summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRiku Nomoto <riku_nomoto@mail.toyota.co.jp>2020-11-19 12:45:32 +0900
committerRiku Nomoto <riku_nomoto@mail.toyota.co.jp>2020-11-19 12:45:32 +0900
commit8e0e00d21146a84c18f9cf9409e187b4fb0248aa (patch)
treeef791689dad216ac61091a1d1bd3b928d563aba6
parent18df6e21c6743a137e2760c52ca89d0789e90417 (diff)
Init basesystem source codes.
Signed-off-by: Riku Nomoto <riku_nomoto@mail.toyota.co.jp> Change-Id: I55aa2f1406ce7f751ae14140b613b53b68995528
-rw-r--r--agl-basefiles/BS/ns/npp/rwdata/version.txt1
-rw-r--r--agl-basefiles/LICENSE177
-rw-r--r--agl-basefiles/agldd/ev_common.h135
-rw-r--r--agl-basefiles/agldd/ev_id.h104
-rw-r--r--agl-basefiles/agldd/evk_lib.h116
-rw-r--r--agl-basefiles/agldd/moduleid.h69
-rw-r--r--agl-basefiles/bin/launch_xml2cfg.sh138
-rw-r--r--agl-basefiles/include/agl_thread.h1385
-rw-r--r--agl-basefiles/include/agl_types_obsoluted.h136
-rw-r--r--agl-basefiles/include/agl_wakeup_order.h27
-rw-r--r--agl-basefiles/include/aglpath.h200
-rw-r--r--agl-basefiles/include/sm_launch_conf.h1385
-rw-r--r--agl-basefiles/share/agl.mk677
-rw-r--r--agl-basefiles/share/rpc_rule.mk42
-rw-r--r--agl-basefiles/share/system_launcher_main.xml40
-rwxr-xr-xagl-systemd/99-agl.rules11
-rwxr-xr-xagl-systemd/LICENSE177
-rwxr-xr-xagl-systemd/agl-trigger.service18
-rwxr-xr-xagl-systemd/env.txt130
-rwxr-xr-xagl-systemd/launch_sm.service22
-rwxr-xr-xagl-systemd/options.conf2
-rwxr-xr-xagl-systemd/setup_refhw.service15
-rwxr-xr-xagl-systemd/systemd-udev-trigger.service22
-rwxr-xr-xagl-systemd/tool_9E_SI/agl_set_capability.sh82
-rwxr-xr-xagl-systemd/tool_9E_SI/launch_sm.sh26
-rwxr-xr-xagl-systemd/tool_9E_SI/set_capability.sh82
-rwxr-xr-xagl-systemd/tool_9E_SI/set_cgroup_rt_runtime_us.sh33
-rwxr-xr-xagl-systemd/tool_9E_SI/setup_refhw.sh83
-rwxr-xr-xagl-systemd/usr/target/agl_cap.lst34
-rwxr-xr-xagl-systemd/usr/target/cap.lst24
-rwxr-xr-xagl-systemd/usr/target/dir.lst0
-rwxr-xr-xagl-systemd/usr/target/mntfs.lst0
-rwxr-xr-xboot_hal/LICENSE177
-rwxr-xr-xboot_hal/Makefile65
-rwxr-xr-xboot_hal/hal_api/boot_hal.h228
-rwxr-xr-xboot_hal/inc/boot_hal_boothallog.h76
-rwxr-xr-xboot_hal/src/boot_hal.cpp313
-rwxr-xr-xcan_hal/LICENSE177
-rwxr-xr-xcan_hal/Makefile19
-rwxr-xr-xcan_hal/README.md3
-rwxr-xr-xcan_hal/can_hal.mk39
-rwxr-xr-xcan_hal/hal_api/can_hal.h303
-rwxr-xr-xcan_hal/src/Makefile52
-rwxr-xr-xcan_hal/src/can_hal_api.cpp166
-rwxr-xr-xcan_hal/src/can_hal_core.cpp372
-rwxr-xr-xcan_hal/src/can_hal_stm.cpp243
-rwxr-xr-xcan_hal/src/driver_can__CWORD31_.c472
-rwxr-xr-xcan_hal/src/inc/can_hal_core.h37
-rwxr-xr-xcan_hal/src/inc/can_hal_frameworkunifiedlog.h76
-rwxr-xr-xcan_hal/src/inc/can_hal_internal.h31
-rwxr-xr-xcan_hal/src/inc/can_hal_stm.h45
-rwxr-xr-xcan_hal/src/inc/can_mng_api.h120
-rwxr-xr-xclock_hal/LICENSE177
-rwxr-xr-xclock_hal/Makefile67
-rwxr-xr-xclock_hal/README.md3
-rwxr-xr-xclock_hal/hal_api/clock_hal.h67
-rwxr-xr-xclock_hal/inc/clock_hal_clockhallog.h76
-rwxr-xr-xclock_hal/src/clock_hal.cpp91
-rwxr-xr-xdeck_hal/LICENSE177
-rwxr-xr-xdeck_hal/Makefile67
-rwxr-xr-xdeck_hal/hal_api/deck_hal.h322
-rwxr-xr-xdeck_hal/inc/deck_hal_deckhallog.h76
-rwxr-xr-xdeck_hal/src/deck_hal.cpp159
-rwxr-xr-xinput_hal/LICENSE177
-rwxr-xr-xinput_hal/Makefile81
-rwxr-xr-xinput_hal/README.md3
-rwxr-xr-xinput_hal/hal_api/input_hal.h696
-rwxr-xr-xinput_hal/hal_api/peripheral_service/aglinput.h536
-rwxr-xr-xinput_hal/hal_api/peripheral_service/extinput.h27
-rwxr-xr-xinput_hal/inc/input_drm.h22
-rwxr-xr-xinput_hal/inc/input_hal_debug.h57
-rwxr-xr-xinput_hal/inc/input_hal_frameworkunifiedlog.h76
-rwxr-xr-xinput_hal/inc/input_hal_internal.h107
-rwxr-xr-xinput_hal/inc/input_touch_ilitek.h27
-rwxr-xr-xinput_hal/inc/input_udev_monitor.h40
-rwxr-xr-xinput_hal/inc/input_util.h46
-rwxr-xr-xinput_hal/src/input_drm.cpp128
-rwxr-xr-xinput_hal/src/input_hal.cpp267
-rwxr-xr-xinput_hal/src/input_touch_ilitek.cpp226
-rwxr-xr-xinput_hal/src/input_udev_monitor.cpp566
-rwxr-xr-xinput_hal/src/input_util.cpp77
-rwxr-xr-xkernel-module-evklib/Makefile30
-rwxr-xr-xkernel-module-evklib/agldd/agldd.h94
-rwxr-xr-xkernel-module-evklib/agldd/ev_common.h135
-rwxr-xr-xkernel-module-evklib/agldd/ev_id.h104
-rwxr-xr-xkernel-module-evklib/agldd/evk_lib.h116
-rwxr-xr-xkernel-module-evklib/agldd/moduleid.h69
-rwxr-xr-xkernel-module-evklib/evk_lib.c2246
-rwxr-xr-xnsframework/backup_manager/LICENSE177
-rwxr-xr-xnsframework/backup_manager/Makefile.client19
-rwxr-xr-xnsframework/backup_manager/Makefile.server19
-rwxr-xr-xnsframework/backup_manager/client/Makefile53
-rwxr-xr-xnsframework/backup_manager/client/include/bkup_api.h60
-rwxr-xr-xnsframework/backup_manager/client/include/native_service/backup_manager.h42
-rwxr-xr-xnsframework/backup_manager/client/include/native_service/ns_backup.h498
-rwxr-xr-xnsframework/backup_manager/client/libns_backup.ver34
-rwxr-xr-xnsframework/backup_manager/client/src/bkup_api.cpp343
-rwxr-xr-xnsframework/backup_manager/config/Makefile42
-rwxr-xr-xnsframework/backup_manager/config/backup.rng123
-rwxr-xr-xnsframework/backup_manager/config/conf/backup/ALL_.xml1216
-rwxr-xr-xnsframework/backup_manager/config/conf/backup/backup_AREA1_L.xml248
-rwxr-xr-xnsframework/backup_manager/config/conf/backup/backup_AREA1_TE.xml248
-rwxr-xr-xnsframework/backup_manager/config/conf/backup/backup_AREA2_T.xml287
-rwxr-xr-xnsframework/backup_manager/config/conf/backup/backup_AREA2_TE.xml289
-rwxr-xr-xnsframework/backup_manager/config/createhdr.pl84
-rwxr-xr-xnsframework/backup_manager/config/sample.xml23
-rwxr-xr-xnsframework/backup_manager/config/uniqcheck.pl46
-rwxr-xr-xnsframework/backup_manager/server/Makefile67
-rwxr-xr-xnsframework/backup_manager/server/include/bkup_backupmanagerlog.h80
-rwxr-xr-xnsframework/backup_manager/server/include/bkup_crc32.h22
-rwxr-xr-xnsframework/backup_manager/server/include/bkup_param.h39
-rwxr-xr-xnsframework/backup_manager/server/include/bkup_process.h31
-rwxr-xr-xnsframework/backup_manager/server/include/bkup_util.h53
-rwxr-xr-xnsframework/backup_manager/server/src/backupmanager_application.cpp277
-rwxr-xr-xnsframework/backup_manager/server/src/backupmanager_main.cpp61
-rwxr-xr-xnsframework/backup_manager/server/src/bkup_crc32.cpp62
-rwxr-xr-xnsframework/backup_manager/server/src/bkup_param.cpp447
-rwxr-xr-xnsframework/backup_manager/server/src/bkup_process.cpp2497
-rwxr-xr-xnsframework/common_library/LICENSE177
-rwxr-xr-xnsframework/common_library/Makefile.client19
-rwxr-xr-xnsframework/common_library/client/Makefile30
-rwxr-xr-xnsframework/common_library/client/include/cl_cgroup.h35
-rwxr-xr-xnsframework/common_library/client/include/cl_error.h44
-rwxr-xr-xnsframework/common_library/client/include/cl_lock_internal.h55
-rwxr-xr-xnsframework/common_library/client/include/cl_monitor_internal.h30
-rwxr-xr-xnsframework/common_library/client/include/cl_process_internal.h53
-rwxr-xr-xnsframework/common_library/client/include/native_service/cl_lock.h259
-rwxr-xr-xnsframework/common_library/client/include/native_service/cl_lockid.h180
-rwxr-xr-xnsframework/common_library/client/include/native_service/cl_monitor.h269
-rwxr-xr-xnsframework/common_library/client/include/native_service/cl_process.h1288
-rwxr-xr-xnsframework/common_library/client/include/native_service/cl_region.h257
-rwxr-xr-xnsframework/common_library/client/include/native_service/cl_sem.h73
-rwxr-xr-xnsframework/common_library/client/include/native_service/common_library.h48
-rwxr-xr-xnsframework/common_library/client/libcommon.ver30
-rwxr-xr-xnsframework/common_library/client/src/cl_cgroup.c260
-rwxr-xr-xnsframework/common_library/client/src/cl_lock.c221
-rwxr-xr-xnsframework/common_library/client/src/cl_monitor.c442
-rwxr-xr-xnsframework/common_library/client/src/cl_process.c1198
-rwxr-xr-xnsframework/common_library/client/src/cl_region.c295
-rwxr-xr-xnsframework/common_library/client/src/cl_sem.c67
-rwxr-xr-xnsframework/framework_unified/LICENSE177
-rwxr-xr-xnsframework/framework_unified/Makefile.client19
-rwxr-xr-xnsframework/framework_unified/client/Makefile269
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_internal.h54
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_parser.h148
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_reader.h133
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_writer.h146
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/include/ns_config_parser_frameworkunifiedlog.h88
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/src/makefile_PosixBasedOS001207
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_parser.cpp365
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_reader.cpp117
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_writer.cpp135
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader.cpp346
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader_writer.cpp74
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/src/ns_config_writer.cpp227
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/src/ns_reader.cpp36
-rwxr-xr-xnsframework/framework_unified/client/NS_ConfigParser/src/ns_writer.cpp36
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_core.h676
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_error_internal.hpp43
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_internal.h675
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_utility.h41
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_msgprofiler.h148
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_finalstate.h97
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h89
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_multithreading_internal.h30
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_dispatcher.cpp2382
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp983
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_error.cpp130
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_logger.cpp575
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp502
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp867
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_session.cpp1357
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_sync.cpp439
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_system.cpp77
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp210
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_multithreading.cpp531
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_service_if.cpp128
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_thread_priority.cpp156
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_timer.cpp67
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/makefile_PosixBasedOS001214
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp32
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp371
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp152
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp79
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp240
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp225
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp79
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp485
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp41
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp148
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp529
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp1419
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp78
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp84
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp211
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp337
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp74
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp634
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp57
-rwxr-xr-xnsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/makefile99
-rwxr-xr-xnsframework/framework_unified/client/NS_Logger/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_Logger/include/frameworkunified_stub.h111
-rwxr-xr-xnsframework/framework_unified/client/NS_Logger/include/ns_logger_internal.h44
-rwxr-xr-xnsframework/framework_unified/client/NS_Logger/src/makefile_PosixBasedOS001223
-rwxr-xr-xnsframework/framework_unified/client/NS_Logger/src/ns_logger.cpp2260
-rwxr-xr-xnsframework/framework_unified/client/NS_Logger/tool/nslogsw.cpp114
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageCenter/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageCenter/include/ns_mc_internal.h93
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageCenter/include/ns_message_center_internal.h185
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageCenter/src/makefile_PosixBasedOS001214
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageCenter/src/ns_message_center.c1269
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageQueue/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_anomaly.h35
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_internal.h58
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageQueue/include/ns_msg_queue.h295
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageQueue/src/makefile_PosixBasedOS001207
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageQueue/src/ns_mq_string.c60
-rwxr-xr-xnsframework/framework_unified/client/NS_MessageQueue/src/ns_msg_queue.c596
-rwxr-xr-xnsframework/framework_unified/client/NS_NPServiceIf/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_NPServiceIf/include/ns_np_service_internal.h75
-rwxr-xr-xnsframework/framework_unified/client/NS_NPServiceIf/src/makefile_PosixBasedOS001208
-rwxr-xr-xnsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_api.c1001
-rwxr-xr-xnsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp498
-rwxr-xr-xnsframework/framework_unified/client/NS_ResourceControler/src/ns_resource_controler.cpp168
-rwxr-xr-xnsframework/framework_unified/client/NS_RingBuffer/src/ns_ringbuffer.cpp1029
-rwxr-xr-xnsframework/framework_unified/client/NS_SharedMemIf/api/nsapi_sharedmem.cpp431
-rwxr-xr-xnsframework/framework_unified/client/NS_SharedMemIf/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_SharedMemIf/src/makefile_PosixBasedOS001190
-rwxr-xr-xnsframework/framework_unified/client/NS_SharedMemIf/src/ns_shared_mem_if.cpp254
-rwxr-xr-xnsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem.cpp697
-rwxr-xr-xnsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_reader.cpp169
-rwxr-xr-xnsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_writer.cpp137
-rwxr-xr-xnsframework/framework_unified/client/NS_Timer/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_Timer/include/ns_timer_handle.h48
-rwxr-xr-xnsframework/framework_unified/client/NS_Timer/include/ns_timer_internal.h28
-rwxr-xr-xnsframework/framework_unified/client/NS_Timer/src/makefile_PosixBasedOS001206
-rwxr-xr-xnsframework/framework_unified/client/NS_Timer/src/mod_version.c51
-rwxr-xr-xnsframework/framework_unified/client/NS_Timer/src/ns_timer.c514
-rwxr-xr-xnsframework/framework_unified/client/NS_Timer/src/ns_timer_class.cpp177
-rwxr-xr-xnsframework/framework_unified/client/NS_Utility/Makefile19
-rwxr-xr-xnsframework/framework_unified/client/NS_Utility/buildversioncheck/Makefile21
-rwxr-xr-xnsframework/framework_unified/client/NS_Utility/buildversioncheck/library/Makefile62
-rwxr-xr-xnsframework/framework_unified/client/NS_Utility/buildversioncheck/library/src/NS_BuildVersionCheck.cpp85
-rwxr-xr-xnsframework/framework_unified/client/NS_UtilityCenter/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_if_internal.h193
-rwxr-xr-xnsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_sys_internal.hpp353
-rwxr-xr-xnsframework/framework_unified/client/NS_UtilityCenter/src/frameworkunified_version.cpp236
-rwxr-xr-xnsframework/framework_unified/client/NS_UtilityCenter/src/makefile_PosixBasedOS001194
-rwxr-xr-xnsframework/framework_unified/client/NS_UtilityCenter/src/ns_endianess.cpp52
-rwxr-xr-xnsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_crc.cpp125
-rwxr-xr-xnsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_directory.cpp145
-rwxr-xr-xnsframework/framework_unified/client/NS_UtilityCenter/src/ns_utility.cpp144
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/Makefile20
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile19
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h113
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h104
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h60
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h88
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile57
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001208
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp522
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp338
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp354
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp55
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp658
-rwxr-xr-xnsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp367
-rwxr-xr-xnsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp325
-rwxr-xr-xnsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h20
-rwxr-xr-xnsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001208
-rwxr-xr-xnsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h51
-rwxr-xr-xnsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h64
-rwxr-xr-xnsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp538
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/Makefile29
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_arm.mk88
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_armv7.mk96
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_x86.mk89
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/cfg/analysis.mk73
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/cfg/common.mk175
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/cfg/config.mk115
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/cfg/depends.mk115
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/cfg/nativeserviceslibraries.mk54
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/makefile_PosixBasedOS00155
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/scfg/ns_filestorage.sql9
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog.cfg278
-rwxr-xr-xnsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg427
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/XMLParser.h289
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/framework_unified.h130
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__service_if.h554
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__session_if.h495
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_application.h376
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_dispatcher.h803
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_framework_error.hpp77
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_framework_if.h6007
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_framework_sync.h370
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_framework_system_if.h110
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_framework_types.h173
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_multithreading.h745
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_service_if.h267
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_service_protocol.h116
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_action.h150
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_compositestate.h434
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_conditionconnector.h203
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_deephistorystate.h141
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_dispatcher.h338
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventdata.h83
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventfactory.h114
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_externaltransition.h268
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_dispatch.h1054
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_if.h486
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_types.h494
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_guard.h145
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_historystate.h253
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsm.h798
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsmframework.h873
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_internaltransition.h111
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_leafstate.h252
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_localtransition.h163
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_multithreading.h227
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_orthogonalstate.h513
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_reaction.h184
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_shallowhistorystate.h163
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_state.h872
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_sm_transition.h150
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_thread_priority.h235
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_timer.h143
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/frameworkunified_types.h268
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns__CWORD77__common.h129
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_if.h183
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_key.h53
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_table.h1217
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns__CWORD77__notifications.h53
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns__CWORD77__types.h68
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_buildversioncheck.hpp227
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_config_parser_if.h1038
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_endianess.h192
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_eventlogger.h103
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_logger_if.h1646
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_mc_system_info.h103
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_message_center_if.h1536
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_msgs.h64
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_np_service.h271
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_np_service_if.h2482
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence.h151
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence_internal.h131
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_np_service_notification.h50
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_np_service_protocol.h116
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_np_types.h47
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_plogger_if.h288
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_rcs_data_handler.hpp1159
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_rcs_logger_types.h104
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_rcs_plugin.hpp328
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_reader.h207
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_resource_controler.h216
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_ringbuffer.h523
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_shared_mem.h100
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_shared_mem_if.h196
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_sharedmem.h486
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_sharedmem_reader.h340
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_sharedmem_writer.h283
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_system_mode.h67
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_timer_if.h317
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_timer_if.hpp393
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_transmit_log.h256
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_util_crc.h111
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_util_directory.h160
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_utility.hpp572
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_utility_if.h76
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_utility_sys.hpp321
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_version.h48
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_version_if.h510
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_writer.h229
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_xml_reader.h291
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_xml_writer.h336
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/ns_xmlparser_if.h1150
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/nsfw_message.h65
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/nslogutil_cmd_if.h86
-rwxr-xr-xnsframework/framework_unified/client/include/native_service/wpf_legacy.h152
-rwxr-xr-xnsframework/framework_unified/client/include/ns__CWORD77__template.h60
-rwxr-xr-xnsframework/framework_unified/client/include/ns_logger_additional_if.h40
-rwxr-xr-xnsframework/framework_unified/client/include/nsverutil_cmd_if.h25
-rwxr-xr-xnsframework/framework_unified/client/libNS_FrameworkUnified.ver144
-rwxr-xr-xnsframework/log_library/LICENSE177
-rwxr-xr-xnsframework/log_library/Makefile.client19
-rwxr-xr-xnsframework/log_library/client/Makefile32
-rwxr-xr-xnsframework/log_library/client/include/loglibrarylog_internal.h26
-rwxr-xr-xnsframework/log_library/client/include/native_service/loglibrarylog_if.h79
-rwxr-xr-xnsframework/log_library/client/include/native_service/loglibrarylog_library.h42
-rwxr-xr-xnsframework/log_library/client/src/loglibrarylog.c60
-rwxr-xr-xnsframework/native_service.mk44
-rwxr-xr-xnsframework/notification_persistent_service/LICENSE177
-rwxr-xr-xnsframework/notification_persistent_service/Makefile.server19
-rwxr-xr-xnsframework/notification_persistent_service/server/Makefile87
-rwxr-xr-xnsframework/notification_persistent_service/server/include/app_states.h187
-rwxr-xr-xnsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h40
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp.h296
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h230
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h558
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h111
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_handlelist.h145
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h218
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_notification.h323
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h496
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h68
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h94
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_persist_file.h121
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h122
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_persistence.h365
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h536
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h119
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h165
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_personality.h75
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h132
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h34
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h330
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h109
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h177
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_state_notification.h221
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h104
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h73
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_threads.h46
-rwxr-xr-xnsframework/notification_persistent_service/server/include/ns_npp_types.h212
-rwxr-xr-xnsframework/notification_persistent_service/server/src/app_states.cpp2684
-rwxr-xr-xnsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp258
-rwxr-xr-xnsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp131
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp.cpp1149
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_archive.cpp846
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp649
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp1153
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp232
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp149
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp747
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_notification.cpp485
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp1558
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp50
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp100
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp96
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp743
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp1132
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp58
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp181
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp333
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp158
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp305
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp402
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp87
-rwxr-xr-xnsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp61
-rwxr-xr-xnv_hal/LICENSE177
-rwxr-xr-xnv_hal/Makefile65
-rwxr-xr-xnv_hal/hal_api/nv_hal.h245
-rwxr-xr-xnv_hal/inc/nv_hal_nvhallog.h76
-rwxr-xr-xnv_hal/src/nv_hal.cpp242
-rwxr-xr-xotherservice/event_library/LICENSE177
-rwxr-xr-xotherservice/event_library/Makefile.client18
-rwxr-xr-xotherservice/event_library/library/Makefile37
-rwxr-xr-xotherservice/event_library/library/include/other_service/ev_lib.h1856
-rwxr-xr-xotherservice/event_library/library/include/other_service/event_library.h39
-rwxr-xr-xotherservice/event_library/library/libev.ver41
-rwxr-xr-xotherservice/event_library/library/src/ev_lib.c1551
-rwxr-xr-xotherservice/other_service.mk42
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/LICENSE177
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/Makefile.client20
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/Makefile48
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h83
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h86
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/include/other_service/itoa.h74
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h46
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/include/other_service/strlcat.h78
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h78
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/include/other_service/ultoa.h74
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c56
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c57
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/src/itoa.c45
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/src/strlcat.c40
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/src/strlcpy.c49
-rwxr-xr-xotherservice/posix_based_os001_legacy_library/library/src/ultoa.c33
-rwxr-xr-xotherservice/rpc_library/LICENSE177
-rwxr-xr-xotherservice/rpc_library/Makefile.client19
-rwxr-xr-xotherservice/rpc_library/library/Makefile46
-rwxr-xr-xotherservice/rpc_library/library/include/other_service/rpc.h765
-rwxr-xr-xotherservice/rpc_library/library/include/other_service/rpc_id.h96
-rwxr-xr-xotherservice/rpc_library/library/include/other_service/rpc_library.h41
-rwxr-xr-xotherservice/rpc_library/library/include/rpc_internal.h135
-rwxr-xr-xotherservice/rpc_library/library/include/rpc_thread.h240
-rwxr-xr-xotherservice/rpc_library/library/include/rpc_udp.h162
-rwxr-xr-xotherservice/rpc_library/library/librpc.ver29
-rwxr-xr-xotherservice/rpc_library/library/src/rpc_event.c158
-rwxr-xr-xotherservice/rpc_library/library/src/rpc_lib.c1264
-rwxr-xr-xotherservice/rpc_library/library/src/rpc_marshall.c740
-rwxr-xr-xotherservice/rpc_library/library/src/rpc_thread.c1224
-rwxr-xr-xotherservice/rpc_library/library/src/rpc_udp.c473
-rwxr-xr-xotherservice/rpc_library/tool/Makefile62
-rwxr-xr-xotherservice/rpc_library/tool/apidef.cc1104
-rwxr-xr-xotherservice/rpc_library/tool/apidef.h333
-rwxr-xr-xotherservice/rpc_library/tool/apidef.l136
-rwxr-xr-xotherservice/rpc_library/tool/apidef.y615
-rwxr-xr-xotherservice/rpc_library/tool_for_arm/Makefile50
-rwxr-xr-xotherservice/vehicle_parameter_library/LICENSE177
-rwxr-xr-xotherservice/vehicle_parameter_library/Makefile.client18
-rwxr-xr-xotherservice/vehicle_parameter_library/library/Makefile40
-rwxr-xr-xotherservice/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h90
-rwxr-xr-xotherservice/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h133
-rwxr-xr-xotherservice/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h114
-rwxr-xr-xotherservice/vehicle_parameter_library/library/include/other_service/env_ext.h45
-rwxr-xr-xotherservice/vehicle_parameter_library/library/include/other_service/env_vehicle.h331
-rwxr-xr-xotherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h138
-rwxr-xr-xotherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h46
-rwxr-xr-xotherservice/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h46
-rwxr-xr-xotherservice/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c732
-rwxr-xr-xotherservice/vehicle_parameter_library/library/src/VP_GetEnv.c291
-rwxr-xr-xperipheralservice/.gitattributes128
-rwxr-xr-xperipheralservice/communication/LICENSE177
-rwxr-xr-xperipheralservice/communication/Makefile.client18
-rwxr-xr-xperipheralservice/communication/Makefile.server18
-rwxr-xr-xperipheralservice/communication/client_can/Makefile72
-rwxr-xr-xperipheralservice/communication/client_can/include/API_Local_Common.h55
-rwxr-xr-xperipheralservice/communication/client_can/include/Canif_API_Local.h46
-rwxr-xr-xperipheralservice/communication/client_can/include/Canif_TransmissionData.h48
-rwxr-xr-xperipheralservice/communication/client_can/include/Canif_TransmissionData21PF.h30
-rwxr-xr-xperipheralservice/communication/client_can/include/peripheral_service/Canif_API.h1158
-rwxr-xr-xperipheralservice/communication/client_can/include/peripheral_service/communication_can.h28
-rwxr-xr-xperipheralservice/communication/client_can/libCAN_API.ver36
-rwxr-xr-xperipheralservice/communication/client_can/src/Canif_API.cpp301
-rwxr-xr-xperipheralservice/communication/server/Makefile96
-rwxr-xr-xperipheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h42
-rwxr-xr-xperipheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h22
-rwxr-xr-xperipheralservice/communication/server/include/CAN/Command/CAN_Command.h21
-rwxr-xr-xperipheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h40
-rwxr-xr-xperipheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h137
-rwxr-xr-xperipheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h54
-rwxr-xr-xperipheralservice/communication/server/include/com_error_type.h21
-rwxr-xr-xperipheralservice/communication/server/include/main/communication_cid.h33
-rwxr-xr-xperipheralservice/communication/server/include/main/communication_communicationlog.h94
-rwxr-xr-xperipheralservice/communication/server/include/main/communication_version.h45
-rwxr-xr-xperipheralservice/communication/server/include/peripheral_service/communication.h29
-rwxr-xr-xperipheralservice/communication/server/include/peripheral_service/communication_notifications.h28
-rwxr-xr-xperipheralservice/communication/server/include/peripheral_service/ps_services.h94
-rwxr-xr-xperipheralservice/communication/server/include/threads/CAN_Thread.h51
-rwxr-xr-xperipheralservice/communication/server/include/threads/Thread_Common.h42
-rwxr-xr-xperipheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp240
-rwxr-xr-xperipheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp405
-rwxr-xr-xperipheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp416
-rwxr-xr-xperipheralservice/communication/server/src/main/communication_application.cpp226
-rwxr-xr-xperipheralservice/communication/server/src/main/communication_main.cpp154
-rwxr-xr-xperipheralservice/communication/server/src/threads/CAN_Thread.cpp238
-rwxr-xr-xperipheralservice/communication/server/src/threads/Thread_Common.cpp182
-rwxr-xr-xperipheralservice/peripheral_service.mk44
-rwxr-xr-xpositioning_hal/LICENSE177
-rwxr-xr-xpositioning_hal/Makefile91
-rwxr-xr-xpositioning_hal/README.md3
-rwxr-xr-xpositioning_hal/hal_api/gps_hal.h932
-rwxr-xr-xpositioning_hal/hal_api/positioning_hal.h872
-rwxr-xr-xpositioning_hal/inc/Common/LineSensDrv_Api.h44
-rwxr-xr-xpositioning_hal/inc/Common/MDev_Gps_API.h51
-rwxr-xr-xpositioning_hal/inc/Common/positioning_common.h63
-rwxr-xr-xpositioning_hal/inc/Common/positioning_def.h307
-rwxr-xr-xpositioning_hal/inc/Common/positioning_log.h43
-rwxr-xr-xpositioning_hal/inc/GpsCommon/MDev_GpsRecv.h170
-rwxr-xr-xpositioning_hal/inc/GpsCommon/MDev_GpsRollOver.h34
-rwxr-xr-xpositioning_hal/inc/GpsCommon/MDev_Gps_Common.h187
-rwxr-xr-xpositioning_hal/inc/GpsCommon/MDev_Gps_Main.h311
-rwxr-xr-xpositioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h90
-rwxr-xr-xpositioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h313
-rwxr-xr-xpositioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h113
-rwxr-xr-xpositioning_hal/inc/LineSensDrv/LineSensDrv_Sensor.h183
-rwxr-xr-xpositioning_hal/inc/LineSensDrv/LineSensDrv_Thread.h66
-rwxr-xr-xpositioning_hal/src/Common/positioning_common.cpp388
-rwxr-xr-xpositioning_hal/src/Common/positioning_hal.cpp49
-rwxr-xr-xpositioning_hal/src/GpsCommon/MDev_GpsRecv.cpp608
-rwxr-xr-xpositioning_hal/src/GpsCommon/MDev_GpsRollOver.cpp275
-rwxr-xr-xpositioning_hal/src/GpsCommon/MDev_Gps_API.cpp491
-rwxr-xr-xpositioning_hal/src/GpsCommon/MDev_Gps_Common.cpp2105
-rwxr-xr-xpositioning_hal/src/GpsCommon/MDev_Gps_Main.cpp362
-rwxr-xr-xpositioning_hal/src/GpsCommon/MDev_Gps_Mtrx.cpp866
-rwxr-xr-xpositioning_hal/src/GpsCommon/MDev_Gps_Nmea.cpp928
-rwxr-xr-xpositioning_hal/src/GpsCommon/MDev_Gps_TimerCtrl.cpp293
-rwxr-xr-xpositioning_hal/src/LineSensDrv/LineSensDrv_Api.cpp136
-rwxr-xr-xpositioning_hal/src/LineSensDrv/LineSensDrv_Sensor.cpp622
-rwxr-xr-xpositioning_hal/src/LineSensDrv/LineSensDrv_Thread.cpp125
-rwxr-xr-xpower_hal/LICENSE177
-rwxr-xr-xpower_hal/Makefile66
-rwxr-xr-xpower_hal/README.md3
-rwxr-xr-xpower_hal/hal_api/power_hal.h572
-rwxr-xr-xpower_hal/src/power_hal.cpp97
-rwxr-xr-xsecurity_hal/LICENSE177
-rwxr-xr-xsecurity_hal/Makefile67
-rwxr-xr-xsecurity_hal/hal_api/security_hal.h1131
-rwxr-xr-xsecurity_hal/inc/security_hal_securityhallog.h76
-rwxr-xr-xsecurity_hal/src/security_hal.cpp615
-rwxr-xr-xsoc_temperature_hal/LICENSE177
-rwxr-xr-xsoc_temperature_hal/Makefile66
-rwxr-xr-xsoc_temperature_hal/hal_api/soc_temperature_hal.h89
-rwxr-xr-xsoc_temperature_hal/inc/soc_temperature_hal_soctemperaturehallog.h75
-rwxr-xr-xsoc_temperature_hal/src/soc_temperature_hal.cpp106
-rwxr-xr-xstub/clock/LICENSE177
-rwxr-xr-xstub/clock/Makefile.client19
-rwxr-xr-xstub/clock/client_clock/Makefile45
-rwxr-xr-xstub/clock/client_clock/include/stub/Clock_API.h503
-rwxr-xr-xstub/clock/client_clock/include/stub/clock_clock.h41
-rwxr-xr-xstub/clock/client_clock/libClock_API.ver29
-rwxr-xr-xstub/clock/client_clock/src/Clock_API.cpp118
-rwxr-xr-xstub/clock/client_display_time/Makefile47
-rwxr-xr-xstub/clock/client_display_time/include/stub/DTime_Api.h916
-rwxr-xr-xstub/clock/client_display_time/include/stub/clock_display_time.h42
-rwxr-xr-xstub/clock/client_display_time/include/stub/clock_notifications.h46
-rwxr-xr-xstub/clock/client_display_time/libDTime_Api.ver31
-rwxr-xr-xstub/clock/client_display_time/src/DTime_Api.cpp246
-rwxr-xr-xstub/clock/localtime/Makefile49
-rwxr-xr-xstub/clock/localtime/zoneinfo_base232
-rwxr-xr-xstub/communication_subcpu/LICENSE177
-rwxr-xr-xstub/communication_subcpu/Makefile19
-rwxr-xr-xstub/communication_subcpu/client/Makefile43
-rwxr-xr-xstub/communication_subcpu/client/include/stub/CommSubCpu_API.h266
-rwxr-xr-xstub/communication_subcpu/client/include/stub/com_message_header.h65
-rwxr-xr-xstub/communication_subcpu/client/src/CommSubCpu_API.cpp57
-rwxr-xr-xstub/communication_usb/LICENSE177
-rwxr-xr-xstub/communication_usb/Makefile19
-rwxr-xr-xstub/communication_usb/client/Makefile43
-rwxr-xr-xstub/communication_usb/client/include/stub/commusb_api.h186
-rwxr-xr-xstub/communication_usb/client/include/stub/commusb_notifications.h56
-rwxr-xr-xstub/communication_usb/client/src/commusb_api.cpp33
-rwxr-xr-xstub/diag_code/LICENSE177
-rwxr-xr-xstub/diag_code/Makefile18
-rwxr-xr-xstub/diag_code/library/Makefile51
-rwxr-xr-xstub/diag_code/library/include/stub/DIAGCODE.h46
-rwxr-xr-xstub/diag_code/library/include/stub/DiagCodeAPI.h1226
-rwxr-xr-xstub/diag_code/library/include/stub/ss_diag.h24
-rwxr-xr-xstub/diag_code/library/libDiagCodeAPI.ver64
-rwxr-xr-xstub/diag_code/library/src/DiagCodeAPI.cpp202
-rwxr-xr-xstub/diag_code/library_dummy_dccc/Makefile46
-rwxr-xr-xstub/diag_code/library_dummy_dccc/include/stub/DIAG_API_DCCC.h109
-rwxr-xr-xstub/diag_code/library_dummy_dccc/src/DIAG_API_DCCC.cpp64
-rwxr-xr-xstub/diag_record/LICENSE177
-rwxr-xr-xstub/diag_record/Makefile19
-rwxr-xr-xstub/diag_record/library_dummy_drec/Makefile48
-rwxr-xr-xstub/diag_record/library_dummy_drec/include/stub/MM_DREC_API.h2203
-rwxr-xr-xstub/diag_record/library_dummy_drec/src/MM_DREC_API.cpp450
-rwxr-xr-xstub/diag_record/library_record_api/Makefile47
-rwxr-xr-xstub/diag_record/library_record_api/include/stub/PFDREC_API.h975
-rwxr-xr-xstub/diag_record/library_record_api/libDiagRecordAPI.ver44
-rwxr-xr-xstub/diag_record/library_record_api/src/DiagRecordAPI.cpp178
-rwxr-xr-xstub/diag_record/library_record_thread/Makefile47
-rwxr-xr-xstub/diag_record/library_record_thread/include/stub/pfdrec_thread_ifc.h168
-rwxr-xr-xstub/diag_record/library_record_thread/src/pfdrec_thread.cpp162
-rwxr-xr-xstub/memory_gpio_access_library/LICENSE177
-rwxr-xr-xstub/memory_gpio_access_library/Makefile20
-rwxr-xr-xstub/memory_gpio_access_library/client/Makefile44
-rwxr-xr-xstub/memory_gpio_access_library/client/include/stub/el_gpio.h802
-rwxr-xr-xstub/memory_gpio_access_library/client/include/stub/el_mem.h396
-rwxr-xr-xstub/memory_gpio_access_library/client/src/el_gpio.c79
-rwxr-xr-xstub/memory_gpio_access_library/client/src/el_mem.c73
-rwxr-xr-xstub/stub.mk42
-rwxr-xr-xstub/vehicle/LICENSE177
-rwxr-xr-xstub/vehicle/Makefile19
-rwxr-xr-xstub/vehicle/client/Makefile60
-rwxr-xr-xstub/vehicle/client/include/stub/Vehicle_API.h298
-rwxr-xr-xstub/vehicle/client/include/stub/Vehicle_Sensor_Common_API.h502
-rwxr-xr-xstub/vehicle/client/include/stub/vehicle_notifications.h48
-rwxr-xr-xstub/vehicle/client/libVehicle_API.ver28
-rwxr-xr-xstub/vehicle/client/src/Vehicle_API.cpp43
-rwxr-xr-xsystemservice/config/LICENSE177
-rwxr-xr-xsystemservice/config/Makefile.client19
-rwxr-xr-xsystemservice/config/library/Makefile19
-rwxr-xr-xsystemservice/config/library/system_manager_config/Makefile21
-rwxr-xr-xsystemservice/config/library/system_manager_config/include/system_service/ss_access_if_private.h80
-rwxr-xr-xsystemservice/config/library/system_manager_config/include/system_service/ss_package.h65
-rwxr-xr-xsystemservice/config/library/system_manager_config/include/system_service/ss_system_manager_conf.h145
-rwxr-xr-xsystemservice/config/library/system_manager_config/include/system_service/system_manager_config.h26
-rwxr-xr-xsystemservice/config/library/system_manager_config/last2order/Makefile71
-rwxr-xr-xsystemservice/config/library/system_manager_config/last2order/sm_last2order.cfobin0 -> 8 bytes
-rwxr-xr-xsystemservice/config/library/system_manager_config/last2order/tool/mklast2ordertbl.pl107
-rwxr-xr-xsystemservice/config/library/system_manager_config/order/Makefile64
-rwxr-xr-xsystemservice/config/library/system_manager_config/order/launch_order_body.xml0
-rwxr-xr-xsystemservice/config/library/system_manager_config/order/launch_order_main.xml23
-rwxr-xr-xsystemservice/config/library/system_manager_config/order/launch_order_xml2cfg.pl171
-rwxr-xr-xsystemservice/config/library/system_manager_config/order/system_launcher_main.order.cfg3
-rwxr-xr-xsystemservice/config/library/system_manager_config/order/system_launcher_main.xml36
-rwxr-xr-xsystemservice/config/library/system_manager_config/src/Makefile45
-rwxr-xr-xsystemservice/config/library/system_manager_config/src/libsssmcfg.ver30
-rwxr-xr-xsystemservice/config/library/system_manager_config/src/ss_system_manager_conf.cpp489
-rwxr-xr-xsystemservice/config/library/system_manager_config/xml/Makefile53
-rwxr-xr-xsystemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh69
-rwxr-xr-xsystemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh116
-rwxr-xr-xsystemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg7
-rwxr-xr-xsystemservice/config/library/system_manager_config/xml/sm_launch_agl.xml35
-rwxr-xr-xsystemservice/interface_unified/LICENSE177
-rwxr-xr-xsystemservice/interface_unified/Makefile.client33
-rwxr-xr-xsystemservice/interface_unified/library/Makefile127
-rwxr-xr-xsystemservice/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h86
-rwxr-xr-xsystemservice/interface_unified/library/include/ss_last_to_order_local.h41
-rwxr-xr-xsystemservice/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h86
-rwxr-xr-xsystemservice/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h85
-rwxr-xr-xsystemservice/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h89
-rwxr-xr-xsystemservice/interface_unified/library/include/ss_system_timer_local.h44
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/interface_unified.h100
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/interfaceunified_system_application.h219
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/interfaceunified_system_types.h165
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_boot_map.h25
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_client_names.h77
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_devicedetection_service.h640
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h1118
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_devicedetection_service_local.h37
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h58
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h143
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h69
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types.h186
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h44
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_error_event_common.h111
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_error_event_common_local.h63
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_error_message.h40
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_heartbeat_if.h165
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_heartbeat_notifications.h46
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h72
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_last_to_order.h58
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_logger_service.h255
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_logger_service_ifc.h1865
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_logger_service_local.h94
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_logger_service_notifications.h47
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_logger_service_protocol.h146
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_logger_store_logs.h81
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_power_service.h535
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_power_service_if.h606
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_power_service_local.h66
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_power_service_notifications.h48
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_power_service_notifications_local.h67
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_power_service_protocol.h201
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_services.h63
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_sm_client_if.h1064
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_sm_client_if_local.h66
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_sm_thread_names.h45
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_sm_thread_names_local.h46
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_string_maps.h680
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_sys_boot_area_map.h39
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_system_if.h119
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_system_manager_if.h335
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_system_manager_if_local.h40
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_system_manager_notifications.h49
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h51
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_system_manager_protocol.h329
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h45
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_system_process.h1118
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_system_timer.h670
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_system_types.h36
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_templates.h303
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_test_clients.h31
-rwxr-xr-xsystemservice/interface_unified/library/include/system_service/ss_version.h33
-rwxr-xr-xsystemservice/interface_unified/library/src/libSS_SystemIfUnified.ver78
-rwxr-xr-xsystemservice/interface_unified/library/src/makefile_PosixBasedOS001180
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_devicedetection_service_ifc.cpp673
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_framework_if.cpp55
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_heartbeat_client.cpp156
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_last_to_order.cpp186
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_logger_service_ifc.cpp781
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_power_client.cpp254
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_pwrsvc_if.cpp343
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_sm_client.cpp1509
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_string_maps.cpp462
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_system_process.cpp1147
-rwxr-xr-xsystemservice/interface_unified/library/src/ss_system_timer.cpp228
-rwxr-xr-xsystemservice/interface_unified/scfg/gpf_ss_cpu_mon_config.cfg14
-rwxr-xr-xsystemservice/interface_unified/scfg/gpf_ss_ps_config.cfg20
-rwxr-xr-xsystemservice/interface_unified/scfg/gpf_ss_showmem.cfg6
-rwxr-xr-xsystemservice/interface_unified/scfg/ss_cpu_high_load_monitor.cfg85
-rwxr-xr-xsystemservice/interface_unified/scfg/ss_logger.cfg133
-rwxr-xr-xsystemservice/interface_unified/scfg/system_launch_flashloader.cfg8
-rwxr-xr-xsystemservice/interface_unified/scfg_pram/gpf_ss_sm_config_data.cfg26
-rwxr-xr-xsystemservice/logger_service/LICENSE177
-rwxr-xr-xsystemservice/logger_service/Makefile.server19
-rwxr-xr-xsystemservice/logger_service/server/Makefile28
-rwxr-xr-xsystemservice/logger_service/server/SS_LoggerService.conf_bin4
-rwxr-xr-xsystemservice/logger_service/server/include/loggerservicedebug_loggerservicelog.h81
-rwxr-xr-xsystemservice/logger_service/server/include/loggerservicedebug_thread_if.h319
-rwxr-xr-xsystemservice/logger_service/server/include/loggerservicedebug_writer_Evntworker.h211
-rwxr-xr-xsystemservice/logger_service/server/include/readerWriter/reader/mem_reader.h51
-rwxr-xr-xsystemservice/logger_service/server/include/readerWriter/reader/queue_reader.h49
-rwxr-xr-xsystemservice/logger_service/server/include/readerWriter/reader/reader.h52
-rwxr-xr-xsystemservice/logger_service/server/include/readerWriter/reader_writer.h77
-rwxr-xr-xsystemservice/logger_service/server/include/readerWriter/reader_writer_cfg.h35
-rwxr-xr-xsystemservice/logger_service/server/include/readerWriter/writer/cached_file_writer.h45
-rwxr-xr-xsystemservice/logger_service/server/include/readerWriter/writer/file_writer.h51
-rwxr-xr-xsystemservice/logger_service/server/include/readerWriter/writer/udp_file_writer.h54
-rwxr-xr-xsystemservice/logger_service/server/include/readerWriter/writer/udp_writer.h63
-rwxr-xr-xsystemservice/logger_service/server/include/readerWriter/writer/writer.h56
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_cfg.h185
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_common.h115
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_device_detection.h66
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_error_event.h156
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_error_event_archive.h77
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_error_event_can_evt_reply.h48
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_error_event_cfg.h135
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_error_event_storage.h82
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_fs_directory.h108
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_popups.h51
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_reader_writer_control.h49
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_scrshot.h30
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_service_callbacks.h96
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_types.h52
-rwxr-xr-xsystemservice/logger_service/server/include/ss_logger_util.h127
-rwxr-xr-xsystemservice/logger_service/server/lib/Makefile62
-rwxr-xr-xsystemservice/logger_service/server/lib/ss_logger_store_logs.cpp2233
-rwxr-xr-xsystemservice/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h96
-rwxr-xr-xsystemservice/logger_service/server/realtimeUsbLog/Makefile22
-rwxr-xr-xsystemservice/logger_service/server/realtimeUsbLog/realtimeUsbLog.conf_bin4
-rwxr-xr-xsystemservice/logger_service/server/realtimeUsbLog/src/Makefile74
-rwxr-xr-xsystemservice/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp103
-rwxr-xr-xsystemservice/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp722
-rwxr-xr-xsystemservice/logger_service/server/realtimeUsbLog/work/Makefile23
-rwxr-xr-xsystemservice/logger_service/server/realtimeUsbLog/work_debug/Makefile19
-rwxr-xr-xsystemservice/logger_service/server/screenShot/Makefile52
-rwxr-xr-xsystemservice/logger_service/server/screenShot/ss_logger_scrshot.cpp89
-rwxr-xr-xsystemservice/logger_service/server/src/cached_file_writer.cpp79
-rwxr-xr-xsystemservice/logger_service/server/src/file_writer.cpp122
-rwxr-xr-xsystemservice/logger_service/server/src/loggerservice_application.cpp952
-rwxr-xr-xsystemservice/logger_service/server/src/loggerservice_main.cpp59
-rwxr-xr-xsystemservice/logger_service/server/src/loggerservicedebug_child_thread.cpp134
-rwxr-xr-xsystemservice/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp1362
-rwxr-xr-xsystemservice/logger_service/server/src/mem_reader.cpp125
-rwxr-xr-xsystemservice/logger_service/server/src/mod_version.c49
-rwxr-xr-xsystemservice/logger_service/server/src/queue_reader.cpp101
-rwxr-xr-xsystemservice/logger_service/server/src/reader.cpp86
-rwxr-xr-xsystemservice/logger_service/server/src/reader_writer.cpp282
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_cfg.cpp754
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_device_detection.cpp209
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_error_event.cpp1047
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_error_event_archive.cpp413
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp147
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_error_event_cfg.cpp335
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_error_event_responses.cpp625
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_error_event_storage.cpp628
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_fs_directory.cpp236
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_popups.cpp176
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_reader_writer_control.cpp151
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_server_callbacks.cpp900
-rwxr-xr-xsystemservice/logger_service/server/src/ss_logger_util.cpp1273
-rwxr-xr-xsystemservice/logger_service/server/src/testapps/fopen0
-rwxr-xr-xsystemservice/logger_service/server/src/testapps/testapps.log0
-rwxr-xr-xsystemservice/logger_service/server/src/testapps/testapps.tar.gz0
-rwxr-xr-xsystemservice/logger_service/server/src/udp_file_writer.cpp161
-rwxr-xr-xsystemservice/logger_service/server/src/udp_writer.cpp295
-rwxr-xr-xsystemservice/logger_service/server/src/writer.cpp86
-rwxr-xr-xsystemservice/logger_service/server/work/Makefile126
-rwxr-xr-xsystemservice/power_service/LICENSE177
-rwxr-xr-xsystemservice/power_service/Makefile.server19
-rwxr-xr-xsystemservice/power_service/server/Makefile51
-rwxr-xr-xsystemservice/power_service/server/include/ss_power.h318
-rwxr-xr-xsystemservice/power_service/server/include/ss_power_config.h147
-rwxr-xr-xsystemservice/power_service/server/include/ss_power_powerservicelog.h85
-rwxr-xr-xsystemservice/power_service/server/include/ss_power_session.h70
-rwxr-xr-xsystemservice/power_service/server/include/ss_power_state_hysteresis.h74
-rwxr-xr-xsystemservice/power_service/server/include/ss_power_state_machine.h414
-rwxr-xr-xsystemservice/power_service/server/src/powerservice_application.cpp236
-rwxr-xr-xsystemservice/power_service/server/src/powerservice_main.cpp70
-rwxr-xr-xsystemservice/power_service/server/src/ss_power.cpp1672
-rwxr-xr-xsystemservice/power_service/server/src/ss_power_config.cpp188
-rwxr-xr-xsystemservice/power_service/server/src/ss_power_session.cpp276
-rwxr-xr-xsystemservice/power_service/server/src/ss_power_state_machine.cpp924
-rwxr-xr-xsystemservice/power_service/server/src/ss_pwr_test_client_handlers.cpp204
-rwxr-xr-xsystemservice/power_service/server/src/ss_supervisor_handlers.cpp498
-rwxr-xr-xsystemservice/power_service/server/src/ss_system_handlers.cpp52
-rwxr-xr-xsystemservice/resource_manager/LICENSE177
-rwxr-xr-xsystemservice/resource_manager/Makefile.client21
-rwxr-xr-xsystemservice/resource_manager/Makefile.server23
-rwxr-xr-xsystemservice/resource_manager/client/Makefile58
-rwxr-xr-xsystemservice/resource_manager/client/RESMGR.api12
-rwxr-xr-xsystemservice/resource_manager/client/include/resmgr_api_resourcemanagerlog.h78
-rwxr-xr-xsystemservice/resource_manager/client/libresm.ver28
-rwxr-xr-xsystemservice/resource_manager/client/src/#resmgr_api_lib.c#142
-rwxr-xr-xsystemservice/resource_manager/client/src/resmgr_api_lib.c142
-rwxr-xr-xsystemservice/resource_manager/drop_caches/Makefile38
-rwxr-xr-xsystemservice/resource_manager/drop_caches/src/drop_caches.cpp183
-rwxr-xr-xsystemservice/resource_manager/server/Makefile55
-rwxr-xr-xsystemservice/resource_manager/server/include/proc_watch.h25
-rwxr-xr-xsystemservice/resource_manager/server/include/resm_cfg.h132
-rwxr-xr-xsystemservice/resource_manager/server/include/resm_internal.h40
-rwxr-xr-xsystemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h82
-rwxr-xr-xsystemservice/resource_manager/server/include/system_service/resm.h325
-rwxr-xr-xsystemservice/resource_manager/server/include/system_service/resm_type.h85
-rwxr-xr-xsystemservice/resource_manager/server/include/system_service/resource_manager.h43
-rwxr-xr-xsystemservice/resource_manager/server/src/cpuload_custom.cpp512
-rwxr-xr-xsystemservice/resource_manager/server/src/proc_watch.cpp285
-rwxr-xr-xsystemservice/resource_manager/server/src/resm.cpp2667
-rwxr-xr-xsystemservice/resource_manager/server/src/resourcemanager_application.cpp155
-rwxr-xr-xsystemservice/rom_access_library/LICENSE177
-rwxr-xr-xsystemservice/rom_access_library/Makefile.client19
-rwxr-xr-xsystemservice/rom_access_library/library/Makefile19
-rwxr-xr-xsystemservice/rom_access_library/library/include/rom_access_library_nor.h43
-rwxr-xr-xsystemservice/rom_access_library/library/include/rom_access_library_rom.h45
-rwxr-xr-xsystemservice/rom_access_library/library/include/ss_rom_access_define.h38
-rwxr-xr-xsystemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h89
-rwxr-xr-xsystemservice/rom_access_library/library/include/ss_sm_checksum.h34
-rwxr-xr-xsystemservice/rom_access_library/library/include/system_service/nor_backup.h212
-rwxr-xr-xsystemservice/rom_access_library/library/include/system_service/rom_access_library.h47
-rwxr-xr-xsystemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h362
-rwxr-xr-xsystemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h235
-rwxr-xr-xsystemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h1010
-rwxr-xr-xsystemservice/rom_access_library/library/nor/Makefile46
-rwxr-xr-xsystemservice/rom_access_library/library/nor/libBlkDev_API.ver30
-rwxr-xr-xsystemservice/rom_access_library/library/nor/libssaccess.ver30
-rwxr-xr-xsystemservice/rom_access_library/library/nor/src/nor_backup.c807
-rwxr-xr-xsystemservice/rom_access_library/library/rom/Makefile62
-rwxr-xr-xsystemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp122
-rwxr-xr-xsystemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp37
-rwxr-xr-xsystemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp215
-rwxr-xr-xsystemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp969
-rwxr-xr-xsystemservice/system_manager/LICENSE177
-rwxr-xr-xsystemservice/system_manager/Makefile.server19
-rwxr-xr-xsystemservice/system_manager/server/Makefile118
-rwxr-xr-xsystemservice/system_manager/server/PhaseInfo.txt2
-rwxr-xr-xsystemservice/system_manager/server/include/crashdetector/ss_crashdetector.h46
-rwxr-xr-xsystemservice/system_manager/server/include/heartbeat/ss_hb_if.h67
-rwxr-xr-xsystemservice/system_manager/server/include/heartbeat/ss_hb_session.h91
-rwxr-xr-xsystemservice/system_manager/server/include/heartbeat/ss_hb_thread.h206
-rwxr-xr-xsystemservice/system_manager/server/include/processlauncher/ProcessLauncher.h58
-rwxr-xr-xsystemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h30
-rwxr-xr-xsystemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h111
-rwxr-xr-xsystemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h62
-rwxr-xr-xsystemservice/system_manager/server/include/ss_sm_config.h543
-rwxr-xr-xsystemservice/system_manager/server/include/ss_sm_default_paths.h42
-rwxr-xr-xsystemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h72
-rwxr-xr-xsystemservice/system_manager/server/include/ss_sm_dynamic_launcher.h111
-rwxr-xr-xsystemservice/system_manager/server/include/ss_sm_launch_configuration.h191
-rwxr-xr-xsystemservice/system_manager/server/include/ss_sm_signals.h32
-rwxr-xr-xsystemservice/system_manager/server/include/ss_sm_systemmanagerlog.h91
-rwxr-xr-xsystemservice/system_manager/server/include/ss_sm_version.h39
-rwxr-xr-xsystemservice/system_manager/server/include/ss_system_manager.h760
-rwxr-xr-xsystemservice/system_manager/server/include/ss_system_manager_callbacks.h29
-rwxr-xr-xsystemservice/system_manager/server/include/ss_system_memory_monitor.h85
-rwxr-xr-xsystemservice/system_manager/server/include/ss_system_thread_info.h45
-rwxr-xr-xsystemservice/system_manager/server/include/system_launcher_cfg_format.h66
-rwxr-xr-xsystemservice/system_manager/server/sm_launch__CWORD84_.xml116
-rwxr-xr-xsystemservice/system_manager/server/src/heartbeat/ss_hb_if.cpp201
-rwxr-xr-xsystemservice/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp184
-rwxr-xr-xsystemservice/system_manager/server/src/heartbeat/ss_hb_session.cpp415
-rwxr-xr-xsystemservice/system_manager/server/src/heartbeat/ss_hb_thread.cpp355
-rwxr-xr-xsystemservice/system_manager/server/src/processlauncher/ProcessLauncher.cpp317
-rwxr-xr-xsystemservice/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp126
-rwxr-xr-xsystemservice/system_manager/server/src/ss_sm_config.cpp1528
-rwxr-xr-xsystemservice/system_manager/server/src/ss_sm_dynamic_launcher.cpp221
-rwxr-xr-xsystemservice/system_manager/server/src/ss_sm_version.cpp79
-rwxr-xr-xsystemservice/system_manager/server/src/ss_system_manager.cpp3655
-rwxr-xr-xsystemservice/system_manager/server/src/ss_system_manager_callbacks.cpp3411
-rwxr-xr-xsystemservice/system_manager/server/src/ss_system_manager_error_event.cpp945
-rwxr-xr-xsystemservice/system_manager/server/src/ss_system_manager_error_event_responses.cpp1007
-rwxr-xr-xsystemservice/system_manager/server/src/ss_system_manager_error_event_triggers.cpp1093
-rwxr-xr-xsystemservice/system_manager/server/src/ss_system_memory_monitor.cpp362
-rwxr-xr-xsystemservice/system_manager/server/src/systemmanager_application.cpp237
-rwxr-xr-xsystemservice/system_manager/server/src/systemmanager_main.cpp120
-rwxr-xr-xsystemservice/system_manager/server/version.txt2
-rwxr-xr-xsystemservice/system_service.mk44
-rwxr-xr-xsystemservice/task_manager/LICENSE177
-rwxr-xr-xsystemservice/task_manager/Makefile.client21
-rwxr-xr-xsystemservice/task_manager/Makefile.server21
-rwxr-xr-xsystemservice/task_manager/client/Makefile26
-rwxr-xr-xsystemservice/task_manager/client/libprimary/Makefile37
-rwxr-xr-xsystemservice/task_manager/client/libprimary/include/pri_main.h48
-rwxr-xr-xsystemservice/task_manager/client/libprimary/libprimary.ver22
-rwxr-xr-xsystemservice/task_manager/client/libprimary/src/pri_api.cpp224
-rwxr-xr-xsystemservice/task_manager/client/libprimary/src/pri_main.cpp873
-rwxr-xr-xsystemservice/task_manager/client/libtskm/Makefile35
-rwxr-xr-xsystemservice/task_manager/client/libtskm/TSKM.api9
-rwxr-xr-xsystemservice/task_manager/client/libtskm/libtskm.ver21
-rwxr-xr-xsystemservice/task_manager/client/libtskm/src/tskm_api_lib.cpp90
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/Makefile93
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/conf/agl_thread.h1377
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/conf/tskm_launch.xml106
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml11
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml6
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml8
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml5
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h40
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.h59
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h173
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/libtskmcfg.ver21
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/src/parsexml.c879
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp138
-rwxr-xr-xsystemservice/task_manager/client/libtskmcfg/tskm_cfg.xml83
-rwxr-xr-xsystemservice/task_manager/client/ss_data_init/Makefile43
-rwxr-xr-xsystemservice/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h78
-rwxr-xr-xsystemservice/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h39
-rwxr-xr-xsystemservice/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h121
-rwxr-xr-xsystemservice/task_manager/client/ss_data_init/include/tskm_data_init_local.h25
-rwxr-xr-xsystemservice/task_manager/client/ss_data_init/mkdatainit.sh45
-rwxr-xr-xsystemservice/task_manager/client/ss_data_init/tskm_data_init.cpp.in66
-rwxr-xr-xsystemservice/task_manager/include-share/tskm_gstep.h54
-rwxr-xr-xsystemservice/task_manager/include-share/tskm_type_local.h52
-rwxr-xr-xsystemservice/task_manager/include-share/tskm_util.h32
-rwxr-xr-xsystemservice/task_manager/server/Makefile67
-rwxr-xr-xsystemservice/task_manager/server/include/system_service/INI_API.h25
-rwxr-xr-xsystemservice/task_manager/server/include/system_service/INI_API.hpp738
-rwxr-xr-xsystemservice/task_manager/server/include/system_service/Primary_common.h148
-rwxr-xr-xsystemservice/task_manager/server/include/system_service/sysup.h41
-rwxr-xr-xsystemservice/task_manager/server/include/system_service/sysup_from.h41
-rwxr-xr-xsystemservice/task_manager/server/include/system_service/task_manager.h54
-rwxr-xr-xsystemservice/task_manager/server/include/system_service/tskm.h413
-rwxr-xr-xsystemservice/task_manager/server/include/system_service/tskm_local_type.h287
-rwxr-xr-xsystemservice/task_manager/server/include/system_service/tskm_svc.h904
-rwxr-xr-xsystemservice/task_manager/server/include/system_service/tskm_type.h123
-rwxr-xr-xsystemservice/task_manager/server/include/tskm_comm.h59
-rwxr-xr-xsystemservice/task_manager/server/include/tskm_debug.h208
-rwxr-xr-xsystemservice/task_manager/server/include/tskm_main.h71
-rwxr-xr-xsystemservice/task_manager/server/include/tskm_port_pf.h46
-rwxr-xr-xsystemservice/task_manager/server/include/tskm_port_subsys.h42
-rwxr-xr-xsystemservice/task_manager/server/include/tskm_shutdown.h27
-rwxr-xr-xsystemservice/task_manager/server/include/tskm_state.h36
-rwxr-xr-xsystemservice/task_manager/server/include/tskm_wakeup.h26
-rwxr-xr-xsystemservice/task_manager/server/include/tskm_watch.h25
-rwxr-xr-xsystemservice/task_manager/server/src/pri_main.cpp840
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_api.cpp268
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_comm.cpp402
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_debug.cpp286
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_main.cpp727
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_port_pf.cpp884
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_port_subsys.cpp297
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_shutdown.cpp242
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_state.cpp452
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_svc.cpp970
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_wakeup.cpp201
-rwxr-xr-xsystemservice/task_manager/server/src/tskm_watch.cpp101
-rwxr-xr-xsystemservice/version_library/LICENSE177
-rwxr-xr-xsystemservice/version_library/Makefile.client19
-rwxr-xr-xsystemservice/version_library/library/Makefile37
-rwxr-xr-xsystemservice/version_library/library/include/system_service/ss_ver.h338
-rwxr-xr-xsystemservice/version_library/library/include/system_service/version_library.h40
-rwxr-xr-xsystemservice/version_library/library/src/ss_ver.cc309
-rwxr-xr-xupdate_hal/LICENSE177
-rwxr-xr-xupdate_hal/Makefile34
-rwxr-xr-xupdate_hal/hal_api/update_hal.h165
-rwxr-xr-xupdate_hal/include/update_hal.h165
-rwxr-xr-xusb_hal/LICENSE177
-rwxr-xr-xusb_hal/Makefile66
-rwxr-xr-xusb_hal/hal_api/usb_hal.h379
-rwxr-xr-xusb_hal/inc/usb_hal_debug.h31
-rwxr-xr-xusb_hal/inc/usb_hal_internal.h165
-rwxr-xr-xusb_hal/inc/usb_hal_usbhallog.h77
-rwxr-xr-xusb_hal/src/usb_hal.cpp500
-rwxr-xr-xvehicle_hal/LICENSE177
-rwxr-xr-xvehicle_hal/Makefile69
-rwxr-xr-xvehicle_hal/README.md3
-rwxr-xr-xvehicle_hal/hal_api/vehicle_hal.h210
-rwxr-xr-xvehicle_hal/inc/vehicle_hal_frameworkunifiedlog.h78
-rwxr-xr-xvehicle_hal/src/vehicle_hal.cpp398
-rwxr-xr-xvehicleservice/.gitattributes128
-rwxr-xr-xvehicleservice/positioning/LICENSE177
-rwxr-xr-xvehicleservice/positioning/Makefile.client20
-rwxr-xr-xvehicleservice/positioning/Makefile.server20
-rwxr-xr-xvehicleservice/positioning/client/Makefile31
-rwxr-xr-xvehicleservice/positioning/client/include/CanInput_API.h98
-rwxr-xr-xvehicleservice/positioning/client/include/CanInput_API_private.h68
-rwxr-xr-xvehicleservice/positioning/client/include/Clock_API.h258
-rwxr-xr-xvehicleservice/positioning/client/include/CommonDefine.h72
-rwxr-xr-xvehicleservice/positioning/client/include/DR_API.h148
-rwxr-xr-xvehicleservice/positioning/client/include/DeadReckoning_DbgLogSim.h50
-rwxr-xr-xvehicleservice/positioning/client/include/Dead_Reckoning_API.h229
-rwxr-xr-xvehicleservice/positioning/client/include/Dead_Reckoning_Local_Api.h147
-rwxr-xr-xvehicleservice/positioning/client/include/Gps_API_private.h64
-rwxr-xr-xvehicleservice/positioning/client/include/INI_API.h259
-rwxr-xr-xvehicleservice/positioning/client/include/Naviinfo_API.h110
-rwxr-xr-xvehicleservice/positioning/client/include/POS_common_private.h62
-rwxr-xr-xvehicleservice/positioning/client/include/POS_private.h981
-rwxr-xr-xvehicleservice/positioning/client/include/POS_sensor_private.h163
-rwxr-xr-xvehicleservice/positioning/client/include/SensorLocation_API.h124
-rwxr-xr-xvehicleservice/positioning/client/include/SensorLocation_API_private.h39
-rwxr-xr-xvehicleservice/positioning/client/include/SensorMotion_API.h178
-rwxr-xr-xvehicleservice/positioning/client/include/Sensor_API.h36
-rwxr-xr-xvehicleservice/positioning/client/include/Sensor_API_private.h174
-rwxr-xr-xvehicleservice/positioning/client/include/Sensor_Common_API.h193
-rwxr-xr-xvehicleservice/positioning/client/include/VehicleDebug_API.h110
-rwxr-xr-xvehicleservice/positioning/client/include/Vehicle_API.h115
-rwxr-xr-xvehicleservice/positioning/client/include/Vehicle_API_Dummy.h142
-rwxr-xr-xvehicleservice/positioning/client/include/Vehicle_API_private.h129
-rwxr-xr-xvehicleservice/positioning/client/include/vehicle_service/POS_common_API.h1663
-rwxr-xr-xvehicleservice/positioning/client/include/vehicle_service/POS_define.h134
-rwxr-xr-xvehicleservice/positioning/client/include/vehicle_service/POS_gps_API.h1135
-rwxr-xr-xvehicleservice/positioning/client/include/vehicle_service/POS_sensor_API.h716
-rwxr-xr-xvehicleservice/positioning/client/include/vehicle_service/positioning.h46
-rwxr-xr-xvehicleservice/positioning/client/src/POS_common_API/Common_API.cpp889
-rwxr-xr-xvehicleservice/positioning/client/src/POS_common_API/Makefile47
-rwxr-xr-xvehicleservice/positioning/client/src/POS_common_API/libPOS_common_API.ver37
-rwxr-xr-xvehicleservice/positioning/client/src/POS_gps_API/Gps_API.cpp456
-rwxr-xr-xvehicleservice/positioning/client/src/POS_gps_API/Makefile51
-rwxr-xr-xvehicleservice/positioning/client/src/POS_gps_API/Naviinfo_API.cpp404
-rwxr-xr-xvehicleservice/positioning/client/src/POS_gps_API/libPOS_gps_API.ver34
-rwxr-xr-xvehicleservice/positioning/client/src/POS_sensor_API/Makefile48
-rwxr-xr-xvehicleservice/positioning/client/src/POS_sensor_API/Sensor_API.cpp784
-rwxr-xr-xvehicleservice/positioning/client/src/POS_sensor_API/Vehicle_API.cpp292
-rwxr-xr-xvehicleservice/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver32
-rwxr-xr-xvehicleservice/positioning/server/Makefile22
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/ClockDataMng.h100
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/ClockGPS_Process_Proto.h37
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/ClockUtility.h46
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/ClockUtility_private.h49
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/DeadReckoning_Common.h84
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/DeadReckoning_DataMaster.h127
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/DeadReckoning_DeliveryCtrl.h137
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/DeadReckoning_main.h146
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/GpsInt.h68
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/SensorLog.h114
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/VehicleSens_Common.h131
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/VehicleSens_DataMaster.h1091
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/VehicleSens_DeliveryCtrl.h253
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/VehicleSens_FromAccess.h69
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/VehicleSens_SelectionItemList.h116
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/VehicleSens_SharedMemory.h48
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/VehicleSens_Thread.h185
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/VehicleSensor_Thread.h33
-rwxr-xr-xvehicleservice/positioning/server/include/Sensor/VehicleUtility.h128
-rwxr-xr-xvehicleservice/positioning/server/include/ServiceInterface/BackupMgrIf.h65
-rwxr-xr-xvehicleservice/positioning/server/include/ServiceInterface/ClockIf.h61
-rwxr-xr-xvehicleservice/positioning/server/include/ServiceInterface/CommUsbIf.h64
-rwxr-xr-xvehicleservice/positioning/server/include/ServiceInterface/DevDetectSrvIf.h69
-rwxr-xr-xvehicleservice/positioning/server/include/ServiceInterface/DiagSrvIf.h55
-rwxr-xr-xvehicleservice/positioning/server/include/ServiceInterface/PSMShadowIf.h58
-rwxr-xr-xvehicleservice/positioning/server/include/ServiceInterface/VehicleIf.h82
-rwxr-xr-xvehicleservice/positioning/server/include/ServiceInterface/ps_psmshadow_notifications.h62
-rwxr-xr-xvehicleservice/positioning/server/include/ServiceInterface/ps_version.h45
-rwxr-xr-xvehicleservice/positioning/server/include/nsfw/positioning_common.h90
-rwxr-xr-xvehicleservice/positioning/server/include/nsfw/vehicle_version.h29
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/ClockUtility.cpp414
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Common.cpp127
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_DataMasterMain.cpp298
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_DeliveryCtrl.cpp835
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Altitude_dr.cpp106
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroOffset_dr.cpp115
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp115
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactor_dr.cpp115
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Heading_dr.cpp106
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Latitude_dr.cpp105
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Longitude_dr.cpp105
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SnsCounter.cpp103
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp116
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp115
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Speed_dr.cpp105
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/DeadReckoning_main.cpp1086
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/GpsInt.cpp171
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/Makefile181
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/SensorLog.cpp1307
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_CanDeliveryEntry.cpp47
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Common.cpp429
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_DataMasterMain.cpp1880
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_DeliveryCtrl.cpp2243
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GPSInterruptFlag.cpp105
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna.cpp58
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntennaStatus.cpp112
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna_l.cpp97
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift.cpp51
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift_g.cpp102
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq.cpp51
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq_g.cpp102
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsCounter_g.cpp98
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsNmea_g.cpp89
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime.cpp53
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw.cpp51
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw_g.cpp107
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime_g.cpp102
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp99
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp102
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82__CWORD44_Gp4_g.cpp101
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX.cpp119
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXExt_l.cpp145
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXFst_l.cpp127
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX_l.cpp98
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY.cpp121
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYExt_l.cpp145
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYFst_l.cpp128
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY_l.cpp99
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ.cpp116
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZExt_l.cpp142
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZFst_l.cpp127
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ_l.cpp97
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroConnectStatus.cpp110
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroExt_l.cpp257
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp.cpp114
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempExt_l.cpp140
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempFst_l.cpp128
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp_l.cpp95
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTrouble.cpp121
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX.cpp145
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroXFst_l.cpp176
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX_l.cpp128
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY.cpp113
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYExt_l.cpp148
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYFst_l.cpp169
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY_l.cpp126
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ.cpp113
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZExt_l.cpp148
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZFst_l.cpp169
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ_l.cpp126
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude.cpp55
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_g.cpp105
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_n.cpp121
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea.cpp50
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea_n.cpp118
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat.cpp56
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_g.cpp104
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_n.cpp163
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MainGpsInterruptSignal.cpp132
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Mon_Hw_g.cpp104
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading.cpp55
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_g.cpp105
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_n.cpp162
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed.cpp57
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_g.cpp107
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_i.cpp103
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_n.cpp103
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Clock_g.cpp104
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Dop_g.cpp104
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Posllh_g.cpp104
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Status_g.cpp104
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_SvInfo_g.cpp108
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeGps_g.cpp104
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeUtc_g.cpp104
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Velned_g.cpp104
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_NaviinfoDiagGPS_g.cpp94
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime.cpp115
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTimeExt_l.cpp143
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime_l.cpp93
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev.cpp118
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevExt_l.cpp134
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevFst_l.cpp171
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev_l.cpp157
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime.cpp58
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime_clock.cpp116
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter.cpp90
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounterExt_l.cpp155
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter_l.cpp124
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph.cpp57
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph_l.cpp156
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse.cpp117
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseExt_l.cpp150
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlag.cpp133
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlagFst_l.cpp91
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFst_l.cpp172
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse_l.cpp128
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SysGpsInterruptSignal.cpp132
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover.cpp51
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover_g.cpp102
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_FromAccess.cpp319
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_SelectionItemList.cpp466
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_SharedMemory.cpp521
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleSens_Thread.cpp2144
-rwxr-xr-xvehicleservice/positioning/server/src/Sensor/VehicleUtility.cpp455
-rwxr-xr-xvehicleservice/positioning/server/src/ServiceInterface/BackupMgrIf.cpp211
-rwxr-xr-xvehicleservice/positioning/server/src/ServiceInterface/ClockIf.cpp138
-rwxr-xr-xvehicleservice/positioning/server/src/ServiceInterface/CommUsbIf.cpp147
-rwxr-xr-xvehicleservice/positioning/server/src/ServiceInterface/DevDetectSrvIf.cpp279
-rwxr-xr-xvehicleservice/positioning/server/src/ServiceInterface/DiagSrvIf.cpp64
-rwxr-xr-xvehicleservice/positioning/server/src/ServiceInterface/Makefile54
-rwxr-xr-xvehicleservice/positioning/server/src/ServiceInterface/PSMShadowIf.cpp102
-rwxr-xr-xvehicleservice/positioning/server/src/ServiceInterface/VehicleIf.cpp364
-rwxr-xr-xvehicleservice/positioning/server/src/nsfw/Makefile89
-rwxr-xr-xvehicleservice/positioning/server/src/nsfw/positioning_application.cpp2593
-rwxr-xr-xvehicleservice/positioning/server/src/nsfw/ps_main.cpp59
-rwxr-xr-xvehicleservice/positioning_base_library/LICENSE177
-rwxr-xr-xvehicleservice/positioning_base_library/Makefile.client20
-rwxr-xr-xvehicleservice/positioning_base_library/library/Makefile87
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h76
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h111
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/WPF_STD_private.h295
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/_pbCommon.h36
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h128
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/_pbInternalProc.h41
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/_pbSerial.h32
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h40
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/sysup.h24
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/sysup_addr.h227
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/tchar.h256
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h1653
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h77
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h46
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h91
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h55
-rwxr-xr-xvehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h359
-rwxr-xr-xvehicleservice/positioning_base_library/library/libPOS_base_API.ver39
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/MsgBapi.cpp347
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp254
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbCSection.cpp131
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbCommon.cpp928
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbDram.cpp284
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbEvent.cpp1695
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbFsys.cpp171
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbMem.cpp989
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbMisc.cpp226
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbMsg.cpp1572
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbMutex.cpp1423
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp541
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbOther.cpp799
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbProcMng.cpp207
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbSem.cpp780
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbSerial.cpp525
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbSram.cpp316
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbSum.cpp95
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbTimer.cpp1115
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp358
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp25
-rwxr-xr-xvehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp25
-rwxr-xr-xvehicleservice/vehicle_service.mk42
-rwxr-xr-xvideo_in_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/Makefile61
-rwxr-xr-xvideo_in_hal/README.md3
-rw-r--r--video_in_hal/agl-basefiles/BS/ns/npp/rwdata/version.txt1
-rw-r--r--video_in_hal/agl-basefiles/LICENSE177
-rw-r--r--video_in_hal/agl-basefiles/agldd/ev_common.h135
-rw-r--r--video_in_hal/agl-basefiles/agldd/ev_id.h104
-rw-r--r--video_in_hal/agl-basefiles/agldd/evk_lib.h116
-rw-r--r--video_in_hal/agl-basefiles/agldd/moduleid.h69
-rw-r--r--video_in_hal/agl-basefiles/bin/launch_xml2cfg.sh138
-rw-r--r--video_in_hal/agl-basefiles/include/agl_thread.h1385
-rw-r--r--video_in_hal/agl-basefiles/include/agl_types_obsoluted.h136
-rw-r--r--video_in_hal/agl-basefiles/include/agl_wakeup_order.h27
-rw-r--r--video_in_hal/agl-basefiles/include/aglpath.h200
-rw-r--r--video_in_hal/agl-basefiles/include/sm_launch_conf.h1385
-rw-r--r--video_in_hal/agl-basefiles/share/agl.mk677
-rw-r--r--video_in_hal/agl-basefiles/share/rpc_rule.mk42
-rw-r--r--video_in_hal/agl-basefiles/share/system_launcher_main.xml40
-rwxr-xr-xvideo_in_hal/agl-systemd/99-agl.rules11
-rwxr-xr-xvideo_in_hal/agl-systemd/LICENSE177
-rwxr-xr-xvideo_in_hal/agl-systemd/agl-trigger.service18
-rwxr-xr-xvideo_in_hal/agl-systemd/env.txt130
-rwxr-xr-xvideo_in_hal/agl-systemd/launch_sm.service22
-rwxr-xr-xvideo_in_hal/agl-systemd/options.conf2
-rwxr-xr-xvideo_in_hal/agl-systemd/setup_refhw.service15
-rwxr-xr-xvideo_in_hal/agl-systemd/systemd-udev-trigger.service22
-rwxr-xr-xvideo_in_hal/agl-systemd/tool_9E_SI/agl_set_capability.sh82
-rwxr-xr-xvideo_in_hal/agl-systemd/tool_9E_SI/launch_sm.sh26
-rwxr-xr-xvideo_in_hal/agl-systemd/tool_9E_SI/set_capability.sh82
-rwxr-xr-xvideo_in_hal/agl-systemd/tool_9E_SI/set_cgroup_rt_runtime_us.sh33
-rwxr-xr-xvideo_in_hal/agl-systemd/tool_9E_SI/setup_refhw.sh83
-rwxr-xr-xvideo_in_hal/agl-systemd/usr/target/agl_cap.lst34
-rwxr-xr-xvideo_in_hal/agl-systemd/usr/target/cap.lst24
-rwxr-xr-xvideo_in_hal/agl-systemd/usr/target/dir.lst0
-rwxr-xr-xvideo_in_hal/agl-systemd/usr/target/mntfs.lst0
-rwxr-xr-xvideo_in_hal/boot_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/boot_hal/Makefile65
-rwxr-xr-xvideo_in_hal/boot_hal/hal_api/boot_hal.h228
-rwxr-xr-xvideo_in_hal/boot_hal/inc/boot_hal_boothallog.h76
-rwxr-xr-xvideo_in_hal/boot_hal/src/boot_hal.cpp313
-rwxr-xr-xvideo_in_hal/can_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/can_hal/Makefile19
-rwxr-xr-xvideo_in_hal/can_hal/README.md3
-rwxr-xr-xvideo_in_hal/can_hal/can_hal.mk39
-rwxr-xr-xvideo_in_hal/can_hal/hal_api/can_hal.h303
-rwxr-xr-xvideo_in_hal/can_hal/src/Makefile52
-rwxr-xr-xvideo_in_hal/can_hal/src/can_hal_api.cpp166
-rwxr-xr-xvideo_in_hal/can_hal/src/can_hal_core.cpp372
-rwxr-xr-xvideo_in_hal/can_hal/src/can_hal_stm.cpp243
-rwxr-xr-xvideo_in_hal/can_hal/src/driver_can__CWORD31_.c472
-rwxr-xr-xvideo_in_hal/can_hal/src/inc/can_hal_core.h37
-rwxr-xr-xvideo_in_hal/can_hal/src/inc/can_hal_frameworkunifiedlog.h76
-rwxr-xr-xvideo_in_hal/can_hal/src/inc/can_hal_internal.h31
-rwxr-xr-xvideo_in_hal/can_hal/src/inc/can_hal_stm.h45
-rwxr-xr-xvideo_in_hal/can_hal/src/inc/can_mng_api.h120
-rwxr-xr-xvideo_in_hal/clock_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/clock_hal/Makefile67
-rwxr-xr-xvideo_in_hal/clock_hal/README.md3
-rwxr-xr-xvideo_in_hal/clock_hal/hal_api/clock_hal.h67
-rwxr-xr-xvideo_in_hal/clock_hal/inc/clock_hal_clockhallog.h76
-rwxr-xr-xvideo_in_hal/clock_hal/src/clock_hal.cpp91
-rwxr-xr-xvideo_in_hal/deck_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/deck_hal/Makefile67
-rwxr-xr-xvideo_in_hal/deck_hal/hal_api/deck_hal.h322
-rwxr-xr-xvideo_in_hal/deck_hal/inc/deck_hal_deckhallog.h76
-rwxr-xr-xvideo_in_hal/deck_hal/src/deck_hal.cpp159
-rwxr-xr-xvideo_in_hal/hal_api/video_in_hal.h567
-rwxr-xr-xvideo_in_hal/input_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/input_hal/Makefile81
-rwxr-xr-xvideo_in_hal/input_hal/README.md3
-rwxr-xr-xvideo_in_hal/input_hal/hal_api/input_hal.h696
-rwxr-xr-xvideo_in_hal/input_hal/hal_api/peripheral_service/aglinput.h536
-rwxr-xr-xvideo_in_hal/input_hal/hal_api/peripheral_service/extinput.h27
-rwxr-xr-xvideo_in_hal/input_hal/inc/input_drm.h22
-rwxr-xr-xvideo_in_hal/input_hal/inc/input_hal_debug.h57
-rwxr-xr-xvideo_in_hal/input_hal/inc/input_hal_frameworkunifiedlog.h76
-rwxr-xr-xvideo_in_hal/input_hal/inc/input_hal_internal.h107
-rwxr-xr-xvideo_in_hal/input_hal/inc/input_touch_ilitek.h27
-rwxr-xr-xvideo_in_hal/input_hal/inc/input_udev_monitor.h40
-rwxr-xr-xvideo_in_hal/input_hal/inc/input_util.h46
-rwxr-xr-xvideo_in_hal/input_hal/src/input_drm.cpp128
-rwxr-xr-xvideo_in_hal/input_hal/src/input_hal.cpp267
-rwxr-xr-xvideo_in_hal/input_hal/src/input_touch_ilitek.cpp226
-rwxr-xr-xvideo_in_hal/input_hal/src/input_udev_monitor.cpp566
-rwxr-xr-xvideo_in_hal/input_hal/src/input_util.cpp77
-rwxr-xr-xvideo_in_hal/kernel-module-evklib/Makefile30
-rwxr-xr-xvideo_in_hal/kernel-module-evklib/agldd/agldd.h94
-rwxr-xr-xvideo_in_hal/kernel-module-evklib/agldd/ev_common.h135
-rwxr-xr-xvideo_in_hal/kernel-module-evklib/agldd/ev_id.h104
-rwxr-xr-xvideo_in_hal/kernel-module-evklib/agldd/evk_lib.h116
-rwxr-xr-xvideo_in_hal/kernel-module-evklib/agldd/moduleid.h69
-rwxr-xr-xvideo_in_hal/kernel-module-evklib/evk_lib.c2246
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/LICENSE177
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/Makefile.client19
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/Makefile.server19
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/client/Makefile53
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/client/include/bkup_api.h60
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/client/include/native_service/backup_manager.h42
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/client/include/native_service/ns_backup.h498
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/client/libns_backup.ver34
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/client/src/bkup_api.cpp343
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/config/Makefile42
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/config/backup.rng123
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/config/conf/backup/ALL_.xml1216
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA1_L.xml248
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA1_TE.xml248
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA2_T.xml287
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA2_TE.xml289
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/config/createhdr.pl84
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/config/sample.xml23
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/config/uniqcheck.pl46
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/Makefile67
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/include/bkup_backupmanagerlog.h80
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/include/bkup_crc32.h22
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/include/bkup_param.h39
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/include/bkup_process.h31
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/include/bkup_util.h53
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/src/backupmanager_application.cpp277
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/src/backupmanager_main.cpp61
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/src/bkup_crc32.cpp62
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/src/bkup_param.cpp447
-rwxr-xr-xvideo_in_hal/nsframework/backup_manager/server/src/bkup_process.cpp2497
-rwxr-xr-xvideo_in_hal/nsframework/common_library/LICENSE177
-rwxr-xr-xvideo_in_hal/nsframework/common_library/Makefile.client19
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/Makefile30
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/cl_cgroup.h35
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/cl_error.h44
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/cl_lock_internal.h55
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/cl_monitor_internal.h30
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/cl_process_internal.h53
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/native_service/cl_lock.h259
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/native_service/cl_lockid.h180
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/native_service/cl_monitor.h269
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/native_service/cl_process.h1288
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/native_service/cl_region.h257
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/native_service/cl_sem.h73
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/include/native_service/common_library.h48
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/libcommon.ver30
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/src/cl_cgroup.c260
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/src/cl_lock.c221
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/src/cl_monitor.c442
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/src/cl_process.c1198
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/src/cl_region.c295
-rwxr-xr-xvideo_in_hal/nsframework/common_library/client/src/cl_sem.c67
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/LICENSE177
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/Makefile.client19
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/Makefile269
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_internal.h54
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_parser.h148
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_reader.h133
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_writer.h146
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_config_parser_frameworkunifiedlog.h88
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/makefile_PosixBasedOS001207
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_parser.cpp365
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_reader.cpp117
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_writer.cpp135
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader.cpp346
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader_writer.cpp74
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_writer.cpp227
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_reader.cpp36
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_writer.cpp36
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_core.h676
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_error_internal.hpp43
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_internal.h675
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_utility.h41
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_msgprofiler.h148
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_finalstate.h97
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h89
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_multithreading_internal.h30
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_dispatcher.cpp2382
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp983
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_error.cpp130
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_logger.cpp575
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp502
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp867
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_session.cpp1357
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_sync.cpp439
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_system.cpp77
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp210
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_multithreading.cpp531
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_service_if.cpp128
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_thread_priority.cpp156
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_timer.cpp67
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/makefile_PosixBasedOS001214
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp32
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp371
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp152
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp79
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp240
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp225
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp79
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp485
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp41
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp148
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp529
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp1419
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp78
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp84
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp211
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp337
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp74
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp634
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp57
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/makefile99
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Logger/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Logger/include/frameworkunified_stub.h111
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Logger/include/ns_logger_internal.h44
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Logger/src/makefile_PosixBasedOS001223
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Logger/src/ns_logger.cpp2260
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Logger/tool/nslogsw.cpp114
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageCenter/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageCenter/include/ns_mc_internal.h93
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageCenter/include/ns_message_center_internal.h185
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageCenter/src/makefile_PosixBasedOS001214
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageCenter/src/ns_message_center.c1269
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageQueue/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_anomaly.h35
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_internal.h58
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_msg_queue.h295
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/makefile_PosixBasedOS001207
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/ns_mq_string.c60
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/ns_msg_queue.c596
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/include/ns_np_service_internal.h75
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/makefile_PosixBasedOS001208
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_api.c1001
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp498
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_ResourceControler/src/ns_resource_controler.cpp168
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_RingBuffer/src/ns_ringbuffer.cpp1029
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/api/nsapi_sharedmem.cpp431
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/makefile_PosixBasedOS001190
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_shared_mem_if.cpp254
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem.cpp697
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_reader.cpp169
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_writer.cpp137
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Timer/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Timer/include/ns_timer_handle.h48
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Timer/include/ns_timer_internal.h28
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Timer/src/makefile_PosixBasedOS001206
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Timer/src/mod_version.c51
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Timer/src/ns_timer.c514
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Timer/src/ns_timer_class.cpp177
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Utility/Makefile19
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/Makefile21
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/Makefile62
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/src/NS_BuildVersionCheck.cpp85
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_if_internal.h193
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_sys_internal.hpp353
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/frameworkunified_version.cpp236
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/makefile_PosixBasedOS001194
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_endianess.cpp52
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_crc.cpp125
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_directory.cpp145
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_utility.cpp144
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/Makefile20
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile19
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h113
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h104
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h60
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h88
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile57
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001208
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp522
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp338
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp354
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp55
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp658
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp367
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp325
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h20
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001208
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h51
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h64
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp538
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/Makefile29
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_arm.mk88
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_armv7.mk96
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_x86.mk89
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/cfg/analysis.mk73
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/cfg/common.mk175
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/cfg/config.mk115
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/cfg/depends.mk115
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/cfg/nativeserviceslibraries.mk54
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/makefile_PosixBasedOS00155
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_filestorage.sql9
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog.cfg278
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg427
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/XMLParser.h289
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/framework_unified.h130
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__service_if.h554
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__session_if.h495
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_application.h376
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_dispatcher.h803
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_error.hpp77
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_if.h6007
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_sync.h370
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_system_if.h110
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_types.h173
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_multithreading.h745
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_service_if.h267
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_service_protocol.h116
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_action.h150
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_compositestate.h434
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_conditionconnector.h203
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_deephistorystate.h141
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_dispatcher.h338
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventdata.h83
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventfactory.h114
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_externaltransition.h268
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_dispatch.h1054
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_if.h486
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_types.h494
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_guard.h145
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_historystate.h253
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsm.h798
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsmframework.h873
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_internaltransition.h111
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_leafstate.h252
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_localtransition.h163
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_multithreading.h227
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_orthogonalstate.h513
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_reaction.h184
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_shallowhistorystate.h163
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_state.h872
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_transition.h150
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_thread_priority.h235
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_timer.h143
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_types.h268
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__common.h129
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_if.h183
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_key.h53
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_table.h1217
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__notifications.h53
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__types.h68
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_buildversioncheck.hpp227
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_config_parser_if.h1038
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_endianess.h192
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_eventlogger.h103
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_logger_if.h1646
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_mc_system_info.h103
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_message_center_if.h1536
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_msgs.h64
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service.h271
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_if.h2482
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence.h151
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence_internal.h131
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_notification.h50
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_protocol.h116
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_types.h47
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_plogger_if.h288
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_data_handler.hpp1159
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_logger_types.h104
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_plugin.hpp328
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_reader.h207
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_resource_controler.h216
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_ringbuffer.h523
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_shared_mem.h100
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_shared_mem_if.h196
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem.h486
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem_reader.h340
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem_writer.h283
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_system_mode.h67
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_timer_if.h317
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_timer_if.hpp393
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_transmit_log.h256
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_util_crc.h111
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_util_directory.h160
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility.hpp572
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility_if.h76
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility_sys.hpp321
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_version.h48
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_version_if.h510
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_writer.h229
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_xml_reader.h291
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_xml_writer.h336
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/ns_xmlparser_if.h1150
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/nsfw_message.h65
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/nslogutil_cmd_if.h86
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/native_service/wpf_legacy.h152
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/ns__CWORD77__template.h60
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/ns_logger_additional_if.h40
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/include/nsverutil_cmd_if.h25
-rwxr-xr-xvideo_in_hal/nsframework/framework_unified/client/libNS_FrameworkUnified.ver144
-rwxr-xr-xvideo_in_hal/nsframework/log_library/LICENSE177
-rwxr-xr-xvideo_in_hal/nsframework/log_library/Makefile.client19
-rwxr-xr-xvideo_in_hal/nsframework/log_library/client/Makefile32
-rwxr-xr-xvideo_in_hal/nsframework/log_library/client/include/loglibrarylog_internal.h26
-rwxr-xr-xvideo_in_hal/nsframework/log_library/client/include/native_service/loglibrarylog_if.h79
-rwxr-xr-xvideo_in_hal/nsframework/log_library/client/include/native_service/loglibrarylog_library.h42
-rwxr-xr-xvideo_in_hal/nsframework/log_library/client/src/loglibrarylog.c60
-rwxr-xr-xvideo_in_hal/nsframework/native_service.mk44
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/LICENSE177
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/Makefile.server19
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/Makefile87
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/app_states.h187
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h40
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp.h296
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h230
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h558
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h111
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h145
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h218
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification.h323
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h496
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h68
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h94
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h121
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h122
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h365
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h536
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h119
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h165
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personality.h75
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h132
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h34
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h330
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h109
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h177
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h221
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h104
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h73
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_threads.h46
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_types.h212
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/app_states.cpp2684
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp258
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp131
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp.cpp1149
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp846
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp649
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp1153
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp232
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp149
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp747
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp485
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp1558
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp50
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp100
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp96
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp743
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp1132
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp58
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp181
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp333
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp158
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp305
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp402
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp87
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp61
-rwxr-xr-xvideo_in_hal/nv_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/nv_hal/Makefile65
-rwxr-xr-xvideo_in_hal/nv_hal/hal_api/nv_hal.h245
-rwxr-xr-xvideo_in_hal/nv_hal/inc/nv_hal_nvhallog.h76
-rwxr-xr-xvideo_in_hal/nv_hal/src/nv_hal.cpp242
-rwxr-xr-xvideo_in_hal/otherservice/event_library/LICENSE177
-rwxr-xr-xvideo_in_hal/otherservice/event_library/Makefile.client18
-rwxr-xr-xvideo_in_hal/otherservice/event_library/library/Makefile37
-rwxr-xr-xvideo_in_hal/otherservice/event_library/library/include/other_service/ev_lib.h1856
-rwxr-xr-xvideo_in_hal/otherservice/event_library/library/include/other_service/event_library.h39
-rwxr-xr-xvideo_in_hal/otherservice/event_library/library/libev.ver41
-rwxr-xr-xvideo_in_hal/otherservice/event_library/library/src/ev_lib.c1551
-rwxr-xr-xvideo_in_hal/otherservice/other_service.mk42
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/LICENSE177
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/Makefile.client20
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/Makefile48
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h83
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h86
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/itoa.h74
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h46
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcat.h78
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h78
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/ultoa.h74
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c56
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c57
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/src/itoa.c45
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/src/strlcat.c40
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/src/strlcpy.c49
-rwxr-xr-xvideo_in_hal/otherservice/posix_based_os001_legacy_library/library/src/ultoa.c33
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/LICENSE177
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/Makefile.client19
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/Makefile46
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/include/other_service/rpc.h765
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/include/other_service/rpc_id.h96
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/include/other_service/rpc_library.h41
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/include/rpc_internal.h135
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/include/rpc_thread.h240
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/include/rpc_udp.h162
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/librpc.ver29
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/src/rpc_event.c158
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/src/rpc_lib.c1264
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/src/rpc_marshall.c740
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/src/rpc_thread.c1224
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/library/src/rpc_udp.c473
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/tool/Makefile62
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/tool/apidef.cc1104
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/tool/apidef.h333
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/tool/apidef.l136
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/tool/apidef.y615
-rwxr-xr-xvideo_in_hal/otherservice/rpc_library/tool_for_arm/Makefile50
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/LICENSE177
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/Makefile.client18
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/Makefile40
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h90
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h133
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h114
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_ext.h45
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicle.h331
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h138
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h46
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h46
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c732
-rwxr-xr-xvideo_in_hal/otherservice/vehicle_parameter_library/library/src/VP_GetEnv.c291
-rwxr-xr-xvideo_in_hal/peripheralservice/.gitattributes128
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/LICENSE177
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/Makefile.client18
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/Makefile.server18
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/client_can/Makefile72
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/client_can/include/API_Local_Common.h55
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/client_can/include/Canif_API_Local.h46
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData.h48
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData21PF.h30
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/client_can/include/peripheral_service/Canif_API.h1158
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/client_can/include/peripheral_service/communication_can.h28
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/client_can/libCAN_API.ver36
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/client_can/src/Canif_API.cpp301
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/Makefile96
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h42
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h22
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/CAN/Command/CAN_Command.h21
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h40
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h137
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h54
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/com_error_type.h21
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/main/communication_cid.h33
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/main/communication_communicationlog.h94
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/main/communication_version.h45
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/peripheral_service/communication.h29
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/peripheral_service/communication_notifications.h28
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/peripheral_service/ps_services.h94
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/threads/CAN_Thread.h51
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/include/threads/Thread_Common.h42
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp240
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp405
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp416
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/src/main/communication_application.cpp226
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/src/main/communication_main.cpp154
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/src/threads/CAN_Thread.cpp238
-rwxr-xr-xvideo_in_hal/peripheralservice/communication/server/src/threads/Thread_Common.cpp182
-rwxr-xr-xvideo_in_hal/peripheralservice/peripheral_service.mk44
-rwxr-xr-xvideo_in_hal/positioning_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/positioning_hal/Makefile91
-rwxr-xr-xvideo_in_hal/positioning_hal/README.md3
-rwxr-xr-xvideo_in_hal/positioning_hal/hal_api/gps_hal.h932
-rwxr-xr-xvideo_in_hal/positioning_hal/hal_api/positioning_hal.h872
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/Common/LineSensDrv_Api.h44
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/Common/MDev_Gps_API.h51
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/Common/positioning_common.h63
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/Common/positioning_def.h307
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/Common/positioning_log.h43
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h170
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h34
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h187
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h311
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h90
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h313
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h113
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/LineSensDrv/LineSensDrv_Sensor.h183
-rwxr-xr-xvideo_in_hal/positioning_hal/inc/LineSensDrv/LineSensDrv_Thread.h66
-rwxr-xr-xvideo_in_hal/positioning_hal/src/Common/positioning_common.cpp388
-rwxr-xr-xvideo_in_hal/positioning_hal/src/Common/positioning_hal.cpp49
-rwxr-xr-xvideo_in_hal/positioning_hal/src/GpsCommon/MDev_GpsRecv.cpp608
-rwxr-xr-xvideo_in_hal/positioning_hal/src/GpsCommon/MDev_GpsRollOver.cpp275
-rwxr-xr-xvideo_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_API.cpp491
-rwxr-xr-xvideo_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Common.cpp2105
-rwxr-xr-xvideo_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Main.cpp362
-rwxr-xr-xvideo_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Mtrx.cpp866
-rwxr-xr-xvideo_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Nmea.cpp928
-rwxr-xr-xvideo_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_TimerCtrl.cpp293
-rwxr-xr-xvideo_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Api.cpp136
-rwxr-xr-xvideo_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Sensor.cpp622
-rwxr-xr-xvideo_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Thread.cpp125
-rwxr-xr-xvideo_in_hal/power_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/power_hal/Makefile66
-rwxr-xr-xvideo_in_hal/power_hal/README.md3
-rwxr-xr-xvideo_in_hal/power_hal/hal_api/power_hal.h572
-rwxr-xr-xvideo_in_hal/power_hal/src/power_hal.cpp97
-rwxr-xr-xvideo_in_hal/security_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/security_hal/Makefile67
-rwxr-xr-xvideo_in_hal/security_hal/hal_api/security_hal.h1131
-rwxr-xr-xvideo_in_hal/security_hal/inc/security_hal_securityhallog.h76
-rwxr-xr-xvideo_in_hal/security_hal/src/security_hal.cpp615
-rwxr-xr-xvideo_in_hal/soc_temperature_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/soc_temperature_hal/Makefile66
-rwxr-xr-xvideo_in_hal/soc_temperature_hal/hal_api/soc_temperature_hal.h89
-rwxr-xr-xvideo_in_hal/soc_temperature_hal/inc/soc_temperature_hal_soctemperaturehallog.h75
-rwxr-xr-xvideo_in_hal/soc_temperature_hal/src/soc_temperature_hal.cpp106
-rwxr-xr-xvideo_in_hal/src/video_in_hal.c50
-rwxr-xr-xvideo_in_hal/stub/clock/LICENSE177
-rwxr-xr-xvideo_in_hal/stub/clock/Makefile.client19
-rwxr-xr-xvideo_in_hal/stub/clock/client_clock/Makefile45
-rwxr-xr-xvideo_in_hal/stub/clock/client_clock/include/stub/Clock_API.h503
-rwxr-xr-xvideo_in_hal/stub/clock/client_clock/include/stub/clock_clock.h41
-rwxr-xr-xvideo_in_hal/stub/clock/client_clock/libClock_API.ver29
-rwxr-xr-xvideo_in_hal/stub/clock/client_clock/src/Clock_API.cpp118
-rwxr-xr-xvideo_in_hal/stub/clock/client_display_time/Makefile47
-rwxr-xr-xvideo_in_hal/stub/clock/client_display_time/include/stub/DTime_Api.h916
-rwxr-xr-xvideo_in_hal/stub/clock/client_display_time/include/stub/clock_display_time.h42
-rwxr-xr-xvideo_in_hal/stub/clock/client_display_time/include/stub/clock_notifications.h46
-rwxr-xr-xvideo_in_hal/stub/clock/client_display_time/libDTime_Api.ver31
-rwxr-xr-xvideo_in_hal/stub/clock/client_display_time/src/DTime_Api.cpp246
-rwxr-xr-xvideo_in_hal/stub/clock/localtime/Makefile49
-rwxr-xr-xvideo_in_hal/stub/clock/localtime/zoneinfo_base232
-rwxr-xr-xvideo_in_hal/stub/communication_subcpu/LICENSE177
-rwxr-xr-xvideo_in_hal/stub/communication_subcpu/Makefile19
-rwxr-xr-xvideo_in_hal/stub/communication_subcpu/client/Makefile43
-rwxr-xr-xvideo_in_hal/stub/communication_subcpu/client/include/stub/CommSubCpu_API.h266
-rwxr-xr-xvideo_in_hal/stub/communication_subcpu/client/include/stub/com_message_header.h65
-rwxr-xr-xvideo_in_hal/stub/communication_subcpu/client/src/CommSubCpu_API.cpp57
-rwxr-xr-xvideo_in_hal/stub/communication_usb/LICENSE177
-rwxr-xr-xvideo_in_hal/stub/communication_usb/Makefile19
-rwxr-xr-xvideo_in_hal/stub/communication_usb/client/Makefile43
-rwxr-xr-xvideo_in_hal/stub/communication_usb/client/include/stub/commusb_api.h186
-rwxr-xr-xvideo_in_hal/stub/communication_usb/client/include/stub/commusb_notifications.h56
-rwxr-xr-xvideo_in_hal/stub/communication_usb/client/src/commusb_api.cpp33
-rwxr-xr-xvideo_in_hal/stub/diag_code/LICENSE177
-rwxr-xr-xvideo_in_hal/stub/diag_code/Makefile18
-rwxr-xr-xvideo_in_hal/stub/diag_code/library/Makefile51
-rwxr-xr-xvideo_in_hal/stub/diag_code/library/include/stub/DIAGCODE.h46
-rwxr-xr-xvideo_in_hal/stub/diag_code/library/include/stub/DiagCodeAPI.h1226
-rwxr-xr-xvideo_in_hal/stub/diag_code/library/include/stub/ss_diag.h24
-rwxr-xr-xvideo_in_hal/stub/diag_code/library/libDiagCodeAPI.ver64
-rwxr-xr-xvideo_in_hal/stub/diag_code/library/src/DiagCodeAPI.cpp202
-rwxr-xr-xvideo_in_hal/stub/diag_code/library_dummy_dccc/Makefile46
-rwxr-xr-xvideo_in_hal/stub/diag_code/library_dummy_dccc/include/stub/DIAG_API_DCCC.h109
-rwxr-xr-xvideo_in_hal/stub/diag_code/library_dummy_dccc/src/DIAG_API_DCCC.cpp64
-rwxr-xr-xvideo_in_hal/stub/diag_record/LICENSE177
-rwxr-xr-xvideo_in_hal/stub/diag_record/Makefile19
-rwxr-xr-xvideo_in_hal/stub/diag_record/library_dummy_drec/Makefile48
-rwxr-xr-xvideo_in_hal/stub/diag_record/library_dummy_drec/include/stub/MM_DREC_API.h2203
-rwxr-xr-xvideo_in_hal/stub/diag_record/library_dummy_drec/src/MM_DREC_API.cpp450
-rwxr-xr-xvideo_in_hal/stub/diag_record/library_record_api/Makefile47
-rwxr-xr-xvideo_in_hal/stub/diag_record/library_record_api/include/stub/PFDREC_API.h975
-rwxr-xr-xvideo_in_hal/stub/diag_record/library_record_api/libDiagRecordAPI.ver44
-rwxr-xr-xvideo_in_hal/stub/diag_record/library_record_api/src/DiagRecordAPI.cpp178
-rwxr-xr-xvideo_in_hal/stub/diag_record/library_record_thread/Makefile47
-rwxr-xr-xvideo_in_hal/stub/diag_record/library_record_thread/include/stub/pfdrec_thread_ifc.h168
-rwxr-xr-xvideo_in_hal/stub/diag_record/library_record_thread/src/pfdrec_thread.cpp162
-rwxr-xr-xvideo_in_hal/stub/memory_gpio_access_library/LICENSE177
-rwxr-xr-xvideo_in_hal/stub/memory_gpio_access_library/Makefile20
-rwxr-xr-xvideo_in_hal/stub/memory_gpio_access_library/client/Makefile44
-rwxr-xr-xvideo_in_hal/stub/memory_gpio_access_library/client/include/stub/el_gpio.h802
-rwxr-xr-xvideo_in_hal/stub/memory_gpio_access_library/client/include/stub/el_mem.h396
-rwxr-xr-xvideo_in_hal/stub/memory_gpio_access_library/client/src/el_gpio.c79
-rwxr-xr-xvideo_in_hal/stub/memory_gpio_access_library/client/src/el_mem.c73
-rwxr-xr-xvideo_in_hal/stub/stub.mk42
-rwxr-xr-xvideo_in_hal/stub/vehicle/LICENSE177
-rwxr-xr-xvideo_in_hal/stub/vehicle/Makefile19
-rwxr-xr-xvideo_in_hal/stub/vehicle/client/Makefile60
-rwxr-xr-xvideo_in_hal/stub/vehicle/client/include/stub/Vehicle_API.h298
-rwxr-xr-xvideo_in_hal/stub/vehicle/client/include/stub/Vehicle_Sensor_Common_API.h502
-rwxr-xr-xvideo_in_hal/stub/vehicle/client/include/stub/vehicle_notifications.h48
-rwxr-xr-xvideo_in_hal/stub/vehicle/client/libVehicle_API.ver28
-rwxr-xr-xvideo_in_hal/stub/vehicle/client/src/Vehicle_API.cpp43
-rwxr-xr-xvideo_in_hal/systemservice/config/LICENSE177
-rwxr-xr-xvideo_in_hal/systemservice/config/Makefile.client19
-rwxr-xr-xvideo_in_hal/systemservice/config/library/Makefile19
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/Makefile21
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_access_if_private.h80
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_package.h65
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_system_manager_conf.h145
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/include/system_service/system_manager_config.h26
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/last2order/Makefile71
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/last2order/sm_last2order.cfobin0 -> 8 bytes
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/last2order/tool/mklast2ordertbl.pl107
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/order/Makefile64
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/order/launch_order_body.xml0
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/order/launch_order_main.xml23
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/order/launch_order_xml2cfg.pl171
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/order/system_launcher_main.order.cfg3
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/order/system_launcher_main.xml36
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/src/Makefile45
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/src/libsssmcfg.ver30
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/src/ss_system_manager_conf.cpp489
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/xml/Makefile53
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh69
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh116
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg7
-rwxr-xr-xvideo_in_hal/systemservice/config/library/system_manager_config/xml/sm_launch_agl.xml35
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/LICENSE177
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/Makefile.client33
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/Makefile127
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h86
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/ss_last_to_order_local.h41
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h86
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h85
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h89
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/ss_system_timer_local.h44
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/interface_unified.h100
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/interfaceunified_system_application.h219
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/interfaceunified_system_types.h165
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_boot_map.h25
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_client_names.h77
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service.h640
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h1118
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_local.h37
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h58
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h143
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h69
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types.h186
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h44
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_event_common.h111
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_event_common_local.h63
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_message.h40
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_if.h165
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_notifications.h46
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h72
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_last_to_order.h58
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service.h255
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_ifc.h1865
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_local.h94
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_notifications.h47
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_protocol.h146
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_store_logs.h81
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service.h535
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_if.h606
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_local.h66
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications.h48
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications_local.h67
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_protocol.h201
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_services.h63
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_client_if.h1064
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_client_if_local.h66
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names.h45
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names_local.h46
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_string_maps.h680
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_sys_boot_area_map.h39
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_if.h119
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_if.h335
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_if_local.h40
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications.h49
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h51
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol.h329
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h45
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_process.h1118
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_timer.h670
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_types.h36
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_templates.h303
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_test_clients.h31
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/include/system_service/ss_version.h33
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/libSS_SystemIfUnified.ver78
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/makefile_PosixBasedOS001180
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_devicedetection_service_ifc.cpp673
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_framework_if.cpp55
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_heartbeat_client.cpp156
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_last_to_order.cpp186
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_logger_service_ifc.cpp781
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_power_client.cpp254
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_pwrsvc_if.cpp343
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_sm_client.cpp1509
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_string_maps.cpp462
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_system_process.cpp1147
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/library/src/ss_system_timer.cpp228
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/scfg/gpf_ss_cpu_mon_config.cfg14
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/scfg/gpf_ss_ps_config.cfg20
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/scfg/gpf_ss_showmem.cfg6
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/scfg/ss_cpu_high_load_monitor.cfg85
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/scfg/ss_logger.cfg133
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/scfg/system_launch_flashloader.cfg8
-rwxr-xr-xvideo_in_hal/systemservice/interface_unified/scfg_pram/gpf_ss_sm_config_data.cfg26
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/LICENSE177
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/Makefile.server19
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/Makefile28
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/SS_LoggerService.conf_bin4
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/loggerservicedebug_loggerservicelog.h81
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/loggerservicedebug_thread_if.h319
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/loggerservicedebug_writer_Evntworker.h211
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/readerWriter/reader/mem_reader.h51
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/readerWriter/reader/queue_reader.h49
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/readerWriter/reader/reader.h52
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/readerWriter/reader_writer.h77
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/readerWriter/reader_writer_cfg.h35
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/readerWriter/writer/cached_file_writer.h45
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/readerWriter/writer/file_writer.h51
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/readerWriter/writer/udp_file_writer.h54
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/readerWriter/writer/udp_writer.h63
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/readerWriter/writer/writer.h56
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_cfg.h185
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_common.h115
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_device_detection.h66
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_error_event.h156
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_archive.h77
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_can_evt_reply.h48
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_cfg.h135
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_storage.h82
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_fs_directory.h108
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_popups.h51
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_reader_writer_control.h49
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_scrshot.h30
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_service_callbacks.h96
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_types.h52
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/include/ss_logger_util.h127
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/lib/Makefile62
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/lib/ss_logger_store_logs.cpp2233
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h96
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/realtimeUsbLog/Makefile22
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/realtimeUsbLog/realtimeUsbLog.conf_bin4
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/Makefile74
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp103
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp722
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/realtimeUsbLog/work/Makefile23
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/realtimeUsbLog/work_debug/Makefile19
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/screenShot/Makefile52
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/screenShot/ss_logger_scrshot.cpp89
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/cached_file_writer.cpp79
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/file_writer.cpp122
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/loggerservice_application.cpp952
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/loggerservice_main.cpp59
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/loggerservicedebug_child_thread.cpp134
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp1362
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/mem_reader.cpp125
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/mod_version.c49
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/queue_reader.cpp101
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/reader.cpp86
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/reader_writer.cpp282
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_cfg.cpp754
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_device_detection.cpp209
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_error_event.cpp1047
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_archive.cpp413
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp147
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_cfg.cpp335
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_responses.cpp625
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_storage.cpp628
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_fs_directory.cpp236
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_popups.cpp176
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_reader_writer_control.cpp151
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_server_callbacks.cpp900
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/ss_logger_util.cpp1273
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/testapps/fopen0
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/testapps/testapps.log0
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/testapps/testapps.tar.gz0
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/udp_file_writer.cpp161
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/udp_writer.cpp295
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/src/writer.cpp86
-rwxr-xr-xvideo_in_hal/systemservice/logger_service/server/work/Makefile126
-rwxr-xr-xvideo_in_hal/systemservice/power_service/LICENSE177
-rwxr-xr-xvideo_in_hal/systemservice/power_service/Makefile.server19
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/Makefile51
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/include/ss_power.h318
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/include/ss_power_config.h147
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/include/ss_power_powerservicelog.h85
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/include/ss_power_session.h70
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/include/ss_power_state_hysteresis.h74
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/include/ss_power_state_machine.h414
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/src/powerservice_application.cpp236
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/src/powerservice_main.cpp70
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/src/ss_power.cpp1672
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/src/ss_power_config.cpp188
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/src/ss_power_session.cpp276
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/src/ss_power_state_machine.cpp924
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/src/ss_pwr_test_client_handlers.cpp204
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/src/ss_supervisor_handlers.cpp498
-rwxr-xr-xvideo_in_hal/systemservice/power_service/server/src/ss_system_handlers.cpp52
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/LICENSE177
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/Makefile.client21
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/Makefile.server23
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/client/Makefile58
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/client/RESMGR.api12
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/client/include/resmgr_api_resourcemanagerlog.h78
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/client/libresm.ver28
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/client/src/#resmgr_api_lib.c#142
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/client/src/resmgr_api_lib.c142
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/drop_caches/Makefile38
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/drop_caches/src/drop_caches.cpp183
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/Makefile55
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/include/proc_watch.h25
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/include/resm_cfg.h132
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/include/resm_internal.h40
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h82
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/include/system_service/resm.h325
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/include/system_service/resm_type.h85
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/include/system_service/resource_manager.h43
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/src/cpuload_custom.cpp512
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/src/proc_watch.cpp285
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/src/resm.cpp2667
-rwxr-xr-xvideo_in_hal/systemservice/resource_manager/server/src/resourcemanager_application.cpp155
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/LICENSE177
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/Makefile.client19
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/Makefile19
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/include/rom_access_library_nor.h43
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/include/rom_access_library_rom.h45
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/include/ss_rom_access_define.h38
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h89
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/include/ss_sm_checksum.h34
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/include/system_service/nor_backup.h212
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/include/system_service/rom_access_library.h47
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h362
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h235
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h1010
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/nor/Makefile46
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/nor/libBlkDev_API.ver30
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/nor/libssaccess.ver30
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/nor/src/nor_backup.c807
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/rom/Makefile62
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp122
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp37
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp215
-rwxr-xr-xvideo_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp969
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/LICENSE177
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/Makefile.server19
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/Makefile118
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/PhaseInfo.txt2
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h46
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_if.h67
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_session.h91
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h206
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h58
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h30
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h111
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h62
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_sm_config.h543
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_sm_default_paths.h42
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h72
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h111
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_sm_launch_configuration.h191
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_sm_signals.h32
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h91
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_sm_version.h39
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_system_manager.h760
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_system_manager_callbacks.h29
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_system_memory_monitor.h85
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/ss_system_thread_info.h45
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/include/system_launcher_cfg_format.h66
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/sm_launch__CWORD84_.xml116
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_if.cpp201
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp184
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_session.cpp415
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_thread.cpp355
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/processlauncher/ProcessLauncher.cpp317
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp126
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/ss_sm_config.cpp1528
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/ss_sm_dynamic_launcher.cpp221
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/ss_sm_version.cpp79
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/ss_system_manager.cpp3655
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/ss_system_manager_callbacks.cpp3411
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event.cpp945
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event_responses.cpp1007
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event_triggers.cpp1093
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/ss_system_memory_monitor.cpp362
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/systemmanager_application.cpp237
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/src/systemmanager_main.cpp120
-rwxr-xr-xvideo_in_hal/systemservice/system_manager/server/version.txt2
-rwxr-xr-xvideo_in_hal/systemservice/system_service.mk44
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/LICENSE177
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/Makefile.client21
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/Makefile.server21
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/Makefile26
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libprimary/Makefile37
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libprimary/include/pri_main.h48
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libprimary/libprimary.ver22
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libprimary/src/pri_api.cpp224
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libprimary/src/pri_main.cpp873
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskm/Makefile35
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskm/TSKM.api9
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskm/libtskm.ver21
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskm/src/tskm_api_lib.cpp90
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/Makefile93
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/conf/agl_thread.h1377
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_launch.xml106
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml11
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml6
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml8
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml5
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h40
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.h59
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h173
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/libtskmcfg.ver21
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/src/parsexml.c879
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp138
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/libtskmcfg/tskm_cfg.xml83
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/ss_data_init/Makefile43
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h78
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h39
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h121
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/ss_data_init/include/tskm_data_init_local.h25
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/ss_data_init/mkdatainit.sh45
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/client/ss_data_init/tskm_data_init.cpp.in66
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/include-share/tskm_gstep.h54
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/include-share/tskm_type_local.h52
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/include-share/tskm_util.h32
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/Makefile67
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/system_service/INI_API.h25
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/system_service/INI_API.hpp738
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/system_service/Primary_common.h148
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/system_service/sysup.h41
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/system_service/sysup_from.h41
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/system_service/task_manager.h54
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/system_service/tskm.h413
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/system_service/tskm_local_type.h287
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/system_service/tskm_svc.h904
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/system_service/tskm_type.h123
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/tskm_comm.h59
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/tskm_debug.h208
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/tskm_main.h71
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/tskm_port_pf.h46
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/tskm_port_subsys.h42
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/tskm_shutdown.h27
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/tskm_state.h36
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/tskm_wakeup.h26
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/include/tskm_watch.h25
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/pri_main.cpp840
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_api.cpp268
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_comm.cpp402
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_debug.cpp286
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_main.cpp727
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_port_pf.cpp884
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_port_subsys.cpp297
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_shutdown.cpp242
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_state.cpp452
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_svc.cpp970
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_wakeup.cpp201
-rwxr-xr-xvideo_in_hal/systemservice/task_manager/server/src/tskm_watch.cpp101
-rwxr-xr-xvideo_in_hal/systemservice/version_library/LICENSE177
-rwxr-xr-xvideo_in_hal/systemservice/version_library/Makefile.client19
-rwxr-xr-xvideo_in_hal/systemservice/version_library/library/Makefile37
-rwxr-xr-xvideo_in_hal/systemservice/version_library/library/include/system_service/ss_ver.h338
-rwxr-xr-xvideo_in_hal/systemservice/version_library/library/include/system_service/version_library.h40
-rwxr-xr-xvideo_in_hal/systemservice/version_library/library/src/ss_ver.cc309
-rwxr-xr-xvideo_in_hal/update_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/update_hal/Makefile34
-rwxr-xr-xvideo_in_hal/update_hal/hal_api/update_hal.h165
-rwxr-xr-xvideo_in_hal/update_hal/include/update_hal.h165
-rwxr-xr-xvideo_in_hal/usb_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/usb_hal/Makefile66
-rwxr-xr-xvideo_in_hal/usb_hal/hal_api/usb_hal.h379
-rwxr-xr-xvideo_in_hal/usb_hal/inc/usb_hal_debug.h31
-rwxr-xr-xvideo_in_hal/usb_hal/inc/usb_hal_internal.h165
-rwxr-xr-xvideo_in_hal/usb_hal/inc/usb_hal_usbhallog.h77
-rwxr-xr-xvideo_in_hal/usb_hal/src/usb_hal.cpp500
-rwxr-xr-xvideo_in_hal/vehicle_hal/LICENSE177
-rwxr-xr-xvideo_in_hal/vehicle_hal/Makefile69
-rwxr-xr-xvideo_in_hal/vehicle_hal/README.md3
-rwxr-xr-xvideo_in_hal/vehicle_hal/hal_api/vehicle_hal.h210
-rwxr-xr-xvideo_in_hal/vehicle_hal/inc/vehicle_hal_frameworkunifiedlog.h78
-rwxr-xr-xvideo_in_hal/vehicle_hal/src/vehicle_hal.cpp398
-rwxr-xr-xvideo_in_hal/vehicleservice/.gitattributes128
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/LICENSE177
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/Makefile.client20
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/Makefile.server20
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/Makefile31
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/CanInput_API.h98
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/CanInput_API_private.h68
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Clock_API.h258
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/CommonDefine.h72
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/DR_API.h148
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/DeadReckoning_DbgLogSim.h50
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Dead_Reckoning_API.h229
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Dead_Reckoning_Local_Api.h147
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Gps_API_private.h64
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/INI_API.h259
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Naviinfo_API.h110
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/POS_common_private.h62
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/POS_private.h981
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/POS_sensor_private.h163
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/SensorLocation_API.h124
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/SensorLocation_API_private.h39
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/SensorMotion_API.h178
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Sensor_API.h36
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Sensor_API_private.h174
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Sensor_Common_API.h193
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/VehicleDebug_API.h110
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Vehicle_API.h115
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Vehicle_API_Dummy.h142
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/Vehicle_API_private.h129
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_common_API.h1663
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_define.h134
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_gps_API.h1135
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_sensor_API.h716
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/include/vehicle_service/positioning.h46
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_common_API/Common_API.cpp889
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_common_API/Makefile47
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_common_API/libPOS_common_API.ver37
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Gps_API.cpp456
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Makefile51
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Naviinfo_API.cpp404
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_gps_API/libPOS_gps_API.ver34
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Makefile48
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Sensor_API.cpp784
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Vehicle_API.cpp292
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver32
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/Makefile22
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/ClockDataMng.h100
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/ClockGPS_Process_Proto.h37
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/ClockUtility.h46
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/ClockUtility_private.h49
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_Common.h84
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DataMaster.h127
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DeliveryCtrl.h137
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_main.h146
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/GpsInt.h68
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/SensorLog.h114
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_Common.h131
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_DataMaster.h1091
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_DeliveryCtrl.h253
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_FromAccess.h69
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_SelectionItemList.h116
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_SharedMemory.h48
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_Thread.h185
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSensor_Thread.h33
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleUtility.h128
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/ServiceInterface/BackupMgrIf.h65
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ClockIf.h61
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/ServiceInterface/CommUsbIf.h64
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/ServiceInterface/DevDetectSrvIf.h69
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/ServiceInterface/DiagSrvIf.h55
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/ServiceInterface/PSMShadowIf.h58
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/ServiceInterface/VehicleIf.h82
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ps_psmshadow_notifications.h62
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ps_version.h45
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/nsfw/positioning_common.h90
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/include/nsfw/vehicle_version.h29
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/ClockUtility.cpp414
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Common.cpp127
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DataMasterMain.cpp298
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DeliveryCtrl.cpp835
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Altitude_dr.cpp106
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroOffset_dr.cpp115
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp115
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactor_dr.cpp115
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Heading_dr.cpp106
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Latitude_dr.cpp105
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Longitude_dr.cpp105
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SnsCounter.cpp103
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp116
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp115
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Speed_dr.cpp105
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_main.cpp1086
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/GpsInt.cpp171
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/Makefile181
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/SensorLog.cpp1307
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_CanDeliveryEntry.cpp47
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Common.cpp429
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_DataMasterMain.cpp1880
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_DeliveryCtrl.cpp2243
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GPSInterruptFlag.cpp105
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna.cpp58
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntennaStatus.cpp112
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna_l.cpp97
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift.cpp51
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift_g.cpp102
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq.cpp51
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq_g.cpp102
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsCounter_g.cpp98
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsNmea_g.cpp89
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime.cpp53
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw.cpp51
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw_g.cpp107
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime_g.cpp102
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp99
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp102
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82__CWORD44_Gp4_g.cpp101
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX.cpp119
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXExt_l.cpp145
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXFst_l.cpp127
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX_l.cpp98
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY.cpp121
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYExt_l.cpp145
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYFst_l.cpp128
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY_l.cpp99
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ.cpp116
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZExt_l.cpp142
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZFst_l.cpp127
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ_l.cpp97
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroConnectStatus.cpp110
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroExt_l.cpp257
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp.cpp114
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempExt_l.cpp140
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempFst_l.cpp128
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp_l.cpp95
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTrouble.cpp121
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX.cpp145
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroXFst_l.cpp176
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX_l.cpp128
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY.cpp113
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYExt_l.cpp148
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYFst_l.cpp169
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY_l.cpp126
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ.cpp113
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZExt_l.cpp148
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZFst_l.cpp169
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ_l.cpp126
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude.cpp55
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_g.cpp105
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_n.cpp121
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea.cpp50
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea_n.cpp118
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat.cpp56
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_g.cpp104
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_n.cpp163
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MainGpsInterruptSignal.cpp132
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Mon_Hw_g.cpp104
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading.cpp55
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_g.cpp105
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_n.cpp162
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed.cpp57
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_g.cpp107
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_i.cpp103
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_n.cpp103
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Clock_g.cpp104
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Dop_g.cpp104
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Posllh_g.cpp104
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Status_g.cpp104
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_SvInfo_g.cpp108
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeGps_g.cpp104
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeUtc_g.cpp104
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Velned_g.cpp104
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_NaviinfoDiagGPS_g.cpp94
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime.cpp115
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTimeExt_l.cpp143
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime_l.cpp93
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev.cpp118
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevExt_l.cpp134
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevFst_l.cpp171
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev_l.cpp157
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime.cpp58
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime_clock.cpp116
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter.cpp90
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounterExt_l.cpp155
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter_l.cpp124
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph.cpp57
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph_l.cpp156
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse.cpp117
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseExt_l.cpp150
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlag.cpp133
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlagFst_l.cpp91
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFst_l.cpp172
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse_l.cpp128
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SysGpsInterruptSignal.cpp132
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover.cpp51
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover_g.cpp102
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_FromAccess.cpp319
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_SelectionItemList.cpp466
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_SharedMemory.cpp521
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Thread.cpp2144
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleUtility.cpp455
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/ServiceInterface/BackupMgrIf.cpp211
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/ServiceInterface/ClockIf.cpp138
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/ServiceInterface/CommUsbIf.cpp147
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/ServiceInterface/DevDetectSrvIf.cpp279
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/ServiceInterface/DiagSrvIf.cpp64
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/ServiceInterface/Makefile54
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/ServiceInterface/PSMShadowIf.cpp102
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/ServiceInterface/VehicleIf.cpp364
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/nsfw/Makefile89
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/nsfw/positioning_application.cpp2593
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning/server/src/nsfw/ps_main.cpp59
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/LICENSE177
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/Makefile.client20
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/Makefile87
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h76
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h111
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/WPF_STD_private.h295
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/_pbCommon.h36
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h128
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/_pbInternalProc.h41
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/_pbSerial.h32
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h40
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/sysup.h24
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/sysup_addr.h227
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/tchar.h256
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h1653
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h77
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h46
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h91
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h55
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h359
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/libPOS_base_API.ver39
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/MsgBapi.cpp347
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp254
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp131
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbCommon.cpp928
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbDram.cpp284
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbEvent.cpp1695
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbFsys.cpp171
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbMem.cpp989
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbMisc.cpp226
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbMsg.cpp1572
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbMutex.cpp1423
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp541
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbOther.cpp799
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp207
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbSem.cpp780
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbSerial.cpp525
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbSram.cpp316
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbSum.cpp95
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbTimer.cpp1115
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp358
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp25
-rwxr-xr-xvideo_in_hal/vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp25
-rwxr-xr-xvideo_in_hal/vehicleservice/vehicle_service.mk42
2603 files changed, 649114 insertions, 0 deletions
diff --git a/agl-basefiles/BS/ns/npp/rwdata/version.txt b/agl-basefiles/BS/ns/npp/rwdata/version.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/agl-basefiles/BS/ns/npp/rwdata/version.txt
@@ -0,0 +1 @@
+1
diff --git a/agl-basefiles/LICENSE b/agl-basefiles/LICENSE
new file mode 100644
index 0000000..f433b1a
--- /dev/null
+++ b/agl-basefiles/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/agl-basefiles/agldd/ev_common.h b/agl-basefiles/agldd/ev_common.h
new file mode 100644
index 0000000..1a68fea
--- /dev/null
+++ b/agl-basefiles/agldd/ev_common.h
@@ -0,0 +1,135 @@
+/**
+ * @file ev_common.h
+ * @brief Event library -- User kernel common data structure
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ev_common_h_
+#define _ev_common_h_
+
+#include <agldd/ev_id.h>
+
+/** @addtogroup EV
+ * @{ */
+/** @brief Maximum number of bytes for message event */
+#define EV_MAX_MESSAGE_LENGTH 2048
+
+/** @brief -Maximum number of flag queue that can be created within a thread */
+#define EV_MAX_IDS_IN_THREAD 24
+
+/** @brief -Muximum number of threads that can be registered to the EV in a process */
+#define EV_MAX_THREADS_IN_PROCESS 16
+
+/** @brief -Maximum number of flag queue that can be creat within a process
+ */
+#define EV_MAX_IDS_IN_PROCESS \
+ (EV_MAX_IDS_IN_THREAD * EV_MAX_THREADS_IN_PROCESS)
+
+/** @brief Return values for even library function
+ *
+ * @see EV_ERR
+ */
+enum ev_err
+{
+ EV_OK = 0, /**< Normal completion */
+ EV_ERR_Exist, /**< The specified flag message queue does exist */
+ EV_ERR_Invalid_ID, /**< The specified flag message queue does not exist */
+ EV_ERR_Busy, /**< Message queue full failed to send */
+ EV_ERR_Interrupted, /**< Waiting function was interrupted by an interrupt */
+ EV_ERR_Thread_Over, /**< Exceeding the number of threads in the process */
+ EV_ERR_Invalid_Thread, /**< Invalid thread ID */
+ EV_ERR_Fatal, /**< Fatal error */
+};
+/** @brief Return values type for even library function
+ *
+ * @see ev_err
+ */
+typedef INT32 EV_ERR;
+
+/** @brief Event type
+ *
+ * Use in the type of EV_Event structs
+ * @see ev_type
+ */
+typedef UINT32 EV_Type;
+
+/** @brief Bit value representing the type of event */
+enum ev_type {
+ EV_EVENT_None = 0x00000000,
+
+ /** Flag event: Judged by EV_EVENT_IS_FLAG() */
+ EV_EVENT_Flag = 0x0001,
+#define EV_EVENT_IS_FLAG(tp) (((tp) & EV_EVENT_Flag) != 0)
+
+ /** Message event: Judged by EV_EVENT_IS_MESSAGE() */
+ EV_EVENT_Message = 0x0002,
+#define EV_EVENT_IS_MESSAGE(tp) (((tp) & EV_EVENT_Message) != 0)
+
+ /** 64bit flag event: Judged by EV_EVENT_IS_FLAG64() */
+ EV_EVENT_Flag64 = 0x0003,
+#define EV_EVENT_IS_FLAG64(tp) (((tp) & EV_EVENT_Flag64) != 0)
+
+};
+
+/** @brief Flag event structure */
+typedef struct {
+ EV_ID flagID;/**< Flag ID */
+ UINT32 bits;/**< Bit pattern */
+} EV_Flag;
+
+/** @brief 64bit flag event structure */
+typedef struct {
+ EV_ID flagID;/**< Flag ID */
+ UINT64 bits;/**< Bit pattern */
+} EV_Flag64;
+
+/** @brief Message event structure */
+typedef struct {
+ EV_ID queueID;/**< queue ID */
+ UINT32 senderInfo;/**< Source information */
+ UINT32 length;/**< Number of bytes in the message */
+ UINT32 dummy;/** dummy for pading */
+ UINT8 message[EV_MAX_MESSAGE_LENGTH];/**< Message */
+} EV_Message;
+
+/** @brief Event structure */
+typedef struct {
+ EV_Type type; /**< Event type */
+ union {
+ EV_Flag flag; /**< Flag event structure */
+ EV_Flag64 flag64; /**< Flag event structure */
+ EV_Message message; /**< Message event structure */
+ } u; /**< Union of structures per event type */
+} EV_Event;
+
+/** @brief Message event queue type
+ *
+ * Specify the action to be taken when the queue overflows (more events are received when the queue is full).
+ */
+enum ev_message_queue_type {
+ EV_MESSAGE_QUEUE_TYPE_BUSY,/**< Return a BUSY to the source */
+ EV_MESSAGE_QUEUE_TYPE_FIFO,/**< Delete the oldest event */
+ EV_MESSAGE_QUEUE_TYPE_REPLACE,/**< Replace the most recent event */
+};
+
+/** @brief Messge event queue type
+ *
+ * @see ev_message_queue_type
+ */
+typedef UINT8 EV_Message_Queue_Type;
+
+/** @} */
+
+#endif /* !_ev_common_h_ */
diff --git a/agl-basefiles/agldd/ev_id.h b/agl-basefiles/agldd/ev_id.h
new file mode 100644
index 0000000..2026ef7
--- /dev/null
+++ b/agl-basefiles/agldd/ev_id.h
@@ -0,0 +1,104 @@
+/**
+ * @file ev_id.h
+ * @brief Event library(kernel) -- Defining flag queue ID
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ev_id_h_
+#define _ev_id_h_
+
+/** @addtogroup EV_ID_spec
+ * @{ */
+
+/** @brief Flag ID and queue ID types used when sending and receiving events
+ *
+ * Assign a 32-bit value as follows
+ *
+ * - Most significant 8 bits: Reserved
+ * - Next 16 bits: Modue ID
+ * - Lower 8 bits: Define in module
+ *
+ * Where module is the modules that creates the queue.
+ * The modules define ID according to the above assignments using EV_Flag_ID_Base and EV_Queue_ID_Base macros.
+ * @see EV_Flag_ID_Base
+ * @see EV_Queue_ID_Base
+ */
+typedef UINT32 EV_ID;
+
+#define EV_ID_BIT 0x80000000UL
+#define EV_FLAG64_BIT 0x40000000UL
+#define EV_FLAG_BIT 0x20000000UL
+#define EV_QUEUE_BIT 0x10000000UL
+#define EV_AUTO_ID_BIT 0x08000000UL
+#define EV_RESERVED_BIT 0xff000000UL
+#define EV_INVALID_ID EV_ID_BIT
+#define EV_NO_ID EV_INVALID_ID
+
+#define EV_ID_IS_FLAG(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_FLAG_BIT)) == (EV_ID_BIT|EV_FLAG_BIT))
+#define EV_ID_IS_FLAG64(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_FLAG64_BIT)) == (EV_ID_BIT|EV_FLAG64_BIT))
+#define EV_ID_IS_QUEUE(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_QUEUE_BIT)) == (EV_ID_BIT|EV_QUEUE_BIT))
+#define EV_ID_IS_AUTO_ID(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_AUTO_ID_BIT)) == (EV_ID_BIT|EV_AUTO_ID_BIT))
+#define EV_ID_IS_VALID(queueID) \
+ (EV_ID_IS_FLAG(queueID) || EV_ID_IS_FLAG64(queueID) || EV_ID_IS_QUEUE(queueID))
+
+/** @brief Macros for defining flag ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Flag_ID_Base EV_Flag_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Flag_foo (XXX_Flag_ID_Base + 1)
+ * - #define XXX_Flag_bar (XXX_Flag_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Flag_ID_Base(mod) (EV_ID_BIT|EV_FLAG_BIT|((mod)<<8))
+
+/** @brief Macros for defining 64 bits flag ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Flag64_ID_Base EV_Flag64_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Flag64_foo (XXX_Flag64_ID_Base + 1)
+ * - #define XXX_Flag64_bar (XXX_Flag64_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Flag64_ID_Base(mod) (EV_ID_BIT|EV_FLAG64_BIT|((mod)<<8))
+
+/** @brief Macros for defining mesage queue ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Queue_ID_Base EV_Queue_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Queue_foo (XXX_Queue_ID_Base + 1)
+ * - #define XXX_Queue_bar (XXX_Queue_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Queue_ID_Base(mod) (EV_ID_BIT|EV_QUEUE_BIT|((mod)<<8))
+
+/** @} */
+
+#endif /* ! _ev_id_h_ */
diff --git a/agl-basefiles/agldd/evk_lib.h b/agl-basefiles/agldd/evk_lib.h
new file mode 100644
index 0000000..378df13
--- /dev/null
+++ b/agl-basefiles/agldd/evk_lib.h
@@ -0,0 +1,116 @@
+/**
+ * @file evk_lib.h
+ * @brief Event library -- API specifications for kernel modules
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _evk_lib_h_
+#define _evk_lib_h_
+
+#include <agldd/ev_common.h>
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+/* API definition */
+
+/** @addtogroup EV
+ * @{ */
+#ifdef __KERNEL__
+/* Flag message queue create/delete */
+EV_ERR EVK_create_flag(EV_ID flagID);
+EV_ERR EVK_create_flag64(EV_ID flagID);
+EV_ERR EVK_create_queue(EV_ID queueID,
+ UINT8 length,
+ UINT16 max_bytes,
+ EV_Message_Queue_Type type);
+
+EV_ERR EVK_create_flag_auto_id(/* OUT */EV_ID *flagID);
+EV_ERR EVK_create_flag64_auto_id(/* OUT */EV_ID *flagID);
+EV_ERR EVK_create_queue_auto_id(/* OUT */EV_ID *queueID,
+ UINT8 length,
+ UINT16 max_bytes,
+ EV_Message_Queue_Type type);
+
+EV_ERR EVK_destroy_flag(EV_ID flagID);
+EV_ERR EVK_destroy_queue(EV_ID queueID);
+
+/* Send events */
+EV_ERR EVK_set_flag(EV_ID flagID, UINT32 bits);
+EV_ERR EVK_set_flag64(EV_ID flagID, UINT64 bits);
+EV_ERR EVK_send_message(EV_ID queueID, UINT16 bytes, const void *message,
+ UINT32 senderInfo);
+
+/* Get event(with search conditions) */
+EV_ERR EVK_get_flag(EV_ID flagID, /* OUT */EV_Flag *flag);
+EV_ERR EVK_wait_flag(EV_ID flagID, /* OUT */EV_Flag *flag);/* block */
+EV_ERR EVK_peek_flag(EV_ID flagID, /* OUT */EV_Flag *flag);
+EV_ERR EVK_get_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);
+EV_ERR EVK_wait_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);/* block */
+EV_ERR EVK_peek_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);
+
+EV_ERR EVK_get_message(EV_ID queueID, /* OUT */EV_Message *message);
+EV_ERR EVK_wait_message(EV_ID queueID, /* OUT */EV_Message *message);/* block */
+EV_ERR EVK_peek_message(EV_ID queueID, /* OUT */EV_Message *message);
+
+EV_ERR EVK_find_message_by_sender(EV_ID queueID, UINT32 senderInfo,
+ /* OUT */EV_Message *message);
+EV_ERR EVK_find_message_by_content(EV_ID queueID, UINT16 length,
+ const void *compare_bytes,
+ /* OUT */EV_Message *message);
+#endif
+
+/** @} */
+
+/** @addtogroup EVK_in
+ * @{ */
+#define EVK_NAME "evk"
+#define EVK_DEV_NAME "/dev/agl/"EVK_NAME
+#define EVK_DEV_MAJOR 1033
+#define EVK_IOC_MAGIC 0xE7
+
+#define EVK_IOC_CREATE_FLAG _IO(EVK_IOC_MAGIC, 0x00)
+#define EVK_IOC_CREATE_FLAG64 _IO(EVK_IOC_MAGIC, 0x01)
+#define EVK_IOC_CREATE_MESSAGE_QUEUE _IO(EVK_IOC_MAGIC, 0x02)
+#define EVK_IOC_ALLOC_FLAG_ID _IO(EVK_IOC_MAGIC, 0x03)
+#define EVK_IOC_ALLOC_FLAG64_ID _IO(EVK_IOC_MAGIC, 0x04)
+#define EVK_IOC_ALLOC_QUEUE_ID _IO(EVK_IOC_MAGIC, 0x05)
+#define EVK_IOC_DESTROY_QUEUE _IO(EVK_IOC_MAGIC, 0x06)
+#define EVK_IOC_STORE_FLAG _IO(EVK_IOC_MAGIC, 0x07)
+#define EVK_IOC_STORE_FLAG64 _IO(EVK_IOC_MAGIC, 0x08)
+#define EVK_IOC_STORE_MESSAGE _IO(EVK_IOC_MAGIC, 0x09)
+#define EVK_IOC_SET_POLL _IO(EVK_IOC_MAGIC, 0x0a)
+#define EVK_IOC_GET_EVENT _IO(EVK_IOC_MAGIC, 0x0b)
+#define EVK_IOC_PEEK_EVENT _IO(EVK_IOC_MAGIC, 0x0c)
+#define EVK_IOC_WAIT_EVENT _IO(EVK_IOC_MAGIC, 0x0d)
+#define EVK_IOC_GET_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0e)
+#define EVK_IOC_PEEK_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0f)
+#define EVK_IOC_DEBUG_LIST _IO(EVK_IOC_MAGIC, 0x10)
+
+typedef struct {
+ EV_ID queueID;/**< Queue ID */
+ UINT32 max_bytes;/**< Maximum number of bytes for an event */
+ UINT8 length;/**< Queue length */
+ EV_Message_Queue_Type type;/**< Type */
+} EVK_Message_Queue_Request;
+
+typedef struct {
+ INT32 num; /**< Number of queue ID of search */
+ EV_ID ids[EV_MAX_IDS_IN_PROCESS]; /**< Queue ID of search */
+ EV_Event ev; /**< [OUT] First event that occured */
+} EVK_Next_Event_Query;
+
+/** @} */
+
+#endif /* !_evk_lib_h */
diff --git a/agl-basefiles/agldd/moduleid.h b/agl-basefiles/agldd/moduleid.h
new file mode 100644
index 0000000..b18c1a1
--- /dev/null
+++ b/agl-basefiles/agldd/moduleid.h
@@ -0,0 +1,69 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <linux/autoconf.h>
+#ifndef _AGLDD_MODULEID_H_
+#define _AGLDD_MODULEID_H_
+
+/*
+ * Define module ID to be used by programs in moduleid_id.h .
+ * Define in the format of "#define XXX_MID ID number" (XXX is the module name).
+ *
+ * MID allocation policy shall be as follows.
+ * - UI Application : 0xxxh
+ * - Application Service : 1xxxh to 2xxxh
+ * + HMI : 10xxh
+ * + AV : 12xxh
+ * + Radio : 14xxh
+ * + Connectivity : 16xxh
+ * + Navigation/Location: 18xxh
+ * + Vehicle : 1Axxh
+ * + Communication : 1Cxxh
+ * + BasePF : 1Exxh
+ * + System : 20xxh
+ * + Other : 22xxh
+ * - Common Service : 3xxxh
+ * - Extension Service : 4xxxh
+ * - System/Device Driver : 5xxxh
+ */
+
+/* UI Application : 0xxxh */
+
+/* Application Service : 1xxxh to 2xxxh */
+#define MODEMANAGER_MID 0x1000
+#define ACTIVITYMANAGER_MID 0x1001
+
+/* Common Service : 3xxxh */
+#define IPMANAGER_MID 0x3000
+#define DEVICEMANAGER_MID 0x3001
+#define MSGBRK_MID 0x3002
+#define TIMERENTRYDRV_MID 0x3003
+#define SOUNDAGENT_MID 0x3004
+#define CAN_MID 0x3006
+#define _CWORD83__MID 0x3007
+#define SENSOR_MID 0x3008
+#define GPS_MID 0x3009
+#define RESMGR_MID 0x300A
+#define GRAPHICS_MID 0x300B
+
+/* Extension Service : 4xxxh */
+
+/* System/Device Driver : 5xxxh */
+#define EV_MID 0x5001
+#define RPC_MID 0x5002
+#define EVK_MID 0x5801
+
+#endif /* !_AGLDD_MODULEID_H_ */
diff --git a/agl-basefiles/bin/launch_xml2cfg.sh b/agl-basefiles/bin/launch_xml2cfg.sh
new file mode 100644
index 0000000..dfa1fa9
--- /dev/null
+++ b/agl-basefiles/bin/launch_xml2cfg.sh
@@ -0,0 +1,138 @@
+#!/bin/bash
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#Since xpath is slow, use sed as much as possible.
+
+infile=$1
+main_file=system_launcher_main.xml
+body_file=system_launcher_body.xml
+
+
+#check xmllint is exist
+if ! which xmllint > /dev/null ; then
+ echo "It need xmllint. Please install it."
+ exit 1;
+fi
+
+#check xpath is exist
+if ! which xpath > /dev/null ; then
+ echo "It need xpath Please install it."
+ exit 1;
+fi
+
+#arg check
+if ! [[ "$infile" =~ .+\.xml ]] ;then
+ echo "$infile is not *.xml"
+ exit 1
+elif ! [ -e $infile ];then
+ echo "$infile not found"
+ exit 1
+fi
+
+cp -f `dirname $0`/$main_file `dirname $1`
+cp -f $infile $body_file
+
+#check xml vaild
+if ! xmllint --noout --valid $main_file ;then
+ echo "XML is Invalid. "
+ exit 1;
+fi
+
+#Format into xpath and read into memory
+xmem=`xpath -q -e /system_launcher $main_file`
+
+echo "# This file is created from $infile."
+echo "# created date : `LANG=en date`"
+echo "[ModulesLaunchConfig]"
+
+#GROUP LOOP
+group_num=`echo $xmem | xpath -e /system_launcher/group 2>&1 | grep Found | cut -d ' ' -f2`
+
+l_idx=1
+cur_group=1
+until [ $cur_group -gt $group_num ];
+do
+ #LAUNCH LOOP
+ group_text=`echo $xmem | xpath -q -e /system_launcher/group[$cur_group]` #ALL XML text for group
+ group_attr=`echo $group_text | sed 's/\(<group[^>]\+>\)\(.*\)/\1/g'`
+
+ g_name=`echo $group_attr | sed 's/\(.* name="\)\([^"]*\)\(.*\)/\2/g'`
+ g_wait_time=`echo $group_attr | sed 's/\(.* wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ g_trigger=`echo $group_attr | sed 's/\(.* trigger="\)\([^"]*\)\(.*\)/\2/g'`
+
+# echo $g_name $g_wait_time $g_trigger
+ l_launch_num=`echo $xmem | xpath -e /system_launcher/group[$cur_group]/launch 2>&1 | grep Found | cut -d ' ' -f2`
+
+ cur_launch=1;
+ until [ $cur_launch -gt $l_launch_num ]; do
+ launch_text=`echo $xmem | xpath -q -e /system_launcher/group[$cur_group]/launch[$cur_launch]`
+
+ l_attr="Launch${l_idx}=$g_name|$cur_group|$g_wait_time|$g_trigger"
+ l_attr+="|"`echo $launch_text | sed 's/\(.* name="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* path="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* priority="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* critical="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* retry_cnt="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* arguments="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* logging_mask="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* restart="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* is_start_required="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* shutdown_critical="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* shutdown_wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* fast_shutdown_wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* user_name="\)\([^"]*\)\(.*\)/\2/g'`
+ if echo "$launch_text" | grep -sq 'is_agl_unit=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* is_agl_unit="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|"
+ fi
+ if echo "$launch_text" | grep -sq 'disable_agl_resethistory=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* disable_agl_resethistory="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|"
+ fi
+ if echo "$launch_text" | grep -sq 'disable_nonagl_resethistory=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* disable_nonagl_resethistory="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|"
+ fi
+ if echo "$launch_text" | grep -sq 'env_cond=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* env_cond="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|"
+ fi
+
+ if echo "$launch_text" | grep -sq 'cpu_assign=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* cpu_assign="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|0x0"
+ fi
+
+ echo $l_attr
+
+ cur_launch=$(($cur_launch+1))
+ l_idx=$(($l_idx+1))
+ done
+
+ cur_group=$(($cur_group+1))
+done
+
+
+rm $body_file
+rm $main_file
+
+
diff --git a/agl-basefiles/include/agl_thread.h b/agl-basefiles/include/agl_thread.h
new file mode 100644
index 0000000..3be3595
--- /dev/null
+++ b/agl-basefiles/include/agl_thread.h
@@ -0,0 +1,1385 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AGL_THREAD_H__
+#define __AGL_THREAD_H__
+
+//MACRO
+#define PR_TSS_S "0"
+#define PR_TSS 0
+
+/*
+ Main thread name. It need to be same as service name in sm_launch.xml or tskm_launch.xml
+ Max name length is 15
+ #define MN_XXXXX "MainName"
+
+ Thread name
+ Max name length is 15
+ #define TN_XXXXX "ThreadName"
+
+ Thread priority 0:TSS 1-99:FIFO
+ #define PR_XXXXX_S "(0-99)" //for xml
+ #define PR_XXXXX 0-99 //for program
+*/
+
+#define MN_SS_SYSMANAGER "SS_SysManager"
+#define PR_SS_SYSMANAGER_S "20"
+#define PR_SS_SYSMANAGER (20)
+
+ #define TN_SMHEARTBEAT "SM.Heartbeat"
+ #define PR_SMHEARTBEAT_S "20"
+ #define PR_SMHEARTBEAT (20)
+
+ #define TN_SMPROCLAUNCH "SM.ProcLaunch"
+ #define PR_SMPROCLAUNCH_S "20"
+ #define PR_SMPROCLAUNCH (20)
+
+ #define TN_SMLOWMEMMON "SM.LowMemMon"
+ #define PR_SMLOWMEMMON_S "20"
+ #define PR_SMLOWMEMMON (20)
+
+ #define TN_LOGGERRTIME "LoggerRtime"
+ #define PR_LOGGERRTIME_S PR_TSS_S
+ #define PR_LOGGERRTIME PR_TSS
+
+
+//======= exec from system manager =============
+#define MN_NS_SHAREDMEM "NS_SharedMem"
+#define PR_NS_SHAREDMEM_S "0"
+#define PR_NS_SHAREDMEM (0)
+
+
+#define MN_NS_NPPSERVICE "NS_NPPService"
+#define PR_NS_NPPSERVICE_S "0"
+#define PR_NS_NPPSERVICE (0)
+
+ #define TN_NS_NPPREADWKR "NS_NPPReadWkr"
+ #define PR_NS_NPPREADWKR_S "0"
+ #define PR_NS_NPPREADWKR (0)
+
+ #define TN_NS_NPPWRITEWKR "NS_NPPWriteWkr"
+ #define PR_NS_NPPWRITEWKR_S "0"
+ #define PR_NS_NPPWRITEWKR (0)
+
+ #define TN_NS_NPPIPWKR "NS_NPPIPWkr"
+ #define PR_NS_NPPIPWKR_S "0"
+ #define PR_NS_NPPIPWKR (0)
+
+#define MN_NS_BACKUPMGR "NS_BackupMgr"
+#define PR_NS_BACKUPMGR_S "0"
+#define PR_NS_BACKUPMGR (0)
+
+ #define TN_NS_BKUPNAND "NS_BkupNAND"
+ #define PR_NS_BKUPNAND_S "0"
+ #define PR_NS_BKUPNAND (0)
+
+ #define TN_NS_BKUPDELAY "NS_BkupDelay"
+ #define PR_NS_BKUPDELAY_S "0"
+ #define PR_NS_BKUPDELAY (0)
+
+#define MN_SS_DEVDETECTSRV "SS_DevDetectSrv"
+#define PR_SS_DEVDETECTSRV_S "0"
+#define PR_SS_DEVDETECTSRV (0)
+
+ #define TN_SS_DETECT_USB "SS_Detect_USB"
+ #define PR_SS_DETECT_USB_S "0"
+ #define PR_SS_DETECT_USB (0)
+
+ #define TN_SS_DETECT_SD "SS_Detect_SD"
+ #define PR_SS_DETECT_SD_S "0"
+ #define PR_SS_DETECT_SD (0)
+
+ #define TN_SS_MONITOR_OVC "SS_Monitor_OVC"
+ #define PR_SS_MONITOR_OVC_S "0"
+ #define PR_SS_MONITOR_OVC (0)
+
+#define MN_SS_LOGGERSRV "SS_LoggerSrv"
+#define PR_SS_LOGGERSRV_S PR_TSS_S
+#define PR_SS_LOGGERSRV PR_TSS
+
+ #define TN_PDGLOGQUER "pdg.LogQueR"
+ #define PR_PDGLOGQUER_S PR_TSS_S
+ #define PR_PDGLOGQUER PR_TSS
+
+ #define TN_PDGTRANSQUER "pdg.TransQueR"
+ #define PR_PDGTRANSQUER_S PR_TSS_S
+ #define PR_PDGTRANSQUER PR_TSS
+
+ #define TN_PDGEVNTLOGQUE "pdg.EvntLogQue"
+ #define PR_PDGEVNTLOGQUE_S PR_TSS_S
+ #define PR_PDGEVNTLOGQUE PR_TSS
+
+ #define TN_SSLOGGERSTRAGE "SSLoggerStrage"
+ #define PR_SSLOGGERSTRAGE_S PR_TSS_S
+ #define PR_SSLOGGERSTRAGE PR_TSS
+
+ #define TN_PFDRECTHREAD "PFDRECThread"
+ #define PR_PFDRECTHREAD_S PR_TSS_S
+ #define PR_PFDRECTHREAD PR_TSS
+
+#define MN_PS_LOGGERSHADOW "PS_LoggerShadow"
+ #define PR_PSLOGGERSHADOW_S PR_TSS_S
+ #define PR_PSLOGGERSHADOW PR_TSS
+
+#define MN_UDEVD "udevd"
+#define PR_UDEVD_S "1"
+#define PR_UDEVD (1)
+
+#define MN_COMMUNICATION "Communication"
+#define PR_COMMUNICATION_S "0"
+#define PR_COMMUNICATION (0)
+
+ #define TN_DEV_SYSCOM_TMR "DEV_SYSCOM_TMR"
+ #define PR_DEV_SYSCOM_TMR_S "0"
+ #define PR_DEV_SYSCOM_TMR (0)
+
+ #define TN_DEV_SYSCOM_RCV "DEV_SYSCOM_RCV"
+ #define PR_DEV_SYSCOM_RCV_S "0"
+ #define PR_DEV_SYSCOM_RCV (0)
+
+ #define TN_DEV_SYSCOM_MAIN "DEV_SYSCOM_MAIN"
+ #define PR_DEV_SYSCOM_MAIN_S "0"
+ #define PR_DEV_SYSCOM_MAIN (0)
+
+ #define TN_TGWCOM "TGWCOM"
+ #define PR_TGWCOM_S "0"
+ #define PR_TGWCOM (0)
+
+ #define TN__CWORD83_ "_CWORD83_"
+ #define PR__CWORD83__S "0"
+ #define PR__CWORD83_ (0)
+
+ #define TN_CAN_COM_PROT "CAN_COM_PROT"
+ #define PR_CAN_COM_PROT_S "0"
+ #define PR_CAN_COM_PROT (0)
+
+#define MN_PS_PSMSHADOW "PS_PSMShadow"
+#define PR_PS_PSMSHADOW_S "0"
+#define PR_PS_PSMSHADOW (0)
+
+#define MN_COMMSH4A "CommSH4A"
+#define PR_COMMSH4A_S "0"
+#define PR_COMMSH4A (0)
+
+ #define TN_DEV_SH4A_SND "DEV_SH4ACOM_SND"
+ #define PR_DEV_SH4A_SND_S "0"
+ #define PR_DEV_SH4A_SND (0)
+
+ #define TN_DEV_SH4A_RCV "DEV_SH4ACOM_RCV"
+ #define PR_DEV_SH4A_RCV_S "0"
+ #define PR_DEV_SH4A_RCV (0)
+
+ #define TN_DEV_SH4A_MON "DEV_SH4ACOM_MON"
+ #define PR_DEV_SH4A_MON_S "0"
+ #define PR_DEV_SH4A_MON (0)
+
+#define MN_PS_COMMUSB "PS_CommUSB"
+#define PR_PS_COMMUSB_S "0"
+#define PR_PS_COMMUSB (0)
+
+ #define TN_COMMUSB_RCV "COMMUSB_RCV"
+ #define PR_COMMUSB_RCV_S "0"
+ #define PR_COMMUSB_RCV (0)
+
+ #define TN_COMMUSB_DIAG "COMMUSB_DIAG"
+ #define PR_COMMUSB_DIAG_S "0"
+ #define PR_COMMUSB_DIAG (0)
+
+#define MN_PS_CANGW_M "CANGW_M"
+#define PR_PS_CANGW_M_S PR_TSS_S
+#define PR_PS_CANGW_M PR_TSS
+
+ #define TN_CANGW_M_RCV "CANGW_M_RCV"
+ #define PR_CANGW_M_RCV_S PR_TSS_S
+ #define PR_CANGW_M_RCV PR_TSS
+
+ #define TN_CANGW_M_DIAG "CANGW_M_DIAG"
+ #define PR_CANGW_M_DIAG_S PR_TSS_S
+ #define PR_CANGW_M_DIAG PR_TSS
+
+#define MN_PS_CANGW_S "CANGW_S"
+#define PR_PS_CANGW_S_S PR_TSS_S
+#define PR_PS_CANGW_S PR_TSS
+
+ #define TN_CANGW_S_SND "CANGW_S_SND"
+ #define PR_CANGW_S_SND_S PR_TSS_S
+ #define PR_CANGW_S_SND PR_TSS
+
+ #define TN_CANGW_S_DIAG "CANGW_S_DIAG"
+ #define PR_CANGW_S_DIAG_S PR_TSS_S
+ #define PR_CANGW_S_DIAG PR_TSS
+
+#define MN_LANSERVER "LanServer"
+#define PR_LANSERVER_S "0"
+#define PR_LANSERVER (0)
+
+#define MN_PS_CDR "ps_cdr"
+#define PR_PS_CDR_S PR_TSS_S
+#define PR_PS_CDR PR_TSS
+
+ #define TN_PS_CDR_NBD "ps_cdr_nbd"
+ #define PR_PS_CDR_NBD_S PR_TSS_S
+ #define PR_PS_CDR_NBD PR_TSS
+
+ #define TN_PS_CDR_DOIT "ps_cdr_doit"
+ #define PR_PS_CDR_DOIT_S PR_TSS_S
+ #define PR_PS_CDR_DOIT PR_TSS
+
+ #define TN_PS_CDR_READ "ps_cdr_read"
+ #define PR_PS_CDR_READ_S PR_TSS_S
+ #define PR_PS_CDR_READ PR_TSS
+
+#define MN_POSITIONING "Positioning"
+#define PR_POSITIONING_S PR_TSS_S
+#define PR_POSITIONING PR_TSS
+
+ #define TN_POSITIONING_GPS_MAIN "POS_Main"
+ #define PR_POSITIONING_GPS_MAIN_S PR_TSS_S
+ #define PR_POSITIONING_GPS_MAIN PR_TSS
+
+ #define TN_POSITIONING_GPS_RECV "POS_Gps_Recv"
+ #define PR_POSITIONING_GPS_RECV_S PR_TSS_S
+ #define PR_POSITIONING_GPS_RECV PR_TSS
+
+ #define TN_POSITIONING_GPS "POS_Gps"
+ #define PR_POSITIONING_GPS_S PR_TSS_S
+ #define PR_POSITIONING_GPS PR_TSS
+
+ #define TN_POSITIONING_SENS "POS_Sens"
+ #define PR_POSITIONING_SENS_S PR_TSS_S
+ #define PR_POSITIONING_SENS PR_TSS
+
+ #define TN_POSITIONING_GPS_ROLOVR "POS_Gps_Rolovr"
+ #define PR_POSITIONING_GPS_ROLOVR_S PR_TSS_S
+ #define PR_POSITIONING_GPS_ROLOVR PR_TSS
+
+#define MN_CLOCK "clock"
+#define PR_CLOCK_S "0"
+#define PR_CLOCK (0)
+
+ #define TN_CLOCK_MNG "ClockMng"
+ #define PR_CLOCK_MNG_S "0"
+ #define PR_CLOCK_MNG (0)
+
+#define MN_VEHICLE "vehicle"
+#define PR_VEHICLE_S "0"
+#define PR_VEHICLE (0)
+
+ #define TN_VEHICLE_SENS "VehicleSens"
+ #define PR_VEHICLE_SENS_S "0"
+ #define PR_VEHICLE_SENS (0)
+
+ #define TN_LINE_SENS_DRV "LineSensDrv"
+ #define PR_LINE_SENS_DRV_S "0"
+ #define PR_LINE_SENS_DRV (0)
+
+#define MN_SS_POWERSERVICE "SS_PowerService"
+#define PR_SS_POWERSERVICE_S "0"
+#define PR_SS_POWERSERVICE (0)
+
+#define MN_SS_TASKMANAGER "SS_TaskManager"
+#define PR_SS_TASKMANAGER_S "0"
+#define PR_SS_TASKMANAGER (0)
+
+ #define TN_SS_TSKMTIMER "SS_TskmTimer"
+ #define PR_SS_TSKMTIMER_S "0"
+ #define PR_SS_TSKMTIMER (0)
+
+#define MN_SOUND "Sound"
+#define PR_SOUND_S "0"
+#define PR_SOUND (0)
+
+ #define TN_VG_SNDSRCMGR "VG_SNDSRCMGR"
+ #define PR_VG_SNDSRCMGR_S "0"
+ #define PR_VG_SNDSRCMGR (0)
+
+ #define TN_SND_INPUTCTRL "SND_INPUTCTRL"
+ #define PR_SND_INPUTCTRL_S "0"
+ #define PR_SND_INPUTCTRL (0)
+
+ #define TN_SND_DEVCTRL "SND_DEVCTRL"
+ #define PR_SND_DEVCTRL_S "0"
+ #define PR_SND_DEVCTRL (0)
+
+ #define TN_SND_VCETRFCTRL "SND_VCETRFCTRL"
+ #define PR_SND_VCETRFCTRL_S "0"
+ #define PR_SND_VCETRFCTRL (0)
+
+ #define TN_SND_VCETRFWRT1 "SND_VCETRFWRT1"
+ #define PR_SND_VCETRFWRT1_S "0"
+ #define PR_SND_VCETRFWRT1 (0)
+
+ #define TN_SND_VCETRFWRT2 "SND_VCETRFWRT2"
+ #define PR_SND_VCETRFWRT2_S "0"
+ #define PR_SND_VCETRFWRT2 (0)
+
+ #define TN_VG_SNDCTRL_BSCF "VG_SNDCTRL_BSCF"
+ #define PR_VG_SNDCTRL_BSCF_S "0"
+ #define PR_VG_SNDCTRL_BSCF (0)
+
+ #define TN_VG_SNDCTRL_BSCR "VG_SNDCTRL_BSCR"
+ #define PR_VG_SNDCTRL_BSCR_S "0"
+ #define PR_VG_SNDCTRL_BSCR (0)
+
+ #define TN_VG_SNDCTRL_ITRT "VG_SNDCTRL_ITRT"
+ #define PR_VG_SNDCTRL_ITRT_S "0"
+ #define PR_VG_SNDCTRL_ITRT (0)
+
+ #define TN_CVRS_OPRT_OUT_1 "CVRS_OPRT_OUT_1"
+ #define PR_CVRS_OPRT_OUT_1_S "0"
+ #define PR_CVRS_OPRT_OUT_1 (0)
+
+ #define TN_CVRS_OPRT_OUT_2 "CVRS_OPRT_OUT_2"
+ #define PR_CVRS_OPRT_OUT_2_S "0"
+ #define PR_CVRS_OPRT_OUT_2 (0)
+
+ #define TN_CVRS_OPRT_OUT_3 "CVRS_OPRT_OUT_3"
+ #define PR_CVRS_OPRT_OUT_3_S "0"
+ #define PR_CVRS_OPRT_OUT_3 (0)
+
+ #define TN_CVRS_OPRT_OUT_4 "CVRS_OPRT_OUT_4"
+ #define PR_CVRS_OPRT_OUT_4_S "0"
+ #define PR_CVRS_OPRT_OUT_4 (0)
+
+ #define TN_CVRS_OPRT_IN_1 "CVRS_OPRT_IN_1"
+ #define PR_CVRS_OPRT_IN_1_S "0"
+ #define PR_CVRS_OPRT_IN_1 (0)
+
+ #define TN_CVRS_OPRT_IN_2 "CVRS_OPRT_IN_2"
+ #define PR_CVRS_OPRT_IN_2_S "0"
+ #define PR_CVRS_OPRT_IN_2 (0)
+
+ #define TN_CVRS_OPRT_IN_3 "CVRS_OPRT_IN_3"
+ #define PR_CVRS_OPRT_IN_3_S "0"
+ #define PR_CVRS_OPRT_IN_3 (0)
+
+ #define TN_CVRS_OPRT_IN_4 "CVRS_OPRT_IN_4"
+ #define PR_CVRS_OPRT_IN_4_S "0"
+ #define PR_CVRS_OPRT_IN_4 (0)
+
+ #define TN_CVRS_OPRT_IN_5 "CVRS_OPRT_IN_5"
+ #define PR_CVRS_OPRT_IN_5_S "0"
+ #define PR_CVRS_OPRT_IN_5 (0)
+
+ #define TN_CVRS_OPRT_IN_6 "CVRS_OPRT_IN_6"
+ #define PR_CVRS_OPRT_IN_6_S "0"
+ #define PR_CVRS_OPRT_IN_6 (0)
+
+ #define TN_CVRS_OPRT_IN_7 "CVRS_OPRT_IN_7"
+ #define PR_CVRS_OPRT_IN_7_S "0"
+ #define PR_CVRS_OPRT_IN_7 (0)
+
+ #define TN_CVRS_OPRT_IN_8 "CVRS_OPRT_IN_8"
+ #define PR_CVRS_OPRT_IN_8_S "0"
+ #define PR_CVRS_OPRT_IN_8 (0)
+
+ #define TN_CVRS_OPRT_BS_I "CVRS_OPRT_BS_I"
+ #define PR_CVRS_OPRT_BS_I_S "0"
+ #define PR_CVRS_OPRT_BS_I (0)
+
+ #define TN_VR_NVR_RECO "VR_NVR_RECO"
+ #define PR_VR_NVR_RECO_S "0"
+ #define PR_VR_NVR_RECO (0)
+
+ #define TN_SND_ECNR "SND_ECNR"
+ #define PR_SND_ECNR_S "0"
+ #define PR_SND_ECNR (0)
+
+ #define TN_SNDAGENT_000 "SNDAGENT_000"
+ #define PR_SNDAGENT_000_S "0"
+ #define PR_SNDAGENT_000 (0)
+
+ #define TN_SNDAGENT_001 "SNDAGENT_001"
+ #define PR_SNDAGENT_001_S "0"
+ #define PR_SNDAGENT_001 (0)
+
+ #define TN_SNDAGENT_002 "SNDAGENT_002"
+ #define PR_SNDAGENT_002_S "0"
+ #define PR_SNDAGENT_002 (0)
+
+ #define TN_SNDAGENT_003 "SNDAGENT_003"
+ #define PR_SNDAGENT_003_S "0"
+ #define PR_SNDAGENT_003 (0)
+
+ #define TN_SNDAGENT_004 "SNDAGENT_004"
+ #define PR_SNDAGENT_004_S "0"
+ #define PR_SNDAGENT_004 (0)
+
+ #define TN_SNDAGENT_005 "SNDAGENT_005"
+ #define PR_SNDAGENT_005_S "0"
+ #define PR_SNDAGENT_005 (0)
+
+ #define TN_SNDAGENT_006 "SNDAGENT_006"
+ #define PR_SNDAGENT_006_S "0"
+ #define PR_SNDAGENT_006 (0)
+
+ #define TN_SNDAGENT_007 "SNDAGENT_007"
+ #define PR_SNDAGENT_007_S "0"
+ #define PR_SNDAGENT_007 (0)
+
+ #define TN_SNDAGENT_008 "SNDAGENT_008"
+ #define PR_SNDAGENT_008_S "0"
+ #define PR_SNDAGENT_008 (0)
+
+ #define TN_SNDAGENT_009 "SNDAGENT_009"
+ #define PR_SNDAGENT_009_S "0"
+ #define PR_SNDAGENT_009 (0)
+
+ #define TN_SNDAGENT_010 "SNDAGENT_010"
+ #define PR_SNDAGENT_010_S "0"
+ #define PR_SNDAGENT_010 (0)
+
+ #define TN_SNDAGENT_011 "SNDAGENT_011"
+ #define PR_SNDAGENT_011_S "0"
+ #define PR_SNDAGENT_011 (0)
+
+ #define TN_SNDAGENT_012 "SNDAGENT_012"
+ #define PR_SNDAGENT_012_S "0"
+ #define PR_SNDAGENT_012 (0)
+
+ #define TN_SNDAGENT_013 "SNDAGENT_013"
+ #define PR_SNDAGENT_013_S "0"
+ #define PR_SNDAGENT_013 (0)
+
+ #define TN_SNDAGENT_014 "SNDAGENT_014"
+ #define PR_SNDAGENT_014_S "0"
+ #define PR_SNDAGENT_014 (0)
+
+ #define TN_SNDAGENT_015 "SNDAGENT_015"
+ #define PR_SNDAGENT_015_S "0"
+ #define PR_SNDAGENT_015 (0)
+
+ #define TN_SNDAGENT_016 "SNDAGENT_016"
+ #define PR_SNDAGENT_016_S "0"
+ #define PR_SNDAGENT_016 (0)
+
+ #define TN_SNDAGENT_017 "SNDAGENT_017"
+ #define PR_SNDAGENT_017_S "0"
+ #define PR_SNDAGENT_017 (0)
+
+ #define TN_SNDAGENT_018 "SNDAGENT_018"
+ #define PR_SNDAGENT_018_S "0"
+ #define PR_SNDAGENT_018 (0)
+
+ #define TN_SNDAGENT_019 "SNDAGENT_019"
+ #define PR_SNDAGENT_019_S "0"
+ #define PR_SNDAGENT_019 (0)
+
+ #define TN_SNDAGENT_020 "SNDAGENT_020"
+ #define PR_SNDAGENT_020_S "0"
+ #define PR_SNDAGENT_020 (0)
+
+ #define TN_SNDAGENT_021 "SNDAGENT_021"
+ #define PR_SNDAGENT_021_S "0"
+ #define PR_SNDAGENT_021 (0)
+
+ #define TN_SNDAGENT_022 "SNDAGENT_022"
+ #define PR_SNDAGENT_022_S "0"
+ #define PR_SNDAGENT_022 (0)
+
+ #define TN_SNDAGENT_023 "SNDAGENT_023"
+ #define PR_SNDAGENT_023_S "0"
+ #define PR_SNDAGENT_023 (0)
+
+ #define TN_SNDAGENT_024 "SNDAGENT_024"
+ #define PR_SNDAGENT_024_S "0"
+ #define PR_SNDAGENT_024 (0)
+
+ #define TN_SNDAGENT_025 "SNDAGENT_025"
+ #define PR_SNDAGENT_025_S "0"
+ #define PR_SNDAGENT_025 (0)
+
+#define MN_SS_RESOURCEMGR "SS_ResourceMgr"
+#define PR_SS_RESOURCEMGR_S "0"
+#define PR_SS_RESOURCEMGR (0)
+
+ #define TN_RESOURCEHWDT "ResourceHWDT"
+ #define PR_RESOURCEHWDT_S "0"
+ #define PR_RESOURCEHWDT (0)
+
+#define MN_AS_AUDIOMANAGER "AS_AudioManager"
+#define PR_AS_AUDIOMANAGER_S PR_TSS_S
+#define PR_AS_AUDIOMANAGER PR_TSS
+
+ #define TN_AS_SOUNDBEEP "AS_SoundBeep"
+ #define PR_AS_SOUNDBEEP_S PR_TSS_S
+ #define PR_AS_SOUNDBEEP PR_TSS
+
+#define MN_GRAPHICS "Graphics"
+#define PR_GRAPHICS_S "0"
+#define PR_GRAPHICS (0)
+
+ #define TN_GR_MAIN_CTRL "Graphics_main"
+ #define PR_GR_MAIN_CTRL_S PR_TSS_S
+ #define PR_GR_MAIN_CTRL PR_TSS
+
+ #define TN_GR_SEQ_CTRL "Graphics_seq"
+ #define PR_GR_SEQ_CTRL_S PR_TSS_S
+ #define PR_GR_SEQ_CTRL PR_TSS
+
+ #define TN_GR_DEV_RCV_CTRL "Graphics_rcv"
+ #define PR_GR_DEV_RCV_CTRL_S PR_TSS_S
+ #define PR_GR_DEV_RCV_CTRL PR_TSS
+
+ #define TN_GR_VCAP1_CTRL "Graphics_cap1"
+ #define PR_GR_VCAP1_CTRL_S "0"
+ #define PR_GR_VCAP1_CTRL (0)
+
+ #define TN_GR_VCAP2_CTRL "Graphics_cap2"
+ #define PR_GR_VCAP2_CTRL_S "0"
+ #define PR_GR_VCAP2_CTRL (0)
+
+#define MN_VUPSERVICE "vupservice"
+#define PR_VUPSERVICE_S PR_TSS_S
+#define PR_VUPSERVICE PR_TSS
+
+#define MN_SS_UPDATESERVICE "UpdateService"
+#define PR_SS_UPDATESERVICE_S PR_TSS_S
+#define PR_SS_UPDATESERVICE PR_TSS
+
+ #define TN_UPSERVICE_VERI "t_update_veri"
+ #define PR_UPSERVICE_VERI_S PR_TSS_S
+ #define PR_UPSERVICE_VERI PR_TSS
+
+#define MN_NW_MICSERVICE "NW_MicService"
+#define PR_NW_MICSERVICE_S PR_TSS_S
+#define PR_NW_MICSERVICE PR_TSS
+
+#define MN_NS_LOCKMGR "LockMgr"
+#define PR_NS_LOCKMGR_S PR_TSS_S
+#define PR_NS_LOCKMGR PR_TSS
+
+#define MN_PS_SWITCHHANDLER "SwitchHandler"
+#define PR_PS_SWITCHHANDLER_S "0"
+#define PR_PS_SWITCHHANDLER (0)
+
+#define MN_SS_WINSYS "SS_WinSys"
+#define PR_SS_WINSYS_S "5"
+#define PR_SS_WINSYS 5
+
+#define MN_MODEMANAGER "modemanager"
+#define PR_MODEMANAGER_S PR_TSS_S
+#define PR_MODEMANAGER PR_TSS
+
+#define MN_BTSTACKMAIN "btstackmain"
+#define PR_BTSTACKMAIN_S PR_TSS_S
+#define PR_BTSTACKMAIN PR_TSS
+
+#define MN_MEDIASERVICE "MediaService"
+#define PR_MEDIASERVICE_S PR_TSS_S
+#define PR_MEDIASERVICE PR_TSS
+
+// REPRO START
+#define MN_REPROSERVICE "ReproService"
+#define PR_REPROSERVICE_S PR_TSS_S
+#define PR_REPROSERVICE PR_TSS
+
+ #define TN_REPROSEQUENCER "RPRS_Sequencer"
+ #define PR_REPROSEQUENCER_S PR_TSS_S
+ #define PR_REPROSEQUENCER PR_TSS
+
+ #define TN_REPROCTRL "RPRS_Control"
+ #define PR_REPROCTRL_S PR_TSS_S
+ #define PR_REPROCTRL PR_TSS
+
+ #define TN_REPROCENTERCOMM "RPRS_CenterComm"
+ #define PR_REPROCENTERCOMM_S PR_TSS_S
+ #define PR_REPROCENTERCOMM PR_TSS
+
+ #define TN_REPROUNITCOMM "RPRS_UnitComm"
+ #define PR_REPROUNITCOMM_S PR_TSS_S
+ #define PR_REPROUNITCOMM PR_TSS
+
+ #define TN_REPROWEBDAVMGR "RPRS_WebDAVMgr"
+ #define PR_REPROWEBDAVMGR_S PR_TSS_S
+ #define PR_REPROWEBDAVMGR PR_TSS
+
+#define MN_REPROAENDTEST "Repro_Testpro_Sender"
+#define PR_REPROAENDTEST_S PR_TSS_S
+#define PR_REPROAENDTEST PR_TSS
+
+ #define TN_REPROAENDTESTTN "Repro_TestproT"
+ #define PR_REPROAENDTESTTN_S PR_TSS_S
+ #define PR_REPROAENDTESTTN PR_TSS
+
+#define MN_REPROBACKVUP "BackVupCtrl"
+#define PR_REPROBACKVUP_S PR_TSS_S
+#define PR_REPROBACKVUP PR_TSS
+
+#define MN_REPRODEVELOP "DevReproService"
+#define PR_REPRODEVELOP_S PR_TSS_S
+#define PR_REPRODEVELOP PR_TSS
+// REPRO END
+
+ #define TN_MED_MMCOM_PLAY "mmcom_play"
+ #define PR_MED_MMCOM_PLAY_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAY PR_TSS
+
+ #define TN_MED_MMCOM_MEDIA "mmcom_media"
+ #define PR_MED_MMCOM_MEDIA_S PR_TSS_S
+ #define PR_MED_MMCOM_MEDIA PR_TSS
+
+ #define TN_MED_MMCOM_DB "mmcom_db"
+ #define PR_MED_MMCOM_DB_S PR_TSS_S
+ #define PR_MED_MMCOM_DB PR_TSS
+
+ #define TN_MED_MMCOM_LIST "mmcom_list"
+ #define PR_MED_MMCOM_LIST_S PR_TSS_S
+ #define PR_MED_MMCOM_LIST PR_TSS
+
+ #define TN_MED_MMCOM_DBUSB "mmcom_dbusb"
+ #define PR_MED_MMCOM_DBUSB_S PR_TSS_S
+ #define PR_MED_MMCOM_DBUSB PR_TSS
+
+ #define TN_MED_MMCOM_DBSD "mmcom_dbsd"
+ #define PR_MED_MMCOM_DBSD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBSD PR_TSS
+
+ #define TN_MED_MMCOM_DBCD "mmcom_dbcd"
+ #define PR_MED_MMCOM_DBCD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBCD PR_TSS
+
+ #define TN_MED_MMCOM_PLAYRCV "mmcom_playrcv"
+ #define PR_MED_MMCOM_PLAYRCV_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAYRCV PR_TSS
+
+ #define TN_MED_RIPCOM_MNG "MngRipComm"
+ #define PR_MED_RIPCOM_MNG_S PR_TSS_S
+ #define PR_MED_RIPCOM_MNG PR_TSS
+
+ #define TN_MED_RIPCOM_EXE01 "ExeRipComm01"
+ #define PR_MED_RIPCOM_EXE01_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE01 PR_TSS
+
+ #define TN_MED_RIPCOM_EXE02 "ExeRipComm02"
+ #define PR_MED_RIPCOM_EXE02_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE02 PR_TSS
+
+ #define TN_MED_DISCCOM_MAIN "disccom_main"
+ #define PR_MED_DISCCOM_MAIN_S PR_TSS_S
+ #define PR_MED_DISCCOM_MAIN PR_TSS
+
+ #define TN_MED_DISCCOM_DB "disccom_db"
+ #define PR_MED_DISCCOM_DB_S PR_TSS_S
+ #define PR_MED_DISCCOM_DB PR_TSS
+
+#define MN_PLAYBACKSERVICE "PlaybackService"
+#define PR_PLAYBACKSERVICE_S PR_TSS_S
+#define PR_PLAYBACKSERVICE PR_TSS
+
+ #define TN_PLAYSRV_AUDIO "playsrv_audio"
+ #define PR_PLAYSRV_AUDIO_S PR_TSS_S
+ #define PR_PLAYSRV_AUDIO PR_TSS
+
+ #define TN_PLAYSRV_RIP "playsrv_rip"
+ #define PR_PLAYSRV_RIP_S PR_TSS_S
+ #define PR_PLAYSRV_RIP PR_TSS
+
+ #define TN_PLAYSRV_PLAY "playsrv_play"
+ #define PR_PLAYSRV_PLAY_S PR_TSS_S
+ #define PR_PLAYSRV_PLAY PR_TSS
+
+ #define TN_PLAYSRV_DISC "playsrv_disc"
+ #define PR_PLAYSRV_DISC_S PR_TSS_S
+ #define PR_PLAYSRV_DISC PR_TSS
+
+ #define TN_PLAYSRV_ARTWORK "playsrv_artwork"
+ #define PR_PLAYSRV_ARTWORK_S PR_TSS_S
+ #define PR_PLAYSRV_ARTWORK PR_TSS
+
+#define MN_DISCSERVICE "DiscService"
+#define PR_DISCSERVICE_S PR_TSS_S
+#define PR_DISCSERVICE PR_TSS
+
+#define MN_RADIOSERVICE "RadioService"
+#define PR_RADIOSERVICE_S PR_TSS_S
+#define PR_RADIOSERVICE PR_TSS
+
+#define MN_RADIOHDARBITER "RadioHDArbiter"
+#define PR_RADIOHDARBITER_S "0"
+#define PR_RADIOHDARBITER (0)
+
+#define MN_HRDS_MANAGER "hrds_manager"
+#define PR_HRDS_MANAGER_S PR_TSS_S
+#define PR_HRDS_MANAGER PR_TSS
+
+ #define TN_HRDS_HDMNG "hrds_hdmng"
+ #define PR_HRDS_HDMNG_S PR_TSS_S
+ #define PR_HRDS_HDMNG PR_TSS
+
+ #define TN_HRDS_HDDEC "hrds_hddec"
+ #define PR_HRDS_HDDEC_S PR_TSS_S
+ #define PR_HRDS_HDDEC PR_TSS
+
+ #define TN_HRDS_WEBMNG "hrds_webmng"
+ #define PR_HRDS_WEBMNG_S PR_TSS_S
+ #define PR_HRDS_WEBMNG PR_TSS
+
+ #define TN_HRDS_WEBCOM "hrds_webcom"
+ #define PR_HRDS_WEBCOM_S PR_TSS_S
+ #define PR_HRDS_WEBCOM PR_TSS
+
+#define MN_BT_CONNECTIONSERVICE "BT_CnctSrv"
+#define PR_BT_CONNECTIONSERVICE_S PR_TSS_S
+#define PR_BT_CONNECTIONSERVICE PR_TSS
+
+#define MN_BT_PHONESERVICE "BT_PhoneSrv"
+#define PR_BT_PHONESERVICE_S PR_TSS_S
+#define PR_BT_PHONESERVICE PR_TSS
+
+#define MN_BT_PHONEBOOKSERVICE "BT_PbkSrv"
+#define PR_BT_PHONEBOOKSERVICE_S PR_TSS_S
+#define PR_BT_PHONEBOOKSERVICE PR_TSS
+
+#define MN_BT_MESSAGINGSERVICE "BT_MsgSrv"
+#define PR_BT_MESSAGINGSERVICE_S PR_TSS_S
+#define PR_BT_MESSAGINGSERVICE PR_TSS
+
+#define MN_BT_BLLSERVICE "TEL_BLLSrv"
+#define PR_BT_BLLSERVICE_S PR_TSS_S
+#define PR_BT_BLLSERVICE PR_TSS
+
+#define MN_BT_DCMPHONESERVICE "DCM_PhoneSrv"
+#define PR_BT_DCMPHONESERVICE_S PR_TSS_S
+#define PR_BT_DCMPHONESERVICE PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ1 "HFPMultiQ1"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1 PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ2 "HFPMultiQ2"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2 PR_TSS
+
+ #define TN_BT_PBKSRV_DATABASE "BTPB_Database"
+ #define PR_TN_BT_PBKSRV_DATABASE_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_DATABASE PR_TSS
+
+ #define TN_BT_PBKSRV_LOCALPBINST "LocalPBINST"
+ #define PR_TN_BT_PBKSRV_LOCALPBINST_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_LOCALPBINST PR_TSS
+
+ #define TN_BT_PBKSRV_RESOLVENAME "ResolveName"
+ #define PR_TN_BT_PBKSRV_RESOLVENAME_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_RESOLVENAME PR_TSS
+
+ #define TN_BT_PBKSRV_PBAPMULTIQ1 "PBAPMultiQ1"
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1 PR_TSS
+
+ #define TN_BT_PBKSRV_OPPMULTI "OPPMulti"
+ #define PR_TN_BT_PBKSRV_OPPMULTI_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_OPPMULTI PR_TSS
+
+ #define TN_BT_PBKSRV_VCARDPARSER "VCardParser"
+ #define PR_TN_BT_PBKSRV_VCARDPARSER_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_VCARDPARSER PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD0 "MsgCntrlThread0"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0 PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD1 "MsgCntrlThread1"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1 PR_TSS
+
+ #define TN_BT_MSGSRV_MAPMULTI "MapMulti"
+ #define PR_TN_BT_MSGSRV_MAPMULTI_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MAPMULTI PR_TSS
+
+#define MN_DTVSERVICE "DtvService"
+#define PR_DTVSERVICE_S PR_TSS_S
+#define PR_DTVSERVICE PR_TSS
+
+ #define TN_DTVTNC_TX "dtvtnc_tx"
+ #define PR_DTVTNC_TX_S PR_TSS_S
+ #define PR_DTVTNC_TX PR_TSS
+
+ #define TN_DTVTNC_RCV "dtvtnc_rcv"
+ #define PR_DTVTNC_RCV_S PR_TSS_S
+ #define PR_DTVTNC_RCV PR_TSS
+
+ #define TN_DTVTNC_TIMER "dtvtnc_timer"
+ #define PR_DTVTNC_TIMER_S PR_TSS_S
+ #define PR_DTVTNC_TIMER PR_TSS
+
+ #define TN_DTVTNC_CTL "dtvtnc_ctl"
+ #define PR_DTVTNC_CTL_S PR_TSS_S
+ #define PR_DTVTNC_CTL PR_TSS
+
+#define MN_DTVVUPSERVICE "DtvVupService"
+#define PR_DTVVUPSERVICE_S PR_TSS_S
+#define PR_DTVVUPSERVICE PR_TSS
+
+#define MN_SETTINGSERVICE "SettingService"
+#define PR_SETTINGSERVICE_S PR_TSS_S
+#define PR_SETTINGSERVICE PR_TSS
+
+#define MN_INFOSETTINGSRV "InfoSettingSrv"
+#define PR_INFOSETTINGSRV_S PR_TSS_S
+#define PR_INFOSETTINGSRV PR_TSS
+
+ #define TN_INFS_UIC "infs_uic"
+ #define PR_INFS_UIC_S PR_TSS_S
+ #define PR_INFS_UIC PR_TSS
+
+#define MN_DELPERSONALSRV "DelPersonalSrv"
+#define PR_DELPERSONALSRV_S PR_TSS_S
+#define PR_DELPERSONALSRV PR_TSS
+
+#define MN_MENUSERVICE "MenuService"
+#define PR_MENUSERVICE_S PR_TSS_S
+#define PR_MENUSERVICE PR_TSS
+
+#define MN_NAVIPROXY "NaviProxy"
+#define PR_NAVIPROXY_S PR_TSS_S
+#define PR_NAVIPROXY PR_TSS
+
+#define MN_AWBPROXY "AwbProxy"
+#define PR_AWBPROXY_S PR_TSS_S
+#define PR_AWBPROXY PR_TSS
+
+#define MN_TFFPROXY "TFFProxy"
+#define PR_TFFPROXY_S PR_TSS_S
+#define PR_TFFPROXY PR_TSS
+
+#define MN_TFFPROXYSLAVE "TFFProxySlave"
+#define PR_TFFPROXYSLAVE_S PR_TSS_S
+#define PR_TFFPROXYSLAVE PR_TSS
+
+#define MN_AWNPRIMARY "AwnPrimary"
+#define PR_AWNPRIMARY_S PR_TSS_S
+#define PR_AWNPRIMARY PR_TSS
+
+#define MN_AWBPRIMARY "AwbPrimary"
+#define PR_AWBPRIMARY_S PR_TSS_S
+#define PR_AWBPRIMARY PR_TSS
+
+#define MN_AWMPRIMARY "AwmPrimary"
+#define PR_AWMPRIMARY_S PR_TSS_S
+#define PR_AWMPRIMARY PR_TSS
+
+#define MN_AWTPRIMARY "AwtPrimary"
+#define PR_AWTPRIMARY_S PR_TSS_S
+#define PR_AWTPRIMARY PR_TSS
+
+#define MN_MISINKSERVICE "MisinkService"
+#define PR_MISINKSERVICE_S PR_TSS_S
+#define PR_MISINKSERVICE PR_TSS
+
+#define MN_TEXTCONVERTER "TextConverter"
+#define PR_TEXTCONVERTER_S PR_TSS_S
+#define PR_TEXTCONVERTER PR_TSS
+
+#define MN_HANDWRITING "HandWriting"
+#define PR_HANDWRITING_S PR_TSS_S
+#define PR_HANDWRITING PR_TSS
+
+#define MN_EXTUNITAUTH_D "EXTUNITAUTH_D"
+#define PR_EXTUNITAUTH_D_S "0"
+#define PR_EXTUNITAUTH_D 0
+
+ #define TN_VPSVC__CWORD84_ "VPSVC_D"
+ #define PR_VPSVC__CWORD84__S PR_TSS_S
+ #define PR_VPSVC__CWORD84_ PR_TSS
+
+#define MN_PROXYSERVICE "ProxyService"
+#define PR_PROXYSERVICE_S PR_TSS_S
+#define PR_PROXYSERVICE PR_TSS
+
+#define MN_FUELSERVICE "VS_FUCSrv"
+#define PR_FUELSERVICE_S PR_TSS_S
+#define PR_FUELSERVICE PR_TSS
+
+#define MN_ENERGYSERVICE "VS_ENMSrv"
+#define PR_ENERGYSERVICE_S PR_TSS_S
+#define PR_ENERGYSERVICE PR_TSS
+
+#define MN_CUSTOMIZESERVICE "VS_VSDSrv"
+#define PR_CUSTOMIZESERVICE_S PR_TSS_S
+#define PR_CUSTOMIZESERVICE PR_TSS
+
+#define MN_DMSSERVICE "VS_DMSSrv"
+#define PR_DMSSERVICE_S PR_TSS_S
+#define PR_DMSSERVICE PR_TSS
+
+#define MN_AIRCONSERVICE "VS_ACNSrv"
+#define PR_AIRCONSERVICE_S PR_TSS_S
+#define PR_AIRCONSERVICE PR_TSS
+
+#define MN_SEATSERVICE "VS_NMSSrv"
+#define PR_SEATSERVICE_S PR_TSS_S
+#define PR_SEATSERVICE PR_TSS
+
+#define MN_CAMERASERVICE "VS_CMRSrv"
+#define PR_CAMERASERVICE_S PR_TSS_S
+#define PR_CAMERASERVICE PR_TSS
+
+ #define TN_CAMERAQUICKRVC "QuickRVCThread"
+ #define PR_CAMERAQUICKRVC_S PR_TSS_S
+ #define PR_CAMERAQUICKRVC PR_TSS
+
+#define MN_METSERVICE "VS_METSrv"
+#define PR_METSERVICE_S PR_TSS_S
+#define PR_METSERVICE PR_TSS
+
+#define MN_TMCSERVICE "VS_TMCSrv"
+#define PR_TMCSERVICE_S PR_TSS_S
+#define PR_TMCSERVICE PR_TSS
+
+#define MN_DASSERVICE "VS_DASSrv"
+#define PR_DASSERVICE_S PR_TSS_S
+#define PR_DASSERVICE PR_TSS
+
+#define MN_EXTUNITAUTH_M "EXTUNITAUTH_M"
+#define PR_EXTUNITAUTH_M_S "0"
+#define PR_EXTUNITAUTH_M 0
+
+#define MN_DUMMYREAD "DummyRead"
+#define PR_DUMMYREAD_S PR_TSS_S
+#define PR_DUMMYREAD PR_TSS
+
+#define MN_SSTSERVICE "storage_access"
+#define PR_SSTSERVICE_S PR_TSS_S
+#define PR_SSTSERVICE PR_TSS
+
+#define MN_CCSAUDITD "ccs-auditd"
+#define PR_CCSAUDITD_S PR_TSS_S
+#define PR_CCSAUDITD PR_TSS
+
+//exec from task manager
+#define MN_ACTIVITYMANAGER "ActivityManager"
+#define PR_ACTIVITYMANAGER_S PR_TSS_S
+#define PR_ACTIVITYMANAGER PR_TSS
+
+#define MN_RESIDENT_SVC "RESIDENT_SVC"
+#define PR_RESIDENT_SVC_S PR_TSS_S
+#define PR_RESIDENT_SVC PR_TSS
+
+#define MN_TRANSIENT_SVC "TRANSIENT_SVC"
+#define PR_TRANSIENT_SVC_S PR_TSS_S
+#define PR_TRANSIENT_SVC PR_TSS
+
+#define MN_WLANSERVICE "wlan_ctrl_0700"
+#define PR_WLANSERVICE_S PR_TSS_S
+#define PR_WLANSERVICE PR_TSS
+
+#define MN_WLANEVTTHR "WlanEvtThr"
+#define PR_WLANEVTTHR_S PR_TSS_S
+#define PR_WLANEVTTHR PR_TSS
+
+#define MN_WLANMIDDLESERVICE "WlanMiddle"
+#define PR_WLANMIDDLESERVICE_S PR_TSS_S
+#define PR_WLANMIDDLESERVICE PR_TSS
+
+ #define TN_WLANMIDDLESERVICE0 "WM_MsgCtrlTh0"
+ #define PR_WLANMIDDLESERVICE0_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE0 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE1 "WM_MsgCtrlTh1"
+ #define PR_WLANMIDDLESERVICE1_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE1 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE2 "WM_MsgCtrlTh2"
+ #define PR_WLANMIDDLESERVICE2_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE2 PR_TSS
+
+#define MN_WLANSERVICE2 "wlan_ctrl_0701"
+#define PR_WLANSERVICE2_S PR_TSS_S
+#define PR_WLANSERVICE2 PR_TSS
+
+#define MN_WLANEVTTHR2 "WlanEvtThr2"
+#define PR_WLANEVTTHR2_S PR_TSS_S
+#define PR_WLANEVTTHR2 PR_TSS
+
+//exec from task manager, Test for vup
+#define MN_PS__CWORD52_VUP "_CWORD52_vup"
+#define PR_PS__CWORD52_VUP_S PR_TSS_S
+#define PR_PS__CWORD52_VUP PR_TSS
+
+#define MN_PS_SYSVUP "sysvup"
+#define PR_PS_SYSVUP_S PR_TSS_S
+#define PR_PS_SYSVUP PR_TSS
+
+#define MN_SS_ROOTFSVUP "rootfsvup"
+#define PR_SS_ROOTFSVUP_S PR_TSS_S
+#define PR_SS_ROOTFSVUP PR_TSS
+
+#define MN_SS_VUPPROGUI "vupprogressui"
+#define PR_SS_VUPPROGUI_S PR_TSS_S
+#define PR_SS_VUPPROGUI PR_TSS
+
+#define MN_SS_NORVUP "norvup"
+#define PR_SS_NORVUP_S PR_TSS_S
+#define PR_SS_NORVUP PR_TSS
+
+// OUTER_UPDATE START
+#define MN_XMVUPSERVICE "radio_xm_update"
+#define PR_XMVUPSERVICE_S PR_TSS_S
+#define PR_XMVUPSERVICE PR_TSS
+// OUTER_UPDATE END
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+// NON-resident, exec from task manager, Repro update
+#define MN_PS_SYSUPDATE "sysupdate"
+#define PR_PS_SYSUPDATE_S PR_TSS_S
+#define PR_PS_SYSUPDATE PR_TSS
+
+#define MN_SS_NANDUPDATE "nandupdate"
+#define PR_SS_NANDUPDATE_S PR_TSS_S
+#define PR_SS_NANDUPDATE PR_TSS
+
+ #define TN_NANDUPDATE_CLD "t_nandcld"
+ #define PR_NANDUPDATE_CLD_S PR_TSS_S
+ #define PR_NANDUPDATE_CLD PR_TSS
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+//exec from diag
+#define MN_DIAGSERVICE "DiagService"
+#define PR_DIAGSERVICE_S PR_TSS_S
+#define PR_DIAGSERVICE PR_TSS
+
+#define MN_DIAGWORKERTSK "diagworker_tsk"
+#define PR_DIAGWORKERTSK_S PR_TSS_S
+#define PR_DIAGWORKERTSK PR_TSS
+
+#define MN_DIAGTSK "diag_tsk"
+#define PR_DIAGTSK_S PR_TSS_S
+#define PR_DIAGTSK PR_TSS
+
+#define MN_DIAGMCTSK "diagmc_tsk"
+#define PR_DIAGMCTSK_S PR_TSS_S
+#define PR_DIAGMCTSK PR_TSS
+
+#define MN_DIAGUTCOL "diagutCol_tsk"
+#define PR_DIAGUTCOL_S PR_TSS_S
+#define PR_DIAGUTCOL PR_TSS
+
+#define MN_DIAGUTUPD "diagutUpd_tsk"
+#define PR_DIAGUTUPD_S PR_TSS_S
+#define PR_DIAGUTUPD PR_TSS
+
+//exec from Connectivity for _CWORD57_
+#define MN__CWORD57_UTILSERVICE "_CWORD57_UtilService"
+#define PR__CWORD57_UTILSERVICE_S PR_TSS_S
+#define PR__CWORD57_UTILSERVICE PR_TSS
+
+ #define TN_CON_IPUT_DETECT "iputsrv_detect"
+ #define PR_CON_IPUT_DETECT_S PR_TSS_S
+ #define PR_CON_IPUT_DETECT PR_TSS
+
+ #define TN_CON_IPUT_AUTH "iputsrv_auth"
+ #define PR_CON_IPUT_AUTH_S PR_TSS_S
+ #define PR_CON_IPUT_AUTH PR_TSS
+
+ #define TN_CON_IPUT_SERIAL "iputsrv_serial"
+ #define PR_CON_IPUT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPUT_SERIAL PR_TSS
+
+ #define TN_CON_IPUT_USB_1 "iputsrv_usb1"
+ #define PR_CON_IPUT_USB_1_S PR_TSS_S
+ #define PR_CON_IPUT_USB_1 PR_TSS
+
+ #define TN_CON_IPUT_USB_2 "iputsrv_usb2"
+ #define PR_CON_IPUT_USB_2_S PR_TSS_S
+ #define PR_CON_IPUT_USB_2 PR_TSS
+
+ #define TN_CON_IPUT_SPP "iputsrv_spp"
+ #define PR_CON_IPUT_SPP_S PR_TSS_S
+ #define PR_CON_IPUT_SPP PR_TSS
+
+#define MN__CWORD57_DTSERVICE "_CWORD57_DTService"
+#define PR__CWORD57_DTSERVICE_S PR_TSS_S
+#define PR__CWORD57_DTSERVICE PR_TSS
+
+ #define TN_CON_IPDT_SERIAL "ipdtsrv_serial"
+ #define PR_CON_IPDT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPDT_SERIAL PR_TSS
+
+ #define TN_CON_IPDT_USB_1 "ipdtsrv_usb1"
+ #define PR_CON_IPDT_USB_1_S PR_TSS_S
+ #define PR_CON_IPDT_USB_1 PR_TSS
+
+ #define TN_CON_IPDT_USB_2 "ipdtsrv_usb2"
+ #define PR_CON_IPDT_USB_2_S PR_TSS_S
+ #define PR_CON_IPDT_USB_2 PR_TSS
+
+ #define TN_CON_IPDT_SPP "ipdtsrv_spp"
+ #define PR_CON_IPDT_SPP_S PR_TSS_S
+ #define PR_CON_IPDT_SPP PR_TSS
+
+#define MN_WEBDAVMGR "webdavmgr"
+#define PR_WEBDAVMGR_S PR_TSS_S
+#define PR_WEBDAVMGR PR_TSS
+
+#define MN_DISPLAYSERVICE "DisplayService"
+#define PR_DISPLAYSERVICE_S PR_TSS_S
+#define PR_DISPLAYSERVICE PR_TSS
+
+#define MN_ENFORMSERVICE "EnformService"
+#define PR_ENFORMSERVICE_S PR_TSS_S
+#define PR_ENFORMSERVICE PR_TSS
+
+#define MN_CONNUTIL "ConnUtil"
+#define PR_CONNUTIL_S PR_TSS_S
+#define PR_CONNUTIL PR_TSS
+
+#define MN_CONNUTILSLAVE "ConnUtilSlave"
+#define PR_CONNUTILSLAVE_S PR_TSS_S
+#define PR_CONNUTILSLAVE PR_TSS
+
+#define MN_CONNMGR "ConnMgr"
+#define PR_CONNMGR_S PR_TSS_S
+#define PR_CONNMGR PR_TSS
+
+#define MN_SERVICEFLAGMGR "ServiceFlagMgr"
+#define PR_SERVICEFLAGMGR_S PR_TSS_S
+#define PR_SERVICEFLAGMGR PR_TSS
+
+//exec from VR
+#define MN_VRMANAGER "vrmanager"
+#define PR_VRMANAGER_S PR_TSS_S
+#define PR_VRMANAGER PR_TSS
+
+ #define TN_VR_WORKER "VrWorkerThread"
+ #define PR_VR_WORKER_S PR_TSS_S
+ #define PR_VR_WORKER PR_TSS
+
+ #define TN_VBT_PROPDISPATCH "PropDispatchThread"
+ #define PR_VBT_PROPDISPATCH_S PR_TSS_S
+ #define PR_VBT_PROPDISPATCH PR_TSS
+
+ #define TN_VBT_PROPRESPONSE "PropResponseThread"
+ #define PR_VBT_PROPRESPONSE_S PR_TSS_S
+ #define PR_VBT_PROPRESPONSE PR_TSS
+
+ #define TN_VBT_PROPAUDIOPLAY "PropAudioPlayThread"
+ #define PR_VBT_PROPAUDIOPLAY_S PR_TSS_S
+ #define PR_VBT_PROPAUDIOPLAY PR_TSS
+
+ #define TN_VBT_PROPAUDIORECORD "PropAudioRecordThread"
+ #define PR_VBT_PROPAUDIORECORD_S PR_TSS_S
+ #define PR_VBT_PROPAUDIORECORD PR_TSS
+
+ #define TN_VBT_MAINTHREADPRIO "MainThreadPriority"
+ #define PR_VBT_MAINTHREADPRIO_S PR_TSS_S
+ #define PR_VBT_MAINTHREADPRIO PR_TSS
+
+ #define TN_VBT_ASRMANAGERGRAMMAR "AsrManagerGrammarGenerationThread"
+ #define PR_VBT_ASRMANAGERGRAMMAR_S PR_TSS_S
+ #define PR_VBT_ASRMANAGERGRAMMAR PR_TSS
+
+ #define TN_VBT_ASRVOCONRECO "AsrVoconRecoProcessThread"
+ #define PR_VBT_ASRVOCONRECO_S PR_TSS_S
+ #define PR_VBT_ASRVOCONRECO PR_TSS
+
+ #define TN_VBT_BROADCASTREAD "BroadCastReadThread"
+ #define PR_VBT_BROADCASTREAD_S PR_TSS_S
+ #define PR_VBT_BROADCASTREAD PR_TSS
+
+ #define TN_VBT_FILEAGGREGATOR "FileAggregatorDecompressThread"
+ #define PR_VBT_FILEAGGREGATOR_S PR_TSS_S
+ #define PR_VBT_FILEAGGREGATOR PR_TSS
+
+ #define TN_VBT_HTTPCURLREQUEST "HttpCurlRequestThread"
+ #define PR_VBT_HTTPCURLREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPCURLREQUEST PR_TSS
+
+ #define TN_VBT_HTTPDRIVERREQUEST "HttpDriverRequestThread"
+ #define PR_VBT_HTTPDRIVERREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPDRIVERREQUEST PR_TSS
+
+ #define TN_VBT_HTTPREQUESTSESSION "HttpRequestSessionStateThread"
+ #define PR_VBT_HTTPREQUESTSESSION_S PR_TSS_S
+ #define PR_VBT_HTTPREQUESTSESSION PR_TSS
+
+ #define TN_VBT_PLAYMGRSTOPASYNC "PlayMgrStopAsyncStreamThread"
+ #define PR_VBT_PLAYMGRSTOPASYNC_S PR_TSS_S
+ #define PR_VBT_PLAYMGRSTOPASYNC PR_TSS
+
+ #define TN_VBT_RESOURCEMGRQUEUE "ResourceMgrQueueHandlerThread"
+ #define PR_VBT_RESOURCEMGRQUEUE_S PR_TSS_S
+ #define PR_VBT_RESOURCEMGRQUEUE PR_TSS
+
+ #define TN_VBT_SMURFDRIVERTIMEOUT "SmurfDriverTimeoutThread"
+ #define PR_VBT_SMURFDRIVERTIMEOUT_S PR_TSS_S
+ #define PR_VBT_SMURFDRIVERTIMEOUT PR_TSS
+
+ #define TN_NVR_NVRMAIN "NvrMainThread"
+ #define PR_NVR_NVRMAIN_S PR_TSS_S
+ #define PR_NVR_NVRMAIN PR_TSS
+
+ #define TN_NVR_NVRRECO "NvrRecoThread"
+ #define PR_NVR_NVRRECO_S PR_TSS_S
+ #define PR_NVR_NVRRECO PR_TSS
+
+ #define TN_NVR_NVRDICT "NvrDictThread"
+ #define PR_NVR_NVRDICT_S PR_TSS_S
+ #define PR_NVR_NVRDICT PR_TSS
+
+ #define TN_NVR_NVRENC "NvrEncThread"
+ #define PR_NVR_NVRENC_S PR_TSS_S
+ #define PR_NVR_NVRENC PR_TSS
+
+//exec from VehicleInfo
+#define MN_VEHICLEINFOSERVICE "VehicleInfoSrv"
+#define PR_VEHICLEINFOSERVICE_S PR_TSS_S
+#define PR_VEHICLEINFOSERVICE PR_TSS
+
+//exec from _CWORD58_
+#define MN__CWORD58_SERVICE "_CWORD58_Service"
+#define PR__CWORD58_SERVICE_S PR_TSS_S
+#define PR__CWORD58_SERVICE PR_TSS
+
+#define MN__CWORD8_SRV "_CWORD8_Srv"
+#define PR__CWORD8_SRV_S PR_TSS_S
+#define PR__CWORD8_SRV PR_TSS
+
+#define MN_SPCSERVICE "SPCService"
+#define PR_SPCSERVICE_S PR_TSS_S
+#define PR_SPCSERVICE PR_TSS
+
+#define MN_LOCALSERVERPROXY "LSP"
+#define PR_LOCALSERVERPROXY_S PR_TSS_S
+#define PR_LOCALSERVERPROXY PR_TSS
+
+#define MN_EOMSERVICE "eOMService"
+#define PR_EOMSERVICE_S PR_TSS_S
+#define PR_EOMSERVICE PR_TSS
+
+//exec from _CWORD89_
+#define MN__CWORD89_SERVICE "_CWORD89_Service"
+#define PR__CWORD89_SERVICE_S PR_TSS_S
+#define PR__CWORD89_SERVICE PR_TSS
+
+//exec from NetworkManager
+#define MN_NETWORKMANAGER "NetworkManager"
+#define PR_NETWORKMANAGER_S PR_TSS_S
+#define PR_NETWORKMANAGER PR_TSS
+
+ #define TN_NWM_TH_CMDRCV "NWM_Th_CmdRcv"
+ #define PR_NWM_TH_CMDRCV_S PR_TSS_S
+ #define PR_NWM_TH_CMDRCV PR_TSS
+
+ #define TN_NWM_TH_PROCMGR "NWM_Th_ProcMgr"
+ #define PR_NWM_TH_PROCMGR_S PR_TSS_S
+ #define PR_NWM_TH_PROCMGR PR_TSS
+
+ #define TN_NWM_TH_CMDPROC "NWM_Th_CmdProc"
+ #define PR_NWM_TH_CMDPROC_S PR_TSS_S
+ #define PR_NWM_TH_CMDPROC PR_TSS
+
+ #define TN_NWM_TH_DNSMGR "NWM_Th_DnsMgr"
+ #define PR_NWM_TH_DNSMGR_S PR_TSS_S
+ #define PR_NWM_TH_DNSMGR PR_TSS
+
+ #define TN_NWM_TH_DHCPD "NWM_Th_Dhcpd"
+ #define PR_NWM_TH_DHCPD_S PR_TSS_S
+ #define PR_NWM_TH_DHCPD PR_TSS
+
+// DCM Service
+#define MN_DCMSERVICE "DCMService"
+#define PR_DCMSERVICE_S PR_TSS_S
+#define PR_DCMSERVICE PR_TSS
+
+ #define TN_DCM_TH_CMDRCV "DCM_Th_CmdRcv"
+ #define PR_DCM_TH_CMDRCV_S PR_TSS_S
+ #define PR_DCM_TH_CMDRCV PR_TSS
+
+ #define TN_DCM_TH_MSGRCV "DCM_Th_MsgRcv"
+ #define PR_DCM_TH_MSGRCV_S PR_TSS_S
+ #define PR_DCM_TH_MSGRCV PR_TSS
+
+ #define TN_DCM_TH_TIMER "DCM_Th_Timer"
+ #define PR_DCM_TH_TIMER_S PR_TSS_S
+ #define PR_DCM_TH_TIMER PR_TSS
+
+// HELP Service
+#define MN_HELPSERVICE "HELPService"
+#define PR_HELPSERVICE_S PR_TSS_S
+#define PR_HELPSERVICE PR_TSS
+
+//exec from RemoteService
+#define MN_REMOTESERVICE "RemoteService"
+#define PR_REMOTESERVICE_S PR_TSS_S
+#define PR_REMOTESERVICE PR_TSS
+
+ #define TN_RS_TH_CANCTRL "RS_Th_CANCtrl"
+ #define PR_RS_TH_CANCTRL_S PR_TSS_S
+ #define PR_RS_TH_CANCTRL PR_TSS
+
+ #define TN_RS_TH_DISPCTRL "RS_Th_DispCtrl"
+ #define PR_RS_TH_DISPCTRL_S PR_TSS_S
+ #define PR_RS_TH_DISPCTRL PR_TSS
+
+ #define TN_RS_TH_PARTSCTRL "RS_Th_PartsCtrl"
+ #define PR_RS_TH_PARTSCTRL_S PR_TSS_S
+ #define PR_RS_TH_PARTSCTRL PR_TSS
+
+ #define TN_RS_TH_HTTPPROC "RS_Th_HttpProc"
+ #define PR_RS_TH_HTTPPROC_S PR_TSS_S
+ #define PR_RS_TH_HTTPPROC PR_TSS
+
+//exec from VR
+#define MN_CONTENTSMGR "contentsmgr"
+#define PR_CONTENTSMGR_S PR_TSS_S
+#define PR_CONTENTSMGR PR_TSS
+
+ #define TN_CDB_CONTENDB "contendbThread"
+ #define PR_CDB_CONTENDB_S PR_TSS_S
+ #define PR_CDB_CONTENDB PR_TSS
+
+/* COMARB Service */
+#define MN_NW_COMARB "ComArbService"
+#define PR_NW_COMARB_S PR_TSS_S
+#define PR_NW_COMARB PR_TSS
+
+/* ASND_FRthread */
+#define MN_ASND_FRTH "ASND_FRthread"
+#define PR_ASND_FRTH_S PR_SND_VCETRFCTRL_S
+#define PR_ASND_FRTH PR_SND_VCETRFCTRL
+
+/* MLINK Service */
+#define MN_MLINKSERVICE "MlinkService"
+#define PR_MLINKSERVICE_S PR_TSS_S
+#define PR_MLINKSERVICE PR_TSS
+
+#define MN__CWORD74_SERVICE "_CWORD74_Service"
+#define PR__CWORD74_SERVICE_S PR_TSS_S
+#define PR__CWORD74_SERVICE PR_TSS
+#endif //__AGL_THREAD_H__
diff --git a/agl-basefiles/include/agl_types_obsoluted.h b/agl-basefiles/include/agl_types_obsoluted.h
new file mode 100644
index 0000000..0f7e86d
--- /dev/null
+++ b/agl-basefiles/include/agl_types_obsoluted.h
@@ -0,0 +1,136 @@
+/*
+ * @copyright Copyright (c) 2017-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _AGL_TYPES_OBSOLUTED_H_
+#define _AGL_TYPES_OBSOLUTED_H_
+
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <linux/types.h>
+#include <stdio.h>
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <errno.h>
+
+typedef u_int64_t _Uint64t;
+typedef int64_t _Int64t;
+typedef u_int32_t _Uint32t;
+typedef int32_t _Int32t;
+typedef u_int16_t _Uint16t;
+typedef int16_t _Int16t;
+typedef u_int8_t _Uint8t;
+typedef int8_t _Int8t;
+
+typedef _Int8t _int8;
+typedef _Uint8t _uint8;
+typedef _Int16t _int16;
+typedef _Uint16t _uint16;
+typedef _Int32t _int32;
+typedef _Uint32t _uint32;
+typedef _Int64t _int64;
+typedef _Uint64t _uint64;
+
+
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+#define AGL_PROTECTION_NO_CACHE 0x00000800
+#define AGL_MAP_NON_INIT 0x00004000
+#define AGL_MAP_PHYSICAL 0x00010000
+#define AGL_NON_FD (-1)
+#define AGL_MAP_DEV_FAILED ((unsigned long)MAP_FAILED)
+#endif /*AGL_PosixBasedOS001LEGACY_USED*/
+
+#define EOK 0
+
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+#define agl_io_in32(_x) *(volatile unsigned long *)(_x)
+#define agl_io_out32(_x, _y) {*(volatile unsigned long *)((void*)(_x)) = (_y);}
+#endif /*AGL_PosixBasedOS001LEGACY_USED*/
+
+
+
+#define __AGLDD_TYPEDEF_I64
+typedef int64_t i64; /* 8-byte signed integer */
+
+#define __AGLDD_TYPEDEF_U64
+typedef uint64_t u64; /* 8-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_U32
+typedef uint32_t u32; /* 4-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_U16
+typedef uint16_t u16; /* 2-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_I16
+typedef int16_t i16; /* 2-byte signed integer */
+
+#define __AGLDD_TYPEDEF_U8
+typedef uint8_t u8; /* 1-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_I8
+typedef int8_t i8; /* 1-byte signed integer */
+
+#define __AGLDD_TYPEDEF_INT8
+typedef int8_t INT8;
+
+#define __AGLDD_TYPEDEF_INT16
+typedef int16_t INT16;
+
+#define __AGLDD_TYPEDEF_INT32
+typedef int32_t INT32;
+
+#define __AGLDD_TYPEDEF_INT64
+typedef int64_t INT64;
+
+#define __AGLDD_TYPEDEF_UINT8
+typedef uint8_t UINT8;
+
+#define __AGLDD_TYPEDEF_UINT16
+typedef uint16_t UINT16;
+
+#define __AGLDD_TYPEDEF_UINT32
+typedef uint32_t UINT32;
+
+#define __AGLDD_TYPEDEF_UINT64
+typedef uint64_t UINT64;
+
+#ifndef __KERNEL__
+#if !defined __WIN_TYPEDEF_BOOL
+#define __AGLDD_TYPEDEF_BOOL
+typedef uint32_t BOOL;
+#endif
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+// AGL ASSERT MACRO
+#ifdef AGL_ASSERT_ON
+#define AGL_ASSERT_NOT_TESTED() \
+do {fprintf(stderr, "[%s][%s][%s:%d]AGL_ASSERT_NOT_TESTED.\n", \
+ program_invocation_short_name, __func__, __FILE__, __LINE__);} while(0)
+#else
+#define AGL_ASSERT_NOT_TESTED() \
+do {} while(0)
+#endif
+#endif /* _AGL_TYPES_OBSOLUTED_H_ */
diff --git a/agl-basefiles/include/agl_wakeup_order.h b/agl-basefiles/include/agl_wakeup_order.h
new file mode 100644
index 0000000..006f1bc
--- /dev/null
+++ b/agl-basefiles/include/agl_wakeup_order.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _AGL_WAKEUP_ORDER_H_
+#define _AGL_WAKEUP_ORDER_H_
+
+//This header define Wakeup Order Name
+//The max string length is 31
+
+#define WON_DEFAULT "DEFAULT"
+
+#endif
+
+
diff --git a/agl-basefiles/include/aglpath.h b/agl-basefiles/include/aglpath.h
new file mode 100644
index 0000000..e278fbf
--- /dev/null
+++ b/agl-basefiles/include/aglpath.h
@@ -0,0 +1,200 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * common path
+ */
+
+/* This definitions are matched as following document.
+ * eMMC Partition Specification V1.28
+ */
+
+#ifndef _AGL_PATH_H_
+#define _AGL_PATH_H_
+
+/* Common path */
+
+#define PF_ROOT "/"
+#define PF_NV PF_ROOT"nv/"
+#define PF_VAR PF_ROOT"var/"
+#define PF_TMP PF_ROOT"tmp/"
+#define PF_USR PF_ROOT"usr/"
+#define PF_MNT PF_ROOT"mnt/"
+#define PF_RAMD PF_ROOT"ramd/"
+#define PF_ENVPARAM PF_ROOT"env_param/"
+#define PF_NVSYSTEM PF_ROOT"nv_system/"
+
+#define PF_SHM PF_TMP"shm/"
+#define PF_SHARE PF_USR"share/"
+#define PF_P_SHARE PF_USR"agl/share/"
+
+#define PF_SYS_BS PF_NVSYSTEM"sys_bs/"
+
+#define PF_SYS_BACKUP PF_NV"backup/"
+#define PF_SYS_NPP PF_NV"npp/"
+
+#define PF_NV_REPRO PF_NV"repro/"
+#define PF_NV_LOG PF_NV"log/"
+#define PF_NV_VUI PF_NV"vui/"
+#define PF_NV_NAVI PF_NV"navi/"
+#define PF_NV_TFF PF_NV"tff/"
+#define PF_NV_FULLBROWSER PF_NV"fullbrowser/"
+#define PF_NV__CWORD8_ PF_NV"_CWORD8_/"
+#define PF_NV_MANUAL PF_NV"manual/"
+#define PF_NV_LOG2 PF_NV"log2/"
+#define PF_NV_PTDATA PF_NV"ptdata/"
+
+#define PF_NV_NORACCESS PF_NV_PTDATA"noraccess/"
+#define PF_NV_SEC PF_NV_PTDATA"sec/"
+#define PF_NVPT_GRAPHICS PF_NV_PTDATA"graphics/"
+#define PF_NVPT_HMI PF_NV_PTDATA"hmi/"
+#define PF_NVPT_VEHICLE PF_NV_PTDATA"vehicle/"
+#define PF_NVPT_CONNECTIVITY PF_NV_PTDATA"connectivity/"
+#define PF_NVPT_WLAN PF_NV_PTDATA"wlan/"
+#define PF_NVPT_SI PF_NV_PTDATA"si/"
+
+#define PF_NVLOG_AGLLOG PF_NV_LOG"agllog/"
+#define PF_NVLOG_WORK PF_NV_LOG"work/"
+#define PF_NVLOG_AWLOG PF_NV_LOG2"awlog/"
+#define PF_NVLOG_CORE PF_NV_LOG2"core/"
+
+
+/* Component domain */
+
+#define DOM_GRAPHICS "graphics"
+#define DOM_SOUND "sound"
+#define DOM_NS_STORAGE "ns_storage"
+#define DOM_NS_IMAGESTORAGE "ns_imagestorage"
+#define DOM_BS "bs"
+#define DOM__CWORD24_ "_CWORD24_"
+#define DOM_HMI "hmi"
+#define DOM_WLAN "wlan"
+#define DOM_BT "bt"
+#define DOM_CINEMO "cinemo"
+#define DOM_MEDIASRV "mediasrv"
+#define DOM_CONTENTMGR "contentmgr"
+#define DOM_USBAUDIO "usbaudio"
+#define DOM_CDDVD "cddvd"
+#define DOM_AV "av"
+#define DOM_DATASRV "datasrv"
+#define DOM_RADIO "radio"
+#define DOM_BTOOTH "Bluetooth"
+#define DOM__CWORD57_ "_CWORD57_"
+#define DOM_REMOTESERVICE "remoteservice"
+#define DOM_CONNECTIVITY "connectivity"
+#define DOM_NAVIGATION "navigation"
+#define DOM_VEHICLE "vehicle"
+#define DOM_ROMACCESS "romaccess"
+#define DOM_AUDIOMGR "audiomgr"
+#define DOM_BACKUP "backup"
+#define DOM_NPP "npp"
+
+#define DOM_DCMSERVICE "dcmservice"
+#define DOM_NETWORKMANAGER "NetworkManager"
+
+/* Others */
+#define DOM_AGLLOG "agllog"
+#define DOM_AWLOG "awlog"
+#define DOM_WORK "work"
+#define DOM_CORE "core"
+
+#define DOM_NORACCESS "noraccess"
+#define DOM_SEC "sec"
+#define DOM_DIAG "diag"
+
+
+/* For WebDAV */
+
+#define PF_EXP_INTR PF_NV"export/Internal/"
+#define PF_EXPINT_AUDIO PF_EXP_INTR"Audio/"
+#define PF_EXPINT_DATASERV PF_EXP_INTR"DataService/"
+#define PF_EXPINT_SCREENCAP PF_EXP_INTR"ScreenCapture/"
+#define PF_EXPINT_REPRO PF_EXP_INTR"Repro/"
+#define PF_EXPINT_VEHICLEINFO PF_EXP_INTR"VehicleInfoDraw/"
+#define PF_EXPINT_VEHICLEPARA PF_EXP_INTR"VehicleParameter/"
+#define PF_EXPINT_VR PF_EXP_INTR"VR/"
+#define PF_EXPINT_NAVI PF_EXP_INTR"Navi/"
+#define PF_EXPINT_TFF PF_EXP_INTR"TFF/"
+#define PF_EXPINT_OSS PF_EXP_INTR"OSS/"
+#define PF_EXPINT_SMARTPHONE PF_EXP_INTR"Smartphone/"
+
+/* For RAMD */
+#define PF_RAMD_LOG PF_RAMD"log/"
+#define PF_RAMD_BKUP PF_RAMD"bkup/"
+
+#define PF_RAMD_AWLOG PF_RAMD_LOG"awlog/"
+#define PF_RAMD_AGLLOG PF_RAMD_LOG"agllog/"
+
+#define PF_RAMD_COMMUNICATION PF_RAMD_AGLLOG"communication/"
+#define PF_RAMD_RADIO PF_RAMD_AGLLOG"radio/"
+#define PF_RAMD_CONNECTIVITY PF_RAMD_AGLLOG"connectivity/"
+#define PF_RAMD_DIAG PF_RAMD_AGLLOG"diag/"
+#define PF_RAMD_SYSLOG PF_RAMD_AGLLOG"syslog/"
+#define PF_RAMD_APPFW PF_RAMD_AGLLOG"appfw/"
+
+
+
+/* For Loopback */
+#define PF_MNTLOOP PF_ROOT"mnt_loop/"
+
+#define PF_MNTLOOP_AW0 PF_MNTLOOP"loopaw0/"
+#define PF_MNTLOOP_AW1 PF_MNTLOOP"loopaw1/"
+#define PF_MNTLOOP_AW2 PF_MNTLOOP"loopaw2/"
+#define PF_MNTLOOP_AW3 PF_MNTLOOP"loopaw3/"
+#define PF_MNTLOOP_AW4 PF_MNTLOOP"loopaw4/"
+#define PF_MNTLOOP_AW5 PF_MNTLOOP"loopaw5/"
+#define PF_MNTLOOP_AW6 PF_MNTLOOP"loopaw6/"
+#define PF_MNTLOOP_AW7 PF_MNTLOOP"loopaw7/"
+#define PF_MNTLOOP_AW8 PF_MNTLOOP"loopaw8/"
+#define PF_MNTLOOP_AW9 PF_MNTLOOP"loopaw9/"
+#define PF_MNTLOOP_AW10 PF_MNTLOOP"loopaw10/"
+#define PF_MNTLOOP_AW11 PF_MNTLOOP"loopaw11/"
+#define PF_MNTLOOP_AW12 PF_MNTLOOP"loopaw12/"
+#define PF_MNTLOOP_AW13 PF_MNTLOOP"loopaw13/"
+#define PF_MNTLOOP_AW14 PF_MNTLOOP"loopaw14/"
+#define PF_MNTLOOP_AW15 PF_MNTLOOP"loopaw15/"
+#define PF_MNTLOOP_AW16 PF_MNTLOOP"loopaw16/"
+#define PF_MNTLOOP_AW17 PF_MNTLOOP"loopaw17/"
+#define PF_MNTLOOP_AW18 PF_MNTLOOP"loopaw18/"
+#define PF_MNTLOOP_AW19 PF_MNTLOOP"loopaw19/"
+#define PF_MNTLOOP_AW20 PF_MNTLOOP"loopaw20/"
+
+/* For Tmpfs mount */
+#define PF_MNTTMPFS PF_ROOT"mnt_tmpfs/"
+#define PF_MNTTMPFS_AW0 PF_MNTTMPFS"tmpfsaw0/"
+
+
+/* DONT USE FOLLOWING DEFINITION !! */
+/* These will be deleted in the future */
+
+#define PF_NV_P3 PF_NV"p3/"
+#define PF_NV_P4 PF_NV"p4/"
+#define PF_NV_P5 PF_NV"p5/"
+#define PF_NV_P6 PF_NV"p6/"
+
+#define PF_NPP PF_NV_P3"npp/"
+#define PF_BS PF_NV_P3"bs/"
+
+#define DOM__CWORD8_ "_CWORD8_"
+#define DOM_BLUETOOTH "bluetooth"
+#define DOM_VR "vr"
+#define DOM_ENTUNE "entune"
+
+#define PF_RAMD_GRAPHICS PF_RAMD_BKUP"graphics/"
+
+#define PF_EXPINT_TRAFFIC PF_EXP_INTR"Traffic/"
+
+#endif/* _AGL_PATH_H_ */
diff --git a/agl-basefiles/include/sm_launch_conf.h b/agl-basefiles/include/sm_launch_conf.h
new file mode 100644
index 0000000..d444eb0
--- /dev/null
+++ b/agl-basefiles/include/sm_launch_conf.h
@@ -0,0 +1,1385 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AGL_THREAD_H__
+#define __AGL_THREAD_H__
+
+//MACRO
+#define PR_TSS_S "0"
+#define PR_TSS 0
+
+/*
+ Main thread name. It need to be same as service name in sm_launch.xml or tskm_launch.xml
+ Max name length is 15
+ #define MN_XXXXX "MainName"
+
+ Thread name
+ Max name length is 15
+ #define TN_XXXXX "ThreadName"
+
+ Thread priority 0:TSS 1-99:FIFO
+ #define PR_XXXXX_S "(0-99)" //for xml
+ #define PR_XXXXX 0-99 //for program
+*/
+
+#define MN_SS_SYSMANAGER "SS_SysManager"
+#define PR_SS_SYSMANAGER_S "0"
+#define PR_SS_SYSMANAGER (0)
+
+ #define TN_SMHEARTBEAT "SM.Heartbeat"
+ #define PR_SMHEARTBEAT_S "0"
+ #define PR_SMHEARTBEAT (0)
+
+ #define TN_SMPROCLAUNCH "SM.ProcLaunch"
+ #define PR_SMPROCLAUNCH_S "0"
+ #define PR_SMPROCLAUNCH (0)
+
+ #define TN_SMLOWMEMMON "SM.LowMemMon"
+ #define PR_SMLOWMEMMON_S "0"
+ #define PR_SMLOWMEMMON (0)
+
+ #define TN_LOGGERRTIME "LoggerRtime"
+ #define PR_LOGGERRTIME_S PR_TSS_S
+ #define PR_LOGGERRTIME PR_TSS
+
+
+//======= exec from system manager =============
+#define MN_NS_SHAREDMEM "NS_SharedMem"
+#define PR_NS_SHAREDMEM_S "0"
+#define PR_NS_SHAREDMEM (0)
+
+
+#define MN_NS_NPPSERVICE "NS_NPPService"
+#define PR_NS_NPPSERVICE_S "0"
+#define PR_NS_NPPSERVICE (0)
+
+ #define TN_NS_NPPREADWKR "NS_NPPReadWkr"
+ #define PR_NS_NPPREADWKR_S "0"
+ #define PR_NS_NPPREADWKR (0)
+
+ #define TN_NS_NPPWRITEWKR "NS_NPPWriteWkr"
+ #define PR_NS_NPPWRITEWKR_S "0"
+ #define PR_NS_NPPWRITEWKR (0)
+
+ #define TN_NS_NPPIPWKR "NS_NPPIPWkr"
+ #define PR_NS_NPPIPWKR_S "0"
+ #define PR_NS_NPPIPWKR (0)
+
+#define MN_NS_BACKUPMGR "NS_BackupMgr"
+#define PR_NS_BACKUPMGR_S "0"
+#define PR_NS_BACKUPMGR (0)
+
+ #define TN_NS_BKUPNAND "NS_BkupNAND"
+ #define PR_NS_BKUPNAND_S "0"
+ #define PR_NS_BKUPNAND (0)
+
+ #define TN_NS_BKUPDELAY "NS_BkupDelay"
+ #define PR_NS_BKUPDELAY_S "0"
+ #define PR_NS_BKUPDELAY (0)
+
+#define MN_SS_DEVDETECTSRV "SS_DevDetectSrv"
+#define PR_SS_DEVDETECTSRV_S "0"
+#define PR_SS_DEVDETECTSRV (0)
+
+ #define TN_SS_DETECT_USB "SS_Detect_USB"
+ #define PR_SS_DETECT_USB_S "0"
+ #define PR_SS_DETECT_USB (0)
+
+ #define TN_SS_DETECT_SD "SS_Detect_SD"
+ #define PR_SS_DETECT_SD_S "0"
+ #define PR_SS_DETECT_SD (0)
+
+ #define TN_SS_MONITOR_OVC "SS_Monitor_OVC"
+ #define PR_SS_MONITOR_OVC_S "0"
+ #define PR_SS_MONITOR_OVC (0)
+
+#define MN_SS_LOGGERSRV "SS_LoggerSrv"
+#define PR_SS_LOGGERSRV_S PR_TSS_S
+#define PR_SS_LOGGERSRV PR_TSS
+
+ #define TN_PDGLOGQUER "pdg.LogQueR"
+ #define PR_PDGLOGQUER_S PR_TSS_S
+ #define PR_PDGLOGQUER PR_TSS
+
+ #define TN_PDGTRANSQUER "pdg.TransQueR"
+ #define PR_PDGTRANSQUER_S PR_TSS_S
+ #define PR_PDGTRANSQUER PR_TSS
+
+ #define TN_PDGEVNTLOGQUE "pdg.EvntLogQue"
+ #define PR_PDGEVNTLOGQUE_S PR_TSS_S
+ #define PR_PDGEVNTLOGQUE PR_TSS
+
+ #define TN_SSLOGGERSTRAGE "SSLoggerStrage"
+ #define PR_SSLOGGERSTRAGE_S PR_TSS_S
+ #define PR_SSLOGGERSTRAGE PR_TSS
+
+ #define TN_PFDRECTHREAD "PFDRECThread"
+ #define PR_PFDRECTHREAD_S PR_TSS_S
+ #define PR_PFDRECTHREAD PR_TSS
+
+#define MN_PS_LOGGERSHADOW "PS_LoggerShadow"
+ #define PR_PSLOGGERSHADOW_S PR_TSS_S
+ #define PR_PSLOGGERSHADOW PR_TSS
+
+#define MN_UDEVD "udevd"
+#define PR_UDEVD_S "1"
+#define PR_UDEVD (1)
+
+#define MN_COMMUNICATION "Communication"
+#define PR_COMMUNICATION_S "0"
+#define PR_COMMUNICATION (0)
+
+ #define TN_DEV_SYSCOM_TMR "DEV_SYSCOM_TMR"
+ #define PR_DEV_SYSCOM_TMR_S "0"
+ #define PR_DEV_SYSCOM_TMR (0)
+
+ #define TN_DEV_SYSCOM_RCV "DEV_SYSCOM_RCV"
+ #define PR_DEV_SYSCOM_RCV_S "0"
+ #define PR_DEV_SYSCOM_RCV (0)
+
+ #define TN_DEV_SYSCOM_MAIN "DEV_SYSCOM_MAIN"
+ #define PR_DEV_SYSCOM_MAIN_S "0"
+ #define PR_DEV_SYSCOM_MAIN (0)
+
+ #define TN_TGWCOM "TGWCOM"
+ #define PR_TGWCOM_S "0"
+ #define PR_TGWCOM (0)
+
+ #define TN__CWORD83_ "_CWORD83_"
+ #define PR__CWORD83__S "0"
+ #define PR__CWORD83_ (0)
+
+ #define TN_CAN_COM_PROT "CAN_COM_PROT"
+ #define PR_CAN_COM_PROT_S "0"
+ #define PR_CAN_COM_PROT (0)
+
+#define MN_PS_PSMSHADOW "PS_PSMShadow"
+#define PR_PS_PSMSHADOW_S "0"
+#define PR_PS_PSMSHADOW (0)
+
+#define MN_COMMSH4A "CommSH4A"
+#define PR_COMMSH4A_S "0"
+#define PR_COMMSH4A (0)
+
+ #define TN_DEV_SH4A_SND "DEV_SH4ACOM_SND"
+ #define PR_DEV_SH4A_SND_S "0"
+ #define PR_DEV_SH4A_SND (0)
+
+ #define TN_DEV_SH4A_RCV "DEV_SH4ACOM_RCV"
+ #define PR_DEV_SH4A_RCV_S "0"
+ #define PR_DEV_SH4A_RCV (0)
+
+ #define TN_DEV_SH4A_MON "DEV_SH4ACOM_MON"
+ #define PR_DEV_SH4A_MON_S "0"
+ #define PR_DEV_SH4A_MON (0)
+
+#define MN_PS_COMMUSB "PS_CommUSB"
+#define PR_PS_COMMUSB_S "0"
+#define PR_PS_COMMUSB (0)
+
+ #define TN_COMMUSB_RCV "COMMUSB_RCV"
+ #define PR_COMMUSB_RCV_S "0"
+ #define PR_COMMUSB_RCV (0)
+
+ #define TN_COMMUSB_DIAG "COMMUSB_DIAG"
+ #define PR_COMMUSB_DIAG_S "0"
+ #define PR_COMMUSB_DIAG (0)
+
+#define MN_PS_CANGW_M "CANGW_M"
+#define PR_PS_CANGW_M_S PR_TSS_S
+#define PR_PS_CANGW_M PR_TSS
+
+ #define TN_CANGW_M_RCV "CANGW_M_RCV"
+ #define PR_CANGW_M_RCV_S PR_TSS_S
+ #define PR_CANGW_M_RCV PR_TSS
+
+ #define TN_CANGW_M_DIAG "CANGW_M_DIAG"
+ #define PR_CANGW_M_DIAG_S PR_TSS_S
+ #define PR_CANGW_M_DIAG PR_TSS
+
+#define MN_PS_CANGW_S "CANGW_S"
+#define PR_PS_CANGW_S_S PR_TSS_S
+#define PR_PS_CANGW_S PR_TSS
+
+ #define TN_CANGW_S_SND "CANGW_S_SND"
+ #define PR_CANGW_S_SND_S PR_TSS_S
+ #define PR_CANGW_S_SND PR_TSS
+
+ #define TN_CANGW_S_DIAG "CANGW_S_DIAG"
+ #define PR_CANGW_S_DIAG_S PR_TSS_S
+ #define PR_CANGW_S_DIAG PR_TSS
+
+#define MN_LANSERVER "LanServer"
+#define PR_LANSERVER_S "0"
+#define PR_LANSERVER (0)
+
+#define MN_PS_CDR "ps_cdr"
+#define PR_PS_CDR_S PR_TSS_S
+#define PR_PS_CDR PR_TSS
+
+ #define TN_PS_CDR_NBD "ps_cdr_nbd"
+ #define PR_PS_CDR_NBD_S PR_TSS_S
+ #define PR_PS_CDR_NBD PR_TSS
+
+ #define TN_PS_CDR_DOIT "ps_cdr_doit"
+ #define PR_PS_CDR_DOIT_S PR_TSS_S
+ #define PR_PS_CDR_DOIT PR_TSS
+
+ #define TN_PS_CDR_READ "ps_cdr_read"
+ #define PR_PS_CDR_READ_S PR_TSS_S
+ #define PR_PS_CDR_READ PR_TSS
+
+#define MN_POSITIONING "Positioning"
+#define PR_POSITIONING_S PR_TSS_S
+#define PR_POSITIONING PR_TSS
+
+ #define TN_POSITIONING_GPS_MAIN "POS_Main"
+ #define PR_POSITIONING_GPS_MAIN_S PR_TSS_S
+ #define PR_POSITIONING_GPS_MAIN PR_TSS
+
+ #define TN_POSITIONING_GPS_RECV "POS_Gps_Recv"
+ #define PR_POSITIONING_GPS_RECV_S PR_TSS_S
+ #define PR_POSITIONING_GPS_RECV PR_TSS
+
+ #define TN_POSITIONING_GPS "POS_Gps"
+ #define PR_POSITIONING_GPS_S PR_TSS_S
+ #define PR_POSITIONING_GPS PR_TSS
+
+ #define TN_POSITIONING_SENS "POS_Sens"
+ #define PR_POSITIONING_SENS_S PR_TSS_S
+ #define PR_POSITIONING_SENS PR_TSS
+
+ #define TN_POSITIONING_GPS_ROLOVR "POS_Gps_Rolovr"
+ #define PR_POSITIONING_GPS_ROLOVR_S PR_TSS_S
+ #define PR_POSITIONING_GPS_ROLOVR PR_TSS
+
+#define MN_CLOCK "clock"
+#define PR_CLOCK_S "0"
+#define PR_CLOCK (0)
+
+ #define TN_CLOCK_MNG "ClockMng"
+ #define PR_CLOCK_MNG_S "0"
+ #define PR_CLOCK_MNG (0)
+
+#define MN_VEHICLE "vehicle"
+#define PR_VEHICLE_S "0"
+#define PR_VEHICLE (0)
+
+ #define TN_VEHICLE_SENS "VehicleSens"
+ #define PR_VEHICLE_SENS_S "0"
+ #define PR_VEHICLE_SENS (0)
+
+ #define TN_LINE_SENS_DRV "LineSensDrv"
+ #define PR_LINE_SENS_DRV_S "0"
+ #define PR_LINE_SENS_DRV (0)
+
+#define MN_SS_POWERSERVICE "SS_PowerService"
+#define PR_SS_POWERSERVICE_S "0"
+#define PR_SS_POWERSERVICE (0)
+
+#define MN_SS_TASKMANAGER "SS_TaskManager"
+#define PR_SS_TASKMANAGER_S "0"
+#define PR_SS_TASKMANAGER (0)
+
+ #define TN_SS_TSKMTIMER "SS_TskmTimer"
+ #define PR_SS_TSKMTIMER_S "0"
+ #define PR_SS_TSKMTIMER (0)
+
+#define MN_SOUND "Sound"
+#define PR_SOUND_S "0"
+#define PR_SOUND (0)
+
+ #define TN_VG_SNDSRCMGR "VG_SNDSRCMGR"
+ #define PR_VG_SNDSRCMGR_S "0"
+ #define PR_VG_SNDSRCMGR (0)
+
+ #define TN_SND_INPUTCTRL "SND_INPUTCTRL"
+ #define PR_SND_INPUTCTRL_S "0"
+ #define PR_SND_INPUTCTRL (0)
+
+ #define TN_SND_DEVCTRL "SND_DEVCTRL"
+ #define PR_SND_DEVCTRL_S "0"
+ #define PR_SND_DEVCTRL (0)
+
+ #define TN_SND_VCETRFCTRL "SND_VCETRFCTRL"
+ #define PR_SND_VCETRFCTRL_S "0"
+ #define PR_SND_VCETRFCTRL (0)
+
+ #define TN_SND_VCETRFWRT1 "SND_VCETRFWRT1"
+ #define PR_SND_VCETRFWRT1_S "0"
+ #define PR_SND_VCETRFWRT1 (0)
+
+ #define TN_SND_VCETRFWRT2 "SND_VCETRFWRT2"
+ #define PR_SND_VCETRFWRT2_S "0"
+ #define PR_SND_VCETRFWRT2 (0)
+
+ #define TN_VG_SNDCTRL_BSCF "VG_SNDCTRL_BSCF"
+ #define PR_VG_SNDCTRL_BSCF_S "0"
+ #define PR_VG_SNDCTRL_BSCF (0)
+
+ #define TN_VG_SNDCTRL_BSCR "VG_SNDCTRL_BSCR"
+ #define PR_VG_SNDCTRL_BSCR_S "0"
+ #define PR_VG_SNDCTRL_BSCR (0)
+
+ #define TN_VG_SNDCTRL_ITRT "VG_SNDCTRL_ITRT"
+ #define PR_VG_SNDCTRL_ITRT_S "0"
+ #define PR_VG_SNDCTRL_ITRT (0)
+
+ #define TN_CVRS_OPRT_OUT_1 "CVRS_OPRT_OUT_1"
+ #define PR_CVRS_OPRT_OUT_1_S "0"
+ #define PR_CVRS_OPRT_OUT_1 (0)
+
+ #define TN_CVRS_OPRT_OUT_2 "CVRS_OPRT_OUT_2"
+ #define PR_CVRS_OPRT_OUT_2_S "0"
+ #define PR_CVRS_OPRT_OUT_2 (0)
+
+ #define TN_CVRS_OPRT_OUT_3 "CVRS_OPRT_OUT_3"
+ #define PR_CVRS_OPRT_OUT_3_S "0"
+ #define PR_CVRS_OPRT_OUT_3 (0)
+
+ #define TN_CVRS_OPRT_OUT_4 "CVRS_OPRT_OUT_4"
+ #define PR_CVRS_OPRT_OUT_4_S "0"
+ #define PR_CVRS_OPRT_OUT_4 (0)
+
+ #define TN_CVRS_OPRT_IN_1 "CVRS_OPRT_IN_1"
+ #define PR_CVRS_OPRT_IN_1_S "0"
+ #define PR_CVRS_OPRT_IN_1 (0)
+
+ #define TN_CVRS_OPRT_IN_2 "CVRS_OPRT_IN_2"
+ #define PR_CVRS_OPRT_IN_2_S "0"
+ #define PR_CVRS_OPRT_IN_2 (0)
+
+ #define TN_CVRS_OPRT_IN_3 "CVRS_OPRT_IN_3"
+ #define PR_CVRS_OPRT_IN_3_S "0"
+ #define PR_CVRS_OPRT_IN_3 (0)
+
+ #define TN_CVRS_OPRT_IN_4 "CVRS_OPRT_IN_4"
+ #define PR_CVRS_OPRT_IN_4_S "0"
+ #define PR_CVRS_OPRT_IN_4 (0)
+
+ #define TN_CVRS_OPRT_IN_5 "CVRS_OPRT_IN_5"
+ #define PR_CVRS_OPRT_IN_5_S "0"
+ #define PR_CVRS_OPRT_IN_5 (0)
+
+ #define TN_CVRS_OPRT_IN_6 "CVRS_OPRT_IN_6"
+ #define PR_CVRS_OPRT_IN_6_S "0"
+ #define PR_CVRS_OPRT_IN_6 (0)
+
+ #define TN_CVRS_OPRT_IN_7 "CVRS_OPRT_IN_7"
+ #define PR_CVRS_OPRT_IN_7_S "0"
+ #define PR_CVRS_OPRT_IN_7 (0)
+
+ #define TN_CVRS_OPRT_IN_8 "CVRS_OPRT_IN_8"
+ #define PR_CVRS_OPRT_IN_8_S "0"
+ #define PR_CVRS_OPRT_IN_8 (0)
+
+ #define TN_CVRS_OPRT_BS_I "CVRS_OPRT_BS_I"
+ #define PR_CVRS_OPRT_BS_I_S "0"
+ #define PR_CVRS_OPRT_BS_I (0)
+
+ #define TN_VR_NVR_RECO "VR_NVR_RECO"
+ #define PR_VR_NVR_RECO_S "0"
+ #define PR_VR_NVR_RECO (0)
+
+ #define TN_SND_ECNR "SND_ECNR"
+ #define PR_SND_ECNR_S "0"
+ #define PR_SND_ECNR (0)
+
+ #define TN_SNDAGENT_000 "SNDAGENT_000"
+ #define PR_SNDAGENT_000_S "0"
+ #define PR_SNDAGENT_000 (0)
+
+ #define TN_SNDAGENT_001 "SNDAGENT_001"
+ #define PR_SNDAGENT_001_S "0"
+ #define PR_SNDAGENT_001 (0)
+
+ #define TN_SNDAGENT_002 "SNDAGENT_002"
+ #define PR_SNDAGENT_002_S "0"
+ #define PR_SNDAGENT_002 (0)
+
+ #define TN_SNDAGENT_003 "SNDAGENT_003"
+ #define PR_SNDAGENT_003_S "0"
+ #define PR_SNDAGENT_003 (0)
+
+ #define TN_SNDAGENT_004 "SNDAGENT_004"
+ #define PR_SNDAGENT_004_S "0"
+ #define PR_SNDAGENT_004 (0)
+
+ #define TN_SNDAGENT_005 "SNDAGENT_005"
+ #define PR_SNDAGENT_005_S "0"
+ #define PR_SNDAGENT_005 (0)
+
+ #define TN_SNDAGENT_006 "SNDAGENT_006"
+ #define PR_SNDAGENT_006_S "0"
+ #define PR_SNDAGENT_006 (0)
+
+ #define TN_SNDAGENT_007 "SNDAGENT_007"
+ #define PR_SNDAGENT_007_S "0"
+ #define PR_SNDAGENT_007 (0)
+
+ #define TN_SNDAGENT_008 "SNDAGENT_008"
+ #define PR_SNDAGENT_008_S "0"
+ #define PR_SNDAGENT_008 (0)
+
+ #define TN_SNDAGENT_009 "SNDAGENT_009"
+ #define PR_SNDAGENT_009_S "0"
+ #define PR_SNDAGENT_009 (0)
+
+ #define TN_SNDAGENT_010 "SNDAGENT_010"
+ #define PR_SNDAGENT_010_S "0"
+ #define PR_SNDAGENT_010 (0)
+
+ #define TN_SNDAGENT_011 "SNDAGENT_011"
+ #define PR_SNDAGENT_011_S "0"
+ #define PR_SNDAGENT_011 (0)
+
+ #define TN_SNDAGENT_012 "SNDAGENT_012"
+ #define PR_SNDAGENT_012_S "0"
+ #define PR_SNDAGENT_012 (0)
+
+ #define TN_SNDAGENT_013 "SNDAGENT_013"
+ #define PR_SNDAGENT_013_S "0"
+ #define PR_SNDAGENT_013 (0)
+
+ #define TN_SNDAGENT_014 "SNDAGENT_014"
+ #define PR_SNDAGENT_014_S "0"
+ #define PR_SNDAGENT_014 (0)
+
+ #define TN_SNDAGENT_015 "SNDAGENT_015"
+ #define PR_SNDAGENT_015_S "0"
+ #define PR_SNDAGENT_015 (0)
+
+ #define TN_SNDAGENT_016 "SNDAGENT_016"
+ #define PR_SNDAGENT_016_S "0"
+ #define PR_SNDAGENT_016 (0)
+
+ #define TN_SNDAGENT_017 "SNDAGENT_017"
+ #define PR_SNDAGENT_017_S "0"
+ #define PR_SNDAGENT_017 (0)
+
+ #define TN_SNDAGENT_018 "SNDAGENT_018"
+ #define PR_SNDAGENT_018_S "0"
+ #define PR_SNDAGENT_018 (0)
+
+ #define TN_SNDAGENT_019 "SNDAGENT_019"
+ #define PR_SNDAGENT_019_S "0"
+ #define PR_SNDAGENT_019 (0)
+
+ #define TN_SNDAGENT_020 "SNDAGENT_020"
+ #define PR_SNDAGENT_020_S "0"
+ #define PR_SNDAGENT_020 (0)
+
+ #define TN_SNDAGENT_021 "SNDAGENT_021"
+ #define PR_SNDAGENT_021_S "0"
+ #define PR_SNDAGENT_021 (0)
+
+ #define TN_SNDAGENT_022 "SNDAGENT_022"
+ #define PR_SNDAGENT_022_S "0"
+ #define PR_SNDAGENT_022 (0)
+
+ #define TN_SNDAGENT_023 "SNDAGENT_023"
+ #define PR_SNDAGENT_023_S "0"
+ #define PR_SNDAGENT_023 (0)
+
+ #define TN_SNDAGENT_024 "SNDAGENT_024"
+ #define PR_SNDAGENT_024_S "0"
+ #define PR_SNDAGENT_024 (0)
+
+ #define TN_SNDAGENT_025 "SNDAGENT_025"
+ #define PR_SNDAGENT_025_S "0"
+ #define PR_SNDAGENT_025 (0)
+
+#define MN_SS_RESOURCEMGR "SS_ResourceMgr"
+#define PR_SS_RESOURCEMGR_S "0"
+#define PR_SS_RESOURCEMGR (0)
+
+ #define TN_RESOURCEHWDT "ResourceHWDT"
+ #define PR_RESOURCEHWDT_S "0"
+ #define PR_RESOURCEHWDT (0)
+
+#define MN_AS_AUDIOMANAGER "AS_AudioManager"
+#define PR_AS_AUDIOMANAGER_S PR_TSS_S
+#define PR_AS_AUDIOMANAGER PR_TSS
+
+ #define TN_AS_SOUNDBEEP "AS_SoundBeep"
+ #define PR_AS_SOUNDBEEP_S PR_TSS_S
+ #define PR_AS_SOUNDBEEP PR_TSS
+
+#define MN_GRAPHICS "Graphics"
+#define PR_GRAPHICS_S "0"
+#define PR_GRAPHICS (0)
+
+ #define TN_GR_MAIN_CTRL "Graphics_main"
+ #define PR_GR_MAIN_CTRL_S PR_TSS_S
+ #define PR_GR_MAIN_CTRL PR_TSS
+
+ #define TN_GR_SEQ_CTRL "Graphics_seq"
+ #define PR_GR_SEQ_CTRL_S PR_TSS_S
+ #define PR_GR_SEQ_CTRL PR_TSS
+
+ #define TN_GR_DEV_RCV_CTRL "Graphics_rcv"
+ #define PR_GR_DEV_RCV_CTRL_S PR_TSS_S
+ #define PR_GR_DEV_RCV_CTRL PR_TSS
+
+ #define TN_GR_VCAP1_CTRL "Graphics_cap1"
+ #define PR_GR_VCAP1_CTRL_S "0"
+ #define PR_GR_VCAP1_CTRL (0)
+
+ #define TN_GR_VCAP2_CTRL "Graphics_cap2"
+ #define PR_GR_VCAP2_CTRL_S "0"
+ #define PR_GR_VCAP2_CTRL (0)
+
+#define MN_VUPSERVICE "vupservice"
+#define PR_VUPSERVICE_S PR_TSS_S
+#define PR_VUPSERVICE PR_TSS
+
+#define MN_SS_UPDATESERVICE "UpdateService"
+#define PR_SS_UPDATESERVICE_S PR_TSS_S
+#define PR_SS_UPDATESERVICE PR_TSS
+
+ #define TN_UPSERVICE_VERI "t_update_veri"
+ #define PR_UPSERVICE_VERI_S PR_TSS_S
+ #define PR_UPSERVICE_VERI PR_TSS
+
+#define MN_NW_MICSERVICE "NW_MicService"
+#define PR_NW_MICSERVICE_S PR_TSS_S
+#define PR_NW_MICSERVICE PR_TSS
+
+#define MN_NS_LOCKMGR "LockMgr"
+#define PR_NS_LOCKMGR_S PR_TSS_S
+#define PR_NS_LOCKMGR PR_TSS
+
+#define MN_PS_SWITCHHANDLER "SwitchHandler"
+#define PR_PS_SWITCHHANDLER_S "0"
+#define PR_PS_SWITCHHANDLER (0)
+
+#define MN_SS_WINSYS "SS_WinSys"
+#define PR_SS_WINSYS_S "0"
+#define PR_SS_WINSYS 0
+
+#define MN_MODEMANAGER "modemanager"
+#define PR_MODEMANAGER_S PR_TSS_S
+#define PR_MODEMANAGER PR_TSS
+
+#define MN_BTSTACKMAIN "btstackmain"
+#define PR_BTSTACKMAIN_S PR_TSS_S
+#define PR_BTSTACKMAIN PR_TSS
+
+#define MN_MEDIASERVICE "MediaService"
+#define PR_MEDIASERVICE_S PR_TSS_S
+#define PR_MEDIASERVICE PR_TSS
+
+// REPRO START
+#define MN_REPROSERVICE "ReproService"
+#define PR_REPROSERVICE_S PR_TSS_S
+#define PR_REPROSERVICE PR_TSS
+
+ #define TN_REPROSEQUENCER "RPRS_Sequencer"
+ #define PR_REPROSEQUENCER_S PR_TSS_S
+ #define PR_REPROSEQUENCER PR_TSS
+
+ #define TN_REPROCTRL "RPRS_Control"
+ #define PR_REPROCTRL_S PR_TSS_S
+ #define PR_REPROCTRL PR_TSS
+
+ #define TN_REPROCENTERCOMM "RPRS_CenterComm"
+ #define PR_REPROCENTERCOMM_S PR_TSS_S
+ #define PR_REPROCENTERCOMM PR_TSS
+
+ #define TN_REPROUNITCOMM "RPRS_UnitComm"
+ #define PR_REPROUNITCOMM_S PR_TSS_S
+ #define PR_REPROUNITCOMM PR_TSS
+
+ #define TN_REPROWEBDAVMGR "RPRS_WebDAVMgr"
+ #define PR_REPROWEBDAVMGR_S PR_TSS_S
+ #define PR_REPROWEBDAVMGR PR_TSS
+
+#define MN_REPROAENDTEST "Repro_Testpro_Sender"
+#define PR_REPROAENDTEST_S PR_TSS_S
+#define PR_REPROAENDTEST PR_TSS
+
+ #define TN_REPROAENDTESTTN "Repro_TestproT"
+ #define PR_REPROAENDTESTTN_S PR_TSS_S
+ #define PR_REPROAENDTESTTN PR_TSS
+
+#define MN_REPROBACKVUP "BackVupCtrl"
+#define PR_REPROBACKVUP_S PR_TSS_S
+#define PR_REPROBACKVUP PR_TSS
+
+#define MN_REPRODEVELOP "DevReproService"
+#define PR_REPRODEVELOP_S PR_TSS_S
+#define PR_REPRODEVELOP PR_TSS
+// REPRO END
+
+ #define TN_MED_MMCOM_PLAY "mmcom_play"
+ #define PR_MED_MMCOM_PLAY_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAY PR_TSS
+
+ #define TN_MED_MMCOM_MEDIA "mmcom_media"
+ #define PR_MED_MMCOM_MEDIA_S PR_TSS_S
+ #define PR_MED_MMCOM_MEDIA PR_TSS
+
+ #define TN_MED_MMCOM_DB "mmcom_db"
+ #define PR_MED_MMCOM_DB_S PR_TSS_S
+ #define PR_MED_MMCOM_DB PR_TSS
+
+ #define TN_MED_MMCOM_LIST "mmcom_list"
+ #define PR_MED_MMCOM_LIST_S PR_TSS_S
+ #define PR_MED_MMCOM_LIST PR_TSS
+
+ #define TN_MED_MMCOM_DBUSB "mmcom_dbusb"
+ #define PR_MED_MMCOM_DBUSB_S PR_TSS_S
+ #define PR_MED_MMCOM_DBUSB PR_TSS
+
+ #define TN_MED_MMCOM_DBSD "mmcom_dbsd"
+ #define PR_MED_MMCOM_DBSD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBSD PR_TSS
+
+ #define TN_MED_MMCOM_DBCD "mmcom_dbcd"
+ #define PR_MED_MMCOM_DBCD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBCD PR_TSS
+
+ #define TN_MED_MMCOM_PLAYRCV "mmcom_playrcv"
+ #define PR_MED_MMCOM_PLAYRCV_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAYRCV PR_TSS
+
+ #define TN_MED_RIPCOM_MNG "MngRipComm"
+ #define PR_MED_RIPCOM_MNG_S PR_TSS_S
+ #define PR_MED_RIPCOM_MNG PR_TSS
+
+ #define TN_MED_RIPCOM_EXE01 "ExeRipComm01"
+ #define PR_MED_RIPCOM_EXE01_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE01 PR_TSS
+
+ #define TN_MED_RIPCOM_EXE02 "ExeRipComm02"
+ #define PR_MED_RIPCOM_EXE02_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE02 PR_TSS
+
+ #define TN_MED_DISCCOM_MAIN "disccom_main"
+ #define PR_MED_DISCCOM_MAIN_S PR_TSS_S
+ #define PR_MED_DISCCOM_MAIN PR_TSS
+
+ #define TN_MED_DISCCOM_DB "disccom_db"
+ #define PR_MED_DISCCOM_DB_S PR_TSS_S
+ #define PR_MED_DISCCOM_DB PR_TSS
+
+#define MN_PLAYBACKSERVICE "PlaybackService"
+#define PR_PLAYBACKSERVICE_S PR_TSS_S
+#define PR_PLAYBACKSERVICE PR_TSS
+
+ #define TN_PLAYSRV_AUDIO "playsrv_audio"
+ #define PR_PLAYSRV_AUDIO_S PR_TSS_S
+ #define PR_PLAYSRV_AUDIO PR_TSS
+
+ #define TN_PLAYSRV_RIP "playsrv_rip"
+ #define PR_PLAYSRV_RIP_S PR_TSS_S
+ #define PR_PLAYSRV_RIP PR_TSS
+
+ #define TN_PLAYSRV_PLAY "playsrv_play"
+ #define PR_PLAYSRV_PLAY_S PR_TSS_S
+ #define PR_PLAYSRV_PLAY PR_TSS
+
+ #define TN_PLAYSRV_DISC "playsrv_disc"
+ #define PR_PLAYSRV_DISC_S PR_TSS_S
+ #define PR_PLAYSRV_DISC PR_TSS
+
+ #define TN_PLAYSRV_ARTWORK "playsrv_artwork"
+ #define PR_PLAYSRV_ARTWORK_S PR_TSS_S
+ #define PR_PLAYSRV_ARTWORK PR_TSS
+
+#define MN_DISCSERVICE "DiscService"
+#define PR_DISCSERVICE_S PR_TSS_S
+#define PR_DISCSERVICE PR_TSS
+
+#define MN_RADIOSERVICE "RadioService"
+#define PR_RADIOSERVICE_S PR_TSS_S
+#define PR_RADIOSERVICE PR_TSS
+
+#define MN_RADIOHDARBITER "RadioHDArbiter"
+#define PR_RADIOHDARBITER_S "0"
+#define PR_RADIOHDARBITER (0)
+
+#define MN_HRDS_MANAGER "hrds_manager"
+#define PR_HRDS_MANAGER_S PR_TSS_S
+#define PR_HRDS_MANAGER PR_TSS
+
+ #define TN_HRDS_HDMNG "hrds_hdmng"
+ #define PR_HRDS_HDMNG_S PR_TSS_S
+ #define PR_HRDS_HDMNG PR_TSS
+
+ #define TN_HRDS_HDDEC "hrds_hddec"
+ #define PR_HRDS_HDDEC_S PR_TSS_S
+ #define PR_HRDS_HDDEC PR_TSS
+
+ #define TN_HRDS_WEBMNG "hrds_webmng"
+ #define PR_HRDS_WEBMNG_S PR_TSS_S
+ #define PR_HRDS_WEBMNG PR_TSS
+
+ #define TN_HRDS_WEBCOM "hrds_webcom"
+ #define PR_HRDS_WEBCOM_S PR_TSS_S
+ #define PR_HRDS_WEBCOM PR_TSS
+
+#define MN_BT_CONNECTIONSERVICE "BT_CnctSrv"
+#define PR_BT_CONNECTIONSERVICE_S PR_TSS_S
+#define PR_BT_CONNECTIONSERVICE PR_TSS
+
+#define MN_BT_PHONESERVICE "BT_PhoneSrv"
+#define PR_BT_PHONESERVICE_S PR_TSS_S
+#define PR_BT_PHONESERVICE PR_TSS
+
+#define MN_BT_PHONEBOOKSERVICE "BT_PbkSrv"
+#define PR_BT_PHONEBOOKSERVICE_S PR_TSS_S
+#define PR_BT_PHONEBOOKSERVICE PR_TSS
+
+#define MN_BT_MESSAGINGSERVICE "BT_MsgSrv"
+#define PR_BT_MESSAGINGSERVICE_S PR_TSS_S
+#define PR_BT_MESSAGINGSERVICE PR_TSS
+
+#define MN_BT_BLLSERVICE "TEL_BLLSrv"
+#define PR_BT_BLLSERVICE_S PR_TSS_S
+#define PR_BT_BLLSERVICE PR_TSS
+
+#define MN_BT_DCMPHONESERVICE "DCM_PhoneSrv"
+#define PR_BT_DCMPHONESERVICE_S PR_TSS_S
+#define PR_BT_DCMPHONESERVICE PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ1 "HFPMultiQ1"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1 PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ2 "HFPMultiQ2"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2 PR_TSS
+
+ #define TN_BT_PBKSRV_DATABASE "BTPB_Database"
+ #define PR_TN_BT_PBKSRV_DATABASE_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_DATABASE PR_TSS
+
+ #define TN_BT_PBKSRV_LOCALPBINST "LocalPBINST"
+ #define PR_TN_BT_PBKSRV_LOCALPBINST_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_LOCALPBINST PR_TSS
+
+ #define TN_BT_PBKSRV_RESOLVENAME "ResolveName"
+ #define PR_TN_BT_PBKSRV_RESOLVENAME_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_RESOLVENAME PR_TSS
+
+ #define TN_BT_PBKSRV_PBAPMULTIQ1 "PBAPMultiQ1"
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1 PR_TSS
+
+ #define TN_BT_PBKSRV_OPPMULTI "OPPMulti"
+ #define PR_TN_BT_PBKSRV_OPPMULTI_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_OPPMULTI PR_TSS
+
+ #define TN_BT_PBKSRV_VCARDPARSER "VCardParser"
+ #define PR_TN_BT_PBKSRV_VCARDPARSER_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_VCARDPARSER PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD0 "MsgCntrlThread0"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0 PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD1 "MsgCntrlThread1"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1 PR_TSS
+
+ #define TN_BT_MSGSRV_MAPMULTI "MapMulti"
+ #define PR_TN_BT_MSGSRV_MAPMULTI_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MAPMULTI PR_TSS
+
+#define MN_DTVSERVICE "DtvService"
+#define PR_DTVSERVICE_S PR_TSS_S
+#define PR_DTVSERVICE PR_TSS
+
+ #define TN_DTVTNC_TX "dtvtnc_tx"
+ #define PR_DTVTNC_TX_S PR_TSS_S
+ #define PR_DTVTNC_TX PR_TSS
+
+ #define TN_DTVTNC_RCV "dtvtnc_rcv"
+ #define PR_DTVTNC_RCV_S PR_TSS_S
+ #define PR_DTVTNC_RCV PR_TSS
+
+ #define TN_DTVTNC_TIMER "dtvtnc_timer"
+ #define PR_DTVTNC_TIMER_S PR_TSS_S
+ #define PR_DTVTNC_TIMER PR_TSS
+
+ #define TN_DTVTNC_CTL "dtvtnc_ctl"
+ #define PR_DTVTNC_CTL_S PR_TSS_S
+ #define PR_DTVTNC_CTL PR_TSS
+
+#define MN_DTVVUPSERVICE "DtvVupService"
+#define PR_DTVVUPSERVICE_S PR_TSS_S
+#define PR_DTVVUPSERVICE PR_TSS
+
+#define MN_SETTINGSERVICE "SettingService"
+#define PR_SETTINGSERVICE_S PR_TSS_S
+#define PR_SETTINGSERVICE PR_TSS
+
+#define MN_INFOSETTINGSRV "InfoSettingSrv"
+#define PR_INFOSETTINGSRV_S PR_TSS_S
+#define PR_INFOSETTINGSRV PR_TSS
+
+ #define TN_INFS_UIC "infs_uic"
+ #define PR_INFS_UIC_S PR_TSS_S
+ #define PR_INFS_UIC PR_TSS
+
+#define MN_DELPERSONALSRV "DelPersonalSrv"
+#define PR_DELPERSONALSRV_S PR_TSS_S
+#define PR_DELPERSONALSRV PR_TSS
+
+#define MN_MENUSERVICE "MenuService"
+#define PR_MENUSERVICE_S PR_TSS_S
+#define PR_MENUSERVICE PR_TSS
+
+#define MN_NAVIPROXY "NaviProxy"
+#define PR_NAVIPROXY_S PR_TSS_S
+#define PR_NAVIPROXY PR_TSS
+
+#define MN_AWBPROXY "AwbProxy"
+#define PR_AWBPROXY_S PR_TSS_S
+#define PR_AWBPROXY PR_TSS
+
+#define MN_TFFPROXY "TFFProxy"
+#define PR_TFFPROXY_S PR_TSS_S
+#define PR_TFFPROXY PR_TSS
+
+#define MN_TFFPROXYSLAVE "TFFProxySlave"
+#define PR_TFFPROXYSLAVE_S PR_TSS_S
+#define PR_TFFPROXYSLAVE PR_TSS
+
+#define MN_AWNPRIMARY "AwnPrimary"
+#define PR_AWNPRIMARY_S PR_TSS_S
+#define PR_AWNPRIMARY PR_TSS
+
+#define MN_AWBPRIMARY "AwbPrimary"
+#define PR_AWBPRIMARY_S PR_TSS_S
+#define PR_AWBPRIMARY PR_TSS
+
+#define MN_AWMPRIMARY "AwmPrimary"
+#define PR_AWMPRIMARY_S PR_TSS_S
+#define PR_AWMPRIMARY PR_TSS
+
+#define MN_AWTPRIMARY "AwtPrimary"
+#define PR_AWTPRIMARY_S PR_TSS_S
+#define PR_AWTPRIMARY PR_TSS
+
+#define MN_MISINKSERVICE "MisinkService"
+#define PR_MISINKSERVICE_S PR_TSS_S
+#define PR_MISINKSERVICE PR_TSS
+
+#define MN_TEXTCONVERTER "TextConverter"
+#define PR_TEXTCONVERTER_S PR_TSS_S
+#define PR_TEXTCONVERTER PR_TSS
+
+#define MN_HANDWRITING "HandWriting"
+#define PR_HANDWRITING_S PR_TSS_S
+#define PR_HANDWRITING PR_TSS
+
+#define MN_EXTUNITAUTH_D "EXTUNITAUTH_D"
+#define PR_EXTUNITAUTH_D_S "0"
+#define PR_EXTUNITAUTH_D 0
+
+ #define TN_VPSVC__CWORD84_ "VPSVC_D"
+ #define PR_VPSVC__CWORD84__S PR_TSS_S
+ #define PR_VPSVC__CWORD84_ PR_TSS
+
+#define MN_PROXYSERVICE "ProxyService"
+#define PR_PROXYSERVICE_S PR_TSS_S
+#define PR_PROXYSERVICE PR_TSS
+
+#define MN_FUELSERVICE "VS_FUCSrv"
+#define PR_FUELSERVICE_S PR_TSS_S
+#define PR_FUELSERVICE PR_TSS
+
+#define MN_ENERGYSERVICE "VS_ENMSrv"
+#define PR_ENERGYSERVICE_S PR_TSS_S
+#define PR_ENERGYSERVICE PR_TSS
+
+#define MN_CUSTOMIZESERVICE "VS_VSDSrv"
+#define PR_CUSTOMIZESERVICE_S PR_TSS_S
+#define PR_CUSTOMIZESERVICE PR_TSS
+
+#define MN_DMSSERVICE "VS_DMSSrv"
+#define PR_DMSSERVICE_S PR_TSS_S
+#define PR_DMSSERVICE PR_TSS
+
+#define MN_AIRCONSERVICE "VS_ACNSrv"
+#define PR_AIRCONSERVICE_S PR_TSS_S
+#define PR_AIRCONSERVICE PR_TSS
+
+#define MN_SEATSERVICE "VS_NMSSrv"
+#define PR_SEATSERVICE_S PR_TSS_S
+#define PR_SEATSERVICE PR_TSS
+
+#define MN_CAMERASERVICE "VS_CMRSrv"
+#define PR_CAMERASERVICE_S PR_TSS_S
+#define PR_CAMERASERVICE PR_TSS
+
+ #define TN_CAMERAQUICKRVC "QuickRVCThread"
+ #define PR_CAMERAQUICKRVC_S PR_TSS_S
+ #define PR_CAMERAQUICKRVC PR_TSS
+
+#define MN_METSERVICE "VS_METSrv"
+#define PR_METSERVICE_S PR_TSS_S
+#define PR_METSERVICE PR_TSS
+
+#define MN_TMCSERVICE "VS_TMCSrv"
+#define PR_TMCSERVICE_S PR_TSS_S
+#define PR_TMCSERVICE PR_TSS
+
+#define MN_DASSERVICE "VS_DASSrv"
+#define PR_DASSERVICE_S PR_TSS_S
+#define PR_DASSERVICE PR_TSS
+
+#define MN_EXTUNITAUTH_M "EXTUNITAUTH_M"
+#define PR_EXTUNITAUTH_M_S "0"
+#define PR_EXTUNITAUTH_M 0
+
+#define MN_DUMMYREAD "DummyRead"
+#define PR_DUMMYREAD_S PR_TSS_S
+#define PR_DUMMYREAD PR_TSS
+
+#define MN_SSTSERVICE "storage_access"
+#define PR_SSTSERVICE_S PR_TSS_S
+#define PR_SSTSERVICE PR_TSS
+
+#define MN_CCSAUDITD "ccs-auditd"
+#define PR_CCSAUDITD_S PR_TSS_S
+#define PR_CCSAUDITD PR_TSS
+
+//exec from task manager
+#define MN_ACTIVITYMANAGER "ActivityManager"
+#define PR_ACTIVITYMANAGER_S PR_TSS_S
+#define PR_ACTIVITYMANAGER PR_TSS
+
+#define MN_RESIDENT_SVC "RESIDENT_SVC"
+#define PR_RESIDENT_SVC_S PR_TSS_S
+#define PR_RESIDENT_SVC PR_TSS
+
+#define MN_TRANSIENT_SVC "TRANSIENT_SVC"
+#define PR_TRANSIENT_SVC_S PR_TSS_S
+#define PR_TRANSIENT_SVC PR_TSS
+
+#define MN_WLANSERVICE "wlan_ctrl_0700"
+#define PR_WLANSERVICE_S PR_TSS_S
+#define PR_WLANSERVICE PR_TSS
+
+#define MN_WLANEVTTHR "WlanEvtThr"
+#define PR_WLANEVTTHR_S PR_TSS_S
+#define PR_WLANEVTTHR PR_TSS
+
+#define MN_WLANMIDDLESERVICE "WlanMiddle"
+#define PR_WLANMIDDLESERVICE_S PR_TSS_S
+#define PR_WLANMIDDLESERVICE PR_TSS
+
+ #define TN_WLANMIDDLESERVICE0 "WM_MsgCtrlTh0"
+ #define PR_WLANMIDDLESERVICE0_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE0 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE1 "WM_MsgCtrlTh1"
+ #define PR_WLANMIDDLESERVICE1_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE1 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE2 "WM_MsgCtrlTh2"
+ #define PR_WLANMIDDLESERVICE2_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE2 PR_TSS
+
+#define MN_WLANSERVICE2 "wlan_ctrl_0701"
+#define PR_WLANSERVICE2_S PR_TSS_S
+#define PR_WLANSERVICE2 PR_TSS
+
+#define MN_WLANEVTTHR2 "WlanEvtThr2"
+#define PR_WLANEVTTHR2_S PR_TSS_S
+#define PR_WLANEVTTHR2 PR_TSS
+
+//exec from task manager, Test for vup
+#define MN_PS__CWORD52_VUP "_CWORD52_vup"
+#define PR_PS__CWORD52_VUP_S PR_TSS_S
+#define PR_PS__CWORD52_VUP PR_TSS
+
+#define MN_PS_SYSVUP "sysvup"
+#define PR_PS_SYSVUP_S PR_TSS_S
+#define PR_PS_SYSVUP PR_TSS
+
+#define MN_SS_ROOTFSVUP "rootfsvup"
+#define PR_SS_ROOTFSVUP_S PR_TSS_S
+#define PR_SS_ROOTFSVUP PR_TSS
+
+#define MN_SS_VUPPROGUI "vupprogressui"
+#define PR_SS_VUPPROGUI_S PR_TSS_S
+#define PR_SS_VUPPROGUI PR_TSS
+
+#define MN_SS_NORVUP "norvup"
+#define PR_SS_NORVUP_S PR_TSS_S
+#define PR_SS_NORVUP PR_TSS
+
+// OUTER_UPDATE START
+#define MN_XMVUPSERVICE "radio_xm_update"
+#define PR_XMVUPSERVICE_S PR_TSS_S
+#define PR_XMVUPSERVICE PR_TSS
+// OUTER_UPDATE END
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+// NON-resident, exec from task manager, Repro update
+#define MN_PS_SYSUPDATE "sysupdate"
+#define PR_PS_SYSUPDATE_S PR_TSS_S
+#define PR_PS_SYSUPDATE PR_TSS
+
+#define MN_SS_NANDUPDATE "nandupdate"
+#define PR_SS_NANDUPDATE_S PR_TSS_S
+#define PR_SS_NANDUPDATE PR_TSS
+
+ #define TN_NANDUPDATE_CLD "t_nandcld"
+ #define PR_NANDUPDATE_CLD_S PR_TSS_S
+ #define PR_NANDUPDATE_CLD PR_TSS
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+//exec from diag
+#define MN_DIAGSERVICE "DiagService"
+#define PR_DIAGSERVICE_S PR_TSS_S
+#define PR_DIAGSERVICE PR_TSS
+
+#define MN_DIAGWORKERTSK "diagworker_tsk"
+#define PR_DIAGWORKERTSK_S PR_TSS_S
+#define PR_DIAGWORKERTSK PR_TSS
+
+#define MN_DIAGTSK "diag_tsk"
+#define PR_DIAGTSK_S PR_TSS_S
+#define PR_DIAGTSK PR_TSS
+
+#define MN_DIAGMCTSK "diagmc_tsk"
+#define PR_DIAGMCTSK_S PR_TSS_S
+#define PR_DIAGMCTSK PR_TSS
+
+#define MN_DIAGUTCOL "diagutCol_tsk"
+#define PR_DIAGUTCOL_S PR_TSS_S
+#define PR_DIAGUTCOL PR_TSS
+
+#define MN_DIAGUTUPD "diagutUpd_tsk"
+#define PR_DIAGUTUPD_S PR_TSS_S
+#define PR_DIAGUTUPD PR_TSS
+
+//exec from Connectivity for _CWORD57_
+#define MN__CWORD57_UTILSERVICE "_CWORD57_UtilService"
+#define PR__CWORD57_UTILSERVICE_S PR_TSS_S
+#define PR__CWORD57_UTILSERVICE PR_TSS
+
+ #define TN_CON_IPUT_DETECT "iputsrv_detect"
+ #define PR_CON_IPUT_DETECT_S PR_TSS_S
+ #define PR_CON_IPUT_DETECT PR_TSS
+
+ #define TN_CON_IPUT_AUTH "iputsrv_auth"
+ #define PR_CON_IPUT_AUTH_S PR_TSS_S
+ #define PR_CON_IPUT_AUTH PR_TSS
+
+ #define TN_CON_IPUT_SERIAL "iputsrv_serial"
+ #define PR_CON_IPUT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPUT_SERIAL PR_TSS
+
+ #define TN_CON_IPUT_USB_1 "iputsrv_usb1"
+ #define PR_CON_IPUT_USB_1_S PR_TSS_S
+ #define PR_CON_IPUT_USB_1 PR_TSS
+
+ #define TN_CON_IPUT_USB_2 "iputsrv_usb2"
+ #define PR_CON_IPUT_USB_2_S PR_TSS_S
+ #define PR_CON_IPUT_USB_2 PR_TSS
+
+ #define TN_CON_IPUT_SPP "iputsrv_spp"
+ #define PR_CON_IPUT_SPP_S PR_TSS_S
+ #define PR_CON_IPUT_SPP PR_TSS
+
+#define MN__CWORD57_DTSERVICE "_CWORD57_DTService"
+#define PR__CWORD57_DTSERVICE_S PR_TSS_S
+#define PR__CWORD57_DTSERVICE PR_TSS
+
+ #define TN_CON_IPDT_SERIAL "ipdtsrv_serial"
+ #define PR_CON_IPDT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPDT_SERIAL PR_TSS
+
+ #define TN_CON_IPDT_USB_1 "ipdtsrv_usb1"
+ #define PR_CON_IPDT_USB_1_S PR_TSS_S
+ #define PR_CON_IPDT_USB_1 PR_TSS
+
+ #define TN_CON_IPDT_USB_2 "ipdtsrv_usb2"
+ #define PR_CON_IPDT_USB_2_S PR_TSS_S
+ #define PR_CON_IPDT_USB_2 PR_TSS
+
+ #define TN_CON_IPDT_SPP "ipdtsrv_spp"
+ #define PR_CON_IPDT_SPP_S PR_TSS_S
+ #define PR_CON_IPDT_SPP PR_TSS
+
+#define MN_WEBDAVMGR "webdavmgr"
+#define PR_WEBDAVMGR_S PR_TSS_S
+#define PR_WEBDAVMGR PR_TSS
+
+#define MN_DISPLAYSERVICE "DisplayService"
+#define PR_DISPLAYSERVICE_S PR_TSS_S
+#define PR_DISPLAYSERVICE PR_TSS
+
+#define MN_ENFORMSERVICE "EnformService"
+#define PR_ENFORMSERVICE_S PR_TSS_S
+#define PR_ENFORMSERVICE PR_TSS
+
+#define MN_CONNUTIL "ConnUtil"
+#define PR_CONNUTIL_S PR_TSS_S
+#define PR_CONNUTIL PR_TSS
+
+#define MN_CONNUTILSLAVE "ConnUtilSlave"
+#define PR_CONNUTILSLAVE_S PR_TSS_S
+#define PR_CONNUTILSLAVE PR_TSS
+
+#define MN_CONNMGR "ConnMgr"
+#define PR_CONNMGR_S PR_TSS_S
+#define PR_CONNMGR PR_TSS
+
+#define MN_SERVICEFLAGMGR "ServiceFlagMgr"
+#define PR_SERVICEFLAGMGR_S PR_TSS_S
+#define PR_SERVICEFLAGMGR PR_TSS
+
+//exec from VR
+#define MN_VRMANAGER "vrmanager"
+#define PR_VRMANAGER_S PR_TSS_S
+#define PR_VRMANAGER PR_TSS
+
+ #define TN_VR_WORKER "VrWorkerThread"
+ #define PR_VR_WORKER_S PR_TSS_S
+ #define PR_VR_WORKER PR_TSS
+
+ #define TN_VBT_PROPDISPATCH "PropDispatchThread"
+ #define PR_VBT_PROPDISPATCH_S PR_TSS_S
+ #define PR_VBT_PROPDISPATCH PR_TSS
+
+ #define TN_VBT_PROPRESPONSE "PropResponseThread"
+ #define PR_VBT_PROPRESPONSE_S PR_TSS_S
+ #define PR_VBT_PROPRESPONSE PR_TSS
+
+ #define TN_VBT_PROPAUDIOPLAY "PropAudioPlayThread"
+ #define PR_VBT_PROPAUDIOPLAY_S PR_TSS_S
+ #define PR_VBT_PROPAUDIOPLAY PR_TSS
+
+ #define TN_VBT_PROPAUDIORECORD "PropAudioRecordThread"
+ #define PR_VBT_PROPAUDIORECORD_S PR_TSS_S
+ #define PR_VBT_PROPAUDIORECORD PR_TSS
+
+ #define TN_VBT_MAINTHREADPRIO "MainThreadPriority"
+ #define PR_VBT_MAINTHREADPRIO_S PR_TSS_S
+ #define PR_VBT_MAINTHREADPRIO PR_TSS
+
+ #define TN_VBT_ASRMANAGERGRAMMAR "AsrManagerGrammarGenerationThread"
+ #define PR_VBT_ASRMANAGERGRAMMAR_S PR_TSS_S
+ #define PR_VBT_ASRMANAGERGRAMMAR PR_TSS
+
+ #define TN_VBT_ASRVOCONRECO "AsrVoconRecoProcessThread"
+ #define PR_VBT_ASRVOCONRECO_S PR_TSS_S
+ #define PR_VBT_ASRVOCONRECO PR_TSS
+
+ #define TN_VBT_BROADCASTREAD "BroadCastReadThread"
+ #define PR_VBT_BROADCASTREAD_S PR_TSS_S
+ #define PR_VBT_BROADCASTREAD PR_TSS
+
+ #define TN_VBT_FILEAGGREGATOR "FileAggregatorDecompressThread"
+ #define PR_VBT_FILEAGGREGATOR_S PR_TSS_S
+ #define PR_VBT_FILEAGGREGATOR PR_TSS
+
+ #define TN_VBT_HTTPCURLREQUEST "HttpCurlRequestThread"
+ #define PR_VBT_HTTPCURLREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPCURLREQUEST PR_TSS
+
+ #define TN_VBT_HTTPDRIVERREQUEST "HttpDriverRequestThread"
+ #define PR_VBT_HTTPDRIVERREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPDRIVERREQUEST PR_TSS
+
+ #define TN_VBT_HTTPREQUESTSESSION "HttpRequestSessionStateThread"
+ #define PR_VBT_HTTPREQUESTSESSION_S PR_TSS_S
+ #define PR_VBT_HTTPREQUESTSESSION PR_TSS
+
+ #define TN_VBT_PLAYMGRSTOPASYNC "PlayMgrStopAsyncStreamThread"
+ #define PR_VBT_PLAYMGRSTOPASYNC_S PR_TSS_S
+ #define PR_VBT_PLAYMGRSTOPASYNC PR_TSS
+
+ #define TN_VBT_RESOURCEMGRQUEUE "ResourceMgrQueueHandlerThread"
+ #define PR_VBT_RESOURCEMGRQUEUE_S PR_TSS_S
+ #define PR_VBT_RESOURCEMGRQUEUE PR_TSS
+
+ #define TN_VBT_SMURFDRIVERTIMEOUT "SmurfDriverTimeoutThread"
+ #define PR_VBT_SMURFDRIVERTIMEOUT_S PR_TSS_S
+ #define PR_VBT_SMURFDRIVERTIMEOUT PR_TSS
+
+ #define TN_NVR_NVRMAIN "NvrMainThread"
+ #define PR_NVR_NVRMAIN_S PR_TSS_S
+ #define PR_NVR_NVRMAIN PR_TSS
+
+ #define TN_NVR_NVRRECO "NvrRecoThread"
+ #define PR_NVR_NVRRECO_S PR_TSS_S
+ #define PR_NVR_NVRRECO PR_TSS
+
+ #define TN_NVR_NVRDICT "NvrDictThread"
+ #define PR_NVR_NVRDICT_S PR_TSS_S
+ #define PR_NVR_NVRDICT PR_TSS
+
+ #define TN_NVR_NVRENC "NvrEncThread"
+ #define PR_NVR_NVRENC_S PR_TSS_S
+ #define PR_NVR_NVRENC PR_TSS
+
+//exec from VehicleInfo
+#define MN_VEHICLEINFOSERVICE "VehicleInfoSrv"
+#define PR_VEHICLEINFOSERVICE_S PR_TSS_S
+#define PR_VEHICLEINFOSERVICE PR_TSS
+
+//exec from _CWORD58_
+#define MN__CWORD58_SERVICE "_CWORD58_Service"
+#define PR__CWORD58_SERVICE_S PR_TSS_S
+#define PR__CWORD58_SERVICE PR_TSS
+
+#define MN__CWORD8_SRV "_CWORD8_Srv"
+#define PR__CWORD8_SRV_S PR_TSS_S
+#define PR__CWORD8_SRV PR_TSS
+
+#define MN_SPCSERVICE "SPCService"
+#define PR_SPCSERVICE_S PR_TSS_S
+#define PR_SPCSERVICE PR_TSS
+
+#define MN_LOCALSERVERPROXY "LSP"
+#define PR_LOCALSERVERPROXY_S PR_TSS_S
+#define PR_LOCALSERVERPROXY PR_TSS
+
+#define MN_EOMSERVICE "eOMService"
+#define PR_EOMSERVICE_S PR_TSS_S
+#define PR_EOMSERVICE PR_TSS
+
+//exec from _CWORD89_
+#define MN__CWORD89_SERVICE "_CWORD89_Service"
+#define PR__CWORD89_SERVICE_S PR_TSS_S
+#define PR__CWORD89_SERVICE PR_TSS
+
+//exec from NetworkManager
+#define MN_NETWORKMANAGER "NetworkManager"
+#define PR_NETWORKMANAGER_S PR_TSS_S
+#define PR_NETWORKMANAGER PR_TSS
+
+ #define TN_NWM_TH_CMDRCV "NWM_Th_CmdRcv"
+ #define PR_NWM_TH_CMDRCV_S PR_TSS_S
+ #define PR_NWM_TH_CMDRCV PR_TSS
+
+ #define TN_NWM_TH_PROCMGR "NWM_Th_ProcMgr"
+ #define PR_NWM_TH_PROCMGR_S PR_TSS_S
+ #define PR_NWM_TH_PROCMGR PR_TSS
+
+ #define TN_NWM_TH_CMDPROC "NWM_Th_CmdProc"
+ #define PR_NWM_TH_CMDPROC_S PR_TSS_S
+ #define PR_NWM_TH_CMDPROC PR_TSS
+
+ #define TN_NWM_TH_DNSMGR "NWM_Th_DnsMgr"
+ #define PR_NWM_TH_DNSMGR_S PR_TSS_S
+ #define PR_NWM_TH_DNSMGR PR_TSS
+
+ #define TN_NWM_TH_DHCPD "NWM_Th_Dhcpd"
+ #define PR_NWM_TH_DHCPD_S PR_TSS_S
+ #define PR_NWM_TH_DHCPD PR_TSS
+
+// DCM Service
+#define MN_DCMSERVICE "DCMService"
+#define PR_DCMSERVICE_S PR_TSS_S
+#define PR_DCMSERVICE PR_TSS
+
+ #define TN_DCM_TH_CMDRCV "DCM_Th_CmdRcv"
+ #define PR_DCM_TH_CMDRCV_S PR_TSS_S
+ #define PR_DCM_TH_CMDRCV PR_TSS
+
+ #define TN_DCM_TH_MSGRCV "DCM_Th_MsgRcv"
+ #define PR_DCM_TH_MSGRCV_S PR_TSS_S
+ #define PR_DCM_TH_MSGRCV PR_TSS
+
+ #define TN_DCM_TH_TIMER "DCM_Th_Timer"
+ #define PR_DCM_TH_TIMER_S PR_TSS_S
+ #define PR_DCM_TH_TIMER PR_TSS
+
+// HELP Service
+#define MN_HELPSERVICE "HELPService"
+#define PR_HELPSERVICE_S PR_TSS_S
+#define PR_HELPSERVICE PR_TSS
+
+//exec from RemoteService
+#define MN_REMOTESERVICE "RemoteService"
+#define PR_REMOTESERVICE_S PR_TSS_S
+#define PR_REMOTESERVICE PR_TSS
+
+ #define TN_RS_TH_CANCTRL "RS_Th_CANCtrl"
+ #define PR_RS_TH_CANCTRL_S PR_TSS_S
+ #define PR_RS_TH_CANCTRL PR_TSS
+
+ #define TN_RS_TH_DISPCTRL "RS_Th_DispCtrl"
+ #define PR_RS_TH_DISPCTRL_S PR_TSS_S
+ #define PR_RS_TH_DISPCTRL PR_TSS
+
+ #define TN_RS_TH_PARTSCTRL "RS_Th_PartsCtrl"
+ #define PR_RS_TH_PARTSCTRL_S PR_TSS_S
+ #define PR_RS_TH_PARTSCTRL PR_TSS
+
+ #define TN_RS_TH_HTTPPROC "RS_Th_HttpProc"
+ #define PR_RS_TH_HTTPPROC_S PR_TSS_S
+ #define PR_RS_TH_HTTPPROC PR_TSS
+
+//exec from VR
+#define MN_CONTENTSMGR "contentsmgr"
+#define PR_CONTENTSMGR_S PR_TSS_S
+#define PR_CONTENTSMGR PR_TSS
+
+ #define TN_CDB_CONTENDB "contendbThread"
+ #define PR_CDB_CONTENDB_S PR_TSS_S
+ #define PR_CDB_CONTENDB PR_TSS
+
+/* COMARB Service */
+#define MN_NW_COMARB "ComArbService"
+#define PR_NW_COMARB_S PR_TSS_S
+#define PR_NW_COMARB PR_TSS
+
+/* ASND_FRthread */
+#define MN_ASND_FRTH "ASND_FRthread"
+#define PR_ASND_FRTH_S PR_SND_VCETRFCTRL_S
+#define PR_ASND_FRTH PR_SND_VCETRFCTRL
+
+/* MLINK Service */
+#define MN_MLINKSERVICE "MlinkService"
+#define PR_MLINKSERVICE_S PR_TSS_S
+#define PR_MLINKSERVICE PR_TSS
+
+#define MN__CWORD74_SERVICE "_CWORD74_Service"
+#define PR__CWORD74_SERVICE_S PR_TSS_S
+#define PR__CWORD74_SERVICE PR_TSS
+#endif //__AGL_THREAD_H__
diff --git a/agl-basefiles/share/agl.mk b/agl-basefiles/share/agl.mk
new file mode 100644
index 0000000..77d4512
--- /dev/null
+++ b/agl-basefiles/share/agl.mk
@@ -0,0 +1,677 @@
+#
+# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#################################################################################
+#
+# MAKE VARIABLES
+#
+# (mandatory)
+# MAKETOP : pprosrc/root directory
+#
+# (optional)
+# COMPONENT_NAME : component name
+# INST_HEADERS : headers to install
+# INST_LIBS : libraries to install
+# INST_SHLIBS : shared libraries to install
+# NOINST_LIBS : libraries for local use
+# INST_PROGS : programs to install
+# INST_CONFBIN : conf_bin to install
+# RPC_API : RPC API definitions (without suffix)
+# IPC_API : IPC API definitions (without suffix)
+# xxx_SRCS : source files of program xxx (*.{c,S,cc})
+# libxxx_SRCS : source files of library libxxx (*.{c,S,cc})
+# xxx_PCOS : pre-compiled object files of program xxx (*.{o,os,a})
+# libxxx_PCOS : pre-compiled object files of library libxxx (*.{o,os,a})
+# SUBDIRS : sub directories
+# CLEAN_FILES : extra files to clean
+# CLEAN_DIRS : extra directoies to clean
+# UNINST_FILES : extra files to uninstall
+# CPPFLAGS : preprocess options (-I, -D, ...)
+# CFLAGS : C source compile options
+# CXXFLAGS : C++ source compile options
+# ASFLAGS : assembler source assemble options
+# LDFLAGS : link options (-L, ...)
+# LDLIBS : libraries to link (-lxxx)
+# ALL : targets to make
+# (default: install-header install-lib install-prog install-data)
+# xxx_SONAME : dummy library SONAME
+#
+# MAKE TARGETS
+#
+# all, test : for target in $(ALL); do $(MAKE) $$target; done
+# install-prog : install program
+# install-lib : install-shlib and intall-arlib
+# install-shlib : install shared libraries
+# install-arlib : install static libraries
+# install-test-mock-lib : install mock libraries
+# install-test-mock-shlib : install shared mock libraries
+# install-test-mock-arlib : install static mock libraries
+# clean, clean-test : clean temporary files
+# clean-all, clean-all-test : clean temporary files and installed files
+# clean-self, clean-self-test : non-recursive clean
+#################################################################################
+
+
+ifneq ($(ADD_EXT),)
+ AEXT=.$(ADD_EXT)
+endif
+
+
+ifneq ($(strip $(filter $(MAKECMDGOALS),\
+ lint \
+ )),)
+endif
+
+ifneq ($(strip $(filter $(MAKECMDGOALS),\
+ )),)
+endif
+
+
+#################################################################################
+SYSROOT ?= $(SDKTARGETSYSROOT)
+DESTDIR ?= $(SDKTARGETSYSROOT)
+
+WARN_FLAGS ?= -Wall
+DEBUG_FLAGS ?= -g
+
+AUTO_INCLUDE := -include $(SYSROOT)/usr/agl/include/agl_types_obsoluted.h
+AGLCFLAGS := $(CFLAGS) $(COMPONENT_CFLAGS)
+AGLCXXFLAGS := $(CXXFLAGS) $(COMPONENT_CXXFLAGS)
+AGLCPPFLAGS := $(CPPFLAGS) $(COMPONENT_CPPFLAGS)
+AGLASFLAGS := $(ASFLAGS)
+AGLLDFLAGS := $(LDFLAGS) $(COMPONENT_LDFLAGS)
+AGLLDLIBS := $(LDLIBS) $(COMPONENT_LDLIBS)
+AGLARFLAGS := $(ARFLAGS)
+AGLPICFLAGS := -fPIC
+
+AGLCFLAGS += $(WARN_FLAGS) $(DEBUG_FLAGS) $(AUTO_INCLUDE)
+AGLCXXFLAGS += $(WARN_FLAGS) $(DEBUG_FLAGS) $(AUTO_INCLUDE)
+AGLASFLAGS += $(WARN_FLAGS) $(ARCH_FLAGS)
+
+
+ifdef LINK_CXX
+LINK := $(CXX)
+else
+LINK := $(CC)
+endif
+
+ifdef LINK_SHLIB_CXX
+LINK_SHLIB := $(CXX)
+else
+LINK_SHLIB := $(CC)
+endif
+
+ifdef DUMMY_SHLIB
+AGLLDFLAGS += -L.
+endif
+
+######### add gcov option ############
+
+
+
+define LINK_DUMMY
+if [ "$1" != "$3" ]; then \
+ echo "dummy lib ($1) created" ; \
+ $(LINK_SHLIB) -shared $(PIC_FLAGS) -Wl,-soname=$2 -o $1 -xc /dev/null ; \
+else \
+ echo "error: dummy lib must not have the same name as $3" ; \
+ exit 1 ; \
+fi ;
+endef
+
+define INST_DUMMY
+ @$(foreach lib,$(DUMMY_SHLIB),$(if $(lib),$(call LINK_DUMMY,$(lib),$(if $($(lib)_SONAME),$($(lib)_SONAME),$(lib)),$1)))
+endef
+
+define CLEAN_DUMMY
+ @$(foreach lib,$(DUMMY_SHLIB),$(if $(lib),rm -f $(lib)))
+endef
+
+define INSTALL_EXT
+@if [ "$(AEXT)" != "" ];then \
+ if echo "$(ADD_EXT)" | grep -q '^[A-Za-z]' ;then \
+ echo "$< -> $<$(AEXT)" ;\
+ mv $< $<$(AEXT) ;\
+ install -c -m 0755 $<$(AEXT) $@$(AEXT) ;\
+ if [ -f "$*.map" ];then \
+ mv $*.map $*.map$(AEXT) ;\
+ fi ;\
+ else \
+ echo "ADD_EXT : ERROR $(ADD_EXT)" ;\
+ exit 1 ;\
+ fi ;\
+fi
+endef
+
+
+define INSTALL_SCRIPT
+install -d -m 0755 $(@D)
+install -c -m 0755 $< $@
+endef
+
+define INSTALL_PIXMAP
+install -d -m 0755 $(@D)
+install -c -m 0644 $< $@
+endef
+
+define INSTALL_UCODE
+install -d -m 0755 $(@D)
+install -c -m 0644 $< $@
+endef
+
+define INSTALL_DATAINITOBJ
+if [ -n "$<" ]; then\
+ install -d -m 0755 $(@D);\
+ install -c -m 0644 $< $@;\
+fi;
+endef
+
+define INSTALL_OBJ
+install -d -m 0755 $(@D)
+install -c -m 0644 $< $@
+endef
+
+define INSTALL_CONFBIN
+if [ -n "$<" ]; then\
+ install -d -m 0755 $(@D);\
+ install -c -m 0644 $< $@;\
+fi;
+endef
+
+#################################################################################
+
+
+## for libc ##
+AGLCPPFLAGS += -D_GNU_SOURCE
+
+## for libPosixBased001Legacy
+AGLCPPFLAGS += -DAGL_PosixBasedOS001LEGACY_USED -DAGL_STUB -DLINUX
+
+## for agl header##
+AGLCPPFLAGS += -I$(SYSROOT)/usr/agl/include
+
+## for agl library##
+AGLLDFLAGS += -L$(SYSROOT)/usr/agl/lib
+
+ifneq ($(INST_SHLIBS),libagl_stub)
+AGLLDLIBS += -Wl,-Bdynamic -lpthread
+endif
+
+
+##########################################
+
+COMPONENT_NAME ?= $(error COMPONENT_NAME is not defined)
+AGL_TOPDIR ?= $(DESTDIR)/usr/agl
+AGL_INCDIR := $(AGL_TOPDIR)/include
+AGL_LIBDIR := $(AGL_TOPDIR)/lib
+AGL_BINDIR := $(AGL_TOPDIR)/bin
+AGL_PIXMAPDIR := $(AGL_TOPDIR)/pixmaps
+AGL_UCODEDIR := $(AGL_TOPDIR)/data/ucode
+
+#################################################################################
+
+HEADER_INSTALL_DIR := $(AGL_INCDIR)/$(COMPONENT_NAME)
+LIB_INSTALL_DIR := $(AGL_LIBDIR)
+PROG_INSTALL_DIR := $(AGL_BINDIR)
+PIXMAP_INSTALL_DIR := $(AGL_PIXMAPDIR)/$(COMPONENT_NAME)
+UCODE_INSTALL_DIR := $(AGL_UCODEDIR)
+DATAINITOBJ_INSTALL_DIR := $(AGL_DATAINITOBJDIR)
+CONFBIN_INSTALL_DIR := $(AGL_CONFBINDIR)
+
+#################################################################################
+
+DEL_OBJS = $(filter %.o,$($(1)_SRCS:%.c=%.o) $($(1)_SRCS:%.cc=%.o) \
+ $($(1)_SRCS:%.cpp=%.o) \
+ $($(1)_SRCS:%.S=%.o))
+OBJS = $(DEL_OBJS) $($(1)_PCOS)
+DEL_SOBJS = $(filter %.os,$($(1)_SRCS:%.c=%.os) $($(1)_SRCS:%.cc=%.os) \
+ $($(1)_SRCS:%.cpp=%.os) \
+ $($(1)_SRCS:%.S=%.os))
+DEL_GCDA = $(filter %.gcda,$($(1)_SRCS:%.c=%.gcda) $($(1)_SRCS:%.cc=%.gcda) \
+ $($(1)_SRCS:%.cpp=%.gcda) \
+ $($(1)_SRCS:%.S=%.gcda))
+DEL_GCNO = $(filter %.gcno,$($(1)_SRCS:%.c=%.gcno) $($(1)_SRCS:%.cc=%.gcno) \
+ $($(1)_SRCS:%.cpp=%.gcno) \
+ $($(1)_SRCS:%.S=%.gcno))
+DEL_GCOV = $(filter %.gcov,$($(1)_SRCS:%.c=%.gcov) $($(1)_SRCS:%.cc=%.gcov) \
+ $($(1)_SRCS:%.cpp=%.gcov) \
+ $($(1)_SRCS:%.S=%.gcov))
+
+DEL_INFO = $(filter %.info, \
+ $(dirname $($(1)_SRCS:%.c=%.tmp))lcov.info \
+ $(dirname $($(1)_SRCS:%.cc=%.tmp))lcov.info \
+ $(dirname $($(1)_SRCS:%.cpp=%.tmp))lcov.info \
+ $(dirname $($(1)_SRCS:%.S=%.tmp))lcov.info)
+
+SOBJS = $(DEL_SOBJS) $($(1)_PCOS)
+DEPS = $(join $(dir $(DEL_OBJS)),$(patsubst %.o,.%.d,$(notdir $(DEL_OBJS))))
+
+INST_TEST_MOCK_LIBS :=
+INST_TEST_MOCK_SHLIBS :=
+INST_ITV2_TESTPROGS :=
+INST_TESTPROGS :=
+
+CLEAN_OBJS := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(INST_TEST_MOCK_LIBS) $(INST_TEST_MOCK_SHLIBS) $(NOINST_LIBS) $(INST_PROGS) $(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(call DEL_OBJS,$(lib)))
+CLEAN_SOBJS := $(foreach lib,$(INST_SHLIBS) $(INST_TEST_MOCK_SHLIBS),$(call DEL_SOBJS,$(lib)))
+
+CLEAN_GCDA := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(NOINST_LIBS) $(INST_PROGS) $(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(call DEL_GCDA,$(lib)))
+CLEAN_GCNO := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(NOINST_LIBS) $(INST_PROGS) $(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(call DEL_GCNO,$(lib)))
+CLEAN_GCOV := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(NOINST_LIBS) $(INST_PROGS) $(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(call DEL_GCOV,$(lib)))
+CLEAN_CFG := $(INST_UT_SMCONF:%=%.cfg) $(INST_IT_SMCONF:%=%.cfg)
+
+CLEAN_INFO := $(sort $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(INST_TEST_MOCK_LIBS) $(INST_TEST_MOCK_SHLIBS) $(NOINST_LIBS) $(INST_PROGS) $(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(call DEL_INFO,$(lib))))
+
+LIB_DEPS := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(INST_TEST_MOCK_LIBS) $(INST_TEST_MOCK_SHLIBS) $(NOINST_LIBS),$(call DEPS,$(lib)))
+PROG_DEPS := $(foreach prog,$(INST_PROGS),$(call DEPS,$(prog)))
+TESTPROGS_DEPS :=
+PROG_RULES := $(foreach prog,$(INST_PROGS),$(if $(prog),.$(prog).out.rule))
+TESTPROG_RULES :=
+
+LIB_RULES := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(NOINST_LIBS) $(INST_TEST_MOCK_LIBS),$(if $($(lib)_SRCS),.$(lib).a.rule))
+SHLIB_RULES := $(foreach lib,$(INST_SHLIBS) $(INST_TEST_MOCK_SHLIBS),$(if $(lib),.$(lib).so.rule))
+ARLIB_RULES := $(foreach lib,$(INST_LIBS) $(NOINST_LIBS),$(if $($(lib)_SRCS),.$(lib).a.rule))
+
+PROG_MAPS := $(foreach prog,$(INST_PROGS),$(if $(prog),$(prog).map))
+TESTPROG_MAPS := $(foreach prog,$(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(if $(prog),$(prog).map))
+LIB_MAPS := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(NOINST_LIBS) $(INST_TEST_MOCK_LIBS) $(INST_TEST_MOCK_SHLIBS),$(if $(lib),$(lib).map))
+PROG_LIBDEPS := $(foreach prog,$(INST_PROGS),$(if $(prog),.$(prog).out.libdep))
+TESTPROG_LIBDEPS := $(foreach prog,$(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(if $(prog),.$(prog).out.libdep))
+
+BUILD_MK_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+include $(BUILD_MK_DIR)/rpc_rule.mk
+
+IPC_API_RULES := $(IPC_API:%=.%.ipc.rule)
+ipc_api := $(shell echo $(IPC_API) | tr A-Z a-z)
+CLEAN_IPC_API_SRCS := $(ipc_api:%=%_client.h) $(ipc_api:%=%_client.c) $(ipc_api:%=%_server.h) $(ipc_api:%=%_server.c)
+IPC_API_DEPS := $(ipc_api:%=%_client.d) $(ipc_api:%=%_server.d)
+
+CLEAN_PROGS := $(foreach prog,$(INST_PROGS),$(if $(prog),$(prog).out))
+CLEAN_TESTPROGS := $(foreach prog,$(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(if $(prog),$(prog).out))
+
+ifneq ($(AEXT),)
+CLEAN_PROGS += $(foreach prog,$(INST_PROGS),$(if $(prog),$(prog).out$(AEXT)))
+CLEAN_TESTPROGS += $(foreach prog,$(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(if $(prog),$(prog).out$(AEXT)))
+endif
+CLEAN_LIBS := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(INST_TEST_MOCK_LIBS) $(INST_TEST_MOCK_SHLIBS) $(NOINST_LIBS),$(if $($(lib)_SRCS),$(lib).a))
+CLEAN_SHLIBS := $(foreach lib,$(INST_SHLIBS) $(INST_TEST_MOCK_SHLIBS),$(if $(lib),$(lib).so))
+ifneq ($(AEXT),)
+CLEAN_SHLIBS += $(foreach lib,$(INST_SHLIBS) $(INST_TEST_MOCK_SHLIBS),$(if $(lib),$(lib).so$(AEXT)))
+endif
+ifneq ($(DUMMY_SHLIB),)
+CLEAN_SHLIBS += $(DUMMY_SHLIB)
+endif
+
+CLEAN_FILES += $(CLEAN_OBJS) $(CLEAN_SOBJS)
+CLEAN_FILES += $(PROG_DEPS) $(LIB_DEPS) $(TESTPROG_DEPS)
+CLEAN_FILES += $(PROG_MAPS) $(PROG_LIBDEPS) $(TESTPROG_MAPS) $(TESTPROG_LIBDEPS)
+CLEAN_FILES += $(PROG_RULES) $(LIB_RULES) $(SHLIB_RULES) $(AR_RULES) $(TESTPROG_RULES)
+CLEAN_FILES += $(CLEAN_PROGS) $(CLEAN_LIBS) $(CLEAN_SHLIBS) $(LIB_MAPS) $(CLEAN_TESTPROGS)
+CLEAN_FILES += $(RPC_API_RULES) $(CLEAN_API_SRCS) $(RPC_API_DEPS)
+CLEAN_FILES += $(IPC_API_RULES) $(CLEAN_IPC_API_SRCS) $(IPC_API_DEPS)
+CLEAN_FILES += $(INST_DATAINITOBJ)
+CLEAN_FILES += $(CLEAN_INFO)
+CLEAN_FILES += $(CLEAN_GCNO) $(CLEAN_GCDA) $(CLEAN_GCOV)
+CLEAN_FILES += $(CLEAN_CFG)
+ifneq ($(AEXT),)
+CLEAN_FILES += $(foreach lib,$(INST_SHLIBS) $(INST_PROGS),$(if $(lib),$(lib).map$(AEXT)))
+endif
+
+
+#################################################################################
+
+RPATHLINK := $(SYSROOT)/usr/lib:$(SYSROOT)/lib:$(SYSROOT)/usr/agl/lib
+
+#################################################################################
+SUBDIRS := $(filter-out mock,$(SUBDIRS))
+
+.PHONY: all all-subdirs install test $(SUBDIRS:%=all-%) $(SUBDIRS:%=install--%)
+.PHONY: install-test $(SUBDIRS:%=install-test-%)
+.PHONY: build-lib
+.PHONY: build-prog $(SUBDIRS:%=build-prog-%)
+.PHONY: build-shlib $(SUBDIRS:%=build-shlib-%)
+.PHONY: build-arlib $(SUBDIRS:%=build-arlib-%)
+.PHONY: build-cfg
+.PHONY: install-header $(SUBDIRS:%=install-header-%)
+.PHONY: install-lib
+.PHONY: install-shlib $(SUBDIRS:%=install-shlib-%)
+.PHONY: install-arlib $(SUBDIRS:%=install-arlib-%)
+.PHONY: install-prog $(SUBDIRS:%=install-prog-%)
+.PHONY: install-data $(SUBDIRS:%=install-data-%)
+.PHONY: install-cfg $(SUBDIRS:%=install-cfg-%)
+.PHONY: install-preload
+.PHONY: clean-all
+.PHONY: clean-self
+.PHONY: clean-sub $(SUBDIRS:%=clean-%)
+.PHONY: clean-all-sub $(SUBDIRS:%=clean-all-%)
+.PHONY: clean-self-sub
+.PHONY: lint lint-exec
+
+
+REF_ROOT_DIR=/home/ref_root/
+TEST_SERVER_DIR=/home/agl_sysroot/
+REFHW_SERVER=192.168.1.2
+
+PHONY: all
+
+lint:
+ @set -e;\
+ $(MAKE) lint-exec
+
+
+#all: build-lib build-prog build-test-mock-lib build-cfg all-subdirs
+all: build-lib build-prog build-cfg all-subdirs
+
+all-subdirs:
+ @set -e;\
+ for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) all); done
+
+
+#lint-exec: $(INST_HEADERS) $($(INST_SHLIBS)_SRCS) $($(INST_LIBS)_SRCS) $($(INST_PROGS)_SRCS)
+# -cpplint.py $^ > cpplint_result.txt 2>&1
+
+lint-exec:
+ $(eval LINTFILES := $(shell find . -name "*.c*" -o -name "*.h*"))
+ -cpplint.py --extensions=hpp,cpp,c,cc,h $(LINTFILES) > cpplint_result.txt 2>&1
+
+
+#install: install-header install-lib install-prog install-data install-test-mock-header install-test-mock-lib install-test-casename $(SUBDIRS:%=install--%)
+install: install-header install-lib install-prog install-data $(SUBDIRS:%=install--%)
+
+
+build-lib: build-shlib build-arlib
+
+build-shlib: $(INST_SHLIBS:%=%.so)
+
+build-arlib: $(INST_LIBS:%=%.a) $(NOINST_LIBS:%=%.a)
+
+TOPDIR=$(abspath ./)
+generate-header-list: install-header-local
+ echo $(COMPONENT_NAME) > $(addsuffix .list, $(abspath ./))
+ ls -1 $(TOPDIR)/tmp_head/usr/agl/include/$(COMPONENT_NAME)/ >> $(addsuffix .list, $(abspath ./))
+ rm -rf ./tmp_head
+
+
+build-prog: $(INST_PROGS:%=%.out)
+
+
+install-lib: install-arlib install-shlib
+
+install-arlib: build-arlib
+ifneq ($(strip $(INST_LIBS)),)
+ install -m 0755 -d $(LIB_INSTALL_DIR)
+ install -m 0644 $(INST_LIBS).a $(LIB_INSTALL_DIR)
+endif
+
+install-shlib: build-shlib
+ifneq ($(strip $(INST_SHLIBS)),)
+ install -m 0755 -d $(LIB_INSTALL_DIR)
+ install -m 0644 $(INST_SHLIBS).so $(LIB_INSTALL_DIR)
+endif
+
+install-prog: build-prog
+ifneq ($(strip $(INST_PROGS)),)
+ install -m 0755 -d $(PROG_INSTALL_DIR)
+ $(foreach prog, $(INST_PROGS), install -m 0755 $(prog).out $(PROG_INSTALL_DIR)/$(prog);)
+endif
+
+
+install-header-r: install-header $(SUBDIRS:%=install-header-r-%)
+
+
+install-header-local:
+ $(MAKE) DESTDIR=`pwd`/tmp_head install-header-r
+
+
+install-header: $(INST_HEADERS:%=install-%)
+
+
+$(INST_HEADERS:%=install-%): install-%: %
+ifneq ($(strip $(INST_HEADERS)),)
+ install -m 0755 -d $(HEADER_INSTALL_DIR)
+ install -m 0644 $< $(HEADER_INSTALL_DIR)
+endif
+
+
+HOST_LAUNCH_XML2CFG = $(SYSROOT)/usr/agl/share/launch_xml2cfg.sh
+CONF_H = $(SYSROOT)/usr/agl/include/sm_launch_conf.h
+
+%.cfg: %.xml
+ set -e; \
+ cpp -P -include $(CONF_H) $< > $<.tmp ; \
+ cd $(dir $<.tmp); \
+ $(HOST_LAUNCH_XML2CFG) $(notdir $<.tmp) > $@ ; \
+ rm -f $<.tmp ;
+
+
+install-data: $(INST_PIXMAPS:%=$(PIXMAP_INSTALL_DIR)/%) $(INST_UCODE:%=$(UCODE_INSTALL_DIR)/%) $(INST_DATAINITOBJ:%=$(DATAINITOBJ_INSTALL_DIR)/%) $(OBJ_COPY_LIST:%=$(OBJ_COPY_INSTALL_DIR)/%) $(INST_CONFBIN:%=$(CONFBIN_INSTALL_DIR)/%)
+
+
+clean: $(SUBDIRS:%=clean--%)
+ rm -f $(CLEAN_FILES)
+ rm -rf $(CLEAN_DIRS)
+
+clean-all: $(SUBDIRS:%=clean-all--%)
+ rm -f $(CLEAN_FILES) $(UNINST_FILES)
+ rm -rf $(CLEAN_DIRS)
+
+clean-self: clean
+
+#################################################################################
+
+%.o: %.c
+ $(CC) -MD -MT $(@:%.o=%.os) -MT $@ -MF $(@D)/.$(@F:%.o=%.d) -MP $(AGLCPPFLAGS) $(AGLCFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLCPPFLAGS) $(AGLCFLAGS) -c $<
+endif
+
+%.o: %.cc
+ $(CXX) -MD -MT $(@:%.o=%.os) -MT $@ -MF $(@D)/.$(@F:%.o=%.d) -MP $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c $<
+endif
+
+%.o: %.cpp
+ $(CXX) -MD -MT $(@:%.o=%.os) -MT $@ -MF $(@D)/.$(@F:%.o=%.d) -MP $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c $<
+endif
+
+%.o: %.S
+ $(CC) -MD -MT $(@:%.o=%.os) -MT $@ -MF $(@D)/.$(@F:%.o=%.d) -MP $(AGLCPPFLAGS) $(AGLASFLAGS) -c -o $@ $<
+
+%.os: %.c
+ $(CC) -MD -MT $(@:%.os=%.o) -MT $@ -MF $(@D)/.$(@F:%.os=%.d) -MP $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCFLAGS) -c $<
+endif
+
+%.os: %.cc
+ $(CXX) -MD -MT $(@:%.os=%.o) -MT $@ -MF $(@D)/.$(@F:%.os=%.d) -MP $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c $<
+endif
+
+%.os: %.cpp
+ $(CXX) -MD -MT $(@:%.os=%.o) -MT $@ -MF $(@D)/.$(@F:%.os=%.d) -MP $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c $<
+endif
+
+%.os: %.S
+ $(CC) -MD -MT $(@:%.os=%.o) -MT $@ -MF $(@D)/.$(@F:%.os=%.d) -MP $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLASFLAGS) -c -o $@ $<
+
+.%.out.rule:
+ @echo '$*.out: $$(call OBJS,$*)' > $@
+ @echo ' @rm -f $$(@:%=.%.libdep)' >> $@
+ @echo ' $$(LINK) $$(AGLLDFLAGS) -Wl,-rpath=$$(RPATH) -Wl,-rpath-link=$$(RPATHLINK),-Map=$$(@:%.out=%.map) $$(call OBJS,$*) $($(*F)_LDLIBS) $$(AGLLDLIBS) -o $$@' >> $@
+ @echo ' @awk '\''$$$$1=="LOAD" && $$$$2~/\.a$$$$/{print("$$@:", $$$$2);print($$$$2 ":")}'\'' $$(@:%.out=%.map) > $$(@:%=.%.libdep)' >> $@
+
+.%.a.rule:
+ @echo '$*.a: $$(call OBJS,$*)' > $@
+ @echo ' $$(AR) $$(AGLARFLAGS) $$@ $$?' >> $@
+
+.%.so.rule:
+ @echo '$*.so: $$(call SOBJS,$*)' > $@
+ @echo ' $$(call INST_DUMMY,$*.so)' >> $@
+ @test -f $*.ver && echo ' $$(LINK_SHLIB) -shared $$(AGLLDFLAGS) $($(*F)_LDFLAGS) $$(AGLLDLIBS) -Wl,-rpath=$$(RPATH) -Wl,-soname=$*.so,-Map=$$(@:%.so=%.map),--version-script,$*.ver $$^ -o $$@' >> $@ || echo ' $$(LINK_SHLIB) -shared $$(AGLLDFLAGS) $($(*F)_LDFLAGS) $$(AGLLDLIBS) -Wl,-rpath=$$(RPATH) -Wl,-soname=$*.so,-Map=$$(@:%.so=%.map) $$^ -o $$@' >> $@
+ @echo ' $$(call CLEAN_DUMMY)' >> $@
+
+.%.ipc.rule:
+ @echo 'ipc_name:=$(shell echo $* | tr A-Z a-z)' > $@
+ @echo '$$(ipc_name)_client.h $$(ipc_name)_client.c $$(ipc_name)_server.h $$(ipc_name)_server.c: $*.api $$(IPC_MKSTUB)' >> $@
+ @echo ' $$(IPC_MKSTUB) $$(AGLCPPFLAGS) $$(IPC_MKSTUB_FLAGS) $$<' >> $@
+ @echo >> $@
+ @echo '$*.api:' >> $@
+ @echo >> $@
+
+################################################################################
+
+#
+# If you write a pattern of smbols that the library may export,
+# it checks for unmatched symbols at installation time.
+#
+# (example)
+# libfoo_SYMBOL_PATTERN = ^(foo|FOO)_
+# libbar_SYMBOL_PATTERN = ^(bar|Bar)
+#
+
+$(LIB_INSTALL_DIR)/%.so: %.so
+ $(INSTALL_SHLIB)
+ $(INSTALL_EXT)
+ @test -z '$($*_SYMBOL_PATTERN)' || $(NM) -f posix -o $< \
+ | awk 'NF>=3 && $$3~/[ABCDGRST]/ && $$2!~/^(_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_edata|_end|__)/ && $$2!~/$($*_SYMBOL_PATTERN)/ \
+ {print $$1, "WARNING: A symbol ", $$2, " that does not match the registered pattern $($*_SYMBOL_PATTERN) is included." > "/dev/stderr"}'
+
+$(LIB_INSTALL_DIR)/%.a: %.a
+ $(INSTALL_LIB)
+ @test -z '$($*_SYMBOL_PATTERN)' || $(NM) -f posix -o $< \
+ | awk 'NF>=3 && $$3~/[ABCDGRST]/ && $$2!~/$($*_SYMBOL_PATTERN)/ \
+ {print $$1, "WARNING: A symbol ", $$2, " that does not match the registered pattern $($*_SYMBOL_PATTERN) is included." > "/dev/stderr"}'
+#################################################################################
+
+ifneq ($(strip $(SUBDIRS)),)
+$(SUBDIRS:%=all-%):
+ @set -e; \
+ dir=`pwd`; \
+ subdir=$(@:all-%=%); \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==START==" ; \
+ $(MAKE) -C $(@:all-%=%) all; \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==END==";
+
+$(SUBDIRS:%=install--%):
+ @set -e; \
+ dir=`pwd`; \
+ subdir=$(@:install--%=%); \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==START==" ; \
+ $(MAKE) -C $(@:install--%=%) install; \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==END==";
+
+$(SUBDIRS:%=install-header-r-%):
+ @set -e; \
+ dir=`pwd`; \
+ subdir=$(@:install-header-r-%=%); \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==START==" ; \
+ $(MAKE) -C $(@:install-header-r-%=%) install-header-r; \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==END==";
+
+
+$(SUBDIRS:%=clean--%):
+ @$(MAKE) -C $(@:clean--%=%) clean
+
+$(SUBDIRS:%=clean-all--%):
+ @echo "$@ ==Start=="
+ @$(MAKE) -C $(@:clean-all--%=%) clean-all
+ @echo "$@ ==End=="
+
+endif
+
+
+#################################################################################
+
+ifeq ($(MAKECMDGOALS),all)
+-include $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),)
+-include $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),install)
+-include $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+ifeq ($(MAKECMDGOALS),install-test)
+-include $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+ifeq ($(MAKECMDGOALS),install-test-exec)
+-include $(PROG_RULES) $(TESTPROG_RULES) $(PROG_DEPS) $(TESTPROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),test)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),run-ct-local)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),run-itv2-local)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),run-ut-local)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),run-it-local)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+
+
+ifeq ($(MAKECMDGOALS),test-exec)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+
+ifeq ($(MAKECMDGOALS),build-prog)
+-include $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS)
+endif
+
+ifeq ($(MAKECMDGOALS),build-testdriver)
+-include $(PROG_RULES) $(TESTPROG_RULES) $(TESTPROG_DEPS) $(TESTPROG_LIBDEPS)
+endif
+
+ifeq ($(MAKECMDGOALS),build-lib)
+-include $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS)
+endif
+
+ifeq ($(MAKECMDGOALS),build-arlib)
+-include $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS)
+endif
+
+ifeq ($(MAKECMDGOALS),build-shlib)
+-include $(SHLIB_RULES) $(LIB_DEPS)
+endif
+
+ifeq ($(MAKECMDGOALS),build-arlib)
+-include $(ARLIB_RULES) $(LIB_DEPS)
+endif
+
+ifeq ($(strip $(filter clean%,$(MAKECMDGOALS))),)
+ifneq ($(IPC_API_RULES),)
+-include $(IPC_API_RULES) $(IPC_API_DEPS)
+endif
+endif
+
diff --git a/agl-basefiles/share/rpc_rule.mk b/agl-basefiles/share/rpc_rule.mk
new file mode 100644
index 0000000..f5db71d
--- /dev/null
+++ b/agl-basefiles/share/rpc_rule.mk
@@ -0,0 +1,42 @@
+#
+# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# rpc rule makefile
+#
+
+#rpc_apidef directory path must be added
+RPC_APIDEF := $(OECORE_NATIVE_SYSROOT)/usr/bin/rpc_apidef
+
+RPC_API_RULES := $(RPC_API:%=.%.api.rule)
+rpc_api := $(shell echo $(RPC_API) | tr A-Z a-z)
+CLEAN_API_SRCS := $(rpc_api:%=%_api.h) $(rpc_api:%=%_api_stub.c) $(rpc_api:%=%_srvr.h) $(rpc_api:%=%_srvr_stub.c)
+RPC_API_DEPS := $(rpc_api:%=%_api_stub.d) $(rpc_api:%=%_srvr_stub.d)
+
+.%.api.rule:
+ @echo 'rpc_name:=$(shell echo $* | tr A-Z a-z)' > $@
+ @echo '$$(rpc_name)_api.h $$(rpc_name)_api_stub.c $$(rpc_name)_srvr.h $$(rpc_name)_srvr_stub.c: $*.api $$(RPC_APIDEF)' >> $@
+ @echo ' $$(RPC_APIDEF) $$(CPPFLAGS) $$(RPC_APIDEF_FLAGS) $$<' >> $@
+ @echo >> $@
+ @echo '$*.api:' >> $@
+ @echo >> $@
+
+ifeq ($(strip $(filter clean%,$(MAKECMDGOALS))),)
+ifneq ($(RPC_API_RULES),)
+-include $(RPC_API_RULES) $(RPC_API_DEPS)
+endif
+endif
+
diff --git a/agl-basefiles/share/system_launcher_main.xml b/agl-basefiles/share/system_launcher_main.xml
new file mode 100644
index 0000000..ac34d29
--- /dev/null
+++ b/agl-basefiles/share/system_launcher_main.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" ?>
+
+<!DOCTYPE system_launcher [
+ <!ELEMENT system_launcher (group+) >
+
+ <!ELEMENT group (launch+) >
+ <!ATTLIST group
+ name CDATA #REQUIRED
+ wait_time CDATA #REQUIRED
+ trigger (True|False) #REQUIRED
+ >
+
+ <!ELEMENT launch EMPTY >
+ <!ATTLIST launch
+ name CDATA #REQUIRED
+ path CDATA #REQUIRED
+ priority CDATA #REQUIRED
+ critical CDATA #REQUIRED
+ retry_cnt CDATA #REQUIRED
+ arguments CDATA #REQUIRED
+ logging_mask CDATA "NULL"
+ restart (me|NULL) #REQUIRED
+ is_start_required (True|False) #REQUIRED
+ shutdown_critical CDATA #REQUIRED
+ shutdown_wait_time CDATA #REQUIRED
+ fast_shutdown_wait_time CDATA #REQUIRED
+ user_name CDATA #REQUIRED
+ is_agl_unit (True|False) #IMPLIED
+ disable_agl_resethistory (True|False) #IMPLIED
+ disable_nonagl_resethistory (True|False) #IMPLIED
+ env_cond CDATA #IMPLIED
+ cpu_assign CDATA #IMPLIED
+ >
+
+ <!ENTITY system_launcher_body SYSTEM "system_launcher_body.xml">
+]>
+
+<system_launcher>
+ &system_launcher_body;
+</system_launcher>
diff --git a/agl-systemd/99-agl.rules b/agl-systemd/99-agl.rules
new file mode 100755
index 0000000..dd4e245
--- /dev/null
+++ b/agl-systemd/99-agl.rules
@@ -0,0 +1,11 @@
+#modify sound related device permissions
+
+SUBSYSTEM=="sound",MODE="0666"
+
+#modify dri related device permissions
+
+SUBSYSTEM=="drm",MODE="0777"
+
+#modify agl/evk related device permissions
+
+SUBSYSTEM=="evk",KERNEL=="agl/evk",MODE="0666"
diff --git a/agl-systemd/LICENSE b/agl-systemd/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/agl-systemd/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/agl-systemd/agl-trigger.service b/agl-systemd/agl-trigger.service
new file mode 100755
index 0000000..8cb752f
--- /dev/null
+++ b/agl-systemd/agl-trigger.service
@@ -0,0 +1,18 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+#After=weston.service
+
+[Service]
+Type=oneshot
+#RemainAfterExit=yes
+EnvironmentFile=/tool_9E_SI/env.txt
+ExecStart=/tool_9E_SI/agl_set_capability.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/agl-systemd/env.txt b/agl-systemd/env.txt
new file mode 100755
index 0000000..48b83df
--- /dev/null
+++ b/agl-systemd/env.txt
@@ -0,0 +1,130 @@
+VEHICLEPARAMETERLIBRARY_AREA="AREA1"
+XDG_RUNTIME_DIR="/run/user/0"
+AGL_NFS="y"
+VEHICLEPARAMETERLIBRARY_BRAND="BRAND1"
+LIBTHAI_DICTDIR="/usr/share/libthai"
+TERM="xterm"
+INIT_UID="1000"
+INIT_GID="1000"
+AGL_RWDATA_PATH="/nv"
+LD_LIBRARY_PATH="/lib:/usr/lib:/usr/agl/lib:/usr/debug/lib"
+ARB_OPT="FORCE_REBOOT"
+PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/agl/bin:/usr/debug/bin:/usr/debug/sbin:/usr/debug/usr/bin:/usr/debug/usr/sbin"
+PWD="/dev/mqueue"
+OLDPWD="/dev/mqueue"
+SHLVL="1"
+ALSA_CONFIG_PATH="/usr/share/alsa/alsa.conf"
+GPF_LOGFLAG="0x00000003"
+GPF_LOGLEVEL_DEBUG="0x00000000"
+_CWORD84__IPADDR="192.168.128.129"
+AGL_ON_SHELL="y"
+AGL_DEVDIAG_FLAG="ON"
+_="/usr/bin/printenv"
+UDEV_CONFIG_FILE="/etc/udev/udev.conf"
+VP_VEHICLEPARAMETERLIBRARY_version="AAAAAAAAA0001"
+VP_VEHICLEPARAMETERLIBRARY_maker_ID="00000-00000"
+VP_VEHICLEPARAMETERLIBRARY_area="AREA1"
+VP_VEHICLEPARAMETERLIBRARY_grade="GRADE1"
+VP_VEHICLEPARAMETERLIBRARY_model_ID="XXXXXXXX-XXXX"
+VP_VEHICLEPARAMETERLIBRARY_dest_c_code=""
+VP_VEHICLEPARAMETERLIBRARY_DAB_tuner_num="0"
+VP_VEHICLEPARAMETERLIBRARY_AMP_type="built_in_AMP"
+VP_VEHICLEPARAMETERLIBRARY_DISPLAY="InternalDisplay"
+VP_VEHICLEPARAMETERLIBRARY_DECK="CD_DECK"
+VP_VEHICLEPARAMETERLIBRARY_default_mode="home"
+VP_VEHICLEPARAMETERLIBRARY_VOICE_RECOGNITION_TUTORIAL="available"
+VP_VEHICLEPARAMETERLIBRARY_SEARCH="unavailable"
+VP_VEHICLEPARAMETERLIBRARY_CONTACT="unavailable"
+VP_VEHICLEPARAMETERLIBRARY_JPTrafficInfo_show="unavailable"
+VP_VEHICLEPARAMETERLIBRARY_INFOMATION_MANAGEMENT="available"
+VP_VEHICLEPARAMETERLIBRARY_WIFI_STA_ENABLE="False"
+VP_VEHICLEPARAMETERLIBRARY_WIFI_AP_ENABLE="True"
+VP_VEHICLEPARAMETERLIBRARY_WIFI_DIRECT_ENABLE="False"
+VP_VEHICLEPARAMETERLIBRARY_HAS_GPS="y"
+VP_VEHICLEPARAMETERLIBRARY__CWORD6_="n"
+VP_VEHICLEPARAMETERLIBRARY_PHASE="3"
+VP_VEHICLEPARAMETERLIBRARY__CWORD6_="unavailable"
+VP_VEHICLEPARAMETERLIBRARY_CONNECTION_SERVER="TRY"
+VP__CWORD31__version="XXXXXXXXX0001"
+VP__CWORD31__class_type_of_LAN="CAN_08_10PF"
+VP__CWORD31__reverse="direct"
+VP__CWORD31__PKB="direct"
+VP__CWORD31__ADIM__CWORD62_="direct_ADIM"
+VP__CWORD31__telematics_function="CAN_judge"
+VP__CWORD31__opening_picture="_CWORD31_"
+VP__CWORD31__theme_color="pure_white"
+VP__CWORD31__AC_onscreen="available"
+VP__CWORD31__AC_screen_operation="available"
+VP__CWORD31__AC_screen_home="available"
+VP__CWORD31__AC_switch_front_temp="available"
+VP__CWORD31__AC_temp_disp_outside="available"
+VP__CWORD31__AC_temp_disp_setting="available"
+VP__CWORD31__AC_switch_concierge="available"
+VP__CWORD31__AC_switch_S_flow="available"
+VP__CWORD31___CWORD11_="available"
+VP__CWORD31___CWORD11__home="available"
+VP__CWORD31___CWORD11__drive_wheel="FF"
+VP__CWORD31___CWORD11__drive_type="2WD"
+VP__CWORD31___CWORD11__battery_position="rear_tire"
+VP__CWORD31___CWORD11__battery_direction="lateral"
+VP__CWORD31___CWORD11__motor_position="Ahead"
+VP__CWORD31___CWORD9__trip="available"
+VP__CWORD31___CWORD9__trip="available"
+VP__CWORD31___CWORD9__home_trip="available"
+VP__CWORD31___CWORD9__fuel="available"
+VP__CWORD31___CWORD9__home_fuel="available"
+VP__CWORD31__FC_eco_safety_point_service="unavailable"
+VP__CWORD31__FC_scale_GAS="5"
+VP__CWORD31__FC_scale_HV="5"
+VP__CWORD31__FC_energy_mark="30wh"
+VP__CWORD31___CWORD9__type="type1"
+VP__CWORD31__FC_SIGNAL="unavailable"
+VP__CWORD31__display_setting_screen="unavailable"
+VP__CWORD31__VR_HVAC_control="unavailable"
+VP__CWORD31__clock_type="unavailable"
+VP__CWORD31__start_up_BGM="unavailable"
+VP__CWORD31__start_up_BGM_type="OFF"
+VP__CWORD31__DTV_antenna_FL="unavailable"
+VP__CWORD31__DTV_antenna_FR="unavailable"
+VP__CWORD31__DTV_antenna_RL="unavailable"
+VP__CWORD31__DTV_antenna_RR="unavailable"
+VP__CWORD31__DTV_ANTENNA="unavailable"
+VP__CWORD31__HF_voice_quality_type="0000"
+VP__CWORD31__tune_knob_push="available"
+VP__CWORD31__screen_switch_seek="unavailable"
+VP__CWORD31__DAB_antenna="unavailable"
+VP__CWORD31__hard_switch_beep="no_beep"
+VP__CWORD31__screen_switch_beep="beep"
+VP__CWORD31__steering_switch_type="2line_crosswise"
+VP__CWORD31__steering_switch_tel="1buttom"
+VP__CWORD31__class_circuit_mode="unavailable"
+VP__CWORD31___CWORD67__warning="unavailable"
+VP__CWORD31___CWORD67__accelerator="unavailable"
+VP__CWORD31__panel_microcomputer="available"
+VP__CWORD31__class_watch_at_brake_hold="unavailable"
+VP__CWORD31__GPS_antenna="available"
+VP__CWORD31__vehicle_signal_ILL="available"
+VP__CWORD31__switch_trigger="unavailable"
+VP__CWORD31__sensitivity_level="unavailable"
+VP__CWORD31__invalidity_term="500"
+VP__CWORD31__thumbnail_type="unavailable"
+VP__CWORD31__BT_device_name="CAR MULTIMEDIA"
+VP__CWORD31__eco_drive_max_volume="no_restriction"
+VP__CWORD31__EOM_function="unavailable"
+VP__CWORD31__Microphone_Type="_CWORD71__array"
+VP__CWORD31__Microphone_Location="ohc"
+VP__CWORD31__Wide_band_FM="unavailable"
+VP__CWORD31__display_type="one_screen_8"
+VP__CWORD31__clock_display="not_need"
+VP__CWORD31__destination="[]"
+VP__CWORD31__class_operation="touch"
+VP__CWORD31__opening_interval="1"
+VP__CWORD31__DES_function="unavailable"
+VP__CWORD31__beep_sound_keys=""
+VP_VEHICLEPARAMETERLIBRARY_SER_serial="00000000000"
+VP_VEHICLEPARAMETERLIBRARY_SER_HELPNET_ID="000000000000000000000"
+VP_VEHICLEPARAMETERLIBRARY_SER_map_update_ID="0000000000000000"
+VP_VEHICLEPARAMETERLIBRARY_SER_ship_date="00000000"
+VP_VEHICLEPARAMETERLIBRARY_SER_FACTORY_ID="0000000000000000000"
+BT_ADDR=""
+BT_DIAL=""
diff --git a/agl-systemd/launch_sm.service b/agl-systemd/launch_sm.service
new file mode 100755
index 0000000..8edc914
--- /dev/null
+++ b/agl-systemd/launch_sm.service
@@ -0,0 +1,22 @@
+[Unit]
+Description=launch_sm
+After=setup_refhw.service agl-trigger.service
+
+[Service]
+PermissionsStartOnly=yes
+EnvironmentFile=/tool_9E_SI/env.txt
+ExecStartPre=/tool_9E_SI/set_cgroup_rt_runtime_us.sh 950000
+ExecStart=/tool_9E_SI/launch_sm.sh
+Type=oneshot
+User=root
+StandardOutput=inherit
+StandardError=inherit
+RemainAfterExit=yes
+LimitAS=infinity
+LimitRSS=infinity
+LimitCORE=infinity
+LimitNOFILE=65536
+LimitMSGQUEUE=infinity
+
+[Install]
+WantedBy=multi-user.target
diff --git a/agl-systemd/options.conf b/agl-systemd/options.conf
new file mode 100755
index 0000000..05c48d9
--- /dev/null
+++ b/agl-systemd/options.conf
@@ -0,0 +1,2 @@
+[Mount]
+Options=rw,nodev
diff --git a/agl-systemd/setup_refhw.service b/agl-systemd/setup_refhw.service
new file mode 100755
index 0000000..427dfed
--- /dev/null
+++ b/agl-systemd/setup_refhw.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Initialize Reference Hardware Settings
+#After=weston.service
+
+[Service]
+EnvironmentFile=/tool_9E_SI/env.txt
+ExecStart=/tool_9E_SI/setup_refhw.sh
+Type=oneshot
+#StandardInput=tty
+#TTYPath=/dev/tty1
+#TTYReset=yes
+#TTYVHangup=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/agl-systemd/systemd-udev-trigger.service b/agl-systemd/systemd-udev-trigger.service
new file mode 100755
index 0000000..07a3f30
--- /dev/null
+++ b/agl-systemd/systemd-udev-trigger.service
@@ -0,0 +1,22 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=udev Coldplug all Devices
+Documentation=man:udev(7) man:systemd-udevd.service(8)
+DefaultDependencies=no
+Wants=systemd-udevd.service
+After=systemd-udevd-kernel.socket systemd-udevd-control.socket systemd-hwdb-update.service
+Before=sysinit.target
+ConditionPathIsReadWrite=/sys
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+EnvironmentFile=/tool_9E_SI/env.txt
+ExecStartPre=/tool_9E_SI/set_capability.sh
+ExecStart=/bin/udevadm trigger --type=subsystems --action=add ; /bin/udevadm trigger --type=devices --action=add
diff --git a/agl-systemd/tool_9E_SI/agl_set_capability.sh b/agl-systemd/tool_9E_SI/agl_set_capability.sh
new file mode 100755
index 0000000..6b108ae
--- /dev/null
+++ b/agl-systemd/tool_9E_SI/agl_set_capability.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ROMFILESTOP=/
+CAP_LST=${ROMFILESTOP}/usr/target/agl_cap.lst
+echo `cat ${CAP_LST}`
+#-----------------------------------------------------------------------
+# Capability
+
+df -T / | grep nfs > /dev/null
+IS_EMMC_BOOT=$?
+
+#*********************from init_nfs_cap.sh**************************
+
+echo "init_nfs-cap.sh: Start"
+
+VERBOSE=y
+SKIPWARN=n
+#-----------------------------------------------------------------------
+# Set Capability for NFS or Set DummyLink for ROM
+#CAP_LST="/usr/debug/share/target/cap.lst"
+CAP_LST="/usr/target/agl_cap.lst"
+
+if [ $IS_EMMC_BOOT -eq 0 ]; then
+if [ -f "${CAP_LST}" ];then
+ echo "*** set capability for NFS environment ***"
+ CAPPATH=/tmp/
+ cd /
+ for PREAD in `cat ${CAP_LST}`
+ do
+ IFS_ORG=${IFS} ; IFS='|' ; PARAM=(${PREAD}) ; IFS=${IFS_ORG}
+ CAP_NAME=${PARAM[0]} ; FMODE=${PARAM[1]} ; FUID_GID=${PARAM[2]}
+ FCAP=${PARAM[3]} ; FKEEPORGPATH=${PARAM[4]}
+ if [ ! -f "${CAP_NAME}" -a ! -f "${CAP_NAME}.org" ];then
+ if [ "${SKIPWARN}" = "n" ];then
+ echo "set capability: ${CAP_NAME}: No such file or directory" 1>&2
+ fi
+ continue
+ fi
+ TCAP_NAME="/tmp/${CAP_NAME##*/}"
+ # Set Capability for NFS
+ if [ ! -L "${CAP_NAME}" ]; then
+ cp -a ${CAP_NAME} ${TCAP_NAME}
+ if [ "${FKEEPORGPATH}" = "y" ];then
+ mv ${CAP_NAME} ${CAP_NAME}.org
+ ln -fs ${TCAP_NAME} ${CAP_NAME}
+ fi
+ else
+ cp -a ${CAP_NAME}.org ${TCAP_NAME}
+ fi
+ if [ -n "${FUID_GID}" ];then
+ chown ${FUID_GID} ${TCAP_NAME}
+ fi
+ if [ -n "${FMODE}" ];then
+ chmod ${FMODE} ${TCAP_NAME}
+ fi
+ if [ -n "${FCAP}" ];then
+ setcap ${FCAP} ${TCAP_NAME}
+ #if [ "${VERBOSE}" = "y" ];then
+ # getcap ${TCAP_NAME}
+ #fi
+ fi
+ done
+ cd - > /dev/null
+else
+ unset CAPPATH
+fi
+fi
diff --git a/agl-systemd/tool_9E_SI/launch_sm.sh b/agl-systemd/tool_9E_SI/launch_sm.sh
new file mode 100755
index 0000000..ed1e8d1
--- /dev/null
+++ b/agl-systemd/tool_9E_SI/launch_sm.sh
@@ -0,0 +1,26 @@
+#!/bin/bash -x
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# launch SS_SystemManager
+export APPS_CONFIG_FILENAME=sm_launch.cfg
+export SM_CONFIG_DATA_FILENAME=gpf_ss_sm_config_data.cfg
+export XDG_RUNTIME_DIR=/run/user/0
+cd /usr/agl/bin/
+rm -rf /nv/romaccess
+rm /dev/shm/lockfile
+
+/usr/agl/bin/SS_SystemManager &
diff --git a/agl-systemd/tool_9E_SI/set_capability.sh b/agl-systemd/tool_9E_SI/set_capability.sh
new file mode 100755
index 0000000..c16ab4a
--- /dev/null
+++ b/agl-systemd/tool_9E_SI/set_capability.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ROMFILESTOP=/
+CAP_LST=${ROMFILESTOP}/usr/target/cap.lst
+echo `cat ${CAP_LST}`
+#-----------------------------------------------------------------------
+# Capability
+
+df -T / | grep nfs > /dev/null
+IS_EMMC_BOOT=$?
+
+#*********************from init_nfs_cap.sh**************************
+
+echo "init_nfs-cap.sh: Start"
+
+VERBOSE=y
+SKIPWARN=n
+#-----------------------------------------------------------------------
+# Set Capability for NFS or Set DummyLink for ROM
+#CAP_LST="/usr/debug/share/target/cap.lst"
+CAP_LST="/usr/target/cap.lst"
+
+if [ $IS_EMMC_BOOT -eq 0 ]; then
+if [ -f "${CAP_LST}" ];then
+ echo "*** set capability for NFS environment ***"
+ CAPPATH=/tmp/
+ cd /
+ for PREAD in `cat ${CAP_LST}`
+ do
+ IFS_ORG=${IFS} ; IFS='|' ; PARAM=(${PREAD}) ; IFS=${IFS_ORG}
+ CAP_NAME=${PARAM[0]} ; FMODE=${PARAM[1]} ; FUID_GID=${PARAM[2]}
+ FCAP=${PARAM[3]} ; FKEEPORGPATH=${PARAM[4]}
+ if [ ! -f "${CAP_NAME}" -a ! -f "${CAP_NAME}.org" ];then
+ if [ "${SKIPWARN}" = "n" ];then
+ echo "set capability: ${CAP_NAME}: No such file or directory" 1>&2
+ fi
+ continue
+ fi
+ TCAP_NAME="/tmp/${CAP_NAME##*/}"
+ # Set Capability for NFS
+ if [ ! -L "${CAP_NAME}" ]; then
+ cp -a ${CAP_NAME} ${TCAP_NAME}
+ if [ "${FKEEPORGPATH}" = "y" ];then
+ mv ${CAP_NAME} ${CAP_NAME}.org
+ ln -fs ${TCAP_NAME} ${CAP_NAME}
+ fi
+ else
+ cp -a ${CAP_NAME}.org ${TCAP_NAME}
+ fi
+ if [ -n "${FUID_GID}" ];then
+ chown ${FUID_GID} ${TCAP_NAME}
+ fi
+ if [ -n "${FMODE}" ];then
+ chmod ${FMODE} ${TCAP_NAME}
+ fi
+ if [ -n "${FCAP}" ];then
+ setcap ${FCAP} ${TCAP_NAME}
+ if [ "${VERBOSE}" = "y" ];then
+ getcap ${TCAP_NAME}
+ fi
+ fi
+ done
+ cd - > /dev/null
+else
+ unset CAPPATH
+fi
+fi
diff --git a/agl-systemd/tool_9E_SI/set_cgroup_rt_runtime_us.sh b/agl-systemd/tool_9E_SI/set_cgroup_rt_runtime_us.sh
new file mode 100755
index 0000000..41536f2
--- /dev/null
+++ b/agl-systemd/tool_9E_SI/set_cgroup_rt_runtime_us.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+desired_rt_runtime_us=$1
+mygroup=${2:-$(awk -F: '$2 == "cpu,cpuacct" {print $3}' /proc/self/cgroup)}
+
+[[ $desired_rt_runtime_us -gt 0 ]] || exit
+[[ $mygroup ]] || exit
+[[ $mygroup = / ]] && exit
+
+echo "${0##*/}: setting cpu.rt_runtime_us for $mygroup" >&2
+
+cgpath=
+IFS=/ read -ra cgroups <<< "${mygroup:1}"
+for cg in "${cgroups[@]}"; do
+ cgpath="${cgpath}/${cg}"
+ echo "${0##*/}: $desired_rt_runtime_us -> /sys/fs/cgroup/cpu,cpuacct${cgpath}" >&2
+ echo "$desired_rt_runtime_us" > /sys/fs/cgroup/cpu,cpuacct${cgpath}/cpu.rt_runtime_us
+done
diff --git a/agl-systemd/tool_9E_SI/setup_refhw.sh b/agl-systemd/tool_9E_SI/setup_refhw.sh
new file mode 100755
index 0000000..e3f33a4
--- /dev/null
+++ b/agl-systemd/tool_9E_SI/setup_refhw.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#to expand msg_max
+sysctl -w fs.mqueue.msg_max=512
+
+# device detection
+echo -n "TARGET_BOARD=" > /tmp/udev_device.env
+cat /proc/device-tree/model | cut -d " " -f 2 >> /tmp/udev_device.env
+echo >> /tmp/udev_device.env
+echo "UID=$INIT_UID" >> /tmp/udev_device.env
+echo "GID=$INIT_GID" >> /tmp/udev_device.env
+echo "BRAND=$VEHICLEPARAMETERLIBRARY_BRAND" >> /tmp/udev_device.env
+echo "AREA=$VEHICLEPARAMETERLIBRARY_AREA" >> /tmp/udev_device.env
+
+# Start: Workaround for release ###############################################
+## Sprint 29 To make WebService can update contents.
+#chown -R agl:agl /usr/agl/data/electronicom
+## For btservice initial data.
+#chown -R agl:agl /nv/backup/D_BK_CA_BT_MANAGEMENT
+## Sprint 29 PFDRECThread
+mkdir -p /ramd/BS/ns/backup_manager/rwdata
+mkdir -p /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/diag
+restorecon -R /ramd
+#chmod 777 /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/diag
+## Sprint 29 communication
+#chmod -R 777 /home/root/.app_can_d
+# TODO:for bluetooth_service
+#chmod 777 /usr/agl/share
+
+#if `df -T / | grep nfs > /dev/null`; then
+#cp /sbin/insmod.kmod /tmp/insmod.kmod
+#ln -s -f /tmp/insmod.kmod /sbin/insmod
+#setcap cap_sys_module+ep /tmp/insmod.kmod
+#fi
+
+## Sprint 32 Positioning
+#chmod 777 /dev/ttySC3
+#chmod -R 777 /home/root/.app_gps_cmd_d
+
+## Sprint 37 BUG17P-9 clock
+ln -f -s /tmp/bs/clock/localtime /etc/localtime
+
+# END: Workaround for release #################################################
+
+# permission setting
+# wait for weston is properly launched
+#until [ -e /run/user/0/wayland-0 ]
+#do
+# usleep 50000
+#done
+#chmod 777 /run/user/0/wayland-0
+
+mkdir /tmp/shm
+
+chmod 777 /tmp/shm
+chmod 666 /dev/mqueue/IccSnd
+#chmod 777 /dev/mqueue/*
+#chmod 777 /dev/mqueue/NS_NPPService
+#chmod 777 /run/user/0
+
+rm -rf /nv/romaccess
+rm /dev/shm/lockfile
+
+
+
+
+export PATH=`echo -n ${PATH} | sed 's|/tmp:||'`
+
diff --git a/agl-systemd/usr/target/agl_cap.lst b/agl-systemd/usr/target/agl_cap.lst
new file mode 100755
index 0000000..89ea096
--- /dev/null
+++ b/agl-systemd/usr/target/agl_cap.lst
@@ -0,0 +1,34 @@
+/usr/agl/bin/SS_SystemManager|||cap_sys_nice,cap_setuid,cap_setgid,cap_sys_resource+ep|y
+/usr/agl/bin/tskmgr|||cap_sys_nice,cap_setuid,cap_setgid=ep|y
+/usr/agl/bin/SS_DeviceDetectionService|||cap_setuid,cap_setgid,cap_sys_resource,cap_dac_override,cap_sys_admin+ep|y
+/usr/agl/bin/communication|||cap_dac_override+ep|y
+/usr/agl/bin/AS_AudioManager|||cap_sys_nice+ep|y
+/usr/agl/bin/acmsrv|||cap_dac_override,cap_sys_admin,cap_sys_nice,cap_sys_resource,cap_chown,cap_fowner,cap_setgid,cap_setuid,cap_kill+ep|y
+/usr/agl/bin/PS_SwitchHandler|||cap_sys_admin,cap_dac_override+ep|y
+/usr/agl/bin/LockManager|||cap_kill+ep|y
+/usr/agl/bin/nandupdate|||cap_dac_override+ep|y
+/usr/agl/bin/wlan_controller|||cap_net_raw,cap_net_admin+ep|y
+/usr/agl/bin/DummyRead|||cap_dac_read_search+ep|y
+/usr/agl/bin/clock|||cap_sys_time+ep|y
+/usr/agl/bin/Mounter|||cap_sys_admin,cap_dac_override+ep|y
+/usr/agl/bin/MounterEx|||cap_sys_admin,cap_fowner,cap_dac_override,cap_chown+ep|y
+/usr/agl/bin/DevReproService|||cap_chown,cap_fowner,cap_dac_override+ep|y
+/usr/agl/bin/PS_CDR|||cap_sys_admin+ep|y
+/usr/agl/bin/webdavmgr|||cap_net_admin,cap_net_raw+ep|y
+/usr/agl/bin/DiagService|||cap_sys_rawio,cap_dac_override+ep|y
+/usr/agl/bin/resm|||cap_setuid+ep|y
+/usr/agl/bin/SS_LoggerService|||cap_dac_override+ep|y
+/usr/agl/bin/NetworkManager|||cap_setuid,cap_setgid,cap_sys_admin,cap_chown,cap_kill,cap_net_raw,cap_net_admin,cap_net_bind_service+ep|y
+/usr/agl/bin/RadioService|||cap_sys_nice+ep|y
+/usr/agl/bin/ASND_VProxy|||cap_sys_nice+ep|y
+/usr/agl/bin/misink|||cap_sys_nice+ep|y
+/usr/agl/bin/mlink|||cap_sys_nice+ep|y
+/usr/agl/bin/media_service|||cap_dac_override,cap_sys_nice+ep|y
+/usr/agl/bin/_CWORD74__service|||cap_dac_override+ep|y
+/usr/agl/bin/PlaybackService|||cap_sys_nice+ep|y
+/usr/agl/bin/Positioning|||cap_dac_override+ep|y
+/usr/agl/bin/vehicle|||cap_dac_override+ep|y
+/usr/agl/bin/bluetooth_srv|||cap_dac_override,cap_sys_nice+ep|y
+/usr/agl/bin/btd_srv|||cap_dac_override,cap_sys_nice+ep|y
+/usr/agl/bin/NS_BackupMgr|||cap_dac_override+ep|y
+/usr/agl/bin/Sound|||cap_dac_override+ep|y
diff --git a/agl-systemd/usr/target/cap.lst b/agl-systemd/usr/target/cap.lst
new file mode 100755
index 0000000..c27de10
--- /dev/null
+++ b/agl-systemd/usr/target/cap.lst
@@ -0,0 +1,24 @@
+/bin/udevadm|||cap_dac_override+ep|y
+/sbin/ifconfig|||cap_net_admin+ep|y
+/usr/libexec/firmware|||cap_sys_rawio,cap_dac_override+ep|y
+/usr/bin/fusedav|||cap_sys_admin+ep|y
+/sbin/dhclient|||cap_net_bind_service,cap_net_admin,cap_net_raw,cap_chown,cap_kill,cap_sys_admin+ep|y
+/sbin/dhcpd|||cap_net_bind_service,cap_net_admin,cap_net_raw,cap_chown,cap_kill,cap_sys_admin+ep|y
+/usr/debug/bin/busybox|||cap_sys_module,cap_net_raw+ep|y
+/sbin/insmod|||cap_sys_module+ep|y
+/sbin/rmmod|||cap_sys_module+ep|y
+/usr/sbin/xtables-multi|||cap_net_raw,cap_net_admin+ep|y
+/usr/bin/fusermount|||cap_sys_admin+ep|y
+/usr/bin/simple-mtpfs|||cap_sys_admin+ep|y
+/sbin/slattach|||cap_net_admin+ep|y
+/sbin/mkfs.ext4|||cap_dac_override+ep|y
+/sbin/losetup|||cap_dac_override+ep|y
+/usr/bin/aplay|||cap_sys_nice+ep|y
+/usr/bin/modetest|||cap_sys_admin+ep|y
+/sbin/fsck.ext4|||cap_dac_override+ep|y
+/usr/sbin/tune2fs|||cap_dac_override+ep|y
+/usr/bin/syslogd|||cap_dac_override+ep|y
+/usr/bin/dnsmasq|||cap_net_bind_service,cap_net_admin,cap_net_raw,cap_chown,cap_kill,cap_setgid,cap_setuid,cap_sys_admin+ep|y
+/usr/sbin/pppd|||cap_setuid,cap_sys_admin,cap_chown,cap_fowner,cap_kill,cap_net_admin,cap_dac_override+ep|y
+/sbin/ip|||cap_net_bind_service,cap_net_admin,cap_net_raw+ep|y
+/usr/bin/arping|||cap_net_bind_service,cap_net_admin,cap_net_raw,cap_setuid+ep|y
diff --git a/agl-systemd/usr/target/dir.lst b/agl-systemd/usr/target/dir.lst
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/agl-systemd/usr/target/dir.lst
diff --git a/agl-systemd/usr/target/mntfs.lst b/agl-systemd/usr/target/mntfs.lst
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/agl-systemd/usr/target/mntfs.lst
diff --git a/boot_hal/LICENSE b/boot_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/boot_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/boot_hal/Makefile b/boot_hal/Makefile
new file mode 100755
index 0000000..d184316
--- /dev/null
+++ b/boot_hal/Makefile
@@ -0,0 +1,65 @@
+#
+# @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libboot_hal.so
+
+HEADER := hal_api/boot_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := boot_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/boot_hal/hal_api/boot_hal.h b/boot_hal/hal_api/boot_hal.h
new file mode 100755
index 0000000..783db97
--- /dev/null
+++ b/boot_hal/hal_api/boot_hal.h
@@ -0,0 +1,228 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_BOOT_HAL_H_
+#define HAL_API_BOOT_HAL_H_
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * @file boot_hal.h
+ * @brief This file provides API for get boot info from boot device, set boot info to boot device,
+ * set next boot mode to coldstart and get current boot mode
+ */
+
+/** @addtogroup reproservice
+ * @{
+ */
+/** @addtogroup boot_hal
+ * @ingroup reprogramming_service
+ * @{
+ */
+
+/**
+ * \~english BootHalBootMode
+ */
+enum BootHalBootMode{
+ /**
+ * \~english cold start
+ */
+ COLD_START = 0,
+ /**
+ * \~english hot start
+ */
+ HOT_START = 1,
+};
+
+/**
+ * \~english BootHalUpTableID
+ */
+enum BootHalUpTableID{
+ /**
+ * \~english UBOOT
+ */
+ BOOTHAL_SIDE_IDX_UBOOT = 0,
+ /**
+ * \~english Secure loader
+ */
+ BOOTHAL_SIDE_IDX_SECURE = 1,
+ /**
+ * \~english MAIN software
+ */
+ BOOTHAL_SIDE_IDX_MAINSOFT = 2,
+ /**
+ * \~english Max num of modules(include reserves)
+ */
+ BOOTHAL_NUMTARGS = 20
+};
+
+/**
+ * \~english BootHalStatus
+ */
+typedef enum BootHalStatus {
+/**
+ * \~english Success
+ */
+ BOOTHAL_RET_SUCCESS = 0,
+/**
+ * \~english No permission to operate
+ */
+ BOOTHAL_RET_ERR_PERMISSION = 1,
+/**
+ * \~english Time out
+ */
+ BOOTHAL_RET_ERR_TIMEOUT = 2,
+/**
+ * \~english Status error
+ */
+ BOOTHAL_RET_ERR_STATUS = 3,
+/**
+ * \~english Write error
+ */
+ BOOTHAL_RET_ERR_WRITE = 4,
+/**
+ * \~english Paramater error
+ */
+ BOOTHAL_RET_ERR_PARAM = 5,
+/**
+ * \~english Internal IO error(open, read, write, strstr, close)
+ */
+ BOOTHAL_RET_ERR_FAIL = 6,
+} BootHalStatus;
+
+/**
+ * \~english Not rewrite.
+ */
+#define BOOTHAL_SIDE_NONE 0
+/**
+ * \~english Rewrites side A.
+ */
+#define BOOTHAL_SIDE_A 1
+/**
+ * \~english Rewrites side B.
+ */
+#define BOOTHAL_SIDE_B 2
+/**
+ * \~english Max parameter num
+ */
+#define BOOTHAL_NUMSIDE_MAX 3
+
+/**\ingroup setSide
+ * \~english @par Brief
+ * This API set boot info to boot device, the caller control this API not be called at the
+ * same time
+ * \~english @param [in] upTableID
+ * unsigned int - Boot info
+ * \~english @retval BOOTHAL_RET_SUCCESS OK
+ * \~english @retval BOOTHAL_RET_ERR_PARAM Parameter error
+ * \~english @retval BOOTHAL_RET_ERR_WRITE Write error
+ * \~english @retval BOOTHAL_RET_ERR_FAIL Internal IO error
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter upTableId is NULL. [BOOTHAL_RET_ERR_PARAM]
+ * - If write /dev/mmcblk0boot1 return -1. [BOOTHAL_RET_ERR_WRITE]
+ * - Internal IO error(open, read, lseek). [BOOTHAL_RET_ERR_FAIL]
+ * \~english @par Detail
+ * - This API set boot info.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see getSide
+ */
+BootHalStatus setSide(unsigned int upTableID[]);
+
+/**\ingroup getSide
+ * \~english @par Brief
+ * Get boot info from boot device
+ * \~english @param [out] upTableID
+ * unsigned int - boot info
+ * \~english @retval BOOTHAL_RET_SUCCESS OK
+ * \~english @retval BOOTHAL_RET_ERR_PARAM Parameter error
+ * \~english @retval BOOTHAL_RET_ERR_FAIL Internal IO error
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter upTableId is NULL. [BOOTHAL_RET_ERR_PARAM]
+ * - Internal IO error.[BOOTHAL_RET_ERR_FAIL]
+ * \~english @par Detail
+ * - This API get boot info from boot device.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see setSide
+ */
+BootHalStatus getSide(unsigned int upTableID[]);
+
+/**\ingroup setBootColdStart
+ * \~english @par Brief
+ * Set next boot to ColdStart mode.
+ * \~english @retval BOOTHAL_RET_SUCCESS OK
+ * \~english @retval BOOTHAL_RET_ERR_FAIL set next boot start mode failed
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error.[BOOTHAL_RET_ERR_FAIL]
+ * \~english @par Detail
+ * - This API Set next boot to ColdStart mode.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see getBootMode
+ */
+BootHalStatus setBootColdStart(void);
+
+/**\ingroup getBootMode
+ * \~english @par Brief
+ * Get boot mode.
+ * \~english @param [out] mode
+ * unsigned int - boot mode(COLD_START or HOT_START)
+ * \~english @retval BOOTHAL_RET_SUCCESS OK
+ * \~english @retval BOOTHAL_RET_ERR_PARAM Parameter error
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter mode is NULL. [BOOTHAL_RET_ERR_PARAM]
+ * \~english @par Detail
+ * - This API get boot mode.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see setBootColdStart
+ */
+BootHalStatus getBootMode(uint32_t *mode);
+
+/** @}*/ // end of boot_hal
+/** @}*/ // end of reprogramming_service
+
+#endif // HAL_API_BOOT_HAL_H_
diff --git a/boot_hal/inc/boot_hal_boothallog.h b/boot_hal/inc/boot_hal_boothallog.h
new file mode 100755
index 0000000..4a037ee
--- /dev/null
+++ b/boot_hal/inc/boot_hal_boothallog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_BOOT_HAL_BOOTHALLOG_H_
+#define INC_BOOT_HAL_BOOTHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_BOOT_HAL_BOOTHALLOG_H_
diff --git a/boot_hal/src/boot_hal.cpp b/boot_hal/src/boot_hal.cpp
new file mode 100755
index 0000000..d4d5581
--- /dev/null
+++ b/boot_hal/src/boot_hal.cpp
@@ -0,0 +1,313 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <boot_hal.h>
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/vfs.h>
+
+#include <cstdio>
+#include <cerrno>
+#include <cstring>
+
+#include "boot_hal_boothallog.h"
+
+#define BOOT_PARTATION "/dev/mmcblk0boot1"
+#define BOOTINFO_FILEA "/repro/mmcblk0boot1-launch_a.bin"
+#define BOOTINFO_FILEB "/repro/mmcblk0boot1-launch_b.bin"
+
+#define MMCBLK0BOOT1_FORCE_RO "/sys/class/block/mmcblk0boot1/force_ro"
+#define MMCBLK0BOOT1_SIZE_PATH "/sys/class/block/mmcblk0boot1/size"
+#define MMCBLK0BOOT1_SIZE_DEF (0x1000000)
+#define BOOTINFO_SIZE (0x20000)
+#define SECTOR_SIZE (512)
+#define FILEPATH_MAX (256)
+
+#define BOOT_CMDLINE "/proc/cmdline"
+#define CMDLINE_MAX_SIZE (256)
+#define BOOT_ROOTFS_A "/dev/mmcblk0p1"
+#define BOOT_ROOTFS_B "/dev/mmcblk0p2"
+#define BOOTARGS_LST_ROOT "root="
+
+
+#define BOOT_COPYBUF_SIZE (64 * 1024)
+
+static int EnableMmcBlk(const char *path) {
+ int fd;
+ char enable[] = "0";
+
+ if ((fd = open(path, O_RDWR)) < 0) {
+ return -1;
+ }
+
+ if (write(fd, enable, sizeof(enable)) < 0) {
+ close(fd);
+ return -1;
+ }
+
+ close(fd);
+ return 0;
+}
+
+static int GetMmcBlkCount(const char *path) {
+ int fd;
+ char block_size[16] = {0};
+
+ if ((fd = open(path, O_RDONLY)) < 0) {
+ return -1;
+ }
+
+ if (read(fd, block_size, sizeof(block_size)) < 0) {
+ close(fd);
+ return -1;
+ }
+
+ close(fd);
+ return strtol(block_size, NULL, 10);
+}
+
+static ssize_t BootReadN(int fd, void *buffer, size_t n) {
+ size_t tot_read;
+ char *buf;
+
+ buf = reinterpret_cast<char *>(buffer);
+ for (tot_read = 0; tot_read < n;) {
+ ssize_t num_read;
+ num_read = read(fd, buf, n - tot_read);
+
+ if (num_read == 0) {
+ return tot_read;
+ }
+ if (num_read == -1) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ return -1;
+ }
+ }
+ tot_read += num_read;
+ buf += num_read;
+ }
+ return tot_read;
+}
+
+static ssize_t BootWriteN(int fd, const void *buffer, size_t n) {
+ size_t tot_written;
+ const char *buf;
+
+ buf = (const char *)buffer;
+ for (tot_written = 0; tot_written < n;) {
+ ssize_t num_written;
+ num_written = write(fd, buf, n - tot_written);
+
+ if (num_written <= 0) {
+ if (num_written == -1 && errno == EINTR) {
+ continue;
+ } else {
+ return -1;
+ }
+ }
+ tot_written += num_written;
+ buf += num_written;
+ }
+ return tot_written;
+}
+
+BootHalStatus setSide(unsigned int upTableID[]) {
+ BootHalStatus ret = BOOTHAL_RET_ERR_FAIL;
+ int binfo_fd = -1;
+ int mmc_fd = -1;
+ int sector_count = 0;
+ char *buf = NULL;
+ char binfo_file[FILEPATH_MAX] = {0};
+ off_t mmc_offset;
+
+ if (NULL == upTableID) {
+ return BOOTHAL_RET_ERR_PARAM;
+ }
+
+ if (upTableID[BOOTHAL_SIDE_IDX_MAINSOFT] == BOOTHAL_SIDE_A) {
+ snprintf(binfo_file, FILEPATH_MAX, "%s", BOOTINFO_FILEA);
+ } else if (upTableID[BOOTHAL_SIDE_IDX_MAINSOFT] == BOOTHAL_SIDE_B) {
+ snprintf(binfo_file, FILEPATH_MAX, "%s", BOOTINFO_FILEB);
+ } else {
+ ret = BOOTHAL_RET_ERR_PARAM;
+ goto exit;
+ }
+
+ binfo_fd = open(binfo_file, O_RDONLY);
+ if (binfo_fd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "open %s:%s", binfo_file, strerror(errno));
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ mmc_fd = open(BOOT_PARTATION, O_WRONLY);
+ if (mmc_fd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "open %s:%s", BOOT_PARTATION, strerror(errno));
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ /*
+ * enable mmcblk0boot1 for write
+ */
+ if (EnableMmcBlk(MMCBLK0BOOT1_FORCE_RO) < 0) {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ /*
+ * Get sector count of mmcblk0boot1 block from sys-file, every sector size is 512byte.
+ * The mmcblk0boot1 block default size is 16M.
+ */
+ if ((sector_count = GetMmcBlkCount(MMCBLK0BOOT1_SIZE_PATH)) < 0) {
+ mmc_offset = MMCBLK0BOOT1_SIZE_DEF - BOOTINFO_SIZE;
+ } else {
+ mmc_offset = sector_count * SECTOR_SIZE - BOOTINFO_SIZE;
+ }
+
+ /*
+ * The environment should be write to the latest 128K of mmcblk0boot1.
+ */
+ if (lseek(mmc_fd, mmc_offset, SEEK_SET) < 0) {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ buf = reinterpret_cast<char *>(mmap(NULL, BOOT_COPYBUF_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
+ if (buf == MAP_FAILED) {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ while (1) {
+ ssize_t rd, wr;
+
+ rd = BootReadN(binfo_fd, buf, BOOT_COPYBUF_SIZE);
+ if (!rd) {
+ // EOF
+ break;
+ }
+ if (rd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "read:%s", strerror(errno));
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ wr = BootWriteN(mmc_fd, buf, rd);
+ if (wr < rd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "write(%s):%s", BOOT_PARTATION, strerror(errno));
+ ret = BOOTHAL_RET_ERR_WRITE;
+ goto exit;
+ }
+ }
+
+ if (fsync(mmc_fd) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "fsync:%s", strerror(errno));
+ }
+ ret = BOOTHAL_RET_SUCCESS;
+
+exit:
+ if (binfo_fd >= 0) {
+ if (close(binfo_fd) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "close:%s", strerror(errno));
+ }
+ }
+
+ if (mmc_fd >= 0) {
+ if (close(mmc_fd) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "close:%s", strerror(errno));
+ }
+ }
+
+ if (buf) {
+ munmap(buf, BOOT_COPYBUF_SIZE);
+ }
+
+ return ret;
+}
+
+BootHalStatus getSide(unsigned int upTableID[]) {
+ BootHalStatus ret = BOOTHAL_RET_SUCCESS;
+ int fd;
+ int rd_size;
+ char buf[CMDLINE_MAX_SIZE] = {0};
+ char *rootfs = NULL;
+
+ if (NULL == upTableID) {
+ return BOOTHAL_RET_ERR_PARAM;
+ }
+
+ if ((fd = open(BOOT_CMDLINE, O_RDONLY)) < 0) {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ if ((rd_size = BootReadN(fd, buf, CMDLINE_MAX_SIZE)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "read %s error:%s", BOOT_CMDLINE, strerror(errno));
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ rootfs = strstr(buf, BOOTARGS_LST_ROOT);
+ if (!rootfs) {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ rootfs += strlen(BOOTARGS_LST_ROOT);
+ if (strncmp(rootfs, BOOT_ROOTFS_A, strlen(BOOT_ROOTFS_A)) == 0 &&
+ (rootfs[strlen(BOOT_ROOTFS_A)] == ' ' || rootfs[strlen(BOOT_ROOTFS_A)] == '\0')) {
+ upTableID[BOOTHAL_SIDE_IDX_MAINSOFT] = BOOTHAL_SIDE_A;
+ } else if (strncmp(rootfs, BOOT_ROOTFS_B, strlen(BOOT_ROOTFS_B)) == 0 &&
+ (rootfs[strlen(BOOT_ROOTFS_B)] == ' ' || rootfs[strlen(BOOT_ROOTFS_B)] == '\0')) {
+ upTableID[BOOTHAL_SIDE_IDX_MAINSOFT] = BOOTHAL_SIDE_B;
+ } else {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ }
+
+exit:
+ if (fd >= 0) {
+ if (close(fd) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "close:%s", strerror(errno));
+ }
+ }
+
+ return ret;
+}
+
+BootHalStatus setBootColdStart(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return BOOTHAL_RET_SUCCESS;
+}
+
+BootHalStatus getBootMode(uint32_t *mode) {
+ if (NULL == mode) {
+ return BOOTHAL_RET_ERR_PARAM;
+ }
+
+ *mode = COLD_START;
+ return BOOTHAL_RET_SUCCESS;
+}
diff --git a/can_hal/LICENSE b/can_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/can_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/can_hal/Makefile b/can_hal/Makefile
new file mode 100755
index 0000000..61e5cc2
--- /dev/null
+++ b/can_hal/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := src
+
+include ./can_hal.mk
diff --git a/can_hal/README.md b/can_hal/README.md
new file mode 100755
index 0000000..e1a5e84
--- /dev/null
+++ b/can_hal/README.md
@@ -0,0 +1,3 @@
+can_hal library
+==================
+CAN HAL implementation library for AGL Reference Board.
diff --git a/can_hal/can_hal.mk b/can_hal/can_hal.mk
new file mode 100755
index 0000000..19a824d
--- /dev/null
+++ b/can_hal/can_hal.mk
@@ -0,0 +1,39 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME ?= can_hal
+
+#############################################################
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/can_hal/hal_api/can_hal.h b/can_hal/hal_api/can_hal.h
new file mode 100755
index 0000000..5f3ef4f
--- /dev/null
+++ b/can_hal/hal_api/can_hal.h
@@ -0,0 +1,303 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HAL_API_CAN_HAL_H_
+#define HAL_API_CAN_HAL_H_
+/**
+ * @file can_hal.h
+ */
+
+/** @addtogroup communication
+ * @{
+ */
+/** @addtogroup can_hal
+ * @ingroup communication
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+/**
+ * \~english Max data length of nomarl can send
+ */
+#define CAN_NORMAL_MESSAGE_LEN (8)
+
+/**
+ * \~english Maximum data length
+ */
+#define CAN_MESSAGE_LEN (2048)
+
+/**
+ * \~english Maximum CAN_ID data length
+ */
+#define CAN_NUM_MAX (125)
+
+/**
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE, CID_CANHAL_CMD_CAN_SEND_STATUS, CANHalSndStsProcess);
+ * @endcode
+ * \~english Command ID to send CAN data and get the send status
+ */
+#define CID_CANHAL_CMD_CAN_SEND_STATUS (0x0A03)
+
+/**
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE, CID_CANHAL_CMD_CAN_RECV, CANHalRcvProcess);
+ * @endcode
+ * \~english Command ID to receive the CAN data
+ */
+#define CID_CANHAL_CMD_CAN_RECV (0x0A04)
+
+/**
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE, CID_CANHAL_CMD_CAN_READY, AnyCallback);
+ * @endcode
+ * \~english Command ID to receive Global CAN is ready.
+ */
+#define CID_CANHAL_CMD_CAN_READY (0x0A0C)
+
+/**
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE, CID_CANHAL_CMD_ERROR_NOTIFY, AnyCallback);
+ * @endcode
+ * \~english Command ID to receive can hal error.
+ */
+#define CID_CANHAL_CMD_ERROR_NOTIFY (0x0A10)
+
+/**
+ * \~english No target address
+ */
+#define CAN_NTA_NONE (0x00)
+
+/**
+ * \~english Size of error message.
+ */
+#define CANHAL_ERROR_MESSAGE_LEN (2048)
+
+/**
+ * \~english Return type of the API
+ */
+enum CANHAL_RET_API {
+ CANHAL_RET_NORMAL = 0, //!< \~english API Success
+ CANHAL_RET_ERR_ERR, //!< \~english API Failed
+ CANHAL_RET_ERR_PARAM, //!< \~english Parameter error
+ CANHAL_RET_ERR_STATE, //!< \~english Uninitialized(not called CanOpen)
+};
+
+/**
+ * \~english CAN type
+ */
+enum CanHalType {
+ CAN_HAL_TYPE_CAN = 0, //!< \~english CAN
+ NR_CAN_HAL_TYPES //!< \~english Number of CAN type
+};
+
+/**
+ * \~english device State
+ */
+enum DEVICE_STATE {
+ DEVICE_STATE_UNAVAILABLE, //!< \~english device unavailable
+ DEVICE_STATE_AVAILABLE, //!< \~english device available
+};
+
+/**
+ * \~english CAN Send Result
+ */
+enum CAN_SEND_RESULT {
+ CAN_SEND_RESULT_FAILURE = 0, //!< \~english Send failure
+ CAN_SEND_RESULT_SUCCESS, //!< \~english Send success
+};
+
+/**
+ * \~english structure of can data
+ */
+typedef struct CanMessageT {
+ uint32_t can_id; //!< \~english Target CAN ID
+ uint32_t dlc; //!< \~english Data length(1~2048)
+ uint8_t rid; //!< \~english Replay ID
+ uint8_t data[CAN_MESSAGE_LEN]; //!< \~english Data buffer
+} CanMessage;
+
+/**
+ * \~english structure of can send result
+ */
+typedef struct CanSendResultT {
+ uint32_t can_id; //!< \~english CAN ID
+ uint8_t rid; //!< \~english RID
+ CAN_SEND_RESULT result; //!< \~english Send result
+} CanSendResult;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \ingroup CanOpen
+ * \~english @par Brief
+ * API to start the can_hal service
+ * \~english @param [in] h_app
+ * HANDLE - Application handle
+ * \~english @param [in] type
+ * CanHalType - CAN type
+ * \~english @retval CANHAL_RET_NORMAL : API return OK
+ * \~english @retval CANHAL_RET_ERR_PARAM : Paramter error
+ * \~english @retval CANHAL_RET_ERR_ERR : Failed
+ * \~english @par Prerequisite
+ * None
+ * \~english @par Change of internal state
+ * - When calling of this API succeeds, the requested channel state is set to open.
+ * \~english @par Conditions of processing failure
+ * - Input paramter is invalid.
+ * - Internal processing failure.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Method
+ * \~english @par Detail
+ * - Perform device use preparation processing of the requested communication path.
+ * - Up to one process can use this library.
+ * \~english @see
+ * Nothing
+ */
+CANHAL_RET_API CanOpen(HANDLE h_app, CanHalType type);
+
+/**
+ * \ingroup CanClose
+ * \~english @par Brief
+ * API to stop the can_hal service
+ * \~english @param [in] h_app
+ * HANDLE - Application handle
+ * \~english @param [in] type
+ * CanHalType - CAN type
+ * \~english @retval CANHAL_RET_NORMAL : API return OK
+ * \~english @retval CANHAL_RET_ERR_PARAM : Paramter error
+ * \~english @retval CANHAL_RET_ERR_ERR : Failed
+ * \~english @retval CANHAL_RET_ERR_STATE : Failed because CanOpen is not called
+ * \~english @par Prerequisite
+ * Communication path status is open
+ * \~english @par Change of internal state
+ * - In the case of normal termination, the requested channel state is close.
+ * \~english @par Conditions of processing failure
+ * - CanOpen is not called.
+ * - Input paramter is invalid.
+ * - Internal processing failure.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Perform device use finalize processing of the requested communication path.
+ * - Up to one process can use this library.
+ * \~english @see
+ * None
+ */
+CANHAL_RET_API CanClose(HANDLE h_app, CanHalType type);
+
+/**
+ * \ingroup CanSend
+ * \~english @par Brief
+ * API to send the Can data
+ * \~english @param [in] h_app
+ * HANDLE - Application handle
+ * \~english @param [in] message
+ * const CanMessage * - Pointer to the structure of
+ * the data which is sent to the CAN
+ * \~english @param [in] type
+ * CanHalType - CAN type
+ * \~english @retval CANHAL_RET_NORMAL : API return OK
+ * \~english @retval CANHAL_RET_ERR_ERR : Failed
+ * \~english @retval CANHAL_RET_ERR_PARAM : Paramter error
+ * \~english @retval CANHAL_RET_ERR_STATE : Failed because CanOpen is not called
+ * \~english @par Prerequisite
+ * - can_hal start successfully
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Input paramter is invalid.
+ * - CanOpen is not called.
+ * - Send data to the sending thread failed.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Method
+ * \~english @par Detail
+ * - Check the sending data, if data is valid, then send the data
+ * to the sending thread; If data if invalid, then return error.
+ * - The API can only be used by 1 process.
+ * \~english @see
+ * \ref CanSendResult
+ */
+CANHAL_RET_API CanSend(HANDLE h_app, const CanMessage *message, CanHalType type);
+
+/**
+ * \ingroup CanGetVersion
+ * \~english @par Brief
+ * API to get the CAN micon version
+ * \~english @param [in] h_app
+ * HANDLE - Application handle
+ * \~english @param [out] p_version
+ * std::string * - Pointer to the version buffer
+ * \~english @retval CANHAL_RET_NORMAL : API return OK
+ * \~english @retval CANHAL_RET_ERR_STATE : Failed because CanOpen is not called
+ * \~english @retval CANHAL_RET_ERR_PARAM : Paramter error
+ * \~english @retval CANHAL_RET_ERR_ERR : Failed
+ * \~english @par Prerequisite
+ * - can_hal start successfully
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Input paramter is invalid.
+ * - CanOpen is not called.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - This API gets the CAN version.
+ * - The API can only be used by 1 process.
+ * - p_version detail\n
+ * Information on the following pink shaded part 4 BYTE in the version information \n
+ * of the CAN microcomputer is stored in string and returned.\n
+ * <table>
+ * <tr>
+ * <th></th><th>7bit-0bit</th>
+ * </tr>
+ * <tr>
+ * <td>1BYTE</td><td>7bit:M/S 6-0bit:Message kind</td>
+ * </tr>
+ * <tr>
+ * <td>2BYTE</td><td>7bit-0bit Operation Code</td>
+ * </tr>
+ * <tr>
+ * <td>3BYTE</td><td bgcolor="pink">7bit-0bit Software kind</td>
+ * </tr>
+ * <tr>
+ * <td>4BYTE</td><td bgcolor="pink">7bit-0bit version(Higher order)</td>
+ * </tr>
+ * <tr>
+ * <td>5BYTE</td><td bgcolor="pink">7bit-0bit version(middle order)</td>
+ * </tr>
+ * <tr>
+ * <td>6BYTE</td><td bgcolor="pink">7bit-0bit version(lower order)</td>
+ * </tr>
+ * </table>
+ * \~english @see
+ * None
+ */
+CANHAL_RET_API CanGetVersion(HANDLE h_app, std::string *p_version);
+
+/** @}*/ // end of can_hal
+/** @}*/ // end of communication
+#ifdef __cplusplus
+}
+#endif
+#endif // HAL_API_CAN_HAL_H_
diff --git a/can_hal/src/Makefile b/can_hal/src/Makefile
new file mode 100755
index 0000000..f34eb75
--- /dev/null
+++ b/can_hal/src/Makefile
@@ -0,0 +1,52 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libcan_hal
+
+######### installed static library(*.a) #############
+
+######### install headers(*.h) #############
+INST_HEADERS = ../hal_api/can_hal.h
+
+######### compiled sources #############
+libcan_hal_SRCS = can_hal_core.cpp can_hal_stm.cpp can_hal_api.cpp
+libcan_hal_SRCS += driver_can__CWORD31_.c
+
+######### include paths/files ###################
+CPPFLAGS += -I./inc/
+CPPFLAGS += -I../hal_api/
+
+######### compile options #######################
+CPPFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH := /usr/lib:/usr/agl/lib
+
+######### linked library ########################
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lpthread
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+COMPONENT_NAME =
+AGL_TOPDIR ?= $(DESTDIR)/usr
+include ../can_hal.mk
diff --git a/can_hal/src/can_hal_api.cpp b/can_hal/src/can_hal_api.cpp
new file mode 100755
index 0000000..86a0104
--- /dev/null
+++ b/can_hal/src/can_hal_api.cpp
@@ -0,0 +1,166 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "can_hal_core.h"
+#include "can_hal_stm.h"
+#include <stdio.h>
+#include <pthread.h>
+#include <string.h>
+#include <assert.h>
+
+CANHAL_RET_API CanOpen(HANDLE h_app, CanHalType type) {
+ CANHAL_RET_API ret = CANHAL_RET_ERR_ERR;
+
+ if (!TypeIsValid(type)) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!h_app) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (IsCanHalOpened(type)) {
+ return CANHAL_RET_NORMAL;
+ }
+
+ if (IsDeviceEnabled(type)) {
+ return CANHAL_RET_NORMAL;
+ }
+
+ ret = CanOpenCore(type);
+ if (CANHAL_RET_NORMAL != ret) {
+ return ret;
+ }
+
+ ret = CanHalCreateInternalThread(h_app, type);
+ if (CANHAL_RET_NORMAL != ret) {
+ CanCloseCore(type);
+ return ret;
+ }
+
+ SetDeviceStateEnable(type);
+ SetCanHalStateOpen(type);
+ InvokeStateCallback(type);
+ return ret;
+}
+
+CANHAL_RET_API CanClose(HANDLE h_app, CanHalType type) {
+ CANHAL_RET_API ret = CANHAL_RET_ERR_ERR;
+ if (!TypeIsValid(type)) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!h_app) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!IsCanHalOpened(type)) {
+ return CANHAL_RET_NORMAL;
+ }
+
+ if (IsDeviceEnabled(type)) {
+ ret = CanCloseCore(type);
+ if (CANHAL_RET_NORMAL != ret)
+ return ret;
+ }
+
+ ret = CanHalDestroyInternalThread(h_app, type);
+ if (CANHAL_RET_NORMAL != ret)
+ return ret;
+
+ SetDeviceStateDisable(type);
+ SetCanHalStateClose(type);
+ InvokeErrorCallback(h_app, type);
+
+ return ret;
+}
+
+static CANHAL_RET_API CanSendCommonCheck(const void *message,
+ enum CanHalType type) {
+ if (!TypeIsValid(type)) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!message) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!IsCanHalOpened(type)) {
+ return CANHAL_RET_ERR_STATE;
+ }
+
+ if (!IsDeviceEnabled(type)) {
+ return CANHAL_RET_ERR_STATE;
+ }
+
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API CanSend(HANDLE h_app,
+ const CanMessage *message, enum CanHalType type) {
+ CANHAL_RET_API ret = CANHAL_RET_ERR_ERR;
+ void *_message = NULL;
+ ssize_t sz = 0;
+
+ ret = CanSendCommonCheck(message, type);
+ if (ret != CANHAL_RET_NORMAL)
+ return ret;
+
+ if (!h_app) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (CAN_NORMAL_MESSAGE_LEN < message->dlc) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ _message = CanHalPackMessage(h_app, (const void *)message,
+ sizeof(CanMessage), &sz);
+ if (!_message)
+ return CANHAL_RET_ERR_ERR;
+
+ ret = CanHalInternalSend(type, _message, sz);
+ CanHalDestroyPackedMessage(_message);
+ return ret;
+}
+
+CANHAL_RET_API CanGetVersion(HANDLE h_app, std::string *p_version) {
+ CanHalType type = CAN_HAL_TYPE_CAN;
+ if (!h_app) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!IsCanHalOpened(type)) {
+ return CANHAL_RET_ERR_STATE;
+ }
+
+ if (!IsDeviceEnabled(type)) {
+ return CANHAL_RET_ERR_STATE;
+ }
+
+ if (NULL == p_version) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ *p_version = "FFFF";
+ return CANHAL_RET_NORMAL;
+}
diff --git a/can_hal/src/can_hal_core.cpp b/can_hal/src/can_hal_core.cpp
new file mode 100755
index 0000000..bdbdbbc
--- /dev/null
+++ b/can_hal/src/can_hal_core.cpp
@@ -0,0 +1,372 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "can_hal.h"
+#include "can_hal_core.h"
+#include "can_hal_internal.h"
+#include "can_hal_frameworkunifiedlog.h"
+#include "can_hal_stm.h"
+extern "C" {
+ #include "can_mng_api.h"
+}
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <string>
+
+static CanCtlApiObj g_driver_obj; // can driver handler
+
+typedef struct MessageWrapper {
+ HANDLE h_app;
+ void *message;
+} MessageWrapper;
+
+// define frame
+enum CANHAL_FRAME {
+ CANHAL_FRAME_SF = 0x00,
+ CANHAL_FRAME_FF,
+ CANHAL_FRAME_CF,
+ CANHAL_FRAME_NONE = 0xFF,
+};
+
+// Declaration of the local functions
+static EFrameworkunifiedStatus CanSendData(HANDLE h_app);
+static UINT8 PackageSendData(const CanMessage *send_msg,
+ UINT8 *send_cmd);
+static UINT8 PackageRecvData(const UINT8 *recv_data, CanMessage *message);
+static uint32_t GetCanId(const UINT8 *recv_data);
+
+#define CANHAL_VALID_NUM_INDEX 0x00
+#define CANHAL_CANID_HI_INDEX 0x00
+#define CANHAL_CANID_LO_INDEX 0x01
+#define CANHAL_DLC_INDEX 0x02
+#define CANHAL_DATA_START_INDEX 0x03
+
+#define CANHAL_RECV_DATA_LENGTH_INVALID 0xFF
+
+#define CANHAL_RECV_DATABLOCK_SIZE (0x0B)
+#define CANHAL_RECV_NTA_INDEX (0x03)
+
+// Register table for framework callback
+static const FrameworkunifiedProtocolCallbackHandler kCanHalPcbhs[] = {
+ { TX_INTERNAL, CanSendData },
+};
+
+void *CanHalPackMessage(HANDLE h_app, const void *msg, ssize_t msg_sz,
+ ssize_t *packed_sz) {
+ *packed_sz = msg_sz + sizeof(ssize_t) + sizeof(HANDLE);
+ void *p = malloc(*packed_sz);
+ if (p) {
+ char *_p = (char *)p;
+ // Set HANDLE to new buffer.
+ memcpy(_p, &h_app, sizeof(HANDLE));
+ // Set message size to new buffer
+ _p += sizeof(HANDLE);
+ *(ssize_t *)_p = msg_sz;
+ // Set message body to new buffer
+ _p += (sizeof(ssize_t));
+ memcpy(_p, msg, msg_sz);
+ }
+ return p;
+}
+
+void CanHalUnPackMessage(void *packed, HANDLE *h_app, void **msg,
+ ssize_t *msg_sz) {
+ char *_p = (char *)packed;
+ *h_app = *(HANDLE *)_p;
+ _p += sizeof(HANDLE);
+ *msg_sz = *((ssize_t *)_p);
+ _p += sizeof(ssize_t);
+ *msg = _p;
+}
+
+void CanHalDestroyPackedMessage(void *packed) {
+ free(packed);
+}
+
+// Start function of the receive thread
+void *CanRecvRun(void *arg) {
+ UINT8 data_start_index = 0;
+ UINT8 loop_num = 0;
+ UINT32 ret = 0;
+ CanCtlApiCmd recv_cmd;
+ memset(&recv_cmd, 0x00, sizeof(CanCtlApiCmd));
+ CanMessage recv_data_can;
+ memset(&recv_data_can, 0x00, sizeof(recv_data_can));
+ enum CanHalType *type = (enum CanHalType *)arg;
+
+ while (1) {
+ // call driver API to receive the can data
+ ret = CanCtlApiRcvCmd(&g_driver_obj, &recv_cmd);
+ if (CAN_CTL_RET_SUCCESS != ret) {
+ continue;
+ }
+
+ /**
+ * Receive data in the following structure:
+ * -----------------
+ * BYTE 01 | num of can data |
+ * -----------------
+ * BYTE 02 | CAN ID (Hi) |
+ * -----------------
+ * BYTE 03 | CAN ID (Lo) |
+ * -----------------
+ * BYTE 04 | DLC |
+ * -----------------
+ * BYTE 05 | DATA #1 |
+ * -----------------
+ * | ... |
+ * -----------------
+ * BYTE 12 | DATA #8 |
+ * -----------------
+ * BYTE 13 | CAN ID (Hi) |
+ * -----------------
+ * BYTE 14 | CAN ID (Lo) |
+ * -----------------
+ * BYTE 15 | DLC |
+ * -----------------
+ * BYTE 16 | DATA #1 |
+ * -----------------
+ * | ... |
+ * -----------------
+ * BYTE 23 | DATA #8 |
+ * -----------------
+ * | ... |
+ * -----------------
+ * BYTE 255 | |
+ * -----------------
+ *
+ * BYTE 0 for the invalid number of the can data
+ * CAN ID (Hi) and (Lo) combine for the CAN ID
+ * CAN ID (Hi) byte's low 7 bits is the high 7 bits of the CAN ID
+ * CAN ID (Lo) byte's high 4 bits is the low 4 bits of the CAN ID
+ * DLC for the length of the following data
+ * DATA #1 ~ #8 for the receive data, its actual length changes
+ * according to the previous DLC byte
+ */
+ UINT8 total_data_num = recv_cmd.data[CANHAL_VALID_NUM_INDEX];
+ data_start_index = 1;
+
+ for (loop_num = 0; loop_num < total_data_num; loop_num++) {
+ uint32_t can_id;
+ can_id = GetCanId(&(recv_cmd.data[data_start_index]));
+
+ // normal can
+ // Return value of the PackageRecvData is the total length
+ // of one can data package, so add to the data_start_index
+ // for the next can data package.
+ ret = PackageRecvData(&(recv_cmd.data[data_start_index]),
+ &recv_data_can);
+ if (CANHAL_RECV_DATA_LENGTH_INVALID == ret) {
+ continue;
+ }
+ data_start_index += ret;
+ CanHalReceiveNotify(*type, &(recv_data_can), sizeof(recv_data_can));
+ }
+
+ // reset buffer
+ memset(&recv_cmd, 0x00, sizeof(CanCtlApiCmd));
+ usleep(1000);
+ }
+
+ return NULL;
+}
+
+// get can id from recive buffer
+static uint32_t GetCanId(const UINT8 *recv_data) {
+ uint32_t can_id;
+ can_id = (recv_data[CANHAL_CANID_HI_INDEX] & 0x7F);
+ can_id <<= 4;
+ can_id |= ((recv_data[CANHAL_CANID_LO_INDEX] & 0xF0) >> 4);
+ return can_id;
+}
+
+static CANHAL_RET_API CanOpenCoreCAN(void) {
+ CanCtlRcvId recv_can_id;
+ memset(recv_can_id.id, 0xFF, sizeof(recv_can_id.id));
+ if (CAN_CTL_RET_SUCCESS != CanCtlApiOpen(&g_driver_obj))
+ return CANHAL_RET_ERR_ERR;
+
+ if (CAN_CTL_RET_SUCCESS != CanCtlApiSetRcvId(&g_driver_obj, &recv_can_id)) {
+ return CANHAL_RET_ERR_ERR;
+ }
+
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API CanOpenCore(CanHalType type) {
+ CANHAL_RET_API ret = CANHAL_RET_ERR_ERR;
+ switch (type) {
+ case CAN_HAL_TYPE_CAN:
+ ret = CanOpenCoreCAN();
+ break;
+ default:
+ // Do nothing
+ break;
+ }
+ return ret;
+}
+
+// Initialize the sending thread
+EFrameworkunifiedStatus CanSendThreadStart(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ intptr_t ptr;
+ e_status = FrameworkunifiedAttachCallbacksToDispatcher(h_app,
+ FRAMEWORKUNIFIED_ANY_SOURCE,
+ kCanHalPcbhs,
+ _countof(kCanHalPcbhs));
+ if (e_status != eFrameworkunifiedStatusOK)
+ goto finish;
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &ptr, sizeof(ptr));
+ if (e_status != eFrameworkunifiedStatusOK)
+ goto finish;
+
+ *((HANDLE *)ptr) = FrameworkunifiedMcOpenSender(h_app, FrameworkunifiedGetAppName(h_app));
+ if (!(*(HANDLE *)ptr))
+ e_status = eFrameworkunifiedStatusFail;
+
+finish:
+ return e_status;
+}
+
+// Clean the sending thread
+EFrameworkunifiedStatus CanSendThreadStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ intptr_t ptr;
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &ptr, sizeof(ptr));
+ if (e_status != eFrameworkunifiedStatusOK)
+ goto finish;
+
+ FrameworkunifiedMcClose(*((HANDLE*)ptr));
+finish:
+ return e_status;
+}
+
+static CANHAL_RET_API CanCloseCoreCAN(void) {
+ CanCtlApiClose(&g_driver_obj);
+ return CANHAL_RET_NORMAL;
+}
+
+// Stop the can hal
+CANHAL_RET_API CanCloseCore(CanHalType type) {
+ CANHAL_RET_API ret = CANHAL_RET_NORMAL;
+ switch (type) {
+ case CAN_HAL_TYPE_CAN:
+ ret = CanCloseCoreCAN();
+ if (ret != CANHAL_RET_NORMAL)
+ goto finish;
+ break;
+ default:
+ goto finish;
+ break;
+ }
+finish:
+ return ret;
+}
+
+// Callback for the sending thread to send the can data
+static EFrameworkunifiedStatus CanSendData(HANDLE h_app) {
+ UINT8 ret = 0;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ HANDLE hb = NULL;
+ CanMessage mb;
+ ssize_t sz = 0;
+ void *send_msg = NULL;
+ HANDLE unpacked_h_app;
+ CanMessage *unpacked_msg;
+ ssize_t unpacked_sz;
+
+ send_msg = CanHalPackMessage(hb, (const void *)&mb, sizeof(mb), &sz);
+ if (!send_msg)
+ return eFrameworkunifiedStatusFail;
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, send_msg, sz, eSMRRelease);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ if (eFrameworkunifiedStatusInvldBufSize == e_status) {
+ FrameworkunifiedClearMsgData(h_app);
+ }
+ return eFrameworkunifiedStatusFail;
+ }
+
+ CanHalUnPackMessage(send_msg, &unpacked_h_app,
+ (void **)&unpacked_msg, &unpacked_sz);
+
+ CanCtlApiCmd send_can_data;
+ memset(&send_can_data, 0, sizeof(CanCtlApiCmd));
+ send_can_data.data[CANHAL_VALID_NUM_INDEX] = 1;
+ ret = PackageSendData(unpacked_msg, &(send_can_data.data[1]));
+ send_can_data.len = ret + 1;
+ CanSendResult send_result;
+ send_result.can_id = unpacked_msg->can_id;
+ send_result.rid = unpacked_msg->rid;
+
+ if (CAN_CTL_RET_SUCCESS == CanCtlApiSndCmd(&g_driver_obj, &send_can_data)) {
+ send_result.result = CAN_SEND_RESULT_SUCCESS;
+ } else {
+ send_result.result = CAN_SEND_RESULT_FAILURE;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Send status is %d.", send_result.result);
+
+ if (CANHAL_RET_NORMAL != CanHalSendStatus(CAN_HAL_TYPE_CAN,
+ unpacked_h_app, &send_result, sizeof(send_result))) {
+ CanHalDestroyPackedMessage(send_msg);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ CanHalDestroyPackedMessage(send_msg);
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * param [in] send_msg
+ * param [out] send_can_data
+ */
+static UINT8 PackageSendData(const CanMessage *send_msg,
+ UINT8 *send_can_data) {
+ // package according to the rule of the data structure,
+ // refer to the line 108 and 109
+ send_can_data[CANHAL_CANID_HI_INDEX] = (send_msg->can_id & 0x7F0) >> 4;
+ send_can_data[CANHAL_CANID_LO_INDEX] = (send_msg->can_id & 0x0F) << 4;
+ send_can_data[CANHAL_DLC_INDEX] = send_msg->dlc;
+ memcpy(&(send_can_data[CANHAL_DATA_START_INDEX]),
+ send_msg->data,
+ send_msg->dlc);
+ return (send_msg->dlc + CANHAL_DATA_START_INDEX);
+}
+
+/**
+ * param [in] recv_data
+ * param [out] message
+ */
+static UINT8 PackageRecvData(const UINT8 *recv_data, CanMessage *message) {
+ if (CAN_NORMAL_MESSAGE_LEN < recv_data[CANHAL_DLC_INDEX]) {
+ // receive data's length is invalid
+ return CANHAL_RECV_DATA_LENGTH_INVALID;
+ }
+ // package according to the rule of the data structure,
+ // refer to the line 108 and 109
+ message->can_id = recv_data[CANHAL_CANID_HI_INDEX] & 0x7F;
+ message->can_id <<= 4;
+ message->can_id |= (recv_data[CANHAL_CANID_LO_INDEX] & 0xF0) >> 4;
+ message->dlc = recv_data[CANHAL_DLC_INDEX];
+ memcpy(message->data, &(recv_data[CANHAL_DATA_START_INDEX]), CAN_NORMAL_MESSAGE_LEN);
+
+ return CANHAL_RECV_DATABLOCK_SIZE;
+}
+
diff --git a/can_hal/src/can_hal_stm.cpp b/can_hal/src/can_hal_stm.cpp
new file mode 100755
index 0000000..fc24964
--- /dev/null
+++ b/can_hal/src/can_hal_stm.cpp
@@ -0,0 +1,243 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "can_hal_stm.h"
+#include "can_hal_core.h"
+#include "can_hal_internal.h"
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <string>
+#include <stdbool.h>
+#include <stdint.h>
+#include <assert.h>
+#include <pthread.h>
+
+// BSS section would be initialized to all 0.
+struct CanHalStateMachine {
+ CanHalType type;
+ HANDLE h_app;
+ bool can_hal_is_opened;
+ bool device_is_enabled;
+ struct {
+ HANDLE tx;
+ HANDLE tx_sender;
+ uint32_t tx_cmd;
+ const char *tx_name;
+ bool rx_initialized;
+ pthread_t rx;
+ pthread_attr_t rx_attr;
+ } internal;
+} can_hal_stm[NR_CAN_HAL_TYPES];
+
+bool TypeIsValid(enum CanHalType type) {
+ if (CAN_HAL_TYPE_CAN == type)
+ return true;
+
+ return false;
+}
+
+bool IsCanHalOpened(enum CanHalType type) {
+ return can_hal_stm[type].can_hal_is_opened;
+}
+
+void SetCanHalStateOpen(enum CanHalType type) {
+ can_hal_stm[type].can_hal_is_opened = true;
+}
+
+void SetCanHalStateClose(enum CanHalType type) {
+ can_hal_stm[type].can_hal_is_opened = false;
+}
+
+bool IsDeviceEnabled(enum CanHalType type) {
+ return can_hal_stm[type].device_is_enabled;
+}
+
+void SetDeviceStateEnable(enum CanHalType type) {
+ can_hal_stm[type].device_is_enabled = true;
+}
+
+void SetDeviceStateDisable(enum CanHalType type) {
+ can_hal_stm[type].device_is_enabled = false;
+}
+
+CANHAL_RET_API CanHalDestroyInternalThread(HANDLE h_app, enum CanHalType type) {
+ intptr_t ptr = (intptr_t)&(can_hal_stm[type].internal.tx_sender);
+
+ if (can_hal_stm[type].internal.tx) {
+ FrameworkunifiedStopChildThread(h_app, can_hal_stm[type].internal.tx, sizeof(ptr), &ptr);
+ FrameworkunifiedDestroyChildThread(h_app, can_hal_stm[type].internal.tx);
+ can_hal_stm[type].internal.tx = NULL;
+ }
+
+ if (can_hal_stm[type].internal.rx_initialized) {
+ pthread_cancel(can_hal_stm[type].internal.rx);
+ pthread_join(can_hal_stm[type].internal.rx, NULL);
+ can_hal_stm[type].internal.rx_initialized = false;
+ }
+ can_hal_stm[type].h_app = NULL;
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API CanHalCreateInternalThread(HANDLE h_app, enum CanHalType type) {
+ enum CANHAL_RET_API ret = CANHAL_RET_ERR_PARAM;
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+ intptr_t ptr = (intptr_t)&(can_hal_stm[type].internal.tx_sender);
+
+ can_hal_stm[type].h_app = h_app;
+ can_hal_stm[type].internal.tx_name = CANHAL_CAN_SEND_THREAD;
+ can_hal_stm[type].internal.tx = FrameworkunifiedCreateChildThread(h_app,
+ can_hal_stm[type].internal.tx_name,
+ CanSendThreadStart, CanSendThreadStop);
+ if (!can_hal_stm[type].internal.tx)
+ goto cleanup;
+
+ err = FrameworkunifiedStartChildThread(h_app,
+ can_hal_stm[type].internal.tx,
+ sizeof(ptr), &ptr);
+ if (err != eFrameworkunifiedStatusOK)
+ goto cleanup;
+
+ if (0 != pthread_attr_init(&(can_hal_stm[type].internal.rx_attr)))
+ goto cleanup;
+
+ if (0 != pthread_create(&(can_hal_stm[type].internal.rx),
+ &(can_hal_stm[type].internal.rx_attr), CanRecvRun,
+ (void *)&(can_hal_stm[type].type)))
+ goto cleanup;
+
+ can_hal_stm[type].internal.rx_initialized = true;
+ ret = CANHAL_RET_NORMAL;
+ return ret;
+cleanup:
+ if (can_hal_stm[type].internal.tx) {
+ FrameworkunifiedStopChildThread(h_app, can_hal_stm[type].internal.tx, sizeof(ptr), &ptr);
+ FrameworkunifiedDestroyChildThread(h_app, can_hal_stm[type].internal.tx);
+ can_hal_stm[type].internal.tx = NULL;
+ }
+
+ return ret;
+}
+
+CANHAL_RET_API CanHalInternalSend_CWORD118_(enum CanHalType type,
+ const void *msg, ssize_t sz) {
+ EFrameworkunifiedStatus e_status = FrameworkunifiedSendMsg(can_hal_stm[type].internal.tx_sender,
+ TX_INTERNAL__CWORD118_, sz, msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ return CANHAL_RET_ERR_ERR;
+ }
+ return CANHAL_RET_NORMAL;
+}
+
+static EFrameworkunifiedStatus FrameworkunifiedSendMsgOneshot(HANDLE h_app, UI_32 cmd,
+ UI_32 l, PCVOID d) {
+ HANDLE h_client = NULL;
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusFail;
+
+ h_client = FrameworkunifiedMcOpenSender(h_app, FrameworkunifiedGetAppName(h_app));
+ if (!h_client)
+ return err;
+
+ err = FrameworkunifiedSendMsg(h_client, cmd, l, d);
+ FrameworkunifiedMcClose(h_client);
+ return err;
+}
+
+CANHAL_RET_API CanHalInternalSend(enum CanHalType type,
+ const void *msg, ssize_t sz) {
+ EFrameworkunifiedStatus e_status = FrameworkunifiedSendMsg(can_hal_stm[type].internal.tx_sender,
+ TX_INTERNAL, sz, msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ return CANHAL_RET_ERR_ERR;
+ }
+ return CANHAL_RET_NORMAL;
+}
+
+
+CANHAL_RET_API InvokeStateCallback(enum CanHalType type) {
+ HANDLE sender = can_hal_stm[type].h_app;
+ uint32_t cmd = 0;
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+ bool send = true;
+
+ switch (type) {
+ case CAN_HAL_TYPE_CAN:
+ cmd = CID_CANHAL_CMD_CAN_READY;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ err = FrameworkunifiedSendMsgOneshot(sender, cmd, sizeof(send), &send);
+ if (err != eFrameworkunifiedStatusOK)
+ return CANHAL_RET_ERR_ERR;
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API InvokeErrorCallback(HANDLE h_app, enum CanHalType type) {
+ HANDLE sender = h_app;
+ uint32_t cmd = CID_CANHAL_CMD_ERROR_NOTIFY;
+ char msg[CANHAL_ERROR_MESSAGE_LEN] = {0};
+ ssize_t sz = sizeof(msg);
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+
+ switch (type) {
+ case CAN_HAL_TYPE_CAN:
+ sprintf(msg, "Global CAN Stop");
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ err = FrameworkunifiedSendMsgOneshot(sender, cmd, sz, msg);
+ if (err != eFrameworkunifiedStatusOK)
+ return CANHAL_RET_ERR_ERR;
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API CanHalSendStatus(enum CanHalType type, HANDLE h_app,
+ const void *msg, ssize_t sz) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ e_status = FrameworkunifiedSendMsgOneshot(h_app, CID_CANHAL_CMD_CAN_SEND_STATUS, sz, msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ return CANHAL_RET_ERR_ERR;
+ }
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API CanHalReceiveNotify(enum CanHalType type,
+ const void *msg, ssize_t sz) {
+ EFrameworkunifiedStatus e_status;
+ uint32_t cmd = 0;
+
+ switch (type) {
+ case CAN_HAL_TYPE_CAN:
+ cmd = CID_CANHAL_CMD_CAN_RECV;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ e_status = FrameworkunifiedSendMsgOneshot(can_hal_stm[type].h_app, cmd, sz, msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ return CANHAL_RET_ERR_ERR;
+ }
+
+ return CANHAL_RET_NORMAL;
+}
diff --git a/can_hal/src/driver_can__CWORD31_.c b/can_hal/src/driver_can__CWORD31_.c
new file mode 100755
index 0000000..bd9cb29
--- /dev/null
+++ b/can_hal/src/driver_can__CWORD31_.c
@@ -0,0 +1,472 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+#include "can_mng_api.h"
+
+#include <poll.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <linux/can/raw.h>
+#include <net/if.h>
+
+
+#define DUMP_DIR "/nv/driver-can"
+#define DUMP_RCVID "/nv/driver-can/dump_rcvid"
+#define CAN_DATA_SIZE (sizeof(CanData))
+
+static int fd_can = -1;
+static struct sockaddr_can tx_address;
+static CanCtlRcvId RcvId;
+const char* device_name = "vcan0";
+
+static UINT32 getData(CanCtlRcvId*, CanCtlApiCmd*);
+static UINT32 getCanData(unsigned char*);
+static UINT32 copyEnableCandata(UINT16* , unsigned char*, unsigned char*);
+static UINT32 isOpendDriver(void);
+
+UINT32 CanCtlApiOpen(CanCtlApiObj* pClientObj)
+{
+ int err_no;
+ int ret;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+
+ /*----------------------------------------------------------------------*/
+ /* Clear Object */
+ /*----------------------------------------------------------------------*/
+ if (pClientObj != NULL) {
+ memset(pClientObj, 0, sizeof(*pClientObj));
+ }
+
+ if (fd_can != -1) {
+ CAN_MNG_API_LOGT("Already Opened");
+ CAN_MNG_API_LOGT("FUNC OUT");
+ return CAN_CTL_RET_SUCCESS;
+ }
+
+ // open socket
+ CAN_MNG_API_LOGT("open socket start");
+ struct ifreq ifr = {0};
+ fd_can = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+ err_no = errno;
+ CAN_MNG_API_LOGT("open socket end");
+ if (fd_can == -1) {
+ CAN_MNG_API_LOGE("Socket Open Error.");
+ CAN_MNG_API_LOGE("(errno[%d]).", err_no);
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ // ioctl(SIOCGIFINDEX)
+ strcpy(ifr.ifr_name, device_name);
+ ret = ioctl(fd_can, SIOCGIFINDEX, &ifr);
+ err_no = errno;
+ if (ret < 0) {
+ CAN_MNG_API_LOGE("ioctl(SIOCGIFINDEX) Error.");
+ CAN_MNG_API_LOGE("(errno[%d]).", err_no);
+ (void)close(fd_can);
+ fd_can = -1;
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ // bind
+ tx_address.can_family = AF_CAN;
+ tx_address.can_ifindex = ifr.ifr_ifindex;
+
+ ret = bind(fd_can, (struct sockaddr *)&tx_address, sizeof(tx_address));
+ err_no = errno;
+ if (ret < 0) {
+ CAN_MNG_API_LOGE("Socket Bind Error.");
+ CAN_MNG_API_LOGE("(errno[%d]).", err_no);
+ (void)close(fd_can);
+ fd_can = -1;
+ return -1;
+ }
+
+ // Initialize RcvId Map
+ memset(&RcvId, 0, sizeof(RcvId));
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+UINT32 CanCtlApiClose(CanCtlApiObj* pClientObj)
+{
+ /*----------------------------------------------------------------------*/
+ /* Clear Object */
+ /*----------------------------------------------------------------------*/
+ if (pClientObj != NULL) {
+ memset(pClientObj, 0, sizeof(*pClientObj));
+ }
+
+ if (fd_can != -1) {
+ (void)close(fd_can);
+ }
+
+ // Initialize fd info
+ fd_can = -1;
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+UINT32 CanCtlApiSndCmd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pSndCmd)
+{
+ int i;
+ printf("%s: call_id=0x%x len=%d\n",
+ __func__, pClientObj->call_id, pSndCmd->len);
+ for (i = 0; i < pSndCmd->len; i++) {
+ printf("[%d]0x%x ", i, pSndCmd->data[i]);
+ if ((i != 0) && ((i % 7) == 0))
+ printf("\n");
+ }
+ printf("\n");
+
+
+ int ret;
+ int err_no;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+ /*----------------------------------------------------------------------*/
+ /* Check Input Value */
+ /*----------------------------------------------------------------------*/
+ if (NULL == pSndCmd)
+ {
+ CAN_MNG_API_LOGE("%s(%p) invalid parameter.", __func__, pSndCmd);
+ return CAN_CTL_RET_ERR_PARAM;
+ }
+
+ ret = isOpendDriver();
+ if (ret != CAN_CTL_RET_SUCCESS) {
+ CAN_MNG_API_LOGE("Not Open Driver.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ struct can_frame frame = {0};
+
+ frame.can_id = pSndCmd->data[1] & 0x7F;
+ frame.can_id <<= 4;
+ frame.can_id |= (pSndCmd->data[2] & 0xF0) >> 4;
+ frame.can_dlc = pSndCmd->data[3];
+ frame.data[0] = pSndCmd->data[4];
+ frame.data[1] = pSndCmd->data[5];
+ frame.data[2] = pSndCmd->data[6];
+ frame.data[3] = pSndCmd->data[7];
+ frame.data[4] = pSndCmd->data[8];
+ frame.data[5] = pSndCmd->data[9];
+ frame.data[6] = pSndCmd->data[10];
+ frame.data[7] = pSndCmd->data[11];
+
+ CAN_MNG_API_LOGT("write() CanDataExtSendNotif start size = %d", (int)sizeof(frame));
+ ret = write(fd_can, &frame, sizeof(frame));
+ err_no = errno;
+ CAN_MNG_API_LOGE("write() ret = %d).", ret);
+
+ CAN_MNG_API_LOGT("write() CanDataExtSendNotif end");
+ if (ret == -1) {
+ CAN_MNG_API_LOGE("write() error(errno[%d]).", err_no);
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+UINT32 CanCtlApiSetRcvId(CanCtlApiObj* pClientObj, CanCtlRcvId* pRcvId)
+{
+ FILE* fp;
+ size_t nmemb;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+ /*----------------------------------------------------------------------*/
+ /* Check Input Value */
+ /*----------------------------------------------------------------------*/
+ if (NULL == pRcvId)
+ {
+ CAN_MNG_API_LOGE("%s(%p) invalid parameter.", __func__, pRcvId);
+ return CAN_CTL_RET_ERR_PARAM;
+ }
+
+ struct stat st;
+ int ret = 0;
+ if (stat(DUMP_DIR, &st) != 0) {
+ ret = mkdir(DUMP_DIR, 0755);
+ }
+ if (ret != 0) {
+ CAN_MNG_API_LOGE("Can not Created RcvId Dump dir.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+ CAN_MNG_API_LOGT("fopen(DUMP_RCVID) start");
+ fp = fopen(DUMP_RCVID, "wb");
+ CAN_MNG_API_LOGT("fopen(DUMP_RCVID) end");
+ if (fp == NULL) {
+ CAN_MNG_API_LOGE("Can not Opened RcvId Dump file.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("fwrite(pRcvId) start");
+ nmemb = fwrite(pRcvId, sizeof(CanCtlRcvId), 1, fp);
+ CAN_MNG_API_LOGT("fwrite(pRcvId) end");
+ if (nmemb != 1) {
+ CAN_MNG_API_LOGE("RcvId Dump file write error.");
+ (void)fclose(fp);
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("fclose() start");
+ (void)fclose(fp);
+ CAN_MNG_API_LOGT("fclose() end");
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+UINT32 CanCtlApiRcvCmd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pRcvCmd)
+{
+ int ret;
+ int enable_ret;
+
+ CanCtlRcvId InitialRcvId;
+ CanCtlRcvId RcvId;
+ FILE* fp;
+ size_t nmemb;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+ /*----------------------------------------------------------------------*/
+ /* Check Input Value */
+ /*----------------------------------------------------------------------*/
+ if (NULL == pRcvCmd)
+ {
+ CAN_MNG_API_LOGE("%s(%p) invalid parameter.", __func__, pRcvCmd);
+ return CAN_CTL_RET_ERR_PARAM;
+ }
+
+ ret = isOpendDriver();
+ if (ret != CAN_CTL_RET_SUCCESS) {
+ CAN_MNG_API_LOGE("Not Open Driver.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ // Restore RcvId
+ CAN_MNG_API_LOGT("fopen(DUMP_RCVID) start");
+ fp = fopen(DUMP_RCVID, "rb");
+ CAN_MNG_API_LOGT("fopen(DUMP_RCVID) end");
+ if (fp == NULL) {
+ CAN_MNG_API_LOGE("Can not Opened RcvId Dump file.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("fread(RcvId) start");
+ nmemb = fread(&RcvId, sizeof(CanCtlRcvId), 1, fp);
+ CAN_MNG_API_LOGT("fread(RcvId) end");
+ if (nmemb != 1) {
+ CAN_MNG_API_LOGE("RcvId Dump file read error.");
+ (void)fclose(fp);
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("fclose() start");
+ (void)fclose(fp);
+ CAN_MNG_API_LOGT("fclose() end");
+
+ memset(&InitialRcvId.id, 0, sizeof(InitialRcvId.id));
+
+ if (memcmp(InitialRcvId.id, RcvId.id, sizeof(RcvId.id)) == 0) {
+ CAN_MNG_API_LOGE("No RecvId Maps.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ enable_ret = getData(&RcvId, pRcvCmd);
+
+ if (enable_ret != CAN_CTL_RET_SUCCESS) {
+ CAN_MNG_API_LOGE("No data founds.");
+ return enable_ret;
+ }
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+static UINT32 getData(CanCtlRcvId* pRcvId, CanCtlApiCmd* pRcvCmd) {
+ int ret;
+ int total_cnt = 0;
+ int copy_cnt = 0;
+ int i;
+ unsigned char can_data[CAN_CTL_CMD_LEN_MAX+1];
+ unsigned char enable_can_data[CAN_CTL_CMD_LEN_MAX];
+ unsigned char store_can_data[CAN_CTL_CMD_LEN_MAX];
+ unsigned char* scd;
+
+
+ UINT16 id_map[CAN_CTL_CMD_ID_HI_NUM];
+
+ CAN_MNG_API_LOGT("FUNC IN");
+
+ memcpy(id_map, pRcvId->id, sizeof(id_map));
+
+ memset(store_can_data, 0, sizeof(store_can_data));
+ scd = store_can_data;
+
+ while(1) {
+ memset(can_data, 0, sizeof(can_data));
+ memset(enable_can_data, 0, sizeof(enable_can_data));
+ ret = getCanData(can_data);
+ if (ret != CAN_CTL_RET_SUCCESS) {
+ // In case of error, read next data
+ CAN_MNG_API_LOGE("getCanData error.");
+ continue;
+ }
+
+ // Extract data of "CAN data extended reception notification 4"
+ copy_cnt = copyEnableCandata(id_map, can_data, enable_can_data);
+ if( copy_cnt == 0 ){
+ continue;
+ }
+
+ // Store in work buffer
+ for (i = 0; i < copy_cnt; i++) {
+ if (total_cnt >= CAN_CTL_MAX_RCV_CAN_SIZE) {
+ CAN_MNG_API_LOGE("buffer over");
+ break;
+ }
+ memcpy(scd, &enable_can_data[CAN_DATA_SIZE * i], CAN_DATA_SIZE);
+ scd = scd + CAN_DATA_SIZE;
+ total_cnt++;
+ }
+
+ // Check work buffer overflow
+ if (total_cnt >= CAN_CTL_MAX_RCV_CAN_SIZE) {
+ CAN_MNG_API_LOGE("buffer over");
+ break;
+ }
+ }
+
+ // If data exists, set and return
+ if (total_cnt != 0) {
+ pRcvCmd->len = 1 + (total_cnt * CAN_DATA_SIZE);
+ pRcvCmd->data[0] = total_cnt;
+ memcpy( &(pRcvCmd->data[1]), store_can_data, (total_cnt * CAN_DATA_SIZE));
+ } else {
+ // If there is no data, return with length 0
+ pRcvCmd->len = 0;
+ memset( &(pRcvCmd->data[0]), 0, sizeof(UINT8) * CAN_DAT_LEN_MAX );
+ CAN_MNG_API_LOGE("data not found");
+ }
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+static UINT32 getCanData(unsigned char *can_data) {
+ int err_no;
+ int i;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+
+ CAN_MNG_API_LOGE("recvfrom start");
+
+ int nbytes = 0;
+ struct can_frame frame = {0};
+ socklen_t addrlen = sizeof(struct sockaddr_can);
+ nbytes = recvfrom(fd_can, &frame, sizeof(frame), 0, (struct sockaddr*)&tx_address, &addrlen);
+ err_no = errno;
+ CAN_MNG_API_LOGE("recvfrom end ret = %d",nbytes);
+ if (nbytes == -1) {
+ CAN_MNG_API_LOGE("Not Read CAN Driver(errno[%d]).", err_no);
+ return CAN_CTL_RET_ERR_ERR;
+ } else if (nbytes != CAN_MTU) {
+ CAN_MNG_API_LOGE("Receive Error size: %d.", nbytes);
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("Recvfrom CAN Data(start)");
+ can_data[0] = (frame.can_id & 0x7F0) >> 4;
+ can_data[1] = (frame.can_id & 0x0F) << 4;
+ can_data[2] = frame.can_dlc;
+ for (i = 0; i < frame.can_dlc; i++) {
+ can_data[3+i] = frame.data[i];
+ CAN_MNG_API_LOGE(" 0x%02x", frame.data[i]);
+ }
+ CAN_MNG_API_LOGT("");
+ CAN_MNG_API_LOGT("Recvfrom Data(end)");
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+ return CAN_CTL_RET_SUCCESS;
+}
+
+static UINT32 copyEnableCandata(UINT16* id_map, unsigned char* can_data, unsigned char* enable_can_data) {
+ int id;
+ UINT16 val;
+ unsigned char* ecd = enable_can_data;
+ UINT32 count = 0;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+ // Search data of "CAN data extended reception notification 4"
+ id = can_data[0];
+ val = can_data[1] >> 4; // Shift right 4 bits and determine search position
+
+ CAN_MNG_API_LOGE("data id =%x", id);
+ CAN_MNG_API_LOGE("data val=%x", val);
+ CAN_MNG_API_LOGE("file val=%x", id_map[id]);
+
+ // If the target data is found (If the bit is on ?)
+ if ((id_map[id] & (0x01 << val)) != 0) {
+ CAN_MNG_API_LOGT("matched.");
+ CAN_MNG_API_LOGE("id_map[%u]", id_map[id]);
+
+ // Store data in work buffer
+ memcpy(ecd, &can_data[0], CAN_DATA_SIZE);
+ count++;
+ }
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+ return count;
+}
+
+UINT32 CanCtlApiRcvSpd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pRcvCmd)
+{
+ // Note.
+ // If vendor needs the special implementation about receiving the vehicle speed,
+ // it should be implemented by vendor.
+ return CAN_CTL_RET_SUCCESS;
+}
+
+static UINT32 isOpendDriver() {
+ CAN_MNG_API_LOGT("FUNC IN");
+
+ if (fd_can == -1) {
+ CAN_MNG_API_LOGE("Not Open CAN Driver.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+ return CAN_CTL_RET_SUCCESS;
+}
diff --git a/can_hal/src/inc/can_hal_core.h b/can_hal/src/inc/can_hal_core.h
new file mode 100755
index 0000000..57a9c9d
--- /dev/null
+++ b/can_hal/src/inc/can_hal_core.h
@@ -0,0 +1,37 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CAN_HAL_CORE_H_
+#define _CAN_HAL_CORE_H_
+#include <stdint.h>
+#include "can_hal.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+CANHAL_RET_API CanOpenCore(CanHalType type);
+CANHAL_RET_API CanCloseCore(CanHalType type);
+EFrameworkunifiedStatus CanSendThreadStart(HANDLE h_app);
+EFrameworkunifiedStatus CanSendThreadStop(HANDLE h_app);
+void *CanRecvRun(void *arg);
+void *CanHalPackMessage(HANDLE h_app, const void *msg, ssize_t msg_sz,
+ ssize_t *packed_sz);
+void CanHalUnPackMessage(void *packed, HANDLE *h_app, void **msg,
+ ssize_t *msg_sz);
+void CanHalDestroyPackedMessage(void *packed);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/can_hal/src/inc/can_hal_frameworkunifiedlog.h b/can_hal/src/inc/can_hal_frameworkunifiedlog.h
new file mode 100755
index 0000000..f3a5f50
--- /dev/null
+++ b/can_hal/src/inc/can_hal_frameworkunifiedlog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_CAN_HAL_FRAMEWORKUNIFIEDLOG_H_
+#define INC_CAN_HAL_FRAMEWORKUNIFIEDLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+#endif // INC_CAN_HAL_FRAMEWORKUNIFIEDLOG_H_
diff --git a/can_hal/src/inc/can_hal_internal.h b/can_hal/src/inc/can_hal_internal.h
new file mode 100755
index 0000000..f42a73f
--- /dev/null
+++ b/can_hal/src/inc/can_hal_internal.h
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_CAN_HAL_INTERNAL_H_
+#define INC_CAN_HAL_INTERNAL_H_
+
+/**
+ * \~english Name of the CAN send thread
+ */
+#define CANHAL_CAN_SEND_THREAD "HalCANSend"
+
+enum CanHalInternalCmd {
+ INVALID_CMD = 0,
+ TX_INTERNAL,
+ TX_INTERNAL__CWORD118_
+};
+
+#endif // INC_CAN_HAL_INTERNAL_H_
diff --git a/can_hal/src/inc/can_hal_stm.h b/can_hal/src/inc/can_hal_stm.h
new file mode 100755
index 0000000..cd07814
--- /dev/null
+++ b/can_hal/src/inc/can_hal_stm.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CAN_HAL_STM_H_
+#define _CAN_HAL_STM_H_
+#include "can_hal.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+bool TypeIsValid(enum CanHalType type);
+bool IsCanHalOpened(enum CanHalType type);
+void SetCanHalStateOpen(enum CanHalType type);
+void SetCanHalStateClose(enum CanHalType type);
+bool IsDeviceEnabled(enum CanHalType type);
+void SetDeviceStateEnable(enum CanHalType type);
+void SetDeviceStateDisable(enum CanHalType type);
+CANHAL_RET_API InvokeStateCallback(enum CanHalType type);
+CANHAL_RET_API InvokeErrorCallback(HANDLE h_app, enum CanHalType type);
+CANHAL_RET_API CanHalInternalSend(enum CanHalType type,
+ const void *msg, ssize_t sz);
+CANHAL_RET_API CanHalInternalSend_CWORD118_(enum CanHalType type,
+ const void *msg, ssize_t sz);
+CANHAL_RET_API CanHalSendStatus(enum CanHalType type, HANDLE h_app,
+ const void *msg, ssize_t sz);
+CANHAL_RET_API CanHalReceiveNotify(enum CanHalType type,
+ const void *msg, ssize_t sz);
+CANHAL_RET_API CanHalCreateInternalThread(HANDLE h_app, enum CanHalType type);
+CANHAL_RET_API CanHalDestroyInternalThread(HANDLE h_app, enum CanHalType type);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/can_hal/src/inc/can_mng_api.h b/can_hal/src/inc/can_mng_api.h
new file mode 100755
index 0000000..ef03750
--- /dev/null
+++ b/can_hal/src/inc/can_mng_api.h
@@ -0,0 +1,120 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CAN_MNG_API_H__
+#define __CAN_MNG_API_H__
+
+/** @includes
+ *
+ */
+
+/** @define
+ *
+ */
+#ifndef UINT8
+#define UINT8 unsigned char
+#endif
+#ifndef UINT16
+#define UINT16 unsigned short
+#endif
+#ifndef INT32
+#define INT32 int
+#endif
+#ifndef UINT32
+#define UINT32 unsigned int
+#endif
+
+/*------------------------------------------*/
+/* Log */
+/*------------------------------------------*/
+#if defined(CAN_MNG_API_FORCE_DEBUG)
+ #define CAN_MNG_API_LOGT(fmt,...) fprintf(stderr, "[T][CAN_API] %s(%s)(%d):" fmt "\n", __FILE__, __func__, __LINE__, ## __VA_ARGS__)
+ #define CAN_MNG_API_LOGD(fmt,...) fprintf(stderr, "[D][CAN_API] %s(%s)(%d):" fmt "\n", __FILE__, __func__, __LINE__, ## __VA_ARGS__)
+ #define CAN_MNG_API_LOGE(fmt,...) fprintf(stderr, "[E][CAN_API] %s(%s)(%d):" fmt "\n", __FILE__, __func__, __LINE__, ## __VA_ARGS__)
+#else
+ #define CAN_MNG_API_LOGT(fmt,...)
+ #define CAN_MNG_API_LOGD(fmt,...)
+ #define CAN_MNG_API_LOGE(fmt,...)
+#endif
+/*------------------------------------------*/
+/* API return value */
+/*------------------------------------------*/
+#define CAN_CTL_RET_SUCCESS 0 /* Normal end */
+#define CAN_CTL_RET_ERR_PARAM -1 /* Parameter error */
+#define CAN_CTL_RET_ERR_NOSVC -2 /* Service not open error */
+#define CAN_CTL_RET_ERR_ERR -3 /* Other error */
+
+/*------------------------------------------*/
+/* Received command information */
+/*------------------------------------------*/
+#define CAN_CTL_CMD_LEN_MAX 255 /* Maximum data length */
+#define CAN_DAT_LEN_MAX CAN_CTL_CMD_LEN_MAX /* Maximum data length */
+#define CAN_CTL_CMD_ID_HI_NUM 128 /* Number of higher CAN-ID(8bit) (00 to 7F) */
+
+#define CAN_CTL_MAX_RCV_CAN_SIZE 23
+
+/** @typedefs
+ *
+ */
+/* Object for CAN communication control API */
+typedef struct _CanCtlApiObj {
+ /* ID assigned to the command reception notification callback */
+ INT32 call_id;
+} CanCtlApiObj ;
+
+/* CAN command structure */
+typedef struct _CanCtlApiCmd {
+ UINT8 len; /* Data length */
+ UINT8 data[CAN_DAT_LEN_MAX]; /* Data */
+} CanCtlApiCmd;
+
+/* Received ID MAP information */
+typedef struct _CanCtlRcvId {
+ UINT16 id[CAN_CTL_CMD_ID_HI_NUM]; /* CAN ID MAP(000~7FF) */
+} CanCtlRcvId;
+
+
+/* CAN Frame structure */
+typedef union {
+ UINT8 Data[2];
+} CanId;
+
+#define LCN_SRV_MSB_FRAME_DAT_SIZE (8) /* MSB send/receive frame data size */
+
+typedef struct _CanData {
+ CanId id; /* CAN Frame structure */
+ UINT8 dlc; /* Valid bytes of DATA#1~#8. DLC is 1 to 8. */
+ UINT8 Data[LCN_SRV_MSB_FRAME_DAT_SIZE]; /* Receive data */
+ /* Data of DLC size is valid, otherwise set to 0 as invalid value. */
+} CanData;
+
+/** @forward declarations
+ *
+ */
+/* API prototype */
+#ifdef __cplusplus
+extern "C" {
+#endif
+UINT32 CanCtlApiOpen(CanCtlApiObj* pClientObj);
+UINT32 CanCtlApiClose(CanCtlApiObj* pClientObj);
+UINT32 CanCtlApiSndCmd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pSndCmd);
+UINT32 CanCtlApiSetRcvId(CanCtlApiObj* pClientObj, CanCtlRcvId* pRcvId);
+UINT32 CanCtlApiRcvCmd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pRcvCmd);
+UINT32 CanCtlApiRcvSpd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pRcvCmd);
+#ifdef __cplusplus
+}
+#endif
+#endif /* __CAN_MNG_API_H__ */
diff --git a/clock_hal/LICENSE b/clock_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/clock_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/clock_hal/Makefile b/clock_hal/Makefile
new file mode 100755
index 0000000..e417a15
--- /dev/null
+++ b/clock_hal/Makefile
@@ -0,0 +1,67 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libclock_hal.so
+
+HEADER := hal_api/clock_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+CXXFLAGS += -DAGL_REFHW
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := clock_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/clock_hal/README.md b/clock_hal/README.md
new file mode 100755
index 0000000..0443f95
--- /dev/null
+++ b/clock_hal/README.md
@@ -0,0 +1,3 @@
+clock_hal library
+==================
+Clock HAL implementation library for AGL Reference Board.
diff --git a/clock_hal/hal_api/clock_hal.h b/clock_hal/hal_api/clock_hal.h
new file mode 100755
index 0000000..8006b32
--- /dev/null
+++ b/clock_hal/hal_api/clock_hal.h
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HAL_API_CLOCK_HAL_H_
+#define HAL_API_CLOCK_HAL_H_
+/**
+ * @file clock_hal.h
+ */
+#include <time.h>
+
+#include <native_service/frameworkunified_types.h>
+/** @addtogroup clock
+ * @{
+ */
+/** @addtogroup clock_hal
+ * @ingroup clock
+ * @{
+ */
+/**
+ * \ingroup SetHardwareClock
+ * \~english @par Brief
+ * API to set the RTC.
+ * \~english @param [in] h_app
+ * HANDLE - Handle for Application
+ * \~english @param [in] l_tm
+ * const struct tm * - pointer to the time will be set
+ * \~english @retval eFrameworkunifiedStatusOK : Ok
+ * \~english @retval eFrameworkunifiedStatusFail : Failed
+ * \~english @retval eFrameworkunifiedStatusInvldHandle : parameter "h_app" is NULL
+ * \~english @retval eFrameworkunifiedStatusNullPointer : parameter "l_tm" is NULL
+ * \~english @par Prerequisite
+ * - /dev/rtc node is exist, rtc driver is availability.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Set time to RTC failed. [eFrameworkunifiedStatusFail]
+ * - The parameter "l_tm" is NULL. [eFrameworkunifiedStatusNullPointer]
+ * - The parameter "h_app" is NULL. [eFrameworkunifiedStatusInvldHandle]
+ * \~english @par Detail
+ * - Set time to RTC.
+ * - The API can be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+EFrameworkunifiedStatus SetHardwareClock(HANDLE h_app, const struct tm *l_tm);
+
+
+/**@}*/ // end of clock_hal
+/**@}*/ // end of clock
+
+#endif // HAL_API_CLOCK_HAL_H_
diff --git a/clock_hal/inc/clock_hal_clockhallog.h b/clock_hal/inc/clock_hal_clockhallog.h
new file mode 100755
index 0000000..6ed5de5
--- /dev/null
+++ b/clock_hal/inc/clock_hal_clockhallog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_CLOCK_HAL_CLOCKHALLOG_H_
+#define INC_CLOCK_HAL_CLOCKHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_CLOCK_HAL_CLOCKHALLOG_H_
diff --git a/clock_hal/src/clock_hal.cpp b/clock_hal/src/clock_hal.cpp
new file mode 100755
index 0000000..cccbd5b
--- /dev/null
+++ b/clock_hal/src/clock_hal.cpp
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "clock_hal.h"
+
+#include <assert.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <linux/rtc.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+#include "clock_hal_clockhallog.h"
+
+#define RTC_NODE_PATH_DEPTH 64
+#define RTC_NODE_PERANT_PATH "/dev"
+
+// set time to hardware
+EFrameworkunifiedStatus SetHardwareClock(HANDLE h_app, const struct tm *l_tm) {
+ if (NULL == h_app) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+ if (NULL == l_tm) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ struct rtc_time hal_rtc_time;
+ hal_rtc_time.tm_year = l_tm->tm_year;
+ hal_rtc_time.tm_mon = l_tm->tm_mon;
+ hal_rtc_time.tm_mday = l_tm->tm_mday;
+ hal_rtc_time.tm_hour = l_tm->tm_hour;
+ hal_rtc_time.tm_min = l_tm->tm_min;
+ hal_rtc_time.tm_sec = l_tm->tm_sec;
+ hal_rtc_time.tm_wday = l_tm->tm_wday;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "setting time : %d-%02d/%02d %02d:%02d:%02d\n",
+ 1900 + l_tm->tm_year, l_tm->tm_mon + 1, l_tm->tm_mday,
+ l_tm->tm_hour, l_tm->tm_min, l_tm->tm_sec);
+
+ // Search RTC node
+ DIR *dir = ::opendir(RTC_NODE_PERANT_PATH);
+ char rtc_path[RTC_NODE_PATH_DEPTH] = { '\0' };
+ for (struct dirent *dp = readdir(dir); dp != NULL; dp = readdir(dir)) {
+ if (strstr(dp->d_name, "rtc") != NULL) {
+ snprintf(rtc_path, sizeof(rtc_path), "/dev/%s", dp->d_name);
+ break;
+ }
+ }
+ closedir(dir);
+ if (strlen(rtc_path) == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "/dev/rtcX not found.\n");
+ e_status = eFrameworkunifiedStatusFail;
+ return e_status;
+ }
+
+ // Set time to /dev/rtcX
+ int fd = ::open(rtc_path, O_WRONLY);
+ if (-1 == fd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error open(/dev/rtc)=[%d] errno=%d\n",
+ fd, errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ int ret = ::ioctl(fd, RTC_SET_TIME, &hal_rtc_time);
+ if (0 != ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Error ioctl(fd, RTC_SET_TIME, hal_rtc_time)=[%d] errno=%d\n",
+ ret, errno);
+ e_status = eFrameworkunifiedStatusFail;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Success ioctl(fd, RTC_SET_TIME, hal_rtc_time)=[%d]\n", ret);
+ }
+ ::close(fd);
+ return e_status;
+}
diff --git a/deck_hal/LICENSE b/deck_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/deck_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/deck_hal/Makefile b/deck_hal/Makefile
new file mode 100755
index 0000000..fbe4ddf
--- /dev/null
+++ b/deck_hal/Makefile
@@ -0,0 +1,67 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libdeck_hal.so
+
+HEADER := hal_api/deck_hal.h
+
+######### include paths/files ###################
+CXXFLAGS += -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH := /usr/lib
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+
+######### source files ##########################
+VPATH += src
+OBJS := deck_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=:$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/deck_hal/hal_api/deck_hal.h b/deck_hal/hal_api/deck_hal.h
new file mode 100755
index 0000000..74aa19a
--- /dev/null
+++ b/deck_hal/hal_api/deck_hal.h
@@ -0,0 +1,322 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!-----------------------------------------------------------------------------
+ * @file deck_hal.h
+ * @~english
+ * @brief deck_hal API head
+ *
+ */
+
+#ifndef HAL_API_DECK_HAL_H_
+#define HAL_API_DECK_HAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * @file deck_hal.h
+ */
+
+/** @addtogroup interface_unified
+ * @{
+ */
+/** @addtogroup deck_hal
+ * @ingroup interface_unified
+ * @{
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif /*__cplusplus*/
+
+/*! @~english Maximum length of command data division */
+#define DECK_CMD_SIZE_CMDDATA_MAX 252
+/*! @~english Maximum length of notification destination */
+#define NOTIFY_NAME_MAX_SIZE 15
+
+// CID_DECK_SYS_DELIVERY is for deck_hal to report correspinding message to vehicle,
+// the value 0x40 can be changed in the future
+/**
+ * \~english @brief DECK SYS Command-Delivery Notification
+ * \~english @brief If you want to receive this DECK SYS command-delivery notification, use the NSFW IF as follows:
+ * \~english @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, DECKHAL_THREAD, CID_DECK_SYS_DELIVERY, LineSensDrvRcvDeckHal);
+ * @endcode
+ */
+#define CID_DECK_SYS_DELIVERY 0x40
+
+/*!
+ * @~english
+ * @brief Disc eject mode
+*/
+typedef enum {
+ /*! @~english normal eject */
+ DECK_EJECT_NORMAL,
+ /*! @~english forced eject */
+ DECK_EJECT_FORCED
+} DeckEjectMode;
+
+/*!
+ * @~english
+ * @brief Disc mode
+*/
+typedef enum {
+ /*! @~english CD */
+ DECK_KIND_CD,
+ /*! @~english DVD */
+ DECK_KIND_DVD,
+ /*! @~english Blue-lay disc */
+ DECK_KIND_BD
+} DeckKind;
+
+/*------------------------------------------------------------------------------
+ * typedefs
+ *----------------------------------------------------------------------------*/
+/**
+ * \~english Deck-Sys command header structure
+ */
+typedef struct {
+ /*! @~english Source logical address */
+ uint8_t lgadr_from;
+ /*! @~english Forwarding destination logical address */
+ uint8_t lgadr_to;
+ /*! @~english OP code */
+ uint8_t opc;
+ /*! @~english Reserve */
+ uint8_t reserve;
+} DeckCmdhdr;
+
+/**
+ * \~english Deck-Sys command body structure
+ */
+typedef struct DeckCmd {
+ /*! @~english Deck-Sys command header */
+ DeckCmdhdr cmdhdr;
+ /*! @~english Data length */
+ uint16_t data_length;
+ /*! @~english Reserve */
+ uint16_t reserve;
+ /*! @~english Command data */
+ uint8_t data[DECK_CMD_SIZE_CMDDATA_MAX];
+} DeckCmd;
+
+/*!
+ * @~english
+ * @brief Structure for message header
+ */
+typedef struct {
+ uint16_t replyid; //!< \~english Send Result ID
+ uint16_t sndpno; //!< \~english Send process No
+ uint16_t respno; //!< \~english Response No
+ uint16_t cid; //!< \~english Command ID
+ uint16_t msgbodysize; //!< \~english Message body size
+ uint8_t rid; //!< \~english Resource ID
+ uint8_t reserve; //!< \~english Reserve
+ uint8_t filler[2]; //!< \~english filler
+} DECK_HEADER_COMM;
+
+/*!
+ * @~english
+ * @brief Structure for buffer message header
+ */
+typedef struct {
+ uint32_t signo; //!< \~english Signal No
+ DECK_HEADER_COMM hdr; //!< \~english Message Header
+} DECK_MSGBUF_HEADER_COMM;
+
+/**
+ * \~english Delivery message structure
+ */
+typedef struct {
+ /*! @~english Header part */
+ DECK_MSGBUF_HEADER_COMM hdr;
+ /*! @~english Physical address */
+ uint16_t phyadr_from;
+ /*! @~english Communication type */
+ uint8_t service_type;
+ /*! @~english Reserve */
+ uint8_t reserve;
+ /*! @~english Data section */
+ DeckCmd cmd;
+} DECK_MSG_DELIVERY;
+
+/*!
+ * @~english
+ * @brief Structure for send command data
+ */
+typedef struct {
+ /*! @~english Physical address */
+ uint16_t phyadr_from;
+ /*! @~english Communication type */
+ uint8_t service_type;
+ /*! @~english Forwarding former logic address */
+ uint8_t lgadr_from;
+ /*! @~english Forwarding site logic address */
+ uint8_t lgadr_to;
+ /*! @~english Operation code */
+ uint8_t opc;
+ /*! @~english Data length (size in command data */
+ uint8_t d_length;
+ /*! @~english Command data */
+ uint8_t data[DECK_CMD_SIZE_CMDDATA_MAX];
+ /*! @~english reserve */
+ uint8_t reserve;
+} DECK_CMD_DATA;
+
+/*!
+ * @~english
+ * @brief Structure for send command
+ */
+typedef struct {
+ /*! @~english Command information */
+ DECK_CMD_DATA cmd_data;
+} DECK_CMD;
+
+/*------------------------------------------------------------------------------
+ * function declaration
+ *----------------------------------------------------------------------------*/
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StopDiscRotation
+/// \~english @par Brief
+/// Stop disc rotation
+/// \~english @param [in] -
+/// \~english @param [out] -
+/// \~english @retval eFrameworkunifiedStatusOK OK
+/// \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+/// \~english @par Prerequisite
+/// - Disc was inserted
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Error occurs when call open or ioctl function.[eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Stop disc rotation
+/// - Whatever disc is rotating or stoped, return successed.
+/// - The API can be used by multi-process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus StopDiscRotation();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EjectDisc
+/// \~english @par Brief
+/// Eject disc
+/// \~english @param [in] kind
+/// DeckKind - kind of deck.
+/// \~english @param [in] mode
+/// DeckEjectMode - eject mode(normal/forcedly)
+/// \~english @param [out] -
+/// \~english @retval eFrameworkunifiedStatusOK OK
+/// \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Error occurs when call open or ioctl function.[eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Eject disc
+/// - Whatever disc is Ejecting or Unejected, return successed.
+/// - The API can be used by multi-process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus EjectDisc(DeckKind kind, DeckEjectMode mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DeckHalSysSend
+/// \~english @par Brief
+/// Send Disc Sys-Command to MICON
+/// \~english @param [in] h_app
+/// HANDLE - Handle of caller (Handle to get in Dispatcher generation
+/// (FrameworkunifiedCreateDispatcherWithoutLoop etc.))
+/// \~english @param [in] name
+/// PCSTR - Name to notification of send result destination thread name
+/// \~english @param [in] cmd
+/// DECK_CMD - Send command pointer
+/// \~english @param [in] req_id
+/// uint8_t - Resource ID
+/// \~english @param [out] -
+/// \~english @retval eFrameworkunifiedStatusOK Normal termination
+/// \~english @retval eFrameworkunifiedStatusInvldParam Abnormal parameter
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[eFrameworkunifiedStatusInvldParam]
+/// - name is NULL or the length of name is longer than 15 bytes.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Send command pointer(cmd) is null.[eFrameworkunifiedStatusInvldParam]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Send SYS command to MICON
+/// - Now only usb disc exists,MICON disc is stub now.
+/// - The API can only be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DeckHalSysSend(HANDLE h_app, PCSTR name, const DECK_CMD* cmd, uint8_t req_id);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DeckHalRegister
+/// \~english @par Brief
+/// Register the deck_hal command to receive from MICON
+/// \~english @param [in] h_app
+/// HANDLE - Handle of caller (Handle to get in Dispatcher generation
+/// (FrameworkunifiedCreateDispatcherWithoutLoop etc.))
+/// \~english @param [in] notify_name
+/// PCSTR - Name to notification destination thread name
+/// \~english @param [out] -
+/// \~english @retval eFrameworkunifiedStatusOK Normal termination
+/// \~english @retval eFrameworkunifiedStatusInvldParam Abnormal parameter
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[eFrameworkunifiedStatusInvldParam]
+/// - notify_name is NULL or the length of notify_name is longer than 15 bytes.
+/// [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - After call this API, the user can received dech_hal command from MICON.
+/// - Now MICON is stub,so that deck_hal won't register to MICON.
+/// - The API can only be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DeckHalRegister(HANDLE h_app, PCSTR notify_name);
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus */
+
+/** @}*/ // end of deck_hal
+/** @}*/ // end of interface_unified
+
+#endif // HAL_API_DECK_HAL_H_
diff --git a/deck_hal/inc/deck_hal_deckhallog.h b/deck_hal/inc/deck_hal_deckhallog.h
new file mode 100755
index 0000000..9aa4624
--- /dev/null
+++ b/deck_hal/inc/deck_hal_deckhallog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_DECK_HAL_DECKHALLOG_H_
+#define INC_DECK_HAL_DECKHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_DECK_HAL_DECKHALLOG_H_
diff --git a/deck_hal/src/deck_hal.cpp b/deck_hal/src/deck_hal.cpp
new file mode 100755
index 0000000..a116e6c
--- /dev/null
+++ b/deck_hal/src/deck_hal.cpp
@@ -0,0 +1,159 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <fcntl.h>
+#include <unistd.h>
+#include <linux/cdrom.h>
+#include <sys/ioctl.h>
+#include <deck_hal.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <stdio.h>
+#include <string.h>
+#include "deck_hal_deckhallog.h"
+
+#define DECKHAL_THREAD "DeckHal"
+#define DISC_PATH "/dev/sr0"
+// static variables
+static char g_notify_name[NOTIFY_NAME_MAX_SIZE + 1] = {0};
+static bool g_register_status = false; // deck_hal register status
+
+// functions
+EFrameworkunifiedStatus DeckNotifyInfo(const DECK_MSG_DELIVERY &DeliveryData);
+
+EFrameworkunifiedStatus StopDiscRotation() {
+ int fd;
+ int ret;
+ fd = open(DISC_PATH, O_RDONLY);
+ if (fd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "open failed.");
+ return eFrameworkunifiedStatusFail;
+ }
+ ret = ioctl(fd, CDROMSTOP);
+ close(fd);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ioctl failed.");
+ return eFrameworkunifiedStatusFail;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus EjectDisc(DeckKind kind, DeckEjectMode mode) {
+ int fd;
+ int ret;
+ fd = open(DISC_PATH, O_RDONLY);
+ if (fd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "open failed.");
+ return eFrameworkunifiedStatusFail;
+ }
+ ret = ioctl(fd, CDROM_LOCKDOOR);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "unlock disc failed.");
+ close(fd);
+ return eFrameworkunifiedStatusFail;
+ }
+ ret = ioctl(fd, CDROMEJECT);
+ close(fd);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "eject disc failed.");
+ return eFrameworkunifiedStatusFail;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus DeckHalSysSend(HANDLE h_app, PCSTR name, const DECK_CMD* cmd, uint8_t req_id) {
+ EFrameworkunifiedStatus ret = eFrameworkunifiedStatusOK;
+
+ if (NULL == h_app || NULL == name || NULL == cmd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Input param is NULL\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (NOTIFY_NAME_MAX_SIZE < strlen(name)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Input name length is overlapped\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ // DeckHalSysSend aims to send command to micon,
+ // since micon is stub now,so DeckHalSysSend is stub either.
+
+ // deck_hal should notify chande mode status after received mode change info
+ // from micon,since now micon is stub,notify change mode status to vehicle
+ // immediately.
+ // the data notify to vehile is just a example.
+ DECK_MSG_DELIVERY data;
+ data.cmd.cmdhdr.lgadr_from = 0x44; // vehile:LSDRV_ADR_DVD_P
+ data.cmd.cmdhdr.lgadr_to = 0xC8; // vehicle:LSDRV_OPC_DRV_M_CH_A_DVD
+ data.cmd.cmdhdr.opc = 0xC8; // vehicle:LSDRV_OPC_DRV_M_CH_A_DVD
+ DeckNotifyInfo(data);
+
+ return ret;
+}
+
+EFrameworkunifiedStatus DeckHalRegister(HANDLE h_app, PCSTR notify_name) {
+ if (NULL == h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Input h_app is NULL\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (NULL == notify_name) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Input notify_name is NULL\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (strlen(notify_name) > NOTIFY_NAME_MAX_SIZE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Input notify_name length is overlapped\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ strncpy(g_notify_name, notify_name, NOTIFY_NAME_MAX_SIZE);
+
+ // now micon is stub,in the future,should register to micon
+
+ g_register_status = true;
+
+ return eFrameworkunifiedStatusOK;
+}
+
+// DeckNotifyInfo aims to send deck infos to vehicle
+// if micon is not stub in the future,after received meesage from micon
+// or any other ways triggered by micon,deck_hal should call this function
+// with different input data to send these data to vehicle.
+EFrameworkunifiedStatus DeckNotifyInfo(const DECK_MSG_DELIVERY &DeliveryData) {
+ EFrameworkunifiedStatus ret = eFrameworkunifiedStatusOK;
+ HANDLE send_handle = NULL;
+
+ if (g_register_status == true) {
+ send_handle = McOpenSender(g_notify_name);
+ if (send_handle == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedMcOpenSender to _CWORD121_Shadow Failed.");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ ret = McSend(send_handle, DECKHAL_THREAD, CID_DECK_SYS_DELIVERY,
+ sizeof(DECK_MSG_DELIVERY), &DeliveryData);
+
+ if (eFrameworkunifiedStatusOK != ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Failed to send CID_DECK_SYS_DELIVERY.");
+ ret = eFrameworkunifiedStatusFail;
+ }
+
+ if (send_handle != NULL) {
+ McClose(send_handle);
+ send_handle = NULL;
+ }
+ }
+
+ return ret;
+}
diff --git a/input_hal/LICENSE b/input_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/input_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/input_hal/Makefile b/input_hal/Makefile
new file mode 100755
index 0000000..35dfefd
--- /dev/null
+++ b/input_hal/Makefile
@@ -0,0 +1,81 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+COMPONENT_NAME := peripheral_service
+
+######### installed program/file ################
+TARGET := libinput_hal.so
+
+HEADER := ./hal_api/input_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/include/libdrm
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+CXXFLAGS += -D_USE_DRM
+
+######### link options ##########################
+LDFLAGS := -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+######### linked library ########################
+LIBS := -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LIBS += -Wl,-Bdynamic -ludev
+LIBS += -Wl,-Bdynamic -lpthread
+LIBS += -Wl,-Bdynamic -ldrm
+
+######### source files ##########################
+VPATH := src
+OBJS := input_hal.o
+OBJS += input_touch_ilitek.o
+OBJS += input_util.o
+OBJS += input_udev_monitor.o
+OBJS += input_drm.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install: install-input
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
+
+install-input:
+ install -m 0755 -d $(DESTDIR)/usr/agl/include/$(COMPONENT_NAME)/
+ install -m 0644 ./hal_api/$(COMPONENT_NAME)/aglinput.h $(DESTDIR)/usr/agl/include/$(COMPONENT_NAME)/
+ install -m 0644 ./hal_api/$(COMPONENT_NAME)/extinput.h $(DESTDIR)/usr/agl/include/$(COMPONENT_NAME)/
diff --git a/input_hal/README.md b/input_hal/README.md
new file mode 100755
index 0000000..4a69113
--- /dev/null
+++ b/input_hal/README.md
@@ -0,0 +1,3 @@
+input_hal library
+==================
+Input HAL implementation library for AGL Reference Board.
diff --git a/input_hal/hal_api/input_hal.h b/input_hal/hal_api/input_hal.h
new file mode 100755
index 0000000..bfc9d59
--- /dev/null
+++ b/input_hal/hal_api/input_hal.h
@@ -0,0 +1,696 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_INPUT_HAL_H_
+#define HAL_API_INPUT_HAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+#include "peripheral_service/aglinput.h"
+
+/**
+ * @file input_hal.h
+ */
+
+/** @addtogroup switchhandler
+ * @{
+ */
+/** @addtogroup input_hal
+ * @ingroup switchhandler
+ * @{
+ */
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/**
+ * \~english Return value type
+ */
+enum HalInputRetType {
+ /**
+ * \~english Success
+ */
+ HAL_INPUT_RET_NORMAL = 0,
+ /**
+ * \~english Process abnormality
+ */
+ HAL_INPUT_RET_ERROR,
+ /**
+ * \~english Not support
+ */
+ HAL_INPUT_RET_NOT_SUPPORT,
+};
+/**
+ * \~english Touch panel IC type
+ */
+enum HalInputTouchDeviceType {
+ /**
+ * \~english Touch panel IC is invalid
+ */
+ HAL_INPUT_TOUCH_DEVICE_INVALID = 0,
+ /**
+ * \~english Touch panel IC is ILITEK
+ */
+ HAL_INPUT_TOUCH_DEVICE_ILITEK,
+};
+
+/**
+ * \~english Radio band type
+ */
+enum HalInputBandType {
+ /**
+ * \~english Radio band is AM
+ */
+ HAL_INPUT_BAND_TYPE_AM = 0,
+ /**
+ * \~english Radio band isn't AM
+ */
+ HAL_INPUT_BAND_TYPE_NOT_AM,
+};
+
+/**
+ * \~english Radio reception status
+ */
+enum HalInputTuneStatus {
+ /**
+ * \~english Radio is in normal state
+ */
+ HAL_INPUT_TUNE_STATUS_NORMAL = 0,
+ /**
+ * \~english Radio is in search state
+ */
+ HAL_INPUT_TUNE_STATUS_SERACH,
+};
+
+/**
+ * \~english Sensitivity Level
+ */
+enum HalInputTouchSensitivityLevel {
+ /**
+ * \~english Sensitivity level low
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_LOW = 1,
+ /**
+ * \~english Sensitivity level middle
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_MIDDLE,
+ /**
+ * \~english Sensitivity level high
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_HIGH,
+ /**
+ * \~english Sensitivity level none
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_NONE,
+};
+
+/**
+ * \~english input device type
+ */
+enum HalInputDeviceType {
+ /**
+ * \~english The device type invalid
+ */
+ HAL_INPUT_DEVICE_INVALID,
+ /**
+ * \~english The device is keyboard
+ */
+ HAL_INPUT_DEVICE_KEYBOARD,
+ /**
+ * \~english The device is touch
+ */
+ HAL_INPUT_DEVICE_TOUCH,
+ /**
+ * \~english The device is ESC-KEY
+ */
+ HAL_INPUT_DEVICE_TOUCH_ESCKEY,
+ /**
+ * \~english The device is steering SW
+ */
+ HAL_INPUT_DEVICE_STEERING,
+ /**
+ * \~english The device is tablet finger
+ */
+ HAL_INPUT_DEVICE_TABLET_FINGER,
+ /**
+ * \~english The device is rotary key
+ */
+ HAL_INPUT_DEVICE_ROTARY_KEY,
+};
+
+/**
+ * \~english Don't need to config touch panel
+ */
+#define HAL_INPUT_TOUCH_CONFIG_OFF (0)
+/**
+ * \~english Touch panel configed
+ */
+#define HAL_INPUT_TOUCH_CONFIG_ON (1)
+
+/**
+ * \~english Touch panel touch press
+ */
+#define HAL_INPUT_TOUCH_PRESS (0)
+/**
+ * \~english Touch panel touch release
+ */
+#define HAL_INPUT_TOUCH_RELEASE (1)
+
+/**
+ * \~english Don't report touch panel's touch event
+ */
+#define HAL_INPUT_TOUCH_UNREPORT (0)
+/**
+ * \~english Report touch panel's touch event
+ */
+#define HAL_INPUT_TOUCH_REPORT (1)
+
+/**
+ * \~english Test all case
+ */
+#define HAL_INPUT_TOUCH_SELFTEST_ID_ALL (0xFE)
+/**
+ * \~english Selftest data length
+ */
+#define HAL_INPUT_TOUCH_SELFTEST_DATA_LEN (5)
+/**
+ * \~english Selftest mode not support
+ */
+#define HAL_INPUT_TOUCH_SELFTEST_NOT_SUPPORT (0xEE)
+
+/**
+ * \~english max number of input_event per package.
+ */
+#define HAL_INPUT_EVENT_COUNT 64
+
+/**
+ * \~english Thread name defined
+ */
+#define HAL_INPUT_SOURCE_NAME "input_hal_mon"
+
+/**
+ * \~english Notify input event from touch panel,
+ * The data of the notification please refer the following two type.\n
+ * @ref HAL_INPUT_TOUCH_PRESS \n
+ * @ref HAL_INPUT_TOUCH_RELEASE \n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_TOUCH, fpOnCmd);
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_TOUCH 100
+/**
+ * \~english Notify input event from touch panel ESC-KEY,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_ESC_KEY, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_ESC_KEY 101
+/**
+ * \~english Notify input event from key board,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_KEY_BOARD, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_KEY_BOARD 102
+/**
+ * \~english Notify input event from steering,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_STEERING, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_STEERING 104
+/**
+ * \~english Notify input event from tablet finger,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_TABLET_FINGER, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_TABLET_FINGER 105
+/**
+ * \~english Notify input event from rotary-key,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_ROTARY_KEY, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_ROTARY_KEY 106
+
+/**
+ * \~english Initialzing touch result notify,
+ * The data format of the notification please refer to @ref TouchInitFinishInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH 120
+
+/**
+ * @struct RadioInfoTouch
+ * \~english @par Brief
+ * Radio information
+ */
+struct RadioInfoTouch {
+ /**
+ * \~english Radio band type
+ * \~english Please ref to @ref HalInputBandType
+ */
+ int16_t band;
+ /**
+ * \~english Frequency of the tuner[kHz]
+ * (Use only at the time of AM reception)
+ */
+ uint16_t freq;
+ /**
+ * \~english Reception status (Use only at the time of AM reception)
+ * \~english Please refer to @ref HalInputBandType
+ */
+ int32_t status;
+};
+
+/**
+ * @struct SelftestTouch
+ * \~english @par Brief
+ * Touch panel selftest mode result
+ */
+struct SelftestTouch {
+ /**
+ * \~english Touch panel selftest mode result
+ */
+ unsigned char r_code;
+ /**
+ * \~english Touch panel selftest mode data.
+ * The datail info is depend on hardware spec.
+ */
+ unsigned char r_data[HAL_INPUT_TOUCH_SELFTEST_DATA_LEN];
+};
+
+/**
+ * @struct EventsPackageInput
+ * \~english @par Brief
+ * Input event package defined
+ */
+struct EventsPackageInput {
+ /**
+ * \~english device type
+ */
+ int device_type;
+ /**
+ * \~english event count
+ */
+ int count;
+ /**
+ * \~english input event data.
+ */
+ struct input_event event[HAL_INPUT_EVENT_COUNT];
+};
+
+/**
+ * @struct TouchInitFinishInput
+ * \~english @par Brief
+ * The result of initializing touch
+ */
+struct TouchInitFinishInput {
+ /**
+ * \~english If initializing the touch successful, the result was set HAL_INPUT_RET_NORMAL.
+ * If an error occurred, the result was set HAL_INPUT_RET_ERROR.
+ */
+ int result;
+};
+/************************************************************************
+* Function prototype *
+************************************************************************/
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// initializing input_hal.
+/// \~english @param [in] app_name
+/// const char* - the app name for receive input event.
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Listen input devices and send input event.
+/// - After initializing touch panel, the event(@ref HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH) will be sent.
+/// - The API can be used by 1 process.
+/// \~english @see None.
+////////////////////////////////////////////////////////////////////////////////
+int InitInput(const char* app_name);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// finalize input_hal
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to finalize input_hal.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int DeInitInput();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Init those operating function of touch panel driver
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @par Prerequisite
+/// - Touch panel function exist
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - The API is a block I/F which initializes those operating functions of touch panel driver.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int InitTouch();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Make touch panel start work
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to prepare touch panel and make it start work.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int StartTouch();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Execute touch panel self test
+/// \~english @param [in] id
+/// int - selftest id(Pass HAL_INPUT_TOUCH_SELFTEST_ID_ALL :
+/// Execute all test(disconnection check))
+/// \~english @param [out] result
+/// void* - Touch panel selftest mode check result
+/// \~english @note Result struct SelftestTouch depend on hardware spec
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Param result is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to execute touch panel self test and get test result.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int SelfTestTouch(int id, void *result);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Set whether the driver sends touch panel data or not.
+/// \~english @param [in] status
+/// int - Touch panel whether report/unreport event\n
+/// HAL_INPUT_TOUCH_REPORT : Report touch panel's touch event\n
+/// HAL_INPUT_TOUCH_UNREPORT : Don't report touch panel's touch event\n
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @note It means this API isn't support when return
+/// @ref HAL_INPUT_RET_NOT_SUPPORT.
+/// The user need to implement it
+/// if don't need to report touch event.
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Status is none of @ref HAL_INPUT_TOUCH_REPORT /
+/// @ref HAL_INPUT_TOUCH_UNREPORT
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to set whether the driver sends touch panel data or not.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int LockTouch(int status);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Suspend touch panel
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @note It means this API isn't support when return
+/// @ref HAL_INPUT_RET_NOT_SUPPORT.
+/// The user need to implement it
+/// if don't need to report touch event.
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to suspend touch panel.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int SuspendTouch();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Set touch panel sensitivity level
+/// \~english @param [in] level
+/// int - Sensitivity level.
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Sensitivity level is none of @ref HalInputTouchSensitivityLevel
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to set touch panel sensitivity level.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int SetSensitivityLevelTouch(int level);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Get touch panel sensitivity level
+/// \~english @param [out] level
+/// int* - Sensitivity level.
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Param level is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to get touch panel sensitivity level.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int GetSensitivityLevelTouch(int *level);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Notify radio scan frequency
+/// \~english @param [in] info
+/// RadioInfoTouch* - SCAN frequence info
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Param info is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to notify radio scan frequency.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int NotifyRadioScanFreqTouch(struct RadioInfoTouch *info);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Get panel resolution
+/// \~english @param [in] reso_h
+/// int* - horizontal resolution
+/// \~english @param [in] reso_v
+/// int* - vertical resolution
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Param reso_h or reso_v is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to get horizontal and vertical resolution.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int GetPanelSpecResolutionInput(int *reso_h, int *reso_v);
+
+/** @}*/ // end of input_hal
+/** @}*/ // end of switchhandler
+
+#endif // HAL_API_INPUT_HAL_H_
diff --git a/input_hal/hal_api/peripheral_service/aglinput.h b/input_hal/hal_api/peripheral_service/aglinput.h
new file mode 100755
index 0000000..aa5f6ed
--- /dev/null
+++ b/input_hal/hal_api/peripheral_service/aglinput.h
@@ -0,0 +1,536 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HAL_API_PERIPHERAL_SERVICE_AGLINPUT_H_
+#define HAL_API_PERIPHERAL_SERVICE_AGLINPUT_H_
+
+#include <peripheral_service/extinput.h>
+
+/*
+ * Extended Area for AGL
+ * In this file the Key definition based on the specification
+ * Redefine with '#undef/#define
+ */
+enum{
+ /**
+ * FP Switch : 0x0001 - 0x0064
+ * */
+ KEY_FP_TOP = 0x001,
+ KEY_FP_SW1 = KEY_FP_TOP,
+ KEY_FP_SW2 ,
+ KEY_FP_SW3 ,
+ KEY_FP_SW4 ,
+ KEY_FP_SW5 ,
+ KEY_FP_SW6 ,
+ KEY_FP_SW7 ,
+ KEY_FP_SW8 ,
+ KEY_FP_SW9 ,
+ KEY_FP_SW10 ,
+ KEY_FP_SW11 ,
+ KEY_FP_SW12 ,
+ KEY_FP_SW13 ,
+ KEY_FP_SW14 ,
+ KEY_FP_SW15 ,
+ KEY_FP_SW16 ,
+ KEY_FP_SW17 ,
+ KEY_FP_SW18 ,
+ KEY_FP_SW19 ,
+ KEY_FP_SW20 ,
+ KEY_FP_SW21 ,
+ KEY_FP_SW22 ,
+ KEY_FP_SW23 ,
+ KEY_FP_SW24 ,
+ KEY_FP_SW25 ,
+ KEY_FP_SW26 ,
+ KEY_FP_SW27 ,
+ KEY_FP_SW28 ,
+ KEY_FP_SW29 ,
+ KEY_FP_SW30 ,
+ KEY_FP_SW31 ,
+ KEY_FP_SW32 ,
+ KEY_FP_SW33 ,
+ KEY_FP_SW34 ,
+ KEY_FP_SW35 ,
+ KEY_FP_SW36 ,
+ KEY_FP_SW37 ,
+ KEY_FP_SW38 ,
+ KEY_FP_SW39 ,
+ KEY_FP_SW40 ,
+ KEY_FP_SW41 ,
+ KEY_FP_SW42 ,
+ KEY_FP_SW43 ,
+ KEY_FP_SW44 ,
+ KEY_FP_SW45 ,
+ KEY_FP_SW46 ,
+ KEY_FP_SW47 ,
+ KEY_FP_SW48 ,
+ KEY_FP_SW49 ,
+ KEY_FP_SW50 ,
+ KEY_FP_SW51 ,
+ KEY_FP_SW52 ,
+ KEY_FP_SW53 ,
+ KEY_FP_SW54 ,
+ KEY_FP_SW55 ,
+ KEY_FP_SW56 ,
+ KEY_FP_SW57 ,
+ KEY_FP_SW58 ,
+ KEY_FP_SW59 ,
+ KEY_FP_SW60 ,
+ KEY_FP_SW61 ,
+ KEY_FP_SW62 ,
+ KEY_FP_SW63 ,
+ KEY_FP_SW64 ,
+ KEY_FP_SW65 ,
+ KEY_FP_SW66 ,
+ KEY_FP_SW67 ,
+ KEY_FP_SW68 ,
+ KEY_FP_SW69 ,
+ KEY_FP_SW70 ,
+ KEY_FP_SW71 ,
+ KEY_FP_SW72 ,
+ KEY_FP_SW73 ,
+ KEY_FP_SW74 ,
+ KEY_FP_SW75 ,
+ KEY_FP_SW76 ,
+ KEY_FP_SW77 ,
+ KEY_FP_SW78 ,
+ KEY_FP_SW79 ,
+ KEY_FP_SW80 ,
+ KEY_FP_SW81 ,
+ KEY_FP_SW82 ,
+ KEY_FP_SW83 ,
+ KEY_FP_SW84 ,
+ KEY_FP_SW85 ,
+ KEY_FP_SW86 ,
+ KEY_FP_SW87 ,
+ KEY_FP_SW88 ,
+ KEY_FP_SW89 ,
+ KEY_FP_SW90 ,
+ KEY_FP_SW91 ,
+ KEY_FP_SW92 ,
+ KEY_FP_SW93 ,
+ KEY_FP_SW94 ,
+ KEY_FP_SW95 ,
+ KEY_FP_SW96 ,
+ KEY_FP_SW97 ,
+ KEY_FP_SW98 ,
+ KEY_FP_SW99 ,
+ KEY_FP_SW100 ,
+ KEY_FP_BOTTOM = KEY_FP_SW100,
+
+ /**
+ * RC Switch : 0x065 - 0x094
+ * */
+ KEY_RC_TOP = 0x0065,
+ KEY_RC_SW1 = KEY_RC_TOP,
+ KEY_RC_SW2 ,
+ KEY_RC_SW3 ,
+ KEY_RC_SW4 ,
+ KEY_RC_SW5 ,
+ KEY_RC_SW6 ,
+ KEY_RC_SW7 ,
+ KEY_RC_SW8 ,
+ KEY_RC_SW9 ,
+ KEY_RC_SW10 ,
+ KEY_RC_SW11 ,
+ KEY_RC_SW12 ,
+ KEY_RC_SW13 ,
+ KEY_RC_SW14 ,
+ KEY_RC_SW15 ,
+ KEY_RC_SW16 ,
+ KEY_RC_SW17 ,
+ KEY_RC_SW18 ,
+ KEY_RC_SW19 ,
+ KEY_RC_SW20 ,
+ KEY_RC_SW21 ,
+ KEY_RC_SW22 ,
+ KEY_RC_SW23 ,
+ KEY_RC_SW24 ,
+ KEY_RC_SW25 ,
+ KEY_RC_SW26 ,
+ KEY_RC_SW27 ,
+ KEY_RC_SW28 ,
+ KEY_RC_SW29 ,
+ KEY_RC_SW30 ,
+ KEY_RC_SW31 ,
+ KEY_RC_SW32 ,
+ KEY_RC_SW33 ,
+ KEY_RC_SW34 ,
+ KEY_RC_SW35 ,
+ KEY_RC_SW36 ,
+ KEY_RC_SW37 ,
+ KEY_RC_SW38 ,
+ KEY_RC_SW39 ,
+ KEY_RC_SW40 ,
+ KEY_RC_SW41 ,
+ KEY_RC_SW42 ,
+ KEY_RC_SW43 ,
+ KEY_RC_SW44 ,
+ KEY_RC_SW45 ,
+ KEY_RC_SW46 ,
+ KEY_RC_SW47 ,
+ KEY_RC_SW48 ,
+ KEY_RC_BOTTOM = KEY_RC_SW48,
+
+ /**
+ * R Switch : 0x0095 - 0x0096
+ * */
+ KEY_ROT_TOP = 0x0095,
+ KEY_ROT_SW1 = KEY_ROT_TOP,
+ KEY_ROT_SW2 ,
+ KEY_ROT_BOTTOM = KEY_ROT_SW2,
+
+ /**
+ * FSAC Switch : 0x0097 - 0x00D2
+ * */
+ KEY_FSAC_TOP = 0x0097,
+ KEY_FSAC_SW1 = KEY_FSAC_TOP,
+ KEY_FSAC_SW2 ,
+ KEY_FSAC_SW3 ,
+ KEY_FSAC_SW4 ,
+ KEY_FSAC_SW5 ,
+ KEY_FSAC_SW6 ,
+ KEY_FSAC_SW7 ,
+ KEY_FSAC_SW8 ,
+ KEY_FSAC_SW9 ,
+ KEY_FSAC_SW10 ,
+ KEY_FSAC_SW11 ,
+ KEY_FSAC_SW12 ,
+ KEY_FSAC_SW13 ,
+ KEY_FSAC_SW14 ,
+ KEY_FSAC_SW15 ,
+ KEY_FSAC_SW16 ,
+ KEY_FSAC_SW17 ,
+ KEY_FSAC_SW18 ,
+ KEY_FSAC_SW19 ,
+ KEY_FSAC_SW20 ,
+ KEY_FSAC_SW21 ,
+ KEY_FSAC_SW22 ,
+ KEY_FSAC_SW23 ,
+ KEY_FSAC_SW24 ,
+ KEY_FSAC_SW25 ,
+ KEY_FSAC_SW26 ,
+ KEY_FSAC_SW27 ,
+ KEY_FSAC_SW28 ,
+ KEY_FSAC_SW29 ,
+ KEY_FSAC_SW30 ,
+ KEY_FSAC_SW31 ,
+ KEY_FSAC_SW32 ,
+ KEY_FSAC_SW33 ,
+ KEY_FSAC_SW34 ,
+ KEY_FSAC_SW35 ,
+ KEY_FSAC_SW36 ,
+ KEY_FSAC_SW37 ,
+ KEY_FSAC_SW38 ,
+ KEY_FSAC_SW39 ,
+ KEY_FSAC_SW40 ,
+ KEY_FSAC_SW41 ,
+ KEY_FSAC_SW42 ,
+ KEY_FSAC_SW43 ,
+ KEY_FSAC_SW44 ,
+ KEY_FSAC_SW45 ,
+ KEY_FSAC_SW46 ,
+ KEY_FSAC_SW47 ,
+ KEY_FSAC_SW48 ,
+ KEY_FSAC_SW49 ,
+ KEY_FSAC_SW50 ,
+ KEY_FSAC_SW51 ,
+ KEY_FSAC_SW52 ,
+ KEY_FSAC_SW53 ,
+ KEY_FSAC_SW54 ,
+ KEY_FSAC_SW55 ,
+ KEY_FSAC_SW56 ,
+ KEY_FSAC_SW57 ,
+ KEY_FSAC_SW58 ,
+ KEY_FSAC_SW59 ,
+ KEY_FSAC_BOTTOM = KEY_FSAC_SW59,
+
+ /**
+ * Ste Switch : 0x00D3 - 0x00E6
+ * */
+ KEY_STE_TOP = 0x00D3,
+ KEY_STE_SW1 = KEY_STE_TOP,
+ KEY_STE_SW2 ,
+ KEY_STE_SW3 ,
+ KEY_STE_SW4 ,
+ KEY_STE_SW5 ,
+ KEY_STE_SW6 ,
+ KEY_STE_SW7 ,
+ KEY_STE_SW8 ,
+ KEY_STE_SW9 ,
+ KEY_STE_SW10 ,
+ KEY_STE_SW11 ,
+ KEY_STE_SW12 ,
+ KEY_STE_SW13 ,
+ KEY_STE_SW14 ,
+ KEY_STE_SW15 ,
+ KEY_STE_SW16 ,
+ KEY_STE_SW18 ,
+ KEY_STE_SW19 ,
+ KEY_STE_BOTTOM = KEY_STE_SW19,
+
+ /**
+ * RCP Switch : 0x00F0 - 0x00F8
+ * */
+ KEY_RCP_TOP = 0x00F0,
+ KEY_RCP_SW1 = KEY_RCP_TOP,
+ KEY_RCP_SW2 ,
+ KEY_RCP_SW3 ,
+ KEY_RCP_SW4 ,
+ KEY_RCP_SW5 ,
+ KEY_RCP_SW6 ,
+ KEY_RCP_SW7 ,
+ KEY_RCP_SW8 ,
+ KEY_RCP_BOTTOM = KEY_RCP_SW8,
+
+ /**
+ * RSE_RC Switch : 0x0160 - 0x01CF
+ * */
+ KEY_RSE_RC_TOP = 0x0160,
+ KEY_RSE_RC_SW1 = KEY_RSE_RC_TOP,
+ KEY_RSE_RC_SW2 ,
+ KEY_RSE_RC_SW3 ,
+ KEY_RSE_RC_SW4 ,
+ KEY_RSE_RC_SW5 ,
+ KEY_RSE_RC_SW6 ,
+ KEY_RSE_RC_SW7 ,
+ KEY_RSE_RC_SW8 ,
+ KEY_RSE_RC_SW9 ,
+ KEY_RSE_RC_SW10 ,
+ KEY_RSE_RC_SW11 ,
+ KEY_RSE_RC_SW12 ,
+ KEY_RSE_RC_SW13 ,
+ KEY_RSE_RC_SW14 ,
+ KEY_RSE_RC_SW15 ,
+ KEY_RSE_RC_SW16 ,
+ KEY_RSE_RC_SW17 ,
+ KEY_RSE_RC_SW18 ,
+ KEY_RSE_RC_SW19 ,
+ KEY_RSE_RC_SW20 ,
+ KEY_RSE_RC_SW21 ,
+ KEY_RSE_RC_SW22 ,
+ KEY_RSE_RC_SW23 ,
+ KEY_RSE_RC_SW24 ,
+ KEY_RSE_RC_SW25 ,
+ KEY_RSE_RC_SW26 ,
+ KEY_RSE_RC_SW27 ,
+ KEY_RSE_RC_SW28 ,
+ KEY_RSE_RC_SW29 ,
+ KEY_RSE_RC_SW30 ,
+ KEY_RSE_RC_SW31 ,
+ KEY_RSE_RC_SW32 ,
+ KEY_RSE_RC_SW33 ,
+ KEY_RSE_RC_SW34 ,
+ KEY_RSE_RC_SW35 ,
+ KEY_RSE_RC_SW36 ,
+ KEY_RSE_RC_SW37 ,
+ KEY_RSE_RC_SW38 ,
+ KEY_RSE_RC_SW39 ,
+ KEY_RSE_RC_SW40 ,
+ KEY_RSE_RC_SW41 ,
+ KEY_RSE_RC_SW42 ,
+ KEY_RSE_RC_SW43 ,
+ KEY_RSE_RC_SW44 ,
+ KEY_RSE_RC_SW45 ,
+ KEY_RSE_RC_SW46 ,
+ KEY_RSE_RC_SW47 ,
+ KEY_RSE_RC_SW48 ,
+ KEY_RSE_RC_SW49 ,
+ KEY_RSE_RC_SW50 ,
+ KEY_RSE_RC_SW51 ,
+ KEY_RSE_RC_SW52 ,
+ KEY_RSE_RC_SW53 ,
+ KEY_RSE_RC_SW54 ,
+ KEY_RSE_RC_SW55 ,
+ KEY_RSE_RC_SW56 ,
+ KEY_RSE_RC_SW57 ,
+ KEY_RSE_RC_SW58 ,
+ KEY_RSE_RC_SW59 ,
+ KEY_RSE_RC_SW60 ,
+ KEY_RSE_RC_SW61 ,
+ KEY_RSE_RC_SW65 ,
+ KEY_RSE_RC_SW66 ,
+ KEY_RSE_RC_SW67 ,
+ KEY_RSE_RC_SW68 ,
+ KEY_RSE_RC_SW69 ,
+ KEY_RSE_RC_SW70 ,
+ KEY_RSE_RC_SW71 ,
+ KEY_RSE_RC_SW72 ,
+ KEY_RSE_RC_SW73 ,
+ KEY_RSE_RC_SW74 ,
+ KEY_RSE_RC_SW75 ,
+ KEY_RSE_RC_SW76 ,
+ KEY_RSE_RC_SW77 ,
+ KEY_RSE_RC_SW78 ,
+ KEY_RSE_RC_SW79 ,
+ KEY_RSE_RC_SW80 ,
+ KEY_RSE_RC_SW81 ,
+ KEY_RSE_RC_SW82 ,
+ KEY_RSE_RC_SW83 ,
+ KEY_RSE_RC_SW84 ,
+ KEY_RSE_RC_SW85 ,
+ KEY_RSE_RC_SW86 ,
+ KEY_RSE_RC_SW87 ,
+ KEY_RSE_RC_SW88 ,
+ KEY_RSE_RC_SW89 ,
+ KEY_RSE_RC_SW90 ,
+ KEY_RSE_RC_SW91 ,
+ KEY_RSE_RC_SW92 ,
+ KEY_RSE_RC_SW93 ,
+ KEY_RSE_RC_SW94 ,
+ KEY_RSE_RC_SW95 ,
+ KEY_RSE_RC_SW96 ,
+ KEY_RSE_RC_SW97 ,
+ KEY_RSE_RC_SW98 ,
+ KEY_RSE_RC_SW99 ,
+ KEY_RSE_RC_SW100 ,
+ KEY_RSE_RC_SW101 ,
+ KEY_RSE_RC_SW102 ,
+ KEY_RSE_RC_SW62 ,
+ KEY_RSE_RC_SW63 ,
+ KEY_RSE_RC_SW64 ,
+ KEY_RSE_RC_SW103 ,
+ KEY_RSE_RC_SW104 ,
+ KEY_RSE_RC_SW105 ,
+ KEY_RSE_RC_SW106 ,
+ KEY_RSE_RC_SW107 ,
+ KEY_RSE_RC_SW108 ,
+ KEY_RSE_RC_SW109 ,
+ KEY_RSE_RC_SW110 ,
+ KEY_RSE_RC_SW111 ,
+ KEY_RSE_RC_SW112 ,
+ KEY_RSE_RC_BOTTOM = KEY_RSE_RC_SW112,
+
+ /**
+ * RTP Switch : 0x01D6 - 0x01DE
+ * */
+ KEY_RTP_TOP = 0x01D6,
+ KEY_RTP_SW1 = KEY_RTP_TOP,
+ KEY_RTP_SW2 ,
+ KEY_RTP_SW3 ,
+ KEY_RTP_SW4 ,
+ KEY_RTP_SW5 ,
+ KEY_RTP_SW6 ,
+ KEY_RTP_SW7 ,
+ KEY_RTP_SW8 ,
+ KEY_RTP_SW9 ,
+ KEY_RTP_BOTTOM = KEY_RTP_SW9,
+
+ /**
+ * RSP Switch : 0x01E0 - 0x0208
+ * */
+ KEY_RSP_TOP = 0x01E0,
+ KEY_RSP_SW1 = KEY_RSP_TOP,
+ KEY_RSP_SW2 ,
+ KEY_RSP_SW3 ,
+ KEY_RSP_SW4 ,
+ KEY_RSP_SW5 ,
+ KEY_RSP_SW6 ,
+ KEY_RSP_SW7 ,
+ KEY_RSP_SW8 ,
+ KEY_RSP_SW9 ,
+ KEY_RSP_SW10 ,
+ KEY_RSP_SW11 ,
+ KEY_RSP_SW12 ,
+ KEY_RSP_SW13 ,
+ KEY_RSP_SW14 ,
+ KEY_RSP_SW15 ,
+ KEY_RSP_SW16 ,
+ KEY_RSP_SW17 ,
+ KEY_RSP_SW18 ,
+ KEY_RSP_SW19 ,
+ KEY_RSP_SW20 ,
+ KEY_RSP_SW21 ,
+ KEY_RSP_SW22 ,
+ KEY_RSP_SW23 ,
+ KEY_RSP_SW24 ,
+ KEY_RSP_SW25 ,
+ KEY_RSP_SW26 ,
+ KEY_RSP_SW27 ,
+ KEY_RSP_SW28 ,
+ KEY_RSP_SW29 ,
+ KEY_RSP_SW30 ,
+ KEY_RSP_SW31 ,
+ KEY_RSP_SW32 ,
+ KEY_RSP_SW33 ,
+ KEY_RSP_SW34 ,
+ KEY_RSP_SW35 ,
+ KEY_RSP_SW36 ,
+ KEY_RSP_SW37 ,
+ KEY_RSP_SW38 ,
+ KEY_RSP_SW39 ,
+ KEY_RSP_SW40 ,
+ KEY_RSP_SW41 ,
+ KEY_RSP_BOTTOM = KEY_RSP_SW41,
+
+ /**
+ * Original Define : 0x02A0 - 0x02CF
+ * */
+ KEY_INPUTHAL_TOP = 0x02A0,
+ KEY_INPUTHAL_SW1 = KEY_INPUTHAL_TOP,
+ KEY_INPUTHAL_BTN_RIGHT,
+ KEY_INPUTHAL_BTN_MIDDLE,
+ KEY_INPUTHAL_BTN_SIDE,
+ KEY_INPUTHAL_BTN_EXTRA,
+ KEY_INPUTHAL_BTN_FORWARD,
+ KEY_INPUTHAL_BTN_BACK,
+ KEY_INPUTHAL_BTN_TASK,
+ KEY_INPUTHAL_SW9,
+ KEY_INPUTHAL_SW10,
+ KEY_INPUTHAL_BTN_JOYSTICK,
+ KEY_INPUTHAL_TOUCH,
+ KEY_INPUTHAL_SINGLE_TAP_UP,
+ KEY_INPUTHAL_DOUBLE_TOUCH_DOWN,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY1,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY2,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY3,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY4,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY5,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY6,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY7,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY8,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY9,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY10,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY11,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY12,
+ KEY_INPUTHAL_TOUCH_POINT_3,
+ KEY_INPUTHAL_TOUCH_POINT_2,
+ KEY_INPUTHAL_PUSH,
+ KEY_INPUTHAL_TAP_SINGLE,
+ KEY_INPUTHAL_TAP_DOUBLE,
+ KEY_INPUTHAL_SW16,
+ KEY_INPUTHAL_NAVI,
+ KEY_INPUTHAL_HOME,
+ KEY_INPUTHAL_MEM1,
+ KEY_INPUTHAL_MEM2,
+ KEY_INPUTHAL_RECENT_JP,
+ KEY_INPUTHAL_WEB,
+ KEY_INPUTHAL_DEST_ERACE,
+ KEY_INPUTHAL_MENU_SEARCH,
+ KEY_INPUTHAL_MENU_GO_HOME,
+ KEY_INPUTHAL_MENU_RECENT_NA,
+ KEY_INPUTHAL_MENU_FAVORITE,
+ KEY_INPUTHAL_MENU_CONTACT,
+ KEY_INPUTHAL_MENU_OTHERS,
+ KEY_INPUTHAL_MENU_SUBSCREEN_NAVI,
+ KEY_INPUTHAL_INVALID_SW ,
+ KEY_INPUTHAL_BOTTOM = KEY_INPUTHAL_INVALID_SW,
+};
+
+#define BTN_TAP_DOUBLE KEY_INPUTHAL_SW10
+
+#define REL_PINCH 0x0a
+
+#endif // HAL_API_PERIPHERAL_SERVICE_AGLINPUT_H_
diff --git a/input_hal/hal_api/peripheral_service/extinput.h b/input_hal/hal_api/peripheral_service/extinput.h
new file mode 100755
index 0000000..0265a2d
--- /dev/null
+++ b/input_hal/hal_api/peripheral_service/extinput.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HAL_API_PERIPHERAL_SERVICE_EXTINPUT_H_
+#define HAL_API_PERIPHERAL_SERVICE_EXTINPUT_H_
+
+#include <linux/input.h>
+
+/*
+ * Extended fields for each supplier
+ * If you want to modify the key definition at the supplier,
+ * redefine with '#undef/#define in this file.
+ */
+
+#endif // HAL_API_PERIPHERAL_SERVICE_EXTINPUT_H_
diff --git a/input_hal/inc/input_drm.h b/input_hal/inc/input_drm.h
new file mode 100755
index 0000000..11ffc32
--- /dev/null
+++ b/input_hal/inc/input_drm.h
@@ -0,0 +1,22 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_INPUT_DRM_H_
+#define INC_INPUT_DRM_H_
+
+int GetPanelSpecResolutionInput(int *reso_h, int *reso_v);
+
+#endif // INC_INPUT_DRM_H_
diff --git a/input_hal/inc/input_hal_debug.h b/input_hal/inc/input_hal_debug.h
new file mode 100755
index 0000000..2fb7d86
--- /dev/null
+++ b/input_hal/inc/input_hal_debug.h
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_INPUT_HAL_DEBUG_H_
+#define INC_INPUT_HAL_DEBUG_H_
+
+#include "input_hal_frameworkunifiedlog.h"
+
+// #define INPUT_DEBUG
+
+#ifdef INPUT_DEBUG
+#define INPUT_DBG_LOG(zone_index, fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(zone_index, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_DBG_LOG(zone_index, fmt, ...)
+#endif
+
+/* Log output control flag */
+#define INPUT_LOG_ENABLE_TRACE /* Normal log(Trace) */
+#define INPUT_LOG_ENABLE_ERROR /* Error log */
+#define INPUT_LOG_ENABLE_RETAIL /* Debug log */
+
+#ifdef INPUT_LOG_ENABLE_TRACE
+#define INPUT_LOG_TRACE(fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_LOG_TRACE(fmt, ...)
+#endif
+
+#ifdef INPUT_LOG_ENABLE_ERROR
+#define INPUT_ERROR_LOG(fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_ERROR_LOG(fmt, ...)
+#endif
+
+#ifdef INPUT_LOG_ENABLE_RETAIL
+#define INPUT_RETAIL_LOG(fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(ZONE_HMI_DBG, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_RETAIL_LOG(fmt, ...)
+#endif
+
+#endif // INC_INPUT_HAL_DEBUG_H_
diff --git a/input_hal/inc/input_hal_frameworkunifiedlog.h b/input_hal/inc/input_hal_frameworkunifiedlog.h
new file mode 100755
index 0000000..c54f16a
--- /dev/null
+++ b/input_hal/inc/input_hal_frameworkunifiedlog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_INPUT_HAL_FRAMEWORKUNIFIEDLOG_H_
+#define INC_INPUT_HAL_FRAMEWORKUNIFIEDLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_INPUT_HAL_FRAMEWORKUNIFIEDLOG_H_
diff --git a/input_hal/inc/input_hal_internal.h b/input_hal/inc/input_hal_internal.h
new file mode 100755
index 0000000..4e57aed
--- /dev/null
+++ b/input_hal/inc/input_hal_internal.h
@@ -0,0 +1,107 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_INPUT_HAL_INTERNAL_H_
+#define INC_INPUT_HAL_INTERNAL_H_
+
+/*
+ * Touch panel operation function info
+ */
+struct TouchHal {
+ /**
+ * \~english Make touch panel start work.
+ */
+ int (* start)(void);
+ /**
+ * \~english Get touch panel device horizontal resolution.
+ */
+ int (* get_reso_h)(int *);
+ /**
+ * \~english Get touch panel device vertical resolution.
+ */
+ int (* get_reso_v)(int *);
+ /**
+ * \~english Get whether X axis is inversion.
+ */
+ int (* get_reverse_axis_x)(bool *);
+ /**
+ * \~english Get whether Y axis is inversion.
+ */
+ int (* get_reverse_axis_y)(bool *);
+ /**
+ * \~english Config touch panel.
+ */
+ int (* config)(const char *, int, int);
+ /**
+ * \~english Get touch panel device name.
+ */
+ int (* get_touch_devicename)(char*, size_t);
+ /**
+ * \~english Get touch panel key device name.
+ */
+ int (* get_key_devicename)(char*, size_t);
+ /**
+ * \~english Execute touch panel self test.
+ */
+ int (* selftest)(int, void *);
+ /**
+ * \~english Get touch panel config status.
+ */
+ int (* get_config_status)(int *);
+ /**
+ * \~english Set whether the driver sends touch panel data or not.
+ */
+ int (* set_touch_lock)(int);
+ /**
+ * \~english Request touch panel touch suspend.
+ */
+ int (* set_touch_suspend)(void);
+ /**
+ * \~english Set touch panel sensitivity level.
+ */
+ int (* set_sensitivity_level)(int);
+ /**
+ * \~english Get touch panel sensitivity level.
+ */
+ int (* get_sensitivity_level)(int *);
+ /**
+ * \~english Notify radio scan frequency.
+ */
+ int (* notify_radio_scan_frequency)(struct RadioInfoTouch *);
+};
+
+
+/**
+ * Config touch panel
+ */
+int ConfigTouch(const char *path , int resolution_h, int resolution_v);
+
+/**
+ * Get touch panel device name
+ */
+int GetPanelNameTouch(char* name, size_t buf_length);
+
+/**
+ * Get touch panel key device name
+ */
+int GetKeyNameTouch(char* name, size_t buf_length);
+
+/**
+ * Get touch panel config status
+ */
+int GetConfigStatusTouch(int *status);
+
+#endif // INC_INPUT_HAL_INTERNAL_H_
diff --git a/input_hal/inc/input_touch_ilitek.h b/input_hal/inc/input_touch_ilitek.h
new file mode 100755
index 0000000..6d76d83
--- /dev/null
+++ b/input_hal/inc/input_touch_ilitek.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_INPUT_TOUCH_ILITEK_H_
+#define INC_INPUT_TOUCH_ILITEK_H_
+
+#include "input_hal_internal.h"
+
+/*
+ * Init ilitek touch panel operation function
+ */
+int InputTouchIlitekInit(struct TouchHal *touch);
+
+#endif // INC_INPUT_TOUCH_ILITEK_H_
diff --git a/input_hal/inc/input_udev_monitor.h b/input_hal/inc/input_udev_monitor.h
new file mode 100755
index 0000000..0391f6f
--- /dev/null
+++ b/input_hal/inc/input_udev_monitor.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_INPUT_UDEV_MONITOR_H_
+#define INC_INPUT_UDEV_MONITOR_H_
+
+#include <peripheral_service/aglinput.h>
+
+#include "input_util.h"
+
+#define INPUT_DEVICE_NODE_LENGTH_MAX (32)
+
+struct InputInputDeviceList{
+ int fd;
+ int device_assort;
+ char device_node[INPUT_DEVICE_NODE_LENGTH_MAX];
+ struct InputUtilList list;
+};
+
+struct InputUdevMonitorInfo {
+ struct udev *udev;
+ struct udev_monitor *monitor;
+ struct InputInputDeviceList dev_list;
+};
+
+int32_t InputUdevMonitorThreadCreate(void);
+
+#endif // INC_INPUT_UDEV_MONITOR_H_
diff --git a/input_hal/inc/input_util.h b/input_hal/inc/input_util.h
new file mode 100755
index 0000000..6d6a400
--- /dev/null
+++ b/input_hal/inc/input_util.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_INPUT_UTIL_H_
+#define INC_INPUT_UTIL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+struct InputUtilList {
+ struct InputUtilList *next;
+ struct InputUtilList *prev;
+};
+
+#define INPUT_INIT_LIST_HEAD(ptr) \
+ (ptr)->next = (ptr); (ptr)->prev = (ptr);
+
+#define input_list_entry(ptr, type, member) \
+ (reinterpret_cast<type *>( \
+ reinterpret_cast<char *>(ptr) - (size_t)(&(reinterpret_cast<type *>(0))->member)))
+
+#define input_list_for_each(pos, head) \
+ for (pos = (head)->next; pos != (head); pos = pos->next)
+
+#define input_list_for_each_safe(pos, n, head) \
+ for (pos = (head)->next, n = pos->next; pos != (head); \
+ pos = n, n = pos->next)
+
+void InputUtilListAdd(struct InputUtilList *node_new, struct InputUtilList *node_head);
+void InputUtilListDelete(struct InputUtilList *node);
+int InputUtilMCSend(HANDLE h_message, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data);
+int InputUtilSleep(int usec);
+
+#endif // INC_INPUT_UTIL_H_
diff --git a/input_hal/src/input_drm.cpp b/input_hal/src/input_drm.cpp
new file mode 100755
index 0000000..20adf79
--- /dev/null
+++ b/input_hal/src/input_drm.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "input_drm.h"
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#if defined(_USE_DRM)
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+#endif
+
+#include "input_hal.h"
+#include "input_hal_debug.h"
+
+#define DIR_PATH "/dev/dri/card0"
+#define DEFAULT_RESOLUTION_HORIZONTAL 1280 /* Horizontal resolution default value */
+#define DEFAULT_RESOLUTION_VERTICAL 800 /* Vertical resolution default value */
+/**
+ * Panel resolution acquisition / GetPanelSpecResolutionInput
+ */
+int GetPanelSpecResolutionInput(int *reso_h, int *reso_v) {
+ if ((NULL == reso_h) || (NULL == reso_v)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+#if defined(_USE_DRM)
+ int fd;
+ drmModeRes *resources = NULL;
+ drmModeConnector *connector = NULL;
+ drmModeEncoder *encoder = NULL;
+ drmModeCrtc *crtc = NULL;
+
+ fd = open(DIR_PATH, O_RDWR);
+ if (fd < 0) {
+ INPUT_ERROR_LOG("DRI Open Error=%s\n", DIR_PATH);
+ goto err_rtn;
+ }
+
+ resources = drmModeGetResources(fd);
+ if (!resources) {
+ INPUT_ERROR_LOG("No resources\n");
+ goto err_rtn;
+ }
+ if (2 > resources->count_connectors) {
+ INPUT_ERROR_LOG("DRI Connect Num Error connectors=%d\n",
+ resources->count_connectors);
+ goto err_rtn;
+ }
+
+ connector = drmModeGetConnector(fd, resources->connectors[1]);
+ if (!connector) {
+ INPUT_ERROR_LOG("No Connector\n");
+ goto err_rtn;
+ }
+
+ if ((DRM_MODE_CONNECTED == connector->connection) &&(connector->count_modes > 0)) {
+ } else {
+ INPUT_ERROR_LOG("Not found connected connector\n");
+ goto err_rtn;
+ }
+
+ encoder = drmModeGetEncoder(fd, connector->encoder_id);
+ if (!encoder) {
+ INPUT_ERROR_LOG("drmModeGetEncoder null\n");
+ goto err_rtn;
+ }
+
+ crtc = drmModeGetCrtc(fd, encoder->crtc_id);
+ if (!crtc) {
+ INPUT_ERROR_LOG("drmModeGetCrtc null\n");
+ goto err_rtn;
+ }
+
+ *reso_h = crtc->mode.hdisplay;
+ *reso_v = crtc->mode.vdisplay;
+
+ drmModeFreeCrtc(crtc);
+ drmModeFreeEncoder(encoder);
+ drmModeFreeConnector(connector);
+ drmModeFreeResources(resources);
+ close(fd);
+
+ INPUT_LOG_TRACE("width=%d height=%d\n", *reso_h, *reso_v);
+ return HAL_INPUT_RET_NORMAL;
+
+err_rtn:
+
+ if (encoder) {
+ drmModeFreeEncoder(encoder);
+ }
+ if (connector) {
+ drmModeFreeConnector(connector);
+ }
+ if (resources) {
+ drmModeFreeResources(resources);
+ }
+ if (fd >= 0) {
+ close(fd);
+ }
+
+ INPUT_ERROR_LOG("Use Default Resolution\n");
+ *reso_h = DEFAULT_RESOLUTION_HORIZONTAL;
+ *reso_v = DEFAULT_RESOLUTION_VERTICAL;
+
+ return HAL_INPUT_RET_ERROR;
+#else
+ *reso_h = DEFAULT_RESOLUTION_HORIZONTAL;
+ *reso_v = DEFAULT_RESOLUTION_VERTICAL;
+
+ return HAL_INPUT_RET_NORMAL;
+#endif
+}
diff --git a/input_hal/src/input_hal.cpp b/input_hal/src/input_hal.cpp
new file mode 100755
index 0000000..b5f4916
--- /dev/null
+++ b/input_hal/src/input_hal.cpp
@@ -0,0 +1,267 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "input_hal.h"
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "input_hal_debug.h"
+#include "input_hal_internal.h"
+#include "input_touch_ilitek.h"
+#include "input_udev_monitor.h"
+
+// Touch panel operation function info
+static struct TouchHal g_input_touch_info = { 0 };
+
+char* g_app_name = NULL;
+static bool g_touch_inited = false;
+static bool g_input_inited = false;
+
+extern bool g_break_from_watch;
+extern pthread_t g_udev_monitor_thread;
+
+// Environment key name
+#define HAL_INPUT_TARGET_BOARD "TARGET_BOARD"
+// Reference board environment value of HAL_INPUT_TARGET_BOARD
+#define HAL_INPUT_REF_BOARD_NAME "agl_reference"
+// Invalid status of report touch panel's touch event
+#define HAL_INPUT_TOUCH_REPORT_INVALID (-1)
+
+/*
+ * Input device init.
+ */
+int InitInput(const char* app_name) {
+ if (NULL == app_name) {
+ INPUT_ERROR_LOG("param is error");
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (!g_touch_inited) {
+ INPUT_ERROR_LOG("call InitTouch first.");
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (g_input_inited) {
+ INPUT_ERROR_LOG("input inited.");
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ g_break_from_watch = false;
+ if (NULL != g_app_name) {
+ delete[] g_app_name;
+ }
+
+ g_app_name = new char[strlen(app_name) + 1];
+ snprintf(g_app_name, strlen(app_name) + 1, "%s", app_name);
+ if (HAL_INPUT_RET_ERROR == InputUdevMonitorThreadCreate()) {
+ delete[] g_app_name;
+ g_app_name = NULL;
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ g_input_inited = true;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Deinit input device
+ */
+int DeInitInput() {
+ g_break_from_watch = true;
+ void* ret_val = NULL;
+ if (NULL != g_app_name) {
+ delete[] g_app_name;
+ g_app_name = NULL;
+ }
+ if (g_udev_monitor_thread != static_cast<pthread_t>(-1)) {
+ pthread_join(g_udev_monitor_thread, &ret_val);
+ }
+ g_input_inited = false;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Init those operating function of touch panel driver
+ */
+int InitTouch() {
+ int ret = InputTouchIlitekInit(&g_input_touch_info);
+ g_touch_inited = true;
+ return ret;
+}
+
+/*
+ * Make touch panel start work
+ */
+int StartTouch() {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.start) {
+ ret = g_input_touch_info.start();
+ }
+
+ return ret;
+}
+
+/*
+ * Config touch panel
+ */
+int ConfigTouch(const char *path , int reso_h, int reso_v) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.config) {
+ ret = g_input_touch_info.config(path, reso_h, reso_v);
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel device name
+ */
+int GetPanelNameTouch(char* name, size_t buf_length) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_touch_devicename) {
+ ret = g_input_touch_info.get_touch_devicename(name, buf_length);
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel key device name
+ */
+int GetKeyNameTouch(char* name, size_t buf_length) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_key_devicename) {
+ ret = g_input_touch_info.get_key_devicename(name, buf_length);
+ }
+
+ return ret;
+}
+
+/*
+ * Execute touch panel self test
+ */
+int SelfTestTouch(int id, void *result) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.selftest) {
+ ret = g_input_touch_info.selftest(id, result);
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel config status
+ */
+int GetConfigStatusTouch(int *status) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_config_status) {
+ ret = g_input_touch_info.get_config_status(status);
+ }
+
+ return ret;
+}
+
+/*
+ * Set whether the driver sends touch panel data or not
+ */
+int LockTouch(int status) {
+ static int input_touch_lock_status = HAL_INPUT_TOUCH_REPORT_INVALID;
+
+ if (input_touch_lock_status == status) {
+ return HAL_INPUT_RET_NORMAL;
+ }
+
+ int ret = HAL_INPUT_RET_ERROR;
+ if (NULL != g_input_touch_info.set_touch_lock) {
+ ret = g_input_touch_info.set_touch_lock(status);
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ input_touch_lock_status = status;
+ }
+ }
+
+ return ret;
+}
+
+/*
+ * Suspend touch panel
+ */
+int SuspendTouch() {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.set_touch_suspend) {
+ ret = g_input_touch_info.set_touch_suspend();
+ }
+
+ return ret;
+}
+
+/*
+ * Set touch panel sensitivity level
+ */
+int SetSensitivityLevelTouch(int level) {
+ int cur = HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_NONE;
+
+ int ret = GetSensitivityLevelTouch(&cur);
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ if (cur == level) {
+ // Don't need to update sensitivity level
+ INPUT_LOG_TRACE("already set level=%d", level);
+ } else {
+ if (NULL != g_input_touch_info.set_sensitivity_level) {
+ ret = g_input_touch_info.set_sensitivity_level(level);
+ } else {
+ ret = HAL_INPUT_RET_ERROR;
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel sensitivity level
+ */
+int GetSensitivityLevelTouch(int *level) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_sensitivity_level) {
+ ret = g_input_touch_info.get_sensitivity_level(level);
+ }
+
+ return ret;
+}
+
+/*
+ * Notify radio scan frequency
+ */
+int NotifyRadioScanFreqTouch(struct RadioInfoTouch *info) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.notify_radio_scan_frequency) {
+ ret = g_input_touch_info.notify_radio_scan_frequency(info);
+ }
+
+ return ret;
+}
diff --git a/input_hal/src/input_touch_ilitek.cpp b/input_hal/src/input_touch_ilitek.cpp
new file mode 100755
index 0000000..9d1822a
--- /dev/null
+++ b/input_hal/src/input_touch_ilitek.cpp
@@ -0,0 +1,226 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "input_touch_ilitek.h"
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "input_hal.h"
+
+// Touch panel device name
+#define HAL_INPUT_ILITEK_TOUCH_DEVICE_NAME "ILITEK ILITEK Multi-Touch"
+// Touch panel key device name
+#define HAL_INPUT_ILITEK_KEY_DEVICE_NAME ""
+
+// Touch panel horizontal resolution value
+#define HAL_INPUT_TOUCH_RESOLUTION_HORIZONTAL 4816
+
+// Touch panel vertical resolution value
+#define HAL_INPUT_TOUCH_RESOLUTION_VERTICAL 2992
+
+/*
+ * Make touch panel start work
+ */
+static int InputTouchStart() {
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Config touch panel
+ */
+static int InputTouchConfig(const char *path,
+ int resolution_h, int resolution_v) {
+ if (NULL == path) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (-1 == ::access(path, F_OK)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel device name
+ */
+static int InputTouchGetDeviceName(char* name, size_t buf_length) {
+ if (NULL == name) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (buf_length < (strlen(HAL_INPUT_ILITEK_TOUCH_DEVICE_NAME) + 1)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ snprintf(name, buf_length, "%s", HAL_INPUT_ILITEK_TOUCH_DEVICE_NAME);
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel key device name
+ */
+static int InputTouchGetKeyName(char* name, size_t buf_length) {
+ if (NULL == name) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (buf_length < (strlen(HAL_INPUT_ILITEK_KEY_DEVICE_NAME) + 1)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ snprintf(name, buf_length, "%s", HAL_INPUT_ILITEK_KEY_DEVICE_NAME);
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel device horizontal resolution
+ */
+static int InputTouchGetDeviceHResolution(int *resolution) {
+ if (NULL == resolution) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *resolution = HAL_INPUT_TOUCH_RESOLUTION_HORIZONTAL;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel device vertical resolution
+ */
+static int InputTouchGetDeviceVResolution(int *resolution) {
+ if (NULL == resolution) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *resolution = HAL_INPUT_TOUCH_RESOLUTION_VERTICAL;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get whether X axis is inversion
+ */
+static int InputTouchGetXAxisReverse(bool* is_reverse) {
+ if (NULL == is_reverse) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *is_reverse = false;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get whether Y axis is inversion
+ */
+static int InputTouchGetYAxisReverse(bool* is_reverse) {
+ if (NULL == is_reverse) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *is_reverse = false;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Execute touch panel self test
+ */
+static int InputTouchSelftest(int id, void *result) {
+ if (NULL == result) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Get touch panel config status
+ */
+static int InputTouchGetConfigStatus(int *status) {
+ if (NULL == status) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *status = HAL_INPUT_TOUCH_CONFIG_OFF;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Set whether the driver sends touch panel data or not
+ */
+static int InputTouchSetTouchLock(int lock) {
+ if ((HAL_INPUT_TOUCH_UNREPORT == lock) ||
+ (HAL_INPUT_TOUCH_REPORT == lock)) {
+ return HAL_INPUT_RET_NOT_SUPPORT;
+ }
+ return HAL_INPUT_RET_ERROR;
+}
+
+/*
+ * Suspend touch panel
+ */
+static int InputTouchSetTouchSuspend() {
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Set touch panel sensitivity level
+ */
+static int InputTouchSetSensitivityLevel(int level) {
+ if ((HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_LOW == level) ||
+ (HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_MIDDLE == level) ||
+ (HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_HIGH == level) ||
+ (HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_NONE == level) ) {
+ return HAL_INPUT_RET_NOT_SUPPORT;
+ }
+ return HAL_INPUT_RET_ERROR;
+}
+
+/*
+ * Get touch panel sensitivity level
+ */
+static int InputTouchGetSensitivityLevel(int *level) {
+ if (NULL == level) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Notify radio scan frequency
+ */
+static int InputTouchNotifyRadioScanFrequency(struct RadioInfoTouch *info) {
+ if (NULL == info) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Init touch panel operation function
+ */
+int InputTouchIlitekInit(struct TouchHal *touch) {
+ touch->start = InputTouchStart;
+ touch->config = InputTouchConfig;
+ touch->get_touch_devicename = InputTouchGetDeviceName;
+ touch->get_key_devicename = InputTouchGetKeyName;
+ touch->get_reso_h = InputTouchGetDeviceHResolution;
+ touch->get_reso_v = InputTouchGetDeviceVResolution;
+ touch->get_reverse_axis_x = InputTouchGetXAxisReverse;
+ touch->get_reverse_axis_y = InputTouchGetYAxisReverse;
+ touch->selftest = InputTouchSelftest;
+ touch->get_config_status = InputTouchGetConfigStatus;
+ touch->set_touch_lock = InputTouchSetTouchLock;
+ touch->set_touch_suspend = InputTouchSetTouchSuspend;
+ touch->set_sensitivity_level = InputTouchSetSensitivityLevel;
+ touch->get_sensitivity_level = InputTouchGetSensitivityLevel;
+ touch->notify_radio_scan_frequency = InputTouchNotifyRadioScanFrequency;
+ return HAL_INPUT_RET_NORMAL;
+}
diff --git a/input_hal/src/input_udev_monitor.cpp b/input_hal/src/input_udev_monitor.cpp
new file mode 100755
index 0000000..5d8cc6b
--- /dev/null
+++ b/input_hal/src/input_udev_monitor.cpp
@@ -0,0 +1,566 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <libudev.h>
+#include <native_service/ns_message_center_if.h>
+
+#include "input_hal.h"
+#include "input_hal_debug.h"
+#include "input_hal_internal.h"
+#include "input_drm.h"
+#include "input_udev_monitor.h"
+
+#define HAL_INPUT_UDEVMONITOR_THREADNAME "input_hal_udevm"
+#define max_value(x, y) ((x) > (y) ? (x) : (y))
+
+#define INPUT_VIRTUAL_INPUTDEVICE_NAME "/devices/virtual" /* Virtual device name created by SwitchManager */
+
+// Enough name length to contain node name
+#define INPUT_NODE_NAME_LENGTH 256
+
+#define TRACKING_ID_NONE -1
+
+static struct InputUdevMonitorInfo g_input_udevmonitor_info;
+static HANDLE g_sender_handle;
+static bool g_input_touch_init_notify = false;
+extern char* g_app_name; /* app name */
+bool g_break_from_watch = false; /* watch thread loop break flag */
+pthread_t g_udev_monitor_thread = -1; /* udev monitor thread */
+
+static void InputUdevMonitorTouchInitFinEventSend(int result) {
+ struct TouchInitFinishInput msg;
+
+ if (g_input_touch_init_notify) {
+ return;
+ }
+
+ if (NULL == g_sender_handle) {
+ g_sender_handle = McOpenSender(g_app_name);
+ }
+ msg.result = result;
+
+ InputUtilMCSend(
+ g_sender_handle, HAL_INPUT_SOURCE_NAME,
+ HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH, sizeof(msg), &msg);
+ g_input_touch_init_notify = true;
+}
+
+static void InputUdevMonitorInputEventHandle(int fd, int device_type, int notify_id) {
+ ssize_t read_size;
+ struct EventsPackageInput events = {0};
+
+ read_size = read(fd, events.event, sizeof(events.event));
+ if (read_size > 0) {
+ events.count = read_size / sizeof(struct input_event);
+ events.device_type = device_type;
+
+ if (NULL == g_sender_handle) {
+ g_sender_handle = McOpenSender(g_app_name);
+ }
+
+ InputUtilMCSend(
+ g_sender_handle, HAL_INPUT_SOURCE_NAME,
+ notify_id, sizeof(events), &events);
+ }
+}
+
+static void InputUdevMonitorTouchEventHandle(int fd, int notify_id) {
+ ssize_t read_size;
+ struct input_event event[HAL_INPUT_EVENT_COUNT] = {0};
+ int touch_status;
+
+ read_size = read(fd, event, sizeof(event));
+
+ if (read_size > 0) {
+ if (NULL == g_sender_handle) {
+ g_sender_handle = McOpenSender(g_app_name);
+ }
+
+ int event_num = read_size / sizeof(struct input_event);
+
+ for (int index = 0; index < event_num; ++index) {
+ if (EV_ABS == event[index].type) {
+ if (event[index].code == ABS_MT_TRACKING_ID) {
+ if (TRACKING_ID_NONE == event[index].value) {
+ touch_status = HAL_INPUT_TOUCH_RELEASE;
+ } else {
+ touch_status = HAL_INPUT_TOUCH_PRESS;
+ }
+ InputUtilMCSend(
+ g_sender_handle, HAL_INPUT_SOURCE_NAME,
+ notify_id, sizeof(touch_status), &touch_status);
+ }
+ }
+ }
+ }
+}
+
+static int InputUdevMonitorDeviceAssort(struct udev_device *dev) {
+ const char *property;
+
+ char touch_key_device_name[INPUT_NODE_NAME_LENGTH] = { 0 };
+ GetKeyNameTouch(touch_key_device_name, sizeof(touch_key_device_name));
+ const char *sysattr_name = udev_device_get_sysattr_value(dev, "name");
+ if ((sysattr_name) &&
+ (0 == strcmp(touch_key_device_name, sysattr_name))) {
+ INPUT_LOG_TRACE("DeviceAssort : ESC_SW\n");
+ return HAL_INPUT_DEVICE_TOUCH_ESCKEY;
+ }
+
+ char touch_device_name[INPUT_NODE_NAME_LENGTH] = { 0 };
+ GetPanelNameTouch(touch_device_name, sizeof(touch_device_name));
+ sysattr_name = udev_device_get_sysattr_value(dev, "name");
+ if ((sysattr_name) &&
+ (0 == strcmp(touch_device_name, sysattr_name))) {
+ INPUT_LOG_TRACE("DeviceAssort : Touch\n");
+ return HAL_INPUT_DEVICE_TOUCH;
+ }
+
+ property = udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD");
+ if ((property) && (strcmp("1", property) == 0)) {
+ INPUT_LOG_TRACE("DeviceAssort : KeyBoard\n");
+ return HAL_INPUT_DEVICE_KEYBOARD;
+ }
+
+ property = udev_device_get_property_value(dev, "ID_INPUT_TABLET");
+ if ((property) && (strcmp("1", property) == 0)) {
+ INPUT_LOG_TRACE("DeviceAssort : Tablet\n");
+ return HAL_INPUT_DEVICE_INVALID;
+ }
+
+ property = udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD");
+ if ((property) && (strcmp("1", property) == 0)) {
+ INPUT_LOG_TRACE("DeviceAssort : Touch pad\n");
+ return HAL_INPUT_DEVICE_TABLET_FINGER;
+ }
+
+ return HAL_INPUT_DEVICE_INVALID;
+}
+
+static void InputUdevMonitorDeviceListOutput(void) {
+ struct InputUtilList *p;
+
+ INPUT_LOG_TRACE("OutputList >> start ======================\n");
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+ if (NULL != entry) {
+ INPUT_LOG_TRACE("FD: %d Device=%s Assort=%d\n",
+ entry->fd, entry->device_node, entry->device_assort);
+ }
+ }
+ INPUT_LOG_TRACE("OutputList << end ======================\n");
+}
+
+static void InputUdevMonitorDeviceListDelete(const char *node) {
+ struct InputUtilList *p;
+
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+ if (strcmp(node, entry->device_node) == 0) {
+ close(entry->fd);
+ InputUtilListDelete(p);
+ free(entry);
+ break;
+ }
+ }
+ InputUdevMonitorDeviceListOutput();
+}
+
+static int InputUdevMonitorDeviceListAdd(int fd, int device_assort, const char *node) {
+ int ret = HAL_INPUT_RET_NORMAL;
+ struct InputInputDeviceList *p;
+
+ p = (struct InputInputDeviceList *) malloc(sizeof(struct InputInputDeviceList));
+ if (p) {
+ p->fd = fd;
+ p->device_assort = device_assort;
+
+ if (strlen(node) < INPUT_DEVICE_NODE_LENGTH_MAX) {
+ strncpy(p->device_node, node, sizeof(p->device_node) - 1);
+ InputUdevMonitorDeviceListDelete(node);
+ InputUtilListAdd(&p->list, &g_input_udevmonitor_info.dev_list.list);
+ } else {
+ ret = HAL_INPUT_RET_ERROR;
+ }
+ } else {
+ ret = HAL_INPUT_RET_ERROR;
+ }
+
+ InputUdevMonitorDeviceListOutput();
+
+ return ret;
+}
+
+static int InputUdevMonitorInputEventGrab(const char *node, struct udev_device *dev) {
+ int fd, rtn;
+
+ InputUdevMonitorDeviceListDelete(node);
+
+ fd = open(node, O_RDONLY);
+
+ if (fd < 0) {
+ INPUT_ERROR_LOG("ERR: open %s errno=%d \n", node, errno);
+ goto err_rtn;
+ }
+
+ rtn = ioctl(fd, EVIOCGRAB, 1);
+ if (rtn) {
+ INPUT_ERROR_LOG("ERR: ioctl grab %s \n", node);
+ goto err_rtn_close;
+ }
+ INPUT_LOG_TRACE("%s Grab \n", node);
+
+ /* Backup FD */
+ rtn = InputUdevMonitorDeviceListAdd(fd, InputUdevMonitorDeviceAssort(dev), node);
+ if (rtn) {
+ goto err_rtn_close;
+ }
+
+ return HAL_INPUT_RET_NORMAL;
+
+err_rtn_close:
+ close(fd);
+err_rtn:
+ INPUT_LOG_TRACE("%s Grab impossible \n", node);
+ return HAL_INPUT_RET_ERROR;
+}
+
+static void InputUdevMonitorFDSet(int *nfds, fd_set *fds) {
+ struct InputUtilList *p;
+
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+
+ switch (entry->device_assort) {
+ case HAL_INPUT_DEVICE_TOUCH_ESCKEY:
+ case HAL_INPUT_DEVICE_TOUCH:
+ case HAL_INPUT_DEVICE_KEYBOARD:
+ case HAL_INPUT_DEVICE_TABLET_FINGER:
+ FD_SET(entry->fd, fds);
+ *nfds = max_value(*nfds, entry->fd);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void InputUdevMonitorFDHandle(fd_set *fds) {
+ struct InputUtilList *p;
+
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+ if (FD_ISSET(entry->fd, fds)) {
+ int notify_id = 0;
+ switch (entry->device_assort) {
+ case HAL_INPUT_DEVICE_TOUCH_ESCKEY:
+ notify_id = HAL_INPUT_NOTIFY_ESC_KEY;
+ break;
+ case HAL_INPUT_DEVICE_TOUCH:
+ notify_id = HAL_INPUT_NOTIFY_TOUCH;
+ break;
+ case HAL_INPUT_DEVICE_KEYBOARD:
+ notify_id = HAL_INPUT_NOTIFY_KEY_BOARD;
+ break;
+ case HAL_INPUT_DEVICE_TABLET_FINGER:
+ notify_id = HAL_INPUT_NOTIFY_TABLET_FINGER;
+ break;
+ default:
+ return;
+ }
+ if (notify_id == HAL_INPUT_NOTIFY_TOUCH) {
+ InputUdevMonitorTouchEventHandle(entry->fd, notify_id);
+ } else {
+ InputUdevMonitorInputEventHandle(entry->fd, entry->device_assort, notify_id);
+ }
+ }
+ }
+}
+
+static int InputUdevMonitorInit(void) {
+ g_input_udevmonitor_info.udev = udev_new();
+ if (NULL == g_input_udevmonitor_info.udev) {
+ INPUT_ERROR_LOG("ERR: udev_new ret=%d \n", errno);
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ // create the udev monitor
+ g_input_udevmonitor_info.monitor = udev_monitor_new_from_netlink(g_input_udevmonitor_info.udev, "udev");
+ udev_monitor_filter_add_match_subsystem_devtype(g_input_udevmonitor_info.monitor, "input", NULL);
+
+ // start receiving hotplug events
+ udev_monitor_enable_receiving(g_input_udevmonitor_info.monitor);
+
+ INPUT_INIT_LIST_HEAD(&g_input_udevmonitor_info.dev_list.list)
+
+ return HAL_INPUT_RET_NORMAL;
+}
+
+static void InputUdevMonitorDeinit(void) {
+ // destroy the udev monitor
+ udev_monitor_unref(g_input_udevmonitor_info.monitor);
+ // destroy the udev object
+ udev_unref(g_input_udevmonitor_info.udev);
+
+ if (g_sender_handle != NULL) {
+ McClose(g_sender_handle);
+ g_sender_handle = NULL;
+ }
+
+ g_input_touch_init_notify = false;
+}
+
+static int InputUdevMonitorDevicesGet(void) {
+ int ret;
+ struct udev_enumerate *enumerate;
+ struct udev_list_entry *devices, *dev_list_entry;
+ char touch_device_name[INPUT_NODE_NAME_LENGTH] = { 0};
+ const char* sysattr_name;
+ bool input_touch_device_found = false;
+
+ // Create a list of the devices in the 'usb_device' subsystem.
+ enumerate = udev_enumerate_new(g_input_udevmonitor_info.udev);
+ udev_enumerate_add_match_subsystem(enumerate, "input");
+ udev_enumerate_scan_devices(enumerate);
+ devices = udev_enumerate_get_list_entry(enumerate);
+ GetPanelNameTouch(touch_device_name, sizeof(touch_device_name));
+
+ // Enumerate device list
+ udev_list_entry_foreach(dev_list_entry, devices) {
+ const char *path, *node;
+
+ // Get the filename of the /sys entry for the device and create a udev_device object (dev) representing it
+ path = udev_list_entry_get_name(dev_list_entry);
+ struct udev_device* dev = udev_device_new_from_syspath(g_input_udevmonitor_info.udev, path);
+ if (NULL == dev) continue;
+
+ // usb_device_get_devnode() returns the path to the device node itself in /dev.
+ node = udev_device_get_devnode(dev);
+ if (!node) {
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // Filter device name is eventX
+ if (strncmp("event", udev_device_get_sysname(dev), sizeof("event") -1) != 0) {
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // virtual device
+ if (strncmp(INPUT_VIRTUAL_INPUTDEVICE_NAME, udev_device_get_devpath(dev),
+ sizeof(INPUT_VIRTUAL_INPUTDEVICE_NAME) - 1) == 0) {
+ INPUT_LOG_TRACE("Found Virtual Device : %s \n", node);
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // check parent is input
+ struct udev_device* input_dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL);
+ if (NULL == input_dev) {
+ udev_device_unref(dev);
+ continue;
+ }
+
+ sysattr_name = udev_device_get_sysattr_value(input_dev, "name");
+ if (NULL == sysattr_name) {
+ INPUT_ERROR_LOG("ERR: Unable to find sysattr \n");
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // touchpanel device
+ if (0 == strcmp(touch_device_name, sysattr_name)) {
+ INPUT_LOG_TRACE("Found %s : %s \n", touch_device_name, path);
+ int spec_reso_h;
+ int spec_reso_v;
+ GetPanelSpecResolutionInput(&spec_reso_h, &spec_reso_v);
+ ret = ConfigTouch(udev_device_get_syspath(input_dev),
+ spec_reso_h, spec_reso_v);
+
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ int status;
+ ret = GetConfigStatusTouch(&status);
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ if (HAL_INPUT_TOUCH_CONFIG_OFF == status) {
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_NORMAL);
+ }
+ } else {
+ INPUT_ERROR_LOG("GetConfigStatusTouch fail\n");
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_ERROR);
+ }
+ } else {
+ INPUT_ERROR_LOG("ConfigTouch fail\n");
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_ERROR);
+ }
+
+ input_touch_device_found = true;
+ }
+
+ INPUT_LOG_TRACE("Found Device : %s \n", node);
+
+ /* Modified not to notify input events to other processes */
+ InputUdevMonitorInputEventGrab(node, input_dev);
+
+ udev_device_unref(dev);
+ } // end foreach
+
+ if (!input_touch_device_found) {
+ INPUT_ERROR_LOG("ERR: Dummy Device Create");
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_NORMAL);
+ }
+
+ // Free the enumerator object
+ udev_enumerate_unref(enumerate);
+
+ return HAL_INPUT_RET_NORMAL;
+}
+
+static void InputUdevMonitorDeviceStatusChange(int fd, fd_set *fds) {
+ if (FD_ISSET(fd, fds)) {
+ // receive the relevant device
+ struct udev_device* dev = udev_monitor_receive_device(g_input_udevmonitor_info.monitor);
+ if (NULL == dev) return;
+
+ // input_udev_DevicesGet(udm);
+ const char* action = udev_device_get_action(dev);
+ const char* node = udev_device_get_devnode(dev);
+ if ((!action) || (!node)) {
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (strncmp("event", udev_device_get_sysname(dev), sizeof("event") -1) != 0) {
+ INPUT_LOG_TRACE("not event device %s \n", udev_device_get_sysname(dev));
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (strncmp(INPUT_VIRTUAL_INPUTDEVICE_NAME, udev_device_get_devpath(dev),
+ sizeof(INPUT_VIRTUAL_INPUTDEVICE_NAME) - 1) == 0) {
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (strcmp(action, "remove") == 0) {
+ InputUdevMonitorDeviceListDelete(node);
+ }
+
+ struct udev_device* input_dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL);
+ if (NULL == input_dev) {
+ udev_device_unref(dev);
+ return;
+ }
+ char touch_device_name[INPUT_NODE_NAME_LENGTH] = { 0};
+ GetPanelNameTouch(touch_device_name, sizeof(touch_device_name));
+ const char *sysattr_name = udev_device_get_sysattr_value(input_dev, "name");
+ if (NULL == sysattr_name) {
+ INPUT_ERROR_LOG("ERR: Unable to find sysattr \n");
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (0 == strcmp(touch_device_name, sysattr_name)) {
+ if (strcmp(action, "remove") == 0) {
+ } else {
+ INPUT_LOG_TRACE("Found %s \n", touch_device_name);
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_NORMAL);
+ }
+ }
+
+ INPUT_LOG_TRACE("%s : %s \n", node, action);
+ if (strcmp(action, "remove") == 0) {
+ } else {
+ /* Modified not to notify input events to other processes */
+ InputUdevMonitorInputEventGrab(node, input_dev);
+ }
+ udev_device_unref(dev);
+ }
+}
+
+static void InputUdevMonitorWatch(void) {
+ fd_set fds;
+ int fd = udev_monitor_get_fd(g_input_udevmonitor_info.monitor);
+
+ if (fd != -1) {
+ while (!g_break_from_watch) {
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ int nfds = max_value(0, fd);
+
+ InputUdevMonitorFDSet(&nfds, &fds);
+
+ struct timeval timeout;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 100 * 1000;
+ int ret = select(nfds + 1, &fds, NULL, NULL, &timeout);
+ if (ret > 0) {
+ InputUdevMonitorDeviceStatusChange(fd, &fds);
+
+ InputUdevMonitorFDHandle(&fds);
+ }
+ }
+ } else {
+ INPUT_ERROR_LOG("ERR: udev_monitor_get_fd");
+ }
+}
+
+static void *InputUdevMonitorMain(void * arg) {
+ int rtn;
+ prctl(PR_SET_NAME, HAL_INPUT_UDEVMONITOR_THREADNAME);
+
+ rtn = InputUdevMonitorInit();
+ if (rtn != HAL_INPUT_RET_NORMAL) {
+ goto err_rtn;
+ }
+
+ /* Get input device */
+ InputUdevMonitorDevicesGet();
+
+ /* Input device monitoring (basically never get out from here) */
+ InputUdevMonitorWatch();
+
+ InputUdevMonitorDeinit();
+
+ return NULL;
+
+err_rtn:
+ INPUT_LOG_TRACE("pthread_detach\n");
+ return NULL;
+}
+
+int32_t InputUdevMonitorThreadCreate(void) {
+ int ret;
+
+ ret = pthread_create(&g_udev_monitor_thread, NULL, InputUdevMonitorMain, NULL);
+ if (ret != 0) {
+ INPUT_ERROR_LOG("ERR: pthread_create =%d\n", errno);
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ return HAL_INPUT_RET_NORMAL;
+}
diff --git a/input_hal/src/input_util.cpp b/input_hal/src/input_util.cpp
new file mode 100755
index 0000000..bb349eb
--- /dev/null
+++ b/input_hal/src/input_util.cpp
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "input_util.h"
+
+#include <native_service/ns_message_center_if.h>
+#include <stdio.h>
+
+#include "input_hal.h"
+#include "input_hal_debug.h"
+
+#define INPUT_UTIL_MESSAGE_SEND_RETRY 3
+#define INPUT_UTIL_MESSAGE_SEND_WAIT 10000 /* RetryWait:10ms */
+/*
+ * InputUtilListAdd
+ */
+void InputUtilListAdd(struct InputUtilList *node_new, struct InputUtilList *node_head) {
+ node_new->prev = node_head;
+ node_new->next = node_head->next;
+ node_head->next = node_new;
+ node_new->next->prev = node_new;
+}
+
+/*
+ * InputUtilListDelete
+ */
+void InputUtilListDelete(struct InputUtilList *node) {
+ node->prev->next = node->next;
+ node->next->prev = node->prev;
+}
+
+/*
+ * InputUtilMCSend
+ */
+int InputUtilMCSend(HANDLE h_message, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data) {
+ int i = 0;
+ EFrameworkunifiedStatus e_status; /* return value */
+
+ do {
+ e_status = McSend(h_message, source, cmd, length, data);
+ if (eFrameworkunifiedStatusOK == e_status) {
+ break;
+ }
+ InputUtilSleep(INPUT_UTIL_MESSAGE_SEND_WAIT);
+ } while (i++ < INPUT_UTIL_MESSAGE_SEND_RETRY);
+
+ if (e_status != eFrameworkunifiedStatusOK) {
+ INPUT_ERROR_LOG("ERR: MessageSend=%d \n", e_status);
+ }
+
+ return e_status;
+}
+
+/*
+ * InputUtilSleep
+ */
+int InputUtilSleep(int usec) {
+ struct timespec req;
+
+ req.tv_sec = 0;
+ req.tv_nsec = usec * 1000;
+ nanosleep(&req, NULL);
+
+ return HAL_INPUT_RET_NORMAL;
+}
diff --git a/kernel-module-evklib/Makefile b/kernel-module-evklib/Makefile
new file mode 100755
index 0000000..2c37667
--- /dev/null
+++ b/kernel-module-evklib/Makefile
@@ -0,0 +1,30 @@
+# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Makefile for linux/drivers/agl
+#
+CFILES = evk_lib.c
+
+obj-m := evk_lib.o
+evklib-objs := $(CFILES:.c=.o)
+
+U_INCLUDE += -I$(PWD)
+U_INCLUDE += -I$(KERNEL_SRC)/include
+ccflags-y += $(U_INCLUDE)
+
+all:
+ make -C $(KERNEL_SRC) M=$(PWD) modules
+clean:
+ make -C $(KERNEL_SRC) M=$(PWD) clean
+
diff --git a/kernel-module-evklib/agldd/agldd.h b/kernel-module-evklib/agldd/agldd.h
new file mode 100755
index 0000000..112dbae
--- /dev/null
+++ b/kernel-module-evklib/agldd/agldd.h
@@ -0,0 +1,94 @@
+/*
+ * adcpf common header
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _AGLDD_H_
+#define _AGLDD_H_
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <stdint.h>
+#if !defined(__cplusplus)
+#include <stdbool.h>
+#endif /* !defined(__cplusplus) */
+#endif /* __KERNEL__ */
+
+#ifndef __KERNEL__
+#define __LINUX_ARM_ARCH__ 7
+#define BITS_PER_LONG 32
+
+#define __AGLDD_TYPEDEF_I64
+typedef long long i64; /* 8-byte signed integer */
+
+#define __AGLDD_TYPEDEF_U64
+typedef unsigned long long u64; /* 8-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_U32
+typedef unsigned long u32; /* 4-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_U16
+typedef unsigned short u16; /* 2-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_I16
+typedef short i16; /* 2-byte signed integer */
+
+#define __AGLDD_TYPEDEF_U8
+typedef unsigned char u8; /* 1-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_I8
+typedef char i8; /* 1-byte signed integer */
+#endif
+
+#define __AGLDD_TYPEDEF_INT8
+typedef signed char INT8;
+
+#define __AGLDD_TYPEDEF_INT16
+typedef signed short INT16;
+
+#define __AGLDD_TYPEDEF_INT32
+typedef signed int INT32;
+
+#define __AGLDD_TYPEDEF_INT64
+typedef signed long long INT64;
+
+#define __AGLDD_TYPEDEF_UINT8
+typedef unsigned char UINT8;
+
+#define __AGLDD_TYPEDEF_UINT16
+typedef unsigned short UINT16;
+
+#define __AGLDD_TYPEDEF_UINT32
+typedef unsigned int UINT32;
+
+#define __AGLDD_TYPEDEF_UINT64
+typedef unsigned long long UINT64;
+
+#ifndef __KERNEL__
+#if !defined __WIN_TYPEDEF_BOOL
+#define __AGLDD_TYPEDEF_BOOL
+typedef UINT32 BOOL;
+#endif
+#endif
+
+#ifndef TRUE
+#define TRUE true
+#endif
+#ifndef FALSE
+#define FALSE false
+#endif
+
+#endif/* _AGLDD_H_ */
diff --git a/kernel-module-evklib/agldd/ev_common.h b/kernel-module-evklib/agldd/ev_common.h
new file mode 100755
index 0000000..0cc1183
--- /dev/null
+++ b/kernel-module-evklib/agldd/ev_common.h
@@ -0,0 +1,135 @@
+/**
+ * @file ev_common.h
+ * @brief Event library -- User kernel common data structure
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ev_common_h_
+#define _ev_common_h_
+
+#include <agldd/ev_id.h>
+
+/** @addtogroup EV
+ * @{ */
+/** @brief Maximum number of bytes for message event */
+#define EV_MAX_MESSAGE_LENGTH 2048
+
+/** @brief -Maximum number of flag queue that can be created within a thread */
+#define EV_MAX_IDS_IN_THREAD 24
+
+/** @brief -Muximum number of threads that can be registered to the EV in a process */
+#define EV_MAX_THREADS_IN_PROCESS 16
+
+/** @brief -Maximum number of flag queue that can be creat within a process
+ */
+#define EV_MAX_IDS_IN_PROCESS \
+ (EV_MAX_IDS_IN_THREAD * EV_MAX_THREADS_IN_PROCESS)
+
+/** @brief Return values for even library function
+ *
+ * @see EV_ERR
+ */
+enum ev_err
+{
+ EV_OK = 0, /**< Normal completion */
+ EV_ERR_Exist, /**< The specified flag message queue does exist */
+ EV_ERR_Invalid_ID, /**< The specified flag message queue does not exist */
+ EV_ERR_Busy, /**< Message queue full failed to send */
+ EV_ERR_Interrupted, /**< Waiting function was interrupted by an interrupt */
+ EV_ERR_Thread_Over, /**< Exceeding the number of threads in the process */
+ EV_ERR_Invalid_Thread, /**< Invalid thread ID */
+ EV_ERR_Fatal, /**< Fatal error */
+};
+/** @brief Return values type for even library function
+ *
+ * @see ev_err
+ */
+typedef INT32 EV_ERR;
+
+/** @brief Event type
+ *
+ * Use in the type of EV_Event structs
+ * @see ev_type
+ */
+typedef UINT32 EV_Type;
+
+/** @brief Bit value representing the type of event */
+enum ev_type {
+ EV_EVENT_None = 0x00000000,
+
+ /** Flag event: Judged by EV_EVENT_IS_FLAG() */
+ EV_EVENT_Flag = 0x0001,
+#define EV_EVENT_IS_FLAG(tp) (((tp) & EV_EVENT_Flag) != 0)
+
+ /** Message event: Judged by EV_EVENT_IS_MESSAGE() */
+ EV_EVENT_Message = 0x0002,
+#define EV_EVENT_IS_MESSAGE(tp) (((tp) & EV_EVENT_Message) != 0)
+
+ /** 64bit flag event: Judged by EV_EVENT_IS_FLAG64() */
+ EV_EVENT_Flag64 = 0x0003,
+#define EV_EVENT_IS_FLAG64(tp) (((tp) & EV_EVENT_Flag64) != 0)
+
+};
+
+/** @brief Flag event structure */
+typedef struct {
+ EV_ID flagID;/**< Flag ID */
+ UINT32 bits;/**< Bit pattern */
+} EV_Flag;
+
+/** @brief 64bit flag event structure */
+typedef struct {
+ EV_ID flagID;/**< Flag ID */
+ UINT64 bits;/**< Bit pattern */
+} EV_Flag64;
+
+/** @brief Message event structure */
+typedef struct {
+ EV_ID queueID;/**< queue ID */
+ UINT32 senderInfo;/**< Source information */
+ UINT32 length;/**< Number of bytes in the message */
+ UINT32 dummy;/** dummy for pading */
+ UINT8 message[EV_MAX_MESSAGE_LENGTH];/**< Message */
+} EV_Message;
+
+/** @brief Event structure */
+typedef struct {
+ EV_Type type; /**< Event type */
+ union {
+ EV_Flag flag; /**< Flag event structure */
+ EV_Flag64 flag64; /**< Flag event structure */
+ EV_Message message; /**< Message event structure */
+ } u; /**< Union of structures per eventtype */
+} EV_Event;
+
+/** @brief Message event queue type
+ *
+ * Specify the action to be taken when the queue overflows (more events are received when the queue is full).
+ */
+enum ev_message_queue_type {
+ EV_MESSAGE_QUEUE_TYPE_BUSY,/**< Return a BUSY to the source */
+ EV_MESSAGE_QUEUE_TYPE_FIFO,/**< Delete the oldest event */
+ EV_MESSAGE_QUEUE_TYPE_REPLACE,/**< Replace the most recent event */
+};
+
+/** @brief Messge event queue type
+ *
+ * @see ev_message_queue_type
+ */
+typedef UINT8 EV_Message_Queue_Type;
+
+/** @} */
+
+#endif /* !_ev_common_h_ */
diff --git a/kernel-module-evklib/agldd/ev_id.h b/kernel-module-evklib/agldd/ev_id.h
new file mode 100755
index 0000000..2026ef7
--- /dev/null
+++ b/kernel-module-evklib/agldd/ev_id.h
@@ -0,0 +1,104 @@
+/**
+ * @file ev_id.h
+ * @brief Event library(kernel) -- Defining flag queue ID
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ev_id_h_
+#define _ev_id_h_
+
+/** @addtogroup EV_ID_spec
+ * @{ */
+
+/** @brief Flag ID and queue ID types used when sending and receiving events
+ *
+ * Assign a 32-bit value as follows
+ *
+ * - Most significant 8 bits: Reserved
+ * - Next 16 bits: Modue ID
+ * - Lower 8 bits: Define in module
+ *
+ * Where module is the modules that creates the queue.
+ * The modules define ID according to the above assignments using EV_Flag_ID_Base and EV_Queue_ID_Base macros.
+ * @see EV_Flag_ID_Base
+ * @see EV_Queue_ID_Base
+ */
+typedef UINT32 EV_ID;
+
+#define EV_ID_BIT 0x80000000UL
+#define EV_FLAG64_BIT 0x40000000UL
+#define EV_FLAG_BIT 0x20000000UL
+#define EV_QUEUE_BIT 0x10000000UL
+#define EV_AUTO_ID_BIT 0x08000000UL
+#define EV_RESERVED_BIT 0xff000000UL
+#define EV_INVALID_ID EV_ID_BIT
+#define EV_NO_ID EV_INVALID_ID
+
+#define EV_ID_IS_FLAG(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_FLAG_BIT)) == (EV_ID_BIT|EV_FLAG_BIT))
+#define EV_ID_IS_FLAG64(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_FLAG64_BIT)) == (EV_ID_BIT|EV_FLAG64_BIT))
+#define EV_ID_IS_QUEUE(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_QUEUE_BIT)) == (EV_ID_BIT|EV_QUEUE_BIT))
+#define EV_ID_IS_AUTO_ID(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_AUTO_ID_BIT)) == (EV_ID_BIT|EV_AUTO_ID_BIT))
+#define EV_ID_IS_VALID(queueID) \
+ (EV_ID_IS_FLAG(queueID) || EV_ID_IS_FLAG64(queueID) || EV_ID_IS_QUEUE(queueID))
+
+/** @brief Macros for defining flag ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Flag_ID_Base EV_Flag_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Flag_foo (XXX_Flag_ID_Base + 1)
+ * - #define XXX_Flag_bar (XXX_Flag_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Flag_ID_Base(mod) (EV_ID_BIT|EV_FLAG_BIT|((mod)<<8))
+
+/** @brief Macros for defining 64 bits flag ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Flag64_ID_Base EV_Flag64_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Flag64_foo (XXX_Flag64_ID_Base + 1)
+ * - #define XXX_Flag64_bar (XXX_Flag64_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Flag64_ID_Base(mod) (EV_ID_BIT|EV_FLAG64_BIT|((mod)<<8))
+
+/** @brief Macros for defining mesage queue ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Queue_ID_Base EV_Queue_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Queue_foo (XXX_Queue_ID_Base + 1)
+ * - #define XXX_Queue_bar (XXX_Queue_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Queue_ID_Base(mod) (EV_ID_BIT|EV_QUEUE_BIT|((mod)<<8))
+
+/** @} */
+
+#endif /* ! _ev_id_h_ */
diff --git a/kernel-module-evklib/agldd/evk_lib.h b/kernel-module-evklib/agldd/evk_lib.h
new file mode 100755
index 0000000..416fb0f
--- /dev/null
+++ b/kernel-module-evklib/agldd/evk_lib.h
@@ -0,0 +1,116 @@
+/**
+ * @file evk_lib.h
+ * @brief Event library -- API specifications for kernel modules
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _evk_lib_h_
+#define _evk_lib_h_
+
+#include <agldd/ev_common.h>
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+/* API definition */
+
+/** @addtogroup EV
+ * @{ */
+#ifdef __KERNEL__
+/* Flag message queue create/delete */
+EV_ERR EVK_create_flag(EV_ID flagID);
+EV_ERR EVK_create_flag64(EV_ID flagID);
+EV_ERR EVK_create_queue(EV_ID queueID,
+ UINT8 length,
+ UINT16 max_bytes,
+ EV_Message_Queue_Type type);
+
+EV_ERR EVK_create_flag_auto_id(/* OUT */EV_ID *flagID);
+EV_ERR EVK_create_flag64_auto_id(/* OUT */EV_ID *flagID);
+EV_ERR EVK_create_queue_auto_id(/* OUT */EV_ID *queueID,
+ UINT8 length,
+ UINT16 max_bytes,
+ EV_Message_Queue_Type type);
+
+EV_ERR EVK_destroy_flag(EV_ID flagID);
+EV_ERR EVK_destroy_queue(EV_ID queueID);
+
+/* Send events */
+EV_ERR EVK_set_flag(EV_ID flagID, UINT32 bits);
+EV_ERR EVK_set_flag64(EV_ID flagID, UINT64 bits);
+EV_ERR EVK_send_message(EV_ID queueID, UINT16 bytes, const void *message,
+ UINT32 senderInfo);
+
+/* Get event(with search conditions) */
+EV_ERR EVK_get_flag(EV_ID flagID, /* OUT */EV_Flag *flag);
+EV_ERR EVK_wait_flag(EV_ID flagID, /* OUT */EV_Flag *flag);/* block */
+EV_ERR EVK_peek_flag(EV_ID flagID, /* OUT */EV_Flag *flag);
+EV_ERR EVK_get_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);
+EV_ERR EVK_wait_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);/* block */
+EV_ERR EVK_peek_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);
+
+EV_ERR EVK_get_message(EV_ID queueID, /* OUT */EV_Message *message);
+EV_ERR EVK_wait_message(EV_ID queueID, /* OUT */EV_Message *message);/* block */
+EV_ERR EVK_peek_message(EV_ID queueID, /* OUT */EV_Message *message);
+
+EV_ERR EVK_find_message_by_sender(EV_ID queueID, UINT32 senderInfo,
+ /* OUT */EV_Message *message);
+EV_ERR EVK_find_message_by_content(EV_ID queueID, UINT16 length,
+ const void *compare_bytes,
+ /* OUT */EV_Message *message);
+#endif
+
+/** @} */
+
+/** @addtogroup EVK_in
+ * @{ */
+#define EVK_NAME "evk"
+#define EVK_DEV_NAME "/dev/agl/"EVK_NAME
+#define EVK_DEV_MAJOR (1033 % 256)
+#define EVK_IOC_MAGIC 0xE7
+
+#define EVK_IOC_CREATE_FLAG _IO(EVK_IOC_MAGIC, 0x00)
+#define EVK_IOC_CREATE_FLAG64 _IO(EVK_IOC_MAGIC, 0x01)
+#define EVK_IOC_CREATE_MESSAGE_QUEUE _IO(EVK_IOC_MAGIC, 0x02)
+#define EVK_IOC_ALLOC_FLAG_ID _IO(EVK_IOC_MAGIC, 0x03)
+#define EVK_IOC_ALLOC_FLAG64_ID _IO(EVK_IOC_MAGIC, 0x04)
+#define EVK_IOC_ALLOC_QUEUE_ID _IO(EVK_IOC_MAGIC, 0x05)
+#define EVK_IOC_DESTROY_QUEUE _IO(EVK_IOC_MAGIC, 0x06)
+#define EVK_IOC_STORE_FLAG _IO(EVK_IOC_MAGIC, 0x07)
+#define EVK_IOC_STORE_FLAG64 _IO(EVK_IOC_MAGIC, 0x08)
+#define EVK_IOC_STORE_MESSAGE _IO(EVK_IOC_MAGIC, 0x09)
+#define EVK_IOC_SET_POLL _IO(EVK_IOC_MAGIC, 0x0a)
+#define EVK_IOC_GET_EVENT _IO(EVK_IOC_MAGIC, 0x0b)
+#define EVK_IOC_PEEK_EVENT _IO(EVK_IOC_MAGIC, 0x0c)
+#define EVK_IOC_WAIT_EVENT _IO(EVK_IOC_MAGIC, 0x0d)
+#define EVK_IOC_GET_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0e)
+#define EVK_IOC_PEEK_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0f)
+#define EVK_IOC_DEBUG_LIST _IO(EVK_IOC_MAGIC, 0x10)
+
+typedef struct {
+ EV_ID queueID;/**< Queue ID */
+ UINT32 max_bytes;/**< Maximum number of bytes for an event */
+ UINT8 length;/**< Queue length */
+ EV_Message_Queue_Type type;/**< Type */
+} EVK_Message_Queue_Request;
+
+typedef struct {
+ INT32 num; /**< Number of queue ID of search */
+ EV_ID ids[EV_MAX_IDS_IN_PROCESS]; /**< Queue ID of search */
+ EV_Event ev; /**< [OUT] First event that occured */
+} EVK_Next_Event_Query;
+
+/** @} */
+
+#endif /* !_evk_lib_h */
diff --git a/kernel-module-evklib/agldd/moduleid.h b/kernel-module-evklib/agldd/moduleid.h
new file mode 100755
index 0000000..b18c1a1
--- /dev/null
+++ b/kernel-module-evklib/agldd/moduleid.h
@@ -0,0 +1,69 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <linux/autoconf.h>
+#ifndef _AGLDD_MODULEID_H_
+#define _AGLDD_MODULEID_H_
+
+/*
+ * Define module ID to be used by programs in moduleid_id.h .
+ * Define in the format of "#define XXX_MID ID number" (XXX is the module name).
+ *
+ * MID allocation policy shall be as follows.
+ * - UI Application : 0xxxh
+ * - Application Service : 1xxxh to 2xxxh
+ * + HMI : 10xxh
+ * + AV : 12xxh
+ * + Radio : 14xxh
+ * + Connectivity : 16xxh
+ * + Navigation/Location: 18xxh
+ * + Vehicle : 1Axxh
+ * + Communication : 1Cxxh
+ * + BasePF : 1Exxh
+ * + System : 20xxh
+ * + Other : 22xxh
+ * - Common Service : 3xxxh
+ * - Extension Service : 4xxxh
+ * - System/Device Driver : 5xxxh
+ */
+
+/* UI Application : 0xxxh */
+
+/* Application Service : 1xxxh to 2xxxh */
+#define MODEMANAGER_MID 0x1000
+#define ACTIVITYMANAGER_MID 0x1001
+
+/* Common Service : 3xxxh */
+#define IPMANAGER_MID 0x3000
+#define DEVICEMANAGER_MID 0x3001
+#define MSGBRK_MID 0x3002
+#define TIMERENTRYDRV_MID 0x3003
+#define SOUNDAGENT_MID 0x3004
+#define CAN_MID 0x3006
+#define _CWORD83__MID 0x3007
+#define SENSOR_MID 0x3008
+#define GPS_MID 0x3009
+#define RESMGR_MID 0x300A
+#define GRAPHICS_MID 0x300B
+
+/* Extension Service : 4xxxh */
+
+/* System/Device Driver : 5xxxh */
+#define EV_MID 0x5001
+#define RPC_MID 0x5002
+#define EVK_MID 0x5801
+
+#endif /* !_AGLDD_MODULEID_H_ */
diff --git a/kernel-module-evklib/evk_lib.c b/kernel-module-evklib/evk_lib.c
new file mode 100755
index 0000000..d5c1718
--- /dev/null
+++ b/kernel-module-evklib/evk_lib.c
@@ -0,0 +1,2246 @@
+/*
+ * drivers/agl/evk_lib.c
+ *
+ * Event library (kernel space part)
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <generated/autoconf.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/version.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+#include <linux/poll.h>
+#include <linux/list.h>
+#include <asm/uaccess.h>
+#include <linux/errno.h>
+#include <linux/vmalloc.h>
+
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+
+#include <linux/device.h>
+#include <linux/cdev.h>
+
+#ifndef STANDARD_INT_DEFINITIONS
+#define STANDARD_INT_DEFINITIONS
+typedef __u8 UINT8;
+typedef __u16 UINT16;
+typedef __u32 UINT32;
+typedef __u64 UINT64;
+typedef __s8 INT8;
+typedef __s16 INT16;
+typedef __s32 INT32;
+typedef __s64 INT64;
+#endif /* !STANDARD_INT_DEFINITIONS */
+
+#define ENABLE_PROC_FS 1
+
+#include <agldd/evk_lib.h>
+
+/** @addtogroup EV_in */
+/** @{ */
+/** In Linux2.4, list_for_each_entry is not provided, so it is prepared by self (in 2.6)
+ */
+#ifdef list_for_each_entry
+#define __LINUX_26_OR_HIGHER
+#endif
+
+#ifndef __LINUX_26_OR_HIGHER /* linux v2.4 */
+
+#define list_for_each_entry(pos, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ prefetch(pos->member.next); \
+ &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member), \
+ prefetch(pos->member.next))
+
+#define list_for_each_entry_safe(pos, n, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+#else /* linux v2.6 */
+
+#include <linux/jiffies.h>
+
+#endif /* linux v2.6 */
+
+#define EVK_assert(cond, mesg) \
+ if (!(cond)) { \
+ printk(KERN_ALERT "[EVK]ASSERT(pid:%d): " #cond " at %s:%d; " \
+ #mesg "\n", current->pid, __FILE__, __LINE__); \
+ do {} while(1); \
+ }
+
+#define EVK_BUG(mesg) \
+ printk(KERN_ALERT "[EVK]BUG: " mesg); \
+ do {} while(1);
+
+#if 0
+#define EVK_info0(s) printk(KERN_ALERT "[EVK]INFO: " s)
+#define EVK_info1(s, t) printk(KERN_ALERT "[EVK]INFO: " s, t)
+#else
+#define EVK_info0(s)
+#define EVK_info1(s, t)
+#endif
+
+static int devmajor = EVK_DEV_MAJOR;
+static int devminor = 0;
+static int nrdevs = 1;
+static struct cdev cdev;
+static struct class *pClass;
+
+DEFINE_SEMAPHORE(evk_mtx);
+static int down_pid;
+static int down_line;
+#define EVK_mutex_lock() { \
+ down(&evk_mtx); \
+ down_pid = current->pid; \
+ down_line = __LINE__; \
+}
+#define EVK_mutex_unlock() (up(&evk_mtx))
+
+#ifdef EVK_USE_KMALLOC
+#define evk_malloc(s) kmalloc((s), GFP_KERNEL)
+#define evk_free kfree
+#else // use vmalloc (this is the default)
+#define evk_malloc(s) vmalloc((s))
+#define evk_free vfree
+#endif
+
+enum {
+ evk_mem_user = 0,
+ evk_mem_kernel,
+};
+
+enum {
+ evk_enum_flag,
+ evk_enum_flag64,
+ evk_enum_queue,
+};
+
+#define GET_USER_OR_KERNEL(to, from) \
+({ \
+ int err; \
+ if (mem == evk_mem_user) { \
+ err = __get_user((to), &(from)); \
+ } else { \
+ (to) = (from); \
+ err = 0; \
+ } \
+ err; \
+})
+
+#define PUT_USER_OR_KERNEL(value, to) \
+({ \
+ int err; \
+ if (mem == evk_mem_user) { \
+ err = __put_user((value), &(to)); \
+ } else { \
+ (to) = (value); \
+ err = 0; \
+ } \
+ err; \
+})
+
+
+/** @brief Common part of the flag structure and message queue structure */
+#define EVK_COMMON_QUEUE_ELEMS \
+ struct list_head list; /**< List structure */ \
+ wait_queue_head_t wq_head; /**< Wait_queue of a process waiting for a queue */\
+ EV_ID queueID; /**< Flag ID/Queue ID */ \
+ UINT32 seq_num; /**< Order of event arrival */ \
+ pid_t read_pid; /**< Read process ID */ \
+ pid_t pid; /**< Owning process ID */
+
+/** @brief Common part of the flag structure and message queue structure */
+struct common_queue {
+ EVK_COMMON_QUEUE_ELEMS
+};
+
+/** @brief Flag structure */
+struct flag {
+ EVK_COMMON_QUEUE_ELEMS
+ UINT32 value;/**< Flags value */
+};
+#define EVK_PFLAG(queue) ((struct flag*)queue)
+
+/** @brief 64-bit flag structure */
+struct flag64 {
+ EVK_COMMON_QUEUE_ELEMS
+ UINT64 value;/**< Flags value */
+};
+#define EVK_PFLAG64(queue) ((struct flag64*)queue)
+
+/** @brief Message queue structure */
+struct message_queue {
+ EVK_COMMON_QUEUE_ELEMS
+ UINT8 type;/**< Type */
+ UINT8 length;/**< Queue length */
+ UINT8 num;/**< Number of messages stored */
+ UINT8 readptr;/**< Next read position(0~length-1) */
+ UINT32 max_bytes;/**< -Maximum bytes per message */
+ UINT8 *message;/**< Message storage area (ring buffer) */
+};
+#define EVK_PQUEUE(queue) ((struct message_queue*)queue)
+
+/** @brief Number of bytes to allocate per message
+ *
+ * This function allocates an area to store the number of bytes actually stored, the time of occurrence,
+ * and the senderInfo, in addition to the number of bytes specified by max_bytes.
+ */
+#define EVK_message_block_size(max_bytes) (sizeof(UINT32) * 3 + (max_bytes))
+
+#define HASH_KEY 15
+
+/** @brief Maximum number of flags used by all systems */
+#define EVK_MAX_FLAGS 48
+/** @brief Maximum number of 64-bit flags used by all systems */
+#define EVK_MAX_FLAG64S 4
+/** @brief Maximum number of message event queues used by all systems */
+/* M1SP BM3547 MESSAGE_QUEUES 128->144 */
+/* M9AT BM2066 MESSAGE_QUEUES 144->218 */
+#define EVK_MAX_MESSAGE_QUEUES 224
+
+/** @brief Allocate flag structure statically */
+static struct flag _flag_pool[EVK_MAX_FLAGS];
+/** @brief Statically allocates a 64-bit flag structure */
+static struct flag64 _flag64_pool[EVK_MAX_FLAG64S];
+/** @brief Beginning of the list of unused flags */
+static LIST_HEAD(flag_pool);
+/** @brief Beginning of the list of unused 64-bit flags */
+static LIST_HEAD(flag64_pool);
+
+/** @brief Allocate message queue structure statically */
+static struct message_queue _message_queue_pool[EVK_MAX_MESSAGE_QUEUES];
+/** @brief Top of the list of unused message queues */
+static LIST_HEAD(message_queue_pool);
+
+/** @brief List of Flags/Message Queues in Use
+ *
+ * Connects the usage flag/message queue to a list for each hash value obtained from the ID.
+ * The hash value is the remainder of the ID divided by HASH_KEY.
+ */
+static struct list_head queue_entry[HASH_KEY];
+
+/** @brief Sequence number to use during automatic ID assignment */
+static EV_ID sequence_id = 0;
+
+/** @brief Number to be assigned in order of occurrence of the event */
+static UINT32 sequence_number = 0;
+
+unsigned int
+evk_get_queue_entry(struct list_head **entries)
+{
+ if (entries) {
+ *entries = queue_entry;
+ return HASH_KEY;
+ }
+ return 0;
+}
+
+static __inline__ int
+calc_hash(UINT32 val)
+{
+ return val % HASH_KEY;
+}
+
+static __inline__
+struct flag *
+alloc_flag(void)
+{
+ struct flag *queue;
+ //EVK_assert(!list_empty(&flag_pool), "flag pool empty");
+ if (list_empty(&flag_pool)) {
+ printk("%s ERROR: flag pool empty\n", __func__);
+ return NULL;
+ }
+ queue = (struct flag *)flag_pool.next;
+ list_del_init(&(queue->list));
+ return queue;
+}
+
+static __inline__
+struct flag64 *
+alloc_flag64(void)
+{
+ struct flag64 *queue;
+ //EVK_assert(!list_empty(&flag64_pool), "flag64 pool empty");
+ if (list_empty(&flag64_pool)) {
+ printk("%s ERROR: flag64 pool empty\n", __func__);
+ return NULL;
+ }
+ queue = (struct flag64 *)flag64_pool.next;
+ list_del_init(&(queue->list));
+ return queue;
+}
+
+static __inline__ void
+free_flag(struct flag *queue)
+{
+ list_add((struct list_head *)queue, &flag_pool);
+}
+
+static __inline__ void
+free_flag64(struct flag64 *queue)
+{
+ list_add((struct list_head *)queue, &flag64_pool);
+}
+
+static __inline__
+struct message_queue *
+alloc_message_queue(void)
+{
+ struct message_queue *queue;
+ //EVK_assert(!list_empty(&message_queue_pool), "message queue pool empty");
+ if (list_empty(&message_queue_pool)) {
+ printk("%s ERROR: message queue pool empty\n", __func__);
+ return NULL;
+ }
+ queue = (struct message_queue *)message_queue_pool.next;
+ list_del_init(&(queue->list));
+ queue->message = NULL;
+ return queue;
+}
+
+static __inline__ void
+free_message_queue(struct message_queue *queue)
+{
+ if (queue->message != NULL) {
+ evk_free(queue->message);
+ queue->message = NULL;
+ }
+ list_add((struct list_head *)queue, &message_queue_pool);
+}
+
+static __inline__
+struct common_queue *
+find_queue_entry(EV_ID queueID)
+{
+ struct list_head *list;
+ struct common_queue *queue;
+ int hash = calc_hash(queueID);
+ list = &(queue_entry[hash]);
+ list_for_each_entry(queue, list, list) { /* pgr0060 */ /* pgr0039 */
+ if (queue->queueID == queueID) {
+ return queue;
+ }
+ }
+ return NULL;
+}
+
+static __inline__ void
+attach_queue_entry(struct common_queue *queue, EV_ID queueID)
+{
+ int hash = calc_hash(queueID);
+ list_add_tail((struct list_head *)queue, &(queue_entry[hash]));
+}
+
+static __inline__ void
+detach_queue_entry(struct common_queue *queue)
+{
+ list_del_init((struct list_head *)queue);
+}
+
+static __inline__ void
+init_common_queue(struct common_queue *queue, EV_ID queueID)
+{
+ queue->queueID = queueID;
+ queue->pid = current->pid;
+ queue->read_pid = 0;
+ init_waitqueue_head(&(queue->wq_head));
+}
+
+static __inline__ void
+evk_init_flag(struct flag *queue, EV_ID queueID)
+{
+ init_common_queue((struct common_queue *)queue, queueID);
+ queue->value = 0;
+}
+
+static __inline__ void
+evk_init_flag64(struct flag64 *queue, EV_ID queueID)
+{
+ init_common_queue((struct common_queue *)queue, queueID);
+ queue->value = 0;
+}
+
+static __inline__ int
+evk_init_message_queue(struct message_queue *queue, EV_ID queueID,
+ UINT8 length, UINT32 max_bytes, UINT8 type)
+{
+ init_common_queue((struct common_queue *)queue, queueID);
+ queue->type = type;
+ queue->length = length;
+ queue->max_bytes = max_bytes;
+ queue->num = 0;
+ queue->readptr = 0;
+ EVK_assert(queue->message == NULL, "message buffer was not freed");
+ queue->message = evk_malloc(length * EVK_message_block_size(max_bytes));
+ EVK_assert(queue->message != NULL, "can't alloc message buffer");
+ return 0;
+}
+
+static void
+__list_queues(void)
+{
+ struct list_head *list;
+ struct common_queue *queue;
+ int i;
+ for(i = 0 ; i < HASH_KEY ; i++) {
+ list = &(queue_entry[i]);
+ if (!list_empty(list)) {
+ printk(KERN_ALERT "%d->", i);
+ list_for_each_entry(queue, list, list) { /* pgr0060 */ /* pgr0039 */
+ printk("%x[%x] ", queue->queueID, queue->seq_num);
+ }
+ printk("\n");
+ }
+ }
+}
+
+static int
+evk_destroy_queue(EV_ID queueID)
+{
+ struct common_queue *queue;
+ int err = 0;
+ EVK_info1("flag destroy %x\n", queueID);
+
+ EVK_mutex_lock(); /*************************************/
+ queue = find_queue_entry(queueID);
+ if (queue == NULL) {
+ err = -ENOENT;
+ goto finish;
+ }
+
+ detach_queue_entry(queue);
+
+ /* wake up processes before destruction */
+ wake_up_interruptible(&(queue->wq_head));
+
+ init_common_queue(queue, EV_INVALID_ID);
+
+ if (EV_ID_IS_FLAG(queueID)) {
+ free_flag((struct flag *)queue);
+ } else if (EV_ID_IS_FLAG64(queueID)) {
+ free_flag64((struct flag64 *)queue);
+ } else if (EV_ID_IS_QUEUE(queueID)) {
+ free_message_queue((struct message_queue *)queue);
+ }
+ //__list_queues();
+ finish:
+ EVK_mutex_unlock(); /*************************************/
+ return err;
+}
+
+static int
+evk_open(struct inode *inode, struct file *file)
+{
+ // Recording of current and measures not to be read or deleted from others are required. */
+ file->private_data = (void *)EV_INVALID_ID;
+ return 0;
+}
+
+static int
+evk_close(struct inode *inode, struct file *file)
+{
+ if (EV_ID_IS_VALID((EV_ID)file->private_data)) {
+ evk_destroy_queue((EV_ID)file->private_data);
+ }
+ file->private_data = (void *)EV_INVALID_ID;
+ return 0;
+}
+
+static int
+evk_create_flag(EV_ID queueID)
+{
+ struct flag *queue;
+ int err = 0;
+ EVK_info1("flag create %x\n", queueID);
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct flag *)find_queue_entry(queueID);
+ if (queue != NULL) {
+ err = -EEXIST;
+ goto finish;
+ }
+
+ queue = alloc_flag();
+ if (queue == NULL) {
+ err = -ENOMEM;
+ goto finish;
+ }
+
+ evk_init_flag(queue, queueID);
+ attach_queue_entry((struct common_queue *)queue, queueID);
+
+ //__list_queues();
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+ return err;
+}
+
+static int
+evk_create_flag64(EV_ID queueID)
+{
+ struct flag64 *queue;
+ int err = 0;
+ EVK_info1("flag64 create %x\n", queueID);
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct flag64 *)find_queue_entry(queueID);
+ if (queue != NULL) {
+ err = -EEXIST;
+ goto finish;
+ }
+
+ queue = alloc_flag64();
+ if (queue == NULL) {
+ err = -ENOMEM;
+ goto finish;
+ }
+
+ evk_init_flag64(queue, queueID);
+ attach_queue_entry((struct common_queue *)queue, queueID);
+
+ //__list_queues();
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+ return err;
+}
+
+static int
+evk_create_message_queue(EV_ID queueID, UINT8 length,
+ UINT32 max_bytes, EV_Message_Queue_Type type)
+{
+ struct message_queue *queue;
+ int err;
+ EVK_info1("message create %x\n", queueID);
+
+ err = 0;
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct message_queue *)find_queue_entry(queueID);
+ if (queue != NULL) {
+ err = -EEXIST;
+ goto finish;
+ }
+
+ queue = alloc_message_queue();
+ if (queue == NULL) {
+ err = -ENOMEM;
+ goto finish;
+ }
+
+ err = evk_init_message_queue(queue, queueID, length, max_bytes, type);
+ if (err == 0) {
+ attach_queue_entry((struct common_queue *)queue, queueID);
+ } else {
+ free_message_queue(queue);
+ }
+
+ //__list_queues();
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+ return err;
+}
+
+static EV_ID
+get_seq_id(void)
+{
+ EV_ID ret;
+ sequence_id++;
+ if ((sequence_id & EV_RESERVED_BIT) != 0) {/* round to 1 */
+ sequence_id = 1;
+ EVK_info0("auto ID rounded\n");
+ }
+ ret = sequence_id;
+ return ret;
+}
+
+static int
+evk_alloc_flagID(EV_ID *queueID)
+{
+ EV_ID seq_id;
+
+ EVK_mutex_lock(); /*************************************/
+ do {
+ seq_id = get_seq_id();
+ seq_id |= (EV_ID_BIT | EV_FLAG_BIT | EV_AUTO_ID_BIT);
+ } while(find_queue_entry(seq_id) != NULL);
+ EVK_mutex_unlock(); /*************************************/
+
+ *queueID = seq_id;
+ return 0;
+}
+
+static int
+evk_alloc_flag64ID(EV_ID *queueID)
+{
+ EV_ID seq_id;
+
+ EVK_mutex_lock(); /*************************************/
+ do {
+ seq_id = get_seq_id();
+ seq_id |= (EV_ID_BIT | EV_FLAG64_BIT | EV_AUTO_ID_BIT);
+ } while(find_queue_entry(seq_id) != NULL);
+ EVK_mutex_unlock(); /*************************************/
+
+ *queueID = seq_id;
+ return 0;
+}
+
+static int
+evk_alloc_queueID(EV_ID *queueID)
+{
+ EV_ID seq_id;
+
+ EVK_mutex_lock(); /*************************************/
+ do {
+ seq_id = get_seq_id();
+ seq_id |= (EV_ID_BIT | EV_QUEUE_BIT | EV_AUTO_ID_BIT);
+ } while(find_queue_entry(seq_id) != NULL);
+ EVK_mutex_unlock(); /*************************************/
+
+ *queueID = seq_id;
+ return 0;
+}
+
+static int
+evk_store_flag(EV_Flag *ev, int mem)
+{
+ struct flag *queue;
+ int ret = 0;
+ EV_ID flagID;
+ UINT32 bits;
+
+ if (GET_USER_OR_KERNEL(flagID, ev->flagID)) /* pgr0039 */
+ return -EFAULT;
+ if (GET_USER_OR_KERNEL(bits, ev->bits)) /* pgr0039 */
+ return -EFAULT;
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct flag *)find_queue_entry(flagID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("set_flag: No such ID %x\n", flagID);
+ ret = -ENOENT;
+ goto finish;
+ }
+
+ if (queue->value == 0) {
+ queue->seq_num = sequence_number++;
+ }
+ queue->value |= bits; /* pgr0000 */
+
+ wake_up_interruptible(&(queue->wq_head));
+
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+ return ret;
+}
+
+static int
+evk_store_flag64(EV_Flag64 *ev, int mem)
+{
+ struct flag64 *queue;
+ int ret = 0;
+ EV_ID flagID;
+ UINT64 bits = 0;
+
+ if (GET_USER_OR_KERNEL(flagID, ev->flagID)) /* pgr0039 */
+ return -EFAULT;
+ //GET_USER_OR_KERNEL(bits, ev->bits); /* pgr0039 */
+ if (mem == evk_mem_user) {
+ if (copy_from_user(&bits, &(ev->bits), sizeof(bits)))
+ return -EFAULT;
+ } else {
+ bits = ev->bits;
+ }
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct flag64 *)find_queue_entry(flagID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("set_flag64: No such ID %x\n", flagID);
+ ret = -ENOENT;
+ goto finish;
+ }
+
+ if (queue->value == 0) {
+ queue->seq_num = sequence_number++;
+ }
+ queue->value |= bits; /* pgr0000 */
+
+ wake_up_interruptible(&(queue->wq_head));
+
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+ return ret;
+}
+
+static int
+evk_store_message(EV_Message *ev, int mem)
+{
+ struct message_queue *queue;
+ UINT8 *ptr;
+ UINT8 writeptr;
+ int ret = 0;
+ EV_ID queueID;
+ UINT32 length, senderInfo, seq;
+
+ if (GET_USER_OR_KERNEL(queueID, ev->queueID)) /* pgr0039 */
+ return -EFAULT;
+ if (GET_USER_OR_KERNEL(length, ev->length)) /* pgr0039 */
+ return -EFAULT;
+ if (GET_USER_OR_KERNEL(senderInfo, ev->senderInfo)) /* pgr0039 */
+ return -EFAULT;
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct message_queue *)find_queue_entry(queueID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("store_message: No such queueID %x\n", queueID);
+ ret = -ENOENT;
+ goto finish;
+ }
+
+ if (length > queue->max_bytes) { /* pgr0000 */
+ EVK_info0("store_message: message is too long for the queue");
+ ret = -EINVAL;
+ goto finish;
+ }
+
+ if (queue->num == queue->length) {
+
+ switch(queue->type) {
+ case EV_MESSAGE_QUEUE_TYPE_BUSY:
+ EVK_info1("store_message: queue %x BUSY\n", queueID);
+ ret = -EBUSY;
+ goto finish;
+ break;
+
+ case EV_MESSAGE_QUEUE_TYPE_FIFO:
+ queue->readptr++;
+ queue->readptr %= queue->length;
+ queue->num--;
+ break;
+
+ case EV_MESSAGE_QUEUE_TYPE_REPLACE:
+ queue->num--;
+ break;
+
+ default:
+ EVK_BUG("internal error in store_message\n");
+ ret = -EINVAL;
+ goto finish;
+ break;
+ }
+ }
+
+ writeptr = (queue->readptr + queue->num) % queue->length;
+ ptr = queue->message + writeptr * EVK_message_block_size(queue->max_bytes);
+
+ memcpy(ptr, &length, sizeof(length));
+ ptr += sizeof(length);
+ memcpy(ptr, &senderInfo, sizeof(senderInfo));
+ ptr += sizeof(senderInfo);
+ seq = sequence_number++;
+ memcpy(ptr, &seq, sizeof(seq));
+ ptr += sizeof(seq);
+
+ if (queue->num == 0) {
+ queue->seq_num = seq;
+ }
+ queue->num++;
+
+ if (mem == evk_mem_user) {
+ if (copy_from_user(ptr, ev->message, length)) {
+ ret = -EFAULT;
+ goto finish;
+ }
+ } else {
+ memcpy(ptr, ev->message, length);
+ }
+
+ wake_up_interruptible(&(queue->wq_head));
+
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+
+ return ret;
+}
+
+static int
+evk_set_poll(struct file *filp, EV_ID queueID)
+{
+ struct common_queue *queue;
+ int err = 0;
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = find_queue_entry(queueID);
+ if (queue == NULL) {
+ EVK_info1("set_poll: ID %x not found.\n", queueID);
+ err = -ENOENT;
+ goto finish;
+ }
+
+ filp->private_data = (void *)queueID;
+
+ finish:
+ EVK_mutex_unlock(); /*************************************/
+ return err;
+}
+
+static int
+evk_get_flag_event(EV_Event *ev, int peek_only, int wait, int mem)
+{
+ struct flag *queue, *queue2;
+ int err = 0;
+ int found = 0;
+ EV_ID flagID;
+
+ if (GET_USER_OR_KERNEL(flagID, ev->u.flag.flagID)) /* pgr0039 */
+ return -EFAULT;
+
+ retry:
+
+ queue = (struct flag *)find_queue_entry(flagID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("get_flag: No such flag %x\n", flagID);
+ err = -ENOENT;
+ goto finish;
+ }
+
+ if (queue->value != 0) {
+ UINT32 bits;
+
+ if (GET_USER_OR_KERNEL(bits, ev->u.flag.bits)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+
+ if (bits == 0 || ((bits & queue->value) != 0)) { /* pgr0000 */
+
+ if (PUT_USER_OR_KERNEL(EV_EVENT_Flag, ev->type)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (PUT_USER_OR_KERNEL(queue->value, ev->u.flag.bits)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ found = 1;
+
+ queue->read_pid = current->pid;
+ if (peek_only) {
+ ;
+ } else {
+ queue->value = 0;
+ }
+ }
+ }
+ finish:
+
+ if (queue != NULL && wait != 0 && found == 0) {
+ int wait_ret;
+ EVK_mutex_unlock(); /*************************************/
+
+ wait_ret
+ = wait_event_interruptible(queue->wq_head,
+ ((queue2 = (struct flag *)find_queue_entry(flagID)) == NULL
+ || queue2->value != 0));
+
+ EVK_mutex_lock(); /*************************************/
+
+ if (wait_ret != 0) {
+ EVK_info1("Interrupted while waiting for flag %x\n", flagID);
+ err = -EINTR;
+ } else if (queue2 == NULL) { /* pgr0039 */
+ EVK_info1("flag %x was destroyed while waiting for it\n", flagID);
+ err = -ENOENT;
+ } else {
+ goto retry;
+ }
+ }
+ return err;
+}
+
+static int
+evk_get_flag64_event(EV_Event *ev, int peek_only, int wait, int mem)
+{
+ struct flag64 *queue, *queue2;
+ int err = 0;
+ int found = 0;
+ EV_ID flagID;
+
+ if (GET_USER_OR_KERNEL(flagID, ev->u.flag64.flagID)) /* pgr0039 */
+ return -EFAULT;
+
+ retry:
+
+ queue = (struct flag64 *)find_queue_entry(flagID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("get_flag64: No such flag %x\n", flagID);
+ err = -ENOENT;
+ goto finish;
+ }
+
+ if (queue->value != 0) {
+ UINT64 bits = 0;
+
+ //GET_USER_OR_KERNEL(bits, ev->u.flag64.bits); /* pgr0039 */
+ if (mem == evk_mem_user) {
+ if (copy_from_user(&bits, &(ev->u.flag64.bits), sizeof(bits))) {
+ err = -EFAULT;
+ goto finish;
+ }
+ } else {
+ bits = ev->u.flag64.bits;
+ }
+
+ if (bits == 0 || ((bits & queue->value) != 0)) { /* pgr0000 */
+
+ if (PUT_USER_OR_KERNEL(EV_EVENT_Flag64, ev->type)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (PUT_USER_OR_KERNEL(queue->value, ev->u.flag64.bits)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ found = 1;
+
+ queue->read_pid = current->pid;
+ if (peek_only) {
+ ;
+ } else {
+ queue->value = 0;
+ }
+ }
+ }
+ finish:
+
+ if (queue != NULL && wait != 0 && found == 0) {
+ int wait_ret;
+ EVK_mutex_unlock(); /*************************************/
+
+ wait_ret
+ = wait_event_interruptible(queue->wq_head,
+ ((queue2 = (struct flag64 *)find_queue_entry(flagID)) == NULL
+ || queue2->value != 0));
+
+ EVK_mutex_lock(); /*************************************/
+
+ if (wait_ret != 0) {
+ EVK_info1("Interrupted while waiting for flag %x\n", flagID);
+ err = -EINTR;
+ } else if (queue2 == NULL) { /* pgr0039 */
+ EVK_info1("flag %x was destroyed while waiting for it\n", flagID);
+ err = -ENOENT;
+ } else {
+ goto retry;
+ }
+ }
+ return err;
+}
+
+static __inline__ void
+remove_message_event(struct message_queue *queue, UINT8 removeptr)
+{
+ UINT8 *ptr;
+ int i, from, to;
+ UINT8 *pFrom, *pTo;
+ UINT32 size;
+ int offset;
+
+ queue->num--;
+ offset = (int)removeptr - (int)(queue->readptr);
+
+ if (offset == 0) {/* To remove the head of the queue, advance the queue by one readptr only */
+ queue->readptr++;
+ queue->readptr %= queue->length;
+
+ if (queue->num > 0) {
+ /* Reset the occurrence time of the first message in the queue to the occurrence time of the queue. */
+ ptr = (queue->message
+ + queue->readptr * EVK_message_block_size(queue->max_bytes));
+ ptr += sizeof(UINT32) * 2;
+ memcpy(&(queue->seq_num), ptr, sizeof(UINT32));
+ }
+ return;
+ }
+ if (offset < 0) {
+ offset += queue->length;
+ }
+ if (offset == queue->num) {/* Do nothing to delete the end of the queue */
+ return;
+ }
+
+ /* To delete a message in the middle of the queue, pack the following messages. */
+ to = removeptr;
+ size = EVK_message_block_size(queue->max_bytes);
+
+ for(i = 0 ; i < queue->num - offset ; i++, to++) {
+ to %= queue->length;
+ from = (to + 1) % queue->length;
+ pFrom = queue->message + from * size;
+ pTo = queue->message + to * size;
+ memcpy(pTo, pFrom, size);
+ }
+}
+
+static int
+evk_get_message_event(EV_Event *ev, int peek_only, int wait, int mem)
+{
+ struct message_queue *queue, *queue2;
+ int err = 0;
+ EV_ID queueID;
+ UINT8 num;
+ UINT8 readptr;
+ UINT8 i, *ptr;
+ int matched = 0;
+
+ if (GET_USER_OR_KERNEL(queueID, ev->u.message.queueID)) /* pgr0039 */
+ return -EFAULT;
+
+ retry:
+ queue = (struct message_queue *)find_queue_entry(queueID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("get_message: No such queue %x\n", queueID);
+ err = -ENOENT;
+ goto finish;
+ }
+
+ num = queue->num;
+ readptr = queue->readptr;
+ for(i = 0 ; i < num ; i++, readptr = (readptr + 1) % queue->length) {
+ UINT32 size, senderInfo, seq;
+ UINT32 length, q_senderInfo;
+
+ ptr = (queue->message
+ + readptr * EVK_message_block_size(queue->max_bytes));
+
+ memcpy(&size, ptr, sizeof(size));
+ ptr += sizeof(size);
+ memcpy(&senderInfo, ptr, sizeof(senderInfo));
+ ptr += sizeof(senderInfo);
+ memcpy(&seq, ptr, sizeof(seq));
+ ptr += sizeof(seq);
+
+ if (GET_USER_OR_KERNEL(length, ev->u.message.length)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (GET_USER_OR_KERNEL(q_senderInfo, ev->u.message.senderInfo)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+
+ if (q_senderInfo == 0 && length == 0) { /* pgr0000 */
+ matched = 1;
+ } else if (q_senderInfo != 0 && q_senderInfo == senderInfo) {
+ matched = 1;
+ } else if (length > 0 && size >= length) { /* pgr0000 */
+
+ if (mem == evk_mem_user) {
+ void *compbytes;
+ compbytes = evk_malloc(length);
+ if (compbytes != NULL) {
+ if (copy_from_user(compbytes, &(ev->u.message.message), length)) {
+ err = -EFAULT;
+ evk_free(compbytes);
+ goto finish;
+ }
+ if (memcmp(ptr, compbytes, length) == 0) {
+ matched = 1;
+ }
+ evk_free(compbytes);
+ }
+ } else {
+ if (memcmp(ptr, ev->u.message.message, length) == 0) {
+ matched = 1;
+ }
+ }
+ }
+
+ if (matched) {
+
+ if (PUT_USER_OR_KERNEL(EV_EVENT_Message, ev->type)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (PUT_USER_OR_KERNEL(size, ev->u.message.length)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (PUT_USER_OR_KERNEL(senderInfo, ev->u.message.senderInfo)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (mem == evk_mem_user) {
+ if (copy_to_user(ev->u.message.message, ptr, size)) {
+ err = -EFAULT;
+ goto finish;
+ }
+ } else {
+ memcpy(ev->u.message.message, ptr, size);
+ }
+
+ queue->read_pid = current->pid;
+ if (peek_only) {
+ ;
+ } else {
+ remove_message_event(queue, readptr);
+ }
+ goto finish;
+ }
+ }
+
+ finish:
+
+ if (queue != NULL && wait != 0 && matched == 0) {
+ int wait_ret;
+ EVK_mutex_unlock(); /*************************************/
+ wait_ret
+ = wait_event_interruptible(queue->wq_head,
+ ((queue2 = (struct message_queue *)find_queue_entry(queueID))==NULL
+ || queue2->num > 0));
+
+ EVK_mutex_lock(); /*************************************/
+
+ if (wait_ret != 0) {
+ EVK_info1("Interrupted while waiting for queue %x\n", queueID);
+ err = -EINTR;
+ } else if (queue2 == NULL) { /* pgr0039 */
+ EVK_info1("queue %x was destroyed while waiting for it\n", queueID);
+ err = -ENOENT;
+ } else {
+ goto retry;
+ }
+ }
+
+ return err;
+}
+
+static int
+evk_get_event(EV_Event *ev, int peek_only, int wait, int mem)
+{
+ EV_Type type;
+ int ret = -EINVAL;
+
+ if (GET_USER_OR_KERNEL(type, ev->type)) /* pgr0039 */
+ return -EFAULT;
+ if (PUT_USER_OR_KERNEL(EV_EVENT_None, ev->type)) /* pgr0039 */
+ return -EFAULT;
+
+ switch(type) { /* pgr0000 */
+ case EV_EVENT_Flag:
+ EVK_mutex_lock(); /*************************************/
+ ret = evk_get_flag_event(ev, peek_only, wait, mem);
+ EVK_mutex_unlock(); /*************************************/
+ break;
+
+ case EV_EVENT_Flag64:
+ EVK_mutex_lock(); /*************************************/
+ ret = evk_get_flag64_event(ev, peek_only, wait, mem);
+ EVK_mutex_unlock(); /*************************************/
+ break;
+
+ case EV_EVENT_Message:
+ EVK_mutex_lock(); /*************************************/
+ ret = evk_get_message_event(ev, peek_only, wait, mem);
+ EVK_mutex_unlock(); /*************************************/
+ break;
+
+ default:
+ break;
+ }
+ return ret;
+}
+
+static int
+evk_get_next_event(EVK_Next_Event_Query *query /* user */, int peek_only)
+{
+ EV_ID *ids;
+ int i, num, ret, first, found;
+ struct common_queue *queue;
+ UINT32 seq_oldest = 0;
+
+ ids = (EV_ID *)kmalloc( (sizeof(EV_ID)*EV_MAX_IDS_IN_PROCESS), GFP_KERNEL );
+ if( ids == NULL ){
+ return -ENOMEM;
+ }
+
+ if (__get_user(num, &(query->num))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish0;
+ }
+ if (copy_from_user(&ids[0], query->ids, num * sizeof(EV_ID))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish0;
+ }
+ if (__put_user(EV_EVENT_None, &(query->ev.type))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish0;
+ }
+
+ ret = 0;
+ first = 1;
+ found = -1;
+
+ EVK_mutex_lock(); /*************************************/
+
+ for(i = 0 ; i < num /* pgr0039 */ ; i++) {
+ queue = find_queue_entry(ids[i]);
+ if (queue != NULL) {/* Have the specified queue ID */
+ if ((EV_ID_IS_FLAG(ids[i])
+ && ((struct flag *)queue)->value != 0)
+ || (EV_ID_IS_FLAG64(ids[i])
+ && ((struct flag64 *)queue)->value != 0)
+ || (EV_ID_IS_QUEUE(ids[i])
+ && ((struct message_queue *)queue)->num > 0)) {/*There are events.*/
+ /* Compare with time_before macros for round 0 */
+ if (first || time_before((unsigned long)queue->seq_num, /* pgr0006 */ /* pgr0039 */
+ (unsigned long)seq_oldest)) {
+ first = 0;
+ seq_oldest = queue->seq_num;
+ found = i;
+ }
+ }
+ }
+ }
+
+ if (found >= 0) {
+ if (EV_ID_IS_FLAG(ids[found])) {
+ if (__put_user(ids[found], &(query->ev.u.flag.flagID))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish1;
+ }
+ ret = evk_get_flag_event(&(query->ev), peek_only, 0, evk_mem_user);
+ } else if (EV_ID_IS_FLAG64(ids[found])) {
+ if (__put_user(ids[found], &(query->ev.u.flag64.flagID))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish1;
+ }
+ ret = evk_get_flag64_event(&(query->ev), peek_only, 0, evk_mem_user);
+ } else if (EV_ID_IS_QUEUE(ids[found])) {
+ if (__put_user(ids[found], &(query->ev.u.message.queueID))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish1;
+ }
+ ret = evk_get_message_event(&(query->ev), peek_only, 0, evk_mem_user);
+ }
+ }
+
+ finish1:
+ EVK_mutex_unlock(); /*************************************/
+ finish0:
+ kfree(ids);
+ return ret;
+}
+
+static long
+evk_ioctl(struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ EVK_Message_Queue_Request mesq;
+ int peek_only, wait;
+ EV_ID queueID;
+ int ret = -EINVAL;
+
+ //lock_kernel();
+
+ switch(cmd) {
+ case EVK_IOC_CREATE_FLAG:
+ queueID = (EV_ID)arg;
+ ret = evk_create_flag(queueID);
+ break;
+
+ case EVK_IOC_CREATE_FLAG64:
+ queueID = (EV_ID)arg;
+ ret = evk_create_flag64(queueID);
+ break;
+
+ case EVK_IOC_CREATE_MESSAGE_QUEUE:
+ if (access_ok(VERIFY_READ, arg, sizeof(mesq))) { /* pgr0039 */
+ if (copy_from_user(&mesq, (EV_Flag *)arg, sizeof(mesq))) {
+ ret = -EFAULT;
+ break;
+ }
+
+ ret = evk_create_message_queue(mesq.queueID, mesq.length,
+ mesq.max_bytes, mesq.type);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_ALLOC_FLAG_ID:
+ if (access_ok(VERIFY_WRITE, arg, sizeof(queueID))) { /* pgr0039 */
+ evk_alloc_flagID(&queueID);
+ if (put_user(queueID, (EV_ID *)arg)) { /* pgr0039 */
+ ret = -EFAULT;
+ break;
+ }
+ ret = 0;
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_ALLOC_FLAG64_ID:
+ if (access_ok(VERIFY_WRITE, arg, sizeof(queueID))) { /* pgr0039 */
+ evk_alloc_flag64ID(&queueID);
+ if (put_user(queueID, (EV_ID *)arg)) { /* pgr0039 */
+ ret = -EFAULT;
+ break;
+ }
+ ret = 0;
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_ALLOC_QUEUE_ID:
+ if (access_ok(VERIFY_WRITE, arg, sizeof(queueID))) { /* pgr0039 */
+ evk_alloc_queueID(&queueID);
+ if (put_user(queueID, (EV_ID *)arg)) { /* pgr0039 */
+ ret = -EFAULT;
+ break;
+ }
+ ret = 0;
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_DESTROY_QUEUE:
+ queueID = (EV_ID)arg;
+ ret = evk_destroy_queue(queueID);
+ break;
+
+ case EVK_IOC_STORE_FLAG:
+ if (access_ok(VERIFY_READ, arg, sizeof(EV_Flag))) { /* pgr0039 */
+ ret = evk_store_flag((EV_Flag *)arg, evk_mem_user);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_STORE_FLAG64:
+ if (access_ok(VERIFY_READ, arg, sizeof(EV_Flag64))) { /* pgr0039 */
+ ret = evk_store_flag64((EV_Flag64 *)arg, evk_mem_user);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_STORE_MESSAGE:
+ if (access_ok(VERIFY_READ, arg, sizeof(EV_Message))) { /* pgr0039 */
+ ret = evk_store_message((EV_Message *)arg, evk_mem_user);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_SET_POLL:
+ queueID = (EV_ID)arg;
+ ret = evk_set_poll(filp, queueID);
+ break;
+
+ case EVK_IOC_PEEK_EVENT:
+ peek_only = 1;
+ wait = 0;
+ goto get_event;
+ break;
+
+ case EVK_IOC_WAIT_EVENT:
+ peek_only = 0;
+ wait = 1;
+ goto get_event;
+ break;
+
+ case EVK_IOC_GET_EVENT:
+ peek_only = 0;
+ wait = 0;
+ get_event:
+ if (access_ok(VERIFY_WRITE, arg, sizeof(EV_Event))) { /* pgr0039 */
+ ret = evk_get_event((EV_Event *)arg, peek_only, wait, evk_mem_user);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_PEEK_NEXT_EVENT:
+ peek_only = 1;
+ goto get_next;
+ break;
+
+ case EVK_IOC_GET_NEXT_EVENT:
+ peek_only = 0;
+ get_next:
+ if (access_ok(VERIFY_WRITE, arg, sizeof(EVK_Next_Event_Query))) { /* pgr0039 */
+ ret = evk_get_next_event((EVK_Next_Event_Query *)arg, peek_only);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_DEBUG_LIST:
+ __list_queues();
+ //__list_message();
+ ret = 0;
+ break;
+
+ default:
+ ret = -EINVAL;
+ break;
+ }
+
+ //unlock_kernel();
+ return ret;
+}
+
+static unsigned int
+evk_poll(struct file *filp, poll_table *wait)
+{
+ unsigned int ret = 0;
+ struct common_queue *queue;
+
+ EV_ID queueID = (EV_ID)(filp->private_data);
+ // Returns errors without stopping at assert if queueID is invalid
+ // (Troubleshooting for Continuous Printing)
+ if (!EV_ID_IS_VALID(queueID)) {
+ printk("evk_poll ERROR: invalid queueID=%x\n", queueID);
+ return POLLERR|POLLHUP;
+ }
+ //EVK_assert(EV_ID_IS_VALID(queueID), "poll: flag/queueID not set");
+
+ EVK_mutex_lock();/*****************************************/
+
+ queue = find_queue_entry(queueID);
+ if (queue == NULL) {
+ EVK_info1("poll: No such flag/queueID %x\n", queueID);
+ ret = POLLERR|POLLHUP;
+ goto finish;
+ }
+
+ poll_wait(filp, &(queue->wq_head), wait);
+
+ if (EV_ID_IS_FLAG(queueID)) {
+ if (((struct flag *)queue)->value != 0) {
+ ret = POLLIN;
+ }
+ } else if (EV_ID_IS_FLAG64(queueID)) {
+ if (((struct flag64 *)queue)->value != 0) {
+ ret = POLLIN;
+ }
+ } else {
+ if (((struct message_queue *)queue)->num > 0) {
+ ret = POLLIN;
+ }
+ }
+
+ finish:
+ EVK_mutex_unlock(); /***************************************/
+
+ return ret;
+}
+
+/** List of system call corresponding function registrations */
+static struct file_operations evk_fops = {
+ .open = evk_open,
+ .release = evk_close,
+ .unlocked_ioctl = evk_ioctl,
+ .poll = evk_poll,
+};
+
+#ifdef ENABLE_PROC_FS
+static int
+evk_procFS_show(struct seq_file *m, int mode)
+{
+ int i, num;
+ struct list_head *list, *entries;
+ struct common_queue *queue;
+
+ seq_printf(m, "[ev library status ");
+
+ switch(mode) {
+ case evk_enum_flag:
+ seq_printf(m, "(flag)]\n");
+ seq_printf(m, "PID moduleID flagID[hash] value\n");
+ break;
+ case evk_enum_flag64:
+ seq_printf(m, "(flag64)]\n");
+ seq_printf(m, "PID moduleID flagID[hash] value\n");
+ break;
+ case evk_enum_queue:
+ seq_printf(m, "(queue)]\n");
+ seq_printf(m, "PID moduleID queueID[hash] maxbytes remain type\n");
+ break;
+ }
+
+ EVK_mutex_lock();
+
+ num = evk_get_queue_entry(&entries);
+
+ for (i = 0 ; i < num ; i++) {
+ list = &(entries[i]);
+ if (!list_empty(list)) {
+ list_for_each_entry(queue, list, list) {
+ if ((mode == evk_enum_flag && (!EV_ID_IS_FLAG(queue->queueID)))
+ || (mode == evk_enum_flag64 && (!EV_ID_IS_FLAG64(queue->queueID)))
+ || (mode == evk_enum_queue && (!EV_ID_IS_QUEUE(queue->queueID))))
+ {
+ continue;
+ }
+
+ seq_printf(m, "%08d ", queue->pid);
+ seq_printf(m, "%05d(%04x) ", ((queue->queueID & 0x00ffff00) >> 8), ((queue->queueID & 0x00ffff00) >> 8));
+ seq_printf(m, "0x%08x[%2d] ", queue->queueID, calc_hash(queue->queueID));
+
+ switch(mode) {
+ case evk_enum_flag:
+ seq_printf(m, "0x%x", EVK_PFLAG(queue)->value);
+ break;
+
+ case evk_enum_flag64:
+ seq_printf(m, "0x%llx", EVK_PFLAG64(queue)->value);
+ break;
+
+ case evk_enum_queue:
+ seq_printf(m, "%04d %02d ", EVK_PQUEUE(queue)->max_bytes, EVK_PQUEUE(queue)->length);
+ seq_printf(m, "%02d ", EVK_PQUEUE(queue)->num);
+ seq_printf(m, "%d ", EVK_PQUEUE(queue)->type);
+ break;
+ }
+ seq_printf(m, "\n");
+ }
+ }
+ }
+
+ EVK_mutex_unlock();
+ return 0;
+}
+
+static int
+evk_procFS_flag_show(struct seq_file *m, void *v)
+{
+ return evk_procFS_show(m, evk_enum_flag);
+}
+
+static int
+evk_procFS_flag64_show(struct seq_file *m, void *v)
+{
+ return evk_procFS_show(m, evk_enum_flag64);
+}
+
+static int
+evk_procFS_queue_show(struct seq_file *m, void *v)
+{
+ return evk_procFS_show(m, evk_enum_queue);
+}
+
+static int
+evk_procFS_flag_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, evk_procFS_flag_show, NULL);
+}
+
+static int
+evk_procFS_flag64_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, evk_procFS_flag64_show, NULL);
+}
+
+static int
+evk_procFS_queue_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, evk_procFS_queue_show, NULL);
+}
+
+static struct file_operations evk_proc_flag_fops = {
+ .owner = THIS_MODULE,
+ .open = evk_procFS_flag_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static struct file_operations evk_proc_flag64_fops = {
+ .owner = THIS_MODULE,
+ .open = evk_procFS_flag64_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static struct file_operations evk_proc_queue_fops = {
+ .owner = THIS_MODULE,
+ .open = evk_procFS_queue_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+#endif /*ENABLE_PROC_FS*/
+
+__init int
+EVK_init(void)
+{
+ int err;
+#ifdef CONFIG_PROC_FS
+#ifdef ENABLE_PROC_FS
+ struct proc_dir_entry *ret;
+#endif /* ENABLE_PROC_FS */
+#endif /* CONFIG_PROC_FS */
+ int i;
+ dev_t dev;
+
+ dev = MKDEV(devmajor, devminor);
+ err = register_chrdev_region(dev, nrdevs, EVK_NAME);
+ if (err) {
+ EVK_info1("register_chrdev_region error %d\n", -err);
+ return -EBUSY;
+ }
+
+ cdev_init(&cdev, &evk_fops);
+ cdev.owner = THIS_MODULE;
+ cdev.ops = &evk_fops;
+
+ err = cdev_add(&cdev, dev, 1);
+ if (err) {
+ EVK_info1("cdev_add error %d\n", -err);
+ return -EBUSY;
+ }
+
+ /* Initialization */
+ for(i = 0 ; i < EVK_MAX_FLAGS ; i++) {
+ list_add_tail((struct list_head *)&(_flag_pool[i]),
+ &flag_pool);
+ }
+ for(i = 0 ; i < EVK_MAX_FLAG64S ; i++) {
+ list_add_tail((struct list_head *)&(_flag64_pool[i]),
+ &flag64_pool);
+ }
+ for(i = 0 ; i < EVK_MAX_MESSAGE_QUEUES ; i++) {
+ list_add_tail((struct list_head *)&(_message_queue_pool[i]),
+ &message_queue_pool);
+ }
+ for(i = 0 ; i < HASH_KEY ; i++) {
+ INIT_LIST_HEAD(&(queue_entry[i]));
+ }
+
+#ifdef CONFIG_PROC_FS
+#ifdef ENABLE_PROC_FS
+ ret = proc_create("driver/ev_flag", 0, NULL, &evk_proc_flag_fops);
+ if( ret == NULL ) {
+ EVK_info1("Unable to initialize /proc entry %d\n", -err);
+ return -EBUSY;
+ }
+
+ ret = proc_create("driver/ev_flag64", 0, NULL, &evk_proc_flag64_fops);
+ if( ret == NULL ) {
+ EVK_info1("Unable to initialize /proc entry %d\n", -err);
+ return -EBUSY;
+ }
+
+ ret = proc_create("driver/ev_queue", 0, NULL, &evk_proc_queue_fops);
+ if( ret == NULL ) {
+ EVK_info1("Unable to initialize /proc entry %d\n", -err);
+ return -EBUSY;
+ }
+#endif /* ENABLE_PROC_FS */
+#endif /* CONFIG_PROC_FS */
+
+ pClass = class_create(THIS_MODULE, EVK_NAME);
+ device_create(pClass, NULL, dev, NULL, "agl/"EVK_NAME);
+
+ return 0;
+}
+
+void
+//#ifndef CONFIG_COMBINE_MODULES
+//__exit
+//#endif
+EVK_exit(void)
+{
+ dev_t dev = MKDEV(devmajor, devminor);
+ device_destroy(pClass, dev);
+ class_destroy(pClass);
+
+ cdev_del(&cdev);
+
+ unregister_chrdev_region(dev, nrdevs);
+
+ remove_proc_entry( "driver/ev_flag", 0 );
+ remove_proc_entry( "driver/ev_flag64", 0 );
+ remove_proc_entry( "driver/ev_queue", 0 );
+}
+
+/** @} */
+/** @addtogroup EV
+ * @{ */
+static EV_ERR
+EVK_create_flag_in(EV_ID flagID)
+{
+ int ret = evk_create_flag(flagID);
+
+ if (ret == -EEXIST) {
+ return EV_ERR_Exist;
+ } else if (ret < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+static EV_ERR
+EVK_create_flag64_in(EV_ID flagID)
+{
+ int ret = evk_create_flag64(flagID);
+
+ if (ret == -EEXIST) {
+ return EV_ERR_Exist;
+ } else if (ret < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+/** @see EV_create_flag */
+EV_ERR
+EVK_create_flag(EV_ID flagID)
+{
+ if (!EV_ID_IS_FLAG(flagID) || EV_ID_IS_AUTO_ID(flagID)) {
+ return EV_ERR_Invalid_ID;
+ }
+ return EVK_create_flag_in(flagID);
+}
+
+/** @see EV_create_flag64 */
+EV_ERR
+EVK_create_flag64(EV_ID flagID)
+{
+ if (!EV_ID_IS_FLAG64(flagID) || EV_ID_IS_AUTO_ID(flagID)) {
+ return EV_ERR_Invalid_ID;
+ }
+ return EVK_create_flag64_in(flagID);
+}
+
+static EV_ERR
+EVK_create_queue_in(EV_ID queueID, UINT8 length, UINT16 max_bytes,
+ EV_Message_Queue_Type type)
+{
+ int ret = evk_create_message_queue(queueID, length, max_bytes, type);
+
+ if (ret == -EEXIST) {
+ return EV_ERR_Exist;
+ } else if (ret < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+/** @see EV_create_queue */
+EV_ERR
+EVK_create_queue(EV_ID queueID, UINT8 length, UINT16 max_bytes,
+ EV_Message_Queue_Type type)
+{
+ if (!EV_ID_IS_QUEUE(queueID) || EV_ID_IS_AUTO_ID(queueID)) {
+ return EV_ERR_Invalid_ID;
+ }
+ return EVK_create_queue_in(queueID, length, max_bytes, type);
+}
+
+/** @see EV_create_flag_auto_id */
+EV_ERR
+EVK_create_flag_auto_id(/* OUT */EV_ID *flagID)
+{
+ EV_ERR err;
+ EVK_assert(flagID != NULL, "NULL pointer was specified");
+
+ if (evk_alloc_flagID(flagID) < 0) {
+ return EV_ERR_Fatal;
+ }
+
+ err = EVK_create_flag_in(*flagID);
+ if (err != EV_OK) {
+ *flagID = EV_NO_ID;
+ }
+ return err;
+}
+
+/** @see EV_create_flag64_auto_id */
+EV_ERR
+EVK_create_flag64_auto_id(/* OUT */EV_ID *flagID)
+{
+ EV_ERR err;
+ EVK_assert(flagID != NULL, "NULL pointer was specified");
+
+ if (evk_alloc_flag64ID(flagID) < 0) {
+ return EV_ERR_Fatal;
+ }
+
+ err = EVK_create_flag64_in(*flagID);
+ if (err != EV_OK) {
+ *flagID = EV_NO_ID;
+ }
+ return err;
+}
+
+/** @see EV_create_queue_auto_id */
+EV_ERR
+EVK_create_queue_auto_id(/* OUT */EV_ID *queueID, UINT8 length,
+ UINT16 max_bytes, EV_Message_Queue_Type type)
+{
+ EV_ERR err;
+ EVK_assert(queueID != NULL, "NULL pointer was specified");
+
+ if (evk_alloc_queueID(queueID) < 0) {
+ return EV_ERR_Fatal;
+ }
+
+ err = EVK_create_queue_in(*queueID, length, max_bytes, type);
+ if (err != EV_OK) {
+ *queueID = EV_NO_ID;
+ }
+ return err;
+}
+
+/** @see EV_destroy_flag */
+EV_ERR
+EVK_destroy_flag(EV_ID flagID)
+{
+ int err;
+ err = evk_destroy_queue(flagID);
+
+ if (err == -ENOENT) {
+ return EV_ERR_Invalid_ID;
+ } else if (err < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+/** @see EV_destroy_queue */
+EV_ERR
+EVK_destroy_queue(EV_ID queueID)
+{
+ return EVK_destroy_flag(queueID);
+}
+
+/* Sending the event */
+/** @see EV_set_flag */
+EV_ERR
+EVK_set_flag(EV_ID flagID, UINT32 bits)
+{
+ EV_Flag flag;
+ int ret;
+
+ if (!EV_ID_IS_FLAG(flagID)) {
+ return EV_ERR_Invalid_ID;
+ }
+ flag.flagID = flagID;
+ flag.bits = bits;
+
+ ret = evk_store_flag(&flag, evk_mem_kernel);
+ if (ret == -ENOENT) {
+ return EV_ERR_Invalid_ID;
+ } else if (ret < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+/** @see EV_set_flag64 */
+EV_ERR
+EVK_set_flag64(EV_ID flagID, UINT64 bits)
+{
+ EV_Flag64 flag;
+ int ret;
+
+ if (!EV_ID_IS_FLAG64(flagID)) {
+ return EV_ERR_Invalid_ID;
+ }
+ flag.flagID = flagID;
+ flag.bits = bits;
+
+ ret = evk_store_flag64(&flag, evk_mem_kernel);
+ if (ret == -ENOENT) {
+ return EV_ERR_Invalid_ID;
+ } else if (ret < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+/** @see EV_send_message */
+EV_ERR
+EVK_send_message(EV_ID queueID, UINT16 bytes, const void *message,
+ UINT32 senderInfo)
+{
+ EV_Message *msg = NULL;
+ EV_ERR ev_ret;
+ int ret;
+
+ msg = evk_malloc( sizeof( EV_Message ) );
+ if( msg == NULL )
+ {
+ ev_ret = EV_ERR_Fatal;
+ goto L_END;
+ }
+
+ if (!EV_ID_IS_QUEUE(queueID)) {
+ ev_ret = EV_ERR_Invalid_ID;
+ goto L_END;
+ }
+ EVK_assert(message != NULL, "NULL pointer was specified");
+ EVK_assert(bytes <= EV_MAX_MESSAGE_LENGTH, "send_message: message too long");
+
+ msg->queueID = queueID;
+ msg->senderInfo = senderInfo;
+ msg->length = bytes;
+ memcpy(msg->message, message, bytes);
+
+ ret = evk_store_message(msg, evk_mem_kernel);
+ if (ret == -ENOENT) {
+ ev_ret = EV_ERR_Invalid_ID;
+ } else if (ret == -EBUSY) {
+ ev_ret = EV_ERR_Busy;
+ } else if (ret < 0) {
+ ev_ret = EV_ERR_Fatal;
+ } else {
+ ev_ret = EV_OK;
+ }
+
+L_END:
+ if( msg != NULL )
+ {
+ evk_free( msg );
+ }
+ return ev_ret;
+}
+
+/* Event acquisition(Order of arrival time) */
+//EV_ERR EV_get_next_event(/* OUT */EV_Event *ev);
+
+static EV_ERR
+EVK_get_flag_in(EV_ID flagID, EV_Flag *flag, int peek_only, int wait)
+{
+ EV_Event *ev = NULL;
+ EV_ERR ev_ret;
+ int ret;
+
+ ev = evk_malloc( sizeof( EV_Event ) );
+ if( ev == NULL )
+ {
+ ev_ret = EV_ERR_Fatal;
+ goto L_END;
+ }
+
+ EVK_assert(flag != NULL, "get_flag: NULL pointer was specified");
+ flag->flagID = EV_NO_ID;
+ flag->bits = 0;
+
+ if (!EV_ID_IS_FLAG(flagID)) {
+ ev_ret = EV_ERR_Invalid_ID;
+ goto L_END;
+ }
+
+ ev->type = EV_EVENT_Flag;
+ ev->u.flag.flagID = flagID;
+ ev->u.flag.bits = 0;
+
+ ret = evk_get_event(ev, peek_only, wait, evk_mem_kernel);
+
+ if (ret < 0) {
+ if (ret == -ENOENT) {
+ ev_ret = EV_ERR_Invalid_ID;
+ } else if (ret == -EINTR) {
+ ev_ret = EV_ERR_Interrupted;
+ } else {
+ ev_ret = EV_ERR_Fatal;
+ }
+ goto L_END;
+ }
+
+ if (ev->type == EV_EVENT_Flag) {
+ flag->flagID = ev->u.flag.flagID;
+ flag->bits = ev->u.flag.bits;
+ }
+ ev_ret = EV_OK;
+
+L_END:
+ if( ev != NULL )
+ {
+ evk_free( ev );
+ }
+ return ev_ret;
+}
+
+static EV_ERR
+EVK_get_flag64_in(EV_ID flagID, EV_Flag64 *flag, int peek_only, int wait)
+{
+ EV_Event *ev = NULL;
+ EV_ERR ev_ret;
+ int ret;
+
+ ev = evk_malloc( sizeof( EV_Event ) );
+ if( ev == NULL )
+ {
+ ev_ret = EV_ERR_Fatal;
+ goto L_END;
+ }
+
+ EVK_assert(flag != NULL, "get_flag64: NULL pointer was specified");
+ flag->flagID = EV_NO_ID;
+ flag->bits = 0;
+
+ if (!EV_ID_IS_FLAG64(flagID)) {
+ ev_ret = EV_ERR_Invalid_ID;
+ goto L_END;
+ }
+
+ ev->type = EV_EVENT_Flag64;
+ ev->u.flag64.flagID = flagID;
+ ev->u.flag64.bits = 0;
+
+ ret = evk_get_event(ev, peek_only, wait, evk_mem_kernel);
+
+ if (ret < 0) {
+ if (ret == -ENOENT) {
+ ev_ret = EV_ERR_Invalid_ID;
+ } else if (ret == -EINTR) {
+ ev_ret = EV_ERR_Interrupted;
+ } else {
+ ev_ret = EV_ERR_Fatal;
+ }
+ goto L_END;
+ }
+
+ if (ev->type == EV_EVENT_Flag64) {
+ flag->flagID = ev->u.flag64.flagID;
+ flag->bits = ev->u.flag64.bits;
+ }
+ ev_ret = EV_OK;
+
+L_END:
+ if( ev != NULL )
+ {
+ evk_free( ev );
+ }
+ return ev_ret;
+}
+
+/* Event acquisition(With Search Criteria) */
+/** @see EV_get_flag */
+EV_ERR
+EVK_get_flag(EV_ID flagID, /* OUT */EV_Flag *flag)
+{
+ return EVK_get_flag_in(flagID, flag, 0, 0);
+}
+
+/** @see EV_get_flag64 */
+EV_ERR
+EVK_get_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag)
+{
+ return EVK_get_flag64_in(flagID, flag, 0, 0);
+}
+
+/** @see EV_wait_flag */
+EV_ERR
+EVK_wait_flag(EV_ID flagID, /* OUT */EV_Flag *flag)/* block */
+{
+ return EVK_get_flag_in(flagID, flag, 0, 1);
+}
+
+/** @see EV_wait_flag64 */
+EV_ERR
+EVK_wait_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag)/* block */
+{
+ return EVK_get_flag64_in(flagID, flag, 0, 1);
+}
+
+/** @see EV_peek_flag */
+EV_ERR
+EVK_peek_flag(EV_ID flagID, /* OUT */EV_Flag *flag)
+{
+ return EVK_get_flag_in(flagID, flag, 1, 0);
+}
+
+/** @see EV_peek_flag64 */
+EV_ERR
+EVK_peek_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag)
+{
+ return EVK_get_flag64_in(flagID, flag, 1, 0);
+}
+
+static EV_ERR
+EVK_get_message_in(EV_ID queueID, EV_Message *message, UINT32 senderInfo,
+ UINT32 length, const void *compare_bytes,
+ int peek_only, int wait)
+{
+ EV_Event *ev = NULL;
+ EV_ERR ev_ret;
+ int ret;
+
+ ev = evk_malloc( sizeof( EV_Event ) );
+ if( ev == NULL )
+ {
+ ev_ret = EV_ERR_Fatal;
+ goto L_END;
+ }
+
+ EVK_assert(message != NULL, "get_message: NULL pointer was specified");
+ if (!EV_ID_IS_QUEUE(queueID)) {
+ ev_ret = EV_ERR_Invalid_ID;
+ goto L_END;
+ }
+ message->queueID = EV_NO_ID;
+ message->senderInfo = 0;
+ message->length = 0;
+
+ ev->type = EV_EVENT_Message;
+ ev->u.message.queueID = queueID;
+ ev->u.message.senderInfo = senderInfo;
+ if (compare_bytes != NULL) {
+ ev->u.message.length = length;
+ memcpy(ev->u.message.message, compare_bytes, length);
+ } else {
+ ev->u.message.length = 0;
+ }
+
+ ret = evk_get_event(ev, peek_only, wait, evk_mem_kernel);
+
+ if (ret < 0) {
+ if (ret == -ENOENT) {
+ ev_ret = EV_ERR_Invalid_ID;
+ } else if (ret == -EINTR) {
+ ev_ret = EV_ERR_Interrupted;
+ } else {
+ ev_ret = EV_ERR_Fatal;
+ }
+ goto L_END;
+ }
+
+ if (ev->type == EV_EVENT_Message) {
+ message->queueID = ev->u.message.queueID;
+ message->senderInfo = ev->u.message.senderInfo;
+ message->length = ev->u.message.length;
+ memcpy(message->message, ev->u.message.message, ev->u.message.length);
+ }
+ ev_ret = EV_OK;
+
+L_END:
+ if( ev != NULL )
+ {
+ evk_free( ev );
+ }
+ return ev_ret;
+}
+
+/** @see EV_get_message */
+EV_ERR
+EVK_get_message(EV_ID queueID, /* OUT */EV_Message *message)
+{
+ return EVK_get_message_in(queueID, message, 0, 0, NULL, 0, 0);
+}
+
+/** @see EV_wait_message */
+EV_ERR
+EVK_wait_message(EV_ID queueID, /* OUT */EV_Message *message)/* block */
+{
+ return EVK_get_message_in(queueID, message, 0, 0, NULL, 0, 1);
+}
+
+/** @see EV_peek_message */
+EV_ERR
+EVK_peek_message(EV_ID queueID, /* OUT */EV_Message *message)
+{
+ return EVK_get_message_in(queueID, message, 0, 0, NULL, 1, 0);
+}
+
+/** @see EV_find_message_by_sender */
+EV_ERR
+EVK_find_message_by_sender(EV_ID queueID, UINT32 senderInfo,
+ /* OUT */EV_Message *message)
+{
+ // Not mounted
+ return EV_ERR_Fatal;
+}
+
+/** @see EV_find_message_by_content */
+EV_ERR
+EVK_find_message_by_content(EV_ID queueID, UINT16 length,
+ const void *compare_bytes,
+ /* OUT */EV_Message *message)
+{
+ // Not mounted
+ return EV_ERR_Fatal;
+}
+/** @} */
+
+EXPORT_SYMBOL(evk_get_queue_entry);
+EXPORT_SYMBOL(EVK_init);
+EXPORT_SYMBOL(EVK_exit);
+
+EXPORT_SYMBOL(EVK_create_flag);
+EXPORT_SYMBOL(EVK_create_flag64);
+EXPORT_SYMBOL(EVK_create_queue);
+EXPORT_SYMBOL(EVK_create_flag_auto_id);
+EXPORT_SYMBOL(EVK_create_flag64_auto_id);
+EXPORT_SYMBOL(EVK_create_queue_auto_id);
+EXPORT_SYMBOL(EVK_destroy_flag);
+EXPORT_SYMBOL(EVK_destroy_queue);
+EXPORT_SYMBOL(EVK_set_flag);
+EXPORT_SYMBOL(EVK_set_flag64);
+EXPORT_SYMBOL(EVK_send_message);
+EXPORT_SYMBOL(EVK_get_flag);
+EXPORT_SYMBOL(EVK_wait_flag);
+EXPORT_SYMBOL(EVK_peek_flag);
+EXPORT_SYMBOL(EVK_get_flag64);
+EXPORT_SYMBOL(EVK_wait_flag64);
+EXPORT_SYMBOL(EVK_peek_flag64);
+EXPORT_SYMBOL(EVK_get_message);
+EXPORT_SYMBOL(EVK_wait_message);
+EXPORT_SYMBOL(EVK_peek_message);
+
+#ifndef CONFIG_COMBINE_MODULES
+//MODULE_LICENSE("proprietary");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("EVent library for Kernel");
+//MODULE_SUPPORTED_DEVICE(name);
+//MODULE_PARM(var,type)
+//MODULE_PARM_DESC(var,desc)
+module_init(EVK_init);
+module_exit(EVK_exit);
+#endif /* !CONFIG_COMBINE_MODULES */
diff --git a/nsframework/backup_manager/LICENSE b/nsframework/backup_manager/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/nsframework/backup_manager/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/nsframework/backup_manager/Makefile.client b/nsframework/backup_manager/Makefile.client
new file mode 100755
index 0000000..07bada3
--- /dev/null
+++ b/nsframework/backup_manager/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := config client
+
+include ../native_service.mk
diff --git a/nsframework/backup_manager/Makefile.server b/nsframework/backup_manager/Makefile.server
new file mode 100755
index 0000000..62bd0d6
--- /dev/null
+++ b/nsframework/backup_manager/Makefile.server
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := server
+
+include ../native_service.mk
diff --git a/nsframework/backup_manager/client/Makefile b/nsframework/backup_manager/client/Makefile
new file mode 100755
index 0000000..41d2bf7
--- /dev/null
+++ b/nsframework/backup_manager/client/Makefile
@@ -0,0 +1,53 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### libraries to be installed(*.so)#############
+INST_SHLIBS := libns_backup
+
+######### headers to be installed(*.h) #############
+INST_HEADERS := backup_manager.h ns_backup.h
+
+######### sources to be compiled #############
+libns_backup_SRCS := bkup_api.cpp
+
+######### search paths #############
+VPATH += ./src ./include/$(COMPONENT_NAME) ../server/include
+
+######### include paths #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I../server/include
+
+######### frameworkunifiedlog options #############
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### libraries to be linked(dynamic)#############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### other unit specific options #############
+LINK_CXX=Y
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+include ../../native_service.mk
diff --git a/nsframework/backup_manager/client/include/bkup_api.h b/nsframework/backup_manager/client/include/bkup_api.h
new file mode 100755
index 0000000..d5b0d2b
--- /dev/null
+++ b/nsframework/backup_manager/client/include/bkup_api.h
@@ -0,0 +1,60 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_CLIENT_INCLUDE_BKUP_API_H_
+#define BACKUP_MANAGER_CLIENT_INCLUDE_BKUP_API_H_
+
+#define BACKUP_CID 0xBACC1D00
+
+#define BKUP_MAX_ITEM_NAME 64
+
+/**
+ * media
+ */
+#include <nv_hal.h>
+
+/**
+ * command
+ */
+typedef enum {
+ BKUP_CMD_READ = 0,
+ BKUP_CMD_WRITE,
+ BKUP_CMD_FILL,
+ BKUP_CMD_SIZE,
+ BKUP_CMD_READ_NUM,
+ BKUP_CMD_SIZE_NUM,
+ BKUP_CMD_CHECK,
+ BKUP_CMD_DELETE,
+ BKUP_CMD_COPY_INNER,
+ BKUP_CMD_MAX,
+} bkup_protocol_command_t;
+
+/**
+ * api/process protocol
+ */
+typedef struct {
+ bkup_protocol_command_t command;
+ char item_name[64];
+ uint32_t num_id;
+ uint32_t offset;
+ uint32_t size;
+ char fill_patern;
+ enum NvHalMedia src_media;
+} bkup_protocol_header_t;
+
+#define SERVICE_BACKUP_MANAGER_MSG_HANDLE_THREAD "bkupmanagerthr"
+
+#endif // BACKUP_MANAGER_CLIENT_INCLUDE_BKUP_API_H_
diff --git a/nsframework/backup_manager/client/include/native_service/backup_manager.h b/nsframework/backup_manager/client/include/native_service/backup_manager.h
new file mode 100755
index 0000000..636c38c
--- /dev/null
+++ b/nsframework/backup_manager/client/include/native_service/backup_manager.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file backup_manager.h
+ * @brief backup_manager unit common header file.
+ */
+
+#ifndef NATIVESERVICE_BACKUPMANAGER_H_ // NOLINT(build/header_guard)
+#define NATIVESERVICE_BACKUPMANAGER_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup backup_manager
+ * @ingroup native_service
+ * @{
+ */
+
+#include <native_service/ns_backup.h>
+
+/**@}*/ // end of backup_manager
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
+
+#endif // NATIVESERVICE_BACKUPMANAGER_H_
diff --git a/nsframework/backup_manager/client/include/native_service/ns_backup.h b/nsframework/backup_manager/client/include/native_service/ns_backup.h
new file mode 100755
index 0000000..5655ae3
--- /dev/null
+++ b/nsframework/backup_manager/client/include/native_service/ns_backup.h
@@ -0,0 +1,498 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ns_backup.h
+ * @brief backup_manager function header file
+ */
+
+#ifndef BACKUP_MANAGER_CLIENT_INCLUDE_NATIVE_SERVICE_NS_BACKUP_H_
+#define BACKUP_MANAGER_CLIENT_INCLUDE_NATIVE_SERVICE_NS_BACKUP_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup backup_manager
+ * @ingroup native_service
+ * @{
+ */
+
+/**
+ * \~english Service availability notify
+ */
+#define NTFY_BackupMgr_Availability "NS_BackupMgr/Availability"
+
+/**
+ * \~english Return value: terminated normally
+ */
+#define BKUP_RET_NORMAL 0
+
+/**
+ * \~english Return value: abnormal termination(content not specified)
+ */
+#define BKUP_RET_ERROR -1
+
+/**
+ * \~english Return value: parameter error
+ */
+#define BKUP_RET_ERRPARAM -2
+
+/**
+ * \~english Return value: initializing
+ */
+#define BKUP_RET_ERRINIT -3
+
+/**
+ * \~english Return value: terminating
+ */
+#define BKUP_RET_ERRTERM -4
+
+/**
+ * \~english Return value: data does not exist
+ */
+#define BKUP_RET_ERRNOENT -5
+
+/**
+ * \~english Return value: data size error
+ */
+#define BKUP_RET_ERRSIZE -6
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \ingroup Backup_DataRd
+ * \~english @par Brief
+ * Read data from backup area
+ * \~english @param [in] tagID
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @param [in] uiOffset
+ * uint32_t - Offset from the beginning of the area(0~size of backup area identified by area ID)
+ * \~english @param [out] pvBuf
+ * void * - A pointer which point to buffer used to storage read data
+ * \~english @param [in] uiSize
+ * uint32_t - Read data size(0~size of backup area identified by area ID)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If the buffer point(pvBuf) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual read size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ Judge the type and access destination according to specified area ID and then read data.
+ * - If appointed size is less than registered size, read data of appointed size. [BKUP_RET_NORMAL]
+ * - If the backup data does not exist, buffer is filled 0. [BKUP_RET_NORMAL]
+ *
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * Backup_DataWt
+ */
+int32_t Backup_DataRd(PCSTR tag_id, uint32_t ui_offset, void *pv_buf, uint32_t ui_size);
+/**
+ * \ingroup Backup_DataWt
+ * \~english @par Brief
+ * Write data to backup area
+ * \~english @param [in] tagID
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @param [in] pvBuf
+ * void * - A pointer which point to buffer used to storage write data
+ * \~english @param [in] uiOffset
+ * uint32_t - Offset from the beginning of the area(0~size of backup area identified by area ID)
+ * \~english @param [in] uiSize
+ * uint32_t - Write data size(0~size of backup area identified by area ID)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If the buffer point(pvBuf) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If system call(mmap()) is error [BKUP_RET_ERROR]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual read size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the storage media type and access destination according to specified area ID and then write data.
+ * Calling @ref Backup_DataWt more than once for the same ID when writing data separately.
+ * Data integrity can not be guaranteed at power interruption.
+ * Data should be written at one time to guarantee data consistency.
+ * The work life of writing times depends on how the user writes,NS_BackupMgr doesn't guaranteed.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * Backup_DataRd
+ */
+int32_t Backup_DataWt(PCSTR tag_id, void *pv_buf, uint32_t ui_offset, uint32_t ui_size);
+
+
+/**
+ * \ingroup Backup_DataFil
+ * \~english @par Brief
+ * Write data to backup area with the specified pattern
+ * \~english @param [in] tagID
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @param [in] uiOffset
+ * uint32_t - Offset from the beginning of the area(0~size of backup area identified by area ID)
+ * \~english @param [in] ucPat
+ * uint8_t - Write pattern data(0x00~0xff)
+ * \~english @param [in] uiSize
+ * uint32_t - Write data size(0~size of backup area identified by area ID)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual read size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and then fill it with the specified pattern.
+ * The work life of writing times depends on how the usrs writes,NS_BackupMgr doesn't guaranteed.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * none
+ */
+int32_t Backup_DataFil(PCSTR tag_id, uint32_t ui_offset, uint8_t uc_pat, uint32_t ui_size);
+
+
+/**
+ * \ingroup Backup_DataSz
+ * \~english @par Brief
+ * Get the size of the backup area.
+ * \~english @param [in] tagID
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @param [out] puiSize
+ * uint32_t * - A pointer which point to storage size
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If the pointer(puiSize) that stores the size specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and acquire the size of the target data.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * none
+ */
+int32_t Backup_DataSz(PCSTR tag_id, uint32_t *pui_size);
+
+/**
+ * \ingroup Backup_DataRdByNumID
+ * \~english @par Brief
+ * Read data from backup area
+ * \~english @param [in] numID
+ * uint32_t - Area ID specified by number
+ * \~english @param [in] uiOffset
+ * uint32_t - Offset from the beginning of the area(0~size of backup area identified by area ID)
+ * \~english @param [out] pvBuf
+ * void * - A pointer which point to buffer used to storage read data
+ * \~english @param [in] uiSize
+ * uint32_t - Read data size(0~size of backup area identified by area ID)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If the buffer point(pvBuf) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual read size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and then read data.
+ * Backup Non-volatile Data Read API for DIAG
+ * Use from the module other than DIAG is prohibited.
+ *
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * Backup_DataRd
+ */
+int32_t Backup_DataRdByNumID(uint32_t num_id, uint32_t ui_offset, void *pv_buf, uint32_t ui_size);
+
+
+/**
+ * \ingroup Backup_DataSzByNumID
+ * \~english @par Brief
+ * Get the size of the backup area.
+ * \~english @param [in] numID
+ * uint32_t - Area ID specified by number
+ * \~english @param [out] puiSize
+ * uint32_t * - A pointer which point to storage size
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If the pointer(puiSize) that stores the size specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and acquire the size of the target data.
+ * Get Non-volatile backup data size API for DIAG
+ * Use from the module other than DIAG is prohibited.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * Backup_DataSz
+ */
+int32_t Backup_DataSzByNumID(uint32_t num_id, uint32_t *pui_size);
+
+/**
+ * \ingroup Backup_DataChk
+ * \~english @par Brief
+ * Check backup data.
+ * \~english @param [in] tagID
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual read size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and check the target data.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * none
+ */
+int32_t Backup_DataChk(PCSTR tag_id);
+
+/**
+ * \ingroup Backup_DataDel
+ * \~english @par Brief
+ * Delete backup data.
+ * \~english @param [in] tag_id
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and delete the target data.
+ * - If the target data does not exist, return value is terminated normally. [BKUP_RET_NORMAL]
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * none
+ */
+int32_t Backup_DataDel(PCSTR tag_id);
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus */
+
+/**@}*/ // end of backup_manager
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
+
+#endif // BACKUP_MANAGER_CLIENT_INCLUDE_NATIVE_SERVICE_NS_BACKUP_H_
diff --git a/nsframework/backup_manager/client/libns_backup.ver b/nsframework/backup_manager/client/libns_backup.ver
new file mode 100755
index 0000000..55003a8
--- /dev/null
+++ b/nsframework/backup_manager/client/libns_backup.ver
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# backup version script
+#
+{
+ global:
+ ### .text section ###
+ Backup_DataRd;
+ Backup_DataWt;
+ Backup_DataFil;
+ Backup_DataSz;
+ Backup_DataRdByNumID;
+ Backup_DataSzByNumID;
+ Backup_DataChk;
+ Backup_DataDel;
+ ### .data section ###
+ local:
+ *;
+};
diff --git a/nsframework/backup_manager/client/src/bkup_api.cpp b/nsframework/backup_manager/client/src/bkup_api.cpp
new file mode 100755
index 0000000..2c085c0
--- /dev/null
+++ b/nsframework/backup_manager/client/src/bkup_api.cpp
@@ -0,0 +1,343 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <native_service/ns_backup.h>
+#include <native_service/ns_message_center_if.h>
+#include <agl_thread.h>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include "bkup_api.h"
+#include "bkup_backupmanagerlog.h"
+#include "bkup_util.h"
+
+#define BKUP_RETRY_MAX (10)
+#define BKUP_RETRY_TIMER (100 * 1000)
+
+static __thread HANDLE g_bkup_msg_handle;
+static __thread HANDLE g_bkup_response_handle;
+
+static int32_t BkupApiCheckTagid(PCSTR tag_id) {
+ if (tag_id == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "tag_id is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ return BKUP_RET_ERRPARAM;
+ }
+ if (strlen(tag_id) >= BKUP_MAX_ITEM_NAME) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "tag_id is long:%zd", strlen(tag_id));
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ return BKUP_RET_ERRPARAM;
+ }
+ return BKUP_RET_NORMAL;
+}
+
+static int32_t BkupApiCall(void *snd_buf, size_t snd_size, void *rcv_buf, uint32_t rcv_size) {
+ int32_t ret = BKUP_RET_ERROR;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ uint32_t real_rcvlen = 0;
+ static __thread char thread_name[16];
+
+ if (g_bkup_msg_handle == NULL) {
+ char invoker_name[24];
+
+ if (prctl(PR_GET_NAME, thread_name) < 0) { // LCOV_EXCL_BR_LINE 5:prctl's error case.
+ // LCOV_EXCL_START 5:prctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "prctl(PR_GET_NAME):%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5:prctl's error case.
+ }
+
+ g_bkup_msg_handle = McOpenSender(SERVICE_BACKUP_MANAGER_MSG_HANDLE_THREAD);
+ if (g_bkup_msg_handle == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "McOpenSender");
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = McCreateInvokerName(thread_name, 0, invoker_name, sizeof(invoker_name))) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "McCreateInvokerName:%d", e_status);
+ McClose(g_bkup_msg_handle);
+ g_bkup_msg_handle = NULL;
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ g_bkup_response_handle = McOpenSyncReceiver(invoker_name);
+ if (g_bkup_response_handle == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "McOpenSyncReceiver");
+ McClose(g_bkup_msg_handle);
+ g_bkup_msg_handle = NULL;
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+ }
+
+ for (int retry_cnt = 0; retry_cnt < BKUP_RETRY_MAX; retry_cnt++) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ e_status = McInvokeSync(g_bkup_msg_handle, thread_name, BACKUP_CID, static_cast<UI_32>(snd_size), snd_buf, 0,
+ g_bkup_response_handle, rcv_size, rcv_buf, &real_rcvlen);
+ if (e_status != eFrameworkunifiedStatusFail) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ break;
+ }
+ usleep(BKUP_RETRY_TIMER);
+ }
+
+ if (e_status != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "McInvokeSync:%d", e_status);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ if (e_status == eFrameworkunifiedStatusInvldParam) {
+ ret = BKUP_RET_ERRPARAM;
+ } else if (e_status == eFrameworkunifiedStatusErrOther) {
+ ret = BKUP_RET_ERRINIT;
+ } else if (e_status == eFrameworkunifiedStatusExit) {
+ ret = BKUP_RET_ERRTERM;
+ } else if (e_status == eFrameworkunifiedStatusFileLoadError) {
+ ret = BKUP_RET_ERRNOENT;
+ } else if (e_status == eFrameworkunifiedStatusAccessError) {
+ ret = BKUP_RET_ERRSIZE;
+ } else {
+ ret = BKUP_RET_ERROR;
+ }
+ goto exit;
+ }
+ if (rcv_size != real_rcvlen) {
+ goto exit;
+ }
+ ret = BKUP_RET_NORMAL;
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataRd(PCSTR tag_id, uint32_t ui_offset, void *pv_buf, uint32_t ui_size) {
+ int32_t ret = BKUP_RET_NORMAL;
+ bkup_protocol_header_t hdr;
+
+ if ((ret = BkupApiCheckTagid(tag_id)) != BKUP_RET_NORMAL) {
+ goto exit;
+ }
+ if (pv_buf == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Buf is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = BKUP_RET_ERRPARAM;
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_READ;
+ BkupStrlcpy(hdr.item_name, tag_id, sizeof(hdr.item_name));
+ hdr.offset = ui_offset;
+ hdr.size = ui_size;
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), pv_buf, ui_size);
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataWt(PCSTR tag_id, void *pv_buf, uint32_t ui_offset, uint32_t ui_size) {
+ int32_t ret;
+ char *snd_buf = NULL;
+ size_t snd_buf_size = 0;
+ bkup_protocol_header_t *hdr;
+
+ if ((ret = BkupApiCheckTagid(tag_id)) != BKUP_RET_NORMAL) {
+ goto exit;
+ }
+ if (pv_buf == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Buf is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = BKUP_RET_ERRPARAM;
+ goto exit;
+ }
+
+ // LCOV_EXCL_BR_START 5:mmap's error case.
+ if ((snd_buf = BkupAnonMmap(sizeof(bkup_protocol_header_t) + ui_size)) == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ ret = BKUP_RET_ERROR;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+ snd_buf_size = sizeof(bkup_protocol_header_t) + ui_size;
+
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(snd_buf);
+ hdr->command = BKUP_CMD_WRITE;
+ BkupStrlcpy(hdr->item_name, tag_id, sizeof(hdr->item_name));
+ hdr->offset = ui_offset;
+ hdr->size = ui_size;
+ memcpy(snd_buf + sizeof(bkup_protocol_header_t), pv_buf, ui_size);
+
+ ret = BkupApiCall(snd_buf, snd_buf_size, NULL, 0);
+
+exit:
+ if (snd_buf) {
+ munmap(snd_buf, snd_buf_size);
+ }
+ return ret;
+}
+
+int32_t Backup_DataFil(PCSTR tag_id, uint32_t ui_offset, uint8_t uc_pat, uint32_t ui_size) {
+ int32_t ret;
+ bkup_protocol_header_t hdr;
+
+ if ((ret = BkupApiCheckTagid(tag_id)) != BKUP_RET_NORMAL) {
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_FILL;
+ BkupStrlcpy(hdr.item_name, tag_id, sizeof(hdr.item_name));
+ hdr.offset = ui_offset;
+ hdr.size = ui_size;
+ hdr.fill_patern = uc_pat;
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), NULL, 0);
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataSz(PCSTR tag_id, uint32_t *pui_size) {
+ int32_t ret;
+ bkup_protocol_header_t hdr;
+
+ if ((ret = BkupApiCheckTagid(tag_id)) != BKUP_RET_NORMAL) {
+ goto exit;
+ }
+ if (pui_size == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Buf is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = BKUP_RET_ERRPARAM;
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_SIZE;
+ BkupStrlcpy(hdr.item_name, tag_id, sizeof(hdr.item_name));
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), pui_size, sizeof(uint32_t));
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataRdByNumID(uint32_t num_id, uint32_t ui_offset, void *pv_buf, uint32_t ui_size) {
+ int32_t ret = BKUP_RET_NORMAL;
+ bkup_protocol_header_t hdr;
+
+ if (pv_buf == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Buf is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = BKUP_RET_ERRPARAM;
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_READ_NUM;
+ hdr.num_id = num_id;
+ hdr.offset = ui_offset;
+ hdr.size = ui_size;
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), pv_buf, ui_size);
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataSzByNumID(uint32_t num_id, uint32_t *pui_size) {
+ int32_t ret;
+ bkup_protocol_header_t hdr;
+
+ if (pui_size == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Buf is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = BKUP_RET_ERRPARAM;
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_SIZE_NUM;
+ hdr.num_id = num_id;
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), pui_size, sizeof(uint32_t));
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataChk(PCSTR tag_id) {
+ int32_t ret;
+ bkup_protocol_header_t hdr;
+
+ if ((ret = BkupApiCheckTagid(tag_id)) != BKUP_RET_NORMAL) {
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_CHECK;
+ BkupStrlcpy(hdr.item_name, tag_id, sizeof(hdr.item_name));
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), NULL, 0);
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataDel(PCSTR tag_id) {
+ int32_t ret;
+ bkup_protocol_header_t hdr;
+
+ ret = BkupApiCheckTagid(tag_id);
+ if (ret != BKUP_RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "tag_id is invalid");
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_DELETE;
+ BkupStrlcpy(hdr.item_name, tag_id, sizeof(hdr.item_name));
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), NULL, 0);
+
+exit:
+ return ret;
+}
diff --git a/nsframework/backup_manager/config/Makefile b/nsframework/backup_manager/config/Makefile
new file mode 100755
index 0000000..b307a66
--- /dev/null
+++ b/nsframework/backup_manager/config/Makefile
@@ -0,0 +1,42 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+XML_PATH := ./conf/backup
+RNG_FILE := backup.rng
+ALL_XML := ALL_.xml
+ID_HEADER := ns_backup_id.h
+BACKUP_XML := backup*.xml
+
+######### headers to be installed(*.h) #############
+INST_HEADERS := $(ID_HEADER)
+
+######### make rule #############
+all: $(ID_HEADER)
+
+$(ID_HEADER): $(XML_PATH)/$(ALL_XML)
+ @set -e; \
+ for xml_file in `find $(XML_PATH) -name \*.xml | grep -v $(ALL_XML)`; do \
+ xmllint --noout --relaxng $(RNG_FILE) $$xml_file; \
+ ./uniqcheck.pl $$xml_file; \
+ done
+ ./createhdr.pl $(XML_PATH)/$(ALL_XML) > $(ID_HEADER)
+
+CLEAN_FILES := $(ID_HEADER)
+
+install: $(XML_PATH)/$(BACKUP_XML)
+ install -m 0755 -d $(DESTDIR)/usr/agl/conf/BS/ns/backup_manager/rodata
+ install -m 0644 $(XML_PATH)/$(BACKUP_XML) $(DESTDIR)/usr/agl/conf/BS/ns/backup_manager/rodata/
+include ../../native_service.mk
diff --git a/nsframework/backup_manager/config/backup.rng b/nsframework/backup_manager/config/backup.rng
new file mode 100755
index 0000000..6c9822b
--- /dev/null
+++ b/nsframework/backup_manager/config/backup.rng
@@ -0,0 +1,123 @@
+<element name="backup" xmlns="http://relaxng.org/ns/structure/1.0">
+ <zeroOrMore>
+ <element name="category" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <attribute name="name">
+ <data type="Name">
+ <param name="maxLength">64</param>
+ </data>
+ </attribute>
+ <choice>
+ <!-- NAND -->
+ <group>
+ <attribute name="nand">
+ <choice>
+ <value type="boolean">true</value>
+ </choice>
+ </attribute>
+ <optional>
+ <attribute name="cacheDram">
+ <data type="boolean"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="backupDram">
+ <data type="boolean"/>
+ </attribute>
+ </optional>
+ <attribute name="sync">
+ <data type="boolean"/>
+ </attribute>
+ <optional>
+ <attribute name="backupCycle">
+ <data type="positiveInteger"/>
+ </attribute>
+ </optional>
+ <attribute name="encrypt">
+ <data type="boolean"/>
+ </attribute>
+ </group>
+ <!-- CacheDRAM -->
+ <group>
+ <attribute name="cacheDram">
+ <choice>
+ <value type="boolean">true</value>
+ </choice>
+ </attribute>
+ <optional>
+ <attribute name="nand">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="backupDram">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="sync">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <attribute name="encrypt">
+ <data type="boolean"/>
+ </attribute>
+ </group>
+ <!-- BackupDRAM -->
+ <group>
+ <attribute name="backupDram">
+ <choice>
+ <value type="boolean">true</value>
+ </choice>
+ </attribute>
+ <optional>
+ <attribute name="nand">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="cacheDram">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="sync">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <attribute name="encrypt">
+ <data type="boolean"/>
+ </attribute>
+ </group>
+ </choice>
+ <zeroOrMore>
+ <element name="item">
+ <attribute name="name">
+ <data type="Name">
+ <param name="maxLength">64</param>
+ </data>
+ </attribute>
+ <attribute name="id">
+ <data type="positiveInteger">
+ <param name="maxInclusive">32767</param>
+ </data>
+ </attribute>
+ <attribute name="size">
+ <data type="positiveInteger"/>
+ </attribute>
+ </element>
+ </zeroOrMore>
+ </element>
+ </zeroOrMore>
+</element>
diff --git a/nsframework/backup_manager/config/conf/backup/ALL_.xml b/nsframework/backup_manager/config/conf/backup/ALL_.xml
new file mode 100755
index 0000000..bb42b63
--- /dev/null
+++ b/nsframework/backup_manager/config/conf/backup/ALL_.xml
@@ -0,0 +1,1216 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="D_BK_CA_GID_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_GID_D" id="0001" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MPT_D" id="0002" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT_D" id="0003" size="1"/>
+ </category>
+ <category name="D_BK_CA_LSDBKUP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LSDBKUP" id="0004" size="1"/>
+ </category>
+ <category name="D_BK_CA_GPSINFO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_GPSINFO" id="0005" size="1"/>
+ </category>
+ <category name="D_BK_CA_MADTIME" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MADTIME" id="0006" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_TEC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_TEC" id="0007" size="1"/>
+ </category>
+ <category name="D_BK_CA_HDW_SCL" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HDW_SCL" id="0008" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_POS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_POS" id="0009" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GYRO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GYRO" id="0010" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_DIST" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_DIST" id="0011" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_HELP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_HELP" id="0012" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_TDST" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_TDST" id="0013" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_PSSR" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_PSSR" id="0014" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GSRV" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GSRV" id="0015" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_TTBL" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_TTBL" id="0016" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_PLGN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_PLGN" id="0017" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_CAM" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_CAM" id="0018" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_DIAG" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_DIAG" id="0019" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_SLRN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_SLRN" id="0020" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_MCKH" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_MCKH" id="0021" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GSBK" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GSBK" id="0022" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_RLRN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_RLRN" id="0023" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_PARK" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_PARK" id="0024" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_SAPA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_SAPA" id="0025" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_TTJD" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_TTJD" id="0026" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_UPLD" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_UPLD" id="0027" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_TTKH" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_TTKH" id="0028" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_UPNR" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_UPNR" id="0029" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_OFRD" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_OFRD" id="0030" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_OSRS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_OSRS" id="0031" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_MCIN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_MCIN" id="0032" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCSM" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCSM" id="0033" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCSR" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCSR" id="0034" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS1" id="0035" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS2" id="0036" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS3" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS3" id="0037" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS4" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS4" id="0038" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS5" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS5" id="0039" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS6" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS6" id="0040" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS7" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS7" id="0041" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS8" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS8" id="0042" size="1"/>
+ </category>
+ <category name="D_BK_CA_MNT_BK1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MNT_BK1" id="0043" size="1"/>
+ </category>
+ <category name="D_BK_CA_MNT_BK2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MNT_BK2" id="0044" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLCM" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLCM" id="0045" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLCR" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLCR" id="0046" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC1" id="0047" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC2" id="0048" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC3" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC3" id="0049" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC4" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC4" id="0050" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC5" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC5" id="0051" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC6" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC6" id="0052" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC7" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC7" id="0053" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC8" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC8" id="0054" size="1"/>
+ </category>
+ <category name="D_BK_CA_GPSCNT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_GPSCNT" id="0055" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_MNG" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_MNG" id="0056" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_RT1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_RT1" id="0057" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_RT2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_RT2" id="0058" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_RT3" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_RT3" id="0059" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_RT4" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_RT4" id="0060" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_RT5" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_RT5" id="0061" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_NS1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_NS1" id="0062" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_NS2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_NS2" id="0063" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_NS3" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_HMI_NS3" id="0064" size="1"/>
+ </category>
+ <category name="D_BK_CA_AVD_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_AVD_D" id="0065" size="1"/>
+ </category>
+ <category name="D_BK_CA_GPT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_GPT_D" id="0066" size="1"/>
+ </category>
+ <category name="D_BK_CA_RTINF_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_RTINF_D" id="0067" size="1"/>
+ </category>
+ <category name="D_BK_CA_RDT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_RDT_D" id="0068" size="1"/>
+ </category>
+ <category name="D_BK_CA_ETA_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ETA_D" id="0069" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GYTP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GYTP" id="0070" size="1"/>
+ </category>
+ <category name="D_BK_CA_GID_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GID_F" id="0071" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPT_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MPT_F" id="0072" size="1"/>
+ </category>
+ <category name="D_BK_CA_AVD_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_AVD_F" id="0073" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_LPT_F" id="0074" size="1"/>
+ </category>
+ <category name="D_BK_CA_VR_POI" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VR_POI" id="0075" size="1"/>
+ </category>
+ <category name="D_BK_CA_BKWNRO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_BKWNRO" id="0076" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPTGRP_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MPTGRP_D" id="0077" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPTGRP_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MPTGRP_F" id="0078" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_TFPMMC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_TFPMMC" id="0079" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_TFPDATA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_TFPDATA" id="0080" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_BCN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_BCN" id="0081" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_FM" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_FM" id="0082" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_DSRC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_DSRC" id="0083" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_DRG" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_DRG" id="0084" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_BRD" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_BRD" id="0085" size="1"/>
+ </category>
+ <category name="D_BK_CA_MADMNG_RCVINFO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MADMNG_RCVINFO" id="0086" size="1"/>
+ </category>
+ <category name="D_BK_CA_MAD_UPDATEINFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MAD_UPDATEINFO" id="0087" size="1"/>
+ </category>
+ <category name="D_BK_CA_NM_NWINF01" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NM_NWINF01" id="0088" size="1"/>
+ </category>
+ <category name="D_BK_CA_NM_NWINF02" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NM_NWINF02" id="0089" size="1"/>
+ </category>
+ <category name="D_BK_CA_ND2_SAPA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ND2_SAPA" id="0090" size="1"/>
+ </category>
+ <category name="D_BK_CA_SMS_RVS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_SMS_RVS" id="0091" size="1"/>
+ </category>
+ <category name="D_BK_CA_SMS_VSC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_SMS_VSC" id="0092" size="1"/>
+ </category>
+ <category name="D_BK_CA_VCJ_CTL1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VCJ_CTL1" id="0093" size="1"/>
+ </category>
+ <category name="D_BK_CA_VCJ_MNT1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VCJ_MNT1" id="0094" size="1"/>
+ </category>
+ <category name="D_BK_CA_VCJ_CTL2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VCJ_CTL2" id="0095" size="1"/>
+ </category>
+ <category name="D_BK_CA_VCJ_MNT2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VCJ_MNT2" id="0096" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIC_SDAT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DIC_SDAT" id="0097" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIC_UDAT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DIC_UDAT" id="0098" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIC_MDAT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DIC_MDAT" id="0099" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPMNG_PB" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPMNG_PB" id="0100" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPMNG_UP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPMNG_UP" id="0101" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPMNG_CT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPMNG_CT" id="0102" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_EA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_EA" id="0103" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_ER" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_ER" id="0104" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_EBA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_EBA" id="0105" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_EBD" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_EBD" id="0106" size="1"/>
+ </category>
+ <category name="D_BK_CA_AWYMNG_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_AWYMNG_D" id="0107" size="1"/>
+ </category>
+ <category name="D_BK_CA_AWYDT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_AWYDT_D" id="0108" size="1"/>
+ </category>
+ <category name="D_BK_CA_AWYCD_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_AWYCD_D" id="0109" size="1"/>
+ </category>
+ <category name="D_BK_CA_PWMPT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PWMPT_D" id="0110" size="1"/>
+ </category>
+ <category name="D_BK_CA_GPOI_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_GPOI_D" id="0111" size="1"/>
+ </category>
+ <category name="D_BK_CA_LFM_REC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LFM_REC" id="0112" size="1"/>
+ </category>
+ <category name="D_BK_CA_LFM_RUN1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LFM_RUN1" id="0113" size="1"/>
+ </category>
+ <category name="D_BK_CA_LFM_RUN2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LFM_RUN2" id="0114" size="1"/>
+ </category>
+ <category name="D_BK_CA_LFM_INIT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LFM_INIT" id="0115" size="1"/>
+ </category>
+ <category name="D_BK_CA_PWMPT_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_PWMPT_F" id="0116" size="1"/>
+ </category>
+ <category name="D_BK_CA_BDMPT_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BDMPT_F" id="0117" size="1"/>
+ </category>
+ <category name="D_BK_CA_GPOI_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GPOI_F" id="0118" size="1"/>
+ </category>
+ <category name="D_BK_CA_ECOLRNJP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ECOLRNJP" id="0119" size="1"/>
+ </category>
+ <category name="D_BK_CA_RDTECOJP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_RDTECOJP" id="0120" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPH_CONF" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPH_CONF" id="0121" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPH_ONDATA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPH_ONDATA" id="0122" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPH_CODATA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPH_CODATA" id="0123" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPFU_CND" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPFU_CND" id="0124" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPFU_COL" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPFU_COL" id="0125" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPFU_STR" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPFU_STR" id="0126" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD67__ITS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID__CWORD67__ITS" id="0127" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_MS1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_MS1" id="0128" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_MS2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_MS2" id="0129" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_BTN" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_BTN" id="0134" size="1"/>
+ </category>
+ <category name="D_BK_CA_G_PER_CA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_G_PER_CA" id="0135" size="1"/>
+ </category>
+ <category name="D_BK_CA_G_BR_HIS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_G_BR_HIS" id="0136" size="1"/>
+ </category>
+ <category name="D_BK_CA_CAR_CDF" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CAR_CDF" id="0137" size="1"/>
+ </category>
+ <category name="D_BK_CA_ACC_CDF" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ACC_CDF" id="0138" size="1"/>
+ </category>
+ <category name="D_BK_CA_CEL_CDF" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CEL_CDF" id="0139" size="1"/>
+ </category>
+ <category name="D_BK_CA_CDF_ONS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CDF_ONS" id="0140" size="1"/>
+ </category>
+ <category name="D_BK_CA_CON_CDF1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CON_CDF1" id="0141" size="1"/>
+ </category>
+ <category name="D_BK_CA_CON_CDF2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CON_CDF2" id="0142" size="1"/>
+ </category>
+ <category name="D_BK_CA_SPFC_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_SPFC_D" id="0143" size="1"/>
+ </category>
+ <category name="D_BK_CA_ECORT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ECORT_D" id="0144" size="1"/>
+ </category>
+ <category name="D_BK_CA_SPFC_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_SPFC_F" id="0145" size="1"/>
+ </category>
+ <category name="D_BK_CA_ECORT_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ECORT_F" id="0146" size="1"/>
+ </category>
+ <category name="D_BK_CA_G_BM_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_G_BM_D" id="0149" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J09" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J09" id="0150" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J10" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J10" id="0151" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J11" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J11" id="0152" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J12" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J12" id="0153" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J13" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J13" id="0154" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J14" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J14" id="0155" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J15" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J15" id="0156" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J16" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J16" id="0157" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J17" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J17" id="0158" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J18" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J18" id="0159" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J19" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J19" id="0160" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J20" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J20" id="0161" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J21" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J21" id="0162" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J22" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J22" id="0163" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J23" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J23" id="0164" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J24" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J24" id="0165" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J25" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J25" id="0166" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J26" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J26" id="0167" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J27" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J27" id="0168" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J28" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J28" id="0169" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J29" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J29" id="0170" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J30" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J30" id="0171" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J31" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J31" id="0172" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J32" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J32" id="0173" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J33" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J33" id="0174" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J34" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J34" id="0175" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J35" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J35" id="0176" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J36" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J36" id="0177" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J37" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J37" id="0178" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J38" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J38" id="0179" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E01" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E01" id="0180" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E02" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E02" id="0181" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E03" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E03" id="0182" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E04" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E04" id="0183" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E05" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E05" id="0184" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E06" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E06" id="0185" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E07" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E07" id="0186" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E08" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E08" id="0187" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E09" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E09" id="0188" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E10" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E10" id="0189" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E11" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E11" id="0190" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E12" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E12" id="0191" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E13" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E13" id="0192" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E14" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E14" id="0193" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E15" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E15" id="0194" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E16" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E16" id="0195" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E17" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E17" id="0196" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E18" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E18" id="0197" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E19" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E19" id="0198" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E20" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E20" id="0199" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E21" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E21" id="0200" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E22" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E22" id="0201" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E23" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E23" id="0202" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E24" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E24" id="0203" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E25" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E25" id="0204" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E26" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E26" id="0205" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E27" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E27" id="0206" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E28" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E28" id="0207" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E29" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E29" id="0208" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E30" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E30" id="0209" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E31" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E31" id="0210" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E32" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E32" id="0211" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E33" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E33" id="0212" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E34" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E34" id="0213" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E35" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E35" id="0214" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E36" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E36" id="0215" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E37" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E37" id="0216" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E38" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E38" id="0217" size="1"/>
+ </category>
+ <category name="D_BK_CA_DAPL_ICN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DAPL_ICN" id="0218" size="1"/>
+ </category>
+ <category name="D_BK_CA_MADMNG_MEMCLEAR" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MADMNG_MEMCLEAR" id="0219" size="1"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_STABLE_DATA" id="0227" size="1"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_DRAMBKUP_DATA" id="0228" size="1"/>
+ </category>
+ <category name="D_BK_CA_DUMMYREAD_OFFSET" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DUMMYREAD_OFFSET" id="0229" size="1"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_PARAMETER" id="0230" size="1"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_RESUME" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_MMCOM_RESUME" id="0231" size="1"/>
+ <item name="D_BK_ID_MEDSRV_ITGP_RESUME" id="0274" size="1"/>
+ <item name="D_BK_ID_MEDSRV_DISC_RESUME" id="0275" size="1"/>
+ <item name="D_BK_ID_MEDSRV__CWORD57__RESUME" id="0276" size="1"/>
+ <item name="D_BK_ID_MEDSRV_BTA_RESUME" id="0277" size="1"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_RESUME" id="0278" size="1"/>
+ <item name="D_BK_ID_MEDSRV_SDVCOM_RESUME" id="0444" size="1"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEPARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEPARAM" id="0232" size="1"/>
+ <item name="D_BK_ID_REPROS_SERVICEFLG" id="0371" size="1"/>
+ <item name="D_BK_ID_REPROS_AUTO_UPDATE_CHECK" id="0372" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLID" id="0373" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_RESULT" id="0374" size="1"/>
+ <item name="D_BK_ID_REPROS_RESUME_TIME" id="0375" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_PCGVER" id="0376" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMING" id="0377" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMEOUT" id="0378" size="1"/>
+ <item name="D_BK_ID_REPROS_NA05OUT_RESULT" id="0379" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLURL" id="0380" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_INFO" id="0381" size="1"/>
+ <item name="D_BK_ID_REPROS_CENTERCOMM_STATE" id="0382" size="1"/>
+ <item name="D_BK_ID_REPROS_MAP_VER" id="0383" size="1"/>
+ <item name="D_BK_ID_REPROS_NA07_HISTORY_INFO" id="0385" size="1"/>
+ <item name="D_BK_ID_REPROS_UPDATE_INFO" id="0386" size="1"/>
+ <item name="D_BK_ID_REPROS_NA05_DOWNLOAD_SIZE" id="0387" size="1"/>
+ <item name="D_BK_ID_REPROS_FILE_PATH_INFO" id="0399" size="1"/>
+ <item name="D_BK_ID_REPROS_UPDATE_FILE_EXIST" id="0401" size="1"/>
+ <item name="D_BK_ID_REPROS_START_STATE_INFO" id="0403" size="1"/>
+ <item name="D_BK_ID_REPROS_CHECKFORUPDATE_TIME" id="0404" size="1"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEHISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEHISTORY" id="0233" size="1"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEINFO" id="0234" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKB_N" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKB_N" id="0235" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKB_M" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKB_M" id="0236" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKB_G" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKB_G" id="0237" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKB_B" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKB_B" id="0238" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKB_T" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKB_T" id="0239" size="1"/>
+ </category>
+ <category name="D_BK_CA_CLOCK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_CLOCK_OFFSET" id="0240" size="1"/>
+ <item name="D_BK_ID_CLOCK_STATE" id="0241" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_SYNC_OFFSET" id="0242" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_ASYNC" nand="true" cacheDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_ASYNC_OFFSET" id="0243" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAG_INFORMATION" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAG_INFORMATION" id="0244" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAG_UTILIZATION" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAG_UTILIZATION" id="0245" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_VSDSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_VSDSRV_PARAMETER" id="0246" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_ACNSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_ACNSRV_PARAMETER" id="0247" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_ASYNC_GRP" id="0248" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_SYNC_GRP" id="0249" size="1"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_PARAMETER" id="0250" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_FIX_CNT" nand="true" cacheDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_FIX_CNT" id="0251" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TD_STS" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TD_STS" id="0252" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_ROLLOVER_CNT" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_ROLLOVER_CNT" id="0253" size="1"/>
+ </category>
+ <category name="D_BK_CA_WLANM_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_WLANM_INFO" id="0254" size="1"/>
+ </category>
+ <category name="D_BK_CA_BTSTK_LINKKEY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BTSTK_LINKKEY" id="0255" size="1"/>
+ </category>
+ <category name="D_BK_CA_EOM_CONTENTS_STATUS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_EOM_CONTENTS_STATUS" id="0256" size="1"/>
+ </category>
+ <category name="D_BK_CA_UPDSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_UPDSERVICE_PARAMETER" id="0257" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_RCV" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_RCV" id="0259" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_GENERAL_GRP" id="0260" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_STARTUPBGM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_GENERAL_STARTUPBGM" id="0261" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_CLOCK_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_CLOCK_GRP" id="0262" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_HOME_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_HOME_GRP" id="0263" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_GRP" id="0264" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_VOL" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_VOL" id="0265" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_GRP" id="0266" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_UIC_TAB" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_UIC_TAB" id="0268" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_GRP" id="0269" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_MET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_MET" id="0270" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_UIC_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_UIC_GRP" id="0271" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_UIC_FILENAME" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_UIC_FILENAME" id="0272" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_SMARTAGENT_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_SMARTAGENT_GRP" id="0273" size="1"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_DISC_SETTING" id="0279" size="1"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_SETTING" id="0280" size="1"/>
+ <item name="D_BK_ID_MEDSRV_COM_SETTING" id="420" size="1"/>
+ </category>
+ <category name="D_BK_CA_GNDB_UPDATE_HISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GNDB_UPDATE_HISTORY" id="0281" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MEM" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_MEM" id="0282" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_EXTINFO" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_EXTINFO" id="0283" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_TRIPCNT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_TRIPCNT" id="0284" size="1"/>
+ </category>
+ <category name="D_BK_CA_PFDREC_FUNC" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_PFDREC_FUNC" id="0285" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_WORK_BUF" nand="false" backupDram="true" sync="false" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_WORK_BUF" id="0286" size="1"/>
+ </category>
+ <category name="D_BK_CA_AS__CWORD76_VOLUME" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_AS__CWORD76_VOLUME" id="0287" size="1"/>
+ </category>
+ <category name="D_BK_CA_G_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_G_INFO" id="0288" size="1"/>
+ </category>
+ <category name="D_BK_CA_G_BM_S" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_G_BM_S" id="0289" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_BR_HIS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_F_BR_HIS" id="0290" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_COOKIE" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_F_COOKIE" id="0291" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_INFO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_F_INFO" id="0292" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_USE_INF" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_F_USE_INF" id="0293" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_BM_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_F_BM_D" id="0294" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_BM_S" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_F_BM_S" id="0295" size="1"/>
+ </category>
+ <category name="D_BK_CA_KEYBOARD_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_KEYBOARD_PARAMETER" id="0296" size="1"/>
+ </category>
+ <category name="D_BK_CA_AUDIOSETTING_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_AUDIOSETTING_PARAMETER" id="0297" size="1"/>
+ </category>
+ <category name="D_BK_CA_CONNECTIVITY_LASTAPP" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CONNECTIVITY_LASTAPP" id="0298" size="1"/>
+ </category>
+ <category name="D_BK_CA_RADIOAPP_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RADIOAPP_PARAMETER" id="0299" size="1"/>
+ </category>
+ <category name="D_BK_CA_TOUCH" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_TOUCH_CONFIG" id="0300" size="1"/>
+ <item name="D_BK_ID_TOUCH_PARAMETER" id="0301" size="1"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_DCMFLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_DCMFLAG" id="0302" size="1"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG" id="0303" size="1"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_ACCON_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_ACCON_CDF" id="0304" size="1"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG_CDF" id="0305" size="1"/>
+ </category>
+ <category name="D_BK_CA_GRA_AMFMHD_CTRL" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_AMFMHD_STATION_LIST" id="0321" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_AMFMHD_STATION_LOGO" id="0322" size="1"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_LSM_DATA" id="0323" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_SC_CONFIG_PARAMS" id="0324" size="1"/>
+ </category>
+ <category name="D_BK_CA_GRA_SDARS_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_STATION_LIST" id="0326" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_CATEGORY_LIST" id="0327" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_IMDB_URL_CHN_LOGO" id="0328" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SMS_CFG" id="0365" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_RADIO_ID" id="0405" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SUBSCRIPTION_STATUS" id="0439" size="1"/>
+ </category>
+ <category name="D_BK_CA_DAB_TUN" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DAB_LM_ENS" id="0329" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_ENS_ORDER" id="0330" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_SRVC" id="0331" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_SRV_ORDER" id="0332" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_CMP" id="0333" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_COMP_ORDER" id="0334" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_HARD_LINK" id="0335" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_HARD_LINK_ORDER" id="0336" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_LINK_INFO" id="0337" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_LINK_INFO_ORDER" id="0338" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_TPEG_LIST" id="0339" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_TPEG_LIST_ORDER" id="0340" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_OE_FREQ" id="0341" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_OE_FREQ_ORDER" id="0342" size="1"/>
+ <item name="D_BK_ID_NVM_DAB_OE_EID" id="0343" size="1"/>
+ <item name="D_BK_ID_NVM_DAB_OE_EID_ORDER" id="0344" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_BEST_FM_LINK" id="0440" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_ERROR_COUNT" id="0441" size="1"/>
+ </category>
+ <category name="D_BK_CA_DBG_POSTMORTEM" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_CPF_POSTMORTEM" id="0345" size="1"/>
+ </category>
+ <category name="D_BK_CA_DBG_FILTER_SET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DBG_FILTER_SET" id="0346" size="1"/>
+ </category>
+ <category name="D_BK_CA_DCM_CNCT_EN" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DCM_CNCT_EN" id="0347" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_CLK" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_CLK" id="0348" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_CP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_CP" id="0349" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_LCTY" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_LCTY" id="0350" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_LPOS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_LPOS" id="0351" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_SRCA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_SRCA" id="0352" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPTMNG_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MPTMNG_D" id="0353" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPTMNG_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MPTMNG_F" id="0354" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TEST_ROLLOVER_CNT" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TEST_ROLLOVER_CNT" id="0355" size="1"/>
+ </category>
+ <category name="D_BK_CA_PAYD_ODO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PAYD_ODO" id="0358" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_RSDDS_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_RSDDS_STATS" id="0359" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_UPDATE_DB_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_UPDATE_DB_STATS" id="0360" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_HISTORY_LIST" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_HISTORY_LIST" id="0361" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WC_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WC_INFO" id="0362" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_VIDCM_DEPLOYMENT_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_VIDCM_DEPLOYMENT_INFO" id="0363" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_DEALER_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_DEALER_INFO" id="0384" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J01" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J01" id="0388" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J02" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J02" id="0389" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J03" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J03" id="0390" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J04" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J04" id="0391" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J05" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J05" id="0392" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J06" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J06" id="0393" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J07" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J07" id="0394" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J08" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J08" id="0395" size="1"/>
+ </category>
+ <category name="D_BK_CA_MODEMANAGER_LASTMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODEMANAGER_LASTMODE" id="0396" size="1"/>
+ </category>
+ <category name="D_BK_CA_MODBPFSG" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODBPFSG" id="0397" size="1"/>
+ </category>
+ <category name="D_BK_CA_ASS_PARAMETER" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ASS_PARAMETER" id="0406" size="1"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_N" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_N" id="0407" size="1"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_D" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_D" id="0408" size="1"/>
+ </category>
+ <category name="D_BK_CA_VR_SYNC_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VR_INPUT_AUDIO_DUMP" id="0258" size="1"/>
+ <item name="D_BK_ID_VR_PVR_FLAG" id="0364" size="1"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_MANAGEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_MANAGEINFO" id="0409" size="1"/>
+ </category>
+ <category name="D_BK_CA_PCSECBK" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PCSECBK" id="0410" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_LRN_1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_LRN_1" id="0412" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_LRN_2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_LRN_2" id="0413" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_LRN_3" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_LRN_3" id="0414" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_LRN_4" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_LRN_4" id="0415" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_LRN_5" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_LRN_5" id="0416" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_HISORY" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_HISORY" id="0417" size="1"/>
+ </category>
+ <category name="D_BK_CA_REPROS_MAPUPDATE_PARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_MAPUPDATE_STATUS" id="0418" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__SYNC_GRP" id="0419" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_PNS1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_PNS1" id="0421" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_PNS2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_PNS2" id="0422" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_USER" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_USER" id="0423" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_SMAP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_SMAP" id="0424" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT1_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT1_F" id="0425" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT2_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT2_F" id="0426" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT3_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT3_F" id="0427" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT4_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT4_F" id="0428" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT5_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT5_F" id="0429" size="1"/>
+ </category>
+ <category name="D_BK_CA_MUDINFO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MUDINFO" id="0430" size="1"/>
+ </category>
+ <category name="D_BK_CA_CTRRTSRV" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CTRRTSRV" id="0431" size="1"/>
+ </category>
+ <category name="D_BK_CA_VDU_MNG" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VDU_MNG" id="0432" size="1"/>
+ </category>
+ <category name="D_BK_CA_VDU_ICON" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VDU_ICON" id="0433" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAG_DEVICEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAG_DEVICEINFO" id="0434" size="1"/>
+ </category>
+ <category name="D_BK_CA_BT_PAIRING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_PAIRING" id="0435" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_SET_TIME" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_SET_TIME" id="0436" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_SHUT_DOWN" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_FORECAST" id="0221" size="1"/>
+ <item name="D_BK_ID_DTSERVICE_COORDINATE" id="0223" size="1"/>
+ <item name="D_BK_ID_DTSERVICE_AFLIST" id="0224" size="1"/>
+ <item name="D_BK_ID_DTSERVICE_DOPPLER" id="0225" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_IMMIEDIATELY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_CITYDB" id="0220" size="1"/>
+ <item name="D_BK_ID_DTSERVICE_SETUP" id="0222" size="1"/>
+ <item name="D_BK_ID_DTSERVICE_WEATHER_HISTORY" id="0226" size="1"/>
+ </category>
+ <category name="D_BK_CA_TCS_LEARN_DICTIONARY" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_TCS_LEARN_DICTIONARY" id="437" size="1"/>
+ <item name="D_BK_ID_TCS_WNN_LEARN_DICTIONARY" id="438" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_INFO" id="0442" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_FLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_FLAG" id="0443" size="1"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL_IMM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_LIST" id="0325" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER1_LIST" id="0366" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER2_LIST" id="0367" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER3_LIST" id="0368" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER4_LIST" id="0369" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER5_LIST" id="0370" size="1"/>
+ </category>
+ <category name="D_BK_CA_CON_CWORD57__INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CON_CWORD57__INFO" id="0445" size="1"/>
+ </category>
+ <category name="D_BK_CA_HELP_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_HELP_DATA" id="0446" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_DRAM_OFFSET" id="0447" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_METSRV_PARAMETER" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VS_METSRV_PARAMETER" id="0448" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MASK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_MASK" id="0449" size="1"/>
+ </category>
+ <category name="D_BK_CA_NAVIPROXY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NAVIPROXY" id="0450" size="1"/>
+ </category>
+ <category name="D_BK_CA_AWBPROXY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_AWBPROXY" id="0451" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_CMRSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_CMRSRV_PARAMETER" id="0452" size="1"/>
+ </category>
+ <category name="D_BK_CA_DWR_DWRM" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DWR_DWRM" id="0453" size="1"/>
+ </category>
+ <category name="D_BK_CA_MUDINIT" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MUDINIT" id="0454" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__USER_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD27__SETTING" id="0457" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__SHARED_RAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD27__CONNECTION_MODE" id="0456" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_ETCC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_ETCC" id="0458" size="1"/>
+ </category>
+ <category name="D_BK_CA_BT_MANAGEMENT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_POWER" id="0459" size="1"/>
+ <item name="D_BK_ID_BT_PINCODE" id="0460" size="1"/>
+ <item name="D_BK_ID_BT_NAME" id="0461" size="1"/>
+ <item name="D_BK_ID_BT_DEFAULT_NAME" id="0462" size="1"/>
+ <item name="D_BK_ID_BT_ADDRESS" id="0463" size="1"/>
+ <item name="D_BK_ID_BT_AUTOMATIC_CONNECTION" id="0464" size="1"/>
+ <item name="D_BK_ID_BT_PREFERRED_SETTING" id="0465" size="1"/>
+ <item name="D_BK_ID_BT_PHONE_DISPLAY_STATE" id="0466" size="1"/>
+ <item name="D_BK_ID_BT_AUDIOPLAYER_DISPLAY_STATE" id="0467" size="1"/>
+ <item name="D_BK_ID_BT_PROFILE_AVAILABLE" id="0468" size="1"/>
+ <item name="D_BK_ID_BT_DCM_PHONE" id="0469" size="1"/>
+ </category>
+ <category name="D_BK_CA_EOMSERVICE_LOCALSTORAGE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_EOMSERVICE_LOCALSTORAGE" id="0470" size="1"/>
+ </category>
+ <category name="D_BK_CA_DOA_EXISTENCE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DOA_EXISTENCE" id="0471" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_SETTING" id="0472" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_ODOMETER" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_ODOMETER" id="0473" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_DIAGMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_DIAGMODE" id="0474" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__ASYNC_GRP" id="0475" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__1TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__1TRIP_ASYNC_GRP" id="0476" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD28_AUTO_SHARED_RAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD28_AUTO_CONNECTION_MODE" id="0477" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD28_AUTO_USER_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD28_AUTO_SETTING" id="0478" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD24_" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD24_" id="0479" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_ASYNC_GRP" id="0480" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_SYNC" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_SYNC_GRP" id="0481" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__TRIP_ASYNC_GRP" id="0482" size="1"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_METER_TYPE" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_METER_TYPE" id="0483" size="1"/>
+ </category>
+ <category name="D_BK_CA_ADAS_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ADAS_SETTING" id="0484" size="1"/>
+ </category>
+</backup>
diff --git a/nsframework/backup_manager/config/conf/backup/backup_AREA1_L.xml b/nsframework/backup_manager/config/conf/backup/backup_AREA1_L.xml
new file mode 100755
index 0000000..a9d523a
--- /dev/null
+++ b/nsframework/backup_manager/config/conf/backup/backup_AREA1_L.xml
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="D_BK_CA_VEHICLE_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_STABLE_DATA" id="0227" size="16"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_DRAMBKUP_DATA" id="0228" size="16"/>
+ </category>
+ <category name="D_BK_CA_DUMMYREAD_OFFSET" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DUMMYREAD_OFFSET" id="0229" size="512"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_PARAMETER" id="0230" size="4096"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_RESUME" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_MMCOM_RESUME" id="0231" size="53280"/>
+ <item name="D_BK_ID_MEDSRV_ITGP_RESUME" id="0274" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_DISC_RESUME" id="0275" size="1024"/>
+ <item name="D_BK_ID_MEDSRV__CWORD57__RESUME" id="0276" size="10656"/>
+ <item name="D_BK_ID_MEDSRV_BTA_RESUME" id="0277" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_RESUME" id="0278" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_SDVCOM_RESUME" id="0444" size="256"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEPARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEPARAM" id="0232" size="32"/>
+ <item name="D_BK_ID_REPROS_AUTO_UPDATE_CHECK" id="0372" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLID" id="0373" size="4"/>
+ <item name="D_BK_ID_REPROS_RESUME_TIME" id="0375" size="6"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_PCGVER" id="0376" size="4"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMING" id="0377" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMEOUT" id="0378" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLURL" id="0380" size="2048"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_INFO" id="0381" size="8192"/>
+ <item name="D_BK_ID_REPROS_CENTERCOMM_STATE" id="0382" size="1"/>
+ <item name="D_BK_ID_REPROS_NA07_HISTORY_INFO" id="0385" size="169192"/>
+ <item name="D_BK_ID_REPROS_NA05_DOWNLOAD_SIZE" id="0387" size="8"/>
+ <item name="D_BK_ID_REPROS_FILE_PATH_INFO" id="0399" size="1024"/>
+ <item name="D_BK_ID_REPROS_UPDATE_FILE_EXIST" id="0401" size="4"/>
+ <item name="D_BK_ID_REPROS_CHECKFORUPDATE_TIME" id="0404" size="4"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEHISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEHISTORY" id="0233" size="4096"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEINFO" id="0234" size="33792"/>
+ </category>
+ <category name="D_BK_CA_CLOCK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_CLOCK_OFFSET" id="0240" size="16"/>
+ <item name="D_BK_ID_CLOCK_STATE" id="0241" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_SYNC_OFFSET" id="0242" size="256"/>
+ </category>
+ <category name="D_BK_CA_DIAG_INFORMATION" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAG_INFORMATION" id="0244" size="2560"/>
+ </category>
+ <category name="D_BK_CA_VS_VSDSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_VSDSRV_PARAMETER" id="0246" size="4096"/>
+ </category>
+ <category name="D_BK_CA_VS_ACNSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_ACNSRV_PARAMETER" id="0247" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_ASYNC_GRP" id="0248" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_SYNC_GRP" id="0249" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_PARAMETER" id="0250" size="256"/>
+ </category>
+ <category name="D_BK_CA_WLANM_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_WLANM_INFO" id="0254" size="1024"/>
+ </category>
+ <category name="D_BK_CA_BTSTK_LINKKEY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BTSTK_LINKKEY" id="0255" size="20480"/>
+ </category>
+ <category name="D_BK_CA_EOM_CONTENTS_STATUS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_EOM_CONTENTS_STATUS" id="0256" size="4"/>
+ </category>
+ <category name="D_BK_CA_UPDSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_UPDSERVICE_PARAMETER" id="0257" size="4096"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_RCV" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_RCV" id="0259" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_GENERAL_GRP" id="0260" size="512"/>
+ </category>
+ <category name="D_BK_CA_INFS_CLOCK_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_CLOCK_GRP" id="0262" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_HOME_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_HOME_GRP" id="0263" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_GRP" id="0264" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_VOL" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_VOL" id="0265" size="64"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_GRP" id="0266" size="384"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_GRP" id="0269" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_SMARTAGENT_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_SMARTAGENT_GRP" id="0273" size="128"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_DISC_SETTING" id="0279" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_SETTING" id="0280" size="32"/>
+ <item name="D_BK_ID_MEDSRV_COM_SETTING" id="420" size="32"/>
+ </category>
+ <category name="D_BK_CA_GNDB_UPDATE_HISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GNDB_UPDATE_HISTORY" id="0281" size="400"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MEM" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_MEM" id="0282" size="9011200"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_EXTINFO" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_EXTINFO" id="0283" size="32"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_TRIPCNT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_TRIPCNT" id="0284" size="16"/>
+ </category>
+ <category name="D_BK_CA_PFDREC_FUNC" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_PFDREC_FUNC" id="0285" size="16"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_WORK_BUF" nand="false" backupDram="true" sync="false" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_WORK_BUF" id="0286" size="9068544"/>
+ </category>
+ <category name="D_BK_CA_AS__CWORD76_VOLUME" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_AS__CWORD76_VOLUME" id="0287" size="200"/>
+ </category>
+ <category name="D_BK_CA_KEYBOARD_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_KEYBOARD_PARAMETER" id="0296" size="8"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_LSM_DATA" id="0323" size="2048"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_SC_CONFIG_PARAMS" id="0324" size="64"/>
+ </category>
+ <category name="D_BK_CA_DBG_FILTER_SET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DBG_FILTER_SET" id="0346" size="240"/>
+ </category>
+ <category name="D_BK_CA_DCM_CNCT_EN" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DCM_CNCT_EN" id="0347" size="4"/>
+ </category>
+ <category name="D_BK_CA_RS_RSDDS_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_RSDDS_STATS" id="0359" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_UPDATE_DB_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_UPDATE_DB_STATS" id="0360" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_HISTORY_LIST" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_HISTORY_LIST" id="0361" size="2804"/>
+ </category>
+ <category name="D_BK_CA_RS_WC_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WC_INFO" id="0362" size="400"/>
+ </category>
+ <category name="D_BK_CA_RS_VIDCM_DEPLOYMENT_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_VIDCM_DEPLOYMENT_INFO" id="0363" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_DEALER_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_DEALER_INFO" id="0384" size="712"/>
+ </category>
+ <category name="D_BK_CA_MODEMANAGER_LASTMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODEMANAGER_LASTMODE" id="0396" size="512"/>
+ </category>
+ <category name="D_BK_CA_ASS_PARAMETER" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ASS_PARAMETER" id="0406" size="26384"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_N" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_N" id="0407" size="16"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_D" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_D" id="0408" size="8"/>
+ </category>
+ <category name="D_BK_CA_VR_SYNC_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VR_INPUT_AUDIO_DUMP" id="0258" size="4"/>
+ <item name="D_BK_ID_VR_PVR_FLAG" id="0364" size="4"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_MANAGEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_MANAGEINFO" id="0409" size="128"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__SYNC_GRP" id="0419" size="19433"/>
+ </category>
+ <category name="D_BK_CA_DIAG_DEVICEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAG_DEVICEINFO" id="0434" size="10240"/>
+ </category>
+ <category name="D_BK_CA_BT_PAIRING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_PAIRING" id="0435" size="102400"/>
+ </category>
+ <category name="D_BK_CA_TCS_LEARN_DICTIONARY" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_TCS_LEARN_DICTIONARY" id="437" size="2097152"/>
+ <item name="D_BK_ID_TCS_WNN_LEARN_DICTIONARY" id="438" size="1176004"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_FLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_FLAG" id="0443" size="4"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL_IMM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_LIST" id="0325" size="22896"/>
+ </category>
+ <category name="D_BK_CA_CON_CWORD57__INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CON_CWORD57__INFO" id="0445" size="256"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_DRAM_OFFSET" id="0447" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_METSRV_PARAMETER" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VS_METSRV_PARAMETER" id="0448" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MASK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_MASK" id="0449" size="4"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_SETTING" id="0472" size="64"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_ODOMETER" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_ODOMETER" id="0473" size="8"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_DIAGMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_DIAGMODE" id="0474" size="4"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__ASYNC_GRP" id="0475" size="19334"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__1TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__1TRIP_ASYNC_GRP" id="0476" size="99"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_ASYNC_GRP" id="0480" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_SYNC" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_SYNC_GRP" id="0481" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__TRIP_ASYNC_GRP" id="0482" size="19334"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_METER_TYPE" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_METER_TYPE" id="0483" size="1"/>
+ </category>
+ <category name="D_BK_CA_ADAS_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ADAS_SETTING" id="0484" size="512"/>
+ </category>
+</backup>
diff --git a/nsframework/backup_manager/config/conf/backup/backup_AREA1_TE.xml b/nsframework/backup_manager/config/conf/backup/backup_AREA1_TE.xml
new file mode 100755
index 0000000..a9d523a
--- /dev/null
+++ b/nsframework/backup_manager/config/conf/backup/backup_AREA1_TE.xml
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="D_BK_CA_VEHICLE_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_STABLE_DATA" id="0227" size="16"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_DRAMBKUP_DATA" id="0228" size="16"/>
+ </category>
+ <category name="D_BK_CA_DUMMYREAD_OFFSET" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DUMMYREAD_OFFSET" id="0229" size="512"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_PARAMETER" id="0230" size="4096"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_RESUME" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_MMCOM_RESUME" id="0231" size="53280"/>
+ <item name="D_BK_ID_MEDSRV_ITGP_RESUME" id="0274" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_DISC_RESUME" id="0275" size="1024"/>
+ <item name="D_BK_ID_MEDSRV__CWORD57__RESUME" id="0276" size="10656"/>
+ <item name="D_BK_ID_MEDSRV_BTA_RESUME" id="0277" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_RESUME" id="0278" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_SDVCOM_RESUME" id="0444" size="256"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEPARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEPARAM" id="0232" size="32"/>
+ <item name="D_BK_ID_REPROS_AUTO_UPDATE_CHECK" id="0372" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLID" id="0373" size="4"/>
+ <item name="D_BK_ID_REPROS_RESUME_TIME" id="0375" size="6"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_PCGVER" id="0376" size="4"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMING" id="0377" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMEOUT" id="0378" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLURL" id="0380" size="2048"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_INFO" id="0381" size="8192"/>
+ <item name="D_BK_ID_REPROS_CENTERCOMM_STATE" id="0382" size="1"/>
+ <item name="D_BK_ID_REPROS_NA07_HISTORY_INFO" id="0385" size="169192"/>
+ <item name="D_BK_ID_REPROS_NA05_DOWNLOAD_SIZE" id="0387" size="8"/>
+ <item name="D_BK_ID_REPROS_FILE_PATH_INFO" id="0399" size="1024"/>
+ <item name="D_BK_ID_REPROS_UPDATE_FILE_EXIST" id="0401" size="4"/>
+ <item name="D_BK_ID_REPROS_CHECKFORUPDATE_TIME" id="0404" size="4"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEHISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEHISTORY" id="0233" size="4096"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEINFO" id="0234" size="33792"/>
+ </category>
+ <category name="D_BK_CA_CLOCK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_CLOCK_OFFSET" id="0240" size="16"/>
+ <item name="D_BK_ID_CLOCK_STATE" id="0241" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_SYNC_OFFSET" id="0242" size="256"/>
+ </category>
+ <category name="D_BK_CA_DIAG_INFORMATION" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAG_INFORMATION" id="0244" size="2560"/>
+ </category>
+ <category name="D_BK_CA_VS_VSDSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_VSDSRV_PARAMETER" id="0246" size="4096"/>
+ </category>
+ <category name="D_BK_CA_VS_ACNSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_ACNSRV_PARAMETER" id="0247" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_ASYNC_GRP" id="0248" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_SYNC_GRP" id="0249" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_PARAMETER" id="0250" size="256"/>
+ </category>
+ <category name="D_BK_CA_WLANM_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_WLANM_INFO" id="0254" size="1024"/>
+ </category>
+ <category name="D_BK_CA_BTSTK_LINKKEY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BTSTK_LINKKEY" id="0255" size="20480"/>
+ </category>
+ <category name="D_BK_CA_EOM_CONTENTS_STATUS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_EOM_CONTENTS_STATUS" id="0256" size="4"/>
+ </category>
+ <category name="D_BK_CA_UPDSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_UPDSERVICE_PARAMETER" id="0257" size="4096"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_RCV" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_RCV" id="0259" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_GENERAL_GRP" id="0260" size="512"/>
+ </category>
+ <category name="D_BK_CA_INFS_CLOCK_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_CLOCK_GRP" id="0262" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_HOME_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_HOME_GRP" id="0263" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_GRP" id="0264" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_VOL" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_VOL" id="0265" size="64"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_GRP" id="0266" size="384"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_GRP" id="0269" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_SMARTAGENT_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_SMARTAGENT_GRP" id="0273" size="128"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_DISC_SETTING" id="0279" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_SETTING" id="0280" size="32"/>
+ <item name="D_BK_ID_MEDSRV_COM_SETTING" id="420" size="32"/>
+ </category>
+ <category name="D_BK_CA_GNDB_UPDATE_HISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GNDB_UPDATE_HISTORY" id="0281" size="400"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MEM" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_MEM" id="0282" size="9011200"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_EXTINFO" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_EXTINFO" id="0283" size="32"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_TRIPCNT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_TRIPCNT" id="0284" size="16"/>
+ </category>
+ <category name="D_BK_CA_PFDREC_FUNC" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_PFDREC_FUNC" id="0285" size="16"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_WORK_BUF" nand="false" backupDram="true" sync="false" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_WORK_BUF" id="0286" size="9068544"/>
+ </category>
+ <category name="D_BK_CA_AS__CWORD76_VOLUME" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_AS__CWORD76_VOLUME" id="0287" size="200"/>
+ </category>
+ <category name="D_BK_CA_KEYBOARD_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_KEYBOARD_PARAMETER" id="0296" size="8"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_LSM_DATA" id="0323" size="2048"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_SC_CONFIG_PARAMS" id="0324" size="64"/>
+ </category>
+ <category name="D_BK_CA_DBG_FILTER_SET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DBG_FILTER_SET" id="0346" size="240"/>
+ </category>
+ <category name="D_BK_CA_DCM_CNCT_EN" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DCM_CNCT_EN" id="0347" size="4"/>
+ </category>
+ <category name="D_BK_CA_RS_RSDDS_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_RSDDS_STATS" id="0359" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_UPDATE_DB_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_UPDATE_DB_STATS" id="0360" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_HISTORY_LIST" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_HISTORY_LIST" id="0361" size="2804"/>
+ </category>
+ <category name="D_BK_CA_RS_WC_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WC_INFO" id="0362" size="400"/>
+ </category>
+ <category name="D_BK_CA_RS_VIDCM_DEPLOYMENT_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_VIDCM_DEPLOYMENT_INFO" id="0363" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_DEALER_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_DEALER_INFO" id="0384" size="712"/>
+ </category>
+ <category name="D_BK_CA_MODEMANAGER_LASTMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODEMANAGER_LASTMODE" id="0396" size="512"/>
+ </category>
+ <category name="D_BK_CA_ASS_PARAMETER" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ASS_PARAMETER" id="0406" size="26384"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_N" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_N" id="0407" size="16"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_D" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_D" id="0408" size="8"/>
+ </category>
+ <category name="D_BK_CA_VR_SYNC_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VR_INPUT_AUDIO_DUMP" id="0258" size="4"/>
+ <item name="D_BK_ID_VR_PVR_FLAG" id="0364" size="4"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_MANAGEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_MANAGEINFO" id="0409" size="128"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__SYNC_GRP" id="0419" size="19433"/>
+ </category>
+ <category name="D_BK_CA_DIAG_DEVICEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAG_DEVICEINFO" id="0434" size="10240"/>
+ </category>
+ <category name="D_BK_CA_BT_PAIRING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_PAIRING" id="0435" size="102400"/>
+ </category>
+ <category name="D_BK_CA_TCS_LEARN_DICTIONARY" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_TCS_LEARN_DICTIONARY" id="437" size="2097152"/>
+ <item name="D_BK_ID_TCS_WNN_LEARN_DICTIONARY" id="438" size="1176004"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_FLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_FLAG" id="0443" size="4"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL_IMM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_LIST" id="0325" size="22896"/>
+ </category>
+ <category name="D_BK_CA_CON_CWORD57__INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CON_CWORD57__INFO" id="0445" size="256"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_DRAM_OFFSET" id="0447" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_METSRV_PARAMETER" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VS_METSRV_PARAMETER" id="0448" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MASK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_MASK" id="0449" size="4"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_SETTING" id="0472" size="64"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_ODOMETER" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_ODOMETER" id="0473" size="8"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_DIAGMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_DIAGMODE" id="0474" size="4"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__ASYNC_GRP" id="0475" size="19334"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__1TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__1TRIP_ASYNC_GRP" id="0476" size="99"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_ASYNC_GRP" id="0480" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_SYNC" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_SYNC_GRP" id="0481" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__TRIP_ASYNC_GRP" id="0482" size="19334"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_METER_TYPE" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_METER_TYPE" id="0483" size="1"/>
+ </category>
+ <category name="D_BK_CA_ADAS_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ADAS_SETTING" id="0484" size="512"/>
+ </category>
+</backup>
diff --git a/nsframework/backup_manager/config/conf/backup/backup_AREA2_T.xml b/nsframework/backup_manager/config/conf/backup/backup_AREA2_T.xml
new file mode 100755
index 0000000..ec028ea
--- /dev/null
+++ b/nsframework/backup_manager/config/conf/backup/backup_AREA2_T.xml
@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="D_BK_CA_VEHICLE_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_STABLE_DATA" id="0227" size="16"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_DRAMBKUP_DATA" id="0228" size="16"/>
+ </category>
+ <category name="D_BK_CA_DUMMYREAD_OFFSET" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DUMMYREAD_OFFSET" id="0229" size="512"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_PARAMETER" id="0230" size="4096"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_RESUME" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_MMCOM_RESUME" id="0231" size="53280"/>
+ <item name="D_BK_ID_MEDSRV_ITGP_RESUME" id="0274" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_DISC_RESUME" id="0275" size="1024"/>
+ <item name="D_BK_ID_MEDSRV__CWORD57__RESUME" id="0276" size="10656"/>
+ <item name="D_BK_ID_MEDSRV_BTA_RESUME" id="0277" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_SDVCOM_RESUME" id="0444" size="256"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEPARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEPARAM" id="0232" size="32"/>
+ <item name="D_BK_ID_REPROS_AUTO_UPDATE_CHECK" id="0372" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLID" id="0373" size="4"/>
+ <item name="D_BK_ID_REPROS_RESUME_TIME" id="0375" size="6"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_PCGVER" id="0376" size="4"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMING" id="0377" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMEOUT" id="0378" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLURL" id="0380" size="2048"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_INFO" id="0381" size="8192"/>
+ <item name="D_BK_ID_REPROS_CENTERCOMM_STATE" id="0382" size="1"/>
+ <item name="D_BK_ID_REPROS_NA07_HISTORY_INFO" id="0385" size="169192"/>
+ <item name="D_BK_ID_REPROS_NA05_DOWNLOAD_SIZE" id="0387" size="8"/>
+ <item name="D_BK_ID_REPROS_FILE_PATH_INFO" id="0399" size="1024"/>
+ <item name="D_BK_ID_REPROS_UPDATE_FILE_EXIST" id="0401" size="4"/>
+ <item name="D_BK_ID_REPROS_CHECKFORUPDATE_TIME" id="0404" size="4"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEHISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEHISTORY" id="0233" size="4096"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEINFO" id="0234" size="33792"/>
+ </category>
+ <category name="D_BK_CA_CLOCK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_CLOCK_OFFSET" id="0240" size="16"/>
+ <item name="D_BK_ID_CLOCK_STATE" id="0241" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_SYNC_OFFSET" id="0242" size="256"/>
+ </category>
+ <category name="D_BK_CA_DIAG_INFORMATION" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAG_INFORMATION" id="0244" size="2560"/>
+ </category>
+ <category name="D_BK_CA_VS_VSDSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_VSDSRV_PARAMETER" id="0246" size="4096"/>
+ </category>
+ <category name="D_BK_CA_VS_ACNSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_ACNSRV_PARAMETER" id="0247" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_ASYNC_GRP" id="0248" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_SYNC_GRP" id="0249" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_PARAMETER" id="0250" size="256"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_FIX_CNT" nand="true" cacheDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_FIX_CNT" id="0251" size="16"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_ROLLOVER_CNT" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_ROLLOVER_CNT" id="0253" size="32"/>
+ </category>
+ <category name="D_BK_CA_WLANM_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_WLANM_INFO" id="0254" size="1024"/>
+ </category>
+ <category name="D_BK_CA_BTSTK_LINKKEY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BTSTK_LINKKEY" id="0255" size="20480"/>
+ </category>
+ <category name="D_BK_CA_UPDSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_UPDSERVICE_PARAMETER" id="0257" size="4096"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_RCV" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_RCV" id="0259" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_GENERAL_GRP" id="0260" size="512"/>
+ </category>
+ <category name="D_BK_CA_INFS_CLOCK_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_CLOCK_GRP" id="0262" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_HOME_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_HOME_GRP" id="0263" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_GRP" id="0264" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_VOL" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_VOL" id="0265" size="64"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_GRP" id="0266" size="384"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_GRP" id="0269" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_SMARTAGENT_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_SMARTAGENT_GRP" id="0273" size="128"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_DISC_SETTING" id="0279" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_COM_SETTING" id="420" size="32"/>
+ </category>
+ <category name="D_BK_CA_GNDB_UPDATE_HISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GNDB_UPDATE_HISTORY" id="0281" size="400"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MEM" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_MEM" id="0282" size="9011200"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_EXTINFO" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_EXTINFO" id="0283" size="32"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_TRIPCNT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_TRIPCNT" id="0284" size="16"/>
+ </category>
+ <category name="D_BK_CA_PFDREC_FUNC" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_PFDREC_FUNC" id="0285" size="16"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_WORK_BUF" nand="false" backupDram="true" sync="false" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_WORK_BUF" id="0286" size="9068544"/>
+ </category>
+ <category name="D_BK_CA_AS__CWORD76_VOLUME" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_AS__CWORD76_VOLUME" id="0287" size="200"/>
+ </category>
+ <category name="D_BK_CA_KEYBOARD_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_KEYBOARD_PARAMETER" id="0296" size="8"/>
+ </category>
+ <category name="D_BK_CA_TOUCH" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_TOUCH_CONFIG" id="0300" size="32"/>
+ <item name="D_BK_ID_TOUCH_PARAMETER" id="0301" size="4"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_DCMFLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_DCMFLAG" id="0302" size="8"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG" id="0303" size="2048"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_ACCON_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_ACCON_CDF" id="0304" size="2048"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG_CDF" id="0305" size="2048"/>
+ </category>
+ <category name="D_BK_CA_GRA_AMFMHD_CTRL" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_AMFMHD_STATION_LIST" id="0321" size="13168"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_LSM_DATA" id="0323" size="2048"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_SC_CONFIG_PARAMS" id="0324" size="64"/>
+ </category>
+ <category name="D_BK_CA_GRA_SDARS_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_STATION_LIST" id="0326" size="45056"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_CATEGORY_LIST" id="0327" size="7168"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SMS_CFG" id="0365" size="65536"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_RADIO_ID" id="0405" size="16"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SUBSCRIPTION_STATUS" id="0439" size="8"/>
+ </category>
+ <category name="D_BK_CA_DBG_FILTER_SET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DBG_FILTER_SET" id="0346" size="240"/>
+ </category>
+ <category name="D_BK_CA_DCM_CNCT_EN" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DCM_CNCT_EN" id="0347" size="4"/>
+ </category>
+ <category name="D_BK_CA_RS_RSDDS_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_RSDDS_STATS" id="0359" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_UPDATE_DB_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_UPDATE_DB_STATS" id="0360" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_HISTORY_LIST" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_HISTORY_LIST" id="0361" size="2804"/>
+ </category>
+ <category name="D_BK_CA_RS_WC_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WC_INFO" id="0362" size="400"/>
+ </category>
+ <category name="D_BK_CA_RS_VIDCM_DEPLOYMENT_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_VIDCM_DEPLOYMENT_INFO" id="0363" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_DEALER_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_DEALER_INFO" id="0384" size="712"/>
+ </category>
+ <category name="D_BK_CA_MODEMANAGER_LASTMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODEMANAGER_LASTMODE" id="0396" size="512"/>
+ </category>
+ <category name="D_BK_CA_ASS_PARAMETER" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ASS_PARAMETER" id="0406" size="26384"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_N" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_N" id="0407" size="16"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_D" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_D" id="0408" size="8"/>
+ </category>
+ <category name="D_BK_CA_VR_SYNC_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VR_INPUT_AUDIO_DUMP" id="0258" size="4"/>
+ <item name="D_BK_ID_VR_PVR_FLAG" id="0364" size="4"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_MANAGEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_MANAGEINFO" id="0409" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAG_DEVICEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAG_DEVICEINFO" id="0434" size="10240"/>
+ </category>
+ <category name="D_BK_CA_BT_PAIRING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_PAIRING" id="0435" size="102400"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_SHUT_DOWN" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_FORECAST" id="0221" size="153600"/>
+ <item name="D_BK_ID_DTSERVICE_COORDINATE" id="0223" size="128"/>
+ <item name="D_BK_ID_DTSERVICE_AFLIST" id="0224" size="1024"/>
+ <item name="D_BK_ID_DTSERVICE_DOPPLER" id="0225" size="73728"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_IMMIEDIATELY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_CITYDB" id="0220" size="113664"/>
+ <item name="D_BK_ID_DTSERVICE_SETUP" id="0222" size="64"/>
+ <item name="D_BK_ID_DTSERVICE_WEATHER_HISTORY" id="0226" size="1024"/>
+ </category>
+ <category name="D_BK_CA_TCS_LEARN_DICTIONARY" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_TCS_LEARN_DICTIONARY" id="437" size="2097152"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_INFO" id="0442" size="8"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_FLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_FLAG" id="0443" size="4"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL_IMM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_LIST" id="0325" size="22896"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER1_LIST" id="0366" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER2_LIST" id="0367" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER3_LIST" id="0368" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER4_LIST" id="0369" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER5_LIST" id="0370" size="10240"/>
+ </category>
+ <category name="D_BK_CA_CON_CWORD57__INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CON_CWORD57__INFO" id="0445" size="256"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_DRAM_OFFSET" id="0447" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_METSRV_PARAMETER" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VS_METSRV_PARAMETER" id="0448" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MASK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_MASK" id="0449" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__USER_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD27__SETTING" id="0457" size="1024"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__SHARED_RAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD27__CONNECTION_MODE" id="0456" size="1024"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_SETTING" id="0472" size="64"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_ODOMETER" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_ODOMETER" id="0473" size="8"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_DIAGMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_DIAGMODE" id="0474" size="4"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_ASYNC_GRP" id="0480" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_SYNC" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_SYNC_GRP" id="0481" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_METER_TYPE" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_METER_TYPE" id="0483" size="1"/>
+ </category>
+ <category name="D_BK_CA_ADAS_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ADAS_SETTING" id="0484" size="512"/>
+ </category>
+</backup>
diff --git a/nsframework/backup_manager/config/conf/backup/backup_AREA2_TE.xml b/nsframework/backup_manager/config/conf/backup/backup_AREA2_TE.xml
new file mode 100755
index 0000000..f80637c
--- /dev/null
+++ b/nsframework/backup_manager/config/conf/backup/backup_AREA2_TE.xml
@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="D_BK_CA_VEHICLE_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_STABLE_DATA" id="0227" size="16"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_DRAMBKUP_DATA" id="0228" size="16"/>
+ </category>
+ <category name="D_BK_CA_DUMMYREAD_OFFSET" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DUMMYREAD_OFFSET" id="0229" size="512"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_PARAMETER" id="0230" size="4096"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_RESUME" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_MMCOM_RESUME" id="0231" size="53280"/>
+ <item name="D_BK_ID_MEDSRV_ITGP_RESUME" id="0274" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_DISC_RESUME" id="0275" size="1024"/>
+ <item name="D_BK_ID_MEDSRV__CWORD57__RESUME" id="0276" size="10656"/>
+ <item name="D_BK_ID_MEDSRV_BTA_RESUME" id="0277" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_SDVCOM_RESUME" id="0444" size="256"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEPARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEPARAM" id="0232" size="32"/>
+ <item name="D_BK_ID_REPROS_AUTO_UPDATE_CHECK" id="0372" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLID" id="0373" size="4"/>
+ <item name="D_BK_ID_REPROS_RESUME_TIME" id="0375" size="6"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_PCGVER" id="0376" size="4"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMING" id="0377" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMEOUT" id="0378" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLURL" id="0380" size="2048"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_INFO" id="0381" size="8192"/>
+ <item name="D_BK_ID_REPROS_CENTERCOMM_STATE" id="0382" size="1"/>
+ <item name="D_BK_ID_REPROS_NA07_HISTORY_INFO" id="0385" size="169192"/>
+ <item name="D_BK_ID_REPROS_NA05_DOWNLOAD_SIZE" id="0387" size="8"/>
+ <item name="D_BK_ID_REPROS_FILE_PATH_INFO" id="0399" size="1024"/>
+ <item name="D_BK_ID_REPROS_UPDATE_FILE_EXIST" id="0401" size="4"/>
+ <item name="D_BK_ID_REPROS_CHECKFORUPDATE_TIME" id="0404" size="4"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEHISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEHISTORY" id="0233" size="4096"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEINFO" id="0234" size="33792"/>
+ </category>
+ <category name="D_BK_CA_CLOCK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_CLOCK_OFFSET" id="0240" size="16"/>
+ <item name="D_BK_ID_CLOCK_STATE" id="0241" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_SYNC_OFFSET" id="0242" size="256"/>
+ </category>
+ <category name="D_BK_CA_DIAG_INFORMATION" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAG_INFORMATION" id="0244" size="2560"/>
+ </category>
+ <category name="D_BK_CA_VS_VSDSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_VSDSRV_PARAMETER" id="0246" size="4096"/>
+ </category>
+ <category name="D_BK_CA_VS_ACNSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_ACNSRV_PARAMETER" id="0247" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_ASYNC_GRP" id="0248" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_SYNC_GRP" id="0249" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_PARAMETER" id="0250" size="256"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_FIX_CNT" nand="true" cacheDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_FIX_CNT" id="0251" size="16"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_ROLLOVER_CNT" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_ROLLOVER_CNT" id="0253" size="32"/>
+ </category>
+ <category name="D_BK_CA_WLANM_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_WLANM_INFO" id="0254" size="1024"/>
+ </category>
+ <category name="D_BK_CA_BTSTK_LINKKEY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BTSTK_LINKKEY" id="0255" size="20480"/>
+ </category>
+ <category name="D_BK_CA_UPDSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_UPDSERVICE_PARAMETER" id="0257" size="4096"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_RCV" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_RCV" id="0259" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_GENERAL_GRP" id="0260" size="512"/>
+ </category>
+ <category name="D_BK_CA_INFS_CLOCK_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_CLOCK_GRP" id="0262" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_HOME_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_HOME_GRP" id="0263" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_GRP" id="0264" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_VOL" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_VOL" id="0265" size="64"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_GRP" id="0266" size="384"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_GRP" id="0269" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_SMARTAGENT_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_SMARTAGENT_GRP" id="0273" size="128"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_DISC_SETTING" id="0279" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_COM_SETTING" id="420" size="32"/>
+ </category>
+ <category name="D_BK_CA_GNDB_UPDATE_HISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GNDB_UPDATE_HISTORY" id="0281" size="400"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MEM" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_MEM" id="0282" size="9011200"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_EXTINFO" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_EXTINFO" id="0283" size="32"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_TRIPCNT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_TRIPCNT" id="0284" size="16"/>
+ </category>
+ <category name="D_BK_CA_PFDREC_FUNC" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_PFDREC_FUNC" id="0285" size="16"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_WORK_BUF" nand="false" backupDram="true" sync="false" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_WORK_BUF" id="0286" size="9068544"/>
+ </category>
+ <category name="D_BK_CA_AS__CWORD76_VOLUME" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_AS__CWORD76_VOLUME" id="0287" size="200"/>
+ </category>
+ <category name="D_BK_CA_KEYBOARD_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_KEYBOARD_PARAMETER" id="0296" size="8"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_DCMFLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_DCMFLAG" id="0302" size="8"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG" id="0303" size="2048"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_ACCON_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_ACCON_CDF" id="0304" size="2048"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG_CDF" id="0305" size="2048"/>
+ </category>
+ <category name="D_BK_CA_GRA_AMFMHD_CTRL" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_AMFMHD_STATION_LIST" id="0321" size="13168"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_LSM_DATA" id="0323" size="2048"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_SC_CONFIG_PARAMS" id="0324" size="64"/>
+ </category>
+ <category name="D_BK_CA_GRA_SDARS_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_STATION_LIST" id="0326" size="45056"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_CATEGORY_LIST" id="0327" size="7168"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SMS_CFG" id="0365" size="65536"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_RADIO_ID" id="0405" size="16"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SUBSCRIPTION_STATUS" id="0439" size="8"/>
+ </category>
+ <category name="D_BK_CA_DBG_FILTER_SET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DBG_FILTER_SET" id="0346" size="240"/>
+ </category>
+ <category name="D_BK_CA_DCM_CNCT_EN" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DCM_CNCT_EN" id="0347" size="4"/>
+ </category>
+ <category name="D_BK_CA_RS_RSDDS_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_RSDDS_STATS" id="0359" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_UPDATE_DB_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_UPDATE_DB_STATS" id="0360" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_HISTORY_LIST" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_HISTORY_LIST" id="0361" size="2804"/>
+ </category>
+ <category name="D_BK_CA_RS_WC_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WC_INFO" id="0362" size="400"/>
+ </category>
+ <category name="D_BK_CA_RS_VIDCM_DEPLOYMENT_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_VIDCM_DEPLOYMENT_INFO" id="0363" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_DEALER_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_DEALER_INFO" id="0384" size="712"/>
+ </category>
+ <category name="D_BK_CA_MODEMANAGER_LASTMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODEMANAGER_LASTMODE" id="0396" size="512"/>
+ </category>
+ <category name="D_BK_CA_ASS_PARAMETER" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ASS_PARAMETER" id="0406" size="26384"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_N" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_N" id="0407" size="16"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_D" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_D" id="0408" size="8"/>
+ </category>
+ <category name="D_BK_CA_VR_SYNC_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VR_INPUT_AUDIO_DUMP" id="0258" size="4"/>
+ <item name="D_BK_ID_VR_PVR_FLAG" id="0364" size="4"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_MANAGEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_MANAGEINFO" id="0409" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAG_DEVICEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAG_DEVICEINFO" id="0434" size="10240"/>
+ </category>
+ <category name="D_BK_CA_BT_PAIRING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_PAIRING" id="0435" size="102400"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_SHUT_DOWN" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_FORECAST" id="0221" size="153600"/>
+ <item name="D_BK_ID_DTSERVICE_COORDINATE" id="0223" size="128"/>
+ <item name="D_BK_ID_DTSERVICE_AFLIST" id="0224" size="1024"/>
+ <item name="D_BK_ID_DTSERVICE_DOPPLER" id="0225" size="73728"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_IMMIEDIATELY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_CITYDB" id="0220" size="113664"/>
+ <item name="D_BK_ID_DTSERVICE_SETUP" id="0222" size="64"/>
+ <item name="D_BK_ID_DTSERVICE_WEATHER_HISTORY" id="0226" size="1024"/>
+ </category>
+ <category name="D_BK_CA_TCS_LEARN_DICTIONARY" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_TCS_LEARN_DICTIONARY" id="437" size="2097152"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_INFO" id="0442" size="8"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL_IMM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_LIST" id="0325" size="22896"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER1_LIST" id="0366" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER2_LIST" id="0367" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER3_LIST" id="0368" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER4_LIST" id="0369" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER5_LIST" id="0370" size="10240"/>
+ </category>
+ <category name="D_BK_CA_CON_CWORD57__INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CON_CWORD57__INFO" id="0445" size="256"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_DRAM_OFFSET" id="0447" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_METSRV_PARAMETER" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VS_METSRV_PARAMETER" id="0448" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MASK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_MASK" id="0449" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__USER_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD27__SETTING" id="0457" size="1024"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__SHARED_RAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD27__CONNECTION_MODE" id="0456" size="1024"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_SETTING" id="0472" size="64"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_ODOMETER" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_ODOMETER" id="0473" size="8"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_DIAGMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_DIAGMODE" id="0474" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD28_AUTO_SHARED_RAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD28_AUTO_CONNECTION_MODE" id="0477" size="1024"/>
+ </category>
+ <category name="D_BK_CA__CWORD28_AUTO_USER_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD28_AUTO_SETTING" id="0478" size="1024"/>
+ </category>
+ <category name="D_BK_CA__CWORD24_" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD24_" id="0479" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_ASYNC_GRP" id="0480" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_SYNC" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_SYNC_GRP" id="0481" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_METER_TYPE" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_METER_TYPE" id="0483" size="1"/>
+ </category>
+ <category name="D_BK_CA_ADAS_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ADAS_SETTING" id="0484" size="512"/>
+ </category>
+</backup>
diff --git a/nsframework/backup_manager/config/createhdr.pl b/nsframework/backup_manager/config/createhdr.pl
new file mode 100755
index 0000000..c282f7b
--- /dev/null
+++ b/nsframework/backup_manager/config/createhdr.pl
@@ -0,0 +1,84 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+sub getlist($$)
+{
+ my $xmlfile = shift(@_);
+ my $xpath = shift(@_);
+
+ $xmlfile =~ s/([\[\]\*\(\)])/\\$1/g;
+
+ open(my $rs, "xmllint --xpath \"$xpath\" $xmlfile |") or die "Cannot open $xmlfile:$!";
+ my $result = join('', <$rs>);
+ close $rs;
+ $result =~ s/^ +//;
+ my @result_array = split(/ +/, $result);
+ return @result_array;
+}
+
+if ($#ARGV < 0 || !(-f $ARGV[0])) {
+ print "No such file or directory.\n";
+ exit 1;
+}
+
+my @item_array = getlist($ARGV[0], '//item/@name');
+
+print<<'HEADER';
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ns_backup_id.h
+ * @brief backup id define
+ */
+
+#ifndef BACKUP_MANAGER_CONFIG_NS_BACKUP_ID_H_
+#define BACKUP_MANAGER_CONFIG_NS_BACKUP_ID_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup backup_manager
+ * @ingroup native_service
+ * @{
+ */
+
+HEADER
+
+foreach my $item (@item_array) {
+ if ($item =~ /^name="(.+)"$/) {
+ printf("#define %s \"%s\"\n", $1, $1);
+ }
+ else {
+ print "Invalid input:$item\n";
+ exit 1;
+ }
+}
+
+print<<'FOOTER';
+
+/**@}*/ // end of backup_manager
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
+
+#endif // BACKUP_MANAGER_CONFIG_NS_BACKUP_ID_H_
+FOOTER
+
+0;
diff --git a/nsframework/backup_manager/config/sample.xml b/nsframework/backup_manager/config/sample.xml
new file mode 100755
index 0000000..cbf6c7a
--- /dev/null
+++ b/nsframework/backup_manager/config/sample.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="NandUnsync" nand="true" cacheDram="true" sync="false">
+ <item name="NandUnsync_001" id="1000" size="4491"/>
+ <item name="NandUnsync_002" id="1001" size="18752"/>
+ </category>
+ <category name="NandCycle" nand="true" cacheDram="true" sync="false" backupCycle="30">
+ <item name="NandCycle_001" id="2000" size="32231"/>
+ <item name="NandCycle_002" id="2001" size="8353"/>
+ </category>
+ <category name="NandSync" nand="true" cacheDram="false" sync="true">
+ <item name="NandSync_001" id="3000" size="25120"/>
+ <item name="NandSync_002" id="3001" size="18187"/>
+ </category>
+ <category name="BackupOnly" backupDram="true">
+ <item name="BackupOnly_001" id="4000" size="657"/>
+ <item name="BackupOnly_002" id="4001" size="526"/>
+ </category>
+ <category name="CacheOnly" cacheDram="true">
+ <item name="CacheOnly_001" id="5000" size="8694"/>
+ <item name="CacheOnly_002" id="5001" size="2051"/>
+ </category>
+</backup>
diff --git a/nsframework/backup_manager/config/uniqcheck.pl b/nsframework/backup_manager/config/uniqcheck.pl
new file mode 100755
index 0000000..1470d7c
--- /dev/null
+++ b/nsframework/backup_manager/config/uniqcheck.pl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my @checkxpath = ('//item/@name', '//item/@id', '//category/@name');
+
+sub uniqcheck($$)
+{
+ my $xpath = shift(@_);
+ my $list = shift(@_);
+ my %u = ();
+ foreach my $key (@{$list}) {
+ if (exists($u{$key})) {
+ print "detect duplicate $xpath $key\n";
+ exit 1;
+ }
+ $u{$key} = 1;
+ }
+}
+
+sub getlist($$)
+{
+ my $xmlfile = shift(@_);
+ my $xpath = shift(@_);
+
+ $xmlfile =~ s/([\[\]\*\(\)])/\\$1/g;
+
+ open(my $rs, "xmllint --xpath \"$xpath\" $xmlfile |") or die "Cannot open $xmlfile:$!";
+ my $result = join('', <$rs>);
+ close $rs;
+ $result =~ s/^ +//;
+ my @result_array = split(/ +/, $result);
+ return @result_array;
+}
+
+if ($#ARGV < 0 || !(-f $ARGV[0])) {
+ print "No such file or directory.\n";
+ exit 1;
+}
+
+foreach my $xpath (@checkxpath) {
+ my @result_array = getlist($ARGV[0], $xpath);
+ uniqcheck($xpath, \@result_array);
+}
+
+0;
diff --git a/nsframework/backup_manager/server/Makefile b/nsframework/backup_manager/server/Makefile
new file mode 100755
index 0000000..7f9fa39
--- /dev/null
+++ b/nsframework/backup_manager/server/Makefile
@@ -0,0 +1,67 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### programs to be installed #############
+INST_PROGS := NS_BackupMgr
+
+######### sources to be compiled #############
+NS_BackupMgr_SRCS := backupmanager_main.cpp \
+ bkup_process.cpp \
+ bkup_param.cpp \
+ bkup_crc32.cpp \
+ backupmanager_application.cpp
+
+######### search paths #############
+VPATH += ./src ./include ../client/include/$(COMPONENT_NAME)
+
+######### include paths #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I../client/include
+CPPFLAGS += -I$(SDKTARGETSYSROOT)/usr/include/libxml2
+
+######### frameworkunifiedlog options #############
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### libraries to be linked(dynamic)#############
+LDLIBS += -Wl,-Bdynamic \
+ -lSS_SystemIfUnified \
+ -lNS_FrameworkUnified \
+ -lxml2 \
+ -lrt \
+ -lnv_hal \
+ -lvp
+
+######### other unit specific options #############
+LINK_CXX=Y
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+install-data: install_data
+
+install_data:
+ install -d -m 755 $(DESTDIR)/nv/BS/ns/backup_manager/rwdata
+
+include ../../native_service.mk
diff --git a/nsframework/backup_manager/server/include/bkup_backupmanagerlog.h b/nsframework/backup_manager/server/include/bkup_backupmanagerlog.h
new file mode 100755
index 0000000..9df4a1c
--- /dev/null
+++ b/nsframework/backup_manager/server/include/bkup_backupmanagerlog.h
@@ -0,0 +1,80 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_SERVER_INCLUDE_BKUP_BACKUPMANAGERLOG_H_
+#define BACKUP_MANAGER_SERVER_INCLUDE_BKUP_BACKUPMANAGERLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_APP ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ZONE_ALSA ZONEMASK(103)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "StateMachine Example"
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_TEXT_103 "Api"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_APP, ZONE_ERR, ZONE_WARN, ZONE_INFO, ZONE_ALSA
+#endif
+
+extern const CHAR kAppName[];
+
+#endif // BACKUP_MANAGER_SERVER_INCLUDE_BKUP_BACKUPMANAGERLOG_H_
diff --git a/nsframework/backup_manager/server/include/bkup_crc32.h b/nsframework/backup_manager/server/include/bkup_crc32.h
new file mode 100755
index 0000000..132ffdc
--- /dev/null
+++ b/nsframework/backup_manager/server/include/bkup_crc32.h
@@ -0,0 +1,22 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_SERVER_INCLUDE_BKUP_CRC32_H_
+#define BACKUP_MANAGER_SERVER_INCLUDE_BKUP_CRC32_H_
+
+uint32_t BkupCrc32(const void *data, size_t length);
+
+#endif // BACKUP_MANAGER_SERVER_INCLUDE_BKUP_CRC32_H_
diff --git a/nsframework/backup_manager/server/include/bkup_param.h b/nsframework/backup_manager/server/include/bkup_param.h
new file mode 100755
index 0000000..0a2dbb1
--- /dev/null
+++ b/nsframework/backup_manager/server/include/bkup_param.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PARAM_H_
+#define BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PARAM_H_
+
+typedef struct {
+ int id;
+ int size;
+ void *opt;
+ bool nand;
+ bool cache_dram;
+ bool backup_dram;
+ bool sync;
+ bool encrypt;
+ int backup_cycle;
+ char category_name[64];
+} bkup_query_result_t;
+
+int BckupParamInit(void);
+
+int BkupParamGet(const char *item_name, bkup_query_result_t *result);
+int BkupParamGetNumid(uint32_t num_id, bkup_query_result_t *result, char *item_name, size_t item_name_size);
+void *BkupParamSetOpt(const char *item_name, void *opt);
+
+#endif // BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PARAM_H_
diff --git a/nsframework/backup_manager/server/include/bkup_process.h b/nsframework/backup_manager/server/include/bkup_process.h
new file mode 100755
index 0000000..72ac7e1
--- /dev/null
+++ b/nsframework/backup_manager/server/include/bkup_process.h
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PROCESS_H_
+#define BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PROCESS_H_
+
+#include <native_service/frameworkunified_types.h>
+
+EFrameworkunifiedStatus BkupHandler(HANDLE h_app);
+
+EFrameworkunifiedStatus bkup_power_handler(HANDLE hApp);
+EFrameworkunifiedStatus BkupInitHandler(HANDLE h_app);
+EFrameworkunifiedStatus BkupTerminateHandler(HANDLE h_app);
+
+void *BkupNandThread(void *arg);
+void *BkupDelayThread(void *arg);
+
+#endif // BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PROCESS_H_
diff --git a/nsframework/backup_manager/server/include/bkup_util.h b/nsframework/backup_manager/server/include/bkup_util.h
new file mode 100755
index 0000000..78494fa
--- /dev/null
+++ b/nsframework/backup_manager/server/include/bkup_util.h
@@ -0,0 +1,53 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_SERVER_INCLUDE_BKUP_UTIL_H_
+#define BACKUP_MANAGER_SERVER_INCLUDE_BKUP_UTIL_H_
+
+#include <sys/mman.h>
+#include <ctime>
+#include <cstring>
+
+static inline size_t BkupStrlcpy(char *dst, const char *src, size_t siz) {
+ size_t ret = strlen(src);
+ if (dst == NULL) {
+ return -1;
+ }
+ if (src == NULL) {
+ return -1;
+ }
+ if (siz) { // LCOV_EXCL_BR_LINE 6:double check
+ size_t len = (ret >= siz) ? siz - 1 : ret; // LCOV_EXCL_BR_LINE 11:unexpected branch
+ memcpy(dst, src, len);
+ dst[len] = '\0';
+ }
+ return ret;
+}
+
+static inline char *BkupAnonMmap(size_t size) {
+ char *map = static_cast<char *>(mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
+ return map;
+}
+
+static inline uint64_t BkupTimerReal(void) {
+ struct timespec ts;
+ if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts) != -1) { // LCOV_EXCL_BR_LINE 5:clock_gettime's error case.
+ return (uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec;
+ }
+ return -1;
+}
+
+#endif // BACKUP_MANAGER_SERVER_INCLUDE_BKUP_UTIL_H_
diff --git a/nsframework/backup_manager/server/src/backupmanager_application.cpp b/nsframework/backup_manager/server/src/backupmanager_application.cpp
new file mode 100755
index 0000000..c08e725
--- /dev/null
+++ b/nsframework/backup_manager/server/src/backupmanager_application.cpp
@@ -0,0 +1,277 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <native_service/ns_backup.h>
+#include <agl_thread.h>
+#include <system_service/ss_system_if.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <native_service/frameworkunified_multithreading.h>
+
+#include <nv_hal.h>
+#include <signal.h>
+#include <cerrno>
+#include <cstdio>
+#include "bkup_api.h"
+#include "bkup_param.h"
+#include "bkup_backupmanagerlog.h"
+#include "bkup_process.h"
+
+pthread_t g_work_thread_id = 0;
+pthread_t g_delay_thread_id = 0;
+pthread_t g_nand_thread_id = 0;
+HANDLE g_msg_handle_thread = NULL;
+
+typedef void (* signal_handler)(int);
+
+void SignalHandlerFuncForMsgHandleThread(int signum) {
+ pthread_exit(0);
+}
+
+EFrameworkunifiedStatus MsgHandleThreadStart(HANDLE h_app) {
+ signal_handler p_signal = SignalHandlerFuncForMsgHandleThread;
+ signal(SIGUSR1, p_signal);
+
+ g_work_thread_id = pthread_self();
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedAttachCallbackToDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, BACKUP_CID, BkupHandler)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedAttachCallbacksToDispatcher e_status:%d\n", e_status);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ return e_status;
+}
+
+EFrameworkunifiedStatus MsgHandleThreadStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ pthread_attr_t t_attr;
+ pthread_t t;
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedRegisterServiceAvailabilityNotification(h_app, NTFY_BackupMgr_Availability)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedRegisterServiceAvailabilityNotification e_status:%d\n", e_status);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ if (pthread_attr_init(&t_attr) < 0) { // LCOV_EXCL_BR_LINE 5:pthread_attr_init's error case.
+ // LCOV_EXCL_START 5:pthread_attr_init's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_attr_init:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5:pthread_attr_init's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5:pthread_attr_setinheritsched's error case.
+ if (pthread_attr_setinheritsched(&t_attr, PTHREAD_INHERIT_SCHED) < 0) {
+ // LCOV_EXCL_BR_STOP 5:pthread_attr_setinheritsched's error case.
+ // LCOV_EXCL_START 5:pthread_attr_setinheritsched's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_attr_setinheritsched:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5:pthread_attr_setinheritsched's error case.
+ }
+
+ if (pthread_create(&t, &t_attr, BkupNandThread, NULL) < 0) { // LCOV_EXCL_BR_LINE 5:pthread_create's error case.
+ // LCOV_EXCL_START 5:pthread_create's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_create:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5:pthread_create's error case.
+ }
+
+ if (pthread_create(&t, &t_attr, BkupDelayThread, NULL) < 0) { // LCOV_EXCL_BR_LINE 5:pthread_create's error case.
+ // LCOV_EXCL_START 5:pthread_create's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_create:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5:pthread_create's error case.
+ }
+
+ e_status = InitNv();
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "InitNv e_status:%d", e_status);
+ exit(EXIT_FAILURE);
+ }
+
+ if (BckupParamInit() < 0) { // LCOV_EXCL_BR_LINE 5:C API's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ exit(EXIT_FAILURE); // LCOV_EXCL_LINE 5:C API's error case.
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedAttachCallbackToDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, BACKUP_CID, BkupHandler)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedAttachCallbacksToDispatcher e_status:%d\n", e_status);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+
+ g_msg_handle_thread = FrameworkunifiedCreateChildThread(h_app, SERVICE_BACKUP_MANAGER_MSG_HANDLE_THREAD, MsgHandleThreadStart, MsgHandleThreadStop); // LCOV_EXCL_BR_LINE 11:Unexpected branch // NOLINT (whitespace/line_length)
+ if (g_msg_handle_thread == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 4: NSFW error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Fail to create SERVICE_BACKUP_MANAGER_MSG_HANDLE_THREAD");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ if (eFrameworkunifiedStatusOK != (e_status = FrameworkunifiedStartChildThread(h_app, g_msg_handle_thread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT (whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start SERVICE_BACKUP_MANAGER_MSG_HANDLE_THREAD. Status:%#x", e_status); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT (whitespace/line_length)
+ }
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedSubscribeNotificationWithCallback(h_app,
+ NTFY_SSSystemMgrPowerOnOff,
+ bkup_power_handler)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSubscribeNotificationWithCallback eStatus:%d", e_status); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT (whitespace/line_length)
+ }
+
+ e_status = BkupInitHandler(h_app); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedPublishServiceAvailability(h_app, TRUE)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedPublishServiceAvailability e_status:%d\n", e_status);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ return e_status;
+}
+
+// LCOV_EXCL_START 14 Resident process, not called by NSFW
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 14 Resident process, not called by NSFW
+
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = BkupTerminateHandler(h_app);
+
+ if (FrameworkunifiedPublishServiceAvailability(h_app, FALSE) != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 15:marco defined in "native_service/ns_logger_if.h"
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedPublishServiceAvailability fail\n");
+ // LCOV_EXCL_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if (eFrameworkunifiedStatusOK == (FrameworkunifiedStopChildThread(h_app, g_msg_handle_thread, 0, NULL))) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ FrameworkunifiedDestroyChildThread(h_app, g_msg_handle_thread);
+ g_msg_handle_thread = NULL;
+ }
+
+ int ret2 = pthread_kill(g_work_thread_id, SIGUSR1);
+ if (ESRCH == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "thread is already exit !");
+ } else if (EINVAL == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "signal is invalid !");
+ } else {
+ pthread_join(g_work_thread_id, NULL);
+ }
+
+ ret2 = pthread_kill(g_nand_thread_id, SIGUSR1);
+ if (ESRCH == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "thread is already exit !");
+ } else if (EINVAL == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "signal is invalid !");
+ } else {
+ pthread_join(g_nand_thread_id, NULL);
+ }
+
+ ret2 = pthread_kill(g_delay_thread_id, SIGUSR1);
+ if (ESRCH == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "thread is already exit !");
+ } else if (EINVAL == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "signal is invalid !");
+ } else {
+ pthread_join(g_delay_thread_id, NULL);
+ }
+
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 7:debug code
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 7:debug code
diff --git a/nsframework/backup_manager/server/src/backupmanager_main.cpp b/nsframework/backup_manager/server/src/backupmanager_main.cpp
new file mode 100755
index 0000000..f225524
--- /dev/null
+++ b/nsframework/backup_manager/server/src/backupmanager_main.cpp
@@ -0,0 +1,61 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <native_service/ns_version_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <agl_thread.h>
+#include <system_service/ss_system_if.h>
+#include <cerrno>
+#include <cstdio>
+#include "bkup_backupmanagerlog.h"
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(0, 0, 0); // NOLINT(readability/nolint).
+
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { // NOLINT(readability/nolint) The varable is used by FW
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+int main(int argc, char *argv[]) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ FrameworkunifiedDefaultCallbackHandler cb_funcs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cb_funcs);
+ FRAMEWORKUNIFIED_SET_ZONES();
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ EFrameworkunifiedStatus e_status = FrameworkunifiedDispatcherWithArguments(MN_NS_BACKUPMGR, argc, argv, &cb_funcs);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedDispatcherWithArguments: %d", e_status);
+ return EXIT_FAILURE;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ return EXIT_SUCCESS;
+} // LCOV_EXCL_BR_LINE 10:The final line
diff --git a/nsframework/backup_manager/server/src/bkup_crc32.cpp b/nsframework/backup_manager/server/src/bkup_crc32.cpp
new file mode 100755
index 0000000..f1d8449
--- /dev/null
+++ b/nsframework/backup_manager/server/src/bkup_crc32.cpp
@@ -0,0 +1,62 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstdio>
+#include "bkup_crc32.h"
+#include "bkup_util.h"
+
+/*
+ * CRC-32C lookup table
+ *
+ * Polynomial 0x1EDC6F41
+ */
+static const uint32_t kBkupCrc32Lookup[4][256] = {
+ {
+ },
+ {
+ },
+ {
+ },
+ {
+ }
+};
+
+/**
+ * compute CRC-32C (Slicing-by-4)
+ */
+uint32_t BkupCrc32(const void *data, size_t length) {
+ uint32_t crc = 0xFFFFFFFF;
+ const uint32_t *current = (const uint32_t *)data;
+
+ if (data == NULL) {
+ return -1;
+ }
+ while (length >= 4) {
+ uint32_t one = *current++ ^ crc;
+ crc = kBkupCrc32Lookup[0][(one >> 24) & 0xFF] ^
+ kBkupCrc32Lookup[1][(one >> 16) & 0xFF] ^
+ kBkupCrc32Lookup[2][(one >> 8) & 0xFF] ^
+ kBkupCrc32Lookup[3][one & 0xFF];
+ length -= 4;
+ }
+
+ const uint8_t *current_char = (const uint8_t *)current;
+ while (length-- > 0) {
+ crc = (crc >> 8) ^ kBkupCrc32Lookup[0][(crc & 0xFF) ^ *current_char++];
+ }
+
+ return ~crc;
+}
diff --git a/nsframework/backup_manager/server/src/bkup_param.cpp b/nsframework/backup_manager/server/src/bkup_param.cpp
new file mode 100755
index 0000000..900779b
--- /dev/null
+++ b/nsframework/backup_manager/server/src/bkup_param.cpp
@@ -0,0 +1,447 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <other_service/VP_GetEnv.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <libxml/xmlerror.h>
+#include <libxml/parser.h>
+#include <libxml/SAX2.h>
+#include <inttypes.h>
+#include <cerrno>
+#include <cstdio>
+#include <string>
+#include <map>
+#include <utility>
+#include "bkup_param.h"
+#include "bkup_backupmanagerlog.h"
+#include "bkup_util.h"
+
+#define BKUP_XML_PATH_MAX 100
+#define BKUP_XML_PATH "/usr/agl/conf/BS/ns/backup_manager/rodata/"
+#define BKUP_XML_PREFIX "backup_"
+#define BKUP_XML_EXTENSION ".xml"
+
+#define BKUP_AREA_1 "AREA1"
+#define BKUP_AREA_2 "AREA2"
+#define BKUP_BRAND_1 "BRAND1"
+#define BKUP_BRAND_2 "BRAND2"
+#define BKUP_GRADE_1 "GRADE1"
+#define BKUP_GRADE_2 "GRADE2"
+#define BKUP_DESTINATION_TYPE_AREA1_TE "AREA1_TE"
+#define BKUP_DESTINATION_TYPE_AREA1_L "AREA1_L"
+#define BKUP_DESTINATION_TYPE_AREA2_T "AREA2_T"
+#define BKUP_DESTINATION_TYPE_AREA2_TE "AREA2_TE"
+
+#define BKUP_DESTINATION_STR_MAX 10
+typedef struct {
+ char area[VP_MAX_LENGTH];
+ char brand[VP_MAX_LENGTH];
+ char grade[VP_MAX_LENGTH];
+ char destination[BKUP_DESTINATION_STR_MAX];
+} BkupDestinationTbl;
+
+const BkupDestinationTbl kDestinationTbl[] = {
+ // Destination:Area1
+ {BKUP_AREA_1, BKUP_BRAND_1, BKUP_GRADE_1, BKUP_DESTINATION_TYPE_AREA1_TE},
+ {BKUP_AREA_1, BKUP_BRAND_1, BKUP_GRADE_2, BKUP_DESTINATION_TYPE_AREA1_TE},
+ {BKUP_AREA_1, BKUP_BRAND_2, BKUP_GRADE_1, BKUP_DESTINATION_TYPE_AREA1_L},
+ {BKUP_AREA_1, BKUP_BRAND_2, BKUP_GRADE_2, BKUP_DESTINATION_TYPE_AREA1_L},
+ // Destination:Area2
+ {BKUP_AREA_2, BKUP_BRAND_1, BKUP_GRADE_1, BKUP_DESTINATION_TYPE_AREA2_TE},
+ {BKUP_AREA_2, BKUP_BRAND_1, BKUP_GRADE_2, BKUP_DESTINATION_TYPE_AREA2_TE},
+ {BKUP_AREA_2, BKUP_BRAND_2, BKUP_GRADE_1, BKUP_DESTINATION_TYPE_AREA2_T},
+ {BKUP_AREA_2, BKUP_BRAND_2, BKUP_GRADE_2, BKUP_DESTINATION_TYPE_AREA2_T},
+};
+
+typedef std::string Category;
+typedef struct {
+ bool nand;
+ bool cache_dram;
+ bool backup_dram;
+ bool sync;
+ bool encrypt;
+ int backup_cycle;
+} CategoryProperty;
+typedef std::map<Category, CategoryProperty> CategoryTable;
+
+typedef std::string Item;
+typedef struct {
+ int id;
+ int size;
+ void *opt;
+ Category category;
+} ItemProperty; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+typedef std::map<Item, ItemProperty> ItemTable;
+typedef std::map<int, Item> IdTable;
+
+typedef struct {
+ Category current;
+ CategoryTable category_table;
+ ItemTable item_table;
+ IdTable id_table;
+} BackupParams; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+static BackupParams *g_backup_params = NULL;
+
+static void StartElementNs(void *ctx, const xmlChar *localname,
+ const xmlChar *prefix, const xmlChar *uri,
+ int nb_namespaces, const xmlChar **namespaces,
+ int nb_attributes, int nb_defaulted,
+ const xmlChar **attributes) {
+ if (ctx == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "ctx is NULL");
+ return;
+ }
+ if (localname == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "localname is NULL");
+ return;
+ }
+ BackupParams *p_backup_params = static_cast<BackupParams *>(ctx);
+ std::string tag = (const char *)localname; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (tag.compare("backup") == 0) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // do nothing
+ } else if (tag.compare("category") == 0) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ CategoryProperty category_attr = {false, false, false, false, false, 0};
+ std::string category_name; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ for (int i = 0; i < nb_attributes; i++) {
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ std::string localname = (const char *)attributes[i * 5];
+ std::string value((const char *)attributes[i * 5 + 3], (const char *)attributes[i * 5 + 4]);
+ if (localname.compare("name") == 0) {
+ category_name = value;
+ } else if (localname.compare("nand") == 0) {
+ if (value.compare("true") == 0) {
+ category_attr.nand = true;
+ }
+ } else if (localname.compare("backupDram") == 0) {
+ if (value.compare("true") == 0) {
+ category_attr.backup_dram = true;
+ }
+ } else if (localname.compare("cacheDram") == 0) {
+ if (value.compare("true") == 0) {
+ category_attr.cache_dram = true;
+ }
+ } else if (localname.compare("sync") == 0) {
+ if (value.compare("true") == 0) {
+ category_attr.sync = true;
+ }
+ } else if (localname.compare("encrypt") == 0) {
+ if (value.compare("true") == 0) {
+ category_attr.encrypt = true;
+ }
+ } else if (localname.compare("backupCycle") == 0) {
+ category_attr.backup_cycle = atoi(value.c_str());
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Unknown attribute:%s", localname.c_str());
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ }
+
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ CategoryTable::iterator c_it = p_backup_params->category_table.find(category_name);
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ if (c_it != p_backup_params->category_table.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_START 200:Execute in server start period
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "duplicate category:%s", category_name.c_str());
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 200:Execute in server start period
+ }
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ p_backup_params->category_table.insert(std::make_pair(category_name, category_attr));
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ p_backup_params->current = category_name; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ } else if (tag.compare("item") == 0) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (p_backup_params->current.compare("") == 0) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_START 200:Execute in server start period
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Detect item before category");
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 200:Execute in server start period
+ }
+
+ ItemProperty item_property = {0, 0, NULL, p_backup_params->current}; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ std::string item_name; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ for (int i = 0; i < nb_attributes; i++) {
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ std::string localname = (const char *)attributes[i * 5];
+ std::string value((const char *)attributes[i * 5 + 3], (const char *)attributes[i * 5 + 4]);
+ if (localname.compare("name") == 0) {
+ item_name = value;
+ } else if (localname.compare("id") == 0) {
+ item_property.id = atoi(value.c_str());
+ } else if (localname.compare("size") == 0) {
+ item_property.size = atoi(value.c_str());
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Unknown attribute:%s", localname.c_str());
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ }
+
+ ItemTable::iterator i_it = p_backup_params->item_table.find(item_name); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (i_it != p_backup_params->item_table.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_START 200:Execute in server start period
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Duplicate item:%s", item_name.c_str());
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 200:Execute in server start period
+ }
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ p_backup_params->item_table.insert(std::make_pair(item_name, item_property));
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+
+ IdTable::iterator id_it = p_backup_params->id_table.find(item_property.id); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (id_it != p_backup_params->id_table.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_START 200:Execute in server start period
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Duplicate id:%d", item_property.id);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 200:Execute in server start period
+ }
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ p_backup_params->id_table.insert(std::make_pair(item_property.id, item_name));
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Unknown tag:%s", localname);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+}
+
+static int BkupGetXmlPath(char* path) {
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6:Excluded as no NULL is currently passed
+ // LCOV_EXCL_START 6:Excluded as no NULL is currently passed
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "path is NULL");
+ return -1;
+ // LCOV_EXCL_STOP 6:Excluded as no NULL is currently passed
+ }
+ memset(path, 0, BKUP_XML_PATH_MAX);
+ char param_area[VP_MAX_LENGTH] = "";
+ VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_AREA, param_area);
+ char param_brand[VP_MAX_LENGTH] = "";
+ VP_GetEnv(VEHICLEPARAMETERLIBRARY_BRAND, param_brand);
+ char param_grade[VP_MAX_LENGTH] = "";
+ VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_GRADE, param_grade);
+
+ bool is_match = false;
+ for (uint16_t i = 0; i < _countof(kDestinationTbl); i++) {
+ size_t area_size = static_cast<size_t>(std::string(kDestinationTbl[i].area).size());
+ // Check vehicle parameter settings (For VP_VEHICLEPARAMETERLIBRALY_AREA only, check the area size of tbl to check the character strings common to each area)
+ if ((strncmp(param_area, kDestinationTbl[i].area, area_size) == 0) &&
+ (strncmp(param_brand, kDestinationTbl[i].brand, sizeof(param_area)) == 0) &&
+ (strncmp(param_grade, kDestinationTbl[i].grade, sizeof(param_area)) == 0)) {
+ is_match = true;
+ snprintf(path, BKUP_XML_PATH_MAX, "%s%s%s%s", BKUP_XML_PATH, BKUP_XML_PREFIX,
+ kDestinationTbl[i].destination, BKUP_XML_EXTENSION);
+ break;
+ }
+ }
+ if (is_match == false) {
+ // If the destination settings do not match, set the AREA2_T path as failsafe
+ snprintf(path, BKUP_XML_PATH_MAX, "%s%s%s%s", BKUP_XML_PATH, BKUP_XML_PREFIX,
+ BKUP_DESTINATION_TYPE_AREA2_T, BKUP_XML_EXTENSION);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Unexpected VP area[%s] brand[%s] grade[%s]",
+ param_area, param_brand, param_grade);
+ }
+ return 0;
+}
+
+int BckupParamInit(void) {
+ int ret = -1;
+ xmlParserCtxtPtr xmlctx;
+ xmlSAXHandler saxh;
+ xmlDocPtr doc;
+ int fd = -1;
+ struct stat sb;
+ char *map = NULL;
+ uint64_t start, end;
+
+ g_backup_params = new BackupParams; // LCOV_EXCL_BR_LINE 11:except,C++ operator
+
+ LIBXML_TEST_VERSION // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ xmlInitParser(); // NOLINT(readability/nolint) Defined in library of libxml
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+
+ memset(&saxh, 0, sizeof(saxh));
+ saxh.initialized = XML_SAX2_MAGIC;
+ saxh.startElementNs = StartElementNs;
+
+ xmlctx = xmlCreatePushParserCtxt(&saxh, g_backup_params, NULL, 0, NULL); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ char xml_path[BKUP_XML_PATH_MAX] = {0};
+ ret = BkupGetXmlPath(xml_path);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6:Excluded because the return value does not cause an error
+ // LCOV_EXCL_START 6:Excluded because the return value does not cause an error
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "BkupGetXmlPath Error");
+ goto exit;
+ // LCOV_EXCL_STOP 6:Excluded because the return value does not cause an error
+ }
+
+ if ((fd = open(xml_path, O_RDONLY)) < 0) { // LCOV_EXCL_BR_LINE 5:open's error case.
+ // LCOV_EXCL_START 5:open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "open:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5:open's error case.
+ }
+ if (fstat(fd, &sb) < 0) { // LCOV_EXCL_BR_LINE 5:fstat's error case.
+ // LCOV_EXCL_START 5:fstat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "fstat:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5:fstat's error case.
+ }
+ map = reinterpret_cast<char *>(mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0));
+ if (map == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ start = BkupTimerReal();
+ if (xmlParseChunk(xmlctx, map, static_cast<int>(sb.st_size), 1)) { // LCOV_EXCL_BR_LINE 5:xmlParseChunk's error case.
+ // LCOV_EXCL_START 5:xmlParseChunk's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ xmlParserError(xmlctx, "xmlParseChunk");
+ goto exit;
+ // LCOV_EXCL_STOP 5:xmlParseChunk's error case.
+ }
+ end = BkupTimerReal();
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "spent:%" PRIu64 ".%06" PRIu64 "ms",
+ static_cast<uint64_t>((end - start) / 1000000),
+ static_cast<uint64_t>((end - start) % 1000000));
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+
+ doc = xmlctx->myDoc;
+ xmlFreeParserCtxt(xmlctx); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ xmlFreeDoc(doc); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ xmlCleanupParser(); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ret = 0;
+
+exit:
+ if (fd >= 0) { // LCOV_EXCL_BR_LINE 5:open's error case.
+ if (close(fd) < 0) { // LCOV_EXCL_BR_LINE 5:close's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, "close:%s", strerror(errno)); // LCOV_EXCL_LINE 5:close's error case.
+ }
+ }
+ if (map) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ if (munmap(map, sb.st_size) < 0) { // LCOV_EXCL_BR_LINE 5:munmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, "munmap:%s", strerror(errno)); // LCOV_EXCL_LINE 5:munmap's error case.
+ }
+ }
+ return ret;
+}
+
+int BkupParamGet(const char *item_name, bkup_query_result_t *result) {
+ if (g_backup_params == NULL) { // LCOV_EXCL_BR_LINE 6:g_backup_params will not be NULL
+ // LCOV_EXCL_START 6:g_backup_params will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Uninitialize call");
+ return -1;
+ // LCOV_EXCL_STOP 6:g_backup_params will not be NULL
+ }
+ if (result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "result is NULL");
+ return -1;
+ }
+ ItemTable::iterator item_it = g_backup_params->item_table.find(item_name); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (item_it == g_backup_params->item_table.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ return -1;
+ }
+
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ CategoryTable::iterator category_it = g_backup_params->category_table.find(item_it->second.category);
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ if (category_it == g_backup_params->category_table.end()) { // LCOV_EXCL_BR_LINE 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 6:double check
+ }
+
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ result->id = item_it->second.id;
+ result->size = item_it->second.size;
+ result->opt = item_it->second.opt;
+ result->nand = category_it->second.nand;
+ result->cache_dram = category_it->second.cache_dram;
+ result->backup_dram = category_it->second.backup_dram;
+ result->sync = category_it->second.sync;
+ result->encrypt = category_it->second.encrypt;
+ result->backup_cycle = category_it->second.backup_cycle;
+ BkupStrlcpy(result->category_name, item_it->second.category.c_str(), sizeof(result->category_name));
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+
+ return 0;
+}
+
+int BkupParamGetNumid(uint32_t num_id, bkup_query_result_t *result,
+ char *item_name, size_t item_name_size) {
+ if (g_backup_params == NULL) { // LCOV_EXCL_BR_LINE 6:g_backup_params will not be NULL
+ // LCOV_EXCL_START 6:g_backup_params will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Uninitialize call");
+ return -1;
+ // LCOV_EXCL_STOP 6:g_backup_params will not be NULL
+ }
+
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ IdTable::iterator id_it = g_backup_params->id_table.find(static_cast<int>(num_id));
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ if (id_it == g_backup_params->id_table.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ return -1;
+ }
+ BkupStrlcpy(item_name, id_it->second.c_str(), item_name_size); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ return BkupParamGet(id_it->second.c_str(), result); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+}
+
+void *BkupParamSetOpt(const char *item_name, void *opt) {
+ if (g_backup_params == NULL) { // LCOV_EXCL_BR_LINE 6:g_backup_params will not be NULL
+ // LCOV_EXCL_START 6:g_backup_params will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Uninitialize call");
+ return reinterpret_cast<void *>((-1));
+ // LCOV_EXCL_STOP 6:g_backup_params will not be NULL
+ }
+
+ ItemTable::iterator item_it = g_backup_params->item_table.find(item_name); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (item_it == g_backup_params->item_table.end()) { // LCOV_EXCL_BR_LINE 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return reinterpret_cast<void *>((-1)); // LCOV_EXCL_LINE 6:double check
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ return __sync_val_compare_and_swap(&item_it->second.opt, NULL, opt); // NOLINT(readability/nolint) Supplied by gcc
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+}
diff --git a/nsframework/backup_manager/server/src/bkup_process.cpp b/nsframework/backup_manager/server/src/bkup_process.cpp
new file mode 100755
index 0000000..f8032ef
--- /dev/null
+++ b/nsframework/backup_manager/server/src/bkup_process.cpp
@@ -0,0 +1,2497 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <inttypes.h>
+#include <mqueue.h>
+#include <agl_thread.h>
+#include <poll.h>
+#include <signal.h>
+#include <sys/epoll.h>
+#include <sys/eventfd.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/timerfd.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_system_manager_if.h>
+#include <nv_hal.h>
+#include <aglpath.h>
+#include <cerrno>
+#include <cstdio>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include "bkup_api.h"
+#include "bkup_backupmanagerlog.h"
+#include "bkup_param.h"
+#include "bkup_crc32.h"
+#include "bkup_util.h"
+
+#define BKUP_THREAD_NAND "NS_BkupNAND"
+#define BKUP_THREAD_DELAY "NS_BkupDelay"
+const char kBkupPrexixEncryption[] = "ENC_";
+const size_t kBkupPrexixEncryptionSize = 4;
+
+typedef void (* signal_handler)(int);
+extern void SignalHandlerFuncForMsgHandleThread(int signum);
+extern pthread_t g_delay_thread_id;
+extern pthread_t g_nand_thread_id;
+
+#define MAX_FD_EPOLL 8
+
+/**
+ * internal state
+ */
+typedef enum {
+ BKUP_STATE_INIT = 0,
+ BKUP_STATE_NORMAL,
+ BKUP_STATE_TERM,
+} bkup_state_t;
+static bkup_state_t g_bkup_internal_state = BKUP_STATE_INIT;
+
+
+/**
+ * delay thread command
+ */
+typedef enum {
+ BKUP_DELAY_CMD_TERM = 0,
+ BKUP_DELAY_CMD_PRE_ACCOFF,
+ BKUP_DELAY_CMD_REGIST,
+} bkup_delay_cmd_t;
+
+
+/**
+ * inter thread communication message
+ */
+typedef union {
+ struct {
+ char client_name[16];
+ uint32_t seq_id;
+ char *rcv_buf;
+ int rcv_size;
+ } nand;
+ struct {
+
+// bool terminate;
+ bkup_delay_cmd_t cmd;
+
+ int event_fd;
+ char item_name[64];
+ } delay;
+} bkup_itc_message_t;
+
+/**
+ * reference response function
+ */
+typedef struct {
+ int (*set_response)(void *, void *, int, EFrameworkunifiedStatus);
+ void *opt;
+} bkup_response_t;
+
+/**
+ * response MQ map(TLS)
+ */
+typedef std::map<std::string, HANDLE> g_bkup_response_mq_t;
+static __thread g_bkup_response_mq_t *g_bkup_response_mq;
+
+/**
+ * NAND thread itc MQ
+ */
+static mqd_t g_bkup_nand_mqd = -1;
+
+/**
+ * Delay thread itc MQ
+ */
+static mqd_t g_bkup_delay_mqd = -1;
+
+static int g_bkup_nand_tid;
+static int g_bkup_delay_tid;
+
+/**
+ * prototype declared
+ */
+static void BkupApilog(bkup_response_t *response, enum NvHalMedia current_media,
+ bkup_protocol_header_t *hdr,
+ bkup_query_result_t *query_result, char *buf,
+ uint32_t crc32, EFrameworkunifiedStatus ret_value);
+
+/**
+ * check status of file spicefied by path
+ */
+static int BkupCheckStatFromNv(enum NvHalMedia media, const char *path,
+ int check_size);
+
+/**
+ * rwlock unlock
+ */
+static inline void BkupRwlockUnlock(pthread_rwlock_t *rwlock, const char *path);
+
+/**
+ * rwlock read lock
+ */
+static inline void BkupRwlockRdlock(pthread_rwlock_t *rwlock, const char *path);
+
+/**
+ * rwlock write lock
+ */
+static inline void BkupRwlockWrlock(pthread_rwlock_t *rwlock, const char *path);
+
+/**\ingroup CheckNv
+ * \~english @par Brief
+ * Check the data stored on the storage device and check the data size.
+ * \~english @param [in] media
+ * enum NvHalMedia - Media type
+ * \~english @param [in] filename
+ * const char* - Concatenated string of "category name/item name"
+ * \~english @param [in] size
+ * uint32_t - Data size to be checked
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusFileLoadError The file does not exist.
+ * \~english @retval eFrameworkunifiedStatusAccessError Check size failed
+ * \~english @retval eFrameworkunifiedStatusInvldParam Parameter error
+ * \~english @par Preconditons
+ * - none
+ * \~english @par Conditions of processing failure
+ * - If the media (media) specified in the parameter is smaller than NVHALMEDIA_CACHEDRAM or larger than NVHALMEDIA_NAND.\n
+ * [eFrameworkunifiedStatusInvldParam]
+ * - The identifier specified in the arguments is a NULL.[eFrameworkunifiedStatusInvldParam]
+ * - When the size specified in the arguments is 0.[eFrameworkunifiedStatusInvldParam]
+ * - Internal I/O handling errors (lstat).[eFrameworkunifiedStatusFileLoadError]
+ * - The size specified by the parameter does not correspond to the file size specified by the identifier.[eFrameworkunifiedStatusAccessError]
+ */
+static EFrameworkunifiedStatus CheckNv(enum NvHalMedia media, const char *filename, uint32_t size) {
+ uint32_t size_;
+ EFrameworkunifiedStatus ret;
+ ret = GetSizeNv(media, filename, &size_); // Get size
+ if (ret != eFrameworkunifiedStatusOK) { // If the GetSizeNv fails, the error is returned unchanged.
+ return ret;
+ }
+ if (size_ != size) { // Returns eFrameworkunifiedStatusAccessError if the sizes do not match.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid size:%d\n", size);
+ return eFrameworkunifiedStatusAccessError;
+ }
+ return eFrameworkunifiedStatusOK; // Returns eFrameworkunifiedStatusOK if size matches
+}
+
+
+
+/**
+ * read file spicefied by id
+ *
+ * \retval 0 read success
+ * \retval -1 crc error
+ * \retval -2 read failed
+ * \retval -3 invalid param
+ */
+static int32_t BkupBufferReadFromNv(const enum NvHalMedia media, const char* path,
+ char *buf, size_t size, uint32_t *crc32) {
+ int32_t ret = 0;
+ EFrameworkunifiedStatus nv_ret = eFrameworkunifiedStatusFail;
+ const uint32_t size_all = static_cast<uint32_t>(size + sizeof(uint32_t));
+ void* buffer = MAP_FAILED;
+ uint8_t* read_buffer = NULL;
+ uint32_t calc_crc32, get_crc32;
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 6:double check
+ }
+
+ if (!buf) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "buf is NULL");
+ return -1;
+ }
+ if ((buffer = BkupAnonMmap(size_all)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:map failed");
+ ret = -1;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ read_buffer = reinterpret_cast<uint8_t*>(buffer);
+ nv_ret = ReadNv(media, path, read_buffer, size_all);
+ if (nv_ret == eFrameworkunifiedStatusOK) {
+ const void* const src_buffer = reinterpret_cast<void *>(read_buffer + size);
+ void* dest_buffer = reinterpret_cast<void *>(&get_crc32);
+ memcpy(dest_buffer, src_buffer, sizeof(uint32_t));
+ calc_crc32 = BkupCrc32(read_buffer, size); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (get_crc32 != calc_crc32) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "invalid crc(%s):%#x:%#x", path, get_crc32, calc_crc32);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = -1;
+ goto exit;
+ }
+ if (crc32 != NULL) {
+ *crc32 = get_crc32;
+ }
+ dest_buffer = reinterpret_cast<void *>(buf);
+ memcpy(dest_buffer, buffer, size);
+ } else if (nv_ret == eFrameworkunifiedStatusInvldParam) { // LCOV_EXCL_BR_LINE 6:double check
+ ret = -3;
+ } else {
+ ret = -2;
+ }
+exit:
+ if (buffer != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ munmap(buffer, size_all);
+ }
+
+ return ret;
+}
+
+/*
+ * buffer -> file write
+ */
+static int32_t BkupBufferWriteToNv(const enum NvHalMedia media, const char* path,
+ char *buf, size_t size, uint32_t *crc32) {
+ if (buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "buf is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ int32_t ret = 0;
+ EFrameworkunifiedStatus nv_ret = eFrameworkunifiedStatusFail;
+ const uint32_t size_all = static_cast<uint32_t>(size + sizeof(uint32_t));
+ char *buffer = reinterpret_cast<char *>(MAP_FAILED);
+ uint32_t calc_crc32;
+
+ if ((buffer = BkupAnonMmap(size_all)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ ret = -1;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ calc_crc32 = BkupCrc32(buf, size); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (crc32) {
+ *crc32 = calc_crc32;
+ }
+
+ memcpy(buffer, buf, size);
+ memcpy(buffer + size, &calc_crc32, sizeof(uint32_t));
+
+ nv_ret = WriteNv(media, path, reinterpret_cast<uint8_t *>(buffer), size_all);
+ if (nv_ret != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "write to nv(%s):%s", path, strerror(ret));
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = -1;
+ }
+
+exit:
+ if (buffer != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ munmap(buffer, size_all);
+ }
+
+ return ret;
+}
+
+/**
+ * inter media copy
+ */
+static int BkupMediaCopyFromNv(char *category_name, const char *item_name,
+ enum NvHalMedia src, enum NvHalMedia dst,
+ pthread_rwlock_t *src_rwlock,
+ pthread_rwlock_t *dst_rwlock) {
+ if (category_name == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "category_name is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ if (item_name == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "item_name is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ int ret = -1;
+ uint32_t crc32;
+ char id_path[FILENAME_MAX] = {0};
+ char *buffer = reinterpret_cast<char *>(MAP_FAILED);
+
+ bkup_query_result_t query_result;
+ BkupParamGet(item_name, &query_result); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ char prefix_name[kBkupPrexixEncryptionSize + 1] = {0};
+ if (query_result.encrypt != false) {
+ strncpy(prefix_name, kBkupPrexixEncryption, kBkupPrexixEncryptionSize);
+ }
+ snprintf(id_path, FILENAME_MAX, "%s/%s%s", category_name, prefix_name, item_name);
+
+ if ((buffer = BkupAnonMmap(query_result.size)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:map failed");
+ ret = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ BkupRwlockRdlock(src_rwlock, id_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if ((ret = BkupBufferReadFromNv(src, id_path, buffer, query_result.size,
+ &crc32)) >= 0) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupRwlockWrlock(dst_rwlock, id_path);
+ ret = BkupBufferWriteToNv(dst, id_path, buffer, query_result.size, &crc32);
+ BkupRwlockUnlock(dst_rwlock, id_path);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+ BkupRwlockUnlock(src_rwlock, id_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+exit:
+ if (buffer != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ munmap(buffer, query_result.size);
+ }
+
+ return ret;
+}
+
+/**
+ * make backup path
+ */
+static int BkupMakeBkupPathToNvId(const char *category_name,
+ const char *item_name, char **path_buf,
+ int buf_size) {
+ int ret = -1;
+ char prefix_name[kBkupPrexixEncryptionSize + 1] = {0};
+
+ if ((*path_buf = BkupAnonMmap(buf_size)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+ bkup_query_result_t query_result;
+ if (BkupParamGet(item_name, &query_result) < 0) { // LCOV_EXCL_BR_LINE 6:Excluded due to checking by upper-level function
+ // LCOV_EXCL_START 6:Excluded due to checking by upper-level function
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid item_name:%s", item_name);
+ goto exit;
+ // LCOV_EXCL_STOP 6:Excluded due to checking by upper-level function
+ }
+ if (query_result.encrypt != false) {
+ strncpy(prefix_name, kBkupPrexixEncryption, kBkupPrexixEncryptionSize);
+ }
+ snprintf(*path_buf, static_cast<size_t>(buf_size), "%s/%s%s",
+ category_name, prefix_name, item_name);
+ ret = 0;
+
+exit:
+ return ret;
+}
+
+/**
+ * delete data
+ */
+static int BkupDeleteDataFromNv(const enum NvHalMedia media, const char* const path) {
+ int ret = 0;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6:Excluded due to checking by upper-level function
+ // LCOV_EXCL_START 6:Excluded due to checking by upper-level function
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "path is NULL");
+ ret = -1;
+ return ret;
+ // LCOV_EXCL_STOP 6:Excluded due to checking by upper-level function
+ }
+ const size_t path_size = static_cast<size_t>(std::string(path).length());
+ if (path_size > FILENAME_MAX) { // LCOV_EXCL_BR_LINE 6:Excluded due to checking by upper-level function
+ // LCOV_EXCL_START 6:Excluded due to checking by upper-level function
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "path size error");
+ ret = -1;
+ return ret;
+ // LCOV_EXCL_STOP 6:Excluded due to checking by upper-level function
+ }
+
+ uint32_t size = 0;
+ e_status = GetSizeNv(media, path, &size);
+ if (e_status == eFrameworkunifiedStatusFileLoadError) {
+ // If the file does not exist, deleet it successfully
+ return ret;
+ } else if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "GetSizeNv e_status:%d\n", e_status);
+ ret = -1;
+ return ret;
+ } else {
+ // no proc
+ }
+
+ e_status = DeleteNv(media, path);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ ret = -1;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "DeleteNv e_status:%d\n", e_status);
+ }
+ return ret;
+}
+
+/**
+ * get rwlock
+ */
+static pthread_rwlock_t *BkupGetRwlock(const char *item_name,
+ enum NvHalMedia media,
+ bkup_query_result_t *query_result) {
+ int ret;
+ pthread_rwlock_t *rwlock, *org_rwlock;
+ pthread_rwlockattr_t attr;
+
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "query_result is NULL");
+ return NULL;
+ }
+
+ if (media != NVHALMEDIA_BACKUPDRAM || query_result->backup_dram == false || query_result->nand == false) {
+ return NULL;
+ }
+ // backupDram && nand
+ if (query_result->opt != NULL) {
+ return reinterpret_cast<pthread_rwlock_t *>(query_result->opt);
+ }
+
+ if ((ret = pthread_rwlockattr_init(&attr)) != 0) { // LCOV_EXCL_BR_LINE 5:pthread_rwlockattr_init's error case.
+ // LCOV_EXCL_START 5:pthread_rwlockattr_init's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlockattr_init:%s", strerror(ret));
+ return NULL;
+ // LCOV_EXCL_STOP 5:pthread_rwlockattr_init's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5:pthread_rwlockattr_setkind_np's error case.
+ if ((ret = pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)) != 0) {
+ // LCOV_EXCL_BR_STOP 5:pthread_rwlockattr_setkind_np's error case.
+ // LCOV_EXCL_START 5:pthread_rwlockattr_setkind_np's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlockattr_setkind_np:%s", strerror(ret));
+ return NULL;
+ // LCOV_EXCL_STOP 5:pthread_rwlockattr_setkind_np's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5:malloc's error case.
+ if ((rwlock = reinterpret_cast<pthread_rwlock_t *>(malloc(sizeof(pthread_rwlock_t)))) == NULL) {
+ // LCOV_EXCL_BR_STOP 5:malloc's error case.
+ // LCOV_EXCL_START 5:malloc's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "malloc failed");
+ return NULL;
+ // LCOV_EXCL_STOP 5:malloc's error case.
+ }
+
+ if ((ret = pthread_rwlock_init(rwlock, &attr)) != 0) { // LCOV_EXCL_BR_LINE 5:pthread_rwlock_init's error case.
+ // LCOV_EXCL_START 5:pthread_rwlock_init's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlock_init:%s", strerror(ret));
+ free(rwlock);
+ return NULL;
+ // LCOV_EXCL_STOP 5:pthread_rwlock_init's error case.
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ org_rwlock = reinterpret_cast<pthread_rwlock_t *>(BkupParamSetOpt(item_name, rwlock));
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (org_rwlock == reinterpret_cast<void *>(-1)) { // LCOV_EXCL_BR_LINE 6:org_rwlock will not be -1
+ // LCOV_EXCL_START 6:org_rwlock will not be -1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid item_name:%s", item_name != 0 ? item_name : NULL);
+ free(rwlock);
+ return NULL;
+ // LCOV_EXCL_STOP 6:org_rwlock will not be -1
+ } else if (org_rwlock != NULL) { // LCOV_EXCL_BR_LINE 5:gcc builtin function's error case
+ // conflict
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ free(rwlock); // LCOV_EXCL_LINE 5:gcc builtin function's error case
+ rwlock = org_rwlock; // LCOV_EXCL_LINE 5:gcc builtin function's error case
+ }
+
+ query_result->opt = rwlock;
+ return rwlock;
+}
+
+/**
+ * rwlock read lock
+ */
+static inline void BkupRwlockRdlock(pthread_rwlock_t *rwlock, const char *path) {
+ if (rwlock) {
+ int ret;
+ if ((ret = pthread_rwlock_rdlock(rwlock)) != 0) { // LCOV_EXCL_BR_LINE 5:pthread_rwlock_rdlock's error case.
+ // LCOV_EXCL_START 5:pthread_rwlock_rdlock's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlock_rdlock(%s):%s", path, strerror(ret));
+ // LCOV_EXCL_STOP 5:pthread_rwlock_rdlock's error case.
+ }
+ }
+}
+
+/**
+ * rwlock write lock
+ */
+static inline void BkupRwlockWrlock(pthread_rwlock_t *rwlock, const char *path) {
+ if (rwlock) {
+ int ret;
+ if ((ret = pthread_rwlock_wrlock(rwlock)) != 0) { // LCOV_EXCL_BR_LINE 5:pthread_rwlock_wrlock's error case.
+ // LCOV_EXCL_START 5:pthread_rwlock_wrlock's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlock_wrlock(%s):%s", path, strerror(ret));
+ // LCOV_EXCL_STOP 5:pthread_rwlock_wrlock's error case.
+ }
+ }
+}
+
+/**
+ * rwlock unlock
+ */
+static inline void BkupRwlockUnlock(pthread_rwlock_t *rwlock, const char *path) {
+ if (rwlock) {
+ int ret;
+ if ((ret = pthread_rwlock_unlock(rwlock)) != 0) { // LCOV_EXCL_BR_LINE 5:pthread_rwlock_unlock's error case.
+ // LCOV_EXCL_START 5:pthread_rwlock_unlock's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlock_unlock(%s):%s", path, strerror(ret));
+ // LCOV_EXCL_STOP 5:pthread_rwlock_unlock's error case.
+ }
+ }
+}
+
+/**
+ * inter thread communication MQ open
+ */
+static mqd_t BkupItcMqopen(const char *mq_name, int flags) {
+ struct mq_attr attr;
+
+ if (mq_name == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "mq_name is NULL");
+ return -1;
+ }
+
+ attr.mq_flags = 0;
+ attr.mq_maxmsg = 256;
+ attr.mq_msgsize = sizeof(bkup_itc_message_t);
+
+ return mq_open(mq_name, flags, 0660, &attr);
+}
+
+/**
+ * write & rename
+ */
+static int BkupWriteRename(const char *category_name, const char *item_name,
+ enum NvHalMedia media, char *buf, int size,
+ pthread_rwlock_t *rwlock) {
+ int ret = -1;
+ char *full_path = reinterpret_cast<char *>(MAP_FAILED);
+
+ // LCOV_EXCL_BR_START 5:mmap's error case.
+ if (BkupMakeBkupPathToNvId(category_name, item_name, &full_path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ BkupRwlockWrlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (BkupBufferWriteToNv(media, full_path, buf, size, NULL) < 0) {
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ goto exit;
+ }
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ ret = size;
+
+exit:
+ if (full_path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ munmap(full_path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * stat check
+ *
+ * \retval 0 file exists
+ * \retval -1 file not exists
+ * \retval -2 size error
+ */
+static int BkupCheckStatFromNv(enum NvHalMedia media, const char *path,
+ int check_size) {
+ uint32_t size = check_size + static_cast<uint32_t>(sizeof(uint32_t));
+ const EFrameworkunifiedStatus ret = CheckNv(media, path, size);
+
+ if (path == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "path is NULL");
+ return -1;
+ }
+
+ if (eFrameworkunifiedStatusOK == ret) {
+ return 0;
+ } else if (eFrameworkunifiedStatusAccessError == ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CheckNv e_status:%d", ret);
+ return -2;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CheckNv e_status:%d", ret);
+ return -1;
+ }
+}
+
+/**
+ * media stat
+ */
+static int BkupMediaStat(const char *category_name, const char *item_name, enum NvHalMedia src, int size) {
+ int ret = -1;
+ char *path = reinterpret_cast<char *>(MAP_FAILED);
+
+ // LCOV_EXCL_BR_START 5:mmap's error case.
+ if (BkupMakeBkupPathToNvId(category_name, item_name, &path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+ ret = BkupCheckStatFromNv(src, path, size); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+exit:
+ if (path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ munmap(path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * stat check & read
+ *
+ * \retval 0 file exists
+ * \retval -1 file not exists
+ */
+static int BkupCheckStatRead(enum NvHalMedia current_media, const char *path,
+ char *buf, int check_size, uint32_t *crc32,
+ pthread_rwlock_t *rwlock) {
+ int ret;
+
+ if ((ret = BkupCheckStatFromNv(current_media, path, check_size)) < 0) {
+ return ret;
+ }
+
+ BkupRwlockRdlock(rwlock, path);
+
+ if (BkupBufferReadFromNv(current_media, path, buf, check_size, crc32) < 0) {
+ BkupRwlockUnlock(rwlock, path);
+ return -1;
+ }
+
+ BkupRwlockUnlock(rwlock, path);
+ return 0;
+}
+
+/**
+ * valid check
+ *
+ * \retval 0 file invalid & do nothing
+ * \retval -1 file invalid but create 0 fill file
+ * \retval 1 file valid
+ */
+static int BkupCheckRead(const char *path, enum NvHalMedia current_media,
+ bkup_protocol_command_t command, char *rcv_buf,
+ char *read_buf, uint32_t *crc32,
+ bkup_query_result_t *query_result,
+ pthread_rwlock_t *rwlock) {
+ int ret = -1;
+
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return 0;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return 0;
+ }
+
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+
+ if (BkupCheckStatRead(current_media, path, read_buf, query_result->size, crc32, rwlock) < 0) {
+ // file not exists
+ if (current_media == NVHALMEDIA_NAND || query_result->nand == false) {
+ goto exit;
+ } else {
+ if (command == BKUP_CMD_READ) {
+ /*
+ * Read
+ */
+ if (BkupCheckStatFromNv(NVHALMEDIA_NAND, path, query_result->size) == 0) {
+ // do nothing
+ ret = 0;
+ } else {
+ // take preference BackupDRAM or CacheDRAM
+ ret = -1;
+ }
+ } else {
+ /*
+ * Write/Fill
+ */
+ pthread_rwlock_t *nand_rwlock = BkupGetRwlock(hdr->item_name, NVHALMEDIA_NAND, query_result);
+ if (BkupCheckStatRead(NVHALMEDIA_NAND, path, read_buf, query_result->size, NULL, nand_rwlock) == 0) {
+ // write back cache
+ if (BkupWriteRename(query_result->category_name, hdr->item_name,
+ current_media, read_buf, query_result->size,
+ rwlock) >= 0) {
+ ret = 1;
+ } else {
+ // copy error, do nothing
+ ret = 0;
+ }
+ } else {
+ // take preference BackupDRAM or CacheDRAM
+ ret = -1;
+ }
+ }
+ goto exit;
+ }
+ }
+ ret = 1;
+exit:
+ return ret;
+}
+
+/**
+ * read command
+ */
+static int BkupCmdRead(bkup_response_t *response, enum NvHalMedia current_media,
+ char *rcv_buf, bkup_query_result_t *query_result) {
+ int ret = -1;
+ if (response == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "response is NULL");
+ return -1;
+ }
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return -1;
+ }
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *rwlock = BkupGetRwlock(hdr->item_name, current_media, query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ char *full_path = reinterpret_cast<char *>(MAP_FAILED);
+ char *buf = reinterpret_cast<char *>(MAP_FAILED);
+ size_t buf_size = 0;
+ uint32_t crc32 = 0;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ // LCOV_EXCL_BR_START 5:mmap's error case.
+ if (BkupMakeBkupPathToNvId(query_result->category_name, hdr->item_name, &full_path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ if ((buf = BkupAnonMmap(query_result->size)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+ buf_size = query_result->size;
+
+ ret = BkupCheckRead(full_path, current_media, hdr->command, rcv_buf, buf,
+ &crc32, query_result, rwlock); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (ret == -1) {
+ // return all 0
+ ret = hdr->size;
+ goto exit;
+ } else if (ret == 0) {
+ // do nothing
+ goto exit;
+ }
+
+ // success
+ ret = hdr->size;
+
+ // caching to memory
+ if (current_media == NVHALMEDIA_NAND) {
+ if (query_result->cache_dram) {
+ if (BkupMediaStat(query_result->category_name, hdr->item_name,
+ NVHALMEDIA_CACHEDRAM, query_result->size) < 0) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *dst_rwlock =
+ BkupGetRwlock(hdr->item_name, NVHALMEDIA_CACHEDRAM, query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ BkupWriteRename(query_result->category_name, hdr->item_name,
+ NVHALMEDIA_CACHEDRAM, buf, query_result->size,
+ dst_rwlock); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ }
+ if (query_result->backup_dram) {
+ if (BkupMediaStat(query_result->category_name, hdr->item_name,
+ NVHALMEDIA_BACKUPDRAM, query_result->size) < 0) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *dst_rwlock =
+ BkupGetRwlock(hdr->item_name, NVHALMEDIA_BACKUPDRAM, query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ BkupWriteRename(query_result->category_name, hdr->item_name,
+ NVHALMEDIA_BACKUPDRAM, buf, query_result->size,
+ dst_rwlock); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ }
+ }
+
+exit:
+ if (ret != 0 && buf != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupApilog(response, current_media, hdr, query_result, buf, crc32, e_status);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((*response->set_response)(response->opt, buf + hdr->offset, hdr->size, e_status) < 0) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -1; // LCOV_EXCL_LINE 4: NSFW error case
+ }
+ }
+
+ if (full_path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(full_path, FILENAME_MAX);
+ }
+ if (buf != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(buf, buf_size);
+ }
+ return ret;
+}
+
+/**
+ * write command
+ */
+static int BkupCmdWrite(bkup_response_t *response,
+ enum NvHalMedia current_media, char *rcv_buf,
+ bkup_query_result_t *query_result) {
+ int ret = -1;
+
+ if (response == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "response is NULL");
+ return -1;
+ }
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return -1;
+ }
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *rwlock = BkupGetRwlock(hdr->item_name, current_media, query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ char *full_path = reinterpret_cast<char *>(MAP_FAILED);
+ char *buf = reinterpret_cast<char *>(MAP_FAILED);
+ char *header = NULL;
+ uint32_t crc32 = 0;
+ int buf_size = 0;
+
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if (BkupMakeBkupPathToNvId(query_result->category_name, hdr->item_name, &full_path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit; // LCOV_EXCL_LINE 5: mmap's error case.
+ }
+
+ if (hdr->offset != 0 || hdr->size != (uint32_t)query_result->size) {
+ /*
+ * partial write
+ */
+ if ((buf = BkupAnonMmap(query_result->size)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ buf_size = query_result->size;
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupCheckRead(full_path, current_media, hdr->command, rcv_buf, buf, NULL, query_result, rwlock);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (ret == 0) {
+ // do nothing
+ goto exit;
+ }
+
+ header = buf;
+ memcpy(buf + hdr->offset, rcv_buf + sizeof(bkup_protocol_header_t), hdr->size);
+ BkupRwlockWrlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (BkupBufferWriteToNv(current_media, full_path, buf, query_result->size, &crc32) < 0) {
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ goto exit;
+ }
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ /*
+ * whole write
+ */
+ header = rcv_buf + sizeof(bkup_protocol_header_t);
+ BkupRwlockWrlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (BkupBufferWriteToNv(current_media, full_path,
+ rcv_buf + sizeof(bkup_protocol_header_t), hdr->size, &crc32) < 0) {
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ goto exit;
+ }
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ // success
+ ret = hdr->size;
+
+exit:
+ EFrameworkunifiedStatus e_status = ret < 0 ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+ if (current_media == NVHALMEDIA_NAND) {
+ if (query_result->cache_dram == false && query_result->backup_dram == false) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupApilog(response, current_media, hdr, query_result, header, crc32, e_status);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+ if ((*response->set_response)(response->opt, NULL, 0, e_status) < 0) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -1; // LCOV_EXCL_LINE 4: NSFW error case
+ }
+ } else {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupApilog(response, current_media, hdr, query_result, header, crc32, e_status);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+
+ if (buf != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(buf, buf_size);
+ }
+ if (full_path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(full_path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * fill command
+ */
+static int BkupCmdFill(bkup_response_t *response, enum NvHalMedia current_media,
+ char *rcv_buf, bkup_query_result_t *query_result) {
+ int ret = -1;
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *rwlock = BkupGetRwlock(hdr->item_name, current_media, query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ char *full_path = reinterpret_cast<char *>(MAP_FAILED);
+ char *buf = reinterpret_cast<char *>(MAP_FAILED);
+ uint32_t crc32 = 0;
+
+ if (response == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "response is NULL");
+ return -1;
+ }
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return -1;
+ }
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if (BkupMakeBkupPathToNvId(query_result->category_name, hdr->item_name, &full_path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit; // LCOV_EXCL_LINE 5: mmap's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if ((buf = BkupAnonMmap(query_result->size)) == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+
+ if (hdr->offset != 0 || hdr->size != (uint32_t)query_result->size) {
+ /*
+ * partial fill
+ */
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupCheckRead(full_path, current_media, hdr->command, rcv_buf, buf, NULL, query_result, rwlock);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (ret == 0) {
+ // do nothing
+ goto exit;
+ }
+ }
+
+ memset(buf + hdr->offset, hdr->fill_patern, hdr->size);
+ BkupRwlockWrlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (BkupBufferWriteToNv(current_media, full_path, buf, query_result->size, &crc32) < 0) {
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ goto exit;
+ }
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ // success
+ ret = hdr->size;
+
+exit:
+ EFrameworkunifiedStatus e_status = ret < 0 ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+ if (current_media == NVHALMEDIA_NAND) {
+ if (query_result->cache_dram == false && query_result->backup_dram == false) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupApilog(response, current_media, hdr, query_result, buf, crc32, e_status);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+ if ((*response->set_response)(response->opt, NULL, 0, e_status) < 0) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -1; // LCOV_EXCL_LINE 4: NSFW error case
+ }
+ } else {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupApilog(response, current_media, hdr, query_result, buf, crc32, e_status);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+
+ if (buf != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(buf, query_result->size);
+ }
+ if (full_path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(full_path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * copy command
+ */
+static int BkupCmdCopy(bkup_response_t *response, enum NvHalMedia current_media,
+ char *rcv_buf, bkup_query_result_t *query_result) {
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return -1;
+ }
+ bkup_protocol_header_t *hdr =
+ reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ pthread_rwlock_t *src_rwlock =
+ BkupGetRwlock(hdr->item_name, hdr->src_media, query_result);
+ pthread_rwlock_t *dst_rwlock =
+ BkupGetRwlock(hdr->item_name, current_media, query_result);
+
+ int ret = BkupMediaCopyFromNv(query_result->category_name, hdr->item_name, hdr->src_media, current_media, src_rwlock,
+ dst_rwlock);
+
+ if (response == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "response is NULL");
+ return -1;
+ }
+
+ if (current_media == NVHALMEDIA_NAND) {
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((*response->set_response)(response->opt, NULL, 0, ret < 0 ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK) < 0) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -1; // LCOV_EXCL_LINE 4: NSFW error case
+ }
+ }
+ return ret;
+}
+
+/**
+ * check command
+ */
+static int BkupCmdCheck(bkup_response_t *response,
+ enum NvHalMedia current_media, char *rcv_buf,
+ bkup_query_result_t *query_result) {
+ int ret = 0;
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ char *full_path = reinterpret_cast<char *>(MAP_FAILED);
+
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return -1;
+ }
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if (BkupMakeBkupPathToNvId(query_result->category_name, hdr->item_name, &full_path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -3;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ ret = BkupCheckStatFromNv(current_media, full_path, query_result->size); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+exit:
+ if (full_path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(full_path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * delete command
+ */
+static int BkupCmdDeleteData(bkup_response_t* const response,
+ const enum NvHalMedia current_media,
+ char* const rcv_buf,
+ bkup_query_result_t* const query_result) {
+ int ret = -1;
+ char *full_path = NULL;
+ bkup_protocol_header_t* hdr = reinterpret_cast<bkup_protocol_header_t*>(NULL);
+ pthread_rwlock_t* rwlock = reinterpret_cast<pthread_rwlock_t*>(NULL);
+ if ((response == NULL) || (rcv_buf == NULL) || (query_result == NULL)) { // LCOV_EXCL_BR_LINE 6:Excluded as no NULL is currently passed
+ // LCOV_EXCL_START 6:Excluded as no NULL is currently passed
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Resp or Buf or Query is NULL");
+ goto exit;
+ // LCOV_EXCL_STOP 6:Excluded as no NULL is currently passed
+ }
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ rwlock = BkupGetRwlock(hdr->item_name, current_media, query_result);
+ if (BkupMakeBkupPathToNvId(query_result->category_name, hdr->item_name, &full_path, FILENAME_MAX) < 0) { // LCOV_EXCL_BR_LINE 6:Excluded due to checking by upper-level function
+ // LCOV_EXCL_START 6:Excluded due to checking by upper-level function
+ AGL_ASSERT_NOT_TESTED();
+ goto exit;
+ // LCOV_EXCL_STOP 6:Excluded due to checking by upper-level function
+ }
+ BkupRwlockWrlock(rwlock, full_path);
+ ret = BkupDeleteDataFromNv(current_media, full_path);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "BkupDeleteDataFromNv Error");
+ }
+ BkupRwlockUnlock(rwlock, full_path);
+
+exit:
+ if ((response != NULL) && (query_result != NULL) && (hdr != NULL)) { // LCOV_EXCL_BR_LINE 6:Excluded as no NULL is currently passed
+ EFrameworkunifiedStatus e_status = (ret < 0) ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+ if (current_media == NVHALMEDIA_NAND) {
+ if ((query_result->cache_dram == false) && (query_result->backup_dram == false)) {
+ BkupApilog(response, current_media, hdr, query_result, NULL, 0, e_status);
+ }
+ if ((*response->set_response)(response->opt, NULL, 0, e_status) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Response Error");
+ ret = -1;
+ }
+ } else {
+ BkupApilog(response, current_media, hdr, query_result, NULL, 0, e_status);
+ }
+ }
+
+ if (full_path != NULL) { // LCOV_EXCL_BR_LINE 6:Excluded because checked by BkupMakeBkupPathToNvId()
+ munmap(full_path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * common file handler
+ */
+static int BkupHandlerFile(bkup_response_t *response,
+ enum NvHalMedia current_media, char *rcv_buf,
+ bkup_query_result_t *query_result) {
+ int ret = 0;
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+
+ switch (hdr->command) { // LCOV_EXCL_BR_LINE 6:double check
+ case BKUP_CMD_READ:
+ ret = BkupCmdRead(response, current_media, rcv_buf, query_result);
+ break;
+
+ case BKUP_CMD_WRITE:
+ ret = BkupCmdWrite(response, current_media, rcv_buf, query_result);
+ break;
+
+ case BKUP_CMD_FILL:
+ ret = BkupCmdFill(response, current_media, rcv_buf, query_result);
+ break;
+
+ case BKUP_CMD_COPY_INNER:
+ ret = BkupCmdCopy(response, current_media, rcv_buf, query_result);
+ break;
+
+ case BKUP_CMD_DELETE:
+ ret = BkupCmdDeleteData(response, current_media, rcv_buf, query_result);
+ break;
+
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 6:double check
+ }
+ return ret;
+}
+
+/**
+ * Main's response
+ */
+static int BkupSetResponseNsfw(void *opt, void *buf, int size, EFrameworkunifiedStatus ret_value) {
+ EFrameworkunifiedStatus e_status;
+
+ if (buf != NULL) { // LCOV_EXCL_BR_LINE 6:double check
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedSetSyncResponseData((HANDLE)opt, buf, size)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSetSyncResponseData:%d", e_status);
+ return -1;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+ }
+ return 0;
+}
+
+/**
+ * write apilog
+ */
+static void BkupApilog(bkup_response_t *response, enum NvHalMedia current_media,
+ bkup_protocol_header_t *hdr,
+ bkup_query_result_t *query_result, char *buf,
+ uint32_t crc32, EFrameworkunifiedStatus ret_value) {
+ const char *src;
+ const char *cmd;
+ char header[12] = "-- -- -- --";
+ const char c[] = "0123456789abcdef";
+
+ if (response == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "response is NULL");
+ return;
+ }
+ if (hdr == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "hdr is NULL");
+ return;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return;
+ }
+ if (response->set_response == BkupSetResponseNsfw) {
+ src = FrameworkunifiedGetMsgSrc((HANDLE)response->opt); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ src = (reinterpret_cast<bkup_itc_message_t *>(response->opt))->nand.client_name;
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+
+ switch (hdr->command) { // LCOV_EXCL_BR_LINE 6:double check
+ case BKUP_CMD_READ:
+ cmd = "RD";
+ break;
+ case BKUP_CMD_WRITE:
+ cmd = "WR";
+ break;
+ case BKUP_CMD_FILL:
+ cmd = "FILL";
+ break;
+ case BKUP_CMD_READ_NUM:
+ // LCOV_EXCL_START 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cmd = "RDN";
+ break;
+ // LCOV_EXCL_STOP 6:double check
+ case BKUP_CMD_SIZE_NUM:
+ // LCOV_EXCL_START 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cmd = "SZN";
+ break;
+ // LCOV_EXCL_STOP 6:double check
+ case BKUP_CMD_DELETE:
+ cmd = "DEL";
+ break;
+ default:
+ // LCOV_EXCL_START 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cmd = "UNKNOWN";
+ break;
+ // LCOV_EXCL_STOP 6:double check
+ }
+
+ if (buf) { // LCOV_EXCL_BR_LINE 6:double check
+ int i;
+ for (i = 0; i < 4; i++) {
+ if (query_result->size > i) {
+ header[i * 3] = c[*(buf + i) >> 4];
+ header[i * 3 + 1] = c[*(buf + i) & 0xf];
+ }
+ }
+ }
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ALSA, "", "%s/%s/%s/o:%d/s:%d/h:%s/c:%x/r:%d", src, cmd, hdr->item_name, hdr->offset, hdr->size,
+ header, crc32, ret_value);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+}
+
+/**
+ * Tweak command
+ */
+static int BkupTweakCommand(enum NvHalMedia current_media, char **rcv_buf,
+ int *rcv_size, bkup_query_result_t *query_result) {
+ int ret = -1;
+ bkup_protocol_header_t update_hdr;
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(*rcv_buf);
+
+ if (current_media == NVHALMEDIA_NAND) { // LCOV_EXCL_BR_LINE 6:current_media never will be NVHALMEDIA_NAND
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = 0; // LCOV_EXCL_LINE 6:current_media never will be NVHALMEDIA_NAND
+ goto exit; // LCOV_EXCL_LINE 6:current_media never will be NVHALMEDIA_NAND
+ }
+ if (rcv_size == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "rcv_size is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "query_resul is NULL");
+ return -1;
+ }
+
+ if ((hdr->command == BKUP_CMD_WRITE || hdr->command == BKUP_CMD_FILL) &&
+ (hdr->offset != 0 || hdr->size != (uint32_t)query_result->size)) {
+ // partial request
+ if ((current_media == NVHALMEDIA_CACHEDRAM &&
+ (query_result->nand || query_result->backup_dram)) ||
+ (current_media == NVHALMEDIA_BACKUPDRAM && query_result->nand)) {
+ memset(&update_hdr, 0, sizeof(update_hdr));
+ BkupStrlcpy(update_hdr.item_name, hdr->item_name, sizeof(update_hdr.item_name));
+ update_hdr.command = BKUP_CMD_COPY_INNER;
+ update_hdr.src_media = current_media;
+ munmap(*rcv_buf, *rcv_size);
+ *rcv_size = 0;
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if ((*rcv_buf = BkupAnonMmap(sizeof(bkup_protocol_header_t))) == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ *rcv_size = sizeof(bkup_protocol_header_t);
+ memcpy(*rcv_buf, &update_hdr, sizeof(update_hdr));
+ }
+ }
+ ret = 0;
+
+exit:
+ return ret;
+}
+
+/**
+ * Main callback handler
+ */
+EFrameworkunifiedStatus BkupHandler(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ uint32_t rcv_size = 0;
+ char *rcv_buf = NULL;
+ bkup_protocol_header_t *hdr;
+ bkup_query_result_t query_result;
+ bool hold_rcv_buf = false;
+ int ret = 0;
+ bkup_response_t response_nsfw = {BkupSetResponseNsfw, h_app};
+
+ if ((rcv_size = FrameworkunifiedGetMsgLength(h_app)) < sizeof(bkup_protocol_header_t)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgLength: size fail:%d", rcv_size);
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ rcv_buf = reinterpret_cast<char *>(mmap(NULL, rcv_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
+ if (rcv_buf == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rcv_size = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ e_status = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if ((e_status = FrameworkunifiedGetMsgDataOfSize(h_app, rcv_buf, rcv_size, eSMRRelease)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize:%d", e_status);
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ if (hdr->command < 0 || hdr->command >= BKUP_CMD_MAX) { // LCOV_EXCL_BR_LINE 6:double check
+ // LCOV_EXCL_START 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid command:%d", hdr->command);
+ e_status = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ // LCOV_EXCL_STOP 6:double check
+ }
+
+ if (hdr->command == BKUP_CMD_READ_NUM || hdr->command == BKUP_CMD_SIZE_NUM) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (BkupParamGetNumid(hdr->num_id, &query_result, hdr->item_name, sizeof(hdr->item_name)) < 0) {
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", hdr->num_id);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ e_status = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ }
+
+ if (hdr->command == BKUP_CMD_READ_NUM) {
+ hdr->command = BKUP_CMD_READ;
+ }
+ } else {
+ if (BkupParamGet(hdr->item_name, &query_result) < 0) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid item_name:%s", hdr->item_name != 0 ? hdr->item_name : NULL);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ e_status = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ }
+ }
+
+ if (hdr->command == BKUP_CMD_READ || hdr->command == BKUP_CMD_WRITE || hdr->command == BKUP_CMD_FILL) {
+ if (hdr->size == 0) {
+ // do nothing
+ goto exit;
+ }
+ if (hdr->size + hdr->offset > (uint32_t)query_result.size) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid size+offset:%d+%d", hdr->size, hdr->offset);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ e_status = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ }
+ }
+
+ // LCOV_EXCL_BR_START 6: g_bkup_internal_state will not be BKUP_STATE_INIT
+ if (g_bkup_internal_state == BKUP_STATE_INIT) {
+ // LCOV_EXCL_BR_STOP 6: g_bkup_internal_state will not be BKUP_STATE_INIT
+ // LCOV_EXCL_START 6: same as above
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ e_status = eFrameworkunifiedStatusErrOther;
+ goto exit;
+ // LCOV_EXCL_STOP 6: same as above
+ }
+ // LCOV_EXCL_BR_START 6: g_bkup_internal_state will not be BKUP_STATE_TERM
+ if (g_bkup_internal_state == BKUP_STATE_TERM) {
+ // LCOV_EXCL_BR_STOP 6: g_bkup_internal_state will not be BKUP_STATE_TERM
+ // LCOV_EXCL_START 6: same as above
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ e_status = eFrameworkunifiedStatusExit;
+ goto exit;
+ // LCOV_EXCL_STOP 6: same as above
+ }
+
+ if (hdr->command == BKUP_CMD_SIZE || hdr->command == BKUP_CMD_SIZE_NUM) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupSetResponseNsfw(h_app, &query_result.size, sizeof(query_result.size), eFrameworkunifiedStatusOK);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ } else if (hdr->command == BKUP_CMD_CHECK) {
+ if (query_result.nand) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupCmdCheck(&response_nsfw, NVHALMEDIA_NAND, rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ } else if (query_result.backup_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupCmdCheck(&response_nsfw, NVHALMEDIA_BACKUPDRAM, rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ } else if (query_result.cache_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupCmdCheck(&response_nsfw, NVHALMEDIA_CACHEDRAM, rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ } else {
+ ret = -3;
+ }
+
+ if (ret == -1) {
+ // not exists
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Not exists:%s", hdr->item_name != 0 ? hdr->item_name : NULL);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ e_status = eFrameworkunifiedStatusFileLoadError;
+ } else if (ret == -2) {
+ // size error
+ e_status = eFrameworkunifiedStatusAccessError;
+ } else if (ret == -3) {
+ e_status = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ /*
+ * Cache DRAM
+ */
+ if (query_result.cache_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupHandlerFile(&response_nsfw, NVHALMEDIA_CACHEDRAM, rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (ret > 0) {
+ if (hdr->command == BKUP_CMD_READ) {
+ goto exit;
+ }
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if (BkupTweakCommand(NVHALMEDIA_CACHEDRAM, &rcv_buf,
+ reinterpret_cast<int *>(&rcv_size),
+ &query_result) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ }
+ }
+
+ /*
+ * Backup DRAM
+ */
+ if (query_result.backup_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupHandlerFile(&response_nsfw, NVHALMEDIA_BACKUPDRAM, rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (ret > 0) {
+ if (hdr->command == BKUP_CMD_READ) {
+ goto exit;
+ }
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if (BkupTweakCommand(NVHALMEDIA_BACKUPDRAM, &rcv_buf,
+ reinterpret_cast<int *>(&rcv_size),
+ &query_result) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ }
+ }
+
+ /*
+ * NAND
+ */
+ if (query_result.nand) {
+ bkup_itc_message_t snd_msg;
+
+ if ((hdr->command == BKUP_CMD_READ) || (hdr->command == BKUP_CMD_DELETE) || (query_result.sync) || (ret == 0)) {
+ /*
+ * operation offload
+ */
+ const char *client_name;
+ char system_info[MAX_SYS_INFO_SIZE];
+
+ if (g_bkup_nand_mqd == -1) {
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((g_bkup_nand_mqd = BkupItcMqopen("/" BKUP_THREAD_NAND, O_WRONLY | O_CREAT | O_NONBLOCK | O_CLOEXEC)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ // LCOV_EXCL_START 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+ }
+
+ if ((client_name = FrameworkunifiedGetMsgSrc(h_app)) == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "invalid client_name");
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ FrameworkunifiedGetSystemInfo(h_app, system_info); // LCOV_EXCL_BR_LINE 11:unexpected branch.
+
+ memset(&snd_msg, 0, sizeof(snd_msg));
+ BkupStrlcpy(snd_msg.nand.client_name, client_name, sizeof(snd_msg.nand.client_name));
+ snd_msg.nand.seq_id = static_cast<uint32_t>(strtoul(system_info, NULL, 16));
+ snd_msg.nand.rcv_buf = rcv_buf;
+ snd_msg.nand.rcv_size = rcv_size;
+
+ // LCOV_EXCL_BR_START 5: mq_send's error case.
+ if (mq_send(g_bkup_nand_mqd, reinterpret_cast<char *>(&snd_msg), sizeof(snd_msg), 0) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_send's error case.
+ // LCOV_EXCL_START 5: mq_send's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int save_errno = errno;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_send:%s", strerror(errno));
+ e_status = eFrameworkunifiedStatusFail;
+ if (save_errno == EAGAIN) {
+ kill(g_bkup_nand_tid, SIGABRT);
+ }
+ goto exit;
+ // LCOV_EXCL_STOP 5: mq_send's error case.
+ }
+ FrameworkunifiedSetDeferredSyncResponse(h_app); // LCOV_EXCL_BR_LINE 11:unexpected branch.
+ hold_rcv_buf = true;
+ } else {
+ /*
+ * delay write
+ */
+ if (g_bkup_delay_mqd == -1) {
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((g_bkup_delay_mqd = BkupItcMqopen("/" BKUP_THREAD_DELAY, O_WRONLY | O_CREAT | O_NONBLOCK | O_CLOEXEC)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ // LCOV_EXCL_START 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+ }
+
+ memset(&snd_msg, 0, sizeof(snd_msg));
+
+// snd_msg.delay.terminate = false;
+ snd_msg.delay.cmd = BKUP_DELAY_CMD_REGIST;
+
+ BkupStrlcpy(snd_msg.delay.item_name, hdr->item_name, sizeof(snd_msg.delay.item_name));
+
+ // LCOV_EXCL_BR_START 5: mq_send's error case.
+ if (mq_send(g_bkup_delay_mqd, reinterpret_cast<char *>(&snd_msg), sizeof(snd_msg), 0) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_send's error case.
+ // LCOV_EXCL_START 5: mq_send's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int save_errno = errno;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_send:%s", strerror(errno));
+ e_status = eFrameworkunifiedStatusFail;
+ if (save_errno == EAGAIN) {
+ kill(g_bkup_delay_tid, SIGABRT);
+ }
+ goto exit;
+ // LCOV_EXCL_STOP 5: mq_send's error case.
+ }
+ }
+ }
+ }
+
+exit:
+ if (hold_rcv_buf == false && rcv_buf != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case
+ munmap(rcv_buf, rcv_size);
+ }
+ return e_status;
+}
+
+
+/**
+ * Power callback handler
+ */
+EFrameworkunifiedStatus bkup_power_handler(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ uint32_t rcv_size = 0;
+ T_SS_SM_UserModeOnOffNotification_StructType power_status;
+
+ if ((rcv_size = FrameworkunifiedGetMsgLength(hApp)) != sizeof(power_status)) { // LCOV_EXCL_BR_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 4: NSFW error case
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgLength: size fail:%d", rcv_size);
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &power_status, rcv_size, eSMRRelease)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 4: NSFW error case
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize:%d", eStatus);
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ if (g_bkup_internal_state != BKUP_STATE_NORMAL) { // LCOV_EXCL_BR_LINE 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 6:double check
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Invalid state:%d", g_bkup_internal_state);
+ goto exit;
+ // LCOV_EXCL_STOP 6:double check
+ }
+
+ if (power_status.isUserModeOn == FALSE) {
+ bkup_itc_message_t snd_msg;
+
+ if (g_bkup_delay_mqd == -1) {
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((g_bkup_delay_mqd = BkupItcMqopen("/" BKUP_THREAD_DELAY, O_WRONLY|O_CREAT|O_NONBLOCK|O_CLOEXEC)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 5: mq_open's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+ }
+
+ memset(&snd_msg, 0, sizeof(snd_msg));
+ snd_msg.delay.cmd = BKUP_DELAY_CMD_PRE_ACCOFF;
+
+ // LCOV_EXCL_BR_START 5: mq_send's error case.
+ if (mq_send(g_bkup_delay_mqd, (char *)&snd_msg, sizeof(snd_msg), 0) < 0) {
+ // LCOV_EXCL_BR_START 5: mq_send's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 5: mq_send's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_send:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mq_send's error case.
+ }
+ }
+
+exit:
+ return eStatus;
+}
+
+
+/**
+ * thread's response
+ */
+static int BkupSetResponseThread(void *opt, void *buf, int size, EFrameworkunifiedStatus ret_value) {
+ HANDLE response_mq;
+ char invoker_name[MAX_QUEUE_NAME_SIZE];
+ if (opt == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "opt is NULL");
+ return -1;
+ }
+ bkup_itc_message_t *msg = reinterpret_cast<bkup_itc_message_t *>(opt);
+ EFrameworkunifiedStatus e_status;
+ // LCOV_EXCL_BR_START 11:unexpected branch.
+ McCreateInvokerName(msg->nand.client_name, 0, invoker_name, sizeof(invoker_name));
+ // LCOV_EXCL_BR_STOP 11:unexpected branch.
+
+ if (g_bkup_response_mq == NULL) {
+ g_bkup_response_mq = new g_bkup_response_mq_t; // LCOV_EXCL_BR_LINE 11:except,C++ operator
+ }
+ g_bkup_response_mq_t::iterator mq_it = g_bkup_response_mq->find(invoker_name); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (mq_it != g_bkup_response_mq->end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ response_mq = mq_it->second; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ } else {
+ if ((response_mq = McOpenSyncSender(invoker_name)) == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mcOpenSyncSender");
+ return -1;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ g_bkup_response_mq->insert(std::make_pair(invoker_name, response_mq)); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch.
+ e_status = McSendSyncResponse(response_mq, MN_NS_BACKUPMGR, BACKUP_CID, msg->nand.seq_id, ret_value, size, buf);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch.
+ return (e_status == eFrameworkunifiedStatusOK) ? 0 : -1; // LCOV_EXCL_BR_LINE 11:unexpected branch
+}
+
+/**
+ * NAND Thread
+ */
+void *BkupNandThread(void *arg) {
+ mqd_t mqd;
+ struct pollfd fds[1];
+ bkup_itc_message_t rcv_msg;
+ bkup_protocol_header_t *hdr;
+ bkup_query_result_t query_result;
+ bkup_response_t response_thread = {BkupSetResponseThread, NULL};
+
+ signal_handler p_signal = SignalHandlerFuncForMsgHandleThread;
+ signal(SIGUSR1, p_signal);
+ g_nand_thread_id = pthread_self();
+
+ if (prctl(PR_SET_NAME, BKUP_THREAD_NAND) < 0) { // LCOV_EXCL_BR_LINE 5: prctl's error case.
+ // LCOV_EXCL_START 5: prctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "prctl(PR_SET_NAME):%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: prctl's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((mqd = BkupItcMqopen("/" BKUP_THREAD_NAND, O_RDONLY | O_CREAT | O_CLOEXEC)) < -1) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ // LCOV_EXCL_START 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+ g_bkup_nand_tid = static_cast<int>(syscall(__NR_gettid));
+
+ fds[0].fd = mqd;
+ fds[0].events = POLLIN;
+
+ while (1) {
+ int ret = poll(fds, sizeof(fds) / sizeof(struct pollfd), -1); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: poll's error case.
+ // LCOV_EXCL_START 5: poll's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == EINTR) {
+ continue;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "poll errno:%s", strerror(errno));
+ // LCOV_EXCL_STOP 5: poll's error case.
+ } else {
+ if ((fds[0].revents & POLLIN) != 0) {
+ // LCOV_EXCL_BR_START 5: mq_receive's error case.
+ if (mq_receive(mqd, reinterpret_cast<char *>(&rcv_msg), sizeof(rcv_msg), NULL) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_receive's error case.
+ // LCOV_EXCL_START 5: mq_receive's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_receive:%s", strerror(errno));
+ }
+ continue;
+ // LCOV_EXCL_STOP 5: mq_receive's error case.
+ }
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_msg.nand.rcv_buf);
+ BkupParamGet(hdr->item_name, &query_result); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ response_thread.opt = &rcv_msg;
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupHandlerFile(&response_thread, NVHALMEDIA_NAND, rcv_msg.nand.rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+
+ munmap(rcv_msg.nand.rcv_buf, rcv_msg.nand.rcv_size);
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/*
+ * delay backup thread
+ */
+typedef struct {
+ int fd;
+ std::string name;
+} bkup_delay_t; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+static int BkupDelayTimerAdd(int efd, const char *item_name, time_t backup_cycle) {
+ int ret = -1;
+ struct epoll_event ev;
+ bkup_delay_t *timer_ev = new bkup_delay_t; // LCOV_EXCL_BR_LINE 11:except,C++ operator
+ struct itimerspec itime;
+
+ if ((timer_ev->fd = timerfd_create(CLOCK_MONOTONIC, 0)) < 0) { // LCOV_EXCL_BR_LINE 5: timerfd_create's error case.
+ // LCOV_EXCL_START 5: timerfd_create's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_create:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5: timerfd_create's error case.
+ }
+ timer_ev->name = item_name; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ ev.events = EPOLLIN;
+ ev.data.ptr = timer_ev;
+ if (epoll_ctl(efd, EPOLL_CTL_ADD, timer_ev->fd, &ev) < 0) { // LCOV_EXCL_BR_LINE 5: epoll_ctl's error case.
+ // LCOV_EXCL_START 5: epoll_ctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5: epoll_ctl's error case.
+ }
+
+ memset(&itime, 0, sizeof(itime));
+ itime.it_value.tv_sec = backup_cycle;
+ itime.it_interval.tv_sec = backup_cycle;
+
+ if (timerfd_settime(timer_ev->fd, 0, &itime, NULL) < 0) { // LCOV_EXCL_BR_LINE 5: timerfd_settime's error case.
+ // LCOV_EXCL_START 5: timerfd_settime's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_settime:%s", strerror(errno));
+ epoll_ctl(efd, EPOLL_CTL_DEL, timer_ev->fd, &ev);
+ goto exit;
+ // LCOV_EXCL_STOP 5: timerfd_settime's error case.
+ }
+ ret = 0;
+
+exit:
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: C API's error case.
+ // LCOV_EXCL_START 5: C API's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (timer_ev->fd >= 0) {
+ if (close(timer_ev->fd) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_settime:%s", strerror(errno));
+ }
+ }
+ delete timer_ev;
+ }
+ // LCOV_EXCL_STOP 5: C API's error case.
+ return ret;
+}
+
+static uint64_t *g_bkup_syncreq;
+static pthread_rwlock_t g_syncreq_rwlock = PTHREAD_RWLOCK_INITIALIZER;
+#define BKUP_SYNCREQ_SIZE (4096)
+#define BKUP_SYNCREQ_ID_MAX (BKUP_SYNCREQ_SIZE * 8 - 1)
+#define BKUP_SYNCREQ_NAME "syncreq"
+
+static int BkupSyncreqInit(void) {
+ int ret = -1;
+ char *map;
+
+ map = reinterpret_cast<char *>(mmap(NULL, BKUP_SYNCREQ_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
+ if (map == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 5: mmap's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap failed");
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ g_bkup_syncreq = reinterpret_cast<uint64_t *>(map);
+ memset(g_bkup_syncreq, 0, BKUP_SYNCREQ_SIZE);
+
+ pthread_rwlock_wrlock(&g_syncreq_rwlock);
+ BkupBufferWriteToNv(NVHALMEDIA_BACKUPDRAM, BKUP_SYNCREQ_NAME,
+ reinterpret_cast<char *>(g_bkup_syncreq),
+ BKUP_SYNCREQ_SIZE, NULL);
+ pthread_rwlock_unlock(&g_syncreq_rwlock);
+ ret = 0;
+
+exit:
+ return ret;
+}
+
+static void BkupSyncreqTerm(void) {
+ if (g_bkup_syncreq != NULL) { // LCOV_EXCL_BR_LINE 6:g_bkup_syncreq will not be NULL
+ munmap(g_bkup_syncreq, BKUP_SYNCREQ_SIZE);
+ g_bkup_syncreq = NULL;
+ }
+}
+
+static int BkupSyncreqSet(int id) {
+ if (g_bkup_syncreq == NULL) { // LCOV_EXCL_BR_LINE 6:g_bkup_syncreq will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: mmap's error case.
+ }
+ if (id > BKUP_SYNCREQ_ID_MAX) {
+ return -1;
+ }
+ if (!(*(g_bkup_syncreq + id / 64) & (1ULL << (id % 64)))) {
+ *(g_bkup_syncreq + id / 64) |= (1ULL << (id % 64));
+ pthread_rwlock_wrlock(&g_syncreq_rwlock);
+ BkupBufferWriteToNv(NVHALMEDIA_BACKUPDRAM, BKUP_SYNCREQ_NAME,
+ reinterpret_cast<char *>(g_bkup_syncreq),
+ BKUP_SYNCREQ_SIZE, NULL);
+ pthread_rwlock_unlock(&g_syncreq_rwlock);
+ }
+ return 0;
+}
+
+static int BkupSyncreqClear(int id) {
+ if (g_bkup_syncreq == NULL) { // LCOV_EXCL_BR_LINE 6:g_bkup_syncreq will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: mmap's error case.
+ }
+ if (id > BKUP_SYNCREQ_ID_MAX) {
+ return -1;
+ }
+ if (*(g_bkup_syncreq + id / 64) & (1ULL << (id % 64))) {
+ *(g_bkup_syncreq + id / 64) &= ~(1ULL << (id % 64));
+ pthread_rwlock_wrlock(&g_syncreq_rwlock);
+ BkupBufferWriteToNv(NVHALMEDIA_BACKUPDRAM, BKUP_SYNCREQ_NAME,
+ reinterpret_cast<char *>(g_bkup_syncreq),
+ BKUP_SYNCREQ_SIZE, NULL);
+ pthread_rwlock_unlock(&g_syncreq_rwlock);
+ }
+
+ return 0;
+}
+
+static inline int BkupPopcnt64(uint64_t x) {
+ uint64_t n;
+
+ n = (x >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ n = (n >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ n = (n >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fULL;
+ x = x * 0x0101010101010101ULL;
+ return static_cast<int>(x >> 56);
+}
+
+static int BkupSyncreqSearch(void) {
+ int i;
+
+ if (g_bkup_syncreq == NULL) { // LCOV_EXCL_BR_LINE 6:g_bkup_syncreq will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: mmap's error case.
+ }
+
+ for (i = 0; i < static_cast<int>(BKUP_SYNCREQ_SIZE / sizeof(uint64_t)); i++) {
+ if (*(g_bkup_syncreq + i) != 0) {
+ uint64_t bits, mrb1; // most right bit 1
+ bits = *(g_bkup_syncreq + i);
+ mrb1 = bits & (-bits);
+ return i * 64 + BkupPopcnt64(mrb1 - 1);
+ }
+ }
+
+ return -1;
+}
+
+static void BkupSyncreqDone(bool skip_cache) {
+ int id;
+ uint64_t start, end;
+
+ start = BkupTimerReal();
+
+ while ((id = BkupSyncreqSearch()) >= 0) {
+ char item_name[64];
+ bkup_query_result_t query_result;
+
+ if (BkupParamGetNumid(id, &query_result, item_name, sizeof(item_name)) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", id);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ } else {
+ if (query_result.cache_dram) {
+ if (!skip_cache) {
+ BkupMediaCopyFromNv(query_result.category_name, item_name,
+ NVHALMEDIA_CACHEDRAM, NVHALMEDIA_NAND, NULL,
+ NULL);
+ }
+ } else if (query_result.backup_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupMediaCopyFromNv(query_result.category_name, item_name,
+ NVHALMEDIA_BACKUPDRAM, NVHALMEDIA_NAND, NULL, NULL);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+ }
+
+ BkupSyncreqClear(id); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ }
+
+ end = BkupTimerReal();
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "spent:%" PRIu64 ".%06" PRIu64 "ms",
+ static_cast<uint64_t>((end - start) / 1000000),
+ static_cast<uint64_t>((end - start) % 1000000));
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+}
+
+void BkupSyncreqRestart(void) {
+ char *map;
+
+ map = reinterpret_cast<char *>(mmap(NULL, BKUP_SYNCREQ_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
+ if (map == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 5: mmap's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap failed");
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ g_bkup_syncreq = reinterpret_cast<uint64_t *>(map);
+
+ if (BkupBufferReadFromNv(NVHALMEDIA_BACKUPDRAM, BKUP_SYNCREQ_NAME,
+ reinterpret_cast<char *>(g_bkup_syncreq),
+ BKUP_SYNCREQ_SIZE, NULL) < 0) {
+ goto exit;
+ }
+ BkupSyncreqDone(true);
+ BkupSyncreqTerm();
+
+exit:
+ return;
+}
+
+void *BkupDelayThread(void *arg) {
+ mqd_t mqd;
+ int efd;
+ struct epoll_event ev;
+ bkup_delay_t *mq_ev;
+ bkup_itc_message_t rcv_msg;
+ std::map<std::string, int> delay_req; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ signal_handler p_signal = SignalHandlerFuncForMsgHandleThread;
+ signal(SIGUSR1, p_signal);
+ g_delay_thread_id = pthread_self();
+
+
+ if (prctl(PR_SET_NAME, BKUP_THREAD_DELAY) < 0) { // LCOV_EXCL_BR_LINE 5: prctl's error case.
+ // LCOV_EXCL_START 5: prctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "prctl(PR_SET_NAME):%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: prctl's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((mqd = BkupItcMqopen("/" BKUP_THREAD_DELAY, O_RDONLY | O_CREAT | O_CLOEXEC)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ // LCOV_EXCL_START 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+
+ if ((efd = epoll_create(MAX_FD_EPOLL)) < 0) { // LCOV_EXCL_BR_LINE 5: epoll_create's error case.
+ // LCOV_EXCL_START 5: epoll_create's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "epoll_create:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: epoll_create's error case.
+ }
+ g_bkup_delay_tid = static_cast<int>(syscall(__NR_gettid));
+
+ mq_ev = new bkup_delay_t; // LCOV_EXCL_BR_LINE 11:except,C++ operator
+ mq_ev->fd = static_cast<int>(mqd);
+ mq_ev->name = "mq"; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ ev.events = EPOLLIN;
+ ev.data.ptr = mq_ev;
+ // LCOV_EXCL_BR_START 5: epoll_ctl's error case.
+ if (epoll_ctl(efd, EPOLL_CTL_ADD, static_cast<int>(mqd), &ev) < 0) {
+ // LCOV_EXCL_BR_STOP 5: epoll_ctl's error case.
+ // LCOV_EXCL_START 5: epoll_ctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: epoll_ctl's error case.
+ }
+
+ while (1) {
+ struct epoll_event events[MAX_FD_EPOLL];
+ int nfds;
+
+ nfds = epoll_wait(efd, events, MAX_FD_EPOLL, -1); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (nfds < 0) { // LCOV_EXCL_BR_LINE 5: epoll_wait's error case.
+ // LCOV_EXCL_START 5: epoll_wait's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "epoll_wait:%s", strerror(errno));
+ }
+ continue;
+ // LCOV_EXCL_STOP 5: epoll_wait's error case.
+ }
+
+ for (int i = 0; i < nfds; i++) {
+ bkup_delay_t *cur_ev = reinterpret_cast<bkup_delay_t *>(events[i].data.ptr);
+
+ if (cur_ev->fd == mqd) {
+ /*
+ * mq
+ */
+ // LCOV_EXCL_BR_START 5: mq_receive's error case.
+ if (mq_receive(mqd, reinterpret_cast<char *>(&rcv_msg), sizeof(rcv_msg), NULL) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_receive's error case.
+ // LCOV_EXCL_START 5: mq_receive's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_receive:%s", strerror(errno));
+ }
+ continue;
+ // LCOV_EXCL_STOP 5: mq_receive's error case.
+ }
+
+#if 0
+ if (rcv_msg.delay.terminate) {
+ // terminate request
+ // shutdown sync
+ BkupSyncreqDone(false); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ for (std::map<std::string, int>::iterator i = delay_req.begin(); i != delay_req.end(); ++i) {
+ i->second = 0; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+
+ // terminate finish response
+ int64_t term_event = 1;
+ // LCOV_EXCL_BR_START 5: write's error case.
+ if (write(rcv_msg.delay.event_fd, &term_event, sizeof(term_event)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: write's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "write:%s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case.
+ }
+ } else {
+ // delay request
+ bkup_query_result_t query_result;
+ BkupParamGet(rcv_msg.delay.item_name, &query_result); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ if (query_result.backup_cycle > 0) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (delay_req.find(rcv_msg.delay.item_name) != delay_req.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ delay_req[rcv_msg.delay.item_name]++; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ } else {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupDelayTimerAdd(efd, rcv_msg.delay.item_name, query_result.backup_cycle);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ delay_req[rcv_msg.delay.item_name] = 1; // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ if (BkupSyncreqSet(query_result.id) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", query_result.id);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ // write to ACC OFF
+ bkup_query_result_t query_result;
+ if (BkupParamGet(rcv_msg.delay.item_name, &query_result) < 0) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid item_name:%s",
+ rcv_msg.delay.item_name != 0 ? rcv_msg.delay.item_name : NULL);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ } else {
+ if (BkupSyncreqSet(query_result.id) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", query_result.id);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ }
+ }
+ }
+#endif
+ switch (rcv_msg.delay.cmd) {
+ case BKUP_DELAY_CMD_TERM:
+ case BKUP_DELAY_CMD_PRE_ACCOFF:
+ /*
+ * terminate or pre-acc_off request
+ */
+ // shutdown sync
+ BkupSyncreqDone(false);
+
+ for (std::map<std::string, int>::iterator i = delay_req.begin(); i != delay_req.end(); ++i) {
+ i->second = 0;
+ }
+
+ if (rcv_msg.delay.cmd == BKUP_DELAY_CMD_TERM) {
+ BkupSyncreqTerm();
+
+ // terminate finish response
+ int64_t term_event = 1;
+ // LCOV_EXCL_BR_START 5: write's error case.
+ if (write(rcv_msg.delay.event_fd, &term_event, sizeof(term_event)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: write's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "write:%s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case.
+ }
+ }
+ break;
+
+ case BKUP_DELAY_CMD_REGIST:
+ // delay regist request
+ bkup_query_result_t query_result;
+ BkupParamGet(rcv_msg.delay.item_name, &query_result);
+
+ if (query_result.backup_cycle > 0) {
+ if (delay_req.find(rcv_msg.delay.item_name) != delay_req.end()) {
+ delay_req[rcv_msg.delay.item_name]++;
+ } else {
+ BkupDelayTimerAdd(efd, rcv_msg.delay.item_name, query_result.backup_cycle);
+ delay_req[rcv_msg.delay.item_name] = 1;
+ }
+
+ if (BkupSyncreqSet(query_result.id) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", query_result.id);
+ }
+ } else {
+ // wite to ACC OFF
+ bkup_query_result_t query_result;
+ if (BkupParamGet(rcv_msg.delay.item_name, &query_result) < 0) { // LCOV_EXCL_BR_LINE 6:double check
+ // LCOV_EXCL_START 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid item_name:%s", rcv_msg.delay.item_name);
+ // LCOV_EXCL_STOP 6:double check
+ } else {
+ if (BkupSyncreqSet(query_result.id) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", query_result.id);
+ }
+ }
+ }
+ break;
+ }
+
+ } else {
+ /*
+ * timerfd
+ */
+ uint64_t exp;
+ if (read(cur_ev->fd, &exp, sizeof(exp)) < 0) { // LCOV_EXCL_BR_LINE 5: read's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "read:%s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case.
+ }
+
+ if (delay_req[cur_ev->name] > 0) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ bkup_query_result_t query_result;
+ BkupParamGet(cur_ev->name.c_str(), &query_result); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ if (query_result.cache_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *src_rwlock = BkupGetRwlock(
+ cur_ev->name.c_str(), NVHALMEDIA_CACHEDRAM, &query_result);
+ pthread_rwlock_t *dst_rwlock = BkupGetRwlock(
+ cur_ev->name.c_str(), NVHALMEDIA_NAND, &query_result);
+ BkupMediaCopyFromNv(query_result.category_name,
+ cur_ev->name.c_str(), NVHALMEDIA_CACHEDRAM,
+ NVHALMEDIA_NAND, src_rwlock, dst_rwlock);
+ BkupMediaCopyFromNv(query_result.category_name,
+ cur_ev->name.c_str(), NVHALMEDIA_CACHEDRAM,
+ NVHALMEDIA_NAND, NULL, NULL);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ } else if (query_result.backup_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *src_rwlock = BkupGetRwlock(
+ cur_ev->name.c_str(), NVHALMEDIA_BACKUPDRAM, &query_result);
+ pthread_rwlock_t *dst_rwlock = BkupGetRwlock(
+ cur_ev->name.c_str(), NVHALMEDIA_NAND, &query_result);
+ BkupMediaCopyFromNv(query_result.category_name,
+ cur_ev->name.c_str(), NVHALMEDIA_BACKUPDRAM,
+ NVHALMEDIA_NAND, src_rwlock, dst_rwlock);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+ delay_req[cur_ev->name] = 0; // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (BkupSyncreqClear(query_result.id) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", query_result.id);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ // not update. timer delte
+ // LCOV_EXCL_BR_START 5: epoll_ctl's error case.
+ if (epoll_ctl(efd, EPOLL_CTL_DEL, cur_ev->fd, &events[i]) < 0) {
+ // LCOV_EXCL_BR_STOP 5: epoll_ctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "epoll_ctl:%s", strerror(errno)); // LCOV_EXCL_LINE 5: epoll_ctl's error case.
+ }
+ if (close(cur_ev->fd) < 0) { // LCOV_EXCL_BR_LINE 5: close's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "close:%s", strerror(errno)); // LCOV_EXCL_LINE 5: close's error case.
+ }
+ delay_req.erase(cur_ev->name); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ delete cur_ev; // LCOV_EXCL_BR_LINE 11:except,C++ operator
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/**
+ * Terminate handler
+ */
+EFrameworkunifiedStatus BkupTerminateHandler(HANDLE h_app) {
+ bkup_itc_message_t snd_msg;
+ int event_fd;
+ int64_t term_event;
+
+ g_bkup_internal_state = BKUP_STATE_TERM;
+
+ if (g_bkup_delay_mqd == -1) {
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((g_bkup_delay_mqd = BkupItcMqopen("/" BKUP_THREAD_DELAY, O_WRONLY | O_CREAT | O_NONBLOCK | O_CLOEXEC)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ // LCOV_EXCL_START 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+ }
+
+ if ((event_fd = eventfd(0, 0)) < 0) { // LCOV_EXCL_BR_LINE 5: eventfd's error case.
+ // LCOV_EXCL_START 5: eventfd's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "eventfd:%s", strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP 5: eventfd's error case.
+ }
+
+ memset(&snd_msg, 0, sizeof(snd_msg));
+
+// snd_msg.delay.terminate = true;
+ snd_msg.delay.cmd = BKUP_DELAY_CMD_TERM;
+
+ snd_msg.delay.event_fd = event_fd;
+
+ // LCOV_EXCL_BR_START 5: mq_send's error case.
+ if (mq_send(g_bkup_delay_mqd, reinterpret_cast<char *>(&snd_msg), sizeof(snd_msg), 0) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_send's error case.
+ // LCOV_EXCL_START 5: mq_send's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_send:%s", strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP 5: mq_send's error case.
+ }
+
+ while (1) {
+ if (read(event_fd, &term_event, sizeof(term_event)) < 0) { // LCOV_EXCL_BR_LINE 5: read's error case.
+ // LCOV_EXCL_START 5: read's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == EINTR) {
+ continue;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "read:%s", strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP 5: read's error case.
+ } else {
+ break;
+ }
+ }
+ if (close(event_fd) < 0) { // LCOV_EXCL_BR_LINE 5: close's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "close:%s", strerror(errno)); // LCOV_EXCL_LINE 5: close's error case.
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Init handler
+ */
+EFrameworkunifiedStatus BkupInitHandler(HANDLE h_app) {
+ BkupSyncreqRestart();
+ BkupSyncreqInit();
+
+ g_bkup_internal_state = BKUP_STATE_NORMAL;
+
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/nsframework/common_library/LICENSE b/nsframework/common_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/nsframework/common_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/nsframework/common_library/Makefile.client b/nsframework/common_library/Makefile.client
new file mode 100755
index 0000000..e6210c4
--- /dev/null
+++ b/nsframework/common_library/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../native_service.mk
diff --git a/nsframework/common_library/client/Makefile b/nsframework/common_library/client/Makefile
new file mode 100755
index 0000000..4bda2aa
--- /dev/null
+++ b/nsframework/common_library/client/Makefile
@@ -0,0 +1,30 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+INST_SHLIBS := libcommon
+
+libcommon_SRCS := cl_process.c cl_sem.c cl_monitor.c cl_region.c cl_lock.c cl_cgroup.c
+INST_HEADERS := common_library.h cl_process.h cl_sem.h cl_monitor.h cl_lock.h cl_region.h cl_lockid.h
+
+VPATH = ./src ./include/$(COMPONENT_NAME)
+
+CPPFLAGS += -I./include/
+
+LDFLAGS += -Wl,--no-as-needed
+
+LDLIBS += -lrt
+
+include ../../native_service.mk
diff --git a/nsframework/common_library/client/include/cl_cgroup.h b/nsframework/common_library/client/include/cl_cgroup.h
new file mode 100755
index 0000000..10a7179
--- /dev/null
+++ b/nsframework/common_library/client/include/cl_cgroup.h
@@ -0,0 +1,35 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_cgroup_h_ // NOLINT(build/header_guard)
+#define _cl_cgroup_h_ // NOLINT(build/header_guard)
+
+typedef enum {
+ CL_CGROUP_MEMORY,
+ CL_CGROUP_CPU,
+} cl_cgroup_t;
+
+int cl_cgroup_make(cl_cgroup_t cgroup, const char *cgroup_name); // NOLINT(readability/nolint)
+int cl_cgroup_remove(cl_cgroup_t cgroup, const char *cgroup_name); // NOLINT(readability/nolint)
+int cl_cgroup_exist(cl_cgroup_t cgroup, const char *cgroup_name); // NOLINT(readability/nolint)
+int cl_cgroup_open(cl_cgroup_t cgroup, const char *cgroup_name, // NOLINT(readability/nolint)
+ const char *controler, int flags);
+int cl_cgroup_set_string(cl_cgroup_t cgroup, const char *cgroup_name, // NOLINT(readability/nolint)
+ const char *controler, const char *str);
+int cl_cgroup_set_num(cl_cgroup_t cgroup, const char *cgroup_name, // NOLINT(readability/nolint)
+ const char *controler, int64_t value);
+
+#endif // ifndef _cl_cgroup_h_ // NOLINT(build/header_guard)
diff --git a/nsframework/common_library/client/include/cl_error.h b/nsframework/common_library/client/include/cl_error.h
new file mode 100755
index 0000000..84bf64e
--- /dev/null
+++ b/nsframework/common_library/client/include/cl_error.h
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_error_h_ // NOLINT(build/header_guard)
+#define _cl_error_h_ // NOLINT(build/header_guard)
+
+#include <stdio.h>
+#include <unistd.h>
+#include <asm/unistd.h>
+
+static inline int gettid(void) { // NOLINT(readability/nolint)
+ return (int)syscall(__NR_gettid); // NOLINT(readability/casting)
+}
+
+#define _num_to_str(num) #num
+#define num_to_str(num) _num_to_str(num)
+#define CL_PERROR(msg) \
+ perror(__FILE__ ":" num_to_str(__LINE__)":"msg)
+
+#define CL_ERR_PRINT(fmt, args...) \
+ fprintf(stderr, "[ERR]%d %s:%d:"fmt"\n", gettid(), __func__, __LINE__, ##args)
+
+#if defined(CL_DBG_ENABLE)
+#define CL_DBG_PRINT(fmt, args...) \
+ fprintf(stdout, "[DBG]%d %s:%d:"fmt"\n", gettid(), __func__, __LINE__, ##args)
+#else
+#define CL_DBG_PRINT(fmt, args...)
+#endif
+
+
+#endif // #ifndef _cl_error_h_ // NOLINT(build/header_guard)
diff --git a/nsframework/common_library/client/include/cl_lock_internal.h b/nsframework/common_library/client/include/cl_lock_internal.h
new file mode 100755
index 0000000..7a2f623
--- /dev/null
+++ b/nsframework/common_library/client/include/cl_lock_internal.h
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_lock_internal_h_ // NOLINT(build/header_guard)
+#define _cl_lock_internal_h_ // NOLINT(build/header_guard)
+
+#include <native_service/cl_lockid.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file cl_lock_internal.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+#define LOCKFILE_NAME "lockfile" // lock file name
+#define SLOT_SIZE 4096 // slot size
+#define LOCKFILE_SIZE SLOT_SIZE * LID_NUM // the lock file size
+
+#define LOCK_TIMEOUT 3 // timeout(sec) for CL_LockTimedGet
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef _cl_lock_internal_h_ // NOLINT(build/header_guard)
diff --git a/nsframework/common_library/client/include/cl_monitor_internal.h b/nsframework/common_library/client/include/cl_monitor_internal.h
new file mode 100755
index 0000000..0a864a2
--- /dev/null
+++ b/nsframework/common_library/client/include/cl_monitor_internal.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_monitor_internal_h_ // NOLINT(build/header_guard)
+#define _cl_monitor_internal_h_ // NOLINT(build/header_guard)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int cl_monitor_cleanup(int pid); // NOLINT(readability/nolint)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef _cl_monitor_internal_h_ */
diff --git a/nsframework/common_library/client/include/cl_process_internal.h b/nsframework/common_library/client/include/cl_process_internal.h
new file mode 100755
index 0000000..ce001de
--- /dev/null
+++ b/nsframework/common_library/client/include/cl_process_internal.h
@@ -0,0 +1,53 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_process_internal_h_ // NOLINT(build/header_guard)
+#define _cl_process_internal_h_ // NOLINT(build/header_guard)
+
+typedef struct {
+ char name[20];
+ uid_t uid;
+ gid_t gid;
+ int sched_policy;
+ int sched_priority;
+ int create_group;
+ int stack_size;
+ int cpu_assign;
+ int hold_fds[CL_PROCESSS_ATTR_HOLD_FDS_NUM];
+ int disable_close_fds;
+ char cgroup_name[64];
+} CL_ProcessAttrInternal_t;
+
+typedef struct {
+ char name[20];
+} CL_ThreadAttrInternal_t;
+
+typedef struct {
+ int rt_runtime_us;
+ int cfs_quota_us;
+ int cpu_shares;
+ int memory_limit;
+ int usage_in_bytes;
+ int event_fd;
+} CL_ProcessCreateCgroupAttrInternal_t;
+
+#define CL_PROCESS_NAME_ENV "CL_PROCESS_NAME"
+
+#define CL_PROCESS_EXIT_INTERNAL 0x80
+
+#define CL_PROCESS_CGROUP_NAME_FORMAT "CGRP%05d"
+
+#endif // #ifndef _cl_process_internal_h_ // NOLINT(build/header_guard)
diff --git a/nsframework/common_library/client/include/native_service/cl_lock.h b/nsframework/common_library/client/include/native_service/cl_lock.h
new file mode 100755
index 0000000..d974540
--- /dev/null
+++ b/nsframework/common_library/client/include/native_service/cl_lock.h
@@ -0,0 +1,259 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _cl_lock_h_ // NOLINT(build/header_guard)
+#define _cl_lock_h_ // NOLINT(build/header_guard)
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file cl_lock.h
+ * @brief \~english This file contains the base api of cl_clock.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockSystemInit
+/// \~english @par Brief
+/// Initialize the system lock.
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - On system call shm_open error, -1 is returned.
+/// - On system call ftrancate error, -1 is returned.
+/// - On system call mmap error, -1 is returned.
+/// - On system call pthread_mutexattr_setpshared error, -1 is returned.
+/// \~english @par Detail
+/// This function will generate the Lock file, and initialize all the pthread_mutex_t slots.\n
+/// This function must to be called in the system once, which is recommended on the SystemManager start.\n
+/// \~english @par
+/// Lock file is formed with lots of slots. Every slot occupies 4KB.
+/// The slot layout is:
+/// 0 ~ 4Byte : field of PID
+/// 4Byte ~ 28Byte : field of pthread_mutex_t
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int32_t CL_LockSystemInit(void); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockProcessInit
+/// \~english @par Brief
+/// Initialize the process Lock file.
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// Should call CL_LockSystemInit() to generate Lock file.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - On system call shm_open error, -1 is returned.
+/// \~english @par Detail
+/// Open the Lock file.\n
+/// If process want to use the Lock, this function should be called.\n
+/// It is recommended that this function should be called since start main function.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int32_t CL_LockProcessInit(void); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockMap
+/// \~english @par Brief
+/// Mapping the Lock information address.
+/// \~english @param [in] lid
+/// int32_t - LockID of the Lock used.(0~LID_NUM) \n
+/// \~english @retval addr Lock address
+/// \~english @retval MAP_FAILED Error (errno)
+/// \~english @par Prerequisite
+/// Should call CL_LockSystemInit(), CL_LockProcessInit() to open the Lock file.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - If LockID(lid) < 0, errno is set as EINVAL, and MAP_FAILED is returned
+/// - If LockID(lid) > LID_NUM, errno is set as EINVAL, and MAP_FAILED is returned
+/// - If systemcall mmap is failure, errno is set euqal with the errno of mmap, and MAP_FAILED is returned
+/// \~english @par Detail
+/// Mapping the Lock information to the memory.\n
+/// The related LockID should be assigned, when apply the share memory.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// CL_LockUnmap
+////////////////////////////////////////////////////////////////////////////////////
+void *CL_LockMap(int32_t lid); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockUnmap
+/// \~english @par Brief
+/// Unmapping the Lock information.
+/// \~english @param [in] addr
+/// void* - Lock information address.
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// Should call CL_LockSystemInit(), CL_LockProcessInit() before this function is called
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - If systemcall munmap is failure, errno is set euqal with the errno of munmap, -1 is returned
+/// \~english @par Detail
+/// 0 would be returned, even if not get the Lock.
+/// The addr is the Lock information address that acquired from CL_LockMap.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// CL_LockMap
+////////////////////////////////////////////////////////////////////////////////////
+int32_t CL_LockUnmap(void *addr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockGet
+/// \~english @par Brief
+/// Get the Lock. Block until get the Lock.
+/// \~english @param [in] addr
+/// void* - Lock information address.
+/// \~english @retval 0 Success
+/// \~english @retval EINVAL Invalid parameter
+/// \~english @retval EDEADLK Mutex already locked
+/// \~english @par Prerequisite
+/// Should call CL_LockMap to get the Lock information address.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - EINVAL as the parameter of Lock information address is NULL
+/// - EINVAL as the parameter of Lock information address is MAP_FAILED
+/// - EINVAL as the mutex does not be initialized in the systemcall pthread_mutex_lock failure.
+/// - EDEADLK as the current thread already owns the mutex in the systemcall pthread_mutex_lock failure.
+/// \~english @par Detail
+/// Get the Lock until other threads release it.
+/// It will be deadlock if the current thread already owns the mutex.
+/// The addr is the Lock information address that should be acquired from CL_LockMap.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// CL_LockRelease
+////////////////////////////////////////////////////////////////////////////////////
+int32_t CL_LockGet(void *addr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockNowait
+/// \~english @par Brief
+/// Try to get Lock, shall immediately return.
+/// \~english @param [in] addr
+/// void* - Lock information address.
+/// \~english @retval 0 Success
+/// \~english @retval EINVAL Invalid parameter
+/// \~english @retval EBUSY Busy
+/// \~english @par Prerequisite
+/// Should call CL_LockMap to get the Lock information address.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - EINVAL as input parameter addr, the Lock information address is NULL
+/// - EINVAL as input parameter addr, the Lock information address if MAP_FAILED
+/// - EINVAL as the mutex does not be initialized in the systemcall pthread_mutex_trylock failure.
+/// - EBUSY as the mutex could not be acquired as it was already locked in the
+/// systemcall pthread_mutex_trylock failure.
+/// \~english @par Detail
+/// The addr is the Lock information address that should be acquired from CL_LockMap.
+/// Get the Lock information from the pointed share memory.
+/// Shall immediately return while not acquire the Lock.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// CL_LockRelease
+////////////////////////////////////////////////////////////////////////////////////
+int32_t CL_LockNowait(void *addr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockRelease
+/// \~english @par Brief
+/// Release the Lock.
+/// \~english @param [in] addr
+/// addr - Lock information address.
+/// \~english @retval 0 Success
+/// \~english @retval EINVAL Invalid parameter
+/// \~english @retval EPERM The current thread does not own the mutex
+/// \~english @par Prerequisite
+/// - Should call CL_LockMap to get the Lock information address.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - EINVAL as input parameter addr, the Lock information address is NULL
+/// - EINVAL as input parameter addr, the Lock information address if MAP_FAILED
+/// - EINVAL as the mutex does not be initialized in the systemcall pthread_mutex_unlock failure.
+/// - EPERM as the current thread does not own the mutex in the systemcall pthread_mutex_unlock failure.
+/// \~english @par Detail
+/// 0 would be returned, even if not get the Lock.
+/// The addr is the Lock information address that should be acquired from CL_LockMap.
+/// Release the Lock related with the share memory.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// CL_LockGet, CL_LockNowait
+////////////////////////////////////////////////////////////////////////////////////
+int CL_LockRelease(void *addr); // NOLINT(readability/nolint)
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#define LOCK_POS_MTX_RSV 40
+#define LOCK_HRDS_RSV 15
+#define LOCK_NSLOG_ACCES_IF_RSV 50
+#define LID_NUM 140
+#endif // #ifndef _cl_lock_h_ // NOLINT(build/header_guard)
diff --git a/nsframework/common_library/client/include/native_service/cl_lockid.h b/nsframework/common_library/client/include/native_service/cl_lockid.h
new file mode 100755
index 0000000..a790a4b
--- /dev/null
+++ b/nsframework/common_library/client/include/native_service/cl_lockid.h
@@ -0,0 +1,180 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file cl_lockid.h
+ * @brief Definition of LockID(LID)
+ *
+ */
+
+#ifndef _cl_lockid_h_ // NOLINT(build/header_guard)
+#define _cl_lockid_h_ // NOLINT(build/header_guard)
+#include <native_service/cl_lock.h>
+#include <assert.h>
+
+/**
+ * @file cl_lockid.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+/*
+ * Numbering rules
+ * Assign LID corresponding to the Lock name specified when requesting shared memories.
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ENUM_LOCK_ID
+/// \~english @par Brief
+/// ID for Exclusive Control\n
+/// When AGL users add their own definitions, add "_**" to the definitions.\n
+/// ("**" is an aribitrary character string indicating the organization that uses AGL.)
+/////////////////////////////////////////////////////////////////////////////////////
+
+typedef enum {
+// LID_TEST_1 = 0,
+// LID_TEST_2,
+ LOCK_ANA_LOG_SEM = 0, /* Exclusive Control to store application log on kernel unmanaged RAM*/
+ LOCK_POS_MTX_1, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_2, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_3, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_4, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_5, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_6, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_7, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_8, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_9, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_10, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_11, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_12, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_13, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_14, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_15, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_16, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_17, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_18, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_19, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_20, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_21, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_22, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_23, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_24, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_25, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_26, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_27, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_28, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_29, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_30, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_31, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_32, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_MAX, /* Exclusive Control between POSITIONING and others MAX */
+ LOCK_CLOCK_SEM_TZ = (LOCK_POS_MTX_1+LOCK_POS_MTX_RSV), /* Access control to shared memory for TimeZone */
+ LOCK_SEC_DATA_PROTECT, /* Exclusive control to shared memory for the application that use the security chip. */
+ LOCK_OS_SEM_ID__CWORD68_, /* Exclusive Control for SSL library. */
+ LOCK_ROM_ACCESS_IF, /* Exclusive access control for system manager nv area */
+ LOCK_BOOT_ACCESS_IF, /* Exclusive access control for system manager nor area */
+ LOCK_RAM_ACCESS_IF, /* Exclusive access control for system manager drambackup area */
+ LOCK_HRDS_1, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_2, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_3, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_4, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_5, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_6, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_7, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_8, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_MAX, /* Exclusive Control between DataService and others MAX */
+ LOCK_LOGG_ACCESS_IF = (LOCK_HRDS_1+LOCK_HRDS_RSV), /* Exclusive access control for NsLoggerService nv area */
+ LOCK__CWORD76__HMI, /* Exclusive Control between _CWORD76_Service and HMI's */
+ LOCK__CWORD76___CWORD58_, /* Exclusive Control between _CWORD76_Service and _CWORD58_Service */
+ LOCK_DIAGCODE_MEM, /* Exclusive Control to diag code memory area */
+ LOCK_MOUNTER_MOUNT, /* Exclusive Control for Mount */
+ LOCK_NOR_ERCNT, /* Exclusive access control for NOR erase count information */
+ LOCK_RS_WNG_HIS_LIST_DATA, /* Exclusive Control between RemoteService and RS-HMI. */
+ LOCK_RS_WNG_SCREEN_DATA, /* Exclusive Control between RemoteService and RS-HMI. */
+ LOCK_RS_SCREEN_DATA, /* Exclusive Control between RemoteService and RS-HMI. */
+ LOCK_NSLOG_ACCES_IF_1, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_2, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_3, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_4, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_5, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_6, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_7, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_8, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_9, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_10, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_11, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_12, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_13, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_14, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_15, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_16, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_17, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_18, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_19, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_20, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_21, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_22, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_23, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_24, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_25, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_26, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_27, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_28, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_29, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_30, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_31, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_32, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_33, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_34, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_35, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_36, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_37, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_38, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_39, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_40, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_41, /* Exclusive Control between writing to log file */
+
+ LOCK_NSLOG_ACCES_IF_42, /* Exclusive Control between writing to log file */
+
+ LOCK_NSLOG_ACCES_IF_43, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_MAX, /* Exclusive Control between writing to log file MAX */
+ LOCK_INFOSETTING_REV = (LOCK_NSLOG_ACCES_IF_1+LOCK_NSLOG_ACCES_IF_RSV), /* Exclusive control revision information for managing the settings */
+ LOCK_SUBMENU_SELECT, /* Exclusive control between writing the selection information of the sub-menu*/
+ LOCK_DIAG_SEM1, /* Exclusive Control between DiagService and others */
+ LOCK_DIAG_SEM2, /* Exclusive Control between Collect thread and Upload thread */
+ LID_NUM_MAX /* Number of LockID */
+} ENUM_LOCK_ID;
+
+static_assert(LOCK_POS_MTX_MAX <= (LOCK_POS_MTX_1+LOCK_POS_MTX_RSV), "LOCK_POS_MTX_RSV resource empty. Please change limit and build AGL.");
+static_assert(LOCK_HRDS_MAX <= (LOCK_HRDS_1+LOCK_HRDS_RSV), "LOCK_HRDS_RSV resource empty. Please change limit and build AGL.");
+static_assert(LOCK_NSLOG_ACCES_IF_MAX <= (LOCK_NSLOG_ACCES_IF_1+LOCK_NSLOG_ACCES_IF_RSV), "LOCK_NSLOG_ACCES_IF_RSV resource empty. Please change limit and build AGL.");
+static_assert(LID_NUM_MAX <= LID_NUM, "LOCK_ID resource empty. Please change limit and build AGL.");
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+
+#endif // #ifndef _cl_lockid_h_ // NOLINT(build/header_guard)
diff --git a/nsframework/common_library/client/include/native_service/cl_monitor.h b/nsframework/common_library/client/include/native_service/cl_monitor.h
new file mode 100755
index 0000000..650492c
--- /dev/null
+++ b/nsframework/common_library/client/include/native_service/cl_monitor.h
@@ -0,0 +1,269 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english This file contains the enum,struct and api of cl_monitor.
+ */
+#ifndef _cl_monitor_h_ // NOLINT(build/header_guard)
+#define _cl_monitor_h_ // NOLINT(build/header_guard)
+
+#include <stdint.h>
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor init enum
+/////////////////////////////////////////////////////////////////////////////////////
+typedef enum {
+ CL_MONITOR_INIT_SYSTEM = 0,
+ CL_MONITOR_INIT_USER
+} CL_MonitorInit_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// the struct of Monitor Entry
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ uint16_t pid;
+ uint8_t type;
+ uint8_t state;
+
+// uint32_t timeout;
+ time_t timeout;
+ uint32_t id;
+ uint32_t user_data;
+} CL_MonitorEntry_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor type enum
+/////////////////////////////////////////////////////////////////////////////////////
+typedef enum {
+ CL_MONITOR_TYPE_GENERIC = 0,
+ CL_MONITOR_TYPE_RPC
+} CL_MonitorType_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor state enum
+/////////////////////////////////////////////////////////////////////////////////////
+typedef enum {
+ CL_MONITOR_STATE_SLEEP = 0,
+ CL_MONITOR_STATE_RUN
+} CL_MonitorState_t;
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// the struct of Monitor Search
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ CL_MonitorEntry_t *entry_list;
+ int entry_num;
+} CL_MonitorSearch_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file cl_monitor.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor initialize
+/// \~english @param [in] init_type
+/// CL_MonitorInit_t - the type of initialzation
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorInit(CL_MonitorInit_t init_type); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Set Monitor Entry
+/// \~english @param [in] type
+/// CL_MonitorType_t - the type of monitor
+/// \~english @param [in] state
+/// CL_MonitorState_t - the state of monitor
+/// \~english @param [in] timeout
+/// uint32_t - the vlaue of timeout
+/// \~english @param [in] user_data
+/// uint32_t - the user data
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorSetEntry(CL_MonitorType_t type, uint32_t id, // NOLINT(readability/nolint)
+ CL_MonitorState_t state, uint32_t timeout,
+ uint32_t user_data);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Get Monitor Entry
+/// \~english @param [in] type
+/// CL_MonitorType_t - the type of monitor
+/// \~english @param [in] id
+/// uint32_t - the monitor id
+/// \~english @param [out] entry
+/// CL_MonitorEntry_t* - the pointer to monitor entry
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorGetEntry(CL_MonitorType_t type, uint32_t id, CL_MonitorEntry_t *entry); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor searth intialize
+/// \~english @param [in] serch
+/// CL_MonitorSearch_t* - the pointor to monitory search
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorSearchInit(CL_MonitorSearch_t *serch); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor searth destroy
+/// \~english @param [in] serch
+/// CL_MonitorSearch_t* - the pointor to monitory search
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorSearchDestroy(CL_MonitorSearch_t *serch); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor searth timeout
+/// \~english @param [in] serch
+/// CL_MonitorSearch_t* - the pointor to monitory search
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorSearchTimeout(CL_MonitorSearch_t *search); // NOLINT(readability/nolint)
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef _cl_monitor_h_ */ // NOLINT(build/header_guard)
diff --git a/nsframework/common_library/client/include/native_service/cl_process.h b/nsframework/common_library/client/include/native_service/cl_process.h
new file mode 100755
index 0000000..6a9adbf
--- /dev/null
+++ b/nsframework/common_library/client/include/native_service/cl_process.h
@@ -0,0 +1,1288 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_process_h_ // NOLINT(build/header_guard)
+#define _cl_process_h_ // NOLINT(build/header_guard)
+
+#include <sys/types.h>
+
+#define CL_PROCESSS_ATTR_HOLD_FDS_NUM 8
+
+#define CL_INTFY_FILENAME_FORMAT "/tmp/intfy_%05d"
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessAttr_t
+/// \~english @par Brief
+/// Process attribute structure
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ char body[148]; ///< process attribute
+} CL_ProcessAttr_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCleanupInfo_t
+/// \~english @par Brief
+/// Child-process attribute structure
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ pid_t pid; ///< child-process ID
+ int code; ///< signal code
+ int status; ///< end status or signal
+} CL_ProcessCleanupInfo_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessSchedPolicy_t
+/// \~english @par Brief
+/// Schedule policy
+/////////////////////////////////////////////////////////////////////////////////////
+typedef enum {
+ CL_PROCESS_SCHED_POLICY_OTHER = 0, ///< TSS
+ CL_PROCESS_SCHED_POLICY_RR, ///< Round robin
+ CL_PROCESS_SCHED_POLICY_FIFO, ///< FIFO
+} CL_ProcessSchedPolicy_t;
+
+typedef struct {
+ char body[20];
+} CL_ThreadAttr_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttr_t
+/// Cgroup attribute structure
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ char body[24]; ///< Cgroup attribute
+} CL_ProcessCreateCgroupAttr_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file cl_process.h
+ * @brief \~english This file contains the base api,enum and struct of cl_process.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessInit
+/// \~english @par Brief
+/// Initialize the process
+/// \~english @retval int file descriptor
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Failed to set up process prctl, -1 is returned.
+/// - Failed to set the signal set to the empty set sigemptyset, -1 is returned.
+/// - Failed to add a signal to the signal mask sigaddset, -1 is returned.
+/// - Failed to set sigprocmask, -1 is returned.
+/// - Failed to create a scripter in the file for signal acceptance signalfd, -1 is returned.
+/// \~english @par Detail
+/// This API must be called before createing a thread.
+/// Therefore, it is recommended that this API be called from within the main() function immediately after the API started.\n
+/// Initialize the process.\n
+/// The retuen value fd is assumed to be poll/select and used for waiting for event.\n
+/// An ready occurs when the child process terminates.\n
+/// Call process name setting(\ref CL_ProcessCreateAttrSetName) uniformly
+/// because it is applied only to the number of architecture after exec.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessInit(void); // NOLINT(readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreate
+/// \~english @par Brief
+/// Create the process
+/// \~english @param [in] file
+/// const char* -
+/// \~english @param [in] argv[]
+/// char* const -
+/// \~english @param [in] envp[]
+/// char* const
+/// \~english @param [in] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval int Success(PID)
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Need to be running CL_ProcessInit.
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the executable name (file) in the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the ARG parameter (argv[]) in the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When memory (malloc) of the data storagee area of the environment variable parameter (envp[]) specified
+/// by the arguments fails, set errno to EINVAL, -1 is returned.
+/// - When memory (malloc) of the data control area of the environment variable parameter (envp[]) specified
+/// by the arguments fails, set errno to EINVAL, -1 is returned.
+/// - Process creation (fork) fail, -1 is returned.
+/// - Process CPU affinity masking (sched_setaffinity) fail, -1 is returned.
+/// - When the character string output processing (snprintf) for process creation fail, -1 is returned.
+/// - When the character string output processing (snprintf) for PID setting of cgroup fail, -1 is returned.
+/// - Failure to allocate the area fo sstoring the path name of cgroup (malloc), -1 is returned.
+/// - Failure to open file descriptor (open) of cgroup, -1 is returned.
+/// - Failure to write file descriptor (write) of cgroup, -1 is returned.
+/// \~english @par Detail
+/// - This API must be called before createing a thread.
+/// \~english @par
+/// Create the process.\n
+/// The ARG parameter (argv[]) specified in the argment must satisfy the following conditions:\n
+/// - Can not be omitted.\n
+/// - The first argument must specify a pointer o the filename to be executed.\n
+/// - An array of pointer to NULL terminated strings.\n
+/// - Arrays must be terminated by NULL pointer.\n
+/// \~english @par
+/// Enviroment-variable parameters (envp[]) specified in arguments mus satisfy the following condiions:\n
+/// - When NULL is specified, the parent process inherits the parent process's environment variables.\n
+/// - An array of pointer to NULL terminated strings.\n
+/// - Arrays must be terminated by NULL pointer.\n
+/// \~english @par
+/// Be aware of the following.\n
+/// - Processing continues without interrupting event if setrlimit() fail.\n
+/// - System call access() checks whether or not there is access privilege,
+/// but returns PID regardless of the access privilege status.
+/// (If the process does not have access privilege, 100 retries are executed at 100 microseconds.)
+/// \~english @par
+/// Since the process attribute of a process cannot be changed during processing,
+/// if it is necessary to change the process attribute,
+/// it is necessary to call the following API and change the process attribute before calling this API.\n
+/// - CL_ProcessCreateAttrInit Initialize process attribute
+/// - CL_ProcessCreateAttrSetCgroup Setting process attribute (Cgroup)
+/// - CL_ProcessCreateAttrSetDisableCloseFds Setting process attribute (stop compulsion FD close)
+/// - CL_ProcessCreateAttrSetGid Setting process attribute (group ID)
+/// - CL_ProcessCreateAttrSetGroup Setting process attribute (process group)
+/// - CL_ProcessCreateAttrSetHoldFds Setting process attribute (maintain FD)
+/// - CL_ProcessCreateAttrSetName Setting process attribute (process name)
+/// - CL_ProcessCreateAttrSetSchedule Setting process attribute (schedule policy and priority)
+/// - CL_ProcessCreateAttrSetStackSize Setting process attribute (Stack Size)
+/// - CL_ProcessCreateAttrSetUid Setting process attribute (user ID)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// CL_ProcessTerminate, CL_ProcessTerminateGroup
+/// CL_ProcessCreateAttrInit, CL_ProcessCreateAttrSetCgroup,
+/// CL_ProcessCreateAttrSetDisableCloseFds, CL_ProcessCreateAttrSetGid,
+/// CL_ProcessCreateAttrSetGroup, CL_ProcessCreateAttrSetHoldFds,
+/// CL_ProcessCreateAttrSetName, CL_ProcessCreateAttrSetSchedule,
+/// CL_ProcessCreateAttrSetStackSize, CL_ProcessCreateAttrSetUid
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreate(const char *file, char * const argv[], char * const envp[], // NOLINT(readability/nolint)
+ const CL_ProcessAttr_t *attr);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrInit
+/// \~english @par Brief
+/// Initialize process attribute
+/// \~english @param [out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Initilize the CL_ProcessAttr_t structure that stores process attribute.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method(Async) / Fire and Forget / Broadcast / Sync / Set Get / Open Close / Request Notify / No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrInit(CL_ProcessAttr_t *attr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetName
+/// \~english @par Brief
+/// Set process name in process attribute
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] name
+/// const char* - process name (max length 16byte)
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the pointer (name) to the character string hat stores the process name specified
+/// by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process name to process attribute.\n
+/// The charactr string that stores the process name specified by the argument must satisfy the following conditions:\n
+/// - Terminated by a NULL.\n
+/// - The maximum lengthof character string is 16 byte including the termination character.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetName(CL_ProcessAttr_t *attr, const char *name); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetUid
+/// \~english @par Brief
+/// Set process attribute to user ID
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] uid
+/// uid_t - user ID
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to user ID.\n
+/// When UINT_MAX is set for the user ID,
+/// the user ID is set to 0 in the process attribute in the processing of CL_ProcessCreate().\n
+/// When 0 is set for the user ID,
+/// it is not reflected in the process attribute becose if is played by the process of CL_ProcessCreate().\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetUid(CL_ProcessAttr_t *attr, uid_t uid); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetGid
+/// \~english @par Brief
+/// Set process attribute to group ID
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] gid
+/// gid_t - Group ID
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to group ID.\n
+/// When 0 is set for the group ID,
+/// it is not reflected in the process attribute becose if is played by the process of CL_ProcessCreate().\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetGid(CL_ProcessAttr_t *attr, gid_t gid); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetSchedule
+/// \~english @par Brief
+/// Set process attribute to schedule policy and priority
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] policy
+/// CL_ProcessSchedPolicy_t - schedule policy
+/// \~english @param [in] priority
+/// int - priority
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @par
+/// enum CL_ProcessSchedPolicy_t Variable
+/// \~english @code
+/// typedef enum {
+/// CL_PROCESS_SCHED_POLICY_OTHER = 0, // TSS
+/// CL_PROCESS_SCHED_POLICY_RR, // Round-robin
+/// CL_PROCESS_SCHED_POLICY_FIFO, // FIFO
+/// } CL_ProcessSchedPolicy_t;
+/// @endcode
+/// \~english @par
+/// target to priority
+/// - -20~19 : CL_PROCESS_SCHED_POLICY_OTHER
+/// - 1~99 : CL_PROCESS_SCHED_POLICY_RR or CL_PROCESS_SCHED_POLICY_FIFO
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the schedule policy (policy) specified in the parameter is CL_PROCESS_SCHED_POLICY_RR
+/// and the priority (priority) is other than 1 to 99, set errno to EINVAL, -1 is returned.
+/// - When the schedule policy (policy) specified in the parameter is CL_PROCESS_SCHED_POLICY_FIFO
+/// and the priority (priority) is other than 1 to 99, set errno to EINVAL, -1 is returned.
+/// - Incorrect parameters are specified for the schedule policy (policy) specified in the arguments,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to schedule policy and priority.\n
+/// Error occur if the real-time schedule policy is set and
+/// the priority is passed value outside the range of 1-99.\n
+/// In the case of TSS, an error does not occur even if it is outside the range of -20 to 19,
+/// but ti is rounded to the nearest integer by a system call when a process is created.\n
+/// If not set by this funtion, the schedule policy set the TSS and priority sets 0.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetSchedule(CL_ProcessAttr_t *attr, // NOLINT(readability/nolint)
+ CL_ProcessSchedPolicy_t policy,
+ int priority);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetGroup
+/// \~english @par Brief
+/// Set process attribute to process group
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] create
+/// int - (0 or 1)
+/// \~english @par
+/// - 1 make
+/// - 0 not make(default)
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When a value oher than 0 or 1 is secified for the process group cration flag (create)
+/// specified in the parameter, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to process group.\n
+/// When a process group is created, all descendant process fork from child process also belong
+/// to the same process group, and the entire process group can be forcibly terminated.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetGroup(CL_ProcessAttr_t *attr, int create); // NOLINT(readability/nolint)
+
+int CL_ProcessCreateAttrSetCpuAssign(CL_ProcessAttr_t *attr, int cpu_assign); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetStackSize
+/// \~english @par Brief
+/// Set process attribute to stack size
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] stack_size
+/// int - stack size(byte)
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to stack size.\n
+/// The muximum configurable stack size is 1MB.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetStackSize(CL_ProcessAttr_t *attr, int stack_size); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetHoldFds
+/// \~english @par Brief
+/// Set process attribute to FD to maintain
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] hold_fds[]
+/// int -
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the array (hode_openfd[]) storing the list of the FD to be maintained specified
+/// by the arguments is NULL, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to FD to maintain.\n
+/// When nothing is set, FD other than 0, 1, and 2 are automatically close.\n
+/// For hold_openfds is stored in a CL_PROCESSS_ATTR_HOLD_FDS_NUM array,
+/// it is recommended that int hold_openfds[CL_PROCESSS_ATTR_HOLD_FDS_NUM] be used.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetHoldFds(CL_ProcessAttr_t *attr, int hold_fds[]); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetDisableCloseFds
+/// \~english @par Brief
+/// Set process attribute to suspend forced FD close
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to suspend forced FD close.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetDisableCloseFds(CL_ProcessAttr_t *attr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetCgroup
+/// \~english @par Brief
+/// Set process attribute to Cgroup
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] cgroup_name
+/// const char* - Cgroup name
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// - cgroup specified by CL_ProcessCreateCgroupCreate() has been created.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the pointer (name) to the character string hat stores the process name specified
+/// by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the character string length of the character string (cgroup_name) storing the process name specified
+/// by the argument is 64 byte or more, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to Cgroup.\n
+/// Creat new Cgroup with CL_ProcessCreateCgroupCreate().\n
+/// An error occurs if an Cgroup name that does not exist is specified.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetCgroup(CL_ProcessAttr_t *attr, // NOLINT(readability/nolint)
+ const char *cgroup_name);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessTerminate
+/// \~english @par Brief
+/// Kill the process
+/// \~english @param [in] pid
+/// pid_t - PID
+/// \~english @retval int file descriptor
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - CL_ProcessInit and CL_ProcessCreate must be running.
+/// (Process ID to be forcibly terminated exists)
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the process ID to be forcibly terminated does not exist, -1 is returned.
+/// \~english @par Detail
+/// The PID of the process is he return value (PID) of CL_ProcessCreate().
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// CL_ProcessCreate
+/////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessTerminate(pid_t pid); // NOLINT(readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessTerminateGroup
+/// \~english @par Brief
+/// Kill process group
+/// \~english @param [in] pid
+/// pid_t - process group ID
+/// \~english @retval int file descriptor
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - CL_ProcessInit and CL_ProcessCreate must be running.
+/// (Process ID to be forcibly terminated exists)
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the process ID to be forcibly terminated does not exist, -1 is returned.
+/// \~english @par Detail
+/// The process group ID is he return value (PID) of CL_ProcessCreate().
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// CL_ProcessCreate
+/////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessTerminateGroup(pid_t pid); // NOLINT(readability/nolint)
+
+int CL_ProcessAbort(pid_t pid); // NOLINT(readability/nolint)
+
+int CL_ProcessAbortGroup(pid_t pid); // NOLINT(readability/nolint)
+
+int CL_ProcessEuthanizeGroup(pid_t pid); // NOLINT(readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCleanup
+/// \~english @par Brief
+/// Collect child process
+/// \~english @param [in] sigchld_fd
+/// int - CL_ProcessInit() function return to fd
+/// \~english @param [out] cleanup_info
+/// CL_ProcessCleanupInfo_t* - Pointer to chiled process info
+/// \~english @par
+/// CL_ProcessCleanupInfo_t struct
+/// \~english @code
+/// typedef struct {
+/// pid_t pid; /* The process ID of the child. */
+/// int code; /* signal code */
+/// int status; /* the exit status of the child or the signal */
+/// } CL_ProcessCleanupInfo_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval 1 Success
+/// (If WNOHANG was specified and no child(ren) specified by id has yet changed state)
+/// \~english @retval -1 Error (setting to errno)
+/// \~english @par Prerequisite
+/// - Must be runnning CL_ProcessInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer (cleanup_info) to the child process information structure is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When a systemu call (waitid) fails, -1 is returned.
+/// - When there are no child process in state waitable, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// This API must be called before createing a thread.\n
+/// \~english @par
+/// It must be called many times while the return valu is 1.
+/// After the return value reaches 0, calling it again results in an error (ECHILD).\n
+/// The code of CL_ProcessCleanupInfo_t cotains the following value:\n
+/// - CLD_EXITED : Finished child process (exited)
+/// - CLD_KILLED : Killed child process
+/// - CLD_DUMPED : Ended abnormally child process
+/// - CLD_TRAPPED : Trapped traced child process
+/// - CLD_STOPPED : Stopped child process (stop)
+/// - CLD_CONTINUED restarted the sopped child process (after Linux 2.6.9)
+/// - The exit status is stored in status only when code is CLD_EXITED. Otherwise, signals are stored.
+/// - Need to include signal.h to use CLD_*.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCleanup(int sigchld_fd, CL_ProcessCleanupInfo_t *cleanup_info); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ThreadCreate
+/// \~english @par Brief
+/// Create thread
+/// \~english @param [out] thread
+/// pthread_t* - thread hadle
+/// \~english @param [in] attr
+/// pthread_attr_t* - Thread attibute pointer for pthread
+/// \~english @param [in] cl_attr
+/// CL_ThreadAttr_t* - Tred attribute pointer for expansion
+/// \~english @param [in] start_routine
+/// void*(*)(void*) - Pointer to the entry function of the thread
+/// \~english @param [in] arg
+/// void* - Argument to the entry function of the thread
+/// \~english @par
+/// CL_ThreadAttr_t structure
+/// \~english @code
+/// typedef struct {
+/// char body[20];
+/// } CL_ThreadAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error (set errno)
+/// \~english @retval EAGAIN failure to create thread
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the thread handler (thread) specified in the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the pointer of the thread attribute specified in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the pointer (start_routine) of the entry function of the thread specified by the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - Failure to initialize semaphore, set errno to sem_init, -1 is returned.
+/// - Failure to create thread (pthread_create), EAGAIN is returned.
+/// - Failure to rock semaphore (sem_wait), set errno to sem_init, -1 is returned.
+/// \~english @par Detail
+/// Create thread.\n
+/// The extension thread attribute (cl_attr) is used o assign the thread name set
+/// by CL_ThreadCreateAttrSetName(CL_ThreadAttr_t*, const char*).\n
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ThreadCreate(pthread_t *thread, pthread_attr_t *attr, // NOLINT(readability/nolint)
+ CL_ThreadAttr_t *cl_attr, void *(*start_routine)(void *),
+ void *arg);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ThreadCreateAttrInit
+/// \~english @par Brief
+/// Initialize thread attribute
+/// \~english @param [out] attr
+/// CL_ThreadAttr_t* - thread attribute pointer
+/// \~english @par
+/// CL_ThreadAttr_t structure
+/// \~english @code
+/// typedef struct {
+/// char body[20];
+/// } CL_ThreadAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error (set errno)
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer (attr) of the thread attributespecified by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Initialize structure CL_ThreadAttr_t that stores threade attribute.\n
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ThreadCreateAttrInit(CL_ThreadAttr_t *attr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ThreadCreateAttrSetName
+/// \~english @par Brief
+/// Set thread attribute to thread name
+/// \~english @param [out] attr
+/// CL_ThreadAttr_t* - thread attribute pointer
+/// \~english @param [in] name
+/// const char* - Pointer to the string storing the thread name (max length 16byte)
+/// \~english @par
+/// CL_ThreadAttr_t structure
+/// \~english @code
+/// typedef struct {
+/// char body[20];
+/// } CL_ThreadAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error (set errno)
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer (attr) of thread attribute specified by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the pointer (name) to the character string that stores the thread name specified
+/// by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set thread attribute to thread name\n
+/// The characer string that stores the thread name specified by the argument must satisfy the following conditions:\n
+/// - Terminated by a NULL.\n
+/// - The maximum lengthof character string is 16 byte including the termination character.\n
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ThreadCreateAttrSetName(CL_ThreadAttr_t *attr, const char *name); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupCreate
+/// \~english @par Brief
+/// Create Cgroup
+/// \~english @param [in] cgroup_name
+/// const char* - cgroup name
+/// \~english @param [in] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribut
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr by CL_ProcessCreateCgroupAttrInit
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the Cgroup name (cgroup_name) specified by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the pointer (attr) of the Cgroup attribute specified by the argumet is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the area for directory path name of the CPU subsystem of Cgroup could not be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When the area for directory of the CPU subsystem of Cgroup could not be create, -1 is returned.
+/// - When the area for file path name of the CPU subsystem of Cgroup could not be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When file descriptor of the CPU subsystem of Cgroup could not be acquired, -1 is returned.
+/// - When setting value to CPU subsystem of Cgroup could not be written, -1 is returned.
+/// - When the area for directory path name of the memory subsystem of Cgroup could not be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When the area for directory of the memory subsystem of Cgroup could not be create, -1 is returned.
+/// - When the area for file path name of the memory subsystem of Cgroup could not be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When file descriptor of the memory subsystem of Cgroup could not be acquired, -1 is returned.
+/// - When setting value to memory subsystem of Cgroup could not be written, -1 is returned.
+/// \~english @par Detail
+/// Create Cgroup to which the process to be created belongs.
+/// If it belongs to Cgroup that has already been created, it is not necessary to create it.\n
+/// \~english @par
+/// Since the Cgroup attribute cannot be changed during Cgroup, if it is necessary o chage the Cgroup attribute,
+/// it is necessary to call the following API and change the Cgroup attribute calling this API.\n
+/// - CL_ProcessCreateCgroupAttrInit :Initialize Cgroup attribute
+/// - CL_ProcessCreateCgroupAttrSetCfsBandwidthControl :TSS process CPU time control by Bandwidth Control
+/// - CL_ProcessCreateCgroupAttrSetCpuShares :TSS process CPU time control
+/// - CL_ProcessCreateCgroupAttrSetMemoryLimit :Contol memory usage
+/// - CL_ProcessCreateCgroupAttrSetMemoryUsageNotification :Memory usage notification setting
+/// - CL_ProcessCreateCgroupAttrSetRtThrottling :FIFO/RR process CPU time control
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// CL_ProcessCreateCgroupDelete,
+/// CL_ProcessCreateCgroupAttrInit, CL_ProcessCreateCgroupAttrSetCfsBandwidthControl,
+/// CL_ProcessCreateCgroupAttrSetCpuShares, CL_ProcessCreateCgroupAttrSetMemoryLimit,
+/// CL_ProcessCreateCgroupAttrSetMemoryUsageNotification, CL_ProcessCreateCgroupAttrSetRtThrottling,
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupCreate(const char *cgroup_name, // NOLINT(readability/nolint)
+ CL_ProcessCreateCgroupAttr_t *attr);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrInit
+/// \~english @par Brief
+/// Initialize Cgroup attribute
+/// \~english @param [out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute pointer
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of Cgroup attribute (attr) specified in the arguments is NULL, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Initialize Cgroup attibute with 0.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrInit(CL_ProcessCreateCgroupAttr_t *attr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrSetRtThrottling
+/// \~english @par Brief
+/// Set FIFO/RR process CPU time control
+/// \~english @param [in,out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute
+/// \~english @param [in] runtime_us
+/// int - CPU allocation time(us)
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateCgroupAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of Cgroup attribute (attr) specified in the arguments is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Limiting the CPU time allocated to a process to
+/// which a real-time class schedule policy (SCHED_FIFO/SCHED_RR) is applied.\n
+/// Set the value of argument runtime_us to the cpu.rt_runtime_us (CPU allocation time) of created Cgroup.\n
+/// cpu.rt_period_us(unit time:1000000us) is not changed.\n
+/// If not set, Cgroup created will remain at default (CPU allocation time:950000us).\n
+/// The configurable range of runtime_us depends on the use of Cgroup and the kernel version.
+/// The user sets an appropriate value.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrSetRtThrottling( // NOLINT(readability/nolint)
+ CL_ProcessCreateCgroupAttr_t *attr, int runtime_us);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrSetCpuShares
+/// \~english @par Brief
+/// Set TSS process CPU time control
+/// \~english @param [in,out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute pointer
+/// \~english @param [in] cpu_shares
+/// int - An integer value that sepcified the relative distribution of CPU time
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateCgroupAttrInit
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer (attr) of the Cgroup attribute specified by the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Cotrols the CPU time allocated to a process to which
+/// a class TSS schedule policy (SCHED_OTHER, etc.) is applied.\n
+/// If cpu_shares is set with this function, a single Cgroup is created and cpu.shares is set with that value.\n
+/// If not set, remain at default.\n
+/// cpu_shares is set to the standard value 1024, and CPU time is allocated according
+/// to the allocaion value specified between Cgroup.\n
+/// Task Cgroup with cpu.shares set to 1024 has twice as much CPU time as
+/// task Cgroup with cpu.shares set to 512.\n
+/// Processes belonging to the same Cgroup are equally allocated CPU time allocated to Cgroup.\n
+/// Note that the time distribution is distributed across al CPU cores on a multi-core system.\n
+/// In a multicore system, if Cgroup limit is set to 100% of the CPU,
+/// 100% of each CPU core wil be available.\n\n
+/// Examle) If Cgroup A is set to use 25% of the CPU and Cgroup B is set to use 75% of the CPU,\n
+/// and a process that uses CPU intensively is started on a 4-core system (1 process in A and 3 processes in B),\n
+/// the CPU allocaion is distributed as follows.\n\n
+/// \~english @par
+/// | PID | cgroup | CPU | CPU allotment |
+/// |:---:|:------:|:---:|:-------:|
+/// | 100 | A | 0 | CPU0 100% |
+/// | 101 | B | 1 | CPU1 100% |
+/// | 102 | B | 2 | CPU2 100% |
+/// | 103 | B | 3 | CPU3 100% |
+/// \~english @par
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrSetCpuShares(CL_ProcessCreateCgroupAttr_t *attr, // NOLINT(readability/nolint)
+ int cpu_shares);
+
+///////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrSetCfsBandwidthControl
+/// \~english @par Brief
+/// Set TS process CU time control by Bandwidth Control
+/// \~english @param [in,out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute pointer
+/// \~english @param [in] cfs_quota_us
+/// int - CPU allocation time
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateCgroupAttrInit
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Controls the amount of time allocated to processes o whitch TSS class schedule plicy (SCHED_OTHER, etc.) are
+/// applied using bandwidth control of CFS(Completely Fair Scheduler) implemented from kernel 3.2.\n
+/// Set the value of argument cfs_quota_us to the cpu.cfs_quota_us of created Cgroup.\n
+/// cpu.cfs_period_us(unit time:1000000us) is not changed.\n
+/// If not set, the created Cgroup will not have CPU allocatio control. (set cpu.cfs_guota_us to -1).\n
+/// The time (%) allocated to Cgroup can be set correctly,
+/// and it can be allocated correctly if the CPU is free.\n
+/// It is scheduled to be allocated as much as possible even if it conflicts with other Cgroup's.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrSetCfsBandwidthControl( // NOLINT(readability/nolint)
+ CL_ProcessCreateCgroupAttr_t *attr, int cfs_quota_us);
+
+/////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrSetMemoryLimit
+/// \~english @par Brief
+/// Control memory usage
+/// \~english @param [in,out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute pointer
+/// \~english @param [in] memory_limit
+/// int - memory limit (byte)
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateCgroupAttrInit
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Control the CPU time allocated to a process.\n
+/// Set the value of argument memory_limit to the memory.limit_in_bytes of created Cgroup.\n
+/// If not set, there is no memory limit.When a request exceeding the memory limit is issued,
+/// a SIGKILL is sent from the kernel and the process is discarded.
+/// Note: When the memory limit is exceeded, control moves to 00M,
+/// but its operation ca be changed (Documentation/cgroup/memory.txt).\n
+/// Write memory.oom_control to 1 to stop the OOM-Killer.
+/// When OOM-Killer is stopped, the task below Cgroup becomes hang/sleep.\n
+/// The task moves when the limit of the memory Cgroup increaes or when usage decreases. When usage decreases,\n
+/// - Task was killed\n
+/// - Task was moved other group\n
+/// - File has been deleted\n
+/// \~english @par
+/// You can also receive a eventf notification from OOM.\n
+/// Memory usage is counted as follows\n
+/// - RSS(All mapped anon pages)\n
+/// - Page Cache\n
+/// - First acess Shared Pages in Cgroup\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrSetMemoryLimit(CL_ProcessCreateCgroupAttr_t *attr, // NOLINT(readability/nolint)
+ int memory_limit);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrSetMemoryUsageNotification
+/// \~english @par Brief
+/// Set notificatio when memory usage exceeds the specified amount
+/// \~english @param [in,out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute pointer
+/// \~english @param [in] usage_in_bytes
+/// int - usage in bytes(byte)
+/// \~english @param [in] event_fd
+/// int - File dexcriptor created by system call eventfd()
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateCgroupAttrInit
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When event_fd is negative for a file descriptor created by system call eventfd(),
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// event_fd is notifued when memory usage exceeds argument usage_in_bytes.\n
+/// See eventfd for details of event_fd.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrSetMemoryUsageNotification( // NOLINT(readability/nolint)
+ CL_ProcessCreateCgroupAttr_t *attr, int usage_in_bytes, int event_fd);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupDelete
+/// \~english @par Brief
+/// Delete Cgroup
+/// \~english @param [in] cgroup_name
+/// const char* - cgroup name
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Need to be runnning CL_ProcessCreateCgroupCreate.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the Cgroup (cgroup_name) name specified inthe argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the area for directory path name of the CPU subsystem of Cgroup and
+/// memory subsystem of Cgroup could not be allocated, set errno to EINVAL, -1 is returned.
+/// - When the area for the directory path name of the memory subsystem of Cgroup cannot be allocated and
+/// the directory for the CPU subsystem of Cgroup does not exist, set errno to EINVAL, -1 is returned.
+/// - When the directory for the CPU subsystem of Cgroup does not exist and
+/// the area for the directory path name of the memory subsystem of Cgroup cannot be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When the directory for the memory subsystem of Cgroup and
+/// the directory for the CPU subsystem of Cgroup does not exist, set errno to EINVAL, -1 is returned.
+/// - When the directory for the memory subsystem of Cgroup could not be deleted, -1 is returned.
+/// - When the directory for the CPU subsystem of Cgroup could not be deleted, -1 is returned.
+/// \~english @par Detail
+/// Delete Cgroup. If there is a proess belonging to Cgroup, error code (EBUSY) is returned.\n
+/// \~english @par
+/// Success is also notified in the following cases:\n
+/// - When the area for directory path name of memory subsyste Cgroup could not be allocated
+/// but CPU subsystem of Cgroup was deleted successfully.
+/// - When the directory for the memory subsystem of Cgroup does not exist,
+/// but CPU subsystem of Cgroup was deleted successfully.
+/// - When the area for directory path name of CPU subsyste Cgroup could not be allocated
+/// but memory subsystem of Cgroup was deleted successfully.
+/// - When the directory for the CPU subsystem of Cgroup does not exist,
+/// but memory subsystem of Cgroup was deleted successfully.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// CL_ProcessCreateCgroupCreate
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupDelete(const char *cgroup_name); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupClassify
+/// \~english @par Brief
+/// Move process to the Cgroup
+/// \~english @param [in,out] cgroup_name
+/// const char* - Destination A name
+/// \~english @param [in] pid
+/// pid_t - process ID
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Need to be running CL_ProcessCreateCgroupCreate.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the Cgroup (cgroup_name) specified in the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the area for directory path name of memory subsystem of Cgroup and
+/// CPU subsystem of Cgroup could not be allocated, set errno to EINVAL, -1 is returned.
+/// - When the area for directory path name of memory subsystem of Cgroup could not be allocated,
+/// and the directory for CPU subsystem of Cgroup does not exist, set errno to EINVAL, -1 is returned.
+/// - When the directory for memory subsystem of Cgroup does not exist and
+/// the directory for CU subsystem of Cgroup could not allocated , set errno to EINVAL, -1 is returned.
+/// - When the directory for the memory subsystem of Cgroup and
+/// the directory for the CPU subsystem of Cgroup does not exist, set errno to EINVAL, -1 is returned.
+/// - When the area for directory path name of the memory subsystem of Cgroup could not allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When the file descripter for the memory subsystem of Cgroup could not be obtained, -1 is returned.
+/// - When pid could not be written to the file for memory subsystem of Cgroup, -1 is returned.
+/// - When the area for directory path name of the CPU subsystem of Cgroup could not be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When the file decsripter for the CPU subsystem of Cgroup could not be allocated, -1 is returned.
+/// - When pid could not be written to the file for CPU subsystem of Cgroup, -1 is returned.
+/// \~english @par Detail
+/// Move process to the Cgroup.\n
+/// \~english @par
+/// Success is also notified in the following cases:\n
+/// - When the area for directory path name of memory subsyste Cgroup could not be allocated
+/// but CPU subsystem of Cgroup was deleted successfully.
+/// - When the directory for the memory subsystem of Cgroup does not exist,
+/// but CPU subsystem of Cgroup was deleted successfully.
+/// - When the area for directory path name of CPU subsyste Cgroup could not be allocated
+/// but memory subsystem of Cgroup was deleted successfully.
+/// - When the directory for the CPU subsystem of Cgroup does not exist,
+/// but memory subsystem of Cgroup was deleted successfully.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupClassify(const char *cgroup_name, pid_t pid); // NOLINT(readability/nolint)
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef _cl_process_h_ // NOLINT(build/header_guard)
diff --git a/nsframework/common_library/client/include/native_service/cl_region.h b/nsframework/common_library/client/include/native_service/cl_region.h
new file mode 100755
index 0000000..c9eec5f
--- /dev/null
+++ b/nsframework/common_library/client/include/native_service/cl_region.h
@@ -0,0 +1,257 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file cl_region.h
+ * @brief region manage
+ *
+ */
+
+#ifndef _CL_REGION_H_ // NOLINT(build/header_guard)
+#define _CL_REGION_H_ // NOLINT(build/header_guard)
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <unistd.h>
+
+#define CL_REGION_DEFAULT_SIZE (4 * 1024)
+
+#define CL_ALIGNOF(type) __alignof(type)
+
+typedef void (*cl_region_cleanup_pt)(void *data);
+
+typedef struct cl_region_cleanup_s cl_region_cleanup_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// region cleanup struct
+/////////////////////////////////////////////////////////////////////////////////////
+struct cl_region_cleanup_s { // NOLINT(readability/nolint)
+ cl_region_cleanup_pt handler;
+ void *data;
+ cl_region_cleanup_t *next;
+};
+
+
+typedef struct cl_region_large_s cl_region_large_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// region large struct
+/////////////////////////////////////////////////////////////////////////////////////
+struct cl_region_large_s { // NOLINT(readability/nolint)
+ cl_region_large_t *next;
+ void *alloc;
+ size_t size;
+};
+
+
+typedef struct cl_region_s cl_region_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// region data struct
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ uint8_t *last;
+ uint8_t *end;
+ cl_region_t *next;
+ int failed;
+} cl_region_data_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// region struct
+/////////////////////////////////////////////////////////////////////////////////////
+struct cl_region_s { // NOLINT(readability/nolint)
+ cl_region_data_t d;
+ size_t max;
+ cl_region_t *current;
+ cl_region_large_t *large;
+ cl_region_cleanup_t *cleanup;
+};
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file cl_region.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Region
+/// \~english @par Brief
+/// Region create
+/// \~english @param [in] size
+/// size_t - the size to create
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+cl_region_t *CL_RegionCreate(size_t size); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Region
+/// \~english @par Brief
+/// Region destroy
+/// \~english @param [in] region
+/// cl_region_t * - the region to destroy
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+void CL_RegionDestroy(cl_region_t *region); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Region
+/// \~english @par Brief
+/// Region allocation
+/// \~english @param [in] region
+/// cl_region_t * - the region to allocate
+/// \~english @param [in] size
+/// size_t * - the size to allocate
+/// \~english @param [in] align_size
+/// size_t * - the size to align
+/// \~english @retval the pointer to region allocated
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+#define CL_RegionAlloc(region, type, length) \
+ cl_region_alloc(region, sizeof(type) * length, CL_ALIGNOF(type))
+void *cl_region_alloc(cl_region_t *region, size_t size, size_t align_size); // NOLINT(readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Region
+/// \~english @par Brief
+/// Region free
+/// \~english @param [in] region
+/// cl_region_t * - the region to free
+/// \~english @param [in] p
+/// void * - the pointer to region
+/// \~english @retval true Success
+/// \~english @retval false Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+bool CL_RegionFree(cl_region_t *region, void *p); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Region
+/// \~english @par Brief
+/// add region cleanup
+/// \~english @param [in] region
+/// cl_region_t * - the region to allocate
+/// \~english @param [in] size
+/// size_t * - the size to add
+/// \~english @param [in] align_size
+/// size_t * - the size to align
+/// \~english @retval the pointer to region cleanup added
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+#define CL_RegionCleanupAdd(region, type, length) \
+ cl_region_cleanup_add(region, sizeof(type) * length, CL_ALIGNOF(type))
+cl_region_cleanup_t *cl_region_cleanup_add(cl_region_t *region, size_t size, // NOLINT(readability/nolint)
+ size_t align_size);
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _CL_REGION_H_ */ // NOLINT(build/header_guard)
+
+/* vim:set ts=8 sw=2 sts=2: */
diff --git a/nsframework/common_library/client/include/native_service/cl_sem.h b/nsframework/common_library/client/include/native_service/cl_sem.h
new file mode 100755
index 0000000..9dbe54e
--- /dev/null
+++ b/nsframework/common_library/client/include/native_service/cl_sem.h
@@ -0,0 +1,73 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _cl_sem_h_ // NOLINT(build/header_guard)
+#define _cl_sem_h_ // NOLINT(build/header_guard)
+
+#include <semaphore.h>
+
+#ifdef __cplusplus
+#define EXT_C extern "C"
+#else
+#define EXT_C
+#endif // __cplusplus
+
+/**
+ * @file cl_sem.h
+ * @brief \~english This file contains the api of sem wait.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Sem
+/// \~english @par Brief
+/// Sem wait
+/// \~english @param [in] semid
+/// sem_t * - the pointer to the union sem_t
+/// \~english @param [in] timeout
+/// unsigned int - the count of timeout
+/// \~english @retval 0 Success
+/// \~english @retval not 0 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EXT_C int CL_SemWait(sem_t *semid, unsigned int timeout); // NOLINT(readability/nolint)
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#endif // #ifndef _cl_sem_h_ // NOLINT(build/header_guard)
diff --git a/nsframework/common_library/client/include/native_service/common_library.h b/nsframework/common_library/client/include/native_service/common_library.h
new file mode 100755
index 0000000..929d04d
--- /dev/null
+++ b/nsframework/common_library/client/include/native_service/common_library.h
@@ -0,0 +1,48 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef NATIVESERVICE_COMMONLIBRARY_H_ // NOLINT(build/header_guard)
+#define NATIVESERVICE_COMMONLIBRARY_H_
+
+/**
+ * @file common_library.h
+ * @brief \~english include all common_library head files
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+#include <native_service/cl_process.h>
+#include <native_service/cl_sem.h>
+#include <native_service/cl_monitor.h>
+#include <native_service/cl_lock.h>
+#include <native_service/cl_region.h>
+#include <native_service/cl_lockid.h>
+
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+
+#endif // NATIVESERVICE_COMMONLIBRARY_H_
diff --git a/nsframework/common_library/client/libcommon.ver b/nsframework/common_library/client/libcommon.ver
new file mode 100755
index 0000000..f89c9ba
--- /dev/null
+++ b/nsframework/common_library/client/libcommon.ver
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# CommonLib version script
+#
+{
+ global:
+ ### .text section ###
+ CL_*;
+ cl_region_alloc;
+ cl_region_cleanup_add;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/nsframework/common_library/client/src/cl_cgroup.c b/nsframework/common_library/client/src/cl_cgroup.c
new file mode 100755
index 0000000..812ccaa
--- /dev/null
+++ b/nsframework/common_library/client/src/cl_cgroup.c
@@ -0,0 +1,260 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <inttypes.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include "cl_cgroup.h"
+
+#define CL_CGROOT "/sys/fs/cgroup/"
+
+static char *cl_cgroup_base(cl_cgroup_t cgroup) {
+ switch (cgroup) { // LCOV_EXCL_BR_LINE 200: internal interface,code make sure
+ case CL_CGROUP_MEMORY:
+ return CL_CGROOT "/memory";
+ case CL_CGROUP_CPU:
+ return CL_CGROOT "/cpu";
+ }
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return NULL;// LCOV_EXCL_LINE 200:internal interface,code make sure nerver run
+}
+
+static char *cl_cgroup_create_path(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler) {
+ char *path = malloc(FILENAME_MAX);
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 5:fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = ENOMEM; // LCOV_EXCL_LINE 5:fail safe for libc malloc
+ goto error; // LCOV_EXCL_LINE 5:fail safe for libc malloc
+ }
+
+ if (cgroup != CL_CGROUP_MEMORY && cgroup != CL_CGROUP_CPU) { // LCOV_EXCL_BR_LINE 200: internal interface,code make sure
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = EINVAL; // LCOV_EXCL_LINE 200: internal interface,code make sure
+ goto error; // LCOV_EXCL_LINE 200: internal interface,code make sure
+ }
+
+ if (cgroup_name == NULL) { // LCOV_EXCL_BR_LINE 200: internal interface,code make sure
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = EINVAL; // LCOV_EXCL_LINE 200: internal interface,code make sure
+ goto error; // LCOV_EXCL_LINE 200: internal interface,code make sure
+ }
+
+ if (controler) {
+ snprintf(path, FILENAME_MAX, "%s/%s/%s", cl_cgroup_base(cgroup), cgroup_name, controler);
+ } else {
+ snprintf(path, FILENAME_MAX, "%s/%s", cl_cgroup_base(cgroup), cgroup_name);
+ }
+
+ return path;
+
+error:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ free(path); // LCOV_EXCL_LINE 200: internal interface,code make sure
+ return NULL; // LCOV_EXCL_LINE 200: internal interface,code make sure
+}
+
+int cl_cgroup_make(cl_cgroup_t cgroup, const char *cgroup_name) {
+ int r = -1;
+ char *path = cl_cgroup_create_path(cgroup, cgroup_name, NULL);
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ goto exit; // LCOV_EXCL_LINE 6: double check
+ }
+
+ if (mkdir(path, 0777) < 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc mkdir
+ goto exit;
+ }
+
+ r = 0;
+
+exit:
+ if (path) {// LCOV_EXCL_BR_LINE 6: double check
+ free(path);
+ }
+ return r;
+}
+
+int cl_cgroup_remove(cl_cgroup_t cgroup, const char *cgroup_name) {
+ int r = -1;
+ char *path = cl_cgroup_create_path(cgroup, cgroup_name, NULL);
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ goto exit; // LCOV_EXCL_LINE 6: double check
+ }
+
+ if (rmdir(path) < 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc rmdir
+ goto exit;
+ }
+
+ r = 0;
+
+exit:
+ if (path) { // LCOV_EXCL_BR_LINE 6: double check
+ free(path);
+ }
+ return r;
+}
+
+int cl_cgroup_exist(cl_cgroup_t cgroup, const char *cgroup_name) {
+ int r = -1;
+ char *path = cl_cgroup_create_path(cgroup, cgroup_name, NULL);
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ goto exit; // LCOV_EXCL_LINE 6: double check
+ }
+
+ r = access(path, F_OK);
+
+exit:
+ if (path) { // LCOV_EXCL_BR_LINE 6: double check
+ free(path);
+ }
+ return r;
+}
+
+int cl_cgroup_open(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler, int flags) {
+ int r = -1;
+ char *path = cl_cgroup_create_path(cgroup, cgroup_name, controler);
+ int fd = -1;
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ goto exit; // LCOV_EXCL_LINE 6: double check
+ }
+
+ if (controler == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = EINVAL; // LCOV_EXCL_LINE 6: double check
+ goto exit; // LCOV_EXCL_LINE 6: double check
+ }
+
+ if ((fd = open(path, flags | O_CLOEXEC)) < 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc open
+ goto exit;
+ }
+
+ r = fd;
+
+exit:
+ if (path) { // LCOV_EXCL_BR_LINE 6: double check
+ free(path);
+ }
+ return r;
+}
+
+int cl_cgroup_set_string(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler, const char *string) {
+ int r = -1;
+ int fd = -1;
+
+ if (controler == NULL || string == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = EINVAL;// LCOV_EXCL_LINE 6: double check
+ goto exit;// LCOV_EXCL_LINE 6: double check
+ }
+
+ fd = cl_cgroup_open(cgroup, cgroup_name, controler, O_WRONLY);
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc funtion open
+ goto exit;
+ }
+
+ if (write(fd, string, strlen(string)) < 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc write
+ goto exit;
+ }
+
+ r = 0;
+
+exit:
+ if (fd >= 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc funtion open
+ int save_err = errno;
+ close(fd);
+ errno = save_err;
+ }
+ return r;
+}
+
+int cl_cgroup_set_num(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler, int64_t value) {
+ char num_str[22];
+
+ snprintf(num_str, sizeof(num_str), "%" PRId64, value);
+
+ return cl_cgroup_set_string(cgroup, cgroup_name, controler, num_str);
+}
+
+int cl_cgroup_get_string(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler, char *string, size_t length) { // LCOV_EXCL_START 8: dead code // NOLINT (readability/nolint)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ int r = -1;
+ int fd = -1;
+
+ if (controler == NULL || string == NULL) {
+ errno = EINVAL;
+ goto exit;
+ }
+
+ fd = cl_cgroup_open(cgroup, cgroup_name, controler, O_RDONLY);
+ if (fd < 0) {
+ goto exit;
+ }
+
+ if (read(fd, string, length) < 0) {
+ goto exit;
+ }
+
+ r = 0;
+
+exit:
+ if (fd >= 0) {
+ int save_err = errno;
+ close(fd);
+ errno = save_err;
+ }
+ return r;
+}
+// LCOV_EXCL_STOP
+
+int64_t cl_cgroup_get_num(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler) { // LCOV_EXCL_START 8: dead code // NOLINT (readability/nolint)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ int r;
+ char num_str[22];
+
+ if ((r = cl_cgroup_get_string(cgroup, cgroup_name, controler, num_str, sizeof(num_str))) < 0) {
+ return r;
+ }
+
+ return atoll(num_str);
+}
+// LCOV_EXCL_STOP
diff --git a/nsframework/common_library/client/src/cl_lock.c b/nsframework/common_library/client/src/cl_lock.c
new file mode 100755
index 0000000..6add2a5
--- /dev/null
+++ b/nsframework/common_library/client/src/cl_lock.c
@@ -0,0 +1,221 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// #include <stdio.h>
+// #include <stdlib.h>
+#include <errno.h>
+
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <pthread.h>
+
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+#include "cl_lock_internal.h"
+#include "cl_error.h"
+
+static int shm_id = -1;
+
+/*
+ * Lock file is consists of slots(4KB)
+ * The slot layout is:
+ * 0 ~ 4Byte : field of PID
+ * 4Byte ~ 28Byte : field of pthread_mutex_t
+ */
+
+
+static int cl_LockfileInit(void *base) {
+ int i;
+ /*
+ int j;
+ */
+ void *addr;
+ pthread_mutexattr_t attr;
+
+ if (pthread_mutexattr_init(&attr) != 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc pthread_mutexattr_init
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5:fail safe for libc pthread_mutexattr_init
+ }
+ if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED) != 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc pthread_mutexattr_setpshared
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5:fail safe for libc pthread_mutexattr_setpshared
+ }
+// if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP) != 0) {
+// return -1;
+// }
+ if (pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST) != 0) {
+ return -1;
+ }
+
+ for (i = 0; i < LID_NUM; i++) {
+ /*
+ addr = SLOT_SIZE * 1 + base;
+ for (j = 0; j < 1024; j++) {
+ *(int*)(addr + j * sizeof(int)) = j;
+ }
+ */
+ addr = SLOT_SIZE * i + (char *)base + sizeof(int);
+ pthread_mutex_init((pthread_mutex_t *)addr, &attr);
+
+ }
+ if (pthread_mutexattr_destroy(&attr) != 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc pthread_mutexattr_destroy
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5:fail safe for libc pthread_mutexattr_destroy
+ }
+ return 0;
+}
+
+/*
+ * Initialize in the system
+ * This function will generate the Lock file, and initialize pthread_mutex_t for all slots
+ */
+int CL_LockSystemInit(void) {
+ int fd = -1;
+ int ret = 0;
+ void *base = MAP_FAILED;
+
+ fd = shm_open(LOCKFILE_NAME, O_CREAT | O_EXCL | O_RDWR, (S_IRWXG | S_IRWXO | S_IRWXU));
+ if (fd < 0) {
+ ret = -1;
+ goto exit;
+ }
+ if (ftruncate(fd, LOCKFILE_SIZE) != 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc ftruncate
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ ret = -1; // LCOV_EXCL_LINE 5:fail safe for libc ftruncate
+ goto exit; // LCOV_EXCL_LINE 5:fail safe for libc ftruncate
+ }
+
+ base = mmap(NULL, LOCKFILE_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0);
+ if (base == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ ret = -1; // LCOV_EXCL_LINE 5:fail safe for libc mmap
+ goto exit; // LCOV_EXCL_LINE 5:fail safe for libc mmap
+ }
+
+ if (cl_LockfileInit(base) < 0) { // LCOV_EXCL_BR_LINE 11:out branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ ret = -1; // LCOV_EXCL_LINE 5:fail safe for libc
+ goto exit; // LCOV_EXCL_LINE 5:fail safe for libc
+ }
+
+exit:
+ if (fd >= 0) {
+ close(fd);
+ }
+ if (base != MAP_FAILED) {
+ munmap(base, LOCKFILE_SIZE);
+ }
+ return ret;
+}
+
+void CL_LockSystemFin_debug(void) {
+ if (shm_id >= 0) {
+ close(shm_id);
+ }
+ shm_unlink(LOCKFILE_NAME);
+ shm_id = -1;
+}
+
+/*
+ * Initialize in the process
+ * Open the Lock file
+ */
+int CL_LockProcessInit(void) {
+ if (shm_id < 0) {
+ shm_id = shm_open(LOCKFILE_NAME, O_RDWR, (S_IRWXG | S_IRWXO | S_IRWXU));
+ }
+ if (shm_id < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function shm_open
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for glibc function shm_open
+ }
+ return 0;
+}
+
+void *CL_LockMap(int lid) {
+ if ((lid < 0) || (lid >= LID_NUM)) {
+ errno = EINVAL;
+ return MAP_FAILED;
+ }
+ return mmap(NULL, SLOT_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, shm_id, (off_t)(lid * SLOT_SIZE));
+}
+
+int CL_LockUnmap(void *addr) {
+ return munmap(addr, SLOT_SIZE);
+}
+
+int CL_LockGet(void *addr) {
+ int ret;
+
+ if ((addr == NULL) || (addr == MAP_FAILED)) {
+ ret = EINVAL;
+ } else {
+ CL_DBG_PRINT("@@@@@ %s Start: pid = %d\n", __func__, *(int *)addr);
+ // LCOV_EXCL_BR_START 5:fail safe for libc pthread_mutex_lock
+ if ((ret = pthread_mutex_lock((pthread_mutex_t*)((char *)addr + sizeof(int)))) == 0) {
+ // LCOV_EXCL_BR_STOP
+ *(int *)addr = (int)getpid();
+ } else if (ret == EOWNERDEAD) {
+ if ((ret = pthread_mutex_consistent((pthread_mutex_t *)((char *)addr + sizeof(int)))) == 0) {
+ *(int *)addr = (int)getpid();
+ }
+ }
+ CL_DBG_PRINT("@@@@@ %s End: pid = %d\n", __func__, *(int *)addr);
+ }
+ return ret;
+}
+
+int CL_LockNowait(void *addr) {
+ int ret;
+
+ if ((addr == NULL) || (addr == MAP_FAILED)) {
+ ret = EINVAL;
+ } else {
+ CL_DBG_PRINT("@@@@@ %s Start: pid = %d\n", __func__, *(int *)addr);
+ if ((ret = pthread_mutex_trylock((pthread_mutex_t*)((char *)addr + sizeof(int)))) == 0) {
+ *(int *)addr = (int)getpid();
+ } else if (ret == EOWNERDEAD) {
+ if ((ret = pthread_mutex_consistent((pthread_mutex_t *)((char *)addr + sizeof(int)))) == 0) {
+ *(int *)addr = (int)getpid();
+ }
+ }
+ CL_DBG_PRINT("@@@@@ %s End: pid = %d\n", __func__, *(int *)addr);
+ }
+ return ret;
+}
+
+
+int CL_LockRelease(void *addr) {
+ int ret;
+ if ((addr == NULL) || (addr == MAP_FAILED)) {
+ ret = EINVAL;
+ } else {
+ CL_DBG_PRINT("@@@@@ %s : pid = %d\n", __func__, *(int *)addr);
+ *(int *)addr = (int)0;
+ ret = pthread_mutex_unlock((pthread_mutex_t*)((char *)addr + sizeof(int)));
+ }
+ return ret;
+}
+
+
+
diff --git a/nsframework/common_library/client/src/cl_monitor.c b/nsframework/common_library/client/src/cl_monitor.c
new file mode 100755
index 0000000..26d8e2e
--- /dev/null
+++ b/nsframework/common_library/client/src/cl_monitor.c
@@ -0,0 +1,442 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <time.h>
+#include <errno.h>
+#include <semaphore.h>
+
+#include "cl_error.h"
+#include <native_service/cl_region.h>
+#include <native_service/cl_monitor.h>
+
+#define CL_MONITOR_SHM_NAME "/cl_monitor"
+
+#define CL_MONITOR_ID_REAL_GENERIC_START (0)
+#define CL_MONITOR_ID_REAL_GENERIC_END (1023)
+#define CL_MONITOR_ID_REAL_RPC_START (49952)
+#define CL_MONITOR_ID_REAL_RPC_END (59999)
+
+#define CL_MONITOR_ID_FLAT_GENERIC_START (0)
+#define CL_MONITOR_ID_FLAT_GENERIC_END \
+ (CL_MONITOR_ID_FLAT_GENERIC_START + (CL_MONITOR_ID_REAL_GENERIC_END - CL_MONITOR_ID_REAL_GENERIC_START))
+#define CL_MONITOR_ID_FLAT_RPC_START (CL_MONITOR_ID_FLAT_GENERIC_END + 1)
+#define CL_MONITOR_ID_FLAT_RPC_END \
+ (CL_MONITOR_ID_FLAT_RPC_START + (CL_MONITOR_ID_REAL_RPC_END - CL_MONITOR_ID_REAL_RPC_START))
+#define CL_MONITOR_ENTRY_NUM (CL_MONITOR_ID_FLAT_RPC_END + 1)
+
+#define CL_MONITOR_BITMAP_LENGTH ((CL_MONITOR_ENTRY_NUM + 63) / 64) // aligned
+
+#define CL_ALIGN(x, a) (((x) + (a - 1)) / (a) * (a))
+
+struct cl_monitor_header {
+ char signature[4];
+ uint64_t bitmap[CL_MONITOR_BITMAP_LENGTH];
+ sem_t sem;
+};
+
+#define CL_MONITOR_OBJECT_SIZE \
+ CL_ALIGN((sizeof(struct cl_monitor_header) + (sizeof(CL_MonitorEntry_t) * CL_MONITOR_ENTRY_NUM)), 4096)
+
+#define CL_MONITOR_SET_BIT(a, i) (a[i / 64] |= (1ULL << (i % 64)))
+#define CL_MONITOR_CLEAR_BIT(a, i) (a[i / 64] &= ~(1ULL << (i % 64)))
+
+static struct cl_monitor_header *cl_monitor_obj;
+static CL_MonitorEntry_t *cl_monitor_entry_head;
+
+int CL_MonitorInit(CL_MonitorInit_t init_type) {
+ int fd;
+ int oflag;
+ mode_t mode;
+
+ if (init_type != CL_MONITOR_INIT_SYSTEM && init_type != CL_MONITOR_INIT_USER) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (cl_monitor_obj != NULL) {
+ return 0;
+ }
+
+ if (init_type == CL_MONITOR_INIT_SYSTEM) {
+ oflag = O_RDWR | O_CREAT | O_EXCL;
+ mode = 0666;
+ } else {
+ oflag = O_RDWR;
+ mode = 0;
+ }
+
+ if ((fd = shm_open(CL_MONITOR_SHM_NAME, oflag, mode)) == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function shm_open
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function shm_open
+ }
+
+ if (init_type == CL_MONITOR_INIT_SYSTEM) {
+ if (ftruncate(fd, CL_MONITOR_OBJECT_SIZE) == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function ftruncate
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for glibc function ftruncate
+ }
+ } else {
+ struct stat st_buf;
+ if (fstat(fd, &st_buf) == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function fstat
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for glibc function fstat
+ }
+
+ if (st_buf.st_size != CL_MONITOR_OBJECT_SIZE) {
+ errno = EAGAIN;
+ return -1;
+ }
+ }
+
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function mmap
+ if ((cl_monitor_obj = mmap(NULL, CL_MONITOR_OBJECT_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for glibc function mmap
+ }
+
+ if (init_type == CL_MONITOR_INIT_SYSTEM) { // LCOV_EXCL_BR_LINE 11: out branch
+ memcpy(cl_monitor_obj->signature, "CLAM", 4);
+ memset(cl_monitor_obj->bitmap, 0, sizeof(cl_monitor_obj->bitmap));
+ sem_init(&cl_monitor_obj->sem, 1, 1);
+ }
+ cl_monitor_entry_head = (CL_MonitorEntry_t *)(((char *)cl_monitor_obj) + sizeof(struct cl_monitor_header));
+
+ return 0;
+}
+
+static inline int cl_monitor_check_type_id(CL_MonitorType_t type, uint32_t id, int *offset) {
+ if (type == CL_MONITOR_TYPE_GENERIC) {
+ if (id > CL_MONITOR_ID_REAL_GENERIC_END) {
+ errno = ENOENT;
+ return -1;
+ }
+ *offset = (int)((id - CL_MONITOR_ID_REAL_GENERIC_START) + CL_MONITOR_ID_FLAT_GENERIC_START);
+ } else if (type == CL_MONITOR_TYPE_RPC) {
+ if (id < CL_MONITOR_ID_REAL_RPC_START || id > CL_MONITOR_ID_REAL_RPC_END) {
+ errno = ENOENT;
+ return -1;
+ }
+ *offset = (int)((id - CL_MONITOR_ID_REAL_RPC_START) + CL_MONITOR_ID_FLAT_RPC_START);
+ } else {
+ errno = ENOENT;
+ return -1;
+ }
+
+ return 0;
+}
+
+static inline int cl_monitor_sem_wait(sem_t *sem) {
+ int ret;
+
+retry:
+ ret = sem_wait(sem);
+ if (ret == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sem_wait
+ // LCOV_EXCL_START 5: fail safe for libc sem_wait
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ if (errno == EINTR) {
+ goto retry;
+ }
+ CL_PERROR("sem_wait");
+ }
+ // LCOV_EXCL_STOP
+
+ return ret;
+}
+
+static inline int cl_monitor_sem_post(sem_t *sem) {
+ int ret;
+
+ if ((ret = sem_post(sem)) == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sem_post
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("sem_post"); // LCOV_EXCL_LINE 5: fail safe for libc sem_post
+ }
+
+ return ret;
+}
+
+int CL_MonitorSetEntry(CL_MonitorType_t type, uint32_t id, CL_MonitorState_t state, uint32_t timeout,
+ uint32_t user_data) {
+ int offset;
+ CL_MonitorEntry_t *e;
+ struct timespec ts;
+
+ if (cl_monitor_obj == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (cl_monitor_check_type_id(type, id, &offset) == -1) {
+ return -1;
+ }
+
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for libc clock_gettime
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for libc clock_gettime
+ }
+
+ e = cl_monitor_entry_head + offset;
+ cl_monitor_sem_wait(&cl_monitor_obj->sem);
+
+ if (state == CL_MONITOR_STATE_SLEEP) {
+ memset(e, 0, sizeof(CL_MonitorEntry_t));
+ CL_MONITOR_CLEAR_BIT(cl_monitor_obj->bitmap, offset);
+ } else {
+ e->pid = (uint16_t)getpid();
+ e->type = type;
+ e->state = state;
+
+// e->timeout = (uint32_t)ts.tv_sec + timeout;
+ e->timeout = ts.tv_sec + timeout;
+ e->id = id;
+ e->user_data = user_data;
+ CL_MONITOR_SET_BIT(cl_monitor_obj->bitmap, offset);
+ }
+
+ cl_monitor_sem_post(&cl_monitor_obj->sem);
+
+ return 0;
+}
+
+int CL_MonitorGetEntry(CL_MonitorType_t type, uint32_t id, CL_MonitorEntry_t *entry) {
+ int offset;
+ CL_MonitorEntry_t *e;
+
+ if (cl_monitor_obj == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (entry == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (cl_monitor_check_type_id(type, id, &offset) == -1) {
+ return -1;
+ }
+
+ e = cl_monitor_entry_head + offset;
+ cl_monitor_sem_wait(&cl_monitor_obj->sem);
+
+ memcpy(entry, e, sizeof(CL_MonitorEntry_t));
+
+ cl_monitor_sem_post(&cl_monitor_obj->sem);
+
+ return 0;
+}
+
+int CL_MonitorSearchInit(CL_MonitorSearch_t *serch) {
+ if (serch == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ serch->entry_list = NULL;
+ serch->entry_num = 0;
+ return 0;
+}
+
+int CL_MonitorSearchDestroy(CL_MonitorSearch_t *serch) {
+ if (serch == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ free(serch->entry_list);
+ serch->entry_num = 0;
+ return 0;
+}
+
+static inline int cl_monitor_popcnt64(uint64_t x) {
+ uint64_t n;
+
+ n = (x >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ n = (n >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ n = (n >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fULL;
+ x = x * 0x0101010101010101ULL;
+ return (int)(x >> 56);
+}
+
+typedef struct cl_monitor_offset_s cl_monitor_offset_t;
+struct cl_monitor_offset_s {
+ cl_monitor_offset_t *next;
+ int offset;
+};
+
+int CL_MonitorSearchTimeout(CL_MonitorSearch_t *search) {
+ int i;
+ int offset;
+ CL_MonitorEntry_t *e;
+ struct timespec ts;
+ int timeout_entry_num = 0;
+ cl_region_t *r;
+ cl_monitor_offset_t *o, *head = NULL, *tail = NULL;
+
+ if (cl_monitor_obj == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (search == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if ((r = CL_RegionCreate(CL_REGION_DEFAULT_SIZE)) == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ free(search->entry_list);
+ search->entry_list = NULL;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) {// LCOV_EXCL_BR_LINE 5: fail safe for libc clock_gettime
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1;// LCOV_EXCL_LINE 5: fail safe for libc clock_gettime
+ }
+
+ cl_monitor_sem_wait(&cl_monitor_obj->sem);
+
+ for (i = 0; i < CL_MONITOR_BITMAP_LENGTH; i++) {
+ if (cl_monitor_obj->bitmap[i] != 0) {
+ uint64_t bits, mrb1; // most right bit 1
+
+ bits = cl_monitor_obj->bitmap[i];
+ while (bits) {
+ mrb1 = bits & (-bits);
+ offset = i * 64 + cl_monitor_popcnt64(mrb1 - 1);
+ e = cl_monitor_entry_head + offset;
+
+ if (e->timeout <= ts.tv_sec) {
+ timeout_entry_num++;
+ if ((o = CL_RegionAlloc(r, cl_monitor_offset_t, 1)) == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for mmap
+ // LCOV_EXCL_START 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = ENOMEM;
+ timeout_entry_num = -1;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+
+ o->offset = offset;
+ o->next = NULL;
+
+ if (head == NULL) {
+ head = tail = o;
+ } else {
+ tail->next = o;
+ tail = o;
+ }
+ }
+ bits &= ~mrb1;
+ }
+ }
+ }
+
+ if (timeout_entry_num) {
+ CL_MonitorEntry_t *src, *dst;
+ dst = malloc(sizeof(CL_MonitorEntry_t) * (size_t)timeout_entry_num);
+ if (dst == NULL) { // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = ENOMEM; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ timeout_entry_num = -1; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ }
+
+ search->entry_list = dst;
+ o = head;
+ for (i = 0; i < timeout_entry_num; i++) {
+ src = cl_monitor_entry_head + o->offset;
+ memcpy(dst, src, sizeof(CL_MonitorEntry_t));
+
+ o = o->next;
+ dst++;
+ }
+ }
+
+exit:
+ cl_monitor_sem_post(&cl_monitor_obj->sem);
+
+ CL_RegionDestroy(r);
+ search->entry_num = (timeout_entry_num == -1) ? 0 : timeout_entry_num; // LCOV_EXCL_BR_LINE 11: out branch
+ return timeout_entry_num;
+}
+
+int cl_monitor_cleanup(int pid) {
+ int ret = 0;
+ int i;
+ int offset;
+ CL_MonitorEntry_t *e;
+
+ if (cl_monitor_obj == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (pid <= 0) { // LCOV_EXCL_LINE 5: fail safe for glibc function waitid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = EINVAL;// LCOV_EXCL_LINE 5: fail safe for glibc function waitid
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function waitid
+ }
+
+ cl_monitor_sem_wait(&cl_monitor_obj->sem);
+
+ for (i = 0; i < CL_MONITOR_BITMAP_LENGTH; i++) {
+ if (cl_monitor_obj->bitmap[i] != 0) {
+ uint64_t bits, mrb1; // most right bit 1
+
+ bits = cl_monitor_obj->bitmap[i];
+ while (bits) {
+ mrb1 = bits & (-bits);
+ offset = i * 64 + cl_monitor_popcnt64(mrb1 - 1);
+
+ e = cl_monitor_entry_head + offset;
+ if (e->pid == pid) {
+ memset(e, 0, sizeof(CL_MonitorEntry_t));
+ CL_MONITOR_CLEAR_BIT(cl_monitor_obj->bitmap, offset);
+ ret++;
+ }
+
+ bits &= ~mrb1;
+ }
+ }
+ }
+
+ cl_monitor_sem_post(&cl_monitor_obj->sem);
+
+ return ret;
+}
diff --git a/nsframework/common_library/client/src/cl_process.c b/nsframework/common_library/client/src/cl_process.c
new file mode 100755
index 0000000..5c9f5a4
--- /dev/null
+++ b/nsframework/common_library/client/src/cl_process.c
@@ -0,0 +1,1198 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <errno.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <sched.h>
+#include <semaphore.h>
+#include <pthread.h>
+#include <limits.h>
+#include <sys/prctl.h>
+#include <sys/signalfd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <sys/syscall.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#include <native_service/cl_process.h>
+#include "cl_process_internal.h"
+#include "cl_error.h"
+#include "cl_cgroup.h"
+#include "cl_monitor_internal.h"
+
+#define assert_static(e) \
+ do { \
+ enum { assert_static__ = 1/(e) }; \
+ } while (0)
+
+struct linux_dirent64 {
+ ino64_t d_ino;
+ off64_t d_off;
+ unsigned short d_reclen;
+ unsigned char d_type;
+ char d_name[];
+};
+
+/*
+ * Initialize the process
+ */
+int CL_ProcessInit(void) {
+ int sfd = -1;
+ char *name;
+ sigset_t mask;
+
+ assert_static(sizeof(CL_ProcessAttr_t) == sizeof(CL_ProcessAttrInternal_t));
+
+ name = getenv(CL_PROCESS_NAME_ENV);
+ if (name != NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc getenv
+ if (prctl(PR_SET_NAME, name) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc getenv
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("prctl"); // LCOV_EXCL_LINE 5: fail safe for libc getenv
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc getenv
+ }
+ }
+
+ if (sigemptyset(&mask) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sigemptyset
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("sigemptyset"); // LCOV_EXCL_LINE 5: fail safe for libc sigemptyset
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc sigemptyset
+ }
+ if (sigaddset(&mask, SIGCHLD) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sigaddset
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("sigaddset"); // LCOV_EXCL_LINE 5: fail safe for libc sigaddset
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc sigaddset
+ }
+ if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sigprocmask
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("sigprocmask"); // LCOV_EXCL_LINE 5: fail safe for libc sigprocmask
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc sigprocmask
+ }
+
+ if ((sfd = signalfd(-1, &mask, SFD_NONBLOCK | SFD_CLOEXEC)) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc signalfd
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("signalfd"); // LCOV_EXCL_LINE 5: fail safe for libc signalfd
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc signalfd
+ }
+
+exit:
+ return sfd;
+}
+
+/*
+ * start of the functions to be executed from fork to exec
+ */
+static void cl_process_pf_err(char no) {
+ char errorstr[17] = "err:post_fork:0\n";
+
+ errorstr[14] = no;
+ while (1) {
+ if (write(STDERR_FILENO, errorstr, 16) == -1 && errno == EINTR) { // LCOV_EXCL_BR_LINE 5: fail safe for libc write
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue; // LCOV_EXCL_LINE 5: fail safe for libc write
+ }
+ break;
+ }
+}
+
+static inline int cl_process_pf_set_schedule(const CL_ProcessAttrInternal_t *ia) {
+ int ret = -1;
+ struct sched_param param;
+ int policy;
+
+ switch (ia->sched_policy) {
+ case CL_PROCESS_SCHED_POLICY_RR:
+ policy = SCHED_RR;
+ param.sched_priority = ia->sched_priority;
+ break;
+ case CL_PROCESS_SCHED_POLICY_FIFO:
+ param.sched_priority = ia->sched_priority;
+ policy = SCHED_FIFO;
+ break;
+ default:
+ param.sched_priority = 0;
+ policy = SCHED_OTHER;
+ break;
+ }
+ if (sched_setscheduler(getpid(), policy, &param) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function sched_setscheduler
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('3');// LCOV_EXCL_LINE 5: fail safe for glibc function sched_setscheduler
+ goto exit;// LCOV_EXCL_LINE 5: fail safe for glibc function sched_setscheduler
+ }
+ if (ia->sched_policy == CL_PROCESS_SCHED_POLICY_OTHER) {
+ if (setpriority(PRIO_PROCESS, (__id_t)getpid(), ia->sched_priority) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function setpriority
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ cl_process_pf_err('4');// LCOV_EXCL_LINE 5: fail safe for glibc function setpriority
+ goto exit;// LCOV_EXCL_LINE 5: fail safe for glibc function setpriority
+ }
+ }
+ ret = 0;
+
+exit:
+ return ret;
+}
+
+static inline int cl_process_pf_check_close_fd(int check_fd, int dirfd, int hold_fds_num, const int *hold_fds) {
+ int i;
+
+ if (check_fd < 3 || check_fd == dirfd) {
+ return 0;
+ }
+
+ for (i = 0; i < hold_fds_num; i++) {
+ if (check_fd == *(hold_fds + i)) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+static inline int cl_process_pf_fname2fd(const char *s) {
+ int result = 0;
+ for (; *s != '\0'; s++) {
+ result = result * 10 + (*s - '0');
+ }
+ return result;
+}
+
+static inline int cl_process_pf_cleanup_fds(const CL_ProcessAttrInternal_t *ia) {
+ int ret = -1;
+ int dfd;
+#define BUF_SIZE 128
+ char buf[BUF_SIZE];
+ struct linux_dirent64 *d;
+ int hold_fds_num, i;
+
+ for (i = 0; i < CL_PROCESSS_ATTR_HOLD_FDS_NUM; i++) {
+ if (ia->hold_fds[i] == 0) {
+ break;
+ }
+ }
+ hold_fds_num = i;
+
+ if ((dfd = open("/proc/self/fd/", O_RDONLY | O_DIRECTORY | O_CLOEXEC)) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function open
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ cl_process_pf_err('8');// LCOV_EXCL_LINE 5: fail safe for glibc function open
+ goto exit;// LCOV_EXCL_LINE 5: fail safe for glibc function open
+ }
+
+ while (1) {
+ long nread;
+ int fd;
+ int bpos;
+
+ nread = syscall(SYS_getdents64, dfd, buf, sizeof(buf));
+ if (nread == -1) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function syscall
+ // LCOV_EXCL_START 5: fail safe for glibc function syscall
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ cl_process_pf_err('9');
+ close(dfd);
+ goto exit;
+ }
+ // LCOV_EXCL_STOP
+
+ if (nread == 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function syscall
+ break;
+ }
+
+ for (bpos = 0; bpos < nread;) {
+ d = (struct linux_dirent64 *)(buf + bpos);
+ fd = cl_process_pf_fname2fd(d->d_name);
+ if (cl_process_pf_check_close_fd(fd, dfd, hold_fds_num, ia->hold_fds)) {
+ close(fd);
+ }
+ bpos += d->d_reclen;
+ }
+ }
+ close(dfd);
+ ret = 0;
+
+exit:
+ return ret;
+}
+
+static void cl_process_post_fork(const char *file, char *const argv[], char *const envp[],
+ const CL_ProcessAttrInternal_t *ia) {
+ int intfy_fd;
+ char intfy_fname[32] = "/tmp/intfy_00000";
+ pid_t pid = getpid();
+
+ intfy_fname[11] = (char)(intfy_fname[11] + (pid / 10000));
+ intfy_fname[12] = (char)(intfy_fname[12] + ((pid / 1000) % 10));
+ intfy_fname[13] = (char)(intfy_fname[13] + ((pid / 100) % 10));
+ intfy_fname[14] = (char)(intfy_fname[14] + ((pid / 10) % 10));
+ intfy_fname[15] = (char)(intfy_fname[15] + (pid % 10));
+
+ unlink(intfy_fname);
+ if ((intfy_fd = open(intfy_fname, O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666)) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function open
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('0'); // LCOV_EXCL_LINE 5:libc fail safe for open
+ goto exit; // LCOV_EXCL_LINE 5:libc fail safe for open
+ }
+ if (close(intfy_fd) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function close
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('1'); // LCOV_EXCL_LINE 5:libc fail safe for close
+ goto exit; // LCOV_EXCL_LINE 5:libc fail safe for close
+ }
+
+ // Process group
+ if (ia->create_group) {
+ if (setpgid(getpid(), getpid()) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function setpgid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('2'); // LCOV_EXCL_LINE 5: fail safe for glibc function setpgid
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for glibc function setpgid
+ }
+ }
+
+ // Scheduling Policy/Priority
+ if (cl_process_pf_set_schedule(ia) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function sched_setscheduler
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for glibc function sched_setscheduler
+ }
+
+ // UID/GID
+ if (ia->gid) {
+ if (setgid(ia->gid) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function setgid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('5'); // LCOV_EXCL_LINE 5: fail safe for glibc function setgid
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for glibc function setgid
+ }
+ }
+
+ if (ia->uid) {
+ uid_t uid = (ia->uid == UINT_MAX) ? 0 : ia->uid;
+ if (setuid(uid) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function setuid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('6');// LCOV_EXCL_LINE 5: fail safe for glibc function setuid
+ goto exit;// LCOV_EXCL_LINE 5: fail safe for glibc function setuid
+ }
+ }
+
+ // stack size
+ if (ia->stack_size) {
+ struct rlimit rlim;
+ getrlimit(RLIMIT_STACK, &rlim);
+ rlim.rlim_cur = (rlim_t)ia->stack_size;
+ if (setrlimit(RLIMIT_STACK, &rlim) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function setrlimit
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ cl_process_pf_err('7');// LCOV_EXCL_LINE 5: fail safe for glibc function setrlimit
+ }
+ }
+
+ // cleanup fds
+ if (ia->disable_close_fds == 0) {
+ if (cl_process_pf_cleanup_fds(ia) < 0) {
+ goto exit;
+ }
+ }
+
+ // exec
+ if (execve(file, argv, envp) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function execve
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('A');// LCOV_EXCL_LINE 5: fail safe for glibc function execve
+ }
+
+exit:
+ return;
+}
+/*
+ * end of the functions to be executed from fork to exec
+ */
+
+static int cl_process_pre_fork(char *const envp[], char ***new_env, const CL_ProcessAttrInternal_t *ia) {
+ int i;
+ size_t envlen = 0;
+ char **e;
+ char *b;
+ int new_env_count;
+ size_t name_env_len = strlen(CL_PROCESS_NAME_ENV);
+ int last_name_env_pos = -1;
+
+ if (envp == NULL) {
+ e = environ;
+ } else {
+ e = (char **)envp;
+ }
+
+ for (i = 0; e[i] != NULL; i++) {
+ if (strncmp(e[i], CL_PROCESS_NAME_ENV, name_env_len) == 0) {
+ last_name_env_pos = i;
+ } else {
+ envlen += strlen(e[i]) + 1;
+ }
+ }
+
+ if (ia->name[0] != 0) {
+ envlen += strlen(CL_PROCESS_NAME_ENV) + 1 + strlen(ia->name) + 1;
+ i++;
+ }
+
+ if ((b = malloc(envlen)) == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_ERR_PRINT("malloc fail"); // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ errno = EFAULT; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ goto error; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ }
+ memset(b, 0, envlen);
+
+ if ((*new_env = malloc(sizeof(char *) * (size_t)(i + 1))) == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ free(b); // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ CL_ERR_PRINT("malloc fail"); // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ errno = EFAULT; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ goto error; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ }
+ memset(*new_env, 0, sizeof(char *) * (size_t)(i + 1));
+
+ new_env_count = 0;
+ for (i = 0; e[i] != NULL; i++) {
+ if (i == last_name_env_pos) {
+ continue;
+ }
+ strcpy(b, e[i]);
+ *(*new_env + i) = b;
+ b += strlen(e[i]) + 1;
+ new_env_count++;
+ }
+
+ if (ia->name[0] != 0) {
+ *(*new_env + new_env_count) = b;
+ b += sprintf(b, "%s=%s", CL_PROCESS_NAME_ENV, ia->name);
+ b++;
+ new_env_count++;
+ }
+
+ return 0;
+
+error:
+ return -1;
+}
+
+/*
+ * Create process
+ */
+int CL_ProcessCreate(const char *file, char *const argv[], char *const envp[], const CL_ProcessAttr_t *attr) {
+ const CL_ProcessAttrInternal_t *ia = (const CL_ProcessAttrInternal_t *)attr;
+ pid_t childpid;
+ char intfy_fname[32];
+ char **new_env;
+ int ret;
+ int retry;
+ int i = 0;
+
+ if (file == NULL || argv == NULL || attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (cl_process_pre_fork(envp, &new_env, ia) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc function malloc
+ return -1;
+ }
+
+ childpid = fork();
+ switch (childpid) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function fork
+ case 0: /* child process */
+ cl_process_post_fork(file, argv, new_env, ia);
+ _exit(CL_PROCESS_EXIT_INTERNAL);
+ break;
+
+ case -1: /* error */
+ goto exit;
+
+ default: /* parent process */
+ break;
+ }
+
+ if (ia->cpu_assign != 0) {
+ cpu_set_t set;
+ CPU_ZERO(&set);
+ for (i = 0; i < (sizeof(ia->cpu_assign) * 8); i++) {
+ if ((ia->cpu_assign >> i) & 0x1) {
+ CPU_SET(i, &set);
+ }
+ }
+ // LCOV_EXCL_BR_START 5: fail safe for libc sched_setaffinity
+ if (sched_setaffinity(childpid, sizeof(set), &set) < 0) {
+ // LCOV_EXCL_BR_STOP
+ int last_errno = errno;
+ CL_PERROR("sched_setaffinity");
+ errno = last_errno;
+ childpid = -1;
+ goto exit;
+ }
+ }
+
+ ret = snprintf(intfy_fname, sizeof(intfy_fname), CL_INTFY_FILENAME_FORMAT, childpid);
+ if (ret < 0 || ret > sizeof(intfy_fname)) {// LCOV_EXCL_BR_LINE 5: fail safe for libc snprintf
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_ERR_PRINT("snprintf fail:%d", ret); // LCOV_EXCL_LINE 5: fail safe for libc snprintf
+ childpid = -1; // LCOV_EXCL_LINE 5: fail safe for libc snprintf
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc snprintf
+ }
+
+ if (ia->cgroup_name[0] != '\0') {
+ if (cl_cgroup_exist(CL_CGROUP_CPU, ia->cgroup_name) == 0) {
+ if (cl_cgroup_set_num(CL_CGROUP_CPU, ia->cgroup_name, "tasks", childpid) < 0) {
+ int last_errno = errno;
+ CL_PERROR("cl_cgroup_set_num");
+ errno = last_errno;
+ childpid = -1;
+ goto exit;
+ }
+ }
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function access
+ if (cl_cgroup_exist(CL_CGROUP_MEMORY, ia->cgroup_name) == 0) {
+ // LCOV_EXCL_BR_STOP
+ if (cl_cgroup_set_num(CL_CGROUP_MEMORY, ia->cgroup_name, "tasks", childpid) < 0) {
+ int last_errno = errno;
+ CL_PERROR("cl_cgroup_set_num");
+ errno = last_errno;
+ childpid = -1;
+ goto exit;
+ }
+ }
+ }
+
+ for (retry = 100; retry >= 0; retry--) {
+ if (access(intfy_fname, F_OK) == 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function access
+ break;
+ }
+ usleep(100);
+ }
+
+exit:
+ free(new_env[0]);
+ free(new_env);
+
+ return childpid;
+}
+
+/*
+ * Initialize process attribute
+ */
+int CL_ProcessCreateAttrInit(CL_ProcessAttr_t *attr) {
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset(attr, 0, sizeof(CL_ProcessAttr_t));
+ return 0;
+}
+
+/*
+ * Set process attribute (process name)
+ */
+int CL_ProcessCreateAttrSetName(CL_ProcessAttr_t *attr, const char *name) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL || name == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ strncpy(ia->name, name, 16);
+ ia->name[15] = 0;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (user ID)
+ */
+int CL_ProcessCreateAttrSetUid(CL_ProcessAttr_t *attr, uid_t uid) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->uid = uid;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (group ID)
+ */
+int CL_ProcessCreateAttrSetGid(CL_ProcessAttr_t *attr, gid_t gid) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->gid = gid;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (schedule policy and priority)
+ */
+int CL_ProcessCreateAttrSetSchedule(CL_ProcessAttr_t *attr, CL_ProcessSchedPolicy_t policy, int priority) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (policy == CL_PROCESS_SCHED_POLICY_RR || policy == CL_PROCESS_SCHED_POLICY_FIFO) {
+ if (priority < 1 || priority > 99) {
+ errno = EINVAL;
+ return -1;
+ }
+ } else if (policy == CL_PROCESS_SCHED_POLICY_OTHER) {
+ if (priority < -20 || priority > 19) {
+ CL_ERR_PRINT("Invlid SCHED_OTHER priority:%d", priority);
+ }
+ } else {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->sched_policy = policy;
+ ia->sched_priority = priority;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (process group)
+ */
+int CL_ProcessCreateAttrSetGroup(CL_ProcessAttr_t *attr, int create) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (create < 0 || create > 1) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->create_group = create;
+
+ return 0;
+}
+
+static int32_t CL_CpuAssignMsbCpu(int cpu_assign) {
+ int32_t i;
+ int32_t ret = 0;
+
+ for (i = 0; i < (sizeof(cpu_assign) * 8); i++) {
+ if ((cpu_assign >> i) & 0x1)
+ ret = i;
+ }
+
+ return ret;
+}
+
+/**
+ * Set process attribute (CPU Assign)
+ */
+int CL_ProcessCreateAttrSetCpuAssign(CL_ProcessAttr_t *attr, int cpu_assign) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (cpu_assign < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (CL_CpuAssignMsbCpu(cpu_assign) >= sysconf(_SC_NPROCESSORS_CONF)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->cpu_assign = cpu_assign;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (Stack Size)
+ */
+int CL_ProcessCreateAttrSetStackSize(CL_ProcessAttr_t *attr, int stack_size) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->stack_size = stack_size;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (FD to maintain)
+ */
+int CL_ProcessCreateAttrSetHoldFds(CL_ProcessAttr_t *attr, int hold_fds[]) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL || hold_fds == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memcpy(ia->hold_fds, hold_fds, sizeof(ia->hold_fds));
+
+ return 0;
+}
+
+/*
+ * Set process attribute (to suspend forced FD close)
+ */
+int CL_ProcessCreateAttrSetDisableCloseFds(CL_ProcessAttr_t *attr) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->disable_close_fds = 1;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (Cgroup)
+ */
+int CL_ProcessCreateAttrSetCgroup(CL_ProcessAttr_t *attr, const char *cgroup_name) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL || cgroup_name == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (strlen(cgroup_name) >= sizeof(ia->cgroup_name)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ strcpy(ia->cgroup_name, cgroup_name);
+
+ return 0;
+}
+
+/*
+ * Kill process
+ */
+int CL_ProcessTerminate(pid_t pid) {
+ return kill(pid, SIGKILL);
+}
+
+/*
+ * Kill process group
+ */
+int CL_ProcessTerminateGroup(pid_t pid) {
+ return killpg(pid, SIGKILL);
+}
+
+/**
+ * Forced process termination
+ */
+int CL_ProcessAbort(pid_t pid) {
+ return kill(pid, SIGABRT);
+}
+
+/**
+ * Forced process group termination
+ */
+int CL_ProcessAbortGroup(pid_t pid) {
+ return killpg(pid, SIGABRT);
+}
+
+/**
+ * Euthanize process group
+ */
+int CL_ProcessEuthanizeGroup(pid_t pid) {
+ usleep(10 * 1000);
+ return killpg(pid, SIGKILL);
+}
+
+/*
+ * Collect child process
+ */
+int CL_ProcessCleanup(int sigchld_fd, CL_ProcessCleanupInfo_t *cleanup_info) {
+ struct signalfd_siginfo fdsi;
+ ssize_t s;
+ siginfo_t info;
+ int ret;
+ char intfy_fname[32];
+
+ if (cleanup_info == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ while (1) {
+ s = read(sigchld_fd, &fdsi, sizeof(struct signalfd_siginfo));
+ if (s != sizeof(struct signalfd_siginfo)) {
+ if (s == -1 && errno == EINTR) {
+ continue;
+ }
+ break;
+ }
+ }
+
+ info.si_pid = 0;
+ while (1) {
+ ret = waitid(P_ALL, 0, &info, WEXITED | WNOHANG);
+ if (ret == -1) {
+ return -1;
+ } else if (ret == 0 && info.si_pid == 0) {
+ errno = ECHILD;
+ return -1;
+ }
+ break;
+ }
+
+ cleanup_info->pid = info.si_pid;
+ cleanup_info->code = info.si_code;
+ cleanup_info->status = info.si_status;
+
+ cl_monitor_cleanup(info.si_pid);
+
+ ret = snprintf(intfy_fname, sizeof(intfy_fname), CL_INTFY_FILENAME_FORMAT, info.si_pid);
+
+ if (ret < 0 || ret > sizeof(intfy_fname)) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function snprintf
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_ERR_PRINT("snprintf fail:%d\n", ret);// LCOV_EXCL_LINE 5: fail safe for glibc function snprintf
+ goto exit;// LCOV_EXCL_LINE 5: fail safe for glibc function snprintf
+ }
+ if (unlink(intfy_fname) < 0) {
+ CL_PERROR("unlink");
+ }
+
+exit:
+ info.si_pid = 0;
+ ret = waitid(P_ALL, 0, &info, WEXITED | WNOWAIT | WNOHANG);
+ if (ret == 0 && info.si_pid != 0) {
+ return 1;
+ } else if (ret == -1 && errno != ECHILD) {
+ return -1;
+ }
+ return 0;
+}
+
+typedef struct {
+ sem_t sem;
+ CL_ThreadAttrInternal_t *ia;
+ void *(*start_routine)(void *);
+ void *start_arg;
+} create_thread_arg_t;
+
+static void *thread_start_func(void *arg) {
+ create_thread_arg_t *p = (create_thread_arg_t *)arg;
+ void *(*start_routine)(void *) = p->start_routine;
+ void *start_arg = p->start_arg;
+
+ prctl(PR_SET_NAME, p->ia->name != 0 ? p->ia->name : NULL);
+
+ if (sem_post(&p->sem) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for libc sem_post
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_PERROR("sem_post"); // LCOV_EXCL_LINE 5: fail safe for libc sem_post
+ }
+
+ return (*start_routine)(start_arg);
+}
+
+/*
+ * Create thread
+ */
+int CL_ThreadCreate(pthread_t *thread, pthread_attr_t *attr, CL_ThreadAttr_t *cl_attr, void *(*start_routine)(void *),
+ void *arg) {
+ int ret;
+ create_thread_arg_t cr_arg = { .ia = (CL_ThreadAttrInternal_t *)cl_attr,
+ .start_routine = start_routine,
+ .start_arg = arg
+ };
+
+ if (thread == NULL || cl_attr == NULL || start_routine == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (sem_init(&cr_arg.sem, 0, 0) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sem_init
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for libc sem_init
+ }
+
+ // LCOV_EXCL_BR_START 5: fail safe for libc pthread_create
+ if ((ret = pthread_create(thread, attr, thread_start_func, &cr_arg)) != 0) {
+ // LCOV_EXCL_BR_STOP
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = ret; // LCOV_EXCL_LINE 5: fail safe for libc pthread_create
+ return -1; // LCOV_EXCL_LINE 5: fail safe for libc pthread_create
+ }
+
+ if (sem_wait(&cr_arg.sem) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for libc sem_wait
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for libc sem_wait
+ }
+
+ return 0;
+}
+
+/*
+ * Initialize CommonLibrary extension thread attribute
+ */
+int CL_ThreadCreateAttrInit(CL_ThreadAttr_t *attr) {
+ assert_static(sizeof(CL_ThreadAttr_t) == sizeof(CL_ThreadAttrInternal_t));
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset(attr, 0, sizeof(CL_ThreadAttr_t));
+ return 0;
+}
+
+/*
+ * Set CommonLibrary extension thread attribute (thread name)
+ */
+int CL_ThreadCreateAttrSetName(CL_ThreadAttr_t *attr, const char *name) {
+ CL_ThreadAttrInternal_t *ia = (CL_ThreadAttrInternal_t *)attr;
+
+ if (attr == NULL || name == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ strncpy(ia->name, name, 16);
+ ia->name[15] = 0;
+
+ return 0;
+}
+
+/*
+ * Create Cgroup
+ */
+int CL_ProcessCreateCgroupCreate(const char *cgroup_name, CL_ProcessCreateCgroupAttr_t *attr) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+ CL_ProcessCreateCgroupAttrInternal_t cmp;
+
+ if (cgroup_name == NULL || attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset(&cmp, 0, sizeof(CL_ProcessCreateCgroupAttrInternal_t));
+ if (memcmp(ia, &cmp, sizeof(CL_ProcessCreateCgroupAttrInternal_t)) == 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (ia->rt_runtime_us || ia->cfs_quota_us || ia->cpu_shares) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function mkdir
+ if (cl_cgroup_make(CL_CGROUP_CPU, cgroup_name) < 0) {
+ // LCOV_EXCL_BR_STOP
+ return -1;
+ }
+
+ if (ia->rt_runtime_us) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function write
+ if (cl_cgroup_set_num(CL_CGROUP_CPU, cgroup_name, "cpu.rt_runtime_us", ia->rt_runtime_us) < 0) {
+ // LCOV_EXCL_BR_STOP
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function write
+ }
+ }
+
+ if (ia->cfs_quota_us) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function write
+ if (cl_cgroup_set_num(CL_CGROUP_CPU, cgroup_name, "cpu.cfs_quota_us", ia->cfs_quota_us) < 0) {
+ // LCOV_EXCL_BR_STOP
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function write
+ }
+ }
+
+ if (ia->cpu_shares) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function write
+ if (cl_cgroup_set_num(CL_CGROUP_CPU, cgroup_name, "cpu.shares", ia->cpu_shares) < 0) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function write
+ }
+ }
+ }
+
+ if (ia->memory_limit || ia->usage_in_bytes || ia->event_fd) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function mkdir
+ if (cl_cgroup_make(CL_CGROUP_MEMORY, cgroup_name) < 0) {
+ // LCOV_EXCL_BR_STOP
+ return -1;
+ }
+
+ if (ia->memory_limit) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function write
+ if (cl_cgroup_set_num(CL_CGROUP_MEMORY, cgroup_name, "memory.limit_in_bytes", ia->memory_limit) < 0) {
+ // LCOV_EXCL_BR_STOP
+ return -1;
+ }
+
+ if (cl_cgroup_set_num(CL_CGROUP_MEMORY, cgroup_name, "memory.memsw.limit_in_bytes", ia->memory_limit) < 0) {
+ return -1;
+ }
+
+ }
+
+ if (ia->usage_in_bytes || ia->event_fd) {
+ int checkfd;
+ char setstr[64];
+
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function open
+ if ( (checkfd = cl_cgroup_open(CL_CGROUP_MEMORY, cgroup_name, "memory.memsw.usage_in_bytes", O_RDONLY)) < 0) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: fail safe for glibc function open
+ }
+
+ snprintf(setstr, sizeof(setstr), "%d %d %d", ia->event_fd, checkfd, ia->usage_in_bytes);
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function write
+ if (cl_cgroup_set_string(CL_CGROUP_MEMORY, cgroup_name, "cgroup.event_control", setstr) < 0) {
+ // LCOV_EXCL_BR_STOP
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function write
+ }
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * Initialize Cgroup attribute
+ */
+int CL_ProcessCreateCgroupAttrInit(CL_ProcessCreateCgroupAttr_t *attr) {
+ assert_static(sizeof(CL_ProcessCreateCgroupAttr_t) == sizeof(CL_ProcessCreateCgroupAttrInternal_t));
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset(attr, 0, sizeof(CL_ProcessCreateCgroupAttr_t));
+ return 0;
+}
+
+/*
+ * Set Cgroup attribute (RT Throttling)
+ */
+int CL_ProcessCreateCgroupAttrSetRtThrottling(CL_ProcessCreateCgroupAttr_t *attr, int runtime_us) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->rt_runtime_us = runtime_us;
+
+ return 0;
+}
+
+/*
+ * Set Cgroup attribute (CFS Bandwidth Control)
+ */
+int CL_ProcessCreateCgroupAttrSetCfsBandwidthControl(CL_ProcessCreateCgroupAttr_t *attr, int cfs_quota_us) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->cfs_quota_us = cfs_quota_us;
+
+ return 0;
+}
+
+/*
+ * Set Cgroup attribute (CPU Shares)
+ */
+int CL_ProcessCreateCgroupAttrSetCpuShares(CL_ProcessCreateCgroupAttr_t *attr, int cpu_shares) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->cpu_shares = cpu_shares;
+
+ return 0;
+}
+
+/*
+ * Set Cgroup attribute (Memory Limit)
+ */
+int CL_ProcessCreateCgroupAttrSetMemoryLimit(CL_ProcessCreateCgroupAttr_t *attr, int memory_limit) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->memory_limit = memory_limit;
+
+ return 0;
+}
+
+/*
+ * Set Cgroup attribute (Memory Usage Notification)
+ */
+int CL_ProcessCreateCgroupAttrSetMemoryUsageNotification(CL_ProcessCreateCgroupAttr_t *attr, int usage_in_bytes,
+ int event_fd) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (event_fd < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->usage_in_bytes = usage_in_bytes;
+ ia->event_fd = event_fd;
+
+ return 0;
+}
+
+/*
+ * Delete Cgroup
+ */
+int CL_ProcessCreateCgroupDelete(const char *cgroup_name) {
+ int mem_ret = 1, mem_err;
+ int cpu_ret = 1, cpu_err;
+
+ if (cgroup_name == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function access
+ if (cl_cgroup_exist(CL_CGROUP_MEMORY, cgroup_name) == 0) {
+ // LCOV_EXCL_BR_STOP
+ mem_ret = cl_cgroup_remove(CL_CGROUP_MEMORY, cgroup_name);
+ mem_err = errno;
+ }
+
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function access
+ if (cl_cgroup_exist(CL_CGROUP_CPU, cgroup_name) == 0) {
+ // LCOV_EXCL_BR_STOP
+ cpu_ret = cl_cgroup_remove(CL_CGROUP_CPU, cgroup_name);
+ cpu_err = errno;
+ }
+
+ if (mem_ret == 1 && cpu_ret == 1) {
+ errno = ENOENT;
+ return -1;
+ } else if (mem_ret < 0) {
+ errno = mem_err;
+ return -1;
+ } else if (cpu_ret < 0) {
+ errno = cpu_err;
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * Move process to the Cgroup
+ */
+int CL_ProcessCreateCgroupClassify(const char *cgroup_name, pid_t pid) {
+ int mem_ret = 1, mem_err;
+ int cpu_ret = 1, cpu_err;
+
+ if (cgroup_name == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (cl_cgroup_exist(CL_CGROUP_MEMORY, cgroup_name) == 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function access
+ mem_ret = cl_cgroup_set_num(CL_CGROUP_MEMORY, cgroup_name, "tasks", pid);
+ mem_err = errno;
+ }
+
+ if (cl_cgroup_exist(CL_CGROUP_CPU, cgroup_name) == 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function access
+ cpu_ret = cl_cgroup_set_num(CL_CGROUP_CPU, cgroup_name, "tasks", pid);
+ cpu_err = errno;
+ }
+
+ if (mem_ret == 1 && cpu_ret == 1) {
+ errno = ENOENT;
+ return -1;
+ } else if (mem_ret < 0) {
+ errno = mem_err;
+ return -1;
+ } else if (cpu_ret < 0) {
+ errno = cpu_err;
+ return -1;
+ }
+
+ return 0;
+}
+
+/* vim:set ts=8 sts=2 sw=2: */
diff --git a/nsframework/common_library/client/src/cl_region.c b/nsframework/common_library/client/src/cl_region.c
new file mode 100755
index 0000000..0f6d470
--- /dev/null
+++ b/nsframework/common_library/client/src/cl_region.c
@@ -0,0 +1,295 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file cl_region.c
+ * @brief region manage
+ *
+ */
+
+#include <stdio.h>
+#include <sys/mman.h>
+#include <native_service/cl_region.h>
+#include "cl_error.h"
+
+#define cl_align_ptr(p, a) \
+ (uint8_t *) (((long)(p) + ((long)a - 1)) & ~((long)a - 1))
+
+static void *cl_region_anonmmap(size_t size);
+static void *cl_region_expand(cl_region_t *region, size_t size, size_t align_size);
+static void *cl_region_alloc_large(cl_region_t *region, size_t size);
+
+cl_region_t *
+CL_RegionCreate(size_t size) {
+ cl_region_t *r;
+ long pagesize;
+
+ pagesize = sysconf(_SC_PAGE_SIZE);
+ size = ((size + (size_t)pagesize - 1) / (size_t)pagesize) * (size_t)pagesize;
+
+ r = cl_region_anonmmap(size);
+ if (r == NULL) {
+ return NULL;
+ }
+
+ r->d.last = (uint8_t *) r + sizeof(cl_region_t);
+ r->d.end = (uint8_t *) r + size;
+ r->d.next = NULL;
+ r->d.failed = 0;
+
+ size = size - sizeof(cl_region_t);
+ r->max = (size < (pagesize - 1)) ? size : (size_t)(pagesize - 1);
+
+ r->current = r;
+ r->large = NULL;
+ r->cleanup = NULL;
+
+ return r;
+}
+
+
+void
+CL_RegionDestroy(cl_region_t *region) {
+ cl_region_t *r, *n;
+ cl_region_large_t *l;
+ cl_region_cleanup_t *c;
+
+ for (c = region->cleanup; c; c = c->next) {
+ if (c->handler) {
+ CL_DBG_PRINT("run cleanup: %p\n", c->handler);
+ c->handler(c->data);
+ }
+ }
+
+ for (l = region->large; l; l = l->next) {
+
+ CL_DBG_PRINT("free: %p\n", l->alloc);
+
+ if (l->alloc) { // LCOV_EXCL_BR_LINE 6: double check, mmap in cl_monitor.c
+ if (munmap(l->alloc, l->size) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc munmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_PERROR("munmap"); // LCOV_EXCL_LINE 5: fail safe for libc munmap
+ }
+ }
+ }
+
+ for (r = region, n = region->d.next; /* void */; r = n, n = n->d.next) {
+ if (munmap(r, (size_t)(r->d.end - (uint8_t *)r)) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for libc munmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_PERROR("munmap"); // LCOV_EXCL_LINE 5: fail safe for libc munmap
+ }
+
+ if (n == NULL) {
+ break;
+ }
+ }
+}
+
+
+void *
+cl_region_alloc(cl_region_t *region, size_t size, size_t align_size) {
+ uint8_t *m;
+ volatile uint8_t *old_last;
+ cl_region_t *r;
+
+ if (size <= region->max) {
+
+ r = region->current;
+
+ do {
+ retry:
+ old_last = r->d.last;
+ m = cl_align_ptr(old_last, align_size);
+ if ((size_t)(r->d.end - m) >= size) {
+ if (false == __sync_bool_compare_and_swap(&r->d.last, old_last, m + size)) {
+ goto retry;
+ }
+ return m;
+ }
+
+ r = r->d.next;
+
+ } while (r);
+
+ return cl_region_expand(region, size, align_size);
+ }
+
+ return cl_region_alloc_large(region, size);
+}
+
+
+static void *
+cl_region_anonmmap(size_t size) {
+ uint8_t *p;
+
+ p = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (p == MAP_FAILED) { /* pgr0203 */
+ CL_PERROR("mmap");
+ return NULL;
+ }
+
+ return p;
+}
+
+
+static void *
+cl_region_expand(cl_region_t *region, size_t size, size_t align_size) {
+ uint8_t *m;
+ size_t psize;
+ cl_region_t *r, *new, *current;
+
+ psize = (size_t)(region->d.end - (uint8_t *)region);
+
+ m = cl_region_anonmmap(psize);
+ if (m == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;// LCOV_EXCL_LINE 5: fail safe for libc mmap
+ }
+
+ new = (cl_region_t *)m;
+
+ new->d.end = m + psize;
+ new->d.next = NULL;
+ new->d.failed = 0;
+
+ m += sizeof(cl_region_data_t);
+ m = cl_align_ptr(m, align_size);
+ new->d.last = m + size;
+
+ current = region->current;
+
+ for (r = current; r->d.next; r = r->d.next) { /* pgr0689 */
+ if (r->d.failed++ > 4) {
+ current = r->d.next;
+ }
+ }
+
+ while (false == __sync_bool_compare_and_swap(&r->d.next, NULL, new)) {
+ for (r = r->d.next; r->d.next; r = r->d.next) {} /* pgr0689 */
+ }
+
+ region->current = current ? current : new;
+
+ return m;
+}
+
+
+static void *
+cl_region_alloc_large(cl_region_t *region, size_t size) {
+ void *p;
+ int n;
+ long pagesize;
+ cl_region_large_t *large;
+
+ pagesize = sysconf(_SC_PAGE_SIZE);
+ size = ((size + (size_t)pagesize - 1) / (size_t)pagesize) * (size_t)pagesize;
+
+ p = cl_region_anonmmap(size);
+
+ if (p == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;// LCOV_EXCL_LINE 5: fail safe for libc mmap
+ }
+
+ n = 0;
+
+ for (large = region->large; large; large = large->next) {
+ if (large->alloc == NULL) {
+ if (false == __sync_bool_compare_and_swap(&large->alloc, NULL, p)) {
+ break;
+ }
+ large->size = size;
+ return p;
+ }
+
+ if (n++ > 3) {
+ break;
+ }
+ }
+
+ large = CL_RegionAlloc(region, cl_region_large_t, 1);
+ if (large == NULL) { // LCOV_EXCL_START 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (munmap(p, size) < 0) {
+ CL_PERROR("munmap");
+ }
+ return NULL;
+ } // LCOV_EXCL_STOP
+
+ large->alloc = p;
+ large->size = size;
+ large->next = region->large;
+ while (false == __sync_bool_compare_and_swap(&region->large, large->next, large)) { // LCOV_EXCL_BR_LINE 100: race condition // NOLINT (readability/nolint)
+ // LCOV_EXCL_START 100: race condition
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ large->next = region->large;
+ } // LCOV_EXCL_STOP
+
+ return p;
+}
+
+
+bool
+CL_RegionFree(cl_region_t *region, void *p) {
+ cl_region_large_t *l;
+
+ for (l = region->large; l; l = l->next) {
+ if (p == l->alloc) {
+ CL_DBG_PRINT("free: %p\n", l->alloc);
+ if (munmap(l->alloc, l->size) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for libc munmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_PERROR("munmap");// LCOV_EXCL_LINE 5: fail safe for libc munmap
+ }
+ l->alloc = NULL;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+cl_region_cleanup_t *
+cl_region_cleanup_add(cl_region_t *region, size_t size, size_t align_size) {
+ cl_region_cleanup_t *c;
+
+ c = CL_RegionAlloc(region, cl_region_cleanup_t, 1);
+ if (c == NULL) { // LCOV_EXCL_START 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;
+ } // LCOV_EXCL_STOP
+
+ if (size) {
+ c->data = cl_region_alloc(region, size, align_size);
+ if (c->data == NULL) { // LCOV_EXCL_START 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;
+ } // LCOV_EXCL_STOP
+ } else {
+ c->data = NULL;
+ }
+
+ c->handler = NULL;
+ c->next = region->cleanup;
+
+ region->cleanup = c;
+
+ CL_DBG_PRINT("add cleanup: %p\n", c);
+
+ return c;
+}
+
+/* vim:set ts=8 sw=2 sts=2: */
diff --git a/nsframework/common_library/client/src/cl_sem.c b/nsframework/common_library/client/src/cl_sem.c
new file mode 100755
index 0000000..911daff
--- /dev/null
+++ b/nsframework/common_library/client/src/cl_sem.c
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <semaphore.h>
+#include <time.h>
+
+#include <native_service/cl_sem.h>
+#include "cl_error.h"
+
+#define CL_MILLI_TO_NANO(time) ((time) * 1000000U)
+#define CL_SEC_TO_NANO(time) ((time) * 1000000000U)
+#define CL_NANO_TO_SEC(time) ((time) / 1000000000U)
+
+static void cl_TimeoutCalc(struct timespec *ts, unsigned int timeout) {
+ unsigned long long nsec;
+
+ clock_gettime(CLOCK_REALTIME, ts);
+ nsec = (unsigned long long)ts->tv_nsec + (CL_MILLI_TO_NANO((unsigned long long)timeout));
+ ts->tv_sec = ts->tv_sec + (time_t)CL_NANO_TO_SEC(nsec);
+ ts->tv_nsec = (__syscall_slong_t)(nsec - CL_SEC_TO_NANO((unsigned long long)CL_NANO_TO_SEC(nsec)));
+}
+
+int CL_SemWait(sem_t *semid, unsigned int timeout) {
+ struct timespec ts, tmp;
+ int ret;
+
+ while (1) {
+ cl_TimeoutCalc(&ts, timeout);
+ if ((ret = sem_timedwait(semid, &ts)) != 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc
+ // LCOV_EXCL_START 5: fail safe for libc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == ETIMEDOUT) {
+ /* Check the time considering the case where the time has been changed by clock_settime/settimeofday */
+ /* If the current time is much larger than the timeout specified time,
+ the system assumes that the time has changed and re-executes the command.
+ (A threshold of 100 is appropriate) */
+ clock_gettime(CLOCK_REALTIME, &tmp);
+ if (difftime(tmp.tv_sec, ts.tv_sec) > 100.0) {
+ CL_DBG_PRINT("detect clock changed\n");
+ continue;
+ }
+ }
+ }
+ // LCOV_EXCL_STOP 5: fail safe for libc
+ break;
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ } // LCOV_EXCL_LINE 10: end line
+
+ return ret;
+}
+
diff --git a/nsframework/framework_unified/LICENSE b/nsframework/framework_unified/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/nsframework/framework_unified/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/nsframework/framework_unified/Makefile.client b/nsframework/framework_unified/Makefile.client
new file mode 100755
index 0000000..69ea68d
--- /dev/null
+++ b/nsframework/framework_unified/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../native_service.mk
diff --git a/nsframework/framework_unified/client/Makefile b/nsframework/framework_unified/client/Makefile
new file mode 100755
index 0000000..29ed628
--- /dev/null
+++ b/nsframework/framework_unified/client/Makefile
@@ -0,0 +1,269 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+#INST_PROGS =
+
+######### installed library(*.a) #############
+#INST_LIBS =
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libNS_FrameworkUnified
+
+######### install headers(*.h) #############
+
+VPATH += ./include/$(COMPONENT_NAME)
+# native
+INST_HEADERS = ns_config_parser_if.h
+INST_HEADERS += ns_reader.h
+INST_HEADERS += ns_writer.h
+INST_HEADERS += ns_eventlogger.h
+INST_HEADERS += ns_logger_if.h
+INST_HEADERS += ns_message_center_if.h
+INST_HEADERS += ns_np_service.h
+INST_HEADERS += ns_np_service_if.h
+INST_HEADERS += ns_np_service_nor_persistence.h
+INST_HEADERS += ns_np_service_notification.h
+INST_HEADERS += ns_np_service_protocol.h
+INST_HEADERS += ns_np_service_nor_persistence_internal.h
+INST_HEADERS += ns_np_types.h
+INST_HEADERS += ns_plogger_if.h
+INST_HEADERS += ns_shared_mem.h
+INST_HEADERS += ns_shared_mem_if.h
+INST_HEADERS += ns_sharedmem.h
+INST_HEADERS += ns_sharedmem_reader.h
+INST_HEADERS += ns_sharedmem_writer.h
+INST_HEADERS += ns_ringbuffer.h
+INST_HEADERS += ns_system_mode.h
+INST_HEADERS += ns_timer_if.h
+INST_HEADERS += ns_timer_if.hpp
+INST_HEADERS += ns_transmit_log.h
+INST_HEADERS += ns_utility.hpp
+INST_HEADERS += ns_utility_if.h
+INST_HEADERS += ns_utility_sys.hpp
+INST_HEADERS += ns_version_if.h
+INST_HEADERS += ns_resource_controler.h
+INST_HEADERS += XMLParser.h
+INST_HEADERS += ns_msgs.h
+INST_HEADERS += ns_mc_system_info.h
+
+# inc
+INST_HEADERS += ns_version.h
+INST_HEADERS += frameworkunified_service_protocol.h
+INST_HEADERS += frameworkunified_types.h
+INST_HEADERS += wpf_legacy.h
+INST_HEADERS += framework_unified.h
+
+# nsrcs
+INST_HEADERS += ns_rcs_data_handler.hpp
+INST_HEADERS += ns_rcs_logger_types.h
+INST_HEADERS += ns_rcs_plugin.hpp
+
+# _CWORD77_
+INST_HEADERS += ns__CWORD77__common.h
+INST_HEADERS += ns__CWORD77__data_pool_if.h
+INST_HEADERS += ns__CWORD77__data_pool_key.h
+INST_HEADERS += ns__CWORD77__data_pool_table.h
+INST_HEADERS += ns__CWORD77__notifications.h
+INST_HEADERS += ns__CWORD77__types.h
+INST_HEADERS += frameworkunified__CWORD77__service_if.h
+INST_HEADERS += frameworkunified__CWORD77__session_if.h
+
+# utility
+INST_HEADERS += ns_endianess.h
+INST_HEADERS += nslogutil_cmd_if.h
+INST_HEADERS += nsfw_message.h
+INST_HEADERS += ns_util_directory.h
+INST_HEADERS += ns_util_crc.h
+
+# framework
+INST_HEADERS += frameworkunified_application.h
+INST_HEADERS += frameworkunified_dispatcher.h
+INST_HEADERS += frameworkunified_framework_error.hpp
+INST_HEADERS += frameworkunified_framework_if.h
+INST_HEADERS += frameworkunified_framework_sync.h
+INST_HEADERS += frameworkunified_framework_system_if.h
+INST_HEADERS += frameworkunified_framework_types.h
+INST_HEADERS += frameworkunified_multithreading.h
+INST_HEADERS += frameworkunified_service_if.h
+INST_HEADERS += frameworkunified_thread_priority.h
+INST_HEADERS += frameworkunified_timer.h
+
+# framework/statemachine
+INST_HEADERS += frameworkunified_sm_action.h
+INST_HEADERS += frameworkunified_sm_compositestate.h
+INST_HEADERS += frameworkunified_sm_conditionconnector.h
+INST_HEADERS += frameworkunified_sm_deephistorystate.h
+INST_HEADERS += frameworkunified_sm_dispatcher.h
+INST_HEADERS += frameworkunified_sm_eventdata.h
+INST_HEADERS += frameworkunified_sm_eventfactory.h
+INST_HEADERS += frameworkunified_sm_externaltransition.h
+INST_HEADERS += frameworkunified_sm_framework_dispatch.h
+INST_HEADERS += frameworkunified_sm_framework_if.h
+INST_HEADERS += frameworkunified_sm_framework_types.h
+INST_HEADERS += frameworkunified_sm_guard.h
+INST_HEADERS += frameworkunified_sm_historystate.h
+INST_HEADERS += frameworkunified_sm_hsm.h
+INST_HEADERS += frameworkunified_sm_hsmframework.h
+INST_HEADERS += frameworkunified_sm_internaltransition.h
+INST_HEADERS += frameworkunified_sm_leafstate.h
+INST_HEADERS += frameworkunified_sm_localtransition.h
+INST_HEADERS += frameworkunified_sm_multithreading.h
+INST_HEADERS += frameworkunified_sm_orthogonalstate.h
+INST_HEADERS += frameworkunified_sm_reaction.h
+INST_HEADERS += frameworkunified_sm_shallowhistorystate.h
+INST_HEADERS += frameworkunified_sm_state.h
+INST_HEADERS += frameworkunified_sm_transition.h
+
+# xmlparser
+INST_HEADERS += ns_xml_reader.h
+INST_HEADERS += ns_xml_writer.h
+INST_HEADERS += ns_xmlparser_if.h
+
+######### compiled sources #############
+
+# NS_Logger
+libNS_FrameworkUnified_SRCS += ./NS_Logger/src/ns_logger.cpp
+CPPFLAGS += -I./NS_Logger/include
+
+# NS_MessageQueue
+libNS_FrameworkUnified_SRCS += ./NS_MessageQueue/src/ns_msg_queue.c
+libNS_FrameworkUnified_SRCS += ./NS_MessageQueue/src/ns_mq_string.c
+CPPFLAGS += -I./NS_MessageQueue/include
+
+# NS_SharedMemIf
+libNS_FrameworkUnified_SRCS += ./NS_SharedMemIf/src/ns_shared_mem_if.cpp
+libNS_FrameworkUnified_SRCS += ./NS_SharedMemIf/src/ns_sharedmem.cpp
+libNS_FrameworkUnified_SRCS += ./NS_SharedMemIf/src/ns_sharedmem_reader.cpp
+libNS_FrameworkUnified_SRCS += ./NS_SharedMemIf/src/ns_sharedmem_writer.cpp
+
+# NS_RingBuffer
+libNS_FrameworkUnified_SRCS += ./NS_RingBuffer/src/ns_ringbuffer.cpp
+
+# NS_UtilityCenter
+libNS_FrameworkUnified_SRCS += ./NS_UtilityCenter/src/ns_endianess.cpp
+libNS_FrameworkUnified_SRCS += ./NS_UtilityCenter/src/ns_util_crc.cpp
+libNS_FrameworkUnified_SRCS += ./NS_UtilityCenter/src/ns_util_directory.cpp
+libNS_FrameworkUnified_SRCS += ./NS_UtilityCenter/src/ns_utility.cpp
+libNS_FrameworkUnified_SRCS += ./NS_UtilityCenter/src/frameworkunified_version.cpp
+CPPFLAGS += -I./NS_UtilityCenter/include
+
+# NS_MessageCenter
+libNS_FrameworkUnified_SRCS += ./NS_MessageCenter/src/ns_message_center.c
+CPPFLAGS += -I./NS_MessageCenter/include
+
+# NS_ConfigParser
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_cfg_parser.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_cfg_reader.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_cfg_writer.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_config_reader.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_config_reader_writer.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_config_writer.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_reader.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_writer.cpp
+CPPFLAGS += -I./NS_ConfigParser/include
+
+# NS_NPServiceIf
+libNS_FrameworkUnified_SRCS += ./NS_NPServiceIf/src/ns_np_service_api.c
+libNS_FrameworkUnified_SRCS += ./NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp
+CPPFLAGS += -I./NS_NPServiceIf/include
+
+# NS_Timer
+libNS_FrameworkUnified_SRCS += ./NS_Timer/src/mod_version.c
+libNS_FrameworkUnified_SRCS += ./NS_Timer/src/ns_timer.c
+libNS_FrameworkUnified_SRCS += ./NS_Timer/src/ns_timer_class.cpp
+CPPFLAGS += -I./NS_Timer/include
+
+# NS_FrameworkCore
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_dispatcher.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_error.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_logger.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_session.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_sync.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_system.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_multithreading.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_service_if.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_thread_priority.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_timer.cpp
+CPPFLAGS += -I./NS_FrameworkCore/include
+
+# NS_FrameworkCore/src/statemachine
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp
+CPPFLAGS += -I./NS_FrameworkCore/include/statemachine
+
+# NS__CWORD77__ServiceIf
+libNS_FrameworkUnified_SRCS += ./NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp
+libNS_FrameworkUnified_SRCS += ./NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp
+libNS_FrameworkUnified_SRCS += ./NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp
+
+# NS_ResourceControler
+libNS_FrameworkUnified_SRCS += ./NS_ResourceControler/src/ns_resource_controler.cpp
+
+######### add include path #############
+CPPFLAGS += -I./include
+
+######### add compile option #############
+
+LDFLAGS += -Wl,--no-as-needed
+
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lrt
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+LDLIBS += -Wl,-Bdynamic -lcommon
+LINK_SHLIB_CXX = Y
+
+# buildversioncheck
+INST_HEADERS += ns_buildversioncheck.hpp
+
+
+SUBDIRS := NS_XMLConfigeParser NS_Utility
+
+
+
+all:
+
+install-data:install_cfg
+ install -d -m 775 $(DESTDIR)/nv/BS/ns/framework_unified/rwdata
+
+install_cfg:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ns/framework_unified/rodata
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ns/framework_unified/rodata NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg
+
+include ../../native_service.mk
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/cfg/depends.mk b/nsframework/framework_unified/client/NS_ConfigParser/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_internal.h b/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_internal.h
new file mode 100755
index 0000000..64aad8b
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_internal.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains the declaration of internal structure for parsing cfg configuration
+/// file.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_INTERNAL_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include <vector>
+
+class CNode {
+ public:
+ CNode(): m_cComment(""), m_cTag(""), m_cValue("") {} // LCOV_EXCL_BR_LINE 11:except branch
+
+ ~CNode() {}
+
+ std::string m_cComment;
+ std::string m_cTag;
+ std::string m_cValue;
+};
+
+class CBlock {
+ public:
+ CBlock(): m_cComment("") {} // LCOV_EXCL_BR_LINE 11:except branch
+
+ ~CBlock() {}
+
+ std::string m_cComment;
+ std::vector<CNode> m_vElementPair;
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_parser.h b/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_parser.h
new file mode 100755
index 0000000..8d7a47f
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_parser.h
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains the declaration of class CCFGParser.
+/// This class contains the parsing logic for reading and writing from and to cfg files
+/// respectively.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_PARSER_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_PARSER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <map>
+
+// forward declaration of classes
+class CNode;
+class CBlock;
+
+typedef std::map<std::string, CBlock *> CFGData_Type;
+
+class CCFGParser {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGParser
+ /// Constructor of CCFGReader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CCFGParser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGParser
+ /// Constructor of CCFGReader class
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - Full path of the configuration file
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CCFGParser(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CCFGParser
+ /// Destructor of CCFGReader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CCFGParser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFGParseFile
+ /// This function is used to parse the configuration file and store data in internal structure
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - full path of the configuration file
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CFGParseFile(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFGGetData
+ /// This function is used to get the value associated with the key from internal CFG structure
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ ///
+ /// \return std::string - value for key
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string CFGGetData(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFGGetData
+ /// This function is used to get the value associated with the key from internal CFG structure
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ /// \param [IN] f_c_value
+ /// std::string - Value of key
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - error if key not founf or else eFrameworkunifiedStatusOK
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CFGGetData(const std::string &f_c_key, std::string &f_c_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFGSetData
+ /// This function is used to set the value for the key in internal CFG structure
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ /// \param [IN] f_c_value
+ /// std::string - value to set
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CFGSetData(const std::string &f_c_key, std::string f_c_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFGSaveData
+ /// This function is used to save the changed value to the cfg config file
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - full path of the configuration file
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CFGSaveData(const std::string &f_c_filepath);
+
+ private:
+ // internal data structure created by parsing the cfg file
+ CFGData_Type *m_pmCFGData;
+ std::string m_cLastComment;
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_PARSER_H_
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_reader.h b/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_reader.h
new file mode 100755
index 0000000..d47c04b
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_reader.h
@@ -0,0 +1,133 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class CCFGReader.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_READER_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_READER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_reader.h>
+#include <string>
+
+class CCFGParser;
+
+/*
+ * This class provides functionalities to read from CFG config file
+ */
+class CCFGReader: public IConfigReader {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGReader
+ /// Constructor of CCFGReader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CCFGReader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGReader
+ /// Constructor of CCFGReader class
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - Full path of the configuration file
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CCFGReader(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CCFGReader
+ /// Destructor of CCFGReader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CCFGReader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ParseFile
+ /// This function is used to parse the file
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - path of file to parse
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ParseFile(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetString
+ /// This function is used to get the value associated with the key
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ ///
+ /// \return std::string - value for key
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetValue(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetString
+ /// This function is used to get the value associated with the key
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ /// \param [REF] f_c_value
+ /// std::string - Value of key
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - error if key not found else eFrameworkunifiedStatusOK
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetValue(const std::string &f_c_key, std::string &f_c_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDataPtr
+ /// This function is used to get the data pointer. This pointer is then set in config writer.
+ /// This is needed to avoid recreation of same data structure object in both reader and writer
+ /// when we create object of NSConfigParser.
+ ///
+ /// \param
+ ///
+ /// \return PVOID - pointer of data structure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PVOID GetDataPtr();
+
+ private:
+ // path of config file
+ std::string m_cFilePath;
+
+ // CFG file parser object
+ CCFGParser *m_pCFGParser;
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_READER_H_
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_writer.h b/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_writer.h
new file mode 100755
index 0000000..58d1639
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_writer.h
@@ -0,0 +1,146 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class CCFGWriter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_WRITER_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_WRITER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_writer.h>
+#include <string>
+
+class CCFGParser;
+
+/*
+ * This class provides functionalities to write to CFG config file
+ */
+class CCFGWriter: public IConfigWriter {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGWriter
+ /// Constructor of CCFGWriter class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CCFGWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGWriter
+ /// Constructor of CCFGWriter class
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - Full path of the configuration file
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CCFGWriter(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CCFGWriter
+ /// Destructor of CCFGWriter class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CCFGWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ParseFile
+ /// This function is used to parse the file
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - path of file to parse
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ParseFile(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetValue
+ /// This function is used to set the value for the key
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ /// \param [IN] f_c_value
+ /// std::string - value to set
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - error if key not found else eFrameworkunifiedStatusOK
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetValue(const std::string &f_c_key, std::string f_c_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SaveData
+ /// This function is used to save the changed value to the cfg config file
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SaveData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDataPtr
+ /// This function is used to set the config file path
+ ///
+ /// \param [IN] f_c_path
+ /// std::string - Path of file
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPath(const std::string &f_c_path);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDataPtr
+ /// This function is used to set the data pointer in writer class with data pointer
+ /// created in config reader class.
+ /// This is needed to avoid recreation of same data structure object in both reader and writer
+ /// when we create object of NSConfigParser
+ ///
+ /// \param [IN] f_p_data
+ /// PVOID - Pointer to data structure
+ ///
+ /// \return VOID
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetDataPtr(PVOID f_p_data);
+
+ private:
+ // path of config file
+ std::string m_cFilePath;
+
+ // CFG file parser object
+ CCFGParser *m_pCFGParser;
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_WRITER_H_
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/include/ns_config_parser_frameworkunifiedlog.h b/nsframework/framework_unified/client/NS_ConfigParser/include/ns_config_parser_frameworkunifiedlog.h
new file mode 100755
index 0000000..c48f09d
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/include/ns_config_parser_frameworkunifiedlog.h
@@ -0,0 +1,88 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGZONES
+// #define FRAMEWORKUNIFIEDLOGZONES (ZONE_WARN|ZONE_ERR)
+#define FRAMEWORKUNIFIEDLOGZONES (ZONE_INIT|ZONE_FUNC|ZONE_INFO|ZONE_WARN|ZONE_ERR|ZONE_NS_WAR|ZONE_NS_ERR)
+#endif
+
+extern const CHAR kAppName[];
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_ConfigParser/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..1e6e556
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/src/makefile_PosixBasedOS001
@@ -0,0 +1,207 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_ConfigParser
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_ConfigParser
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_XMLConfigParser/inc
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+#DYNAMIC_LIBS += \
+# xml2 \
+# m
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+module_dirs: build_dirs
+
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_parser.cpp b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_parser.cpp
new file mode 100755
index 0000000..a2abd78
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_parser.cpp
@@ -0,0 +1,365 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CCFGParser class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <ns_cfg_internal.h>
+#include <ns_cfg_parser.h>
+#include <ns_config_parser_frameworkunifiedlog.h>
+
+#include <fstream>
+#include <string>
+
+CCFGParser::CCFGParser()
+ : m_pmCFGData(NULL) {
+}
+
+// LCOV_EXCL_START 200:CCFGParser is not external API class, this constructed function isn't used by other function
+CCFGParser::CCFGParser(const std::string &f_cfilepath)
+ : m_pmCFGData(NULL) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CFGParseFile(f_cfilepath);
+}
+// LCOV_EXCL_STOP
+
+CCFGParser::~CCFGParser() {
+ CFGData_Type::iterator l_itCfgStructure;
+
+ if (NULL != m_pmCFGData) { // LCOV_EXCL_BR_LINE 5:m_pmCFGData cannot be NULL, because internal logic guarantee
+ // release the structure
+ for (l_itCfgStructure = m_pmCFGData->begin();
+ l_itCfgStructure != m_pmCFGData->end();
+ l_itCfgStructure++) {
+ CBlock *l_pBlock = (*l_itCfgStructure).second;
+ if (NULL != l_pBlock) { // LCOV_EXCL_BR_LINE 5:l_pBlock cannot be NULL, because map insert data success.
+ // clear the vector
+ l_pBlock->m_vElementPair.clear();
+
+ delete l_pBlock; // LCOV_EXCL_BR_LINE 11:except branch
+ l_pBlock = NULL;
+ }
+ }
+
+ delete m_pmCFGData; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pmCFGData = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CCFGParser::CFGParseFile(const std::string &f_cfilepath) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ size_t l_uiPos = 0;
+ std::string l_cLine("");
+ std::string l_cTag(""); // LCOV_EXCL_BR_LINE 11:except branch
+ std::string l_cComment(""); // LCOV_EXCL_BR_LINE 11:except branch
+
+ m_pmCFGData = new(std::nothrow) CFGData_Type(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (NULL != m_pmCFGData) { // LCOV_EXCL_BR_LINE 5:new's error case
+ // open the file
+ std::ifstream l_objFile(f_cfilepath.c_str()); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // check if file is opened
+ if (l_objFile.is_open()) {
+ CBlock *l_pBlock = NULL;
+
+ // read until end of file is not reached or any other stream error occurred
+ while (!l_objFile.eof()) {
+ // read the line from the file
+ getline(l_objFile, l_cLine); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // if line is a comment
+ if ('#' == l_cLine[0] || ';' == l_cLine[0]) {
+ if (!l_cComment.empty()) {
+ l_cComment.append("\n"); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+ l_cComment.append(l_cLine);
+ } else if ('[' == l_cLine[0]) { // if line is main tag
+ // creates new CBlock object,
+ // each block contains information of single like all its key-value pair and
+ // all the comments associated with it.
+ l_pBlock = new CBlock(); // LCOV_EXCL_BR_LINE 11:except branch
+ if (NULL != l_pBlock) { // LCOV_EXCL_BR_LINE 5:new's error case
+ // set the tag comment
+ l_pBlock->m_cComment = l_cComment;
+ l_cComment.clear();
+
+ if (std::string::npos != (l_uiPos = l_cLine.find(']'))) {
+ // set the tag
+ l_cTag = l_cLine.substr(1, l_uiPos - 1); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // insert the block with its tag name in structure(map)
+ m_pmCFGData->insert(make_pair(l_cTag, l_pBlock)); // NOLINT (readability/nolint)
+ } else {
+ delete l_pBlock; // LCOV_EXCL_BR_LINE 11:except branch
+ l_pBlock = NULL;
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "End Tag missing");
+ // LCOV_EXCL_BR_STOP
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+ }
+ } else {
+ // LCOV_EXCL_START 5:new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error allocating memory for l_pBlock");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ } else if (std::string::npos != (l_uiPos = l_cLine.find('='))) { // LCOV_EXCL_BR_LINE 11:except branch
+ if (NULL != l_pBlock) { // LCOV_EXCL_BR_LINE 5:new's error case
+ // create new node object,
+ // each node object contains the information of singlr key-value pair and
+ /// it's comment(if any)
+ // LCOV_EXCL_BR_START 11:except branch
+ CNode l_objNode;
+ l_objNode.m_cComment.append(l_cComment);
+ l_objNode.m_cTag = l_cLine.substr(0, l_uiPos);
+ l_objNode.m_cValue = l_cLine.substr(l_uiPos + 1);
+
+ // insert the node object in block
+ l_pBlock->m_vElementPair.push_back(l_objNode);
+ // LCOV_EXCL_BR_STOP
+
+ l_cComment.clear();
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "l_pBlock is NULL");
+ // LCOV_EXCL_BR_STOP
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ break;
+ }
+ }
+ }
+
+ // last comment
+ if (!l_cComment.empty()) {
+ m_cLastComment = l_cComment;
+ } else {
+ m_cLastComment.clear();
+ }
+
+ // close the file
+ l_objFile.close(); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error Opening File");
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5:new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pmCFGData is NULL");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ return l_eStatus;
+}
+
+std::string CCFGParser::CFGGetData(const std::string &f_ckey) {
+ CFGData_Type::iterator l_itCfgStructure;
+ std::string l_cHeadTag = "";
+ std::string l_cTag = ""; // LCOV_EXCL_BR_LINE 11:except branch
+ std::string l_cValue = ""; // LCOV_EXCL_BR_LINE 11:except branch
+
+ size_t l_uiPos = 0;
+
+ if (NULL != m_pmCFGData && !f_ckey.empty()) { // LCOV_EXCL_BR_LINE 5:new's error case(in function CFGParseFile)
+ if (std::string::npos != (l_uiPos = f_ckey.find('.'))) { // LCOV_EXCL_BR_LINE 11:except branch
+ l_cHeadTag = f_ckey.substr(0, l_uiPos); // LCOV_EXCL_BR_LINE 11:except branch
+ l_cTag = f_ckey.substr(l_uiPos + 1); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ // search for the key and its associated value in internal structure
+ for (l_itCfgStructure = m_pmCFGData->begin();
+ l_itCfgStructure != m_pmCFGData->end();
+ l_itCfgStructure++) {
+ CBlock *l_pBlock = (*l_itCfgStructure).second;
+
+ if (!l_cHeadTag.compare((*l_itCfgStructure).first) && NULL != l_pBlock) {
+ for (UI_32 l_uiCount = 0; l_uiCount < l_pBlock->m_vElementPair.size(); l_uiCount++) {
+ if (!l_cTag.compare(l_pBlock->m_vElementPair[l_uiCount].m_cTag)) {
+ // LCOV_EXCL_BR_START 200:After l_cValue assignment is empty,there is no other place to assignment the value
+ if (!l_cValue.empty()) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 200:After l_cValue assignment is empty,there is no other place to assignment the value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_cValue.append("\n");
+ // LCOV_EXCL_STOP 200
+ }
+ l_cValue.append(l_pBlock->m_vElementPair[l_uiCount].m_cValue);
+ }
+ }
+ }
+ }
+ }
+
+ return l_cValue;
+}
+
+EFrameworkunifiedStatus CCFGParser::CFGGetData(const std::string &f_ckey, std::string &f_cvalue) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ CFGData_Type::iterator l_itCfgStructure;
+ std::string l_cHeadTag = "";
+ std::string l_cTag = ""; // LCOV_EXCL_BR_LINE 11:except branch
+ std::string l_cValue = ""; // LCOV_EXCL_BR_LINE 11:except branch
+
+ size_t l_uiPos = 0;
+
+ if (NULL != m_pmCFGData && !f_ckey.empty()) { // LCOV_EXCL_BR_LINE 5:new's error case(in function CFGParseFile)
+ if (std::string::npos != (l_uiPos = f_ckey.find('.'))) { // LCOV_EXCL_BR_LINE 11:except branch
+ l_cHeadTag = f_ckey.substr(0, l_uiPos); // LCOV_EXCL_BR_LINE 11:except branch
+ l_cTag = f_ckey.substr(l_uiPos + 1); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ // search for the key and its associated value in internal structure
+ for (l_itCfgStructure = m_pmCFGData->begin();
+ l_itCfgStructure != m_pmCFGData->end();
+ l_itCfgStructure++) {
+ CBlock *l_pBlock = (*l_itCfgStructure).second;
+
+ if (!l_cHeadTag.compare((*l_itCfgStructure).first) && NULL != l_pBlock) {
+ for (UI_32 l_uiCount = 0; l_uiCount < l_pBlock->m_vElementPair.size(); l_uiCount++) {
+ if (!l_cTag.compare(l_pBlock->m_vElementPair[l_uiCount].m_cTag)) {
+ if (!f_cvalue.empty()) {
+ f_cvalue.append("\n");
+ }
+ f_cvalue.append(l_pBlock->m_vElementPair[l_uiCount].m_cValue);
+
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ }
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CCFGParser::CFGSetData(const std::string &f_cKey, std::string f_cvalue) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ CFGData_Type::iterator l_itCfgStructure;
+ std::string l_cHeadTag = "";
+ std::string l_cTag = ""; // LCOV_EXCL_BR_LINE 11:except branch
+ std::string l_cValue = ""; // LCOV_EXCL_BR_LINE 11:except branch
+ size_t l_uiPos = 0;
+
+ // LCOV_EXCL_BR_START 6:f_cKey is not NULL, because checked in CCFGWriter::SetValue
+ if (NULL != m_pmCFGData && !f_cKey.empty()) {
+ // LCOV_EXCL_BR_STOP
+ if (std::string::npos != (l_uiPos = f_cKey.find('.'))) { // LCOV_EXCL_BR_LINE 11:except branch
+ l_cHeadTag = f_cKey.substr(0, l_uiPos); // LCOV_EXCL_BR_LINE 11:except branch
+ l_cTag = f_cKey.substr(l_uiPos + 1); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ // search for the key in internal structure and set the data for it
+ for (l_itCfgStructure = m_pmCFGData->begin();
+ l_itCfgStructure != m_pmCFGData->end();
+ l_itCfgStructure++) {
+ CBlock *l_pBlock = (*l_itCfgStructure).second;
+
+ if (!l_cHeadTag.compare((*l_itCfgStructure).first) && NULL != l_pBlock) {
+ for (UI_32 l_uiCount = 0; l_uiCount < l_pBlock->m_vElementPair.size(); l_uiCount++) {
+ if (!l_cTag.compare(l_pBlock->m_vElementPair[l_uiCount].m_cTag)) {
+ l_pBlock->m_vElementPair[l_uiCount].m_cValue.assign(f_cvalue);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6:f_cKey is not NULL, because checked in CCFGWriter::SetValue
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pmCFGData is NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CCFGParser::CFGSaveData(const std::string &f_cfilepath) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CFGData_Type::iterator l_itCfgStructure;
+
+ if (NULL != m_pmCFGData) { // LCOV_EXCL_BR_LINE 5:m_pmCFGData cannot be NULL, because internal logic guarantee
+ std::ofstream l_objFile(f_cfilepath.c_str());
+
+ // check if file is open
+ if (l_objFile.is_open()) {
+ // write the updated CFG structure back to the file
+ for (l_itCfgStructure = m_pmCFGData->begin();
+ l_itCfgStructure != m_pmCFGData->end();
+ l_itCfgStructure++) {
+ CBlock *l_pBlock = (*l_itCfgStructure).second;
+ if (NULL != l_pBlock) { // LCOV_EXCL_BR_LINE 11:except branch
+ // write the main tag comment in file
+ if (!l_pBlock->m_cComment.empty()) {
+ l_objFile << l_pBlock->m_cComment << std::endl;
+ }
+
+ // write main tag to file
+ l_objFile << "[" << (*l_itCfgStructure).first << "]" << std::endl;
+
+ for (UI_32 l_uiCount = 0; l_uiCount < l_pBlock->m_vElementPair.size(); l_uiCount++) {
+ // comment over the key-value pair
+ if (!l_pBlock->m_vElementPair[l_uiCount].m_cComment.empty()) {
+ l_objFile << l_pBlock->m_vElementPair[l_uiCount].m_cComment << std::endl;;
+ }
+
+ // key-value
+ l_objFile << l_pBlock->m_vElementPair[l_uiCount].m_cTag << "="
+ << l_pBlock->m_vElementPair[l_uiCount].m_cValue << std::endl;
+ }
+ }
+ }
+
+ // last comment
+ if (!m_cLastComment.empty()) {
+ l_objFile << m_cLastComment << std::endl;
+ }
+
+ // close the file
+ l_objFile.close(); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Cannot Open File");
+ }
+ } else {
+ // LCOV_EXCL_START 5:m_pmCFGData cannot be NULL, because internal logic guarantee
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pmCFGData is NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_reader.cpp b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_reader.cpp
new file mode 100755
index 0000000..9eeb3c0
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_reader.cpp
@@ -0,0 +1,117 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CCFGReader class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <ns_cfg_reader.h>
+#include <ns_cfg_parser.h>
+#include <ns_config_parser_frameworkunifiedlog.h>
+#include <string>
+
+
+
+CCFGReader::CCFGReader(): m_cFilePath(""), m_pCFGParser(NULL) { // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+// LCOV_EXCL_START 200:CCFGReader is not external API class, this constructed function isn't used by other function
+CCFGReader::CCFGReader(const std::string &f_c_filepath): m_cFilePath(f_c_filepath), m_pCFGParser(NULL) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", m_cFilePath.c_str());
+
+ m_pCFGParser = new CCFGParser(m_cFilePath);
+
+ if (NULL == m_pCFGParser) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Memory allocation error for m_pCFGParser");
+ }
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CCFGReader::ParseFile(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ m_cFilePath.assign(f_c_filepath);
+
+ m_pCFGParser = new(std::nothrow) CCFGParser(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (NULL == m_pCFGParser) { // LCOV_EXCL_BR_LINE 5:new's error case
+ // LCOV_EXCL_START 5:new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Memory allocation error for m_pCFGParser");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ l_e_status = m_pCFGParser->CFGParseFile(f_c_filepath);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_e_status;
+}
+
+CCFGReader::~CCFGReader() {
+ if (NULL != m_pCFGParser) {
+ delete m_pCFGParser;
+ m_pCFGParser = NULL;
+ }
+}
+
+PVOID CCFGReader::GetDataPtr() {
+ return m_pCFGParser;
+}
+
+std::string CCFGReader::GetValue(const std::string &f_c_key) {
+ std::string l_cValue = "";
+
+ if (NULL != m_pCFGParser && !f_c_key.empty()) { // LCOV_EXCL_BR_LINE 11:except branch
+ // read the data from internal CFG structure
+ l_cValue = m_pCFGParser->CFGGetData(f_c_key); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ return l_cValue;
+}
+
+EFrameworkunifiedStatus CCFGReader::GetValue(const std::string &f_c_key, std::string &f_c_value) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL == m_pCFGParser) { // LCOV_EXCL_BR_LINE 5:m_pCFGParser cannot be NULL, because internal logic guarantee
+ // LCOV_EXCL_START 5:m_pCFGParser cannot be NULL, because internal logic guarantee
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Parser object(m_pCFGParser) is NULL");
+ // LCOV_EXCL_STOP
+ } else if (f_c_key.empty()) {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid Key");
+ // LCOV_EXCL_BR_STOP
+ } else {
+ // read the data from internal CFG structure
+ l_e_status = m_pCFGParser->CFGGetData(f_c_key, f_c_value);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_e_status;
+}
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_writer.cpp b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_writer.cpp
new file mode 100755
index 0000000..4bf16d5
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_writer.cpp
@@ -0,0 +1,135 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CCFGWriter class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include <ns_cfg_parser.h>
+#include <ns_cfg_writer.h>
+#include <ns_config_parser_frameworkunifiedlog.h>
+
+#include <fstream>
+#include <string>
+
+
+CCFGWriter::CCFGWriter(): m_cFilePath(""), m_pCFGParser(NULL) { // LCOV_EXCL_BR_LINE 11:except branch
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
+
+CCFGWriter::CCFGWriter(const std::string &f_c_filepath): m_cFilePath(f_c_filepath), m_pCFGParser(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", m_cFilePath.c_str());
+
+ m_pCFGParser = new CCFGParser(m_cFilePath);
+
+ if (NULL == m_pCFGParser) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Memory allocation error for m_pCFGParser");
+ }
+}
+
+CCFGWriter::~CCFGWriter() {
+ if (NULL != m_pCFGParser) {
+ delete m_pCFGParser; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pCFGParser = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CCFGWriter::ParseFile(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ m_cFilePath.assign(f_c_filepath);
+
+ m_pCFGParser = new(std::nothrow) CCFGParser(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (NULL == m_pCFGParser) { // LCOV_EXCL_BR_LINE 5:m_pCFGParser cannot be NULL, because internal logic guarantee
+ // LCOV_EXCL_START 5:m_pCFGParser cannot be NULL, because internal logic guarantee
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Memory allocation error for m_pCFGParser");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ l_e_status = m_pCFGParser->CFGParseFile(f_c_filepath);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CCFGWriter::SetPath(const std::string &f_c_path) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (!f_c_path.empty()) { // LCOV_EXCL_BR_LINE 11:except branch
+ // set the file path
+ m_cFilePath.assign(f_c_path);
+ } else {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_e_status;
+}
+
+VOID CCFGWriter::SetDataPtr(PVOID f_p_data) {
+ if (NULL != f_p_data) {
+ // set the doc pointer
+ m_pCFGParser = static_cast<CCFGParser *>(f_p_data);
+ } else {
+ m_pCFGParser = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Data Pointer not set in cfg writer"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+}
+
+EFrameworkunifiedStatus CCFGWriter::SetValue(const std::string &f_c_key, std::string f_c_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pCFGParser && !f_c_key.empty()) {
+ // set the data in internal CFG structure
+ l_e_status = m_pCFGParser->CFGSetData(f_c_key, f_c_value); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CCFGWriter::SaveData() {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pCFGParser) {
+ if (0 == access(m_cFilePath.c_str(), W_OK)) {
+ // save the data permanently in config file
+ l_e_status = m_pCFGParser->CFGSaveData(m_cFilePath);
+ } else {
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader.cpp b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader.cpp
new file mode 100755
index 0000000..839053a
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader.cpp
@@ -0,0 +1,346 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CNSConfigReader class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <stdlib.h>
+#include <ctype.h>
+#include <dlfcn.h>
+#include <errno.h>
+
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_reader.h>
+
+#include <cstring>
+#include <string>
+
+#include "ns_config_parser_frameworkunifiedlog.h"
+#include "ns_cfg_reader.h"
+CNSConfigReader::CNSConfigReader() {
+ m_pReader = NULL;
+}
+
+CNSConfigReader::CNSConfigReader(const std::string &f_c_filepath): m_pReader(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ if (eFrameworkunifiedStatusOK != Parse(f_c_filepath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Parsing file %s", f_c_filepath.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+}
+
+CNSConfigReader::~CNSConfigReader() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
+
+ if (NULL != m_pReader) {
+ delete m_pReader; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pReader = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CNSConfigReader::Parse(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ if (NULL != m_pReader) {
+ delete m_pReader; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pReader = NULL;
+ }
+
+ // create parser object depending on file extension
+ if (NULL != std::strstr(f_c_filepath.c_str(), ".cfg")) {
+ m_pReader = new(std::nothrow) CCFGReader(); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Not CFG"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->ParseFile(f_c_filepath);
+ } else {
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_e_status;
+}
+
+PVOID CNSConfigReader::GetDataPtr() {
+ if (NULL != m_pReader) {
+ // get the data pointer
+ return m_pReader->GetDataPtr();
+ } else {
+ return NULL;
+ }
+}
+
+BOOL CNSConfigReader::GetBool(const std::string &f_c_key) {
+ BOOL l_bResult = FALSE;
+
+ if (NULL != m_pReader) {
+ std::string l_c_temp = m_pReader->GetValue(f_c_key);
+
+ l_c_temp = FormatValue(l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (!strcasecmp(l_c_temp.c_str(), "true")) {
+ l_bResult = TRUE;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ return l_bResult;
+}
+
+F_64 CNSConfigReader::GetDouble(const std::string &f_c_key) {
+ F_64 l_fValue = 0;
+
+ if (NULL != m_pReader) {
+ std::string l_c_temp = m_pReader->GetValue(f_c_key);
+
+ errno = EOK;
+
+ // convert string to double
+ l_fValue = strtod(l_c_temp.c_str(), NULL);
+
+ if (EOK != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to double, errno=%d", l_c_temp.c_str(), errno);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ return l_fValue;
+}
+
+F_32 CNSConfigReader::GetFloat(const std::string &f_c_key) {
+ F_32 l_fValue = 0;
+
+ if (NULL != m_pReader) {
+ std::string l_c_temp = m_pReader->GetValue(f_c_key);
+ errno = EOK;
+ l_fValue = strtof(l_c_temp.c_str(), NULL);
+
+ if (EOK != errno) {
+ l_fValue = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to float, errno=%d", l_c_temp.c_str(), errno);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ return l_fValue;
+}
+
+SI_32 CNSConfigReader::GetInt(const std::string &f_c_key) {
+ UI_64 l_ui_value = 0;
+
+ if (NULL != m_pReader) {
+ std::string l_c_temp = m_pReader->GetValue(f_c_key);
+
+ errno = EOK;
+
+ if ((l_c_temp.size() >= 3) && ('0' == l_c_temp[0]) && ('X' == toupper(l_c_temp[1]))) {
+ l_ui_value = strtoul(l_c_temp.c_str(), NULL, 16);
+ } else {
+ l_ui_value = strtoul(l_c_temp.c_str(), NULL, 10);
+ }
+
+ if (EOK != errno) {
+ l_ui_value = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to int, errno=%d", l_c_temp.c_str(), errno);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ return static_cast<SI_32>(l_ui_value);
+}
+
+std::string CNSConfigReader::GetString(const std::string &f_c_key) {
+ std::string l_c_temp = "";
+
+ if (NULL != m_pReader) {
+ l_c_temp = m_pReader->GetValue(f_c_key); // LCOV_EXCL_BR_LINE 11:except branch
+
+ l_c_temp = FormatValue(l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ }
+
+ return l_c_temp;
+}
+
+EFrameworkunifiedStatus CNSConfigReader::GetBool(const std::string &f_c_key, BOOL &f_b_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ std::string l_c_temp = "";
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->GetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK == l_e_status) {
+ l_c_temp = FormatValue(l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (!strcasecmp(l_c_temp.c_str(), "true")) {
+ f_b_value = TRUE;
+ } else if (!strcasecmp(l_c_temp.c_str(), "false")) {
+ f_b_value = FALSE;
+ } else {
+ l_e_status = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigReader::GetDouble(const std::string &f_c_key, F_64 &f_d_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ std::string l_c_temp = "";
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->GetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK == l_e_status) {
+ errno = EOK;
+ f_d_value = strtod(l_c_temp.c_str(), NULL);
+
+ if (EOK != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to double, errno=%d", l_c_temp.c_str(), errno);
+ l_e_status = eFrameworkunifiedStatusInvldBuf;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigReader::GetFloat(const std::string &f_c_key, F_32 &f_f_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ std::string l_c_temp = "";
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->GetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK == l_e_status) {
+ errno = EOK;
+ f_f_value = strtof(l_c_temp.c_str(), NULL);
+
+ if (EOK != errno) {
+ f_f_value = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to float, errno=%d", l_c_temp.c_str(), errno);
+ l_e_status = eFrameworkunifiedStatusInvldBuf;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigReader::GetInt(const std::string &f_c_key, SI_32 &f_i_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ std::string l_c_temp = "";
+
+ UI_64 l_ui_value = 0;
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->GetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK == l_e_status) {
+ errno = EOK;
+
+ if ((l_c_temp.size() >= 3) && ('0' == l_c_temp[0]) && ('X' == toupper(l_c_temp[1]))) {
+ l_ui_value = strtoul(l_c_temp.c_str(), NULL, 16);
+ } else {
+ l_ui_value = strtoul(l_c_temp.c_str(), NULL, 10);
+ }
+
+ f_i_value = static_cast<SI_32>(l_ui_value);
+
+ if (EOK != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to int, errno=%d", l_c_temp.c_str(), errno);
+ l_e_status = eFrameworkunifiedStatusInvldBuf;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigReader::GetString(const std::string &f_c_key, std::string &f_c_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ std::string l_c_temp = "";
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->GetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK == l_e_status) {
+ l_c_temp = FormatValue(l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ f_c_value.assign(l_c_temp);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+std::string CNSConfigReader::FormatValue(const std::string &f_c_value) {
+ std::string l_c_newvalue = f_c_value;
+
+ if (0 < f_c_value.length()) {
+ UI_32 l_uiStrPos = static_cast<UI_32>(l_c_newvalue.length() - 1);
+
+ while ('\n' == l_c_newvalue[l_uiStrPos] || '\r' == l_c_newvalue[l_uiStrPos]) {
+ l_c_newvalue = l_c_newvalue.substr(0, l_uiStrPos);
+
+ if (0 == l_uiStrPos) {
+ break;
+ }
+
+ l_uiStrPos--;
+ }
+ }
+
+ return l_c_newvalue;
+}
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader_writer.cpp b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader_writer.cpp
new file mode 100755
index 0000000..6c2b2d6
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader_writer.cpp
@@ -0,0 +1,74 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CNSConfigParser class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_config_parser_if.h>
+#include <string>
+#include "ns_config_parser_frameworkunifiedlog.h"
+
+CNSConfigParser::CNSConfigParser() : CNSConfigReader(), CNSConfigWriter() { // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+CNSConfigParser::CNSConfigParser(const std::string &f_c_filepath): CNSConfigReader(f_c_filepath),
+ CNSConfigWriter(f_c_filepath, TRUE) { // LCOV_EXCL_BR_LINE 11:except branch
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ // get the data pointer from the config reader
+ PVOID l_pdata = GetDataPtr(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // set the same data pointer in config writer
+ SetDataPtr(l_pdata); // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+CNSConfigParser::~CNSConfigParser() { // LCOV_EXCL_BR_LINE 11:except branch
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
+
+ // set the data pointer to NULL in writer
+ SetDataPtr(NULL); // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+EFrameworkunifiedStatus CNSConfigParser::Parse(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ // parse and create config document structure with reader
+ if (eFrameworkunifiedStatusOK == (l_e_status = CNSConfigReader::Parse(f_c_filepath))) {
+ // set the data pointer to NULL in writer
+ SetDataPtr(NULL);
+
+ // sets the same config document structure in writer
+ if (eFrameworkunifiedStatusOK == (l_e_status = CNSConfigWriter::Create(f_c_filepath))) {
+ // get the data pointer from the config reader
+ PVOID l_pdata = GetDataPtr();
+
+ // set the same data pointer in config writer
+ SetDataPtr(l_pdata);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_e_status;
+}
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_writer.cpp b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_writer.cpp
new file mode 100755
index 0000000..601500d
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_writer.cpp
@@ -0,0 +1,227 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CNSConfigWriter class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_writer.h>
+#include <dlfcn.h>
+#include <sstream>
+#include <cstring>
+#include <string>
+#include "ns_cfg_writer.h"
+#include "ns_config_parser_frameworkunifiedlog.h"
+
+
+CNSConfigWriter::CNSConfigWriter(): m_pWriter(NULL) {
+}
+
+CNSConfigWriter::CNSConfigWriter(const std::string &f_c_filepath): m_pWriter(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ Parse(f_c_filepath);
+}
+
+CNSConfigWriter::CNSConfigWriter(const std::string &f_c_filepath, BOOL f_b_noload): m_pWriter(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ Create(f_c_filepath);
+}
+
+CNSConfigWriter::~CNSConfigWriter() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
+
+ if (NULL != m_pWriter) {
+ delete m_pWriter; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pWriter = NULL;
+ }
+ // TODO(my_username): dlclose.
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Parse(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ delete m_pWriter; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pWriter = NULL;
+ }
+
+ // create parser object depending on file extension
+ if (std::strstr(f_c_filepath.c_str(), ".cfg") != NULL) {
+ m_pWriter = new(std::nothrow) CCFGWriter(); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Not CFG");
+ // LCOV_EXCL_BR_STOP
+ }
+
+ if (NULL != m_pWriter) {
+ l_e_status = m_pWriter->ParseFile(f_c_filepath);
+ } else {
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Create(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ delete m_pWriter; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pWriter = NULL;
+ }
+
+ // create parser object depending on file extension
+ if (std::strstr(f_c_filepath.c_str(), ".cfg") != NULL) {
+ m_pWriter = new(std::nothrow) CCFGWriter(); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Not CFG");
+ // LCOV_EXCL_BR_STOP
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+
+ if (NULL != m_pWriter) {
+ l_e_status = m_pWriter->SetPath(f_c_filepath);
+ } else {
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+VOID CNSConfigWriter::SetDataPtr(PVOID f_p_data) {
+ if (NULL != m_pWriter) {
+ m_pWriter->SetDataPtr(f_p_data);
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pWriter is NULL");
+ // LCOV_EXCL_BR_STOP
+ }
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Save() {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ // save the updated config file
+ l_e_status = m_pWriter->SaveData();
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL");
+ // LCOV_EXCL_BR_STOP
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::SetBool(const std::string &f_c_key, BOOL f_b_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ std::string l_c_temp = "";
+
+ if (TRUE == f_b_value) {
+ l_c_temp = "TRUE";
+ l_e_status = m_pWriter->SetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+ } else if (FALSE == f_b_value) { // LCOV_EXCL_BR_LINE 11:except branch
+ l_c_temp = "FALSE";
+ l_e_status = m_pWriter->SetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "received bool value is not proper:: %d", f_b_value);
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL");
+ // LCOV_EXCL_BR_STOP
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Set(const std::string &f_cKey, F_64 f_f_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ std::stringstream l_cStream;
+ l_cStream << f_f_value;
+
+ l_e_status = m_pWriter->SetValue(f_cKey, l_cStream.str()); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL");
+ // LCOV_EXCL_BR_STOP
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Set(const std::string &f_cKey, F_32 f_fValue) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) { // LCOV_EXCL_BR_LINE 11:except branch
+ std::stringstream l_cStream;
+ l_cStream << f_fValue;
+
+ l_e_status = m_pWriter->SetValue(f_cKey, l_cStream.str()); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Set(const std::string &f_cKey, SI_32 f_si_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ std::stringstream l_cStream;
+ l_cStream << f_si_value; // LCOV_EXCL_BR_LINE 11:except branch
+
+ l_e_status = m_pWriter->SetValue(f_cKey, l_cStream.str()); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL"); // LCOV_EXCL_BR_LINE 11:except branch
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Set(const std::string &f_cKey, const std::string &f_s_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ l_e_status = m_pWriter->SetValue(f_cKey, f_s_value); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL"); // LCOV_EXCL_BR_LINE 11:except branch
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/src/ns_reader.cpp b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_reader.cpp
new file mode 100755
index 0000000..ff3cc7a
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_reader.cpp
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of IConfigReader class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_reader.h>
+#include <ns_config_parser_frameworkunifiedlog.h>
+
+
+IConfigReader::IConfigReader() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
+
+IConfigReader::~IConfigReader() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
diff --git a/nsframework/framework_unified/client/NS_ConfigParser/src/ns_writer.cpp b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_writer.cpp
new file mode 100755
index 0000000..b2b52f0
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ConfigParser/src/ns_writer.cpp
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of IConfigWriter class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_writer.h>
+#include <ns_config_parser_frameworkunifiedlog.h>
+
+
+IConfigWriter::IConfigWriter() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
+
+IConfigWriter::~IConfigWriter() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/cfg/depends.mk b/nsframework/framework_unified/client/NS_FrameworkCore/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_core.h b/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_core.h
new file mode 100755
index 0000000..cb8bcee
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_core.h
@@ -0,0 +1,676 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Application framework's core structures and data types.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_CORE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_CORE_H_
+
+#include <pthread.h>
+#include <errno.h>
+
+#include <other_service/strlcpy.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/ns_logger_if.h>
+
+#include <iostream>
+#include <string>
+#include <map>
+#include <queue>
+#include <cstdio>
+#include <vector>
+#include <utility>
+
+static const UI_32 THREAD_SESSION_ID = 0;
+
+typedef HANDLE SessionHandle;
+typedef int SessionId; // < service protocol command
+typedef int ServiceProtocolCommand; // < service protocol command
+typedef int Fd; // < FD associated with callback
+typedef std::string Notification; // < notification name
+typedef std::string ServiceName; // < service name
+typedef std::string ThreadName;
+typedef std::string DataKey;
+typedef std::string InvokerName;
+typedef int Socket;
+typedef std::string ConnectKey;
+typedef PVOID Data;
+
+typedef std::map<Notification, CallbackFunctionPtr> NotificationTable;
+
+
+typedef std::map<ServiceProtocolCommand, CallbackFunctionPtr> ServiceProtocolTable;
+typedef std::map<SessionId, ServiceProtocolTable> SessionTable;
+typedef std::map<ServiceName, SessionTable> Services;
+typedef std::map<HANDLE, ServiceName> ServiceSendMsgHandle;
+typedef std::map<Fd, CallbackFunctionPtr> FdTable;
+
+typedef int EventId;
+typedef std::map<ServiceProtocolCommand, EventId> ServiceEventProtocolTable;
+typedef std::map<SessionId, ServiceEventProtocolTable> EventSessionTable;
+typedef std::map<ServiceName, EventSessionTable> EventServices;
+typedef std::map<Notification, EventId> NotificationEventTable;
+typedef std::map<SessionId, SessionHandle> SessionHandleTable;
+typedef std::map<ServiceName, SessionHandleTable> ServiceSessionTable;
+typedef std::map<InvokerName, HANDLE> InvokeResponseQTable;
+typedef std::map<Socket, ConnectKey> AcceptMonitorTable;
+typedef std::map<Socket, ConnectKey> ConnectMonitorTable;
+
+typedef std::pair<NotificationTable::iterator, bool> NotificationTableRetStatus;
+typedef std::map<DataKey, Data> AppData;
+
+// private event data structure
+typedef struct _EventData {
+ PVOID pData; /// <message data
+ UI_32 uiLength; /// <message length
+} EventData;
+
+// framework message queue info
+typedef struct _MsgQInfo {
+ CHAR cSrcName[MAX_NAME_SIZE_APP]; /// <source message queue name
+ CHAR cMsgQName[MAX_NAME_SIZE_APP]; /// <name of the handle to the msgq
+ UI_32 checkCode;
+ pthread_t self;
+ HANDLE hMsgQ; /// <handle to message queue
+ UI_32 sessionId; /// <Used only when it is a session handle
+} MsgQInfo;
+
+#define MSGQ_CHECK_CODE (0xACCE55ED)
+
+static inline BOOL frameworkunifiedCheckValidMsgQ(HANDLE hService) {
+ static __thread int detect_once = 0;
+ if (NULL != hService) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(hService);
+ /**
+ * @todo
+ * If an application handle is specified in place of a session handle,
+ * the element is accessed illegally without type checking,
+ * and a DeathTest occurs because the thread_self check is violated.
+ */
+ if (pMsgQ->self != pthread_self() && detect_once == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __func__, "Invalid thread context detect(hService/hSession):%#lx:%#lx", pMsgQ->self,
+ pthread_self());
+ detect_once = 1;
+ }
+ if (pMsgQ->checkCode == MSGQ_CHECK_CODE) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/* data structure for public state events and data associated with it */
+// map of state events and data associated with it
+typedef std::map<UI_32, EventData *> PublicStateEventTable;
+
+/* data structure for private state events and data associated with it */
+// list of session id's of service and event data(private) associated with it
+typedef std::map<UI_32, EventData *> SessionEventData;
+
+// map of service name and list of its session id's and associated event data
+typedef std::map<ServiceName, SessionEventData> ServiceSessionEventData;
+
+// map of private events and the data published on the all sessions of all services subscribed to it
+typedef std::map<UI_32, ServiceSessionEventData> PrivateStateEventTable;
+
+
+// list of session id's for each service registering with event
+typedef std::vector<UI_32> SessionIdList;
+typedef std::vector<UI_32> EventIdList;
+
+// map of service name and and list of its session id
+typedef std::map<ServiceName, SessionIdList> ServiceSessionIdListTable;
+// map of events and its subscribers
+typedef std::map<UI_32, ServiceSessionIdListTable> EventTable;
+
+// structure to hold the session handle and list of event ids for that session
+typedef struct _SessionEventInfo {
+ HANDLE m_hSession; // Msg queue handle for the specific session
+ EventIdList m_vEvents; // List of event ids corresponding to the session
+} SessionEventInfo, *PSessionEventInfo;
+
+// map to hold the session id and structure of session event info
+typedef std::map<SessionId, SessionEventInfo *> SessionToEventInfo;
+
+// map of service name with session id and session handle
+typedef std::map<ServiceName, SessionToEventInfo > ServiceSessionHandleTable;
+
+// Defer'ed queue
+// When a pop is issued this data will be copied to the internal CFrameworkunifiedFrameworkApp struct
+// which will call the FrameworkunifiedDispatchProcess that will process the message as if
+// it was received off the message queue!
+class DeferedMsgInfo {
+ void copy_me(const DeferedMsgInfo &defer) {
+ if (this != &defer) {
+ uiProtocolCmd = defer.uiProtocolCmd;
+ strlcpy(cMsgSrcName, defer.cMsgSrcName, sizeof(cMsgSrcName));
+ std::memcpy(uiMsgRcvBuffer, defer.uiMsgRcvBuffer, MAX_MSGQ_BUFFER);
+ }
+ }
+
+ public:
+ UI_32 uiProtocolCmd; /// <protocol req/ack received
+ CHAR cMsgSrcName[MAX_NAME_SIZE_APP]; /// <name of client/server(application) message queue
+ UI_8 uiMsgRcvBuffer[MAX_MSGQ_BUFFER]; /// <receive buffer for message queue
+
+ DeferedMsgInfo() : uiProtocolCmd(0) {
+ std::memset(uiMsgRcvBuffer, 0, MAX_MSGQ_BUFFER);
+ std::memset(cMsgSrcName, '\0', MAX_NAME_SIZE_APP);
+ }
+
+ DeferedMsgInfo(const DeferedMsgInfo &defer) {
+ copy_me(defer); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ DeferedMsgInfo(UI_32 cmd, PCSTR name, UI_8 buf[MAX_MSGQ_BUFFER]) {
+ DeferedMsgInfo defer;
+
+ defer.uiProtocolCmd = cmd;
+ strlcpy(defer.cMsgSrcName, name, sizeof(defer.cMsgSrcName));
+ std::memcpy(defer.uiMsgRcvBuffer, buf, MAX_MSGQ_BUFFER);
+
+ copy_me(defer);
+ }
+
+ DeferedMsgInfo &operator = (const DeferedMsgInfo &defer) {
+ copy_me(defer);
+
+ return *this;
+ }
+};
+
+typedef struct _ServiceNotificationInfo {
+ CHAR sNotificationName[MAX_SYS_INFO_SIZE];
+ UI_32 uiEventId;
+} ServiceNotificationInfo;
+
+typedef std::vector<ServiceNotificationInfo> NotificationList;
+typedef std::queue<DeferedMsgInfo> DeferedMessageQueue;
+
+typedef struct _LostSessionInfo {
+ std::string sServiceName;
+ SessionId iSessionId;
+} LostSessionInfo;
+
+typedef std::queue<LostSessionInfo> LostSessionQueue;
+
+#ifdef DISPATCHER_PROFILER
+class FrameworkunifiedMsgProfiler;
+#endif
+
+class ResponseData {
+ std::vector<UI_8> rawBuffer;
+
+ public:
+ void set(PVOID src, UI_32 size) {
+ rawBuffer.resize(size);
+ std::memcpy(&rawBuffer[0], src, size);
+ }
+
+ UI_8 *data(void) {
+ return rawBuffer.empty() ? NULL : &rawBuffer[0];
+ }
+
+ void clear(void) {
+ std::vector<UI_8>().swap(rawBuffer);
+ }
+
+ UI_32 size(void) {
+ return static_cast<UI_32>(rawBuffer.size());
+ }
+};
+
+
+// framework container
+typedef struct _CFrameworkunifiedFrameworkApp {
+ CHAR cAppName[MAX_NAME_SIZE_APP]; /// <application(client/service) name
+ UI_32 checkCode; /// <check code
+ pthread_t self;
+
+ // message receive information
+ HANDLE hAppRcvMsgQ; /// <handle to apps receive message queue
+ HANDLE hAppSndMsgQ; /// <handle to apps send message queue
+ UI_32 uiMsgLength; /// <length of data in message queue
+ UI_32 uiProtocolCmd; /// <protocol req/ack received
+ UI_32 uiSessionId;
+ CHAR cSystemInfo[MAX_SYS_INFO_SIZE];
+ CHAR cMsgSrcName[MAX_NAME_SIZE_APP]; /// <name of client/server(application) message queue
+ UI_8 uiMsgRcvBuffer[MAX_MSGQ_BUFFER]; /// <receive buffer for message queue
+ int efd; /// <FD for multiple wait generated by the epoll_create()
+ int defer_evfd; /// <FD for receiving Defer events to Dispatcher
+
+ Services services; /// <services <map>
+ ServiceSendMsgHandle servicesHandle; /// <serviceHandle <map>
+ NotificationTable notifications; /// <notification <map>
+ FdTable fds; /// <fdTable <map>
+
+ InvokeResponseQTable invokeResQTable;
+
+ AcceptMonitorTable acceptMonitorTable;
+ ConnectMonitorTable connectMonitorTable;
+ LostSessionQueue lostSessionQueue;
+ CallbackFunctionPtr lostSessionHandler;
+
+ EventServices eventservices;
+ NotificationEventTable notificationevents;
+
+ AppData appdata;
+
+ // Defer'ed Message Queue
+ DeferedMessageQueue deferedMsgQueue; /// <defer'ed message <queue>
+ BOOL fPopDeferedMsg;
+
+ HANDLE hNPSndMsgQ; /// <send msgq handle to NPService
+
+ // application & framework errors
+ EFrameworkunifiedStatus eLastFrameworkError; /// <Framework internal errors
+ EFrameworkunifiedStatus eLastAppError; /// <application(client/server/child thread) reported errors
+
+ /////////////////////////////////////////
+ void *FrameworkData;
+ HANDLE hParentSndMsgQ;
+ CHAR cParentAppName[MAX_NAME_SIZE_APP]; /// <application(client/service) name
+ /////////////////////////////////////////
+
+ HANDLE hConfigFileHandle;
+
+ class CFrameworkunifiedHSMFramework *m_pFrameworkunifiedStateMachine;
+
+ ServiceSessionTable sessiontable;
+ NotificationList servicenotificationlist;
+ CHAR sServiceAvailabilityNotification[MAX_SYS_INFO_SIZE];
+ BOOL bIsAvailable;
+
+ ServiceSessionHandleTable servicesessionhandletable;
+
+ void *pRsrcMgr;
+
+ // framework state information
+ // TODO(framework_unified): consider this for future
+
+ // Current user
+ HANDLE hUser;
+
+ // table holding list of all the events of service and its subscribers
+ EventTable eventtable;
+
+ // table holding list of all the public events of service and the event data corresponding to it
+ PublicStateEventTable publicstateeventtable;
+
+ // table holding list of all the private events of service and
+ // the event data corresponding to each of the subscribed session of its subscribers
+ PrivateStateEventTable privatestateeventtable;
+
+ ResponseData responsedata;
+
+ UI_64 total_occupy_time;
+ UI_64 total_run_count;
+ UI_32 max_occupy_time;
+
+ SI_32 siMonitorSock;
+
+ BOOL fDeferredSyncResponse;
+
+#ifdef DISPATCHER_PROFILER
+ // Profiler object. This is required per dispatcher
+ FrameworkunifiedMsgProfiler *m_pFrameworkunifiedMsgProfiler;
+#endif
+} CFrameworkunifiedFrameworkApp;
+
+// Structure containing the synchronization data
+struct SFrameworkunifiedSyncDataPacket {
+ PVOID m_pNotificationData; // Data published with the notification
+ UI_32 m_uiDataSize; // Size of the data published with the notification
+ time_t m_tTimeStamp; // Time when the notification was recently published
+};
+
+struct PCData {
+ PCData(pthread_barrier_t *bar, EFrameworkunifiedStatus *status, PCSTR parent, PCSTR child, CbFuncPtr init, CbFuncPtr shdn,
+ EFrameworkunifiedSchedPolicy policy, SI_32 priority, CbFuncPtr CreateHSM = NULL)
+ : barrier(bar),
+ childStatus(status),
+ parentName(parent),
+ childName(child),
+ initFn(init),
+ shdnFn(shdn),
+ schedPolicy(policy),
+ schedPriority(priority),
+ CbCreateStateMachine(CreateHSM) { // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ pthread_barrier_t *barrier;
+ EFrameworkunifiedStatus *childStatus;
+ const ServiceName parentName;
+ const ServiceName childName;
+ CbFuncPtr initFn;
+ CbFuncPtr shdnFn;
+ EFrameworkunifiedSchedPolicy schedPolicy;
+ SI_32 schedPriority;
+ CbFuncPtr CbCreateStateMachine;
+};
+
+#define APP_CHECK_CODE (0xAC1D5EED)
+
+static inline BOOL frameworkunifiedCheckValidAppHandle(HANDLE hApp) {
+ static __thread int detect_once = 0;
+ if (NULL != hApp) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+ /**
+ * @todo
+ * eFrameworkunifiedStatusOK is returned even if a appHandle created in another thread is passed,
+ * and the specifications and operations differ.
+ * @todo
+ * If an application handle is specified in place of a session handle,
+ * the element is accessed illegally without type checking,
+ * and a DeathTest occurs because the thread_self check is violated.
+ * @todo
+ * If you specify an app handle for a child thread,
+ * the NULL's return value is not terminated abnormally at the intended point (frameworkunifiedCheckValidAppHandle).
+ */
+ if (pApp->self != pthread_self() && detect_once == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __func__, "Invalid thread context detect(hApp):%#lx:%#lx", pApp->self, pthread_self());
+ detect_once = 1;
+ }
+ if (pApp->checkCode == APP_CHECK_CODE) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSubscribeToNotification
+/// API to send message to Notification Service to add to subscription list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSubscribeToNotification(HANDLE hApp, PCSTR pNotification);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSubscribeToNotifications
+/// API to send message to Notification Service to add multiple subscriptions list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pList
+/// FrameworkunifiedNotificationCallbackHandler - Name of Notification
+/// \param [in] uiListLength
+/// UI_32 - number of notification that your subscribing too.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSubscribeToNotifications(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pList, UI_32 uiListLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPUnsubscribeFromNotification
+/// API to send message to Notification Service to remove from subscription list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnsubscribeFromNotification(HANDLE hApp, PCSTR pNotification);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPUnsubscribeFromNotifications
+/// API to send message to Notification Service to remove multiple notification from subscription list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pList
+/// FrameworkunifiedNotificationCallbackHandler - notifications list
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnsubscribeFromNotifications(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pList,
+ UI_32 uiListLength);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMSubscribeToNotificationsEvents
+/// API to send message to Notification Service to add multiple subscriptions list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pList
+/// FrameworkunifiedNotificationEvent - list of notification events
+/// \param [in] uiListLength
+/// UI_32 - number of notification that your subscribing too.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMSubscribeToNotificationsEvents(HANDLE hApp, const FrameworkunifiedNotificationEvent *pList,
+ UI_32 uiListLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMSubscribeToNotificationEvent
+/// API to send message to Notification Service to add to subscription list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMSubscribeToNotificationEvent(HANDLE hApp, PCSTR pNotification);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnsubscribeFromNotificationEvent
+/// API to send message to Notification Service to remove from subscription list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnsubscribeFromNotificationEvent(HANDLE hApp, PCSTR pNotification);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnsubscribeFromNotificationEvents
+/// API to send message to Notification Service to remove multiple subscriptions list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pList
+/// FrameworkunifiedNotificationEvent - list of notification events
+/// \param [in] uiListLength
+/// UI_32 - number of notification that your subscribing too.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnsubscribeFromNotificationEvents(HANDLE hApp, const FrameworkunifiedNotificationEvent *pList,
+ UI_32 uiListLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateDispatcher
+///
+/// \param [in] cAppName
+/// PCSTR - Application name
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocol(HANDLE hApp);
+
+EFrameworkunifiedStatus frameworkunifiedAddConnectMonitor(HANDLE hApp, PCSTR serverName, PCSTR clientName);
+EFrameworkunifiedStatus frameworkunifiedDelConnectMonitorPre(int efd, PCSTR serverName, PCSTR clientName);
+EFrameworkunifiedStatus frameworkunifiedDelConnectMonitor(HANDLE hApp, PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateDispatcher
+///
+/// \param [in] cAppName
+/// PCSTR - Application name
+/// \param [out] hApp
+/// HANDLE& - Reference of application handle
+/// \param [in] bIsChildThread
+/// BOOL - child thread
+///
+/// \return status
+/// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if success
+/// eFrameworkunifiedStatusFail if invalid app name
+/// eFrameworkunifiedStatusNullPointer if unable to open message Q handle
+/// or possible errors from call FrameworkunifiedAttachSystemCallbacksDispatcher/
+/// FrameworkunifiedAttachLoggerCallbacksDispatcher/
+/// FrameworkunifiedAttachVersionCallbacksDispatcher
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateDispatcher(PCSTR cAppName, HANDLE &hApp, BOOL bIsChildThread = FALSE); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// RunDispatcher
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RunDispatcher(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// RunChildDispatcher
+/// Dispatcher for child thread. Only difference with \ref RunDispatcher is, child dispatcher
+/// exits when non eFrameworkunifiedStatusOK value by callback function is returned.
+/// Whereas, \ref RunDispatcher is not supposed to exit.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RunChildDispatcher(HANDLE hChildApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsValidWaitBarrier
+///
+/// \param [in] wbret
+/// int - barrier
+///
+/// \return bool
+/// valid or invalid
+////////////////////////////////////////////////////////////////////////////////////////////
+bool IsValidWaitBarrier(int wbret);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// setChildThreadSched
+///
+/// \param [in] policy
+/// EFrameworkunifiedSchedPolicy - scheduling policy
+/// \param [in] priority
+/// SI_32 - scheduling priority
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus setChildThreadSched(EFrameworkunifiedSchedPolicy policy, SI_32 priority);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateChildThread
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] childName
+/// PCSTR - Name of child thread to be created
+/// \param [in] CbInitialize
+/// CbFuncPtr - Initialize function.
+/// \param [in] CbShutdown
+/// CbFuncPtr - Shutdown function.
+/// \param [in] attr
+/// const FrameworkunifiedChildThreadAttr * - child thread attribute
+/// \param [in] CbCreateStateMachine
+/// CbFuncPtr - Function pointer to create state machine, in case of SM child thread, else NULL
+///
+/// \return HANDLE
+/// Non-null value if thread is created else NULL
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE CreateChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize, CbFuncPtr CbShutdown,
+ const FrameworkunifiedChildThreadAttr *attr, CbFuncPtr CbCreateStateMachine);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Child thread attribute initialize
+///
+/// \param [out] attr
+/// FrameworkunifiedChildThreadAttr - Child thread attribute
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateChildThreadAttrInit(FrameworkunifiedChildThreadAttr *attr);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Child thread attribute set schedule policy & priority
+///
+/// \param [out] attr
+/// FrameworkunifiedChildThreadAttr - Child thread attribute
+/// \param [int] policy
+/// EFrameworkunifiedSchedPolicy - Child thread scheduling policy
+/// \param [in] priority
+/// SI_32 - Child thread scheduling priority
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateChildThreadAttrSetSched(FrameworkunifiedChildThreadAttr *attr, EFrameworkunifiedSchedPolicy policy, SI_32 priority);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// DestroyThread
+// Sends eFrameworkunifiedStatusExit status to exits the dispatcher loop to terminate the thread.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DestroyThread(HANDLE hApp);
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_CORE_H_
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_error_internal.hpp b/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_error_internal.hpp
new file mode 100755
index 0000000..8599fb2
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_error_internal.hpp
@@ -0,0 +1,43 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief This file provides framework's API which are used by system services.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_INTERNAL_HPP_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_INTERNAL_HPP_
+
+#include <stdexcept>
+#include <native_service/frameworkunified_types.h>
+
+namespace frameworkunified {
+namespace framework {
+namespace error {
+
+class CSystemError : public std::runtime_error {
+ public:
+ explicit CSystemError(EFrameworkunifiedSystemError error, PCSTR errorMsg);
+ const EFrameworkunifiedSystemError m_eSystemError;
+};
+}
+}
+}
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_INTERNAL_HPP_
+//@}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_internal.h b/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_internal.h
new file mode 100755
index 0000000..4d38828
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_internal.h
@@ -0,0 +1,675 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Internal functions of the application framework.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_INTERNAL_H_
+
+#include <native_service/ns_shared_mem_if.h>
+#include <native_service/frameworkunified_types.h>
+#include "frameworkunified_framework_core.h"
+#define PASA_APPCONFIG_FILES "PASA_APPCONFIG_FILES"
+
+#define FRAMEWORKUNIFIEDLOG_CUT(zone, funcname, print_fmt, args...)
+
+//////////////////////////////////////////////////
+// dispatcher internal functions
+//////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachSystemCallbacksDispatcher
+/// All system defined callbacks will be attached to the dispatcher
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework.
+///
+/// \return eStatus
+/// EFrameworkunifiedStatus - success or error
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachSystemCallbacksDispatcher(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendSystemErrMessage
+/// This API is used to send application's critical error message to system manager.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework.
+/// \param [in] eSystemError
+/// EFrameworkunifiedSystemError - System error type
+///
+/// \return EFrameworkunifiedStatus - success or error
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendSystemErrMessage(HANDLE hApp, EFrameworkunifiedSystemError eSystemError);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateDispatcher
+/// Creates and initializes an applications/threads dispatcher.
+///
+/// \param [in] cAppname
+/// PCSTR - Application/ thread name
+/// \param [out] hApp
+/// HANDLE& - Reference of application handle
+/// \param [in] bIsChildThread
+/// BOOL - child thread
+///
+/// \return status
+/// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if Success
+/// possible errors from call CreateDispatcher
+///
+/// \see FrameworkunifiedDispatchBlock,
+/// FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcher(PCSTR cAppName, HANDLE &hApp, BOOL bIsChildThread); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateHSMDispatcher
+/// Creates and initializes an applications/threads hsm dispatcher.
+///
+/// \param [in] cAppname
+/// PCSTR - Application/ thread name
+/// \param [out] hApp
+/// HANDLE& - Reference of application handle
+/// \param [in] bIsThread
+/// BOOL - child thread
+/// \param [in] f_pFrameworkunifiedHSM
+/// CFrameworkunifiedHSMFramework* - statemachine instances
+///
+/// \return status
+/// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if Success
+/// possible errors from call CreateDispatcher
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateHSMDispatcher(PCSTR cAppName,
+ HANDLE &hApp, // NOLINT (readability/nolint)
+ BOOL bIsThread,
+ CFrameworkunifiedHSMFramework *f_pFrameworkunifiedHSM = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDispatchBlock
+/// Blocked until the dipatcher receives a notification of a service request or ack.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus -Success or error
+///
+/// \see FrameworkunifiedCreateDispatcher,
+/// FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatchBlock(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// frameworkunifiedFdHandler
+/// FD POLLIN blocked & process.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] efd
+/// int - epoll FD
+///
+/// \return status
+/// EFrameworkunifiedStatus -Success or error
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchProcess, FrameworkunifiedDispatchBlock,
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus frameworkunifiedFdHandler(HANDLE hApp , int efd);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDispatchProcess
+/// Processes the Service/system request or notification.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus -Success or error
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
+/// FrameworkunifiedCloseDispatcher,
+///
+/// \details
+/// \code
+/// Pseudo code:
+/// IF message_source != Notification Service
+/// FIND source_name
+/// IF source_name available
+/// FIND protocol_cmd
+/// IF protocol_cmd available
+/// execute callback
+/// ELSE
+/// ignore
+/// END
+/// ELSE
+/// ignore
+/// END
+/// ELSE // notification
+/// FIND notification_callback
+/// IF available
+/// execute callback
+/// END
+/// \endcode
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatchProcess(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCloseDispatcher
+/// Closing the dispatcher
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus -Success or error
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
+/// FrameworkunifiedDispatchProcess.
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseDispatcher(HANDLE hApp);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPopedDeferedMessage
+/// Checks the Defer'ed Message Queue should be pop'ed off
+/// the front of the queue!
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// BOOL - TRUE (a message has been pop'ed of the defer'ed msg queue)
+/// FALSE (no msg was pop'ed of the defer'ed msg queue)
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
+/// FrameworkunifiedDispatchProcess.
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedPopedDeferedMessage(HANDLE hApp);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDispatcherMain
+/// Main processing loop that is shared between FrameworkunifiedDispacther and FrameworkunifiedDispatcherWithCmdLnArguments.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// BOOL - TRUE (a message has been pop'ed of the defer'ed msg queue)
+/// FALSE (no msg was pop'ed of the defer'ed msg queue)
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
+/// FrameworkunifiedDispatchProcess.
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatcherMain(HANDLE hApp);
+
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherMain(HANDLE hApp);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDispatcherMain
+/// Main processing loop that is shared between FrameworkunifiedDispacther and FrameworkunifiedDispatcherWithCmdLnArguments.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// BOOL - TRUE (a message has been pop'ed of the defer'ed msg queue)
+/// FALSE (no msg was pop'ed of the defer'ed msg queue)
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
+/// FrameworkunifiedDispatchProcess.
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedArgumentParser(HANDLE hApp, int argc, char *argv[], CustomCommandLineOptions *cmdLineOptions);
+
+
+EFrameworkunifiedStatus FrameworkunifiedOnInitializationInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnDestroyInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnStartInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnStopInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnPreStartInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnPreStopInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStartInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStopInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDumpInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachineInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterfaceInternal(HANDLE hApp);
+EFrameworkunifiedStatus RegistDefaultCbHandler(const FrameworkunifiedDefaultCallbackHandler *CbHandler);
+
+
+//////////////////////////////////////////////////
+// message center internal functions
+//////////////////////////////////////////////////
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// frameworkunifiedGetIsTypeOfSync
+/// Gets if message type is sync, return TRUE. or not return FALSE
+///
+/// \param [in] hApp
+/// HANDLE - Handle to a Application Framework
+///
+/// \return status
+/// BOOL - TRUE or FALSE
+///
+/// \see FrameworkunifiedInvokeSync, frameworkunifiedSendSyncResponse
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL frameworkunifiedGetIsTypeOfSync(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendSyncResponse
+/// Send Sync Response to the hApp.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the dispatcher to receive message
+/// \param [in] seq_id
+/// UI_32 - Sync sequence ID
+/// \param [in] retValue
+/// EFrameworkunifiedStatus - Return Status
+/// \param [in] length
+/// UI_32 - Length of the data to be receive response.
+/// \param [in] data
+/// PVOID - Pointer to the response data.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedInvokeSync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus frameworkunifiedSendSyncResponse(HANDLE hApp, UI_32 iCmd, UI_32 seq_id, EFrameworkunifiedStatus retValue, UI_32 length, PCVOID data);
+
+//////////////////////////////////////////////////
+// logger internal functions
+//////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachLoggerCallbacksDispatcher(HANDLE hApp);
+
+#ifdef DISPATCHER_PROFILER
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachMsgProfilerCallbacksDispatcher
+/// This function attaches callback function for profiler protocol for main thread.
+/// Protocol is attached considering the source as "nsprofilerutil"
+///
+/// \param [in] hApp
+/// HANDLE - Handle to a Application Framework
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachMsgProfilerCallbacksDispatcher(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachMsgProfilerCallbacksDispatcher
+/// This function attaches callback function for profiler protocol for child threads.
+/// Protocol is attached considering the source as parent thread
+///
+/// \param [in] hApp
+/// HANDLE - Handle to a Application Framework
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachChildMsgProfilerCallbacksDispatcher(HANDLE hApp);
+#endif
+
+EFrameworkunifiedStatus FrameworkunifiedSetLogMask(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedGetLogMask(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedSetOutputLogOpts(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedGetOutputLogOpts(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedSetLogSeverity(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedGetLogSeverity(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedDebugDumpRequest(HANDLE hApp);
+
+EFrameworkunifiedStatus NSRcsSetLogSettings(HANDLE hApp);
+EFrameworkunifiedStatus NSRcsGetLogSettings(HANDLE hApp);
+EFrameworkunifiedStatus NSRcsSetLogMask(HANDLE hApp);
+EFrameworkunifiedStatus NSRcsSetOutputLogOpts(HANDLE hApp);
+EFrameworkunifiedStatus NSRcsSetLogSeverity(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetConfigHandle
+/// This Function opens the configuration file from given path and sets the file handle in hApp
+///
+/// \param [in] cAppname
+/// HANDLE - Application handle
+/// \param [in] sFilePath
+/// PCHAR - File path of the config file
+///
+/// \return status of the operation
+///
+/// \see SetDefaultFilePath,
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetConfigHandle(HANDLE hApp, PCHAR sFilePath);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetDefaultFilePath
+/// This Function fetches the default config path, opens the configuration file and sets the file
+/// handle in the application
+///
+/// \param [in] cAppname
+/// HANDLE - Application handle
+/// \param [in] sFilePath
+/// PCHAR - File path of the config file
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetDefaultConfigFile(HANDLE hApp);
+
+EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocolHSMEvent(HANDLE hApp, PCSTR pRequester);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ProcessProtocolEvents
+/// This Function registers the events of server with the client.
+/// If the event is published previously and is a state event then send the event data to the client.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus ProcessProtocolEvents(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ProcessPrivateEvents
+/// This Function registers the events of server with the client.
+/// If the event is published previously and is a state event then send the event data to the client.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus ProcessPrivateEvents(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CleanAllEventsOfSession
+/// This Function closes the session handle and removes its entry from the table of
+/// ServiceSessionHandleTable of application framework handle.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] serviceName
+/// PCSTR - Name of a service
+/// \param [in] sessionId
+/// UI_32 - Session id
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CleanAllEventsOfSession(HANDLE hApp, PCSTR serviceName, UI_32 sessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveEntryFromSessionEventInfoTable
+/// This Function removes the entry of event id from the session table based on the service
+/// name and session id.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] serviceName
+/// PCSTR - Name of service
+/// \param [in] sessionId
+/// UI_32 - Session id
+/// \param [in] eventId
+/// UI_32 - Event id which needs to be removed from internal table
+///
+/// \return eFrameworkunifiedStatusOK- Success, or eFrameworkunifiedStatusFail
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RemoveEntryFromSessionEventInfoTable(HANDLE hApp, PCSTR serviceName, UI_32 sessionId, UI_32 eventId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// HandleSessionEventOnCloseSession
+/// This Function does the handling of session events on close session request
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus HandleSessionEventOnCloseSession(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// UnregisterPrivateEvents
+/// This Function unregisters the private event.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus UnregisterPrivateEvents(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetMsgQueueHandle
+/// Gets the message queue handle from servicesessionhandletable map.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] serviceName
+/// PCSTR - Service name of receiver
+/// \param [in] uiSessionId
+/// UI_32 - session id
+///
+/// \return Message queue handle
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE GetMsgQueueHandle(HANDLE hApp, PCSTR serviceName, const UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetNewMsgQueueHandle
+/// This function creates and returns the message queue handle.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] serviceName
+/// PCSTR - Service name of receiver
+/// \param [in] uiSessionId
+/// UI_32 - session id
+/// \param [in] uiEventId
+/// const UI_32 - event id
+///
+/// \return Message queue handle
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE GetNewHandleAndUpdateEventInfoTable(HANDLE hApp, PCSTR serviceName, const UI_32 uiSessionId,
+ const UI_32 uiEventId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsEventAlreadyRegistered
+/// Searches for the session id in the vector
+///
+/// \param [in] vSessionIdList
+/// SessionIdList - list of sessions id's
+/// \param [in] uiSessionId
+/// UI_32 - session id
+///
+/// \return true or false
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL IsEventAlreadyRegistered(const SessionIdList &vSessionIdList, const UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveEventEntryFromEventTable
+/// This Function removes the entry of event for received service on the active session id
+/// from Event Table.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] uiEventId
+/// UI_32 - event id
+/// \param [in] serviceName
+/// PCSTR - Service name of receiver
+/// \param [in] uiSessionId
+/// UI_32 - session id
+///
+/// \return success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RemoveEventEntryFromEventTable(HANDLE hApp, UI_32 uiEventId, PCSTR cServiceName, const UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendEventMessage
+/// This function sends the private event message to all the sessions of service registered
+/// for event.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] vSessionIdList
+/// SessionIdList - session id list
+/// \param [in] uiEventId
+/// UI_32 - event id
+/// \param [in] cServiceName
+/// PCSTR - Service name of receiver
+/// \param [in] pData
+/// PCVOID - data to send
+/// \param [in] uiLength
+/// UI_32 - length of data
+///
+/// \return success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendEventMessage(HANDLE hApp, const SessionIdList &vSessionIdList, UI_32 uiEventId, PCSTR cServiceName,
+ PCVOID pData, UI_32 uiLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdatePublicStateEventData
+/// This API updates the event data of public state event for all the session of
+/// all subscribed clients.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] uiEventId
+/// UI_32 - event id
+/// \param [in] pData
+/// PCVOID - data to send
+/// \param [in] uiLength
+/// UI_32 - length of data
+///
+/// \return success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus UpdatePublicStateEventData(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdatePrivateStateEventData
+/// This API updates the event data of private state event for session with
+/// session id uiSessionId of client pClientName.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] uiEventId
+/// UI_32 - event id
+/// \param [in] pClientName
+/// PCSTR - Event Subscriber name
+/// \param [in] uiSessionId
+/// UI_32 - session id
+/// \param [in] pData
+/// PCVOID - data to send
+/// \param [in] uiLength
+/// UI_32 - length of data
+///
+/// \return success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus UpdatePrivateStateEventData(HANDLE hApp, UI_32 uiEventId, PCSTR pClientName, UI_32 uiSessionId, PCVOID pData,
+ UI_32 uiLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// DeleteSessionEventData
+/// This function is called while destroying the session with client.
+/// This method removes the private event data associated with the session.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pClientName
+/// PCSTR - Event Subscriber name
+/// \param [in] uiSessionId
+/// UI_32 - session id
+///
+/// \return success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DeleteSessionEventData(HANDLE hApp, PCSTR pClientName, UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetDataUSID
+/// Gets the shared memory ID
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// UI_32 - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+TMemID FrameworkunifiedGetDataUSID(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedIsAutoPublishServiceAvailableEnabled
+/// This function is used to check whether auto publishing of service availability is
+/// enabled or not.
+///
+/// \param None
+///
+/// \return BOOL
+/// BOOL - true if auto publish is enabled for service else false
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsAutoPublishServiceAvailableEnabled();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedIsWaitInStoppingStateEnabled
+/// Check if wait in stopping state is enabled.
+///
+/// \param [in] none
+///
+/// \return BOOL - TRUE if enabled or FALSE
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsWaitInStoppingStateEnabled();
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_utility.h b/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_utility.h
new file mode 100755
index 0000000..b78297e
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_utility.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_UTILITY_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_UTILITY_H_
+
+#include <native_service/ns_utility.hpp>
+#include "frameworkunified_framework_internal.h"
+
+DEFINE_EXCEPTION(happ_error, std::runtime_error);
+
+class HAppTraits {
+ public:
+ typedef HANDLE Type;
+ typedef happ_error Exception;
+ static void Release(Type rsrc) {
+ FrameworkunifiedOnDestroyInternal(rsrc);
+ FrameworkunifiedCloseDispatcher(rsrc);
+ }
+
+ static BOOL BadValue(Type rsrc) {
+ return NULL == rsrc;
+ }
+};
+
+typedef ResourceMgr< HANDLE, HAppTraits > THApp;
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_UTILITY_H_
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_msgprofiler.h b/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_msgprofiler.h
new file mode 100755
index 0000000..f512e76
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_msgprofiler.h
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief File declares FrameworkunifiedMsgProfiler class which keeps profiler information for message dispatcher
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_MSGPROFILER_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_MSGPROFILER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <vector>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// Profiler class which keeps and manage profiler information for message dispatcher
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class FrameworkunifiedMsgProfiler {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedMsgProfiler
+ /// Parameterized constructor
+ /// \param [in] f_cAppName
+ /// const std::string& - Name of the application or dispatcher
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ explicit FrameworkunifiedMsgProfiler(const std::string &f_cAppName);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~FrameworkunifiedMsgProfiler
+ /// Class destructor
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ~FrameworkunifiedMsgProfiler();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// GetAppName
+ /// Returns application name corresponding to profiler
+ ///
+ /// \param [in] none
+ ///
+ /// \return std::string
+ /// std::string - Returns application name corresponding to profiler
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetAppName();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// AddChildName
+ /// Returns application name corresponding to profiler
+ ///
+ /// \param [in] f_cChildName
+ /// const std::string& - Add the name of child dispatcher profiler
+ ///
+ /// \return none
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID AddChildName(const std::string &f_cChildName);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// MsgReceived
+ /// Updates the profiler information once the message is received.
+ /// e.g. increaments msg count, save the time of msg received
+ ///
+ /// \param [in] none
+ ///
+ /// \return none
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID MsgReceived();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// MsgProcessed
+ /// Updates the profiler information once the message is processed.
+ /// e.g. Updates the frequency of execution of message
+ ///
+ /// \param [in] none
+ ///
+ /// \return none
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID MsgProcessed();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintProfileInfo
+ /// All the profiler information which FrameworkunifiedMsgProfiler class has prints it in message
+ /// queue FRAMEWORKUNIFIED_NS_MSGPROFILERUTIL
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Application framework handle
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PrintProfileInfo(HANDLE f_hApp);
+
+ static BOOL m_bMsgProfilerEnabled; /// Flag is enabled when command line argument -q is passed.
+ /// Otherwise no profiler information is maintained.
+
+ private:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// GetClock
+ /// GetClock of milliseconds
+ ///
+ /// \param [in] none
+ ///
+ /// \return UI_64
+ /// UI_64 - returns time in Milliseconds
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ UI_64 GetClock();
+
+ std::vector<std::string> m_vChildNames; /// vector to save list of all child threads dispatcher
+ std::string m_cAppName; /// Dispacther application name
+ UI_32 m_ui32TotalNoOfMsgsReceived; /// Total number of messages received by the dispatcher
+
+ // NOTE: Storing time in ClockCycle. So that it will not add overhead for converting it to miliseconds.
+ // It will get converted only when information is required to print.
+ UI_64 m_ui64MinMsgProcessingTime; // time is in clock cycles
+ UI_64 m_ui64MaxMsgProcessingTime; // time is in clock cycles
+
+ UI_64 m_ui64TotalMsgExecutionTime; /// total time spent in message execution
+ UI_64 m_ui64LastMsgReceivedTime; /// save the time when last message was received
+ UI_64 m_ui64AppInitTime; /// save the time when application got initialized
+ BOOL m_bLastMsgWasPrintProfile; /// TRUE if the last message received
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_MSGPROFILER_H_
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_finalstate.h b/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_finalstate.h
new file mode 100755
index 0000000..20ed3f6
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_finalstate.h
@@ -0,0 +1,97 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedFinalState class definitions. CFrameworkunifiedFinalState is derived from
+/// CFrameworkunifiedState class.This class implements the additional functionality supported by HSM Final
+/// state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FINALSTATE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FINALSTATE_H_
+
+
+#include <native_service/frameworkunified_sm_state.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM Final state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedFinalState : public CFrameworkunifiedState {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedFinalState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedFinalState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedFinalState
+ /// Class destructor
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedFinalState();
+
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateHistory
+ /// This function stores the last active state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UpdateHistory();
+
+ protected :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEntry
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnExit
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FINALSTATE_H_
+// @}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h b/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h
new file mode 100755
index 0000000..ea564df
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This File has public Macro definition that simplifies the statemachine implementation
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_
+/// Include files
+#include <native_service/frameworkunified_framework_types.h>
+#include <vector>
+#include <utility>
+
+/// connect child state to parent state and sets it as default state
+#define CONNECT_DEFAULTSTATE(parent, child) \
+ FrameworkunifiedConnect(l_p## parent, l_p## child, TRUE);
+
+/// connect child state to parent state
+#define CONNECT_STATE(parent, child) \
+ FrameworkunifiedConnect(l_p## parent, l_p## child);
+
+/// connect the deferred event and reactions and associate them with the state
+#define CONNECT_DEFERREDEVENT(state, eventid) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, NULL, #eventid, TRUE); \
+
+/// connect the event and reactions and associate them with the state
+#define CONNECT_EVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid);
+
+/// connect the event and reactions and associate them with the state
+#define CONNECT_LOCAL_EVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pLocalTrn## reaction, #eventid);
+
+/// Sets the state as root state in the statemachine
+#define CONNECTROOT(state) \
+ FrameworkunifiedConnect(l_p## state);
+
+/// Creates the state
+#define CREATE_STATE(class_name) \
+ CHKNULL(m_pFrameworkunifiedStateList) \
+ C## class_name *l_p## class_name = new C## class_name(#class_name); \
+ CHKNULL(l_p## class_name) \
+ m_pFrameworkunifiedStateList->insert(std::pair<UI_32, CFrameworkunifiedState*>(e## class_name, l_p## class_name));
+
+// create a new shallow history state and add it in parent state
+#define ADD_SHALLOWHISTORYSTATE(parent) \
+ CFrameworkunifiedShallowHistoryState *l_p##parent##SHALLOWHISTORYSTATE = new CFrameworkunifiedShallowHistoryState(SHALLOWHISTORYSTATE);\
+ FrameworkunifiedConnect(l_p## parent, l_p##parent##SHALLOWHISTORYSTATE);\
+ l_p##parent##SHALLOWHISTORYSTATE->SetDefaultHistory();
+
+// create a new shallow history state and add it in parent state
+#define ADD_DEEPHISTORYSTATE(parent) \
+ CFrameworkunifiedDeepHistoryState *l_p##parent##DEEPHISTORYSTATE = new CFrameworkunifiedDeepHistoryState(DEEPHISTORYSTATE);\
+ FrameworkunifiedConnect(l_p## parent, l_p##parent##DEEPHISTORYSTATE);\
+ l_p##parent##DEEPHISTORYSTATE->SetDefaultHistory();
+
+/// connect deep history event to reaction and add to state
+#define CONNECT_DEEPHISTORYEVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##DEEPHISTORYSTATE, #eventid);
+
+/// connect shallow history event to reaction and add to state
+#define CONNECT_SHALLOWHISTORYEVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##SHALLOWHISTORYSTATE, #eventid);
+
+typedef struct _HSMConfigOptions {
+ EUserChangeOptions eUserChange;
+ BOOL bAutoPublishServiceAvaialble;
+ BOOL bWaitInStoppingState;
+} HSMConfigOptions;
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_multithreading_internal.h b/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_multithreading_internal.h
new file mode 100755
index 0000000..ff67029
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_multithreading_internal.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Internal functions related to state machine child threads
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_INTERNAL_H_
+
+void *child_hsm_thread_proc(void *args);
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_dispatcher.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_dispatcher.cpp
new file mode 100755
index 0000000..250edce
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_dispatcher.cpp
@@ -0,0 +1,2382 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/epoll.h>
+#include <sys/eventfd.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <fcntl.h>
+#include <pthread.h>
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_framework_sync.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/ns_resource_controler.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <other_service/strlcpy.h>
+
+#include <string>
+#include <utility>
+#include <map>
+
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+#include "ns_message_center_internal.h"
+#include "ns_mc_internal.h"
+#include "frameworkunified_framework_error_internal.hpp"
+#include "frameworkunified_framework_utility.h"
+#include "frameworkunified_sm_framework_core.h"
+
+#ifdef DISPATCHER_PROFILER
+#include "frameworkunified_msgprofiler.h"
+#include <boost/bind.hpp>
+#endif
+
+/*
+ * static variable
+ */
+static FrameworkunifiedDefaultCallbackHandler g_defaultCallbackHandler;
+
+//////////////////////////
+// prototype declaration
+//////////////////////////
+static EFrameworkunifiedStatus GetDispatcherMqFD(HANDLE hApp, int *fd);
+static EFrameworkunifiedStatus CreateMultiWaitingFD(HANDLE hApp);
+static EFrameworkunifiedStatus ProcessMq(HANDLE hApp);
+static EFrameworkunifiedStatus ProcessFd(HANDLE hApp , int fd);
+
+//////////////////////////////////////////
+// Function : ostream &operator<<
+//////////////////////////////////////////
+template <typename K, typename V, class C, class A>
+std::ostream &operator<< (std::ostream &os, const std::map<K, V, C, A> &m) {
+ os << "{ ";
+ typename std::map<K, V, C, A>::const_iterator p;
+ for (p = m.begin(); p != m.end(); ++p) {
+ os << p->first << ":" << p->second << ", ";
+ }
+ return os << "}";
+}
+
+EFrameworkunifiedStatus CreateDispatcher(PCSTR cAppName, HANDLE &hApp, BOOL bIsChildThread) { // NOLINT (readability/nolint)
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = new CFrameworkunifiedFrameworkApp; // LCOV_EXCL_BR_LINE 11:except branch
+ if (pApp != NULL) { // LCOV_EXCL_BR_LINE 5:fail safe for new
+ pApp->checkCode = APP_CHECK_CODE;
+ pApp->self = pthread_self();
+ // app name size should not exceed the max length
+ memset(pApp->cAppName, 0, MAX_NAME_SIZE_APP);
+ memset(pApp->sServiceAvailabilityNotification, 0, MAX_SYS_INFO_SIZE);
+ pApp->bIsAvailable = FALSE;
+ /*
+ * todo
+ * Setting NULL for arguments causes an Exception
+ */
+ if (strlen(cAppName) < MAX_NAME_SIZE_APP) {
+ memcpy(pApp->cAppName, cAppName, strlen(cAppName));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error : Aborting ... Exceeds Max App name size MAX_NAME_SIZE_APP : %d ",
+ MAX_NAME_SIZE_APP);
+ /*
+ * Error is set here, but the error is overwritten by the following process
+ */
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, " Application Created ");
+
+ // opening handle to receive message for the application
+ pApp->hAppRcvMsgQ = NULL;
+ if (NULL == (pApp->hAppRcvMsgQ = McOpenReceiver(pApp->cAppName))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Error : Failed to McOpenReceiver ");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ } else {
+ if (strcmp(cAppName, "NS_NPPService") != 0) {
+ McFlushReceiver(pApp->hAppRcvMsgQ);
+ }
+ }
+
+ // opening socket for abnormal monitoring
+ pApp->siMonitorSock = -1;
+ if ((eFrameworkunifiedStatusOK == eStatus) && (-1 == (pApp->siMonitorSock = mcOpenMonitor(pApp->cAppName)))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Error : Failed to mcOpenMonitor ");
+ eStatus = eFrameworkunifiedStatusFail;
+ pApp->siMonitorSock = -1;
+ }
+
+ // opening handle to send messages to itself
+ pApp->hAppSndMsgQ = NULL;
+ if ((eFrameworkunifiedStatusOK == eStatus) && (NULL == (pApp->hAppSndMsgQ = McOpenSender(pApp->cAppName)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Error : Failed to McOpenSender ");
+ // LCOV_EXCL_BR_STOP
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ // opening handles for Notification Persistence Service and Service Directory
+ pApp->hNPSndMsgQ = NULL;
+ if ((eFrameworkunifiedStatusOK == eStatus) &&
+ (NULL == (pApp->hNPSndMsgQ = FrameworkunifiedMcOpenSender(reinterpret_cast<HANDLE>(pApp), FRAMEWORKUNIFIED_NS_NPSERVICE)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error : Failed to FrameworkunifiedMcOpenSender < NS_NPPService >");
+ // LCOV_EXCL_BR_STOP
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ // stores the message queue handle of the parent thread.
+ // It will set after the dispatcher of child thread is created. And will be NULL for main thread.
+ pApp->hParentSndMsgQ = NULL;
+
+ if ((eFrameworkunifiedStatusOK == eStatus) && (!bIsChildThread)) {
+ // Define any system callback's with the dispatcher.
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachSystemCallbacksDispatcher(reinterpret_cast<HANDLE>(pApp)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error :: (%d) Failed to FrameworkunifiedAttachSystemCallbacksDispatcher ", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ // Define the logger callback's for setting up gets and sets with the dispatcher.
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachLoggerCallbacksDispatcher(reinterpret_cast<HANDLE>(pApp)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error :: (%d) Failed to FrameworkunifiedAttachLoggerCallbacksDispatcher ", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ }
+
+ // initialize
+ pApp->m_pFrameworkunifiedStateMachine = NULL;
+ pApp->uiProtocolCmd = 0;
+
+ // Clear the Defer'ed message pop flag.
+ pApp->fPopDeferedMsg = FALSE;
+
+ // Clear the Defer'ed sync response flag.
+ pApp->fDeferredSyncResponse = FALSE;
+
+ // buffer initialize
+ memset(pApp->uiMsgRcvBuffer, 0, MAX_MSGQ_BUFFER);
+ memset(pApp->cMsgSrcName, '\0', MAX_NAME_SIZE_APP);
+ memset(pApp->cSystemInfo, '\0', MAX_SYS_INFO_SIZE);
+
+ pApp->defer_evfd = -1;
+ pApp->efd = -1;
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ eStatus = CreateMultiWaitingFD((HANDLE)pApp);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : CreateMultiWaitingFD Failed, status=%d", eStatus);
+ }
+ }
+
+#ifdef DISPATCHER_PROFILER
+ // Assign default value
+ pApp->m_pFrameworkunifiedMsgProfiler = NULL;
+#endif
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ if (NULL != pApp->hAppRcvMsgQ) {
+ McClose(pApp->hAppRcvMsgQ);
+ pApp->hAppRcvMsgQ = NULL;
+ }
+
+ if (0 < pApp->siMonitorSock) {
+ mcCloseMonitor(pApp->cAppName);
+ pApp->siMonitorSock = -1;
+ }
+
+ if (NULL != pApp->hAppSndMsgQ) {
+ McClose(pApp->hAppSndMsgQ);
+ pApp->hAppSndMsgQ = NULL;
+ }
+
+ if (NULL != pApp->hNPSndMsgQ) {
+ FrameworkunifiedMcClose(pApp->hNPSndMsgQ);
+ pApp->hNPSndMsgQ = NULL;
+ }
+
+ // LCOV_EXCL_BR_START 6:According to line 158, pApp->hParentSndMsgQ is NULL.
+ if (NULL != pApp->hParentSndMsgQ) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6:According to line 158, pApp->hParentSndMsgQ is NULL.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ McClose(pApp->hParentSndMsgQ);
+ pApp->hParentSndMsgQ = NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 < pApp->defer_evfd) {
+ close(pApp->defer_evfd);
+ pApp->defer_evfd = -1;
+ }
+
+ if (0 < pApp->efd) {
+ close(pApp->efd);
+ pApp->efd = -1;
+ }
+
+ delete pApp; // LCOV_EXCL_BR_LINE 11:except branch
+ pApp = NULL;
+ }
+ }
+
+ hApp = pApp;
+
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedCreateDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcher(PCSTR cAppName, HANDLE &hApp, BOOL bIsChildThread) { // NOLINT (readability/nolint)
+ return CreateDispatcher(cAppName, hApp, bIsChildThread);
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedDispatchBlock
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatchBlock(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+// FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "+");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (eFrameworkunifiedStatusOK != (eStatus = McReceiveWithSession(pApp->hAppRcvMsgQ, pApp->cMsgSrcName,
+ &pApp->uiProtocolCmd, &pApp->uiSessionId, MAX_MSGQ_BUFFER,
+ (PVOID)(pApp->uiMsgRcvBuffer)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: (%d) Failed on McReceive", eStatus);
+ // LCOV_EXCL_BR_STOP
+ } else {
+// FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Message received on dispatcher:: Source: %s, Cmd: 0x%X, SessionId: %d ",
+// pApp->cMsgSrcName, pApp->uiProtocolCmd, pApp->uiSessionId);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+// FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "-");
+ return eStatus;
+}
+
+
+EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocolCallback(HANDLE hApp, PCSTR pRequester) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ Services::iterator s_iterator;
+
+ s_iterator = pApp->services.find(pRequester);
+ if (s_iterator != pApp->services.end()) {
+ SessionTable::iterator session_iterator;
+ session_iterator = (s_iterator->second).find(pApp->uiSessionId);
+ if (session_iterator != (s_iterator->second).end()) {
+ // FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, " %s found :: (%s) ", pApp->cMsgSrcName, s_iterator->second);
+
+ // find the protocol req/ack handler
+ ServiceProtocolTable::iterator spt_iterator;
+ spt_iterator = (session_iterator->second).find(pApp->uiProtocolCmd);
+ if (spt_iterator != (session_iterator->second).end()) {
+ // calling the protocol req/ack handler
+ eStatus = (*spt_iterator).second(hApp);
+ } else if ((session_iterator->second).end() != (spt_iterator =
+ (session_iterator->second).find(FRAMEWORKUNIFIED_ANY_COMMAND))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__,
+ "Processing callback function for (FRAMEWORKUNIFIED_ANY_COMMAND). "
+ "Dispatcher protocol command: (0x%x)", pApp->uiProtocolCmd);
+ // LCOV_EXCL_BR_STOP
+ eStatus = (*spt_iterator).second(hApp);
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocol(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // Check if the callback is associated with the Protocol for message source
+ eStatus = FrameworkunifiedProcessServiceProtocolCallback(hApp, const_cast<PCSTR>(pApp->cMsgSrcName));
+
+ if (eFrameworkunifiedStatusMsgNotProcessed == eStatus) {
+ // Check if the callback is associated with the Protocol for FRAMEWORKUNIFIED_ANY_SOURCE
+ eStatus = FrameworkunifiedProcessServiceProtocolCallback(hApp, FRAMEWORKUNIFIED_ANY_SOURCE);
+ if (eFrameworkunifiedStatusMsgNotProcessed == eStatus) {
+ if (pApp->m_pFrameworkunifiedStateMachine) {
+ // Check if the HSM event is associated with the Protocol for message source
+ eStatus = FrameworkunifiedProcessServiceProtocolHSMEvent(hApp, const_cast<PCSTR>(pApp->cMsgSrcName));
+
+ if (eFrameworkunifiedStatusMsgNotProcessed == eStatus) {
+ // Check if the HSM event is associated with the Protocol for FRAMEWORKUNIFIED_ANY_SOURCE
+ eStatus = FrameworkunifiedProcessServiceProtocolHSMEvent(hApp, FRAMEWORKUNIFIED_ANY_SOURCE);
+ }
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+EFrameworkunifiedStatus FrameworkunifiedSetDeferredSyncResponse(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldBuf;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->fDeferredSyncResponse = TRUE;
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ return eStatus;
+}
+
+
+static void frameworkunifiedProcessSyncResponse(HANDLE hApp, EFrameworkunifiedStatus retValue) {
+ EFrameworkunifiedStatus eStatus;
+ CHAR systemInfo[MAX_SYS_INFO_SIZE];
+ UI_32 seq_id;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (frameworkunifiedGetIsTypeOfSync(hApp) == TRUE) {
+ if (pApp->fDeferredSyncResponse == TRUE) {
+ if (pApp->responsedata.size() != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Response data is ignored for "
+ ":: source: %s, Protocol Command: 0x%x, Session Id: %u.",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL,
+ pApp->uiProtocolCmd, pApp->uiSessionId);
+ pApp->responsedata.clear();
+ }
+ } else {
+ FrameworkunifiedGetSystemInfo(hApp, systemInfo);
+ seq_id = (UI_32)strtoul(systemInfo, NULL, 16);
+
+ eStatus = frameworkunifiedSendSyncResponse(hApp, PROTOCOL_FRAMEWORKUNIFIED_ANY_COMMAND, seq_id, retValue, pApp->responsedata.size(),
+ pApp->responsedata.data());
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "retValu:%d errno:%d", eStatus, errno);
+ }
+ pApp->responsedata.clear();
+ }
+ } else {
+ if (pApp->responsedata.size() != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Response data is ignored for :: "
+ "source: %s, Protocol Command: 0x%x, Session Id: %u.",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL,
+ pApp->uiProtocolCmd, pApp->uiSessionId);
+ pApp->responsedata.clear();
+ }
+ }
+ pApp->fDeferredSyncResponse = FALSE;
+}
+
+
+inline static time_t frameworkunifiedTimeval2usec(const struct timeval &time) {
+ return static_cast<time_t>(time.tv_sec * 1000000 + time.tv_usec);
+}
+
+
+static void frameworkunifiedPrintRusage(HANDLE hApp, const struct rusage &start, const struct rusage &end) {
+ UI_32 occupy_time;
+ UI_32 average;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ occupy_time = static_cast<UI_32>(frameworkunifiedTimeval2usec(end.ru_utime) - frameworkunifiedTimeval2usec(start.ru_utime));
+ occupy_time += static_cast<UI_32>(frameworkunifiedTimeval2usec(end.ru_stime) - frameworkunifiedTimeval2usec(start.ru_stime));
+
+ pApp->total_occupy_time += occupy_time;
+ pApp->total_run_count++;
+ average = static_cast<UI_32>(pApp->total_occupy_time / pApp->total_run_count);
+
+ if (occupy_time > pApp->max_occupy_time) {
+ pApp->max_occupy_time = occupy_time;
+ }
+
+// FRAMEWORKUNIFIEDLOG(ZONE_NS_DEBUG_DUMP, __FUNCTION__, "cur:%d.%06d avg:%d.%06d max:%d.%06d",
+// occupy_time / 1000000, occupy_time % 1000000,
+// average / 1000000, average % 1000000,
+// pApp->max_occupy_time / 1000000, pApp->max_occupy_time % 1000000);
+}
+
+
+static inline void frameworkunifiedGetRusage(struct rusage *r) {
+ if (r == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "r is NULL");
+ return;
+ }
+ memset(r, 0, sizeof(struct rusage));
+ if (getrusage(RUSAGE_THREAD, r) == -1) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "getrusage errno:%d", errno);
+ // LCOV_EXCL_BR_STOP
+ }
+}
+
+static int frameworkunifiedPushLostSessionInfo(HANDLE hApp, PCSTR serviceName) {
+ int cntFound = 0;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ ServiceSessionTable::iterator s_iterator = pApp->sessiontable.find(serviceName);
+ if (s_iterator != pApp->sessiontable.end()) {
+ // LCOV_EXCL_BR_START 11:except branch
+ SessionHandleTable::iterator sh_iterator = pApp->sessiontable[serviceName].begin();
+ // LCOV_EXCL_BR_STOP
+ while (sh_iterator != pApp->sessiontable[serviceName].end()) {
+ LostSessionInfo l_info;
+ l_info.sServiceName = serviceName;
+ l_info.iSessionId = sh_iterator->first;
+ pApp->lostSessionQueue.push(l_info);
+ cntFound++;
+ sh_iterator++;
+ }
+ }
+ return cntFound;
+}
+
+///
+/// Abnormal monitor(server): Client socket close handle
+///
+EFrameworkunifiedStatus frameworkunifiedProcessClientAbnormalState(HANDLE hApp, int sockfd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ AcceptMonitorTable::iterator it;
+
+ if ((it = pApp->acceptMonitorTable.find(sockfd)) == pApp->acceptMonitorTable.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid fd", sockfd);
+ } else {
+ char clientName[16];
+ if (mcGetClientNameFromConnectKey((it->second).c_str(), clientName, sizeof(clientName)) < 0) {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Invlid connectKey:%s", (it->second).c_str());
+ // LCOV_EXCL_BR_STOP
+ } else {
+ if (pApp->lostSessionHandler != NULL) {
+ int cntFound = frameworkunifiedPushLostSessionInfo(hApp, clientName);
+ if (cntFound) {
+ // calling lost session handler
+ try {
+ eStatus = pApp->lostSessionHandler(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from: %s", e.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ }
+ }
+ pApp->acceptMonitorTable.erase(sockfd);
+ }
+
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///
+/// Abnormal monitor(server): Add
+///
+EFrameworkunifiedStatus frameworkunifiedAddAcceptMonitor(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ int acceptSock;
+
+ if ((acceptSock = mcGetAcceptMonitor(pApp->cAppName, pApp->cMsgSrcName)) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : mcGetAcceptMonitor srv:%s clnt:%s",
+ pApp->cAppName != 0 ? pApp->cAppName : NULL, pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL);
+ // LCOV_EXCL_BR_STOP
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ char connectKey[32];
+ mcSetConnectKey(connectKey, sizeof(connectKey), pApp->cAppName, pApp->cMsgSrcName);
+ pApp->acceptMonitorTable.insert(std::make_pair(acceptSock, connectKey));
+ }
+
+ return eStatus;
+}
+
+///
+/// Abnormal monitor(server): Del
+///
+EFrameworkunifiedStatus frameworkunifiedDelAcceptMonitor(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ long acceptSock; // NOLINT (readability/nolint)
+
+ char connectKey[32];
+ mcSetConnectKey(connectKey, sizeof(connectKey), pApp->cAppName, pApp->cMsgSrcName);
+ if (frameworkunifiedGetResource(FRAMEWORKUNIFIED_RES_ABNMLMON, connectKey, &acceptSock) < 0) {
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ if (pApp->acceptMonitorTable.find(static_cast<Socket>(acceptSock)) != pApp->acceptMonitorTable.end()) {
+ pApp->acceptMonitorTable.erase(static_cast<Socket>(acceptSock));
+ }
+ }
+
+ return eStatus;
+}
+
+///
+/// Abnormal monitor(client): Server socket close handle
+///
+EFrameworkunifiedStatus frameworkunifiedProcessServerAbnormalState(HANDLE hApp, int sockfd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ ConnectMonitorTable::iterator it;
+
+ if ((it = pApp->connectMonitorTable.find(sockfd)) == pApp->connectMonitorTable.end()) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid fd", sockfd);
+ // LCOV_EXCL_BR_STOP
+ } else {
+ char serverName[16];
+ if (mcGetServerNameFromConnectKey((it->second).c_str(), serverName, sizeof(serverName)) < 0) {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Invlid connectKey:%s", (it->second).c_str());
+ // LCOV_EXCL_BR_STOP
+ } else {
+ if (pApp->lostSessionHandler != NULL) {
+ int cntFound = frameworkunifiedPushLostSessionInfo(hApp, serverName); // LCOV_EXCL_BR_LINE 11:except branch
+ if (cntFound) {
+ // calling lost session handler
+ try {
+ eStatus = pApp->lostSessionHandler(hApp);
+ } catch (const std::exception &e) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from: %s", e.what());
+ // LCOV_EXCL_BR_STOP
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ }
+ }
+ pApp->connectMonitorTable.erase(sockfd);
+ }
+
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///
+/// Abnormal monitor(client): Add
+///
+EFrameworkunifiedStatus frameworkunifiedAddConnectMonitor(HANDLE hApp, PCSTR serverName, PCSTR clientName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ int connectSock = mcConnectMonitor(serverName, clientName);
+ if (connectSock < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error::%s:%s mcConnectMonitor",
+ serverName != 0 ? serverName : NULL, pApp->cAppName != 0 ? pApp->cAppName : NULL);
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ if (pApp->connectMonitorTable.find(connectSock) == pApp->connectMonitorTable.end()) {
+ char connectKey[32];
+ mcSetConnectKey(connectKey, sizeof(connectKey), serverName, clientName);
+
+ struct epoll_event event;
+ event.events = EPOLLRDHUP;
+ event.data.fd = connectSock;
+
+ if (epoll_ctl(pApp->efd, EPOLL_CTL_ADD, connectSock, &event) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (eStatus == eFrameworkunifiedStatusOK) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->connectMonitorTable.insert(std::make_pair(connectSock, connectKey));
+ }
+ }
+ }
+
+ return eStatus;
+}
+
+///
+/// Abnormal monitor(client): Del
+///
+EFrameworkunifiedStatus frameworkunifiedDelConnectMonitor(HANDLE hApp, PCSTR serverName, PCSTR clientName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ char connectKey[32];
+ mcSetConnectKey(connectKey, sizeof(connectKey), serverName, clientName);
+
+ long connectSock; // NOLINT (readability/nolint)
+ if (frameworkunifiedGetResource(FRAMEWORKUNIFIED_RES_ABNMLMON, connectKey, &connectSock) < 0) {
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ if (pApp->connectMonitorTable.find(static_cast<Socket>(connectSock)) != pApp->connectMonitorTable.end()) {
+ pApp->connectMonitorTable.erase(static_cast<Socket>(connectSock));
+ }
+
+ if (epoll_ctl(pApp->efd, EPOLL_CTL_DEL, static_cast<int>(connectSock), NULL) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ return eStatus;
+}
+
+///
+/// Abnormal monitor(common): Attach callback
+///
+EFrameworkunifiedStatus FrameworkunifiedAttachLostSessionCallbackToDispatcher(HANDLE hApp, CbFuncPtr fpLostSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) == FALSE || fpLostSession == NULL) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->lostSessionHandler = fpLostSession;
+ }
+
+ return eStatus;
+}
+
+///
+/// Abnormal monitor(common): Get lost session data
+///
+EFrameworkunifiedStatus FrameworkunifiedGetLostSessionData(HANDLE hApp, PSTR pServiceName, PUI_32 puiSessionId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) == FALSE || pServiceName == NULL || puiSessionId == NULL) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (pApp->lostSessionQueue.empty()) {
+ eStatus = eFrameworkunifiedStatusAccessError;
+ } else {
+ LostSessionInfo info = pApp->lostSessionQueue.front();
+ pApp->lostSessionQueue.pop();
+ strcpy(pServiceName, info.sServiceName.c_str()); // NOLINT (readability/nolint)
+ *puiSessionId = info.iSessionId;
+ }
+ }
+
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedDispatchProcess
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatchProcess(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ // FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "+");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ struct rusage start, end;
+ BOOL enable_rusage = NsLogIsZoneSet(ZONE_NS_DEBUG_DUMP);
+
+ if (enable_rusage == TRUE) {
+ frameworkunifiedGetRusage(&start);
+ }
+
+ if (0 != strcmp(FRAMEWORKUNIFIED_NS_NPSERVICE, pApp->cMsgSrcName)) { // < if not from NPP service
+ switch (pApp->uiProtocolCmd) {
+ case PROTOCOL_REGISTER_EVENTS: {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "%s subscribing to session event on sessionid %d",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL, pApp->uiSessionId);
+
+ eStatus = ProcessProtocolEvents(hApp);
+ }
+ break;
+
+ case PROTOCOL_UNREGISTER_EVENTS: {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "%s unsubscribing private event on sessionid %d",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL, pApp->uiSessionId);
+
+ eStatus = UnregisterPrivateEvents(hApp);
+ }
+ break;
+
+ case PROTOCOL_CLOSE_SESSION_REQ:
+ case PROTOCOL_CLOSE_SESSION_REQ_SYNC: {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "Close session request received from %s",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL);
+
+ // Handle the session events on the close session request
+ (VOID)HandleSessionEventOnCloseSession(hApp);
+
+ frameworkunifiedDelAcceptMonitor(hApp);
+
+ eStatus = FrameworkunifiedProcessServiceProtocol(hApp);
+ }
+ break;
+
+ case PROTOCOL_OPEN_SESSION_REQ:
+ case PROTOCOL_OPEN_SESSION_REQ_SYNC: {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "Open session request received from %s",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL);
+
+ eStatus = FrameworkunifiedProcessServiceProtocol(hApp);
+ if (eStatus == eFrameworkunifiedStatusOK) {
+ frameworkunifiedAddAcceptMonitor(hApp);
+ }
+ }
+ break;
+
+ default: {
+ eStatus = FrameworkunifiedProcessServiceProtocol(hApp);
+ }
+ break;
+ }
+ } else {
+ NotificationTable::iterator n_iterator;
+ FrameworkunifiedGetSystemInfo(pApp, pApp->cSystemInfo);
+ n_iterator = pApp->notifications.find(static_cast<PSTR>(pApp->cSystemInfo));
+ if (n_iterator != pApp->notifications.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, " Notification found in NS_NP :: (%s)."
+ " Processing callback function.", n_iterator->first.c_str());
+ eStatus = (*n_iterator).second(hApp);
+ } else {
+ NotificationEventTable::iterator n_iterator;
+ FrameworkunifiedGetSystemInfo(pApp, pApp->cSystemInfo);
+ n_iterator = pApp->notificationevents.find(static_cast<PSTR>(pApp->cSystemInfo));
+ if (n_iterator != pApp->notificationevents.end()) {
+ CFrameworkunifiedHSMFramework *l_pStateMachine = FrameworkunifiedGetStateMachine(hApp);
+ if (l_pStateMachine) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, " Notification found in NS_NP :: (%s)."
+ " Processing HSM event.", n_iterator->first.c_str());
+ eStatus = l_pStateMachine->FrameworkunifiedPostEvent(n_iterator->second);
+ }
+ } else {
+ /// Paul A. Dennis (FOUND BUG)
+ /// For Persistent Data NS_NP sends the data back as a normal command not via the
+ /// notification logic... The Ack's for NPReadPersistedData,NPRegisterFilePath and
+ /// NPLoadFileFromPersistentStorage were never getting back
+ /// to the requester because its's not looking in the correct location.
+ /// So, Check the Services to see if the user has defined the Ack commands via the
+ /// services map
+ eStatus = FrameworkunifiedProcessServiceProtocol(hApp);
+ }
+ }
+ }
+
+ frameworkunifiedProcessSyncResponse(hApp, eStatus);
+
+ if ((eStatus != eFrameworkunifiedStatusOK) && (eStatus != eFrameworkunifiedStatusExit) && (eStatus != eFrameworkunifiedStatusMsgNotProcessed)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error :: %d, (%s) Event Info :: (%s), (%d), (%s)",
+ eStatus,
+ pApp->cAppName != 0 ? static_cast<PSTR>(pApp->cAppName) : NULL,
+ pApp->cMsgSrcName != 0 ? static_cast<PSTR>(pApp->cMsgSrcName) : NULL,
+ pApp->uiProtocolCmd,
+ pApp->cSystemInfo != 0 ? static_cast<PSTR>(pApp->cSystemInfo) : NULL);
+ }
+
+ if (eStatus == eFrameworkunifiedStatusMsgNotProcessed) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING:: No handler found for :: "
+ "Source: %s, Protocol Command: 0x%x, Session Id: %u.",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL,
+ pApp->uiProtocolCmd, pApp->uiSessionId);
+ FrameworkunifiedClearMsgData(hApp);
+ eStatus = eFrameworkunifiedStatusOK;
+ } else {
+// FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Message processed. Status (0x%X) ::"
+// " Source: %s Command: 0x%x SessionId: %d.",
+// eStatus, pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL,
+// pApp->uiProtocolCmd, pApp->uiSessionId);
+ }
+
+ if (enable_rusage == TRUE) {
+ frameworkunifiedGetRusage(&end);
+ frameworkunifiedPrintRusage(hApp, start, end);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "-");
+ return eStatus;
+}
+
+
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedCloseDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseDispatcher(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->checkCode = 0;
+
+ if (NULL != pApp->hAppRcvMsgQ) {
+ McClose(pApp->hAppRcvMsgQ);
+ pApp->hAppRcvMsgQ = NULL;
+ }
+
+ if (pApp->siMonitorSock) {
+ mcCloseMonitor(pApp->cAppName);
+ pApp->siMonitorSock = 0;
+ }
+
+ if (NULL != pApp->hAppSndMsgQ) {
+ McClose(pApp->hAppSndMsgQ);
+ pApp->hAppSndMsgQ = NULL;
+ }
+
+ if (NULL != pApp->hNPSndMsgQ) {
+ FrameworkunifiedMcClose(pApp->hNPSndMsgQ);
+ pApp->hNPSndMsgQ = NULL;
+ }
+
+ if (NULL != pApp->hParentSndMsgQ) {
+ McClose(pApp->hParentSndMsgQ);
+ pApp->hParentSndMsgQ = NULL;
+ }
+
+ if (0 < pApp->defer_evfd) {
+ close(pApp->defer_evfd);
+ pApp->defer_evfd = 0;
+ }
+
+ if (0 < pApp->efd) {
+ close(pApp->efd);
+ pApp->efd = 0;
+ }
+
+ delete(pApp);
+ pApp = NULL; // mb20110110 Added per comment 216
+ // NOTE: However, client still needs to set his own pointer to NULL
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedPopedDeferedMessage
+//////////////////////////////////////////
+BOOL FrameworkunifiedPopedDeferedMessage(HANDLE hApp) {
+ BOOL rtnFlag = FALSE;
+
+ // LCOV_EXCL_BR_START 6:FrameworkunifiedPopedDeferedMessage is internal function, hApp is checked in extenal API
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ // LCOV_EXCL_BR_STOP
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // check if the pop flag is send and there is something to pop!
+ if (pApp->fPopDeferedMsg && !pApp->deferedMsgQueue.empty()) {
+ // get the message at the top\front of the queue
+ DeferedMsgInfo defered(pApp->deferedMsgQueue.front());
+
+ // remove this item from the queue using pop
+ pApp->deferedMsgQueue.pop();
+
+ // copy the data into the pApp
+ pApp->uiProtocolCmd = defered.uiProtocolCmd;
+ strlcpy(pApp->cMsgSrcName, defered.cMsgSrcName, sizeof(pApp->cMsgSrcName));
+ std::memcpy(pApp->uiMsgRcvBuffer, defered.uiMsgRcvBuffer, MAX_MSGQ_BUFFER);
+
+ // clear the pop flag!
+ pApp->fPopDeferedMsg = FALSE;
+
+ // set the return flag TRUE, we have pop'ed
+ rtnFlag = TRUE;
+ }
+ }
+
+ return rtnFlag;
+}
+
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatcher(PCSTR cAppName, const FrameworkunifiedDefaultCallbackHandler *CbHandler) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "In");
+ return FrameworkunifiedDispatcherWithArguments(cAppName, 0, NULL, CbHandler);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+// FrameworkunifiedDispatcherWithArguments
+// Creates, initializes and runs the dispatcher
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatcherWithArguments(PCSTR cAppName, int argc, char *argv[],
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler,
+ CustomCommandLineOptions *cmdLineOptions) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (cAppName == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ NsLogSetProcessName(cAppName);
+ PLOG_TEXT("FrameworkunifiedDispatcher Start");
+ // set main thread name as provided in dispatcher
+ pthread_setname_np(pthread_self(), cAppName);
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "In");
+
+ if ((eStatus = RegistDefaultCbHandler(CbHandler)) != eFrameworkunifiedStatusOK) {
+ return eStatus;
+ }
+
+ try {
+ HANDLE hFrameworkApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcher(cAppName, hFrameworkApp, FALSE))) {
+ // LCOV_EXCL_BR_START 6:if FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hFrameworkApp is not NULL
+ if (NULL != hFrameworkApp) {
+ // LCOV_EXCL_BR_STOP
+ THApp hApp(hFrameworkApp);
+
+ /// Parse the Arguments via the FrameworkunifiedArgumentParser
+ /// passing an handle to the app and argument list
+ eStatus = FrameworkunifiedArgumentParser(hApp, argc, argv, cmdLineOptions);
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ eStatus = FrameworkunifiedDispatcherMain(hApp);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hFrameworkApp is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcher error, status=%d", eStatus);
+ }
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedCreateDispatcher: %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+
+ return eStatus;
+}
+
+// required for parsing subargument of -r
+char *g_cPlogSubOpts[] = {
+#define PLOG_OUTPUT 0
+ const_cast<PSTR>("output"),
+ NULL
+};
+
+EFrameworkunifiedStatus FrameworkunifiedArgumentParser(HANDLE hApp, int argc, char *argv[], CustomCommandLineOptions *cmdLineOptions) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ TFrameworkunifiedZoneMask mask = {};
+ PCHAR l_cMask = NULL;
+ UI_32 l_iMaskCount = 0;
+ CHAR l_logoutput[MAX_QUEUE_NAME_SIZE];
+ CHAR l_tFilePath[MAX_PATH_LENGTH];
+
+ BOOL l_bHasConfigFilepath = FALSE;
+
+ SI_32 l_iOpt = 0;
+ SI_32 l_iPriority = 10;
+ PSTR l_cOptions;
+ PSTR l_cValue;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "In");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+#ifdef DISPATCHER_PROFILER
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+#endif
+
+ if (argc > 0 && argv != NULL) {
+ // l:m:t:c: options are reserved for NS Framework and should not be used by other FRAMEWORKUNIFIED Applications.
+ CHAR l_cNSOptions[MAX_STRING_SIZE_TAG] = {};
+
+ strncpy(l_cNSOptions, "l:m:c:p:qr:s", (MAX_STRING_SIZE_TAG - 1));
+ optind = 1;
+
+ if (NULL != cmdLineOptions) {
+ // append custom options
+ strncat(l_cNSOptions, cmdLineOptions->cShortOptions, (MAX_STRING_SIZE_TAG - strlen(l_cNSOptions) - 1));
+ }
+ while ((eFrameworkunifiedStatusOK == eStatus) && ((l_iOpt = getopt(argc, argv, l_cNSOptions)) != -1)) {
+ switch (l_iOpt) {
+ case 'm': // mask value..
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-m (mask value): %s", optarg);
+ /*
+ * @todo
+ * If the second of the command-line arguments is-m and the third is not, an exception occurs.
+ */
+ char *saveptr;
+ l_cMask = strtok_r(optarg, ",", &saveptr);
+
+ while (NULL != l_cMask) {
+ mask[l_iMaskCount++] = static_cast<TFrameworkunifiedZone>(strtoul(l_cMask, NULL, 16));
+ l_cMask = strtok_r(NULL, ",", &saveptr);
+ }
+ NsLogSetControlMask(mask);
+ break;
+ case 'l': // log output
+ strncpy(l_logoutput, optarg, (MAX_QUEUE_NAME_SIZE - 1));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-l (log output option): %s", l_logoutput);
+ NsLogSetLogMethod(NsLogDetermineLogMethod(l_logoutput));
+ break;
+ case 'c': // config file option
+ strncpy(l_tFilePath, optarg, (MAX_PATH_LENGTH - 1));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-c (set config file): %s", l_tFilePath);
+ eStatus = SetConfigHandle(hApp, l_tFilePath);
+ l_bHasConfigFilepath = TRUE;
+ break;
+ case 'p': // priority
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-p (set priority): %s", optarg);
+ if (eFrameworkunifiedStatusOK != frameworkunified::framework::CFrameworkunifiedThreadPriorities::ParseThreadArguments(optarg)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING!! Failed to parse sub arguments of -p");
+ }
+ l_iPriority = frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(FrameworkunifiedGetAppName(hApp));
+ // set only if valid prio, otherwise use the default one
+ if (FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND != l_iPriority) {
+ pthread_setschedprio(pthread_self(),
+ frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(FrameworkunifiedGetAppName(hApp)));
+ }
+ break;
+ case 'q':
+#ifdef DISPATCHER_PROFILER
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-q (set msg dispatcher profiler)");
+ FrameworkunifiedMsgProfiler::m_bMsgProfilerEnabled = TRUE;
+ pApp->m_pFrameworkunifiedMsgProfiler = new(nothrow) FrameworkunifiedMsgProfiler(FrameworkunifiedGetAppName(hApp));
+#endif
+ break;
+ case 'r':
+ NSLogEnablePLog(TRUE);
+ l_cOptions = optarg;
+ while (*l_cOptions != '\0') {
+ switch (getsubopt(&l_cOptions, g_cPlogSubOpts, &l_cValue)) {
+ case PLOG_OUTPUT: {
+ if (l_cValue != NULL) {
+ NSLogSetPlogOutputOptions(static_cast<UI_8>(strtoul(l_cValue, NULL, 16)));
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ break;
+ case 's':
+ NSLogEnableSysEventLog(TRUE);
+ break;
+ default:
+ if (NULL != cmdLineOptions) {
+ // option other than l:m:t:c: is a custom option, therefore let application handle that option.
+ if (eFrameworkunifiedStatusOK != cmdLineOptions->callback(l_iOpt, optarg)) {
+ // Do not terminate an application even if invalid arguments received
+ // eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING!! Invalid cmd line argument received.");
+ }
+ } else {
+ // Do not terminate an application even if invalid arguments received
+ // eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING!! Invalid cmd line argument received.");
+ }
+ break;
+ }
+ }
+ }
+
+ // if no config option is selected then use the default config path
+ if ((FALSE == l_bHasConfigFilepath) && (eFrameworkunifiedStatusOK == eStatus)) {
+ eStatus = SetDefaultConfigFile(hApp);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSimpleDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSimpleDispatcher(PCSTR cAppName, const FrameworkunifiedDefaultCallbackHandler *CbHandler, CbFuncPtr CbShutdown,
+ BOOL isChildThread) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ // if main thread then set log process name
+ if (!isChildThread) {
+ NsLogSetProcessName(cAppName);
+ }
+
+ if ((eStatus = RegistDefaultCbHandler(CbHandler)) != eFrameworkunifiedStatusOK) {
+ return eStatus;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "+");
+
+ if (NULL != CbShutdown) {
+ try {
+ HANDLE hFrameworkApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcher(cAppName, hFrameworkApp, isChildThread))) {
+ // LCOV_EXCL_BR_START 6:if FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hFrameworkApp is not NULL
+ if (NULL != hFrameworkApp) {
+ // LCOV_EXCL_BR_STOP
+ THApp hApp(hFrameworkApp);
+
+ // Call application defined start function
+ eStatus = FrameworkunifiedOnInitializationInternal(hApp);
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedOnInitialization failed ");
+ throw happ_error();
+ } else {
+ while (eFrameworkunifiedStatusExit != eStatus) {
+ try {
+ // dispatch block: waits on receive message
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDispatchBlock(hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: FrameworkunifiedDispatchBlock : 0x%x ", eStatus);
+ continue;
+ }
+ // dispatch process: calls respective call back functions
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDispatchProcess(hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: FrameworkunifiedDispatchProcess : 0x%x ", eStatus);
+ }
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR :: %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const std::exception &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from: %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exiting dispatcher ");
+ }
+ // Call application defined stop function
+ eStatus = CbShutdown(hApp);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "hFrameworkApp is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcher error, status=%d", eStatus);
+ }
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedCreateDispatcher ");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus RunDispatcher(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ int efd;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+#ifdef DISPATCHER_PROFILER
+ // Get the application handle
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ FrameworkunifiedAttachMsgProfilerCallbacksDispatcher(hApp);
+ }
+#endif
+ FrameworkunifiedGetDispatcherFD(hApp, &efd);
+
+ while (1) {
+ frameworkunifiedFdHandler(hApp, efd);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+EFrameworkunifiedStatus FrameworkunifiedDispatcherMain(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ try {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "Success: FrameworkunifiedCreateDispatcher ");
+
+ // Initialize the global structures
+ // register service with service dir
+ // register notifications
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization +");
+ eStatus = FrameworkunifiedOnInitializationInternal(hApp);
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization -");
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedOnInitialization failed ");
+ throw happ_error();
+ } else {
+ eStatus = RunDispatcher(hApp);
+ CFrameworkunifiedSyncData::FrameworkunifiedReleaseSyncDataInstance();
+ }
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR :: %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedCreateDispatcher ");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcherWithoutLoop(PCSTR cAppName, HANDLE &hApp, int argc, char *argv[], // NOLINT (readability/nolint)
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler,
+ BOOL bIsConnectSM, CustomCommandLineOptions *cmdLineOptions) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ THApp *l_hApp = NULL;
+
+ if (cAppName == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ NsLogSetProcessName(cAppName);
+
+ PLOG_TEXT("FrameworkunifiedDispatcher Start");
+ // set main thread name as provided in dispatcher
+ pthread_setname_np(pthread_self(), cAppName);
+
+ if ((eStatus = RegistDefaultCbHandler(CbHandler)) != eFrameworkunifiedStatusOK) {
+ return eStatus;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "In");
+
+ try {
+ HANDLE hFrameworkApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcher(cAppName, hFrameworkApp,
+ bIsConnectSM == TRUE ? FALSE : TRUE))) {
+ // LCOV_EXCL_BR_START 6:if FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hFrameworkApp is not NULL
+ if (NULL != hFrameworkApp) {
+ // LCOV_EXCL_BR_STOP
+ l_hApp = new THApp(hFrameworkApp);
+ hApp = *l_hApp;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->pRsrcMgr = reinterpret_cast<void *>(l_hApp);
+
+ eStatus = FrameworkunifiedArgumentParser(hApp, argc, argv, cmdLineOptions);
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization +");
+ eStatus = FrameworkunifiedOnInitializationInternal(hApp);
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization -");
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedOnInitialization failed ");
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcher error, status=%d", eStatus);
+ }
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedCreateDispatcher ");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedDispatchProcessWithoutLoop(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ int efd; // FD for multi waiting
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ FrameworkunifiedGetDispatcherFD(hApp, &efd);
+ eStatus = frameworkunifiedFdHandler(hApp, efd);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedDestroyDispatcherWithoutLoop(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ try {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ THApp *RsrcMgr = reinterpret_cast<THApp *>(pApp->pRsrcMgr);
+ delete RsrcMgr;
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+static EFrameworkunifiedStatus GetDispatcherMqFD(HANDLE hApp, int *fd) {
+ if (fd == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "fd is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ *fd = McGetQueueFD(pApp->hAppRcvMsgQ);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+static EFrameworkunifiedStatus CreateMultiWaitingFD(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ int efd; // FD for multi waiting
+ int q_fd; // FD for Dispatcher's message queue
+ int defer_evfd; // FD for receiving Defer events to Dispatcher
+ struct epoll_event ev; // Info struct to associate with multiwaiting FD
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // Create efd
+ efd = epoll_create1(EPOLL_CLOEXEC);
+ if (-1 != efd) {
+ pApp->efd = efd;
+
+ // get fd to Dispatcher's message queue
+ eStatus = GetDispatcherMqFD(hApp, &q_fd);
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ // efd to monitor the q_fd.
+ ev.events = EPOLLIN;
+ ev.data.fd = q_fd;
+ if (-1 == epoll_ctl(efd, EPOLL_CTL_ADD, q_fd, &ev)) {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(q_fd, ADD) Failed, "
+ "status=%d, errno=%d", eStatus, errno);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : GetDispatcherMqFD Failed, status=%d", eStatus);
+ }
+
+ // create FD for receiving Defer events to Dispatcher
+ defer_evfd = eventfd(0, EFD_CLOEXEC);
+ if (-1 != defer_evfd) {
+ pApp->defer_evfd = defer_evfd;
+
+ // efd to monitor the defer_evfd.
+ ev.events = EPOLLIN;
+ ev.data.fd = defer_evfd;
+ if (-1 == epoll_ctl(efd, EPOLL_CTL_ADD, defer_evfd, &ev)) {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(defer_evfd, ADD) Failed,"
+ " status=%d, errno=%d", eStatus, errno);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : eventfd Failed, status=%d, errno=%d", eStatus, errno);
+ }
+
+ // add abnormal monitor socket polling
+ if (-1 != pApp->siMonitorSock) {
+ ev.events = EPOLLIN;
+ ev.data.fd = pApp->siMonitorSock;
+ if (-1 == epoll_ctl(efd, EPOLL_CTL_ADD, pApp->siMonitorSock, &ev)) {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl:%s", strerror(errno));
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_create1 Failed, status=%d, errno=%d", eStatus, errno);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedGetDispatcherFD(HANDLE hApp, int *efd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (NULL != efd) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ *efd = pApp->efd;
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnInitializationInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onInitilization != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onInitilization(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDestroyInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onDestroy != NULL) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (pApp->hParentSndMsgQ == NULL) {
+ // main thread
+ try {
+ eStatus = g_defaultCallbackHandler.onDestroy(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStartInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onStart != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onStart(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStopInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onStop != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onStop(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStartInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onPreStart != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onPreStart(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStopInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onPreStop != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onPreStop(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStartInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onBackgroundStart != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onBackgroundStart(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStopInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onBackgroundStop != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onBackgroundStop(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDumpInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onDebugDump != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onDebugDump(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachineInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.createStateMachine != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.createStateMachine(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterfaceInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.ssFrameworkInterface != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.ssFrameworkInterface(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus RegistDefaultCbHandler(const FrameworkunifiedDefaultCallbackHandler *CbHandler) {
+ if (CbHandler == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ } else if (CbHandler->onInitilization == NULL || CbHandler->onDestroy == NULL || CbHandler->onStart == NULL ||
+ CbHandler->onStop == NULL
+ || CbHandler->onPreStart == NULL || CbHandler->onPreStop == NULL
+ || CbHandler->onBackgroundStart == NULL || CbHandler->onBackgroundStop == NULL
+ || CbHandler->onDebugDump == NULL || CbHandler->createStateMachine == NULL
+ || CbHandler->ssFrameworkInterface == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " [ ABORT ] DefaultCallbackHandler is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ g_defaultCallbackHandler = *CbHandler;
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedGetDefaultCbHandler(FrameworkunifiedDefaultCallbackHandler *CbHandler) {
+ if (CbHandler == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ *CbHandler = g_defaultCallbackHandler;
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus frameworkunifiedFdHandler(HANDLE hApp , int efd) {
+ struct epoll_event events[MAX_FD_MULTIWAITING];
+ int nfds; // The number of events received
+ int q_fd; // The FD of events received
+ int n; // Loop counter
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ const char *key;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ eStatus = GetDispatcherMqFD(hApp, &q_fd);
+ // LCOV_EXCL_BR_START 6:Because of hApp is valid, GetDispatcherMqFD return eFrameworkunifiedStatusOK.
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ // LCOV_EXCL_BR_STOP
+ nfds = epoll_wait(efd, events, MAX_FD_MULTIWAITING, -1);
+ if (-1 != nfds) {
+ for (n = 0; n < nfds; ++n) {
+ if (pApp->siMonitorSock == events[n].data.fd) {
+ // abnormal monitor connect request
+ int socket;
+
+ if ((socket = mcAcceptMonitor(pApp->cAppName, pApp->siMonitorSock)) >= 0) {
+ struct epoll_event event;
+
+ event.events = EPOLLRDHUP;
+ event.data.fd = socket;
+
+ if (epoll_ctl(pApp->efd, EPOLL_CTL_ADD, socket, &event) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl:%s", strerror(errno));
+ }
+ }
+ }
+ }
+
+ for (n = 0; n < nfds; ++n) {
+ // The branch processing by FD on which the message was received
+ if (q_fd == events[n].data.fd) {
+ // process the message to the Dispatcher's message queue
+ eStatus = ProcessMq(hApp);
+ } else if (pApp->defer_evfd == events[n].data.fd) {
+ // process the Defer event to the Dispatcher
+ uint64_t data;
+ ssize_t len;
+
+ len = read(pApp->defer_evfd, &data, sizeof(uint64_t));
+ if (len < 0) {
+ // read error
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : read Failed, status=%d, errno=%d, defer_evfd=%d",
+ eStatus, errno, pApp->defer_evfd);
+ } else {
+ while (TRUE == (FrameworkunifiedPopedDeferedMessage(hApp))) {
+ try {
+ // dispatch process: calls respective call back functions
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDispatchProcess(hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : FrameworkunifiedDispatchProcess Status : 0x%x", eStatus);
+ }
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const std::exception &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from : %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ }
+ } else if (pApp->siMonitorSock == events[n].data.fd) {
+ // do nothing
+ } else if (frameworkunifiedSearchResourseKey(FRAMEWORKUNIFIED_RES_ABNMLMON, events[n].data.fd, &key) == 0) {
+ if (pApp->acceptMonitorTable.find(events[n].data.fd) != pApp->acceptMonitorTable.end()) {
+ // server: accept socket close
+ eStatus = frameworkunifiedProcessClientAbnormalState(hApp, events[n].data.fd);
+ } else if (pApp->connectMonitorTable.find(events[n].data.fd) != pApp->connectMonitorTable.end()) {
+ // client: connect socket close
+ eStatus = frameworkunifiedProcessServerAbnormalState(hApp, events[n].data.fd);
+ }
+
+ if (epoll_ctl(pApp->efd, EPOLL_CTL_DEL, events[n].data.fd, NULL) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl:%s", strerror(errno));
+ }
+ close(events[n].data.fd);
+ frameworkunifiedUnregistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, key);
+ } else {
+ // process the message to the FD set by the user
+ eStatus = ProcessFd(hApp, events[n].data.fd);
+ }
+ }
+ } else {
+ if (errno == EINTR) {
+ // signal interrupt
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_wait Failed, status=%d, errno=%d", eStatus, errno);
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6:Because of hApp is valid, GetDispatcherMqFD return eFrameworkunifiedStatusOK.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : GetDispatcherMqFD Failed, status=%d", eStatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+static EFrameworkunifiedStatus ProcessMq(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+#ifdef DISPATCHER_PROFILER
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+#endif
+
+ // handle defer'ed message
+ if (FALSE == FrameworkunifiedPopedDeferedMessage(hApp)) {
+ // dispatch block: waits on receive message
+ if ((eStatus = FrameworkunifiedDispatchBlock(hApp)) != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : FrameworkunifiedDispatchBlock Status : 0x%x", eStatus);
+ }
+ #ifdef DISPATCHER_PROFILER
+ else if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) { // NOLINT (readability/nolint)
+ pApp->m_pFrameworkunifiedMsgProfiler->MsgReceived();
+ }
+ #endif
+ }
+ try {
+ // dispatch process: calls respective call back functions
+ eStatus = FrameworkunifiedDispatchProcess(hApp);
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const std::exception &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from : %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+#ifdef DISPATCHER_PROFILER
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ pApp->m_pFrameworkunifiedMsgProfiler->MsgProcessed();
+ }
+#endif
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+static EFrameworkunifiedStatus ProcessFd(HANDLE hApp , int fd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ FdTable::iterator f_iterator;
+ struct rusage start, end;
+ BOOL enable_rusage = NsLogIsZoneSet(ZONE_NS_DEBUG_DUMP);
+
+ if (enable_rusage == TRUE) {
+ frameworkunifiedGetRusage(&start);
+ }
+
+ // finding callback func associated with FD
+ f_iterator = pApp->fds.find(fd);
+ if (f_iterator != pApp->fds.end()) {
+ try {
+ // calling func associated with FD
+ eStatus = (*f_iterator).second(hApp);
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR :: %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const std::exception &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from: %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Callback associated with FD is not found. ", eStatus);
+ }
+
+ if (enable_rusage == TRUE) {
+ frameworkunifiedGetRusage(&end);
+ frameworkunifiedPrintRusage(hApp, start, end);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////////
+/// EFrameworkunifiedStatus SetConfigHandle(HANDLE hApp, PCHAR sFilePath )
+/// This Function opens the file from give path and sets the file handle in hApp
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetConfigHandle(HANDLE hApp, PCHAR sFilePath) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __PRETTY_FUNCTION__, "This function is not implemented");
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////////
+/// EFrameworkunifiedStatus SetDefaultFilePath(HANDLE hApp)
+/// This Function fetches the file path from Environment variable from PASA_APPCONFIG_FILES and
+/// pass it to the SetConfigHandle function
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetDefaultConfigFile(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ // Get the file path from environment variable
+ PCHAR l_strEnvValue = getenv(PASA_APPCONFIG_FILES);
+
+ if (l_strEnvValue) {
+ // FRAMEWORKUNIFIEDLOG( ZONE_NS_DIS, __FUNCTION__, "Configuration file path %s ",l_strEnvValue);
+
+ std::string l_strFilePath(l_strEnvValue);
+
+ if (!l_strFilePath.empty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Configuration file path %s ", l_strFilePath.c_str());
+ // Open the configuration file
+ SetConfigHandle(hApp, (PCHAR)l_strFilePath.c_str());
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocolHSMEvent(HANDLE hApp, PCSTR pRequester) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ EventServices::iterator s_iterator;
+
+ // finding the service
+ s_iterator = pApp->eventservices.find(pRequester);
+ if (s_iterator != pApp->eventservices.end()) {
+ EventSessionTable::iterator session_iterator;
+ session_iterator = (s_iterator->second).find(pApp->uiSessionId);
+ if (session_iterator != (s_iterator->second).end()) {
+ ServiceEventProtocolTable::iterator spt_iterator;
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, " %s found :: (%s) ", pApp->cMsgSrcName, s_iterator->second);
+
+ // find the protocol req/ack handler
+ spt_iterator = (session_iterator->second).find(pApp->uiProtocolCmd);
+ if (spt_iterator != (session_iterator->second).end()) {
+ // FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, " Protocol Command :: (0x%x) ", pApp->uiProtocolCmd);
+ // Post corresponding event
+ CFrameworkunifiedHSMFramework *l_pStateMachine = FrameworkunifiedGetStateMachine(hApp);
+ if (l_pStateMachine) {
+ eStatus = l_pStateMachine->FrameworkunifiedPostEvent(spt_iterator->second);
+ }
+ } else if ((session_iterator->second).end() != (spt_iterator =
+ (session_iterator->second).find(FRAMEWORKUNIFIED_ANY_COMMAND))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Processing HSM event for (FRAMEWORKUNIFIED_ANY_COMMAND). "
+ "Dispatcher protocol command: (0x%x)",
+ pApp->uiProtocolCmd);
+ // Post corresponding event
+ CFrameworkunifiedHSMFramework *l_pStateMachine = FrameworkunifiedGetStateMachine(hApp);
+ if (l_pStateMachine) {
+ eStatus = l_pStateMachine->FrameworkunifiedPostEvent(spt_iterator->second);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+
+ // if FrameworkunifiedPostEvent returns NULL
+ if (eFrameworkunifiedStatusNullPointer == eStatus) {
+ eStatus = eFrameworkunifiedStatusExit;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : ProcessProtocolEvents
+//////////////////////////////////////////
+EFrameworkunifiedStatus ProcessProtocolEvents(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // common event table iterator
+ EventTable::iterator e_iterator;
+ ServiceSessionIdListTable::iterator ssidl_iterator;
+
+ // public state event table iterator
+ PublicStateEventTable::iterator se_iterator;
+
+ // private state event table iterator
+ PrivateStateEventTable::iterator pse_iterator;
+ ServiceSessionEventData::iterator ssed_iterator;
+ SessionEventData::iterator sed_iterator;
+
+ HANDLE l_pClientHandle = NULL;
+
+ // get the name of the service from which message is received
+ PCSTR l_cServiceName = pApp->cMsgSrcName;
+ const UI_32 l_uiSessionId = pApp->uiSessionId;
+
+ // number of events to register
+ UI_32 l_uiListSize = static_cast<UI_32>(FrameworkunifiedGetMsgLength(hApp) / sizeof(UI_32));
+
+ // check if the received service name and data is valid
+ if (NULL != l_cServiceName && 0 < l_uiListSize) {
+ PUI_32 l_pData = new UI_32[l_uiListSize];
+ UI_32 l_uiEventId = 0;
+
+ // get the list of events
+ eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, l_pData, static_cast<UI_32>(l_uiListSize * sizeof(UI_32)));
+
+ if (NULL != l_pData && eFrameworkunifiedStatusOK == eStatus) {
+ for (UI_32 uiCount = 0; uiCount < l_uiListSize; uiCount++) {
+ // received event id
+ l_uiEventId = l_pData[uiCount];
+
+ // find the event in map of EventTable
+ e_iterator = pApp->eventtable.find(l_uiEventId);
+
+ // if event is registered by any of the clients
+ if (pApp->eventtable.end() != e_iterator) {
+ // table of services with list of their session id's registering this event
+ ServiceSessionIdListTable &l_mServiceSessionIdListTable = e_iterator->second;
+
+ // find the service name in map of ServiceSessionIdListTable
+ ssidl_iterator = l_mServiceSessionIdListTable.find(l_cServiceName);
+
+ // if service have already registered this event with any of its session
+ if (l_mServiceSessionIdListTable.end() != ssidl_iterator) {
+ // list of sessions id's registering with this event
+ SessionIdList &l_vSessionIdList = ssidl_iterator->second;
+
+ // event is registered with this session
+ if (IsEventAlreadyRegistered(l_vSessionIdList, l_uiSessionId)) {
+ // get the message queue handle from map servicesessionhandletable
+ l_pClientHandle = GetMsgQueueHandle(hApp, l_cServiceName, l_uiSessionId);
+ } else { // event is not registered with this session
+ // create new message queue handle and insert it in map servicesessionhandletable
+ l_pClientHandle = GetNewHandleAndUpdateEventInfoTable(hApp,
+ l_cServiceName, l_uiSessionId, l_uiEventId);
+
+ // insert the current session id
+ l_vSessionIdList.push_back(l_uiSessionId);
+ }
+ } else { // if service have not registered this event with any of its session
+ // create a list for storing session id's registering this event for this service
+ SessionIdList l_vSessionIdList;
+
+ // insert the current session id
+ l_vSessionIdList.push_back(l_uiSessionId);
+
+ // create new message queue handle and insert it in map servicesessionhandletable
+ l_pClientHandle = GetNewHandleAndUpdateEventInfoTable(hApp, l_cServiceName, l_uiSessionId, l_uiEventId);
+
+ // make a entry for service name and session id's list in map of ServiceSessionIdListTable
+ l_mServiceSessionIdListTable.insert(make_pair(l_cServiceName, l_vSessionIdList));
+ }
+ } else { // if event is not registered by any of the clients
+ // create a list for storing session id's registering this event for this service
+ SessionIdList l_vSessionIdList;
+
+ // insert the current session id
+ l_vSessionIdList.push_back(l_uiSessionId);
+
+ // create new message queue handle and insert it in map servicesessionhandletable
+ l_pClientHandle = GetNewHandleAndUpdateEventInfoTable(hApp, l_cServiceName, l_uiSessionId, l_uiEventId);
+
+ // create a table for storing services and its session id list, registering this event
+ ServiceSessionIdListTable l_mServiceSessionIdListTable;
+
+ // make a entry for service name and session id's list in map of ServiceSessionIdListTable
+ l_mServiceSessionIdListTable.insert(make_pair(l_cServiceName, l_vSessionIdList));
+
+ // insert the table with event id in EventTable
+ pApp->eventtable.insert(make_pair(l_uiEventId, l_mServiceSessionIdListTable));
+ }
+
+ // check whether event is defined as public state event
+ se_iterator = pApp->publicstateeventtable.find(l_uiEventId);
+
+ // if event is a state event, publish the event
+ if (pApp->publicstateeventtable.end() != se_iterator) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "%d is a public state event", l_uiEventId);
+
+ if (NULL != (se_iterator->second)) {
+ // send the event data for state event
+ eStatus = FrameworkunifiedSendMsg(l_pClientHandle,
+ l_uiEventId,
+ (se_iterator->second)->uiLength,
+ (se_iterator->second)->pData);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Sending event:%d to service:%s, session:%d, status:%d",
+ l_uiEventId,
+ l_cServiceName,
+ l_uiSessionId,
+ eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event %d yet not published ", l_uiEventId);
+ }
+ } else { // check whether the event is defined as private state event
+ pse_iterator = pApp->privatestateeventtable.find(l_uiEventId);
+
+ // if event found, publish the event
+ if (pApp->privatestateeventtable.end() != pse_iterator) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "%d is a private state event", l_uiEventId);
+
+ ssed_iterator = (pse_iterator->second).find(l_cServiceName);
+
+ // check whether the event had been published for this service before subscription
+ if ((pse_iterator->second).end() != ssed_iterator) {
+ sed_iterator = (ssed_iterator->second).find(l_uiSessionId);
+
+ // check whether the event had been published for this service for the same session
+ if ((ssed_iterator->second).end() != sed_iterator) {
+ if (NULL != (sed_iterator->second)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%d had been published for the "
+ "service:%s on sessionId:%d ", l_uiEventId,
+ l_cServiceName, l_uiSessionId);
+
+ // send the event data for state event
+ eStatus = FrameworkunifiedSendMsg(l_pClientHandle,
+ l_uiEventId,
+ (sed_iterator->second)->uiLength,
+ (sed_iterator->second)->pData);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Sending event:%d to service:%s, session:%d, status:%d",
+ l_uiEventId,
+ l_cServiceName,
+ l_uiSessionId,
+ eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event %d yet not published ", l_uiEventId);
+ }
+ }
+ }
+ }
+ }
+ } // end of for loop of events list
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, PROTOCOL_REGISTER_EVENTS Invalid data ", eStatus);
+ }
+
+ if (NULL != l_pData) {
+ delete[] l_pData;
+ l_pData = NULL;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, PROTOCOL_REGISTER_EVENTS Service Name invalid ", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : IsEventAlreadyRegistered
+//////////////////////////////////////////
+BOOL IsEventAlreadyRegistered(const SessionIdList &vSessionIdList, const UI_32 uiSessionId) {
+ for (UI_32 uiCount = 0; uiCount < vSessionIdList.size(); uiCount++) {
+ if (uiSessionId == vSessionIdList[uiCount]) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+//////////////////////////////////////////
+// Function : GetMsgQueueHandle
+//////////////////////////////////////////
+HANDLE GetMsgQueueHandle(HANDLE hApp, PCSTR serviceName, const UI_32 uiSessionId) {
+ HANDLE l_pClientHandle = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ ServiceSessionHandleTable::iterator ssh_iterator;;
+ SessionToEventInfo::iterator sh_iterator;
+
+ // find the service name
+ ssh_iterator = pApp->servicesessionhandletable.find(serviceName);
+
+ if (pApp->servicesessionhandletable.end() != ssh_iterator) {
+ // search for session id
+ sh_iterator = ssh_iterator->second.find(uiSessionId);
+
+ if (ssh_iterator->second.end() != sh_iterator) {
+ SessionEventInfo *l_ptSessionEventInfo = sh_iterator->second;
+ if (NULL != l_ptSessionEventInfo) {
+ l_pClientHandle = l_ptSessionEventInfo->m_hSession;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Handle found for service: %s, session: %d, handle:%p.",
+ serviceName, uiSessionId, l_pClientHandle);
+ }
+ }
+ }
+ }
+
+ if (NULL == l_pClientHandle) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Handle NULL for service: %s, session: %d.",
+ serviceName != 0 ? serviceName : NULL, uiSessionId);
+ }
+
+ return l_pClientHandle;
+}
+
+//////////////////////////////////////////
+// Function : GetNewHandleAndUpdateEventInfoTable
+//////////////////////////////////////////
+HANDLE GetNewHandleAndUpdateEventInfoTable(HANDLE hApp, PCSTR serviceName, const UI_32 uiSessionId,
+ const UI_32 uiEventId) {
+ HANDLE l_pClientHandle = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ ServiceSessionHandleTable::iterator ssh_iterator;;
+ SessionToEventInfo::iterator sh_iterator;
+
+ ssh_iterator = pApp->servicesessionhandletable.find(serviceName);
+
+ if (pApp->servicesessionhandletable.end() == ssh_iterator) {
+ SessionToEventInfo l_mSessionToEventInfoTable;
+ pApp->servicesessionhandletable.insert(make_pair(serviceName, l_mSessionToEventInfoTable));
+ }
+
+ sh_iterator = pApp->servicesessionhandletable[serviceName].find(uiSessionId);
+
+ if (pApp->servicesessionhandletable[serviceName].end() == sh_iterator) {
+ l_pClientHandle = FrameworkunifiedMcOpenSender(hApp, serviceName);
+ if (NULL != l_pClientHandle) {
+ (reinterpret_cast<MsgQInfo *>(l_pClientHandle))->sessionId = uiSessionId;
+ }
+ SessionEventInfo *l_ptSessionEventInfo = new(std::nothrow) SessionEventInfo;
+ if (NULL != l_ptSessionEventInfo) { // LCOV_EXCL_BR_LINE 5: new's error case.
+ l_ptSessionEventInfo->m_hSession = l_pClientHandle;
+ l_ptSessionEventInfo->m_vEvents.push_back(uiEventId);
+ pApp->servicesessionhandletable[serviceName].insert(std::make_pair(uiSessionId, l_ptSessionEventInfo));
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error(NULL) createing new session event info for "
+ "service:%s, session:%d, event:%d.",
+ serviceName, uiSessionId, uiEventId);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ SessionEventInfo *l_ptSessionEventInfo = sh_iterator->second;
+ if (NULL != l_ptSessionEventInfo) {
+ if (NULL == l_ptSessionEventInfo->m_hSession) {
+ l_ptSessionEventInfo->m_hSession = FrameworkunifiedMcOpenSender(hApp, serviceName);
+ if (NULL != l_ptSessionEventInfo->m_hSession) {
+ (reinterpret_cast<MsgQInfo *>(l_ptSessionEventInfo->m_hSession))->sessionId = uiSessionId;
+ }
+ }
+ l_pClientHandle = l_ptSessionEventInfo->m_hSession;
+ l_ptSessionEventInfo->m_vEvents.push_back(uiEventId);
+ }
+ }
+ }
+ return l_pClientHandle;
+}
+
+//////////////////////////////////////////
+// Function : UnregisterPrivateEvents
+//////////////////////////////////////////
+EFrameworkunifiedStatus UnregisterPrivateEvents(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // get the name of the service from which message is received
+ PCSTR l_cServiceName = pApp->cMsgSrcName;
+ const UI_32 l_uiSessionId = pApp->uiSessionId;
+
+ // number of events to unregister
+ UI_32 l_uiListSize = static_cast<UI_32>(FrameworkunifiedGetMsgLength(hApp) / sizeof(UI_32));
+
+ // check if the received service name and data is valid
+ if (NULL != l_cServiceName && 0 < l_uiListSize) {
+ PUI_32 l_pData = new(std::nothrow) UI_32[l_uiListSize];
+ UI_32 l_uiEventId = 0;
+
+ if (NULL != l_pData) { // LCOV_EXCL_BR_LINE 5: new's error case.
+ // get the list of events
+ eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, l_pData, static_cast<UI_32>(l_uiListSize * sizeof(UI_32)));
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ for (UI_32 uiCount = 0; uiCount < l_uiListSize; uiCount++) {
+ // received event id
+ l_uiEventId = l_pData[uiCount];
+
+ // remove the entry from map of Events and Session id's of services
+ eStatus = RemoveEventEntryFromEventTable(hApp, l_uiEventId, l_cServiceName, l_uiSessionId);
+ (VOID)RemoveEntryFromSessionEventInfoTable(hApp, l_cServiceName, l_uiSessionId, l_uiEventId);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, PROTOCOL_REGISTER_EVENTS Invalid data ", eStatus);
+ }
+ delete[] l_pData;
+ l_pData = NULL;
+ } else {
+ // LCOV_EXCL_START 5: new's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: PROTOCOL_UNREGISTER_EVENTS: "
+ "Unable to allocate memory for l_pData");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, PROTOCOL_UNREGISTER_EVENTS Service Name invalid ", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : HandleSessionEventOnCloseSession
+//////////////////////////////////////////
+EFrameworkunifiedStatus HandleSessionEventOnCloseSession(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ // close session request structure
+ CloseSessionReq tClose = {};
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(tClose)) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tClose, sizeof(tClose)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, FrameworkunifiedGetMsgDataOfSize Failed ", eStatus);
+ } else {
+ CleanAllEventsOfSession(hApp, pApp->cMsgSrcName, tClose.sessionId);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid data length received:: Expected: %ld, Received: %d",
+ static_cast<long int>(sizeof(tClose)), FrameworkunifiedGetMsgLength(hApp)); // NOLINT (readability/nolint)
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid application handle status.");
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnDummy
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDummy(HANDLE hApp) {
+ return eFrameworkunifiedStatusOK;
+}
+
+#ifdef DISPATCHER_PROFILER
+EFrameworkunifiedStatus FrameworkunifiedAttachMsgProfilerCallbacksDispatcher(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp,
+ "NSProfileUtil",
+ PROTOCOL_DIS_MSGPROFILER,
+ boost::bind(&FrameworkunifiedMsgProfiler::PrintProfileInfo,
+ pApp->m_pFrameworkunifiedMsgProfiler, hApp));
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, "", "FrameworkunifiedAttachCallbackToDispatcher success for PROTOCOL_DIS_MSGPROFILER.");
+ }
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedAttachChildMsgProfilerCallbacksDispatcher(HANDLE hChildApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, "", "+");
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hChildApp);
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ eStatus = FrameworkunifiedAttachCallbackToDispatcher(hChildApp,
+ pApp->cParentAppName,
+ PROTOCOL_DIS_MSGPROFILER,
+ boost::bind(&FrameworkunifiedMsgProfiler::PrintProfileInfo,
+ pApp->m_pFrameworkunifiedMsgProfiler, hChildApp));
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, "", "FrameworkunifiedAttachCallbackToDispatcher success for PROTOCOL_DIS_MSGPROFILER.");
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, "", "-");
+ return eStatus;
+}
+#endif
+// EOF
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp
new file mode 100755
index 0000000..cb573c9
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp
@@ -0,0 +1,983 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <sys/epoll.h>
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_plogger_if.h>
+#include <other_service/strlcpy.h>
+
+#include <map>
+#include <utility>
+
+#include "frameworkunified_framework_core.h"
+///////////////////////////////////////////////////
+// Utility
+///////////////////////////////////////////////////
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetAppName
+//////////////////////////////////////////
+PCSTR FrameworkunifiedGetAppName(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ const CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return ((PCSTR)pApp->cAppName);
+ } else {
+ return NULL;
+ }
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSetThreadSpecificData
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetThreadSpecificData(HANDLE hApp, PVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->FrameworkData = data;
+
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetThreadSpecificData
+//////////////////////////////////////////
+PVOID FrameworkunifiedGetThreadSpecificData(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ const CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+ return pApp->FrameworkData;
+ } else {
+ return NULL;
+ }
+}
+
+
+
+template <typename K, typename V, class C, class A>
+std::ostream &operator<< (std::ostream &os, std::map<K, V, C, A> const &m) {
+ os << "{ ";
+ typename std::map<K, V, C, A>::const_iterator p;
+ for (p = m.begin(); p != m.end(); ++p) {
+ os << p->first << ":" << p->second << ", ";
+ }
+ return os << "}";
+}
+
+
+
+
+
+
+
+///////////////////////////////////////////////////
+// Service Protocol attach/detach to dispatcher
+///////////////////////////////////////////////////
+
+
+
+
+
+
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachCallbacksToDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbacksToDispatcher(HANDLE hApp, PCSTR pServiceName, const FrameworkunifiedProtocolCallbackHandler *handlers,
+ UI_32 handlerCount, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName && NULL != handlers && 0 != handlerCount) {
+ // setup callbacks
+ for (UI_32 i = 0; i < handlerCount; ++i) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, pServiceName, handlers[ i ].iCmd,
+ handlers[ i ].callBack, hSession))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+/////////////////////////////////////////////
+// Function : FrameworkunifiedAttachCallbackToDispatcher
+/////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbackToDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, CbFuncPtr fpOnCmd,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName && NULL != fpOnCmd) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ Services::iterator s_iterator;
+ SessionTable::iterator session_iterator;
+
+ UI_32 uiSessionId = 0;
+ if (hSession) {
+ uiSessionId = FrameworkunifiedGetSessionId(hSession);
+ }
+
+ // finding the service
+ s_iterator = pApp->services.find(pServiceName);
+ if (s_iterator == pApp->services.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (New service entry): service name [%s]", pApp->cAppName, pServiceName);
+ s_iterator = pApp->services.insert(std::make_pair(pServiceName, SessionTable())).first;
+ }
+
+ session_iterator = s_iterator->second.find(uiSessionId);
+ if (session_iterator == s_iterator->second.end()) {
+ session_iterator = s_iterator->second.insert(std::make_pair(uiSessionId, ServiceProtocolTable())).first;
+ }
+
+ session_iterator->second.insert(std::make_pair(iCmd, fpOnCmd));
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachCallbacksToDispatcherWithFd
+///////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbacksToDispatcherWithFd(HANDLE hApp, const FrameworkunifiedFdProtocolCallbackHandler *handlers,
+ UI_32 handlerCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != handlers && 0 != handlerCount) {
+ // setup callbacksWithFd
+ for (UI_32 i = 0; i < handlerCount; ++i) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachCallbackToDispatcherWithFd(hApp, handlers[ i ].fd,
+ handlers[ i ].callBack))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : %d, Invalid param ", eStatus);
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachCallbackToDispatcherWithFd
+///////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbackToDispatcherWithFd(HANDLE hApp, int fd, CbFuncPtr fpOnCmd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ int efd; // FD for multi waiting
+ struct epoll_event ev; // Info struct to associate with multiwaiting FD
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && 0 < fd && NULL != fpOnCmd) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // attach callbackFuncPtr and FD to FdTable.
+ pApp->fds.insert(std::make_pair(fd, fpOnCmd));
+
+ // Monitor FD by epoll.
+ efd = pApp->efd;
+ if (0 < efd) {
+ ev.events = EPOLLIN;
+ ev.data.fd = fd;
+ if (-1 == epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ev)) {
+ /**
+ * Duplicate registering the same FD in the Dispatcher causes an internal epoll_ctl errno EEXIST(val17) to be returned, which results in an error.
+ */
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(ADD) Failed, status=%d, errno=%d", eStatus, errno);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Multi waiting FD is Invalid , status=%d, efd=%d", eStatus, efd);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : %d, Invalid param ", eStatus);
+ }
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachParentCallbacksToDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachParentCallbacksToDispatcher(HANDLE hChildApp, const FrameworkunifiedProtocolCallbackHandler *handlers,
+ UI_32 handlerCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hChildApp) && NULL != handlers && 0 != handlerCount) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hChildApp);
+
+ eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hChildApp, pApp->cParentAppName, handlers, handlerCount);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachParentCallbacksFromDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachParentCallbacksFromDispatcher(HANDLE hChildApp, const PUI_32 puiCmdArray, UI_32 uiCommandCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hChildApp) && NULL != puiCmdArray && 0 != uiCommandCount) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hChildApp);
+
+ eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hChildApp, pApp->cParentAppName, puiCmdArray, uiCommandCount);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachCallbacksFromDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbacksFromDispatcher(HANDLE hApp, PCSTR pServiceName, const PUI_32 puiCmdArray,
+ UI_32 uiCommandCount, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName && NULL != puiCmdArray && 0 != uiCommandCount) {
+ // setup callbacks
+ for (UI_32 i = 0; i < uiCommandCount; ++i) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(hApp, pServiceName,
+ puiCmdArray[ i ], hSession))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+
+////////////////////////////////////////////
+// Function : FrameworkunifiedDetachCallbackFromDispatcher
+/////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbackFromDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ Services::iterator s_iterator;
+
+ UI_32 uiSessionId = 0;
+ if (hSession) {
+ uiSessionId = FrameworkunifiedGetSessionId(hSession);
+ }
+
+ // finding the service
+ s_iterator = pApp->services.find(pServiceName);
+ if (s_iterator != pApp->services.end()) {
+ SessionTable::iterator session_iterator;
+ session_iterator = (s_iterator->second).find(uiSessionId);
+ if (session_iterator != (s_iterator->second).end()) {
+ ServiceProtocolTable::iterator spt_iterator;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (found): service [%s]", pApp->cAppName, pServiceName);
+
+ spt_iterator = (session_iterator->second).find(iCmd);
+ if (spt_iterator != (session_iterator->second).end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : Detaching command [0x%X] service [%s]",
+ pApp->cAppName, iCmd, pServiceName);
+ (session_iterator->second).erase(spt_iterator);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "%s : Warning : Cmd NOT found [%d] service [%s]",
+ pApp->cAppName, iCmd, pServiceName);
+ }
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "%s : Warning : Cannot find service [%s]", pApp->cAppName, pServiceName);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachCallbacksFromDispatcherWithFd
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbacksFromDispatcherWithFd(HANDLE hApp, const int *fdArray, UI_32 uiCommandCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != fdArray && 0 != uiCommandCount) {
+ // setup callbacks
+ for (UI_32 i = 0; i < uiCommandCount; ++i) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbackFromDispatcherWithFd(hApp, fdArray[ i ]))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : %d, Invalid param ", eStatus);
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachCallbackFromDispatcherWithFd
+////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbackFromDispatcherWithFd(HANDLE hApp, int fd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && 0 < fd) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ FdTable::iterator f_iterator;
+ int efd; // FD for multi waiting
+ struct epoll_event ev; // Info struct to associate with multiwaiting FD
+
+ // finding the FD from FD table
+ f_iterator = pApp->fds.find(fd);
+ if (f_iterator != pApp->fds.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : Detaching fd [0x%x]", pApp->cAppName, fd);
+ pApp->fds.erase(f_iterator);
+
+ // Remove the monitoring of FD from multi waiting FD
+ efd = pApp->efd;
+ if (0 < efd) {
+ ev.events = EPOLLIN;
+ ev.data.fd = fd;
+ if (-1 == epoll_ctl(efd, EPOLL_CTL_DEL, fd, &ev)) {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(DEL) Failed, status=%d, errno=%d", eStatus, errno);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Multi waiting FD is Invalid , status=%d, efd=%d", eStatus, efd);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "%s : Warning : Cannot find fd [0x%x]", pApp->cAppName, fd);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, Invalid param ", eStatus);
+ }
+
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachServiceFromDispatcher
+///////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachServiceFromDispatcher(HANDLE hApp, PCSTR pServiceName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ Services::iterator s_iterator;
+ EventServices::iterator es_iterator;
+
+ // finding the service
+ s_iterator = pApp->services.find(pServiceName);
+ if (s_iterator != pApp->services.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (found): service [%s]", pApp->cAppName, pServiceName);
+ pApp->services.erase(s_iterator);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "%s : Warning: Cannot find service [%s]", pApp->cAppName, pServiceName);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ // finding the service
+ es_iterator = pApp->eventservices.find(pServiceName);
+ if (es_iterator != pApp->eventservices.end()) {
+ eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (found): service [%s] in event map", pApp->cAppName, pServiceName);
+ pApp->eventservices.erase(es_iterator);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "%s : Warning : Cannot find service [%s] in event map",
+ pApp->cAppName, pServiceName);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////
+// Notification functions
+///////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachNotificationCallbacksToDispatcher
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationsWithCallback(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pNtfyHandler,
+ UI_32 uiHandlerCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNtfyHandler && (uiHandlerCount > 0)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ /// Deal with handling batch processing of subscriptions.
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPSubscribeToNotifications(hApp, pNtfyHandler, uiHandlerCount))) {
+ for (UI_32 i = 0; i < uiHandlerCount; ++i) {
+ // Notification names are character arrays of the MAX_STRING_SIZE_NOTIFICATION byte
+ // If there are no NULL characters in the array of Notification names, they will overrun during make_pair,
+ // so use a strlcpy that substitutes a trailing NULL character.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNtfyHandler[ i ].cNotification, MAX_STRING_SIZE_NOTIFICATION);
+ // service found
+ pApp->notifications.insert(std::make_pair(tmp_notification, pNtfyHandler[ i ].callBack));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : attaching call-back for notification [%s]", pApp->cAppName,
+ pNtfyHandler[ i ].cNotification);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to Subscribe to batch set of notifications",
+ pApp->cAppName, eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachNotificationCallbackToDispatcher
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationWithCallback(HANDLE hApp, PCSTR pNotification, CbFuncPtr fpOnCmd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification && NULL != fpOnCmd) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ NotificationTableRetStatus mRet;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPSubscribeToNotification(hApp, pNotification))) {
+ // Notification names are character arrays of the MAX_STRING_SIZE_NOTIFICATION byte
+ // If there are no NULL characters in the array of Notification names, they will overrun during make_pair,
+ // so use a strlcpy that substitutes a trailing NULL character.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNotification, MAX_STRING_SIZE_NOTIFICATION);
+
+ // service found
+ mRet = pApp->notifications.insert(std::make_pair(tmp_notification, fpOnCmd));
+ if (false == mRet.second) {
+ eStatus = eFrameworkunifiedStatusDuplicate;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s:Error:[%d] Unable to Subscribe to notification [%s]",
+ pApp->cAppName, eStatus, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s:attaching call-back for notification [%s]",
+ pApp->cAppName, pNotification);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s:Error:[%d] Unable to Subscribe to notification [%s]",
+ pApp->cAppName, eStatus, pNotification);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachNotificationCallbacksFromDispatcher
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationsWithCallback(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pNtfyHandler,
+ UI_32 uiHandlerCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ NotificationTable::iterator n_iterator;
+ PCSTR pNotification = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNtfyHandler && (uiHandlerCount > 0)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPUnsubscribeFromNotifications(hApp, pNtfyHandler, uiHandlerCount))) {
+ for (UI_32 l_unCount = 0; l_unCount < uiHandlerCount; ++l_unCount) {
+ // When registering using FrameworkunifiedSubscribeNotificationWithCallback, etc., the Nortification names NULL the 64th byte.
+ // In response to this, the UnRegister uses a strlcpy that puts a NULL in the 64th byte.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNtfyHandler[ l_unCount ].cNotification, MAX_STRING_SIZE_NOTIFICATION);
+
+ n_iterator = pApp->notifications.find(tmp_notification);
+ if (n_iterator != pApp->notifications.end()) {
+ pApp->notifications.erase(n_iterator);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : removed notification [%s]", pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : Cannot find notification [%s]", pApp->cAppName,
+ pNotification != 0 ? pNotification : NULL);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : detaching call-back for notification [%s]", pApp->cAppName,
+ pNotification != 0 ? pNotification : NULL);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to UnSubscribe from notifications ", pApp->cAppName,
+ eFrameworkunifiedStatusOK);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachNotificationCallbackToDispatcher
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationWithCallback(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ NotificationTable::iterator n_iterator;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPUnsubscribeFromNotification(hApp, pNotification))) {
+ // \todo : error handling on all map function calls
+
+ // When registering using FrameworkunifiedSubscribeNotificationWithCallback, etc., the Nortification names NULL the 64th byte.
+ // In response to this, the UnRegister uses a strlcpy that puts a NULL in the 64th byte.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNotification, MAX_STRING_SIZE_NOTIFICATION);
+
+ n_iterator = pApp->notifications.find(tmp_notification);
+ if (n_iterator != pApp->notifications.end()) {
+ pApp->notifications.erase(n_iterator);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s:removed notification [%s]", pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s:Error:Cannot find notification [%s]", pApp->cAppName, pNotification);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s:Error:[%d] Unable to UnSubscribe from notification [%s]",
+ pApp->cAppName, eStatus, pNotification);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////
+// Defer Message functions
+///////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedGetDeferQueueCnt
+////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetDeferQueueCnt(HANDLE hApp) {
+ UI_32 l_uiCnt = 0;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ l_uiCnt = static_cast<UI_32>(pApp->deferedMsgQueue.size());
+ }
+
+ return l_uiCnt;
+}
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedIsDeferQueueEmpty
+////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsDeferQueueEmpty(HANDLE hApp) {
+ BOOL l_bIsQEmpty = TRUE;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ l_bIsQEmpty = static_cast<BOOL>(pApp->deferedMsgQueue.empty());
+ }
+
+ return l_bIsQEmpty;
+}
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedDeferMessage
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDeferMessage(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ DeferedMsgInfo defer(pApp->uiProtocolCmd, pApp->cMsgSrcName, pApp->uiMsgRcvBuffer);
+ pApp->deferedMsgQueue.push(defer);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedClearDeferMessages
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedClearDeferMessages(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // clear the pop flag!
+ pApp->fPopDeferedMsg = FALSE;
+
+ // remove all items from the queue!
+ while (!pApp->deferedMsgQueue.empty()) {
+ pApp->deferedMsgQueue.pop();
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedRetrieveDeferMessage
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRetrieveDeferMessage(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ uint64_t data = 1;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->fPopDeferedMsg = pApp->deferedMsgQueue.empty() ? FALSE : TRUE;
+ if (pApp->fPopDeferedMsg) {
+ if (-1 == (write(pApp->defer_evfd, &data, sizeof(uint64_t)))) {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : write Failed, status=%d, errno=%d, defer_evfd=%d",
+ eStatus, errno, pApp->defer_evfd);
+ }
+ }
+
+
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedIsStateMachineApp
+/// Returns TRUE if it's a state machine application else FALSE.
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsStateMachineApp(HANDLE hApp) {
+ BOOL l_bIsStateMachine = FALSE;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (NULL != pApp->m_pFrameworkunifiedStateMachine) {
+ l_bIsStateMachine = TRUE;
+ }
+ }
+
+ return l_bIsStateMachine;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetXMLConfigHandle
+/// Returns the handle to config file handle
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetXMLConfigHandle(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __PRETTY_FUNCTION__, "This function is not implemented!!!!");
+ return NULL;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedSetMandatoryServiceInfo(HANDLE hApp, PCSTR pNotification, UI_32 uiEventId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ ServiceNotificationInfo objNotification = {};
+ if (strlen(pNotification) < MAX_STRING_SIZE_NOTIFICATION) {
+ strlcpy(objNotification.sNotificationName, pNotification, sizeof(objNotification.sNotificationName));
+ objNotification.uiEventId = uiEventId;
+ pApp->servicenotificationlist.push_back(objNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ " Error : Aborting ... Exceeds Max Notification name size MAX_STRING_SIZE_NOTIFICATION : %d ",
+ MAX_STRING_SIZE_NOTIFICATION);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+BOOL FrameworkunifiedIsServiceAvailable(HANDLE hApp) {
+ BOOL l_bIsServiceAvailable = FALSE;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ // Publish notification
+ ServiceAvailability tServiceAvailability = {};
+
+ UI_32 l_uiLength = FrameworkunifiedGetMsgLength(hApp);
+
+ if (sizeof(tServiceAvailability) == l_uiLength) {
+ // Read the data from the message
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedGetMsgDataOfSize(hApp, &tServiceAvailability, sizeof(tServiceAvailability))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
+ } else {
+ // Check the Service availability
+ if (eFrameworkunifiedServiceAvailable == tServiceAvailability.eServiceAvailability) {
+ l_bIsServiceAvailable = TRUE;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error: Received message data size not matched :: %d", l_uiLength);
+ }
+ }
+
+ return l_bIsServiceAvailable;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedPublishServiceAvailability(HANDLE hApp, BOOL bIsAvailable) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (strlen(pApp->sServiceAvailabilityNotification)) {
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ pApp->bIsAvailable = bIsAvailable;
+ ServiceAvailability tServiceAvailability = {};
+ strlcpy(tServiceAvailability.cServiceName, FrameworkunifiedGetAppName(hApp), sizeof(tServiceAvailability.cServiceName));
+
+ if (bIsAvailable) {
+ tServiceAvailability.eServiceAvailability = eFrameworkunifiedServiceAvailable;
+ } else {
+ tServiceAvailability.eServiceAvailability = eFrameworkunifiedServiceNotAvailable;
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedNPPublishNotification(hApp, pApp->sServiceAvailabilityNotification,
+ &tServiceAvailability, sizeof(tServiceAvailability)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__,
+ "Failed to Publish notification: %s, status: %d", pApp->sServiceAvailabilityNotification, eStatus);
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE("Service Availability Status: %s, ERRORED %d", bIsAvailable ? "TRUE" : "FALSE", eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE("Service Availability Status: %s", bIsAvailable ? "TRUE" : "FALSE");
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__,
+ "Publish availability notfn:%s, status:%s", pApp->sServiceAvailabilityNotification,
+ bIsAvailable ? "TRUE" : "FALSE");
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+BOOL FrameworkunifiedGetSelfAvailability(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return pApp->bIsAvailable;
+ }
+
+ return FALSE;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedRegisterServiceAvailabilityNotification(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (strlen(pNotification) < MAX_STRING_SIZE_NOTIFICATION) {
+ strlcpy(pApp->sServiceAvailabilityNotification, pNotification, sizeof(pApp->sServiceAvailabilityNotification));
+
+ // Register Notifications
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedNPRegisterNotification(hApp, pNotification,
+ sizeof(ServiceAvailability), eFrameworkunifiedStateVar))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedNPRegisterNotifications %s Failed Status:0x%x ", pNotification, eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "FrameworkunifiedNPRegisterNotifications %s success Status:0x%x ",
+ pNotification, eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ " Error : Aborting ... Exceeds Max Notification name size MAX_STRING_SIZE_NOTIFICATION : %d ",
+ MAX_STRING_SIZE_NOTIFICATION);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterServiceAvailabilityNotification(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // Register Notifications
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedNPUnRegisterNotification(hApp, pApp->sServiceAvailabilityNotification))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedNPUnRegisterNotifications %s Failed Status:0x%x ",
+ pApp->sServiceAvailabilityNotification != 0 ? pApp->sServiceAvailabilityNotification : NULL, eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "FrameworkunifiedNPUnRegisterNotifications %s success Status:0x%x ",
+ pApp->sServiceAvailabilityNotification, eStatus);
+ }
+ memset(pApp->sServiceAvailabilityNotification, 0, MAX_SYS_INFO_SIZE);
+ pApp->bIsAvailable = FALSE;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetServiceNameOnServiceAvailabilityNotification
+/// To be used when client receives service availability notification to get the available
+/// service name.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetServiceNameOnServiceAvailabilityNotification(HANDLE hApp, PSTR pServiceName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ // Publish notification
+ ServiceAvailability tServiceAvailability;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName) {
+ UI_32 l_uiLength = FrameworkunifiedGetMsgLength(hApp);
+
+ if (sizeof(tServiceAvailability) == l_uiLength) {
+ // Read the data from the message
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tServiceAvailability, sizeof(tServiceAvailability)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ if (NULL == std::strncpy(pServiceName, tServiceAvailability.cServiceName, MAX_NAME_SIZE_APP)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " strcpy failed Failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error: Received message data size not matched :: %d", l_uiLength);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetCurrentUser
+//////////////////////////////////////////
+HANDLE FrameworkunifiedGetCurrentUser(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ const CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return pApp->hUser;
+ } else {
+ return NULL;
+ }
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSetUser
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetUser(HANDLE hApp, HANDLE hUser) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->hUser = hUser;
+ return eFrameworkunifiedStatusOK;
+ } else {
+ return eFrameworkunifiedStatusFail;
+ }
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSetAppData
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetAppData(HANDLE hApp, PCSTR pKey, PVOID pData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ // Insert the data element
+ std::pair<AppData::iterator, bool> l_tRet = pApp->appdata.insert(std::make_pair(pKey, pData));
+ if (false == l_tRet.second) {
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetAppData
+//////////////////////////////////////////
+PVOID FrameworkunifiedGetAppData(HANDLE hApp, PCSTR pKey) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ AppData::iterator n_iterator = pApp->appdata.find(pKey);
+ if (n_iterator != pApp->appdata.end()) {
+ return n_iterator->second;
+ }
+ }
+ return NULL;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedRemoveAppData
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRemoveAppData(HANDLE hApp, PCSTR pKey) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ AppData::iterator n_iterator = pApp->appdata.find(pKey);
+ if (n_iterator != pApp->appdata.end()) {
+ pApp->appdata.erase(n_iterator);
+
+ eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ return eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_error.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_error.cpp
new file mode 100755
index 0000000..cf07922
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_error.cpp
@@ -0,0 +1,130 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <native_service/frameworkunified_framework_error.hpp>
+#include <cstdio>
+#include <string>
+#include "frameworkunified_framework_error_internal.hpp"
+
+// using std::snprintf;
+typedef std::string TErrorDesc;
+typedef const TErrorDesc TCErrorDesc;
+
+namespace {
+
+PCSTR FrameworkunifiedStatusDesc(EFrameworkunifiedStatus status) {
+ switch (status) {
+ case eFrameworkunifiedStatusSessionLimitMaxedOut:
+ return "Session limit maxed out";
+ case eFrameworkunifiedStatusDbRecNotFound:
+ return "Db record not Found";
+ case eFrameworkunifiedStatusDbResultError:
+ return "Db result error";
+ case eFrameworkunifiedStatusDbExecuteFail:
+ return "Db execute failure";
+ case eFrameworkunifiedStatusSemCloseFail:
+ return "Semaphore close failure";
+ case eFrameworkunifiedStatusSemUnlockFail:
+ return "Semaphore unlock gailure";
+ case eFrameworkunifiedStatusSemLockFail:
+ return "Semaphore lock failure";
+ case eFrameworkunifiedStatusFail:
+ return "failure";
+ case eFrameworkunifiedStatusOK:
+ return "Status OK";
+ case eFrameworkunifiedStatusInvldBuf:
+ return "Invalid buffer";
+ case eFrameworkunifiedStatusInvldHandle:
+ return "Invalid handle";
+ case eFrameworkunifiedStatusInvldHndlType:
+ return "Invalid handle yype";
+ case eFrameworkunifiedStatusInvldQName:
+ return "Invalid queue name";
+ case eFrameworkunifiedStatusMsgQFull:
+ return "Message queue full";
+ case eFrameworkunifiedStatusInvldNotification:
+ return "Invliad notification";
+ case eFrameworkunifiedStatusInvldParam:
+ return "Invalid parameter";
+ case eFrameworkunifiedStatusInvldBufSize:
+ return "Invalid buffer size";
+ case eFrameworkunifiedStatusInvldID:
+ return "Invalid MemID";
+ case eFrameworkunifiedStatusCannotRelease:
+ return "Cannot release resource";
+ case eFrameworkunifiedStatusBadConnection:
+ return "Bad connection";
+ case eFrameworkunifiedStatusExit:
+ return "Exit";
+ case eFrameworkunifiedStatusNotImplemented:
+ return "Not implemented";
+ case eFrameworkunifiedStatusThreadBusy:
+ return "Thread busy";
+ case eFrameworkunifiedStatusThreadSelfJoin:
+ return "Attempted to self-join";
+ case eFrameworkunifiedStatusThreadInvalidVal:
+ return "Invalid value passed";
+ case eFrameworkunifiedStatusThreadNotExist:
+ return "Thread does not exist";
+ case eFrameworkunifiedStatusFault:
+ return "Fault";
+ case eFrameworkunifiedStatusServNotFound:
+ return "Service not found";
+ case eFrameworkunifiedStatusErrOther:
+ default:
+ return "Other error";
+ }
+}
+
+TCErrorDesc BuildFrameworkunifiedErrorDesc(EFrameworkunifiedStatus error, PCSTR errorMsg) {
+ CHAR buf[ MAX_QUEUE_MSG_SIZE ] = {};
+ snprintf(&buf[ 0 ],
+ MAX_QUEUE_MSG_SIZE,
+ "Framework Error: %s - %s",
+ FrameworkunifiedStatusDesc(error),
+ errorMsg != 0 ? errorMsg : NULL);
+ return TErrorDesc(&buf[ 0 ]);
+}
+
+TCErrorDesc BuildFrameworkunifiedSystemErrorDesc(EFrameworkunifiedSystemError error, PCSTR errorMsg) {
+ TErrorDesc l_cErrorMsg("Framework defined error desc: ");
+
+ switch (error) {
+ // Commented, because this is product specific error. Must handle by SystemServices only.
+ // case eFrameworkunifiedDSPHardwareReset : l_cErrorMsg.append("DSP HW RESET ERROR"); break;
+ default:
+ l_cErrorMsg.append("Other error");
+ break;
+ }
+
+ l_cErrorMsg.append(" :: Application provided error desc:");
+ l_cErrorMsg.append(errorMsg);
+ return l_cErrorMsg;
+}
+
+} // end namespace
+
+
+
+frameworkunified::framework::error::error::error(EFrameworkunifiedStatus error, PCSTR errorMsg)
+ : std::runtime_error(BuildFrameworkunifiedErrorDesc(error, errorMsg)),
+ m_error(error) {
+}
+
+frameworkunified::framework::error::CSystemError::CSystemError(EFrameworkunifiedSystemError error, PCSTR errorMsg)
+ : std::runtime_error(BuildFrameworkunifiedSystemErrorDesc(error, errorMsg)),
+ m_eSystemError(error) {
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_logger.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_logger.cpp
new file mode 100755
index 0000000..2912527
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_logger.cpp
@@ -0,0 +1,575 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Framework wrapper over the logger interface APIs
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_rcs_logger_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/nslogutil_cmd_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <cstdio>
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+#include "frameworkunified_framework_utility.h"
+
+FrameworkunifiedProtocolCallbackHandler rcs_logging_callbacks[] = {
+ { NSRCS_SET_LOG_SETTINGS_REQ, NSRcsSetLogSettings },
+ { NSRCS_GET_LOG_SETTINGS_REQ, NSRcsGetLogSettings },
+ { NSRCS_SET_LOG_MASK_REQ, NSRcsSetLogMask },
+ { NSRCS_SET_LOG_OUT_OPT_REQ, NSRcsSetOutputLogOpts },
+ { NSRCS_SET_LOG_SEVERITY_REQ, NSRcsSetLogSeverity },
+};
+
+
+FrameworkunifiedProtocolCallbackHandler logging_callbacks[] = {
+ { SET_LOG_MASK, FrameworkunifiedSetLogMask },
+ { GET_LOG_MASK, FrameworkunifiedGetLogMask },
+ { SET_LOG_OUT_OPT, FrameworkunifiedSetOutputLogOpts },
+ { GET_LOG_OUT_OPT, FrameworkunifiedGetOutputLogOpts },
+ // { kDebugDumpRequest, FrameworkunifiedDebugDumpRequest }, /// < Added to help Debug Issues with in CCR Radio
+ // Callback attach with frameworkunifieddebug is moved to SystemServices
+ { SET_LOG_SEVERITY, FrameworkunifiedSetLogSeverity },
+ { GET_LOG_SEVERITY, FrameworkunifiedGetLogSeverity },
+};
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachLoggerCallbacksDispatcher(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp, "nslogutil", logging_callbacks,
+ static_cast<UI_32>(_countof(logging_callbacks)));
+ // Callback attach with of kDebugDumpRequest with frameworkunifieddebug is moved to SystemServices. Keep only nslogutil.
+ eStatus = (eStatus != eFrameworkunifiedStatusOK) ? eStatus : FrameworkunifiedAttachCallbackToDispatcher(hApp, "nslogutil", kDebugDumpRequest,
+ FrameworkunifiedDebugDumpRequest);
+ eStatus = (eStatus != eFrameworkunifiedStatusOK) ? eStatus : FrameworkunifiedAttachCallbacksToDispatcher(hApp,
+ "SS_LoggerService",
+ logging_callbacks,
+ static_cast<UI_32>(_countof(logging_callbacks)));
+ eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_LOGGER_SETCONTROLMASK, FrameworkunifiedSetLogMask);
+
+ // This is optional only for remote control service. Therefore return value not checked
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbacksToDispatcher(hApp, FRAMEWORKUNIFIED_NS_REMOTECONTROLSERVICE, rcs_logging_callbacks,
+ static_cast<UI_32>(_countof(rcs_logging_callbacks)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_WAR, __FUNCTION__,
+ " FrameworkunifiedAttachCallbacksToDispatcher failed for rcs_logging_callbacks with FRAMEWORKUNIFIED_NS_REMOTECONTROLSERVICE");
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetLogMask(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CHANGELOGPARAMS chngLogOpts;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(CHANGELOGPARAMS)) {
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&chngLogOpts, sizeof(chngLogOpts))) {
+ // Set the mask to the value that was just sent.
+ NsLogSetControlMask(chngLogOpts.uiZoneMask);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Retervial of Data Failed");
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Incorrect message sz");
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetLogMask(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ PCSTR pAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR pSrcName = FrameworkunifiedGetMsgSrc(hApp);
+
+ if (NULL != pAppName && NULL != pSrcName) {
+ HANDLE echoBack = McOpenSender(pSrcName);
+ if (NULL != echoBack) {
+ CHANGELOGPARAMS chng_log_params;
+
+ NsLogGetControlMask(chng_log_params.uiZoneMask);
+ if (eFrameworkunifiedStatusOK != (eStatus = McSend(echoBack, pAppName, GET_LOG_MASK_RESPONSE, sizeof(chng_log_params),
+ &chng_log_params))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Error sending message GET_LOG_MASK_RESPONSE");
+ }
+
+ McClose(echoBack);
+ echoBack = NULL;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetOutputLogOpts(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CHANGELOGPARAMS chngLogOpts;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(CHANGELOGPARAMS)) {
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&chngLogOpts, sizeof(chngLogOpts))) {
+ // Set the logging method to the value that was just received.
+ NsLogSetLogMethod(chngLogOpts.uiLogOptions);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Retervial of Data Failed");
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Incorrect message sz");
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ }
+
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetOutputLogOpts(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ PCSTR pAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR pSrcName = FrameworkunifiedGetMsgSrc(hApp);
+
+ if (NULL != pAppName && NULL != pSrcName) {
+ HANDLE echoBack = McOpenSender(pSrcName);
+
+ if (NULL != echoBack) {
+ CHANGELOGPARAMS chng_log_params;
+
+ chng_log_params.uiLogOptions = NsLogGetLogMethod();
+ if (eFrameworkunifiedStatusOK != (eStatus = McSend(echoBack, pAppName, GET_LOG_OUT_OPT_RESPONSE, sizeof(chng_log_params),
+ &chng_log_params))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Error sending message GET_LOG_OUT_OPT_RESPONSE");
+ }
+
+ McClose(echoBack);
+ echoBack = NULL;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSetLogSeverity
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetLogSeverity(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CHANGELOGPARAMS l_tChngLogOpts = {};
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(CHANGELOGPARAMS)) {
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tChngLogOpts, sizeof(l_tChngLogOpts))) {
+ // Set the logging method to the value that was just received.
+ NsLogSetSeverity(l_tChngLogOpts.eSeverity);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of log severity data Failed");
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size CHANGELOGPARAMS");
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetLogSeverity
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetLogSeverity(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+
+ if (NULL != l_cAppName && NULL != l_cSrcName) {
+ HANDLE l_hEchoBack = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hEchoBack) {
+ CHANGELOGPARAMS l_tChngLogParams = {};
+
+ l_tChngLogParams.eSeverity = NsLogGetSeverity();
+ if (eFrameworkunifiedStatusOK != (eStatus = McSend(l_hEchoBack, l_cAppName, GET_LOG_SEVERITY_RESPONSE,
+ sizeof(l_tChngLogParams), &l_tChngLogParams))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Error sending message GET_LOG_OUT_OPT_RESPONSE");
+ }
+
+ McClose(l_hEchoBack);
+ l_hEchoBack = NULL;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDebugDumpRequest: Calls an Applications FrameworkunifiedOnDebugDump method.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDebugDumpRequest(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DEBUG_DUMP, __FUNCTION__, "+");
+ eStatus = FrameworkunifiedOnDebugDumpInternal(hApp);
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DEBUG_DUMP, __FUNCTION__, "+");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus NSRcsSetLogSettings(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(TNSRCS_SetLogSettingsReq)) {
+ TNSRCS_SetLogSettingsReq l_tSetLogSettings = {};
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tSetLogSettings, sizeof(l_tSetLogSettings))) {
+ // Set the log mask
+ NsLogSetControlMask(l_tSetLogSettings.m_pui32ZoneMask);
+ // set the log output option
+ NsLogSetLogMethod(l_tSetLogSettings.m_ui8OutputLogOption);
+ // set the log severity
+ NsLogSetSeverity(l_tSetLogSettings.m_si32Severity);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Log settings applied");
+
+ // send the response back with the current settings
+ TNSRCS_SetLogSettingsResp l_tSetLogSettingsResp = {};
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ HANDLE l_hSendTo = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hSendTo) {
+ l_tSetLogSettingsResp.m_ui8ClientId = l_tSetLogSettings.m_ui8ClientId;
+ l_tSetLogSettingsResp.m_ui8SetStatus = static_cast<UI_8>(eFrameworkunifiedStatusOK);
+
+ NsLogGetControlMask(l_tSetLogSettingsResp.m_pui32ZoneMask);
+ l_tSetLogSettingsResp.m_ui8OutputLogOption = NsLogGetLogMethod();
+ l_tSetLogSettingsResp.m_si32Severity = NsLogGetSeverity();
+
+ if (eFrameworkunifiedStatusOK !=
+ McSend(l_hSendTo, l_cAppName, NSRCS_SET_LOG_SETTINGS_RESP,
+ sizeof(TNSRCS_SetLogSettingsResp), &l_tSetLogSettingsResp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending message "
+ "NSRCS_SET_LOG_SETTINGS_RESP to %s", l_cSrcName);
+ }
+ McClose(l_hSendTo);
+ l_hSendTo = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Sender handle NULL when sending response to %s", l_cSrcName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of Data Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size. Received: %d expected: %ld",
+ FrameworkunifiedGetMsgLength(hApp),
+ static_cast<long int>(sizeof(TNSRCS_SetLogSettingsReq))); // NOLINT (readability/nolint)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus NSRcsGetLogSettings(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(TNSRCS_GetLogSettingsReq)) {
+ TNSRCS_GetLogSettingsReq l_tGetLogSettings = {};
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tGetLogSettings, sizeof(l_tGetLogSettings))) {
+ // send the response back with the current settings
+ TNSRCS_GetLogSettingsResp l_tGetLogSettingsResp = {};
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ HANDLE l_hSendTo = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hSendTo) {
+ l_tGetLogSettingsResp.m_ui8ClientId = l_tGetLogSettings.m_ui8ClientId;
+ NsLogGetZoneTextList(l_tGetLogSettingsResp.m_cZoneList);
+ NsLogGetControlMask(l_tGetLogSettingsResp.m_pui32ZoneMask);
+ l_tGetLogSettingsResp.m_ui8OutputLogOption = NsLogGetLogMethod();
+ l_tGetLogSettingsResp.m_si32Severity = NsLogGetSeverity();
+
+ if (eFrameworkunifiedStatusOK !=
+ McSend(l_hSendTo, l_cAppName, NSRCS_GET_LOG_SETTINGS_RESP,
+ sizeof(TNSRCS_GetLogSettingsResp), &l_tGetLogSettingsResp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending message "
+ "NSRCS_GET_LOG_SETTINGS_RESP to %s", l_cSrcName);
+ }
+ McClose(l_hSendTo);
+ l_hSendTo = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Sender handle NULL when sending response to %s", l_cSrcName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of Data Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size. Received: %d expected: %ld",
+ FrameworkunifiedGetMsgLength(hApp),
+ static_cast<long int>(sizeof(TNSRCS_GetLogSettingsReq))); // NOLINT (readability/nolint)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus NSRcsSetLogMask(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(TNSRCS_SetLogSettingsReq)) {
+ TNSRCS_SetLogSettingsReq l_tSetLogSettings = {};
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tSetLogSettings, sizeof(l_tSetLogSettings))) {
+ // Set the log mask
+ NsLogSetControlMask(l_tSetLogSettings.m_pui32ZoneMask);
+
+ // 11 = number of chars in UI_32, 1 - nul char at the end
+ CHAR l_cOutMask[(ZONE_MASK_ARRAY_ELTS * 11) + 1] = {};
+ CHAR l_cMask[12] = {}; // 12 = 11+1: 11 = number of chars in UI_32, 1 - nul char at the end
+ for (UI_32 zoneIndex = 0; zoneIndex < ZONE_MASK_ARRAY_ELTS; zoneIndex++) {
+ std::strncpy(l_cMask, "", 11);
+ snprintf(l_cMask, sizeof(l_cMask), "0x%X,", l_tSetLogSettings.m_pui32ZoneMask[zoneIndex]);
+ std::strncat(l_cOutMask, l_cMask, (sizeof(l_cOutMask) - std::strlen(l_cMask) - 1));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Log settings (zone mask) applied: %s", l_cOutMask);
+
+ // send the response back with the current settings
+ TNSRCS_SetLogMaskResp l_tSetLogMaskResp = {};
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ HANDLE l_hSendTo = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hSendTo) {
+ l_tSetLogMaskResp.m_ui8ClientId = l_tSetLogSettings.m_ui8ClientId;
+ l_tSetLogMaskResp.m_ui8SetStatus = static_cast<UI_8>(eFrameworkunifiedStatusOK);
+
+ NsLogGetControlMask(l_tSetLogMaskResp.m_pui32ZoneMask);
+
+ if (eFrameworkunifiedStatusOK !=
+ McSend(l_hSendTo, l_cAppName, NSRCS_SET_LOG_MASK_RESP,
+ sizeof(TNSRCS_SetLogMaskResp), &l_tSetLogMaskResp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending message "
+ "NSRCS_SET_LOG_MASK_RESP to %s", l_cSrcName);
+ }
+ McClose(l_hSendTo);
+ l_hSendTo = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Sender handle NULL when sending response to %s", l_cSrcName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of Data Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size. Received: %d expected: %ld",
+ FrameworkunifiedGetMsgLength(hApp),
+ static_cast<long int>(sizeof(TNSRCS_SetLogSettingsReq))); // NOLINT (readability/nolint)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus NSRcsSetOutputLogOpts(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(TNSRCS_SetLogSettingsReq)) {
+ TNSRCS_SetLogSettingsReq l_tSetLogSettings = {};
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tSetLogSettings, sizeof(l_tSetLogSettings))) {
+ // set the log output option
+ NsLogSetLogMethod(l_tSetLogSettings.m_ui8OutputLogOption);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Log settings(log output option) applied: %d.",
+ l_tSetLogSettings.m_ui8OutputLogOption);
+
+ // send the response back with the current settings
+ TNSRCS_SetLogOutOptResp l_tSetLogOutputOptResp = {};
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ HANDLE l_hSendTo = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hSendTo) {
+ l_tSetLogOutputOptResp.m_ui8ClientId = l_tSetLogSettings.m_ui8ClientId;
+ l_tSetLogOutputOptResp.m_ui8SetStatus = static_cast<UI_8>(eFrameworkunifiedStatusOK);
+
+ l_tSetLogOutputOptResp.m_ui8OutputLogOption = NsLogGetLogMethod();
+
+ if (eFrameworkunifiedStatusOK !=
+ McSend(l_hSendTo, l_cAppName, NSRCS_SET_LOG_OUT_OPT_RESP,
+ sizeof(TNSRCS_SetLogOutOptResp), &l_tSetLogOutputOptResp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending message "
+ "NSRCS_SET_LOG_OUT_OPT_RESP to %s", l_cSrcName);
+ }
+ McClose(l_hSendTo);
+ l_hSendTo = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Sender handle NULL when sending response to %s", l_cSrcName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of Data Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size. Received: %d expected: %ld",
+ FrameworkunifiedGetMsgLength(hApp),
+ static_cast<long int>(sizeof(TNSRCS_SetLogSettingsReq))); // NOLINT (readability/nolint)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus NSRcsSetLogSeverity(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(TNSRCS_SetLogSettingsReq)) {
+ TNSRCS_SetLogSettingsReq l_tSetLogSettings = {};
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tSetLogSettings, sizeof(l_tSetLogSettings))) {
+ // set the log severity
+ NsLogSetSeverity(l_tSetLogSettings.m_si32Severity);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Log settings(log severity) applied: %d.",
+ l_tSetLogSettings.m_si32Severity);
+
+ // send the response back with the current settings
+ TNSRCS_SetLogSeverityResp l_tSetLogSeverityResp = {};
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ HANDLE l_hSendTo = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hSendTo) {
+ l_tSetLogSeverityResp.m_ui8ClientId = l_tSetLogSettings.m_ui8ClientId;
+ l_tSetLogSeverityResp.m_ui8SetStatus = static_cast<UI_8>(eFrameworkunifiedStatusOK);
+
+ l_tSetLogSeverityResp.m_si32Severity = NsLogGetSeverity();
+
+ if (eFrameworkunifiedStatusOK !=
+ McSend(l_hSendTo, l_cAppName, NSRCS_SET_LOG_SEVERITY_RESP,
+ sizeof(TNSRCS_SetLogSeverityResp), &l_tSetLogSeverityResp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending message "
+ "NSRCS_SET_LOG_SEVERITY_RESP to %s", l_cSrcName);
+ }
+ McClose(l_hSendTo);
+ l_hSendTo = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Sender handle NULL when sending response to %s", l_cSrcName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of Data Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size. Received: %d expected: %ld",
+ FrameworkunifiedGetMsgLength(hApp),
+ static_cast<long int>(sizeof(TNSRCS_SetLogSettingsReq))); // NOLINT (readability/nolint)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp
new file mode 100755
index 0000000..ea953c9
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp
@@ -0,0 +1,502 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <other_service/strlcpy.h>
+#include "frameworkunified_framework_core.h"
+#include "ns_mc_internal.h"
+
+using std::malloc;
+using std::free;
+using std::strcpy;
+using std::strlen;
+using std::memset;
+
+extern __thread HANDLE responseWaitQ;
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedMcOpenSender
+//////////////////////////////////////////
+HANDLE FrameworkunifiedMcOpenSender(HANDLE hApp, PCSTR pName) {
+ MsgQInfo *pMsgQ = NULL;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pName)) {
+ UI_32 l_ui32SrvNameLen = static_cast<UI_32>(strlen(pName));
+ /**
+ * @todo
+ * CHAR cSessionName[MAX_QUEUE_NAME_SIZE] cannot be determined to be 20 bytes including the termination NULL.
+ */
+ if ((l_ui32SrvNameLen < MAX_NAME_SIZE_APP) && (l_ui32SrvNameLen > 0)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pMsgQ = reinterpret_cast<MsgQInfo *>(malloc(sizeof(MsgQInfo)));
+
+ if (NULL != pMsgQ) { // LCOV_EXCL_BR_LINE 5:malloc's error case.
+ errno = EOK; // flush previous errors, if any.
+ memset(pMsgQ, 0, sizeof(MsgQInfo));
+ if (NULL == (pMsgQ->hMsgQ = McOpenSender(pName))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Error::errno:%d, hApp:0x%p, %s failed to McOpenSender",
+ errno, hApp, pName);
+ free(pMsgQ);
+ pMsgQ = NULL;
+ } else {
+ pMsgQ->checkCode = MSGQ_CHECK_CODE;
+ pMsgQ->self = pthread_self();
+ strlcpy(pMsgQ->cSrcName, pApp->cAppName, sizeof(pMsgQ->cSrcName));
+ strlcpy(pMsgQ->cMsgQName, pName, sizeof(pMsgQ->cMsgQName));
+ pMsgQ->sessionId = 0;
+ }
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Invalid param. Name:%s, Following must be true: %d > len of passed name(%u) > 0.",
+ pName, MAX_NAME_SIZE_APP, l_ui32SrvNameLen);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Invalid param. hApp:0x%p, name:0x%p",
+ hApp, pName); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ return static_cast<HANDLE>(pMsgQ);
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedMcClose
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedMcClose(HANDLE hService) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidMsgQ(hService)) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(hService);
+ pMsgQ->checkCode = 0;
+ if (NULL != pMsgQ->hMsgQ) {
+ eStatus = McClose(pMsgQ->hMsgQ);
+ pMsgQ->hMsgQ = NULL;
+ }
+ free(pMsgQ);
+ pMsgQ = NULL;
+ hService = NULL; // This has no effect because hService is not passed as reference.
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSendMsg
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendMsg(HANDLE hService, UI_32 iCmd, UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidMsgQ(hService)) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(hService);
+
+ if ((NULL != pMsgQ->hMsgQ) && (0 != std::strlen(pMsgQ->cSrcName))) {
+ eStatus = McSendWithSession(pMsgQ->hMsgQ, pMsgQ->cSrcName, iCmd, length, data, pMsgQ->sessionId);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ // check if McSendWithSession failed with error destination msg queue full
+ // log the information
+ if (eFrameworkunifiedStatusMsgQFull == eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error!! Message queue full of receiver '%s' while sending CmdId = 0x%X",
+ FrameworkunifiedGetSessionName(hService), iCmd);
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSendPriorityMsg
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendPriorityMsg(HANDLE hService, UI_32 iCmd, UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidMsgQ(hService)) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(hService);
+ eStatus = McSendWithPriority(pMsgQ->hMsgQ, pMsgQ->cSrcName, iCmd,
+ length, data, eFrameworkunifiedMsgPrioEmergency, pMsgQ->sessionId);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function: FrameworkunifiedSendSelf
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendSelf(HANDLE hApp, UI_32 iCmd, UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+ eStatus = McSend(pApp->hAppSndMsgQ, &pApp->cAppName[ 0 ], iCmd, length, data);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedInvokeSync
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedInvokeSync(HANDLE hService, UI_32 iCmd, UI_32 msgLenght, PCVOID msgData, UI_32 responseLength,
+ PVOID responseData, UI_32 *receivedLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidMsgQ(hService)) {
+ if (NULL != receivedLength) {
+ MsgQInfo *pMsgQ = static_cast<MsgQInfo *>(hService);
+
+ if (responseWaitQ == NULL) {
+ char mc_invoker_name[MAX_QUEUE_NAME_SIZE];
+ InvokerName invokerName;
+ // LCOV_EXCL_BR_START 11:except branch
+ McCreateInvokerName(pMsgQ->cSrcName, pMsgQ->sessionId, mc_invoker_name, sizeof(mc_invoker_name));
+ // LCOV_EXCL_BR_STOP
+ invokerName = mc_invoker_name;
+
+ responseWaitQ = McOpenSyncReceiver(invokerName.c_str());
+ if (NULL == responseWaitQ) {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ if (eStatus == eFrameworkunifiedStatusOK) {
+ eStatus = McInvokeSync(pMsgQ->hMsgQ, pMsgQ->cSrcName, iCmd, msgLenght, msgData, pMsgQ->sessionId,
+ responseWaitQ, responseLength, responseData, receivedLength);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : frameworkunifiedSendSyncResponse
+//////////////////////////////////////////
+EFrameworkunifiedStatus frameworkunifiedSendSyncResponse(HANDLE hApp, UI_32 iCmd, UI_32 seq_id, EFrameworkunifiedStatus retValue, UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ HANDLE responseSendQ;
+
+ char mc_invoker_name[MAX_QUEUE_NAME_SIZE];
+ InvokerName invokerName;
+ PVOID rcv_buf = static_cast<PVOID>(pApp->uiMsgRcvBuffer);
+ McCreateInvokerName(McGetMsgSrc(rcv_buf), mcGetMsgSsessionId(rcv_buf), mc_invoker_name, sizeof(mc_invoker_name));
+ invokerName = mc_invoker_name;
+
+ InvokeResponseQTable::iterator s_iterator = pApp->invokeResQTable.find(invokerName);
+ if (s_iterator != pApp->invokeResQTable.end()) {
+ responseSendQ = s_iterator->second;
+ } else {
+ responseSendQ = McOpenSyncSender(invokerName.c_str()); // LCOV_EXCL_BR_LINE 11:except branch
+ /*
+ * @todo
+ * FrameworkunifiedSendSyncResponse() uses McOpenSyncSender() to create a synchronous communication response queue handle,
+ * but there is no process to release the queue handle after the response.
+ */
+ if (NULL == responseSendQ) {
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ pApp->invokeResQTable[invokerName] = responseSendQ; // LCOV_EXCL_BR_LINE 11:except branch
+ }
+ }
+
+ if (eStatus == eFrameworkunifiedStatusOK) {
+ eStatus = McSendSyncResponse(responseSendQ, pApp->cAppName, iCmd, seq_id, retValue, length, data);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedDispatchProcess
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetSyncResponseData(HANDLE hApp, PVOID data, UI_32 size) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ /*
+ * @todo
+ * When the response data is 0 bytes, it can be transmitted as SYNC data.
+ */
+ if (frameworkunifiedCheckValidAppHandle(hApp) && data != NULL) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ try {
+ pApp->responsedata.set(data, size); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+ catch(std::bad_alloc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "bad_alloc");
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetMsgLength
+//////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgLength(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return McGetLength(static_cast<PVOID>(pApp->uiMsgRcvBuffer));
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetMsgProtocol
+//////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgProtocol(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return static_cast<UI_32>(pApp->uiProtocolCmd);
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetMsgDataOfSize
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetMsgDataOfSize(HANDLE hApp, PVOID pData, UI_32 uiSize, ESMRetrieveTypes eRetrieveMethod) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ /*
+ * @todo
+ * The behavior is the same as when "eSMRRetain" is set without getting an error when the ESMRetrieveTypes is not appropriate.
+ */
+ if (eSMRRelease == eRetrieveMethod) {
+ eStatus = McGetDataOfSize(static_cast<PVOID>(pApp->uiMsgRcvBuffer), pData, uiSize);
+ } else {
+ eStatus = McGetDataOfSizeWithSMRetain(static_cast<PVOID>(pApp->uiMsgRcvBuffer), pData, uiSize);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetDataPointer
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetDataPointer(HANDLE hApp, void **datap) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (NULL == datap) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ void *dt;
+ if ((dt = McGetDataPointer(reinterpret_cast<PVOID>(pApp->uiMsgRcvBuffer))) == NULL) {
+ return eFrameworkunifiedStatusInvldBufSize;
+ }
+
+ *datap = dt;
+ return eFrameworkunifiedStatusOK;
+ }
+ return eFrameworkunifiedStatusInvldHandle;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetMsgSrc
+//////////////////////////////////////////
+PCSTR FrameworkunifiedGetMsgSrc(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return (reinterpret_cast<PCSTR>(pApp->cMsgSrcName));
+ }
+ return NULL;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetMsgNotification
+//////////////////////////////////////////
+PCSTR FrameworkunifiedGetMsgNotification(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return (reinterpret_cast<PCSTR>(pApp->cSystemInfo));
+ }
+ return NULL;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedClearMsgData
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedClearMsgData(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ eStatus = McClearData(static_cast<PVOID>(pApp->uiMsgRcvBuffer));
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetDataUSID
+//////////////////////////////////////////
+TMemID FrameworkunifiedGetDataUSID(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return McGetDataUSID(static_cast<PVOID>(pApp->uiMsgRcvBuffer));
+ }
+ return BAD_MEM_ID;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedForwardMessage
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedForwardMessage(HANDLE hApp, HANDLE hChildQ, UI_32 iCmd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldBuf;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && hChildQ) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+
+ eStatus = McForward(hChildQ, &pApp->cAppName[ 0 ], iCmd, FrameworkunifiedGetDataUSID(hApp));
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetSystemInfo
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetSystemInfo(HANDLE hApp, PVOID pSystemInfo) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldBuf;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pSystemInfo != NULL) { // LCOV_EXCL_BR_LINE 11:except branch
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ eStatus = McGetSysInfoData(pApp->uiMsgRcvBuffer, pSystemInfo);
+// memcpy(pSystemInfo, pApp->cSystemInfo, _countof(pApp->cSystemInfo));
+// eStatus = eFrameworkunifiedStatusOK;
+ }
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : frameworkunifiedGetIsTypeOfSync
+//////////////////////////////////////////
+BOOL frameworkunifiedGetIsTypeOfSync(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return mcGetIsTypeOfSync(pApp->uiMsgRcvBuffer);
+ }
+ return FALSE;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetLastNotification
+/// Returns the last notification string that was received.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return pSourceName
+/// PCSTR - the last notification name that has been received.
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetLastNotification(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return static_cast<PCSTR>(pApp->cSystemInfo);
+ }
+
+ return NULL;
+}
+
+
+EFrameworkunifiedStatus FrameworkunifiedSendResponse(HANDLE hApp, UI_32 iCmd, UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ HANDLE hSession = FrameworkunifiedGetCurrentSessionHandle(hApp);
+
+ if (hSession) {
+ // send response
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(hSession, iCmd, length, data))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__,
+ "Response send Failed Status:0x%x ", eStatus);
+ // LCOV_EXCL_BR_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __PRETTY_FUNCTION__, "Response sent ");
+ }
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedSendRequest(HANDLE hApp, PCSTR pServerName, UI_32 uiSessionId, UI_32 iCmd,
+ UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ HANDLE hSession = FrameworkunifiedGetSessionHandle(hApp, pServerName, uiSessionId);
+ if (hSession) {
+ // send response
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(hSession, iCmd, length, data))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__,
+ "Response send Failed Status:0x%x ", eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __PRETTY_FUNCTION__, "Response sent ");
+ }
+ }
+ }
+ return eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp
new file mode 100755
index 0000000..063e357
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp
@@ -0,0 +1,867 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Framework wrapper over the NPService interface APIs
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <string.h>
+
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <other_service/strlcpy.h>
+
+#include "frameworkunified_framework_core.h"
+#include "ns_np_service_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterNotification(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const EFrameworkunifiedNotificationType persType) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ if (strlen(pNotification) && strlen(pNotification) < MAX_STRING_SIZE_NOTIFICATION) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ NotificationInfo notifInfo = {};
+ strlcpy(notifInfo.notificationName, pNotification, sizeof(notifInfo.notificationName));
+ notifInfo.persType = persType;
+ notifInfo.maxLength = max_length;
+
+ eStatus = NPRegisterNotifications(pMqInfo->hMsgQ, pApp->cAppName, 1, &notifInfo);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterImmediatePersistNotification(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const UI_32 delay) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification) {
+ if (strlen(pNotification) && strlen(pNotification) <= MAX_STRING_SIZE_NOTIFICATION) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ ImmediateNotificationInfo notifInfo = {};
+ strlcpy(notifInfo.notificationName, pNotification, sizeof(notifInfo.notificationName));
+ notifInfo.persType = eFrameworkunifiedImmediatePersistedStateVar;
+ notifInfo.maxLength = max_length;
+ notifInfo.delay = delay;
+
+ eStatus = NPRegisterImmediateNotifications(pMqInfo->hMsgQ, pApp->cAppName, 1, &notifInfo);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPPersistentSync
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPPersistentSync(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPPersistentSync(pMqInfo->cSrcName, pMqInfo->hMsgQ, pMqInfo->sessionId, pApp->cAppName);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eStatus;
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterNotifications(HANDLE hApp, const FrameworkunifiedNotificationsList *pList, UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ NotificationInfo *pNotificationList =
+ reinterpret_cast<NotificationInfo *>(malloc(sizeof(NotificationInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pNotificationList[i].notificationName, pList[i].cNotification,
+ sizeof(pNotificationList[i].notificationName));
+ pNotificationList[i].maxLength = pList[i].uiLengthData;
+ pNotificationList[i].persType = pList[i].persType;
+ }
+ eStatus = NPRegisterNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pNotificationList);
+
+ free(pNotificationList);
+ pNotificationList = NULL; // mb20110110 Fixed per comment 295
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPUnRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnRegisterNotification(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification && strlen(pNotification)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ NotificationInfo notifInfo = {};
+ strlcpy(notifInfo.notificationName, pNotification, sizeof(notifInfo.notificationName));
+
+ eStatus = NPUnRegisterNotifications(pMqInfo->hMsgQ, pApp->cAppName, 1, &notifInfo);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPUnRegisterNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnRegisterNotifications(HANDLE hApp, const FrameworkunifiedNotificationsList *pList, UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ NotificationInfo *pNotificationList =
+ reinterpret_cast<NotificationInfo *>(malloc(sizeof(NotificationInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pNotificationList[i].notificationName, pList[i].cNotification,
+ sizeof(pNotificationList[i].notificationName));
+ pNotificationList[i].maxLength = pList[i].uiLengthData;
+ pNotificationList[i].persType = pList[i].persType;
+ }
+ eStatus = NPUnRegisterNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pNotificationList);
+
+ free(pNotificationList);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPPublishNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPPublishNotification(HANDLE hApp, PCSTR pNotification,
+ PCVOID pData, UI_32 iLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if ((NULL != pMqInfo->hMsgQ) && (0 != std::strlen(pApp->cAppName))) {
+ eStatus = NPPublishNotification(pMqInfo->hMsgQ, pApp->cAppName, pNotification, pData, iLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSubscribeToNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSubscribeToNotification(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPSubscribeToNotification(pMqInfo->hMsgQ, pApp->cAppName, pNotification);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+EFrameworkunifiedStatus FrameworkunifiedNPSubscribeToNotifications(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pList,
+ UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ SubscribeInfo *pSubscribeList =
+ reinterpret_cast<SubscribeInfo *>(malloc(sizeof(SubscribeInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pSubscribeList[i].notificationName, pList[i].cNotification,
+ sizeof(pSubscribeList[i].notificationName));
+ }
+ eStatus = NPSubscribeToNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pSubscribeList);
+
+ free(pSubscribeList);
+ pSubscribeList = NULL; // mb20110110 Fixed per comment 307
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPUnSubscribeNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnsubscribeFromNotifications(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pList,
+ UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ SubscribeInfo *pSubscribeList =
+ reinterpret_cast<SubscribeInfo *>(malloc(sizeof(SubscribeInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pSubscribeList[i].notificationName, pList[i].cNotification, MAX_STRING_SIZE_NOTIFICATION);
+ }
+ eStatus = NPUnsubscribeFromNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pSubscribeList);
+
+ free(pSubscribeList);
+ pSubscribeList = NULL; // mb20110110 Fixed per comment 307
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPUnsubscribeFromNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnsubscribeFromNotification(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPUnsubscribeFromNotification(pMqInfo->hMsgQ, pApp->cAppName, pNotification);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReadPersistedData
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReadPersistedData(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPReadPersistedData(pMqInfo->hMsgQ, pApp->cAppName, pNotification);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSavePersistentData
+////////////////////////////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus FrameworkunifiedNPSavePersistentData(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED();
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPSavePersistentData(pMqInfo->hMsgQ, pApp->cAppName);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterPersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterPersistentFile(HANDLE hApp, PCSTR pTag, BOOL bIsUserFile) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ eStatus = NPRegisterPersistentFile(pMqInfo->hMsgQ, pApp->cAppName, pTag, bIsUserFile);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPLoadPersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPLoadPersistentFile(HANDLE hApp, PCSTR pDstFilePath, PCSTR pTag, HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pDstFilePath && pTag) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPLoadPersistentFile(pMqInfo->hMsgQ, pApp->cAppName, pDstFilePath, pTag, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFile(HANDLE hApp, BOOL bIsPersist, PCSTR pTag,
+ PCSTR pFullFilePath, HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag && pFullFilePath) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ EFrameworkunifiedReleaseType eReleaseType = (bIsPersist == FALSE) ? eFrameworkunifiedNotOnRelease : eFrameworkunifiedPersistOnShutdown;
+ eStatus = NPReleasePersistentFile(pMqInfo->hMsgQ, pApp->cAppName, eReleaseType, pTag,
+ pFullFilePath, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFile(HANDLE hApp, EFrameworkunifiedReleaseType eReleaseType, PCSTR pTag,
+ PCSTR pFullFilePath, HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag && pFullFilePath) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPReleasePersistentFile(pMqInfo->hMsgQ, pApp->cAppName, eReleaseType, pTag,
+ pFullFilePath, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterPersistentFolder
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterPersistentFolder(HANDLE hApp, PCSTR pTag, BOOL bIsUserFolder) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPRegisterPersistentFolder(pMqInfo->hMsgQ, pApp->cAppName, pTag, bIsUserFolder);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPLoadPersistentFolder
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPLoadPersistentFolder(HANDLE hApp, PCSTR pDstFolderPath, PCSTR pTag, HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag && pDstFolderPath) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ eStatus = NPLoadPersistentFolder(pMqInfo->hMsgQ, pApp->cAppName, pDstFolderPath, pTag, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFolder
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFolder(HANDLE hApp, BOOL bIsPersist, PCSTR pTag, PCSTR pFullFolderPath,
+ HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag && pFullFolderPath) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ EFrameworkunifiedReleaseType eReleaseType = (bIsPersist == FALSE) ? eFrameworkunifiedNotOnRelease : eFrameworkunifiedPersistOnShutdown;
+ eStatus = NPReleasePersistentFolder(pMqInfo->hMsgQ, pApp->cAppName, eReleaseType, pTag,
+ pFullFolderPath, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFolder
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFolder(HANDLE hApp, EFrameworkunifiedReleaseType eReleaseType, PCSTR pTag,
+ PCSTR pFullFolderPath,
+ HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag && pFullFolderPath) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ eStatus = NPReleasePersistentFolder(pMqInfo->hMsgQ, pApp->cAppName, eReleaseType, pTag,
+ pFullFolderPath, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+// 20110429_brp
+// defined for backward compatibility; will be removed once the persistence feature is finalized
+EFrameworkunifiedStatus FrameworkunifiedRegisterPersistentStorage(HANDLE hApp, PCSTR pFullFilePath) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pFullFilePath) {
+ eStatus = FrameworkunifiedNPRegisterPersistentFile(hApp, pFullFilePath);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+EFrameworkunifiedStatus FrameworkunifiedReleaseFileToPersistentStorage(HANDLE hApp, PCSTR pFullFilePath, BOOL persist) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pFullFilePath) {
+ eStatus = FrameworkunifiedNPReleasePersistentFile(hApp, persist, pFullFilePath, pFullFilePath);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMRegisterNotificationsEvents
+/// API to send message to Notification Service to register a notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMRegisterNotificationsEvents(HANDLE hApp, const FrameworkunifiedNotificationsList *pList,
+ UI_32 uiListLength) {
+ return FrameworkunifiedNPRegisterNotifications(hApp, pList, uiListLength);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMRegisterNotificatsionEvent
+/// API to send message to Notification Service to register a notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMRegisterNotificatsionEvent(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const EFrameworkunifiedNotificationType persType) {
+ return FrameworkunifiedNPRegisterNotification(hApp, pNotification, max_length, persType);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnRegisterNotificationEvent
+/// API to send message to Notification Service to remove a notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnRegisterNotificationEvent(HANDLE hApp, PCSTR pNotification) {
+ return FrameworkunifiedNPUnRegisterNotification(hApp, pNotification);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMSubscribeToNotificationsEvents
+/// API to send message to Notification Service to add multiple subscriptions list for
+/// that notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMSubscribeToNotificationsEvents(HANDLE hApp, const FrameworkunifiedNotificationEvent *pList,
+ UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ SubscribeInfo *pSubscribeList =
+ reinterpret_cast<SubscribeInfo *>(malloc(sizeof(SubscribeInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pSubscribeList[i].notificationName, pList[i].cNotification,
+ sizeof(pSubscribeList[i].notificationName));
+ }
+ eStatus = NPSubscribeToNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pSubscribeList);
+
+ free(pSubscribeList);
+ pSubscribeList = NULL; // mb20110110 Fixed per comment 307
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMSubscribeToNotificationEvent
+/// API to send message to Notification Service to add to subscription list for
+/// that notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMSubscribeToNotificationEvent(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPSubscribeToNotification(pMqInfo->hMsgQ, pApp->cAppName, pNotification);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnsubscribeFromNotificationEvent
+/// API to send message to Notification Service to remove from subscription list for
+/// that notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnsubscribeFromNotificationEvent(HANDLE hApp, PCSTR pNotification) {
+ return FrameworkunifiedNPUnsubscribeFromNotification(hApp, pNotification);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnsubscribeFromNotificationEvents
+/// API to send message to Notification Service to remove from subscription list for
+/// that notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnsubscribeFromNotificationEvents(HANDLE hApp, const FrameworkunifiedNotificationEvent *pList,
+ UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ SubscribeInfo *pSubscribeList =
+ reinterpret_cast<SubscribeInfo *>(malloc(sizeof(SubscribeInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pSubscribeList[i].notificationName, pList[i].cNotification,
+ sizeof(pSubscribeList[i].notificationName));
+ }
+ eStatus = NPUnsubscribeFromNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pSubscribeList);
+
+ free(pSubscribeList);
+ pSubscribeList = NULL; // mb20110110 Fixed per comment 307
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetPersonality
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersonality(HANDLE hApp, PCSTR pUserName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pUserName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPSetPersonality(pMqInfo->hMsgQ, pApp->cAppName, pUserName);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPChangePersonality
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPChangePersonality(HANDLE hApp, PCSTR pUserName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pUserName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPChangePersonality(pMqInfo->hMsgQ, pApp->cAppName, pUserName);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendStopToNSNPP
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendStopToNSNPP(HANDLE hApp, EFrameworkunifiedShutdownType eShutdownType, UI_32 uiStopMsgData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = SendStopToNSNPP(pMqInfo->hMsgQ, pApp->cAppName, eShutdownType, uiStopMsgData);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPGetReadyStatusOfNPP
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPGetReadyStatusOfNPP(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPGetReadyStatusOfNPP(pMqInfo->hMsgQ, pApp->cAppName);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPClearPersistedData
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPClearPersistedData(HANDLE hApp, EFrameworkunifiedClearPersistence eFrameworkunifiedClearPersistenceScope) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ eStatus = NPClearPersistedData(pMqInfo->hMsgQ, pApp->cAppName, eFrameworkunifiedClearPersistenceScope);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetPersistNotfnDefaultValue
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersistNotfnDefaultValue(HANDLE hApp, PCSTR pNotification, PVOID pData,
+ const UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pNotification)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPSetPersistNotfnDefaultValue(pMqInfo->hMsgQ,
+ pApp->cAppName,
+ pNotification,
+ pData,
+ uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetPersistentNotfnType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersistentNotfnType(HANDLE hApp, PCSTR pNotification, EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pNotification)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ eStatus = NPSetPersistentNotfnType(pMqInfo->hMsgQ,
+ pApp->cAppName,
+ pNotification,
+ ePersistCategory);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetFilePersistentType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetFilePersistentType(HANDLE hApp, PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pTag)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPSetFilePersistentType(pMqInfo->hMsgQ,
+ pApp->cAppName,
+ pTag,
+ ePersistCategory);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetFolderPersistentType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetFolderPersistentType(HANDLE hApp, PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pTag)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPSetFolderPersistentType(pMqInfo->hMsgQ,
+ pApp->cAppName,
+ pTag,
+ ePersistCategory);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_session.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_session.cpp
new file mode 100755
index 0000000..7c9935b
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_session.cpp
@@ -0,0 +1,1357 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Framework service protocol session APIs implementation
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string.h>
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/ns_logger_if.h>
+#include <other_service/strlcpy.h>
+#include <utility>
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedOpenService
+//////////////////////////////////////////////////////
+HANDLE FrameworkunifiedOpenService(HANDLE hApp, PCSTR pServiceName) {
+ HANDLE hService = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName) {
+ if (NULL == (hService = FrameworkunifiedMcOpenSender(hApp, pServiceName))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error::hApp:0x%p, %s failed to FrameworkunifiedMcOpenSender", hApp, pServiceName);
+ // LCOV_EXCL_BR_STOP
+ } else {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ frameworkunifiedAddConnectMonitor(hApp, pServiceName, pApp->cAppName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Invalid param. hApp:0x%p, name:0x%p",
+ hApp, pServiceName);
+ }
+
+ return static_cast<HANDLE>(hService);
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedCloseService
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseService(HANDLE hApp, HANDLE hService) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hService)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMsgQ = static_cast<MsgQInfo *>(hService);
+
+ if (eFrameworkunifiedStatusOK != frameworkunifiedDelConnectMonitor(hApp, pMsgQ->cMsgQName, pApp->cAppName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : frameworkunifiedDelConnectMonitor(%s, %s) fail",
+ pMsgQ->cMsgQName != 0 ? pMsgQ->cMsgQName : NULL, pApp->cAppName != 0 ? pApp->cAppName : NULL);
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(hService))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : %s Failed to FrameworkunifiedMcClose",
+ pApp->cAppName != 0 ? pApp->cAppName : NULL);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+HANDLE FrameworkunifiedGenerateSessionHandle(HANDLE hApp, PCSTR pServiceName) {
+ HANDLE l_pSession = NULL;
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pServiceName)) {
+ l_pSession = FrameworkunifiedMcOpenSender(hApp, pServiceName);
+
+ if (NULL != l_pSession) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(l_pSession);
+ pMsgQ->sessionId = FrameworkunifiedGenerateNewSessionId();
+ }
+ }
+
+ return l_pSession;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedOpenSessionWithData
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionWithData(HANDLE hService, PVOID pData, UI_32 length) {
+ return FrameworkunifiedSendMsg(hService, PROTOCOL_OPEN_SESSION_REQ, length, pData);
+}
+
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedOpenSession
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSession(HANDLE hService) {
+ UI_32 l_uiDummy = 0;
+ return FrameworkunifiedSendMsg(hService, PROTOCOL_OPEN_SESSION_REQ, 0, &l_uiDummy);
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedOpenSessionWithDataSync
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionWithDataSync(HANDLE hService, PVOID pData, UI_32 length, OpenSessionAck *ack) {
+ UI_32 rcvLen;
+ return FrameworkunifiedInvokeSync(hService, PROTOCOL_OPEN_SESSION_REQ_SYNC, length, pData, sizeof(OpenSessionAck), ack, &rcvLen);
+}
+
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedOpenSessionSync
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionSync(HANDLE hService, OpenSessionAck *ack) {
+ UI_32 l_uiDummy = 0;
+ UI_32 rcvLen;
+ return FrameworkunifiedInvokeSync(hService, PROTOCOL_OPEN_SESSION_REQ_SYNC, 0, &l_uiDummy, sizeof(OpenSessionAck), ack, &rcvLen);
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedGetSessionHandle
+//////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetOpenSessionHandle(HANDLE hApp) {
+ HANDLE hSession = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ OpenSessionAck tAck;
+
+ if (sizeof(OpenSessionAck) == FrameworkunifiedGetMsgLength(hApp)) {
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedGetMsgDataOfSize(hApp, &tAck, sizeof(tAck))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedGetMsgDataOfSize");
+ } else {
+ if (eFrameworkunifiedStatusOK == tAck.eStatus) {
+ hSession = FrameworkunifiedMcOpenSender(hApp, tAck.cSessionName);
+ if (NULL != hSession) {
+ (reinterpret_cast<MsgQInfo *>(hSession))->sessionId = tAck.sessionId;
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedGetOpenSessionHandle");
+ }
+ }
+
+ return hSession;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedGetOpenSessionSyncHandle
+//////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetOpenSessionSyncHandle(HANDLE hApp, OpenSessionAck *tAck) {
+ HANDLE hSession = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && (NULL != tAck)) {
+ if (eFrameworkunifiedStatusOK == tAck->eStatus) {
+ hSession = FrameworkunifiedMcOpenSender(hApp, tAck->cSessionName);
+ if (NULL != hSession) {
+ (reinterpret_cast<MsgQInfo *>(hSession))->sessionId = tAck->sessionId;
+ }
+ }
+ }
+
+ return hSession;
+}
+
+//////////////////////////////////////////////////////
+/// frameworkunifiedCloseSessionInner
+//////////////////////////////////////////////////////
+static EFrameworkunifiedStatus frameworkunifiedCloseSessionInner(HANDLE hService, HANDLE hSession, CloseSessionAck *ack) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ CloseSessionReq tClose = {};
+
+ if (frameworkunifiedCheckValidMsgQ(hService) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ tClose.sessionId = (reinterpret_cast<MsgQInfo *>(hSession))->sessionId;
+ strlcpy(tClose.cSessionName, (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, sizeof(tClose.cSessionName));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Info : sessionid %d", tClose.sessionId);
+
+ if (NULL != ack) {
+ UI_32 rcvLen;
+ eStatus = FrameworkunifiedInvokeSync(hService, PROTOCOL_CLOSE_SESSION_REQ_SYNC, sizeof(tClose), (PVOID)&tClose,
+ sizeof(CloseSessionAck), ack, &rcvLen);
+ if (rcvLen != sizeof(CloseSessionAck)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : Invalid receive length %d", rcvLen);
+ }
+ } else {
+ eStatus = FrameworkunifiedSendMsg(hService, PROTOCOL_CLOSE_SESSION_REQ, sizeof(tClose), (PVOID)&tClose);
+ }
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ eStatus = FrameworkunifiedMcClose(hSession);
+ hSession = NULL;
+ }
+ }
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedCloseSession
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseSession(HANDLE hService, HANDLE hSession) {
+ return frameworkunifiedCloseSessionInner(hService, hSession, NULL);
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedCloseSessionSync
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseSessionSync(HANDLE hService, HANDLE hSession, CloseSessionAck *ack) {
+ if (NULL == ack) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return frameworkunifiedCloseSessionInner(hService, hSession, ack);
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedGetSessionId -> On Client side
+//////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetSessionId(HANDLE hSession) {
+ if (frameworkunifiedCheckValidMsgQ(hSession)) {
+ return ((reinterpret_cast<MsgQInfo *>(hSession))->sessionId);
+ } else {
+ return MAX_SESSION_ID_VAL;
+ }
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedGetSessionId -> On Client side
+//////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgSessionId(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return pApp->uiSessionId;
+ }
+ return MAX_SESSION_ID_VAL;
+}
+
+
+//////////////////////////////////////////////////////
+/// GenerateNewSessionId -> On Server side
+//////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGenerateNewSessionId() {
+ static UI_16 lastSessionId = 0;
+ lastSessionId++;
+ UI_32 sessionId = (lastSessionId % MAX_SESSION_ID_VAL);
+ return sessionId;
+}
+
+
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedRegisterEvents
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRegisterEvents(HANDLE hSession, PVOID puiEventsArray, UI_32 uiListSize) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (hSession) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS,
+ static_cast<UI_32>(uiListSize * sizeof(uiListSize)), puiEventsArray);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedRegisterEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRegisterEvent(HANDLE hSession, UI_32 uiEvent) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (hSession) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS, sizeof(uiEvent), (PVOID)&uiEvent);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedUnRegisterEvents
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterEvents(HANDLE hSession, PVOID puiEventsArray, UI_32 uiListSize) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (hSession) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS,
+ static_cast<UI_32>(uiListSize * sizeof(uiListSize)), puiEventsArray);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedUnRegisterEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterEvent(HANDLE hSession, UI_32 uiEvent) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (hSession) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS, sizeof(uiEvent), (PVOID)&uiEvent);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedDefineStateEvents
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefineStateEvents(HANDLE hApp, PVOID puiEvents, UI_32 uiListSize) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && puiEvents) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ EventData *l_pEventData = NULL;
+
+ UI_32 l_uiEventId;
+ PUI_32 l_pEventList = (PUI_32)puiEvents;
+
+ for (UI_32 uiCount = 0; uiCount < uiListSize; uiCount++) {
+ l_uiEventId = l_pEventList[uiCount];
+
+ // checks if event exists in state event list
+ if (pApp->publicstateeventtable.end() == pApp->publicstateeventtable.find(l_uiEventId)) {
+ // insert the event in state event list, data is passed as NULL as there is no data published
+ pApp->publicstateeventtable.insert(std::make_pair(l_uiEventId, l_pEventData));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event %d already registered as state event ", l_uiEventId);
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedBroadcastEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedBroadcastEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ eStatus = FrameworkunifiedPublishEvent(hApp, uiEventId, NULL, pData, uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedPublishEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishEvent(HANDLE hApp, UI_32 uiEventId, PCSTR pClientName, PCVOID pData, UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus eRetStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ EventTable::iterator e_iterator;
+ ServiceSessionIdListTable::iterator ssidl_iterator;
+
+ PCSTR l_cServiceName = "";
+
+ // set the data, if event is a state events
+ UpdatePublicStateEventData(hApp, uiEventId, pData, uiLength);
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // check if event is registered by client/s
+ e_iterator = pApp->eventtable.find(uiEventId);
+
+ if (pApp->eventtable.end() != e_iterator) {
+ // for loop for event table
+ for (ssidl_iterator = e_iterator->second.begin();
+ ssidl_iterator != e_iterator->second.end();
+ ssidl_iterator++) {
+ l_cServiceName = ssidl_iterator->first.c_str();
+
+ if (NULL != pClientName) {
+ // send message to only specified client
+ if (!std::strcmp(pClientName, l_cServiceName)) {
+ eStatus = SendEventMessage(hApp, ssidl_iterator->second, uiEventId, l_cServiceName, pData, uiLength);
+ break;
+ }
+ } else {
+ // send message to all registered client
+ eRetStatus = SendEventMessage(hApp, ssidl_iterator->second, uiEventId, l_cServiceName, pData, uiLength);
+ if (eFrameworkunifiedStatusOK != eRetStatus) {
+ eStatus = eRetStatus;
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "No subscriber has subscribed for event %d.", uiEventId);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// UpdatePublicStateEventData
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus UpdatePublicStateEventData(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if ((NULL == pData) && (uiLength > 0)) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ PublicStateEventTable::iterator se_iterator;
+ EventData *l_pEventData = NULL;
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // set the data, if event is a state events
+ se_iterator = pApp->publicstateeventtable.find(uiEventId);
+ if (pApp->publicstateeventtable.end() != se_iterator) {
+ l_pEventData = se_iterator->second;
+ if (NULL != l_pEventData) {
+ if (NULL != l_pEventData->pData) {
+ delete[](static_cast<PCHAR>(l_pEventData->pData));
+ (se_iterator->second)->pData = NULL;
+ }
+
+ delete l_pEventData;
+ se_iterator->second = NULL;
+ }
+
+ l_pEventData = new(std::nothrow) EventData();
+ /*
+ * @todo
+ * UpdatePublicStateEventData() in the pApp->publicstateeventtable
+ * The data area is being created, but there is no process to release.
+ */
+ if (NULL != l_pEventData) {
+ l_pEventData->uiLength = uiLength;
+ // LCOV_EXCL_BR_START 6:pData is checked in the top of this function, it should be not NULL here.
+ if (NULL == pData) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6:pData is checked in the top of this function, it should be not NULL here.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_pEventData->pData = NULL;
+ // LCOV_EXCL_STOP
+ } else {
+ l_pEventData->pData = new(std::nothrow) CHAR[uiLength];
+ if (NULL != l_pEventData->pData) {
+ std::memset(l_pEventData->pData, 0, uiLength);
+ std::memcpy(l_pEventData->pData, pData, uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+
+ se_iterator->second = l_pEventData;
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// SendEventMessage
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendEventMessage(HANDLE hApp,
+ const SessionIdList &vSessionIdList,
+ UI_32 uiEventId,
+ PCSTR cServiceName,
+ PCVOID pData,
+ UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus eStatusSendMsg = eFrameworkunifiedStatusOK;
+
+ UI_32 l_uiSessionId = 0;
+ HANDLE l_hClientHandle = NULL;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != cServiceName)) {
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < vSessionIdList.size();
+ l_uiCount++) {
+ l_uiSessionId = vSessionIdList[l_uiCount];
+ l_hClientHandle = GetMsgQueueHandle(hApp, cServiceName, l_uiSessionId);
+
+ // send message to all the registered sessions of the service
+ if (NULL != l_hClientHandle) {
+ if (eFrameworkunifiedStatusOK != (eStatusSendMsg = FrameworkunifiedSendMsg(l_hClientHandle, uiEventId, uiLength, pData))) {
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "FrameworkunifiedSendMsg failed for EventID %d to service %s, status %d",
+ uiEventId, cServiceName, eStatusSendMsg);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send event %d to service %s, session %d. NULL handle found.",
+ uiEventId, cServiceName, l_uiSessionId);
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// RemoveEventEntryFromEventTable
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus RemoveEventEntryFromEventTable(HANDLE hApp, UI_32 uiEventId,
+ PCSTR cServiceName, const UI_32 uiSessionId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != cServiceName)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ EventTable::iterator e_iterator;
+ ServiceSessionIdListTable::iterator ssidl_iterator;
+
+ // event table = event id, service name, vector of session ids
+ // check if event is registered by client/s
+ e_iterator = pApp->eventtable.find(uiEventId);
+
+ if (pApp->eventtable.end() != e_iterator) {
+ ssidl_iterator = e_iterator->second.find(cServiceName);
+
+ if (e_iterator->second.end() != ssidl_iterator) {
+ // search for the session id in list of registered session of service with the event uiEventId
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < ssidl_iterator->second.size();
+ l_uiCount++) {
+ if (uiSessionId == ssidl_iterator->second[l_uiCount]) {
+ ssidl_iterator->second.erase(ssidl_iterator->second.begin() + l_uiCount);
+ break;
+ }
+ }
+
+ // no other session of service cServiceName is registered with the event uiEventId
+ if (ssidl_iterator->second.empty()) {
+ e_iterator->second.erase(ssidl_iterator);
+
+ // no other session is registered for the event uiEventId
+ if (e_iterator->second.empty()) {
+ pApp->eventtable.erase(e_iterator);
+ }
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////
+// Function : CleanAllEventsOfSession
+////////////////////////////////////////////
+EFrameworkunifiedStatus CleanAllEventsOfSession(HANDLE hApp, PCSTR serviceName, UI_32 sessionId) {
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != serviceName)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ ServiceSessionHandleTable::iterator ssh_iterator;
+ SessionToEventInfo::iterator sh_iterator;
+ HANDLE l_pClientHandle = NULL;
+ SessionEventInfo *l_ptSessionEventInfo = NULL;
+
+ // check whether client has registered for private event/s
+ ssh_iterator = pApp->servicesessionhandletable.find(serviceName);
+
+ if (pApp->servicesessionhandletable.end() != ssh_iterator) {
+ // get the table of session id and session handle of the received service over which private events are
+ // registered
+ sh_iterator = ssh_iterator->second.find(sessionId);
+
+ // client has registered for private event/s over this session
+ if (ssh_iterator->second.end() != sh_iterator) {
+ l_ptSessionEventInfo = sh_iterator->second;
+
+ if (NULL != l_ptSessionEventInfo) {
+ l_pClientHandle = l_ptSessionEventInfo->m_hSession;
+ if (NULL != l_pClientHandle) {
+ // close the session handle
+ eStatus = FrameworkunifiedMcClose(l_pClientHandle);
+ l_ptSessionEventInfo->m_hSession = NULL;
+ }
+ // Remove all the event entries from Event registry table
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_ptSessionEventInfo->m_vEvents.size();
+ l_uiCount++) {
+ (VOID)RemoveEventEntryFromEventTable(hApp,
+ l_ptSessionEventInfo->m_vEvents[l_uiCount],
+ serviceName,
+ sessionId);
+ }
+ l_ptSessionEventInfo->m_vEvents.clear(); // clear the event list
+ delete l_ptSessionEventInfo;
+ sh_iterator->second = NULL; // l_ptSessionEventInfo
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Deleting session event info entry for service: %s, session id: %d.",
+ serviceName, sessionId);
+ // remove the entry from SessionHandle table
+ ssh_iterator->second.erase(sh_iterator);
+
+ // remove the entry from ServiceSessionHandle table if this service have not registered for
+ // private events over other session
+ if (ssh_iterator->second.empty()) {
+ pApp->servicesessionhandletable.erase(ssh_iterator);
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid application handle or service name NULL");
+ }
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// RemoveEntryFromSessionEventInfoTable
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus RemoveEntryFromSessionEventInfoTable(HANDLE hApp, PCSTR serviceName, UI_32 sessionId, UI_32 eventId) {
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != serviceName)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ ServiceSessionHandleTable::iterator ssh_iterator;
+ SessionToEventInfo::iterator sh_iterator;
+ HANDLE l_pClientHandle = NULL;
+ SessionEventInfo *l_ptSessionEventInfo = NULL;
+
+ // check whether client has registered for private event/s
+ ssh_iterator = pApp->servicesessionhandletable.find(serviceName);
+
+ if (pApp->servicesessionhandletable.end() != ssh_iterator) {
+ // get the table of session id and session handle of the received service over which private events are
+ // registered
+ sh_iterator = ssh_iterator->second.find(sessionId);
+
+ // client has registered for private event/s over this session
+ if (ssh_iterator->second.end() != sh_iterator) {
+ l_ptSessionEventInfo = sh_iterator->second;
+
+ if (NULL != l_ptSessionEventInfo) {
+ // Remove event entry from session event info table
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_ptSessionEventInfo->m_vEvents.size();
+ l_uiCount++) {
+ if (eventId == l_ptSessionEventInfo->m_vEvents[l_uiCount]) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Removing session event info entry for "
+ "service:%s, session id:%d. event:%d",
+ serviceName, sessionId, eventId);
+ l_ptSessionEventInfo->m_vEvents.erase(l_ptSessionEventInfo->m_vEvents.begin() + l_uiCount);
+ break;
+ }
+ }
+
+ if (l_ptSessionEventInfo->m_vEvents.empty()) {
+ l_pClientHandle = l_ptSessionEventInfo->m_hSession;
+ if (NULL != l_pClientHandle) {
+ // close the session handle
+ eStatus = FrameworkunifiedMcClose(l_pClientHandle);
+ l_ptSessionEventInfo->m_hSession = NULL;
+ }
+ delete l_ptSessionEventInfo;
+ sh_iterator->second = NULL; // l_ptSessionEventInfo
+
+ // remove the entry from SessionHandle table
+ ssh_iterator->second.erase(sh_iterator);
+ }
+ }
+
+ // remove the entry from ServiceSessionHandle table if this service have not registered for
+ // private events over other session
+ if (ssh_iterator->second.empty()) {
+ pApp->servicesessionhandletable.erase(ssh_iterator);
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid application handle status:: %d", eStatus);
+ }
+
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedDefinePublicStateEvents
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefinePublicStateEvents(HANDLE hApp, PUI_32 puiEvents, UI_32 uiListSize) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != puiEvents) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ UI_32 l_uiEventId;
+
+ for (UI_32 uiCount = 0; uiCount < uiListSize; uiCount++) {
+ l_uiEventId = puiEvents[uiCount];
+
+ // checks if event exists in state event list
+ if (pApp->publicstateeventtable.end() == pApp->publicstateeventtable.find(l_uiEventId)) {
+ EventData *l_pEventData = NULL;
+ // insert the event in state event list, data is passed as NULL as there is no data published
+ pApp->publicstateeventtable.insert(std::make_pair(l_uiEventId, l_pEventData));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event %d already registered as public state event ", l_uiEventId);
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedDefinePrivateStateEvents
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefinePrivateStateEvents(HANDLE hApp, PUI_32 puiEvents, UI_32 uiListSize) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != puiEvents) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ UI_32 l_uiEventId = 0;
+
+ for (UI_32 uiCount = 0; uiCount < uiListSize; uiCount++) {
+ l_uiEventId = puiEvents[uiCount];
+
+ // checks if event exists in state event list
+ if (pApp->privatestateeventtable.end() == pApp->privatestateeventtable.find(l_uiEventId)) {
+ ServiceSessionEventData servicesessioneventdata;
+ pApp->privatestateeventtable.insert(std::make_pair(l_uiEventId, servicesessioneventdata));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event %d already registered as private state event", l_uiEventId);
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventWithCallback
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventWithCallback(HANDLE hApp, UI_32 uiCmd, CbFuncPtr fpOnCmd, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName,
+ uiCmd,
+ fpOnCmd,
+ hSession))) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS, sizeof(UI_32), (PVOID)&uiCmd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedAttachCallbackToDispatcher for "
+ "PROTOCOL_REGISTER_EVENTS Failed Status:: %d", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventsWithCallbacks
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventsWithCallbacks(HANDLE hApp, const FrameworkunifiedProtocolCallbackHandler *pMsgHandler,
+ UI_32 uiHandlerCount, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == pMsgHandler) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ } else if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ /**
+ * @todo
+ * If the CbFuncPtr in the pMsgHandler is set to NULL, the expected value is eFrameworkunifiedStatusInvldParam,
+ * but eFrameworkunifiedStatusOK is returned in the implementation.
+ * [Proposed measures]
+ * Exit by referring to the return code of the FrameworkunifiedAttachCallbacksToDispatcher executed in the FrameworkunifiedSubscribeToSessionEventsWithCallbacks.
+ */
+ /**
+ * @todo
+ * The behavior when NULL is set for a CbFuncPtr in a pMsgHandler in which more than one callback message is registered
+ * is not specified in the specifications.
+ * Ex: Prepare a pMsgHandler in which three callback information are registered,
+ * and specify NULL as the callback function pointer of the second callback information, and execute it.
+ * - Register the first callback function.
+ * - The second callback function is not registered with an error.
+ * - It is unspecified whether the third callback function is registered.
+ * [Proposed measures]
+ * Specifies that if there is callback information including NULL in the callback function pointer in pMsgHandler,
+ * the callback information will not be registered from the element following that callback function pointer.
+ */
+ eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName,
+ pMsgHandler,
+ uiHandlerCount,
+ hSession);
+ UI_32 l_uiCmdList[uiHandlerCount]; // NOLINT (readability/nolint)
+ for (UI_32 l_uiCnt = 0; l_uiCnt < uiHandlerCount; l_uiCnt++) {
+ l_uiCmdList[l_uiCnt] = pMsgHandler[l_uiCnt].iCmd;
+ }
+
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS,
+ static_cast<UI_32>(uiHandlerCount * sizeof(UI_32)), l_uiCmdList);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventWithCallback(HANDLE hApp, UI_32 uiEvent, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS, sizeof(uiEvent), (PVOID)&uiEvent);
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName,
+ uiEvent,
+ hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedDetachCallbackFromDispatcher failed status:: %d", eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : Failed to send PROTOCOL_UNREGISTER_EVENTS request to service:: %d",
+ eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventsWithCallbacks(HANDLE hApp, PUI_32 puiEventsArray, UI_32 uiListSize,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS, static_cast<UI_32>(uiListSize * sizeof(uiListSize)),
+ puiEventsArray);
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName,
+ puiEventsArray,
+ uiListSize,
+ hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedDetachCallbackFromDispatcher failed status:: %d", eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : Failed to send PROTOCOL_UNREGISTER_EVENTS request to service:: %d",
+ eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedPublishPrivateEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishPrivateEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ EventTable::iterator e_iterator;
+ ServiceSessionIdListTable::iterator ssidl_iterator;
+
+ PCSTR l_cServiceName = "";
+ BOOL l_bIsPublished = FALSE;
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // set the data, if event is a public state events
+ UpdatePrivateStateEventData(hApp,
+ uiEventId,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName,
+ (reinterpret_cast<MsgQInfo *>(hSession))->sessionId,
+ pData,
+ uiLength);
+
+ // check if event is registered by client/s
+ e_iterator = pApp->eventtable.find(uiEventId);
+
+ if (pApp->eventtable.end() != e_iterator) {
+ // for loop for event table
+ for (ssidl_iterator = e_iterator->second.begin();
+ ssidl_iterator != e_iterator->second.end();
+ ssidl_iterator++) {
+ l_cServiceName = ssidl_iterator->first.c_str();
+
+ // send message to only specified client
+ if (!std::strcmp(l_cServiceName, (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName)) {
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < ssidl_iterator->second.size();
+ l_uiCount++) {
+ if ((reinterpret_cast<MsgQInfo *>(hSession))->sessionId == ssidl_iterator->second[l_uiCount]) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(hSession, uiEventId, uiLength, pData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed for Event %d", uiEventId);
+ }
+
+ l_bIsPublished = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (l_bIsPublished) {
+ break;
+ }
+ }
+
+ if (!l_bIsPublished) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Failed to publish event %d to client [%s], session: [%d]. "
+ "Client not subscribed to the event on specified session.",
+ uiEventId, (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName != 0 ? \
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName : NULL,
+ (reinterpret_cast<MsgQInfo *>(hSession))->sessionId);
+ eStatus = eFrameworkunifiedStatusServNotFound;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Client %s is not subscribed to Event %d, session: [%d]",
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, uiEventId,
+ (reinterpret_cast<MsgQInfo *>(hSession))->sessionId);
+ eStatus = eFrameworkunifiedStatusServNotFound;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedPublishPublicEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishPublicEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus eRetStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ EventTable::iterator e_iterator;
+ ServiceSessionIdListTable::iterator ssidl_iterator;
+
+ PCSTR l_cServiceName = "";
+
+ // set the data, if event is a state events
+ UpdatePublicStateEventData(hApp, uiEventId, pData, uiLength);
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // check if event is registered by client/s
+ e_iterator = pApp->eventtable.find(uiEventId);
+
+ if (pApp->eventtable.end() != e_iterator) {
+ // for loop for event table
+ for (ssidl_iterator = e_iterator->second.begin();
+ ssidl_iterator != e_iterator->second.end();
+ ssidl_iterator++) {
+ l_cServiceName = ssidl_iterator->first.c_str();
+
+ eRetStatus = SendEventMessage(hApp, ssidl_iterator->second, uiEventId, l_cServiceName, pData, uiLength);
+ if (eFrameworkunifiedStatusOK != eRetStatus) {
+ eStatus = eRetStatus;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "No client subscribed to EventID %d.", uiEventId);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// UpdatePrivateStateEventData
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus UpdatePrivateStateEventData(HANDLE hApp, UI_32 uiEventId, PCSTR pClientName, UI_32 uiSessionId,
+ PCVOID pData,
+ UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((NULL == pData) && (uiLength > 0)) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ if ((eFrameworkunifiedStatusOK == eStatus) && (frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pClientName)) {
+ PrivateStateEventTable::iterator pse_iterator;
+ ServiceSessionEventData::iterator ssed_iterator;
+ SessionEventData::iterator sed_iterator;
+
+ EventData *l_pEventData = NULL;
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // set the data, if event is a state events
+ pse_iterator = pApp->privatestateeventtable.find(uiEventId);
+ if (pApp->privatestateeventtable.end() != pse_iterator) {
+ ssed_iterator = (pse_iterator->second).find(pClientName);
+
+ if ((pse_iterator->second).end() != ssed_iterator) {
+ sed_iterator = (ssed_iterator->second).find(uiSessionId);
+ if ((ssed_iterator->second).end() != sed_iterator) {
+ l_pEventData = sed_iterator->second;
+
+ if (NULL != l_pEventData) {
+ if (NULL != l_pEventData->pData) {
+ delete[](static_cast<PCHAR>(l_pEventData->pData));
+ (sed_iterator->second)->pData = NULL;
+ }
+
+ delete l_pEventData;
+ sed_iterator->second = NULL;
+ }
+
+ l_pEventData = new(std::nothrow) EventData();
+
+ if (NULL != l_pEventData) {
+ l_pEventData->uiLength = uiLength;
+
+ if (NULL == pData) {
+ l_pEventData->pData = NULL;
+ } else {
+ l_pEventData->pData = new(std::nothrow) CHAR[uiLength];
+ if (NULL != l_pEventData->pData) {
+ std::memset(l_pEventData->pData, 0, uiLength);
+ std::memcpy(l_pEventData->pData, pData, uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ l_pEventData->uiLength = 0;
+ }
+ }
+
+ sed_iterator->second = l_pEventData;
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else { // if client has not yet subscribed to this event over the session uiSessionId
+ l_pEventData = new(std::nothrow) EventData();
+
+ if (NULL != l_pEventData) {
+ l_pEventData->uiLength = uiLength;
+
+ if (NULL == pData) {
+ l_pEventData->pData = NULL;
+ } else {
+ l_pEventData->pData = new(std::nothrow) CHAR[uiLength];
+ if (NULL != l_pEventData->pData) {
+ std::memset(l_pEventData->pData, 0, uiLength);
+ std::memcpy(l_pEventData->pData, pData, uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+
+ (ssed_iterator->second).insert(std::make_pair(uiSessionId, l_pEventData));
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ } else { // if client has not yet subscribed to this event
+ SessionEventData sessionEventData;
+
+ l_pEventData = new(std::nothrow) EventData();
+
+ if (NULL != l_pEventData) {
+ l_pEventData->uiLength = uiLength;
+
+ if (NULL == pData) {
+ l_pEventData->pData = NULL;
+ } else {
+ l_pEventData->pData = new(std::nothrow) CHAR[uiLength];
+ if (NULL != l_pEventData->pData) {
+ std::memset(l_pEventData->pData, 0, uiLength);
+ std::memcpy(l_pEventData->pData, pData, uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ l_pEventData->uiLength = 0;
+ }
+ }
+ sessionEventData.insert(std::make_pair(uiSessionId, l_pEventData));
+
+ (pse_iterator->second).insert(std::make_pair(pClientName, sessionEventData));
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// DeleteSessionEventData
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus DeleteSessionEventData(HANDLE hApp, PCSTR pClientName, UI_32 uiSessionId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ // map: eventid -> servicename -> sessionid -> eventdata(data, length)
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pClientName) {
+ PrivateStateEventTable::iterator pse_iterator;
+ ServiceSessionEventData::iterator ssed_iterator;
+ SessionEventData::iterator sed_iterator;
+
+ EventData *l_pEventData = NULL;
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // delete the private event data associated with the service over this session
+ for (pse_iterator = pApp->privatestateeventtable.begin();
+ pse_iterator != pApp->privatestateeventtable.end();
+ ++pse_iterator) {
+ ssed_iterator = (pse_iterator->second).find(pClientName);
+
+ if ((pse_iterator->second).end() != ssed_iterator) {
+ sed_iterator = (ssed_iterator->second).find(uiSessionId);
+ if ((ssed_iterator->second).end() != sed_iterator) {
+ l_pEventData = sed_iterator->second;
+
+ if (NULL != l_pEventData) {
+ if (NULL != l_pEventData->pData) {
+ delete[](static_cast<PCHAR>(l_pEventData->pData));
+ (sed_iterator->second)->pData = NULL;
+ }
+
+ delete l_pEventData;
+ sed_iterator->second = NULL;
+ }
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// Returns the number of session opened by the server for one client
+//////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetNumberOfSession(HANDLE hApp, PCSTR strServiceName) {
+ UI_32 l_uiSessionCount = 0;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ Services::iterator s_iterator = pApp->services.find(strServiceName);
+ if (s_iterator != pApp->services.end()) {
+ l_uiSessionCount = static_cast<UI_32>((s_iterator->second).size());
+ }
+ }
+
+ return l_uiSessionCount;
+}
+
+//////////////////////////////////////////////////////
+/// Sets the handle in the Application Framework
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetSessionHandle(HANDLE hApp, PCSTR strServiceName, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_uiSessionId = 0;
+ if (frameworkunifiedCheckValidMsgQ(hSession) && NULL != strServiceName && frameworkunifiedCheckValidAppHandle(hApp) &&
+ 0 != std::strlen(strServiceName)) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(hSession);
+
+ // Get session Id
+ l_uiSessionId = pMsgQ->sessionId;
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ ServiceSessionTable::iterator session_iterator;
+ SessionHandleTable::iterator session_handle_iterator;
+
+ // Find the service name
+ session_iterator = pApp->sessiontable.find(strServiceName);
+ if (session_iterator == pApp->sessiontable.end()) {
+ pApp->sessiontable.insert(std::make_pair(strServiceName, SessionHandleTable()));
+ }
+
+ // Find the session id
+ session_handle_iterator = pApp->sessiontable[strServiceName].find(l_uiSessionId);
+ if (session_handle_iterator != pApp->sessiontable[strServiceName].end()) {
+ pApp->sessiontable[strServiceName].erase(l_uiSessionId);
+ }
+
+ // Set the session handle
+ pApp->sessiontable[strServiceName].insert(std::make_pair(l_uiSessionId, hSession));
+
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// reads the handle from the Application Framework
+//////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetSessionHandle(HANDLE hApp, PCSTR strServiceName, UI_32 uiSessionId) {
+ HANDLE hSession = NULL;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && strServiceName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ ServiceSessionTable::iterator session_iterator;
+ SessionHandleTable::iterator session_handle_iterator;
+
+ // Find the service name
+ session_iterator = pApp->sessiontable.find(strServiceName);
+ if (session_iterator != pApp->sessiontable.end()) {
+ // Find the session id
+ session_handle_iterator = pApp->sessiontable[strServiceName].find(uiSessionId);
+ if (session_handle_iterator != pApp->sessiontable[strServiceName].end()) {
+ // Fetch the session handle
+ hSession = session_handle_iterator->second;
+ }
+ }
+ }
+ return hSession;
+}
+//////////////////////////////////////////////////////
+/// Close the handle stored in the Application Framework
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRemoveSessionHandle(HANDLE hApp, PCSTR strServiceName, UI_32 uiSessionId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && strServiceName && 0 != std::strlen(strServiceName)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ pApp->sessiontable[strServiceName].erase(uiSessionId);
+ if (0 == pApp->sessiontable[strServiceName].size()) {
+ // If no entry is available for current service then remove the servicename
+ pApp->sessiontable.erase(strServiceName);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedGetSession|Name -> On Client side
+//////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetSessionName(HANDLE hSession) {
+ if (frameworkunifiedCheckValidMsgQ(hSession)) {
+ return ((reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName);
+ } else {
+ return NULL;
+ }
+}
+
+
+HANDLE FrameworkunifiedGetCurrentSessionHandle(HANDLE hApp) {
+ HANDLE hSession = NULL;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ UI_32 l_uiSessionId = FrameworkunifiedGetMsgSessionId(hApp);
+ PCSTR pRequester = FrameworkunifiedGetMsgSrc(hApp);
+
+ hSession = FrameworkunifiedGetSessionHandle(hApp, pRequester, l_uiSessionId);
+ }
+ return hSession;
+}
+
+HANDLE FrameworkunifiedCreateSession(HANDLE hApp, PCSTR pSessionName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ HANDLE hSession = NULL;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pSessionName && strlen(pSessionName)) {
+ hSession = FrameworkunifiedGenerateSessionHandle(hApp, pSessionName);
+ if (hSession) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSetSessionHandle(hApp, pSessionName, hSession))) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "Close session failed");
+ }
+ hSession = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "FrameworkunifiedCreateSession Failed Status:0x%x ", eStatus);
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return hSession;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedDestroySession(HANDLE hApp, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ UI_32 uiSessionId = (reinterpret_cast<MsgQInfo *>(hSession))->sessionId;
+ CHAR pRequester[MAX_NAME_SIZE_APP] = {};
+ strncpy(pRequester, (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, sizeof(pRequester) - 1);
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "Close session failed. Status: %d", eStatus);
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedRemoveSessionHandle(hApp, pRequester, uiSessionId))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "Remove session failed. Status: %d", eStatus);
+ }
+
+ DeleteSessionEventData(hApp, pRequester, uiSessionId);
+ }
+
+ return eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_sync.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_sync.cpp
new file mode 100755
index 0000000..80eec1f
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_sync.cpp
@@ -0,0 +1,439 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeService
+/// \brief This file contains the implementation for the synchronization
+/// API's class.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_framework_sync.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_logger_if.h>
+#include <string>
+#include <algorithm>
+#include <utility>
+#include "frameworkunified_framework_core.h"
+
+/// initialization of static members of class
+CFrameworkunifiedSyncData *CFrameworkunifiedSyncData::m_psSyncData = NULL;
+
+pthread_spinlock_t CFrameworkunifiedSyncData::m_pSyncLock;
+static pthread_mutex_t g_instance_lock = PTHREAD_MUTEX_INITIALIZER;
+
+// Template function to invoke callback function of CFrameworkunifiedSyncData class
+template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)> EFrameworkunifiedStatus SyncDataCallback(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ C *l_pClass = C::FrameworkunifiedGetSyncDataInstance();
+
+ if (NULL != l_pClass) {
+ l_eStatus = (l_pClass->*M)(hThread);
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedSyncData
+/// Constructor of CFrameworkunifiedSyncData class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedSyncData::CFrameworkunifiedSyncData(): m_bSyncThreadStarted(FALSE),
+ m_mSyncDataMap(NULL),
+ m_hSyncThreadAppHandle(NULL),
+ m_hAppHandle(NULL),
+ m_hSyncThreadMsgQHandle(NULL) {
+ pthread_spin_init(&m_pSyncLock, 1);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedSyncData
+/// Destructor of CFrameworkunifiedSyncData class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedSyncData::~CFrameworkunifiedSyncData() {
+ pthread_spin_destroy(&m_pSyncLock);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedStartNotificationSync
+/// This method is used to start the synchronization notification thread.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedStartNotificationSync(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ pthread_spin_lock(&m_pSyncLock);
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ m_hAppHandle = hApp;
+ std::string l_cThreadName = FrameworkunifiedGetAppName(hApp);
+ // l_cThreadName.append("SyncThread");
+ std::reverse(l_cThreadName.begin(), l_cThreadName.end());
+
+ if (NULL == m_hSyncThreadMsgQHandle) {
+ // Create Sync Thread
+ m_hSyncThreadMsgQHandle = FrameworkunifiedCreateChildThread(hApp,
+ l_cThreadName.c_str(),
+ SyncDataCallback<CFrameworkunifiedSyncData,
+ &CFrameworkunifiedSyncData::FrameworkunifiedSyncDataThreadStart>,
+ SyncDataCallback<CFrameworkunifiedSyncData,
+ &CFrameworkunifiedSyncData::FrameworkunifiedSyncDataThreadStop>);
+ if (NULL != m_hSyncThreadMsgQHandle) {
+ if (FALSE == m_bSyncThreadStarted) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(hApp,
+ m_hSyncThreadMsgQHandle,
+ 0,
+ NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Failed to start Thread.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, " Sync Data Thread Started");
+ m_bSyncThreadStarted = TRUE;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusThreadAlreadyRunning;
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Sync Data Thread Message Queue Null");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusThreadAlreadyRunning;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ pthread_spin_unlock(&m_pSyncLock);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedStartNotificationSync
+/// This method is used to stop the synchronization notification thread.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedStopNotificationSync(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (NULL != m_hSyncThreadMsgQHandle) {
+ pthread_spin_lock(&m_pSyncLock);
+ if (eFrameworkunifiedStatusOK != (l_eStatus = (FrameworkunifiedStopChildThread(hApp,
+ m_hSyncThreadMsgQHandle,
+ 0,
+ NULL)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread Sync Thread Failed.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "FrameworkunifiedStopChildThread Sync Thread Success.");
+ m_bSyncThreadStarted = FALSE;
+ }
+ pthread_spin_unlock(&m_pSyncLock);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusThreadNotExist;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetSyncDataInstance
+/// This function is used to get the singleton instance of class.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedSyncData *CFrameworkunifiedSyncData::FrameworkunifiedGetSyncDataInstance() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (NULL == m_psSyncData) {
+ pthread_mutex_lock(&g_instance_lock);
+ if (NULL == m_psSyncData) {
+ CFrameworkunifiedSyncData *l_pFrameworkunifiedSyncData = new(std::nothrow)CFrameworkunifiedSyncData();
+ m_psSyncData = l_pFrameworkunifiedSyncData;
+ }
+ pthread_mutex_unlock(&g_instance_lock);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return m_psSyncData;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedReleaseSyncDataInstance
+/// This function is used to release the instance of class.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedReleaseSyncDataInstance() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_psSyncData) {
+ pthread_mutex_lock(&g_instance_lock);
+ if (NULL != m_psSyncData) {
+ delete m_psSyncData;
+ m_psSyncData = NULL;
+ }
+ pthread_mutex_unlock(&g_instance_lock);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSyncDataThreadStart
+/// This function is callback function on the start of the sync thread.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedSyncDataThreadStart(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hThread) {
+ // Set Sync Thread Handle
+ m_hSyncThreadAppHandle = hThread;
+
+ if (NULL == m_mSyncDataMap) {
+ m_mSyncDataMap = new(std::nothrow)TSyncDataPacketList();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSyncDataThreadStop
+/// This function is callback function on the stop of the sync thread.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedSyncDataThreadStop(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (NULL != m_mSyncDataMap) {
+ for (TSyncDataPacketItr l_itSyncDataPacketItr = m_mSyncDataMap->begin() ;
+ l_itSyncDataPacketItr != m_mSyncDataMap->end();) {
+ SFrameworkunifiedSyncDataPacket *l_ptDataPacket = l_itSyncDataPacketItr->second;
+
+ if (NULL != l_ptDataPacket) {
+ if (NULL != l_ptDataPacket->m_pNotificationData) {
+ delete[](static_cast<PCHAR>(l_ptDataPacket->m_pNotificationData));
+ l_ptDataPacket->m_pNotificationData = NULL;
+ }
+ delete l_ptDataPacket;
+ l_ptDataPacket = NULL;
+ m_mSyncDataMap->erase(l_itSyncDataPacketItr++);
+ } else {
+ l_itSyncDataPacketItr++;
+ }
+ }
+
+ delete m_mSyncDataMap;
+ m_mSyncDataMap = NULL;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusExit;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeNotificationWithDataSync
+/// This function is used to subscribe to notifications.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedSubscribeNotificationWithDataSync(const std::string &f_cNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ pthread_spin_lock(&m_pSyncLock);
+ if (TRUE != f_cNotification.empty() && NULL != m_hSyncThreadAppHandle) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(
+ m_hSyncThreadAppHandle, // Thread Application handle
+ f_cNotification.c_str(), // Notification
+ SyncDataCallback<CFrameworkunifiedSyncData,
+ &CFrameworkunifiedSyncData::FrameworkunifiedSyncDataNotifCallback>))) { // Callback Function
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSubscribeNotificationWithCallback Sync Notification Data failed.");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "FrameworkunifiedSubscribeNotificationWithCallback Sync Notification Data success.");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ pthread_spin_unlock(&m_pSyncLock);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeNotificationWithDataSync
+/// This function is used to unsubscribe to notifications.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedUnSubscribeNotificationWithDataSync(const std::string &f_cNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ pthread_spin_lock(&m_pSyncLock);
+ if (TRUE != f_cNotification.empty() && NULL != m_hSyncThreadAppHandle) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedUnsubscribeNotificationWithCallback
+ (m_hSyncThreadAppHandle, // Thread Application Handle
+ f_cNotification.c_str()))) { // Notification
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedUnsubscribeNotificationWithCallback failed.");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "FrameworkunifiedUnsubscribeNotificationWithCallback success.");
+
+ TSyncDataPacketItr l_itSycDataPacketItr = m_mSyncDataMap->find(f_cNotification);
+ // Delete the notification data
+ if (m_mSyncDataMap->end() != l_itSycDataPacketItr) {
+ SFrameworkunifiedSyncDataPacket *l_ptDataPacket = l_itSycDataPacketItr->second;
+ if (NULL != l_ptDataPacket && NULL != l_ptDataPacket->m_pNotificationData) {
+ delete[](static_cast<PCHAR>(l_ptDataPacket->m_pNotificationData));
+ l_ptDataPacket->m_pNotificationData = NULL;
+ delete l_ptDataPacket;
+ l_ptDataPacket = NULL;
+ m_mSyncDataMap->erase(l_itSycDataPacketItr);
+ }
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ pthread_spin_unlock(&m_pSyncLock);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSyncDataNotifCallback
+/// This function is callback to notifications on publication of notifications.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedSyncDataNotifCallback(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == hThread) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ PCSTR l_pcLastNotification = FrameworkunifiedGetLastNotification(hThread);
+
+ if (NULL == l_pcLastNotification || 0 == std::strlen(l_pcLastNotification)) {
+ return eFrameworkunifiedStatusInvldNotification;
+ }
+
+ UI_32 l_uiBufferSize = FrameworkunifiedGetMsgLength(hThread);
+ PVOID l_pDataBuffer = new(std::nothrow)CHAR[l_uiBufferSize];
+
+ if ((NULL != l_pDataBuffer) &&
+ (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hThread, l_pDataBuffer, l_uiBufferSize, eSMRRelease))) {
+ SFrameworkunifiedSyncDataPacket *l_ptDataPacket = NULL;
+
+ pthread_spin_lock(&m_pSyncLock);
+
+ TSyncDataPacketItr l_itSycDataPacketItr = m_mSyncDataMap->find(l_pcLastNotification);
+ // Delete the last notification data
+ if (m_mSyncDataMap->end() == l_itSycDataPacketItr) {
+ l_ptDataPacket = new(std::nothrow)SFrameworkunifiedSyncDataPacket();
+ } else {
+ l_ptDataPacket = l_itSycDataPacketItr->second;
+ if (NULL != l_ptDataPacket && NULL != l_ptDataPacket->m_pNotificationData) {
+ delete[](static_cast<PCHAR>(l_ptDataPacket->m_pNotificationData));
+ l_ptDataPacket->m_pNotificationData = NULL;
+ }
+ }
+
+ if (NULL != l_ptDataPacket) {
+ l_ptDataPacket->m_pNotificationData = l_pDataBuffer;
+ l_ptDataPacket->m_uiDataSize = l_uiBufferSize;
+ l_ptDataPacket->m_tTimeStamp = time(NULL);
+ m_mSyncDataMap->insert(std::make_pair(l_pcLastNotification, l_ptDataPacket));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "NULL pointer: l_ptDataPacket");
+ }
+
+ pthread_spin_unlock(&m_pSyncLock);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetSyncDataSize
+/// This function is used to get the size of the synchronization data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CFrameworkunifiedSyncData::FrameworkunifiedGetSyncDataSize(const std::string &f_cNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ UI_32 l_uiSyncDataSize = 0;
+
+ if (TRUE != f_cNotification.empty()) {
+ pthread_spin_lock(&m_pSyncLock);
+
+ TSyncDataPacketItr l_itSyncDataPacketItr = m_mSyncDataMap->find(f_cNotification);
+ SFrameworkunifiedSyncDataPacket *l_ptDataPacket = NULL;
+
+ if (m_mSyncDataMap->end() != l_itSyncDataPacketItr) {
+ l_ptDataPacket = l_itSyncDataPacketItr->second;
+ l_uiSyncDataSize = l_ptDataPacket->m_uiDataSize;
+ }
+ pthread_spin_unlock(&m_pSyncLock);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_uiSyncDataSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetSyncNotificationData
+/// This function is used to get the synchronization notification data for a particular notification .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedGetSyncNotificationData(const std::string &f_cNotification, PVOID f_pBuffer,
+ UI_16 f_nBufferSize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (TRUE != f_cNotification.empty() && NULL != f_pBuffer && 0 != f_nBufferSize) {
+ pthread_spin_lock(&m_pSyncLock);
+ TSyncDataPacketItr l_itSyncDataPacketItr = m_mSyncDataMap->find(f_cNotification);
+ if (m_mSyncDataMap->end() != l_itSyncDataPacketItr) {
+ if (NULL != l_itSyncDataPacketItr->second) {
+ if (NULL != std::memcpy(f_pBuffer, l_itSyncDataPacketItr->second->m_pNotificationData,
+ l_itSyncDataPacketItr->second->m_uiDataSize)) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ pthread_spin_unlock(&m_pSyncLock);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_system.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_system.cpp
new file mode 100755
index 0000000..3a2d434
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_system.cpp
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Framework wrapper over the service directory interface APIs
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/ns_logger_if.h>
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+
+/// This is a library method in System Services....
+/// Note: Special care has been taken so that Native Services
+/// binaries don't have any circular dependence on System services.
+extern EFrameworkunifiedStatus SendSystemErrorToSystemManager(EFrameworkunifiedSystemError eSystemError) __attribute__((weak));
+
+
+EFrameworkunifiedStatus FrameworkunifiedAttachSystemCallbacksDispatcher(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ EFrameworkunifiedStatus eStatus = FrameworkunifiedSSFrameworkInterfaceInternal(hApp);
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendSystemErrMessage
+/// Sends a request to system manager for hard reset using function SendHardResetRequestToSystemManager
+/// which is defined in SystemServices library.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \param [in] eResetReason
+/// EFrameworkunifiedSystemError - Error Type
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - Returns status of operation
+///
+///////////////////////////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 200: System Error can't be tested for UT.
+EFrameworkunifiedStatus FrameworkunifiedSendSystemErrMessage(HANDLE hApp, EFrameworkunifiedSystemError eSystemError) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (SendSystemErrorToSystemManager) {
+ l_eStatus = SendSystemErrorToSystemManager(eSystemError);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp
new file mode 100755
index 0000000..468478c
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp
@@ -0,0 +1,210 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief File defines FrameworkunifiedMsgProfiler class which keeps profiler information for message dispatcher
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/* For FRAMEWORKUNIFIEDLOG*/
+#include <stdio.h>
+#include <time.h>
+#include <errno.h>
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_message_center_if.h>
+/* For PROTOCOL_DIS_MSGPROFILER */
+#include <native_service/frameworkunified_service_protocol.h>
+/* For FrameworkunifiedGetAppName */
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <string>
+#include <vector>
+/* Required for OpenSender, SendMessage, McSend, McOpenSender */
+#include "ns_msg_queue.h"
+#include "frameworkunified_msgprofiler.h"
+
+BOOL FrameworkunifiedMsgProfiler::m_bMsgProfilerEnabled = FALSE;
+
+//////////////////////////////////////////
+// Constructor
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+FrameworkunifiedMsgProfiler::FrameworkunifiedMsgProfiler(const std::string &f_cAppName)
+ : m_cAppName(f_cAppName),
+ m_ui32TotalNoOfMsgsReceived(0),
+ m_ui64MinMsgProcessingTime(720575940), // assign some big value
+ m_ui64MaxMsgProcessingTime(0),
+ m_ui64TotalMsgExecutionTime(0),
+ m_ui64LastMsgReceivedTime(0),
+ m_ui64AppInitTime(0),
+ m_bLastMsgWasPrintProfile(FALSE) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ m_ui64AppInitTime = GetClock();
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Destructor
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+FrameworkunifiedMsgProfiler::~FrameworkunifiedMsgProfiler() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : GetAppName
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+std::string FrameworkunifiedMsgProfiler::GetAppName() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ return m_cAppName;
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : MsgReceived
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+VOID FrameworkunifiedMsgProfiler::MsgReceived() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ m_ui32TotalNoOfMsgsReceived++;
+ m_ui64LastMsgReceivedTime = GetClock();
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : MsgProcessed
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+VOID FrameworkunifiedMsgProfiler::MsgProcessed() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ if (!m_bLastMsgWasPrintProfile) {
+ UI_64 l_ui64MsgProcessedTime = GetClock() - m_ui64LastMsgReceivedTime;
+
+ // set minimum execution time
+ if (l_ui64MsgProcessedTime < m_ui64MinMsgProcessingTime) {
+ m_ui64MinMsgProcessingTime = l_ui64MsgProcessedTime;
+ }
+
+ // set maximum execution time
+ if (l_ui64MsgProcessedTime > m_ui64MaxMsgProcessingTime) {
+ m_ui64MaxMsgProcessingTime = l_ui64MsgProcessedTime;
+ }
+
+ m_ui64TotalMsgExecutionTime += l_ui64MsgProcessedTime;
+ } else {
+ m_bLastMsgWasPrintProfile = FALSE;
+ }
+
+ // reset the last msg received time
+ m_ui64LastMsgReceivedTime = 0;
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : PrintProfileInfo
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus FrameworkunifiedMsgProfiler::PrintProfileInfo(HANDLE f_hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ HANDLE l_hProfileQ = OpenSender(FRAMEWORKUNIFIED_NS_MSGPROFILERUTIL);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __PRETTY_FUNCTION__, "Inside");
+ CHAR l_cData[MAX_QUEUE_MSG_SIZE] = {};
+ m_bLastMsgWasPrintProfile = TRUE;
+ // don't consider this message which is profiler specific. So decreasing the msg count by 1
+ m_ui32TotalNoOfMsgsReceived--;
+ if (NULL != l_hProfileQ) {
+ UI_64 l_ui64TimeSinceAppStart = (GetClock() - m_ui64AppInitTime) / 1000;
+ UI_64 l_ui64AvgMsgProcessingTime = m_ui64TotalMsgExecutionTime / m_ui32TotalNoOfMsgsReceived;
+
+ // MSG FORMAT: Tick, App/ThreadName, TotalMsgs, Freq(msgs/sec),
+ // Min MsgProcessingtime(cs,ms),:, Avg MsgProcessingtime (cs,ms) ,:, Max MsgProcessingtime (cs,ms)
+ snprintf(l_cData, MAX_QUEUE_MSG_SIZE, "%010lld, %-23s, %9d, %6.3f, "
+ "%30lld,%-5lld ,:, %30lld,%-5lld ,:, %30lld,%-5lld\n",
+ static_cast<long long int>(l_ui64TimeSinceAppStart), // NOLINT (readability/nolint)
+ m_cAppName.c_str(),
+ m_ui32TotalNoOfMsgsReceived,
+ (F_64)m_ui32TotalNoOfMsgsReceived / (F_64)l_ui64TimeSinceAppStart,
+ static_cast<long long int>(m_ui64MinMsgProcessingTime), // NOLINT (readability/nolint)
+ static_cast<long long int>(m_ui64MinMsgProcessingTime), // NOLINT (readability/nolint)
+ static_cast<long long int>(l_ui64AvgMsgProcessingTime), // NOLINT (readability/nolint)
+ static_cast<long long int>(l_ui64AvgMsgProcessingTime), // NOLINT (readability/nolint)
+ static_cast<long long int>(m_ui64MaxMsgProcessingTime), // NOLINT (readability/nolint)
+ static_cast<long long int>(m_ui64MaxMsgProcessingTime)); // NOLINT (readability/nolint)
+
+ SendMessage(l_hProfileQ, MAX_QUEUE_MSG_SIZE, l_cData);
+
+ if (eFrameworkunifiedStatusOK == CloseSender(l_hProfileQ)) {
+ l_hProfileQ = NULL;
+ }
+
+ // inform all childs to print msg profiler information.
+ std::vector<std::string>::iterator l_itChildList = m_vChildNames.begin();
+
+ HANDLE l_hChild = NULL;
+ while (m_vChildNames.end() != l_itChildList) {
+ if (!((*l_itChildList).empty())) {
+ l_hChild = McOpenSender((*l_itChildList).c_str());
+ if (NULL != l_hChild) {
+ if (eFrameworkunifiedStatusOK != McSend(l_hChild, FrameworkunifiedGetAppName(f_hApp), PROTOCOL_DIS_MSGPROFILER, 0, NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __PRETTY_FUNCTION__, "Error sending PROTOCOL_DIS_MSGPROFILER to child");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __PRETTY_FUNCTION__, "Msg PROTOCOL_DIS_MSGPROFILER sent to child");
+ }
+
+ McClose(l_hChild);
+ l_hChild = NULL;
+ }
+ }
+ l_itChildList++;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __PRETTY_FUNCTION__, "Exiting");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : AddChildName
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+VOID FrameworkunifiedMsgProfiler::AddChildName(const std::string &f_cChildName) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ if (!f_cChildName.empty()) {
+ m_vChildNames.push_back(f_cChildName);
+ }
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : GetClock
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+UI_64 FrameworkunifiedMsgProfiler::GetClock() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "clock_gettime errno:%d", errno);
+ return 0;
+ }
+ return (UI_64)tp.tv_sec * 1000 * 1000 + tp.tv_nsec / 1000;
+}
+// LCOV_EXCL_STOP
+
+// EOF
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_multithreading.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_multithreading.cpp
new file mode 100755
index 0000000..986f3b3
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_multithreading.cpp
@@ -0,0 +1,531 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Framework wrapper over the service directory interface APIs
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/prctl.h>
+#include <sys/resource.h>
+#include <sys/syscall.h>
+
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/ns_utility.hpp>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_system_mode.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+
+#include <iostream>
+
+#ifdef DISPATCHER_PROFILER
+#include <boost/bind.hpp>
+#include "frameworkunified_msgprofiler.h"
+#endif
+
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_utility.h"
+#include "frameworkunified_framework_internal.h"
+#include "frameworkunified_sm_multithreading_internal.h"
+
+__thread HANDLE responseWaitQ = NULL;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsValidWaitBarrier
+////////////////////////////////////////////////////////////////////////////////////////////
+bool IsValidWaitBarrier(int wbret) {
+ return (PTHREAD_BARRIER_SERIAL_THREAD == wbret) ||
+ (0 == wbret);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// DestroyThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DestroyThread(HANDLE hApp) {
+ // terminates the dispatcher loop to destroy the thread
+ if (responseWaitQ != NULL) {
+ /**
+ * @todo
+ * The responseWaitQ is set in the FrameworkunifiedInvokeSync and is closed in the callback process (DestroyThread) of the FrameworkunifiedDestroyChildThread.
+ * Therefore, the responseWaitQ is not closed when FrameworkunifiedInvokeSync is used on the parent.
+ */
+ McClose(responseWaitQ);
+ responseWaitQ = NULL;
+ }
+ return eFrameworkunifiedStatusExit;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// setChildThreadSched
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus setChildThreadSched(EFrameworkunifiedSchedPolicy policy, SI_32 priority) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ struct sched_param param;
+ int get_policy, set_policy;
+ int set_priority;
+
+ if (pthread_getschedparam(pthread_self(), &get_policy, &param) != 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: pthread_getschedparam errno:%d", errno);
+ // LCOV_EXCL_BR_STOP
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (policy == eFrameworkunifiedSchedPolicyInherit) {
+ set_policy = get_policy;
+ } else {
+ if (policy == eFrameworkunifiedSchedPolicyFIFO) {
+ set_policy = SCHED_FIFO;
+ } else if (policy == eFrameworkunifiedSchedPolicyRR) {
+ set_policy = SCHED_RR;
+ } else {
+ set_policy = SCHED_OTHER;
+ }
+ }
+
+ if (priority == INHERIT_PARENT_THREAD_PRIO) {
+ if (get_policy != set_policy) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning: Change policy(%d-%d) but inherit priority", get_policy, set_policy);
+
+ if (set_policy == SCHED_OTHER) {
+ set_priority = 0;
+ } else {
+ set_priority = sched_get_priority_min(set_policy);
+ }
+ } else {
+ set_priority = param.sched_priority;
+ }
+ } else {
+ set_priority = priority;
+ }
+
+ switch (set_policy) {
+ case SCHED_OTHER:
+ param.sched_priority = 0;
+ if (pthread_setschedparam(pthread_self(), SCHED_OTHER, &param) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: pthread_setschedparam errno:%d", errno);
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ if (setpriority(PRIO_PROCESS, static_cast<int>(syscall(__NR_gettid)), set_priority) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: setpriority errno:%d", errno);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ break;
+
+ case SCHED_FIFO:
+ case SCHED_RR:
+ param.sched_priority = set_priority;
+ if (pthread_setschedparam(pthread_self(), set_policy, &param) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: pthread_setschedparam errno:%d", errno);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ break;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// child_thread_proc
+////////////////////////////////////////////////////////////////////////////////////////////
+void *child_thread_proc(void *args) {
+ if (args == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "args is NULL");
+ return NULL;
+ }
+ PCData pcdata = *reinterpret_cast< PCData * >(args); // Create a local copy of data
+
+ try {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ HANDLE hApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcherChild(hApp,
+ pcdata.childName.c_str(),
+ pcdata.parentName.c_str()))) {
+ // LCOV_EXCL_BR_START 200: If FrameworkunifiedCreateDispatcherChild return eFrameworkunifiedStatusOK, hApp would also be valid.
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ // LCOV_EXCL_BR_STOP
+ THApp hChildApp(hApp);
+
+ const FrameworkunifiedProtocolCallbackHandler pcbhs[] = { { SYSTEM_ON_INITIALIZATION, pcdata.initFn },
+ { SYSTEM_ON_SHUTDOWN, pcdata.shdnFn },
+ { SYSTEM_ON_DESTROY, DestroyThread }
+ }; // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbacksToDispatcher(hChildApp,
+ pcdata.parentName.c_str(),
+ &pcbhs[ 0 ],
+ static_cast<UI_32>(_countof(pcbhs)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Error: Attaching child callbacks to dispatcher %s", pcdata.childName.c_str());
+ }
+
+ char thread_name[16];
+ strncpy(thread_name, pcdata.childName.c_str(), sizeof(thread_name));
+ prctl(PR_SET_NAME, thread_name);
+ thread_name[15] = '\0';
+
+ setChildThreadSched(pcdata.schedPolicy, pcdata.schedPriority);
+
+ *pcdata.childStatus = eFrameworkunifiedStatusOK;
+ if (IsValidWaitBarrier(pthread_barrier_wait(pcdata.barrier))) {
+ RunChildDispatcher(hChildApp);
+ }
+ } else {
+ // LCOV_EXCL_START 200: If FrameworkunifiedCreateDispatcherChild return eFrameworkunifiedStatusOK, hApp would also be valid.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcherChild error, status=%d", eStatus);
+
+ *pcdata.childStatus = eFrameworkunifiedStatusFail;
+ pthread_barrier_wait(pcdata.barrier);
+ }
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to create child %s", pcdata.childName.c_str());
+ }
+
+ return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE CreateChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize, CbFuncPtr CbShutdown,
+ const FrameworkunifiedChildThreadAttr *attr, CbFuncPtr CbCreateStateMachine) {
+ HANDLE hChildQ = NULL;
+ pthread_attr_t tAttr;
+ pthread_attr_t *pAttr = NULL;
+ SI_32 l_iThrCreate = 0;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
+ NULL != CbInitialize && NULL != CbShutdown && NULL != attr) {
+ if (attr->schedPolicy < eFrameworkunifiedSchedPolicyInherit || attr->schedPolicy >= eFrameworkunifiedSchedPolicyMAX) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ if (EOK == pthread_attr_init(&tAttr)) {
+ if (EOK != pthread_attr_setinheritsched(&tAttr, PTHREAD_INHERIT_SCHED)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ pAttr = &tAttr;
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ pthread_barrier_t barrier;
+ if (EOK == pthread_barrier_init(&barrier, NULL, 2)) {
+ PCData pc(&barrier, &l_eStatus, FrameworkunifiedGetAppName(hApp), childName, CbInitialize, CbShutdown,
+ attr->schedPolicy, attr->schedPriority, CbCreateStateMachine);
+ pthread_t childThread = 0;
+
+ if (NULL != CbCreateStateMachine) {
+ l_iThrCreate = pthread_create(&childThread, pAttr, child_hsm_thread_proc, &pc);
+ } else {
+ l_iThrCreate = pthread_create(&childThread, pAttr, child_thread_proc, &pc);
+ }
+
+ if (EOK == l_iThrCreate) {
+ if (IsValidWaitBarrier(pthread_barrier_wait(&barrier))) {
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ hChildQ = McOpenSenderChild(childName, childThread);
+ }
+ }
+ }
+ pthread_barrier_destroy(&barrier);
+ }
+ }
+#ifdef DISPATCHER_PROFILER
+ if (TRUE == FrameworkunifiedMsgProfiler::m_bMsgProfilerEnabled) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ pApp->m_pFrameworkunifiedMsgProfiler->AddChildName(childName);
+ }
+ }
+#endif
+ }
+ return hChildQ;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateChildThreadAttrInit
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateChildThreadAttrInit(FrameworkunifiedChildThreadAttr *attr) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (attr == NULL) {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ } else {
+ memset(attr, 0, sizeof(FrameworkunifiedChildThreadAttr));
+ attr->schedPolicy = eFrameworkunifiedSchedPolicyInherit;
+ attr->schedPriority = INHERIT_PARENT_THREAD_PRIO;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateChildThreadAttrSetSched
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateChildThreadAttrSetSched(FrameworkunifiedChildThreadAttr *attr, EFrameworkunifiedSchedPolicy policy, SI_32 priority) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (attr == NULL) {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ } else {
+ if (policy < eFrameworkunifiedSchedPolicyInherit || policy >= eFrameworkunifiedSchedPolicyMAX) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ attr->schedPolicy = policy;
+ attr->schedPriority = priority;
+ }
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateChildThreadAttrInit
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateChildThreadAttrInit(FrameworkunifiedChildThreadAttr *attr) {
+ return CreateChildThreadAttrInit(attr);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateChildThreadAttrSetSched
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateChildThreadAttrSetSched(FrameworkunifiedChildThreadAttr *attr, EFrameworkunifiedSchedPolicy policy, SI_32 priority) {
+ return CreateChildThreadAttrSetSched(attr, policy, priority);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
+ , CbFuncPtr CbShutdown) {
+ HANDLE hChildQ = NULL;
+ FrameworkunifiedChildThreadAttr attr;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
+ NULL != CbInitialize && NULL != CbShutdown) {
+ CreateChildThreadAttrInit(&attr);
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, &attr, NULL);
+ }
+
+ return hChildQ;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateChildThreadWithPriority
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThreadWithPriority(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
+ , CbFuncPtr CbShutdown, SI_32 schedPrio) {
+ HANDLE hChildQ = NULL;
+ FrameworkunifiedChildThreadAttr attr;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
+ NULL != CbInitialize && NULL != CbShutdown) {
+ CreateChildThreadAttrInit(&attr);
+ CreateChildThreadAttrSetSched(&attr, eFrameworkunifiedSchedPolicyFIFO, schedPrio);
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, &attr, NULL);
+ }
+
+ return hChildQ;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateChildThreadWithAttribute
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThreadWithAttribute(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
+ , CbFuncPtr CbShutdown, const FrameworkunifiedChildThreadAttr *attr) {
+ HANDLE hChildQ = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
+ NULL != CbInitialize && NULL != CbShutdown && NULL != attr) {
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, attr, NULL);
+ }
+
+ return hChildQ;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDestroyChildThread(HANDLE hApp, HANDLE hChildQ) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != hChildQ) {
+ eStatus = FrameworkunifiedSendChild(hApp, hChildQ, PROTOCOL_THREAD_DESTROY, 0, NULL);
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedJoinChild(hChildQ))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedJoinChild Error. status: %d", eStatus);
+ }
+
+ // close the child message queue handle
+ eStatus = McClose(hChildQ);
+ hChildQ = NULL;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedStartChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedStartChildThread(HANDLE hApp, HANDLE hChildQ, UI_32 length, PCVOID data) {
+ return FrameworkunifiedSendChild(hApp, hChildQ, SYSTEM_ON_INITIALIZATION, length, data);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedStopChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedStopChildThread(HANDLE hApp, HANDLE hChildQ, UI_32 length, PCVOID data) {
+ return FrameworkunifiedSendChild(hApp, hChildQ, SYSTEM_ON_SHUTDOWN, length, data);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendChild
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendChild(HANDLE hApp, HANDLE hChildQ, UI_32 iCmd, UI_32 length, PCVOID data) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+ return McSend(hChildQ, &pApp->cAppName[ 0 ], iCmd, length, data);
+ }
+ return eFrameworkunifiedStatusInvldHandle;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendParent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendParent(HANDLE hChildApp, UI_32 iCmd, UI_32 length, PCVOID data) {
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
+ return McSend(pApp->hParentSndMsgQ, &pApp->cAppName[ 0 ], iCmd, length, data);
+ }
+ return eFrameworkunifiedStatusInvldHandle;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateDispatcherChild
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcherChild(HANDLE &hChildApp, // NOLINT (readability/nolint)
+ PCSTR childName,
+ PCSTR parentName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((NULL != childName) && (NULL != parentName) && (LIMIT_NAME_SIZE_APP > strlen(parentName)) &&
+ (LIMIT_NAME_SIZE_APP > strlen(parentName))) {
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcher(childName, hChildApp, TRUE))) {
+ // LCOV_EXCL_BR_START 200: If FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hChildApp would also be valid.
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ // LCOV_EXCL_BR_STOP
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
+
+ memset(pApp->cParentAppName, 0, sizeof(pApp->cParentAppName));
+ memcpy(pApp->cParentAppName, parentName, strlen(parentName));
+
+ pApp->hParentSndMsgQ = McOpenSender(parentName);
+ if (NULL == pApp->hParentSndMsgQ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "McOpenSender is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ return eStatus;
+ }
+ pApp->uiSessionId = THREAD_SESSION_ID;
+ } else {
+ // LCOV_EXCL_START 200: If FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hChildApp would also be valid.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hChildApp is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcher error, status=%d", eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid parameter received");
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedJoinChild
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedJoinChild(HANDLE hChildApp) {
+ return McJoinChild(hChildApp);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetChildThreadPriority
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio) {
+ return McGetChildThreadPriority(hChildApp, threadPrio);
+}
+
+EFrameworkunifiedStatus RunChildDispatcher(HANDLE hChildApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int efd;
+ // LCOV_EXCL_BR_START 6: RunChildDispatcher is a internal function, hChildApp would checked in child_thread_proc.
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ // LCOV_EXCL_BR_STOP
+#ifdef DISPATCHER_PROFILER
+ // Get the application handle
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
+ if (TRUE == FrameworkunifiedMsgProfiler::m_bMsgProfilerEnabled) {
+ pApp->m_pFrameworkunifiedMsgProfiler = new(std::nothrow) FrameworkunifiedMsgProfiler(FrameworkunifiedGetAppName(hChildApp));
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ FrameworkunifiedAttachChildMsgProfilerCallbacksDispatcher(hChildApp);
+ }
+ }
+#endif
+ FrameworkunifiedGetDispatcherFD(hChildApp, &efd);
+
+ while (eFrameworkunifiedStatusExit != l_eStatus) {
+ l_eStatus = frameworkunifiedFdHandler(hChildApp, efd);
+ }
+ } else {
+ // LCOV_EXCL_START 6: RunChildDispatcher is a internal function, hChildApp would checked in child_thread_proc.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_service_if.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_service_if.cpp
new file mode 100755
index 0000000..dccffa8
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_service_if.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_service_if.h>
+#include <string>
+//////////////////////////////////////////
+/// Function : CFrameworkunifiedServiceInterface
+//////////////////////////////////////////
+CFrameworkunifiedServiceInterface::CFrameworkunifiedServiceInterface() {
+}
+//////////////////////////////////////////
+/// Function : ~CFrameworkunifiedServiceInterface
+//////////////////////////////////////////
+CFrameworkunifiedServiceInterface::~CFrameworkunifiedServiceInterface() {
+}
+//////////////////////////////////////////
+/// Function : OpenService
+//////////////////////////////////////////
+HANDLE CFrameworkunifiedServiceInterface::OpenService(const HANDLE f_hApp, std::string f_sServiceName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ HANDLE l_hService = NULL;
+ if (NULL == (l_hService = FrameworkunifiedOpenService(f_hApp, f_sServiceName.c_str()))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Failed to open Service [%s]", f_sServiceName.c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_hService;
+}
+//////////////////////////////////////////
+/// Function : CloseService
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedServiceInterface::CloseService(const HANDLE f_hApp, const HANDLE f_hService) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ if ((NULL == f_hApp) || (NULL == f_hService)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseService(f_hApp, f_hService))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "CloseService Failed");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : OpenSession
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedServiceInterface::OpenSession(const HANDLE f_hApp, UI_32 f_uisessionType) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ if (NULL == f_hApp) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ l_eStatus = FrameworkunifiedOpenSessionWithData(f_hApp, (PVOID)&f_uisessionType, sizeof(UI_32));
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedOpenSession Failed, eFrameworkunifiedStatusOK = 0x%x, l_eStatus = 0x%x", eFrameworkunifiedStatusOK,
+ l_eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : OpenSessionAcknowledge
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedServiceInterface::OpenSessionAcknowledge(const HANDLE f_hApp, HANDLE &hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : CloseSession
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedServiceInterface::CloseSession(const HANDLE f_hService, const HANDLE f_hSession) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ if ((NULL == f_hService) || (NULL == f_hSession)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseSession(f_hService, f_hSession))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Failed to send session close request");
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS__CWORD77_, __FUNCTION__, " Session close request sent successfully");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : CloseSessionAcknowledge
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedServiceInterface::CloseSessionAcknowledge(const HANDLE hClient) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ CloseSessionAck tCloseAck;
+ if (NULL == hClient) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ if (eFrameworkunifiedStatusOK == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hClient, &tCloseAck, sizeof(tCloseAck)))) {
+ l_eStatus = tCloseAck.eStatus;
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR,
+ __FUNCTION__,
+ "Failed to get message data:%x", l_eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_thread_priority.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_thread_priority.cpp
new file mode 100755
index 0000000..88b5c50
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_thread_priority.cpp
@@ -0,0 +1,156 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+/// \brief <INSERT INFO HERE>.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+#include <stdlib.h>
+#include <string.h>
+
+#include <native_service/frameworkunified_thread_priority.h>
+#include <native_service/ns_logger_if.h>
+
+#include <string>
+
+char *priopts[] = {
+#define THREAD 0
+ const_cast<PSTR>("thrd"),
+ NULL
+};
+
+namespace frameworkunified {
+namespace framework {
+
+CFrameworkunifiedThreadPriorities::TThreadPriorityList CFrameworkunifiedThreadPriorities::ms_mapThreadPritories;
+
+//////////////////////////////////////////
+// Constructor
+//////////////////////////////////////////
+CFrameworkunifiedThreadPriorities::CFrameworkunifiedThreadPriorities() { // LCOV_EXCL_START 200:only use static function of this class
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Destructor
+//////////////////////////////////////////
+CFrameworkunifiedThreadPriorities::~CFrameworkunifiedThreadPriorities() { // LCOV_EXCL_START 200:only use static function of this class
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// GetPriority
+//////////////////////////////////////////
+SI_32 CFrameworkunifiedThreadPriorities::GetPriority(const std::string &f_cThreadName) {
+ SI_32 l_si32Prio = FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND;
+ ThreadPrioMapIter iter = ms_mapThreadPritories.find(f_cThreadName);
+ if (iter != ms_mapThreadPritories.end() && (FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND == l_si32Prio)) {
+ l_si32Prio = iter->second;
+ }
+
+ return l_si32Prio;
+}
+
+//////////////////////////////////////////
+// AddPriority
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedThreadPriorities::AddPriority(const std::string &f_cThreadName, SI_32 f_si32Priority) {
+ ms_mapThreadPritories[f_cThreadName] = f_si32Priority;
+ return eFrameworkunifiedStatusOK;
+}
+
+//////////////////////////////////////////
+// PrintPriorites
+//////////////////////////////////////////
+VOID CFrameworkunifiedThreadPriorities::PrintPriorites() { // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ThreadPrioMapIter iter = ms_mapThreadPritories.begin();
+ for (; iter != ms_mapThreadPritories.end(); iter++) {
+ std::string name = iter->first;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Thread name: %s Priority: %d", name.data(), iter->second);
+ }
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// ParseThreadArguments
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedThreadPriorities::ParseThreadArguments(PCHAR f_cArgumentValue) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ PCHAR l_cData = NULL;
+ PSTR l_cOptions;
+ PSTR l_cValue;
+ PCHAR saveptr;
+
+ if (NULL != f_cArgumentValue) {
+ l_cOptions = f_cArgumentValue;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "args of -p: %s", l_cOptions); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ while (*l_cOptions != '\0' && (eFrameworkunifiedStatusOK == l_eStatus)) {
+ switch (getsubopt(&l_cOptions, priopts, &l_cValue)) {
+ case THREAD: {
+ if (l_cValue == NULL) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ std::string l_cName("");
+ std::string l_cPriority(""); // LCOV_EXCL_BR_LINE 11: except branch
+ int at = static_cast<int>(frameworkunified::framework::args::name);
+
+ l_cData = strtok_r(l_cValue, ":", &saveptr); // NOLINT (readability/nolint)
+ while (NULL != l_cData) {
+ switch (at) {
+ case frameworkunified::framework::args::name:
+ l_cName = l_cData;
+ break;
+ case frameworkunified::framework::args::priority:
+ l_cPriority = l_cData;
+ break;
+ default:
+ break;
+ }
+
+ if (!l_cName.empty() && !l_cPriority.empty()) {
+ frameworkunified::framework::CFrameworkunifiedThreadPriorities::AddPriority(l_cName, atoi(l_cPriority.data()));
+ at = static_cast<int>(frameworkunified::framework::args::name);
+ l_cName.clear();
+ l_cPriority.clear();
+ } else {
+ at++;
+ }
+
+ l_cData = strtok_r(NULL, ":", &saveptr); // NOLINT (readability/nolint)
+ }
+ }
+ break;
+ }
+ default: {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ }
+ }
+ }
+ return l_eStatus;
+}
+
+} // namespace framework
+}; // namespace frameworkunified
+/// EOF
+
+
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_timer.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_timer.cpp
new file mode 100755
index 0000000..0663b85
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_timer.cpp
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <native_service/frameworkunified_timer.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_timer_if.h>
+#include "frameworkunified_framework_core.h"
+
+const UI_32 TIMER_CALLBACK_CMD_ID = 42; // The answer to life, the universe, and everything
+const PCSTR TIMER_SERVICE_NAME = "TIMER";
+
+
+HANDLE FrameworkunifiedAttachTimerCallback(HANDLE hApp, UI_32 initMS, UI_32 repeatMS, CbFuncPtr CbFn) {
+ HANDLE timer = NULL;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != CbFn)) {
+ FrameworkunifiedAttachCallbackToDispatcher(hApp, TIMER_SERVICE_NAME, TIMER_CALLBACK_CMD_ID, CbFn);
+
+ CFrameworkunifiedFrameworkApp *pApp = const_cast<CFrameworkunifiedFrameworkApp *>(reinterpret_cast<const CFrameworkunifiedFrameworkApp *>(hApp));
+ NSTimerInfo ti = { WholeSeconds(initMS),
+ MSToNS(RemainderMs(initMS)),
+ TIMER_CALLBACK_CMD_ID,
+ WholeSeconds(repeatMS),
+ MSToNS(RemainderMs(repeatMS))
+ };
+ timer = NS_TimerCreate(ti, CALLBACK_MESSAGE, pApp->hAppSndMsgQ);
+ }
+
+ return timer;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedDetachTimerCallback(HANDLE hApp, HANDLE hTimer) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != hTimer) {
+ EFrameworkunifiedStatus sDel = NS_TimerDelete(hTimer);
+ hTimer = NULL;
+
+ EFrameworkunifiedStatus sDet = FrameworkunifiedDetachCallbackFromDispatcher(hApp,
+ TIMER_SERVICE_NAME,
+ TIMER_CALLBACK_CMD_ID);
+
+ // out of coverage
+ // Since the above frameworkunifiedCheckValidAppHandle(hApp) && NULL != hTimer have been confirmed,
+ // the condition will not be satisfied.
+ if (eFrameworkunifiedStatusOK != sDel || eFrameworkunifiedStatusOK != sDet) {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_FrameworkCore/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..025ec70
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/makefile_PosixBasedOS001
@@ -0,0 +1,214 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_FrameworkCore
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_FrameworkCore
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS += -D DISPATCHER_PROFILER
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_MessageQueue/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_UtilityCenter/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc/statemachine \
+ $(DEPENDS_INCLUDES) \
+
+# Libraries should be exported to the Domain Root. However if there is a
+# local static library (3rd Party) go ahead and add it here.
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+ $(wildcard statemachine/*.cpp)
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+# assuming all objects should be included in the library.
+ALL_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(notdir $(basename $(NON_LOCAL_SRCS) )) ) ) \
+ $(OBJECTS)
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/framework/*.h) \
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+ifdef DYNAMIC
+ DYNAMIC_LIBS += \
+ NS_MessageCenter$(DEBUG_EXT) \
+ NS_ConfigParser$(DEBUG_EXT) \
+ NS_NPServiceIf$(DEBUG_EXT) \
+ NS_Timer$(DEBUG_EXT)
+else
+ STATIC_LIBS +=
+endif
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS) $(ALL_OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+ $(MAKE) -C statemachine $(MAKECMDGOALS)
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(ALL_OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp
new file mode 100755
index 0000000..0cb4d67
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+/// This file has class declaration of the CFrameworkunifiedAction. This is an interface class that defines
+/// interfaces for implementing action
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_action.h>
+#include <string>
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedAction
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedAction::CFrameworkunifiedAction(std::string f_strName): m_strName(f_strName) {
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp
new file mode 100755
index 0000000..d975e93
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp
@@ -0,0 +1,371 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedCompositeState class definitions. CFrameworkunifiedCompositeState is derived from C
+/// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Composite
+/// state. It provides the standard interfaces for adding state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_compositestate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_sm_historystate.h>
+
+#include <sstream>
+#include <string>
+#include <map>
+#include <utility>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedCompositeState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedCompositeState::CFrameworkunifiedCompositeState(std::string f_pName): CFrameworkunifiedState(f_pName) {
+ try {
+ // ChildState map stores the pointers to sub state, key is state name
+ m_pChildStates = new ChildStateList();
+
+ m_pDefaultState = NULL;
+
+ m_pActiveState = NULL;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed in %s state ", f_pName.c_str());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedCompositeState::~CFrameworkunifiedCompositeState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "CFrameworkunifiedCompositeState destructor");
+ StateIterator l_objStateIterator;
+ try {
+ CHKNULL(m_pChildStates);
+
+ // Deleting the States
+ for (l_objStateIterator = m_pChildStates->begin();
+ l_objStateIterator != m_pChildStates->end(); l_objStateIterator++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, " deleting the state %s in state %s ",
+ (reinterpret_cast<CFrameworkunifiedState *>((*l_objStateIterator).second))->m_strStateName.c_str(),
+ m_strStateName.c_str());
+
+ CHKNULL((*l_objStateIterator).second);
+
+ delete(*l_objStateIterator).second;
+ (*l_objStateIterator).second = NULL;
+ }
+ m_pChildStates->clear();
+ delete m_pChildStates;
+ m_pChildStates = NULL;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to delete state %s",
+ ((reinterpret_cast<CFrameworkunifiedState *>((*l_objStateIterator).second))->m_strStateName).c_str());
+ }
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAddState
+/// sets the given state as a substate of the current state. If the f_eStateType is
+/// eFrameworkunifiedDefaultState then substate is default state for current state.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedAddState(CFrameworkunifiedState *f_pState,
+ FRAMEWORKUNIFIED_STATE_TYPE f_eStateType) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ std::map<std::string, CFrameworkunifiedState *>::iterator l_itChildStates;
+ CFrameworkunifiedHistoryState *l_pHistoryState = NULL;
+ try {
+ CHKNULL(f_pState);
+
+ CHKNULL(m_pChildStates);
+
+ // Set current state as the parent state of given state object
+ f_pState->m_pParentState = this;
+
+ // if given state is default state then set it as the default and active state of parent
+ // state
+ if (eFrameworkunifiedDefaultState == f_eStateType) {
+ m_pDefaultState = f_pState;
+ m_pActiveState = f_pState;
+
+ // set default shallow history state
+ l_itChildStates = m_pChildStates->find(SHALLOWHISTORYSTATE);
+ if (m_pChildStates->end() != l_itChildStates) {
+ l_pHistoryState = static_cast<CFrameworkunifiedHistoryState *>((*l_itChildStates).second);
+ CHKNULL(l_pHistoryState);
+ eStatus = l_pHistoryState->SetDefaultHistory();
+ }
+
+ // set default deep history state
+ l_itChildStates = m_pChildStates->find(DEEPHISTORYSTATE);
+ if (m_pChildStates->end() != l_itChildStates) {
+ l_pHistoryState = static_cast<CFrameworkunifiedHistoryState *>((*l_itChildStates).second);
+ CHKNULL(l_pHistoryState);
+ eStatus = l_pHistoryState->SetDefaultHistory();
+ }
+ }
+
+ // Insert the state in the map with key as state name
+ m_pChildStates->insert(std::pair<std::string, CFrameworkunifiedState *>(f_pState->m_strStateName, f_pState));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " %s state added in the state %s "
+ , (f_pState->m_strStateName).c_str(), (this->m_strStateName).c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to add state %s",
+ f_pState->m_strStateName.c_str());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetDefaultState
+/// Returns the default state of the current composite state.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedCompositeState::FrameworkunifiedGetDefaultState() {
+ return m_pDefaultState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPrintStates
+/// This logs the state name and events associated with the state
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedPrintStates() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ StateIterator l_objStateIterator;
+ EventReactionIterator l_objEventIterator;
+ try {
+ CHKNULL(m_pEventList);
+
+ if (m_pParentState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "%s:%s",
+ (m_pParentState->m_strStateName).c_str(), m_strStateName.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "NULL:%s", m_strStateName.c_str());
+ }
+
+ // print event
+ for (l_objEventIterator = m_pEventList->begin();
+ l_objEventIterator != m_pEventList->end(); l_objEventIterator++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "event %d %s", ((*l_objEventIterator).first),
+ (m_pEventName->find((*l_objEventIterator).first)->second).c_str());
+ }
+ CHKNULL(m_pDeferredEventList);
+ // print deferred events
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pDeferredEventList->size(); l_uiCount++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "deferred event %d %s", m_pDeferredEventList->at(l_uiCount),
+ (m_pEventName->find(m_pDeferredEventList->at(l_uiCount))->second).c_str());
+ }
+ CHKNULL(m_pChildStates);
+ // print states
+ for (l_objStateIterator = m_pChildStates->begin();
+ l_objStateIterator != m_pChildStates->end(); l_objStateIterator++) {
+ (reinterpret_cast<CFrameworkunifiedState *>((*l_objStateIterator).second))->FrameworkunifiedPrintStates();
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to print in state %s",
+ m_strStateName.c_str());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedHasSubStates
+/// This indicates if the state has sub states. It returns TRUE only in the CompositeState
+/// where this function is overridden
+///////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFrameworkunifiedCompositeState::FrameworkunifiedHasSubStates() {
+ return TRUE;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedCompositeState::FrameworkunifiedGetActiveState() {
+ CFrameworkunifiedState *l_pActiveState = NULL;
+ if (NULL != m_pActiveState) {
+ l_pActiveState = m_pActiveState->FrameworkunifiedGetActiveState();
+ } else {
+ l_pActiveState = this;
+ }
+ return l_pActiveState;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ StateIterator l_objStateIterator;
+ try {
+ CHKNULL(f_pStatemachine);
+ // iterate child states
+ for (l_objStateIterator = m_pChildStates->begin();
+ l_objStateIterator != m_pChildStates->end(); l_objStateIterator++) {
+ (reinterpret_cast<CFrameworkunifiedState *>((*l_objStateIterator).second))->FrameworkunifiedSetHSM(f_pStatemachine);
+ }
+ m_pStateMachine = f_pStatemachine;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EventReactionIterator l_objEventIterator;
+ StateIterator l_objStateIterator;
+ try {
+ CHKNULL(m_pEventList);
+ CHKNULL(m_pEventName);
+ CHKNULL(m_pDeferredEventList);
+
+ f_strXMLString << "<" << m_strStateName.c_str() << ">";
+
+ CHKNULL(m_pChildStates);
+ f_strXMLString << "<ChildStates>";
+ // print states
+ for (l_objStateIterator = m_pChildStates->begin();
+ l_objStateIterator != m_pChildStates->end(); l_objStateIterator++) {
+ (reinterpret_cast<CFrameworkunifiedState *>((*l_objStateIterator).second))->FrameworkunifiedPrintXML(f_strXMLString);
+ }
+
+ f_strXMLString << "</ChildStates>";
+
+ f_strXMLString << "<EventList>";
+ // print events
+ for (l_objEventIterator = m_pEventList->begin();
+ l_objEventIterator != m_pEventList->end(); l_objEventIterator++) {
+ std::string l_strEventName =
+ (m_pEventName->find((*l_objEventIterator).first)->second);
+
+ UI_32 l_uiEventId = (*l_objEventIterator).first;
+
+ f_strXMLString << "<Event " << "Id = " << "\"" << l_uiEventId << "\">";
+
+ f_strXMLString << "<Name>" << l_strEventName.c_str() << "</Name>";
+
+ f_strXMLString << "</Event>";
+ }
+ f_strXMLString << "</EventList>";
+
+ // print deferred events
+ f_strXMLString << "<DeferredEventList>";
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pDeferredEventList->size(); l_uiCount++) {
+ UI_32 l_uiEventId = m_pDeferredEventList->at(l_uiCount);
+
+ std::string l_strEventName = (m_pEventName->find(l_uiEventId)->second);
+
+ f_strXMLString << "<Event " << "Id = " << "\"" << l_uiEventId << "\">";
+
+ f_strXMLString << "<Name>" << l_strEventName.c_str() << "</Name>";
+
+ f_strXMLString << "</Event>";
+ }
+
+ f_strXMLString << "</DeferredEventList>";
+ f_strXMLString << "</" << m_strStateName.c_str() << ">";
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to print in state %s", m_strStateName.c_str());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::UpdateHistory() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // update shallow history state
+ l_eStatus = CheckHistory(SHALLOWHISTORYSTATE);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s Shallow History Update Failed", m_strStateName.c_str());
+ return l_eStatus;
+ }
+
+ // update deep history state
+ l_eStatus = CheckHistory(DEEPHISTORYSTATE);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s Deep History Update Failed", m_strStateName.c_str());
+ return l_eStatus;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CheckHistory
+/// This function searches for history state in this composite state and updates it.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::CheckHistory(std::string l_cHistoryType) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(m_pChildStates);
+
+ CFrameworkunifiedState *l_pHistoryState = NULL;
+
+ std::map<std::string, CFrameworkunifiedState *>::iterator l_itChildStates;
+
+ // update history state
+ l_itChildStates = m_pChildStates->find(l_cHistoryType);
+
+ if (m_pChildStates->end() != l_itChildStates) {
+ l_pHistoryState = (*l_itChildStates).second;
+ CHKNULL(l_pHistoryState);
+ l_eStatus = l_pHistoryState->UpdateHistory();
+ }
+
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp
new file mode 100755
index 0000000..6f27319
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp
@@ -0,0 +1,152 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has class definition of the CFrameworkunifiedConditionConnector. This class is responsible for
+/// implementing interfaces required to use condition connector in statemachine.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_conditionconnector.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_guard.h>
+
+#include <vector>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedConditionConnector
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedConditionConnector::CFrameworkunifiedConditionConnector(std::string f_strName): CFrameworkunifiedExternalTransition(NULL),
+ m_strName(f_strName) {
+ // Create the condition list
+ m_pConditionList = new std::vector<CCondition * >();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedConditionConnector
+/// destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedConditionConnector::~CFrameworkunifiedConditionConnector() {
+ if (m_pConditionList) {
+ TConditionIterator l_itConditionList = m_pConditionList->begin();
+
+ while (m_pConditionList->end() != l_itConditionList) {
+ delete *l_itConditionList;
+ l_itConditionList++;
+ }
+ // clear condition list
+ m_pConditionList->clear();
+ delete m_pConditionList;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CCondition
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedConditionConnector::CCondition::CCondition(CFrameworkunifiedGuard *f_pGuard, CFrameworkunifiedState *f_pTargetState)
+ : m_pGuard(f_pGuard), m_pTargetState(f_pTargetState) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedReaction
+/// This API evaluates the guards added in the condition list. If the guard is evaluated as
+/// true then statemachine transitions to target state associated with guard.
+//////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedConditionConnector::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) {
+ CFrameworkunifiedState *l_pActiveState = NULL;
+ BOOL l_bAllowTransition = FALSE;
+ try {
+ CHKNULL(f_pSourceState);
+ CHKNULL(m_pConditionList);
+ TConditionIterator l_itConditionList
+ = m_pConditionList->begin();
+
+ // iterate condition list and set the target state
+ while (m_pConditionList->end() != l_itConditionList) {
+ CCondition *l_pCondition = *l_itConditionList;
+ CHKNULL(l_pCondition);
+
+ CFrameworkunifiedGuard *l_pGuard = l_pCondition->m_pGuard;
+ CFrameworkunifiedState *l_pTargetState = l_pCondition->m_pTargetState;
+
+ CHKNULL(l_pGuard);
+ CHKNULL(l_pTargetState);
+
+ if (l_pGuard->FrameworkunifiedEvaluate()) {
+ m_pTargetState = l_pTargetState;
+ l_bAllowTransition = TRUE;
+ break;
+ }
+ l_itConditionList++;
+ }
+
+ if (l_bAllowTransition) {
+ // Transition to target state
+ l_pActiveState = ExecuteTransition(f_pSourceState, f_pData);
+
+ } else {
+ // No state changed
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__,
+ "Guard condition for External Transition from state %s to condition connector %s failed",
+ f_pSourceState->m_strStateName.c_str(), m_strName.c_str());
+
+ l_pActiveState = f_pSourceState;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+ return l_pActiveState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAddCondition
+/// Adds condition to condition list
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedConditionConnector::FrameworkunifiedAddCondition(CFrameworkunifiedGuard *f_pGuard, CFrameworkunifiedState *f_pTargetState) {
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pConditionList);
+ CHKNULL(f_pGuard);
+ CHKNULL(f_pTargetState);
+
+ CCondition *l_pCondition = new CCondition(f_pGuard, f_pTargetState);
+
+ m_pConditionList->push_back(l_pCondition);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+
+ return l_eFrameworkunifiedStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp
new file mode 100755
index 0000000..baac0d4
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedDeepHistoryState class definitions. CFrameworkunifiedDeepHistoryState is derived
+/// from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported by
+/// HSM DeepHistory state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_deephistorystate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <string>
+
+// define static members of class
+const UI_32 CFrameworkunifiedDeepHistoryState::m_suievDeepHistory = 72;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedDeepHistoryState
+/// Parameterized constructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedDeepHistoryState::CFrameworkunifiedDeepHistoryState(std::string f_pName): CFrameworkunifiedHistoryState(f_pName) {
+ m_uiEventId = m_suievDeepHistory;
+ m_cEventName = "evDeepHistory";
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedDeepHistoryState
+/// Class destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedDeepHistoryState::~CFrameworkunifiedDeepHistoryState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "CFrameworkunifiedDeepHistoryState destructor");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedDeepHistoryState::UpdateHistory() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CFrameworkunifiedState *l_pActiveState = NULL;
+
+ try {
+ CHKNULL(m_pParentState);
+ l_pActiveState = m_pParentState->m_pActiveState;
+
+ while (NULL != l_pActiveState) {
+ m_pLastActiveState = l_pActiveState;
+ l_pActiveState = l_pActiveState->m_pActiveState;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp
new file mode 100755
index 0000000..a73408a
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp
@@ -0,0 +1,240 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <pthread.h>
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_sm_dispatcher.h>
+
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_error_internal.hpp"
+#include "frameworkunified_sm_framework_core.h"
+#include "frameworkunified_framework_utility.h"
+
+static HSMConfigOptions s_tHSMConfigOptions = {eUserchangeIgnore, TRUE, FALSE};
+
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherMain(HANDLE hApp);
+//////////////////////////////////////////
+// Function : FrameworkunifiedCreateDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateHSMDispatcher(PCSTR cAppName,
+ HANDLE &hFrameworkApp, // NOLINT (readability/nolint)
+ BOOL bIsThread, CFrameworkunifiedHSMFramework *f_pFrameworkunifiedHSM) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != cAppName) {
+ if (eFrameworkunifiedStatusOK == (eStatus = CreateDispatcher(cAppName, hFrameworkApp, bIsThread))) {
+ if (NULL != hFrameworkApp) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hFrameworkApp);
+
+ if (NULL != f_pFrameworkunifiedHSM) {
+ pApp->m_pFrameworkunifiedStateMachine = f_pFrameworkunifiedHSM;
+ pApp->m_pFrameworkunifiedStateMachine->m_pHApp = pApp;
+ } else {
+ if (bIsThread) {
+ pApp->m_pFrameworkunifiedStateMachine = new CFrameworkunifiedHSMChildFramework(pApp);
+ } else {
+ pApp->m_pFrameworkunifiedStateMachine = new CFrameworkunifiedHSMParentFramework(pApp);
+ }
+ }
+
+ if (NULL != pApp->m_pFrameworkunifiedStateMachine) {
+ pApp->m_pFrameworkunifiedStateMachine->FrameworkunifiedCreate(&s_tHSMConfigOptions);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "hFrameworkApp is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "CreateDispatcher returned error, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "AppName is NULL");
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDispatcherWithArguments
+/// Creates, initializes and runs the dispatcher
+///
+/// \param [in] cAppname
+/// PCSTR - Application/ thread name
+///
+/// \return Never does, main loop for your application.
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock,
+/// FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherWithArguments(PCSTR cAppName, int argc, char *argv[],
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler, CFrameworkunifiedHSMFramework *f_pFrameworkunifiedHSM,
+ CustomCommandLineOptions *cmdLineOptions) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (cAppName == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ NsLogSetProcessName(cAppName);
+ PLOG_TEXT("FrameworkunifiedHSMDispatcher Start");
+ // set main thread name as provided in dispatcher
+ pthread_setname_np(pthread_self(), cAppName);
+
+ if ((eStatus = RegistDefaultCbHandler(CbHandler)) != eFrameworkunifiedStatusOK) {
+ return eStatus;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "In"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ try {
+ HANDLE hFrameworkApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateHSMDispatcher(cAppName, hFrameworkApp, FALSE, f_pFrameworkunifiedHSM))) {
+ if (NULL != hFrameworkApp) {
+ THApp hApp(hFrameworkApp);
+
+ /// Parse the Arguments via the FrameworkunifiedArgumentParser
+ /// passing an handle to the app and argument list
+ eStatus = FrameworkunifiedArgumentParser(hApp, argc, argv, cmdLineOptions);
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ eStatus = FrameworkunifiedHSMDispatcherMain(hApp);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hFrameworkApp is NULL");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateHSMDispatcher error, status=%d", eStatus);
+ }
+ } catch (const THApp::Exception &) {
+ /**
+ * @todo
+ * When an exception error occurs in a FrameworkunifiedCreateHSMDispatcher,
+ * the caller cannot detect the exception because the exception becomes the eFrameworkunifiedStatusOK return code.
+ */
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedHSMCreateDispatcher ");
+ }
+
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function : FrameworkunifiedHSMDispatcherMain
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherMain(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Success: FrameworkunifiedCreateDispatcher ");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ CFrameworkunifiedHSMFramework *l_pStateMachine = pApp->m_pFrameworkunifiedStateMachine;
+
+ if (l_pStateMachine) {
+ eStatus = l_pStateMachine->FrameworkunifiedStart();
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedOnInitialization failed ");
+ l_pStateMachine->FrameworkunifiedClose();
+ throw happ_error();
+ } else {
+ eStatus = RunDispatcher(hApp);
+ }
+
+ l_pStateMachine->FrameworkunifiedClose();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "l_pStateMachine is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR :: %s", err.what());
+
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedCreateDispatcher ");
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function : FrameworkunifiedSetHSMType
+////////////////////////////////////////////////////////////////////////////////////////////
+void FrameworkunifiedSetHSMType(EUserChangeOptions f_eHSMType) {
+ s_tHSMConfigOptions.eUserChange = f_eHSMType;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function : FrameworkunifiedEnableAutoPublishServiceAvailable
+////////////////////////////////////////////////////////////////////////////////////////////
+void FrameworkunifiedEnableAutoPublishServiceAvailable() {
+ s_tHSMConfigOptions.bAutoPublishServiceAvaialble = TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function : FrameworkunifiedDisableAutoPublishServiceAvailable
+////////////////////////////////////////////////////////////////////////////////////////////
+void FrameworkunifiedDisableAutoPublishServiceAvailable() {
+ s_tHSMConfigOptions.bAutoPublishServiceAvaialble = FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function : FrameworkunifiedIsAutoPublishServiceAvailableEnabled
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsAutoPublishServiceAvailableEnabled() {
+ return s_tHSMConfigOptions.bAutoPublishServiceAvaialble;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedHSMEnableWaitInStoppingState
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID FrameworkunifiedHSMEnableWaitInStoppingState() {
+ s_tHSMConfigOptions.bWaitInStoppingState = TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedHSMDisableWaitInStoppingState
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID FrameworkunifiedHSMDisableWaitInStoppingState() {
+ s_tHSMConfigOptions.bWaitInStoppingState = FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedIsWaitInStoppingStateEnabled
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsWaitInStoppingStateEnabled() {
+ return s_tHSMConfigOptions.bWaitInStoppingState;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp
new file mode 100755
index 0000000..294dcf5
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp
@@ -0,0 +1,225 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedExternalTransition class definitions. CFrameworkunifiedExternalTransition is derived
+/// from CFrameworkunifiedTransition class.This class implements the FrameworkunifiedReaction interface to support transition
+/// from one state to another state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_externaltransition.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_guard.h>
+#include <native_service/frameworkunified_sm_action.h>
+#include <vector>
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedExternalTransition::CFrameworkunifiedExternalTransition(CFrameworkunifiedState *f_pTargetState): CFrameworkunifiedTransition(f_pTargetState) {
+ m_pGuard = NULL;
+
+ // Create the condition list
+ m_pActionList = new std::vector<CFrameworkunifiedAction * >(); // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedExternalTransition::~CFrameworkunifiedExternalTransition() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (m_pActionList) {
+ TActionListIterator l_itActionList = m_pActionList->begin();
+
+ while (m_pActionList->end() != l_itActionList) {
+ if (NULL != *l_itActionList) {
+ delete *l_itActionList;
+ *l_itActionList = NULL;
+ }
+ l_itActionList++;
+ }
+ // clear condition list
+ m_pActionList->clear();
+ delete m_pActionList;
+ m_pActionList = NULL;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedReaction
+/// The reaction for an event is implemented in this function. For external transition, Exit
+/// of the source state is called and entry of the target state is called recursively.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedExternalTransition::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) {
+ CFrameworkunifiedState *l_pActiveState = NULL;
+ BOOL l_bAllowTransition = FALSE;
+
+ try {
+ CHKNULL(f_pSourceState);
+ CHKNULL(m_pTargetState);
+
+ // Check if External transition has Guard condition
+ if (m_pGuard) {
+ // Evaluate guard condition
+ l_bAllowTransition = m_pGuard->FrameworkunifiedEvaluate();
+ } else {
+ // If Guard is not available then allow transition
+ l_bAllowTransition = TRUE;
+ }
+
+ if (l_bAllowTransition) {
+ l_pActiveState = ExecuteTransition(f_pSourceState, f_pData); // LCOV_EXCL_BR_LINE 11:except branch
+
+ } else {
+ // No state changed
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Guard condition for External Transition "
+ "from state %s to state %s failed"
+ , f_pSourceState->m_strStateName.c_str(), m_pTargetState->m_strStateName.c_str());
+
+ l_pActiveState = f_pSourceState;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pActiveState;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedExternalTransition::FrameworkunifiedSetGuard(CFrameworkunifiedGuard *f_pGuard) {
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pGuard);
+ m_pGuard = f_pGuard;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eFrameworkunifiedStatus;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedExternalTransition::ExecuteTransition(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) {
+ CFrameworkunifiedState *l_pActiveState = NULL;
+ try {
+ CHKNULL(m_pTargetState);
+ CHKNULL(f_pSourceState);
+ CFrameworkunifiedState *l_pTargetState = m_pTargetState;
+ CFrameworkunifiedState *l_pCurrentState = f_pSourceState;
+
+
+
+
+ // Find the common parent of the source and target state
+ // and then call recursively OnExit on source state and
+ // OnEntry on parent state
+ BOOL l_bFoundCommonParent = FALSE;
+ while (l_pCurrentState->m_pParentState) {
+ while (l_pTargetState->m_pParentState) {
+ // Check if current source state and target state has common parent
+ if (l_pCurrentState->m_pParentState == l_pTargetState->m_pParentState) {
+ l_bFoundCommonParent = TRUE;
+ break;
+ } else {
+ // Set the next target parent state
+ l_pTargetState = l_pTargetState->m_pParentState;
+ }
+ }
+
+ if (l_bFoundCommonParent) {
+ break;
+ } else {
+ // Set the next source parent state
+ l_pCurrentState = l_pCurrentState->m_pParentState;
+ l_pTargetState = m_pTargetState;
+ }
+ }
+
+ if (l_bFoundCommonParent) {
+ // recursively execute the exit on the current state
+ l_pCurrentState->FrameworkunifiedOnHSMStop(f_pData);
+
+ // execute actions associated with the external transition
+ CHKNULL(m_pActionList);
+ TActionListIterator l_itActionList = m_pActionList->begin();
+
+ // iterate action list and execute actions
+ while (m_pActionList->end() != l_itActionList) {
+ CFrameworkunifiedAction *l_pAction = *l_itActionList;
+ CHKNULL(l_pAction);
+
+ l_pAction->FrameworkunifiedAction(f_pSourceState, l_pTargetState, f_pData);
+
+ l_itActionList++;
+ }
+
+ // Set the target state as a active state
+ CFrameworkunifiedState *l_pState = m_pTargetState;
+ while (l_pState->m_pParentState != l_pTargetState->m_pParentState) {
+ CHKNULL(l_pState->m_pParentState);
+
+ l_pState->m_pParentState->m_pActiveState = l_pState;
+ l_pState = l_pState->m_pParentState;
+ }
+
+
+ // recursively execute the entry on the target state
+ l_pActiveState = l_pTargetState->FrameworkunifiedOnHSMStart(f_pData);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "External Transition from state %s to state %s"
+ , f_pSourceState->m_strStateName.c_str(), m_pTargetState->m_strStateName.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "External Transition from state %s to state %s failed"
+ , f_pSourceState->m_strStateName.c_str(), m_pTargetState->m_strStateName.c_str());
+ return NULL;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+
+ return l_pActiveState;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedExternalTransition::FrameworkunifiedAddAction(CFrameworkunifiedAction *f_pAction) {
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pActionList);
+
+ CHKNULL(f_pAction);
+
+ m_pActionList->push_back(f_pAction);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eFrameworkunifiedStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp
new file mode 100755
index 0000000..8b361fa
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedFinalState class definitions. CFrameworkunifiedFinalState is derived from C
+/// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Final
+/// state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <string>
+#include "frameworkunified_sm_finalstate.h"
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedFinalState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedFinalState::~CFrameworkunifiedFinalState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "CFrameworkunifiedFinalState destructor");
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedFinalState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedFinalState::CFrameworkunifiedFinalState(std::string f_pName): CFrameworkunifiedState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedFinalState::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedFinalState::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedFinalState::FrameworkunifiedGetActiveState() {
+ return this;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedFinalState::UpdateHistory() {
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp
new file mode 100755
index 0000000..dfb2d5c
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp
@@ -0,0 +1,485 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_logger_if.h>
+#include <map>
+#include <utility>
+#include "frameworkunified_framework_core.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Registers a single event with the dispatcher for a given service.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachHSMEventToDispatcher(HANDLE hApp,
+ PCSTR pServiceName,
+ UI_32 iCmd,
+ UI_32 iEvent,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pServiceName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ EventServices::iterator s_iterator;
+ EventSessionTable::iterator session_iterator;
+
+ UI_32 uiSessionId = 0;
+ if (hSession) {
+ uiSessionId = FrameworkunifiedGetSessionId(hSession);
+ }
+
+ // finding the service
+ s_iterator = pApp->eventservices.find(pServiceName);
+ if (s_iterator == pApp->eventservices.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (service NOT found): service name [%s]", pApp->cAppName, pServiceName);
+ pApp->eventservices.insert(std::make_pair(pServiceName, EventSessionTable()));
+ }
+
+ session_iterator = pApp->eventservices[pServiceName].find(uiSessionId);
+ if (session_iterator == pApp->eventservices[pServiceName].end()) {
+ pApp->eventservices[pServiceName].insert
+ (std::make_pair(uiSessionId, ServiceEventProtocolTable()));
+ }
+
+ (pApp->eventservices[pServiceName].find(uiSessionId)->second).insert(std::make_pair(iCmd, iEvent));
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachHSMEventsToDispatcher
+/// Registers a multiple event with the dispatcher for a given service.
+////////////////////////////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus FrameworkunifiedAttachHSMEventsToDispatcher(HANDLE hApp, PCSTR pServiceName,
+ const FrameworkunifiedProtocolEvent *pEventIds, UI_32 uiEventCount, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pServiceName && pEventIds) {
+ // setup callbacks
+ for (UI_32 i = 0; i < uiEventCount; ++i) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachHSMEventToDispatcher(hApp,
+ pServiceName,
+ pEventIds[ i ].iCmd,
+ pEventIds[ i ].iEventId,
+ hSession))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachParentCallbacksToDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachParentHSMEventsToDispatcher(HANDLE hChildApp, const FrameworkunifiedProtocolEvent *pEventIds,
+ UI_32 uiEventCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hChildApp);
+
+ eStatus = FrameworkunifiedAttachHSMEventsToDispatcher(hChildApp, pApp->cParentAppName, pEventIds, uiEventCount);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachParentCallbacksFromDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachParentHSMEventsFromDispatcher(HANDLE hChildApp,
+ const PUI_32 puiEventArray, UI_32 uiEventCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hChildApp);
+
+ eStatus = FrameworkunifiedDetachHSMEventsFromDispatcher(hChildApp, pApp->cParentAppName, puiEventArray, uiEventCount);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachHSMEventsFromDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachHSMEventsFromDispatcher(HANDLE hApp, PCSTR pServiceName, const PUI_32 puiEventArray,
+ UI_32 uiEventCount, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pServiceName) {
+ // setup callbacks
+ for (UI_32 i = 0; i < uiEventCount; ++i) {
+ /**
+ * @todo
+ * When an event-struct pointer is turned NULL, the array is accessed without NULL checking,
+ * and a segmentation fault occurs.
+ */
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachHSMEventFromDispatcher(hApp, pServiceName,
+ puiEventArray[ i ], hSession))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+/////////////////////////////////////////////
+// Function : FrameworkunifiedDetachHSMEventFromDispatcher
+/////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachHSMEventFromDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iEvent, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pServiceName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ EventServices::iterator s_iterator;
+
+ UI_32 uiSessionId = 0;
+ if (hSession) {
+ uiSessionId = FrameworkunifiedGetSessionId(hSession);
+ }
+
+ // finding the service
+ s_iterator = pApp->eventservices.find(pServiceName);
+ if (s_iterator != pApp->eventservices.end()) {
+ EventSessionTable::iterator session_iterator;
+ session_iterator = (s_iterator->second).find(uiSessionId);
+ if (session_iterator != (s_iterator->second).end()) {
+ ServiceEventProtocolTable::iterator spt_iterator;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (found): service [%s]", pApp->cAppName, pServiceName);
+
+ spt_iterator = (session_iterator->second).find(iEvent);
+ if (spt_iterator != (session_iterator->second).end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : Cmd found [%d] service [%s]",
+ pApp->cAppName, iEvent, pServiceName);
+ (session_iterator->second).erase(spt_iterator);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : Error : Cmd NOT found [%d] service [%s]",
+ pApp->cAppName, iEvent, pServiceName);
+ }
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : Cannot find service [%s]", pApp->cAppName, pServiceName);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachNotificationEventsToDispatcher
+/// API to attach a event to the dispatcher on receiving a specific notification.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationsWithHSMEvent(HANDLE hApp, const FrameworkunifiedNotificationEvent *pNtfyEvent,
+ UI_32 uiEventCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNtfyEvent) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ /// Deal with handling batch processing of subscriptions.
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPHSMSubscribeToNotificationsEvents(hApp, pNtfyEvent, uiEventCount))) {
+ for (UI_32 i = 0; i < uiEventCount; ++i) {
+ // service found
+ pApp->notificationevents.insert(std::make_pair(pNtfyEvent[ i ].cNotification, pNtfyEvent[ i ].iEventId));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : attaching call-back for notification [%s]", pApp->cAppName,
+ pNtfyEvent[ i ].cNotification);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to Subscribe "
+ "to batch set of notifications", pApp->cAppName,
+ eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachNotificationEventToDispatcher
+/// API to attach a event to the dispatcher on receiving a specific notification.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationWithHSMEvent(HANDLE hApp, PCSTR pNotification, UI_32 iEventId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPHSMSubscribeToNotificationEvent(hApp, pNotification))) {
+ // service found
+ pApp->notificationevents.insert(std::make_pair(pNotification, iEventId));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : attaching call-back for notification [%s]",
+ pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to Subscribe "
+ "to notification [%s]", pApp->cAppName, eFrameworkunifiedStatusOK, pNotification);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachNotificationEventsFromDispatcher
+/// API to detach a notification event from the dispatcher.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationsWithHSMEvent(HANDLE hApp, const FrameworkunifiedNotificationEvent *pNtfyEvent,
+ UI_32 uiEventCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNtfyEvent) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ NotificationEventTable::iterator n_iterator;
+ PCSTR pNotification = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPHSMUnsubscribeFromNotificationEvents(hApp, pNtfyEvent, uiEventCount))) {
+ for (UI_32 l_unCount = 0; l_unCount < uiEventCount; ++l_unCount) {
+ pNotification = pNtfyEvent[ l_unCount ].cNotification;
+ n_iterator = pApp->notificationevents.find(pNotification);
+ if (n_iterator != pApp->notificationevents.end()) {
+ pApp->notificationevents.erase(n_iterator);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : removed notification [%s]", pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : Cannot find notification [%s]",
+ pApp->cAppName, pNotification);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : detaching call-back for notification [%s]",
+ pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to UnSubscribe from notifications ",
+ pApp->cAppName, eFrameworkunifiedStatusOK);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachNotificationEventsFromDispatcher
+/// API to detach a notification event from the dispatcher.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationWithHSMEvent(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ NotificationEventTable::iterator n_iterator;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPHSMUnsubscribeFromNotificationEvent(hApp, pNotification))) {
+ // \todo : error handling on all map function calls
+ n_iterator = pApp->notificationevents.find(pNotification);
+ if (n_iterator != pApp->notificationevents.end()) {
+ pApp->notificationevents.erase(n_iterator);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : removed notification [%s]", pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : Cannot find notification [%s]",
+ pApp->cAppName, pNotification);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to UnSubscribe from notification [%s]",
+ pApp->cAppName, eFrameworkunifiedStatusOK, pNotification);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetStateMachine
+/// returns the pointer to the statemachine object
+////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMFramework *FrameworkunifiedGetStateMachine(HANDLE hApp) {
+ CFrameworkunifiedHSMFramework *l_pHSMFramework = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ l_pHSMFramework = pApp->m_pFrameworkunifiedStateMachine;
+ }
+
+ return l_pHSMFramework;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSetStateMachine
+/// sets the statemachine object
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetStateMachine(HANDLE hApp,
+ CFrameworkunifiedHSM *f_pFrameworkunifiedHSM) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (NULL != f_pFrameworkunifiedHSM) {
+ (reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp))->m_pFrameworkunifiedStateMachine =
+ reinterpret_cast<CFrameworkunifiedHSMFramework *>(f_pFrameworkunifiedHSM);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventWithHSMEvent
+/// This API is used for subscribing to single event of a service.
+/// This API also attaches the session event with HSM events.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventWithHSMEvent(HANDLE hApp,
+ UI_32 uiEventId,
+ UI_32 uiHSMEventId,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedAttachHSMEventToDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, uiEventId,
+ uiHSMEventId, hSession))) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS, sizeof(UI_32), (PVOID)&uiEventId);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedAttachCallbackToDispatcher "
+ "for PROTOCOL_REGISTER_EVENTS Failed Status:: %d", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventsWithHSMEvents
+/// This API is used for subscribing to multiple events of a service.
+/// This API also attaches the session events with hsm events.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventsWithHSMEvents(HANDLE hApp, const FrameworkunifiedProtocolEvent *pEventIds,
+ UI_32 uiEventCount,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession) && NULL != pEventIds) {
+ eStatus = FrameworkunifiedAttachHSMEventsToDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, pEventIds,
+ uiEventCount, hSession);
+
+ UI_32 l_uiCmdList[uiEventCount]; // NOLINT (readability/nolint)
+ for (UI_32 l_uiCnt = 0; l_uiCnt < uiEventCount; l_uiCnt++) {
+ l_uiCmdList[l_uiCnt] = pEventIds[l_uiCnt].iCmd;
+ }
+
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS, static_cast<UI_32>(uiEventCount * sizeof(UI_32)),
+ l_uiCmdList);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventWithHSMEvent
+/// API to unsubscribe from event of a service. Also detaches HSM event.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventWithHSMEvent(HANDLE hApp, UI_32 uiEventId, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS, sizeof(uiEventId), (PVOID)&uiEventId);
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedDetachHSMEventFromDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, uiEventId, hSession)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedDetachCallbackFromDispatcher failed status:: %d", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventsWithHSMEvents
+/// API to unsubscribe from multiple events of a service. Also detaches HSM events.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventsWithHSMEvents(HANDLE hApp, PUI_32 pEventsArray, UI_32 uiListSize,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession) && NULL != pEventsArray) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS,
+ static_cast<UI_32>(uiListSize * sizeof(uiListSize)), pEventsArray);
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedDetachHSMEventsFromDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, pEventsArray,
+ uiListSize)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedDetachCallbackFromDispatcher failed status:: %d", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp
new file mode 100755
index 0000000..7afabdb
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedGuard class definitions. This is an interface that defines the Evaluate
+/// interface for guard condition validation.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_guard.h>
+#include <string>
+CFrameworkunifiedGuard::~CFrameworkunifiedGuard() {
+}
+
+CFrameworkunifiedGuard::CFrameworkunifiedGuard(std::string f_strName): m_strName(f_strName) {
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp
new file mode 100755
index 0000000..9640276
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedHistoryState class definitions. CFrameworkunifiedHistoryState is derived from
+/// CFrameworkunifiedState class.This class implements the additional functionality supported by HSM History
+/// state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_sm_historystate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedHistoryState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHistoryState::CFrameworkunifiedHistoryState(std::string f_pName): CFrameworkunifiedState(f_pName), m_pLastActiveState(NULL), m_uiEventId(0) { // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedHistoryState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHistoryState::~CFrameworkunifiedHistoryState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "CFrameworkunifiedHistoryState destructor");
+}
+
+CFrameworkunifiedState *CFrameworkunifiedHistoryState::FrameworkunifiedGetActiveState() {
+ return this;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHistoryState::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ try {
+ CHKNULL(m_pLastActiveState);
+ CHKNULL(m_pEventList);
+
+ CFrameworkunifiedExternalTransition *l_pTrnTargetState = new CFrameworkunifiedExternalTransition(m_pLastActiveState);
+
+ m_pActiveState = l_pTrnTargetState->FrameworkunifiedReaction(this, f_pEventData);
+ CHKNULL(m_pActiveState);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHistoryState::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// SetDefaultHistory
+/// This function sets the default active state in history state
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHistoryState::SetDefaultHistory() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(m_pParentState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ m_pLastActiveState = m_pParentState->m_pDefaultState;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus; // LCOV_EXCL_BR_LINE 11: except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnHSMStart
+/// This function internally calls the Entry function of the current state.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedHistoryState::FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pActiveState = this;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ // Call Entry method of the current state. Entry method of state is called in the order of
+ // Hierarchy from Outer state to Inner state
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedOnEntry(f_pEventData))) {
+ l_pActiveState = m_pActiveState;
+ } else {
+ // If FrameworkunifiedOnEntry failed then statemachine should report the error
+ // We can throw an exception but for now as a quick fix we are setting
+ // l_pActiveState as NULL which will stop the statemachine
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error:%d in state %s", eStatus,
+ l_pActiveState->m_strStateName.c_str());
+ // l_pActiveState = NULL;
+ /* Commenting it, because it was making state machine inactive. This should not be the expected behavior.
+ * Just log and take no action, if user return non-ok value.
+ * User defined error values should be handled separately */
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pActiveState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnHSMStop
+/// This function internally calls the Exit function of the current state.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedHistoryState::FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData) {
+ return this;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp
new file mode 100755
index 0000000..f6cdb09
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp
@@ -0,0 +1,529 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedHSM class definitions. CFrameworkunifiedHSM is base class for HSM Framework.
+/// This class implements interfaces for connecting child states to parent states, connecting events
+/// to state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_sm_reaction.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_compositestate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_orthogonalstate.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <cstdio>
+#include <sstream>
+#include <string>
+
+#include "frameworkunified_framework_internal.h"
+#include "frameworkunified_sm_framework_core.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedHSM
+/// Class constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSM::CFrameworkunifiedHSM(PVOID f_pHApp): m_uiCurrentEvent(0), m_pHApp(f_pHApp), m_pActiveState(NULL), m_pRootState(NULL),
+ m_bIsTransitioning(FALSE) {
+ // PostEventList stores the list of events posted in the state
+ m_pPostEventList = new EventInfoList();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedHSM
+/// Class constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSM::CFrameworkunifiedHSM(): m_uiCurrentEvent(0), m_pHApp(NULL), m_pActiveState(NULL), m_pRootState(NULL),
+ m_bIsTransitioning(FALSE) {
+ // PostEventList stores the list of events posted in the state
+ m_pPostEventList = new EventInfoList();
+ m_pHApp = NULL;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedHSM
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSM::~CFrameworkunifiedHSM() {
+ if (NULL != m_pPostEventList) {
+ delete m_pPostEventList;
+ m_pPostEventList = NULL;
+ }
+
+ if (m_pRootState) {
+ FrameworkunifiedClose();
+ }
+
+ // we are not deleting this pointer because memory pointed by this pointer
+ // had already been deleted in above step.
+ m_pActiveState = NULL;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetActiveState
+/// Returns the active state of the statemachine
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedHSM::FrameworkunifiedGetActiveState() {
+ CFrameworkunifiedState *l_pCurrentState = m_pRootState;
+ CFrameworkunifiedState *l_pActiveState = NULL;
+
+ try {
+ // Iterate till the current state is leafstate or orthogonal state
+ while (l_pCurrentState != l_pActiveState) {
+ l_pActiveState = l_pCurrentState;
+ l_pCurrentState = l_pCurrentState->FrameworkunifiedGetActiveState();
+ CHKNULL(l_pCurrentState);
+ }
+
+ // Set active state
+ m_pActiveState = l_pActiveState;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Active state is %s "
+ , m_pActiveState->m_strStateName.c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_pActiveState = NULL;
+ }
+
+
+ return l_pActiveState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedStart
+/// This starts the state machine
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedStart(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(m_pActiveState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ m_bIsTransitioning = TRUE;
+
+ // Start the state machine execution on current state
+ m_pActiveState = m_pActiveState->FrameworkunifiedOnHSMStart(f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Active state is %s "
+ , m_pActiveState->m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ // post the event from events list
+ eStatus = ProcessEventQueue(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ m_bIsTransitioning = FALSE;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedConnect
+/// This connects the reaction to event and add event to child states then add child state
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::CFrameworkunifiedHSM::FrameworkunifiedConnect(CFrameworkunifiedState *f_pParentState, CFrameworkunifiedState *f_pChildState,
+ UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction,
+ BOOL f_bIsDefaultState, BOOL f_bIsDeferredEventType,
+ std::string f_strEventName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ // attach reaction to event and add it to the child state
+ eStatus = FrameworkunifiedConnect(f_pChildState, f_uiEventId, f_pReaction, f_strEventName, f_bIsDeferredEventType);
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ // add child state to parent state
+ eStatus = FrameworkunifiedConnect(f_pParentState, f_pChildState, f_bIsDefaultState);
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedConnect
+/// This add child state to parent state.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedConnect(CFrameworkunifiedState *f_pParentState, CFrameworkunifiedState *f_pChildState,
+ BOOL f_bIsDefaultState) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pParentState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(f_pChildState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ // Check if the state is composite state
+ if (f_pParentState->FrameworkunifiedHasSubStates()) {
+ // Check if the child state is default state
+ if (f_bIsDefaultState) {
+ // Add child state as default state
+ (reinterpret_cast<CFrameworkunifiedCompositeState *>(f_pParentState))->FrameworkunifiedAddState(f_pChildState,
+ CFrameworkunifiedCompositeState::eFrameworkunifiedDefaultState); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ // Add state as regular state
+ (reinterpret_cast<CFrameworkunifiedCompositeState *>(f_pParentState))->FrameworkunifiedAddState(f_pChildState); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ f_pChildState->FrameworkunifiedSetHSM(this); // LCOV_EXCL_BR_LINE 11: except branch
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error %s is not a composite state",
+ f_pParentState->m_strStateName.c_str());
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus; //LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedConnect
+/// This connects the reaction to event and add event to child states
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedConnect(CFrameworkunifiedState *f_pState, UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction,
+ std::string f_strEventName , BOOL f_bIsDeferredEventType) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ // check if the event is deferred event
+ if (f_bIsDeferredEventType) {
+ // Add event as deferred event
+ f_pState->FrameworkunifiedAddDeferredEvent(f_uiEventId, f_strEventName); // LCOV_EXCL_BR_LINE 11: except branch
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Deferred Event %d %s is "
+ "associated with Reaction and added to state %s "
+ , f_uiEventId, f_strEventName.c_str(), (f_pState->m_strStateName).c_str());
+ // LCOV_EXCL_BR_STOP
+ } else {
+ CHKNULL(f_pReaction); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ // Add event as regular event
+ f_pState->FrameworkunifiedAddEvent(f_uiEventId, f_pReaction, f_strEventName); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Event %d %s is associated with Reaction and added to state %s "
+ , f_uiEventId, f_strEventName.c_str(), (f_pState->m_strStateName).c_str());
+ // LCOV_EXCL_BR_STOP
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to add event %d in %s", f_uiEventId,
+ (f_pState->m_strStateName).c_str());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPostEvent
+/// This creates the default event data and sends the event to the active HSM state.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedPostEvent(UI_32 f_uiEventId) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; // LCOV_EXCL_BR_LINE 11: except branch
+ try {
+ CEventDataPtr l_pEventData(new CEventData(f_uiEventId)); // LCOV_EXCL_BR_LINE 11:except branch
+ CHKNULL(l_pEventData); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ l_eStatus = FrameworkunifiedPostEvent(l_pEventData); // LCOV_EXCL_BR_LINE 11: except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPostEvent
+/// This sends the event to the active HSM state
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedPostEvent(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pEventData); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ if (m_bIsTransitioning) {
+ eStatus = FrameworkunifiedQueueEvent(f_pEventData); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ m_bIsTransitioning = TRUE;
+
+ eStatus = ProcessEvent(f_pEventData); // LCOV_EXCL_BR_LINE 11: except branch
+
+ m_bIsTransitioning = FALSE;
+
+ CHKNULL(m_pActiveState);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Active state is %s ", m_pActiveState->m_strStateName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSM::ProcessEvent(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pActiveState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(f_pEventData); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pActiveState->m_pEventName); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ EventNameList::iterator l_itEventName;
+ l_itEventName = m_pActiveState->m_pEventName->find(f_pEventData->m_uiEventId);
+
+ if (m_pActiveState->m_pEventName->end() != l_itEventName) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Posting event %d %s to state %s",
+ f_pEventData->m_uiEventId,
+ l_itEventName->second.c_str(),
+ m_pActiveState->m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ }
+
+ m_uiCurrentEvent = f_pEventData->m_uiEventId;
+
+ // Send event to active state for processing
+ m_pActiveState = m_pActiveState->FrameworkunifiedOnEvent(f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+
+ CHKNULL(m_pActiveState);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Active state is %s ", m_pActiveState->m_strStateName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ // post the event from events list
+ eStatus = ProcessEventQueue(); // LCOV_EXCL_BR_LINE 11:except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedClose
+/// This stops the state machine and destroys all states and events
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedClose(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pRootState);
+ delete m_pRootState;
+ m_pRootState = NULL;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedConnect
+/// This sets the givens state as root state in the state machine
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedConnect(CFrameworkunifiedState *f_pRootState) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pRootState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ m_pActiveState = f_pRootState;
+ m_pRootState = f_pRootState;
+
+ m_pRootState->FrameworkunifiedSetHSM(this); // LCOV_EXCL_BR_LINE 11:except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPrintAllStates
+/// This prints all states and events associated with every state on console.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedPrintAllStates() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pRootState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ // Print the states
+ m_pRootState->FrameworkunifiedPrintStates();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedConnectOrthogonal(CFrameworkunifiedOrthogonalState *f_pOrthogonalState,
+ CFrameworkunifiedCompositeState *f_pOrthogonalRegion) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pOrthogonalState) // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(f_pOrthogonalRegion) // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ f_pOrthogonalState->FrameworkunifiedAddOrthogonalRegion(f_pOrthogonalRegion);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+HANDLE CFrameworkunifiedHSM::FrameworkunifiedGetAppHandle() {
+ return m_pHApp;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedPrintXML() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ try {
+ std::ostringstream l_strXMLString;
+ l_strXMLString << "<Statemachine>";
+
+ CHKNULL(m_pRootState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ // Write statemachine information in XML stream
+ m_pRootState->FrameworkunifiedPrintXML(l_strXMLString);
+ l_strXMLString << "</Statemachine>";
+
+ // Write a stream to XML file
+ if (m_pHApp) {
+ size_t l_uiLength = static_cast<size_t>(l_strXMLString.str().length());
+
+ PCHAR l_pStream = new CHAR[l_uiLength + 1];
+ if (NULL != l_pStream) {
+ std::FILE *l_pFile = NULL;
+
+ std::memset(l_pStream, 0, l_uiLength + 1);
+ std::strncpy(l_pStream, l_strXMLString.str().c_str(), l_uiLength);
+
+ std::ostringstream l_strFileName;
+
+ l_strFileName << "StatemachineXML_";
+
+ l_strFileName << FrameworkunifiedGetAppName(m_pHApp) << ".xml";
+
+ l_pFile = std::fopen(l_strFileName.str().c_str(), "wbe");
+
+ if (l_pFile) {
+ std::fwrite(l_pStream, l_uiLength, 1, l_pFile);
+ std::fclose(l_pFile);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "%s File Created"
+ , l_strFileName.str().c_str());
+ }
+ delete[] l_pStream;
+ l_pStream = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: StatemachineXML_%s.xml file not created", FrameworkunifiedGetAppName(m_pHApp));
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, l_strXMLString.str().c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedQueueEvent(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pPostEventList); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pActiveState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(f_pEventData); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ // Push the event in the post event list(FIFO)
+ m_pPostEventList->push_back(f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ProcessEventQueue
+/// This post the event from events list
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::ProcessEventQueue() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(m_pPostEventList); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ if (!m_pPostEventList->empty()) {
+ CEventDataPtr l_pEventData = m_pPostEventList->front(); // LCOV_EXCL_BR_LINE 11:except branch
+ CHKNULL(l_pEventData); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ CHKNULL(m_pActiveState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "Processing posted event %d in state %s",
+ l_pEventData->m_uiEventId, m_pActiveState->m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ m_pPostEventList->erase(m_pPostEventList->begin());
+
+ eStatus = ProcessEvent(l_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveEventFromPostedEventQueue
+/// This API is used to remove the all events of eventId f_uiEventId from event queue of statemachine
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::RemoveEventFromPostedEventQueue(const UI_32 f_uiEventId) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldID;
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pPostEventList) {
+ int32_t l_siCnt = static_cast<int32_t>(m_pPostEventList->size() - 1);
+
+ for (; l_siCnt >= 0; l_siCnt--) {
+ if (NULL != m_pPostEventList->at(l_siCnt).get()) {
+ if (f_uiEventId == m_pPostEventList->at(l_siCnt).get()->m_uiEventId) {
+ m_pPostEventList->erase(m_pPostEventList->begin() + l_siCnt);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp
new file mode 100755
index 0000000..da060f2
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp
@@ -0,0 +1,1419 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedHSMParentFramework class definitions. CFrameworkunifiedHSMParentFramework is derived from
+/// CFrameworkunifiedHSM class. It defines the states required for NS statemachine framework, it creates the NS
+/// statemachine and implements the reaction associated with the events
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_notification.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/ns_plogger_if.h>
+
+#include <map>
+#include <string>
+
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+#include "frameworkunified_framework_utility.h"
+#include "frameworkunified_sm_framework_core.h"
+
+extern EFrameworkunifiedStatus FrameworkunifiedHSMOnLoadData(HANDLE hApp) __attribute__((weak));
+extern EFrameworkunifiedStatus FrameworkunifiedHSMOnStopInsFrameworkunifiedRun(HANDLE hApp) __attribute__((weak));
+
+CFrameworkunifiedHSMFramework::CFrameworkunifiedHSMFramework(): CFrameworkunifiedHSM() {
+}
+CFrameworkunifiedHSMFramework::CFrameworkunifiedHSMFramework(PVOID f_pHApp): CFrameworkunifiedHSM(f_pHApp) {
+}
+CFrameworkunifiedHSMParentFramework::CFrameworkunifiedHSMParentFramework(): CFrameworkunifiedHSMFramework() {
+ try {
+ m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedHSMParentFramework
+/// default constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CFrameworkunifiedHSMParentFramework(PVOID f_pHApp): CFrameworkunifiedHSMFramework(f_pHApp) {
+ try {
+ m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedHSMParentFramework
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::~CFrameworkunifiedHSMParentFramework() {
+ // TODO(framework_unifeid) Auto-generated destructor stub
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreate
+/// Statemachine states and events created and connected in this interface.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::FrameworkunifiedCreate(PVOID f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ HSMConfigOptions *l_tHSMConfig = NULL;
+ try {
+ if (f_pEventData) {
+ l_tHSMConfig = reinterpret_cast<HSMConfigOptions *>(f_pEventData);
+ }
+
+ // Create states
+ CREATE_STATE(sFrameworkunifiedRoot)
+ CREATE_STATE(sFrameworkunifiedApp)
+ CREATE_STATE(sFrameworkunifiedInitialization)
+ CREATE_STATE(sFrameworkunifiedLoadData)
+ CREATE_STATE(sFrameworkunifiedRun)
+ CREATE_STATE(sFrameworkunifiedLoadSessions)
+ CREATE_STATE(sFrameworkunifiedReady)
+ CREATE_STATE(sFrameworkunifiedStop)
+ CREATE_STATE(sFrameworkunifiedStopping)
+ CREATE_STATE(sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CREATE_STATE(sFrameworkunifiedBackground) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ // connect states as per the statemachine
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedRoot, sFrameworkunifiedApp)
+ CONNECT_STATE(sFrameworkunifiedRoot, sFrameworkunifiedStop)
+
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedApp, sFrameworkunifiedInitialization)
+ CONNECT_STATE(sFrameworkunifiedApp, sFrameworkunifiedRun)
+
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedInitialization, sFrameworkunifiedLoadData)
+ CONNECT_STATE(sFrameworkunifiedInitialization, sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CONNECT_STATE(sFrameworkunifiedInitialization, sFrameworkunifiedBackground) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedRun, sFrameworkunifiedLoadSessions)
+ CONNECT_STATE(sFrameworkunifiedRun, sFrameworkunifiedReady)
+
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedStop, sFrameworkunifiedStopping)
+
+ // Create External Transition
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedApp)
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedStop)
+
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedLoadSessions)
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedReady)
+
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedBackground) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ // CREATE_ACTION(aFrameworkunifiedOnStart)
+
+ // this is a patch, this code will be fixed once we change the macro for CONNECT_ACTION
+ CFrameworkunifiedExternalTransition *l_pTrnsFrameworkunifiedRunevFrameworkunifiedStart = new CFrameworkunifiedExternalTransition(l_psFrameworkunifiedRun);
+
+ // CONNECT_ACTION(sFrameworkunifiedRunevFrameworkunifiedStart,aFrameworkunifiedOnStart)
+
+ // Connecting events to sFrameworkunifiedInitialization state
+ CONNECT_EVENT(sFrameworkunifiedInitialization, evFrameworkunifiedStart, sFrameworkunifiedRunevFrameworkunifiedStart)
+ CONNECT_EVENT(sFrameworkunifiedInitialization, evFrameworkunifiedPreStart, sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+ CONNECT_EVENT(sFrameworkunifiedInitialization, evFrameworkunifiedBackgroundStart, sFrameworkunifiedBackground) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+
+ // Create Local transitions
+ CREATE_LOCALTRANSITION(sFrameworkunifiedInitialization);
+ CREATE_LOCALTRANSITION(sFrameworkunifiedStop);
+
+ // Connect events to state
+
+ // Connecting events to sFrameworkunifiedLoadData state
+ CONNECT_DEFERREDEVENT(sFrameworkunifiedLoadData, evFrameworkunifiedStart)
+ CONNECT_DEFERREDEVENT(sFrameworkunifiedLoadData, evFrameworkunifiedUserChange)
+ CONNECT_LOCAL_EVENT(sFrameworkunifiedLoadData, evFrameworkunifiedLoadComplete, sFrameworkunifiedInitialization)
+
+ // Connecting events to App state
+ CONNECT_EVENT(sFrameworkunifiedApp, evFrameworkunifiedStop, sFrameworkunifiedStop)
+ CONNECT_LOCAL_EVENT(sFrameworkunifiedStopping, evFrameworkunifiedStopComplete, sFrameworkunifiedStop)
+ CONNECT_DEFERREDEVENT(sFrameworkunifiedStopping, evFrameworkunifiedStart)
+
+ // Connecting events to Connecting state
+ CONNECT_EVENT(sFrameworkunifiedLoadSessions, evFrameworkunifiedReady, sFrameworkunifiedReady)
+ // CONNECT_EVENT(sFrameworkunifiedReady,evFrameworkunifiedLoadSessions,sFrameworkunifiedRun)
+ CONNECT_EVENT(sFrameworkunifiedReady, evFrameworkunifiedLoadSessions, sFrameworkunifiedLoadSessions)
+
+ // Connecting events to Stop state
+ CONNECT_EVENT(sFrameworkunifiedStop, evFrameworkunifiedInit, sFrameworkunifiedApp)
+
+ // Create internal transitions
+ CREATE_INTERNALTRANSITION(OnEventStartInStopState)
+ CONNECT_EVENT(sFrameworkunifiedStop, evFrameworkunifiedStart, OnEventStartInStopState)
+
+ CREATE_INTERNALTRANSITION(OnEventStopInStoppingState)
+ CONNECT_EVENT(sFrameworkunifiedStopping, evFrameworkunifiedStop, OnEventStopInStoppingState)
+
+ // Connecting events to sFrameworkunifiedRun state
+ CONNECT_EVENT(sFrameworkunifiedRun, evFrameworkunifiedPreStop, sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CONNECT_EVENT(sFrameworkunifiedRun, evFrameworkunifiedBackgroundStop, sFrameworkunifiedBackground) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+
+ // Connecting events to sFrameworkunifiedBackground state
+ CONNECT_EVENT(sFrameworkunifiedBackground, evFrameworkunifiedPreStop, sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ if (NULL != l_tHSMConfig) {
+ if (eUserchangeIgnore != l_tHSMConfig->eUserChange) {
+ if (eUserchangeReInit == l_tHSMConfig->eUserChange) {
+ // Create Internal Transition
+ CREATE_INTERNALTRANSITION(OnEventUserChangeInInitializationState)
+ CONNECT_EVENT(sFrameworkunifiedInitialization, evFrameworkunifiedUserChange, OnEventUserChangeInInitializationState)
+
+ // Create Internal Transition
+ CREATE_INTERNALTRANSITION(OnEventUserChangeInRunState)
+ CONNECT_EVENT(sFrameworkunifiedRun, evFrameworkunifiedUserChange, OnEventUserChangeInRunState)
+
+ CREATE_ACTION(aFrameworkunifiedOnStop)
+
+ // this is a patch, this code will be fixed once we change the macro for CONNECT_ACTION
+ CFrameworkunifiedExternalTransition *l_pTrnsFrameworkunifiedAppevFrameworkunifiedInit = new CFrameworkunifiedExternalTransition(l_psFrameworkunifiedApp);
+
+ CONNECT_ACTION(sFrameworkunifiedAppevFrameworkunifiedInit, aFrameworkunifiedOnStop)
+
+ CONNECT_EVENT(sFrameworkunifiedApp, evFrameworkunifiedInit, sFrameworkunifiedAppevFrameworkunifiedInit)
+
+ } else if (eUserchangeRetPrevState == l_tHSMConfig->eUserChange) {
+ CREATE_STATE(sFrameworkunifiedUserChange)
+
+ CONNECT_STATE(sFrameworkunifiedRoot, sFrameworkunifiedUserChange)
+
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedUserChange)
+
+ CONNECT_EVENT(sFrameworkunifiedApp, evFrameworkunifiedUserChange, sFrameworkunifiedUserChange)
+ CONNECT_EVENT(sFrameworkunifiedUserChange, evFrameworkunifiedStop, sFrameworkunifiedStop)
+
+ CONNECT_DEFERREDEVENT(sFrameworkunifiedUserChange, evFrameworkunifiedStart)
+ CONNECT_DEFERREDEVENT(sFrameworkunifiedUserChange, evFrameworkunifiedUserChange)
+
+ // add shallow history state in state sFrameworkunifiedApp
+ ADD_SHALLOWHISTORYSTATE(sFrameworkunifiedApp)
+
+ // create transition to shallow history state in state sFrameworkunifiedApp
+ CREATE_SHALLOWHISTORYTRANSITION(sFrameworkunifiedApp)
+
+ // Connecting events to UserChange State
+ CONNECT_SHALLOWHISTORYEVENT(sFrameworkunifiedUserChange, evFrameworkunifiedUserChangeComplete, sFrameworkunifiedApp)
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Incorrect Userchange config option %d", l_tHSMConfig->eUserChange);
+ }
+ }
+ }
+
+ // Connecting FrameworkRoot to statemachine
+ CONNECTROOT(sFrameworkunifiedRoot)
+
+ // Creating the application specific statemachine
+ CHKNULL(m_pHApp);
+ FrameworkunifiedCreateStateMachineInternal(m_pHApp);
+
+ // Print statemachine xml
+ PRINT_HSM();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedFrameworkConnect
+/// This adds the given state as a sub state of sReady state of the Framework
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::FrameworkunifiedFrameworkConnect(CFrameworkunifiedState *f_pAppState, BOOL f_bIsDefaultState) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pFrameworkunifiedStateList);
+ CHKNULL(f_pAppState);
+
+ if (m_pFrameworkunifiedStateList->find(esFrameworkunifiedReady) == m_pFrameworkunifiedStateList->end()) {
+ throw CNullPointerException();
+ }
+ CFrameworkunifiedState *l_pReady = reinterpret_cast<CFrameworkunifiedCompositeState *>(m_pFrameworkunifiedStateList->find(esFrameworkunifiedReady)->second);
+ CHKNULL(l_pReady);
+
+ eStatus = FrameworkunifiedConnect(l_pReady, f_pAppState, f_bIsDefaultState);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedFrameworkConnect
+/// This connects the reaction to event and add event to states
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::FrameworkunifiedFrameworkConnect(FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState, UI_32 f_uiEventId,
+ CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName,
+ BOOL f_bIsDeferredEvent) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pFrameworkunifiedStateList);
+
+ if (m_pFrameworkunifiedStateList->find(f_eFrameworkunifiedState) == m_pFrameworkunifiedStateList->end()) {
+ throw CNullPointerException();
+ }
+ CFrameworkunifiedState *l_pFrameworkunifiedState = reinterpret_cast<CFrameworkunifiedCompositeState *>(m_pFrameworkunifiedStateList->find(f_eFrameworkunifiedState)->second);
+
+ CHKNULL(l_pFrameworkunifiedState);
+
+ eStatus = FrameworkunifiedConnect(l_pFrameworkunifiedState, f_uiEventId, f_pReaction, f_strEventName, f_bIsDeferredEvent);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedRoot
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRoot::CsFrameworkunifiedRoot(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedRoot
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRoot::~CsFrameworkunifiedRoot() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// Initializes the application and registers the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRoot::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization +");
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedOnInitializationInternal(l_pHApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to Initialize application:0x%x ", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization -");
+
+ // Publish service unavailability
+ if (FrameworkunifiedIsAutoPublishServiceAvailableEnabled()) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedPublishServiceAvailability(l_pHApp, FALSE))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to set service availability notification:0x%x ", eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Service unavailable published");
+ }
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRoot::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedApp
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedApp::CsFrameworkunifiedApp(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedRoot
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedApp::~CsFrameworkunifiedApp() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// Initializes the application and registers the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedApp::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedApp::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedUserChange
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedUserChange::CsFrameworkunifiedUserChange(std::string f_pName): CFrameworkunifiedLeafState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedRoot
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedUserChange::~CsFrameworkunifiedUserChange() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// Initializes the application and registers the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedUserChange::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ if (!FrameworkunifiedIsReactionAvailable(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadUserData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, " Reaction not available for evFrameworkunifiedUserChangeComplete");
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, " No reaction for loading user specific data ");
+
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedUserChangeComplete));
+ } else {
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadUserData));
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedUserChange::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedInitialization
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedInitialization::CsFrameworkunifiedInitialization(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedInitialization
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedInitialization::~CsFrameworkunifiedInitialization() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedInitialization::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedInitialization::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedHSMParentFramework::COnEventUserChangeInInitializationState::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState,
+ CEventDataPtr f_pEventData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "In Reaction OnEventUserChangeInInitializationState");
+ CHKNULL(f_pSourceState);
+
+ // post the event to move to sFrameworkunifiedApp state
+ f_pSourceState->FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedInit));
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return f_pSourceState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedLoadData
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadData::CsFrameworkunifiedLoadData(std::string f_pName): CFrameworkunifiedLeafState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedLoadData
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadData::~CsFrameworkunifiedLoadData() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadData::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CHKNULL(FrameworkunifiedGetStateMachine(l_pHApp));
+
+ UI_32 l_uiCurrentEventId = FrameworkunifiedGetStateMachine(l_pHApp)->m_uiCurrentEvent;
+ if (!(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedUserChangeComplete) == l_uiCurrentEventId)) {
+ if (FrameworkunifiedHSMOnLoadData) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedHSMOnLoadData(l_pHApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to load application data:0x%X ", eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning: FrameworkunifiedHSMOnLoadData not defined by the application");
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSubscribeNotificationWithHSMEvent(l_pHApp,
+ NTFY_NPPService_UserChange,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedUserChange)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "FrameworkunifiedSubscribeNotificationWithHSMEvent "
+ "NTFY_NPPService_UserChange Failed Status:0x%x ", eStatus);
+ return eStatus;
+ }
+ // Attach callback : Event to start the StateMachine
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachHSMEventToDispatcher(l_pHApp,
+ FRAMEWORKUNIFIED_ANY_SOURCE,
+ NPS_GET_PERS_FILE_ACK,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadFileAck)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher NPS_GET_PERS_FILE_ACK (FRAMEWORKUNIFIED_ANY_SOURCE) Failed Status:0x%x ", eStatus);
+ return eStatus;
+ }
+ if (!FrameworkunifiedIsReactionAvailable(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadFileAck))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, " Reaction not available for evFrameworkunifiedLoadFileAck");
+
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadComplete));
+ }
+ } else {
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadComplete));
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadData::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pHSM);
+
+ UI_32 l_uiCurrentEventId = l_pHSM->m_uiCurrentEvent;
+
+ if (FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStop) == l_uiCurrentEventId) {
+ l_pHSM->RemoveEventFromPostedEventQueue(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart));
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedPre
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedPre::CsFrameworkunifiedPre(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others) // NOLINT(whitespace/line_length)
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedPre
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedPre::~CsFrameworkunifiedPre() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedPre::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CHKNULL(f_pEventData); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ // Only evFrameworkunifiedPreStart or evFrameworkunifiedPreStop events occur when functions are executed.
+ if (f_pEventData->m_uiEventId == FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedPreStart)) {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnPreStartInternal +"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ eStatus = FrameworkunifiedOnPreStartInternal(l_pHApp);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to pre start application:0x%x ", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnPreStartInternal -"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ } else {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnPreStopInternal +"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ eStatus = FrameworkunifiedOnPreStopInternal(l_pHApp);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to pre stop application:0x%x ", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnPreStopInternal -"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedPre::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedBackground
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedBackground::CsFrameworkunifiedBackground(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others) // NOLINT(whitespace/line_length)
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedBackground
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedBackground::~CsFrameworkunifiedBackground() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedBackground::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CHKNULL(f_pEventData); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ // Only evFrameworkunifiedBackgroundStart or evFrameworkunifiedBackgroundStop events occur when functions are executed.
+ if (f_pEventData->m_uiEventId == FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedBackgroundStart)) {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnBackgroundStartInternal +"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+ eStatus = FrameworkunifiedOnBackgroundStartInternal(l_pHApp);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to background start application:0x%x ", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnBackgroundStartInternal -"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+ } else {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnBackgroundStopInternal +"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+ eStatus = FrameworkunifiedOnBackgroundStopInternal(l_pHApp);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to background stop application:0x%x ", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnBackgroundStopInternal -"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedBackground::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedRun
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRun::CsFrameworkunifiedRun(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedRun
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRun::~CsFrameworkunifiedRun() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// Subscribes for the service availability notification and calls FrameworkunifiedOnStart
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRun::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ try {
+ HANDLE hApp = FrameworkunifiedGetAppHandle();
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ FrameworkunifiedOnStartInternal(hApp);
+
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ for (UI_32 l_uiCount = 0; l_uiCount < pApp->servicenotificationlist.size(); l_uiCount++) {
+ ServiceNotificationInfo objNotification = pApp->servicenotificationlist.at(l_uiCount);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSubscribeNotificationWithHSMEvent
+ (hApp, objNotification.sNotificationName, objNotification.uiEventId))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "failed to subscribe notification %s"
+ , objNotification.sNotificationName);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "successfully subscribe notification %s"
+ , objNotification.sNotificationName);
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "Application handle is NULL");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRun::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+
+ try {
+ HANDLE hApp = FrameworkunifiedGetAppHandle();
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ // Let application also handle exit of sFrameworkunifiedRun state
+ if (FrameworkunifiedHSMOnStopInsFrameworkunifiedRun) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedHSMOnStopInsFrameworkunifiedRun(hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning: FrameworkunifiedHSMOnStopInsFrameworkunifiedRun returned: 0x%X ", l_eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning: FrameworkunifiedHSMOnStopInsFrameworkunifiedRun not defined by the application");
+ }
+
+ for (UI_32 l_uiCount = 0; l_uiCount < pApp->servicenotificationlist.size(); l_uiCount++) {
+ ServiceNotificationInfo objNotification = pApp->servicenotificationlist.at(l_uiCount);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedUnsubscribeNotificationWithHSMEvent(hApp,
+ objNotification.sNotificationName))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "failed to unsubscribe notification %s",
+ objNotification.sNotificationName);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "successfully unsubscribed from notification %s",
+ objNotification.sNotificationName);
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "Application handle is NULL");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedHSMParentFramework::COnEventUserChangeInRunState::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState,
+ CEventDataPtr f_pEventData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "In Reaction OnEventUserChangeInRunState");
+ CHKNULL(f_pSourceState);
+
+ // post the event to move to sFrameworkunifiedApp state
+ f_pSourceState->FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedInit));
+
+ CHKNULL(f_pSourceState);
+
+ // post the event to move to sFrameworkunifiedRun state
+ f_pSourceState->FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart));
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+ return f_pSourceState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedLoadSessions
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadSessions::CsFrameworkunifiedLoadSessions(std::string f_pName): CFrameworkunifiedLeafState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedLoadSessions
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadSessions::~CsFrameworkunifiedLoadSessions() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadSessions::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ HANDLE hApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(hApp);
+
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (!pApp->servicenotificationlist.size()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, " No Mandatory services set ");
+
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedReady));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, " Wait for service availability of mandatory services ");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadSessions::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedReady
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedReady::CsFrameworkunifiedReady(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedReady
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedReady::~CsFrameworkunifiedReady() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedReady::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ if (FrameworkunifiedIsAutoPublishServiceAvailableEnabled()) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ if (eFrameworkunifiedStatusOK != (FrameworkunifiedPublishServiceAvailability(l_pHApp, TRUE))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "warning:Failed to Publish service availability notification:0x%x ",
+ l_eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Service available published");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Auto Service available published feature disabled");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedReady::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ try {
+ ServiceSessionTable::iterator session_iterator;
+ SessionHandleTable::iterator session_handle_iterator;
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ if (FrameworkunifiedIsAutoPublishServiceAvailableEnabled()) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ if (eFrameworkunifiedStatusOK != (FrameworkunifiedPublishServiceAvailability(l_pHApp, FALSE))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to set service availability notification:0x%x ", l_eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Service unavailable published");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Auto Service available published feature disabled");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedStop
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStop::CsFrameworkunifiedStop(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedStop
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStop::~CsFrameworkunifiedStop() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStop::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ // every application need to implement this function
+ // all the resource deallocation like file release,etc should be done in this callback
+ l_eStatus = FrameworkunifiedOnStopInternal(l_pHApp);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING: FrameworkunifiedOnStop returned %d", l_eStatus);
+ // We just need to print the error.
+ // Returning this status to state machine is not required.
+ // Currently, If not OK is sent to state machine while FrameworkunifiedOnEntry, then state machine becomes dead.
+ l_eStatus = eFrameworkunifiedStatusOK; // Therefore assign ok.
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStop::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedStopping
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStopping::CsFrameworkunifiedStopping(std::string f_pName): CFrameworkunifiedLeafState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedStopping
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStopping::~CsFrameworkunifiedStopping() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStopping::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ try {
+ if (FrameworkunifiedIsWaitInStoppingStateEnabled()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event evFrameworkunifiedStopComplete not posted. User has to post it.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Reaction not available for evFrameworkunifiedStopAck");
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Posting event evFrameworkunifiedStopComplete");
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStopComplete));
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStopping::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedHSMParentFramework::COnEventStopInStoppingState::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState,
+ CEventDataPtr f_pEventData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "In Reaction OnEventStopInStoppingState");
+ CHKNULL(f_pSourceState);
+
+ (VOID)f_pSourceState->FrameworkunifiedRemoveEventFromDeferredEventList(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart));
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+ return f_pSourceState;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedHSMParentFramework::COnEventStartInStopState::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState,
+ CEventDataPtr f_pEventData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "In Reaction OnEventStartInStopState");
+ CHKNULL(f_pSourceState);
+
+ // post the event to move to sFrameworkunifiedApp state
+ f_pSourceState->FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedInit));
+
+ CHKNULL(f_pSourceState);
+
+ // post the event to transit to sFrameworkunifiedRun state
+ f_pSourceState->FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart));
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+ return f_pSourceState;
+}
+
+VOID CFrameworkunifiedHSMParentFramework::CaFrameworkunifiedOnStop::FrameworkunifiedAction(CFrameworkunifiedState *f_pSourceState, CFrameworkunifiedState *f_pTargetState,
+ CEventDataPtr f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "In Action %s", m_strName.c_str());
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ if (NULL != l_pHApp) {
+ FrameworkunifiedOnStopInternal(l_pHApp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Application handle is NULL in Action %s", m_strName.c_str());
+ }
+}
+
+CFrameworkunifiedHSMChildFramework::CFrameworkunifiedHSMChildFramework(): CFrameworkunifiedHSMFramework() {
+}
+
+
+CFrameworkunifiedHSMChildFramework::CFrameworkunifiedHSMChildFramework(PVOID f_pHApp): CFrameworkunifiedHSMFramework(f_pHApp) {
+ try {
+ m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+}
+
+CFrameworkunifiedHSMChildFramework::~CFrameworkunifiedHSMChildFramework() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreate
+/// Statemachine states and events created and connected in this interface.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::FrameworkunifiedCreate(PVOID f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ // Create states
+ CREATE_STATE(sFrameworkunifiedThreadRoot)
+ CREATE_STATE(sFrameworkunifiedThreadIdle)
+ CREATE_STATE(sFrameworkunifiedThreadStart)
+ CREATE_STATE(sFrameworkunifiedThreadReady)
+ CREATE_STATE(sFrameworkunifiedThreadStop)
+
+ // connect states as per the statemachine
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedThreadRoot, sFrameworkunifiedThreadIdle)
+ CONNECT_STATE(sFrameworkunifiedThreadRoot, sFrameworkunifiedThreadStart)
+ CONNECT_STATE(sFrameworkunifiedThreadRoot, sFrameworkunifiedThreadStop)
+ CONNECT_STATE(sFrameworkunifiedThreadRoot, sFrameworkunifiedThreadReady)
+
+ // Create External Transition
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedThreadIdle)
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedThreadStart)
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedThreadReady)
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedThreadStop)
+
+ // Connect events to state
+ CONNECT_EVENT(sFrameworkunifiedThreadIdle, evFrameworkunifiedStart, sFrameworkunifiedThreadStart)
+ CONNECT_EVENT(sFrameworkunifiedThreadStart, evFrameworkunifiedReady, sFrameworkunifiedThreadReady)
+ CONNECT_EVENT(sFrameworkunifiedThreadStart, evFrameworkunifiedError, sFrameworkunifiedThreadIdle)
+ CONNECT_EVENT(sFrameworkunifiedThreadReady, evFrameworkunifiedStop, sFrameworkunifiedThreadStop)
+ CONNECT_EVENT(sFrameworkunifiedThreadStop, evFrameworkunifiedStart, sFrameworkunifiedThreadStart)
+
+ // Create Internal Transition
+ CREATE_INTERNALTRANSITION(OnDestroyThread)
+ CONNECT_EVENT(sFrameworkunifiedThreadRoot, evFrameworkunifiedDestroy, OnDestroyThread)
+
+ // Connecting AppRoot to statemachine
+ CONNECTROOT(sFrameworkunifiedThreadRoot)
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// COnDestroyThread::FrameworkunifiedReaction
+/// This reaction is executed when request for terminating the thread is received.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedHSMChildFramework::COnDestroyThread::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState,
+ CEventDataPtr f_pEventData) {
+ // return the NULL to exit the dispatcher loop of thread
+ return NULL;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::FrameworkunifiedFrameworkConnect(CFrameworkunifiedState *f_pAppState, BOOL f_bIsDefaultState) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pFrameworkunifiedStateList);
+ CHKNULL(f_pAppState);
+
+ if (m_pFrameworkunifiedStateList->find(esFrameworkunifiedThreadReady) == m_pFrameworkunifiedStateList->end()) {
+ throw CNullPointerException();
+ }
+ CFrameworkunifiedState *l_pReady = reinterpret_cast<CFrameworkunifiedCompositeState *>(m_pFrameworkunifiedStateList->find(esFrameworkunifiedThreadReady)->second);
+ CHKNULL(l_pReady);
+
+ eStatus = FrameworkunifiedConnect(l_pReady, f_pAppState, f_bIsDefaultState);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::FrameworkunifiedFrameworkConnect(FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState, UI_32 f_uiEventId,
+ CFrameworkunifiedReaction *f_pReaction,
+ std::string f_strEventName, BOOL f_bIsDeferredEvent) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pFrameworkunifiedStateList);
+
+ if (m_pFrameworkunifiedStateList->find(f_eFrameworkunifiedState) == m_pFrameworkunifiedStateList->end()) {
+ throw CNullPointerException();
+ }
+ CFrameworkunifiedState *l_pFrameworkunifiedState = reinterpret_cast<CFrameworkunifiedCompositeState *>(m_pFrameworkunifiedStateList->find(f_eFrameworkunifiedState)->second);
+
+ CHKNULL(l_pFrameworkunifiedState);
+
+ eStatus = FrameworkunifiedConnect(l_pFrameworkunifiedState, f_uiEventId, f_pReaction, f_strEventName, f_bIsDeferredEvent);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedThreadRoot
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadRoot::CsFrameworkunifiedThreadRoot(std::string f_pName)
+ : CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedThreadRoot
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadRoot::~CsFrameworkunifiedThreadRoot() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// publishes the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadRoot::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadRoot::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedThreadIdle
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadIdle::CsFrameworkunifiedThreadIdle(std::string f_pName)
+ : CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedThreadIdle
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadIdle::~CsFrameworkunifiedThreadIdle() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// publishes the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadIdle::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadIdle::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedThreadStart
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStart::CsFrameworkunifiedThreadStart(std::string f_pName)
+ : CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedThreadStart
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStart::~CsFrameworkunifiedThreadStart() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// publishes the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStart::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >
+ (FrameworkunifiedGetAppHandle());
+ CHKNULL(reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine));
+ CHKNULL((reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStartThread);
+ if (eFrameworkunifiedStatusOK ==
+ (reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStartThread(pApp)) {
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedReady));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Thread start Failed: %s", m_strStateName.c_str());
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStart::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedThreadReady
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadReady::CsFrameworkunifiedThreadReady(std::string f_pName)
+ : CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedThreadReady
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadReady::~CsFrameworkunifiedThreadReady() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// publishes the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadReady::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadReady::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedThreadStop
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStop::CsFrameworkunifiedThreadStop(std::string f_pName)
+ : CFrameworkunifiedLeafState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedThreadStop
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStop::~CsFrameworkunifiedThreadStop() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// publishes the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStop::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ HANDLE hApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(hApp);
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >
+ (hApp);
+ CHKNULL(reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine));
+ CHKNULL((reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStopThread);
+
+ eStatus = (reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStopThread(pApp);
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING: Thread stop function returned %d", eStatus);
+ // We just need to print the error.
+ // Returning this status to state machine is not required.
+ // Currently, If not OK is sent to state machine while FrameworkunifiedOnEntry, then state machine becomes dead.
+ eStatus = eFrameworkunifiedStatusOK; // Therefore assign ok.
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStop::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp
new file mode 100755
index 0000000..6c44ebb
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedLeafState class definitions. CFrameworkunifiedLeafState is derived from C
+/// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Leafstate.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_leafstate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedLeafState::CFrameworkunifiedLeafState(std::string f_pName): CFrameworkunifiedState(f_pName) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedLeafState::~CFrameworkunifiedLeafState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "CFrameworkunifiedLeafState destructor");
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedLeafState::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedLeafState::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedLeafState::FrameworkunifiedGetActiveState() {
+ return this;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedLeafState::UpdateHistory() {
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp
new file mode 100755
index 0000000..b5f9c0a
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp
@@ -0,0 +1,84 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_localtransition.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedExternalTransition
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedLocalTransition::CFrameworkunifiedLocalTransition(CFrameworkunifiedState *f_pTargetState): CFrameworkunifiedTransition(f_pTargetState) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedExternalTransition
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedLocalTransition::~CFrameworkunifiedLocalTransition() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedReaction
+/// The reaction for an event is implemented in this function. For local transition from inner
+/// state to outer state exit of the inner state is invoked, but entry of outer state is not
+/// invoked and from outer state to inner state entry of the inner state is invoked but exit of
+/// outer state is not invoked
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedLocalTransition::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) {
+ CFrameworkunifiedState *l_pActiveState = NULL;
+ CFrameworkunifiedState *l_pCurrentState = NULL;
+ try {
+ CHKNULL(f_pSourceState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pTargetState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ // Local transition from inner state to outer state
+ if (f_pSourceState->m_pParentState == m_pTargetState) {
+ // Source is child of target
+ l_pCurrentState = f_pSourceState->FrameworkunifiedOnHSMStop(f_pData);
+
+ if (l_pCurrentState == f_pSourceState) {
+ l_pActiveState = m_pTargetState;
+
+ } else {
+ l_pActiveState = l_pCurrentState;
+ }
+
+ /**
+ * @todo
+ * If the parent state is registered and OnEvent is performed without OrthogonalReigonList, illegal accesses occur.
+ */
+ l_pActiveState->m_pActiveState = NULL;
+
+ // Local transition from outer state to inner state
+ } else if (f_pSourceState == m_pTargetState->m_pParentState) {
+ // Source is parent to target state
+ l_pActiveState = m_pTargetState->FrameworkunifiedOnHSMStart(f_pData);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Local Transition from state %s to state %s"
+ , f_pSourceState->m_strStateName.c_str(), m_pTargetState->m_strStateName.c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ return NULL;
+ }
+
+ return l_pActiveState;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp
new file mode 100755
index 0000000..33dab56
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp
@@ -0,0 +1,211 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief This file has the function implementation for creating state machine child thread
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+#include <sys/prctl.h>
+
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_utility.hpp>
+#include <native_service/ns_system_mode.h>
+#include <native_service/frameworkunified_sm_multithreading.h>
+#include <native_service/frameworkunified_multithreading.h>
+
+#include <iostream>
+#include <string>
+
+#include "frameworkunified_framework_utility.h"
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateHSMDispatcherChild
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateHSMDispatcherChild(PCSTR childName,
+ PCSTR parentName,
+ HANDLE &hChildApp, // NOLINT (readability/nolint)
+ CbFuncPtr pOnThreadStart,
+ CbFuncPtr pOnThreadStop) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((NULL != childName) && (NULL != parentName) && (strlen(childName) <= MAX_NAME_SIZE_APP) &&
+ (strlen(parentName) <= MAX_NAME_SIZE_APP)) {
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateHSMDispatcher(childName, hChildApp, TRUE))) {
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
+
+ (reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStartThread
+ = pOnThreadStart;
+
+ (reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStopThread
+ = pOnThreadStop;
+
+ pApp->hParentSndMsgQ = McOpenSender(parentName);
+ if (NULL == pApp->hParentSndMsgQ) {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "McOpenSender failed");
+ return eStatus;
+ }
+ pApp->uiSessionId = THREAD_SESSION_ID;
+
+ memset(pApp->cParentAppName, 0, sizeof(pApp->cParentAppName));
+ memcpy(pApp->cParentAppName, parentName, strlen(parentName));
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hChildApp is NULL");
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateHSMDispatcher error, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid Param received"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+void *child_hsm_thread_proc(void *args) {
+ if (args == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "args is NULL");
+ return NULL;
+ }
+ PCData pcdata = *reinterpret_cast< PCData * >(args); // Create a local copy of data
+
+ try {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ HANDLE hFrameworkApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateHSMDispatcherChild(pcdata.childName.c_str(),
+ pcdata.parentName.c_str(),
+ hFrameworkApp,
+ pcdata.initFn,
+ pcdata.shdnFn))) {
+ if (NULL != hFrameworkApp) {
+ THApp hChildApp(hFrameworkApp);
+
+ if (pcdata.CbCreateStateMachine) {
+ pcdata.CbCreateStateMachine(hChildApp);
+ FRAMEWORKUNIFIED_PRINT_HSM(hChildApp)
+ }
+ const FrameworkunifiedProtocolEvent pcbhs[] = { { SYSTEM_ON_INITIALIZATION, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart) },
+ { SYSTEM_ON_SHUTDOWN, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStop) },
+ { SYSTEM_ON_DESTROY, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedDestroy) }
+ };
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(hChildApp,
+ pcdata.parentName.c_str(),
+ &pcbhs[ 0 ],
+ static_cast<UI_32>(_countof(pcbhs)),
+ NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to attach hsm events to child thread %s",
+ pcdata.childName.c_str());
+ }
+
+ // set child thread name
+ char thread_name[16];
+ strncpy(thread_name, pcdata.childName.c_str(), sizeof(thread_name));
+ prctl(PR_SET_NAME, thread_name);
+ thread_name[15] = '\0';
+
+ setChildThreadSched(pcdata.schedPolicy, pcdata.schedPriority);
+
+ (FrameworkunifiedGetStateMachine(hChildApp))->FrameworkunifiedStart();
+
+ *pcdata.childStatus = eFrameworkunifiedStatusOK;
+ if (IsValidWaitBarrier(pthread_barrier_wait(pcdata.barrier))) {
+ RunChildDispatcher(hChildApp);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hFrameworkApp is NULL");
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateHSMDispatcherChild error, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+
+ *pcdata.childStatus = eFrameworkunifiedStatusFail;
+ pthread_barrier_wait(pcdata.barrier);
+ }
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to create child %s", pcdata.childName.c_str());
+ }
+
+ return NULL;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateHSMChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize,
+ CbFuncPtr CbShutdown, CbFuncPtr CbCreateStateMachine) {
+ HANDLE hChildQ = NULL;
+ FrameworkunifiedChildThreadAttr attr;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && NULL != CbInitialize && NULL != CbShutdown &&
+ NULL != CbCreateStateMachine) {
+ CreateChildThreadAttrInit(&attr);
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, &attr, CbCreateStateMachine);
+ }
+
+ return hChildQ;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateHSMChildThreadWithPriority
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThreadWithPriority(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize,
+ CbFuncPtr CbShutdown, CbFuncPtr CbCreateStateMachine, SI_32 schedPrio) {
+ HANDLE hChildQ = NULL;
+ FrameworkunifiedChildThreadAttr attr;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && NULL != CbInitialize && NULL != CbShutdown &&
+ NULL != CbCreateStateMachine) {
+ CreateChildThreadAttrInit(&attr);
+ CreateChildThreadAttrSetSched(&attr, eFrameworkunifiedSchedPolicyRR, schedPrio);
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, &attr, CbCreateStateMachine);
+ }
+ return hChildQ;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateHSMChildThreadWithAttribute
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThreadWithAttribute(HANDLE hApp,
+ PCSTR childName,
+ CbFuncPtr CbInitialize,
+ CbFuncPtr CbShutdown,
+ CbFuncPtr CbCreateStateMachine,
+ const FrameworkunifiedChildThreadAttr *attr) {
+ HANDLE hChildQ = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && NULL != CbInitialize && NULL != CbShutdown &&
+ NULL != CbCreateStateMachine) {
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, attr, CbCreateStateMachine);
+ }
+ return hChildQ;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp
new file mode 100755
index 0000000..a8289a0
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp
@@ -0,0 +1,337 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedOrthogonalState class definitions. CFrameworkunifiedOrthogonalState is derived from
+/// CFrameworkunifiedCompositeState class.This class implements the additional functionality supported by HSM
+/// Orthogonal state. It provides the standard interfaces for adding orthogonal state machines.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_orthogonalstate.h>
+#include <native_service/frameworkunified_sm_compositestate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <sstream>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedCompositeState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedOrthogonalState::CFrameworkunifiedOrthogonalState(std::string f_pName): CFrameworkunifiedState(f_pName) {
+ try {
+ m_pOrthogonalReigonList = new OrthogonalRegionList();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedOrthogonalState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedOrthogonalState::~CFrameworkunifiedOrthogonalState() {
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ delete m_pOrthogonalReigonList->at(l_uiCount);
+ }
+ }
+ m_pOrthogonalReigonList->clear();
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "CFrameworkunifiedOrthogonalState destructor");
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedAddOrthogonalRegion(CFrameworkunifiedCompositeState *f_pOrthogonalRegion) {
+ try {
+ CHKNULL(f_pOrthogonalRegion);
+ CHKNULL(m_pOrthogonalReigonList);
+ f_pOrthogonalRegion->m_pParentState = this;
+ m_pOrthogonalReigonList->push_back(f_pOrthogonalRegion);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedOrthogonalState::FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pCurrentState = NULL;
+ CFrameworkunifiedState *l_pActiveState = NULL;
+
+ try {
+ FrameworkunifiedOnEntry(f_pEventData);
+
+ CHKNULL(m_pOrthogonalReigonList);
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ l_pActiveState = (m_pOrthogonalReigonList->at(l_uiCount));
+ CHKNULL(l_pActiveState);
+
+ l_pCurrentState = l_pActiveState->FrameworkunifiedOnHSMStart(f_pEventData);
+ CHKNULL(l_pCurrentState);
+
+ if (!IsOrthogonalChildState(l_pCurrentState)) {
+ break;
+ } else {
+ l_pCurrentState = this;
+ }
+ }
+ }
+
+ // set current state as the active state of its parent state to maintain the Hierarchy
+ if (m_pParentState) {
+ m_pParentState->m_pActiveState = l_pCurrentState;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pCurrentState;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedOrthogonalState::FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pCurrentState = NULL;
+ CFrameworkunifiedState *l_pActiveState = NULL;
+
+ try {
+ CHKNULL(m_pOrthogonalReigonList);
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ l_pActiveState = (m_pOrthogonalReigonList->at(l_uiCount));
+ CHKNULL(l_pActiveState);
+
+ l_pCurrentState = l_pActiveState->FrameworkunifiedOnHSMStop(f_pEventData);
+ CHKNULL(l_pCurrentState);
+
+ if (!IsOrthogonalChildState(l_pCurrentState)) {
+ break;
+ } else {
+ l_pCurrentState = this;
+ }
+ }
+ }
+ FrameworkunifiedOnExit(f_pEventData);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pCurrentState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEvent
+/// This function processes the event. If the reaction for event is available in the current
+/// state within eventlist and deferred eventlist then it is consumed in the current state
+/// otherwise forwarded to the parent state. Event forwarding is done recursively till either
+/// event is consumed or the root state has encountered. This also process the events posted
+/// in the reactions recursively till all posted events are cleared.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedOrthogonalState::FrameworkunifiedOnEvent(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pCurrentState = NULL;
+ CFrameworkunifiedState *l_pStateIterator = NULL;
+ CFrameworkunifiedState *l_pOrthogonalRegion = NULL;
+ BOOL l_bReactionAvailable = FALSE;
+ BOOL l_bIsEventProcessed = FALSE;
+
+ try {
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ l_pOrthogonalRegion = m_pOrthogonalReigonList->at(l_uiCount);
+
+ if (l_pOrthogonalRegion) {
+ // get the current active state
+ l_pCurrentState = l_pOrthogonalRegion->FrameworkunifiedGetActiveState();
+ CHKNULL(l_pCurrentState);
+
+ l_pStateIterator = l_pCurrentState;
+
+ // checks whether the reaction for the event is available in this orthogonal region
+ while (this != l_pStateIterator) {
+ if (l_pStateIterator->FrameworkunifiedIsReactionAvailable(f_pEventData->m_uiEventId)) {
+ l_bReactionAvailable = TRUE;
+ l_bIsEventProcessed = TRUE;
+ break;
+ }
+
+ // iterate to parent state in orthogonal region
+ l_pStateIterator = l_pStateIterator->m_pParentState;
+ }
+
+ // if reaction is found, post the event
+ if (l_bReactionAvailable) {
+ l_bReactionAvailable = FALSE;
+
+ l_pCurrentState = l_pCurrentState->FrameworkunifiedOnEvent(f_pEventData);
+ CHKNULL(l_pCurrentState);
+
+ // check whether current active state is within the orthogonal state
+ if (IsOrthogonalChildState(l_pCurrentState)) {
+ l_pCurrentState = this;
+ }
+
+ break;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Reaction not available in orthogonal region %s",
+ l_pOrthogonalRegion->m_strStateName.c_str());
+ l_pCurrentState = this;
+ }
+ }
+ }
+
+ // if event is not processed in any of orthogonal region, post the event to orthogonal state
+ if (!l_bIsEventProcessed) {
+ l_pCurrentState = CFrameworkunifiedState::FrameworkunifiedOnEvent(f_pEventData);
+
+ // check whether current active state is within the orthogonal state
+ if (IsOrthogonalChildState(l_pCurrentState)) {
+ l_pCurrentState = this;
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pCurrentState;
+}
+
+BOOL CFrameworkunifiedOrthogonalState::FrameworkunifiedHasOrthogoanlRegions() {
+ try {
+ CHKNULL(m_pOrthogonalReigonList);
+
+ if (m_pOrthogonalReigonList->size()) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return FALSE;
+ }
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedPrintStates() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "%s:%s",
+ (m_pParentState->m_strStateName).c_str(), m_strStateName.c_str());
+
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ m_pOrthogonalReigonList->at(l_uiCount)->FrameworkunifiedPrintStates();
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+BOOL CFrameworkunifiedOrthogonalState::IsOrthogonalChildState(CFrameworkunifiedState *f_pChildState) {
+ CFrameworkunifiedState *l_pParentState = f_pChildState;
+ BOOL l_bIsOrthgonalChild = FALSE;
+ while (l_pParentState) {
+ if (this == l_pParentState) {
+ l_bIsOrthgonalChild = TRUE;
+ break;
+ }
+
+ l_pParentState = l_pParentState->m_pParentState;
+ }
+
+ return l_bIsOrthgonalChild;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedOrthogonalState::FrameworkunifiedGetActiveState() {
+ return this;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pStatemachine);
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size();
+ l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ m_pOrthogonalReigonList->at(l_uiCount)->FrameworkunifiedSetHSM(f_pStatemachine);
+ }
+ }
+ m_pStateMachine = f_pStatemachine;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ f_strXMLString << "<" << m_strStateName.c_str() << ">";
+ f_strXMLString << "<OrthogonalRegions>";
+
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ m_pOrthogonalReigonList->at(l_uiCount)->FrameworkunifiedPrintXML(f_strXMLString);
+ }
+ }
+
+ f_strXMLString << "</OrthogonalRegions>";
+ f_strXMLString << "</" << m_strStateName.c_str() << ">";
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::UpdateHistory() {
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp
new file mode 100755
index 0000000..97b6e3b
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp
@@ -0,0 +1,74 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedShallowHistoryState class definitions. CFrameworkunifiedShallowHistoryState is derived
+/// from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported by
+/// HSM ShallowHistory state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_shallowhistorystate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <string>
+
+// define static members of class
+const UI_32 CFrameworkunifiedShallowHistoryState::m_suievShallowHistory = 71;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedShallowHistoryState
+/// Parameterized constructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedShallowHistoryState::CFrameworkunifiedShallowHistoryState(std::string f_pName): CFrameworkunifiedHistoryState(f_pName) {
+ m_uiEventId = m_suievShallowHistory;
+ m_cEventName = "evShallowHistory";
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedShallowHistoryState
+/// Class destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedShallowHistoryState::~CFrameworkunifiedShallowHistoryState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "CFrameworkunifiedShallowHistoryState destructor");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedShallowHistoryState::UpdateHistory() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(m_pParentState);
+
+ m_pLastActiveState = m_pParentState->m_pActiveState;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp
new file mode 100755
index 0000000..af90583
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp
@@ -0,0 +1,634 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedState class implementation. CFrameworkunifiedState is base class for all types of
+/// state classes.This class implements the basic functionality required for HSM state.
+/// It provides the standard interfaces for entering, exiting and reacting in a state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_reaction.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <sstream>
+#include <string>
+#include <utility>
+#include "frameworkunified_sm_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState::CFrameworkunifiedState(std::string f_pName): m_strStateName(f_pName) {
+ try {
+ // EventList stores the list of events associated with the state
+ m_pEventList = new EventReactionList(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // Deferred eventlist stores the list of deferred events associated
+ // with the state
+ m_pDeferredEventList = new DeferredEventList(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // Deferred PostEventList stores the list of posted deferred events posted
+ // in the state
+ m_pDeferredPostEventList = new EventInfoList(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // EventName map stores the Name of event against event id, The event name is
+ // only used for debugging so this can be disbaled in case of release build
+ m_pEventName = new EventNameList(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ m_pDefaultState = NULL;
+ m_pActiveState = NULL;
+ m_pParentState = NULL;
+ m_pStateMachine = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "%s state created ", f_pName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed in %s state ", f_pName.c_str());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState::~CFrameworkunifiedState() {
+ EventReactionIterator l_objEventIterator;
+ EventReactionIterator l_objDeferredEventIterator;
+
+ try {
+ // Delete the event list
+ CHKNULL(m_pEventList);
+ for (l_objEventIterator = m_pEventList->begin();
+ l_objEventIterator != m_pEventList->end();
+ l_objEventIterator++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, " deleting the event %d in state %s",
+ (*l_objEventIterator).first , m_strStateName.c_str());
+
+ if (NULL != (*l_objEventIterator).second) {
+ (*l_objEventIterator).second->m_ucRefCount--;
+
+ if (0 == ((*l_objEventIterator).second->m_ucRefCount)) {
+ delete(*l_objEventIterator).second;
+ (*l_objEventIterator).second = NULL;
+ }
+ }
+ }
+
+ // Delete the eventlist
+ m_pEventList->clear();
+ delete m_pEventList;
+ m_pEventList = NULL;
+
+ // Delete the deferred eventlist
+ CHKNULL(m_pDeferredEventList);
+ m_pDeferredEventList->clear();
+ delete m_pDeferredEventList;
+ m_pDeferredEventList = NULL;
+
+ // delete deferred Post event list
+ CHKNULL(m_pDeferredPostEventList);
+ m_pDeferredPostEventList->clear();
+ delete m_pDeferredPostEventList;
+ m_pDeferredPostEventList = NULL;
+
+ // delete event name list
+ CHKNULL(m_pEventName);
+ m_pEventName->clear();
+ delete m_pEventName;
+ m_pEventName = NULL;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAddEvent
+/// Associates the event id with the reaction in the state. When the event is posted to the
+/// state the associated reaction is executed. This also adds the event name to the map
+/// which is used for debugging.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedAddEvent(UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ // LCOV_EXCL_BR_START 15:marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pEventName);
+ CHKNULL(m_pEventList);
+ CHKNULL(f_pReaction);
+ // LCOV_EXCL_BR_STOP
+ // associate the eventname with event id (debugging only)
+ m_pEventName->insert(std::pair<UI_32, std::string>(f_uiEventId, f_strEventName));
+
+ f_pReaction->m_ucRefCount++;
+
+ // associate the reaction with event id
+ m_pEventList->insert(std::pair<UI_32, CFrameworkunifiedReaction *>(f_uiEventId, f_pReaction));
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Reaction associated with the event %d %s in the state %s "
+ , f_uiEventId, (m_pEventName->find(f_uiEventId)->second).c_str(), m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to add event %d %s in state %s",
+ f_uiEventId , (m_pEventName->find(f_uiEventId)->second).c_str(), m_strStateName.c_str());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEvent
+/// This function processes the event. If the reaction for event is available in the current
+/// state within eventlist and deferred eventlist then it is consumed in the current state
+/// otherwise forwarded to the parent state. Event forwarding is done recursively till either
+/// event is consumed or the root state has encountered. This also process the events posted
+/// in the reactions recursively till all posted events are cleared.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedState::FrameworkunifiedOnEvent(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pCurrentState = this;
+ CFrameworkunifiedReaction *l_pEventReaction = NULL;
+
+ try {
+ // LCOV_EXCL_BR_START 15:marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pEventList);
+ CHKNULL(m_pDeferredEventList);
+ // LCOV_EXCL_BR_STOP
+ // Find the reaction object for given event id
+
+ /**
+ * @todo
+ * Unauthorized accesses will occur if NULL is specified for the event data.
+ */
+ if (m_pEventList->end() != m_pEventList->find(f_pEventData->m_uiEventId)) {
+ l_pEventReaction = reinterpret_cast<CFrameworkunifiedReaction *>((m_pEventList->find(f_pEventData->m_uiEventId))->second);
+ }
+
+ if (l_pEventReaction) {
+ // execute the reaction associated with the event
+ l_pCurrentState = l_pEventReaction->FrameworkunifiedReaction(this, f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "Reaction completed for event %d %s in state %s "
+ , f_pEventData->m_uiEventId, (m_pEventName->find(f_pEventData->m_uiEventId)->second).c_str(),
+ m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ } else if (IsEventDeferred(f_pEventData->m_uiEventId)) {
+ // If given event is deferred event then handle defer event
+ CHKNULL(m_pDeferredPostEventList);
+
+ m_pDeferredPostEventList->push_back(f_pEventData);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "deferred event %d %s posted to state %s ",
+ f_pEventData->m_uiEventId,
+ (m_pEventName->find(f_pEventData->m_uiEventId)->second).c_str(),
+ m_strStateName.c_str());
+
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "Reaction not available or event %d not found in state %s"
+ , f_pEventData->m_uiEventId, m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ // check if the current state has parent state
+ if (m_pParentState) {
+ // No reaction available fot given event in the current state
+ // then forward event to parent state
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Forwarding an event %d to %s"
+ , f_pEventData->m_uiEventId, m_pParentState->m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ l_pCurrentState = m_pParentState->FrameworkunifiedOnEvent(f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+
+ } else {
+ // No parent is available then reached root state,
+ // No reaction available in the statemachine then discard the event
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Discarding an event %d ", f_pEventData->m_uiEventId);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ CHKNULL(l_pCurrentState);
+
+ // This is a recursive function that recurse in parent states till the event is
+ // consumed or discarded So Setting the current state as the active state of the
+ // returned state, as the return state is parent state
+ if (l_pCurrentState->m_pActiveState) {
+ l_pCurrentState = l_pCurrentState->m_pActiveState;
+
+ } else {
+ // do nothing in leaf state, as current state is active state
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+ return l_pCurrentState;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAddDeferredEvent
+/// When the event is posted to the state the event is deferred and stored in the state.
+/// In case of implicit recall of the deferred events, events are processed before exiting the state.
+/// The deferred events can also be recalled explicitly in the state.
+/// This also adds the event name to the map which is used for debugging.
+//////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedAddDeferredEvent(UI_32 f_uiEventId, std::string f_strEventName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ // LCOV_EXCL_BR_START 15:marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pEventName);
+
+ CHKNULL(m_pDeferredEventList);
+ // LCOV_EXCL_BR_STOP
+ // associate the deferred eventname with event id (debugging only)
+ m_pEventName->insert(std::pair<UI_32, std::string>(f_uiEventId, f_strEventName));
+
+ // associate the reaction with deferred event id
+ m_pDeferredEventList->push_back(f_uiEventId); // LCOV_EXCL_BR_LINE 11:except branch
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Added deferred event %d %s in the state %s "
+ , f_uiEventId, (m_pEventName->find(f_uiEventId)->second).c_str(), m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to add event %d %s in state %s",
+ f_uiEventId, (m_pEventName->find(f_uiEventId)->second).c_str(), m_strStateName.c_str());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPostEvent
+/// This function creates new eventdata object and add the to event queue of the state.
+/// The events are posted in the reaction which are executed in the state.
+/// The event queue is processed once the execution of the reaction is completed.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedPostEvent(UI_32 f_uiEventId) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pStateMachine); // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+
+ CEventDataPtr l_pEventData(new CEventData(f_uiEventId)); // LCOV_EXCL_BR_LINE 11:except branch
+
+ l_eStatus = m_pStateMachine->FrameworkunifiedPostEvent(l_pEventData); // LCOV_EXCL_BR_LINE 11:except branch // LCOV_EXCL_BR_LINE 11:except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPostEvent
+/// This function adds the event queue of the state. The events are posted in the reaction
+/// which are executed in the state. The event queue is processed once the execution of the
+/// reaction is completed.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedPostEvent(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(m_pStateMachine);
+ CHKNULL(f_pEventData);
+
+ l_eStatus = m_pStateMachine->FrameworkunifiedPostEvent(f_pEventData);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnHSMStart
+/// This function is called recursively till the leaf state is reached. This internally
+/// calls the Entry function of the current state.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedState::FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pActiveState = this;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ // Call Entry method of the current state. Entry method of state is called in the order of
+ // Hierarchy from Outer state to Inner state
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedOnEntry(f_pEventData))) {
+ // If current state has sub states then enter into active state for state entry
+ // active state is same as the default state. In this case the FrameworkunifiedOnStart is called
+ // recursively and recursion breaks when the current state is leafstate that does not have
+ // any active/default state.
+ if (m_pActiveState) {
+ l_pActiveState = m_pActiveState->FrameworkunifiedOnHSMStart(f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ l_pActiveState = this;
+ }
+
+ // set current state as the active state of its parent state to maintain the Hierarchy
+ if (m_pParentState) {
+ m_pParentState->m_pActiveState = this;
+ }
+ } else {
+ // If FrameworkunifiedOnEntry failed then statemachine should report the error
+ // We can throw an exception but for now as a quick fix we are setting
+ // l_pActiveState as NULL which will stop the statemachine
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error:%d in FrameworkunifiedOnEntry of state %s", eStatus,
+ l_pActiveState->m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ // l_pActiveState = NULL;
+ /* Commenting it, because it was making state machine inactive. This should not be the expected behavior.
+ * Just log and take no action, if user return non-ok value.
+ * User defined error values should be handled separately */
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pActiveState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnHSMStop
+/// This function is called recursively till the required parent state is reached. This
+/// internally calls the Exit function of the current state.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedState::FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pActiveState = this;
+ try {
+ // if active state is composite state, update the shallow and deep history state(if exists)
+ UpdateHistory(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // if current state has active state then recursively call the FrameworkunifiedOnHSMStop till current
+ // state has no active state i.e. current state is leaf state
+ if (m_pActiveState) {
+ m_pActiveState->FrameworkunifiedOnHSMStop(f_pEventData);
+ }
+
+ m_pActiveState = m_pDefaultState;
+
+ // Post deferred events to statemachine event queue
+ CHKNULL(m_pDeferredPostEventList); // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+
+ // recall deferred events till the vector is empty
+ while (!m_pDeferredPostEventList->empty()) {
+ // get the first event list object
+ CEventDataPtr l_pEventData = m_pDeferredPostEventList->front();
+
+ CHKNULL(l_pEventData);
+ CHKNULL(m_pEventName);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Recalling event %d %s in state %s"
+ , l_pEventData->m_uiEventId,
+ (m_pEventName->find(l_pEventData->m_uiEventId)->second).c_str(), m_strStateName.c_str());
+
+ m_pDeferredPostEventList->erase(m_pDeferredPostEventList->begin());
+
+ // recall the event stored in the eventinfo object
+ FrameworkunifiedPostEvent(l_pEventData);
+ }
+
+ FrameworkunifiedOnExit(f_pEventData);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pActiveState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// IsEventDeferred
+/// This checks if the given event is marked as deferred in the state.
+///////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFrameworkunifiedState::IsEventDeferred(UI_32 f_uiEventId) {
+ BOOL bStatus = FALSE;
+ try {
+ CHKNULL(m_pDeferredEventList); // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pDeferredEventList->size(); l_uiCount++) {
+ if (f_uiEventId == m_pDeferredEventList->at(l_uiCount)) {
+ bStatus = TRUE;
+ break;
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+
+ return bStatus; // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedRemoveEventFromDeferredEventList
+/// This function removes the event from the posted deferred queue list of the state.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedRemoveEventFromDeferredEventList(UI_32 f_uiEventId) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldID;
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "+");
+
+ try {
+ CHKNULL(m_pDeferredPostEventList);
+ int32_t l_siCnt = static_cast<int32_t>(m_pDeferredPostEventList->size() - 1);
+
+ for (; l_siCnt >= 0; l_siCnt--) {
+ if (NULL != m_pDeferredPostEventList->at(l_siCnt).get()) {
+ if (f_uiEventId == m_pDeferredPostEventList->at(l_siCnt).get()->m_uiEventId) {
+ m_pDeferredPostEventList->erase(m_pDeferredPostEventList->begin() + l_siCnt);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedRecallEvent
+/// This indicates if the state has sub states. It returns TRUE only in the CompositeState
+/// where this function is overridden
+///////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFrameworkunifiedState::FrameworkunifiedHasSubStates() {
+ return FALSE;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPrintStates
+/// This logs the state name and events associated with the state
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedPrintStates() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ EventReactionIterator l_objEventIterator;
+ try {
+ CHKNULL(m_pEventList);
+ CHKNULL(m_pDeferredEventList);
+ CHKNULL(m_pEventName);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "%s:%s",
+ (m_pParentState->m_strStateName).c_str(), m_strStateName.c_str());
+
+ // print events
+ for (l_objEventIterator = m_pEventList->begin();
+ l_objEventIterator != m_pEventList->end(); l_objEventIterator++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "event %d %s", ((*l_objEventIterator).first),
+ (m_pEventName->find((*l_objEventIterator).first)->second).c_str());
+ }
+
+ // print deferred events
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pDeferredEventList->size(); l_uiCount++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "deferred event %d %s", m_pDeferredEventList->at(l_uiCount),
+ (m_pEventName->find(m_pDeferredEventList->at(l_uiCount))->second).c_str());
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to print in state %s", m_strStateName.c_str());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+BOOL CFrameworkunifiedState::FrameworkunifiedHasOrthogoanlRegions() {
+ return FALSE;
+}
+
+BOOL CFrameworkunifiedState::FrameworkunifiedIsReactionAvailable(UI_32 f_uiEventId) {
+ BOOL IsReactionAvailable = FALSE;
+ CFrameworkunifiedReaction *l_pEventReaction = NULL;
+
+ try {
+ // LCOV_EXCL_BR_START 15:marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pEventList);
+ CHKNULL(m_pDeferredEventList);
+ // LCOV_EXCL_BR_STOP
+ if (m_pEventList->end() != m_pEventList->find(f_uiEventId)) {
+ // Find the reaction object for given event id
+ l_pEventReaction = reinterpret_cast<CFrameworkunifiedReaction *>((m_pEventList->find(f_uiEventId))->second);
+ }
+
+ if (l_pEventReaction) {
+ IsReactionAvailable = TRUE;
+ } else {
+ if (IsEventDeferred(f_uiEventId)) {
+ IsReactionAvailable = TRUE;
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+
+ return IsReactionAvailable; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(f_pStatemachine); // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+ m_pStateMachine = f_pStatemachine;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+HANDLE CFrameworkunifiedState:: FrameworkunifiedGetAppHandle() {
+ HANDLE l_pHApp = NULL;
+ try {
+ CHKNULL(m_pStateMachine); // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+ l_pHApp = m_pStateMachine->FrameworkunifiedGetAppHandle(); // LCOV_EXCL_BR_LINE 11:except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+ return l_pHApp; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EventReactionIterator l_objEventIterator;
+ try {
+ CHKNULL(m_pEventList);
+ CHKNULL(m_pDeferredEventList);
+ CHKNULL(m_pEventName);
+
+ f_strXMLString << "<" << m_strStateName.c_str() << ">";
+
+ f_strXMLString << "<EventList>";
+ // print events
+ for (l_objEventIterator = m_pEventList->begin();
+ l_objEventIterator != m_pEventList->end(); l_objEventIterator++) {
+ std::string l_strEventName =
+ (m_pEventName->find((*l_objEventIterator).first)->second);
+
+ UI_32 l_uiEventId = (*l_objEventIterator).first;
+
+ f_strXMLString << "<Event " << "Id = " << "\"" << l_uiEventId << "\">";
+
+ f_strXMLString << "<Name>" << l_strEventName.c_str() << "</Name>";
+
+ f_strXMLString << "</Event>";
+ }
+ f_strXMLString << "</EventList>";
+
+ // print deferred events
+ f_strXMLString << "<DeferredEventList>";
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pDeferredEventList->size(); l_uiCount++) {
+ UI_32 l_uiEventId = m_pDeferredEventList->at(l_uiCount);
+
+ std::string l_strEventName = (m_pEventName->find(l_uiEventId)->second);
+
+ f_strXMLString << "<Event " << "Id = " << "\"" << l_uiEventId << "\">";
+
+ f_strXMLString << "<Name>" << l_strEventName.c_str() << "</Name>";
+
+ f_strXMLString << "</Event>";
+ }
+
+ f_strXMLString << "</DeferredEventList>";
+ f_strXMLString << "</" << m_strStateName.c_str() << ">";
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to print in state %s", m_strStateName.c_str());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp
new file mode 100755
index 0000000..1162f61
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedTransition class definitions.This class provides the interface
+/// for reacting local transition and external transition
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_transition.h>
+#include <native_service/frameworkunified_sm_state.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedTransition
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedTransition::CFrameworkunifiedTransition(CFrameworkunifiedState *f_pTargetState): m_pTargetState(f_pTargetState) {
+ if (m_pTargetState) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Transition created with Target %s ",
+ (m_pTargetState->m_strStateName).c_str());
+ // LCOV_EXCL_BR_STOP
+ }
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedTransition
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedTransition::~CFrameworkunifiedTransition() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+}
+
diff --git a/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/makefile b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/makefile
new file mode 100755
index 0000000..964a1f5
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/makefile
@@ -0,0 +1,99 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+COMPONENT_NAME = NS_FrameworkCore
+
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG). \
+ $(CC_IFLAG)../../inc \
+ $(CC_IFLAG)../../inc/statemachine \
+ $(DEPENDS_INCLUDES) \
+
+
+## Sources Section
+
+SOURCES = \
+ $(wildcard *.c*)
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard ../../inc/*.h) \
+ $(wildcard ../../inc/NS_Statemachine/*.h) \
+ $(wildcard $(REPOSITORY_ROOT)NativeServices/inc/*.h) \
+
+# Make targets
+# Standard
+all: banner module_dirs local
+
+base: banner module_dirs subdirs local
+
+binary: base
+
+local: $(OBJECTS)
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+# Defines specific for each deliverable
+
+
+# Default source file build rules
+$(OBJECTS): $(HEADERS)
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+
+module_dirs: build_dirs
diff --git a/nsframework/framework_unified/client/NS_Logger/cfg/depends.mk b/nsframework/framework_unified/client/NS_Logger/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Logger/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_Logger/include/frameworkunified_stub.h b/nsframework/framework_unified/client/NS_Logger/include/frameworkunified_stub.h
new file mode 100755
index 0000000..2263038
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Logger/include/frameworkunified_stub.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_FRAMEWORKUNIFIED_STUB_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_FRAMEWORKUNIFIED_STUB_H_
+
+/*#include <PosixBasedOS001legacy_types.h>*/ // for _UintXXt
+
+#define _NTO_TRACE_USERFIRST (0x00000000)
+
+// from types.h
+typedef char *__NTO_va_list;
+
+// from sys/platform.h
+#define __CLOCKADJUST \
+ { \
+ unsigned long tick_count; /*NOLINT (readability/nolint)*/\
+ long tick_nsec_inc; /*NOLINT (readability/nolint)*/\
+ }
+
+// from syspage.h
+struct _clockadjust __CLOCKADJUST;
+struct qtime_entry {
+ _Uint64t cycles_per_sec; /* for ClockCycle */
+ _Uint64t volatile nsec_tod_adjust;
+ _Uint64t volatile nsec;
+ unsigned long nsec_inc; // NOLINT (readability/nolint)
+ unsigned long boot_time; /* UTC seconds when machine booted */ // NOLINT (readability/nolint)
+
+ struct _clockadjust adjust;
+ unsigned long timer_rate; /* times 10^timer_scale */ // NOLINT (readability/nolint)
+ long timer_scale; // NOLINT (readability/nolint)
+ unsigned long timer_load; // NOLINT (readability/nolint)
+ long intr; // NOLINT (readability/nolint)
+ unsigned long epoch; // NOLINT (readability/nolint)
+ unsigned long flags; // NOLINT (readability/nolint)
+ unsigned int rr_interval_mul;
+ unsigned long spare0; // NOLINT (readability/nolint)
+ _Uint64t volatile nsec_stable;
+ unsigned long spare[4]; // NOLINT (readability/nolint)
+};
+
+struct syspage_entry *_syspage_ptr;
+
+typedef struct {
+ _Uint16t entry_off;
+ _Uint16t entry_size;
+} syspage_entry_info;
+
+struct syspage_entry {
+ _Uint16t size; /* size of syspage_entry */
+ _Uint16t total_size; /* size of system page */
+ _Uint16t type;
+ _Uint16t num_cpu;
+ syspage_entry_info system_private;
+ syspage_entry_info asinfo;
+ syspage_entry_info meminfo;
+ syspage_entry_info hwinfo;
+ syspage_entry_info cpuinfo;
+ syspage_entry_info cacheattr;
+ syspage_entry_info qtime;
+ syspage_entry_info callout;
+ syspage_entry_info callin;
+ syspage_entry_info typed_strings;
+ syspage_entry_info strings;
+ syspage_entry_info intrinfo;
+ syspage_entry_info smp;
+ syspage_entry_info pminfo;
+ syspage_entry_info mdriver;
+ long spare[2]; // NOLINT (readability/nolint)
+ union {
+#if defined(SYSPAGE_TARGET_ALL) || defined(SYSPAGE_TARGET_X86)
+ struct x86_syspage_entry x86;
+#endif
+#if defined(SYSPAGE_TARGET_ALL) || defined(SYSPAGE_TARGET_PPC)
+ struct ppc_syspage_entry ppc;
+#endif
+#if defined(SYSPAGE_TARGET_ALL) || defined(SYSPAGE_TARGET_MIPS)
+ struct mips_syspage_entry mips;
+#endif
+#if defined(SYSPAGE_TARGET_ALL) || defined(SYSPAGE_TARGET_ARM)
+ struct arm_syspage_entry arm;
+#endif
+#if defined(SYSPAGE_TARGET_ALL) || defined(SYSPAGE_TARGET_SH)
+ struct sh_syspage_entry sh;
+#endif
+ struct {
+ long filler[20]; // NOLINT (readability/nolint)
+ } filler;
+ } un;
+};
+
+#define _SYSPAGE_ENTRY( __base, __field ) /*NOLINT (readability/nolint)*/\
+ ((struct __field##_entry *)reinterpret_cast<void *>(reinterpret_cast<char *>(__base)\
+ + (__base)->__field.entry_off))
+#define SYSPAGE_ENTRY(__field) _SYSPAGE_ENTRY(_syspage_ptr, __field)
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_FRAMEWORKUNIFIED_STUB_H_
diff --git a/nsframework/framework_unified/client/NS_Logger/include/ns_logger_internal.h b/nsframework/framework_unified/client/NS_Logger/include/ns_logger_internal.h
new file mode 100755
index 0000000..97bde91
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Logger/include/ns_logger_internal.h
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief API Header for Zone Player Service APIs to be used by senders and
+/// receivers.
+///
+/// Declares the external APIs to Zone Player Service.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_NS_LOGGER_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_NS_LOGGER_INTERNAL_H_
+
+// PASA Headers
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _GetTimeString(PSTR format, UI_16 length);
+void _BuildFormatString(HANDLE hMsgQ, const UI_16 f_uiZoneIndex, PCSTR process_name, PCSTR p_pstrClassName_i,
+ const UI_32 p_lLine_i, PCSTR lpszFormat, PSTR format, UI_16 length);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_NS_LOGGER_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_Logger/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_Logger/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..25318be
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Logger/src/makefile_PosixBasedOS001
@@ -0,0 +1,223 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_Logger
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_Logger
+
+#All possible logging options
+#NS_LOG_FORMAT = NS_LCLOCKCYCLES_IN_TIMESTRING
+#NS_LOG_FORMAT = NS_LCLOCKCYCLES_IN_MS
+#NS_LOG_FORMAT = NS_LCURDATETIME
+
+ifndef NS_LOG_FORMAT
+NS_LOG_FORMAT = NS_LCURDATETIME
+endif
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS += -D $(NS_LOG_FORMAT)
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_MessageQueue/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NS_MessageQueue/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NS_Logger/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+# NS_MessageCenter library is added as dependency for logger.
+# This is a temporary solution to support event logger (required by VehicleServices).
+# Fix the problem in proper way so that it should not depend on NS_MessageCenter after PastModel002 delivery.
+ifdef DYNAMIC
+ DYNAMIC_LIBS += \
+ NS_MessageQueue$(DEBUG_EXT) \
+ NS_MessageCenter$(DEBUG_EXT)
+else
+ STATIC_LIBS +=
+endif
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
+
diff --git a/nsframework/framework_unified/client/NS_Logger/src/ns_logger.cpp b/nsframework/framework_unified/client/NS_Logger/src/ns_logger.cpp
new file mode 100755
index 0000000..94f775c
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Logger/src/ns_logger.cpp
@@ -0,0 +1,2260 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief
+///
+/// Frameworkunified Framework Handlers Logging to log services.
+///////////////////////////////////////////////////////////////////////////////
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/timeb.h>
+#include <time.h>
+#include <sys/syscall.h>
+#include <sys/prctl.h>
+#include <syslog.h>
+#include <boost/algorithm/string.hpp>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <aglpath.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <arpa/inet.h>
+
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/ns_ringbuffer.h>
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_eventlogger.h>
+#include <native_service/cl_lockid.h>
+
+#ifdef AGL_STUB
+#include <other_service/strlcat.h>
+#include <other_service/strlcpy.h>
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include "frameworkunified_stub.h"
+#else
+#include <sys/neutrino.h>
+#include <sys/trace.h> // trace_nlogf
+#include <sys/slog.h>
+#include <sys/slogcodes.h>
+#include <sys/syspage.h>
+#endif
+
+#include <map>
+#include <vector>
+#include <sstream>
+#include <utility>
+#include <string>
+
+#include "ns_logger_internal.h"
+#include "ns_msg_queue.h"
+#include "mqueue.h"
+
+static HANDLE g_hSSEventLogQ = INVALID_HANDLE;
+#ifndef AGL_STUB
+static HANDLE g_hNSplogMsgQ = INVALID_HANDLE;
+#endif
+static HANDLE g_hNSSysEventLogQ = INVALID_HANDLE;
+static __thread CHAR tls_strProcessName[MAX_NAME_SIZE_APP];
+static __thread pid_t tid = 0;
+static UI_32 g_msgcounter = 0;
+static FRAMEWORKUNIFIEDLOGPARAM g_LocalFrameworkunifiedLogParams;
+static UI_32 syslogopened;
+static int shm_fd = -1;
+static const unsigned int default_log_cfgtbl[] = {
+ // realTimeLog
+ FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF,
+ // flagIdNum
+ 1,
+ // logLevel
+ FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE,
+};
+static void *shm_pmap = reinterpret_cast<void *>(const_cast<unsigned int*>(default_log_cfgtbl));
+#define EXE_STR_LEN 64
+static char exe_link_path[EXE_STR_LEN] = {0};
+
+/// For PLog
+#define PLOG_GAP_FILE "/dev/shmem/Plog.gap"
+#define MAX_GAP_BUFFER_LEN 80
+#define MAX_PLOG_STRING_SIZE 1024
+#define MAX_TIME_FORMATSTR_LEN 3
+#define RETRY_COUNT 5
+FRAMEWORKUNIFIEDLOGPPARAM g_FrameworkunifiedLogPParams = {FALSE, EPLOG_TIME_FORMAT_USEC, 0, EPLOG_MSGQ}; // default values for PLog
+FRAMEWORKUNIFIEDLOGSYSEVENTPARAM g_FrameworkunifiedLogSysEventParams = {FALSE}; // default values for System event log
+
+#define ZONEMASK_MAX BITS_IN_TZONE // ((UI_32)(BITS_IN_TZONE * TZONE_COUNT))
+
+#define FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID (0)
+#define FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__FN "/usr/agl/conf/BS/ns/framework_unified/rodata/ns_logger_frameworkunifiedlog__CWORD84_.cfg"
+#define FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__TMP "ns_logger_frameworkunifiedlog__CWORD84_.tmp"
+#define FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV "ns_logger_frameworkunifiedlog__CWORD84_.cfg"
+
+#define FRAMEWORKUNIFIEDLOG_CONFIG_NV "/nv/BS/ns/framework_unified/rwdata/"
+
+#define FRAMEWORKUNIFIEDLOG_CONFIG_TMP_NV "ns_logger_frameworkunifiedlog_tmp.cfg"
+#ifndef TN_LOGGERRTIME
+#define TN_LOGGERRTIME "LoggerRtime"
+#define PR_LOGGERRTIME_S PR_TSS_S
+#define PR_LOGGERRTIME PR_TSS
+#endif // TN_LOGGERRTIME
+#define USB_REALTIME_MSGMAX 256
+#define USB_REALTIME_SIZMAX 4096
+#define USB_REALTIME_QNAME "/PlRtLogger"
+#define USB_REALTIME_RTRYMAX 10
+static mqd_t g_qid = (mqd_t)(-1);
+
+unsigned int g_FlagIdNum;
+std::vector<std::string> g_flag_name;
+
+typedef struct {
+ CNSRingBuffer *ring_buffer;
+ std::string file_name;
+ UI_32 size;
+ BOOL force_output;
+
+ BOOL real_time_log;
+} FrameworkunifiedLogMapTbl;
+
+typedef struct {
+ TFrameworkunifiedZone zone;
+ FrameworkunifiedLogMapTbl info;
+} FrameworkunifiedLogTbl;
+
+typedef std::map<TFrameworkunifiedZone, FrameworkunifiedLogMapTbl> TFrameworkunifiedLogMap;
+static TFrameworkunifiedLogMap g_FrameworkunifiedLogMap;
+static TFrameworkunifiedLogMap g_FrameworkunifiedLogFlagMap;
+static UI_32 g_FrameworkunifiedLogFlagId = FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID;
+
+static bool g_FrameworkunifiedLogFlagRealTimeLog = TRUE;
+pthread_mutex_t FrameworkunifiedLogMtx = PTHREAD_MUTEX_INITIALIZER;
+
+#ifdef ENABLE_DEBUG_SYSLOG // for FRAMEWORKUNIFIED_SET_ZONES() error
+#define DEB_SYSLOG(fmt, ...) {openlog(0, LOG_PID, LOG_USER); \
+ syslog(LOG_ERR, "[FRAMEWORKUNIFIEDLOG][ERR]EXE_LINK_PATH(%s)[%s:L%d] " fmt, exe_link_path, \
+ __FUNCTION__, __LINE__, ## __VA_ARGS__); \
+ closelog();}
+#else
+#define DEB_SYSLOG(fmt, ...)
+#endif
+
+static UI_32
+GetFrameworkunifiedLogRealtimeUartOutput(CNSConfigReader *cfg_reader) {
+ if (cfg_reader == NULL) {
+ return -1;
+ }
+
+ std::string output_str = cfg_reader->GetString("REALTIME_LOG.Output"); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (output_str.compare("UART") == 0) {
+ return FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART;
+ } else if (output_str.compare("USB") == 0) {
+ return FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB;
+ } else {
+ return FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ }
+}
+
+static EFrameworkunifiedStatus
+GetFrameworkunifiedLogZoneFileInfo(CNSConfigReader *cfg_reader, std::string &name, // NOLINT (readability/nolint)
+ FrameworkunifiedLogMapTbl &tbl, UI_32 &zone) { // NOLINT (readability/nolint)
+ std::string zone_key = name;
+ zone_key.append(".Zone");
+ std::string zone_filename_key = name; // LCOV_EXCL_BR_LINE 11:expect branch
+ zone_filename_key.append(".FileName");
+ std::string zone_filesize_key = name; // LCOV_EXCL_BR_LINE 11:expect branch
+ zone_filesize_key.append(".FileSizeMax");
+ std::string zone_force_output_key = name; // LCOV_EXCL_BR_LINE 11:expect branch
+ zone_force_output_key.append(".ForceOutput");
+
+ if (cfg_reader == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ tbl.ring_buffer = NULL;
+ tbl.file_name = cfg_reader->GetString(zone_filename_key);
+ tbl.size = static_cast<UI_32>(cfg_reader->GetInt(zone_filesize_key));
+ tbl.force_output
+ = (cfg_reader->GetString(zone_force_output_key) == "True") ? TRUE : FALSE;
+
+ tbl.real_time_log = TRUE;
+ zone = ZONEMASK(static_cast<UI_32>(cfg_reader->GetInt(zone_key)));
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus
+GetFrameworkunifiedLogFlagFileInfo(CNSConfigReader *cfg_reader, std::string &name, // NOLINT (readability/nolint)
+ FrameworkunifiedLogMapTbl &tbl, UI_32 &loglevel) { // NOLINT (readability/nolint)
+ std::string flag_loglevel_key = name;
+ flag_loglevel_key.append(".LogLevel");
+ std::string flag_filename_key = name; // LCOV_EXCL_BR_LINE 11:expect branch
+ flag_filename_key.append(".FileName");
+ std::string flag_filesize_key = name; // LCOV_EXCL_BR_LINE 11:expect branch
+ flag_filesize_key.append(".FileSizeMax");
+
+ std::string flag_real_time_log_key = name;
+ flag_real_time_log_key.append(".Realtimelog");
+
+ if (cfg_reader == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ tbl.ring_buffer = NULL;
+ tbl.file_name = cfg_reader->GetString(flag_filename_key); // LCOV_EXCL_BR_LINE 11:expect branch
+ tbl.size = static_cast<UI_32>(cfg_reader->GetInt(flag_filesize_key)); // LCOV_EXCL_BR_LINE 11:expect branch
+ tbl.force_output = FALSE;
+
+ tbl.real_time_log
+ = (cfg_reader->GetString(flag_real_time_log_key) == "False") ? FALSE : TRUE;
+
+
+ std::string loglevel_str = cfg_reader->GetString(flag_loglevel_key); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (loglevel_str.compare("Debug") == 0) {
+ loglevel = FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG;
+ } else {
+ loglevel = FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE;
+ }
+
+ if ((tbl.file_name.empty()) || (tbl.size == 0)) {
+ return eFrameworkunifiedStatusFail;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+static VOID
+GetFrameworkunifiedLogList(CNSConfigReader *cfg_reader, std::vector<std::string> &list, // NOLINT (readability/nolint)
+ std::string req_list) {
+ if (cfg_reader == NULL) {
+ return;
+ }
+
+ std::string list_str = cfg_reader->GetString(req_list);
+ if (!list_str.empty()) {
+ try {
+ boost::algorithm::split(list, list_str, boost::is_any_of(", "));
+ }
+ /*
+ * @todo
+ * Even if throw is executed by the process called by 'try', it cannot be captured by catch().
+ */
+ catch (...) {
+ fprintf(stderr, "occured exception handling by boost::algorithm::split in ns_logger\n");
+ }
+ }
+}
+
+static BOOL
+CheckMatchFrameworkunifiedLogFlagMap(TFrameworkunifiedLogMap &map, FrameworkunifiedLogMapTbl &check_tbl, // NOLINT (readability/nolint)
+ FrameworkunifiedLogMapTbl &out_tbl) { // NOLINT (readability/nolint)
+ TFrameworkunifiedLogMap::iterator itr;
+ for (itr = map.begin(); itr != map.end(); itr++) {
+ if (itr->second.file_name.compare(check_tbl.file_name) == 0) {
+ out_tbl = itr->second;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static BOOL
+IsDefinedFrameworkunifiedLogFlag(CNSConfigReader *cfg_reader, std::string &flag_name, // NOLINT (readability/nolint)
+ std::string &exe_name) { // NOLINT (readability/nolint)
+ UI_32 cnt = 1;
+ size_t pos1;
+
+ if (cfg_reader == NULL) {
+ return FALSE;
+ }
+
+ while (1) {
+ std::string service_key = flag_name;
+ std::ostringstream service_num; // LCOV_EXCL_BR_LINE 11:expect branch
+ service_num << ".Service" << cnt;
+ service_key.append(service_num.str());
+ std::string service_name = cfg_reader->GetString(service_key);
+ if (service_name.empty()) {
+ break;
+ }
+ pos1 = exe_name.find(service_name);
+ if ((pos1 != std::string::npos)
+ && (exe_name.length() - pos1) == service_name.length()) {
+ return TRUE;
+ }
+ cnt++;
+ }
+ return FALSE;
+}
+
+static VOID
+CreateFrameworkunifiedLogFileTbl(CNSConfigReader *cfg_reader, std::string &exe_str, // NOLINT (readability/nolint)
+ int *realTimeLog, int **logLevelArray) {
+ int *logLevel;
+
+ std::vector<std::string> zone_vector;
+ GetFrameworkunifiedLogList(cfg_reader, zone_vector, "ZONE_LIST.List");
+ for (UI_32 i = 0; i < zone_vector.size(); i++) {
+ FrameworkunifiedLogMapTbl zone_tbl;
+ UI_32 zone;
+ if (GetFrameworkunifiedLogZoneFileInfo(cfg_reader, zone_vector.at(i), zone_tbl, zone)
+ == eFrameworkunifiedStatusOK) {
+ g_FrameworkunifiedLogMap.insert(std::make_pair(zone, zone_tbl));
+ }
+ }
+
+ *realTimeLog = static_cast<int>(GetFrameworkunifiedLogRealtimeUartOutput(cfg_reader));
+
+ FrameworkunifiedLogMapTbl default_tbl;
+ UI_32 default_id = FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID;
+ std::string default_flag = "FLAG_DEFAULT"; // LCOV_EXCL_BR_LINE 11:expect branch
+ UI_32 default_loglevel;
+ if (GetFrameworkunifiedLogFlagFileInfo(cfg_reader, default_flag, default_tbl, default_loglevel)
+ != eFrameworkunifiedStatusOK) {
+ fprintf(stderr, "<WARNING>FRAMEWORKUNIFIEDLOG[%s:L%d]FLAG_DEFAULT is not definition into ns_logger_frameworkunifiedlog.cfg.\n",
+ __FUNCTION__, __LINE__);
+
+ DEB_SYSLOG("<WARNING>FLAG_DEFAULT is not definition into ns_logger_frameworkunifiedlog.cfg.)");
+ default_tbl.ring_buffer = NULL;
+ default_tbl.file_name = "frameworkunified_debug.log";
+ default_tbl.size = 100; // 100bytes
+
+ default_tbl.real_time_log = TRUE;
+ }
+ std::vector<std::string> flag_vector;
+ UI_32 flag_id = FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID + 1;
+ GetFrameworkunifiedLogList(cfg_reader, flag_vector, "FLAG_LIST.List"); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (g_FlagIdNum != (flag_vector.size() + 1)) {
+ if (!g_FrameworkunifiedLogFlagMap.empty()) {
+ TFrameworkunifiedLogMap::iterator delitr;
+ unsigned int delflag_id;
+ for (delflag_id = 0; delflag_id < g_FlagIdNum; delflag_id++) {
+ delitr = g_FrameworkunifiedLogFlagMap.find(delflag_id);
+ if (delitr->second.ring_buffer != NULL) {
+ delete delitr->second.ring_buffer;
+ delitr->second.ring_buffer = NULL;
+ }
+ }
+ g_FrameworkunifiedLogFlagMap.clear();
+ if (!g_flag_name.empty()) {
+ g_flag_name.clear();
+ }
+ }
+ g_FlagIdNum = static_cast<unsigned int>(flag_vector.size() + 1); // +1: [Add Default Flag]
+ g_flag_name.push_back(default_flag); // LCOV_EXCL_BR_LINE 11:expect branch
+ g_FrameworkunifiedLogFlagMap.insert(std::make_pair(default_id, default_tbl)); // LCOV_EXCL_BR_LINE 11:expect branch
+ }
+ logLevel = reinterpret_cast<int *>(malloc(sizeof(int) * g_FlagIdNum));
+ logLevel[0] = default_loglevel;
+
+ for (UI_32 i = 0; i < flag_vector.size(); i++) {
+ FrameworkunifiedLogMapTbl flag_tbl;
+ UI_32 loglevel;
+ if (GetFrameworkunifiedLogFlagFileInfo(cfg_reader, flag_vector.at(i), flag_tbl, loglevel)
+ == eFrameworkunifiedStatusOK) {
+ FrameworkunifiedLogMapTbl check_result_tbl;
+ if (CheckMatchFrameworkunifiedLogFlagMap(g_FrameworkunifiedLogFlagMap, flag_tbl, check_result_tbl)
+ == TRUE) {
+ flag_tbl.file_name = check_result_tbl.file_name;
+ flag_tbl.size = check_result_tbl.size;
+ }
+ if (g_FrameworkunifiedLogFlagMap.find(flag_id) == g_FrameworkunifiedLogFlagMap.end()) {
+ if (IsDefinedFrameworkunifiedLogFlag(cfg_reader, flag_vector.at(i), exe_str)
+ == TRUE) {
+ g_FrameworkunifiedLogFlagId = flag_id;
+
+ g_FrameworkunifiedLogFlagRealTimeLog = flag_tbl.real_time_log;
+ }
+ g_flag_name.push_back(flag_vector.at(i));
+ g_FrameworkunifiedLogFlagMap.insert(std::make_pair(flag_id, flag_tbl));
+ }
+ }
+ logLevel[flag_id] = loglevel;
+ flag_id++;
+ }
+ *logLevelArray = logLevel;
+}
+
+static VOID
+GetFrameworkunifiedLogRingBuffer(const UI_16 zone, CNSRingBuffer **ring_buf) {
+ TFrameworkunifiedLogMap::iterator itr = g_FrameworkunifiedLogMap.find(zone);
+
+ if (ring_buf == NULL) {
+ return;
+ }
+
+ if (itr == g_FrameworkunifiedLogMap.end()) {
+ itr = g_FrameworkunifiedLogFlagMap.find(g_FrameworkunifiedLogFlagId);
+ if (itr == g_FrameworkunifiedLogFlagMap.end()) {
+ // ASSERT
+ *ring_buf = NULL;
+ return;
+ }
+ }
+
+ pthread_mutex_lock(&FrameworkunifiedLogMtx);
+
+ if (itr->second.ring_buffer == NULL) {
+ std::string file_path;
+ int index;
+
+ file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ file_path.append("/"); // LCOV_EXCL_BR_LINE 11:expect branch
+ file_path.append(itr->second.file_name);
+
+ index = NSLogGetFrameworkunifiedlogIndex(file_path.c_str());
+ itr->second.ring_buffer = new(std::nothrow) CNSRingBuffer(file_path, itr->second.size,
+ index + LOCK_NSLOG_ACCES_IF_1); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (itr->second.ring_buffer != NULL) {
+ itr->second.ring_buffer->Open();
+ }
+ }
+ pthread_mutex_unlock(&FrameworkunifiedLogMtx);
+
+ *ring_buf = itr->second.ring_buffer;
+}
+
+static int
+MapShmInfo(int flagId) {
+ int size;
+ void *pmap;
+
+ if (shm_fd != -1) {
+ return -1;
+ }
+ shm_fd = shm_open(FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, O_RDONLY, S_IRWXU | S_IRWXO);
+ if (shm_fd == -1) {
+
+ DEB_SYSLOG("shm_open error errno:%d", errno);
+ return -1;
+ }
+ size = static_cast<int>(sizeof(int) * 2); // realTimeLog + flagIdNum
+ size += static_cast<int>(sizeof(int) * (flagId + 1)); // g_FrameworkunifiedLogFlagId + DefaultFlagId
+
+ pmap = reinterpret_cast<int *>(mmap(NULL, size, PROT_READ, MAP_SHARED, shm_fd, 0));
+ if (pmap == MAP_FAILED) {
+
+ DEB_SYSLOG("mmap error errno:%d", errno);
+ close(shm_fd);
+ shm_fd = -1;
+ return -1;
+ }
+ shm_pmap = pmap;
+
+ return 0;
+}
+
+static inline void
+GetShmInfo(int flagId, int *realTimeLog, int *logLevel) {
+ volatile ssize_t *p;
+
+ if ((realTimeLog == NULL) || (logLevel == NULL)) {
+ return;
+ }
+
+ p = static_cast<ssize_t *>(shm_pmap);
+ *realTimeLog = static_cast<int>(p[0]);
+ p += 2;
+ *logLevel = static_cast<int>(p[flagId]);
+}
+
+static BOOL
+IsExistFrameworkunifiedLogCfgShmem(void) {
+ if (shm_pmap == reinterpret_cast<void *>(const_cast<unsigned int*>(default_log_cfgtbl))) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static BOOL
+NsLogIsZonePrintEnable(const UI_16 zone, UI_8 *mode) {
+ int l_realTimeLog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ int l_loglevel = FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE;
+
+ if (mode == NULL) {
+ return FALSE;
+ }
+
+ GetShmInfo(g_FrameworkunifiedLogFlagId, &l_realTimeLog, &l_loglevel);
+ *mode = static_cast<UI_8>(l_realTimeLog);
+ if (l_realTimeLog == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF) {
+ return FALSE;
+ }
+
+ if ((ZONEMASK(96) <= (TFrameworkunifiedZone)zone)
+ && ((TFrameworkunifiedZone)zone <= ZONEMASK(127))) {
+ return FALSE;
+ }
+
+
+ if (g_FrameworkunifiedLogFlagRealTimeLog == FALSE) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static int
+copyFrameworkunifiedLogCfgFile(const char *l_cSrcPath, const char *l_cDestPath) {
+ int fd_in = -1;
+ int fd_ot = -1;
+ char l_buf[8*1024];
+ ssize_t l_nrd, l_nwr;
+
+ fd_in = open(l_cSrcPath, O_RDONLY | O_CLOEXEC);
+ if (fd_in == -1) {
+ return -1;
+ }
+
+ fd_ot = open(l_cDestPath, O_WRONLY | O_CREAT | O_CLOEXEC, 0640);
+ if (fd_ot == -1) {
+ close(fd_in);
+ return -1;
+ }
+
+ while (1) {
+ l_nrd = read(fd_in, l_buf, sizeof(l_buf));
+ if (l_nrd == 0) {
+ break;
+ }
+ if (l_nrd < 0) {
+ close(fd_in);
+ close(fd_ot);
+ return -1;
+ }
+
+ l_nwr = write(fd_ot, l_buf, l_nrd);
+ if (l_nwr < 0) {
+ close(fd_in);
+ close(fd_ot);
+ return -1;
+ }
+ }
+
+ if (fsync(fd_ot) != 0) {
+ close(fd_in);
+ close(fd_ot);
+ return -1;
+ }
+
+ close(fd_in);
+ close(fd_ot);
+
+ return 0;
+}
+
+
+static VOID
+copyFrameworkunifiedLogCfgFileToNv(void) {
+ int fd_in = -1;
+ int fd_ot = -1;
+ int fd_dr = -1;
+ char c[1];
+ ssize_t len;
+
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov constraints (others)
+ std::string config_dirpath = FRAMEWORKUNIFIEDLOG_CONFIG_NV;
+ std::string config_tempname = FRAMEWORKUNIFIEDLOG_CONFIG_NV;
+ std::string config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV;
+ fd_in = open(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__FN, O_RDONLY);
+ config_tempname.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__TMP);
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV);
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov constraints (others)
+
+ if (fd_in == -1) {
+ return;
+ }
+
+ unlink(config_tempname.c_str());
+
+ fd_ot = open(config_tempname.c_str(), O_WRONLY | O_CREAT, 0640); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (fd_ot == -1) {
+ DEB_SYSLOG("open error errno:%d", errno);
+ close(fd_in); // LCOV_EXCL_BR_LINE 11:expect branch
+ return;
+ }
+
+ while (1) {
+ len = read(fd_in, c, sizeof(c));
+ if (len == 0) {
+ break;
+ }
+ if (len < 0) {
+ close(fd_in);
+ close(fd_ot);
+ return;
+ }
+ len = write(fd_ot, c, sizeof(c));
+ if (len < 0) {
+ close(fd_in);
+ close(fd_ot);
+ return;
+ }
+ }
+
+ if (fsync(fd_ot) != 0) {
+ close(fd_in);
+ close(fd_ot);
+ return;
+ }
+
+ close(fd_in);
+ close(fd_ot);
+
+ if (rename(config_tempname.c_str(), config_filename.c_str()) != 0) {
+
+ DEB_SYSLOG("rename error errno:%d", errno);
+ return;
+ }
+
+ fd_dr = open(config_dirpath.c_str(), O_RDONLY);
+ if (fd_dr == -1) {
+
+ DEB_SYSLOG("mmap error errno:%d", errno);
+ return;
+ }
+
+ fsync(fd_dr);
+
+ close(fd_dr);
+}
+
+#define WTYPE_NORMAL 0
+#define WTYPE_RTIMELOG 1
+static int
+WriteSharedMem(int flag, int realTimeLog, unsigned int flagIdNum, int *logLevelArray) {
+ int fd;
+ ssize_t *pp;
+ volatile ssize_t *p;
+ int size;
+
+ if ((flag == WTYPE_NORMAL)
+ && (logLevelArray == NULL)) {
+ return -1;
+ }
+
+ size = static_cast<int>(sizeof(int) * 2); // realTimeLog + flagIdNum
+ size += static_cast<int>(sizeof(int) * flagIdNum);
+
+ fd = shm_open(FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, O_RDWR | O_CREAT, S_IRWXU | S_IRWXO);
+ if (fd == -1) {
+
+ DEB_SYSLOG("shm_open error errno:%d", errno);
+ return -1;
+ }
+
+ if (ftruncate(fd, size) == -1) {
+
+ DEB_SYSLOG("ftruncate error errno:%d", errno);
+ close(fd);
+ return -1;
+ }
+
+// pp = (int *)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ pp = static_cast<ssize_t *>(mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
+ if (pp == MAP_FAILED) {
+
+ DEB_SYSLOG("mmap error errno:%d", errno);
+ close(fd);
+ return -1;
+ }
+
+ p = pp;
+ p[0] = realTimeLog;
+
+ if (flag == WTYPE_NORMAL) {
+ // flagIdNum
+ p[1] = flagIdNum;
+
+ // log level
+ p += 2;
+ for (unsigned int i = 0; i < flagIdNum; i++) {
+ *p = logLevelArray[i];
+ p++;
+ }
+ }
+ close(fd);
+ munmap(pp, size);
+
+ return 0;
+}
+
+static int
+WriteSharedMemForFlagId(int realTimeLog, unsigned int flagIdNum, int flagId,
+ int logLevel) {
+ int fd;
+ volatile ssize_t *p;
+ ssize_t *pp;
+ int size;
+
+ size = static_cast<int>(sizeof(int) * 2); // realTimeLog + flagIdNum
+ size += static_cast<int>(sizeof(int) * flagIdNum);
+
+ fd = shm_open(FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, O_RDWR | O_CREAT, S_IRWXU | S_IRWXO);
+ if (fd == -1) {
+
+ DEB_SYSLOG("shm_open error errno:%d", errno);
+ return -1;
+ }
+
+ if (ftruncate(fd, size) == -1) {
+
+ DEB_SYSLOG("ftruncate error errno:%d", errno);
+ close(fd);
+ return -1;
+ }
+
+ pp = static_cast<ssize_t *>(mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
+ if (pp == MAP_FAILED) {
+
+ DEB_SYSLOG("mmap error errno:%d", errno);
+ close(fd);
+ return -1;
+ }
+
+ p = pp;
+ p[0] = realTimeLog;
+
+ // flagIdNum
+ p[1] = flagIdNum;
+
+ // log level
+ p += 2;
+ p[flagId] = logLevel;
+
+ close(fd);
+ munmap(pp, size);
+
+ return 0;
+}
+
+static BOOL
+IsExistFrameworkunifiedLogCfgNv(void) {
+ FILE *fp;
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov constraints (others)
+ std::string config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV;
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV);
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov constraints (others)
+
+ fp = fopen(config_filename.c_str(), "re");
+ if (fp == NULL) {
+ return FALSE;
+ }
+
+ fclose(fp);
+ return TRUE;
+}
+
+static int
+get_readlink_path(char *path) {
+ CHAR exe_path[EXE_STR_LEN];
+ CHAR buf[EXE_STR_LEN];
+ ssize_t len;
+
+ if (path == NULL) {
+ return -1;
+ }
+
+ path[0] = 0;
+ if (exe_link_path[0] == 0) {
+ pid_t pid = static_cast<pid_t>(syscall(__NR_getpid));
+ sprintf(exe_path, "/proc/%d/exe", pid); // NOLINT (readability/nolint)
+ memset(buf, 0, sizeof(buf));
+ len = readlink(exe_path, buf, (sizeof(buf) - 1));
+ if (len != -1) { // LCOV_EXCL_BR_LINE 200: exe_path can not non-existent
+ strcpy(exe_link_path, buf); // NOLINT (readability/nolint)
+ } else {
+ // LCOV_EXCL_START 200
+ AGL_ASSERT_NOT_TESTED();
+ fprintf(stderr, "<WARNING>FRAMEWORKUNIFIEDLOG[%s:L%d]Can't get readlink path(%s). errno(%d)\n", __FUNCTION__, __LINE__,
+ exe_path, errno);
+ DEB_SYSLOG("<WARNING>Can't get readlink path(%s)(errno:%d)", exe_path, errno);
+ return 0;
+ // LCOV_EXCL_STOP 200
+ }
+ }
+ strcpy(path, exe_link_path); // NOLINT (readability/nolint)
+ return 1; // OK
+}
+
+static void
+readConfig(int *realTimeLog, int **logLevelArray) {
+ CHAR buf[EXE_STR_LEN];
+
+ if (get_readlink_path(buf)) { // LCOV_EXCL_BR_LINE 200:get_readlink_path can not return false
+ std::string config_filename;
+ std::string exe_str = buf; // LCOV_EXCL_BR_LINE 11:expect branch
+
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov constraints (others)
+ if (IsExistFrameworkunifiedLogCfgNv()) {
+ config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV;
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV);
+ } else {
+ config_filename = FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__FN;
+ }
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov constraints (others)
+ CNSConfigReader *config_reader = new CNSConfigReader(); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (config_reader != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ if (config_reader->Parse(config_filename)
+ == eFrameworkunifiedStatusOK) {
+ CreateFrameworkunifiedLogFileTbl(config_reader, exe_str, realTimeLog, logLevelArray); // LCOV_EXCL_BR_LINE 11:expect branch
+ MapShmInfo(g_FrameworkunifiedLogFlagId); // LCOV_EXCL_BR_LINE 11:expect branch
+ } else {
+ DEB_SYSLOG("Parseg error %s", config_filename.c_str());
+ }
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEB_SYSLOG("new CNSConfigReader error");
+ // LCOV_EXCL_STOP 5
+ }
+ delete config_reader; // LCOV_EXCL_BR_LINE 11:expect branch1
+ } else {
+ // LCOV_EXCL_START 5: get_readlink_path can not return false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEB_SYSLOG("get_readlink_path error");
+ // LCOV_EXCL_STOP 5
+ }
+}
+
+//////////////////////////////////////////
+// NSLogGetFrameworkunifiedlogFileTotalNum
+//////////////////////////////////////////
+UI_32
+NSLogGetFrameworkunifiedlogFileTotalNum(void) {
+ return static_cast<UI_32>((g_FrameworkunifiedLogMap.size() + g_FrameworkunifiedLogFlagMap.size()));
+}
+
+//////////////////////////////////////////
+// NSLogGetFrameworkunifiedlogFileName
+//////////////////////////////////////////
+PCSTR
+NSLogGetFrameworkunifiedlogFileName(UI_32 index) {
+ PCSTR name = NULL;
+
+ if ((g_FrameworkunifiedLogMap.size() + g_FrameworkunifiedLogFlagMap.size()) <= index) {
+ return NULL;
+ }
+
+ TFrameworkunifiedLogMap::iterator itr;
+ TFrameworkunifiedLogMap::iterator itr_end;
+ UI_32 cnt;
+
+ if (index < g_FrameworkunifiedLogMap.size()) {
+ cnt = 0;
+ itr = g_FrameworkunifiedLogMap.begin();
+ itr_end = g_FrameworkunifiedLogMap.end();
+ } else {
+ cnt = static_cast<UI_32>(g_FrameworkunifiedLogMap.size());
+ itr = g_FrameworkunifiedLogFlagMap.begin();
+ itr_end = g_FrameworkunifiedLogFlagMap.end();
+ }
+
+ for (; itr != itr_end; itr++, cnt++) {
+ if (cnt == index) {
+ name = itr->second.file_name.c_str();
+ break;
+ }
+ }
+ return name;
+}
+
+//////////////////////////////////////////
+// NSLogGetFrameworkunifiedlogIndex
+//////////////////////////////////////////
+int
+NSLogGetFrameworkunifiedlogIndex(PCSTR filename) {
+ TFrameworkunifiedLogMap::iterator itr;
+ TFrameworkunifiedLogMap::iterator itr_end;
+ UI_32 i = 0;
+ /**
+ * @todo
+ * Defining a NULL for arguments results in exceptions.
+ */
+ std::string fname = filename;
+
+ itr = g_FrameworkunifiedLogFlagMap.begin();
+ itr_end = g_FrameworkunifiedLogFlagMap.end();
+ for (; itr != itr_end; itr++, i++) {
+ if (fname.find(itr->second.file_name) != std::string::npos) {
+ return i;
+ }
+ }
+
+ itr = g_FrameworkunifiedLogMap.begin();
+ itr_end = g_FrameworkunifiedLogMap.end();
+ for (; itr != itr_end; itr++, i++) {
+ if (fname.find(itr->second.file_name) != std::string::npos) {
+ return i;
+ }
+ }
+ return 0;
+}
+
+UI_32
+ConvertEndian(UI_32 *pvar) {
+ UI_32 retVal = (UI_32)0;
+
+ if (pvar == NULL) {
+ return retVal;
+ }
+
+ UI_32 var = *pvar;
+ retVal = (((var & 0xFF000000) >> 24) |
+ ((var & 0x00FF0000) >> 8) |
+ ((var & 0x0000FF00) << 8) |
+ ((var & 0x000000FF) << 24));
+ return (retVal);
+}
+
+static void
+check_syslog_opened(void) {
+ if (!syslogopened) {
+ openlog(0, LOG_CONS | LOG_NDELAY | LOG_PID, LOG_USER);
+ syslogopened = 1;
+ }
+}
+
+static time_t
+tick_msec_get(void) {
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) != 0) { // LCOV_EXCL_BR_LINE 5: clock_gettime's error case
+ // LCOV_EXCL_START 5: clock_gettime's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0; /* NG */
+ // LCOV_EXCL_STOP 5
+ }
+ return tp.tv_sec * 1000 + tp.tv_nsec / 1000000;
+}
+
+static inline int
+num2string(PSTR buf, int digits, UI_32 num) {
+ PSTR p = NULL;
+ char c;
+
+ switch (digits) {
+ case 5:
+ p = buf;
+ if (num >= 100000) {
+ *p++ = '0';
+ *p++ = '0';
+ *p++ = '0';
+ *p++ = '0';
+ *p = '0';
+ break;
+ }
+ c = static_cast<char>(num / 10000);
+ *p++ = static_cast<char>(c + '0');
+ num = num - (c * 10000);
+ c = static_cast<char>(num / 1000);
+ *p++ = static_cast<char>(c + '0');
+ num = num - (c * 1000);
+ case 3:
+ if (p == NULL) {
+ p = buf;
+ }
+ if (num >= 1000) {
+ *p++ = '0';
+ *p++ = '0';
+ *p = '0';
+ break;
+ }
+ c = static_cast<char>(num / 100);
+ *p++ = static_cast<char>(c + '0');
+ num = num - (c * 100);
+ case 2:
+ if (p == NULL) {
+ p = buf;
+ }
+ if (num >= 100) {
+ *p++ = '0';
+ *p = '0';
+ break;
+ }
+ c = static_cast<char>(num / 10);
+ *p++ = static_cast<char>(c + '0');
+ *p = static_cast<char>(num - (c * 10) + '0');
+ break;
+ default: {
+ int dig = 1;
+ int n = num;
+ p = buf;
+ while (n >= 10) {
+ n /= 10;
+ dig *= 10;
+ }
+ while (dig > 1) {
+ c = static_cast<char>(num / dig);
+ *p++ = static_cast<char>(c + '0');
+ num = num - (c * dig);
+ dig /= 10;
+ }
+ *p = static_cast<char>(num + '0');
+ }
+ break;
+ }
+ return static_cast<int>(p - buf + 1);
+}
+
+static void
+_GetTimeString2(PSTR format) {
+ time_t tick;
+ UI_32 hh, mm, ss, ms;
+
+ // "%02d:%02d:%02d.%03d/"
+ tick = tick_msec_get();
+
+ ms = static_cast<UI_32>(tick % 1000);
+ format[8] = '.';
+ num2string(&format[9], 3, ms);
+ format[12] = '/';
+
+ tick /= 1000;
+ ss = static_cast<UI_32>(tick % 60);
+ format[5] = ':';
+ num2string(&format[6], 2, ss);
+
+ tick /= 60;
+ mm = static_cast<UI_32>(tick % 60);
+ format[2] = ':';
+ num2string(&format[3], 2, mm);
+
+ tick /= 60;
+ hh = static_cast<UI_32>(tick);
+ num2string(&format[0], 2, hh);
+}
+
+// LCOV_EXCL_START 8: dead code
+void
+_GetTimeString(PSTR format, UI_16 length) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ time_t tick;
+ UI_32 hh, mm, ss, ms;
+
+ tick = tick_msec_get();
+ ms = static_cast<UI_32>(tick % 1000);
+ tick /= 1000;
+ ss = static_cast<UI_32>(tick % 60);
+ tick /= 60;
+ mm = static_cast<UI_32>(tick % 60);
+ tick /= 60;
+ hh = static_cast<UI_32>(tick);
+
+ snprintf(format, (length - 1), "%02d:%02d:%02d.%03d/", hh, mm, ss, ms);
+}
+// LCOV_EXCL_STOP 8
+
+static UI_64
+ClockCyclesToMs(void) {
+ return ClockCycle() / 1000;
+}
+
+static CHAR *
+_in_NsLog_part1(const UI_16 p_lLine_i, const UI_16 f_uiZoneIndex,
+ PCSTR p_pstrClassName_i, CHAR *format) {
+ CHAR t_name[16]; // thread name (not more than 15 characters)
+ int len;
+ CHAR *p = format;
+
+ if (format == NULL) {
+ return NULL;
+ }
+
+ // fixed format : "%s%ld/%d/%s/%05d/%s/%d/=%s\r\n"
+ // time_string
+ _GetTimeString2(p);
+ p += 13;
+
+ // g_msgcounter
+ g_msgcounter++;
+ len = num2string(p, 0, g_msgcounter);
+ p += len;
+ *p++ = '/';
+
+ // f_uiZoneIndex
+ len = num2string(p, 0, f_uiZoneIndex);
+ p += len;
+ *p++ = '/';
+
+ // Check whether thread name has previously been set
+ t_name[0] = 0;
+ if (tls_strProcessName[0] != 0) {
+ tls_strProcessName[sizeof(t_name) - 1] = '\0';
+ strcpy(t_name, tls_strProcessName); // NOLINT (readability/nolint)
+ } else {
+ if (prctl(PR_GET_NAME, t_name) != 0) {
+ strcpy(t_name, "UNKNOWN"); // NOLINT (readability/nolint)
+ }
+ NsLogSetProcessName(t_name);
+ }
+
+ // t_name
+ strcpy(p, t_name); // NOLINT (readability/nolint)
+ p += strlen(t_name);
+ *p++ = '/';
+
+ // t_id
+ if (tid == 0) {
+ tid = static_cast<pid_t>(syscall(__NR_gettid));
+ }
+ len = num2string(p, 5, tid);
+ p += len;
+ *p++ = '/';
+
+ // p_pstrClassName_i
+ if (p_pstrClassName_i) {
+ strcpy(p, p_pstrClassName_i); // NOLINT (readability/nolint)
+ } else {
+ strcpy(p, "(null)"); // NOLINT (readability/nolint)
+ }
+ p += strlen(p);
+ *p++ = '/';
+
+ // p_lLine_i
+ len = num2string(p, 0, p_lLine_i);
+ p += len;
+ *p++ = '/';
+ *p++ = '=';
+
+ return p;
+}
+
+static void
+_in_NsLog_part2(const UI_16 f_uiZoneIndex, CHAR *p, CHAR *format) {
+ UI_32 l_uiLength;
+
+ if (p == NULL) {
+ return;
+ }
+
+ *p++ = '\r';
+ *p++ = '\n';
+ *p = '\0';
+
+ if (format == NULL) {
+ return;
+ }
+
+ l_uiLength = static_cast<UI_32>(p - format);
+
+ // Write log message
+ if (l_uiLength > 0) {
+ UI_8 l_realTimeLog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ BOOL IsZonePrintEnable = NsLogIsZonePrintEnable(f_uiZoneIndex, &l_realTimeLog);
+ if (l_realTimeLog == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE) {
+ if (g_qid != (mqd_t)(-1)) {
+ mq_close(g_qid);
+ g_qid = (mqd_t)(-1);
+ }
+ return;
+ }
+ if (g_LocalFrameworkunifiedLogParams.uiLogOptions & LPRINT) {
+ ssize_t l_writtenbyte;
+ std::string usb_realtime_filename;
+ std::string ownAdrr;
+ std::string writeAdrr;
+ if (IsZonePrintEnable == TRUE) {
+ switch (l_realTimeLog) {
+ case FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF:
+ // Nothing
+ break;
+ case FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART:
+ // Write console
+ fwrite(format, 1, l_uiLength, stdout);
+ break;
+ case FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB:
+ if (g_qid == (mqd_t)(-1)) {
+ struct mq_attr qattr;
+
+ qattr.mq_flags = 0;
+ qattr.mq_maxmsg = USB_REALTIME_MSGMAX;
+ qattr.mq_msgsize = USB_REALTIME_SIZMAX;
+ qattr.mq_curmsgs = 0;
+ if ((g_qid = mq_open(USB_REALTIME_QNAME, O_WRONLY | O_CREAT, 0666, &qattr)) == (mqd_t)(-1)) {
+ fprintf(stderr, "Failed to create Message Queue %s, errno=%d\n", USB_REALTIME_QNAME, errno);
+ break;
+ }
+ }
+ l_writtenbyte = mq_send(g_qid, format, l_uiLength, 1);
+ if (l_writtenbyte == -1) {
+ fprintf(stderr, "mq_send ERROR, errno=%d\n", errno);
+ mq_close(g_qid);
+ g_qid = (mqd_t)(-1);
+ }
+ break;
+ case FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE:
+ if (g_qid != (mqd_t)(-1)) {
+ mq_close(g_qid);
+ g_qid = (mqd_t)(-1);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ if (g_LocalFrameworkunifiedLogParams.uiLogOptions & LSLOGGER) {
+ check_syslog_opened();
+ syslog(LOG_ERR, "%s", format);
+ }
+
+ {
+ CNSRingBuffer *ring_buffer = NULL;
+ GetFrameworkunifiedLogRingBuffer(f_uiZoneIndex, &ring_buffer);
+
+ if (ring_buffer != NULL) {
+ if (ring_buffer->IsOpen()) {
+ ring_buffer->Write(format, l_uiLength);
+ }
+ }
+ }
+ }
+}
+
+void
+NsLogTime(const UI_16 f_uiZoneIndex, PCSTR lpszFormat) {
+ CHAR format[MAX_QUEUE_MSG_SIZE];
+ CHAR *p = format;
+ CHAR *q = reinterpret_cast<CHAR *>(const_cast<char *>(lpszFormat));
+ int i;
+
+ // fixed format : "%s/=%s\r\n"
+ // time_string
+ _GetTimeString2(p);
+ p += 13;
+ *p++ = '=';
+
+ /**
+ * @todo
+ * Defining a NULL for the lpszFormat causes a segmentation fault.
+ */
+ for (i = 0; *q && i < MAX_QUEUE_MSG_SIZE - (p - format) - 3; i++) { // '3': '\r''\n''\0'
+ *p++ = *q++;
+ }
+ _in_NsLog_part2(f_uiZoneIndex, p, format);
+}
+
+void
+NsLogData(const UI_16 f_uiZoneIndex, PCSTR data, UI_32 size) {
+ int l_realTimeLog;
+ int l_logLevel;
+
+ GetShmInfo(g_FrameworkunifiedLogFlagId, &l_realTimeLog, &l_logLevel);
+ if (l_realTimeLog == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE) {
+ return;
+ }
+
+ if (size > 0) {
+ CNSRingBuffer *ring_buffer = NULL;
+ GetFrameworkunifiedLogRingBuffer(f_uiZoneIndex, &ring_buffer); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (ring_buffer != NULL) {
+ if (ring_buffer->IsOpen()) {
+ ring_buffer->Write(data, size);
+ }
+ }
+ }
+}
+
+void
+NsLog0(const UI_16 p_lLine_i, // Line number where message was generated
+ const UI_16 f_uiZoneIndex,
+ PCSTR p_pstrClassName_i,
+ PCSTR lpszFormat) {
+ CHAR format[MAX_QUEUE_MSG_SIZE];
+ CHAR *p;
+ CHAR *q = reinterpret_cast<CHAR *>(const_cast<char *>(lpszFormat));
+ int i;
+
+ p = _in_NsLog_part1(p_lLine_i, f_uiZoneIndex, p_pstrClassName_i, format);
+ /**
+ * @todo
+ * Setting p_pstrClassName_i to NULL results in a segmentation fault.
+ */
+ for (i = 0; *q && i < MAX_QUEUE_MSG_SIZE - (p - format) - 3; i++) { // '3': '\r''\n''\0'
+ *p++ = *q++;
+ }
+ _in_NsLog_part2(f_uiZoneIndex, p, format);
+}
+
+void
+NsLog(const UI_16 p_lLine_i, // Line number where message was generated
+ const UI_16 f_uiZoneIndex,
+ PCSTR p_pstrClassName_i,
+ PCSTR lpszFormat,
+ ...) {
+ va_list argList;
+ CHAR format[MAX_QUEUE_MSG_SIZE];
+ CHAR *p;
+ int num;
+ int size;
+
+ va_start(argList, lpszFormat);
+
+ p = _in_NsLog_part1(p_lLine_i, f_uiZoneIndex, p_pstrClassName_i, format);
+ size = static_cast<int>(MAX_QUEUE_MSG_SIZE - (p - format) - 3);
+ num = vsnprintf(p, size, lpszFormat, argList);
+ if (num >= size) {
+ num = size - 1;
+ } else if (num < 0) {
+ num = 0;
+ }
+ p += num;
+ _in_NsLog_part2(f_uiZoneIndex, p, format);
+
+ va_end(argList);
+}
+
+void
+NsLogSetFrameworkunifiedLogParams(FRAMEWORKUNIFIEDLOGPARAM *p_FrameworkunifiedLogParams) {
+ int l_realTimeLog = 0;
+ int *l_logLevelArray = NULL;
+ CHAR buf[EXE_STR_LEN];
+
+ if (p_FrameworkunifiedLogParams == NULL) {
+ return;
+ }
+
+ get_readlink_path(buf);
+ if (g_flag_name.empty()) { // LCOV_EXCL_BR_LINE 200:get_readlink_path can not return false
+ std::string config_filename;
+ CHAR buf[EXE_STR_LEN];
+
+ if (IsExistFrameworkunifiedLogCfgNv()) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ } else {
+ config_filename = FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__FN; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ }
+ if (get_readlink_path(buf)) {
+ std::string exe_str = buf; // LCOV_EXCL_BR_LINE 11:expect branch
+ CNSConfigReader *config_reader = new CNSConfigReader(); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (config_reader != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ if (config_reader->Parse(config_filename)
+ == eFrameworkunifiedStatusOK) {
+ CreateFrameworkunifiedLogFileTbl(config_reader, exe_str, &l_realTimeLog, &l_logLevelArray); // LCOV_EXCL_BR_LINE 11:expect branch
+ MapShmInfo(g_FrameworkunifiedLogFlagId); // LCOV_EXCL_BR_LINE 11:expect branch
+ } else {
+ DEB_SYSLOG("Parse error %s", config_filename.c_str());
+ }
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEB_SYSLOG("new CNSConfigReader error");
+ // LCOV_EXCL_STOP 5
+ }
+ delete config_reader; // LCOV_EXCL_BR_LINE 11:expect branch
+ } else {
+ // LCOV_EXCL_START 5: get_readlink_path can not return false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEB_SYSLOG("get_readlink_path error");
+ // LCOV_EXCL_STOP 5
+ }
+ } else {
+ // already read
+ // do nothing
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgShmem()) {
+ if (l_logLevelArray == NULL) {
+ readConfig(&l_realTimeLog, &l_logLevelArray);
+ }
+ WriteSharedMem(WTYPE_NORMAL, l_realTimeLog, g_FlagIdNum, l_logLevelArray);
+ MapShmInfo(g_FrameworkunifiedLogFlagId);
+ }
+ if (l_logLevelArray != NULL) {
+ free(l_logLevelArray);
+ }
+
+ /**
+ * @tood
+ * Segmentation faults occur when NULL is defined as arguments.
+ */
+ memcpy(&g_LocalFrameworkunifiedLogParams, p_FrameworkunifiedLogParams, sizeof(FRAMEWORKUNIFIEDLOGPARAM));
+
+ // Force Output ZONE_NS_WAR(8),ZONE_NS_ERR(9)
+ TFrameworkunifiedZone l_uiZoneMask = g_LocalFrameworkunifiedLogParams.uiZoneMask[0];
+ l_uiZoneMask = l_uiZoneMask | GET_ZONE_BIT_MASK(ZONE_NS_WAR) | GET_ZONE_BIT_MASK(ZONE_NS_ERR);
+ g_LocalFrameworkunifiedLogParams.uiZoneMask[0] = l_uiZoneMask;
+
+ // Force Output Zones
+ {
+ TFrameworkunifiedLogMap::iterator itr = g_FrameworkunifiedLogMap.begin();
+ TFrameworkunifiedLogMap::iterator itr_end = g_FrameworkunifiedLogMap.end();
+ for (; itr != itr_end; itr++) {
+ if (itr->second.force_output) {
+ UI_16 zone = static_cast<UI_16>(itr->first);
+ TFrameworkunifiedZone *pl_uiZoneMask = &g_LocalFrameworkunifiedLogParams.uiZoneMask[GET_ZONE_INDEX(zone)];
+ *pl_uiZoneMask |= GET_ZONE_BIT_MASK(zone);
+ }
+ }
+ }
+}
+
+void
+NsLogSetProcessName(PCSTR p_strProcessName_i) {
+ if ((p_strProcessName_i != NULL) && (strlen(p_strProcessName_i) < _countof(tls_strProcessName))) {
+ strcpy(tls_strProcessName, p_strProcessName_i); // NOLINT (readability/nolint)
+ }
+}
+
+void
+NsLogSetControlMask(TFrameworkunifiedZoneMask p_NSLogControl_i) {
+ for (UI_32 zoneIndex = 0; zoneIndex < ZONE_MASK_ARRAY_ELTS; zoneIndex++) {
+ /**
+ * @todo
+ * Setting NULL to arguments terminates abnormally
+ */
+ g_LocalFrameworkunifiedLogParams.uiZoneMask[zoneIndex] = p_NSLogControl_i[zoneIndex];
+ }
+}
+
+void
+NsLogGetControlMask(TFrameworkunifiedZoneMask p_Zonemask_i) {
+ for (UI_32 zoneIndex = 0; zoneIndex < ZONE_MASK_ARRAY_ELTS; zoneIndex++) {
+ /**
+ * @todo
+ * Setting NULL to arguments terminates abnormally
+ */
+ p_Zonemask_i[zoneIndex] = g_LocalFrameworkunifiedLogParams.uiZoneMask[zoneIndex];
+ }
+}
+
+BOOL
+NsLogIsZoneSet(UI_32 set_zone) {
+ int realTimeLog;
+ int logLevel = 0;
+
+ GetShmInfo(g_FrameworkunifiedLogFlagId, &realTimeLog, &logLevel);
+
+ if (logLevel == FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG)
+ {
+ return TRUE;
+ }
+
+ if (set_zone >= BITS_IN_ZONE_MASK) {
+ return FALSE;
+ }
+
+ if (0 != (g_LocalFrameworkunifiedLogParams.uiZoneMask[ GET_ZONE_INDEX(set_zone) ] & GET_ZONE_BIT_MASK(set_zone))) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+void
+NsLogSetLogMethod(UI_8 p_eMethod_i) {
+ g_LocalFrameworkunifiedLogParams.uiLogOptions = p_eMethod_i;
+}
+
+UI_8
+NsLogGetLogMethod(void) {
+ return g_LocalFrameworkunifiedLogParams.uiLogOptions;
+}
+
+void
+NsLogSetSeverity(TFrameworkunifiedLoggerSeverity p_eLogSeverity_i) {
+ g_LocalFrameworkunifiedLogParams.eSeverity = p_eLogSeverity_i;
+}
+
+TFrameworkunifiedLoggerSeverity
+NsLogGetSeverity(void) {
+ return g_LocalFrameworkunifiedLogParams.eSeverity;
+}
+
+UI_8
+NsLogDetermineLogMethod(PCSTR output_type) {
+ PSTR p = NULL;
+ const CHAR delims[] = "|";
+ UI_8 outmask = 0;
+ PSTR parse = NULL;
+ PSTR saveptr = NULL;
+
+ if (output_type != NULL) {
+ // since strtok modifies the var. we
+ // must create a copy of the string.
+ parse = strdup(output_type);
+ p = strtok_r (parse, delims, &saveptr); // NOLINT (readability/nolint)
+ while (p != NULL) {
+ // slogger|msgq|console
+#ifdef AGL_STUB
+ if (!strcasecmp(p, "slogger")) {
+#else
+ if (!strcmpi(p, "slogger")) {
+#endif
+ outmask |= LSLOGGER;
+#ifdef AGL_STUB
+ } else if (!strcasecmp(p, "msgq")) {
+#else
+ } else if (!strcmpi(p, "msgq")) {
+#endif
+ outmask |= LMSGQ;
+#ifdef AGL_STUB
+ } else if (!strcasecmp(p, "console")) {
+#else
+ } else if (!strcmpi(p, "console")) {
+#endif
+ outmask |= LPRINT;
+#ifdef AGL_STUB
+ } else if (!strcasecmp(p, "shmem")) {
+#else
+ } else if (!strcmpi(p, "shmem")) {
+#endif
+ outmask |= LSHAREDMEM;
+ } else {
+ // do nothing
+ }
+
+ p = strtok_r (NULL, delims, &saveptr); // NOLINT (readability/nolint)
+ }
+
+ // since we made dup of the char * passed we need to free it!
+ if (parse != NULL) {
+ free(parse);
+ parse = NULL;
+ }
+ }
+ return outmask;
+}
+
+void
+NsLogSetZones(UI_32 f_uiZoneCount, ...) {
+ va_list l_tArguments;
+
+ // Initialize the variable argument list
+ va_start(l_tArguments, f_uiZoneCount);
+
+ // Iterate the variable argument list
+ for (UI_32 l_uiArgumentCount = 0; l_uiArgumentCount < f_uiZoneCount; l_uiArgumentCount++) {
+ // get zone value
+ UI_32 l_uiZone = va_arg(l_tArguments, UI_32); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (l_uiZone < BITS_IN_ZONE_MASK) {
+ // add zone value to existing mask
+ UI_32 l_uiZoneMask = g_LocalFrameworkunifiedLogParams.uiZoneMask[GET_ZONE_INDEX(l_uiZone)];
+ l_uiZoneMask = l_uiZoneMask | GET_ZONE_BIT_MASK(l_uiZone);
+ g_LocalFrameworkunifiedLogParams.uiZoneMask[GET_ZONE_INDEX(l_uiZone)] = l_uiZoneMask;
+ }
+ }
+
+ va_end(l_tArguments);
+}
+
+void
+NsLogParseZones(FRAMEWORKUNIFIEDLOGPARAM *p_FrameworkunifiedLogParams, UI_32 f_uiZoneCount, ...) {
+ va_list l_tArguments;
+
+ if (p_FrameworkunifiedLogParams == NULL) {
+ return;
+ }
+
+ // Initialize the variable argument list
+ va_start(l_tArguments, f_uiZoneCount);
+
+ // Iterate the variable argument list
+ for (UI_32 l_uiArgumentCount = 0; l_uiArgumentCount < f_uiZoneCount; l_uiArgumentCount++) {
+ // get zone value
+ UI_32 l_uiZone = va_arg(l_tArguments, UI_32); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (l_uiZone < BITS_IN_ZONE_MASK) {
+ // add zone
+ UI_32 l_uiZoneMask = p_FrameworkunifiedLogParams->uiZoneMask[GET_ZONE_INDEX(l_uiZone)];
+ l_uiZoneMask = l_uiZoneMask | GET_ZONE_BIT_MASK(l_uiZone);
+ p_FrameworkunifiedLogParams->uiZoneMask[GET_ZONE_INDEX(l_uiZone)] = l_uiZoneMask;
+ }
+ }
+
+ va_end(l_tArguments);
+}
+
+void
+NsLog_EvtCnt(UI_16 Cnt_Id, UI_16 Evt_Id, UI_8 nu, ...) {
+ st_LogEvent log;
+ va_list EC_list;
+ va_start(EC_list, nu);
+ UI_8 i = 0;
+ UI_32 ts = (UI_32)ClockCyclesToMs();
+
+ memset(&log, 0, sizeof(log));
+
+ log.ts = ConvertEndian(&ts);
+ log.event_id = (UI_8)Evt_Id;
+ log.grp_ID = (UI_8)(Evt_Id >> 8);
+ log.cnt_ID = Cnt_Id;
+
+ switch (nu) {
+ case 1:
+ log.data[0] = (UI_8)va_arg(EC_list, int);
+ log.phase = NORMAL;
+ log.typeofdata = COMMON;
+ break;
+ case 2:
+ log.data[0] = (UI_8)va_arg(EC_list, int);;
+ log.phase = (SystemPhase)va_arg(EC_list, int);
+ log.typeofdata = COMMON;
+ break;
+ case 4:
+ for (i = 0; i < nu; i++) {
+ log.data[i] = (UI_8)va_arg(EC_list, int);
+ }
+ log.phase = NORMAL;
+ log.typeofdata = EVENT_SPECIFIC;
+ break;
+ case 5:
+ for (i = 0; i < (nu - 1); i++) {
+ log.data[i] = (UI_8)va_arg(EC_list, int);
+ }
+ log.phase = (SystemPhase)va_arg(EC_list, int);
+ log.typeofdata = EVENT_SPECIFIC;
+ break;
+ default:
+ memset(&log, 0, sizeof(log));
+ break;
+ }
+
+ if (log.cnt_ID != 0 && log.grp_ID != 0) {
+ if (g_hSSEventLogQ == INVALID_HANDLE) {
+ g_hSSEventLogQ = McOpenSender(EVENTLOG_MSGQ_NAME);
+ }
+ McSend(g_hSSEventLogQ, tls_strProcessName, SS_MSG_LOGGER_CNT_EVTLOG, sizeof(log), &log);
+ }
+ va_end(EC_list);
+}
+
+
+void
+NsLog_Evt(UI_16 Evt_Id, UI_8 nu, ...) {
+ st_LogEvent log_Evt;
+ va_list E_list;
+ va_start(E_list, nu);
+ UI_32 ts = (UI_32)ClockCyclesToMs();
+
+ memset(&log_Evt, 0, sizeof(st_LogEvent));
+
+ log_Evt.ts = ConvertEndian(&ts);
+ log_Evt.grp_ID = (UI_8)(Evt_Id >> 8);
+ log_Evt.event_id = (UI_8)Evt_Id;
+
+ UI_8 i;
+ switch (nu) {
+ case 1:
+ log_Evt.data[0] = (UI_8)va_arg(E_list, int); // LCOV_EXCL_BR_LINE 11:expect branch
+ log_Evt.typeofdata = COMMON;
+ break;
+ case 4:
+ for (i = 0; i < nu; i++) {
+ log_Evt.data[i] = (UI_8)va_arg(E_list, int); // LCOV_EXCL_BR_LINE 11:expect branch
+ }
+ log_Evt.typeofdata = EVENT_SPECIFIC;
+ break;
+ default:
+ memset(&log_Evt, 0, sizeof(st_LogEvent));
+ break;
+ }
+ if (log_Evt.grp_ID != 0) {
+ if (g_hSSEventLogQ == INVALID_HANDLE) {
+ g_hSSEventLogQ = McOpenSender(EVENTLOG_MSGQ_NAME);
+ }
+
+ McSend(g_hSSEventLogQ, tls_strProcessName, SS_MSG_EVTLOG, sizeof(log_Evt), &log_Evt);
+ }
+ va_end(E_list);
+}
+
+
+void
+NsLog_Cnt(UI_16 Cnt_Id, UI_8 nu, ...) {
+ st_LogCount log_Cnt;
+ va_list C_list;
+ va_start(C_list, nu);
+
+ memset(&log_Cnt, 0, sizeof(st_LogCount));
+ log_Cnt.cnt_id = Cnt_Id;
+
+ switch (nu) {
+ case 0:
+ log_Cnt.phase = NORMAL;
+ break;
+ case 1:
+ log_Cnt.phase = (SystemPhase)va_arg(C_list, int); // LCOV_EXCL_BR_LINE 11:expect branch
+ break;
+ default:
+ memset(&log_Cnt, 0, sizeof(st_LogCount));
+ break;
+ }
+ if (log_Cnt.cnt_id != 0) {
+ if (g_hSSEventLogQ == INVALID_HANDLE) {
+ g_hSSEventLogQ = McOpenSender(EVENTLOG_MSGQ_NAME);
+ }
+ McSend(g_hSSEventLogQ, tls_strProcessName, SS_MSG_LOGGERCNT, sizeof(log_Cnt), &log_Cnt);
+ }
+ va_end(C_list);
+}
+
+//////////////////////////////////////////
+// NSPrintPerformanceLog
+//////////////////////////////////////////
+VOID
+NSLogPrintPerformanceLog(const UI_16 f_ui16Line, PCSTR f_cFuncName, PCSTR __format, ...) {
+#ifndef AGL_STUB
+ va_list arg;
+ CHAR l_cFormat[MAX_PLOG_STRING_SIZE] = {};
+ CHAR l_cTimeFormat[MAX_TIME_FORMATSTR_LEN] = {};
+ UI_64 l_ui64CurrentTime = 0;
+
+ if (g_hNSplogMsgQ == INVALID_HANDLE) {
+ g_hNSplogMsgQ = OpenSender(NS_PLOGQ);
+ }
+
+ if (g_FrameworkunifiedLogPParams.ui64GapInuS == 0) {
+ FILE *l_fpPLogGap = NULL;
+ l_fpPLogGap = fopen(PLOG_GAP_FILE, "re");
+ if (l_fpPLogGap != NULL) {
+ CHAR l_cBuffer[MAX_GAP_BUFFER_LEN] = {};
+ if (fgets(l_cBuffer, MAX_GAP_BUFFER_LEN, l_fpPLogGap) != NULL) {
+ g_FrameworkunifiedLogPParams.ui64GapInuS = (unsigned)atoll(l_cBuffer);
+ }
+ fclose(l_fpPLogGap);
+ }
+ }
+
+ if (g_FrameworkunifiedLogPParams.eTimeFormat == EPLOG_TIME_FORMAT_USEC) {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ l_ui64CurrentTime = ClockCycle() + g_FrameworkunifiedLogPParams.ui64GapInuS;
+#endif
+ snprintf(l_cTimeFormat, MAX_TIME_FORMATSTR_LEN, "%s", "us");
+ } else if (g_FrameworkunifiedLogPParams.eTimeFormat == EPLOG_TIME_FORMAT_MSEC) {
+ l_ui64CurrentTime = ClockCyclesToMs() + (g_FrameworkunifiedLogPParams.ui64GapInuS / 1000);
+ snprintf(l_cTimeFormat, MAX_TIME_FORMATSTR_LEN, "%s", "ms");
+ } else if (g_FrameworkunifiedLogPParams.eTimeFormat == EPLOG_TIME_FORMAT_SEC) {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ l_ui64CurrentTime = (ClockCycle() / 1000000) + (g_FrameworkunifiedLogPParams.ui64GapInuS / 1000000);
+#endif
+ snprintf(l_cTimeFormat, MAX_TIME_FORMATSTR_LEN, "%s", "s");
+ } else {
+ // do nothing
+ }
+
+ va_start(arg, __format);
+ vsnprintf(l_cFormat, MAX_PLOG_STRING_SIZE - 1, __format, arg);
+ l_cFormat[MAX_PLOG_STRING_SIZE - 1] = '\0';
+ va_end(arg);
+
+ CHAR l_cMsg[MAX_QUEUE_MSG_SIZE] = {};
+ snprintf(l_cMsg, MAX_QUEUE_MSG_SIZE - 1, "PLog: %12llu[%s]:%s %s: %s: %s",
+ l_ui64CurrentTime, l_cTimeFormat, (g_FrameworkunifiedLogPParams.ui64GapInuS > 0) ? ("o") : ("x"),
+ tls_strProcessName, f_cFuncName, l_cFormat);
+
+ if (g_FrameworkunifiedLogPParams.uiLogOutputOptions & EPLOG_SLOG) {
+ // send to system logger
+ check_syslog_opened();
+ syslog(LOG_INFO, "%s", l_cMsg);
+ }
+
+ if (g_FrameworkunifiedLogPParams.uiLogOutputOptions & EPLOG_TRACEEVENT) {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ (VOID)trace_nlogf(_NTO_TRACE_USERFIRST, MAX_QUEUE_MSG_SIZE - 1, l_cMsg);
+#endif
+ }
+
+ if (g_FrameworkunifiedLogPParams.uiLogOutputOptions & EPLOG_MSGQ) {
+ // send to message queue /NSplog
+ if (g_hNSplogMsgQ != INVALID_HANDLE) {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcat(l_cMsg, "\n", sizeof(l_cMsg)); // insert new line... user may not have.
+#endif
+ if (SendMessage(g_hNSplogMsgQ, strlen(l_cMsg),
+ reinterpret_cast<void *>(const_cast<char *>(l_cMsg))) != eFrameworkunifiedStatusOK) {
+ // Note: Nothing will be printed on a failure.
+ }
+ }
+ }
+#endif
+}
+
+//////////////////////////////////////////
+// NSLogEnablePLog
+//////////////////////////////////////////
+VOID
+NSLogEnablePLog(BOOL f_bEnable) {
+ g_FrameworkunifiedLogPParams.bIsPLogEnabled = f_bEnable;
+}
+
+//////////////////////////////////////////
+// NsLogIsPLogEnabled
+//////////////////////////////////////////
+BOOL
+NsLogIsPLogEnabled(void) {
+ return g_FrameworkunifiedLogPParams.bIsPLogEnabled;
+}
+
+//////////////////////////////////////////
+// NSLogSetPlogTimeFormat
+//////////////////////////////////////////
+VOID
+NSLogSetPlogTimeFormat(EPLOG_TIME_FORMAT f_ePlogTimeFormat) {
+ g_FrameworkunifiedLogPParams.eTimeFormat = f_ePlogTimeFormat;
+}
+
+//////////////////////////////////////////
+// NSLogSetPlogOutputOptions
+//////////////////////////////////////////
+VOID
+NSLogSetPlogOutputOptions(UI_8 f_uiPlogOutputOption) {
+ g_FrameworkunifiedLogPParams.uiLogOutputOptions = f_uiPlogOutputOption;
+}
+
+//////////////////////////////////////////
+// NsLogInitialize for Diag Method
+//////////////////////////////////////////
+VOID
+NsLogInitialize(void) {
+ std::string config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ int l_realTimelog;
+ int *l_logLevelArray = NULL;
+
+ if (unlink(config_filename.c_str()) != 0) {
+ // error TODO wirte log, bit, not use frameworkunifiedlog
+ }
+
+ readConfig(&l_realTimelog, &l_logLevelArray); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (l_logLevelArray == NULL) {
+ return;
+ }
+ WriteSharedMem(WTYPE_NORMAL, l_realTimelog, g_FlagIdNum, l_logLevelArray); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (l_logLevelArray != NULL) {
+ free(l_logLevelArray);
+ }
+}
+
+static void writeUpdateConfigForString(std::string &name, // NOLINT (readability/nolint)
+ std::string set_key,
+ std::string value) {
+ std::string flag_loglevel_key = name;
+ flag_loglevel_key.append(set_key);
+
+ std::string config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:expect branch
+ std::string config_tmpfilename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ config_tmpfilename.append(FRAMEWORKUNIFIEDLOG_CONFIG_TMP_NV);
+
+ unlink(config_tmpfilename.c_str());
+ if (copyFrameworkunifiedLogCfgFile(config_filename.c_str(), config_tmpfilename.c_str()) != 0) {
+ DEB_SYSLOG("fail to copy file. no update config.");
+ return;
+ }
+
+// CNSConfigWriter *l_pConfigWriter = new(std::nothrow) CNSConfigWriter(config_filename.c_str());
+ CNSConfigWriter *l_pConfigWriter = new(std::nothrow) CNSConfigWriter(config_tmpfilename.c_str()); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (l_pConfigWriter != NULL) {
+ try {
+ // l_iReturnState = ConfigWriterUpdateValue(l_hHandle, l_sKeyValue.c_str(), actualOutput.c_str());
+ l_pConfigWriter->Set(flag_loglevel_key, value);
+ } catch (...) {
+ // error TODO
+ }
+ // ConfigWriterClose(l_hHandle);
+ l_pConfigWriter->Save();
+ delete l_pConfigWriter;
+ l_pConfigWriter = NULL;
+
+ if (rename(config_tmpfilename.c_str(), config_filename.c_str()) != 0) {
+ DEB_SYSLOG("rename error errno:%d", errno);
+ }
+
+ }
+}
+
+static void
+writeUpdateConfig(std::string set_key, std::string value) {
+ std::string config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ std::string config_tmpfilename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_tmpfilename.append(FRAMEWORKUNIFIEDLOG_CONFIG_TMP_NV);
+
+ unlink(config_tmpfilename.c_str());
+ if (copyFrameworkunifiedLogCfgFile(config_filename.c_str(), config_tmpfilename.c_str())) {
+ DEB_SYSLOG("fail to copy file. no update config.");
+ return;
+ }
+
+// CNSConfigWriter *l_pConfigWriter = new(std::nothrow) CNSConfigWriter(config_filename.c_str());
+ CNSConfigWriter *l_pConfigWriter = new(std::nothrow) CNSConfigWriter(config_tmpfilename.c_str()); // LCOV_EXCL_BR_LINE 11:expect branch
+
+
+ if (l_pConfigWriter != NULL) {
+ l_pConfigWriter->Set(set_key.c_str(), value); // LCOV_EXCL_BR_LINE 11:expect branch
+ l_pConfigWriter->Save(); // LCOV_EXCL_BR_LINE 11:expect branch
+ delete l_pConfigWriter; // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (rename(config_tmpfilename.c_str(), config_filename.c_str()) != 0) {
+ DEB_SYSLOG("rename error errno:%d", errno);
+ }
+ }
+}
+
+//////////////////////////////////////////
+// NsLogSetFrameworkunifiedLogFlag for Diag Method
+//////////////////////////////////////////
+VOID
+NsLogSetFrameworkunifiedLogFlag(UI_8 flag_id, UI_8 mode) {
+ std::string l_key = ".LogLevel";
+ int l_realTimelog;
+ int *l_logLevelArray;
+ std::string l_value;
+
+ if (mode != FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG
+ && mode != FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE) {
+ return;
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgNv()) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ copyFrameworkunifiedLogCfgFileToNv(); // LCOV_EXCL_BR_LINE 11:expect branch
+ }
+
+ l_realTimelog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ l_logLevelArray = NULL;
+
+ readConfig(&l_realTimelog, &l_logLevelArray); // for make ramd data
+ if (l_logLevelArray == NULL) {
+ return;
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgShmem()) {
+ WriteSharedMem(WTYPE_NORMAL, l_realTimelog, g_FlagIdNum, l_logLevelArray);
+ MapShmInfo(g_FrameworkunifiedLogFlagId);
+ }
+
+ if (flag_id >= g_FlagIdNum) {
+ if (l_logLevelArray != NULL) {
+ free(l_logLevelArray);
+ }
+ return;
+ }
+
+ if (mode == FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG) {
+ l_value = "Debug";
+ l_logLevelArray[flag_id] = FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG;
+ } else {
+ l_value = "Release";
+ l_logLevelArray[flag_id] = FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE;
+ }
+ writeUpdateConfigForString(g_flag_name[flag_id], l_key, l_value); // LCOV_EXCL_BR_LINE 11:expect branch
+ WriteSharedMemForFlagId(l_realTimelog, g_FlagIdNum, flag_id, l_logLevelArray[flag_id]); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ free(l_logLevelArray);
+}
+
+//////////////////////////////////////////
+// NsLogGetFrameworkunifiedLogFlag for Diag Method
+//////////////////////////////////////////
+EFrameworkunifiedStatus
+NsLogGetFrameworkunifiedLogFlag(UI_8 flag_id, UI_8 *mode) {
+ int l_realTimeLog;
+ int l_logLevel = 0;
+ int *l_logLevelArray;
+
+ if (mode == NULL) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ l_realTimeLog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ l_logLevelArray = NULL;
+
+ readConfig(&l_realTimeLog, &l_logLevelArray); // for make ramd data
+ if (l_logLevelArray == NULL) {
+ *mode = FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE;
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgShmem()) {
+ WriteSharedMem(WTYPE_NORMAL, l_realTimeLog, g_FlagIdNum, l_logLevelArray);
+ MapShmInfo(g_FrameworkunifiedLogFlagId);
+ }
+
+ if (l_logLevelArray != NULL) {
+ free(l_logLevelArray);
+ }
+
+ if ((flag_id >= g_FlagIdNum)) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ GetShmInfo(flag_id, &l_realTimeLog, &l_logLevel);
+ *mode = static_cast<UI_8>(l_logLevel);
+
+ return eFrameworkunifiedStatusOK;
+}
+
+//////////////////////////////////////////
+// NsLogSetRealtimeLog for Diag Method
+//////////////////////////////////////////
+VOID
+NsLogSetRealtimeLog(UI_8 mode) {
+ int l_realTimelog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ int *l_logLevelArray;
+ std::string l_key = "REALTIME_LOG.Output";
+ std::string l_value = "OFF"; // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (mode == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE) {
+ WriteSharedMem(WTYPE_RTIMELOG, FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE, g_FlagIdNum, NULL); // LCOV_EXCL_BR_LINE 11:expect branch
+ return;
+ }
+
+ if ((mode >= FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_MAX)
+ && (mode != FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE)) {
+ return;
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgNv()) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ copyFrameworkunifiedLogCfgFileToNv(); // LCOV_EXCL_BR_LINE 11:expect branch
+ }
+
+ l_logLevelArray = NULL;
+ readConfig(&l_realTimelog, &l_logLevelArray); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (l_logLevelArray == NULL) {
+ return;
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgShmem()) {
+ WriteSharedMem(WTYPE_NORMAL, l_realTimelog, g_FlagIdNum, l_logLevelArray);
+ MapShmInfo(g_FrameworkunifiedLogFlagId);
+ }
+
+ if (mode == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART) {
+ l_value = "UART";
+ l_realTimelog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART;
+ } else if ((mode == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB)
+ || (mode == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE)) {
+ l_value = "USB";
+ l_realTimelog = mode;
+ } else {
+ l_value = "OFF";
+ l_realTimelog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ }
+
+ writeUpdateConfig(l_key, l_value); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (l_logLevelArray != NULL) {
+ WriteSharedMemForFlagId(l_realTimelog, g_FlagIdNum, FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID,
+ l_logLevelArray[FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID]); // LCOV_EXCL_BR_LINE 11:expect branch
+ free(l_logLevelArray);
+ }
+}
+
+//////////////////////////////////////////
+// NsLogGetRealtimeLog for Diag
+//////////////////////////////////////////
+VOID
+NsLogGetRealtimeLog(UI_8 *mode) {
+ int l_realTimelog;
+ int l_logLevel;
+ int *l_logLevelArray;
+
+ if (mode == NULL) {
+ return;
+ }
+ l_realTimelog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ l_logLevelArray = NULL;
+
+ readConfig(&l_realTimelog, &l_logLevelArray); // for make ramd data
+ if (l_logLevelArray == NULL) {
+ *mode = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ return;
+ }
+ if (!IsExistFrameworkunifiedLogCfgShmem()) {
+ WriteSharedMem(WTYPE_NORMAL, l_realTimelog, g_FlagIdNum, l_logLevelArray);
+ MapShmInfo(g_FrameworkunifiedLogFlagId);
+ }
+ if (l_logLevelArray != NULL) {
+ free(l_logLevelArray);
+ }
+
+ GetShmInfo(g_FrameworkunifiedLogFlagId, &l_realTimelog, &l_logLevel);
+ *mode = static_cast<UI_8>(l_realTimelog);
+}
+
+//////////////////////////////////////////
+// NSLogPrintSysEventLog
+//////////////////////////////////////////
+VOID NSLogSysEvent(const UI_16 f_ui16Line, PCSTR f_cFuncName, PCSTR __format, ...) {
+ va_list arg;
+ CHAR l_cFormat[MAX_QUEUE_MSG_SIZE] = {};
+ CHAR l_cTimeFormat[MAX_TIME_FORMATSTR_LEN] = {};
+ UI_64 l_ui64CurrentTime = 0;
+ static UI_64 cps = 0;
+ static UI_64 l_ui64GapInUS = 0;
+
+ if (cps == 0) {
+ cps = SYSPAGE_ENTRY(qtime)->cycles_per_sec;
+ }
+ if (g_hNSSysEventLogQ == INVALID_HANDLE) {
+ g_hNSSysEventLogQ = OpenSender(NS_SYSEVENTLOGQ);
+ }
+ if (l_ui64GapInUS == 0) {
+ FILE *l_fpPLogGap = NULL;
+ l_fpPLogGap = fopen(PLOG_GAP_FILE, "re");
+ if (l_fpPLogGap != NULL) {
+ CHAR l_cBuffer[MAX_GAP_BUFFER_LEN] = {};
+ if (fgets(l_cBuffer, MAX_GAP_BUFFER_LEN, l_fpPLogGap) != NULL) {
+ l_ui64GapInUS = static_cast<UI_64>(atoll(l_cBuffer));
+ }
+ fclose(l_fpPLogGap);
+ }
+ }
+
+ if (g_hNSSysEventLogQ != INVALID_HANDLE) {
+ CHAR l_cMsg[MAX_QUEUE_MSG_SIZE] = {};
+ // build a format string
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ l_ui64CurrentTime = (ClockCycle() / (cps / 1000000)) + l_ui64GapInUS;
+#endif
+ snprintf(l_cTimeFormat, MAX_TIME_FORMATSTR_LEN, "%s", "us");
+
+ va_start(arg, __format);
+ vsnprintf(l_cFormat, MAX_PLOG_STRING_SIZE - 1, __format, arg);
+ l_cFormat[MAX_PLOG_STRING_SIZE - 1] = '\0';
+ va_end(arg);
+ UI_32 l_uiCharsWritten =
+ snprintf(l_cMsg, MAX_QUEUE_MSG_SIZE - 1,
+ "%12llu[%s]:%s %s: %s: %s\n",
+ static_cast<long long unsigned int>(l_ui64CurrentTime), // NOLINT (readability/nolint)
+ l_cTimeFormat,
+ (l_ui64GapInUS > 0) ? ("o") : ("x"),
+ tls_strProcessName != 0 ? tls_strProcessName : NULL,
+ f_cFuncName != 0 ? f_cFuncName : NULL, l_cFormat);
+
+ if (SendMessage(g_hNSSysEventLogQ, l_uiCharsWritten + 1,
+ reinterpret_cast<void *>(const_cast<char *>(l_cMsg)))
+ != eFrameworkunifiedStatusOK) {
+ // Note: Nothing will be printed on a failure.
+ }
+ }
+}
+
+/////////////////////////////////////////
+// NSLogEnableSysEventLog
+//////////////////////////////////////////
+VOID
+NSLogEnableSysEventLog(BOOL f_bEnable) {
+ g_FrameworkunifiedLogSysEventParams.bIsSysEventLogEnabled = f_bEnable;
+}
+
+//////////////////////////////////////////
+// NSLogIsSysEventLogEnabled
+//////////////////////////////////////////
+BOOL
+NSLogIsSysEventLogEnabled(void) {
+ return g_FrameworkunifiedLogSysEventParams.bIsSysEventLogEnabled;
+}
+
+//////////////////////////////////////////
+// NsLogGetZoneTextList
+//////////////////////////////////////////
+VOID
+NsLogGetZoneTextList(CHAR f_cZoneList[][ZONE_TEXT_SIZE]) {
+ if (f_cZoneList != NULL) {
+ UI_32 l_ui32CharsToWrite = ZONE_TEXT_SIZE - 1;
+ // first fill ns zone text list
+ strncpy(f_cZoneList[0], ZONE_TEXT_0, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[1], ZONE_TEXT_1, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[2], ZONE_TEXT_2, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[3], ZONE_TEXT_3, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[4], ZONE_TEXT_4, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[5], ZONE_TEXT_5, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[6], ZONE_TEXT_6, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[7], ZONE_TEXT_7, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[8], ZONE_TEXT_8, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[9], ZONE_TEXT_9, l_ui32CharsToWrite);
+
+ // fill user zone text list
+ UI_32 l_ui32Count = 10; // start of user zones
+ UI_32 l_ui32ZoneListCount = 0;
+ for (; l_ui32Count < BITS_IN_ZONE_MASK; l_ui32Count++, l_ui32ZoneListCount++) {
+ strncpy(f_cZoneList[l_ui32Count], g_LocalFrameworkunifiedLogParams.cZones[l_ui32ZoneListCount], l_ui32CharsToWrite);
+ }
+ }
+}
+
+VOID
+NsForceClose(void) {
+ if (!syslogopened) {
+ closelog();
+ syslogopened = 0;
+ }
+
+ if (shm_pmap != reinterpret_cast<void *>(const_cast<unsigned int*>(default_log_cfgtbl))) {
+ int size;
+ size = static_cast<int>(sizeof(int) * 2); // realTimeLog + flagIdNum
+ size += static_cast<int>(sizeof(int) * g_FlagIdNum);
+ munmap(shm_pmap, size);
+ shm_pmap = reinterpret_cast<void *>(const_cast<unsigned int*>(default_log_cfgtbl));
+ }
+
+ if (shm_fd != -1) {
+ close(shm_fd);
+ shm_fd = -1;
+ }
+
+ if (g_qid != (mqd_t)(-1)) {
+ mq_close(g_qid);
+ g_qid = (mqd_t)(-1);
+ }
+
+ TFrameworkunifiedLogMap::iterator itr;
+ TFrameworkunifiedLogMap::iterator itr_end;
+ UI_32 i = 0;
+ unsigned int flag_id;
+ if (!g_FrameworkunifiedLogMap.empty()) {
+ itr = g_FrameworkunifiedLogMap.begin();
+ itr_end = g_FrameworkunifiedLogMap.end();
+ for (; itr != itr_end; itr++, i++) {
+ if (itr->second.ring_buffer != NULL) {
+ delete itr->second.ring_buffer; // LCOV_EXCL_BR_LINE 11:expect branch
+ itr->second.ring_buffer = NULL;
+ }
+ }
+ g_FrameworkunifiedLogMap.clear();
+ }
+
+ if (!g_FrameworkunifiedLogFlagMap.empty()) {
+ for (flag_id = 0; flag_id < g_FlagIdNum; flag_id++) {
+ itr = g_FrameworkunifiedLogFlagMap.find(flag_id);
+ if (itr->second.ring_buffer != NULL) {
+ delete itr->second.ring_buffer; // LCOV_EXCL_BR_LINE 11:expect branch
+ itr->second.ring_buffer = NULL;
+ }
+ }
+ g_FrameworkunifiedLogFlagMap.clear();
+ }
+
+ if (!g_flag_name.empty()) {
+ g_flag_name.clear();
+ }
+ g_FrameworkunifiedLogFlagId = FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID;
+ g_FlagIdNum = 0;
+} // LCOV_EXCL_BR_LINE 10:The final line
diff --git a/nsframework/framework_unified/client/NS_Logger/tool/nslogsw.cpp b/nsframework/framework_unified/client/NS_Logger/tool/nslogsw.cpp
new file mode 100755
index 0000000..b81b4a6
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Logger/tool/nslogsw.cpp
@@ -0,0 +1,114 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/ns_version.h>
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+_CWORD78_LOGPARAM g__CWORD78_LogParams = {
+ _CWORD78_LOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31
+ },
+ _CWORD78_LOGZONES
+};
+
+C_CWORD78_Version g__CWORD78_Version(MAJORNO, MINORNO, REVISION);
+
+static void
+Usage(char *exec) {
+ fprintf(stderr, "Usage: %s options\n", exec != 0 ? exec : NULL);
+ fprintf(stderr, " options\n");
+ fprintf(stderr, " -0 : REALTIMELOG_MODE_OFF\n");
+ fprintf(stderr, " -1 : REALTIMELOG_MODE_UART\n");
+ fprintf(stderr, " -2 : REALTIMELOG_MODE_USB\n");
+ fprintf(stderr, " -3 : REALTIMELOG_MODE_ETHER\n");
+ fprintf(stderr, " (none) print current status\n");
+}
+
+int
+main(int argc, char **argv) {
+ int c;
+
+ if (argc < 2) {
+ UI_8 realtimelog;
+ NsLogGetRealtimeLog(&realtimelog);
+ fprintf(stderr, "current status : -%d\n", realtimelog);
+ fprintf(stderr, " refer '%s -h'\n", argv[0] != 0 ? argv[0] : NULL);
+ return 0;
+ }
+
+ while ((c = getopt(argc, argv, "0123h")) != -1) {
+ switch (c) {
+ case '0':
+ fprintf(stderr, "set REALTIMELOG_MODE_OFF\n");
+ NsLogSetRealtimeLog(_CWORD78_LOG_REALTIMELOG_MODE_OFF);
+ return 0;
+ case '1':
+ fprintf(stderr, "set REALTIMELOG_MODE_UART\n");
+ NsLogSetRealtimeLog(_CWORD78_LOG_REALTIMELOG_MODE_UART);
+ return 0;
+ case '2':
+ fprintf(stderr, "set REALTIMELOG_MODE_USB\n");
+ NsLogSetRealtimeLog(_CWORD78_LOG_REALTIMELOG_MODE_USB);
+ return 0;
+ case '3':
+ fprintf(stderr, "set REALTIMELOG_MODE_ETHER\n");
+ NsLogSetRealtimeLog(_CWORD78_LOG_REALTIMELOG_MODE_ETHER);
+ return 0;
+ default:
+ Usage(argv[0]);
+ return 0;
+ }
+ }
+ Usage(argv[0]);
+ return 0;
+}
diff --git a/nsframework/framework_unified/client/NS_MessageCenter/cfg/depends.mk b/nsframework/framework_unified/client/NS_MessageCenter/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageCenter/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_MessageCenter/include/ns_mc_internal.h b/nsframework/framework_unified/client/NS_MessageCenter/include/ns_mc_internal.h
new file mode 100755
index 0000000..2b6dae8
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageCenter/include/ns_mc_internal.h
@@ -0,0 +1,93 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_MessageCenter
+/// \brief Declares the internal methods of message center
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MC_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MC_INTERNAL_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetData
+/// Get the message data, this may be from a queue or shared memory.
+/// Deletes the data based on the value of BOOL retain, if it is stored in shared memory.
+///
+/// \param [in] data
+/// PVOID - pointer to the data received from the McReceive Call
+/// \param [in] to
+/// PVOID - pointer to the data to be received
+/// \param [in] retain
+/// BOOL - TRUE to retain the data in shared memory
+/// FALSE to release the data
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - status indicating success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetData(PVOID data, PVOID to, BOOL retain);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// McLogTransmitLoggingMsgProcessed
+///
+/// \param [in] p_sysHdr
+/// PVOID - Header of the received message. Passed as PVOID since Frameworkunified layer doesn't have
+/// knowledge about the header.
+/// \param [in] bMsgProcessed
+/// BOOL - TRUE - If any action was taken on the received message else FALSE
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID McLogTransmitLoggingMsgProcessed(PVOID p_sysHdr, BOOL bMsgProcessed);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Get the session id.
+///
+/// \param [in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+///
+/// \return UI_32
+/// sessionId - session id
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 mcGetMsgSsessionId(PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Gets the is type of sync from message header.
+///
+/// \param [in] pData
+/// void* - pointer to the data was received from the McReceive Call
+///
+/// \return BOOL
+/// isTypeOfSync -
+/// if message type is sync, return TRUE. or not return FALSE.
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL mcGetIsTypeOfSync(PVOID data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MC_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_MessageCenter/include/ns_message_center_internal.h b/nsframework/framework_unified/client/NS_MessageCenter/include/ns_message_center_internal.h
new file mode 100755
index 0000000..a99e811
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageCenter/include/ns_message_center_internal.h
@@ -0,0 +1,185 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MESSAGE_CENTER_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MESSAGE_CENTER_INTERNAL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_shared_mem_if.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcOpenMonitor
+/// for Server API
+///
+/// \param [in] name
+/// PCSTR - Service name
+///
+/// \return int
+/// -1 - error
+/// >0 - Listen socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcOpenMonitor(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcCloseMonitor
+/// for Server API
+///
+/// \param [in] name
+/// PCSTR - Service name
+///
+/// \return int
+/// -1 - error
+/// 0 - success
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcCloseMonitor(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcSetConnectKey
+/// for Common API
+///
+/// \param [out] buf
+/// char * - buffer
+/// \param [in] size
+/// int - buffer size
+/// \param [in] serverName
+/// PCSTR - Server name
+/// \param [in] clientName
+/// PCSTR - Client name
+///
+/// \return int
+/// -1 - error
+/// >0 - Connect socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcSetConnectKey(char *buf, size_t size, PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcConnectMonitor
+/// for Client API
+///
+/// \param [in] serverName
+/// PCSTR - server name
+/// \param [in] clientName
+/// PCSTR - client name
+///
+/// \return int
+/// -1 - error
+/// >0 - Connect socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcConnectMonitor(PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcCloseConnectMonitor
+/// for Client API
+///
+/// \param [in] serverName
+/// PCSTR - server name
+/// \param [in] clientName
+/// PCSTR - client name
+///
+/// \return int
+/// -1 - error
+/// >0 - Connect socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcCloseConnectMonitor(PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcAcceptMonitor
+/// for Server API
+///
+/// \param [in] serverName
+/// PCSTR - server name
+/// \param [in] listenMonitorFd
+/// int - Listen socket FD
+///
+/// \return int
+/// -1 - error
+/// >0 - Accept socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcAcceptMonitor(PCSTR serverName, int listenMonitorFd);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcGetAcceptMonitor
+/// for Server API
+///
+/// \param [in] serverName
+/// PCSTR - server name
+/// \param [in] clientName
+/// PCSTR - client name
+///
+/// \return int
+/// -1 - error
+/// >0 - Accept socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcGetAcceptMonitor(PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcCloseAcceptMonitor
+/// for Server API
+///
+/// \param [in] serverName
+/// PCSTR - server name
+/// \param [in] clientName
+/// PCSTR - client name
+///
+/// \return int
+/// -1 - error
+/// >0 - Accept socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcCloseAcceptMonitor(PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcGetClientNameFromConnectKey
+/// for Server API
+///
+/// \param [in] connectKey
+/// PCSTR - connect key
+/// \param [out] clientName
+/// PCHAR - client name
+/// \param [out] len
+/// size_t - clientname buffer length
+///
+/// \return int
+/// -1 - error
+/// >0 - Accept socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcGetClientNameFromConnectKey(PCSTR connectKey, PCHAR clientName, size_t len);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcGetServerNameFromConnectKey
+/// for Client API
+///
+/// \param [in] connectKey
+/// PCSTR - connect key
+/// \param [out] serverName
+/// PCHAR - client name
+/// \param [out] len
+/// size_t - serverName buffer length
+///
+/// \return int
+/// -1 - error
+/// >0 - Accept socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcGetServerNameFromConnectKey(PCSTR connectKey, PCHAR serverName, size_t len);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MESSAGE_CENTER_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_MessageCenter/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_MessageCenter/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..c654ef7
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageCenter/src/makefile_PosixBasedOS001
@@ -0,0 +1,214 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_MessageCenter
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_MessageCenter
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_MessageQueue/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_SharedMemIf/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
+ $(wildcard $(TEAM_ROOT)NS_MessageQueue/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NS_SharedMemIf/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+ifdef DYNAMIC
+ DYNAMIC_LIBS += \
+ NS_SharedMemIf$(DEBUG_EXT) \
+ NS_MessageQueue$(DEBUG_EXT)
+else
+ STATIC_LIBS +=
+endif
+
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+module_dirs: build_dirs
+
diff --git a/nsframework/framework_unified/client/NS_MessageCenter/src/ns_message_center.c b/nsframework/framework_unified/client/NS_MessageCenter/src/ns_message_center.c
new file mode 100755
index 0000000..fe84128
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageCenter/src/ns_message_center.c
@@ -0,0 +1,1269 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageCenter
+/// \brief
+///
+/// APIs to Open\Close and Send\Receive on message queues and shared memory.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_message_center_if.h>
+#include <ns_message_center_internal.h>
+#include "ns_msg_queue.h"
+#include <ns_mq_internal.h>
+#include <ns_mc_internal.h>
+#include <native_service/ns_msgs.h>
+#include <string.h>
+#include <stdarg.h>
+#include <native_service/ns_shared_mem_if.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/timeb.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/resource.h>
+#include <sys/syscall.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <stddef.h>
+#include <sys/epoll.h>
+#include <native_service/ns_transmit_log.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_resource_controler.h>
+#include <native_service/nsfw_message.h>
+#include <limits.h>
+
+#include <other_service/strlcpy.h>
+
+#define assert_static(e) \
+ do { \
+ enum { assert_static__ = 1/(e) }; \
+ } while (0)
+
+#define MC_INVOKE_SYNC_TIMEOUT (60 * 1000)
+
+typedef struct {
+ UI_32 seq_id;
+ EFrameworkunifiedStatus ret_val;
+ UI_32 res_size;
+} ResponseHeader;
+
+static unsigned int mcSeed[4];
+
+HANDLE McOpenReceiverNotBlocked(PCSTR name) {
+ return OpenReceiverNotBlocked(name);
+}
+
+HANDLE McOpenReceiver(PCSTR name) {
+ return OpenReceiver(name);
+}
+
+HANDLE McOpenSyncReceiver(PCSTR name) {
+ return openSyncReceiver(name);
+}
+
+
+HANDLE McOpenSender(PCSTR name) {
+ return OpenSender(name);
+}
+
+HANDLE McOpenSenderNotBlocked(PCSTR name) {
+ return OpenSender(name);
+}
+
+HANDLE McOpenSyncSender(PCSTR name) {
+ return openSyncSender(name);
+}
+
+static int mcSetMonitorName(char *str, PCSTR name) {
+ int len;
+ if (str == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "str is NULL");
+ return -1;
+ }
+ *str = '\0';
+ len = sprintf(str + 1, "monitorS_%s", name != 0 ? name : NULL);
+ return len + 1;
+}
+
+static int OpenMonitor(PCSTR name) {
+ int monitor_sock = -1;
+ int monitor_sa_len;
+ struct sockaddr_un monitor_sa_un;
+
+ if ((monitor_sock = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "socket:%s", strerror(errno));
+ goto error;
+ }
+
+ memset(&monitor_sa_un, 0, sizeof(monitor_sa_un));
+ monitor_sa_un.sun_family = AF_UNIX;
+ monitor_sa_len = mcSetMonitorName(monitor_sa_un.sun_path, name);
+ monitor_sa_len += (int)offsetof(struct sockaddr_un, sun_path);
+
+ if (bind(monitor_sock, (struct sockaddr *)&monitor_sa_un, (socklen_t)monitor_sa_len) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "bind:%s:%s", name, strerror(errno)); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ goto error;
+ }
+
+ if (listen(monitor_sock, SOMAXCONN) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "listen:%s", strerror(errno)); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ goto error;
+ }
+ return monitor_sock;
+
+error:
+ if (monitor_sock >= 0) {
+ close(monitor_sock);
+ }
+ return -1;
+}
+
+int mcOpenMonitor(PCSTR name) {
+ long monitor_sock;
+
+ if (frameworkunifiedAcquireResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, name, &monitor_sock) < 0) {
+ if ((monitor_sock = OpenMonitor(name)) != -1) {
+ if (frameworkunifiedRegistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, name, monitor_sock, 1) < 0) {
+ close(monitor_sock);
+ monitor_sock = -1;
+ }
+ }
+ }
+
+ return (int)monitor_sock;
+}
+
+int mcCloseMonitor(PCSTR name) {
+ long monitor_sock;
+
+ if (frameworkunifiedGetResource(FRAMEWORKUNIFIED_RES_ABNMLMON, name, &monitor_sock) < 0) {
+ return -1;
+ }
+
+ frameworkunifiedUnregistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, name);
+ close((int)monitor_sock);
+
+ return 0;
+}
+
+static int mcSetClientName(char *str, PCSTR serverName, PCSTR clientName) {
+ int len;
+ if (str == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "str is NULL");
+ return -1;
+ }
+ *str = '\0';
+ len = sprintf(str + 1, "monitorC_%s:%s", serverName != 0 ? serverName : NULL, clientName != 0 ? clientName : NULL);
+ return len + 1;
+}
+
+static int ConnectMonitor(PCSTR serverName, PCSTR clientName) {
+ int client_sock = -1;
+ int client_sa_len, monitor_sa_len;
+ struct sockaddr_un client_sa_un, monitor_sa_un;
+
+ if ((client_sock = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) < 0) { // LCOV_EXCL_BR_LINE 5: socket's error case
+ // LCOV_EXCL_START 5:socket's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "socket:%s", strerror(errno));
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ memset(&client_sa_un, 0, sizeof(client_sa_un));
+ client_sa_un.sun_family = AF_UNIX;
+ client_sa_len = mcSetClientName(client_sa_un.sun_path, serverName, clientName);
+ client_sa_len += (int)offsetof(struct sockaddr_un, sun_path);
+
+ if (bind(client_sock, (struct sockaddr *)&client_sa_un, (socklen_t)client_sa_len) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "bind:%s:%s", client_sa_un.sun_path + 1, strerror(errno));
+ goto error;
+ }
+
+ memset(&monitor_sa_un, 0, sizeof(monitor_sa_un));
+ monitor_sa_un.sun_family = AF_UNIX;
+ monitor_sa_len = mcSetMonitorName(monitor_sa_un.sun_path, serverName);
+ monitor_sa_len += (int)offsetof(struct sockaddr_un, sun_path);
+
+ if (connect(client_sock, (struct sockaddr *)&monitor_sa_un, (socklen_t)monitor_sa_len) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "connect:%s", strerror(errno));
+ goto error;
+ }
+ return client_sock;
+
+error:
+ close(client_sock);
+ return -1;
+}
+
+int mcSetConnectKey(char *buf, size_t size, PCSTR serverName, PCSTR clientName) {
+ int len = snprintf(buf, size, "%s:%s", serverName != 0 ? serverName : NULL, clientName != 0 ? clientName : NULL);
+ if (buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "buf is NULL");
+ return -1;
+ }
+ buf[size - 1] = '\0';
+ return len;
+}
+
+int mcConnectMonitor(PCSTR serverName, PCSTR clientName) {
+ long client_sock;
+ char connect_key[32];
+
+ mcSetConnectKey(connect_key, sizeof(connect_key), serverName, clientName);
+
+ if (frameworkunifiedAcquireResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key, &client_sock) < 0) {
+ if ((client_sock = ConnectMonitor(serverName, clientName)) != -1) {
+ if (frameworkunifiedRegistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key, client_sock, 1) < 0) {
+ close(client_sock);
+ client_sock = -1;
+ }
+ }
+ }
+
+ return (int)client_sock;
+}
+
+int mcCloseConnectMonitor(PCSTR serverName, PCSTR clientName) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ long client_sock;
+ char connect_key[32];
+
+ mcSetConnectKey(connect_key, sizeof(connect_key), serverName, clientName);
+
+ if (frameworkunifiedGetResource(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key, &client_sock) == -1) {
+ return -1;
+ }
+
+ if (frameworkunifiedReleaseResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key) == 0) {
+ frameworkunifiedUnregistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key);
+ close((int)client_sock);
+ }
+
+ return 0;
+}
+// LCOV_EXCL_STOP
+static void mcGetClientName(const char *str, char *client_name, size_t size, int pathlen) {
+ size_t len = size - 1;
+ size_t str_len;
+ if (str == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "str is NULL");
+ return;
+ }
+ char *p_div = strchr(str + 1, ':');
+ if (p_div == NULL) {
+ return;
+ }
+ str_len = (size_t)(pathlen - (p_div - str + 1));
+ if (len > str_len) {
+ len = str_len;
+ }
+ if (client_name == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "client_name is NULL");
+ return;
+ }
+ strncpy(client_name, p_div + 1, len);
+ client_name[len] = '\0';
+}
+
+int mcAcceptMonitor(PCSTR serverName, int listenMonitorFd) {
+ int accept_sock = -1;
+ struct sockaddr_un client_sa_un;
+ socklen_t client_sa_len = sizeof(client_sa_un);
+ char client_name[16];
+ char connect_key[32];
+
+ if ((accept_sock = accept4(listenMonitorFd, (struct sockaddr *)&client_sa_un, &client_sa_len, SOCK_CLOEXEC)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "accept:%s", strerror(errno));
+ return -1;
+ }
+
+ mcGetClientName(client_sa_un.sun_path, client_name, sizeof(client_name), (int)(client_sa_len - offsetof(struct sockaddr_un,
+ sun_path)));
+ mcSetConnectKey(connect_key, sizeof(connect_key), serverName, client_name);
+
+ frameworkunifiedRegistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key, accept_sock, 0);
+ return accept_sock;
+}
+
+int mcGetAcceptMonitor(PCSTR serverName, PCSTR clientName) {
+ long accept_sock;
+ char connect_key[32];
+
+ mcSetConnectKey(connect_key, sizeof(connect_key), serverName, clientName);
+
+ if (frameworkunifiedAcquireResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key, &accept_sock) < 0) {
+ return -1;
+ }
+
+ return (int)accept_sock;
+}
+
+int mcGetClientNameFromConnectKey(PCSTR connectKey, PCHAR clientName, size_t len) {
+ char *p_div = strchr(connectKey, ':');
+ if (p_div == NULL) {
+ return -1;
+ }
+
+ strncpy(clientName, p_div + 1, len);
+ clientName[len - 1] = '\0';
+ return 0;
+}
+
+int mcGetServerNameFromConnectKey(PCSTR connectKey, PCHAR serverName, size_t len) {
+ char *p_div = strchr(connectKey, ':');
+ size_t min_len;
+
+ if (p_div == NULL) {
+ return -1;
+ }
+
+ min_len = ((len - 1) < (p_div - connectKey)) ? len - 1 : (size_t)(p_div - connectKey);
+ strncpy(serverName, connectKey, min_len);
+ serverName[min_len] = '\0';
+ return 0;
+}
+
+/////////////////////////////////////////
+HANDLE McOpenSenderChild(PCSTR name, pthread_t childid) {
+ return OpenSenderChild(name, childid);
+}
+
+EFrameworkunifiedStatus McJoinChild(HANDLE hChildApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (INVALID_HANDLE != hChildApp) { // LCOV_EXCL_BR_LINE 6: impossible to confirm because hChildApp checked is passed in the FrameworkunifiedDestroyChildThread function of the frameworkunified_multithreading.cpp
+ eStatus = JoinChild(hChildApp);
+ } else {
+ // LCOV_EXCL_START 6: impossible to confirm because hChildApp checked is passed in the FrameworkunifiedDestroyChildThread function of the frameworkunified_multithreading.cpp
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus McGetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (INVALID_HANDLE != hChildApp) {
+ eStatus = GetChildThreadPriority(hChildApp, threadPrio);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+/// endhack...
+/////////////////////////////////////////
+
+static EFrameworkunifiedStatus mcReceiveInternal(HANDLE hMessage, PSTR source, UI_32 *cmd, UI_32 *sessionid, UI_32 length,
+ PVOID data) {
+ PSSystemMsgHeader sysHdr = NULL;
+
+ // check if handle is valid
+ if (hMessage == INVALID_HANDLE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // check if buffer is null
+ if (data == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ // check for invalid length.
+ if (length <= 0) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ // check if the source is null
+ if (source == NULL) {
+ return eFrameworkunifiedStatusInvldQName;
+ }
+
+ if (cmd == NULL) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (-1 != ReceiveMessage(hMessage, length, data)) {
+ sysHdr = (PSSystemMsgHeader)data;
+ if (strlen(sysHdr->info.source) < MAX_QUEUE_NAME_SIZE) {
+ *cmd = sysHdr->info.command;
+ if (sessionid) {
+ *sessionid = sysHdr->info.sessionid;
+ }
+ strlcpy(source, sysHdr->info.source, MAX_NAME_SIZE_APP);
+ return eFrameworkunifiedStatusOK;
+ } else {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+ } else {
+ return TranslateError(errno);
+ }
+
+ return eFrameworkunifiedStatusFail;
+}
+
+EFrameworkunifiedStatus McReceive(HANDLE hMessage, PSTR source, UI_32 *cmd, UI_32 length, PVOID data) {
+ return mcReceiveInternal(hMessage, source, cmd, NULL, length, data);
+}
+
+EFrameworkunifiedStatus McReceiveWithSession(HANDLE hMessage, PSTR source, UI_32 *cmd, UI_32 *sessionid, UI_32 length, PVOID data) {
+ if (sessionid == NULL) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return mcReceiveInternal(hMessage, source, cmd, sessionid, length, data);
+}
+
+static EFrameworkunifiedStatus mcSendInternal(HANDLE hMessage, PCSTR source, UI_32 cmd, PCSTR sysInfo, UI_32 length, PCVOID data,
+ EFrameworkunifiedMessagePriorties priority, UI_32 sessionid, BOOL is_sync) {
+ assert_static(_NSFW_MSG_LEN_ == sizeof(SSystemMsgHeader));
+ assert_static(_NSFW_SYSINFO_SIZE_ == MAX_SYS_INFO_SIZE);
+ assert_static(_NSFW_SYSINFO_FLAG_ == MC_EMSGT_SYSINFO_MASK);
+
+ // check if handle is valid
+ if (mqCheckValidHandle(hMessage) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // check if buffer is null
+ if (data == NULL && length > 0) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ // check if the source is null
+ if (source == NULL) {
+ return eFrameworkunifiedStatusInvldQName;
+ }
+
+ // check if the source length exceeds than expected
+ /**
+ * @todo
+ * Although a send message queue handle can be created using a 19-byte message queue name, messages cannot be sent using the created send message queue handle.
+ * Because "/" is added to the queue name in the send message queue handle, a judgment error of MAX_QUEUE_NAME_SIZE (20 bytes) occurs during transmission and transmission cannot be performed.
+ */
+ if (strlen(source) >= MAX_QUEUE_NAME_SIZE) {
+ return eFrameworkunifiedStatusInvldQName;
+ }
+
+ // notification name size should be less than MAX_SYS_INFO_SIZE
+ // data length check
+ UI_32 max_length = 0;
+ if (NULL != sysInfo) {
+ if (strlen(sysInfo) >= MAX_SYS_INFO_SIZE) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ // If there is an sysInfo, the maximum send data length is the maximum send data length of UI_32 minus (header + sysInfo size).
+ max_length = 0xFFFFFFFF - sizeof(SSystemMsgHeader) - sizeof(TSysMsgSystemInfo);
+ } else {
+ // If there is no sysInfo, the maximum send data length is the maximum value of UI_32 minus the headers.
+ max_length = 0xFFFFFFFF - sizeof(SSystemMsgHeader);
+ }
+
+ if (length > max_length) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ EFrameworkunifiedStatus rtnStatus = eFrameworkunifiedStatusOK;
+
+ UI_8 sndBuf[ MAX_QUEUE_MSG_SIZE ];
+ SQhandle *sndHndl = (SQhandle *)hMessage;
+ SSystemMsgHeader *msgHdr = (SSystemMsgHeader *)sndBuf;
+ UI_32 send_length = 0;
+ UI_32 offset = sizeof(SSystemMsgHeader);
+
+ if (NULL == sndHndl->q_name) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // check if the dest length exceeds than expected
+ if (strlen(sndHndl->q_name) >= MAX_QUEUE_NAME_SIZE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // compose header
+ strcpy(msgHdr->info.source, source);
+ msgHdr->info.length = length; // this is length of the messages data...
+ msgHdr->info.command = cmd;
+ msgHdr->info.sessionid = sessionid;
+
+ msgHdr->eType = (UI_32)MC_EMSGT_VALID_TOKEN;
+ msgHdr->memId = 0; // not set...
+ if (NULL != sysInfo) {
+ msgHdr->eType |= MC_EMSGT_SYSINFO_MASK;
+ strcpy((char *)(sndBuf + offset), sysInfo);
+ offset += (UI_32)sizeof(TSysMsgSystemInfo);
+ }
+ if (is_sync) {
+ msgHdr->eType |= MC_EMSGT_SYNC_MASK;
+ }
+
+ // Build buffer to send...
+
+ // copy to buffer
+ /*
+ * @todo
+ * Do not throw an error even if the data size of the argument is set to 0.
+ * When "length + offset" is MAX_QUEUE_MSG_SIZE (4096) or more, the length becomes 0 in the process that is executed cannot be checked.
+ * Sizeof(SSystemMsgHeader) is 40, sizeof(TSysMsgSystemInfo) is 64, maximal. offset is 104, min. is 40
+ */
+ if ((length + offset) >= MAX_QUEUE_MSG_SIZE) {
+ // set the shared mem info in header....
+ msgHdr->eType |= MC_EMSGT_SHM_MASK;
+
+ // send data to shm
+ msgHdr->memId = SetDataToShared(data, length, source, sndHndl->q_name);
+
+ if (BAD_MEM_ID != msgHdr->memId) {
+ // update the send length
+ send_length += offset;
+ } else {
+ rtnStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else { // was less than the max
+ // update the send length
+ send_length += offset;
+
+ /**
+ * @todo
+ * If UINT_MAX (4294967295) is specified in the iLength of FrameworkunifiedNPPublishNotification,
+ * the comparison by (length + offset) >= MAX_QUEUE_MSG_SIZE fails to compare correctly because of an overflow,
+ * and the comparison is judged to be less than the max.
+ * Once in the else block, the data is treated as a sysHeader block of up to 4096 bytes,
+ * and the memcpy is performed again without size checking, resulting in a segmentation fault.
+ * Maximum message length that can be sent by FrameworkunifiedNPPublishNotification must be specified and the maximum message length must be checked.
+ */
+ // copy the msg to send buffer
+ memcpy(&sndBuf[0] + offset, data, length);
+
+ // update the send length
+ send_length += length;
+ }
+
+ if (eFrameworkunifiedStatusOK == rtnStatus) {
+ rtnStatus = SendMessageWithPriority(hMessage, send_length, (PVOID)&sndBuf[0], priority);
+ }
+
+ if (rtnStatus != eFrameworkunifiedStatusOK) {
+ // remove the shared mem since this failed.
+ McClearData(msgHdr);
+ }
+
+ return rtnStatus;
+}
+
+EFrameworkunifiedStatus McSendPrioWithSysInfo(HANDLE hMessage, PCSTR source, UI_32 cmd, PCSTR sysInfo, UI_32 length, PCVOID data,
+ EFrameworkunifiedMessagePriorties priority, UI_32 sessionid) {
+ if (NULL == sysInfo) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return mcSendInternal(hMessage, source, cmd, sysInfo, length, data, priority, sessionid, FALSE);
+}
+
+EFrameworkunifiedStatus McSendWithSysInfo(HANDLE hMessage, PCSTR source, UI_32 cmd, PCSTR sysInfo, UI_32 length, PCVOID data,
+ UI_32 sessionid) {
+ if (NULL == sysInfo) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return mcSendInternal(hMessage, source, cmd, sysInfo, length, data, eFrameworkunifiedMsgPrioNormal, sessionid, FALSE);
+}
+
+EFrameworkunifiedStatus McSend(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data) {
+ return mcSendInternal(hMessage, source, cmd, NULL, length, data, eFrameworkunifiedMsgPrioNormal, 0, FALSE);
+}
+
+EFrameworkunifiedStatus McSendWithPriority(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data,
+ EFrameworkunifiedMessagePriorties priority, UI_32 sessionid) {
+ return mcSendInternal(hMessage, source, cmd, NULL, length, data, priority, sessionid, FALSE);
+}
+
+EFrameworkunifiedStatus McSendWithSession(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data, UI_32 sessionid) {
+ return mcSendInternal(hMessage, source, cmd, NULL, length, data, eFrameworkunifiedMsgPrioNormal, sessionid, FALSE);
+}
+
+EFrameworkunifiedStatus McSendSyncResponse(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 seq_id, EFrameworkunifiedStatus ret_val, UI_32 length,
+ PCVOID data) {
+ EFrameworkunifiedStatus eStatus;
+ ResponseHeader *resHdr;
+ UI_8 *res_data;
+
+ if ((UINT_MAX - sizeof(ResponseHeader)) < length) {
+ return eFrameworkunifiedStatusInvldBufSize;
+ }
+
+ // check if buffer is null
+ if (data == NULL && length > 0) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ if ((res_data = calloc(length + sizeof(ResponseHeader), 1)) == NULL) { // LCOV_EXCL_BR_LINE 5: calloc's error case
+ // LCOV_EXCL_START 5: calloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+
+ resHdr = (ResponseHeader *)res_data;
+ resHdr->seq_id = seq_id;
+ resHdr->ret_val = ret_val;
+ resHdr->res_size = length;
+
+ memcpy(res_data + sizeof(ResponseHeader), data, length);
+
+ eStatus = mcSendInternal(hMessage, source, cmd, NULL, (UI_32)(length + sizeof(ResponseHeader)), res_data, eFrameworkunifiedMsgPrioNormal, 0,
+ TRUE);
+
+exit:
+ free(res_data);
+ res_data = NULL;
+ resHdr = NULL;
+
+ return eStatus;
+}
+
+/*
+ * Xorshift
+ */
+static inline unsigned int xor128(void) {
+ unsigned int t;
+ t = (mcSeed[0] ^ (mcSeed[0] << 11));
+ mcSeed[0] = mcSeed[1];
+ mcSeed[1] = mcSeed[2];
+ mcSeed[2] = mcSeed[3];
+ return (mcSeed[3] = (mcSeed[3] ^ (mcSeed[3] >> 19)) ^ (t ^ (t >> 8)));
+}
+
+static inline char *ultoa(unsigned long value, char *buf, int radix) {
+ const static char c[] = "0123456789abcdef";
+ char b[65];
+ char *p = b + sizeof(b);
+
+ *--p = '\0';
+ do {
+ *--p = c[value % (unsigned long)radix];
+ value /= (unsigned long)radix;
+ } while (value);
+ if (buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "buf is NULL");
+ return NULL;
+ }
+ strcpy(buf, p);
+
+ return buf;
+}
+
+EFrameworkunifiedStatus McInvokeSync(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 msgLength, PCVOID msgData, UI_32 sessionid,
+ HANDLE hRcvMessage, UI_32 responseLength, PVOID responseData, UI_32 *receivedLength) {
+ EFrameworkunifiedStatus eStatus;
+ TSysMsgSystemInfo sysInfo;
+ UI_32 seq_id;
+ ResponseHeader *resHdr;
+ UI_8 *rcv_buf = NULL;
+ CHAR resSource[MAX_NAME_SIZE_APP];
+ int efd = -1;
+ struct epoll_event events[2];
+ struct epoll_event ev;
+ int connect_sock = -1;
+ SQhandle *sndHndl = (SQhandle *)hMessage;
+
+ if (mqCheckValidHandle(hMessage) == FALSE || mqCheckValidHandle(hRcvMessage) == FALSE || (responseLength != 0 &&
+ responseData == NULL)) {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ /**
+ * @todo
+ * The system performs rcv_buf free without NULL determination.
+ */
+ goto exit;
+ }
+
+ if (NULL == receivedLength) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ }
+ if ((rcv_buf = malloc(MAX_QUEUE_MSG_SIZE)) == NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case.
+ // LCOV_EXCL_START 5: malloc's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+
+ if (mcSeed[0] == 0) {
+ int fd;
+ if ((fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC)) < 0) {
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ }
+
+ if (read(fd, &mcSeed, sizeof(mcSeed)) < 0) {
+ close(fd);
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ }
+ close(fd);
+ }
+ seq_id = xor128();
+
+ sysInfo[0] = '0';
+ sysInfo[1] = 'x';
+ ultoa(seq_id, &sysInfo[2], 16);
+
+ Flush(hRcvMessage);
+
+ eStatus = mcSendInternal(hMessage, source, cmd, sysInfo, msgLength, msgData, eFrameworkunifiedMsgPrioNormal, sessionid, TRUE);
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ goto exit;
+ }
+
+ if ((connect_sock = mcConnectMonitor(sndHndl->q_name + 1, source)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "connect:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ }
+
+ if ((efd = epoll_create1(EPOLL_CLOEXEC)) < 0) { // LCOV_EXCL_BR_LINE 5: epoll_create1's error case.
+ // LCOV_EXCL_START 5: epoll_create1's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_create1:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+ ev.events = EPOLLIN;
+ ev.data.fd = McGetQueueFD(hRcvMessage);
+ if (epoll_ctl(efd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0) { // LCOV_EXCL_BR_LINE 5: epoll_ctl's error case.
+ // LCOV_EXCL_START 5: epoll_ctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+ ev.events = EPOLLRDHUP;
+ ev.data.fd = connect_sock;
+ if (epoll_ctl(efd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0) { // LCOV_EXCL_BR_LINE 5: epoll_ctl's error case.
+ // LCOV_EXCL_START 5: epoll_ctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+
+ while (1) {
+ int nfds, n;
+
+ nfds = epoll_wait(efd, events, 2, MC_INVOKE_SYNC_TIMEOUT);
+ if (nfds == -1) { // LCOV_EXCL_BR_LINE 5: epoll_wait's error case.
+ // LCOV_EXCL_START 5: epoll_wait's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == EINTR) {
+ continue;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_wait:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ } else if (nfds == 0) { // LCOV_EXCL_BR_LINE 5: epoll_wait return value equal 0.
+ // LCOV_EXCL_START 5: epoll_wait return value equal 0.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_wait:time out");
+ eStatus = eFrameworkunifiedStatusAccessError;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+
+ for (n = 0; n < nfds; n++) {
+ if (events[n].data.fd == connect_sock) {
+ /*
+ * connection fail
+ */
+ char connect_key[32];
+ mcSetConnectKey(connect_key, sizeof(connect_key), sndHndl->q_name + 1, source);
+
+ if (epoll_ctl(efd, EPOLL_CTL_DEL, connect_sock, events) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ }
+ if (close(connect_sock) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "close:%s", strerror(errno));
+ }
+ frameworkunifiedUnregistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key);
+
+ if ((connect_sock = mcConnectMonitor(sndHndl->q_name + 1, source)) < 0) {
+ eStatus = eFrameworkunifiedStatusBadConnection;
+ goto exit;
+ }
+ ev.events = EPOLLRDHUP;
+ ev.data.fd = connect_sock;
+ if (epoll_ctl(efd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ }
+ } else {
+ /*
+ * response receive
+ */
+ if ((eStatus = McReceive(hRcvMessage, resSource, &cmd, MAX_QUEUE_MSG_SIZE, rcv_buf)) != eFrameworkunifiedStatusOK) {
+ goto exit;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)rcv_buf;
+ if (MC_EMSGT_IS_SHM(sysHdr->eType)) {
+ UI_32 shmLength = GetLengthOfDataFromShared(sysHdr->memId);
+ TMemID memId = sysHdr->memId;
+
+ if (shmLength == 0) {
+ eStatus = eFrameworkunifiedStatusErrOther;
+ goto exit;
+ }
+
+ free(rcv_buf);
+ if ((rcv_buf = calloc(shmLength, 1)) == NULL) {
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ }
+
+ if ((eStatus = GetDataFromShared(memId, rcv_buf, shmLength)) != eFrameworkunifiedStatusOK) {
+ eStatus = eFrameworkunifiedStatusErrOther;
+ goto exit;
+ }
+
+ DiscardDataFromShared(memId);
+ resHdr = (ResponseHeader *)rcv_buf;
+ } else {
+ resHdr = (ResponseHeader *)(rcv_buf + sizeof(SSystemMsgHeader));
+ }
+
+ if (resHdr->seq_id == seq_id) {
+ if (resHdr->res_size > 0 && responseLength > 0)
+ memcpy(responseData, (const void *)((char *)resHdr + sizeof(ResponseHeader)),
+ resHdr->res_size > responseLength ? responseLength : resHdr->res_size);
+
+ *receivedLength = resHdr->res_size;
+ eStatus = resHdr->ret_val;
+ goto exit; // success
+ }
+ }
+ }
+ }
+
+exit:
+ free(rcv_buf);
+ rcv_buf = NULL;
+ resHdr = NULL;
+
+ if (efd >= 0) {
+ close(efd);
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus McCreateInvokerName(PCSTR source, UI_32 sessionid, PSTR invokerName, UI_32 size) {
+ if (source == NULL || invokerName == NULL) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ // When the size of the synchronous communication message queue name storage area is 0.
+ if (0 == size) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ snprintf(invokerName, size - 1, "%s_r0", source);
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus McForward(HANDLE hMessage, PCSTR source, UI_32 iCmd, TMemID USID) {
+ // check if handle is valid
+ if (mqCheckValidHandle(hMessage) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // check if the source is null
+ if (source == NULL) {
+ return eFrameworkunifiedStatusInvldQName;
+ }
+
+ // check the shared memory id
+ if (USID == BAD_MEM_ID) {
+ return eFrameworkunifiedStatusErrOther;
+ }
+
+ // check if the source length exceeds than expected
+ if (strlen(source) >= MAX_QUEUE_NAME_SIZE) {
+ return eFrameworkunifiedStatusInvldQName;
+ }
+
+ UI_8 sndBuf[ MAX_QUEUE_MSG_SIZE ] = {};
+ SQhandle *sndHndl = (SQhandle *)hMessage;
+ SSystemMsgHeader msgHdr = {};
+
+ // check if the dest length exceeds than expected
+ if (strlen(sndHndl->q_name) >= MAX_QUEUE_NAME_SIZE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // compose header
+ strlcpy(msgHdr.info.source, source, sizeof(msgHdr.info.source));
+ msgHdr.info.length = GetLengthOfDataFromShared(USID); // this is length of the messages data...
+ msgHdr.info.command = iCmd;
+ msgHdr.eType = (UI_32)(MC_EMSGT_VALID_TOKEN | MC_EMSGT_SHM_MASK);
+ msgHdr.memId = USID;
+ msgHdr.info.sessionid = 0;
+
+ // copy to buffer
+ UI_8 offset = sizeof(SSystemMsgHeader);
+ // write header to send buffer
+ memcpy(&sndBuf[0], &msgHdr, offset);
+
+ return SendMessage(hMessage, MAX_QUEUE_MSG_SIZE, (PVOID)&sndBuf[0]);
+}
+
+PCSTR McGetMsgSrc(PVOID data) {
+ // check if buffer is null
+ if (data == NULL) {
+ return NULL; // The data is invalid return zero length.
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ return (PCSTR)sysHdr->info.source;
+}
+
+UI_32 mcGetMsgSsessionId(PVOID data) {
+ // check if buffer is null
+ if (data == NULL) {
+ return 0; // The data is invalid return zero.
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ return sysHdr->info.sessionid;
+}
+
+UI_32 McGetLength(PVOID data) {
+ // check if buffer is null
+ if (data == NULL) {
+ return 0; // The data is invalid return zero length.
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ return sysHdr->info.length;
+}
+
+PVOID McGetDataPointer(PVOID data) {
+ if (data == NULL) {
+ return NULL;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ int offset = sizeof(SSystemMsgHeader);
+
+ if (MC_EMSGT_HAS_SYSINFO(sysHdr->eType)) {
+ offset += (int)sizeof(TSysMsgSystemInfo);
+ }
+
+ return (PVOID)((long)data + offset);
+}
+
+EFrameworkunifiedStatus McGetSysInfoData(PVOID data, PVOID to) {
+ // check if buffers are null
+ if (data == NULL || to == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ if (MC_EMSGT_VALID((int)sysHdr->eType)) {
+ if (MC_EMSGT_HAS_SYSINFO(sysHdr->eType)) {
+ strlcpy(to, (char *)data + sizeof(SSystemMsgHeader), MAX_SYS_INFO_SIZE);
+ } else {
+ *(char *)to = '\0';
+ }
+ return eFrameworkunifiedStatusOK;
+ }
+
+ return eFrameworkunifiedStatusInvldHandle;
+}
+
+EFrameworkunifiedStatus McGetDataOfSize(PVOID data, PVOID to, UI_32 uiSize) {
+ if (McGetLength(data) > uiSize) {
+ return eFrameworkunifiedStatusInvldBufSize;
+ }
+ return GetData(data, to, FALSE);
+}
+
+EFrameworkunifiedStatus McGetDataOfSizeWithSMRetain(PVOID data, PVOID to, UI_32 uiSize) {
+ if (McGetLength(data) > uiSize) {
+ return eFrameworkunifiedStatusInvldBufSize;
+ }
+ return GetData(data, to, TRUE);
+}
+
+BOOL mcGetIsTypeOfSync(PVOID data) {
+ if (data == NULL) {
+ return FALSE;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+
+ if (MC_EMSGT_VALID((int)sysHdr->eType)) {
+ if (MC_EMSGT_IS_SYNC(sysHdr->eType)) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+EFrameworkunifiedStatus McClearData(PVOID data) {
+ // check if buffers are null
+ if (data == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+
+ if (MC_EMSGT_VALID((int)sysHdr->eType)) {
+ if (MC_EMSGT_IS_SHM(sysHdr->eType)) {
+ return DiscardDataFromShared(sysHdr->memId);
+ } else {
+ return eFrameworkunifiedStatusOK;
+ }
+ }
+
+ return eFrameworkunifiedStatusInvldParam;
+}
+
+EFrameworkunifiedStatus McClose(HANDLE hMessage) {
+ EFrameworkunifiedStatus rtnStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != hMessage) {
+ EQType qType = GetQueueType(hMessage);
+
+ if (eQTypeSender == qType) {
+ rtnStatus = CloseSender(hMessage);
+ } else if (eQTypeReveiver == qType) {
+ rtnStatus = CloseReceiver(hMessage);
+ }
+ }
+
+ return rtnStatus;
+}
+
+
+void McFlushReceiver(HANDLE hMessage) {
+ if (hMessage != INVALID_HANDLE) {
+ // proxy to the real function in msg queue
+ Flush(hMessage);
+ }
+}
+
+TMemID McGetDataUSID(PVOID pData) {
+ // check if buffer is null
+ if (pData == NULL) {
+ return BAD_MEM_ID;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)pData;
+
+ if (MC_EMSGT_VALID((int)sysHdr->eType)) {
+ if (MC_EMSGT_IS_SHM(sysHdr->eType)) {
+ return sysHdr->memId;
+ } else {
+ return BAD_MEM_ID;
+ }
+ }
+
+ return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetData
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetData(PVOID data, PVOID to, BOOL retain) {
+ EFrameworkunifiedStatus rtnStatus = eFrameworkunifiedStatusInvldHandle;
+
+ // check if buffers are null
+ if (data == NULL || to == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ int offset = sizeof(SSystemMsgHeader);
+
+ if (MC_EMSGT_VALID((int)sysHdr->eType)) {
+ if (MC_EMSGT_HAS_SYSINFO(sysHdr->eType)) {
+ offset += (int)sizeof(TSysMsgSystemInfo);
+ }
+
+ if (MC_EMSGT_IS_SHM(sysHdr->eType)) {
+ // need to get the message from shared memory
+
+ // get the length based on the memId
+ UI_32 shmLength = GetLengthOfDataFromShared(sysHdr->memId);
+ /*
+ * todo
+ * When a eFrameworkunifiedStatusInvldID error occurs in GetDataFromShared, the abnormal values are also returned in eFrameworkunifiedStatusErrOther.
+ */
+ if (0 != shmLength && eFrameworkunifiedStatusOK == GetDataFromShared(sysHdr->memId, to, shmLength)) {
+ if (!retain) {
+ // now that the data has been retrieved we may now discard it.
+ McClearData(data);
+ }
+ rtnStatus = eFrameworkunifiedStatusOK;
+ } else {
+ rtnStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ // memcpy the data to the buffer provided.
+ memcpy(to, (PVOID)((long)data + offset), sysHdr->info.length);
+ rtnStatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ rtnStatus = eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ return rtnStatus;
+}
+
+PCSTR McGetQueueName(HANDLE hMessage) {
+ PCSTR name = NULL;
+
+ if (NULL != hMessage) {
+ name = GetQueueName(hMessage);
+ }
+
+ return name;
+}
+
+int McGetQueueFD(HANDLE hMessage) {
+ int fd = -1;
+
+ if (NULL != hMessage) {
+ fd = GetQueueFD(hMessage);
+ }
+
+ return fd;
+}
+
+EFrameworkunifiedStatus McTranslateError(int error) {
+ return TranslateError(error);
+}
+
+EFrameworkunifiedStatus McZcSetParam(HANDLE handle, UI_32 cmd, UI_32 length) {
+ if (handle == NULL) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ SQhandle *sndHndl = (SQhandle *)handle;
+ SSystemMsgHeader *msgHdr = (SSystemMsgHeader *)(sndHndl->sendbuf);
+
+ // QueueType checking
+ EQType qType = GetQueueType(handle);
+ if (eQTypeSender != qType) {
+ return eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ if (mqCheckValidHandle(handle) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+ if (sndHndl->sendbuf == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+ if (length > (MAX_QUEUE_MSG_SIZE - sizeof(SSystemMsgHeader))) {
+ return eFrameworkunifiedStatusInvldBufSize;
+ }
+
+ msgHdr->info.command = cmd;
+ msgHdr->info.length = length;
+ return eFrameworkunifiedStatusOK;
+}
+
+PVOID McZcGetBuf(HANDLE handle) {
+ if (handle == NULL) {
+ return NULL;
+ }
+
+ SQhandle *sndHndl = (SQhandle *)handle;
+
+ // QueueType checking
+ EQType qType = GetQueueType(handle);
+ if (eQTypeSender != qType) {
+ return NULL;
+ }
+
+ if (mqCheckValidHandle(handle) == FALSE) {
+ return NULL;
+ }
+ if (sndHndl->sendbuf == NULL) {
+ return NULL;
+ }
+ return (char *)(sndHndl->sendbuf) + sizeof(SSystemMsgHeader);
+}
+
+EFrameworkunifiedStatus McZcSend(HANDLE hMessage) {
+ if (hMessage == NULL) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // QueueType checking
+ EQType qType = GetQueueType(hMessage);
+ if (eQTypeSender != qType) {
+ return eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ SQhandle *sndHndl = (SQhandle *)hMessage;
+
+ SSystemMsgHeader *msgHdr = (SSystemMsgHeader *)(sndHndl->sendbuf);
+
+ if (mqCheckValidHandle(hMessage) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+ if (sndHndl->sendbuf == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ return SendMessageWithPriority(hMessage, (UI_32)(msgHdr->info.length + sizeof(SSystemMsgHeader)), sndHndl->sendbuf,
+ eFrameworkunifiedMsgPrioNormal);
+}
+
+HANDLE McZcOpenSender(PCSTR source) {
+ HANDLE handle = openSenderZc(source);
+
+ if (handle != NULL) {
+ SQhandle *sndHndl = (SQhandle *)handle;
+ SSystemMsgHeader *msgHdr = (SSystemMsgHeader *)(sndHndl->sendbuf);
+
+ strlcpy(msgHdr->info.source, source, sizeof(msgHdr->info.source));
+ msgHdr->info.command = 0;
+ msgHdr->info.length = 0;
+ msgHdr->info.sessionid = 0;
+ msgHdr->eType = (UI_32)MC_EMSGT_VALID_TOKEN;
+ msgHdr->memId = 0;
+ }
+
+ return handle;
+}
+
+EFrameworkunifiedStatus McZcClose(HANDLE handle) {
+ return CloseSender(handle);
+}
diff --git a/nsframework/framework_unified/client/NS_MessageQueue/cfg/depends.mk b/nsframework/framework_unified/client/NS_MessageQueue/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageQueue/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_anomaly.h b/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_anomaly.h
new file mode 100755
index 0000000..5b02e2b
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_anomaly.h
@@ -0,0 +1,35 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_ANOMALY_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_ANOMALY_H_
+
+#include <native_service/frameworkunified_types.h>
+
+typedef struct {
+ CHAR name[18];
+ UI_32 maxMsg;
+} mq_anomaly_t;
+
+mq_anomaly_t mq_anomaly_list[] = {
+ { "/NS_NPPService", 256 },
+ { "/NS_NPPWriteWkr", 256 },
+ { "/NS_NPPReadWkr", 256 },
+ { "/NS_NPPIPWkr", 256 },
+ { "/audio_app", 256 },
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_ANOMALY_H_
diff --git a/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_internal.h b/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_internal.h
new file mode 100755
index 0000000..ca02218
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_internal.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageQueue
+/// \brief API Header for Logger.
+///
+/// Declares the external APIs to Logger.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_INTERNAL_H_
+
+/////////////////////////////////////////
+#include <pthread.h>
+/////////////////////////////////////////
+
+
+/// \brief Struct that defines internal handle object
+typedef struct tQHandle {
+ UI_32 check_code;
+ SI_32 fd;
+ PSTR q_name;
+ EQType q_type;
+ void *sendbuf;
+
+ /////////////////////////////////////////
+ pthread_t threadid; // thread id of child thread (may be NULL)
+ /////////////////////////////////////////
+} SQhandle;
+
+#define MQ_CHECK_CODE (0xC0D1F1ED)
+
+static inline BOOL mqCheckValidHandle(HANDLE hMessage) {
+ if (INVALID_HANDLE != hMessage) {
+ SQhandle *sndHndl = (SQhandle *)hMessage; // NOLINT (readability/nolint)
+ if (sndHndl->check_code == MQ_CHECK_CODE) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_MessageQueue/include/ns_msg_queue.h b/nsframework/framework_unified/client/NS_MessageQueue/include/ns_msg_queue.h
new file mode 100755
index 0000000..111b5be
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageQueue/include/ns_msg_queue.h
@@ -0,0 +1,295 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_msg_queue.h
+ * @brief \~english TestFramework provides interface for implementing functional test classes.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MSG_QUEUE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MSG_QUEUE_H_
+
+#include <native_service/frameworkunified_types.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// \brief Enum that defines the value Q Types
+typedef enum eQType {
+ eQTypeReveiver,
+ eQTypeSender,
+ eQTypeInvld
+} EQType;
+
+// PASA CCR IPC Framework API
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// OpenReceiver
+/// The opens a handle to a Receiver message queue.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+///
+/// \return HANDLE
+/// handle - to a recevier's message queue
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE OpenReceiver(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// OpenReceiverNotBlocked
+/// The opens a handle to a Receiver message queue. Operations on this queue
+/// are non-blocking if queue is empty or full.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+///
+/// \return HANDLE
+/// handle - to a recevier's message queue
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE OpenReceiverNotBlocked(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// OpenSyncReceiver
+/// The opens a handle to a response Receiver message queue.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+///
+/// \return HANDLE
+/// handle - to a recevier's message queue
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE openSyncReceiver(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// OpenSender
+/// The opens a handle for sending messages to another message queue.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to send messages too
+///
+/// \return HANDLE
+/// handle - senders message queue handle
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE OpenSender(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// openSyncSender
+/// The opens a handle for sending response to another message queue.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to send messages too
+///
+/// \return HANDLE
+/// handle - senders message queue handle
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE openSyncSender(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// openSenderZc
+/// The opens a handle for sending response to another message queue.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to send messages too
+///
+/// \return HANDLE
+/// handle - senders message queue handle
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE openSenderZc(PCSTR name);
+
+/////////////////////////////////////////
+#include <pthread.h>
+HANDLE OpenSenderChild(PCSTR name, pthread_t threadid);
+/////////////////////////////////////////
+
+/////////////////////////////////////////
+EFrameworkunifiedStatus JoinChild(HANDLE hChildApp);
+/////////////////////////////////////////
+
+/////////////////////////////////////////
+EFrameworkunifiedStatus GetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio);
+/////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendMessage
+/// The function sends a message to a queue.
+///
+/// \param [in] hMessage
+/// Handle - handle to the sendMessage, OpenSender
+/// \param [in] length
+/// UI_32 - length of the data to be sent
+/// \param [in] data
+/// const void* - pointer to the data that needs to be transmitted
+///
+/// \return EFrameworkunifiedaStatus
+/// status - status of the message(error)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendMessage(HANDLE hMessage, UI_32 length, PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendMessageWithPriority
+/// The function sends a message to a queue.
+///
+/// \param [in] hMessage
+/// Handle - handle to the sendMessage, OpenSender
+/// \param [in] length
+/// UI_32 - length of the data to be sent
+/// \param [in] data
+/// const void* - pointer to the data that needs to be transmitted
+/// \param [in] priority
+/// EFrameworkunifiedMessagePriorties - priority at which the message should be sent at!
+///
+/// \return EFrameworkunifiedaStatus
+/// status - status of the message(error)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendMessageWithPriority(HANDLE hMessage, UI_32 length, PVOID data, EFrameworkunifiedMessagePriorties priority);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ReceiveMessage
+/// The function blocks on a message queue waiting for data to be received.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the recvMessage, OpenReceiver
+/// \param [in] length
+/// UI_32 - length of the data buffer provided
+/// \param [in] data
+/// void* - pointer to the data to be received
+///
+/// \return SI_32
+/// length read - indicates the number of bytes that were read from the queue (eFrameworkunifiedStatusErrOther) error
+////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 ReceiveMessage(HANDLE hMessage, UI_32 length, PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CloseReceiver
+/// The closes a connection to a Receiver message queue.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the recvMessage that will be closed
+///
+/// \return EFrameworkunifiedaStatus
+/// status - indicates if the close was successfully (eFrameworkunifiedStatusOK) or not (anything else)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CloseReceiver(HANDLE handle);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CloseReceiver
+/// The closes a connection to a Receiver message queue.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the recvMessage that will be closed
+///
+/// \return EFrameworkunifiedaStatus
+/// status - indicates if the close was successfully (eFrameworkunifiedStatusOK) or not (anything else)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CloseSender(HANDLE handle);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Flush
+/// Flush all data on HANDLE's Receiver message queue.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the recvMessage queue that will be flushed
+///
+/// \return void
+////////////////////////////////////////////////////////////////////////////////////////////
+void Flush(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetQueueType
+/// Get the handle's queue type.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the Message queue
+///
+/// \return EQType
+/// EQType - queue type of handle
+////////////////////////////////////////////////////////////////////////////////////////////
+EQType GetQueueType(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Function : TranslateError
+// Translates global error variables into FW EFrameworkunifiedStatus
+///
+/// \param [in] error
+/// int - error variable
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - frameworkunified error type
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus TranslateError(int error);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetQueueName
+/// This gets the name of the message queue
+///
+/// \param [in] hMessage
+/// HANDLE - handle of the message queue
+/// (handle created with McOpenReceiver or McOpenSender)
+///
+/// \return PCSTR
+/// name - name of the message queue if handle is valid else NULL
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR GetQueueName(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetQueueFD
+/// This gets the fd of the message queue
+///
+/// \param [in] hMessage
+/// HANDLE - handle of the message queue
+/// (handle created with McOpenReceiver or McOpenSender)
+///
+/// \return int
+/// fd - fd of the message queue if handle is valid else -1
+////////////////////////////////////////////////////////////////////////////////////////////
+int GetQueueFD(HANDLE hMessage);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MSG_QUEUE_H_
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/NS_MessageQueue/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_MessageQueue/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..054db6d
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageQueue/src/makefile_PosixBasedOS001
@@ -0,0 +1,207 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_MessageQueue
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_MessageQueue
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+# mqS is not available for x86
+ifneq ($(TARGET),x86)
+ # Link mqS only to PastModel003*1!
+ ifeq ($(PRODUCT_NAME),PastModel004)
+ STATIC_LIBS += mqS
+ LD_OFLAG := -Wl,-Bsymbolic $(LD_OFLAG)
+ endif
+endif
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/nsframework/framework_unified/client/NS_MessageQueue/src/ns_mq_string.c b/nsframework/framework_unified/client/NS_MessageQueue/src/ns_mq_string.c
new file mode 100755
index 0000000..8749a99
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageQueue/src/ns_mq_string.c
@@ -0,0 +1,60 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <native_service/ns_logger_if.h>
+
+size_t strlcpy(char *dst, const char *src, size_t siz) {
+ if (dst == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "dst is NULL");
+ return 0;
+ }
+ if (src == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "src is NULL");
+ return 0;
+ }
+ size_t ret = strlen(src);
+
+ if (siz) {
+ size_t len = (ret >= siz) ? siz - 1 : ret;
+ memcpy(dst, src, len);
+ dst[len] = '\0';
+ }
+ return ret;
+}
+
+size_t strlcat(char *dst, const char *src, size_t siz) {
+ if (dst == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "dst is NULL");
+ return 0;
+ }
+ if (src == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "src is NULL");
+ return 0;
+ }
+ size_t dsiz = strlen(dst);
+ size_t len = strlen(src);
+ size_t res = dsiz + len;
+
+ dst += dsiz;
+ siz -= dsiz;
+ if (len >= siz) {
+ len = siz - 1;
+ }
+ memcpy(dst, src, len);
+ dst[len] = '\0';
+ return res;
+}
diff --git a/nsframework/framework_unified/client/NS_MessageQueue/src/ns_msg_queue.c b/nsframework/framework_unified/client/NS_MessageQueue/src/ns_msg_queue.c
new file mode 100755
index 0000000..1990061
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_MessageQueue/src/ns_msg_queue.c
@@ -0,0 +1,596 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageQueue
+/// \brief API Header for Zone Player Service APIs to be used by senders and
+/// receivers.
+///
+/// APIs to register/unregister notifications and add/remove recievers to the notifications.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include "ns_msg_queue.h"
+#include <malloc.h>
+#include <mqueue.h>
+#include <ns_mq_internal.h>
+#include <errno.h>
+#include "ns_mq_anomaly.h"
+
+#include <other_service/strlcpy.h>
+#include <other_service/strlcat.h>
+
+const UI_32 DEFAULT_MSG_PRIORITY = 10;
+const UI_32 MAX_MESSAGES_STORED_IN_QUEUE = 256;
+const UI_32 MAX_SYNC_RESPONSE_STORED_IN_QUEUE = 2;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : TranslateError
+// Translates global error variables into FW EFrameworkunifiedStatus
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus TranslateError(int error) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ switch (error) {
+ case EOK:
+ eStatus = eFrameworkunifiedStatusOK;
+ break;
+ case EBUSY:
+ eStatus = eFrameworkunifiedStatusThreadBusy;
+ break;
+ case EDEADLK:
+ eStatus = eFrameworkunifiedStatusThreadSelfJoin;
+ break;
+ case EFAULT:
+ eStatus = eFrameworkunifiedStatusFault;
+ break;
+ case EINVAL:
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ case ESRCH:
+ eStatus = eFrameworkunifiedStatusThreadNotExist;
+ break;
+ case EBADF:
+ eStatus = eFrameworkunifiedStatusErrNoEBADF;
+ break;
+ case EAGAIN:
+ eStatus = eFrameworkunifiedStatusErrNoEAGAIN;
+ break;
+ case EINTR:
+ eStatus = eFrameworkunifiedStatusErrNoEINTR;
+ break;
+ case EMSGSIZE:
+ eStatus = eFrameworkunifiedStatusInvldBufSize;
+ break;
+ case ENOTSUP:
+ eStatus = eFrameworkunifiedStatusNotImplemented;
+ break;
+ case EPERM:
+ eStatus = eFrameworkunifiedStatusAccessError;
+ break;
+ default:
+ eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+
+ return eStatus;
+}
+
+static UI_8 GetNormalizedMqName(PSTR normalized_mqname , PCSTR name, size_t size) {
+ if ((NULL != name) && (NULL != normalized_mqname)) {
+ if (name[0] != '/') {
+ strlcpy(normalized_mqname, "/", size);
+ strlcat(normalized_mqname, name, size);
+ } else {
+ strlcpy(normalized_mqname, name, size);
+ }
+
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+HANDLE OpenReceiverNotBlocked(PCSTR name) {
+ HANDLE rtnHandle = INVALID_HANDLE; // invalid until made valid.
+ PSTR normalized_qname = NULL;
+ SI_32 q_fd = -1; // fd to mqueue
+ SQhandle *rcvHndl = NULL;
+ struct mq_attr mqattr;
+ size_t norm_qname_size = 0;
+
+ // Check for invalid name
+ if (name == NULL) {
+ return INVALID_HANDLE;
+ }
+
+ if (strlen(name) >= MAX_QUEUE_NAME_SIZE) {
+ return INVALID_HANDLE;
+ }
+
+ norm_qname_size = strlen(name) + 2;
+ normalized_qname = (PSTR)malloc(norm_qname_size);
+
+ if (0 != GetNormalizedMqName(normalized_qname, name, norm_qname_size)) {
+ if (strlen(normalized_qname) > LIMIT_QUEUE_NAME_SIZE) {
+ free(normalized_qname);
+ return INVALID_HANDLE;
+ }
+
+ mqattr.mq_flags = 0;
+ mqattr.mq_maxmsg = (__syscall_slong_t)MAX_MESSAGES_STORED_IN_QUEUE;
+ mqattr.mq_msgsize = MAX_QUEUE_MSG_SIZE;
+
+ q_fd = mq_open(normalized_qname, O_RDONLY | O_CREAT | O_NONBLOCK | O_CLOEXEC , 0666, &mqattr);
+
+ if (q_fd != -1) {
+ rcvHndl = (SQhandle *)malloc(sizeof(SQhandle));
+ if (rcvHndl != NULL) {
+ rcvHndl->check_code = MQ_CHECK_CODE;
+ rcvHndl->fd = q_fd;
+ rcvHndl->q_name = normalized_qname;
+ rcvHndl->q_type = eQTypeReveiver;
+
+ /////////////////////////////////////////
+ rcvHndl->threadid = 0;
+ /////////////////////////////////////////
+
+ // Set the return handle to rcvHndl
+ rtnHandle = rcvHndl;
+ }
+ }
+ }
+
+ if (INVALID_HANDLE == rtnHandle) {
+ // couldn't connect the queue,
+ // release the memory to normalized queue name
+ if (normalized_qname != NULL) {
+ free(normalized_qname);
+ normalized_qname = NULL; // mb20110108 item 11
+ }
+ }
+
+ return rtnHandle;
+}
+
+static HANDLE openReceiverInternal(PCSTR name, UI_32 mq_maxmsg, UI_32 mq_msgsize, BOOL is_internal) {
+ HANDLE rtnHandle = INVALID_HANDLE; // invalid until made valid.
+ PSTR normalized_qname = NULL;
+ SI_32 q_fd = -1; // fd to mqueue
+ SQhandle *rcvHndl = NULL;
+ struct mq_attr mqattr;
+ size_t norm_qname_size = 0;
+
+ // Check for invalid name
+ if (name == NULL) {
+ return INVALID_HANDLE;
+ }
+
+ if (strlen(name) >= MAX_QUEUE_NAME_SIZE) {
+ return INVALID_HANDLE;
+ }
+
+ norm_qname_size = strlen(name) + 2;
+ normalized_qname = (PSTR)malloc(norm_qname_size);
+
+ if (0 != GetNormalizedMqName(normalized_qname, name, norm_qname_size)) {
+ int i;
+
+ if (!is_internal && strlen(normalized_qname) > LIMIT_QUEUE_NAME_SIZE) {
+ free(normalized_qname);
+ return INVALID_HANDLE;
+ }
+
+ mqattr.mq_flags = 0;
+ mqattr.mq_maxmsg = (__syscall_slong_t)mq_maxmsg;
+ mqattr.mq_msgsize = (__syscall_slong_t)mq_msgsize;
+
+ for (i = 0; i < (sizeof(mq_anomaly_list) / sizeof(mq_anomaly_list[0])); i++) {
+ if (strcmp(normalized_qname, mq_anomaly_list[i].name) == 0) {
+ mqattr.mq_maxmsg = (__syscall_slong_t)mq_anomaly_list[i].maxMsg;
+ break;
+ }
+ }
+
+
+ q_fd = mq_open(normalized_qname, O_RDONLY | O_CREAT | O_CLOEXEC, 0666, &mqattr);
+
+ if (q_fd != -1) {
+ rcvHndl = (SQhandle *)malloc(sizeof(SQhandle));
+ if (rcvHndl != NULL) {
+ rcvHndl->check_code = MQ_CHECK_CODE;
+ rcvHndl->fd = q_fd;
+ rcvHndl->q_name = normalized_qname;
+ rcvHndl->q_type = eQTypeReveiver;
+
+ /////////////////////////////////////////
+ rcvHndl->threadid = 0;
+ /////////////////////////////////////////
+
+ // Set the return handle to rcvHndl
+ rtnHandle = rcvHndl;
+ }
+
+ }
+ }
+
+ if (INVALID_HANDLE == rtnHandle) {
+ // couldn't connect the queue,
+ // release the memory to normalized queue name
+ if (normalized_qname != NULL) {
+ free(normalized_qname);
+ normalized_qname = NULL; // mb20110108 item 11
+ }
+ }
+
+ return rtnHandle;
+}
+
+HANDLE OpenReceiver(PCSTR name) {
+ return openReceiverInternal(name, MAX_MESSAGES_STORED_IN_QUEUE, MAX_QUEUE_MSG_SIZE, FALSE);
+}
+
+HANDLE openSyncReceiver(PCSTR name) {
+ return openReceiverInternal(name, MAX_SYNC_RESPONSE_STORED_IN_QUEUE , MAX_QUEUE_MSG_SIZE, TRUE);
+}
+
+static HANDLE openSenderInternal(PCSTR name, UI_32 mq_maxmsg, UI_32 mq_msgsize, BOOL is_internal, BOOL zero_copy) {
+ HANDLE rtnHandle = INVALID_HANDLE; // invalid until made valid.
+ SI_32 q_fd = -1; // fd to queue
+ SQhandle *sndHndl = NULL;
+ PSTR normalized_qname = NULL;
+ size_t norm_qname_size = 0;
+
+ struct mq_attr mqattr;
+
+ // Check for invalid name
+ if (name == NULL) {
+ return rtnHandle;
+ }
+
+ if (strlen(name) >= MAX_QUEUE_NAME_SIZE) {
+ return rtnHandle;
+ }
+
+ norm_qname_size = strlen(name) + 2;
+ normalized_qname = (PSTR)malloc(norm_qname_size);
+
+ if (NULL == normalized_qname) {
+ return rtnHandle;
+ }
+
+ if (0 != GetNormalizedMqName(normalized_qname, name, norm_qname_size)) {
+ int i;
+
+
+ if (!is_internal && strlen(normalized_qname) > LIMIT_QUEUE_NAME_SIZE) {
+ free(normalized_qname);
+ return INVALID_HANDLE;
+ }
+
+ mqattr.mq_flags = 0;
+ mqattr.mq_maxmsg = (__syscall_slong_t)mq_maxmsg;
+ mqattr.mq_msgsize = (__syscall_slong_t)mq_msgsize;
+
+ for (i = 0; i < (sizeof(mq_anomaly_list) / sizeof(mq_anomaly_list[0])); i++) {
+ if (strcmp(normalized_qname, mq_anomaly_list[i].name) == 0) {
+ mqattr.mq_maxmsg = (__syscall_slong_t)mq_anomaly_list[i].maxMsg;
+ break;
+ }
+ }
+
+ q_fd = mq_open(normalized_qname, O_WRONLY | O_CREAT | O_NONBLOCK | O_CLOEXEC, 0666, &mqattr);
+
+ if (q_fd != -1) {
+ sndHndl = (SQhandle *)malloc(sizeof(SQhandle));
+ if (NULL != sndHndl) {
+ sndHndl->check_code = MQ_CHECK_CODE;
+ sndHndl->fd = q_fd;
+ sndHndl->q_name = normalized_qname;
+ sndHndl->q_type = eQTypeSender;
+
+ sndHndl->threadid = 0;
+
+
+ // Set the return handle to sndHndl
+ rtnHandle = sndHndl;
+
+ if (zero_copy) {
+ sndHndl->sendbuf = malloc(MAX_QUEUE_MSG_SIZE);
+ if (sndHndl->sendbuf == NULL) {
+ // LCOV_EXCL_START 5: malloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ free(sndHndl);
+ rtnHandle = INVALID_HANDLE;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ sndHndl->sendbuf = NULL;
+ }
+ }
+ }
+ }
+
+ if (INVALID_HANDLE == rtnHandle) {
+ // couldn't connect the queue,
+ // release the memory to normalized queue name
+ if (normalized_qname != NULL) {
+ free(normalized_qname);
+ normalized_qname = NULL; // mb20110108 item 11
+ }
+ if (q_fd != -1) {
+ mq_close(q_fd);
+ }
+ }
+
+ return rtnHandle; // invalid until made valid.
+}
+
+HANDLE OpenSender(PCSTR name) {
+ return openSenderInternal(name, MAX_MESSAGES_STORED_IN_QUEUE, MAX_QUEUE_MSG_SIZE, FALSE, FALSE);
+}
+
+
+HANDLE OpenSenderChild(PCSTR name, pthread_t threadid) {
+ HANDLE h = OpenSender(name);
+ if (INVALID_HANDLE != h) {
+ SQhandle *sq = (SQhandle *)h;
+ sq->threadid = threadid;
+ }
+ return h;
+}
+
+
+HANDLE openSyncSender(PCSTR name) {
+ return openSenderInternal(name, MAX_SYNC_RESPONSE_STORED_IN_QUEUE, MAX_QUEUE_MSG_SIZE, TRUE, FALSE);
+}
+
+HANDLE openSenderZc(PCSTR name) {
+ return openSenderInternal(name, MAX_MESSAGES_STORED_IN_QUEUE, MAX_QUEUE_MSG_SIZE, FALSE, TRUE);
+}
+
+
+EFrameworkunifiedStatus JoinChild(HANDLE hChildApp) {
+ // mb20110108 Code re-structured per comments 24 & 25
+ if (mqCheckValidHandle(hChildApp)) {
+ SQhandle *sq = (SQhandle *)hChildApp;
+ return TranslateError(pthread_join(sq->threadid, NULL));
+ } else {
+ return eFrameworkunifiedStatusFail;
+ }
+}
+
+EFrameworkunifiedStatus GetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 6:GetChildThreadPriority is called by McGetChildThreadPriority, and hChildApp will check there.
+ if (mqCheckValidHandle(hChildApp)) {
+ // LCOV_EXCL_BR_STOP
+ SQhandle *sq = (SQhandle *)hChildApp;
+ SI_32 schedPolicy; // this is needed according to syntax of pthread_getschedparam. api not available to get prio directly.
+ struct sched_param schedParam;
+ eStatus = TranslateError(pthread_getschedparam(sq->threadid, &schedPolicy, &schedParam));
+
+ *threadPrio = schedParam.sched_priority;
+ } else {
+ // LCOV_EXCL_START 6:GetChildThreadPriority is called by McGetChildThreadPriority, and hChildApp will check there.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+ return eStatus;
+}
+
+/// endhack...
+/////////////////////////////////////////
+
+EFrameworkunifiedStatus SendMessage(HANDLE hMessage, UI_32 length, PVOID data) {
+ return SendMessageWithPriority(hMessage, length, data, eFrameworkunifiedMsgPrioNormal);
+}
+
+EFrameworkunifiedStatus SendMessageWithPriority(HANDLE hMessage, UI_32 length, PVOID data, EFrameworkunifiedMessagePriorties priority) {
+ // define a Q handle structure
+ SQhandle *sndHndl = NULL;
+
+ // mb20110108 Added per comments 27 & 28
+ if (length > 0 && NULL == data) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ // check handle for null case...
+ if (mqCheckValidHandle(hMessage) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ sndHndl = (SQhandle *)hMessage;
+
+ // check to see if this is a sender handle
+ if (sndHndl->q_type != eQTypeSender) {
+ return eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ if (-1 == mq_send((mqd_t)sndHndl->fd, (PCSTR)data, (size_t)length, (unsigned int)priority)) {
+ if (errno == EAGAIN) {
+ return eFrameworkunifiedStatusMsgQFull;
+ } else {
+ return TranslateError(errno);
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+SI_32 ReceiveMessage(HANDLE hMessage, UI_32 length, PVOID data) {
+ // define a Q handle structure
+ SQhandle *rcvHndl = NULL;
+
+ // check handle for null case...
+ if (mqCheckValidHandle(hMessage) == FALSE) {
+ errno = ENODATA;
+ return -1;
+ }
+
+ rcvHndl = (SQhandle *)hMessage;
+
+ // check to see if this is a receiver handle
+ if (rcvHndl->q_type != eQTypeReveiver) {
+ errno = ENODATA;
+ return -1;
+ }
+
+
+ return (SI_32)mq_receive((mqd_t)rcvHndl->fd, (char *)data, (size_t)length, NULL);
+}
+
+EFrameworkunifiedStatus CloseReceiver(HANDLE handle) {
+ SQhandle *rcvHndl = NULL;
+ SI_32 q_fd;
+
+ // check handle for null case...
+ if (mqCheckValidHandle(handle) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ rcvHndl = (SQhandle *)handle;
+
+ // check to see if this is a receiver handle
+ if (rcvHndl->q_type != eQTypeReveiver) {
+ return eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ rcvHndl->check_code = 0;
+ q_fd = rcvHndl->fd;
+
+ if (NULL != rcvHndl->q_name) {
+ free(rcvHndl->q_name); // remove the memory to the name
+ rcvHndl->q_name = NULL;
+ }
+ free((void *)handle); // remove handle.. now..
+ handle = INVALID_HANDLE;
+
+ return ((-1 == mq_close((mqd_t)q_fd)) ? eFrameworkunifiedStatusInvldHandle : eFrameworkunifiedStatusOK);
+}
+
+EFrameworkunifiedStatus CloseSender(HANDLE handle) {
+ SQhandle *sndHndl = NULL;
+ SI_32 q_fd;
+
+ // check handle for null case...
+ if (mqCheckValidHandle(handle) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ sndHndl = (SQhandle *)handle;
+
+ // check to see if this is a sender handle
+ if (sndHndl->q_type != eQTypeSender) {
+ return eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ sndHndl->check_code = 0;
+ q_fd = sndHndl->fd; // copy the fd, need it to close the queues....
+
+ if (NULL != sndHndl->q_name) {
+ free(sndHndl->q_name); // remove the memory to the name
+ sndHndl->q_name = NULL;
+ }
+ if (NULL != sndHndl->sendbuf) {
+ free(sndHndl->sendbuf);
+ sndHndl->sendbuf = NULL;
+ }
+ free((void *)handle); // remove handle.. now..
+ handle = INVALID_HANDLE; // invalidate handle so user doesn't reuse...
+
+ return (-1 == mq_close((mqd_t)q_fd)) ? eFrameworkunifiedStatusInvldHandle : eFrameworkunifiedStatusOK;
+}
+
+static UI_8 IsMessageAvailable(SI_32 fd) {
+ struct mq_attr sMqStatus;
+ if (-1 == mq_getattr(fd, &sMqStatus)) {
+ // Error Detected.
+ return 0;
+ } else {
+ if (0 < sMqStatus.mq_curmsgs) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+}
+
+void Flush(HANDLE hMessage) {
+ SQhandle *rcvHndl = NULL;
+
+ if (mqCheckValidHandle(hMessage)) {
+ rcvHndl = (SQhandle *)hMessage;
+
+ if (rcvHndl->q_type != eQTypeReveiver) {
+ return;
+ }
+
+ // check there is anything on the queue before going into the loop....
+ if (IsMessageAvailable(rcvHndl->fd)) {
+ CHAR l_pReceiveBuffer_o[MAX_QUEUE_MSG_SIZE];
+
+ // read till there isn't anything on the queue.
+ while (IsMessageAvailable(rcvHndl->fd)) {
+ mq_receive((mqd_t)rcvHndl->fd, l_pReceiveBuffer_o, (size_t)MAX_QUEUE_MSG_SIZE, NULL);
+ }
+ }
+ }
+}
+
+EQType GetQueueType(HANDLE hMessage) {
+ EQType qType = eQTypeInvld;
+
+ if (mqCheckValidHandle(hMessage)) {
+ SQhandle *handle = (SQhandle *)hMessage;
+ qType = handle->q_type;
+ }
+
+ return qType;
+}
+
+PCSTR GetQueueName(HANDLE hMessage) {
+ PCSTR name = NULL;
+
+ if (mqCheckValidHandle(hMessage)) {
+ SQhandle *hMsgQ = (SQhandle *)hMessage;
+
+ if (hMsgQ->q_type == eQTypeSender ||
+ hMsgQ->q_type == eQTypeReveiver) {
+ name = hMsgQ->q_name;
+ }
+ }
+
+ return name;
+}
+
+int GetQueueFD(HANDLE hMessage) {
+ int fd = -1;
+
+ if (mqCheckValidHandle(hMessage)) {
+ SQhandle *hMsgQ = (SQhandle *)hMessage;
+
+ if (hMsgQ->q_type == eQTypeSender ||
+ hMsgQ->q_type == eQTypeReveiver) {
+ fd = hMsgQ->fd;
+ }
+ }
+
+ return fd;
+}
diff --git a/nsframework/framework_unified/client/NS_NPServiceIf/cfg/depends.mk b/nsframework/framework_unified/client/NS_NPServiceIf/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_NPServiceIf/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_NPServiceIf/include/ns_np_service_internal.h b/nsframework/framework_unified/client/NS_NPServiceIf/include/ns_np_service_internal.h
new file mode 100755
index 0000000..469b4c0
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_NPServiceIf/include/ns_np_service_internal.h
@@ -0,0 +1,75 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_np_service_internal.h
+ * @brief \~english TestFramework provides interface for implementing functional test classes.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_INTERNAL_H_
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendStopToNSNPP
+/// To be used by System Manager Service only. This API would push NPP Service to persist
+/// the data/files. Ideally this should be sent during system shutdown by System Manager Service
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of the requesters message queue
+/// \param [in] eShutdownType
+/// EFrameworkunifiedShutdownType - shutdown type
+/// \param [in] uiStopMsgData
+/// UI_32 - Flag representing which data to persist and which data to delete
+/// from persistent memory
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendStopToNSNPP(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedShutdownType eShutdownType, UI_32 uiStopMsgData);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_INTERNAL_H_
+/** @}*/
+/** @}*/
+/** @}*/
+
+// EOF
diff --git a/nsframework/framework_unified/client/NS_NPServiceIf/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_NPServiceIf/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..cbfc140
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_NPServiceIf/src/makefile_PosixBasedOS001
@@ -0,0 +1,208 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_NPServiceIf
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_NPServiceIf
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_UtilityCenter/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+ifdef DYNAMIC
+ DYNAMIC_LIBS += \
+ NS_MessageCenter$(DEBUG_EXT)
+else
+ STATIC_LIBS +=
+endif
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_api.c b/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_api.c
new file mode 100755
index 0000000..d41514d
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_api.c
@@ -0,0 +1,1001 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPService
+/// \brief APIs to be used by clients while invoking Notification Service.
+///
+/// Implementation of APIs for Publishers and Subscribers of notifications.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_mc_system_info.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <limits.h>
+#include <other_service/strlcpy.h>
+
+// define user name as blank for global persistence file
+#define GLOBAL_PERSISTENCE ""
+
+// this is the maximum number of notifications that can be registered/ unregistered at once
+const UI_32 maxNotification = UINT_MAX / sizeof(NC_register_notif_msg);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPRegisterNotifications
+/// API to send message to Notification Service to register a set of notifications
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] numNotifications
+/// PCSTR - Name of Notification
+/// \param [in] pNotificationArray
+/// NotificationInfo - Array of notifications
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ NotificationInfo *pNotificationArray) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (maxNotification < numNotifications) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ size_t sizeOfMsg = (sizeof(NC_register_notif_msg) * numNotifications) + sizeof(UI_32);
+ if (NULL == pNotificationArray) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ PCHAR *pMsgBuffer = (PCHAR *)malloc(sizeOfMsg);
+
+ if (NULL == pMsgBuffer) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ NC_register_multiple_notif_msg *pNotifMsg = (NC_register_multiple_notif_msg *)pMsgBuffer;
+
+ pNotifMsg->numNotifications = numNotifications;
+ memcpy(&pNotifMsg->notifierList[0], pNotificationArray, sizeof(NC_register_notif_msg) * numNotifications);
+
+ for(UI_32 i = 0; i < numNotifications; i++) {
+ // Insert \0 at the end of character (up to 64bytes) by copying with strlcpy.
+ strlcpy(pNotifMsg->notifierList[i].notificationName,
+ pNotificationArray[i].notificationName,
+ sizeof(pNotificationArray[i].notificationName));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_REGISTER_EV_REQ, (UI_32)sizeOfMsg, (PVOID)pNotifMsg) ;
+
+ free(pMsgBuffer);
+ pMsgBuffer = NULL;
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPUnRegisterNotifications
+/// API to send message to Notification Service to remove a set of notifications
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] numNotifications
+/// PCSTR - Name of Notification
+/// \param [in] pNotificationArray
+/// NotificationInfo - Array of notifications
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnRegisterNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ NotificationInfo *pNotificationArray) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (maxNotification < numNotifications) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ size_t sizeOfMsg = (sizeof(NC_unregister_notif_msg) * numNotifications) + sizeof(UI_32);
+ UI_32 i = 0;
+ if (NULL == pNotificationArray) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ PCHAR *pMsgBuffer = (PCHAR *)malloc(sizeOfMsg);
+
+ if (NULL == pMsgBuffer) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ NC_unregister_multiple_notif_msg *pNotifMsg = (NC_unregister_multiple_notif_msg *)pMsgBuffer;
+
+ pNotifMsg->numNotifications = numNotifications;
+
+ for (i = 0; i < numNotifications; ++i) {
+ strlcpy(pNotifMsg->notificationList[i].notificationName, pNotificationArray[i].notificationName,
+ sizeof(pNotifMsg->notificationList[i].notificationName));
+ }
+
+ // mb20110110 Fixed issue 135
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_UNREGISTER_EV_REQ, (UI_32)sizeOfMsg, (VOID *)pMsgBuffer) ;
+
+ free(pMsgBuffer);
+ pMsgBuffer = NULL; // mb20110110 issue 134
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPRegisterNotification
+/// API to send message to Notification Service to register a notification
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] notif_name
+/// PCSTR - Name of Notification
+/// \param [in] max_length
+/// const UI_32 - Max size of the notification message
+/// \param [in] bIsPersistent
+/// const UI_8 - Flag to indicate if it has to be persistent
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR notificationName,
+ const UI_32 maxLength, const EFrameworkunifiedNotificationType perstype)
+
+{
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != notificationName) {
+ if (strlen(pPublisherName) && strlen(notificationName)) {
+ NotificationInfo data = {};
+ strlcpy(data.notificationName, notificationName, sizeof(data.notificationName));
+ data.persType = perstype;
+ data.maxLength = maxLength;
+
+ eFrameworkunifiedStatus = NPRegisterNotifications(hNPMsgQ, pPublisherName, 1, &data);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPUnRegisterNotification
+/// API to send message to Notification Service to remove a notification
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnRegisterNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification) {
+
+ NotificationInfo data = {};
+ strlcpy(data.notificationName, pNotification, sizeof(data.notificationName));
+ return (NPUnRegisterNotifications(hNPMsgQ, pPublisherName, 1, &data));
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPPublishNotification
+/// API to send message to Notification Service to notify subscribers
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+/// \param [in] pData
+/// VOID * - Data buffer
+/// \param [in] iLength
+/// const UI_32 - Size of data buffer
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPPublishNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification,
+ PCVOID pData, const UI_32 iLength) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pNotification) {
+ if (strlen(pPublisherName) && strlen(pNotification)) {
+ if (strlen(pNotification) < MAX_STRING_SIZE_NOTIFICATION) {
+ // Insert \0 at the end of characters (up to 64bytes) by copying pNotification to local variables with strlcpy.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNotification, MAX_STRING_SIZE_NOTIFICATION);
+ eFrameworkunifiedStatus = McSendWithSysInfo(hNPMsgQ, pPublisherName, NPS_PUBLISH_EV_REQ,
+ tmp_notification, iLength, pData, 0);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSubscribeToNotification
+/// API to send message to Notification Service to add to subscription list for
+/// that notification
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSubscribeToNotification(HANDLE hNPMsgQ, PCSTR pSubscriberName, PCSTR pNotification) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ if (NULL != hNPMsgQ && NULL != pSubscriberName && NULL != pNotification) {
+ if (strlen(pSubscriberName) && strlen(pNotification)) {
+ NC_subscribe_msg data;
+ snprintf(data.notificationName, sizeof(data.notificationName), "%s", pNotification);
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pSubscriberName, NPS_SUBSCRIBE_TO_EV_REQ, sizeof(NC_subscribe_msg), (PVOID)&data);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// NPSubscribeToNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSubscribeToNotifications(HANDLE hNPMsgQ, PCSTR pSubscriberName, UI_32 numNotifications,
+ SubscribeInfo *pSubscribeInfoArray) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (maxNotification < numNotifications) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ size_t sizeOfMsg = (sizeof(NC_subscribe_msg) * numNotifications) + sizeof(UI_32);
+ if (NULL == pSubscribeInfoArray) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ PCHAR *pMsgBuffer = (PCHAR *)malloc(sizeOfMsg);
+
+ if (NULL == pMsgBuffer) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ NC_subscribe_multiple_notif_msg *pSubscribeMsg = (NC_subscribe_multiple_notif_msg *)pMsgBuffer;
+
+ pSubscribeMsg->numNotifications = numNotifications;
+ memcpy(&pSubscribeMsg->notificationList[0], pSubscribeInfoArray, sizeof(NC_subscribe_msg) * numNotifications);
+
+ for(UI_32 i = 0; i < numNotifications; i++) {
+ // Insert \0 at the end of character (up to 64bytes) by copying with strlcpy.
+ strlcpy(pSubscribeMsg->notificationList[i].notificationName,
+ pSubscribeInfoArray[i].notificationName,
+ sizeof(pSubscribeInfoArray[i].notificationName));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pSubscriberName, NPS_BATCH_SUBSCRIBE_TO_EV_REQ, (UI_32)sizeOfMsg, (PVOID)pSubscribeMsg) ;
+
+ free(pMsgBuffer);
+ pMsgBuffer = NULL;
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPUnsubscribeFromNotification
+/// API to send message to Notification Service to remove from subscription list for
+/// that notification
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnsubscribeFromNotification(HANDLE hNPMsgQ, PCSTR pSubscriberName, PCSTR pNotification) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pSubscriberName && NULL != pNotification) {
+ if (strlen(pSubscriberName) && strlen(pNotification)) {
+ NC_unsubscribe_frm_notif_msg data;
+ snprintf(data.notificationName, sizeof(data.notificationName), "%s", pNotification);
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pSubscriberName, NPS_UNSUBSCRIBE_FROM_EV_REQ, sizeof(NC_unsubscribe_frm_notif_msg),
+ (PVOID)&data);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// NPUnsubscribeToNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnsubscribeFromNotifications(HANDLE hNPMsgQ, PCSTR pUnSubscriberName, UI_32 numNotifications,
+ SubscribeInfo *pUnSubscribeInfoArray) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pUnSubscriberName) {
+ if (strlen(pUnSubscriberName)) {
+ if (maxNotification < numNotifications) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ size_t sizeOfMsg = (sizeof(NC_subscribe_msg) * numNotifications) + sizeof(UI_32);
+ if (NULL == pUnSubscribeInfoArray) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ PCHAR *pMsgBuffer = (PCHAR *)malloc(sizeOfMsg);
+
+ if (NULL == pMsgBuffer) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ NC_unsubscribe_multiple_notif_msg *pUnSubscribeMsg = (NC_unsubscribe_multiple_notif_msg *)pMsgBuffer;
+
+ pUnSubscribeMsg->numNotifications = numNotifications;
+ memcpy(&pUnSubscribeMsg->notificationList[0], pUnSubscribeInfoArray, sizeof(NC_subscribe_msg) * numNotifications);
+
+ for(UI_32 i = 0; i < numNotifications; i++) {
+ // Insert \0 at the end of character (up to 64bytes) by copying with strlcpy.
+ strlcpy(pUnSubscribeMsg->notificationList[i].notificationName,
+ pUnSubscribeInfoArray[i].notificationName,
+ sizeof(pUnSubscribeInfoArray[i].notificationName));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pUnSubscriberName, NPS_BATCH_UNSUBSCRIBE_FROM_EV_REQ, (UI_32)sizeOfMsg, (PVOID)pUnSubscribeMsg) ;
+
+ free(pMsgBuffer);
+ pMsgBuffer = NULL;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPReadPersistedData
+/// API to requested the persistent data corresponding to specified notification if available
+/// The caller recieves an acknowledgement once NPS completes data retrieval and sends it.
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \param [in] notification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPReadPersistedData(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR notification) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != notification) {
+ if (strlen(pPublisherName) && strlen(notification)) {
+ NC_get_pers_data_msg msg;
+
+ snprintf(msg.notificationName, sizeof(msg.notificationName), "%s", notification);
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_GET_PERS_DATA_REQ, sizeof(msg), (PVOID)&msg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSavePersistentData
+/// API to send message to Notification Service to save all persisted data that in Ram
+/// to the filesystem via a file write.
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of publisher message queue
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSavePersistentData(HANDLE hNPMsgQ, PCSTR pPublisherName) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_SAVE_PERS_DATA_REQ, 0, NULL) ;
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPRegisterPersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterPersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pTag,
+ BOOL bIsUserFile) { // EFrameworkunifiedRegisterType eRegisterType)
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pTag) {
+ if (strlen(pPublisherName) && strlen(pTag)) {
+ NC_RegisterPersistentFileMsg tMsg;
+
+ snprintf(tMsg.cFileTag, sizeof(tMsg.cFileTag), "%s", pTag);
+ tMsg.bIsUserFile = bIsUserFile;
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_SET_PERSIST_FILE_PATH_REQ, sizeof(tMsg),
+ (PVOID)&tMsg);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPLoadPersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPLoadPersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pDstFilePath,
+ PCSTR pTag, HANDLE hUser) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName &&
+ NULL != pDstFilePath && NULL != pTag) {
+ if (strlen(pPublisherName) && strlen(pDstFilePath) && strlen(pTag)) {
+ NC_LoadPersistedFileMsg tMsg = {};
+
+ snprintf(tMsg.cFilePath, sizeof(tMsg.cFilePath), "%s", pDstFilePath);
+ snprintf(tMsg.cFileTag, sizeof(tMsg.cFileTag), "%s", pTag);
+
+ if (hUser) {
+ NC_User *pUser = (NC_User *) hUser;
+ snprintf(tMsg.cUsername, sizeof(tMsg.cUsername), "%s", pUser->cUsername != 0 ? pUser->cUsername : NULL);
+ } else {
+ strlcpy(tMsg.cUsername, GLOBAL_PERSISTENCE, sizeof(tMsg.cUsername));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_GET_PERS_FILE_REQ, sizeof(tMsg), (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPReleasePersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPReleasePersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType, PCSTR pTag,
+ PCSTR pFullFilePath, HANDLE hUser) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName &&
+ NULL != pTag && NULL != pFullFilePath) {
+ if (strlen(pPublisherName) && strlen(pTag) && strlen(pFullFilePath)) {
+ NC_ReleasePersistentFileMsg tMsg = {eFrameworkunifiedReleaseType, {0}, {0}};
+
+ snprintf(tMsg.cFilePath, sizeof(tMsg.cFilePath), "%s", pFullFilePath);
+ snprintf(tMsg.cFileTag, sizeof(tMsg.cFileTag), "%s", pTag);
+
+ if (hUser) {
+ NC_User *pUser = (NC_User *) hUser;
+ snprintf(tMsg.cUsername, sizeof(tMsg.cUsername), "%s", pUser->cUsername != 0 ? pUser->cUsername : NULL);
+ } else {
+ strlcpy(tMsg.cUsername, GLOBAL_PERSISTENCE, sizeof(tMsg.cUsername));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_RELEASE_PERS_FILE_REQ, sizeof(tMsg), (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPPersistentSync
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPPersistentSync(PCSTR SrcName, HANDLE hNPMsgQ, UI_32 sessionid, PCSTR pPublisherName) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ CHAR data[4];
+ UI_32 length;
+ HANDLE hResponse;
+ char mc_invoker_name[MAX_QUEUE_NAME_SIZE];
+
+ McCreateInvokerName(SrcName, sessionid, mc_invoker_name, sizeof(mc_invoker_name));
+ hResponse = McOpenSyncReceiver(&mc_invoker_name[0]);
+ if (hResponse != NULL) {
+ eFrameworkunifiedStatus = McInvokeSync(hNPMsgQ, pPublisherName, NPS_NPP_SYNC_REQ , sizeof(data), data, sessionid,
+ hResponse, 0, NULL, &length);
+ McClose(hResponse);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ return eFrameworkunifiedStatus;
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSetPersonality
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetPersonality(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pUserName) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pUserName) {
+ if (strlen(pPublisherName) && strlen(pUserName)) {
+ // NC_SetPersonalityMsg tMsg;
+ NC_User tMsg;
+
+ snprintf(tMsg.cUsername, sizeof(tMsg.cUsername), "%s", pUserName);
+
+ // eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_SET_PERSONALITY_REQ, sizeof(tMsg), (PVOID)&tMsg ) ;
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_CHANGE_PERSONALITY_REQ, sizeof(tMsg), (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPRegisterPersistentFolder
+/// API to register persistence tag to folder that need to persist
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \param [in] pTag
+/// PCSTR - Tag associated to folder that need to persist
+/// \param [in] bIsUserFolder
+/// BOOL - TRUE - user specific folder
+/// FALSE - global file
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterPersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pTag, BOOL bIsUserFolder) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pTag) {
+ if (strlen(pPublisherName) && strlen(pTag)) {
+ NC_RegisterPersistentFolderMsg tMsg;
+
+ snprintf(tMsg.cFolderTag, sizeof(tMsg.cFolderTag), "%s", pTag);
+ tMsg.bIsUserFolder = bIsUserFolder;
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_SET_PERSIST_FOLDER_PATH_REQ, sizeof(tMsg),
+ (PVOID)&tMsg);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPLoadPersistentFolder
+/// API to load folder to given path and associated with given tag from persistent memory
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \param [in] pDstFolderPath
+/// PCSTR - Destination where folder needs to be loaded
+/// \param [in] pTag
+/// PCSTR - Tag associated to folder that need to loaded from persistent memory
+/// \param [in] hUser
+/// HANDLE - Handle of the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPLoadPersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pDstFolderPath,
+ PCSTR pTag, HANDLE hUser) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName &&
+ NULL != pDstFolderPath && NULL != pTag) {
+ if (strlen(pPublisherName) && strlen(pDstFolderPath) && strlen(pTag)) {
+ NC_LoadPersistedFolderMsg tMsg;
+
+ snprintf(tMsg.cFolderPath, sizeof(tMsg.cFolderPath), "%s", pDstFolderPath);
+ snprintf(tMsg.cFolderTag, sizeof(tMsg.cFolderTag), "%s", pTag);
+
+ if (hUser) {
+ NC_User *pUser = (NC_User *) hUser;
+ snprintf(tMsg.cUsername, sizeof(tMsg.cUsername), "%s", pUser->cUsername != 0 ? pUser->cUsername : NULL);
+ } else {
+ strlcpy(tMsg.cUsername, GLOBAL_PERSISTENCE, sizeof(tMsg.cUsername));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_GET_PERS_FOLDER_REQ, sizeof(tMsg), (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPReleasePersistentFolder
+/// API to release folder for saving with tag name to persistent memory
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \param [in] eFrameworkunifiedReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease :not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly :persist instantly
+/// \param [in] pTag
+/// PCSTR - Tag associated to folder that need to persist
+/// \param [in] pFullFolderPath
+/// PCSTR - full folder path of folder that need to be stored in persistent memory
+/// \param [in] hUser
+/// HANDLE - Handle of the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPReleasePersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType,
+ PCSTR pTag, PCSTR pFullFolderPath, HANDLE hUser) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName &&
+ NULL != pTag && NULL != pFullFolderPath) {
+ if (strlen(pPublisherName) && strlen(pFullFolderPath) && strlen(pTag)) {
+ NC_ReleasePersistentFolderMsg tMsg = {eFrameworkunifiedReleaseType, {0}, {0}};
+
+ snprintf(tMsg.cFolderPath, sizeof(tMsg.cFolderPath), "%s", pFullFolderPath);
+ snprintf(tMsg.cFolderTag, sizeof(tMsg.cFolderTag), "%s", pTag);
+
+ if (hUser) {
+ NC_User *pUser = (NC_User *) hUser;
+ snprintf(tMsg.cUsername, sizeof(tMsg.cUsername), "%s", pUser->cUsername != 0 ? pUser->cUsername : NULL);
+ } else {
+ strlcpy(tMsg.cUsername, GLOBAL_PERSISTENCE, sizeof(tMsg.cUsername));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_RELEASE_PERS_FOLDER_REQ, sizeof(tMsg), (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPChangePersonality
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPChangePersonality(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pUserName) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != pUserName && 0 != strlen(pUserName)) {
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_CHANGE_PERSONALITY_REQ, sizeof(pUserName), (PVOID)&pUserName) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendStopToNSNPP
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendStopToNSNPP(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedShutdownType eShutdownType, UI_32 uiStopMsgData) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != pPublisherName && 0 != strlen(pPublisherName)) {
+ NC_StopMsgData tMsg;
+ tMsg.eShutdownType = eShutdownType;
+ tMsg.uiStopMsgData = uiStopMsgData;
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_NPP_STOP_REQ, sizeof(tMsg), (PVOID)&tMsg);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPGetReadyStatusOfNPP
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPGetReadyStatusOfNPP(HANDLE hNPMsgQ, PCSTR pRequesterName) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != pRequesterName && 0 != strlen(pRequesterName)) {
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pRequesterName, NPS_GET_READYSTATUS_REQ, 0, NULL);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPRegisterImmediateNotifications
+/// API to send message to Notification Service to register a set of notifications
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] numNotifications
+/// PCSTR - Name of Notification
+/// \param [in] pNotificationArray
+/// ImmediateNotificationInfo - Array of notifications
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterImmediateNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ ImmediateNotificationInfo *pNotificationArray) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (maxNotification < numNotifications) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ size_t sizeOfMsg = (sizeof(NC_register_immediate_notif_msg) * numNotifications) + sizeof(UI_32);
+ if (NULL == pNotificationArray) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ PCHAR *pMsgBuffer = (PCHAR *)malloc(sizeOfMsg);
+
+ if (NULL == pMsgBuffer) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ NC_register_multiple_immediate_notif_msg *pNotifMsg = (NC_register_multiple_immediate_notif_msg *)pMsgBuffer;
+
+ if (NULL != pNotifMsg) {
+ pNotifMsg->numNotifications = numNotifications;
+ }
+
+ memcpy(&pNotifMsg->notifierList[0], pNotificationArray, sizeof(NC_register_immediate_notif_msg) * numNotifications);
+
+ for(UI_32 i = 0; i < numNotifications; i++ ) {
+ // Insert \0 at the end of character (up to 64bytes) by copying with strlcpy.
+ strlcpy(pNotifMsg->notifierList[i].notificationName,
+ pNotificationArray[i].notificationName,
+ sizeof(pNotificationArray[i].notificationName));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_REGISTER_NOR_EV_REQ, (UI_32)sizeOfMsg, (PVOID)pNotifMsg) ;
+
+ if (NULL != pMsgBuffer) {
+ free(pMsgBuffer);
+ pMsgBuffer = NULL;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPClearPersistedData
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPClearPersistedData(HANDLE hNPMsgQ, PCSTR pRequesterName, EFrameworkunifiedClearPersistence eFrameworkunifiedClearPersistenceScope) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if ((NULL != hNPMsgQ) && (NULL != pRequesterName) && (0 != strlen(pRequesterName))) {
+ NC_ClearPersistedDataReq tMsg = {};
+ tMsg.ePersistenceData = eFrameworkunifiedClearPersistenceScope;
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ,
+ pRequesterName,
+ NPS_DELETE_PERSISTED_DATA_REQ,
+ sizeof(tMsg),
+ &tMsg);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSetPersistNotfnDefaultValue
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetPersistNotfnDefaultValue(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification, PCVOID pData,
+ const UI_32 iLength) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pNotification) {
+ if ((0 != strlen(pPublisherName)) && (0 != strlen(pNotification))) {
+
+ // Insert \0 at the end of characters (up to 64bytes) by copying pNotification to local variables with strlcpy.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNotification, MAX_STRING_SIZE_NOTIFICATION);
+
+ eFrameworkunifiedStatus = McSendWithSysInfo(hNPMsgQ,
+ pPublisherName,
+ NPS_SET_DEFAULT_PERS_DATA,
+ (PCHAR)tmp_notification,
+ iLength,
+ pData,
+ 0);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSetPersistentNotfnType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetPersistentNotfnType(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification,
+ EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pNotification) {
+ if ((0 != strlen(pPublisherName)) && (0 != strlen(pNotification))) {
+
+ // Insert \0 at the end of characters (up to 64bytes) by copying pNotification to local variables with strlcpy.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNotification, MAX_STRING_SIZE_NOTIFICATION);
+
+ eFrameworkunifiedStatus = McSendWithSysInfo(hNPMsgQ,
+ pPublisherName,
+ NPS_SET_NOTFN_PERSISTENT_TYPE,
+ (PCHAR)tmp_notification,
+ sizeof(ePersistCategory),
+ &ePersistCategory,
+ 0);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSetFilePersistentType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetFilePersistentType(HANDLE hNPMsgQ, PCSTR pPublisherName,
+ PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pTag) {
+ if ((0 != strlen(pPublisherName)) && (0 != strlen(pTag))) {
+ NC_SetFilePersistType tMsg = {};
+
+ tMsg.ePersistType = ePersistCategory;
+
+ snprintf(tMsg.cTag, sizeof(tMsg.cTag), "%s", pTag);
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ,
+ pPublisherName,
+ NPS_SET_FILE_PERSISTENT_TYPE,
+ sizeof(tMsg),
+ (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSetFolderPersistentType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetFolderPersistentType(HANDLE hNPMsgQ, PCSTR pPublisherName,
+ PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pTag) {
+ if ((0 != strlen(pPublisherName)) && (0 != strlen(pTag))) {
+ NC_SetFolderPersistType tMsg = {};
+
+ tMsg.ePersistType = ePersistCategory;
+ snprintf(tMsg.cTag, sizeof(tMsg.cTag), "%s", pTag);
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ,
+ pPublisherName,
+ NPS_SET_FOLDER_PERSISTENT_TYPE,
+ sizeof(tMsg),
+ (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+// EOF
diff --git a/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp b/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp
new file mode 100755
index 0000000..a777743
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp
@@ -0,0 +1,498 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPService
+/// \brief This file contains the API to store and retrieve immediate
+/// notification data from and to persistent storage.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dirent.h>
+#include <semaphore.h>
+#include <aglpath.h>
+
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_util_directory.h>
+#include <native_service/ns_np_service_nor_persistence.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+#include <string>
+
+#include <native_service/ns_np_service_nor_persistence_internal.h>
+#include <native_service/ns_np_types.h>
+#include <native_service/ns_mc_system_info.h>
+
+sem_t g_FileAccessSemaphore;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousReadPersistentData
+/// Read immediate persistent data from the persistent memory
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousReadPersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ UI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ NC_NorPersistentData l_tNorPersistentData = {};
+
+ if (NULL != pAppName && NULL != notif_name && NULL != pData) {
+ if (eFrameworkunifiedStatusOK != NPSynchronousGetPersistentData(pAppName, notif_name, pData, uiDataSize, l_tNorPersistentData,
+ ePersistCategory)) {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousGetPersistentData
+/// Get the notification data from the persistent storage
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousGetPersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ UI_32 uiDataSize,
+ NC_NorPersistentData &ptImmediatePersistentData, // NOLINT (readability/nolint)
+ const EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != notif_name && NULL != pData && 0 < uiDataSize) {
+ FILE *l_fFilePtr = NULL;
+
+ if (0 == sem_init(&g_FileAccessSemaphore, 1, 1)) { // LCOV_EXCL_BR_LINE 5: sem_init's error case
+ if (sem_wait(&g_FileAccessSemaphore) == 0) { // LCOV_EXCL_BR_LINE 5: sem_wait's error case
+ // Create unique filename
+ std::string l_cTempPath = notif_name;
+ size_t l_uiTempPathSize = 0;
+
+ std::string l_cPath = "";
+ std::string l_cNewPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+ std::string l_cOldPath = IMMEDIATE_PERSISTENCE_STORAGE_V1;
+
+ // replace all '/' by '_'
+ l_uiTempPathSize = l_cTempPath.find_first_of("/");
+ while (std::string::npos != l_uiTempPathSize) {
+ l_cTempPath[l_uiTempPathSize] = '_';
+ l_uiTempPathSize = l_cTempPath.find_first_of("/", l_uiTempPathSize + 1);
+ }
+
+ switch (ePersistCategory) {
+ case eFrameworkunifiedFactoryData: {
+ l_cNewPath.append(FACTORYDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedFactoryCustomerData: {
+ l_cNewPath.append(FACTORYCUSTOMERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedDealerData: {
+ l_cNewPath.append(DEALERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedUserData:
+ default: {
+ l_cNewPath.append(USERDATADIR);
+ l_cNewPath.append(ALLUSERAPPDATADIR);
+ }
+ break;
+ }
+
+ l_cNewPath.append(IMMEDIATEDATADIR);
+ l_cNewPath.append(l_cTempPath);
+
+ if (NULL != pAppName) { // LCOV_EXCL_BR_LINE 6: pAppName was checed in NPSynchronousReadPersistentData
+ l_cNewPath.append(pAppName);
+ }
+
+ if (0 == access(l_cNewPath.c_str(), F_OK)) {
+ l_cPath.assign(l_cNewPath);
+ } else {
+ l_cOldPath.append(l_cTempPath);
+ if (NULL != pAppName) { // LCOV_EXCL_BR_LINE 6: pAppName was checed in NPSynchronousReadPersistentData
+ l_cOldPath.append(pAppName);
+ }
+
+ if (0 == access(l_cOldPath.c_str(), F_OK)) {
+ l_cPath.assign(l_cOldPath);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == eFrameworkunifiedStatus) {
+ size_t PersistData;
+ // Open and read from a file
+ l_fFilePtr = fopen(l_cPath.c_str(), "re");
+ if (NULL != l_fFilePtr) {
+ // read notification info structure
+ if (fread(&ptImmediatePersistentData, 1, sizeof(ptImmediatePersistentData),
+ l_fFilePtr) == sizeof(ptImmediatePersistentData)) {
+ if (0 == feof(l_fFilePtr)) {
+ // read data
+ PersistData = fread(pData, 1, uiDataSize, l_fFilePtr);
+ if (PersistData != uiDataSize) {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ fclose(l_fFilePtr);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ sem_post(&g_FileAccessSemaphore);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusErrOther;
+ }
+ sem_destroy(&g_FileAccessSemaphore);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousWritePersistentData
+/// Store the notification data on the persistent memory
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousWritePersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ const UI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ HANDLE l_hReceiverMq = NULL;
+
+ // if this API is used to write the data directly then max data size will be same as data write size
+ l_eStatus = SynchronousWritePersistentData(pAppName, notif_name, pData, uiDataSize, 0, uiDataSize, ePersistCategory);
+
+ l_hReceiverMq = McOpenSender(FRAMEWORKUNIFIED_NS_NPSERVICE);
+
+ if (NULL != l_hReceiverMq) {
+ (VOID)McSendWithSysInfo(l_hReceiverMq,
+ pAppName,
+ NPS_SYNCHRONOUS_WRITE_NOTIFY_REQ,
+ (PCHAR)notif_name,
+ uiDataSize,
+ pData,
+ 0);
+
+ McClose(l_hReceiverMq);
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SynchronousWritePersistentData
+/// Store the notification data on the persistent memory
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SynchronousWritePersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ const UI_32 uiDataSize,
+ const UI_32 uiDelay,
+ const UI_32 uiMaxSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ FILE *l_fFilePtr = NULL;
+ NC_NorPersistentData l_tImmediatePersistentData = {};
+
+ if (NULL != notif_name && NULL != pAppName && NULL != pData) {
+ if (strlen(notif_name) < MAX_STRING_SIZE_NOTIFICATION && strlen(pAppName) < MAX_NAME_SIZE_APP) {
+ // Create unique filename
+ std::string l_cTempPath = notif_name;
+ size_t l_uiTempPathSize = 0;
+
+ // replace all '/' by '_'
+ l_uiTempPathSize = l_cTempPath.find_first_of("/");
+ while (std::string::npos != l_uiTempPathSize) {
+ l_cTempPath[l_uiTempPathSize] = '_';
+ l_uiTempPathSize = l_cTempPath.find_first_of("/", l_uiTempPathSize + 1);
+ }
+
+ strncpy(l_tImmediatePersistentData.notificationName, notif_name,
+ sizeof(l_tImmediatePersistentData.notificationName) - 1);
+ strncpy(l_tImmediatePersistentData.pPublisherName, pAppName,
+ sizeof(l_tImmediatePersistentData.pPublisherName) - 1);
+ l_tImmediatePersistentData.dataSize = uiDataSize;
+ l_tImmediatePersistentData.uiDelay = uiDelay;
+ l_tImmediatePersistentData.uiMaxSize = uiMaxSize;
+
+ if (0 == sem_init(&g_FileAccessSemaphore, 1, 1)) { // LCOV_EXCL_BR_LINE 5: sem_init's error case
+ if (sem_wait(&g_FileAccessSemaphore) == 0) { // LCOV_EXCL_BR_LINE 5: sem_wait's error case
+ std::string l_cPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+
+ switch (ePersistCategory) {
+ case eFrameworkunifiedFactoryData: {
+ l_cPath.append(FACTORYDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedFactoryCustomerData: {
+ l_cPath.append(FACTORYCUSTOMERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedDealerData: {
+ l_cPath.append(DEALERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedUserData:
+ default: {
+ l_cPath.append(USERDATADIR);
+ l_cPath.append(ALLUSERAPPDATADIR);
+ }
+ break;
+ }
+
+ l_cPath.append(IMMEDIATEDATADIR);
+
+ if (!DoesDirecotryExist(l_cPath)) {
+ eFrameworkunifiedStatus = CreateDirectory(l_cPath);
+ }
+
+ if (eFrameworkunifiedStatusOK == eFrameworkunifiedStatus) {
+ l_cPath.append(l_cTempPath);
+
+ l_cPath.append(pAppName);
+
+ l_fFilePtr = fopen(l_cPath.c_str(), "we");
+ if (NULL != l_fFilePtr) {
+ // write header
+ fwrite(&l_tImmediatePersistentData , 1 , sizeof(l_tImmediatePersistentData) , l_fFilePtr);
+ if (0 == ferror(l_fFilePtr)) {
+ // write data
+ fwrite(pData , 1 , uiDataSize , l_fFilePtr);
+ if (0 != ferror(l_fFilePtr)) {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ fsync(fileno(l_fFilePtr));
+ fclose(l_fFilePtr);
+ }
+ }
+
+ sem_post(&g_FileAccessSemaphore);
+ }
+ sem_destroy(&g_FileAccessSemaphore);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousGetPersistentDataSize
+/// Get the size of the notification data stored in the persistent memory
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousGetPersistentDataSize(PCSTR notif_name, PUI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != notif_name && NULL != uiDataSize) {
+ FILE *l_fFilePtr = NULL;
+ NC_NorPersistentData l_ptImmediatePersistentData = {};
+
+ *uiDataSize = 0;
+
+ if (0 == sem_init(&g_FileAccessSemaphore, 1, 1)) { // LCOV_EXCL_BR_LINE 5: sem_init's error case
+ if (sem_wait(&g_FileAccessSemaphore) == 0) { // LCOV_EXCL_BR_LINE 5: sem_wait's error case
+ // Create unique filename
+ std::string l_cTempPath = notif_name;
+ size_t l_uiTempPathSize = 0;
+
+ std::string l_cPath = "";
+ std::string l_cNewPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+ std::string l_cOldPath = IMMEDIATE_PERSISTENCE_STORAGE_V1;
+
+ // replace all '/' by '_'
+ l_uiTempPathSize = l_cTempPath.find_first_of("/");
+ while (std::string::npos != l_uiTempPathSize) {
+ l_cTempPath[l_uiTempPathSize] = '_';
+ l_uiTempPathSize = l_cTempPath.find_first_of("/", l_uiTempPathSize + 1);
+ }
+
+ switch (ePersistCategory) {
+ case eFrameworkunifiedFactoryData: {
+ l_cNewPath.append(FACTORYDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedFactoryCustomerData: {
+ l_cNewPath.append(FACTORYCUSTOMERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedDealerData: {
+ l_cNewPath.append(DEALERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedUserData:
+ default: {
+ l_cNewPath.append(USERDATADIR);
+ l_cNewPath.append(ALLUSERAPPDATADIR);
+ }
+ break;
+ }
+
+ l_cNewPath.append(IMMEDIATEDATADIR);
+ l_cNewPath.append(l_cTempPath);
+
+ if (0 == access(l_cNewPath.c_str(), F_OK)) {
+ l_cPath.assign(l_cNewPath);
+ } else {
+ l_cOldPath.append(l_cTempPath);
+
+ if (0 == access(l_cOldPath.c_str(), F_OK)) {
+ l_cPath.assign(l_cOldPath);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ size_t PersistData;
+ // Open and read from a file
+ l_fFilePtr = fopen(l_cPath.c_str(), "re");
+ if (NULL != l_fFilePtr) {
+ // read notification info structure
+ PersistData = fread(&l_ptImmediatePersistentData, 1, sizeof(l_ptImmediatePersistentData), l_fFilePtr);
+ if (PersistData == sizeof(l_ptImmediatePersistentData)) {
+ *uiDataSize = l_ptImmediatePersistentData.dataSize;
+ } else {
+ *uiDataSize = static_cast<UI_32>(PersistData);
+ }
+ fclose(l_fFilePtr);
+ }
+ }
+
+ sem_post(&g_FileAccessSemaphore);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+
+ sem_destroy(&g_FileAccessSemaphore);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SynchronousMovePersistentData
+/// API to move all the immediate notification data from f_cSrcDir directory to
+/// f_cDestDir directory
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SynchronousMovePersistentData(PCSTR f_cSrcDir,
+ PCSTR f_cDestDir) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != f_cSrcDir && NULL != f_cDestDir) {
+ if (0 == sem_init(&g_FileAccessSemaphore, 1, 1)) {
+ if (sem_wait(&g_FileAccessSemaphore) == 0) { // LCOV_EXCL_BR_LINE 5: sem_init's error case
+ if (DoesDirecotryExist(f_cSrcDir)) { // LCOV_EXCL_BR_LINE 5: sem_wait's error case
+ if (!DoesDirecotryExist(f_cDestDir)) {
+ l_eStatus = CreateDirectory(f_cDestDir);
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ DIR *l_pDir = NULL;
+ struct dirent *l_pdirent = NULL;
+
+ std::string l_cSrcPath = "";
+ std::string l_cDestPath = "";
+
+ if (NULL != (l_pDir = opendir(f_cSrcDir))) {
+ while (NULL != (l_pdirent = readdir(l_pDir))) {
+ if (0 != std::strcmp(l_pdirent->d_name, ".") &&
+ 0 != std::strcmp(l_pdirent->d_name, "..")) {
+ l_cSrcPath.assign(f_cSrcDir);
+ l_cSrcPath.append(l_pdirent->d_name);
+
+ l_cDestPath.assign(f_cDestDir);
+ l_cDestPath.append(l_pdirent->d_name);
+
+ // move the old app user data to the UserData fodler
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ closedir(l_pDir);
+
+ sync();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ }
+ }
+
+ sem_post(&g_FileAccessSemaphore);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ sem_destroy(&g_FileAccessSemaphore);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_ResourceControler/src/ns_resource_controler.cpp b/nsframework/framework_unified/client/NS_ResourceControler/src/ns_resource_controler.cpp
new file mode 100755
index 0000000..5122e39
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_ResourceControler/src/ns_resource_controler.cpp
@@ -0,0 +1,168 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <pthread.h>
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_resource_controler.h>
+
+#include <map>
+#include <string>
+#include <utility>
+
+struct frameworkunifiedResource {
+ int ref_counter;
+ long resource; // NOLINT (readability/nolint)
+};
+
+typedef std::map<std::string, frameworkunifiedResource> frameworkunifiedResourceTable_t;
+typedef std::map<long, std::string> frameworkunifiedResourceTableR_t; // NOLINT (readability/nolint)
+
+struct frameworkunifiedResourceTable {
+ frameworkunifiedResourceTable_t resTable;
+ frameworkunifiedResourceTableR_t resTableR;
+};
+
+typedef std::map<std::string, frameworkunifiedResourceTable> frameworkunifiedResourceModuleTable_t;
+
+static __thread frameworkunifiedResourceModuleTable_t *frameworkunifiedResourceModuleTable;
+
+static frameworkunifiedResource *frameworkunifiedSearchResourse(const char *mod, const char *key) {
+ if (frameworkunifiedResourceModuleTable == NULL) {
+ frameworkunifiedResourceModuleTable = new frameworkunifiedResourceModuleTable_t;
+ /*
+ * @todo
+ * There is no release processing for "new frameworkunifiedResourceModuleTable_t" created under McOpenMonitor() (Valgrind pointed).
+ */
+ }
+ frameworkunifiedResourceModuleTable_t::iterator mod_it = frameworkunifiedResourceModuleTable->find(mod);
+ if (mod_it == frameworkunifiedResourceModuleTable->end()) {
+ return NULL;
+ }
+
+ frameworkunifiedResourceTable_t::iterator res_it = mod_it->second.resTable.find(key);
+ if (res_it == mod_it->second.resTable.end()) {
+ return NULL;
+ }
+
+ return &res_it->second;
+}
+
+int frameworkunifiedGetResource(const char *mod, const char *key, long *resource) { // NOLINT (readability/nolint)
+ frameworkunifiedResource *r = frameworkunifiedSearchResourse(mod, key);
+ if (r == NULL) {
+ return -1;
+ }
+ if (resource == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "resource is NULL");
+ return -1;
+ }
+ *resource = r->resource;
+ return 0;
+}
+
+int frameworkunifiedAcquireResouce(const char *mod, const char *key, long *resource) { // NOLINT (readability/nolint)
+ frameworkunifiedResource *r = frameworkunifiedSearchResourse(mod, key);
+ if (r == NULL) {
+ return -1;
+ }
+ *resource = r->resource;
+ return ++(r->ref_counter);
+}
+
+int frameworkunifiedReleaseResouce(const char *mod, const char *key) {
+ frameworkunifiedResource *r = frameworkunifiedSearchResourse(mod, key);
+ if (r == NULL) {
+ return -1;
+ }
+ return --(r->ref_counter);
+}
+
+int frameworkunifiedSearchResourseKey(const char *mod, long resource, const char **key) { // NOLINT (readability/nolint)
+ if (frameworkunifiedResourceModuleTable == NULL) {
+ frameworkunifiedResourceModuleTable = new frameworkunifiedResourceModuleTable_t;
+ }
+ frameworkunifiedResourceModuleTable_t::iterator mod_it = frameworkunifiedResourceModuleTable->find(mod);
+ if (mod_it == frameworkunifiedResourceModuleTable->end()) {
+ return -1;
+ }
+
+ frameworkunifiedResourceTableR_t::iterator resR_it = mod_it->second.resTableR.find(resource);
+ if (resR_it == mod_it->second.resTableR.end()) {
+ return -1;
+ }
+
+ *key = (resR_it->second).c_str();
+ return 0;
+}
+
+int frameworkunifiedRegistResouce(const char *mod, const char *key, long resource, // NOLINT (readability/nolint)
+ int init_counter) {
+ int ret = 0;
+
+ if (frameworkunifiedResourceModuleTable == NULL) {
+ frameworkunifiedResourceModuleTable = new frameworkunifiedResourceModuleTable_t;
+ }
+ frameworkunifiedResourceModuleTable_t::iterator mod_it = frameworkunifiedResourceModuleTable->find(mod);
+
+ if (mod_it == frameworkunifiedResourceModuleTable->end()) {
+ frameworkunifiedResourceTable mod_res;
+ frameworkunifiedResourceModuleTable->insert(std::make_pair(mod, mod_res)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ mod_it = frameworkunifiedResourceModuleTable->find(mod); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ if (mod_it->second.resTable.find(key) == mod_it->second.resTable.end()) {
+ frameworkunifiedResource regist_res;
+ regist_res.ref_counter = init_counter;
+ regist_res.resource = resource;
+ mod_it->second.resTable.insert(std::make_pair(key, regist_res));
+ mod_it->second.resTableR.insert(std::make_pair(resource, key));
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __func__, "Key(%s) already regist", key != 0 ? key : NULL);
+ // LCOV_EXCL_BR_STOP
+ ret = -1;
+ }
+
+ return ret;
+}
+
+int frameworkunifiedUnregistResouce(const char *mod, const char *key) {
+ if (frameworkunifiedResourceModuleTable == NULL) {
+ frameworkunifiedResourceModuleTable = new frameworkunifiedResourceModuleTable_t;
+ }
+ frameworkunifiedResourceModuleTable_t::iterator mod_it = frameworkunifiedResourceModuleTable->find(mod);
+
+ if (mod_it == frameworkunifiedResourceModuleTable->end()) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __func__, "Mod(%s) undefined", mod != 0 ? mod : NULL);
+ // LCOV_EXCL_BR_STOP
+ } else {
+ frameworkunifiedResourceTable_t::iterator res_it = mod_it->second.resTable.find(key);
+ if (res_it != mod_it->second.resTable.end()) {
+ long resource = res_it->second.resource; // NOLINT (readability/nolint)
+ mod_it->second.resTable.erase(key);
+
+ if (mod_it->second.resTableR.find(resource) != mod_it->second.resTableR.end()) {
+ mod_it->second.resTableR.erase(resource);
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __func__, "Key(%s) no regist", key != 0 ? key : NULL);
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ return 0;
+}
diff --git a/nsframework/framework_unified/client/NS_RingBuffer/src/ns_ringbuffer.cpp b/nsframework/framework_unified/client/NS_RingBuffer/src/ns_ringbuffer.cpp
new file mode 100755
index 0000000..1fbc5b5
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_RingBuffer/src/ns_ringbuffer.cpp
@@ -0,0 +1,1029 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSRingBuffer
+/// \brief This file contains implementation of class CNSRingBuffer.
+/// This class provides API to open, read, write and close ring buffer
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+
+#include <native_service/ns_ringbuffer.h>
+#include <native_service/cl_lock.h>
+
+#include <string>
+
+#define RBUF_HEADER_EXT "Hdr"
+#define RBUF_RETRY_SLEEP (1000)
+#define RBUF_RETRY_COUNT (8)
+#define RBUF_PAGE_SIZE (4096)
+#define RBUF_PAGE_ALIGN(p) ((p / RBUF_PAGE_SIZE) * RBUF_PAGE_SIZE)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSRingBuffer
+/// Parameterized Constructor of CNSRingBuffer class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSRingBuffer::CNSRingBuffer(const std::string &f_cMappedFilePath, const UI_32 f_uiSize, int f_lid):
+ m_cMappedFilePath(f_cMappedFilePath), m_uiRingBuffSize(f_uiSize), m_pRbufMtx(NULL), m_pRbufHdr(NULL), m_pRbuf(NULL),
+ m_lid(f_lid), m_pLockAddr(NULL), m_siProcessLastWrtPage(-1) { // LCOV_EXCL_BR_LINE 11: except branch
+ m_cMappedFileHdrPath = f_cMappedFilePath;
+ m_cMappedFileHdrPath.append(RBUF_HEADER_EXT); // LCOV_EXCL_BR_LINE 11: except branch
+
+ m_cRbufMtxName = f_cMappedFilePath;
+ std::size_t found = m_cRbufMtxName.find_first_of('/');
+ while (found != std::string::npos) {
+ m_cRbufMtxName[found] = '_';
+ found = m_cRbufMtxName.find_first_of('/', found + 1);
+ }
+ m_cRbufMtxName[0] = '/';
+ pthread_mutex_init(&m_tOpenMutex, NULL);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSRingBuffer
+/// Constructor of CNSRingBuffer class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSRingBuffer::CNSRingBuffer():
+ m_cMappedFilePath(""), m_uiRingBuffSize(0), m_pRbufMtx(NULL), m_pRbufHdr(NULL), m_pRbuf(NULL), m_lid(-1),
+ m_pLockAddr(NULL), m_siProcessLastWrtPage(-1) {
+ pthread_mutex_init(&m_tOpenMutex, NULL);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNSRingBuffer
+/// Destructor of CNSRingBuffer class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSRingBuffer::~CNSRingBuffer() {
+ if (NULL != m_pRbufHdr) {
+ // un-map the ring buffer object
+ Close();
+
+ m_pRbufHdr = NULL;
+ m_pRbufMtx = NULL;
+ }
+ pthread_mutex_destroy(&m_tOpenMutex);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Open
+/// This function opens and maps the ring buffer object.
+/// It creates the ring buffer if it does not exists.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::Open() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusErrOther;
+
+ pthread_mutex_lock(&m_tOpenMutex);
+
+ if (NULL == m_pRbufMtx) {
+ // Open ring buffer mutex
+ if (eFrameworkunifiedStatusOK != (l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pRbufMtx),
+ m_cRbufMtxName, sizeof(NSRingBufferMtx)))) {
+ if (ENOENT == errno) {
+ errno = EOK;
+
+
+// if (eFrameworkunifiedStatusOK == CreateRBMutex()) {
+ EFrameworkunifiedStatus l_eStatus1 = CreateRBMutex();
+ if ((l_eStatus1 == eFrameworkunifiedStatusOK) || (l_eStatus1 == eFrameworkunifiedStatusDuplicate)) {
+
+ l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pRbufMtx), m_cRbufMtxName, sizeof(NSRingBufferMtx));
+ }
+ }
+ } else {
+ if (m_pRbufMtx->m_lid != m_lid) {
+ // Different Lock ID in constructor parameter and mutex object
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (m_lid >= 0 && NULL == m_pLockAddr) {
+ CL_LockProcessInit();
+ if ((m_pLockAddr = CL_LockMap(m_lid)) == MAP_FAILED) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (NULL == m_pRbufHdr) {
+ // Open header ring buffer
+ if (eFrameworkunifiedStatusOK != (l_eStatus = Map(reinterpret_cast<PVOID *>(&m_pRbufHdr),
+ m_cMappedFileHdrPath, sizeof(NSRingBufferHdr)))) {
+ if (ENOENT == errno) { // ring buffer is not created yet
+ errno = EOK;
+
+ // Create ring buffer
+
+// if (eFrameworkunifiedStatusOK == CreateRBHeader()) {
+ EFrameworkunifiedStatus l_eStatus1 = CreateRBHeader();
+ if ((l_eStatus1 == eFrameworkunifiedStatusOK) || (l_eStatus1 == eFrameworkunifiedStatusDuplicate)) {
+
+ // Retry to open
+ l_eStatus = Map(reinterpret_cast<PVOID *>(&m_pRbufHdr),
+ m_cMappedFileHdrPath, sizeof(NSRingBufferHdr));
+
+// }
+ } else {
+ l_eStatus = l_eStatus1;
+ }
+
+ }
+ } else {
+
+#if 0
+ LockMtx();
+
+ struct stat st;
+ int ret = stat(m_cMappedFilePath.c_str(), &st);
+
+ if (m_uiRingBuffSize == 0) {
+ if (ret == 0) { // LCOV_EXCL_BR_LINE 5:stat's error case.
+ // LCOV_EXCL_START 5: stat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if ((UI_32)st.st_size != m_pRbufHdr->m_uiRingBufferSize || (UI_32)st.st_size < m_pRbufHdr->m_uiReadPtr
+ || (UI_32)st.st_size < m_pRbufHdr->m_uiWritePtr) {
+ memset(m_pRbufHdr, 0, sizeof(NSRingBufferHdr));
+ m_pRbufHdr->m_uiRingBufferSize = static_cast<UI_32>(st.st_size);
+ unlink(m_cMappedFilePath.c_str());
+ }
+ m_uiRingBuffSize = static_cast<UI_32>(st.st_size);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ if (m_uiRingBuffSize != m_pRbufHdr->m_uiRingBufferSize || m_uiRingBuffSize < m_pRbufHdr->m_uiReadPtr
+ || m_uiRingBuffSize < m_pRbufHdr->m_uiWritePtr || (ret == 0 && m_uiRingBuffSize != (UI_32)st.st_size)) {
+ memset(m_pRbufHdr, 0, sizeof(NSRingBufferHdr));
+ m_pRbufHdr->m_uiRingBufferSize = m_uiRingBuffSize;
+ unlink(m_cMappedFilePath.c_str());
+ }
+ }
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ struct stat st;
+ int ret = stat(m_cMappedFilePath.c_str(), &st);
+
+ if (m_uiRingBuffSize == 0) {
+ if (ret == 0) {
+ if ((UI_32)st.st_size != m_pRbufHdr->m_uiRingBufferSize || (UI_32)st.st_size < m_pRbufHdr->m_uiReadPtr ||
+ (UI_32)st.st_size < m_pRbufHdr->m_uiWritePtr) {
+ memset(m_pRbufHdr, 0, sizeof(NSRingBufferHdr));
+ m_pRbufHdr->m_uiRingBufferSize = static_cast<UI_32>(st.st_size);
+ unlink(m_cMappedFilePath.c_str());
+ }
+ m_uiRingBuffSize = static_cast<UI_32>(st.st_size);
+ }
+ } else {
+ if (m_uiRingBuffSize != m_pRbufHdr->m_uiRingBufferSize || m_uiRingBuffSize < m_pRbufHdr->m_uiReadPtr ||
+ m_uiRingBuffSize < m_pRbufHdr->m_uiWritePtr || (ret == 0 && m_uiRingBuffSize != (UI_32)st.st_size)) {
+ memset(m_pRbufHdr, 0, sizeof(NSRingBufferHdr));
+ m_pRbufHdr->m_uiRingBufferSize = m_uiRingBuffSize;
+ unlink(m_cMappedFilePath.c_str());
+ }
+ }
+
+ UnlockMtx();
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ munmap(m_pRbufHdr, sizeof(NSRingBufferHdr));
+ m_pRbufHdr = NULL;
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus && 0 != m_uiRingBuffSize) {
+ if (NULL == m_pRbuf) {
+ // Open ring buffer data buffer, create if not exists
+ if (eFrameworkunifiedStatusOK != (l_eStatus = Map(reinterpret_cast<PVOID *>(&m_pRbuf),
+ m_cMappedFilePath, m_uiRingBuffSize))) {
+ if (ENOENT == errno) { // ring buffer is not created yet
+ // Create ring buffer
+
+// if (eFrameworkunifiedStatusOK == CreateRBDataBuffer()) {
+ EFrameworkunifiedStatus l_eStatus1 = CreateRBDataBuffer();
+ if ((l_eStatus1 == eFrameworkunifiedStatusOK) || (l_eStatus1 == eFrameworkunifiedStatusDuplicate)) {
+
+ // Retry to open
+ l_eStatus = Map(reinterpret_cast<PVOID *>(&m_pRbuf),
+ m_cMappedFilePath, m_uiRingBuffSize);
+ }
+ }
+ }
+ }
+ }
+
+ pthread_mutex_unlock(&m_tOpenMutex);
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsOpen
+/// This function is used to check whether the ring buffer is opened or not.
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNSRingBuffer::IsOpen() {
+ return NULL == m_pRbufHdr ? FALSE : TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Close
+/// This function closes the ring buffer object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::Close() {
+ if (NULL != m_pLockAddr) {
+ CL_LockUnmap(m_pLockAddr);
+ }
+
+ EFrameworkunifiedStatus l_eStatus1 = UnMap(m_pRbufHdr, sizeof(NSRingBufferHdr));
+ m_pRbufHdr = NULL;
+
+ EFrameworkunifiedStatus l_eStatus2 = eFrameworkunifiedStatusOK;
+ if (0 != m_uiRingBuffSize) {
+ l_eStatus2 = UnMap(m_pRbuf, m_uiRingBuffSize);
+ m_pRbuf = NULL;
+ }
+
+ EFrameworkunifiedStatus l_eStatus3 = UnMap(m_pRbufMtx, sizeof(NSRingBufferMtx));
+ m_pRbufMtx = NULL;
+
+ return (eFrameworkunifiedStatusOK != l_eStatus1 || eFrameworkunifiedStatusOK != l_eStatus2 ||
+ eFrameworkunifiedStatusOK != l_eStatus3) ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Read
+/// This function reads data from the ring buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSRingBuffer::Read(PSTR f_pBuffer, const UI_32 f_uilength) {
+ SI_32 l_iReadSize = -1;
+
+ if ((NULL != f_pBuffer) && (NULL != m_pRbufHdr) && (0 != f_uilength)) {
+ UI_32 l_uiDataSizeToRead = 0;
+
+ // Remaining buffer size from read pointer to end of the buffer
+ UI_32 l_uiRemainSize = 0;
+
+
+#if 0
+ LockMtx();
+
+ // if ring buffer size is changed by some other process, remap the updated buffer size in this process
+ // ring buffer size can only be changed if the initial size is 0.
+ if (m_uiRingBuffSize != m_pRbufHdr->m_uiRingBufferSize) {
+ if (eFrameworkunifiedStatusOK == Map(reinterpret_cast<PVOID *>(&m_pRbuf),
+ m_cMappedFilePath, m_pRbufHdr->m_uiRingBufferSize)) {
+ m_uiRingBuffSize = m_pRbufHdr->m_uiRingBufferSize;
+ }
+ }
+
+ if (NULL != m_pRbuf) {
+ l_uiRemainSize = m_uiRingBuffSize - m_pRbufHdr->m_uiReadPtr;
+
+ // Round read data size depending on un-read data size in the buffer
+ l_uiDataSizeToRead = m_pRbufHdr->m_uiUnReadSize < f_uilength ? m_pRbufHdr->m_uiUnReadSize : f_uilength;
+
+ if (l_uiRemainSize < l_uiDataSizeToRead) {
+ // Wrapping read
+ memcpy(f_pBuffer, m_pRbuf + m_pRbufHdr->m_uiReadPtr, l_uiRemainSize);
+ memcpy(f_pBuffer + l_uiRemainSize, m_pRbuf, l_uiDataSizeToRead - l_uiRemainSize);
+ m_pRbufHdr->m_uiReadPtr = l_uiDataSizeToRead - l_uiRemainSize;
+ } else {
+ memcpy(f_pBuffer, m_pRbuf + m_pRbufHdr->m_uiReadPtr, l_uiDataSizeToRead);
+
+ m_pRbufHdr->m_uiReadPtr += l_uiDataSizeToRead;
+
+ // Read pointer is the end of the buffer
+ if (m_pRbufHdr->m_uiReadPtr == m_uiRingBuffSize) {
+ m_pRbufHdr->m_uiReadPtr = 0;
+ }
+ }
+
+ m_pRbufHdr->m_uiUnReadSize -= l_uiDataSizeToRead; // Update un-read data size
+
+ l_iReadSize = l_uiDataSizeToRead;
+ }
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ // if ring buffer size is changed by some other process, remap the updated buffer size in this process
+ // ring buffer size can only be changed if the initial size is 0.
+ if (m_uiRingBuffSize != m_pRbufHdr->m_uiRingBufferSize) {
+ if (eFrameworkunifiedStatusOK == Map(reinterpret_cast<PVOID *>(&m_pRbuf),
+ m_cMappedFilePath, m_pRbufHdr->m_uiRingBufferSize)) {
+ m_uiRingBuffSize = m_pRbufHdr->m_uiRingBufferSize;
+ }
+ }
+
+ if (NULL != m_pRbuf) {
+ l_uiRemainSize = m_uiRingBuffSize - m_pRbufHdr->m_uiReadPtr;
+
+ // Round read data size depending on un-read data size in the buffer
+ l_uiDataSizeToRead = m_pRbufHdr->m_uiUnReadSize < f_uilength ? m_pRbufHdr->m_uiUnReadSize : f_uilength;
+
+ if (l_uiRemainSize < l_uiDataSizeToRead) {
+ // Wrapping read
+ memcpy(f_pBuffer, m_pRbuf + m_pRbufHdr->m_uiReadPtr, l_uiRemainSize);
+ memcpy(f_pBuffer + l_uiRemainSize, m_pRbuf, l_uiDataSizeToRead - l_uiRemainSize);
+ m_pRbufHdr->m_uiReadPtr = l_uiDataSizeToRead - l_uiRemainSize;
+ } else {
+ memcpy(f_pBuffer, m_pRbuf + m_pRbufHdr->m_uiReadPtr, l_uiDataSizeToRead);
+
+ m_pRbufHdr->m_uiReadPtr += l_uiDataSizeToRead;
+
+ // Read pointer is the end of the buffer
+ if (m_pRbufHdr->m_uiReadPtr == m_uiRingBuffSize) {
+ m_pRbufHdr->m_uiReadPtr = 0;
+ }
+ }
+
+ m_pRbufHdr->m_uiUnReadSize -= l_uiDataSizeToRead; // Update un-read data size
+
+ l_iReadSize = l_uiDataSizeToRead;
+ }
+
+ UnlockMtx();
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ l_iReadSize = 0;
+ }
+
+ }
+
+ return l_iReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Write
+/// This function writes the data into the ring buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSRingBuffer::Write(PCSTR f_pBuffer, const UI_32 f_uilength) {
+ SI_32 l_iWriteSize = -1;
+
+ // size available in buffer
+ UI_32 l_uiRemainSize = 0;
+
+ if (NULL != m_pRbufHdr && NULL != m_pRbuf && NULL != f_pBuffer && f_uilength <= m_uiRingBuffSize) { // LCOV_EXCL_BR_LINE 11:except branch
+#if 0
+ LockMtx();
+
+ UI_32 l_uiLastPage = RBUF_PAGE_ALIGN(m_pRbufHdr->m_uiWritePtr);
+ l_uiRemainSize = m_uiRingBuffSize - m_pRbufHdr->m_uiWritePtr;
+
+ if (m_siProcessLastWrtPage >= 0) {
+ if ((UI_32)m_siProcessLastWrtPage != l_uiLastPage) {
+ if (madvise(m_pRbuf + m_siProcessLastWrtPage, RBUF_PAGE_SIZE, MADV_DONTNEED) < 0) {
+ fprintf(stderr, "[CNSRingBuffer::Write] madvise(%p) error: %s\n",
+ m_pRbuf + m_siProcessLastWrtPage, strerror(errno));
+ }
+ }
+ }
+
+ // Write data to the buffer
+ if (l_uiRemainSize < f_uilength) {
+ // Wrapping write
+ memcpy(m_pRbuf + m_pRbufHdr->m_uiWritePtr, f_pBuffer, l_uiRemainSize);
+ memcpy(m_pRbuf, f_pBuffer + l_uiRemainSize, f_uilength - l_uiRemainSize);
+
+ // Update the write pointer
+ m_pRbufHdr->m_uiWritePtr = f_uilength - l_uiRemainSize;
+
+ // The buffer is full of valid data
+ m_pRbufHdr->m_bIsFull = TRUE;
+ } else {
+ memcpy(m_pRbuf + m_pRbufHdr->m_uiWritePtr, f_pBuffer, f_uilength);
+
+ // Update the write pointer
+ m_pRbufHdr->m_uiWritePtr += f_uilength;
+
+ // Write pointer is the end of the buffer
+ if (m_pRbufHdr->m_uiWritePtr == m_uiRingBuffSize) {
+ m_pRbufHdr->m_uiWritePtr = 0;
+
+ // The buffer is full of valid data
+ m_pRbufHdr->m_bIsFull = TRUE;
+ }
+ }
+
+ // Update un-read data size
+ m_pRbufHdr->m_uiUnReadSize += f_uilength;
+
+ // Set read pointer to be same as write pointer if write pointer exceeds the read pointer
+ if (m_uiRingBuffSize < m_pRbufHdr->m_uiUnReadSize) {
+ m_pRbufHdr->m_uiReadPtr = m_pRbufHdr->m_uiWritePtr;
+ m_pRbufHdr->m_uiUnReadSize = m_uiRingBuffSize;
+ }
+
+ while (l_uiLastPage != RBUF_PAGE_ALIGN(m_pRbufHdr->m_uiWritePtr)) {
+ if (madvise(m_pRbuf + l_uiLastPage, RBUF_PAGE_SIZE, MADV_DONTNEED) < 0) {
+ fprintf(stderr, "[CNSRingBuffer::Write] madvise(%p) error: %s\n", m_pRbuf + l_uiLastPage, strerror(errno));
+ }
+ l_uiLastPage += RBUF_PAGE_SIZE;
+ if (l_uiLastPage >= m_uiRingBuffSize) {
+ l_uiLastPage = 0;
+ }
+ }
+ m_siProcessLastWrtPage = (SI_32)l_uiLastPage;
+
+ UnlockMtx();
+
+ l_iWriteSize = f_uilength;
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ UI_32 l_uiLastPage = RBUF_PAGE_ALIGN(m_pRbufHdr->m_uiWritePtr);
+ l_uiRemainSize = m_uiRingBuffSize - m_pRbufHdr->m_uiWritePtr;
+
+ if (m_siProcessLastWrtPage >= 0) {
+ if ((UI_32)m_siProcessLastWrtPage != l_uiLastPage) {
+ if (madvise(m_pRbuf + m_siProcessLastWrtPage, RBUF_PAGE_SIZE, MADV_DONTNEED) < 0) {
+ fprintf(stderr, "[CNSRingBuffer::Write] madvise(%p) error: %s\n",
+ m_pRbuf + m_siProcessLastWrtPage, strerror(errno));
+ }
+ }
+ }
+
+ // Write data to the buffer
+ if (l_uiRemainSize < f_uilength) {
+ // Wrapping write
+ memcpy(m_pRbuf + m_pRbufHdr->m_uiWritePtr, f_pBuffer, l_uiRemainSize);
+ memcpy(m_pRbuf, f_pBuffer + l_uiRemainSize, f_uilength - l_uiRemainSize);
+
+ // Update the write pointer
+ m_pRbufHdr->m_uiWritePtr = f_uilength - l_uiRemainSize;
+
+ // The buffer is full of valid data
+ m_pRbufHdr->m_bIsFull = TRUE;
+ } else {
+ memcpy(m_pRbuf + m_pRbufHdr->m_uiWritePtr, f_pBuffer, f_uilength);
+
+ // Update the write pointer
+ m_pRbufHdr->m_uiWritePtr += f_uilength;
+
+ // Write pointer is the end of the buffer
+ if (m_pRbufHdr->m_uiWritePtr == m_uiRingBuffSize) {
+ m_pRbufHdr->m_uiWritePtr = 0;
+
+ // The buffer is full of valid data
+ m_pRbufHdr->m_bIsFull = TRUE;
+ }
+ }
+
+ // Update un-read data size
+ m_pRbufHdr->m_uiUnReadSize += f_uilength;
+
+ // Set read pointer to be same as write pointer if write pointer exceeds the read pointer
+ if (m_uiRingBuffSize < m_pRbufHdr->m_uiUnReadSize) {
+ m_pRbufHdr->m_uiReadPtr = m_pRbufHdr->m_uiWritePtr;
+ m_pRbufHdr->m_uiUnReadSize = m_uiRingBuffSize;
+ }
+
+ while (l_uiLastPage != RBUF_PAGE_ALIGN(m_pRbufHdr->m_uiWritePtr)) {
+ if (madvise(m_pRbuf + l_uiLastPage, RBUF_PAGE_SIZE, MADV_DONTNEED) < 0) {
+ fprintf(stderr, "[CNSRingBuffer::Write] madvise(%p) error: %s\n",
+ m_pRbuf + l_uiLastPage, strerror(errno));
+ }
+ l_uiLastPage += RBUF_PAGE_SIZE;
+ if (l_uiLastPage >= m_uiRingBuffSize) {
+ l_uiLastPage = 0;
+ }
+ }
+ m_siProcessLastWrtPage = (SI_32)l_uiLastPage;
+
+ UnlockMtx();
+
+ l_iWriteSize = f_uilength;
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ l_iWriteSize = 0;
+ }
+
+ }
+
+ return l_iWriteSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// DumpToFile
+/// This function writes all the data in the buffer into provided file f_pPath.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ ssize_t l_iSize = 0;
+
+ SI_32 fd = -1;
+
+ if (NULL == f_uiDumpSize) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ *f_uiDumpSize = 0;
+
+ if (NULL != f_pPath) {
+ if (NULL != m_pRbufHdr) {
+ // Open file
+ if (-1 != (fd = open(f_pPath, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0640))) {
+ if (NULL != m_pRbuf && 0 != m_uiRingBuffSize) {
+
+#if 0
+ LockMtx();
+ // Write buffer data to file
+ if (m_pRbufHdr->m_bIsFull) {
+ // Buffer has full of data (read data from write pointer)
+ if (-1 != (l_iSize = write(fd, m_pRbuf + m_pRbufHdr->m_uiWritePtr,
+ m_uiRingBuffSize - m_pRbufHdr->m_uiWritePtr))) {
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+
+ if (-1 != (l_iSize = write(fd, m_pRbuf, m_pRbufHdr->m_uiWritePtr))) {
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ }
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ // Write buffer data to file
+ if (m_pRbufHdr->m_bIsFull) {
+ // Buffer has full of data (read data from write pointer)
+ if (-1 != (l_iSize = write(fd, m_pRbuf + m_pRbufHdr->m_uiWritePtr,
+ m_uiRingBuffSize - m_pRbufHdr->m_uiWritePtr))) {
+
+// *f_uiDumpSize += l_iSize;
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+
+ if (-1 != (l_iSize = write(fd, m_pRbuf, m_pRbufHdr->m_uiWritePtr))) {
+
+// *f_uiDumpSize += l_iSize;
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ }
+
+ UnlockMtx();
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ }
+
+ } else if (NULL == m_pRbuf && 0 != m_uiRingBuffSize) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // do nothing
+ }
+
+ // Sync the file to force I/O operation completed
+ fsync(fd);
+
+ close(fd);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSize
+/// This function returns the number of unread bytes which can be read by Read().
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSRingBuffer::GetSize() {
+ SI_32 l_uiReadSize = -1;
+
+ if (NULL != m_pRbufHdr) {
+ l_uiReadSize = m_pRbufHdr->m_uiUnReadSize;
+ }
+
+ return l_uiReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearBuf
+/// This function clears the buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::ClearBuf() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pRbufHdr) {
+
+#if 0
+ LockMtx();
+
+ // Initialize the r/w pointers
+ m_pRbufHdr->m_uiReadPtr = 0;
+ m_pRbufHdr->m_uiWritePtr = 0;
+ m_pRbufHdr->m_uiUnReadSize = 0;
+ m_pRbufHdr->m_bIsFull = FALSE;
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ((ret = LockMtx()) == 0) {
+ // Initialize the r/w pointers
+ m_pRbufHdr->m_uiReadPtr = 0;
+ m_pRbufHdr->m_uiWritePtr = 0;
+ m_pRbufHdr->m_uiUnReadSize = 0;
+ m_pRbufHdr->m_bIsFull = FALSE;
+
+ UnlockMtx();
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ }
+
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReadPtrToWritePtr
+/// This function sets the position of read ptr to write ptr in buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::SetReadPtrToWritePtr() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pRbufHdr) {
+
+#if 0
+ LockMtx();
+
+ // Initialize the r/w pointers
+ m_pRbufHdr->m_uiReadPtr = m_pRbufHdr->m_uiWritePtr;
+ m_pRbufHdr->m_uiUnReadSize = 0;
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ // Initialize the r/w pointers
+ m_pRbufHdr->m_uiReadPtr = m_pRbufHdr->m_uiWritePtr;
+ m_pRbufHdr->m_uiUnReadSize = 0;
+
+ UnlockMtx();
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ }
+
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+//
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateRBMutex
+/// This function creates the shared memory object for mutex.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::CreateRBMutex() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of shared memory
+ SI_32 l_siId = -1;
+
+ // ring buffer mutex
+ NSRingBufferMtx *l_pRbufMtx = NULL;
+
+ if ((!m_cRbufMtxName.empty()) || (m_cRbufMtxName.size() <= NAME_MAX)) {
+ // Try to create shared memory
+ l_siId = shm_open(m_cRbufMtxName.c_str(), O_CREAT | O_EXCL | O_RDWR, 0640);
+
+ if (-1 != l_siId) {
+ // Set the size of shared memory
+ if (-1 != ftruncate(l_siId, sizeof(NSRingBufferMtx))) {
+ // Map the shared memory
+ l_pRbufMtx = reinterpret_cast<NSRingBufferMtx *>(mmap(NULL,
+ sizeof(NSRingBufferMtx), (PROT_READ | PROT_WRITE), MAP_SHARED, l_siId, 0));
+
+ if (MAP_FAILED != l_pRbufMtx) {
+ if (m_lid == -1) {
+ // mutex attribute
+ pthread_mutexattr_t l_tMtxAttr = {};
+
+ // Initialize mutex
+ pthread_mutexattr_init(&l_tMtxAttr);
+ pthread_mutexattr_setpshared(&l_tMtxAttr, PTHREAD_PROCESS_SHARED);
+ pthread_mutex_init(&l_pRbufMtx->m_tBufMutex, &l_tMtxAttr);
+ pthread_mutexattr_destroy(&l_tMtxAttr);
+
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ // CL_Lock
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ l_pRbufMtx->m_lid = m_lid;
+
+ // Once initialized un-map the shared memory
+ munmap(l_pRbufMtx, sizeof(NSRingBufferMtx));
+ }
+ }
+
+ close(l_siId);
+ } else if (EEXIST == errno) {
+ // Shared memory is already created
+ l_eStatus = eFrameworkunifiedStatusDuplicate;
+ } else {
+ // do nothing
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateRBHeader
+/// This function creates the ring buffer object for header.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::CreateRBHeader() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of ring buffer
+ SI_32 l_siFd = -1;
+
+ // ring buffer headers
+ NSRingBufferHdr *l_pRbufHdr = NULL;
+
+ if (!m_cMappedFileHdrPath.empty()) { // LCOV_EXCL_BR_LINE 11: except branch
+ // Try to create ring buffer
+ l_siFd = open(m_cMappedFileHdrPath.c_str(), O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, 0640);
+
+ if (-1 != l_siFd) {
+ // Set the size of ring buffer
+ if (-1 != ftruncate(l_siFd, sizeof(NSRingBufferHdr))) {
+ // Map the ring buffer
+ l_pRbufHdr = reinterpret_cast<NSRingBufferHdr *>(mmap(NULL,
+ sizeof(NSRingBufferHdr), (PROT_READ | PROT_WRITE), MAP_SHARED, l_siFd, 0));
+
+ if (MAP_FAILED != l_pRbufHdr) {
+
+#if 0
+ LockMtx();
+
+ // Initialize the r/w pointers
+ l_pRbufHdr->m_uiReadPtr = 0;
+ l_pRbufHdr->m_uiWritePtr = 0;
+ l_pRbufHdr->m_uiUnReadSize = 0;
+ l_pRbufHdr->m_bIsFull = FALSE;
+ l_pRbufHdr->m_uiRingBufferSize = m_uiRingBuffSize;
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ // Initialize the r/w pointers
+ l_pRbufHdr->m_uiReadPtr = 0;
+ l_pRbufHdr->m_uiWritePtr = 0;
+ l_pRbufHdr->m_uiUnReadSize = 0;
+ l_pRbufHdr->m_bIsFull = FALSE;
+ l_pRbufHdr->m_uiRingBufferSize = m_uiRingBuffSize;
+
+ UnlockMtx();
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+
+ // Once initialized un-map the ring buffer
+ munmap(l_pRbufHdr, sizeof(NSRingBufferHdr));
+ }
+ }
+
+ close(l_siFd);
+ } else if (EEXIST == errno) {
+ // ring buffer is already created
+ l_eStatus = eFrameworkunifiedStatusDuplicate;
+ } else {
+ // do nothing
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateRBDataBuffer
+/// This function creates the ring buffer object for data buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::CreateRBDataBuffer() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of ring buffer
+ SI_32 l_siFd = -1;
+
+ if (!m_cMappedFilePath.empty()) {
+ // Try to create ring buffer
+ l_siFd = open(m_cMappedFilePath.c_str(), O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, 0640);
+
+ if (-1 != l_siFd) {
+ // Set the size of ring buffer
+ if (-1 != ftruncate(l_siFd, m_uiRingBuffSize)) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ close(l_siFd);
+ } else if (EEXIST == errno) {
+ // ring buffer is already created
+ l_eStatus = eFrameworkunifiedStatusDuplicate;
+ } else {
+ // do nothing
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// MapRBHeader
+/// This function open and maps in process space.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::Map(PVOID *f_pRbuf, const std::string &f_cMappedFile, const UI_32 f_uiRbufSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of ring buffer
+ SI_32 l_siFd = -1;
+
+ // ring buffer headers
+ PVOID l_pRbuf = NULL;
+
+ // Open ring buffer
+ l_siFd = open(f_cMappedFile.c_str(), O_RDWR | O_CLOEXEC, NULL);
+
+ if (-1 != l_siFd) {
+ if (CheckSize(l_siFd, f_uiRbufSize) == eFrameworkunifiedStatusOK) {
+ // Map the ring buffer into its memory space
+ l_pRbuf = mmap(NULL, f_uiRbufSize, (PROT_READ | PROT_WRITE), MAP_SHARED, l_siFd, 0);
+
+ if (MAP_FAILED != l_pRbuf) {
+ *f_pRbuf = l_pRbuf;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+
+ close(l_siFd);
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CheckSize
+/// This function check mmap size
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::CheckSize(int fd, off_t size) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ struct stat st;
+ int i;
+
+ for (i = 0; i < RBUF_RETRY_COUNT; i++) {
+ if (fstat(fd, &st) < 0) {
+ fprintf(stderr, "[CNSRingBuffer::CheckSize] fstat error: %s\n", strerror(errno));
+ goto out;
+ }
+ if (st.st_size == size) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+ }
+ usleep(RBUF_RETRY_SLEEP);
+ }
+ if (i >= RBUF_RETRY_COUNT) {
+ errno = ENOMEM;
+ }
+
+out:
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// MapSM
+/// This function shm_open and maps the shared memory in process space.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::MapSM(PVOID *f_pShMem, const std::string &f_cShmName, const UI_32 f_uiShmSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of shared memory
+ SI_32 l_siId = -1;
+
+ // shared memory buffer headers
+ PVOID l_pShmBuf = NULL;
+
+ // Open shared memory
+ l_siId = shm_open(f_cShmName.c_str(), O_RDWR, 0640);
+
+ if (-1 != l_siId) {
+ if (CheckSize(l_siId, f_uiShmSize) == eFrameworkunifiedStatusOK) {
+ // Map the shared memory into its memory space
+ l_pShmBuf = mmap(NULL, f_uiShmSize, (PROT_READ | PROT_WRITE), MAP_SHARED, l_siId, 0);
+
+ if (MAP_FAILED != l_pShmBuf) {
+ *f_pShMem = l_pShmBuf;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+
+ close(l_siId);
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// UnMap
+/// This function unmaps object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::UnMap(PVOID f_pRbuf, const UI_32 f_uiRbufSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // Un-map the ring buffer
+ if (NULL != f_pRbuf) {
+ if (0 != munmap(f_pRbuf, f_uiRbufSize)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+
+//void CNSRingBuffer::LockMtx() {
+// if (m_lid == -1) {
+// pthread_mutex_lock(&m_pRbufMtx->m_tBufMutex);
+// } else {
+// CL_LockGet(m_pLockAddr);
+// }
+//}
+int CNSRingBuffer::LockMtx() {
+ int ret = 0;
+
+ if (m_lid == -1) {
+ ret = pthread_mutex_lock(&m_pRbufMtx->m_tBufMutex);
+ } else {
+ ret = CL_LockGet(m_pLockAddr);
+ }
+
+ return ret;
+}
+
+
+void CNSRingBuffer::UnlockMtx() {
+ if (m_lid == -1) {
+ pthread_mutex_unlock(&m_pRbufMtx->m_tBufMutex);
+ } else {
+ CL_LockRelease(m_pLockAddr);
+ }
+}
diff --git a/nsframework/framework_unified/client/NS_SharedMemIf/api/nsapi_sharedmem.cpp b/nsframework/framework_unified/client/NS_SharedMemIf/api/nsapi_sharedmem.cpp
new file mode 100755
index 0000000..89c7421
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_SharedMemIf/api/nsapi_sharedmem.cpp
@@ -0,0 +1,431 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+ *
+ * FILENAME : nsapi_sharedmem.cpp
+ *
+ * DESCRIPTION : TestApp - NS_SharedMem
+ *
+ ************************************************************************/
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_shared_mem_if.h>
+#include <native_service/ns_transmit_log.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ss_version.h"
+#include "ns_unittest_internal.h"
+
+#define AVAILABLE_API
+#if defined(AVAILABLE_API)
+static CNSSharedMem *g_pTransmitLogSharedBuf = NULL;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemTransmitLogOpen
+/// Open the shared memory for transmit logging
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogOpen() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == g_pTransmitLogSharedBuf) {
+ // Create the instance
+ g_pTransmitLogSharedBuf = new(std::nothrow) CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ }
+
+ if (NULL != g_pTransmitLogSharedBuf) {
+ if (!g_pTransmitLogSharedBuf->IsOpen()) {
+ // maps the shared memory buffer
+ l_eStatus = g_pTransmitLogSharedBuf->Open();
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemTransmitLogClose
+/// Close the transmit logging shared memory
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogClose() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != g_pTransmitLogSharedBuf) {
+ // un-map the shared memory object
+ l_eStatus = g_pTransmitLogSharedBuf->Close();
+
+ delete g_pTransmitLogSharedBuf;
+ g_pTransmitLogSharedBuf = NULL;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemReadTransmitLog
+/// Reads transmit log from the shared memory buffer.
+////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemReadTransmitLog(PSTR f_pBuffer, const UI_32 f_uiLength, const BOOL f_bBlock) {
+ // no. of bytes read
+ SI_32 l_iReadSize = NS_SHM_ERROR;
+
+ if (NULL != g_pTransmitLogSharedBuf && NULL != f_pBuffer) {
+ // Writes log data into shared memory buffer
+ l_iReadSize = g_pTransmitLogSharedBuf->Read(f_pBuffer, f_uiLength, f_bBlock);
+ }
+
+ return l_iReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemWriteTransmitLog
+/// Write transmit log into the shared memory buffer.
+////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemWriteTransmitLog(PCSTR f_pBuffer, const UI_32 f_uiLength) {
+ // no. of bytes read
+ SI_32 l_iWriteSize = NS_SHM_ERROR;
+
+ if (NULL != g_pTransmitLogSharedBuf && NULL != f_pBuffer) {
+ // Writes log data into shared memory buffer
+ l_iWriteSize = g_pTransmitLogSharedBuf->Write(f_pBuffer, f_uiLength);
+ }
+
+ return l_iWriteSize;
+}
+#endif
+
+
+// For NsLog
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INFO, ZONE_WARN, ZONE_ERR
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+ LPRINT,
+ {
+ "Init", "Function", "Memory",
+ "", "", "",
+ "", "", "",
+ "", "", "",
+ "", "", "",
+ "", "", "",
+ "",
+ "Info", "Warning", "Error"
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+/** sleep */
+static int
+sleep_msec(int msec) {
+ struct timespec ts, rem;
+ ts.tv_sec = msec / 1000;
+ ts.tv_nsec = (msec % 1000) * 1000000;
+ int ret;
+ for (;;) {
+ ret = nanosleep(&ts, &rem);
+ if (ret == 0 || (ret < 0 && errno != EINTR)) {
+ break;
+ }
+ ts = rem;
+ }
+ return ret;
+}
+
+/** usage */
+void usage(void) {
+ printf("nsapi_sharedmem [command] [option]\n");
+ printf(" command: preset\n");
+#if !defined(AVAILABLE_API)
+ printf(" preset service_write\n");
+ printf(" preset service_write_read n\n");
+#endif
+ printf(" preset sharedmem_write\n");
+ printf(" preset sharedmem_write_read n\n");
+ printf(" preset write_6_A\n");
+ printf(" preset write_6_B\n");
+ printf(" preset write_7_A\n");
+ printf(" preset write_7_B\n");
+ printf(" command: manual\n");
+ printf(" manual ***\n");
+}
+
+/** main */
+int main(int argc, char *argv[]) {
+ int status = 0;
+
+ FRAMEWORKUNIFIED_SET_ZONES();
+
+ if (argc < 2) {
+ usage();
+ return 0;
+ } else {
+ char *command = argv[1];
+ int option = 0;
+
+ /* Execute command */
+ if (strcmp(command, "preset") == 0) {
+ if (argc > 2) {
+ char *preset = argv[2];
+ if (argc > 3) {
+ option = atoi(argv[3]);
+ }
+
+#if defined(AVAILABLE_API)
+ if (strcmp(preset, "sharedmem_write") == 0) {
+ NSUT_ASSERT(NSSharedMemTransmitLogOpen() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogOpen() error.");
+ SI_32 size = NSSharedMemWriteTransmitLog(argv[2], static_cast<UI_32>(strlen(argv[2]) + 1));
+ NSUT_ASSERT(size == (SI_32)(strlen(argv[2]) + 1), "NSSharedMemWriteTransmitLog() error.");
+ NSUT_ASSERT(NSSharedMemTransmitLogClose() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogClose() error.");
+ if (size != (SI_32)(strlen(argv[2]) + 1)) {
+ return -1;
+ }
+ } else if (strcmp(preset, "sharedmem_write_read") == 0) {
+ for (int i = 0; i < option; i++) {
+ NSUT_ASSERT(NSSharedMemTransmitLogOpen() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogOpen() error.");
+ SI_32 size = NSSharedMemWriteTransmitLog(argv[2], static_cast<UI_32>(strlen(argv[2]) + 1));
+ NSUT_ASSERT(size == (SI_32)(strlen(argv[2]) + 1), "NSSharedMemWriteTransmitLog() error.");
+ char f_pBuffer[100] = {0};
+ NSSharedMemReadTransmitLog(f_pBuffer, sizeof(f_pBuffer), FALSE);
+ NSUT_ASSERT(NSSharedMemTransmitLogClose() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogClose() error.");
+ }
+ }
+#else
+ if (strcmp(preset, "service_write") == 0) {
+ TMemID id = SetDataToShared(argv[2], strlen(argv[2]) + 1);
+ NSUT_ASSERT(id != BAD_MEM_ID, "SetDataToShared() error.");
+ if (id == BAD_MEM_ID) {
+ return -1;
+ }
+ } else if (strcmp(preset, "service_write_read") == 0) {
+ for (int i = 0; i < option; i++) {
+ EFrameworkunifiedStatus status;
+ TMemID id = SetDataToShared(argv[2], strlen(argv[2]) + 1);
+ NSUT_ASSERT(id != BAD_MEM_ID, "SetDataToShared() error.");
+ UI_32 size = GetLengthOfDataFromShared(id);
+ NSUT_ASSERT(size == (strlen(argv[2]) + 1), "NSSharedMemWriteTransmitLog() error.");
+ void *data[100] = { 0 };
+ status = GetDataFromShared(id, data, sizeof(data));
+ NSUT_ASSERT(eFrameworkunifiedStatusOK == status, "GetDataFromShared()");
+ status = DiscardDataFromShared(id);
+ NSUT_ASSERT(eFrameworkunifiedStatusOK == status, "DiscardDataFromShared()");
+ }
+ } else if (strcmp(preset, "sharedmem_write") == 0) {
+ NSUT_ASSERT(NSSharedMemTransmitLogOpen() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogOpen() error.");
+ SI_32 size = NSSharedMemWriteTransmitLog(argv[2], strlen(argv[2]) + 1);
+ NSUT_ASSERT(size == (SI_32)(strlen(argv[2]) + 1), "NSSharedMemWriteTransmitLog() error.");
+ NSUT_ASSERT(NSSharedMemTransmitLogClose() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogClose() error.");
+ if (size != (SI_32)(strlen(argv[2]) + 1)) {
+ return -1;
+ }
+ } else if (strcmp(preset, "sharedmem_write_read") == 0) {
+ for (int i = 0; i < option; i++) {
+ NSUT_ASSERT(NSSharedMemTransmitLogOpen() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogOpen() error.");
+ SI_32 size = NSSharedMemWriteTransmitLog(argv[2], strlen(argv[2]) + 1);
+ NSUT_ASSERT(size == (SI_32)(strlen(argv[2]) + 1), "NSSharedMemWriteTransmitLog() error.");
+ char f_pBuffer[100] = {0};
+ NSSharedMemReadTransmitLog(f_pBuffer, sizeof(f_pBuffer), FALSE);
+ NSUT_ASSERT(NSSharedMemTransmitLogClose() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogClose() error.");
+ }
+ }
+#endif
+ else if (strcmp(preset, "write_6_A") == 0) { // NOLINT (readability/nolint)
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ sleep(2);
+ char f_pBuffer[100] = {0};
+ if (testObj->Read(f_pBuffer, sizeof(f_pBuffer), FALSE) != 7) {
+ status = -1;
+ }
+ if (memcmp(f_pBuffer, "ABCDEFG", 7) != 0) {
+ printf("memcmp() error.");
+ return -1;
+ }
+ if (testObj->Close() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+ } else if (strcmp(preset, "write_6_B") == 0) {
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ if (testObj->Write("ABCDEFG", static_cast<UI_32>(strlen("ABCDEFG"))) != 7) {
+ status = -1;
+ }
+ if (testObj->Close() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+ } else if (strcmp(preset, "write_7_A") == 0) {
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ sleep(2);
+ char f_pBuffer[100] = {0};
+ if (testObj->Read(f_pBuffer, sizeof(f_pBuffer), FALSE) == 7) {
+ status = -1;
+ }
+ if (testObj->Close() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+ } else if (strcmp(preset, "write_7_B") == 0) {
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() == eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ if (testObj->Write("ABCDEFG", static_cast<UI_32>(strlen("ABCDEFG"))) == 7) {
+ status = -1;
+ }
+ if (testObj->Close() == eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+ } else if (strcmp(preset, "stress_4") == 0) {
+ int i;
+ char *writeBuffer = new char[0x400]();
+ for (i = 0; i < 0x400; i++) {
+ writeBuffer[i] = static_cast<char>(i);
+ }
+
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ int timeout = 0;
+ int test_count = 0;
+ while ((timeout < 10) && (test_count < option)) {
+ if (testObj->GetSize() > (SI_32)(TRANSMIT_LOG_SHAREDMEM_SIZE - 0x800)) {
+ sleep_msec(100);
+ timeout++;
+ // printf("timeout = %d\n", timeout);
+ continue;
+ }
+ if (testObj->ClearBuf() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ if (testObj->SetReadPtrToWritePtr() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ if (testObj->Write(writeBuffer, 0x400) != 0x400) {
+ status = -1;
+ }
+ timeout = 0;
+ test_count++;
+ }
+ if (testObj->Close() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+
+ delete[] writeBuffer;
+ } else if (strcmp(preset, "stress_5") == 0) {
+ int i;
+ char *writeBuffer = new char[0x100]();
+ for (i = 0; i < 0x100; i++) {
+ writeBuffer[i] = static_cast<char>(0xff - i);
+ }
+
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ int timeout = 0;
+ int count = 0;
+ while (timeout < 10) {
+ int size = (count % 0xff) + 1;
+ if (testObj->GetSize() > (SI_32)(TRANSMIT_LOG_SHAREDMEM_SIZE - 0x800)) {
+ sleep_msec(100);
+ timeout++;
+ continue;
+ }
+ if (testObj->Write(&writeBuffer[0xff - size], size) != size) {
+ status = -1;
+ }
+ timeout = 0;
+ count++;
+ }
+ if (testObj->Close() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+
+ delete[] writeBuffer;
+ } else {
+ usage();
+ }
+ } else {
+ usage();
+ }
+ } else if (strcmp(command, "manual") == 0) {
+ int testno;
+ char buf[32];
+ INT8 active = 1;
+
+ while (active) {
+ printf(" ----- imageapi ----------\n");
+ printf(" 0: debug_test()\n");
+ printf(" 1: gfx_ut_image_api()\n");
+ printf(" 2: gfx_ut_image_csv()\n");
+ printf(" q: quit\n");
+ printf(" -------------------------\n");
+
+ fgets(buf, sizeof(buf), stdin);
+ if (buf[0] == '\n') {
+ continue;
+ } else if (buf[0] == 'q' || buf[0] == 'Q') {
+ active = 0;
+ continue;
+ }
+ testno = atoi(buf);
+
+ switch (testno) {
+ case 0:
+ // debug_test();
+ break;
+ case 1:
+ // gfx_ut_image_api();
+ break;
+ case 2:
+ // gfx_ut_image_csv((char *)"it_image.csv");
+ break;
+ default:
+ break;
+ }
+ }
+ } else {
+ usage();
+ }
+ }
+ return status;
+}
diff --git a/nsframework/framework_unified/client/NS_SharedMemIf/cfg/depends.mk b/nsframework/framework_unified/client/NS_SharedMemIf/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_SharedMemIf/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_SharedMemIf/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_SharedMemIf/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..dc225c4
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_SharedMemIf/src/makefile_PosixBasedOS001
@@ -0,0 +1,190 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_SharedMemIf
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_SharedMemIf
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS += -Wstrict-aliasing
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_SharedMem/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_UtilityCenter/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_shared_mem_if.cpp b/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_shared_mem_if.cpp
new file mode 100755
index 0000000..e60a404
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_shared_mem_if.cpp
@@ -0,0 +1,254 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief SharedMemIf implementation
+///
+/// Implements interface functions to SharedMem service
+//////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_shared_mem_if.h> ///< Shared mem source interface file
+#include <native_service/ns_logger_if.h>
+
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+
+#define NS_SHM_HEADER_SIZE (48)
+
+/////////////////////////////////////////////////////////////////////////////
+/// Utility functions and classes
+
+static TMemID getclock(void) {
+ struct timespec tp;
+ if (clock_gettime(CLOCK_MONOTONIC_RAW, &tp) < 0) { // LCOV_EXCL_BR_LINE 5: clock_gettime's error case.
+ return 0;
+ }
+ return (TMemID)(((uint64_t)tp.tv_sec * 1000 * 1000 * 1000 + tp.tv_nsec) >> 8);
+}
+
+static size_t uitoa(unsigned int value, char *buf) {
+ static const char c[] = "0123456789abcdef";
+ int i;
+
+ if (buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "buf is NULL");
+ return 0;
+ }
+ for (i = 0; i < 8; i++) {
+ buf[i] = c[(value >> ((7 - i) * 4)) & 0xf];
+ }
+ buf[i] = '\0';
+
+ return i;
+}
+
+static inline void create_shmname(char *buf, TMemID id) {
+ if (buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "buf is NULL");
+ return;
+ }
+ strcpy(buf, "nsshm_"); // NOLINT (readability/nolint)
+ buf += sizeof("nsshm_") - 1;
+ uitoa(id, buf);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+// Public interface function definitions
+
+TMemID SetDataToShared(const void *data, UI_32 dataBytes, const char *from, const char *to) {
+ TMemID id;
+ char shmname[16];
+ int fd;
+ void *addr = MAP_FAILED;
+
+ if (data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "data is NULL");
+ return BAD_MEM_ID;
+ }
+ if (from == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "from is NULL");
+ return BAD_MEM_ID;
+ }
+ if (to == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "to is NULL");
+ return BAD_MEM_ID;
+ }
+
+ if (dataBytes == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "DataSize is invalied(%d)", dataBytes);
+ return BAD_MEM_ID;
+ }
+
+ while (1) {
+ id = getclock();
+ create_shmname(shmname, id);
+
+ if ((fd = shm_open(shmname, O_CREAT | O_EXCL | O_RDWR, 0666)) < 0) {
+ if (errno == EEXIST) {
+ continue;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "shm_open: %s", strerror(errno));
+ return BAD_MEM_ID;
+ }
+ break;
+ }
+
+ if (ftruncate(fd, dataBytes + NS_SHM_HEADER_SIZE) < 0) { // LCOV_EXCL_BR_LINE 5: ftruncate's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "ftruncate: %s", strerror(errno));
+ id = BAD_MEM_ID;
+ goto exit;
+ }
+
+ if ((addr = mmap(NULL, dataBytes + NS_SHM_HEADER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "mmap: %s", strerror(errno));
+ id = BAD_MEM_ID;
+ goto exit;
+ }
+
+ strcpy(reinterpret_cast<char *>(addr), from); // NOLINT (readability/nolint)
+ strcpy(reinterpret_cast<char *>(addr) + (NS_SHM_HEADER_SIZE / 2), to); // NOLINT (readability/nolint)
+ /**
+ * @todo
+ * Specifying a large number (4097 or higher) for the Session Data Size for transmission results in a segmentation fault.
+ */
+ memcpy(reinterpret_cast<char *>(addr) + NS_SHM_HEADER_SIZE, data, dataBytes);
+
+exit:
+ close(fd);
+ if (addr != MAP_FAILED) {
+ munmap(addr, dataBytes + NS_SHM_HEADER_SIZE);
+ }
+ if (id == BAD_MEM_ID) {
+ shm_unlink(shmname);
+ }
+ return id;
+}
+
+EFrameworkunifiedStatus GetDataFromShared(TMemID id, void *data, UI_32 dataMaxBytes) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ char shmname[16];
+ int fd;
+ void *addr = MAP_FAILED;
+ struct stat sb;
+
+ if (id == BAD_MEM_ID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "ShMemID is invalied(%u)", id);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "data is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (dataMaxBytes == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "DataSize is invalied(%d)", dataMaxBytes);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ create_shmname(shmname, id);
+
+ if ((fd = shm_open(shmname, O_RDONLY, 0)) < 0) {
+ if (errno == ENOENT) {
+ eStatus = eFrameworkunifiedStatusInvldID;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "shm_open: %s", strerror(errno));
+ return eStatus;
+ }
+
+ if (fstat(fd, &sb) < 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "fstat: %s", strerror(errno));
+ goto exit;
+ }
+ if (sb.st_size - NS_SHM_HEADER_SIZE > static_cast<SI_64>(dataMaxBytes)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "DataSize is invalied(%d-%d)", dataMaxBytes, (int)sb.st_size);
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ }
+
+ if ((addr = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "mmap: %s", strerror(errno)); // LCOV_EXCL_LINE 5: mmap's error case.
+ goto exit;
+ }
+
+ memcpy(data, reinterpret_cast<char *>(addr) + NS_SHM_HEADER_SIZE, sb.st_size - NS_SHM_HEADER_SIZE);
+ eStatus = eFrameworkunifiedStatusOK;
+
+exit:
+ close(fd);
+ if (addr != MAP_FAILED) {
+ munmap(addr, sb.st_size);
+ }
+ return eStatus;
+}
+
+UI_32 GetLengthOfDataFromShared(TMemID id) {
+ UI_32 size = 0;
+ char shmname[16];
+ int fd;
+ struct stat sb;
+
+ if (id == BAD_MEM_ID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "ShMemID is invalied(%u)", id); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return 0;
+ }
+
+ create_shmname(shmname, id);
+
+ if ((fd = shm_open(shmname, O_RDWR, 0)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "shm_open: %s", strerror(errno));
+ return 0;
+ }
+
+ if (fstat(fd, &sb) < 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "fstat: %s", strerror(errno)); // LCOV_EXCL_LINE 5: mmap's error case.
+ goto exit;
+ }
+
+ size = static_cast<UI_32>(sb.st_size - NS_SHM_HEADER_SIZE);
+
+exit:
+ close(fd);
+ return size;
+}
+
+EFrameworkunifiedStatus DiscardDataFromShared(TMemID id) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ char shmname[16];
+
+ if (id == BAD_MEM_ID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "ShMemID is invalied(%u)", id);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ create_shmname(shmname, id);
+
+ if (shm_unlink(shmname) < 0) {
+ if (errno == ENOENT) {
+ eStatus = eFrameworkunifiedStatusInvldID;
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "shm_unlink: %s", strerror(errno));
+ }
+
+ return eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem.cpp b/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem.cpp
new file mode 100755
index 0000000..fe1e9bc
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem.cpp
@@ -0,0 +1,697 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMem.
+/// This class provides API to open, read, write and close shared memory
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <unistd.h>
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_transmit_log.h>
+
+#include <string>
+
+static CNSSharedMem *g_pTransmitLogSharedBuf = NULL;
+
+#define SHM_HEADER_EXT "Hdr"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemTransmitLogOpen
+/// Open the shared memory for transmit logging
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogOpen() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == g_pTransmitLogSharedBuf) {
+ // Create the instance
+ g_pTransmitLogSharedBuf = new(std::nothrow) CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ }
+
+ if (NULL != g_pTransmitLogSharedBuf) {
+ if (!g_pTransmitLogSharedBuf->IsOpen()) {
+ // maps the shared memory buffer
+ l_eStatus = g_pTransmitLogSharedBuf->Open();
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemTransmitLogClose
+/// Close the transmit logging shared memory
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogClose() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != g_pTransmitLogSharedBuf) {
+ // un-map the shared memory object
+ l_eStatus = g_pTransmitLogSharedBuf->Close();
+
+ delete g_pTransmitLogSharedBuf;
+ g_pTransmitLogSharedBuf = NULL;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemReadTransmitLog
+/// Reads transmit log from the shared memory buffer.
+////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemReadTransmitLog(PSTR f_pBuffer, const UI_32 f_uiLength, const BOOL f_bBlock) {
+ // no. of bytes read
+ SI_32 l_iReadSize = NS_SHM_ERROR;
+
+ if (NULL != g_pTransmitLogSharedBuf && NULL != f_pBuffer) {
+ // Writes log data into shared memory buffer
+ l_iReadSize = g_pTransmitLogSharedBuf->Read(f_pBuffer, f_uiLength, f_bBlock);
+ }
+
+ return l_iReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemWriteTransmitLog
+/// Write transmit log into the shared memory buffer.
+////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemWriteTransmitLog(PCSTR f_pBuffer, const UI_32 f_uiLength) {
+ // no. of bytes read
+ SI_32 l_iWriteSize = NS_SHM_ERROR;
+
+ if (NULL != g_pTransmitLogSharedBuf && NULL != f_pBuffer) {
+ // Writes log data into shared memory buffer
+ l_iWriteSize = g_pTransmitLogSharedBuf->Write(f_pBuffer, f_uiLength);
+ }
+
+ return l_iWriteSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemDumpTransmitLogToFile
+/// Dump transmit log from the shared memory buffer into file.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemDumpTransmitLogToFile(PCSTR f_pPath, PUI_32 f_puiDumpSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ if (NULL != g_pTransmitLogSharedBuf && NULL != f_pPath) {
+ // Writes log data into shared memory buffer
+ l_eStatus = g_pTransmitLogSharedBuf->DumpToFile(f_pPath, f_puiDumpSize);
+ }
+
+ return l_eStatus;
+}
+
+// Used only in nstest_sharedmem.
+#if defined(SHM_UNITTEST_ENABLE)
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemTransmitLogIsOpen
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NSSharedMemTransmitLogIsOpen() {
+ if (g_pTransmitLogSharedBuf != NULL) {
+ return g_pTransmitLogSharedBuf->IsOpen();
+ } else {
+ return FALSE;
+ }
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMem
+/// Parameterized Constructor of CNSSharedMem class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMem::CNSSharedMem(const std::string &f_cSharedMemName, const UI_32 f_uiSize):
+ m_cShmName(f_cSharedMemName), m_uiShmBuffSize(f_uiSize), m_pShmHdr(NULL), m_pShmBuff(NULL) {
+ m_cShmHdrName = f_cSharedMemName;
+ m_cShmHdrName.append(SHM_HEADER_EXT);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMem
+/// Constructor of CNSSharedMem class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMem::CNSSharedMem():
+ m_cShmName(""), m_uiShmBuffSize(0), m_pShmHdr(NULL), m_pShmBuff(NULL) {
+ // do nothing
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNSSharedMem
+/// Destructor of CNSSharedMem class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMem::~CNSSharedMem() {
+ if (NULL != m_pShmHdr) {
+ // un-map the shared memory object
+ Close();
+
+ m_pShmHdr = NULL;
+ }
+
+ // TODO(framework_unified): currently shared memory is not being unlinked,
+ // we need to find a method where we can unlink the sharedmem
+ // shm_unlink(m_cShmName.c_str());
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Open
+/// This function opens and maps the shared memory object.
+/// It creates the shared memory if it does not exists.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::Open() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusErrOther;
+
+// Used only in nstest_sharedmem.
+#if defined(SHM_UNITTEST_ENABLE)
+ if (getenv(NSTEST_FAIL_SHAREDMEM_OPEN) != NULL) {
+ return l_eStatus;
+ }
+#endif
+
+ if (NULL == m_pShmHdr) {
+ // Open header shared memory
+ if (eFrameworkunifiedStatusOK != (l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pShmHdr),
+ m_cShmHdrName, sizeof(NSSharedBufferHdr)))) {
+ if (ENOENT == errno) { // Shared memory is not created yet
+ errno = EOK;
+
+ // Create shared memory
+ if (eFrameworkunifiedStatusOK == CreateSMHeader()) {
+ // Retry to open
+ l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pShmHdr), m_cShmHdrName, sizeof(NSSharedBufferHdr));
+ }
+ }
+ } else {
+ pthread_mutex_lock(&m_pShmHdr->m_tBufMutex);
+
+ // if shared memory buffer is created with size 0, then set new size in header if any change
+ if (0 == m_pShmHdr->m_uiShMemSize && 0 < m_uiShmBuffSize) {
+ m_pShmHdr->m_uiShMemSize = m_uiShmBuffSize;
+ } else if (0 < m_pShmHdr->m_uiShMemSize && 0 == m_uiShmBuffSize) {
+ m_uiShmBuffSize = m_pShmHdr->m_uiShMemSize;
+ } else {
+ // do nothing
+ }
+
+ pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex);
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus && 0 != m_uiShmBuffSize) {
+ if (NULL == m_pShmBuff) {
+ // Open shared memory data buffer, create if not exists
+ if (eFrameworkunifiedStatusOK != (l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pShmBuff), m_cShmName, m_uiShmBuffSize))) {
+ if (ENOENT == errno) { // Shared memory is not created yet
+ // Create shared memory
+ if (eFrameworkunifiedStatusOK == CreateSMDataBuffer()) {
+ // Retry to open
+ l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pShmBuff), m_cShmName, m_uiShmBuffSize);
+ }
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsOpen
+/// This function is used to check whether the shared memory buffer is opened or not.
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNSSharedMem::IsOpen() {
+ return NULL == m_pShmHdr ? FALSE : TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Close
+/// This function closes the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::Close() {
+ EFrameworkunifiedStatus l_eStatus1 = UnMapSM(m_pShmHdr, sizeof(NSSharedBufferHdr));
+ m_pShmHdr = NULL;
+
+ EFrameworkunifiedStatus l_eStatus2 = eFrameworkunifiedStatusOK;
+ if (0 != m_uiShmBuffSize) {
+ l_eStatus2 = UnMapSM(m_pShmBuff, m_uiShmBuffSize);
+ m_pShmBuff = NULL;
+ }
+ /*
+ * todo
+ * Even if an error occurs due to eFrameworkunifiedStatusNullPointer when UnMapSM fails,
+ * the error type cannot be determined by the caller because it is rounded to eFrameworkunifiedStatusFail
+ * if the API final determination is not OK.
+ */
+ return (eFrameworkunifiedStatusOK != l_eStatus1 || eFrameworkunifiedStatusOK != l_eStatus2) ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Read
+/// This function reads data from the shared memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMem::Read(PSTR f_pBuffer, const UI_32 f_uilength, const BOOL f_bBlock) {
+ SI_32 l_iReadSize = NS_SHM_ERROR;
+
+ if ((NULL != f_pBuffer) && (NULL != m_pShmHdr) && (0 != f_uilength)) {
+ UI_32 l_uiDataSizeToRead = 0;
+
+ // Remaining buffer size from read pointer to end of the buffer
+ UI_32 l_uiRemainSize = 0;
+
+ if (0 == pthread_mutex_lock(&m_pShmHdr->m_tBufMutex)) {
+ if ((TRUE == f_bBlock) && (0 == m_pShmHdr->m_uiUnReadSize)) {
+ pthread_cond_wait(&m_pShmHdr->m_tCondVar, &m_pShmHdr->m_tBufMutex);
+ }
+
+ // if shared memory buffer size is changed by some other process, remap the updated buffer size in this process
+ // shared memory buffer size can only be changed if the initial size is 0.
+ if (m_uiShmBuffSize != m_pShmHdr->m_uiShMemSize) {
+ if (eFrameworkunifiedStatusOK == MapSM(reinterpret_cast<PVOID *>(&m_pShmBuff), m_cShmName, m_pShmHdr->m_uiShMemSize)) {
+ m_uiShmBuffSize = m_pShmHdr->m_uiShMemSize;
+ }
+ }
+
+ if (NULL != m_pShmBuff) {
+ l_uiRemainSize = m_uiShmBuffSize - m_pShmHdr->m_uiReadPtr;
+
+ // Round read data size depending on un-read data size in the buffer
+ l_uiDataSizeToRead = m_pShmHdr->m_uiUnReadSize < f_uilength ? m_pShmHdr->m_uiUnReadSize : f_uilength;
+
+ if (l_uiRemainSize < l_uiDataSizeToRead) {
+ // Wrapping read
+ memcpy(f_pBuffer, m_pShmBuff + m_pShmHdr->m_uiReadPtr, l_uiRemainSize);
+ memcpy(f_pBuffer + l_uiRemainSize, m_pShmBuff, l_uiDataSizeToRead - l_uiRemainSize);
+ m_pShmHdr->m_uiReadPtr = l_uiDataSizeToRead - l_uiRemainSize;
+ } else {
+ memcpy(f_pBuffer, m_pShmBuff + m_pShmHdr->m_uiReadPtr, l_uiDataSizeToRead);
+
+ m_pShmHdr->m_uiReadPtr += l_uiDataSizeToRead;
+
+ // Read pointer is the end of the buffer
+ if (m_pShmHdr->m_uiReadPtr == m_uiShmBuffSize) {
+ m_pShmHdr->m_uiReadPtr = 0;
+ }
+ }
+
+ m_pShmHdr->m_uiUnReadSize -= l_uiDataSizeToRead; // Update un-read data size
+
+ l_iReadSize = l_uiDataSizeToRead;
+ }
+
+ pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex);
+ }
+ }
+
+ return l_iReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Write
+/// This function writes the data into the shared memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMem::Write(PCSTR f_pBuffer, const UI_32 f_uilength) {
+ SI_32 l_iWriteSize = NS_SHM_ERROR;
+
+ // size available in buffer
+ UI_32 l_uiRemainSize = 0;
+
+ if (NULL != m_pShmHdr && NULL != m_pShmBuff && NULL != f_pBuffer && f_uilength <= m_uiShmBuffSize) {
+ if (0 == pthread_mutex_lock(&m_pShmHdr->m_tBufMutex)) {
+ l_uiRemainSize = m_uiShmBuffSize - m_pShmHdr->m_uiWritePtr;
+
+ // Write data to the buffer
+ if (l_uiRemainSize < f_uilength) {
+ // Wrapping write
+ memcpy(m_pShmBuff + m_pShmHdr->m_uiWritePtr, f_pBuffer, l_uiRemainSize);
+ memcpy(m_pShmBuff, f_pBuffer + l_uiRemainSize, f_uilength - l_uiRemainSize);
+
+ // Update the write pointer
+ m_pShmHdr->m_uiWritePtr = f_uilength - l_uiRemainSize;
+
+ // The buffer is full of valid data
+ m_pShmHdr->m_bIsFull = TRUE;
+ } else {
+ memcpy(m_pShmBuff + m_pShmHdr->m_uiWritePtr, f_pBuffer, f_uilength);
+
+ // Update the write pointer
+ m_pShmHdr->m_uiWritePtr += f_uilength;
+
+ // Write pointer is the end of the buffer
+ if (m_pShmHdr->m_uiWritePtr == m_uiShmBuffSize) {
+ m_pShmHdr->m_uiWritePtr = 0;
+
+ // The buffer is full of valid data
+ m_pShmHdr->m_bIsFull = TRUE;
+ }
+ }
+
+ // Update un-read data size
+ m_pShmHdr->m_uiUnReadSize += f_uilength;
+
+ // Set read pointer to be same as write pointer if write pointer exceeds the read pointer
+ if (m_uiShmBuffSize < m_pShmHdr->m_uiUnReadSize) {
+ m_pShmHdr->m_uiReadPtr = m_pShmHdr->m_uiWritePtr;
+ m_pShmHdr->m_uiUnReadSize = m_uiShmBuffSize;
+ }
+
+ pthread_cond_signal(&m_pShmHdr->m_tCondVar);
+
+ pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex);
+
+ l_iWriteSize = f_uilength;
+ }
+ }
+
+ return l_iWriteSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// DumpToFile
+/// This function writes all the data in the buffer into provided file f_pPath.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ ssize_t l_iSize = 0;
+
+ SI_32 fd = -1;
+
+ if (NULL == f_uiDumpSize) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ *f_uiDumpSize = 0;
+
+ if (NULL != f_pPath) {
+ if (NULL != m_pShmHdr) {
+ // Open file
+ if (-1 != (fd = open(f_pPath, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, S_IRWXU | S_IRWXG | S_IRWXO))) {
+ if (NULL != m_pShmBuff && 0 != m_uiShmBuffSize) {
+ if (0 == pthread_mutex_lock(&m_pShmHdr->m_tBufMutex)) {
+ // Write buffer data to file
+ if (m_pShmHdr->m_bIsFull) {
+ // Buffer has full of data (read data from write pointer)
+ if (-1 != (l_iSize = write(fd, m_pShmBuff + m_pShmHdr->m_uiWritePtr,
+ m_uiShmBuffSize - m_pShmHdr->m_uiWritePtr))) {
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+
+ if (-1 != (l_iSize = write(fd, m_pShmBuff, m_pShmHdr->m_uiWritePtr))) {
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ }
+
+ if (0 != pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex)) {
+ l_eStatus = eFrameworkunifiedStatusSemUnlockFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusSemLockFail;
+ }
+ } else if (NULL == m_pShmBuff && 0 != m_uiShmBuffSize) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // do nothing
+ }
+
+ // Sync the file to force I/O operation completed
+ fsync(fd);
+
+ close(fd);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSize
+/// This function returns the number of unread bytes which can be read by Read().
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMem::GetSize() {
+ SI_32 l_uiReadSize = NS_SHM_ERROR;
+
+ if (NULL != m_pShmHdr) {
+ l_uiReadSize = m_pShmHdr->m_uiUnReadSize;
+ }
+
+ return l_uiReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearBuf
+/// This function clears the buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::ClearBuf() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmHdr) {
+ if (0 == pthread_mutex_lock(&m_pShmHdr->m_tBufMutex)) {
+ // Initialize the r/w pointers
+ m_pShmHdr->m_uiReadPtr = 0;
+ m_pShmHdr->m_uiWritePtr = 0;
+ m_pShmHdr->m_uiUnReadSize = 0;
+ m_pShmHdr->m_bIsFull = FALSE;
+
+ if (0 != pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex)) {
+ l_eStatus = eFrameworkunifiedStatusSemUnlockFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusSemLockFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReadPtrToWritePtr
+/// This function sets the position of read ptr to write ptr in buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::SetReadPtrToWritePtr() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmHdr) {
+ if (0 == pthread_mutex_lock(&m_pShmHdr->m_tBufMutex)) { // LCOV_EXCL_BR_LINE 5: pthread_mutex_lock's error case
+ // Initialize the r/w pointers
+ m_pShmHdr->m_uiReadPtr = m_pShmHdr->m_uiWritePtr;
+ m_pShmHdr->m_uiUnReadSize = 0;
+
+ if (0 != pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex)) { // LCOV_EXCL_BR_LINE 5: pthread_mutex_unlock's error
+ l_eStatus = eFrameworkunifiedStatusSemUnlockFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusSemLockFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateSMHeader
+/// This function creates the shared memory object for header.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::CreateSMHeader() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of shared memory
+ SI_32 l_siId = -1;
+
+ // shared memory buffer headers
+ NSSharedBufferHdr *l_pShmHdr = NULL;
+
+ if ((!m_cShmHdrName.empty()) && (m_cShmHdrName.size() <= NAME_MAX)) {
+ // Try to create shared memory
+ l_siId = shm_open(m_cShmHdrName.c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO);
+
+ if (-1 != l_siId) {
+ // Set the size of shared memory
+ if (-1 != ftruncate(l_siId, sizeof(NSSharedBufferHdr))) {
+ // Map the shared memory
+ l_pShmHdr = reinterpret_cast<NSSharedBufferHdr *>(mmap(NULL, sizeof(NSSharedBufferHdr),
+ (PROT_READ | PROT_WRITE), MAP_SHARED, l_siId, 0));
+
+ if (MAP_FAILED != l_pShmHdr) {
+ // mutex attribute
+ pthread_mutexattr_t l_tMtxAttr = {};
+ pthread_condattr_t l_tCondAttr = {};
+
+ // Initialize mutex
+ pthread_mutexattr_init(&l_tMtxAttr);
+ pthread_mutexattr_setpshared(&l_tMtxAttr, PTHREAD_PROCESS_SHARED);
+ pthread_mutex_init(&l_pShmHdr->m_tBufMutex, &l_tMtxAttr);
+ pthread_mutexattr_destroy(&l_tMtxAttr);
+
+ pthread_condattr_init(&l_tCondAttr);
+ pthread_condattr_setpshared(&l_tCondAttr, PTHREAD_PROCESS_SHARED);
+ pthread_cond_init(&l_pShmHdr->m_tCondVar, &l_tCondAttr);
+ pthread_condattr_destroy(&l_tCondAttr);
+
+ pthread_mutex_lock(&l_pShmHdr->m_tBufMutex);
+
+ // Initialize the r/w pointers
+ l_pShmHdr->m_uiReadPtr = 0;
+ l_pShmHdr->m_uiWritePtr = 0;
+ l_pShmHdr->m_uiUnReadSize = 0;
+ l_pShmHdr->m_bIsFull = FALSE;
+ l_pShmHdr->m_uiShMemSize = m_uiShmBuffSize;
+
+ pthread_mutex_unlock(&l_pShmHdr->m_tBufMutex);
+
+ // Once initialized un-map the shared memory
+ munmap(l_pShmHdr, sizeof(NSSharedBufferHdr));
+
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+
+ close(l_siId);
+ } else if (EEXIST == errno) {
+ // Shared memory is already created
+ l_eStatus = eFrameworkunifiedStatusDuplicate;
+ } else {
+ // do nothing
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateSMDataBuffer
+/// This function creates the shared memory object for data buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::CreateSMDataBuffer() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of shared memory
+ SI_32 l_siId = -1;
+
+ if ((!m_cShmName.empty()) && (m_cShmName.size() <= NAME_MAX)) {
+ // Try to create shared memory
+ l_siId = shm_open(m_cShmName.c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO);
+
+ if (-1 != l_siId) {
+ // Set the size of shared memory
+ if (-1 != ftruncate(l_siId, m_uiShmBuffSize)) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ close(l_siId);
+ } else if (EEXIST == errno) {
+ // Shared memory is already created
+ l_eStatus = eFrameworkunifiedStatusDuplicate;
+ } else {
+ // do nothing
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// MapSMHeader
+/// This function open and maps the shared memory header in process space.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::MapSM(PVOID *f_pShMem, const std::string &f_cShmName, const UI_32 f_uiShmSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of shared memory
+ SI_32 l_siId = -1;
+
+ // shared memory buffer headers
+ PVOID l_pShmBuf = NULL;
+
+ // Open shared memory
+ l_siId = shm_open(f_cShmName.c_str(), O_RDWR, 0);
+
+ if (-1 != l_siId) {
+ // Map the shared memory into its memory space
+ l_pShmBuf = mmap(NULL, f_uiShmSize, (PROT_READ | PROT_WRITE), MAP_SHARED, l_siId, 0);
+
+ if (MAP_FAILED != l_pShmBuf) {
+ *f_pShMem = l_pShmBuf;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ close(l_siId);
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// UnMapSM
+/// This function unmaps the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::UnMapSM(PVOID f_pShMem, const UI_32 f_uiShmSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // Un-map the shared memory
+ if (NULL != f_pShMem) {
+ if (0 != munmap(f_pShMem, f_uiShmSize)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_reader.cpp b/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_reader.cpp
new file mode 100755
index 0000000..79f9f54
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_reader.cpp
@@ -0,0 +1,169 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMemReader.
+/// This class provides API to open, close and perform read operation on shared memory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_reader.h>
+#include <string>
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMemReader
+/// Constructor of CNSSharedMemReader class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemReader::CNSSharedMemReader(): m_pShmReader(NULL), m_bBlock(TRUE) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMemReader
+/// Parameterized Constructor of CNSSharedMemReader class
+/// This creates the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemReader::CNSSharedMemReader(const std::string &f_cSharedMemName, const BOOL f_bBlock): m_bBlock(f_bBlock) {
+ m_pShmReader = new(std::nothrow) CNSSharedMem(f_cSharedMemName, 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNSSharedMemReader
+/// Destructor of CNSSharedMemReader class.
+/// Closes the shared memory, if it is open.
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemReader::~CNSSharedMemReader() {
+ if (NULL != m_pShmReader) {
+ if (m_pShmReader->IsOpen()) {
+ m_pShmReader->Close();
+ }
+
+ delete m_pShmReader;
+ m_pShmReader = NULL;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Open
+/// This function opens and maps the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemReader::Open() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmReader) {
+ l_eStatus = m_pShmReader->Open();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsOpen
+/// This function is used to check whether the shared memory buffer is opened or not.
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNSSharedMemReader::IsOpen() {
+ BOOL l_bOpen = FALSE;
+
+ if (NULL != m_pShmReader) {
+ l_bOpen = m_pShmReader->IsOpen();
+ }
+
+ return l_bOpen;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Close
+/// This function unmaps the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemReader::Close() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmReader) {
+ l_eStatus = m_pShmReader->Close();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Read
+/// This function reads data from the shared memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMemReader::Read(PSTR buffer, const UI_32 f_uilength) {
+ SI_32 l_iReadSize = NS_SHM_ERROR;
+
+ if (NULL != m_pShmReader) {
+ l_iReadSize = m_pShmReader->Read(buffer, f_uilength, m_bBlock);
+ }
+
+ return l_iReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// DumpToFile
+/// This function writes all the data in the buffer into provided file f_pPath.
+/// This function does not changes the unread buffer.
+/// This function overwrites the file if it exists.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemReader::DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmReader) {
+ l_eStatus = m_pShmReader->DumpToFile(f_pPath, f_uiDumpSize);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSize
+/// This function returns the number of unread bytes which can be read by Read().
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMemReader::GetSize() {
+ UI_32 l_uiReadSize = NS_SHM_ERROR;
+
+ if (NULL != m_pShmReader) {
+ l_uiReadSize = m_pShmReader->GetSize();
+ }
+
+ return l_uiReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReadPtrToWritePtr
+/// This function sets the position of read ptr to write ptr in buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemReader::SetReadPtrToWritePtr() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmReader) {
+ l_eStatus = m_pShmReader->SetReadPtrToWritePtr();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_writer.cpp b/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_writer.cpp
new file mode 100755
index 0000000..2561415
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_writer.cpp
@@ -0,0 +1,137 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMemReader.
+/// This class provides API to open, close and perform read operation on shared memory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_writer.h>
+#include <string>
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMemWriter
+/// Constructor of CNSSharedMemWriter class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemWriter::CNSSharedMemWriter(): m_pShmWriter(NULL) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMemWriter
+/// Parameterized Constructor of CNSSharedMemWriter class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemWriter::CNSSharedMemWriter(const std::string &f_cSharedMemName, const UI_32 f_uiSize) {
+ m_pShmWriter = new(std::nothrow) CNSSharedMem(f_cSharedMemName, f_uiSize);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNSSharedMemWriter
+/// Destructor of CNSSharedMemWriter class.
+/// Closes the shared memory, if it is open.
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemWriter::~CNSSharedMemWriter() {
+ if (NULL != m_pShmWriter) {
+ if (m_pShmWriter->IsOpen()) {
+ m_pShmWriter->Close();
+ }
+
+ delete m_pShmWriter;
+ m_pShmWriter = NULL;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Open
+/// This function opens and maps the shared memory object.
+/// It creates the shared memory if it does not exists.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemWriter::Open() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmWriter) {
+ l_eStatus = m_pShmWriter->Open();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsOpen
+/// This function is used to check whether the shared memory buffer is opened or not.
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNSSharedMemWriter::IsOpen() {
+ BOOL l_bOpen = FALSE;
+
+ if (NULL != m_pShmWriter) {
+ l_bOpen = m_pShmWriter->IsOpen();
+ }
+
+ return l_bOpen;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Close
+/// This function unmaps the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemWriter::Close() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmWriter) {
+ l_eStatus = m_pShmWriter->Close();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Write
+/// This function writes the data into the shared memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMemWriter::Write(PCSTR buffer, const UI_32 f_uilength) {
+ SI_32 l_iWriteSize = NS_SHM_ERROR;
+
+ if ((NULL != m_pShmWriter) && (NULL != buffer) && (0 != f_uilength)) {
+ l_iWriteSize = m_pShmWriter->Write(buffer, f_uilength);
+ }
+
+ return l_iWriteSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearBuf
+/// This function clears the shared memory buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemWriter::ClearBuf() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmWriter) {
+ l_eStatus = m_pShmWriter->ClearBuf();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_Timer/cfg/depends.mk b/nsframework/framework_unified/client/NS_Timer/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Timer/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_Timer/include/ns_timer_handle.h b/nsframework/framework_unified/client/NS_Timer/include/ns_timer_handle.h
new file mode 100755
index 0000000..7d082e7
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Timer/include/ns_timer_handle.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSTimer
+/// \brief Contains the internal structures that used by ns_timer
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_HANDLE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_HANDLE_H_
+#include <stdio.h>
+#include <time.h>
+#include <signal.h>
+#include <native_service/frameworkunified_types.h>
+
+typedef void (*pfCb)(UI_16 cmd);
+
+/// \brief Struct that defines internal function callback for a timer
+typedef struct _TimerNotifyInfo {
+ UI_16 iCmd;
+ PSTR q_name;
+} TTimerInfo, *PTimerInfo;
+
+/// \brief Struct that defines internal handle object for a timer
+typedef struct _NSTimerHandle {
+ int timerfd;
+ struct itimerspec itime;
+ PTimerInfo tTimerInfo;
+ UI_8 timerState;
+} NSTimerHandle, *PNSTimerHandle;
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_HANDLE_H_
diff --git a/nsframework/framework_unified/client/NS_Timer/include/ns_timer_internal.h b/nsframework/framework_unified/client/NS_Timer/include/ns_timer_internal.h
new file mode 100755
index 0000000..43418a2
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Timer/include/ns_timer_internal.h
@@ -0,0 +1,28 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSTimer
+/// \brief Contains the internal APIs that used by NS_Timer
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_INTERNAL_H_
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_Timer/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_Timer/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..b3eb74d
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Timer/src/makefile_PosixBasedOS001
@@ -0,0 +1,206 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_Timer
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_Timer
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+ifdef DYNAMIC
+ DYNAMIC_LIBS += \
+ NS_MessageCenter$(DEBUG_EXT)
+else
+ STATIC_LIBS +=
+endif
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+module_dirs: build_dirs
diff --git a/nsframework/framework_unified/client/NS_Timer/src/mod_version.c b/nsframework/framework_unified/client/NS_Timer/src/mod_version.c
new file mode 100755
index 0000000..c6e28eb
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Timer/src/mod_version.c
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_ModVersion
+/// \brief Identifies module version
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <native_service/frameworkunified_types.h>
+
+#define MOD_VERSION_LENGTH 12
+
+
+
+static CHAR s_ModVersion[MOD_VERSION_LENGTH + 1] = "0.0.0";
+
+SI_8 GetModuleVersion(CHAR *pRetBuf, UI_8 nBufLen) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ UI_8 CopyLen = 0;
+ SI_8 RetVal = -1;
+
+ if (NULL != pRetBuf) {
+ CopyLen = MIN_VAL(nBufLen, MOD_VERSION_LENGTH);
+ strncpy(pRetBuf, s_ModVersion, CopyLen);
+ pRetBuf[CopyLen] = '\0';
+ RetVal = 0;
+ }
+ return RetVal;
+}
+// LCOV_EXCL_STOP
+
diff --git a/nsframework/framework_unified/client/NS_Timer/src/ns_timer.c b/nsframework/framework_unified/client/NS_Timer/src/ns_timer.c
new file mode 100755
index 0000000..d24264b
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Timer/src/ns_timer.c
@@ -0,0 +1,514 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSTimer
+/// \brief Native Services Timer Interface code
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <unistd.h>
+#include <string.h>
+#include <malloc.h>
+#include <errno.h>
+#include <sys/epoll.h>
+#include <sys/eventfd.h>
+#include <sys/timerfd.h>
+#include <sys/prctl.h>
+
+#include <native_service/ns_timer_if.h>
+#include <ns_timer_handle.h>
+#include <native_service/ns_message_center_if.h>
+#include <ns_timer_internal.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_resource_controler.h>
+
+#define INVALID_TIMERFD -1
+
+#define RUNNING_STATE 0
+#define DELETING_STATE 1
+#define DELETED_STATE 2
+
+#define MAX_FD_EPOLL 10
+
+int epollFd; // To listen to multiple timerfd events.
+int eventFd; // To use not complete at epoll_wait
+pthread_t timerTh_id = 0; // Thread ID of the TimerMonitoringThread
+pthread_mutex_t m_mtx = PTHREAD_MUTEX_INITIALIZER;
+
+const UI_32 MS_IN_SEC = 1000;
+const UI_64 NS_IN_MS = 1000000;
+
+BOOL DebugFlag = FALSE;
+
+static PVOID TimerMonitoringThread(PVOID args) {
+ struct epoll_event events[MAX_FD_EPOLL];
+ int nfds; // The number of events received
+ int n; // Loop counter
+ PNSTimerHandle hTimer;
+ char *p, name[32];
+ uint64_t exp;
+
+ // Thread naming
+#define NSTIMER_APPEND_NAME "_T"
+#ifndef NSTIMER_SIZE_PROCESSNAME
+#define NSTIMER_SIZE_PROCESSNAME 15 // Profiler analysis tool name length limitations
+#endif
+ prctl(PR_GET_NAME, name);
+ name[NSTIMER_SIZE_PROCESSNAME] = '\0';
+ if (strlen(name) + strlen(NSTIMER_APPEND_NAME) > NSTIMER_SIZE_PROCESSNAME) {
+ p = name + NSTIMER_SIZE_PROCESSNAME - strlen(NSTIMER_APPEND_NAME);
+ } else {
+ p = name + strlen(name);
+ }
+ strcpy(p, NSTIMER_APPEND_NAME);
+ prctl(PR_SET_NAME, name);
+
+ for (;;) {
+ nfds = epoll_wait(epollFd, events, MAX_FD_EPOLL, -1);
+ if (-1 != nfds) {
+ for (n = 0; n < nfds; ++n) {
+ hTimer = (PNSTimerHandle)events[n].data.ptr;
+ if (NULL != hTimer) {
+ if (-1 == read(hTimer->timerfd, &exp, sizeof(uint64_t))) {
+ if (errno != EAGAIN) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Failed to read in timeout : fd=%d, errno=%d",
+ hTimer->timerfd, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ continue;
+ }
+
+ if (RUNNING_STATE == hTimer->timerState) {
+ if (NULL != hTimer->tTimerInfo) {
+ EFrameworkunifiedStatus eStatus;
+ HANDLE hReceiver = NULL;
+ if (frameworkunifiedAcquireResouce(FRAMEWORKUNIFIED_RES_TIMER, hTimer->tTimerInfo->q_name, (long *)&hReceiver) < 0) {
+ if ((hReceiver = McOpenSender(hTimer->tTimerInfo->q_name)) == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : McOpenSender is Failed");
+ // LCOV_EXCL_BR_STOP
+ continue;
+ } else {
+ if (frameworkunifiedRegistResouce(FRAMEWORKUNIFIED_RES_TIMER, hTimer->tTimerInfo->q_name, (long)hReceiver, 1) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : frameworkunifiedRegistResouce is Failed : q_name=%s",
+ hTimer->tTimerInfo->q_name);
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ }
+
+ eStatus = McSendWithPriority(hReceiver,
+ TIMER_QUE,
+ hTimer->tTimerInfo->iCmd,
+ 0,
+ NULL,
+ eFrameworkunifiedMsgPrioEmergency,
+ 0);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : McSendWithPriority to %s is Failed, eStatus=%d", hTimer->tTimerInfo->q_name,
+ eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR(RUNNING_STATE) : tTimerInfo is NULL");
+ // LCOV_EXCL_BR_STOP
+ }
+ } else if (DELETED_STATE == hTimer->timerState) {
+ if (-1 == epoll_ctl(epollFd, EPOLL_CTL_DEL, hTimer->timerfd, events)) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(DEL) Failed, fd=%d, errno=%d",
+ hTimer->timerfd, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ if (-1 == close(hTimer->timerfd)) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : close(fd=%d) Failed, errno=%d", hTimer->timerfd, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ hTimer->timerfd = INVALID_TIMERFD;
+
+ if (NULL != hTimer->tTimerInfo) {
+ HANDLE hReceiver;
+ if (frameworkunifiedAcquireResouce(FRAMEWORKUNIFIED_RES_TIMER, hTimer->tTimerInfo->q_name, (long *)&hReceiver) >= 0) {
+ if (frameworkunifiedReleaseResouce(FRAMEWORKUNIFIED_RES_TIMER, hTimer->tTimerInfo->q_name) <= 0) {
+ frameworkunifiedUnregistResouce(FRAMEWORKUNIFIED_RES_TIMER, hTimer->tTimerInfo->q_name);
+ McClose(hReceiver);
+ }
+ }
+ free(hTimer->tTimerInfo->q_name);
+ free(hTimer->tTimerInfo); // delete the timer info
+ hTimer->tTimerInfo = NULL;
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR(DELETED_STATE) : tTimerInfo is NULL");
+ // LCOV_EXCL_BR_STOP
+ }
+
+ free(hTimer); // delete the handle
+ events[n].data.ptr = NULL;
+ } else {
+ // do nothing
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : hTimer is NULL");
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ } else {
+ if (errno == EINTR) {
+ // signal interrupt
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_wait Failed, errno=%d", errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ }
+ return NULL;
+}
+
+static EFrameworkunifiedStatus CreateTimerMonitoringThread() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ struct epoll_event ev; // Info struct to associate with multiwaiting FD
+ int ret;
+
+ pthread_mutex_lock(&m_mtx);
+
+ // Create the TimerMonitoringThread If the thread has not been generated.
+ if (0 == timerTh_id) {
+ epollFd = epoll_create1(EPOLL_CLOEXEC);
+ if (-1 != epollFd) {
+ eventFd = eventfd(0, EFD_CLOEXEC);
+ if (-1 != eventFd) {
+ ev.events = EPOLLIN;
+ ev.data.fd = eventFd;
+ if (-1 != epoll_ctl(epollFd, EPOLL_CTL_ADD, eventFd, &ev)) {
+ if (0 != (ret = pthread_create(&timerTh_id, NULL, TimerMonitoringThread, NULL))) {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Failed to pthread_create : errno %d", ret);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(eventFd=%d, ADD) Failed, status=%d, errno=%d", eventFd, eStatus,
+ errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR :eventfd Failed, status=%d, errno=%d", eStatus, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_create1 Failed, status=%d, errno=%d",
+ eStatus, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ }
+
+ if (TRUE == DebugFlag) { // LCOV_EXCL_BR_LINE 7: debug code
+ // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "[DEBUG] sleep 3 Sec START.");
+ sleep(3);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "[DEBUG] sleep 3 Sec END.");
+ // LCOV_EXCL_STOP
+ }
+ pthread_mutex_unlock(&m_mtx);
+
+ return eStatus;
+}
+
+HANDLE NS_TimerCreate(NSTimerInfo timer_info, eNSTimerCallbackMechanism cbMech, HANDLE sndMqHndl) {
+ PNSTimerHandle hTimer = NULL;
+
+ if ((NULL != sndMqHndl) && (cbMech == CALLBACK_MESSAGE)) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ PTimerInfo pTimerInfo = NULL;
+ struct epoll_event ev; // Info struct to associate with multiwaiting FD
+ int timerfd = INVALID_TIMERFD;
+
+ eStatus = CreateTimerMonitoringThread();
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ hTimer = (PNSTimerHandle)malloc(sizeof(NSTimerHandle));
+ if (NULL != hTimer) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+ pTimerInfo = (PTimerInfo)malloc(sizeof(TTimerInfo));
+
+ if (NULL != pTimerInfo) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+ hTimer->timerState = RUNNING_STATE;
+
+ // set the timer info structure
+ PCSTR pName = McGetQueueName(sndMqHndl);
+ if (NULL != pName) {
+ pTimerInfo->q_name = strdup(pName);
+ } else {
+ pTimerInfo->q_name = NULL;
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : McGetQueueName(sndMqHndl) Failed, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ pTimerInfo->iCmd = timer_info.iCmd;
+
+ hTimer->tTimerInfo = pTimerInfo;
+ if (INVALID_TIMERFD != (timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC|TFD_NONBLOCK))) {
+ ev.events = EPOLLIN;
+ ev.data.ptr = hTimer;
+ if (-1 != epoll_ctl(epollFd, EPOLL_CTL_ADD, timerfd, &ev)) {
+ hTimer->timerfd = timerfd;
+ if (eFrameworkunifiedStatusOK == NS_TimerSetTime(hTimer, timer_info)) {
+ // set the interval in timer handle
+ hTimer->itime.it_value.tv_sec = (__time_t)timer_info.t_sec;
+ hTimer->itime.it_value.tv_nsec = (__syscall_slong_t)timer_info.t_nsec;
+ hTimer->itime.it_interval.tv_sec = (__time_t)timer_info.rpt_sec;
+ hTimer->itime.it_interval.tv_nsec = (__syscall_slong_t)timer_info.rpt_nsec;
+
+ } else {
+ eStatus = eFrameworkunifiedStatusErrOther;
+
+ // if timer interval is not set or memory is not allocated for hTimer
+ close(timerfd);
+ timerfd = INVALID_TIMERFD;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(timerfd=%d, ADD) Failed, status=%d, errno=%d", timerfd, eStatus,
+ errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : (PTimerInfo)malloc(sizeof(TTimerInfo)) Failed, status=%d", eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ if (NULL != pTimerInfo) {
+ if (NULL != pTimerInfo->q_name) {
+ free(pTimerInfo->q_name);
+ pTimerInfo->q_name = NULL;
+ }
+
+ free(pTimerInfo);
+ pTimerInfo = NULL;
+ }
+
+ if (NULL != hTimer) {
+ free(hTimer);
+ hTimer = NULL;
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : malloc(sizeof(NSTimerHandle)) Failed");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : CreateTimerMonitoringThread Failed, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Invalid param");
+ // LCOV_EXCL_BR_STOP
+ }
+
+ return hTimer;
+}
+
+EFrameworkunifiedStatus NS_TimerDelete(HANDLE hTimer) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (NULL != hTimer) {
+ PNSTimerHandle tTimerHndl = (PNSTimerHandle)hTimer;
+ /**
+ * @todo
+ * Dropping by typing the service handle instead of the timer handle
+ */
+ if (DELETED_STATE != tTimerHndl->timerState) {
+ if (NULL != tTimerHndl->tTimerInfo) {
+ tTimerHndl->timerState = DELETING_STATE;
+ NSTimerInfo timer_info = {1, 0, tTimerHndl->tTimerInfo->iCmd, 0, 0};
+
+ if (eFrameworkunifiedStatusOK != (eStatus = NS_TimerSetTime(tTimerHndl, timer_info))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "ERROR : NS_TimerSetTime for Timer delete Failed, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ tTimerHndl->timerState = DELETED_STATE;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : tTimerInfo is NULL, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Timer is not RUNNING State, timerStatus=%d, status=%d",
+ tTimerHndl->timerState, eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : hTimer is NULL, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus NS_TimerSetTime(HANDLE hTimer, NSTimerInfo timer_info) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hTimer) {
+ PNSTimerHandle tTimerHndl = (PNSTimerHandle)hTimer;
+ struct itimerspec itime;
+
+ if (DELETED_STATE != tTimerHndl->timerState) {
+ // set periodic interval values
+ itime.it_value.tv_sec = (__time_t)timer_info.t_sec;
+ itime.it_value.tv_nsec = (__syscall_slong_t)timer_info.t_nsec;
+
+ // set periodic interval values
+ itime.it_interval.tv_sec = (__time_t)timer_info.rpt_sec;
+ itime.it_interval.tv_nsec = (__syscall_slong_t)timer_info.rpt_nsec;
+
+ if (-1 != timerfd_settime(tTimerHndl->timerfd, 0, &itime, NULL)) {
+ // updated the value of the timer values in the handler
+ tTimerHndl->itime = itime;
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : timerfd_settime is failed, status=%d, errno=%d", eStatus, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Timer is not RUNNING State, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : hTimer is NULL, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus NS_TimerGetTime(HANDLE hTimer, NSTimerInfo *timer_info) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((NULL != hTimer) && (NULL != timer_info)) {
+ PNSTimerHandle tTimerHndl = (PNSTimerHandle)hTimer;
+ struct itimerspec itime;
+
+ if (DELETED_STATE != tTimerHndl->timerState) {
+ if (-1 != timerfd_gettime(tTimerHndl->timerfd, &itime)) {
+ // set periodic interval values
+
+// timer_info->t_sec = (UI_32)itime.it_value.tv_sec;
+ timer_info->t_sec = itime.it_value.tv_sec;
+ timer_info->t_nsec = (UI_64)itime.it_value.tv_nsec;
+
+ // set periodic interval values
+
+// timer_info->rpt_sec = (UI_32)itime.it_interval.tv_sec;
+ timer_info->rpt_sec = itime.it_interval.tv_sec;
+ timer_info->rpt_nsec = (UI_64)itime.it_interval.tv_nsec;
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : timerfd_gettime is failed, status=%d, errno=%d", eStatus, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Timer is not RUNNING State, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Invalid param, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ return eStatus;
+}
+
+
+//UI_32 WholeSeconds(UI_32 ms) {
+// return ms / MS_IN_SEC;
+//}
+time_t WholeSeconds(UI_32 ms) {
+ return (time_t)(ms / MS_IN_SEC);
+}
+
+
+UI_32 RemainderMs(UI_32 ms) {
+ return ms % MS_IN_SEC;
+}
+
+UI_64 MSToNS(UI_32 ms) {
+ return (UI_64)ms * NS_IN_MS;
+}
+
+void NS_TimerDebugOn(BOOL FlagState) { // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (DebugFlag != FlagState) {
+ DebugFlag = FlagState;
+ if (TRUE == DebugFlag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "NS_Timer debugging is enabled.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "NS_Timer debugging is disabled.");
+ }
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/nsframework/framework_unified/client/NS_Timer/src/ns_timer_class.cpp b/nsframework/framework_unified/client/NS_Timer/src/ns_timer_class.cpp
new file mode 100755
index 0000000..47b41e9
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Timer/src/ns_timer_class.cpp
@@ -0,0 +1,177 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSTimer
+/// \brief
+///
+/// Timer class for setting timers.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_timer_if.hpp>
+#include <native_service/ns_message_center_if.h>
+#include <string.h>
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// Constructor
+//////////////////////////////////////////////////////////////////////////////////////////////
+NSTimer::NSTimer():
+ m_hTimer(NULL),
+ m_u64TimeInterval(0),
+ m_bRepeatTimer(FALSE) {
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// Destructor
+//////////////////////////////////////////////////////////////////////////////////////////////
+NSTimer::~NSTimer() {
+ if (NULL != m_hTimer) {
+ NS_TimerDelete(m_hTimer);
+ m_hTimer = NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// SetNotifyMethod
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSTimer::SetNotifyMethod(UI_16 notifyCmdId, PCSTR notifyToAppName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ NSTimerInfo l_tTimerInfo = {};
+
+ if ((NULL != notifyToAppName) && (strlen(notifyToAppName) <= MAX_SERVICE_NAME)) {
+ HANDLE l_hSenderHandle = McOpenSender(notifyToAppName);
+
+ if (NULL != l_hSenderHandle) { // reset previous notify method, and set new
+ // resets previous timer timeout action if any
+ if (NULL != m_hTimer) {
+ NS_TimerDelete(m_hTimer);
+ m_hTimer = NULL;
+ }
+
+ l_tTimerInfo.iCmd = notifyCmdId;
+ // Create timer. Do not start.
+ if (NULL == (m_hTimer = NS_TimerCreate(l_tTimerInfo, CALLBACK_MESSAGE, l_hSenderHandle))) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ McClose(l_hSenderHandle);
+ } else {
+ // just return fail. Don't reset any previous notify method
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// SetRepeatTimer
+//////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSTimer::SetRepeatTimer(BOOL repeatTimer) {
+ m_bRepeatTimer = repeatTimer;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// SetTime
+//////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSTimer::SetTime(UI_32 seconds, UI_64 msecs) {
+ m_u64TimeInterval = msecs + seconds * 1000ULL; // internally, set interval as milliseconds
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// SetTime
+//////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSTimer::SetTime(UI_32 hrs, UI_32 mins, UI_32 seconds, UI_64 msecs) {
+ // internally, set interval as milliseconds
+ m_u64TimeInterval = msecs + seconds * 1000ULL + mins * 60000ULL + hrs * 3600000ULL;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// Start
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSTimer::Start(UI_32 seconds, UI_64 msecs) {
+ this->SetTime(seconds, msecs);
+ return (this->Start());
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// Start
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSTimer::Start() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (NULL != m_hTimer) {
+ NSTimerInfo l_tTimerInfo = {};
+
+ l_tTimerInfo.t_sec = WholeSeconds(static_cast<UI_32>(m_u64TimeInterval)); /// Converts to seconds
+ l_tTimerInfo.t_nsec = MSToNS(RemainderMs(static_cast<UI_32>(m_u64TimeInterval))); /// Converts to nano seconds
+
+ if (TRUE == m_bRepeatTimer) {
+ l_tTimerInfo.rpt_sec = l_tTimerInfo.t_sec;
+ l_tTimerInfo.rpt_nsec = l_tTimerInfo.t_nsec;
+ }
+ l_eStatus = NS_TimerSetTime(m_hTimer, l_tTimerInfo);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// Stop
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSTimer::Stop() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_hTimer) {
+ NSTimerInfo l_tTimerInfo = {};
+ l_eStatus = NS_TimerSetTime(m_hTimer, l_tTimerInfo);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// IsRunning
+//////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NSTimer::IsRunning() {
+ BOOL l_bIsRunning = FALSE;
+
+ if (NULL != m_hTimer) {
+ NSTimerInfo l_tTimerInfo = {};
+ NS_TimerGetTime(m_hTimer, &l_tTimerInfo);
+ if ((0 != l_tTimerInfo.t_sec) || (0 != l_tTimerInfo.t_nsec) || (0 != l_tTimerInfo.rpt_sec) ||
+ (0 != l_tTimerInfo.rpt_nsec)) {
+ l_bIsRunning = TRUE;
+ }
+ }
+ return l_bIsRunning;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// GetInterval
+//////////////////////////////////////////////////////////////////////////////////////////////
+UI_64 NSTimer::GetInterval() {
+ return m_u64TimeInterval;
+}
+
+// EOF
diff --git a/nsframework/framework_unified/client/NS_Utility/Makefile b/nsframework/framework_unified/client/NS_Utility/Makefile
new file mode 100755
index 0000000..2f4dfef
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Utility/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS = buildversioncheck
+
+include ../../../native_service.mk
diff --git a/nsframework/framework_unified/client/NS_Utility/buildversioncheck/Makefile b/nsframework/framework_unified/client/NS_Utility/buildversioncheck/Makefile
new file mode 100755
index 0000000..03ca87c
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Utility/buildversioncheck/Makefile
@@ -0,0 +1,21 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := library
+
+
+
+include ../../../../native_service.mk
diff --git a/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/Makefile b/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/Makefile
new file mode 100755
index 0000000..e1b0a6d
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/Makefile
@@ -0,0 +1,62 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+
+
+######### installed library(*.a) #############
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libNS_BuildVersionCheck
+
+######### install headers(*.h) #############
+
+######### compiled sources #############
+libNS_BuildVersionCheck_SRCS = NS_BuildVersionCheck.cpp
+
+######### add source path #############
+VPATH += ./src
+
+######### add include path #############
+CPPFLAGS += -I./../../../include/
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fdata-sections -ffunction-sections -DFLG_LEGACY
+
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+CPPFLAGS += -DBUILD_VERSION=PastModel002_stable_c1_I20130701-0000
+
+CPPFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -g -Wl,--gc-sections -shared
+
+LDLIBS += -Wl,-Bdynamic -lstdc++
+
+######### linked library #############
+
+######### linked library (dynamic) #############
+
+######### add library path #############
+
+include ../../../../../native_service.mk
diff --git a/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/src/NS_BuildVersionCheck.cpp b/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/src/NS_BuildVersionCheck.cpp
new file mode 100755
index 0000000..633797b
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/src/NS_BuildVersionCheck.cpp
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// Interfaces
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_buildversioncheck.hpp>
+#include <cstdlib>
+#include <cstring>
+
+namespace {
+
+namespace frameworkunified_ns_bvc {
+
+const UI_32 kMaxBuildVersionLength = 32;
+PCSTR g_build_version_env_var_name = "BUILD_VERSION";
+PCSTR g_build_version = _BUILD_VERSION; // Should be defined when library is built
+
+bool isEmptyString(PCSTR str) { // NOLINT (readability/nolint)
+ return 0 == std::strncmp("", str, 1);
+}
+
+} // namespace frameworkunified_ns_bvc
+
+} // namespace
+
+namespace frameworkunified {
+
+namespace ns {
+
+namespace utility {
+
+BOOL buildVersionsMatch(PCSTR build_version) { // NOLINT (readability/nolint)
+ PCSTR env_build_version = getEnvironmentBuildVersion();
+ PCSTR lib_build_version = getLibraryBuildVersion();
+ return 0 == std::strncmp(env_build_version, build_version, frameworkunified_ns_bvc::kMaxBuildVersionLength) &&
+ 0 == std::strncmp(lib_build_version, build_version, frameworkunified_ns_bvc::kMaxBuildVersionLength) &&
+ !frameworkunified_ns_bvc::isEmptyString(build_version) &&
+ !frameworkunified_ns_bvc::isEmptyString(env_build_version) &&
+ !frameworkunified_ns_bvc::isEmptyString(lib_build_version);
+}
+
+PCSTR getEnvironmentBuildVersion() { // NOLINT (readability/nolint)
+ static PCSTR env_version = std::getenv(frameworkunified_ns_bvc::g_build_version_env_var_name);
+ return env_version != NULL ? env_version : "";
+}
+
+PCSTR getLibraryBuildVersion() { // NOLINT (readability/nolint)
+ return frameworkunified_ns_bvc::g_build_version;
+}
+
+namespace utility_private {
+
+PCSTR niceBuildVersion(PCSTR build_version) { // NOLINT (readability/nolint)
+ return frameworkunified_ns_bvc::isEmptyString(build_version) ? "<Not defined>" : build_version;
+}
+
+} // namespace utility_private
+
+} // namespace utility
+
+} // namespace ns
+
+} // namespace frameworkunified
diff --git a/nsframework/framework_unified/client/NS_UtilityCenter/cfg/depends.mk b/nsframework/framework_unified/client/NS_UtilityCenter/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_UtilityCenter/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_if_internal.h b/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_if_internal.h
new file mode 100755
index 0000000..fc0b761
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_if_internal.h
@@ -0,0 +1,193 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains declaration of common APIs for NS_UtilityCenter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_utility_if_internal.h
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_IF_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_IF_INTERNAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of leading zeros in a given 16bit value.
+/// \~english @param [in] f_ui_val
+/// UI_16 - the value to be counted
+/// \~english @retval the number of leading zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of leading zeros in a given 16bit value.
+/// \~english @see NS_CountLeadingZeros_32Bit NS_CountLeadingZeros_64Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountLeadingZeros_16Bit(UI_16 f_ui_val); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of leading zeros in a given 32bit value.
+/// \~english @param [in] f_ui_val
+/// UI_32 - the value to be counted
+/// \~english @retval the number of leading zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of leading zeros in a given 32bit value.
+/// \~english @see NS_CountLeadingZeros_16Bit NS_CountLeadingZeros_64Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountLeadingZeros_32Bit(UI_32 f_ui_val); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of leading zeros in a given 64bit value.
+/// \~english @param [in] f_ui_val
+/// UI_64 - the value to be counted
+/// \~english @retval the number of leading zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of leading zeros in a given 64bit value.
+/// \~english @see NS_CountLeadingZeros_16Bit NS_CountLeadingZeros_32Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountLeadingZeros_64Bit(UI_64 f_ui_val); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of trailing zeros in a given 16bit value.
+/// \~english @param [in] f_ui_val
+/// UI_16 - the value to be counted
+/// \~english @retval the number of trailing zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of trailing zeros in a given 16bit value.
+/// \~english @see NS_CountTrailingZeros_32Bit NS_CountTrailingZeros_64Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountTrailingZeros_16Bit(UI_16 f_ui_val); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of trailing zeros in a given 32bit value.
+/// \~english @param [in] f_ui_val
+/// UI_32 - the value to be counted
+/// \~english @retval the number of trailing zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of trailing zeros in a given 32bit value.
+/// \~english @see NS_CountTrailingZeros_16Bit NS_CountTrailingZeros_64Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountTrailingZeros_32Bit(UI_32 f_ui_val); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of trailing zeros in a given 64bit value.
+/// \~english @param [in] f_ui_val
+/// UI_64 - the value to be counted
+/// \~english @retval the number of trailing zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of trailing zeros in a given 64bit value.
+/// \~english @see NS_CountTrailingZeros_16Bit NS_CountTrailingZeros_32Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountTrailingZeros_64Bit(UI_64 f_ui_val); // NOLINT (readability/nolint)
+
+/** @}*/ // end of framework_unified
+
+/** @}*/ // end of native_service
+
+/** @}*/ // end of BaseSystem
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_IF_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_sys_internal.hpp b/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_sys_internal.hpp
new file mode 100755
index 0000000..8c71ace
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_sys_internal.hpp
@@ -0,0 +1,353 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// @file ns_utility_sys_internal.hpp
+/// @brief This file contains declaration of common APIs for NS_UtilityCenter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_SYS_INTERNAL_HPP_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_SYS_INTERNAL_HPP_
+
+#include <native_service/frameworkunified_types.h>
+#include <pthread.h>
+#include <errno.h>
+
+#include <native_service/ns_utility.hpp>
+
+UI_32 utility_sys_rand(); // NOLINT (readability/nolint)
+
+// Random Functions //////////////////////////////////////////////////////////
+
+template< class T>
+T randomValue(T min, T max) {
+ const int32_t lmin = static_cast< int32_t >(min);
+ const int32_t range = static_cast< int32_t >(max) - lmin + 1;
+ if (range > 0) {
+ return static_cast< T >(utility_sys_rand() % range + lmin);
+ } else {
+ return min;
+ }
+}
+
+template< class T, UI_32 N >
+T randomItem(const T(&arr)[ N ]) {
+ return arr[ randomValue< UI_32 >(0, N - 1) ];
+}
+
+
+template< class T, class Lock > class CLockedData;
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &, // NOLINT (readability/nolint)
+ typename FSig< Fn >::TArg2); // NOLINT (readability/nolint)
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5,
+ typename FSig< Fn >::TArg6);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5,
+ typename FSig< Fn >::TArg6, typename FSig< Fn >::TArg7);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &); // NOLINT (readability/nolint)
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5,
+ typename FSig< Fn >::TArg6);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5,
+ typename FSig< Fn >::TArg6, typename FSig< Fn >::TArg7);
+
+
+template< class T, class Lock >
+class CWithReadLock {
+ public:
+ typedef const T TData;
+
+ CWithReadLock(CLockedData< T, Lock > &);
+ ~CWithReadLock();
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5, typename FSig< Fn >::TArg6);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5, typename FSig< Fn >::TArg6,
+ typename FSig< Fn >::TArg7);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CWithReadLock);
+
+ const TData &data() const; // NOLINT (readability/nolint)
+ CLockedData< T, Lock > &m_LockedData;
+};
+
+template< class T, class Lock >
+class CWithWriteLock {
+ public:
+ typedef T TData;
+
+ CWithWriteLock(CLockedData< T, Lock > &);
+ ~CWithWriteLock();
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5, typename FSig< Fn >::TArg6);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5, typename FSig< Fn >::TArg6,
+ typename FSig< Fn >::TArg7);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CWithWriteLock);
+
+ TData &data(); // NOLINT (readability/nolint)
+ CLockedData< T, Lock > &m_LockedData;
+};
+
+/// \brief Represents a piece of data protected by a lock
+///
+/// Data wrapped with Can only be accessed using helper functions
+/// WithReadLock and WithWriteLock
+///
+/// Example usage:
+///
+/// void ModifySharedData( int& n ) { ... modify n ... };
+/// int ReadSharedData( const int& n ){ ... read n ... };
+///
+/// void DoSomething()
+/// {
+/// CLocked< int > my_data( -1 ); // initialize value to -1
+/// WithWriteLock( ModifySharedData, my_data );
+/// int val = WithReadLock( ReadSharedData, my_data );
+/// }
+///
+/// NOTE: that data is locked for the duration of the time that helper functions
+/// ModifySharedData, and ReadSharedData are called - once they return, the data becomes
+/// unlocked automatically.
+template< class T, class Lock = CMutex >
+class CLockedData {
+ public:
+ typedef CWithReadLock< T, Lock > TReadLock;
+ typedef CWithWriteLock< T, Lock > TWriteLock;
+
+ CLockedData() {}
+ template< class T1 > CLockedData(T1 t1) : m_data(t1) {}
+ template< class T1, class T2 > CLockedData(T1 t1, T2 t2) : m_data(t1, t2) {}
+ template< class T1, class T2, class T3 > CLockedData(T1 t1, T2 t2, T3 t3) : m_data(t1, t2, t3) {}
+ template< class T1, class T2, class T3, class T4 > CLockedData(T1 t1, T2 t2, T3 t3, T4 t4) : m_data(t1, t2, t3,
+ t4) {}
+ template< class T1, class T2, class T3, class T4, class T5 > CLockedData(T1 t1, T2 t2, T3 t3, T4 t4,
+ T5 t5) : m_data(t1, t2, t3, t4, t5) {}
+ template< class T1, class T2, class T3, class T4, class T5, class T6 > CLockedData(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5,
+ T6 t6) : m_data(t1, t2, t3, t4, t5, t6) {}
+ template< class T1, class T2, class T3, class T4, class T5, class T6, class T7 > CLockedData(T1 t1, T2 t2, T3 t3,
+ T4 t4, T5 t5, T6 t6, T7 t7) : m_data(t1, t2, t3, t4, t5, t6, t7) {}
+
+ friend class CWithReadLock< T, Lock >;
+ friend class CWithWriteLock< T, Lock >;
+
+ private:
+ T m_data;
+ Lock m_lock;
+};
+
+// CWithReadLock and CWithWriteLock implementation //////////////////////////////////////////////
+
+template< class T, class Lock >
+CWithReadLock< T, Lock >::CWithReadLock(CLockedData< T, Lock > &ld) : m_LockedData(ld) {
+ m_LockedData.m_lock.ReadLock();
+}
+
+template< class T, class Lock >
+CWithReadLock< T, Lock >::~CWithReadLock() {
+ m_LockedData.m_lock.Unlock();
+}
+
+template< class T, class Lock >
+const typename CWithReadLock< T, Lock >::TData &CWithReadLock< T, Lock >::data() const { // NOLINT (readability/nolint)
+ return m_LockedData.m_data;
+}
+
+template< class T, class Lock >
+CWithWriteLock< T, Lock >::CWithWriteLock(CLockedData< T, Lock > &ld) : m_LockedData(ld) {
+ m_LockedData.m_lock.WriteLock();
+}
+
+template< class T, class Lock >
+CWithWriteLock< T, Lock >::~CWithWriteLock() {
+ m_LockedData.m_lock.Unlock();
+}
+
+template< class T, class Lock >
+typename CWithWriteLock< T, Lock >::TData &CWithWriteLock< T, Lock >::data() { // NOLINT (readability/nolint)
+ return m_LockedData.m_data;
+}
+
+// WithReadLock / WithWriteLock ///////////////////////////////////////////////
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data());
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2, t3);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2, t3, t4);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2, t3, t4, t5);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5,
+ typename FSig< Fn >::TArg6 t6) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2, t3, t4, t5, t6);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5,
+ typename FSig< Fn >::TArg6 t6, typename FSig< Fn >::TArg7 t7) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2, t3, t4, t5, t6, t7);
+}
+
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data());
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2, t3);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2, t3, t4);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2, t3, t4, t5);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5,
+ typename FSig< Fn >::TArg6 t6) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2, t3, t4, t5, t6);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5,
+ typename FSig< Fn >::TArg6 t6, typename FSig< Fn >::TArg7 t7) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2, t3, t4, t5, t6, t7);
+}
+
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_SYS_INTERNAL_HPP_
+//@}
diff --git a/nsframework/framework_unified/client/NS_UtilityCenter/src/frameworkunified_version.cpp b/nsframework/framework_unified/client/NS_UtilityCenter/src/frameworkunified_version.cpp
new file mode 100755
index 0000000..3ee907f
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_UtilityCenter/src/frameworkunified_version.cpp
@@ -0,0 +1,236 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeServices
+/// \brief Implementation of CFrameworkunifiedVersion class
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_version_if.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
+#include <string>
+
+
+// defaults - top level makefile for entire system will provide an override
+#ifndef FRAMEWORKUNIFIED_SIGNATURE
+#define FRAMEWORKUNIFIED_SIGNATURE 0xE0344333
+#endif
+
+#ifndef FRAMEWORKUNIFIED_STRUC_VER
+#define FRAMEWORKUNIFIED_STRUC_VER 0x02
+#endif
+
+#ifndef FRAMEWORKUNIFIED_PRODUCT_VER
+#define FRAMEWORKUNIFIED_PRODUCT_VER 0x01
+#endif
+
+#ifndef PRODUCT_LABEL
+#define PRODUCT_LABEL "undefined"
+#endif
+
+#ifndef FRAMEWORKUNIFIED_BUILD_VER
+#define FRAMEWORKUNIFIED_BUILD_VER "undefined"
+#endif
+
+/* For future use */
+#define YEAR ((((__DATE__[7] - '0') * 10 + (__DATE__[8] - '0')) * 10 \
++ (__DATE__[9] - '0')) * 10 + (__DATE__[10] - '0'))
+
+#define MONTH (__DATE__[2] == 'n' ? 0 \
+: __DATE__[2] == 'b' ? 1 \
+: __DATE__[2] == 'r' ? (__DATE__[0] == 'M' ? 2 : 3) \
+: __DATE__[2] == 'y' ? 4 \
+: __DATE__[2] == 'n' ? 5 \
+: __DATE__[2] == 'l' ? 6 \
+: __DATE__[2] == 'g' ? 7 \
+: __DATE__[2] == 'p' ? 8 \
+: __DATE__[2] == 't' ? 9 \
+: __DATE__[2] == 'v' ? 10 : 11)
+
+#define DAY ((__DATE__[4] == ' ' ? 0 : __DATE__[4] - '0') * 10 \
++ (__DATE__[5] - '0'))
+
+#define DATE_AS_INT (((YEAR - 2000) * 12 + MONTH) * 31 + DAY)
+
+#define HOUR (((__TIME__[0] - '0') * 10 + (__TIME__[1] - '0')))
+
+#define MIN (((__TIME__[3] - '0') * 10 + (__TIME__[4] - '0')))
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Default Constructor
+////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedVersion::CFrameworkunifiedVersion():
+ m_tVersionInfo(const_cast<PSTR>(PRODUCT_LABEL),
+ FRAMEWORKUNIFIED_SIGNATURE,
+ FRAMEWORKUNIFIED_STRUC_VER,
+ FRAMEWORKUNIFIED_PRODUCT_VER,
+ DATE_AS_INT,
+ 0,
+ 0,
+ const_cast<PSTR>(FRAMEWORKUNIFIED_BUILD_VER),
+ 0),
+ m_u32Month(MONTH + 1),
+ m_u32Year(YEAR),
+ m_u32Day(DAY) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Parametrized constructor
+////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedVersion::CFrameworkunifiedVersion(UI_16 major, UI_16 minor, UI_16 revision) :
+ m_tVersionInfo(const_cast<PSTR>(PRODUCT_LABEL),
+ FRAMEWORKUNIFIED_SIGNATURE,
+ FRAMEWORKUNIFIED_STRUC_VER,
+ FRAMEWORKUNIFIED_PRODUCT_VER,
+ DATE_AS_INT,
+ major,
+ minor,
+ const_cast<PSTR>(FRAMEWORKUNIFIED_BUILD_VER),
+ revision),
+ m_u32Month(MONTH + 1),
+ m_u32Year(YEAR),
+ m_u32Day(DAY) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Destructor
+////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedVersion::~CFrameworkunifiedVersion() {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Compares two version instances
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL operator == (CFrameworkunifiedVersion &a, CFrameworkunifiedVersion &b) { // NOLINT (readability/nolint)
+ return a.operator == (b);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Compares two version instances
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFrameworkunifiedVersion::operator == (const CFrameworkunifiedVersion &f_test_i) {
+ if (!strcmp(m_tVersionInfo.p_str_product, f_test_i.m_tVersionInfo.p_str_product) &&
+ !strcmp(m_tVersionInfo.p_str_build, f_test_i.m_tVersionInfo.p_str_build) &&
+ (m_tVersionInfo.u16_major == f_test_i.m_tVersionInfo.u16_major) &&
+ (m_tVersionInfo.u16_minor == f_test_i.m_tVersionInfo.u16_minor) &&
+ (m_tVersionInfo.u16_revision == f_test_i.m_tVersionInfo.u16_revision) &&
+ (m_tVersionInfo.u32_date == f_test_i.m_tVersionInfo.u32_date) &&
+ (m_tVersionInfo.u32_product_version == f_test_i.m_tVersionInfo.u32_product_version) &&
+ (m_tVersionInfo.u32_signature == f_test_i.m_tVersionInfo.u32_signature) &&
+ (m_tVersionInfo.u32_struc_version == f_test_i.m_tVersionInfo.u32_struc_version)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the version string
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR CFrameworkunifiedVersion::VersionStr() {
+ static char version[30] = {};
+
+ snprintf(version, sizeof(version) - 1, "%s_%s_%02d.%02d.%02d",
+ m_tVersionInfo.p_str_product,
+ m_tVersionInfo.p_str_build,
+ m_tVersionInfo.u16_major,
+ m_tVersionInfo.u16_minor,
+ m_tVersionInfo.u16_revision);
+
+ return version;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the date when the new version of the app was created
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR CFrameworkunifiedVersion::DateStr() {
+ static char date[30] = {};
+
+ snprintf(date, sizeof(date) - 1, "%d-%02d-%02d",
+ m_u32Year,
+ m_u32Month,
+ m_u32Day);
+
+ return date;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the Signature
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CFrameworkunifiedVersion::Signature() const {
+ return m_tVersionInfo.u32_signature;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns a new structure version
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CFrameworkunifiedVersion::StrucVersion() const {
+ return m_tVersionInfo.u32_struc_version;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the product version
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CFrameworkunifiedVersion::ProductVersion() const {
+ return m_tVersionInfo.u32_product_version;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the date
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CFrameworkunifiedVersion::Date() const {
+ return m_tVersionInfo.u32_date;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the major number
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_16 CFrameworkunifiedVersion::Major() const {
+ return m_tVersionInfo.u16_major;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the minor number
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_16 CFrameworkunifiedVersion::Minor() const {
+ return m_tVersionInfo.u16_minor;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the unique product identifier
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR CFrameworkunifiedVersion::Product() const {
+ return m_tVersionInfo.p_str_product;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the unique build identifier number
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR CFrameworkunifiedVersion::Build() const {
+ return m_tVersionInfo.p_str_build;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the revision number
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_16 CFrameworkunifiedVersion::Revision() const {
+ return m_tVersionInfo.u16_revision;
+}
diff --git a/nsframework/framework_unified/client/NS_UtilityCenter/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_UtilityCenter/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..14ad4d8
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_UtilityCenter/src/makefile_PosixBasedOS001
@@ -0,0 +1,194 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_UtilityCenter
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_UtilityCenter
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for utility functions
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_endianess.cpp b/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_endianess.cpp
new file mode 100755
index 0000000..3dea53c
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_endianess.cpp
@@ -0,0 +1,52 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <native_service/ns_endianess.h>
+
+UI_16 ConvertEndian_UI16(UI_16 f_value) { // NOLINT (readability/nolint)
+ UI_16 l_ret = static_cast<UI_16>((f_value << 8) | (f_value >> 8));
+ return l_ret;
+}
+
+
+SI_16 ConvertEndian_SI16(SI_16 f_value) { // NOLINT (readability/nolint)
+ SI_16 l_ret = static_cast<SI_16>((f_value << 8) | ((f_value >> 8) & 0xFF));
+ return l_ret;
+}
+
+
+UI_32 ConvertEndian_UI32(UI_32 f_value) { // NOLINT (readability/nolint)
+ UI_32 l_ret = ((f_value << 8) & 0xFF00FF00) | ((f_value >> 8) & 0xFF00FF);
+ return (l_ret << 16) | (l_ret >> 16);
+}
+
+SI_32 ConvertEndian_SI32(SI_32 f_value) { // NOLINT (readability/nolint)
+ SI_32 l_ret = ((f_value << 8) & 0xFF00FF00) | ((f_value >> 8) & 0xFF00FF);
+ return (l_ret << 16) | ((l_ret >> 16) & 0xFFFF);
+}
+
+UI_64 ConvertEndian_UI64(UI_64 f_value) { // // NOLINT (readability/nolint)
+ UI_64 l_ret = ((f_value << 8) & 0xFF00FF00FF00FF00ULL) | ((f_value >> 8) & 0x00FF00FF00FF00FFULL);
+ l_ret = ((l_ret << 16) & 0xFFFF0000FFFF0000ULL) | ((l_ret >> 16) & 0x0000FFFF0000FFFFULL);
+ return (l_ret << 32) | (l_ret >> 32);
+}
+
+SI_64 ConvertEndian_SI64(SI_64 f_value) { // NOLINT (readability/nolint)
+ SI_64 l_ret = ((f_value << 8) & 0xFF00FF00FF00FF00ULL) | ((f_value >> 8) & 0x00FF00FF00FF00FFULL);
+ l_ret = ((l_ret << 16) & 0xFFFF0000FFFF0000ULL) | ((l_ret >> 16) & 0x0000FFFF0000FFFFULL);
+ return (l_ret << 32) | ((l_ret >> 32) & 0xFFFFFFFFULL);
+}
diff --git a/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_crc.cpp b/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_crc.cpp
new file mode 100755
index 0000000..af82364
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_crc.cpp
@@ -0,0 +1,125 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_UtilityCenter
+/// \brief This file contains implementation of APIs to calcuate 16-bit and 32-bit CRC checksum of file.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_util_crc.h>
+#include <stdio.h>
+
+// buffer size for reading from file
+#define MAX_BUFFER_SIZE 4096
+
+// Static 32 bit CRC lookup table
+UI_16 g_arr_crc16_table[256] = {
+};
+
+// Static 32 bit CRC lookup table
+UI_32 g_arr_crc32_table[256] = {
+};
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CalculateCRC16
+/// This API calculates the 16 bit CRC checksum of a file
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CalculateCRC16(PCSTR f_c_file_name, UI_16 &f_ui_check_sum) { // NOLINT (readability/nolint)
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ CHAR l_c_buffer[MAX_BUFFER_SIZE] = {0};
+ size_t l_ui_bytes_read = 0;
+ FILE *l_p_file = NULL;
+
+ if (NULL != f_c_file_name) {
+ f_ui_check_sum = 0xFFFF;
+
+ // Open the file
+ l_p_file = fopen(f_c_file_name, "rbe");
+
+ if (NULL == l_p_file) {
+ l_e_status = eFrameworkunifiedStatusFileLoadError;
+ } else {
+ l_ui_bytes_read = fread(l_c_buffer, 1, sizeof(l_c_buffer), l_p_file);
+
+ while (0 != l_ui_bytes_read) { // LCOV_EXCL_BR_LINE 11: not a branch
+ for (UI_32 l_ui_bytes_cnt = 0; l_ui_bytes_cnt < l_ui_bytes_read; l_ui_bytes_cnt++) { // LCOV_EXCL_BR_LINE 11: not a branch
+ f_ui_check_sum = static_cast<UI_16>(
+ g_arr_crc16_table[((f_ui_check_sum >> 8) ^ l_c_buffer[l_ui_bytes_cnt]) & 0xFF] ^ (f_ui_check_sum << 8));
+ }
+
+ l_ui_bytes_read = fread(l_c_buffer, 1, sizeof(l_c_buffer), l_p_file);
+ }
+
+ fclose(l_p_file);
+ l_p_file = NULL;
+ }
+
+ f_ui_check_sum = static_cast<UI_16>(~f_ui_check_sum);
+ } else {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_e_status;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CalculateCRC32
+/// This API calculates the 32 bit CRC checksum of a file
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CalculateCRC32(PCSTR f_c_file_name, UI_32 &f_ui_check_sum) { // NOLINT (readability/nolint)
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ CHAR l_c_buffer[MAX_BUFFER_SIZE] = {0};
+ size_t l_ui_bytes_read = 0;
+ FILE *l_p_file = NULL;
+
+ if (NULL != f_c_file_name) {
+ f_ui_check_sum = 0xFFFFFFFF;
+
+ // Open the file
+ l_p_file = fopen(f_c_file_name, "rbe");
+
+ if (NULL == l_p_file) {
+ l_e_status = eFrameworkunifiedStatusFileLoadError;
+ } else {
+ l_ui_bytes_read = fread(l_c_buffer, 1, sizeof(l_c_buffer), l_p_file);
+
+ while (0 != l_ui_bytes_read) { // LCOV_EXCL_BR_LINE 11: not a branch
+ for (UI_32 l_ui_bytes_cnt = 0; l_ui_bytes_cnt < l_ui_bytes_read; l_ui_bytes_cnt++) { // LCOV_EXCL_BR_LINE 11: not a branch
+ f_ui_check_sum = (f_ui_check_sum >> 8)
+ ^ g_arr_crc32_table[(l_c_buffer[l_ui_bytes_cnt] ^ f_ui_check_sum) & 0xFF];
+ }
+
+ l_ui_bytes_read = fread(l_c_buffer, 1, sizeof(l_c_buffer), l_p_file);
+ }
+
+ fclose(l_p_file);
+ l_p_file = NULL;
+ }
+
+ f_ui_check_sum = ~f_ui_check_sum;
+ } else {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_e_status;
+}
diff --git a/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_directory.cpp b/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_directory.cpp
new file mode 100755
index 0000000..a8b4263
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_directory.cpp
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_UtilityCenter
+/// \brief This file contains API implementation for handling file and folder functionalities.
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_util_directory.h>
+
+#include <dirent.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <cstring>
+#include <string>
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetFileList
+/// Get list of files present in a specific directory
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetFileList(TFileList *f_pv_tfile_list, PCSTR f_pc_path) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ DIR *l_p_dir = NULL;
+ struct dirent *l_pt_dirent = NULL;
+
+ if (NULL != f_pc_path && NULL != f_pv_tfile_list) {
+ if (NULL != (l_p_dir = opendir(f_pc_path))) {
+ PCHAR l_c_file_name = NULL;
+ size_t l_ui_str_length = 0;
+ while (NULL != (l_pt_dirent = readdir(l_p_dir))) { // LCOV_EXCL_BR_LINE 11: not a branch
+ if (!((std::strcmp(l_pt_dirent->d_name, ".") == 0) || (std::strcmp(l_pt_dirent->d_name, "..") == 0))) {
+ l_ui_str_length = std::strlen(l_pt_dirent->d_name);
+
+ l_c_file_name = new(std::nothrow) CHAR[l_ui_str_length + 1];
+
+ if (NULL != l_c_file_name) { // LCOV_EXCL_BR_LINE 11: new's error case(c++)
+ std::memset(l_c_file_name, 0, (sizeof(CHAR) * (l_ui_str_length + 1)));
+
+ std::strncpy(l_c_file_name, l_pt_dirent->d_name, l_ui_str_length);
+
+ f_pv_tfile_list->push_back(l_c_file_name); // LCOV_EXCL_BR_LINE 11: not a branch
+
+ delete[] l_c_file_name; // LCOV_EXCL_BR_LINE 11: not a branch
+ l_c_file_name = NULL;
+ } else {
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ }
+ closedir(l_p_dir);
+ } else {
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_e_status;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateDirectory
+/// Method to create a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateDirectory(std::string f_c_dir_path) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (!f_c_dir_path.empty()) {
+ PSTR l_c_temp_dir_path;
+ PSTR l_c_parsed_dir_path;
+ PCSTR l_c_copy_path = f_c_dir_path.c_str();
+
+ l_c_temp_dir_path = const_cast<PSTR >(f_c_dir_path.c_str());
+ // LCOV_EXCL_BR_START 11: not a branch
+ while (l_e_status == eFrameworkunifiedStatusOK && (l_c_parsed_dir_path = std::strchr(l_c_temp_dir_path, '/')) != 0) {
+ // LCOV_EXCL_BR_STOP
+ if (l_c_parsed_dir_path != l_c_temp_dir_path) {
+ /* Neither root nor double slash in path */
+ *l_c_parsed_dir_path = '\0';
+ if (0 != mkdir(l_c_copy_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+ if (EEXIST != errno) { // LCOV_EXCL_BR_LINE 11: not a branch
+ l_e_status = eFrameworkunifiedStatusFail;
+ } else {
+ // file already exist
+ if (TRUE != DoesDirecotryExist(f_c_dir_path)) { // LCOV_EXCL_BR_LINE 5: DoesDirecotryExist's error case
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ *l_c_parsed_dir_path = '/';
+ }
+ l_c_temp_dir_path = l_c_parsed_dir_path + 1;
+ }
+ if (eFrameworkunifiedStatusOK == l_e_status) { // LCOV_EXCL_BR_LINE 11: not a branch
+ if (0 != mkdir(l_c_copy_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+ if (EEXIST != errno) { // LCOV_EXCL_BR_LINE 11: not a branch
+ l_e_status = eFrameworkunifiedStatusFail;
+ } else {
+ // file already exist
+ if (TRUE != DoesDirecotryExist(f_c_dir_path)) { // LCOV_EXCL_BR_LINE 5: DoesDirecotryExist's error case
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ }
+ } else {
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+ return l_e_status;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DoesDirecotryExist
+/// Method to check if a directory exists.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL DoesDirecotryExist(std::string f_c_dir_path) {
+ BOOL l_b_directory_status = FALSE;
+
+ DIR *l_p_dir_descriptor = opendir(f_c_dir_path.c_str());
+ if (NULL != l_p_dir_descriptor) {
+ closedir(l_p_dir_descriptor);
+ l_b_directory_status = TRUE;
+ }
+ return l_b_directory_status;
+}
+
diff --git a/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_utility.cpp b/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_utility.cpp
new file mode 100755
index 0000000..d9e6776
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_utility.cpp
@@ -0,0 +1,144 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <native_service/ns_utility_if.h>
+#include <native_service/ns_utility_sys.hpp>
+#include <stdlib.h>
+#include <ctime>
+#include <cstring>
+#include "ns_utility_sys_internal.hpp"
+#include "ns_utility_if_internal.h"
+// Random functions ////////////////////////////////////////////////////
+void utility_sys_seedrand() { // NOLINT (readability/nolint)
+ static bool s_seeded = false;
+ if (!s_seeded) {
+ s_seeded = true;
+ srand48(std::time(NULL));
+ }
+}
+
+UI_32 utility_sys_rand() { // NOLINT (readability/nolint)
+ utility_sys_seedrand();
+ return static_cast< UI_32 >(mrand48());
+}
+
+// Lock wrapper implementation /////////////////////////////////////
+
+///////////////////////////////////////////
+// Implements locking policy for mutexes //
+///////////////////////////////////////////
+
+// CMutex helper function
+template< class TErr >
+void MutexLock(pthread_mutex_t *mtx) {
+ if (EOK != pthread_mutex_lock(mtx)) {
+ throw TErr("");
+ }
+}
+
+CMutex::CMutex() {
+ pthread_mutex_t mtx_tmp = PTHREAD_MUTEX_INITIALIZER;
+ std::memcpy(&m_mtx, &mtx_tmp, sizeof(m_mtx));
+ if (EOK != pthread_mutex_init(&m_mtx, NULL)) {
+ throw lock_creation_error();
+ }
+}
+
+CMutex::~CMutex() {
+ pthread_mutex_destroy(&m_mtx);
+}
+
+void CMutex::ReadLock() {
+ MutexLock< lock_acquireread_error >(&m_mtx);
+}
+
+void CMutex::WriteLock() {
+ MutexLock< lock_acquirewrite_error >(&m_mtx);
+}
+
+void CMutex::Unlock() {
+ if (EOK != pthread_mutex_unlock(&m_mtx)) {
+ throw lock_release_error("");
+ }
+}
+
+
+/////////////////////////////////////////////////////////
+// implements locking policy for reader / writer locks //
+/////////////////////////////////////////////////////////
+CRWLock::CRWLock() {
+ pthread_rwlock_t rw_tmp = PTHREAD_RWLOCK_INITIALIZER;
+ std::memcpy(&m_rwl, &rw_tmp, sizeof(m_rwl));
+ if (EOK != pthread_rwlock_init(&m_rwl, NULL)) {
+ throw lock_creation_error();
+ }
+}
+
+CRWLock::~CRWLock() {
+ pthread_rwlock_destroy(&m_rwl);
+}
+
+void CRWLock::ReadLock() {
+ if (EOK != pthread_rwlock_rdlock(&m_rwl)) {
+ throw lock_acquireread_error();
+ }
+}
+
+void CRWLock::WriteLock() {
+ if (EOK != pthread_rwlock_wrlock(&m_rwl)) {
+ throw lock_acquirewrite_error();
+ }
+}
+
+void CRWLock::Unlock() {
+ if (EOK != pthread_rwlock_unlock(&m_rwl)) {
+ throw lock_release_error();
+ }
+}
+
+/////////////////////////////////////////////////////////
+// implements GNU Builtins for counting leading zeros //
+/////////////////////////////////////////////////////////
+
+// returns the number of leading zeros in a given 16bit value
+SI_16 NS_CountLeadingZeros_16Bit(UI_16 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_clz(f_ui_val)); // NOLINT (readability/nolint)
+}
+
+// returns the number of leading zeros in a given 32bit value
+SI_16 NS_CountLeadingZeros_32Bit(UI_32 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_clzl(f_ui_val)); // NOLINT (readability/nolint)
+}
+
+// returns the number of leading zeros in a given 64bit value
+SI_16 NS_CountLeadingZeros_64Bit(UI_64 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_clzll(f_ui_val)); // NOLINT (readability/nolint)
+}
+
+// returns the number of trailing zeros in a given 16bit value
+SI_16 NS_CountTrailingZeros_16Bit(UI_16 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_ctz(f_ui_val)); // NOLINT (readability/nolint)
+}
+
+// returns the number of trailing zeros in a given 32bit value
+SI_16 NS_CountTrailingZeros_32Bit(UI_32 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_ctzl(f_ui_val)); // NOLINT (readability/nolint)
+}
+
+// returns the number of trailing zeros in a given 64bit value
+SI_16 NS_CountTrailingZeros_64Bit(UI_64 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_ctzll(f_ui_val)); // NOLINT (readability/nolint)
+}
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/Makefile b/nsframework/framework_unified/client/NS_XMLConfigeParser/Makefile
new file mode 100755
index 0000000..1cc5e18
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/Makefile
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS :=library
+
+
+include ../../../native_service.mk
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile
new file mode 100755
index 0000000..520b5f7
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS = src
+
+include ../../../../native_service.mk
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h
new file mode 100755
index 0000000..4186f09
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h
@@ -0,0 +1,113 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup MY 14 Platfom Software Team
+/// \brief Internal Header for ns_config_parser_XML.c
+///
+/// These functions are used to read from and write to XML file.
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include <ns_config_parser_internal.h>
+#define BUFFERSIZE 200
+#define ZERO 0
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// XMLGetValue:
+/// Function : get value for given key.
+///
+/// \param [in] pCurrNode
+/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
+/// \param [in] pNodePath
+/// const char * - pNodePath is a Pointer to path of Current XML node.
+/// \param [in] pUserKey
+/// const char * - pUserKey is a Pointer to Key provided by user.
+/// \param [in] pReturnValue
+/// char * - pReturnValue is a Pointer to value to be returned corresponding to Key.
+/// \param [in] pReturnState
+/// int * - pReturnState is updated depending upon user provided Key\n
+/// returns 0 if user passed valid key.\n
+/// returns 1 if user passed invalid key.\n
+/// \return status
+/// void
+///////////////////////////////////////////////////////////////////////////////////////////
+void XMLGetValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, char *preturnvalue,
+ int *preturnstate);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// XMLUpdateOldValue:
+/// Function : update value corresponding to given user key.
+///
+/// \param [in] pCurrNode
+/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
+/// \param [in] pNodePath
+/// const char * - pNodePath is a Pointer to path of Current XML node.
+/// \param [in] pUserKey
+/// const char * - pUserKey is a Pointer to Key provided by user.
+/// \param [in] pValue
+/// const char * - pValue is a Pointer to the new value for attribute or text.
+/// \param [in] pReturnState
+/// int * - returns 0 if user passed valid key.\n
+/// returns -6 if old value is not updated with new value.\n
+/// \return status
+/// void
+///////////////////////////////////////////////////////////////////////////////////////////
+void XMLUpdateOldValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, const char *preturnvalue,
+ int *preturnstate);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// XMLUpdateOldValueWithNewValue:
+/// Function : Traverse all nodes of XML tree read value to given node,compare with old value,\n
+/// if old value matched then write new value in place of old value.
+///
+/// \param [in] pCurrNode
+/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
+/// \param [in] pNodePath
+/// const char * -pNodePath is a Pointer to path of Current XML node.
+/// \param [in] pUserKey
+/// const char * -pUserKey is a Pointer to Key provided by user.
+/// \param [in] pOldValue
+/// const char * - pOldValue is a Pointer to the old value for attribute or text of key passed.
+/// \param [in] pNewValue
+/// const char * -pNewValue is a Pointer to the new value for attribute or text to be assigned to the key.
+/// \param [in] pReturnState
+/// int * - returns 0 if user passed valid key.\n
+/// returns -6 if old value is not updated with new value.\n
+/// \return status
+/// void
+///////////////////////////////////////////////////////////////////////////////////////////
+void XMLUpdateOldValueWithNewValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey,
+ const char *poldvalue, const char *pnewvalue, int *preturnstate);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
+
+// EOF
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h
new file mode 100755
index 0000000..6dcf11a
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup MY 14 Platform Software Team
+/// \brief Internal Header for ns_config_parser_cfg.c
+///
+/// These functions are used to read from and write to cfg file.
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <ns_config_parser_internal.h>
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CFGGetValue:
+/// Function : Traverse cfg file and read value corresponding to key.
+///
+/// \param [in] filePtr
+/// FILE * - filePtr is a Pointer to a file descriptor.
+/// \param [in] pKey
+/// const char * -pKey is a Pointer to user key.
+/// \param [in] pRetValue
+/// char * - pRetValue is a Pointer to value or values to be returned corresponding to user key.
+/// \return status
+/// int - value returned depending upon user provided Key is valid or not.\n
+/// returns 1 if user passed invalid key.\n
+/// returns 0 if user passed valid key.\n
+///
+///////////////////////////////////////////////////////////////////////////////////////////
+int CFGGetValue(FILE *file_ptr, const char *p_key, char *p_ret_value);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CFGUpdateOldValue:
+/// Function : Traverse the cfg file and update the value corresponding to given key.
+///
+/// \param [in] hConfigFile
+/// HANDLE - hConfigFile is a handle to given file.
+/// \param [in] pKey
+/// const char * - pKey is a Pointer to user key.
+/// \param [in] pValue
+/// const char * - pValue is a Pointer to new value corresponding to user key.
+/// \return status
+/// int - returns 1 if user passed invalid key.\n
+/// returns 0 if user passed valid key.\n
+/// returns -1 if memory allocation fail.\n
+/// returns -6 if value not updated in file.\n
+///
+///////////////////////////////////////////////////////////////////////////////////////////
+int CFGUpdateOldValue(HANDLE h_config_file, const char *p_key, const char *p_value);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CFGUpdateOldValueWithNewValue
+/// Function : Traverse the cfg file read value to given node,compare with old value,\n
+/// if old value matched then write new value in place of old value.\n
+///
+/// \param [in] hConfigFile
+/// HANDLE - hConfigFile is a handle to given file.
+/// \param [in] pKey
+/// const char * - pKey is a Pointer to user key.
+/// \param [in] pOldValue
+/// const char * - pOldValue is a Pointer to Old Value corresponding to user key.
+/// \param [in] pNewValue
+/// const char * - pNewValue is a Pointer to New Value corresponding to user key.
+/// \return status
+/// int - returns 1 if user passed invalid key.\n
+/// returns 0 if user passed valid key.\n
+/// returns -1 if memory allocation fail.\n
+/// returns -6 if value not updated in file.\n
+///
+///////////////////////////////////////////////////////////////////////////////////////////
+
+int CFGUpdateOldValueWithNewValue(HANDLE h_config_file, const char *p_key,
+ const char *p_old_value, const char *p_new_value);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_
+
+// EOF
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h
new file mode 100755
index 0000000..97c9be6
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h
@@ -0,0 +1,60 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup MY 14 Platform Software Team
+/// \brief Internal Header for ns_config_parser_cfg.c
+///
+/// These structures are file handler structure.
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_
+
+#include <libxml/tree.h>
+#include <ns_config_parser.h>
+
+
+// defines enum for MODE
+// in which file is opened
+typedef enum MODE {
+ kReadMode = 0, kWriteMode, kAppend
+} MODE;
+
+// defines enum for STATUS
+typedef enum STATUS {
+ kSuccess = 0, kFailure
+} STATUS;
+
+// defines enum for Filetype
+// i.e .cfg or .xml or other type of file
+typedef enum Filetype {
+ kCfg = 0, kXml, kOther
+} Filetype;
+
+// FILE STRUCTURE
+typedef struct FILESTRUCT {
+ char *filename;
+ Filetype filetype;
+ MODE mode;
+ xmlDocPtr doc;
+ FILE *fileptr;
+} FILESTRUCT;
+
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h
new file mode 100755
index 0000000..0587489
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h
@@ -0,0 +1,88 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGZONES
+// #define FRAMEWORKUNIFIEDLOGZONES (ZONE_WARN|ZONE_ERR)
+#define FRAMEWORKUNIFIEDLOGZONES (ZONE_INIT|ZONE_FUNC|ZONE_INFO|ZONE_WARN|ZONE_ERR|ZONE_NS_WAR|ZONE_NS_ERR)
+#endif
+
+extern const CHAR kAppName[];
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile
new file mode 100755
index 0000000..9ec700c
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile
@@ -0,0 +1,57 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+
+
+######### installed library(*.a) #############
+
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libNS_XMLConfigParser
+
+######### install headers(*.h) #############
+
+
+######### compiled sources #############
+libNS_XMLConfigParser_SRCS = ns_xml_reader.cpp ns_xml_writer.cpp ns_xmlparser.cpp ns_xmlparser_attributes.cpp ns_xmlparser_node.cpp
+
+######### add source path #############
+
+######### add include path #############
+
+CPPFLAGS += -I$(SDKTARGETSYSROOT)/usr/include/libxml2
+CPPFLAGS += -I../../../include
+CPPFLAGS += -I../include
+CPPFLAGS += -I../../../include
+#inc_dummy
+CPPFLAGS += -I../../../NS_ConfigParser/include
+
+######### add compile option #############
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+
+######### add library path #############
+LDFLAGS += -L../../../
+LDFLAGS += -Wl,--no-as-needed
+######### linked library (dynamic) #############
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lxml2
+LDLIBS += -Wl,-Bdynamic -lm
+
+LINK_SHLIB_CXX = Y
+
+include ../../../../../native_service.mk
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..cdf3238
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001
@@ -0,0 +1,208 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_XMLConfigParser
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_XMLConfigParser
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_ConfigParser/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+DYNAMIC_LIBS += \
+ xml2 \
+ m
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+module_dirs: build_dirs
+
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp
new file mode 100755
index 0000000..01abb97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp
@@ -0,0 +1,522 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CXMLReader class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_xml_reader.h>
+#include <string>
+#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+CXMLReader *GetCXMLReaderObject(CHAR *f_cfilepath) {
+ CXMLReader *l_p_xml_reader = NULL;
+ if (NULL != f_cfilepath) {
+ l_p_xml_reader = new(std::nothrow) CXMLReader(f_cfilepath); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ return l_p_xml_reader;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+CXMLReader::CXMLReader(): m_pXmlDoc(NULL) {
+}
+
+CXMLReader::CXMLReader(const std::string &f_cFilePath): m_pXmlDoc(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_cFilePath.c_str());
+
+ // create document object structure
+ m_pXmlDoc = xmlParseFile(f_cFilePath.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (!m_pXmlDoc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+}
+
+CXMLReader::~CXMLReader() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
+
+ if (NULL != m_pXmlDoc) {
+ xmlFreeDoc(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
+ m_pXmlDoc = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CXMLReader::ParseFile(const std::string &f_cFilePath) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // create document object structure
+ m_pXmlDoc = xmlParseFile(f_cFilePath.c_str());
+
+ if (NULL == m_pXmlDoc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+PVOID CXMLReader::GetDataPtr() {
+ return m_pXmlDoc;
+}
+
+std::string CXMLReader::GetValue(const std::string &f_cKey) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Key %s", f_cKey.c_str());
+
+ std::string l_cValue = "";
+
+ if (NULL != m_pXmlDoc && (!f_cKey.empty())) {
+ std::string l_cUserKey = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ l_cUserKey.assign(f_cKey);
+
+ // get the root node element
+ xmlNodePtr l_pCurrNode = xmlDocGetRootElement(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (NULL != l_pCurrNode) {
+ // remove the root node name from key
+ size_t l_uiLength = l_cUserKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (std::string::npos != l_uiLength) {
+ l_cUserKey = l_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // if root node name matches with the name in received key
+ if (!(f_cKey.substr(0, l_uiLength)).compare((PCSTR)l_pCurrNode->name)) {
+ l_cValue = XMLGetValue(l_pCurrNode,
+ l_cUserKey);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Parsed Value :: %s", l_cValue.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document structure pointer m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+
+ return l_cValue;
+}
+
+std::string CXMLReader::XMLGetValue(xmlNodePtr f_pCurrNode,
+ const std::string &f_cUserKey) {
+ std::string l_cReturnValue = "";
+
+ if (NULL != f_pCurrNode && (!f_cUserKey.empty())) {
+ std::string l_cKey = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // result of previous attribute of same node
+ BOOL l_bResult = TRUE;
+
+ // this parameter specifies whether to AND or OR the current result with previous result
+ // TRUE means AND while FALSE means OR
+ BOOL l_bOperation = FALSE;
+
+ // position of "@" in user key if exists
+ size_t l_uiAttrLen = 0;
+
+ // get the single attribute from list of attributes of node
+ std::string l_cAttr = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ std::string l_cNodeName = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // contains the single attribute key, value
+ std::string l_cAttrOpt = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // l_cAttrId of the attribute
+ std::string l_cAttrId = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ // value of the attribute
+ std::string l_cAttrValue = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ size_t l_uiSplitProp = 0;
+ size_t l_uiAttrSplit = 0;
+ BOOL l_bCurrentResult = FALSE;
+
+ l_cKey.assign(f_cUserKey);
+
+ // position of first "." in user key
+ size_t l_uiLength = l_cKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+ if (std::string::npos != l_uiLength) {
+ // get the current node name string with node attributes
+ l_cKey = l_cKey.substr(0, l_uiLength); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ l_cNodeName.assign(l_cKey);
+
+ // get children of current node
+ f_pCurrNode = f_pCurrNode->children;
+
+ while (NULL != f_pCurrNode) {
+ // check whether current node is an element node.
+ if (XML_ELEMENT_NODE == f_pCurrNode->type) {
+ l_bResult = TRUE;
+ l_bOperation = FALSE;
+ l_uiAttrLen = 0;
+ l_cAttr.clear();
+
+ // check whether key contains attribute for current node
+ if (std::string::npos != (l_uiAttrLen = l_cKey.find('@'))) {
+ // get the attribute string from node key
+ l_cAttr.assign(l_cKey, (l_uiAttrLen + 1), std::string::npos); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // remove the attribute string from key string
+ l_cKey = l_cKey.substr(0, l_uiAttrLen); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // check whether node name string matches with the current node name
+ if (!l_cKey.compare((PCSTR)f_pCurrNode->name)) {
+ l_cAttrOpt.assign(l_cAttr);
+
+ while (0 < l_cAttr.length()) {
+ // initialize variables
+ l_cAttrId.clear();
+ l_cAttrValue.clear();
+ l_uiSplitProp = 0;
+ l_uiAttrSplit = 0;
+ l_bCurrentResult = FALSE;
+
+ // check whether node have multiple attributes
+ if (std::string::npos != (l_uiSplitProp = l_cAttr.find('|'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else if (std::string::npos != (l_uiSplitProp = l_cAttr.find('&'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else {
+ l_uiSplitProp = l_cAttr.length() - 1;
+ if (std::string::npos != (l_uiAttrSplit = l_cAttr.find('='))) {
+ l_cAttrId = l_cAttr.substr(0, l_uiAttrSplit); // LCOV_EXCL_BR_LINE 11: except branch
+ l_cAttrValue = l_cAttr.substr(l_uiAttrSplit + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+
+ // compare the value of attributes
+ xmlChar *l_pAttrValue = xmlGetProp(f_pCurrNode, (const xmlChar *)l_cAttrId.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
+ if (NULL != l_pAttrValue) {
+ if (!l_cAttrValue.compare((PCSTR)l_pAttrValue)) {
+ l_bCurrentResult = TRUE;
+ }
+ }
+ xmlFree(l_pAttrValue); // LCOV_EXCL_BR_LINE 11: except branch
+ l_pAttrValue = NULL;
+
+ // combine the result of all attributes
+ if (!l_bOperation) {
+ l_bResult = l_bResult && l_bCurrentResult;
+ } else {
+ l_bResult = l_bResult || l_bCurrentResult;
+ }
+
+ if ('|' == l_cAttr[l_uiSplitProp]) {
+ l_bOperation = TRUE;
+ } else {
+ l_bOperation = FALSE;
+ }
+
+ if ((!l_bResult) && (!l_bOperation)) {
+ // break from current while loop
+ break;
+ }
+
+ l_cAttr = l_cAttr.substr(l_uiSplitProp + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // if attributes not matched move to next node
+ if (!l_bResult) {
+ // search for the same node name in next child nodes
+ l_cKey.assign(l_cNodeName);
+ } else {
+ // read text of current node
+ if ((NULL != f_pCurrNode->children) &&
+ (XML_TEXT_NODE == f_pCurrNode->children->type) &&
+ (NULL == f_pCurrNode->children->next)) {
+ // append the result in string
+ l_cReturnValue.append((PCSTR) f_pCurrNode->children->content); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+ } else {
+ l_bResult = FALSE;
+ }
+
+ if (l_bResult) {
+ // parse children and next nodes of current node
+ if (std::string::npos != l_uiLength) {
+ l_cKey = f_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+
+ std::string l_cValue = XMLGetValue(f_pCurrNode, l_cKey); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (!l_cReturnValue.empty() && !l_cValue.empty()) {
+ l_cReturnValue.append("\n");
+ }
+
+ // append the received string
+ l_cReturnValue.append(l_cValue);
+ }
+
+ l_cKey = l_cNodeName;
+ }
+ }
+
+ f_pCurrNode = f_pCurrNode->next;
+ }
+ }
+
+ return l_cReturnValue;
+}
+
+EFrameworkunifiedStatus CXMLReader::GetValue(const std::string &f_cKey, std::string &f_cValue) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pXmlDoc && (!f_cKey.empty())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Key is %s", f_cKey.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ std::string l_cUserKey = "";
+ l_cUserKey.assign(f_cKey);
+
+ // get the root node element
+ xmlNodePtr l_pCurrNode = xmlDocGetRootElement(m_pXmlDoc);
+
+ if (NULL != l_pCurrNode) {
+ // remove the root node name from key
+ size_t l_uiLength = l_cUserKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (std::string::npos != l_uiLength) {
+ l_cUserKey = l_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // if root node name matches with the name in received key
+ if (!(f_cKey.substr(0, l_uiLength)).compare((PCSTR)l_pCurrNode->name)) {
+ BOOL l_bKeyFound = FALSE;
+
+ XMLGetValue(l_pCurrNode, l_cUserKey, f_cValue, l_bKeyFound);
+
+ if (!l_bKeyFound) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Root Node ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Parsed Value :: %s", f_cValue.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document structure pointer m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CXMLReader::XMLGetValue(xmlNodePtr f_pCurrNode, const std::string &f_cUserKey, std::string &f_cValue,
+ BOOL &f_bKeyFound) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_pCurrNode && (!f_cUserKey.empty())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Key :: %s", f_cUserKey.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ std::string l_cKey = "";
+
+ // result of previous attribute of same node
+ BOOL l_bResult = TRUE;
+
+ // this parameter specifies whether to AND or OR the current result with previous result
+ // TRUE means AND while FALSE means OR
+ BOOL l_bOperation = FALSE;
+
+ // position of "@" in user key if exists
+ size_t l_uiAttrLen = 0;
+
+ // get the single attribute from list of attributes of node
+ std::string l_cAttr = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ std::string l_cNodeName = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // contains the single attribute key, value
+ std::string l_cAttrOpt = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // l_cAttrId of the attribute
+ std::string l_cAttrId = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ // value of the attribute
+ std::string l_cAttrValue = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ size_t l_uiSplitProp = 0;
+ size_t l_uiAttrSplit = 0;
+ BOOL l_bCurrentResult = FALSE;
+
+ l_cKey.assign(f_cUserKey);
+
+ // position of first "." in user key
+ size_t l_uiLength = l_cKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+ if (std::string::npos != l_uiLength) {
+ // get the current node name string with node attributes
+ l_cKey = l_cKey.substr(0, l_uiLength); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ l_cNodeName.assign(l_cKey);
+
+ // get children of current node
+ f_pCurrNode = f_pCurrNode->children;
+
+ while (NULL != f_pCurrNode) {
+ // check whether current node is an element node.
+ if (XML_ELEMENT_NODE == f_pCurrNode->type) {
+ l_bResult = TRUE;
+ l_bOperation = FALSE;
+ l_uiAttrLen = 0;
+ l_cAttr.clear();
+
+ // check whether key contains attribute for current node
+ if (std::string::npos != (l_uiAttrLen = l_cKey.find('@'))) {
+ // get the attribute string from node key
+ l_cAttr.assign(l_cKey, (l_uiAttrLen + 1), std::string::npos); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // remove the attribute string from key string
+ l_cKey = l_cKey.substr(0, l_uiAttrLen); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // check whether node name string matches with the current node name
+ if (!l_cKey.compare((PCSTR)f_pCurrNode->name)) {
+ l_cAttrOpt.assign(l_cAttr);
+
+ while (0 < l_cAttr.length()) {
+ // initialize variables
+ l_cAttrId.clear();
+ l_cAttrValue.clear();
+ l_uiSplitProp = 0;
+ l_uiAttrSplit = 0;
+ l_bCurrentResult = FALSE;
+
+ // check whether node have multiple attributes
+ if (std::string::npos != (l_uiSplitProp = l_cAttr.find('|'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else if (std::string::npos != (l_uiSplitProp = l_cAttr.find('&'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else {
+ l_uiSplitProp = l_cAttr.length() - 1;
+ if (std::string::npos != (l_uiAttrSplit = l_cAttr.find('='))) {
+ l_cAttrId = l_cAttr.substr(0, l_uiAttrSplit); // LCOV_EXCL_BR_LINE 11: except branch
+ l_cAttrValue = l_cAttr.substr(l_uiAttrSplit + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+
+ // compare the value of attributes
+ xmlChar *l_pAttrValue = xmlGetProp(f_pCurrNode, (const xmlChar *)l_cAttrId.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
+ if (NULL != l_pAttrValue) {
+ if (!l_cAttrValue.compare((PCSTR)l_pAttrValue)) {
+ l_bCurrentResult = TRUE;
+ }
+
+ xmlFree(l_pAttrValue); // LCOV_EXCL_BR_LINE 11: except branch
+ l_pAttrValue = NULL;
+ }
+
+ // combine the result of all attributes
+ if (!l_bOperation) {
+ l_bResult = l_bResult && l_bCurrentResult;
+ } else {
+ l_bResult = l_bResult || l_bCurrentResult;
+ }
+
+ if ('|' == l_cAttr[l_uiSplitProp]) {
+ l_bOperation = TRUE;
+ } else {
+ l_bOperation = FALSE;
+ }
+
+ if ((!l_bResult) && (!l_bOperation)) {
+ // break from current while loop
+ break;
+ }
+
+ l_cAttr = l_cAttr.substr(l_uiSplitProp + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // if attributes not matched move to next node
+ if (!l_bResult) {
+ // search for the same node name in next child nodes
+ l_cKey.assign(l_cNodeName);
+ } else {
+ // read text of current node
+ if ((NULL != f_pCurrNode->children) &&
+ (XML_TEXT_NODE == f_pCurrNode->children->type) &&
+ (NULL == f_pCurrNode->children->next)) {
+ if (!f_cValue.empty()) {
+ f_cValue.append("\n");
+ }
+
+ // append the result in string
+ f_cValue.append((PCSTR) f_pCurrNode->children->content); // LCOV_EXCL_BR_LINE 11: except branch
+
+ f_bKeyFound = TRUE;
+ }
+ }
+ } else {
+ l_bResult = FALSE;
+ }
+
+ if (l_bResult) {
+ // parse children and next nodes of current node
+ if (std::string::npos != l_uiLength) {
+ l_cKey = f_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+
+ l_eStatus = XMLGetValue(f_pCurrNode, l_cKey, f_cValue, f_bKeyFound);
+ }
+
+ l_cKey = l_cNodeName;
+ }
+ }
+
+ f_pCurrNode = f_pCurrNode->next;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp
new file mode 100755
index 0000000..2876e22
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp
@@ -0,0 +1,338 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CXMLWriter class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_xml_writer.h>
+#include <string>
+#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+CXMLWriter *GetCXMLWriterObject(CHAR *f_cfilepath) {
+ CXMLWriter *l_p_xml_writer = NULL;
+ if (NULL != f_cfilepath) {
+ l_p_xml_writer = new(std::nothrow) CXMLWriter(f_cfilepath); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ return l_p_xml_writer;
+}
+
+CXMLWriter *GetCXMLWriterObjectNoParam() {
+ return (new(std::nothrow) CXMLWriter()); // LCOV_EXCL_BR_LINE 11: except branch
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+CXMLWriter::CXMLWriter(): m_pXmlDoc(NULL), m_cFilePath("") {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
+
+CXMLWriter::CXMLWriter(const std::string &f_cFilePath): m_pXmlDoc(NULL), m_cFilePath(f_cFilePath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_cFilePath.c_str());
+
+ // create document object structure
+ m_pXmlDoc = xmlParseFile(m_cFilePath.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (!m_pXmlDoc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL");
+ }
+}
+
+CXMLWriter::~CXMLWriter() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
+
+ if (NULL != m_pXmlDoc) {
+ xmlFreeDoc(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
+ m_pXmlDoc = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CXMLWriter::ParseFile(const std::string &f_cFilePath) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = SetPath(f_cFilePath);
+
+ if (NULL != m_pXmlDoc) {
+ xmlFreeDoc(m_pXmlDoc);
+ m_pXmlDoc = NULL;
+ }
+
+ // create document object structure
+ m_pXmlDoc = xmlParseFile(f_cFilePath.c_str());
+
+ if (NULL == m_pXmlDoc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CXMLWriter::SetPath(const std::string &f_cPath) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (!f_cPath.empty()) {
+ // set the file path
+ m_cFilePath.assign(f_cPath);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+VOID CXMLWriter::SetDataPtr(PVOID f_pData) {
+ m_pXmlDoc = NULL;
+ if (NULL != f_pData) {
+ // set the doc pointer
+ m_pXmlDoc = static_cast<xmlDocPtr>(f_pData);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Data Pointer not set in xml writer"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+}
+
+EFrameworkunifiedStatus CXMLWriter::SetValue(const std::string &f_cKey, std::string f_cValue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Key %s", f_cKey.c_str());
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pXmlDoc && (!f_cKey.empty())) {
+ std::string l_cUserKey = "";
+ l_cUserKey.assign(f_cKey);
+
+ // get the root node element
+ xmlNodePtr l_pCurrNode = xmlDocGetRootElement(m_pXmlDoc);
+
+ if (NULL != l_pCurrNode) {
+ // remove the root node name from key
+ size_t l_uiLength = l_cUserKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (std::string::npos != l_uiLength) {
+ l_cUserKey = l_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // if root node name matches with the name in received key
+ if (!(f_cKey.substr(0, l_uiLength)).compare((PCSTR)l_pCurrNode->name)) {
+ BOOL l_bKeyFound = FALSE;
+ l_eStatus = XMLSetValue(l_pCurrNode, l_cUserKey, f_cValue, l_bKeyFound);
+
+ if (!l_bKeyFound) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document structure pointer m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CXMLWriter::XMLSetValue(xmlNodePtr f_pCurrNode,
+ const std::string &f_cUserKey,
+ std::string &f_cValue,
+ BOOL &f_bKeyFound) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (!f_cUserKey.empty() && NULL != f_pCurrNode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Key :: %s", f_cUserKey.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ std::string l_cKey = "";
+
+ // result of previous attribute of same node
+ BOOL l_bResult = TRUE;
+
+ // this parameter specifies whether to AND or OR the current result with previous result
+ // TRUE means AND while FALSE means OR
+ BOOL l_bOperation = FALSE;
+
+ // position of "@" in user key if exists
+ size_t l_uiAttrLen = 0;
+
+ // get the single attribute from list of attributes of node
+ std::string l_cAttr = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ std::string l_cNodeName = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // contains the single attribute key, value
+ std::string l_cAttrOpt = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // l_cAttrId of the attribute
+ std::string l_cAttrId = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ // value of the attribute
+ std::string l_cAttrValue = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ size_t l_uiSplitProp = 0;
+ size_t l_uiAttrSplit = 0;
+ BOOL l_bCurrentResult = FALSE;
+
+ l_cKey.assign(f_cUserKey);
+
+ // position of first "." in user key
+ size_t l_uiLength = l_cKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+ if (std::string::npos != l_uiLength) {
+ // get the current node name string with node attributes
+ l_cKey = l_cKey.substr(0, l_uiLength); // LCOV_EXCL_BR_LINE 11: except branch
+
+ l_cNodeName.assign(l_cKey);
+ }
+
+ // get children of current node
+ f_pCurrNode = f_pCurrNode->children;
+
+ while (NULL != f_pCurrNode) {
+ // check whether current node is an element node.
+ if (XML_ELEMENT_NODE == f_pCurrNode->type) {
+ l_bResult = TRUE;
+ l_bOperation = FALSE;
+ l_uiAttrLen = 0;
+ l_cAttr.clear();
+
+ // check whether key contains attribute for current node
+ if (std::string::npos != (l_uiAttrLen = l_cKey.find('@'))) {
+ // get the attribute string from node key
+ l_cAttr.assign(l_cKey, (l_uiAttrLen + 1), std::string::npos); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // remove the attribute string from key string
+ l_cKey = l_cKey.substr(0, l_uiAttrLen); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // check whether node name string matches with the current node name
+ if (!l_cKey.compare((PCSTR)f_pCurrNode->name)) {
+ l_cAttrOpt.assign(l_cAttr);
+
+ while (0 < l_cAttr.length()) {
+ // initialize variables
+ l_cAttrId.clear();
+ l_cAttrValue.clear();
+ l_uiSplitProp = 0;
+ l_uiAttrSplit = 0;
+ l_bCurrentResult = FALSE;
+
+ // check whether node have multiple attributes
+ if (std::string::npos != (l_uiSplitProp = l_cAttr.find('|'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else if (std::string::npos != (l_uiSplitProp = l_cAttr.find('&'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else {
+ l_uiSplitProp = l_cAttr.length() - 1;
+ if (std::string::npos != (l_uiAttrSplit = l_cAttr.find('='))) {
+ l_cAttrId = l_cAttr.substr(0, l_uiAttrSplit); // LCOV_EXCL_BR_LINE 11: except branch
+ l_cAttrValue = l_cAttr.substr(l_uiAttrSplit + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+
+ // compare the value of attributes
+ xmlChar *l_pAttrValue = xmlGetProp(f_pCurrNode, (const xmlChar *)l_cAttrId.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
+ if (NULL != l_pAttrValue) {
+ if (!l_cAttrValue.compare((PCSTR)l_pAttrValue)) {
+ l_bCurrentResult = TRUE;
+ }
+ }
+ xmlFree(l_pAttrValue);
+ l_pAttrValue = NULL;
+
+ // combine the result of all attributes
+ if (!l_bOperation) {
+ l_bResult = l_bResult && l_bCurrentResult;
+ } else {
+ l_bResult = l_bResult || l_bCurrentResult;
+ }
+
+ if ('|' == l_cAttr[l_uiSplitProp]) {
+ l_bOperation = TRUE;
+ } else {
+ l_bOperation = FALSE;
+ }
+
+ if ((!l_bResult) && (!l_bOperation)) {
+ // break from current while loop
+ break;
+ }
+
+ l_cAttr = l_cAttr.substr(l_uiSplitProp + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // if attributes not matched move to next node
+ if (!l_bResult) {
+ // search for the same node name in next child nodes
+ l_cKey.assign(l_cNodeName);
+ } else {
+ // read text of current node
+ if ((NULL != f_pCurrNode->children) &&
+ (XML_TEXT_NODE == f_pCurrNode->children->type) &&
+ (NULL == f_pCurrNode->children->next)) {
+ // set the value
+ xmlNodeSetContent(f_pCurrNode, (const xmlChar *)f_cValue.c_str());
+
+ f_bKeyFound = TRUE;
+ }
+ }
+ }
+
+ if (l_bResult) {
+ // parse children and next nodes of current node
+ l_cKey = f_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ l_eStatus = XMLSetValue(f_pCurrNode, l_cKey, f_cValue, f_bKeyFound);
+ }
+ }
+
+ f_pCurrNode = f_pCurrNode->next;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CXMLWriter::SaveData() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // save the doc structure to the file
+ if (-1 == xmlSaveFileEnc(m_cFilePath.c_str(), m_pXmlDoc, "UTF-8")) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp
new file mode 100755
index 0000000..cb05865
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp
@@ -0,0 +1,354 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_XmlParser
+/// \brief This file contains implementation of CXmlParser class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_xmlparser_if.h>
+#include <fstream>
+#include <string>
+#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CXmlParser
+/// Constructor
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlParser::CXmlParser(): m_pXmlDoc(NULL), m_cFileName(""), m_pRootNode(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // for maintaining indentation
+ xmlKeepBlanksDefault(0); // LCOV_EXCL_BR_LINE 11: except branch
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CXmlParser
+/// Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlParser::~CXmlParser() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // clears the document structure
+ ClearDocument(); // LCOV_EXCL_BR_LINE 11: except branch
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ParseXml
+/// Parses the xml file and creates a document structure
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlParser::ParseXml(std::string f_cFileName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // clears the document structure
+ ClearDocument(); // LCOV_EXCL_BR_LINE 11: except branch
+
+ m_cFileName = f_cFileName;
+
+ if (IsReadable(m_cFileName)) {
+ // create document object structure
+ m_pXmlDoc = xmlParseFile(m_cFileName.c_str());
+
+ if (NULL != m_pXmlDoc) {
+ // sets the root node in class
+ m_pRootNode.SetXmlNodePtr(xmlDocGetRootElement(m_pXmlDoc));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document not parsed successfully :: %s", f_cFileName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "File not exists :: %s", f_cFileName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateNewXmlDoc
+/// Creates a new xml document with f_cRootNodeName as root node
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlParser::CreateNewXmlDoc(std::string f_cRootNodeName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ xmlNodePtr l_pRootNodePtr = NULL;
+
+ // clears the document structure
+ ClearDocument();
+
+ if (0 < f_cRootNodeName.length()) {
+ // creates new document structure
+ m_pXmlDoc = xmlNewDoc((const xmlChar *)"1.0");
+ if (NULL != m_pXmlDoc) {
+ // create new node(root)
+ l_pRootNodePtr = xmlNewNode(NULL,
+ (const xmlChar *)f_cRootNodeName.c_str());
+ if (NULL != l_pRootNodePtr) {
+ // sets the root node in document structure
+ xmlDocSetRootElement(m_pXmlDoc, l_pRootNodePtr);
+
+ // sets the root node in class
+ m_pRootNode.SetXmlNodePtr(l_pRootNodePtr);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error creating new root node"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Unable to create new xml document structure"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid root node name :: %s", f_cRootNodeName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SaveXml
+/// Saves the document structure in an xml file
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlParser::SaveXml(std::string f_cFileName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_cFileName = "";
+
+ // if user explicitly provides file name
+ if (0 < f_cFileName.length()) {
+ l_cFileName.assign(f_cFileName);
+ } else { // takes the file name from the CXmlParser object
+ l_cFileName.assign(m_cFileName);
+ }
+
+ if (NULL != m_pXmlDoc) {
+ if (IsReadable(l_cFileName)) {
+ // save the doc structure to the file
+ if (-1 == xmlSaveFormatFileEnc(l_cFileName.c_str(), m_pXmlDoc, "UTF-8", 1)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "File not exists :: %s", f_cFileName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRootNode
+/// Gets the root node object of xml
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlParser::GetRootNode() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_pRootNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddNewNode
+/// Adds the new node to the parent node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlParser::AddNewNode(CXmlNode m_pParentNode, std::string f_cNewNodeName, std::string f_cContent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (!m_pParentNode.IsNull()) {
+ l_pXmlNode = m_pParentNode.AddChildNode(f_cNewNodeName, f_cContent); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveNode
+/// Removes the node from the xml
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlParser::RemoveNode(CXmlNode m_pNode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (!m_pNode.IsNull()) {
+ xmlUnlinkNode(m_pNode.m_pXmlNodePtr);
+ xmlFreeNode(m_pNode.m_pXmlNodePtr);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FindNode
+/// Finds the first matching node, by tag name or path
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlParser::FindNode(std::string f_cNodePath, CXmlNode f_pCurrentNode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ xmlXPathObjectPtr l_pXpathObj = GetNodeSet(f_cNodePath, f_pCurrentNode); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (NULL != l_pXpathObj) {
+ if (NULL != l_pXpathObj->nodesetval && 0 < l_pXpathObj->nodesetval->nodeNr) {
+ l_pXmlNode.SetXmlNodePtr(l_pXpathObj->nodesetval->nodeTab[0]); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NodeSetVal is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ xmlXPathFreeObject(l_pXpathObj); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "xmlXPathObjectPtr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FindAllNodes
+/// Finds all the matching node, by tag name or path
+////////////////////////////////////////////////////////////////////////////////////////////////
+TNodeList CXmlParser::FindAllNodes(std::string f_cNodePath, CXmlNode f_pCurrentNode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TNodeList l_pNodeList;
+
+ xmlXPathObjectPtr l_pXpathObj = GetNodeSet(f_cNodePath, f_pCurrentNode); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (NULL != l_pXpathObj) {
+ if (NULL != l_pXpathObj->nodesetval && 0 < l_pXpathObj->nodesetval->nodeNr) {
+ for (UI_8 l_uiSize = 0;
+ l_uiSize < l_pXpathObj->nodesetval->nodeNr;
+ l_uiSize++) {
+ if (NULL != l_pXpathObj->nodesetval->nodeTab[l_uiSize]) {
+ CXmlNode l_pNode(l_pXpathObj->nodesetval->nodeTab[l_uiSize]); // LCOV_EXCL_BR_LINE 11: except branch
+ l_pNodeList.push_back(l_pNode);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "node pointer is NULL");
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NodeSetVal is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ xmlXPathFreeObject(l_pXpathObj); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "xmlXPathObjectPtr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNodeList;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetNodeSet
+/// Gets the node set resulting from search of nodepath using XPath
+////////////////////////////////////////////////////////////////////////////////////////////////
+xmlXPathObjectPtr CXmlParser::GetNodeSet(std::string f_cNodePath, CXmlNode f_pCurrentNode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ xmlXPathObjectPtr l_pXpathObj = NULL;
+
+ xmlXPathContextPtr l_pXpathCtx = NULL;
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlDoc) {
+ if (!f_pCurrentNode.IsNull()) {
+ l_pXmlNode = f_pCurrentNode;
+ }
+
+ // Create xpath evaluation context
+ l_pXpathCtx = xmlXPathNewContext(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (NULL != l_pXpathCtx) {
+ // set the current node in path context
+ l_pXpathCtx->node = l_pXmlNode.m_pXmlNodePtr;
+
+ // Evaluate xpath expression
+ l_pXpathObj = xmlXPathEvalExpression((const xmlChar *)f_cNodePath.c_str(), l_pXpathCtx); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (NULL == l_pXpathObj) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to evaluate nodepath :: \"%s\"", f_cNodePath.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ // Cleanup of XPath data
+ xmlXPathFreeContext(l_pXpathCtx); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to create new XPath context"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "document object is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXpathObj;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearDocument
+/// Clears the document structure and resets the root node
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CXmlParser::ClearDocument() {
+ if (NULL != m_pXmlDoc) {
+ // free the document
+ xmlFreeDoc(m_pXmlDoc);
+ m_pXmlDoc = NULL;
+
+ // free the global variables that may have been allocated by the parser
+ xmlCleanupParser();
+ }
+
+ m_pRootNode = NULL;
+ m_cFileName.clear();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsReadable
+/// Checks whether the file exists or not
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CXmlParser::IsReadable(const std::string &filename) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReadable = FALSE;
+
+ std::ifstream l_ifstream(filename.c_str());
+
+ if (l_ifstream.good()) {
+ l_bReadable = TRUE;
+ l_ifstream.close(); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReadable;
+}
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp
new file mode 100755
index 0000000..27b6bad
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_XmlParser
+/// \brief This file contains implementation of CXmlAttr class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_xmlparser_if.h>
+#include <string>
+#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CXmlAttr
+/// Constructor of CXmlAttr class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlAttr::CXmlAttr(): m_cKey(""), m_cValue("") {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CXmlAttr
+/// Parameterized constructor of CXmlAttr class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlAttr::CXmlAttr(std::string f_cKey, std::string f_cValue): m_cKey(f_cKey), m_cValue(f_cValue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CXmlAttr
+/// Destructor of CXmlAttr class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlAttr::~CXmlAttr() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp
new file mode 100755
index 0000000..47f6caa
--- /dev/null
+++ b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp
@@ -0,0 +1,658 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_XmlParser
+/// \brief This file contains implementation of CXmlNode class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_xmlparser_if.h>
+#include <string>
+#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CXmlNode
+/// Constructor
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode::CXmlNode(): m_pXmlNodePtr(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CXmlNode
+/// Parameterized Constructor
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode::CXmlNode(xmlNodePtr f_pXmlNodePtr): m_pXmlNodePtr(f_pXmlNodePtr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CXmlNode
+/// Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode::~CXmlNode() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetXmlNodePtr
+/// Sets the xmlNodePtr in class
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CXmlNode::SetXmlNodePtr(xmlNodePtr f_pXmlNodePtr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_pXmlNodePtr = f_pXmlNodePtr;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsNull
+/// Checks whether the node is valid or not
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CXmlNode::IsNull() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bNull = FALSE;
+
+ if (NULL == m_pXmlNodePtr) {
+ l_bNull = TRUE;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bNull;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Type
+/// Gets the type of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedXmlNodeTypes CXmlNode::Type() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedXmlNodeTypes l_eNodeType = FRAMEWORKUNIFIED_XML_NODE_NONE;
+
+ if (NULL != m_pXmlNodePtr) {
+ switch (m_pXmlNodePtr->type) {
+ case XML_ELEMENT_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ELEMENT_NODE;
+ break;
+ case XML_ATTRIBUTE_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ATTRIBUTE_NODE;
+ break;
+ case XML_TEXT_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_TEXT_NODE;
+ break;
+ case XML_CDATA_SECTION_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_CDATA_SECTION_NODE;
+ break;
+ case XML_ENTITY_REF_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ENTITY_REF_NODE;
+ break;
+ case XML_ENTITY_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ENTITY_NODE;
+ break;
+ case XML_PI_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_PI_NODE;
+ break;
+ case XML_COMMENT_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_COMMENT_NODE;
+ break;
+ case XML_DOCUMENT_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_DOCUMENT_NODE;
+ break;
+ case XML_DOCUMENT_TYPE_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_DOCUMENT_TYPE_NODE;
+ break;
+ case XML_DOCUMENT_FRAG_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_DOCUMENT_FRAG_NODE;
+ break;
+ case XML_NOTATION_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_NOTATION_NODE;
+ break;
+ case XML_HTML_DOCUMENT_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_HTML_DOCUMENT_NODE;
+ break;
+ case XML_DTD_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_DTD_NODE;
+ break;
+ case XML_ELEMENT_DECL:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ELEMENT_DECL;
+ break;
+ case XML_ATTRIBUTE_DECL:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ATTRIBUTE_DECL;
+ break;
+ case XML_ENTITY_DECL:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ENTITY_DECL;
+ break;
+ case XML_NAMESPACE_DECL:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_NAMESPACE_DECL;
+ break;
+ case XML_XINCLUDE_START:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_XINCLUDE_START;
+ break;
+ case XML_XINCLUDE_END:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_XINCLUDE_END;
+ break;
+ default:
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eNodeType;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Name
+/// Gets the name of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+std::string CXmlNode::Name() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_cNodeName = "";
+
+ if (NULL != m_pXmlNodePtr && NULL != m_pXmlNodePtr->name) {
+ l_cNodeName = std::string((PCSTR)m_pXmlNodePtr->name); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_cNodeName;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetContent
+/// Gets the content of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+std::string CXmlNode::GetContent() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_cText = "";
+
+ if ((NULL != m_pXmlNodePtr) &&
+ (NULL != m_pXmlNodePtr->children) &&
+ (XML_TEXT_NODE == m_pXmlNodePtr->children->type) &&
+ (NULL == m_pXmlNodePtr->children->next)) {
+ xmlChar * p_xmlText = xmlNodeGetContent(m_pXmlNodePtr);
+ l_cText = std::string((PCSTR)p_xmlText); // LCOV_EXCL_BR_LINE 11: except branch
+ xmlFree(p_xmlText); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_cText;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetContent
+/// Sets or updates the content of current node.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::SetContent(std::string f_cUpdatedText) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pXmlNodePtr) {
+ xmlNodeSetContent(m_pXmlNodePtr, (const xmlChar *)f_cUpdatedText.c_str());
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetAttributeValue
+/// Gets the attribute's value for the key.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::GetAttributeValue(std::string f_cKey, std::string &f_cAttributeValue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pXmlNodePtr) {
+ xmlChar *l_pAttrValue = xmlGetProp(m_pXmlNodePtr,
+ (const xmlChar *)f_cKey.c_str());
+ if (NULL != l_pAttrValue) {
+ f_cAttributeValue.assign((PCSTR)l_pAttrValue);
+
+ xmlFree(l_pAttrValue);
+ l_pAttrValue = NULL;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Attribute key :: %s not found", f_cKey.c_str());
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Node ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetAttributeValue
+/// Sets the attribute's value for the key
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::SetAttributeValue(std::string f_cKey, std::string f_cValue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "SetAttributeValue feature is not available,"
+ "Reason: This API is not supported by libxml2 present in PosixBasedOS001"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddNewAttribute
+/// Add new attribute to the node
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::AddNewAttribute(std::string f_cKey, std::string f_cAttributeValue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ xmlChar* p_key = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cKey.c_str()));
+ xmlChar* p_value = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cAttributeValue.c_str()));
+ if (NULL != m_pXmlNodePtr) {
+ if (NULL == xmlNewNsProp(m_pXmlNodePtr,
+ NULL,
+ p_key,
+ p_value)) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Unable to add new property :: %s", f_cKey.c_str());
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Node ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveAttribute
+/// Removes the attribute from the node with the specified key
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::RemoveAttribute(std::string f_cKey) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "RemoveAttribute feature is not available,"
+ "Reason: This API is not supported by libxml2 present in PosixBasedOS001"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetAttributeItems
+/// Gets the list of all the attribute's key and value of the node
+////////////////////////////////////////////////////////////////////////////////////////////////
+TAttrList CXmlNode::GetAttributeItems() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TAttrList l_cAttrList;
+ std::string l_cKey;
+ std::string l_cValue;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlAttrPtr l_pAttr = m_pXmlNodePtr->properties;
+ l_pAttr != NULL;
+ l_pAttr = l_pAttr->next) {
+ l_cKey = (PCSTR)l_pAttr->name;
+ l_cValue = "";
+
+ if (NULL != l_pAttr->children) {
+ l_cValue = (PCSTR)l_pAttr->children->content;
+ }
+
+ CXmlAttr l_pXmlAttr(l_cKey, l_cValue);
+ l_cAttrList.push_back(l_pXmlAttr); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_cAttrList;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Parent
+/// Gets the parent node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::Parent() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr && NULL != m_pXmlNodePtr->parent) {
+ if (XML_ELEMENT_NODE == m_pXmlNodePtr->parent->type) {
+ l_pXmlNode.SetXmlNodePtr(m_pXmlNodePtr->parent); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FirstChild
+/// Gets the first child of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::FirstChild() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->next) {
+ if (XML_ELEMENT_NODE == l_pNodePtr->type) {
+ l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// LastChild
+/// Gets the last child of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::LastChild() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->last;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->prev) {
+ if (XML_ELEMENT_NODE == l_pNodePtr->type) {
+ l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Children
+/// Gets the list of all the child node of current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+TNodeList CXmlNode::Children() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TNodeList l_pNodeList;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->next) {
+ if (XML_ELEMENT_NODE == l_pNodePtr->type) {
+ CXmlNode l_pXmlNode(l_pNodePtr);
+ l_pNodeList.push_back(l_pXmlNode);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNodeList;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NextSibling
+/// Gets the next sibling node of current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::NextSibling() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->next;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->next) {
+ if (XML_ELEMENT_NODE == l_pNodePtr->type) {
+ l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// PrevSibling
+/// Gets the previous sibling node of current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::PrevSibling() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->prev;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->prev) {
+ if (XML_ELEMENT_NODE == l_pNodePtr->type) {
+ l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FindChildNode
+/// Finds the first immediate sub node matching tag as f_cNodeName.
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::FindChildNode(std::string f_cNodeName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->next) {
+ if ((XML_ELEMENT_NODE == m_pXmlNodePtr->type) &&
+ (0 == f_cNodeName.compare((PCSTR)l_pNodePtr->name))) {
+ l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FindAllChildNodes
+/// Gets the list of all the immediate sub node matching tag as f_cNodeName.
+////////////////////////////////////////////////////////////////////////////////////////////////
+TNodeList CXmlNode::FindAllChildNodes(std::string f_cNodeName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TNodeList l_pNodeList;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->next) {
+ if ((XML_ELEMENT_NODE == m_pXmlNodePtr->type) &&
+ (0 == f_cNodeName.compare((PCSTR)l_pNodePtr->name))) {
+ CXmlNode l_pXmlNode(l_pNodePtr);
+ l_pNodeList.push_back(l_pXmlNode);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNodeList;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetContentOfChildNode
+/// Finds the first level sub node matching tag as f_cNodeName.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::GetContentOfChildNode(std::string f_cNodeName, std::string &f_cContent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CXmlNode l_pXmlNode = FindChildNode(f_cNodeName);
+
+ if (!l_pXmlNode.IsNull()) {
+ f_cContent.assign(l_pXmlNode.GetContent());
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddChildNode
+/// Adds sub node to the current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::AddChildNode(std::string f_cNodeName, std::string f_cText) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // pointer of child node
+ xmlNodePtr l_pChildNode = NULL;
+
+ // content of child node
+ xmlChar *l_cNodeContent = NULL;
+
+ // validate the node name
+ if (NULL != m_pXmlNodePtr && 0 < f_cNodeName.length()) {
+ if (0 < f_cText.length()) {
+ xmlChar* p_text = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cText.c_str()));
+ l_cNodeContent = p_text;
+ }
+
+ if (NULL == (l_pChildNode = xmlNewDocNode(m_pXmlNodePtr->doc,
+ m_pXmlNodePtr->ns,
+ (const xmlChar *)f_cNodeName.c_str(),
+ l_cNodeContent))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error creating child node");
+ } else {
+ l_pChildNode->type = XML_ELEMENT_NODE;
+ l_pChildNode->parent = m_pXmlNodePtr;
+ l_pChildNode->doc = m_pXmlNodePtr->doc;
+
+ // if there is no other child to the parent
+ if (m_pXmlNodePtr->children == NULL) {
+ m_pXmlNodePtr->children = l_pChildNode;
+ m_pXmlNodePtr->last = l_pChildNode;
+ } else { // else add the new child to the end of children list
+ // temp node
+ xmlNodePtr l_pTempNode = m_pXmlNodePtr->last;
+ l_pTempNode->next = l_pChildNode;
+ l_pChildNode->prev = l_pTempNode;
+
+ m_pXmlNodePtr->last = l_pChildNode;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return CXmlNode(l_pChildNode);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddSiblingNode
+/// Adds new node as sibling to the current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::AddSiblingNode(std::string f_cNodeName, std::string f_cText) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ xmlNodePtr l_pNewNode = NULL;
+ xmlNodePtr l_pSiblingNode = NULL;
+
+ if (NULL != m_pXmlNodePtr &&
+ !this->Parent().IsNull()) { // check whether the node is root node
+ if (NULL != (l_pNewNode = xmlNewNode(NULL,
+ (const xmlChar *)f_cNodeName.c_str()))) {
+ if (0 < f_cText.length()) {
+ xmlChar* p_text = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cText.c_str()));
+ xmlNodeSetContent(l_pNewNode, p_text);
+ }
+
+ l_pSiblingNode = xmlAddSibling(m_pXmlNodePtr,
+ l_pNewNode);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return CXmlNode(l_pSiblingNode);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveChildNode
+/// Removes the child node from current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::RemoveChildNode(std::string f_cNodeName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CXmlNode l_pXmlNode = FindChildNode(f_cNodeName);
+ if (!l_pXmlNode.IsNull()) {
+ xmlUnlinkNode(l_pXmlNode.m_pXmlNodePtr);
+ xmlFreeNode(l_pXmlNode.m_pXmlNodePtr);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearNode
+/// Clears the contents, attributes of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::ClearNode() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pXmlNode = m_pXmlNodePtr->children;
+ l_pXmlNode != NULL;
+ l_pXmlNode = m_pXmlNodePtr->children) {
+ xmlUnlinkNode(l_pXmlNode);
+ xmlFreeNode(l_pXmlNode);
+ }
+
+ for (xmlAttrPtr l_pXmlAttr = m_pXmlNodePtr->properties;
+ l_pXmlAttr != NULL;
+ l_pXmlAttr = m_pXmlNodePtr->properties) {
+ xmlRemoveProp(l_pXmlAttr);
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp
new file mode 100755
index 0000000..3965783
--- /dev/null
+++ b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp
@@ -0,0 +1,367 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified__CWORD77__service_if.h>
+#include <native_service/ns__CWORD77__data_pool_if.h>
+#include <other_service/strlcpy.h>
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "ns__CWORD77__data_pool_internal.h"
+#include "ns__CWORD77__common_internal.h"
+
+#define NS__CWORD77__MAX_SESSION_RETRY_COUNT 10
+
+//////////////////////////////////////////
+/// Function : CFrameworkunified_CWORD77_Service
+//////////////////////////////////////////
+CFrameworkunified_CWORD77_Service::CFrameworkunified_CWORD77_Service()
+ : m_cbResponse(NULL),
+ m_cbSessionACK(NULL),
+ m_pSession(NULL),
+ m_cServiceName(""),
+ m_bServiceAvailable(FALSE),
+ m_ui8SessionRetryCount(0),
+ m_hApp(NULL) { // LCOV_EXCL_BR_LINE 11:except branch
+ m_SessTypeToSessObj.clear();
+}
+//////////////////////////////////////////
+/// Function : ~CFrameworkunified_CWORD77_Service
+//////////////////////////////////////////
+CFrameworkunified_CWORD77_Service::~CFrameworkunified_CWORD77_Service() { // LCOV_EXCL_BR_LINE 11:except branch
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ while (l_iter != m_SessTypeToSessObj.end()) {
+ CFrameworkunified_CWORD77_Session *l_pTemp = l_iter->second;
+ DELETEPTR(l_pTemp); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns__CWORD77__common.h"
+ l_iter++;
+ }
+}
+//////////////////////////////////////////
+/// Function : SetResponseCallback
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::SetResponseCallback(ResponseServiceTo_CWORD77_ cbResponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ m_cbResponse = cbResponse;
+ if (m_cbResponse == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "Call back function ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ while (l_iter != m_SessTypeToSessObj.end()) {
+ if (l_iter->second != NULL) {
+ l_iter->second->SetResponseCallback(m_cbResponse);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ l_iter++;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : SetSession
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::SetSession(CFrameworkunified_CWORD77_Session *f_pSessionObj) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ m_SessTypeToSessObj[f_pSessionObj->GetSessionType()] = f_pSessionObj;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : SendMessageToSession
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::SendMessageToSession(UI_32 f_uiSessionType, UI_32 f_uiSrvProtocol) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ l_iter = m_SessTypeToSessObj.find(f_uiSessionType);
+ if (l_iter != m_SessTypeToSessObj.end()) {
+ if (l_iter->second != NULL) {
+ if (eFrameworkunifiedStatusSessionErr == l_iter->second->HandleSessionMessage(f_uiSrvProtocol)) {
+ if (m_bServiceAvailable) {
+ if (NS__CWORD77__MAX_SESSION_RETRY_COUNT < m_ui8SessionRetryCount) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send cmd 0x%X."
+ " But, service is available. Open session req max limit reached [%s].",
+ f_uiSrvProtocol, m_cServiceName.c_str());
+ // TODO(framework_unified): what to do in case of max limit reached?
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send cmd 0x%X."
+ " But, service is available. Re-sending open session req [%s].",
+ f_uiSrvProtocol, m_cServiceName.c_str());
+ // send open session request
+ OpenSessionRetry(f_uiSessionType);
+ m_ui8SessionRetryCount++;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send cmd 0x%X."
+ " Service not yet available.", f_uiSrvProtocol);
+ }
+ } else {
+ // ignore error, already printed by HandleSessionMessage
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object is not there in Map for session type %d ", f_uiSessionType);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+//////////////////////////////////////////
+/// Function : OpenSession
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::OpenSession(HANDLE f_hApp, const std::string &f_sServiceName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ m_cServiceName = f_sServiceName;
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ while (l_iter != m_SessTypeToSessObj.end()) {
+ if (l_iter->second != NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, " Sent open session request for session %d ", l_iter->first); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_iter->second->OpenSession(f_hApp, f_sServiceName); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ l_iter++;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : CloseSession
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::CloseSession(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ while (l_iter != m_SessTypeToSessObj.end()) {
+ if (l_iter->second != NULL) {
+ l_iter->second->CloseSession(f_hApp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ l_iter++;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : OpenSessionAcks
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::OpenSessionAcks(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ OpenSessionAck tOpenSessAck;
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ m_ui8SessionRetryCount = 0;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &tOpenSessAck, sizeof(tOpenSessAck)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "/***********************************************************************/");
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_,
+ __PRETTY_FUNCTION__,
+ "Open session ACK obtained for service: [%s] with session type: [%d]",
+ tOpenSessAck.cSessionName != 0 ? tOpenSessAck.cSessionName : NULL,
+ tOpenSessAck.sessionType);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "/***********************************************************************/");
+ // LCOV_EXCL_BR_STOP
+ UI_32 l_uisessionType = tOpenSessAck.sessionType;
+ /// Session Acks
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ while (l_iter != m_SessTypeToSessObj.end()) {
+ if (l_iter->second != NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "Get session type = %d", l_iter->second->GetSessionType()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ if (l_uisessionType == l_iter->second->GetSessionType()) {
+ l_iter->second->OpenSessionAcknowledge(f_hApp);
+
+ if (m_cbSessionACK != NULL) {
+ (VOID)m_cbSessionACK(f_hApp, m_cServiceName, tOpenSessAck.cSessionName, tOpenSessAck.sessionType,
+ tOpenSessAck.eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR,
+ __FUNCTION__,
+ "Unexpected Session_Type from service [%s]. Obtained Session_Type: [%d] != Expected Session_Type: [%d]",
+ tOpenSessAck.cSessionName != 0 ? tOpenSessAck.cSessionName : NULL,
+ l_uisessionType,
+ l_iter->second->GetSessionType()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ l_iter++;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : OpenServiceOnAvailability
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::OpenServiceOnAvailability(HANDLE f_hApp, const std::string &f_sServiceName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ m_hApp = f_hApp;
+ m_bServiceAvailable = TRUE;
+ m_ui8SessionRetryCount = 0;
+ AttachOpenSessionAckCallback(f_hApp);
+ OpenSession(f_hApp, f_sServiceName);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return eStatus;
+}
+//////////////////////////////////////////
+/// Function : CloseServiceOnUnavailability
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::CloseServiceOnUnavailability(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ m_bServiceAvailable = FALSE;
+ m_ui8SessionRetryCount = 0;
+ CloseSession(f_hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return eStatus;
+}
+
+//////////////////////////////////////////
+/// Function : AddNotification
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::AddNotification(PCSTR f_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ FrameworkunifiedNotificationCallbackHandler tNotifyStruct = {};
+ /**
+ * @todo
+ * Defining a NULL for argument f_pNotification results in a segmentation fault.
+ */
+ strlcpy(tNotifyStruct.cNotification, f_pNotification, sizeof(tNotifyStruct.cNotification)); // LCOV_EXCL_BR_LINE 11:except branch
+ tNotifyStruct.callBack = CCallback< CFrameworkunified_CWORD77_Service, &CFrameworkunified_CWORD77_Service::OnServiceNtf >::set(this); // LCOV_EXCL_BR_LINE 11:except branch
+ m_vServiceNotifications.push_back(tNotifyStruct); // LCOV_EXCL_BR_LINE 11:except branch
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+
+//////////////////////////////////////////
+/// Function : SubscribeNotifications
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::SubscribeNotifications(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t Size = m_vServiceNotifications.size();
+ for (size_t i = 0; i < Size; i++) {
+ if (m_vServiceNotifications[i].callBack != NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "Before subscribing notifications"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSubscribeNotificationWithCallback(f_hApp, m_vServiceNotifications[i].cNotification,
+ m_vServiceNotifications[i].callBack)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSubscribeNotificationWithCallback fail"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : UnSubscribeNotifications
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::UnSubscribeNotifications(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t Size = m_vServiceNotifications.size();
+ for (size_t i = 0; i < Size; i++) {
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedUnsubscribeNotificationWithCallback(f_hApp, m_vServiceNotifications[i].cNotification)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedUnsubscribeNotificationWithCallback fail");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+/// Function : OnServiceNtf
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::OnServiceNtf(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {};
+ PCSTR l_cNotificationName = FrameworkunifiedGetLastNotification(hApp);
+ // retrieve notification name
+ // FrameworkunifiedGetSystemInfo(hApp, l_cNotificationName);
+
+ UI_32 l_uiLength = FrameworkunifiedGetMsgLength(hApp);
+ if (l_uiLength != 0) {
+ std::vector<char> data;
+ data.resize(l_uiLength);
+ if (eFrameworkunifiedStatusOK == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &data[0], l_uiLength))) {
+ SetRespNotfnDataIn_CWORD77_DataPool(l_cNotificationName, static_cast<UI_32>(data.size()), &data[0]);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Error, "
+ "Resp Notfn Data not set in _CWORD77_ data pool, status: 0x%x", l_eStatus);
+ }
+ } else {
+ SetRespNotfnDataIn_CWORD77_DataPool(l_cNotificationName, 0, NULL);
+ }
+
+ m_cbResponse(hApp, NOTIFICATION, m_cServiceName);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+/// Function : OpenSessionRetry
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::OpenSessionRetry(UI_32 f_ui32SessionType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_FUNC, __FUNCTION__, "+");
+ if (!m_cServiceName.empty() && (NULL != m_hApp)) {
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.find(f_ui32SessionType);
+ if (l_iter != m_SessTypeToSessObj.end()) {
+ if (NULL != l_iter->second) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "Re-sending open session req for session type %d ", l_iter->first);
+ l_iter->second->OpenSession(m_hApp, m_cServiceName);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Can't retry for open session req. Service name: [%s], hApp:[%p].",
+ m_cServiceName.c_str(),
+ m_hApp);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_FUNC, __FUNCTION__, "-");
+}
+
+//////////////////////////////////////////
+/// Function : Set_CWORD77_OpenSessionACK
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::Set_CWORD77_OpenSessionACK(SessionAckTo_CWORD77_ cbResponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ m_cbSessionACK = cbResponse;
+ if (NULL == m_cbSessionACK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __PRETTY_FUNCTION__, "Call back function ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
diff --git a/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp
new file mode 100755
index 0000000..1211f91
--- /dev/null
+++ b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp
@@ -0,0 +1,325 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified__CWORD77__session_if.h>
+#include <native_service/ns__CWORD77__data_pool_if.h>
+#include <boost/bind.hpp>
+#include <utility>
+#include <vector>
+#include "ns__CWORD77__data_pool_internal.h"
+#include "ns__CWORD77__common_internal.h"
+
+//////////////////////////////////////////
+/// Function : CFrameworkunified_CWORD77_Session
+//////////////////////////////////////////
+CFrameworkunified_CWORD77_Session::CFrameworkunified_CWORD77_Session() {
+ m_hSession = NULL;
+ m_hApp = NULL;
+ m_hService = NULL;
+ m_uiSessionType = 0;
+}
+//////////////////////////////////////////
+/// Function : ~CFrameworkunified_CWORD77_Session
+//////////////////////////////////////////
+CFrameworkunified_CWORD77_Session::~CFrameworkunified_CWORD77_Session() { // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+void CFrameworkunified_CWORD77_Session::SetSessionType(const UI_32 &sessioType) {
+ m_uiSessionType = sessioType;
+}
+
+//////////////////////////////////////////
+/// Function : GetSessionType
+//////////////////////////////////////////
+UI_32 CFrameworkunified_CWORD77_Session::GetSessionType() {
+ return m_uiSessionType;
+}
+//////////////////////////////////////////
+/// Function : SetResponseCallback
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Session::SetResponseCallback(ResponseServiceTo_CWORD77_ f_cbResponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ m_ResponseTo_CWORD77_ = f_cbResponse;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : AddProtocolHandler
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Session::AddProtocolHandler(UI_32 f_uiCmdId, CbFuncPtr f_cbFuncPtr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ FrameworkunifiedProtocolCallbackHandler l_tProtocolCallback;
+ l_tProtocolCallback.iCmd = f_uiCmdId;
+ l_tProtocolCallback.callBack = f_cbFuncPtr;
+ m_vSessionProtocolHanlder.push_back(l_tProtocolCallback);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+//////////////////////////////////////////
+/// Function : AddEventHandler
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Session::AddEventHandler(UI_32 f_uiCmdId, CbFuncPtr f_cbFuncPtr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ FrameworkunifiedProtocolCallbackHandler l_tProtocolCallback;
+ l_tProtocolCallback.iCmd = f_uiCmdId;
+ l_tProtocolCallback.callBack = f_cbFuncPtr;
+ m_vSessionEventHandler.push_back(l_tProtocolCallback);
+ m_vEventVector.push_back(f_uiCmdId); // Code added by Shyam
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+//////////////////////////////////////////
+/// Function : AttachProtocolwithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::AttachProtocolwithDispatcher(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_uiSize = m_vSessionProtocolHanlder.size();
+ PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp);
+ for (size_t i = 0; i < l_uiSize; i++) {
+ FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, m_vSessionProtocolHanlder[i].iCmd,
+ m_vSessionProtocolHanlder[i].callBack, m_hSession);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : DetachProtocolwithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::DetachProtocolwithDispatcher(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_uiSize = m_vSessionProtocolHanlder.size();
+ PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp);
+ for (size_t i = 0; i < l_uiSize; i++) {
+ FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_pRequester, m_vSessionProtocolHanlder[i].iCmd,
+ m_hSession);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : AttachEventswithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::AttachEventswithDispatcher(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_uiSize = m_vEventVector.size();
+
+ for (size_t i = 0; i < l_uiSize; i++) {
+ l_eStatus = FrameworkunifiedRegisterEvent(m_hSession, m_vEventVector[i]);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : AttachEventswithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::RegisterEvents(HANDLE f_hApp) {
+ // Function: added by Shyam to overcome the naming conflict in registering the event
+ return AttachEventswithDispatcher(f_hApp);
+}
+
+//////////////////////////////////////////
+/// Function : AttachEventHandlerswithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::AttachEventHandlerswithDispatcher(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_uiSize = m_vSessionEventHandler.size();
+ PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp);
+ for (size_t i = 0; i < l_uiSize; i++) {
+ FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, m_vSessionEventHandler[i].iCmd,
+ m_vSessionEventHandler[i].callBack, m_hSession);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : DetachEventHandlerswithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::DetachEventHandlerswithDispatcher(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_uiSize = m_vSessionEventHandler.size();
+ PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp);
+ for (size_t i = 0; i < l_uiSize; i++) {
+ FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_pRequester, m_vSessionEventHandler[i].iCmd,
+ m_hSession);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+/// Function : HandleSessionMessage
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::HandleSessionMessage(UI_32 cmdID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ UI_32 size = 0;
+ PVOID data = NULL;
+
+ if (NULL != m_hSession && NULL != m_hService) {
+ eStatus = GetReqDataFrom_CWORD77_DataPool(std::make_pair(cmdID, FrameworkunifiedGetSessionName(m_hService)), size, data);
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ eStatus = FrameworkunifiedSendMsg(m_hSession, cmdID, size, data);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg() returned %d", eStatus);
+ }
+ } else if (eFrameworkunifiedStatusDbRecNotFound == eStatus) {
+ // FIXME: This is added to help, if there is any command with no data. So, that services
+ // don't need to provide _CWORD77_ interfaces for such command.
+ // Correct way to solve the problem is, let services provide one _CWORD77_ interface
+ // which will write 0 length in data pool.
+ // Impact: This may have one impact that, service is expecting some data, but
+ // _CWORD77_ sends data with 0 length because it didn't find anything in the data pool.
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__,
+ "GetReqDataFrom_CWORD77_DataPool() returned %d. But, still sending cmd 0x%X to service %s with length 0.",
+ eStatus, cmdID, FrameworkunifiedGetSessionName(m_hService));
+ eStatus = FrameworkunifiedSendMsg(m_hSession, cmdID, 0, NULL);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg() returned %d", eStatus);
+ }
+ // end fixme
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "GetReqDataFrom_CWORD77_DataPool() returned %d. Can't send cmd 0x%X to service %s.",
+ eStatus, cmdID, FrameworkunifiedGetSessionName(m_hService));
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Error: HandleSessionMessage: Error sending cmd 0x%X request to service."
+ " Session handle %p Service Handle %p", cmdID, m_hSession, m_hService);
+ if (NULL == m_hSession) {
+ eStatus = eFrameworkunifiedStatusSessionErr;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "- %d", eStatus);
+ return eStatus;
+}
+
+//////////////////////////////////////////
+/// Function : AttachResponseCallbacks
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Session::AttachResponseCallbacks(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ UI_32 l_uiCount = 0;
+ PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp);
+
+ // attach response protocols
+ UI_32 const *l_uiResponseProtocol = GetResponseProtocolArray();
+ if (NULL != l_uiResponseProtocol) {
+ for (; l_uiCount < GetResponseProtocolArrayLength(); l_uiResponseProtocol++, l_uiCount++) {
+ FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, *l_uiResponseProtocol,
+ boost::bind(&CFrameworkunified_CWORD77_Session::OnResponse, this, f_hApp), m_hSession);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No Response protocols available for session with %s",
+ FrameworkunifiedGetSessionName(m_hService));
+ }
+
+ // attach events
+ l_uiCount = 0;
+ UI_32 const *l_uiEvents = GetEventArray();
+ if (NULL != l_uiEvents) {
+ for (; l_uiCount < GetEventArrayLength(); l_uiEvents++, l_uiCount++) {
+ // attach callback
+ FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, *l_uiEvents,
+ boost::bind(&CFrameworkunified_CWORD77_Session::OnResponse, this, f_hApp), m_hSession); // LCOV_EXCL_BR_LINE 11:except branch
+ // register event
+ FrameworkunifiedRegisterEvent(m_hSession, *l_uiEvents);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No event protocols available for session with %s",
+ FrameworkunifiedGetSessionName(m_hService));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+
+//////////////////////////////////////////
+/// Function : DetachResponseCallbacks
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Session::DetachResponseCallbacks(HANDLE f_hApp) {
+ if (NULL != m_hSession) {
+ UI_32 l_uiCount = 0;
+ PCSTR l_cSessionName = FrameworkunifiedGetSessionName(m_hSession);
+ // detach response protocols
+ UI_32 const *l_uiResponseProtocol = GetResponseProtocolArray();
+ if (NULL != l_uiResponseProtocol) {
+ for (; l_uiCount < GetResponseProtocolArrayLength(); l_uiResponseProtocol++, l_uiCount++) {
+ FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_cSessionName, *l_uiResponseProtocol, m_hSession);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No Response protocols available for session with %s",
+ FrameworkunifiedGetSessionName(m_hService));
+ }
+
+ // detach and unregister events
+ l_uiCount = 0;
+ UI_32 const *l_uiEvents = GetEventArray();
+ if (NULL != l_uiEvents) {
+ for (; l_uiCount < GetEventArrayLength(); l_uiEvents++, l_uiCount++) {
+ FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_cSessionName, *l_uiEvents, m_hSession);
+ FrameworkunifiedUnRegisterEvent(m_hSession, *l_uiEvents);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No event protocols available for session with %s",
+ FrameworkunifiedGetSessionName(m_hService));
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Detach not required. Session not yet available");
+ }
+}
+
+//////////////////////////////////////////
+/// Function : OnResponse
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::OnResponse(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ UI_32 length = FrameworkunifiedGetMsgLength(f_hApp);
+ UI_32 cmdId = FrameworkunifiedGetMsgProtocol(f_hApp);
+ PCSTR l_cMsgSourceName = FrameworkunifiedGetMsgSrc(f_hApp);
+ if (NULL != l_cMsgSourceName) {
+ if (length != 0) {
+ std::vector<char> data;
+ data.resize(length);
+ eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &data[0], length);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "OnResponse from %s cmdId:%d", l_cMsgSourceName, cmdId);
+ SetRespDataIn_CWORD77_DataPool(std::make_pair(cmdId, l_cMsgSourceName), static_cast<UI_32>(data.size()), &data[0]);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "OnResponse from %s cmdId:[%d], Value: [NULL]", l_cMsgSourceName, cmdId);
+ SetRespDataIn_CWORD77_DataPool(std::make_pair(cmdId, l_cMsgSourceName), 0, NULL);
+ }
+
+ m_ResponseTo_CWORD77_(f_hApp, RESPONSE, l_cMsgSourceName);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Setting response value of cmd 0x%X in data pool.", cmdId);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "- %d", eStatus);
+ return eStatus;
+}
+
diff --git a/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h
new file mode 100755
index 0000000..68efb44
--- /dev/null
+++ b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h
@@ -0,0 +1,20 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS__CWORD77__SERVICEIF_SRC_FRAMEWORKUNIFIED_STUB_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS__CWORD77__SERVICEIF_SRC_FRAMEWORKUNIFIED_STUB_H_
+extern size_t strlcpy(char *destination, const char *source, size_t size);
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS__CWORD77__SERVICEIF_SRC_FRAMEWORKUNIFIED_STUB_H_
diff --git a/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..88693cd
--- /dev/null
+++ b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001
@@ -0,0 +1,208 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS__CWORD77__ServiceIf
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS__CWORD77__ServiceIf
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/_CWORD77_/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+#DYNAMIC_LIBS += \
+# xml2 \
+# m
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+module_dirs: build_dirs
+
diff --git a/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h
new file mode 100755
index 0000000..78f96a7
--- /dev/null
+++ b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// @defgroup tag_HMI_CWORD77_Controller HMI _CWORD77_ Controller
+/// @file ns__CWORD77__common_internal.h
+/// @brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__COMMON_INTERNAL_H_ // NOLINT (readability/nolint)
+#define NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__COMMON_INTERNAL_H_
+
+#include <native_service/ns__CWORD77__types.h>
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+EFrameworkunifiedStatus Set_CWORD77_DataPoolKeyValue(std::string Key, std::string Value);
+std::string Get_CWORD77_DataPoolKeyValue(std::string Key);
+
+template <typename T>
+UI_32 _CWORD77_GetMsgLength(HANDLE hApp) {
+ UI_32 uiLength = FrameworkunifiedGetMsgLength(hApp);
+ return (uiLength / sizeof(T));
+}
+
+template <typename T>
+EFrameworkunifiedStatus _CWORD77_GetMsgData(HANDLE hApp, T *pData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_8 *pTemp = reinterpret_cast<UI_8 *>(pData);
+ eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, pTemp, sizeof(T));
+ return eStatus;
+}
+
+#endif // NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__COMMON_INTERNAL_H_ // NOLINT (readability/nolint)
+//@}
diff --git a/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h
new file mode 100755
index 0000000..1ad792e
--- /dev/null
+++ b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// @file ns__CWORD77__data_pool_internal.h
+/// @brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__DATA_POOL_INTERNAL_H_ // NOLINT (readability/nolint)
+#define NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__DATA_POOL_INTERNAL_H_
+
+#include <native_service/ns__CWORD77__types.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRespDataIn_CWORD77_DataPool
+/// API to set data associated with response into _CWORD77_ Data Pool
+///
+/// \param [in] f_DataPoolKey
+/// _CWORD77_DataPoolKey - Data pool key
+/// \param [in] f_uiSize
+/// UI_32 - size of the data
+/// \param [in] f_pData
+/// PVOID - void pointer to data
+///
+/// \return VOID - None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID SetRespDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, const PVOID f_pData);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetReqDataIn_CWORD77_DataPool
+/// API to get data associated with request from _CWORD77_ Data Pool
+///
+/// \param [in] f_DataPoolKey
+/// _CWORD77_DataPoolKey - Data pool key
+/// \param [in] f_uiSize
+/// UI_32 - size of the data
+/// \param [in] f_pData
+/// PVOID - void pointer to data
+///
+/// \return EFrameworkunifiedStatus - Succes or Error
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetReqDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData); // NOLINT (readability/nolint)
+
+#endif // NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__DATA_POOL_INTERNAL_H_ // NOLINT (readability/nolint)
+//@}
diff --git a/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp
new file mode 100755
index 0000000..b48062a
--- /dev/null
+++ b/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp
@@ -0,0 +1,538 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns__CWORD77__data_pool_table.h>
+#include <native_service/ns__CWORD77__data_pool_if.h>
+#include <vector>
+#include <string>
+#include <map>
+#include <utility>
+#include "ns__CWORD77__data_pool_internal.h"
+#include "ns__CWORD77__common_internal.h"
+
+C_CWORD77_DataPool g__CWORD77_DataPool;
+C_CWORD77_DataPool *C_CWORD77_DataPool::m_p_CWORD77_DataPoolInstance = NULL;
+
+// For getting/setting notification data from data pool,
+// data key will be pair<g_uiNotificationDataPoolId,"NotificationName">
+static const UI_32 g_uiNotificationDataPoolId = 0;
+
+/////////////////////////////////////////////////////////////////////////////////
+/// NoOfElementsinData
+/////////////////////////////////////////////////////////////////////////////////
+UI_32 NoOfElementsinData(std::string Input) {
+ std::string first = "";
+ std::istringstream ss(Input);
+ int i = 0;
+ while (!ss.eof()) {
+ getline(ss, first, ',');
+ if (first != "") {
+ i++;
+ }
+ }
+ return i;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// ConvertArrayStringsToString
+/////////////////////////////////////////////////////////////////////////////////
+std::string ConvertArrayStringsToString(std::string *strArr, int Size) {
+ int length = 0;
+ std::string Result;
+ if (strArr == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "strArr is NULL");
+ Result.append("");
+ return Result;
+ }
+ while (length < Size) {
+ Result.append(strArr[length]);
+ Result.append(",");
+ length++;
+ }
+ Result.append("");
+ return Result;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// ConvertStringToArrString
+/////////////////////////////////////////////////////////////////////////////////
+void ConvertStringToArrString(std::string Input, std::string *strArr,
+ UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ if (strArr == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "strArr is NULL");
+ return;
+ }
+ int i = 0;
+ std::string first = "";
+ std::istringstream ss(Input);
+ while (!ss.eof()) {
+ getline(ss, first, ',');
+ if (first != "") {
+ strArr[i] = first;
+ i++;
+ }
+ }
+ ArraySize = i;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// C_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+C_CWORD77_DataPool::C_CWORD77_DataPool() {
+ m__CWORD77_DataRequestTable.clear();
+ m__CWORD77_DataResponseTable.clear();
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// ~C_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+C_CWORD77_DataPool::~C_CWORD77_DataPool() {
+ m__CWORD77_DataRequestTable.clear();
+ m__CWORD77_DataResponseTable.clear();
+}
+
+//////////////////////////////////////////
+/// Function : GetInstance
+//////////////////////////////////////////
+C_CWORD77_DataPool *C_CWORD77_DataPool::GetInstance() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "GetInstance");
+ if (m_p_CWORD77_DataPoolInstance == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "Before creating object");
+ m_p_CWORD77_DataPoolInstance = new C_CWORD77_DataPool();
+ }
+ return m_p_CWORD77_DataPoolInstance;
+}
+
+//////////////////////////////////////////
+/// Function : DeleteInstance
+//////////////////////////////////////////
+void C_CWORD77_DataPool::DeleteInstance() {
+ DELETEPTR(m_p_CWORD77_DataPoolInstance);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetValueFromMap
+/////////////////////////////////////////////////////////////////////////////////
+void C_CWORD77_DataPool::GetValueFromMap(ETableType TableType, UI_32 VarName, EDataType &DataType, std::string &Strvalue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::map<UI_32, _CWORD77_Data>::iterator iter;
+ std::string temp;
+
+ if (TableType == REQUEST_TABLE) {
+ iter = m__CWORD77_DataRequestTable.begin();
+ iter = m__CWORD77_DataRequestTable.find(VarName);
+ if (iter != m__CWORD77_DataRequestTable.end()) {
+ DataType = iter->second.DataType;
+ temp = iter->second.DataValue;
+ }
+ } else {
+ iter = m__CWORD77_DataResponseTable.begin();
+ iter = m__CWORD77_DataResponseTable.find(VarName);
+ if (iter != m__CWORD77_DataResponseTable.end()) {
+ DataType = iter->second.DataType;
+ temp = iter->second.DataValue;
+ }
+ }
+ Strvalue.assign(temp);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetValueinMap
+/////////////////////////////////////////////////////////////////////////////////
+void C_CWORD77_DataPool::SetValueinMap(ETableType TableType, UI_32 VarName, EDataType VarType, std::string Result) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ _CWORD77_Data t_CWORD77_Data;
+ t_CWORD77_Data.DataType = VarType;
+ t_CWORD77_Data.DataValue = Result;
+ if (TableType == REQUEST_TABLE) {
+ m__CWORD77_DataRequestTable[VarName] = t_CWORD77_Data;
+ } else {
+ m__CWORD77_DataResponseTable[VarName] = t_CWORD77_Data;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetNoofElementsofData
+/////////////////////////////////////////////////////////////////////////////////
+UI_32 C_CWORD77_DataPool::GetNoofElementsofData(ETableType TableType, UI_32 KeyName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EDataType DataType = UNKNOWNTYPE;
+ std::string Result = "";
+ GetValueFromMap(TableType, KeyName, DataType, Result);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return NoOfElementsinData(Result);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetDataType
+/////////////////////////////////////////////////////////////////////////////////
+EDataType C_CWORD77_DataPool::GetDataType(ETableType TableType, UI_32 KeyName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EDataType DataType = UNKNOWNTYPE;
+ std::string Result = "";
+ GetValueFromMap(TableType, KeyName, DataType, Result);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return DataType;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void C_CWORD77_DataPool::SetArrayStringData(ETableType TableType, UI_32 VarName, EDataType VarType,
+ std::string DataValue[], UI_32 size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::string Result = ConvertArrayStringsToString(DataValue, size);
+ SetValueinMap(TableType, VarName, VarType, Result);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void C_CWORD77_DataPool::GetArrayStringData(ETableType TableType, UI_32 VarName, std::string DataValue[], UI_32 &size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::string Result = "";
+ EDataType DataType = UNKNOWNTYPE;
+ GetValueFromMap(TableType, VarName, DataType, Result);
+ ConvertStringToArrString(Result, DataValue, size);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRequestArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void SetRequestArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size) {
+ g__CWORD77_DataPool.SetReqArrayStringData(VarName, VarType, DataValue, size);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetResponseArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void SetResponseArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size) {
+ g__CWORD77_DataPool.SetRespArrayStringData(VarName, VarType, DataValue, size);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequestArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void GetRequestArrayStringData(UI_32 VarName, std::string DataValue[],
+ UI_32 &size) { // NOLINT (readability/nolint)
+ g__CWORD77_DataPool.GetReqArrayStringData(VarName, DataValue, size);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetResponseArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void GetResponseArrayStringData(UI_32 VarName, std::string DataValue[],
+ UI_32 &size) { // NOLINT (readability/nolint)
+ g__CWORD77_DataPool.GetRespArrayStringData(VarName, DataValue, size);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRequestStringData
+/////////////////////////////////////////////////////////////////////////////////
+
+void SetRequestStringData(UI_32 VarName, EDataType VarType, std::string DataValue) {
+ g__CWORD77_DataPool.SetReqStringData(VarName, VarType, DataValue);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetResponseStringData
+/////////////////////////////////////////////////////////////////////////////////
+void SetResponseStringData(UI_32 VarName, EDataType VarType, std::string DataValue) {
+ g__CWORD77_DataPool.SetRespStringData(VarName, VarType, DataValue);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequestStringData
+/////////////////////////////////////////////////////////////////////////////////
+std::string GetRequestStringData(UI_32 VarName) {
+ return g__CWORD77_DataPool.GetReqStringData(VarName);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequestDataSize
+/////////////////////////////////////////////////////////////////////////////////
+UI_32 GetRequestDataSize(UI_32 Key) {
+ return g__CWORD77_DataPool.GetReqDataSize(Key);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetResponseDataSize
+/////////////////////////////////////////////////////////////////////////////////
+UI_32 GetResponseDataSize(UI_32 Key) {
+ return g__CWORD77_DataPool.GetRespDataSize(Key);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequestDataType
+/////////////////////////////////////////////////////////////////////////////////
+EDataType GetRequestDataType(UI_32 Key) {
+ return g__CWORD77_DataPool.GetReqDataType(Key);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetResponseDataType
+/////////////////////////////////////////////////////////////////////////////////
+EDataType GetResponseDataType(UI_32 Key) {
+ return g__CWORD77_DataPool.GetRespDataType(Key);
+}
+
+
+
+C_CWORD77_Data *C_CWORD77_Data::m_p_CWORD77_DataInstance = NULL;
+
+/////////////////////////////////////////////////////////////////////////////////
+/// Constructor
+/////////////////////////////////////////////////////////////////////////////////
+C_CWORD77_Data::C_CWORD77_Data() {
+ m__CWORD77_RequestDataTable.clear();
+ m__CWORD77_ResponseDataTable.clear();
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// Destructor
+/////////////////////////////////////////////////////////////////////////////////
+C_CWORD77_Data::~C_CWORD77_Data() {
+ m__CWORD77_RequestDataTable.clear();
+ m__CWORD77_ResponseDataTable.clear();
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetInstacne
+/////////////////////////////////////////////////////////////////////////////////
+C_CWORD77_Data *C_CWORD77_Data::GetInstance() {
+ if (m_p_CWORD77_DataInstance == NULL) {
+ m_p_CWORD77_DataInstance = new C_CWORD77_Data(); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+ return m_p_CWORD77_DataInstance;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// DeleteInstance
+/////////////////////////////////////////////////////////////////////////////////
+void C_CWORD77_Data::DeleteInstance() {
+ delete m_p_CWORD77_DataInstance;
+ m_p_CWORD77_DataInstance = NULL;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRequData
+/////////////////////////////////////////////////////////////////////////////////
+VOID C_CWORD77_Data::SetRequData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::vector<CHAR> &DataVector = m__CWORD77_RequestDataTable[f_DataPoolKey];
+ CHAR *l_pTemp = static_cast<CHAR *>(f_pData);
+ DataVector.assign(l_pTemp, (l_pTemp + f_uiSize));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRequData
+/////////////////////////////////////////////////////////////////////////////////
+VOID C_CWORD77_Data::SetRequData(UI_32 f_uiMsgId, UI_32 f_uiSize, PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::vector<CHAR> &DataVector = m__CWORD77_RequestDataTableOrig[f_uiMsgId];
+ CHAR *l_pTemp = static_cast<CHAR *>(f_pData);
+ DataVector.assign(l_pTemp, (l_pTemp + f_uiSize));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRespoData
+/////////////////////////////////////////////////////////////////////////////////
+VOID C_CWORD77_Data::SetRespoData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, const PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ std::vector<CHAR> &DataVector = m__CWORD77_ResponseDataTable[f_DataPoolKey];
+ CHAR *l_pTemp = static_cast<CHAR *>(f_pData);
+ DataVector.assign(l_pTemp, (l_pTemp + f_uiSize));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRespoData
+/////////////////////////////////////////////////////////////////////////////////
+VOID C_CWORD77_Data::SetRespoData(UI_32 f_uiMsgId, UI_32 f_uiSize, const PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::vector<CHAR> &DataVector = m__CWORD77_ResponseDataTableOrig[f_uiMsgId];
+ CHAR *l_pTemp = static_cast<CHAR *>(f_pData);
+ DataVector.assign(l_pTemp, (l_pTemp + f_uiSize));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequData
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus C_CWORD77_Data::GetRequData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 &f_uiSize, PVOID &f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusDbRecNotFound; // data not found in data pool
+ T_CWORD77_DataPool::iterator l_iter;
+
+ l_iter = m__CWORD77_RequestDataTable.find(f_DataPoolKey);
+ if (l_iter != m__CWORD77_RequestDataTable.end()) {
+ f_uiSize = static_cast<UI_32>(l_iter->second.size());
+ if (f_uiSize > 0) {
+ f_pData = &l_iter->second[0];
+ } else {
+ f_pData = NULL;
+ }
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequData
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus C_CWORD77_Data::GetRequData(UI_32 f_uiMsgId, UI_32 &f_uiSize, PVOID &f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusDbRecNotFound; // data not found in data pool
+ std::map<UI_32, std::vector<CHAR> >::iterator l_iter;
+
+ l_iter = m__CWORD77_RequestDataTableOrig.find(f_uiMsgId);
+ if (l_iter != m__CWORD77_RequestDataTableOrig.end()) {
+ f_uiSize = static_cast<UI_32>(l_iter->second.size());
+ if (f_uiSize > 0) {
+ f_pData = &l_iter->second[0];
+ } else {
+ f_pData = NULL;
+ }
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRespoData
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus C_CWORD77_Data::GetRespoData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 &f_uiSize, PVOID &f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ T_CWORD77_DataPool::iterator l_iter;
+ l_iter = m__CWORD77_ResponseDataTable.find(f_DataPoolKey);
+ if (l_iter != m__CWORD77_ResponseDataTable.end()) {
+ f_uiSize = static_cast<UI_32>(l_iter->second.size());
+ if (f_uiSize > 0) {
+ /**
+ * @todo
+ * If *f_pData is set to NULL, a segmentation fault occurs.
+ */
+ f_pData = &l_iter->second[0];
+ } else {
+ f_pData = NULL;
+ }
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return l_eStatus;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRespoData
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus C_CWORD77_Data::GetRespoData(UI_32 f_uiMsgId,
+ UI_32 &f_uiSize, PVOID &f_pData) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::map<UI_32, std::vector<CHAR> >::iterator l_iter;
+ l_iter = m__CWORD77_ResponseDataTableOrig.find(f_uiMsgId);
+ if (l_iter != m__CWORD77_ResponseDataTableOrig.end()) {
+ f_uiSize = static_cast<UI_32>(l_iter->second.size());
+ if (f_uiSize > 0) {
+ f_pData = &l_iter->second[0];
+ } else {
+ f_pData = NULL;
+ }
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetReqDataIn_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+VOID SetReqDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 f_uiSize, PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ if (C_CWORD77_Data::GetInstance()) {
+ C_CWORD77_Data::GetInstance()->SetRequData(f_DataPoolKey, f_uiSize, f_pData);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRespDataIn_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+VOID SetRespDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 f_uiSize, const PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ if (C_CWORD77_Data::GetInstance()) {
+ C_CWORD77_Data::GetInstance()->SetRespoData(f_DataPoolKey, f_uiSize, f_pData);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRespNotfnDataIn_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+VOID SetRespNotfnDataIn_CWORD77_DataPool(const std::string &f_cNotificationName, // NOLINT (readability/nolint)
+ UI_32 f_uiSize, const PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ if (C_CWORD77_Data::GetInstance()) {
+ // LCOV_EXCL_BR_START 11:except branch
+ C_CWORD77_Data::GetInstance()->SetRespoData(std::make_pair(g_uiNotificationDataPoolId, f_cNotificationName), f_uiSize, // LCOV_EXCL_BR_LINE 11:except branch
+ f_pData);
+ // LCOV_EXCL_BR_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetReqDataFrom_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetReqDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if (C_CWORD77_Data::GetInstance()) {
+ l_eStatus = C_CWORD77_Data::GetInstance()->GetRequData(f_DataPoolKey, f_uiSize, f_pData);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRespDataFrom_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetRespDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if (C_CWORD77_Data::GetInstance()) {
+ l_eStatus = C_CWORD77_Data::GetInstance()->GetRespoData(f_DataPoolKey, f_uiSize, f_pData);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRespDataFrom_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetRespNotfnDataFrom_CWORD77_DataPool(const std::string &f_cNotificationName, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if (C_CWORD77_Data::GetInstance()) {
+ // LCOV_EXCL_BR_START 11:except branch
+ l_eStatus = C_CWORD77_Data::GetInstance()->GetRespoData(std::make_pair(g_uiNotificationDataPoolId, f_cNotificationName),
+ f_uiSize, f_pData);
+ // LCOV_EXCL_BR_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return l_eStatus;
+}
diff --git a/nsframework/framework_unified/client/NativeServices/Makefile b/nsframework/framework_unified/client/NativeServices/Makefile
new file mode 100755
index 0000000..c346b28
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/Makefile
@@ -0,0 +1,29 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+SUBDIRS = src
+
+
+all:
+
+install-data:install_cfg
+
+install_cfg:
+ install -d -m 775 $(SDKTARGETSYSROOT)/usr/agl/conf/ns_logger
+ install -m 644 -t $(SDKTARGETSYSROOT)/usr/agl/conf/ns_logger scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg
+
+include ../../../native_service.mk
diff --git a/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_arm.mk b/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_arm.mk
new file mode 100755
index 0000000..3baa0f2
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_arm.mk
@@ -0,0 +1,88 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# QCC arm COMPILER SETTINGS
+# Standard form of tool.mk file configured for PosixBasedOS001 vmware
+
+# Tools and Options
+LIB_EXT = a
+SO_EXT = so
+LIB_PREFIX = lib
+OBJ_EXT = o
+BIN_EXT =
+CC = qcc -c
+CPP = qcc -c
+AS = ntoarm-as
+AR = ntoarm-ar
+LD = qcc
+# Add addtion Linker Flags....
+# If your application contains c++ code you will need
+# the -lang-c++
+LD_CPP = -lang-c++
+
+# Compile options and commands
+TARGET_FLG = -Vgcc_ntoarmle
+
+# Set Debug Flag
+ifdef DEBUG
+CC_DEBUG_FLG = -g
+DEBUG_EXT=_g
+endif
+
+# Set Profiling Flag
+ifdef PROFILING
+CC_PROFILING_FLG = -p
+endif
+
+# Set Optimization Flag
+ifeq ($(OPTIMIZATION),OPTIMIZE)
+CC_OPT_FLG = -O2
+else
+ifeq ($(OPTIMIZATION),FULL_OPTIMIZE)
+CC_OPT_FLG = -O3
+else
+ifeq ($(OPTIMIZATION),NONE)
+CC_OPT_FLG =
+endif
+endif
+endif
+
+
+# Compiler Options
+CC_OFLAG = -o
+CC_IFLAG = -I
+CC_FLAGS = $(TARGET_FLG) -w9 -Wc,-Wall -shared $(CC_OPT_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG)
+CC_TARGET = $(@)
+CC_CMD = $(CC) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.c) -o $(@)
+CPP_CMD = $(CPP) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.cpp) -o $(@)
+
+# Archive Options (Static Library)
+AR_OFLAG =
+AR_FLAGS = -r
+AR_CMD = $(AR) $(AR_FLAGS) $(AR_OFLAG)$(@) $^
+
+# Linker Options
+# Executable
+# Used in the form of $(LD_CMD) -L[Library Paths] -l[libraries] [objects] $(LD_OFLAG) executable_name.$(BIN_EXT)
+LD_FLAGS = $(TARGET_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG) $(LD_CPP)
+LD_OFLAG = -o
+LD_CMD = $(LD) -L$(LIB_PATH) $(LD_FLAGS)
+EXEC_CMD = $(LD_CMD) $(LD_OFLAG) $(@) $(OBJECTS) $(addprefix -L , $(LIB_PATHS)) -Bstatic $(addprefix -l , $(STATIC_LIBS)) -Bdynamic $(addprefix -l , $(DYNAMIC_LIBS))
+
+# To create shared objects use the linker command but add -shared
+SO_CMD = $(LD) $(LD_FLAGS) -shared
+SLIB_CMD = $(SO_CMD) $^ $(LD_OFLAG) $(@) $(addprefix -L, $(LIB_PATHS)) \
+ -Bstatic $(addprefix -l,$(STATIC_LIBS)) -Bdynamic $(addprefix -l,$(DYNAMIC_LIBS))
diff --git a/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_armv7.mk b/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_armv7.mk
new file mode 100755
index 0000000..68d15da
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_armv7.mk
@@ -0,0 +1,96 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# QCC arm COMPILER SETTINGS
+# Standard form of tool.mk file configured for PosixBasedOS001 arm v7
+# Note: Make sure PosixBasedOS001_HOST is set to install version desired
+
+# Tools and Options
+LIB_EXT = a
+SO_EXT = so
+LIB_PREFIX = lib
+OBJ_EXT = o
+BIN_EXT =
+CC = ${PosixBasedOS001_HOST}/usr/bin/qcc -c
+CPP = ${PosixBasedOS001_HOST}/usr/bin/qcc -c
+AS = ${PosixBasedOS001_HOST}/usr/bin/ntoarmv7-as
+AR = ${PosixBasedOS001_HOST}/usr/bin/ntoarmv7-ar
+OBJCPY := ${PosixBasedOS001_HOST}/usr/bin/ntoarmv7-objcopy
+LD = qcc
+# Add addtion Linker Flags....
+# If your application contains c++ code you will need
+# the -lang-c++
+LD_CPP = -lang-c++ #-lm
+
+# Compile options and commands
+TARGET_FLG = -Vgcc_ntoarmv7le
+
+# Define Map file Option
+MAP_FILE_FLG=-M
+
+# Set Debug Flag
+ifdef DEBUG
+CC_DEBUG_FLG = -g
+DEBUG_EXT=_g
+endif
+
+# Set Profiling Flag
+ifdef PROFILING
+CC_PROFILING_FLG = -p
+endif
+
+# Set Optimization Flag (precident to force none, force full, force basic, or default remain as defined)
+ifeq ($(OPTIMIZATION),OPTIMIZE)
+CC_OPT_FLG = -O2
+else
+ifeq ($(OPTIMIZATION),FULL_OPTIMIZE)
+CC_OPT_FLG = -O3
+else
+ifeq ($(OPTIMIZATION),NONE)
+CC_OPT_FLG =
+endif
+endif
+endif
+
+
+# Compiler Options
+CC_OFLAG = -o
+CC_IFLAG = -I
+CC_FLAGS = $(TARGET_FLG) -w9 -Wc,-Wall -shared $(CC_OPT_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG)
+CC_TARGET = $(@)
+CC_CMD = $(CC) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.c) -o $(@)
+CPP_CMD = $(CPP) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.cpp) -o $(@)
+CPP_D_CMD = arm-unknown-nto-PosixBasedOS001.5.0eabi-gcc.exe -c $(DEFS) $(INCLUDES) -MM -MP $< > $(@:.o=.d)
+
+# Archive Options (Static Library)
+AR_OFLAG =
+AR_FLAGS = -r
+AR_CMD = $(AR) $(AR_FLAGS) $(AR_OFLAG)$(@) $^
+
+# Linker Options
+# Executable
+# Used in the form of $(LD_CMD) -L[Library Paths] -l[libraries] [objects] $(LD_OFLAG) executable_name.$(BIN_EXT)
+LD_FLAGS = $(TARGET_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG) $(LD_CPP)
+LD_OFLAG = -o
+LD_CMD = $(LD) -L$(LIB_PATH) $(LD_FLAGS) $(MAP_FILE_FLG)
+EXEC_CMD = $(LD_CMD) $(LD_OFLAG) $(@) $(OBJECTS) $(addprefix -L , $(LIB_PATHS)) \
+ -Bstatic $(addprefix -l , $(STATIC_LIBS)) -Bdynamic $(addprefix -l , $(DYNAMIC_LIBS))
+
+# To create shared objects use the linker command but add -shared
+SO_CMD = $(LD) $(LD_FLAGS) -shared $(MAP_FILE_FLG)
+SLIB_CMD = $(SO_CMD) $^ $(LD_OFLAG) $(@) $(addprefix -L, $(LIB_PATHS)) \
+ -Bstatic $(addprefix -l,$(STATIC_LIBS)) -Bdynamic $(addprefix -l,$(DYNAMIC_LIBS))
+
diff --git a/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_x86.mk b/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_x86.mk
new file mode 100755
index 0000000..528e7ea
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_x86.mk
@@ -0,0 +1,89 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# QCC x86 COMPILER SETTINGS
+# Standard form of tool.mk file configured for PosixBasedOS001 vmware
+
+# Tools and Options
+LIB_EXT = a
+SO_EXT = so
+LIB_PREFIX = lib
+OBJ_EXT = o
+BIN_EXT =
+CC = qcc -c
+CPP = qcc -c
+AS = qcc -c
+AR = qcc -a
+LD = qcc
+LD_CPP = -lang-c++ #-lm
+OBJCPY := ${PosixBasedOS001_HOST}/usr/bin/ntox86-objcopy
+
+# Compile options and commands
+TARGET_FLG = -Vgcc_ntox86
+
+# Set Debug Flag
+ifdef DEBUG
+CC_DEBUG_FLG = -g
+DEBUG_EXT=_g
+endif
+
+# Define Map file Option
+MAP_FILE_FLG=-M
+
+# Set Profiling Flag
+ifdef PROFILING
+CC_PROFILING_FLG = -p
+endif
+
+# Set Optimization Flag (precident to force none, force full, force basic, or default remain as defined)
+ifeq ($(OPTIMIZATION),OPTIMIZE)
+CC_OPT_FLG = -O2
+else
+ifeq ($(OPTIMIZATION),FULL_OPTIMIZE)
+CC_OPT_FLG = -O3
+else
+ifeq ($(OPTIMIZATION),NONE)
+CC_OPT_FLG =
+endif
+endif
+endif
+
+
+# Compiler Options
+CC_OFLAG = -o
+CC_IFLAG = -I
+CC_FLAGS = $(TARGET_FLG) -w9 -Wc,-Wall -shared $(CC_OPT_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG) $(CC_OPT_FLG)
+CC_TARGET = $(@)
+CC_CMD = $(CC) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.c*) -o $(@)
+CPP_CMD = $(CPP) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.cpp) -o $(@)
+CPP_D_CMD = i486-pc-nto-PosixBasedOS001.5.0-gcc.exe $(DEFS) $(INCLUDES) -MM $< > $(@:.o=.d)
+
+# Archive Options (Static Library)
+AR_OFLAG =
+AR_FLAGS =
+AR_CMD = $(AR) $(AR_FLAGS) $(AR_OFLAG)$(@) $^
+
+# Linker Options
+# Executable
+# Used in the form of $(LD_CMD) -L[Library Paths] -l[libraries] [objects] $(LD_OFLAG) executable_name.$(BIN_EXT)
+LD_FLAGS = $(TARGET_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG) $(LD_CPP)
+LD_OFLAG = -o
+LD_CMD = $(LD) -L$(LIB_PATH) $(LD_FLAGS) $(MAP_FILE_FLG)
+
+# To create shared objects use the linker command but add -shared
+SO_CMD = $(LD) $(LD_FLAGS) -shared $(MAP_FILE_FLG)
+SLIB_CMD = $(SO_CMD) $^ $(LD_OFLAG) $(@) $(addprefix -L, $(LIB_PATHS)) \
+ -Bstatic $(addprefix -l,$(STATIC_LIBS)) -Bdynamic $(addprefix -l,$(DYNAMIC_LIBS))
diff --git a/nsframework/framework_unified/client/NativeServices/cfg/analysis.mk b/nsframework/framework_unified/client/NativeServices/cfg/analysis.mk
new file mode 100755
index 0000000..c1e14fd
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/cfg/analysis.mk
@@ -0,0 +1,73 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# QCC arm COMPILER SETTINGS
+# Standard form of tool.mk file configured for PosixBasedOS001 vmware
+
+#Add PosixBasedOS001 binary tools to path
+PATH := $(PosixBasedOS001_HOME)/usr/bin/;$(PATH)
+
+# include the compiler definitions in which we are linting against
+include $(PRJ_ROOT)/cfg/PosixBasedOS001_armv7.mk
+
+# Tools and Options
+CODE_COUNT = surveyor
+LINT = lint-nt
+CC_IFLAG = -i
+
+CC_DEFS = -D__LANGUAGE_C -D_LANGUAGE_C -D__PosixBasedOS001__ -D__PosixBasedOS001__ \
+ -D__GNUC__=4 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=2 \
+ -D__unix__ -D__unix -D__ELF__ -D__ARM__ -D__arm__ \
+ -D__ARM_ARCH_4__ -D__APCS_32__ -D__LITTLEENDIAN__ -D__ARMEL__ -D_MUDFLAPTH
+
+CPP_DEFS = -D__cplusplus -D__PosixBasedOS001__ -D__PosixBasedOS001__ \
+ -D__GNUC__=4 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=2 \
+ -D__NO_INLINE__ -D__DEPRECATED -D__EXCEPTIONS \
+ -D__unix__ -D__unix -D__ELF__ -D__ARM__ -D__arm__ \
+ -D__ARM_ARCH_4__ -D__APCS_32__ -D__LITTLEENDIAN__ -D__ARMEL__ -D_MUDFLAPTH
+
+LINT_C_INCLUDES = \
+ $(CC_IFLAG)C:/lint.PosixBasedOS001 \
+ $(CC_IFLAG)$(PosixBasedOS001_TARGET)/usr/include \
+
+LINT_CPP_INCLUDES = \
+ $(CC_IFLAG)C:/lint.PosixBasedOS001 \
+ $(CC_IFLAG)$(PosixBasedOS001_TARGET)/usr/include \
+ $(CC_IFLAG)$(PosixBasedOS001_HOST)/usr/lib/gcc/arm-unknown-nto-PosixBasedOS001.5.0/4.4.2/include \
+ $(CC_IFLAG)$(PosixBasedOS001_TARGET)/usr/include/cpp/c \
+ $(CC_IFLAG)$(PosixBasedOS001_TARGET)/usr/include/cpp \
+
+LINT_SOURCES := $(shell find .. -iname "*.c" -or -iname "*.cc" -or -iname "*.cpp")
+LINT_IMPLIED_DIRS := $(addprefix $(CC_IFLAG), $(sort $(dir $(shell find .. -iname "*.c" -or -iname "*.cc" -or -iname "*.cpp"))))
+
+# Metric Rule
+metrics:
+ @echo --------------------
+ @echo Start metrics on $(COMPONENT_NAME)
+ @echo --------------------
+ -@mkdir -p $(PRJ_ROOT)/ana/metrics
+ -@$(CODE_COUNT) -detailed -progress -out $(PRJ_ROOT)/ana/metrics/metrics_$(COMPONENT_NAME).csv ..
+
+# Static Analysis Rule
+lint:
+ @echo --------------------
+ @echo Performing Lint on $(COMPONENT_NAME)
+ @echo --------------------
+ @echo includes the following files:
+ @echo $(LINT_SOURCES)
+ @echo --------------------
+ -@c:/lint/$(LINT) $(PRJ_ROOT)cfg/options.lnt C:/lint.PosixBasedOS001/co-gcc.lnt $(CC_DEFS) $(LINT_C_INCLUDES) $(INCLUDES) $(LINT_IMPLIED_DIRS) $(filter %.c ,$(LINT_SOURCES))
+ -@c:/lint/$(LINT) $(PRJ_ROOT)cfg/options.lnt C:/lint.PosixBasedOS001/co-gcc.lnt $(CPP_DEFS) $(LINT_CPP_INCLUDES) $(INCLUDES) $(LINT_IMPLIED_DIRS) $(filter %.cpp %.cc %.cxx,$(LINT_SOURCES) )
diff --git a/nsframework/framework_unified/client/NativeServices/cfg/common.mk b/nsframework/framework_unified/client/NativeServices/cfg/common.mk
new file mode 100755
index 0000000..10a9a6b
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/cfg/common.mk
@@ -0,0 +1,175 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+####################################################################
+# DO NOT EDIT THIS FILE
+# Common Project Makefile definitions shared by all types of makefiles
+#
+#
+# Please use project.mk in your build folder to customize your build
+#######################################################################
+
+include $(PRJ_ROOT)cfg/depends.mk
+
+ifndef COMPONENT_ROOT
+export COMPONENT_ROOT=$(COMPONENT_NAME)
+endif
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS += $(PROJECT_FLAGS)
+
+# Set local includes and then the reference includes (priority order determines search path)
+INCLUDES = \
+ $(CC_IFLAG)./ \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_ROOT)/inc \
+ $(addprefix $(CC_IFLAG),$(PROJECT_INCLUDE_PATHS)) \
+ $(DEPENDS_INCLUDES) \
+
+
+# Do the same if you need to include library paths as well
+LIB_PATHS += \
+ $(PROJECT_LIB_PATHS) \
+ $(DEPENDS_LIB_PATHS) \
+
+
+LD_STATIC_LIBS += \
+ $(PROJECT_STATIC_LIBS)
+
+LD_DYNAMIC_LIBS += \
+ $(PROJECT_DYNAMIC_LIBS)
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+# Convert the source files to object files with correct folder location.
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+D_FILES = $(OBJECTS:.o=.d)
+
+# pull in dependency info for existing .o files
+-include $(D_FILES)
+
+
+ifeq ($(BUILDTYPE),APP)
+COMPONENT_EXEC = $(BIN_PATH)$(COMPONENT_NAME)$(DEBUG_EXT)
+BINARIES = \
+ $(COMPONENT_EXEC)
+
+$(COMPONENT_EXEC): $(OBJECTS)
+ $(LD_CMD) $(LD_OFLAG) $(@) $(OBJECTS) $(addprefix -L , $(LIB_PATHS)) -Bstatic $(addprefix -l , $(LD_STATIC_LIBS)) -Bdynamic $(addprefix -l , $(LD_DYNAMIC_LIBS))
+
+endif
+
+ifeq ($(BUILDTYPE),DLL)
+COMPONENT_SOLIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+LIBRARIES = \
+ $(COMPONENT_SOLIB) \
+
+$(COMPONENT_SOLIB): $(OBJECTS)
+ $(SO_CMD) $(OBJECTS) $(LD_OFLAG) $(@) $(addprefix -L, $(LIB_PATHS)) \
+ -Bstatic $(addprefix -l,$(STATIC_LIBS)) -Bdynamic $(addprefix -l,$(DYNAMIC_LIBS))
+
+endif
+
+ifeq ($(BUILDTYPE),LIB)
+COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+$(COMPONENT_LIB): $(OBJECTS)
+ $(AR_CMD)
+
+endif
+
+
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+base: banner module_dirs subdirs local
+
+
+$(BLD_PATH)/%.o: %.cpp
+ $(CPP_CMD)
+ $(CPP_D_CMD)
+ @mv -f $(@:.o=.d) $(@:.o=.d).tmp
+ @sed -e 's|.*: |$@: |' < $(@:.o=.d).tmp > $(@:.o=.d)
+ @rm -f $(@:.o=.d).tmp
+
+local: $(OBJECTS)
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(D_FILES)
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/nsframework/framework_unified/client/NativeServices/cfg/config.mk b/nsframework/framework_unified/client/NativeServices/cfg/config.mk
new file mode 100755
index 0000000..5eb23f4
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/cfg/config.mk
@@ -0,0 +1,115 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Configuration Makefile version 2.0
+#
+
+.SUFFIXES:
+
+# Setup configuration exports to make sure other "subprojects" have the correct configuration settings.
+# Export shared variables
+export DEFS
+export LIBS
+export LIB_PATHS
+
+# Export setup
+export MAKE_DEPS := $(PRJ_ROOT)cfg/depends.mk
+export MAKE_CFG := $(TOOLS_CFG)config.mk
+
+# Set the location of build files. By default all build files become local to the initating location of the build so
+# one doesn't impact a referenced project
+# Alteratively a directed path can also be supported.
+ifndef PRJ_OUTPUT_ROOT
+PRJ_OUTPUT_ROOT = $(PRJ_ROOT)
+endif
+
+# Select Compiler Tool by name and select the tool configuration file
+# default behavior is to generate for arm
+ifeq ($(TARGET),analysis)
+export MAKE_TOOLS := $(TOOLS_CFG)analysis.mk
+else
+ifeq ($(TARGET),x86)
+export MAKE_TOOLS := $(TOOLS_CFG)PosixBasedOS001_x86.mk
+else
+ifeq ($(TARGET),armle)
+export MAKE_TOOLS := $(TOOLS_CFG)PosixBasedOS001_arm.mk
+else
+export MAKE_TOOLS := $(TOOLS_CFG)PosixBasedOS001_armv7.mk
+TARGET = armle-v7
+endif
+endif
+endif
+
+
+# Set specific flags as path suffixes to make sure the right build options are picked up
+ifdef DEBUG
+BUILD_CFG+=/debug
+endif
+ifdef PROFILING
+BUILD_CFG+=/profile
+endif
+ifndef BUILD_CFG
+BUILD_CFG=/release
+endif
+
+# Set File Paths
+export BIN_PATH := $(PRJ_OUTPUT_ROOT)bin/$(TARGET)$(BUILD_CFG)/
+export BLD_PATH := $(PRJ_OUTPUT_ROOT)bld/$(TARGET)$(BUILD_CFG)/$(COMPONENT_NAME)/
+export LIB_PATH := $(PRJ_OUTPUT_ROOT)lib/$(TARGET)$(BUILD_CFG)/
+export SLIB_PATH := $(PRJ_OUTPUT_ROOT)dll/$(TARGET)$(BUILD_CFG)/
+export BUILD_DIRS = $(BIN_PATH) $(LIB_PATH) $(SLIB_PATH) $(BLD_PATH)
+export BUILD_ROOTS := $(addprefix $(PRJ_OUTPUT_ROOT), bin bld lib dll)
+
+# Set Staging Location - set to a default location to prevent accidents
+ifndef STAGE_LOCATION
+export STAGE_LOCATION = C:/temp/stage/
+endif
+
+# Now include the defintions that have been exported
+include $(MAKE_TOOLS)
+
+# Add additional configuration includes reflective of project and decisions expressed in include makefiles.
+# So local includes, base infrastructure, and target platform.
+# This is also the variable to add local overriding header file locations for configuration in makefiles
+# prior to spawning to subprojects. Which means if you want to utilize different header files than those
+# the project you are going to build this will force an early search path to override with.
+ifndef CFG_INCS
+ export CFG_INCS +=
+endif
+
+# Standard Targets (and defaults)
+all:
+
+subdirs:
+
+# Building necessary directories
+build_dirs: $(BUILD_DIRS)
+
+$(BUILD_DIRS):
+ -mkdir -p $(@)
+
+# Stage "public" directories
+stage:
+ -rm -r $(STAGE_LOCATION)/$(COMPONENT_NAME)
+ mkdir -p $(STAGE_LOCATION)/$(COMPONENT_NAME)
+ cp -r ../bin ../dll ../lib ../inc ../cfg ../doc $(STAGE_LOCATION)/$(COMPONENT_NAME)/
+
+
+# Debug Headers
+banner:
+ @echo Making $(COMPONENT_NAME)
+ @echo Bld Roots $(BLD_ROOTS)
diff --git a/nsframework/framework_unified/client/NativeServices/cfg/depends.mk b/nsframework/framework_unified/client/NativeServices/cfg/depends.mk
new file mode 100755
index 0000000..57ecd9b
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/cfg/depends.mk
@@ -0,0 +1,115 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+
+# Begin User Build Location Definition
+# This is the prefixing information which dictates the versioning of dependant projects
+# Typically path statements will include some set of versioning information.
+
+# The Repository Root is the base location of where a build is put in context
+# By default this is up a directory from the project root. This is based on
+# the default local build where a component where a project is started to build is
+# on the same level as other components in the repository. Otherwise a value can
+# be forced by setting the value before operating on the configuration file.
+#
+# Example would be to setting the Repository Root to a baseline label name
+# where the contents of the baseline lable are exported to the filesystem.
+ifndef REPOSITORY_ROOT
+export REPOSITORY_ROOT = $(PRJ_ROOT)../
+endif
+
+# The Team Root is akin to the Repository Root. It sets the location of
+# the root for other components in the same stream. It is very rare to
+# modify the value of the team root. However it is entirely possible that
+# the repository root and the team root are pointed to the same location.
+# By default the Team Root is set to the workspace location of your project
+ifndef TEAM_ROOT
+export TEAM_ROOT = $(PRJ_ROOT)../
+endif
+
+# Setup the include paths for project functional dependencies by component.
+# This is a list of include paths that should be done with relative locations
+# that are relative to the repository root for all elements external to the
+# component. All Dependency includes should be based on the $(REPOSITORY_ROOT)
+# all local (team/local) dependencies should be handled in the main makefile.
+# Note: Internal include locations should be simply in the makefile directly using
+# the './' as the notation for referencing location.
+# EXCEPTION: The first include is a TEAM_ROOT for the locally "globally" visible
+# module(s) of the Domain. (When doing the product release this is overridden)
+DEPENDS_INCLUDES = \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/framework \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/_CWORD77_ \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/services \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/utility \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/native \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/framework/statemachine \
+ $(CC_IFLAG)$(TEAM_ROOT)SystemServices/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/testautomationframework \
+ $(CC_IFLAG)$(REPOSITORY_ROOT)OpenSource/inc \
+
+DEPENDS_LIB_PATHS = \
+ $(TEAM_ROOT)NativeServices/lib/$(TARGET)$(BUILD_CFG)/ \
+ $(TEAM_ROOT)NativeServices/dll/$(TARGET)$(BUILD_CFG)/
+
+# BSP is required for PastModel002 because of mq (libmqS.a)
+ifneq ($(TARGET),x86)
+ ifeq ($(PRODUCT_NAME),PastModel004)
+ ifdef TARGET_BSP
+ ifndef BSP
+ BSP = $(TARGET_BSP)
+ endif
+ endif
+ ifndef BSP
+ ifneq ($(findstring all,$(MAKECMDGOALS)),)
+$(error \
+$(\n) \
+$(\n)***************************************************************************************** \
+$(\n)!!!ERROR!!! BSP not defined. Please, define TARGET_BSP variable in your make environment \
+$(\n)***************************************************************************************** \
+$(\n))
+ endif
+ else
+ DEPENDS_LIB_PATHS += $(REPOSITORY_ROOT)/$(BSP)/prebuilt/armle-v7/usr/lib
+ endif
+ endif
+endif
+
+
+# $(REPOSITORY_ROOT)SystemServices/lib/$(TARGET)$(BUILD_CFG)/ \
+
+# Setup library definintions. Same rules
+include $(TEAM_ROOT)NativeServices/cfg/nativeserviceslibraries.mk
+
+# Setup the include location for the tools configuration. This sets the
+# standard tool definition locations. By default these are local, but
+# long term will be a standard component for a project to include. This
+# definition is inherited in cases that this is a recursive call.
+
+# Set tools location
+ifndef TOOLS_CFG
+TOOLS_CFG = $(TEAM_ROOT)NativeServices/cfg/
+endif
+
+# Include the configuration
+include $(TOOLS_CFG)config.mk
diff --git a/nsframework/framework_unified/client/NativeServices/cfg/nativeserviceslibraries.mk b/nsframework/framework_unified/client/NativeServices/cfg/nativeserviceslibraries.mk
new file mode 100755
index 0000000..67205f1
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/cfg/nativeserviceslibraries.mk
@@ -0,0 +1,54 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# TODO make this more functionally oriented.
+# That is to make them more like the types ... so client libraries, etc.
+
+#NATIVE_SERVICES_DYNAMIC_LIBS = \
+# NS_FrameworkCore$(DEBUG_EXT) \
+# NS_Logger$(DEBUG_EXT) \
+# NS_Timer$(DEBUG_EXT)\
+# NS_MessageCenter$(DEBUG_EXT) \
+# NS_MessageQueue$(DEBUG_EXT) \
+# NS_SharedMemIf$(DEBUG_EXT) \
+# NS_NPServiceIf$(DEBUG_EXT) \
+# NS_UtilityCenter$(DEBUG_EXT) \
+# NS_ConfigParser$(DEBUG_EXT) \
+# NS__CWORD77__ServiceIf$(DEBUG_EXT) \
+
+# For improving startup performance, all libraries are merged into one
+# Other modules can still use individual libraries if required. Other NS libraries are also available.
+#NATIVE_SERVICES_DYNAMIC_LIBS = \
+# NS_Storage$(DEBUG_EXT) \
+# sqlite3 \
+# z \
+# NS_FrameworkUnified$(DEBUG_EXT) \
+
+NATIVE_SERVICES_DYNAMIC_LIBS = \
+ NS_FrameworkUnified$(DEBUG_EXT) \
+
+NATIVE_SERVICES_IMAGE_STORE_DYNAMIC_LIBS = \
+ sqlite3 \
+ z \
+ NS_Storage$(DEBUG_EXT) \
+ NS_ImageStorage$(DEBUG_EXT) \
+
+NATIVE_SERVICES_DYNAMIC_LIBS_CORE = \
+ NS_CoreUnified$(DEBUG_EXT) \
+
+TEST_AUTOMATION_FRAMEWORK_STATIC_LIBS = \
+ NS_TestAutomationFramework$(DEBUG_EXT) \
+
diff --git a/nsframework/framework_unified/client/NativeServices/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NativeServices/makefile_PosixBasedOS001
new file mode 100755
index 0000000..9b512f4
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/makefile_PosixBasedOS001
@@ -0,0 +1,55 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Top level makefile triggered to export all options
+
+# Set Optimization on for all lower makefiles
+#export OPTIMIZATION=OPTIMIZE
+
+all interface clean clean_interface clean_test:
+ $(MAKE) -C src OPTIMIZATION=FULL_OPTIMIZE DYNAMIC=TRUE $(MAKECMDGOALS)
+ $(MAKE) -C src DEBUG=TRUE OPTIMIZATION=NONE DYNAMIC=TRUE $(MAKECMDGOALS)
+ $(MAKE) -C src TARGET=x86 DYNAMIC=TRUE $(MAKECMDGOALS)
+ $(MAKE) -C src TARGET=x86 DEBUG=TRUE DYNAMIC=TRUE $(MAKECMDGOALS)
+
+# doxygen and graphviz tools must be in path of Jazz Build Engine
+# tested with doxygen 1.7.2 and graphviz 2.26.3
+docs:
+ $(MAKE) -C dox all
+
+lint:
+ $(MAKE) -C src TARGET=analysis lint
+
+# unit tests require main libraries -- typically not run directly, but part of a build engine
+unittest:
+ #$(MAKE) -C src OPTIMIZATION=FULL_OPTIMIZE $(MAKECMDGOALS)
+ #$(MAKE) -C src TARGET=x86 $(MAKECMDGOALS)
+ $(MAKE) -C src TARGET=x86 DYNAMIC=TRUE $(MAKECMDGOALS)
+ $(MAKE) -C src TARGET=x86 DEBUG=TRUE DYNAMIC=TRUE $(MAKECMDGOALS)
+
+functionaltest misc:
+ #$(MAKE) -C src OPTIMIZATION=FULL_OPTIMIZE DYNAMIC=TRUE $(MAKECMDGOALS)
+ #$(MAKE) -C src DEBUG=TRUE OPTIMIZATION=NONE DYNAMIC=TRUE $(MAKECMDGOALS)
+ $(MAKE) -C src TARGET=x86 DYNAMIC=TRUE $(MAKECMDGOALS)
+ #$(MAKE) -C src TARGET=x86 DEBUG=TRUE DYNAMIC=TRUE $(MAKECMDGOALS)
+
+
+# Stage is a forced clean, build, export
+# Expectation is that the user sets the STAGE_LOCATION in initiating the makefile
+stage:
+ $(MAKE) clean
+ $(MAKE) all
+ $(MAKE) -C src stage
diff --git a/nsframework/framework_unified/client/NativeServices/scfg/ns_filestorage.sql b/nsframework/framework_unified/client/NativeServices/scfg/ns_filestorage.sql
new file mode 100755
index 0000000..b6aa172
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/scfg/ns_filestorage.sql
@@ -0,0 +1,9 @@
+CREATE TABLE IF NOT EXISTS IMAGE(
+ METAUID VARCHAR NOT NULL,
+ FORMAT VARCHAR NULL,
+ PATH VARCHAR NULL,
+ CRC BIGINT NOT NULL,
+ FILEID BIGINT NOT NULL,
+ TIMESTAMP DATETIME NOT NULL,
+ PRIMARY KEY ( METAUID,FILEID )
+);
diff --git a/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog.cfg b/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog.cfg
new file mode 100755
index 0000000..729fe2f
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog.cfg
@@ -0,0 +1,278 @@
+[REALTIME_LOG]
+Output=OFF
+
+[ZONE_LIST]
+List=ZONE_PERFORMANCE,ZONE_SCREEN_TRANS,ZONE_SWDL,ZONE_SYSTEMDATA,ZONE_LOG_SH,ZONE_LOG_SYS,ZONE_LOG__CWORD52_,ZONE_SECURE,ZONE_CAN_FILTER,ZONE_COMM_PROCESS,ZONE_CONNECT_DEVICE,ZONE_COMM_SYS,ZONE_COMM_SH,ZONE_COMM_USB
+
+[ZONE_PERFORMANCE]
+Zone=64
+FileName=frameworkunified_performance.log
+FileSizeMax=1048576
+
+[ZONE_SCREEN_TRANS]
+Zone=65
+FileName=frameworkunified_screen_trans.log
+FileSizeMax=20480
+
+[ZONE_SWDL]
+Zone=66
+FileName=frameworkunified_swdl.log
+FileSizeMax=10240
+
+[ZONE_SYSTEMDATA]
+Zone=67
+FileName=frameworkunified_systemdata.log
+FileSizeMax=655360
+
+[ZONE_LOG_SH]
+Zone=68
+FileName=frameworkunified_sh.log
+FileSizeMax=65536
+
+[ZONE_LOG_SYS]
+Zone=69
+FileName=frameworkunified_sys.log
+FileSizeMax=131072
+
+[ZONE_LOG__CWORD52_]
+Zone=70
+FileName=frameworkunified__CWORD52_.log
+FileSizeMax=4096
+
+[ZONE_SECURE]
+Zone=71
+FileName=frameworkunified_secure.log
+FileSizeMax=4096
+
+[ZONE_CAN_FILTER]
+Zone=72
+FileName=frameworkunified_can_filter.log
+FileSizeMax=40960
+
+[ZONE_COMM_PROCESS]
+Zone=73
+FileName=frameworkunified_comm_process.log
+FileSizeMax=1048576
+
+[ZONE_CONNECT_DEVICE]
+Zone=74
+FileName=frameworkunified_connect_device.log
+FileSizeMax=20480
+
+[ZONE_COMM_SYS]
+Zone=96
+FileName=frameworkunified_comm_sys.log
+FileSizeMax=1048576
+
+[ZONE_COMM_SH]
+Zone=97
+FileName=frameworkunified_comm_sh.log
+FileSizeMax=1048576
+
+[ZONE_COMM_USB]
+Zone=98
+FileName=frameworkunified_comm_usb.log
+FileSizeMax=1048576
+
+[FLAG_DEFAULT]
+LogLevel=Release
+FileName=frameworkunified_debug.log
+FileSizeMax=3419136
+
+[FLAG_LIST]
+List=FLAG_UIAPP,FLAG_RADIO,FLAG_MEDIA,FLAG_VEHICLE,FLAG_NETWORK,FLAG_CONNECTIVITY,FLAG_APPFW,FLAG_BTTEL,FLAG_VR,FLAG_NAVI,FLAG_SYSTEM,FLAG_BASEPF,FLAG_COMMUNICATION
+
+[FLAG_UIAPP]
+LogLevel=Release
+FileName=frameworkunified_debug_uiapp.log
+FileSizeMax=10485760
+Service1=proxy_app
+Service2=audio_app
+Service3=connect_app
+Service4=diag_app
+Service5=home_app
+Service6=repro_app
+Service7=vui_app
+Service8=VehicleInfoSrv
+Service9=InfoSettingSrv
+Service10=MenuService
+Service11=DelPersonalSrv
+
+[FLAG_RADIO]
+LogLevel=Release
+FileName=frameworkunified_debug_radio.log
+FileSizeMax=81920
+Service1=RadioService
+Service2=RadioHDArbiter
+Service3=hrds_manager
+
+[FLAG_MEDIA]
+LogLevel=Release
+FileName=frameworkunified_debug_media.log
+FileSizeMax=81920
+Service1=DtvService
+Service2=PlaybackService
+Service3=DiscService
+Service4=_CWORD8_Srv
+Service5=DtvVupService
+
+[FLAG_VEHICLE]
+LogLevel=Release
+FileName=frameworkunified_debug_vehicle.log
+FileSizeMax=81920
+Service1=DiagService
+Service2=vehicle_app
+Service3=VS_ACNSrv
+Service4=VS_CMRSrv
+Service5=VS_DMSSrv
+Service6=VS_ENMSrv
+Service7=VS_FUCSrv
+Service8=VS_METSrv
+Service9=VS_NMSSrv
+Service10=VS_VSDSrv
+
+[FLAG_NETWORK]
+LogLevel=Release
+FileName=frameworkunified_debug_network.log
+FileSizeMax=81920
+Service1=NetworkManager
+Service2=ComArb_CWORD84_
+
+[FLAG_CONNECTIVITY]
+LogLevel=Release
+FileName=frameworkunified_debug_connectivity.log
+FileSizeMax=81920
+Service1=_CWORD57_DTService
+Service2=_CWORD57_UtilService
+Service3=MisinkService
+Service4=MisinkMiddle
+Service5=_CWORD27_Service
+Service6=RemoteService
+Service7=_CWORD76_Service
+Service8=_CWORD58_Service
+Service9=SDLService
+Service10=_CWORD89_Service
+Service11=SPCService
+Service12=eOMService
+Service13=LSP
+Service14=AwtPrimary
+Service15=TFFProxy
+Service16=EnformService
+
+[FLAG_APPFW]
+LogLevel=Release
+FileName=frameworkunified_debug_appfw.log
+FileSizeMax=81920
+
+[FLAG_BTTEL]
+LogLevel=Release
+FileName=frameworkunified_debug_bttel.log
+FileSizeMax=81920
+Service1=BT_BLLSrv
+Service2=BT_CnctSrv
+Service3=BT_PhoneSrv
+Service4=DCM_PhoneSrv
+Service5=BT_PbkSrv
+Service6=BT_MsgSrv
+Service7=WlanMiddle
+Service8=wlan_controller
+Service9=DCMService
+Service10=HELPService
+Service11=hciattach_qca
+
+[FLAG_VR]
+LogLevel=Release
+FileName=frameworkunified_debug_vr.log
+FileSizeMax=81920
+Service1=vrmanager_area1
+Service2=vrmanager_area2
+Service3=vrmanager_area3
+Service4=vrmanager_area4
+Service5=contentsmgr
+Service6=vrmanager_area1_t
+Service7=vrmanager_area1__CWORD84__t
+Service8=vrmanager_area1__CWORD84_
+Service9=vrmanager_area2__CWORD84_
+
+[FLAG_NAVI]
+LogLevel=Release
+FileName=frameworkunified_debug_navi.log
+FileSizeMax=1024
+
+[FLAG_SYSTEM]
+LogLevel=Release
+FileName=frameworkunified_debug_system.log
+FileSizeMax=81920
+Service1=ReproService
+Service2=Positioning
+
+[FLAG_BASEPF]
+LogLevel=Release
+FileName=frameworkunified_debug_base_pf.log
+FileSizeMax=1126400
+Service1=AS_AudioManager
+Service2=graphics
+Service3=CANGW_M
+Service4=CANGW_S
+Service5=DummyRead
+Service6=ExtUnitAuth
+Service7=LockManager
+Service8=Mounter
+Service9=MounterEx
+Service10=NS_BackupMgr
+Service11=NS_NPPService
+Service12=NS_RemoteCtrlService
+Service13=NS_SharedMem
+Service14=NW_MicService
+Service15=PS_CDR
+Service16=PS_CommSH4A
+Service17=PS_CommUSB
+Service18=PS_IPC
+Service19=PS_IPC_MP_Shadow
+Service20=PS_LanServer
+Service21=PS_LoggerShadow
+Service22=PS_PSMShadow
+Service23=PS_SwitchHandler
+Service24=ProxyService
+Service25=SS_DeviceDetectionService
+Service26=SS_GroupLaunchTrigger
+Service27=SS_LoggerService
+Service28=SS_PartitionRemount
+Service29=SS_PowerService
+Service30=SS_ScrShot
+Service31=SS_SystemManager
+Service32=SS_WinSys
+Service33=Sound
+Service34=StartUpBgm
+Service35=ViewerApp
+Service36=_CWORD52_vup
+Service37=clock
+Service38=communication
+Service39=dcmDevNotify
+Service40=dsrcDevNotify
+Service41=fatfsck
+Service42=hubDevNotify
+Service43=mkfatfs
+Service44=mscDevNotify
+Service45=nandupdate
+Service46=ncmDevNotify
+Service47=norvup
+Service48=nsprofileutil
+Service49=nsverutil
+Service50=resm
+Service51=rootfsvup
+Service52=sdDevNotify
+Service53=sysupdate
+Service54=sysvup
+Service55=tskmgr
+Service56=updateservice
+Service57=usbDevNotify
+Service58=vehicle
+Service59=vupprogressui
+Service60=vupservice
+Service61=webdavmgr
+
+[FLAG_COMMUNICATION]
+LogLevel=Release
+FileName=frameworkunified_debug_communication.log
+FileSizeMax=81920
diff --git a/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg b/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg
new file mode 100755
index 0000000..0ca29e5
--- /dev/null
+++ b/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg
@@ -0,0 +1,427 @@
+[REALTIME_LOG]
+Output=OFF
+
+[ZONE_LIST]
+
+#List=ZONE_PERFORMANCE,ZONE_SCREEN_TRANS,ZONE_SWDL,ZONE_SYSTEMDATA,ZONE_LOG_SH,ZONE_LOG_SYS,ZONE_LOG__CWORD52_,ZONE_SECURE,ZONE_CAN_FILTER,ZONE_COMM_PROCESS,ZONE_CONNECT_DEVICE,ZONE_COMM_SYS,ZONE_COMM_SH,ZONE_COMM_USB,ZONE_POS_SYS_IN,ZONE_POS_GPS_IN,ZONE_POS_CMD_IN,ZONE_ALSA,ZONE_WINSYS,ZONE_SOC_TEMP,ZONE_VERSION,ZONE_COMM_SYS_STS,ZONE_HDARBITER
+
+#List=ZONE_PERFORMANCE,ZONE_SCREEN_TRANS,ZONE_SWDL,ZONE_SYSTEMDATA,ZONE_LOG_SH,ZONE_LOG_SYS,ZONE_LOG__CWORD52_,ZONE_SECURE,ZONE_CAN_FILTER,ZONE_COMM_PROCESS,ZONE_CONNECT_DEVICE,ZONE_COMM_SYS,ZONE_COMM_SH,ZONE_COMM_USB,ZONE_POS_SYS_IN,ZONE_POS_GPS_IN,ZONE_POS_CMD_IN,ZONE_ALSA,ZONE_WINSYS,ZONE_SOC_TEMP,ZONE_VERSION,ZONE_COMM_SYS_STS,ZONE_HDARBITER,ZONE_TOUCH
+List=ZONE_PERFORMANCE,ZONE_SCREEN_TRANS,ZONE_SWDL,ZONE_SYSTEMDATA,ZONE_LOG_SH,ZONE_LOG_SYS,ZONE_LOG__CWORD52_,ZONE_CAN_FILTER,ZONE_COMM_PROCESS,ZONE_CONNECT_DEVICE,ZONE_COMM_SYS,ZONE_COMM_SH,ZONE_COMM_USB,ZONE_POS_SYS_IN,ZONE_POS_GPS_IN,ZONE_POS_CMD_IN,ZONE_ALSA,ZONE_WINSYS,ZONE_SOC_TEMP,ZONE_VERSION,ZONE_COMM_SYS_STS,ZONE_HDARBITER,ZONE_TOUCH
+
+[ZONE_PERFORMANCE]
+Zone=64
+FileName=frameworkunified_performance.log
+FileSizeMax=131072
+
+[ZONE_SCREEN_TRANS]
+Zone=65
+FileName=frameworkunified_screen_trans.log
+FileSizeMax=20480
+
+[ZONE_SWDL]
+Zone=66
+FileName=frameworkunified_swdl.log
+FileSizeMax=10240
+
+[ZONE_SYSTEMDATA]
+Zone=67
+FileName=frameworkunified_systemdata.log
+FileSizeMax=655360
+
+[ZONE_LOG_SH]
+Zone=68
+FileName=frameworkunified_sh.log
+FileSizeMax=65536
+
+[ZONE_LOG_SYS]
+Zone=69
+FileName=frameworkunified_sys.log
+FileSizeMax=131072
+
+[ZONE_LOG__CWORD52_]
+Zone=70
+FileName=frameworkunified__CWORD52_.log
+FileSizeMax=4096
+
+
+#[ZONE_SECURE]
+#Zone=71
+#FileName=frameworkunified_secure.log
+#FileSizeMax=4096
+
+
+[ZONE_CAN_FILTER]
+Zone=72
+FileName=frameworkunified_can_filter.log
+FileSizeMax=40960
+
+[ZONE_COMM_PROCESS]
+Zone=73
+FileName=frameworkunified_comm_process.log
+FileSizeMax=1024
+
+[ZONE_CONNECT_DEVICE]
+Zone=74
+FileName=frameworkunified_connect_device.log
+FileSizeMax=20480
+
+[ZONE_COMM_SYS]
+Zone=96
+FileName=frameworkunified_comm_sys.log
+FileSizeMax=1048576
+
+[ZONE_COMM_SH]
+Zone=97
+FileName=frameworkunified_comm_sh.log
+FileSizeMax=1048576
+
+[ZONE_COMM_USB]
+Zone=98
+FileName=frameworkunified_comm_usb.log
+FileSizeMax=1048576
+
+[ZONE_POS_SYS_IN]
+Zone=99
+FileName=frameworkunified_pos_sys_in.log
+FileSizeMax=102400
+
+[ZONE_POS_GPS_IN]
+Zone=100
+FileName=frameworkunified_pos_gps_in.log
+FileSizeMax=20480
+
+[ZONE_POS_CMD_IN]
+Zone=101
+FileName=frameworkunified_pos_cmd_in.log
+FileSizeMax=10240
+
+[ZONE_ALSA]
+Zone=103
+FileName=frameworkunified_alsa.log
+FileSizeMax=450560
+ForceOutput=True
+
+[ZONE_WINSYS]
+Zone=105
+FileName=frameworkunified_winsys.log
+FileSizeMax=512000
+ForceOutput=True
+
+[ZONE_SOC_TEMP]
+Zone=104
+FileName=frameworkunified_soc_temp.log
+FileSizeMax=2048
+
+[ZONE_VERSION]
+Zone=106
+FileName=frameworkunified_version.log
+FileSizeMax=8192
+
+[ZONE_COMM_SYS_STS]
+Zone=107
+FileName=frameworkunified_comm_sys_sts.log
+FileSizeMax=102400
+
+[ZONE_HDARBITER]
+Zone=108
+FileName=frameworkunified_hdarbiter.log
+FileSizeMax=102400
+
+
+[ZONE_TOUCH]
+Zone=109
+FileName=frameworkunified_touch_display.log
+FileSizeMax=32768
+
+
+[FLAG_DEFAULT]
+LogLevel=Release
+FileName=frameworkunified_debug.log
+FileSizeMax=2097152
+
+Realtimelog=True
+
+[FLAG_LIST]
+
+#List=FLAG_UIAPP,FLAG_RADIO,FLAG_MEDIA,FLAG_VEHICLE,FLAG_DIAG,FLAG_NETWORK,FLAG_CONNECTIVITY,FLAG_APPFW,FLAG_BTTEL,FLAG_VR,FLAG_NAVI,FLAG_SYSTEM,FLAG_BASEPF,FLAG_COMMUNICATION,FLAG_LSP,FLAG__CWORD76_,FLAG_MISINK,FLAG_CONNPROXY
+List=FLAG_UIAPP,FLAG_RADIO,FLAG_MEDIA,FLAG_VEHICLE,FLAG_DIAG,FLAG_NETWORK,FLAG_CONNECTIVITY,FLAG_APPFW,FLAG_BTTEL,FLAG_VR,FLAG_NAVI,FLAG_SYSTEM,FLAG_BASEPF,FLAG_COMMUNICATION,FLAG_LSP,FLAG__CWORD76_,FLAG_MISINK,FLAG_CONNPROXY,FLAG_CPAA
+
+[FLAG_UIAPP]
+LogLevel=Release
+FileName=frameworkunified_debug_uiapp.log
+FileSizeMax=5242880
+
+Realtimelog=True
+Service1=proxy_app
+Service2=audio_app
+Service3=connect_app
+Service4=diag_app
+Service5=home_app
+Service6=repro_app
+Service7=vui_app
+Service8=VehicleInfoSrv
+Service9=InfoSettingSrv
+Service10=MenuService
+Service11=DelPersonalSrv
+Service12=vehicle_app
+
+[FLAG_RADIO]
+LogLevel=Release
+FileName=frameworkunified_debug_radio.log
+FileSizeMax=1249280
+
+Realtimelog=True
+Service1=RadioService
+Service2=RadioHDArbiter
+Service3=hrds_manager
+
+[FLAG_MEDIA]
+LogLevel=Release
+FileName=frameworkunified_debug_media.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=DtvService
+Service2=PlaybackService
+Service3=DiscService
+Service4=_CWORD8_Srv
+Service5=DtvVupService
+
+[FLAG_VEHICLE]
+LogLevel=Release
+FileName=frameworkunified_debug_vehicle.log
+FileSizeMax=6553600
+
+Realtimelog=True
+Service1=VS_ACNSrv
+Service2=VS_CMRSrv
+Service3=VS_DMSSrv
+Service4=VS_ENMSrv
+Service5=VS_FUCSrv
+Service6=VS_METSrv
+Service7=VS_NMSSrv
+Service8=VS_VSDSrv
+Service9=VS_TMCSrv
+Service10=VS_DASSrv
+
+[FLAG_DIAG]
+LogLevel=Release
+FileName=frameworkunified_debug_diag.log
+FileSizeMax=6553600
+
+[FLAG_NETWORK]
+LogLevel=Release
+FileName=frameworkunified_debug_network.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=NetworkManager
+Service2=ComArb_CWORD84_
+
+[FLAG_CONNECTIVITY]
+LogLevel=Release
+FileName=frameworkunified_debug_connectivity.log
+FileSizeMax=81920
+
+#Service1=_CWORD27_Service
+#Service2=eOMService
+#Service3=_CWORD57_DTService
+#Service4=_CWORD57_UtilService
+#Service5=SPCService
+Realtimelog=True
+Service1=eOMService
+Service2=_CWORD57_DTService
+Service3=_CWORD57_UtilService
+Service4=SPCService
+
+
+[FLAG_APPFW]
+LogLevel=Release
+FileName=frameworkunified_debug_appfw.log
+FileSizeMax=1048576
+
+Realtimelog=True
+Service1=modemanager
+Service2=acmsrv
+
+[FLAG_BTTEL]
+LogLevel=Release
+FileName=frameworkunified_debug_bttel.log
+
+#FileSizeMax=6291456
+FileSizeMax=6023168
+Realtimelog=True
+
+Service1=TEL_BLLSrv
+Service2=BT_CnctSrv
+Service3=BT_PhoneSrv
+Service4=DCM_PhoneSrv
+Service5=BT_PbkSrv
+Service6=BT_MsgSrv
+Service7=WlanMiddle
+Service8=wlan_controller
+Service9=DCMService
+Service10=HELPService
+Service11=hciattach_qca
+
+[FLAG_VR]
+LogLevel=Release
+FileName=frameworkunified_debug_vr.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=vrmanager_area1
+Service2=vrmanager_area2
+Service3=vrmanager_area3
+Service4=contentsmgr
+Service5=vrmanager_area1_t
+Service6=vrmanager_area1__CWORD84__t
+Service7=vrmanager_area1__CWORD84_
+Service8=vrmanager_area2__CWORD84_
+Service9=vrmanager_area3__CWORD84_
+Service10=vrmanager_area5__CWORD84_
+
+[FLAG_NAVI]
+LogLevel=Release
+FileName=frameworkunified_debug_navi.log
+FileSizeMax=1024
+
+Realtimelog=True
+
+[FLAG_SYSTEM]
+LogLevel=Release
+FileName=frameworkunified_debug_system.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=ReproService
+Service2=Positioning
+
+[FLAG_BASEPF]
+LogLevel=Release
+FileName=frameworkunified_debug_base_pf.log
+FileSizeMax=5017600
+
+Realtimelog=True
+Service1=AS_AudioManager
+Service2=graphics
+Service3=CANGW_M
+Service4=CANGW_S
+Service5=DummyRead
+Service6=ExtUnitAuth
+Service7=LockManager
+Service8=Mounter
+Service9=MounterEx
+Service10=NS_BackupMgr
+Service11=NS_NPPService
+Service12=NS_RemoteCtrlService
+Service13=NS_SharedMem
+Service14=NW_MicService
+Service15=PS_CDR
+Service16=PS_CommSH4A
+Service17=PS_CommUSB
+Service18=PS_IPC
+Service19=PS_IPC_MP_Shadow
+Service20=PS_LanServer
+Service21=PS_LoggerShadow
+Service22=PS_PSMShadow
+Service23=PS_SwitchHandler
+Service24=ProxyService
+Service25=SS_DeviceDetectionService
+Service26=SS_GroupLaunchTrigger
+Service27=SS_LoggerService
+Service28=SS_PartitionRemount
+Service29=SS_PowerService
+Service30=SS_ScrShot
+Service31=SS_SystemManager
+Service32=SS_WinSys
+Service33=Sound
+Service34=StartUpBgm
+Service35=ViewerApp
+Service36=_CWORD52_vup
+Service37=clock
+Service38=communication
+Service39=dcmDevNotify
+Service40=dsrcDevNotify
+Service41=fatfsck
+Service42=hubDevNotify
+Service43=mkfatfs
+Service44=mscDevNotify
+Service45=nandupdate
+Service46=ncmDevNotify
+Service47=norvup
+Service48=nsprofileutil
+Service49=nsverutil
+Service50=resm
+Service51=rootfsvup
+Service52=sdDevNotify
+Service53=sysupdate
+Service54=sysvup
+Service55=tskmgr
+Service56=updateservice
+Service57=usbDevNotify
+Service58=vehicle
+Service59=vupprogressui
+Service60=vupservice
+Service61=webdavmgr
+Service62=drop_caches
+
+Service63=ASND_Server
+
+[FLAG_COMMUNICATION]
+LogLevel=Release
+FileName=frameworkunified_debug_communication.log
+FileSizeMax=81920
+
+Realtimelog=True
+
+[FLAG_LSP]
+LogLevel=Release
+FileName=frameworkunified_debug_lsp.log
+FileSizeMax=1048576
+
+Realtimelog=True
+Service1=LSP
+Service2=ConnUtilSlave
+Service3=ServiceFlagMgr
+Service4=ConnMgr
+
+[FLAG__CWORD76_]
+LogLevel=Release
+FileName=frameworkunified_debug__CWORD76_.log
+FileSizeMax=245760
+
+Realtimelog=True
+Service1=_CWORD76_Service
+Service2=_CWORD58_Service
+Service3=SDLService
+Service4=_CWORD89_Service
+
+[FLAG_MISINK]
+LogLevel=Release
+FileName=frameworkunified_debug_misink.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=MisinkService
+Service2=misink
+Service3=MlinkService
+Service4=mlink
+
+[FLAG_CONNPROXY]
+LogLevel=Release
+FileName=frameworkunified_debug_connproxy.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=TFFProxySlave
+
+
+[FLAG_CPAA]
+LogLevel=Release
+FileName=frameworkunified_debug_cpaa.log
+FileSizeMax=81920
+Realtimelog=True
+Service1=_CWORD27_Service
+Service2=_CWORD28_AutoService
+
diff --git a/nsframework/framework_unified/client/include/native_service/XMLParser.h b/nsframework/framework_unified/client/include/native_service/XMLParser.h
new file mode 100755
index 0000000..36467ba
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/XMLParser.h
@@ -0,0 +1,289 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup MY 14 Platform Software Team
+/// \brief Xml parser used to extract and update data from Xml file
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file XMLParser.h
+ * @brief \~english Xml parser used to extract and update data from Xml file
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef XMLPARSER_H_ // NOLINT (build/header_guard)
+#define XMLPARSER_H_
+
+#include <libxml/tree.h>
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+
+#include <vector>
+#include <list>
+#include <string>
+#include <map>
+#include <sstream>
+
+////////////////////////////////////////////////////////////////////////
+/// CTestCaseData : Class used to fill testcase data from XML
+////////////////////////////////////////////////////////////////////////
+
+
+class CTestCaseData {
+ public:
+ std::string key;
+
+ // Delay for testCase
+ SI_32 m_testDelaySec;
+ SI_32 m_testDelayMSec;
+ SI_32 m_testDelayUSec;
+ // TestLoop Count
+ SI_32 m_testLoop;
+
+ SI_32 m_testReset;
+ SI_32 m_testPrintResult;
+ std::string m_testCategory;
+ std::string m_testResultType;
+
+ std::vector<std::string> macroVector;
+ // Delay for TestMacros
+ std::string m_macroDelaySecVal;
+ std::string m_macroDelayMsecVal;
+ std::string m_macroDelayUsecVal;
+
+ std::list<std::string> expOut;
+
+
+ CTestCaseData(const xmlChar *name, std::string testDelaySec, std::string testDelayMSec, std::string testDelayUSec,
+ std::string testLoopVal, std::string testReset, std::string testPrintResult, std::string testCategory,
+ std::string testResultType, std::vector<std::string> paramMacroVector, std::string macroDelaySecVal,
+ std::string macroDelayMSecVal, std::string macroDelayUSecVal,
+ std::list<std::string> expOutputVector);
+
+ CTestCaseData(const CTestCaseData &value);
+
+ ~CTestCaseData();
+};
+
+class XMLParser {
+ private:
+ struct FindByName {
+ std::string l_sName;
+ FindByName(const std::string &name) : l_sName(name) {} // NOLINT (readability/nolint)
+ bool operator()(const xmlNodePtr &xmlNode) {
+ std::stringstream l_sStream;
+ l_sStream << xmlNode->name;
+ std::string l_sStr = l_sStream.str();
+ return l_sStr == l_sName;
+ }
+ };
+
+ public:
+ static std::string xmlCharToString(const xmlChar *value);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// XMLParser
+ /// Class Constructor
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ XMLParser();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// XMLParser
+ /// Class Destructor
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ ~XMLParser();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// readAllXml
+ /// read all XML files from xmlInputFile
+ ///
+ /// \param [in] xmlInputFile
+ /// string
+ /// xmlList
+ /// string
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void readAllXml(const std::string &xmlInputFile, std::list<std::string> &xmlList); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// getChildNodeList
+ ///
+ /// \param [in] node
+ /// xmlNodePtr
+ /// nodeVector
+ /// vector<xmlNodePtr>
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void getChildNodeList(xmlNodePtr node, std::vector<xmlNodePtr> &nodeVector); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// fillMacroVector
+ ///
+ /// \param [in] node
+ /// xmlFileHandle
+ /// xmlDocPtr
+ /// macroNodeVector
+ /// vector<xmlNodePtr>
+ /// expOutValue
+ /// string
+ /// expOutputVector
+ /// list<std::string>
+ /// macroDelayVal
+ /// string
+ /// paramMacroVector
+ /// vector<std::string>
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void fillMacroVector(xmlDocPtr &xmlFileHandle, // NOLINT (readability/nolint)
+ std::vector<xmlNodePtr> &macroNodeVector, // NOLINT (readability/nolint)
+ std::string &expOutValue, // NOLINT (readability/nolint)
+ std::list<std::string> &expOutputVector, // NOLINT (readability/nolint)
+ std::string &macroSecDelayVal, // NOLINT (readability/nolint)
+ std::string &macroMSecDelayVal, // NOLINT (readability/nolint)
+ std::string &macroUSecDelayVal, // NOLINT (readability/nolint)
+ std::vector<std::string> &paramMacroVector); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// StringToNumber
+ /// Convert the string to number
+ ///
+ /// \param [in]
+ /// Text
+ /// string
+ ///
+ /// \return number value
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static int StringToNumber(const std::string &Text) { // NOLINT (readability/nolint)
+ std::istringstream ss(Text, std::istringstream::in);
+ int result;
+ return ss >> result ? result : 0;
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// createTestCaseVector
+ ///
+ /// \param [in]
+ /// testCaseNodeVector
+ /// vector<xmlNodePtr>
+ /// xmlFileHandle
+ /// xmlDocPtr
+ /// testCaseDataVector
+ /// vector<CTestCaseData>
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void createTestCaseVector(std::vector<xmlNodePtr> &testCaseNodeVector, xmlDocPtr &xmlFileHandle, // NOLINT (readability/nolint)
+ std::vector<CTestCaseData> &testCaseDataVector); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetXmlNodeAttributeValueToString
+ ///
+ /// \param [in]
+ /// arg
+ /// void *
+ /// str
+ /// const char *
+ /// xmlFileHandle
+ /// xmlDocPtr
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetXmlNodeAttributeValueToString(void *arg, const char *str, xmlDocPtr xmlFileHandle);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// populateTestCaseMap
+ ///
+ /// \param [in]
+ /// testCaseDataVector
+ /// vector<CTestCaseData>
+ /// xmlFileHandle
+ /// xmlDocPtr
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void populateTestCaseMap(std::vector<CTestCaseData> &testCaseDataVector, xmlDocPtr xmlFileHandle) ; // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// updateXmlActualOutput
+ ///
+ /// \param [in]
+ /// xmlName
+ /// string
+ /// testCaseName
+ /// string
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void updateXmlActualOutput(const std::string &xmlName, // NOLINT (readability/nolint)
+ std::string &testCaseName, // NOLINT (readability/nolint)
+ std::string &actualOutput); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetXmlExpectedOutput
+ ///
+ /// \param [in]
+ /// pKey
+ /// string
+ /// pValue
+ /// string
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void GetXmlExpectedOutput(std::string pKey, std::string pValue);
+
+ private:
+ xmlDocPtr m_xmlFileHandle;
+ static const std::string EXPECTEDOUTPUT;
+ static const std::string VALUE;
+ static const std::string DELAYSEC;
+ static const std::string DELAYMSEC;
+ static const std::string DELAYUSEC;
+ static const std::string TESTLOOP;
+ static const std::string TESTRESET;
+ static const std::string TESTPRINTRESULT;
+ static const std::string TESTCATEGORY;
+ static const std::string TESTCASEDATA;
+ static const std::string MACRODELAYSEC;
+ static const std::string MACRODELAYMSEC;
+ static const std::string MACRODELAYUSEC;
+ static const std::string LOOPPVAL;
+ static const std::string ACTUALOUTOUT;
+ static const std::string OUTPUT_SEPARATOR;
+ static const std::string ACCESS_OPERATOR;
+ static const std::string TERMINATE_STR;
+ static const SI_32 LOOP_DEFAULT_VALUE;
+ static const std::string DEFAULT_VALUE;
+ static const std::string PARAMETER_SEPARATOR;
+ static const std::string TESTRESULTTYPE;
+ static const std::string RESULT_AUTOMATIC;
+ static const std::string RESULT_MANUAL;
+};
+
+#endif /* XMLPARSER_H_ */ // NOLINT (build/header_guard)
+
+// EOF
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/framework_unified.h b/nsframework/framework_unified/client/include/native_service/framework_unified.h
new file mode 100755
index 0000000..b3c2f29
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/framework_unified.h
@@ -0,0 +1,130 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file framework_unified.h
+ * @brief \~english include all framework_unified head files
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef NATIVESERVICE_FRAMEWORKUNIFIED_H_ // NOLINT (build/header_guard)
+#define NATIVESERVICE_FRAMEWORKUNIFIED_H_
+
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_eventlogger.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_np_service_nor_persistence.h>
+#include <native_service/ns_np_service_notification.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/ns_shared_mem.h>
+#include <native_service/ns_shared_mem_if.h>
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_reader.h>
+#include <native_service/ns_sharedmem_writer.h>
+#include <native_service/ns_ringbuffer.h>
+#include <native_service/ns_system_mode.h>
+#include <native_service/ns_timer_if.h>
+#include <native_service/ns_timer_if.hpp>
+#include <native_service/ns_transmit_log.h>
+#include <native_service/ns_utility.hpp>
+#include <native_service/ns_utility_if.h>
+#include <native_service/ns_utility_sys.hpp>
+#include <native_service/ns_util_directory.h>
+#include <native_service/ns_util_crc.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/ns_resource_controler.h>
+#include <native_service/ns_version.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/wpf_legacy.h>
+#include <native_service/ns_rcs_data_handler.hpp>
+#include <native_service/ns_rcs_logger_types.h>
+#include <native_service/ns_rcs_plugin.hpp>
+#include <native_service/ns__CWORD77__common.h>
+#include <native_service/ns__CWORD77__data_pool_if.h>
+#include <native_service/ns__CWORD77__data_pool_key.h>
+#include <native_service/ns__CWORD77__data_pool_table.h>
+#include <native_service/ns__CWORD77__notifications.h>
+#include <native_service/ns__CWORD77__types.h>
+#include <native_service/frameworkunified__CWORD77__service_if.h>
+#include <native_service/frameworkunified__CWORD77__session_if.h>
+#include <native_service/ns_buildversioncheck.hpp>
+#include <native_service/ns_endianess.h>
+#include <native_service/nslogutil_cmd_if.h>
+#include <native_service/nsfw_message.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_framework_sync.h>
+#include <native_service/frameworkunified_framework_system_if.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_service_if.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <native_service/frameworkunified_timer.h>
+#include <native_service/frameworkunified_sm_action.h>
+#include <native_service/frameworkunified_sm_compositestate.h>
+#include <native_service/frameworkunified_sm_conditionconnector.h>
+#include <native_service/frameworkunified_sm_deephistorystate.h>
+#include <native_service/frameworkunified_sm_dispatcher.h>
+#include <native_service/frameworkunified_sm_eventdata.h>
+#include <native_service/frameworkunified_sm_eventfactory.h>
+#include <native_service/frameworkunified_sm_externaltransition.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/frameworkunified_sm_framework_if.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_guard.h>
+#include <native_service/frameworkunified_sm_historystate.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_sm_internaltransition.h>
+#include <native_service/frameworkunified_sm_leafstate.h>
+#include <native_service/frameworkunified_sm_localtransition.h>
+#include <native_service/frameworkunified_sm_multithreading.h>
+#include <native_service/frameworkunified_sm_orthogonalstate.h>
+#include <native_service/frameworkunified_sm_reaction.h>
+#include <native_service/frameworkunified_sm_shallowhistorystate.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_transition.h>
+#include <native_service/XMLParser.h>
+#include <native_service/ns_xml_reader.h>
+#include <native_service/ns_xml_wrter.h>
+#include <native_service/ns_xmlparser_if.h>
+#include <native_service/ns_reader.h>
+#include <native_service/ns_writer.h>
+
+#endif // NATIVESERVICE_FRAMEWORKUNIFIED_H_ NOLINT (build/header_guard)
+/**@}*/ // end of inc
+/**@}*/ // end of framework_unified
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__service_if.h b/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__service_if.h
new file mode 100755
index 0000000..823257f
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__service_if.h
@@ -0,0 +1,554 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified__CWORD77__service_if.h
+ * @brief \~english This file contains a interface class for all services classes.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIED__CWORD77_SERVICE_H_ // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIED__CWORD77_SERVICE_H_
+
+#include <native_service/ns__CWORD77__common.h>
+#include <native_service/frameworkunified__CWORD77__session_if.h>
+#include <string>
+#include <map>
+#include <vector>
+
+///////////////////////////////////////////////////////////////////////////
+/// class: CFrameworkunified_CWORD77_Service
+/// Description: This is interface class for all services classes.
+///
+////////////////////////////////////////////////////////////////////////////
+
+class CFrameworkunified_CWORD77_Service {
+ protected:
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *> m_SessTypeToSessObj; ///< Map of session type to session object
+ ResponseServiceTo_CWORD77_ m_cbResponse; ///< Call back function pointer
+ SessionAckTo_CWORD77_ m_cbSessionACK; // Call back function pointer for session ACK
+ std::vector<FrameworkunifiedNotificationCallbackHandler> m_vServiceNotifications; ///< vector of Frameworkunifiednotification callbacks
+ CFrameworkunified_CWORD77_Session *m_pSession; ///< Pointer to an instance of I_CWORD77_Session
+ std::string m_cServiceName;
+ BOOL m_bServiceAvailable;
+ UI_8 m_ui8SessionRetryCount;
+ HANDLE m_hApp; ///> application framework handle
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Function to send message to a session
+ /// \~english @param[in] f_uiSessionType
+ /// UI_32 - session type
+ /// \~english @param[in] f_uiSrvProtocol
+ /// UI_32 - Protocol ID
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// CFrameworkunified_CWORD77_Service::SetSession()
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Send specified sessionType message by FrameworkunifiedSendMsg().
+ /// \~english @par
+ /// If the session object corresponding to the session Public specified by the arguments is not registered,
+ /// the system terminates normally without sending the object.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see SetSession,FrameworkunifiedSendMsg
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SendMessageToSession(UI_32 f_uiSessionType, UI_32 f_uiSrvProtocol);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Function to open sessions with specified Service Name
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle to the Framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @param [in] f_sServiceName
+ /// f_sServiceName - Service Name
+ /// \~english @par
+ /// f_sServiceName - const std::string&
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - Save service name into member variable.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Function to open sessions with specified Service Name
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void OpenSession(HANDLE f_hApp, const std::string &f_sServiceName);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Function to close sessions
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle to the Framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Function to close sessions
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ void CloseSession(HANDLE f_hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Function to add notification
+ /// \~english @param[in] f_pNotification
+ /// PCSTR - Notification name
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Session obeject is declared in CFrameworkunified_CWORD77_Service::SetSession()
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// -Bind Notification name declared in parameter with callbak function in OnServiceNtf()
+ /// \~english @par Detail
+ /// -subscribed notifications will transfor into subscribe instance in SubscribeNotifications()
+ /// \~english @par Detail
+ /// -Process will not commit when notification parameter name is null
+ /// \~english @par Classification
+ /// -public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see SetSession,OnServiceNtf,SubscribeNotifications,UnSubscribeNotifications
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void AddNotification(PCSTR f_pNotification);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AttachOpenSessionAckCallback
+ /// virtual function to attche open session ack callback
+ ///
+ /// \param [in] hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus AttachOpenSessionAckCallback(HANDLE hApp) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// OpenSessionRetry
+ /// This function sends open session request to the service m_cServiceName
+ ///
+ /// \param [in] f_ui32SessionType
+ /// UI_32 - Session type to open
+ /// \return none
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ void OpenSessionRetry(UI_32 f_ui32SessionType);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Constructor for CFrameworkunified_CWORD77_Service
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// -No preconditions
+ /// \~english @par Change of internal status
+ /// -The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// -Create CFrameworkunified_CWORD77_Service class instance
+ /// -Initialize class member variable(m_cbResponse, m_cbSessionACK, m_pSession, m_cServiceName,\n
+ /// m_bServiceAvailable, m_ui8SessionRetryCount, m_hApp, m_SessTypeToSessObj).\n
+ /// \~english @par Classification
+ /// -public
+ /// \~english @par type
+ /// -None
+ /// \~english @see ~CFrameworkunified_CWORD77_Service
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunified_CWORD77_Service();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunified_CWORD77_Service
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -CFrameworkunified_CWORD77_Service instance is decleared in Constructor
+ /// \~english @par Change of internal status
+ /// -The internal status is not changed
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// -Release the CFrameworkunified_CWORD77_Service class instance
+ /// \~english @par Classification
+ /// -Pubulic
+ /// \~english @par Type
+ /// -None
+ /// \~english @see CFrameworkunified_CWORD77_Service
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunified_CWORD77_Service();
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// HandleMessage
+ /// virtual function to process message coming from _CWORD77_
+ /// \~english @param [in] cmdID
+ /// cmdID - Request ID
+ /// \~english @par
+ /// cmdID UI_32
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or Error
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// - none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus HandleServiceMessage(UI_32 cmdID) = 0;
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// function to open session with specified Service name when service available.
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle to the Framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @param [in] f_sServiceName
+ /// f_sServiceName - service name
+ /// \~english @par
+ /// f_sServiceName - const std::string &
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or Error
+ /// \~english @par Preconditions
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - save Framework handler into m_hApp.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// function to open session with specified Service name
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see AttachOpenSessionAckCallback, OpenSession
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenServiceOnAvailability(HANDLE f_hApp, const std::string &f_sServiceName);
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// function to close session when service unavailable.
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle to the Framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or Error
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - set m_bServiceAvailable FALSE.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// function to close session when service unavailable.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CloseSession
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseServiceOnUnavailability(HANDLE hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Set Call back function into Sessions.
+ /// \~english @param [in] fptr
+ /// fptr - Pointer to call back function
+ /// \~english @par
+ /// fptr ResponseServiceTo_CWORD77_*
+ /// \~english @retval
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - set m_cbResponse with fptr.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Set Call back function into Sessions.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetResponseCallback(ResponseServiceTo_CWORD77_ fptr);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// API to set session objects in service.
+ /// \~english @param [in] f_pSessionObj
+ /// f_pSessionObj - Pointer to an instance of session object.
+ /// \~english @par
+ /// f_pSessionObj CFrameworkunified_CWORD77_Session*
+ /// \~english @retval
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - set sessionobj into m_SessTypeToSessObj.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Set session objects in service.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetSession(CFrameworkunified_CWORD77_Session *f_pSessionObj);
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Subscribe notifications.
+ /// \~english @param [in] hApp
+ /// hApp - Handle to the Framework.
+ /// \~english @par
+ /// hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or eFrameworkunifiedStatusInvldParam
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - save pointer of notifications into framework handler.
+ /// \~english @par Conditions of processing failure
+ /// - FrameworkunifiedSubscribeNotificationWithCallback() failed [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Detail
+ /// Send subscribe message to NPPService for Subscribe notifications.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedSubscribeNotificationWithCallback
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SubscribeNotifications(HANDLE hApp);
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// unsubscribe notifications
+ /// \~english @param [in] hApp
+ /// hApp - Handle to the Framework.
+ /// \~english @par
+ /// hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or eFrameworkunifiedStatusInvldParam
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - delete notifications from framework handler.
+ /// \~english @par Conditions of processing failure
+ /// - FrameworkunifiedNPUnsubscribeFromNotifications() failed [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Detail
+ /// Send unsubscribe message to NPPService for delete subscribe notifications.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedSubscribeNotificationWithCallback
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnSubscribeNotifications(HANDLE hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// virtual function to enable session in service
+ /// \~english @param [in] f_uiNum
+ /// f_uiNum - Number of arguments
+ /// \~english @par
+ /// f_uiNum UI_32
+ /// \~english @param [in] f_uiFirst
+ /// f_uiFirst - first argument
+ /// \~english @par
+ /// f_uiFirst UI_32
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// None
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// None
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual void EnableSession(UI_32 f_uiNum, UI_32 f_uiFirst, ...) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// unsubscribe notifications
+ /// \~english @param [in] hApp
+ /// hApp - Handle to the Framework.
+ /// \~english @par
+ /// hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or eFrameworkunifiedStatusNullPointer
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none.
+ /// \~english @par Conditions of processing failure
+ /// - FrameworkunifiedGetMsgDataOfSize() failed [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Call register subscribe notification.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedGetMsgDataOfSize, SetRespNotfnDataIn_CWORD77_DataPool
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnServiceNtf(HANDLE hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Acknowledgement process of open session
+ /// \~english @param[in] f_hApp
+ /// HANDLE - Handle to the Application
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Set Session object in CFrameworkunified_CWORD77_Service::SetSession()
+ /// - Set Callback function in CFrameworkunified_CWORD77_Service::Set_CWORD77_OpenSessionACK()
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Set the application handle as Parameter when receiving acknowledgement for open session process.
+ /// Call OpenSessionAcknowledge() in session object which has same session type.
+ /// Call the callback function for open session acknowledgement.
+ /// \~english @par
+ /// Message sending process will be stoped in reguler when the session type of open session process is not
+ /// declared.
+ /// \~english @par
+ /// Callback function will be stoped in reguler when callback function is not declared.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see SetSession,Set_CWORD77_OpenSessionACK
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void OpenSessionAcks(HANDLE f_hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Attach open session ack callback function to service.
+ /// \~english @param [in] fptr
+ /// fptr - Callback Function pointer of notify open session ack.
+ /// \~english @par
+ /// fptr SessionAckTo_CWORD77_*
+ /// \~english @retval
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - set callback function into m_cbSessionACK..
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Attach open session ack callback function to service.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void Set_CWORD77_OpenSessionACK(SessionAckTo_CWORD77_ fptr);
+};
+
+#endif // _FRAMEWORKUNIFIED__CWORD77_SERVICE_H_ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__session_if.h b/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__session_if.h
new file mode 100755
index 0000000..2c189a7
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__session_if.h
@@ -0,0 +1,495 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified__CWORD77__session_if.h
+ * @brief \~english This file provides API for operating session
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIED__CWORD77_SESSION_H_ // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIED__CWORD77_SESSION_H_
+
+#include <native_service/ns__CWORD77__common.h>
+#include <string>
+#include <vector>
+
+class CFrameworkunified_CWORD77_Session {
+ protected:
+ HANDLE m_hSession; ///< Handle to session
+ HANDLE m_hApp; ///< Handle to Framework
+ HANDLE m_hService; ///< Handle to Service
+ UI_32 m_uiSessionType; ///< Session Type
+ ResponseServiceTo_CWORD77_ m_ResponseTo_CWORD77_; ///< Call back function pointer
+ std::vector<FrameworkunifiedProtocolCallbackHandler> m_vSessionProtocolHanlder;
+ std::vector<UI_32> m_vEventVector;
+ std::vector<FrameworkunifiedProtocolCallbackHandler> m_vSessionEventHandler;
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddProtocol
+ /// Function to add notification
+ ///
+ /// \param[in] f_uiCmdId
+ /// UI_32 - Command id
+ /// \param[in] f_cbFuncPtr
+ /// CbFuncPtr - Callback function pointer
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void AddProtocolHandler(UI_32 f_uiCmdId, CbFuncPtr f_cbFuncPtr);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AttachProtocolwithDispatcher
+ /// API to Register Session 1 of Service A protocols with Dispatcher
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AttachProtocolwithDispatcher(HANDLE f_hApp);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// DetachProtocolwithDispatcher
+ /// API to Un Register Session 1 of Service A protocols with Dispatcher
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DetachProtocolwithDispatcher(HANDLE f_hApp);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AttachEventswithDispatcher
+ /// Function to register events with dispatcher
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AttachEventswithDispatcher(HANDLE f_hApp);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// RegisterEvents
+ /// Function to register events
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterEvents(HANDLE f_hApp); // Function: added by Shyam to overcome
+ /// the naming conflict in registering the event
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AttachEventHandlerswithDispatcher
+ /// API to Register Session 1 of Service A protocols with Dispatcher
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AttachEventHandlerswithDispatcher(HANDLE f_hApp);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// DetachEventHandlerswithDispatcher
+ /// API to Un Register Session 1 of Service A protocols with Dispatcher
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DetachEventHandlerswithDispatcher(HANDLE f_hApp);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventHandler
+ /// Function to add event handler
+ ///
+ /// \param[in] f_uiCmdId
+ /// UI_32 - Command id
+ /// \param[in] f_cbFuncPtr
+ /// CbFuncPtr - Callback function pointer
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void AddEventHandler(UI_32 f_uiCmdId, CbFuncPtr f_cbFuncPtr);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// Constructor for CFrameworkunified_CWORD77_Session
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// no preconditions
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Create CFrameworkunified_CWORD77_Session instance and initialize the member parameter(m_hSession, m_hApp,m_hService,\n
+ /// m_uiSessionType)
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunified_CWORD77_Session
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunified_CWORD77_Session();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunified_CWORD77_Session
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// CFrameworkunified_CWORD77_Session is decleared in constructor
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Release CFrameworkunified_CWORD77_Session class instance
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunified_CWORD77_Session
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunified_CWORD77_Session();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// send specific command by session
+ /// \~english @param [in] cmdID
+ /// cmdID - commond id
+ /// \~english @par
+ /// cmdID UI_32
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or failed
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - GetReqDataFrom_CWORD77_DataPool() failed [eFrameworkunifiedStatusDbRecNotFound]
+ /// - FrameworkunifiedSendMsg() failed
+ /// - if m_hSession is NULL. [eFrameworkunifiedStatusSessionErr]
+ /// \~english @par Detail
+ /// send specified commond by session.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see GetReqDataFrom_CWORD77_DataPool
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ // virtual EFrameworkunifiedStatus HandleSessionMessage(UI_32 cmdID);
+ EFrameworkunifiedStatus HandleSessionMessage(UI_32 cmdID);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// Set Call back function in Session
+ /// \~english @param [in] fptr
+ /// fptr - Pointer to call back function
+ /// \~english @par
+ /// fptr ResponseServiceTo_CWORD77_*
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - set callback into m_ResponseTo_CWORD77_.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Set Call back function in Session
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetResponseCallback(ResponseServiceTo_CWORD77_ fptr);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// function to Open Session.(pure virtual function)
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle of framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @param [in] f_sServiceName
+ /// f_sServiceName - Service Name
+ /// \~english @par
+ /// f_sServiceName std::string
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus OpenSession(HANDLE f_hApp, std::string f_sServiceName) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// function to close Session.(pure virtual function)
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle of framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// - none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus CloseSession(HANDLE f_hApp) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// Open Session acknowledge.(pure virtual function)
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle of framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// -none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus OpenSessionAcknowledge(HANDLE f_hApp) = 0;
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSessionType
+ /// API to get session type
+ ///
+ /// \return UI_32 - Session type
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// API to get session type
+ /// \~english @param none
+ /// \~english @retval UI_32 - Session type
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// API to get session type.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetSessionType();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// API to set session type into class CFrameworkunified_CWORD77_Session object.
+ /// \~english @param[in] sessioType
+ /// const UI_32& - Session type
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// API to set session type into class CFrameworkunified_CWORD77_Session object.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ /// none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetSessionType(const UI_32 &sessioType);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// declear callback funcion into Dispatcher
+ /// \~english @param[in] hApp
+ /// HANDLE - Handle to Application
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// no precondition
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// declear OnResponse() of callback function by calling FrameworkunifiedAttachCallbackToDispatcher()\n
+ /// get decleared protocol ID through GetResponseProtocolArray()\n
+ /// get decleared event ID through GetEventArray() and regist event-sending instance in FrameworkunifiedRegisterEvent
+ /// \~english @par
+ /// cautions in using this API:\n
+ /// -Registrition will fail without msg When Application handle is uncorrect set by parameter\n
+ /// -Registrition process in FrameworkunifiedAttachCallbackToDispatcher() will not commit when
+ /// GetResponseProtocolArray()\n
+ /// or GetEventArray() returns NULL or NULL list
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedRegisterEvent,
+ /// GetResponseProtocolArray, GetEventArray, OnResponse
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void AttachResponseCallbacks(HANDLE hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// unscrible dispatcher callback function
+ /// \~english @param[in] hApp
+ /// HANDLE - Handle to Application
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// no preconditions
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// declear OnResponse() of callback function by calling FrameworkunifiedDetachCallbackFromDispatcher()\n
+ /// get unregistrition protocol ID through GetResponseProtocolArray()\n
+ /// get unregistrition event ID through GetEventArray() and unregist event-sending instance in \n
+ /// FrameworkunifiedUnRegisterEvent()
+ /// \~english @par Detail
+ /// cautions in using this API:\n
+ /// -Unregistrition will fail without msg When Application handle is uncorrect set by parameter\n
+ /// -Unregistrition process in FrameworkunifiedDetachCallbackFromDispatcher() will not commit when
+ /// GetResponseProtocolArray()\n
+ /// or GetEventArray() returns NULL or NULL list
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedUnRegisterEvent,
+ /// GetResponseProtocolArray, GetEventArray
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void DetachResponseCallbacks(HANDLE hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnResponse
+ /// Callback function on receiving response protocol or event specified in the list, returned
+ /// by either \ref GetResponseProtocolArray or \ref GetEventArray
+ ///
+ /// \param [in] hApp
+ /// HANDLE - Handle to framework
+ /// \return None
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// Callback function on receiving response protocol or event specified in the list, returned
+ /// by either \ref GetResponseProtocolArray or \ref GetEventArray
+ /// \~english @param [in] f_hApp
+ /// HANDLE - Handle of framework
+
+ /// \~english @retval EFrameworkunifiedStatus
+ /// SuceFrameworkunifiedStatusOK or eFrameworkunifiedStatusNullPointer
+ /// \~english @par Preconditions
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - framework handler is invalid handler.[eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Callback function on receiving response protocol or event specified in the list, returned
+ /// by either \ref GetResponseProtocolArray or \ref GetEventArray
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedGetMsgDataOfSize
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnResponse(HANDLE hApp);
+
+ // FIXME: Following set of functions should be pure virtual functions.
+ // But, in order to avoid build errors for HMI__CWORD77_, it is defined as virtual functions only.
+ // Because nobody who is currently deriving off of frameworkunified__CWORD77__session_if.h has these functions implemented.
+ virtual UI_32 const *GetResponseProtocolArray() = 0;
+ virtual UI_32 const GetResponseProtocolArrayLength() = 0;
+ virtual UI_32 const *GetEventArray() = 0;
+ virtual UI_32 const GetEventArrayLength() = 0;
+};
+
+#endif // _FRAMEWORKUNIFIED__CWORD77_SESSION_H_ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_application.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_application.h
new file mode 100755
index 0000000..9d96751
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_application.h
@@ -0,0 +1,376 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief System callbacks that applications should address.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_application.h
+ * @brief \~english This file contains the base api of an application that must be provided.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_APPLICATION_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_APPLICATION_H__
+
+#include <native_service/frameworkunified_types.h>
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup IsNull
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton initialize
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp);
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton WaleUp
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnWakeup(HANDLE hApp); /// << deprecated
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton shutdown
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE hApp); /// << deprecated
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton EShutdown
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE hApp); /// << deprecated
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton start
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp);
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton stop
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOnPreStart
+/// \~english @par Brief
+/// callback of Application Life cycle event
+/// \~english @param [in] hApp
+/// HANDLE - Application Handle
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// Depend on the implementation in the inheriting class
+/// \~english @par Change of internal state
+/// Depend on the implementation in the inheriting class
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// callback of Application Pre start
+/// \~english @par
+/// - include frameworkunified_application.h
+/// - Library libNS_FrameworkUnified.so
+/// - Set compile option for "-DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND" when this API in the each application implements.
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOnPreStop
+/// \~english @par Brief
+/// callback of Application Life cycle event
+/// \~english @param [in] hApp
+/// HANDLE - Application Handle
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// Depend on the implementation in the inheriting class
+/// \~english @par Change of internal state
+/// Depend on the implementation in the inheriting class
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// callback of Application Pre stop
+/// \~english @par
+/// - include frameworkunified_application.h
+/// - Library libNS_FrameworkUnified.so
+/// - Set compile option for "-DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND" when this API in the each application implements.
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOnBackgroundStart
+/// \~english @par Brief
+/// callback of Application Life cycle event
+/// \~english @param [in] hApp
+/// HANDLE - Application Handle
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// Depend on the implementation in the inheriting class
+/// \~english @par Change of internal state
+/// Depend on the implementation in the inheriting class
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// callback of Application Background start
+/// \~english @par
+/// - include frameworkunified_application.h
+/// - Library libNS_FrameworkUnified.so
+/// - Set compile option for "-DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND" when this API in the each application implements.
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOnBackgroundStop
+/// \~english @par Brief
+/// callback of Application Life cycle event
+/// \~english @param [in] hApp
+/// HANDLE - Application Handle
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// Depend on the implementation in the inheriting class
+/// \~english @par Change of internal state
+/// Depend on the implementation in the inheriting class
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// callback of Application Background stop
+/// \~english @par
+/// - include frameworkunified_application.h
+/// - Library libNS_FrameworkUnified.so
+/// - Set compile option for "-DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND" when this API in the each application implements.
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp);
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton reinit
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnReinit(HANDLE hApp);
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton destroy
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp);
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton debugdump
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp); // << Used for CCR Debugging
+
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval PCSTR depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of get applicaiton servcice avaible
+////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetServiceAvailabilityNotification(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOnDummy
+/// \~english @par Brief
+/// dummy callback of Application Life cycle event
+/// \~english @param [in] hApp
+/// HANDLE - Application Handle
+/// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
+/// \~english @par Prerequisite
+/// Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Registered dummy callback when not processing
+/// \~english @par
+/// - include frameworkunified_application.h
+/// - Library libNS_FrameworkUnified.so
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDummy(HANDLE hApp);
+
+#endif /* __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_APPLICATION_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_dispatcher.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_dispatcher.h
new file mode 100755
index 0000000..8aa4572
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_dispatcher.h
@@ -0,0 +1,803 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Application dispatch interface functions
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_dispatcher.h
+ * @brief \~english This file contains the base class of application.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_DISPATCHER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_DISPATCHER_H__
+
+#include <native_service/frameworkunified_framework_types.h>
+// #include <native_service/frameworkunified_sm_hsmframework.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDispatcher
+/// \~english @par Brief
+/// This API creates, initializes the dispatcher and runs mainloop for event handling.
+/// \~english @param [in] cAppName
+/// PCSTR - Pointer to application thread name
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Pointer to default callback functions.
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Function is called when a Dispatcher is created.
+/// */
+/// CbFuncPtr onDestroy; /* Function is called when the Dispatcher is
+/// released. */
+/// CbFuncPtr onStart; /* Function is called when the Dispatcher is started.
+/// */
+/// CbFuncPtr onStop; /* Function is called when the Dispatcher is stopped.
+/// */
+/// CbFuncPtr onPreStart; /* Function is called when the Dispatcher is pre started. */
+/// CbFuncPtr onPreStop; /* Function is called when the Dispatcher is pre stoped. */
+/// CbFuncPtr onBackgroundStart; /* Function is called when the Dispatcher is Background started. */
+/// CbFuncPtr onBackgroundStop; /* Function is called when the Dispatcher is Background stopped. */
+/// CbFuncPtr onDebugDump; /* Function is called when the Dispatcher detects
+/// abnormal state. */
+/// CbFuncPtr createStateMachine; /* Set dummy function that does nothing.
+/// */
+/// CbFuncPtr ssFrameworkInterface; /* Function to connect to SystemManager
+/// */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @par
+/// About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
+/// - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
+/// - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+/// - If application is resident service, link library libSS_SystemIfUnified
+/// (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
+/// - If application is nonresident service, define function that does nothing below.
+/// - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - Pointer to default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusNullPointer]
+/// - One of members in default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
+/// 15byte). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
+/// - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+/// the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl).
+/// [eFrameworkunifiedStatusFail]
+/// - The result of FrameworkunifiedOnInitialization is not eFrameworkunifiedStatusOK. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API creates and initializes the dispatcher.\n
+/// It starts to mainloop that receives request or notification, and runs registered callback to dispatcher.
+/// When success starting mainloop, never return.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedDispatcherWithArguments
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatcher(PCSTR cAppName, const FrameworkunifiedDefaultCallbackHandler *CbHandler);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDispatcherWithArguments
+/// \~english @par Brief
+/// This API creates, initializes the dispatcher and runs loop with command-line options.
+/// \~english @param [in] cAppName
+/// PCSTR - Pointer to application thread name
+/// \~english @param [in] argc
+/// int - Number of command-line options
+/// \~english @param [in] argv
+/// char *[] - Array of pointer to command-line options
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Pointer to default callback functions.
+/// \~english @param [in] cmdLineOptions
+/// CustomCommandLineOptions* - Parser setting of command-line options(Optional. When don't use, set NULL.)
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Function is called when a Dispatcher is created.
+/// */
+/// CbFuncPtr onDestroy; /* Function is called when the Dispatcher is
+/// released. */
+/// CbFuncPtr onStart; /* Function is called when the Dispatcher is started.
+/// */
+/// CbFuncPtr onStop; /* Function is called when the Dispatcher is stopped.
+/// */
+/// CbFuncPtr onPreStart; /* Function is called when the Dispatcher is pre started. */
+/// CbFuncPtr onPreStop; /* Function is called when the Dispatcher is pre stoped. */
+/// CbFuncPtr onBackgroundStart; /* Function is called when the Dispatcher is Background started. */
+/// CbFuncPtr onBackgroundStop; /* Function is called when the Dispatcher is Background stopped. */
+/// CbFuncPtr onDebugDump; /* Function is called when the Dispatcher detects
+/// abnormal state. */
+/// CbFuncPtr createStateMachine; /* Set dummy function that does nothing.
+/// */
+/// CbFuncPtr ssFrameworkInterface; /* Function to connect to SystemManager
+/// */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @par
+/// CustomCommandLineOptions Structure
+/// \~english @code
+/// typedef struct _CustomCommandLineOptions
+/// {
+/// PCSTR cShortOptions; /* Short options list. */
+/// PCHAR cLongOptions; /* Reserved. Set to NULL. */
+/// CbArgumentParser callback; /* Pointer to callback function to parse command-line
+/// options. */
+/// } CustomCommandLineOptions;
+/// @endcode
+/// \~english @par
+/// About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
+/// - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
+/// - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+/// - If application is resident service, link library libSS_SystemIfUnified
+/// (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
+/// - If application is nonresident service, define function that does nothing below.
+/// - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - Pointer to default callback functions specified in the argument (CbHandler) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - One of members in default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
+/// 15byte). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
+/// - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - The result of FrameworkunifiedOnInitialization is not eFrameworkunifiedStatusOK. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API creates and initializes the dispatcher with command-line options.\n
+/// It starts to mainloop that receives request or notification, and runs registered callback to dispatcher.
+/// When success starting mainloop, never return.
+/// Use this API to take over a command-line options to the dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedDispatcher, FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock,
+/// FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatcherWithArguments(PCSTR cAppName, int argc, char *argv[],
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler,
+ CustomCommandLineOptions *cmdLineOptions = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSimpleDispatcher
+/// \~english @par none
+/// Generatings/intializes a Dispatcher and executs main loops for handling events.
+/// \~english @param [in] cAppName
+/// PCSTR - Pointer to the application thread name
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Pointer to a default-defined callback function
+/// \~english @param [in] CbShutdown
+/// CbFuncPtr - Pointer to the callack function o be called when the main loop is exited
+/// \~english @param [in] isChildThread
+/// BOOL - Whether the child thread is a dispatcher (Default:TRUE)
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Callback function to run when creating dispatcher instance */
+/// CbFuncPtr onDestroy; /* Callback function to run when releasing dispatcher instance */
+/// CbFuncPtr onStart; /* Callback function executed when dispatcher starts processing */
+/// CbFuncPtr onStop; /* Callback function to be executed when dispatcher termination is requested */
+/// CbFuncPtr onPreStart; /* Callback function executed when dispatcher requestes activation */
+/// CbFuncPtr onPreStop; /* Callback function to be executed when an-request is made to the dispatcher on board status */
+/// CbFuncPtr onBackgroundStart; /* Callback function executed when dispatcher parking is requested */
+/// CbFuncPtr onBackgroundStop; /* Callback function executed when requesting termination of a dispatcher's parking status */
+/// CbFuncPtr onDebugDump; /* Callback function to be executed when an error is detected */
+/// CbFuncPtr createStateMachine; /* Specify an empty function */
+/// CbFuncPtr ssFrameworkInterface; /* Callback function for connecting to the systemManager */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @par
+/// About setting the default definition callback function (FrameworkunifiedDefaultCallbackHandler)
+/// The FrameworkunifiedDefaultCallbackHandler structure passed as argument CbHandler must be initialized using the FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK macro.
+/// - The application that executes this API must define a function with the following name. (Can also be an functio)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+/// If the applicatio is a resident service, link the library libSS_SystemIfUnified
+/// (which provides the function FrameworkunifiedSSFrameworkInterface that performs connection processin with SystemManager).
+/// - If the applicatio is a nonresident service, define the following names with empy function.
+/// - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifiying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusFail User-specific continuation.
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplicate entry error
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Category Type
+/// \~english @retval eFrameworkunifiedStatusErrOther Shared-memory accesses for sending message for NPP Service fail.
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF If the timers fail,...
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Service does not exist
+/// \~english @par Failed to acquire
+/// -
+/// \~english @par Log output string
+/// - The internal state is not changed.
+/// \~english @par You do not use.
+/// - When the pointer (CbHandler) to the default-definition callback function specified by the arguments is NULL [eFrameworkunifiedStatusNullPointer]
+/// - If any of the member of the default-defined callback-function sruct specified in he arguments is NULL [eFrameworkunifiedStatusInvldParam]
+/// - When the pointer (CbShutdown) to the callback fuction to be called when the main loop specified by the arguments exits is NULL [eFrameworkunifiedStatusFail]
+/// - When the pointer (cAppName) to the threade name of the application specified by the arguments is NULL [eFrameworkunifiedStatusNullPointer]
+/// - When the application name (cAppName) specified in the parameter exceeds 15 byte [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open a message queue (mq_open) [eFrameworkunifiedStatusNullPointer]
+/// - When acquisition (malloc) of the message queue management information area fails, [eFrameworkunifiedStatusNullPointer]
+/// - If the creation (socket, bind, listen) of sockets for error monitoring fails,... [eFrameworkunifiedStatusFail]
+/// - Application handles and callback function cannot be added to Notification lists [eFrameworkunifiedStatusDuplicate]
+/// - When the Notification name specified in the arguments has already been registred i the Dispatcher [eFrameworkunifiedStatusDuplicate]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for the NPP Service.... [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages for sessions for NPP Service [eFrameworkunifiedStatusErrOther]
+/// - Failed to create epoll instances (epoll_create1) [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register Dispatcher message queue descriptor for epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to create file descriptor for receiving events to Dispatcher (eventfd) [eFrameworkunifiedStatusFail]
+/// - Failed to register file descriptor for receiving Dispatcher events to epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to register socket for monitoring Dispatcher error in epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - If FrameworkunifiedOnInitialization of result is not eFrameworkunifiedStatusOK [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Type
+/// Creats or initializes a Dispatcher, receives requests and notifications to the Dispatcher, and starts a main loop that executes the registred callback functions.\n
+/// When the main loop is started normally, this API does not retur until the hread terminates.\n
+/// At thread termination, the callback function specified by the third argument is called, and the processing result is returned.\n
+/// \n
+/// This API can be used for both main and child threads.\n
+/// However, since this API is an API for chid threads created without going through the API of NS framework such as \ref FrameworkunifiedCreateChildThread,
+/// it is recommended to use \ref FrameworkunifiedDispatcherWithArguments or other API to create Dispatcher in the main thread.\n
+/// \~english @par Immediate
+/// Brief
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see
+/// FrameworkunifiedDispatcherWithArguments
+///
+/// \~english @par Brief
+/// Generatings/intializes a Dispatcher and executs main loops for handling events
+/// \~english @param [in] cAppName
+/// PCSTR - Application/ thread name
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Function that primes the dispatch pump. i.e. start function
+/// \~english @param [in] CbShutdown
+/// CbFuncPtr * - Shutdown function. Functions gets called if the dispatcher loop exits.
+/// \~English @param[in] isChildThread
+/// BOOL - Default value is TRUE. TRUE - child thread dispatcher else main thread dispatcher
+/// \~english @retval Never does. Unless any callback function returns eFrameworkunifiedStatusExit
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer
+/// \~english @retval eFrameworkunifiedStatusFail Invalid Parameter
+/// \~english @retval eFrameworkunifiedStatusErrOther Unknown Error
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - cAppName is NULL[eFrameworkunifiedStatusNullPointer]
+/// - Length of cAppName is longer than MAX_NAME_SIZE_APP[eFrameworkunifiedStatusNullPointer]
+/// - NativeService has some issues [eFrameworkunifiedStatusNullPointer]
+/// - When the pointer (CbHandler) to the default-definition callback function specified by the arguments is NULL [eFrameworkunifiedStatusNullPointer]
+/// - If any of the member of the default-defined callback-function sruct specified in he arguments is NULL [eFrameworkunifiedStatusInvldParam]
+/// - When the pointer (CbShutdown) to the callback fuction to be called when the main loop specified by the arguments exits is NULL [eFrameworkunifiedStatusFail]
+/// - Failed to open a message queue (mq_open) [eFrameworkunifiedStatusNullPointer]
+/// - When acquisition (malloc) of the message queue management information area fails, [eFrameworkunifiedStatusNullPointer]
+/// - If the creation (socket, bind, listen) of sockets for error monitoring fails,... [eFrameworkunifiedStatusFail]
+/// - Application handles and callback function cannot be added to Notification lists [eFrameworkunifiedStatusDuplicate]
+/// - When the Notification name specified in the arguments has already been registred i the Dispatcher [eFrameworkunifiedStatusDuplicate]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for the NPP Service.... [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// - When an interrupt by a system call (signal) occurs while sending Service session-specific messages. [eFrameworkunifiedStatusErrOther]
+/// - Failed to create epoll instances (epoll_create1) [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register Dispatcher message queue descriptor for epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to create file descriptor for receiving events to Dispatcher (eventfd) [eFrameworkunifiedStatusFail]
+/// - Failed to register file descriptor for receiving Dispatcher events to epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to register socket for monitoring Dispatcher error in epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - If FrameworkunifiedOnInitialization of result is not eFrameworkunifiedStatusOK [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// Creates, initializes and runs the dispatcher. This dispatcher function can be used with child thread or main
+/// thread. <BR>
+/// But, recommended to use for child thread. For main thread use \ref FrameworkunifiedDispatcherWithArguments<BR>
+/// Intention to provide this API is for child threads created from dynamically loaded plugin, where thread wants
+/// to <BR>
+/// subscribe to PASA notification, attach callbacks. This can be done in the start function specified with this
+/// API.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedDispatcherWithArguments
+/// \~english @todo not enough inforamtion need readon why this API is for child thread.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSimpleDispatcher(PCSTR cAppName, const FrameworkunifiedDefaultCallbackHandler *CbHandler, CbFuncPtr CbShutdown,
+ BOOL isChildThread = TRUE);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateDispatcherWithoutLoop
+/// \~english @par Brief
+/// This API creates and initializes the dispatcher with command-line options.
+/// \~english @param [in] cAppName
+/// PCSTR - Pointer to application thread name
+/// \~english @param [out] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [in] argc
+/// int - Number of command-line options
+/// \~english @param [in] argv
+/// char *[] - Array of pointer to command-line options
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Pointer to default callback functions.
+/// \~english @param [in] bIsConnectSM
+/// BOOL - whether or not connect with System Manager(TRUE/FALSE)
+/// \~english @param [in] cmdLineOptions
+/// CustomCommandLineOptions* - Parser setting of command-line options(Optional. When don't use, set NULL.)
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Function is called when a Dispatcher is created.
+/// */
+/// CbFuncPtr onDestroy; /* Function is called when the Dispatcher is
+/// released. */
+/// CbFuncPtr onStart; /* Function is called when the Dispatcher is started.
+/// */
+/// CbFuncPtr onStop; /* Function is called when the Dispatcher is stopped.
+/// */
+/// CbFuncPtr onPreStart; /* Function is called when the Dispatcher is pre started. */
+/// CbFuncPtr onPreStop; /* Function is called when the Dispatcher is pre stoped. */
+/// CbFuncPtr onBackgroundStart; /* Function is called when the Dispatcher is Background started. */
+/// CbFuncPtr onBackgroundStop; /* Function is called when the Dispatcher is Background stopped. */
+/// CbFuncPtr onDebugDump; /* Function is called when the Dispatcher detects
+/// abnormal state. */
+/// CbFuncPtr createStateMachine; /* Set dummy function that does nothing.
+/// */
+/// CbFuncPtr ssFrameworkInterface; /* Function to connect to SystemManager
+/// */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @par
+/// CustomCommandLineOptions Structure
+/// \~english @code
+/// typedef struct _CustomCommandLineOptions
+/// {
+/// PCSTR cShortOptions; /* Short options list. */
+/// PCHAR cLongOptions; /* Reserved. Set to NULL. */
+/// CbArgumentParser callback; /* Pointer to callback function to parse command-line
+/// options. */
+/// } CustomCommandLineOptions;
+/// @endcode
+/// \~english @par
+/// About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
+/// - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
+/// - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+/// - If application is resident service, link library libSS_SystemIfUnified
+/// (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
+/// - If application is nonresident service, define function that does nothing below.
+/// - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - Pointer to default callback functions specified in the argument (CbHandler) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - One of members in default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
+/// 15byte). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
+/// - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API creates and initializes the dispatcher with command-line options without running main loop.\n
+/// Use this, if application control some contexts(include NS framework).\n
+/// when the dispatcher generated by this API, Application need to handle event.\n
+/// Use FrameworkunifiedGetDispatcherFD and FrameworkunifiedDispatchProcessWithoutLoop for event handling.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDestroyDispatcherWithoutLoop, FrameworkunifiedGetDispatcherFD
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcherWithoutLoop(PCSTR cAppName, HANDLE &hApp, int argc, char *argv[], // NOLINT (readability/nolint)
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler,
+ BOOL bIsConnectSM, CustomCommandLineOptions *cmdLineOptions = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDispatchProcessWithoutLoop
+/// \~english @par Brief
+/// Receive request or notification, and run registered callback to dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - If the waiting message (epoll_wait) , was terminated with an error other than interrupt (EINTR)
+/// [eFrameworkunifiedStatusFail]
+/// - Service name that has been set in the received message exceeds the 20byte. [eFrameworkunifiedStatusFail]
+/// - Message queue in the HANDLE specified in the argument (hApp) is not for receive. [eFrameworkunifiedStatusFail]
+/// - Message queue for receive is empty. [eFrameworkunifiedStatusFail]
+/// - File descriptor of message queue for receive is invalid. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) has occurred during the message receiving. [eFrameworkunifiedStatusFail]
+/// - Size of the receive buffer of the message is illegal. [eFrameworkunifiedStatusFail]
+/// - Any errors occur during the message receiving. [eFrameworkunifiedStatusFail]
+/// - Service name in the received message is not appropriate(The name is NULL, Length is 0byte) [eFrameworkunifiedStatusFail]
+/// - The received message data length is more than data length in the received message header. [eFrameworkunifiedStatusFail]
+/// - The received message is not appropriate. [eFrameworkunifiedStatusFail]
+/// - Shared memory ID for receiving message is invalid. [eFrameworkunifiedStatusFail]
+/// - Failed to access to shared memory for receive message. [eFrameworkunifiedStatusFail]
+/// - Data size of shared memory for receiving message is more than destination buffer size. [eFrameworkunifiedStatusFail]
+/// - Message queue of the processing result destination is invalid. [eFrameworkunifiedStatusFail]
+/// - The transmission data that is the received request processing result is NULL. [eFrameworkunifiedStatusFail]
+/// - Service name of the processing result destination is not appropriate(The name is NULL, more than 20byte).
+/// [eFrameworkunifiedStatusFail]
+/// - Failed to access to shared memory for send message. [eFrameworkunifiedStatusFail]
+/// - Message queue type is not for sending. [eFrameworkunifiedStatusFail]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusFail]
+/// - File descriptor of message queue for sending is invalid. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) has occurred during the message sending. [eFrameworkunifiedStatusFail]
+/// - Size of the send buffer of the message is illegal. [eFrameworkunifiedStatusFail]
+/// - Any errors occur during the message sending. [eFrameworkunifiedStatusFail]
+/// - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusFail]
+/// - Failed to get memory buffer for message receiving. [eFrameworkunifiedStatusFail]
+/// - Failed to read data from file descriptor that is set from application. [eFrameworkunifiedStatusFail]
+/// - Failed to run callback that is set from application. [eFrameworkunifiedStatusFail]
+/// - The callback that is set from application returned error. [eFrameworkunifiedStatusFail]
+/// - I could not found callback function associated with file descriptor that is set from application.
+/// [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// If the Dispatcher was created by FrameworkunifiedCreateDispatcherWithoutLoop, \n
+/// you use this API to receive request or notification, and run registered callback to dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDestroyDispatcherWithoutLoop, FrameworkunifiedGetDispatcherFD
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatchProcessWithoutLoop(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDestroyDispatcherWithoutLoop
+/// \~english @par Brief
+/// This API destroy the dispatcher created by FrameworkunifiedCreateDispatcherWithoutLoop.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to release memory referenced by HANDLE specified in the argument (hApp). [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API destroy the dispatcher created by FrameworkunifiedCreateDispatcherWithoutLoop.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+/// FrameworkunifiedCreateDispatcherWithoutLoop
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDestroyDispatcherWithoutLoop(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetDispatcherFD
+/// \~english @par Brief
+/// Get the Dispatcher file descriptor corresponding to the given application handle.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [out] efd
+/// int* - Dispatcher file descriptor
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - The argument efd is NULL. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API gets the Dispatcher file descriptor corresponding to the given application handle.\n
+/// The application can use file descriptor to detect event of NS Framework.\n
+/// When events detected, run FrameworkunifiedDispatchProcessWithoutLoop to handling events.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see FrameworkunifiedDispatchProcessWithoutLoop
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetDispatcherFD(HANDLE hApp, SI_32 *efd); // Replace int with SI_32
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetDefaultCbHandler
+/// \~english @par Brief
+/// Get default callback handler table
+/// \~english @param [out] CbHandler
+/// FrameworkunifiedGetDefaultCbHandler * - Default callback handler table pointer
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Function is called when a Dispatcher is created.
+/// */
+/// CbFuncPtr onDestroy; /* Function is called when the Dispatcher is
+/// released. */
+/// CbFuncPtr onStart; /* Function is called when the Dispatcher is started.
+/// */
+/// CbFuncPtr onStop; /* Function is called when the Dispatcher is stopped.
+/// */
+/// CbFuncPtr onPreStart; /* Function is called when the Dispatcher is pre started. */
+/// CbFuncPtr onPreStop; /* Function is called when the Dispatcher is pre stoped. */
+/// CbFuncPtr onBackgroundStart; /* Function is called when the Dispatcher is Background started. */
+/// CbFuncPtr onBackgroundStop; /* Function is called when the Dispatcher is Background stopped. */
+/// CbFuncPtr onDebugDump; /* Function is called when the Dispatcher detects
+/// abnormal state. */
+/// CbFuncPtr createStateMachine; /* Set dummy function that does nothing.
+/// */
+/// CbFuncPtr ssFrameworkInterface; /* Function to connect to SystemManager
+/// */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer to default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// Gets the default defined callback fuction set by FrameworkunifiedDispatcherWithArguments, FrameworkunifiedSimpleDispatcher, and FrameworkunifiedCreateDispatcherWithoutLoop.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see FrameworkunifiedDispatchProcessWithoutLoop
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetDefaultCbHandler(FrameworkunifiedDefaultCallbackHandler *CbHandler);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachLostSessionCallbackToDispatcher
+/// \~english Register
+/// abnormal session disconnect callback
+/// \~english @param[in] hApp
+/// HANDLE - Application framework handle
+/// \~english @param[in] fpLostSession
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
+/// done.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+/// \~english @par Preconditions
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
+/// done.
+/// \~english @par Change of internal status
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - hApp is NULL [eFrameworkunifiedStatusInvldParam]
+/// - hApp is invalid [eFrameworkunifiedStatusInvldParam]
+/// - fpLostSession is NULL [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Registers a callback fuction to be called when a session disconnection occurs in the specified application handle.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDispatcherWithArguments, FrameworkunifiedSimpleDispatcher
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachLostSessionCallbackToDispatcher(HANDLE hApp, CbFuncPtr fpLostSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetLostSessionData
+/// \~english @par Brief
+/// Get last lost session data
+/// \~english @param [in] hApp
+/// HANDLE - Application framework handle
+/// \~english @param [out] pServiceName
+/// PSTR - Disconnect service name
+/// \~english @param [out] puiSessionId
+/// PUI_32 - Disconnect session ID
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+/// \~english @retval eFrameworkunifiedStatusAccessError Error when accessing resource
+/// \~english @par Preconditions
+/// - Generation/Initialization of Dispatcher for the Application
+/// by FrameworkunifiedCreateDispatcherWithoutLoop has been done.
+/// \~english @par Change of internal status
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - hApp is invalid [eFrameworkunifiedStatusInvldParam]
+/// - pServiceName is NULL [eFrameworkunifiedStatusInvldParam]
+/// - puiSessionId is NULL [eFrameworkunifiedStatusInvldParam]
+/// - Lost session queue is empty [eFrameworkunifiedStatusAccessError]
+/// \~english @par Detail
+/// Gets the service name and session ID disconnected from the hadle for the specified application.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDispatcherWithArguments, FrameworkunifiedSimpleDispatcher
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetLostSessionData(HANDLE hApp, PSTR pServiceName, PUI_32 puiSessionId);
+
+#endif /* __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_DISPATCHER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_error.hpp b/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_error.hpp
new file mode 100755
index 0000000..8c8e3f5
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_error.hpp
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief This file provides framework's API which are used by system services.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_framework_error.hpp
+ * @brief \~english This file provides framework's API which are used by system services.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <stdexcept>
+
+namespace frameworkunified {
+namespace framework {
+namespace error {
+
+class error : public std::runtime_error {
+ public:
+ explicit error(EFrameworkunifiedStatus error, PCSTR errorMsg);
+ private:
+ const EFrameworkunifiedStatus m_error;
+};
+
+}
+}
+}
+
+#define DEFINE_FRAMEWORKUNIFIED_ERROR( name ) \
+class name : public framework_unified::framework::error::error \
+{ \
+public: \
+ explicit name ( EFrameworkunifiedStatus error, PCSTR str ) \
+ : framework_unified::framework::error::error ( error, str ) \
+ {} \
+}
+
+#endif // __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_H__ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_if.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_if.h
new file mode 100755
index 0000000..44ef854
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_if.h
@@ -0,0 +1,6007 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+// tag_NSFramework
+// Application framework's interface header file.
+//
+// The interfaces exposed here are
+// - Application framework Dispatcher
+// - attaching/detaching service protocol callbacks
+// - attaching/detaching notification callbacks
+// - Message Center
+// - send messaging to services/clients
+// - read the incoming message information
+// - Service Directory
+// - open and close a service
+// - register/unregister a service
+// - Notification & Persistence Service
+// - register/unregister and publish a notification
+// - subscribe/unsubscribe to a notification
+//
+/////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_framework_if.h
+ * @brief \~english Application framework's interface header file.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup Native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/ns_shared_mem_if.h>
+#include <native_service/ns_np_service.h>
+///////////////////////////////////
+// To avoid integration build break: removing dependency on SM framework.
+// #include <native_service/frameworkunified_sm_hsmframework.h>
+
+// QUICK FIX Files added here, which was included by frameworkunified_sm_hsmframework.h
+// if we simply comment frameworkunified_sm_hsmframework.h inclusion, then other modules build may
+// break, if they are not including below files explicitly and was relying of frameworkunified_framework_if.h.
+#include <native_service/ns_timer_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_logger_if.h>
+#include <map>
+#include <string>
+#include <vector>
+///////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Dispatcher functions
+////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachCallbacksToDispatcher
+/// \~english @par Brief
+/// API to register multiple Callback-informations to the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to the service name
+/// \~english @param [in] pMsgHandler
+/// FrameworkunifiedProtocolCallbackHandler* - Pointer to the Message Handler structure
+/// \~english @param [in] uiHandlerCount
+/// UI_32 - Message Handler count(1 to 4294967295)
+/// \~english @param [in] hSession
+/// HANDLE - Session handle (Default:NULL)
+/// \~english @par
+/// FrameworkunifiedProtocolCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedProtocolCallbackHandler
+/// {
+/// /* Command ID/request ID/approval ID of protocol on the service */
+/// UI_32 iCmd;
+/// /* Pointer to Callback function that would be called on receiving iCmd from pServiceName. */
+/// CbFuncPtr callBack;
+/// }FrameworkunifiedProtocolCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(pServiceName) is NULL to the service name specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Message Handler number specified in the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// - NULL Callback function pointer of the Message Handler structure specified by the argument.
+/// [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Register multiple Callback-informations(iCmd,CbFuncPtr) of the service that has been specified by the argument
+/// \n
+/// to the Dispatcher.\n
+/// Thus, if the iCmd is requested from the service, so the appropriate Callback function is called. \n
+/// When multiple registration, if an error occurs in the second and subsequent, becomes effective only \n
+/// information that has been registered so far. \n
+/// For number of upper limit of the registration possible message handler, depending on \n
+/// the securable size as the area of the message handler structure. Therefore, note to ensure \n
+/// the size of the area of the message handler structure at the call side of API, and define \n
+/// the number of message handler.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the handle (hSession) for the session specified by the arguments is not appropriate (disabled),
+/// the system assumes that the session ID = MAX_SESSION_ID_VAL(0xFFFF) is specified.\n
+/// - It is not possible to register more than one callback with the same command ID (iCmd) for the same service/session ID,
+/// and the callback function will win.
+/// - Operatio is not guaranteed if the number of elements of the array indicated by the address of the pointer (pMsgHandler)
+/// to the message handler structure does not match the number of arrays specified by the number of
+/// party-specified message hadlers (uiHandlerCount).
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbacksToDispatcher(HANDLE hApp, PCSTR pServiceName,
+ const FrameworkunifiedProtocolCallbackHandler *pMsgHandler,
+ UI_32 uiHandlerCount, HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachCallbackToDispatcher
+/// \~english @par Brief
+/// API to register a Callback-information to the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to the service name
+/// \~english @param [in] iCmd
+/// UI_32 - Command ID/request ID/approval ID of protocol on the service
+/// \~english @param [in] fpOnCmd
+/// CbFuncPtr - Pointer to Callback function that would be called on receiving iCmd from pServiceName.
+/// \~english @param [in] hSession
+/// HANDLE - Session handle (Default:NULL)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(pServiceName) is NULL to the service name specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Pointer (fpOnCmd) is NULL to the Callback function specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Register a Callback-information(iCmd,CbFuncPtr) of the service that has been specified by the argument \n
+/// to the Dispatcher.\n
+/// Thus, if the iCmd is requested from the service, so the appropriate Callback function is called.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the handle (hSession) for the session specified by the arguments is not appropriate (disabled),
+/// the system assumes that the session ID = MAX_SESSION_ID_VAL(0xFFFF) is specified.
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbackToDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, CbFuncPtr fpOnCmd,
+ HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachCallbacksToDispatcherWithFd
+/// \~english @par Brief
+/// API to register multiple Callback and file descriptor set to the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] handlers
+/// FrameworkunifiedFdProtocolCallbackHandler* - Pointer to the Message Handler structure to be registered
+/// \~english @param [in] handlerCount
+/// UI_32 - Message Handler Count(1 to 4294967295)
+/// \~english @par
+/// FrameworkunifiedFdProtocolCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedFdProtocolCallbackHandler
+/// {
+/// int fd; /* File descriptor for message waiting control */
+/// CbFuncPtr callBack; /* Pointer to Callback function */
+/// }FrameworkunifiedFdProtocolCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer (handlers) to the Message Handler structure of the registration object specified in the argument is
+/// NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Message Handler number of registered specified by the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor in the Message Handler structure(FrameworkunifiedFdProtocolCallbackHandler) specified in the argument is
+/// incorrect(If fd is less than or equal to 0). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(fpOnCmd) to the Callback function in the Message Handler structure(FrameworkunifiedFdProtocolCallbackHandler)
+/// specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor specified in the argument is incorrect(If fd is less than or equal to 0).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Pointer (fpOnCmd) is NULL to the Callback function specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Monitoring file descriptor for epoll managed by the HANDLE(hApp) specified in the argument is not
+/// appropriate. [eFrameworkunifiedStatusFail]
+/// - File descriptor in the Message Handler structure(FrameworkunifiedFdProtocolCallbackHandler) specified in the argument is
+/// already registered to the monitoring control(epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - It failed to add the file descriptor of the message waiting control to the monitoring of epoll_ctl().
+/// [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Register multiple callbacks that link to file descriptor that has been specified by the argument to
+/// the Dispatcher.\n
+/// For epoll_ctl() of Dispatcher, add multiple file descriptor for the specified message waiting control \n
+/// by the argument.\n
+/// Thus, for the file descriptor registered in the message waiting control, when receiving a message, \n
+/// so the appropriate Callback function is called. \n
+/// When multiple registration, if an error occurs in the second and subsequent, becomes effective only \n
+/// information that has been registered so far. \n
+/// For number of upper limit of the registration possible message handler, depending on \n
+/// the securable size as the area of the message handler structure. Therefore, note to ensure \n
+/// the size of the area of the message handler structure at the call side of API, and define \n
+/// the number of message handler.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - The operation cannot be guaranteed if the number of elements of the array entity indicated by the address of the pointer (handlers)
+/// to the message handler structure to be registered does not match the number of arrays specified in the number of message handlers o be registered (handlerCount).\n
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcherWithFd, FrameworkunifiedDetachCallbackFromDispatcherWithFd,
+/// FrameworkunifiedDetachCallbacksFromDispatcherWithFd
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbacksToDispatcherWithFd(HANDLE hApp, const FrameworkunifiedFdProtocolCallbackHandler *handlers,
+ UI_32 handlerCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachCallbackToDispatcherWithFd
+/// \~english @par Brief
+/// API to register a callback that link to a single file descriptor to the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] fd
+/// int - File descriptor for message waiting control
+/// \~english @param [in] fpOnCmd
+/// CbFuncPtr - Pointer to Callback function
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor specified in the argument is incorrect(If fd is less than or equal to 0).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Pointer (fpOnCmd) is NULL to the Callback function specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Monitoring file descriptor for epoll managed by the HANDLE(hApp) specified in the argument is not
+/// appropriate. [eFrameworkunifiedStatusFail]
+/// - File descriptor(fd) specified in the argument is already registered to the monitoring control(epoll_ctl).
+/// [eFrameworkunifiedStatusFail]
+/// - It failed to add the file descriptor(fd) of the message waiting control to the monitoring of epoll_ctl().
+/// [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Register a callback that link to a file descriptor that has been specified by the argument to
+/// the Dispatcher.\n
+/// For epoll_ctl() of Dispatcher, add a file descriptor(fd) for the specified message waiting control \n
+/// by the argument.\n
+/// Thus, for the file descriptor registered in the message waiting control, when receiving a message, \n
+/// so the appropriate Callback function is called.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedDetachCallbackFromDispatcherWithFd,
+/// FrameworkunifiedDetachCallbacksFromDispatcherWithFd
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbackToDispatcherWithFd(HANDLE hApp, int fd, CbFuncPtr fpOnCmd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachParentCallbacksToDispatcher
+/// \~english @par Brief
+/// API to register multiple callback information for the parent thread to the Dispatcher.
+/// \~english @param [in] hChildApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pMsgHandler
+/// FrameworkunifiedProtocolCallbackHandler* - Pointer to the Message Handler structure
+/// \~english @param [in] uiHandlerCount
+/// UI_32 - Message Handler count(1 to 4294967295)
+/// \~english @par
+/// FrameworkunifiedProtocolCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedProtocolCallbackHandler
+/// {
+/// /* Command ID/request ID/approval ID of protocol on the service */
+/// UI_32 iCmd;
+/// /* Pointer to Callback function that would be called on receiving iCmd from pServiceName. */
+/// CbFuncPtr callBack;
+/// }FrameworkunifiedProtocolCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE(hApp) specified in the argument is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Parent service name in the HANDLE(hApp) specified in the argument is NULL . [eFrameworkunifiedStatusInvldParam]
+/// - Message Handler number specified in the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// - NULL Callback function pointer of the Message Handler structure specified by the argument.
+/// [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Register multiple Callback-informations(iCmd,CbFuncPtr) to the Dispatcher to process \n
+/// the message from the parent thread. \n
+/// Thus, if the iCmd is requested from the parent service(application), so the appropriate \n
+/// Callback function is called. \n
+/// When multiple registration, if an error occurs in the second and subsequent, becomes \n
+/// effective only information that has been registered so far.\n
+/// For number of upper limit of the registration possible message handler, depending on \n
+/// the securable size as the area of the message handler structure. Therefore, note to ensure \n
+/// the size of the area of the message handler structure at the call side of API, and define \n
+/// the number of message handler.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation is not guaranteed if the number of elements of the array indicated by the address of the pointer (pMsgHandler)
+/// to the message handler structure does not match the number of arrays specified by the number of
+/// party-specified message hadlers (uiHandlerCount).
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachParentCallbacksToDispatcher(HANDLE hChildApp, const FrameworkunifiedProtocolCallbackHandler *pMsgHandler,
+ UI_32 uiHandlerCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachCallbacksFromDispatcher
+/// \~english @par Brief
+/// API to cancel multiple Callback-informations from the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to the service name
+/// \~english @param [in] puiCmdArray
+/// PUI_32 - Pointer to Command ID/request ID/approval ID of protocol on the service
+/// \~english @param [in] uiCommandCount
+/// UI_32 - Cancel handler count
+/// \~english @param [in] hSession
+/// HANDLE - Session handle (Default:NULL)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(pServiceName) is NULL to the service name specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(puiCmdArray) to cancel target ID specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - The number(uiCommandCount) of handlers to cancel specified by the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// - Specified service (ServiceName) in the argument is not present. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel a Callback-information(iCmd,CbFuncPtr) of the service that has been specified by the argument \n
+/// from the Dispatcher.\n
+/// Thus, if the iCmd is requested from the service, so the appropriate Callback function is not called. \n
+/// If you have already specified the iCmd of revocation has been subject, to return the eFrameworkunifiedStatusOK.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the iCmad to be canceled is specified, the eFrameworkunifiedStatusOK is returned.
+/// - Event if an error occurs during deletion of two or more iCmd, the subsequent iCmd is deleted.
+/// - If a iCmd larger than the iCmd array is specified eFrameworkunifiedStatusOK is returned and all iCmd is deleted.\n
+/// - If the hade (hSession) for the session specified by the arguments is not appropriate (disabled),
+/// the system assumes that the session ID = MAX_SESSION_ID_VAL(0xFFFF) is specified.\n
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedDetachCallbackFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbacksFromDispatcher(HANDLE hApp, PCSTR pServiceName, const PUI_32 puiCmdArray,
+ UI_32 uiCommandCount, HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachCallbackFromDispatcher
+/// \~english @par Brief
+/// API to cancel a Callback-information from the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to the service name
+/// \~english @param [in] iCmd
+/// UI_32 - Command ID/request ID/approval ID of protocol on the service
+/// \~english @param [in] hSession
+/// HANDLE - Session handle (Default:NULL)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(pServiceName) is NULL to the service name specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Specified service (ServiceName) in the argument is not present. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel a Callback-information(iCmd,CbFuncPtr) of the service that has been specified by the argument \n
+/// from the Dispatcher.\n
+/// Thus, if the iCmd is requested from the service, so the appropriate Callback function is not called. \n
+/// If you have already specified the cancellation has been the subject or unregistered iCmd, to return \n
+/// the eFrameworkunifiedStatusOK.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the handle (hSession) for the session specified by the arguments is not appropriate (disabled),
+/// the system assumes that the session ID = MAX_SESSION_ID_VAL(0xFFFF) is specified.\n
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbackFromDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachCallbacksFromDispatcherWithFd
+/// \~english @par Brief
+/// API to cancel multiple Callback and file descriptor set from the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] fdArray
+/// int* - Pointer to cancel the target file descriptor array
+/// \~english @param [in] handlerCount
+/// UI_32 - Handler count of cancellation
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(fdArray) is NULL to cancel the target file descriptor array specified in the argument.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Handler count(handlerCount) of canceled specified by the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor of the file descriptor in the array(fdArray) specified by the argument is incorrect(If fd is
+/// less than or equal to 0). [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor in the file descriptor array(fdArray) specified in the argument is already deleted from the
+/// management table, and can not search. [eFrameworkunifiedStatusFail]
+/// - There is no file descriptor management table of the specified HANDLE(hApp) in argument. [eFrameworkunifiedStatusFail]
+/// - Monitoring file descriptor for epoll managed by the HANDLE(hApp) specified in the argument is not
+/// appropriate. [eFrameworkunifiedStatusFail]
+/// - It failed to delete the file descriptor(fd) of the message waiting control from the monitoring of
+/// epoll_ctl(). [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel Callback and file descriptor set that has been specified by the argument from the Dispatcher.\n
+/// For epoll_ctl() of Dispatcher, delete multiple file descriptor for the specified message waiting control \n
+/// by the argument.\n
+/// Thus, for the file descriptor became cancellation target, when receiving the message, the appropriate \n
+/// Callback function is not called.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation cannot be guaranteed if the number of elements of the array specified by the address of the pointer
+/// to the file descriptor array to be canceled (fdArray) does not match the number of arrays specified by the number of
+/// file descriptors to be canceled (uiCommandCount).
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackFromDispatcherWithFd,
+/// FrameworkunifiedDetachCallbackFromDispatcherWithFd
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbacksFromDispatcherWithFd(HANDLE hApp, const int *fdArray, UI_32 uiCommandCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachCallbackFromDispatcherWithFd
+/// \~english @par Brief
+/// API to cancel a Callback and file descriptor from the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] fd
+/// int - Cancel the target file descriptor
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE(hApp) specified in the argument is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor(fd) specified in the argument is incorrect(If fd is less than or equal to 0).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor specified in the argument is already deleted from the management table, and can not search.
+/// [eFrameworkunifiedStatusFail]
+/// - There is no file descriptor management table of the specified HANDLE(hApp) in argument. [eFrameworkunifiedStatusFail]
+/// - Monitoring file descriptor for epoll managed by the HANDLE(hApp) specified in the argument is not
+/// appropriate. [eFrameworkunifiedStatusFail]
+/// - It failed to delete the file descriptor(fd) of the message waiting control from the monitoring of
+/// epoll_ctl(). [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel a Callback and file descriptor that has been specified by the argument from the Dispatcher.\n
+/// For epoll_ctl() of Dispatcher, delete a file descriptor(fd) for the specified message waiting control \n
+/// by the argument.\n
+/// Thus, for the file descriptor became cancellation target, when receiving the message, the appropriate \n
+/// Callback function is not called.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackFromDispatcherWithFd,
+/// FrameworkunifiedDetachCallbacksFromDispatcherWithFd
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbackFromDispatcherWithFd(HANDLE hApp, int fd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachParentCallbacksFromDispatcher
+/// \~english @par Brief
+/// API to cancel the multiple of Callback information for the parent thread from Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] puiCmdArray
+/// PUI_32 - Pointer to an array of command/request on the service protocol
+/// \~english @param [in] uiCommandCount
+/// UI_32 - Handler count of cancellation
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE(hApp) specified in the argument is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(puiCmdArray) to an array of command/request that you specified in the argument is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Handler count(uiCommandCount) of canceled specified by the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Parent service name in the HANDLE(hApp) specified in the argument is NULL . [eFrameworkunifiedStatusInvldParam]
+/// - There is no parent service of the target in the HANDLE(hApp) specified in the argument. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel multiple Callback-informations(iCmd,CbFuncPtr) from the Dispatcher to process \n
+/// the message from the parent thread. \n
+/// Thus, if iCmd has been requested from the parent service (application), the corresponding \n
+/// Callback function is no longer referred to. \n
+/// If you have already specified the iCmd of revocation has been subject, to return the eFrameworkunifiedStatusOK.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation cannot be guaranteed if the number of elements of the array specified by the address of the pointer (puiCmdArray)
+/// to the array of commands/requests on the service protocol does not match the number of arrays specified by the number of hadles to cancel (uiCommandCount).
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachParentCallbacksFromDispatcher(HANDLE hApp, const PUI_32 puiCmdArray, UI_32 uiCommandCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachServiceFromDispatcher
+/// \~english @par Brief
+/// Disconnect the service from Dispatcher, and API to cancel all the associated callbacks.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to the service name
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE(hApp) specified in the argument is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer (pServiceName) to the service name specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Information corresponding to the service name(pServiceName) specified in the argument is not registered in
+/// Dispatcher. [eFrameworkunifiedStatusFail]
+/// - Callback information(Event information) of the service name(pServiceName) specified in the argument is not
+/// registered. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel the entry of service information from Dispatcher, and cancel all callback \n
+/// information(event information) related to the service.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Service registration available/API processing when an event is registered:delete service, delete event, return eFrameworkunifiedStatusOK
+/// - Service registration available/API processing when an event is registered:delete service, return eFrameworkunifiedStatusOK
+/// - Service registration available/API processing when an event is registered:delete event, return eFrameworkunifiedStatusOK
+/// - Service registration available/API processing when an event is registered:nothing, return eFrameworkunifiedStatusFail
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedAttachParentCallbacksToDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachServiceFromDispatcher(HANDLE hApp, PCSTR pServiceName);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSubscribeNotificationsWithCallback
+/// \~english @par Brief
+/// API to send a message to the notification service in order to register multiple Notification of list format.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pNtfyHandler
+/// FrameworkunifiedNotificationCallbackHandler - Pointer to a structure of the Notification Handler
+/// \~english @param [in] uiHandlerCount
+/// UI_32 - Notification Handler number
+/// \~english @par
+/// FrameworkunifiedNotificationCallbackHandler Structure
+/// \~english @code
+/// #define MAX_STRING_SIZE_NOTIFICATION 64
+/// typedef struct _FrameworkunifiedNotificationCallbackHandler
+/// {
+/// CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION]; /* Notification Name */
+/// CbFuncPtr callBack; /* Callback function pointer */
+/// }FrameworkunifiedNotificationCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded the maximum number of
+/// Notification. [eFrameworkunifiedStatusFail]
+/// - The acquisition of the buffer for storing a plurality of information of Notification Handler specified by
+/// the argument has failed. [eFrameworkunifiedStatusInvldParam]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// The Callback information of multiple Notification upon receipt that is specified in the form of a list, \n
+/// set to the notification service (NS_NPPService). \n
+/// In addition, collectively set the Callback information at the time of multiple Notification received that \n
+/// have been specified in the list format to Dispatcher.\n
+/// When the notification service receives the public message of the Notification, it sends a NPS_NOTIFY_EV_REQ \n
+/// message to the client that has registered the Notification. The client having received the NPS_NOTIFY_EV_REQ
+/// \n
+/// message, based on the Callback information registered in the Dispatcher, call a Callback corresponding to the
+/// \n
+/// Notification.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation is not guaranteed if the number of elemets of the array entity indicated by the address of the pointer (pNtfyHandler)
+/// to the Notification Handler structure does not match the number of arrays specified by the Notification Handler number (uiHandlerCount).
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationsWithCallback(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pNtfyHandler,
+ UI_32 uiHandlerCount);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSubscribeNotificationWithCallback
+/// \~english @par Brief
+/// API to set the Callback information at the time of Notification received Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @param [in] pNotification
+/// PCSTR - Notification String.
+/// \param [in] fpOnCmd
+/// CbFuncPtr - Callback function that will be called on receiving pNotification.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNotification) is NULL to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - CbFuncPtr specified in the argument (fpOnCmd) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Can not add HANDLE specified in the argument (hApp) and CbFuncPtr specified in the argument (fpOnCmd) to
+/// notification list [eFrameworkunifiedStatusDuplicate]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Notification name specified by the argument has already been registered in the Dispatcher.
+/// [eFrameworkunifiedStatusDuplicate]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// The Callback information at the time of Notification received that has been specified by the argument, \n
+/// set in the notification service (NS_NPPService).\n
+/// Also, it sets the Callback information at the time of Notification received that has been specified by \n
+/// the argument to the Dispatcher.\n
+/// When the notification service receives the public message of the Notification, it sends a NPS_NOTIFY_EV_REQ \n
+/// message to the client that has registered the Notification. The client having received the NPS_NOTIFY_EV_REQ
+/// \n
+/// message, based on the Callback information registered in the Dispatcher, call a Callback corresponding to the
+/// \n
+/// Notification.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback, FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationWithCallback(HANDLE hApp, PCSTR pNotification, CbFuncPtr fpOnCmd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnsubscribeNotificationsWithCallback
+/// \~english @par Brief
+/// API to bulk delete the Callback information at the time of multiple Notification received from the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pNtfyHandler
+/// FrameworkunifiedNotificationCallbackHandler - Pointer to a structure of the Notification Handler
+/// \~english @param [in] uiHandlerCount
+/// UI_32 - Notification Handler number
+/// \~english @par
+/// FrameworkunifiedNotificationCallbackHandler Structure
+/// \~english @code
+/// #define MAX_STRING_SIZE_NOTIFICATION 64
+/// typedef struct _FrameworkunifiedNotificationCallbackHandler
+/// {
+/// CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION]; /* Notification Name */
+/// CbFuncPtr callBack; /* Callback function pointer */
+/// }FrameworkunifiedNotificationCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded the maximum number of
+/// Notification. [eFrameworkunifiedStatusFail]
+/// - In Notification name in the structure of the Notification Handler specified in the argument, there is not
+/// applicable in those registered as Callback information. [eFrameworkunifiedStatusFail]
+/// - The acquisition of the buffer for storing a plurality of information of Notification Handler specified by
+/// the argument has failed. [eFrameworkunifiedStatusInvldParam]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// The Callback information of multiple Notification upon receipt that is specified in the form of a list, \n
+/// collectively removed from the notification service (NS_NPPService). \n
+/// In addition, the bulk delete the Callback information at the time of multiple Notification received that \n
+/// are specified in the form of a list from the Dispatcher.\n
+/// By bulk delete the Callback information, if the notification services receives the public message
+/// Notification, \n
+/// because the Notification information applicable also been deleted, Callback does not occur.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPRegisterNotifications,
+/// FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationsWithCallback(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pNtfyHandler,
+ UI_32 uiHandlerCount);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnsubscribeNotificationWithCallback
+/// \~english @par Brief
+/// API to detach a notification callback from the dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @param [in] pNotification
+/// PCSTR - Notification String.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNotification) is NULL to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - Length of pointer (pNotification) is 0 to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Missing HANDLE specified in the argument (hApp) in notification list [eFrameworkunifiedStatusFail]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// The Callback information at the time of Notification received that has been specified by the argument, \n
+/// to remove from the notification service (NS_NPPService).\n
+/// Also, delete the Callback information of Notification upon receipt, which is specified by the argument \n
+/// from the Dispatcher.
+/// By bulk delete the Callback information, if the notification services receives the public message
+/// Notification, \n
+/// because the Notification information applicable also been deleted, Callback does not occur.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPRegisterNotifications,
+/// FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationWithCallback(HANDLE hApp, PCSTR pNotification);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetAppName
+/// \~english @par Brief
+/// Get the application thread name that is registered with the dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval PCSTR Pointer to application thread name
+/// \~english @retval NULL NULL pointer (Failed to get application name)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// \~english @par Detail
+/// Get the application thread name that was registered at initialization of dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedDispatcherWithArguments, FrameworkunifiedDispatcher, FrameworkunifiedCreateDispatcherWithoutLoop
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetAppName(HANDLE hApp);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetThreadSpecificData
+/// \~english @par Brief
+/// Set pointer to the application-specific data to the application HANDLE.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] data
+/// PVOID - Pointer to the application-specific data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// This API sets application-specific data to internal pointer inside application framwork HANDLE.\n
+/// You can share data in callback function or thread.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedGetThreadSpecificData
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetThreadSpecificData(HANDLE hApp, PVOID data);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetThreadSpecificData
+/// \~english @par Brief
+/// Get pointer to the application-specific data from the application HANDLE.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @retval PVOID pointer to application-specific data.
+/// \~english @retval NULL NULL pointer(failed to get data)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// \~english @par Detail
+/// This API gets application-specific data that set with FrameworkunifiedSetThreadSpecificData from internal pointer inside
+/// application framwork HANDLE.\n
+/// You can share data in callback function or thread.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedSetThreadSpecificData
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID FrameworkunifiedGetThreadSpecificData(HANDLE hApp);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOpenService
+/// \~english @par Brief
+/// API to acquire a service HANDLE.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to service name
+/// \~english @retval HANDLE Handle to the service
+/// \~english @retval NULL NULL pointer (Failed to get service handle)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// - Only when will open the session by FrameworkunifiedOpenSession, you can use the handle obtained by this API.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Service name specified in the argument (pServiceName) is NULL. [NULL]
+/// - Service name specified in the argument (pServiceName) is not appropriate (NULL, over 20byte). [NULL]
+/// - Normalized service name for message queue is not appropriate (over 15byte). [NULL]
+/// - Can not be acquired memory for message queue infomation(malloc). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Detail
+/// Create a communication resource for communicating with the specified service , return the HANDLE.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedCloseService, FrameworkunifiedOpenSession
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedOpenService(HANDLE hApp, PCSTR pServiceName);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCloseService
+/// \~english @par Brief
+/// API to close service HANDLE.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService HANDLE acquired in)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hService) is mismatch.(eQTypeSender or
+/// eQTypeReveiver) [eFrameworkunifiedStatusInvldHndlType]
+/// - Failed to close message queue specified in the argument (hService). [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// This API closes service HANDLE specified by argument.\n
+/// And close message queue of the service.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenService
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseService(HANDLE hApp, HANDLE hService);
+
+//////////////////////////////////////////////////
+// message center functions
+//////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedMcOpenSender
+/// \~english @par Brief
+/// Generate a handle to the message queue for sending.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [in] pName
+/// PCSTR - Message queue name of destination service
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (pName) is NULL. [NULL]
+/// - Message queue name specified in the argument (pName) is not appropriate (NULL, over 20byte). [NULL]
+/// - Normalized message queue name is not appropriate (over 15byte). [NULL]
+/// - Can not be acquired memory for message queue infomation(malloc). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Detail
+/// This API generates and returns a handle to the message queue for sending of service.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedMcClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedMcOpenSender(HANDLE hApp, PCSTR pName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedMcClose
+/// \~english @par Brief
+/// API for closing a message queue handle
+/// \~english @param [in] hService
+/// HANDLE - Handle for services (handle obtained by FrameworkunifiedMcOpenSender)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hService specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hService specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle in the handle (hService) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hService) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the message queue types of the handles (hService) specified in the arguments do not match, [eFrameworkunifiedStatusInvldHandle]
+/// - Closing the message queue for the handle (hService) specified in the arguments fails, [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Closes the message queue for the specified service.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedMcOpenSender
+///
+/// To close message queue handle to a service
+///
+/// \param [in] hService
+/// HANDLE - Handle to a service
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedMcClose(HANDLE hService);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendMsg
+/// \~english @par Brief
+/// Asynchronous API that sends messages to the service
+/// \~english @param [in] hService
+/// HANDLE - Handle for services (handle acquired by FrameworkunifiedMcOpenSender, etc.)
+/// \~english @param [in] uiCmd
+/// UI_32 - Command ID, Request ID, and Authorization ID on the service's protocol
+/// \~english @param [in] uiLength
+/// UI_32 - Data size to be sent (0 to 4294967255)
+/// \~english @param [in] pData
+/// PCVOID - Pointer to the data to send
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Handles for services must be acquired (FrameworkunifiedMcOpenSender, etc.).
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hService specified in the arguments is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - If the hService specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue name of the handle (hService) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue of the handle (hService) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle in the handle (hService) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hService) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the send data (pData) specified in the parameter is NULL and the data length (uiLength) is not 0, [eFrameworkunifiedStatusInvldBuf]
+/// - When the name of the message queue handle in the handle (hService) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldQName]
+/// - If the name of the message queue handle (hService) specified in the argument exceeds 20 bytes, [eFrameworkunifiedStatusInvldQName]
+/// - When the message queue type of the handle (hService) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sessions for services is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for sessions intended for the service [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for services [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for the services [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages for sessions for services [eFrameworkunifiedStatusErrOther]
+/// - When the size (uiLength) of the data to be sent specified in the parameter is out of range, [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Messages are sent to the service using the message queue associated with the service handle.\n
+/// A destination is a service specified as arguments such as FrameworkunifiedMcOpenSender when a service handle was created.\n
+/// This API operates asynchronously.
+/// \~english @par
+/// - The consistency between the size of the data to be sent and the size of the area indicated by the pointer to the data to be sent is ensure by the caller.
+/// - The maximum data size (uiLength) described above is a theoretical value. The maximum data size that can be actually used depends on the environment requirements.\n
+/// The maximum value is the upper limit of the type (UINT_MAX) minus the following size.\n
+/// Message header section\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method
+/// \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedOpenService
+///
+/// Send message to the service.
+///
+/// \param [in] hService
+/// HANDLE - Handle to the service.
+/// \param [in] uiCmd
+/// UI_32 - Protocol message id.
+/// \param [in] uiLength
+/// UI_32 - Length of the data to be send.
+/// \param [in] pData
+/// PVOID - Pointer to the data.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendMsg(HANDLE hService, UI_32 uiCmd, UI_32 uiLength, PCVOID pData);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendPriorityMsg
+/// Send message to a service. It places your message at the top of the services message queue.
+/// \b Applications should not use this unless absolutely required - use cases must be reviewed by
+/// \b Framework Team.
+///
+/// \param [in] hService
+/// HANDLE - Handle to the service.
+/// \param [in] uiCmd
+/// UI_32 - Protocol message id.
+/// \param [in] uiLength
+/// UI_32 - Length of the data to be send.
+/// \param [in] pData
+/// PVOID - Pointer to the data.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendPriorityMsg(HANDLE hService, UI_32 uiCmd, UI_32 uiLength, PCVOID pData);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendSelf
+/// \~english @par Brief
+/// Asynchronous APIs that send messages to the application's own Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] iCmd
+/// UI_32 - Command ID, Request ID, and Authorization ID on the service's protocol
+/// \~english @param [in] length
+/// UI_32 - Data size to be sent (0 to 4294967255)
+/// \~english @param [in] data
+/// PCVOID - Pointer to the data to send
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hService specified in the arguments is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - If the hService specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle for the own Dispatcher in the handle (hService) specified by the arguments is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - Invalid message queue handle for its own Dispatcher in the handle (hService) specified by the arguments [eFrameworkunifiedStatusInvldHandle]
+/// - When the send data (data) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldBuf]
+/// - When the service name of the handle (hService) specified in the arguments is not appropriate (when the service name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue handle for the own Dispatcher in the handle (hService) specified in the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - Failed to access shared memory for sending messages for its own Dispatcher [eFrameworkunifiedStatusErrOther]
+/// - When the message queue type for the own Dispatcher of the handle (hService) specified in the parameter is not the send type [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue for your Dispatcher is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for own Dispatcher [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending messages for the Dispatcher itself [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for your Dispatcher [eFrameworkunifiedStatusFail]
+/// - When the size (length) of the data to be sent specified in the parameter is out of range, [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Send messages to the application's own Dispatcher.\n
+/// This API operates asynchronously.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - The maximum data size (length) described above is a theoretical value. The maximum data size that can be actually used depends on the environment requirements.\n
+/// The maximum value is the upper limit of the type (UINT_MAX) minus the following size.\n
+/// Message header section\n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address of the pointer (data) to the data buffer does not match the size specified by the size of the data buffer (length).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method
+/// \~english @see FrameworkunifiedSendMsg
+///
+/// Send message to the hApp.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the dispatcher to receive message
+/// \param [in] iCmd
+/// UI_32 - Protocol message id.
+/// \param [in] length
+/// UI_32 - Length of the data to be send.
+/// \param [in] data
+/// PVOID - Pointer to the data.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendSelf(HANDLE hApp, UI_32 iCmd, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedInvokeSync
+/// \~english @par Brief
+/// API for synchronous communication of the message.
+/// \~english @param [in] hService
+/// HANDLE - Handle for the message queue
+/// \~english @param [in] iCmd
+/// UI_32 - Command ID
+/// \~english @param [in] msgLenght
+/// UI_32 - Data length of the send message
+/// \~english @param [in] msgData
+/// PCVOID - Pointer to send the message
+/// \~english @param [in] responseLength
+/// UI_32 - Size of the received message storage buffer
+/// \~english @param [out] responseData
+/// PVOID - Pointer to the received message storage buffer
+/// \~english @param [out] receivedLength
+/// UI_32 * - Data length of the received message
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// - Handles for message queue must be acquired (FrameworkunifiedMcOpenSender, etc.).
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hService) specified in the argument is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE(hService) specified in the argument is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - It failed to open the message queue for the response received [eFrameworkunifiedStatusFail]
+/// - Send message queue HANDLE in HANDLE(hService) specified in the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Send message queue HANDLE in HANDLE(hService) specified in the argument is not appropriate (which is
+/// invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE for the response received is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE for the response received is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - The size of the received message storage buffer specified by the argument is not 0, and the pointer is NULL
+/// to the received message storage buffer. [eFrameworkunifiedStatusInvldHandle]
+/// - It fails to get the message storage buffer for the response received. [eFrameworkunifiedStatusFail]
+/// - Random number generation to fail for the sequence ID of the message for transmission. [eFrameworkunifiedStatusFail]
+/// - Message queue name of HANDLE(hService) specified in the argument is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue name of HANDLE(hService) specified in the argument exceeds 20byte. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE(hService) specified in the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE(hService) specified in the argument exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE(hService) specified in the argument is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmit and receive file descriptor of the session message. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) occurs during the transmission and reception of the session
+/// message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the sending and receiving of a session message. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// - It failed to Socket connection of the response message for the reception. [eFrameworkunifiedStatusFail]
+/// - The wait control of the response message received failed. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) to wait in the response message received has occurred.
+/// [eFrameworkunifiedStatusFail]
+/// - In response message at the time of failure to receive, it failed to re-connection of the Socket.
+/// [eFrameworkunifiedStatusBadConnection]
+/// \~english @par Detail
+/// Under the following procedure, perform synchronous communication of the message.
+/// - During the first call, it generates a message queue name for the response message received by the
+/// McCreateInvokerName(),
+/// and to open the message queue for the response message received by the McOpenSyncReceiver ().
+/// - By the McInvokeSync(), perform synchronous communication of the message.
+/// \~english @par
+/// If the received response message is greater than the storage buffer, to store up to store buffer length.\n
+/// The user is able to detect an abnormality by comparing store buffer length and a received message length.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedSendMsg
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedInvokeSync(HANDLE hService, UI_32 iCmd, UI_32 msgLenght, PCVOID msgData, UI_32 responseLength,
+ PVOID responseData, UI_32 *receivedLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetSyncResponseData
+/// \~english @par Brief
+/// API to set the response data of the synchronization communication.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [in] data
+/// PVOID - Pointer to the response data
+/// \~english @param [in] size
+/// UI_32 - The response data size
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE(hApp) specified in the argument is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - Pointer to the response data(data) specified in the argument is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - If the size (size) of the response data specified in the arguments cannot be allocated, [eFrameworkunifiedStatusFail]
+/// - When the response data size (size) specified in the parameter is out of range, [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Store the response data specified in the storage area of the response data \n
+/// in the handle specified by the argument.
+/// \~english @par
+/// Response data set by this PROCESS is automatically sent by the Dispatcher after the callback function completes execution, so the API does not need to send the response data.
+/// \~english @par
+/// - The response data is registered to the heap.
+/// - If the pointer (data) to the response data is normal (not NULL) and 0 is specified for the size (size) of the response data, the response data is set to empty.
+/// - The maximum size (size) of the response data described above is a theoretical value. The maximum size that can be used is environment-dependent.\n
+/// The maximum value is the upper limit of the type (UINT_MAX) minus the following size.\n
+/// Message header section and response message header section\n
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedInvokeSync
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetSyncResponseData(HANDLE hApp, PVOID data, UI_32 size);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetMsgLength
+/// \~english @par Brief
+/// API to retrieve the data length of the received message.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval UI_32 The data length of the received message
+/// \~english @retval 0 Error or No data
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [0]
+/// - HANDLE(hApp) specified in the argument is not appropriate (which is invalid). [0]
+/// \~english @par Detail
+/// To return the data length of the received messages in the handle(hApp) \n
+/// that you specified in the argument as a return value. \n
+/// It is possible to get by to use when the message was received. \n
+/// If the return value is 0, there is a need for caution because of either \n
+/// error or no data.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgLength(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetMsgProtocol
+/// \~english @par Brief
+/// API to get the Command ID/Request ID/Approval ID on the protocol.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval UI_32 Command ID/Request ID/Approval ID
+/// \~english @retval 0 Error
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [0]
+/// - HANDLE(hApp) specified in the argument is not appropriate (which is invalid). [0]
+/// \~english @par Detail
+/// To return the Command ID/Request ID/Approval ID that are within \n
+/// the handle(hApp) specified in the argument as a return value.
+/// \~english @par
+/// The application shall execute this API using an application handle passed as an argument to the callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp),
+/// and then executed by the application callback functions.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgProtocol(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetMsgDataOfSize
+/// \~english @par Brief
+/// API to get the data of the received message
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [out] pData
+/// PVOID - Pointer to the buffer where the received message data will be copied
+/// \~english @param [in] uiSize
+/// UI_32 - Size of the buffer to which received message data is copied
+/// \~english @param [in] eRetrieveMethod
+/// ESMRetrieveTypes - Shared memory-acquisition-type (optional; eSMRRelease if not specified)
+/// \~english @par
+/// enum ESMRetrieveTypes variables
+/// - eSMRRelease = 0 : The shared memory data is deleted after acquisition.
+/// - eSMRRetain = 1 : Shared memory data is maintained.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the data size is larger than the buffer size (uiSize) specified by the parameter, [eFrameworkunifiedStatusInvldBufSize]
+/// - If the buffer (pData) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldBuf]
+/// - Incoming messages are incorrect [eFrameworkunifiedStatusInvldHndlType]
+/// - If the shared memory ID specified in the received message is invalid [FrameworkunifiedStatusErrOther]
+/// - If accessing shared memory (shm_open/fstat/mmap) fails [eFrameworkunifiedStatusErrOther]
+/// - If the size of the data in shared memory is larger than the buffer size (uiSize) specified by the arguments [FrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Receive message data is acquired from the receive buffer in the application handle (hApp) or the shared memory (message is stored in the shared memory when the size is 4096 bytes or more), and is stored in the area passed in the parameter pData.\n
+/// When data exists in the shared memory, the data is held or deleted in the shared memory by specifying the eRetrieveMethod of arguments of this API
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Execute this API using an application handle passed as an argument of a callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp), and then executed by the application callback functions.)
+/// - Before executing this API, the size of the received message must be checked by the FrameworkunifiedGetMsgLength to determine whether data is to be retained in the shared memory.
+/// - If it is kept in shared memory, the application must execute the FrameworkunifiedClearMsgData and delete it.
+/// - If an invalid value other than the ESMRetrieveTypes defined value is specified for the shared memory allocation type (eRetrieveMethod), the shared memory allocation type behaves as if eSMRRetain were specified.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedClearMsgData
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [out] pData
+/// PVOID - Buffer to which the received message data will be copied.
+/// \param [out] uiSize
+/// UI_32 - Size of the buffer to which the received message data will be copied.
+/// \param [in] eRetrieveMethod
+/// ESMRetrieveTypes -
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \~english @par Type
+/// Sync
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetMsgDataOfSize(HANDLE hApp, PVOID pData, UI_32 uiSize, ESMRetrieveTypes eRetrieveMethod = eSMRRelease);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetDataPointer
+/// \~english @par Brief
+/// API to get start address of data from received message
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [out] datap
+/// void** - Pointer to the data of the received message
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the receive buffer address of the handle (hApp) specified in the parameter is NULL [eFrameworkunifiedStatusInvldBufSize]
+/// - When the pointer (datap) to the data of the received message specified by the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// This function gets the received message data from the receive buffer in the application handle (hApp)
+/// and returns the start address of the received message in the argument datap.\n
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - This API can be executed for messages that do not use shared memory (messages with a message size less than 4096 bytes).
+/// Check the size of received messages in the FrameworkunifiedGetMsgLength prior to executing this API.
+/// - Since the pointers acquired by this API are part of the Dispatcher, the pointers acquired by this API must not be released by the application.
+/// - Execute this API using an application handle passed as an argument of a callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp), and then executed by the application callback functions.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgDataOfSize
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [out] datap
+/// void ** - Pointer to which the receive message data.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @par Type
+/// Sync
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetDataPointer(HANDLE hApp, void **datap);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetMsgSrc
+/// \~english @par Brief
+/// API to get the application name of the sender of the received message
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval PCSTR Name of the application from which the message was sent
+/// \~english @retval NULL NULL pointer (Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// \~english @par Detail
+/// This API returns the application name of the sender of the received message.\n
+/// The application name acquired by this API is used for establishing sessions, creating message queues for responses,
+/// and registering/releasing callbacks to the Dispatcher.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Execute this API using an application handle passed as an argument of a callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp), and then executed by the application callback functions.)
+/// - Since the pointers acquired by this API are part of the Dispatcher, the pointers acquired by this API must not be released by the application.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedOpenService, FrameworkunifiedCreateSession, FrameworkunifiedMcOpenSender, \n
+/// FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedAttachCallbacksToDispatcher, \n
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher, FrameworkunifiedDetachServiceFromDispatcher
+///
+/// Source of the message.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return pSourceName
+/// PCSTR - Source name of the message.
+/// \~english @par Type
+/// Sync
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetMsgSrc(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetLastNotification
+/// \~english @par Brief
+/// Get the most recent Notification names
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval PCSTR Pointers to Notification
+/// \~english @retval NULL NULL pointer (Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// \~english @par Detail
+/// This API acquires and returns the most recent Notification name from the received data.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Execute this API using an application handle passed as an argument of a callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp), and then executed by the application callback functions.)
+/// - Since the pointers acquired by this API are part of the Dispatcher, the pointers acquired by this API must not be released by the application.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedNPPublishNotification
+///
+/// Returns the last notification string that was received.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return pSourceName
+/// PCSTR - the last notification name that has been received.
+/// \~english @par Type
+/// Sync
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetLastNotification(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedClearMsgData
+/// \~english @par Brief
+/// API to delete shared memory used for sending and receiving messages
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval eFrameworkunifiedStatusOK Successful or Use Shared Memory Messages
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldID Invalid ID
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - Framework generating failure [eFrameworkunifiedStatusInvldParam]
+/// - If the shared memory ID specified in the message is invalid [eFrameworkunifiedStatusInvldParam]
+/// - If an attempt is made to remove a non-existent shared memory, [eFrameworkunifiedStatusInvldID]
+/// - If accessing shared memory (shm_unlink) fails, [eFrameworkunifiedStatusFail]
+/// - When the receive buffer address of the handle (hApp) specified in the parameter is NULL [eFrameworkunifiedStatusInvldBuf]
+/// \~english @par Detail
+/// This API deletes the shared memory used for sending and receiving messages.\n
+/// When an application gets received messages by specifying eSMRRetain as FrameworkunifiedGetMsgDataOfSize, it deletes the shared memories by using this API...\n
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - The shared memory information to be deleted by this API shall be executed by the application on the message receiving side because it is obtained from the received message.\n
+/// - Execute this API using an application handle passed as an argument of a callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp), and then executed by the application callback functions.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedSendMsg, FrameworkunifiedGetMsgDataOfSize
+///
+/// Explicit call to clear the data from shared memory.
+/// To be used incase of forwarding messages ???
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @par Type
+/// Sync
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedClearMsgData(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedForwardMessage
+/// Forward a message to a service or a client.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the service
+/// \param [in] hChildQ
+/// HANDLE - Handle to the child thread
+/// \param [in] iCmd
+/// UI_32 - .
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedGetSystemInfo
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedForwardMessage(HANDLE hApp, HANDLE hChildQ, UI_32 iCmd);
+
+
+
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Notification & Persistence Service
+////////////////////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPRegisterNotification
+/// \~english @par Brief
+/// To the notification service to register the Notification, API to send a message.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pNotification
+/// PCSTR - A pointer to the Notification name
+/// \~english @param [in] max_length
+/// UI_32 - The maximum length of the Notification message (64byte below)
+/// \~english @param [in] persType
+/// \~english @par
+/// EFrameworkunifiedNotificationType - Type of Notification
+/// enum EFrameworkunifiedNotificationType Variable
+/// - eFrameworkunifiedNotificationVar : Non Persistent. Not stored locally by NPS.
+/// - eFrameworkunifiedStateVar : Non Persistent. stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateVar : Not to be used. Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateUserVar : Not to be used. User specific Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedImmediatePersistedStateVar : Not to be used.
+/// - eFrameworkunifiedUnknown : Not to be used. This is not a type of notification.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNotification) is NULL to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - It is not appropriate length of the specified Notification name in argument(0, or more than a 64byte).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// To the notification service (NS_NPPService) to register the Notification, \n
+/// send a message for the Notification registration.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedNPRegisterNotifications, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback, FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterNotification(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const EFrameworkunifiedNotificationType persType);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetPersistNotfnDefaultValue
+/// API to send message to Notification Service to set the default value for the notification.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+/// \param [in] data
+/// PVOID - Set the default value for the notification.
+/// \param [in] uiLength
+/// const UI_32 - length of the data
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersistNotfnDefaultValue(HANDLE hApp, PCSTR pNotification, PVOID data, const UI_32 uiLength);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPSetPersistentNotfnType
+/// \~english @par Brief
+/// API to send message to Notification Service to set persistent notification category.
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \~english @param [in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @param [in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - Persistent Category
+/// \~english @return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @code
+/// typedef enum _EFrameworkunifiedNotificationType
+/// {
+/// eFrameworkunifiedNotificationVar = 0, /* Not persistent (not retained by NPS) */
+/// eFrameworkunifiedStateVar, /* Not persistent (held by NPS) */
+/// eFrameworkunifiedPersistedStateVar, /* persistent. Only kept in NPS */
+/// eFrameworkunifiedPersistedStateUserVar, /* Invalid handle type. Only kept in NPS */
+/// eFrameworkunifiedImmediatePersistedStateVar, /* Invalid handle. See \ref
+/// FrameworkunifiedNPRegisterImmediatePersistNotification */
+/// eFrameworkunifiedUnknown /* No Notification typing. Not recommended */
+/// } EFrameworkunifiedNotificationType;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue information handle specified in the argument (hApp) is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see none
+///
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersistentNotfnType(HANDLE hApp, PCSTR pNotification, EFrameworkunifiedPersistCategory ePersistCategory);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPRegisterImmediatePersNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to register a immediate notification
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \~english @param [in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @param [in] max_length
+/// const UI_32 - Max size of the notification message (should be <= 1Kb)
+/// \~english @param [in] delay
+/// const UI_32 - Min time interval between every persist (in sec)
+/// \~english @return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the pNotification to the Notification specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the length of the Notification specified by the arguments is 0, [eFrameworkunifiedStatusInvldParam]
+/// - If the length of the Notification specified in the arguments is 64 (MAX_STRING_SIZE_NOTIFICATION) or greater [eFrameworkunifiedStatusInvldParam]
+/// - Failed to get buffers to store Notification [eFrameworkunifiedStatusInvldParam]
+/// - When memory could not be allocated due to the allocation of message-sending buffers (malloc),... [eFrameworkunifiedStatusFail]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API registers a Notification to the notification service (NS_NPPService).\n
+/// By sending a Notification registration message to the notification service, the specified Notification is registered in the received notification service.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedNPRegisterNotifications, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,FrameworkunifiedSubscribeNotificationsWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterImmediatePersistNotification(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const UI_32 delay);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPPersistentSync
+/// Processing which synchronizes by NPPService (syncfs)
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPPersistentSync(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPRegisterNotifications
+/// \~english @par Brief
+/// API to send a message to the notification service in order to register multiple Notification of list format.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pList
+/// FrameworkunifiedNotificationsList - Pointer to the Notification list to be registered
+/// \~english @param [in] uiListLength
+/// UI_32 - List length
+/// \~english @par
+/// FrameworkunifiedNotificationsList Structure
+/// \~english @code
+/// #define MAX_STRING_SIZE_NOTIFICATION 64
+/// typedef struct _FrameworkunifiedNotificationsList
+/// {
+/// CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION]; /* Notification Name */
+/// UI_32 uiLengthData; /* Notification Name length(64byte below) */
+/// EFrameworkunifiedNotificationType persType; /* Notification Type */
+/// }
+/// @endcode
+/// \~english @par
+/// enum EFrameworkunifiedNotificationType Variable
+/// - eFrameworkunifiedNotificationVar : Non Persistent. Not stored locally by NPS.
+/// - eFrameworkunifiedStateVar : Non Persistent. stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateVar : Not to be used. Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateUserVar : Not to be used. User specific Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedImmediatePersistedStateVar : Not to be used.
+/// - eFrameworkunifiedUnknown : Not to be used. This is not a type of notification.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - A pointer to the Notification list to register specified in the argument (pList) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - And fail to acquire the buffer for storing a plurality Notification. [eFrameworkunifiedStatusInvldParam]
+/// - List specified in the argument length (uiListLength) has exceeded the maximum number of Notification.
+/// [eFrameworkunifiedStatusFail]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// This API is to register multiple Notification of list format to the notification service (NS_NPPService).\n
+/// By transmitting multiple Notification registration message to the notification service, Notification \n
+/// specified in the received notification service is registered. \n
+/// It sends a message for multiple Notification registered with the notification service (NS_NPPService) \n
+/// in order to register multiple Notification of list format.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback, FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterNotifications(HANDLE hApp, const FrameworkunifiedNotificationsList *pList, UI_32 uiListLength);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPUnRegisterNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to remove a notification.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pNotification
+/// PCSTR - A pointer to the Notification name
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNotification) is NULL to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - It fails to get the buffer that stores the Notification. [eFrameworkunifiedStatusInvldParam]
+/// - It is not appropriate length of the specified Notification name in argument(0, or more than a 64byte).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Can not be acquired memory in the acquisition of buffer for internal processing (malloc). [eFrameworkunifiedStatusFail]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// This API is, to remove the Notification from the notification service (NS_NPPService). \n
+/// By deleting, Notification specified from the notification service will no longer be delivered.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPRegisterNotifications, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback, FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnRegisterNotification(HANDLE hApp, PCSTR pNotification);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPUnRegisterNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to delete a notification.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pList
+/// FrameworkunifiedNotificationsList - Pointer to the Notification list that you want to delete
+/// \~english @param [in] uiListLength
+/// UI_32 - List length
+/// \~english @par
+/// FrameworkunifiedNotificationsList Structure
+/// \~english @code
+/// #define MAX_STRING_SIZE_NOTIFICATION 64
+/// typedef struct _FrameworkunifiedNotificationsList
+/// {
+/// CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION]; /* Notification Name */
+/// UI_32 uiLengthData; /* Notification Name length(64byte below) */
+/// EFrameworkunifiedNotificationType persType; /* Notification Type */
+/// }
+/// @endcode
+/// \~english @par
+/// enum EFrameworkunifiedNotificationType Variable
+/// - eFrameworkunifiedNotificationVar : Non Persistent. Not stored locally by NPS.
+/// - eFrameworkunifiedStateVar : Non Persistent. stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateVar : Not to be used. Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateUserVar : Not to be used. User specific Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedImmediatePersistedStateVar : Not to be used.
+/// - eFrameworkunifiedUnknown : Not to be used. This is not a type of notification.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - It fails to get the buffer that stores multiple Notification. [eFrameworkunifiedStatusInvldParam]
+/// - List specified in the argument length (uiListLength) has exceeded the maximum number of Notification.
+/// [eFrameworkunifiedStatusFail]
+/// - Can not be acquired memory in the acquisition of buffer for internal processing (malloc). [eFrameworkunifiedStatusFail]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// This API is, delete multiple Notification of list format from the notification service (NS_NPPService). \n
+/// By deleting, Notification specified from the notification service will no longer be delivered.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPRegisterNotifications, FrameworkunifiedNPUnRegisterNotification,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback, FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnRegisterNotifications(HANDLE hApp, const FrameworkunifiedNotificationsList *pList,
+ UI_32 uiListLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPPublishNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to notify subscribers
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pNotification
+/// PCSTR - A pointer to the Notification name
+/// \~english @param [in] pData
+/// VOID * - Data buffer pointer
+/// \~english @param [in] iLength
+/// UI_32 - Size of data buffer
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some kind of error has occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNotification) is NULL to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Detail
+/// Send a message to the notification service(NS_NPPService), and notifies the Subscriber.\n
+/// - Publisher is required registration of Notification in advance FrameworkunifiedNPRegisterNotification.
+/// - Publisher is possible cancellation of the Notification in FrameworkunifiedNPUnRegisterNotification.
+/// - Subscriber need a reception procedure of Notification in advance FrameworkunifiedSubscribeNotification.
+/// - Subscriber is capable of receiving cancellation of the Notification in FrameworkunifiedUnsubscribeNotification.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification
+/// FrameworkunifiedNPRegisterNotifications, FrameworkunifiedNPUnRegisterNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPPublishNotification(HANDLE hApp, PCSTR pNotification,
+ PCVOID pData, UI_32 iLength);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPReadPersistedData
+/// \~english @par Brief
+/// API to requested the persistent data corresponding to the notification if available
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \~english @param [in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the pNotification to the Notification specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the length of the Notification specified by the arguments is 0, [eFrameworkunifiedStatusInvldParam]
+/// - Failed to get buffers to store Notification [eFrameworkunifiedStatusInvldParam]
+/// - When memory could not be allocated due to the allocation of message-sending buffers (malloc),... [eFrameworkunifiedStatusFail]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for the NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see none
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReadPersistedData(HANDLE hApp, PCSTR pNotification);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPRegisterPersistentFile
+/// \~english @par Brief
+/// APIs that send messages to notification services and register Persistent file tags
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pTag
+/// PCSTR - Tag name
+/// \~english @param [in] bIsUserFile
+/// BOOL - User specified (TRUE: user-specific/FALSE: all users) (Default:FALSE)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue information handle specified in the argument (hApp) is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is an empty character, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends messages to the notification service (NS_NPPService) and registers Persistent file tags.\n
+/// Tag name is 64 bytes or less. If the tag name exceeds 64 bytes, the tag name is truncated to 64 bytes or less. Therefore, specify a tag name of 64 bytes or less.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget
+/// \~english @see FrameworkunifiedNPLoadPersistentFile, FrameworkunifiedNPReleasePersistentFile
+///
+/// API to send message to Notification Service to add a file path as to be persisted
+///
+/// \param [in] pTag
+/// PCSTR - A unique identifier for the file path specified,
+/// this is used in retrieve/Load the file later
+///
+/// \param [in] bIsUserFile
+/// BOOL - set TRUE if want to register a file for user.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPLoadPersistentFile, FrameworkunifiedNPReleasePersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterPersistentFile(HANDLE hApp, PCSTR pTag, BOOL bIsUserFile = FALSE);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetFilePersistentType
+/// API to send message to Notification Service to set persistent file category.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pTag
+/// PCSTR - File tag
+/// \param [in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - Persistent category
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetFilePersistentType(HANDLE hApp, PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPLoadPersistentFile
+/// \~english @par Brief
+/// APIs that send messages to notification services and request Load of Persistent file tags
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pDstFilePath
+/// PCSTR - Address of arbitrary data
+/// \~english @param [in] pTag
+/// PCSTR - Tag name
+/// \~english @param [in] hUser
+/// BOOL - Parameter error(Default:NULL)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue information handle specified in the argument (hApp) is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the Load destination file path (pDstFilePath) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the Load destination filepath (pDstFilePath) specified in the parameter is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is an empty character, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends messages to the notification service (NS_NPPService) and requests the Load of Persistent file tags.\n
+/// The copy destination file path is 255 bytes or less, and any file that exceeds 255 bytes is truncated to 255 bytes. Therefore, specify a file path of 255 bytes or less.\n
+/// Tag name is 64 bytes or less. If the tag name exceeds 64 bytes, the tag name is truncated to 64 bytes or less. Therefore, specify a tag name of 64 bytes or less.\n
+///
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method(Async)
+/// \~english @see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPReleasePersistentFile
+///
+/// API to send message to Notification Service to copy file from persistent memory to
+/// specified path. The caller recieves an acknowledgement once NPS completes file copy
+///
+/// \param [in] pDstFilePath
+/// PCSTR - Complete file path to which the file should be copied from persistent area
+/// \param [in] pTag
+/// PCSTR - Tag associated with the file that needs to be copied to pDstFilePath
+/// \param [in] hUser
+/// HANDLE - Handle for the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPReleasePersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPLoadPersistentFile(HANDLE hApp, PCSTR pDstFilePath, PCSTR pTag, HANDLE hUser = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPReleasePersistentFile
+/// \~english @par Brief
+/// API to send message to Notification Service to notify that the file can be persisted.
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \~english @param [in] bIsPersist
+/// BOOL - If the specified file needs to be persisted or not on release
+/// \~english @param [in] pTag
+/// PCSTR - Tag associated with the file released
+/// \~english @param [in] pFullFilePath
+/// PCSTR - Full path name of the file to be persisted
+/// \~english @param [in] hUser
+/// HANDLE - Handle for the user
+/// \~english @return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue information handle specified in the argument (hApp) is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the Release destination file path (pFullFilePath) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the Release destination filepath (pFullFilePath) specified in the parameter is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is an empty character, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends messages to the notification service (NS_NPPService) and requests the Load of Persistent file tags.\n
+/// The copy destination file path is 255 bytes or less, and any file that exceeds 255 bytes is truncated to 255 bytes. Therefore, specify a file path of 255 bytes or less.\n
+/// Tag name is 64 bytes or less. If the tag name exceeds 64 bytes, the tag name is truncated to 64 bytes or less. Therefore, specify a tag name of 64 bytes or less.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPLoadPersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFile(HANDLE hApp, BOOL bIsPersist, PCSTR pTag, PCSTR pFullFilePath,
+ HANDLE hUser = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPReleasePersistentFile
+/// \~english @par Brief
+/// API to send message to Notification Service to notify that the file can be persisted.
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \~english @param [in] eReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease :not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly :persist instantly
+/// \~english @param [in] pTag
+/// PCSTR - Tag associated with the file released
+/// \~english @param [in] pFullFilePath
+/// PCSTR - Full path name of the file to be persisted
+/// \~english @param [in] hUser
+/// HANDLE - Handle for the user
+/// \~english @return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue information handle specified in the argument (hApp) is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the Load destination file path (pDstFilePath) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the Load destination filepath (pDstFilePath) specified in the parameter is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is an empty character, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends messages to the notification service (NS_NPPService) and requests the Load of Persistent file tags.\n
+/// The copy destination file path is 255 bytes or less, and any file that exceeds 255 bytes is truncated to 255 bytes. Therefore, specify a file path of 255 bytes or less.\n
+/// Tag name is 64 bytes or less. If the tag name exceeds 64 bytes, the tag name is truncated to 64 bytes or less. Therefore, specify a tag name of 64 bytes or less.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPLoadPersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFile(HANDLE hApp, EFrameworkunifiedReleaseType eReleaseType, PCSTR pTag, PCSTR pFullFilePath,
+ HANDLE hUser = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPRegisterPersistentFolder
+/// API to send message to Notification Service to add a folder path to be persisted
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pTag
+/// PCSTR - A unique identifier for the folder path specified,
+/// this is used in retrieve/Load the folder later
+///
+/// \param [in] bIsUserFolder
+/// BOOL - set TRUE if want to register a folder for user.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPLoadPersistentFolder, FrameworkunifiedNPReleasePersistentFolder
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterPersistentFolder(HANDLE hApp, PCSTR pTag, BOOL bIsUserFolder = FALSE);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetFolderPersistentType
+/// API to send message to Notification Service to set persistent folder category.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pTag
+/// PCSTR - A unique identifier for the folder path specified,
+/// this is used in retrieve/Load the folder later
+/// \param [in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - Persistent category
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetFolderPersistentType(HANDLE hApp, PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPLoadPersistentFolder
+/// API to send message to Notification Service to copy folder from persistent memory to
+/// specified path. The caller recieves an acknowledgement once NPS completes folder copy
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pDstFolderPath
+/// PCSTR - Complete folder path to which the folder should be copied from persistent area
+/// \param [in] pTag
+/// PCSTR - Tag associated with the folder that needs to be copied to pDstFolderPath
+/// \param [in] hUser
+/// HANDLE - Handle for the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFolder, FrameworkunifiedNPReleasePersistentFolder
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPLoadPersistentFolder(HANDLE hApp, PCSTR pDstFolderPath, PCSTR pTag, HANDLE hUser = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFolder
+/// API to send message to Notification Service to notify that the folder can be persisted.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] bIsPersist
+/// BOOL - If the specified folder needs to be persisted or not on release
+/// \param [in] pTag
+/// PCSTR - Tag associated with the folder released
+/// \param [in] pFullFolderPath
+/// PCSTR - Full path name of the folder to be persisted
+/// \param [in] hUser
+/// HANDLE - Handle for the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFolder, FrameworkunifiedNPLoadPersistentFolder
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFolder(HANDLE hApp, BOOL bIsPersist, PCSTR pTag, PCSTR pFullFolderPath,
+ HANDLE hUser = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFolder
+/// API to send message to Notification Service to notify that the folder can be persisted.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] eFrameworkunifiedReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease :not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly :persist instantly
+/// \param [in] pTag
+/// PCSTR - Tag associated with the folder released
+/// \param [in] pFullFolderPath
+/// PCSTR - Full path name of the folder to be persisted
+/// \param [in] hUser
+/// HANDLE - Handle for the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFolder, FrameworkunifiedNPLoadPersistentFolder
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFolder(HANDLE hApp, EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType, PCSTR pTag,
+ PCSTR pFullFolderPath, HANDLE hUser = NULL);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Session APIs
+////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOpenSession
+/// \~english @par Brief
+/// API sends a message to the service requesting a session.
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService HANDLE acquired in)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (Service) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) during the transmission of the session message to the service
+/// occurs. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// To send a message of the session request to the service.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedGetOpenSessionHandle, FrameworkunifiedOpenSessionWithData, FrameworkunifiedCloseSession, FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSession(HANDLE hService);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOpenSessionWithData
+/// \~english @par Brief
+/// API to send to service the message of the session request together with the data.
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService HANDLE acquired in)
+/// \~english @param [in] pData
+/// PVOID - Pointer to the session data for transmission
+/// \~english @param [in] length
+/// UI_32 - Size of the session data for transmission
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - A pointer to the session data for transmission to the specified non-zero size at NULL in argument.
+/// [eFrameworkunifiedStatusInvldBuf]
+/// - The pointer is NULL to the session data for transmission specified in the argument. [eFrameworkunifiedStatusErrOther]
+/// - Size of the session data for transmission specified in the argument is 0. [eFrameworkunifiedStatusErrOther]
+/// - HANDLE specified in the argument (Service) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) during the transmission of the session message to the service
+/// occurs. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// To send to the service a message of session request together with the data.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSession, FrameworkunifiedGetOpenSessionHandle, FrameworkunifiedCloseSession, FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionWithData(HANDLE hService, PVOID pData, UI_32 length);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOpenSessionSync
+/// \~english @par Brief
+/// Synchronous API of sending a message of the session request to the service.
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService/FrameworkunifiedGetOpenSessionHandle/FrameworkunifiedGetOpenSessionSyncHandle HANDLE
+/// acquired in)
+/// \~english @param [out] ack
+/// OpenSessionAck - Pointer to the response data of the session initiation
+/// \~english @par
+/// OpenSessionAck Structure
+/// \~english @code
+/// #define MAX_QUEUE_NAME_SIZE 20
+/// typedef struct _OpenSessionAck
+/// {
+/// EFrameworkunifiedStatus eStatus; /* Status */
+/// UI_32 sessionId; /* Session ID */
+/// CHAR cSessionName[MAX_QUEUE_NAME_SIZE]; /* Session Name(20byte) */
+/// UI_32 sessionType; /* Session Type */
+/// }OpenSessionAck;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (Service) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - It failed to open the message queue for the response received [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - It fails to get the message storage buffer for the response received. [eFrameworkunifiedStatusFail]
+/// - Random number generation to fail for the sequence ID of the message for transmission. [eFrameworkunifiedStatusFail]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmit and receive file descriptor of the session message to the service.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) occurs during the transmission and reception of the session message
+/// to the service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the sending and receiving of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// - It failed to Socket connection of the response message for the reception from the service. [eFrameworkunifiedStatusFail]
+/// - The wait control of the response message received from the service failed. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) to wait in the response message received from the service has
+/// occurred. [eFrameworkunifiedStatusFail]
+/// - In response message at the time of failure to receive from the service, it failed to re-connection of the
+/// Socket. [eFrameworkunifiedStatusBadConnection]
+/// \~english @par Detail
+/// Send in the synchronous type the message of the session request to the service.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSessionWithDataSync, FrameworkunifiedGetOpenSessionSyncHandle, FrameworkunifiedCloseSessionSync,
+/// FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionSync(HANDLE hService, OpenSessionAck *ack);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOpenSessionWithDataSync
+/// \~english @par Brief
+/// Synchronous API that transmits to the service a message session request with the data.
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService/FrameworkunifiedGetOpenSessionHandle/FrameworkunifiedGetOpenSessionSyncHandle HANDLE
+/// acquired in)
+/// \~english @param [in] pData
+/// PVOID - Pointer to session data for transmission
+/// \~english @param [in] length
+/// UI_32 - Size of the session data for transmission
+/// \~english @param [out] ack
+/// OpenSessionAck - Pointer to the response data of the session initiation
+/// \~english @par
+/// OpenSessionAck Structure
+/// \~english @code
+/// #define MAX_QUEUE_NAME_SIZE 20
+/// typedef struct _OpenSessionAck
+/// {
+/// EFrameworkunifiedStatus eStatus; /* Status */
+/// UI_32 sessionId; /* Session ID */
+/// CHAR cSessionName[MAX_QUEUE_NAME_SIZE]; /* Session Name(20byte) */
+/// UI_32 sessionType; /* Session Type */
+/// }OpenSessionAck;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid Buffer
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - A pointer to the session data for transmission to the specified non-zero size at NULL in argument.
+/// [eFrameworkunifiedStatusInvldBuf]
+/// - The pointer is NULL to the session data for transmission specified in the argument. [eFrameworkunifiedStatusErrOther]
+/// - Size of the session data for transmission specified in the argument is 0. [eFrameworkunifiedStatusErrOther]
+/// - HANDLE specified in the argument (Service) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - It failed to open the message queue for the response received [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - It fails to get the message storage buffer for the response received. [eFrameworkunifiedStatusFail]
+/// - Random number generation to fail for the sequence ID of the message for transmission. [eFrameworkunifiedStatusFail]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmit and receive file descriptor of the session message to the service.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) occurs during the transmission and reception of the session message
+/// to the service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the sending and receiving of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for transmission and reception of the service for the message for the session
+/// failed. [eFrameworkunifiedStatusErrOther]
+/// - It failed to Socket connection of the response message for the reception from the service. [eFrameworkunifiedStatusFail]
+/// - The wait control of the response message received from the service failed. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) to wait in the response message received from the service has
+/// occurred. [eFrameworkunifiedStatusFail]
+/// - In response message at the time of failure to receive from the service, it failed to re-connection of the
+/// Socket. [eFrameworkunifiedStatusBadConnection]
+/// \~english @par Detail
+/// Send in the synchronous type to service the message of the session request along with the data.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSessionSync, FrameworkunifiedGetOpenSessionSyncHandle, FrameworkunifiedCloseSessionSync, FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionWithDataSync(HANDLE hService, PVOID pData, UI_32 length, OpenSessionAck *ack);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetOpenSessionHandle
+/// \~english @par Brief
+/// Asynchronous API to get the session handler.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application (FrameworkunifiedCreateDispatcherWithoutLoop() HANDLE acquired in)
+/// \~english @retval HANDLE HANDLE for the session
+/// \~english @retval NULL Failure to HANDLE acquisition for the session
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// Under the following conditions, HANDLE is returned as NULL.
+/// - HANDLE specified in the argument (hApp) is NULL.
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid).
+/// - Data size received by the HANDLE specified in the argument (hApp) is not the data size of
+/// ProtocolOpenSessionAck message.
+/// - Can not get the data and the data length received by the HANDLE specified in the argument (hApp).
+/// - Size of the session name of the data received by the specified HANDLE (hApp) in the argument is more than
+/// 20byte.
+/// - Not be able to acquire the memory of the buffer for the internal processing.
+/// - Session name is NULL of data received by the HANDLE specified in the argument (hApp).
+/// - It failed to generate the message queue name.
+/// - It failed to open the message queue.
+/// \~english @par Detail
+/// This API will be used in an asynchronous type specification. \n
+/// Acquires received data ProtocolOpenSessionAck from HANDLE specified in the argument (hApp), \n
+/// obtains the session HANDLE from the session name.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSession, FrameworkunifiedOpenSessionWithData, FrameworkunifiedCloseSession, FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetOpenSessionHandle(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetOpenSessionSyncHandle
+/// \~english @par Brief
+/// API to get the session ID without using the received data of ProtocolOpenSessionAck.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application (FrameworkunifiedCreateDispatcherWithoutLoop() HANDLE acquired in)
+/// \~english @param [in] tAck
+/// OpenSessionAck - Pointer to the OpenSessionAck structure
+/// \~english @par
+/// OpenSessionAck Structure
+/// \~english @code
+/// #define MAX_QUEUE_NAME_SIZE 20
+/// typedef struct _OpenSessionAck
+/// {
+/// EFrameworkunifiedStatus eStatus; /* Status */
+/// UI_32 sessionId; /* Session ID */
+/// CHAR cSessionName[MAX_QUEUE_NAME_SIZE]; /* Session Name(20byte) */
+/// UI_32 sessionType; /* Session Type */
+/// }OpenSessionAck;
+/// @endcode
+/// \~english @retval HANDLE HANDLE for the session
+/// \~english @retval NULL Failure to HANDLE acquisition for the session
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// Under the following conditions, HANDLE is returned as NULL.
+/// - HANDLE specified in the argument (hApp) is NULL.
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid).
+/// - Data size received by the HANDLE specified in the argument (hApp) is not the data size of
+/// ProtocolOpenSessionAck message.
+/// - Size of the session name of the data received by the specified HANDLE (hApp) in the argument is more than
+/// 20byte.
+/// - Not be able to acquire the memory of the buffer for the internal processing.
+/// - Session name is NULL of data received by the HANDLE specified in the argument (hApp).
+/// - It failed to generate the message queue name.
+/// - It failed to open the message queue.
+/// \~english @par Detail
+/// This API is to be used at the time of the synchronous type specification. \n
+/// Use the session name of OpenSessionAck structure specified by the argument, to get the session HANDLE.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSessionSync, FrameworkunifiedOpenSessionWithDataSync, FrameworkunifiedCloseSessionSync, FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetOpenSessionSyncHandle(HANDLE hApp, OpenSessionAck *tAck);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGenerateSessionHandle
+/// API will be called by server on receiving the Open session request to Create session
+///
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the framework application
+/// \param [in] pServiceName
+/// PCSTR - Service Name
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+///
+/// \see FrameworkunifiedOpenSession, FrameworkunifiedCloseSession, FrameworkunifiedGenerateNewSessionId
+/// FrameworkunifiedGetSessionId
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGenerateSessionHandle(HANDLE hApp, PCSTR pServiceName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCloseSession
+/// \~english @par Brief
+/// API to close the session.
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService HANDLE acquired in)
+/// \~english @param [in] hSession
+/// HANDLE - Handle to the session(FrameworkunifiedOpenSession HANDLE acquired in)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hSession) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hSession) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) during the transmission of the session message to the service
+/// occurs. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// - Message queue type of HANDLE specified in the argument (hSession) is mismatch.(eQTypeSender or
+/// eQTypeReveiver) [eFrameworkunifiedStatusInvldHndlType]
+/// - Failed to close message queue HANDLE specified in the argument (hSession). [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Send a message of the session close request to the service.\n
+/// And close message queue of the session.
+/// This is asynchronous API.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSession, FrameworkunifiedOpenSessionWithData, FrameworkunifiedGetOpenSessionHandle
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseSession(HANDLE hService, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCloseSessionSync
+/// \~english @par Brief
+/// API to close the session (synchronous).
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService HANDLE acquired in)
+/// \~english @param [in] hSession
+/// HANDLE - Handle to the session(FrameworkunifiedOpenSessionSync HANDLE acquired in)
+/// \~english @param [out] ack
+/// CloseSessionAck - Pointer to the response data of the session close
+/// \~english @par
+/// CloseSessionAck Structure
+/// \~english @code
+/// typedef struct _CloseSessionAck
+/// {
+/// UI_32 sessionId; /* Session ID */
+/// EFrameworkunifiedStatus eStatus; /* Status */
+/// }CloseSessionAck;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusOK [eStatus in CloseSessionAck]Success in serivice side.
+/// \~english @retval eFrameworkunifiedStatusFail [eStatus in CloseSessionAck]Some sort of error occurred in service side.
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure (API)
+/// - CloseSessionAck specified in the argument (ack) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (Service) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hSession) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hSession) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - It failed to open the message queue for the response received [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - It fails to get the message storage buffer for the response received. [eFrameworkunifiedStatusFail]
+/// - Random number generation to fail for the sequence ID of the message for transmission. [eFrameworkunifiedStatusFail]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmit and receive file descriptor of the session message to the service.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) occurs during the transmission and reception of the session message
+/// to the service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the sending and receiving of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// - It failed to Socket connection of the response message for the reception from the service. [eFrameworkunifiedStatusFail]
+/// - The wait control of the response message received from the service failed. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) to wait in the response message received from the service has
+/// occurred. [eFrameworkunifiedStatusFail]
+/// - In response message at the time of failure to receive from the service, it failed to re-connection of the
+/// Socket. [eFrameworkunifiedStatusBadConnection]
+/// - Failed to close message queue HANDLE specified in the argument (hSession). [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hSession) is mismatch.(eQTypeSender or
+/// eQTypeReveiver) [eFrameworkunifiedStatusInvldHndlType]
+/// \~english @par Conditions of processing failure (eStatus in CloseSessionAck)
+/// - Any errors occur during in service side. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Send a message synchronously of the session close request to the service.\n
+/// And close message queue of the session.\n
+/// The eStatus value in CloseSessionAck is dependent on service. So we indecates major return value.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSessionSync, FrameworkunifiedOpenSessionWithDataSync
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseSessionSync(HANDLE hService, HANDLE hSession, CloseSessionAck *ack);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGenerateNewSessionId
+/// Used on the Server side to get the next session id
+///
+///
+/// \return sessionID
+/// UI_32 - session ID value
+///
+///
+/// \see FrameworkunifiedOpenSession, FrameworkunifiedGetOpenSessionHandle, FrameworkunifiedCloseSession,
+/// FrameworkunifiedGetSessionId
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGenerateNewSessionId();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetSessionId
+/// \~english @par Brief
+/// Returns the session id corresponding to the given session handle.
+/// \~english @param [in] hSession
+/// HANDLE - Handle to the session(FrameworkunifiedMcOpenSender HANDLE acquired in)
+/// \~english @retval UI_32 session ID value
+/// \~english @retval MAX_SESSION_ID_VAL Failed to get session ID value
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hSession) is NULL. [MAX_SESSION_ID_VAL]
+/// - HANDLE specified in the argument (hSession) is not appropriate (which is invalid). [MAX_SESSION_ID_VAL]
+/// \~english @par Detail
+/// Returns the session id corresponding to the given session handle.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSession, FrameworkunifiedOpenSessionSync, FrameworkunifiedOpenSessionWithData, FrameworkunifiedOpenSessionWithDataSync, \n
+/// FrameworkunifiedGetOpenSessionHandle, FrameworkunifiedGetOpenSessionSyncHandle, FrameworkunifiedGetCurrentSessionHandle, \n
+/// FrameworkunifiedMcOpenSender, FrameworkunifiedCreateSession
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetSessionId(HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetMsgSessionId
+/// \~english @par Brief
+/// Get session ID from received message.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval UI_32 session ID value
+/// \~english @retval MAX_SESSION_ID_VAL Failed to get session ID value
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [MAX_SESSION_ID_VAL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [MAX_SESSION_ID_VAL]
+/// \~english @par Detail
+/// Get session ID from received message.\n
+/// Mostly, this API is used to get session ID from message received by callback function that is registered to
+/// Dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedGetSessionHandle
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgSessionId(HANDLE hApp);
+
+
+
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Defer Message APIs
+////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetDeferQueueCnt
+/// Get the number of messages in the defer queue
+///
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the App / Thread
+///
+/// \return count
+/// UI_32 - number of messages on Defered Queue
+///
+///
+/// \see FrameworkunifiedDeferMessage, FrameworkunifiedRetrieveDeferMessage
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetDeferQueueCnt(HANDLE hApp);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedIsDeferQueueEmpty
+/// \~english @par Brief
+/// Empty determination of DeferQueue
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval BOOL DeferQueue status (TRUE: empty or FALSE: not empty)
+/// \~english @retval TRUE Judgment failure
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [TRUE]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [TRUE]
+/// \~english @par Detail
+/// Returns whether the DeferQueue in the application-handle given by the arguments is empty
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see FrameworkunifiedDeferMessage, FrameworkunifiedRetrieveDeferMessage
+/// FrameworkunifiedIsDeferQueueEmpty
+/// Get the number of messages in the defer queue
+///
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the App / Thread
+///
+/// \return count
+/// BOOL - Indicates if the defer queue is empty, TRUE (empty), FALSE (not empty)
+///
+///
+/// \see FrameworkunifiedDeferMessage, FrameworkunifiedRetrieveDeferMessage, FrameworkunifiedGetDeferQueueCnt
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsDeferQueueEmpty(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDeferMessage
+/// \~english @par Brief
+/// Push messages to the DeferQueue
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Push received messages in the application handles specified by the arguments to the DeferQueue.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Set Get
+/// \~english @see FrameworkunifiedRetrieveDeferMessage
+/// FrameworkunifiedDeferMessage
+/// Defers the current message; Pushes the message on to a defer msg queue
+///
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the App / Thread
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+///
+/// \see FrameworkunifiedClearDeferMessages, FrameworkunifiedRetrieveDeferMessage
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDeferMessage(HANDLE hApp);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedClearDeferMessages
+/// Clear all the defer messages
+///
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the App / Thread
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+///
+/// \see FrameworkunifiedDeferMessage, FrameworkunifiedRetrieveDeferMessage
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedClearDeferMessages(HANDLE hApp);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedRetrieveDeferMessage
+/// \~english @par Brief
+/// Write Messages Registered in DeferQueue to FD
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Write the messages registered in the DeferQueue in the application handler specified by arguments to the FD.\n
+/// This allows the main loop to receive the message.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Set Get
+/// \~english @see FrameworkunifiedDeferMessage
+/// FrameworkunifiedRetrieveDeferMessage
+/// Enables Checking for deferred message and retrieves messages when
+/// callback returns to the dispatcher.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the App / Thread
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+///
+/// \see FrameworkunifiedDeferMessage, FrameworkunifiedClearDeferMessages
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRetrieveDeferMessage(HANDLE hApp);
+
+// TODO(framework_unified) : clean up the old FrameworkunifiedRegisterPersistentStorage api's
+// 20110429_brp
+// defined for backward compatibility; will be removed once the persistence feature is finalized
+EFrameworkunifiedStatus FrameworkunifiedRegisterPersistentStorage(HANDLE hApp, PCSTR pFullFilePath);
+EFrameworkunifiedStatus FrameworkunifiedReleaseFileToPersistentStorage(HANDLE hApp, PCSTR pFullFilePath, BOOL persist);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedRegisterEvent
+/// \~english @par Brief
+/// Registering Applications for Delivery of Service-Specific Events
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @param [in] uiEventId
+/// UI_32 - Event ID (Identification ID on the service's protocol)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sessions for services is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for sessions intended for the service [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for services [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for the services [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Issues a request for registering the application that executes this API to the delivery target of the device-specific events of the service associated with the handle (hSession) specified in the arguments.\n
+/// The application specifies the type of events to receive in the uiEventId of arguments.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message. The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API is deprecated and should now use FrameworkunifiedSubscribeToSessionEventWithCallback.
+/// - When this API is used, the application shall use a FrameworkunifiedAttachCallbackToDispatcher or the like to register callback functions in its own Dispatcher for handling events.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackToDispatcherWithFd,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents
+///
+/// API to register for event of a service.
+/// This API is depricated, use FrameworkunifiedSubscribeToSessionEventWithCallback.
+///
+/// \param [in] hSession
+/// HANDLE - Handle to the application session
+/// \param [in] uiEventId
+/// UI_32 - Event registering for.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents, FrameworkunifiedBroadcastEvent, FrameworkunifiedDefineStateEvents,
+/// FrameworkunifiedPublishEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRegisterEvent(HANDLE hSession, UI_32 uiEventId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedRegisterEvents
+/// \~english @par Brief
+/// Registering Applications for Delivery of Service-Specific Events
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @param [in] puiEventsArray
+/// PVOID - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID array (0 to 4294967295)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (puiEventsArray) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldBuf]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sessions for services is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for sessions intended for the service [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for services [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for the services [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages for sessions for services [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Issues a request for registering the application that executes this API to the delivery target of the device-specific events of the service associated with the handle (hSession) specified in the arguments.\n
+/// The application specifies more than one type of events to receive in the puiEventsArray of arguments.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message. The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API is deprecated and should now use FrameworkunifiedSubscribeToSessionEventsWithCallbacks.
+/// - When this API is used, the application shall use a FrameworkunifiedAttachCallbackToDispatcher or the like to register callback functions in its own Dispatcher for handling events.
+/// - The maximum number of event IDs that can be registered depends on the size that can be allocated as the area for the event ID array.\n
+/// Therefore, the API caller should consider the size of the event ID array and define the number of event IDs (uiListSize).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedRegisterEvent, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackToDispatcherWithFd,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents
+///
+/// API to register for events of a service.
+/// This API is depricated, use FrameworkunifiedSubscribeToSessionEventsWithCallbacks.
+///
+/// \param [in] hSession
+/// HANDLE - Handle to the application session
+/// \param [in] puiEventsArray
+/// PVOID - Array of events registering for.
+/// \param [in] uiListSize
+/// UI_32 - count of elements in array.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedRegisterEvent, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents, FrameworkunifiedBroadcastEvent, FrameworkunifiedDefineStateEvents,
+/// FrameworkunifiedPublishEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRegisterEvents(HANDLE hSession, PVOID puiEventsArray, UI_32 uiListSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnRegisterEvent
+/// \~english @par Brief
+/// Unregistering Service-Specific Events from Delivery
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @param [in] uiEventId
+/// UI_32 - Event ID (Identification ID on the service's protocol)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sessions for services is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for sessions intended for the service [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for services [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for the services [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Issues a request to unregister the application that executed this API from the delivery target of the service-specific event associated with the handle (hSession) specified in the arguments.\n
+/// The application specifies events that are no longer needed for delivery in the uiEventId of arguments.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API is deprecated and should now use FrameworkunifiedUnSubscribeSessionEventWithCallback.
+/// - When this API is used, the application shall unregister callbacks for events registered in its own Dispatcher by means of FrameworkunifiedDetachCallbackFromDispatcher, etc.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedRegisterEvent, FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcherWithFd, FrameworkunifiedDetachCallbacksFromDispatcherWithFd,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks,
+/// FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents
+///
+/// API to unregister from event of a service.
+/// This API is depricated, use FrameworkunifiedUnSubscribeSessionEventsWithCallbacks.
+///
+/// \param [in] hSession
+/// HANDLE - Handle to the application session
+/// \param [in] uiEventId
+/// UI_32 - Event registering for.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnRegisterEvents, FrameworkunifiedRegisterEvent, FrameworkunifiedBroadcastEvent, FrameworkunifiedDefineStateEvents, FrameworkunifiedPublishEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterEvent(HANDLE hSession, UI_32 uiEventId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnRegisterEvents
+/// \~english @par Brief
+/// Unregistering Service-Specific Events from Delivery
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @param [in] puiEventsArray
+/// PVOID - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID array (0 to 4294967295)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (puiEventsArray) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldBuf]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sessions for services is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for sessions intended for the service [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for services [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for the services [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages for sessions for services [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Issues a request to unregister the application that executed this API from the delivery target of the service-specific event associated with the handle (hSession) specified in the arguments.\n
+/// The application specifies the unneeded events in the puiEventsArray of arguments.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API is deprecated and should now use FrameworkunifiedUnSubscribeSessionEventsWithCallbacks.
+/// - After executing this API, the callback of the event registered in the Dispatcher of the application itself must be unregistered by FrameworkunifiedDetachCallbackFromDispatcher, etc.
+/// - The maximum number of event IDs that can be registered depends on the size that can be allocated as the area for the event ID array.\n
+/// Therefore, the API caller should consider the size of the event ID array and define the number of event IDs (uiListSize).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedRegisterEvent, FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcherWithFd, FrameworkunifiedDetachCallbacksFromDispatcherWithFd,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks,
+/// FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents
+///
+/// API to unregister from events of a service.
+/// This API is depricated, use FrameworkunifiedUnSubscribeSessionEventsWithCallbacks.
+///
+/// \param [in] hSession
+/// HANDLE - Handle to the application session
+/// \param [in] puiEventsArray
+/// PVOID - Array of events registering for.
+/// \param [in] uiListSize
+/// UI_32 - count of elements in array.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnRegisterEvent, FrameworkunifiedRegisterEvent, FrameworkunifiedBroadcastEvent, FrameworkunifiedDefineStateEvents, FrameworkunifiedPublishEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterEvents(HANDLE hSession, PVOID puiEventsArray, UI_32 uiListSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDefineStateEvents
+/// \~english @par Brief
+/// Subscribing to Application-Specific Events in the Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] puiEvents
+/// PVOID - Pointer to an array (UI_32 arrays) of event IDs (identification IDs on the service protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID array (0 to 4294967295)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (puiEvents) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Register unique events in your Dispatcher that applications can deliver to other applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// For application-specific events registered by this API, the event is delivered by Dispatcher when the application executes the FrameworkunifiedPublishPublicEvent.\n
+/// Events are distributed to applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API is deprecated, use FrameworkunifiedDefinePublicStateEvents or FrameworkunifiedDefinePrivateStateEvents now.
+/// - The maximum number of event IDs that can be registered depends on the size that can be allocated as the area for the event ID array.\n
+/// Therefore, the API caller should consider the size of the event ID array and define the number of event IDs (uiListSize).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents,
+/// FrameworkunifiedPublishEvent, FrameworkunifiedBroadcastEvent, FrameworkunifiedPublishPublicEvent, FrameworkunifiedPublishPrivateEvent
+/// FrameworkunifiedRegisterEvent, FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks,
+///
+/// API to define the state events of the service.
+/// This API is depricated, use FrameworkunifiedDefinePublicStateEvents or FrameworkunifiedDefinePrivateStateEvents.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] puiEvents
+/// PVOID - Array of state events or single state event.
+/// \param [in] uiListSize
+/// UI_32 - size of events list.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedRegisterEvent, FrameworkunifiedBroadcastEvent, FrameworkunifiedPublishEvent, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefineStateEvents(HANDLE hApp, PVOID puiEvents, UI_32 uiListSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedPublishEvent
+/// \~english @par Brief
+/// Deliver application-specific events
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] pClientName
+/// PCSTR - Destination application name (distributed to all registered applications when NULL is specified),
+/// \~english @param [in] pData
+/// PCVOID - Pointer to trasmission data
+/// \~english @param [in] iLength
+/// UI_32 - Transmission data length
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - The events to be delivered must be specified in a FrameworkunifiedDefinePublicStateEvents, etc.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the application name of the delivery destination in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - Sessioninformation is not found with the application being delivered to within the handles (hApp) specified in the arguments. [eFrameworkunifiedStatusErrOther]
+/// - If the destination handles are inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is NULL [eFrameworkunifiedStatusErrOther]
+/// - If the application name in the destination handles is not set, [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - When the send data length (iLength) specified in the arguments is not 0 and the pointer to the send data pointer (pData) is NULL, [eFrameworkunifiedStatusErrOther]
+/// - When the name of the application in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle is NULL, [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - If the message queue type of the destination handler is not the send type [eFrameworkunifiedStatusErrOther]
+/// - When the message queue is full [eFrameworkunifiedStatusErrOther]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrOther]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrOther]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusErrOther]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusErrOther]
+/// - Failed to access shared memory for sending messages [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Delivers application-specific events to subscribed applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// The delivery destination of events is the application specified by the argument pClientName or (when the argument pClientName is NULL)
+/// all the applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks etc.\n
+/// The data (pData) to be distributed is the same for all distribution destinations.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation cannot be guaranteed if the size of the area indicated by the pointer (pData) address to the send data does not match the size specified by the send data length (iLength) address.
+/// \~english @par
+/// This API is deprecated, use FrameworkunifiedPublishPublicEvent or FrameworkunifiedPublishPrivateEvent now.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents,
+/// FrameworkunifiedBroadcastEvent, FrameworkunifiedPublishPublicEvent,
+/// FrameworkunifiedRegisterEvent, FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackToDispatcherWithFd,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcherWithFd, FrameworkunifiedDetachCallbacksFromDispatcherWithFd,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to publish the event to one of the client subscribed to this event.
+/// This API can be used to publish the event to all the clients subscribed to this event by
+/// passing pClientName as NULL.
+/// This API is depricated, use FrameworkunifiedPublishPrivateEvent or FrameworkunifiedPublishPublicEvent.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] uiEventId
+/// UI_32 - Event id of Message
+/// \param [in] pClientName
+/// PCSTR - Name of the client
+/// \param [in] pData
+/// PCVOID - Data buffer
+/// \param [in] iLength
+/// UI_32 - Size of data buffer
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedRegisterEvent, FrameworkunifiedBroadcastEvent, FrameworkunifiedDefineStateEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishEvent(HANDLE hApp, UI_32 uiEventId, PCSTR pClientName, PCVOID pData, UI_32 iLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedBroadcastEvent
+/// \~english @par Brief
+/// Broadcast application-specific events
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] pData
+/// PCVOID - Pointer to trasmission data
+/// \~english @param [in] iLength
+/// UI_32 - Transmission data length
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - The events to be delivered must be specified in a FrameworkunifiedDefinePublicStateEvents, etc.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the application name of the delivery destination in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - Sessioninformation is not found with the application being delivered to within the handles (hApp) specified in the arguments. [eFrameworkunifiedStatusErrOther]
+/// - If the destination handles are inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is NULL [eFrameworkunifiedStatusErrOther]
+/// - If the application name in the destination handles is not set, [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - When the send data length (iLength) specified in the arguments is not 0 and the pointer to the send data pointer (pData) is NULL, [eFrameworkunifiedStatusErrOther]
+/// - When the name of the application in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle is NULL, [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - If the message queue type of the destination handler is not the send type [eFrameworkunifiedStatusErrOther]
+/// - When the message queue is full [eFrameworkunifiedStatusErrOther]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrOther]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrOther]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusErrOther]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Broadcast application-specific events to all registered applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// Events are delivered to all applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.
+/// The data (pData) to be distributed is the same for all distribution destinations.
+/// \~english @par
+/// This API is deprecated and should now use FrameworkunifiedPublishPublicEvent.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents,
+/// FrameworkunifiedPublishEvent, FrameworkunifiedPublishPublicEvent,
+/// FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackToDispatcherWithFd,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcherWithFd, FrameworkunifiedDetachCallbacksFromDispatcherWithFd,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to publish the event to all the clients subscribed to this event.
+/// This API is depricated, use FrameworkunifiedPublishPublicEvent.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] uiEventId
+/// UI_32 - Event id of Message
+/// \param [in] pData
+/// PCVOID - Data buffer
+/// \param [in] iLength
+/// UI_32 - Size of data buffer
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedRegisterEvent, FrameworkunifiedPublishEvent, FrameworkunifiedDefineStateEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedBroadcastEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 iLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDefinePublicStateEvents
+/// \~english @par Brief
+/// Subscribing to Application-Specific Events in the Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] puiEvents
+/// PUI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID array (0 to 4294967295)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (puiEvents) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Register unique events in your Dispatcher that applications can deliver to other applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// For application-specific events registered by this API, the event is delivered by Dispatcher when the application executes the FrameworkunifiedPublishPublicEvent.\n
+/// Events are distributed to all applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.
+/// \~english @par
+/// The difference from FrameworkunifiedDefinePrivateStateEvents is that when the Dispatcher distributes events registered by this API, the same data is distributed to all registered applications.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - The maximum number of event IDs that can be registered depends on the size that can be allocated as the area for the event ID array.\n
+/// Therefore, the API caller should consider the size of the event ID array and define the number of event IDs (uiListSize).
+/// - FrameworkunifiedDefinePrivateStateEvents should be used to deliver individual data by registered application sessions.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedPublishPublicEvent, FrameworkunifiedDefinePrivateStateEvents, FrameworkunifiedPublishPrivateEvent,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to define the public state events of the service.
+/// Public Event means the data associated with the event will be same for all the clients
+/// subscribed to it.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] puiEvents
+/// PUI_32 - Array of state events or single state event.
+/// \param [in] uiListSize
+/// UI_32 - size of events list.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedDefinePrivateStateEvents
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefinePublicStateEvents(HANDLE hApp, PUI_32 puiEvents, UI_32 uiListSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDefinePrivateStateEvents
+/// \~english @par Brief
+/// Subscribing to Application-Specific Events in the Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] puiEvents
+/// PUI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID array (0 to 4294967295)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (puiEvents) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Register unique events in your Dispatcher that applications can deliver to other applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// For application-specific events registered by this API, the event is delivered by Dispatcher when the application executes the FrameworkunifiedPublishPrivateEvent.\n
+/// Events are distributed to applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.
+/// \~english @par
+/// The difference from FrameworkunifiedDefinePublicStateEvents is that when the Dispatcher distributes events registered by this API, it distributes individual data by sessions of the registered application.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - The maximum number of event IDs that can be registered depends on the size that can be allocated as the area for the event ID array.\n
+/// Therefore, the API caller should consider the size of the event ID array and define the number of event IDs (uiListSize).
+/// - Use FrameworkunifiedDefinePublicStateEvents to deliver broadcasts to all registered applications.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedPublishPrivateEvent, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedPublishPublicEvent,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to define the private state events of the service.
+/// Private event means the data associated with the event will be specific for
+/// every session of all the clients on which it has subscribed.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] puiEvents
+/// PUI_32 - Array of state events or single state event.
+/// \param [in] uiListSize
+/// UI_32 - size of events list.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedDefinePublicStateEvents
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefinePrivateStateEvents(HANDLE hApp, PUI_32 puiEvents, UI_32 uiListSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSubscribeToSessionEventWithCallback
+/// \~english @par Brief
+/// Register delivery of service-specific events and set callback for receiving events
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - Event ID (Identification ID on the service protocol) (PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD)
+/// \~english @param [in] fpOnCmd
+/// CbFuncPtr - Pointer to callback function when event is received
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the callback function pointer (fpOnCmd) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sets the callback function for the event ID (iCmd) specified in the application Dispatcher.\n
+/// Then, it issues a request for registering the application that executed this API to the delivery target of the device-specific events of the service associated with the handle (hSession) specified in the argument.\n
+/// The application specifies the type of event to be received from the service by the event ID (uiEventId) of the arguments.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message. The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedSubscribeToSessionEventsWithCallbacks, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used for subscribing to single event of a service.
+/// This API also attaches the session event with callback.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] uiEventId
+/// UI_32 - Event id
+/// \param [in] fpOnCmd
+/// CbFuncPtr - pointer to callback function
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSubscribeToSessionEventsWithCallbacks
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventWithCallback(HANDLE hApp, UI_32 uiEventId, CbFuncPtr fpOnCmd, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSubscribeToSessionEventsWithCallbacks
+/// \~english @par Brief
+/// Registering multiple service-specific events for delivery and configuring callback settings when an event is received
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pEventHandler
+/// const FrameworkunifiedProtocolCallbackHandler* - Pointer to array of event handler structure
+/// \~english @param [in] uiHandlerCount
+/// UI_32 - Number of event handlers to register (0 to 214748362)
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @par
+/// FrameworkunifiedProtocolCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedProtocolCallbackHandler
+/// {
+/// UI_32 iCmd; /* Event ID (Identification ID on the service's protocol) */
+/// CbFuncPtr callBack; /* Reference to an XML stream */
+/// }FrameworkunifiedProtocolCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the event handler structure array (pEventHandler) specified by arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Sets the callback functions for the IDs specified by the pEventHandler arguments in the Dispatcher of the application.\n
+/// Then, it issues a request for registering the application that executed this API to the delivery target of the device-specific events of the service associated with the handle (hSession) specified in the argument.\n
+/// The application specifies the type of event to be received from the service by the event ID.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message. The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the callback function pointer in the event handler structure (pEventHandler) specified in the arguments is NULL, the callback function up to NULL is registered.\n
+/// Later, FrameworkunifiedSendMsg() is executed inside this API, and the result becomes the return code of this API.\n
+/// Do not set NULL in the callback function pointer because operation cannot be guaranteed.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used for subscribing to multiple events of a service.
+/// This API also attaches the session event with callbacks.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pEventHandler
+/// FrameworkunifiedProtocolCallbackHandler - Array of event handler structures
+/// \param [in] uiHandlerCount
+/// UI_32 - number of event handlers
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSubscribeToSessionEventWithCallback
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventsWithCallbacks(HANDLE hApp, const FrameworkunifiedProtocolCallbackHandler *pEventHandler,
+ UI_32 uiHandlerCount, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnSubscribeSessionEventWithCallback
+/// \~english @par Brief
+/// Undeliver service-specific events and delete callbacks when events are received
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - Event ID (Identification ID on the service protocol) (PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD)
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// - If the service specified by the parameter hSession is not registered in the Dispatcher, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Issues a request to unregister the application that executed this API from the delivery target of device-specific events
+/// of services associated with the handle (hSession) specified in the arguments.\n
+/// Then, the callback functions for the specified event ID (iCmd) are deleted from the application Dispatcher.\n
+/// The application specifies the type of event to be undelivered from the service by the event ID (uiEventId) of the arguments.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message.
+/// The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedUnSubscribeSessionEventsWithCallbacks, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks
+///
+/// API to unsubscribe from event of a service. Also detaches callback.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] uiEventId
+/// UI_32 - Event id
+/// \param [in] hSession
+/// HANDLE - Session Handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventWithCallback(HANDLE hApp, UI_32 uiEventId, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+/// \~english @par Brief
+/// Undeliver multiple service-specific events and delete callbacks when an event is received
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pEventsArray
+/// PUI_32 - Pointer to an array of Event IDs (Identification IDs in the service's protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID (identification ID in the service protocol) array (1 to 1073741813)
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (pEventsArray) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldBuf]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// - When the number of elements (uiListSize) of the event ID array specified by the arguments is 0, [eFrameworkunifiedStatusInvldParam]
+/// - If the service specified by the parameter hSession is not registered in the Dispatcher, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Issues a request to unregister the application that executed this API from the delivery target of the plurality of unique events of the service associated with the handle (hSession) specified by the argument.\n
+/// Then, the callback functions for the IDs specified in the pEventsArray arguments are deleted from the application Dispatcher.\n
+/// The application specifies the type of event to be undelivered from the service by the event ID (pEventsArray) of the arguments.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message. The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks
+///
+/// API to unsubscribe from multiple events of a service. Also detaches callbacks.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] pEventsArray
+/// PUI_32 - Array of events id's.
+/// \param [in] uiListSize
+/// UI_32 - count of elements in array.
+/// \param [in] hSession
+/// HANDLE - Session Handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnSubscribeSessionEventWithCallback
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventsWithCallbacks(HANDLE hApp, PUI_32 pEventsArray, UI_32 uiListSize,
+ HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedPublishPublicEvent
+/// \~english @par Brief
+/// Broadcast application-specific events
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] pData
+/// PCVOID - Pointer to trasmission data
+/// \~english @param [in] uiLength
+/// UI_32 - Transmission data length
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - The events to be delivered must be specified in the FrameworkunifiedDefinePublicStateEvents.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the application name of the delivery destination in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - Sessioninformation is not found with the application being delivered to within the handles (hApp) specified in the arguments. [eFrameworkunifiedStatusErrOther]
+/// - If the destination handles are inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is NULL [eFrameworkunifiedStatusErrOther]
+/// - If the application name in the destination handles is not set, [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - When the send data length (uiLength) specified in the arguments is not 0 and the pointer to the send data pointer (pData) is NULL [eFrameworkunifiedStatusErrOther]
+/// - When the name of the application in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle is NULL, [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - If the message queue type of the destination handler is not the send type [eFrameworkunifiedStatusErrOther]
+/// - When the message queue is full [eFrameworkunifiedStatusErrOther]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrOther]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrOther]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusErrOther]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusErrOther]
+/// - Failed to access shared memory for sending messages [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Broadcast application-specific events to subscribed applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// Events are delivered to all applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.\n
+/// The data (pData) to be distributed is the same for all distribution destinations.
+/// \~english @par
+/// FrameworkunifiedPublishPrivateEvent should be used to deliver individual data by registered application sessions.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents, FrameworkunifiedPublishPrivateEvent,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to publish the event to all the client over all the session it is subscribed to.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] uiEventId
+/// UI_32 - Event id of Message
+/// \param [in] pData
+/// PCVOID - Data buffer
+/// \param [in] uiLength
+/// UI_32 - Size of data buffer
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedPublishPrivateEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishPublicEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedPublishPrivateEvent
+/// \~english @par Brief
+/// Delivers application-specific events to a specified session
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] pData
+/// PCVOID - Pointer to trasmission data
+/// \~english @param [in] uiLength
+/// UI_32 - Transmission data length
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusServNotFound Perform the event processing
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - The events to be delivered must be specified in the FrameworkunifiedDefinePrivateStateEvents.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the application handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application handle (hApp) specified in the arguments is not appropriate (disabled) [eFrameworkunifiedStatusInvldParam]
+/// - If the session handle (hSession) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the sessionhandle (hSession) specified in the arguments is not appropriate (is not valid) [eFrameworkunifiedStatusInvldParam]
+/// - The event ID (uiEventId) specified in the parameter is not registered as an event to be delivered to the Dispatcher. [eFrameworkunifiedStatusServNotFound]
+/// - When the session handle (hSession) specified in the arguments is not registered as the delivery destination in the Dispatcher [eFrameworkunifiedStatusServNotFound]
+/// - When the message queue handle in the session handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the application name in the session handle (hSession) specified by the arguments is not set [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue handle in the session handle (hSession) specified by the arguments is invalid. [eFrameworkunifiedStatusInvldHandle]
+/// - When the send data length (uiLength) specified in the arguments is not 0 and the pointer to the send data pointer (pData) is NULL [eFrameworkunifiedStatusInvldBuf]
+/// - When the name of the application in the session handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the session handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the session handle (hSession) specified in the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the session handle (hSession) specified in the parameter is not the send type [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Delivers application-specific events to specified sessions in registered applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// Events are delivered to the sessions specified in the hSession of arguments among the applications registered in the FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - When broadcasting to all registered applications, use FrameworkunifiedPublishPublicEvent.
+/// - This API shall be executed from within a callback function, and a session-use handle acquired using FrameworkunifiedGetCurrentSessionHandle shall be passed to the parameter hSession.
+/// - Operation cannot be guaranteed if the size of the area indicated by the pointer (pData) address to the send data does not match
+/// the size specified by the send data length (iLength) address.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedDefinePrivateStateEvents, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedPublishPublicEvent,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to publish the event over session to the client subscribed to it using session handle.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] uiEventId
+/// UI_32 - Event id of Message
+/// \param [in] pData
+/// PCVOID - Data buffer
+/// \param [in] uiLength
+/// UI_32 - Size of data buffer
+/// \param [in] hSession
+/// HANDLE - Session Handle
+///
+/// \return EFrameworkunifiedStatus
+/// eFrameworkunifiedStatusOK - If publish event success
+/// eFrameworkunifiedStatusInvldParam - Invalid parameter passed
+/// eFrameworkunifiedStatusServNotFound - If event uiEventId not subscribed on hSession by a client
+/// Any other values returned by FrameworkunifiedSendMsg
+///
+/// \see FrameworkunifiedPublishPublicEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishPrivateEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetServiceAvailabilityTable
+/// returns the list that stores the available services
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application session
+
+/// \return ServiceAvailabilityList
+/// ServiceAvailabilityTable - ServiceAvailabilityList
+///
+/// \see FrameworkunifiedRegisterEvent
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+std::map<std::string, EFrameworkunifiedServiceAvailableStatus> FrameworkunifiedGetServiceAvailabilityTable(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedIsStateMachineApp
+/// \~english @par Brief
+/// Returns the presence or absence of a State Machine Application
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval BOOL State Machine Application existence (TRUE: existent/FALSE: nonexistent)
+/// \~english @retval FALSE Judgment failure
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [FALSE]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [FALSE]
+/// \~english @par Detail
+/// Determines whether there is a State Machine Application from the application handle specified by the arguments, and returns the handle.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see FrameworkunifiedSetStateMachine, FrameworkunifiedHSMDispatcherWithArguments
+///
+/// FrameworkunifiedIsStateMachineApp
+/// Returns TRUE if it's a state machine application else FALSE.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application session
+///
+/// \return TRUE - if a state machine application.
+/// FALSE - if not a state machine application
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsStateMachineApp(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetXMLConfigHandle
+/// Returns the handle to config file handle
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application session
+///
+/// \return handle
+/// HANDLE - Config file handle
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetXMLConfigHandle(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetNumberOfSession
+/// API to get the number of sessions created in the system.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] strServiceName
+/// PCSTR - Service name.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetNumberOfSession(HANDLE hApp, PCSTR strServiceName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetSessionHandle
+/// \~english @par Brief
+/// Registering Session Handles with an Application Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] strServiceName
+/// PCSTR - Service name established for the session
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (Acquired by FrameworkunifiedGetOpenSessionHandle, etc.)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - If the service-name (strServiceName) specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the length of the service-name (strServiceName) specified in the arguments is 0, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// After the application establishes a session with the service using a FrameworkunifiedOpenSession or the like,
+/// the session handle is registered in the application Dispatcher in association with the service name and session ID.
+/// Session handles shall be acquired by using a FrameworkunifiedGetOpenSessionHandle or the like when a response is received from the service.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedGetSessionHandle, FrameworkunifiedRemoveSessionHandle,
+/// FrameworkunifiedOpenSession, FrameworkunifiedOpenSessionWithData, FrameworkunifiedOpenSessionSync, FrameworkunifiedOpenSessionWithDataSync,
+/// FrameworkunifiedGetOpenSessionHandle, FrameworkunifiedGetOpenSessionSyncHandle,
+///
+/// Sets the session handle in the Application Framework. It stores the mapping between
+/// source, session id and session handle in the application framework.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] strServiceName
+/// PCSTR -Name of the associated service name
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedCreateSession, FrameworkunifiedGetSessionHandle, FrameworkunifiedRemoveSessionHandle.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetSessionHandle(HANDLE hApp, PCSTR strServiceName, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetSessionHandle
+/// \~english @par Brief
+/// Get the session handle for the given service name and session ID
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] strServiceName
+/// PCSTR - service name
+/// \~english @param [in] uiSessionId
+/// UI_32 - session ID
+/// \~english @retval HANDLE Handles for sessions
+/// \~english @retval NULL NULL pointer(Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// - If the service-name (strServiceName) specified in the parameter is NULL, [NULL]
+/// - If the session with the service name (strServiceName) specified in the parameter is not registered in the Dispatcher, [NULL]
+/// - If the session with the session ID name (uiSessionId) specified in the parameter is not registered in the Dispatcher, [NULL]
+/// \~english @par Detail
+/// Gets and returns the session handle associated with the specified service and session id from the application Dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedSetSessionHandle, FrameworkunifiedRemoveSessionHandle
+///
+/// Returns the requested session handle associated with service name and session id.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] strServiceName
+/// PCSTR -Name of the associated service name
+/// \param [in] uiSessionId
+/// HANDLE - Session Id
+///
+/// \return handle
+/// HANDLE - Session handle
+///
+/// \see FrameworkunifiedSetSessionHandle
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetSessionHandle(HANDLE hApp, PCSTR strServiceName, UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetCurrentSessionHandle
+/// \~english @par Brief
+/// Get the session handle for the most recent incoming message
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval HANDLE Handles for sessions
+/// \~english @retval NULL NULL pointer (Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// - When the source service name obtained from received messages is NULL [NULL]
+/// - If the Dispatcher does not have a session associated with the source service-name retrieved from the received message [NULL]
+/// - When the session ID acquired from the received message is not registered in the Dispatcher, [NULL]
+/// \~english @par Detail
+/// Gets and returns the session-handle associated with the most recently received message from the application's Dispatcher.
+/// \~english @par
+/// The application shall execute this API using an application handle passed as an argument to the callback function.\n
+/// (The callback functions are executed after the information required to execute the APIs is stored in the application handles (hApp) by receiving messages in the frameworks.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedGetSessionHandle, FrameworkunifiedSetSessionHandle
+///
+/// Returns the session handle for the current session. Useful, if used in the callback
+/// function of protocol. Current session means on which the protocol message received.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \return handle
+/// HANDLE - Session handle
+///
+/// \see FrameworkunifiedSetSessionHandle, FrameworkunifiedGetSessionHandle.
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetCurrentSessionHandle(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedRemoveSessionHandle
+/// \~english @par Brief
+/// Deletes the session handle for the given service name and session ID
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] strServiceName
+/// PCSTR - Service name
+/// \~english @param [in] uiSessionId
+/// UI_32 - session ID
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - If the service-name (strServiceName) specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the length of the service-name (strServiceName) specified in the arguments is 0, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This service call deletes the session handle associated with the specified service name and session ID among the session handles registered in the application's Dispatcher by FrameworkunifiedSetSessionHandle.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - When a session ID that has been deleted (or unregistered) is specified, this API returns an eFrameworkunifiedStatusOK.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedSetSessionHandle
+///
+/// Removes the session handle from the Application Framework associated with service name
+/// and session id. It actually removes the mapping between source, session id and session
+/// handle in the application framework which was set using FrameworkunifiedSetSessionHandle.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] strServiceName
+/// PCSTR -Name of the associated service name
+/// \param [in] uiSessionId
+/// HANDLE - Session Id
+///
+/// \return handle
+/// HANDLE - Session handle
+///
+/// \see FrameworkunifiedSetSessionHandle
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRemoveSessionHandle(HANDLE hApp, PCSTR strServiceName, UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetMandatoryServiceInfo
+/// \~english @par Brief
+/// Registers the specified Notification and event ID in the Notification list of the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pNotification
+/// PCSTR - Notification name
+/// \~english @param [in] uiEventId
+/// UI_32 - Event ID (Identification ID on the service's protocol)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the Notification name (pNotification) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the length of the Notification name (pNotification) specified in the arguments is 64 bytes or greater, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Registers the specified Notification and event ID in the Notification list of the Dispatcher.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// By registering a Notification with this API, a Notification registration/unregistration request
+/// to the notification service (NS_NPPService) is automatically issued by the Dispatcher when the Dispatcher starts/ends.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the Notification name is specified as an empty character, eFrameworkunifiedStatusOK is returned. Cannot guarantee operation.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Broadcast
+/// \~english @see
+///
+/// Sets the given service as Mandatory service in application handle
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNotification
+/// PCSTR -Name of the Notification
+/// \param [in] uiEventId
+/// UI_32 - event id
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetMandatoryServiceInfo(HANDLE hApp, PCSTR pNotification, UI_32 uiEventId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetSessionName
+/// \~english @par Brief
+/// Gets the name of the message queue from the session handle
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions
+/// \~english @retval PCSTR Pointer to the message queue name
+/// \~english @retval NULL NULL pointer (Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hSession specified in the parameter is NULL, [NULL]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [NULL]
+/// \~english @par Detail
+/// Gets the name of the message queue from the session handle (hSession) passed in the parameter.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+///
+/// Returns the session name corresponding to the given session handle.
+///
+///
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return session_name
+/// PCSTR - Session name
+///
+/// \see
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetSessionName(HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedIsServiceAvailable
+/// \~english @par Brief
+/// Determine the availability of services
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval BOOL Use (TRUE: Available, FALSE: Not Available)
+/// \~english @retval FALSE Acquisition failure
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [FALSE]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [FALSE]
+/// - If the received message is not a service-availability notice... [FALSE]
+/// - Incoming messages are invalid [FALSE]
+/// \~english @par Detail
+/// Based on the received Notification, the service is judged to be usable or unusable, and true/false is returned.
+/// \~english @par
+/// The application shall execute this API using the handle of the application passed as the argument of the service availability notification callback function.\n
+/// (The callback functions are executed after the information required to execute the APIs is stored in the application handles (hApp) by receiving messages in the frameworks.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Broadcast
+/// \~english @see FrameworkunifiedGetServiceNameOnServiceAvailabilityNotification,
+/// FrameworkunifiedSubscribeNotificationWithCallback, FrameworkunifiedSubscribeNotificationsWithCallback
+///
+/// This API should only be called in the callback/reaction associated with the Service
+/// availability notification. It returns TRUE if service is available and FALSE if service
+/// is not available.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return service_availability
+/// BOOL - returns TRUE if service is available otherwise returns FALSE
+///
+/// \see
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsServiceAvailable(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedPublishServiceAvailability
+/// \~english @par Brief
+/// Publish application availability status
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] bIsAvailable
+/// BOOL - Availability status of the application (TRUE: Available, FALSE: Not Available)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Notification must be registered by FrameworkunifiedRegisterServiceAvailabilityNotification.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - If the service-availability Notification is not set for the handle (hApp) specified in the parameter, [eFrameworkunifiedStatusFail]
+/// - When the message queue handle for NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hApp) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle for NPP services in the handle (hApp) specified in the arguments is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hApp) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue for the NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue for NPP services in the handle (hApp) specified in the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - If the message queue type is not the send type [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusErrFail]
+/// \~english @par Detail
+/// Notifies (issues a Notification) the availability status of an application to another application.\n
+/// Applications must use this API to notify other applications when the availability of services provided by the application changes.\n
+/// (However, the state machine managed application generated by FrameworkunifiedHSMDispatcherWithArguments, etc. is excluded because the state machine automatically issues a Notification.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Broadcast
+/// \~english @see FrameworkunifiedRegisterServiceAvailabilityNotification, FrameworkunifiedGetSelfAvailability
+///
+/// This API publishes service availability status of the service. This API needs to be
+/// used when service is up and ready to process clients requests.
+/// FrameworkunifiedRegisterServiceAvailabilityNotification must be called before calling this API.
+/// In Frameworkunified HSM Framework based application service availability is published by the Framework
+/// So this API can be used only in Non-FRAMEWORKUNIFIED HSM based application.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] bIsAvailable
+/// BOOL - TRUE if Service Available and FALSE if service is unavailable
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+/// FrameworkunifiedRegisterServiceAvailabilityNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishServiceAvailability(HANDLE hApp, BOOL bIsAvailable);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetSelfAvailability
+/// \~english @par Brief
+/// Gets the availability status of the application itself
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval BOOL Use (TRUE: Available, FALSE: Not Available)
+/// \~english @retval FALSE Acquisition failure
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [FALSE]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [FALSE]
+/// \~english @par Detail
+/// Gets the availability status of the applications managed in the Dispatcher.\n
+/// Availability states are the values specified by the application when the FrameworkunifiedPublishServiceAvailability is executed.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see FrameworkunifiedPublishServiceAvailability
+///
+/// This API get service availability status of the service. This API needs to be
+/// used when service is up and ready to process clients requests.
+/// FrameworkunifiedRegisterServiceAvailabilityNotification must be called before calling this API.
+/// In Frameworkunified HSM Framework based application service availability is published by the Framework
+/// So this API can be used only in Non-FRAMEWORKUNIFIED HSM based application.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+/// FrameworkunifiedRegisterServiceAvailabilityNotification, FrameworkunifiedPublishServiceAvailability
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedGetSelfAvailability(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedRegisterServiceAvailabilityNotification
+/// \~english @par Brief
+/// Registering Application Availability Notification with NPP-Service
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pNotification
+/// PCSTR - Pointers to Notification names
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the Notification name (pNotification) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the length of the Notification name (pNotification) specified in the arguments is 64 bytes or greater, [eFrameworkunifiedStatusFail]
+/// - When the length of the Notification name (pNotification) specified in the arguments is 0, [eFrameworkunifiedStatusInvldParam]
+/// - Get buffer for sending messages (malloc) failed [eFrameworkunifiedStatusFail]
+/// - When the message queue handle for NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle for NPP services in the handle (hApp) specified in the arguments is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hApp) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue for the NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue for NPP services in the handle (hApp) specified in the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - If the message queue type is not the send type [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusErrFail]
+/// \~english @par Detail
+/// Requests that NPPservice register a Notification to notify the application availability status.\n
+/// A Notification registered by this API can publish the availability status to other applications by executing FrameworkunifiedPublishServiceAvailability from the application.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation is not guaranteed when the same application executes this API more than once with different Notification names.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Broadcast
+/// \~english @see FrameworkunifiedUnRegisterServiceAvailabilityNotification, FrameworkunifiedPublishServiceAvailability
+///
+/// This API registers the given service availability notification. Need to be used by
+/// service.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNotification
+/// PCSTR -Name of the Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+/// FrameworkunifiedPublishServiceAvailability
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRegisterServiceAvailabilityNotification(HANDLE hApp, PCSTR pNotification);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnRegisterServiceAvailabilityNotification
+/// \~english @par Brief
+/// Revoke application availability Notification from NPPservice
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Notification must be registered by FrameworkunifiedRegisterServiceAvailabilityNotification.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - If the service-availability Notification is not set for the handle (hApp) specified in the parameter, [eFrameworkunifiedStatusInvldParam]
+/// - Get buffer for sending messages (malloc) failed [eFrameworkunifiedStatusFail]
+/// - When the message queue handle for NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle for NPP services in the handle (hApp) specified in the arguments is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hApp) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue for the NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue for NPP services in the handle (hApp) specified in the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - If the message queue type is not the send type [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Requests that NPPservice abandon the Notification to notify the availability status of the application that executed this API.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Broadcast
+/// \~english @see FrameworkunifiedRegisterServiceAvailabilityNotification
+///
+/// This API unregisters the service availability notification
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+/// FrameworkunifiedPublishServiceAvailability, FrameworkunifiedRegisterServiceAvailabilityNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterServiceAvailabilityNotification(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateSession
+/// \~english @par Brief
+/// Create handles for sessions and register them with the application's Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pSessionName
+/// PCSTR - Session name (application name or thread name)
+/// \~english @retval HANDLE Handles for sessions
+/// \~english @retval NULL NULL pointer (Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// - The session name (pSessionName) specified in the arguments is invalid.
+/// (For NULL, if the length is 0 or 20 bytes or more) [NULL]
+/// - When acquisition (malloc) of the message queue management information area fails, [NULL]
+/// - When the normalized message queue name from the session name (pSessionName) is inappropriate (exceeds 16 bytes) [NULL]
+/// - When acquisition (malloc) of the storage area for the message queue name fails, [NULL]
+/// - The open of the message queue (mq_open) failed [NULL]
+/// \~english @par Detail
+/// Creates handles (send message queues) for sessions with the specified application and registers them in the application's Dispatcher.\n
+/// The pSessionName is set to the application name or thread name of the client that establishes the session.\n
+/// This API is used to establish a session with a client application when an application on the service providing side receives a session start request from the client application.
+/// The application shall execute this API from the corresponding callback function.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedDestroySession
+///
+/// This API generates the session handle and sets it in the Application Framework. This API
+/// should be used by the server in the callback function attached to the open session request.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pSessionName
+/// PCSTR - SessionName can be application name or thread name
+///
+/// \return session_handle
+/// HANDLE - Session Handle
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateSession(HANDLE hApp, PCSTR pSessionName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDestroySession
+/// \~english @par Brief
+/// Destroys the session handle and removes the session handle from the application Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] hSession
+/// HANDLE - Handle for sessions (handle obtained with FrameworkunifiedCreateSession)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - When the length of the message queue name of the handle (hSession) specified in the arguments is 0, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Destroys the specified session handle and removes the specified session handle from the application Dispatcher.\n
+/// This API is used when the service-providing application receives a session termination request from the client application and discards the session with the client application.
+/// The application shall execute this API from the corresponding callback function.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedCreateSession
+///
+/// This API destroys the session handle and removes it from the Application Framework.
+/// This API should be called by the server in the callback attached to the close session
+/// request
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDestroySession(HANDLE hApp, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendResponse
+/// \~english @par Brief
+/// Sending a Response to the Source of an Incoming Message
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] iCmd
+/// UI_32 - Identification ID on the service's protocol
+/// \~english @param [in] length
+/// UI_32 - Data size to be sent (0 to 4294967255)
+/// \~english @param [in] data
+/// PCVOID - Pointer to the data to send
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Sessions are registered in the Dispatcher by FrameworkunifiedCreateSession, etc.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - When the source service name obtained from received messages is NULL [eFrameworkunifiedStatusFail]
+/// - If the Dispatcher does not have a session associated with the source service-name retrieved from the received message [eFrameworkunifiedStatusFail]
+/// - When the session ID acquired from the received message is not registered in the Dispatcher, [eFrameworkunifiedStatusFail]
+/// - If the sessionhandle for incoming messages is NULL [eFrameworkunifiedStatusNullPointer]
+/// - If the handles for sessions corresponding to incoming messages are inappropriate (disabled) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle corresponding to the received message in the session handle is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - When the application name length in the session handle corresponding to received messages is 0, [eFrameworkunifiedStatusInvldHandle]
+/// - Incorrect (invalid) message queue handle in session handle for incoming message [eFrameworkunifiedStatusInvldHandle]
+/// - When the data (data) of the send message specified by the parameter is NULL and the data length (length) is not 0, [eFrameworkunifiedStatusInvldBuf]
+/// - When the length of the application name in the session handle corresponding to the received message exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the message queue name of the session handle corresponding to the received message is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue name of the session handle corresponding to the received message exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the session handle corresponding to the received message is not the transmission type [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages [eFrameworkunifiedStatusErrOther]
+/// - When the size (length) of the data to be sent specified in the parameter is out of range, [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Gets the session ID and session name from received messages, and the corresponding session handles from Dispatcher.\n
+/// Send a response to the sender of the received message using the acquired session handle.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - The maximum data size (length) described above is a theoretical value. The maximum data size that can be actually used depends on the environment requirements.\n
+/// The maximum value is the upper limit of the type (UINT_MAX) minus the following size.\n
+/// Message header section\n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address of the pointer (data) to the data buffer does not match the size specified by the size of the data buffer (length).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method
+/// \~english @see FrameworkunifiedCreateSession, FrameworkunifiedSetSessionHandle
+///
+/// This API retrieves the session handle from the application framework and sends the response
+/// to the client on the same session. The session id and message source name available in the
+/// hApp at that instance is used to get the session handle. This API will work if server has
+/// created session using FrameworkunifiedCreateSession or has used FrameworkunifiedSetSessionHandle after creating the
+/// session.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] iCmd
+/// UI_32 - Protocol command
+/// \param [in] length
+/// UI_32 - size of message data
+/// \param [in] data
+/// PCVOID - message data
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedCreateSession, FrameworkunifiedSetSessionHandle, FrameworkunifiedSendRequest.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendResponse(HANDLE hApp, UI_32 iCmd, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendRequest
+/// This API retrieves the session handle from the application framework and sends the request
+/// to the server with specific service name and session id. This API will work, if application
+/// has previously stored associated session handle using FrameworkunifiedSetSessionHandle.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pServerName
+/// PCSTR - Name of the server
+/// \param [in] uiSessionId
+/// UI_32 - session id
+/// \param [in] iCmd
+/// UI_32 - Protocol command
+/// \param [in] length
+/// UI_32 - size of message data
+/// \param [in] data
+/// PCVOID - message data
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSetSessionHandle, FrameworkunifiedSendResponse
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendRequest(HANDLE hApp, PCSTR pServerName, UI_32 uiSessionId, UI_32 iCmd,
+ UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetPersonality
+/// API to send message to Notification Service to set Personality
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] pUserName
+/// PCSTR - Name of the new Personality
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPLoadPersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersonality(HANDLE hApp, PCSTR pUserName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPChangePersonality
+/// API to send message to Notification Service to set new Personality
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] pUserName
+/// PCSTR - Name of the new Personality
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPLoadPersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPChangePersonality(HANDLE hApp, PCSTR pUserName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendStopToNSNPP
+/// \~english @par Brief
+/// API that sends a message to the notification service and requests a shutdown
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] eShutdownType
+/// EFrameworkunifiedShutdownType - Shutdown type
+/// \~english @param [in] uiStopMsgData
+/// UI_32 - Flag subject to resetting (Default:0)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends a message to the notification service (NS_NPPService) and requests shutdown.\n
+/// The reset target flag (uiStopMsgData) is valid only when the shutdown type (eShutdownType) is eFrameworkunifiedDataResetShutdown.\n
+/// The reset target flag (uiStopMsgData) indicates the target of data reset at shutdown.\n
+/// The target can be OR-set by using EFrameworkunifiedPersistCategory defined values.\n
+/// The specified target is reset from the non-volatile memory.
+/// Eg: uiStopMsgData = (eFrameworkunifiedUserData | eFrameworkunifiedFactoryCustomerData) = 0x0101\n
+/// eFrameworkunifiedUserData bit : 1 : user data resets\n
+/// eFrameworkunifiedFactoryData bit : 0 : factory data not reset-target\n
+/// eFrameworkunifiedFactoryCustomerData bit : 1 : factory customer data resets\n
+/// eFrameworkunifiedDealerData bit : 0 : persist dealer data not reset-target\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+///
+/// FrameworkunifiedSendStopToNSNPP
+/// To be used by System Manager Service only. This API would push NPP Service to persist
+/// the data/files. Ideally this should be sent during system shutdown by System Manager Service
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+///
+/// \param [in] eShutdownType
+/// EFrameworkunifiedShutdownType - shutdown type
+///
+/// \param [in] uiStopMsgData
+/// UI_32 - Flag representing which data to persist and which data to delete from
+/// persistent memory during shutdown.
+/// This needs to be specified only when shutdown type is eFrameworkunifiedDataResetShutdown.
+/// If not specified with DataReset type, then NPP will do normal shutdown.
+/// For other shutdown type this parameter has no effect.
+/// uiStopMsgData = 0 means Normal shutdown persisting all data
+/// else value from enum EFrameworkunifiedPersistCategory, multiple value from enum can be ORed.
+/// Bit value 1 represent resetting of data while value 0 bit represent data persisting
+/// Eg: uiStopMsgData = (eFrameworkunifiedUserData|eFrameworkunifiedFactoryCustomerData) = 0x0101 indicates
+/// eFrameworkunifiedUserData bit value 1 means delete user data
+/// eFrameworkunifiedFactoryData bit value 0 means persist factory data
+/// eFrameworkunifiedFactoryCustomerData bit value 1 means delete factory customer data
+/// eFrameworkunifiedDealerData bit value 0 means persist dealer data
+///
+/// \return status
+/// EFrameworkunifiedStatus - success if request sent to NPPService or error
+/// \~english @par Type
+/// Pub-Sub
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendStopToNSNPP(HANDLE hApp, EFrameworkunifiedShutdownType eShutdownType, UI_32 uiStopMsgData = 0x0);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPGetReadyStatusOfNPP
+/// \~english @par Brief
+/// APIs that send messages to notification services and obtain Ready status
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends messages to the notification service (NS_NPPService) and acquires the Ready status.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method
+/// \~english @see
+///
+/// FrameworkunifiedNPGetReadyStatusOfNPP
+/// To be used by System Manager Service only. SystemManager will use this API to get the
+/// ready status of NPPService.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success if request sent to NPPService or error
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPGetReadyStatusOfNPP(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetServiceNameOnServiceAvailabilityNotification
+/// \~english @par Brief
+/// Get the available service names
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [out] pServiceName
+/// PSTR - Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the service-name storage area (pServiceName) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the received message is not a service-availability notice... [eFrameworkunifiedStatusFail]
+/// - Incoming messages are invalid [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// When an application receives a service availability notification, it gets the name of the available service.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - The application shall execute this API using an application handle passed as an argument to the callback function.\n
+/// (The callback functions are executed after the information required to execute the APIs is stored in the application handles (hApp) by receiving messages in the frameworks.)
+/// - The size of the buffer passed in the argument pServiceName must be at least MAX_NAME_SIZE_APP(20).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see FrameworkunifiedIsServiceAvailable, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback
+///
+/// To be used when client receives service availability notification to get the available
+/// service name.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [out] pServiceName
+/// PSTR - Name of the available service.
+/// Size of the buffer should be equal to or greater than MAX_NAME_SIZE_APP
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetServiceNameOnServiceAvailabilityNotification(HANDLE hApp, PSTR pServiceName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetCurrentUser
+/// Get the current user for the application
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \return userhandle
+/// HANDLE - Returns current user handle
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetCurrentUser(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSetUser
+/// Set the current user for the application in application framework
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] hUser
+/// HANDLE - User handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetUser(HANDLE hApp, HANDLE hUser);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetAppData
+/// \~english @par Brief
+/// Hold the specified arbitrary data
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pKey
+/// PCSTR - Key strings
+/// \~english @param [in] pData
+/// PVOID - Service name that can be used
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Retention failure
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the addresses of the key strings are NULL [eFrameworkunifiedStatusInvldParam]
+/// - Failed to retain arbitrary data. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This function stores an arbitrary data address in the heap using the specified key string as a key.
+/// Since the object to be held is an address, the caller must specify an accessible global address, etc.
+/// The caller should pay attention to the addresses of arbitrary data, since they retain the addresses of arbitrary data even if they are NULL.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Set Get
+/// \~english @see FrameworkunifiedGetAppData, FrameworkunifiedRemoveAppData
+///
+/// FrameworkunifiedSetAppData
+/// This API stores the data pointer against a key in application framework. This can be used
+/// as a global data and can be accessed in the FRAMEWORKUNIFIED functions. Please note that application
+/// developer should avoid using global data.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pKey
+/// PSTR - Data key
+/// \param [in] pData
+/// PVOID - data
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedGetAppData, FrameworkunifiedRemoveAppData
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetAppData(HANDLE hApp, PCSTR pKey, PVOID pData);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetAppData
+/// \~english @par Brief
+/// Returns the address of any data associated with the key string
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pKey
+/// PCSTR - Key strings
+/// \~english @retval PVOID Address of arbitrary data
+/// \~english @retval NULL NULL pointers (unsuccessful retrieval, anomaly parameters)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// - If the addresses of the Key strings are NULL [NULL]
+/// \~english @par Detail
+/// Returns the corresponding data address using the specified key string as the key.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Set Get
+/// \~english @see FrameworkunifiedSetAppData, FrameworkunifiedRemoveAppData
+///
+/// FrameworkunifiedGetAppData
+/// This API retrieves the data stored against a key in application framework.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pKey
+/// PSTR - Data key
+/// \return [in] pData
+/// PVOID - data
+///
+/// \see FrameworkunifiedSetAppData, FrameworkunifiedRemoveAppData
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID FrameworkunifiedGetAppData(HANDLE hApp, PCSTR pKey);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedRemoveAppData
+/// This API removes the data stored against a key in application framework.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pKey
+/// PSTR - Data key
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSetAppData, FrameworkunifiedGetAppData
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRemoveAppData(HANDLE hApp, PCSTR pKey);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetSystemInfo
+/// Gets some internal notification information
+///
+/// \param [in] hApp
+/// HANDLE - Handle to a Application Framework
+/// \param [in, out] pSystemInfo
+/// PVOID - Buffer pointer to which system info is copied.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetSystemInfo(HANDLE hApp, PVOID pSystemInfo);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSetDeferredSyncResponse
+/// Set sync response deferred flag
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the dispatcher to receive message
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetDeferredSyncResponse(HANDLE hApp);
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_H__ */ // NOLINT (build/header_guard)
+/**@}*/ // end of framework
+/**@}*/ // end of framework_unified
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_sync.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_sync.h
new file mode 100755
index 0000000..3573e8c
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_sync.h
@@ -0,0 +1,370 @@
+/*
+ *
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeService
+/// \brief This file contains the class declaration for synchronization
+/// API's.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_framework_sync.h
+ * @brief \~english This file contains the class declaration for synchronization
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYNC_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYNC_H__
+
+#include <pthread.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <time.h>
+#include <map>
+#include <string>
+
+struct SFrameworkunifiedSyncDataPacket;
+
+// Map containing the synchronization data as per the notification
+typedef std::map<std::string, SFrameworkunifiedSyncDataPacket *> TSyncDataPacketList;
+
+// Iterator to the map containing the synchronization data as per the notification
+typedef TSyncDataPacketList::iterator TSyncDataPacketItr;
+
+/**
+ * @class CFrameworkunifiedSyncData
+ * \~english @brief this file has the CFrameworkunifiedSyncData class definitions
+ * \~english @par Brief Introduction
+ * - This class provids some functions to handle the synchronization data as per the notification.
+ *
+ */
+class CFrameworkunifiedSyncData {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - This function is used to get the singleton instance of class.
+ /// \~english @param None
+ /// \~english @retval CFrameworkunifiedSyncData - singleton instance of class
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - If m_psSyncData is NULL,will create a new object,otherwise, will return m_psSyncData.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @see CFrameworkunifiedSyncData::CFrameworkunifiedSyncData
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ static CFrameworkunifiedSyncData *FrameworkunifiedGetSyncDataInstance();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - This function is used to release the instance of class.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval except eFrameworkunifiedStatusOK - failure
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - system function error.[Not eFrameworkunifiedStatusOK]
+ /// \~english @par Detail
+ /// - If m_psSyncData is NULL,return success,otherwise, will delete m_psSyncData.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see CFrameworkunifiedSyncData::CFrameworkunifiedSyncData
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus FrameworkunifiedReleaseSyncDataInstance();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - This method is used by the application to start the notification synchronization thread.
+ /// \~english @param [in] hApp
+ /// HANDLE - Application Handle.
+ /// \~english @retval eFrameworkunifiedStatusOK - On Success
+ /// \~english @retval eFrameworkunifiedStatusThreadAlreadyRunning - If thread already running
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - Null Handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid Handle
+ /// \~english @par Preconditons
+ /// - The function FrameworkunifiedReleaseSyncDataInstance is successed, object is created successfully.
+ /// \~english @par Change of internal status
+ /// -m_hSyncThreadMsgQHandle saves sync thread handle.
+ /// \~english @par Conditions of processing failure
+ /// - m_hSyncThreadMsgQHandle is not NULL, thread already running.[eFrameworkunifiedStatusThreadAlreadyRunning]
+ /// - Null Handle.[eFrameworkunifiedStatusNullPointer]
+ /// - Invalid Handle.[eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Detail
+ /// - This fucntion create a child thread of hApp, m_hSyncThreadMsgQHandle saves the child thread.
+ /// - The child thread will be used to receive and send notification data.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedStartNotificationSync(HANDLE hApp);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - This method is used to stop the synchronization notification thread.
+ /// \~english @param [in] hApp
+ /// HANDLE - Application Handle.
+ /// \~english @retval eFrameworkunifiedStatusOK - On Success
+ /// \~english @retval eFrameworkunifiedStatusThreadNotExist - If thread already running
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - Null Handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid Handle
+ /// \~english @par Preconditons
+ /// -The function FrameworkunifiedStartNotificationSync is successed.
+ /// \~english @par Change of internal status
+ /// - m_hSyncThreadMsgQHandle will be delete.
+ /// \~english @par Conditions of processing failure
+ /// - If thread doesn't exist.[eFrameworkunifiedStatusThreadNotExist]
+ /// - Null Handle.[eFrameworkunifiedStatusNullPointer]
+ /// - Invalid Handle.[eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Detail
+ /// - This method is used by the application to stop the notification synchronization thread.
+ /// m_hSyncThreadMsgQHandle is Invalid and can't be used to get notification data for hApp.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedStopNotificationSync(HANDLE hApp);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - API to subscribe to a synchronization notification data.
+ /// \~english @param [in] f_cNotification
+ /// std::string - Notification to be subscribed.
+ /// \~english @retval eFrameworkunifiedStatusOK - On Success
+ /// \~english @retval eFrameworkunifiedStatusFail - On failure
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If f_cNotification is empty or m_hSyncThreadAppHandle is NULL.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - API to subscribe to a synchronization notification data.\n
+ /// application will get the synchronization notification data at run-time.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - eFrameworkunifiedStatusFail:Failure
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationWithDataSync(const std::string &f_cNotification);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - API to unsubscribe to a synchronization notification data.
+ /// \~english @param [in] f_cNotification
+ /// std::string - Notification to be subscribed.
+ /// \~english @retval eFrameworkunifiedStatusOK - On Success
+ /// \~english @retval eFrameworkunifiedStatusFail - On failure
+ /// \~english @par Preconditons
+ /// - the FrameworkunifiedSubscribeNotificationWithDataSync result is success.
+ /// \~english @par Change of internal status
+ /// - The synchronization data's pointor of the special notification will be remove and delete.
+ /// - The synchronization data of the special notification will delete from m_mSyncDataMap.
+ /// \~english @par Conditions of processing failure
+ /// - If f_cNotification is empty or m_hSyncThreadAppHandle is NULL.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - API to unsubscribe to a synchronization notification data.\n
+ /// After unsubscribing,notification synchronization data of application will be freed.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - eFrameworkunifiedStatusFail:Failure
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedUnSubscribeNotificationWithDataSync(const std::string &f_cNotification);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - This function is used to get the synchronization notification data for a particular notification.
+ /// \~english @param [in] f_cNotification
+ /// std::string - Notification for which data is required
+ /// \~english @param [in] f_pBuffer
+ /// PVOID - Buffer for the synchronization data
+ /// \~english @param [in] f_nBufferSize
+ /// UI_16 - size of notification data buffer
+ /// \~english @retval eFrameworkunifiedStatusOK - Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - Null pointor
+ /// \~english @retval eFrameworkunifiedStatusFail - failure
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If f_cNotification is empty or m_hSyncThreadAppHandle is NULL or f_nBufferSize is 0.[eFrameworkunifiedStatusFail]
+ /// - If l_itSyncDataPacketItr is not in m_mSyncDataMap.[eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// - This function is used to get the synchronization notification data for a particular notification.
+ /// f_cNotification is the iterator to the map containing the synchronization data of notification,\n
+ /// using this iterator to get data from m_mSyncDataMap.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedGetSyncNotificationData(const std::string &f_cNotification, PVOID f_pBuffer, UI_16 f_nBufferSize);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - API to get the size of synchronization notification data.
+ /// \~english @param [in] f_cNotification
+ /// const std::string - Notification to be subscribed.
+ /// \~english @retval UI_32 - size of notification data
+ /// \~english @par Preconditons
+ /// -Instance is created successfully.
+ /// \~english @par Change of internal status
+ /// -None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - This function is used to get the size of the synchronization data.
+ /// if f_cNotification is null or l_itSyncDataPacketItr is not in m_mSyncDataMap\n
+ /// the function will return 0.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 FrameworkunifiedGetSyncDataSize(const std::string &f_cNotification);
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedSyncData
+ /// Constructor of CFrameworkunifiedSyncData class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedSyncData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedSyncData
+ /// Destructor of CFrameworkunifiedSyncData class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFrameworkunifiedSyncData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSyncDataThreadStart
+ /// Callback on the start of the sync thread.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Thread Application Handle.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedSyncDataThreadStart(HANDLE hThread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSyncDataThreadStop
+ /// Callback on the stop of the sync thread.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Thread Application Handle.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedSyncDataThreadStop(HANDLE hThread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSyncDataNotifCallback
+ /// Callback on the receiving the published notification.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Thread Application Handle.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedSyncDataNotifCallback(HANDLE hThread);
+
+ static CFrameworkunifiedSyncData *m_psSyncData; ///< singleton instance of class
+
+ BOOL m_bSyncThreadStarted; /// Check to verify if thread started
+
+ TSyncDataPacketList
+ *m_mSyncDataMap; /// Pointer to the map containing the synchronization data as per the notification
+
+ HANDLE m_hSyncThreadAppHandle; /// S ynchronization thread Application Handle
+
+ HANDLE m_hAppHandle; /// Application Handle
+
+ HANDLE m_hSyncThreadMsgQHandle; /// Synchronization thread message queue handle
+
+ static pthread_spinlock_t m_pSyncLock; /// Synchronization Spinlock
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYNC_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_system_if.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_system_if.h
new file mode 100755
index 0000000..af7a4f9
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_system_if.h
@@ -0,0 +1,110 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief This file provides framework's API which are used by system services.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_framework_system_if.h
+ * @brief \~english This file provides framework's API which are used by system services.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYSTEM_IF_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYSTEM_IF_H__
+
+#include <native_service/frameworkunified_types.h>
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FrameworkunifiedNPClearPersistedData
+ /// \~english @par Summary
+ /// API to delete all the persistent files and notification data from persistent memory
+ /// related to NS_NPS.
+ /// Note: This API is only to be used HMI service.
+ /// This API should not be used by the other application.
+ /// \~english @param [in] hApp
+ /// hApp - Handle to the Framework
+ /// \~english @par
+ /// hApp HANDLE*
+ /// \~english @param [in] eFrameworkunifiedClearPersistenceScope
+ /// eFrameworkunifiedClearPersistenceScope - specifies what data to delete from persistent memory
+ /// \~english @par
+ /// eFrameworkunifiedClearPersistenceScope EFrameworkunifiedClearPersistence enum
+ /// \~english @code
+ /// typedef enum _EFrameworkunifiedClearPersistence {
+ /// eFrameworkunifiedClearAllData = 0, ///< clears all the data in persistence memory for all users
+ /// ///< (currently only this enum value is supported.)
+ /// eFrameworkunifiedClearAllApplicationData, ///< clears all the data(files, folders) related to all application for all
+ /// users
+ /// eFrameworkunifiedClearAllNotificationData, ///< clears all the notification data related to all application for all users
+ /// eFrameworkunifiedClearCurrentUserData, ///< clears all the data in persistence memory for current users
+ /// eFrameworkunifiedClearCurrentUserApplicationData, ///< clears all the data(files, folders) related to all application for
+ /// current users
+ /// eFrameworkunifiedClearCurrentUserNotificationData ///< clears all the notification data related to all application for
+ /// current users
+ /// } EFrameworkunifiedClearPersistence;
+ /// @endcode
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @par
+ /// eFrameworkunifiedStatusOK
+ /// eFrameworkunifiedStatusNullPointer
+ /// eFrameworkunifiedStatusInvldParam
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If input parameter Framework handler is invalid. [eFrameworkunifiedStatusNullPointer]
+ /// - If communicate handler of NPPService is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Function NPClearPersistedData return invalid parameter. [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// API to delete all the persistent files and notification data from persistent memory
+ /// related to NS_NPS.
+ /// Note: This API is only to be used HMI service.
+ /// This API should not be used by the other application.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPClearPersistedData(HANDLE hApp, EFrameworkunifiedClearPersistence eFrameworkunifiedClearPersistenceScope = eFrameworkunifiedClearAllData);
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYSTEM_IF_H__ */ // NOLINT (build/header_guard)
+/**@}*/ // end of framework
+/**@}*/ // end of framework_unified
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_types.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_types.h
new file mode 100755
index 0000000..aa4119d
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_types.h
@@ -0,0 +1,173 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+/// \brief Application framework's core structures and data types.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_framework_types.h
+ * @brief \~english Application framework's core structures and data types.
+ *
+ */
+/** @addtogroup BaseSystem
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <boost/function.hpp>
+
+#define MAX_LEN MAX_QUEUE_NAME_SIZE
+#define MAX_MSGQ_BUFFER MAX_QUEUE_MSG_SIZE
+#define MAX_SESSION_ID_VAL 0xFFFF
+#define MAX_FD_MULTIWAITING 8
+
+#define FRAMEWORKUNIFIED_ANY_SOURCE "NS_ANY_SRC"
+#define FRAMEWORKUNIFIED_ANY_COMMAND 0xFFFFFFFF
+#define FRAMEWORKUNIFIED_NS_NPSERVICE "NS_NPPService"
+#define FRAMEWORKUNIFIED_NS_VERSIONUTIL "nsverutil"
+#define FRAMEWORKUNIFIED_NS_MSGPROFILERUTIL "NSDisMsgProfile"
+#define FRAMEWORKUNIFIED_NS_REMOTECONTROLSERVICE "NS_RemoteControlService"
+
+// call back function definition
+typedef boost::function< EFrameworkunifiedStatus(HANDLE) > TCbFunction;
+typedef TCbFunction CallbackFunctionPtr;
+typedef TCbFunction CbFuncPtr;
+typedef EFrameworkunifiedStatus(*CbArgumentParser)(SI_32 argument, PCHAR argumentValue);
+
+typedef enum _EFrameworkunifiedServiceAvailableStatus {
+ eFrameworkunifiedServiceAvailable = 0,
+ eFrameworkunifiedServiceNotAvailable,
+} EFrameworkunifiedServiceAvailableStatus;
+
+// Share Memory Retrieve Types
+typedef enum _ESMRetrieveTypes {
+ eSMRRelease = 0, ///< data will be released on a read
+ eSMRRetain = 1, ///< data will be retained in the shared memory
+} ESMRetrieveTypes;
+
+/**
+ * \~english Callbacks structure of Application Life cycle
+ */
+typedef struct _FrameworkunifiedDefaultCallbackHandler {
+ CbFuncPtr onInitilization; //!< \~english Callback of initialization
+ CbFuncPtr onDestroy; //!< \~english Callback of destroy
+ CbFuncPtr onStart; //!< \~english Callback of startup
+ CbFuncPtr onStop; //!< \~english Callback of stop
+ CbFuncPtr onPreStart; //!< \~english Callback of pre start
+ CbFuncPtr onPreStop; //!< \~english Callback of pre stop
+ CbFuncPtr onBackgroundStart; //!< \~english Callback of Background start
+ CbFuncPtr onBackgroundStop; //!< \~english Callback of Background stop
+ CbFuncPtr onDebugDump; //!< \~english Callback of debug dump
+ CbFuncPtr createStateMachine; //!< \~english Callback of created state machine
+ CbFuncPtr ssFrameworkInterface; //!< \~english Callback to Establish a session with the system_manager
+} FrameworkunifiedDefaultCallbackHandler;
+
+// LCOV_EXCL_BR_START 11:Occurred in the above test
+typedef struct _FrameworkunifiedProtocolCallbackHandler {
+ UI_32 iCmd;
+ CbFuncPtr callBack;
+} FrameworkunifiedProtocolCallbackHandler;
+// LCOV_EXCL_BR_STOP
+
+typedef struct _FrameworkunifiedFdProtocolCallbackHandler {
+ int fd;
+ CbFuncPtr callBack;
+} FrameworkunifiedFdProtocolCallbackHandler;
+
+// LCOV_EXCL_BR_START 11:Occurred in the above test
+typedef struct _FrameworkunifiedNotificationCallbackHandler {
+ CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
+ CbFuncPtr callBack;
+} FrameworkunifiedNotificationCallbackHandler;
+// LCOV_EXCL_BR_STOP
+
+typedef struct _FrameworkunifiedNotificationsList {
+ CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
+ UI_32 uiLengthData;
+ EFrameworkunifiedNotificationType persType;
+} FrameworkunifiedNotificationsList;
+
+typedef struct _FrameworkunifiedProtocolEvent {
+ UI_32 iCmd;
+ UI_32 iEventId;
+} FrameworkunifiedProtocolEvent;
+
+typedef struct _FrameworkunifiedNotificationEvent {
+ CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
+ UI_32 iEventId;
+} FrameworkunifiedNotificationEvent;
+
+typedef struct _ServiceAvailability {
+ CHAR cServiceName[MAX_NAME_SIZE_APP];
+ EFrameworkunifiedServiceAvailableStatus eServiceAvailability;
+} ServiceAvailability;
+
+typedef enum _EFrameworkunifiedShutdowntatus {
+ eFrameworkunifiedShutdownOk = 0,
+ eFrameworkunifiedShutdownTimeout,
+ eFrameworkunifiedShutdownFail,
+} EFrameworkunifiedShutdownStatus;
+
+typedef struct _ShutdownComplete {
+ CHAR cServiceName[MAX_NAME_SIZE_APP];
+ EFrameworkunifiedShutdownStatus eShutdownCompleteStatus;
+} ShutdownComplete;
+
+typedef struct _CustomCommandLineOptions {
+ PCSTR cShortOptions;
+ PCHAR cLongOptions; // reserved for long options.
+ CbArgumentParser callback;
+} CustomCommandLineOptions;
+
+/// Scheduling Policy
+typedef enum _EFrameworkunifiedSchedPolicy {
+ eFrameworkunifiedSchedPolicyInherit = 0,
+ eFrameworkunifiedSchedPolicyTSS,
+ eFrameworkunifiedSchedPolicyFIFO,
+ eFrameworkunifiedSchedPolicyRR,
+ eFrameworkunifiedSchedPolicyMAX
+} EFrameworkunifiedSchedPolicy;
+
+/// Child Thread Attribute
+typedef struct _FrameworkunifiedChildThreadAttr {
+ EFrameworkunifiedSchedPolicy schedPolicy;
+ SI_32 schedPriority;
+} FrameworkunifiedChildThreadAttr;
+
+#endif /* __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_multithreading.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_multithreading.h
new file mode 100755
index 0000000..b943596
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_multithreading.h
@@ -0,0 +1,745 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Application framework's core structures and data types.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_multithreading.h
+ * @brief \~english Application framework's core structures and data types.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NSFRAMEWORK_NFRAMEWORKCORE_MULTITHREADING__ // NOLINT (build/header_guard)
+#define __NSFRAMEWORK_NFRAMEWORKCORE_MULTITHREADING__
+
+#include <native_service/frameworkunified_framework_types.h>
+
+#define INHERIT_PARENT_THREAD_PRIO -100
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateChildThread
+/// \~english @par Brief
+/// Create child thread and dispatcher for child thread, and initialize it
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] childName
+/// PCSTR - Child thread name
+/// \~english @param [in] CbInitialize
+/// CbFuncPtr - Pointer to the callback function for initializing child thread
+/// \~english @param [in] CbShutdown
+/// CbFuncPtr - Pointer to the callback function for stopping child thread
+/// \~english @retval HANDLE handle for communicate with child thread
+/// \~english @retval NULL Failure to get HANDLE
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize, CbShutdown) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Detail
+/// This API creates child thread and returns handle for communicate with child thread.\n
+/// Generated child thread creates dispatcher for itself, and initializes the dispatcher. \n
+/// It starts to mainloop that receives request or notification,
+/// and runs registered callback to dispatcher for child thread.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize, CbFuncPtr CbShutdown);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateChildThreadWithPriority
+/// \~english @par Brief
+/// Create child thread with specified priority and dispatcher for child thread, and initialize it
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] childName
+/// PCSTR - Child thread name
+/// \~english @param [in] CbInitialize
+/// CbFuncPtr - Pointer to the callback function for initializing child thread
+/// \~english @param [in] CbShutdown
+/// CbFuncPtr - Pointer to the callback function for stopping child thread
+/// \~english @param [in] schedPrio
+/// SI_32 - priority of child thread
+/// (If INHERIT_PARENT_THREAD_PRIO specified, inherit from parent thread priority)
+/// \~english @retval HANDLE handle for communicate with child thread
+/// \~english @retval NULL Failure to get HANDLE
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize,CbShutdown) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Detail
+/// This API creates child thread with specified priority(schedPrio) and
+/// returns handle for communicate with child thread.\n
+/// The thread scheduling policy of generated child thread is fixed to first in-first out scheduling
+/// (eFrameworkunifiedSchedPolicyFIFO).\n
+/// Generated child thread creates dispatcher for itself, and initializes the dispatcher. \n
+/// It starts to mainloop that receives request or notification,
+/// and runs registered callback to dispatcher for child thread.\n
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThreadWithPriority(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
+ , CbFuncPtr CbShutdown, SI_32 schedPrio);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateDispatcherChild
+/// \~english @par Breif
+/// Creates and initializes a handle for the child thread's application
+/// \~english @param [out] hChildApp
+/// HANDLE & - A handle for the child thread's application
+/// \~english @param [in] childName
+/// PCSTR - Child thread name
+/// \~english @param [in] parentName
+/// PCSTR - Parent thread name
+/// \~english @retval eFrameworkunifiedStatusOK succss
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Framework generation failure
+/// \~english @par Prerequisite
+/// - A child thread has been created.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the childName to the child thread name of the application specified in the arguments is NULL [eFrameworkunifiedStatusInvldParam]
+/// - If the parentName to the parent thread name of the application specified in the arguments is NULL [eFrameworkunifiedStatusInvldParam]
+/// - When the parent thread name (parentName) of the application specified in the arguments exceeds 16 bytes [eFrameworkunifiedStatusInvldParam]
+/// - When the normalized message queue name from the childName specified in the arguments exceeds 16 bytes [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open a message queue (mq_open) [eFrameworkunifiedStatusNullPointer]
+/// - When acquisition (malloc) of the message queue management information area fails [eFrameworkunifiedStatusNullPointer]
+/// - If the creation (socket, bind, listen) of sockets for error monitoring fails [eFrameworkunifiedStatusFail]
+/// - When a message queue is created with the name of an already registered thread [eFrameworkunifiedStatusFail]
+/// - Failed to create epoll instances (epoll_create1) [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register Dispatcher message queue descriptor for epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to create file descriptor for receiving events to Dispatcher (eventfd) [eFrameworkunifiedStatusFail]
+/// - Failed to register file descriptor for receiving Dispatcher events to epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to register socket for monitoring Dispatcher error in epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API creates a handle for the application of the child thread, initializes it, and returns the handle.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+///
+/// \~english @par Brief
+/// Create and initialize an threads dispatcher.
+///
+/// \~english \param [out] hChildApp
+/// HANDLE& - Reference of application handle
+/// \~english \param [in] childName
+/// PCSTR - create thread name
+/// \~english \param [in] parentName
+/// PCSTR - parent thread name
+///
+/// \~english \return status
+/// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if Success
+/// possible errors from call CreateDispatcher
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcherChild(HANDLE &hChildApp, PCSTR childName, PCSTR parentName); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateChildThreadWithAttribute
+/// \~english @par Brief
+/// Create child thread with specified thread attributes and dispatcher for child thread, and initialize it
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] childName
+/// PCSTR - Child thread name
+/// \~english @param [in] CbInitialize
+/// CbFuncPtr - Pointer to the callback function for initializing child thread
+/// \~english @param [in] CbShutdown
+/// CbFuncPtr - Pointer to the callback function for stopping child thread
+/// \~english @param [out] attr
+/// FrameworkunifiedChildThreadAttr* - Pointer to thread attributes
+/// \~english @par
+/// FrameworkunifiedChildThreadAttr Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedChildThreadAttr
+/// {
+/// EFrameworkunifiedSchedPolicy schedPolicy; // Thread scheduling policy(Default is eFrameworkunifiedSchedPolicyInherit)
+/// SI_32 schedPriority; // Thread priority(Default is INHERIT_PARENT_THREAD_PRIO)
+/// } FrameworkunifiedChildThreadAttr;
+/// @endcode
+/// \~english @par
+/// enum EFrameworkunifiedSchedPolicy Variable
+/// \~english @code
+/// typedef enum _EFrameworkunifiedSchedPolicy {
+/// eFrameworkunifiedSchedPolicyInherit = 0, // Inherit from parent thread.
+/// eFrameworkunifiedSchedPolicyTSS, // Time Sharing System scheduling
+/// eFrameworkunifiedSchedPolicyFIFO, // First in-first out scheduling
+/// eFrameworkunifiedSchedPolicyRR, // Round-robin scheduling
+/// eFrameworkunifiedSchedPolicyMAX // EFrameworkunifiedSchedPolicy Max(Not to be used.)
+/// } EFrameworkunifiedSchedPolicy;
+/// @endcode
+/// \~english @retval HANDLE handle for communicate with child thread
+/// \~english @retval NULL Failure to get HANDLE
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize,CbShutdown) is NULL. [NULL]
+/// - Thread attribute specified in the argument (attr) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Detail
+/// This API creates child thread with specified thread attributes(attr)
+/// and returns handle for communicate with child thread.\n
+/// Generated child thread creates dispatcher for itself, and initializes the dispatcher. \n
+/// It starts to mainloop that receives request or notification,
+/// and runs registered callback to dispatcher for child thread.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThreadWithAttribute(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
+ , CbFuncPtr CbShutdown, const FrameworkunifiedChildThreadAttr *attr);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateChildThreadAttrInit
+/// \~english @par Brief
+/// Initialize thread attribute object.
+/// \~english @param [out] attr
+/// FrameworkunifiedChildThreadAttr* - Pointer to thread attribute
+/// \~english @par
+/// FrameworkunifiedChildThreadAttr Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedChildThreadAttr
+/// {
+/// EFrameworkunifiedSchedPolicy schedPolicy; // Thread scheduling policy(Default is eFrameworkunifiedSchedPolicyInherit)
+/// SI_32 schedPriority; // Thread priority(Default is INHERIT_PARENT_THREAD_PRIO)
+/// } FrameworkunifiedChildThreadAttr;
+/// @endcode
+/// \~english @par
+/// enum EFrameworkunifiedSchedPolicy Variable
+/// \~english @code
+/// typedef enum _EFrameworkunifiedSchedPolicy {
+/// eFrameworkunifiedSchedPolicyInherit = 0, // Inherit from parent thread.
+/// eFrameworkunifiedSchedPolicyTSS, // Time Sharing System scheduling
+/// eFrameworkunifiedSchedPolicyFIFO, // First in-first out scheduling
+/// eFrameworkunifiedSchedPolicyRR, // Round-robin scheduling
+/// eFrameworkunifiedSchedPolicyMAX // EFrameworkunifiedSchedPolicy Max(Not to be used.)
+/// } EFrameworkunifiedSchedPolicy;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - the argument attr is NULL. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API initialize thread attribute (attr) by default value of NS framework.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedCreateChildThreadWithAttribute
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateChildThreadAttrInit(FrameworkunifiedChildThreadAttr *attr);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateChildThreadAttrSetSched
+/// \~english @par Brief
+/// Initialize thread attribute object with specified value.
+/// \~english @param [out] attr
+/// FrameworkunifiedChildThreadAttr* - Pointer to thread attribute
+/// \~english @param [in] policy
+/// EFrameworkunifiedSchedPolicy - Thread shcheduling policy at thread start
+/// \~english @param [in] priority
+/// SI_32 - Thread priority at thread start
+/// \~english @par
+/// FrameworkunifiedChildThreadAttr Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedChildThreadAttr
+/// {
+/// EFrameworkunifiedSchedPolicy schedPolicy; // Thread scheduling policy(Default is eFrameworkunifiedSchedPolicyInherit)
+/// SI_32 schedPriority; // Thread priority(Default is INHERIT_PARENT_THREAD_PRIO)
+/// } FrameworkunifiedChildThreadAttr;
+/// @endcode
+/// \~english @par
+/// enum EFrameworkunifiedSchedPolicy Variable
+/// \~english @code
+/// typedef enum _EFrameworkunifiedSchedPolicy {
+/// eFrameworkunifiedSchedPolicyInherit = 0, // Inherit from parent thread.
+/// eFrameworkunifiedSchedPolicyTSS, // Time Sharing System scheduling
+/// eFrameworkunifiedSchedPolicyFIFO, // First in-first out scheduling
+/// eFrameworkunifiedSchedPolicyRR, // Round-robin scheduling
+/// eFrameworkunifiedSchedPolicyMAX // EFrameworkunifiedSchedPolicy Max(Not to be used.)
+/// } EFrameworkunifiedSchedPolicy;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - the argument attr is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - the argument policy is out of range
+/// (less than eFrameworkunifiedSchedPolicyInherit, over eFrameworkunifiedSchedPolicyMAX). [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// This API initializes thread attribute object for child thread with specified value.\n
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// FrameworkunifiedCreateChildThreadWithAttribute
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateChildThreadAttrSetSched(FrameworkunifiedChildThreadAttr *attr, EFrameworkunifiedSchedPolicy policy, SI_32 priority);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedStartChildThread
+/// \~english @par Brief
+/// Send initialize request to the child thread.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] hChildQ
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @param [in] length
+/// UI_32 - Length of send message data
+/// \~english @param [in] data
+/// PCVOID - Pointer to message data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state is depend on application implements.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Data buffer specified in the argument (data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Thread name specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldQName]
+/// - Message queue name of child thread specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusErrOther]
+/// - Type of message queue to child thread is not for sending. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during message sending. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Any errors occur during the transmission of message to the child thread. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API sends initialize request to the child thread from parent thread.\n
+/// Taking this request,
+/// child thread runs callback function for initialize that specified when the thread create.
+/// \~english @par
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// FrameworkunifiedStopChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedStartChildThread(HANDLE hApp, HANDLE hChildQ, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedStopChildThread
+/// \~english @par Brief
+/// Send shutdown request to the child thread.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] hChildQ
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @param [in] length
+/// UI_32 - Length of send message data
+/// \~english @param [in] data
+/// PCVOID - Pointer to message data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state is depend on application implements.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Data buffer specified in the argument (data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Thread name specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldQName]
+/// - Message queue name of child thread specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusErrOther]
+/// - Type of message queue to child thread is not for sending. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during message sending. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Any errors occur during the transmission of message to the child thread. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API sends shutdown request to the child thread.\n
+/// Taking this request,
+/// child thread runs callback function for shutdown that specified when the thread create.\n
+/// This API does not terminate child thread.
+/// Use FrameworkunifiedDestroyChildThread to terminate child thread from parent thread.
+/// \~english @par
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// FrameworkunifiedStartChildThread FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedStopChildThread(HANDLE hApp, HANDLE hChildQ, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDestroyChildThread
+/// \~english @par Brief
+/// Terminate child thread.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] hChildQ
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusThreadNotExist Thread is not exist
+/// \~english @retval eFrameworkunifiedStatusThreadSelfJoin Self thread specified
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread
+/// (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state is depend on application implements.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hChildQ) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hChildQ) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Thread name specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldQName]
+/// - Message queue name of child thread specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+/// - Type of message queue to child thread is not for sending. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during message sending. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Message data size is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of message to the child thread. [eFrameworkunifiedStatusFail]
+/// - Child thread is invalid (thread exit or invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Another thread is already waiting to join with this child thread. [eFrameworkunifiedStatusInvldParam]
+/// - Already child thread is in termination process [eFrameworkunifiedStatusInvldParam]
+/// - Thread specified in argument is self thread. [eFrameworkunifiedStatusThreadSelfJoin]
+/// - Failed to close message queue specified in the argument (hChildQ). [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// This API sends terminate request to child thread , and waits to terminate child thread.\n
+/// Taking this request, child thread terminates itself.\n
+/// After child thread terminates, parent thread destroys handle for communicate with child thread.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedCreateChildThread FrameworkunifiedCreateChildThreadWithAttribute FrameworkunifiedCreateChildThreadWithPriority
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDestroyChildThread(HANDLE hApp, HANDLE hChildQ);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendChild
+/// \~english @par Brief
+/// Send a message to the child thread.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] hChildQ
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @param [in] iCmd
+/// UI_32 - Command of message
+/// \~english @param [in] length
+/// UI_32 - Length of send message data
+/// \~english @param [in] data
+/// PCVOID - Pointer to message data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Data buffer specified in the argument (data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Thread name specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldQName]
+/// - Message queue name of child thread specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusErrOther]
+/// - Type of message queue to child thread is not for sending. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during message sending. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Any errors occur during the transmission of message to the child thread. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API sends a message to the child thread from parent thread.\n
+/// This API is available only from parent thread.
+/// \~english @par
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedSendParent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendChild(HANDLE hApp, HANDLE hChildQ, UI_32 iCmd, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendParent
+/// \~english @par Brief
+/// Send a message to the parent thread.
+/// \~english @param [in] hChildApp
+/// HANDLE - Handle for Application of child thread(get as argument of callback function)
+/// \~english @param [in] iCmd
+/// UI_32 - Command of message
+/// \~english @param [in] length
+/// UI_32 - Length of send message data
+/// \~english @param [in] data
+/// PCVOID - Pointer to message data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hChildApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue for parent thread in HANDLE (hChildApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue for parent thread in HANDLE (hChildApp) is not appropriate
+/// (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Data buffer specified in the argument (data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Thread name specified in the argument (hChildApp) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldQName]
+/// - The name of message queue for parent thread specified in the argument (hChildApp) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusErrOther]
+/// - Type of message queue to parent thread is not for sending. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during message sending. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Any errors occur during the transmission of message to the parent thread. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API sends a message to the parent thread from child thread.\n
+/// This API is available only from child thread.
+/// \~english @par
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedSendChild
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendParent(HANDLE hChildApp, UI_32 iCmd, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedJoinChild
+/// \~english @par Brief
+/// Wait for child thread terminates.
+/// \~english @param [in] hChildApp
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusThreadNotExist Thread is not exist
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusThreadSelfJoin Self thread specified
+/// \~english @retval eFrameworkunifiedStatusFail thread exit or invalid
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hChildApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Child thread is invalid (thread exit or invalid) [eFrameworkunifiedStatusFail]
+/// - Another thread is already waiting to join with this child thread. [eFrameworkunifiedStatusInvldParam]
+/// - Already child thread is in termination process [eFrameworkunifiedStatusInvldParam]
+/// - Thread specified in argument is self thread. [eFrameworkunifiedStatusThreadSelfJoin]
+/// \~english @par Detail
+/// It waits for terminate of child thread it was created by FrameworkunifiedCreateChildThread
+/// (or similar one) in the parent thread.\n
+/// This API blocks the calling thread until child thread terminates.\n
+/// This API does not terminate child thread.
+/// Use FrameworkunifiedDestroyChildThread to terminate child thread from parent thread.
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// FrameworkunifiedCreateChildThread, FrameworkunifiedCreateChildThreadWithPriority, FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedJoinChild(HANDLE hChildApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetChildThreadPriority
+/// \~english @par Brief
+/// Get the child thread priority.
+/// \~english @param [in] hChildApp
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @param [out] threadPrio
+/// PSI_32 - Dispatcher file descriptor
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusThreadNotExist Thread is not exist
+/// \~english @retval eFrameworkunifiedStatusFault Error occured during function
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hChildApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - child thread priority in the argument (threadPrio) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Failed to get child thread priority (pthread_getschedparam). [eFrameworkunifiedStatusFault]
+/// - If child threads are inalid or already terminated. [eFrameworkunifiedStatusThreadNotExist]
+/// \~english @par Detail
+/// This API set the child thread priority generated by FrameworkunifiedCreateChildThread to argument threadPrio.
+/// Use to get child thread priority from parent thread.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedCreateChildThread, FrameworkunifiedCreateChildThreadWithPriority
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio);
+#endif // __NSFRAMEWORK_NFRAMEWORKCORE_MULTITHREADING__ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_service_if.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_service_if.h
new file mode 100755
index 0000000..b142d11
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_service_if.h
@@ -0,0 +1,267 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_service_if.h
+ * @brief \~english This is base class for service interface classes
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __CSERVICESESSION_H__ // NOLINT (build/header_guard)
+#define __CSERVICESESSION_H__
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////
+/// class: CServiceSession
+/// Description: This is base class for service interface classes
+///
+////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedServiceInterface {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// Constructor for CFrameworkunifiedServiceInterface
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// no preconditions
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// create CFrameworkunifiedServiceInterface class instance
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunifiedServiceInterface
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedServiceInterface();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedServiceInterface
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// CFrameworkunifiedServiceInterface is decleared in constructor
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Release CFrameworkunifiedServiceInterface instance
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedServiceInterface
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFrameworkunifiedServiceInterface();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to open Service.
+ /// \~english @param [in] f_hApp
+ /// HANDLE* - Handle of framework
+ /// \~english @param [in] f_sServiceName
+ /// std::string - Service Name
+ /// \~english @retval HANDLE
+ /// \~english @par Preconditions
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Open service by specified name and retrun handle of service. \n
+ /// If FrameworkunifiedOpenService failed, handle is NULL.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedOpenService
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ HANDLE OpenService(const HANDLE f_hApp, std::string f_sServiceName);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to close service.
+ /// \~english @param [in] f_hApp
+ /// HANDLE* - Handle of framework
+ /// \~english @param [in] f_hService
+ /// HANDLE - Handle of the service
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter f_hApp is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - If parameter f_hService is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - If FrameworkunifiedCloseService failed. [eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Detail
+ /// close service by handle \n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedCloseService
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseService(const HANDLE f_hApp, const HANDLE f_hService);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to open session
+ /// \~english @param [in] f_hApp
+ /// HANDLE* -framework handle
+ /// \~english @param [in] f_uisessionType
+ /// UI_32 - sessiontype
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter f_hApp is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - If FrameworkunifiedOpenSessionWithData failed. [eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Detail
+ /// open session by specified session type \n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedOpenSessionWithData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenSession(const HANDLE f_hApp, UI_32 f_uisessionType);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to open session Acknowledge
+ /// \~english @param [in] f_hApp
+ /// HANDLE* - Handle of framework
+ /// \~english @param [in] hSession
+ /// HANDLE - Session Handle
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Empty implement.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see one
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus OpenSessionAcknowledge(const HANDLE f_hApp, HANDLE &hSession); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to close session.
+ /// \~english @param [in] f_hService
+ /// HANDLE* - Handle of service
+ /// \~english @param [in] hSession
+ /// HANDLE - Session Handle
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter f_hService is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - If parameter f_hSession is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - If FrameworkunifiedCloseSession failed. [eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Detail
+ /// close session of specified service. \n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedCloseSession
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseSession(const HANDLE f_hService, const HANDLE f_hSession);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to close session.
+ /// \~english @param [in] f_hService
+ /// HANDLE* - Handle of service
+ /// \~english @param [in] hSession
+ /// HANDLE - Session Handle
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter hClient is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If FrameworkunifiedGetMsgDataOfSize failed. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Check close session acknowledge.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedGetMsgDataOfSize
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseSessionAcknowledge(const HANDLE hClient);
+};
+#endif // __CSERVICESESSION_H__ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_service_protocol.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_service_protocol.h
new file mode 100755
index 0000000..e66119e
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_service_protocol.h
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeServices
+/// \brief
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_service_protocol.h
+ * @brief \~english Include enums, structs and frameworkunified_types.h
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef FRAMEWORKUNIFIED_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard)
+#define FRAMEWORKUNIFIED_SERVICE_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+#define NS_INVALID_SESSION 0xFFFF
+
+typedef enum _EBaseProtocol {
+ PROTOCOL_OPEN_SESSION_REQ = 0x00, ///< Open session request (client > service)
+ PROTOCOL_OPEN_SESSION_ACK = 0x01, ///< Open session ack (service > client)
+ PROTOCOL_OPEN_SESSION_REQ_SYNC = 0x02, ///< Open session request sync (client > service)
+ PROTOCOL_CLOSE_SESSION_REQ = 0x03, ///< Close session request (client > service)
+ PROTOCOL_CLOSE_SESSION_ACK = 0x04, ///< Close session ack (service > client)
+ PROTOCOL_CLOSE_SESSION_REQ_SYNC = 0x05, ///< Close session request sync (client > service)
+
+ PROTOCOL_REGISTER_EVENTS = 0x06, ///< Register for events (client > service)
+ PROTOCOL_REGISTER_EVENTS_ACK = 0x07, ///< Register for events ack (service > client)
+ PROTOCOL_UNREGISTER_EVENTS = 0x08, ///< Un-Register for events (client > service)
+
+ PROTOCOL_THREAD_INITIALIZATION = 0x09, ///< Initialize thread after creation
+ PROTOCOL_THREAD_WAKEUP = 0x0A, ///< Wakeup Thread after sleep
+ PROTOCOL_THREAD_SHUTDOWN = 0x0B, ///< Stop the thread
+ PROTOCOL_THREAD_DESTROY = 0x0C, ///< Destroy the thread
+ PROTOCOL_RSV_0D = 0x0D, ///< Reserved
+ PROTOCOL_RSV_0E = 0x0E, ///< Reserved
+ PROTOCOL_DIS_MSGPROFILER = 0x0F, ///< Reserved
+
+ PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD = 0x10, ///< Protocols between range PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD
+ PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD = 0xFFFFFFF0, ///< are available for FRAMEWORKUNIFIED applications to use.
+
+ PROTOCOL_RSV_xF1 = 0xFFFFFFF1, ///< Reserved
+ PROTOCOL_RSV_xF2 = 0xFFFFFFF2, ///< Reserved
+ PROTOCOL_RSV_xF3 = 0xFFFFFFF3, ///< Reserved
+ PROTOCOL_RSV_xF4 = 0xFFFFFFF4, ///< Reserved
+ PROTOCOL_RSV_xF5 = 0xFFFFFFF5, ///< Reserved
+ PROTOCOL_RSV_xF6 = 0xFFFFFFF6, ///< Reserved
+ PROTOCOL_RSV_xF7 = 0xFFFFFFF7, ///< Reserved
+ PROTOCOL_RSV_xF8 = 0xFFFFFFF8, ///< Reserved
+ PROTOCOL_RSV_xF9 = 0xFFFFFFF9, ///< Reserved
+ PROTOCOL_RSV_xFA = 0xFFFFFFFA, ///< Reserved
+ PROTOCOL_RSV_xFB = 0xFFFFFFFB, ///< Reserved
+ PROTOCOL_RSV_xFC = 0xFFFFFFFC, ///< Reserved
+
+ PROTOCOL_TIMER_DUMMY_CMD = 0xFFFFFFFD, ///< NS internally use this command in timer
+
+ PROTOCOL_FRAMEWORKUNIFIED_NOTIFICATION = 0xFFFFFFFE,
+ PROTOCOL_FRAMEWORKUNIFIED_ANY_COMMAND = 0xFFFFFFFF
+} EBaseProtocol;
+
+typedef struct _OpenSessionAck {
+ EFrameworkunifiedStatus eStatus;
+ UI_32 sessionId;
+ CHAR cSessionName[MAX_QUEUE_NAME_SIZE];
+ UI_32 sessionType;
+} OpenSessionAck;
+
+
+typedef struct _CloseSessionReq {
+ UI_32 sessionId;
+ CHAR cSessionName[MAX_QUEUE_NAME_SIZE];
+} CloseSessionReq;
+
+typedef struct _CloseSessionAck {
+ UI_32 sessionId;
+ EFrameworkunifiedStatus eStatus;
+} CloseSessionAck;
+
+#endif /* FRAMEWORKUNIFIED_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_action.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_action.h
new file mode 100755
index 0000000..58dbf22
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_action.h
@@ -0,0 +1,150 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief This file has class declaration of the CFrameworkunifiedAction. This is an
+/// interface class that defines interfaces for implementing action
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_action.h
+ * @brief \~english This file has class declaration of the CFrameworkunifiedAction. This is an interface class that defines
+ * interfaces for implementing action
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMACTION_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMACTION_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <boost/smart_ptr.hpp>
+#include <string>
+
+class CFrameworkunifiedState;
+
+class CEventData;
+typedef boost::shared_ptr<CEventData> CEventDataPtr;
+
+class CFrameworkunifiedAction {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedAction
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedAction.
+ /// \~english @param [in] f_strName
+ /// std::string -Name of Action object
+ /// \~english @retval
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Constructor of CFrameworkunifiedAction class. Create an object of CFrameworkunifiedAction. \n
+ /// Initialize member value with name designated by f_strName. \n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunifiedAction
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedAction(std::string f_strName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedAction
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedAction
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Pure virtual function , implemented by child class
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedAction
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedAction() {
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedAction
+ /// \~english @par Brief
+ /// Callback function of CFrameworkunifiedAction.(pure virtual function)
+ /// \~english @param [in] f_pSourceState
+ /// CFrameworkunifiedState - pointer of source state
+ /// \~english @param [in] f_pTargetState
+ /// CFrameworkunifiedState - pointer of target state
+ /// \~english @param [in] f_pData
+ /// CEventDataPtr - pointer of event data
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Callback function of CFrameworkunifiedAction.(pure virtual function)
+ /// Implement action by subclass
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual VOID FrameworkunifiedAction(CFrameworkunifiedState *f_pSourceState, CFrameworkunifiedState *f_pTargetState,
+ CEventDataPtr f_pData) = 0;
+
+ // action name
+ std::string m_strName;
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMACTION_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_compositestate.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_compositestate.h
new file mode 100755
index 0000000..72ac640
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_compositestate.h
@@ -0,0 +1,434 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedCompositeState class definitions. CFrameworkunifiedCompositeState is derived from C
+/// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Composite
+/// state. It provides the standard interfaces for adding state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_compositestate.h
+ * @brief \~english This file has the CFrameworkunifiedCompositeState class definitions. CFrameworkunifiedCompositeState is derived from C
+ * FrameworkunifiedState class.This class implements the additional functionality supported by HSM Composite
+ * state. It provides the standard interfaces for adding state.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDCOMPOSITESTATE_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDCOMPOSITESTATE_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_state.h>
+#include <map>
+#include <string>
+
+typedef std::map<std::string, CFrameworkunifiedState *> ChildStateList;
+typedef std::map<std::string, CFrameworkunifiedState *>::iterator StateIterator;
+
+class CFrameworkunifiedHSM;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM Composite
+/// state. It provides the standard interfaces for adding state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedCompositeState : public CFrameworkunifiedState {
+ public :
+
+ typedef enum _FRAMEWORKUNIFIED_STATE_TYPE {
+ eFrameworkunifiedState = 0,
+ eFrameworkunifiedDefaultState
+ } FRAMEWORKUNIFIED_STATE_TYPE;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedCompositeState.
+ /// \~english @param [in] f_strName
+ /// std::string -Name of state
+ /// \~english @retval
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// This class inherit from CFrameworkunifiedState(basic class of state machine), \n
+ /// and create object of CFrameworkunifiedCompositeState class. \n
+ /// Create and initialize child state, and set the pointor to member variable. \n
+ /// Initialize other member variables with NULL. \n
+ /// Output the process error logs.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState, ~CFrameworkunifiedCompositeState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedCompositeState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedCompositeState
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Release the objects of CFrameworkunifiedState class and CFrameworkunifiedCompositeState class. \n
+ /// Release all the child states registered in child states list of member variable. \n
+ /// Output error log if failed.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState, CFrameworkunifiedCompositeState::CFrameworkunifiedCompositeState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedCompositeState();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// sets the given state as a substate of the current state. If the f_eStateType is
+ /// eFrameworkunifiedDefaultState then substate is default state for current state.
+ /// \~english @param [in] f_pState
+ /// CFrameworkunifiedState* - Pointer to the substate object to be added in the current state
+ /// \~english @param [in] f_eStateType
+ /// FRAMEWORKUNIFIED_STATE_TYPE - state type indicating if it is default state
+ /// \~english @retval EFrameworkunifiedStatus
+ /// success or fail
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter f_pState is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If m_pChildStates is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// sets the given state as a substate of the current state. If the f_eStateType is
+ /// eFrameworkunifiedDefaultState then substate is default state for current state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedAddState(CFrameworkunifiedState *f_pState,
+ FRAMEWORKUNIFIED_STATE_TYPE f_eStateType = eFrameworkunifiedState);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Returns the default state of the current composite state.
+ /// \~english @param none
+ /// \~english @retval CFrameworkunifiedState* - pointer default state
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Returns the default state of the current composite state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedState *FrameworkunifiedGetDefaultState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Logs the state name and events associated with the state.
+ /// \~english @param none
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer failed
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - Don't create instance of CFrameworkunifiedCompositeState [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This function overrides the fuction of CFrameworkunifiedState::FrameworkunifiedPrintStates.
+ /// This function outputs log of state name and events associated with the state as follows:
+ /// - state name of parent state machine and self state machine
+ /// - all the event names in event list
+ /// - all the event names in delay event list
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedPrintStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// This indicates if the state has sub states. It returns TRUE only in the CompositeState
+ /// where this function is overridden
+ /// \~english @param none
+ /// \~english @retval BOOL TRUE - has substate FALSE - has not substatue
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// This function overrides the fuction of CFrameworkunifiedState::FrameworkunifiedHasSubStates.
+ /// Return true only in CFrameworkunifiedCompositeState class.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedHasSubStates
+ virtual BOOL FrameworkunifiedHasSubStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// This interface returns the Active state of the current composite state. In case of
+ /// non-composite state current state is active state
+ /// \~english @param none
+ /// \~english @retval CFrameworkunifiedState* pointer of active state
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// This function overrides the pure virtual fuction of CFrameworkunifiedState::FrameworkunifiedGetActiveState.
+ /// Reture active state of current composite state. If it isn't a composite state,
+ /// return current state as an active state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedGetActiveState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// This function stores the last active state
+ /// \~english @param none
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// This function overrides the pure virtual fuction of CFrameworkunifiedState::UpdateHistory.
+ /// Store the last active state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState::UpdateHistory
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UpdateHistory();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Update the State information in the given stream in the form of XML tags
+ ///
+ /// \~english @param f_strXMLString
+ /// std::ostringstream & - reference to the XML stream
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
+ /// eFrameworkunifiedStatusNullPointer
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal status
+ /// - Self instance of CFrameworkunifiedCompositeState created failed. [eFrameworkunifiedStatusNullPointer].
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// This function overrides the fuction of CFrameworkunifiedState::FrameworkunifiedPrintXML.
+ /// Set parameter f_strXMLString with the following state information by XML type.
+ /// - state name
+ /// - all the event information in event list(event ID, event name)
+ /// - all the event information in delay event list(event ID, event name)
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedPrintXML
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString);
+
+
+ protected :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Initialize state
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @par Preconditions
+ /// - Its own instance (CFrameworkunifiedCompositeState) has been created.
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides and uses CFrameworkunifiedState::FrameworkunifiedOnEntry, which is pure virtual functions, to initialize state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedOnEntry, FrameworkunifiedOnExit
+ ///
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Clean up state.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @par Preconditions
+ /// - Its own instance (CFrameworkunifiedCompositeState) has been created.
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides and uses CFrameworkunifiedState::FrameworkunifiedOnExit, which is pure virtual functions, to clean up state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedOnExit, FrameworkunifiedOnEntry
+ ///
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
+
+ /// stores the pointers to sub state, key is state name
+ ChildStateList *m_pChildStates;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Associate the state machine with the current state.
+ /// \~english @param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Pointers to state machines (CFrameworkunifiedHSM classes)
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+ /// \~english @par Preconditions
+ /// - Its own instance (CFrameworkunifiedCompositeState) has been created.
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - When the pointers to the state machines (CFrameworkunifiedHSM classes) specified in the arguments (f_pStatemachine) are NULL [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This method is used by overriding CFrameworkunifiedState::FrameworkunifiedSetHSM.\n
+ /// Associates a state machine with the current state by setting a pointer (f_pStatemachine)
+ /// to the state machine (CFrameworkunifiedHSM) specified by the argument to the pointer to the state machine of the member variable. \n
+ /// Calling FrameworkunifiedSetHSM() for child states also associates the state machine of the child states with the state of the current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedHSM, CFrameworkunifiedState::FrameworkunifiedSetHSM
+ ///
+ /// Sets the statemachine in the status
+ ///
+ /// \param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Statemachine pointer
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine);
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CheckHistory
+ /// This function searches for history state in this composite state and updates it.
+ ///
+ /// \param [in] l_cHistoryType
+ /// string - Type of history state (shallow or deep)
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CheckHistory(std::string l_cHistoryType);
+};
+
+#endif // _FRAMEWORKUNIFIEDCOMPOSITESTATE_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_conditionconnector.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_conditionconnector.h
new file mode 100755
index 0000000..110c151
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_conditionconnector.h
@@ -0,0 +1,203 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+/// This file has class declaration of the CFrameworkunifiedConditionConnector. This class is responsible for
+/// implementing interfaces required to use condition connector in statemachine.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_conditionconnector.h
+ * @brief \~english This file has class declaration of the CFrameworkunifiedConditionConnector. This class is responsible for
+ * implementing interfaces required to use condition connector in statemachine.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMCONDITIONCONNECTOR_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMCONDITIONCONNECTOR_H__
+
+#include <native_service/frameworkunified_sm_externaltransition.h>
+#include <string>
+#include <vector>
+
+// This class is responsible for implementing interfaces required to use condition connector in statemachine.
+class CFrameworkunifiedConditionConnector : public CFrameworkunifiedExternalTransition {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedConditionConnector
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedConditionConnector.
+ /// \~english @param [in] f_strName
+ /// std::string - Name of the condition connector
+ /// \~english @retval
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Inherite from base class CFrameworkunifiedExternalTransition.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedExternalTransition, ~CFrameworkunifiedConditionConnector
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedConditionConnector(std::string f_strName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedConditionConnector
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedCompositeState
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedConditionConnector created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Class CFrameworkunifiedExternalTransition instance and CFrameworkunifiedConditionConnector instance release.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedConditionConnector::CFrameworkunifiedConditionConnector
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedConditionConnector();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedConditionConnector
+ /// \~english @par Brief
+ /// This API evaluates the guards added in the condition list. If the guard is evaluated as
+ /// true then statemachine transitions to target state associated with guard.
+ /// \~english @param [in] f_pSourceState
+ /// CFrameworkunifiedState* - Source state in which reaction is being executed
+ /// \~english @param [in] f_pData
+ /// CEventDataPtr - event data
+ /// \~english @retval CFrameworkunifiedState*
+ /// CFrameworkunifiedState* - Returns Active state
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedConditionConnector created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter f_pSourceState is NULL. [NULL]
+ /// - If m_pConditionList is NULL. [NULL]
+ /// \~english @par Detail
+ /// This API evaluates the guards added in the condition list. If the guard is evaluated as
+ /// true then statemachine transitions to target state associated with guard.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedConditionConnector
+ /// \~english @par Brief
+ /// Adds connect condition into condition list of current connection
+ /// \~english @param [in] f_pGuard
+ /// CFrameworkunifiedState* - Pointer to the guard object to be added in the currrent connection
+ /// \~english @param [in] f_pTargetState
+ /// CFrameworkunifiedState* - Target state for given guard condition
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
+ /// eFrameworkunifiedStatusNullPointer
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedConditionConnector created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If m_pConditionList is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If parameter f_pGuard is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If parameter f_pTargetState is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Adds connect condition into condition list of current connection.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedAddCondition(CFrameworkunifiedGuard *f_pGuard, CFrameworkunifiedState *f_pTargetState);
+
+ private:
+ // This class defines the conditions required in condition connector
+ class CCondition {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CCondition
+ /// Parameterized constructor
+ /// \param [in] f_pGuard
+ /// CFrameworkunifiedGuard* - guard object
+ /// \param [in] f_pTargetState
+ /// CFrameworkunifiedState* - target state for a condition
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CCondition(CFrameworkunifiedGuard *f_pGuard, CFrameworkunifiedState *f_pTargetState);
+
+ // pointer to guard that will be evaluated for a condition
+ CFrameworkunifiedGuard *m_pGuard;
+
+ // pointer to target state for a condition
+ CFrameworkunifiedState *m_pTargetState;
+ };
+
+ // Condition list
+ typedef std::vector<CCondition *> TConditionList;
+
+ // Condition list iterator
+ typedef TConditionList::iterator TConditionIterator;
+
+ // condition connector name
+ std::string m_strName;
+
+ // List of conditions
+ TConditionList *m_pConditionList;
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMCONDITIONCONNECTOR_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_deephistorystate.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_deephistorystate.h
new file mode 100755
index 0000000..fbb74ee
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_deephistorystate.h
@@ -0,0 +1,141 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the declaration of class CFrameworkunifiedDeepHistoryState . CFrameworkunifiedDeepHistoryState is
+/// derived from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported
+/// by HSM Deep History state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_deephistorystate.h
+ * @brief \~english This file has the declaration of class CFrameworkunifiedDeepHistoryState.CFrameworkunifiedDeepHistoryState is
+ * derived from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported
+ * by HSM Deep History state.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_SM_DEEPHISTORYSTATE_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_SM_DEEPHISTORYSTATE_H__
+
+#include <native_service/frameworkunified_sm_historystate.h>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM Shallow History state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedDeepHistoryState : public CFrameworkunifiedHistoryState {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedDeepHistoryState
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedDeepHistoryState.
+ /// \~english @param [in] f_pName
+ /// std::string - Name of the state
+ /// \~english @retval
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Inherite from base class CFrameworkunifiedHistoryState.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedHistoryState, ~CFrameworkunifiedDeepHistoryState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedDeepHistoryState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedDeepHistoryState
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedDeepHistoryState
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedDeepHistoryState created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Class CFrameworkunifiedHistoryState instance and CFrameworkunifiedDeepHistoryState instance release.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedDeepHistoryState::CFrameworkunifiedDeepHistoryState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ~CFrameworkunifiedDeepHistoryState();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedDeepHistoryState
+ /// \~english @par Brief
+ /// This function stores the last active state
+ /// \~english @param
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
+ /// eFrameworkunifiedStatusNullPointer
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedConditionConnector created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If m_pParentState is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This function stores the last active state.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UpdateHistory();
+
+ private:
+ static const UI_32 m_suievDeepHistory;
+};
+
+#endif /* __FRAMEWORKUNIFIED_SM_DEEPHISTORYSTATE_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_dispatcher.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_dispatcher.h
new file mode 100755
index 0000000..2f392ba
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_dispatcher.h
@@ -0,0 +1,338 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Application dispatch interface functions
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_dispatcher.h
+ * @brief \~english Application dispatch interface functions
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_SM_DISPATCHER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_SM_DISPATCHER_H__
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+
+class CFrameworkunifiedHSMFramework;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedHSMDispatcher
+/// \~english @par Brief
+/// Creates, initializes and runs the HSM dispatcher.
+/// \~english @param [in] cAppName
+/// PCSTR - pointer of Application/ thread name
+/// \~english @retval EFrameworkunifiedStatus
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// none
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcher(PCSTR cAppName);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedHSMDispatcherWithArguments
+/// \~english @par Brief
+/// This API creates, initializes the dispatcher and runs loop with command-line options.
+/// \~english @param [in] cAppName
+/// PCSTR - Pointer to application thread name
+/// \~english @param [in] argc
+/// int - Number of command-line options
+/// \~english @param [in] argv
+/// char *[] - Array of pointer to command-line options
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Pointer to default callback functions.
+/// \~english @param [in] f_pFrameworkunifiedHSM
+/// CFrameworkunifiedHSMFramework* - state machine object pointer(default NULL)
+/// \~english @param [in] cmdLineOptions
+/// CustomCommandLineOptions* - Parser setting of command-line options(Optional. When don't use, set NULL.)
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Function is called when a Dispatcher is created. */
+/// CbFuncPtr onDestroy; /* Function is called when the Dispatcher is released. */
+/// CbFuncPtr onStart; /* Function is called when the Dispatcher is started. */
+/// CbFuncPtr onStop; /* Function is called when the Dispatcher is stopped. */
+/// CbFuncPtr onPreStart; /* Function is called when the Dispatcher is pre started. */
+/// CbFuncPtr onPreStop; /* Function is called when the Dispatcher is pre stoped. */
+/// CbFuncPtr onBackgroundStart; /* Function is called when the Dispatcher is Background started. */
+/// CbFuncPtr onBackgroundStop; /* Function is called when the Dispatcher is Background stopped. */
+/// CbFuncPtr onDebugDump; /* Function is called when the Dispatcher detects abnormal state. */
+/// CbFuncPtr createStateMachine; /* Set dummy function that does nothing. */
+/// CbFuncPtr ssFrameworkInterface; /* Function to connect to SystemManager */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @par
+/// CustomCommandLineOptions Structure
+/// \~english @code
+/// typedef struct _CustomCommandLineOptions
+/// {
+/// PCSTR cShortOptions; /* Short options list. */
+/// PCHAR cLongOptions; /* Reserved. Set to NULL. */
+/// CbArgumentParser callback; /* Pointer to callback function to parse command-line options. */
+/// } CustomCommandLineOptions;
+/// @endcode
+/// \~english @par
+/// About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
+/// - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
+/// - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+/// - If application is resident service, link library libSS_SystemIfUnified
+/// (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
+/// - If application is nonresident service, define function that does nothing below.
+/// - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - Pointer to default callback functions specified in the argument (CbHandler) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - One of members in default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
+/// 15byte). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
+/// - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - The result of FrameworkunifiedOnInitialization is not eFrameworkunifiedStatusOK. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API creates and initializes the dispatcher with command-line options.\n
+/// It starts to mainloop that receives request or notification, and runs registered callback to dispatcher.
+/// When success starting mainloop, never return.
+/// Use this API to take over a command-line options to the dispatcher.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Error handling is not performed when the state machine event registration process (CFrameworkunifiedHSMFramework::FrameworkunifiedCreate) fails.\n
+/// The behavior of state machine objects must be guaranteed by the application implementation.
+/// - When an exception occurs during Dispatcher generating, an error log is output and eFrameworkunifiedStatusOK is returned.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see none
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherWithArguments(PCSTR cAppName, int argc, char *argv[],
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler,
+ CFrameworkunifiedHSMFramework *f_pFrameworkunifiedHSM = NULL,
+ CustomCommandLineOptions *cmdLineOptions = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetHSMType
+/// \~english @par Brief
+/// Set the Application Statemachine Type
+/// \~english @param [in] cAppName
+/// PCSTR - pointer of Application/ thread name
+/// \~english @code
+/// typedef enum _EUserChangeOptions {
+/// eUserchangeIgnore = 0,
+/// eUserchangeReInit,
+/// eUserchangeRetPrevState
+/// } EUserChangeOptions;
+/// @endcode
+/// \~english @retval EFrameworkunifiedStatus
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// none
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void FrameworkunifiedSetHSMType(EUserChangeOptions f_eHSMType);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedEnableAutoPublishServiceAvailable
+/// \~english @par Brief
+/// Enables the AutoPublishServiceAvailability Feature
+/// \~english @param none
+/// \~english @retval EFrameworkunifiedStatus
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// Enables the AutoPublishServiceAvailability Feature that publishes the service
+/// availability on entry of sFrameworkunifiedReady state and publishes the service unavailability
+/// on exit of sFrameworkunifiedReady state.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// none
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void FrameworkunifiedEnableAutoPublishServiceAvailable();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDisableAutoPublishServiceAvailable
+/// \~english @par Brief
+/// Disable to the AutoPublishServiceAvailability Feature.
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - Prerequisite is nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// None.
+/// \~english @par Detail
+/// This API disable feature that notify automatically service availability to clients
+/// at the timing of changing of internal state.\n
+/// If you disable this feature, the application needs to publish service availability state explicitly
+/// using FrameworkunifiedPublishServiceAvailability.
+/// \~english @par Classification
+/// Forbidden
+/// \~english @see FrameworkunifiedHSMDispatcherWithArguments FrameworkunifiedPublishServiceAvailability
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDisableAutoPublishServiceAvailable
+/// Disables the AutoPublishServiceAvailability Feature that publishes the service
+/// availability on entry of sFrameworkunifiedReady state and publishes the service unavailability
+/// on exit of sFrameworkunifiedReady state. Applications are responsible for publishing the service
+/// availability.
+void FrameworkunifiedDisableAutoPublishServiceAvailable();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedHSMEnableWaitInStoppingState
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedHSMEnableWaitInStoppingState
+/// If HSM application should wait in sStoppingState until user explicitly publishes evFrameworkunifiedStopComplete,
+/// then call this function before FrameworkunifiedHSMDispatcher APIs.
+/// Default behavior is application will not wait is sStoppingState.
+///
+/// \~english @par Brief
+/// Change state application when call FrameworkunifiedOnStop().
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - Prerequisite is nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// None.
+/// \~english @par Detail
+/// If HSM application should wait in sStoppingState until user explicitly publishes evFrameworkunifiedStopComplete,
+/// then call this function before FrameworkunifiedHSMDispatcher APIs.
+/// Default behavior is application will not wait in sStoppingState.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// none
+/// \~english @see FrameworkunifiedHSMDisableWaitInStoppingState
+VOID FrameworkunifiedHSMEnableWaitInStoppingState();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedHSMDisableWaitInStoppingState
+/// \~english @par Brief
+/// Chanage state to not wait in sStoppingState.
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - Prerequisite is nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// None.
+/// \~english @par Detail
+/// If HSM application should not wait in sStoppingState, then call this function before FrameworkunifiedHSMDispatcher APIs.\n
+/// Default behavior is application will not wait is sStoppingState. So, it's not mandatory to use it.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// none
+/// \~english @see FrameworkunifiedHSMEnableWaitInStoppingState
+VOID FrameworkunifiedHSMDisableWaitInStoppingState();
+
+#endif // __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_SM_DISPATCHER_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventdata.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventdata.h
new file mode 100755
index 0000000..e54d095
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventdata.h
@@ -0,0 +1,83 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+/// This file has class declaration of the CFrameworkunifiedAction. This is an interface class that defines
+/// interfaces for implementing action
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_eventdata.h
+ * @brief \~english This file has class declaration of the CFrameworkunifiedAction. This is an interface class that defines
+ * interfaces for implementing action
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMEVENTDATA_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMEVENTDATA_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+#include <boost/smart_ptr.hpp>
+
+
+class CEventData {
+ public:
+ CEventData(UI_32 f_uiEventId): m_uiEventId(f_uiEventId) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "CEventData parameterized constructor"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ virtual ~CEventData() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "CEventData destructor"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ // event id
+ UI_32 m_uiEventId;
+
+ private:
+ CEventData() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "CEventData constructor");
+ }
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMEVENTDATA_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventfactory.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventfactory.h
new file mode 100755
index 0000000..02a2b3b
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventfactory.h
@@ -0,0 +1,114 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file defines the events used by the statemachine framework
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_eventfactory.h
+ * @brief \~english This file defines the events used by the statemachine framework.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef CFRAMEWORKUNIFIEDEVENTFACTORY_H_ // NOLINT (build/header_guard)
+#define CFRAMEWORKUNIFIEDEVENTFACTORY_H_
+
+#include <native_service/frameworkunified_types.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class defines the events used by the statemachine framework
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedEventFactory {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedEventFactory
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedEventFactory.
+ /// \~english @param none
+ /// \~english @retval
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunifiedEventFactory
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedEventFactory();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedEventFactory
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedEventFactory
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedEventFactory created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Class CFrameworkunifiedHistoryState instance release.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedEventFactory::CFrameworkunifiedEventFactory
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedEventFactory();
+
+ /// Defines the events for starting an application
+ static const UI_32 evFrameworkunifiedStart = 0;
+
+ /// Defines the Higher limit for event id reserved only for framework
+ static const UI_32 evFrameworkunifiedEventLimit = 10;
+};
+
+#endif /* CFRAMEWORKUNIFIEDEVENTFACTORY_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_externaltransition.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_externaltransition.h
new file mode 100755
index 0000000..a466806
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_externaltransition.h
@@ -0,0 +1,268 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedExternalTransition class definitions. CFrameworkunifiedExternalTransition is derived
+/// from CFrameworkunifiedTransition class.This class implements the FrameworkunifiedReaction interface to support transition
+/// from one state to another state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_externaltransition.h
+ * @brief \~english This file has the CFrameworkunifiedExternalTransition class definitions. CFrameworkunifiedExternalTransition is derived
+ * from CFrameworkunifiedTransition class.This class implements the FrameworkunifiedReaction interface to support transition
+ * from one state to another state.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_EXTERNALTRANSITION_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_EXTERNALTRANSITION_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_transition.h>
+#include <vector>
+class CFrameworkunifiedGuard;
+class CFrameworkunifiedAction;
+class CEventData;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the FrameworkunifiedReaction interface to support transition
+/// from one state to another state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedExternalTransition : public CFrameworkunifiedTransition {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedExternalTransition
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedExternalTransition.
+ /// \~english @param [in] f_pTargetState
+ /// CFrameworkunifiedState* - pointer of target CFrameworkunifiedState object
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// inherit the CFrameworkunifiedTransition class and create instance of CFrameworkunifiedExternalTransition class \n
+ /// create the list for CFrameworkunifiedAction class,set pointer as member parameter\n
+ /// this class is intanced with FrameworkunifiedReaction interfase in order to support changing one state to other state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedExternalTransition, FrameworkunifiedReaction, FrameworkunifiedAddAction
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedExternalTransition
+ /// Parameterized constructor
+ /// \param [in] f_pTargetState
+ /// CFrameworkunifiedState* - Target state object
+ ///
+ /// \return none
+ CFrameworkunifiedExternalTransition(CFrameworkunifiedState *f_pTargetState); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedExternalTransition
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedExternalTransition
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedExternalTransition created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Class CFrameworkunifiedHistoryState instance release. \n
+ /// Member variable active action list of CFrameworkunifiedAction release.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedExternalTransition::CFrameworkunifiedExternalTransition
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedExternalTransition
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedExternalTransition();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedExternalTransition
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedReaction
+ /// The reaction for an event is implemented in this function. For external transition, Exit
+ /// of the source state is called and entry of the target state is called recursively.
+ ///
+ /// \~english @par Brief
+ /// CFrameworkunifiedExternalTransition instance event process.
+ /// \~english @param f_pSourceState
+ /// CFrameworkunifiedState* - source state object pointer
+ /// \~english @param f_pData
+ /// CEventDataPtr* - CEventData event pointer
+ /// \~english @retval CFrameworkunifiedState* active state pointer
+ /// \~english @retval NULL
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedExternalTransition created.
+ /// \~english @par Change of internal status
+ /// - If input parameter f_pSourceState is NULL. [NULL]
+ /// - If member variable m_pTargetState is NULL. [NULL]
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// if the self-instance has guard object,event operation will not conduct.
+ /// return soucestate(CFrameworkunifiedState class)object()f_pSourceState(set from parameter) as
+ /// activestate(CFrameworkunifiedState class)object\n
+ /// as activestate(CFrameworkunifiedState class)object
+ /// if there is no guard object:
+ /// - Exit process(FrameworkunifiedOnHSMStop call)for sorcestate(CFrameworkunifiedStateclass)object will conduct once more.
+ /// - Entryt process(FrameworkunifiedOnHSMStart call)for target state(CFrameworkunifiedState class)objectwill conduct once more.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedSetGuard, FrameworkunifiedAddAction
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedExternalTransition
+ /// \~english @par Brief
+ /// Sets the Guard object in External Transition
+ /// \~english @param f_pGuard
+ /// CFrameworkunifiedGuard* - CFrameworkunifiedGuard object pointer
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedExternalTransition created.
+ /// \~english @par Change of internal status
+ /// - If input parameter CFrameworkunifiedGuard is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Sets the Guard object in CFrameworkunifiedExternalTransition instance\n
+ /// in order to guard the transform process. and during setting process,\n
+ /// transform is not conduct
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedReaction, FrameworkunifiedAddAction
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSetGuard
+ /// Sets the Guard object in External Transition
+ ///
+ /// \param [in] f_pGuard
+ /// CFrameworkunifiedGuard* - guard object
+ ///
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus -
+ ///
+ virtual EFrameworkunifiedStatus FrameworkunifiedSetGuard(CFrameworkunifiedGuard *f_pGuard);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedExternalTransition
+ /// \~english @par Brief
+ /// Adds CFrameworkunifiedAction object to the action list
+ /// \~english @param f_pAction
+ /// CFrameworkunifiedAction* - CFrameworkunifiedAction object pointer
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedExternalTransition created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - If input parameter CFrameworkunifiedAction is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If member variable m_pActionList is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// add CFrameworkunifiedAction class object to the end of the list for CFrameworkunifiedAction class in parameter
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedReaction, FrameworkunifiedSetGuard
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedAddAction(CFrameworkunifiedAction *f_pAction);
+
+
+ protected :
+ /// pointer to the guard condition object
+ CFrameworkunifiedGuard *m_pGuard;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ExecuteTransition
+ /// Execute the transition actions, calls OnExit of Source State and OnEntry of target state
+ ///
+ /// \param [in] f_pSourceState
+ /// CEventDataPtr - source state
+ ///
+ /// \param [in] f_pData
+ /// CFrameworkunifiedState* - Event data
+ ///
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus -
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedState *ExecuteTransition(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData);
+
+ // Action list
+ typedef std::vector<CFrameworkunifiedAction *> TActionList;
+
+ // Action list iterator
+ typedef TActionList::iterator TActionListIterator;
+
+ // List of conditions
+ TActionList *m_pActionList;
+};
+#endif // __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_EXTERNALTRANSITION_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_dispatch.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_dispatch.h
new file mode 100755
index 0000000..70afea1
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_dispatch.h
@@ -0,0 +1,1054 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_framework_dispatch.h
+ * @brief \~english This file contains basic api to operate state machine
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_DISPATCH_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_DISPATCH_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetStateMachine
+/// \~english @par Brief
+/// Get pointer to the statemachine object.
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the framework application
+/// \~english @retval CFrameworkunifiedHSMParentFramework* pointer to the statemachine object
+/// \~english @retval NULL Failed to get pointer to the statemachine object
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) . [NULL]
+/// - Pointer to statemachine object is NULL. [NULL]
+/// \~english @par Detail
+/// Get pointer to the statemachine object associated with application framework handle.\n
+/// Do not release the statemachine object in application, because it is a part of the Dispathcer.
+/// \~english @par Classification
+/// public
+/// \~english @par type
+/// sync only
+/// \~english @see FrameworkunifiedHSMDispatcherWithArguments,FrameworkunifiedGetStateMachine
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSetStateMachine
+/// sets the statemachine object
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application session
+///
+/// \param [in] f_pFrameworkunifiedHSM
+/// CFrameworkunifiedHSM - Pointer to statemachine object
+///
+/// \return pointer to the StateMachine object
+/// CFrameworkunifiedHSMParentFramework* - pointer to the StateMachine object
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetStateMachine(HANDLE hApp,
+ CFrameworkunifiedHSM *f_pFrameworkunifiedHSM);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventToDispatcher
+/// \~english @par Brief
+/// Register an event in dispatcher
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application framework handle
+/// \~english @param [in] pServiceName
+/// PCSTR pServiceName - Service Name
+/// \~english @param [in] iCmd
+/// UI_32 iCmd - service protocol command/request/acknowledgment ID
+/// \~english @param [in] iEvent
+/// UI_32 iEvent - event to be posted to active state on receiving iCmd from pServiceName.
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to service name specified in the argument (pServiceName) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Register an event information (iCmd,iEvent) for service specified in the argument in dispatcher.\n
+/// After that, when receiving an iCmd from service, post the event to active state.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Operation is not guaranteed if a different handle is set for an application handle.
+/// - Operation is not guaranteed if an invalid handle is set for a session handle.
+/// - This API registers one event for one command and one callback for one event.\n
+/// When registration is performed for the same command, the previously registered event is activated.
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see FrameworkunifiedAttachHSMEventsToDispatcher
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachHSMEventToDispatcher
+/// Registers a single event with the dispatcher for a given service.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pServiceName
+/// PCSTR - Service Name
+/// \param [in] iCmd
+/// UI_32 - service protocol command/request/acknowledgment ID
+/// \param [in] iEvent
+/// UI_32 - event to be posted to active state on receiving iCmd from pServiceName.
+/// \param [in] hSession
+/// HANDLE - Session Handle.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachHSMEventToDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, UI_32 iEvent,
+ HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// Register events in dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application framework handle
+/// \~english @param [in] pServiceName
+/// PCSTR pServiceName - Service Name
+/// \~english @param [in] pEventIds
+/// const FrameworkunifiedProtocolEvent *pEventIds - structure mapping event ids with the messages
+/// \~english @param [in] uiEventCount
+/// UI_32 uiEventCount - no of events
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to service name specified in the argument (pServiceName) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to FrameworkunifiedProtocolEvent structure specified in the argument is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Register events information (iCmd,iEvent) for service specified in the argument in dispatcher.\n
+/// After that, when receiving an iCmd from service, post the event to active state.\n
+/// If register failed, only the events that register before it are valid.\n
+/// When multiple registration, if an error occurs in the second and subsequent, becomes effective only \n
+/// information that has been registered so far. \n
+/// For number of upper limit of the registration possible event, depending on \n
+/// the securable size as the area of the FrameworkunifiedProtocolEvent structure. Therefore, note to ensure \n
+/// the size of the area of the FrameworkunifiedProtocolEvent structure at the call side of API, and define \n
+/// the number of event.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Operation is not guaranteed if a different handle is set to Handle for the application.
+/// - Operation is not guaranteed if an invalid handle is set for a session handle.
+/// - If an error occurs when multiple events are registered, it is impossible to determine which event was valid.
+/// Therefore, either register multiple event information again or delete multiple event information at the same time when registration fails.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see FrameworkunifiedAttachHSMEventToDispatcher
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachHSMEventsToDispatcher
+/// Registers a multiple event with the dispatcher for a given service.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pServiceName
+/// PCSTR - Service Name
+/// \param [in] pEventIds
+/// const FrameworkunifiedProtocolEvent* - structure mapping event ids with the messages
+/// \param [in] uiEventCount
+/// UI_32 - no of events
+/// \param [in] hSession
+/// HANDLE - Session Handle.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachHSMEventsToDispatcher(HANDLE hApp, PCSTR pServiceName,
+ const FrameworkunifiedProtocolEvent *pEventIds,
+ UI_32 uiEventCount,
+ HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// register a notification in service
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNotification
+/// PCSTR pNotification - Name of Notification
+/// \~english @param [in] max_length
+/// const UI_32 max_length - Max size of the notification message
+/// \~english @param [in] persType
+/// const EFrameworkunifiedNotificationType persType - Type of persistent
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pNotification) to service name is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// send message to Notification Service to register a notification
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMRegisterNotificatsionEvent
+/// API to send message to Notification Service to register a notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+/// \param [in] max_length
+/// const UI_32 - Max size of the notification message
+/// \param [in] persType
+/// const EFrameworkunifiedNotificationType - Type of persistent
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMRegisterNotificatsionEvent(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const EFrameworkunifiedNotificationType persType);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// register many notifications in service
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pList
+/// const FrameworkunifiedNotificationsList *pList - List of the notifications that need to be registered
+/// \~english @param [in] uiListLength
+/// UI_32 uiListLength - Length of the list
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pList) to service name is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// send message to Notification Service to register many notifications
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMRegisterNotificationsEvents
+/// API to send message to Notification Service to register a notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pList
+/// FrameworkunifiedNotificationsList - List of the notifications that need to be registered
+/// \param [in] uiListLength
+/// const UI_32 - Length of the list
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMRegisterNotificationsEvents(HANDLE hApp, const FrameworkunifiedNotificationsList *pList,
+ UI_32 uiListLength);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// remove a notification in service
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNotification
+/// cPCSTR pNotification - Name of Notification
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pNotification) to service name is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// send message to Notification Service to remove a notification
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnRegisterNotificationEvent
+/// API to send message to Notification Service to remove a notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnRegisterNotificationEvent(HANDLE hApp, PCSTR pNotification);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// attach an event to the dispatcher on receiving a specific notification.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNotification
+/// cPCSTR pNotification - Name of Notification
+/// \~english @param [in] iEventId
+/// UI_32 iEventId - event ID
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pNotification) to service name is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// attach an event to the dispatcher on receiving a specific notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachNotificationEventToDispatcher
+/// API to attach a event to the dispatcher on receiving a specific notification.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNotification
+/// PCSTR - Notification String.
+/// \param [in] iEventId
+/// UI_32 - event to be posted to active state on receiving iCmd from pServiceName.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationWithHSMEvent(HANDLE hApp, PCSTR pNotification,
+ UI_32 iEventId);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// attach many events to eath dispatcher on receiving a specific notification.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNtfyEvent
+/// const FrameworkunifiedNotificationEvent *pNtfyEvent - Notification event structure.
+/// \~english @param [in] uiEventCount
+/// UI_32 uiEventCount - Number of Notification event
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to FrameworkunifiedProtocolEvent structure specified in the argument is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// attach many events to eath dispatcher on receiving a specific notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachNotificationEventsToDispatcher
+/// API to attach a event to the dispatcher on receiving a specific notification.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNtfyEvent
+/// const FrameworkunifiedNotificationEvent* - Notification event structure.
+/// \param [in] uiEventCount
+/// UI_32 - Number of Notification event
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationsWithHSMEvent(HANDLE hApp, const FrameworkunifiedNotificationEvent *pNtfyEvent,
+ UI_32 uiEventCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// detach events from the dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNtfyHandler
+/// const FrameworkunifiedNotificationEvent *pNtfyHandler - Notification handler structure.
+/// \~english @param [in] uiHandlerCount
+/// UI_32 uiHandlerCount - Notification handler structure.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to FrameworkunifiedProtocolEvent structure specified in the argument is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// detach events from the dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnsubscribeNotificationsWithHSMEvent
+/// API to detach a notification event from the dispatcher.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNtfyHandler
+/// const FrameworkunifiedNotificationEvent* - Notification handler structure.
+/// \param [in] uiHandlerCount
+/// UI_32 - Number of notification handlers
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationsWithHSMEvent(HANDLE hApp, const FrameworkunifiedNotificationEvent *pNtfyHandler,
+ UI_32 uiHandlerCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// detach a notification event from the dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNotification
+/// PCSTR pNotification - Notification String.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pNotification) to service name is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// detach a notification event from the dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachNotificationEventsFromDispatcher
+/// API to detach a notification event from the dispatcher.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNotification
+/// PCSTR - Notification String.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationWithHSMEvent(HANDLE hApp, PCSTR pNotification);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// Registers a multiple HSM event with the dispatcher for a given service.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Child Thread handle
+/// \~english @param [in] pEventIds
+/// const FrameworkunifiedProtocolEvent *pEventIds - structure mapping event ids with the messages
+/// \~english @param [in] uiEventCount
+/// UI_32 uiEventCount - no of events
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to FrameworkunifiedProtocolEvent structure specified in the argument is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Registers a multiple HSM event with the dispatcher for a given service.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachParentHSMEventsToDispatcher
+/// Registers a multiple HSM event with the dispatcher for a given service.
+///
+///
+/// \param [in] hChildApp
+/// HANDLE - Application framework handle
+/// \param [in] pEventIds
+/// const FrameworkunifiedProtocolEvent* - structure mapping event ids with the messages
+/// \param [in] uiEventCount
+/// UI_32 - no of events
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachParentHSMEventsToDispatcher(HANDLE hChildApp, const FrameworkunifiedProtocolEvent *pEventIds,
+ UI_32 uiEventCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// detach notification HSM events from the dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Child Thread handle
+/// \~english @param [in] puiEventArray
+/// const PUI_32 puiEventArray - Array of events
+/// \~english @param [in] uiEventCount
+/// UI_32 uiEventCount - Number of events
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// detach notification HSM events from the dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachParentHSMEventsFromDispatcher
+/// API to detach a notification HSM event from the dispatcher.
+///
+///
+/// \param [in] hChildApp
+/// HANDLE - Child Thread handle
+/// \param [in] puiEventArray
+/// const PUI_32 puiEventArray - Array of events
+/// \param [in] uiEventCount
+/// UI_32 - Number of events
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachParentHSMEventsFromDispatcher(HANDLE hChildApp, const PUI_32 puiEventArray, UI_32 uiEventCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventsFromDispatcher
+/// \~english @par Brief
+/// detach multiple events from the dispatcher
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application framework handle
+/// \~english @param [in] pServiceName
+/// PCSTR pServiceName - Service Name
+/// \~english @param [in] puiCmdArray
+/// const PUI_32 puiCmdArray - Array of commands
+/// \~english @param [in] uiCmdCount
+/// UI_32 uiCmdCount - Number of Commands
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @retval eFrameworkunifiedStatusInvldParam invalid parameter
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to service name specified in the argument (pServiceName) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pServiceName) to service name doesn't exist [eFrameworkunifiedStatusFail]
+/// - Pointer to event array specified in the argument which will be deleted is NULL [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Detach multiple events(puiCmdArray) information for service specified in the argument from dispatcher.\n
+/// After that, when receiving command from service, post the event to unactive state.\n
+/// If the information has been deleted, return eFrameworkunifiedStatusOK.\n
+/// If the specific event has not been registered, return eFrameworkunifiedStatusOK.\n
+/// If number of puiCmdArray to be deleted is 0, return eFrameworkunifiedStatusOK.\n
+/// When deleting multiple events, if an error occurs, stop deleting. \n
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Operation is not guaranteed if a different handle is set for an application handle.
+/// - Operation is not guaranteed if an invalid handle is set for a session handle.
+/// - Operatuib is not guaranteed if a puiCmdArray that differs from the events to be deleted is set.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see FrameworkunifiedDetachHSMEventFromDispatcher
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachHSMEventsFromDispatcher
+/// API to detach a notification HSM event from the dispatcher.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pServiceName
+/// PCSTR - Service Name
+/// \param [in] puiCmdArray
+/// const PUI_32 - Array of commands
+/// \param [in] uiCmdCount
+/// UI_32 - Number of Commands
+/// \param [in] hSession
+/// HANDLE - Session Handle.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+EFrameworkunifiedStatus FrameworkunifiedDetachHSMEventsFromDispatcher(HANDLE hApp, PCSTR pServiceName, const PUI_32 puiCmdArray,
+ UI_32 uiCmdCount, HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventFromDispatcher
+/// \~english @par Brief
+/// detach an event from the dispatcher
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application framework handle
+/// \~english @param [in] pServiceName
+/// PCSTR pServiceName - Service Name
+/// \~english @param [in] iCmd
+/// UI_32 iCmd - service protocol command/request/acknowledgment ID
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to service name specified in the argument (pServiceName) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pServiceName) to service name doesn't exist [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Detach an event information for service specified in the argument from dispatcher.\n
+/// After that, when receiving command from service, post the event to unactive state.\n
+/// If the information has been deleted or the specific iCmd has not been registered, return eFrameworkunifiedStatusOK.\n
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Operation is not guaranteed if a different handle is set for an application handle.
+/// - Operation is not guaranteed if an invalid handle is set for a session handle.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see FrameworkunifiedDetachHSMEventsFromDispatcher
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachHSMEventFromDispatcher
+/// API to detach a notification HSM event from the dispatcher.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pServiceName
+/// PCSTR - Service Name
+/// \param [in] iCmd
+/// UI_32 - service protocol command/request/acknowledgment ID
+/// \param [in] hSession
+/// HANDLE - Session Handle.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+EFrameworkunifiedStatus FrameworkunifiedDetachHSMEventFromDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, HANDLE hSession = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetStateMachine
+/// \~english @par Brief
+/// Get pointer to the statemachine object.
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the framework application
+/// \~english @retval CFrameworkunifiedHSMParentFramework* pointer to the statemachine object
+/// \~english @retval NULL Failed to get pointer to the statemachine object
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) . [NULL]
+/// - HANDLE specified in the argument (hApp) is not generated by FrameworkunifiedHSMDispatcherWithArguments. [NULL]
+/// \~english @par Detail
+/// Get pointer to the statemachine object associated with application framework handle.\n
+/// Do not release the statemachine object in application, because it is a part of the Dispathcer.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see FrameworkunifiedHSMDispatcherWithArguments,FrameworkunifiedSetStateMachine
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetStateMachine
+/// returns the pointer to the statemachine object
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application session
+///
+/// \return pointer to the StateMachine object
+/// CFrameworkunifiedHSMParentFramework* - pointer to the StateMachine object
+///
+/// \see
+///
+CFrameworkunifiedHSMFramework *FrameworkunifiedGetStateMachine(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventFromDispatcher
+/// \~english @par Brief
+/// subscribing to single event of a service. attaches the session event with HSM events.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application handle
+/// \~english @param [in] uiEventId
+/// UI_32 uiEventId - Session Event id
+/// \~english @param [in] uiHSMEventId
+/// UI_32 uiHSMEventId- Statemachine Event id
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// This API is used for subscribing to single event of a service.
+/// This API also attaches the session event with HSM events.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventWithHSMEvent
+/// This API is used for subscribing to single event of a service.
+/// This API also attaches the session event with HSM events.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] uiEventId
+/// UI_32 - Session Event id
+/// \param [in] uiHSMEventId
+/// UI_32 - Statemachine Event id
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSubscribeToSessionEventsWithHSMEvents
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventWithHSMEvent(HANDLE hApp, UI_32 uiEventId, UI_32 uiHSMEventId, HANDLE hSession);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventFromDispatcher
+/// \~english @par Brief
+/// subscribing to multiple events of a service. attaches the session events with HSM events.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application handle
+/// \~english @param [in] pEventIds
+/// const FrameworkunifiedProtocolEvent *pEventIds - structure mapping session event id's with the hsm event id's
+/// \~english @param [in] uiEventCount
+/// UI_32 uiEventCount - count of events
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to FrameworkunifiedProtocolEvent structure specified in the argument is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// This API is used for subscribing to multiple events of a service.
+/// his API also attaches the session events with hsm events.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventsWithHSMEvents
+/// This API is used for subscribing to multiple events of a service.
+/// This API also attaches the session events with hsm events.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pEventIds
+/// FrameworkunifiedProtocolEvent - structure mapping session event id's with the hsm event id's
+/// \param [in] uiEventCount
+/// UI_32 - count of events
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSubscribeToSessionEventWithHSMEvent
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventsWithHSMEvents(HANDLE hApp, const FrameworkunifiedProtocolEvent *pEventIds, UI_32 uiEventCount,
+ HANDLE hSession);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventFromDispatcher
+/// \~english @par Brief
+/// unsubscribe from event of a service. detaches HSM event from session event.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application handle
+/// \~english @param [in] uiEventId
+/// UI_32 uiEventId - Event id
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// API to unsubscribe from event of a service. Also detaches HSM event from session event.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventWithHSMEvent
+/// API to unsubscribe from event of a service. Also detaches HSM event from session event.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] uiEventId
+/// UI_32 - Event id
+/// \param [in] hSession
+/// HANDLE - Session Handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnSubscribeSessionEventsWithHSMEvents
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventWithHSMEvent(HANDLE hApp, UI_32 uiEventId, HANDLE hSession);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventFromDispatcher
+/// \~english @par Brief
+/// unsubscribe from multiple events of a service. detaches HSM events from session events.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application handle
+/// \~english @param [in] pEventsArray
+/// PUI_32 pEventsArray - Array of events id's.
+/// \~english @param [in] uiListSize
+/// UI_32 uiListSize - count of elements in array.
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// API to unsubscribe from multiple events of a service. Also detaches HSM events from session events.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventsWithHSMEvents
+/// API to unsubscribe from multiple events of a service. Also detaches HSM events from session events.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] pEventsArray
+/// PUI_32 - Array of events id's.
+/// \param [in] uiListSize
+/// UI_32 - count of elements in array.
+/// \param [in] hSession
+/// HANDLE - Session Handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnSubscribeSessionEventWithHSMEvent
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventsWithHSMEvents(HANDLE hApp, PUI_32 pEventsArray, UI_32 uiListSize,
+ HANDLE hSession);
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_DISPATCH_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_if.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_if.h
new file mode 100755
index 0000000..8c90e59
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_if.h
@@ -0,0 +1,486 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_framework_if.h
+ * @brief \~english This File has public Macro definition that simplifies the statemachine implementation
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_IF_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_IF_H__
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro creates an instance of a state object.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro creates an instance of a state object with the specified class name.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Create a instance of state object
+#define CREATE_STATE(class_name) \
+ C## class_name *l_p## class_name = new C## class_name(#class_name);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates a framework event with a process and adds it to a state.
+/// \~english @param [in] state State
+/// \~english @param [in] eventid Event ID
+/// \~english @param [in] reaction Pointers to CFrameworkunifiedReaction objects
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macros retrieves the current state machine from the application handles used in the process
+/// and associates framework events with the process and adds them to the state using FrameworkunifiedFrameworkConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Connect framework event to reaction and add to state
+#define FRAMEWORKUNIFIED_CONNECT_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(CFrameworkunifiedHSMParentFramework::e## state, \
+ CFrameworkunifiedHSMParentFramework::_## eventid, l_pTrn## reaction, #eventid);
+
+#define FRAMEWORKUNIFIED_CONNECT_LOCAL_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(CFrameworkunifiedHSMParentFramework::e## state, \
+ CFrameworkunifiedHSMParentFramework::_## eventid, l_pLocalTrn## reaction, #eventid);
+
+/// Connect framework event to reaction and add to state as deferred event
+#define FRAMEWORKUNIFIED_CONNECT_DEFERREDEVENT(state, eventid) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(CFrameworkunifiedHSMParentFramework::e## state, \
+ CFrameworkunifiedHSMParentFramework::_## eventid, NULL, #eventid, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates a child state as the default state with the ready state of the framework.
+/// \~english @param [in] child Child state
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro retrieves the current state machine from the application handles used in the process and uses FrameworkunifiedFrameworkConnect() to associate the specified child state with the ready state of the framework as the default state.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect state to framework ready state as default state
+#define FRAMEWORKUNIFIED_CONNECT_DEFAULTSTATE(child) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(l_p## child, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates the child state with the ready state of the framework.
+/// \~english @param [in] child Child state
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro retrieves the current state machine from the application handles used in the process and associates the specified child state with the ready state of the framework using FrameworkunifiedFrameworkConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect state to framework ready state
+#define FRAMEWORKUNIFIED_CONNECT_STATE(child) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(l_p## child);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// A macro that associates a child state as the defaut state with a parent state.
+/// \~english @param [in] parent Parent state
+/// \~english @param [in] child Child state
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro takes the current state machine from the application handles used in the process and uses FrameworkunifiedConnect() to associate the specified child state with the specified parent state as the default state.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect child state to parent state as default state
+#define CONNECT_DEFAULTSTATE(parent, child) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## parent, l_p## child, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// A macro that associates a child state with a parent state.
+/// \~english @param [in] parent Parent state
+/// \~english @param [in] child Child state
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro takes the current state machine from the application handles used in the process and associates the specified child state with the specified parent state using FrameworkunifiedConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect child state to parent state
+#define CONNECT_STATE(parent, child) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## parent, l_p## child);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates a state as the state of the root.
+/// \~english @param [in] orthogonalstate quadrature state(CFrameworkunifiedOrthogonalState*)
+/// \~english @param [in] orthogonalregion orthographic region(CFrameworkunifiedCompositeState*)
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro gets the current state machine from the application handles used in the process and associates the specified orthographic state as the state of the root using FrameworkunifiedConnectOrthogonal().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect child state to parent state
+#define CONNECT_ORTHOGONAL_REGION(orthogonalstate, orthogonalregion) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnectOrthogonal(l_p## orthogonalstate, l_p## orthogonalregion);
+
+/// connect the deferred event and reactions and associate them with the state
+#define CONNECT_DEFERREDEVENT(state, eventid) \
+ FrameworkunifiedGetStateMachine(hApp)->FrameworkunifiedConnect(l_p## state, _## eventid, NULL, #eventid, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates a framework event with a process and adds it to a state.
+/// \~english @param [in] state State
+/// \~english @param [in] eventid Event ID
+/// \~english @param [in] reaction Pointers to CFrameworkunifiedReaction objects
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macros retrieves the current state machine from the application handles used in the process and associates framework events with the process and adds them to the state using FrameworkunifiedConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect event to reaction and add to state
+#define CONNECT_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid);
+
+/// connect event to reaction and add to state
+#define CONNECT_LOCAL_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, _## eventid, l_pLocalTrn## reaction, #eventid);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro logs state and events of the state machine.
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro gets the current state machine from the application handles used in the process and logs the state and events of the state machine using FrameworkunifiedPrintAllStates().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// print state machine states and events
+#define PRINTSTATEMACHINE() \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedPrintAllStates();
+
+/// Connect application defined event to application defined reaction and add to framework state
+#define CONNECT_FRAMEWORKUNIFIED_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, CFrameworkunifiedHSMParentFramework::_## eventid, \
+ l_pTrn## reaction, #eventid);
+
+/// Connect application defined deferred event to framework state
+#define CONNECT_FRAMEWORKUNIFIED_DEFERREDEVENT(state, eventid) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, CFrameworkunifiedHSMParentFramework::_## eventid, \
+ NULL, #eventid, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates an application event with a process and adds it to a state.
+/// \~english @param [in] state State
+/// \~english @param [in] eventid Event ID
+/// \~english @param [in] reaction Pointers to CFrameworkunifiedReaction objects
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macros retrieves the current state machine from the application handles used in the process, and associates the events of the application with the process and adds them to the state using FrameworkunifiedFrameworkConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIED_CONNECT_APP_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(CFrameworkunifiedHSMParentFramework::e## state, _## eventid, \
+ l_pTrn## reaction, #eventid);
+
+#define FRAMEWORKUNIFIED_CONNECT_APP_DEFERREDEVENT(state, eventid) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(CFrameworkunifiedHSMParentFramework::e## state, _## eventid, \
+ NULL, #eventid, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that create and add Shallow history states to their parents.
+/// \~english @param [in] parent Parent state
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro retrieves the current state machine from the application handles used in the process after a new Shallow history state is created, and adds the Shallow history state created to the parent state using FrameworkunifiedConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+// create a new shallow history state and add it in parent state
+#define ADD_SHALLOWHISTORYSTATE(parent) \
+ CFrameworkunifiedShallowHistoryState *l_p##parent##SHALLOWHISTORYSTATE = new CFrameworkunifiedShallowHistoryState(SHALLOWHISTORYSTATE);\
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## parent, l_p##parent##SHALLOWHISTORYSTATE);\
+ CHKNULL(l_p##parent##SHALLOWHISTORYSTATE);\
+ l_p##parent##SHALLOWHISTORYSTATE->SetDefaultHistory();
+
+// create a new shallow history state and add it in parent state
+#define ADD_DEEPHISTORYSTATE(parent) \
+ CFrameworkunifiedDeepHistoryState *l_p##parent##DEEPHISTORYSTATE = new CFrameworkunifiedDeepHistoryState(DEEPHISTORYSTATE);\
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## parent, l_p##parent##DEEPHISTORYSTATE);\
+ CHKNULL(l_p##parent##DEEPHISTORYSTATE);\
+ l_p##parent##DEEPHISTORYSTATE->SetDefaultHistory();
+
+/// connect deep history event to reaction and add to state
+#define CONNECT_DEEPHISTORYEVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##DEEPHISTORYSTATE, #eventid);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that associate Shallow history events with processes and add them to states.
+/// \~english @param [in] state State
+/// \~english @param [in] eventid Event ID
+/// \~english @param [in] reaction Pointers to CFrameworkunifiedReaction objects
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macros retrieves the current state machine from the application handles used in the process and associates Shallow history events with the process and adds them to the state using FrameworkunifiedConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect shallow history event to reaction and add to state
+#define CONNECT_SHALLOWHISTORYEVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##SHALLOWHISTORYSTATE, #eventid);
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+///////////////////////////////////////////////////////////////////////////////////////////
+
+/// FrameworkunifiedCreateStateMachine
+/// The application state machine is created in this interface. User defined events can also
+/// be connected to the framework states in this interface.
+///
+/// \~english @par Brief
+/// - It's a callback function to create state machine used by application.
+/// \~english @param [in] hApp
+/// HANDLE - handle to application
+/// \~english @retval eFrameworkunifiedStatusOK -successed
+/// \~english @retval Except eFrameworkunifiedStatusOK - failure
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Inside state change
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// The application state machine is created in this interface. User defined events can also\n
+/// be connected to the framework states in this interface.
+/// - FrameworkunifiedDispatcherWithArguments
+/// - FrameworkunifiedDispatcher
+/// - FrameworkunifiedCreateDispatcherWithoutLoop
+/// \~english @par Classification
+/// - Public
+/// \~english @see FrameworkunifiedDispatcherWithArguments, FrameworkunifiedDispatcher, FrameworkunifiedCreateDispatcherWithoutLoop
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+///////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////
+/// All HSM applications must define this function. This function will be called on entry
+/// of sFrameworkunifiedLoadData state.
+// Expected in this function:
+/// All the persistent data of the applications should be loaded in this function.
+///
+/// \~english @par Brief
+/// - This function defines loading persistent data of HSM application.
+/// \~english @param [in] hApp
+/// HANDLE - handle to application
+/// \~english @retval eFrameworkunifiedStatusOK -successed
+/// \~english @retval Except eFrameworkunifiedStatusOK - failure
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Inside state change
+/// - None
+/// \~english @par Conditions of processing failure
+/// - The implementation specification of the callback depends on the implementation (design) of the application.
+/// For this reason, the application should consider the Public of errors in the failed condition.
+/// \~english @par Detail
+/// - All HSM applications must define this function. This function will be called on entry\n
+/// of sFrameworkunifiedLoadData state.Expected in this function:\n
+/// All the persistent data of the applications should be loaded in this function.
+/// \~english @par Classification
+/// - Private
+/// \~english @par Detail
+/// - None
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMOnLoadData(HANDLE hApp);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+///////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////
+/// All HSM applications must define this function. This function will be called on exit
+/// of sFrameworkunifiedRun state.
+// Expected in this function:
+/// Send stop request to all the child threads.
+///
+/// \~english @par Brief
+/// - This function defines sending stop request to the child threads of HSM application.
+/// \~english @param [in] hApp
+/// HANDLE - handle to application
+/// \~english @retval eFrameworkunifiedStatusOK -successed
+/// \~english @retval Except eFrameworkunifiedStatusOK - failure
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Inside state change
+/// - None
+/// \~english @par Conditions of processing failure
+/// - The implementation specification of the callback depends on the implementation (design) of the application.
+/// For this reason, the application should consider the Public of errors in the failed condition.
+/// \~english @par Detail
+/// - All HSM applications must define this function.\n
+/// This function will be called on exit of sFrameworkunifiedRun state.\n
+/// Expected in this function:Send stop request to all the child threads.
+/// \~english @par Classification
+/// - Private
+/// \~english @par Type
+/// - None
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMOnStopInsFrameworkunifiedRun(HANDLE hApp);
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_IF_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_types.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_types.h
new file mode 100755
index 0000000..fb00ecd
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_types.h
@@ -0,0 +1,494 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This File has public Macro definition that simplifies the statemachine implementation
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_framework_types.h
+ * @brief \~english This File has public Macro definition that simplifies the statemachine implementation
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_FRAMEWORKUNIFIED_SM_FRAMEWORK_TYPES_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_FRAMEWORKUNIFIED_SM_FRAMEWORK_TYPES_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_leafstate.h>
+#include <native_service/frameworkunified_sm_internaltransition.h>
+#include <native_service/frameworkunified_sm_compositestate.h>
+#include <native_service/frameworkunified_sm_eventfactory.h>
+#include <native_service/frameworkunified_sm_externaltransition.h>
+#include <native_service/frameworkunified_sm_localtransition.h>
+#include <native_service/frameworkunified_sm_orthogonalstate.h>
+#include <native_service/frameworkunified_sm_shallowhistorystate.h>
+#include <native_service/frameworkunified_sm_deephistorystate.h>
+#include <native_service/frameworkunified_sm_guard.h>
+#include <native_service/frameworkunified_sm_conditionconnector.h>
+#include <native_service/frameworkunified_sm_action.h>
+#include <native_service/frameworkunified_sm_eventdata.h>
+#include <exception>
+#include <string>
+
+class CFrameworkunifiedState;
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the null pointer exception
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CNullPointerException: public std::exception {
+ virtual const char *what() const throw() {
+ return "Null pointer exception";
+ }
+};
+
+
+/// Macro to check pointer for null value and throw null pointer exception
+#define CHKNULL(x) if (NULL == x) throw CNullPointerException();
+
+#define SHALLOWHISTORYSTATE "ShallowHistory"
+#define DEEPHISTORYSTATE "DeepHistory"
+
+/// Defines the state machine class
+#define DEFINE_STATEMACHINE(class_name) \
+ class C## class_name : public CFrameworkunifiedHSM{ \
+ public: \
+ C## class_name(); \
+ virtual ~C## class_name(); \
+ EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL); \
+ };
+
+/// Defines the leafstate class that does not override entry and exit of base state
+#define DEFINE_LEAFSTATE(class_name) \
+ class C## class_name : public CFrameworkunifiedLeafState { \
+ public: \
+ C## class_name(std::string f_pName):CFrameworkunifiedLeafState(f_pName) {} };
+
+/// Defines the Composite state that does not override entry and exit of base state
+#define DEFINE_COMPOSITESTATE(class_name) \
+ class C## class_name : public CFrameworkunifiedCompositeState { \
+ public: \
+ C## class_name(std::string f_pName):CFrameworkunifiedCompositeState(f_pName) {} };
+
+/// Defines the Orthogonal state that does not override entry and exit of base state
+#define DEFINE_ORTHOGONALSTATE(class_name) \
+ class C## class_name : public CFrameworkunifiedOrthogonalState { \
+ public: \
+ C## class_name(std::string f_pName):CFrameworkunifiedOrthogonalState(f_pName) {} };
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that inherit CFrameworkunifiedLeafState classes.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that inherit from CFrameworkunifiedLeafState classes and override the following methods:
+/// The following overriding methods should be implemented by the user.
+/// - FrameworkunifiedOnEntry
+/// - FrameworkunifiedOnExit
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the leafstate that overrides entry and exit of base state
+#define DEFINE_LEAFSTATE_OVERRIDE(class_name) \
+ class C## class_name : public CFrameworkunifiedLeafState{ \
+ public: \
+ C## class_name(std::string f_pName); \
+ virtual ~C## class_name(); \
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData); \
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData); \
+ };
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that inherit CFrameworkunifiedCompositeState classes.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that inherit from CFrameworkunifiedCompositeState classes and override the following methods:
+/// The following overriding methods should be implemented by the user.
+/// - FrameworkunifiedOnEntry
+/// - FrameworkunifiedOnExit
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the Composite state class that overrides entry and exit of base state
+#define DEFINE_COMPOSITESTATE_OVERRIDE(class_name) \
+ class C## class_name : public CFrameworkunifiedCompositeState{ \
+ public: \
+ C## class_name(std::string f_pName); \
+ virtual ~C## class_name(); \
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData); \
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData); \
+ };
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that inherit CFrameworkunifiedOrthogonalState classes.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that inherit from CFrameworkunifiedOrthogonalState classes and override the following methods:
+/// The following overriding methods should be implemented by the user.
+/// - FrameworkunifiedOnEntry
+/// - FrameworkunifiedOnExit
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the Orthogonal state that overrides entry and exit of base state
+#define DEFINE_ORTHOGONALSTATE_OVERRIDE(class_name) \
+ class C## class_name : public CFrameworkunifiedOrthogonalState{ \
+ public: \
+ C## class_name(std::string f_pName); \
+ virtual ~C## class_name(); \
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData); \
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData); \
+ };
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that inherit CFrameworkunifiedInternalTransition classes.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that inherit from CFrameworkunifiedInternalTransition classes and override the following methods:
+/// The following overriding methods should be implemented by the user.
+/// - FrameworkunifiedReaction
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the InternalTransition class
+#define DEFINE_INTERNALTRANSITION(class_name) \
+ class C## class_name : public CFrameworkunifiedInternalTransition{ \
+ public: \
+ virtual CFrameworkunifiedState* FrameworkunifiedReaction(CFrameworkunifiedState* f_pSourceState, CEventDataPtr f_pData); \
+ };
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that define application events.
+/// \~english @param [in] event_name Event name
+/// \~english @param [in] value Event value
+/// \~english @retval UI_32 Event value for the application
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Values of events defined in CFrameworkunifiedEventFactory classes (evFrameworkunifiedEventLimit:10) are specifiedMacros that define events for an application by adding event values (value).
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the application event
+#define DEFINE_EVENT(event_name, value) \
+ static const UI_32 _## event_name = CFrameworkunifiedEventFactory::evFrameworkunifiedEventLimit + value;
+
+#define DEFINE_ACTION(class_name) \
+ class C## class_name: public CFrameworkunifiedAction{ \
+ public: \
+ C## class_name(std::string f_strName):CFrameworkunifiedAction(f_strName) {} \
+ VOID FrameworkunifiedAction(CFrameworkunifiedState *f_pSourceState, CFrameworkunifiedState *f_pTargetState, CEventDataPtr f_pEventData); \
+ };
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro creates an instance for an internal transition.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro creates an instance for an internal transition of a class with the specified name.\n
+/// Otherwise, the CNullPointerException objects are excepted.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// creates the instance of the internal transition
+#define CREATE_INTERNALTRANSITION(class_name) \
+ C## class_name *l_pTrn## class_name = new C## class_name(); \
+ CHKNULL(l_pTrn## class_name);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro creates an instance for an external transition.
+/// \~english @param [in] target_state State name for external transition
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that instantiate CFrameworkunifiedExternalTransition classes for external transitions.\n
+/// Otherwise, the CNullPointerException objects are excepted.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// creates the instance of the external transition
+#define CREATE_EXTERNALTRANSITION(target_state) \
+ CFrameworkunifiedExternalTransition *l_pTrn## target_state = new CFrameworkunifiedExternalTransition(l_p## target_state); \
+ CHKNULL(l_pTrn## target_state);
+
+/// creates the instance of the external transition
+#define CREATE_CONDITIONCONNECTOR(connector_name) \
+ CFrameworkunifiedConditionConnector *l_pTrn## connector_name = new CFrameworkunifiedConditionConnector( #connector_name); \
+ CHKNULL(l_pTrn## connector_name);
+
+
+/// creates the instance of the local transition
+#define CREATE_LOCALTRANSITION(target_state) \
+ CFrameworkunifiedLocalTransition *l_pLocalTrn## target_state = new CFrameworkunifiedLocalTransition(l_p## target_state); \
+ CHKNULL(l_pLocalTrn## target_state);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// A macro that instantiates an orthographic region.
+/// \~english @param [in] target_state State name for external transition
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that create instances of compound states (CFrameworkunifiedCompositeState classes) as instances of orthographic regions.\n
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// create orthogonal region
+#define CREATE_ORTHOGONALREGION(name) \
+ CFrameworkunifiedCompositeState *l_p## name = new CFrameworkunifiedCompositeState(#name);
+
+/// create action for external transition
+#define CREATE_ACTION(class_name) \
+ C## class_name *l_pTrn## class_name = new C## class_name( #class_name); \
+ CHKNULL(l_pTrn## class_name);
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// A macro that defines events for the framework.
+/// \~english @param [in] eventid Event ID
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// These macros define the IDs of the current events in the CFrameworkunifiedHSMParentFramework classes.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// framework event
+#define FRAMEWORKUNIFIED_EVENT(eventid) \
+ CFrameworkunifiedHSMParentFramework::_## eventid
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Is a macro that defines events for an application
+/// \~english @param [in] eventid Event ID
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// A macro that defines an event ID for an application.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Application event
+#define EVENT(eventid) \
+ _## eventid
+
+/// FrameworkunifiedReaction function signature for internal transition class
+#define IMPLEMENT_INTERNALTRANSITION(name) \
+ CFrameworkunifiedState* C## name::FrameworkunifiedReaction(CFrameworkunifiedState* f_pSourceState, CEventDataPtr f_pData)
+
+#define IMPLEMENT_ACTION(action_name) \
+ void C## action_name::FrameworkunifiedAction(CFrameworkunifiedState *f_pSourceState, CFrameworkunifiedState *f_pTargetState, CEventDataPtr f_pEventData)
+
+#define DEFINE_GUARD(guard_name)\
+ class C## guard_name : public CFrameworkunifiedGuard{ \
+ public: \
+ C## guard_name(std::string f_pName):CFrameworkunifiedGuard(f_pName) {} \
+ virtual BOOL FrameworkunifiedEvaluate();\
+ };
+
+#define CREATE_GUARD(guard_name)\
+ CFrameworkunifiedGuard *l_pGrd## guard_name = new C## guard_name(#guard_name);
+
+#define CONNECT_GUARD(transition, guard)\
+ l_pTrn## transition->FrameworkunifiedSetGuard(l_pGrd## guard);
+
+#define CONNECT_CONDITION(connector_name , guard , target_state) \
+ CHKNULL(l_pTrn## connector_name)\
+ l_pTrn## connector_name->FrameworkunifiedAddCondition(l_pGrd## guard , l_p## target_state); \
+
+#define IMPLEMENT_GUARD(guard_name) \
+ BOOL C## guard_name::FrameworkunifiedEvaluate()
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// These macros create instances for Shallow history transitions.
+/// \~english @param [in] parent State name for external transition
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// These macros create instances of CFrameworkunifiedExternalTransition classes for external transitions of Shallow history transitions.\n
+/// Otherwise, the CNullPointerException objects are excepted.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// creates the instance of the shallow history transition
+#define CREATE_SHALLOWHISTORYTRANSITION(parent) \
+ CFrameworkunifiedExternalTransition *l_pTrn##parent##SHALLOWHISTORYSTATE = \
+ new CFrameworkunifiedExternalTransition(l_p##parent##SHALLOWHISTORYSTATE); \
+ CHKNULL(l_pTrn##parent##SHALLOWHISTORYSTATE);
+
+/// creates the instance of the deep history transition
+#define CREATE_DEEPHISTORYTRANSITION(parent) \
+ CFrameworkunifiedExternalTransition *l_pTrn##parent##DEEPHISTORYSTATE = \
+ new CFrameworkunifiedExternalTransition(l_p##parent##DEEPHISTORYSTATE); \
+ CHKNULL(l_pTrn##parent##DEEPHISTORYSTATE);
+
+#define CONNECT_CONDITION_SHALLOWHISTORYTRANSITION(connector_name , guard , target_state) \
+ CHKNULL(l_pTrn## connector_name)\
+ l_pTrn## connector_name->FrameworkunifiedAddCondition(l_pGrd## guard , l_p## target_state##SHALLOWHISTORYSTATE); \
+
+
+#define CONNECT_CONDITION_DEEPHISTORYTRANSITION(connector_name , guard , target_state) \
+ CHKNULL(l_pTrn## connector_name)\
+ l_pTrn## connector_name->FrameworkunifiedAddCondition(l_pGrd## guard , l_p## target_state##DEEPHISTORYSTATE); \
+
+
+#define CONNECT_ACTION(transition, action_name) \
+ CHKNULL(l_pTrn## action_name); \
+ CHKNULL(l_pTrn## transition); \
+ l_pTrn## transition->FrameworkunifiedAddAction(l_pTrn## action_name); \
+
+#ifdef DEBUG
+#define FRAMEWORKUNIFIED_PRINT_HSM(x) (FrameworkunifiedGetStateMachine(x))->FrameworkunifiedPrintXML();
+#define PRINT_HSM() FrameworkunifiedPrintXML();
+#else
+#define FRAMEWORKUNIFIED_PRINT_HSM(x)
+#define PRINT_HSM()
+#endif
+
+/// defines options for integrating user change state
+typedef enum _EUserChangeOptions {
+ eUserchangeIgnore = 0,
+ eUserchangeReInit,
+ eUserchangeRetPrevState
+} EUserChangeOptions;
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_FRAMEWORKUNIFIED_SM_FRAMEWORK_TYPES_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_guard.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_guard.h
new file mode 100755
index 0000000..1792f72
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_guard.h
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedGuard class definitions. This is an interface that defines the Evaluate
+/// interface for guard condition validation.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_guard.h
+ * @brief \~english This file has the CFrameworkunifiedGuard class definitions.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDGUARD_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDGUARD_H
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+
+/**
+ * @class CNSSharedMem
+ * \~english @brief this file has the CFrameworkunifiedGuard class definitions
+ * \~english @par Brief Introduction
+ * This file has the CFrameworkunifiedGuard class definitions. This is an interface \n
+ * that defines the Evaluate interface for guard condition validation.
+ *
+ */
+class CFrameworkunifiedGuard {
+ public :
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedGuard
+ /// \~english @par Brief
+ /// CFrameworkunifiedGuard's constructor
+ /// \~english @param [in] f_strName
+ /// string - Name of the guard
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - CFrameworkunifiedGuard's constructor
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see ~CFrameworkunifiedGuard
+ ////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedGuard(std::string f_strName); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CFrameworkunifiedGuard
+ /// \~english @par Brief
+ /// - Destructor of CFrameworkunifiedGuard class
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Destruct the object of this class.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see CFrameworkunifiedGuard
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedGuard();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedGuard
+ /// \~english @par Brief
+ /// This is a pure virtual function that defines the logic for evaluating the guard condition
+ /// \~english @param None
+ /// \~english @retval TRUE - if test passes
+ /// \~english @retval FALSE - otherwise returns false
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - This is a pure virtual function that defines the logic for evaluating the guard condition
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual BOOL FrameworkunifiedEvaluate() = 0;
+
+ private:
+ std::string m_strName;
+};
+
+#endif // _FRAMEWORKUNIFIEDGUARD_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_historystate.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_historystate.h
new file mode 100755
index 0000000..47d5914
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_historystate.h
@@ -0,0 +1,253 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the declaration of CFrameworkunifiedHistoryState interface.
+/// CFrameworkunifiedHistoryState is derived from CFrameworkunifiedState class.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_historystate.h
+ * @brief \~english This file has the declaration of CFrameworkunifiedHistoryState interface.
+ * CFrameworkunifiedHistoryState is derived from CFrameworkunifiedState class.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDHISTORYSTATE_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDHISTORYSTATE_H
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <string>
+
+/**
+ * @class CFrameworkunifiedHistoryState
+ * \~english @brief this file has the CFrameworkunifiedHistoryState class definitions
+ * \~english @par Brief Introduction
+ * This class implements the additional functionality supported by HSM History state.
+ *
+ */
+class CFrameworkunifiedHistoryState : public CFrameworkunifiedState {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHistoryState
+ /// \~english @par Brief
+ /// -Constructor of CFrameworkunifiedHistoryState.
+ /// \~english @param [in] f_pName
+ /// std::string - Name of the state
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - This class inherits from CFrameworkunifiedState, which is the base class of state machine.
+ /// This class implements the additional functionality supported by HSM History state.
+ /// This function creates an object of CFrameworkunifiedHistoryState class.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @see ~CFrameworkunifiedHistoryState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedHistoryState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ CFrameworkunifiedHistoryState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHistoryState
+ /// \~english @par Brief
+ /// -Destructor of CFrameworkunifiedHistoryState.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// -Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// -Destruct the object of this class.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @see CFrameworkunifiedHistoryState::CFrameworkunifiedHistoryState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedHistoryState
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedHistoryState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHistoryState
+ /// \~english @par Brief
+ /// - Gets the pointor of this class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Gets the pointor of this class.The pointor of this class's base class will get it.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHistoryState
+ /// \~english @par Brief
+ /// - This function stores the last active state.
+ /// \~english @param None
+ /// \~english @retval EFrameworkunifiedStatus - Returns status of operation
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - This function stores the last active state.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus UpdateHistory() = 0;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHistoryState
+ /// \~english @par Brief
+ /// - This function sets the default active state in history state.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK - Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - Null Pointer
+ /// \~english @par Preconditons
+ /// -Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// -m_pParentState is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// -This function sets the default state of parent state to the newest active state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDefaultHistory
+ /// This function sets the default active state in history state
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ EFrameworkunifiedStatus SetDefaultHistory();
+
+ protected :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEntry
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnExit
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStart
+ /// This function is called recursively till the leaf state is reached. This internally
+ /// calls the Entry function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStop
+ /// This function is called recursively till the required parent state is reached. This
+ /// internally calls the Exit function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData);
+
+ // last active state
+ CFrameworkunifiedState *m_pLastActiveState;
+
+ // event id of history state
+ UI_32 m_uiEventId;
+
+ // event name
+ std::string m_cEventName;
+};
+#endif // _FRAMEWORKUNIFIEDHISTORYSTATE_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsm.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsm.h
new file mode 100755
index 0000000..1a8e1d7
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsm.h
@@ -0,0 +1,798 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedHSM class definitions. CFrameworkunifiedHSM is base class for HSM Framework.
+/// This class implements interfaces for connecting child states to parent states, connecting events
+/// to state.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_hsm.h
+ * @brief \~english This file has the CFrameworkunifiedHSM class definitions. CFrameworkunifiedHSM is base class for HSM Framework.
+ * This class implements interfaces for connecting child states to parent states, connecting events to state.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSM_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSM_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/frameworkunified_sm_eventdata.h>
+#include <vector>
+#include <exception>
+#include <map>
+#include <string>
+
+class CFrameworkunifiedEvent;
+
+class CFrameworkunifiedState;
+
+class CFrameworkunifiedCompositeState;
+
+class CFrameworkunifiedReaction;
+
+class CFrameworkunifiedOrthogonalState;
+
+class CEventData;
+
+typedef boost::shared_ptr<CEventData> CEventDataPtr;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements interfaces for connecting child states to parent states, connecting events
+/// to state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedHSM {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedHSM
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Release class CFrameworkunifiedHistoryState instance.\n
+ /// Release event in postevent list.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedHSM
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedHSM();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedHSM.
+ /// \~english @param
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSM class is the super class of HSM framework.
+ /// this class produce interface to connected super class state with sub class state and to connect event with
+ /// state
+ /// create the instance of CFrameworkunifiedHSM class\n
+ /// create event list as following and hold the member parameter,others will be initialized as NULL
+ /// - event list which is supported in state
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSM();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedHSM.
+ /// \~english @param f_pHApp
+ /// PVOID - handle of application
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSM class is the super class of HSM framework.
+ /// this class produce interface to connected super class state with sub class state and to connect event with
+ /// state
+ /// create the instance of CFrameworkunifiedHSM class\n
+ /// create event list as following and hold the member parameter,others will be initialized as NULL
+ /// - event list which is supported in state
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedHSM(PVOID f_pHApp)
+ /// Class constructor
+ ///
+ /// \return none
+ CFrameworkunifiedHSM(PVOID f_pHApp); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Returns the active state of the statemachine
+ /// \~english @param none
+ /// \~english @retval CFrameworkunifiedState* - Returns ActiveState
+ /// \~english @retval NULL - failed
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created and active state exist.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - active state do not exist. [NULL]
+ /// \~english @par Detail
+ /// route state search will be continued until current state become active
+ /// route state search will be continued until Leaf State or orthogonal State is found\n
+ /// if there is no active state.reture NULL\n
+ /// if there is active state,this state will be hold in memeber parameter as return value
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedGetActiveState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This creates the default event data and sends the event to the active HSM state.
+ /// \~english @param f_uiEventId
+ /// UI_32 - Event Id
+ /// \~english @retval eFrameworkunifiedStatusOK add succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Event data instance create faield. [eFrameworkunifiedStatusNullPointer]
+ /// - The pointer of post event list in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - The pointer of active state in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - The name of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// create new event data object and send this event to active HSM state,\n
+ /// then add to event queue of the statemachine
+ /// add to event queque in order to process event using statemachine
+ /// event will be deleted from event queue when process complete
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedPostEvent(CEventDataPtr), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPostEvent
+ /// This creates the default event data and sends the event to the active HSM state.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event Id
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedPostEvent(UI_32 f_uiEventId);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPostEvent
+ /// This sends the event to the active HSM state
+ ///
+ /// \~english @par Brief
+ /// Add event data into event queue of state machine.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Event data
+ /// \~english @retval eFrameworkunifiedStatusOK add succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pEventData is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - The pointer of post event list in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - The pointer of active state in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - The name of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ ///
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedPostEvent(UI_32), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedPostEvent(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This is pure virtual function to be implemented by the derived classes. Statemachine
+ /// states and events created and connected in this interface.
+ /// \~english @param f_pEventData
+ /// PVOID - Event data
+ /// \~english @retval EFrameworkunifiedStatus Returns status of operation
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ // none
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL) = 0;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedStart
+ /// This starts the state machine
+ ///
+ /// \~english @par Brief
+ /// Start the state machine.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Event data
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ // - Pointer of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ ///
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedPostEvent(UI_32), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedStart(CEventDataPtr f_pEventData = boost::make_shared<CEventData>(0));
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Stop the state machine.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Event data
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ // - Pointer of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Stop the state machine.\n
+ /// Release route state of state machine.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedPostEvent(UI_32), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedClose(CEventDataPtr f_pEventData = boost::make_shared<CEventData>(0));
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPrintAllStates
+ /// This prints all states and events associated with every state on console.
+ ///
+ /// \~english @par Brief
+ /// Output log of all states and events name associated with every state.
+ /// \~english @param
+ /// \~english @retval EFrameworkunifiedStatus succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Root state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Self instance of CFrameworkunifiedHSM does not create. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// print out log for connected state name and event name\n
+ /// following log will be print put
+ /// - super statemachine state name and self-statemachine state name
+ /// - all the event name on event list
+ /// - all the event on delayed event list
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedPrintAllStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This connects the reaction to event and add event to child states then add child state
+ /// to parent state.
+ /// \~english @param f_pParentState
+ /// CFrameworkunifiedState* - Parent state pointer
+ /// \~english @param f_pChildState
+ /// CFrameworkunifiedState* - Child state pointer
+ /// \~english @param f_uiEventId
+ /// UI_32 - eventi id
+ /// \~english @param f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ /// \~english @param f_eIsDefaultState
+ /// BOOL - Does has default state.(default: FALSE)
+ /// \~english @par
+ /// - TRUE : has default state
+ /// - FALSE: not has default state
+ /// \~english @param f_eIsDeferredEventType
+ /// BOOL - Does has the deferred event(default: FALSE)
+ /// \~english @par
+ /// - TRUE : has the deferred event
+ /// - FALSE: not has the deferred event
+ /// \~english @param f_strEventName
+ /// std::string - name of event(default:"")
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pParentState pointer is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pChildState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pReaction pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pParentState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pChildState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// connect process with event and add the event to sub state.
+ /// and do following considering the event delay and event declare(f_eIsDeferredEventType)
+ /// - if TRUE : add the event as delayed event(add to event name list and delayed event list)
+ /// - if FALSE:add normal event and event(add to event name list and event list)
+ /// \~english @par
+ /// After adding an event to a child state, associate the child state with the parent state and
+ /// set the HSM state machine for the child state only if the parent state is a compound state.
+ /// The following associations are made depending on whether or not a default state is defined (f_eIsDefaultState).
+ /// - TRUE: Associates a child state as the default state with the parent state.
+ /// - FALSE: Associates a child state with a parent state as a normal state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,std::string,BOOL),
+ /// FrameworkunifiedConnect(CFrameworkunifiedState*,CFrameworkunifiedState*,BOOL)
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedConnect
+ /// This connects the reaction to event and add event to child states then add child state
+ /// to parent state.
+ ///
+ /// \param [in] f_pParentState
+ /// CFrameworkunifiedState* - Parent state
+ ///
+ /// \param [in] f_pChildState
+ /// CFrameworkunifiedState* - Child state
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id
+ ///
+ /// \param [in] f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ ///
+ /// \param [in] f_eIsDefaultState
+ /// BOOL - Defines if the state is default state
+ ///
+ /// \param [in] f_eIsDeferredEventType
+ /// BOOL - defines if the event is deferred event
+ ///
+ /// \param [in] f_strEventName
+ /// BOOL - Event name
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pParentState, CFrameworkunifiedState *f_pChildState,
+ UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction,
+ BOOL f_eIsDefaultState = FALSE,
+ BOOL f_eIsDeferredEventType = FALSE,
+ std::string f_strEventName = "");
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This add child state to parent state.
+ /// \~english @param f_pParentState
+ /// CFrameworkunifiedState* - Parent state pointer
+ /// \~english @param f_pChildState
+ /// CFrameworkunifiedState* - Child state pointer
+ /// \~english @param f_eIsDefaultState
+ /// BOOL - Does has default state.(default: FALSE)
+ /// \~english @par
+ /// - TRUE : has default state
+ /// - FALSE: not has default state
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pParentState pointer is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pChildState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pParentState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pChildState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// connect super state with sub state and set HSM state machine to sub state only when super state is compond
+ /// state
+ /// according to the default state define(f_eIsDefaultState),doing the connection below
+ /// - if TRUE: connect sub state as default state with super state
+ /// - if FALSE: connect sub state as normal state with super state
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,std::string,BOOL),
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedConnect
+ /// This add child state to parent state.
+ ///
+ /// \param [in] f_pParentState
+ /// CFrameworkunifiedState* - Parent state
+ ///
+ /// \param [in] f_pChildState
+ /// CFrameworkunifiedState* - Child state
+ ///
+ /// \param [in] f_eIsDefaultState
+ /// BOOL - Defines if the state is default state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pParentState, CFrameworkunifiedState *f_pChildState,
+ BOOL f_eIsDefaultState = FALSE);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedConnect
+ /// This connects the reaction to event and add event to states
+ ///
+ /// \~english @par Brief
+ /// This connects the reaction to event and add event to states.
+ /// \~english @param f_pState
+ /// CFrameworkunifiedState* - pointer of state class
+ /// \~english @param f_uiEventId
+ /// UI_32 - eventi id
+ /// \~english @param f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ /// \~english @param f_eIsDefaultState
+ /// BOOL - Does has default state.(default: FALSE)
+ /// \~english @par
+ /// - TRUE : has default state
+ /// - FALSE: not has default state
+ /// \~english @param f_eIsDeferredEventType
+ /// BOOL - Does has the deferred event(default: FALSE)
+ /// \~english @par
+ /// - TRUE : has the deferred event
+ /// - FALSE: not has the deferred event
+ /// \~english @param f_strEventName
+ /// std::string - name of event(default:"")
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pReaction pointer is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pState pointer does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// connect process with event and add event to sub state
+ /// following will be added according to whether delayed event or event define exsist
+ /// - if TRUE : add event as delayed event(add to event name list and delayed event list)
+ /// - if FALSE: add event as normal event(add to event name list and event list)
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,BOOL,BOOL,std::string)
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pState, UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction,
+ std::string f_strEventName = "", BOOL f_eIsDeferredEventType = FALSE);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This sets the givens state as root state in the state machine
+ /// \~english @param f_pRootState
+ /// CFrameworkunifiedState* - Root state
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pRootState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pRootState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// set state(f_pRootState, which is designated as route state) to HSM state machine
+ /// set route state pointer(f_pRootState,which is set as parameter value)as pointer of
+ /// active state for member
+ /// parameter and routestate
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,BOOL,BOOL,std::string)
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedConnect
+ /// This sets the givens state as root state in the state machine
+ ///
+ /// \param [in] f_pRootState
+ /// CFrameworkunifiedState* - Root state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pRootState);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Set Composite state as HSM state OrthogonalState.
+ /// \~english @param f_pOrthogonalState
+ /// CFrameworkunifiedOrthogonalState* - Orthogonal state pointer
+ /// \~english @param f_pOrthogonalRegion
+ /// CFrameworkunifiedCompositeState* - Composite state pointer
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer(process failed)
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pOrthogonalState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pOrthogonalRegion pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pOrthogonalState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Set Composite state as HSM state OrthogonalState.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedConnect
+ /// This sets the givens state as root state in the state machine
+ ///
+ /// \param [in] f_pOrthogonalState
+ /// CFrameworkunifiedOrthogonalState* - Orthogonal state
+ ///
+ /// \param [in] f_pOrthogonalRegion
+ /// CFrameworkunifiedCompositeState* - Orthogonal region
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedConnectOrthogonal(CFrameworkunifiedOrthogonalState *f_pOrthogonalState,
+ CFrameworkunifiedCompositeState *f_pOrthogonalRegion);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This interface returns the application handle
+ /// \~english @param none
+ /// \~english @retval HANDLE application handle
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ HANDLE FrameworkunifiedGetAppHandle();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Output statemachine information into XML file.
+ /// \~english @param none
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedPrintXML();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Push the event in the post event list.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - pointer of event data
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
+ /// eFrameworkunifiedStatusNullPointer NULL pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - If input parameter f_pEventData is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If member variable m_pActiveState is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If member variable m_pPostEventList is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedQueueEvent(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Remove the all events of eventId f_uiEventId from event queue of statemachine.
+ /// \~english @param f_pEventData
+ /// const UI_32 - event id
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
+ /// eFrameworkunifiedStatusInvldID Not found event id
+ /// eFrameworkunifiedStatusNullPointer NULL pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - If not find event id. [eFrameworkunifiedStatusInvldID]
+ /// - If member variable m_pPostEventList is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RemoveEventFromPostedEventQueue(const UI_32 f_uiEventId);
+
+ UI_32 m_uiCurrentEvent;
+
+ /// Application handle
+ HANDLE m_pHApp;
+
+ private:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ProcessEventQueue
+ /// Gets the event from StateMachine events list and post it.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ProcessEventQueue();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ProcessEvent
+ /// Processes the event posted to the statemachine
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ProcessEvent(CEventDataPtr f_pEventData);
+
+ /// pointer to the active state object
+ CFrameworkunifiedState *m_pActiveState;
+
+ /// pointer to the root state object
+ CFrameworkunifiedState *m_pRootState;
+
+ std::vector<CEventDataPtr> *m_pPostEventList;
+
+ BOOL m_bIsTransitioning;
+};
+
+#endif // __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSM_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsmframework.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsmframework.h
new file mode 100755
index 0000000..fd61117
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsmframework.h
@@ -0,0 +1,873 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedHSMParentFramework class definitions. CFrameworkunifiedHSMParentFramework is derived from
+/// CFrameworkunifiedHSM class. It defines the states required for NS statemachine framework, it creates the NS
+/// statemachine and implements the reaction associated with the events
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_hsmframework.h
+ * @brief \~english This file has the CFrameworkunifiedHSMParentFramework class definitions. CFrameworkunifiedHSMParentFramework is derived from
+ * CFrameworkunifiedHSM class. It defines the states required for NS statemachine framework, it creates the NS
+ * statemachine and implements the reaction associated with the events
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSMFRAMEWORK_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSMFRAMEWORK_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/ns_timer_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <map>
+#include <string>
+
+class CFrameworkunifiedHSMFramework: public CFrameworkunifiedHSM {
+ public:
+ /**
+ * \~english state machine state
+ */
+ typedef enum _FRAMEWORKUNIFIED_HSM_STATES {
+ esFrameworkunifiedRoot = 0, //!< \~english Root state
+ esFrameworkunifiedInitialization, //!< \~english Initialization state
+ esFrameworkunifiedLoadData, //!< \~english LoadData state
+ esFrameworkunifiedPre, //!< \~english Pre state
+ esFrameworkunifiedBackground, //!< \~english Background state
+ esFrameworkunifiedRun, //!< \~english Run state
+ esFrameworkunifiedLoadSessions, //!< \~english LoadSessions state
+ esFrameworkunifiedReady, //!< \~english Ready state
+ esFrameworkunifiedStop, //!< \~english Stop state
+ esFrameworkunifiedApp, //!< \~english App state
+ esFrameworkunifiedUserChange, //!< \~english UserChange state
+ esFrameworkunifiedThreadRoot, //!< \~english ThreadRoot state
+ esFrameworkunifiedThreadIdle, //!< \~english ThreadIdle state
+ esFrameworkunifiedThreadStart, //!< \~english ThreadStart state
+ esFrameworkunifiedThreadReady, //!< \~english ThreadReady state
+ esFrameworkunifiedThreadStop, //!< \~english ThreadStop state
+ esFrameworkunifiedStopping, //!< \~english Stopping state
+ } FRAMEWORKUNIFIED_HSM_STATES;
+
+ /// Define evFrameworkunifiedStart event
+ DEFINE_EVENT(evFrameworkunifiedStart, 1)
+
+ /// Define evFrameworkunifiedStop event
+ DEFINE_EVENT(evFrameworkunifiedStop, 5)
+
+ /// Define evFrameworkunifiedDestroy event
+ DEFINE_EVENT(evFrameworkunifiedDestroy, 3)
+
+ /// Define evFrameworkunifiedReady event
+ DEFINE_EVENT(evFrameworkunifiedReady, 12)
+
+ /// Define evFrameworkunifiedError event
+ DEFINE_EVENT(evFrameworkunifiedError, 16)
+
+ /// Define evFrameworkunifiedPreStart event
+ DEFINE_EVENT(evFrameworkunifiedPreStart, 19)
+
+ /// Define evFrameworkunifiedPreStop event
+ DEFINE_EVENT(evFrameworkunifiedPreStop, 20)
+
+ /// Define evFrameworkunifiedBackgroundStart event
+ DEFINE_EVENT(evFrameworkunifiedBackgroundStart, 21)
+
+ /// Define evFrameworkunifiedBackgroundStop event
+ DEFINE_EVENT(evFrameworkunifiedBackgroundStop, 22)
+
+ // Define internal transition for event evFrameworkunifiedStart in sFrameworkunifiedStop state
+ DEFINE_INTERNALTRANSITION(OnEventStartInStopState)
+
+ // Define internal transition for event evFrameworkunifiedUserChange in sFrameworkunifiedInitialization state
+ DEFINE_INTERNALTRANSITION(OnEventUserChangeInInitializationState)
+
+ // Define internal transition for event evFrameworkunifiedUserChange in sFrameworkunifiedRun state
+ DEFINE_INTERNALTRANSITION(OnEventUserChangeInRunState)
+
+ DEFINE_INTERNALTRANSITION(OnEventStopInStoppingState)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMFramework default constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// CFrameworkunifiedHSM()
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMFramework default constructor, for create CFrameworkunifiedHSMFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMFramework();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMFramework constructor with param
+ /// \~english @param [in] f_pHApp
+ /// PVOID f_pHApp - for parent class constructor
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// CFrameworkunifiedHSM(f_pHApp)
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMFramework constructor with param, for create CFrameworkunifiedHSMFramework object
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMFramework(PVOID f_pHApp); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMFramework
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param [in] f_pEventData
+ /// PVOID f_pEventData - event data
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedCreate
+ /// Statemachine states and events created and connected in this interface.
+ ///
+ /// \param [in] f_pEventData
+ /// PVOID - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMFramework
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param [in] f_pAppState
+ /// CFrameworkunifiedState *f_pAppState - state object to be added in the ready state.
+ /// \~english @param [in] f_bIsDefaultState
+ /// BOOL f_bIsDefaultState - if the state is default state
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This adds the given state as a sub state of sReady state of the Framework
+ ///
+ /// \param [in] f_pAppState
+ /// CFrameworkunifiedState* - state object to be added in the ready state.
+ ///
+ /// \param [in] f_bIsDefaultState
+ /// BOOL - defines if the state is default state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(CFrameworkunifiedState *f_pAppState, BOOL f_bIsDefaultState = FALSE) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMFramework
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState - enum maping to framework state
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - Event id
+ /// \~english @param [in] f_pReaction
+ /// CFrameworkunifiedReaction *f_pReaction - Reaction object for attaching to event
+ /// \~english @param [in] f_strEventName
+ /// std::string f_strEventName - Event name
+ /// \~english @param [in] f_bIsDeferredEvent
+ /// BOOL f_bIsDeferredEvent - defines if the event is deferred event
+ /// \~english @retval EFrameworkunifiedStatus depend on implement class
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This connects the reaction to event and add event to states
+ ///
+ /// \param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES - enum maping to framework state
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id
+ ///
+ /// \param [in] f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ ///
+ /// \param [in] f_strEventName
+ /// std::string - Event name
+ ///
+ /// \param [in] f_bIsDeferredEvent
+ /// BOOL - defines if the event is deferred event
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState, UI_32 f_uiEventId,
+ CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName = "",
+ BOOL f_bIsDeferredEvent = FALSE) = 0;
+
+ protected:
+ /// Stores the state objects against FRAMEWORKUNIFIED_HSM_STATES enumerations
+ std::map<UI_32, CFrameworkunifiedState *> *m_pFrameworkunifiedStateList;
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// It defines the states required for NS statemachine framework, it creates the NS
+/// statemachine and implements the reaction associated with the events
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedHSMParentFramework: public CFrameworkunifiedHSMFramework {
+ public:
+ /// Define evFrameworkunifiedLoadPersistenceAck event
+ DEFINE_EVENT(evFrameworkunifiedLoadFileAck, 2)
+
+ /// Define evFrameworkunifiedLoadComplete event
+ DEFINE_EVENT(evFrameworkunifiedLoadComplete, 4)
+
+ /// Define evFrameworkunifiedUserChange event
+ DEFINE_EVENT(evFrameworkunifiedUserChange, 6)
+
+ /// Define evFrameworkunifiedReInit event
+ DEFINE_EVENT(evFrameworkunifiedReInit, 7)
+
+ /// Define evFrameworkunifiedLoadUserData event
+ DEFINE_EVENT(evFrameworkunifiedLoadUserData, 8)
+
+ /// Define evFrameworkunifiedCloseSessionAck event
+ DEFINE_EVENT(evFrameworkunifiedCloseSessionAck, 9)
+
+ /// Define evFrameworkunifiedCloseSessionAck event
+ DEFINE_EVENT(evFrameworkunifiedOpenSessionAck, 10)
+
+ /// Define evFrameworkunifiedStopComplete event
+ DEFINE_EVENT(evFrameworkunifiedStopComplete, 11)
+
+ /// Define evFrameworkunifiedOpenSessionReq event
+ DEFINE_EVENT(evFrameworkunifiedOpenSessionReq, 14)
+
+ /// Define evFrameworkunifiedCloseSessionReq event
+ DEFINE_EVENT(evFrameworkunifiedCloseSessionReq, 15)
+
+ /// Define evFrameworkunifiedInit event
+ DEFINE_EVENT(evFrameworkunifiedInit, 16)
+
+ /// Define evFrameworkunifiedUserChangeComplete event
+ DEFINE_EVENT(evFrameworkunifiedUserChangeComplete, 17)
+
+ /// Define evFrameworkunifiedLoadSessions event
+ DEFINE_EVENT(evFrameworkunifiedLoadSessions, 18)
+
+ /// Define sFrameworkunifiedRoot state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedRoot)
+
+ /// Define sFrameworkunifiedRoot state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedApp)
+
+ /// Define sFrameworkunifiedInitialization state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedInitialization)
+
+ /// Define sFrameworkunifiedPre state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedPre)
+
+ /// Define sFrameworkunifiedBackground state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedBackground)
+
+ /// Define sFrameworkunifiedRun state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedRun)
+
+ /// Define sFrameworkunifiedStop state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedStop)
+
+ /// Define sFrameworkunifiedReady state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedReady)
+
+ /// Define sFrameworkunifiedLoadData state
+ DEFINE_LEAFSTATE_OVERRIDE(sFrameworkunifiedLoadData)
+
+ /// Define sFrameworkunifiedLoadSessions state
+ DEFINE_LEAFSTATE_OVERRIDE(sFrameworkunifiedLoadSessions)
+
+ /// Define sFrameworkunifiedStopping state
+ DEFINE_LEAFSTATE_OVERRIDE(sFrameworkunifiedStopping)
+
+ /// Define sFrameworkunifiedUserChange state
+ DEFINE_LEAFSTATE_OVERRIDE(sFrameworkunifiedUserChange)
+
+ // DEFINE_ACTION(aFrameworkunifiedOnStart)
+ DEFINE_ACTION(aFrameworkunifiedOnStop)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMFramework default constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ /// \~english @par Conditions of processing failure
+ /// apply space for m_pFrameworkunifiedStateList failed
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMFramework default constructor, for create CFrameworkunifiedHSMFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMParentFramework();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMFramework constructor with param
+ /// \~english @param [in] f_pHApp
+ /// PVOID f_pHApp - Name of the state
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ /// \~english @par Conditions of processing failure
+ /// apply space for m_pFrameworkunifiedStateList failed
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMFramework constructor with param, for create CFrameworkunifiedHSMFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedHSMParentFramework
+ /// default constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMParentFramework(PVOID f_pHApp); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMFramework destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMFramework destructor, for destory CFrameworkunifiedHSMFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedHSMParentFramework
+ /// Class destructor
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedHSMParentFramework();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// create state and event
+ /// \~english @param [in] f_pEventData
+ /// PVOID f_pEventData - event data
+ /// \~english @retval eFrameworkunifiedStatusOK create state and event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when create state and event
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL pointer exception occur
+ /// \~english @par Detail
+ /// Statemachine states and events created and connected in this interface.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedCreate
+ /// Statemachine states and events created and connected in this interface.
+ ///
+ /// \param [in] f_pHApp
+ /// PVOID - application handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// add sub state
+ /// \~english @param [in] f_pAppState
+ /// CFrameworkunifiedState *f_pAppState - state object to be added in the ready state.
+ /// \~english @param [in] f_bIsDefaultState
+ /// BOOL f_bIsDefaultState - defines if the state is default state.
+ /// \~english @retval eFrameworkunifiedStatusOK add sub state success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when add sub state
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL point exception occur when add sub state
+ /// \~english @par Detail
+ /// This adds the given state as a sub state of sReady state of the Framework
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This adds the given state as a sub state of sReady state of the Framework
+ ///
+ /// \param [in] f_pAppState
+ /// CFrameworkunifiedState* - state object to be added in the ready state.
+ ///
+ /// \param [in] f_bIsDefaultState
+ /// BOOL - defines if the state is default state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(CFrameworkunifiedState *f_pAppState, BOOL f_bIsDefaultState = FALSE);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// connects the reaction to event and add event to states
+ /// \~english @param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState - framework state
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - Event id
+ /// \~english @param [in] f_pReaction
+ /// CFrameworkunifiedReaction *f_pReaction - Reaction object
+ /// \~english @param [in] f_strEventName
+ /// std::string f_strEventName - Event name
+ /// \~english @param [in] f_bIsDeferredEvent
+ /// BOOL f_bIsDeferredEvent - defines if the event is deferred event
+ /// \~english @retval eFrameworkunifiedStatusOK add sub state success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when add sub state
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL point exception occur when add sub state
+ /// \~english @par Detail
+ /// This connects the reaction to event and add event to states
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This connects the reaction to event and add event to states
+ ///
+ /// \param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES - enum maping to framework state
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id
+ ///
+ /// \param [in] f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ ///
+ /// \param [in] f_strEventName
+ /// std::string - Event name
+ ///
+ /// \param [in] f_bIsDeferredEvent
+ /// BOOL - defines if the event is deferred event
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState, UI_32 f_uiEventId,
+ CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName = "",
+ BOOL f_bIsDeferredEvent = FALSE);
+};
+
+class CFrameworkunifiedHSMChildFramework: public CFrameworkunifiedHSMFramework {
+ public:
+ /// Define sFrameworkunifiedThreadIdle state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedThreadRoot)
+
+ /// Define sFrameworkunifiedThreadIdle state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedThreadIdle)
+
+ /// Define sFrameworkunifiedThreadStart state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedThreadStart)
+
+ /// Define sFrameworkunifiedThreadReady state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedThreadReady)
+
+ /// Define sFrameworkunifiedThreadStop state
+ DEFINE_LEAFSTATE_OVERRIDE(sFrameworkunifiedThreadStop)
+
+ // Define internal transition for event evFrameworkunifiedDestroy
+ DEFINE_INTERNALTRANSITION(OnDestroyThread)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMChildFramework constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMChildFramework constructor, for create CFrameworkunifiedHSMChildFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedHSMChildFramework
+ /// default constructor
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMChildFramework();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMChildFramework constructor with param
+ /// \~english @param [in] f_pHApp
+ /// PVOID f_pHApp - application handle
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ /// \~english @par Conditions of processing failure
+ /// m_pFrameworkunifiedStateList apply space fail
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMChildFramework constructor with param, for create CFrameworkunifiedHSMChildFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedHSMChildFramework
+ /// default constructor
+ /// \param [in] f_pHApp
+ /// PVOID - application handle
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMChildFramework(PVOID f_pHApp); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMChildFramework destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMChildFramework destructor, for destory CFrameworkunifiedHSMChildFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedHSMChildFramework
+ /// Class destructor
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedHSMChildFramework();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// create state and event
+ /// \~english @param [in] f_pEventData
+ /// PVOID f_pEventData - event data
+ /// \~english @retval eFrameworkunifiedStatusOK create state and event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when create state and event
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL pointer exception occur
+ /// \~english @par Detail
+ /// Statemachine states and events created and connected in this interface.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedCreate
+ /// Statemachine states and events created and connected in this interface.
+ ///
+ /// \param [in] f_pEventData
+ /// PVOID - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// add sub state
+ /// \~english @param [in] f_pAppState
+ /// CFrameworkunifiedState *f_pAppState - state object to be added in the ready state.
+ /// \~english @param [in] f_bIsDefaultState
+ /// BOOL f_bIsDefaultState - defines if the state is default state.
+ /// \~english @retval eFrameworkunifiedStatusOK add sub state success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when add sub state
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL point exception occur when add sub state
+ /// \~english @par Detail
+ /// This adds the given state as a sub state of sReady state of the Framework
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This adds the given state as a sub state of sReady state of the Framework
+ ///
+ /// \param [in] f_pAppState
+ /// CFrameworkunifiedState* - state object to be added in the ready state.
+ ///
+ /// \param [in] f_bIsDefaultState
+ /// BOOL - defines if the state is default state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(CFrameworkunifiedState *f_pAppState, BOOL f_bIsDefaultState = FALSE);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// connects the reaction to event and add event to states
+ /// \~english @param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState - framework state
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - Event id
+ /// \~english @param [in] f_pReaction
+ /// CFrameworkunifiedReaction *f_pReaction - Reaction object
+ /// \~english @param [in] f_strEventName
+ /// std::string f_strEventName - Event name
+ /// \~english @param [in] f_bIsDeferredEvent
+ /// BOOL f_bIsDeferredEvent - defines if the event is deferred event
+ /// \~english @retval eFrameworkunifiedStatusOK add sub state success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when add sub state
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL point exception occur when add sub state
+ /// \~english @par Detail
+ /// This connects the reaction to event and add event to states
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This connects the reaction to event and add event to states
+ ///
+ /// \param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES - enum maping to framework state
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id
+ ///
+ /// \param [in] f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ ///
+ /// \param [in] f_strEventName
+ /// std::string - Event name
+ ///
+ /// \param [in] f_bIsDeferredEvent
+ /// BOOL - defines if the event is deferred event
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState,
+ UI_32 f_uiEventId,
+ CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName = "",
+ BOOL f_bIsDeferredEvent = FALSE);
+
+ /// function pointer of the Thread start routine
+ CbFuncPtr m_fpStartThread;
+
+ /// function pointer of the Thread stop routine
+ CbFuncPtr m_fpStopThread;
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSMFRAMEWORK_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_internaltransition.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_internaltransition.h
new file mode 100755
index 0000000..71eebec
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_internaltransition.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedInternalTransition class definitions. CFrameworkunifiedInternalTransition is derived
+/// from CFrameworkunifiedReaction class.This class provides the interface for defining a reaction for an event
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_internaltransition.h
+ * @brief \~english This file has the CFrameworkunifiedInternalTransition class definitions. CFrameworkunifiedInternalTransition is derived
+ * from CFrameworkunifiedReaction class.This class provides the interface for defining a reaction for an event
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDINTERNALTRANSITION_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDINTERNALTRANSITION_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_reaction.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class provides the interface for defining a reaction for an event
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedInternalTransition : public CFrameworkunifiedReaction {
+ public :
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedInternalTransition
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param [in] f_pSourceState
+ /// CFrameworkunifiedState* f_pSourceState - source state
+ /// \~english @param [in] f_pData
+ /// CEventDataPtr f_pData - event data
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Pure virtual function , implemented by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedReaction
+ /// The reaction for the event has to be implemented in this function
+ ///
+ /// \param [in] f_pSourceState
+ /// CFrameworkunifiedState* - Event id of the event to be added in the state
+ ///
+ /// \param [in] f_pData
+ /// CEventDataPtr - Reaction to be associated with the with event id in the state
+ ///
+ /// \return ActiveState
+ /// CFrameworkunifiedState* - Returns Active state
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) = 0;
+};
+
+#endif // _FRAMEWORKUNIFIEDINTERNALTRANSITION_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_leafstate.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_leafstate.h
new file mode 100755
index 0000000..e1aa6bd
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_leafstate.h
@@ -0,0 +1,252 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedLeafState class definitions. CFrameworkunifiedLeafState is derived from C
+/// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Leafstate.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_leafstate.h
+ * @brief \~english This file has the CFrameworkunifiedLeafState class definitions. CFrameworkunifiedLeafState is derived from C
+ * FrameworkunifiedState class.This class implements the additional functionality supported by HSM Leafstate.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDLEAFSTATE_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDLEAFSTATE_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_state.h>
+#include <string>
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM Leafstate.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedLeafState : public CFrameworkunifiedState {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// It is a constructor for CFrameworkunifiedLeafState classes.
+ /// \~english @param [in] f_pName
+ /// std::string - state name
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Inherits CFrameworkunifiedState, which is a superclass of state machines.\n
+ /// This class is implemented by HSM Leafstate as an additional class of functional support.\n
+ /// It inherits from the CFrameworkunifiedState classes and instantiates the CFrameworkunifiedLeafState.
+ /// \~english @par Immediate
+ /// Brief
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see ~CFrameworkunifiedLeafState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ CFrameworkunifiedLeafState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// Destructors for CFrameworkunifiedLeafState classes.
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedLeafState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Frees instances of CFrameworkunifiedLeafState classes.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedLeafState::CFrameworkunifiedLeafState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedState
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedLeafState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// Get the active state.
+ /// \~english @retval CFrameworkunifiedState* Pointers to active-state (CFrameworkunifiedState classes) objects
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedLeafState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides and uses CFrameworkunifiedState::FrameworkunifiedGetActiveState, which is pure virtual functions.\n
+ /// Returns the current state (this) as the active state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedGetActiveState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedGetActiveState
+ /// This interface returns the Active state of the current composite state. In case of
+ /// non-composite state current state is active state
+ ///
+ /// \return Active state
+ /// CFrameworkunifiedState* - Active state
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// Save the last active state.
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedLeafState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides CFrameworkunifiedState::UpdateHistory, which is pure virtual functions.Used and saves the last active state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::UpdateHistory
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateHistory
+ /// This function stores the last active state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ EFrameworkunifiedStatus UpdateHistory();
+
+ protected :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// Initialize state
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedLeafState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides and uses CFrameworkunifiedState::FrameworkunifiedOnEntry, which is pure virtual functions, to initialize state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedOnEntry, FrameworkunifiedOnExit
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEntry
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// Clean up state.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedLeafState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides and uses CFrameworkunifiedState::FrameworkunifiedOnExit, which is pure virtual functions, to clean up state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedOnExit, FrameworkunifiedOnEntry
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnExit
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
+};
+
+#endif // _FRAMEWORKUNIFIEDLEAFSTATE_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_localtransition.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_localtransition.h
new file mode 100755
index 0000000..99975eb
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_localtransition.h
@@ -0,0 +1,163 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedLocalTransition class definitions. CFrameworkunifiedLocalTransition is derived
+/// from CFrameworkunifiedTransition class.This class provides the interface for local transition over event
+///////////////////////////////////////////// //////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_localtransition.h
+ * @brief \~english This file has the CFrameworkunifiedLocalTransition class definitions. CFrameworkunifiedLocalTransition is derived
+ * from CFrameworkunifiedTransition class.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDLOCALTRANSITIONS_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDLOCALTRANSITIONS_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_transition.h>
+
+class CFrameworkunifiedEventData;
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class provides the interface for local transition over event
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedLocalTransition : public CFrameworkunifiedTransition {
+ public :
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLocalTransition
+ /// \~english @par Brief
+ /// CFrameworkunifiedLocalTransition constructor
+ /// \~english @param [in] f_pTargetState
+ /// CFrameworkunifiedState *f_pTargetState - target state
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// Constructor of CFrameworkunifiedLocalTransition, to create CFrameworkunifiedLocalTransition object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedLocalTransition(CFrameworkunifiedState *f_pTargetState); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLocalTransition
+ /// \~english @par Brief
+ /// CFrameworkunifiedLocalTransition destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedLocalTransition destructor, for destory CFrameworkunifiedLocalTransition object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedLocalTransition();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLocalTransition
+ /// \~english @par Brief
+ /// reaction for location transition
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// For local transition from inner
+ /// state to outer state exit of the inner state is invoked, but entry of outer state is not
+ /// invoked and from outer state to inner state entry of the inner state is invoked but exit of
+ /// outer state is not invoked
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedReaction
+ /// The reaction for an event is implemented in this function. For local transition from inner
+ /// state to outer state exit of the inner state is invoked, but entry of outer state is not
+ /// invoked and from outer state to inner state entry of the inner state is invoked but exit of
+ /// outer state is not invoked
+ ///
+ /// \param [in] f_pSourceState
+ /// CFrameworkunifiedState* - Source state in which reaction is being executed
+ ///
+ /// \param [in] f_pData
+ /// CEventDataPtr - event data
+ ///
+ /// \return ActiveState
+ /// CFrameworkunifiedState* - Returns Active state
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData);
+};
+
+#endif // _FRAMEWORKUNIFIEDLOCALTRANSITIONS_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_multithreading.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_multithreading.h
new file mode 100755
index 0000000..827b180
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_multithreading.h
@@ -0,0 +1,227 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \~english \brief Application framework's core structures and data types.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_multithreading.h
+ * @brief \~english Application framework's core structures and data types.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_H__
+
+#include <native_service/frameworkunified_framework_types.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateHSMChildThread
+/// \~english @par Brief
+/// Start a subordinate dispatcher in a separate thread
+///
+/// \~english \param [in] hApp
+/// HANDLE - parent framework HANDLE
+/// \~english \param [in] childName
+/// PCSTR - Name to give to the child object
+/// \~english \param [in] CbInitialize
+/// CbFuncPtr - Initialization callback - use this to initialize and configure
+/// the child's dispatcher.
+/// \~english \param [in] CbShutdown
+/// CbFuncPtr - Shutdown callback - use this to shutdown and close the child
+/// The correct way for child to exit dispatch loop is to return eFrameworkunifiedStatusExit
+/// directly from this callback, or from some other interaction triggered by this
+/// callback
+///
+/// \~english \param [in] CbCreateStateMachine
+/// CbFuncPtr - StateMachine callback - use this to add new states, events and reactions
+/// in the Thread statemachine.
+/// \~english @retval HANDLE create thread with Priority success
+/// \~english @retval NULL create thread with Priority failed
+/// \~english @par Preconditions
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// \~english @par Change of the internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize,CbShutdown) is NULL. [NULL]
+/// - Thread attribute specified in the argument (attr) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// Start a subordinate dispatcher in a separate thread
+/// This API creates a child thread and returns a handle for communication with the child thread.\n
+/// After creating/initializing the Dispatcher for the child thread, the child thread receives requests
+/// and notifications to the Dispatcher and starts a main loop that executes the registered callback.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize, CbFuncPtr
+ CbShutdown, CbFuncPtr CbCreateStateMachine);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FrameworkunifiedCreateHSMChildThread
+ /// \~english @par Summary
+ /// Start a subordinate dispatcher in a separate thread with given Priority
+ /// \~english @param [in] hApp
+ /// HANDLE - parent framework HANDLE
+ /// \~english @param [in] childName
+ /// PCSTR - Name to give to the child object
+ /// \~english @param [in] CbInitialize
+ /// CbFuncPtr - Initialization callback - use this to initialize and configure
+ /// the child's dispatcher.
+ /// \~english @param [in] CbShutdown
+ /// CbFuncPtr - Shutdown callback - use this to shutdown and close the child
+ /// The correct way for child to exit dispatch loop is to return eFrameworkunifiedStatusExit
+ /// directly from this callback, or from some other interaction triggered by this
+ /// callback
+ ///
+ /// \~english @param [in] CbCreateStateMachine
+ /// CbFuncPtr - StateMachine callback - use this to add new states, events and reactions
+ /// in the Thread statemachine.
+ /// \~english @param [in] schedPrio
+ /// SI_32 - given Priority for create thread
+ /// \~english @retval HANDLE create thread with Priority success
+ /// \~english @retval NULL create thread with Priority failed
+ /// \~english @par Preconditions
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize,CbShutdown) is NULL. [NULL]
+/// - Thread attribute specified in the argument (attr) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Start a subordinate dispatcher in a separate thread with given Priority
+ /// This API creates a child thread and returns a handle for communication with the child thread.\n
+ /// After creating/initializing the Dispatcher for the child thread, the child thread receives requests
+ /// and notifications to the Dispatcher and starts a main loop that executes the registered callback.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThreadWithPriority(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize,
+ CbFuncPtr CbShutdown, CbFuncPtr CbCreateStateMachine, SI_32 schedPrio);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FrameworkunifiedCreateHSMChildThread
+ /// \~english @par Summary
+ /// Start a subordinate dispatcher in a separate thread with given attribute
+ /// \~english @param [in] hApp
+ /// HANDLE - parent framework HANDLE
+ /// \~english @param [in] childName
+ /// PCSTR - Name to give to the child object
+ /// \~english @param [in] CbInitialize
+ /// CbFuncPtr - Initialization callback - use this to initialize and configure
+ /// the child's dispatcher.
+ /// \~english @param [in] CbShutdown
+ /// CbFuncPtr - Shutdown callback - use this to shutdown and close the child
+ /// The correct way for child to exit dispatch loop is to return eFrameworkunifiedStatusExit
+ /// directly from this callback, or from some other interaction triggered by this
+ /// callback
+ ///
+ /// \~english @param [in] CbCreateStateMachine
+ /// CbFuncPtr - StateMachine callback - use this to add new states, events and reactions
+ /// in the Thread statemachine.
+ /// \~english @param [in] attr
+ /// const FrameworkunifiedChildThreadAttr * - given attribute to create thread
+ /// \~english @retval HANDLE create thread with Priority success
+ /// \~english @retval NULL create thread with Priority failed
+ /// \~english @par Preconditions
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize,CbShutdown) is NULL. [NULL]
+/// - Thread attribute specified in the argument (attr) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Start a subordinate dispatcher in a separate thread with given attribute
+ /// This API creates a child thread and returns a handle for communication with the child thread.\n
+ /// After creating/initializing the Dispatcher for the child thread, the child thread receives requests
+ /// and notifications to the Dispatcher and starts a main loop that executes the registered callback.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThreadWithAttribute(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize,
+ CbFuncPtr CbShutdown, CbFuncPtr CbCreateStateMachine,
+ const FrameworkunifiedChildThreadAttr *attr);
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_orthogonalstate.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_orthogonalstate.h
new file mode 100755
index 0000000..c9ea8c7
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_orthogonalstate.h
@@ -0,0 +1,513 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedOrthogonalState class definitions. CFrameworkunifiedOrthogonalState is derived from
+/// CFrameworkunifiedCompositeState class.This class implements the additional functionality supported by HSM
+/// Orthogonal state. It provides the standard interfaces for adding orthogonal state machines.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_orthogonalstate.h
+ * @brief \~english This file has the CFrameworkunifiedOrthogonalState class definitions. CFrameworkunifiedOrthogonalState is derived from
+ * CFrameworkunifiedCompositeState class.This class implements the additional functionality supported by HSM
+ * Orthogonal state. It provides the standard interfaces for adding orthogonal state machines.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDORTHOGONALSTATE_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDORTHOGONALSTATE_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_state.h>
+#include <vector>
+
+typedef std::vector<CFrameworkunifiedState *> OrthogonalRegionList;
+
+class CFrameworkunifiedCompositeState;
+
+class CFrameworkunifiedHSM;
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM
+/// Orthogonal state. It provides the standard interfaces for adding orthogonal state machines.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedOrthogonalState : public CFrameworkunifiedState {
+ public :
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Constructors for CFrameworkunifiedOrthogonalState classes
+ /// \~english @param [in] f_pName
+ /// std::string - state name
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - When the quadrature region list cannot be created due to insufficient memory
+ /// \~english @par Detail
+ /// Generates an orthographic region list.\n
+ /// CFrameworkunifiedOrthogonalState classes are used to manage the status of independent features individually.\n
+ /// For example, when the function of the clock is set to the following two, the management of the internal state is performed according to the function.\n
+ /// - Clock function (Clock display by 12h/24h)\n
+ /// - Alarm function (on/off setting)
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see ~CFrameworkunifiedOrthogonalState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedCompositeState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ CFrameworkunifiedOrthogonalState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Destructors of CFrameworkunifiedOrthogonalState classes
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Frees the memory in the orthographic area list and clears the memory contents.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedOrthogonalState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedOrthogonalState
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedOrthogonalState();
+
+
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Initialize state
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval Successful pointer to the current state after processing
+ /// \~english @retval NULL Exception supine in internal processing
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - The State Machine for the current state of the application is set in the FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - Failed recursive function call (FrameworkunifiedOnEntry call)[NULL]
+ /// - If the pointers to the orthographic regions are NULL [NULL]
+ /// \~english @par Detail
+ /// Loops as many times as the number of elements in the quadrature area list, and initializes the active state (calls FrameworkunifiedOnEntry).\n
+ /// If the current state is Leaf State, it does not initialize because it does not have any active state.\n
+ /// If, after initialization, the current state is a child state of Orthogonal State, sets itself (the this pointer) to the current state.\n
+ /// Breaks looping if the current state is not a child state of Orthogonal State.\n
+ /// To maintain the hierarchy, the active state of the parent state is set to the current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see FrameworkunifiedOnHSMStop, FrameworkunifiedOnEntry, CFrameworkunifiedState::FrameworkunifiedOnHSMStart, IsOrthogonalChildState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStart
+ /// This function is called recursively till the leaf state is reached. This internally
+ /// calls the Entry function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ CFrameworkunifiedState *FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Clean up state.
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval Successful pointer to the current state after processing
+ /// \~english @retval NULL Exception supine in internal processing
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - The State Machine for the current state of the application is set in the FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - If the pointers to the orthographic regions are NULL [NULL]
+ /// - If the pointers to the orthographic area lists of the member variables are NULL [NULL]
+ /// - Active state pointers from orthographic area lists of member variables are NULL [NULL]
+ /// - If the current state of the state being cleaned up is NULL [NULL]
+ /// \~english @par Detail
+ /// Loops as many times as the number of elements in the quadrature area list, and performs cleanup of the active state (calls FrameworkunifiedOnExit).\n
+ /// If the current state is Leaf State,Do not clean up because it does not have any active state.\n
+ /// If the current state is a child state of Orthogonal State (orthographic state) after the cleanup process finishes,Sets itself (the this pointer) to the current state.\n
+ /// Breaks looping if the current state is not a child state of Orthogonal State.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see FrameworkunifiedOnHSMStart, CFrameworkunifiedState::FrameworkunifiedOnHSMStop, CFrameworkunifiedState::FrameworkunifiedPostEvent, FrameworkunifiedOnExit,
+ /// IsOrthogonalChildState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStop
+ /// This function is called recursively till the required parent state is reached. This
+ /// internally calls the Exit function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ CFrameworkunifiedState *FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedAddOrthogonalRegion
+ /// This Interface adds orthogonal region in the orthogonal state.
+ ///
+ /// \param [in] f_pOrthogonalRegion
+ /// CFrameworkunifiedCompositeState - Orthogonal region object to be associated with state.
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedAddOrthogonalRegion(CFrameworkunifiedCompositeState *f_pOrthogonalRegion);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Checks whether OrthogonalRegion (orthographic area) is registered or not.
+ /// \~english @retval TRUE OrthogonalRegion (orthographic area) is registered
+ /// \~english @retval FALSE OrthogonalRegion (orthographic area) is not registered
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - OrthogonalRegion (orthographic area) is registered in FrameworkunifiedAddOrthogonalRegion.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - If the pointers to the orthographic regions are NULL [FALSE]
+ /// - When the OrthogonalRegion (orthographic area) is not registered and the number of elements (size) of the orthographic area is 0, [FALSE]
+ /// \~english @par Detail
+ /// Checks whether OrthogonalRegion (orthographic area) is registered by referring to the number of elements (size) of the orthographic area list.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedHasOrthogoanlRegions
+ /// This checks if the current state has Orthogonal regions
+ ///
+ ///
+ /// \return TRUE/FASLE
+ /// BOOL - returns TRUE if orthogonal regions are available in the state
+ virtual BOOL FrameworkunifiedHasOrthogoanlRegions();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Event handling
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval Successful pointer to the current state after processing
+ /// \~english @retval NULL Operation cannot be guaranteed.
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - The State Machine for the current state of the application is set in the FrameworkunifiedSetHSM.
+ /// - OrthogonalRegion (orthographic area) is registered in FrameworkunifiedAddOrthogonalRegion.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - If the pointers to the orthographic regions are NULL [NULL]
+ /// - If the event data class is pointed to by NULL [NULL]
+ /// \~english @par Detail
+ /// If the event specified in the argument (f_pEventData) is available in the current state,Set itself (this) to current state and return it.\n
+ /// Invokes the parent-state FrameworkunifiedOnEvent if not available in the current state
+ /// (Repeated until the root state is reached.)\n
+ /// However, since the FrameworkunifiedState that is the parent state of the Orthogonal State (orthographic state) is the root state,You call the FrameworkunifiedOnEvent of FrameworkunifiedState.\n
+ /// If the current state is a child state of the Orthogonal State (quadrature state) after the above process, sets itself (the this pointer) to the current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedCompositeState::FrameworkunifiedGetActiveState, CFrameworkunifiedState::FrameworkunifiedIsReactionAvailable, CFrameworkunifiedState::FrameworkunifiedOnEvent,
+ /// IsOrthogonalChildState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEvent
+ /// This function processes the event. If the reaction for event is available in the current
+ /// state within eventlist and deferred eventlist then it is consumed in the current state
+ /// otherwise forwarded to the parent state. Event forwarding is done recursively till either
+ /// event is consumed or the root state has encountered. This also process the events posted
+ /// in the reactions recursively till all posted events are cleared.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ ///
+ /// \return state
+ /// CFrameworkunifiedState* - Returns current state after the event is processed
+ ///
+ virtual CFrameworkunifiedState *FrameworkunifiedOnEvent(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Logs the state name and event name.
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - OrthogonalRegion (orthographic area) is registered in FrameworkunifiedAddOrthogonalRegion.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - If the pointers to the orthographic regions are NULL [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Size of the log output data
+ /// - State name of the parent state machine and the state name of the self-state machine
+ /// - All event names on the event list
+ /// - All event names on the deferred event list
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedCompositeState::FrameworkunifiedPrintStates
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPrintStates
+ /// This logs the state name and events associated with the state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedPrintStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Get the active state.
+ /// \~english @retval Successful pointer to the active state
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// In this class, the current state (this state) is always returned as the active state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedGetActiveState
+ /// This interface returns the Active state of the current composite state. In case of
+ /// non-composite state current state is active state
+ ///
+ /// \return Active state
+ /// CFrameworkunifiedState* - Active state
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Associate the state machine with the current state.
+ /// \~english @param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Pointers to state machines (CFrameworkunifiedHSM classes)
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Specifiying NULL pointers
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - When the pointers to the state machines (CFrameworkunifiedHSM classes) specified in the arguments (f_pStatemachine) are NULL
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Associates a state machine with the current state by setting a pointer (f_pStatemachine) to the state machine (CFrameworkunifiedHSM) specified by the argument to the pointer to the state machine of the member variables.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedCompositeState::FrameworkunifiedSetHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSetHSM
+ /// This Interface associates the gives statemachine with the current state
+ ///
+ /// \param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Statemachine associated with the state.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Outputs state information in the form of XML tags.
+ /// \~english @param [out] f_strXMLString
+ /// std::ostringstream& - Only kept in NPS
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Specifiying NULL pointers
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - The State Machine for the current state of the application is set in the FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - If generating of own instance (CFrameworkunifiedOrthogonalState) failed, [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Outputs the following state information in XML tag format to the XML stream specified by the argument.
+ /// - Sate name
+ /// - All event information (event ID and event name) in the event list
+ /// - All event information (event ID and event name) in the deferred event list
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedCompositeState::FrameworkunifiedPrintXML
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPrintXML
+ /// Update the State information in the given stream in the form of XML tags
+ ///
+ /// \param [in] f_strXMLString
+ /// std::ostringstream & - reference to the XML stream
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Always returns eFrameworkunifiedStatusOK (Successful).
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// In this class, eFrameworkunifiedStatusOK is always returned because the class does not require the History feature.\n
+ /// The History feature holds the active state prior to preprocessing and
+ /// returns the inside state to the active state prior to processing after the processing is executed.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateHistory
+ /// This function stores the last active state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ EFrameworkunifiedStatus UpdateHistory();
+
+ protected :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEntry
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnExit
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
+
+ private:
+ /// Pointer to the map that stores the pointer to Orthogonal region list
+ OrthogonalRegionList *m_pOrthogonalReigonList;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// IsOrthogonalChildState
+ /// Checks if the given state is a child of orthogonal region
+ ///
+ /// \param [in] f_pChildState
+ /// CFrameworkunifiedState* - Child state pointer
+ ///
+ /// \return TRUE/FASLE
+ /// BOOL - returns TRUE if the given state is child of orthogonal state
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsOrthogonalChildState(CFrameworkunifiedState *f_pChildState);
+};
+
+#endif // _FRAMEWORKUNIFIEDORTHOGONALSTATE_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_reaction.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_reaction.h
new file mode 100755
index 0000000..83beea0
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_reaction.h
@@ -0,0 +1,184 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedReaction class definitions.This class provides the interface
+/// for defining a reaction for an event
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_reaction.h
+ * @brief \~english This file has the CFrameworkunifiedReaction class definitions.This class provides the interface
+ * for defining a reaction for an event
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDREACTION_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDREACTION_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <boost/smart_ptr.hpp>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+#include <exception>
+
+class CFrameworkunifiedState;
+class CEventData;
+
+typedef boost::shared_ptr<CEventData> CEventDataPtr;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class provides the interface for defining a reaction for an event
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedReaction {
+ public :
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedReaction
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param [in] f_pSourceState
+ /// CFrameworkunifiedState* f_pSourceState - source state
+ /// \~english @param [in] f_pData
+ /// CEventDataPtr f_pData - event data
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedReaction
+ /// The reaction for the event has to be implemented in this function
+ ///
+ /// \param [in] f_pSourceState
+ /// CFrameworkunifiedState* - Source state in which reaction is being executed
+ ///
+ /// \param [in] f_pData
+ /// CEventDataPtr - event data
+ ///
+ /// \return ActiveState
+ /// CFrameworkunifiedState* - Returns Active state
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedReaction
+ /// \~english @par Summary
+ /// CFrameworkunifiedReaction constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - m_ucRefCount = 0
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// CFrameworkunifiedReaction Constructor, for create CFrameworkunifiedReaction object
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedReaction
+ /// Constructor
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedReaction() {
+ m_ucRefCount = 0;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedReaction
+ /// \~english @par Summary
+ /// CFrameworkunifiedReaction destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// CFrameworkunifiedReaction destructor, for destory CFrameworkunifiedReaction object
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedReaction
+ /// Destructor
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedReaction() {}
+
+ // count to check the number of reference of this reaction in all the states of statemachine
+ UI_8 m_ucRefCount;
+};
+#endif // _FRAMEWORKUNIFIEDREACTION_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_shallowhistorystate.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_shallowhistorystate.h
new file mode 100755
index 0000000..945749d
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_shallowhistorystate.h
@@ -0,0 +1,163 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the declaration of class CFrameworkunifiedShallowHistoryState . CFrameworkunifiedShallowHistoryState is
+/// derived from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported
+/// by HSM Shallow History state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_shallowhistorystate.h
+ * @brief \~english This file has the declaration of class CFrameworkunifiedShallowHistoryState . CFrameworkunifiedShallowHistoryState is
+ * derived from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported
+ * by HSM Shallow History state.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_SM_SHALLOWHISTORYSTATE_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_SM_SHALLOWHISTORYSTATE_H__
+
+#include <native_service/frameworkunified_sm_historystate.h>
+#include <string>
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM Shallow History state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedShallowHistoryState : public CFrameworkunifiedHistoryState {
+ public :
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedShallowHistoryState
+ /// \~english @par Brief
+ /// CFrameworkunifiedShallowHistoryState constructor
+ /// \~english @param [in] f_pName
+ /// std::string - Name of the state
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This class inherits from CFrameworkunifiedHistoryState class and creates CFrameworkunifiedShallowHistoryState object. \n
+ /// In this function, we set member variable m_uiEventId to ShallowHistoryID(71), \n
+ /// and set member variable m_cEventName to evShallowHistory"evShallowHistory".
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see ~CFrameworkunifiedShallowHistoryState
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedShallowHistoryState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ CFrameworkunifiedShallowHistoryState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedShallowHistoryState
+ /// \~english @par Brief
+ /// CFrameworkunifiedShallowHistoryState destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Destory CFrameworkunifiedShallowHistoryState object.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedShallowHistoryState::CFrameworkunifiedShallowHistoryState
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedShallowHistoryState
+ /// Class destructor
+ ///
+ /// \return none
+ ~CFrameworkunifiedShallowHistoryState();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedShallowHistoryState
+ /// \~english @par Brief
+ /// update history infomation
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK update history infomation success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when update history infomation
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// m_pParentState is NULL
+ /// \~english @par Detail
+ /// update last active state, failed if m_pParentState is NULL
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateHistory
+ /// This function stores the last active state
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UpdateHistory();
+
+ private:
+ static const UI_32 m_suievShallowHistory;
+};
+
+#endif /* __FRAMEWORKUNIFIED_SM_SHALLOWHISTORYSTATE_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_state.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_state.h
new file mode 100755
index 0000000..438e2e5
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_state.h
@@ -0,0 +1,872 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedState class definitions. CFrameworkunifiedState is base class for all types of
+/// state classes.This class implements the basic functionality required for HSM state.
+/// It provides the standard interfaces for entering, exiting and reacting in a state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_state.h
+ * @brief \~english This file has the CFrameworkunifiedState class definitions. CFrameworkunifiedState is base class for all types of
+ * state classes.This class implements the basic functionality required for HSM state.
+ * It provides the standard interfaces for entering, exiting and reacting in a state.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_STATE_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_STATE_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_reaction.h>
+#include <string>
+#include <map>
+#include <exception>
+#include <vector>
+
+class CFrameworkunifiedReaction;
+class CFrameworkunifiedHSM;
+
+/// defines the map of event reactions
+typedef std::map<UI_32, CFrameworkunifiedReaction *> EventReactionList;
+
+typedef std::vector<UI_32> DeferredEventList;
+
+/// defines the map of event names
+typedef std::map<UI_32, std::string> EventNameList;
+
+/// defines the iterator for event reaction map
+typedef std::map<UI_32, CFrameworkunifiedReaction *>::iterator EventReactionIterator;;
+
+typedef std::vector<CEventDataPtr> EventInfoList;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the basic functionality required for HSM state. It provides the standard
+/// interfaces for entering, exiting and reacting in a state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedState {
+ public :
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// CFrameworkunifiedState constructor
+ /// \~english @param [in] f_pName
+ /// std::string - Name of the state
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This clase is a base class of state machine. \n
+ /// It creates object of CFrameworkunifiedState class, and initializes the member variable with state name specified by
+ /// argument(f_pName). \n
+ /// It creates the following event lists, and saves them as member variables. About the other member variables,
+ /// it initialzes them with NULL. \n
+ /// If error occurs, output the error log. \n
+ /// - list of events associated with the state(used for managing state of eace event)
+ /// - list of deferred events associated with the state(used for managing state of deferred event)
+ /// - list of deferred events posted in the state(used for posting list of deferred events)
+ /// - list of event names(used for managing event names)
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see ~CFrameworkunifiedState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ CFrameworkunifiedState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// CFrameworkunifiedState destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This class destroys object of CFrameworkunifiedState class.\n
+ /// It destroys the following event list. If error occurs, output the error log.
+ /// - list of events associated with the state
+ /// - list of deferred events associated with the state
+ /// - list of deferred events posted in the state
+ /// - list of event names
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedState
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedState();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// add event information
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - event ID
+ /// \~english @param [in] f_pReaction
+ /// CFrameworkunifiedReaction *f_pReaction - event reaction
+ /// \~english @param [in] f_strEventName
+ /// std::string f_strEventName - event name
+ /// \~english @retval eFrameworkunifiedStatusOK add event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when add event
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// given param is NULL
+ /// \~english @par Detail
+ /// add event information to event list, failed if given param is NULL
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedAddEvent
+ /// Associates the event id with the reaction in the state. When the event is posted to the
+ /// state the associated reaction is executed. This also adds the event name to the map
+ /// which is used for debugging.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id of the event to be added in the state
+ ///
+ /// \param [in] f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction to be associated with the with event id in the state
+ ///
+ /// \param [in] f_strEventName
+ /// string - Name of the event (used for debugging purpose only)
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedAddEvent(UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName = "");
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This function processes the event.
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to event data class
+ /// \~english @retval CFrameworkunifiedState* Pointer to current CFrameworkunifiedState object after processing event
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to call constructor to create object. [this(current CFrameworkunifiedState object]
+ /// - Pointer to event data class is NULL. [NULL]
+ /// \~english @par Detail
+ /// This function processes the event. If the reaction for event is available in the current
+ /// state within eventlist and deferred eventlist then it is consumed in the current state
+ /// otherwise forwarded to the parent state. Event forwarding is done recursively till either
+ /// event is consumed or the root state has encountered. This also process the events posted
+ /// in the reactions recursively till all posted events are cleared.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CEventData, FrameworkunifiedIsReactionAvailable
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEvent
+ /// This function processes the event. If the reaction for event is available in the current
+ /// state within eventlist and deferred eventlist then it is consumed in the current state
+ /// otherwise forwarded to the parent state. Event forwarding is done recursively till either
+ /// event is consumed or the root state has encountered. This also process the events posted
+ /// in the reactions recursively till all posted events are cleared.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ ///
+ /// \return state
+ /// CFrameworkunifiedState* - Returns current state after the event is processed
+ ///
+ virtual CFrameworkunifiedState *FrameworkunifiedOnEvent(CEventDataPtr f_pEventData);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// add deferred event information
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - event ID
+ /// \~english @param [in] f_strEventName
+ /// std::string f_strEventName - event name
+ /// \~english @retval eFrameworkunifiedStatusOK add deferred event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when add deferred event
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// given param is NULL
+ /// \~english @par Detail
+ /// add deferred event information to event list , failed if given param is NULL
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedAddDeferredEvent
+ /// Associates the deferred event id with the reaction in the state. When the event is posted
+ /// to the state the event is deferred and stored in the state. In case of implicit recall
+ /// of the deferred events, events are processed before exiting the state. The deferred
+ /// events can also be recalled explicitly in the state This also adds the event name
+ /// to the map which is used for debugging.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id of the event to be added in the state
+ ///
+ /// \param [in] f_strEventName
+ /// string - Name of the event (used for debugging purpose only)
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedAddDeferredEvent(UI_32 f_uiEventId, std::string f_strEventName = "");
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This function creates new eventdata object and add it to event queue of the state machine.
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - event ID
+ /// \~english @retval eFrameworkunifiedStatusOK post event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when post event
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - State machine of application is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Failed to create object of eventdata. [eFrameworkunifiedStatusNullPointer]
+ /// - Pointer to event list in which to add eventdata in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Pointer to active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Name of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This function creates new eventdata object and add it to event queue of the state machine.\n
+ /// The events are posted in the reaction which are executed in the state.
+ /// The event queue is processed once the execution of the reaction is completed.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedPostEvent(CEventDataPtr), CEventData, CFrameworkunifiedHSM::FrameworkunifiedQueueEvent, CFrameworkunifiedHSM::ProcessEvent
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPostEvent
+ /// This function creates new eventdata object and add the to event queue of the state.
+ /// The events are posted in the reaction which are executed in the state.
+ /// The event queue is processed once the execution of the reaction is completed.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event Id
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedPostEvent(UI_32 f_uiEventId);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This function adds event data to event queue of the state machine.
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to event data class
+ /// \~english @retval eFrameworkunifiedStatusOK post event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when post event
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - State machine of application is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Pointer to event data class specified by argument(f_pEventData) is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Pointer to event list in which to add eventdata in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Pointer to active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Name of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This function adds event data to event queue of the state machine. The events are posted in the reaction
+ /// which are executed in the state. The event queue is processed once the execution of the
+ /// reaction is completed.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CEventData, FrameworkunifiedIsReactionAvailable, CFrameworkunifiedHSM::FrameworkunifiedQueueEvent, CFrameworkunifiedHSM::ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPostEvent
+ /// This function adds the event queue of the state. The events are posted in the reaction
+ /// which are executed in the state. The event queue is processed once the execution of the
+ /// reaction is completed.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedPostEvent(CEventDataPtr f_pEventData);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// delete event from deferred event list
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - event ID
+ /// \~english @retval eFrameworkunifiedStatusOK delete deferred event success
+ /// \~english @retval eFrameworkunifiedStatusInvldID invalid event ID
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when delete deferred event
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// delete event from deferred event list by event ID
+ /// failed if event id is not exist. exception occur if given param is NULL
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedRemoveEventFromDeferredEventList
+ /// This function removes the event from the posted deferred queue list of the state.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if event removed
+ /// eFrameworkunifiedStatusInvldID if event not found in list
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedRemoveEventFromDeferredEventList(UI_32 f_uiEventId);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This function indicates if the state has sub states.
+ /// \~english @param None
+ /// \~english @retval BOOL if the state has sub states
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function indicates if the state has sub states. It returns TRUE only in the CompositeState
+ /// where this function is overridden
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedCompositeState::FrameworkunifiedHasSubStates
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedHasSubStates
+ /// This indicates if the state has sub states. It returns TRUE only in the CompositeState
+ /// where this function is overridden
+ ///
+ /// \return TRUE/FASLE
+ /// BOOL - returns TRUE if it has sub states otherwise returns false.
+ virtual BOOL FrameworkunifiedHasSubStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This function indicates if the state has sub states.
+ /// \~english @param None
+ /// \~english @retval BOOL if the state has sub states
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function indicates if the state has sub states. It returns TRUE only in the OrthogonalState
+ /// where this function is overridden
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedOrthogonalState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedHasOrthogoanlRegions
+ /// This indicates if the state has sub states. It returns TRUE only in the OrthogonalState
+ /// where this function is overridden
+ ///
+ /// \return TRUE/FASLE
+ /// BOOL - returns TRUE if it has sub states otherwise returns false.
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual BOOL FrameworkunifiedHasOrthogoanlRegions();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This logs the state name and event name associated with the state
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer exception
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to call constructor to create object. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This logs the state name and event name associated with the state. \n
+ /// It outputs the following logs:
+ /// - state name of parent state machine and self state machine
+ /// - all event names in event list
+ /// - all event names in deferred event list
+ /// CFrameworkunifiedCompositeState and CFrameworkunifiedOrthogonalState class overrides this function
+ /// and use it.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPrintStates
+ /// This logs the state name and events associated with the state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedPrintStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// Initialize state.
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to event data class
+ /// \~english @retval CFrameworkunifiedState* Pointer to current CFrameworkunifiedState object after processing event
+ /// \~english @retval NULL error occurs in internal process
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to call function(FrameworkunifiedOnEntry) recursively. [NULL]
+ /// \~english @par Detail
+ /// This function is called recursively till the leaf state is reached. This internally
+ /// calls the Entry function of the current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CEventData, FrameworkunifiedOnEntry, FrameworkunifiedOnHSMStop
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStart
+ /// This function is called recursively till the leaf state is reached. This internally
+ /// calls the Entry function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// Clearup state.
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to event data class
+ /// \~english @retval CFrameworkunifiedState* Pointer to current CFrameworkunifiedState object after processing event
+ /// \~english @retval NULL error occurs in internal process
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to call constructor to create object. [NULL]
+ /// - Pointer to list of deferred events posted in the state is NULL. [NULL]
+ /// - Pointer to event data getted from list of deferred events posted in the state is NULL. [NULL]
+ /// - Event name of event data getted from list of deferred events posted in the state is NULL. [NULL]
+ /// \~english @par Detail
+ /// This function is called recursively till the required parent state is reached. This
+ /// internally calls the Exit function of the current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CEventData, FrameworkunifiedOnExit, FrameworkunifiedOnHSMStart
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStop
+ /// This function is called recursively till the required parent state is reached. This
+ /// internally calls the Exit function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CECEventDataPtr Event data
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// Check the availability of event.
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 - event ID
+ /// \~english @retval TRUE reaction is available for this event
+ /// \~english @retval FALSE reaction is not available for this event
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// If the event specified by argument(f_uiEventId) is in event list,
+ /// the reaction is available for this event, return TRUE.
+ /// If the event specified by argument(f_uiEventId) is in deferred event list
+ /// but not in event list, the reaction is available for this event, return TRUE.
+ /// Otherwise, the event specified by argument(f_uiEventId) isn't available, return FALSE.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedPostEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedIsReactionAvailable
+ ///
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event identifier
+ ///
+ /// \return TRUE/FASLE
+ /// BOOL - returns TRUE if it reaction is available for this event
+ virtual BOOL FrameworkunifiedIsReactionAvailable(UI_32 f_uiEventId);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param None
+ /// \~english @retval CFrameworkunifiedState* depend on implement class
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedGetActiveState
+ /// This interface returns the Active state of the current composite state. In case of
+ /// non-composite state current state is active state
+ ///
+ /// \return Active state
+ /// CFrameworkunifiedState* - Active state
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState() = 0;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This Interface associates the gives statemachine with the current state
+ /// \~english @param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Statemachine associated with the state.
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer exception
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Pointer to state machine(CFrameworkunifiedHSM class) specified by argument(f_pStatemachine) is NULL.
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This Interface sets state machine of member variable to state machine specified by argument,
+ /// so it can associate the giving statemachine with current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSetHSM
+ /// This Interface associates the gives statemachine with the current state
+ ///
+ /// \param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Statemachine associated with the state.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ virtual EFrameworkunifiedStatus FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// Get application handle.
+ /// \~english @param None
+ /// \~english @retval HANDLE application handle
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to get application handle. [NULL]
+ /// \~english @par Detail
+ /// This interface gets and returns the application handle with following steps:
+ /// - If member variable used for state machine of application is not setted, return NULL.
+ /// - Get application handle from state machine of application.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedHSM::FrameworkunifiedGetAppHandle
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedGetAppHandle
+ /// This interface returns the application handle
+ ///
+ /// \return HANDLE
+ /// HANDLE - Application Handle
+ ///
+ virtual HANDLE FrameworkunifiedGetAppHandle();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// Update the State information in the given stream in the form of XML tags
+ /// \~english @param [out] f_strXMLString
+ /// std::ostringstream & - reference to the XML stream
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer exception
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to call constructor to create object. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Update the following State information in the given stream in the form of XML tags
+ /// - state name
+ /// - all event information in event list(eventID, event name)
+ /// - all event information in deferred event list(eventID, event name)
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CEventData, FrameworkunifiedIsReactionAvailable, CFrameworkunifiedHSM::FrameworkunifiedQueueEvent, CFrameworkunifiedHSM::ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPrintXML
+ /// Update the State information in the given stream in the form of XML tags
+ ///
+ /// \param [in] f_strXMLString
+ /// std::ostringstream & - reference to the XML stream
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ virtual EFrameworkunifiedStatus FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateHistory
+ /// This function stores the last active state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus UpdateHistory() = 0;
+
+ protected :
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEntry
+ /// This is pure virtual function implemented by the derived classes of the application.
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) = 0;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnExit
+ /// This is pure virtual function implemented by the derived classes of the application.
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData) = 0;
+
+ private:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// IsEventDeferred
+ /// This checks if the given event is marked as deferred in the state.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event identifier
+ ///
+ /// \return BOOL
+ /// BOOL - event deferred or not
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsEventDeferred(UI_32 f_uiEventId);
+
+ public:
+ /// state name
+ std::string m_strStateName;
+
+ /// Pointer to the parent state
+ CFrameworkunifiedState *m_pParentState;
+
+ /// pointer to the default state
+ CFrameworkunifiedState *m_pDefaultState;
+
+ /// pointer to the active state
+ CFrameworkunifiedState *m_pActiveState;
+
+ /// pointer to the map that stores the event name against event id
+ EventNameList *m_pEventName;
+
+ protected :
+ /// pointer to the map that stores the reaction against event id
+ EventReactionList *m_pEventList;
+
+ /// pointer to the map that stores deferred event ids
+ DeferredEventList *m_pDeferredEventList;
+
+ /// pointer to the vector that stores the eventinfo of the posted deferred event
+ EventInfoList *m_pDeferredPostEventList;
+
+ /// pointer to the application statemachine
+ CFrameworkunifiedHSM *m_pStateMachine;
+};
+
+#endif // __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_STATE_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_transition.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_transition.h
new file mode 100755
index 0000000..232c91e
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_transition.h
@@ -0,0 +1,150 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedTransition class definitions.This class provides the
+/// interface for reacting local transition and external transition
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_transition.h
+ * @brief \~english This file has the CFrameworkunifiedTransition class definitions.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_TRANSITION_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_TRANSITION_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_reaction.h>
+
+class CFrameworkunifiedState;
+class CFrameworkunifiedEventData;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class provides the interface for reacting local transition and external transition
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedTransition : public CFrameworkunifiedReaction {
+ public :
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedTransition
+ /// \~english @par Summary
+ /// CFrameworkunifiedTransition constructor
+ /// \~english @param [in] f_pTargetState
+ /// CFrameworkunifiedState *f_pTargetState - set m_pTargetState value
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - m_pTargetState = f_pTargetState
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// CFrameworkunifiedTransition constructor, for create CFrameworkunifiedTransition object
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedTransition(CFrameworkunifiedState *f_pTargetState); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedTransition
+ /// \~english @par Summary
+ /// CFrameworkunifiedTransition destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// CFrameworkunifiedTransition destructor, for destroy CFrameworkunifiedTransition object
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedTransition();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedTransition
+ /// \~english @par Summary
+ /// virtual fuction
+ /// \~english @param [in] f_pSourceState
+ /// CFrameworkunifiedState *f_pSourceState - source state
+ /// \~english @param [in] f_pData
+ /// CEventDataPtr f_pData - event data
+ /// \~english @retval CFrameworkunifiedState* depend on implement class
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) = 0;
+
+ protected :
+
+ /// Pointer to the target state of transition
+ CFrameworkunifiedState *m_pTargetState;
+};
+
+#endif // __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_TRANSITION_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_thread_priority.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_thread_priority.h
new file mode 100755
index 0000000..2af26a3
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_thread_priority.h
@@ -0,0 +1,235 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief The file provide CFrameworkunifiedThreadPriorities class.
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_thread_priority.h
+ * @brief \~english The file contains declaration of CFrameworkunifiedThreadPriorities class
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef FRAMEWORKUNIFIED_THREAD_PRIORITY_H_ // NOLINT (build/header_guard)
+#define FRAMEWORKUNIFIED_THREAD_PRIORITY_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <map>
+
+#define FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND -1 ///< \~english if specified thread name not found
+
+namespace frameworkunified {
+namespace framework {
+class args {
+ public:
+ enum {
+ name,
+ priority
+ };
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class parses and stores thread priorities
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedThreadPriorities {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Brief
+ /// CFrameworkunifiedThreadPriorities constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedThreadPriorities constructor, for create CFrameworkunifiedThreadPriorities
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedThreadPriorities();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Brief
+ /// CFrameworkunifiedThreadPriorities destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedThreadPriorities destructor, for destory CFrameworkunifiedThreadPriorities
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedThreadPriorities();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Brief
+ /// Get the priority of the thread. Priority of the thread was added by \ref AddPriority(),
+ /// when parsing command line arguments.
+ /// \~english @param [in] f_cThreadName
+ /// const std::string& - Name of thread
+ /// \~english @retval SI_32 Returns the priority of a thread.
+ /// \~english @retval FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND if specified thread name not found
+ /// \~english @par
+ /// FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND
+ /// \~english @code
+ /// #define FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND -1 // if specified thread name not found
+ /// @endcode
+ /// \~english @par Prerequisite
+ /// - Call AddPriority() and set priority.
+ /// \~english @par Change of internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - Thread name is not registered in AddPriority()
+ /// \~english @par Detail
+ /// Get the priority of the thread. Priority of the thread was added by \ref AddPriority(),
+ /// when parsing command line arguments.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ /// AddPriority
+ /////////////////////////////////////////////////////////////////////////////////////
+ static SI_32 GetPriority(const std::string &f_cThreadName);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Summary
+ /// set thread Priority
+ /// \~english @param [in] f_cThreadName
+ /// const std::string &f_cThreadName - thread name
+ /// \~english @param [in] f_si32Priority
+ /// SI_32 f_si32Priority - Priority
+ /// \~english @retval eFrameworkunifiedStatusOK set Priority success
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Change of the internal state
+ /// - ms_mapThreadPritories[f_cThreadName] = f_si32Priority
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// set thread Priority through thread name
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus AddPriority(const std::string &f_cThreadName, SI_32 f_si32Priority);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Summary
+ /// print thread Priority
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// read each thread and print it's Priority
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ static VOID PrintPriorites();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Summary
+ /// analyse thread param
+ /// \~english @param [in] f_cArgumentValue
+ /// PCHAR f_cArgumentValue - thread param string
+ /// \~english @retval eFrameworkunifiedStatusOK parse thread param success
+ /// \~english @retval eFrameworkunifiedStatusFail parse thread param failed
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - f_cArgumentValue == NULL
+ /// - f_cArgumentValue is invalid
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// analyse thread param data, and set param to thread.
+ /// if given data is NULL or invalid , return false
+ /// \~english @see getsubopt, AddPriority
+ ////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus ParseThreadArguments(PCHAR f_cArgumentValue);
+
+ private:
+ typedef std::map<std::string, SI_32> TThreadPriorityList;
+ typedef TThreadPriorityList::iterator ThreadPrioMapIter;
+ static TThreadPriorityList ms_mapThreadPritories; // map of thread name and priority
+};
+
+} // namespace framework
+}; // namespace frameworkunified
+
+#endif /* FRAMEWORKUNIFIED_THREAD_PRIORITY_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_timer.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_timer.h
new file mode 100755
index 0000000..7a3c762
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_timer.h
@@ -0,0 +1,143 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Application framework's core structures and data types.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_timer.h
+ * @brief \~english Application framework's core structures and data types.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NSFRAMEWORK_NFRAMEWORKCORE_FRAMEWORKUNIFIEDTIMER__ // NOLINT (build/header_guard)
+#define __NSFRAMEWORK_NFRAMEWORKCORE_FRAMEWORKUNIFIEDTIMER__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachTimerCallback
+/// \~english @par Brief
+/// Attach a callback to hApp dispatcher that will get called initially at initNS nanoseconds,
+/// and then repeatedly at repeatNS nanoseconds
+/// \~english @param[in] hApp
+/// HANDLE - hApp parent framework HANDLE
+/// \~english @param[in] initMS
+/// UI_32 - milliseconds to begin triggering callback(0 to 4294967295)
+/// \~english @param[in] repeatMS
+/// UI_32 - milliseconds between repeated triggerings of callback(0 to 4294967295)
+/// \~english @param[in] CbFn
+/// CbFuncPtr - Callback to be triggered
+/// \~english @retval Handle to the timer object or NULL on failure
+/// \~english @par Preconditons
+/// - hApp has already gotten the dispatcher(return NULL)
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - hApp is not application HNADLE(return NULL)
+/// - eFrameworkunifiedStatusFail if the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// - CbFn is NULL(return NULL))
+/// - If the send message queue handle specified in the argument (hApp) to itself is NULL [NULL]
+/// - Failed to create epoll instances (epoll_create1/eventfd) for timer event monitoring [NULL]
+/// - Failed to create a timer event monitor thread (pthread_create) [NULL]
+/// - When acquisition (malloc) of the timer-management-information area fails [NULL]
+/// - If the send message queue type to the handle (hApp) specified in the parameter is neither send nor receive, [NULL]
+/// - Failed to generate timers (timerfd_create) [NULL]
+/// - Failed to register file descriptors for timer notification to epoll instances (epoll_ctl) [NULL]
+/// - Failed to start/stop timer (timerfd_settime) [NULL]
+/// \~english @par Detail
+/// After registering the callback functions for timer events in the Dispatcher specified by the hApp arguments,
+/// it creates and starts a timer and returns its handles.\n
+/// Dispatcher executes callback functions when the timers generated by the APIs fire.\n
+/// The application shall use this API when there is a process to be executed once or repeatedly in response to a specified time elapsed.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the application specifies a initMS of 0, a timer is created and handles are returned, but the callback is not executed because the timer is stopped.
+/// - If the application specifies a repeatMS of zero, the callback is executed only once.
+/// - Since the timer handle is a FrameworkunifiedAttachTimerCallback return value, the callback cannot be set twice with the same timer handle.
+/// - If multiple calls are made with the same application handle, the second and subsequent callbacks are not set,
+/// and the first registered callback function is started at the last registered timer interval.
+/// - Create a thread for sending messages, but do not make dynamic calls because the thread is not destroyed even if FrameworkunifiedDetachTimerCallback is executed.
+/// \~english @par Classification
+/// \~english @par Type
+/// Open Close
+/// \~english @see FrameworkunifiedDetachTimerCallback
+/// \~english @todo needs to clarify this API require initMS except 0
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedAttachTimerCallback(HANDLE hApp, UI_32 initMS, UI_32 repeatMS, CbFuncPtr CbFn);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachTimerCallback
+/// \~english @par Brief
+/// Detach callback and deallocate a timer previous created with FrameworkunifiedAttachTimerCallback
+/// \~english @param[in] hApp
+/// HANDLE - hApp parent framework HANDLE
+/// \~english @param[in] hTimer
+/// HANDLE - timer HANDLE
+/// \~english @retval HANDLE HANDLE used to communicate with child. NULL...failure, otherwize...success
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusFail(not happened)
+/// \~english @retval eFrameworkunifiedStatusInvldParam
+/// \~englsih @par Preconditions
+/// - Timer is dispatched for hApp Callback
+/// \~englsih @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - hApp is not application HNADLE(eFrameworkunifiedStatusInvldParam)
+/// - eFrameworkunifiedStatusFail if the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - hTimer is NULL(eFrameworkunifiedStatusInvldParam)
+/// - When the timer has been stopped by the timer administrative info of the timer handle specified by the arguments, [eFrameworkunifiedStatusFail]
+/// - When the timer administrative information of the timer handle specified by the arguments is NULL, [eFrameworkunifiedStatusFail]
+/// - Failed to stop the timer (timerfd_settime) [eFrameworkunifiedStatusFail]
+/// - If a callback for the timer event is not registered in the Dispatcher specified by the hApp, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Stops the timer (hTimer) specified by the argument and registrations the callback functions
+/// for timer events from the Dispacther specified by the argument hApp.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation is not guaranteed if a different handle is set for the timer handle.
+/// - If a normal timer handle and an invalid application handle are set, only the timer information is deleted, resulting in an inconsistent state.
+/// \~english @par Classification
+/// \~english @par Type
+/// Open Close
+/// \~english @see FrameworkunifiedAttachTimerCallback
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachTimerCallback(HANDLE hApp, HANDLE hTimer);
+
+#endif // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/frameworkunified_types.h b/nsframework/framework_unified/client/include/native_service/frameworkunified_types.h
new file mode 100755
index 0000000..faaf3aa
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/frameworkunified_types.h
@@ -0,0 +1,268 @@
+/*
+ *
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file frameworkunified_types.h
+ * @brief \~english This file contains basic define,enum and struct of framework_unified.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef FRAMEWORKUNIFIED_TYPES_H_ // NOLINT (build/header_guard)
+#define FRAMEWORKUNIFIED_TYPES_H_
+
+#include <stdint.h>
+
+#define DEFINE_HANDLE_TYPE(struct_type, handle_type) typedef struct struct_type* handle_type;
+
+#define MIN_VAL(a, b) ((a) < (b)? (a) : (b))
+
+#ifndef NULL
+#define NULL 0
+#endif
+#ifndef VOID
+typedef void VOID;
+#endif
+#ifndef CONST
+#define CONST const
+#endif
+
+/// Lengths and Max Sizes
+#define INVALID_HANDLE NULL
+#define MAX_QUEUE_MSG_SIZE 4096
+// #define MAX_QUEUE_NAME_SIZE 24
+#define MAX_QUEUE_NAME_SIZE 20
+#define LIMIT_QUEUE_NAME_SIZE 16
+#define MAX_SYS_INFO_SIZE 64
+
+#define MAX_NAME_SIZE_APP MAX_QUEUE_NAME_SIZE ///< Maximum name size of the APP (Client/Service)
+#define LIMIT_NAME_SIZE_APP LIMIT_QUEUE_NAME_SIZE ///< Limit name size of the APP (Client/Service)
+#define MAX_NAME_SIZE_NOTIFICATION 24 ///< Maximum name size of the Notification
+#define MAX_STRING_SIZE_NOTIFICATION 64
+
+#define MAX_STRING_SIZE_TAG 64
+#define MAX_PATH_LENGTH 255
+
+
+#define NS_SHM_ERROR -1
+
+// Types
+typedef int8_t SI_8;
+typedef uint8_t UI_8;
+typedef int16_t SI_16;
+typedef uint16_t UI_16;
+typedef int32_t SI_32;
+typedef uint32_t UI_32;
+typedef int64_t SI_64;
+typedef uint64_t UI_64;
+typedef float F_32;
+typedef double F_64;
+// use it defined kernelmoduleevklibdd.h typedef UI_32 BOOL;
+#define PFALSE ((BOOL)0)
+#define PTRUE ((BOOL)1)
+
+#ifndef FALSE
+#define FALSE PFALSE
+#endif
+#ifndef TRUE
+#define TRUE PTRUE
+#endif
+
+// Pointer Types
+typedef BOOL *PBOOL;
+typedef SI_8 *PSI_8;
+typedef UI_8 *PUI_8;
+typedef SI_16 *PSI_16;
+typedef UI_16 *PUI_16;
+typedef UI_32 *PUI_32;
+typedef SI_32 *PSI_32;
+typedef UI_64 *PUI_64;
+typedef SI_64 *PSI_64;
+typedef F_32 *PF_32;
+typedef void *PVOID;
+typedef CONST void *PCVOID;
+
+typedef char CHAR, *PCHAR;
+typedef CONST char *PCSTR;
+typedef char *PSTR;
+
+typedef UI_8 _TUCHAR;
+typedef SI_32 HFILE;
+typedef PVOID HANDLE;
+typedef HANDLE *PHANDLE;
+typedef CHAR TSysMsgSystemInfo[MAX_SYS_INFO_SIZE]; ///< Information passed via the framework
+
+
+/// CR carry over types...
+/// \brief Types that have been carried
+/// over from Color Radio header file WPFAPI_types.h.
+typedef UI_16 MID;
+typedef UI_16 FRAMEWORKUNIFIED_CID;
+typedef UI_8 RID;
+typedef UI_16 PNO;
+typedef UI_8 BYTE;
+
+#define LOWORD(l) ((WORD)(l))
+#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
+#define _countof(array) (sizeof(array)/sizeof(array[0]))
+
+/// \typedef EFrameworkunifiedStatus
+/// \brief Status and return types
+typedef enum eFrameworkunifiedStatus {
+ eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+ eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+ eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+ eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+ eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+ eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+ eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+ eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+ eFrameworkunifiedStatusFail = -2, ///< Failed
+ eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+ eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+ eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+ eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+ eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+ eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+ eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+ eFrameworkunifiedStatusInvldNotification = 6, ///< The Notification event not present
+ eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+ eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+ eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+ eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+ eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+ eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+ eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+ eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+ eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+ eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+ eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+ eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+ eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+ eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+ eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+ eFrameworkunifiedStatusNullPointer = 22,
+ eFrameworkunifiedStatusMsgNotProcessed = 23,
+ eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+ eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+ eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+ eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+ eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+ eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+ eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+ eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+ eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+ eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+ eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+ eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+} EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+
+/// \typedef EFrameworkunifiedNotificationType
+/// \brief Notification types
+typedef enum _EFrameworkunifiedNotificationType {
+ eFrameworkunifiedNotificationVar = 0, ///< Non Persistent. Not stored locally by NPS
+ eFrameworkunifiedStateVar, ///< Non Persistent. stored locally by NPS
+ eFrameworkunifiedPersistedStateVar, ///< Persistent. Also stored locally by NPS
+ eFrameworkunifiedPersistedStateUserVar, ///< User specific Persistent. Also stored locally by NPS
+ eFrameworkunifiedImmediatePersistedStateVar, ///< Not to be used. See \ref FrameworkunifiedNPRegisterImmediatePersistNotification
+ eFrameworkunifiedUnknown ///< This is not a type of notification and should not be used while
+ ///< defining any notification.
+} EFrameworkunifiedNotificationType;
+
+/// \typedef ENS_ApplicationState
+/// \brief Application States that all module must handle
+/// this should be handle by Publishing a "ModuleName/State"
+/// with the parameter being one of these state values.
+typedef enum _EApplicationStates {
+ eAppInital = 0, ///< Initial: state value
+ eAppIdle, ///< Idle: application shouldn't be processing anything
+ eAppReady, ///< Ready: application is ready to do work
+ eAppConnecting, ///< Connecting: Service is connecting
+ eAppDisconnecting ///< Disconnecting: Service is disconnecting
+} EApplicationStates;
+
+
+typedef enum _EFrameworkunifiedMessagePriorties {
+ eFrameworkunifiedMsgPrioVeryLow = 1,
+ eFrameworkunifiedMsgPrioLow = 8,
+ eFrameworkunifiedMsgPrioNormal = 16,
+ eFrameworkunifiedMsgPrioEmergency = 30,
+} EFrameworkunifiedMessagePriorties;
+
+// defines what data to delete from persistent memory
+typedef enum _EFrameworkunifiedClearPersistence {
+ eFrameworkunifiedClearAllData = 0, ///< clears all the data in persistence memory for all users
+ ///< (currently only this enum value is supported.)
+ eFrameworkunifiedClearAllApplicationData, ///< clears all the data(files, folders) related to all application for all users
+ eFrameworkunifiedClearAllNotificationData, ///< clears all the notification data related to all application for all users
+ eFrameworkunifiedClearCurrentUserData, ///< clears all the data in persistence memory for current users
+ eFrameworkunifiedClearCurrentUserApplicationData, ///< clears all the data(files, folders)
+ ///< related to all application for current users
+ eFrameworkunifiedClearCurrentUserNotificationData ///< clears all the notification data
+ ///< related to all application for current users
+} EFrameworkunifiedClearPersistence;
+
+/// Enum defining category of persistent data
+typedef enum _EFrameworkunifiedPersistCategory {
+ eFrameworkunifiedUserData = 0x0001,
+ eFrameworkunifiedFactoryData = 0x0010,
+ eFrameworkunifiedFactoryCustomerData = 0x0100,
+ eFrameworkunifiedDealerData = 0x1000
+} EFrameworkunifiedPersistCategory;
+
+// defines the type of system error
+typedef enum _EFrameworkunifiedSystemError {
+ // TODO(framework_unified): add generic system errors
+ eFrameworkunifiedSystemErrorNone = 0,
+ eFrameworkunifiedDSPHardwareReset = 1 // system error is DSP hardware reset.
+ // It was commented, because this is product
+ // specific error. Must handle by SystemServices only.
+ // Uncommented per system services request.
+} EFrameworkunifiedSystemError;
+
+/// defines the shutdown types
+typedef enum _EFrameworkunifiedShutdownType {
+ eFrameworkunifiedNormalShutdown = 0,
+ eFrameworkunifiedQuickShutdown,
+ eFrameworkunifiedDataResetShutdown
+} EFrameworkunifiedShutdownType;
+
+/// defines the Release types
+typedef enum _EFrameworkunifiedReleaseType {
+ eFrameworkunifiedNotOnRelease = 0, ///< 0:not on release
+ eFrameworkunifiedPersistOnShutdown, ///< 1:persist on shutdown
+ eFrameworkunifiedPersistInstantly, ///< 2:persist instantly
+} EFrameworkunifiedReleaseType;
+
+#endif // FRAMEWORKUNIFIED_TYPES_H_ // NOLINT (build/header_guard))
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns__CWORD77__common.h b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__common.h
new file mode 100755
index 0000000..e472b30
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__common.h
@@ -0,0 +1,129 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns__CWORD77__common.h
+ * @brief \~english This file has templet class declaration of CCallback and CResCallback
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _NS__CWORD77_COMMON_H_ // NOLINT (build/header_guard)
+#define _NS__CWORD77_COMMON_H_
+
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns__CWORD77__types.h>
+
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+#define MAX_DATA_SIZE 512;
+// using namespace std;
+
+
+// typedef string ServiceName;
+
+
+#define DELETEPTR(p) {if (p != NULL) {delete p; p = NULL;}}
+
+typedef EFrameworkunifiedStatus(*_CWORD77_FuncPtr)(HANDLE hApp, BOOL bTImerExpiry);
+typedef EFrameworkunifiedStatus(*ResponseServiceTo_CWORD77_)(HANDLE hApp, E_CWORD77_ResponseType ResponseType, std::string ServiceName);
+typedef boost::function< EFrameworkunifiedStatus(HANDLE, std::string, std::string, UI_32, EFrameworkunifiedStatus) > SessionAckTo_CWORD77_;
+
+// typedef EFrameworkunifiedStatus (*_CWORD77_TimeoutFuncPtr)(HANDLE hApp,UI_32 uiCmdId, E_CWORD77_MessageType MessageType);
+
+template <typename C, EFrameworkunifiedStatus(C::*M)(HANDLE)>
+class CCallback {
+ public:
+ static CallbackFunctionPtr set(void *pInst) {
+ if (pInst == NULL) {
+ throw;
+ }
+ if (ms_pInst != NULL) {
+ // TODO(framework_unified): FRAMEWORKUNIFIEDLOG some warning, preferably outside the template (i.e. use a global),
+ // to limit executable size, as this code will be replicated many times over
+ }
+ ms_pInst = pInst;
+ return &CCallback::call;
+ }
+ static EFrameworkunifiedStatus call(HANDLE y) {
+ if (ms_pInst == NULL) {
+ return eFrameworkunifiedStatusFault; // can't throw here
+ }
+ C *c = static_cast<C *>(ms_pInst);
+ return (c->*M)(y);
+ }
+ private:
+ static void *ms_pInst;
+};
+
+
+
+template <typename C, EFrameworkunifiedStatus(C::*M)(HANDLE)>
+void *CCallback<C, M>::ms_pInst = NULL;
+
+
+
+template <typename C, EFrameworkunifiedStatus(C::*M)(HANDLE, E_CWORD77_ResponseType, std::string)>
+class CResCallback {
+ public:
+ static ResponseServiceTo_CWORD77_ set(void *pInst) {
+ if (pInst == NULL) {
+ throw;
+ }
+ if (ms_pInst != NULL) {
+ // TODO(framework_unified): FRAMEWORKUNIFIEDLOG some warning, preferably outside the template (i.e. use a global),
+ // to limit executable size, as this code will be replicated many times over
+ }
+ ms_pInst = pInst;
+ return &CResCallback::call;
+ }
+ static EFrameworkunifiedStatus call(HANDLE y, E_CWORD77_ResponseType ResponseType, std::string ServiceName) {
+ if (ms_pInst == NULL) {
+ return eFrameworkunifiedStatusFault; // can't throw here
+ }
+ C *c = static_cast<C *>(ms_pInst);
+ return (c->*M)(y, ResponseType, ServiceName);
+ }
+ private:
+ static void *ms_pInst;
+};
+
+template <typename C, EFrameworkunifiedStatus(C::*M)(HANDLE, E_CWORD77_ResponseType, std::string)>
+void *CResCallback<C, M>::ms_pInst = NULL;
+
+
+#endif // _NS__CWORD77_COMMON_H_ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_if.h b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_if.h
new file mode 100755
index 0000000..0fab83b
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_if.h
@@ -0,0 +1,183 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns__CWORD77__data_pool_if.h
+ * @brief \~english This file provides api to operating _CWORD77_DataPool
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+#ifndef _C_CWORD77_DATAPOOLIF_H_ // NOLINT (build/header_guard)
+#define _C_CWORD77_DATAPOOLIF_H_
+
+#include <native_service/ns__CWORD77__types.h>
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_HMI_CWORD77_Controller
+ /// \~english @par Brief
+ /// API to set data associated with request into _CWORD77_ Data Pool
+ /// \~english @param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \~english @param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \~english @param [in] f_pData
+ /// PVOID - void pointer to data
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - None.
+ /// \~english @par Detail
+ /// API to set data associated with request into _CWORD77_ Data Pool
+ /// \~english @par
+ /// It is maintained by executing C_CWORD77_Data::SetRespoData().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see GetRespDataFrom_CWORD77_DataPool, C_CWORD77_Data::SetRespoData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+VOID SetReqDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, PVOID f_pData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_HMI_CWORD77_Controller
+ /// \~english @par Brief
+ /// API to get data associated with response from _CWORD77_ Data Pool
+ /// \~english @param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \~english @param [out] f_uiSize
+ /// UI_32 - size of the data
+ /// \~english @param [out] f_pData
+ /// PVOID - void pointer to data
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusFail Error
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - C_CWORD77_Data Class instance fail or create fail [eFrameworkunifiedStatusFail]
+ /// - f_DataPoolKey is not registered [eFrameworkunifiedStatusFail]
+ /// - f_pData is NULL [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// API to get data associated with response from _CWORD77_ Data Pool
+ /// \~english @par
+ /// Use SetRespNotfnDataFrom_CWORD77_DataPool() to keep the data.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see SetRespNotfnDataFrom_CWORD77_DataPool, C_CWORD77_Data::GetRespoData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetRespDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_HMI_CWORD77_Controller
+ /// \~english @par Brief
+ /// API to set data associated with notification response into _CWORD77_ Data Pool
+ /// \~english @param[in] f_cNotificationName
+ /// const std::string& - Name of the notification
+ /// \~english @param[in] f_uiSize
+ /// UI_32 - size of the data
+ /// \~english @param[in] f_pData
+ /// const PVOID - void pointer to data
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - None.
+ /// \~english @par Detail
+ /// API to set data associated with notification response into _CWORD77_ Data Pool
+ /// \~english @par
+ /// Use GetRespNotfnDataFrom_CWORD77_DataPool() to get the held data.
+ /// \~english @par
+ /// It is maintained by executing C_CWORD77_Data::SetRespoData().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see GetRespNotfnDataFrom_CWORD77_DataPool, C_CWORD77_Data::SetRespoData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+VOID SetRespNotfnDataIn_CWORD77_DataPool(const std::string &f_cNotificationName, UI_32 f_uiSize, const PVOID f_pData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_HMI_CWORD77_Controller
+ /// \~english @par Brief
+ /// API to set data associated with notification response into _CWORD77_ Data Pool
+ /// \~english @param[in] f_cNotificationName
+ /// const std::string& - Name of the notification
+ /// \~english @param[out] f_uiSize
+ /// UI_32& - size of the data
+ /// \~english @param[out] f_pData
+ /// PVOID& - void pointer to data
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusFail Fail
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - C_CWORD77_Data Class instance fail or create fail [eFrameworkunifiedStatusFail]
+ /// - f_cNotificationName is not registered [eFrameworkunifiedStatusFail]
+ /// - f_pData is NULL [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// API to set data associated with notification response into _CWORD77_ Data Pool
+ /// \~english @par
+ /// Use SetRespNotfnDataFrom_CWORD77_DataPool() to keep the data.
+ /// \~english @par
+ /// Get by executing C_CWORD77_Data::GetRespoData().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see SetRespNotfnDataFrom_CWORD77_DataPool, C_CWORD77_Data::GetRespoData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetRespNotfnDataFrom_CWORD77_DataPool(const std::string &f_cNotificationName, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData); // NOLINT (readability/nolint)
+
+#endif // _C_CWORD77_DATAPOOLIF_H_ NOLINT (build/header_guard)
+//@}
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_key.h b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_key.h
new file mode 100755
index 0000000..6e3fbc1
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_key.h
@@ -0,0 +1,53 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns__CWORD77__data_pool_key.h
+ * @brief \~english Provide function _CWORD77__DATA_POOL_KEY of make_pair
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+#ifndef NS__CWORD77__DATA_POOL_KEY_H_ // NOLINT (build/header_guard)
+#define NS__CWORD77__DATA_POOL_KEY_H_
+
+#define _CWORD77__DATA_POOL_KEY(ProtocolId) (std::make_pair(ProtocolId, g_c_CWORD77_ServiceName))
+
+#endif /* NS__CWORD77__DATA_POOL_KEY_H_ */ // NOLINT (build/header_guard)
+//@}
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_table.h b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_table.h
new file mode 100755
index 0000000..73f6a20
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_table.h
@@ -0,0 +1,1217 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns__CWORD77__data_pool_table.h
+ * @brief \~english This file provides API for convert and C_CWORD77_DataPool class
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _CWORD77__DATA_POOL_TABLE_H_ // NOLINT (build/header_guard)
+#define _CWORD77__DATA_POOL_TABLE_H_
+
+#include <native_service/ns__CWORD77__common.h>
+#include <sstream>
+#include <map>
+#include <string>
+#include <vector>
+
+/// Enumeration for Type of Table
+typedef enum _ETableType {
+ REQUEST_TABLE = 1,
+ RESPONSE_TABLE
+} ETableType, *PETableType;
+
+/// Enumeration for Data Type
+typedef enum _EDataType {
+ UNKNOWNTYPE = -1,
+ SIGNEDINT,
+ UNSIGNEDINT,
+ FLOAT,
+ DOUBLE,
+ CHARACTER,
+ BOOLEAN,
+ STRING,
+} EDataType, *PEDataType;
+
+/// _CWORD77_ Data structure
+typedef struct __CWORD77_Data {
+ EDataType DataType;
+ std::string DataValue;
+} _CWORD77_Data, *P_CWORD77_Data;
+
+typedef std::map< _CWORD77_DataPoolKey, std::vector< CHAR > > T_CWORD77_DataPool;
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NoOfElementsinData
+/// Function to get number of elements for given string
+///
+/// \param [in] Input
+/// string - string
+///
+/// \return UI_32 - Number of elements
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 NoOfElementsinData(std::string Input);
+
+/// Template to Convert Number to String
+
+template <typename T>
+std::string NumberToString(T Number) {
+ std::ostringstream ss;
+ ss << Number;
+ return ss.str();
+}
+
+/// Template to convert String to Number
+
+template <typename T>
+T StringToNumber(const std::string &Text) {
+ std::istringstream ss(Text);
+ T result;
+ ss >> result;
+ return result;
+}
+
+/// Template to Convert an Array To String
+
+template<class T>
+std::string ConvertArrayToString(T *Array, int Arraysize) {
+ int length = 0;
+ std::string Result = "";
+ while (length < Arraysize) {
+ Result.append(NumberToString<T>(Array[length]));
+ Result.append(",");
+ length++;
+ }
+ Result.append("");
+ return Result;
+}
+
+/// Template to Convert String To Array
+template<class T>
+void ConvertStringToArray(std::string Input, std::vector<T> &Array, UI_32 &Arraysize) { // NOLINT (readability/nolint)
+ int i = 0;
+ std::string first = "";
+ std::istringstream ss(Input);
+ int Size = NoOfElementsinData(Input);
+ // T Arr[Size];
+ while (!ss.eof()) {
+ getline(ss, first, ',');
+ if (first != "") {
+ Array[i] = StringToNumber<T>(first);
+ i++;
+ }
+ }
+ Arraysize = i;
+ // memcpy(Array,(void *)Arr,Arraysize*sizeof(T));
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ConvertArrayStringsToString
+/// Function to convert array of strings to string
+///
+/// \param [in] strArr
+/// string * - pointer to array of strings
+/// \param [in] Size
+/// SI_32 - Number of strings
+///
+/// \return string
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string ConvertArrayStringsToString(std::string *strArr, SI_32 Size);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ConvertArrayStringsToString
+/// Function to convert string to array of strings
+///
+/// \param [in] Input
+/// string - string contains array of strings
+/// \param [out] strArr
+/// string * - Pointer to Array of strings
+/// \param [out] ArraySize
+/// UI_32 - No of elements in Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void ConvertStringToArrString(std::string Input, std::string *strArr, UI_32 &ArraySize); // NOLINT (readability/nolint)
+
+///////////////////////////////////////////////////////////////////////////
+/// class: C_CWORD77_DataPool
+/// Description: This is interface class to _CWORD77_ Data base.
+/// It provides APIs to set and get data from _CWORD77_ Data base
+///
+////////////////////////////////////////////////////////////////////////////
+class C_CWORD77_DataPool {
+ private:
+ std::map<UI_32, _CWORD77_Data> m__CWORD77_DataRequestTable; ///< Request Data Table
+ std::map<UI_32, _CWORD77_Data> m__CWORD77_DataResponseTable; ///< Response Data Table
+
+ static C_CWORD77_DataPool *m_p_CWORD77_DataPoolInstance; ///< Static instance to C_CWORD77_DataPool
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetData
+ /// Templatized Function to get data from _CWORD77_ Data base
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// string - Variable Name or key value
+ /// \param [out] Array
+ /// T * - Pointer to an array of given type
+ /// \param [out] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ template<class T>
+ void GetData(ETableType TableType, UI_32 VarName, T *Array, UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ EDataType DataType = SIGNEDINT;
+ std::string DataValue;
+ GetValueFromMap(TableType, VarName, DataType, DataValue);
+ UI_32 Num = NoOfElementsinData(DataValue);
+ std::vector<T> Temp;
+ Temp.resize(Num);
+ ConvertStringToArray<T>(DataValue, Temp, ArraySize);
+ for (unsigned int i = 0; i < Num; i++) {
+ Array[i] = Temp[i];
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetData
+ /// Templatized Function to set data into _CWORD77_ Data base
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// string - Variable Name or key value
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] Array
+ /// T * - Pointer to an array of given type
+ /// \param [in] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void SetData(ETableType TableType, UI_32 VarName, EDataType DataType, T *Array, UI_32 ArraySize) {
+ std::string Result = ConvertArrayToString(Array, ArraySize);
+ SetValueinMap(TableType, VarName, DataType, Result);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetValueFromMap
+ /// Function to get data from _CWORD77_ map
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// string - Variable Name or key value
+ /// \param [out] DataType
+ /// EDataType - Data Type of key
+ /// \param [out] Strvalue
+ /// string - Output in the form of string
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void GetValueFromMap(ETableType TableType, UI_32 VarName, EDataType &DataType, std::string &Strvalue); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetValueinMap
+ /// Function to set data in _CWORD77_ map
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// string - Variable Name or key value
+ /// \param [in] VarType
+ /// EDataType - Data Type of key
+ /// \param [in] Result
+ /// string - input in the form of string
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetValueinMap(ETableType TableType, UI_32 VarName, EDataType VarType, std::string Result);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetArrayStringData
+ /// Function to set string data in _CWORD77_ map
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// string - Variable Name or key value
+ /// \param [in] VarType
+ /// EDataType - Data Type of key
+ /// \param [in] DataValue
+ /// string [] - Array of strings
+ /// \param [in] Size
+ /// UI_32 - No of elements in Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetArrayStringData(ETableType TableType,
+ UI_32 VarName,
+ EDataType VarType,
+ std::string DataValue[],
+ UI_32 size);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetArrayStringData
+ /// Function to get string data in _CWORD77_ map
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [out] DataValue
+ /// string [] - Array of strings
+ /// \param [out] Size
+ /// UI_32 - No of elements in Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void GetArrayStringData(ETableType TableType, UI_32 VarName, std::string DataValue[], UI_32 &size); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNoofElementsofData
+ /// Function to get Number of elements in data item
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// UI_32 - key
+
+ ///
+ /// \return UI_32 - Number of elements
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetNoofElementsofData(ETableType TableType, UI_32 Key);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDataType
+ /// Function to get data type of given key Name
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// UI_32 - key
+
+ ///
+ /// \return EDataType - Data type of variable
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ EDataType GetDataType(ETableType TableType, UI_32 Key);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// C_CWORD77_DataPool
+ /// Constructor for C_CWORD77_DataPool
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ C_CWORD77_DataPool();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~C_CWORD77_DataPool
+ /// Destructor for C_CWORD77_DataPool
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ ~C_CWORD77_DataPool();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetInstance
+ /// API to get single instance of C_CWORD77_DataPool
+ /// \param None
+ /// \return Pointer to single instance of C_CWORD77_Controller
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static C_CWORD77_DataPool *GetInstance();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// DeleteInstance
+ /// API to delete single instance of C_CWORD77_DataPool
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static void DeleteInstance();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestArrayData
+ /// Templatized Function to set array data into Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] Array
+ /// T * - Pointer to an array of given type
+ /// \param [in] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void SetReqArrayData(UI_32 VarName, EDataType DataType, T *Array, UI_32 ArraySize) {
+ SetData<T>(REQUEST_TABLE, VarName, DataType, Array, ArraySize);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestArrayData
+ /// Templatized Function to set array data into Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] Array
+ /// T * - Pointer to an array of given type
+ /// \param [in] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void SetRespArrayData(UI_32 VarName, EDataType DataType, T *Array, UI_32 ArraySize) {
+ SetData<T>(RESPONSE_TABLE, VarName, DataType, Array, ArraySize);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequestArrayData
+ /// Templatized Function to get array data from Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [out] Array
+ /// T * - Pointer to an array of given type
+ /// \param [out] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void GetReqArrayData(UI_32 VarName, T *Array, UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ GetData<T>(REQUEST_TABLE, VarName, Array, ArraySize);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequestArrayData
+ /// Templatized Function to get array data from Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [out] Array
+ /// T * - Pointer to an array of given type
+ /// \param [out] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void GetRespArrayData(UI_32 VarName, T *Array, UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ GetData<T>(RESPONSE_TABLE, VarName, Array, ArraySize);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestData
+ /// Templatized Function to set data into Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] Array
+ /// T - Data type of key
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void SetReqData(UI_32 VarName, EDataType DataType, T Array) {
+ SetData<T>(REQUEST_TABLE, VarName, DataType, &Array, 1);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestData
+ /// Templatized Function to set data into Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] Array
+ /// T - Data type of key
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void SetRespData(UI_32 VarName, EDataType DataType, T Array) {
+ SetData<T>(RESPONSE_TABLE, VarName, DataType, &Array, 1);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequestData
+ /// Templatized Function to get data from Resquest _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return T - value belong to type T
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ T GetReqData(UI_32 VarName) {
+ T Data;
+ UI_32 ArraySize = 0;
+ GetData<T>(REQUEST_TABLE, VarName, &Data, ArraySize);
+ return Data;
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetResponseData
+ /// Templatized Function to get data from Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return T - value belong to type T
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ T GetRespData(UI_32 VarName) {
+ T Data;
+ UI_32 ArraySize = 0;
+ GetData<T>(RESPONSE_TABLE, VarName, &Data, ArraySize);
+ return Data;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestArrayStringData
+ /// API to set array of string data into Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] DataValue
+ /// string [] - array of strings
+ /// \param [in] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ void SetReqArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size) {
+ SetArrayStringData(REQUEST_TABLE, VarName, VarType, DataValue, size);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestArrayStringData
+ /// API to set array of string data into Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] DataValue
+ /// string [] - array of strings
+ /// \param [in] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetRespArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size) {
+ SetArrayStringData(RESPONSE_TABLE, VarName, VarType, DataValue, size);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequestArrayStringData
+ /// API to get array of string data from Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [out] DataValue
+ /// string [] - array of strings
+ /// \param [out] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ void GetReqArrayStringData(UI_32 VarName, std::string DataValue[], UI_32 &size) { // NOLINT (readability/nolint)
+ GetArrayStringData(REQUEST_TABLE, VarName, DataValue, size);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetResponseArrayStringData
+ /// API to get array of string data from Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [out] DataValue
+ /// string [] - array of strings
+ /// \param [out] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void GetRespArrayStringData(UI_32 VarName, std::string DataValue[], UI_32 &size) { // NOLINT (readability/nolint)
+ GetArrayStringData(RESPONSE_TABLE, VarName, DataValue, size);
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestStringData
+ /// API to set string data into Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] DataValue
+ /// string [] - array of strings
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetReqStringData(UI_32 VarName, EDataType VarType, std::string DataValue) {
+ UI_32 size = 1;
+ SetArrayStringData(REQUEST_TABLE, VarName, VarType, &DataValue, size);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetResponseStringData
+ /// API to set string data into Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] DataValue
+ /// string [] - array of strings
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetRespStringData(UI_32 VarName, EDataType VarType, std::string DataValue) {
+ UI_32 size = 1;
+ SetArrayStringData(RESPONSE_TABLE, VarName, VarType, &DataValue, size);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequestStringData
+ /// API to get string data from Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return string - value of data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetReqStringData(UI_32 VarName) {
+ UI_32 size = 0;
+ std::string DataValue = "";
+ GetArrayStringData(REQUEST_TABLE, VarName, &DataValue, size);
+ return DataValue;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNoofElementsFromRequestTable
+ /// API to get No of elements in a key from request data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return UI_32 - No of elements
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetReqDataSize(UI_32 Key) {
+ return GetNoofElementsofData(REQUEST_TABLE, Key);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNoofElementsFromResponseTable
+ /// API to get No of elements in a key from response data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return UI_32 - No of elements
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ UI_32 GetRespDataSize(UI_32 Key) {
+ return GetNoofElementsofData(RESPONSE_TABLE, Key);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDataTypeFromRequestTable
+ /// API to get data type of key from request data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return EDataType - Data type of key
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ EDataType GetReqDataType(UI_32 Key) {
+ return GetDataType(REQUEST_TABLE, Key);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDataTypeFromResponseTable
+ /// API to get data type of key from response data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return EDataType - Data type of key
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EDataType GetRespDataType(UI_32 Key) {
+ return GetDataType(RESPONSE_TABLE, Key);
+ }
+};
+
+extern C_CWORD77_DataPool g__CWORD77_DataPool;
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestArrayData
+/// Templatized Function to set array data into Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] Array
+/// T * - Pointer to an array of given type
+/// \param [in] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void SetRequestArrayData(UI_32 VarName, EDataType DataType, T *Array, UI_32 ArraySize) {
+ g__CWORD77_DataPool.SetReqArrayData(VarName, DataType, Array, ArraySize);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestArrayData
+/// Templatized Function to set array data into Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] Array
+/// T * - Pointer to an array of given type
+/// \param [in] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void SetResponseArrayData(UI_32 VarName, EDataType DataType, T *Array, UI_32 ArraySize) {
+ g__CWORD77_DataPool.SetRespArrayData<T>(VarName, DataType, Array, ArraySize);
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestArrayData
+/// Templatized Function to get array data from Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [out] Array
+/// T * - Pointer to an array of given type
+/// \param [out] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void GetRequestArrayData(UI_32 VarName, T *Array, UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ g__CWORD77_DataPool.GetReqArrayData<T>(VarName, Array, ArraySize);
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestArrayData
+/// Templatized Function to get array data from Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [out] Array
+/// T * - Pointer to an array of given type
+/// \param [out] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void GetResponseArrayData(UI_32 VarName, T *Array, UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ g__CWORD77_DataPool.GetRespArrayData<T>(VarName, Array, ArraySize);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestData
+/// Templatized Function to set data into Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] Array
+/// T - Data type of key
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void SetRequestData(UI_32 VarName, EDataType DataType, T Array) {
+ g__CWORD77_DataPool.SetReqData<T>(VarName, DataType, Array);
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestData
+/// Templatized Function to set data into Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] Array
+/// T - Data type of key
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void SetResponseData(UI_32 VarName, EDataType DataType, T Array) {
+ g__CWORD77_DataPool.SetRespData<T>(VarName, DataType, Array);
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestData
+/// Templatized Function to get data from Resquest _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return T - value belong to type T
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+T GetRequestData(UI_32 VarName) {
+ return g__CWORD77_DataPool.GetReqData<T>(VarName);
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetResponseData
+/// Templatized Function to get data from Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return T - value belong to type T
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+T GetResponseData(UI_32 VarName) {
+ return g__CWORD77_DataPool.GetRespData<T>(VarName);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestArrayStringData
+/// API to set array of string data into Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] DataValue
+/// string [] - array of strings
+/// \param [in] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+
+void SetRequestArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestArrayStringData
+/// API to set array of string data into Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] DataValue
+/// string [] - array of strings
+/// \param [in] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void SetResponseArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestArrayStringData
+/// API to get array of string data from Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [out] DataValue
+/// string [] - array of strings
+/// \param [out] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+
+void GetRequestArrayStringData(UI_32 VarName, std::string DataValue[], UI_32 &size); // NOLINT (readability/nolint)
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetResponseArrayStringData
+/// API to get array of string data from Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [out] DataValue
+/// string [] - array of strings
+/// \param [out] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void GetResponseArrayStringData(UI_32 VarName, std::string DataValue[], UI_32 &size); // NOLINT (readability/nolint)
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestStringData
+/// API to set string data into Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] DataValue
+/// string [] - array of strings
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void SetRequestStringData(UI_32 VarName, EDataType VarType, std::string DataValue);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetResponseStringData
+/// API to set string data into Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] DataValue
+/// string [] - array of strings
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void SetResponseStringData(UI_32 VarName, EDataType VarType, std::string DataValue);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestStringData
+/// API to get string data from Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return string - value of data
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string GetRequestStringData(UI_32 VarName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestDataLength
+/// API to get No of elements in a key from request data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return UI_32 - No of elements
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 GetRequestDataLength(UI_32 Key);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetResponseDataLength
+/// API to get No of elements in a key from response data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return UI_32 - No of elements
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+
+UI_32 GetResponseDataLength(UI_32 Key);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetDataTypeFromRequestTable
+/// API to get data type of key from request data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return EDataType - Data type of key
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+
+EDataType GetRequestDataType(UI_32 Key);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetDataTypeFromResponseTable
+/// API to get data type of key from response data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return EDataType - Data type of key
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EDataType GetResponseDataType(UI_32 Key);
+
+
+
+class C_CWORD77_Data {
+ private:
+ T_CWORD77_DataPool m__CWORD77_RequestDataTable; ///< Request Data Table
+ T_CWORD77_DataPool m__CWORD77_ResponseDataTable; ///< Response Data Table
+
+ // Original data pool
+ // Depricated. Remove once all modules migrates to new API's for accessing data pool
+ std::map< UI_32, std::vector<CHAR> > m__CWORD77_RequestDataTableOrig; ///< Request Data Table
+ std::map< UI_32, std::vector<CHAR> > m__CWORD77_ResponseDataTableOrig; ///< Response Data Table
+
+ static C_CWORD77_Data *m_p_CWORD77_DataInstance; /// instance to C_CWORD77_Data
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// C_CWORD77_Data
+ /// Constructor for C_CWORD77_Data
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ C_CWORD77_Data();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// C_CWORD77_Data
+ /// Destructor for C_CWORD77_Data
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ ~C_CWORD77_Data();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetInstance
+ /// API to get single instance of C_CWORD77_Data
+ /// \param None
+ /// \return Pointer to single instance of C_CWORD77_Data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static C_CWORD77_Data *GetInstance();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// DeleteInstance
+ /// API to delete single instance of C_CWORD77_DataPool
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static void DeleteInstance();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReqDataIn_CWORD77_DataPool
+ /// API to set data associated with request into _CWORD77_ Data Pool
+ ///
+ /// \param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return VOID - None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetRequData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, PVOID f_pData); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReqDataIn_CWORD77_DataPool
+ /// API to set data associated with request into _CWORD77_ Data Pool
+ /// Depricated. Do not use.
+ ///
+ /// \param [in] f_uiMsgId
+ /// UI_32 - MsgId
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return VOID - None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetRequData(UI_32 f_uiMsgId, UI_32 f_uiSize, PVOID f_pData);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRespDataIn_CWORD77_DataPool
+ /// API to set data associated with response into _CWORD77_ Data Pool
+ ///
+ /// \param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return VOID - None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetRespoData(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 f_uiSize, const PVOID f_pData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRespDataIn_CWORD77_DataPool
+ /// API to set data associated with response into _CWORD77_ Data Pool
+ /// Depricated. Do not use.
+ ///
+ /// \param [in] f_uiMsgId
+ /// UI_32 - MsgId
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return VOID - None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetRespoData(UI_32 f_uiMsgId, UI_32 f_uiSize, const PVOID f_pData); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetReqDataIn_CWORD77_DataPool
+ /// API to get data associated with request from _CWORD77_ Data Pool
+ ///
+ /// \param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return EFrameworkunifiedStatus - Succes or Error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetRequData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetReqDataIn_CWORD77_DataPool
+ /// API to get data associated with request from _CWORD77_ Data Pool
+ /// Depricated. Do not use.
+ ///
+ /// \param [in] f_uiMsgId
+ /// UI_32 - MsgId
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return EFrameworkunifiedStatus - Succes or Error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetRequData(UI_32 f_uiMsgId, UI_32 &f_uiSize, PVOID &f_pData); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRespDataFrom_CWORD77_DataPool
+ /// API to get data associated with response from _CWORD77_ Data Pool
+ ///
+ /// \param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return EFrameworkunifiedStatus - Succes or Error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetRespoData(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRespDataFrom_CWORD77_DataPool
+ /// API to get data associated with response from _CWORD77_ Data Pool
+ /// Depricated. Do not use.
+ ///
+ /// \param [in] f_uiMsgId
+ /// UI_32 - MsgId
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return EFrameworkunifiedStatus - Succes or Error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetRespoData(UI_32 f_uiMsgId, UI_32 &f_uiSize, PVOID &f_pData); // NOLINT (readability/nolint)
+};
+
+#endif /* _CWORD77__DATA_POOL_TABLE_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns__CWORD77__notifications.h b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__notifications.h
new file mode 100755
index 0000000..5d7e399
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__notifications.h
@@ -0,0 +1,53 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns__CWORD77__notifications.h
+ * @brief \~english This file defines _CWORD77_ Service Availability Notification.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef NS__CWORD77__NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define NS__CWORD77__NOTIFICATIONS_H_
+
+#define NTFY_REG__CWORD77__Available "_CWORD77_/Available" ///< _CWORD77_ Service Availability Notification
+
+#endif /* NS__CWORD77__NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns__CWORD77__types.h b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__types.h
new file mode 100755
index 0000000..ae6ce83
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns__CWORD77__types.h
@@ -0,0 +1,68 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file
+ * @brief \~english This file contains enum of PE_CWORD77_ResponseType
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _NS__CWORD77__TYPES_H_ // NOLINT (build/header_guard)
+#define _NS__CWORD77__TYPES_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <sstream>
+#include <utility>
+#include <string>
+// using namespace std;
+
+typedef enum _E_CWORD77_ResponseType {
+ RESPONSE = 0,
+ NOTIFICATION,
+ EVENT
+} E_CWORD77_ResponseType, *PE_CWORD77_ResponseType;
+
+// Pair to uniquely identify protocol commands and notifications for different services
+// pair of protocol id and service name in case of protocol interfaces
+// pair of 0 and notification name in case of notifications, as notification name will always be unique
+typedef std::pair<UI_32, std::string> _CWORD77_DataPoolKey;
+
+#endif /* _NS__CWORD77__TYPES_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_buildversioncheck.hpp b/nsframework/framework_unified/client/include/native_service/ns_buildversioncheck.hpp
new file mode 100755
index 0000000..d7f702c
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_buildversioncheck.hpp
@@ -0,0 +1,227 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_buildversioncheck.hpp
+ * @brief \~english Provide the APIs to check/get version
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_UTILITY_BUILDVERSIONCHECK_LIBRARY_INCLUDE_NATIVE_SERVICE_NS_BUILDVERSIONCHECK_HPP_ // NOLINT (build/header_guard)
+#define FRAMEWORK_UNIFIED_CLIENT_NS_UTILITY_BUILDVERSIONCHECK_LIBRARY_INCLUDE_NATIVE_SERVICE_NS_BUILDVERSIONCHECK_HPP_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+/**
+ * \~english the namespace frameworkunified
+ */
+namespace frameworkunified {
+/**
+ * \~english the namespace ns
+ */
+namespace ns {
+/**
+ * \~english the namespace utility
+ */
+namespace utility {
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_BuildVersionCheck
+/// \~english @par Brief
+/// Check whether the input param build_version is matched or not.
+/// \~english @param [in] build_version
+/// PCSTR - The version to be checked
+/// \~english @retval TRUE: match; FALSE: does not match
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// If the input param version string build_version is empty, the function returns FALSE. \n
+/// If the input param version string build_version is equal to the environment build version \n
+/// and library build version, the function returns TRUE.
+/// \~english @see getEnvironmentBuildVersion getLibraryBuildVersion
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL buildVersionsMatch(PCSTR build_version); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_BuildVersionCheck
+/// \~english @par Brief
+/// Get the build version from environment variable.
+/// \~english @retval the build version string
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The funcion returns the value of the system environment variable "BUILD_VERSION". If \n
+/// the environment variable does not exist, the function returns "".
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR getEnvironmentBuildVersion(); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_BuildVersionCheck
+/// \~english @par Brief
+/// Get the library build version string
+/// \~english @retval the library buidling version string
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the string as macro _BUILD_VERSION.
+/// \~english @see _BUILD_VERSION
+////////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR getLibraryBuildVersion(); // NOLINT (readability/nolint)
+
+/**
+ * \~english the namespace utility_private
+ */
+namespace utility_private {
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_BuildVersionCheck
+/// \~english @par Brief
+/// Check whether the input param is empty or not.
+/// \~english @param [in] build_version
+/// PCSTR - the build version
+/// \~english @retval the input param build_version or "<Not defined>"
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// If the input param build_version is not empty, the function returns build_version, \n
+/// or the function returns "<Not defined>".
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR niceBuildVersion(PCSTR build_version); // NOLINT (readability/nolint)
+
+/**
+ * \~english the end of namespace utility_private
+ */
+}
+/**
+ * \~english the end of namespace utility
+ */
+}
+/**
+ * \~english the end of namespace ns
+ */
+}
+/**
+ * \~english the end of namespace frameworkunified
+ */
+}
+
+/**
+ * \~english define the macro _BUILD_VERSION
+ */
+#ifndef BUILD_VERSION
+#define _BUILD_VERSION ""
+#else
+#define QUOTE( ___str___ ) #___str___
+#define EXPAND_AND_QUOTE( ___str___ ) QUOTE( ___str___ )
+#define _BUILD_VERSION EXPAND_AND_QUOTE( BUILD_VERSION )
+#endif
+
+/**
+ * \~english define the macro WARNING_STRING to print the warning
+ */
+#define WARNING_STRING "\n\
+!!! WARNING - Build Versions do not match !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\
+project build: %s\n\
+library build: %s\n\
+environment build: %s\n\
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+
+/**
+ * \~english define the macro _BUILD_VERSION
+ */
+#if defined STDOUT_LOGGING
+#include <cstdio>
+#define BUILDVERSIONLOG( ___log_string___, ...) std::printf( ___log_string___ "\n", __VA_ARGS__)
+#define BUILDVERSION_NULL_STATEMENT (0)
+#elif defined NO_LOGGING
+#define BUILDVERSIONLOG(...) ((void)0)
+#define BUILDVERSION_NULL_STATEMENT ((void)0)
+#else
+#include <native_service/ns_logger_if.h>
+#define BUILDVERSIONLOG( ___log_string___, ...) TEXT( __PRETTY_FUNCTION__, ___log_string___, __VA_ARGS__)
+/**
+ * \~english define the macro BUILDVERSION_NULL_STATEMENT
+ */
+#define BUILDVERSION_NULL_STATEMENT ((void)0)
+#endif
+
+/**
+ * \~english define the macro CHECK_BUILD_VERSION to check the version
+ */
+#define CHECK_BUILD_VERSION() \
+ (!framework_unified::ns::utility::buildVersionsMatch( _BUILD_VERSION )) ? \
+ BUILDVERSIONLOG( WARNING_STRING, \
+ framework_unified::ns::utility::utility_private::niceBuildVersion( _BUILD_VERSION ), \
+ framework_unified::ns::utility::utility_private::niceBuildVersion( framework_unified::ns::utility::getLibraryBuildVersion() ), \
+ framework_unified::ns::utility::utility_private::niceBuildVersion( framework_unified::ns::utility::getEnvironmentBuildVersion() ) ) :\
+ BUILDVERSION_NULL_STATEMENT
+
+/** @}*/ // end of framework_unified
+
+/** @}*/ // end of native_service
+
+/** @}*/ // end of BaseSystem
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_UTILITY_BUILDVERSIONCHECK_LIBRARY_INCLUDE_NATIVE_SERVICE_NS_BUILDVERSIONCHECK_HPP_ // NOLINT (build/header_guard)
diff --git a/nsframework/framework_unified/client/include/native_service/ns_config_parser_if.h b/nsframework/framework_unified/client/include/native_service/ns_config_parser_if.h
new file mode 100755
index 0000000..b40c01e
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_config_parser_if.h
@@ -0,0 +1,1038 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_config_parser_if.h
+ * @brief \~english This file contains declaration of class CNSConfigReader, CNSConfigWriter and CNSConfigParser. -- API
+ * define head file
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup Native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef NS_NATIVESERVICES_INC_NATIVE_NS_CONFIG_PARSER_IF_H_ // NOLINT (build/header_guard)
+#define NS_NATIVESERVICES_INC_NATIVE_NS_CONFIG_PARSER_IF_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+// forward declaration of classes
+class IConfigReader;
+class IConfigWriter;
+
+/**
+ * @class CNSConfigReader
+ * @brief \~english Configuration File Read Service Class
+ * @par \~english Brief Introduction
+ * \~english This class provides API's to application to read from configuration files.
+ *
+ */
+class CNSConfigReader {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigReader
+ /// \~english @par Brief
+ /// Constructor of CNSConfigReader class
+ /// This constructor can only be called by derived class. Application cannot use this constructor
+ /// to create object of CNSConfigReader class.
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It is called when generating the instance of CNSConfigParser class.
+ /// \~english @see CNSConfigReader::~CNSConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSConfigReader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigReader
+ /// \~english @par Brief
+ /// Constructor of CNSConfigReader class
+ /// This is depricated. Use parameterless constructor instead to create object and
+ /// Parse(filepath) to parse the file using reader object.
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Name of the configuration file
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It doesn't need to call Parse() function to execute parse process of configuration file,
+ /// when using the constructor with file path. However, because we don't execute error process,
+ /// if it needs to reply error about parse process, we must to use the constructor without parameter
+ /// and call Parse() function.
+ /// \~english @see CNSConfigReader::~CNSConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CNSConfigReader(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Parse
+ /// \~english @par Brief
+ /// This function is used to parse configuration file
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Name of the configuration file
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - if memory allocation failed or document is not proper
+ /// \~english @retval eFrameworkunifiedStatusFail - invalid file type
+ /// \~english @retval eFrameworkunifiedStatusInvldParam invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusErrOther - file data error
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File(f_c_filepath) designated by parameter is not proper [eFrameworkunifiedStatusNullPointer]
+ /// - Data of file(f_c_filepath) designated by parameter is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Expansion name of file(f_c_filepath) designated by parameter is not cfg [eFrameworkunifiedStatusFail]
+ /// - Failed to open file(f_c_filepath) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Path of file designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Data of file designated by parameter has error [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parse designated configuration file. If the data format is correct, get memory to store the parsed result,
+ /// and store the parsed contents in it.
+ /// \~english @see CNSConfigWriter::Parse, CNSConfigParser::Parse
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Parse(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CNSConfigReader
+ /// \~english @par Brief
+ /// Destructor of CNSConfigReader class.
+ /// It is used when release the instance.
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Release the used memory and the parsed result of configuration file.
+ /// \~english @see CNSConfigReader::CNSConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSConfigReader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetBool
+ /// \~english @par Brief
+ /// This function is used to get the bool value associated with key.
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// This API has been depricated, use GetBool(key, ref_value)
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @retval TRUE - value associated with key
+ /// \~english @retval FALSE - Failed to get value associated with key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [FALSE]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [FALSE]
+ /// - Can not find search key(f_c_key) designated by parameter [FALSE]
+ /// - Value getted from configuration file is not true or false [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(TRUE/FALSE) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// This API has been depricated, please use GetBool(const std::string& f_c_key, BOOL& f_bValue).
+ /// \~english @see CNSConfigWriter::SetBool
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL GetBool(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetDouble
+ /// \~english @par Brief
+ /// This function is used to get the double value associated with key.
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// This API has been depricated, use GetDouble(key, ref_value)
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @param [out] - none
+ /// \~english @retval F_64 - value associated with key
+ /// \~english @retval 0 - Failed to get value associated with key(64bit)
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [0]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [0]
+ /// - Can not find search key(f_c_key) designated by parameter [0]
+ /// - Failed to change data getted from configuration file from string type to double type [0]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - We can take the value in specification only if it is in the range of
+ /// [1.17549435082228750797e-38F, 3.40282346638528859812e+38F](min value of double, max value of double).
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(64bit) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// This API has been depricated, please use GetDouble(const std::string& f_c_key, F_64& f_f_value).
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ F_64 GetDouble(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetFloat
+ /// \~english @par Brief
+ /// This function is used to get the float value associated with key
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// This API has been depricated, use GetFloat(key, ref_value)
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @retval F_32 value associated with key
+ /// \~english @retval 0 - Failed to get value associated with key(32bit)
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [0]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [0]
+ /// - Can not find search key(f_c_key) designated by parameter [0]
+ /// - Can not change the data string, because that data string getted
+ /// from configuration file is over range [9.8765436e+12]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(32bit) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// This API has been depricated, please use GetFloat(const std::string& f_c_key, F_32& f_f_value).
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ F_32 GetFloat(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetInt
+ /// \~english @par Brief
+ /// This function is used to get the integer value associated with key
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// This API has been depricated, use GetInt(key, ref_value)
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @retval SI_32 - value associated with key
+ /// \~english @retval 0.0f - Failed to get value associated with key(32bit)
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [0]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [0]
+ /// - Can not find search key(f_c_key) designated by parameter [0]
+ /// - Failed to change data getted from Configuration file from string type to Int type [0]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(32bit) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// This API has been depricated, please use GetInt(const std::string& f_c_key, SI_32& f_si_value).
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - If data string getted from file is larger than INT_MAX(2147483648), return -1.
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetInt(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetString
+ /// \~english @par Brief
+ /// This function is used to get the string value associated with key
+ /// If there are multiple values associated with the same key, all the values separated by
+ /// delimiter "\n" are returned.
+ /// This API has been depricated, use GetString(key, ref_value)
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @retval std::string value(string) associated with key
+ /// \~english @retval nullbuffer - Failed to get value associated with key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [null buffer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [null buffer]
+ /// - Can not find search key(f_c_key) designated by parameter [null buffer]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(string) associated with key.
+ /// If there are multiple values associated with the same key,
+ /// return all the values separated by delimiter "\n".
+ /// This API has been depricated, please use GetString(
+ /// const std::string& f_c_key, std::string& f_cValue).
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetString(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetBool
+ /// \~english @par Brief
+ /// This function is used to get the bool value associated with key
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key string
+ /// \~english @param [in] f_b_value
+ /// BOOL& - value associated with key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @retval eFrameworkunifiedStatusErrOther - value is not bool type
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Value getted from configuration file is not true or false [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(TRUE/FALSE) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// \~english @see CNSConfigWriter::SetBool
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetBool(const std::string &f_c_key, BOOL &f_b_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetDouble
+ /// \~english @par Brief
+ /// This function is used to get the double value associated with key.
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @param [in] f_f_value
+ /// F_64& - value associated with key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @retval eFrameworkunifiedStatusInvldBuf - change error
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Changed result of data string getted from configuration file is overflow or underflow [eFrameworkunifiedStatusInvldBuf]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - Return eFrameworkunifiedStatusOK if we didn't excute the changing operation
+ /// - We can take the value in specification only if it is in the range of
+ /// [1.17549435082228750797e-38F, 3.40282346638528859812e+38F](min value of double, max value of double).
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(64bit) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetDouble(const std::string &f_c_key, F_64 &f_f_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetFloat
+ /// \~english @par Brief
+ /// This function is used to get the float value associated with key
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @param [in] f_f_value
+ /// F_32& - value associated with key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @retval eFrameworkunifiedStatusInvldBuf - change error
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Can not change the data string, because that data string getted
+ /// from configuration file is over range [9.8765436e+12]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(32bit) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetFloat(const std::string &f_c_key, F_32 &f_f_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetInt
+ /// \~english @par Brief
+ /// This function is used to get the integer value associated with key
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @param [out] f_si_value
+ /// SI_32& - value associated with key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @retval eFrameworkunifiedStatusInvldBuf - change error
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Failed to change data getted from Configuration file from string type to Int type [eFrameworkunifiedStatusInvldBuf]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(32bit) associated with key.
+ /// If there are multiple values associated with the same key, return all the values separated by delimiter "\n".
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetInt(const std::string &f_c_key, SI_32 &f_si_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetString
+ /// \~english @par Brief
+ /// This function is used to get the string value associated with key
+ /// If there are multiple values associated with the same key, all the values separated by
+ /// delimiter "\n" are returned.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @param [in] f_c_value
+ /// std::string& - value(string) associated with key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(string) associated with key.
+ /// If there are multiple values associated with the same key,
+ /// return all the values separated by delimiter "\n".
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetString(const std::string &f_c_key, std::string &f_c_value); // NOLINT (readability/nolint)
+
+ protected:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDataPtr
+ /// This function is used to get the data pointer. This pointer is then set in config writer.
+ /// This is needed to avoid recreation of same data structure object in both reader and writer
+ /// when we create object of NSConfigParser.
+ ///
+ /// \return PVOID - pointer of data structure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PVOID GetDataPtr();
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FormatValue
+ /// This function is used to remove the line feed or carriage return from string
+ ///
+ /// \param [in] f_cValue
+ /// std::string - value
+ ///
+ /// \return std::string - formated data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string FormatValue(const std::string &f_c_value);
+
+ // config reader pointer
+ IConfigReader *m_pReader;
+ static HANDLE m_hNSXMLLibHandle; // NOLINT (readability/nolint)
+};
+
+
+/**
+ * @class CNSConfigWriter
+ * @brief \~english File Write Service Class
+ * @par \~english Brief Introduction
+ * \~english This class provides API's to application to write to configuration files.
+ *
+ */
+class CNSConfigWriter {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigWriter
+ /// \~english @par Brief
+ /// Constructor of CNSConfigWriter class
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It is called when generating the instance of CNSConfigWriter class.
+ /// \~english @see CNSConfigWriter::~CNSConfigWriter
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSConfigWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigWriter
+ /// \~english @par Brief
+ /// Constructor of CNSConfigWriter class
+ /// This is depricated. Use parameterless constructor instead to create object and
+ /// Parse(filepath) to parse the file using writer object.
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Full path of the configuration file
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It doesn't need to call Parse() function to execute parse process of configuration File,
+ /// when using the constructor with file path. However, because we don't execute error process,
+ /// if it needs to reply error about parse process, we must to use the constructor without parameter
+ /// and call Parse() function.
+ /// \~english @see CNSConfigWriter::~CNSConfigWriter
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CNSConfigWriter(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CNSConfigWriter
+ /// \~english @par Brief
+ /// Destructor of CNSConfigWriter class
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Release the used memory and the parsed result of Configuration File.
+ /// \~english @see CNSConfigWriter::CNSConfigWriter
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSConfigWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Parse
+ /// \~english @par Brief
+ /// This function is used to parse the configuration file
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Name of the configuration file
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - if memory allocation failed or document not proper
+ /// \~english @retval eFrameworkunifiedStatusFail - invalid file type
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusErrOther - file data error
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File(f_c_filepath) designated by parameter is not proper [eFrameworkunifiedStatusNullPointer]
+ /// - Data of file(f_c_filepath) designated by parameter is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Expansion name of file(f_c_filepath) designated by parameter is not cfg [eFrameworkunifiedStatusFail]
+ /// - Failed to open file(f_c_filepath) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Path of file designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Data of file designated by parameter has error [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parse designated configuration file. If the data format is correct, get memory to store the parsed result,
+ /// and store the parsed contents in it.
+ /// \~english @see CNSConfigParser::Parse, CNSConfigWriter::Parse
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Parse(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Save
+ /// \~english @par Brief
+ /// This function is used to save the configuration settings to config file
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusFail - file access fail
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - File doesn't exit [eFrameworkunifiedStatusFail]
+ /// - File access error [eFrameworkunifiedStatusFail]
+ /// - Can't open file [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Save the data stored in memory to configuration file.
+ /// \~english @see CNSConfigWriter::SetBool, CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Save();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetBool
+ /// \~english @par Brief
+ /// This function is used to set the bool value corresponding to key
+ /// This function is not overloaded with other Set() API's of this class because
+ /// BOOL is typedef of UI_32 so when we pass integer or BOOL to Set API it would have
+ /// called the same API.
+ /// If multiple identical keys are found it sets the value for all the keys.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key
+ /// \~english @param [in] f_b_value
+ /// BOOL - bool value to set for key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @retval eFrameworkunifiedStatusErrOther - if passsed value is invalid
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Data(f_bValue) of search key designated by parameter is not bool [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - Valid condition of search key string: there is no separator and line feed in config tag
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the value(bool type) associated with key to data stored in memory.
+ /// If there are multiple keys, set the values associated with all keys.
+ /// \~english @see CNSConfigReader::GetBool
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetBool(const std::string &f_c_key, BOOL f_b_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Set
+ /// \~english @par Brief
+ /// This function is used to set the double value corresponding to key.
+ /// If multiple identical keys are found it sets the value for all the keys.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key
+ /// \~english @param [in] f_f_value
+ /// F_64 - double value to set for key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - We can take the value in specification only if it is in the range of
+ /// [2.22507385850720138309e-308L, 1.7976931348623157e+308L](min value of double, max value of double).
+ /// - Valid condition of search key string: there is no separator and line feed in config tag
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the bool type value(64bit) associated with key to data stored in memory.
+ /// If there are multiple keys, set the values associated with all keys.
+ /// \~english @see CNSConfigReader::GetDouble
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Set(const std::string &f_c_key, F_64 f_f_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Set
+ /// \~english @par Brief
+ /// This function is used to set the float value corresponding to key.
+ /// If multiple identical keys are found it sets the value for all the keys.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key
+ /// \~english @param [in] f_f_value
+ /// F_32 - float value to set for key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - We can take the value in specification only if it is in the range of
+ /// [1.17549435082228750797e-38F, 3.40282346638528859812e+38F](min value of double, max value of double).
+ /// - Valid condition of search key string: there is no separator and line feed in config tag
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the float type value(32bit) associated with key to data stored in memory.
+ /// If there are multiple keys, set the values associated with all keys.
+ /// \~english @see CNSConfigReader::GetFloat
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Set(const std::string &f_c_key, F_32 f_f_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Set
+ /// \~english @par Brief
+ /// This function is used to set the integer value corresponding to key.
+ /// If multiple identical keys are found it sets the value for all the keys.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key
+ /// \~english @param [in] f_si_value
+ /// SI_32 - integer value to set for key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - Valid condition of search key string: there is no separator and line feed in config tag
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the int type value(32bit) associated with key to data stored in memory.
+ /// If there are multiple keys, set the values associated with all keys.
+ /// \~english @see CNSConfigReader::GetInt
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Set(const std::string &f_c_key, SI_32 f_si_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Set
+ /// \~english @par Brief
+ /// This function is used to set the string value corresponding to key.
+ /// If multiple identical keys are found it sets the value for all the keys.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key
+ /// \~english @param [in] f_s_value
+ /// const std::string& - string value to set for key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - Valid condition of search key string: there is no separator and line feed in config tag
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the string type value associated with key to data stored in memory.
+ /// If there are multiple keys, set the values associated with all keys.
+ /// \~english @see CNSConfigReader::GetString
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Set(const std::string &f_c_key, const std::string &f_s_value);
+
+ protected:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSConfigWriter
+ /// Constructor of CNSConfigWriter class
+ ///
+ /// \param [in] f_c_filepath
+ /// const std::string& - Full path of the configuration file
+ /// \param [in] f_b_noload
+ /// BOOL - load writer with no data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSConfigWriter(const std::string &f_c_filepath, BOOL f_b_noload);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDataPtr
+ /// This function is used to set the data pointer in writer class with data pointer
+ /// created in config reader class.
+ /// This is needed to avoid recreation of same data structure object in both reader and writer
+ /// when we create object of NSConfigParser
+ ///
+ /// \param [in] f_p_data
+ /// PVOID - Pointer to data structure
+ ///
+ /// \return VOID
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetDataPtr(PVOID f_p_data);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Create
+ /// This function is used to create config object
+ ///
+ /// \param [in] f_c_filepath
+ /// const std::string& - Name of the configuration file
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Create(const std::string &f_c_filepath);
+
+ private:
+ // config writer pointer
+ IConfigWriter *m_pWriter;
+ static HANDLE m_hNSXMLLibHandle; // NOLINT (readability/nolint)
+};
+
+
+/**
+ * @class CNSConfigParser
+ * @brief \~english File both Reade and Write Service Class
+ * @par \~english Brief Introduction
+ * \~english This class provides API's to application for both reading and writing into configuration files.
+ *
+ */
+class CNSConfigParser: public CNSConfigReader, public CNSConfigWriter {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigParser
+ /// \~english @par Brief
+ /// Constructor of CNSConfigParser class
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It is called when generating the instance of CNSConfigParser class.
+ /// \~english @see CNSConfigParser::~CNSConfigParser
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSConfigParser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigParser
+ /// \~english @par Brief
+ /// Constructor of CNSConfigParser class
+ /// This is depricated. Use parameterless constructor instead to create object and
+ /// Parse(filepath) to parse the file using parser object.
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Full path of the configuration file
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It doesn't need to call Parse() function to execute parse process of configuration File,
+ /// when using the constructor with file path. However, because we don't execute error process,
+ /// if it needs to reply error about parse process, we must to use the constructor without parameter
+ /// and call Parse() function.
+ /// \~english @see CNSConfigParser::~CNSConfigParser
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CNSConfigParser(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CNSConfigParser
+ /// \~english @par Brief
+ /// Destructor of CNSConfigParser class
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigParser
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Release the used memory and the parsed result of Configuration File.
+ /// \~english @see CNSConfigParser::CNSConfigParser
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSConfigParser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Parse
+ /// \~english @par Brief
+ /// This function is used to create config reader object and config writer object
+ /// which then parses the configuration file.
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Name of the configuration file
+ /// \~english @retval eFrameworkunifiedStatusOK on success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - if memory allocation failed or document not proper
+ /// \~english @retval eFrameworkunifiedStatusFail - invalid file type
+ /// \~english @retval eFrameworkunifiedStatusInvldParam invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusErrOther file data error
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigParser
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File(f_c_filepath) designated by parameter is not proper [eFrameworkunifiedStatusNullPointer]
+ /// - Data of file(f_c_filepath) designated by parameter is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Expansion name of file(f_c_filepath) designated by parameter is not cfg [eFrameworkunifiedStatusFail]
+ /// - Failed to open file(f_c_filepath) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Path of file designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Data of file designated by parameter has error [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parse designated configuration file. If the data format is correct, get memory to store the parsed result,
+ /// and store the parsed contents in it.
+ /// \~english @see CNSConfigReader::Parse, CNSConfigWriter::Parse
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Parse(const std::string &f_c_filepath);
+};
+
+#endif // NS_NATIVESERVICES_INC_NATIVE_NS_CONFIG_PARSER_IF_H_ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_endianess.h b/nsframework/framework_unified/client/include/native_service/ns_endianess.h
new file mode 100755
index 0000000..33fa858
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_endianess.h
@@ -0,0 +1,192 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_endianess.h
+ * @brief \~english Provide api for convert value
+ */
+
+#ifndef NS_NATIVESERVICES_INC_UTILITY_NS_ENDIANESS_H_ // NOLINT (build/header_guard)
+#define NS_NATIVESERVICES_INC_UTILITY_NS_ENDIANESS_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup utility
+ * @ingroup framework_unified
+ * @{
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the UI_16(unsigned 16bit) value to big-endian.
+/// \~english @param [in] f_value
+/// UI_16 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function converts the UI_16(unsigned 16bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+UI_16 ConvertEndian_UI16(UI_16 f_value); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the SI_16(signed 16bit) value to big-endian.
+/// \~english @param [in] f_value
+/// SI_16 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function converts the SI_16(signed 16bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 ConvertEndian_SI16(SI_16 f_value); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the UI_32(unsigned 32bit) value to big-endian.
+/// \~english @param [in] f_value
+/// UI_32 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function convers the UI_32(unsigned 32bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 ConvertEndian_UI32(UI_32 f_value); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the SI_32(signed 32bit) value to big-endian.
+/// \~english @param [in] f_value
+/// SI_32 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function convers the SI_32(signed 32bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 ConvertEndian_SI32(SI_32 f_value); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the UI_64(unsigned 64bit) value to big-endian.
+/// \~english @param [in] f_value
+/// UI_64 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function convers the UI_64(unsigned 64bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+UI_64 ConvertEndian_UI64(UI_64 f_value); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the SI_64(signed 64bit) value to big-endian.
+/// \~english @param [in] f_value
+/// SI_64 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function convers the SI_64(signed 64bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_64 ConvertEndian_SI64(SI_64 f_value); // NOLINT (readability/nolint)
+
+#endif // NS_NATIVESERVICES_INC_UTILITY_NS_ENDIANESS_H_ // NOLINT (build/header_guard)
+
+/** @}*/ // end of utility
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/ns_eventlogger.h b/nsframework/framework_unified/client/include/native_service/ns_eventlogger.h
new file mode 100755
index 0000000..ab96e11
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_eventlogger.h
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief structures used by ns_logger.cpp for event and counter logging
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ * @brief \~english structures used by ns_logger.cpp for event and counter logging
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup Native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_EVENTLOGGER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_EVENTLOGGER_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// event log messageQ name
+#define EVENTLOG_MSGQ_NAME "/EvntLogQue"
+
+typedef enum _Datatype_ {
+ COMMON,
+ EVENT_SPECIFIC
+} Datatype;
+
+typedef enum _SystemPhase_ {
+ STARTUP = 0x21,
+ NORMAL = 0x22,
+ SHUTDOWN = 0x23,
+} SystemPhase;
+
+typedef enum _NStoSS_LOGGERSERVICEPROTOCOL {
+ SS_MSG_EVTLOG = 6463, // NS to Event Logger Thread
+ SS_MSG_LOGGERCNT, // NS to Event logger Thread
+ SS_MSG_LOGGER_CNT_EVTLOG // NS to event logger thread
+} NStoSS_loggerserviceprotocol;
+
+// Note: Don't remove #paragma pack(1) this is required for the
+// ARM processor, forces data structures to be on a byte boundary
+// all messages should be place in between #pragma pack(1) and #pragma pack()
+#pragma pack(1)
+typedef struct _stLogEvent_ {
+ UI_32 ts;
+ UI_8 grp_ID;
+ UI_8 event_id;
+ UI_8 data[4];
+ SystemPhase phase;
+ UI_16 cnt_ID;
+ Datatype typeofdata;
+} st_LogEvent;
+#pragma pack(0)
+
+#pragma pack(1)
+typedef struct _stLogCount_ {
+ SystemPhase phase;
+ UI_16 cnt_id;
+} st_LogCount;
+#pragma pack(0)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NATIVESERVICES_EVENTLOGGER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_logger_if.h b/nsframework/framework_unified/client/include/native_service/ns_logger_if.h
new file mode 100755
index 0000000..a1ca9ef
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_logger_if.h
@@ -0,0 +1,1646 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file
+/// Declares the external APIs to Logger.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ * @brief \~english Declares the external APIs to Logger.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup Native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_LOGGER_IF_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_LOGGER_IF_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FRAMEWORKUNIFIEDLOG_MSGQ_NAME "/NSLog"
+#define FRAMEWORKUNIFIEDLOG_SHAREDMEM_NAME "/frameworkunified_debug.log.1"
+#define FRAMEWORKUNIFIEDLOG_SHAREDMEM_SIZE 5242880 // 5MB
+
+#define MASTER_ZONE_COUNT 16U
+
+#include <native_service/loglibrarylog_if.h>
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief typedef of ZONE
+///////////////////////////////////////////////////////////////////////////////
+typedef UI_32 TFrameworkunifiedZone;
+// Note: if the BITS_IN_TZONE macro is getting modified do the corresponding changes
+// in GET_ZONE_INDEX and GET_ZONE_BIT_MASK
+#define BITS_IN_BYTE (8U)
+#define BITS_IN_TZONE ((UI_32 )(sizeof( TFrameworkunifiedZone ) * BITS_IN_BYTE))
+#define TZONE_COUNT ((UI_32)MASTER_ZONE_COUNT)
+#define BITS_IN_ZONE_MASK ((UI_32)(BITS_IN_TZONE * TZONE_COUNT))
+#define DEBUG_ZONE_COUNT BITS_IN_ZONE_MASK
+
+#define ZONE_MASK_ARRAY_ELTS ((UI_32)TZONE_COUNT)
+
+#define USER_ZONES_COUNT BITS_IN_ZONE_MASK -10
+
+#define ZONE_TEXT_SIZE 24
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief Array of mask options
+///////////////////////////////////////////////////////////////////////////////
+typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
+
+typedef enum _TFrameworkunifiedLoggerSeverity {
+ FRAMEWORKUNIFIED_SEVERITY_LOW = 0x0, /// <all enable(default)
+ FRAMEWORKUNIFIED_SEVERITY_DEBUG2, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
+ FRAMEWORKUNIFIED_SEVERITY_DEBUG1, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
+ FRAMEWORKUNIFIED_SEVERITY_INFO, /// <enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
+ FRAMEWORKUNIFIED_SEVERITY_WARN, /// <enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
+ FRAMEWORKUNIFIED_SEVERITY_ERROR, /// <enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
+ FRAMEWORKUNIFIED_SEVERITY_FATAL, /// <enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
+ FRAMEWORKUNIFIED_SEVERITY_ALWAYS /// <enable FRAMEWORKUNIFIEDLOG_ALWAYS()
+} TFrameworkunifiedLoggerSeverity;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG parameter
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _FRAMEWORKUNIFIEDLOGPARAM {
+ UI_8 uiLogOptions; /// <output options (ref. NS_LoggingMethod_t )
+ CHAR cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE]; /// <mask text ZONE_TEXT_10 ... ZONE_TEXT_n
+ TFrameworkunifiedZoneMask uiZoneMask; /// <mask options ZONEMASK(10)...ZONEMASK(n) (ref. TFrameworkunifiedZone)
+ TFrameworkunifiedLoggerSeverity eSeverity; /// <severity level(ref. TFrameworkunifiedLoggerSeverity)
+} FRAMEWORKUNIFIEDLOGPARAM, *LPFRAMEWORKUNIFIEDLOGPARAM;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG output direction
+/// \note LMSGQ and LSLOGGER are disabled
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _NS_LOGGER_METHODS {
+ LPRINT = 0x01, /// <Print to the console(similar to printf)
+ LMSGQ = 0x02, /// <Disabled
+ LSLOGGER = 0x04, /// <Disabled
+ LSHAREDMEM = 0x08 /// <Output to shared memory. this is the default logging method.
+} NS_LoggingMethod_t;
+// Note: Don't remove #paragma pack(1) this is required for the
+// ARM processor, forces data structures to be on a byte boundary
+// all messages should be place in between #pragma pack(1) and #pragma pack()
+#pragma pack(1) // *** DO NOT REMOVE ***
+
+typedef struct tag_Change_Log_Parameters {
+ TFrameworkunifiedZoneMask uiZoneMask;
+ UI_8 uiLogOptions;
+ TFrameworkunifiedLoggerSeverity eSeverity;
+} CHANGELOGPARAMS;
+
+#pragma pack(0) // *** DO NOT REMOVE ***
+
+// RCS related
+#define NS_RCS_LOGGER_PLUGIN_Q "/NsRcsLoggerPlugin"
+
+typedef enum _NS_RCS_LOGGER_SETTINGS {
+ NS_RCS_LOGGER_PLUGIN_ADD_APPNAME = 0x500,
+} NS_RCS_LOGGER_SETTINGS;
+
+typedef struct _TNS_EnableRcsLogging {
+ CHAR m_cAppName[MAX_NAME_SIZE_APP];
+ BOOL m_bEnable;
+} TNS_EnableRcsLogging;
+
+// End RCS related
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLog
+/// \~english @par Brief
+/// Writes a log to the Native Services logging mechanism
+/// \~english @param [in] p_lLine_i
+/// const UI_16 - Line number(0 to 65535) that this log was was written on
+/// \~english @param [in] f_uiZoneIndex
+/// const UI_64 - Mask value(0 to 511) to check against
+/// \~english @param [in] p_pstrClassName_i
+/// PCSTR - Name of the class or method where the log was written
+/// \~english @param [in] lpszFormat
+/// PCSTR - string similar to that of a printf statement
+/// \~english @param [in] arg list
+/// ... - Data arguments(option)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// FRAMEWORKUNIFIEDLOG parameter is set throuth NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
+/// But in case of FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE real-time log and/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog /will not print out
+/// \~~english @par
+/// - in the following conditions,real-time log will not print out:
+/// - log output way is LPRINT but f_uiZoneIndex parameter is in [96 to 127]
+/// - log output way is LPRINT but real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_open system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_send system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and socket system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and setsockopt system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and bind system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and inet_addr system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and sendto system call failed(retry 5 times)
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE
+/// \~english @par
+/// in the following conditions /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/ log can not be print out
+/// - log file for parameter f_uiZoneIndex and
+/// log file for parameter FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter can not be found
+/// - the ring_buffer of log file(log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when
+/// log file is not exited) for parameter f_uiZoneIndex is not opened (CNSRingBuffer::IsOpen())
+/// - the write-in operation to ring_buffer of log file for parameter f_uiZoneIndex
+/// (log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when file is not exited) is failed
+/// \~english @par Detail
+/// Writes a log to the Native Services logging mechanism
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLog(const UI_16 p_lLine_i, // Line number where message was generated
+ const UI_16 f_uiZoneIndex,
+ PCSTR p_pstrClassName_i,
+ PCSTR lpszFormat,
+ ...)
+#ifdef __GNUC__
+__attribute__((format(printf, 4, 5)))
+#endif
+; // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLog0
+/// \~english @par Brief
+/// Writes a log to the Native Services logging mechanism
+/// \~english @param [in] p_lLine_i
+/// const UI_16 - Line number(0 to 65535) that this log was was written on
+/// \~english @param [in] f_uiZoneIndex
+/// const UI_64 - Mask value(0 to 511) to check against
+/// \~english @param [in] p_pstrClassName_i
+/// PCSTR - Name of the class or method where the log was written
+/// \~english @param [in] lpszFormat
+/// PCSTR - string similar to that of a printf statement
+/// \~english @param [in] arg list
+/// ... - Data arguments(option)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// FRAMEWORKUNIFIEDLOG parameter is set throuth NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
+/// But in case of FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE real-time log and/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog /will not print out
+/// \~~english @par
+/// - in the following conditions,real-time log will not print out:
+/// - log output way is LPRINT but f_uiZoneIndex parameter is in [96 to 127]
+/// - log output way is LPRINT but real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_open system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_send system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and socket system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and setsockopt system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and bind system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and inet_addr system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and sendto system call failed(retry 5 times)
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE
+/// \~english @par
+/// in the following conditions /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/ log can not be print out
+/// - log file for parameter f_uiZoneIndex and
+/// log file for parameter FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter can not be found
+/// - the ring_buffer of log file(log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when
+/// log file is not exited) for parameter f_uiZoneIndex is not opened (CNSRingBuffer::IsOpen())
+/// - the write-in operation to ring_buffer of log file for parameter f_uiZoneIndex
+/// (log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when file is not exited) is failed
+/// \~english @par Detail
+/// Writes a log to the Native Services logging mechanism
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLog0(const UI_16 p_lLine_i, // Line number where message was generated
+ const UI_16 f_uiZoneIndex,
+ PCSTR p_pstrClassName_i,
+ PCSTR lpszFormat);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogTime
+/// \~english @par Brief
+/// Print out real-time in log using Native Service mechanism
+/// \~english @param [in] f_uiZoneIndex
+/// const UI_64 - Mask value(0 to 511) to check against
+/// \~english @param [in] lpszFormat
+/// PCSTR - string similar to that of a printf statement
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// parameter FRAMEWORKUNIFIEDLOG has already set using NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
+/// But in case of FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE real-time log and/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog /will not print out
+/// \~~english @par
+/// - in the following conditions,real-time log will not print out:
+/// - log output way is LPRINT but f_uiZoneIndex parameter is in [96 to 127]
+/// - log output way is LPRINT but real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_open system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_send system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and socket system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and setsockopt system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and bind system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and inet_addr system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and sendto system call failed(retry 5 times)
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE
+/// \~english @par
+/// in the following conditions /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/ log can not be print out
+/// - log file for parameter f_uiZoneIndex and
+/// log file for parameter FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter can not be found
+/// - the ring_buffer of log file(log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when
+/// log file is not exited) for parameter f_uiZoneIndex is not opened (CNSRingBuffer::IsOpen())
+/// - the write-in operation to ring_buffer of log file for parameter f_uiZoneIndex
+/// (log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when file is not exited) is failed
+/// \~english @par Detail
+/// Print out real-time in log using Native Service mechanism
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogTime(const UI_16 f_uiZoneIndex,
+ PCSTR lpszFormat);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogData
+/// \~english @par Brief
+/// log print-out function
+/// \~english @param [in] f_uiZoneIndex
+/// const UI_64 - Mask value(0 to 511) to check against
+/// \~english @param [in] data
+/// PCSTR -log print-out data
+/// \~english @param [in] size (0 to ULONG_MAX)
+/// UI_32 - data size (0 to ULONG_MAX)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// FRAMEWORKUNIFIEDLOG has already set by NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// -Process will failed under following conditions:
+/// -Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
+/// But the set value is FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE
+/// -the log file for f_uiZoneIndex and log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter
+/// are both not found
+/// - the ring_buffer of log file for f_uiZoneIndex(using log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG
+/// if file is not exited)is not opened (CNSRingBuffer::IsOpen())
+/// - write operation on ring_buffer of log file for f_uiZoneIndex
+/// (using log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG if file is not exited)is failed
+/// \~english @par Detail
+/// the difference bewteen NsLog and NsLogData:
+/// - NsLog()will print out real-time log
+/// NsLogData() will not print out real-time log but noly print out logs under /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/
+/// - NsLog() will add ZoneIndex, process name, real-time info to log but
+/// NsLogData() only print out log
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogData(const UI_16 f_uiZoneIndex,
+ PCSTR data,
+ UI_32 size);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetFrameworkunifiedLogParams
+/// \~english @par Brief
+/// Sets the FRAMEWORKUNIFIEDLOG parameter of your application\process based on
+/// the value passed in.
+/// \~english @param [in] p_FrameworkunifiedLogParams
+/// FRAMEWORKUNIFIEDLOGPARAM * - FRAMEWORKUNIFIEDLOG parameter in process
+/// \~english @par
+/// FRAMEWORKUNIFIEDLOGPARAM Structure
+/// \~english @code
+/// typedef struct _FRAMEWORKUNIFIEDLOGPARAM {
+/// UI_8 uiLogOptions; // output options (ref. NS_LoggingMethod_t )
+/// CHAR cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE]; // mask text ZONE_TEXT_10 ... ZONE_TEXT_n
+/// // mask options ZONEMASK(10)...ZONEMASK(n) (ref. TFrameworkunifiedZone)
+/// TFrameworkunifiedZoneMask uiZoneMask;
+/// TFrameworkunifiedLoggerSeverity eSeverity; // severity level(ref. TFrameworkunifiedLoggerSeverity)
+/// } FRAMEWORKUNIFIEDLOGPARAM, *LPFRAMEWORKUNIFIEDLOGPARAM;
+/// @endcode
+/// \~english @par
+/// TFrameworkunifiedZoneMask Array
+/// \~english @code
+/// typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
+/// @endcode
+/// \~english @par
+/// TFrameworkunifiedZone typedef
+/// \~english @code
+/// UI_32 TFrameworkunifiedZone; // 32bit
+/// @endcode
+/// \~english @par
+/// TFrameworkunifiedLoggerSeverity Enum
+/// \~english @code
+/// typedef enum _TFrameworkunifiedLoggerSeverity {
+/// FRAMEWORKUNIFIED_SEVERITY_LOW = 0x0, // all enable(default)
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG2, // enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG1, // enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_INFO, // enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_WARN, // enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_ERROR, // enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_FATAL, // enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// FRAMEWORKUNIFIED_SEVERITY_ALWAYS // enable FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// } TFrameworkunifiedLoggerSeverity;
+/// @endcode
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - process will not conducted when p_FrameworkunifiedLogParams is NULL.
+/// \~english @par Detail
+/// set the FRAMEWORKUNIFIEDLOG of Application using the parameter set in parameter\n
+/// ZONE_NS_WAR(8), ZONE_NS_ERR(9) will be put-out forcely in the function\n
+/// log will be print out when ForceOutput is set.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetFrameworkunifiedLogParams(FRAMEWORKUNIFIEDLOGPARAM *p_FrameworkunifiedLogParams);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetProcessName
+/// \~english @par Brief
+/// Sets the name of your application\process based on
+/// the value passed in.
+/// \~english @param [in] p_strProcessName_i
+/// PCSTR - name of your application process.(string array ended by NULL below 20byte)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// The specified Aplication names are not set in the following cases:
+/// - When the Application name specified in the arguments (p_strProcessName_i) is NULL
+/// - When the Application name specified in the arguments (p_strProcessName_i) is a NULL termination character string of 21 bytes or more
+/// \~english @par Detail
+/// -name in prarameter should be string array(less than 20byte) ended by NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetProcessName(PCSTR p_strProcessName_i);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetControlMask
+/// \~english @par Brief
+/// Sets the control word that should be logged
+/// \~english @param [in] p_ulNSLogControl_i
+/// TFrameworkunifiedZoneMask - Set mask to the new value.
+/// \~english @par
+/// TFrameworkunifiedZoneMask Array
+/// \~english @code
+/// typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
+/// @endcode
+/// \~english @par
+/// TFrameworkunifiedZone typedef
+/// \~english @code
+/// UI_32 TFrameworkunifiedZone; // 32bit
+/// @endcode
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// -process will not be conducted when p_ulNSLogControl_i is none
+/// \~english @par Detail
+/// -Sets the control word that should be logged
+/// zone mask(16) will be rewrited using parameter value
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NsLogGetControlMask
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetControlMask(TFrameworkunifiedZoneMask p_ulNSLogControl_i);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogIsZoneSet
+/// \~english @par Brief
+/// check wheather the FRAMEWORKUNIFIEDLOG ZONE is set by your application process.
+/// \~english @param [in] set_zone
+/// UI_32 - checking zone_index
+/// \~english @retval TRUE zone is enable
+/// \~english @retval FALSE zone is disable
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// If the parameter of set_zone is outside(set_zone < 0 or 511 > set_zone), it will return FALSE.
+/// \~english @par Detail
+/// check wheather the FRAMEWORKUNIFIEDLOG ZONE is set by your application process.\n
+/// zone parameter first 4bit(0 to 15)is the index of zone mask array\n
+/// second 5bit(0 to 31) is showing bit position of mask(9bit,511 for the most)\n
+/// True will be returned when bit for zone mask is set as 1
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NsLogIsZoneSet(UI_32 set_zone);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetControlMask
+/// \~english @par Brief
+/// Get the control word that you currently have set.
+/// \~english @param [out] p_Zonemask_i
+/// TFrameworkunifiedZoneMask - current mask value.
+/// \~english @par
+/// TFrameworkunifiedZoneMask Array
+/// \~english @code
+/// typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
+/// @endcode
+/// \~english @par
+/// TFrameworkunifiedZone typedef
+/// \~english @code
+/// UI_32 TFrameworkunifiedZone; // 32bit
+/// @endcode
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - If p_Zonemask_i is NULL, no operation is performed.
+/// \~english @par Detail
+/// Get all 16 zone mask.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NsLogSetControlMask
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogGetControlMask(TFrameworkunifiedZoneMask p_Zonemask_i);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetLogMethod
+/// \~english @par Brief
+/// Sets the logging place, LPRINT, LSHAREDMEM or any combination of these.
+/// If this is never called the default is LSHAREDMEM.
+/// \~english @param [in] p_eMethod_i
+/// UI_8 - Where you would like to log your data.
+/// \~english @par
+/// NS_LoggingMethod_t Enum
+/// \~english @code
+/// typedef enum _NS_LOGGER_METHODS {
+/// LPRINT = 0x01, // Print to the console(similar to printf)
+/// LMSGQ = 0x02, // Disabled
+/// LSLOGGER = 0x04, // Disabled
+/// LSHAREDMEM = 0x08 // Output to shared memory. this is the default logging method.
+/// } NS_LoggingMethod_t;
+/// @endcode
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// -switch the out-put place for NsLog API
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// Sets the logging place, LPRINT, LSHAREDMEM or any combination of these.
+/// If this is never called the default is LSHAREDMEM.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NsLogGetLogMethod
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetLogMethod(UI_8 p_eMethod_i);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetLogMethod
+/// \~english @par Brief
+/// Get the logging method.
+/// \~english @param None
+/// \~english @retval - return the way you log your data.
+/// UI_8 - Log data type(NS_LoggingMethod_t Enum).
+/// \~english @par
+/// NS_LoggingMethod_t Enum
+/// \~english @code
+/// typedef enum _NS_LOGGER_METHODS {
+/// LPRINT = 0x01, // Print to the console(similar to printf)
+/// LMSGQ = 0x02, // Disabled
+/// LSLOGGER = 0x04, // Disabled
+/// LSHAREDMEM = 0x08 // Output to shared memory. this is the default logging method.
+/// } NS_LoggingMethod_t;
+/// @endcode
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// Invoke callback function to get the logging method.\n
+/// If callback function is null and expectedCalls is '0',
+/// using default SetSeparator function to get the logging method. \n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogSetLogMethod
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_8 NsLogGetLogMethod(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogInitialize
+/// \~english @par Brief
+/// Initialize the log level and real-time log out-put setting
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// if the getting process of FRAMEWORKUNIFIEDLOG CONFIG file data is failed
+/// \~english @par Detail
+/// Initialize the log level and real-time log out-put setting
+/// if the getting process of FRAMEWORKUNIFIEDLOG CONFIG file data is failed,log
+/// level and real-time log out-put setting will not be initialized
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogInitialize(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetFrameworkunifiedLogFlag
+/// \~english @par Brief
+/// set LogLevel of FRAMEWORKUNIFIEDLOG flag
+/// \~english @param [in] flag_id
+/// UI_8 - index for FRAMEWORKUNIFIEDLOG flag(0 to FLAG_LIST(declared in FRAMEWORKUNIFIEDLOG CONFIG file)
+/// \~english @param [in] mode
+/// UI_8 - LogLevel
+/// \~english @par
+/// avaliable LogLevel
+/// - FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE
+/// - FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// in the following conditions FRAMEWORKUNIFIEDLOG flag will not be set
+/// - mode is not FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE, FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG
+/// - the getting process of FRAMEWORKUNIFIEDLOG CONFIG file is failed(ns_logger_frameworkunifiedlog_xxx.cfg)
+/// - flag_id is not declared in FRAMEWORKUNIFIEDLOG CONFIG file
+/// \~english @par Detail
+/// set loglevel for specific FRAMEWORKUNIFIEDLOG flag
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogGetFrameworkunifiedLogFlag
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetFrameworkunifiedLogFlag(UI_8 flag_id, UI_8 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetFrameworkunifiedLogFlag
+/// \~english @par Brief
+/// get LogLevel of FRAMEWORKUNIFIEDLOG flag
+/// \~english @param [in] flag_id
+/// UI_8 - index for FRAMEWORKUNIFIEDLOG flag(0 to FLAG_LIST(declared in FRAMEWORKUNIFIEDLOG CONFIG file)
+/// \~english @param [out]mode
+/// UI_8 - LogLevel value
+/// \return none
+/// void - there is no return.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusFail any sort of error occurred
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// -parameter mode is NULL[eFrameworkunifiedStatusFail]
+/// -flag_id is not declared in FRAMEWORKUNIFIEDLOG CONFIG file [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// get FRAMEWORKUNIFIEDLOG flage for specific flag_id
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogSetFrameworkunifiedLogFlag
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NsLogGetFrameworkunifiedLogFlag(UI_8 flag_id, UI_8 *mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetRealtimeLog
+/// \~english @par Brief
+/// real-time log output setting
+/// \~english @param [in] mode
+/// UI_8 - set mode for Real time log
+/// \~english @par
+/// available setting for real-time log output
+/// default value is REALTIME_LOG in FRAMEWORKUNIFIEDLOG CFG file
+/// (FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF when FRAMEWORKUNIFIEDLOG CFG file get failed)
+/// \~english @code
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART 1 // : UARTOUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB 2 // : USB OUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE 0x82 // : USB OFF
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER 3 // : Ether OUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF 0 // : ALL OFF
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE 0xFF // : FREEZE
+/// @endcode
+/// \~english @retval none
+/// void - there is no return
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// -mode is not in FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_XXX above
+/// \~english @par Detail
+/// set the real-time log output using the setting value.\n
+/// need to reboot during ROM start in order to switch to Ethernet output\n
+/// /nv/BS/ns/framework_unified/rwdata/frameworkunifiedlog.ether file will be generated
+/// when mode FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER /nv/BS/ns/framework_unified/rwdata/frameworkunifiedlog.ether\n
+/// and /nv/BS/ns/framework_unified/rwdata/frameworkunifiedlog.ether file will be delated when mode is not FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogGetRealtimeLog
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetRealtimeLog(UI_8 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetRealtimeLog
+/// \~english @par Brief
+/// get the setting of real-time log output
+/// \~english @param [out] mode
+/// UI_8 * -the setting of real-time log output
+/// \~english @par
+/// available settings of real-time log output
+/// default value is REALTIME_LOG in FRAMEWORKUNIFIEDLOG CFG file
+/// (FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF when FRAMEWORKUNIFIEDLOG CFG file get failed)
+/// \~english @code
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART 1 // : UARTOUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB 2 // : USB OUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE 0x82 // : USB OFF
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER 3 // : Ether OUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF 0 // : ALL OFF
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE 0xFF // : FREEZE
+/// @endcode
+/// \~english @retval none
+/// void - there is no return
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - cannot get when mode is NULL
+/// -FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF will be returned when the approach
+/// of FRAMEWORKUNIFIEDLOG CONFIG file (ns_logger_frameworkunifiedlog_xxx.cfg)is failed
+/// \~english @par Detail
+/// get the setting of real-time log output
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogSetRealtimeLog
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogGetRealtimeLog(UI_8 *mode);
+
+// Deprecated API: Not use.
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetSeverity
+/// \~english @par Brief
+/// Set log severity level
+/// \~english @param [in] p_eLogSeverity_i
+/// TFrameworkunifiedLoggerSeverity - Log severity
+/// \~english @par
+/// TFrameworkunifiedLoggerSeverity Enum
+/// \~english @code
+/// typedef enum _TFrameworkunifiedLoggerSeverity {
+/// FRAMEWORKUNIFIED_SEVERITY_LOW = 0x0, /// <all enable(default)
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG2, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG1, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_INFO, /// <enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_WARN, /// <enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_ERROR, /// <enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_FATAL, /// <enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// FRAMEWORKUNIFIED_SEVERITY_ALWAYS /// <enable FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// } TFrameworkunifiedLoggerSeverity;
+/// @endcode
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(p_eLogSeverity_i).
+/// \~english @par Detail
+/// Invoke callback function to set log severity.\n
+/// If callback function is null and expectedCalls is '0', using default function to set log severity.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogGetSeverity
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetSeverity(TFrameworkunifiedLoggerSeverity p_eLogSeverity_i);
+
+// Deprecated API: Not use.
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetSeverity
+/// \~english @par Brief
+/// Get the log severity.
+/// \~english @param none
+/// \~english @retval Log Severity
+/// TFrameworkunifiedLoggerSeverity - Log severity.
+/// \~english @par
+/// TFrameworkunifiedLoggerSeverity Enum
+/// \~english @code
+/// typedef enum _TFrameworkunifiedLoggerSeverity {
+/// FRAMEWORKUNIFIED_SEVERITY_LOW = 0x0, /// <all enable(default)
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG2, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG1, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_INFO, /// <enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_WARN, /// <enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_ERROR, /// <enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_FATAL, /// <enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// FRAMEWORKUNIFIED_SEVERITY_ALWAYS /// <enable FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// } TFrameworkunifiedLoggerSeverity;
+/// @endcode
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// none
+/// \~english @par Detail
+/// Invoke callback function to get log severity.\n
+/// If callback function is null and expectedCalls is '0', using default function to get log severity.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogSetSeverity
+////////////////////////////////////////////////////////////////////////////////////////////
+TFrameworkunifiedLoggerSeverity NsLogGetSeverity(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLog_EvtCnt
+/// \~english @par Brief
+/// Event and count logger.
+/// \~english @param [in] @param [in] Cnt_Id
+/// UI_16 - ID of counter from comm layer
+/// \~english @param [in] Evt_Id
+/// UI_16 - ID of Event from comm layer
+/// \~english @param [in] n
+/// UI_8 - number of variable arguments inputted
+/// \~english @param [in] arg list
+/// ... - Data arguments(option)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(Cnt_Id).
+/// - It is an incorrect value(Evt_Id).
+/// - It is an incorrect value(n).
+/// \~english @par Detail
+/// Invoke callback function with argument 'Cnt_Id', 'Evt_Id', 'n' to log.\n
+/// If callback function is null and expectedCalls is '0', using default SetSeparator function to log. \n
+/// In other situation, match and log 'Cnt_Id', 'Evt_Id', 'n'.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+// Deprecated API: Not use.
+void NsLog_EvtCnt( // Line number where message was generated
+ UI_16 Cnt_Id,
+ UI_16 Evt_Id, UI_8 n,
+ ...);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLog_Evt
+/// \~english @par Brief
+/// Event logger mechanism.(Send data to SS event logger Queue)
+/// \~english @param [in] Evt_Id
+/// UI_16 - ID of Event from comm layer
+/// \~english @param [in] nu
+/// UI_8 - number of variable arguments inputted
+/// \~english @param [in] ...
+/// ... - Data arguments
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - process nothing when Evt_id is in [0 to 0xFF]
+/// - process nothing when nu is not 1 or 4
+/// \~english @par Detail
+/// -send the log event queue to SS(logger mechanism Event)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+// Deprecated API: Not use.
+void NsLog_Evt(UI_16 Evt_Id, UI_8 nu, ...);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLog_Cnt
+/// \~english @par Brief
+/// Counter logger mechanism.(Send data to SS event logger Queue)
+/// \~english @param [in] Cnt_Id
+/// UI_16 - ID of Counter from comm layer
+/// \~english @param [in] nu
+/// UI_8 - number of variable arguments inputted
+/// \~english @param [in] ...
+/// ... - Data arguments
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - process nothing when Cnt_Id is 0
+/// - process nothing when nu is not 0 or 1
+/// \~english @par Detail
+/// send the log event queue to SS(logger mechanism counter)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+// Deprecated API: Not use.
+void NsLog_Cnt(UI_16 Cnt_Id, UI_8 nu, ...); // Not to use.
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogDetermineLogMethod
+/// \~english @par Brief
+/// Determines the control log method based on the string passed.
+/// If the string passed doesn't match any of the key words:
+/// slogger or msgr or console the method will return a value of
+/// zero. This string may be in the form of the following:
+/// "msgq|console" would cause the output to go to both the NSLog
+/// message queue and the console.
+/// \~english @param [in] output_type
+/// PCSTR - The key words:
+/// \~english @retval 1 ... 0xF Success
+/// \~english @retval 0 the string passed doesn't match any of the key words
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// the string passed doesn't match any of the key words
+/// \~english @par Detail
+/// mask value retruned from application can be used as parameter in NsLogSetLogMethod()
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_8 NsLogDetermineLogMethod(PCSTR output_type);
+
+// Unused API.
+// VOID NsLogEnableRcsLogging(BOOL f_bRCSEnableLogging);
+
+// Private API.
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetZoneTextList
+/// \~english @par Brief
+/// Get the zone data list.
+/// \~english @param [out] f_cZoneList
+/// CHAR [][ZONE_TEXT_SIZE] - zone text list(0 ... 511)
+/// \~english @par
+/// PUI_32 - Pointer to preallocated array of CHAR cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE];
+/// \~english @retval none
+/// VOID - There is no return
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(f_cZoneList) or f_cZoneList is empty.
+/// - Some error occur when get value from f_cZoneList
+/// \~english @par Detail
+/// Invoke callback function to get zone text list.\n
+/// If callback function is null and expectedCalls is '0', using default function to get zone text list.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogSetZones
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID NsLogGetZoneTextList(CHAR f_cZoneList[][ZONE_TEXT_SIZE]);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetZones
+/// \~english @par Brief
+/// set FRAMEWORKUNIFIEDLOG ZONE
+/// \~english @param [in] f_uiZoneCount
+/// UI_32 - number of zone
+/// \~english @param [in] ...
+/// arg_list - zone list (0 ... 511)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - zone value will not over 512
+/// \~english @par Detail
+/// set the specific bit to existed zone mask\n
+/// first 4bit(0 to 15) in zone is the index of zone mask array\n
+/// second 5bit(0 to 31)set the 9bit which shows the bit position of mask(blew 511)\n
+/// eg:in the case of setting three zones=31,30,29, function should be called like NsLogSetZones(3,31,30,29) \n
+/// operation may not be right when parameter shows in arg_list differs with array num in f_uiZoneCount
+///
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Set Get
+/// \~english @see
+/// none
+/////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetZones(UI_32 f_uiZoneCount, ...);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogParseZones
+/// \~english @par Brief
+/// Parse the FRAMEWORKUNIFIEDLOG ZONE.
+/// \~english @param [out] p_FrameworkunifiedLogParams
+/// FRAMEWORKUNIFIEDLOGPARAM * - Input/output FRAMEWORKUNIFIEDLOG parameter
+/// \~english @param [in] f_uiZoneCount
+/// UI_32 - Zone setting
+/// \~english @param [in] ...
+/// arg_list - Zone lists (zone values are 0 to 511)
+/// \~english @par
+/// FRAMEWORKUNIFIEDLOGPARAM structures
+/// \~english @code
+/// typedef struct _FRAMEWORKUNIFIEDLOGPARAM {
+/// UI_8 uiLogOptions; // Log output location (ref NS_LoggingMethod_t)
+/// CHAR cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE]; // ZONE_TEXT_10 ... ZONE_TEXT_n
+/// TFrameworkunifiedZoneMask uiZoneMask; // ZONEMASK(10)...ZONEMASK(n) (ref TFrameworkunifiedZone)
+/// TFrameworkunifiedLoggerSeverity eSeverity; // Logging level (ref TFrameworkunifiedLoggerSeverity)
+/// } FRAMEWORKUNIFIEDLOGPARAM, *LPFRAMEWORKUNIFIEDLOGPARAM;
+/// @endcode
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// In the FRAMEWORKUNIFIEDLOG parameter (p_FrameworkunifiedLogParams) specified in the arguments,\n
+/// add (or) all masked values of the zone lists specified by the arguments.
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// none
+/////////////////////////////////////////////////////////////////////////////////////
+void NsLogParseZones(FRAMEWORKUNIFIEDLOGPARAM *p_FrameworkunifiedLogParams, UI_32 f_uiZoneCount, ...);
+
+// Unused API.
+// VOID NsRcsSendTraceData(PCHAR f_pData, UI_32 f_len);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSLogGetFrameworkunifiedlogFileTotalNum
+/// \~english @par Brief
+/// get total number of log file
+/// \~english @retval num
+/// UI_32 - Total numger of frameworkunifiedlog files.
+/// \~english @par Prerequisite
+/// set log file using NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// get total number of log file
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 NSLogGetFrameworkunifiedlogFileTotalNum(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSLogGetFrameworkunifiedlogFileName
+/// \~english @par Brief
+/// get the name of log file
+/// \~english @param [in] index
+/// UI_32 - Index of a list of frameworkunifiedlog file names.(0 to NSLogGetFrameworkunifiedlogFileTotalNum()-1)
+/// \~english @retval file name -file with specific index is exsisted
+/// \~english @retval NULL -file with specific index is not exsisted
+/// \~english @par Prerequisite
+/// set log file using NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// file with specific index is not exsisted
+/// \~english @par Detail
+/// get the file name with specific index is not exsisted
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No macth
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR NSLogGetFrameworkunifiedlogFileName(UI_32 index);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSLogGetFrameworkunifiedlogFileName
+/// \~english @par Brief
+/// get index of log file
+/// \~english @param [in] filename
+/// PCSTR - Name of frameworkunifiedlog file.
+/// \~english @retval 0 log file specific logfile is not exsisted
+/// \~english @retval index of log file specific logfile is exsisted
+/// \~english @par Prerequisite
+/// set log file using NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// process nothing when file name is NULL
+/// process nothing when file name is not exsisted
+/// \~english @par Detail
+/// get index of log file
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+int NSLogGetFrameworkunifiedlogIndex(PCSTR filename);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsForceClose
+/// \~english @par Brief
+/// clear log forcely.
+/// \~english @retval none
+/// return void
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// -clear log forcely.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID NsForceClose(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief extern FRAMEWORKUNIFIEDLOG parameter
+///////////////////////////////////////////////////////////////////////////////
+/// Global variable that's used by the Native Services Logger.
+/// An application will setup this variable in their main,
+/// values are user defined and provide user control of what
+/// should and shouldn't get logged.
+/// \code
+/// FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams =
+/// {
+/// FRAMEWORKUNIFIEDLOGOPTIONS,
+/// {
+/// ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+/// ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+/// ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+/// ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+/// ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+/// ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+/// ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+/// ZONE_TEXT_31, ZONE_TEXT_32, ZONE_TEXT_33,
+/// ZONE_TEXT_34, ZONE_TEXT_35, ZONE_TEXT_36,
+/// ZONE_TEXT_37, ZONE_TEXT_38, ZONE_TEXT_39,
+/// ZONE_TEXT_40, ZONE_TEXT_41, ZONE_TEXT_42,
+/// ZONE_TEXT_43, ZONE_TEXT_44, ZONE_TEXT_45,
+/// ZONE_TEXT_46, ZONE_TEXT_47, ZONE_TEXT_48,
+/// ZONE_TEXT_49, ZONE_TEXT_50, ZONE_TEXT_51,
+/// ZONE_TEXT_52, ZONE_TEXT_53, ZONE_TEXT_54,
+/// ZONE_TEXT_55
+/// },
+/// FRAMEWORKUNIFIEDLOGZONES
+/// };
+/// \endcode
+///
+
+/// if FRAMEWORKUNIFIEDLOGZONES not defined in makefile
+#ifndef FRAMEWORKUNIFIEDLOGZONES
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief g_FrameworkunifiedLogParams
+/// if FRAMEWORKUNIFIEDLOGZONES not defined in makefile
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOGZONES {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup FRAMEWORKUNIFIED_SET_ZONES
+/// \~english @par Brief
+/// This macro API register FRAMEWORKUNIFIEDLOGAPPZONES.
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// in main() function use macro FRAMEWORKUNIFIED_SET_ZONES() before FrameworkunifiedDispatcher()
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NsLogSetFrameworkunifiedLogParams
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIED_SET_ZONES() {UI_32 LogArr[] = {FRAMEWORKUNIFIEDLOGAPPZONES}; \
+ NsLogParseZones(&g_FrameworkunifiedLogParams, (UI_32)_countof(LogArr), FRAMEWORKUNIFIEDLOGAPPZONES); \
+ NsLogSetFrameworkunifiedLogParams(&g_FrameworkunifiedLogParams);}
+#else
+#warning "Zones defined by FRAMEWORKUNIFIEDLOGAPPZONES are overridden by FRAMEWORKUNIFIEDLOGZONES"
+#define FRAMEWORKUNIFIED_SET_ZONES() NsLogSetFrameworkunifiedLogParams(&g_FrameworkunifiedLogParams)
+#endif
+
+#define ZONE_END UINT_MAX
+// Unused API
+// #define CHECK_SEVERITY_LEVEL(sev_level) ((sev_level) >= NsLogGetSeverity())
+// If value of BITS_IN_TZONE changes in future then need to consider changes in the values 5 and 0x1F in below macros
+// here 5 represents (sizeof(TFrameworkunifiedZone)+1) and 0x1F represents (BITS_IN_TZONE-1)
+#define GET_ZONE_INDEX(zone) (((UI_32)zone) >> 5)
+#define GET_ZONE_BIT_MASK(zone) ((TFrameworkunifiedZone)(1U << (((UI_32)zone) & 0x1F)))
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ZONEMASK
+/// \~english @par Brief
+/// the Macro for zone index mask
+/// \~english @param [in] n
+/// zone index
+/// \~english @retval num
+/// UI_32 - zone index
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// mask the zone index
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define ZONEMASK( n ) ((TFrameworkunifiedZone)( n ))
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup IS_ZONE_SET
+/// \~english @par Brief
+/// check wheather the FRAMEWORKUNIFIEDLOG ZONE is set by your application process.
+/// \~english @param [in] set_zone
+/// UI_32 - checking zone_index
+/// \~english @retval TRUE zone is enable
+/// \~english @retval FALSE zone is disable
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// Checks if the FRAMEWORKUNIFIEDLOG ZONE can be configured by Application processes.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NsLogIsZoneSet
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define IS_ZONE_SET(set_zone) (NsLogIsZoneSet(set_zone) == TRUE)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup FRAMEWORKUNIFIEDLOG
+/// \~english @par Brief
+/// Developers should use the FRAMEWORKUNIFIEDLOG for logging.
+/// \~english @param [in] zone
+/// Defined zone in a process (e.g. ZONE_FUNC)
+/// \~english @param [in] funcname
+/// Name of the class or method where the log was written (e.g. "main")
+/// \~english @param [in] print_fmt
+/// string similar to that of a printf statement
+/// \~english @param [in] args
+/// Data arguments(option)
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If print_fmt is NULL, no operation is performed.
+/// \~english @par Detail
+/// FRAMEWORKUNIFIEDLOG is simple macro to make it easy to log messages from any point in your code.
+/// This macro has smarts that does fast checks to determine if your log should or shouldn't be printed.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// ZONEMASK, IS_ZONE_SET, NsLog, NsLog0
+///////////////////////////////////////////////////////////////////////////////
+#ifndef _FRAMEWORKUNIFIEDLOG_ZONE_FUNC_ENABLE_
+#define FRAMEWORKUNIFIEDLOG(zone, funcname, print_fmt, args...)\
+ (zone != ZONEMASK(11))?((IS_ZONE_SET(zone))?TEXT_ZONE(zone, funcname, print_fmt, ## args):((void)0)):((void)(0))
+#else // _FRAMEWORKUNIFIEDLOG_ZONE_FUNC_ENABLE_
+#define FRAMEWORKUNIFIEDLOG(zone, funcname, print_fmt, args...)\
+ ((IS_ZONE_SET(zone)) ? TEXT_ZONE(zone, funcname, print_fmt, ## args) : ((void)0))
+#endif // _FRAMEWORKUNIFIEDLOG_ZONE_FUNC_ENABLE_
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \~english @par Brief
+/// This is the log output macro for clock display in milliseconds.
+/// \~english @param [in] zone
+/// Zone indexes to be checked
+/// \~english @param [in] str
+/// Log output string
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// A simple macro for logging messages in milliseconds from any point in the source code.\n
+/// The log is output in the following format. "Hours:Minutes:Seconds.Milliseconds/=log-output-string"
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// IS_ZONE_SET
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_TIME(zone, str)\
+ ((IS_ZONE_SET(zone))?NsLogTime(zone, str):((void)(0)))
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \~english @par Brief
+/// This is a simplified version of the log output macro.
+/// \~english @param [in] zone
+/// Zone indexes to be checked
+/// \~english @param [in] data
+/// Log output data
+/// \~english @param [in] size
+/// Size of the log output data
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// A simple macro for logging messages from any point in the source code.\n
+/// \ref The macro FRAMEWORKUNIFIEDLOG can specify variable argument lists for log output data,
+/// but the macro is a macro that specifies only data character strings.
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// IS_ZONE_SET, NsLogData
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_DATA(zone, data, size)\
+ ((IS_ZONE_SET(zone))?NsLogData(zone, data, size):((void)(0)))
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_EVTCNT
+///////////////////////////////////////////////////////////////////////////////
+/// Deprecated API. Not use.
+#define FRAMEWORKUNIFIEDLOG_EVTCNT(zone, CntId, EvtId, n...) NsLog_EvtCnt(CntId, EvtId, ##n)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_EVT
+///////////////////////////////////////////////////////////////////////////////
+/// Event logger mechanism.(Send data to SS event logger Queue)
+/// \note The ZONE is not used.
+///
+/// \param [in] zone
+/// Defined zone in a process (e.g. ZONE_FUNC)
+/// \param [in] EvtId
+/// UI_16 - ID of Event from comm layer
+/// \param [in] n
+/// UI_8 - number of variable arguments inputted
+///////////////////////////////////////////////////////////////////////////////
+/// Deprecated API. Not use.
+#define FRAMEWORKUNIFIEDLOG_EVT(zone, EvtId, n...) NsLog_Evt(EvtId, ##n)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_CNT
+///////////////////////////////////////////////////////////////////////////////
+/// Counter logger mechanism.(Send data to SS event logger Queue)
+/// \note The ZONE is not used.
+///
+/// \param [in] zone
+/// Defined zone in a process (e.g. ZONE_FUNC)
+/// \param [in] CntId
+/// UI_16 - ID of Event from comm layer
+/// \param [in] n
+/// UI_8 - number of variable arguments inputted
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Deprecated API. Not use.
+#define FRAMEWORKUNIFIEDLOG_CNT(zone, CntId, n...) NsLog_Cnt(CntId, ##n) // Not to use
+
+/// Deprecated API. Not use.
+#define TEXT(funcname, args...) TEXT_ZONE(BITS_IN_ZONE_MASK, funcname, ## args)
+
+// Unused API
+// #define TEXT0(funcname, print_fmt ) NsLog(__LINE__, BITS_IN_ZONE_MASK, funcname, print_fmt)
+
+#define GET_MACRO(_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, NAME, ...) NAME
+#define NsLogFunc(...)\
+ GET_MACRO(__VA_ARGS__, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog0)
+#define TEXT_ZONE(zone_index, funcname, ...)\
+ NsLogFunc(__VA_ARGS__)(__LINE__, zone_index, funcname, __VA_ARGS__)
+
+/// Deprecated API. Not use.
+#define TEXT_EVTCNT(CntId, EvtId, n...) NsLog_EvtCnt(CntId, EvtId, ##n)
+/// Deprecated API. Not use
+#define TEXT_EVT(EvtID, n...) NsLog_Evt(EvtID, ##n)
+/// Deprecated API. Not use.
+#define TEXT_CNT(CntId, n...) NsLog_Cnt(CntId, ##n)
+/// Used to log data that contains trailing arguments \n
+/// Example: FRAMEWORKUNIFIEDLOG0(ZONE_INFO, __FUNCTION__, "testers return value is [%d]!", rtnValue);
+
+
+/// Deprecated API. Use FRAMEWORKUNIFIEDLOG instead.
+#define FRAMEWORKUNIFIEDLOG0 FRAMEWORKUNIFIEDLOG
+
+
+/// Note: These bits are reserved for Framework logging and debugging
+#define ZONE_NS_FUNC ZONEMASK(0)
+#define ZONE_NS_DIS ZONEMASK(1)
+#define ZONE_NS__CWORD77_ ZONEMASK(2)
+#define ZONE_NS_IMP_INFO ZONEMASK(3)
+#define ZONE_NS_SM_DEV_INFO ZONEMASK(4)
+#define ZONE_NS_SM_USR_INFO ZONEMASK(5)
+#define ZONE_NS_INFO ZONEMASK(6)
+#define ZONE_NS_DEBUG_DUMP ZONEMASK(7)
+#define ZONE_NS_WAR ZONEMASK(8)
+#define ZONE_NS_ERR ZONEMASK(9)
+#define ZONE_DEBUG_DUMP ZONE_NS_DEBUG_DUMP
+
+#define ZONE_TEXT_0 "NS_Func"
+#define ZONE_TEXT_1 "NS_Dispatcher"
+#define ZONE_TEXT_2 "NS__CWORD77_"
+#define ZONE_TEXT_3 "NS_Reserved"
+#define ZONE_TEXT_4 "NS_StateMachine_Dev"
+#define ZONE_TEXT_5 "NS_StateMachine_Usr"
+#define ZONE_TEXT_6 "NS_Info"
+#define ZONE_TEXT_7 "NS_Debug_Dump"
+#define ZONE_TEXT_8 "NS_Warning"
+#define ZONE_TEXT_9 "NS_Error"
+
+////
+// Following is old definitions. Only for compile.
+// Specific ZONE to use the ns_logger_frameworkunifiedlog.cfg
+// If possible, following Specific ZONE difinitions shall be delete.
+////
+// Special ZONE(64)-(95)
+/// Note: These bits are reserved for special ZONE
+#define ZONE_PERFORMANCE ZONEMASK(64)
+#define ZONE_SCREEN_TRANS ZONEMASK(65)
+#define ZONE_SWDL ZONEMASK(66)
+#define ZONE_SYSTEMDATA ZONEMASK(67)
+#define ZONE_LOG_SH ZONEMASK(68)
+#define ZONE_LOG_SYS ZONEMASK(69)
+#define ZONE_LOG__CWORD52_ ZONEMASK(70)
+#define ZONE_SECURE ZONEMASK(71)
+#define ZONE_CAN_FILTER ZONEMASK(72)
+#define ZONE_COMM_PROCESS ZONEMASK(73)
+#define ZONE_CONNECT_DEVICE ZONEMASK(74)
+#define ZONE_SP_ZONE_75 ZONEMASK(75)
+#define ZONE_SP_ZONE_76 ZONEMASK(76)
+#define ZONE_SP_ZONE_77 ZONEMASK(77)
+#define ZONE_SP_ZONE_78 ZONEMASK(78)
+#define ZONE_SP_ZONE_79 ZONEMASK(79)
+#define ZONE_SP_ZONE_80 ZONEMASK(80)
+#define ZONE_SP_ZONE_81 ZONEMASK(81)
+#define ZONE_SP_ZONE_82 ZONEMASK(82)
+#define ZONE_SP_ZONE_83 ZONEMASK(83)
+#define ZONE_SP_ZONE_84 ZONEMASK(84)
+#define ZONE_SP_ZONE_85 ZONEMASK(85)
+#define ZONE_SP_ZONE_86 ZONEMASK(86)
+#define ZONE_SP_ZONE_87 ZONEMASK(87)
+#define ZONE_SP_ZONE_88 ZONEMASK(88)
+#define ZONE_SP_ZONE_89 ZONEMASK(89)
+#define ZONE_SP_ZONE_90 ZONEMASK(90)
+#define ZONE_SP_ZONE_91 ZONEMASK(91)
+#define ZONE_SP_ZONE_92 ZONEMASK(92)
+#define ZONE_SP_ZONE_93 ZONEMASK(93)
+#define ZONE_SP_ZONE_94 ZONEMASK(94)
+#define ZONE_SP_ZONE_95 ZONEMASK(95)
+
+// Special ZONE(96)-(127) (console off)
+/// Note: These bits are reserved for special ZONE
+#define ZONE_COMM_SYS ZONEMASK(96)
+#define ZONE_COMM_SH ZONEMASK(97)
+#define ZONE_COMM_USB ZONEMASK(98)
+#define ZONE_SP_ZONE_99 ZONEMASK(99)
+#define ZONE_SP_ZONE_100 ZONEMASK(100)
+#define ZONE_SP_ZONE_101 ZONEMASK(101)
+#define ZONE_SP_ZONE_102 ZONEMASK(102)
+#define ZONE_SP_ZONE_103 ZONEMASK(103)
+#define ZONE_SP_ZONE_104 ZONEMASK(104)
+#define ZONE_SP_ZONE_105 ZONEMASK(105)
+#define ZONE_SP_ZONE_106 ZONEMASK(106)
+#define ZONE_SP_ZONE_107 ZONEMASK(107)
+#define ZONE_SP_ZONE_108 ZONEMASK(108)
+#define ZONE_SP_ZONE_109 ZONEMASK(109)
+#define ZONE_SP_ZONE_110 ZONEMASK(110)
+#define ZONE_SP_ZONE_111 ZONEMASK(111)
+#define ZONE_SP_ZONE_112 ZONEMASK(112)
+#define ZONE_SP_ZONE_113 ZONEMASK(113)
+#define ZONE_SP_ZONE_114 ZONEMASK(114)
+#define ZONE_SP_ZONE_115 ZONEMASK(115)
+#define ZONE_SP_ZONE_116 ZONEMASK(116)
+#define ZONE_SP_ZONE_117 ZONEMASK(117)
+#define ZONE_SP_ZONE_118 ZONEMASK(118)
+#define ZONE_SP_ZONE_119 ZONEMASK(119)
+#define ZONE_SP_ZONE_120 ZONEMASK(120)
+#define ZONE_SP_ZONE_121 ZONEMASK(121)
+#define ZONE_SP_ZONE_122 ZONEMASK(122)
+#define ZONE_SP_ZONE_123 ZONEMASK(123)
+#define ZONE_SP_ZONE_124 ZONEMASK(124)
+#define ZONE_SP_ZONE_125 ZONEMASK(125)
+#define ZONE_SP_ZONE_126 ZONEMASK(126)
+#define ZONE_SP_ZONE_127 ZONEMASK(127)
+
+#endif /* __NATIVESERVICES_LOGGER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_mc_system_info.h b/nsframework/framework_unified/client/include/native_service/ns_mc_system_info.h
new file mode 100755
index 0000000..b61268a
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_mc_system_info.h
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageCenter
+/// \brief Native Services Special Interfaces
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_MC_SYSTEM_INFO_H_
+#define FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_MC_SYSTEM_INFO_H_
+
+
+#include <native_service/ns_msgs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageCenter
+/// McSendWithSysInfo
+/// Sends data to a message queue, user defined system info.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \param [in] source
+/// LPCSTR - app (You) the sender
+/// \param [in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \param [in] sysInfo
+/// PCHAR - pointer to sysInfo data that will be placed in the header of the message.
+/// \param [in] length
+/// UI_32 - length of the data buffer provided
+/// \param [in] data
+/// void* - pointer to the data to be sent
+///
+/// \return EFrameworkunifiedStatus
+/// status -
+/// indicates if the message was sent successfully
+/// success >> (eFrameworkunifiedStatusOK)
+/// failure >> (anything else)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSendWithSysInfo(HANDLE hMessage, PCSTR source, UI_32 cmd, PCHAR sysInfo, UI_32 length, PCVOID data,
+ UI_32 sessionid);
+
+// EFrameworkunifiedStatus McSendWithSysInfoWithSession(HANDLE hMessage, PCSTR source,
+// UI_32 cmd, PCHAR sysInfo, UI_32 length, PCVOID data, UI_32 sessionid);
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageCenter
+/// McSendWithSysInfo
+/// Sends data to a message queue, user defined system info.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \param [in] source
+/// LPCSTR - app (You) the sender
+/// \param [in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \param [in] sysInfo
+/// PCHAR - pointer to sysInfo data that will be placed in the header of the message.
+/// \param [in] length
+/// UI_32 - length of the data buffer provided
+/// \param [in] data
+/// void* - pointer to the data to be sent
+/// \param [in] priority
+/// EFrameworkunifiedMessagePriorties - various Message Priorities that a process can assign.
+///
+/// \return EFrameworkunifiedStatus
+/// status -
+/// indicates if the message was sent successfully
+/// success >> (eFrameworkunifiedStatusOK)
+/// failure >> (anything else)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSendPrioWithSysInfo(HANDLE hMessage, PCSTR source, UI_32 cmd, PCSTR sysInfo, UI_32 length, PCVOID data,
+ EFrameworkunifiedMessagePriorties priority, UI_32 sessionid);
+
+// EFrameworkunifiedStatus McSendPrioWithSysInfoWithSession(HANDLE hMessage, PCSTR source,
+// UI_32 cmd, PCSTR sysInfo, UI_32 length, PCVOID data, EFrameworkunifiedMessagePriorties priority, UI_32 sessionid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_MC_SYSTEM_INFO_H_
diff --git a/nsframework/framework_unified/client/include/native_service/ns_message_center_if.h b/nsframework/framework_unified/client/include/native_service/ns_message_center_if.h
new file mode 100755
index 0000000..cfd350f
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_message_center_if.h
@@ -0,0 +1,1536 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * @brief \~english APIs to Open/Close and Send/Receive on message queues and shared memory.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_MESSAGE_CENTER_IF_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_MESSAGE_CENTER_IF_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_shared_mem_if.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McOpenReceiver
+/// \~english @par Brief
+/// Opens a handle to a Receiver message queue.
+/// \~english @param[in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+/// \~english @retval Handle to a recevier's message queue (If INVALID_HANDLE is returned its an error)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size of message queue name string specified by argument(name) is larger then 20byte. [NULL]
+/// - Message queue name specified by argument(name) is NULL. [NULL]
+/// - Size of name normalised from argument(name) for message queue is larger then 15byte[16byte when starts with
+/// "/"]. [NULL]
+/// - Failed to create(malloc) buffer to storage name normalised from argument(name) for message queue. [NULL]
+/// - Failed to get(mq_open) message queue. [NULL]
+/// - Failed to create(malloc) buffer to storage management information of message queue. [NULL]
+/// \~english @par Detail
+/// Create a message queue whose name is specified by argument, and return a handle for receiving message. \n
+/// The message queue created in this API is used to receive message, but not to send message. \n
+/// You can use message queue in McOpenSender to send message.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McReceive, McClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenReceiver(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McOpenReceiverNotBlocked
+/// \~english @par Brief
+/// Opens a handle to a Receiver message queue. Operations on this queue are
+/// non-blocking if queue is empty or full.
+/// \~english @param[in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+/// \~english @retval Handle to a recevier's message queue (If INVALID_HANDLE is returned its an error)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size of message queue name string specified by argument(name) is larger then 20byte. [NULL]
+/// - Message queue name specified by argument(name) is NULL. [NULL]
+/// - Size of name normalised from argument(name) for message queue is larger then 15byte[16byte when starts with
+/// "/"]. [NULL]
+/// - Failed to create(malloc) buffer to storage name normalised from argument(name) for message queue. [NULL]
+/// - Failed to get(mq_open) message queue. [NULL]
+/// - Failed to create(malloc) buffer to storage management information of message queue. [NULL]
+/// \~english @par Detail
+/// Create a message queue whose name is specified by argument, and return a handle for receiving message. \n
+/// The message queue created in this API is used to receive message, but not to send message. \n
+/// You can use message queue in McOpenSender to send message.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McReceive, McClose, McOpenSenderNotBlocked
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenReceiverNotBlocked(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McOpenSyncReceiver
+/// \~english @par Brief
+/// Opens a handle to a response Receiver message queue.
+/// \~english @param[in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+/// \~english @retval Handle to a recevier's message queue (If INVALID_HANDLE is returned its an error)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size of message queue name string specified by argument(name) is larger then 20byte. [NULL]
+/// - Message queue name specified by argument(name) is NULL. [NULL]
+/// - Size of name normalised from argument(name) for message queue(don't start with "/") is larger then 19byte.
+/// [NULL]
+/// - Size of name normalised from argument(name) for message queue(start with "/") is larger then 20byte. [NULL]
+/// - Failed to create(malloc) buffer to storage name normalised from argument(name) for message queue. [NULL]
+/// - Failed to get(mq_open) message queue. [NULL]
+/// - Failed to create(malloc) buffer to storage management information of message queue. [NULL]
+/// \~english @par Detail
+/// Create a message queue whose name is specified by argument, and return a handle for receiving message
+/// by synchronous communication.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// When the application used the message queue acquired by this API, note the following.
+/// - Use McCreateInvokerName to obtain the receive message queue handle to be passed to the parameter name.
+/// - It can not be used transmission because it is for reception.
+/// McOpenSender must be used for the message queue trasmission.
+/// - Cannot be used other than for waiting for response during synchronous communication.
+/// (because the maxmum number of messages in the queue is specified as 2)
+/// - When a message queue name (name) that has not been normalized is specified, transmission falis unless 18 byte are specified.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McCreateInvokerName, McInvokeSync, McClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenSyncReceiver(PCSTR name);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McOpenSender
+/// \~english @par Brief
+/// The opens a handle for sending messages to another message queue.
+/// \~english @param[in] name
+/// PCSTR - name of the message queue you want to send messages too
+/// \~english @retval Handle for sending messages to a queue (If INVALID_HANDLE is returned its an error)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size of message queue name string specified by argument(name) is larger then 20byte. [NULL]
+/// - Message queue name specified by argument(name) is NULL. [NULL]
+/// - Size of name normalised from argument(name) for message queue is larger then 15byte[16byte when starts with
+/// "/"]. [NULL]
+/// - Failed to create(malloc) buffer to storage name normalised from argument(name) for message queue. [NULL]
+/// - Failed to get(mq_open) message queue. [NULL]
+/// - Failed to create(malloc) buffer to storage management information of message queue. [NULL]
+/// \~english @par Detail
+/// Create a message queue whose name is specified by argument, and return a handle for sending message. \n
+/// The message queue created in this API is used to send message, but not to receive message. \n
+/// You can use message queue in McOpenReceiver to receive message.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McSend, McClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenSender(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// The opens a handle for sending messages to another message queue.
+/// operations on this queue are non-blocking if queue is empty or full.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to send messages too
+///
+/// \return HANDLE
+/// handle - for sending messages to a queue (If INVALID_HANDLE is returned its an error)
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenSenderNotBlocked(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McOpenSyncSender
+/// \~english @par Brief
+/// The opens a handle for sending responce to another message queue.
+/// \~english @param[in] name
+/// PCSTR - name of the message queue you want to send messages too
+/// \~english @retval Handle for sending response to a queue (If INVALID_HANDLE is returned its an error)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size of message queue name string specified by argument(name) is larger then 20byte. [NULL]
+/// - Message queue name specified by argument(name) is NULL. [NULL]
+/// - Size of name normalised from argument(name) for message queue(don't start with "/") is larger then 19byte.
+/// [NULL]
+/// - Size of name normalised from argument(name) for message queue(start with "/") is larger then 20byte. [NULL]
+/// - Failed to create(malloc) buffer to storage name normalised from argument(name) for message queue. [NULL]
+/// - Failed to get(mq_open) message queue. [NULL]
+/// - Failed to create(malloc) buffer to storage management information of message queue. [NULL]
+/// \~english @par Detail
+/// Create a message queue whose name is specified by argument, and return a handle for sending message. \n
+/// The message queue created in this API is used to send message, but not to receive message. \n
+/// You can use message queue in McOpenReceiver to receive message.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McSend, McClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenSyncSender(PCSTR name);
+
+/////////////////////////////////////////
+#include <pthread.h>
+HANDLE McOpenSenderChild(PCSTR name, pthread_t childid);
+/////////////////////////////////////////
+
+/////////////////////////////////////////
+EFrameworkunifiedStatus McJoinChild(HANDLE hChildApp);
+/////////////////////////////////////////
+
+/////////////////////////////////////////
+EFrameworkunifiedStatus McGetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio);
+/////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McReceive
+/// \~english @par Brief
+/// Retrieves data from a message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the recvMessage, McOpenRecevier
+/// \~english @param[out] source
+/// PSTR - app that sent this message
+/// \~english @param[out] cmd
+/// UI_32* - command message that has been received.
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[out] data
+/// PVOID - pointer to the data to be received
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName - Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail - Invalid handle of message queue for receiving message
+/// \~english @par Preconditons
+/// Message queue(McOpenReceiver etc.) for receiving message is created.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Data buffer specified by argument(data) for receiving message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Size of data buffer specified by argument(length) for receiving message is 0. [eFrameworkunifiedStatusInvldBuf]
+/// - Buffer to storage application name specified by argument(source) for sending message is NULL.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Buffer to storage commond ID of protocol on the service specified by argument(cmd) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Size of application name of sender getted from received message is lager then 20byte. [eFrameworkunifiedStatusInvldBuf]
+/// - Handle specified by argument(hMessage) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified by argument(hMessage) is not appropriate(which is invalid). [eFrameworkunifiedStatusFail]
+/// - Message queue type of handle specified by argument(hMessage) is not receiving type. [eFrameworkunifiedStatusFail]
+/// - File descriptor for receiving message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when receiving message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for receiving message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// \~english @par Detail
+/// Receives data from message queue specified by argument.
+/// Sets application of sender(source), commond ID of protocol on the service(cmd), receiving data(data), and
+/// return.
+/// It will block until getting message from message queue.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// Since data is exchanged only in the message queue, the data size that can be received is up to 4096 bytes.
+/// \~english @par
+/// The caller must guarantee the allocation of the area for the receive data buffer
+/// and the consistency of the sizes set in the arguments.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McSend
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McReceive(HANDLE hMessage, PSTR source, UI_32 *cmd, UI_32 length, PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McReceiveWithSession
+/// \~english @par Brief
+/// Retrieves data from a message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the recvMessage, McOpenRecevier
+/// \~english @param[out] source
+/// PSTR - app that sent this message
+/// \~english @param[out] cmd
+/// UI_32* - command message that has been received.
+/// \~english @param[out] sessionid
+/// UI_32* - Session ID
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[out] data
+/// PVOID - pointer to the data to be received
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName - Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail - Invalid handle of message queue for receiving message
+/// \~english @par Preconditons
+/// Message queue(McOpenReceiver etc.) for receiving message is created.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Buffer to storage session ID specified by argument(sessionid) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Buffer to storage handle of message queue specified by argument(hMessage) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Data buffer specified by argument(data) for receiving message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Size of data buffer specified by argument(length) for receiving message is 0. [eFrameworkunifiedStatusInvldBuf]
+/// - Buffer to storage application name specified by argument(source) for sending message is NULL.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Buffer to storage commond ID of protocol on the service specified by argument(cmd) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Size of application name of sender getted from received message is lager then 20byte. [eFrameworkunifiedStatusInvldBuf]
+/// - Handle specified by argument(hMessage) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified by argument(hMessage) is not appropriate(which is invalid). [eFrameworkunifiedStatusFail]
+/// - Message queue type of handle specified by argument(hMessage) is not receiving type. [eFrameworkunifiedStatusFail]
+/// - File descriptor for receiving message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when receiving message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for receiving message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// \~english @par Detail
+/// Receives data from message queue specified by argument.Sets application of sender(source),
+/// commond ID of protocol on the service(cmd), receiving data(data), session id(sessionid), and return.
+/// It will block until getting message from message queue.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// The caller must guarantee the allocation of the area for the receive data buffer
+/// and the consistency of the sizes set in the arguments.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McSendWithSession
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McReceiveWithSession(HANDLE hMessage, PSTR source, UI_32 *cmd, UI_32 *sessionid,
+ UI_32 length, PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetLength
+/// \~english @par Brief
+/// Get the length of data that needs to be retrieved.
+/// \~english @param[in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+/// \~english @retval UI_32 indicates the number of bytes that in the message
+/// \~english @par
+/// if return is 0 or less then invalid data was passed.
+/// \~english @par Preconditons
+/// - Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Data of received message(data) is NULL. [0]
+/// \~english @par Detail
+/// Return message data length specified by the header of received message. \n
+/// Use this data length as the buffer size specified by McGetDataOfSize.
+/// \~english @par
+/// This API does not distinguish between error and no data.
+/// \~english @par
+/// The parameter data of this API must be the data obtained from the message queue by McReceive, etc.
+/// (Since the data obtained from the message queue incudes header information,
+/// this API acquires necessary iformation from the header)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McReceive, McReceiveWithSession, McGetDataOfSize
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 McGetLength(PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetDataPointer
+/// \~english @par Brief
+/// Get header address of data from received message.
+/// \~english @param[in] data
+/// PVOID - received message data
+/// \~english @retval PVOID - data address of received message
+/// \~english @par Preconditons
+/// Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Data of received message(data) is NULL. [NULL]
+/// \~english @par Detail
+/// Get header address of data from received message excepting the header and system information.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Since the pointer acquired by this API is part of the received message passed as an argument to this API,
+/// the pointer must not be released by specifying he address acquired by this API.
+/// - The parameter data of this API must be the data obtained from the message queue by McReceive, etc.
+/// (Since the data obtained from the message queue incudes header information,
+/// this API acquires necessary iformation from the header)
+/// - When the next message is received, the internally held data is discarded.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McReceive, McReceiveWithSession, McGetDataOfSize
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID McGetDataPointer(PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetDataOfSize
+/// \~english @par Brief
+/// Get the message data, this may be from a queue or shared memory where the maximum
+/// size of the data should not exceed the maximum size passed in.
+/// And deletes the data if it is stored in shared memory.
+/// \~english @param[in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+/// \~english @param[in] to
+/// PVOID - pointer to the data to be received
+/// \~english @param[in] uiSize
+/// UI_32 - maximum size of the buffer to which the received data is copied
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK - success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusErrOther - invalid shared memory ID specified by received message
+/// \~english @par Preconditons
+/// - Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size specified by argument(uiSize) is smaller then size of received message data(data).
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Data of received message(data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Pointer to buffer(to) which is used to storage data getted from message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Received message data specified by argument(data) is invalid. [eFrameworkunifiedStatusInvldHndlType]
+/// - Failed to access(shm_open/fstat/mmap) the shared memory of received message data(data).
+/// [eFrameworkunifiedStatusErrOther]
+/// - Shared memory ID specified by received message is invalid. [FrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Get data from received message excepting the header and system information.
+/// Delete data storaged in shared memory after getting the data successfully.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - In the case where he received message data becomes 0byte, there is no need to call this API,
+/// and be careful not to allocate the memory for the received message data by 0byte.
+/// - Error details related to shared memory access canno be detected.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McGetLength
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McGetDataOfSize(PVOID data, PVOID to, UI_32 uiSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetDataOfSizeWithSMRetain
+/// \~english @par Brief
+/// Get the message data, this may be from a queue or shared memory where the maximum
+/// size of the data should not exceed the maximum size passed in.
+/// Does not delete the data if it is stored in shared memory.
+/// \~english @param[in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+/// \~english @param[in] to
+/// PVOID - pointer to the data to be received
+/// \~english @param[in] uiSize
+/// UI_32 - maximum size of the buffer to which the received data is copied
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK - success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusErrOther - invalid shared memory ID specified by received message
+/// \~english @par Preconditons
+/// - Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size specified by argument(uiSize) is smaller then size of received message data(data).
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Data of received message(data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Pointer to buffer(to) which is used to storage data getted from message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Received message data specified by argument(data) is invalid. [eFrameworkunifiedStatusInvldHndlType]
+/// - Failed to access(shm_open/fstat/mmap) the shared memory of received message data(data).
+/// [eFrameworkunifiedStatusErrOther]
+/// - Shared memory ID specified by received message is invalid. [FrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Get data from received message excepting the header and system information.
+/// Does not delete data storaged in shared memory after getting the data successfully.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - In the case where he received message data becomes 0byte, there is no need to call this API,
+/// and be careful not to allocate the memory for the received message data by 0byte.
+/// - Error details related to shared memory access canno be detected.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// McReceive
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McGetDataOfSizeWithSMRetain(PVOID data, PVOID to, UI_32 uiSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetSysInfoData
+/// \~english @par Brief
+/// Gets the data from system info buffer from message header.
+/// \~english @param[in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+/// \~english @param[out] to
+/// PVOID - pointer to the data to be received
+/// \~english @retval EFrameworkunifiedStatus indicates if the close was successfully
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @par Preconditons
+/// Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Data of received message(data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Pointer to buffer(to) which is used to storage system info getted from message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Received message data specified by argument(data) is invalid. [eFrameworkunifiedStatusInvldHndlType]
+/// \~english @par Detail
+/// Gets system info from received message, and set argument(to) with it. \n
+/// If there is no system info in received message,and set argument(to) with "\0".
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - The parameter data of this API must be the data obtained from the message queue by McReceive, etc.
+/// (Since the data obtained from the message queue incudes header information,
+/// this API acquires necessary iformation from the header)
+/// - Since the system information is 64 bytes (including the null character), the area of 64 byte must be allocated in the argument to fo this API.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McReceive, McReceiveWithSession
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McGetSysInfoData(PVOID data, PVOID to);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McClearData
+/// \~english @par Brief
+/// Clears the data that may be pending for the a message in shared memory.
+/// \~english @param[in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+/// \~english @retval EFrameworkunifiedStatus indicates if the data was clear successfully
+/// \~english @retval eFrameworkunifiedStatusOK - success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldID - invalid ID
+/// \~english @retval eFrameworkunifiedStatusFail - other errors
+/// \~english @par Preconditons
+/// - Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Data of received message(data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Received message data specified by argument(data) is invalid. [eFrameworkunifiedStatusInvldParam]
+/// - Shared memory ID in received message is invalid. [eFrameworkunifiedStatusInvldParam]
+/// - Shared memory specified by ID in received message does not exist. [eFrameworkunifiedStatusInvldID]
+/// - Failed to delete shared memory specified by ID in received message. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Delete data from received message.
+/// And delete the received message data if it is stored in shared memory.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McReceive, McReceiveWithSession
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McClearData(PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McSend
+/// \~english @par Brief
+/// Sends data to a message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @param[in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[in] data
+/// PCVOID - pointer to the data to be sent
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK - Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer - NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName - Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull - Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF I- nvalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail - Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther - other errors(Failed to open/allocate shared memory)
+/// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+/// \~english @par Preconditons
+/// - Message queue(McOpenSender) for sending message is created.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Application name of sender specified in the argument (source) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Application name of sender specified in the argument (source) exceeds 20byte. [eFrameworkunifiedStatusInvldQName]
+/// - Sender data does not match sender data size(size is larger then 0, and data is NULL). [eFrameworkunifiedStatusInvldBuf]
+/// - Message queue type of handle specified by argument(hMessage) is not sending type. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when sending message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for sending message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// - Some errors occur, when sending message. [eFrameworkunifiedStatusFail]
+/// - Failed to access(shm_open/ftruncate/mmap) the shared memory for sending message data. [eFrameworkunifiedStatusErrOther]
+/// - Sending data size specified in the argument (length) is out of range. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// It is an asynchronous API. It provides function to send message by message queue. \n
+/// Message queue name created by McOpenSender is the sender.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// Command ID must be within the range PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD(0x10) to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD(0xFFFFFFF0).
+/// Even if a command ID out of range is specified, a message is sent by the command ID (no erro occurs).
+/// Command ID out of range are resered ID used for session connection, etc.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - The maximum transmission data size (ength) described above is a theoretical value,
+/// and the maximum actually usable data size depends on the environment requirements.\n
+/// The maximum value is the upper limit of the type (UNIT_MAX) minus the following size.\n
+/// Message header section \n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address
+/// of the pointer (data) to the data buffer does not match the size specified by the size of the data buffer (length).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McSendWithSession, McReceive
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSend(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McSendWithSession
+/// \~english @par Brief
+/// Sends data to a message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @param[in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[in] data
+/// PCVOID - pointer to the data to be sent
+/// \~english @param[in] sessionid
+/// UI_32 - session id
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK - Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer - NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName - Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull - Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail - Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther - other errors(Failed to open/allocate shared memory)
+/// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+/// \~english @par Preconditons
+/// - Message queue(McOpenSender) for sending message is created.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Application name of sender specified in the argument (source) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Application name of sender specified in the argument (source) exceeds 20byte. [eFrameworkunifiedStatusInvldQName]
+/// - Sender data does not match sender data size(size is larger then 0, and data is NULL). [eFrameworkunifiedStatusInvldBuf]
+/// - Message queue type of handle specified by argument(hMessage) is not sending type. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when sending message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for sending message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// - Some errors occur, when sending message. [eFrameworkunifiedStatusFail]
+/// - Failed to access(shm_open/ftruncate/mmap) the shared memory for sending message data. [eFrameworkunifiedStatusErrOther]
+/// - Sending data size specified in the argument (length) is out of range. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// It is an asynchronous API. It provides function to send message by message queue. \n
+/// Message queue name created by McOpenSender is the sender.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// Command ID must be within the range PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD(0x10) to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD(0xFFFFFFF0).
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - McSend should be used if no sessionid is specified.
+/// - To communicate with an application that uses NS Framework Dispatcher, use FrameworkunifiedSendMsg, etc.
+/// - The maximum transmission data size (length) described above is a theoretical value,
+/// and the maximum actually usable data size depends on the environment requirements.\n
+/// - The maximum value is the upper limit of the type (UNIT_MAX) minus the following size.\n
+/// Message header section\n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address
+/// of the pointer (data) to the data buffer does not match the size specified by the size of the data buffer (length).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McSend, McReceiveWithSession, FrameworkunifiedSendMsg
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSendWithSession(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data, UI_32 sessionid);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McSendWithPriority
+/// \~english @par Brief
+/// Sends data to a message queue, inserts based on priority given.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @param[in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[in] data
+/// PCVOID - pointer to the data to be sent
+/// \~english @param[in] sessionid
+/// UI_32 - session id
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK(success)
+/// \~english @retval eFrameworkunifiedStatusFail(anything else)
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hMessage) or hMessage is NULL.
+/// - It is an incorrect value(source) or hMessage is NULL.
+/// - It is an incorrect value(data) or hMessage is NULL.
+/// - It is an incorrect value(priority).
+/// - It is an incorrect value(sessionid).
+/// \~english @par Detail
+/// Invoke callback function with arguments to send data to message queue based on priority given.\n
+/// If callback function is null and expectedCalls is '0', using default function 'McSendWithPriority' to send
+/// data to message queue based on priority given.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// Command ID must be within the range PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD(0x10) to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD(0xFFFFFFF0).
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - McSend should be used if no sessionid is specified.
+/// - To communicate with an application that uses NS Framework Dispatcher, use FrameworkunifiedSendMsg, etc.
+/// - The maximum transmission data size (length) described above is a theoretical value,
+/// and the maximum actually usable data size depends on the environment requirements.\n
+/// The maximum value is the upper limit of the type (UNIT_MAX) minus the following size.\n
+/// Message header section\n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address
+/// of the pointer (data) to the data buffer does not match the size specified by the size of the data buffer (length).
+/// \~english @par
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+// McOpenSender, McSend, McSendWithSession, FrameworkunifiedSendMsg
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSendWithPriority(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data,
+ EFrameworkunifiedMessagePriorties priority, UI_32 sessionid);
+
+// EFrameworkunifiedStatus McSendWithPriorityWithSession(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data,
+// EFrameworkunifiedMessagePriorties priority, UI_32 sessionid);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McInvokeSync
+/// \~english @par Brief
+/// Synchronous Invoke. Send data to message queue, and Receive data from message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @param[in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \~english @param[in] msgLength
+/// UI_32 - length of the data buffer provided
+/// \~english @param[in] msgData
+/// PCVOID - pointer to the data to be sent
+/// \~english @param[in] sessionid
+/// UI_32 - session ID
+/// \~english @param[in] hRcvMessage
+/// HANDLE - handle to the receive message queue, McOpenSyncReceiver
+/// \~english @param[in] responseLength
+/// UI_32 - length of the responnce receive buffer provided
+/// \~english @param[out] responseData
+/// PVOID - pointer to the data to be receive
+/// \~english @param[out] receivedLength
+/// UI_32* - length of the data to be receive
+/// \~english @retval EFrameworkunifiedStatus indicates invoke response or message sent error or response receive error
+/// \~english @retval eFrameworkunifiedStatusOK - success
+/// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName - Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull - Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusBadConnection - Can't connect with Socket
+/// \~english @retval eFrameworkunifiedStatusFail - Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther - other errors(Failed to open/allocate shared memory)
+/// \~english @par Preconditons
+/// - Message queue specified by argument hMessage and hRcvMessage is useful.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Message queue handle specified in the argument (hMessage) for sending message is NULL.
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue handle specified in the argument (hMessage) for sending message is not appropriate (which is
+/// invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue handle specified in the argument (hRcvMessage) for receiving message is NULL.
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue handle specified in the argument (hRcvMessage) for receiving message is not appropriate (which
+/// is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Size of buffer(responseLength) which is used to storage received message is not 0,
+/// but the pointer to this buffer(responseData) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to create buffer to storage the response message. [eFrameworkunifiedStatusFail]
+/// - Failed to generete random number of the sequence ID for sending message. [eFrameworkunifiedStatusFail]
+/// - Data size of sending message is not 0, but the message data(msgData) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Application name of sender specified in the argument (source) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Application name of sender specified in the argument (source) exceeds 20byte. [eFrameworkunifiedStatusInvldQName]
+/// - Name of message queue handle specified in the argument (hMessage) for sending message is NULL.
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Name of message queue handle specified in the argument (hMessage) for sending message exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Size of sending message specified in the argument is not 0,
+/// but the pointer to sending message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Message queue type of handle specified by argument(hMessage) is not sending type. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending message is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of message queue for sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when sending message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for sending message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// - Some errors occur, when sending message. [eFrameworkunifiedStatusFail]
+/// - Failed to access the shared memory for sending message data. [eFrameworkunifiedStatusErrOther]
+/// - Failed to connect with the socket(socket/bind/connect) for checking the connection with application of
+/// sender. [eFrameworkunifiedStatusFail]
+/// - Failed to wait(epoll_create/epoll_ctl/epoll_wait) for receiving response message. [eFrameworkunifiedStatusFail]
+/// - Failed to reconnect with the socket(socket/bind/connect) for checking the connection with application of
+/// sender. [eFrameworkunifiedStatusBadConnection]
+/// - Application name of sender in response message exceeds 20byte.[eFrameworkunifiedStatusInvldBuf]
+/// - Message queue type of handle specified by argument(hMessage) is not receiving type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - File descriptor of message queue for receiving message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when receiving message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for receiving message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// - Received message is storaged in shared memory, but data size of shared memory is 0. [eFrameworkunifiedStatusErrOther]
+/// - Failed to create buffer(calloc) to storage date getted from shared memory. [eFrameworkunifiedStatusFail]
+/// - Failed to access(shm_open/fstat/mmap) the shared memory for receiving message data. [eFrameworkunifiedStatusErrOther]
+/// - Data size of received message specified by argument(receivedLength) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Sending data size specified in the argument (msgLength) is out of range. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// It provides synchronous communication for message queue between sender and receiver specified in the
+/// argument. \n
+/// As it is a synchronous function, after sending a message, the sender will wait until getting response form
+/// receiver.
+/// After receiving the response, set responseData with the received data and return.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// When data larger than the receive message storage buffer size (resposeLength) is received,
+/// the write size to the receive message storage buffer (responseData) does not exceed the specified size,
+/// but the receive size is set in the receive message data length (recievedLength) as is.
+/// \~english @par
+/// The caller must guarantee the allocation of the receive message storage buffer (resonseData) area
+/// and the consistency of the receive message stoage buffer sizes (resposeLength).
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API stores up to the storage buffer length (responseLength) and returs eFrameworkunifiedStatusOK even
+/// if the received reply message is larger than the storage buffer (responseData) size.\n
+/// Therefore, the application shoud compare the received message length (recievedLenght) and the storage buffer length (responseLength) even
+/// if this API returns eFrameworkunifiedStatusOK, and detect the above.
+/// - Specify 0 for the sessionid of argument.
+/// If a value other than 0 is specified, no error occurs and the value is used as is.
+/// - To communicate with an application that uses NS Framework Dispatcher, use FrameworkunifiedInvokeSync, etc.
+/// - The maximum data lenght (msgLength) of sent messages is a theoretical value,
+/// and the maximum value that can be actually used is environment-depedent.\n
+/// The maximum value is the upper limit of the type (UNIT_MAX) minus the following size.\n
+/// Message header section, System information department in messages\n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address
+/// of the pointer (msgData) to the data buffer does not match the size specified by the size of the data buffer (msgLength).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McOpenSyncReceiver, FrameworkunifiedInvokeSync
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McInvokeSync(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 msgLength, PCVOID msgData, UI_32 sessionid,
+ HANDLE hRcvMessage, UI_32 responseLength, PVOID responseData, UI_32 *receivedLength);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McSendSyncResponse
+/// \~english @par Brief
+/// Sends response to a message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSyncSender
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @param[in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \~english @param[in] seq_id
+/// UI_32 - response sequence ID
+/// \~english @param[in] ret_val
+/// EFrameworkunifiedStatus - response status
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[in] data
+/// PCVOID - pointer to the data to be sent
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - If handle is NULL or invalid
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType -if handle type is invalid
+/// \~english @retval eFrameworkunifiedStatusInvldQName - if MQ name is invalid
+/// \~english @retval eFrameworkunifiedStatusMsgQFull - if MQ is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - if fd is invalid
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - if system call(signal) interupt occurs
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize -if buffer size is invalid
+/// \~english @retval eFrameworkunifiedStatusInvldBuf -if buffer is invalid
+/// \~english @retval eFrameworkunifiedStatusFail - any other error
+/// \~english @retval eFrameworkunifiedStatusErrOther -other error(memory open/allocate fail)
+/// \~english @par Preconditons
+/// - The message queue specified by argument hMessage of this API must be allocated
+/// in advance by McOpenSender and McOpenSyncSender.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - sending MQ handle(designated by parameter)is NULL[eFrameworkunifiedStatusInvldHandle]
+/// - sending MQ handle(designated by parameter)is invalid[eFrameworkunifiedStatusInvldHandle]
+/// - the type of sending MQ handle(designated by parameter)is not sending type[eFrameworkunifiedStatusInvldHndlType]
+/// - application name(source,designated by parameter)is NULL[eFrameworkunifiedStatusInvldQName]
+/// - the length of application name(designated by parameter)is over 20byte[eFrameworkunifiedStatusInvldQName]
+/// - sending data not in accordance with the size of sending data(eg:size is not 0 but data is NULL)
+/// [eFrameworkunifiedStatusInvldBuf]
+/// - sending data MQ is full [eFrameworkunifiedStatusMsgQFull]
+/// - fd of sending data MQ is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - system call(signal) interupt occurs during MQ receiveing process[eFrameworkunifiedStatusErrNoEINTR]
+/// - the size of receiveing MQ buffer is invalid[eFrameworkunifiedStatusInvldBufSize]
+/// - error occurs during MQ receiveing process [eFrameworkunifiedStatusFail]
+/// - failed to access shared memmory for sending message[eFrameworkunifiedStatusErrOther]
+/// - failed to allocate buffer for data retriving from shared memmory[eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// set the response data to buffer and call this API
+/// when need to response to synchronous message get from synchronous communication(McInvokeSync)
+/// \~english @par
+/// This API applies communication function(using message queue)between processes to the application which do not
+/// use
+/// Dispatcher of NS Framework
+/// \~english @par
+/// cautions when using this API
+/// - Use FrameworkunifiedSetSyncResponseData if communacate with application which use the Dispatcher of NS Framework\n
+/// - the limit of size for sending data is according to system
+/// but the total size of SSystemMsgHeader and ResponseHeader shared memmory header is 48byte
+/// size limit should be(UINT_MAX-48byte)
+/// - operation is not guaranteed if the size which shown in data buffer pointer(data) is not in
+/// accordance with the length set in data buffer
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McOpenSyncReceiver, McInvokeSync, FrameworkunifiedSetSyncResponseData
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSendSyncResponse(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 seq_id, EFrameworkunifiedStatus ret_val, UI_32 length,
+ PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McCreateInvokerName
+/// \~english @par Brief
+/// Create synchronous invoke response MQ name.
+/// \~english @param[in] source
+/// PCSTR - source service name
+/// \~english @param[in] sessionid
+/// UI_32 - session id
+/// \~english @param[in] invokerName
+/// PSTR - create invoker name buffer
+/// \~english @param[in] size
+/// UI_32 - InvokerName buffer size
+/// \~english @retval EFrameworkunifiedStatus indicates if the close was successfully
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusInvldParam -if parameter is invalid
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - sender application name(source,designated by parameter) is NULL[eFrameworkunifiedStatusInvldParam]
+/// - synchronous communication MQ name(invokerName,designated by parameter) is NULL[eFrameworkunifiedStatusInvldParam]
+/// - the size of synchronous communication MQ name buffer(designated by parameter)is NULL[eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// This API will add specific letters to the end of sender application name and return it as synchronous
+/// communication MQ name
+/// This name will be used when application create the MQ through McOpenSyncReceiver
+/// \~english @par
+/// cautions when using this API:
+/// - the synchronous communication MQ name(invokerName) buffer size should be larger than the length of source
+/// application
+/// name(at least 4byte larger)
+/// - source application name(designated by parameter) should be less than 15byte(according to NS framework
+/// spec,error occurs
+/// if message name length is over 20byte
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSyncReceiver
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McCreateInvokerName(PCSTR source, UI_32 sessionid, PSTR invokerName, UI_32 size);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McClose
+/// \~english @par Brief
+/// Close a connection to a Receiver message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle that will be closed
+/// \~english @retval EFrameworkunifiedStatus indicates if the close was successfully
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - If hMessage is NULL or invalid
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - if hMessage is invalid
+/// \~english @par Preconditons
+/// message queue(McOpenSender, McOpenReceiver) is created in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(hMessage,designated by parameter) is NULL[eFrameworkunifiedStatusInvldHandle]
+/// - handle(hMessage,designated by parameter) is invalid[eFrameworkunifiedStatusInvldHandle]
+/// - the type of handle(designated by parameter) is neither sending or receiveing[eFrameworkunifiedStatusInvldHndlType]
+/// - fail to close the message queue(mq_close)[eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// close the message sending or receiveing message queue which is designated by parameter\n
+/// Application can call this API to close the message queue which is created by McOpenSender
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McOpenReceiver, McOpenSyncReceiver
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McClose(HANDLE hMessage);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetDataUSID
+/// \~english @par Brief
+/// Get the USID is the Unique Shared Memory ID.e. from the message that was received.
+/// \~english @param[in] pData
+/// void* - pointer to the data was received from the McReceive Call
+/// \~english @retval TMemID Type of memory buffer identifiers(unsigned int).
+/// \~english @retval NoneZero(Success)
+/// \~english @retval Zero(Failed)
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(pData) or pData is NULL.
+/// \~english @par Detail
+/// Invoke callback function with arguments to get the USID from the message that was received.\n
+/// If callback function is null and expectedCalls is '0', using default function 'McGetDataUSID' to get the USID
+/// from the message that was received.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+// FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage
+//////////////////////////////////////////////////////////////////////////////////////////////
+TMemID McGetDataUSID(PVOID pData);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetMsgSrc
+/// \~english @par Brief
+/// Gets the constant pointer to source message queue.
+/// \~english @param[in] data
+/// PVOID - pointer to the data to be received
+/// \~english @retval PCSTR message queue's address
+/// CONST char* - constant pointer to source message queue
+/// \~english @retval NotNull(Success)
+/// \~english @retval Null(Failed)
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(data) or data is NULL.
+/// \~english @par Detail
+/// Invoke callback function with arguments to get the constant pointer to source message queue.\n
+/// If callback function is null and expectedCalls is '0', using default function 'McGetMsgSrc' to the constant
+/// pointer to source message queue.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+// frameworkunifiedSendSyncResponse, frameworkunifiedProcessSyncResponse
+//////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR McGetMsgSrc(PVOID data);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McForward
+/// \~english @par Brief
+/// Forward a Message to indicate that there is a Shared Memory
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \~english @param[in] source
+/// PCSTR - the sender of this forwarding message.
+/// \~english @param[in] iCmd
+/// UI_32 - Command Id message to forward
+/// \~english @param[in] USID
+/// UI_32 - Unique Shared memory Id
+/// \~english @retval EFrameworkunifiedStatus indicates if the close was successfully
+/// CONST char* - constant pointer to source message queue
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Failed(anything else)
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hMessage) or hMessage is NULL.
+/// - It is an incorrect value(source) or source is NULL.
+/// - It is an incorrect value(iCmd).
+/// - It is an incorrect value(USID).
+/// \~english @par Detail
+/// Invoke callback function with arguments to forward a Message.\n
+/// If callback function is null and expectedCalls is '0', using default function 'McForward' to forward a
+/// Message.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+// FrameworkunifiedForwardMessage
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McForward(HANDLE hMessage, PCSTR source, UI_32 iCmd, TMemID USID);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McFlushReceiver
+/// \~english @par Brief
+/// Flush's all data on HANDLE's Receiver message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the recvMessage queue that will be flushed
+/// \~english @retval void
+/// \~english @par Preconditons
+/// message queue(McOpenReceiver)is created in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(hMessage,designated by parameter) is NULL
+/// - handle(hMessage,designated by parameter) is invalid [-1]
+/// - the type of handle(designated by parameter) is neither sending or receiveing[-1]
+/// \~english @par Detail
+/// message will not be flushed if process failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McOpenReceiver, McOpenSyncReceiver
+////////////////////////////////////////////////////////////////////////////////////////////
+void McFlushReceiver(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetQueueName
+/// \~english @par Brief
+/// Gets the name of the message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle of the message queue,
+/// (handle created with McOpenReceiver or McOpenSender)
+/// \~english @retval PCSTR name - name of the message queue if handle is valid else NULL
+/// \~english @par Preconditons
+/// Dispatcher for application should be created and initilized(FrameworkunifiedCreateDispatcherWithoutLoop)in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(hMessage,designated by parameter) is NULL
+/// - handle(hMessage,designated by parameter) is invalid [-1]
+/// - the type of handle(designated by parameter) is neither sending or receiveing[-1]
+/// \~english @par Detail
+/// return the name of specific message queue
+/// this APL is used for application to supervize message queue
+/// \~english @par
+/// This API applies communication function(using message queue)between processes to the application which do not
+/// use
+/// Dispatcher of NS Framework
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McOpenSender
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR McGetQueueName(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetQueueFD
+/// \~english @par Brief
+/// Gets the fd of the message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle of the message queue.(handle created with McOpenReceiver or McOpenSender)
+/// \~english @retval int fd - fd of the message queue if handle is valid else -1
+/// \~english @par Preconditons
+/// - Dispatcher for application is created and initialized(FrameworkunifiedCreateDispatcherWithoutLoop) in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(hMessage,designated by parameter) is NULL
+/// - handle(hMessage,designated by parameter) is invalid [-1]
+/// - the type of handle(designated by parameter) is neither sending or receiveing[-1]
+/// \~english @par Detail
+/// return the fd of specific message queue
+/// this APL is used for application to supervize message queue
+/// \~english @par
+/// This API applies communication function(using message queue)between processes to the application which do not
+/// use
+/// Dispatcher of NS Framework
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McOpenSender
+////////////////////////////////////////////////////////////////////////////////////////////
+int McGetQueueFD(HANDLE hMessage);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McTranslateError
+/// \~english @par Brief
+/// Translates global error variables into FW EFrameworkunifiedStatus
+/// \~english @param[in] error
+/// int - error variable
+/// \~english @retval EFrameworkunifiedStatus indicates frameworkunified error type
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(error).
+/// \~english @par Detail
+/// Invoke callback function with arguments to translates global error variables.\n
+/// If callback function is null and expectedCalls is '0', using default function 'McTranslateError' to translates
+/// global error variables.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+// none
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McTranslateError(int error);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McZcSetParam
+/// \~english @par Brief
+/// set variable parameter to messeg-sending header
+/// \~english @param[in] handle
+/// HANDLE - handle to the send message queue, McZcOpenSender
+/// \~english @param[in] cmd
+/// UI_32 -cmd for sending(ID to identify protocol of service)
+/// \~english @param[in] length
+/// UI_32 -size of buffer for message-sending
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was set successfully
+/// \~english @retval eFrameworkunifiedStatusOK sucess
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - If hMessage is NULL or invalid
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - invalid buffer size
+/// \~english @par Preconditons
+/// message queue is created by McZcOpenSender in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(designated by parameter) is NULL[NULL]
+/// - handle(designated by parameter) is invalid [NULL]
+/// - the buffer for sending in handle(designated by parameter) is NULL[NULL]
+/// - the size of data for sending(designated by parameter)(except header) is larger than the size of
+/// sending-buffer[eFrameworkunifiedStatusInvldBufSize]
+/// \~english @par Detail
+/// set the variable sending cmd and sending data length in sending buffer of message-sending handle
+/// This API will only do the initialization of message header.detail setting of data for sending will be done\n
+/// Application can use McZcGetBuf to do data setting
+/// \~english @par
+/// CMD ID should be in (PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD(0x10) to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD(0xFFFFFFF0))
+/// \~english @par
+/// cautions when using this API
+/// - detail data sending size should be in accordance with the data sending size which is set in this API
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McZcGetBuf, McZcSend
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McZcSetParam(HANDLE handle, UI_32 cmd, UI_32 length);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McZcGetBuf
+/// \~english @par Brief
+/// get the fist address of buffer for sending
+/// \~english @param[in] handle
+/// HANDLE - handle to the send message queue, McZcOpenSender
+/// \~english @retval PVOID the first address of buffer for data-sending
+/// \~english @retval NULL NULL pointer(fail to get)
+/// \~english @par Preconditons
+/// message queue is created by McZcOpenSender in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(designated by parameter) is NULL[NULL]
+/// - handle(designated by parameter) is invalid [NULL]
+/// - the buffer for sending in handle(designated by parameter) is NULL[NULL]
+/// \~english @par Detail
+/// get the first address of data(excpet the message-header)from sending-buffer in message-sending handle
+/// application will set the address got as sending message
+/// \~english @par
+/// cautions When using the application
+/// - result will not be guaranteed if the handle set is different from message-sending queue handle
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McZcGetBuf
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID McZcGetBuf(HANDLE handle);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McZcSend
+/// \~english @par Brief
+/// send message
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the sendMessage, McZcOpenSender
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - If hMessage is NULL or invalid
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - buffer is invalid
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType -handle type is invalid
+/// \~english @retval eFrameworkunifiedStatusMsgQFull - message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - file descriptor invalid
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR -system call(signal) interupt
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize -invalid buffer size
+/// \~english @par Preconditons
+/// message queuqe is created by McZcOpenSender
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(hMessage,designated by parameter)is NULL[eFrameworkunifiedStatusInvldHandle]
+/// - handle(hMessage,designated by parameter)is invalid[eFrameworkunifiedStatusInvldHandle]
+/// - the sending-buffer in handle(hMessage,designated by parameter)is NULL[eFrameworkunifiedStatusInvldBuf]
+/// - the type of message queue in handle(hMessage,designated by parameter)is not sending
+/// type[eFrameworkunifiedStatusInvldHndlType]
+/// - message-sending queue is full[eFrameworkunifiedStatusMsgQFull]
+/// - file descriptor of message-sending queue is invalid[eFrameworkunifiedStatusErrNoEBADF]
+/// - system call(singal) interupts during the message sending process[eFrameworkunifiedStatusErrNoEINTR]
+/// - the size of buffer for message-sending is invalid[eFrameworkunifiedStatusInvldBufSize]
+/// \~english @par Detail
+/// send message using specific message-sending handle.\n
+/// data for sending should be set to message-sending handle(hMessage)beforhead using McZcSetParam, McZcGetBuf
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method
+/// \~english @see McZcOpenSender, McZcSetParam, McZcGetBuf
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McZcSend(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McZcOpenSender
+/// \~english @par Brief
+/// create message-sending queuqe
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @retval Handle for sending messages to a queue (If INVALID_HANDLE is returned its an error)
+/// \~english @retval NULL NULL pointer(fail to get)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - message queue name(designated by parameter)is NULL[NULL]
+/// - the length of message queue name(designated by parameter)(source) is over 20byte[NULL]
+/// - fail to get memmory for restoring formated message queue name [NULL]
+/// - length of formated message queue name is over 15byte or 16byte(when initial letter is'/')[NULL]
+/// - fail to get message queue(mq_open)[NULL]
+/// - fail to get memmory for message queue info managment(malloc)[NULL]
+/// - fail to get memory for sending buffer[NULL]
+/// \~english @par Detail
+/// create message queuqe and return the handle
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McZcSetParam, McZcGetBuf, McZcSend, McZcClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McZcOpenSender(PCSTR source);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McZcClose
+/// \~english @par Brief
+/// close the handle to message queue
+/// \~english @param[in] handle
+/// HANDLE - handle to the send message queue, handle got through McZcOpenSender
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was close successfully
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - If hMessage is NULL or invalid
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType If handle type is invalid
+/// \~english @par Preconditons
+/// - message queue is created by McZcOpenSender in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - message handle(designated by parameters) is NULL[eFrameworkunifiedStatusInvldHandle]
+/// - message handle(designated by parameters) is invalid [eFrameworkunifiedStatusInvldHandle]
+/// - message handle type(designated by parameters) is not match(neither send or receive)[eFrameworkunifiedStatusInvldHndlType]
+/// - fail to close message queue(mq_close)[eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Close message-sending or message-receiving handle(designated by parameters)\n
+/// application call this function to close message queue which is created by McZcOpenSender.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McZcOpenSender
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McZcClose(HANDLE handle);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NATIVESERVICES_MESSAGE_CENTER_IF_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_msgs.h b/nsframework/framework_unified/client/include/native_service/ns_msgs.h
new file mode 100755
index 0000000..48c83e7
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_msgs.h
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageCenter
+/// \brief
+///
+/// Header defines the messaging IF header that will be at the start of each message.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MSGS_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MSGS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_shared_mem_if.h>
+
+#define MC_EMSGT_VALID_TOKEN (0xC8 << 24)
+#define MC_EMSGT_VALID_MASK (0xFF << 24)
+#define MC_EMSGT_VALID(t) ((t & MC_EMSGT_VALID_MASK) == MC_EMSGT_VALID_TOKEN) // NOLINT (readability/nolint)
+
+#define MC_EMSGT_SHM_MASK (0x1 << 0)
+#define MC_EMSGT_IS_SHM(t) (t & MC_EMSGT_SHM_MASK) // NOLINT (readability/nolint)
+
+#define MC_EMSGT_SYNC_MASK (0x1 << 1)
+#define MC_EMSGT_IS_SYNC(t) (t & MC_EMSGT_SYNC_MASK) // NOLINT (readability/nolint)
+
+#define MC_EMSGT_SYSINFO_MASK (0x1 << 2)
+#define MC_EMSGT_HAS_SYSINFO(t) (t & MC_EMSGT_SYSINFO_MASK) // NOLINT (readability/nolint)
+
+#pragma pack(1)
+/// \brief brief description of Messages Header that's pass via Message Center.
+/// Note: Don't remove #paragma pack(1) this is required for the
+/// ARM processor, forces data structures to be on a byte boundary
+/// all messages should be place in between #pragma pack(1) and #pragma pack()
+typedef struct tSysMsgHeader {
+ UI_32 eType; // The type of the message
+ TMemID memId; // Unique MemID of the data stored in shared memory,
+ // this is only valid if eType == IPC_MSG_SHM_TYPE
+ struct {
+ CHAR source[MAX_QUEUE_NAME_SIZE]; // Task that's sending the message.
+ UI_32 command; // The command id of the message
+ UI_32 length; // The length of the complete message in contiguous memory
+ // including the header and data block
+ UI_32 sessionid;
+ } info;
+} SSystemMsgHeader, *PSSystemMsgHeader;
+
+#pragma pack()
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MSGS_H_
diff --git a/nsframework/framework_unified/client/include/native_service/ns_np_service.h b/nsframework/framework_unified/client/include/native_service/ns_np_service.h
new file mode 100755
index 0000000..e2a2deb
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_np_service.h
@@ -0,0 +1,271 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief Header for message structures for notification_persistent_service.
+///
+/// Declares the external APIs to Notification and Persistence Service.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_np_service.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __NATIVESERVICES_NP_SERVICE_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NP_SERVICE_H__
+
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english A structure to register notification msg
+ */
+typedef struct _NC_register_notif_msg {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english notification event name string
+ UI_32 maxLength; //!< \~english Maximum possible length (bytes) of
+ // the message data
+ // UI_8 bIsPersistent; ///< Flag to indicate if data has to be persisted.
+ EFrameworkunifiedNotificationType persType; //!< \~english Specifies persitence for this notification
+ UI_8 dummy[4]; //!< \~english Packing to 32 bit boundary
+} NC_register_notif_msg;
+
+/**
+ * \~english A structure to register multiple notification msg
+ */
+typedef struct _NC_register_multiple_notif_msg {
+ UI_32 numNotifications; //!< \~english This has to be UI_32 to avoid holes.
+ NC_register_notif_msg notifierList[1]; //!< \~english variable number of structures
+} NC_register_multiple_notif_msg;
+
+/**
+ * \~english A structure to register immediate notification msg
+ */
+typedef struct _NC_register_immediate_notif_msg {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english Notification Event Name string
+ UI_32 maxLength; //!< \~english Maximum possible length (bytes) of
+ // the message data
+ EFrameworkunifiedNotificationType persType; //!< \~english Specifies persitence for this notification
+ UI_32 delay; //!< \~english Delay time for persistence
+ UI_8 dummy[4]; //!< \~english Packing to 32 bit boundary
+} NC_register_immediate_notif_msg;
+
+/**
+ * \~english A structure to register multiple immediate notification msg
+ */
+typedef struct _NC_register_multiple_immediate_notif_msg {
+ UI_32 numNotifications; //!< \~english This has to be UI_32 to avoid holes.
+ NC_register_immediate_notif_msg notifierList[1]; //!< \~english variable number of structures
+} NC_register_multiple_immediate_notif_msg;
+
+/**
+ * \~english A structure to unregister notification msg
+ */
+typedef struct _NC_unregister_notif_msg {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english Notification Event Name string
+} NC_unregister_notif_msg, NC_subscribe_msg, NC_unsubscribe_frm_notif_msg, NC_get_pers_data_msg;
+
+/**
+ * \~english A structure to unregister multiple notification msg
+ */
+typedef struct _NC_unregister_multiple_notif_msg {
+ UI_32 numNotifications; //!< \~english notification event name num
+ NC_unregister_notif_msg notificationList[1]; //!< \~english notification event name List
+} NC_unregister_multiple_notif_msg;
+
+/**
+ * \~english A structure to save pers data
+ */
+typedef struct _NC_savepersdata_ack {
+ EFrameworkunifiedStatus eStatus; //!< \~english eFrameworkunifiedStatusOK is (valid - data stored, anything else is
+} NC_savepersdata_ack;
+
+/**
+ * \~english A structure to subscribe multiple notification msg
+ */
+typedef struct _NC_subscribe_multiple_notif_msg {
+ UI_32 numNotifications; //!< \~english notification event name num
+ NC_subscribe_msg notificationList[1]; //!< \~english notification event name List
+} NC_subscribe_multiple_notif_msg;
+
+/**
+ * \~english A structure to subscribe multiple notification msg
+ */
+typedef struct _NC_unsubscribe_multiple_notif_msg {
+ UI_32 numNotifications; //!< \~english notification event name num
+ NC_unsubscribe_frm_notif_msg notificationList[1]; //!< \~english notification event name List
+} NC_unsubscribe_multiple_notif_msg;
+
+/**
+ * \~english A structure to get pers data failed
+ */
+typedef struct __NC_get_persdata_failed_ack {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english notification name
+} NC_get_persdata_failed_ack;
+
+/**
+ * \~english A structure to set personality
+ */
+typedef struct _NC_User {
+ CHAR cUsername[MAX_PATH_LENGTH]; //!< \~english name of personality
+} NC_User;
+
+/**
+ * \~english A structure to register persistent file with the notification_persistent_service
+ */
+typedef struct _NC_RegisterPersistentFileMsg {
+ CHAR cFileTag[MAX_STRING_SIZE_TAG]; //!< \~english Tag associated with the
+ // file that would be persisted
+ BOOL bIsUserFile; //!< \~english is user file
+} NC_RegisterPersistentFileMsg;
+
+/**
+ * \~english A structure to specify where to load the file associated with the Tag
+ */
+typedef struct _NC_LoadPersistedFileMsg {
+ CHAR cFileTag[MAX_STRING_SIZE_TAG]; //!< \~english Tag associated with the file
+ CHAR cFilePath[MAX_PATH_LENGTH]; //!< \~english path to which the file needs to retrieved
+ CHAR cUsername[MAX_PATH_LENGTH]; //!< \~english Name of the user for user specific file.
+} NC_LoadPersistedFileMsg;
+
+/**
+ * \~english A structure to release persistent file
+ */
+typedef struct _NC_ReleasePersistentFileMsg {
+ EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType; //!< \~english should the file be persisted
+ CHAR cFilePath[MAX_PATH_LENGTH]; //!< \~english path from which the
+ // file needs to be picked up to persist
+ CHAR cFileTag[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english Tag associated with the
+ // file to be persisted
+ CHAR cUsername[MAX_PATH_LENGTH]; //!< \~english Name of the user for user specific file.
+} NC_ReleasePersistentFileMsg;
+
+/**
+ * \~english A structure to register persistent folder with the notification_persistent_service
+ */
+typedef struct _NC_RegisterPersistentFolderMsg {
+ CHAR cFolderTag[MAX_STRING_SIZE_TAG]; //!< \~english Tag associated with the
+ // folder that would be persisted
+ BOOL bIsUserFolder; //!< \~english Check if the folder is of user type
+} NC_RegisterPersistentFolderMsg;
+
+/**
+ * \~english A structure to specify where to load the folder associated with the Tag
+ */
+typedef struct _NC_LoadPersistedFolderMsg {
+ CHAR cFolderTag[MAX_STRING_SIZE_TAG]; //!< \~english Tag associated with the folder
+ CHAR cFolderPath[MAX_PATH_LENGTH]; //!< \~english path to which the folder needs to retrieved
+ CHAR cUsername[MAX_PATH_LENGTH]; //!< \~english Name of the user for user specific folder.
+} NC_LoadPersistedFolderMsg;
+
+/**
+ * \~english A structure to Release Persistent Folder Msg
+ */
+typedef struct _NC_ReleasePersistentFolderMsg {
+ EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType; //!< \~english should the file be persisted
+ CHAR cFolderPath[MAX_PATH_LENGTH]; //!< \~english path from which the folder
+ // needs to be picked up to persist
+ CHAR cFolderTag[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english Tag associated with
+ // the folder to be persisted
+ CHAR cUsername[MAX_PATH_LENGTH]; //!< \~english Name of the user for user
+ // specific folder.
+} NC_ReleasePersistentFolderMsg;
+
+/**
+ * \~english A structure to Load Persisted Ack
+ */
+typedef struct _NC_LoadPersistedAck {
+ EFrameworkunifiedStatus eStatus; //!< \~english ack the success/failure in
+ // retrieving the file/folder from persistence
+ CHAR cTag[MAX_PATH_LENGTH]; //!< \~english tag of the file/folder for which acknowledge is made
+} NC_LoadPersistedAck, NC_ReleasePersistedAck;
+
+/**
+ * \~english A structure to Nor Persistent Data
+ */
+typedef struct _NC_NorPersistentData {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english Notification Event Name string
+ CHAR pPublisherName[MAX_NAME_SIZE_APP]; //!< \~english Publisher Event Name string
+ UI_32 dataSize; //!< \~english data size
+ UI_32 uiDelay; //!< \~english ui Delay
+ UI_32 uiMaxSize; //!< \~english ui Max Size
+} NC_NorPersistentData;
+
+/**
+ * \~english A structure to request for deleting data from persistent memory
+ */
+typedef struct _NC_ClearPersistedDataReq {
+ EFrameworkunifiedClearPersistence ePersistenceData; //!< \~english defines what
+ // data to be deleted from persistent memory
+} NC_ClearPersistedDataReq;
+
+/**
+ * \~english A structure for receiving ack of data deleted from persistent memory
+ */
+typedef struct _NC_ClearPersisteDatadAck {
+ EFrameworkunifiedStatus eStatus; //!< \~english ack status of ClearPersistedData request
+} NC_ClearPersisteDatadAck;
+
+/**
+ * \~english A structure to request stop message to notification_persistent_service.
+ */
+typedef struct _NC_StopMsgData {
+ EFrameworkunifiedShutdownType eShutdownType; //!< \~english shutdown type
+ UI_32 uiStopMsgData; //!< \~english Reason for sending stop message to NPPService
+} NC_StopMsgData;
+
+/**
+ * \~english A structure to set the persist type of file and folder
+ */
+typedef struct _NC_SetPersistType {
+ EFrameworkunifiedPersistCategory ePersistType; //!< \~english persist type
+ CHAR cTag[MAX_PATH_LENGTH]; //!< \~english tag name of the file or folder
+} NC_SetFilePersistType, NC_SetFolderPersistType;
+
+/**
+ * \~english A data received with ack sent by notification_persistent_service when immediate notification data is
+ * written in persistent memory
+ */
+typedef struct _NC_ImmediateWriteAck {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english notification Name
+ EFrameworkunifiedStatus eStatus; //!< \~english status of request
+} NC_ImmediateWriteAck;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NATIVESERVICES_NP_SERVICE_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+// EOF
diff --git a/nsframework/framework_unified/client/include/native_service/ns_np_service_if.h b/nsframework/framework_unified/client/include/native_service/ns_np_service_if.h
new file mode 100755
index 0000000..b188958
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_np_service_if.h
@@ -0,0 +1,2482 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_np_service_if.h
+ * @brief \~english Declares the external APIs to Notification and Persistence Service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __NATIVESERVICES_NP_SERVICE_IF_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NP_SERVICE_IF_H__
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english A structure to Notification Info
+ */
+typedef struct _NotificationInfo {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; ///< Notification Event Name string
+ UI_32 maxLength; ///< Maximum possible length (bytes) of the message data
+ EFrameworkunifiedNotificationType persType; ///< Specifies persitence for this notification
+ UI_8 dummy[4]; ///< Packing to 32 bit boundary
+} NotificationInfo;
+
+/**
+ * \~english A structure to Immediate Notification Info
+ */
+typedef struct _ImmediateNotificationInfo {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; ///< Notification Event Name string
+ UI_32 maxLength; ///< Maximum possible length (bytes) of the message data
+ EFrameworkunifiedNotificationType persType; ///< Specifies persitence for this notification
+ UI_32 delay;
+ UI_8 dummy[4]; ///< Packing to 32 bit boundary
+} ImmediateNotificationInfo;
+
+/**
+ * \~english A structure to Subscribe Info
+ */
+typedef struct _SubscribeInfo {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; ///< Notification Event Name string
+} SubscribeInfo;
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPRegisterNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to register a set of notification
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \~english @param[in] numNotifications
+/// PCSTR - Name of Notification
+/// \~english @param[in] pNotificationArray
+/// NotificationInfo - Array of notifications
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(numNotifications).
+/// - It is an incorrect value(pNotificationArray) or pNotificationArray is NULL.
+/// \~english @par Detail
+/// Invoke callback function with arguments to register a set of notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPRegisterNotifications' to
+/// register a set of notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPRegisterNotification, NPRegisterNotification
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ NotificationInfo *pNotificationArray);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPRegisterImmediateNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to register a set of immediate notifications
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue.
+/// \~english @param[in] numNotifications
+/// PCSTR - Name of Notification.
+/// \~english @param[in] pNotificationArray
+/// ImmediateNotificationInfo - Array of immediate notifications
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(numNotifications).
+/// - It is an incorrect value(pNotificationArray) or pNotificationArray is NULL.
+/// \~english @par Detail
+/// Invoke callback function with arguments to register a set of immediate notification.\n
+/// If callback function is null and expectedCalls is '0', using default function
+/// 'NPRegisterImmediateNotifications' to register a set\n
+/// of immediate notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPRegisterImmediatePersistNotification
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterImmediateNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ ImmediateNotificationInfo *pNotificationArray);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPRegisterNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to register a notification
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \~english @param[in] notif_name
+/// PCSTR - Name of Notification
+/// \~english @param[in] max_length
+/// const UI_32 - Max size of the notification message
+/// \~english @param[in] perstype
+/// const EFrameworkunifiedPersistentVarType - Flag to indicate if it has to be persistent
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(notif_name) or notif_name is NULL.
+/// - It is an incorrect value(max_length).
+/// \~english @par Detail
+/// Invoke callback function with arguments to register a notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPRegisterNotification' to
+/// register a notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NPRegisterNotifications, FrameworkunifiedNPRegisterNotification
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR notif_name,
+ const UI_32 max_length, const EFrameworkunifiedNotificationType perstype);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPUnRegisterNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to remove a notification
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \~english @param[in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pNotification) or pNotification is NULL.
+/// \~english @par Detail
+/// Invoke NPUnRegisterNotifications to remove one notification named 'pPublisherName'.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPUnRegisterNotification, NPUnRegisterNotifications
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnRegisterNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSetPersistentNotfnType
+/// \~english @par Brief
+/// API to send message to Notification Service to set the persist category of notification.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Service Name
+/// \~english @param[in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @param[in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - Persistent category
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pNotification) or pNotification is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to set the persist category of
+/// notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSetPersistentNotfnType' to
+/// send\n
+/// message to Notification Service to set the persist category of notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSetPersistentNotfnType
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetPersistentNotfnType(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification,
+ EFrameworkunifiedPersistCategory ePersistCategory);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSetPersistNotfnDefaultValue
+/// \~english @par Brief
+/// API to send message to Notification Service to set default value of persistent category in notification.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Service Name
+/// \~english @param[in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @param[in] pData
+/// PVOID - Data buffer
+/// \~english @param[in] iLength
+/// const UI_32 - Size of data buffer
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pNotification) or pNotification is NULL.
+/// - It is an incorrect value(pData) or pData is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to set default value of persistent category
+/// in notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSetPersistNotfnDefaultValue'
+/// to send message\n
+/// to Notification Service to set default value of persistent category in notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSetPersistNotfnDefaultValue
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetPersistNotfnDefaultValue(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification,
+ PCVOID pData, const UI_32 iLength);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPUnRegisterNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to remove a set of notification
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \~english @param[in] numNotifications
+/// UI_32 - Number of Notification
+/// \~english @param[in] pNotificationArray
+/// NotificationInfo - Array of notifications
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(numNotifications).
+/// - It is an incorrect value(pNotificationArray) or pNotificationArray is NULL.
+/// - Allocate memory for deal with original notification array failed.
+/// \~english @par Detail
+/// Copy original notification array to temp allocated memory and then remove the given notifications from the
+/// memory.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPUnRegisterNotifications
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnRegisterNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ NotificationInfo *pNotificationArray);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPPublishNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to notify subscribers
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \~english @param[in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @param[in] pData
+/// PVOID - Data buffer
+/// \~english @param[in] iLength
+/// const UI_32 - Size of data buffer
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusInvldParam
+/// \~english @retval eFrameworkunifiedStatusMsgQFull
+/// \~english @retval eFrameworkunifiedStatusErrNoEBAD
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize
+/// \~english @retval eFrameworkunifiedStatusFail
+/// \~english @retval eFrameworkunifiedStatusErrOther
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - queue handle(hNPMsgQ,designated by parameter)is NULL[eFrameworkunifiedStatusInvldParam]
+/// - pubulisher name(pPublisherName,designated by parameter)is NULL[eFrameworkunifiedStatusInvldParam]
+/// - Notification name(pNotification)is NULL[eFrameworkunifiedStatusInvldParam]
+/// - pubulisher name(pPublisherName,designated by parameter)is nullbuffer[eFrameworkunifiedStatusInvldParam]
+/// - Notification name(pNotification,designated by parameter)is nullbuffer[eFrameworkunifiedStatusInvldParam]
+/// - message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - wrong file discriptor for message sending [eFrameworkunifiedStatusErrNoEBAD]
+/// - system call disruput during message sending process[eFrameworkunifiedStatusErrNoEINTR]
+/// - wrong buffer size for sending message[eFrameworkunifiedStatusInvldBufSize]
+/// - message sending failed[eFrameworkunifiedStatusFail]
+/// - failed access to shared memmory for message sending[eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// send system info as Notification name and command[NPS_PUBLISH_EV_REQ] through McSendWithSysInfo()
+/// NPP service wii process according to command[NPS_PUBLISH_EV_REQ]when get the message above
+/// \~english @par Classification
+/// - pubulic
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see McSendWithSysInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPPublishNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification,
+ PCVOID pData, const UI_32 iLength);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSubscribeToNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to add to subscription list for.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \~english @param[in] notif_name
+/// PCSTR - Name of Notification
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(notif_name) or notif_name is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to add to subscription list for given
+/// notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSubscribeToNotification' to
+/// Notification Service to add to subscription list for given notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSubscribeToNotification
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSubscribeToNotification(HANDLE hNPMsgQ, PCSTR pSubscriberName, PCSTR notif_name);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSubscribeToNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to add multiple subscriptions for a set of notification.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \~english @param[in] numNotifications
+/// UI_32 - Number of Notifications
+/// \~english @param[in] pSubscribeInfoArray
+/// SubscribeInfo* - Array of SubscribeInfo
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(numNotifications).
+/// - It is an incorrect value(pSubscribeInfoArray) or pSubscribeInfoArray is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to add multiple subscriptions for a set of
+/// notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSubscribeToNotifications' to
+/// Notification Service to add multiple subscriptions for a set of notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSubscribeToNotifications
+EFrameworkunifiedStatus NPSubscribeToNotifications(HANDLE hNPMsgQ, PCSTR pSubscriberName, UI_32 numNotifications,
+ SubscribeInfo *pSubscribeInfoArray);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPUnsubscribeFromNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to remove from subscription list for given notification.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \~english @param[in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(pNotification) or pNotification is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to remove from subscription list for given
+/// notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPUnsubscribeFromNotification'
+/// to send message to Notification Service to remove from subscription list for given notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPUnsubscribeFromNotification
+EFrameworkunifiedStatus NPUnsubscribeFromNotification(HANDLE hNPMsgQ, PCSTR pSubscriberName, PCSTR pNotification);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPUnsubscribeFromNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to unsubscribe multiple subscriptions for a set of notification.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \~english @param[in] numNotifications
+/// UI_32 - Number of Notifications
+/// \~english @param[in] pUnSubscribeInfoArray
+/// SubscribeInfo - Array of notifications
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(numNotifications).
+/// - It is an incorrect value(pUnSubscribeInfoArray) or pUnSubscribeInfoArray is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to unsubscribe multiple subscriptions for a
+/// set of notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPUnsubscribeFromNotifications'
+/// to send message to Notification Service to unsubscribe multiple subscriptions for a set of notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPUnsubscribeFromNotifications
+EFrameworkunifiedStatus NPUnsubscribeFromNotifications(HANDLE hNPMsgQ, PCSTR pUnSubscriberName, UI_32 numNotifications,
+ SubscribeInfo *pUnSubscribeInfoArray);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPReadPersistedData
+/// \~english @par Brief
+/// API to requested the persistent data corresponding to the notification if available.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \~english @param[in] notification
+/// PCSTR - Name of Notification
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(notification) or notification is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to requested the persistent data corresponding to the notification if
+/// available.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPReadPersistedData' to
+/// requested the persistent data corresponding to the notification if available.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPReadPersistedData
+EFrameworkunifiedStatus NPReadPersistedData(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR notification);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSavePersistentData
+/// \~english @par Brief
+/// API to send message to Notification Service to save all persisted data that in Ram to the file system via a
+/// file write.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to save all persisted data.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSavePersistentData' to send
+/// message to Notification Service to save all persisted data.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSavePersistentData
+EFrameworkunifiedStatus NPSavePersistentData(HANDLE hNPMsgQ, PCSTR pPublisherName);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPRegisterPersistentFile
+/// \~english @par Brief
+/// API to send message to Notification Service to add a file path as to be persisted.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pTag
+/// PCSTR - A unique identifier for the file path specified, this is used in retrieve/Load the file later.
+/// \~english @param[in] bIsUserFile
+/// BOOL - Set TRUE, if registering user file.
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to add a file path as to be persisted.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPRegisterPersistentFile' to
+/// send message to Notification Service to add a file path as to be persisted.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPRegisterPersistentFile
+EFrameworkunifiedStatus NPRegisterPersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pTag, BOOL bIsUserFile);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSetFilePersistentType
+/// \~english @par Brief
+/// API to send message to Notification Service to add a file path as to be persisted.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pTag
+/// PCSTR - A unique identifier for the file path specified, this is used in retrieve/Load the file later.
+/// \~english @param[in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - persist category
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to add a file path as to be persisted. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSetFilePersistentType' to
+/// send message to Notification Service to add a file path as to be persisted.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSetFilePersistentType
+EFrameworkunifiedStatus NPSetFilePersistentType(HANDLE hNPMsgQ, PCSTR pPublisherName,
+ PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPLoadPersistentFile
+/// \~english @par Brief
+/// API to send message to Notification Service to copy file from persistent memory to
+/// specified path. The caller recieves an acknowledgement once NPS completes file copy
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pDstFilePath
+/// PCSTR - Complete file path to which the file should be copied from persistent area.
+/// \~english @param[in] pTag
+/// PCSTR - Tag associated with the file that needs to be copied to pDstFilePath.
+/// \~english @param[in] hUser
+/// HANDLE - Load the file for the specified user.
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pDstFilePath) or pDstFilePath is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// - It is an incorrect value(hUser) or hUser is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to copy file from persistent memory to
+/// specified path. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPLoadPersistentFile' to send
+/// message to Notification Service to copy file from persistent memory to specified path.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPLoadPersistentFile
+EFrameworkunifiedStatus NPLoadPersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pDstFilePath,
+ PCSTR pTag, HANDLE hUser);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPReleasePersistentFile
+/// \~english @par Brief
+/// API to send message to Notification Service to notify that the file can be persisted.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] eReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease:not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly:persist instantly
+/// \~english @param[in] pTag
+/// PCSTR - Tag associated with the file released
+/// \~english @param[in] pFullFilePath
+/// PCSTR - Full path name of the file to be persisted
+/// \~english @param[in] hUser
+/// HANDLE - Release the file for the specified user.
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pDstFilePath) or pDstFilePath is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// - It is an incorrect value(pFullFilePath) or pFullFilePath is NULL.
+/// - It is an incorrect value(hUser) or hUser is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to notify that the file can be persisted. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPReleasePersistentFile' to
+/// send message to Notification Service to notify that the file can be persisted.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPReleasePersistentFile
+EFrameworkunifiedStatus NPReleasePersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedReleaseType eReleaseType, PCSTR pTag,
+ PCSTR pFullFilePath, HANDLE hUser);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPPersistentSync
+/// \~english @par Brief
+/// API to synchronizes by NPPService.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] eReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease:not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly:persist instantly
+/// \~english @param[in] SrcName
+/// PCSTR - source service name.
+/// \~english @param[in] sessionid
+/// UI_32 - session ID
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(SrcName) or SrcName is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(sessionid).
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to synchronizes by NPPService. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPPersistentSync' to
+/// synchronizes by NPPService.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPPersistentSync
+EFrameworkunifiedStatus NPPersistentSync(PCSTR SrcName, HANDLE hNPMsgQ, UI_32 sessionid, PCSTR pPublisherName);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSetPersonality
+/// \~english @par Brief
+/// API to send message to Notification Service to set the Personality.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pUserName
+/// PCSTR - Name of new Personality
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pUserName) or pUserName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to set the Personality. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSetPersonality' to send
+/// message to Notification Service to set the Personality.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSetPersonality
+EFrameworkunifiedStatus NPSetPersonality(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pUserName);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPChangePersonality
+/// \~english @par Brief
+/// API to send message to Notification Service to change the current Personality.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pUserName
+/// PCSTR - Name of new Personality
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pUserName) or pUserName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to change the current Personality. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPChangePersonality' to send
+/// message to Notification Service to change the current Personality.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPChangePersonality
+EFrameworkunifiedStatus NPChangePersonality(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pUserName);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPGetReadyStatusOfNPP
+/// \~english @par Brief
+/// To be used by System Manager Service only. SystemManager will use this API to get the ready status of
+/// NPPService.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pRequesterName
+/// PCSTR - Name of the requesters message queue.
+/// \~english @param[in] pUserName
+/// PCSTR - Name of new Personality
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pRequesterName) or pRequesterName is NULL.
+/// - It is an incorrect value(pUserName) or pUserName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to get the ready status of NPPService. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPGetReadyStatusOfNPP' to get
+/// the ready status of NPPService.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPGetReadyStatusOfNPP
+EFrameworkunifiedStatus NPGetReadyStatusOfNPP(HANDLE hNPMsgQ, PCSTR pRequesterName);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPClearPersistedData
+/// \~english @par Brief
+/// API to delete the persisted data of NS_NPS.
+/// Note: Currently to be used by HMI service only
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pRequesterName
+/// PCSTR - Name of the requesters message queue.
+/// \~english @param[in] eFrameworkunifiedClearPersistenceScope
+/// EFrameworkunifiedClearPersistence - specifies what data to delete from persistent memory.
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pRequesterName) or pRequesterName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to delete the persisted data of NS_NPS.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPClearPersistedData' to delete
+/// the persisted data of NS_NPS.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPClearPersistedData
+EFrameworkunifiedStatus NPClearPersistedData(HANDLE hNPMsgQ, PCSTR pRequesterName, EFrameworkunifiedClearPersistence eFrameworkunifiedClearPersistenceScope);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPRegisterPersistentFolder
+/// \~english @par Brief
+/// API to send message to Notification Service to add a folder path as to be persisted.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pTag
+/// PCSTR - A unique identifier for the folder path specified, this is used in retrieve/Load the folder later.
+/// \~english @param[in] bIsUserFolder
+/// BOOL - Set TRUE, if registering user folder.
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to add a folder path as to be persisted.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPRegisterPersistentFolder' to
+/// send message to Notification Service to add a folder path as to be persisted.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPRegisterPersistentFolder
+EFrameworkunifiedStatus NPRegisterPersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pTag, BOOL bIsUserFolder);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSetFolderPersistentType
+/// \~english @par Brief
+/// API to send message to Notification Service to set the persist category of file.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pTag
+/// PCSTR - A unique identifier for the file path specified, this is used in retrieve/Load the file later
+/// \~english @param[in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - persist category
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to set the persist category of file.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSetFolderPersistentType' to
+/// send message to Notification Service to set the persist category of file.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSetFolderPersistentType
+EFrameworkunifiedStatus NPSetFolderPersistentType(HANDLE hNPMsgQ, PCSTR pPublisherName,
+ PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPLoadPersistentFolder
+/// \~english @par Brief
+/// API to send message to Notification Service to copy folder from persistent memory to
+/// specified path. The caller recieves an acknowledgement once NPS completes folder copy.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pDstFolderPath
+/// PCSTR - Complete folder path to which the folder should be copied from persistent area
+/// \~english @param[in] pTag
+/// PCSTR - Tag associated with the folder that needs to be copied to pDstFolderPath
+/// \~english @param[in] hUser
+/// HANDLE - Name of new Personality
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pDstFolderPath) or pDstFolderPath is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// - It is an incorrect value(hUser) or hUser is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to copy folder from persistent memory to
+/// specified path.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPLoadPersistentFolder' to send
+/// message to Notification Service to copy folder from persistent memory to specified path.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPLoadPersistentFolder
+EFrameworkunifiedStatus NPLoadPersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pDstFolderPath,
+ PCSTR pTag, HANDLE hUser);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPReleasePersistentFolder
+/// \~english @par Brief
+/// API to send message to Notification Service to notify that the folder can be persisted.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to the Framework
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] eFrameworkunifiedReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease :not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly :persist instantly
+/// \~english @param[in] pTag
+/// PCSTR - Tag associated with the folder released
+/// \~english @param[in] pFullFolderPath
+/// PCSTR - Full path name of the folder to be persisted
+/// \~english @param[in] hUser
+/// HANDLE - Name of new Personality
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pDstFolderPath) or pDstFolderPath is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// - It is an incorrect value(hUser) or hUser is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to notify that the folder can be persisted.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPReleasePersistentFolder' to
+/// send message to Notification Service to notify that the folder can be persisted.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPReleasePersistentFolder
+EFrameworkunifiedStatus NPReleasePersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType, PCSTR pTag,
+ PCSTR pFullFolderPath, HANDLE hUser);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NATIVESERVICES_NP_SERVICE_IF_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+// EOF
diff --git a/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence.h b/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence.h
new file mode 100755
index 0000000..88daef7
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence.h
@@ -0,0 +1,151 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief This file contains the declaration for methods to retrieve and store data for NOR storage
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_np_service_nor_persistence.h
+ * @brief This file contains the declaration for methods to retrieve and store data for NOR storage
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __NATIVESERVICES_NP_NOR_SERVICE_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NP_NOR_SERVICE_H__
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NPSynchronousReadPersistentData
+ /// \~english @par Brief
+ /// API to synchronously read persistent data corresponding to a notification before NPPService is available
+ /// \~english @param[in] pAppName
+ /// PCSTR - Application/ thread name
+ /// \~english @param[in] notif_name
+ // PCSTR - Name of Notification
+ /// \~english @param[in] pData
+ /// PVOID - Pointer to the buffer where read data will be written.
+ /// \~english @param[in] uiDataSize
+ /// UI_32 - Length of the data buffer.
+ /// \~english @param[in] ePersistCategory
+ /// const EFrameworkunifiedPersistCategory - Persist Category of Notification.
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusInvldParam
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - NULL handle specified in the argument(pAppName).[eFrameworkunifiedStatusInvldParam]
+ /// - NULL handle specified in the argument(notif_name).[eFrameworkunifiedStatusInvldParam]
+ /// - NULL handle specified in the argument(pData).[eFrameworkunifiedStatusInvldParam]
+ /// - 0 specified in the argument(uiDataSize).[eFrameworkunifiedStatusFail]
+ /// - Handle of the application [eFrameworkunifiedStatusFail]
+ /// - If the file access process fails,.... [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// API to synchronously read persistent data corresponding to a notification before NPPService is available
+ /// \~english @par
+ /// File reading by this API is exclusive control by semaphore,
+ /// and writing to non-voatie area is to use NPSynchronousWritePersistentData().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see NPSynchronousWritePersistentData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousReadPersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ UI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NPSynchronousWritePersistentData
+ /// \~english @par Brief
+ /// API to synchronously write persistent data corresponding to a notification before NPPService is available
+ /// \~english @param[in] pAppName
+ /// PCSTR - Application/ thread name
+ /// \~english @param[in] notif_name
+ // PCSTR - Name of Notification
+ /// \~english @param[in] pData
+ /// PVOID - Pointer to the buffer where read data will be written.
+ /// \~english @param[in] uiDataSize
+ /// UI_32 - Length of the data buffer.
+ /// \~english @param[in] ePersistCategory
+ /// const EFrameworkunifiedPersistCategory - Persist Category of Notification.
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusInvldParam
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - NULL handle specified in the argument(pAppName).[eFrameworkunifiedStatusInvldParam]
+ /// - NULL handle specified in the argument(notif_name).[eFrameworkunifiedStatusInvldParam]
+ /// - NULL handle specified in the argument(pData).[eFrameworkunifiedStatusInvldParam]
+ /// - 0 specified in the argument(uiDataSize).[eFrameworkunifiedStatusFail]
+ /// - Handle of the application [eFrameworkunifiedStatusFail]
+ /// - If the file access process fails,.... [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// API to synchronously read persistent data corresponding to a notification before NPPService is available
+ /// \~english @par
+ /// File reading by this API is exclusive control by semaphore,
+ /// and writing to non-voatie area is to use NPSynchronousWritePersistentData().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see NPSynchronousWritePersistentData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousWritePersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ const UI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory = eFrameworkunifiedUserData);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NATIVESERVICES_NP_NOR_SERVICE_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+// EOF
diff --git a/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence_internal.h b/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence_internal.h
new file mode 100755
index 0000000..ea149c5
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence_internal.h
@@ -0,0 +1,131 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPServiceIf
+/// \brief This file contains the declaration for internal functions to retrieve and store
+/// immediate notification data from and to persistent storage.
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_NOR_PERSISTENCE_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_NOR_PERSISTENCE_INTERNAL_H_
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousGetPersistentData
+/// API to retrieve immediate storage notification data structure.
+///
+///
+/// \param [in] pAppName
+/// PCSTR - Name of application service
+/// \param [in] notif_name
+/// PCSTR - Name of notification to be written to immediate storage
+/// \param [in] pData
+/// PVOID - Notification data
+/// \param [in] uiDataSize
+/// UI_32 - Size of notification data
+/// \param [out] ptNorPersistentData
+/// NC_NorPersistentData - Immediate notification structure
+/// \param [in] ePersistCategory
+/// const EFrameworkunifiedPersistCategory - Persist Category of Notification.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousGetPersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ UI_32 uiDataSize,
+ NC_NorPersistentData &ptNorPersistentData,
+ const EFrameworkunifiedPersistCategory ePersistCategory);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousGetPersistentDataSize
+/// API to get immediate storage notification data size.
+///
+/// \param [in] notif_name
+/// PCSTR - Name of notification to be read from immediate storage
+/// \param [out] uiDataSize
+/// PUI_32 - notification data size
+/// \param [in] ePersistCategory
+/// const EFrameworkunifiedPersistCategory - Persist Category of Notification.
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - success or failure
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousGetPersistentDataSize(PCSTR notif_name,
+ PUI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SynchronousGetPersistentDataSize
+/// API to write immediate persistence notification data.
+///
+/// \param [in] notif_name
+/// PCSTR - Name of notification to be read from immediate storage
+/// \param [in] ePersistCategory
+/// const EFrameworkunifiedPersistCategory - Persist Category of Notification.
+///
+/// \return UI_32
+/// UI_32 - size of the data
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SynchronousWritePersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ const UI_32 uiDataSize,
+ const UI_32 uiDelay,
+ const UI_32 uiMaxSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SynchronousMovePersistentData
+/// API to move all the immediate notification data from f_cSrcDir directory to
+/// f_cDestDir directory
+///
+/// \param [in] f_cSrcDir
+/// PCSTR - Source directory full path
+/// \param [in] f_cDestDir
+/// PCSTR - Dest directory full path
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - eFrameworkunifiedStatusAccessError if source path not exists
+/// eFrameworkunifiedStatusFileLoadError if unable to access src directory
+/// eFrameworkunifiedStatusInvldParam if invalid parameter is received
+/// eFrameworkunifiedStatusFail if error occurs while copying file
+/// eFrameworkunifiedStatus on success
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SynchronousMovePersistentData(PCSTR f_cSrcDir,
+ PCSTR f_cDestDir);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_NOR_PERSISTENCE_INTERNAL_H_
+
+// EOF
diff --git a/nsframework/framework_unified/client/include/native_service/ns_np_service_notification.h b/nsframework/framework_unified/client/include/native_service/ns_np_service_notification.h
new file mode 100755
index 0000000..5d389ec
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_np_service_notification.h
@@ -0,0 +1,50 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief Notifications for notification service messages used by senders and receivers.
+///
+/// Declares the external Notification messages to the Notification Service.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ns_np_service_notification.h
+ */
+
+
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef NS_NP_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define NS_NP_SERVICE_NOTIFICATIONS_H_
+
+#define NTFY_NPPService_UserChange "NPPService/UserChange" //!< \~english notification_persistent_service server's Availability folder
+
+#endif /* NS_NP_SERVICE_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/ns_np_service_protocol.h b/nsframework/framework_unified/client/include/native_service/ns_np_service_protocol.h
new file mode 100755
index 0000000..475950b
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_np_service_protocol.h
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief API Header for Notification Service messages used by senders and recievers.
+///
+/// Declares the external Protocol messages to the Notification Service.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ns_np_service_protocol.h
+ */
+
+
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NATIVESERVICES_NP_SERVICE_PROTOCOL_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NP_SERVICE_PROTOCOL_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english notification_persistent_service protocol msg name define
+ */
+typedef enum _NS_NPServiceProtocol {
+ NPS_REGISTER_EV_REQ = PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD + 0, /// <16+0 Request to register a Notification
+ NPS_UNREGISTER_EV_REQ , /// <1 Request to unregister a Notification
+ NPS_PUBLISH_EV_REQ , /// <2 Sender request to NP service to publish (send) a notification to subscribers
+ NPS_NOTIFY_EV_REQ , /// <3 Message to subscribers that the notification was generated by publisher
+ NPS_SUBSCRIBE_TO_EV_REQ , /// <4 Request to subscribe to a notification
+ NPS_UNSUBSCRIBE_FROM_EV_REQ , /// <5 Request to unsubscribe from a notification
+ NPS_SET_PERSIST_FILE_PATH_REQ , /// <6 Request to add a path to the list of files to be persisted
+ NPS_GET_PERS_DATA_REQ , /// <7 Request to get persistent data for specified notification
+ NPS_GET_PERS_DATA_ACK , /// <8 MSG from NPS to requester of persistent data.
+ NPS_GET_PERS_FILE_REQ , /// <9 Request to get persistent File from specified path
+ NPS_GET_PERS_FILE_ACK , /// <10 MSG from NPS to inform that file was retrieved from persistent
+ /// mem and copied.
+ NPS_SAVE_PERS_DATA_REQ , /// <11 Request to save the persistent data to what ever file that has
+ /// been defined.
+ NPS_SAVE_PERS_DATA_ACK , /// <12 MSG from NPS to requester of Save Action.
+ NPS_RELEASE_PERS_FILE_REQ , /// <13 Request to NPS to persist file in persistent memory
+ NPS_NPP_STOP_REQ , /// <14 MSG from system manager to NS_NPS to stop processing.
+ /// NS_NPS goes to idle state.
+ NPS_TST_WAKEUP , /// <15
+ NPS_BATCH_SUBSCRIBE_TO_EV_REQ , /// <16 Request to subscribe to a batch of notification(s)
+ NPS_GET_PERS_DATA_FAILED_ACK , /// <17 Failed to get persistent data
+ NPS_SET_PERSONALITY_REQ , /// <18 Request to change current user
+ NPS_CHANGE_PERSONALITY_REQ , /// <19 Request to change current user
+ NPS_USER_CHANGE_REQ , /// <20 MSG from NPS to frameworkunified applications.
+ NPS_SET_PERSIST_FOLDER_PATH_REQ , /// <21 Request to add a path to the folder to be persisted
+ NPS_GET_PERS_FOLDER_REQ , /// <22 Request to get persistent Folder from specified path
+ NPS_RELEASE_PERS_FOLDER_REQ , /// <23 Request to NPS to persist folder in persistent memory
+ NPS_GET_PERS_FOLDER_ACK, /// <24 Ack from NPS to requester to inform that folder was retrieved from persistent mem
+ /// and copied.
+ NPS_NPP_STOP_ACK , /// <25 Ack from NS_NPS to system manager on NPS_NPP_STOP_REQ request
+ NPS_BATCH_UNSUBSCRIBE_FROM_EV_REQ , /// <26
+ NPS_GET_READYSTATUS_REQ , /// <27 Request from system manager to check the ready status of NPPService
+ NPS_GET_READYSTATUS_ACK , /// <28 Ack from NPPService to system manager, only if NPPService is in ready state
+ NPS_REGISTER_NOR_EV_REQ , /// <29 Request to register immediate notification
+ NPS_DELETE_PERSISTED_DATA_REQ , /// <30 Request to delete the persistent data.
+ NPS_DELETE_PERSISTED_DATA_ACK , /// <31 Ack of deleting the persistent data.
+ NPS_SET_DEFAULT_PERS_DATA , /// <32 Sets the default data for persistent notification.
+ NPS_SET_NOTFN_PERSISTENT_TYPE , /// <33 Sets the persistent type of notification.
+ NPS_SET_FILE_PERSISTENT_TYPE , /// <34 Sets the persistent type of file.
+ NPS_SET_FOLDER_PERSISTENT_TYPE , /// <35 Sets the persistent type of folder.
+ NPS_SYNCHRONOUS_WRITE_NOTIFY_REQ , /// <36 Updates the immediate notification data in NPPService,
+ /// when written using synchronous API.
+ NPS_IMMEDIATE_WRITE_ACK , /// <37 Sends the ack to publisher of immediate notification after
+ /// data is written to persistent memory.
+ NPS_NPP_SYNC_REQ /// <38 Processing which synchronizes by NPPService (syncfs)
+} NS_NPServiceProtocol;
+
+/**
+ * \~english notification_persistent_service service event
+ */
+typedef enum _NS_NPServiceEvent {
+ NPS_NPP_READY_EVENT = 0x100,
+} NS_NPServiceEvent;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NATIVESERVICES_NP_SERVICE_PROTOCOL_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+// EOF
diff --git a/nsframework/framework_unified/client/include/native_service/ns_np_types.h b/nsframework/framework_unified/client/include/native_service/ns_np_types.h
new file mode 100755
index 0000000..01559d9
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_np_types.h
@@ -0,0 +1,47 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPServiceIf
+/// \brief
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_TYPES_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_TYPES_H_
+
+// Path of immediate notification data in NS_NPS version 1
+#define IMMEDIATE_PERSISTENCE_STORAGE_V1 "/nv/BS/ns/npp/rwdata/NPSNOR/"
+
+// Path of immediate notification data in NS_NPS version 2
+#define IMMEDIATE_PERSISTENCE_STORAGE_V2 "/nv/BS/ns/npp/rwdata/"
+
+// name of persistence folder for persistent type categorization
+#define USERDATADIR "UserData/" // stores all the user data (all user common data as well as user specific data)
+#define FACTORYDATADIR "FactoryData/" // stores all the factory data
+#define FACTORYCUSTOMERDATADIR "FactoryCustomerData/" // store all the factory customer data
+#define DEALERDATADIR "DealerData/" // stores all the dealer data
+
+#define IMMEDIATEDATADIR "__ImmNotfn/" // all immediate notification are stored under this folder name
+
+// folder for storing userdata common for all user
+#define ALLUSERAPPDATADIR "AllUserAppData/"
+
+#define RELEASETEMP_DIR "/nps_tmp/"
+#define RELEASETEMP_FILENAME "/ReleaseWork.nps_tmp"
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_TYPES_H_
diff --git a/nsframework/framework_unified/client/include/native_service/ns_plogger_if.h b/nsframework/framework_unified/client/include/native_service/ns_plogger_if.h
new file mode 100755
index 0000000..f926f38
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_plogger_if.h
@@ -0,0 +1,288 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file
+/// Declares functions and macros related to performance logging
+///
+/// \ingroup tag_NSLogger
+/// @{
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ * @brief \~english Declares functions and macros related to performance logging
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+
+#ifndef NS_PLOGGER_IF_H_ // NOLINT (build/header_guard)
+#define NS_PLOGGER_IF_H_
+
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NS_PLOGQ "/NSplog"
+#define NS_SYSEVENTLOGQ "/NSSysEventLog"
+
+/// Performance logging
+typedef enum _EPLOG_TIME_FORMAT {
+ EPLOG_TIME_FORMAT_USEC, ///< microseconds
+ EPLOG_TIME_FORMAT_MSEC, ///< miliseconds
+ EPLOG_TIME_FORMAT_SEC, ///< seconds
+} EPLOG_TIME_FORMAT;
+
+typedef enum _EPLOG_OUTPUT_OPTION {
+ EPLOG_SLOG = 0x01, ///< log to standard logging i.e. slogger
+ EPLOG_MSGQ = 0x02, ///< log to message queue NSPlog
+ EPLOG_TRACEEVENT = 0x04 ///< log to trace events
+} EPLOG_OUTPUT_OPTION;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief Performance LOG parameter
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _FRAMEWORKUNIFIEDLOGPPARAM {
+ BOOL bIsPLogEnabled; ///< PLog enabled or disabled
+ EPLOG_TIME_FORMAT eTimeFormat; ///< Time format when PLog is printed
+ UI_64 ui64GapInuS; ///< Gap in micro seconds
+ UI_8 uiLogOutputOptions; ///< Output log options
+} FRAMEWORKUNIFIEDLOGPPARAM, *LFRAMEWORKUNIFIEDLOGPPARAM;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief System event LOG parameter
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _FRAMEWORKUNIFIEDLOGSYSEVENTPARAM {
+ BOOL bIsSysEventLogEnabled; ///< SysEvent log enabled or disabled
+} FRAMEWORKUNIFIEDLOGSYSEVENTPARAM, *LFRAMEWORKUNIFIEDLOGSYSEVENTPARAM;
+
+extern FRAMEWORKUNIFIEDLOGPPARAM g_FrameworkunifiedLogPParams;
+extern FRAMEWORKUNIFIEDLOGSYSEVENTPARAM g_FrameworkunifiedLogSysEventParams;
+
+#define PLOG_TEXT(args...) NSLogPrintPerformanceLog(__LINE__, __FUNCTION__, ## args)
+#define SYSEVENTLOG_TEXT(args...) NSLogSysEvent(__LINE__, __FUNCTION__, ## args)
+#define IS_PLOG_ENABLED() NsLogIsPLogEnabled()
+#define IS_SYSEVENTLOG_ENABLED() NSLogIsSysEventLogEnabled()
+
+#ifdef __FRAMEWORKUNIFIEDLOG_NDEBUG_LEVEL2__
+#define FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG(print_fmt, args...) ((void)0)
+#else
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG
+///////////////////////////////////////////////////////////////////////////////
+/// Prints a performance log in PosixBasedOS001 system log. These logs can be viewed by using utility sloginfo.
+/// \note This macro API is disable in Linux system
+/// This macro API is disable if defined "__FRAMEWORKUNIFIEDLOG_NDEBUG_LEVEL2__"
+///
+/// \param [in] print_fmt
+/// PCSTR - Input string
+/// \param [in] args
+/// string similar to that of a printf statement and data argments
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG(print_fmt, args...) ((IS_PLOG_ENABLED()) ? PLOG_TEXT(print_fmt, ## args): ((void)0))
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_PERFORMANCE
+///////////////////////////////////////////////////////////////////////////////
+/// FRAMEWORKUNIFIEDLOG_PERFORMANCE is a logging API provided specifically for logging performance metrics.
+/// \note This macro API is disable in Linux system
+/// It should be used in few locations within an application. (Max 5 times per application).
+/// It should never be used in place of FRAMEWORKUNIFIEDLOG.
+///
+/// \param [in] print_fmt
+/// string similar to that of a printf statement
+/// \param [in] args
+/// Data arguments
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_PERFORMANCE(print_fmt, args...) ((IS_PLOG_ENABLED()) ? PLOG_TEXT(print_fmt, ## args): ((void)0))
+
+///////////////////////////////////////////////////////////////////////////////
+/// FRAMEWORKUNIFIEDLOG_SYSTEMEVENT
+///
+/// \param [in] print_fmt
+/// string similar to that of a printf statement
+/// \param [in] args
+/// Data arguments
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_SYSTEMEVENT(print_fmt, args...) ((IS_SYSEVENTLOG_ENABLED()) ?\
+ SYSEVENTLOG_TEXT(print_fmt, ## args): ((void)0))
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSLogPrintPerformanceLog
+/// \~english @par Brief
+/// This macro API is disable in Linux system
+/// \~english @param [in] f_ui16Line
+/// const UI_16 - line number
+/// \~english @param [in] f_cFuncName
+/// PCSTR - Function name. It takes __PRETTY_FUNCTION__
+/// \~english @param [in] print_fmt
+/// PCSTR - Input string
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - Work ony when AGL_STUB is disabled.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// none
+/// \~english @par Detail
+/// Prints a performance log in PosixBasedOS001 system log. These logs can be viewed by using utility sloginfo.
+/// Log is in format: "Plog: Time[us]:x or o (if gap in cs):Line:Function Input string"\n
+/// - Outputs in time units (microseconds/milliseconds/second) that can be set by the NSLogSetPlogTimeFormat.
+/// - The time data to be output is added to the gap data described in the/dev/shmem/Plog.gap files.
+/// - This information is output to the log output destinations (system log, NSPlog message queue, and event trace)
+/// that can be set by the NSLogSetPlogOutputOptions.(Default: NSPLog message queue)
+/// - PLOG_TEXT, Use this API from the FRAMEWORKUNIFIEDLOG_PERFORMANCE and FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG macros.\n
+/// Continued:\n
+/// - PLOG_TEXT("Service Availability Status: %d", IsAvailable);
+/// - FRAMEWORKUNIFIEDLOG_PERFORMANCE("Service Availability Status: %d", IsAvailable);
+/// - FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("Service Availability Status: %d", IsAvailable);
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogPrintPerformanceLog(const UI_16 f_ui16Line, PCSTR f_cFuncName, PCSTR __format, ...);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogEnablePLog
+/// Enables/Disables the performance logging
+///
+/// \param [in] f_bEnable
+/// BOOL - TRUE- Enable performance logging, FALSE - Disable
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogEnablePLog(BOOL f_bEnable);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogIsPLogEnabled
+/// \~english @par Brief
+/// Is Enables/Disables the performance logging
+/// \~english @retval TRUE current state of plog enable.
+/// \~english @retval FALSE current state of plog disable.
+/// \~english @par Prerequisite
+/// -
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// -
+/// \~english @par Detail
+/// Get the Performance Log enable/disable status.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NSLogEnablePLog
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NsLogIsPLogEnabled(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogSetPlogTimeFormat
+/// Set the time format for performance logging.
+///
+/// \param [in] f_ePlogTimeFormat
+/// EPLOG_TIME_FORMAT - Time format for performance logging
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogSetPlogTimeFormat(EPLOG_TIME_FORMAT f_ePlogTimeFormat);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogSetPlogOutputOptions
+/// Set the output options for performance logging.
+///
+/// \param [in] f_uiPlogOutputOption
+/// UI_8 - Output option. Value is generated by or'ed value of enum EPLOG_OUTPUT_OPTION
+/// e.g. EPLOG_SLOG | EPLOG_MSGQ
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogSetPlogOutputOptions(UI_8 f_uiPlogOutputOption);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogSysEvent()
+/// Prints system event log in message queue NSSyseventlog.
+///
+/// \param [in] f_ui16Line
+/// const UI_16 - line number
+/// \param [in] f_cFuncName
+/// PCSTR - Function name. It takes __PRETTY_FUNCTION__
+/// \param [in] __format
+/// PCSTR - Input string
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogSysEvent(const UI_16 f_ui16Line, PCSTR f_cFuncName, PCSTR __format, ...);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogEnableSysEventLog
+/// Enables/Disables the system event logging
+///
+/// \param [in] f_bEnable
+/// BOOL - TRUE- Enable system event logging, FALSE - Disable
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogEnableSysEventLog(BOOL f_bEnable);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogIsSysEventLogEnabled
+/// Is Enables/Disables the system event logging
+///
+/// \return SysEventLogEnabled
+/// BOOL - current state of sys event log(enable/disable).
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NSLogIsSysEventLogEnabled(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* NS_PLOGGER_IF_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/// @}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_rcs_data_handler.hpp b/nsframework/framework_unified/client/include/native_service/ns_rcs_data_handler.hpp
new file mode 100755
index 0000000..6f303f1
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_rcs_data_handler.hpp
@@ -0,0 +1,1159 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * @brief \~english This file contains declaration of CPassThruInDataHandler class
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup nsrcs
+ * @ingroup framework_unified
+ * @{
+ */
+
+// todo: move this file to the rcs interface folder
+
+#ifndef _NS_RCS_DATA_HANDLER_H__ // NOLINT (build/header_guard)
+#define _NS_RCS_DATA_HANDLER_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_endianess.h>
+#include <vector>
+
+#ifdef AGL_STUB
+#include <cstring>
+#endif
+
+typedef UI_8 NSRCS_BOOL;
+
+#define SIZE_OF_PASSTHRU_DATATYPE_IDENTIFIER 1
+#define SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER 3
+#define PASSTHRU_DATA_HEADER_LEN 8
+
+
+// not valid for buffer or array
+// \return - 0 - invalid type id
+/*UI_16 GetLengthOfBasicType(UI_8 f_ui8TypeId)
+{
+
+ UI_16 l_ui16LengthOfBasicType = 0;
+ switch(f_ui8TypeId)
+ {
+ case 0x01: l_ui16LengthOfBasicType = 2; break; // eBool
+ case 0x02: l_ui16LengthOfBasicType = 1; break; // eUint8
+ case 0x03: l_ui16LengthOfBasicType = 2; break; // eUint16
+ case 0x04: l_ui16LengthOfBasicType = 4; break; // eUint32
+ case 0x05: l_ui16LengthOfBasicType = 8; break; // eUint64
+ case 0x06: l_ui16LengthOfBasicType = 1; break; // eSint8
+ case 0x07: l_ui16LengthOfBasicType = 2; break; // eSint16
+ case 0x08: l_ui16LengthOfBasicType = 4; break; // eSint32
+ case 0x09: l_ui16LengthOfBasicType = 8; break; // eSint64
+ case 0x0A: l_ui16LengthOfBasicType = 8; break; // eReal
+ default: break;
+ }
+ return l_ui16LengthOfBasicType;
+}*/
+
+/////////////////////////////////////////
+/// Class: CPassThruInDataHandler
+/////////////////////////////////////////
+/**
+ * @class CPassThruInDataHandler
+ * \~english @brief Data Handler
+ * \~english @par Brief Introduction
+ * Class to get/set function to do input data handler
+ *
+ */
+class CPassThruInDataHandler {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CPassThruInDataHandler
+ /// \~english @par Summary
+ /// Constructor of CPassThruInDataHandler class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a CPassThruInDataHandler class. \n
+ /// Member variables (m_ui8Data, m_ui16TotalLength, m_ui16ParamCount, m_pui8CurOffset, m_ui16RemainingLength) to
+ /// be initialized. \n
+ /// \~english @see ~CPassThruInDataHandler
+ ////////////////////////////////////////////////////////////////////////////////////
+ CPassThruInDataHandler(UI_8 *f_pui8Data, UI_16 f_ui16Length, UI_16 f_ui16ParamCount)
+ : m_ui8Data(f_pui8Data),
+ m_ui16TotalLength(f_ui16Length),
+ m_ui16ParamCount(f_ui16ParamCount),
+ m_pui8CurOffset(f_pui8Data),
+ m_ui16RemainingLength(f_ui16Length) {
+
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CPassThruInDataHandler
+ /// \~english @par Summary
+ /// Destructor of CPassThruInDataHandler class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a CPassThruInDataHandler class. \n
+ /// \~english @see CPassThruInDataHandler
+ ////////////////////////////////////////////////////////////////////////////////////
+ ~CPassThruInDataHandler() {
+ m_ui8Data = NULL; // Do not delete. Because, not allocated in this class
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetBool
+ /// \~english @par Brief
+ /// This function is used to convert value to type NSRCS_BOOL
+ /// \~english @param [out] f_rcsboolOutValue
+ /// NSRCS_BOOL & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type NSRCS_BOOL(f_rcsboolOutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetBool(NSRCS_BOOL &f_rcsboolOutValue) {
+ return GetValue<NSRCS_BOOL>(f_rcsboolOutValue);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetUI8
+ /// \~english @par Brief
+ /// This function is used to convert value to type UI_8
+ /// \~english @param [out] f_rcsboolOutValue
+ /// UI_8 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type UI_8(f_ui8OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetUI8(UI_8 &f_ui8OutValue) {
+ return GetValue<UI_8>(f_ui8OutValue);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetUI16
+ /// \~english @par Brief
+ /// This function is used to convert value to type UI_16
+ /// \~english @param [out] f_rcsboolOutValue
+ /// UI_16 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type UI_16(f_ui16OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetUI16(UI_16 &f_ui16OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<UI_16>(f_ui16OutValue);
+ f_ui16OutValue = ConvertEndian_UI16(f_ui16OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetUI32
+ /// \~english @par Brief
+ /// This function is used to convert value to type UI_32
+ /// \~english @param [out] f_rcsboolOutValue
+ /// UI_32 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type UI_32(f_ui32OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetUI32(UI_32 &f_ui32OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<UI_32>(f_ui32OutValue);
+ f_ui32OutValue = ConvertEndian_UI32(f_ui32OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetUI64
+ /// \~english @par Brief
+ /// This function is used to convert value to type UI_64
+ /// \~english @param [out] f_rcsboolOutValue
+ /// UI_64 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type UI_64(f_ui64OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetUI64(UI_64 &f_ui64OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<UI_64>(f_ui64OutValue);
+ f_ui64OutValue = ConvertEndian_UI64(f_ui64OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetSI8
+ /// \~english @par Brief
+ /// This function is used to convert value to type SI_8
+ /// \~english @param [out] f_rcsboolOutValue
+ /// SI_8 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type SI_8(f_si8OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetSI8(SI_8 &f_si8OutValue) {
+ return GetValue<SI_8>(f_si8OutValue);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetSI16
+ /// \~english @par Brief
+ /// This function is used to convert value to type SI_16
+ /// \~english @param [out] f_rcsboolOutValue
+ /// SI_16 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type SI_16(f_si16OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetSI16(SI_16 &f_si16OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<SI_16>(f_si16OutValue);
+ f_si16OutValue = ConvertEndian_SI16(f_si16OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetSI32
+ /// \~english @par Brief
+ /// This function is used to convert value to type SI_32
+ /// \~english @param [out] f_rcsboolOutValue
+ /// SI_32 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type SI_32(f_si32OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetSI32(SI_32 &f_si32OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<SI_32>(f_si32OutValue);
+ f_si32OutValue = ConvertEndian_SI32(f_si32OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetSI64
+ /// \~english @par Brief
+ /// This function is used to convert value to type SI_64
+ /// \~english @param [out] f_rcsboolOutValue
+ /// SI_64 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type SI_64(f_si64OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetSI64(SI_64 &f_si64OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<SI_64>(f_si64OutValue);
+ f_si64OutValue = ConvertEndian_SI64(f_si64OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetBuffer
+ /// \~english @par Brief
+ /// This function is used to get the buffer and its size.
+ /// \~english @param [out] f_pui8Buffer
+ /// UI_8 *& - buffer address
+ /// \~english @param [out] f_ui16BufLength
+ /// UI_16 - buffer size
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_ui16RemainingLength) is invalid(outrange of the size
+ /// SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER) [eFrameworkunifiedStatusInvldParam]
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get buffer address(f_pui8Buffer) and its size.
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetBuffer(UI_8 *&f_pui8Buffer, UI_16 &f_ui16BufLength) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (f_pui8Buffer == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "f_pui8Buffer is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ if (m_pui8CurOffset == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "m_pui8CurOffsetis NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ if (m_ui16RemainingLength >= SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER) {
+ if (0xB == *m_pui8CurOffset) { // check if the corresponding data is of type buffer
+ m_pui8CurOffset++;
+ f_ui16BufLength = *(static_cast<UI_16 *>(static_cast<PVOID>(m_pui8CurOffset)));
+ f_ui16BufLength = ConvertEndian_UI16(f_ui16BufLength);
+ m_pui8CurOffset += sizeof(UI_16);
+ m_ui16RemainingLength = static_cast<UI_16>(m_ui16RemainingLength - SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER);
+
+ if (m_ui16RemainingLength >= f_ui16BufLength) {
+ f_pui8Buffer = m_pui8CurOffset;
+ m_pui8CurOffset += f_ui16BufLength;
+ m_ui16RemainingLength = static_cast<UI_16>(m_ui16RemainingLength - f_ui16BufLength);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetArrayCount
+ /// \~english @par Brief
+ /// This function is used to get the buffer and its size.
+ /// \~english @param [out] f_ui16NoOfArrayElements
+ /// UI_16 - buffer size
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - If no array id found at the current location
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient buffer to read the data
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_ui16RemainingLength) is invalid(outrange of the size
+ /// SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER) [eFrameworkunifiedStatusInvldParam]
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get buffer address(f_pui8Buffer) and its size.
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetArrayCount(UI_16 &f_ui16NoOfArrayElements) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (m_pui8CurOffset == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "m_pui8CurOffsetis NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ if (m_ui16RemainingLength >= SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER) {
+ if (0xC == *m_pui8CurOffset) { // check if the corresponding data is of type array
+ m_pui8CurOffset++;
+ f_ui16NoOfArrayElements = *(static_cast<UI_16 *>(static_cast<PVOID>(m_pui8CurOffset)));
+ f_ui16NoOfArrayElements = ConvertEndian_UI16(f_ui16NoOfArrayElements);
+ m_pui8CurOffset += sizeof(UI_16);
+ m_ui16RemainingLength = static_cast<UI_16>(m_ui16RemainingLength - SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ return l_eStatus;
+ }
+
+ UI_16 GetDataLength() {
+ return m_ui16TotalLength;
+ }
+
+ private:
+ // template <class DataType>
+ // EFrameworkunifiedStatus GetValue(DataType& f_dtOutValue);
+
+
+ /*
+ * \return -
+ * eFrameworkunifiedStatusFail - no sufficient data is available
+ * eFrameworkunifiedStatusOK - data retrieved
+ * eFrameworkunifiedStatusInvldID - invalid data type id passed
+ */
+ template <class DataType>
+ EFrameworkunifiedStatus GetValue(DataType &l_dtOutValue) {
+ if (m_pui8CurOffset == NULL) {
+ FRAMWEORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "m_pui8CurOffsetis NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (m_ui16RemainingLength >= (sizeof(DataType) + SIZE_OF_PASSTHRU_DATATYPE_IDENTIFIER)) {
+ if ((0x1 <= *m_pui8CurOffset) && (*m_pui8CurOffset <= 0x9)) // Get value is applicable only for basic types,
+ // not for buffer and array
+ {
+ m_pui8CurOffset++;
+ l_dtOutValue = *(static_cast<DataType *>(static_cast<PVOID>(m_pui8CurOffset)));
+ m_ui16RemainingLength = static_cast<UI_16>(m_ui16RemainingLength - sizeof(DataType));
+ m_pui8CurOffset += sizeof(DataType);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ return l_eStatus;
+ }
+
+ UI_8 *m_ui8Data;
+ UI_16 m_ui16TotalLength; // total data length
+ UI_16 m_ui16ParamCount;
+
+ UI_8 *m_pui8CurOffset;
+ UI_16 m_ui16RemainingLength; // remaining data length. Not yet parsed
+};
+
+/////////////////////////////////////////
+//// CPassThruOutDataHandler
+/////////////////////////////////////////
+/**
+ * @class CPassThruOutDataHandler
+ * \~english @brief Data Handler
+ * \~english @par Brief Introduction
+ * Class to get/set function to do output data handler
+ *
+ */
+class CPassThruOutDataHandler {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CPassThruOutDataHandler
+ /// \~english @par Summary
+ /// Constructor of CPassThruOutDataHandler class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a CPassThruOutDataHandler class. \n
+ /// Member variables (m_ui16TotalLength, m_ui16ParamCount, m_ui16CurOffset, m_ui16CurrentArrCount,
+ /// m_bArrayTypeSet, m_ui8LastArrDataType) to be initialized. \n
+ /// \~english @see ~CPassThruOutDataHandler
+ ////////////////////////////////////////////////////////////////////////////////////
+ CPassThruOutDataHandler(UI_8 f_ui8ClientId, UI_8 f_ui8PluginId, UI_32 f_ui32CommandId)
+ : m_ui16TotalLength(PASSTHRU_DATA_HEADER_LEN),
+ m_ui16ParamCount(0),
+ m_ui16CurOffset(0),
+ m_ui16CurrentArrCount(0),
+ m_bArrayTypeSet(FALSE),
+ m_ui8LastArrDataType(0) { // default data type eNull
+ m_vui8Data.resize(PASSTHRU_DATA_HEADER_LEN);
+ // TODO: check error condition for resize operation
+ // TODO: try if &m_vui8Data[m_ui16CurOffset] directly works without casting
+ *static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = f_ui8ClientId;
+ m_ui16CurOffset++;
+ *static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = f_ui8PluginId;
+ m_ui16CurOffset++;
+ *static_cast<UI_32 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = ConvertEndian_UI32(f_ui32CommandId);
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + sizeof(UI_32));
+ *static_cast<UI_16 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = 0; // initialize param count
+ m_ui16ParamCount = m_ui16CurOffset;
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + sizeof(UI_16));
+ m_ui8ClientId = f_ui8ClientId;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CPassThruOutDataHandler
+ /// \~english @par Summary
+ /// Destructor of CPassThruOutDataHandler class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a CPassThruOutDataHandler class. \n
+ /// \~english @see CPassThruOutDataHandler
+ ////////////////////////////////////////////////////////////////////////////////////
+ ~CPassThruOutDataHandler() {
+ m_vui8Data.clear();
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetClientID
+ /// \~english @par Brief
+ /// This function is used to get clinet id.
+ /// \~english @param none
+ /// \~english @retval
+ /// UI_8 - client id
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(m_ui8ClientId).
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_8 GetClientID() {
+ return m_ui8ClientId;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetData
+ /// \~english @par Brief
+ /// This function is used to get m_vui8Data data address.
+ /// \~english @param none
+ /// \~english @retval
+ /// UI_8 * - m_vui8Data data address
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return m_vui8Data data address.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_8 *GetData() {
+ return static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[0]));
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetLength
+ /// \~english @par Brief
+ /// This function is used to get m_ui16CurOffset value.
+ /// \~english @param none
+ /// \~english @retval
+ /// UI_16 - m_ui16CurOffset value
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return m_ui16CurOffset value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_16 GetLength() {
+ return m_ui16CurOffset;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetBool
+ /// \~english @par Brief
+ /// This function is used to set NSRCS_BOOL type value.
+ /// \~english @param[in] f_rcsboolValue
+ /// NSRCS_BOOL - new NSRCS_BOOL value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set NSRCS_BOOL type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetBool(NSRCS_BOOL &f_rcsboolValue) {
+ return SetValue<NSRCS_BOOL>(f_rcsboolValue, 0x1);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetUI8
+ /// \~english @par Brief
+ /// This function is used to set UI_8 type value.
+ /// \~english @param[in] f_ui8Value
+ /// UI_8 - new UI_8 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set UI_8 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetUI8(UI_8 f_ui8Value) {
+ return SetValue<UI_8>(f_ui8Value, 0x2);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetUI16
+ /// \~english @par Brief
+ /// This function is used to set UI_16 type value.
+ /// \~english @param[in] f_ui16Value
+ /// UI_16 - new UI_16 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set UI_16 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetUI16(UI_16 f_ui16Value) {
+ return SetValue<UI_16>(ConvertEndian_UI16(f_ui16Value), 0x3);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetUI32
+ /// \~english @par Brief
+ /// This function is used to set UI_32 type value.
+ /// \~english @param[in] f_ui32Value
+ /// UI_32 - new UI_32 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set UI_32 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetUI32(UI_32 f_ui32Value) {
+ return SetValue<UI_32>(ConvertEndian_UI32(f_ui32Value), 0x4);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetUI64
+ /// \~english @par Brief
+ /// This function is used to set UI_64 type value.
+ /// \~english @param[in] f_ui64Value
+ /// UI_64 - new UI_64 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set UI_64 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetUI64(UI_64 f_ui64Value) {
+ return SetValue<UI_64>(ConvertEndian_UI64(f_ui64Value), 0x5);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetSI8
+ /// \~english @par Brief
+ /// This function is used to set SI_8 type value.
+ /// \~english @param[in] f_si8Value
+ /// SI_8 - new SI_8 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set SI_8 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetSI8(SI_8 f_si8Value) {
+ return SetValue<SI_8>(f_si8Value, 0x6);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetSI16
+ /// \~english @par Brief
+ /// This function is used to set SI_16 type value.
+ /// \~english @param[in] f_si16Value
+ /// SI_16 - new SI_16 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set SI_16 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetSI16(SI_16 f_si16Value) {
+ return SetValue<SI_16>(ConvertEndian_SI16(f_si16Value), 0x7);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetSI32
+ /// \~english @par Brief
+ /// This function is used to set SI_32 type value.
+ /// \~english @param[in] f_si32Value
+ /// SI_32 - new SI_32 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set SI_32 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetSI32(SI_32 f_si32Value) {
+ return SetValue<SI_32>(ConvertEndian_SI32(f_si32Value), 0x8);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetSI64
+ /// \~english @par Brief
+ /// This function is used to set SI_64 type value.
+ /// \~english @param[in] f_si64Value
+ /// SI_64 - new SI_64 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set SI_64 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetSI64(SI_64 f_si64Value) {
+ return SetValue<SI_64>(ConvertEndian_SI64(f_si64Value), 0x9);
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetBuffer
+ /// \~english @par Brief
+ /// This function is used to set buffer and size.
+ /// \~english @param[in] f_pui8Buffer
+ /// UI_8* - buffer address
+ /// \~english @param[in] f_ui16BufLength
+ /// UI_16 - buffer size
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - data member(m_ui8LastArrDataType) is invalid value
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set buffer and size.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetBuffer(UI_8 *f_pui8Buffer, UI_16 f_ui16BufLength) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // TODO: add error check for resize operation
+ if (f_pui8Buffer == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "f_pui8Buffer is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ m_ui16TotalLength = static_cast<UI_16>(m_ui16TotalLength + f_ui16BufLength + SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER);
+ m_vui8Data.resize(m_ui16TotalLength);
+ *static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = 0xB;
+ m_ui16CurOffset++;
+ *static_cast<UI_16 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = ConvertEndian_UI16(f_ui16BufLength);
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + sizeof(UI_16));
+ std::memcpy(&m_vui8Data[m_ui16CurOffset], f_pui8Buffer, f_ui16BufLength);
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + f_ui16BufLength);
+
+ if (!m_bArrayTypeSet) {
+// *static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount])) =
+// (*static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount]))) + 1;
+ UpdateParamCount();
+ } else {
+ // setting array element
+ m_ui16CurrentArrCount--;
+
+ if ((m_ui8LastArrDataType != 0) && (m_ui8LastArrDataType != 0xB)) {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ } else {
+ m_ui8LastArrDataType = 0xB;
+ if (0 == m_ui16CurrentArrCount) {
+ m_ui8LastArrDataType = 0; // default data type eNull
+ m_bArrayTypeSet = FALSE;
+ }
+ }
+ }
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetArrayCount
+ /// \~english @par Brief
+ /// This function is used to set ArrayCount.
+ /// \~english @param f_ui16ArrayCount
+ /// UI_16 - ArrayCount
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set ArrayCount.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetArrayCount(UI_16 f_ui16ArrayCount) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // TODO: add error check for resize operation
+ m_ui16TotalLength = static_cast<UI_16>(m_ui16TotalLength + SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER);
+ m_vui8Data.resize(m_ui16TotalLength);
+ *static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = 0xC;
+ m_ui16CurOffset++;
+ *static_cast<UI_16 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = ConvertEndian_UI16(f_ui16ArrayCount);
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + sizeof(UI_16));
+
+ m_ui16CurrentArrCount = f_ui16ArrayCount;
+ m_bArrayTypeSet = TRUE;
+// *static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount])) =
+// (*static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount]))) + 1;
+ UpdateParamCount();
+
+ // TODO: add error handling, if any other element is added before the array count reaches to f_ui16ArrayCount
+ return l_eStatus;
+ }
+
+ private:
+ CPassThruOutDataHandler() {
+
+ }
+
+ // SetValue
+ // \return - eFrameworkunifiedStatusInvldID - If setting array element of different type
+ template <class DataType>
+ EFrameworkunifiedStatus SetValue(DataType l_dtValue, UI_8 f_ui8DataType) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // TODO: add error check for resize operation
+
+ m_ui16TotalLength = static_cast<UI_16>(m_ui16TotalLength + SIZE_OF_PASSTHRU_DATATYPE_IDENTIFIER + sizeof(DataType));
+ m_vui8Data.resize(m_ui16TotalLength);
+ *static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = f_ui8DataType;
+ m_ui16CurOffset++;
+ *static_cast<DataType *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = l_dtValue;
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + sizeof(DataType));
+
+ if (!m_bArrayTypeSet) {
+// *static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount])) =
+// (*static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount]))) + 1;
+ UpdateParamCount();
+ } else {
+ // setting array element
+ m_ui16CurrentArrCount--;
+
+ if ((m_ui8LastArrDataType != 0) && (m_ui8LastArrDataType != f_ui8DataType)) {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ } else {
+ m_ui8LastArrDataType = f_ui8DataType;
+ if (0 == m_ui16CurrentArrCount) {
+ m_ui8LastArrDataType = 0; // default data type eNull
+ m_bArrayTypeSet = FALSE;
+ }
+ }
+ }
+ return l_eStatus;
+ }
+
+ VOID UpdateParamCount() {
+ UI_16 l_ui16ParamCount = static_cast<UI_16>(ConvertEndian_UI16(*static_cast<UI_16 *>(static_cast<PVOID>
+ (&m_vui8Data[m_ui16ParamCount]))) + 1);
+ l_ui16ParamCount = ConvertEndian_UI16(l_ui16ParamCount);
+ *static_cast<UI_16 *>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount])) = l_ui16ParamCount;
+ }
+
+ // UI_8* m_ui8Data;
+ std::vector<UI_8> m_vui8Data;
+ UI_16 m_ui16TotalLength; // total data length
+ UI_16 m_ui16ParamCount;
+ UI_16 m_ui16CurOffset;
+ UI_8 m_ui8ClientId;
+
+ // required for array data type
+ UI_16 m_ui16CurrentArrCount;
+ BOOL m_bArrayTypeSet;
+ UI_8 m_ui8LastArrDataType;
+};
+
+#endif // _NS_RCS_DATA_HANDLER_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_rcs_logger_types.h b/nsframework/framework_unified/client/include/native_service/ns_rcs_logger_types.h
new file mode 100755
index 0000000..cc28f7c
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_rcs_logger_types.h
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * ns_rcs_logger_if.h
+ */
+/**
+ * @file
+ * @brief \~english This file provides logger type's structures
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup nsrcs
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _NS_RCS_LOGGER_IF_H_ // NOLINT (build/header_guard)
+#define _NS_RCS_LOGGER_IF_H_
+
+#include <native_service/ns_logger_if.h>
+
+// protocol: NSRCS_SET_LOG_SETTINGS_REQ,
+// NSRCS_SET_LOG_MASK_REQ,
+// NSRCS_SET_LOG_OUT_OPT_REQ,
+// NSRCS_SET_LOG_SEVERITY_REQ
+typedef struct _TNSRCS_SetLogSettingsReq {
+ UI_8 m_ui8ClientId;
+ TFrameworkunifiedZoneMask m_pui32ZoneMask;
+ UI_8 m_ui8OutputLogOption;
+ TFrameworkunifiedLoggerSeverity m_si32Severity;
+} TNSRCS_SetLogSettingsReq;
+
+// protocol: NSRCS_SET_LOG_SETTINGS_RESP
+typedef struct _TNSRCS_SetLogSettingsResp {
+ UI_8 m_ui8ClientId;
+ UI_8 m_ui8SetStatus;
+ TFrameworkunifiedZoneMask m_pui32ZoneMask;
+ UI_8 m_ui8OutputLogOption;
+ TFrameworkunifiedLoggerSeverity m_si32Severity;
+} TNSRCS_SetLogSettingsResp;
+
+// protocol: NSRCS_GET_LOG_SETTINGS_REQ
+typedef struct _TNSRCS_GetLogSettingsReq {
+ UI_8 m_ui8ClientId;
+} TNSRCS_GetLogSettingsReq;
+
+// protocol: NSRCS_GET_LOG_SETTINGS_RESP
+typedef struct _TNSRCS_GetLogSettingsResp {
+ UI_8 m_ui8ClientId;
+ CHAR m_cZoneList[BITS_IN_ZONE_MASK][ZONE_TEXT_SIZE];
+ TFrameworkunifiedZoneMask m_pui32ZoneMask;
+ UI_8 m_ui8OutputLogOption;
+ TFrameworkunifiedLoggerSeverity m_si32Severity;
+} TNSRCS_GetLogSettingsResp;
+
+// protocol: NSRCS_SET_LOG_MASK_RESP
+typedef struct _TNSRCS_SetLogMaskResp {
+ UI_8 m_ui8ClientId;
+ UI_8 m_ui8SetStatus;
+ TFrameworkunifiedZoneMask m_pui32ZoneMask;
+} TNSRCS_SetLogMaskResp;
+
+// protocol: NSRCS_SET_LOG_OUT_OPT_RESP
+typedef struct _TNSRCS_SetLogOutOptResp {
+ UI_8 m_ui8ClientId;
+ UI_8 m_ui8SetStatus;
+ UI_8 m_ui8OutputLogOption;
+} TNSRCS_SetLogOutOptResp;
+
+// protocol: NSRCS_SET_LOG_SEVERITY_RESP
+typedef struct _TNSRCS_SetLogSeverityResp {
+ UI_8 m_ui8ClientId;
+ UI_8 m_ui8SetStatus;
+ SI_32 m_si32Severity;
+} TNSRCS_SetLogSeverityResp;
+
+#endif /* _NS_RCS_LOGGER_IF_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_rcs_plugin.hpp b/nsframework/framework_unified/client/include/native_service/ns_rcs_plugin.hpp
new file mode 100755
index 0000000..617aa1d
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_rcs_plugin.hpp
@@ -0,0 +1,328 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * @brief \~english This file contains the declaration of CNSRcsPlugin class
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup nsrcs
+ * @ingroup framework_unified
+ * @{
+ */
+
+#ifndef _NS_RCS_PLUGIN_H__ // NOLINT (build/header_guard)
+#define _NS_RCS_PLUGIN_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+typedef EFrameworkunifiedStatus(*TFPNSRcsSendPassthruData)(UI_8 f_ui8clientId, PVOID f_data, UI_16 f_ui16PayloadLength);
+
+// forward declaration
+class CPassThruInDataHandler;
+
+/**
+ * @class CNSRcsPlugin
+ * \~english @brief CNSRcsPlugin
+ * \~english @par Brief Introduction
+ * Class to provide base class of CNSRcsPlugin
+ */
+
+class CNSRcsPlugin {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// Constructor of CNSRcsPlugin class.
+ /// \~english @param [in] f_cPluginName
+ /// std::string - the name of plugin
+ /// \~english @param [in] f_fpNSRcsSendPassthruData
+ /// TFPNSRcsSendPassthruData - the pointer of send data function
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Constructor of CNSRcsPlugin class. \n
+ /// variables (m_cPluginName,m_fpNSRcsSendPassthruData,m_uiPluginId) to be initialization.
+ /// \~english @see ~CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ CNSRcsPlugin(std::string f_cPluginName, TFPNSRcsSendPassthruData f_fpNSRcsSendPassthruData)
+ : m_fpNSRcsSendPassthruData(f_fpNSRcsSendPassthruData),
+ m_cPluginName(f_cPluginName) {
+ static UI_8 l_uiPluginId = 0;
+ m_uiPluginId = ++l_uiPluginId;
+ }
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// Destructor of CNSRcsPlugin class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// To delete a CNSRcsPlugin class. \n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CNSRcsPlugin() {
+
+ }
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// get plugin id.
+ /// \~english @param None
+ /// \~english @retval Plugin Id
+ /// UI_8 - the ID of plugin
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar get plugin id. \n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_8 GetPluginId() {
+ return m_uiPluginId;
+ }
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// get plugin id.
+ /// \~english @param None
+ /// \~english @retval m_cPluginName
+ /// std::string - the name of plugin
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar get plugin name. \n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ std::string GetPluginName() {
+ return m_cPluginName;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// set parent name.
+ /// \~english @param f_cParentName
+ /// std::string - the name of parent
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar set parent name. \n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ static VOID SetParentName(const std::string &f_cParentName) {
+ CNSRcsPlugin::m_cParentName = f_cParentName;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// request from host side.
+ /// \~english @param f_uiProtocol
+ /// UI_32 - protocol ID
+ /// \~english @param f_ui8ClientId
+ /// UI_8 - client ID
+ /// \~english @param f_pData
+ /// CPassThruInDataHandler - the handler of transfer data
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar request from host side.\n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ProcessRequestMessage(UI_32 f_uiProtocol, UI_8 f_ui8ClientId, CPassThruInDataHandler *f_pData) = 0;
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// response from service side on target
+ /// \~english @param f_cMsgSource
+ /// PCSTR -
+ /// \~english @param f_uiProtocol
+ /// UI_32 - protocol ID
+ /// \~english @param f_pui8Data
+ /// UI_8 - pointer of data
+ /// \~english @param f_uiDataLength
+ /// UI_32 - length of data
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar response from service side on target.\n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ProcessResponseMessage(PCSTR f_cMsgSource, UI_32 f_uiProtocol, UI_8 *f_pui8Data,
+ UI_32 f_uiDataLength) = 0;
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// get response protocol array
+ /// \~english @param none
+ /// \~english @retval UI_32 const *
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar get response protocol array.\n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual UI_32 const *GetResponseProtocolArray() = 0;
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// get length of response protocol array
+ /// \~english @param none
+ /// \~english @retval UI_32 const
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar get length of response protocol array.\n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual UI_32 const GetResponseProtocolArrayLength() = 0;
+
+ static std::string m_cParentName; // TODO: move to private
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// the function of transport data
+ /// \~english @param f_ui8ClientId
+ /// UI_8 - client id
+ /// \~english @param f_data
+ /// PVOID - the pointer of transport data
+ /// \~english @param f_ui16PayloadLength
+ /// UI_16 - the size of transport data
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar the function of transport data.\n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SendPassthruOutData(UI_8 f_ui8clientId, PVOID f_data, UI_16 f_ui16PayloadLength) {
+ return m_fpNSRcsSendPassthruData(f_ui8clientId, f_data, f_ui16PayloadLength);
+ }
+ private:
+ CNSRcsPlugin() {
+ }
+
+ UI_8 m_uiPluginId;
+ TFPNSRcsSendPassthruData m_fpNSRcsSendPassthruData;
+ std::string m_cPluginName;
+};
+
+// std::string CNSRcsPlugin::m_cParentName = "";
+
+#endif // _NS_RCS_PLUGIN_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_reader.h b/nsframework/framework_unified/client/include/native_service/ns_reader.h
new file mode 100755
index 0000000..f306a52
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_reader.h
@@ -0,0 +1,207 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class IConfigReader.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_reader.h
+ * @brief \~english This file contains declaration of class IConfigReader.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_READER_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_READER_H__ // NOLINT(build/header_guard)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h> // NOLINT(build/header_guard)
+#include <string>
+
+/*
+ * IConfigReader is an abstract class which is inherited by different type configuration file
+ * reader class.
+ */
+/**
+ * @class IConfigReader
+ * \~english @brief IConfigReader
+ * \~english @par Brief Introduction
+ * Class to provide class of parse config file.
+ */
+class IConfigReader {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// Constructor of IConfigReader class.
+ /// \~english @param none
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Constructor of IConfigReader class.
+ /// \~english @see ~IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ IConfigReader();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// Destructor of IConfigReader class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// To delete a IConfigReader class.
+ /// \~english @see IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~IConfigReader();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// This function is used to parse the file.
+ /// \~english @param [IN] f_c_filepath
+ /// const std::string - path of file to parse.
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to parse the file.\n
+ /// This is abstract function.
+ /// \~english @see IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ParseFile(const std::string &f_c_filepath) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// This function is used to get the value associated with the key.
+ /// \~english @param [IN] f_c_key
+ /// const std::string - key to search.
+ /// \~english @retval l_cValue value for key
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to get the value associated with the key.\n
+ /// This is abstract function.
+ /// \~english @see IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual std::string GetValue(const std::string &f_c_key) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// This function is used to get the value associated with the key.
+ /// \~english @param [IN] f_c_key
+ /// const std::string - key to search.
+ /// \~english @param [OUT] f_c_value
+ /// const std::string - value for key.
+ /// \~english @retval EFrameworkunifiedStatus error error if key not found else eFrameworkunifiedStatusOK
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to get the value associated with the key.\n
+ /// This is abstract function.
+ /// \~english @see IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus GetValue(const std::string &f_c_key, std::string &f_c_value) = 0; // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// This function is used to get the data pointer.
+ /// \~english @param none.
+ /// \~english @retval PVOID - pointer of data structure
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to get the data pointer. This pointer is then set in config writer.\n
+ /// This is needed to avoid recreation of same data structure object in both reader and writer.\n
+ /// when we create object of NSConfigParser.
+ /// This is abstract function.
+ /// \~english @see IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual PVOID GetDataPtr() = 0;
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_READER_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/ns_resource_controler.h b/nsframework/framework_unified/client/include/native_service/ns_resource_controler.h
new file mode 100755
index 0000000..0cce23a
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_resource_controler.h
@@ -0,0 +1,216 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ns_resource_controler.h
+ * @brief \~english This file provides api for operating Resource
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _ns_resource_controler_h_ // NOLINT (build/header_guard)
+#define _ns_resource_controler_h_
+
+#define FRAMEWORKUNIFIED_RES_ABNMLMON "FRAMEWORKUNIFIED_RES_ABNMLMON"
+#define FRAMEWORKUNIFIED_RES_TIMER "FRAMEWORKUNIFIED_RES_TIMER"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to get the resourceid associated with the mod and the key.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] key
+ /// const char * - the key of resource
+ /// \~english @param [OUT] resource
+ /// long * - resource ID
+ /// \~english @retval -1 fail
+ /// \~english @retval 0 success
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to get the resourceid associated with the mod and the key.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+int frameworkunifiedGetResource(const char *mod, const char *key, long *resource); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to acquire the resourceid associated with the mod and the key.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] key
+ /// const char * - the key of resource
+ /// \~english @param [OUT] resource
+ /// long * - resource ID
+ /// \~english @retval ref_counter the counter of user
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to acquire the resourceid associated with the mod and the key.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+int frameworkunifiedAcquireResouce(const char *mod, const char *key, long *resource); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to release the resourceid associated with the mod and the key.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] key
+ /// const char * - the key of resource
+ /// \~english @retval ref_counter the counter of user
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to release the resourceid associated with the mod and the key.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+int frameworkunifiedReleaseResouce(const char *mod, const char *key);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to get the key associated with the mod and the resourceid.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] resource
+ /// long - resource ID
+ /// \~english @param [OUT] key
+ /// const char * - the key of resource
+ /// \~english @retval -1 fail
+ /// \~english @retval 0 success
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to get the key associated with the mod and the resourceid.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+int frameworkunifiedSearchResourseKey(const char *mod, long resource, const char **key); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to register the resource associated with the mod and the key.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] key
+ /// const char * - the key of resource
+ /// \~english @param [IN] resource
+ /// const char * - resource ID
+ /// \~english @param [IN] init_counter
+ /// long - resource user counter
+ /// \~english @retval -1 fail
+ /// \~english @retval 0 success
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to register the resource associated with the mod and the key.init counter.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+
+int frameworkunifiedRegistResouce(const char *mod, const char *key, long resource, int init_counter); // NOLINT (readability/nolint)
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to unregister the resource associated with the mod and the key.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] key
+ /// const char * - the key of resource
+ /// \~english @retval 0 success
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to unregister the resource associated with the mod and the key.init counter.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+int frameworkunifiedUnregistResouce(const char *mod, const char *key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _ns_resource_controler_h_ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_ringbuffer.h b/nsframework/framework_unified/client/include/native_service/ns_ringbuffer.h
new file mode 100755
index 0000000..b67cd17
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_ringbuffer.h
@@ -0,0 +1,523 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSRingBuffer
+/// \brief This file contains implementation of class CNSRingBuffer.
+/// This class provides API to open, read, write and close ring buffer
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_ringbuffer.h
+ * @brief \~english This file contains implementation of class CNSRingBuffer.
+ * This class provides API to open, read, write and close ring buffer
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_RINGBUFFER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_RINGBUFFER_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <pthread.h>
+
+#include <native_service/frameworkunified_types.h>
+
+#include <string>
+
+// Structure of the header of the ring buffer
+typedef struct _NSRingBufferHdr {
+ UI_32 m_uiReadPtr; // Read pointer
+ UI_32 m_uiWritePtr; // Write pointer
+ UI_32 m_uiUnReadSize; // Data size not read yet
+ BOOL m_bIsFull; // Flag indicating if the buffer has full of data
+ UI_32 m_uiRingBufferSize; // Size of the ring buffer
+} NSRingBufferHdr;
+
+// Structure of the mutex of the ring buffer
+typedef struct _NSRingBufferMtx {
+ pthread_mutex_t m_tBufMutex; // Mutex object to mutual exclusion
+ int m_lid;
+} NSRingBufferMtx;
+
+
+/**
+ * @class CNSRingBuffer
+ * \~english @brief CNSRingBuffer
+ * \~english @par Brief Introduction
+ * Class to provide class of ring buffer.
+ */
+class CNSRingBuffer {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// Constructor for CNSRingBuffer
+ /// \~english @param[in] f_cMappedFilePath
+ /// const std::string& - path of the ring buffer mapped file
+ /// \~english @param[in] f_uiSize
+ /// const UI_32 - size of ring buffer
+ /// \~english @param[in] f_lid
+ /// int - Lock ID
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Create an instance of CNSRingBuffer class.\n
+ /// Initializes cass member (m_cMappedFilePath, m_uiRingBuffSize, m_pRbufMtx, m_pRbufHdr,
+ /// m_pRbuf, m_lid, m_pLockAddr, m_siProcessLastWrtPage, m_cRbufMtxName).\n
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Constructor of CNSRingBuffer class.
+ /// variables (m_cMappedFilePath, m_uiRingBuffSize, m_pRbufMtx, m_pRbufHdr,
+ /// m_pRbuf, m_lid, m_pLockAddr, m_siProcessLastWrtPage, m_cRbufMtxName) to be initialization.
+ /// \~english @see ~CNSRingBuffer
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSRingBuffer(const std::string &f_cMappedFilePath, const UI_32 f_uiSize, int f_lid = -1);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// Destructor for CNSRingBuffer.
+ /// \~english @param none
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - The constructor creates an instance of the CNSRingBuffer class.
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Closes the ring buffer, if it is open.
+ /// \~english @par
+ /// Closes the ring buffer if it is open.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CNSRingBuffer
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSRingBuffer();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function opens and maps the ring buffer object.
+ /// \~english @param none
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusInvldParam
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @retval eFrameworkunifiedStatusErrOther
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - Different Lock ID in constructor parameter and mutex object [eFrameworkunifiedStatusInvldParam]
+ /// - If the path at the time of CNSRingBuffer class instantiation is empty [eFrameworkunifiedStatusFail]
+ /// - When the CNSRingBuffer class is instantiated with a path longer than 255 characters... [eFrameworkunifiedStatusFail]
+ /// - If accessing the information header file (shm_open/ mmap) fails [eFrameworkunifiedStatusFail]
+ /// - When accessing the ring buffer file (shm_open/ mmap) fails [eFrameworkunifiedStatusFail]
+ /// - Accessing a mutex file (shm_open/ mmap) fails [eFrameworkunifiedStatusFail]
+ /// - Alreadey opened [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Detail
+ /// It creates the ring buffer if it does not exists.
+ /// Opens the path information header, ring buffer, and mutex set at instance creation.
+ /// \~english @par
+ /// Update ring buffer size for instances created with different sizes on the same path.
+ /// \~english @par
+ /// Execute close() to close.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CNSRingBuffer, Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Open();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function is used to check whether the ring buffer is opened or not..
+ /// \~english @param none
+ /// \~english @retval TRUE - Open
+ /// \~english @retval FALSE - Not open
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// This function is used to check whether the ring buffer is opened or not.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CNSRingBuffer, Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsOpen();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function unmaps the ring buffer object.
+ /// \~english @param none
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// - Open has been performed.
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - not open [eFrameworkunifiedStatusFail]
+ /// - information header file munmap fail [eFrameworkunifiedStatusFail]
+ /// - ring buffer file munmap fail [eFrameworkunifiedStatusFail]
+ /// - minidesk file munmap fail [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function unmaps the ring buffer object.
+ /// \~english @par
+ /// Close processing is also performed when an instance is destructed to prevent leakage.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Close();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function reads data from the ring buffer.
+ /// \~english @param [OUT] buffer
+ /// PSTR - pointer to the buffer in which the read data is stored
+ /// \~english @param [IN] f_uilength
+ /// UI_32 - length of the data buffer provided
+ /// \~english @retval SI_32 Returns The number of bytes actually read
+ /// \~english @retval -1 error occurred
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - not open [-1]
+ /// \~english @par Detail
+ /// - This function reads data from the ring buffer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Read(PSTR buffer, const UI_32 f_uilength);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function writes the data into the ring buffer.
+ /// \~english @param [OUT] buffer
+ /// PSTR - pointer to the buffer containing the data to be written
+ /// \~english @param [IN] f_uilength
+ /// UI_32 - length of the data buffer to be written
+ /// \~english @retval SI_32 Returns The number of bytes written
+ /// \~english @retval -1 error occurred
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - not open [-1]
+ /// \~english @par Detail
+ /// - This function writes the data into the ring buffer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Write(PCSTR buffer, const UI_32 f_uilength);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function writes all the data in the buffer into provided file f_pPath.
+ /// \~english @param[in] f_pPath
+ /// PCSTR - file path.
+ /// \~english @param[in] f_uiDumpSize
+ /// PUI_32 - Returns The number of bytes written into file
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusNullPointer
+ /// \~english @retval eFrameworkunifiedStatusInvldParam
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @retval eFrameworkunifiedStatusFileLoadError
+ /// \~english @retval eFrameworkunifiedStatusErrOther
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - f_uiDumpSize is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - dump file path is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - not open [eFrameworkunifiedStatusFail]
+ /// - dump file open fail [eFrameworkunifiedStatusFileLoadError]
+ /// - ring buffer access fail [eFrameworkunifiedStatusFail]
+ /// - dump file write fail [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Detail
+ /// This function does not changes the unread buffer.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Writing to a dump file is overwritten.
+ /// \~english @par
+ /// This function overwrites the file if it exists.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function returns the number of unread bytes which can be read by Read().
+ /// \~english @retval SI_32 Returns The number of bytes which can be read by Read()
+ /// \~english @retval -1 error occurred
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - not open [-1]
+ /// \~english @par Detail
+ /// - This function returns the number of unread bytes which can be read by Read().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetSize();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function clears the ring buffer.
+ /// \~english @param none
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - not open [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// This function clears the ring buffer.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Only read/write information cleared, and the size of the ring buffer itself is not changed.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearBuf();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function sets the position of read ptr to write ptr in buffer.
+ /// \~english @param none
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusFail ring buffer is not open
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - not open [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// This function sets the position of read ptr to write ptr in buffer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetReadPtrToWritePtr();
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSRingBuffer
+ /// Constructor of CNSRingBuffer class
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSRingBuffer();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateRBMutex
+ /// This function creates the ring buffer mutex object.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK ring buffer created successfully
+ /// eFrameworkunifiedStatusDuplicate ring buffer already exists
+ /// eFrameworkunifiedStatusInvldParam invalid ring buffer name
+ /// eFrameworkunifiedStatusFail on error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateRBMutex();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateRBHeader
+ /// This function creates the ring buffer object for header.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK ring buffer created successfully
+ /// eFrameworkunifiedStatusDuplicate ring buffer already exists
+ /// eFrameworkunifiedStatusInvldParam invalid ring buffer name
+ /// eFrameworkunifiedStatusFail on error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateRBHeader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateRBDataBuffer
+ /// This function creates the ring buffer object for data buffer.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK ring buffer created successfully
+ /// eFrameworkunifiedStatusDuplicate ring buffer already exists
+ /// eFrameworkunifiedStatusInvldParam invalid ring buffer name
+ /// eFrameworkunifiedStatusFail on error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateRBDataBuffer();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// MapRBHeader
+ /// This function open and maps the file in process space.
+ ///
+ /// \param [out] f_pRbuf
+ /// PVOID* - address of the mapped memory
+ /// \param [in] f_cMappedFile
+ /// std::string - Path of the ring buffer mapped file
+ /// \param [in] f_uiRbufSize
+ /// UI_32 - Size of the ring buffer
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK if ring buffer opened successfully
+ /// eFrameworkunifiedStatusFail unable to open ring buffer
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Map(PVOID *f_pRbuf, const std::string &f_cMappedFile, const UI_32 f_uiRbufSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// MapRBHeader
+ /// This function open and maps the shared memory in process space.
+ ///
+ /// \param [out] f_pShMem
+ /// PVOID* - address of the mapped memory
+ /// \param [in] f_cShmName
+ /// std::string - Name of the shared memory
+ /// \param [in] f_uiShmSize
+ /// UI_32 - Size of the shared memory
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK if shared memory opened successfully
+ /// eFrameworkunifiedStatusFail unable to open shared memory
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus MapSM(PVOID *f_pShMem, const std::string &f_cShmName, const UI_32 f_uiShmSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// UnMapRB
+ /// This function unmaps the object.
+ ///
+ /// \param [in] f_pRbuf
+ /// PCSTR - address of the memory to unmap
+ /// \param [in] f_uiRbufSize
+ /// UI_32 - Size of the memory to be unmapped
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK if ring buffer closed successfully
+ /// eFrameworkunifiedStatusFail if ring buffer is not open
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnMap(PVOID f_pRbuf, const UI_32 f_uiRbufSize);
+
+ EFrameworkunifiedStatus CheckSize(int fd, off_t size);
+
+
+// void LockMtx();
+ int LockMtx();
+
+ void UnlockMtx();
+
+ std::string m_cRbufMtxName; // name of the ring buffer mutex name
+
+ std::string m_cMappedFileHdrPath; // path of the ring buffer mapped file header
+
+ std::string m_cMappedFilePath; // path of the ring buffer mapped file
+
+ UI_32 m_uiRingBuffSize; // ring buffer size
+
+ NSRingBufferMtx *m_pRbufMtx; // The pointer to the ring buffer mutex
+
+ NSRingBufferHdr *m_pRbufHdr; // The pointer to the ring buffer header
+
+ PCHAR m_pRbuf; // The pointer to the ring buffer data buffer
+
+ pthread_mutex_t m_tOpenMutex; // for multithread process
+
+ int m_lid; // Lock ID
+ void *m_pLockAddr; // Lock Address
+
+ SI_32 m_siProcessLastWrtPage; // to hold page that each process wrote in last
+};
+
+#endif /* __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_RINGBUFFER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_shared_mem.h b/nsframework/framework_unified/client/include/native_service/ns_shared_mem.h
new file mode 100755
index 0000000..981c1ad
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_shared_mem.h
@@ -0,0 +1,100 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief Shared interface file for SharedMemory Service
+/// Detail description of interface and usage
+/// \ref http://ptcframeworkunifiedaccbuild2/TikiWiki/tiki-index.php?page=Shared+Memory
+/// http://ptcframeworkunifiedaspsql01/sites/ptcsweng/SW%20Engineering%20Document%20Library/
+/// Projects/Connected%20Color%20Radio%20(CCR)/Architecture/Framework/
+/// CCR%20Messaging.vsd
+///
+/// Declares the external APIs to Zone Player Service.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_shared_mem.h
+ * @brief \~english Shared interface file for SharedMemory Service
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+
+#ifndef __CCR_NATIVESERVICES_MESSAGECENTER_SHAREDMEMORY_H__ // NOLINT (build/header_guard)
+#define __CCR_NATIVESERVICES_MESSAGECENTER_SHAREDMEMORY_H__
+
+
+#include <native_service/frameworkunified_types.h> ///< Header file for Template
+#include <stdint.h>
+#ifdef AGL_STUB
+#else
+#include <devctl.h>
+#include <sys/neutrino.h>
+#endif
+
+typedef struct _pulse_t TPosixHdr; ///> Header for system-provided messages
+
+enum ESharedMemCommand {
+ eSharedMemCommandWrite = 1,
+ eSharedMemCommandRead = 2,
+ eSharedMemCommandSize = 3,
+ eSharedMemCommandDelete = 4,
+};
+
+#define NS_SHAREDMEM_NAME "NS_SharedMem"
+#define NS_SHAREDMEM_SOCK_QUEUE 10
+DEFINE_HANDLE_TYPE(SSHMemID, TShMemID);
+
+#ifdef AGL_STUB
+#else
+#include <_pack1.h>
+#endif
+struct SMsgHeader {
+ uint16_t cmd; // Command to the NS_SharedMem
+ uintptr_t id; // NS_SharedMem ID
+ UI_32 size; // The size of the data to write to NS_SharedMem
+};
+
+struct SReplyHeader {
+ EFrameworkunifiedStatus status; // write result
+ UI_32 size; // The size of the data to read from NS_SharedMem
+};
+#ifdef AGL_STUB
+#else
+#include <_packpop.h>
+#endif
+
+#endif // __CCR_NATIVESERVICES_MESSAGECENTER_SHAREDMEMORY_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_shared_mem_if.h b/nsframework/framework_unified/client/include/native_service/ns_shared_mem_if.h
new file mode 100755
index 0000000..25c5da1
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_shared_mem_if.h
@@ -0,0 +1,196 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_shared_mem_if.h
+ * @brief \~english API Header for Logger.
+ * Declares the external APIs to Logger.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __CCR_NATIVESERVICES_MESSAGECENTER_NSSHAREDMEMIF_H__ // NOLINT (build/header_guard)
+#define __CCR_NATIVESERVICES_MESSAGECENTER_NSSHAREDMEMIF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <native_service/frameworkunified_types.h> ///< Standard Types
+
+typedef unsigned int TMemID; ///< Type of memory buffer identifiers
+#define BAD_MEM_ID (0)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SetDataToShared
+/// \~english @par Summary
+/// - Store a large chunk of memory using SharedMem service
+/// \~english @param [in] data
+/// - const void* - data to be stored in shared memory
+/// \~english @param [in] dataBytes
+/// - UI_32 - length of the data (in bytes) that is stored in shared memory
+/// \~english @param [in] from
+/// - const char * - start address
+/// \~english @param [in] to
+/// - const char * - end address
+/// \~english @retval TMemID - unique MemID of the data stored in the shared memory, 0 if error occurs
+/// \~english @par Preconditions
+/// - None
+/// \~english @par Change of the internal state
+/// - shared memory changed
+/// \~english @par Causes of failures
+/// - param is Invalid.[BAD_MEM_ID]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - The function sets the data to the shared memory and associates it with a\n
+/// unique MemID that can be used to refer to data in subsequent calls \n
+/// (not necessarily from the same process).
+/// \~english @par
+/// - TMemID:Result
+/// - Except 0:Success
+/// - 0:Failure
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TMemID SetDataToShared(const void *data, UI_32 dataBytes, const char *from, const char *to);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetDataFromShared
+/// \~english @par Summary
+/// - Retrieve a large chunk of memory using SharedMem service
+/// \~english @param [in] id
+/// - TMemID - MemID of the shared data
+/// \~english @param [in] data
+/// - void* - Buffer to store data in, must be at least as large as buffer associated with id
+/// \~english @param [in] dataMaxBytes
+/// - UI_32 - Size of data - system will never copy more than dataMaxBytes bytes into data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldID Invalid id
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Preconditions
+/// -
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - param is Invalid. [eFrameworkunifiedStatusInvldParam]
+/// - id is Invalid. [eFrameworkunifiedStatusInvldID]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - Retrieve data, given a MemID. Each MemID is only safe to use until a call to \n
+/// DiscardDataFromShared If the call succeeds, the return value is eFrameworkunifiedStatusOK.\n
+/// Otherwise, the contents of data are undefined.
+/// \~english @par
+/// - eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Failure
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetDataFromShared(TMemID id, void *data, UI_32 dataMaxBytes);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetLengthOfDataFromShared
+/// \~english @par Summary
+/// - Query the minimum buffer size, in bytes, necessary to hold a chunk of memory in SharedMem
+/// \~english @param [in] id
+/// - TMemID - MemID of the shared data
+/// \~english @retval length - Minimum buffer size, in bytes, required to hold the data associated with id.
+/// \~english @par Preconditions
+/// -
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - param is Invalid.[BAD_MEM_ID]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - Returns the minimum buffer size, in bytes, required to hold the data associated with id.\n
+/// Return value of 0 indicates failure.For an id, may be called one or more times \n
+/// until a successful call to either GetDataFromShared or DiscardDataFromShared with that id.
+/// \~english @par
+/// - TMemID:Result
+/// - Except 0:Success
+/// - 0:Failure
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+UI_32 GetLengthOfDataFromShared(TMemID id);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DiscardDataFromShared
+/// \~english @par Summary
+/// - Discard a chunk of memory in SharedMem
+/// \~english @param [in] id
+/// - TMemID - MemID of the shared data
+/// \~english @retval eFrameworkunifiedStatusOK - Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam -Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldID -Invalid id
+/// \~english @retval eFrameworkunifiedStatusFail -Some sort of error occurred
+/// \~english @par Preconditions
+/// -
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - param is Invalid. [eFrameworkunifiedStatusInvldParam]
+/// - id is Invalid. [eFrameworkunifiedStatusInvldID]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - Invalidates the data stored with the MemID. Each id is only safe to use in a\n
+/// single successful call to GetDataFromShared or DiscardDataFromShared
+/// If the call succeeds, the return value is eImageStatusOK.
+/// On failure, the state of shared memory shall not be altered
+/// \~english @par
+/// - eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Failure
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DiscardDataFromShared(TMemID id);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // __CCR_NATIVESERVICES_MESSAGECENTER_NSSHAREDMEMIF_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_sharedmem.h b/nsframework/framework_unified/client/include/native_service/ns_sharedmem.h
new file mode 100755
index 0000000..d8ac8b9
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_sharedmem.h
@@ -0,0 +1,486 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMem.
+/// This class provides API to open, read, write and close shared memory
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_sharedmem.h
+ * @brief \~english This file contains implementation of class CNSSharedMem.
+ * This class provides API to open, read, write and close shared memory
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_H__
+
+// Used only in nstest_sharedmem.
+// set environment, CNSSharedMem::Open() always fail. ===> eFrameworkunifiedStatusErrOther
+#define NSTEST_FAIL_SHAREDMEM_OPEN "NSTEST_FAIL_SHAREDMEM_OPEN"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <pthread.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+// Structure of the header of the shared memory buffer
+typedef struct _NSSharedBuffer {
+ pthread_mutex_t m_tBufMutex; // Mutex object to mutual exclusion
+ pthread_cond_t m_tCondVar; // Condition Variable
+ UI_32 m_uiReadPtr; // Read pointer
+ UI_32 m_uiWritePtr; // Write pointer
+ UI_32 m_uiUnReadSize; // Data size not read yet
+ BOOL m_bIsFull; // Flag indicating if the buffer has full of data
+ UI_32 m_uiShMemSize; // Size of the shared memory buffer
+} NSSharedBufferHdr;
+
+/**
+ * @class CNSSharedMem
+ * \~english @brief shared memory
+ * \~english @par Brief Introduction
+ * This class is used for handle shared memory.
+ *
+ */
+class CNSSharedMem {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// Constructor for CNSSharedMem
+ /// \~english @param[in] f_cSharedMemName
+ /// const std::string& - name of the shared memory
+ /// \~english @param[in] f_uiSize
+ /// const UI_32 - size of shared memory
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// Create object of CNSSharedMem class.
+ /// This class don't used to open shared memory object or allocate memory.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// \~english @see ~CNSSharedMem
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMem(const std::string &f_cSharedMemName, const UI_32 f_uiSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// Destructor for CNSSharedMem.
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// None
+ /// \~english @par Change of internal status
+ /// - Change the state of shared memory to closed state
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// Closes the shared memory, if it is open.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Since the destructor does not delete the shared memory area, \n
+ /// the application must execute shm_unlink to delete the shared memory area.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// \~english @see CNSSharedMem(const std::string&, const UI_32), CNSSharedMem(), Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSSharedMem();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function opens and maps the shared memory object.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory opened successfully
+ /// \~english @retval eFrameworkunifiedStatusFail unable to open shared memory
+ /// \~english @retval eFrameworkunifiedStatusErrOther if shared memory already opened
+ /// \~english @par Preconditons
+ /// None
+ /// \~english @par Change of internal status
+ /// - Open shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - if shared memory already opened [eFrameworkunifiedStatusErrOther]
+ /// - Unable to open shared memory(shm_open) [eFrameworkunifiedStatusFail]
+ /// - Unable to create shared memory(mmap) [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// It creates the shared memory if it does not exists.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Open();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function is used to check whether the shared memory buffer is opened or not.
+ /// \~english @retval TRUE - Open
+ /// \~english @retval FALSE - Not open
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Check whether the shared memory buffer is opened or not, and return the result.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsOpen();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function unmaps the shared memory object.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory closed successfully
+ /// \~english @retval eFrameworkunifiedStatusFail if shared memory is not opened
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - Close the shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - The shared memory object is not opened. [eFrameworkunifiedStatusFail]
+ /// - Unable to unmap(munmap) the shared memory object [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function unmaps the shared memory object from memory space.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Since the destructor does not delete the shared memory area, \n
+ /// the application must execute shm_unlink to delete the shared memory area.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Close();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ // Read data from shared memory.
+ /// \~english @param [out] buffer
+ /// PSTR - pointer to the buffer in which the read data is stored
+ /// \~english @param [in] f_uilength
+ /// UI_32 - length of the data buffer provided
+ /// \~english @param [in] f_bBlock
+ /// BOOL - TRUE - blocking call
+ /// FALSE - non blocking call
+ /// \~english @retval SI_32 Returns The number of bytes actually read, or NS_SHM_ERROR if an error occurred
+ /// \~english @retval NS_SHM_ERROR
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - The shared memory object is not opened. [NS_SHM_ERROR]
+ /// - Pointor to buffer(buffer) is NULL. [NS_SHM_ERROR]
+ /// - Byte of data(f_uilength)is 0. [NS_SHM_ERROR]
+ /// \~english @par Detail
+ /// This function reads data from the shared memory.
+ /// If this function is used as blocking call, then the calling thread will get blocked
+ /// until data is available for read. By default it is a blocking call.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Write
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Read(PSTR buffer, const UI_32 f_uilength, const BOOL f_bBlock = TRUE);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function writes the data into the shared memory.
+ /// \~english @param[in] buffer
+ /// PCSTR - pointer to the buffer containing the data to be written
+ /// \~english @param[in] f_uilength
+ /// const UI_32 - length of the data buffer to be written
+ /// \~english @retval SI_32 Returns The number of bytes written, or NS_SHM_ERROR if an error occurred
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - The shared memory object is not opened. [NS_SHM_ERROR]
+ /// - Pointor to buffer(buffer) is NULL. [NS_SHM_ERROR]
+ /// - Size of buffer(f_uilength) is larger than the size designated by constructor. [NS_SHM_ERROR]
+ /// \~english @par Detail
+ /// - This function writes the data into the shared memory.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Read
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Write(PCSTR buffer, const UI_32 f_uilength);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// Dump data to file.
+ /// \~english @param [in] f_pPath
+ /// PCSTR - file path.
+ /// \~english @param[in] [in] f_uiDumpSize
+ /// PUI_32 - Returns The number of bytes written into file
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK on success,
+ /// eFrameworkunifiedStatusFileLoadError - file path is incorrect
+ /// eFrameworkunifiedStatusSemLockFail/
+ /// eFrameworkunifiedStatusSemLockFail - mutex locking/unlocking error
+ /// eFrameworkunifiedStatusFail - shared memory is not opened
+ /// eFrameworkunifiedStatusInvldParam - invalid param
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// -None
+ /// \~english @par Conditions of processing failure
+ /// - file path is incorrect.[eFrameworkunifiedStatusFileLoadError]
+ /// - mutex locking/unlocking error.[eFrameworkunifiedStatusSemLockFail/eFrameworkunifiedStatusSemLockFail]
+ /// - shared memory is not opened.[eFrameworkunifiedStatusFail]
+ /// - invalid param.[eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Detail
+ /// - This function writes all the data in the buffer into provided file f_pPath.
+ /// - This function does not changes the unread buffer.
+ /// - This function overwrites the file if it exists.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function gets size of unread bytes.
+ /// \~english @param None
+ /// \~english @retval Except NS_SHM_ERROR - Returns The number of unread bytes
+ /// \~english @retval NS_SHM_ERROR -if an error occurred
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// if m_pShmHdr is null.[NS_SHM_ERROR]
+ /// \~english @par Detail
+ /// This function returns the number of unread bytes which can be read by Read().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par
+ /// - l_uiReadSize:Result
+ /// - NS_SHM_ERROR:Failure
+ /// - Except NS_SHM_ERROR:Success
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetSize();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// Clear buffer.
+ /// \~english @param None
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK on success,
+ /// eFrameworkunifiedStatusSemLockFail/
+ /// eFrameworkunifiedStatusSemLockFail - mutex locking/unlocking error
+ /// eFrameworkunifiedStatusFail - shared memory is not opened
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// - set m_pShmHdr->m_uiReadPtr with 0;
+ /// - set m_pShmHdr->m_uiWritePtr with 0;
+ /// - set m_pShmHdr->m_uiUnReadSize with 0;
+ /// - set m_pShmHdr->m_bIsFull with FALSE;
+ /// \~english @par Conditions of processing failure
+ /// - mutex locking/unlocking error.[eFrameworkunifiedStatusSemLockFail/eFrameworkunifiedStatusSemLockFail]
+ /// - shared memory is not opened.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function clears the shared memory buffer.if m_pShmHdr is null,return failure.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearBuf();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function sets the position of read ptr to write ptr in buffer.
+ /// \~english @param None
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK on success,
+ /// eFrameworkunifiedStatusSemLockFail/
+ /// eFrameworkunifiedStatusSemLockFail - mutex locking/unlocking error
+ /// eFrameworkunifiedStatusFail - shared memory is not opened
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// - set m_pShmHdr->m_uiReadPtr with m_pShmHdr->m_uiWritePtr;
+ /// - set m_pShmHdr->m_uiUnReadSize with 0;
+ /// \~english @par Conditions of processing failure
+ /// - mutex locking/unlocking error.[eFrameworkunifiedStatusSemLockFail/eFrameworkunifiedStatusSemLockFail]
+ /// - shared memory is not opened.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function sets the position of read ptr to write ptr in buffer.\n
+ /// If m_pShmHdr of lock failure or unlock failure,result is error.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetReadPtrToWritePtr();
+
+ protected:
+ // no members in protected
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSSharedMem
+ /// Constructor of CNSSharedMem class
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMem();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateSMHeader
+ /// This function creates the shared memory object for header.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK shared memory created successfully
+ /// eFrameworkunifiedStatusDuplicate shared memory already exists
+ /// eFrameworkunifiedStatusInvldParam invalid shared memory name
+ /// eFrameworkunifiedStatusFail on error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateSMHeader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateSMDataBuffer
+ /// This function creates the shared memory object for data buffer.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK shared memory created successfully
+ /// eFrameworkunifiedStatusDuplicate shared memory already exists
+ /// eFrameworkunifiedStatusInvldParam invalid shared memory name
+ /// eFrameworkunifiedStatusFail on error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateSMDataBuffer();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// MapSMHeader
+ /// This function open and maps the shared memory in process space.
+ ///
+ /// \param [out] f_pShMem
+ /// PVOID* - address of the mapped memory
+ /// \param [in] f_cShmName
+ /// std::string - Name of the shared memory
+ /// \param [in] f_uiShmSize
+ /// UI_32 - Size of the shared memory
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK if shared memory opened successfully
+ /// eFrameworkunifiedStatusFail unable to open shared memory
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus MapSM(PVOID *f_pShMem, const std::string &f_cShmName, const UI_32 f_uiShmSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// UnMapSM
+ /// This function unmaps the shared memory object.
+ ///
+ /// \param [in] f_pShMem
+ /// PCSTR - address of the memory to unmap
+ /// \param [in] f_uiShmSize
+ /// UI_32 - Size of the memory to be unmapped
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK if shared memory closed successfully
+ /// eFrameworkunifiedStatusFail if shared memory is not opened
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnMapSM(PVOID f_pShMem, const UI_32 f_uiShmSize);
+
+ std::string m_cShmHdrName; // name of the shared memory header
+
+ std::string m_cShmName; // name of the shared memory data
+
+ UI_32 m_uiShmBuffSize; // shared memory size
+
+ NSSharedBufferHdr *m_pShmHdr; // The pointer to the shared memory header
+
+ PCHAR m_pShmBuff; // The pointer to the shared memory data buffer
+};
+
+#endif /* __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_sharedmem_reader.h b/nsframework/framework_unified/client/include/native_service/ns_sharedmem_reader.h
new file mode 100755
index 0000000..9a34909
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_sharedmem_reader.h
@@ -0,0 +1,340 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMemReader.
+/// This class provides API to open, close and perform read operation on shared memory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_sharedmem_reader.h
+ * @brief \~english This file contains implementation of class CNSSharedMemReader.
+ * This class provides API to open, close and perform read operation on shared memory.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_READER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_READER_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+class CNSSharedMem;
+
+/**
+ * @class CNSSharedMemReader
+ * \~english @brief read shared memory
+ * \~english @par Brief Introduction
+ * This class is used for read shared memory.
+ *
+ */
+class CNSSharedMemReader {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// Constructor for CNSSharedMemReader
+ /// \~english @param[in] f_cSharedMemName
+ /// const std::string& - name of the shared memory
+ /// \~english @param[in] f_bBlock
+ /// BOOL - TRUE - blocking call for Read() API,Thread will get blocked \n
+ /// the thread until data is available for read.
+ /// FALSE - non blocking call for Read() API
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Create object of CNSSharedMemReader class.
+ /// This class don't used to open shared memory object or allocate memory.
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - None
+ /// \~english @see ~CNSSharedMemReader
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMemReader(const std::string &f_cSharedMemName, const BOOL f_bBlock = TRUE); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// Destructor for CNSSharedMemReader.
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - Change the state of shared memory to closed state
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Closes the shared memory, if it is open.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Since the destructor does not delete the shared memory area, \n
+ /// the application must execute shm_unlink to delete the shared memory area.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see CNSSharedMemReader(const std::string&, const BOOL), CNSSharedMemReader(), Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSSharedMemReader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function opens and maps the shared memory object.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory opened successfully
+ /// \~english @retval eFrameworkunifiedStatusFail unable to open shared memory
+ /// \~english @retval eFrameworkunifiedStatusErrOther if shared memory already opened
+ /// \~english @par Preconditons
+ /// None
+ /// \~english @par Change of internal status
+ /// - Open shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - if shared memory already opened [eFrameworkunifiedStatusErrOther]
+ /// - Unable to open shared memory(shm_open) [eFrameworkunifiedStatusFail]
+ /// - Unable to create shared memory(mmap) [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// Opens a shared memory object and allocates it to a memory space.\n
+ /// It creates the shared memory if it does not exists.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Open();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function is used to check whether the shared memory buffer is opened or not.
+ /// \~english @retval TRUE - Open
+ /// \~english @retval FALSE - Not open
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Check whether the shared memory buffer is opened or not, and return the result.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsOpen();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function unmaps the shared memory object.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory closed successfully
+ /// \~english @retval eFrameworkunifiedStatusFail if shared memory is not opened
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - Close the shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - The shared memory object is not opened. [eFrameworkunifiedStatusFail]
+ /// - Unable to unmap(munmap) the shared memory object [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function unmaps the shared memory object from memory space.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Since the closing does not delete the shared memory area, \n
+ /// the application must execute shm_unlink to delete the shared memory area.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Open
+ ////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Close();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function reads data from the shared memory.
+ /// \~english @param[in] buffer
+ /// PSTR - pointer to the buffer in which the read data is stored
+ /// \~english @param[in] f_uilength
+ /// const UI_32 - length of the data buffer provided
+ /// \~english @retval The number of bytes actually read, or NS_SHM_ERROR if an error occurred
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - The shared memory object is not opened. [NS_SHM_ERROR]
+ /// - Pointor to buffer(buffer) is NULL. [NS_SHM_ERROR]
+ /// - Byte of data(f_uilength)is 0. [NS_SHM_ERROR]
+ /// \~english @par Detail
+ /// If this constructor is used as blocking call, then the calling thread will get blocked\n
+ /// until data is available for read.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Write
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Read(PSTR buffer, const UI_32 f_uilength);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function writes all the data in the buffer into provided file f_pPath.
+ /// \~english @param[in] f_pPath
+ /// PCSTR - file path.
+ /// \~english @param[in] f_uiDumpSize
+ /// PUI_32 - Returns The number of bytes written into file
+ /// \~english @retval eFrameworkunifiedStatusOK - on success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid param
+ /// \~english @retval eFrameworkunifiedStatusFail - shared memory is not open
+ /// \~english @retval eFrameworkunifiedStatusFileLoadError - file path is incorrect
+ /// \~english @retval eFrameworkunifiedStatusErrOther
+ /// \~english @retval eFrameworkunifiedStatusSemUnlockFail
+ /// \~english @par Preconditons
+ /// - File is opened.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Pointor to dump size(f_uiDumpSize)is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Dump file path is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - File is not opened [eFrameworkunifiedStatusFail]
+ /// - Failed to open dump file [eFrameworkunifiedStatusFileLoadError]
+ /// - Failed to access shared memory [eFrameworkunifiedStatusFail]
+ /// - Failed to write data into dump file [eFrameworkunifiedStatusErrOther]
+ /// - Failed to lock mutex [eFrameworkunifiedStatusSemLockFail]
+ /// - Failed to unlock mutex [eFrameworkunifiedStatusSemUnlockFail]
+ /// \~english @par Detail
+ /// This function does not changes the unread buffer.
+ /// \~english @par
+ /// This function overwrites the file if it exists.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function gets size of unread .bytes.
+ /// \~english @param None
+ /// \~english @retval Except NS_SHM_ERROR - Returns The number of bytes written,
+ /// \~english @retval NS_SHM_ERROR -if an error occurred
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// if m_pShmHdr is null.[NS_SHM_ERROR]
+ /// \~english @par Detail
+ /// This function returns the number of unread bytes which can be read by Read().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par
+ /// - l_uiReadSize:Result
+ /// - NS_SHM_ERROR:Failure
+ /// - Except NS_SHM_ERROR:Success
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetSize();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function sets the position of read ptr to write ptr in buffer.
+ /// \~english @retval eFrameworkunifiedStatusOK - on success
+ /// \~english @retval eFrameworkunifiedStatusFail - shared memory is not open
+ /// \~english @retval eFrameworkunifiedStatusSemLockFail - mutex locking error
+ /// \~english @retval eFrameworkunifiedStatusSemUnlockFail - mutex unlocking error
+ /// \~english @par Preconditons
+ /// - File is opened.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - File is not opened [eFrameworkunifiedStatusFail]
+ /// - Failed to lock mutex [eFrameworkunifiedStatusSemLockFail]
+ /// - Failed to unlock mutex [eFrameworkunifiedStatusSemUnlockFail]
+ /// \~english @par Detail
+ /// - Set the position of read ptr to write ptr in buffer.\n
+ /// - Initialize state of unreading bytes to 0.
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetReadPtrToWritePtr();
+
+ protected:
+ // no members in protected
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSSharedMemReader
+ /// Constructor of CNSSharedMemReader class
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMemReader();
+
+ CNSSharedMem *m_pShmReader; // pointer to the CNSSharedMem object
+
+ BOOL m_bBlock; // blocking or non blocking read
+};
+
+#endif /*__NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_READER_H__*/ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_sharedmem_writer.h b/nsframework/framework_unified/client/include/native_service/ns_sharedmem_writer.h
new file mode 100755
index 0000000..de6e9f9
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_sharedmem_writer.h
@@ -0,0 +1,283 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMemWriter.
+/// This class provides API to open, close and perform write operation on shared memory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_sharedmem_writer.h
+ * @brief \~english This file contains implementation of class CNSSharedMemWriter.
+ * This class provides API to open, close and perform write operation on shared memory.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_WRITER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_WRITER_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+class CNSSharedMem;
+
+/**
+ * @class CNSSharedMemWriter
+ * \~english @brief write shared memory
+ * \~english @par Brief Introduction
+ * This class is used for write shared memory.
+ *
+ */
+class CNSSharedMemWriter {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// Constructor for CNSSharedMemWriter
+ /// \~english @param[in] f_cSharedMemName
+ /// const std::string& - name of the shared memory
+ /// \~english @param[in] f_uiSize
+ /// UI_32 - size of shared memory
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Create object of CNSSharedMemWriter class.
+ /// This class don't used to open shared memory object or allocate memory.
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @see ~CNSSharedMemWriter
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMemWriter(const std::string &f_cSharedMemName, const UI_32 f_uiSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// Destructor of CNSSharedMemWriter class.
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - Change the state of shared memory to closed state
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Closes the shared memory, if it is open.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Since the destructor does not delete the shared memory area, \n
+ /// the application must execute shm_unlink to delete the shared memory area.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @see CNSSharedMemWriter(const std::string&, const BOOL), CNSSharedMemWriter(), Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSSharedMemWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// This function opens and maps the shared memory object.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory opened successfully
+ /// \~english @retval eFrameworkunifiedStatusNullPointer pointer of the CNSSharedMem object is NULL
+ /// \~english @retval eFrameworkunifiedStatusFail unable to open shared memory
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - Open shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - pointer of the CNSSharedMem object is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - unable to open shared memory.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// This function opens and maps the shared memory object.\n
+ /// It creates the shared memory if it does not exists.
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Open();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// This function is used to check whether the shared memory buffer is opened or not.
+ /// \~english @retval TRUE - Open
+ /// \~english @retval FALSE - Not open
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Check whether the shared memory buffer is opened or not, and return the result.
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsOpen();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// This function unmaps the shared memory object.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory closed successfully
+ /// \~english @retval eFrameworkunifiedStatusNullPointer pointer of the CNSSharedMem object is NULL
+ /// \~english @retval eFrameworkunifiedStatusFail if shared memory is not open
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - Close the shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - Pointer of the CNSSharedMem object is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - If shared memory is not open.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function unmaps the shared memory object.\n
+ /// If pointer of the CNSSharedMem object is NULL, will return eFrameworkunifiedStatusNullPointer.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Close();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// This function writes the data into the shared memory.
+ /// \~english @param[in] buffer
+ /// PSTR - pointer to the buffer containing the data to be written
+ /// \~english @param[in] f_uilength
+ /// const UI_32 - length of the data buffer to be written
+ /// \~english @retval The number of bytes written
+ /// \~english @retval NS_SHM_ERROR if an error occurred
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - shared memory is changed.
+ /// \~english @par Conditions of processing failure
+ /// - m_pShmWriter is NULL.
+ /// - buffer is NULL.
+ /// - f_uilength is 0.
+ /// \~english @par Detail
+ /// - This function writes the buffer's data whose length is f_uilength to shared memory.\n
+ /// If successed,return write size,else return NS_SHM_ERROR.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// Sync only
+ /// \~english @par
+ /// - l_iWriteSize:Result
+ /// - NS_SHM_ERROR:Failure
+ /// - Except NS_SHM_ERROR:Success
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Write(PCSTR buffer, const UI_32 f_uilength);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// This function clears the shared memory buffer.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory cleared successfully
+ /// \~english @retval eFrameworkunifiedStatusNullPointer pointer of the CNSSharedMem object is NULL
+ /// \~english @retval eFrameworkunifiedStatusFail if shared memory is not open
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - shared memory is changed.
+ /// \~english @par Conditions of processing failure
+ /// - Pointer of the CNSSharedMem object is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - If shared memory is not open.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function clears the shared memory buffer.\n
+ /// If pointer of the CNSSharedMem object is NULL, will return eFrameworkunifiedStatusNullPointer.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearBuf();
+
+ protected:
+ // no members in protected
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSSharedMemWriter
+ /// Constructor of CNSSharedMemWriter class
+ ///
+ /// \param
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMemWriter();
+
+ CNSSharedMem *m_pShmWriter; // pointer to the CNSSharedMem object
+};
+
+#endif /*__NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_WRITER_H__*/ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_system_mode.h b/nsframework/framework_unified/client/include/native_service/ns_system_mode.h
new file mode 100755
index 0000000..9815904
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_system_mode.h
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * NS_SYSTEM_MODE.h
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_system_mode.h
+ * @brief \~english The file defines enum SystemModeProtocol
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_SYSTEM_MODE_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_SYSTEM_MODE_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_System
+/// \brief System Mode Protocol
+////////////////////////////////////////////////////////////////////////////////////////////////
+typedef enum _SystemModeProtocol {
+ SYSTEM_ON_INITIALIZATION = PROTOCOL_THREAD_INITIALIZATION, ///< Initialize thread after creation
+ SYSTEM_ON_WAKEUP = PROTOCOL_THREAD_WAKEUP, ///< Wakeup Thread after sleep
+ SYSTEM_ON_SHUTDOWN = PROTOCOL_THREAD_SHUTDOWN, ///< Stop the thread
+ SYSTEM_ON_DESTROY = PROTOCOL_THREAD_DESTROY ///< Destroy the thread
+} SystemModeProtocol;
+
+#endif /* __NATIVESERVICES_SYSTEM_MODE_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_timer_if.h b/nsframework/framework_unified/client/include/native_service/ns_timer_if.h
new file mode 100755
index 0000000..549fc4c
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_timer_if.h
@@ -0,0 +1,317 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_timer_if.h
+ * @brief \~english APIs to create, delete and use Native Service timers .
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_TIMER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_TIMER_H__
+
+#include <native_service/frameworkunified_types.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TIMER_QUE "TIMER"
+
+#define MAX_SERVICE_NAME 15
+
+/// \brief Timer Function Pointer definition
+/// Detailed description of the class
+typedef void (*TimerCb)(UI_16 cmd);
+
+/// \brief Timer info, defines the initial
+/// start of a timer, the repeat timer
+/// values and the cmd id for a timer
+typedef struct _NSTimerInfo {
+
+// UI_32 t_sec;
+ time_t t_sec;
+ UI_64 t_nsec;
+ UI_16 iCmd;
+
+// UI_32 rpt_sec;
+ time_t rpt_sec;
+ UI_64 rpt_nsec;
+} NSTimerInfo;
+
+/// \brief Enum Types for valid Callback Mechanisms for
+/// a NS_Timer
+typedef enum _NSTimerCallbackMechanism {
+ CALLBACK_MESSAGE
+} eNSTimerCallbackMechanism;
+
+/// \brief Helper methods that convert time provided in MS.
+/// mseconds
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup WholeSeconds
+/// \~english @par Brief
+/// Converts a time value in milliseconds (ms) to a time value in secods (s).
+/// \~english @param [in] ms
+/// UI_32 - Time value in milliseconds(0 to ULONG_MAX)
+/// \~english @retval Time value in seconds
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// This function converts a time value in ms to a time value in s and returns it.\n
+/// For example, 12345ms obtains 12s as the conversion result.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see
+/// none
+///
+/// \~english @par Brief
+/// Get the number of whole seconds in the milsecond number that was passed.
+/// \~english @param[in] ms
+/// UI_32 - time value in mil seconds
+/// \~english @retval Number of whole seconds in the number passed.
+/// \~english @par Preconditons
+/// \~english @par Change of internal status
+/// \~english @par Conditions of processing failure
+/// \~english @par Detail
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see
+/// none
+/////////////////////////////////////////////////////////////////////////////////////
+
+//UI_32 WholeSeconds(UI_32 ms);
+time_t WholeSeconds(UI_32 ms);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RemainderMs
+/// \~english @par Brief
+/// Get the number of remaining milseconds out of whole second for the number passed.
+/// \~english @param[in] ms
+/// UI_32 - time value in mil seconds
+/// \~english @retval Number of remaining mil seconds in the number passed.
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// none
+/// \~english @par Detail
+/// This function returns the time value in ms of the remainder from converting the time value in ms to the time value in s.\n
+/// For example, 12345ms obtains 345ms as the conversion result.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see
+/// none
+/////////////////////////////////////////////////////////////////////////////////////
+UI_32 RemainderMs(UI_32 ms);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup MSToNS
+/// \~english @par Brief
+/// Converts mil seconds to nano seconds.
+/// \~english @param[in] ms
+/// UI_32 - time value in mil seconds
+/// \~english @retval Number of nano seconds there are in mil seconds in the number passed.
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// none
+/// \~english @par Detail
+/// This function converts a time value in ms to a time value in ns and returns it.\n
+/// For example, 1234ms obtains 1234000000ns as the conversion result.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see
+/// none
+/////////////////////////////////////////////////////////////////////////////////////
+UI_64 MSToNS(UI_32 ms);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_TimerCreate
+/// \~english @par Brief
+/// to create an instance of a timer object, and start it
+/// \~english @param[in] timer_info
+/// NSTimerInfo - timer value represents an absolute expiration timeout
+/// \~english @param[in] cbMech
+/// eNSTimerCallbackMechanism - CALLBACKMECHANISM_ENUM - specifies the callback mechanism associated with the
+/// timer\n
+/// CALLBACK_MESSAGE will send a message to a message queue
+/// \~english @param[in] sndMqHndl
+/// HANDLE - implies a MESSAGE QUE HANDLE generated by McOpenSender() is specified
+/// \~english @retval Handle to the timer object or NULL on failure
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If HANDLE(sndMqHndl) is NULL, [NULL]
+/// - If the Callback mechanism (cbMech) specified in the arguments is not CALLBACK_MESSAGE [NULL]
+/// - If thread creation fails (reateTimerMonitoringThread(); returns eFrameworkunifiedStatusFail) [NULL]
+/// - Unable to allocate memory for timer handle structures [NULL]
+/// - Memory cannot be allocated for the timer-information struct. [NULL]
+/// - When the message queue name of the handle (sndMqHndl) specified in the arguments is NULL,[NULL]
+/// - If a system call (such as epoll_ctl()) is in error,[NULL]
+/// \~english @par Detail
+/// Creates an instance of a timer object, sends a CALLBACK_MESSAGE message to the message queue, and starts the timer.\n
+/// When McOpenSender() is executed to execute NS_TimerCreate, the handles should be closed if not needed.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see NS_TimerDelete,NS_TimerSetTime
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE NS_TimerCreate(NSTimerInfo timer_info, eNSTimerCallbackMechanism cbMech, HANDLE sndMqHndl);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_TimerDelete
+/// \~english @par Brief
+/// to delete an instance of a timer object
+/// \~english @param[in] hTimer
+/// HANDLE - a timer handle that was created via NS_TimerCreate
+/// \~english @retval EFrameworkunifiedStatus indicates if the timer handle was delete successfully
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusFail
+/// \~english @retval eFrameworkunifiedStatusInvldParam
+/// \~english @par Preconditons
+/// - NS_TimerCreate has generated a HANDLE of timers
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If HANDLE(hTimer) is NULL,[eFrameworkunifiedStatusInvldParam]
+/// - Initializes the state. [eFrameworkunifiedStatusFail]
+/// - Invalid timed objects for HANDLE(hTimer specified by arguments:[eFrameworkunifiedStatusInvldParam]
+/// - If semaphoring fails, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// If the timer is set, the timer is stopped.\n
+/// Delete an instance of a timer object.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see NS_TimerCreate, NS_TimerSetTime
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NS_TimerDelete(HANDLE hTimer);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_TimerSetTime
+/// \~english @par Brief
+/// to start or stop a timer by setting the time interval associated
+/// with a timer, value of 0 in t_sec & t_nsec, will stop the timer.
+/// \~english @param[in] hTimer
+/// HANDLE - handle to timer that your specifying the timer to be set
+/// \~english @param[in] timer_info
+/// NSTimerInfo - timer value represents an absolute expiration timeout
+/// \~english @retval EFrameworkunifiedStatus indicates if the timer info was set successfully
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusInvldHandle
+/// \~english @retval eFrameworkunifiedStatusFail
+/// \~english @par Preconditons
+/// the timer must have already been created with NS_TimerCreate
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If HANDLE(hTimer) is NULL,[eFrameworkunifiedStatusInvldHandle]
+/// - Initializes the state. [eFrameworkunifiedStatusFail]
+/// - Retrieving timers fails [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// When the timer information (t_sec and t_nsec) is 0, the timer is stopped.\n
+/// If it is not 0, the timer is started based on the timer information.\n
+/// The hTimer must have been created with NS_TimerCreate.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see NS_TimerCreate, NS_TimerGetTime
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NS_TimerSetTime(HANDLE hTimer, NSTimerInfo timer_info);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_TimerGetTime
+/// \~english @par Brief
+/// to retrieve the time until a timer expires
+/// \~english @param[in] hTimer
+/// HANDLE - handle to timer that your trying to get information about
+/// \~english @param[out] timer_info
+/// NSTimerInfo* - a structure to store the delay time until the timer expires
+/// \~english @retval EFrameworkunifiedStatus indicates if the timer info was get successfully
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusInvldHandle
+/// \~english @retval eFrameworkunifiedStatusFail
+/// \~english @par Preconditons
+/// - NS_TimerCreate has generated a HANDLE of timers
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If HANDLE(hTimer) is NULL,[eFrameworkunifiedStatusInvldHandle]
+/// - If the timer_info specified in the arguments is NULL,... [eFrameworkunifiedStatusInvldHandle]
+/// - Initializes the state. [eFrameworkunifiedStatusFail]
+/// - If the timerdelete fails.... [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Gets the time until the timer expires.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see NS_TimerCreate, NS_TimerSetTime
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NS_TimerGetTime(HANDLE hTimer, NSTimerInfo *timer_info);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_TimerDebugOn
+/// \~english @par Brief
+/// to make a flag for the debugging process. for debug.
+/// \~english @param[in] FlagState
+/// BOOL - DebugFlag state
+/// \~english @retval none
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// none
+/// \~english @par Detail
+/// Sets the debug flag specified by the argument.\n
+/// However, if the set flag is the same as the flag specified in the argument, no operation is performed.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NS_TimerDebugOn(BOOL FlagState);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NATIVESERVICES_TIMER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_timer_if.hpp b/nsframework/framework_unified/client/include/native_service/ns_timer_if.hpp
new file mode 100755
index 0000000..ffcd8c8
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_timer_if.hpp
@@ -0,0 +1,393 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSTimer
+/// \brief Header file for Timer class.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_timer_if.hpp
+ * @brief \~english Header file for Timer class.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef NS_TIMER_IF_HPP_ // NOLINT (build/header_guard)
+#define NS_TIMER_IF_HPP_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_timer_if.h>
+
+/**
+ * @class NSTimer
+ * \~english @brief Handle Timer
+ * \~english @par Brief Introduction
+ * Timer class is using to handle the timer.creating, starting, stopping,and so on.
+ *
+ */
+class NSTimer {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Creates a timer object with default behavior as single timeout timer.
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// -To create the instance of this class.init the member var using m_hTimer, m_u64TimeInterval,
+ /// m_bRepeatTimer.\n
+ /// Default status,all time will be set 0.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -
+ /// \~english @see ~NSTimer
+ ////////////////////////////////////////////////////////////////////////////////////
+ NSTimer();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Deletes a timer object.
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -Instance of this class is created successfully.
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// -Destruct the instance of this class.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see NSTimer
+ ////////////////////////////////////////////////////////////////////////////////////
+ ~NSTimer();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// This function overloads \ref SetNotifyMethod().
+ /// On timeout, sends the command id to the message queue of specified application.
+ /// Resets previous notify method if any.
+ /// \~english @param[in] notifyCmdId
+ /// UI_16 - command id.
+ /// \~english @param[in] notifyToAppName
+ /// PCSTR - Send command id to the message queue of this application
+ /// \~english @retval EFrameworkunifiedStatus - Returns eFrameworkunifiedStatusOK if the action is set otherwise eFrameworkunifiedStatusFail
+ /// \~english @retval eFrameworkunifiedStatusOK - Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - process error
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// - Pointer of AppName specified by argument(notifyToAppName) is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Bytes of AppName specified by argument(notifyToAppName) are larger then MAX_SERVICE_NAME(15byte)
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - There isn't enough buffer(malloc) to storage message queue name, when getting(McOpenSender) message queue
+ /// handle [eFrameworkunifiedStatusFail]
+ /// - Bytes of message queue name are larger then LIMIT_QUEUE_NAME_SIZE(16byte), when getting(McOpenSender)
+ /// message queue handle [eFrameworkunifiedStatusFail]
+ /// - Failed to get message queue(mq_open), when getting(McOpenSender) message queue handle [eFrameworkunifiedStatusFail]
+ /// - There isn't enough buffer(malloc) to storage message queue information, when getting(McOpenSender) message
+ /// queue handle [eFrameworkunifiedStatusFail]
+ /// - Failed to create(epoll_create1) file descriptor for epoll, when creating timer handle(NS_TimerCreate)
+ /// [eFrameworkunifiedStatusFail]
+ /// - Failed to create(eventfd) file descriptor for event notification, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - Failed to connect(epoll_ctl) file descriptors for epoll and event notification, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - Failed to create(pthread_create) timer thread for event notification, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - There isn't enough buffer(malloc) to storage timer handle structure, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - There isn't enough buffer(malloc) to storage timer information structure,, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - Message queue handle is INVALID_HANDLE(-1), when creating timer handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - Checking code of message queue handle is not MQ_CHECK_CODE, when creating timer handle(NS_TimerCreate)
+ /// [eFrameworkunifiedStatusFail]
+ /// - Type of message queue handle is not send/receive, when creating timer handle(NS_TimerCreate)
+ /// [eFrameworkunifiedStatusFail]
+ /// - Failed to create(timerfd_create) file descriptor for timer, when creating timer handle(NS_TimerCreate)
+ /// [eFrameworkunifiedStatusFail]
+ /// - Failed to connect(epoll_ctl) file descriptors for epoll and timer, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - Timer handle state of instance has been deleted(DELETED_STATE), when creating timer handle(NS_TimerCreate)
+ /// [eFrameworkunifiedStatusFail]
+ /// - Failed to start/stop(timerfd_settime) timer, when creating timer handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// This function overloads \ref SetNotifyMethod().
+ /// On timeout, sends the command id to the message queue of specified application.
+ /// Create a timer handle(m_hTimer) of instance, if the time handle already exits, delete it then create a new
+ /// one.
+ /// If there is resource for timer notification before, reset it.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see McOpenSender, McClose, NS_TimerCreate
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetNotifyMethod(UI_16 notifyCmdId, PCSTR notifyToAppName);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Sets the timer as a repeat timer. Timer timeouts repeatedly as per the interval set.
+ /// Default timer fires only once.
+ /// Not effective, if the timer is running. Effective on next \ref Start() or \ref Start(seconds, msecs) call.
+ /// \~english @param[in] repeatTimer
+ /// BOOL - TRUE - set repeat timer
+ /// FALSE - set single timeout timer. (Default behavior)
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// -None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Sets the timer as a repeat timer. Timer timeouts repeatedly as per the interval set.
+ /// Default timer fires only once.
+ /// Not effective, if the timer is running. Effective on next \ref Start() or \ref Start(seconds, msecs) call.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////
+ VOID SetRepeatTimer(BOOL repeatTimer);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Set the interval of timeout. Interval is addition of seconds and milliseconds passed as an arguments.
+ /// \~english @param[in] seconds
+ /// UI_32 - Time in seconds
+ /// \~english @param[in] msecs
+ /// UI_64 - Time in milliseconds
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Set the interval of timeout. Interval is addition of seconds and milliseconds passed as an arguments.
+ /// The default value of interval time is 0.
+ /// If interval time is 0, stop timer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////
+ VOID SetTime(UI_32 seconds, UI_64 msecs);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// This function overloads SetTime(). Set the interval of timeout. Interval is addition of hrs,
+ /// mins, seconds and milliseconds passed as an arguments.
+ /// \~english @param[in] hrs
+ /// UI_32 - Time in hours
+ /// \~english @param[in] mins
+ /// UI_64 - Time in minutes
+ /// \~english @param[in] seconds
+ /// UI_32 - Time in seconds
+ /// \~english @param[in] msecs
+ /// UI_64 - Time in milliseconds
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// This function overloads SetTime(). Set the interval of timeout. Interval is addition of hrs,
+ /// mins, seconds and milliseconds passed as an arguments.
+ /// The default value of interval time is 0.
+ /// If interval time is 0, stop timer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetTime(UI_32 hrs, UI_32 mins, UI_32 seconds, UI_64 msecs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Starts or restarts timer with specified time interval. Interval is addition of seconds and
+ /// milliseconds passed as an arguments.
+ /// \~english @param[in] seconds
+ /// UI_32 - Time in seconds
+ /// \~english @param[in] msecs
+ /// UI_64 - Time in milliseconds
+ /// \~english @retval EFrameworkunifiedStatus - Returns eFrameworkunifiedStatusOK on success otherwise eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// - Create a timer handle of instance by SetNotifyMethod()
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// - Timer handle of instance is NULL [eFrameworkunifiedStatusFail]
+ /// - Timer handle state of instance has been deleted(DELETED_STATE) [eFrameworkunifiedStatusFail]
+ /// - Failed to start/stop(timerfd_settime) timer [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// Starts or restarts timer with specified time interval. Interval is addition of seconds and
+ /// milliseconds passed as an arguments.
+ /// Interval time setted by this method will overwrite interval time setted by SetTime(UI_32, UI_64).
+ /// If interval time is 0, stop timer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// - None
+ /// \~english @see SetTime(UI_32, UI_64), Start, Stop, SetNotifyMethod
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Start(UI_32 seconds, UI_64 msecs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// This function overloads Start(). Starts or restarts timer with interval specified using SetTime()
+ /// or last interval (if the timer was started before using Start(seconds, msecs)).
+ /// \~english @retval EFrameworkunifiedStatus - Returns eFrameworkunifiedStatusOK on success otherwise eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// - Create a timer handle of instance by SetNotifyMethod()
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// - Timer handle of instance is NULL [eFrameworkunifiedStatusFail]
+ /// - Timer handle state of instance has been deleted(DELETED_STATE) [eFrameworkunifiedStatusFail]
+ /// - Failed to start/stop(timerfd_settime) timer [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - Starts or restarts timer with interval specified using SetTime(UI_32, UI_64) or Start(UI_32, UI_64).
+ /// If interval time is not setted, default value is 0. If interval time is 0, stop timer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// - None
+ /// \~english @see SetTime(UI_32, UI_64), Stop, SetNotifyMethod, WholeSeconds, MSToNS, NS_TimerSetTime
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Start();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Stops the timer
+ /// \~english @retval EFrameworkunifiedStatus - Returns eFrameworkunifiedStatusOK on success otherwise eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// - Create a timer handle of instance by SetNotifyMethod()
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// - Timer handle of instance is NULL [eFrameworkunifiedStatusFail]
+ /// - Timer handle state of instance has been deleted(DELETED_STATE) [eFrameworkunifiedStatusFail]
+ /// - Failed to stop(timerfd_settime) timer [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - Stops the timer
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// - None
+ /// \~english @see Start, Start(UI_32, UI_64), SetNotifyMethod, NS_TimerSetTime
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Stop();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Returns timer running status
+ /// \~english @retval BOOL - TRUE if timer is running else FALSE
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// -Returns timer running status
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see Start, Start(UI_32, UI_64), SetNotifyMethod, NS_TimerSetTime
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsRunning();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Returns timeout interval in milliseconds
+ /// \~english @retval UI_64 - Timeout interval in milliseconds
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// - Returns timeout interval in milliseconds
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_64 GetInterval();
+
+ private:
+
+ HANDLE m_hTimer; ///< Corresponding NS timer handle
+
+ UI_64 m_u64TimeInterval; ///< time interval in milliseconds
+
+ BOOL m_bRepeatTimer; ///< if it is a repeat timer. Default value is false.
+};
+
+
+#endif // NS_TIMER_IF_HPP_ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_transmit_log.h b/nsframework/framework_unified/client/include/native_service/ns_transmit_log.h
new file mode 100755
index 0000000..e61ec7e
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_transmit_log.h
@@ -0,0 +1,256 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains declaration of wrapper C type API's for class CNSSharedMem
+/// to read and write transmit log to shared memory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_transmit_log.h
+ * @brief \~english This file contains declaration of wrapper C type API for reading and writing
+ * transmit log on shared memory.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_LOG_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_LOG_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define TRANSMIT_LOG_SHAREDMEM_NAME "/TransmitLogShBuf"
+#define TRANSMIT_LOG_SHAREDMEM_SIZE 5242880 // 5MB
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemTransmitLogOpen
+/// \~english @par Brief
+/// Open the shared memory for transmit logging.
+/// \~english @param[in]
+/// \~english @retval eFrameworkunifiedStatusOK if shared memory is opened.
+/// \~english @retval eFrameworkunifiedStatusNullPointer if memory allocation error while creating shared memory pointer.
+/// \~english @retval eFrameworkunifiedStatusFail if shared memory not open
+/// \~english @par Preconditons
+/// - None
+/// \~english @par Change of internal status
+/// - Open shared memory object
+/// \~english @par Conditions of processing failure
+/// - Memory allocation error while creating shared memory pointer.[eFrameworkunifiedStatusNullPointer]
+/// - If shared memory not open.[eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Open the shared memory for transmit logging.\n
+/// If shared memory is not exist,then create a shared memory,and open.
+/// \~english @par Classification
+/// - public
+/// \~english @par Type
+/// - sync only
+/// \~english @par
+/// - eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Failure
+/// \~english @see NSSharedMemTransmitLogClose
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogOpen();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemTransmitLogClose
+/// \~english @par Brief
+/// Close the transmit logging shared memory
+/// \~english @param[in]
+/// \~english @retval eFrameworkunifiedStatusOK if shared memory is closed
+/// \~english @retval eFrameworkunifiedStatusNullPointer if shared memory pointer is NULL.
+/// \~english @retval eFrameworkunifiedStatusFail if shared memory was not closed.
+/// \~english @par Preconditons
+/// - None
+/// \~english @par Change of internal status
+/// -Open shared memory object
+/// \~english @par Conditions of processing failure
+/// - shared memory pointer is NULL.[eFrameworkunifiedStatusNullPointer]
+/// - If shared memory not close.[eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Close the transmit logging shared memory.\n
+/// If shared memory closed failure or shared memory don't exist,then return failure.
+/// \~english @par Classification
+/// - public
+/// \~english @par Type
+/// - sync only
+/// \~english @par
+/// - eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Failure
+/// \~english @see NSSharedMemTransmitLogOpen
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogClose();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemReadTransmitLog
+/// \~english @par Brief
+/// Reads transmit log from the shared memory buffer.
+/// \~english @param [in] f_pBuffer
+/// PSTR - pointer to the buffer in which data to be read.
+/// \~english @param [in] f_uiLength
+/// UI_32 - length of the data to be read.
+/// \~english @param [in] f_bBlock
+/// BOOL - TRUE - blocking call
+/// FALSE - non blocking call
+/// \~english @retval Except NS_SHM_ERROR - Indicates the number of bytes read.
+/// \~english @retval NS_SHM_ERROR -if shared memory is not opened.
+/// \~english @par Preconditons
+/// -None
+/// \~english @par Change of internal status
+/// None
+/// \~english @par Conditions of processing failure
+/// if g_pTransmitLogSharedBuf or f_pBuffer is null.[NS_SHM_ERROR]
+/// \~english @par Detail
+/// If this function is used as blocking call,\n
+/// then the calling thread will get blocked until data is available for read.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par
+/// - l_iReadSize:Result
+/// - NS_SHM_ERROR:Failure
+/// - Except NS_SHM_ERROR:Success
+/// \~english @see NSSharedMemWriteTransmitLog
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemReadTransmitLog(PSTR f_pBuffer, const UI_32 f_uiLength, const BOOL f_bBlock);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemWriteTransmitLog
+/// \~english @par Brief
+/// Write transmit log into the shared memory buffer.
+/// \~english @param [in] f_pBuffer
+/// PSTR - pointer to the buffer containing the data to be written.
+/// \~english @param [in] f_uiLength
+/// UI_32 - length of the data buffer to be written.
+/// \~english @retval Except NS_SHM_ERROR - Indicates the number of bytes written,
+/// \~english @retval NS_SHM_ERROR -if shared memory is not opened.
+/// \~english @par Preconditons
+/// -None
+/// \~english @par Change of internal status
+/// None
+/// \~english @par Conditions of processing failure
+/// if g_pTransmitLogSharedBuf or f_pBuffer is null.[NS_SHM_ERROR]
+/// \~english @par Detail
+/// If this function is used as blocking call,\n
+/// then the calling thread will get blocked until data is available for write.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par
+/// - l_iReadSize:Result
+/// - NS_SHM_ERROR:Failure
+/// - Except NS_SHM_ERROR:Success
+/// \~english @see NSSharedMemReadTransmitLog
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemWriteTransmitLog(PCSTR f_pBuffer, const UI_32 f_uiLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemDumpTransmitLogToFile
+/// \~english @par Brief
+/// Dump the transmit logging shared memory to file
+/// \~english @param [in] f_pPath
+/// PCSTR - full file path
+/// \~english @param [in] f_puiSize
+/// PCSTR - Size of data dumped to file
+/// \~english @retval eFrameworkunifiedStatusOK if shared memory is closed
+/// \~english @retval eFrameworkunifiedStatusFileLoadError file path is incorrect
+/// \~english @retval eFrameworkunifiedStatusSemLockFail/
+/// eFrameworkunifiedStatusSemUnLockFail - mutex locking/unlocking error
+/// \~english @retval eFrameworkunifiedStatusFail shared memory is not open
+/// \~english @par Preconditons
+/// - None
+/// \~english @par Change of internal status
+/// -Open shared memory object
+/// \~english @par Conditions of processing failure
+/// - shared memory pointer is NULL.[eFrameworkunifiedStatusNullPointer]
+/// - mutex locking/unlocking error.[eFrameworkunifiedStatusSemLockFail/eFrameworkunifiedStatusSemUnLockFail]
+/// - shared memory is not open.[eFrameworkunifiedStatusFail]
+/// - file path is incorrect.[eFrameworkunifiedStatusFileLoadError]
+/// \~english @par Detail
+/// Writes all the data in the buffer into provided file path.\n
+/// Overwrites the file if it exists.
+/// \~english @par Classification
+/// - public
+/// \~english @par Type
+/// - sync only
+/// \~english @par
+/// - eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Failure
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemDumpTransmitLogToFile(PCSTR f_pPath, PUI_32 f_puiDumpSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemTransmitLogIsOpen
+/// \~english @par Brief
+/// This function is used to check whether the shared memory buffer is opened or not.
+/// \~english @retval TRUE - Open
+/// \~english @retval FALSE - Not open
+/// \~english @par Preconditons
+/// - None
+/// \~english @par Change of internal status
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// - This function is used to check whether the shared memory buffer is opened or not.\n
+/// Used only in nstest_sharedmem.
+/// \~english @par Classification
+/// - public
+/// \~english @par Type
+/// Sync only
+/// \~english @see none
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NSSharedMemTransmitLogIsOpen();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_LOG_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_util_crc.h b/nsframework/framework_unified/client/include/native_service/ns_util_crc.h
new file mode 100755
index 0000000..5528007
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_util_crc.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \brief This file contains declaration of APIs to calcuate 16-bit and 32-bit CRC checksum of file.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_util_crc.h
+ */
+
+#ifndef NS_NS_UTILITYCENTER_INC_NS_UTIL_CRC_H_ // NOLINT (build/header_guard)
+#define NS_NS_UTILITYCENTER_INC_NS_UTIL_CRC_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup utility
+ * @ingroup framework_unified
+ * @{
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Calculate the CRC value of the file
+/// \~english @param [in] f_c_file_name
+/// PCSTR - the file to be calculated
+/// \~english @param [out] f_ui_check_sum
+/// UI_16 - the CRC value of the file
+/// \~english @retval eFrameworkunifiedStatusOK : Success
+/// \~english @retval eFrameworkunifiedStatusFileLoadError : File Load Error
+/// \~english @retval eFrameworkunifiedStatusInvldParam : Invalid Param
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - Failed to open the file. [eFrameworkunifiedStatusFileLoadError]
+/// - The pointer f_c_file_name is NULL. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function calculates the CRC value(16 bit) of the file f_c_file_name.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CalculateCRC16(PCSTR f_c_file_name, UI_16 & f_ui_check_sum); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Calculate the CRC value of the file
+/// \~english @param [in] f_c_file_name
+/// PCSTR - the file to be calculated
+/// \~english @param [out] f_ui_check_sum
+/// UI_32 - the CRC value of the file
+/// \~english @retval eFrameworkunifiedStatusOK : Success
+/// \~english @retval eFrameworkunifiedStatusFileLoadError : File Load Error
+/// \~english @retval eFrameworkunifiedStatusInvldParam : Invalid Param
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - Failed to open the file. [eFrameworkunifiedStatusFileLoadError]
+/// - The pointer f_c_file_name is NULL. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function calculates the CRC value(32 bit) of the file f_c_file_name.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CalculateCRC32(PCSTR f_c_file_name, UI_32 & f_ui_check_sum); // NOLINT (readability/nolint)
+
+#endif // NS_NS_UTILITYCENTER_INC_NS_UTIL_CRC_H_ // NOLINT (build/header_guard)
+
+/** @}*/ // end of utility
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/ns_util_directory.h b/nsframework/framework_unified/client/include/native_service/ns_util_directory.h
new file mode 100755
index 0000000..945275c
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_util_directory.h
@@ -0,0 +1,160 @@
+/**
+ * @file ns_util_directory.h
+ * @brief \~english This file contains declaration of ns_util_directory.
+ *
+ */
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains utility functions to handle file and folder operations.
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef NS_NS_UTILITYCENTER_INC_NS_UTIL_DIRECTORY_H_ // NOLINT (build/header_guard)
+#define NS_NS_UTILITYCENTER_INC_NS_UTIL_DIRECTORY_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <vector>
+#include <string>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup utility
+ * @ingroup framework_unified
+ * @{
+ */
+
+/**
+ * \~english an abbreviation for std::vector<std::string>
+ */
+typedef std::vector< std::string > TFileList;
+
+/**
+ * \~english a abbreviation for std::vector<std::string>::iterator
+ */
+typedef TFileList::iterator TFileListIterator;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the name of files existing in a specific directory
+/// \~english @param [in] f_pc_path
+/// PCSTR - the directory path
+/// \~english @param [out] f_pv_tfile_list
+/// TFileList - store the name of the files in the specific directory
+/// \~english @retval eFrameworkunifiedStatusOK : Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam : Invalid Param
+/// \~english @retval eFrameworkunifiedStatusNullPointer : NULL Pointer
+/// \~english @retval eFrameworkunifiedStatusFail : Abnormal Error
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - The pointer f_pv_tfile_list or f_pc_path is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Failed to open the directory f_pc_path. [eFrameworkunifiedStatusFail]
+/// - Failed to new a buffer for inner using. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function gets all the name of the file locating at the directory f_pc_path and stores \n
+/// them in f_pv_tfile_list.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetFileList(TFileList * f_pv_tfile_list, PCSTR f_pc_path);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Check whether the directory is existing or not.
+/// \~english @param [in] f_c_dir_path
+/// std::string - the directory to be checked
+/// \~english @retval TRUE: the directory is existing.
+/// FALSE: the directory is not existing.
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function checks whether the directory is existing or not.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL DoesDirecotryExist(std::string f_c_dir_path);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Create the directory f_c_dir_path.
+/// \~english @param [in] f_c_dir_path
+/// std::string - the directory to be created
+/// \~english @retval eFrameworkunifiedStatusOK : Success
+/// \~english @retval eFrameworkunifiedStatusFail : Abnormal Error
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - The input param f_c_dir_path is empty. [eFrameworkunifiedStatusFail]
+/// - Faild to create(mkdir) the direcory. [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function creates the directory f_c_dir_path.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateDirectory(std::string f_c_dir_path);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // NS_NS_UTILITYCENTER_INC_NS_UTIL_DIRECTORY_H_ NOLINT (build/header_guard)
+
+/** @}*/ // end of utility
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/ns_utility.hpp b/nsframework/framework_unified/client/include/native_service/ns_utility.hpp
new file mode 100755
index 0000000..07fe4f5
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_utility.hpp
@@ -0,0 +1,572 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_UtilityCenter
+/// \brief This file contains declaration of common APIs for NS_UtilityCenter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_utility.hpp
+ * @brief \~english This file contains declaration of common APIs for NS_UtilityCenter.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NSFRAMEWORK_NSUTILITY_NSUTILITY__ // NOLINT (build/header_guard)
+#define __NSFRAMEWORK_NSUTILITY_NSUTILITY__
+
+#include <native_service/frameworkunified_types.h>
+#include <new>
+#include <exception>
+#include <algorithm>
+#include <iterator>
+
+#ifdef AGL_STUB
+#include <stdexcept>
+#endif
+
+// Macros ///////////////////////////////////////////////////////////////
+
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&); \
+ void operator=(const TypeName& )
+
+#define DEFINE_EXCEPTION( name, base ) \
+class name : public base \
+{ \
+public: \
+ name ( const char* str = "" ) : base ( str ) \
+ {} \
+}
+
+// Helpful type definitions ////////////////////////////////////////////////
+template <int v>
+struct Int2Type {
+ enum { value = v }; // NOLINT (readability/nolint)
+};
+
+template <class T>
+struct Type2Type {
+ typedef T Type;
+};
+
+// Helpful Fucntions /////////////////////////////////////////////////////////
+template< class T, UI_32 N >
+const T *ArrBeg(const T(&arr)[ N ]) {
+ return &arr[ 0 ];
+}
+
+template< class T, UI_32 N >
+const T *ArrEnd(const T(&arr)[ N ]) {
+ return &arr[ 0 ] + N;
+}
+
+template< class O, class I >
+O SimpleCast(I i) {
+ return static_cast< O >(i);
+}
+
+template< class R, class B >
+R UnalignedRet(B *b) {
+ return *reinterpret_cast< R volatile * >(b);
+}
+
+template< class Cont, class Gen >
+Cont genRange(UI_32 N, Gen genFn) {
+ Cont c;
+ std::generate_n(std::back_inserter(c), N, genFn);
+ return c;
+}
+
+template< class OCont, class IIter, class MapFn >
+OCont mapRange(const IIter &begin, const IIter &end, MapFn fn) {
+ OCont c;
+ std::transform(begin, end, std::inserter(c, c.begin()), fn);
+ return c;
+}
+// Static Compile-time list creation /////////////////////////////////////////
+
+#ifdef AGL_STUB
+#else
+////////////////////////
+#include <_pack1.h> //
+//////////////////////////
+#endif
+
+template< class T, UI_32 N >
+struct TList {
+ T datum;
+ TList < T, N - 1 > data;
+
+ T *operator&() { // NOLINT (readability/nolint)
+ return reinterpret_cast< T * >(this);
+ }
+ const T *operator&() const { // NOLINT (readability/nolint)
+ return reinterpret_cast< const T * >(this);
+ }
+ static const UI_32 count = N; // NOLINT (readability/nolint)
+
+};
+
+template< class T >
+struct TList< T, 1 > {
+ T datum;
+
+ T *operator&() { // NOLINT (readability/nolint)
+ return reinterpret_cast< T * >(this);
+ }
+ const T *operator&() const { // NOLINT (readability/nolint)
+ return reinterpret_cast< const T * >(this);
+ }
+ static const UI_32 count = 1; // NOLINT (readability/nolint)
+
+};
+
+#ifdef AGL_STUB
+#else
+/////////////////////////
+#include <_packpop.h> //
+///////////////////////
+#endif
+
+// Function Decomposition ///////////////////////////////////////////////////
+
+template< class Sig >
+struct FSig {
+};
+
+template<class R>
+struct FSig< R(*)() > {
+ typedef R RType;
+ static const UI_32 argCount = 0; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1>
+struct FSig< R(*)(T1) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ static const UI_32 argCount = 1; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2>
+struct FSig< R(*)(T1, T2) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ static const UI_32 argCount = 2; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2, class T3>
+struct FSig< R(*)(T1, T2, T3) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ typedef T3 TArg3;
+ static const UI_32 argCount = 3; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2, class T3, class T4>
+struct FSig< R(*)(T1, T2, T3, T4) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ typedef T3 TArg3;
+ typedef T4 TArg4;
+ static const UI_32 argCount = 4; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2, class T3, class T4, class T5>
+struct FSig< R(*)(T1, T2, T3, T4, T5) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ typedef T3 TArg3;
+ typedef T4 TArg4;
+ typedef T5 TArg5;
+ static const UI_32 argCount = 5; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2, class T3, class T4, class T5, class T6>
+struct FSig< R(*)(T1, T2, T3, T4, T5, T6) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ typedef T3 TArg3;
+ typedef T4 TArg4;
+ typedef T5 TArg5;
+ typedef T6 TArg6;
+ static const UI_32 argCount = 6; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2, class T3, class T4, class T5, class T6, class T7>
+struct FSig< R(*)(T1, T2, T3, T4, T5, T6, T7) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ typedef T3 TArg3;
+ typedef T4 TArg4;
+ typedef T5 TArg5;
+ typedef T6 TArg6;
+ typedef T7 TArg7;
+ static const UI_32 argCount = 7; // NOLINT (readability/nolint)
+};
+
+
+
+// Accumulator definition //////////////////////////////////////////////////
+
+/// \brief Accumultor type
+///
+/// An accumulator is an object that keeps an internal counter, and will increment its
+/// counter by n, which defaults to 1, each time operator() is called on it. Eample usage:
+///
+/// Accumulator< int > a( 42 ); // initialize a to 42
+/// int v1 = a(); // <-- v1 == 43
+/// int v2 = a(); // <-- v2 == 44
+/// int v4 = a(10); // <-- v4 == 54
+/// int v5 = a(); // <-- v5 == 55
+template<typename T>
+class Accumulator {
+ public:
+ Accumulator(T n) : n(n) {}
+
+ template<typename U>
+ Accumulator(const Accumulator<U> &u) : n(u.n) {}
+
+ T operator()(T i = 1) { // NOLINT (readability/nolint)
+ return operator()< T >(i);
+ }
+
+ template<typename U>
+ T operator()(U i) {
+ return n += i;
+ }
+
+ template< typename U >
+ friend class Accumulator;
+
+ private:
+ T n;
+};
+
+
+/// \brief Accumulator utility function
+///
+/// Given a value n of type T, returns an accumulator of type Accumulator<T> initialized to value n
+template<typename T>
+Accumulator<T> MakeAccumulator(T n) {
+ return Accumulator<T>(n);
+}
+
+// Rsrc Management helper class /////////////////////////////////////////////
+
+template< class T >
+class MemTraits {
+ public:
+ typedef T *Type;
+ typedef std::bad_alloc Exception;
+ static void Release(Type rsrc) {
+ delete rsrc;
+ }
+
+ static BOOL BadValue(Type rsrc) {
+ return NULL == rsrc;
+ }
+};
+
+template< class RsrcTraits >
+class RaiseExceptionPolicy {
+ public:
+ typedef typename RsrcTraits::Type Type;
+ static Type check(Type t) { // NOLINT (readability/nolint)
+ if (RsrcTraits::BadValue(t)) {
+ throw typename RsrcTraits::Exception();
+ }
+
+ return t;
+ }
+};
+
+template< class RsrcTraits >
+class CheckForErrorPolicy { // no exceptions
+ public:
+ typedef typename RsrcTraits::Type Type;
+
+ static Type check(Type t) { // NOLINT (readability/nolint)
+ return t;
+ }
+
+ static bool isValid(Type t) { // NOLINT (readability/nolint)
+ return ! RsrcTraits::BadValue(t);
+ }
+};
+
+template < class T,
+ class RsrcTraits = MemTraits< T >,
+ template <class> class ErrorPolicy = RaiseExceptionPolicy >
+class ResourceMgr : public RsrcTraits {
+ public:
+ typedef typename RsrcTraits::Type Type;
+ typedef ErrorPolicy< RsrcTraits > TFullErrorPolicy;
+
+ ResourceMgr(Type rsrc) : m_rsrc(TFullErrorPolicy::check(rsrc)) {}
+
+ ~ResourceMgr() {
+ RsrcTraits::Release(m_rsrc);
+ }
+
+ operator Type() { // NOLINT (readability/nolint)
+ return m_rsrc;
+ }
+
+ operator const Type() const { // NOLINT (readability/nolint)
+ return m_rsrc;
+ }
+
+ bool isValid() const { // NOLINT (readability/nolint)
+ return TFullErrorPolicy::isValid(m_rsrc);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ResourceMgr);
+
+ Type m_rsrc;
+};
+
+// Functor Helper classes /////////////////////////////////////
+template< class R >
+class IFunctor {
+ public:
+ IFunctor() {}
+ virtual ~IFunctor() {}
+
+ virtual R operator()() const = 0; // NOLINT (readability/nolint)
+ virtual UI_32 size() const = 0; // NOLINT (readability/nolint)
+};
+
+template< class TFn >
+class CFunctor0 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+ CFunctor0(TFn fn) : m_function(fn) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function();
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn);
+ }
+
+ private:
+ TFn m_function;
+};
+
+template< class TFn, class Arg1 >
+class CFunctor1 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+
+ CFunctor1(TFn fn, Arg1 arg1) : m_function(fn), m_arg1(arg1) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1);
+ }
+
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+};
+
+template< class TFn, class Arg1, class Arg2 >
+class CFunctor2 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+
+ CFunctor2(TFn fn, Arg1 arg1, Arg2 arg2) : m_function(fn), m_arg1(arg1), m_arg2(arg2) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+};
+
+template< class TFn, class Arg1, class Arg2, class Arg3 >
+class CFunctor3 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+
+ CFunctor3(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3) : m_function(fn), m_arg1(arg1), m_arg2(arg2), m_arg3(arg3) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2, m_arg3);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2) + sizeof(Arg3);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+ Arg3 m_arg3;
+};
+
+template< class TFn, class Arg1, class Arg2, class Arg3, class Arg4 >
+class CFunctor4 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+ CFunctor4(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) : m_function(fn), m_arg1(arg1), m_arg2(arg2),
+ m_arg3(arg3), m_arg4(arg4) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2, m_arg3, m_arg4);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2) + sizeof(Arg3) + sizeof(Arg4);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+ Arg3 m_arg3;
+ Arg4 m_arg4;
+};
+
+template< class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
+class CFunctor5 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+ CFunctor5(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) : m_function(fn), m_arg1(arg1), m_arg2(arg2),
+ m_arg3(arg3), m_arg4(arg4), m_arg5(arg5) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2, m_arg3, m_arg4, m_arg5);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2) + sizeof(Arg3) + sizeof(Arg4) + sizeof(Arg5);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+ Arg3 m_arg3;
+ Arg4 m_arg4;
+ Arg5 m_arg5;
+};
+
+template< class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6 >
+class CFunctor6 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+ CFunctor6(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6) : m_function(fn), m_arg1(arg1),
+ m_arg2(arg2), m_arg3(arg3), m_arg4(arg4), m_arg5(arg5), m_arg6(arg6) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2) + sizeof(Arg3) + sizeof(Arg4) + sizeof(Arg5) + sizeof(Arg6);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+ Arg3 m_arg3;
+ Arg4 m_arg4;
+ Arg5 m_arg5;
+ Arg6 m_arg6;
+};
+
+template< class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7 >
+class CFunctor7 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+ CFunctor7(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6, Arg7 arg7)
+ : m_function(fn), m_arg1(arg1), m_arg2(arg2), m_arg3(arg3), m_arg4(arg4), m_arg5(arg5), m_arg6(arg6), m_arg7(arg7) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2) + sizeof(Arg3) + sizeof(Arg4) + sizeof(Arg5) + sizeof(Arg6) + sizeof(Arg7);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+ Arg3 m_arg3;
+ Arg4 m_arg4;
+ Arg5 m_arg5;
+ Arg6 m_arg6;
+ Arg7 m_arg7;
+};
+
+
+template<class TFn>
+CFunctor0<TFn> functor(TFn fn) {
+ return CFunctor0<TFn>(fn);
+}
+
+template<class TFn, class Arg1>
+CFunctor1<TFn, Arg1> functor(TFn fn, Arg1 arg1) {
+ return CFunctor1<TFn, Arg1>(fn, arg1);
+}
+
+template<class TFn, class Arg1, class Arg2>
+CFunctor2<TFn, Arg1, Arg2> functor(TFn fn, Arg1 arg1, Arg2 arg2) {
+ return CFunctor2<TFn, Arg1, Arg2>(fn, arg1, arg2);
+}
+
+template<class TFn, class Arg1, class Arg2, class Arg3>
+CFunctor3<TFn, Arg1, Arg2, Arg3> functor(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3) {
+ return CFunctor3<TFn, Arg1, Arg2, Arg3>(fn, arg1, arg2, arg3);
+}
+
+template<class TFn, class Arg1, class Arg2, class Arg3, class Arg4>
+CFunctor4<TFn, Arg1, Arg2, Arg3, Arg4> functor(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) {
+ return CFunctor4<TFn, Arg1, Arg2, Arg3, Arg4>(fn, arg1, arg2, arg3, arg4);
+}
+
+template<class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5>
+CFunctor5<TFn, Arg1, Arg2, Arg3, Arg4, Arg5> functor(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) {
+ return CFunctor5<TFn, Arg1, Arg2, Arg3, Arg4, Arg5>(fn, arg1, arg2, arg3, arg4, arg5);
+}
+
+template<class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6>
+CFunctor6<TFn, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6> functor(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4,
+ Arg5 arg5, Arg6 arg6) {
+ return CFunctor6<TFn, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>(fn, arg1, arg2, arg3, arg4, arg5, arg6);
+}
+
+template<class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7>
+CFunctor7<TFn, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7> functor(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4,
+ Arg5 arg5, Arg6 arg6, Arg7 arg7) {
+ return CFunctor7<TFn, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>(fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+}
+
+#endif // __NSFRAMEWORK_NSUTILITY_NSUTILITY__ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/nsframework/framework_unified/client/include/native_service/ns_utility_if.h b/nsframework/framework_unified/client/include/native_service/ns_utility_if.h
new file mode 100755
index 0000000..ee10337
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_utility_if.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains declaration of common APIs for NS_UtilityCenter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ns_utility_if.h
+ */
+
+#ifndef NS_NATIVESERVICES_INC_NATIVE_NS_UTILITY_IF_H_ // NOLINT (build/header_guard)
+#define NS_NATIVESERVICES_INC_NATIVE_NS_UTILITY_IF_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+
+/**
+ * \~english Macro for invalid/undefined return
+ */
+#define NS_INVALID_RETURN -1
+
+/**
+ * \~english Macro for setting the i bit of x to one
+ */
+#define NS_SETBIT(x, i) ((x) |= (1 << (i)))
+
+/**
+ * \~english Macro for setting the i bit of x to zero
+ */
+#define NS_CLEARBIT(x, i) ((x) &= ~(1 << (i)))
+
+/**
+ * \~english Macro for making the exclusive-OR operator on the i bit of x with one
+ */
+#define NS_TOGGLEBIT(x, i) ((x) ^= (1 << (i)))
+
+/**
+ * \~english Macro for checking whether the i bit of x is one or not
+ */
+#define NS_ISBITSET(x, i) (((x) & (1 << (i))) != 0)
+
+#endif // NS_NATIVESERVICES_INC_NATIVE_NS_UTILITY_IF_H_ // NOLINT (build/header_guard)
+
+/** @}*/ // end of native
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/ns_utility_sys.hpp b/nsframework/framework_unified/client/include/native_service/ns_utility_sys.hpp
new file mode 100755
index 0000000..5780144
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_utility_sys.hpp
@@ -0,0 +1,321 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains declaration of common APIs for NS_UtilityCenter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_utility_sys.hpp
+ */
+
+#ifndef __NSFRAMEWORK_NSUTILITY_NSUTILITYSYS__ // NOLINT (build/header_guard)
+#define __NSFRAMEWORK_NSUTILITY_NSUTILITYSYS__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_utility.hpp>
+#include <pthread.h>
+#include <errno.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+
+// Lock Wrapper ////////////////////////////////////////////////////////////////
+
+/**
+ * \~english define the lock_error class inherit from std::runtime_error
+ */
+DEFINE_EXCEPTION(lock_error, std::runtime_error);
+
+/**
+ * \~english define the lock_creation_error class inherit from lock_error
+ */
+DEFINE_EXCEPTION(lock_creation_error, lock_error);
+
+/**
+ * \~english define the lock_acquireread_error class inherit from lock_error
+ */
+DEFINE_EXCEPTION(lock_acquireread_error, lock_error);
+
+/**
+ * \~english define the lock_acquirewrite_error class inherit from lock_error
+ */
+DEFINE_EXCEPTION(lock_acquirewrite_error, lock_error);
+
+/**
+ * \~english define the lock_release_error class inherit from lock_error
+ */
+DEFINE_EXCEPTION(lock_release_error, lock_error);
+
+
+/**
+ * @class CMutex
+ * @brief \~english Mutex Lock Class
+ * @par \~english Brief Introduction
+ * \~english This class defines locking policy for Mutexes.
+ *
+ */
+class CMutex {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Construct a CMutex object.
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function constructs a CMutex object.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CMutex();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Destruct the CMutex object.
+ /// \~english @par Prerequisite
+ /// - Construct a CMutex object
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function destructs the CMutex object.
+ /// \~english @see CMutex()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CMutex();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Lock the CMutex object when reading.
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CMutex object
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function locks the CMutex object when reading.
+ /// \~english @see CMutex(), WriteLock(), UnLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void ReadLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Lock the CMutex object when writing.
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CMutex object
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function locks the CMutex object when writing.
+ /// \~english @see CMutex(), ReadLock(), UnLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void WriteLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Open the lock of the CMutex object.
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CMutex object
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function opens the lock of the CMutex object.
+ /// \~english @see CMutex(), ReadLock(), WriteLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void Unlock();
+
+ private:
+
+ pthread_mutex_t m_mtx;
+};
+
+/**
+ * @class CRWLock
+ * @brief \~english Read/Write Lock Class
+ * @par \~english Brief Introduction
+ * \~english This class defines locking policy for reader/writer.
+ *
+ */
+class CRWLock {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// - Construct a CRWLock object.
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function constructs a CRWLock object.
+ /// \~english @see ~CRWLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRWLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Destruct the CRWLock object.
+ /// \~english @par Prerequisite
+ /// - Construct a CRWLock object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function destructs the CRWLock object.
+ /// \~english @see CRWLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CRWLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Lock the CRWLock object when reading.
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CRWLock object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function locks the CRWLock object when reading.
+ /// \~english @see CRWLock(), WriteLock(), UnLoack()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void ReadLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Lock the CRWLock object when writing.
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CRWLock object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function locks the CRWLock object when writing.
+ /// \~english @see CRWLock(), ReadLock(), UnLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void WriteLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Open the lock of CRWLock object
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CRWLock object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function opens the lock of the CRWLock object.
+ /// \~english @see CRWLock(), ReadLock(), WriteLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void Unlock();
+
+ private:
+ pthread_rwlock_t m_rwl;
+};
+
+#endif // __NSFRAMEWORK_NSUTILITY_NSUTILITYSYS__ // NOLINT (build/header_guard)
+/** @}*/ // end of native
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/ns_version.h b/nsframework/framework_unified/client/include/native_service/ns_version.h
new file mode 100755
index 0000000..fad7eff
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_version.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_version.h
+ * @brief \~english This file provides version define
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef VERSION_H_ // NOLINT (build/header_guard)
+#define VERSION_H_
+
+#define MAJORNO 0x02
+#define MINORNO 0x02
+#define REVISION 0x05
+
+#endif /* VERSION_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_version_if.h b/nsframework/framework_unified/client/include/native_service/ns_version_if.h
new file mode 100755
index 0000000..d0f5172
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_version_if.h
@@ -0,0 +1,510 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Header for CFrameworkunifiedVersion class
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_version_if.h
+* @brief \~english Header for CFrameworkunifiedVersion class
+ */
+
+#ifndef NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_ // NOLINT (build/header_guard)
+#define NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_
+#include <native_service/frameworkunified_types.h>
+#include <string.h>
+
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+#include <other_service/strlcat.h>
+#endif
+
+
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+
+/**
+ * @class CFrameworkunifiedVersion
+ * @brief \~english Version Info Class
+ * @par \~english Brief Introduction
+ * \~english This class provides functions to get various information of the version.
+ *
+ */
+class CFrameworkunifiedVersion {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Construct a CFrameworkunifiedVersion object.
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function constructs a CFrameworkunifiedVersion object.
+ /// \~english @see ~CFrameworkunifiedVersion
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedVersion();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Constructs a CFrameworkunifiedVersion object with parameters.
+ /// \~english @param[in] major
+ /// UI_16 - Major number of the application
+ /// \~english @param[in] minor
+ /// UI_16 - Minor number of the application
+ /// \~english @param[in] revision
+ /// UI_16 - Revision number of the application
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function constructs a CFrameworkunifiedVersion object with parameters.
+ /// \~english @see ~CFrameworkunifiedVersion
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedVersion(UI_16 major, UI_16 minor, UI_16 revision);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Destruct the CFrameworkunifiedVersion object.
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function destructs the CFrameworkunifiedVersion object.
+ /// \~english @see CFrameworkunifiedVersion
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedVersion();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the data number
+ /// \~english @param [in] a
+ /// CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against b.
+ /// \~english @param [in] b
+ /// CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against a.
+ /// \~english @retval TRUE: Match, FALSE: Does not Match
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function is a friend function of the class. \n
+ /// The function checks whether the object matchs the other or not. Match: returns TRUE, \n
+ /// Does not match: returns FALSE.
+ /// \~english @see operator ==
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ friend BOOL operator == (CFrameworkunifiedVersion &a, CFrameworkunifiedVersion &b); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the data number
+ /// \~english @param [in] f_test_i
+ /// CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against this obj.
+ /// \~english @retval TRUE: Match, FALSE: Does not Match
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function checks whether the object matchs the other or not. Match: returns TRUE, \n
+ /// Does not match: returns FALSE.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL operator == (const CFrameworkunifiedVersion &f_test_i); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the version as string
+ /// \~english @retval the vision string
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the version string.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PCSTR VersionStr();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the date as string
+ /// \~english @retval the date string
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the date when building.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PCSTR DateStr();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the signature number
+ /// \~english @retval the signature
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the signature number.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 Signature() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the structure version number
+ /// \~english @retval the structure version number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the structure version number.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 StrucVersion() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the product version
+ /// \~english @retval the product version
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the product version.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 ProductVersion() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the date as number
+ /// \~english @retval the date number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the date as number.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 Date() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the major verion number
+ /// \~english @retval the major version number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the major version number.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_16 Major() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the minor version number
+ /// \~english @retval the minor version number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the minor version number.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_16 Minor() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the unique product identifier
+ /// \~english @retval the revision number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the unique product identifier generated by the build server.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PCSTR Product() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the building version string
+ /// \~english @retval the building version string
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the unique build identifier generated by the build server.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PCSTR Build() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the revision number
+ /// \~english @retval the revision number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the revision as number.
+ /// \~english @see CFrameworkunifiedVersion
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_16 Revision() const;
+
+ private:
+ CFrameworkunifiedVersion(const CFrameworkunifiedVersion &);
+ CFrameworkunifiedVersion &operator= (const CFrameworkunifiedVersion &); // NOLINT (readability/nolint)
+ struct VersionInfo {
+ PSTR p_str_product;
+ UI_32 u32_signature;
+ UI_32 u32_struc_version;
+ UI_32 u32_product_version;
+ UI_32 u32_date;
+ UI_16 u16_major;
+ UI_16 u16_minor;
+ PSTR p_str_build;
+ UI_16 u16_revision;
+ VersionInfo(PSTR p, UI_32 a, UI_32 b, UI_32 c, UI_32 d, UI_16 e, UI_16 f , PSTR g, UI_16 h) :
+ u32_signature(a),
+ u32_struc_version(b),
+ u32_product_version(c),
+ u32_date(d),
+ u16_major(e),
+ u16_minor(f),
+ u16_revision(h) {
+ size_t length = strlen(p) + 1;
+ p_str_product = new CHAR[length]; // LCOV_EXCL_BR_LINE 11:except branch
+ if (NULL != p_str_product) { // LCOV_EXCL_BR_LINE 5:new's error case
+ memset(p_str_product, 0, length);
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(p_str_product, p, length);
+#endif
+ }
+
+ length = strlen(g) + 1;
+ p_str_build = new CHAR[length]; // LCOV_EXCL_BR_LINE 11:except branch
+ if (NULL != p_str_build) { // LCOV_EXCL_BR_LINE 5:new's error case
+ memset(p_str_build, 0, length);
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(p_str_build, g , length);
+#endif
+ }
+ }
+ ~VersionInfo() {
+ delete[] p_str_product; // LCOV_EXCL_BR_LINE 11:except branch
+ p_str_product = NULL;
+ delete[] p_str_build; // LCOV_EXCL_BR_LINE 11:except branch
+ p_str_build = NULL;
+ }
+ } m_tVersionInfo;
+ UI_32 m_u32Month;
+ UI_32 m_u32Year;
+ UI_32 m_u32Day;
+};
+
+/**
+ * \~english define macro for version string
+ */
+#define FRAMEWORKUNIFIED_GET_VERSION() "undefined_undefined_00.00.00"
+
+/**
+ * \~english define macro for the major number of the version
+ */
+#define FRAMEWORKUNIFIED_APP_VERSION_MAJOR() (0)
+
+/**
+ * \~english define macro for the minor number of the version
+ */
+#define FRAMEWORKUNIFIED_APP_VERSION_MINOR() (0)
+
+/**
+ * \~english define macro for the revision number
+ */
+#define FRAMEWORKUNIFIED_APP_VERSION_REVISION() (0)
+
+/**
+ * \~english define macro for the building version
+ */
+#define FRAMEWORKUNIFIED_APP_VERSION_BUILDVER() "undefined"
+
+/**
+ * \~english define macro for product version
+ */
+#define FRAMEWORKUNIFIED_APP_VERSION_PRODUCTID() "undefined"
+
+#endif // NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_ // NOLINT (build/header_guard)
+/** @}*/ // end of native
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/ns_writer.h b/nsframework/framework_unified/client/include/native_service/ns_writer.h
new file mode 100755
index 0000000..788b6a4
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_writer.h
@@ -0,0 +1,229 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class IConfigWriter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_writer.h
+ * @brief \~english This file contains declaration of class IConfigWriter.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_WRITER_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_WRITER_H__ // NOLINT(build/header_guard)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h> // NOLINT(build/header_guard)
+#include <string>
+
+
+/**
+ * @class IConfigWriter
+ * \~english @brief Config writer abstract class.
+ * \~english @par Brief Introduction
+ * IConfigWriter is an abstract class which is inherited by\n
+ * different type configuration file writer class.
+ *
+ */
+class IConfigWriter {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// Constructor of IConfigWriter class
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - To get a instance of this class.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see ~IConfigWriter
+ ////////////////////////////////////////////////////////////////////////////////////
+ IConfigWriter();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~IConfigWriter
+ /// \~english @par Brief
+ /// Destructor of IConfigWriter class
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Destruct the object of this class.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see IConfigWriter
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~IConfigWriter();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// This function is used to parse the file.
+ /// \~english @param [in] f_c_filepath
+ /// std::string - path of file to parse
+ /// \~english @retval EFrameworkunifiedStatus - success or failure
+ /// \~english @par Preconditons
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function is used to parse the file.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ParseFile(const std::string &f_c_filepath) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// This function is used to set the value for the key
+ /// \~english @param [in] f_c_key
+ /// std::string - key to search
+ /// \~english @param [in] f_c_value
+ /// std::string - value to set
+ /// \~english @retval EFrameworkunifiedStatus - error if key not found else eFrameworkunifiedStatusOK
+ /// \~english @par Preconditons
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function is used to set the value for the key
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SetValue(const std::string &f_c_key, std::string f_c_value) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// This function is used to save the changed value permanently to the config source
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function is used to save the changed value permanently to the config source
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SaveData() = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// This function is used to set the config file path
+ /// \~english @param [in] f_cpath
+ /// std::string - Path of file
+ /// \~english @retval EFrameworkunifiedStatus - success or failure
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function is used to set the config file path
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SetPath(const std::string &f_cpath) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// This function is used to set the data pointer in config writer class with data pointer\n
+ /// created in config reader class.\n
+ /// This is needed to avoid recreation of same data structure object in both reader and writer\n
+ /// when we create object of NSConfigParser.\n
+ /// \~english @param [in] f_pdata
+ /// PVOID - Pointer to data structure
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function is used to set the data pointer in config writer class with data pointer\n
+ /// created in config reader class.\n
+ /// This is needed to avoid recreation of same data structure object in both reader and writer\n
+ /// when we create object of NSConfigParser.\n
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual VOID SetDataPtr(PVOID f_pdata) = 0;
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_WRITER_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/ns_xml_reader.h b/nsframework/framework_unified/client/include/native_service/ns_xml_reader.h
new file mode 100755
index 0000000..91e88c0
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_xml_reader.h
@@ -0,0 +1,291 @@
+/**
+ * @file ns_xml_reader.h
+ * @brief \~english This file contains declaration of class CXMLReader.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class CXMLReader.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_READER_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_READER_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <libxml/tree.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_reader.h>
+#include <string>
+
+
+/**
+ * @class CXMLReader
+ * \~english @par Brief Introduction
+ * This class provides functionalities to read from XML config file.
+ *
+ */
+class CXMLReader: public IConfigReader {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXMLReader
+ /// \~english @par Brief
+ /// This API constructor of CXMLReader class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API should be called by ServiceA and create a new object of CXMLReader.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ CXMLReader();
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXMLReader
+ /// \~english @par Brief
+ /// This API constructor of CXMLReader class.
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - Full path of the configuration file
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API should be called by ServiceA and create a new object of CXMLReader with filepath.
+ /// \~english @see GetCXMLReaderObject
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXMLReader(const std::string &f_cFilePath); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CXMLReader
+ /// \~english @par CXMLReader
+ /// Destructor of CXMLReader class.
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - Close shared memory object.
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Destruct the object of CXMLReader
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @see CXMLReader
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CXMLReader();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseFile
+ /// \~english @par Brief
+ /// This API parser file
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - path of file to parse
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// - Create XmlReader object.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API is used to parse the file from the path.
+ /// \~english @see CXMLReader or GetCXMLReaderObject
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus ParseFile(const std::string &f_cFilePath);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseFile
+ /// \~english @par Brief
+ /// Get Value with key
+ /// \~english @param [IN] f_cKey
+ /// std::string - key to search
+ /// \~english @retval std::string - value for key
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// - Create XmlReader object.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to get the value associated with the key
+ /// \~english @see CXMLReader or GetCXMLReaderObject
+ ////////////////////////////////////////////////////////////////////////////////
+ std::string GetValue(const std::string &f_cKey);
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseFile
+ /// \~english @par Brief
+ /// Get Value with key
+ /// \~english @param [IN] f_cKey
+ /// std::string - key to search
+ /// \~english @param [REF] f_cValue
+ /// std::string - Value of key
+ /// \~english @retval eFrameworkunifiedStatusOK Success / Pass / OK
+ /// \~english @retval eFrameworkunifiedStatusFail Failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// - Create XmlReader object.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to get the value associated with the key
+ /// \~english @see CXMLReader or GetCXMLReaderObject
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ EFrameworkunifiedStatus GetValue(const std::string &f_cKey, std::string &f_cValue); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseFile
+ /// \~english @par Brief
+ /// Get Value with key
+ /// \~english @param None
+ /// \~english @retval PVOID - pointer of data structure
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// - Create XmlReader object.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to get the data pointer. This pointer is then set in config writer.
+ /// \~english @see CXMLReader or GetCXMLReaderObject
+ ////////////////////////////////////////////////////////////////////////////////
+ PVOID GetDataPtr();
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// XMLGetValue
+ /// This function is used to parse and get the value from xml file
+ ///
+ /// \param [IN] f_pCurrNode
+ /// xmlNodePtr - pointer to current node in xml
+ /// \param [IN] f_cUserKey
+ /// std::string - Key to be searched for
+ ///
+ /// \return std::string - content of key node
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string XMLGetValue(xmlNodePtr f_pCurrNode, const std::string &f_cUserKey);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// XMLGetValue
+ /// This function is used to parse and get the value from xml file
+ ///
+ /// \param [IN] f_pCurrNode
+ /// xmlNodePtr - pointer to current node in xml
+ /// \param [IN] f_cUserKey
+ /// std::string - Key to be searched for
+ /// \param [IN] f_cValue
+ /// std::string - Value of Key
+ /// \param [IN] f_bKeyFound
+ /// BOOL - flag to check whether key exists in xml file or not
+ ///
+ /// \return EFrameworkunifiedStatus - error if key not found or else eFrameworkunifiedStatusOK
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus XMLGetValue(xmlNodePtr f_pCurrNode,
+ const std::string &f_cUserKey, std::string &f_cValue, BOOL &f_bKeyFound); // NOLINT (readability/nolint)
+ // pointer of xml document structure(DOM)
+ xmlDocPtr m_pXmlDoc;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetCXMLReaderObject
+ /// \~english @par Brief
+ /// Get CXMLReader object.
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - path of file to parse
+ /// \~english @retval CXMLReader *
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API is used to create CXMLReader object with file path and return the CXMLReader pointer.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+CXMLReader *GetCXMLReaderObject(CHAR *f_cFilePath);
+#ifdef __cplusplus
+}
+#endif
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_READER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_xml_writer.h b/nsframework/framework_unified/client/include/native_service/ns_xml_writer.h
new file mode 100755
index 0000000..7686553
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_xml_writer.h
@@ -0,0 +1,336 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_xml_writer.h
+ * @brief \~english This file contains declaration of class CXMLWriter.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class CXMLWriter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_WRITER_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_WRITER_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <libxml/tree.h>
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_writer.h>
+
+#include <string>
+
+/**
+ * @class CXMLWriter
+ * \~english @brief this file has the CXMLWriter class definitions
+ * \~english @par Brief Introduction
+ * This class provides functionalities to write to XML config file
+ *
+ */
+class CXMLWriter: public IConfigWriter {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXMLWriter
+ /// \~english @par Brief
+ /// Parameterless Constructor of CXMLWriter class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API should be called by ServiceA and create a new object without file path of CXMLWriter
+ /// \~english @see GetCXMLWriterObjectNoParam
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXMLWriter();
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXMLWriter
+ /// \~english @par Brief
+ /// Constructor of CXMLWriter class
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - Full path of the configuration file
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API should be called by ServiceA and create a new object with file path of CXMLWriter
+ /// \~english @see GetCXMLWriterObject
+ ////////////////////////////////////////////////////////////////////////////////
+ CXMLWriter(const std::string &f_cFilePath); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CXMLWriter
+ /// \~english @par CXMLWriter
+ /// Destructor of CXMLWriter class.
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// -None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Destruct the object of CXMLWriter
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @see CXMLWriter
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CXMLWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseFile
+ /// \~english @par Brief
+ /// Parse file
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - path of file to parse
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Create CXMLWriter object
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to parse the file
+ /// \~english @see CXMLWriter
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus ParseFile(const std::string &f_cFilePath);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetValue
+ /// \~english @par Brief
+ /// Set vaule for key
+ /// \~english @param [IN] f_cKey
+ /// std::string - key to search
+ /// \~english @param [IN] f_cValue
+ /// std::string - value to set
+ /// \~english @retval eFrameworkunifiedStatusOK Success / Pass / OK
+ /// \~english @retval eFrameworkunifiedStatusFail Failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Create CXMLWriter object
+ /// - ParseFile set the path
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to set the value for the key
+ /// \~english @see CXMLWriter,ParseFile
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SetValue(const std::string &f_cKey, std::string f_cValue);
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SaveData
+ /// \~english @par Brief
+ /// Save changed data
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success / Pass / OK
+ /// \~english @retval eFrameworkunifiedStatusFail Failed
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Create CXMLWriter object
+ /// - ParseFile set the path
+ /// - Change the data
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to save the changed value to the xml config file
+ /// \~english @see GetCXMLWriterObjectNoParam
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SaveData();
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetPath
+ /// \~english @par Brief
+ /// Updata file path
+ /// \~english @param [IN] f_cPath
+ /// std::string - Path of file
+ /// \~english @retval eFrameworkunifiedStatusOK Success / Pass / OK
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Create CXMLWriter object
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to set the config file path
+ /// \~english @see GetCXMLWriterObjectNoParam
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SetPath(const std::string &f_cPath);
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetDataPtr
+ /// \~english @par Brief
+ /// Parse file
+ /// \~english @param [IN] f_pData
+ /// PVOID - Pointer to data structure
+ /// \~english @retval VOID
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Create CXMLWriter object
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to set the data pointer in config writer class
+ /// \~english @see CXMLWriter
+ ////////////////////////////////////////////////////////////////////////////////
+
+ VOID SetDataPtr(PVOID f_pData);
+
+ private:
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// XMLSetValue
+/// This function is used to parse the value from xml file
+///
+/// \param [IN] f_pCurrNode
+/// xmlNodePtr - pointer to current node in xml
+/// \param [IN] f_cUserKey
+/// std::string - Key to be searched for
+/// \param [IN] f_cValue
+/// std::string - Required Value for key
+/// \param [IN] f_bKeyFound
+/// std::string - Flag to check whether key is present in xml file
+///
+/// \return EFrameworkunifiedStatus- success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus XMLSetValue(xmlNodePtr f_pCurrNode,
+ const std::string &f_cUserKey, // NOLINT (readability/nolint)
+ std::string &f_cValue, // NOLINT (readability/nolint)
+ BOOL &f_bKeyFound); // NOLINT (readability/nolint)
+
+// pointer of xml document structure(DOM)
+ xmlDocPtr m_pXmlDoc;
+
+// path of config file
+ std::string m_cFilePath;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetCXMLWriterObject
+ /// \~english @par Brief
+ /// Get CXMLWriter object.
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - path of file to parse
+ /// \~english @retval CXMLWriter *
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API is used to create CXMLWriter object with file path and return the CXMLWriter pointer.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+CXMLWriter *GetCXMLWriterObject(CHAR *f_cFilePath);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetCXMLWriterObjectNoParam
+ /// \~english @par Brief
+ /// Get CXMLWriter object.
+ /// \~english @param None
+ /// \~english @retval CXMLWriter *
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API is used to create CXMLWriter object without file path and return the CXMLWriter pointer.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+
+CXMLWriter *GetCXMLWriterObjectNoParam();
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_WRITER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/ns_xmlparser_if.h b/nsframework/framework_unified/client/include/native_service/ns_xmlparser_if.h
new file mode 100755
index 0000000..f944ddd
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/ns_xmlparser_if.h
@@ -0,0 +1,1150 @@
+/**
+ * @file ns_xmlparser_if.h
+ * @brief \~english This file contains declaration of class CXmlParser, CXmlNode and CXmlAttr.
+ * This file provides the interface for Parsing XML file, API for operation on node
+ * of an xml structure.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NS_XMLPARSER_INC_NS_XMLPARSER_IF_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NS_XMLPARSER_INC_NS_XMLPARSER_IF_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <string>
+#include <list>
+
+// defines the type of xml nodes
+/**
+ * \~english type of xml nodes
+ */
+typedef enum _EFrameworkunifiedXmlNodeTypes {
+ FRAMEWORKUNIFIED_XML_NODE_NONE = 0, //!< \~english not exist node
+ FRAMEWORKUNIFIED_XML_ELEMENT_NODE = 1, //!< \~english element node
+ FRAMEWORKUNIFIED_XML_ATTRIBUTE_NODE = 2, //!< \~english attribute node
+ FRAMEWORKUNIFIED_XML_TEXT_NODE = 3, //!< \~english text node
+ FRAMEWORKUNIFIED_XML_CDATA_SECTION_NODE = 4, //!< \~english section node
+ FRAMEWORKUNIFIED_XML_ENTITY_REF_NODE = 5, //!< \~english entity ref node
+ FRAMEWORKUNIFIED_XML_ENTITY_NODE = 6, //!< \~english entity node
+ FRAMEWORKUNIFIED_XML_PI_NODE = 7, //!< \~english PI node
+ FRAMEWORKUNIFIED_XML_COMMENT_NODE = 8, //!< \~english comment node
+ FRAMEWORKUNIFIED_XML_DOCUMENT_NODE = 9, //!< \~english document node
+ FRAMEWORKUNIFIED_XML_DOCUMENT_TYPE_NODE = 10, //!< \~english document type node
+ FRAMEWORKUNIFIED_XML_DOCUMENT_FRAG_NODE = 11, //!< \~english document frag node
+ FRAMEWORKUNIFIED_XML_NOTATION_NODE = 12, //!< \~english notation node
+ FRAMEWORKUNIFIED_XML_HTML_DOCUMENT_NODE = 13, //!< \~english document node
+ FRAMEWORKUNIFIED_XML_DTD_NODE = 14, //!< \~english dtd node
+ FRAMEWORKUNIFIED_XML_ELEMENT_DECL = 15, //!< \~english element decl
+ FRAMEWORKUNIFIED_XML_ATTRIBUTE_DECL = 16, //!< \~english attribute decl
+ FRAMEWORKUNIFIED_XML_ENTITY_DECL = 17, //!< \~english entity decl
+ FRAMEWORKUNIFIED_XML_NAMESPACE_DECL = 18, //!< \~english namespace decl
+ FRAMEWORKUNIFIED_XML_XINCLUDE_START = 19, //!< \~english include start
+ FRAMEWORKUNIFIED_XML_XINCLUDE_END = 20, //!< \~english include end
+ FRAMEWORKUNIFIED_XML_DOCB_DOCUMENT_NODE = 21 //!< \~english document node
+} EFrameworkunifiedXmlNodeTypes;
+
+// forward declaration
+class CXmlNode;
+class CXmlAttr;
+
+// list of CXmlNode
+typedef std::list<CXmlNode> TNodeList;
+typedef TNodeList::iterator TNodeListIterator;
+
+// list of CXmlAttr
+typedef std::list<CXmlAttr> TAttrList;
+typedef std::list<CXmlAttr>::iterator TAttrListIterator;
+
+
+/**
+ * @class CXmlNode
+ * \~english @brief This class represents node of an XML.
+ * \~english @par Brief Introduction
+ * Provides API for performing operations on node.
+ *
+ */
+class CXmlNode {
+ friend class CXmlParser;
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlNode
+ /// \~english @par Brief
+ /// Destructor of CXmlNode class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Inside state change
+ /// - None
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Destructor of CXmlNode class
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ ~CXmlNode();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IsNull
+ /// \~english @par Brief
+ /// Check xmlNodePtr
+ /// \~english @param None
+ /// \~english @retval BOOL true if valid else false
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Checks whether the corresponding xmlNodePtr is valid or not
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ BOOL IsNull();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Type
+ /// \~english @par Brief
+ /// Get type
+ /// \~english @param None
+ /// \~english @retval FRAMEWORKUNIFIED_XML_NODE_NONE not exist node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ELEMENT_NODE element node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_TEXT_NODE text node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_CDATA_SECTION_NODE section node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ENTITY_REF_NODE entity ref node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ENTITY_NODE entity node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_PI_NODE PI node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_COMMENT_NODE comment node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_DOCUMENT_NODE document node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_DOCUMENT_TYPE_NODE document type node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_DOCUMENT_FRAG_NODE document frag node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_NOTATION_NODE notation node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_HTML_DOCUMENT_NODE document node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_DTD_NODE dtd node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ELEMENT_DECL element decl
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ATTRIBUTE_DECL attribute decl
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ENTITY_DECL entity decl
+ /// \~english @retval FRAMEWORKUNIFIED_XML_NAMESPACE_DECL namespace decl
+ /// \~english @retval FRAMEWORKUNIFIED_XML_XINCLUDE_START include start
+ /// \~english @retval FRAMEWORKUNIFIED_XML_XINCLUDE_END include end
+ /// \~english @retval FRAMEWORKUNIFIED_XML_DOCB_DOCUMENT_NODE document node
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Gets the type of XML node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedXmlNodeTypes Type();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Name
+ /// \~english @par Brief
+ /// Get name
+ /// \~english @param None
+ /// \~english @retval std::string node name
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the name/tag of an XML node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ std::string Name();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetContent
+ /// \~english @par Brief
+ /// Get content
+ /// \~english @param None
+ /// \~english @retval std::string content of current node
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Gets the content of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ std::string GetContent();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetContent
+ /// \~english @par Brief
+ /// Set content
+ /// \~english @param [IN] f_cUpdatedText
+ /// std::string - updated value
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set or update the content of current node. If the node has children then it removes all the child
+ /// nodes and sets the content for the current node.
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SetContent(std::string f_cUpdatedText);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetAttributeValue
+ /// \~english @par Brief
+ /// Get attribute
+ /// \~english @param [IN] f_cKey
+ /// std::string - attribute name
+ /// \~english @param [OUT] f_cAttributeValue
+ /// std::string& - attribute value
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the attribute's value for the key
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus GetAttributeValue(std::string f_cKey, std::string &f_cAttributeValue); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetAttributeValue
+ /// \~english @par Brief
+ /// Set attribute
+ /// \~english @param [IN] f_cKey
+ /// std::string - attribute name
+ /// \~english @param [IN] f_cValue
+ /// std::string - attribute value
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the attribute's value for the key
+ /// If attribute is not found then new attribute key-value pair is created and added to node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SetAttributeValue(std::string f_cKey, std::string f_cValue);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup AddNewAttribute
+ /// \~english @par Brief
+ /// Add new attribute
+ /// \~english @param [IN] f_cKey
+ /// std::string - attribute name
+ /// \~english @param [IN] f_cValue
+ /// std::string - attribute value
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Add new attribute to the node. If the attribute key is existing then it updates the existing
+ /// value with the new value or else adds the new attribute
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus AddNewAttribute(std::string f_cKey, std::string f_cAttributeValue);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RemoveAttribute
+ /// \~english @par Brief
+ /// Removes attribute
+ /// \~english @param [IN] f_cKey
+ /// std::string - attribute name
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Remove the attribute from the node with the specified key
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus RemoveAttribute(std::string f_cKey);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetAttributeItems
+ /// \~english @par Brief
+ /// Get attributes list
+ /// \~english @param None
+ /// \~english @retval TAttrList - list of all attributes of node or empty list in case of no attributes
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the list of all the attribute's key and value of the node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ TAttrList GetAttributeItems();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Parent
+ /// \~english @par Brief
+ /// Get parent
+ /// \~english @param None
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the parent node of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ CXmlNode Parent();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FirstChild
+ /// \~english @par Brief
+ /// Get first child
+ /// \~english @param None
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the first child node of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode FirstChild();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LastChild
+ /// \~english @par Brief
+ /// Get last child
+ /// \~english @param None
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the last child node of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode LastChild();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Children
+ /// \~english @par Brief
+ /// Get child list
+ /// \~english @param None
+ /// \~english @retval TNodeList - list of all child node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the list of all the child nodes of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ TNodeList Children();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NextSibling
+ /// \~english @par Brief
+ /// Get next node
+ /// \~english @param None
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the next sibling node of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode NextSibling();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup PrevSibling
+ /// \~english @par Brief
+ /// Get previous node
+ /// \~english @param None
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the previous sibling node of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode PrevSibling();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FindChildNode
+ /// \~english @par Brief
+ /// Find child node
+ /// \~english @param [IN] f_cNodeName std::string - tag name of the node
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the first immediate sub node with matching node name
+ /// This function does not provide support to find node based on attribute value
+ /// Use FindNode() API of CXmlParser to find node based on XPath expression
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ CXmlNode FindChildNode(std::string f_cNodeName);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FindAllChildNodes
+ /// \~english @par Brief
+ /// Get list of all the immediate sub node
+ /// \~english @param [IN] f_cNodeName std::string - tag name of the node
+ /// \~english @retval TNodeList - list of matching nodes
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the list of all the immediate sub node matching tag as f_cNodeName.
+ /// This function does not provide support to find node based on attribute value.
+ /// Use FindNode() API of CXmlParser to find node based on XPath expression.
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ TNodeList FindAllChildNodes(std::string f_cNodeName);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetContentOfChildNode
+ /// \~english @par Brief
+ /// Find first level node
+ /// \~english @param [IN] f_cNodeName
+ /// std::string - name of the node
+ /// \~english @param [OUT] f_cContent
+ /// std::string& - content of the node
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusFail Failed
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Find the first level sub node matching tag as f_cNodeName
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus GetContentOfChildNode(std::string f_cNodeName, std::string &f_cContent); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup AddChildNode
+ /// \~english @par Brief
+ /// Add sub node
+ /// \~english @param [IN] f_cNodeName
+ /// std::string - tag of the new node
+ /// \~english @param [IN] f_cText
+ /// std::string - content of the new node
+ /// \~english @retval CXmlNode - object of child node
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Add sub node to the current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode AddChildNode(std::string f_cNodeName, std::string f_cText = "");
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup AddSiblingNode
+ /// \~english @par Brief
+ /// Add new node to siblings
+ /// \~english @param [IN] f_cNodeName
+ /// std::string - tag of the new node
+ /// \~english @param [IN] f_cText
+ /// std::string - content of the new node
+ /// \~english @retval CXmlNode - object of sibling node
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Add a new node to the list of siblings of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode AddSiblingNode(std::string f_cNodeName, std::string f_cText = "");
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RemoveChildNode
+ /// \~english @par Brief
+ /// Remove child node
+ /// \~english @param [IN] f_cNodeName
+ /// std::string - name of child node
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Remove the child node from current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus RemoveChildNode(std::string f_cNodeName);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ClearNode
+ /// \~english @par Brief
+ /// Removes elements and attributes
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// This function removes all sub elements, clears all attributes,
+ /// and sets the text and tail attributes to None
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearNode();
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CXmlNode
+ /// Constructor of CXmlNode class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CXmlNode();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CXmlNode
+ /// Parameterized constructor of CXmlNode class
+ ///
+ /// \param f_pXmlNodePtr
+ /// xmlNodePtr - pointer of an xml node
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CXmlNode(xmlNodePtr f_pXmlNodePtr); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetXmlNodePtr
+ /// Sets the xmlNodePtr
+ ///
+ /// \param f_pXmlNodePtr
+ /// xmlNodePtr - pointer of an xml node
+ ///
+ /// \return VOID
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetXmlNodePtr(xmlNodePtr f_pXmlNodePtr);
+
+ // pointer to xml node
+ xmlNodePtr m_pXmlNodePtr;
+};
+
+
+/**
+ * @class CXmlAttr
+ * \~english @brief This class represents the attribute of an xml node.
+ * \~english @par Brief Introduction
+ * This class represents the attribute of an xml node.
+ *
+ */
+class CXmlAttr {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlAttr
+ /// \~english @par Brief
+ /// CXmlAttr constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parameterized constructor of CXmlAttr class
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ CXmlAttr();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlAttr
+ /// \~english @par Brief
+ /// CXmlAttr constructor
+ /// \~english @param [IN] f_cKey
+ /// std::string - attributes key
+ /// \~english @param [IN] f_cValue
+ /// std::string - attributes value
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parameterized constructor of CXmlAttr class
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ CXmlAttr(std::string f_cKey, std::string f_cValue);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlAttr
+ /// \~english @par Brief
+ /// Destructor of CXmlAttr class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Inside state change
+ /// - None
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Destructor of CXmlAttr class
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ ~CXmlAttr();
+
+ // atrribute key
+ std::string m_cKey;
+
+ // atrribute value
+ std::string m_cValue;
+};
+
+/**
+ * @class CXmlParser
+ * \~english @brief This class represents the XML parser.
+ * \~english @par Brief Introduction
+ * Provides API for parsing xml file. Also provides API to search node/nodes based on Xml Path
+ *
+ */
+class CXmlParser {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlParser
+ /// \~english @par Brief
+ /// CXmlParser constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Constructor of CXmlParser class
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ CXmlParser();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlParser
+ /// \~english @par Brief
+ /// Destructor of CXmlParser class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Destructor of CXmlParser class
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+ ~CXmlParser();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseXml
+ /// \~english @par Brief
+ /// Parses xml file
+ /// \~english @param [IN] f_cFileName
+ /// std::string - full path of xml file to be parsed
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parses the xml file and creates a document structure
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus ParseXml(std::string f_cFileName);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateNewXmlDoc
+ /// \~english @par Brief
+ /// Creates new xml
+ /// \~english @param [IN] f_cRootNodeName
+ /// std::string - root node name in new doc
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Create a new xml document
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus CreateNewXmlDoc(std::string f_cRootNodeName);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SaveXml
+ /// \~english @par Brief
+ /// Save XML file
+ /// \~english @param [IN] f_cFileName
+ /// std::string - full path of output xml file
+ /// In case of parsing an xml file,
+ /// if f_cFileName is empty, output will be saved in source xml file
+ /// else output will be saved in user provided file path
+ /// In case of creating new xml document,
+ /// if f_cFileName is empty, returns error
+ /// else output will be saved in user provided file path
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Save the updated structure to the XML file
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SaveXml(std::string f_cFileName = "");
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetRootNode
+ /// \~english @par Brief
+ /// Get root node
+ /// \~english @param None
+ /// \~english @retval CXmlNode - root node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the root node object
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode GetRootNode();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup AddNewNode
+ /// \~english @par Brief
+ /// Create and add node
+ /// \~english @param [IN] f_pParentNode
+ /// CXmlNode - parent node
+ /// \~english @param [IN] f_cNewNodeName
+ /// std::string - tag name of the new node
+ /// \~english @param [IN] f_cContent
+ /// std::string - text to set for the new node
+ /// \~english @retval CXmlNode - new node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Create new node and add it to the parent node
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode AddNewNode(CXmlNode m_pParentNode, std::string f_cNewNodeName, std::string f_cContent = "");
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RemoveNode
+ /// \~english @par Brief
+ /// Remove node
+ /// \~english @param [IN] f_pNode
+ /// CXmlNode - node object
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Remove the node from the xml
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus RemoveNode(CXmlNode m_pNode);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FindNode
+ /// \~english @par Brief
+ /// Find first matching node
+ /// \~english @param [IN] f_cNodePath
+ /// std::string - name or path of node(XPath) path is relative to current node or absolute path
+ /// \~english @param [IN] f_pCurrentNode
+ /// CXmlNode - current node
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Find the first matching node, by tag name or path relative to current node path or
+ /// absolute path. Here the path is XPath expression
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ CXmlNode FindNode(std::string f_cNodePath, CXmlNode f_pCurrentNode);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FindAllNodes
+ /// \~english @par Brief
+ /// Find all matching node
+ /// \~english @param [IN] f_cNodePath
+ /// std::string - name or path of node(XPath) path is relative to current node or absolute path
+ /// \~english @param [IN] f_pCurrentNode
+ /// CXmlNode - current node
+ /// \~english @retval TNodeList - list of matching nodes
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Find all the matching node, by tag name or path relative to current node path or
+ /// absolute path.
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ TNodeList FindAllNodes(std::string f_cNodePath, CXmlNode f_pCurrentNode);
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNodeSet
+ /// Gets the node set resulting from search of nodepath using XPath
+ ///
+ /// \param f_cNodePath
+ /// std::string - name or path of node
+ /// path is relative to current node or absolute path
+ /// \param f_pCurrentNode
+ /// CXmlNode - current node
+ ///
+ /// \return xmlXPathObjectPtr
+ /// xmlXPathObjectPtr - returns the xpath object pointer containing nodes pointer
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ xmlXPathObjectPtr GetNodeSet(std::string f_cNodePath, CXmlNode f_pCurrentNode);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsReadable
+ /// Checks whether the file exists or not
+ ///
+ /// \param
+ ///
+ /// \return VOID
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsReadable(const std::string &filename);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ClearDocument
+ /// Clears the document structure and resets the root node
+ ///
+ /// \param
+ ///
+ /// \return VOID
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ClearDocument();
+
+ // pointer to structure created from xml after parsing
+ xmlDocPtr m_pXmlDoc;
+
+ // stores the name/path of source xml file
+ std::string m_cFileName;
+
+ // pointer to the root node of xml structure
+ CXmlNode m_pRootNode;
+};
+
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NS_XMLPARSER_INC_NS_XMLPARSER_IF_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/nsfw_message.h b/nsframework/framework_unified/client/include/native_service/nsfw_message.h
new file mode 100755
index 0000000..b5872c5
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/nsfw_message.h
@@ -0,0 +1,65 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file nsfw_message.h
+ * @brief \~english The file definition of NSFW message for NSFW independent module reference
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup utility
+ * @ingroup framework_unified
+ * @{
+ */
+/*
+ * The definition of NSFW message for NSFW independent module reference.
+ *
+ */
+//@{
+#ifndef _nsfw_message_h_ // NOLINT (build/header_guard)
+#define _nsfw_message_h_
+
+/*
+ * The following definitions are defined only for NSFW to check consistency.
+ * NOT TO BE USED IN ANY WAY.
+ */
+#define _NSFW_MSG_LEN_ (40)
+#define _NSFW_SYSINFO_FLAG_ (4)
+#define _NSFW_SYSINFO_SIZE_ (64)
+
+/*
+ * The following definitions are published definitions.
+ */
+#define NSFW_GET_MESSAGE(msg) \
+ ((*((unsigned int *)msg) & _NSFW_SYSINFO_FLAG_) ? \
+ ((unsigned char *)msg) + _NSFW_MSG_LEN_ + _NSFW_SYSINFO_SIZE_ : \
+ ((unsigned char *)msg) + _NSFW_MSG_LEN_)
+
+#endif // _nsfw_message_h_ // NOLINT (build/header_guard)
+//@}
+/**@}*/ // end of utility
+/**@}*/ // end of framework_unified
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
diff --git a/nsframework/framework_unified/client/include/native_service/nslogutil_cmd_if.h b/nsframework/framework_unified/client/include/native_service/nslogutil_cmd_if.h
new file mode 100755
index 0000000..90f03b7
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/nslogutil_cmd_if.h
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file
+/// Declares COMMANDS related to Log Utility
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file
+ * @brief \~english Declares COMMANDS related to Log Utility
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup utility
+ * @ingroup framework_unified
+ * @{
+ */
+
+#ifndef COMMANDS_H_ // NOLINT (build/header_guard)
+#define COMMANDS_H_
+
+// Notifications
+#define NTFY_LOGGER_SETCONTROLMASK "LoggerService/SetControlMask"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief Logger Utility Commands
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _COMMANDS {
+ SET_LOG_MASK = 0xAEA, // < Sets the NS log mask for a process. uses CHANGELOGPARAMS
+ GET_LOG_MASK, // < Gets the NS log mask for a process. uses CHANGELOGPARAMS
+ SET_LOG_OUT_OPT, // < Sets the NS log output option mask for a process. uses CHANGELOGPARAMS
+ GET_LOG_OUT_OPT, // < Gets the NS log output option mask for a process. uses CHANGELOGPARAMS
+ GET_LOG_MASK_RESPONSE, // < Get the response about NS log masks
+ GET_LOG_OUT_OPT_RESPONSE, // < Get the response about NS log output options
+ SET_MSGTX_RX_ON_AND_TX_OFF, // < Sets TransmissionLogger to receive ON, transmit OFF
+ SET_MSGTX_RX_OFF_AND_TX_ON, // < Sets TransmissionLogger to receive OFF, transmit ON
+ SET_MSGTX_RX_AND_TX_ON, // < Sets TransmissionLogger to receive ON, transmit ON
+ SET_MSGTX_RX_AND_TX_OFF, // < Sets TransmissionLogger to receive OFF, transmit OFF
+ kDebugDumpRequest, // < Sets a debug dump log to the debug dump queue
+ SET_LOG_SEVERITY, // < Sets the NS severity log level
+ GET_LOG_SEVERITY, // < Gets the NS severity log level
+ GET_LOG_SEVERITY_RESPONSE, // < Get the response about NS serverity log level
+
+ // list of protocols provided for rcs logger plugin
+ NSRCS_SET_LOG_SETTINGS_REQ, // < Set the NS RCS log setting request
+ NSRCS_SET_LOG_SETTINGS_RESP, // < Set the NS RCS log setting response
+ NSRCS_GET_LOG_SETTINGS_REQ, // < Get the NS RCS log setting request
+ NSRCS_GET_LOG_SETTINGS_RESP, // < Get the NS RCS log setting response
+ NSRCS_SET_LOG_MASK_REQ, // < Set the NS RCS log mask request
+ NSRCS_SET_LOG_MASK_RESP, // < Get the NS RCS log mask response
+ NSRCS_SET_LOG_OUT_OPT_REQ, // < Set the NS RCS log output option request
+ NSRCS_SET_LOG_OUT_OPT_RESP, // < Set the NS RCS log output option response
+ NSRCS_SET_LOG_SEVERITY_REQ, // < Set the NS RCS severity log level request
+ NSRCS_SET_LOG_SEVERITY_RESP, // < Set the NS RCS severity log level response
+} COMMANDS;
+
+#endif /* COMMANDS_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/native_service/wpf_legacy.h b/nsframework/framework_unified/client/include/native_service/wpf_legacy.h
new file mode 100755
index 0000000..7553f91
--- /dev/null
+++ b/nsframework/framework_unified/client/include/native_service/wpf_legacy.h
@@ -0,0 +1,152 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english This file define primary types to use
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __WPF_LEGACY_H__ // NOLINT (build/header_guard)
+#define __WPF_LEGACY_H__
+
+// these are legacy definitions.
+// these were defined at Windows_Def.h ... in the past.
+// if you make new code , you should not use these.
+// you should use definitions in frameworkunified_types.h.
+
+#include <native_service/frameworkunified_types.h>
+
+
+// Windows_Def.h
+#define CALLBACK
+#define INVALID_HANDLE_VALUE ((void*)(-1))
+#define INFINITE 0xFFFFFFFF
+
+typedef int INT;
+typedef unsigned int UINT;
+typedef unsigned int *PUINT;
+#define VOID void
+typedef char CHAR;
+typedef short SHORT; // NOLINT (readability/nolint)
+typedef long LONG; // NOLINT (readability/nolint)
+typedef SHORT *PSHORT;
+typedef LONG *PLONG;
+typedef unsigned long ULONG; // NOLINT (readability/nolint)
+typedef ULONG *PULONG;
+typedef unsigned short USHORT; // NOLINT (readability/nolint)
+typedef USHORT *PUSHORT;
+typedef unsigned char UCHAR;
+typedef UCHAR *PUCHAR;
+typedef unsigned long DWORD; // NOLINT (readability/nolint)
+// defined in kernelmoduleevklibdd.h typedef int BOOL;
+typedef unsigned char BYTE;
+typedef unsigned short WORD; // NOLINT (readability/nolint)
+typedef float FLOAT;
+typedef FLOAT *PFLOAT;
+typedef BOOL *PBOOL;
+typedef BOOL *LPBOOL;
+typedef BYTE *PBYTE;
+typedef BYTE *LPBYTE;
+typedef int *PINT;
+typedef int *LPINT;
+typedef WORD *PWORD;
+typedef WORD *LPWORD;
+typedef long *LPLONG; // NOLINT (readability/nolint)
+typedef DWORD *PDWORD;
+typedef DWORD *LPDWORD;
+typedef void *PVOID;
+typedef void *LPVOID;
+typedef const void *LPCVOID;
+typedef wchar_t WCHAR;
+typedef size_t SIZE_T;
+typedef DWORD COLORREF;
+typedef DWORD *LPCOLORREF;
+typedef CHAR *PCHAR, *LPCH, *PCH;
+typedef CONST CHAR *LPCCH, *PCCH;
+typedef CHAR *NPSTR, *LPSTR, *PSTR;
+typedef PSTR *PZPSTR;
+typedef CONST PSTR *PCZPSTR;
+typedef CONST CHAR *LPCSTR, *PCSTR;
+typedef PCSTR *PZPCSTR;
+typedef void *HGDIOBJ;
+typedef int INT_PTR, *PINT_PTR;
+typedef unsigned int UINT_PTR, *PUINT_PTR;
+typedef long LONG_PTR, *PLONG_PTR; // NOLINT (readability/nolint)
+typedef unsigned long ULONG_PTR, *PULONG_PTR; // NOLINT (readability/nolint)
+typedef unsigned long ULONGLONG; // NOLINT (readability/nolint)
+typedef char CCHAR;
+typedef DWORD LCID;
+typedef PDWORD PLCID;
+typedef WORD LANGID;
+typedef long LONGLONG; // NOLINT (readability/nolint)
+typedef WORD ATOM;
+
+typedef pthread_mutex_t CRITICAL_SECTION;
+typedef CRITICAL_SECTION *LPCRITICAL_SECTION;
+
+#define __readableTo(extent)
+#define __nullterminated __readableTo(sentinel(0))
+
+typedef __nullterminated WCHAR *NWPSTR, *LPWSTR, *PWSTR;
+typedef __nullterminated PWSTR *PZPWSTR;
+typedef __nullterminated CONST PWSTR *PCZPWSTR;
+typedef __nullterminated CONST WCHAR *LPCWSTR, *PCWSTR;
+typedef __nullterminated PCWSTR *PZPCWSTR;
+
+#ifdef UNICODE
+#define wsprintf swprintf
+typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
+typedef LPWSTR PTSTR, LPTSTR;
+typedef LPCWSTR PCTSTR, LPCTSTR;
+#else /* UNICODE */
+#define wsprintf sprintf
+typedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR;
+typedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR;
+typedef WCHAR *LPWCH;
+typedef WCHAR *PWCHAR; // 110509 chg
+#endif /* UNICODE */
+
+#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
+
+typedef struct _SYSTEMTIME {
+ WORD wYear;
+ WORD wMonth;
+ WORD wDayOfWeek;
+ WORD wDay;
+ WORD wHour;
+ WORD wMinute;
+ WORD wSecond;
+ WORD wMilliseconds;
+} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
+
+#endif /* __WPF_LEGACY_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/framework_unified/client/include/ns__CWORD77__template.h b/nsframework/framework_unified/client/include/ns__CWORD77__template.h
new file mode 100755
index 0000000..e4069dd
--- /dev/null
+++ b/nsframework/framework_unified/client/include/ns__CWORD77__template.h
@@ -0,0 +1,60 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS__CWORD77__TEMPLATE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS__CWORD77__TEMPLATE_H_
+
+#include <iterator>
+#include <algorithm>
+
+/// Template for Map range transformation
+template< class OCont, class IIter, class MapFn >
+OCont mapRange(const IIter &begin, const IIter &end, MapFn fn) {
+ OCont c;
+ std::transform(begin, end, std::inserter(c, c.begin()), fn);
+ return c;
+}
+
+
+/// Template to get Array begining
+template< class T, UI_32 N >
+const T *ArrBeg(const T(&arr)[ N ]) {
+ return &arr[ 0 ];
+}
+
+/// Template to get Array ending
+template< class T, UI_32 N >
+const T *ArrEnd(const T(&arr)[ N ]) {
+ return &arr[ 0 ] + N;
+}
+
+/// Template to convert structure to Map
+template< class Cont, class T, class C, class TFn >
+const Cont GetMap(const T *mapTable, C N, TFn transform) {
+ return mapRange< Cont >(&mapTable[0], &mapTable[0] + N, transform);
+}
+
+ServiceResponseTableItem TransformServiceResponseTableIteminMap(const ServiceResponse &uch);
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS__CWORD77__TEMPLATE_H_
+//@}
diff --git a/nsframework/framework_unified/client/include/ns_logger_additional_if.h b/nsframework/framework_unified/client/include/ns_logger_additional_if.h
new file mode 100755
index 0000000..4d67e18
--- /dev/null
+++ b/nsframework/framework_unified/client/include/ns_logger_additional_if.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file
+/// Declares the external APIs to Logger.Include this header when you want to use FRAMEWORKUNIFIEDLOG_TEXT.
+/// \ingroup tag_NSLogger
+/// @{
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_LOGGER_ADDITIONAL_IF_H_
+#define FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_LOGGER_ADDITIONAL_IF_H_
+
+#include <native_service/ns_logger_if.h>
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_TEXT
+///////////////////////////////////////////////////////////////////////////////
+/// FRAMEWORKUNIFIEDLOG_TEXT macro will output the log without relationship to the ZONE.
+/// \note Developers should use the FRAMEWORKUNIFIEDLOG for logging.
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_TEXT(funcname, args...) TEXT_ZONE(BITS_IN_ZONE_MASK, funcname, ## args)
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_LOGGER_ADDITIONAL_IF_H_
+/// @}
diff --git a/nsframework/framework_unified/client/include/nsverutil_cmd_if.h b/nsframework/framework_unified/client/include/nsverutil_cmd_if.h
new file mode 100755
index 0000000..70705e8
--- /dev/null
+++ b/nsframework/framework_unified/client/include/nsverutil_cmd_if.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NSVERUTIL_CMD_IF_H_
+#define FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NSVERUTIL_CMD_IF_H_
+
+typedef enum _VERCOMMANDS {
+ GET_VERSION_RESPONSE = 0xBEB, /**< Version response from framework */
+ GET_VERSION /**< Version request to framework */
+} VERCOMMANDS;
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NSVERUTIL_CMD_IF_H_
diff --git a/nsframework/framework_unified/client/libNS_FrameworkUnified.ver b/nsframework/framework_unified/client/libNS_FrameworkUnified.ver
new file mode 100755
index 0000000..764c5bb
--- /dev/null
+++ b/nsframework/framework_unified/client/libNS_FrameworkUnified.ver
@@ -0,0 +1,144 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libNS_FrameworkUnified version script
+#
+{
+ global:
+ ### .text section ###
+ extern "C++" {
+ Frameworkunified*;
+ SetReqDataIn_CWORD77_DataPool*;
+ GetResp*;
+ SetResp*;
+ CalculateCRC32*;
+ ConvertEndian_*;
+ CFrameworkunifiedAction::*;
+ CFrameworkunifiedVersion::*;
+ operator*CFrameworkunifiedVersion*;
+ CNSSharedMem::*;
+ CNSSharedMemReader::*;
+ CNSRingBuffer::*;
+ CFrameworkunifiedLeafState::*;
+ CFrameworkunified_CWORD77_Service::*;
+ CFrameworkunified_CWORD77_Session::*;
+ CNSConfig*::*;
+ CFrameworkunifiedCompositeState::*;
+ CFrameworkunifiedOrthogonalState::*;
+ CFrameworkunifiedConditionConnector::*;
+ CFrameworkunifiedExternalTransition::*;
+ frameworkunified::framework::CFrameworkunifiedThreadPriorities::*;
+ CMutex::*;
+ CFrameworkunifiedHSM::*;
+ CRWLock::*;
+ NSTimer::*;
+ NsForceClose;
+ CFrameworkunifiedGuard::*;
+ CFrameworkunifiedState::*;
+ CFrameworkunifiedLocalTransition::*;
+ CFrameworkunifiedShallowHistoryState::*;
+ CFrameworkunifiedHistoryState::*;
+ CFrameworkunifiedDeepHistoryState::*;
+ CFrameworkunifiedHSMParentFramework::*;
+ CFrameworkunifiedSyncData::*;
+ IConfigWriter::*;
+ IConfigReader::*;
+ };
+ GetFileList;
+ MSToNS;
+ DoesDirecotryExist;
+ CreateDirectory;
+ Mc*;
+ NP*;
+ NSLog*;
+ NsLogIsPLogEnabled;
+ NsLogData;
+ NsLogTime;
+ NsLog0;
+ NsLog;
+ NsLogSetFrameworkunifiedLogParams;
+ NsLogSetProcessName;
+ NsLogSetControlMask;
+ NsLogIsZoneSet;
+ NsLogGetControlMask;
+ NsLogSetLogMethod;
+ NsLog_EvtCnt;
+ NsLog_Evt;
+ NsLog_Cnt;
+ NsLogDetermineLogMethod;
+ NsLogSetZones;
+ NsLogParseZones;
+ NsRcsSendTraceData;
+ NSLogGetFrameworkunifiedlogFileTotalNum;
+ NSLogGetFrameworkunifiedlogFileName;
+ NsLogGetLogMethod;
+ NsLogSetFrameworkunifiedLogFlag;
+ NsLogGetFrameworkunifiedLogFlag;
+ NsLogSetRealtimeLog;
+ NsLogGetRealtimeLog;
+ NsLogInitialize;
+ NS_Timer*;
+ OpenReceiver;
+ OpenReceiverNotBlocked;
+ CloseSender;
+ CloseReceiver;
+ OpenSender;
+ ReceiveMessage;
+ RemainderMs;
+ SendMessage;
+ SynchronousWritePersistentData;
+ SynchronousMovePersistentData;
+ WholeSeconds;
+ _init;
+ _fini;
+ GetLengthOfDataFromShared;
+
+ ### .data section ###
+ extern "C++" {
+ typeinfo?for?CFrameworkunifiedAction;
+ typeinfo?for?CFrameworkunifiedVersion;
+ typeinfo?for?CNSSharedMem;
+ typeinfo?for?CNSSharedMemReader;
+ typeinfo?for?CNSRingBuffer;
+ typeinfo?for?CFrameworkunifiedLeafState;
+ typeinfo?for?CFrameworkunified_CWORD77_Service;
+ typeinfo?for?CFrameworkunified_CWORD77_Session;
+ typeinfo?for?CNSConfig*;
+ typeinfo?for?CFrameworkunifiedCompositeState;
+ typeinfo?for?CFrameworkunifiedOrthogonalState;
+ typeinfo?for?CFrameworkunifiedConditionConnector;
+ typeinfo?for?CFrameworkunifiedExternalTransition;
+ typeinfo?for?frameworkunified::framework::CFrameworkunifiedThreadPriorities;
+ typeinfo?for?CMutex;
+ typeinfo?for?CFrameworkunifiedHSM;
+ typeinfo?for?CRWLock;
+ typeinfo?for?NSTimer;
+ typeinfo?for?CFrameworkunifiedGuard;
+ typeinfo?for?CFrameworkunifiedState;
+ typeinfo?for?CFrameworkunifiedLocalTransition;
+ typeinfo?for?CFrameworkunifiedShallowHistoryState;
+ typeinfo?for?CFrameworkunifiedHistoryState;
+ typeinfo?for?CFrameworkunifiedDeepHistoryState;
+ typeinfo?for?CFrameworkunifiedHSMParentFramework;
+ typeinfo?for?CFrameworkunifiedSyncData;
+ typeinfo?for?IConfigWriter;
+ typeinfo?for?IConfigReader;
+ };
+ local:
+ *;
+};
+
diff --git a/nsframework/log_library/LICENSE b/nsframework/log_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/nsframework/log_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/nsframework/log_library/Makefile.client b/nsframework/log_library/Makefile.client
new file mode 100755
index 0000000..fb995b3
--- /dev/null
+++ b/nsframework/log_library/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS = client
+
+include ../native_service.mk
diff --git a/nsframework/log_library/client/Makefile b/nsframework/log_library/client/Makefile
new file mode 100755
index 0000000..2427927
--- /dev/null
+++ b/nsframework/log_library/client/Makefile
@@ -0,0 +1,32 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### libraries to be installed(*.a) #############
+INST_SHLIBS = liblog
+######### headers to be installed(*.h) #############
+INST_HEADERS := loglibrarylog_library.h loglibrarylog_if.h
+
+######### sources to be compiled #############
+liblog_SRCS := loglibrarylog.c
+
+######### search paths #############
+VPATH = ./src ./include/$(COMPONENT_NAME)
+
+######### include paths #############
+CFLAGS += -I./include
+LDFLAGS += -Wl,--no-as-needed
+
+include ../../native_service.mk
diff --git a/nsframework/log_library/client/include/loglibrarylog_internal.h b/nsframework/log_library/client/include/loglibrarylog_internal.h
new file mode 100755
index 0000000..af6e7cf
--- /dev/null
+++ b/nsframework/log_library/client/include/loglibrarylog_internal.h
@@ -0,0 +1,26 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@{
+
+#ifndef LOG_LIBRARY_CLIENT_INCLUDE_LOGLIBRARYLOG_INTERNAL_H_
+#define LOG_LIBRARY_CLIENT_INCLUDE_LOGLIBRARYLOG_INTERNAL_H_
+
+// Prototype
+int LOGLIBRARYLOG_Freeze(void);
+
+#endif // LOG_LIBRARY_CLIENT_INCLUDE_LOGLIBRARYLOG_INTERNAL_H_
+//@}
diff --git a/nsframework/log_library/client/include/native_service/loglibrarylog_if.h b/nsframework/log_library/client/include/native_service/loglibrarylog_if.h
new file mode 100755
index 0000000..5bf90c3
--- /dev/null
+++ b/nsframework/log_library/client/include/native_service/loglibrarylog_if.h
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english This file contains defines and LOGLIBRARYLOG_Freeze API for free frameworkunifiedlog.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup log_library
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __LOGLIBRARYLOG_IF_H__ // NOLINT (readability/nolint)
+#define __LOGLIBRARYLOG_IF_H__
+
+#define FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME "loglibrarylogconfig.cfg"
+#define FRAMEWORKUNIFIEDLOG_RAMDISC_NAME "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/frameworkunified_debug.log"
+#define FRAMEWORKUNIFIEDLOG_RAMDISC_PATH "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog"
+
+// Out put mode
+#define FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG 1 // Debug
+#define FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE 0 // :Release
+
+// RealtimeLog mode
+#define LOGLIBRARYLOG_REALTIMELOG_DISABLE_MASK 0x80
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE 0xFF // : FREEZE
+
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF 0 // :ALL OFF
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART 1 // :UARTOUT
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB 2 // :USB OUT
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE \
+ (FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB | LOGLIBRARYLOG_REALTIMELOG_DISABLE_MASK)
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_MAX 3 // :MAX NUM
+
+//////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup LOGLIBRARYLOG_Freeze
+/// \~english @par Brief
+/// Freeze Loglibrarylog API.
+/// \~english @retval 0: success
+/// \~english @retval -1: error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// This API is provide to freeze Loglibrarylog.
+/// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+int LOGLIBRARYLOG_Freeze(void);
+
+#endif // __LOGLIBRARYLOG_IF_H__ // NOLINT (readability/nolint)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/log_library/client/include/native_service/loglibrarylog_library.h b/nsframework/log_library/client/include/native_service/loglibrarylog_library.h
new file mode 100755
index 0000000..60edd01
--- /dev/null
+++ b/nsframework/log_library/client/include/native_service/loglibrarylog_library.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english include all log_library head files
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup log_library
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef NATIVESERVICE_LOGLIBRARY_H_ // NOLINT(build/header_guard)
+#define NATIVESERVICE_LOGLIBRARY_H_
+
+#include <native_service/loglibrarylog_if.h>
+
+#endif // NATIVESERVICE_LOGLIBRARY_H_
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/nsframework/log_library/client/src/loglibrarylog.c b/nsframework/log_library/client/src/loglibrarylog.c
new file mode 100755
index 0000000..7aa7c2b
--- /dev/null
+++ b/nsframework/log_library/client/src/loglibrarylog.c
@@ -0,0 +1,60 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <native_service/loglibrarylog_if.h>
+#include "loglibrarylog_internal.h"
+
+int
+LOGLIBRARYLOG_Freeze(void) {
+ int fd;
+ int *pmap;
+ int ret;
+
+ fd = shm_open(FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, O_RDWR | O_CREAT, S_IRWXU | S_IRWXO);
+ if (fd == -1) {
+ fprintf(stderr, "[%s:L%d]shm_open(%s) error(%d)\n", __FUNCTION__, __LINE__,
+ FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, errno);
+ return -1;
+ }
+
+ ret = ftruncate(fd, sizeof(int));
+ if (ret == 0) {
+ fprintf(stderr, "[%s:L%d]ftruncate() error(%d)\n", __FUNCTION__, __LINE__, ret);
+ close(fd);
+ return -1;
+ }
+
+ pmap = mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ close(fd);
+ if (pmap == MAP_FAILED) {
+ fprintf(stderr, "[%s:L%d]mmap() error(%d)\n", __FUNCTION__, __LINE__, errno);
+ return -1;
+ }
+ *pmap = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE;
+
+ if (munmap(pmap, sizeof(int)) != 0) {
+ fprintf(stderr, "[%s:L%d]munmap() error(%d)\n", __FUNCTION__, __LINE__, errno);
+ }
+
+ return 0;
+}
diff --git a/nsframework/native_service.mk b/nsframework/native_service.mk
new file mode 100755
index 0000000..729362c
--- /dev/null
+++ b/nsframework/native_service.mk
@@ -0,0 +1,44 @@
+#############################################################
+#
+# Common Makefile for native_service
+# Copyright (C) 2017-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := native_service
+
+#############################################################
+
+
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/nsframework/notification_persistent_service/LICENSE b/nsframework/notification_persistent_service/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/nsframework/notification_persistent_service/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/nsframework/notification_persistent_service/Makefile.server b/nsframework/notification_persistent_service/Makefile.server
new file mode 100755
index 0000000..1347519
--- /dev/null
+++ b/nsframework/notification_persistent_service/Makefile.server
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := server
+
+include ../native_service.mk
diff --git a/nsframework/notification_persistent_service/server/Makefile b/nsframework/notification_persistent_service/server/Makefile
new file mode 100755
index 0000000..b5b80cb
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/Makefile
@@ -0,0 +1,87 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = NS_NPPService
+
+######### add source path #############
+VPATH += ./src
+VPATH += ./include/$(COMPONENT_NAME)
+
+######### installed library(*.a) #############
+#INST_LIBS =
+
+######### installed shared library(*.so) #############
+#INST_SHLIBS =
+
+######### install headers(*.h) #############
+INST_HEADERS = notification_persistent_service.h
+
+######### compiled sources #############
+NS_NPPService_SRCS = app_states.cpp \
+ ns_npp.cpp \
+ ns_npp_archive.cpp \
+ ns_npp_binary_accesser.cpp \
+ ns_npp_copy_worker.cpp \
+ ns_npp_fs_directory.cpp \
+ ns_npp_handlelist.cpp \
+ ns_npp_nor_persistence_worker_thread.cpp \
+ ns_npp_notification.cpp \
+ ns_npp_notification_manager.cpp \
+ ns_npp_notification_receiver.cpp \
+ ns_npp_persist_file.cpp \
+ ns_npp_persist_folder.cpp \
+ ns_npp_persistence.cpp \
+ ns_npp_persistence_manager.cpp \
+ ns_npp_persistent_data.cpp \
+ ns_npp_personalization_manager.cpp \
+ ns_npp_registry_entry.cpp \
+ ns_npp_regular_notification.cpp \
+ ns_npp_state_nor_persistence_notification.cpp \
+ ns_npp_state_notification.cpp \
+ ns_npp_state_persistence_notification.cpp \
+ ns_npp_state_persistence_user_notification.cpp \
+ notificationpersistentservice_application.cpp \
+ notificationpersistentservice_main.cpp
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+######### add compile option #############
+ENABLE_PARA_INST += install-prog # PARALLEL MAKE
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+######### linked library #############
+
+######### linked library (dynamic) #############
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -ltar
+LDLIBS += -Wl,-Bdynamic -lz
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy #-lPosixBasedOS001ClockCycleApi -lPosixBasedOS001MsgApi -lPosixBasedOS001GetPrioApi -lPosixBasedOS001TimeApi -lPosixBasedOS001SlogApi
+
+LINK_CXX=Y
+
+######### add library path #############
+
+include ../../native_service.mk
diff --git a/nsframework/notification_persistent_service/server/include/app_states.h b/nsframework/notification_persistent_service/server/include/app_states.h
new file mode 100755
index 0000000..a7f4b4a
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/app_states.h
@@ -0,0 +1,187 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file all the states, events, internal transitions of state machine.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_APP_STATES_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_APP_STATES_H_
+
+#include <native_service/frameworkunified_sm_framework_if.h>
+#include <native_service/ns_np_service.h>
+#include <string>
+
+const UI_32 kCuiEventIdStartLimit = 20;
+
+DEFINE_COMPOSITESTATE(sNotificationpersistentserviceNPPRoot) // NOLINT (readability/naming)
+DEFINE_ORTHOGONALSTATE_OVERRIDE(sNotificationpersistentserviceNPPStart)
+DEFINE_LEAFSTATE(sNotificationpersistentserviceNPPError)
+
+// =====Define Persistence state
+DEFINE_LEAFSTATE_OVERRIDE(sNotificationpersistentservicePersistenceReady)
+DEFINE_LEAFSTATE(sNotificationpersistentservicePersistenceError)
+
+// DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReadPersistedData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReleaseFileAck)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnSaveDataAck)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPNorDataSaveAck)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFile)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFile)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFile)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFolder)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFolder)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFolder)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFilePersistentType)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFolderPersistentType)
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnUserChange)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceCheckAllReleaseRequestsProcessed)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPersistentSync)
+
+// =====Define Shutdown state
+DEFINE_LEAFSTATE(sNotificationpersistentserviceShutdownIdle)
+// DEFINE_LEAFSTATE_OVERRIDE(sNotificationpersistentserviceShutdownDataSave)
+class CsNotificationpersistentserviceShutdownDataSave : public CFrameworkunifiedLeafState {
+ public:
+ explicit CsNotificationpersistentserviceShutdownDataSave(std::string f_pName);
+ virtual ~CsNotificationpersistentserviceShutdownDataSave();
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_peventdata);
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_peventdata);
+ private:
+ std::string m_cShutdownRequestor;
+};
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPShutdown) // NOLINT (readability/naming)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnShutdownTimeout)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceReInitShutdownTimer)
+
+// =====Define Notification state
+DEFINE_LEAFSTATE(sNotificationpersistentserviceNotificationReady)
+DEFINE_LEAFSTATE(sNotificationpersistentserviceNotificationError)
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishNotification)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotification)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnRegisterNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotification)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterImmediateNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPGetReadyStatus)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPClearPersistedData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetDefaultPersistentData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetNotfnPersistentType)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishImmediateNotification)
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfileNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfilePersistence)
+
+#endif
+
+// ==========Define event
+DEFINE_EVENT(evIdle, kCuiEventIdStartLimit + 1)
+DEFINE_EVENT(evReady, kCuiEventIdStartLimit + 2)
+DEFINE_EVENT(evShutdown, kCuiEventIdStartLimit + 3)
+DEFINE_EVENT(evError, kCuiEventIdStartLimit + 4)
+
+DEFINE_EVENT(evNPSetNotfnPersistentType, kCuiEventIdStartLimit + 5)
+DEFINE_EVENT(evNPSetDefaultPersistentData, kCuiEventIdStartLimit + 6)
+DEFINE_EVENT(evNPReadPersistedData, kCuiEventIdStartLimit + 7)
+DEFINE_EVENT(evNPReleaseLoadAck, kCuiEventIdStartLimit + 8)
+DEFINE_EVENT(evNPNorShutdownAck, kCuiEventIdStartLimit + 9)
+DEFINE_EVENT(evNPRegisterPersistentFile, kCuiEventIdStartLimit + 10)
+DEFINE_EVENT(evNPReleasePersistentFile, kCuiEventIdStartLimit + 11)
+DEFINE_EVENT(evNPLoadPersistentFile, kCuiEventIdStartLimit + 12)
+DEFINE_EVENT(evNPSetFilePersistentType, kCuiEventIdStartLimit + 13)
+DEFINE_EVENT(evNPSetFolderPersistentType, kCuiEventIdStartLimit + 14)
+DEFINE_EVENT(evUserChange, kCuiEventIdStartLimit + 15)
+DEFINE_EVENT(evShutdownTimeout, kCuiEventIdStartLimit + 16)
+
+DEFINE_EVENT(evNPPublishNotification, kCuiEventIdStartLimit + 17)
+DEFINE_EVENT(evNPRegisterNotifications, kCuiEventIdStartLimit + 18)
+DEFINE_EVENT(evNPSubscribeToNotification, kCuiEventIdStartLimit + 19)
+DEFINE_EVENT(evNPSubscribeToNotifications, kCuiEventIdStartLimit + 20)
+DEFINE_EVENT(evNPUnRegisterNotifications, kCuiEventIdStartLimit + 21)
+DEFINE_EVENT(evNPUnSubscribeFromNotification, kCuiEventIdStartLimit + 22)
+DEFINE_EVENT(evNPRegisterPersistentFolder, kCuiEventIdStartLimit + 23)
+DEFINE_EVENT(evNPLoadPersistentFolder, kCuiEventIdStartLimit + 24)
+DEFINE_EVENT(evNPReleasePersistentFolder, kCuiEventIdStartLimit + 25)
+DEFINE_EVENT(evNPUnSubscribeFromNotifications, kCuiEventIdStartLimit + 26)
+DEFINE_EVENT(evCheckAllFilesPersisted, kCuiEventIdStartLimit + 27)
+DEFINE_EVENT(evNPGetReadyStatus, kCuiEventIdStartLimit + 28)
+DEFINE_EVENT(evNPRegisterImmediateNotifications, kCuiEventIdStartLimit + 29)
+DEFINE_EVENT(evNPClearPersistedData, kCuiEventIdStartLimit + 30)
+
+DEFINE_EVENT(evNPShutdownDataSave, kCuiEventIdStartLimit + 31)
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+DEFINE_EVENT(evNPProfileNotification, kCuiEventIdStartLimit + 32)
+DEFINE_EVENT(evNPProfilePersistence, kCuiEventIdStartLimit + 33)
+
+#endif
+
+DEFINE_EVENT(evNPPublishImmediateNotification, kCuiEventIdStartLimit + 34)
+DEFINE_EVENT(evNPPersistentSync, kCuiEventIdStartLimit + 35)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersonality
+/// Set the personality in the framework on userchange.
+///
+/// \param [IN] f_happ
+/// HANDLE - Application Handle
+///
+/// \param [IN] f_tMsg
+/// NC_User - Structure containing user specific details
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetPersonality(HANDLE f_happ, NC_User &f_tMsg); // NOLINT (runtime/references)
+
+
+/*
+ * CShutDownMsgData
+ * This class is used to pass the data between states sShutdownIdle and sShutdownDataSave
+ */
+class CShutDownMsgData : public CEventData {
+ public:
+ // constructor
+ CShutDownMsgData(UI_32 f_uieventid, EFrameworkunifiedShutdownType f_etype, UI_32 f_uidata): CEventData(f_uieventid),
+ m_eShutdownType(f_etype), m_uiMsgData(f_uidata) {} // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ // destructor
+ virtual ~CShutDownMsgData() {}
+
+ EFrameworkunifiedShutdownType m_eShutdownType;
+
+ UI_32 m_uiMsgData;
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_APP_STATES_H_
diff --git a/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h b/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h
new file mode 100755
index 0000000..a7c9f8e
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file notification_persistent_service.h
+ * @brief \~english include all notification_persistent_service head files
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef NATIVESERVICE_NOTIFICATIONPERSISTENTSERVICE_H_ // NOLINT(build/header_guard)
+#define NATIVESERVICE_NOTIFICATIONPERSISTENTSERVICE_H_
+
+#endif // NATIVESERVICE_NOTIFICATIONPERSISTENTSERVICE_H_
+
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp.h b/nsframework/notification_persistent_service/server/include/ns_npp.h
new file mode 100755
index 0000000..f96dd75
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp.h
@@ -0,0 +1,296 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_H_
+
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+
+class CPersistenceManager;
+class CNotificationManager;
+class CnotificationpersistentservicePersonalizationManager;
+
+/**
+ * This class act as a controller class which holds the instance of notification, personalization
+ * and persistence manager respectively.
+ */
+class CNSNPP: public CFrameworkunifiedHSM {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSNPP
+ /// Constructor of CNSNPP class
+ ///
+ /// \param f_happ
+ /// PVOID - application handle
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CNSNPP(PVOID f_happ);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNSNPP
+ /// Destructor of CNSNPP class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSNPP();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// Init
+ /// This function is used to allocate dynamic memory for member variables of this class after
+ /// creation of object.
+ ///
+ /// \param f_happ
+ /// HANDLE - Application handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Init(HANDLE f_happ);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// DeInit
+ /// This function is used to deinitialize the NPP object.
+ ///
+ /// \param f_happ
+ /// HANDLE - Application handle
+ ///
+ /// \return VOID
+ /// VOID - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID DeInit(HANDLE f_happ);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedCreate
+ /// This function is pure virtual function of parent class.
+ /// In this function, states and events of StateMachine are created and connected.
+ ///
+ /// \param [in] f_peventdata
+ /// PVOID - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_peventdata = NULL);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentservicePersistAll
+ /// Persist all persistent state, user persistent state notification data;
+ /// and all global and user related files to permenant storage
+ ///
+ /// \param [in] f_eshutdowntype
+ /// EFrameworkunifiedShutdownType - shutdown type i.e. normal shutdown, quick, data reset
+ ///
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentservicePersistAll(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSaveNotificationPersistentData
+ /// In this function, all the data related to persistent notification is retrieved from
+ /// notification manager and stored in persistent file by persistent manager.
+ ///
+ /// \param [in] f_epersistenttype
+ /// EFrameworkunifiedPersistentVarType - Type of persistent notification
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSaveNotificationPersistentData(EFrameworkunifiedNotificationType f_epersistenttype,
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag = 0x0);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceLoadPersistentNotificationData
+ /// In this transition, persistent file is loaded by persistent manager and
+ /// persistent notifications and its data is loaded to notification manager.
+ ///
+ /// \param [in] f_epersistenttype
+ /// EFrameworkunifiedPersistentVarType - Type of persistent notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceLoadPersistentNotificationData(EFrameworkunifiedNotificationType f_epersistenttype);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// DeletePersistedDataFolder
+ /// This function does not deletes the data instead just rename the folder which needs to
+ /// be deleted. And this data will gets deleted during next startup.
+ ///
+ /// \param f_uipersistcategoryflag
+ /// UI_32 - Rename the persisted data folder depending on enum EFrameworkunifiedPersistCategory value
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DeletePersistedDataFolder(UI_32 f_uipersistcategoryflag);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// Syncfs
+ /// Syncfs is carried out.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Syncfs();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Singleton instance of NotificationManager
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationManager *m_pNotificationManager; ///< Instance of Notification Manager
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Singleton instance of PersonalizationManager
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CnotificationpersistentservicePersonalizationManager *m_pPersonalizationManager; ///< Instance of Personalization Manager
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Singleton instance of PersistenceManager
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistenceManager *m_pPersistenceManager;
+ // scheduling priority of read thread
+ static SI_32 m_siReadThreadPrio; // NOLINT (readability/naming)
+ // scheduling priority of write thread
+ static SI_32 m_siWriteThreadPrio; // NOLINT (readability/naming)
+ // scheduling priority of immediate persistence thread
+ static SI_32 m_siImmediatePersistenceThreadPrio; // NOLINT (readability/naming)
+ // number of times CRC check is required. (CRC check will be done more than once only on failure)
+ static UI_16
+ m_siCRCCheckCount; // NOLINT (readability/naming)
+
+ private:
+ ///< name of reader thread
+ const std::string m_cReadThreadName; // NOLINT (readability/naming)
+ ///< name of writer thread
+ const std::string m_cWriteThreadName; // NOLINT (readability/naming)
+ ///< name of immediate persistence thread
+ const std::string m_cImmediatePersistenceThreadName; // NOLINT (readability/naming)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateAndStartChildThreads
+ /// This function creates and start all child threads.
+ ///
+ /// \param f_happ
+ /// HANDLE - Application handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateAndStartChildThreads(HANDLE f_happ);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SwitchToFileStructureVersion1
+ /// Copy all the data from old persistent path to new persistent path
+ ///
+ /// \param [IN] f_uinppversion
+ /// UI_32 - New version of NPPService
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SwitchToFileStructureVersion1(const UI_32 f_uinppversion);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SwitchToFileStructureVersion2
+ /// Move immediate notification data files from IMMEDIATE_PERSISTENCE_STORAGE_V1 to
+ /// IMMEDIATE_PERSISTENCE_STORAGE_V2/AllUserAppData/UserData
+ ///
+ /// \param [IN] f_uinppversion
+ /// UI_32 - New version of NPPService
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SwitchToFileStructureVersion2(const UI_32 f_uinppversion);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNSNPPVersion
+ /// Get the version of NSNPP from version.txt
+ ///
+ /// \param
+ ///
+ /// \return UI_8
+ /// UI_8 - version number
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetNSNPPVersion();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SetNSNPPVersion
+ /// Set the version of NSNPP in version.txt
+ ///
+ /// \param [IN] f_uiversion
+ /// UI_32 - version number
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetNSNPPVersion(UI_8 f_uiversion);
+
+ HANDLE m_hNSReadThread; ///< Reader thread handle
+
+ HANDLE m_hNSWriteThread; ///< Writer thread handle
+
+ HANDLE m_hNSImmediatePersistenceThread; ///< immediate persistence thread handle
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h b/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h
new file mode 100755
index 0000000..aed4d2a
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h
@@ -0,0 +1,230 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CBinaryAccesser class.
+/// This class stores data in a file in binary format.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_BINARY_ACCESSER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_BINARY_ACCESSER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <vector>
+#include "ns_npp_persistent_accesser.h"
+
+class CPersistentAccesser;
+class CPersistentData;
+class CNotificationsToPersist;
+class CPersistDataHeader;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// vector of all available persistent notification and its data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+typedef Persistent_Notification_List_Type::iterator Persistent_Notification_List_Iterator;
+
+/**
+ * This class stores data in a file in binary format.
+ *
+ */
+class CBinaryAccesser: public CPersistentAccesser {
+ public:
+ typedef enum FileOpentype {
+ EREAD = 0,
+ EWRITE
+ } FILE_OPEN_TYPE;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CBinaryAccesser
+ /// Constructor of CBinaryAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CBinaryAccesser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CBinaryAccesser
+ /// Destructor of CBinaryAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CBinaryAccesser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistData
+ /// Persist data in persistent memory in a file in binary format.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Memory file path for saving notification.
+ ///
+ /// \param [IN] f_vdata
+ /// Persistent_Notification_List_Type* - Data which has to be persisted.
+ ///
+ /// \param [IN] f_epersistenttype
+ /// EFrameworkunifiedNotificationType - Type of Notification.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PersistData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *f_vdata,
+ EFrameworkunifiedNotificationType f_epersistenttype,
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RetrieveData
+ /// Retrieve data from from a file from persistent memory and store in a vector.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Memory file path from where to retrieve notification data.
+ ///
+ /// \param [OUT] f_vdata
+ /// Persistent_Notification_List_Type*& - Retrieved notification data is filled in this vector.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RetrieveData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *&f_vdata, // NOLINT (runtime/references)
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ private:
+ UI_32 m_uiCurStrOffset;
+ UI_32 m_uiCurStrSize;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OpenFileForReading
+ /// Open file in read mode.
+ ///
+ /// \param [OUT] f_Fd
+ /// int * - File descriptor to read from a file
+ ///
+ /// \param [IN] f_cfilepath
+ /// std::string - File Path from the file is to be read
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenFileForReading(int *f_infd,
+ std::string f_cfilepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OpenFileForWriting
+ /// Open file in write mode.
+ ///
+ /// \param [OUT] f_Fd
+ /// int * - File descriptor to write to a file
+ ///
+ /// \param [IN] f_cfilepath
+ /// std::string - File Path for the file that is to be written
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenFileForWriting(int *f_outfd,
+ std::string f_cfilepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// WriteHeaderAndData
+ /// Write header and data in a file.
+ ///
+ /// \param [IN] f_pnotificationstopersist
+ /// CNotificationsToPersist - Object of class CNotificationsToPersist
+ ///
+ /// \param [IN] f_pdata
+ /// PVOID - notification data
+ ///
+ /// \param [IN] f_Fd
+ /// int - File descriptor to write the file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus WriteHeaderAndData(CNotificationsToPersist *f_pnotificationstopersist,
+ PVOID f_pdata,
+ int f_outfd);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ReadHeaderAndData
+ /// Read header from the file.
+ ///
+ /// \param [IN] f_objcpersistdataheader
+ /// CPersistDataHeader& - Object of class CPersistDataHeader
+ ///
+ /// \param [OUT] f_pdata
+ /// CHAR*& -
+ ///
+ /// \param [IN] f_Fd
+ /// int - File descriptor to read the file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ReadHeaderAndData(CPersistDataHeader &f_objcpersistdataheader, // NOLINT (runtime/references)
+ CHAR *&f_pdata, int f_infd); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FillNotificationList
+ /// This function retrieves the notification data from file and fill it in map.
+ ///
+ /// \param [IN] f_Fd
+ /// int - File descriptor to retrieve notification data.
+ ///
+ /// \param [OUT] f_vdata
+ /// Persistent_Notification_List_Type*& - Retrieved notification data is filled in this vector.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FillNotificationList(int f_infd,
+ Persistent_Notification_List_Type *&f_vdata, // NOLINT (runtime/references)
+ EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ EFrameworkunifiedStatus WriteFileHeaderAndDuplicate(int f_outfd, std::string f_cfilepath);
+ EFrameworkunifiedStatus CheckFileHeader(int f_infd);
+ EFrameworkunifiedStatus OpenBakFileForReading(int *f_infd, std::string f_cfilepath);
+ UI_32 CalcCRC(PVOID f_pdata, UI_32 f_size);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_BINARY_ACCESSER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h b/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h
new file mode 100755
index 0000000..984296f
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h
@@ -0,0 +1,558 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CCopyWorker and CArchive.
+/// Class CCopyWorker holds the implementation for worker thread.
+/// Class CArchive holds the implementation for archive.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_COPY_WORKER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_COPY_WORKER_H_
+
+#define LIBTARFAIL -1
+#define LIBTARSUCCESS 0
+#define TARMODE 0644
+#define FILEERROR -1
+
+#include <pthread.h>
+#include <libtar.h>
+#include <stdio.h>
+#include <zlib.h>
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_utility_sys.hpp>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/ns_np_service.h>
+
+#include <map>
+#include <string>
+
+#include "ns_npp_types.h"
+
+typedef std::map<std::string, UI_32> TMTagCRC; // map of tag and corresponding CRC
+typedef std::map<std::string, TMTagCRC> TMServiceTagCRC; // map of service and tag list
+typedef std::map<int, gzFile> GZFiles;
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPCopyWorkerOnStart
+/// Callback method on start of worker thread.
+///
+/// \param [IN] f_hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPCopyWorkerOnStart(HANDLE f_hthread);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPCopyWorkerOnStop
+/// Callback method on stopping of worker thread.
+///
+/// \param [IN] f_hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPCopyWorkerOnStop(HANDLE f_hthread);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// gzopen_frontend
+/// Method to set archiving options.
+///
+/// \param [IN] f_pcpathname
+/// PCHAR - Thread Handle
+///
+/// \param [IN] f_sioflags
+/// SI_32 - Open file flags
+///
+/// \param [IN] f_simode
+/// SI_32 - File Mode
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 OpenArchive(PCHAR f_pcpathname, SI_32 f_sioflags, SI_32 f_simode);
+
+int CloseArchive(int fd);
+ssize_t ReadArchive(int fd, void *buf, size_t count);
+ssize_t WriteArchive(int fd, const void *buf, size_t count);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPServiceOnDeleteOldDataCmd
+/// This callback is used to delete the data which was requested to be deleted during
+/// previous shutdown.
+///
+/// \param [in] f_happ
+/// HANDLE - Handle to notificationpersistentservice_application Framework.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPServiceOnDeleteOldDataCmd(HANDLE f_happ);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPDataResetThreadCallback
+/// Callback of data reset thread.
+/// This callback delete all the data which was requested for reset during previous shutdown.
+///
+/// \param [in] f_parg
+/// PVOID - Thread argument
+///
+/// \return PVOID
+/// PVOID - NULL
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID NSPDataResetThreadCallback(PVOID f_parg);
+
+class CCopyWorker {
+ public:
+ static TMServiceTagCRC g_mservicetagcrc;
+ static CMutex g_objmtxservicetag;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCopyWorker
+ /// Constructor of class CCopyWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CCopyWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CCopyWorker
+ /// Destructor of class CCopyWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CCopyWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdCopy
+ /// Callback method for start copy command.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdCopy(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdResume
+ /// Callback method for resuming worker thread.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdResume(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdStart
+ /// Callback method for starting worker thread.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdStart(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdArchive
+ /// Callback method to start archiving/unarchiving for file or folder
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdArchive(HANDLE f_hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdStop
+ /// Callback method for stopping worker thread.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdStop(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnCmdShutdownRequest
+ /// Callback method on shutdown request.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnCmdShutdownRequest(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Abort
+ /// Method to abort worker thread tasks.
+ ///
+ ///
+ /// \return VOID
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ static VOID Abort();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetCopyStatusToFailure
+ /// Method to set the copy status to failure.
+ ///
+ /// \param [IN] f_tcopystatusresponse
+ /// NSP_CopyStatusResponse - Response status struct
+ ///
+ /// \param [IN] f_eworkerfailcmd
+ /// ENPS_CopyWorkerFailures - Worker failure Commands
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetCopyStatusToFailure(NSP_CopyStatusResponse &f_tcopystatusresponse, // NOLINT (runtime/references)
+ const ENPS_CopyWorkerFailures f_eworkerfailcmd);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// InAbortState
+ /// Method to check if the thread is in abort state
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return BOOL
+ // BOOL - true if in abort state or false.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL InAbortState() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SendAck
+ /// Method to send ack to the parent thread
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \param [IN] f_eworkercmd
+ /// ENSP_CopyWorkerProtocol - Worker protocol command
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SendAck(HANDLE hthread, const ENSP_CopyWorkerProtocol &f_eworkercmd);
+
+ private:
+ static pthread_mutex_t m_sAbortMutex; // NOLINT (readability/naming) , Mutex for abort
+ static BOOL m_sbAbortCopy; // NOLINT (readability/naming) , Check for abort state
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CopyFile
+ /// Copy the content of source file f_csrcpath to destination file f_cdestpath.
+ /// Creates the destination file path if does not exists.
+ ///
+ /// \param [IN] f_csrcpath
+ /// PCSTR - source file path
+ ///
+ /// \param [IN] f_cdestpath
+ /// PCSTR - dest file path
+ ///
+ /// \param [OUT] f_uiwritesize
+ /// UI_32 - number of bytes written to the destination file
+ ///
+ /// \param [IN] f_btmpfile
+ /// BOOL - TRUE:RELEASE-temp file use /FALSE:LOAD-temp file not use
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK on success else eFrameworkunifiedStatusFail
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CopyFile(PCSTR f_csrcpath, PCSTR f_cdestpath, UI_32 &f_uiwritesize, BOOL btmpfile = FALSE); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetCopyBufSize
+ /// Get the buffer size appropriate for file copy
+ ///
+ /// \param [IN] f_si32openfd
+ /// SI_32 - File descriptor of a file opened with open() api
+ ///
+ /// \param [OUT] f_ui32filesize
+ /// UI_32 - Get the size of file
+ ///
+ /// \return SI_32
+ /// SI_32 - Returns the buffer size appropriate for file copy
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetCopyBufSize(SI_32 f_si32openfd, UI_32 &f_ui32filesize); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// VerifyWithStoredCRC
+ /// Verify CRC stored internally for the tag matches with the CRC of a file (file passed as a argument)
+ ///
+ /// \param [IN] f_crequesterappname
+ /// PCSTR - Name of the requester. This is to find the corresponding stored CRC
+ ///
+ /// \param [IN] f_cpersistenttag
+ /// PCSTR - Tag. This is to find the corresponding stored CRC
+ ///
+ /// \param [IN] f_cFile
+ /// PCSTR - Complete file path on temporary storage.
+ /// Comparison of CRC needs to be done with this temporary file.
+ ///
+ /// \return BOOL
+ /// BOOL - Returns TRUE if f_cFile's CRC matches with CRC stored internally for the corresponding tag
+ /// else FALSE
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL VerifyWithStoredCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, PCSTR f_cFile, UI_32 &f_ui32crc); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateTagCRC
+ /// Update the passed CRC in the internal map for the corresponding requester and tag.
+ ///
+ /// \param [IN] f_crequesterappname
+ /// PCSTR - Name of the requester.
+ ///
+ /// \param [IN] f_cpersistenttag
+ /// PCSTR - File Tag.
+ ///
+ /// \param [IN] f_ui32crc
+ /// UI_32 - New CRC.
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID UpdateTagCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, UI_32 f_ui32crc);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// TryFileCopyWithCRCCheck
+ /// Try to copy file from source to destination until src and dest CRC matches or max f_ui32checkcount
+ /// number of times
+ ///
+ /// \param [IN] f_csource
+ /// PCSTR - Source file
+ ///
+ /// \param [IN] f_cdest
+ /// PCSTR - Destination file
+ ///
+ /// \param [IN] f_ui32checkcount
+ /// UI_32 - Maximum number of times to perform file copy
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK - If file copy done successfully and CRC matches.
+ /// eFrameworkunifiedStatusFail - otherwise
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus TryFileCopyWithCRCCheck(PCSTR f_csource, PCSTR f_cdest, UI_32 f_ui32checkcount);
+
+ class CArchive {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CArchive
+ /// Constructor of CArchive class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CArchive();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CArchive
+ /// Destructor of CArchive class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CArchive();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Archive
+ /// Method for performing folder archive or extraction operation.
+ ///
+ /// \param [IN] f_tarchiveinfocmd
+ /// NSP_CopyInfoCmd - Archive Command Info Structure
+ ///
+ /// \param [IN] f_tarchivestatusresponse
+ /// NSP_CopyStatusResponse - Archive Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Archive(NSP_CopyInfoCmd &f_tarchiveinfocmd, NSP_CopyStatusResponse &f_tarchivestatusresponse); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FileOperationUsingLibz
+ /// Method to determine whether to compress or decompres file using libz.
+ ///
+ /// \param [IN] f_toperainfocmd
+ /// NSP_CopyInfoCmd - File Operation Command Info Structure
+ ///
+ /// \param [IN] f_toperarespstatus
+ /// NSP_CopyStatusResponse - File Operation Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FileOperationUsingLibz(NSP_CopyInfoCmd &f_toperainfocmd, NSP_CopyStatusResponse &f_toperarespstatus); // NOLINT (runtime/references)
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateTar
+ /// Method to Create tar archive.
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the folder to be archived
+ ///
+ /// \param [IN] f_cdestpath
+ /// std::string - Destination path for the archived folder.
+ ///
+ /// \param [IN] f_tarchivestatusresponse
+ /// NSP_CopyStatusResponse - Archive Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateTar(const std::string &f_csourepath, const std::string &f_cdestpath,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ExtractTar
+ /// Method to extract tar archive.
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the folder to be extracted
+ ///
+ /// \param [IN] f_csourcedest
+ /// std::string - Destination path for the extracted folder.
+ ///
+ /// \param [IN] f_tarchivestatusresponse
+ /// NSP_CopyStatusResponse - Archive Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ExtractTar(const std::string &f_csourepath, const std::string &f_csourcedest,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Create
+ /// Method to Create archive
+ ///
+ /// \param [IN] f_pctarfiledestpath
+ /// CHAR - Destination path for the archived folder.
+ ///
+ /// \param [IN] f_pcrootdirpath
+ /// CHAR - Source path of the folder to be archived
+ ///
+ /// \param [IN] f_plibtarlist
+ /// BOOL - TRUE if user file else FALSE
+ ///
+ /// \return SI_32
+ //
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Create(std::string &f_pctarfiledestpath, std::string &f_pcrootdirpath, libtar_list_t *f_plibtarlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Extract
+ /// Nethod to extract archive.
+ ///
+ /// \param [IN] f_pcrootdirpath
+ /// CHAR - Source path of the folder to be extracted
+ ///
+ /// \param [IN] f_pctarfiledestpath
+ /// CHAR - Destination path for extraction.
+ ///
+ /// \return SI_32
+ //
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Extract(std::string &f_pcrootdirpath, std::string &f_pctarfiledestpath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CompressUsingZlib
+ /// Method to compress file using libz
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the file to be compressed
+ ///
+ /// \param [IN] f_cdestpath
+ /// std::string - Destination path for the compressed file.
+ ///
+ /// \param [IN] f_iziplevel
+ /// Level of compression i.e.
+ /// More compression results in more time taken for compression operation and vice versa.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CompressUsingZlib(const std::string &f_csourepath, const std::string &f_cdestpath, SI_32 f_iziplevel);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// DeCompressUsingZlib
+ /// Method to decompress file using libz.
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the file to be decompressed.
+ ///
+ /// \param [IN] f_csourcedest
+ /// std::string - Destination path for the decompressed file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DeCompressUsingZlib(const std::string &f_csourepath, const std::string &f_csourcedest);
+ };
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_COPY_WORKER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h b/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h
new file mode 100755
index 0000000..4f7876d
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CFSDirectory.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_FS_DIRECTORY_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_FS_DIRECTORY_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+
+
+// Class to provide file system directory operations like create,delete etc.
+class CFSDirectory {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFSDirectory
+ /// Constructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFSDirectory
+ /// Destructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to check if the directory exists.
+ ///
+ /// \param [in] f_cdirpath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL DoesDirecotryExist(const std::string &f_cdirpath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to create a directory.
+ ///
+ /// \param [in] f_cdirpath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus CreateDirectory(const std::string &f_cdirpath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to verify directory.
+ ///
+ /// \param [in] f_cpath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL IsDirectory(const std::string &f_cpath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to delete directory with delay of f_uidelay(msec)
+ /// between consecutive deletes.
+ ///
+ /// \param [in] f_cpath
+ /// std::string - Path of the directory to delete.
+ /// \param [in] f_uidelay
+ /// UI_32 - delay in millisec before recursive call.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL RemoveDirectory(std::string f_cpath, const UI_32 f_uidelay = 0);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_FS_DIRECTORY_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h b/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h
new file mode 100755
index 0000000..30c8a26
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup tag_NS_NPPService
+/// \ingroup tag_NS_NPPService
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This class holds the message queue handles for notification subscribers
+///
+/// This is a singleton class which holds the message queue handles for notification subscribers.
+/// This will ensure that NS_NPPService will hold only one handle per subscriber.
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <map>
+#include <utility>
+
+typedef std::map<std::string, HANDLE> HandleList_Type;
+typedef std::pair<HandleList_Type::iterator, bool> HandleListRetStatus_Type;
+
+
+
+/**
+ * This class holds the message queue handles for notification subscribers
+ */
+class CHandleList {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetHandleList
+ /// This function is used to get the singleton instance of class.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \return CHandleList
+ /// CHandleList - singleton instance of class
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ static CHandleList *GetHandleList();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ReleaseHandleList
+ /// This function is used to release the instance of class.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus ReleaseHandleList();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddHandleInList
+ /// Add pair of subscriber name and corresponding handle in map.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ /// \param [IN] f_hmqhandle
+ /// HANDLE - Message queue handle of the subscriber
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus -
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddHandleInList(std::string f_csubscribername, HANDLE f_hmqhandle);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RemoveHandleFromList
+ /// Remove handle for subscriber from the list.
+ /// Handle will actually get removed when all the notifications are unsubscribed by the subscriber
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus -
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RemoveHandleFromList(std::string f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSubscriberMqHandle
+ /// Get the message queue handle of a subscriber.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return HANDLE
+ // HANDLE - Message queue handle of the subscriber
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ HANDLE GetSubscriberMqHandle(std::string f_csubscribername);
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CHandleList
+ /// Constructor of CHandleList class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CHandleList();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CHandleList
+ /// Destructor of CHandleList class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CHandleList();
+
+ HandleList_Type m_mHandleList; ///< map which stores all the message queue handle
+
+ static CHandleList *m_psHandleList; // NOLINT (readability/naming)
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h b/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h
new file mode 100755
index 0000000..a3994ca
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h
@@ -0,0 +1,218 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CImmediatePersistenceWorker and holds the
+/// implementation for worker thread.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOR_PERSISTENCE_WORKER_THREAD_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOR_PERSISTENCE_WORKER_THREAD_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_timer_if.hpp>
+
+#include "ns_npp_types.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSP_NorPersistenceWorkerOnStart
+/// Callback method on start of worker thread.
+///
+/// \param [IN] hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStart(HANDLE hthread);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPNorPersistenceWorkerOnStop
+/// Callback method on stopping of worker thread.
+///
+/// \param [IN] hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStop(HANDLE hthread);
+
+// Forward Declaration for class
+class CNotificationsToPersist;
+
+
+/**
+ * This class handles the immediate persistence notification related requests.
+ *
+ */
+class CNorPersistenceWorker {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNorPersistenceWorker
+ /// Constructor of class CNorPersistenceWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNorPersistenceWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNorPersistenceWorker
+ /// Destructor of class CNorPersistenceWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNorPersistenceWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnNorPersistenceTimerStart
+ /// When immediate persistence notification publish request is received by NPPService. It sends a
+ /// NOR_PERSISTENCE_TIMER_START command to the worker thread and this function gets called.
+ /// This function starts the respective timer of the notification. Timeout of timer writes
+ /// corresponding notification data to persistent memory.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnNorPersistenceTimerStart(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RegisterImmediatePersistNotification
+ /// When immediate persistence notification register request is received by NPPService. It sends a
+ /// NOR_PERSISTENCE_REGISTER command to the worker thread and this function gets called.
+ /// Registration with worker thread is required because only child thread will be responsible for
+ /// data saving related stuff. It creates a timer corresponding to the notification.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterImmediatePersistNotification(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// UnregisterImmediatePersistNotification
+ /// When immediate persistence notification unregister request is received by NPPService. It sends a
+ /// NOR_PERSISTENCE_UNREGISTER command to the worker thread and this function gets called.
+ /// It deletes a timer corresponding to the notification.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnregisterImmediatePersistNotification(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnShutdown
+ /// This API stops all the immediate notification timer.
+ /// This API immediately writes the data to persistent memory if the timer is runnning,
+ /// irrespective of delay unless the data .
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnShutdown(HANDLE hthread);
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnCategoryChange
+ /// This API updates the category of immediate persistence notification.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnCategoryChange(HANDLE hthread);
+};
+
+/**
+ * CTimerHelper class maps the timer id and corresponding data.
+ *
+ */
+class CTimerHelper: public NSTimer {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CTimerHelper
+ /// Constructor of class CTimerHelper
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CTimerHelper();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CTimerHelper
+ /// Destructor of class CTimerHelper
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CTimerHelper();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetCmdId
+ /// Returns the timer id of the timer.
+ ///
+ /// \param [IN] none
+ ///
+ /// \return UI_32
+ // UI_32 - Timer id of the timer
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetCmdId();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnTimeOut
+ /// This function gets called when timer expires. This function writes the notification data in
+ /// persistent memory.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnTimeOut(HANDLE hthread);
+
+ // member variables
+ PUI_8 m_pui8HeaderAndData; // header and corresponding data of the notfn stored as part of timer
+
+ private:
+ UI_32 m_uiCmdId; // command id associated with timer
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOR_PERSISTENCE_WORKER_THREAD_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_notification.h
new file mode 100755
index 0000000..673e54c
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_notification.h
@@ -0,0 +1,323 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include <string>
+#include <iostream>
+#include "ns_npp_notification_receiver.h"
+
+typedef std::map<std::string, CNotificationReceiver *> NotifReceiver_Type;
+
+/// Iterator of map of CNotificationReceiver
+typedef NotifReceiver_Type::iterator NotifReceiver_Iterator_Type;
+
+/**
+ * This class is base class for all the notification types classes.
+ */
+class CNotification {
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotification
+ /// Parameterless Constructor of CNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification();
+
+ protected:
+ std::string m_cNotificationName; ///< Name of Notification
+
+ UI_32 m_uiMaxMsgSize; ///< Maximum size of notification data
+
+ EFrameworkunifiedNotificationType m_ePersistentType; ///< type of notification
+
+ std::string m_cServiceName; ///< List of services registering notification
+
+ NotifReceiver_Type *m_pmSubscribersList; ///< list of subscribers of notification
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddReceiverInMap
+ /// This function adds the name of the service to receiver list of notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddReceiverInMap(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PublishData
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_hmsgqhandle
+ /// HANDLE - MessageQ Handle of ReceiverQ
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PublishData(HANDLE f_hmsgqhandle,
+ const PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotification
+ /// Constructor of CNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotification
+ /// Destructor of CNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventReciever
+ /// This function adds the name of the application to receiver list of particular notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// DeleteEventReciever
+ /// This function deletes the name of application from receivers list.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DeleteEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetNewSubscribersList
+ /// This function sets the subscribers list of notification
+ ///
+ /// \param [IN] f_pnotification
+ /// CNotification - notification object containing subscribers list
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetNewSubscribersList(CNotification *f_pnotification);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetEventPublisher
+ /// This function set the publisher name to current received service name
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of application
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetEventPublisher(const std::string &f_cservicename);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetEventPublisher
+ /// This function resets the publisher name to NULL
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of application
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ResetEventPublisher(const std::string &f_cservicename);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsServiceRegistered
+ /// This function checks whether the notification is registered with any service or not.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - true,if subscriber list is empty
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsServiceRegistered();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsSubscribersListEmpty
+ /// This function is used to check whether any service is subscribed to notification
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - true,if subscriber list is empty
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsSubscribersListEmpty();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNotificationName
+ /// This function is used to get the notification name.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - notification name
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetNotificationName();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPublisherName
+ /// This function is used to get the publisher name of notification.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - service name
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetPublisherName();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceType
+ /// This function is used to get the type of notification.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedPersistentVarType
+ // EFrameworkunifiedPersistentVarType - persistent type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedNotificationType GetNotificationType();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetMaxMessageSize
+ /// This function is used to get the max size of data of notification message.
+ ///
+ /// \param
+ ///
+ /// \return UI_32
+ // UI_32 - Max Message Size
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetMaxMessageSize();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetMaxMessageSize
+ /// This function reset the max size of data that can be published with notification
+ ///
+ /// \param [IN] f_uilength
+ /// std::string - Max size for notification data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ResetMaxMessageSize(const UI_32 f_uilength);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSubscriberList
+ /// Returns the list of subscribers subscribed to notification
+ ///
+ /// \param
+ ///
+ /// \return NotifReceiver_Type
+ // NotifReceiver_Type - subscriber's list of notification
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ NotifReceiver_Type *GetSubscriberList();
+
+#endif
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h b/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h
new file mode 100755
index 0000000..e730d02
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h
@@ -0,0 +1,496 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of singleton class CNotificationManager which is used
+/// to manage notification information.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_MANAGER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_MANAGER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+
+#include <map>
+#include <vector>
+#include <string>
+#include <iostream>
+
+/// forward declaration of class
+class CNotification;
+class CPersistentData;
+class CNotificationsToPersist;
+class CStateNotification;
+
+/// map of all the available notification.
+typedef std::map<std::string, CNotification *> Notification_Type;
+
+/// iterator for map of notifications.
+typedef Notification_Type::iterator Notification_Iterator_Type;
+
+/// map of all available persistent notification and its data.
+typedef std::map<std::string, CPersistentData *> Persistent_Type;
+
+/// Iterator for map of persistent notifications.
+typedef Persistent_Type::iterator Persistent_Iterator_Type;
+
+/**
+ * This class is used to manage the operations related to notification
+ * on registration, subscription, publication, etc.
+ */
+class CNotificationManager {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationManager
+ /// Constructor of CNotificationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationManager
+ /// Destructor of CNotificationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnRegisterEvents
+ /// This function creates notification object depending on its type and if already created it
+ /// adds the service name to the list in the notification object.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_uimsglength
+ /// UI_32 - Maximum length of Message
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedPersistentVarType - type of notification
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - Delay time for persistence
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnRegisterEvents(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay = 0);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnUnRegisterEvents
+ /// This function removes the name of the service from the notification object.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service unregistering from notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnUnRegisterEvents(const std::string &f_cservicename,
+ const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnPublishEvent
+ /// This function stores the published data in the notification object in case of state and
+ /// persistent notification.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - pointer to message
+ ///
+ /// \param f_uimsgsize
+ /// UI_32 - size of Message
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnPublishEvent(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnSubscribeToEvent
+ /// This function adds the name of the application to subscribers list in notification object.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing to notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnSubscribeToEvent(const std::string &f_csubscribername,
+ const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnUnSubscribeFromEvent
+ /// This function adds the name of the application to subscribers list in notification object.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing to notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnUnSubscribeFromEvent(const std::string &f_csubscribername,
+ const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NPGetPersistentNotificationData
+ /// Get data for notification name
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - name of notification
+ /// \param [OUT] f_pnotificationdata
+ /// PVOID - data corresponding to notification name
+ /// \param [IN] f_uidatasize
+ /// UI_32 - size of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NPGetPersistentNotificationData(const std::string &f_cnotificationname,
+ PVOID f_pnotificationdata, const UI_32 f_uidatasize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnGetPersistentData
+ /// This function is used to get the persistent data stored related to notification.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification Name
+ ///
+ /// \param [IN] f_creceivername
+ /// std::string - Source Name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnGetPersistentData(const std::string &f_cnotificationname,
+ const std::string &f_creceivername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceGetPersistentNotificationData
+ /// This function is used to get the list of persistent notifications and the data associated
+ /// with it.
+ ///
+ /// \param [OUT] f_pvpersistnotification
+ /// CNotificationsToPersist - vector containing list of persistent notifications and
+ /// data associated with it.
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedNotificationType - Type of notification
+ ///
+ /// \param [IN] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceGetPersistentNotificationData(std::vector<CNotificationsToPersist *> *f_pvpersistnotification,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersistentNotificationData
+ /// This function is used to create the persistent notifications object and fill the data
+ /// related with it on system load.
+ ///
+ /// \param [IN] f_pvpersistnotification
+ /// vector<CNotificationsToPersist> - vector containing list of notifications and data associated with it
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersistentNotificationData(std::vector<CNotificationsToPersist *> *f_pvpersistnotification);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNotificationInfo
+ /// This function is used to get the notification information.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification Name
+ ///
+ /// \param [IN] l_pnotificationstopersist
+ /// CNotificationsToPersist - Notification info structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetNotificationInfo(const std::string &f_cnotificationname,
+ CNotificationsToPersist *&l_pnotificationstopersist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetDefaultPersistentNotificationData
+ /// This function is used to set the default data of persistent notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ /// \param [IN] f_pmessage
+ /// PVOID - message data
+ /// \param [IN] f_uimsgsize
+ /// UI_32 - message size
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetDefaultPersistentNotificationData(const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersistentCategory
+ /// This function is used to set the persistent type of persistent notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ /// \param [IN] f_epersistenttype
+ /// EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersistentCategory(const std::string &f_cnotificationname,
+ const EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentservicePublishImmediateNotification
+ /// This function publish the immediate notification f_cnotificationname to all its subscribers.
+ /// This API is called when service updates the immediate notification data in persistent memory
+ /// using synchronous API.
+ ///
+ /// \param [IN] f_cservicename
+ /// const std::string& - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// const std::string& - notification name
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - pointer to message
+ ///
+ /// \param f_uimsgsize
+ /// UI_32 - size of Message
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - eFrameworkunifiedStatusOK on success
+ /// eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// eFrameworkunifiedStatusNullPointer - if notification not found
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentservicePublishImmediateNotification(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNotificationProfilingData
+ /// This function is used to get the notification profiling information.
+ ///
+ /// \param [OUT] f_tNotificationProfileInfo
+ /// std::string - all the notification info of all applications concated in a string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetNotificationProfilingData(std::string &f_cnotificationprofileInfo); // NOLINT (runtime/references)
+
+#endif
+
+ private:
+ Notification_Type *m_pmNotificationList; /// < map containing list of all notifications.
+
+ std::vector<std::string> *m_pvPersistentList; /// < vector containing list of all persistent notifications.
+
+ std::vector<std::string> *m_pvUserPersistentList; /// < vector containing list of all user persistent notifications.
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateNotificationObject
+ /// This function is used to get notification object from map if it exists else create new
+ /// object as per type of notification.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_uimsglength
+ /// UI_32 - Maximum size of notification message
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedPersistentVarType - Delay time for persistence
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - Persistence Delay
+ ///
+ /// \return CNotification
+ // CNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification *CreateNotificationObject(const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay = 0);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SearchNotification
+ /// This function is used to search whether notification object is present in map or not.
+ /// If present it sends the reference. CNotification - reference to pointer of notification object
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return CNotification
+ // CNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification *SearchNotification(const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SearchPersistenceNotification
+ /// This function is used to search whether the given persistent notification object
+ /// is present in map or not.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return CStateNotification
+ // CStateNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStateNotification *SearchPersistenceNotification(const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateNotificationObjectToPersist
+ /// Creates the CNotificationsToPersist object from notification object and the persistent data.
+ ///
+ /// \param [IN] f_pnotification
+ /// CStateNotification - notification object ptr
+ /// \param [IN] f_pdata
+ /// CPersistentData - persistent data
+ ///
+ /// \return CNotification
+ // CNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationsToPersist *CreateNotificationObjectToPersist(CStateNotification *f_pnotification,
+ const CPersistentData *f_pdata);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RemoveUserSpecificNotificationEntry
+ /// This function is used to get the singleton instance of class.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RemoveUserSpecificNotificationEntry();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ChangeNotificationType
+ /// This function creates new notification object depending on the type and replaces the old one.
+ /// The subscribers list is copied from the old notification object is copied to the new one.
+ ///
+ /// \param [IN] f_pnotification
+ /// CNotification* - old notification object
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_uimsglength
+ /// UI_32 - Maximum length of Message
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedPersistentVarType - new type of notification
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - Delay time for persistence
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ChangeNotificationType(CNotification *f_pnotification,
+ const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_MANAGER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h b/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h
new file mode 100755
index 0000000..09f6b15
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h
@@ -0,0 +1,68 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CNotificationReceiver.
+/// It holds the handle of message queue for sending notification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_RECEIVER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_RECEIVER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+class CNotificationReceiver {
+ private:
+ // no members in private
+
+ public:
+ HANDLE m_MsgQHandle; ///< handle to message queue
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationReceiver
+ /// Constructor of CNotificationReceiver class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationReceiver();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationReceiver
+ /// Destructor of CNotificationReceiver class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationReceiver();
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_RECEIVER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h b/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h
new file mode 100755
index 0000000..e668af6
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATIONPERSISTENTSERVICELOG_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATIONPERSISTENTSERVICELOG_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_NPP_INFO ZONEMASK(25)
+#define ZONE_PRD_INFO3 ZONEMASK(26)
+#define ZONE_PRD_INFO2 ZONEMASK(27)
+#define ZONE_PRD_INFO1 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 "NPP Info"
+#define ZONE_TEXT_26 "Product Info3"
+#define ZONE_TEXT_27 "Product Info2"
+#define ZONE_TEXT_28 "Product Info1"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_NS_WAR, ZONE_NS_ERR, ZONE_PRD_INFO2
+#endif
+
+extern const CHAR AppName[]; // NOLINT (readability/naming)
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATIONPERSISTENTSERVICELOG_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h b/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h
new file mode 100755
index 0000000..04468be
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CFilePersistence class.
+/// This class is responsible for persisting and retrieving of files.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FILE_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FILE_H_
+
+#include <native_service/ns_np_service.h>
+#include <string>
+#include <map>
+#include "ns_npp_persistence.h"
+
+// Forward declaration of classes.
+class CPersistence;
+class CRegistryEntry;
+
+/**
+ * This class is responsible for persisting and retrieving of files..
+ */
+class CFilePersistence : public CPersistence {
+ private:
+ TSourceRegistryList m_mPersistFileRegistry;
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFilePersistence
+ /// Constructor of CFilePersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFilePersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFilePersistence
+ /// Destructor of CFilePersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFilePersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Release
+ /// Request for release file to persistent storage. File persist will be done at shutdown.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - File which needs to persist.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Release(std::string f_cappname, std::string f_ctag, std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype, std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Load
+ /// Load file from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Filepath for retrieved file.
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Load(std::string f_cappname, std::string f_ctag, std::string f_cretrievepath,
+ std::string f_cusername);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FILE_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h b/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h
new file mode 100755
index 0000000..39cf975
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h
@@ -0,0 +1,122 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FOLDER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FOLDER_H_
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <string>
+
+#include "ns_npp_persistence.h"
+
+
+// class CPersistence;
+
+class CFolderPersistence : public CPersistence {
+ private:
+ TSourceRegistryList m_mPersistFolderRegistry; // map to hold the folder registry entries
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFolderPersistence
+ /// Constructor of CFolderPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFolderPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFolderPersistence
+ /// Destructor of CFolderPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFolderPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Release
+ /// Entry for the folder is stored in map for persistence.
+ /// If f_bPersist is TRUE folder will be persisted immediately else will be persisted on shutdown
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - Folder which needs to persist.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Release(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Load
+ /// Load folder from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Filepath for retrieved file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Load(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ std::string f_cusername);
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FOLDER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h b/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h
new file mode 100755
index 0000000..d84f9fb
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h
@@ -0,0 +1,365 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CPersistence class.
+/// This is a abstract class for file and folder persistency.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+#include <string>
+#include <map>
+#include <list>
+
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_copy_worker.h"
+
+class CRegistryEntry;
+
+typedef std::string TSourceName;
+typedef std::string TTag;
+typedef std::map< TTag, CRegistryEntry > TTagRegistryList;
+typedef TTagRegistryList::iterator TTagRegistryListItr;
+
+typedef std::map<TSourceName, TTagRegistryList> TSourceRegistryList;
+typedef TSourceRegistryList::iterator TSourceRegistryListItr;
+
+typedef std::list<NSP_CopyInfoCmd> TPendingJobs;
+typedef TPendingJobs::iterator TPendingJobsItr;
+
+/**
+ * This is a abstract class for file and folder persistence.
+ */
+class CPersistence {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistence
+ /// Constructor of CPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistence
+ /// Destructor of CPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Register
+ /// Register file/folder tag for persistence.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] bisuserpersistence
+ /// BOOL - TRUE if user persistence else FALSE
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Register(std::string f_crequestorappname, std::string f_ctag, BOOL bisuserpersistence);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Release
+ /// Entry for the file/Folder is stored in map for persistence.
+ /// If f_bPersist is TRUE file/folder will be persisted immediately else will be persist on shutdown
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - File/Folder path that is to be persisted.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Release(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername) = 0;
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Load
+ /// Load file/folder from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Path to retrieve.
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Load(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ std::string f_cusername) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Persist
+ /// Persist file/folder immediately
+ ///
+ /// \param [IN] f_objregistryentry
+ /// CRegistryEntry& - Registry entry job object to persist.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Persist(CRegistryEntry &f_objregistryentry); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AckReceivedFromWorker
+ ///
+ ///
+ /// \param [in] pSource
+ /// PCSTR - Name of the source.
+ /// \param [in] f_ctag
+ /// PCSTR - file/folder tag.
+ /// \param [in] f_bcopystatus
+ /// BOOL - Status of file/folder copy by copy worker.
+ /// \param [in] f_eloadtype
+ /// ENPS_Loadtype - Type of load release or load.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, BOOL f_bcopystatus,
+ ENPS_Loadtype f_eloadtype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistAllReleaseRequests
+ /// Persist all files/folders which are not persisted yet.
+ ///
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HaveAllReleaseRequestsPersisted
+ /// Checks if all release requests are processed or not
+ ///
+ /// \param [out] f_ctagnotreleased
+ /// std::string - list of tags not released by application
+ ///
+ /// \return BOOL
+ /// TRUE if all release requests are processed else false
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL HaveAllReleaseRequestsPersisted(std::string &f_ctagnotreleased); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetPersistFlag
+ /// Resets persist flag.
+ ///
+ /// \param none
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ResetPersistFlag();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistAllUserRequests
+ /// Persist all files/folders which are not persisted yet.
+ ///
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus PersistAllUserRequests();
+
+ // virtual VOID ListAllInMap() = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReadThreadHandle
+ /// Set read thread handle.
+ ///
+ /// \param [in] f_hreadthread
+ /// HANDLE - Handle of the read thread.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetReadThreadHandle(HANDLE f_hreadthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetWriteThreadHandle
+ /// Set write thread handle.
+ ///
+ /// \param [in] f_hwritethread
+ /// HANDLE - Handle of the write thread.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetWriteThreadHandle(HANDLE f_hwritethread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetStoragePath
+ /// Get the permanent storage path. Get it from NS_NPPService's config file.
+ ///
+ /// \return std::string
+ /// std::string - Permanant storage path
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static std::string GetStoragePath();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persist type of file/folder
+ ///
+ /// \param [IN] f_crequestorname
+ /// string - Application Name
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(const std::string &f_crequestorname,
+ const std::string &f_ctag,
+ EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsUserPersistence
+ /// Check if the file/folder being persisted is user specific
+ ///
+ /// \param [in] - f_ctag
+ /// std::string - File/Folder Tag
+ ///
+ /// \return status
+ /// BOOL - TRUE for user specific persistence
+ /// FALSE for global persistence
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual BOOL IsUserPersistence(std::string f_ctag);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceProfilingData
+ /// This function is used to get the persistence info
+ ///
+ /// \param [out] f_cpersistenceprofileinfo
+ /// std::string - Persistence info concated in a string
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo); // NOLINT (runtime/references)
+
+#endif
+
+ protected:
+ EFrameworkunifiedStatus ProcessReleaseRequest(std::string f_crequesterappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername);
+
+ EFrameworkunifiedStatus ProcessLoadRequest(std::string f_crequesterappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cretrievepath,
+ std::string f_cusername);
+
+ VOID AddRequestData(NSP_CopyInfoCmd &f_tcpinfo, // NOLINT (runtime/references)
+ std::string f_sourcepath,
+ std::string f_destpath,
+ std::string f_crequesterappname,
+ std::string f_ctag,
+ ENPS_Loadtype f_eloadtype,
+ ENotificationpersistentservicePersistType f_epersisttype);
+
+ EFrameworkunifiedStatus SendRequestMessage(NSP_CopyInfoCmd &f_tcpinfo); // NOLINT (runtime/references)
+
+ std::string m_cStoragePath; ///< Persistent memory storage path
+
+ NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_eCompressionType; ///< Compression type for file/folder persistency
+
+ HANDLE m_hNSWriteToPersistentMem; ///< Child thread handle, copies file to persistent memory.
+
+ HANDLE m_hNSReadFromPersistentMem; ///< Child thread handle, copies file from persistent memory.
+
+ // TODO(my_username): Remove this member var. Once the API to get application handle is available, use that.
+ HANDLE m_hAppHandle;
+
+ TSourceRegistryList m_mPersistRegistry;
+
+ TPendingJobs m_lPendingJobs; ///< stores the list of pending jobs sequentially
+
+ BOOL m_bPersist; ///< persist or not. It will be set to TRUE either on shutdown or userchange
+
+ UI_32 m_uiNotificationpersistentservicePersistCategoryFlag; ///< Stores the persist category flag value on shutdown request.
+ ///< It is needed to decide which data to persist, if
+ ///< release request is received by NSNPP after shutdown request
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h b/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h
new file mode 100755
index 0000000..99f98d7
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h
@@ -0,0 +1,536 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CPersistenceManager class.
+/// This class acts as a manager for notification persistent data storage
+/// and file and folder persistence.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_MANAGER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_MANAGER_H_
+
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+#include <map>
+#include <string>
+#include <vector>
+#include "ns_npp_types.h"
+#include "ns_npp_persistent_accesser.h"
+
+class CPersistence;
+class CPersistentData;
+class CNotificationsToPersist;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// vector of all available persistent notification and its data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Map of all persist file type. i.e. FilePersistence and FolderPersistence
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::map<ENotificationpersistentservicePersistType, CPersistence *> Persist_Type;
+
+typedef Persist_Type::iterator Persist_Type_Iter;
+
+/**
+ * This class acts as a manager for storing notification data,file and folder in
+ * persistent memory.
+ */
+class CPersistenceManager {
+ public:
+ /// Disable Persistence
+ static BOOL m_bPersistenceDisabled; // NOLINT (readability/naming)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistenceManager
+ /// Constructor of CPersistenceManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistenceManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistenceManager
+ /// Destructor of CPersistenceManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CPersistenceManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceRegister
+ /// Registers a tag for the file or folder. This tag will be used for releasing or loading a
+ /// file or folder.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Tag to register is for a file
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Tag to register is for a folder
+ ///
+ /// \param [IN] bisuserpersistence
+
+ /// BOOL - TRUE if user persistence else FALSE
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceRegister(std::string f_cappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ BOOL bisuserpersistence);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceRelease
+ /// Entry for the file or folder is stored in map for persistence.
+ /// If f_bPersist is TRUE file or folder will be persist immediately else will be persist
+ /// on shutdown
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - File/Folder which needs to persist.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Persist a file to a persistent memory
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Persist a folder to a persistent memory
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceRelease(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceLoad
+ /// Load file/folder from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Filepath for retrieved file/folder.
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Load a file from persistent memory
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Load a folder from persistent memory
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceLoad(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AckReceivedFromWorker
+ /// Send release ack to file/folder persistence object.
+ ///
+ /// \param [IN] f_csource
+ /// PCSTR - Source of released file/folder
+ ///
+ /// \param [IN] f_ctag
+ /// PCSTR - Tag of released file/folder
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Ack for file persistence object
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Ack for folder persistence object
+ ///
+ /// \param [in] f_bcopystatus
+ /// BOOL - Status of file/folder copy by worker.
+ ///
+ /// \param [in] f_eloadtype
+ /// ENPS_Loadtype - Type of load release or load.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, ENotificationpersistentservicePersistType f_epersisttype,
+ BOOL f_bcopystatus, ENPS_Loadtype f_eloadtype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSaveNotificationData
+ /// Save notification data in a persistent file.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - List of all notifications and corresponding data.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSaveNotificationData(Persistent_Notification_List_Type *f_vpersistentnotificationlist);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSaveUserNotificationData
+ /// Save notification data of user in a persistent file.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - List of all notifications and corresponding data.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSaveUserNotificationData(Persistent_Notification_List_Type *f_vpersistentnotificationlist);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceReadNotificationData
+ /// Get the list of all persistent notifications from a persistent memory and store it in a map.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceReadNotificationData(Persistent_Notification_List_Type *&f_vnotificationlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceReadUserNotificationData
+ /// Get the list of all user persistent notifications from a persistent memory and store it in a map.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceReadUserNotificationData(Persistent_Notification_List_Type *&f_vnotificationlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceReadNorNotificationData
+ /// Get the list of all Nor persistent notifications from a persistent memory and store it in a map.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceReadNorNotificationData(Persistent_Notification_List_Type *&f_vnotificationlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistAllReleaseRequests
+ /// Persist all files and folder contained in the map in persistent memory.
+ ///
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentservicePersistAllUserRequests
+ /// Persist all user files and folder contained in the map in persistent memory.
+ ///
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentservicePersistAllUserRequests();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReadThreadHandle
+ /// Pass the handle of the read thread to the object of file/folder persistence
+ ///
+ /// \param [IN] f_hreadthread
+ /// HANDLE - Handle of read thread.
+ ///
+ /// \return
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetReadThreadHandle(HANDLE f_hreadthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetWriteThreadHandle
+ /// Pass the handle of the write thread to the object of file/folder persistence
+ ///
+ /// \param [IN] f_hwritethread
+ /// HANDLE - Handle of write thread.
+ ///
+ /// \return
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetWriteThreadHandle(HANDLE f_hwritethread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetNorPersistenceThreadHandle
+ /// Pass the handle of the Nor persistence write thread to the object of file/folder persistence
+ ///
+ /// \param [IN] f_hwritethread
+ /// HANDLE - Handle of write thread.
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetNorPersistenceThreadHandle(HANDLE f_hwritethread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetUserPersistentPath
+ /// Set user persistent path.
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - Name of user
+ ///
+ /// \return
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetUserPersistentPath(std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsUserPersistence
+ /// Check if the persistence is user specific
+ ///
+ /// \param [in] - f_ctag
+ /// std::string - File/folder Tag
+ ///
+ /// \param [in] - f_epersisttype
+ /// ENotificationpersistentservicePersistType - persistent type
+ ///
+ /// \return status
+ /// BOOL - TRUE for user specific persistence
+ /// FALSE for global persistence
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsUserPersistence(std::string f_ctag, ENotificationpersistentservicePersistType f_epersisttype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HaveAllReleaseRequestsPersisted
+ /// Checks if all files and immediate persistent data are persisted.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ /// TRUE if all release requests are processed else false
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL HaveAllReleaseRequestsPersisted();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetPersistFlag
+ /// Resets persist flag.
+ ///
+ /// \param none
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ResetPersistFlag();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ClearPersistenceData
+ /// Deletes the data from the persistent memory
+ ///
+ /// \param [in] f_enotificationpersistentserviceclearpersistencescope
+ /// EFrameworkunifiedClearPersistence - data to be deleted from memory
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearPersistenceData(const EFrameworkunifiedClearPersistence &f_enotificationpersistentserviceclearpersistencescope);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersistentCategory
+ /// Sets the persist type of file or folder
+ ///
+ /// \param [IN] f_crequestorname
+ /// string - Application name
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \param [IN] f_bPersist
+ /// ENotificationpersistentservicePersistType - file or folder
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersistentCategory(std::string f_crequestorname,
+ std::string f_ctag,
+ EFrameworkunifiedPersistCategory f_epersistcategory,
+ ENotificationpersistentservicePersistType f_epersisttype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistNORData
+ /// Sends the message to Immediate Persistence Thread to Persists the data immediately or reset
+ /// the NOR data depending on persist category flag during shutdown irrespective of delay.
+ ///
+ /// \param f_eshutdowntype
+ /// EFrameworkunifiedShutdownType - shutdown type - normal, quick, data reset
+ ///
+ /// \param f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - flag representing whether to persist or reset data.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PersistNORData(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetImmediateDataPersistedStatus
+ /// Set/Reset the persistence status of immediate persistence data
+ ///
+ /// \param [in] - f_bstatus
+ /// BOOL
+ /// TRUE - immediate persistent data are persisted
+ /// FALSE - immediate persistent data not persisted
+ ///
+ /// \return
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetImmediateDataPersistedStatus(BOOL f_bstatus);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetFilePersistedStatus
+ /// Set/Reset the persistence status of files and folders
+ ///
+ /// \param [in] - f_bstatus
+ /// BOOL
+ /// TRUE - all files are persisted
+ /// FALSE - all files and folders are not persisted
+ ///
+ /// \return
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetFilePersistedStatus(BOOL f_bstatus);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceProfilingData
+ /// This function is used to get the persistence info
+ ///
+ /// \param [out] f_cpersistenceprofileinfo
+ /// std::string - Persistence info concated in a string
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo); // NOLINT (runtime/references)
+
+#endif
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ReadImmediateNotificationData
+ /// Get the list of all immediate persistent notifications of f_epersistcategory
+ /// from a persistent memory in a vector.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \param [IN] f_epersistcategory
+ /// const EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ReadImmediateNotificationData(Persistent_Notification_List_Type *&f_vpersistentnotificationlist, // NOLINT (runtime/references)
+ const EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ std::string m_cUserNotificationTag; ///< Tag associated with a file which is used
+ ///< for storing user related notification persistent data.
+
+ std::string m_cNotificationPersistFilepath; ///< Persistent file path for storing persistent data
+
+ std::string m_cNotificationUserMemFilepath; ///< Memory location of a file for storing persistent data of a user
+
+ Persist_Type m_mPersist_Type; ///< Map holds the objects of file and folder persistency.
+
+ CPersistentAccesser *m_poDataAccesser; ///< Object for persistent data accesser
+
+ HANDLE m_hNSImmediatePersistenceThread; ///< Nor persistence thread handle
+
+ BOOL m_bAllFilePersisted; // all files have been persisted
+
+ BOOL m_bImmediatedDataPersisted; // all immediate peristence data have been persisted
+
+ EFrameworkunifiedStatus Init();
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPServiceOnCpWorkerAckCmd
+/// Handles when the CopyWorker sends an ack back for a message received .
+///
+/// \param [in] f_happ
+/// HANDLE - Handle to notificationpersistentservice_application Framework.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPServiceOnCpWorkerAckCmd(HANDLE f_happ);
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_MANAGER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h b/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h
new file mode 100755
index 0000000..bfb1538
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h
@@ -0,0 +1,119 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CPersistentAccesser class.
+/// This is a abstract class. Derived classes of this class will store the data in different
+/// file formats.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_ACCESSER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_ACCESSER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <vector>
+
+class CPersistentData;
+class CNotificationsToPersist;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// vector of all available persistent notification and its data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+/**
+ * This is a abstract class. Derived classes of this class will store the data in different
+ * file formats.
+ */
+class CPersistentAccesser {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistentAccesser
+ /// Constructor of CPersistentAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistentAccesser() {}
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistentAccesser
+ /// Destructor of CPersistentAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CPersistentAccesser() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistData
+ /// Persist data in persistent memory depending on file format.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Data which has to be persisted.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Read data from this file.
+ ///
+ /// \param [IN] f_epersistenttype
+ /// EFrameworkunifiedNotificationType - Type of persistent notification
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus PersistData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *f_vpersistentnotificationlist,
+ EFrameworkunifiedNotificationType f_epersistenttype,
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RetrieveData
+ /// Retrieve data in persistent memory depending on file format.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Write data from this file.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type* - Retrieved data.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus RetrieveData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *&f_vpersistentnotificationlist, // NOLINT (runtime/references)
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData) = 0;
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_ACCESSER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h b/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h
new file mode 100755
index 0000000..84e2b43
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h
@@ -0,0 +1,165 @@
+ /*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file conains declaration of CPersistentData, CNotificationsToPersist and CPersistDataHeader class.
+/// This class is used to hold the persistent data related to state and persistent
+/// notification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+#ifdef AGL_STUB
+#include <cstring>
+#endif
+/**
+ * This class holds the message and message length of notification data.
+ */
+class CPersistentData {
+ private:
+ // no members in private
+
+ public:
+ PVOID m_pMessage; ///< pointer to message structure
+
+ UI_32 m_uiMsgSize; ///< length of message
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistentData
+ /// Constructor of CPersistentData class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistentData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistentData
+ /// Destructor of CPersistentData class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CPersistentData();
+};
+
+class CNotificationsToPersist {
+ private:
+ // no members in private
+
+ public:
+ std::string m_cNotificationName; ///< Name of Notification
+
+ UI_32 m_uiMaxMsgLength; ///< Maximum data length of notification
+
+ EFrameworkunifiedNotificationType m_ePersistentType; ///< type of notification
+
+ EFrameworkunifiedPersistCategory m_ePersistCategory; ///< Persistent category
+
+ std::string m_cPublisherName; ///< Service Name
+
+ CPersistentData *m_pPersistentData; ///< Persistent data related to notification
+
+ UI_32 m_uiDelay; ///< Maximum delay for persistence
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationsToPersist
+ /// Constructor of CNotificationsToPersist class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationsToPersist(): m_cNotificationName(""),
+ m_uiMaxMsgLength(0),
+ m_ePersistentType(eFrameworkunifiedUnknown),
+ m_ePersistCategory(eFrameworkunifiedUserData),
+ m_cPublisherName(""),
+ m_pPersistentData(NULL),
+ m_uiDelay(0) {
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationsToPersist
+ /// Destructor of CNotificationsToPersist class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationsToPersist() {
+ if (NULL != m_pPersistentData) { // LCOV_EXCL_BR_LINE 6: m_pPersistentData can't be NULL
+ delete m_pPersistentData;
+ m_pPersistentData = NULL;
+ }
+ }
+};
+
+class CPersistDataHeader {
+ private:
+ // no members in private
+
+ public:
+ UI_32 m_uiSize; ///< size of the associated data blob
+ UI_32 m_uiOffset; ///< Offset at which the data blob starts
+ EFrameworkunifiedNotificationType m_ePersistentType;
+ CHAR m_cPublisherName[MAX_QUEUE_NAME_SIZE];
+ CHAR m_cNotificationName[MAX_STRING_SIZE_NOTIFICATION];
+ UI_32 m_uiMaxMsgLength; ///< max size of the associated data
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistDataHeader
+ /// Constructor of CPersistDataHeader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistDataHeader(): m_uiSize(0),
+ m_uiOffset(0),
+ m_ePersistentType(eFrameworkunifiedPersistedStateVar),
+ m_uiMaxMsgLength(0) {
+ std::memset(m_cPublisherName, 0, MAX_QUEUE_NAME_SIZE);
+ std::memset(m_cNotificationName, 0, MAX_STRING_SIZE_NOTIFICATION);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistDataHeader
+ /// Destructor of CPersistDataHeader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CPersistDataHeader() {
+ }
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_personality.h b/nsframework/notification_persistent_service/server/include/ns_npp_personality.h
new file mode 100755
index 0000000..9ac052f
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_personality.h
@@ -0,0 +1,75 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of CNotificationpersistentservicePersonality class.
+/// The class object define personality.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALITY_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALITY_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+/**
+ * This class holds all the informations related to a personality.
+ */
+class CNotificationpersistentservicePersonality {
+ private:
+ // no members in private
+
+ public:
+ std::string m_cUserName; ///< user name
+
+ UI_32 m_uiUserId; ///< unique identifier of each user
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationpersistentservicePersonality
+ /// Constructor of CNotificationpersistentservicePersonality class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationpersistentservicePersonality(): m_cUserName(""), m_uiUserId(0) {} // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationpersistentservicePersonality
+ /// Destructor of CNotificationpersistentservicePersonality class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationpersistentservicePersonality() {}
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALITY_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h b/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h
new file mode 100755
index 0000000..b1042fb
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h
@@ -0,0 +1,132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of singleton class CnotificationpersistentservicePersonalizationManager which is
+/// used to manage information of personality.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALIZATION_MANAGER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALIZATION_MANAGER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <string>
+#include <map>
+#include "ns_npp_personality.h"
+
+typedef std::map<std::string, CNotificationpersistentservicePersonality *> Personality_Type;
+
+/**
+ * This class maintains information on creation of new personality or
+ * change of personality.
+ */
+class CnotificationpersistentservicePersonalizationManager {
+ private:
+ Personality_Type *m_pmPersonality; ///< list of personality
+
+ UI_32 m_uiUserId; ///< unique user id
+
+ std::string m_cCurrentPersonality; ///< current personality name
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreatePersonality
+ /// This function is used to create new Personality.
+ ///
+ /// \param [IN] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreatePersonality(const std::string &f_cpersonalityname);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CnotificationpersistentservicePersonalizationManager
+ /// Constructor of CnotificationpersistentservicePersonalizationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CnotificationpersistentservicePersonalizationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CnotificationpersistentservicePersonalizationManager
+ /// Destructor of CnotificationpersistentservicePersonalizationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CnotificationpersistentservicePersonalizationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceGetPersonality
+ /// This function is used to get the current personality.
+ ///
+ /// \param [OUT] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceGetPersonality(std::string &f_cpersonalityname); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersonality
+ /// This function is used to set the new personality.
+ ///
+ /// \param [IN] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersonality(const std::string f_cpersonalityname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceIsValidPersonality
+ /// Check if user is valid or not.
+ ///
+ /// \param [IN] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return BOOL
+ /// TRUE - Valid user
+ /// FALSE - Not a valid user
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL NotificationpersistentserviceIsValidPersonality(const std::string f_cpersonalityname);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALIZATION_MANAGER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h b/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h
new file mode 100755
index 0000000..13b96a2
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeServices
+/// \brief This file contains declaration of all the protocols and structures related to profiling.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PROFILING_PROTOCOLS_INTERNAL_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PROFILING_PROTOCOLS_INTERNAL_H_
+
+
+#define NPS_PROFILE_NOTIFICATION_REQ 0x1AA
+#define NPS_PROFILE_NOTIFICATION_RESP 0x1BB
+
+#define NPS_PROFILE_PERSISTENCE_REQ 0x2AA
+#define NPS_PROFILE_PERSISTENCE_RESP 0x2BB
+
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PROFILING_PROTOCOLS_INTERNAL_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h b/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h
new file mode 100755
index 0000000..3cb475e
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h
@@ -0,0 +1,330 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CRegistryEntry class.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "ns_npp_types.h"
+
+/**
+ * This class contains the registry information of the files/folders to be peresisted.
+ */
+class CRegistryEntry {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CRegistryEntry
+ /// Constructor of CRegistryEntry class
+ ///
+ /// \param [OUT] f_ctag
+ /// std::string& - File or Folder tag
+ ///
+ /// \param [OUT] f_crequester
+ /// std::string& - Requester Name
+ ///
+ /// \param [OUT] f_cstoragepath
+ /// std::string& - File or Folder persistence storage path
+ ///
+ /// \param [IN] f_bisuserpersistence
+ /// BOOL - File or Folder is user specific
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CRegistryEntry(const std::string &f_ctag, const std::string &f_crequester,
+ const std::string &f_cstoragepath, BOOL f_bisuserpersistence);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CRegistryEntry
+ /// Copy Constructor of CRegistryEntry class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRegistryEntry(const CRegistryEntry &f_objin);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// operator=
+ /// Operator overload =
+ ///
+ /// \param [IN] f_objin
+ /// CRegistryEntry& - In object.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRegistryEntry &operator=(const CRegistryEntry &f_objin); // NOLINT (readability/naming)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReleasePath
+ /// Set release path.
+ ///
+ /// \param [IN] f_creleasepath
+ /// std::string& - Path of the file/folder to be released.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetReleasePath(const std::string &f_creleasepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetBeingPersisted
+ /// Set the file/folder persist member variable to true to notify that the file/folder is being
+ /// persisted.
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetBeingPersisted();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AckReceived
+ /// Ack from copy worker received. Process the ack.
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID AckReceived();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsReleased
+ /// Check if File/folder released or not.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if file/folder is released else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsReleased() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// HasntBeenPersisted
+ /// File persisted or not
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if file is not persisted else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL HasntBeenPersisted() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsPersisted
+ /// File/Folder persisted or not
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if file/folder is persisted else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsPersisted() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsAckPending
+ /// Ack is pending or not.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if ack is pending else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsAckPending() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistPath
+ /// Get the persist path.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the persist path.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetPersistPath() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetReleasePath
+ /// Get the release path.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the release path.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetReleasePath() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetLoadPath
+ /// Get the load path.
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - type of persisted data
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - Current user name
+ ///
+ ///
+ /// \return std::string
+ // std::string - Returns the load path.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetLoadPath(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequester
+ /// Get the name of requester.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the name of requester.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetRequester() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetTag
+ /// Get the tag.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the tag.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetTag() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsUserPersistence
+ /// Returns TRUE if it is a user persistence.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - Returns TRUE if it is a user persistence.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsUserPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetCurrentAction
+ /// Set current copying action of a the corresponding tag.
+ ///
+ /// \param [IN] f_ecurrentaction
+ /// ENPS_Loadtype - Current action
+ ///
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetCurrentAction(ENPS_Loadtype f_ecurrentaction);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetPersistedFlag
+ /// Reset Persist flags
+ ///
+ /// \param
+ ///
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ResetPersistedFlag();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistProperties
+ /// creates persistence path and stores the persist type
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - Set persist type
+ /// \param [IN] f_cusername
+ /// std::string - Username related to persist tag if any.
+ ///
+ ///
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetPersistProperties(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername = "");
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistType
+ /// Returns persist type of a job
+ ///
+ /// \param
+ ///
+ /// \return ENotificationpersistentservicePersistType
+ // ENotificationpersistentservicePersistType - Returns persist type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ENotificationpersistentservicePersistType GetPersistType() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persistent type related to tag
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentCategory
+ /// Returns persistent type of tag
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedPersistCategory
+ // EFrameworkunifiedPersistCategory - Returns persistent type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedPersistCategory GetPersistentCategory();
+
+ ENPSPersistenceJobState m_eJobState; // Current state of a job
+
+ private:
+ std::string m_cTag; // File/Folder tag
+ std::string m_cRequestor; // Requester application name
+ BOOL m_bIsReleased; // if file or folder released
+ BOOL m_bIsPersisted; // if file or folder is persisted
+ std::string m_cPersistPath; // Persist path
+ std::string m_cReleasePath; // Release path
+ std::string m_cBasePath; // Persist base path
+ BOOL m_bIsUserPersistence; // If user persistence
+ ENPS_Loadtype m_eCurrentAction; // Current action to load file to/from
+ /// temporary/persistence memory
+ ENotificationpersistentservicePersistType m_ePersistType;
+ EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h
new file mode 100755
index 0000000..da5427d
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h
@@ -0,0 +1,109 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CRegularNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGULAR_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGULAR_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_notification.h"
+
+/**
+ * This class inherits CNotification class and implements regular notification related operations.
+ */
+class CRegularNotification : public CNotification {
+ private:
+ // no members in private
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CRegularNotification
+ /// Constructor of CRegularNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRegularNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CRegularNotification
+ /// Destructor of CRegularNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CRegularNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventReciever
+ /// This function adds the name of the application to receiver list of particular notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+};
+
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGULAR_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h
new file mode 100755
index 0000000..26edf73
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h
@@ -0,0 +1,177 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStateNorPersistenceNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_state_notification.h"
+
+/**
+ * This class inherits CStateNotification class and implements specific operations related to
+ * nor persistent notifications.
+ */
+class CStateNorPersistenceNotification : public CStateNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStateNorPersistenceNotification
+ /// Constructor of CStateNorPersistenceNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - delay
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStateNorPersistenceNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize,
+ const UI_32 f_uidelay,
+ const EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStateNorPersistenceNotification
+ /// Destructor of CStateNorPersistenceNotification class
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CStateNorPersistenceNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceDelay
+ /// Method to get the persistence delay for a specific notification.
+ ///
+ /// \param
+ ///
+ /// \return UI_32
+ // UI_32 - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetPersistenceDelay();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients and saves the data
+ /// immediately to persistent memory.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PublishNotification
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PublishNotification(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentCategory
+ /// Gets the persist type of notification
+ ///
+ ///
+ /// \return EFrameworkunifiedPersistCategory
+ // EFrameworkunifiedPersistCategory - persist type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedPersistCategory GetPersistentCategory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persist type of notification
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory);
+ // Handle of the immediate persistence worker thread.
+ static HANDLE m_hNSImmediatePersistenceThread; // NOLINT (readability/naming)
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SaveDataToNor
+ /// Saves the persistent data to nor
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SaveDataToNor(PVOID f_pmessage,
+ const UI_32 f_msgsize);
+
+ UI_32 m_uiDelay; // Time Delay between persistence on NOR
+
+ EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h
new file mode 100755
index 0000000..aaa6992
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h
@@ -0,0 +1,221 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStateNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_notification.h"
+
+class CPersistentData;
+
+/**
+ * This class inherits CNotification class and implements state and persistent notification
+ * related operations.
+ */
+class CStateNotification : public CNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStateNotification
+ /// Constructor of CStateNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStateNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStateNotification
+ /// Destructor of CStateNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CStateNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventReciever
+ /// This function adds the name of the application to receiver list of particular notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentData
+ /// This function get the data related to notification
+ ///
+ /// \param
+ ///
+ /// \return CPersistentData
+ // CPersistentData - notification data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ const CPersistentData *GetPersistentData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentData
+ /// This function is used to set the data related to notification
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SetPersistentData(PVOID f_pmessage,
+ const UI_32 f_msgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDefaultPersistentData
+ /// This function get the default data(if any) related to notification
+ ///
+ /// \param
+ ///
+ /// \return CPersistentData
+ // CPersistentData - notification data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ const CPersistentData *GetDefaultPersistentData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDefaultPersistentData
+ /// This function is used to set the default data related to notification
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SetDefaultPersistentData(PVOID f_pmessage,
+ const UI_32 f_msgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsPublished
+ /// This functions returns the published status of notification.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - returns true if published before
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsPublished();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetMaxMessageSize
+ /// This function reset the max size of data that can be published with notification.
+ /// Also deletes the old persistent data and default data.
+ ///
+ /// \param [IN] f_uilength
+ /// std::string - Max size for notification data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ResetMaxMessageSize(const UI_32 f_uilength);
+
+ protected:
+ CPersistentData *m_pData; ///< persistent data of notification
+
+ CPersistentData *m_pDefaultData; ///< persistent data of notification
+
+ BOOL m_bWasPublished; ///< Flag to check whether publisher had published notification
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetData
+ /// This function is used to set the persistent data
+ ///
+ /// \param [IN] f_pdata
+ /// CPersistentData - persistent data ptr
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetData(CPersistentData *f_pdata,
+ PVOID f_pmessage,
+ const UI_32 f_msgsize);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h
new file mode 100755
index 0000000..1123941
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStatePersistenceNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <string>
+#include "ns_npp_state_notification.h"
+
+/**
+ * This class inherits CStateNotification class and implements specific operations related to
+ * persistent notifications.
+ */
+class CStatePersistenceNotification : public CStateNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStatePersistenceNotification
+ /// Constructor of CStatePersistenceNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStatePersistenceNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize,
+ const EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStatePersistenceNotification
+ /// Destructor of CStatePersistenceNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CStatePersistenceNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentCategory
+ /// Gets the persist type of notification
+ ///
+ ///
+ /// \return EFrameworkunifiedPersistCategory
+ // EFrameworkunifiedPersistCategory - persist type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedPersistCategory GetPersistentCategory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persist type of notification
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ private:
+ EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h
new file mode 100755
index 0000000..8423e3e
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h
@@ -0,0 +1,73 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStatePersistenceUserNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_USER_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_USER_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_state_notification.h"
+
+
+/**
+ * This class inherits CStateNotification class and implements specific operations related to
+ * persistent notifications specific to user.
+ */
+class CStatePersistenceUserNotification : public CStateNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStatePersistenceUserNotification
+ /// Constructor of CStatePersistenceUserNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStatePersistenceUserNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStatePersistenceUserNotification
+ /// Destructor of CStatePersistenceUserNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CStatePersistenceUserNotification();
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_USER_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_threads.h b/nsframework/notification_persistent_service/server/include/ns_npp_threads.h
new file mode 100755
index 0000000..042e857
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_threads.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_THREADS_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_THREADS_H_
+
+// name of threads
+#define NS_NPP_READ_THREAD_NAME "NS_NPPReadWkr"
+#define NS_NPP_WRITE_THREAD_NAME "NS_NPPWriteWkr"
+#define NS_NPP_IMMEDIATE_PERSIST_THREAD_NAME "NS_NPPIPWkr"
+#define NS_NPP_DATA_RESET_THREAD_NAME "NS_NPPDataRst"
+
+// priority of threads
+#define NS_NPP_READ_THREAD_PRIO 15
+#define NS_NPP_WRITE_THREAD_PRIO 15
+#define NS_NPP_IMMEDIATE_PERSIST_THREAD_PRIO 25
+#define NS_NPP_DATA_RESET_THREAD_PRIO 10
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_THREADS_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_types.h b/nsframework/notification_persistent_service/server/include/ns_npp_types.h
new file mode 100755
index 0000000..79a44d7
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_types.h
@@ -0,0 +1,212 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
+
+#include <native_service/frameworkunified_sm_eventdata.h>
+#include <aglpath.h>
+#include <native_service/ns_np_types.h>
+
+// name of notification file to be saved in persistent memory depending on the persistent type category
+
+#define NOTIFICATIONFILE "PERSISTENT_NOTIFICATION" // stores user notification common to all user
+#define USERNOTIFICATIONFILE "USER_PERSISTENT_NOTIFICATION" // stores user notification specific to particular user
+#define FACTORYNOTIFICATIONFILE "FACTORY_NOTIFICATION" // stores factory notification
+#define FACTORYCUSTOMERNOTIFICATIONFILE "FACTORYCUSTOMER_NOTIFICATION" // stores factorycustomer notification
+#define DEALERNOTIFICATIONFILE "DEALER_NOTIFICATION" // stores dealer notification
+
+// name of persistence folder for persistent type categorization
+#define USERDATA "UserData" // name of folder contatining userdata
+#define FACTORYDATA "FactoryData" // name of folder contatining factory data
+#define FACTORYCUSTOMERDATA "FactoryCustomerData" // name of folder contatining factory customer data
+#define DEALERDATA "DealerData" // name of folder contatining dealer data
+
+// default user name for personalization
+#define DEFAULTUSERNAME "DefaultUser"
+
+// name of NSNPS version file
+#define VERSION_TXT "version.txt"
+
+#define STORAGE_PATH "/nv/BS/ns/npp/rwdata/"
+
+
+typedef enum ENPSLoadType {
+ LOADTYPE_NONE = -1,
+ LOADTYPE_RELEASE = 0, // load file to persistent memory
+ LOADTYPE_LOAD = 1, // load file to temporary memory
+ LOADTYPE_RELOAD = 2, // reload the file.
+} ENPS_Loadtype;
+
+/// \typedef ENotificationpersistentservicePersistType
+/// \brief Persist file types
+typedef enum ENotificationpersistentservicePersistType {
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST = 0, ///< Add values after this value only.
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE, ///< Persist a file to a persistent memory
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, ///< Persist a folder to a persistent memory
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTNONE, ///< no type
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST, ///< Add values before this value only.
+} ENotificationpersistentservicePersistType;
+
+typedef enum ENPSPersistenceJobState {
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE = 0, ///< Job is idle. // NOLINT (readability/naming)
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS = 1, ///< Job is in process. Either release or load. // NOLINT (readability/naming)
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED = 2, ///< Job release was aborted due to abort shutdown. // NOLINT (readability/naming)
+} ENPSPersistenceJobState;
+
+typedef CHAR CopyInfoStr[MAX_PATH_LENGTH]; ///< Information passed via the framework
+
+
+typedef enum ENPSCopyWorkerProtocol {
+ // > Command(s)
+ CP_WRK_CMD_START = 1500,
+ CP_WRK_CMD_STOP = 1501,
+ CP_WRK_CMD_COPY = 1502,
+ CP_WRK_CMD_RESUME = 1503, // This will release the thread from the abort command.
+
+ // < Command Ack(s)
+ CP_WRK_ACK_CMD_COMPLETE = 1504,
+
+ // < Notification(s)
+ CP_WRK_NTFY = 1505,
+
+ // < Shutdown request command
+ CMD_WRK_SHUTDOWN_REQ = 1506,
+ CMD_WRK_SHUTDOWN_ACK = 1507,
+
+ CMD_DELETE_OLD_DATA = 1508,
+
+ AR_CMD_START = 1400,
+ AR_CMD_STOP = 1401,
+ AR_CMD_ARCHIVE = 1402,
+ AR_CMD_RESUME = 1403, // This will release the thread from the abort command.
+
+ // < Command Ack(s)
+ AR_ACK_CMD_COMPLETE = 1404,
+
+ // < Notification(s)
+ AR_CMD_NTFY = 1405,
+
+ NOR_PERSISTENCE_TIMER_START = 1406,
+ NOR_PERSISTENCE_REGISTER = 1407,
+ NOR_PERSISTENCE_UNREGISTER = 1408,
+ // this cmd is used to tell the NOR thread to stop the timer
+ // for all the the notifications in case of userdata reset during shutdown
+ NOR_PERSISTENCE_ONSHUTDOWN = 1409,
+ // while to persist the data immediately irrespective of delay in case of shutdown without userdata reset.
+ // ack sent to NPPService main thread by Nor worker thread after persisting immediate data
+ NOR_PERSISTENCE_ONSHUTDOWN_ACK = 1410,
+ // message sent by main thread to immediate persistence thread
+ // to change the persistent category of immediate notification
+ NOR_PERSISTENCE_CHANGE_CATEGORY = 1411
+} ENSP_CopyWorkerProtocol, *PENSP_CopyWorkerProtocol, ENPS_ArchiveProtocol;
+
+
+typedef enum ENPSCopyWorkerFailures {
+ // > Failure codes(s)
+ CP_WRK_FAILURE_SRC_NOT_FND = 3500,
+ CP_WRK_FAILURE_DST_CREATE = 3501,
+ CP_WRK_FAILURE_ABORT_DURING_CP = 3502,
+ CP_WRK_FAILURE_ABORT_BEFORE_CP = 3503,
+ CP_WRK_FAILURE_WRITE_ERROR_CP = 3504,
+
+ AR_THREAD_FAILURE_SRC_NOT_FND = 3400,
+ AR_THREAD_FAILURE_DST_CREATE = 3401,
+ AR_THREAD_FAILURE_ABORT_DURING_ARCHIVE = 3402,
+ AR_THREAD_FAILURE_ABORT_BEFORE_ARCHIVE = 3403,
+} ENPS_CopyWorkerFailures, *PENPS_CopyWorkerFailures, ENPS_ArchiveFailures;
+
+typedef struct NPSCopyAckMsg {
+ ENSP_CopyWorkerProtocol m_eworkerprotocol; // Worker Load or Release Protocol Id
+} NSP_CopyAckMsg;
+
+typedef enum NotificationpersistentserviceCompressionType {
+ ENOTIFICATIONPERSISTENTSERVICENONE = 0, /// No Compression before file persistence
+ ENOTIFICATIONPERSISTENTSERVICEDEFAULTCOMPRESSION, /// Compress file before persistence using default compression method
+ ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ /// Compress file before persistence using libz
+} NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE;
+
+typedef struct NPSCopyInfoMsg {
+ CopyInfoStr m_csourcepath; // Source path
+ CopyInfoStr m_cdestinationpath; // Destination path
+ CopyInfoStr m_cpersistenttag; // Tag for Persistence
+ CopyInfoStr m_crequesterappname; // Requester Name
+ ENPS_Loadtype m_eloadtype; // Load to Persistent or Temporary Memory
+ ENotificationpersistentservicePersistType m_epersisttype; // Folder or File Persistence
+ NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_ecompressiontype; // Check for Compression of the file
+} NSP_CopyInfoCmd;
+
+typedef struct NPSCopyStatus {
+ BOOL m_bpersistencechk; // Persistence Success or Failure
+ ENPS_CopyWorkerFailures m_ecopyfailures; // Failure Protocol ID
+ CopyInfoStr m_cpersistenttag; // Tag for Persistence
+ CopyInfoStr m_crequesterappname; // Requester Name
+ ENPS_Loadtype m_eloadtype; // Load to Persistent or Temporary Memory
+ ENotificationpersistentservicePersistType m_epersisttype; // Folder or File Persistence
+ NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_ecompressiontype; // Check for Compression of the file
+} NSP_CopyStatusResponse, NSP_CopyCancel;
+
+
+// Structure for Nor Persistent Notification
+typedef struct TNorPersistenceNotifInfoHeader {
+ CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
+ UI_32 m_uimaxmsglength; ///< Maximum data length of notification
+ EFrameworkunifiedNotificationType m_epersistenttype; ///< type of notification
+ CHAR m_cpublishername[MAX_NAME_SIZE_APP]; ///< Service Name
+ UI_32 m_uimsgsize; ///< length of message
+ UI_32 m_uidelay; ///< Time delay between persistence
+ EFrameworkunifiedPersistCategory m_epersistcategory; ///< Persistent Category
+} TNorPersistenceNotifInfoHeader;
+
+typedef struct _TImmediatePersistenceRegisterNotifInfo { // NOLINT (readability/naming)
+ CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
+ UI_32 m_uidelay; ///< Time delay between persistence
+ EFrameworkunifiedPersistCategory m_epersistcategory; ///< Persistent Category
+} TImmediatePersistenceRegisterNotifInfo;
+
+typedef struct _TImmediatePersistenceUnregisterNotifInfo { // NOLINT (readability/naming)
+ CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
+} TImmediatePersistenceUnregisterNotifInfo;
+
+typedef struct _NPS_CopyShutdown { // NOLINT (readability/naming)
+ CopyInfoStr m_crequesterappname;
+} NSP_CopyShutdown, NSP_CopyShutdownAck;
+
+typedef struct _TImmediatePersistenceChangeCategory { // NOLINT (readability/naming)
+ TNorPersistenceNotifInfoHeader m_tnornotifInfoheader; ///< Notification info with new persist category type
+ EFrameworkunifiedPersistCategory m_eoldpersistcategory; ///< Old Persistent Category of notification
+} TImmediatePersistenceChangeCategory;
+
+typedef struct _TImmediateShutdown { // NOLINT (readability/naming)
+ EFrameworkunifiedShutdownType f_eshutdowntype;
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag;
+} TImmediateShutdown;
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
diff --git a/nsframework/notification_persistent_service/server/src/app_states.cpp b/nsframework/notification_persistent_service/server/src/app_states.cpp
new file mode 100755
index 0000000..c54508b
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/app_states.cpp
@@ -0,0 +1,2684 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of internal transitions of state machine
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <unistd.h>
+#include <native_service/ns_np_service.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_notification.h>
+#include <string>
+#include <vector>
+#include "app_states.h"
+#include "ns_npp.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_notification_manager.h"
+#include "ns_npp_persistence_manager.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_personalization_manager.h"
+
+
+#ifdef NPP_PROFILEINFO_ENABLE
+#include <ns_npp_profiling_protocols_internal.h>
+#endif
+
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+#endif
+
+static size_t NppUIToA(unsigned int value, char *buf) {
+ static const char c[] = "0123456789";
+ char b[12];
+ char *p = b + sizeof(b);
+ int i = 0;
+
+ *--p = '\0';
+ do {
+ *--p = c[value % 10];
+ value /= 10;
+ ++i;
+ } while (value);
+ strcpy(buf, p); // NOLINT (runtime/printf)
+
+ return i;
+}
+
+static size_t NppStrlcpy(char *dst, const char *src, size_t siz) {
+ size_t ret = strlen(src);
+
+ if (siz) { // LCOV_EXCL_BR_LINE 6: siz can't be 0
+ size_t len = (ret >= siz) ? siz - 1 : ret;
+ memcpy(dst, src, len);
+ dst[len] = '\0';
+ }
+ return ret;
+}
+
+#define NPP_SET_FIXSTR(buf, str) \
+ do { \
+ strcpy(buf, str); /* NOLINT (runtime/printf) */ \
+ buf += sizeof(str) - 1; \
+ } while (0)
+
+#define NPP_SET_VARSTR(buf, str, siz) \
+ buf += NppStrlcpy(buf, str, siz)
+
+extern CHAR g_csendreadyackto[];
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPRegisterNotifications
+/// The state machine executes this transition when event for registering notification is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterNotifications) { // NOLINT (readability/naming)
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_register_multiple_notif_msg *l_pMsg = NULL;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get app name of message source
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register notifications. Invalid message length received."); // LCOV_EXCL_LINE 6: l_uiMsgLength must be greater than 0 // NOLINT[whitespace/line_length]
+ } else {
+ std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(
+ l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) {
+ l_pMsg = reinterpret_cast<NC_register_multiple_notif_msg *>(&l_vData[0]);
+
+ if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
+ NC_register_notif_msg *l_pEventInfo = NULL;
+
+ // register all the notifications
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_pMsg->numNotifications;
+ ++l_uiCount) {
+ l_pEventInfo = &l_pMsg->notifierList[l_uiCount];
+
+ if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Register Notfn request, src=%s, name=%s, len=%d, type=%d",
+ l_cMsgSource, l_pEventInfo->notificationName, l_pEventInfo->maxLength, l_pEventInfo->persType);
+
+ // register the notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(l_cMsgSource,
+ l_pEventInfo->notificationName,
+ l_pEventInfo->maxLength,
+ l_pEventInfo->persType)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnRegisterEvents :: %s", l_pEventInfo->notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register notification from source %s. l_pEventInfo is NULL", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid src mq"); // LCOV_EXCL_LINE 6: l_pMsg can't be NULL
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register notifications from source %s, Unable to get message data. Error Status: 0x%x",
+ l_cMsgSource, l_estatus);
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pNotificationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSubscribeToNotification
+/// The state machine executes this transition when event for subscribing single notification is
+/// triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotification) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_subscribe_msg l_objSubscribeMsg;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_subscribe_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // get the data received
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_objSubscribeMsg), sizeof(NC_subscribe_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+#ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
+ char buf[128];
+ char *p = buf;
+ NPP_SET_FIXSTR(p, "Subscribing Notfn request, src=");
+ NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
+ NPP_SET_FIXSTR(p, ", name=");
+ strcpy(p, l_objSubscribeMsg.notificationName); // NOLINT (runtime/printf)
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
+ /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ * "Subscribing Notfn request, src=%s, name=%s",
+ * l_cMsgSource, l_objSubscribeMsg.notificationName);*/
+#endif // ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
+
+ // subscribe for notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnSubscribeToEvent(
+ l_cMsgSource,
+ l_objSubscribeMsg.notificationName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnSubscribeToEvent :: %s", l_objSubscribeMsg.notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't subscribe to notification from source %s. Unable to get msg data, status: 0x%x",
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't subscribe to notification from source %s. Invalid message length received.",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't subscribe to notification from source %s. l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSubscribeToNotifications
+/// The state machine executes this transition when event for subscribing multiple notification is
+/// triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotifications) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_subscribe_multiple_notif_msg *l_pMsg = NULL;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
+ // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid msg len");
+ // LCOV_EXCL_STOP
+ } else {
+ std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the data received
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_pMsg = reinterpret_cast<NC_subscribe_multiple_notif_msg *>(&l_vData[0]);
+
+ if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
+ NC_subscribe_msg *l_pEventInfo = NULL;
+
+ // subscribe to multiple notifications
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_pMsg->numNotifications;
+ ++l_uiCount) {
+ l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
+
+ if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
+#ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
+ char buf[128];
+ char *p = buf;
+ NPP_SET_FIXSTR(p, "Subscribe Notfn request, src=");
+ NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
+ NPP_SET_FIXSTR(p, ", name=");
+ strcpy(p, l_pEventInfo->notificationName); // NOLINT (runtime/printf)
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
+ /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "Subscribe Notfn request, src=%s, name=%s",
+ l_cMsgSource,
+ l_pEventInfo->notificationName);*/
+#endif // ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
+
+ // subscribe to notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnSubscribeToEvent(
+ l_cMsgSource,
+ l_pEventInfo->notificationName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnSubscribeToEvent :: %s", l_pEventInfo->notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to subscribe to notifications from source %s, l_pEventInfo is NULL", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pMsg can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to subscribe to notifications from source %s, Invalid src mq", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+
+ l_vData.clear();
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to subscribe to notifications from source %s, error retrieving message data, status: 0x%x",
+ l_cMsgSource,
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to subscribe to notifications from source %s, l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPPublishNotification
+/// The state machine executes this transition when event for publishing notification is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishNotification) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+
+ CHAR l_cData[MAX_SYS_INFO_SIZE];
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get the app name of message source
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ // retrieve notification name
+ FrameworkunifiedGetSystemInfo(l_pHApp, l_cData);
+
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ char buf[144];
+ char *p = buf;
+ NPP_SET_FIXSTR(p, "Publish Notfn request, src=");
+ NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
+ NPP_SET_FIXSTR(p, ", name=");
+ NPP_SET_VARSTR(p, l_cData, sizeof(buf) - (p - buf));
+ NPP_SET_FIXSTR(p, ", len=");
+ NppUIToA(l_uiMsgLength, p);
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
+ /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "Publish Notfn request, src=%s, name=%s, len=%d",
+ l_cMsgSource, l_cData, l_uiMsgLength);*/
+
+ if (0 != l_uiMsgLength) {
+ std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], static_cast<UI_32>(pMsgData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // publish the notification
+ (VOID)l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(l_cMsgSource, l_cData,
+ (PVOID)&pMsgData[0], l_uiMsgLength);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't publish notification from source %s, Unable to get messsage data, Error Status: 0x%x",
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+ } else {
+ // publish the notification
+ (VOID)l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(l_cMsgSource, l_cData, NULL, l_uiMsgLength);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't publish notification from source %s. l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPUnSubscribeFromNotification
+/// The state machine executes this transition when event for unsubscribing notification is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotification) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_unsubscribe_frm_notif_msg unsubscribeMsg;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get the msg source name
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 200: l_pNotificationManager can't be NULL
+ if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_unsubscribe_frm_notif_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&unsubscribeMsg), sizeof(NC_unsubscribe_frm_notif_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source: %s is unsubscribing from notification: %s", l_cMsgSource,
+ unsubscribeMsg.notificationName);
+
+ // unsubscribe from notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnSubscribeFromEvent(
+ l_cMsgSource,
+ unsubscribeMsg.notificationName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnUnSubscribeFromEvent :: %s",
+ unsubscribeMsg.notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "%s is unable to subscribe from notification, error getting message data, status: 0x%x",
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe to notification from source %s, Invalid Message size received.",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe to notification from source %s, l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPUnSubscribeFromNotification
+/// The state machine executes this transition when event for unsubscribing notification is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotifications) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_unsubscribe_multiple_notif_msg *l_pMsg = NULL;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
+ // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe from notifications from source %s. Invalid message length received",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ } else {
+ std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the data received
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_pMsg = reinterpret_cast<NC_unsubscribe_multiple_notif_msg *>(&l_vData[0]);
+
+ if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
+ NC_unsubscribe_frm_notif_msg *l_pEventInfo = NULL;
+
+ // subscribe to multiple notifications
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_pMsg->numNotifications;
+ ++l_uiCount) {
+ l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
+
+ if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source: %s is unsubscribing from notification: %s", l_cMsgSource,
+ l_pEventInfo->notificationName);
+
+ // unsubscribe from notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnSubscribeFromEvent(
+ l_cMsgSource,
+ l_pEventInfo->notificationName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnUnSubscribeFromEvent :: %s", l_pEventInfo->notificationName);
+ }
+
+ } else {
+ // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe from notifications from source %s. l_pEventInfo is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pMsg can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe from notifications from source %s. Invalid src mq", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+
+ l_vData.clear();
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe from notifications from source %s, error getting message data, status: 0x%x",
+ l_cMsgSource,
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe from notifications from source %s. l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPUnRegisterNotifications
+/// The state machine executes this transition when event for unregistering notifications is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnRegisterNotifications) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_unregister_multiple_notif_msg *l_pMsg = NULL;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get the source name
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
+ // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unregister to notifications from source %s. Invalid message length received.",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ } else {
+ std::vector<CHAR>l_vData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_pMsg = reinterpret_cast<NC_unregister_multiple_notif_msg *>(&l_vData[0]);
+
+ // unregister multiple notifications
+ if (NULL != l_cMsgSource && NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_cMsgSource and l_pMsg can't be NULL
+ NC_unregister_notif_msg *l_pEventInfo = NULL;
+
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_pMsg->numNotifications;
+ ++l_uiCount) {
+ l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
+
+ if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source %s is unregistering to notification %s", l_cMsgSource,
+ l_pEventInfo->notificationName);
+
+ // unregister notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnRegisterEvents(
+ l_cMsgSource,
+ l_pEventInfo->notificationName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnUnRegisterEvents :: %s", l_pEventInfo->notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unregister to notifications from source %s, l_pEventInfo is NULL", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_cMsgSource and l_pMsg can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unregister to notificationsfrom source %s, Invalid src mq ", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+
+ l_vData.clear();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unregister to notifications from source %s, Unable to get message data, status: 0x%x",
+ l_cMsgSource, l_estatus);
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unregister to notifications from source %s, l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPReadPersistedData
+/// The state machine executes this transition when event for getting notification's persistent data
+/// is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPReadPersistedData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_get_pers_data_msg l_tMsg;
+
+ l_tMsg.notificationName[0] = '\0';
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_get_pers_data_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // get the message data received
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(NC_get_pers_data_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Source %s is requesting to read data for persistent notification %s",
+ l_cMsgSource, l_tMsg.notificationName);
+ // get persistent data related to notification
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceServiceOnGetPersistentData(
+ l_tMsg.notificationName,
+ l_cMsgSource))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in NotificationpersistentserviceServiceOnGetPersistentData :: %s", l_tMsg.notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't read persistent data for source %s, Error getting message data, status: 0x%x",
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't read persistent data for source %s. Invalid Message size received.",
+ l_cMsgSource);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't read persistent data for source %s. l_pNotificationManager is NULL",
+ l_cMsgSource);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ // if any error occurs while reading persistent data, send failed ack to the requestor
+ if (eFrameworkunifiedStatusOK != l_estatus) {
+ HANDLE l_hReceiverMq = McOpenSender(l_cMsgSource);
+ if (NULL != l_hReceiverMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ NC_get_persdata_failed_ack gpdFailed = {};
+ std::strncpy(&gpdFailed.notificationName[0], l_tMsg.notificationName, MAX_STRING_SIZE_NOTIFICATION);
+
+ // send the failure ack to requester
+ l_estatus = McSend(l_hReceiverMq, AppName, NPS_GET_PERS_DATA_FAILED_ACK, sizeof(gpdFailed), &gpdFailed); // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "Sent NPS_GET_PERS_DATA_FAILED_ACK to %s. Status: %d.",
+ l_cMsgSource, l_estatus);
+
+ McClose(l_hReceiverMq);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in opening sender queue of %s. Can't send NPS_GET_PERS_DATA_FAILED_ACK",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPPublishImmediateNotification
+/// This transition is executed when service updates the immediate notification data
+/// using synchronous API
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishImmediateNotification) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ // get the app name of message source
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+ CHKNULL(l_pNotificationManager);
+
+ CHAR l_cNotfName[MAX_SYS_INFO_SIZE] = {};
+
+ // retrieve notification name
+ (VOID)FrameworkunifiedGetSystemInfo(l_pHApp, l_cNotfName);
+
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Warning::Notification %s published using sync API by %s, Data length: %d",
+ l_cNotfName,
+ l_cMsgSource, l_uiMsgLength);
+
+ if (0 != l_uiMsgLength) {
+ std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], l_uiMsgLength, eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // publish the notification
+ (VOID)l_pNotificationManager->NotificationpersistentservicePublishImmediateNotification(l_cMsgSource, l_cNotfName, (PVOID)&pMsgData[0],
+ l_uiMsgLength);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't publish notification %s from source %s, Unable to get messsage data, Error Status: 0x%x",
+ l_cNotfName,
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // publish the notification
+ (VOID)l_pNotificationManager->NotificationpersistentservicePublishImmediateNotification(l_cMsgSource, l_cNotfName, NULL, l_uiMsgLength);
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPPersistentSync
+/// Processing which synchronizes by NPPService (syncfs)
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPersistentSync) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ if (TRUE == l_pnsnpp->Syncfs()) { // LCOV_EXCL_BR_LINE 6: always return true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "syncfs are processed."); // LCOV_EXCL_LINE 6: always return true
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPReleaseFileAck) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ NSP_CopyStatusResponse l_tCpStatus = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, (PVOID)&l_tCpStatus, sizeof(l_tCpStatus), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s for tag: %s sender: %s, persist type:%d",
+ (l_tCpStatus.m_bpersistencechk ? "Successful copy" : "Non-Successful copy"),
+ l_tCpStatus.m_cpersistenttag, l_tCpStatus.m_crequesterappname, l_tCpStatus.m_eloadtype);
+
+ if (LOADTYPE_LOAD == l_tCpStatus.m_eloadtype) { // ack for load file/folder
+ HANDLE hMq = NULL;
+ NC_LoadPersistedAck l_tMsgAck = {};
+
+ // HANDLE hMq = McOpenSender(l_tCpStatus.sender);
+ hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_tCpStatus.m_crequesterappname);
+
+ // send NC_LoadPersistedAck to the requester
+ l_tMsgAck.eStatus = (TRUE == l_tCpStatus.m_bpersistencechk) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
+
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_tMsgAck.cTag, l_tCpStatus.m_cpersistenttag, sizeof(l_tMsgAck.cTag));
+#endif
+
+ if (NULL == hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // catastrophic failure!
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s ", l_tCpStatus.m_crequesterappname); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ } else {
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == l_tCpStatus.m_epersisttype) {
+ // send ack to requester for file successfully persisted
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR :: Sending NPS_GET_PERS_FILE_ACK message to %s", l_tCpStatus.m_crequesterappname);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "NPS_GET_PERS_FILE_ACK is sent to %s for file tag %s and load status: %d.",
+ l_tCpStatus.m_crequesterappname, l_tMsgAck.cTag, l_tMsgAck.eStatus);
+ }
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == l_tCpStatus.m_epersisttype) { // LCOV_EXCL_BR_LINE 6: m_epersisttype must be ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE or ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER // NOLINT[whitespace/line_length]
+ // send ack to requester for folder successfully persisted
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_GET_PERS_FOLDER_ACK, sizeof(l_tMsgAck), &l_tMsgAck)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR :: Sending NPS_GET_PERS_FOLDER_ACK message to %s", l_tCpStatus.m_crequesterappname);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "NPS_GET_PERS_FOLDER_ACK is sent to %s for folder tag %s and load status: %d.",
+ l_tCpStatus.m_crequesterappname, l_tMsgAck.cTag, l_tMsgAck.eStatus);
+ }
+ } else {
+ // do nothing
+ }
+ // close mq
+ FrameworkunifiedMcClose(hMq);
+ hMq = NULL;
+ }
+ }
+
+ // Update registry
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ if (l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: unexpected branch can't be NULL
+ l_pPersistenceManager->AckReceivedFromWorker(l_tCpStatus.m_crequesterappname,
+ l_tCpStatus.m_cpersistenttag,
+ l_tCpStatus.m_epersisttype,
+ l_tCpStatus.m_bpersistencechk,
+ l_tCpStatus.m_eloadtype);
+ }
+
+ if (LOADTYPE_RELEASE == l_tCpStatus.m_eloadtype) {
+ f_pSourceState->FrameworkunifiedPostEvent(EVENT(evCheckAllFilesPersisted));
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR ::invalid length FrameworkunifiedGetMsgDataOfSize expected(%ld)", static_cast<long int>(sizeof(l_tCpStatus))); // NOLINT (runtime/int)
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnSaveDataAck) { // LCOV_EXCL_START 6: unused code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnUserChange
+/// The state machine executes this transition when event to set or change personality is received
+/// from the system.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnUserChange) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(f_pSourceState);
+ NC_User l_tMsg;
+ std::string l_cCurrentUsername;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ // TODO(my_username): Only accept user change from authorized app. Compare l_cMsgSource with authorized source.
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(NC_User), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: l_pnsnpp can't be NULL
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ CnotificationpersistentservicePersonalizationManager *l_pPersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+
+ if (NULL != l_pPersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersonalizationManager can't be NULL
+ l_pPersonalizationManager->NotificationpersistentserviceGetPersonality(l_cCurrentUsername);
+ }
+
+ // writes the temporary user files and folders to permanent memory
+ if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
+ if (!l_cCurrentUsername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_cCurrentUsername can't be empty
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentservicePersistAllUserRequests()) { // LCOV_EXCL_BR_LINE 6: NotificationpersistentservicePersistAllUserRequests will always return ok // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while persisting user files and folders."); // LCOV_EXCL_LINE 6: NotificationpersistentservicePersistAllUserRequests will always return ok // NOLINT[whitespace/line_length]
+ }
+ }
+ }
+
+ // save the user persistent notification data
+ if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentserviceSaveNotificationPersistentData(eFrameworkunifiedPersistedStateUserVar)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while NotificationpersistentserviceSaveNotificationPersistentData");
+ }
+ }
+
+ // set new personality
+ SetPersonality(l_pHApp, l_tMsg);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Cannot set new personality, error getting message data, status: 0x%x", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+// ===========Shutdown
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnShutdownTimeout) { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+// LCOV_EXCL_STOP
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceCheckAllReleaseRequestsProcessed) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ CHKNULL(l_pPersistenceManager);
+ if (TRUE == l_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: always return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All release requests are processed.");
+ f_pSourceState->FrameworkunifiedPostEvent(EVENT(evIdle));
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceReInitShutdownTimer) { // LCOV_EXCL_START 8: not be used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+// LCOV_EXCL_STOP
+
+CsNotificationpersistentserviceNPPStart::CsNotificationpersistentserviceNPPStart(std::string f_strName): CFrameworkunifiedOrthogonalState(f_strName) {
+}
+
+CsNotificationpersistentserviceNPPStart::~CsNotificationpersistentserviceNPPStart() { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CsNotificationpersistentserviceNPPStart::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // Get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ NC_User l_tMsg = {};
+
+ // register the user change notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(AppName, // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ NTFY_NPPService_UserChange,
+ sizeof(NC_User),
+ eFrameworkunifiedPersistedStateVar)) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in user change notification registration."); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ }
+
+ // Set initial user. By default, NS_NPPService will set the current user as last user. If no
+ // last user found set the default user.
+ UI_32 l_uiUserNotificationDataSize = 0;
+ EFrameworkunifiedStatus l_eGetNotificationDataStatus = eFrameworkunifiedStatusFail;
+ l_eGetNotificationDataStatus = l_pNotificationManager->NPGetPersistentNotificationData(
+ NTFY_NPPService_UserChange,
+ (PVOID)&l_tMsg,
+ sizeof(l_tMsg));
+
+ if ((eFrameworkunifiedStatusOK != l_eGetNotificationDataStatus) || (l_uiUserNotificationDataSize <= 0)) {
+ // set default user
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_tMsg.cUsername, DEFAULTUSERNAME, sizeof(l_tMsg.cUsername));
+#endif
+ }
+
+ l_estatus = SetPersonality(l_pHApp, l_tMsg);
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return l_estatus;
+}
+
+EFrameworkunifiedStatus SetPersonality(HANDLE l_pHApp, NC_User &f_tMsg) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: l_pnsnpp can't be NULL
+ // Get the instance of personalization manager
+ CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+
+ if (NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationpersistentservicePersonalizationManager can't be NULL
+ // send msg to all notificationpersistentservice apps that user has change.
+ // register user change notification
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality :: %s", f_tMsg.cUsername);
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceSetPersonality(f_tMsg.cUsername))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Personality not set in Personality Manager :: user : %s", f_tMsg.cUsername);
+ } else {
+ // Get the instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
+ l_pPersistenceManager->SetUserPersistentPath(f_tMsg.cUsername);
+
+ // save the user persistent notification data
+ if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentserviceLoadPersistentNotificationData(eFrameworkunifiedPersistedStateUserVar)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while loading user specific notification data.");
+ }
+
+ // Get instance of notification manager
+ CNotificationManager *l_pNotificationManager = NULL;
+ l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ // publish the user change notification
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(AppName, NTFY_NPPService_UserChange, (PVOID)&f_tMsg, sizeof(f_tMsg)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in publish user change event."); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ }
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationpersistentservicePersonalizationManager is NULL"); // LCOV_EXCL_LINE 6: l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return l_estatus;
+}
+
+EFrameworkunifiedStatus CsNotificationpersistentserviceNPPStart:: FrameworkunifiedOnExit(CEventDataPtr f_peventdata) { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+}
+
+CsNotificationpersistentserviceShutdownDataSave::CsNotificationpersistentserviceShutdownDataSave(std::string f_strName): CFrameworkunifiedLeafState(f_strName) {
+}
+
+CsNotificationpersistentserviceShutdownDataSave::~CsNotificationpersistentserviceShutdownDataSave() { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CsNotificationpersistentserviceShutdownDataSave::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ m_cShutdownRequestor = l_cMsgSource;
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "NS_NPP received STOP message from %s.", l_cMsgSource);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: can't be NULL
+ CShutDownMsgData *l_pMsgData = dynamic_cast<CShutDownMsgData *>(f_peventdata.get());
+ CHKNULL(l_pMsgData);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Shutdown Type=%d, Data received with shutdown message:: %x",
+ l_pMsgData->m_eShutdownType, l_pMsgData->m_uiMsgData);
+
+ // save the persistent data on shutdown
+ if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentservicePersistAll(l_pMsgData->m_eShutdownType, l_pMsgData->m_uiMsgData)) { // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in NotificationpersistentserviceOnSavePersistentData"); // LCOV_EXCL_LINE 6: always return ok
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CsNotificationpersistentserviceShutdownDataSave:: FrameworkunifiedOnExit(CEventDataPtr f_peventdata) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ CHKNULL(l_pPersistenceManager);
+
+ l_pPersistenceManager->ResetPersistFlag();
+
+ // before sending shutdown ack, synchronize all the modified block buffers by NPPService for writing
+ l_pnsnpp->Syncfs();
+
+ // Send shutdown ack response to requester
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Sending shutdown complete message to requestor %s.",
+ m_cShutdownRequestor.c_str());
+ HANDLE hMq = FrameworkunifiedMcOpenSender(l_pHApp, m_cShutdownRequestor.c_str());
+ if (NULL != hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_NPP_STOP_ACK, 0, NULL)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error sending shutdown complete message to requestor %s.",
+ m_cShutdownRequestor.c_str());
+ // LCOV_EXCL_STOP
+ }
+ FrameworkunifiedMcClose(hMq);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in OpenSender for requestor %s.", m_cShutdownRequestor.c_str()); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnRegisterPersistentFile
+/// The state machine executes this transition when event for registering persistent file tag is
+/// received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFile) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+ NC_RegisterPersistentFileMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ std::string l_cName;
+ l_cName = l_tMsg.cFileTag;
+
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRegister(l_cMsgSource, // LCOV_EXCL_BR_LINE 6: always return ok
+ l_tMsg.cFileTag,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
+ // l_tMsg.eRegisterType,
+ l_tMsg.bIsUserFile)) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Registering Persitence File :: %s", l_tMsg.cFileTag); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Registered File %s as TO BE PERSISTED for %s",
+ l_tMsg.cFileTag, l_cMsgSource);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent file. Invalid message size received."); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent file. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnReleasePersistentFile
+/// The state machine executes this transition when event for releasing persistent file tag is
+/// received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFile) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ // Check if persistence has been disabled than return immediately
+ if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return f_pSourceState; // LCOV_EXCL_LINE 6: custom command line options
+ }
+
+ CHKNULL(f_pSourceState);
+ NC_ReleasePersistentFileMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get the instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ // get the instance of persistence manager
+ CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // Check if the filetag is registered as user specific persistence
+ if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFileTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
+ if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRelease(l_cMsgSource,
+ l_tMsg.cFileTag,
+ l_tMsg.cFilePath,
+ l_tMsg.eFrameworkunifiedReleaseType, // NOLINT (readability/naming)
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
+ l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in releasing persitence file :: %s", l_tMsg.cFileTag);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Release file %s to tag %s for source %s",
+ l_tMsg.cFilePath, l_tMsg.cFileTag, l_cMsgSource);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent file. Invalid message size received"); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent file. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnLoadPersistentFile
+/// The state machine executes this transition when event for loading persistent file is received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFile) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+ NC_LoadPersistedFileMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+ // get the instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Load file %s that was PERSISTED by %s with tag %s",
+ l_tMsg.cFilePath, l_cMsgSource, l_tMsg.cFileTag);
+
+ // Check if the filetag is registered as user specific persistence
+ if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFileTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
+ if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+ }
+ }
+
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ NC_LoadPersistedAck l_tMsgAck = {};
+
+ HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
+
+ if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ //// Check if persistence has been disabled than send positive acknowledgement to the application
+ if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: custom command line options
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_tMsgAck.eStatus = eFrameworkunifiedStatusOK;
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_tMsgAck.cTag, l_tMsg.cFileTag, sizeof(l_tMsgAck.cTag));
+#endif
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pPersistenceManager->NotificationpersistentserviceLoad(l_cMsgSource,
+ l_tMsg.cFileTag,
+ l_tMsg.cFilePath,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
+ l_tMsg.cUsername))) {
+ if (eFrameworkunifiedStatusFileLoadSuccess == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus can't be eFrameworkunifiedStatusFileLoadSuccess // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_tMsgAck.eStatus = eFrameworkunifiedStatusOK; // LCOV_EXCL_LINE 6: l_estatus can't be eFrameworkunifiedStatusFileLoadSuccess
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Loading Persitence File :: %s", l_tMsg.cFileTag);
+
+ // return error to requester
+ l_tMsgAck.eStatus = l_estatus;
+ }
+
+ std::strncpy(l_tMsgAck.cTag, l_tMsg.cFileTag, (MAX_PATH_LENGTH - 1));
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "NPS_GET_PERS_FILE_ACK is sent to %s. File load status: %d, "
+ "message sent status: %d ", l_cMsgSource, l_tMsgAck.eStatus, l_estatus);
+ }
+ }
+
+ FrameworkunifiedMcClose(l_hMq);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // catastrophic failure!
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent file. Invalid message size received."); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent file. l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnRegisterPersistentFolder
+/// The state machine executes this transition when event for registering persistent folder tag is
+/// received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFolder) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+ NC_RegisterPersistentFolderMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, // LCOV_EXCL_BR_LINE 4: NSFW error case
+ static_cast<PVOID>(&l_tMsg),
+ sizeof(l_tMsg),
+ eSMRRelease)) {
+ std::string l_cName;
+ l_cName = l_tMsg.cFolderTag;
+
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRegister(l_cMsgSource, // LCOV_EXCL_BR_LINE 6: always return ok
+ l_tMsg.cFolderTag,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
+ // l_tMsg.eRegisterType,
+ l_tMsg.bIsUserFolder)) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Registering Persitence Folder :: %s", l_tMsg.cFolderTag); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Registered Folder %s as TO BE PERSISTED for %s",
+ l_tMsg.cFolderTag, l_cMsgSource);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent folder. Invalid message size received.");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent folder.. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnLoadPersistentFolder
+/// The state machine executes this transition when event for loading persistent folder is received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFolder) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+ NC_LoadPersistedFolderMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+
+ // get the instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Load folder %s that was PERSISTED by %s with tag %s",
+ l_tMsg.cFolderPath, l_cMsgSource, l_tMsg.cFolderTag);
+
+ // Check if the foldertag is registered as user specific persistence
+ if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFolderTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
+ if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+ }
+ }
+
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ NC_LoadPersistedAck l_tMsgAck = {};
+ HANDLE l_hMq = NULL;
+ l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
+
+ if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ //// Check if persistence has been disabled than send positive acknowledgement to the application
+ if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: custom command line options
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_tMsgAck.eStatus = eFrameworkunifiedStatusOK;
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_tMsgAck.cTag, l_tMsg.cFolderTag, sizeof(l_tMsgAck.cTag));
+#endif
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq,
+ NPS_GET_PERS_FOLDER_ACK,
+ sizeof(l_tMsgAck), &l_tMsgAck))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pPersistenceManager->NotificationpersistentserviceLoad(l_cMsgSource,
+ l_tMsg.cFolderTag,
+ l_tMsg.cFolderPath,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
+ l_tMsg.cUsername))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Loading Persitence Folder :: %s", l_tMsg.cFolderTag);
+
+ // return error to requester
+ l_tMsgAck.eStatus = l_estatus;
+ std::strncpy(l_tMsgAck.cTag, l_tMsg.cFolderTag, (MAX_PATH_LENGTH - 1));
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, // LCOV_EXCL_BR_LINE 4: NSFW error case
+ NPS_GET_PERS_FOLDER_ACK,
+ sizeof(l_tMsgAck), &l_tMsgAck))) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ FrameworkunifiedMcClose(l_hMq);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't send ack NPS_GET_PERS_FOLDER_ACK. McOpenSender failed for %s ", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent folder. Invalid message size received.");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent folder. l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnReleasePersistentFolder
+/// The state machine executes this transition when event for releasing persistent folder tag is
+/// received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFolder) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ // Check if persistence has been disabled than return immediately
+ if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options
+ // LCOV_EXCL_START 6: custom command line options
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+ // LCOV_EXCL_STOP
+ }
+
+ NC_ReleasePersistentFolderMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get the instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // Check if the foldertag is registered as user specific persistence
+ if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFolderTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
+ if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+ }
+ }
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRelease(l_cMsgSource,
+ l_tMsg.cFolderTag,
+ l_tMsg.cFolderPath,
+ l_tMsg.eFrameworkunifiedReleaseType, // NOLINT (readability/naming)
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
+ l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in releasing persitence folder :: %s", l_tMsg.cFolderTag);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Release Folder %s to tag %s for source %s",
+ l_tMsg.cFolderPath, l_tMsg.cFolderTag, l_cMsgSource);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent folder. Invalid message size received.");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent folder. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPGetReadyStatus
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPGetReadyStatus) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
+ if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_READYSTATUS_ACK, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __PRETTY_FUNCTION__, "NPP ready status sent to %s.", l_cMsgSource);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error sending NPS_GET_READYSTATUS_ACK to %s, status: %d", l_cMsgSource,
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+
+ FrameworkunifiedMcClose(l_hMq);
+ l_hMq = NULL;
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // catastrophic failure!
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s ", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterImmediateNotifications) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_register_multiple_immediate_notif_msg *l_pMsg = NULL;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get app name of message source
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
+ // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register immediate persistence notification from source %s. Invalid message length.",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ } else {
+ std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_pMsg = reinterpret_cast<NC_register_multiple_immediate_notif_msg *>(&l_vData[0]);
+
+ if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 5: reinterpret_cast's error case.
+ NC_register_immediate_notif_msg *l_pEventInfo = NULL;
+ UI_32 l_uiCount;
+ // register all the notifications
+ for (l_uiCount = 0 ; l_uiCount < l_pMsg->numNotifications; ++l_uiCount) {
+ l_pEventInfo = &l_pMsg->notifierList[l_uiCount];
+
+ if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Register immediate persistence notification: "
+ "NotificationName[%d] = %s, data length = %d ",
+ l_uiCount, l_pEventInfo->notificationName, l_pEventInfo->maxLength);
+
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(l_cMsgSource,
+ l_pEventInfo->notificationName,
+ l_pEventInfo->maxLength,
+ l_pEventInfo->persType,
+ l_pEventInfo->delay)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnRegisterEvents :: %s", l_pEventInfo->notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register immediate persistence notification from source %s. l_pEventInfo is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 5: reinterpret_cast's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register immediate persistence notification from source %s. Invalid src mq",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register immediate persistence notification from source %s, "
+ "Error getting message data, status: 0x%x",
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register immediate persistence notification from source %s. "
+ "l_pNotificationManager is NULL", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPClearPersistedData
+/// Deletes NPS Persistent Data and sends the ack back to requester
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPClearPersistedData) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+
+ // requeter MsgQ handle for sending Ack
+ HANDLE hRequesterAck = NULL;
+
+ // Application Handle
+ HANDLE l_pHApp = NULL;
+
+ // Received request data
+ NC_ClearPersistedDataReq l_tMsg = {};
+
+ // Ack structure
+ NC_ClearPersisteDatadAck l_tMsgAck = {};
+
+ // requester name
+ PCSTR pRequester = NULL;
+
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ pRequester = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(pRequester);
+
+ if (sizeof(NC_ClearPersistedDataReq) == FrameworkunifiedGetMsgLength(l_pHApp)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, (PVOID)(&l_tMsg), sizeof(NC_ClearPersistedDataReq), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Request for deleting the persistent data of type %d received from %s",
+ l_tMsg.ePersistenceData, pRequester);
+
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ CHKNULL(l_pPersistenceManager);
+
+ l_estatus = l_pPersistenceManager->ClearPersistenceData(l_tMsg.ePersistenceData);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize Error");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't delete persistent data. Invalid message size received.");
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ // sending acknowledgement to the requester
+
+ // create the requestor handle to send the ack
+ hRequesterAck = FrameworkunifiedMcOpenSender(l_pHApp,
+ pRequester);
+
+ if (NULL != hRequesterAck) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // set the status
+ l_tMsgAck.eStatus = l_estatus;
+
+ // send NC_ClearPersisteDatadAck to the requester
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hRequesterAck, // LCOV_EXCL_BR_LINE 4: NSFW error case
+ NPS_DELETE_PERSISTED_DATA_ACK,
+ sizeof(l_tMsgAck),
+ &l_tMsgAck)) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending NPS_GET_PERS_FILE_ACK message to %s", pRequester);
+ // LCOV_EXCL_STOP
+ }
+
+ // close handle
+ FrameworkunifiedMcClose(hRequesterAck);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedMcOpenSender failed for %s ", pRequester);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSetDefaultPersistentData
+/// Sets the default value of the persistent notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetDefaultPersistentData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {};
+
+ // retrieve notification name
+ FrameworkunifiedGetSystemInfo(l_pHApp, l_cNotificationName);
+
+ if (0 != std::strlen(l_cNotificationName)) { // LCOV_EXCL_BR_LINE 6: double check, l_cNotificationName can't be empty // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "Set default value request for Notification:: %s from :: %s", l_cNotificationName,
+ l_cMsgSource);
+
+ if (0 != l_uiMsgLength) {
+ std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], static_cast<UI_32>(pMsgData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // set the default notification data
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceSetDefaultPersistentNotificationData(l_cNotificationName,
+ (PVOID)&pMsgData[0],
+ l_uiMsgLength)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceSetDefaultPersistentNotificationData :: %s", l_cNotificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to set default persistent notification data for %s, "
+ "Error retrieving data from message, status: 0x%x",
+ l_cNotificationName, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Not setting default persistent notification data for %s, Data length received is %d",
+ l_cNotificationName, l_uiMsgLength);
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_cNotificationName can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to Set DefaultPersistentNotificationData from source %s, Notification name is blank",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't set default value for notification from source %s, l_pNotificationManager is NULL", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSetNotfnPersistentType
+/// Sets the persist type of notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetNotfnPersistentType) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {};
+
+ // retrieve notification name
+ FrameworkunifiedGetSystemInfo(l_pHApp,
+ l_cNotificationName);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager && 0 != std::strlen(l_cNotificationName)) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL, l_cNotificationName can't be empty // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Set persist type request for Notification:: %s", l_cNotificationName);
+
+ EFrameworkunifiedPersistCategory ePersistCategory = eFrameworkunifiedUserData;
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &ePersistCategory, sizeof(EFrameworkunifiedPersistCategory), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // set the notification persist type
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceSetPersistentCategory(l_cNotificationName, // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ ePersistCategory))) {
+ // LCOV_EXCL_START 6: always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Setting PersistentType for notification :: %s, Status: 0x%x",
+ l_cNotificationName, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in getting the PersistentType message data for notification :: %s, Status: 0x%x",
+ l_cNotificationName, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL, l_cNotificationName can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't set persist type for notification :: %s", l_cNotificationName);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSetFilePersistentType
+/// Sets the persist type of file
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFilePersistentType) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
+ NC_SetFilePersistType l_tMsg = {};
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ if (0 != std::strlen(l_tMsg.cTag)) { // LCOV_EXCL_BR_LINE 6: double check, l_tMsg.cTag can't be empty
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "Set persist type request for file tag:: %s from %s", l_tMsg.cTag, l_cMsgSource);
+
+ // set the file persist type
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceSetPersistentCategory(l_cMsgSource,
+ l_tMsg.cTag,
+ l_tMsg.ePersistType,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in Setting FilePersistentType for tag:: %s for request from:: %s", l_tMsg.cTag,
+ l_cMsgSource);
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_tMsg.cTag can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "set file persistent type request for NULL file tag from source:: %s", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pPersistenceManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't process request for setting persist type for file from source: %s, l_pPersistenceManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSetFolderPersistentType
+/// Sets the persist type of folder
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFolderPersistentType) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
+ NC_SetFolderPersistType l_tMsg = {};
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ if (0 != std::strlen(l_tMsg.cTag)) { // LCOV_EXCL_BR_LINE 6: double check, l_tMsg.cTag can't be empty
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Set persist type request for folder tag:: %s", l_tMsg.cTag);
+
+ // set the file persist type
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceSetPersistentCategory(l_cMsgSource,
+ l_tMsg.cTag,
+ l_tMsg.ePersistType,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in Setting FolderPersistentType for tag:: %s for request from:: %s", l_tMsg.cTag,
+ l_cMsgSource);
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_tMsg.cTag can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "set file persistent type request for NULL folder tag from source:: %s", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pPersistenceManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't process request for setting persist type for folder from source: %s, l_pPersistenceManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPShutdown
+/// Internal transition when NPP receives shutdown message
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPShutdown) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ try {
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ NC_StopMsgData l_tStopMsgData = {};
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tStopMsgData), sizeof(l_tStopMsgData), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // make a transition to sNotificationpersistentserviceShutdownDataSave state and pass the message data through event
+ CShutDownMsgData *l_pMsgData = new(std::nothrow) CShutDownMsgData(EVENT(evNPShutdownDataSave),
+ l_tStopMsgData.eShutdownType,
+ l_tStopMsgData.uiStopMsgData);
+ CHKNULL(l_pMsgData);
+
+ CEventDataPtr l_pData(l_pMsgData);
+ f_pSourceState->FrameworkunifiedPostEvent(l_pData);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Shutdown Message received from %s with data: %d", l_cMsgSource,
+ l_tStopMsgData.uiStopMsgData);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't process shutdown request from:: %s, Invalid message data", l_cMsgSource); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPNorDataSaveAck
+/// Internal transition when NPP receives shutdown ack message nor worker thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPNorDataSaveAck) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ try {
+ // data received with ack
+ UI_32 l_uiPersistCategoryFlag = 0;
+
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ CHKNULL(l_pPersistenceManager);
+
+ l_pPersistenceManager->SetImmediateDataPersistedStatus(TRUE);
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_uiPersistCategoryFlag), sizeof(l_uiPersistCategoryFlag), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "ShutdownAck received from %s with data: %d", l_cMsgSource,
+ l_uiPersistCategoryFlag);
+ }
+
+ // depending on the flag delete the persisted data from persistent memory
+ // which are not to be persisted during shutdown
+ l_pnsnpp->DeletePersistedDataFolder(l_uiPersistCategoryFlag);
+
+ if (TRUE == l_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: always return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All release requests are processed.");
+ f_pSourceState->FrameworkunifiedPostEvent(EVENT(evIdle));
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+CsNotificationpersistentservicePersistenceReady::CsNotificationpersistentservicePersistenceReady(std::string f_strName): CFrameworkunifiedLeafState(f_strName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+}
+
+CsNotificationpersistentservicePersistenceReady::~CsNotificationpersistentservicePersistenceReady() { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CsNotificationpersistentservicePersistenceReady::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+
+ if (NULL != l_pHApp) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, g_csendreadyackto);
+
+ if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_NPP_READY_EVENT, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __PRETTY_FUNCTION__, "NPP ready status sent to %s.", g_csendreadyackto);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error sending NPS_NPP_READY_EVENT to %s, status: %d", g_csendreadyackto,
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ FrameworkunifiedMcClose(l_hMq);
+ l_hMq = NULL;
+ } else {
+ // catastrophic failure!
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "McOpenSender failed for %s ", g_csendreadyackto); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CsNotificationpersistentservicePersistenceReady::FrameworkunifiedOnExit(CEventDataPtr f_peventdata) { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+}
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfileNotifications) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ try {
+ CHKNULL(f_pSourceState);
+
+ // get the application handle
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ // get the statemachine pointer of application
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ // get the message source name
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get the message queue handle for sending the response
+ HANDLE hSrcMqHandle = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
+ CHKNULL(hSrcMqHandle);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+ CHKNULL(l_pNotificationManager);
+
+ std::string l_cNotificationProfileInfo = "";
+
+ // get the data from notification manager
+ if (eFrameworkunifiedStatusOK == l_pNotificationManager->GetNotificationProfilingData(l_cNotificationProfileInfo)) {
+ UI_32 l_uiLength = l_cNotificationProfileInfo.size();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_NOTIFICATION_RESP Msg Length: %d", l_uiLength);
+
+ PCHAR l_pData = new CHAR[l_uiLength];
+ std::memset(l_pData, '0', l_uiLength);
+
+ std::strncpy(l_pData, l_cNotificationProfileInfo.c_str(), l_cNotificationProfileInfo.size());
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSrcMqHandle,
+ NPS_PROFILE_NOTIFICATION_RESP,
+ l_uiLength,
+ l_pData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "FrameworkunifiedSendMsg NPS_PROFILE_NOTIFICATION_RESP for Notification Profiling failed.");
+ }
+
+ delete[] l_pData;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Failed to get Notification profiling data from NSNPP.");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfilePersistence) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ try {
+ CHKNULL(f_pSourceState);
+
+ // get the application handle
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ // get the statemachine pointer of application
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ // get the message source name
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get the message queue handle for sending the response
+ HANDLE hSrcMqHandle = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
+ CHKNULL(hSrcMqHandle);
+
+ // get instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ CHKNULL(l_pPersistenceManager);
+
+ std::string l_cPersistenceProfileInfo = "";
+
+ if (eFrameworkunifiedStatusOK == l_pPersistenceManager->GetPersistenceProfilingData(l_cPersistenceProfileInfo)) {
+ UI_32 l_uiLength = l_cPersistenceProfileInfo.size();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_PERSISTENCE_RESP Msg Length: %d", l_uiLength);
+
+ PCHAR l_pData = new CHAR[l_uiLength];
+ std::memset(l_pData, '0', l_uiLength);
+
+ std::strncpy(l_pData, l_cPersistenceProfileInfo.c_str(), l_cPersistenceProfileInfo.size());
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSrcMqHandle,
+ NPS_PROFILE_PERSISTENCE_RESP,
+ l_uiLength,
+ l_pData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_PERSISTENCE_RESP for Persistence Profiling failed.");
+ }
+
+ delete[] l_pData;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+#endif
diff --git a/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp b/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp
new file mode 100755
index 0000000..c1b97f9
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp
@@ -0,0 +1,258 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_notification.h>
+
+#include "app_states.h"
+#include "ns_npp.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_persistence_manager.h"
+
+using std::malloc;
+
+#ifdef NPP_PROFILEINFO_ENABLE
+#include "ns_npp_profiling_protocols_internal.h"
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnInitialization
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE happ) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != happ) { // LCOV_EXCL_BR_LINE 4: happ can't be null
+ FrameworkunifiedProtocolEvent ns_npp_protocol_handlers[] = {
+ {NPS_REGISTER_EV_REQ, EVENT(evNPRegisterNotifications)},
+ {NPS_PUBLISH_EV_REQ, EVENT(evNPPublishNotification)},
+ {NPS_SUBSCRIBE_TO_EV_REQ, EVENT(evNPSubscribeToNotification)},
+ {NPS_BATCH_SUBSCRIBE_TO_EV_REQ, EVENT(evNPSubscribeToNotifications)},
+ {NPS_UNSUBSCRIBE_FROM_EV_REQ, EVENT(evNPUnSubscribeFromNotification)},
+ {NPS_UNREGISTER_EV_REQ, EVENT(evNPUnRegisterNotifications)},
+ {NPS_GET_PERS_DATA_REQ, EVENT(evNPReadPersistedData)},
+ {NPS_SET_PERSIST_FILE_PATH_REQ, EVENT(evNPRegisterPersistentFile)},
+ {NPS_RELEASE_PERS_FILE_REQ, EVENT(evNPReleasePersistentFile)},
+ {NPS_GET_PERS_FILE_REQ, EVENT(evNPLoadPersistentFile)},
+ {NPS_SET_PERSIST_FOLDER_PATH_REQ, EVENT(evNPRegisterPersistentFolder)},
+ {NPS_GET_PERS_FOLDER_REQ, EVENT(evNPLoadPersistentFolder)},
+ {NPS_RELEASE_PERS_FOLDER_REQ, EVENT(evNPReleasePersistentFolder)},
+ {NPS_CHANGE_PERSONALITY_REQ, EVENT(evUserChange)},
+ {NPS_NPP_STOP_REQ, EVENT(evShutdown)},
+ {NPS_BATCH_UNSUBSCRIBE_FROM_EV_REQ, EVENT(evNPUnSubscribeFromNotifications)},
+ {NPS_GET_READYSTATUS_REQ, EVENT(evNPGetReadyStatus)},
+ {NPS_REGISTER_NOR_EV_REQ, EVENT(evNPRegisterImmediateNotifications)},
+ {NPS_DELETE_PERSISTED_DATA_REQ, EVENT(evNPClearPersistedData)},
+ {NPS_SET_DEFAULT_PERS_DATA, EVENT(evNPSetDefaultPersistentData)},
+ {NPS_SET_NOTFN_PERSISTENT_TYPE, EVENT(evNPSetNotfnPersistentType)},
+ {NPS_SET_FILE_PERSISTENT_TYPE, EVENT(evNPSetFilePersistentType)},
+ {NPS_SET_FOLDER_PERSISTENT_TYPE, EVENT(evNPSetFolderPersistentType)},
+ {NPS_SYNCHRONOUS_WRITE_NOTIFY_REQ, EVENT(evNPPublishImmediateNotification)},
+ {NPS_NPP_SYNC_REQ, EVENT(evNPPersistentSync)}
+ };
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ FrameworkunifiedProtocolEvent ns_npp_profile_protocol_handlers[] = {
+ {NPS_PROFILE_NOTIFICATION_REQ, EVENT(evNPProfileNotification)},
+ {NPS_PROFILE_PERSISTENCE_REQ, EVENT(evNPProfilePersistence)},
+ };
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedAttachHSMEventsToDispatcher(happ,
+ "NSProfileUtil",
+ ns_npp_profile_protocol_handlers,
+ _countof(ns_npp_profile_protocol_handlers))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Profile info messages are attached to events");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to attach profile info messages to events");
+ }
+
+#endif
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedAttachHSMEventsToDispatcher(happ, FRAMEWORKUNIFIED_ANY_SOURCE, ns_npp_protocol_handlers, static_cast<UI_32>(_countof(ns_npp_protocol_handlers))))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ CNSNPP *l_pnsnpp = new(std::nothrow) CNSNPP(happ);
+ if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 5: new's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "l_pnsnpp object created");
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = l_pnsnpp->Init(happ))) { // LCOV_EXCL_BR_LINE 200: can't test
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "l_pnsnpp object initialized");
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = l_pnsnpp->FrameworkunifiedCreate())) { // LCOV_EXCL_BR_LINE 200: the result of l_pnsnpp->FrameworkunifiedCreate() is always eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ FrameworkunifiedSetStateMachine(happ, l_pnsnpp);
+
+ l_pnsnpp->FrameworkunifiedStart();
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NSNPP statemachine not created, status: 0x%x", l_estatus); // LCOV_EXCL_LINE 200: the result of l_pnsnpp->FrameworkunifiedCreate() is always eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 200: can't test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pnsnpp object initialization error, status: %d", l_estatus);
+
+ // de-initialize the partially initialize object
+ l_pnsnpp->DeInit(happ);
+
+ delete l_pnsnpp;
+ l_pnsnpp = NULL;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pnsnpp object not created");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedAttachHSMEventsToDispatcher Failed Status:0x%x ", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: happ can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Application handle happ is NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE happ) { // LCOV_EXCL_START 14: Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnDebugDump
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE happ) { // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+ /// << Dump internal tables!
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE happ) {
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE happ) {
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnStart
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE happ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnStop
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE happ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnPreStart
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnPreStop
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnBackgroundStart
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnBackgroundStop
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+extern const FrameworkunifiedDefaultCallbackHandler kDefaultCbHandler = { // NOLINT (readability/naming)
+ FrameworkunifiedOnInitialization,
+ FrameworkunifiedOnDestroy,
+ FrameworkunifiedOnStart,
+ FrameworkunifiedOnStop,
+ FrameworkunifiedOnPreStart,
+ FrameworkunifiedOnPreStop,
+ FrameworkunifiedOnBackgroundStart,
+ FrameworkunifiedOnBackgroundStop,
+ FrameworkunifiedOnDebugDump,
+ FrameworkunifiedCreateStateMachine,
+ FrameworkunifiedSSFrameworkInterface
+}; // LCOV_EXCL_BR_LINE 10: The final line
diff --git a/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp b/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp
new file mode 100755
index 0000000..fd963c5
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp
@@ -0,0 +1,131 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_version.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <stdlib.h>
+#include <cstdlib>
+#include <iostream>
+
+#include "ns_npp.h" // for static members. Set thread prio.
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_persistence_manager.h" // for static members. Set enable/disable persistence feature.
+
+const CHAR AppName[] = FRAMEWORKUNIFIED_NS_NPSERVICE; // NOLINT (readability/naming)
+CHAR g_csendreadyackto[MAX_QUEUE_NAME_SIZE];
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION); // NOLINT (readability/naming)
+
+// Argument Parser for NSNPP
+EFrameworkunifiedStatus NPPArgumentParser(SI_32 f_iargument, PCHAR f_pargumentvalue);
+
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { // NOLINT (readability/naming)
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31,
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+extern const FrameworkunifiedDefaultCallbackHandler kDefaultCbHandler;
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : main
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+int main(int argc, char *argv[]) {
+ FRAMEWORKUNIFIED_SET_ZONES();
+ CustomCommandLineOptions l_tcmdlineoptions = { "i:e:w:fa:v:", NULL, NPPArgumentParser};
+ EFrameworkunifiedStatus l_estatus = FrameworkunifiedDispatcherWithArguments(AppName, argc, argv, &kDefaultCbHandler, &l_tcmdlineoptions);
+
+ return static_cast<SI_32>(l_estatus);
+}
+
+EFrameworkunifiedStatus NPPArgumentParser(SI_32 f_iargument, PCHAR f_pargumentvalue) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ SI_32 l_iTmpArgValue = 0;
+ switch (f_iargument) { // LCOV_EXCL_BR_LINE 8: cannot test
+ // Disable Persistence
+ case 'f': {
+ CPersistenceManager::m_bPersistenceDisabled = TRUE;
+ break;
+ }
+ case 'i': {
+ l_iTmpArgValue = atoi(f_pargumentvalue);
+ if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
+ CNSNPP::m_siImmediatePersistenceThreadPrio = l_iTmpArgValue;
+ }
+ break;
+ }
+ case 'e': {
+ l_iTmpArgValue = atoi(f_pargumentvalue);
+ if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
+ CNSNPP::m_siReadThreadPrio = l_iTmpArgValue;
+ }
+ break;
+ }
+ case 'w': {
+ l_iTmpArgValue = atoi(f_pargumentvalue);
+ if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
+ CNSNPP::m_siWriteThreadPrio = l_iTmpArgValue;
+ }
+ break;
+ }
+ case 'a': {
+ std::memset(g_csendreadyackto, 0, MAX_QUEUE_NAME_SIZE);
+ std::strncpy(g_csendreadyackto, f_pargumentvalue, (MAX_QUEUE_NAME_SIZE - 1));
+ break;
+ }
+ case 'v': {
+ l_iTmpArgValue = atoi(f_pargumentvalue);
+ CNSNPP::m_siCRCCheckCount = static_cast<UI_16>(l_iTmpArgValue);
+ break;
+ }
+
+ default:
+ l_estatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ return l_estatus;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp.cpp b/nsframework/notification_persistent_service/server/src/ns_npp.cpp
new file mode 100755
index 0000000..25b6443
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp.cpp
@@ -0,0 +1,1149 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <sys/timeb.h>
+#include <sys/types.h>
+
+#include <native_service/frameworkunified_sm_leafstate.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/ns_np_service_protocol.h>
+
+#include <string>
+#include <vector>
+
+#include <native_service/ns_np_service_nor_persistence_internal.h>
+#include "app_states.h"
+#include "ns_npp.h"
+#include "ns_npp_types.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_threads.h"
+#include "ns_npp_copy_worker.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_persist_folder.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_persistence_manager.h"
+#include "ns_npp_notification_manager.h"
+#include "ns_npp_personalization_manager.h"
+#include "ns_npp_nor_persistence_worker_thread.h"
+
+#define NPP_VERSION_INVALID 255
+#define NPP_VERSION_0 0
+#define NPP_VERSION_1 1
+
+#define NPP_CONNECT_DEFAULTSTATE(parent, child) \
+ FrameworkunifiedConnect(l_p## parent, l_p## child, TRUE);
+
+#define NPP_CONNECT_STATE(parent, child) \
+ FrameworkunifiedConnect(l_p## parent, l_p## child);
+
+#define NPP_CONNECT_DEFERREDEVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid, TRUE); \
+
+#define NPP_CONNECT_EVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid);
+
+#define NPP_CONNECTROOT(state) \
+ FrameworkunifiedConnect(l_p## state);
+
+#define NPP_CONNECT_ORTHOGONAL_REGION(orthogonalstate, orthogonalregion) \
+ FrameworkunifiedConnectOrthogonal(l_p## orthogonalstate, l_p## orthogonalregion);
+
+#define NPP_CREATE_STATE(class_name) \
+ C## class_name *l_p## class_name = new (std::nothrow) C## class_name(#class_name);
+
+#define NPP_PRINTSTATEMACHINE() \
+ FrameworkunifiedPrintAllStates();
+
+// typedef of vector of CNotificationsToPersist
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+// iterator for CNotificationsToPersist vector
+typedef Persistent_Notification_List_Type::iterator Persistent_Notification_List_Iterator;
+
+// initialize static variables
+SI_32 CNSNPP::m_siWriteThreadPrio = NS_NPP_WRITE_THREAD_PRIO;
+SI_32 CNSNPP::m_siReadThreadPrio = NS_NPP_READ_THREAD_PRIO;
+SI_32 CNSNPP::m_siImmediatePersistenceThreadPrio = NS_NPP_IMMEDIATE_PERSIST_THREAD_PRIO;
+UI_16 CNSNPP::m_siCRCCheckCount = 0;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSNPP
+/// Class Constructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNSNPP::CNSNPP(PVOID f_happ) : CFrameworkunifiedHSM(f_happ),
+ m_cReadThreadName(NS_NPP_READ_THREAD_NAME),
+ m_cWriteThreadName(NS_NPP_WRITE_THREAD_NAME),
+ m_cImmediatePersistenceThreadName(NS_NPP_IMMEDIATE_PERSIST_THREAD_NAME) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_hNSReadThread = NULL;
+ m_hNSWriteThread = NULL;
+ m_hNSImmediatePersistenceThread = NULL;
+
+ m_pNotificationManager = NULL;
+ m_pPersonalizationManager = NULL;
+ m_pPersistenceManager = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSNPP
+/// Class Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNSNPP::~CNSNPP() { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pNotificationManager) {
+ delete m_pNotificationManager;
+ m_pNotificationManager = NULL;
+ }
+
+ if (NULL != m_pPersonalizationManager) {
+ delete m_pPersonalizationManager;
+ m_pPersonalizationManager = NULL;
+ }
+ if (NULL != m_pPersistenceManager) {
+ delete m_pPersistenceManager;
+ m_pPersistenceManager = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Init
+/// This function is used to allocate dynamic memory for member variables of this class after
+/// creation of object.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::Init(HANDLE f_happ) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FrameworkunifiedProtocolEvent ns_npp_internal_protocol_handlers[] = {
+ {CP_WRK_NTFY, EVENT(evNPReleaseLoadAck)}
+ };
+
+ FrameworkunifiedProtocolEvent immediate_thread_protocol_handlers[] = {
+ {NOR_PERSISTENCE_ONSHUTDOWN_ACK, EVENT(evNPNorShutdownAck)},
+ };
+
+ UI_32 l_uiNPPVersion = NPP_VERSION_INVALID;
+
+ // initialize Notification Manager
+ m_pNotificationManager = new(std::nothrow) CNotificationManager();
+ // initialize Personalization Manager
+ m_pPersonalizationManager = new(std::nothrow) CnotificationpersistentservicePersonalizationManager();
+ // initialize Persistence Manager
+ m_pPersistenceManager = new(std::nothrow) CPersistenceManager();
+
+ if ((NULL == f_happ) || (NULL == m_pNotificationManager) || (NULL == m_pPersonalizationManager) || (NULL == m_pPersistenceManager)) { // LCOV_EXCL_BR_LINE 5: f_happ, m_pNotificationManager, m_pPersonalizationManager, m_pPersistenceManager can't be NULL // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5: f_happ, m_pNotificationManager, m_pPersonalizationManager, m_pPersistenceManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "f_happ or m_pNotificationManager or m_pPersonalizationManager or m_pPersistenceManager is NULL");
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ if ((eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbackToDispatcher( // LCOV_EXCL_BR_LINE 4: NSFW error case
+ f_happ, m_cReadThreadName.c_str(),
+ CP_WRK_ACK_CMD_COMPLETE,
+ NPServiceOnCpWorkerAckCmd))
+ || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbackToDispatcher(
+ f_happ, m_cWriteThreadName.c_str(),
+ CP_WRK_ACK_CMD_COMPLETE,
+ NPServiceOnCpWorkerAckCmd))
+ || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(
+ f_happ, m_cWriteThreadName.c_str(),
+ ns_npp_internal_protocol_handlers,
+ static_cast<UI_32>(_countof(ns_npp_internal_protocol_handlers))))
+ || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(
+ f_happ, m_cReadThreadName.c_str(),
+ ns_npp_internal_protocol_handlers,
+ static_cast<UI_32>(_countof(ns_npp_internal_protocol_handlers))))
+ || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(
+ f_happ, m_cImmediatePersistenceThreadName.c_str(),
+ immediate_thread_protocol_handlers,
+ static_cast<UI_32>(_countof(immediate_thread_protocol_handlers))))) {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Attaching callbacks and events failed for protocols CP_WRK_ACK_CMD_COMPLETE, CP_WRK_NTFY");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ l_estatus = CreateAndStartChildThreads(f_happ);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ if (NPP_VERSION_INVALID != (l_uiNPPVersion = GetNSNPPVersion())) { // LCOV_EXCL_BR_LINE 6: l_uiNPPVersion can't be NPP_VERSION_INVALID // NOLINT[whitespace/line_length]
+ if (NPP_VERSION_0 == l_uiNPPVersion) {
+ l_estatus = SwitchToFileStructureVersion1(l_uiNPPVersion + 1);
+
+ l_estatus = SwitchToFileStructureVersion2(l_uiNPPVersion + 2);
+ } else if (NPP_VERSION_1 == l_uiNPPVersion) { // LCOV_EXCL_BR_LINE 200: cannot test code in init sequence
+ // LCOV_EXCL_START 200: cannot test code in init sequence
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = SwitchToFileStructureVersion2(l_uiNPPVersion + 1);
+
+ // send the message to write worker thread to delete the persistent
+ /// which was requested for deletion during previous shutdown
+ l_estatus = FrameworkunifiedSendChild(f_happ, m_hNSWriteThread, CMD_DELETE_OLD_DATA, 0, NULL);
+ // LCOV_EXCL_STOP
+ } else {
+ // send the message to write worker thread to delete the persistent
+ /// which was requested for deletion during previous shutdown
+ l_estatus = FrameworkunifiedSendChild(f_happ, m_hNSWriteThread, CMD_DELETE_OLD_DATA, 0, NULL);
+ }
+
+ // Try to load persisted notification data
+ NotificationpersistentserviceLoadPersistentNotificationData(eFrameworkunifiedPersistedStateVar);
+
+ // load immediate persistence data as the respective thread is now started.
+ NotificationpersistentserviceLoadPersistentNotificationData(eFrameworkunifiedImmediatePersistedStateVar);
+ } else {
+ // LCOV_EXCL_START 6: l_uiNPPVersion can't be NPP_VERSION_INVALID
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid version of NPPService");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in creating child threads of NPPService"); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DeInit
+/// This function is used to deinitialize the NPP object
+////////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CNSNPP::DeInit(HANDLE f_happ) { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pNotificationManager) {
+ delete m_pNotificationManager;
+ m_pNotificationManager = NULL;
+ }
+
+ if (NULL != m_pPersonalizationManager) {
+ delete m_pPersonalizationManager;
+ m_pPersonalizationManager = NULL;
+ }
+
+ if (NULL != m_pPersistenceManager) {
+ delete m_pPersistenceManager;
+ m_pPersistenceManager = NULL;
+ }
+
+ if (NULL != f_happ) {
+ EFrameworkunifiedStatus eStatus;
+
+ if (NULL != m_hNSReadThread) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedStopChildThread(f_happ, m_hNSReadThread, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread Read Thread Failed. status=%d", eStatus);
+ }
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroyChildThread(f_happ, m_hNSReadThread))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedDestroyChildThread Read Thread Failed. status=%d", eStatus);
+ }
+ m_hNSReadThread = NULL;
+ }
+
+ if (NULL != m_hNSWriteThread) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedStopChildThread(f_happ, m_hNSWriteThread, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread Write Thread Failed. status=%d", eStatus);
+ }
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroyChildThread(f_happ, m_hNSWriteThread))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedDestroyChildThread Write Thread Failed. status=%d", eStatus);
+ }
+ m_hNSWriteThread = NULL;
+ }
+
+ if (NULL != m_hNSImmediatePersistenceThread) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedStopChildThread(f_happ, m_hNSImmediatePersistenceThread, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread ImmidatePersistence Thread Failed. status=%d", eStatus);
+ }
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroyChildThread(f_happ, m_hNSImmediatePersistenceThread))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedDestroyChildThread ImmidatePersistence Thread Failed. status=%d", eStatus);
+ }
+ m_hNSImmediatePersistenceThread = NULL;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SwitchToFileStructureVersion1
+/// Copy all the user data from old persistent path to new persistent path i.e. UserData folder
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::SwitchToFileStructureVersion1(const UI_32 f_uinppversion) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string l_cSrcPath = "";
+ std::string l_cDestPath = "";
+
+ std::string l_cNSNPSPath = CPersistence::GetStoragePath();
+ std::string l_cUserDataPath = "";
+
+ if (CFSDirectory::DoesDirecotryExist(l_cNSNPSPath)) { // LCOV_EXCL_BR_LINE 6: l_cNSNPSPath must exist
+ DIR *l_pdir = NULL;
+
+ struct dirent *l_pdirent = NULL;
+
+ l_pdir = opendir(l_cNSNPSPath.c_str());
+
+ if (NULL != l_pdir) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ if (l_cNSNPSPath[l_cNSNPSPath.length() - 1] != '/') { // LCOV_EXCL_BR_LINE 6: l_cNSNPSPath must has '/'
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_cNSNPSPath.append("/"); // LCOV_EXCL_LINE 6: l_cNSNPSPath must has '/'
+ }
+
+ // set the userdata folder path
+ l_cUserDataPath.assign(l_cNSNPSPath);
+ l_cUserDataPath.append(USERDATADIR);
+ l_cUserDataPath.append(ALLUSERAPPDATADIR);
+
+ // create the userdata directory
+ if (!CFSDirectory::DoesDirecotryExist(l_cUserDataPath)) {
+ l_estatus = CFSDirectory::CreateDirectory(l_cUserDataPath);
+ }
+
+ // if directory successfully created or is already present on target
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus must be eFrameworkunifiedStatusOK
+ while (NULL != (l_pdirent = readdir(l_pdir))) {
+ if (0 != std::strcmp(l_pdirent->d_name, ".") &&
+ 0 != std::strcmp(l_pdirent->d_name, "..") &&
+ 0 != std::strcmp(l_pdirent->d_name, AppName) &&
+ 0 != std::strcmp(l_pdirent->d_name, USERDATA)) {
+ l_cSrcPath.assign(l_cNSNPSPath.c_str());
+ l_cSrcPath.append(l_pdirent->d_name);
+
+ if (CFSDirectory::IsDirectory(l_cSrcPath)) { // LCOV_EXCL_BR_LINE 6: cannot test in init sequence
+ l_cDestPath.assign(l_cUserDataPath);
+ l_cDestPath.append(l_pdirent->d_name);
+
+ // move the old app user data to the UserData fodler
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: rename must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error renaming folder %s to %s",
+ l_cSrcPath.c_str(), l_cDestPath.c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to create directory:: %s", l_cDestPath.c_str()); // LCOV_EXCL_LINE 6: l_estatus must be eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ }
+
+ closedir(l_pdir); // close the directory
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pdir is NULL");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ l_estatus = SetNSNPPVersion(static_cast<UI_8>(f_uinppversion));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SwitchToFileStructureVersion2
+/// Move immediate notification data files from IMMEDIATE_PERSISTENCE_STORAGE_V1 to
+/// IMMEDIATE_PERSISTENCE_STORAGE_V2/AllUserAppData/UserData
+//// ////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::SwitchToFileStructureVersion2(const UI_32 f_uinppversion) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // immediate notification persistent path for NPPService version 1
+ std::string l_cSrcDir = IMMEDIATE_PERSISTENCE_STORAGE_V1;
+
+ // immediate notification persistent path for NPPService version 2
+ std::string l_cDestDir = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+ l_cDestDir.append(USERDATADIR);
+ l_cDestDir.append(ALLUSERAPPDATADIR);
+ l_cDestDir.append(IMMEDIATEDATADIR);
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = SynchronousMovePersistentData(l_cSrcDir.c_str(), l_cDestDir.c_str()))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ if (!CFSDirectory::RemoveDirectory(l_cSrcDir)) { // LCOV_EXCL_BR_LINE 6: cannot test in init sequence
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error deleting old immediate pers. dir %s", l_cSrcDir.c_str());
+ }
+
+ l_estatus = SetNSNPPVersion(static_cast<UI_8>(f_uinppversion));
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SynchronousMovePersistentData faiure, status=%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// GetNSNPPVersion
+/// Get the version of NSNPP from version.txt
+///////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CNSNPP::GetNSNPPVersion() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ UI_32 l_uiVersion = NPP_VERSION_INVALID;
+ CHAR l_cVerStr[3] = {};
+ FILE *l_pFile = NULL;
+
+ std::string l_cVersion = CPersistence::GetStoragePath();
+ if (l_cVersion[l_cVersion.length() - 1] != '/') { // LCOV_EXCL_BR_LINE 6: must has '/'
+ l_cVersion += "/";
+ }
+ l_cVersion.append(VERSION_TXT);
+
+ if (NULL != (l_pFile = fopen(l_cVersion.c_str(), "r"))) {
+ // read the version from file
+ if (NULL == fgets(l_cVerStr, 2, l_pFile)) { // LCOV_EXCL_BR_LINE 6: can't return NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "File empty: %s", l_cVersion.c_str()); // LCOV_EXCL_LINE 6: can't return NULL
+ } else {
+ errno = EOK;
+ l_uiVersion = static_cast<UI_32>(strtol(l_cVerStr, NULL, 10));
+
+ if (EOK != errno) { // LCOV_EXCL_BR_LINE 6: errno always is EOK
+ // LCOV_EXCL_START 6: errno always is EOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to hex, errno=%d", l_cVerStr, errno);
+ l_uiVersion = NPP_VERSION_0;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ fclose(l_pFile);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file: %s, errno=%d", l_cVersion.c_str(), errno);
+ l_uiVersion = NPP_VERSION_0;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_uiVersion;
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Syncfs
+/// Syncfs is carried out.
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - Returns status of operation
+///
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::Syncfs() {
+ int dfd;
+
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string l_cPath = CPersistence::GetStoragePath();
+
+ // create the file
+ dfd = open(l_cPath.c_str(), O_RDONLY | O_DIRECTORY);
+ if (-1 != dfd) {
+ // syncfs()
+ if (syncfs(dfd) < 0) { // LCOV_EXCL_BR_LINE 5: syncfs's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to syncfs: %s errno=%d", l_cPath.c_str(), errno); // LCOV_EXCL_LINE 5: syncfs's error case. // NOLINT[whitespace/line_length]
+ }
+ close(dfd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file: %s serrno=%d", l_cPath.c_str(), errno);
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// SetNSNPPVersion
+/// Set the version of NSNPP in version.txt
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::SetNSNPPVersion(UI_8 f_uiversion) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FILE *l_pFile = NULL;
+
+ std::string l_cVersion = CPersistence::GetStoragePath();
+ if (l_cVersion[l_cVersion.length() - 1] != '/') { // LCOV_EXCL_BR_LINE 6: must has '/'
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_cVersion += "/"; // LCOV_EXCL_LINE 6: must has '/'
+ }
+ if (!CFSDirectory::DoesDirecotryExist(l_cVersion)) {
+ CFSDirectory::CreateDirectory(l_cVersion);
+ }
+
+ l_cVersion.append(VERSION_TXT);
+
+ // create the file and write
+ l_pFile = fopen(l_cVersion.c_str(), "w");
+ if (NULL != l_pFile) { // LCOV_EXCL_BR_LINE 6: l_pFile can't be NULL
+ // write the version to file
+ fprintf(l_pFile, "%d", f_uiversion);
+ fclose(l_pFile);
+ } else {
+ // LCOV_EXCL_START 6: l_pFile can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file: %s", l_cVersion.c_str());
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreate
+/// In this function, states and events of StateMachine are created and connected.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::FrameworkunifiedCreate(PVOID f_peventdata) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // ========Create states
+ NPP_CREATE_STATE(sNotificationpersistentserviceNPPRoot)
+ NPP_CREATE_STATE(sNotificationpersistentserviceNPPStart)
+ NPP_CREATE_STATE(sNotificationpersistentserviceNPPError)
+
+ CREATE_ORTHOGONALREGION(sNotificationpersistentservicePersistence)
+ CREATE_ORTHOGONALREGION(sNotificationpersistentserviceShutdown)
+ CREATE_ORTHOGONALREGION(sNotificationpersistentserviceNotification)
+
+ NPP_CREATE_STATE(sNotificationpersistentservicePersistenceReady)
+ NPP_CREATE_STATE(sNotificationpersistentservicePersistenceError)
+
+ NPP_CREATE_STATE(sNotificationpersistentserviceNotificationReady)
+ NPP_CREATE_STATE(sNotificationpersistentserviceNotificationError)
+
+ NPP_CREATE_STATE(sNotificationpersistentserviceShutdownIdle)
+ NPP_CREATE_STATE(sNotificationpersistentserviceShutdownDataSave)
+
+ // ========Connect states
+ NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentserviceNPPRoot, sNotificationpersistentserviceNPPStart)
+ NPP_CONNECT_STATE(sNotificationpersistentserviceNPPRoot, sNotificationpersistentserviceNPPStart)
+ NPP_CONNECT_STATE(sNotificationpersistentserviceNPPRoot, sNotificationpersistentserviceNPPError)
+
+ NPP_CONNECT_ORTHOGONAL_REGION(sNotificationpersistentserviceNPPStart, sNotificationpersistentservicePersistence)
+ NPP_CONNECT_ORTHOGONAL_REGION(sNotificationpersistentserviceNPPStart, sNotificationpersistentserviceShutdown)
+ NPP_CONNECT_ORTHOGONAL_REGION(sNotificationpersistentserviceNPPStart, sNotificationpersistentserviceNotification)
+
+ NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentservicePersistence, sNotificationpersistentservicePersistenceReady)
+ NPP_CONNECT_STATE(sNotificationpersistentservicePersistence, sNotificationpersistentservicePersistenceError)
+
+ NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentserviceShutdown, sNotificationpersistentserviceShutdownIdle)
+ NPP_CONNECT_STATE(sNotificationpersistentserviceShutdown, sNotificationpersistentserviceShutdownDataSave)
+
+ NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentserviceNotification, sNotificationpersistentserviceNotificationReady)
+ NPP_CONNECT_STATE(sNotificationpersistentserviceNotification, sNotificationpersistentserviceNotificationError)
+
+ // ========Create external transitions
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNPPStart)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNPPError)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentservicePersistenceReady)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentservicePersistenceError)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceShutdownIdle)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceShutdownDataSave)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNotificationReady)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNotificationError)
+
+ // ========Create internal transitions
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReadPersistedData)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReleaseFileAck)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnUserChange)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPNorDataSaveAck)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFile)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFile)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFile)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFolder)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFolder)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFolder)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFilePersistentType)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFolderPersistentType)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPersistentSync)
+
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPShutdown)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnShutdownTimeout)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceCheckAllReleaseRequestsProcessed)
+
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishNotification)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotification)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnRegisterNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotification)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPGetReadyStatus)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterImmediateNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPClearPersistedData)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetDefaultPersistentData)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetNotfnPersistentType)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishImmediateNotification)
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfileNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfilePersistence)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPProfileNotification, NotificationpersistentserviceOnNPProfileNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPProfilePersistence, NotificationpersistentserviceOnNPProfilePersistence)
+
+#endif
+
+ // ========Connect events
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNPPRoot, evNPClearPersistedData, NotificationpersistentserviceOnNPClearPersistedData)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNPPStart, evError, sNotificationpersistentserviceNPPError)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNPPError, evReady, sNotificationpersistentserviceNPPStart)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evError, sNotificationpersistentservicePersistenceError)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceError, evReady, sNotificationpersistentservicePersistenceReady)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReadPersistedData, NotificationpersistentserviceOnNPReadPersistedData)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReleaseLoadAck, NotificationpersistentserviceOnNPReleaseFileAck)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPRegisterPersistentFile, NotificationpersistentserviceOnRegisterPersistentFile)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReleasePersistentFile, NotificationpersistentserviceOnReleasePersistentFile)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPLoadPersistentFile, NotificationpersistentserviceOnLoadPersistentFile)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPRegisterPersistentFolder, NotificationpersistentserviceOnRegisterPersistentFolder)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPLoadPersistentFolder, NotificationpersistentserviceOnLoadPersistentFolder)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReleasePersistentFolder, NotificationpersistentserviceOnReleasePersistentFolder)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPGetReadyStatus, NotificationpersistentserviceOnNPGetReadyStatus)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPSetFilePersistentType, NotificationpersistentserviceOnNPSetFilePersistentType)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPSetFolderPersistentType, NotificationpersistentserviceOnNPSetFolderPersistentType)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPPersistentSync, NotificationpersistentserviceOnNPPersistentSync)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evUserChange, NotificationpersistentserviceOnUserChange)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownIdle, evShutdown, NotificationpersistentserviceOnNPShutdown)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownIdle, evNPShutdownDataSave, sNotificationpersistentserviceShutdownDataSave)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evIdle, sNotificationpersistentserviceShutdownIdle)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evShutdownTimeout, NotificationpersistentserviceOnShutdownTimeout)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evCheckAllFilesPersisted, NotificationpersistentserviceCheckAllReleaseRequestsProcessed)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evNPNorShutdownAck, NotificationpersistentserviceOnNPNorDataSaveAck)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evError, sNotificationpersistentserviceNotificationError)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationError, evReady, sNotificationpersistentserviceNotificationReady)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPPublishNotification, NotificationpersistentserviceOnNPPublishNotification)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPRegisterNotifications, NotificationpersistentserviceOnNPRegisterNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSubscribeToNotification, NotificationpersistentserviceOnNPSubscribeToNotification)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSubscribeToNotifications, NotificationpersistentserviceOnNPSubscribeToNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPUnRegisterNotifications, NotificationpersistentserviceOnNPUnRegisterNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPUnSubscribeFromNotification, NotificationpersistentserviceOnNPUnSubscribeFromNotification)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPUnSubscribeFromNotifications, NotificationpersistentserviceOnNPUnSubscribeFromNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPRegisterImmediateNotifications, NotificationpersistentserviceOnNPRegisterImmediateNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSetDefaultPersistentData, NotificationpersistentserviceOnNPSetDefaultPersistentData)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSetNotfnPersistentType, NotificationpersistentserviceOnNPSetNotfnPersistentType)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPPublishImmediateNotification, NotificationpersistentserviceOnNPPublishImmediateNotification)
+
+ NPP_CONNECTROOT(sNotificationpersistentserviceNPPRoot)
+
+ NPP_PRINTSTATEMACHINE() // NOLINT (whitespace/empty_if_body)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentservicePersistAll
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::NotificationpersistentservicePersistAll(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedQuickShutdown == f_eshutdowntype) {
+ if (NULL != m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
+ // set all file persisted status as TRUE
+ m_pPersistenceManager->SetFilePersistedStatus(TRUE);
+
+ // send request to immediate persistence thread to stop all the immediate notification timer
+ m_pPersistenceManager->PersistNORData(f_eshutdowntype, f_uinotificationpersistentservicepersistcategoryflag);
+ }
+ } else {
+ if (eFrameworkunifiedNormalShutdown == f_eshutdowntype) {
+ f_uinotificationpersistentservicepersistcategoryflag = 0x0;
+ }
+
+ // save global notification data of persisted state notification
+ if (eFrameworkunifiedStatusOK != NotificationpersistentserviceSaveNotificationPersistentData(eFrameworkunifiedPersistedStateVar, f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while saving notification persistent data.");
+ // LCOV_EXCL_STOP
+ }
+
+ // save user notification data for the current user
+ if (eFrameworkunifiedStatusOK != NotificationpersistentserviceSaveNotificationPersistentData(eFrameworkunifiedPersistedStateUserVar, f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while saving user notification persistent data.");
+ // LCOV_EXCL_STOP
+ }
+
+ // NOR data is saved immediately,
+ // but during shutdown it can be possible that because of delay in consecutive save to NOR
+ // the latest data may not get persisted. So if we get shutdown we will need to persist the data immediately.
+ if (NULL != m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
+ m_pPersistenceManager->PersistNORData(f_eshutdowntype, f_uinotificationpersistentservicepersistcategoryflag);
+ }
+
+ // delete all persistent files and folders for all applications
+ if ((eFrameworkunifiedUserData | eFrameworkunifiedFactoryData | eFrameworkunifiedFactoryCustomerData | eFrameworkunifiedDealerData) == f_uinotificationpersistentservicepersistcategoryflag) {
+ if (NULL != m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
+ m_pPersistenceManager->SetFilePersistedStatus(TRUE);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: m_pPersistenceManager can't be NULL
+ }
+ } else {
+ // writes the temporary global and user files to permanent memory
+ if (m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
+ if (eFrameworkunifiedStatusOK == m_pPersistenceManager->PersistAllReleaseRequests(f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 6: PersistAllReleaseRequests will always return ok // NOLINT[whitespace/line_length]
+ // this is needed to check in case when there are no file to persist
+ if (TRUE == m_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: HaveAllReleaseRequestsPersisted will always return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: HaveAllReleaseRequestsPersisted will always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All file release requests processed");
+ m_pPersistenceManager->SetFilePersistedStatus(TRUE);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: PersistAllReleaseRequests will always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while persisting temporary files.");
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DeletePersistedDataFolder
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::DeletePersistedDataFolder(UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ struct timeb timebuf;
+ struct tm *theTime;
+
+ ftime(&timebuf);
+ theTime = gmtime(&timebuf.time); // NOLINT (runtime/threadsafe_fn)
+
+ // get the current date and time to append to the folder name
+ PCHAR l_cDateTime = new CHAR[MAX_STRING_SIZE_TAG];
+ snprintf(l_cDateTime, MAX_STRING_SIZE_TAG, "_%02d%02d%02d_%02d%02d%02d", theTime->tm_mon + 1, theTime->tm_mday,
+ theTime->tm_year + 1900, theTime->tm_hour, theTime->tm_min, theTime->tm_sec);
+
+ std::string l_cBasePath = CPersistence::GetStoragePath();
+ std::string l_cSrcPath = "";
+ std::string l_cDestPath = "";
+
+ if (eFrameworkunifiedUserData == (eFrameworkunifiedUserData & f_uinotificationpersistentservicepersistcategoryflag)) {
+ l_cSrcPath.assign(l_cBasePath);
+ l_cSrcPath.append(USERDATA);
+
+ if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
+ l_cDestPath.assign(l_cSrcPath);
+ l_cDestPath.append(l_cDateTime);
+
+ // instead of deleting the data, rename the persistence folder before shutdown
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
+ // LCOV_EXCL_START 6: rename must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error renaming folder %s to %s, errno = %d",
+ l_cSrcPath.c_str(),
+ l_cDestPath.c_str(),
+ errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ if (eFrameworkunifiedFactoryData == (eFrameworkunifiedFactoryData & f_uinotificationpersistentservicepersistcategoryflag)) {
+ l_cSrcPath.assign(l_cBasePath);
+ l_cSrcPath.append(FACTORYDATA);
+
+ if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
+ l_cDestPath.assign(l_cSrcPath);
+ l_cDestPath.append(l_cDateTime);
+
+ // instead of deleting the data, rename the persistence folder before shutdown
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
+ // LCOV_EXCL_START 6: rename must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error renaming folder %s to %s, errno = %d",
+ l_cSrcPath.c_str(),
+ l_cDestPath.c_str(),
+ errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ if (eFrameworkunifiedFactoryCustomerData == (eFrameworkunifiedFactoryCustomerData & f_uinotificationpersistentservicepersistcategoryflag)) {
+ l_cSrcPath.assign(l_cBasePath);
+ l_cSrcPath.append(FACTORYCUSTOMERDATA);
+
+ if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
+ l_cDestPath.assign(l_cSrcPath);
+ l_cDestPath.append(l_cDateTime);
+
+ // instead of deleting the data, rename the persistence folder before shutdown
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
+ // LCOV_EXCL_START 6: rename must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error renaming folder %s to %s, errno = %d",
+ l_cSrcPath.c_str(),
+ l_cDestPath.c_str(),
+ errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ if (eFrameworkunifiedDealerData == (eFrameworkunifiedDealerData & f_uinotificationpersistentservicepersistcategoryflag)) {
+ l_cSrcPath.assign(l_cBasePath);
+ l_cSrcPath.append(DEALERDATA);
+
+ if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
+ l_cDestPath.assign(l_cSrcPath);
+ l_cDestPath.append(l_cDateTime);
+
+ // instead of deleting the data, rename the persistence folder before shutdown
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
+ // LCOV_EXCL_START 6: rename must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error renaming folder %s to %s, errno = %d",
+ l_cSrcPath.c_str(),
+ l_cDestPath.c_str(),
+ errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+
+ if (NULL != l_cDateTime) { // LCOV_EXCL_BR_LINE 6: l_cDateTime can't be NULL
+ delete[] l_cDateTime;
+ l_cDateTime = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSaveNotificationPersistentData
+/// In this function, all the data related to persistent notification is retrieved from
+/// notification manager and stored in persistent file by persistent manager.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::NotificationpersistentserviceSaveNotificationPersistentData(EFrameworkunifiedNotificationType f_epersistenttype,
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // pointer of Notification Manager
+ CNotificationManager *l_pNotificationManager = NULL;
+
+ // pointer of Persistence Manager
+ CPersistenceManager *l_pCNotificationpersistentservicePersistenceManager = NULL;
+
+ Persistent_Notification_List_Type *l_vPersistentNotificationList = NULL;
+
+ // get the instance of notification manager
+ l_pNotificationManager = m_pNotificationManager;
+
+ // get the instance of persistence manager
+ l_pCNotificationpersistentservicePersistenceManager = m_pPersistenceManager;
+
+ if (NULL != l_pNotificationManager && NULL != l_pCNotificationpersistentservicePersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager and l_pCNotificationpersistentservicePersistenceManager can't be NULL // NOLINT[whitespace/line_length]
+ // create new vector to retrieve persistent notification data
+ l_vPersistentNotificationList = new(std::nothrow) Persistent_Notification_List_Type();
+
+ if (NULL != l_vPersistentNotificationList) { // LCOV_EXCL_BR_LINE 5: l_vPersistentNotificationList can't be NULL
+ // get all the persistent notification data in vector from notification manager
+ l_pNotificationManager->NotificationpersistentserviceGetPersistentNotificationData(l_vPersistentNotificationList,
+ f_epersistenttype,
+ f_uinotificationpersistentservicepersistcategoryflag);
+ } else {
+ // LCOV_EXCL_START 5: l_vPersistentNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_vPersistentNotificationList is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ if (NULL != l_vPersistentNotificationList) { // LCOV_EXCL_BR_LINE 5: l_vPersistentNotificationList can't be NULL
+ if (eFrameworkunifiedPersistedStateVar == f_epersistenttype) {
+ // save persistent notification data from vector to file
+ l_estatus = l_pCNotificationpersistentservicePersistenceManager->NotificationpersistentserviceSaveNotificationData(l_vPersistentNotificationList);
+ } else if (eFrameworkunifiedPersistedStateUserVar == f_epersistenttype) { // LCOV_EXCL_BR_LINE 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar // NOLINT[whitespace/line_length]
+ l_estatus = l_pCNotificationpersistentservicePersistenceManager->NotificationpersistentserviceSaveUserNotificationData(l_vPersistentNotificationList);
+ } else {
+ // LCOV_EXCL_START 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Save data for %d PersistentVarType not supported", f_epersistenttype);
+ // LCOV_EXCL_STOP
+ }
+
+
+ // delete the locally created vector
+ if (!l_vPersistentNotificationList->empty()) {
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_vPersistentNotificationList->size();
+ l_uiCount++) {
+ if (NULL != l_vPersistentNotificationList->at(l_uiCount)) { // LCOV_EXCL_BR_LINE 6: can't be NULL
+ delete l_vPersistentNotificationList->at(l_uiCount);
+ }
+ }
+
+ // clear the vector
+ l_vPersistentNotificationList->clear();
+ }
+
+ delete l_vPersistentNotificationList;
+ l_vPersistentNotificationList = NULL;
+ } else {
+ // LCOV_EXCL_START 5: l_vPersistentNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_vPersistentNotificationList is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager and l_pCNotificationpersistentservicePersistenceManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationManager is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnLoadPersistentData
+/// In this transition, persistent file is loaded by persistent manager and
+/// persistent notifications and its data is stored by notification manager.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::NotificationpersistentserviceLoadPersistentNotificationData(EFrameworkunifiedNotificationType f_epersistenttype) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // pointer of Notification Manager
+ CNotificationManager *l_pNotificationManager = NULL;
+
+ // pointer of Persistence Manager
+ CPersistenceManager *l_pNotificationpersistentservicePersistenceManager = NULL;
+
+ // iterator of CNotificationToPersist vector
+ Persistent_Notification_List_Type *l_vPersistentNotificationList = NULL;
+
+ // get the instance of notification manager
+ l_pNotificationManager = m_pNotificationManager;
+
+ // get the instance of persistent manager
+ l_pNotificationpersistentservicePersistenceManager = m_pPersistenceManager;
+
+ // create new vector for persistent notifications
+ l_vPersistentNotificationList = new(std::nothrow) Persistent_Notification_List_Type();
+
+ if (NULL != l_vPersistentNotificationList) { // LCOV_EXCL_BR_LINE 5: l_vPersistentNotificationList can't be NULL
+ if (NULL != l_pNotificationManager && NULL != l_pNotificationpersistentservicePersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager and l_pNotificationpersistentservicePersistenceManager can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedPersistedStateVar == f_epersistenttype) {
+ // read persistent notification data from file and store in vector
+ l_estatus = l_pNotificationpersistentservicePersistenceManager->NotificationpersistentserviceReadNotificationData(l_vPersistentNotificationList);
+ } else if (eFrameworkunifiedPersistedStateUserVar == f_epersistenttype) {
+ l_estatus = l_pNotificationpersistentservicePersistenceManager->NotificationpersistentserviceReadUserNotificationData(l_vPersistentNotificationList);
+ } else if (eFrameworkunifiedImmediatePersistedStateVar == f_epersistenttype) { // LCOV_EXCL_BR_LINE 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar or eFrameworkunifiedImmediatePersistedStateVar // NOLINT[whitespace/line_length]
+ l_estatus = l_pNotificationpersistentservicePersistenceManager->NotificationpersistentserviceReadNorNotificationData(l_vPersistentNotificationList);
+ } else {
+ // LCOV_EXCL_START 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar or eFrameworkunifiedImmediatePersistedStateVar // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Read data for %d PersistentVarType not supported", f_epersistenttype);
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 < l_vPersistentNotificationList->size()) {
+ // send the notification list to notification manager
+ l_estatus = l_pNotificationManager->NotificationpersistentserviceSetPersistentNotificationData(l_vPersistentNotificationList);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager and l_pNotificationpersistentservicePersistenceManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationManager or l_pNotificationpersistentservicePersistenceManager is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ if (!l_vPersistentNotificationList->empty()) {
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_vPersistentNotificationList->size();
+ l_uiCount++) {
+ if (NULL != l_vPersistentNotificationList->at(l_uiCount)) { // LCOV_EXCL_BR_LINE 6: can't be NULL
+ delete l_vPersistentNotificationList->at(l_uiCount);
+ }
+ }
+
+ // clear the vector
+ l_vPersistentNotificationList->clear();
+ }
+
+ delete l_vPersistentNotificationList;
+ l_vPersistentNotificationList = NULL;
+ } else {
+ // LCOV_EXCL_START 5: l_vPersistentNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error for l_vPersistentNotificationList");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateAndStartChildThreads
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::CreateAndStartChildThreads(HANDLE f_happ) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == f_happ) { // LCOV_EXCL_BR_LINE 6: f_happ can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_happ can't be NULL
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is eFrameworkunifiedStatusOK
+ // create reader thread
+ if (NULL != (m_hNSReadThread = FrameworkunifiedCreateChildThreadWithPriority(f_happ, m_cReadThreadName.c_str(), NSPCopyWorkerOnStart, NSPCopyWorkerOnStop, CNSNPP::m_siReadThreadPrio))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Thread %s created, Prio=%d",
+ m_cReadThreadName.c_str(),
+ CNSNPP::m_siReadThreadPrio);
+
+ // start the reader thread
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedStartChildThread(f_happ, m_hNSReadThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ m_pPersistenceManager->SetReadThreadHandle(m_hNSReadThread);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start Read Worker thread. Status:0x%x", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error creating NPP Read Worker thread");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is eFrameworkunifiedStatusOK
+ // create writer thread
+ if (NULL != (m_hNSWriteThread = FrameworkunifiedCreateChildThreadWithPriority(f_happ, m_cWriteThreadName.c_str(), NSPCopyWorkerOnStart, NSPCopyWorkerOnStop, CNSNPP::m_siWriteThreadPrio))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Thread %s created, Prio=%d",
+ m_cWriteThreadName.c_str(),
+ CNSNPP::m_siWriteThreadPrio);
+
+ // start the writer thread
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedStartChildThread(f_happ, m_hNSWriteThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ m_pPersistenceManager->SetWriteThreadHandle(m_hNSWriteThread);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start Write Worker thread. Status:0x%x", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error creating NPP Write Worker thread");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is eFrameworkunifiedStatusOK
+ // create immediate Persistence thread
+ if (NULL != (m_hNSImmediatePersistenceThread = FrameworkunifiedCreateChildThreadWithPriority(f_happ, m_cImmediatePersistenceThreadName.c_str(), NSPNorPersistenceWorkerOnStart, NSPNorPersistenceWorkerOnStop, CNSNPP::m_siImmediatePersistenceThreadPrio))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Thread %s created, Prio=%d", m_cImmediatePersistenceThreadName.c_str(),
+ CNSNPP::m_siImmediatePersistenceThreadPrio);
+
+ // start the immediate Persistence thread
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedStartChildThread(f_happ, m_hNSImmediatePersistenceThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ m_pPersistenceManager->SetNorPersistenceThreadHandle(m_hNSImmediatePersistenceThread);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start immediate persistence thread. Status:0x%x", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error creating NPP immediate persistence Worker thread");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ return l_estatus;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp
new file mode 100755
index 0000000..b54faeb
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp
@@ -0,0 +1,846 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains the implementation for archiving and extracting files and folders.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <zlib.h>
+#include <dirent.h>
+#include <zconf.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <libtar_listhash.h>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_copy_worker.h"
+
+
+tartype_t g_gztype = { (openfunc_t) OpenArchive, (closefunc_t) CloseArchive,
+ (readfunc_t) ReadArchive, (writefunc_t) WriteArchive
+ };
+
+GZFiles g_gzfiles;
+
+// CHUNK Size 256 Kb
+// Buffer size for feeding data to and pulling data from the zlib routines
+const size_t kChunkSize = 1U << 18;
+// buff size 32KB
+const size_t kBufSize = 1U << 15;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CArchive
+/// Constructor of CArchive class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CCopyWorker::CArchive::CArchive() {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CArchive
+/// Destructor of CArchive class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CCopyWorker::CArchive::~CArchive() {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FolderOperation
+/// Method to perform archive or extract operations
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::Archive(NSP_CopyInfoCmd &f_tarchiveinfocmd,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_pSourcePath = f_tarchiveinfocmd.m_csourcepath;
+ std::string l_pDestPath = f_tarchiveinfocmd.m_cdestinationpath;
+
+ if (!l_pSourcePath.empty() || !l_pDestPath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_pSourcePath and l_pDestPath can't be empty // NOLINT[whitespace/line_length]
+ size_t l_ifound = l_pDestPath.rfind("/");
+ // get string from start to last occurrence of '/'. Which will return directory path
+ std::string l_cOutDirPath = l_pDestPath.substr(0, l_ifound);
+ // check for load file or release file
+ if (LOADTYPE_RELEASE == f_tarchiveinfocmd.m_eloadtype) {
+ if (CFSDirectory::DoesDirecotryExist(l_pSourcePath)) {
+ // check if destination directory exist
+ if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s DOESN'T exist, Creating...",
+ l_cOutDirPath.c_str());
+ l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath);
+ }
+ // Create archive
+ if (eFrameworkunifiedStatusOK == (l_estatus = CreateTar(l_pSourcePath, l_pDestPath, // LCOV_EXCL_BR_LINE 6: CreateTar always return eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ f_tarchivestatusresponse))) {
+ // sync tar file to persistent memory
+ SI_32 l_iTarHandle = LIBTARFAIL;
+ if (LIBTARFAIL != (l_iTarHandle = open(l_pDestPath.c_str() , O_RDONLY))) {
+ struct stat l_objStat;
+ if (-1 != fstat(l_iTarHandle , &l_objStat)) { // LCOV_EXCL_BR_LINE 6: fstat always return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written in NAND memory, %ld, file=%s", l_objStat.st_size,
+ l_pDestPath.c_str());
+ }
+
+ close(l_iTarHandle);
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ // LCOV_EXCL_START 6: CreateTar always return eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Create tar Failed.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "CP_WRK_FAILURE_SRC_NOT_FND for %s ",
+ l_pSourcePath.c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ // check if destination directory exist
+ if (!CFSDirectory::DoesDirecotryExist(l_pDestPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s DOESN'T exist, Creating...",
+ l_pDestPath.c_str());
+ l_estatus = CFSDirectory::CreateDirectory(l_pDestPath);
+ }
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus will be always eFrameworkunifiedStatusOK
+ // Extract archive
+ l_estatus = ExtractTar(l_pSourcePath, l_pDestPath, f_tarchivestatusresponse);
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pSourcePath and l_pDestPath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateTar
+/// Method to create tar
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::CreateTar(const std::string &f_csourepath,
+ const std::string &f_cdestpath,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_cDestPath = f_cdestpath;
+ std::string l_pcRootDirPath = f_csourepath;
+
+ libtar_list_t *l_pLibTarList = NULL;
+ l_pLibTarList = libtar_list_new(LIST_QUEUE, NULL);
+ libtar_list_add(l_pLibTarList, (void *)l_pcRootDirPath.c_str()); // NOLINT (readability/casting)
+
+ if (!l_cDestPath.empty() || !l_pcRootDirPath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_cDestPath and l_pcRootDirPath cannot be empty // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != Create(l_cDestPath, l_pcRootDirPath, l_pLibTarList)) { // LCOV_EXCL_BR_LINE 6: Create always return eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: Create always return eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // not copied properly so remove temporary file
+ if (TRUE == CFSDirectory::RemoveDirectory(l_cDestPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete persistent directory successful.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete persistent directory unsuccessful.");
+ }
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archiving fails for %s to %s", l_pcRootDirPath.c_str(),
+ l_cDestPath.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Folder archived %s ", l_cDestPath.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Source Path %s", l_pcRootDirPath.c_str());
+
+ if (TRUE == CFSDirectory::RemoveDirectory(l_pcRootDirPath)) { // LCOV_EXCL_BR_LINE 6: always return true
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete temporary directory successful.");
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete temporary directory unsuccessful."); // LCOV_EXCL_LINE 6: always return true // NOLINT[whitespace/line_length]
+ }
+ l_estatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_cDestPath and l_pcRootDirPath cannot be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ libtar_list_free(l_pLibTarList, NULL);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ExtractTar
+/// Method to extract tar
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::ExtractTar(const std::string &f_csourepath,
+ const std::string &f_cdestpath,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_pcTarFileDestPath = f_cdestpath;
+ std::string l_pcRootDirPath = f_csourepath;
+
+ if (!l_pcTarFileDestPath.empty() || !l_pcRootDirPath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be empty // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != Extract(l_pcRootDirPath, l_pcTarFileDestPath)) {
+ // not copied properly so remove temporary file
+ if (TRUE == CFSDirectory::RemoveDirectory(l_pcTarFileDestPath)) { // LCOV_EXCL_BR_LINE 6: RemoveDirectory always return true // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete retrieved directory successful.");
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete retrieved directory unsuccessful."); // LCOV_EXCL_LINE 6: RemoveDirectory always return true // NOLINT[whitespace/line_length]
+ }
+
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "ABORT WAS CALLED!");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Extraction fails for %s to %s",
+ l_pcTarFileDestPath.c_str(), l_pcTarFileDestPath.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Folder extracted %s ", l_pcTarFileDestPath.c_str());
+ l_estatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Create
+/// Method to create tar
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::Create(std::string &f_pctarfiledestpath,
+ std::string &f_pcrootdirpath,
+ libtar_list_t *f_plibtarlist) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (FILEERROR == access(f_pcrootdirpath.c_str(), R_OK)) { // LCOV_EXCL_BR_LINE 6: access always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 6: access always return ok
+ }
+
+ TAR *l_pTarInfo = NULL;
+ CHAR l_cBuffer[MAX_PATH_LENGTH];
+ libtar_listptr_t l_pTarListPtr;
+
+ PCHAR l_pcTarFileDestPath = const_cast<PCHAR >(f_pctarfiledestpath.c_str());
+ PCHAR l_pcRootDirPath = const_cast<PCHAR >(f_pcrootdirpath.c_str());
+
+ CHAR l_temp[] = "/";
+
+ if (l_pcTarFileDestPath || l_pcRootDirPath) { // LCOV_EXCL_BR_LINE 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be NULL // NOLINT[whitespace/line_length]
+ // open tar archive
+ if (LIBTARFAIL == (tar_open(&l_pTarInfo, l_pcTarFileDestPath, &g_gztype, O_WRONLY | O_CREAT, // LCOV_EXCL_BR_LINE 6: tar_open always return ok // NOLINT[whitespace/line_length]
+ TARMODE, TAR_GNU))) {
+ // LCOV_EXCL_START 6: tar_open always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_open(): %s", std::strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ libtar_listptr_reset(&l_pTarListPtr);
+
+ while (libtar_list_next(f_plibtarlist, &l_pTarListPtr) != LIBTARSUCCESS) {
+ if (l_pcRootDirPath[0] != '/') { // LCOV_EXCL_BR_LINE 6: l_pcRootDirPath must begin with '/'
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s", l_pcRootDirPath); // LCOV_EXCL_LINE 6: l_pcRootDirPath must begin with '/' // NOLINT[whitespace/line_length]
+ } else {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_cBuffer, l_pcRootDirPath, sizeof(l_cBuffer));
+#endif
+ }
+
+ if (tar_append_tree(l_pTarInfo, l_cBuffer, l_temp) != LIBTARSUCCESS) { // LCOV_EXCL_BR_LINE 6: tar_append_tree always return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: tar_append_tree always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__,
+ "tar_append_tree(\"%s\", \"%s\"): %s", l_cBuffer,
+ l_temp, std::strerror(errno));
+ tar_close(l_pTarInfo);
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+ if (tar_append_eof(l_pTarInfo) != LIBTARSUCCESS) { // LCOV_EXCL_BR_LINE 6: tar_append_eof always return ok
+ // LCOV_EXCL_START 6: tar_append_eof always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_append_eof(): %s", std::strerror(errno));
+ tar_close(l_pTarInfo);
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (tar_close(l_pTarInfo) != LIBTARSUCCESS) { // LCOV_EXCL_BR_LINE 6: tar_close always return ok
+ // LCOV_EXCL_START 6: tar_close always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_close(): %s", std::strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// create
+/// Method to extract tar
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::Extract(std::string &f_pcrootdirpath, std::string &f_pctarfiledestpath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (FILEERROR == access(f_pcrootdirpath.c_str(), R_OK)) { // LCOV_EXCL_BR_LINE 6: access always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 6: access always return ok
+ }
+
+ PCHAR l_pcRootDirPath = const_cast<PCHAR >(f_pcrootdirpath.c_str());
+ PCHAR l_pcTarFileDestPath = const_cast<PCHAR >(f_pctarfiledestpath.c_str());
+
+ TAR *l_pTarInfo = NULL;
+
+ if (l_pcRootDirPath || l_pcTarFileDestPath) { // LCOV_EXCL_BR_LINE 6: double check, l_pcRootDirPath and l_pcTarFileDestPath can't be NULL // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Extraction open for %s to ", l_pcRootDirPath);
+
+ if (LIBTARFAIL == (tar_open(&l_pTarInfo, l_pcRootDirPath, &g_gztype, O_RDONLY, LIBTARSUCCESS, TAR_GNU))) { // LCOV_EXCL_BR_LINE 6: tar_open always return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: tar_open always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_open(): %s", std::strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (LIBTARSUCCESS != tar_extract_all(l_pTarInfo, l_pcTarFileDestPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_extract_all(): %s", std::strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (LIBTARSUCCESS != tar_close(l_pTarInfo)) { // LCOV_EXCL_BR_LINE 6: tar_close always return ok
+ // LCOV_EXCL_START 6: tar_close always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_close(): %s", std::strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pcRootDirPath and l_pcTarFileDestPath can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+SI_32 OpenArchive(PCHAR f_pcpathname, SI_32 f_sioflags, SI_32 f_simode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ gzFile l_gzfile = Z_NULL;
+ SI_32 l_sifiledescriptor = LIBTARFAIL;
+ if (f_pcpathname) { // LCOV_EXCL_BR_LINE 6: double check, f_pcpathname can't be NULL
+ PCHAR l_pcgzoflags;
+
+ switch (f_sioflags & O_ACCMODE) {
+ case O_WRONLY: {
+ l_pcgzoflags = (PCHAR)"wb";
+ break;
+ }
+ case O_RDONLY: {
+ l_pcgzoflags = (PCHAR)"rb";
+ break;
+ }
+ case O_RDWR:
+ default: {
+ // LCOV_EXCL_START 6: must be O_WRONLY or O_RDONLY
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EINVAL;
+ return LIBTARFAIL;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ l_sifiledescriptor = open(f_pcpathname, f_sioflags, f_simode);
+
+ if (LIBTARFAIL == l_sifiledescriptor) { // LCOV_EXCL_BR_LINE 6: l_sifiledescriptor always be ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return LIBTARFAIL; // LCOV_EXCL_LINE 6: l_sifiledescriptor always be ok
+ }
+
+ if (((f_sioflags & O_CREAT) && fchmod(l_sifiledescriptor, f_simode))) { // LCOV_EXCL_BR_LINE 6: always be ok
+ // LCOV_EXCL_START 6: always be ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(l_sifiledescriptor);
+ return LIBTARFAIL;
+ // LCOV_EXCL_STOP
+ }
+
+ l_gzfile = gzdopen(l_sifiledescriptor, l_pcgzoflags);
+ if (!l_gzfile) { // LCOV_EXCL_BR_LINE 6: l_gzfile always be not null
+ // LCOV_EXCL_START 6: l_gzfile always be not null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(l_sifiledescriptor);
+
+ errno = ENOMEM;
+ return LIBTARFAIL;
+ // LCOV_EXCL_STOP
+ } else {
+ g_gzfiles.insert(std::make_pair(l_sifiledescriptor, l_gzfile));
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path empty."); // LCOV_EXCL_LINE 6: double check, f_pcpathname can't be NULL // NOLINT[whitespace/line_length]
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_sifiledescriptor;
+}
+
+int CloseArchive(int fd) {
+ int ret;
+ gzFile gzfile = Z_NULL;
+
+ /* checks */
+ if (g_gzfiles.empty()) { // LCOV_EXCL_BR_LINE 6: g_gzfiles always be not empty
+ // LCOV_EXCL_START 6: g_gzfiles always be not empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EBADF;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ GZFiles::iterator gzfiles_it = g_gzfiles.find(fd);
+ if (gzfiles_it == g_gzfiles.end()) { // LCOV_EXCL_BR_LINE 6: fd will always be found
+ // LCOV_EXCL_START 6: fd will always be found
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EINVAL;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ /* call zlib */
+ gzfile = gzfiles_it->second;
+ ret = gzclose(gzfile);
+
+ /* remove gzFile* association from our list */
+ g_gzfiles.erase(gzfiles_it);
+
+ return ret;
+}
+
+ssize_t ReadArchive(int fd, void *buf, size_t count) {
+ gzFile gzfile = Z_NULL;
+
+ if (g_gzfiles.empty()) { // LCOV_EXCL_BR_LINE 6: g_gzfiles always be not empty
+ // LCOV_EXCL_START 6: g_gzfiles always be not empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EBADF;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ GZFiles::iterator gzfiles_it = g_gzfiles.find(fd);
+ if (gzfiles_it == g_gzfiles.end()) { // LCOV_EXCL_BR_LINE 6: fd will always be found
+ // LCOV_EXCL_START 6: fd will always be found
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EINVAL;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ gzfile = gzfiles_it->second;
+ return gzread(gzfile, buf, static_cast<UI_32>(count));
+}
+
+ssize_t WriteArchive(int fd, const void *buf, size_t count) {
+ gzFile gzfile = Z_NULL;
+
+ if (g_gzfiles.empty()) { // LCOV_EXCL_BR_LINE 6: g_gzfiles always be not empty
+ // LCOV_EXCL_START 6: g_gzfiles always be not empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EBADF;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ GZFiles::iterator gzfiles_it = g_gzfiles.find(fd);
+ if (gzfiles_it == g_gzfiles.end()) { // LCOV_EXCL_BR_LINE 6: fd will always be found
+ // LCOV_EXCL_START 6: fd will always be found
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EINVAL;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ gzfile = gzfiles_it->second;
+ return gzwrite(gzfile, buf, static_cast<UI_32>(count));
+}
+
+// LCOV_EXCL_START 6: unused code
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FileOperationUsingLibz
+/// Method to determine whether to compress/decompress file using libz
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::FileOperationUsingLibz(NSP_CopyInfoCmd &f_toperainfocmd,
+ NSP_CopyStatusResponse &f_toperarespstatus) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_pSourcePath = f_toperainfocmd.m_csourcepath;
+ std::string l_pDestPath = f_toperainfocmd.m_cdestinationpath;
+
+ if (!l_pSourcePath.empty() || !l_pDestPath.empty()) {
+ size_t l_ifound = l_pDestPath.rfind("/");
+ // get string from start to last occurrence of '/'. Which will return directory path
+ std::string l_cOutDirPath = l_pDestPath.substr(0, l_ifound);
+
+ // check if destination directory exist
+ if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s DOESN'T exist, Creating...",
+ l_cOutDirPath.c_str());
+ l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath);
+ }
+
+ // check for load file or release file
+ if (LOADTYPE_RELEASE == f_toperainfocmd.m_eloadtype) {
+ // Zip
+ if (eFrameworkunifiedStatusOK == (l_estatus = CompressUsingZlib(l_pSourcePath, l_pDestPath, Z_BEST_COMPRESSION))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "File Compression successful.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "File Compression failed.");
+ f_toperarespstatus.m_bpersistencechk = FALSE;
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else if (LOADTYPE_LOAD == f_toperainfocmd.m_eloadtype) {
+ // Unzip
+ if (eFrameworkunifiedStatusOK == (l_estatus = DeCompressUsingZlib(l_pSourcePath, l_pDestPath))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "File DeCompression successful.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "File DeCompression failed.");
+ f_toperarespstatus.m_bpersistencechk = FALSE;
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Wrong Request or No request for compression or decompression!");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path or Destination Path Empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 6: unused code
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CompressUsingZlib
+/// Method to compress file using libz
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::CompressUsingZlib(const std::string &f_csourepath,
+ const std::string &f_cdestpath,
+ SI_32 f_iziplevel) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (!f_csourepath.empty() || !f_cdestpath.empty()) {
+ std::string l_cSourePath = f_csourepath;
+ std::string l_cDestPath = f_cdestpath;
+
+ std::string l_TempFile = "";
+ l_TempFile.append(l_cDestPath.c_str());
+ l_TempFile.append(".nps_tmp");
+
+ FILE *l_pSrcFilePtr = fopen(l_cSourePath.c_str(), "rb");
+
+ if (NULL != l_pSrcFilePtr) {
+ FILE *l_pDestFilePtr = fopen(l_TempFile.c_str(), "wb");
+ if (NULL != l_pDestFilePtr) {
+ setvbuf(l_pSrcFilePtr, NULL, _IOFBF, kBufSize);
+ setvbuf(l_pDestFilePtr, NULL, _IOFBF, kBufSize);
+
+ // structure used to pass information to and from the zlib routines
+ z_stream l_tZstreamInfo = {};
+
+ // Allocate deflate state
+ l_tZstreamInfo.zalloc = Z_NULL;
+ l_tZstreamInfo.zfree = Z_NULL;
+ l_tZstreamInfo.opaque = Z_NULL;
+
+ // Initialize deflates
+ SI_32 l_iDeflateStatus = deflateInit(&l_tZstreamInfo, f_iziplevel);
+
+ // Deflate Flush Status to determine end of input file
+ SI_32 l_iDeflateFlushState = Z_FINISH;
+
+ std::vector< UI_8 > l_vInBuffer(kChunkSize);
+ std::vector< UI_8 > l_vOutBuffer(kChunkSize);
+
+ // pointer to the read bytes from the input file
+ UI_8 *l_pReadBuffer = &l_vInBuffer[0];
+ // pointer to the next available byte space to write to output file
+ UI_8 *l_pWriteBuffer = &l_vOutBuffer[0];
+
+ size_t l_uiDeflateRetData = 0;
+
+ if (Z_OK == l_iDeflateStatus) {
+ do {
+ // bytes read from input file
+ l_tZstreamInfo.avail_in = static_cast<uInt>(fread(l_pReadBuffer, 1, kChunkSize, l_pSrcFilePtr));
+
+ if (0 == ferror(l_pSrcFilePtr)) {
+ // if the eof input file reached set the flush state to Z_FINISH
+ // Z_NO_FLUSH to indicate that we still have uncompressed data
+ l_iDeflateFlushState = feof(l_pSrcFilePtr) ? Z_FINISH : Z_NO_FLUSH;
+ l_tZstreamInfo.next_in = l_pReadBuffer;
+
+ // run deflate() on input until output buffer not full, finish
+ // compression if all of source has been read in
+ do {
+ l_tZstreamInfo.avail_out = kChunkSize;
+ l_tZstreamInfo.next_out = l_pWriteBuffer;
+ // no bad return value
+ l_iDeflateStatus = deflate(&l_tZstreamInfo, l_iDeflateFlushState);
+ // state not clobbered
+ if (Z_STREAM_ERROR == l_iDeflateStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "zlib stream error");
+ } else {
+ l_uiDeflateRetData = kChunkSize - l_tZstreamInfo.avail_out;
+ if ((fwrite(l_pWriteBuffer, 1, l_uiDeflateRetData, l_pDestFilePtr) != l_uiDeflateRetData) ||
+ // all data not written properly
+ (0 != ferror(l_pDestFilePtr))) { // file error in writing
+ deflateEnd(&l_tZstreamInfo);
+ l_estatus = eFrameworkunifiedStatusFail;
+ l_tZstreamInfo.avail_out = 0;
+ l_iDeflateFlushState = Z_FINISH;
+ }
+ }
+ } while (0 == l_tZstreamInfo.avail_out); //<< check if deflate() has no more output
+ } else { // by seeing that it did not fill the output buffer
+ deflateEnd(&l_tZstreamInfo); // leaving avail_out greater than zero >>//
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ // all input will be used
+ if (0 != l_tZstreamInfo.avail_in) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All inputs in z-stream avail_in not used");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ // done when last data in file processed
+ } while (Z_FINISH != l_iDeflateFlushState);
+ // stream will be complete
+ if (Z_STREAM_END != l_iDeflateStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "z-stream not completed");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Compressed %lu bytes down to %lu bytes",
+ l_tZstreamInfo.total_in, l_tZstreamInfo.total_out);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written in NAND memory, %lu, file=%s", l_tZstreamInfo.total_out,
+ f_cdestpath.c_str());
+
+ // clean up and return
+ deflateEnd(&l_tZstreamInfo);
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "deflateInit Failed");
+ }
+
+ fclose(l_pDestFilePtr);
+
+ if (0 != rename(l_TempFile.c_str(), l_cDestPath.c_str())) {
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error renaming file %s to %s",
+ l_TempFile.c_str(), l_cDestPath.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Destination File Opening Error");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ fclose(l_pSrcFilePtr);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Source File Opening Error");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path or Destination Path Empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 6: unused code
+////////////////////////////////////////////////////////////////////////////////////////////
+/// DeCompressUsingZlib
+/// Method to decompress file using libz
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::DeCompressUsingZlib(const std::string &f_csourepath,
+ const std::string &f_cdestpath) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (!f_csourepath.empty() || !f_cdestpath.empty()) {
+ std::string l_cSourePath = f_csourepath;
+ std::string l_cDestPath = f_cdestpath;
+
+ std::string l_TempFile = "";
+ l_TempFile.append(l_cDestPath.c_str());
+ l_TempFile.append(".nps_tmp");
+
+ FILE *l_pSrcFilePtr = fopen(l_cSourePath.c_str(), "rb");
+
+ if (NULL != l_pSrcFilePtr) {
+ FILE *l_pDestFilePtr = fopen(l_TempFile.c_str(), "wb");
+ if (NULL != l_pDestFilePtr) {
+ setvbuf(l_pSrcFilePtr, NULL, _IOFBF, kBufSize);
+ setvbuf(l_pDestFilePtr, NULL, _IOFBF, kBufSize);
+
+ z_stream l_tZstreamInfo = {};
+
+ // allocate inflate state
+ l_tZstreamInfo.zalloc = Z_NULL;
+ l_tZstreamInfo.zfree = Z_NULL;
+ l_tZstreamInfo.opaque = Z_NULL;
+ l_tZstreamInfo.avail_in = 0;
+ l_tZstreamInfo.next_in = Z_NULL;
+
+ SI_32 l_iInflateStatus = inflateInit(&l_tZstreamInfo);
+
+ if (Z_OK == l_iInflateStatus) {
+ std::vector< UI_8 > l_vInBuffer(kChunkSize);
+ std::vector< UI_8 > l_vOutBuffer(kChunkSize);
+
+ // pointer to the read bytes from the input file
+ UI_8 *l_pReadBuffer = &l_vInBuffer[0];
+ // pointer to the next available byte space to write to output file
+ UI_8 *l_pWriteBuffer = &l_vOutBuffer[0];
+
+ size_t l_uiDeflateRetData = 0;
+
+ do {
+ l_tZstreamInfo.avail_in = static_cast<uInt>(fread(l_pReadBuffer, 1, kChunkSize, l_pSrcFilePtr));
+ if (0 == ferror(l_pSrcFilePtr)) {
+ if (0 == l_tZstreamInfo.avail_in) {
+ break;
+ }
+ l_tZstreamInfo.next_in = l_pReadBuffer;
+ // run inflate() on input until output buffer not full
+ do {
+ l_tZstreamInfo.avail_out = kChunkSize;
+ l_tZstreamInfo.next_out = l_pWriteBuffer;
+ l_iInflateStatus = inflate(&l_tZstreamInfo, Z_NO_FLUSH);
+
+ // state clobbered
+ if (Z_STREAM_ERROR == l_iInflateStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "zlib stream error");
+ l_estatus = eFrameworkunifiedStatusFail;
+ } else if (Z_NEED_DICT == l_iInflateStatus) {
+ l_iInflateStatus = Z_DATA_ERROR;
+ l_estatus = eFrameworkunifiedStatusFail;
+ } else if (Z_MEM_ERROR == l_iInflateStatus) {
+ inflateEnd(&l_tZstreamInfo);
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Out of Memory");
+ } else {
+ l_uiDeflateRetData = kChunkSize - l_tZstreamInfo.avail_out;
+ // all data not written
+ if ((fwrite(l_pWriteBuffer, 1, l_uiDeflateRetData, l_pDestFilePtr) != l_uiDeflateRetData) ||
+ (0 != ferror(l_pDestFilePtr))) { // or file writing error
+ inflateEnd(&l_tZstreamInfo);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ } while (0 == l_tZstreamInfo.avail_out);
+ } else {
+ inflateEnd(&l_tZstreamInfo);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ // done when inflate() says it's done
+ } while (Z_STREAM_END != l_iInflateStatus);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " De-compressed %lu bytes to %lu bytes",
+ l_tZstreamInfo.total_in, l_tZstreamInfo.total_out);
+ // clean up and return
+ inflateEnd(&l_tZstreamInfo);
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ fclose(l_pDestFilePtr);
+
+ if (0 != rename(l_TempFile.c_str(), l_cDestPath.c_str())) {
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error renaming file %s to %s",
+ l_TempFile.c_str(), l_cDestPath.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Destination File Opening Error");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ fclose(l_pSrcFilePtr);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Source File Opening Error");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path or Destination Path Empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp
new file mode 100755
index 0000000..e0a749f
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp
@@ -0,0 +1,649 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains definition of CBinaryAccesser class.
+/// This class stores data in a file in binary format.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+#endif
+#include <cerrno>
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_binary_accesser.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_persistent_accesser.h"
+
+struct PersistFileHeder {
+ char check_code[4];
+ unsigned int crc;
+};
+#define NPP_CHECK_CODE "NPPD"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CBinaryAccesser
+/// Constructor of CBinaryAccesser class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CBinaryAccesser::CBinaryAccesser() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_uiCurStrOffset = 0;
+ m_uiCurStrSize = 0;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CBinaryAccesser
+/// Destructor of CBinaryAccesser class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CBinaryAccesser::~CBinaryAccesser() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// PersistData
+/// Persist data in persistent memory in a file in binary format.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::PersistData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *f_vdata,
+ EFrameworkunifiedNotificationType f_epersistenttype,
+ EFrameworkunifiedPersistCategory f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ int l_OutFd;
+
+ if (NULL != f_vdata) { // LCOV_EXCL_BR_LINE 6: f_vdata can't be NULL
+ // Open global file in write mode.
+ if ((eFrameworkunifiedStatusOK == OpenFileForWriting(&l_OutFd, f_cmemfilepath))) {
+ Persistent_Notification_List_Iterator l_itNotificationList = f_vdata->begin();
+
+ // Iterate through a vector f_vdata
+ for (; l_itNotificationList != f_vdata->end(); l_itNotificationList++) {
+ if (eFrameworkunifiedPersistedStateVar == (*l_itNotificationList)->m_ePersistentType) {
+ if (f_epersistcategory == (*l_itNotificationList)->m_ePersistCategory) {
+ // write header and data
+ if (eFrameworkunifiedStatusOK != WriteHeaderAndData((*l_itNotificationList),
+ (*l_itNotificationList)->m_pPersistentData->m_pMessage,
+ l_OutFd)) {
+ l_estatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ }
+ } else {
+ // write header and data
+ if (eFrameworkunifiedStatusOK != WriteHeaderAndData((*l_itNotificationList),
+ (*l_itNotificationList)->m_pPersistentData->m_pMessage,
+ l_OutFd)) {
+ l_estatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != WriteFileHeaderAndDuplicate(l_OutFd, f_cmemfilepath)) {
+ l_estatus = eFrameworkunifiedStatusFail;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written in NAND memory, %ld, file=%s",
+ static_cast<long int>(m_uiCurStrOffset - sizeof(PersistFileHeder)), f_cmemfilepath.c_str()); // NOLINT (runtime/int)
+ }
+ close(l_OutFd);
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file %s", f_cmemfilepath.c_str());
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// RetrieveData
+/// Retrieve data in persistent memory in a file in binary format.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::RetrieveData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *&f_vdata,
+ EFrameworkunifiedPersistCategory f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ int l_InFd;
+
+ if (NULL != f_vdata) { // LCOV_EXCL_BR_LINE 6: f_vdata can't be NULL
+ if ((eFrameworkunifiedStatusOK == (l_estatus = OpenFileForReading(&l_InFd, f_cmemfilepath)))) {
+ l_estatus = FillNotificationList(l_InFd, f_vdata, f_epersistcategory);
+
+ close(l_InFd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file %s, status=%d", f_cmemfilepath.c_str(), l_estatus);
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_vdata can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_pdata is NULL");
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FillNotificationList
+/// This function retrieve the notification data from file and fill it in map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::FillNotificationList(int f_infd,
+ Persistent_Notification_List_Type *&f_vdata,
+ EFrameworkunifiedPersistCategory f_epersistcategory) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL == f_vdata) { // LCOV_EXCL_BR_LINE 6: f_vdata can't be NULL
+ // LCOV_EXCL_START 6: f_vdata can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_pdata is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ while (eFrameworkunifiedStatusOK == l_estatus) {
+ CPersistDataHeader l_objCPersistDataHeader;
+ CHAR *l_pData = NULL;
+
+ // Read header and data.
+ l_estatus = ReadHeaderAndData(l_objCPersistDataHeader, l_pData, f_infd);
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ CNotificationsToPersist *l_objCNotificationsToPersist = new(std::nothrow) CNotificationsToPersist();
+ CPersistentData *l_objCPersistentData = new(std::nothrow) CPersistentData();
+
+ // fill the appropriate values in l_objCNotificationsToPersist
+ if ((NULL != l_objCPersistentData) && (NULL != l_objCNotificationsToPersist)) { // LCOV_EXCL_BR_LINE 5: new's error case // NOLINT[whitespace/line_length]
+ l_objCPersistentData->m_pMessage = new(std::nothrow) CHAR[l_objCPersistDataHeader.m_uiSize];
+ if (NULL != l_objCPersistentData->m_pMessage) { // LCOV_EXCL_BR_LINE 5: new's error case
+ std::memcpy(l_objCPersistentData->m_pMessage, l_pData, l_objCPersistDataHeader.m_uiSize);
+ l_objCPersistentData->m_uiMsgSize = l_objCPersistDataHeader.m_uiSize;
+ l_objCNotificationsToPersist->m_ePersistentType = l_objCPersistDataHeader.m_ePersistentType;
+ l_objCNotificationsToPersist->m_ePersistCategory = f_epersistcategory;
+
+ l_objCNotificationsToPersist->m_cNotificationName = l_objCPersistDataHeader.m_cNotificationName;
+ l_objCNotificationsToPersist->m_cPublisherName = l_objCPersistDataHeader.m_cPublisherName;
+
+ l_objCNotificationsToPersist->m_pPersistentData = l_objCPersistentData;
+
+ l_objCNotificationsToPersist->m_uiMaxMsgLength = l_objCPersistDataHeader.m_uiMaxMsgLength;
+ f_vdata->push_back(l_objCNotificationsToPersist);
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::memset(&l_objCPersistDataHeader, 0, sizeof(CPersistDataHeader));
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::memset(&l_objCPersistDataHeader, 0, sizeof(CPersistDataHeader));
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ } else if (eFrameworkunifiedStatusErrOther == l_estatus) {
+ // EOF
+ l_estatus = eFrameworkunifiedStatusOK;
+ break;
+ } else {
+ std::memset(&l_objCPersistDataHeader, 0, sizeof(CPersistDataHeader));
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::OpenFileForReading(int *f_infd,
+ std::string f_cfilepath) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // raw & raw.bak file unlink
+ std::string l_cUnlinkPath(f_cfilepath);
+ unlink(l_cUnlinkPath.c_str());
+ l_cUnlinkPath.append(".bak");
+ unlink(l_cUnlinkPath.c_str());
+
+ // add .valid
+ std::string l_cValidPath(f_cfilepath);
+ l_cValidPath.append(".valid");
+
+ if ((*f_infd = open(l_cValidPath.c_str(), O_RDONLY)) >= 0) {
+ if (eFrameworkunifiedStatusOK == CheckFileHeader(*f_infd)) {
+ struct stat st;
+ if (fstat(*f_infd, &st) == 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
+ if (st.st_size == 0) {
+ // If original file is 0byte, to confirm bak file
+ int bak_fd;
+ if (eFrameworkunifiedStatusOK == OpenBakFileForReading(&bak_fd, l_cValidPath)) {
+ close(*f_infd);
+ *f_infd = bak_fd;
+ }
+ }
+ }
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ close(*f_infd);
+ l_estatus = OpenBakFileForReading(f_infd, l_cValidPath);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) fail: %s", l_cValidPath.c_str(), strerror(errno));
+ l_estatus = OpenBakFileForReading(f_infd, l_cValidPath);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// OpenFileForWriting
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::OpenFileForWriting(int *f_outfd,
+ std::string f_cfilepath) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ std::string l_cPath(f_cfilepath);
+ size_t l_ifound = l_cPath.rfind("/");
+ std::string l_cOutDirPath = l_cPath.substr(0, l_ifound);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Path for persistence %s ", l_cOutDirPath.c_str());
+
+ // if parent directory path doesn't exists, create it
+ if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s DOESN'T exist, Creating...", l_cOutDirPath.c_str());
+ if (eFrameworkunifiedStatusOK != (l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath))) { // LCOV_EXCL_BR_LINE 6: CreateDirectory always return ok // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Failed to create %s ", l_cOutDirPath.c_str()); // LCOV_EXCL_LINE 6: CreateDirectory always return ok // NOLINT[whitespace/line_length]
+ }
+ }
+
+ // add .valid
+ std::string l_cValidPath(f_cfilepath);
+ l_cValidPath.append(".valid");
+
+ if ((*f_outfd = open(l_cValidPath.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0660)) >= 0) {
+ if (lseek(*f_outfd, sizeof(PersistFileHeder), SEEK_SET) == sizeof(PersistFileHeder)) { // LCOV_EXCL_BR_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ l_estatus = eFrameworkunifiedStatusOK;
+ m_uiCurStrOffset = sizeof(PersistFileHeder);
+ } else {
+ // LCOV_EXCL_START 5: lseek's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno));
+ close(*f_outfd);
+ *f_outfd = -1;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) fail: %s", l_cValidPath.c_str(), strerror(errno));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// WriteHeaderAndData
+/// Write header and data in a file.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::WriteHeaderAndData(CNotificationsToPersist *f_pnotificationstopersist,
+ PVOID f_pdata,
+ int f_outfd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+
+ if ((NULL == f_pdata) || (NULL == f_pnotificationstopersist)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_pdata is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ } else {
+ CPersistDataHeader l_objCPersistDataHeader;
+
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_objCPersistDataHeader.m_cNotificationName, f_pnotificationstopersist->m_cNotificationName.c_str(),
+ sizeof(l_objCPersistDataHeader.m_cNotificationName));
+ strlcpy(l_objCPersistDataHeader.m_cPublisherName, f_pnotificationstopersist->m_cPublisherName.c_str(),
+ sizeof(l_objCPersistDataHeader.m_cPublisherName));
+#endif
+
+ // size check
+ if (UINT32_MAX >= static_cast<size_t>(sizeof(CPersistDataHeader) + l_objCPersistDataHeader.m_uiSize)) { // LCOV_EXCL_BR_LINE 5: the size is not bigger than UINT32_MAX // NOLINT[whitespace/line_length]
+ l_objCPersistDataHeader.m_uiOffset = static_cast<UI_32>(m_uiCurStrOffset + sizeof(CPersistDataHeader));
+ l_objCPersistDataHeader.m_uiSize = f_pnotificationstopersist->m_pPersistentData->m_uiMsgSize;
+ l_objCPersistDataHeader.m_ePersistentType = f_pnotificationstopersist->m_ePersistentType;
+ l_objCPersistDataHeader.m_uiMaxMsgLength = f_pnotificationstopersist->m_uiMaxMsgLength;
+
+ // write header
+ if (write(f_outfd, (PCHAR)&l_objCPersistDataHeader, sizeof(CPersistDataHeader)) == sizeof(CPersistDataHeader)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ // write data
+ if (write(f_outfd, (PCHAR)f_pdata, // LCOV_EXCL_BR_LINE 5: write's error case
+ l_objCPersistDataHeader.m_uiSize) == (ssize_t)l_objCPersistDataHeader.m_uiSize) {
+ // save offset of end of current record's data
+ m_uiCurStrOffset += static_cast<UI_32>(sizeof(CPersistDataHeader) + l_objCPersistDataHeader.m_uiSize);
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while writing data: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while writing header: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::ReadHeaderAndData(CPersistDataHeader &f_objcpersistdataheader,
+ CHAR *&f_pdata, int f_infd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ static UI_32 l_uisPrevAllocSz = 0;
+ ssize_t l_iRet;
+
+ // read header
+ l_iRet = read(f_infd, (PCHAR)&f_objcpersistdataheader, sizeof(f_objcpersistdataheader));
+ if (l_iRet != sizeof(f_objcpersistdataheader)) {
+ if (l_iRet < 0) { // LCOV_EXCL_BR_LINE 5: read's error case
+ // LCOV_EXCL_START 5: read's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while reading header: %s", strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ l_estatus = eFrameworkunifiedStatusErrOther; // TODO(my_username): set specific error as eNotificationpersistentserviceStatusEOFReadched
+ }
+ std::memset(&f_objcpersistdataheader, 0, sizeof(CPersistDataHeader));
+ } else { // read data
+ m_uiCurStrOffset += static_cast<UI_32>(sizeof(CPersistDataHeader));
+ if (static_cast<int>(f_objcpersistdataheader.m_uiSize) > 0 &&
+ m_uiCurStrOffset + f_objcpersistdataheader.m_uiSize <= m_uiCurStrSize) {
+ // if f_pdata has space allocated and if the allocated size less than new size,
+ // free and reallocate
+ if ((NULL != f_pdata) && (l_uisPrevAllocSz < f_objcpersistdataheader.m_uiSize)) { // LCOV_EXCL_BR_LINE 6: f_pdata must be null // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: f_pdata must be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete[] f_pdata;
+ f_pdata = NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ if (NULL == f_pdata) { // LCOV_EXCL_BR_LINE 200: f_pdata must be null
+ f_pdata = new(std::nothrow) CHAR[f_objcpersistdataheader.m_uiSize];
+ } else {
+ // memory already allcoated.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+
+ if (NULL != f_pdata) { // LCOV_EXCL_BR_LINE 6: f_pdata can't be null
+ l_uisPrevAllocSz = f_objcpersistdataheader.m_uiSize;
+ l_iRet = read(f_infd, (PCHAR)f_pdata, f_objcpersistdataheader.m_uiSize);
+ if (l_iRet == (ssize_t)f_objcpersistdataheader.m_uiSize) { // LCOV_EXCL_BR_LINE 5: read's error case
+ m_uiCurStrOffset += f_objcpersistdataheader.m_uiSize;
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while reading data: %s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_pdata can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem Allocation failure");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invlide data size: %u", f_objcpersistdataheader.m_uiSize);
+ std::memset(&f_objcpersistdataheader, 0, sizeof(CPersistDataHeader));
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+EFrameworkunifiedStatus CBinaryAccesser::WriteFileHeaderAndDuplicate(int f_outfd, std::string f_cfilepath) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ struct stat st;
+
+ if (fstat(f_outfd, &st) == 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
+ if (st.st_size > static_cast<long>(sizeof(PersistFileHeder))) { // NOLINT (runtime/int)
+ size_t body_size = static_cast<size_t>(st.st_size - sizeof(PersistFileHeder));
+ char *buf = new(std::nothrow) char[body_size];
+ if (buf != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ if (lseek(f_outfd, sizeof(PersistFileHeder), SEEK_SET) == sizeof(PersistFileHeder)) { // LCOV_EXCL_BR_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ if (read(f_outfd, buf, body_size) == static_cast<ssize_t>(body_size)) { // LCOV_EXCL_BR_LINE 5: read's error case // NOLINT[whitespace/line_length]
+ PersistFileHeder f_header;
+ std::memcpy(&f_header.check_code, NPP_CHECK_CODE, sizeof(f_header.check_code));
+ f_header.crc = static_cast<UI_32>(CalcCRC(buf, static_cast<UI_32>(body_size)));
+ if (lseek(f_outfd, 0, SEEK_SET) == 0) { // LCOV_EXCL_BR_LINE 5: lseek's error case
+ if (write(f_outfd, &f_header, sizeof(f_header)) == sizeof(f_header)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ eStatus = eFrameworkunifiedStatusOK;
+
+ // file duplicate
+ std::string bak_file_path = f_cfilepath;
+ bak_file_path.append(".valid.bak");
+ int bak_fd = open(bak_file_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0660);
+ if (bak_fd >= 0) { // LCOV_EXCL_BR_LINE 5: open's error case
+ if (write(bak_fd, &f_header, sizeof(f_header)) == sizeof(f_header)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ if (write(bak_fd, buf, body_size) != static_cast<ssize_t>(body_size)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ }
+ close(bak_fd);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: open's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case
+ }
+ delete[] buf;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem Allocation failure"); // LCOV_EXCL_LINE 5: new's error case
+ }
+ } else {
+ // 0byte file through
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: fstat's error case
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CBinaryAccesser::CheckFileHeader(int f_infd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ struct stat st;
+
+ if (fstat(f_infd, &st) == 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
+ if (st.st_size > static_cast<long>(sizeof(PersistFileHeder))) { // NOLINT (runtime/int)
+ size_t body_size = static_cast<size_t>(st.st_size - sizeof(PersistFileHeder));
+ char *buf = new(std::nothrow) char[body_size];
+ if (buf != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ if (lseek(f_infd, sizeof(PersistFileHeder), SEEK_SET) == sizeof(PersistFileHeder)) { // LCOV_EXCL_BR_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ if (read(f_infd, buf, body_size) == static_cast<ssize_t>(body_size)) {
+ UI_32 crc32 = static_cast<UI_32>(CalcCRC(buf, static_cast<UI_32>(body_size)));
+ PersistFileHeder f_header;
+ if (lseek(f_infd, 0, SEEK_SET) == 0) { // LCOV_EXCL_BR_LINE 5: lseek's error case
+ if (read(f_infd, &f_header, sizeof(f_header)) == sizeof(f_header)) { // LCOV_EXCL_BR_LINE 5: read's error case // NOLINT[whitespace/line_length]
+ if (std::memcmp(&f_header.check_code, NPP_CHECK_CODE, sizeof(f_header.check_code)) == 0
+ && f_header.crc == crc32) {
+ m_uiCurStrOffset = sizeof(f_header);
+ m_uiCurStrSize = static_cast<UI_32>(st.st_size);
+ eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "file header fail: %02x %02x %02x %02x %#x:%#x",
+ f_header.check_code[0], f_header.check_code[1],
+ f_header.check_code[2], f_header.check_code[3], crc32, f_header.crc);
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail: %s", strerror(errno));
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case
+ }
+ delete[] buf;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem Allocation failure"); // LCOV_EXCL_LINE 5: new's error case
+ }
+ } else {
+ // 0byte file through
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: fstat's error case
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CBinaryAccesser::OpenBakFileForReading(int *f_infd, std::string f_cfilepath) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ std::string bak_file_path = f_cfilepath;
+ bak_file_path.append(".bak");
+
+ *f_infd = open(bak_file_path.c_str(), O_RDONLY);
+ if (*f_infd >= 0) {
+ struct stat st;
+ if (fstat(*f_infd, &st) == 0) {
+ // Error if bak file is 0byte
+ if (st.st_size > 0) {
+ if (eFrameworkunifiedStatusOK == CheckFileHeader(*f_infd)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s fail. bak file correct.", f_cfilepath.c_str());
+ eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ close(*f_infd);
+ *f_infd = -1;
+ }
+ } else {
+ close(*f_infd);
+ *f_infd = -1;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat fail: %s", strerror(errno));
+ close(*f_infd);
+ *f_infd = -1;
+ }
+ }
+
+ return eStatus;
+}
+
+/*
+ * CRC-32C lookup table
+ *
+ * Polynomial 0x1EDC6F41
+ */
+static const UI_32 crc32_lookup[4][256] = { // NOLINT (readability/naming)
+ {
+ },
+ {
+ },
+ {
+ },
+ {
+ }
+};
+
+UI_32 CBinaryAccesser::CalcCRC(PVOID f_pdata, UI_32 f_size) {
+ UI_32 crc = 0xFFFFFFFF;
+ const UI_32 *current = (const UI_32 *)f_pdata;
+
+ while (f_size >= 4) {
+ UI_32 one = *current++ ^ crc;
+ crc = crc32_lookup[0][(one >> 24) & 0xFF] ^
+ crc32_lookup[1][(one >> 16) & 0xFF] ^
+ crc32_lookup[2][(one >> 8) & 0xFF] ^
+ crc32_lookup[3][one & 0xFF];
+ f_size -= 4;
+ }
+
+ const UI_8 *current_char = (const UI_8 *)current;
+ while (f_size-- > 0) {
+ crc = (crc >> 8) ^ crc32_lookup[0][(crc & 0xFF) ^ *current_char++];
+ }
+
+ return ~crc;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp
new file mode 100755
index 0000000..4638a7d
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp
@@ -0,0 +1,1153 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file implements the CCopyWorker class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_util_crc.h>
+#include <native_service/ns_logger_if.h>
+
+// standard headers
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <dirent.h>
+
+#include <string>
+#include <utility>
+
+// ns headers
+#include "ns_npp_copy_worker.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_persistence.h"
+#include "ns_npp_threads.h"
+#include "ns_npp.h"
+
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+/*#include "PosixBasedOS001legacy_types.h"*/
+#include <unistd.h>
+#include <sys/syscall.h>
+#endif
+
+#define NS_NPP_WRITESIZE1 4096
+#define NS_NPP_WRITESIZE2 32768
+#define NS_NPP_REMOVE_DIR_DELAY 100 // in ms
+#define NS_NPP_FILEWRITE_DELAY 50 // in ms
+
+pthread_mutex_t g_mutworkerthread = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t CCopyWorker::m_sAbortMutex = PTHREAD_MUTEX_INITIALIZER;
+BOOL CCopyWorker::m_sbAbortCopy = FALSE;
+
+template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)> EFrameworkunifiedStatus WorkerCallback(HANDLE hthread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ C *l_pClass = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hthread));
+
+ if (l_pClass) { // LCOV_EXCL_BR_LINE 6: l_pClass can't be NULL
+ l_estatus = (l_pClass->*M)(hthread);
+ }
+
+ return l_estatus;
+}
+
+// Initialize static members
+TMServiceTagCRC CCopyWorker::CCopyWorker::g_mservicetagcrc;
+CMutex CCopyWorker::CCopyWorker::g_objmtxservicetag;
+
+static FrameworkunifiedProtocolCallbackHandler aServiceHandlers[] = { // NOLINT (readability/naming) // LCOV_EXCL_BR_LINE 11: unexpected branch
+ { CP_WRK_CMD_COPY, WorkerCallback<CCopyWorker, &CCopyWorker::OnWrkCmdCopy> },
+ { CP_WRK_CMD_RESUME, WorkerCallback<CCopyWorker, &CCopyWorker::OnWrkCmdResume> },
+ { AR_CMD_ARCHIVE, WorkerCallback<CCopyWorker, &CCopyWorker::OnWrkCmdArchive> },
+ { CMD_WRK_SHUTDOWN_REQ, WorkerCallback<CCopyWorker, &CCopyWorker::OnCmdShutdownRequest>},
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CCopyWorker
+/// Constructor of CCopyWorker class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CCopyWorker::CCopyWorker() {
+ pthread_mutex_init(&m_sAbortMutex, NULL);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CCopyWorker
+/// Destructor of CCopyWorker class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CCopyWorker::~CCopyWorker() {
+ pthread_mutex_destroy(&m_sAbortMutex);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Abort
+/// Method to abort worker thread.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CCopyWorker::Abort() { // LCOV_EXCL_START 8: not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ pthread_mutex_lock(&m_sAbortMutex);
+ m_sbAbortCopy = TRUE;
+ pthread_mutex_unlock(&m_sAbortMutex);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// InAbortState
+/// Method to check for abort state.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CCopyWorker::InAbortState() const {
+ BOOL l_bAbortStatus = FALSE;
+ pthread_mutex_lock(&m_sAbortMutex);
+ l_bAbortStatus = m_sbAbortCopy;
+ pthread_mutex_unlock(&m_sAbortMutex);
+
+ return l_bAbortStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetCopyStatusToFailure
+/// Method to set the copy status failure.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::SetCopyStatusToFailure(NSP_CopyStatusResponse &f_tcopystatusresponse, // LCOV_EXCL_START 8: not used // NOLINT[whitespace/line_length]
+ const ENPS_CopyWorkerFailures f_eworkerfailcmd) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ f_tcopystatusresponse.m_bpersistencechk = FALSE;
+ f_tcopystatusresponse.m_ecopyfailures = f_eworkerfailcmd;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusFail;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnWrkCmdCopy
+/// Callback method on copy command.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnWrkCmdCopy(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ NSP_CopyStatusResponse l_tCopyStatus = {};
+ NSP_CopyInfoCmd l_tCopyInfo = {};
+ UI_32 l_uiFileSize = 0;
+ UI_32 l_ui32FileCRC = 0;
+ PSTR l_cTmpStorageFile = NULL;
+
+ if (NULL != hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
+ if (FrameworkunifiedGetMsgLength(hthread) == sizeof(l_tCopyInfo)) { // LCOV_EXCL_BR_LINE 200: the size of msg must be sizeof(NSP_CopyInfoCmd) // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tCopyInfo, sizeof(NSP_CopyInfoCmd), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_tCopyStatus.m_eloadtype = l_tCopyInfo.m_eloadtype;
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_tCopyStatus.m_cpersistenttag, l_tCopyInfo.m_cpersistenttag, sizeof(l_tCopyStatus.m_cpersistenttag));
+ strlcpy(l_tCopyStatus.m_crequesterappname,
+ l_tCopyInfo.m_crequesterappname,
+ sizeof(l_tCopyStatus.m_crequesterappname));
+#endif
+
+ l_tCopyStatus.m_epersisttype = l_tCopyInfo.m_epersisttype;
+
+ if (ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ == l_tCopyInfo.m_ecompressiontype) { // LCOV_EXCL_BR_LINE 6: l_tCopyInfo.m_ecompressiontype can't be ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: l_tCopyInfo.m_ecompressiontype can't be ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CCopyWorker::CArchive *l_pCArchive = new(std::nothrow) CCopyWorker::CArchive();
+
+ if (NULL != l_pCArchive) {
+ // Start the folder archive or extract operation
+ if (eFrameworkunifiedStatusOK == (l_estatus = l_pCArchive->FileOperationUsingLibz(l_tCopyInfo, l_tCopyStatus))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Compress/Decompress Successful");
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail; // Set the archive status to failure
+ }
+ delete l_pCArchive;
+ l_pCArchive = NULL;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Tag: %s SourceFile: %s DestFile: %s",
+ l_tCopyInfo.m_cpersistenttag != 0 ? l_tCopyInfo.m_cpersistenttag : NULL,
+ l_tCopyInfo.m_csourcepath != 0 ? l_tCopyInfo.m_csourcepath : NULL,
+ l_tCopyInfo.m_cdestinationpath != 0 ? l_tCopyInfo.m_cdestinationpath : NULL);
+
+ if (LOADTYPE_RELEASE == l_tCopyStatus.m_eloadtype) {
+ // if release, source file needs to check whether it's changed or not
+ l_cTmpStorageFile = l_tCopyInfo.m_csourcepath;
+ } else if (LOADTYPE_LOAD == l_tCopyStatus.m_eloadtype) { // LCOV_EXCL_BR_LINE 6: m_eloadtype must be LOADTYPE_RELEASE or LOADTYPE_LOAD // NOLINT[whitespace/line_length]
+ // if load, dest file needs to check whether it's changed or not
+ l_cTmpStorageFile = l_tCopyInfo.m_cdestinationpath;
+
+ // check if file on temporary location exists, then no need to load from persistent memory
+ if (0 == access(l_tCopyInfo.m_cdestinationpath, F_OK)) { // LCOV_EXCL_BR_LINE 5: access's error case
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "File to load::%s for source::%s "
+ "is already present on path:: %s.",
+ l_tCopyInfo.m_cpersistenttag != 0 ? l_tCopyInfo.m_cpersistenttag : NULL,
+ l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL,
+ l_tCopyInfo.m_cdestinationpath != 0 ? l_tCopyInfo.m_cdestinationpath : NULL);
+ l_estatus = eFrameworkunifiedStatusFileLoadSuccess;
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // let l_cTmpStorageFile be NULL.
+ }
+
+ if (eFrameworkunifiedStatusFileLoadSuccess == l_estatus) {
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ if (NULL != l_cTmpStorageFile) { // LCOV_EXCL_BR_LINE 6: l_cTmpStorageFile can't be NULL
+ if (!VerifyWithStoredCRC(l_tCopyStatus.m_crequesterappname,
+ l_tCopyStatus.m_cpersistenttag,
+ l_cTmpStorageFile,
+ l_ui32FileCRC)) { // l_ui32FileCRC: out param
+ // Check if file release and CRC verification is enabled
+ if ((LOADTYPE_RELEASE == l_tCopyStatus.m_eloadtype) && (CNSNPP::m_siCRCCheckCount > 0)) { // LCOV_EXCL_BR_LINE 200: cannot test code // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = TryFileCopyWithCRCCheck(l_tCopyInfo.m_csourcepath,
+ l_tCopyInfo.m_cdestinationpath,
+ CNSNPP::m_siCRCCheckCount);
+ // LCOV_EXCL_STOP
+ } else {
+ if (LOADTYPE_RELEASE == l_tCopyStatus.m_eloadtype) {
+ l_estatus = CopyFile(l_tCopyInfo.m_csourcepath,
+ l_tCopyInfo.m_cdestinationpath,
+ l_uiFileSize,
+ TRUE);
+ } else {
+ l_estatus = CopyFile(l_tCopyInfo.m_csourcepath,
+ l_tCopyInfo.m_cdestinationpath,
+ l_uiFileSize,
+ FALSE);
+ }
+ }
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written:%d file=%s",
+ l_uiFileSize, l_tCopyInfo.m_cdestinationpath != 0 ? l_tCopyInfo.m_cdestinationpath : NULL);
+ if (0 == l_ui32FileCRC) {
+ if (eFrameworkunifiedStatusOK != CalculateCRC32(l_cTmpStorageFile, l_ui32FileCRC)) { // LCOV_EXCL_BR_LINE 200: CalculateCRC32() return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200: CalculateCRC32() return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warn: getting crc. File:%s, crc:%d",
+ l_cTmpStorageFile, l_ui32FileCRC);
+ // LCOV_EXCL_STOP
+ }
+ }
+ UpdateTagCRC(l_tCopyStatus.m_crequesterappname, l_tCopyInfo.m_cpersistenttag, l_ui32FileCRC);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FileCopy Error, status : 0x%x", l_estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "File %s not changed. No copy done. Load type:%d. Tag:%s for Requester:%s.",
+ l_cTmpStorageFile,
+ l_tCopyStatus.m_eloadtype,
+ l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL,
+ l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_cTmpStorageFile can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unknown load type:%d, for tag:%s",
+ l_tCopyStatus.m_eloadtype,
+ l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != l_estatus) {
+ l_tCopyStatus.m_bpersistencechk = FALSE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "COPY_FAILED_ID sending parent message. Tag:%s for Requester:%s.",
+ l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL,
+ l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL);
+
+ FrameworkunifiedSendParent(hthread, CP_WRK_NTFY, sizeof(NSP_CopyStatusResponse), &l_tCopyStatus);
+ } else {
+ l_tCopyStatus.m_bpersistencechk = TRUE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "COPY_COMPLETE_ID sending parent message. Tag:%s for Requester:%s.",
+ l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL,
+ l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL);
+
+ FrameworkunifiedSendParent(hthread, CP_WRK_NTFY, sizeof(NSP_CopyStatusResponse), &l_tCopyStatus);
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:FrameworkunifiedGetMsgDataOfSize returned:%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 200: the size of msg must be sizeof(NSP_CopyInfoCmd)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:MsgLength: Expected:%ld, Received:%d.",
+ static_cast<long int>(sizeof(l_tCopyInfo)), FrameworkunifiedGetMsgLength(hthread)); // NOLINT (runtime/int)
+ // LCOV_EXCL_STOP
+ }
+ l_estatus = SendAck(hthread, CP_WRK_CMD_COPY);
+ } else {
+ // LCOV_EXCL_START 6: hthread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetCopyBufSize
+/// Get the proper buffer size.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CCopyWorker::GetCopyBufSize(SI_32 f_si32openfd, UI_32 &f_ui32filesize) {
+ UI_32 l_ui32BufSize = NS_NPP_WRITESIZE1;
+ // to get the size of file
+ struct stat l_tSrcFstat = {};
+
+ if (-1 == fstat(f_si32openfd , &l_tSrcFstat)) { // LCOV_EXCL_BR_LINE 5: fstat's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat failure, errno:%d", errno); // LCOV_EXCL_LINE 5: fstat's error case
+ } else {
+ f_ui32filesize = static_cast<UI_32>(l_tSrcFstat.st_size); // set out param
+ if (l_tSrcFstat.st_size < NS_NPP_WRITESIZE1) {
+ l_ui32BufSize = NS_NPP_WRITESIZE1;
+ } else {
+ l_ui32BufSize = NS_NPP_WRITESIZE2;
+ }
+ }
+ return l_ui32BufSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CopyFile
+/// Copy the content of source file f_csrcpath to destination file f_cdestpath
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CopyFile(PCSTR f_csrcpath, PCSTR f_cdestpath, UI_32 &f_uiNS_NPP_WRITESIZE, BOOL btmpfile) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // declare variables
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ SI_32 l_iSourceFileFd = -1; // file descriptor of source file
+ SI_32 l_iDestFileFd = -1; // file descriptor of destination file
+ PSTR l_cWriteBuffer = NULL;
+ SI_32 l_si32BufSize = NS_NPP_WRITESIZE1;
+ size_t l_iReadBuffLength = 0; // size of data read from source file
+ UI_32 l_ui32SrcFileSize = 0;
+ std::string l_cTempDestPath; // temporary file path
+ if (btmpfile == FALSE) {
+ l_cTempDestPath = f_cdestpath;
+ } else {
+ l_cTempDestPath = CPersistence::GetStoragePath(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ if (l_cTempDestPath.length() > 0) { // LCOV_EXCL_BR_LINE 6: l_cTempDestPath.length() is bigger than 0
+ l_cTempDestPath.append(RELEASETEMP_DIR); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ // create the destination folder path if does not exists
+ if (!CFSDirectory::DoesDirecotryExist(l_cTempDestPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s DOESN'T exist, Creating...", l_cTempDestPath.c_str());
+ if (eFrameworkunifiedStatusOK != (l_estatus = CFSDirectory::CreateDirectory(l_cTempDestPath))) { // LCOV_EXCL_BR_LINE 200: CreateDirectory() is eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200: CreateDirectory() is eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to create %s, errno:%d", l_cTempDestPath.c_str(), errno);
+ return l_estatus;
+ // LCOV_EXCL_STOP
+ }
+ }
+ l_cTempDestPath.append(RELEASETEMP_FILENAME);
+
+ } else {
+ // LCOV_EXCL_START 6: l_cTempDestPath.length() is bigger than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_cTempDestPath.length():%ld", static_cast<long int>(l_cTempDestPath.length())); // NOLINT (runtime/int)
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+ // get the destination folder path from full file path
+ std::string l_cOutDirPath(f_cdestpath);
+ size_t l_ifound = l_cOutDirPath.rfind("/");
+ l_cOutDirPath = l_cOutDirPath.substr(0, l_ifound);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Full Path for persistence %s.", f_cdestpath);
+
+ // create the destination folder path if does not exists
+ if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s DOESN'T exist, Creating...", l_cOutDirPath.c_str());
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to create %s, errno:%d", l_cOutDirPath.c_str(), errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+
+ // open source file
+ if (-1 == (l_iSourceFileFd = open(f_csrcpath, O_RDONLY, S_IRUSR))) { // LCOV_EXCL_BR_LINE 5: open's error case
+ // LCOV_EXCL_START 5: open's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Warning :: CP_WRK_FAILURE_SRC_NOT_FND, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ // open the destination file for writing or create if does not exists
+ if (-1 == (l_iDestFileFd = open(l_cTempDestPath.c_str(), O_WRONLY | O_CREAT | O_TRUNC, // LCOV_EXCL_BR_LINE 5: open's error case // NOLINT[whitespace/line_length]
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH))) {
+ // LCOV_EXCL_START 5: open's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_DST_CREATE, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ l_si32BufSize = GetCopyBufSize(l_iSourceFileFd, l_ui32SrcFileSize);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Src file:%s, size:%d", f_csrcpath, l_ui32SrcFileSize);
+ l_cWriteBuffer = (PSTR) std::malloc(l_si32BufSize);
+ f_uiNS_NPP_WRITESIZE = 0;
+
+ if (NULL != l_cWriteBuffer) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+#ifdef AGL_STUB
+ while (1) {
+ std::memset(l_cWriteBuffer, 0, l_si32BufSize);
+ l_iReadBuffLength = read(l_iSourceFileFd, l_cWriteBuffer, l_si32BufSize);
+ if (0 == l_iReadBuffLength) {
+ break;
+ } else if (0 < l_iReadBuffLength) { // LCOV_EXCL_BR_LINE 5: read's error case
+ f_uiNS_NPP_WRITESIZE += static_cast<UI_32>(l_iReadBuffLength);
+
+ if (-1 == write(l_iDestFileFd, l_cWriteBuffer, l_iReadBuffLength)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_WRITE_ERROR_CP, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (InAbortState()) { // LCOV_EXCL_START 200: the state can't be aborted
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_ABORT_DURING_CP");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ // LCOV_EXCL_START 5: read's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error reading from source file, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK != l_estatus) {
+ break;
+ }
+ }
+#else
+ while (!eof(l_iSourceFileFd)) {
+ std::memset(l_cWriteBuffer, 0, l_si32BufSize);
+ if (-1 != (l_iReadBuffLength = read(l_iSourceFileFd, l_cWriteBuffer, l_si32BufSize))) {
+ f_uiNS_NPP_WRITESIZE += static_cast<UI_32>(l_iReadBuffLength);
+
+ if (-1 == write(l_iDestFileFd, l_cWriteBuffer, l_iReadBuffLength)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_WRITE_ERROR_CP, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (InAbortState()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_ABORT_DURING_CP");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error reading from source file, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (eFrameworkunifiedStatusOK != l_estatus) {
+ break;
+ }
+ }
+#endif
+
+ free(l_cWriteBuffer);
+ l_cWriteBuffer = NULL;
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem alloc error for l_cWriteBuffer");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ close(l_iDestFileFd);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ if (btmpfile == TRUE) {
+ if (0 != rename(l_cTempDestPath.c_str(), f_cdestpath)) { // LCOV_EXCL_START 5: rename's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "Error renaming file %s to %s, errno: %d", l_cTempDestPath.c_str(), f_cdestpath,
+ errno);
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // remove the source file after successful copy
+ if (0 != remove(l_cTempDestPath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Temporary file not deleted::%s, errno:%d", l_cTempDestPath.c_str(), errno);
+ }
+ }
+ }
+
+ close(l_iSourceFileFd);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnWrkCmdResume
+/// Callback on resume worker thread command
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnWrkCmdResume(HANDLE hthread) { // LCOV_EXCL_START 8: not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (hthread) {
+ pthread_mutex_lock(&m_sAbortMutex);
+ m_sbAbortCopy = FALSE;
+ pthread_mutex_unlock(&m_sAbortMutex);
+ l_estatus = SendAck(hthread, CP_WRK_CMD_RESUME);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnWrkCmdStart
+/// Callback method on start worker thread command.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnWrkCmdStart(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (hthread) { // LCOV_EXCL_BR_LINE 6:hthread can't be NULL
+ l_estatus = SendAck(hthread, CP_WRK_CMD_START);
+ } else {
+ // LCOV_EXCL_START 6:hthread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnWrkCmdStop
+/// Callback method on stop worker thread command.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnWrkCmdStop(HANDLE hthread) { // LCOV_EXCL_START 200: can't test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (hthread) {
+ l_estatus = SendAck(hthread, CP_WRK_CMD_STOP);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnCmdShutdownRequest
+/// Callback method for shutdown request command.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnCmdShutdownRequest(HANDLE hthread) { // LCOV_EXCL_START 8: not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (hthread) {
+ NSP_CopyShutdownAck l_tCopyShutdownAck = {};
+ if (FrameworkunifiedGetMsgLength(hthread) == sizeof(l_tCopyShutdownAck)) {
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tCopyShutdownAck, sizeof(NSP_CopyShutdownAck),
+ eSMRRelease))) {
+ FrameworkunifiedSendParent(hthread, CMD_WRK_SHUTDOWN_ACK, sizeof(NSP_CopyShutdown), &l_tCopyShutdownAck);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:FrameworkunifiedGetMsgDataOfSize returned:%d", l_estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:MsgLength: Expected:%ld, Received:%d.",
+ static_cast<long int>(sizeof(l_tCopyShutdownAck)), FrameworkunifiedGetMsgLength(hthread)); // NOLINT (runtime/int)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SendAck
+/// Method to send ack to the parent thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::SendAck(HANDLE hthread, const ENSP_CopyWorkerProtocol &f_eworkercmd) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
+ NSP_CopyAckMsg l_tCopyAckMs = {};
+ l_tCopyAckMs.m_eworkerprotocol = f_eworkercmd;
+ l_estatus = FrameworkunifiedSendParent(hthread, CP_WRK_ACK_CMD_COMPLETE, sizeof(l_tCopyAckMs), &l_tCopyAckMs);
+ } else {
+ // LCOV_EXCL_START 6: hthread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnWrkCmdArchive
+/// Callback method on archive command
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnWrkCmdArchive(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // Archive response struct
+ NSP_CopyStatusResponse l_tArchiveStatusResponse;
+
+ if (f_hThread) { // LCOV_EXCL_BR_LINE 6: f_hThread can't be NULL
+ // Archive info struct
+ NSP_CopyInfoCmd l_tArchiveInfo = {};
+
+ if (FrameworkunifiedGetMsgLength(f_hThread) == sizeof(l_tArchiveInfo)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(f_hThread, &l_tArchiveInfo, sizeof(NSP_CopyInfoCmd), // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ eSMRRelease))) {
+ // Copy archive status response
+ l_tArchiveStatusResponse.m_eloadtype = l_tArchiveInfo.m_eloadtype;
+ l_tArchiveStatusResponse.m_epersisttype = l_tArchiveInfo.m_epersisttype;
+ std::strncpy(l_tArchiveStatusResponse.m_cpersistenttag, l_tArchiveInfo.m_cpersistenttag, (MAX_PATH_LENGTH - 1));
+ std::strncpy(l_tArchiveStatusResponse.m_crequesterappname,
+ l_tArchiveInfo.m_crequesterappname, (MAX_PATH_LENGTH - 1));
+
+ CCopyWorker::CArchive *l_pCArchive = new CCopyWorker::CArchive();
+
+ // Start the folder archive or extract operation
+ if (eFrameworkunifiedStatusOK == (l_estatus = l_pCArchive->Archive(l_tArchiveInfo, l_tArchiveStatusResponse))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archive/Extract Successful!");
+ } else {
+ // Set the archive status to failure
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ if (NULL != l_pCArchive) { // LCOV_EXCL_BR_LINE 5: l_pCArchive can't be null
+ delete l_pCArchive;
+ l_pCArchive = NULL;
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:FrameworkunifiedGetMsgDataOfSize returned:%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:MsgLength: Expected:%ld, Received:%d.",
+ static_cast<long int>(sizeof(l_tArchiveInfo)), FrameworkunifiedGetMsgLength(f_hThread)); // NOLINT (runtime/int)
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK != l_estatus) {
+ l_tArchiveStatusResponse.m_bpersistencechk = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archive/Extract fail.Sending parent message!");
+ } else {
+ l_tArchiveStatusResponse.m_bpersistencechk = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archive/Extract success.Sending parent message!");
+ }
+
+ FrameworkunifiedSendParent(f_hThread, CP_WRK_NTFY, sizeof(NSP_CopyStatusResponse), &l_tArchiveStatusResponse);
+ } else {
+ // LCOV_EXCL_START 6: f_hThread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread Application Handle NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPCopyWorkerOnStart
+/// Callback method on start of worker thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPCopyWorkerOnStart(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
+ pthread_mutex_lock(&g_mutworkerthread);
+
+ // Note: this variable is made static just to ignore the resource leak showing in coverity analysis
+ static CCopyWorker *l_pccopyworker = NULL;
+
+ l_pccopyworker = new(std::nothrow) CCopyWorker; // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ if (NULL != l_pccopyworker) { // LCOV_EXCL_BR_LINE 5: l_pccopyworker can't be NULL
+ if (eFrameworkunifiedStatusOK == (l_estatus = l_pccopyworker->OnWrkCmdStart(hthread))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, l_pccopyworker);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ l_estatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hthread, AppName, aServiceHandlers, static_cast<UI_32>(_countof(aServiceHandlers)));
+
+ if (0 == std::strcmp(NS_NPP_WRITE_THREAD_NAME, FrameworkunifiedGetAppName(hthread))) {
+ l_estatus = FrameworkunifiedAttachCallbackToDispatcher(hthread, AppName,
+ CMD_DELETE_OLD_DATA, NPServiceOnDeleteOldDataCmd);
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete l_pccopyworker;
+ l_pccopyworker = NULL;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete l_pccopyworker;
+ l_pccopyworker = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread Start failed.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5: l_pccopyworker can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null.");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ pthread_mutex_unlock(&g_mutworkerthread);
+ } else {
+ // LCOV_EXCL_START 6: hthread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPCopyWorkerOnStop
+/// Callback method on stop of worker thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPCopyWorkerOnStop(HANDLE hthread) { // LCOV_EXCL_START 200: can't test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hthread) {
+ pthread_mutex_lock(&g_mutworkerthread);
+ CCopyWorker *l_pccopyworker = static_cast<CCopyWorker *>(FrameworkunifiedGetThreadSpecificData(hthread));
+
+ if (NULL != l_pccopyworker) {
+ l_pccopyworker->OnWrkCmdStop(hthread);
+
+ delete l_pccopyworker;
+ l_pccopyworker = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSetThreadSpecificData Error, status=%d", l_estatus);
+ }
+
+ PCSTR l_cservice = FrameworkunifiedGetAppName(hthread);
+ if (NULL != l_cservice) {
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedDetachServiceFromDispatcher(hthread, l_cservice))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Detaching service %s from dispatcher, status=%d", l_cservice, l_estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetAppName returned NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ pthread_mutex_unlock(&g_mutworkerthread);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPServiceOnDeleteOldDataCmd
+/// This callback is used to delete the data which was requested to be deleted during
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPServiceOnDeleteOldDataCmd(HANDLE f_happ) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ SI_32 l_ithreadcreate = 0;
+ pthread_attr_t l_tattr;
+ struct sched_param l_tschedparam = {};
+
+ // thread id
+ pthread_t childthread = 0;
+
+ if (EOK == pthread_attr_init(&l_tattr)) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // detach the thread from parent thread
+ if (EOK != pthread_attr_setdetachstate(&l_tattr, PTHREAD_CREATE_DETACHED)) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_START 11:except,C++ STL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error setting detach state attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
+ // set the schedule property of thread
+ if (EOK != pthread_attr_setinheritsched(&l_tattr, PTHREAD_EXPLICIT_SCHED)) { // LCOV_EXCL_BR_LINE 5:except,C++ STL // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5:except,C++ STL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error setting inherit schedule attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
+ if (EOK != pthread_attr_getschedparam(&l_tattr, &l_tschedparam)) { // LCOV_EXCL_BR_LINE 5:except,C++ STL
+ // LCOV_EXCL_START 5:except,C++ STL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error getting schedule param attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
+ // set the schedule priority of thread
+ l_tschedparam.sched_priority = NS_NPP_DATA_RESET_THREAD_PRIO;
+ if (EOK != pthread_attr_setschedparam(&l_tattr, &l_tschedparam)) { // LCOV_EXCL_BR_LINE 5:except,C++ STL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error setting schedule param attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ // start the child thread
+ if (EOK == (l_ithreadcreate = pthread_create(&childthread, &l_tattr, NSPDataResetThreadCallback, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Thread id %ld created, name=%s, prio=%d", childthread, NS_NPP_DATA_RESET_THREAD_NAME,
+ NS_NPP_DATA_RESET_THREAD_PRIO);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pthread_create failed for %s, error = %d", NS_NPP_DATA_RESET_THREAD_NAME,
+ l_ithreadcreate);
+ }
+ }
+
+ // release the thread attribute object
+ pthread_attr_destroy(&l_tattr);
+ } else {
+ // LCOV_EXCL_START 11:except,C++ STL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to initialize attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPDataResetThreadCallback
+/// Callback of data reset thread.
+///////////////////////////////////////////////////////////////////////////////////////////
+PVOID NSPDataResetThreadCallback(PVOID f_parg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string f_csourcepath = "";
+ std::string f_ctargetpath = "";
+ std::string l_ctargetdir = "";
+
+ DIR *l_pdir = NULL;
+ struct dirent *l_pdirent = NULL;
+
+ // set the name of thread
+ if (EOK == pthread_setname_np(0, NS_NPP_DATA_RESET_THREAD_NAME)) { // LCOV_EXCL_BR_LINE 5:pthread_setname_np's error case // NOLINT[whitespace/line_length]
+#ifdef AGL_STUB
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Name of thread id %ld set to %s",
+ syscall(__NR_gettid), NS_NPP_DATA_RESET_THREAD_NAME);
+#else
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Name of thread id %d set to %s", gettid(), NS_NPP_DATA_RESET_THREAD_NAME);
+#endif
+ } else {
+ // LCOV_EXCL_START 5:pthread_setname_np's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#ifdef AGL_STUB
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error setting name %s for thread-id %ld", NS_NPP_DATA_RESET_THREAD_NAME,
+ syscall(__NR_gettid));
+#else
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error setting name %s for thread-id %d", NS_NPP_DATA_RESET_THREAD_NAME, gettid());
+#endif
+ // LCOV_EXCL_STOP
+ }
+
+ f_csourcepath = CPersistence::GetStoragePath();
+ l_pdir = opendir(f_csourcepath.c_str());
+
+ if (NULL != l_pdir) { // LCOV_EXCL_BR_LINE 5:opendir's error case
+ if ('/' != f_csourcepath[f_csourcepath.length() - 1]) { // LCOV_EXCL_BR_LINE 200: there must be '/' in f_csourcepath // NOLINT[whitespace/line_length]
+ f_csourcepath.append("/");
+ }
+
+ /*
+ * Old Persistent data folders which needs to be deleted are renamed with the orignal folder name
+ * followed by underscore and date and time.
+ */
+ std::string l_colduserdata = USERDATA;
+ l_colduserdata.append("_");
+
+ std::string l_coldfactorydata = FACTORYDATA;
+ l_coldfactorydata.append("_");
+
+ std::string l_coldfactorycustomerdata = FACTORYCUSTOMERDATA;
+ l_coldfactorycustomerdata.append("_");
+
+ std::string l_colddealerdata = DEALERDATA;
+ l_colddealerdata.append("_");
+
+ while (NULL != (l_pdirent = readdir(l_pdir))) {
+ l_ctargetdir = l_pdirent->d_name;
+
+ if (0 == l_ctargetdir.find(l_colduserdata) ||
+ 0 == l_ctargetdir.find(l_coldfactorydata) ||
+ 0 == l_ctargetdir.find(l_coldfactorycustomerdata) ||
+ 0 == l_ctargetdir.find(l_colddealerdata)) {
+ f_ctargetpath.assign(f_csourcepath);
+ f_ctargetpath.append(l_ctargetdir);
+
+ if (!CFSDirectory::RemoveDirectory(f_ctargetpath, NS_NPP_REMOVE_DIR_DELAY)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to delete directory :: %s", f_ctargetpath.c_str());
+ }
+ }
+ }
+ closedir(l_pdir); // close the directory
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory does not exists :: %s", f_csourcepath.c_str()); // LCOV_EXCL_LINE 5:opendir's error case // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// VerifyWithStoredCRC
+/// Check if crc of the file passed matches with existing crc of a file
+///////////////////////////////////////////////////////////////////////////////////////////
+BOOL CCopyWorker::VerifyWithStoredCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, PCSTR f_cFile,
+ UI_32 &f_ui32crc) {
+ UI_32 l_ui32StoredCrc = 0;
+ BOOL l_bRet = FALSE;
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ TMServiceTagCRC::iterator l_itServiceTag;
+ TMTagCRC::iterator l_itTagCRC;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ f_ui32crc = 0; // initialize with default
+
+ if ((NULL != f_crequesterappname) && (NULL != f_cpersistenttag) && (NULL != f_cFile)) { // LCOV_EXCL_BR_LINE 6: f_crequesterappname, f_cpersistenttag, f_cFile can't be null // NOLINT[whitespace/line_length]
+ // Get the existing crc of a file from the map
+ CCopyWorker::g_objmtxservicetag.ReadLock();
+ l_itServiceTag = CCopyWorker::g_mservicetagcrc.find(f_crequesterappname);
+ if (l_itServiceTag != CCopyWorker::g_mservicetagcrc.end()) {
+ l_itTagCRC = (l_itServiceTag->second).find(f_cpersistenttag);
+ if (l_itTagCRC != (l_itServiceTag->second).end()) {
+ l_ui32StoredCrc = (l_itTagCRC->second);
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ // Do nothing.
+ }
+ } else {
+ // Do nothing.
+ }
+ CCopyWorker::g_objmtxservicetag.Unlock();
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ // get the crc of a file
+ l_estatus = CalculateCRC32(f_cFile, f_ui32crc);
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: CalculateCRC32() return ok
+ if (f_ui32crc == l_ui32StoredCrc) {
+ l_bRet = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "CRC matched. crc:%u", l_ui32StoredCrc);
+ } else {
+ // Do nothing. Return value already set.
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "CRC different. stored:%u, new:%u",
+ l_ui32StoredCrc, f_ui32crc);
+ }
+ } else {
+ // LCOV_EXCL_START: CalculateCRC32() return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warn: getting crc:file:%s, status:%d, errno:%d",
+ f_cFile, l_estatus, errno);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // Do nothing. Return value already set.
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_crequesterappname, f_cpersistenttag, f_cFile can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid param::f_crequesterappname:%p, f_cpersistenttag:%p, f_cFile:%p",
+ f_crequesterappname, f_cpersistenttag, f_cFile);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateTagCRC
+/// Update the internal map with new crc
+///////////////////////////////////////////////////////////////////////////////////////////
+VOID CCopyWorker::UpdateTagCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, UI_32 f_ui32crc) {
+ TMServiceTagCRC::iterator l_itServiceTag;
+ TMTagCRC::iterator l_itTagCRC;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CCopyWorker::g_objmtxservicetag.ReadLock();
+ l_itServiceTag = CCopyWorker::g_mservicetagcrc.find(f_crequesterappname);
+ if (l_itServiceTag != CCopyWorker::g_mservicetagcrc.end()) {
+ l_itTagCRC = (l_itServiceTag->second).find(f_cpersistenttag);
+ if (l_itTagCRC != (l_itServiceTag->second).end()) {
+ l_itTagCRC->second = f_ui32crc;
+ } else {
+ (l_itServiceTag->second).insert(std::make_pair(f_cpersistenttag, f_ui32crc));
+ }
+ } else {
+ TMTagCRC l_mTagCRC;
+ l_mTagCRC.insert(std::make_pair(f_cpersistenttag, f_ui32crc));
+ CCopyWorker::g_mservicetagcrc.insert(std::make_pair(f_crequesterappname, l_mTagCRC));
+ }
+ CCopyWorker::g_objmtxservicetag.Unlock();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// TryFileCopyWithCRCCheck
+/// Try file copy with CRC validation
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::TryFileCopyWithCRCCheck(PCSTR f_csource, PCSTR f_cdest, UI_32 f_ui32checkcount) { // LCOV_EXCL_START 200: cannot test code // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_uiSrcFileCrc = 0;
+ UI_32 l_uiDestFileCrc = 0;
+ UI_32 l_uiFileSize = 0;
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ for (UI_16 l_uiCrcCnt = 1; l_uiCrcCnt <= CNSNPP::m_siCRCCheckCount; l_uiCrcCnt++) {
+ l_uiSrcFileCrc = 0;
+ l_uiDestFileCrc = 0;
+ l_uiFileSize = 0;
+
+ l_estatus = CopyFile(f_csource, f_cdest, l_uiFileSize, TRUE);
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ // calculate crc of file in temp memory(RAM)
+ l_estatus = CalculateCRC32(f_csource, l_uiSrcFileCrc);
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ // calculate crc of file stored in persistent memory
+ l_estatus = CalculateCRC32(f_cdest, l_uiDestFileCrc);
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ if (l_uiSrcFileCrc == l_uiDestFileCrc) { // if checksum matches for both the files
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CRC Checksum matches for file:%s :: 0x%x", f_csource, l_uiSrcFileCrc);
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written:%d file=%s",
+ l_uiFileSize, f_cdest);
+ break;
+ } else { // else delete the file from target
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CRC doesn't match for src:%s::0x%x and dest:%s::0x%x, CRC cnt=%d",
+ f_csource, l_uiSrcFileCrc, f_cdest, l_uiDestFileCrc, l_uiCrcCnt);
+ // if the checksum does not matches even for the last time, do not delete the file from target
+ if (l_uiCrcCnt < (CNSNPP::m_siCRCCheckCount)) {
+ if (0 != remove(f_cdest)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error deleting file:%s, errno:%d", f_cdest, errno);
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Calculating Checksum for DestFile:%s",
+ f_cdest != 0 ? f_cdest : NULL);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Calculating Checksum for SrcFile:%s",
+ f_csource != 0 ? f_csource : NULL);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FileCopy Error:%d", l_estatus);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp
new file mode 100755
index 0000000..8f4f98a
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp
@@ -0,0 +1,232 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains the implementation for class CFSDirectory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef AGL_STUB
+#include <other_service/PosixBasedOS001TimeApi.h>
+#endif
+
+#include <stdio.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifdef AGL_STUB
+#include <cstring>
+#endif
+#include <string>
+
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_types.h"
+#include "ns_npp_fs_directory.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFSDirectory
+/// Constructor of CFSDirectory class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFSDirectory::CFSDirectory() { // LCOV_EXCL_START 8: all methods are static
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFSDirectory
+/// Destructor of CFSDirectory class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFSDirectory::~CFSDirectory() { // LCOV_EXCL_START 8: all methods are static
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateDirectory
+/// Method to create a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFSDirectory::CreateDirectory(const std::string &f_cdirpath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (!f_cdirpath.empty()) {
+ PSTR l_cTempDirPath;
+ PSTR l_cParsedDirPath;
+ PCSTR l_cCopypath = f_cdirpath.c_str();
+
+ l_cTempDirPath = const_cast<PSTR >(f_cdirpath.c_str());
+ while (l_estatus == eFrameworkunifiedStatusOK && (l_cParsedDirPath = std::strchr(l_cTempDirPath, '/')) != 0) {
+ if (l_cParsedDirPath != l_cTempDirPath) {
+ /* Neither root nor double slash in path */
+ *l_cParsedDirPath = '\0';
+ if (0 != mkdir(l_cCopypath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { // LCOV_EXCL_BR_LINE 5: mkdir's error case // NOLINT[whitespace/line_length]
+ if (EEXIST != errno) { // LCOV_EXCL_BR_LINE 5: errno can't be changed
+ // LCOV_EXCL_START 5: errno can't be changed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Cannot Create directory %s", l_cCopypath);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ // file already exist
+ }
+ }
+ *l_cParsedDirPath = '/';
+ }
+ l_cTempDirPath = l_cParsedDirPath + 1;
+ }
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
+ if (0 != mkdir(l_cCopypath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { // LCOV_EXCL_BR_LINE 5: mkdir's error case // NOLINT[whitespace/line_length]
+ if (EEXIST != errno) { // LCOV_EXCL_BR_LINE 5: errno can't be changed
+ // LCOV_EXCL_START 5: errno can't be changed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Cannot Create directory %s", l_cCopypath);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ // file already exist
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory path is empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DoesDirecotryExist
+/// Method to check if a directory exists.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::DoesDirecotryExist(const std::string &f_cdirpath) {
+ DIR *l_pDirDescriptor = opendir(f_cdirpath.c_str());
+ if (NULL != l_pDirDescriptor) {
+ closedir(l_pDirDescriptor);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsDirectory
+/// Method to check if the entity is a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::IsDirectory(const std::string &f_cpath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReturn = FALSE;
+
+ if (!f_cpath.empty()) { // LCOV_EXCL_BR_LINE 200: f_cpath can't be empty
+ struct stat st_buf;
+
+ if (0 == stat(f_cpath.c_str(), &st_buf)) { // LCOV_EXCL_BR_LINE 5: stat's error case
+ // Get the status of the file
+ if (S_ISREG(st_buf.st_mode)) {
+ l_bReturn = FALSE; // return false if f_cpath is a regular file
+ }
+ if (S_ISDIR(st_buf.st_mode)) {
+ l_bReturn = TRUE; // return true if f_cpath is a directory
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving status of path : %s", f_cpath.c_str()); // LCOV_EXCL_LINE 5: stat's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory path is empty."); // LCOV_EXCL_LINE 200: f_cpath can't be empty
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReturn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveDirectory
+/// Method to remove a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::RemoveDirectory(std::string f_cpath, const UI_32 f_uidelay) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReturn = FALSE;
+
+ if (!f_cpath.empty()) { // LCOV_EXCL_BR_LINE 200: f_cpath can't be empty.
+ std::string l_cFilePath = "";
+
+ struct dirent *l_pdirent = NULL;
+ DIR *l_pdir = NULL;
+
+ l_pdir = opendir(f_cpath.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (NULL != l_pdir) {
+ if ('/' != f_cpath[f_cpath.length() - 1]) {
+ f_cpath.append("/");
+ }
+
+ while (NULL != (l_pdirent = readdir(l_pdir))) {
+ if (0 != std::strcmp(l_pdirent->d_name, ".") &&
+ 0 != std::strcmp(l_pdirent->d_name, "..")) {
+ l_cFilePath.assign(f_cpath);
+ l_cFilePath.append(l_pdirent->d_name); // concatenate the strings to get the complete f_cpath
+
+ if (TRUE == IsDirectory(l_cFilePath)) {
+ (void)RemoveDirectory(l_cFilePath, f_uidelay);
+ } else {
+ // it's a file, we can use unlink
+ unlink(l_cFilePath.c_str());
+
+ if (0 < f_uidelay) { // LCOV_EXCL_START 200: f_uidelay is 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ delay(f_uidelay);
+#endif
+ }
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ closedir(l_pdir); // close the directory
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pdir is NULL");
+ }
+
+ // delete the directory
+ if (0 == rmdir(f_cpath.c_str())) {
+ if (0 < f_uidelay) { // LCOV_EXCL_START 200: f_uidelay is 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ delay(f_uidelay);
+#endif
+ }
+ // LCOV_EXCL_STOP
+ l_bReturn = TRUE;
+ }
+ } else {
+ // LCOV_EXCL_START 200: f_cpath can't be empty.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory path is empty.");
+ l_bReturn = FALSE;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReturn;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp
new file mode 100755
index 0000000..c9e88a8
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp
@@ -0,0 +1,149 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup tag_NS_NPPService
+/// \ingroup tag_NS_NPPService
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This class holds the message queue handles for notification subscribers
+///
+/// This is a singleton class which holds the message queue handles for notification subscribers.
+/// This will ensure that NS_NPPService will hold only one handle per subscriber.
+//////////////////////////////////////////////////////////////////////////////////////////////////
+#include <utility>
+#include <string>
+#include "ns_npp_handlelist.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+
+// define static member of class CHandleList
+CHandleList *CHandleList::m_psHandleList = NULL;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CHandleList
+/// Class Constructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CHandleList::CHandleList() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CHandleList
+/// Class Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CHandleList::~CHandleList() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetHandleList
+/// This function is used to get the singleton instance of class.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CHandleList *CHandleList::GetHandleList() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // create the instance of class
+ if (NULL == m_psHandleList) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Creating handle list."); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ m_psHandleList = new(std::nothrow) CHandleList(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_psHandleList;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ReleaseHandleList
+/// This function is used to release the instance of class.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CHandleList::ReleaseHandleList() { // LCOV_EXCL_START 100: not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_psHandleList) {
+ delete m_psHandleList;
+ m_psHandleList = NULL;
+ } else {
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddHandleInList
+/// Add pair of subscriber name and corresponding handle in map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CHandleList::AddHandleInList(std::string f_csubscribername, HANDLE f_hmqhandle) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ HandleListRetStatus_Type l_prRetValue;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_prRetValue = m_mHandleList.insert(make_pair(f_csubscribername, f_hmqhandle));
+ if (false == l_prRetValue.second) {
+ l_estatus = eFrameworkunifiedStatusDuplicate;
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Handle exists in list for %s.", f_csubscribername.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Handle added in list for %s.", f_csubscribername.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveHandleFromList
+/// Remove handle for subscriber from the list.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CHandleList::RemoveHandleFromList(std::string f_csubscribername) { // LCOV_EXCL_START 100: not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // TODO(my_username): Implementation of this function.
+ // NOTE: Right now this feature is not required. Let the NS_NPPService hold one handle for
+ // each subscriber, even if all the notifications are unsubscribed by subscriber.
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSubscriberMqHandle
+/// Get the message queue handle of a subscriber.
+////////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE CHandleList::GetSubscriberMqHandle(std::string f_csubscribername) {
+ HANDLE l_hMqHandle = NULL;
+ HandleList_Type::iterator l_itHandleList;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_itHandleList = m_mHandleList.find(f_csubscribername);
+ if (l_itHandleList != m_mHandleList.end()) {
+ l_hMqHandle = l_itHandleList->second;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_hMqHandle;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp
new file mode 100755
index 0000000..d4b1604
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp
@@ -0,0 +1,747 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CNorPersistenceWorker and CArchive.
+/// Class CNorPersistenceWorker holds the implementation for worker thread.
+/// Class CArchive holds the implementation for archive.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_timer_if.hpp>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_utility_sys.hpp>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_nor_persistence.h>
+
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <boost/bind.hpp>
+#include <map>
+#include <utility>
+#include <string>
+
+#include <native_service/ns_np_service_nor_persistence_internal.h>
+#include "ns_npp_types.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_nor_persistence_worker_thread.h"
+
+
+
+typedef std::string NotificationName;
+typedef std::map<NotificationName, CTimerHelper *> TTimerList;
+static TTimerList g_mtimers; /// List of all the timers for immediate persistence notifications
+CMutex g_objmutextimerdata; /// Mutex object on g_mtimers
+
+// Template function for NorWorkerCallback
+template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)> EFrameworkunifiedStatus NorWorkerCallback(HANDLE hthread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ C *l_pClass = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hthread));
+
+ if (l_pClass) { // LCOV_EXCL_BR_LINE 6: l_pClass can't be NULL
+ l_estatus = (l_pClass->*M)(hthread);
+ }
+ return l_estatus;
+}
+
+static FrameworkunifiedProtocolCallbackHandler aServiceHandlers[] = { // NOLINT (readability/naming)
+ { NOR_PERSISTENCE_TIMER_START, NorWorkerCallback<CNorPersistenceWorker,
+ &CNorPersistenceWorker::OnNorPersistenceTimerStart>},
+ { NOR_PERSISTENCE_REGISTER, NorWorkerCallback<CNorPersistenceWorker,
+ &CNorPersistenceWorker::RegisterImmediatePersistNotification>},
+ { NOR_PERSISTENCE_UNREGISTER, NorWorkerCallback<CNorPersistenceWorker,
+ &CNorPersistenceWorker::UnregisterImmediatePersistNotification>},
+ { NOR_PERSISTENCE_ONSHUTDOWN, NorWorkerCallback<CNorPersistenceWorker,
+ &CNorPersistenceWorker::OnShutdown>},
+ { NOR_PERSISTENCE_CHANGE_CATEGORY, NorWorkerCallback<CNorPersistenceWorker,
+ &CNorPersistenceWorker::OnCategoryChange>}
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPNorPersistenceWorkerOnStart
+/// Callback method on start of worker thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStart(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
+ // Note: this variable is made static just to ignore the resource leak showing in coverity analysis
+ static CNorPersistenceWorker *l_pcnorpersistenceworker = new(std::nothrow) CNorPersistenceWorker;
+
+ if (NULL != l_pcnorpersistenceworker) { // LCOV_EXCL_BR_LINE 5: new's error case
+ l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, l_pcnorpersistenceworker);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ l_estatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hthread, AppName, aServiceHandlers, static_cast<UI_32>(_countof(aServiceHandlers)));
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete l_pcnorpersistenceworker;
+ l_pcnorpersistenceworker = NULL;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null.");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: hthread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPNorPersistenceWorkerOnStop
+/// Callback method on stop of worker thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStop(HANDLE hthread) { // LCOV_EXCL_START 200: can't test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hthread) {
+ CNorPersistenceWorker *l_pcnorpersistenceworker = static_cast<CNorPersistenceWorker *>(FrameworkunifiedGetThreadSpecificData(
+ hthread));
+
+ if (NULL != l_pcnorpersistenceworker) {
+ delete l_pcnorpersistenceworker;
+ l_pcnorpersistenceworker = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSetThreadSpecificData error, status=%d", l_estatus);
+ }
+
+ PCSTR l_cservice = FrameworkunifiedGetAppName(hthread);
+ if (NULL != l_cservice) {
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedDetachServiceFromDispatcher(hthread, l_cservice))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error detaching service %s from dispatcher, status=%d", l_cservice, l_estatus);
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetAppName returned NULL");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Class : CNorPersistenceWorker
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNorPersistenceWorker
+/// Constructor of CNorPersistenceWorker class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNorPersistenceWorker::CNorPersistenceWorker() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNorPersistenceWorker
+/// Destructor of CNorPersistenceWorker class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNorPersistenceWorker::~CNorPersistenceWorker() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnNorPersistenceTimerStart
+/// This function starts the respective timer of the notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNorPersistenceWorker::OnNorPersistenceTimerStart(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ TNorPersistenceNotifInfoHeader *l_ptNorPersistentData = NULL;
+ UI_32 l_ui32ReceivedDataLength = FrameworkunifiedGetMsgLength(f_hThread);
+ UI_8 *l_pui32ReceivedData = new(std::nothrow) UI_8[l_ui32ReceivedDataLength];
+
+ if (l_ui32ReceivedDataLength >= sizeof(TNorPersistenceNotifInfoHeader)) { // LCOV_EXCL_BR_LINE 200: l_ui32ReceivedDataLength is bigger than sizeof(TNorPersistenceNotifInfoHeader) // NOLINT[whitespace/line_length]
+ if (NULL != l_pui32ReceivedData) { // LCOV_EXCL_BR_LINE 5: new's error case
+ std::memset(l_pui32ReceivedData, 0, l_ui32ReceivedDataLength);
+ l_estatus = FrameworkunifiedGetMsgDataOfSize(f_hThread, l_pui32ReceivedData, l_ui32ReceivedDataLength, eSMRRelease);
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ TTimerList::iterator l_itTimerList;
+ l_ptNorPersistentData = static_cast<TNorPersistenceNotifInfoHeader *>(static_cast<PVOID>(l_pui32ReceivedData));
+
+ g_objmutextimerdata.WriteLock();
+ // find the corresponding timer object in the list of timers
+ l_itTimerList = g_mtimers.find(l_ptNorPersistentData->m_cnotificationname);
+ if (g_mtimers.end() != l_itTimerList) { // LCOV_EXCL_BR_LINE 200: the notification must be registered
+ if (NULL != (l_itTimerList->second)) { // LCOV_EXCL_BR_LINE 200: l_itTimerList->second can't be null
+ if (NULL != (l_itTimerList->second)->m_pui8HeaderAndData) {
+ delete[](l_itTimerList->second)->m_pui8HeaderAndData;
+ (l_itTimerList->second)->m_pui8HeaderAndData = NULL;
+ }
+
+ // Update specific immediate persistence notification data
+ (l_itTimerList->second)->m_pui8HeaderAndData = l_pui32ReceivedData;
+
+ // if corresponding timer is not already running start it.
+ if (!(l_itTimerList->second)->IsRunning()) {
+ (l_itTimerList->second)->Start();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Timer started, Notfn=%s", l_ptNorPersistentData->m_cnotificationname);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Timer already running for notfn %s. Data updated",
+ l_ptNorPersistentData->m_cnotificationname);
+ }
+
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ // LCOV_EXCL_START 200: l_itTimerList->second can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Immediate persistence: Timer object NULL for Notfn:%s.",
+ l_ptNorPersistentData->m_cnotificationname);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: the notification must be registered
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Immediate persistence notification not registered. Notification: %s ",
+ l_ptNorPersistentData->m_cnotificationname != 0 ? l_ptNorPersistentData->m_cnotificationname : NULL);
+ // LCOV_EXCL_STOP
+ }
+ g_objmutextimerdata.Unlock();
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetMsgDataOfSize failed while retrieving immediate persistence notfn data. Status:0x%x ", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to allocate data. Can't persist.");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: l_ui32ReceivedDataLength is bigger than sizeof(TNorPersistenceNotifInfoHeader)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldBuf;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid data length received. Can't persist.");
+ // LCOV_EXCL_STOP
+ }
+
+ if ((eFrameworkunifiedStatusOK != l_estatus) && (NULL != l_pui32ReceivedData)) {
+ delete[] l_pui32ReceivedData;
+ l_pui32ReceivedData = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RegisterImmediatePersistNotification
+/// It creates a timer corresponding to the notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNorPersistenceWorker::RegisterImmediatePersistNotification(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ TImmediatePersistenceRegisterNotifInfo l_tRegisterNotifInfo = {};
+
+ if (sizeof(l_tRegisterNotifInfo) == FrameworkunifiedGetMsgLength(hthread)) { // LCOV_EXCL_BR_LINE 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo) // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tRegisterNotifInfo, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ sizeof(TImmediatePersistenceRegisterNotifInfo), eSMRRelease))) {
+ g_objmutextimerdata.WriteLock();
+
+ TTimerList::iterator l_itTimerList = g_mtimers.find(l_tRegisterNotifInfo.m_cnotificationname);
+ if (l_itTimerList != g_mtimers.end()) { // LCOV_EXCL_BR_LINE 6: notification can't be registered again
+ // LCOV_EXCL_START 6: notification can't be registered again
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification %s is already registered for immediate data persistence ",
+ l_tRegisterNotifInfo.m_cnotificationname);
+ // LCOV_EXCL_STOP
+ } else {
+ // create timer corresponding to notification
+ CTimerHelper *l_pTimerHelper = new CTimerHelper();
+ if (NULL != l_pTimerHelper) { // LCOV_EXCL_BR_LINE 5: new's error case
+ l_pTimerHelper->SetTime(l_tRegisterNotifInfo.m_uidelay, 0);
+ // todo: modify SetNotifyMethod of timer NSTimer class to accept sender handle as well.
+ // This will help to have only one handle, instead of one handle per timer.
+ l_pTimerHelper->SetNotifyMethod(static_cast<UI_16>(l_pTimerHelper->GetCmdId()), FrameworkunifiedGetAppName(hthread));
+
+ // associate timer's timeout with the callback function.
+ FrameworkunifiedAttachCallbackToDispatcher(hthread, TIMER_QUE, l_pTimerHelper->GetCmdId(),
+ boost::bind(&CTimerHelper::OnTimeOut, l_pTimerHelper, hthread));
+ // add created timer in timers list
+ g_mtimers.insert(std::make_pair(l_tRegisterNotifInfo.m_cnotificationname, l_pTimerHelper));
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification %s is registered for immediate data persistence ",
+ l_tRegisterNotifInfo.m_cnotificationname != 0 ? l_tRegisterNotifInfo.m_cnotificationname : NULL);
+ }
+ }
+
+ g_objmutextimerdata.Unlock();
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error getting message data for registering Immediate persistent notification, status: 0x%x", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetMsgLength and size of TImmediatePersistenceRegisterNotifInfo mismatched."
+ "Length received %d, buffer available: %ld ",
+ FrameworkunifiedGetMsgLength(hthread), static_cast<long int>(sizeof(TImmediatePersistenceRegisterNotifInfo))); // NOLINT (runtime/int)
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UnregisterImmediatePersistNotification
+/// It deletes a timer corresponding to the notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNorPersistenceWorker::UnregisterImmediatePersistNotification(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ TImmediatePersistenceUnregisterNotifInfo l_tRegisterNotifInfo = {};
+
+ if (sizeof(l_tRegisterNotifInfo) == FrameworkunifiedGetMsgLength(hthread)) { // LCOV_EXCL_BR_LINE 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo) // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tRegisterNotifInfo, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ sizeof(TImmediatePersistenceUnregisterNotifInfo), eSMRRelease))) {
+ g_objmutextimerdata.WriteLock();
+
+ TTimerList::iterator l_itTimerList = g_mtimers.find(l_tRegisterNotifInfo.m_cnotificationname);
+ if (l_itTimerList != g_mtimers.end()) { // LCOV_EXCL_BR_LINE 6: notification can't be unregistered again
+ if (NULL != (l_itTimerList->second)) { // LCOV_EXCL_BR_LINE 200: l_itTimerList->second can't be null
+ EFrameworkunifiedStatus eStatus;
+ // detach callbacks
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(hthread, TIMER_QUE, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ (l_itTimerList->second)->GetCmdId()))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedDetachCallbackFromDispatcher Failed Status:0x%x ", eStatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ delete l_itTimerList->second;
+ l_itTimerList->second = NULL;
+ }
+ g_mtimers.erase(l_itTimerList);
+ } else {
+ // LCOV_EXCL_START 6: notification can't be registered again
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Can't unregister. Notification %s is not a registered notification for immediate data persistence.",
+ l_tRegisterNotifInfo.m_cnotificationname != 0 ? l_tRegisterNotifInfo.m_cnotificationname : NULL);
+ // LCOV_EXCL_STOP
+ }
+
+ g_objmutextimerdata.Unlock();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Notification %s is unregistered for immediate data persistence, FrameworkunifiedGetMsgDataOfSize Error, status: 0x%x",
+ l_tRegisterNotifInfo.m_cnotificationname != 0 ? l_tRegisterNotifInfo.m_cnotificationname : NULL,
+ l_estatus);
+ }
+ } else {
+ // LCOV_EXCL_START 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetMsgLength and size of TImmediatePersistenceUnregisterNotifInfo mismatched."
+ "Length received %d, buffer available: %ld ",
+ FrameworkunifiedGetMsgLength(hthread), static_cast<long int>(sizeof(TImmediatePersistenceUnregisterNotifInfo))); // NOLINT (runtime/int)
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnShutdown
+/// This API saves or deletes the data of NOR irrespective of delay depending on the message data
+/// received from parent thread during shutdown.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNorPersistenceWorker::OnShutdown(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ UI_32 l_uiPersistCategoryFlag = 0;
+
+ TImmediateShutdown l_tImmShutdown = {};
+
+ CTimerHelper *l_pTimerHelper = NULL;
+
+ // iterator of list of nor notifications and its timers
+ TTimerList::iterator l_itTimerList;
+
+ TNorPersistenceNotifInfoHeader *l_ptImmediateNotfnHeader = NULL;
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(f_hThread, &l_tImmShutdown, sizeof(l_tImmShutdown), // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ eSMRRelease))) {
+ l_uiPersistCategoryFlag = l_tImmShutdown.f_uinotificationpersistentservicepersistcategoryflag;
+
+ // if quick shutdown is received then just stop the timer and dont save the data
+ if (eFrameworkunifiedQuickShutdown == l_tImmShutdown.f_eshutdowntype) {
+ for (l_itTimerList = g_mtimers.begin(); l_itTimerList != g_mtimers.end(); l_itTimerList++) {
+ l_pTimerHelper = l_itTimerList->second;
+
+ if (NULL != l_pTimerHelper && l_pTimerHelper->IsRunning()) {
+ // stop the timer
+ l_pTimerHelper->Stop();
+ }
+ }
+ } else { // stop the timer and save the data
+ for (l_itTimerList = g_mtimers.begin(); l_itTimerList != g_mtimers.end(); l_itTimerList++) {
+ l_pTimerHelper = l_itTimerList->second;
+
+ if (NULL != l_pTimerHelper && l_pTimerHelper->IsRunning()) {
+ // stop the timer
+ l_pTimerHelper->Stop();
+
+ l_ptImmediateNotfnHeader = static_cast<TNorPersistenceNotifInfoHeader *>
+ (static_cast<PVOID>(l_pTimerHelper->m_pui8HeaderAndData));
+
+ if (NULL != l_ptImmediateNotfnHeader) { // LCOV_EXCL_BR_LINE 200: l_ptImmediateNotfnHeader can't be null
+ if (eFrameworkunifiedUserData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag) &&
+ eFrameworkunifiedFactoryData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag) &&
+ eFrameworkunifiedFactoryCustomerData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag) &&
+ eFrameworkunifiedDealerData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag)) {
+ // save the new data to persistent memory
+ l_pTimerHelper->OnTimeOut(f_hThread);
+ }
+ } else {
+ // LCOV_EXCL_START 200: l_ptImmediateNotfnHeader can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Immediate notification data header is NULL");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize failed for protocol NOR_PERSISTENCE_ONSHUTDOWN, status : %d",
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendParent(f_hThread, NOR_PERSISTENCE_ONSHUTDOWN_ACK, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ sizeof(l_uiPersistCategoryFlag), &l_uiPersistCategoryFlag))) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendParent failed for protocol NOR_PERSISTENCE_ONSHUTDOWN_ACK, status : %d",
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnCategoryChange
+/// This callback is called when category of immediate persistence is changed
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNorPersistenceWorker::OnCategoryChange(HANDLE hthread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != hthread) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ UI_32 l_ui32ReceivedDataLength = FrameworkunifiedGetMsgLength(hthread);
+
+ if (l_ui32ReceivedDataLength >= sizeof(TImmediatePersistenceChangeCategory)) { // LCOV_EXCL_BR_LINE 200: l_ui32ReceivedDataLength is bigger than sizeof(TImmediatePersistenceChangeCategory) // NOLINT[whitespace/line_length]
+ UI_8 *l_pui32ReceivedData = new(std::nothrow) UI_8[l_ui32ReceivedDataLength];
+
+ if (NULL != l_pui32ReceivedData) { // LCOV_EXCL_BR_LINE 5: new's error case
+ std::memset(l_pui32ReceivedData, 0, l_ui32ReceivedDataLength);
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, l_pui32ReceivedData, l_ui32ReceivedDataLength, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ eSMRRelease))) {
+ TImmediatePersistenceChangeCategory *l_pChangePersistentCategory =
+ static_cast<TImmediatePersistenceChangeCategory *>(static_cast<PVOID>(l_pui32ReceivedData));
+ PUI_8 l_pui8Data = l_pui32ReceivedData + sizeof(TImmediatePersistenceChangeCategory);
+
+ TTimerList::iterator l_itTimerList;
+
+ g_objmutextimerdata.WriteLock();
+ // find the corresponding timer object in the list of timers
+ l_itTimerList = g_mtimers.find(l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname);
+ if (g_mtimers.end() != l_itTimerList) { // LCOV_EXCL_BR_LINE 6: notification must be in list
+ CTimerHelper *l_pTimerHelper = l_itTimerList->second;
+
+ if (NULL != l_pTimerHelper && l_pTimerHelper->IsRunning()) {
+ TNorPersistenceNotifInfoHeader *l_ptImmediateNotfnHeader =
+ static_cast<TNorPersistenceNotifInfoHeader *>(static_cast<PVOID>(l_pTimerHelper->m_pui8HeaderAndData));
+
+ if (NULL != l_ptImmediateNotfnHeader) { // LCOV_EXCL_BR_LINE 200: l_ptImmediateNotfnHeader can't be null
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Changing category from %d to %d for notfn %s in dataHdr",
+ l_ptImmediateNotfnHeader->m_epersistcategory,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory,
+ l_ptImmediateNotfnHeader->m_cnotificationname);
+
+ l_ptImmediateNotfnHeader->m_epersistcategory =
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory;
+ }
+ }
+
+ EFrameworkunifiedPersistCategory l_eOldPersistCategory = l_pChangePersistentCategory->m_eoldpersistcategory;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Changing persist category of %s from %d to %d",
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname,
+ l_eOldPersistCategory,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory);
+
+ // write data to emmc
+ l_estatus = SynchronousWritePersistentData(
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_cpublishername,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname,
+ static_cast<PVOID>(l_pui8Data),
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_uimsgsize,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_uidelay,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_uimaxmsglength,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory);
+
+ // Create the old file path string to be removed
+ std::string l_cPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+ std::string l_cTempPath = l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname;
+ size_t l_uiTempPathSize = 0;
+
+ // replace all '/' by '_'
+ l_uiTempPathSize = l_cTempPath.find_first_of("/");
+ while (std::string::npos != l_uiTempPathSize) {
+ l_cTempPath[l_uiTempPathSize] = '_';
+ l_uiTempPathSize = l_cTempPath.find_first_of("/", l_uiTempPathSize + 1);
+ }
+
+ switch (l_eOldPersistCategory) {
+ case eFrameworkunifiedFactoryData:
+ l_cPath.append(FACTORYDATADIR);
+ break;
+ case eFrameworkunifiedFactoryCustomerData:
+ l_cPath.append(FACTORYCUSTOMERDATADIR);
+ break;
+ case eFrameworkunifiedDealerData:
+ l_cPath.append(DEALERDATADIR);
+ break;
+ case eFrameworkunifiedUserData:
+ default: {
+ l_cPath.append(USERDATADIR);
+ l_cPath.append(ALLUSERAPPDATADIR);
+ }
+ break;
+ }
+
+ l_cPath.append(IMMEDIATEDATADIR);
+ l_cPath.append(l_cTempPath);
+
+ l_cPath.append(l_pChangePersistentCategory->m_tnornotifInfoheader.m_cpublishername);
+
+ if (0 != unlink(l_cPath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error deleting file %s, errno=%d", l_cPath.c_str(), errno);
+ }
+ } else {
+ // LCOV_EXCL_START 6: notification must be in list
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't update persistent category, notfn %s not found in g_mtimers map",
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname != 0 ?
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname : NULL);
+ // LCOV_EXCL_STOP
+ }
+ g_objmutextimerdata.Unlock();
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize failed while retrieving"
+ "immediate persistence notfn data. Status:0x%x ", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+
+ delete[] l_pui32ReceivedData;
+ l_pui32ReceivedData = NULL;
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to allocate data. Can't persist, errno=%d", errno);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: l_ui32ReceivedDataLength is bigger than sizeof(TImmediatePersistenceChangeCategory)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldBuf;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid data length received %d. Can't persist.", l_ui32ReceivedDataLength);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid param, hthread is NULL");
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+/////////////////////////////
+/// Class: CTimerHelper
+/////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CTimerHelper
+/// Constructor of CTimerHelper class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CTimerHelper::CTimerHelper() {
+ static UI_32 l_uiTimerCounter = PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD;
+ l_uiTimerCounter++;
+ m_uiCmdId = l_uiTimerCounter;
+ m_pui8HeaderAndData = NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CTimerHelper
+/// Destructor of CTimerHelper class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CTimerHelper::~CTimerHelper() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pui8HeaderAndData) {
+ delete[] m_pui8HeaderAndData;
+ m_pui8HeaderAndData = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetCmdId
+/// Returns id for timer
+////////////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CTimerHelper::GetCmdId() {
+ return m_uiCmdId;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnTimeOut
+/// This function writes the corresponding data in NOR when timer expires.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CTimerHelper::OnTimeOut(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ g_objmutextimerdata.ReadLock();
+ if (NULL != m_pui8HeaderAndData) { // LCOV_EXCL_BR_LINE 200: m_pui8HeaderAndData can't be null
+ TNorPersistenceNotifInfoHeader *l_ptImmediateNotfnHeader =
+ static_cast<TNorPersistenceNotifInfoHeader *>(static_cast<PVOID>(m_pui8HeaderAndData));
+ PUI_8 l_pui8Data = m_pui8HeaderAndData + sizeof(TNorPersistenceNotifInfoHeader);
+ HANDLE l_hReceiverMq = McOpenSender(l_ptImmediateNotfnHeader->m_cpublishername);
+
+ // write data to emmc
+ l_estatus = SynchronousWritePersistentData(l_ptImmediateNotfnHeader->m_cpublishername,
+ l_ptImmediateNotfnHeader->m_cnotificationname,
+ static_cast<PVOID>(l_pui8Data),
+ l_ptImmediateNotfnHeader->m_uimsgsize,
+ l_ptImmediateNotfnHeader->m_uidelay,
+ l_ptImmediateNotfnHeader->m_uimaxmsglength,
+ l_ptImmediateNotfnHeader->m_epersistcategory);
+
+ // update corresponding application about data written status.
+ if (NULL != l_hReceiverMq) { // LCOV_EXCL_BR_LINE 5: NSFW error case
+ NC_ImmediateWriteAck l_tWriteAck = {};
+ std::strncpy(l_tWriteAck.notificationName, l_ptImmediateNotfnHeader->m_cnotificationname,
+ sizeof(l_tWriteAck.notificationName) - 1);
+ l_tWriteAck.eStatus = l_estatus;
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSend(l_hReceiverMq, AppName, NPS_IMMEDIATE_WRITE_ACK, sizeof(l_tWriteAck), // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ &l_tWriteAck))) {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error Sending NPS_IMMEDIATE_WRITE_ACK to %s for %s, Status: %d",
+ l_ptImmediateNotfnHeader->m_cpublishername != 0 ? l_ptImmediateNotfnHeader->m_cpublishername : NULL,
+ l_ptImmediateNotfnHeader->m_cnotificationname != 0 ?
+ l_ptImmediateNotfnHeader->m_cnotificationname : NULL,
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ McClose(l_hReceiverMq);
+ l_hReceiverMq = NULL;
+ } else {
+ // LCOV_EXCL_START 5: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error creating sender handle for service %s, Notification name %s Write Status: %d",
+ l_ptImmediateNotfnHeader->m_cpublishername != 0 ? l_ptImmediateNotfnHeader->m_cpublishername : NULL,
+ l_ptImmediateNotfnHeader->m_cnotificationname != 0 ?
+ l_ptImmediateNotfnHeader->m_cnotificationname : NULL,
+ l_estatus);
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: m_pui8HeaderAndData can't be null
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Not writing immediate persistence data. Data is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_STOP
+ }
+ g_objmutextimerdata.Unlock();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+/// EOF
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp
new file mode 100755
index 0000000..8e2bb2d
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp
@@ -0,0 +1,485 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of CNotification class.
+/// It define functionalities common to all types of notification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <utility>
+#include <iostream>
+#include <string>
+#include <native_service/ns_mc_system_info.h>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_handlelist.h"
+#include "ns_npp_notification.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNotification
+/// Constructor of CNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotification::CNotification() { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_cNotificationName = "";
+ m_uiMaxMsgSize = 0;
+ m_ePersistentType = eFrameworkunifiedUnknown;
+
+ m_cServiceName = "";
+
+ m_pmSubscribersList = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNotification
+/// Constructor of CNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotification::CNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_cNotificationName = "";
+ m_uiMaxMsgSize = 0;
+ m_ePersistentType = eFrameworkunifiedUnknown;
+ m_pmSubscribersList = NULL;
+
+ if (!f_cnotificationname.empty()) { // LCOV_EXCL_BR_LINE 200: f_cnotificationname can't be empty
+ m_cNotificationName = f_cnotificationname;
+ m_uiMaxMsgSize = f_uimaxmsgsize;
+// m_ePersistentType = eFrameworkunifiedUnknown;
+
+ m_cServiceName = "";
+
+ m_pmSubscribersList = new(std::nothrow) NotifReceiver_Type(); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ // LCOV_EXCL_START 200: f_cnotificationname can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification String is Empty");
+
+ CNotification();
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNotification
+/// Destructor of CNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotification::~CNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator of CNotificationReceiver map
+ NotifReceiver_Iterator_Type l_itNotifReceiver;
+
+ CNotificationReceiver *l_pNotificationReceiver = NULL;
+
+ if (NULL != m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: m_pmSubscribersList can't be NULL
+ if (!m_pmSubscribersList->empty()) {
+ for (l_itNotifReceiver = m_pmSubscribersList->begin();
+ l_itNotifReceiver != m_pmSubscribersList->end();
+ l_itNotifReceiver++) {
+ l_pNotificationReceiver = (*l_itNotifReceiver).second;
+
+ if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: l_pNotificationReceiver can't be NULL
+ // NOTE: Uncomment following code when implementation of the function RemoveHandleFromList
+ // is available. To find the reason why it is not implemented, see the function definition.
+ // CHandleList *l_hHandleList = CHandleList::GetHandleList();
+ // l_hHandleList->RemoveHandleFromList((*l_itNotifReceiver).first);
+
+ delete l_pNotificationReceiver; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_pNotificationReceiver = NULL;
+ }
+ }
+
+ // clear the map
+ m_pmSubscribersList->clear();
+ }
+
+ delete m_pmSubscribersList; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ m_pmSubscribersList = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddEventReciever
+/// This function adds the name of the application to receiver list of particular notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::AddEventReciever(const std::string &f_csubscribername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: f_csubscribername can't be empty
+ l_estatus = AddReceiverInMap(f_csubscribername);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_csubscribername can't be empty
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Publish
+/// This function publishes the notification to subscribed clients.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusFail;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DeleteEventReciever
+/// This function deletes the name of application from receivers list.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::DeleteEventReciever(const std::string &f_csubscribername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator of CNotificationReceiver map
+ NotifReceiver_Iterator_Type l_iterator;
+
+ CNotificationReceiver *l_pNotificationReceiver = NULL;
+
+ if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_csubscribername can't be empty
+ l_iterator = m_pmSubscribersList->find(f_csubscribername);
+
+
+ if (l_iterator != m_pmSubscribersList->end()) {
+ l_pNotificationReceiver = (*l_iterator).second;
+
+ if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: l_pNotificationReceiver can't be NULL
+ // NOTE: Uncomment following code when implementation of the function RemoveHandleFromList
+ // is available. To find the reason why it is not implemented, see the function definition.
+ // CHandleList *l_hHandleList = CHandleList::GetHandleList();
+ // l_hHandleList->RemoveHandleFromList((*l_iterator).first);
+
+ delete l_pNotificationReceiver; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_pNotificationReceiver = NULL;
+ }
+
+ m_pmSubscribersList->erase(l_iterator);
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Subscriber successfully deleted"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Invalid Iterator");
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, f_csubscribername can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Subscriber Name String is Empty");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetNewSubscribersList
+/// This function sets the subscribers list of notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::SetNewSubscribersList(CNotification *f_pnotification) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator of CNotificationReceiver map
+ NotifReceiver_Iterator_Type l_itNotifReceiver;
+
+ std::string l_cSubscriberName;
+
+ if (NULL != f_pnotification && NULL != f_pnotification->m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: f_pnotification and f_pnotification->m_pmSubscribersList can't be empty // NOLINT[whitespace/line_length]
+ if (!f_pnotification->m_pmSubscribersList->empty()) {
+ for (l_itNotifReceiver = f_pnotification->m_pmSubscribersList->begin();
+ l_itNotifReceiver != f_pnotification->m_pmSubscribersList->end();
+ l_itNotifReceiver++) {
+ l_cSubscriberName = (*l_itNotifReceiver).first;
+ AddReceiverInMap(l_cSubscriberName); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Subscriber List Empty");
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_pnotification and f_pnotification->m_pmSubscribersList can't be empty // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetEventPublisher
+/// This function set the publisher name to current received service name
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::SetEventPublisher(const std::string &f_cservicename) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!f_cservicename.empty()) {
+ m_cServiceName = f_cservicename;
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Service successfully set"); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Service Name String is Empty");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetEventPublisher
+/// This function resets the publisher name
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::ResetEventPublisher(const std::string &f_cservicename) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_cservicename.empty()) { // LCOV_EXCL_BR_LINE 6: f_cservicename can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_cservicename can't be empty
+ } else {
+ if (0 == m_cServiceName.compare(f_cservicename)) {
+ m_cServiceName = "";
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Service successfully reset"); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Service Name Not Registered"); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+EFrameworkunifiedStatus CNotification::AddReceiverInMap(const std::string &f_csubscribername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Message Queue Handle for passsing messages
+ HANDLE l_hMsgSenQueHandle = NULL;
+
+ // Pointer to class CNotificationReceiver
+ CNotificationReceiver *l_pCNotificationReceiver = NULL;
+
+ // Iterator for Notification Receiver map
+ NotifReceiver_Iterator_Type l_itrNotifReceiver;
+
+ if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: f_csubscribername can't be empty
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Message Queue Handle Set"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ CHandleList *l_hHandleList = CHandleList::GetHandleList();
+
+ l_hMsgSenQueHandle = l_hHandleList->GetSubscriberMqHandle(f_csubscribername); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ // If handle not found
+ if (NULL == l_hMsgSenQueHandle) {
+ // Open a handle for sending messages to another message queue
+ l_hMsgSenQueHandle = McOpenSender(f_csubscribername.c_str());
+ l_hHandleList->AddHandleInList(f_csubscribername, l_hMsgSenQueHandle); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ }
+
+ if (NULL != m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: m_pmSubscribersList can't be NULL
+ l_pCNotificationReceiver = new(std::nothrow) CNotificationReceiver(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ if (NULL != l_pCNotificationReceiver) { // LCOV_EXCL_BR_LINE 5: l_pCNotificationReceiver can't be NULL
+ l_pCNotificationReceiver->m_MsgQHandle = l_hMsgSenQueHandle;
+
+ // Insert Subscriber name and associated message queue handle in the map
+ m_pmSubscribersList->insert(make_pair(f_csubscribername, l_pCNotificationReceiver));
+ } else {
+ // LCOV_EXCL_START 5: l_pCNotificationReceiver can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pCNotificationReceiver is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: m_pmSubscribersList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_pmSubscribersList is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusNullPointer == l_estatus) {
+ // close the queue handle
+ // NOTE: Uncomment following code when implementation of the function RemoveHandleFromList
+ // is available. To find the reason why it is not implemented, see the function definition.
+ // CHandleList *l_hHandleList = CHandleList::GetHandleList();
+ // l_hHandleList->RemoveHandleFromList(f_csubscribername);
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_csubscribername can't be empty
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// PublishData
+/// This function publishes the notification to client.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::PublishData(HANDLE f_hmsgqhandle,
+ const PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_hmsgqhandle) { // LCOV_EXCL_BR_LINE 6: f_hmsgqhandle can't be NULL
+ // Notification Name
+ PSTR l_cNotificationName = const_cast<PSTR>(m_cNotificationName.c_str());
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSendWithSysInfo(f_hmsgqhandle, AppName, NPS_NOTIFY_EV_REQ, l_cNotificationName, f_uimsgsize, f_pmessage, 0))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PublishData failed while McSend for Notification %s, Error Status: 0x%x",
+ l_cNotificationName, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_hmsgqhandle can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsServiceRegistered
+/// This function checks whether the notification is registered with any service or not.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNotification::IsServiceRegistered() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!m_cServiceName.empty()) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsSubscribersListEmpty
+/// This function is used to check whether any service is subscribed to notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNotification::IsSubscribersListEmpty() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: m_pmSubscribersList can't be NULL
+ if (m_pmSubscribersList->empty()) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetNotificationName
+/// This function is used to get the notification name.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+std::string CNotification::GetNotificationName() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ return m_cNotificationName;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPublisherName
+/// This function is used to get the publisher name of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+std::string CNotification::GetPublisherName() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ return m_cServiceName;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistenceType
+/// This function is used to get the type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedNotificationType CNotification::GetNotificationType() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ return m_ePersistentType;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetMaxMessageSize
+/// This function is used to get the max size of data of notification message.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CNotification::GetMaxMessageSize() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ return m_uiMaxMsgSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetMaxMessageSize
+/// This function reset the max size of data that can be published with notification.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::ResetMaxMessageSize(const UI_32 f_uilength) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_uiMaxMsgSize = f_uilength;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSubscriberList
+/// Returns the list of subscribers subscribed to notification
+////////////////////////////////////////////////////////////////////////////////////////////////
+NotifReceiver_Type *CNotification::GetSubscriberList() {
+ return m_pmSubscribersList;
+}
+
+#endif
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp
new file mode 100755
index 0000000..73ce838
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp
@@ -0,0 +1,1558 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of singleton class CNotificationManager.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <algorithm>
+#include <utility>
+#include <string>
+#include <vector>
+#include "ns_npp_types.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_threads.h"
+#include "ns_npp_notification.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_state_notification.h"
+#include "ns_npp_regular_notification.h"
+#include "ns_npp_notification_manager.h"
+#include "ns_npp_state_persistence_notification.h"
+#include "ns_npp_state_nor_persistence_notification.h"
+#include "ns_npp_state_persistence_user_notification.h"
+
+#ifdef NPP_PROFILEINFO_ENABLE
+#include <sstream>
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNotificationManager
+/// Constructor of CNotificationManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotificationManager::CNotificationManager() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_pmNotificationList = new(std::nothrow) Notification_Type(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ m_pvPersistentList = new(std::nothrow) std::vector<std::string>(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ m_pvUserPersistentList = new(std::nothrow) std::vector<std::string>(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ if (NULL == CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread =
+ McOpenSender(NS_NPP_IMMEDIATE_PERSIST_THREAD_NAME);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNotificationManager
+/// Destructor of CNotificationManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotificationManager::~CNotificationManager() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ CNotification *l_pNotification = NULL;
+
+ // delete the members in map of Notification
+ if (NULL != m_pmNotificationList) {
+ if (!m_pmNotificationList->empty()) {
+ for (l_itNotification = m_pmNotificationList->begin();
+ l_itNotification != m_pmNotificationList->end();
+ l_itNotification++) {
+ l_pNotification = (*l_itNotification).second;
+
+ if (NULL != l_pNotification) {
+ delete l_pNotification;
+ l_pNotification = NULL;
+ }
+ }
+
+ // clear the map
+ m_pmNotificationList->clear();
+ }
+
+ delete m_pmNotificationList;
+ m_pmNotificationList = NULL;
+ }
+
+ // delete the members in vector of persistent notification
+ if (NULL != m_pvPersistentList) {
+ if (!m_pvPersistentList->empty()) {
+ // clear the vector
+ m_pvPersistentList->clear();
+ }
+
+ delete m_pvPersistentList;
+ m_pvPersistentList = NULL;
+ }
+
+ // delete the members in vector of user persistent notification
+ if (NULL != m_pvUserPersistentList) {
+ if (!m_pvUserPersistentList->empty()) {
+ // clear the vector
+ m_pvUserPersistentList->clear();
+ }
+
+ delete m_pvUserPersistentList;
+ m_pvUserPersistentList = NULL;
+ }
+
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) {
+ McClose(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread);
+ CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateNotificationObject
+/// This function is used to get notification object from map. If doesn't exists, it create new
+/// object as per type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotification *CNotificationManager::CreateNotificationObject(const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // pointer of notification object
+ CNotification *l_pNotification = NULL;
+
+ // iterator to find notification from map of CNotification
+ Notification_Iterator_Type l_itNotification;
+
+ if (NULL == m_pmNotificationList || NULL == m_pvPersistentList || NULL == m_pvUserPersistentList) { // LCOV_EXCL_START 6: double check, m_pmNotificationList, m_pvPersistentList, m_pvUserPersistentList can't be NULL // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map/vector object is NULL"); // LCOV_EXCL_LINE 6: m_pmNotificationList, m_pvPersistentList, m_pvUserPersistentList can't be NULL // NOLINT[whitespace/line_length]
+ return NULL;
+ }
+ // LCOV_EXCL_STOP
+
+ // check if notification already exists
+ l_itNotification = m_pmNotificationList->find(f_cnotificationname);
+
+ // if exists remove previous entry
+ if (m_pmNotificationList->end() != l_itNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Removing previous entry of notification %s from map", f_cnotificationname.c_str());
+ m_pmNotificationList->erase(l_itNotification);
+ }
+
+ switch (f_enotificationtype) {
+ // if notification is regular notification
+ case eFrameworkunifiedNotificationVar: {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Regular Notification :: %s", f_cnotificationname.c_str());
+ l_pNotification = new(std::nothrow) CRegularNotification(f_cnotificationname,
+ f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ break;
+ }
+
+ // if notification is state notification
+ case eFrameworkunifiedStateVar: {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "State Notification :: %s", f_cnotificationname.c_str());
+ l_pNotification = new(std::nothrow) CStateNotification(f_cnotificationname,
+ f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ break;
+ }
+
+ // if notification is persistence notification
+ case eFrameworkunifiedPersistedStateVar: {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "PersistedState Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_pNotification = new(std::nothrow) CStatePersistenceNotification(f_cnotificationname,
+ f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ // insert notification in persistent notification vector
+ m_pvPersistentList->push_back(f_cnotificationname);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory not allocated"); // LCOV_EXCL_LINE 5: It's impossible to mock new() function // NOLINT[whitespace/line_length]
+ }
+
+ break;
+ }
+
+ // if notification is user persistence notification
+ case eFrameworkunifiedPersistedStateUserVar: {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "PersistedStateUser Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_pNotification = new(std::nothrow) CStatePersistenceUserNotification(f_cnotificationname,
+ f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ // insert notification in user persistent notification vector
+ m_pvUserPersistentList->push_back(f_cnotificationname);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NULL pointer error"); // LCOV_EXCL_LINE 5: It's impossible to mock new() function // NOLINT[whitespace/line_length]
+ }
+
+ break;
+ }
+
+ // if notification is immediate persistence notification
+ case eFrameworkunifiedImmediatePersistedStateVar: {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Immediate PersistedState Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_pNotification = new(std::nothrow) CStateNorPersistenceNotification(f_cnotificationname,
+ f_uimsglength,
+ f_uidelay); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if (NULL != l_pNotification) {
+ // insert notification in notification map
+ m_pmNotificationList->insert(make_pair(f_cnotificationname, l_pNotification));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object creation failed for %s.", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNotification;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SearchNotification
+/// This function is used to search whether notification object is present in map or not.
+/// If present it sends the reference.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotification *CNotificationManager::SearchNotification(const std::string &f_cnotificationname) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ if (NULL == m_pmNotificationList || f_cnotificationname.empty()) { // LCOV_EXCL_BR_LINE 6: double check, m_pmNotificationList can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map pointer is NULL"); // LCOV_EXCL_LINE 6: m_pmNotificationList can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ } else {
+ // check if this notification's object present in map
+ l_itNotification = m_pmNotificationList->find(f_cnotificationname);
+
+ // if notification found in map
+ if (m_pmNotificationList->end() != l_itNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification found in map :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // get the notification object pointer from map
+ l_pNotification = (*l_itNotification).second;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Notification not found :: %s", f_cnotificationname.c_str());
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNotification;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SearchPersistenceNotification
+/// This function is used to search for the given persistent notification in map.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStateNotification *CNotificationManager::SearchPersistenceNotification(const std::string &f_cnotificationname) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // pointer of notification object
+ CNotification *l_pNotification = NULL;
+ CStateNotification *l_pStateNotification = NULL;
+
+ // search the notification in the map
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ if (NULL != l_pNotification) {
+ if (eFrameworkunifiedPersistedStateVar == l_pNotification->GetNotificationType() ||
+ eFrameworkunifiedPersistedStateUserVar == l_pNotification->GetNotificationType() ||
+ eFrameworkunifiedImmediatePersistedStateVar == l_pNotification->GetNotificationType()) {
+ l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "There is no persistence notification registered with name :: %s",
+ f_cnotificationname.c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pStateNotification;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnRegisterEvents
+/// This function creates notification object depending on its type and if already created it adds
+/// the service name to the list in the notification object.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnRegisterEvents(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+
+ if (f_cservicename.empty() || f_cnotificationname.empty()) {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ // get the notification object from map or create new object
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ // if new notification is registered
+ if (NULL == l_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Create new notification object :: %s", f_cnotificationname.c_str());
+
+ // create the new notification object depending on type and insert in map and vector
+ l_pNotification = CreateNotificationObject(f_cnotificationname,
+ f_uimsglength,
+ f_enotificationtype,
+ f_uidelay);
+
+ if (NULL != l_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Set Notification publisher %s for notification %s", f_cservicename.c_str(),
+ f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ // set publisher name
+ l_estatus = l_pNotification->SetEventPublisher(f_cservicename);
+ }
+ } else { // if notification object already exists
+ EFrameworkunifiedNotificationType l_eNotificationType = l_pNotification->GetNotificationType();
+
+ // <<notification type is eFrameworkunifiedUnknown
+ // if some service had already subscribed to the notification before registering it.>>
+ if (eFrameworkunifiedUnknown == l_eNotificationType) {
+ // creates new notification object depending on the type and insert it in notification map
+ l_estatus = ChangeNotificationType(l_pNotification, f_cservicename, f_cnotificationname, f_uimsglength,
+ f_enotificationtype, f_uidelay);
+
+ // delete the old notification object
+ delete l_pNotification; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_pNotification = NULL;
+ } else { // notification is already registered by some service
+ // update the notification property, if re-registered by the same publisher
+ if (f_cservicename == l_pNotification->GetPublisherName() || // if re-register by service
+ "" == l_pNotification->GetPublisherName()) { // if previously unregistered by service
+ // if type is same just update the length of notification data
+ if (l_eNotificationType == f_enotificationtype) {
+ if (l_pNotification->GetMaxMessageSize() != f_uimsglength) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Updating max size of notification %s to %d from %d", f_cnotificationname.c_str(),
+ f_uimsglength, l_pNotification->GetMaxMessageSize());
+ l_estatus = l_pNotification->ResetMaxMessageSize(f_uimsglength);
+ }
+
+ if ("" == l_pNotification->GetPublisherName()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Updating publisher name of notification %s to %s from %s", f_cservicename.c_str(),
+ f_cnotificationname.c_str(), l_pNotification->GetPublisherName().c_str());
+ l_pNotification->SetEventPublisher(f_cservicename);
+ }
+ } else if (eFrameworkunifiedImmediatePersistedStateVar != l_eNotificationType &&
+ eFrameworkunifiedImmediatePersistedStateVar != f_enotificationtype) {
+ // else create new notification object depending on the type and delete the old one
+ // note: do not change immediate notification type
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Changing type of notfn %s from %d to %d", f_cnotificationname.c_str(),
+ l_eNotificationType, f_enotificationtype);
+
+ std::vector<std::string>::iterator l_itNotificationName;
+
+ // remove the notification name from the persistent list of notification(if any)
+ if (eFrameworkunifiedPersistedStateVar == l_eNotificationType) {
+ l_itNotificationName = find(m_pvPersistentList->begin(), m_pvPersistentList->end(), f_cnotificationname);
+
+ if (m_pvPersistentList->end() != l_itNotificationName) {
+ m_pvPersistentList->erase(l_itNotificationName);
+ }
+ } else if (eFrameworkunifiedPersistedStateUserVar == l_eNotificationType) {
+ l_itNotificationName = find(m_pvUserPersistentList->begin(),
+ m_pvUserPersistentList->end(),
+ f_cnotificationname);
+
+ if (m_pvUserPersistentList->end() != l_itNotificationName) {
+ m_pvUserPersistentList->erase(l_itNotificationName);
+ }
+ } else {
+ // do nothing
+ }
+
+ // creates new notification object depending on the new type and insert it in map and delete the old one
+ l_estatus = ChangeNotificationType(l_pNotification, f_cservicename, f_cnotificationname, f_uimsglength,
+ f_enotificationtype, f_uidelay);
+
+ // delete the old notification object
+ delete l_pNotification;
+ l_pNotification = NULL;
+ } else {
+ // do nothing
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notfn: %s already registered by %s, skipping register request by %s",
+ f_cnotificationname.c_str(), l_pNotification->GetPublisherName().c_str(), f_cservicename.c_str());
+
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ChangeNotificationType
+/// This function creates new notification object depending on the type and replaces the old one.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::ChangeNotificationType(CNotification *f_pnotification,
+ const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNewNotification = NULL;
+
+ if (NULL != f_pnotification) { // LCOV_EXCL_BR_LINE 6: f_pnotification can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Create New Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // create new notification object as per notification type
+ l_pNewNotification = CreateNotificationObject(f_cnotificationname, f_uimsglength, f_enotificationtype, f_uidelay);
+
+ if (NULL != l_pNewNotification) {
+ l_estatus = l_pNewNotification->SetEventPublisher(f_cservicename);
+
+ // assign subscribers list to newly created notification
+ l_pNewNotification->SetNewSubscribersList(f_pnotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error creating notification object for notification:%s",
+ f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_pnotification can't be NULL
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnUnRegisterEvents
+/// This function removes the name of the service from the notification object.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnUnRegisterEvents(const std::string &f_cservicename,
+ const std::string &f_cnotificationname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+ std::vector<std::string> *l_pvPersistentList = NULL;
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ if (f_cservicename.empty() || f_cnotificationname.empty()) {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ // check if this notification's object present in map
+ l_itNotification = m_pmNotificationList->find(f_cnotificationname);
+
+ // if notification found in map
+ if (m_pmNotificationList->end() != l_itNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification found in map"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // get the notification object pointer from map
+ l_pNotification = (*l_itNotification).second;
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: f_pnotification can't be NULL
+ if (eFrameworkunifiedPersistedStateUserVar == l_pNotification->GetNotificationType()) {
+ l_pvPersistentList = m_pvUserPersistentList;
+ } else if (eFrameworkunifiedPersistedStateVar == l_pNotification->GetNotificationType()) {
+ l_pvPersistentList = m_pvPersistentList;
+ }
+
+ // reset the publisher name
+ l_estatus = l_pNotification->ResetEventPublisher(f_cservicename);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ // if no other service is subscribed to this notification and no service is registered
+ // to this notification remove the notification object from map
+ if (!l_pNotification->IsServiceRegistered() &&
+ l_pNotification->IsSubscribersListEmpty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Deleting Notification Object"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // delete the notification
+ delete l_pNotification; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_pNotification = NULL;
+
+ m_pmNotificationList->erase(l_itNotification);
+
+ if (l_pvPersistentList) {
+ // find the notification in vector
+ std::vector<std::string>::iterator l_itNotificationName;
+
+ l_itNotificationName = find(l_pvPersistentList->begin(),
+ l_pvPersistentList->end(),
+ f_cnotificationname);
+
+ if (l_pvPersistentList->end() != l_itNotificationName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification name from vector");
+ l_pvPersistentList->erase(l_itNotificationName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Persistent list empty"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Services still registered or subscriber list empty"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s is not registered by service %s",
+ f_cnotificationname.c_str(), f_cservicename.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_pnotification can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not registered", f_cnotificationname.c_str());
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not found.", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnPublishEvent
+/// This function stores the published data in the notification object in case of state and
+/// persistent notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnPublishEvent(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+
+ if (f_cservicename.empty() || f_cnotificationname.empty()) { // LCOV_EXCL_BR_LINE 6: f_cservicename and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_cservicename and f_cnotificationname can't be empty
+ } else {
+ // get the notification object from map
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ if (NULL != l_pNotification) {
+ // publish the notification
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotification->Publish(f_cservicename,
+ f_pmessage,
+ f_uimsgsize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error publishing notification %s published by %s, status: %d",
+ f_cnotificationname.c_str(), f_cservicename.c_str(), l_estatus); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification not registered"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnSubscribeToEvent
+/// This function adds the name of the application to subscribers list in notification object.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnSubscribeToEvent(const std::string &f_csubscribername,
+ const std::string &f_cnotificationname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ CNotification *l_pNotification = NULL;
+
+ if (f_cnotificationname.empty() || f_csubscribername.empty()) {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ } else if (NULL == m_pmNotificationList) { // LCOV_EXCL_BR_LINE 6 m_pmNotificationList can't be NULL
+ // LCOV_EXCL_START 6: m_pmNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map pointer is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ // get the notification object from map or create new object
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ if (NULL == l_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "CNotification object created for %s", f_cnotificationname.c_str());
+
+ l_pNotification = new(std::nothrow) CNotification(f_cnotificationname, 0); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ m_pmNotificationList->insert(make_pair(f_cnotificationname, l_pNotification));
+ }
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: double check, l_pNotification can't be NULL
+ // add subscribers name in subscribers list of notification
+ l_estatus = l_pNotification->AddEventReciever(f_csubscribername);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory not allocated for l_pNotification"); // LCOV_EXCL_LINE 6: double check, l_pNotification can't be NULL // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnUnSubscribeFromEvent
+/// This function removes the name of the application from the subscribers list in notification object.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnUnSubscribeFromEvent(const std::string &f_csubscribername,
+ const std::string &f_cnotificationname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotificationType;
+
+ std::vector<std::string> *l_pvPersistentList = NULL;
+
+ if (f_cnotificationname.empty() || f_csubscribername.empty()) {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ } else if (NULL == m_pmNotificationList) { // LCOV_EXCL_BR_LINE 6: m_pmNotificationList can't be NULL
+ // LCOV_EXCL_START 6: m_pmNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification list pointer is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ // check if this notification's object present in map
+ l_itNotificationType = m_pmNotificationList->find(f_cnotificationname);
+
+ // if notification found in map
+ if (m_pmNotificationList->end() != l_itNotificationType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification %s found in map", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ l_pNotification = (*l_itNotificationType).second;
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: l_pNotification can't be NULL
+ if (eFrameworkunifiedPersistedStateUserVar == l_pNotification->GetNotificationType()) {
+ l_pvPersistentList = m_pvUserPersistentList;
+ } else if (eFrameworkunifiedPersistedStateVar == l_pNotification->GetNotificationType()) {
+ l_pvPersistentList = m_pvPersistentList;
+ }
+
+ // removes the subscribers name from subscribers list of notification
+ l_estatus = l_pNotification->DeleteEventReciever(f_csubscribername);
+
+ // if no other service is subscribed to this notification and no service is registered
+ // to this notification remove the notification object from map
+ if (!l_pNotification->IsServiceRegistered() &&
+ l_pNotification->IsSubscribersListEmpty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification Object from map"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // delete notification object from map
+ delete l_pNotification; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_pNotification = NULL;
+
+ m_pmNotificationList->erase(l_itNotificationType);
+
+ if (l_pvPersistentList) {
+ // find notification in vector
+ std::vector<std::string>::iterator l_itNotificationName;
+ l_itNotificationName = find(l_pvPersistentList->begin(),
+ l_pvPersistentList->end(),
+ f_cnotificationname);
+
+ if (l_pvPersistentList->end() != l_itNotificationName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification from vector"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_pvPersistentList->erase(l_itNotificationName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Persistent list Empty."); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotification can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Notification %s not registered", f_cnotificationname.c_str());
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Notification %s not found.", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NPGetPersistentNotificationData
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NPGetPersistentNotificationData(const std::string &f_cnotificationname,
+ PVOID f_pnotificationdata,
+ const UI_32 f_uidatasize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+ CStateNotification *l_pStateNotification = NULL;
+ const CPersistentData *l_pPersistentData = NULL;
+
+ if (f_cnotificationname.empty() || NULL == f_pnotificationdata) { // LCOV_EXCL_BR_LINE 6: f_pnotificationdata can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_pnotificationdata can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ } else {
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 200: f_cnotificationname must be NTFY_NPPService_UserChange, NTFY_NPPService_UserChange must be registered in FrameworkunifiedOnEntry() by itself. // NOLINT[whitespace/line_length]
+ const EFrameworkunifiedNotificationType l_eNotificationType = l_pNotification->GetNotificationType();
+
+ if (eFrameworkunifiedStateVar == l_eNotificationType ||
+ eFrameworkunifiedPersistedStateVar == l_eNotificationType ||
+ eFrameworkunifiedPersistedStateUserVar == l_eNotificationType ||
+ eFrameworkunifiedImmediatePersistedStateVar == l_eNotificationType) { // LCOV_EXCL_BR_LINE 200: NTFY_NPPService_UserChange's type is eFrameworkunifiedPersistedStateVar. // NOLINT[whitespace/line_length]
+ l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
+
+ l_pPersistentData = l_pStateNotification->GetPersistentData();
+
+ if (NULL != l_pPersistentData) {
+ if (f_uidatasize >= l_pPersistentData->m_uiMsgSize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending Data Size %d", l_pPersistentData->m_uiMsgSize);
+
+ if (NULL != l_pPersistentData->m_pMessage) {
+ std::memcpy(f_pnotificationdata, l_pPersistentData->m_pMessage, l_pPersistentData->m_uiMsgSize);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification data is NULL");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Smaller buffer size %d is received for notification data of size %d", f_uidatasize,
+ l_pPersistentData->m_uiMsgSize);
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Persistent data object is NULL for notification %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 200: NTFY_NPPService_UserChange's type is eFrameworkunifiedPersistedStateVar.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Get notification data failed, Notification %s is registered as type %d",
+ f_cnotificationname.c_str(), l_eNotificationType);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: f_cnotificationname must be NTFY_NPPService_UserChange, NTFY_NPPService_UserChange must be registered in FrameworkunifiedOnEntry() by itself. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not found.", f_cnotificationname.c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnGetPersistentData
+/// This function is used to get the persistent data stored related to notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnGetPersistentData(const std::string &f_cnotificationname,
+ const std::string &f_creceivername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+ CStateNotification *l_pStateNotification = NULL;
+ const CPersistentData *l_pPersistentData = NULL;
+
+ if (f_cnotificationname.empty() || f_creceivername.empty()) { // LCOV_EXCL_BR_LINE 6: f_creceivername can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: f_creceivername can't be NULL and f_cnotificationname can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ // open the receiver message queue
+ HANDLE l_hReceiverMq = McOpenSender(f_creceivername.c_str());
+
+ if (NULL == l_hReceiverMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // catastrophic failure!
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open MessageQ %s ", f_creceivername.c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ // get the notification object from map or create new object
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ if (NULL != l_pNotification) {
+ l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
+
+ if (NULL != l_pStateNotification) { // LCOV_EXCL_BR_LINE 5: fail safe for static_cast<CStateNotification *>
+ l_pPersistentData = l_pStateNotification->GetPersistentData();
+
+ if (NULL != l_pPersistentData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending Data Size %d", l_pPersistentData->m_uiMsgSize);
+
+ if (NULL == l_pPersistentData->m_pMessage) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending Data is NULL");
+ }
+
+ // sent the notification data to requester
+ l_estatus = McSend(l_hReceiverMq,
+ AppName,
+ NPS_GET_PERS_DATA_ACK,
+ l_pPersistentData->m_uiMsgSize,
+ l_pPersistentData->m_pMessage);
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Persistent data found for notification %s. "
+ "Sent NPS_GET_PERS_DATA_ACK to %s. Status: %d."
+ , f_cnotificationname.c_str(), f_creceivername.c_str(), l_estatus);
+ } else { // In case of failure, we send back a failure ACK
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "No persistent data found for notification %s. "
+ , f_cnotificationname.c_str());
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not found", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ // Close the mq handle
+ McClose(l_hReceiverMq);
+ l_hReceiverMq = NULL;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceGetPersistentNotificationData
+/// This function is used to get the list of persistent notifications and data associated with it.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceGetPersistentNotificationData(std::vector<CNotificationsToPersist *>
+ *f_pvpersistnotification,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+ CStateNotification *l_pStateNotification = NULL;
+ CStatePersistenceNotification *l_pStatePersistenceNotification = NULL;
+
+ std::string l_cNotificationName = "";
+ CNotificationsToPersist *l_pNotificationsToPersist = NULL;
+ const CPersistentData *l_pPData = NULL;
+
+ std::vector<std::string> *l_pvPersistentList = NULL;
+
+ // iterator for retrieving notifications from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ if (eFrameworkunifiedPersistedStateUserVar == f_enotificationtype) {
+ l_pvPersistentList = m_pvUserPersistentList;
+ } else if (eFrameworkunifiedPersistedStateVar == f_enotificationtype) { // LCOV_EXCL_BR_LINE 6: f_enotificationtype must be eFrameworkunifiedPersistedStateUserVar or eFrameworkunifiedPersistedStateVar // NOLINT[whitespace/line_length]
+ l_pvPersistentList = m_pvPersistentList;
+ }
+
+ // copy all the notification data in map to received vector
+ if (NULL != f_pvpersistnotification && NULL != l_pvPersistentList) { // LCOV_EXCL_BR_LINE 6: f_pvpersistnotification and l_pvPersistentList can't be null // NOLINT[whitespace/line_length]
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_pvPersistentList->size();
+ l_uiCount++) {
+ // get the persistent notification name from vector
+ l_cNotificationName = l_pvPersistentList->at(l_uiCount);
+
+ // search for notification in map
+ l_itNotification = m_pmNotificationList->find(l_cNotificationName);
+
+ // notification found in map
+ if (m_pmNotificationList->end() != l_itNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Persistent Notification: %s", l_cNotificationName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // get notification object from map
+ l_pNotification = (*l_itNotification).second;
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: l_pNotification can't be NULL
+ if (eFrameworkunifiedPersistedStateVar == f_enotificationtype) {
+ l_pStatePersistenceNotification = static_cast<CStatePersistenceNotification *>(l_pNotification);
+
+ // get the notification's default data
+ if ((eFrameworkunifiedUserData == l_pStatePersistenceNotification->GetPersistentCategory() &&
+ (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedUserData)) ||
+ (eFrameworkunifiedFactoryData == l_pStatePersistenceNotification->GetPersistentCategory() &&
+ (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedFactoryData)) ||
+ (eFrameworkunifiedFactoryCustomerData == l_pStatePersistenceNotification->GetPersistentCategory() &&
+ (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedFactoryCustomerData)) ||
+ (eFrameworkunifiedDealerData == l_pStatePersistenceNotification->GetPersistentCategory() &&
+ (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedDealerData))) {
+ l_pPData = l_pStatePersistenceNotification->GetDefaultPersistentData();
+ } else {
+ l_pStateNotification = l_pStatePersistenceNotification;
+
+ // get the published notification data
+ if (l_pStateNotification->IsPublished()) {
+ l_pPData = l_pStateNotification->GetPersistentData();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification not published");
+ }
+ }
+ } else {
+ l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
+
+ // if not to reset userdata
+ if (0 == (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedUserData)) {
+ if (l_pStateNotification->IsPublished()) {
+ l_pPData = l_pStateNotification->GetPersistentData();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification not published");
+ }
+ }
+ }
+
+ if ((NULL != l_pStateNotification) && (NULL != l_pPData)) {
+ l_pNotificationsToPersist = CreateNotificationObjectToPersist(l_pStateNotification, l_pPData); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ // insert the persistent data in map
+ f_pvpersistnotification->push_back(l_pNotificationsToPersist); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ l_pPData = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "no data is stored in notification %s", l_cNotificationName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object is NULL for %s", l_cNotificationName.c_str()); // LCOV_EXCL_LINE 6: l_pNotification can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Non Persistent Notification: %s", l_cNotificationName.c_str());
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_pvpersistnotification and l_pvPersistentList can't be null // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateNotificationObjectToPersist
+/// Creates the CNotificationsToPersist object from notification object and the persistent data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotificationsToPersist *CNotificationManager::CreateNotificationObjectToPersist(CStateNotification
+ *f_pStateNotification,
+ const CPersistentData *f_pdata) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotificationsToPersist *l_pNotificationsToPersist = NULL;
+ CPersistentData *l_pData = NULL;
+
+ if (NULL != f_pStateNotification && NULL != f_pdata) { // LCOV_EXCL_BR_LINE 6: f_pStateNotification and f_pdata can't be NULL // NOLINT[whitespace/line_length]
+ if (f_pStateNotification->GetMaxMessageSize() >= f_pdata->m_uiMsgSize) {
+ l_pNotificationsToPersist = new(std::nothrow) CNotificationsToPersist(); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ if (NULL != l_pNotificationsToPersist) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ l_pNotificationsToPersist->m_pPersistentData = new(std::nothrow) CPersistentData(); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ l_pData = l_pNotificationsToPersist->m_pPersistentData;
+
+ if (NULL != l_pData) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ l_pNotificationsToPersist->m_cNotificationName = f_pStateNotification->GetNotificationName();
+ l_pNotificationsToPersist->m_uiMaxMsgLength = f_pStateNotification->GetMaxMessageSize();
+ l_pNotificationsToPersist->m_ePersistentType = f_pStateNotification->GetNotificationType();
+
+ if (eFrameworkunifiedPersistedStateVar == l_pNotificationsToPersist->m_ePersistentType) {
+ l_pNotificationsToPersist->m_ePersistCategory = (static_cast<CStatePersistenceNotification *>
+ (f_pStateNotification))->GetPersistentCategory();
+ }
+
+ l_pNotificationsToPersist->m_cPublisherName = f_pStateNotification->GetPublisherName();
+
+ l_pData->m_uiMsgSize = f_pdata->m_uiMsgSize;
+ l_pData->m_pMessage = new(std::nothrow) CHAR[l_pNotificationsToPersist->m_uiMaxMsgLength];
+
+ if (NULL != l_pData->m_pMessage) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ std::memset(l_pData->m_pMessage, 0, l_pNotificationsToPersist->m_uiMaxMsgLength);
+ std::memcpy(l_pData->m_pMessage, f_pdata->m_pMessage, f_pdata->m_uiMsgSize);
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "memory not allocated for l_pNotificationsToPersist"); // LCOV_EXCL_LINE 5: It's impossible to mock new() function // NOLINT[whitespace/line_length]
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error persisting notfn, Data size of notification %s is %d greater than max registered size %d",
+ f_pStateNotification->GetNotificationName().c_str(),
+ f_pdata->m_uiMsgSize, f_pStateNotification->GetMaxMessageSize());
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid parameter received"); // LCOV_EXCL_LINE 6: f_pStateNotification and f_pdata can't be NULL // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNotificationsToPersist;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSetPersistentNotificationData
+/// This function is used to create the persistent notifications object and fill the data related
+/// with it on system load.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceSetPersistentNotificationData(std::vector<CNotificationsToPersist *>
+ *f_pvpersistnotification) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CStateNotification *l_pNotification = NULL;
+ CNotificationsToPersist *l_pNotificationsToPersist = NULL;
+
+ std::vector<std::string> *l_pvPersistentList = NULL;
+
+ Persistent_Iterator_Type l_itPersistentData;
+
+ // store all the notification data received in vector to map of CNotification and to vector of
+ // persistent notification in case of persistent and user persistent notification
+ if (NULL != f_pvpersistnotification) { // LCOV_EXCL_BR_LINE 6: double check, f_pvpersistnotification can't be NULL
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < f_pvpersistnotification->size();
+ l_uiCount++) {
+ // get the persistent data object
+ l_pNotificationsToPersist = f_pvpersistnotification->at(l_uiCount);
+
+ if (NULL != l_pNotificationsToPersist) { // LCOV_EXCL_BR_LINE 6: double check, l_pNotificationsToPersist can't be NULL // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Persistent Type %d", l_pNotificationsToPersist->m_ePersistentType);
+
+ if (eFrameworkunifiedPersistedStateVar == l_pNotificationsToPersist->m_ePersistentType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "PersistentState Notification");
+
+ l_pNotification = new(std::nothrow) CStatePersistenceNotification(
+ l_pNotificationsToPersist->m_cNotificationName,
+ l_pNotificationsToPersist->m_uiMaxMsgLength,
+ l_pNotificationsToPersist->m_ePersistCategory);
+
+ l_pvPersistentList = m_pvPersistentList;
+ } else if (eFrameworkunifiedPersistedStateUserVar == l_pNotificationsToPersist->m_ePersistentType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "PersistentStateUser Notification");
+
+ l_pNotification = new(std::nothrow) CStatePersistenceUserNotification(
+ l_pNotificationsToPersist->m_cNotificationName,
+ l_pNotificationsToPersist->m_uiMaxMsgLength);
+
+ l_pvPersistentList = m_pvUserPersistentList;
+ } else if (eFrameworkunifiedImmediatePersistedStateVar == l_pNotificationsToPersist->m_ePersistentType) { // LCOV_EXCL_BR_LINE 6: l_pNotificationsToPersist->m_ePersistentType must be eFrameworkunifiedPersistedStateVar, eFrameworkunifiedPersistedStateUserVar, eFrameworkunifiedImmediatePersistedStateVar // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "PersistentStateUser Notification");
+
+ l_pNotification = new(std::nothrow) CStateNorPersistenceNotification(
+ l_pNotificationsToPersist->m_cNotificationName,
+ l_pNotificationsToPersist->m_uiMaxMsgLength,
+ l_pNotificationsToPersist->m_uiDelay,
+ l_pNotificationsToPersist->m_ePersistCategory);
+ }
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: l_pNotification can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Insert persistent notification object in map");
+
+ l_pNotification->SetPersistentData(l_pNotificationsToPersist->m_pPersistentData->m_pMessage,
+ l_pNotificationsToPersist->m_pPersistentData->m_uiMsgSize);
+
+ l_pNotification->SetEventPublisher(l_pNotificationsToPersist->m_cPublisherName);
+
+ if (NULL != m_pmNotificationList) { // LCOV_EXCL_BR_LINE 6: double check, m_pmNotificationList can't be NULL
+ m_pmNotificationList->insert(make_pair(l_pNotificationsToPersist->m_cNotificationName, l_pNotification));
+
+ if (NULL != l_pvPersistentList) {
+ l_pvPersistentList->push_back(l_pNotificationsToPersist->m_cNotificationName);
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Inserted persistent notification object in map");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Inserted persistent notification object in vector");
+ } else {
+ // LCOV_EXCL_START 6: double check, m_pmNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete l_pNotification;
+ l_pNotification = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object not inserted in map/vector");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotification can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "notification object is NULL");
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pNotificationsToPersist can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationsToPersist is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, f_pvpersistnotification can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistent data pointer is NULL");
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveUserSpecificNotificationEntry
+/// This function is used to remove the user persistent notifications entry
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::RemoveUserSpecificNotificationEntry() { // LCOV_EXCL_START 100: never be used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string l_cNotificationName;
+
+ std::vector<std::string>::iterator l_itNotificationName;
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ CNotification *l_pNotification = NULL;
+
+ for (l_itNotificationName = m_pvUserPersistentList->begin() ; l_itNotificationName < m_pvUserPersistentList->end() ;
+ l_itNotificationName++) {
+ l_cNotificationName = *(l_itNotificationName);
+
+ // check if this notification's object present in map
+ l_itNotification = m_pmNotificationList->find(l_cNotificationName);
+
+ if (m_pmNotificationList->end() != l_itNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification found in map");
+
+ // get the notification object pointer from map
+ l_pNotification = (*l_itNotification).second;
+
+ if (NULL != l_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification Object");
+
+ // delete the notification
+ delete l_pNotification;
+ l_pNotification = NULL;
+
+ m_pmNotificationList->erase(l_itNotification);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification name from vector");
+ m_pvUserPersistentList->erase(l_itNotificationName);
+
+ l_itNotificationName = m_pvUserPersistentList->begin();
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification not found.");
+
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CNotificationManager::GetNotificationInfo(const std::string &f_cnotificationname, // LCOV_EXCL_START 100: never be used // NOLINT[whitespace/line_length]
+ CNotificationsToPersist *&f_pnotificationstopersist) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+ CStateNotification *l_pStateNotification = NULL;
+ const CPersistentData *l_pPData = NULL;
+
+ l_pNotification = SearchNotification(f_cnotificationname);
+ l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
+
+ if (NULL != l_pStateNotification) {
+ if (l_pStateNotification->IsPublished()) {
+ l_pPData = l_pStateNotification->GetPersistentData();
+
+ if (NULL != l_pPData) {
+ f_pnotificationstopersist = new(std::nothrow) CNotificationsToPersist();
+
+ if (NULL == f_pnotificationstopersist) {
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error for f_pnotificationstopersist");
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ f_pnotificationstopersist->m_pPersistentData = new(std::nothrow) CPersistentData();
+
+ if (NULL == f_pnotificationstopersist->m_pPersistentData) {
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error for f_pnotificationstopersist->m_pPersistentData");
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ f_pnotificationstopersist->m_cNotificationName = l_pStateNotification->GetNotificationName();
+ f_pnotificationstopersist->m_uiMaxMsgLength = l_pStateNotification->GetMaxMessageSize();
+ f_pnotificationstopersist->m_cPublisherName = l_pStateNotification->GetPublisherName();
+ f_pnotificationstopersist->m_ePersistentType = l_pStateNotification->GetNotificationType();
+
+ if (eFrameworkunifiedPersistedStateVar == f_pnotificationstopersist->m_ePersistentType) {
+ f_pnotificationstopersist->m_ePersistCategory = (static_cast<CStatePersistenceNotification *>
+ (l_pStateNotification))->GetPersistentCategory();
+ }
+
+ if (eFrameworkunifiedImmediatePersistedStateVar == f_pnotificationstopersist->m_ePersistentType) {
+ CStateNorPersistenceNotification *l_pStateNorPersistenceNotification =
+ static_cast<CStateNorPersistenceNotification *>(l_pStateNotification);
+ f_pnotificationstopersist->m_uiDelay = l_pStateNorPersistenceNotification->GetPersistenceDelay();
+ f_pnotificationstopersist->m_ePersistCategory = (static_cast<CStateNorPersistenceNotification *>
+ (l_pStateNotification))->GetPersistentCategory();
+ }
+
+ f_pnotificationstopersist->m_pPersistentData->m_pMessage = new(std::nothrow)
+ CHAR[f_pnotificationstopersist->m_uiMaxMsgLength];
+ std::memset(f_pnotificationstopersist->m_pPersistentData->m_pMessage, 0,
+ f_pnotificationstopersist->m_uiMaxMsgLength);
+ std::memcpy(f_pnotificationstopersist->m_pPersistentData->m_pMessage,
+ l_pPData->m_pMessage, l_pPData->m_uiMsgSize);
+
+ f_pnotificationstopersist->m_pPersistentData->m_uiMsgSize = l_pPData->m_uiMsgSize;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "No data is stored in notification %s", f_cnotificationname.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification %s not published", f_cnotificationname.c_str());
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSetDefaultPersistentNotificationData
+/// This function is used to set the default data of persistent notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceSetDefaultPersistentNotificationData(const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // pointer of notification object
+ CStateNotification *l_pStateNotification = SearchPersistenceNotification(f_cnotificationname);
+
+ if (NULL != l_pStateNotification) {
+ l_estatus = l_pStateNotification->SetDefaultPersistentData(f_pmessage, f_uimsgsize);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to set default notification data for %s, notification does not exists",
+ f_cnotificationname.c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSetPersistentCategory
+/// This function is used to set the persistent type of persistent notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceSetPersistentCategory(const std::string &f_cnotificationname,
+ const EFrameworkunifiedPersistCategory f_epersistcategory) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // pointer of notification object
+ CStateNotification *l_pStateNotification = SearchPersistenceNotification(f_cnotificationname);
+
+ if (NULL != l_pStateNotification) {
+ EFrameworkunifiedNotificationType l_eNotificationType = l_pStateNotification->GetNotificationType();
+
+ if (eFrameworkunifiedPersistedStateVar == l_eNotificationType) {
+ l_estatus = (static_cast<CStatePersistenceNotification *>(l_pStateNotification))->SetPersistentCategory(
+ f_epersistcategory);
+ } else if (eFrameworkunifiedImmediatePersistedStateVar == l_eNotificationType) {
+ l_estatus = (static_cast<CStateNorPersistenceNotification *>(l_pStateNotification))->SetPersistentCategory(
+ f_epersistcategory);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Cannot set category %d for notification %s of type %d", f_epersistcategory,
+ f_cnotificationname.c_str(), l_eNotificationType);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Cannot set category %d for %s, Either not registered or not a persistent notification",
+ f_epersistcategory, f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentservicePublishImmediateNotification
+/// This function publish the immediate notification f_cnotificationname to all its subscribers.
+/// This API is called when service updates the immediate notification data in persistent memory
+/// using synchronous API.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentservicePublishImmediateNotification(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_cservicename.empty() || f_cnotificationname.empty()) {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ // get the notification object from map
+ CStateNotification *l_pStateNotf = SearchPersistenceNotification(f_cnotificationname);
+
+ if (NULL != l_pStateNotf) {
+ if (eFrameworkunifiedImmediatePersistedStateVar == l_pStateNotf->GetNotificationType()) {
+ CStateNorPersistenceNotification *l_pImmediateNotf =
+ static_cast<CStateNorPersistenceNotification *>(l_pStateNotf);
+
+ // publish the notification
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pImmediateNotf->PublishNotification(f_cservicename,
+ f_pmessage,
+ f_uimsgsize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error publishing notification %s published by %s, status: %d",
+ f_cnotificationname.c_str(), f_cservicename.c_str(), l_estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s is not registered as immediate persistence by service %s",
+ f_cnotificationname.c_str(), f_cservicename.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not registered by service %s", f_cnotificationname.c_str(),
+ f_cservicename.c_str());
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+EFrameworkunifiedStatus CNotificationManager::GetNotificationProfilingData(std::string &f_cnotificationprofileInfo) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ Notification_Iterator_Type l_itNotification;
+ NotifReceiver_Iterator_Type l_itNotifReceiver_Iterator;
+
+ CNotification *l_pNotification = NULL;
+ NotifReceiver_Type *l_pSubscriberList = NULL;
+
+ std::stringstream ss;
+ UI_32 l_uiSubscriberCnt = 0;
+
+ std::string l_cPublisher = "";
+ std::string l_cNotification = "";
+
+ try {
+ if (NULL == m_pmNotificationList) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification List m_pmNotificationList is NULL in notification manager");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus && m_pmNotificationList->empty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification List m_pmNotificationList Empty in notification manager");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ f_cnotificationprofileInfo.append("Application Name,");
+ f_cnotificationprofileInfo.append("Notification Name,");
+ f_cnotificationprofileInfo.append("Type,");
+ f_cnotificationprofileInfo.append("Length,");
+ f_cnotificationprofileInfo.append("Subscribed By,");
+ f_cnotificationprofileInfo.append("Subscribers Count");
+
+ for (l_itNotification = m_pmNotificationList->begin();
+ l_itNotification != m_pmNotificationList->end();
+ l_itNotification++) {
+ l_pNotification = (*l_itNotification).second;
+ if (NULL == l_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object ptr is NULL");
+ l_estatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_cPublisher = l_pNotification->GetPublisherName();
+ if (l_cPublisher.empty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Publisher name empty");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ l_cNotification = l_pNotification->GetNotificationName();
+ if (l_cNotification.empty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification name empty");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ l_pSubscriberList = l_pNotification->GetSubscriberList();
+ if (NULL == l_pSubscriberList) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Subscribers List ptr is NULL");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ f_cnotificationprofileInfo.append("\n");
+
+ f_cnotificationprofileInfo.append(l_cPublisher);
+ f_cnotificationprofileInfo.append(",");
+
+ f_cnotificationprofileInfo.append(l_cNotification);
+ f_cnotificationprofileInfo.append(",");
+
+ switch (l_pNotification->GetNotificationType()) {
+ case eFrameworkunifiedNotificationVar : {
+ f_cnotificationprofileInfo.append("Regular");
+ }
+ break;
+
+ case eFrameworkunifiedStateVar : {
+ f_cnotificationprofileInfo.append("State");
+ }
+ break;
+
+ case eFrameworkunifiedPersistedStateVar : {
+ f_cnotificationprofileInfo.append("PersistenceState");
+ }
+ break;
+
+ case eFrameworkunifiedPersistedStateUserVar : {
+ f_cnotificationprofileInfo.append("UserPersistenceState");
+ }
+ break;
+
+ case eFrameworkunifiedImmediatePersistedStateVar : {
+ f_cnotificationprofileInfo.append("ImmediatePersistenceState");
+ }
+ break;
+
+ case eFrameworkunifiedUnknown: {
+ f_cnotificationprofileInfo.append("Unknown");
+ }
+ break;
+
+ default:
+ break;
+ }
+ f_cnotificationprofileInfo.append(",");
+
+ ss << l_pNotification->GetMaxMessageSize();
+ f_cnotificationprofileInfo.append(ss.str());
+ ss.str("");
+ f_cnotificationprofileInfo.append(",\"");
+
+ l_uiSubscriberCnt = 0;
+ for (l_itNotifReceiver_Iterator = l_pSubscriberList->begin();
+ l_pSubscriberList->end() != l_itNotifReceiver_Iterator;) {
+ f_cnotificationprofileInfo.append(l_itNotifReceiver_Iterator->first);
+ ++l_uiSubscriberCnt;
+
+ ++l_itNotifReceiver_Iterator;
+
+ if (l_pSubscriberList->end() != l_itNotifReceiver_Iterator) {
+ f_cnotificationprofileInfo.append(",");
+ }
+ }
+
+ f_cnotificationprofileInfo.append("\",");
+
+ ss << l_uiSubscriberCnt;
+ f_cnotificationprofileInfo.append(ss.str());
+ ss.str("");
+ }
+
+ l_estatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ } catch (std::exception &exp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Exception:: %s", exp.what());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+#endif
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp
new file mode 100755
index 0000000..53b9eab
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp
@@ -0,0 +1,50 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CNotificationReceiver.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include "ns_npp_notification_receiver.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNotificationReceiver
+/// Constructor of CNotificationReceiver class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotificationReceiver::CNotificationReceiver() {
+ m_MsgQHandle = NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNotificationReceiver
+/// Destructor of CNotificationReceiver class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotificationReceiver::~CNotificationReceiver() {
+ m_MsgQHandle = NULL;
+}
+
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp
new file mode 100755
index 0000000..4b0e452
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp
@@ -0,0 +1,100 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains definition of CFilePersistence class.
+/// This class is responsible for persisting and retrieving of files.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <unistd.h>
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_copy_worker.h"
+#include "ns_npp_persist_file.h"
+#include "ns_npp_registry_entry.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFilePersistence
+/// Constructor of CFilePersistence class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFilePersistence::CFilePersistence() {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFilePersistence
+/// Destructor of CFilePersistence class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFilePersistence::~CFilePersistence() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Release
+/// Entry for the file is stored in map for persistence.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFilePersistence::Release(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_cmempath.empty() || f_crequesterappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cmempath, f_crequesterappname and f_ctag can't be empty
+ // LCOV_EXCL_START 6: f_cmempath, f_crequesterappname and f_ctag can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid file path, requester or tag.");
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ l_estatus = ProcessReleaseRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE, f_cmempath, enotificationpersistentservicereleasetype,
+ f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Load
+/// Load file from persistent memory to the specified location.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFilePersistence::Load(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ if (!f_ctag.empty() && !f_crequesterappname.empty() && !f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_ctag, f_crequesterappname and f_cretrievepath can't be empty
+ l_estatus = ProcessLoadRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE, f_cretrievepath, f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ } else {
+ // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cretrievepath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid argument passed (RetrievePath:%s ,tag:%s, requester:%s)",
+ f_cretrievepath.c_str(), f_ctag.c_str(), f_crequesterappname.c_str());
+
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp
new file mode 100755
index 0000000..87b1ed4
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp
@@ -0,0 +1,96 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <unistd.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <string>
+#include "ns_npp_persistence.h"
+#include "ns_npp_persist_folder.h"
+#include "ns_npp_registry_entry.h"
+
+// Constructor of class CFolderPersistence
+CFolderPersistence::CFolderPersistence() {
+}
+
+// Destructor of class CFolderPersistence
+CFolderPersistence::~CFolderPersistence() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+// Method to release folder for persistence.
+EFrameworkunifiedStatus CFolderPersistence::Release(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_cmempath.empty() || f_crequesterappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cmempath, f_crequesterappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cmempath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid folder path, requester or tag.");
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ // Call to method requesting to release the folder for persistence.
+ l_estatus = ProcessReleaseRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, f_cmempath, enotificationpersistentservicereleasetype,
+ f_cusername);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
+ return l_estatus;
+}
+
+// Method to load folder from persistent memory.
+EFrameworkunifiedStatus CFolderPersistence::Load(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ if (!f_ctag.empty() && !f_crequesterappname.empty() && !f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cretrievepath, f_crequesterappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ // Call to method requesting to load the folder from persistent memory.
+ l_estatus = ProcessLoadRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, f_cretrievepath, f_cusername);
+ } else {
+ // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cretrievepath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid argument passed (RetrievePath:%s ,tag:%s, requester:%s)",
+ f_cretrievepath.c_str(), f_ctag.c_str(), f_crequesterappname.c_str());
+
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp
new file mode 100755
index 0000000..a39b836
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp
@@ -0,0 +1,743 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CPersistence.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+// #include "frameworkunified_stub.h"
+#endif
+#include <unistd.h>
+#include <stdlib.h> // for getenv()
+#ifdef AGL_STUB
+#include <cstdio>
+#endif
+#include <utility>
+#include <string>
+#include "ns_npp_persistence.h"
+#include "ns_npp_registry_entry.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CPersistence
+/// Constructor of CPersistence class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistence::CPersistence():
+ m_cStoragePath(GetStoragePath()),
+ m_eCompressionType(ENOTIFICATIONPERSISTENTSERVICEDEFAULTCOMPRESSION),
+ m_hNSWriteToPersistentMem(NULL),
+ m_hNSReadFromPersistentMem(NULL),
+ m_hAppHandle(NULL),
+ m_bPersist(FALSE),
+ m_uiNotificationpersistentservicePersistCategoryFlag(0) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CPersistence
+/// Destructor of CPersistence class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistence::~CPersistence() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReadThreadHandle
+/// Set read thread handle.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistence::SetReadThreadHandle(HANDLE f_hreadthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_hNSReadFromPersistentMem = f_hreadthread;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetWriteThreadHandle
+/// Set write thread handle.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistence::SetWriteThreadHandle(HANDLE f_hwritethread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_hNSWriteToPersistentMem = f_hwritethread;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetStoragePath
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+std::string CPersistence::GetStoragePath() {
+ std::string l_cStoragePath(STORAGE_PATH);
+
+ return l_cStoragePath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Register
+/// Register tag for persistence.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::Register(std::string f_crequestorappname, std::string f_ctag, BOOL bisuserpersistence) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (f_ctag.empty() || f_crequestorappname.empty()) { // LCOV_EXCL_BR_LINE 6: f_ctag and f_crequestorappname can't be empty // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: f_ctag and f_crequestorappname can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid tag or requester.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ TSourceRegistryListItr l_itRegistry = m_mPersistRegistry.find(f_crequestorappname);
+ if (l_itRegistry != m_mPersistRegistry.end()) {
+ // source available, check for file/folder availability
+ TTagRegistryListItr l_itRegistryList = (l_itRegistry->second).find(f_ctag);
+ if (l_itRegistryList != (l_itRegistry->second).end()) {
+ // found already in the registry
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Already exists %s , %s", f_ctag.c_str(), f_crequestorappname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ // tag not found .. so add to the registry
+ CRegistryEntry l_objRegistryEntry(f_ctag, f_crequestorappname, m_cStoragePath,
+ bisuserpersistence); // f_eRegisterType, f_cUser);
+
+ (l_itRegistry->second).insert(make_pair(f_ctag, l_objRegistryEntry));
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s found adding tag %s", f_crequestorappname.c_str(), f_ctag.c_str());
+ }
+ } else {
+ // source not found, so creating a new entry
+ CRegistryEntry l_objRegistryEntry(f_ctag, f_crequestorappname, m_cStoragePath,
+ bisuserpersistence); // f_eRegisterType, f_cUser);
+
+ TTagRegistryList l_mRegList;
+ l_mRegList.insert(make_pair(f_ctag, l_objRegistryEntry)); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ m_mPersistRegistry.insert(std::make_pair(f_crequestorappname, l_mRegList)); // LCOV_EXCL_BR_LINE 11:except,C++ STL // NOLINT[whitespace/line_length]
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "none exists %s , %s. So, added entry.", // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ f_ctag.c_str(), f_crequestorappname.c_str()); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
+
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ProcessReleaseRequest
+/// Persist file/folder that need to be persisted.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::ProcessReleaseRequest(std::string f_crequesterappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (f_cmempath.empty() || f_crequesterappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6:f_cmempath, f_crequesterappname and f_ctag can`t be empty // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: f_cmempath, f_crequesterappname and f_ctag can`t be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG0(ZONE_ERR, __FUNCTION__, "Invalid file path, requester or tag.");
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ // Persistence Registry map iterator
+ TSourceRegistryListItr l_itTSourceRegistryListItr = m_mPersistRegistry.find(f_crequesterappname);
+
+ if (l_itTSourceRegistryListItr != m_mPersistRegistry.end()) {
+ // source available, check for file if registered
+ TTagRegistryListItr l_itTRegistryList = (l_itTSourceRegistryListItr->second).find(f_ctag);
+ if (l_itTRegistryList != (l_itTSourceRegistryListItr->second).end()) {
+ if (eFrameworkunifiedNotOnRelease != enotificationpersistentservicereleasetype) {
+ // Set release path
+ l_itTRegistryList->second.SetReleasePath(f_cmempath);
+ // Set persist path
+ l_itTRegistryList->second.SetPersistProperties(f_epersisttype, f_cusername); // LCOV_EXCL_BR_LINE 11:except,C++ STL // NOLINT[whitespace/line_length]
+
+ // file/folder found in registry
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "%s released %s. Found in registry. queued up to persist from %s",
+ f_crequesterappname.c_str(), f_ctag.c_str(), l_itTRegistryList->second.GetReleasePath().c_str());
+
+ // check if persist flag is set due to shutdown or user change
+ if ((m_bPersist // It will be set to TRUE either on shutdown or userchange
+ && l_itTRegistryList->second.HasntBeenPersisted()) // File/Folder persisted or not
+ || (eFrameworkunifiedPersistInstantly == enotificationpersistentservicereleasetype)) {
+ // reset the data
+ if (((eFrameworkunifiedUserData == l_itTRegistryList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedUserData & m_uiNotificationpersistentservicePersistCategoryFlag)) ||
+ ((eFrameworkunifiedFactoryData == l_itTRegistryList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedFactoryData & m_uiNotificationpersistentservicePersistCategoryFlag)) ||
+ ((eFrameworkunifiedFactoryCustomerData == l_itTRegistryList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedFactoryCustomerData & m_uiNotificationpersistentservicePersistCategoryFlag)) ||
+ ((eFrameworkunifiedDealerData == l_itTRegistryList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedDealerData & m_uiNotificationpersistentservicePersistCategoryFlag))) {
+ // set the status of file/folder persisted as reset has been called on these data
+ l_itTRegistryList->second.SetCurrentAction(LOADTYPE_RELEASE);
+ l_itTRegistryList->second.SetBeingPersisted();
+ } else { // persist the data
+ if (eFrameworkunifiedStatusOK != (l_estatus = Persist(static_cast<CRegistryEntry &>(l_itTRegistryList->second)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+ } else {
+ // Don't persist now. Persist on shutdown.
+ }
+ } else { // not on release
+ // set the status of file/folder as released and persisted as these data need not to be persisted on shutdown
+ l_itTRegistryList->second.SetReleasePath("");
+ l_itTRegistryList->second.SetCurrentAction(LOADTYPE_RELEASE);
+ l_itTRegistryList->second.SetBeingPersisted();
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s didn't register %s, not persisting",
+ f_crequesterappname.c_str(), f_ctag.c_str()); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ // source not registered, cannot persist
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s is not registered ignoring release of %s",
+ f_ctag.c_str(), f_crequesterappname.c_str());
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ }
+ return l_estatus;
+}
+
+EFrameworkunifiedStatus CPersistence::Persist(CRegistryEntry &f_objregistryentry) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // Persistence Info Structure
+ NSP_CopyInfoCmd l_tCpInfo = {};
+
+
+ std::string l_cSourcePath = f_objregistryentry.GetReleasePath();
+ std::string l_cPersistPath = f_objregistryentry.GetPersistPath(); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ // Fill the persistence info structure
+ AddRequestData(l_tCpInfo,
+ l_cSourcePath,
+ l_cPersistPath,
+ f_objregistryentry.GetRequester(),
+ f_objregistryentry.GetTag(),
+ LOADTYPE_RELEASE,
+ f_objregistryentry.GetPersistType());
+
+ // Persist only if file was released.
+ // Release means application has asked NPPService to persist file at shutdown.)
+ // Persist means actual persisting a file at persistent storage
+ if (f_objregistryentry.IsReleased()) {
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS == f_objregistryentry.m_eJobState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Another job with source: %s and tag %s is in process. "
+ "Therefore adding release request to the pending queue.",
+ f_objregistryentry.GetRequester().c_str(), f_objregistryentry.GetTag().c_str());
+ // if job corresponding to the tag is already in process, add it in pending queue
+ m_lPendingJobs.push_back(l_tCpInfo);
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE == f_objregistryentry.m_eJobState) {
+ if (eFrameworkunifiedStatusOK == (SendRequestMessage(l_tCpInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Release message passed to writer thread."); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ f_objregistryentry.SetCurrentAction(LOADTYPE_RELEASE);
+ f_objregistryentry.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS;
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failure in passing release message to writer thread.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File/Folder not released yet.");
+ }
+
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ProcessLoadRequest
+/// Load persisted file/folder.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::ProcessLoadRequest(std::string f_crequesterappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cretrievepath,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // file/folder found in registry
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Load request received: Requester: %s and Tag: %s Load at: %s.",
+ f_crequesterappname.c_str(), f_ctag.c_str(), f_cretrievepath.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ if (f_ctag.empty() || f_crequesterappname.empty() || f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: both f_ctag and f_crequesterappname and f_cretrievepath can`t be empty // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: both f_ctag and f_crequesterappname and f_cretrievepath can`t be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid argument passed (RetrievePath:%s ,tag:%s, requester:%s)",
+ f_cretrievepath.c_str(), f_ctag.c_str(), f_crequesterappname.c_str());
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ // Persistence Registry Map Iterator
+ TSourceRegistryListItr l_itTRegistry = m_mPersistRegistry.find(f_crequesterappname);
+
+ // Persistence Info Struct
+ NSP_CopyInfoCmd l_tCopyInfo = {};
+
+ if (l_itTRegistry != m_mPersistRegistry.end()) {
+ // source available, check for file/folder
+ TTagRegistryListItr l_itTRegistryList = (l_itTRegistry->second).find(f_ctag);
+ if (l_itTRegistryList != (l_itTRegistry->second).end()) {
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED == l_itTRegistryList->second.m_eJobState)) { // LCOV_EXCL_BR_LINE 6: m_eJobState can`t be ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: m_eJobState can`t be ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::string l_cReleasePath(l_itTRegistryList->second.GetReleasePath());
+ // if job was aborted due to some reason like abort shutdown.
+ // Then persistent storage doesn't have updated file/folder. Just restore
+ // aborted released file.
+ // just rename it
+ if (0 == std::rename(l_cReleasePath.c_str(), f_cretrievepath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File loaded at requested location.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error while processing load request when tried to move. source: %s dest: %s",
+ l_cReleasePath.c_str(), f_cretrievepath.c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ l_itTRegistryList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE;
+ // LCOV_EXCL_STOP
+ } else {
+ std::string l_cLoadPath(l_itTRegistryList->second.GetLoadPath(f_epersisttype, f_cusername)); // LCOV_EXCL_BR_LINE 11:except,C++ STL // NOLINT[whitespace/line_length]
+
+ if (0 == access(l_cLoadPath.c_str(), R_OK)) {
+ // file/folder found in registry
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Found in registry. checking in persistence...(%s)", l_cLoadPath.c_str());
+
+ AddRequestData(l_tCopyInfo,
+ l_cLoadPath,
+ f_cretrievepath,
+ f_crequesterappname,
+ f_ctag,
+ LOADTYPE_LOAD,
+ f_epersisttype);
+
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS == (l_itTRegistryList->second).m_eJobState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Another job with source: %s and tag %s is in process. "
+ "Therefore adding load request to the pending queue.",
+ f_crequesterappname.c_str(), f_ctag.c_str());
+ m_lPendingJobs.push_back(l_tCopyInfo);
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE == (l_itTRegistryList->second).m_eJobState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Found in persistence.");
+ if (eFrameworkunifiedStatusOK == (SendRequestMessage(l_tCopyInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Load message passed to reader thread. Retrieving..");
+ // file/folder is requested for loading so reset the persisted flag.
+ l_itTRegistryList->second.ResetPersistedFlag();
+ l_itTRegistryList->second.SetCurrentAction(LOADTYPE_LOAD);
+ l_itTRegistryList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS;
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failure in passing load message to reader thread.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s requested by %s. Not found in persistence memory.", // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ f_ctag.c_str(), f_crequesterappname.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ l_estatus = eFrameworkunifiedStatusAccessError;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s requesting %s .. Tag not found",
+ f_crequesterappname.c_str(), f_ctag.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ // source not found
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s requesting %s .. Requester not found",
+ f_crequesterappname.c_str(), f_ctag.c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ return l_estatus;
+}
+
+VOID CPersistence::AddRequestData(NSP_CopyInfoCmd &f_tcpinfo,
+ std::string f_sourcepath,
+ std::string f_destpath,
+ std::string f_crequesterappname,
+ std::string f_ctag,
+ ENPS_Loadtype f_eloadtype,
+ ENotificationpersistentservicePersistType f_epersisttype) {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(f_tcpinfo.m_csourcepath, f_sourcepath.c_str(), sizeof(f_tcpinfo.m_csourcepath));
+ strlcpy(f_tcpinfo.m_cdestinationpath, f_destpath.c_str(), sizeof(f_tcpinfo.m_cdestinationpath));
+ strlcpy(f_tcpinfo.m_crequesterappname, f_crequesterappname.c_str(), sizeof(f_tcpinfo.m_crequesterappname));
+ strlcpy(f_tcpinfo.m_cpersistenttag, f_ctag.c_str(), sizeof(f_tcpinfo.m_cpersistenttag));
+#endif
+ f_tcpinfo.m_eloadtype = f_eloadtype;
+ f_tcpinfo.m_epersisttype = f_epersisttype;
+ // f_tcpinfo.m_eCompressionType = ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ;
+}
+
+EFrameworkunifiedStatus CPersistence::SendRequestMessage(NSP_CopyInfoCmd &f_tcpinfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ HANDLE l_hThreadHandle = NULL;
+ // Worker Command Protocol
+ ENSP_CopyWorkerProtocol l_eWorkerProtocol = CP_WRK_CMD_COPY;
+
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == f_tcpinfo.m_epersisttype) {
+ l_eWorkerProtocol = CP_WRK_CMD_COPY;
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == f_tcpinfo.m_epersisttype) {
+ l_eWorkerProtocol = AR_CMD_ARCHIVE;
+ }
+
+ if (LOADTYPE_RELEASE == f_tcpinfo.m_eloadtype) {
+ l_hThreadHandle = m_hNSWriteToPersistentMem;
+ } else if (LOADTYPE_LOAD == f_tcpinfo.m_eloadtype) {
+ l_hThreadHandle = m_hNSReadFromPersistentMem;
+ }
+
+ if (l_hThreadHandle) {
+ // issue a copy to the worker thread
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSend(l_hThreadHandle, AppName, l_eWorkerProtocol, sizeof(NSP_CopyInfoCmd), &f_tcpinfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for thread failed %d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// AckReceivedFromWorker
+/// This is callback function for ack that file is released to persistenet memory.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, BOOL f_bcopystatus,
+ ENPS_Loadtype f_eloadtype) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus retVal = eFrameworkunifiedStatusOK;
+
+ std::string l_cRequester(f_csource);
+ std::string l_cTag(f_ctag); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ TSourceRegistryListItr l_itTReg = m_mPersistRegistry.find(l_cRequester);
+ if (l_itTReg != m_mPersistRegistry.end()) {
+ // source available, check for file
+ TTagRegistryListItr l_itTRegList = (l_itTReg->second).find(l_cTag);
+ if (l_itTRegList != (l_itTReg->second).end()) {
+ if (LOADTYPE_RELEASE == f_eloadtype) {
+ l_itTRegList->second.SetBeingPersisted(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ if (f_bcopystatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File persisted %s / %s", f_csource, f_ctag);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ "File not persisted %s / %s, Negative ack received from copy worker thread",
+ f_csource,
+ f_ctag); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ }
+
+ // Job processed. Set job state as idle
+ l_itTRegList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE;
+
+ // check if there are any pending jobs for corresponding source and tag
+ if (!m_lPendingJobs.empty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Retrieving next pending job for persistence...");
+ TPendingJobsItr l_itrPendingJobs;
+ for (l_itrPendingJobs = m_lPendingJobs.begin(); l_itrPendingJobs != m_lPendingJobs.end(); ++l_itrPendingJobs) {
+ if (0 == std::strcmp((*l_itrPendingJobs).m_crequesterappname, f_csource)
+ && (0 == std::strcmp((*l_itrPendingJobs).m_cpersistenttag, f_ctag))) {
+ if (eFrameworkunifiedStatusOK == (retVal = (SendRequestMessage((*l_itrPendingJobs))))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // set job state as processing
+ l_itTRegList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS;
+ // set current action
+ l_itTRegList->second.SetCurrentAction((*l_itrPendingJobs).m_eloadtype);
+ // Reset persisted flag. It requires to process release request for this tag.
+ // Because, file will be persisted only once. Unless, anyone loads the file again.
+ if (LOADTYPE_LOAD == (*l_itrPendingJobs).m_eloadtype) {
+ l_itTRegList->second.ResetPersistedFlag();
+ }
+
+ // remove job from pending list
+ m_lPendingJobs.erase(l_itrPendingJobs);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failure in passing load/release message to the worker threads.");
+ retVal = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ break;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No pending jobs"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // tag not found ..
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " ERROR %s, tag %s not found ", f_csource, f_ctag);
+ }
+ } else {
+ // source not found
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR none exists %s , %s", f_csource, f_ctag);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return retVal;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// PersistAllReleaseRequests
+/// Persist all files which are not persisted yet.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ m_bPersist = TRUE; // set to true because persist of all release requests have been triggered.
+ // Trigger reason: shutdown
+
+ m_uiNotificationpersistentservicePersistCategoryFlag = f_uinotificationpersistentservicepersistcategoryflag;
+
+ TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
+
+ for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
+ TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
+ for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
+ if (l_itTRegList->second.HasntBeenPersisted()) {
+ // reset the data
+ if (((eFrameworkunifiedUserData == l_itTRegList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedUserData & f_uinotificationpersistentservicepersistcategoryflag)) ||
+ ((eFrameworkunifiedFactoryData == l_itTRegList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedFactoryData & f_uinotificationpersistentservicepersistcategoryflag)) ||
+ ((eFrameworkunifiedFactoryCustomerData == l_itTRegList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedFactoryCustomerData & f_uinotificationpersistentservicepersistcategoryflag)) ||
+ ((eFrameworkunifiedDealerData == l_itTRegList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedDealerData & f_uinotificationpersistentservicepersistcategoryflag))) {
+ // set the status of file/folder as released and persisted as these data need not to be persisted on shutdown
+ l_itTRegList->second.SetCurrentAction(LOADTYPE_RELEASE);
+ l_itTRegList->second.SetBeingPersisted();
+ } else { // persist the data
+ if (eFrameworkunifiedStatusOK != Persist(static_cast<CRegistryEntry &>(l_itTRegList->second))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+BOOL CPersistence::HaveAllReleaseRequestsPersisted(std::string &f_ctagnotreleased) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bRetVal = TRUE;
+
+ TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
+
+ f_ctagnotreleased.assign("");
+
+ for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
+ TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
+ for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
+ if (l_itTRegList->second.HasntBeenPersisted()) {
+ l_bRetVal = FALSE;
+
+ if (!l_itTRegList->second.IsReleased()) {
+ f_ctagnotreleased.append("\n");
+ f_ctagnotreleased.append(l_itTRegList->second.GetTag());
+ f_ctagnotreleased.append(" [");
+ f_ctagnotreleased.append(l_itTRegList->second.GetRequester());
+ f_ctagnotreleased.append("]");
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bRetVal;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// PersistAllUserRequests
+/// Persist all user files which are not persisted yet.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::PersistAllUserRequests() {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ // TODO(my_username): Persist data on userchange. Uncomment following.
+ // m_bPersist = TRUE; // set to true because persist of all user release requests have been triggered.
+ // Trigger reason: user change
+
+ TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
+
+ for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
+ TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
+ for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
+ if (l_itTRegList->second.IsUserPersistence()) {
+ if (eFrameworkunifiedStatusOK != Persist(static_cast<CRegistryEntry &>(l_itTRegList->second))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+ }
+ }
+ return l_estatus;
+}
+
+BOOL CPersistence::IsUserPersistence(std::string f_ctag) {
+ BOOL l_bUserPersistence = FALSE;
+
+ TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
+
+ for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
+ TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
+ for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
+ if (l_itTRegList->second.GetTag() == f_ctag) {
+ if (l_itTRegList->second.IsUserPersistence()) {
+ l_bUserPersistence = TRUE;
+ }
+ break;
+ }
+ }
+ }
+
+ return l_bUserPersistence;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistentCategory
+/// Sets the persist type of file/folder
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::SetPersistentCategory(const std::string &f_crequesterappname,
+ const std::string &f_ctag,
+ EFrameworkunifiedPersistCategory f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // Persistence Registry map iterator
+ TSourceRegistryListItr l_itTSourceRegistryListItr = m_mPersistRegistry.find(f_crequesterappname);
+
+ if (m_mPersistRegistry.end() != l_itTSourceRegistryListItr) {
+ // source available, check for file if registered
+ TTagRegistryListItr l_itTRegistryList = (l_itTSourceRegistryListItr->second).find(f_ctag);
+
+ if ((l_itTSourceRegistryListItr->second).end() != l_itTRegistryList) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppName:: %s, Tag:: %s found in registry", f_crequesterappname.c_str(),
+ f_ctag.c_str());
+
+ l_estatus = (l_itTRegistryList->second).SetPersistentCategory(f_epersistcategory);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s didn't register %s", f_crequesterappname.c_str(), f_ctag.c_str());
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ // source not registered, cannot persist
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s is not registered", f_ctag.c_str());
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetPersistFlag
+/// Resets the persist flag.
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistence::ResetPersistFlag() {
+ m_bPersist = FALSE;
+
+ m_uiNotificationpersistentservicePersistCategoryFlag = 0;
+}
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+EFrameworkunifiedStatus CPersistence::GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ TSourceRegistryListItr l_itrTSourceRegistryListItr;
+ TTagRegistryListItr l_itrTTagRegistryListItr;
+
+ for (l_itrTSourceRegistryListItr = m_mPersistRegistry.begin();
+ l_itrTSourceRegistryListItr != m_mPersistRegistry.end();
+ l_itrTSourceRegistryListItr++) {
+ for (l_itrTTagRegistryListItr = (l_itrTSourceRegistryListItr->second).begin();
+ l_itrTTagRegistryListItr != (l_itrTSourceRegistryListItr->second).end();
+ l_itrTTagRegistryListItr++) {
+ f_cpersistenceprofileinfo.append("\n");
+ f_cpersistenceprofileinfo.append((*l_itrTSourceRegistryListItr).first);
+ f_cpersistenceprofileinfo.append(",");
+
+ f_cpersistenceprofileinfo.append(l_itrTTagRegistryListItr->first);
+ f_cpersistenceprofileinfo.append(",");
+
+ switch ((l_itrTTagRegistryListItr->second).GetPersistType()) {
+ case ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE: {
+ f_cpersistenceprofileinfo.append("File,");
+ }
+ break;
+
+ case ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER: {
+ f_cpersistenceprofileinfo.append("Folder,");
+ }
+ break;
+
+ default: {
+ f_cpersistenceprofileinfo.append(",");
+ }
+ break;
+ }
+
+ if ((l_itrTTagRegistryListItr->second).IsUserPersistence()) {
+ f_cpersistenceprofileinfo.append("Yes,");
+ } else {
+ f_cpersistenceprofileinfo.append("No,");
+ }
+
+ if ((l_itrTTagRegistryListItr->second).IsReleased()) {
+ f_cpersistenceprofileinfo.append("Yes,");
+ } else {
+ f_cpersistenceprofileinfo.append("No,");
+ }
+
+ if ((l_itrTTagRegistryListItr->second).IsPersisted()) {
+ f_cpersistenceprofileinfo.append("Yes");
+ } else {
+ f_cpersistenceprofileinfo.append("No");
+ }
+ }
+ }
+ return l_estatus;
+}
+
+#endif
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp
new file mode 100755
index 0000000..7f5d292
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp
@@ -0,0 +1,1132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief This file contains implementation of class CPersistenceManager.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <stdio.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_util_directory.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <string>
+#include <native_service/ns_np_service_nor_persistence_internal.h>
+#include "ns_npp.h"
+#include "ns_npp_types.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_copy_worker.h"
+#include "ns_npp_persistence.h"
+#include "ns_npp_persist_file.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_persist_folder.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_binary_accesser.h"
+#include "ns_npp_persistence_manager.h"
+#include "ns_npp_nor_persistence_worker_thread.h"
+#include "ns_npp_state_nor_persistence_notification.h"
+
+extern const CHAR AppName[]; // NOLINT (readability/naming)
+
+// Initialisation of static class member for disabling persistence
+BOOL CPersistenceManager::m_bPersistenceDisabled = FALSE;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CPersistenceManager
+/// Constructor of CPersistenceManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistenceManager::CPersistenceManager() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_cUserNotificationTag = USERNOTIFICATIONFILE;
+
+ m_poDataAccesser = NULL;
+
+ m_cNotificationPersistFilepath = CPersistence::GetStoragePath(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Storage path for persistence=%s", m_cNotificationPersistFilepath.c_str()); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ m_cNotificationPersistFilepath += AppName;
+ m_cNotificationPersistFilepath += "/";
+
+ m_hNSImmediatePersistenceThread = NULL;
+ m_bAllFilePersisted = FALSE;
+ m_bImmediatedDataPersisted = FALSE;
+
+ if (eFrameworkunifiedStatusOK != Init()) { // LCOV_EXCL_BR_LINE 6: Init() must be return eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to initialize Persistent Manager."); // LCOV_EXCL_LINE 6: Init() must be return eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CPersistenceManager
+/// Destructor of CPersistenceManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistenceManager::~CPersistenceManager() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_poDataAccesser) {
+ delete m_poDataAccesser;
+ }
+
+ Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
+ // Remove memory allocated for persistence objects
+ for (; l_itPersist_Type != m_mPersist_Type.end(); ++l_itPersist_Type) {
+ if (NULL != (*l_itPersist_Type).second) {
+ delete(*l_itPersist_Type).second;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CPersistenceManager::Init() {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE] = new(std::nothrow) CFilePersistence(); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER] = new(std::nothrow) CFolderPersistence(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT[whitespace/line_length]
+
+ m_poDataAccesser = new(std::nothrow) CBinaryAccesser(); // Save data in binary format. // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT[whitespace/line_length]
+
+ // check if all object creation is successful
+ if (NULL != m_poDataAccesser) { // LCOV_EXCL_BR_LINE 5:m_poDataAccesser can`t be NULL
+ Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
+
+ // check if all object creation is successful
+ for (; l_itPersist_Type != m_mPersist_Type.end();
+ ++l_itPersist_Type) {
+ if (NULL == (*l_itPersist_Type).second) { // LCOV_EXCL_START 6:(*l_itPersist_Type).second can`t be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 5: m_poDataAccesser can`t be NULL
+ }
+
+ if (eFrameworkunifiedStatusOK != l_estatus) { // LCOV_EXCL_START 6: l_estatus must be eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (NULL != m_poDataAccesser) {
+ delete m_poDataAccesser;
+ }
+
+ Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
+ // check if all object creation is successful
+ for (; l_itPersist_Type != m_mPersist_Type.end(); ++l_itPersist_Type) {
+ if (NULL != (*l_itPersist_Type).second) {
+ delete(*l_itPersist_Type).second;
+ }
+ }
+ // LCOV_EXCL_STOP
+ }
+ std::string f_csourcepath = CPersistence::GetStoragePath();
+ if (f_csourcepath.length() > 0) { // LCOV_EXCL_BR_LINE 6: f_csourcepath.length() is always bigger then 0
+ f_csourcepath.append(RELEASETEMP_DIR); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (CFSDirectory::DoesDirecotryExist(f_csourcepath)) {
+ f_csourcepath.append(RELEASETEMP_FILENAME);
+ if (0 != remove(f_csourcepath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Temporary file not deleted::%s, errno:%d", f_csourcepath.c_str(), errno);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceRegister
+/// Registers a tag for the file/folder. This tag will be used for releasing or loading
+/// a file/folder.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceRegister(std::string f_cappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ BOOL bisuserpersistence) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+
+ if (f_cappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Appname & tag should not be empty."); // LCOV_EXCL_LINE 6: f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ } else {
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ // register tag
+ l_estatus = m_mPersist_Type[f_epersisttype]->Register(f_cappname, f_ctag,
+ bisuserpersistence); // f_eRegisterType, f_cUser); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ // m_mPersist_Type[f_ePersistFileType]->ListAllInMap();
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always biger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceRelease
+/// Entry for the file/folder is stored in map for persistence.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceRelease(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cusername) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+
+ if (f_cappname.empty() || f_ctag.empty() || f_cmempath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cappname, f_cmempath and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Appname & tag should not be empty."); // LCOV_EXCL_LINE 6: double check, f_cappname, f_cmempath and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ } else {
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ // release file
+ if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ l_estatus = m_mPersist_Type[f_epersisttype]->Release(f_cappname,
+ f_ctag,
+ f_cmempath,
+ enotificationpersistentservicereleasetype,
+ f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceLoad
+/// Load file/folder from persistent memory to the specified location.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceLoad(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_cappname.empty() || f_ctag.empty() || f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cretrievepath, f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Appname, tag & retrieve path should not be empty."); // LCOV_EXCL_LINE 6: double check, f_cretrievepath, f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ } else {
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ // load file
+ l_estatus = m_mPersist_Type[f_epersisttype]->Load(f_cappname, f_ctag, f_cretrievepath, f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AckReceivedFromWorker
+/// Send release ack to file/folder persistence object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, ENotificationpersistentservicePersistType f_epersisttype,
+ BOOL f_bcopystatus, ENPS_Loadtype f_eloadtype) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if ((NULL == f_csource) || (NULL == f_ctag)) { // LCOV_EXCL_BR_LINE 6: f_csource and f_ctag can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_csource or f_ctag is NULL."); // LCOV_EXCL_LINE 6: f_csource and f_ctag can't be NULL // NOLINT[whitespace/line_length]
+ } else {
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ if (NULL != m_mPersist_Type[f_epersisttype]) {
+ // Send release ack to file/folder persistence object.
+ l_estatus = m_mPersist_Type[f_epersisttype]->AckReceivedFromWorker(f_csource, f_ctag,
+ f_bcopystatus, f_eloadtype);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype);
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSaveNotificationData
+/// Save notification data in a persistent file.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceSaveNotificationData(Persistent_Notification_List_Type
+ *f_vpersistentnotificationlist) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if ((NULL == m_poDataAccesser) || (NULL == f_vpersistentnotificationlist)) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_poDataAccesser or f_vpersistentnotificationlist is NULL."); // LCOV_EXCL_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
+ } else {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_cNotificationFilePath = "";
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += NOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedPersistedStateVar,
+ eFrameworkunifiedUserData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += FACTORYNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedPersistedStateVar,
+ eFrameworkunifiedFactoryData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += FACTORYCUSTOMERNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedPersistedStateVar,
+ eFrameworkunifiedFactoryCustomerData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += DEALERNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedPersistedStateVar,
+ eFrameworkunifiedDealerData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSaveUserNotificationData
+/// Save user notification data in a persistent file.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceSaveUserNotificationData(Persistent_Notification_List_Type
+ *f_vpersistentnotificationlist) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if ((NULL == m_poDataAccesser) || (NULL == f_vpersistentnotificationlist)) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_poDataAccesser or f_vpersistentnotificationlist is NULL."); // LCOV_EXCL_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
+ } else {
+ l_estatus = m_poDataAccesser->PersistData(m_cNotificationUserMemFilepath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedPersistedStateUserVar); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceReadNotificationData
+/// Get the list of all persistent notifications from a persistent memory and store it in a map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceReadNotificationData(Persistent_Notification_List_Type
+ * &f_vpersistentnotificationlist) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_poDataAccesser) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser would not be null
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_cNotificationFilePath = "";
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += NOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedUserData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += FACTORYNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedFactoryData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += FACTORYCUSTOMERNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedFactoryCustomerData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += DEALERNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedDealerData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceReadUserNotificationData
+/// Get the list of all user persistent notifications from a persistent memory and store it in a map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceReadUserNotificationData(Persistent_Notification_List_Type
+ * &f_vpersistentnotificationlist) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_poDataAccesser) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser would not be null
+ l_estatus = m_poDataAccesser->RetrieveData(m_cNotificationUserMemFilepath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedUserData); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// PersistAllReleaseRequests
+/// Persist all released files and folder contained in the map in persistent memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+
+ // Persist all i.e files and folders
+ while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
+ if (NULL != m_mPersist_Type[l_ePersistType]) {
+ if (eFrameworkunifiedStatusFail == m_mPersist_Type[l_ePersistType]->PersistAllReleaseRequests(f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentservicePersistAllUserRequests
+/// Persist all user files and folder contained in the map in persistent memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentservicePersistAllUserRequests() {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+
+ // Persist all i.e files and folders
+ while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
+ if (NULL != m_mPersist_Type[l_ePersistType]) {
+ l_estatus = m_mPersist_Type[l_ePersistType]->PersistAllUserRequests();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType);
+ }
+
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReadThreadHandle
+/// Pass the handle of the read thread to the object of file/folder persistence
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetReadThreadHandle(HANDLE f_hreadthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_hreadthread != NULL) { // LCOV_EXCL_BR_LINE 6: f_hreadthread would not be null
+ // Set thread handle for object persistfile objects. i.e. for file/folder
+ for (Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
+ l_itPersist_Type != m_mPersist_Type.end();
+ ++l_itPersist_Type) {
+ if (NULL != (*l_itPersist_Type).second) { // LCOV_EXCL_BR_LINE 6: (*l_itPersist_Type).second can't be NULL
+ (*l_itPersist_Type).second->SetReadThreadHandle(f_hreadthread);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetWriteThreadHandle
+/// Pass the handle of the write thread to the object of file/folder persistence
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetWriteThreadHandle(HANDLE f_hwritethread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_hwritethread) { // LCOV_EXCL_BR_LINE 6: f_hwritethread would not be null
+ // Set thread handle for object persist objects. i.e. for file/folder
+ for (Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
+ l_itPersist_Type != m_mPersist_Type.end();
+ ++l_itPersist_Type) {
+ if (NULL != (*l_itPersist_Type).second) { // LCOV_EXCL_BR_LINE 6: (*l_itPersist_Type).second can't be NULL
+ (*l_itPersist_Type).second->SetWriteThreadHandle(f_hwritethread);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetWriteThreadHandle
+/// Pass the handle of the write thread to the object of file/folder persistence
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetNorPersistenceThreadHandle(HANDLE f_hwritethread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_hwritethread) { // LCOV_EXCL_BR_LINE 6: f_hwritethread would not be null
+ m_hNSImmediatePersistenceThread = f_hwritethread;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPServiceOnCpWorkerAckCmd
+/// Handles when the CopyWorker sends an ack back for a message received .
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPServiceOnCpWorkerAckCmd(HANDLE f_happ) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ NSP_CopyAckMsg l_tack = {};
+ if (f_happ) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(f_happ, (PVOID)&l_tack, sizeof(NSP_CopyAckMsg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length] // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "CP_WRK_ACK_CMD_COMPLETE for cmd 0x%X", l_tack.m_eworkerprotocol); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to get message data in NPServiceOnCpWorkerAckCmd, status : 0x%x", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetUserPersistentPath
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetUserPersistentPath(std::string f_cusername) {
+ m_cNotificationUserMemFilepath = CPersistence::GetStoragePath();
+ m_cNotificationUserMemFilepath += AppName;
+ m_cNotificationUserMemFilepath += "/";
+ m_cNotificationUserMemFilepath += f_cusername;
+ m_cNotificationUserMemFilepath += "/";
+ m_cNotificationUserMemFilepath += m_cUserNotificationTag;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsUserPersistence
+/// Check if tag is user persistence
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CPersistenceManager::IsUserPersistence(std::string f_ctag, ENotificationpersistentservicePersistType f_epersisttype) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ BOOL l_bUserPersistence = FALSE;
+
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
+ // load file
+ l_bUserPersistence = m_mPersist_Type[f_epersisttype]->IsUserPersistence(f_ctag); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT[whitespace/line_length]
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bUserPersistence;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// HaveAllReleaseRequestsPersisted
+/// Check if all release requests processed or not
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CPersistenceManager::HaveAllReleaseRequestsPersisted() {
+ BOOL l_bRetVal = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // check if all files are persisted
+ if (FALSE == m_bAllFilePersisted) {
+ ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+
+ std::string l_cTagNotReleased = "";
+ std::string l_cTagList = ""; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ // Persist all i.e files and folders
+ while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
+ if (NULL != m_mPersist_Type[l_ePersistType]) {
+ l_cTagNotReleased.assign(""); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // if(eFrameworkunifiedStatusFail == m_mPersist_Type[l_ePersistType]->PersistAllReleaseRequests())
+ if (FALSE == m_mPersist_Type[l_ePersistType]->HaveAllReleaseRequestsPersisted(l_cTagNotReleased)) {
+ l_bRetVal = FALSE;
+ l_cTagList.append(l_cTagNotReleased);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+ }
+
+ if (0 != l_cTagList.size()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Tags not released:: %s", l_cTagList.c_str());
+ }
+ }
+
+ if (TRUE == l_bRetVal) {
+ m_bAllFilePersisted = TRUE;
+
+ // if all files are persisted set the return value to the status of immediate data persistency
+ l_bRetVal = m_bImmediatedDataPersisted;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bRetVal;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetPersistFlag
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::ResetPersistFlag() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+
+ // Persist all i.e files and folders
+ while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
+ if (NULL != m_mPersist_Type[l_ePersistType]) {
+ m_mPersist_Type[l_ePersistType]->ResetPersistFlag();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+ }
+
+ m_bAllFilePersisted = FALSE;
+
+ m_bImmediatedDataPersisted = FALSE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceReadNorNotificationData
+/// Get the list of all user persistent notifications from a persistent memory and store it in a map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceReadNorNotificationData(Persistent_Notification_List_Type
+ * &f_vpersistentnotificationlist) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedUserData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate User data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedFactoryData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate Factory data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedFactoryCustomerData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate Factory Customer data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedDealerData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate Dealer data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearPersistenceData
+/// Deletes the data from the persistent memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::ClearPersistenceData(const EFrameworkunifiedClearPersistence &f_enotificationpersistentserviceclearpersistencescope) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // persistence memory path to be cleared
+ std::string l_cPath = "";
+
+ switch (f_enotificationpersistentserviceclearpersistencescope) { // LCOV_EXCL_BR_LINE 6: f_enotificationpersistentserviceclearpersistencescope must be eFrameworkunifiedClearAllData, eFrameworkunifiedClearAllApplicationData, eFrameworkunifiedClearAllNotificationData, eFrameworkunifiedClearCurrentUserData, eFrameworkunifiedClearCurrentUserApplicationData, eFrameworkunifiedClearCurrentUserNotificationData. // NOLINT[whitespace/line_length]
+ case eFrameworkunifiedClearAllData: {
+ // clears all the data from the persistent memory
+ l_cPath.append(CPersistence::GetStoragePath());
+ }
+ break;
+
+ case eFrameworkunifiedClearAllApplicationData: {
+ // TODO(my_username): clears all the application folder in persistence memory
+ // don't delete the NS_NPS folder
+ }
+ break;
+
+ case eFrameworkunifiedClearAllNotificationData: {
+ // TODO(my_username): deletes the NS_NPS folder
+ }
+ break;
+
+ case eFrameworkunifiedClearCurrentUserData: {
+ // TODO(my_username): deletes the user folder from all the application folder in persisted memory
+ // as well as from the NS_NPS folder
+ }
+ break;
+
+ case eFrameworkunifiedClearCurrentUserApplicationData: {
+ // TODO(my_username): deletes the user folder from all the application folder
+ }
+ break;
+
+ case eFrameworkunifiedClearCurrentUserNotificationData: {
+ // TODO(my_username): deletes the user folder from the NS_NPS folder
+ }
+ break;
+
+ default: {
+ // LCOV_EXCL_START 6: f_enotificationpersistentserviceclearpersistencescope must be eFrameworkunifiedClearAllData, eFrameworkunifiedClearAllApplicationData, eFrameworkunifiedClearAllNotificationData, eFrameworkunifiedClearCurrentUserData, eFrameworkunifiedClearCurrentUserApplicationData, eFrameworkunifiedClearCurrentUserNotificationData. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid _EFrameworkunifiedClearPersistence Parameter:: %d", f_enotificationpersistentserviceclearpersistencescope);
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+ break;
+ }
+
+ if (0 != l_cPath.size()) {
+ if (CFSDirectory::DoesDirecotryExist(l_cPath)) {
+ if (TRUE == CFSDirectory::RemoveDirectory(l_cPath)) { // LCOV_EXCL_BR_LINE 6: RemoveDirectory always return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete persistent directory successful : %s", l_cPath.c_str());
+ } else {
+ // LCOV_EXCL_START 6: RemoveDirectory always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete persistent directory unsuccessful : %s", l_cPath.c_str());
+ l_estatus = eFrameworkunifiedStatusErrOther;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusErrOther;
+ }
+
+ // delete NOR data
+ l_cPath.clear();
+ l_cPath.append(IMMEDIATE_PERSISTENCE_STORAGE_V2);
+ if (0 != l_cPath.size()) { // LCOV_EXCL_BR_LINE 6: l_cPath.size can't be 0
+ if (CFSDirectory::DoesDirecotryExist(l_cPath)) {
+ if (TRUE == CFSDirectory::RemoveDirectory(l_cPath)) { // LCOV_EXCL_BR_LINE 6: RemoveDirectory always return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete nor persistent directory successful : %s", l_cPath.c_str());
+ } else {
+ // LCOV_EXCL_START 6: RemoveDirectory always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete nor persistent directory unsuccessful : %s", l_cPath.c_str());
+ l_estatus = eFrameworkunifiedStatusErrOther;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusErrOther; // LCOV_EXCL_LINE 6: l_cPath.size can't be 0
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSetPersistentCategory
+/// Sets the persist type of file or folder.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceSetPersistentCategory(std::string f_crequestorname,
+ std::string f_ctag,
+ EFrameworkunifiedPersistCategory f_epersistcategory,
+ ENotificationpersistentservicePersistType f_epersisttype) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_ctag.size can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Tag name is empty."); // LCOV_EXCL_LINE 6: double check, f_ctag.size can't be empty
+ } else {
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
+ // set the persist type
+ l_estatus = m_mPersist_Type[f_epersisttype]->SetPersistentCategory(f_crequestorname,
+ f_ctag,
+ f_epersistcategory);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// PersistNORData
+/// Sends the message to Immediate Persistence Thread to Persists the data immediately or reset
+/// the NOR data depending on persist category flag during shutdown irrespective of delay.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::PersistNORData(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ TImmediateShutdown l_tImmShutdown = {};
+ l_tImmShutdown.f_eshutdowntype = f_eshutdowntype;
+ l_tImmShutdown.f_uinotificationpersistentservicepersistcategoryflag = f_uinotificationpersistentservicepersistcategoryflag;
+
+ // send the message to NOR to persist or reset the data during shutdown
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_ONSHUTDOWN, sizeof(l_tImmShutdown), &l_tImmShutdown))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for cmd 0x%X failed", NOR_PERSISTENCE_ONSHUTDOWN); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetImmediateDataPersistedStatus
+/// Set/Reset the persistence status of immediate persistence data
+///////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetImmediateDataPersistedStatus(BOOL f_bstatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_bImmediatedDataPersisted = f_bstatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetFilePersistedStatus
+/// Set/Reset the persistence status of files and folders
+///////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetFilePersistedStatus(BOOL f_bstatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_bAllFilePersisted = f_bstatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ReadImmediateNotificationData
+/// Get the list of all immediate persistent notifications of f_epersistcategory from a
+/// persistent memory and store it in a map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::ReadImmediateNotificationData(Persistent_Notification_List_Type
+ * &f_vpersistentnotificationlist,
+ const EFrameworkunifiedPersistCategory f_epersistcategory) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string l_pcPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+ std::string l_cNotificationName = ""; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // stores the list of invalid immediate notification files at persistent location
+ std::string l_cInvalidFileList = ""; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ PCSTR l_pPublisherName = NULL;
+ PSTR l_pData = NULL;
+ UI_32 l_uiDataSize = 0;
+
+ NC_NorPersistentData l_ptNorPersistentData = {};
+
+ TFileList l_pTFileList;
+
+ if ('/' != l_pcPath[l_pcPath.length() - 1]) { // LCOV_EXCL_BR_LINE 6: the last char is always '/'
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_pcPath.append("/"); // LCOV_EXCL_LINE 6: the last char is always '/'
+ }
+
+ switch (f_epersistcategory) {
+ case eFrameworkunifiedFactoryData: {
+ l_pcPath.append(FACTORYDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ break;
+
+ case eFrameworkunifiedFactoryCustomerData: {
+ l_pcPath.append(FACTORYCUSTOMERDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ break;
+
+ case eFrameworkunifiedDealerData: {
+ l_pcPath.append(DEALERDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ break;
+
+ case eFrameworkunifiedUserData:
+ default: {
+ l_pcPath.append(USERDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ l_pcPath.append(ALLUSERAPPDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ break;
+ }
+
+ l_pcPath.append(IMMEDIATEDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ if (eFrameworkunifiedStatusOK == GetFileList(&l_pTFileList, l_pcPath.c_str())) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ if (!l_pTFileList.empty()) { // LCOV_EXCL_BR_LINE 200: if GetFileList() returns eFrameworkunifiedStatusOK, l_pTFileList can't be empty // NOLINT[whitespace/line_length]
+ for (UI_32 l_uiCount = 0; l_uiCount < l_pTFileList.size(); l_uiCount++) {
+ l_uiDataSize = 0;
+
+ // get the persistent notification name from vector
+ l_cNotificationName = l_pTFileList.at(l_uiCount);
+
+ if (eFrameworkunifiedStatusOK == NPSynchronousGetPersistentDataSize(l_cNotificationName.c_str(), &l_uiDataSize, // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ f_epersistcategory) && (0 != l_uiDataSize)) {
+ l_pData = new(std::nothrow) CHAR[l_uiDataSize];
+ std::memset(l_pData, 0, l_uiDataSize);
+
+ if (NULL != l_pData) { // LCOV_EXCL_BR_LINE 6: l_pData can't be null
+ l_pPublisherName = NULL;
+
+ // clear the memory
+ std::memset(&l_ptNorPersistentData, 0, sizeof(NC_NorPersistentData));
+
+ // As NS_NPP does a recursive filename read from directory it has the complete filename.
+ // So it does not require to pass the Publisher name i.e. l_pPublisherName.So it is being passed as NULL.
+ if (eFrameworkunifiedStatusOK == NPSynchronousGetPersistentData(l_pPublisherName, // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ l_cNotificationName.c_str(),
+ (PVOID)l_pData,
+ l_uiDataSize,
+ l_ptNorPersistentData,
+ f_epersistcategory)) {
+ CNotificationsToPersist *l_objCNotificationsToPersist = new(std::nothrow) CNotificationsToPersist();
+ if (NULL != l_objCNotificationsToPersist) { // LCOV_EXCL_BR_LINE 6: l_objCNotificationsToPersist can't be null // NOLINT[whitespace/line_length]
+ CPersistentData *l_objCPersistentData = new(std::nothrow) CPersistentData();
+
+ // fill the appropriate values in l_objCNotificationsToPersist
+ if (NULL != l_objCPersistentData) { // LCOV_EXCL_BR_LINE 6: l_objCPersistentData can't be null
+ l_objCPersistentData->m_pMessage = new(std::nothrow) CHAR[l_ptNorPersistentData.dataSize];
+ std::memset(l_objCPersistentData->m_pMessage, 0, l_ptNorPersistentData.dataSize);
+
+ if (NULL != l_objCPersistentData->m_pMessage) { // LCOV_EXCL_BR_LINE 6: l_objCPersistentData->m_pMessage can't be null // NOLINT[whitespace/line_length]
+ std::memcpy(l_objCPersistentData->m_pMessage, l_pData, l_ptNorPersistentData.dataSize);
+
+ l_objCNotificationsToPersist->m_uiMaxMsgLength = l_ptNorPersistentData.uiMaxSize;
+ l_objCPersistentData->m_uiMsgSize = l_ptNorPersistentData.dataSize;
+ l_objCNotificationsToPersist->m_ePersistentType = eFrameworkunifiedImmediatePersistedStateVar;
+
+ l_objCNotificationsToPersist->m_cNotificationName = l_ptNorPersistentData.notificationName;
+ l_objCNotificationsToPersist->m_cPublisherName = l_ptNorPersistentData.pPublisherName;
+ l_objCNotificationsToPersist->m_uiDelay = l_ptNorPersistentData.uiDelay;
+
+ l_objCNotificationsToPersist->m_pPersistentData = l_objCPersistentData;
+
+ l_objCNotificationsToPersist->m_ePersistCategory = f_epersistcategory;
+
+ f_vpersistentnotificationlist->push_back(l_objCNotificationsToPersist);
+ } else {
+ // LCOV_EXCL_START 6: l_objCPersistentData->m_pMessage can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Memory allocation error for notification data of size %d",
+ l_ptNorPersistentData.dataSize);
+
+ if (NULL != l_objCNotificationsToPersist) {
+ delete l_objCNotificationsToPersist;
+ l_objCNotificationsToPersist = NULL;
+ }
+
+ if (NULL != l_objCPersistentData) {
+ delete l_objCPersistentData;
+ l_objCPersistentData = NULL;
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_objCPersistentData can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Memory allocation error for CPersistentData object");
+
+ if (NULL != l_objCNotificationsToPersist) {
+ delete l_objCNotificationsToPersist;
+ l_objCNotificationsToPersist = NULL;
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Memory allocation error for CNotificationsToPersist object"); // LCOV_EXCL_LINE 6: l_objCNotificationsToPersist can't be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_cInvalidFileList.append(l_cNotificationName);
+ l_cInvalidFileList.append(",");
+ // LCOV_EXCL_STOP
+ }
+
+ delete[] l_pData;
+ l_pData = NULL;
+ } else {
+ // LCOV_EXCL_START 6: l_pData can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Persistent data received as NULL from immediate notification file :: %s",
+ l_cNotificationName.c_str());
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_cInvalidFileList.append(l_cNotificationName);
+ l_cInvalidFileList.append(",");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (0 != l_cInvalidFileList.size()) { // LCOV_EXCL_START 200: l_cInvalidFileList's size must be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Unable to get persistent data for following immediate notification files :: %s",
+ l_cInvalidFileList.c_str());
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "No Immediate persistence data available at :: %s", l_pcPath.c_str()); // LCOV_EXCL_LINE 200: if GetFileList() returns eFrameworkunifiedStatusOK, l_pTFileList can't be empty // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to get the list of files from Immediate persistent location :: %s",
+ l_pcPath.c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+EFrameworkunifiedStatus CPersistenceManager::GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ f_cpersistenceprofileinfo.append("Application Name,");
+ f_cpersistenceprofileinfo.append("Tag Name,");
+ f_cpersistenceprofileinfo.append("Type,");
+ f_cpersistenceprofileinfo.append("UserSpecific,");
+ f_cpersistenceprofileinfo.append("Released,");
+ f_cpersistenceprofileinfo.append("Persisted");
+
+ CPersistence *l_pPersistence = m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE];
+ l_pPersistence->GetPersistenceProfilingData(f_cpersistenceprofileinfo);
+
+ l_pPersistence = m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER];
+ l_pPersistence->GetPersistenceProfilingData(f_cpersistenceprofileinfo);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+#endif
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp
new file mode 100755
index 0000000..8a9127e
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CPersistentData.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include "ns_npp_persistent_data.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CPersistentData
+/// Constructor of CPersistentData class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistentData::CPersistentData() {
+ m_pMessage = NULL;
+ m_uiMsgSize = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CPersistentData
+/// Destructor of CPersistentData class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistentData::~CPersistentData() {
+ if (NULL != m_pMessage) {
+ delete[](static_cast<PCHAR>(m_pMessage)); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ m_pMessage = NULL;
+ }
+}
+
+
+
+
+
+
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp
new file mode 100755
index 0000000..4371465
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp
@@ -0,0 +1,181 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CnotificationpersistentservicePersonalizationManager.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <utility>
+#include <string>
+#ifdef AGL_STUB
+#include "ns_npp_personalization_manager.h"
+#else
+#include "ns_npp_Personalization_manager.h"
+#endif
+#include "ns_npp_notificationpersistentservicelog.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CnotificationpersistentservicePersonalizationManager
+/// Constructor of CnotificationpersistentservicePersonalizationManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CnotificationpersistentservicePersonalizationManager::CnotificationpersistentservicePersonalizationManager() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_uiUserId = 0;
+
+ m_cCurrentPersonality.clear();
+
+ m_pmPersonality = new(std::nothrow) Personality_Type(); // LCOV_EXCL_BR_LINE 11: except,C++ STL
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CnotificationpersistentservicePersonalizationManager
+/// Destructor of CnotificationpersistentservicePersonalizationManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CnotificationpersistentservicePersonalizationManager::~CnotificationpersistentservicePersonalizationManager() { // LCOV_EXCL_START 14: Resident process, global instance not released // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pmPersonality) {
+ m_pmPersonality->clear();
+
+ delete m_pmPersonality;
+ m_pmPersonality = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceGetPersonality
+/// This function is used to get the current personality.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CnotificationpersistentservicePersonalizationManager::NotificationpersistentserviceGetPersonality(std::string &f_cpersonalityname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ f_cpersonalityname = m_cCurrentPersonality;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSetPersonality
+/// This function is used to set the new personality.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CnotificationpersistentservicePersonalizationManager::NotificationpersistentserviceSetPersonality(const std::string f_cpersonalityname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator to find personality name from map of personality
+ Personality_Type::iterator l_itPersonality;
+
+ if (!f_cpersonalityname.empty()) {
+ if (NULL != m_pmPersonality) { // LCOV_EXCL_BR_LINE 6: double check, m_pmPersonality can't be NULL
+ l_itPersonality = m_pmPersonality->find(f_cpersonalityname);
+
+ // if personality found in map
+ if (m_pmPersonality->end() != l_itPersonality) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality found in map");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality not found in map");
+
+ l_estatus = CreatePersonality(f_cpersonalityname);
+ }
+
+ m_cCurrentPersonality = f_cpersonalityname;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map object is NULL"); // LCOV_EXCL_LINE 6: m_pmPersonality can't be NULL
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreatePersonality
+/// This function is used to create new Personality.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CnotificationpersistentservicePersonalizationManager::CreatePersonality(const std::string &f_cpersonalityname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pmPersonality) { // LCOV_EXCL_BR_LINE 6: m_pmPersonality can't be NULL
+ CNotificationpersistentservicePersonality *l_pPersonality = new(std::nothrow) CNotificationpersistentservicePersonality(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ if (NULL != l_pPersonality) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ l_pPersonality->m_uiUserId = ++m_uiUserId;
+ l_pPersonality->m_cUserName = f_cpersonalityname;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Inserting new personality in map"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ m_pmPersonality->insert(make_pair(f_cpersonalityname, l_pPersonality));
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map object is NULL"); // LCOV_EXCL_LINE 6: m_pmPersonality can't be NULL
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceIsValidPersonality
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CnotificationpersistentservicePersonalizationManager::NotificationpersistentserviceIsValidPersonality(const std::string f_cpersonalityname) {
+ BOOL l_bReturnValue = FALSE;
+ // iterator to find personality name from map of personality
+ Personality_Type::iterator l_itPersonality;
+ if (NULL != m_pmPersonality) { // LCOV_EXCL_BR_LINE 6: m_pmPersonality can't be NULL
+ l_itPersonality = m_pmPersonality->find(f_cpersonalityname);
+
+ // if personality found in map
+ if (m_pmPersonality->end() != l_itPersonality) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality found in map");
+ l_bReturnValue = TRUE;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality not found in map");
+ }
+ } else {
+ // LCOV_EXCL_START 6: m_pmPersonality can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map object is NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ return l_bReturnValue;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp
new file mode 100755
index 0000000..dc74580
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp
@@ -0,0 +1,333 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CRegistryEntry class.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_registry_entry.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Constructor
+////////////////////////////////////////////////////////////////////////////////////////////
+CRegistryEntry::CRegistryEntry(const std::string &f_ctag, const std::string &f_crequester,
+ const std::string &f_cstoragepath,
+ const BOOL f_bisuserpersistence):
+ m_eJobState(ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE),
+ m_cTag(f_ctag),
+ m_cRequestor(f_crequester),
+ m_bIsReleased(FALSE),
+ m_bIsPersisted(FALSE),
+ m_bIsUserPersistence(f_bisuserpersistence),
+ m_eCurrentAction(LOADTYPE_NONE),
+ m_ePersistType(ENOTIFICATIONPERSISTENTSERVICEPERSISTNONE),
+ m_ePersistCategory(eFrameworkunifiedUserData) {
+ m_cBasePath.clear();
+
+ // set base path.
+ m_cBasePath += f_cstoragepath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Copy Constructor
+////////////////////////////////////////////////////////////////////////////////////////////
+CRegistryEntry::CRegistryEntry(const CRegistryEntry &in):
+ m_eJobState(ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE),
+ m_cTag(in.m_cTag),
+ m_cRequestor(in.m_cRequestor),
+ m_bIsReleased(in.m_bIsReleased),
+ m_bIsPersisted(in.m_bIsPersisted),
+ m_cPersistPath(in.m_cPersistPath),
+ m_cBasePath(in.m_cBasePath),
+ m_bIsUserPersistence(in.m_bIsUserPersistence),
+ m_eCurrentAction(in.m_eCurrentAction),
+ m_ePersistType(in.m_ePersistType),
+ m_ePersistCategory(in.m_ePersistCategory) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Operator overload
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+CRegistryEntry &CRegistryEntry::operator=(const CRegistryEntry &in) { // LCOV_EXCL_START 8: never be used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (this != &in) {
+ m_eJobState = in.m_eJobState;
+ m_cTag = in.m_cTag;
+ m_cRequestor = in.m_cRequestor;
+ m_bIsReleased = in.m_bIsReleased;
+ m_bIsPersisted = in.m_bIsPersisted;
+ m_cPersistPath = in.m_cPersistPath;
+ m_cBasePath = in.m_cBasePath;
+ m_bIsUserPersistence = in.m_bIsUserPersistence;
+ m_ePersistType = in.m_ePersistType;
+ }
+ return *this;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReleasePath
+/// Set release path.
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CRegistryEntry::SetReleasePath(const std::string &f_creleasepath) {
+ m_bIsReleased = TRUE;
+ m_cReleasePath = f_creleasepath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetBeingPersisted
+/// Set the file/folder is being persisted.
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CRegistryEntry::SetBeingPersisted() {
+ if (LOADTYPE_RELEASE == m_eCurrentAction) {
+ m_bIsPersisted = TRUE;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsReleased
+/// File/folder released or not.
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CRegistryEntry::IsReleased() const {
+ return m_bIsReleased;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// HasntBeenPersisted
+/// File/Folder persisted or not
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CRegistryEntry::HasntBeenPersisted() const {
+ return !m_bIsPersisted;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsPersisted
+/// File persisted or not
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CRegistryEntry::IsPersisted() const {
+ return m_bIsPersisted;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistPath
+/// Get the persist path.
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string CRegistryEntry::GetPersistPath() const {
+ return m_cPersistPath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetReleasePath
+/// Get the release path.
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string CRegistryEntry::GetReleasePath() const {
+ return m_cReleasePath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetLoadPath
+/// Get the load path.
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string CRegistryEntry::GetLoadPath(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) const {
+ std::string l_cLoadPath = "";
+
+ if (f_epersisttype > ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST && f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be in range. // NOLINT[whitespace/line_length]
+ l_cLoadPath = m_cBasePath;
+
+ switch (m_ePersistCategory) {
+ case eFrameworkunifiedUserData: {
+ l_cLoadPath += USERDATADIR;
+
+ // Check if to persist for user
+ if (m_bIsUserPersistence) {
+ // if its a user file, user name can't be empty
+ if (!f_cusername.empty()) { // LCOV_EXCL_BR_LINE 6: f_cusername can't be empty
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Tag %s is registered for user %s", m_cTag.c_str(), f_cusername.c_str());
+ l_cLoadPath += f_cusername;
+ l_cLoadPath += "/";
+ }
+ } else {
+ l_cLoadPath += ALLUSERAPPDATADIR;
+ }
+
+ break;
+ }
+ case eFrameworkunifiedFactoryData: {
+ l_cLoadPath += FACTORYDATADIR;
+ break;
+ }
+ case eFrameworkunifiedFactoryCustomerData: {
+ l_cLoadPath += FACTORYCUSTOMERDATADIR;
+ break;
+ }
+ case eFrameworkunifiedDealerData: {
+ l_cLoadPath += DEALERDATADIR;
+ break;
+ }
+ }
+
+ l_cLoadPath += m_cRequestor;
+ l_cLoadPath += "/";
+
+ // file and folder persistency has different storage paths mapped
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == f_epersisttype) {
+ l_cLoadPath += "NSFile/";
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == f_epersisttype) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE or ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER. // NOLINT[whitespace/line_length]
+ l_cLoadPath += "NSFolder/";
+ }
+
+ l_cLoadPath += m_cTag;
+ }
+
+ return l_cLoadPath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequester
+/// Get the name of requester.
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string CRegistryEntry::GetRequester() const {
+ return m_cRequestor;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetTag
+/// Get the tag.
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string CRegistryEntry::GetTag() const {
+ return m_cTag;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsUserPersistence
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CRegistryEntry::IsUserPersistence() {
+ return m_bIsUserPersistence;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetCurrentAction
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CRegistryEntry::SetCurrentAction(ENPS_Loadtype f_ecurrentaction) {
+ m_eCurrentAction = f_ecurrentaction;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetPersistedFlag
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CRegistryEntry::ResetPersistedFlag() {
+ m_bIsPersisted = FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistProperties
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CRegistryEntry::SetPersistProperties(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) {
+ if (f_epersisttype > ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST && f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be in range. // NOLINT[whitespace/line_length]
+ // set the persist type
+ m_ePersistType = f_epersisttype;
+
+ // set the persist file based on the persist type and username (if a user file)
+ m_cPersistPath = m_cBasePath;
+
+ switch (m_ePersistCategory) {
+ case eFrameworkunifiedUserData: {
+ m_cPersistPath += USERDATADIR;
+
+ // Check if to persist for user
+ if (m_bIsUserPersistence) {
+ // if its a user file, user name can't be empty
+ if (!f_cusername.empty()) { // LCOV_EXCL_BR_LINE 6: f_cusername can't be empty
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Tag %s is registered for user %s", m_cTag.c_str(), f_cusername.c_str());
+ m_cPersistPath += f_cusername;
+ m_cPersistPath += "/";
+ }
+ } else {
+ m_cPersistPath += ALLUSERAPPDATADIR;
+ }
+
+ break;
+ }
+ case eFrameworkunifiedFactoryData: {
+ m_cPersistPath += FACTORYDATADIR;
+ break;
+ }
+ case eFrameworkunifiedFactoryCustomerData: {
+ m_cPersistPath += FACTORYCUSTOMERDATADIR;
+ break;
+ }
+ case eFrameworkunifiedDealerData: {
+ m_cPersistPath += DEALERDATADIR;
+ break;
+ }
+ }
+
+ m_cPersistPath += m_cRequestor;
+ m_cPersistPath += "/";
+
+ // file and folder persistency has different storage paths mapped
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == f_epersisttype) {
+ m_cPersistPath += "NSFile/";
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == f_epersisttype) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE or ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER. // NOLINT[whitespace/line_length]
+ m_cPersistPath += "NSFolder/";
+ }
+
+ m_cPersistPath += m_cTag;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistType
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+ENotificationpersistentservicePersistType CRegistryEntry::GetPersistType() const {
+ return m_ePersistType;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistentCategory
+/// Sets the persistent type related to tag
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CRegistryEntry::SetPersistentCategory(EFrameworkunifiedPersistCategory f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ m_ePersistCategory = f_epersistcategory;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistentCategory
+/// Gets the persistent type of a tag
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedPersistCategory CRegistryEntry::GetPersistentCategory() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_ePersistCategory;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp
new file mode 100755
index 0000000..6d75091
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp
@@ -0,0 +1,158 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CRegularNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <mqueue.h>
+#include <iostream>
+#include <string>
+#include <native_service/ns_mc_system_info.h>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_regular_notification.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CRegularNotification
+/// Constructor of CRegularNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CRegularNotification::CRegularNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize):
+ CNotification(f_cnotificationname, f_uimaxmsgsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistentType = eFrameworkunifiedNotificationVar;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CRegularNotification
+/// Destructor of CRegularNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CRegularNotification::~CRegularNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddEventReciever
+/// This function adds the name of the application to receiver list of particular notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CRegularNotification::AddEventReciever(const std::string &f_csubscribername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_csubscribername can't be empty
+ l_estatus = AddReceiverInMap(f_csubscribername);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_csubscribername can't be empty
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Publish
+/// This function publishes the notification to subscribed clients.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CRegularNotification::Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Message Queue Handle
+ HANDLE l_hMsgQHandle = NULL;
+
+ // Pointer to class CNotificationReceiver
+ CNotificationReceiver *l_pNotificationReceiver = NULL;
+
+ // Iterator for Notification Receiver map
+ NotifReceiver_Iterator_Type l_itrNotifReceiver;
+
+ if (m_uiMaxMsgSize >= f_uimsgsize) {
+ if (0 == m_cServiceName.compare(f_cservicename)) {
+ for (l_itrNotifReceiver = m_pmSubscribersList->begin();
+ l_itrNotifReceiver != m_pmSubscribersList->end();
+ l_itrNotifReceiver++) {
+ l_pNotificationReceiver = l_itrNotifReceiver->second;
+
+ if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: l_pNotificationReceiver can't be NULL
+ l_hMsgQHandle = l_pNotificationReceiver->m_MsgQHandle;
+
+ if (NULL != l_hMsgQHandle) { // LCOV_EXCL_BR_LINE 6: l_hMsgQHandle can't be NULL
+ if (eFrameworkunifiedStatusOK != (l_estatus = PublishData(l_hMsgQHandle, f_pmessage, f_uimsgsize))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error Publishing notification %s to %s published by %s, error status: 0x%x",
+ m_cNotificationName.c_str(), l_itrNotifReceiver->first.c_str(), f_cservicename.c_str(), l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_hMsgQHandle can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationReceiver can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationReceiver is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't publish notification %s. Registered by %s and published by %s.",
+ m_cNotificationName.c_str(), m_cServiceName.c_str(), f_cservicename.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h"
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't publish notification %s. Message data size (%d) is greater than maximum registered data size (%d)",
+ m_cNotificationName.c_str(), f_uimsgsize, m_uiMaxMsgSize);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp
new file mode 100755
index 0000000..7898f38
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp
@@ -0,0 +1,305 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CStateNorPersistenceNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <errno.h>
+#include <native_service/ns_message_center_if.h>
+#include <string>
+#include <iostream>
+
+#include "ns_npp_types.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_state_nor_persistence_notification.h"
+
+HANDLE CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread = NULL;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CStateNorPersistenceNotification
+/// Constructor of CStateNorPersistenceNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStateNorPersistenceNotification::CStateNorPersistenceNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize,
+ const UI_32 f_uidelay,
+ const EFrameworkunifiedPersistCategory f_epersistcategory):
+ CStateNotification(f_cnotificationname, f_uimaxmsgsize),
+ m_uiDelay(f_uidelay),
+ m_ePersistCategory(f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistentType = eFrameworkunifiedImmediatePersistedStateVar;
+
+ // also, register the notification with worker thread responsible for writing notification data
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
+ TImmediatePersistenceRegisterNotifInfo l_tRegisterNotifInfo = {};
+ std::strncpy(l_tRegisterNotifInfo.m_cnotificationname,
+ f_cnotificationname.c_str(),
+ sizeof(l_tRegisterNotifInfo.m_cnotificationname) - 1);
+ l_tRegisterNotifInfo.m_uidelay = f_uidelay;
+ l_tRegisterNotifInfo.m_epersistcategory = f_epersistcategory;
+
+ if (eFrameworkunifiedStatusOK != McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_REGISTER, sizeof(l_tRegisterNotifInfo), &l_tRegisterNotifInfo)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for cmd 0x%X failed", NOR_PERSISTENCE_REGISTER); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CStateNorPersistenceNotification
+/// Constructor of CStateNorPersistenceNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStateNorPersistenceNotification::~CStateNorPersistenceNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // also, unregister the notification with worker thread responsible for writing notification data
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
+ TImmediatePersistenceUnregisterNotifInfo l_tUnregisterNotifInfo = {};
+ std::strncpy(l_tUnregisterNotifInfo.m_cnotificationname,
+ GetNotificationName().c_str(), // LCOV_EXCL_BR_LINE 11: except,C++ STL
+ sizeof(l_tUnregisterNotifInfo.m_cnotificationname) - 1);
+
+ if (eFrameworkunifiedStatusOK != McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_UNREGISTER, sizeof(l_tUnregisterNotifInfo), &l_tUnregisterNotifInfo)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for cmd 0x%X failed", NOR_PERSISTENCE_UNREGISTER); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistenceDelay
+/// Method to get the persistence time delay.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CStateNorPersistenceNotification::GetPersistenceDelay() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_uiDelay;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Publish
+/// This function publishes the notification to subscribed clients and saves the data
+/// immediately to persistent memory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNorPersistenceNotification::Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = PublishNotification(f_cservicename,
+ f_pmessage,
+ f_uimsgsize))) {
+ if (eFrameworkunifiedStatusOK != (l_estatus = SaveDataToNor(f_pmessage, f_uimsgsize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in saving persistent data on nor for %s published by %s, status: %d",
+ m_cNotificationName.c_str(), f_cservicename.c_str(), l_estatus); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// PublishNotification
+/// This function publishes the notification to subscribed clients.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNorPersistenceNotification::PublishNotification(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_estatus = CStateNotification::Publish(f_cservicename, f_pmessage, f_uimsgsize);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SaveDataToNor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNorPersistenceNotification::SaveDataToNor(PVOID f_pmessage, const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_pmessage && f_uimsgsize > 0) {
+ TNorPersistenceNotifInfoHeader l_tNorPersistentData = {};
+ UI_32 l_ui32SendDataTotalLength = static_cast<UI_32>(sizeof(TNorPersistenceNotifInfoHeader) + f_uimsgsize);
+ UI_8 *l_ui8SendData = new(std::nothrow) UI_8[l_ui32SendDataTotalLength];
+ UI_8 *l_ui8TmpOffset = l_ui8SendData;
+
+ if (NULL != l_ui8SendData) { // LCOV_EXCL_BR_LINE 6: l_ui8SendData can't be NULL
+ std::strncpy(l_tNorPersistentData.m_cnotificationname,
+ this->GetNotificationName().c_str(),
+ sizeof(l_tNorPersistentData.m_cnotificationname) - 1);
+ std::strncpy(l_tNorPersistentData.m_cpublishername,
+ this->GetPublisherName().c_str(),
+ sizeof(l_tNorPersistentData.m_cpublishername) - 1);
+ l_tNorPersistentData.m_epersistenttype = this->GetNotificationType();
+ l_tNorPersistentData.m_uimaxmsglength = this->GetMaxMessageSize();
+ l_tNorPersistentData.m_uidelay = this->GetPersistenceDelay();
+ l_tNorPersistentData.m_uimsgsize = f_uimsgsize;
+ l_tNorPersistentData.m_epersistcategory = m_ePersistCategory;
+
+ std::memset(l_ui8SendData, 0, l_ui32SendDataTotalLength);
+ std::memcpy(l_ui8SendData, &l_tNorPersistentData, sizeof(l_tNorPersistentData));
+ l_ui8TmpOffset += sizeof(l_tNorPersistentData);
+ std::memcpy(l_ui8TmpOffset, f_pmessage, f_uimsgsize);
+
+ // issue a copy to the worker thread
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_TIMER_START, l_ui32SendDataTotalLength, l_ui8SendData))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for nor worker thread failed %d ", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Sender handle of nor worker thread is NULL. Can't send message.");
+ // LCOV_EXCL_STOP
+ }
+
+ delete[] l_ui8SendData; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_ui8SendData = NULL;
+ } else {
+ // LCOV_EXCL_START 6: l_ui8SendData can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification data is NULL, size is %d", f_uimsgsize); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistentCategory
+/// Gets the persist type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedPersistCategory CStateNorPersistenceNotification::GetPersistentCategory() { // LCOV_EXCL_START 100: never be used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_ePersistCategory;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistentCategory
+/// Sets the persist type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNorPersistenceNotification::SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_epersistcategory != m_ePersistCategory) {
+ if (NULL != m_pData && NULL != m_pData->m_pMessage) { // LCOV_EXCL_BR_LINE 6: if m_pData is not null, the m_pData->m_pMessage can not be null // NOLINT[whitespace/line_length]
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
+ TImmediatePersistenceChangeCategory l_tChangeCategory = {};
+ UI_32 l_ui32SendDataTotalLength =
+ static_cast<UI_32>(sizeof(TImmediatePersistenceChangeCategory) + m_pData->m_uiMsgSize);
+ UI_8 *l_ui8SendData = new(std::nothrow) UI_8[l_ui32SendDataTotalLength];
+ UI_8 *l_ui8TmpOffset = l_ui8SendData;
+
+ if (NULL != l_ui8SendData) { // LCOV_EXCL_BR_LINE 6: l_ui8SendData can't be NULL
+ std::strncpy(l_tChangeCategory.m_tnornotifInfoheader.m_cnotificationname, this->GetNotificationName().c_str(),
+ sizeof(l_tChangeCategory.m_tnornotifInfoheader.m_cnotificationname) - 1);
+ std::strncpy(l_tChangeCategory.m_tnornotifInfoheader.m_cpublishername, this->GetPublisherName().c_str(),
+ sizeof(l_tChangeCategory.m_tnornotifInfoheader.m_cpublishername) - 1);
+ l_tChangeCategory.m_tnornotifInfoheader.m_epersistenttype = this->GetNotificationType();
+ l_tChangeCategory.m_tnornotifInfoheader.m_uimaxmsglength = this->GetMaxMessageSize();
+ l_tChangeCategory.m_tnornotifInfoheader.m_uidelay = this->GetPersistenceDelay();
+ l_tChangeCategory.m_tnornotifInfoheader.m_uimsgsize = m_pData->m_uiMsgSize;
+ l_tChangeCategory.m_tnornotifInfoheader.m_epersistcategory = f_epersistcategory;
+
+ l_tChangeCategory.m_eoldpersistcategory = m_ePersistCategory;
+
+ std::memset(l_ui8SendData, 0, l_ui32SendDataTotalLength);
+ std::memcpy(l_ui8SendData, &l_tChangeCategory, sizeof(l_tChangeCategory));
+ l_ui8TmpOffset += sizeof(l_tChangeCategory);
+ std::memcpy(l_ui8TmpOffset, m_pData->m_pMessage, m_pData->m_uiMsgSize);
+
+ // issue a copy to the worker thread
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AppName,
+ NOR_PERSISTENCE_CHANGE_CATEGORY,
+ l_ui32SendDataTotalLength,
+ l_ui8SendData))) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "McSend failed while changing category for notfn %s from %d to %d, status=%d",
+ m_cNotificationName.c_str(), m_ePersistCategory, f_epersistcategory, l_estatus);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__,
+ "Msg sent to immediate pers. thread to change persist category of %s from %d to %d",
+ m_cNotificationName.c_str(), m_ePersistCategory, f_epersistcategory);
+ }
+
+ delete[] l_ui8SendData;
+ l_ui8SendData = NULL;
+ } else {
+ // LCOV_EXCL_START 6: l_ui8SendData can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory alloc error for l_ui8SendData, errno=%d", errno);
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Sender handle of nor worker thread is NULL. Can't send message.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+ } else { // no data is persisted in emmc for this notfn, so no need to send msg to worker thread
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notfn %s has no data to persist", m_cNotificationName.c_str());
+ }
+
+ m_ePersistCategory = f_epersistcategory;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp
new file mode 100755
index 0000000..ff8f054
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp
@@ -0,0 +1,402 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CStateNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <iostream>
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_state_notification.h"
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CStateNotification
+/// Constructor of CStateNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStateNotification::CStateNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize):
+ CNotification(f_cnotificationname, f_uimaxmsgsize),
+ m_pData(NULL),
+ m_pDefaultData(NULL),
+ m_bWasPublished(FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistentType = eFrameworkunifiedStateVar;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CStateNotification
+/// Destructor of CStateNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStateNotification::~CStateNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pData) {
+ delete m_pData; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ m_pData = NULL;
+ }
+
+ if (NULL != m_pDefaultData) {
+ delete m_pDefaultData;
+ m_pDefaultData = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistentData
+/// This function is used to get the persistent data pointer
+////////////////////////////////////////////////////////////////////////////////////////////////////
+const CPersistentData *CStateNotification::GetPersistentData() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return m_pData;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistentData
+/// This function is used to set the data related to notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::SetPersistentData(PVOID f_pmessage,
+ const UI_32 f_msgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL == m_pData) {
+ m_pData = new(std::nothrow) CPersistentData(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+
+ l_estatus = SetData(m_pData, f_pmessage, f_msgsize);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetDefaultPersistentData
+/// This function get the default data(if any) related to notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+const CPersistentData *CStateNotification::GetDefaultPersistentData() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return m_pDefaultData;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetDefaultPersistentData
+/// This function is used to set the default data related to notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::SetDefaultPersistentData(PVOID f_pmessage,
+ const UI_32 f_msgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL == m_pDefaultData) {
+ m_pDefaultData = new(std::nothrow) CPersistentData(); // LCOV_EXCL_BR_LINE 11: except,C++ STL
+ }
+
+ // set the default persistent data
+ if (eFrameworkunifiedStatusOK == (l_estatus = SetData(m_pDefaultData, f_pmessage, f_msgsize))) {
+ if (NULL == m_pData) {
+ // set the default data as persistent data if notification is not yet published
+ l_estatus = SetPersistentData(f_pmessage, f_msgsize);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Setting Persistent data");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistent data already set");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error setting default persistent data for notification:: %s",
+ m_cNotificationName.c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetData
+/// This function is used to set the persistent data
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::SetData(CPersistentData *f_pdata,
+ PVOID f_pmessage,
+ const UI_32 f_msgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_pdata) { // LCOV_EXCL_BR_LINE 6: double check, f_pdata can't be NULL
+ if (m_uiMaxMsgSize >= f_msgsize) {
+ f_pdata->m_uiMsgSize = f_msgsize;
+
+ if (NULL != f_pmessage && 0 != f_msgsize) {
+ if (NULL == f_pdata->m_pMessage) {
+ f_pdata->m_pMessage = new(std::nothrow) CHAR[m_uiMaxMsgSize];
+ }
+
+ if (NULL != f_pdata->m_pMessage) { // LCOV_EXCL_BR_LINE 5: new error case
+ std::memset(f_pdata->m_pMessage, 0, m_uiMaxMsgSize);
+ std::memcpy(f_pdata->m_pMessage, f_pmessage, f_msgsize);
+ } else {
+ // LCOV_EXCL_START 5: new error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error, unable to set persistent data for notification: %s",
+ m_cNotificationName.c_str());
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ if (NULL != f_pdata->m_pMessage) {
+ delete[](static_cast<PCHAR>(f_pdata->m_pMessage));
+ f_pdata->m_pMessage = NULL;
+ }
+ }
+
+ m_bWasPublished = TRUE;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't set notification data. Message data size (%d) is greater than maximum registered data size (%d)"
+ " of notification (%s).", f_msgsize, m_uiMaxMsgSize, GetNotificationName().c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, f_pdata can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to set persistent data for notification: %s, persistent object is NULL",
+ m_cNotificationName.c_str());
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddEventReciever
+/// This function adds the name of the application to receiver list of particular notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::AddEventReciever(const std::string &f_csubscribername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Message Queue Handle
+ HANDLE l_hMsgQHandle = NULL;
+
+ // iterator of CNotificationReceiver map
+ NotifReceiver_Iterator_Type l_iterator;
+
+ CNotificationReceiver *l_pNotificationReceiver = NULL;
+
+ if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_csubscribername can't be empty
+ l_estatus = AddReceiverInMap(f_csubscribername);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: double check, f_csubscribername can't be empty
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: double check, l_estatus must be eFrameworkunifiedStatusOK
+ if (m_bWasPublished) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Republish Notification to subscriber :: %s", f_csubscribername.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ if (NULL != m_pData) {
+ l_iterator = m_pmSubscribersList->find(f_csubscribername);
+
+ if (m_pmSubscribersList->end() != l_iterator) {
+ l_pNotificationReceiver = (*l_iterator).second;
+
+ if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: double check, l_pNotificationReceiver can't be NULL // NOLINT[whitespace/line_length]
+ l_hMsgQHandle = l_pNotificationReceiver->m_MsgQHandle;
+
+ if (NULL != l_hMsgQHandle) { // LCOV_EXCL_BR_LINE 6: double check, l_hMsgQHandle can't be NULL
+ if (eFrameworkunifiedStatusOK != (l_estatus = PublishData(l_pNotificationReceiver->m_MsgQHandle, m_pData->m_pMessage, m_pData->m_uiMsgSize))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error Publishing notification %s to %s published by %s, error status: 0x%x",
+ m_cNotificationName.c_str(), l_iterator->first.c_str(), m_cServiceName.c_str(), l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_hMsgQHandle can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pNotificationReceiver can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationReceiver is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_pData pointer is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Subscribing Notfn, src=%s name=%s. Notification not published.",
+ f_csubscribername.c_str(), m_cNotificationName.c_str());
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_estatus must be eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Receiver Not Added in map");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Publish
+/// This function publishes the notification to subscribed clients.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Message Queue Handle
+ HANDLE l_hMsgQHandle = NULL;
+
+ // Pointer to class CNotificationReceiver
+ CNotificationReceiver *l_pNotificationReceiver = NULL;
+
+ // Iterator for Notification Receiver map
+ NotifReceiver_Iterator_Type l_itrNotifReceiver;
+
+ if (m_uiMaxMsgSize >= f_uimsgsize) {
+ if (0 == m_cServiceName.compare(f_cservicename)) {
+ l_estatus = SetPersistentData(f_pmessage,
+ f_uimsgsize);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is always eFrameworkunifiedStatusOK
+ for (l_itrNotifReceiver = m_pmSubscribersList->begin();
+ l_itrNotifReceiver != m_pmSubscribersList->end();
+ l_itrNotifReceiver++) {
+ l_pNotificationReceiver = l_itrNotifReceiver->second;
+
+ if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6:double check, l_pNotificationReceiver can not be null // NOLINT[whitespace/line_length]
+ l_hMsgQHandle = l_pNotificationReceiver->m_MsgQHandle;
+
+ if (NULL != l_hMsgQHandle && NULL != m_pData) { // LCOV_EXCL_BR_LINE 6:double check, l_hMsgQHandle and m_pData can not be null // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != (l_estatus = PublishData(l_hMsgQHandle, m_pData->m_pMessage, f_uimsgsize))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error Publishing notification %s to %s published by %s, error status: 0x%x",
+ m_cNotificationName.c_str(),
+ l_itrNotifReceiver->first.c_str(),
+ f_cservicename.c_str(), l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_hMsgQHandle and m_pData can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pNotificationReceiver can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationReceiver is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistent Data Not Set"); // LCOV_EXCL_LINE 6: double check, l_estatus is always eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't publish notification %s. Registered by %s and published by %s.",
+ GetNotificationName().c_str(), m_cServiceName.c_str(), f_cservicename.c_str());
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't publish notification %s. Message data size (%d) is greater than maximum registered data size (%d)",
+ GetNotificationName().c_str(), f_uimsgsize, m_uiMaxMsgSize);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsPublished
+/// This functions returns the published status of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CStateNotification::IsPublished() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ return m_bWasPublished;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetMaxMessageSize
+/// This function reset the max size of data that can be published with notification.
+/// Also deletes the old persistent data and default data.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::ResetMaxMessageSize(const UI_32 f_uilength) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification::ResetMaxMessageSize(f_uilength);
+
+ // delete the old data as the size is changed the data may become invalid
+ if (NULL != m_pData) {
+ delete m_pData;
+ m_pData = NULL;
+ }
+
+ if (NULL != m_pDefaultData) {
+ delete m_pDefaultData;
+ m_pDefaultData = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp
new file mode 100755
index 0000000..1bb9dd1
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp
@@ -0,0 +1,87 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CStatePersistenceNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <iostream>
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_state_persistence_notification.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CStatePersistenceNotification
+/// Constructor of CStatePersistenceNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStatePersistenceNotification::CStatePersistenceNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize,
+ const EFrameworkunifiedPersistCategory f_epersistcategory):
+ CStateNotification(f_cnotificationname, f_uimaxmsgsize),
+ m_ePersistCategory(f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistentType = eFrameworkunifiedPersistedStateVar;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CStatePersistenceNotification
+/// Constructor of CStatePersistenceNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStatePersistenceNotification::~CStatePersistenceNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistentCategory
+/// Gets the persist type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedPersistCategory CStatePersistenceNotification::GetPersistentCategory() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_ePersistCategory;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistentCategory
+/// Sets the persist type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStatePersistenceNotification::SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistCategory = f_epersistcategory;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp b/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp
new file mode 100755
index 0000000..222ada3
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp
@@ -0,0 +1,61 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CStatePersistenceUserNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <iostream>
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_state_persistence_user_notification.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CStatePersistenceUserNotification
+/// Constructor of CStatePersistenceUserNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStatePersistenceUserNotification::CStatePersistenceUserNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize):
+ CStateNotification(f_cnotificationname, f_uimaxmsgsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistentType = eFrameworkunifiedPersistedStateUserVar;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CStatePersistenceUserNotification
+/// Destructor of CStatePersistenceUserNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStatePersistenceUserNotification::~CStatePersistenceUserNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
diff --git a/nv_hal/LICENSE b/nv_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/nv_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/nv_hal/Makefile b/nv_hal/Makefile
new file mode 100755
index 0000000..2f2d89f
--- /dev/null
+++ b/nv_hal/Makefile
@@ -0,0 +1,65 @@
+#
+# @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libnv_hal.so
+
+HEADER := hal_api/nv_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := nv_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/nv_hal/hal_api/nv_hal.h b/nv_hal/hal_api/nv_hal.h
new file mode 100755
index 0000000..2014754
--- /dev/null
+++ b/nv_hal/hal_api/nv_hal.h
@@ -0,0 +1,245 @@
+/*
+ * @copyright Copyright(c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_NV_HAL_H_
+#define HAL_API_NV_HAL_H_
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * @file nv_hal.h
+ * @brief This file provides API for accessing storage device.
+ */
+
+/** @addtogroup backup_manager
+ * @{
+ */
+/** @addtogroup nv_hal
+ * @ingroup backup_manager
+ * @{
+ */
+
+/**
+ * \~english NvHalMedia
+ */
+enum NvHalMedia {
+ /**
+ * \~english CacheDram
+ */
+ NVHALMEDIA_CACHEDRAM = 0,
+ /**
+ * \~english BackupDram
+ */
+ NVHALMEDIA_BACKUPDRAM,
+ /**
+ * \~english nand
+ */
+ NVHALMEDIA_NAND,
+ /**
+ * \~english Max
+ */
+ NVHALMEDIA_MAX
+};
+
+/**\ingroup InitNv
+ * \~english @par Brief
+ * Initialize Nv hal library.
+ * \~english @retval eFrameworkunifiedStatusOK : succsess initialize.
+ * \~english @retval eFrameworkunifiedStatusFail : fail initialize
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Initialization processing failure.[eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Perform Nv_hal library initialization.
+ * - This process also performs deletion of temporary files accompanying system reset\n
+ * during write processing.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * - None
+ */
+EFrameworkunifiedStatus InitNv(void);
+
+/**\ingroup GetSizeNv
+ * \~english @par Brief
+ * This API get data size which is stored in storage device.
+ * \~english @param [in] media
+ * enum NvHalMedia - Media type
+ * \~english @param [in] filename
+ * const char* - file name(Concatenated[category name/item name])
+ * \~english @param [out] size
+ * uint32_t - Data size
+ * \~english @par
+ * - Get decrypted data size as encryption data when item name in the argument of filename (file name) is added Prefix "ENC_".
+ * - Non encryption data : D_BK_CA_GID_D/D_BK_ID_GID_D
+ * - Encryption data : D_BK_CA_GID_D/ENC_D_BK_ID_GID_D
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusFileLoadError File not exists
+ * \~english @retval eFrameworkunifiedStatusInvldParam Parameter error
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter media is less than NVHALMEDIA_CACHEDRAM or greater than\n
+ * NVHALMEDIA_NAND. [eFrameworkunifiedStatusInvldParam]
+ * - Parameter id is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Value of parameter size is 0. [eFrameworkunifiedStatusInvldParam]
+ * - Internal IO error(lstat).[eFrameworkunifiedStatusFileLoadError]
+ * \~english @par Detail
+ * - This API get the data size according to specified media and ID.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see WriteNv ReadNv
+ */
+EFrameworkunifiedStatus GetSizeNv(enum NvHalMedia media, const char *filename, uint32_t* size);
+
+
+
+/**\ingroup ReadNv
+ * \~english @par Brief
+ * Read data from storage device.
+ * \~english @param [in] media
+ * enum NvHalMedia - Media type
+ * \~english @param [in] filename
+ * const char* - file name(Concatenated[category name/item name])
+ * \~english @param [out] buffer
+ * uint8_t* - Buffer for storing read data
+ * \~english @param [in] size
+ * uint32_t - Data size
+ * \~english @par
+ * - Decrypt and read data as encryption data when item name in the argument of filename (file name) is added Prefix "ENC_".
+ * - Non encryption data : D_BK_CA_GID_D/D_BK_ID_GID_D
+ * - Encryption data : D_BK_CA_GID_D/ENC_D_BK_ID_GID_D
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Parameter error
+ * \~english @retval eFrameworkunifiedStatusFail Read data failed
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter media is less than NVHALMEDIA_CACHEDRAM or greater than\n
+ * NVHALMEDIA_NAND. [eFrameworkunifiedStatusInvldParam]
+ * - Parameter id is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Parameter buffer is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Value of parameter size is 0. [eFrameworkunifiedStatusInvldParam]
+ * - Internal IO error(open, pread, lstat, close).[eFrameworkunifiedStatusFail]
+ * - The value of parameter size is not equal to the file size specified by id.
+ * [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - This API reads data according to specified media and ID.
+ * - ID is managed by backup_manager.For details, refer to "Details about XML file" in external specification of backup_manager.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see CheckNv WriteNv
+ */
+EFrameworkunifiedStatus ReadNv(enum NvHalMedia media, const char *filename, uint8_t *buffer, uint32_t size);
+
+/**\ingroup WriteNv
+ * \~english @par Brief
+ * Write data to storage device.
+ * \~english @param [in] media
+ * enum NvHalMedia - Media type
+ * \~english @param [in] filename
+ * const char* - filename(Concatenated[category name/item name])
+ * \~english @param [in] buffer
+ * uint8_t* - Buffer for storing written data
+ * \~english @param [in] size
+ * uint32_t - Data size
+ * \~english @par
+ * - Encrypt and write data as encryption data when item name in the argument of filename (file name) is added Prefix "ENC_".
+ * - Non encryption data : D_BK_CA_GID_D/D_BK_ID_GID_D
+ * - Encryption data : D_BK_CA_GID_D/ENC_D_BK_ID_GID_D
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Parameter error
+ * \~english @retval eFrameworkunifiedStatusFail Write data failed
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter media is less than NVHALMEDIA_CACHEDRAM or greater than\n
+ * NVHALMEDIA_NAND. [eFrameworkunifiedStatusInvldParam]
+ * - Parameter id is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Parameter buffer is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Value of parameter size is 0. [eFrameworkunifiedStatusInvldParam]
+ * - Internal IO error(open, pwrite, close, mkdir).[eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - This API writes data according to specified media and ID.
+ * - filename is managed by backup_manager.For details, refer to "Details about XML file" in external specification of backup_manager.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see CheckNv ReadNv
+ */
+EFrameworkunifiedStatus WriteNv(enum NvHalMedia media, const char *filename, uint8_t *buffer, uint32_t size);
+
+/**\ingroup DeleteNv
+ * \~english @par Brief
+ * Delete data which is stored in storage device.
+ * \~english @param [in] media
+ * enum \ref NvHalMedia - Media type
+ * \~english @param [in] filename
+ * const char* - filename(Concatenated[category name/item name])
+ * \~english @par
+ * - Delete data as encryption data when item name in the argument of filename (file name) is added Prefix "ENC_".
+ * - Non encryption data : D_BK_CA_GID_D/D_BK_ID_GID_D
+ * - Encryption data : D_BK_CA_GID_D/ENC_D_BK_ID_GID_D
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Parameter error
+ * \~english @retval eFrameworkunifiedStatusFail Delete data failed
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter media is less than \ref NVHALMEDIA_CACHEDRAM or greater than\n
+ * \ref NVHALMEDIA_NAND . [eFrameworkunifiedStatusInvldParam]
+ * - Parameter filename (filename) is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Internal IO error.[eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - This API delete data according to specified media and filename.
+ * - This API delete encryption key if data is encrypted.
+ * - filename is managed by backup_manager.For details, refer to "Details about XML file" in external specification of backup_manager.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see GetSizeNv ReadNv WriteNv
+ */
+EFrameworkunifiedStatus DeleteNv(enum NvHalMedia media, const char *filename);
+
+/** @}*/ // end of nv_hal
+/** @}*/ // end of backup_manager
+
+#endif // HAL_API_NV_HAL_H_
diff --git a/nv_hal/inc/nv_hal_nvhallog.h b/nv_hal/inc/nv_hal_nvhallog.h
new file mode 100755
index 0000000..d62bd88
--- /dev/null
+++ b/nv_hal/inc/nv_hal_nvhallog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_NV_HAL_NVHALLOG_H_
+#define INC_NV_HAL_NVHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_NV_HAL_NVHALLOG_H_
diff --git a/nv_hal/src/nv_hal.cpp b/nv_hal/src/nv_hal.cpp
new file mode 100755
index 0000000..d746ea0
--- /dev/null
+++ b/nv_hal/src/nv_hal.cpp
@@ -0,0 +1,242 @@
+/*
+ * @copyright Copyright(c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "nv_hal.h"
+#include <errno.h>
+#include <fcntl.h>
+#include <aglpath.h>
+#include <sys/syscall.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "nv_hal_nvhallog.h"
+
+/**
+ * Media type difine.
+ */
+const char *kMediaType[NVHALMEDIA_MAX] = {
+ "/tmp/bkup/",
+ "/ramd/BS/ns/backup_manager/rwdata/",
+ "/nv/BS/ns/backup_manager/rwdata/",
+};
+
+const int kMaxPath = 127; // Max length of path
+
+/**
+ * Initialize Nv hal
+ */
+EFrameworkunifiedStatus InitNv(void) {
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Get data size.
+ */
+EFrameworkunifiedStatus GetSizeNv(enum NvHalMedia media, const char *filename, uint32_t *size) {
+ if ((media < NVHALMEDIA_CACHEDRAM) || (media > NVHALMEDIA_NAND)) { // Argument range checking
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid media type:%d\n", media);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == filename) { // NULL checking of arguments
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "filename is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == size) { // NULL checking of arguments
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "size is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ char path[kMaxPath];
+ memset(path, '\0', kMaxPath);
+ snprintf(path, kMaxPath, "%s%s", kMediaType[media], filename);
+ // Geting the file size
+ struct stat file_stat;
+ if (0 > lstat(path, &file_stat)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lstat() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFileLoadError;
+ }
+ *size = file_stat.st_size;
+ return eFrameworkunifiedStatusOK;
+}
+
+
+
+/**
+ * Reading data from memory device.
+ */
+EFrameworkunifiedStatus ReadNv(enum NvHalMedia media, const char *filename, uint8_t *buffer, uint32_t size) {
+ if ((media < NVHALMEDIA_CACHEDRAM) || (media > NVHALMEDIA_NAND)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid media type:%d\n", media);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == filename) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "filename is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == buffer) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "buffer is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid size:%d\n", size);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ char path[kMaxPath];
+ memset(path, '\0', kMaxPath);
+ snprintf(path, kMaxPath, "%s%s", kMediaType[media], filename);
+ struct stat file_stat;
+ if (0 > lstat(path, &file_stat)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lstat() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ if (file_stat.st_size != size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "size error:%ld != %d\n", file_stat.st_size, size);
+ return eFrameworkunifiedStatusFail;
+ }
+ int fd = open(path, O_RDONLY);
+ if (-1 == fd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) error, errno=%d\n", path, errno);
+ return eFrameworkunifiedStatusFail;
+ } else {
+ size_t tot_read;
+ // Read data by support EINTR
+ for (tot_read = 0; tot_read < static_cast<size_t>(size);) {
+ ssize_t read_size = pread(fd, &buffer[tot_read], static_cast<size_t>(size) - tot_read, tot_read);
+ if (-1 == read_size) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pread() error, errno=%d\n", errno);
+ if (0 != close(fd)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "close() error, errno=%d\n", errno);
+ }
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ tot_read += read_size;
+ }
+ if (0 != close(fd)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "close() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Writing data to memory device.
+ */
+EFrameworkunifiedStatus WriteNv(enum NvHalMedia media, const char *filename, uint8_t *buffer, uint32_t size) {
+ if ((media < NVHALMEDIA_CACHEDRAM) || (media > NVHALMEDIA_NAND)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid media type:%d\n", media);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == filename) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "filename is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == buffer) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "buffer is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid size:%d\n", size);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ char path[kMaxPath];
+ memset(path, '\0', kMaxPath);
+ snprintf(path, kMaxPath, "%s%s", kMediaType[media], filename);
+ struct stat file_stat;
+ // Check file exists or not, mkdir first if file no exists.
+ if (0 > lstat(path, &file_stat)) {
+ char *dir_point = path;
+ char dir_buff[kMaxPath];
+ dir_point++;
+ while ((dir_point = strchr(dir_point, '/'))) {
+ memset(dir_buff, '\0', kMaxPath);
+ memcpy(dir_buff, path, dir_point - path);
+ if (0 > mkdir(dir_buff, 0770)) {
+ if (EEXIST != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "mkdir() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ } else {
+ dir_point++;
+ continue;
+ }
+ }
+ dir_point++;
+ }
+ }
+ int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0660);
+ if (-1 == fd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) error, errno=%d\n", path, errno);
+ return eFrameworkunifiedStatusFail;
+ } else {
+ size_t tot_written;
+ // Write data by support EINTR
+ for (tot_written = 0; tot_written < static_cast<size_t>(size);) {
+ ssize_t write_size = pwrite(fd, &buffer[tot_written], static_cast<size_t>(size) - tot_written, tot_written);
+ if (0 >= write_size) {
+ if (-1 == write_size && errno == EINTR) {
+ continue;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pwrite() error, errno=%d\n", errno);
+ if (0 != close(fd)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "close() error, errno=%d\n", errno);
+ }
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ tot_written += write_size;
+ }
+ if (0 != close(fd)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "close() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Delete data.
+ */
+EFrameworkunifiedStatus DeleteNv(enum NvHalMedia media, const char *filename) {
+ if ((media < NVHALMEDIA_CACHEDRAM) || (media > NVHALMEDIA_NAND)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid media type:%d\n", media);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == filename) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "filename is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ char path[kMaxPath];
+ memset(path, '\0', kMaxPath);
+ snprintf(path, kMaxPath, "%s%s", kMediaType[media], filename);
+ struct stat file_stat;
+
+ if (0 > lstat(path, &file_stat)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lstat() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (0 != unlink(path)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "unlink() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/otherservice/event_library/LICENSE b/otherservice/event_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/otherservice/event_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/otherservice/event_library/Makefile.client b/otherservice/event_library/Makefile.client
new file mode 100755
index 0000000..f00b09d
--- /dev/null
+++ b/otherservice/event_library/Makefile.client
@@ -0,0 +1,18 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+SUBDIRS := library
+
+include ../other_service.mk
diff --git a/otherservice/event_library/library/Makefile b/otherservice/event_library/library/Makefile
new file mode 100755
index 0000000..3127439
--- /dev/null
+++ b/otherservice/event_library/library/Makefile
@@ -0,0 +1,37 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+INST_SHLIBS = libev
+libev_SRCS := src/ev_lib.c
+VPATH = ./src ./include/$(COMPONENT_NAME)/
+INST_HEADERS = ev_lib.h event_library.h
+
+CPPFLAGS = -I./include
+
+FDLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wpointer-to-int-cast
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS := -lpthread
+
+include ../../other_service.mk
diff --git a/otherservice/event_library/library/include/other_service/ev_lib.h b/otherservice/event_library/library/include/other_service/ev_lib.h
new file mode 100755
index 0000000..6b87ea2
--- /dev/null
+++ b/otherservice/event_library/library/include/other_service/ev_lib.h
@@ -0,0 +1,1856 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ev_lib.h
+ * @brief \~english Event library -- API define head file
+ */
+
+#ifndef OTHERSERVICE_EV_LIB_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_EV_LIB_H_ // NOLINT(build/header_guard)
+
+#include <agl_types_obsoluted.h>
+#include <agldd/ev_common.h>
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup event_library
+ * @ingroup other_service
+ * @{
+ */
+
+#ifndef __KERNEL__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Create/Delete flag and message queue */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag
+/// \~english @par Brief
+/// Create flag for event flag by the flag_id.
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID of the flag event
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist Duplication Error
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id: The ID is not created by function of EV_moduleID_to_flagID().
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - flag_id registered in launch thread
+/// - Flag corresponding to flag_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Creates flag with ID specified by the argument.
+/// An error occurs if flag of the specified ID already exists.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_create_flag, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag(EV_ID flag_id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag64
+/// \~english @par Brief
+/// Create flag for event flag by the flag_id.
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID of the flag event
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist Duplication Error
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id: The ID is not created by function of EV_moduleID_to_flag64ID ().
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - flag_id registered in launch thread
+/// - Flag corresponding to flag_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Creates flag with ID specified by the argument.
+/// An error occurs if flag of the specified ID already exists.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_create_flag, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag64(EV_ID flag_id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_queue
+/// \~english @par Brief
+/// Create message queue with the queue_id.
+/// \~english @param [in] queue_id
+/// EV_ID - queue_id of message event
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [in] length
+/// UINT8 - length of message queue (Maximum accumulated number of the messages)
+/// \~english @param [in] max_bytes
+/// UINT16 - the maximum number of bytes per 1 message(MAX 2048)
+/// \~english @param [in] type
+/// EV_Message_Queue_Type - classification of the processing when the queue received more event
+/// - in the queue full state.
+/// \~english @par
+/// EV_Message_Queue_Type
+/// \~english @code
+/// typedef UINT8 EV_Message_Queue_Type;
+/// - EV_MESSAGE_QUEUE_TYPE_BUSY = 0 // Return error(EV_ERR_Busy) to origin of message transmission
+/// - EV_MESSAGE_QUEUE_TYPE_FIFO = 1 // Delete the top message of the queue, and shift message
+/// // (Delete the oldest message)
+/// - EV_MESSAGE_QUEUE_TYPE_REPLACE = 2 // Overwrite the last message of the queue
+/// // (Overwrite the newest message)
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist Duplication Error
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id is not created by function of EV_moduleID_to_queueID ().
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - queue_id registered in launch thread
+/// - Message queue corresponding to queue_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Message queue pool is NULL
+/// - Message queue generation corresponding to queue_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Creates message queue with ID specified by the argument.
+/// When queue is created, a memory area corresponding to "length" x "max_bytes" is dynamically secured.
+/// An error occurs if queue of the specified ID already exists.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_create_message_queue, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_queue(EV_ID queue_id, // NOLINT (readability/nolint)
+ UINT8 length, // NOLINT (readability/nolint)
+ UINT16 max_bytes, // NOLINT (readability/nolint)
+ EV_Message_Queue_Type type); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag_auto_id
+/// \~english @par Brief
+/// Automatically assign flag ID, and creates flag with flag ID.
+/// \~english @param [out] flag_id
+/// EV_ID* - flag_id assigned automatically
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Automatically assign flag ID, and creates flag with flag ID.
+/// It is the same as "EV_create_flag" except that flag ID is automatically allocated.
+/// \~english @see EV_create_flag, evk_open, evk_close, evk_ioctl, evk_create_flag, evk_alloc_flag_id, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag_auto_id(/* OUT */EV_ID *flag_id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag64_auto_id
+/// \~english @par Brief
+/// Automatically assign flag ID, and creates flag with flag ID.
+/// \~english @param [out] flag_id
+/// EV_ID* - flag_id assigned automatically
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Automatically assign flag ID, and creates flag with flag ID.
+/// It is the same as "EV_create_flag" except that flag ID is automatically allocated.
+/// \~english @see EV_create_flag, evk_open, evk_close, evk_ioctl, evk_create_flag, evk_alloc_flag_id, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag64_auto_id(/* OUT */EV_ID *flag_id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_queue_auto_id
+/// \~english @par Brief
+/// Automatically assign queue ID, and creates message queue with queue ID.
+/// It stores queue_id assigned automatically in argument.
+/// \~english @param [out] queue_id
+/// EV_ID* - queue_id assigned automatically
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [in] length
+/// UINT8 - length of message queue (Maximum accumulated number of the messages)
+/// \~english @param [in] max_bytes
+/// UINT16 - the maximum number of bytes per 1 message(MAX 2048)
+/// \~english @param [in] type
+/// EV_Message_Queue_Type - classification of the processing when the queue received more event
+/// in the queue full state.
+/// \~english @par
+/// EV_Message_Queue_Type
+/// \~english @code
+/// typedef UINT8 EV_Message_Queue_Type;
+/// - EV_MESSAGE_QUEUE_TYPE_BUSY = 0 // Return error(EV_ERR_Busy) to origin of message transmission
+/// - EV_MESSAGE_QUEUE_TYPE_FIFO = 1 // Delete the top message of the queue, and shift message
+/// // (Delete the oldest message)
+/// - EV_MESSAGE_QUEUE_TYPE_REPLACE = 2 // Overwrite the last message of the queue
+/// // (Overwrite the newest message)
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Thread is unregistered and threads started up to the maximum of event thread(16 threads)
+/// - EV_ERR_Thread_Over
+/// - Message queue corresponding to queue_id already exists
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Message queue pool is NULL
+/// - Message queue generation corresponding to queue_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Automatically assign queue id, and creates message queue with queue id, It stores queue_id
+/// assigned automatically in argument.
+/// It is the same as "EV_queue_flag" except that queue ID is automatically allocated.
+/// \~english @see EV_create_queue, evk_open, evk_close, evk_ioctl, evk_create_message_queue,
+/// evk_alloc_queueID, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_queue_auto_id(/* OUT */EV_ID *queue_id, // NOLINT (readability/nolint)
+ UINT8 length, // NOLINT (readability/nolint)
+ UINT16 max_bytes, // NOLINT (readability/nolint)
+ EV_Message_Queue_Type type); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_destroy_flag
+/// \~english @par Brief
+/// Deletes flag with ID specified by the argument.
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID of the flag event
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Flag corresponding to queue_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Deletes flag with ID specified by the argument.
+/// The user can only delete flag created by user process.
+/// Due to deletion, program waiting for this flag (poll or wait) wakes up.
+/// \~english @see evk_close, evk_ioctl, evk_destroy_queue
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_destroy_flag(EV_ID queue_id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_destroy_queue
+/// \~english @par Brief
+/// Delete queue for message event by the queue_id.
+/// \~english @param [in] queue_id
+/// EV_ID - queue_id of the message event
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Message queue corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Deletes message queue with ID specified by the argument.
+/// The user can only delete message queue created by user process.
+/// Due to deletion, program waiting for this message queue (poll or wait) wakes up.
+/// \~english @see EV_destroy_flag, evk_close, evk_ioctl, evk_destroy_queue
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_destroy_queue(EV_ID queue_id); // NOLINT (readability/nolint)
+
+/* Send event */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_set_flag
+/// \~english @par Brief
+/// Set Event flag
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID of the event flag
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [in] bits
+/// UINT32 - event flag bit pattern
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - Flag corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sets bit pattern specified by argument to flag of ID specified by argument.
+/// When setting a plurality of bit patterns in the same flag, "only OR
+/// operation result of all bit patterns" is held in flag.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_store_flag
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_set_flag(EV_ID flag_id, UINT32 bits); // NOLINT (readability/nolint)
+
+/* Send event */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_set_flag64
+/// \~english @par Brief
+/// Set Event flag
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID of the event flag
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [in] bits
+/// UINT32 - event flag bit pattern
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - Flag corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sets bit pattern specified by argument to flag of ID specified by argument.
+/// When setting a plurality of bit patterns in the same flag, "only OR operation
+/// result of all bit patterns" is held in flag.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_store_flag
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_set_flag64(EV_ID flag_id, UINT64 bits); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_send_message
+/// \~english @par Brief
+/// Send Message event
+/// \~english @param [in] queue_id
+/// EV_ID - Queue ID of the message destination
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [in] bytes
+/// UINT16 - The bytes of the send message
+/// \~english @param [in] message
+/// const void * - Pointer to a transmitting byte line
+/// \~english @param [in] senderInfo
+/// UINT32 - Message Source(It is specified when it is used for application identification.
+/// When do not use it, appoint 0.)
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Busy Queue overflow
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Message queue corresponding to queue_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Queue overflow in kernel space
+/// - EV_ERR_Busy
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Invalid queue types
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sends message specified by argument to message queue of ID specified by argument.
+/// An error occurs when message queue of the specified ID doesn't exist or
+/// message size exceeds the specified size.
+/// When message queue is FULL, the processing differs depending on the type of message queue specified
+/// at the time of creation message queue.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_store_message
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_send_message(EV_ID queue_id, // NOLINT (readability/nolint)
+ UINT16 bytes, // NOLINT (readability/nolint)
+ const void *message, // NOLINT (readability/nolint)
+ UINT32 senderInfo); // NOLINT (readability/nolint)
+
+/* \~english Get events in the order of arrivals */
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_next_event
+/* \~english get events by reaching time */
+/// \~english @par Brief get the first reached event(non-block)
+/// \~english @param [out] ev
+/// event Structure
+/// \~english @par
+/// EV_Event struct
+/// @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_Type;
+/// typedef UINT32 EV_ID;
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// enum ev_message_queue_type {
+/// EV_MESSAGE_QUEUE_TYPE_BUSY,
+/// EV_MESSAGE_QUEUE_TYPE_FIFO,
+/// EV_MESSAGE_QUEUE_TYPE_REPLACE,
+/// };
+///
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT32 bits;
+/// } EV_Flag;
+///
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT64 bits;
+/// } EV_Flag64;
+///
+/// typedef struct {
+/// EV_ID queueID;
+/// UINT32 senderInfo;
+/// UINT32 length;
+/// UINT32 dummy;
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH];
+/// } EV_Message;
+///
+/// typedef struct {
+/// EV_Type type; // please reference ev_message_queue_type.
+/// union {
+/// EV_Flag flag;
+/// EV_Flag64 flag64;
+/// EV_Message message;
+/// } u;
+/// } EV_Event;
+///
+/// @endcode
+
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_Thread: unregistered thread
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - unregistered thread
+/// - EV_ERR_Invalid_Thread
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Get the first reached event which occurred for
+/// flags or message queues created in current process.
+/// If there is no event, set ev->type to EV_EVENT_None, then return immediately.
+/// The event is flag or message is decided by
+/// the ev->type is EV_EVENT_Flag or EV_EVENT_Message.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_next_event(/* OUT */EV_Event *ev); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_peek_next_event
+/// \~english @par Brief get the first reached event(non-destructive)
+/// \~english @param [out] ev
+/// event Structure
+/// @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_Type;
+/// typedef UINT32 EV_ID;
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// enum ev_message_queue_type {
+/// EV_MESSAGE_QUEUE_TYPE_BUSY,
+/// EV_MESSAGE_QUEUE_TYPE_FIFO,
+/// EV_MESSAGE_QUEUE_TYPE_REPLACE,
+/// };
+///
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT32 bits;
+/// } EV_Flag;
+///
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT64 bits;
+/// } EV_Flag64;
+///
+/// typedef struct {
+/// EV_ID queueID;
+/// UINT32 senderInfo;
+/// UINT32 length;
+/// UINT32 dummy;
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH];
+/// } EV_Message;
+///
+/// typedef struct {
+/// EV_Type type; // please reference ev_message_queue_type.
+/// union {
+/// EV_Flag flag;
+/// EV_Flag64 flag64;
+/// EV_Message message;
+/// } u;
+/// } EV_Event;
+///
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_Thread: unregistered thread
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - unregistered thread
+/// - EV_ERR_Invalid_Thread
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Get the first reached event which occurred for
+/// flags or message queues created in current process non-destructively.
+/// If the event is not getted from other processes, then call the function of
+/// EV_get_next_event() or EV_peek_next_event(), it will return a same event.
+/// If there is no event, set ev->type to EV_EVENT_None, then return immediately.
+/// The event is flag or message is decided by
+/// ev->type is EV_EVENT_Flag or EV_EVENT_Message.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_peek_next_event(/* OUT */EV_Event *ev); // NOLINT (readability/nolint)
+
+/* Get eventflag (ID specified) */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_flag
+/// \~english @par Brief
+/// Get event flag(non-block)
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] flag
+/// EV_Flag * - event flag structure
+/// \~english @par
+/// EV_Flag structure
+/// \~english @code
+/// typedef struct {
+/// EV_ID flagID; // Flag ID
+/// UINT32 bits; // event flag bit pattern
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets bit pattern specified by argument to flag of ID specified by argument.
+/// The user can only get flag created by user process, and clear bit pattern of acquired flag.
+/// An error occurs if flag of the specified ID doesn't exist.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_flag(EV_ID flag_id, /* OUT */EV_Flag *flag); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_wait_flag
+/// \~english @par Brief
+/// Get event flag(block)
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] flag
+/// EV_Flag * - event flag structure
+/// \~english @par
+/// EV_Flag structure
+/// \~english @code
+/// typedef struct {
+/// EV_ID flagID; // Flag ID
+/// UINT32 bits; // event flag bit pattern
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Interrupted signal interrupt
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Task blocking was canceled by signal interrupt
+/// - EV_ERR_Interrupted
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets bit pattern specified by argument to flag of ID specified by argument.
+/// The user can only get flag created by user process, and clear bit pattern of acquired flag.
+/// An error occurs if flag of the specified ID doesn't exist.
+/// If bit pattern is not set in flag, block until bit pattern is set.
+/// However, if a signal interrupt or corresponding flag is deleted, it will abort and return an error.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_wait_flag(EV_ID flag_id, /* OUT */EV_Flag *flag); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_peek_flag
+/// \~english @par Brief get flag event(non-destructive)
+/// \~english @param [in] flag_id
+/// ID of message event queue
+/// \~english @param [out] flag
+/// flag struct
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @par
+/// EV_Flag Structure
+/// @code
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT32 bits;
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: The specified flag ID is not existing,
+/// or it is not created in current process.
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Task blocking was canceled by signal interrupt
+/// - EV_ERR_Interrupted
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Get a flag event whose ID is specified non-destructively.
+/// If there is no event, just return.
+/// If there is no event, set flag->flagID to EV_NO_ID.
+/// You can judge that there is no event, even though flag->bits is 0.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_peek_flag(EV_ID flag_id, /* OUT */EV_Flag *flag); // NOLINT (readability/nolint)
+
+/* Get eventflag (ID specified) */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_flag64
+/// \~english @par Brief
+/// Get event flag(non-block)
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] flag
+/// EV_Flag * - event flag structure
+/// \~english @par
+/// EV_Flag structure
+/// \~english @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_ID
+///
+/// typedef struct {
+/// EV_ID flagID; // Flag ID
+/// UINT32 bits; // event flag bit pattern
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets bit pattern specified by argument to flag of ID specified by argument.
+/// The user can only get flag created by user process, and clear bit pattern of acquired flag.
+/// An error occurs if flag of the specified ID doesn't exist.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_flag64(EV_ID flag_id, /* OUT */EV_Flag64 *flag); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_wait_flag64
+/// \~english @par Brief
+/// Get event flag(block)
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] flag
+/// EV_Flag * - event flag structure
+/// \~english @par
+/// EV_Flag structure
+/// \~english @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_ID
+///
+/// typedef struct {
+/// EV_ID flagID; // Flag ID
+/// UINT32 bits; // event flag bit pattern
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Interrupted signal interrupt
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Task blocking was canceled by signal interrupt
+/// - EV_ERR_Interrupted
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets bit pattern specified by argument to flag of ID specified by argument.
+/// The user can only get flag created by user process, and clear bit pattern of acquired flag.
+/// An error occurs if flag of the specified ID doesn't exist.
+/// If bit pattern is not set in flag, block until bit pattern is set.
+/// However, if a signal interrupt or corresponding flag is deleted, it will abort and return an error.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_wait_flag64(EV_ID flag_id, /* OUT */EV_Flag64 *flag); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_peek_flag64
+/// \~english @par Brief get flag event(non-destructive)
+/// \~english @param [in] flag_id
+/// ID of message event queue
+/// \~english @param [out] flag
+/// flag struct
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @par
+/// EV_Flag Structure
+/// @code
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT32 bits;
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: The specified flag ID is not existing,
+/// or it is not created in current process.
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Task blocking was canceled by signal interrupt
+/// - EV_ERR_Interrupted
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Get a flag event whose ID is specified non-destructively.
+/// If there is no event, just return.
+/// If there is no event, set flag->flagID to EV_NO_ID.
+/// You can judge that there is no event, even though flag->bits is 0.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_peek_flag64(EV_ID flag_id, /* OUT */EV_Flag64 *flag); // NOLINT (readability/nolint)
+
+/* Get Message Event (ID specified) */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_message
+/// \~english @par Brief
+/// Get message event(non-block)
+/// \~english @param [in] queue_id
+/// EV_ID - Message queue ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] message
+/// EV_Message * - Message event structure
+/// \~english @par
+/// EV_Message structure
+/// \~english @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_ID
+///
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// typedef struct {
+/// EV_ID queueID; // ID of message queue
+/// UINT32 senderInfo; // Message Source
+/// UINT32 length; // length of message
+/// UINT32 dummy; // dummy for padding
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH]; // message
+/// } EV_Message;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Message queue corresponding to queue_id doesn't exist
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets 1 message specified by argument to message queue of ID specified by argument.
+/// The user can only get message queue created by user process, and clear 1 message of acquired message queue.
+/// An error occurs if message queue of the specified ID doesn't exist.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_message(EV_ID queue_id, /* OUT */EV_Message *message); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_wait_message
+/// \~english @par Brief
+/// Get message event(block)
+/// \~english @param [in] queue_id
+/// EV_ID - Message queue ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] message
+/// EV_Message * - Message event structure
+/// \~english @par
+/// EV_Message structure
+/// \~english @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_ID
+///
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// typedef struct {
+/// EV_ID queueID; // ID of message queue
+/// UINT32 senderInfo; // Message Source
+/// UINT32 length; // length of message
+/// UINT32 dummy; // dummy for padding
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH]; // message
+/// } EV_Message;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Interrupted signal interrupt
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Message queue corresponding to queue_id doesn't exist
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Task blocking was canceled by signal interrupt
+/// - EV_ERR_Interrupted
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets 1 message specified by argument to message queue of ID specified by argument.
+/// The user can only get message queue created by user process, and clear 1 message of acquired message queue.
+/// An error occurs if message queue of the specified ID doesn't exist.
+/// If message is not set in message queue, block until message is sent.
+/// However, if a signal interrupt or corresponding message queue is deleted, it will abort and return an error.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_wait_message(EV_ID queue_id, /* OUT */EV_Message *message); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_peek_message
+/// \~english @par Brief get message event(non-destructive)
+/// \~english @param [in] queue_id
+/// ID of message event queue
+/// \~english @param [out] message
+/// message event queue struct
+/// \~english @par
+/// EV_ID define
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+
+/// \~english @par
+/// EV_Message struct
+/// @code
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// typedef struct {
+/// EV_ID queueID;
+/// UINT32 senderInfo;
+/// UINT32 length;
+/// UINT32 dummy;
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH];
+/// } EV_Message;
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: The specified queue ID is not existing,
+/// or it is not created in current process.
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Message queue corresponding to queue_id doesn't exist
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Get a message event queue whose ID is specified non-destructively.
+/// If there is no event, just return.
+/// If there is no event, set message->queueID to EV_NO_ID.
+/// It is the same with EV_get_message(), except the message is remained in the queue.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_peek_message(EV_ID queue_id, /* OUT */EV_Message *message); // NOLINT (readability/nolint)
+
+/* \~english Get events(with search criteria) */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_find_message_by_sender
+/* \~english get event(with search sender infomation condition) */
+/// \~english @param [in] queue_id
+/// ID of message event queue
+/// \~english @param [in] senderInfo
+/// sender information
+/// \~english @param [out] message
+/// message event struct
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @par
+/// EV_Message struct
+/// @code
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// typedef struct {
+/// EV_ID queueID;
+/// UINT32 senderInfo;
+/// UINT32 length;
+/// UINT32 dummy;
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH];
+/// } EV_Message;
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: The specified queue ID is not existing,
+/// or it is not created in current process.
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Not find same sender information's message according to input sender information information
+/// - EV_ERR_Invalid_ID
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Message queue pool is NULL
+/// - Message queue generation corresponding to queue_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// If there is a event whose sender information is same with
+/// any event in message event queue whose ID is specified, get the event and delete it from queue.
+/// If such a message is not existing,
+/// set message->queueID to EV_NO_ID, then return.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_find_message_by_sender(EV_ID queue_id, UINT32 senderInfo, EV_Message *message); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_find_message_by_content
+/// \~english @par Brief get message event(search with contents)
+/// \~english @param [in] queue_id
+/// ID of message event queue
+/// \~english @param [in] bytes
+/// size of compare bytes
+/// \~english @param [in] compare_bytes
+/// bytes that used to campare the contents
+/// \~english @param [out] message
+/// message event struct
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @par
+/// EV_Message struct
+/// @code
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// typedef struct {
+/// EV_ID queueID;
+/// UINT32 senderInfo;
+/// UINT32 length;
+/// UINT32 dummy;
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH];
+/// } EV_Message;
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: The specified queue ID is not existing,
+/// or it is not created in current process.
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Not find contents's message according to input contents information
+/// - EV_ERR_Invalid_ID
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Message queue pool is NULL
+/// - Message queue generation corresponding to queue_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// If the event in compare bytes is same with
+/// any event in message event queue whose ID is specified,
+/// get the event and delete it from queue.
+/// If such a message is not existing, set message->queueID to EV_NO_ID, then return.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_find_message_by_content(EV_ID queue_id, // NOLINT (readability/nolint)
+ UINT16 length, // NOLINT (readability/nolint)
+ const void *compare_bytes, // NOLINT (readability/nolint)
+ /* OUT */EV_Message *message); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_flag_fd
+/// \~english @par Brief
+/// Obtain fd for polling flag event
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] fd
+/// int * - event flag queue fd for Polling
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - Flag corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets fd(File Descriptor) corresponding to flag of ID specified by argument.
+/// The user can only get flag created by user process .
+/// This fd(File Descriptor) can be used only for designation to poll / select, and operation when other
+/// operations are performed is not guaranteed.
+/// At the time of poll, only POLLIN can be specified, and at the time of select,
+/// it is possible to check only whether it can be read.
+/// Also, if flag is deleted in poll / select, it exits poll / select. * In case of poll, POLLERR is set.
+/// When calling the same ID more than once, it returns the same fd(File Descriptor)
+/// each time (unless destroy / create is done).
+/// \~english @see
+/// nothing
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_flag_fd(EV_ID flag_id, /* OUT */int *fd); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_queue_fd
+/// \~english @par Brief
+/// Obtain fd for polling message event
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] fd
+/// int * - Message queue fd for Polling
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Message queue corresponding to queue_id doesn't exist
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets fd(File Descriptor) corresponding to message queue of ID specified by argument.
+/// The user can only get message queue created by user process .
+/// This fd(File Descriptor) can be used only for designation to poll / select,
+/// and operation when other operations are performed is not guaranteed.
+/// At the time of poll, only POLLIN can be specified, and at the time of select,
+/// it is possible to check only whether it can be read.
+/// Also, if message queue is deleted in poll / select, it exits poll / select.
+/// * In case of poll, POLLERR is set.
+/// When calling the same ID more than once, it returns the same fd(File Descriptor)
+/// each time (unless destroy / create is done).
+/// \~english @see
+/// nothing
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_queue_fd(EV_ID queue_id, /* OUT */int *fd); // NOLINT (readability/nolint)
+
+/* \~english Functions that specify the module ID (16 bits) instead of the flag ID and queue ID */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_moduleID_to_flag_id
+/* \~english function group used to specify moduleID(16bit) instead of flag_id, queue_id */
+/// \~english @par Brief change from moduleID to flag_id
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @retval flag_id
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of flags with one moduleID. return error:EV_ERR_Exist.
+/// This function is only used for generating one event by one module ID.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ID EV_moduleID_to_flagID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_moduleID_to_flag64ID
+/// \~english @par Brief change from moduleID to 64bit flag_id
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval 64bit flag_id
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of flags with one moduleID. return error:EV_ERR_Exist.
+/// This function is only used for generating one event by one module ID.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ID EV_moduleID_to_flag64ID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_moduleID_to_queueID
+/// \~english @par Brief change from moduleID to queue_id
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval queue_id
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of queues with one moduleID.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ID EV_moduleID_to_queueID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag_by_mID
+/// \~english @par Brief create flag(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist Duplication Error
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The ID is not created by function of EV_moduleID_to_flagID ().
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - flag_id registered in launch thread
+/// - Flag corresponding to flag_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of flags with one moduleID.return error:EV_ERR_Exist.
+/// This function is only used for generating one event by one module ID.
+// \~english @see EV_create_flag
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag_by_mID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag64_by_mID
+/// \~english @par Brief create 64bit flag(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist Duplication Error
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The ID is not created by function of EV_moduleID_to_flag64ID ().
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - flag_id registered in launch thread
+/// - Flag corresponding to flag_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of flags with one moduleID. return error:EV_ERR_Exist.
+/// This function is only used for generating one event by one module ID.
+// \~english @see EV_create_flag64
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag64_by_mID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_queue_by_mID
+/// \~english @par Brief create queue(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @param [in] length
+/// length of message queue
+/// \~english @param [in] max_bytes
+/// one max bytes for message
+/// \~english @param [in] type
+/// treat type of receiving events even though the queue is full
+/// \~english @par
+/// ev_message_queue_type struct
+/// @code
+/// enum ev_message_queue_type {
+/// EV_MESSAGE_QUEUE_TYPE_BUSY,
+/// EV_MESSAGE_QUEUE_TYPE_FIFO,
+/// EV_MESSAGE_QUEUE_TYPE_REPLACE,
+/// };
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: set en invalid flag ID
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist: a same flag ID is existing
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - queue_id registered in launch thread
+/// - Message queue corresponding to queue_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Message queue pool is NULL
+/// - Message queue generation corresponding to queue_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of queues with one moduleID.
+// \~english @see EV_create_queue
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR
+EV_create_queue_by_mID(UINT16 m_id, // NOLINT (readability/nolint)
+ UINT8 length, // NOLINT (readability/nolint)
+ UINT16 max_bytes, // NOLINT (readability/nolint)
+ EV_Message_Queue_Type type); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_destroy_flag_by_mID
+/// \~english @par Brief delete flag(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @par length [in]length of message queue
+/// \~english @par max_bytes [in]one max bytes for message
+/// \~english @par type [in]treat type of receiving events even though the queue is full
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: set en invalid flag ID
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The flag_id of event/message which has not been created.
+/// - Flag corresponding to queue_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// \~english You can not use this function to
+/// \~english create a multiple of flags with one moduleID. return error:EV_ERR_Exist.
+/// This function is only used for generating one event by one module ID.
+// \~english @see EV_destroy_flag
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_destroy_flag_by_mID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_destroy_queue_by_mID
+/// \~english @par Brief delete queue(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Message queue corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of queues with one moduleID
+// \~english @see EV_destroy_queue
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_destroy_queue_by_mID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_set_flag_by_mID
+/// \~english @par Brief send flag(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @param [in] bits
+/// value of flag
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: set en invalid flag ID
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - Flag corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sets bit pattern specified by argument to flag of ID specified by argument.
+/// When setting a plurality of bit patterns in the same flag,
+/// "only OR operation result of all bit patterns" is held in flag.
+// \~english @see EV_set_flag
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_set_flag_by_mID(UINT16 m_id, UINT32 bits); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_set_flag64_by_mID
+/// \~english @par Brief send 64bit flag(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @param [in] bits
+/// value of flag
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - Flag corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sets bit pattern specified by argument to flag of ID specified by argument.
+/// When setting a plurality of bit patterns in the same flag, "only
+/// OR operation result of all bit patterns" is held in flag.
+// \~english @see EV_set_flag64
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_set_flag64_by_mID(UINT16 m_id, UINT64 bits); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_send_message_by_mID
+/// \~english @par Brief send message(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @param [in] bytes
+/// number of send bytes
+/// \~english @param [in] message
+/// pointer to sender contents
+/// \~english @param [in] senderInfo
+/// sender information
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Busy Queue overflow
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Message queue corresponding to queue_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Queue overflow in kernel space
+/// - EV_ERR_Busy
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Invalid queue types
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sends message specified by argument to message moduleID specified by argument.
+/// An error occurs when message queue of the specified ID doesn't exist
+/// or message size exceeds the specified size.
+/// When message queue is FULL, the processing differs depending on the type
+/// of message queue specified at the time of creation message queue.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_store_message
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR
+EV_send_message_by_mID(UINT16 m_id, // NOLINT (readability/nolint)
+ UINT16 bytes, // NOLINT (readability/nolint)
+ const void *message, // NOLINT (readability/nolint)
+ UINT32 senderInfo); // NOLINT (readability/nolint)
+
+/** @}*/ // end of event_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+/**
+ *
+ * @brief Method to specify module IDs as flag IDs and queue IDs
+ *
+ * The function with module ID as an argument directly can be used in the case of that created only
+ * one flag and queue in the module, other than using macros EV_Flag_ID_Base() or EV_Queue_ID_Base().
+ * @see EV_create_flag_by_mID
+ * @see EV_create_queue_by_mID
+ * @see EV_destroy_flag_by_mID
+ * @see EV_destroy_queue_by_mID
+ * @see EV_set_flag_by_mID
+ * @see EV_send_message_by_mID
+ *
+ * So the following API can be used to convert IDs created using above method to flag IDs or queue ID
+ * when pass them to other modules.
+ * @see EV_moduleID_to_flagID(UINT16 m_id)
+ * @see EV_moduleID_to_queueID(UINT16 m_id)
+ *
+ * @see EV_ID_spec
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* !__KERNEL__ */
+
+#endif // OTHERSERVICE_EV_LIB_H_
diff --git a/otherservice/event_library/library/include/other_service/event_library.h b/otherservice/event_library/library/include/other_service/event_library.h
new file mode 100755
index 0000000..ea6285c
--- /dev/null
+++ b/otherservice/event_library/library/include/other_service/event_library.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english include all event_library head files
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup event_library
+ * @ingroup other_service
+ * @{
+ */
+#ifndef OTHERSERVICE_EVENTLIBRARY_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_EVENTLIBRARY_H_ // NOLINT(build/header_guard)
+
+#include <other_service/ev_lib.h>
+
+#endif // OTHERSERVICE_EVENTLIBRARY_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/otherservice/event_library/library/libev.ver b/otherservice/event_library/library/libev.ver
new file mode 100755
index 0000000..a361455
--- /dev/null
+++ b/otherservice/event_library/library/libev.ver
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+######################
+# ev version script #
+######################
+{
+ global:
+ ### .text section ###
+ EV_*;
+ ev_lock_func;
+ ev_lock_line;
+ ev_lock_pid;
+ ev_process_global_mutex;
+ g_destory_message_invalid_id_wrapper_flag;
+ g_destory_message_fatal_wrapper_flag;
+ g_receive_message_no_exist_fatal_wrapper_flag;
+ g_receive_message_fatal_wrapper_flag;
+ g_send_message_invalid_id_wrapper_flag;
+ g_send_message_fatal_wrapper_flag;
+ g_create_event_fatal_wrapper_flag;
+ g_create_event_set_poll_fatal_wrapper_flag;
+ ### .data section ###
+ ### .bss section ###
+ local:
+ *;
+};
+
diff --git a/otherservice/event_library/library/src/ev_lib.c b/otherservice/event_library/library/src/ev_lib.c
new file mode 100755
index 0000000..f6b784a
--- /dev/null
+++ b/otherservice/event_library/library/src/ev_lib.c
@@ -0,0 +1,1551 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ev_lib.c
+ * @brief Events Library -- Implementing API Functions
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/prctl.h>
+#include <other_service/ev_lib.h>
+#include <agldd/evk_lib.h>
+#include <agldd/ev_common.h>
+#include <assert.h>
+#define EV_perror perror
+#define EV_assert assert
+
+/*
+ * Not use dbg_output in the EV so that the DTV apps and semiconductor vendor use this function.
+ */
+#define ev_log(format, arg...) \
+{ \
+ { \
+ char procname[33]; \
+ prctl(PR_GET_NAME, procname); \
+ int pid = getpid(); \
+ printf(format, procname, pid, ##arg); \
+ } \
+}
+
+#define EV_DEBUG_INFO(format, arg...) \
+{ \
+ if (getenv("EV_DEBUG") != NULL) { \
+ ev_log("[EV: info](%s:%d) " format, ##arg); \
+ } \
+}
+
+#define EV_DEBUG_WARNING(format, arg...) \
+{ \
+ ev_log("[EV: warning](%s:%d) " format, ##arg); \
+}
+
+#define EV_DEBUG_ERR(format, arg...) \
+{ \
+ ev_log("[EV: ERR](%s:%d) " format, ##arg); \
+}
+
+/** @brief Structures for managing ID and FD in use by processes
+ */
+typedef struct {
+ EV_ID id; /**< flag/queue ID */
+ INT32 fd; /**< file descriptor */
+}
+EV_Info;
+
+/*----------------------------------------*/
+/** @brief EV management information table per thread */
+/*----------------------------------------*/
+typedef struct {
+ /** Thread calling the EV library */
+ pthread_t thread;
+ /** Registration information by ID */
+ EV_Info ev_info[EV_MAX_IDS_IN_THREAD];
+ /** Number of registered IDs */
+ UINT8 num;
+}
+EV_thread_info_type;
+
+/** Thread information acquisition mode */
+#define EV_THREAD_INFO_CREATE 0
+#define EV_THREAD_INFO_PEEK 1
+#define EV_SEARCH_ALL_THREAD -1
+
+/* Related process exclusion control in the process */
+const char *g_ev_lock_func;
+int g_ev_lock_line;
+int g_ev_lock_pid;
+pthread_mutex_t g_ev_process_global_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+#define EV_PROCESS_MUTEX_LOCK \
+ pthread_mutex_lock(&g_ev_process_global_mutex); \
+ g_ev_lock_func = __FUNCTION__; \
+ g_ev_lock_line = __LINE__; \
+ g_ev_lock_pid = getpid();
+#define EV_PROCESS_MUTEX_UNLOCK \
+ pthread_mutex_unlock(&g_ev_process_global_mutex);
+
+/** @mainpage
+ * This document describes the following specifications:
+ * - Event Library (EV) API specifications
+ * - Event ID specifications
+ *
+ * In principle, the API specifications of the event library for kernel space (EVK) is
+ * the same as the event library for user space (EV) except for the function name prefixed ""EVK"".
+ * If there are differences between the EV and EVK, it is described as "difference in kernel version".
+ */
+/** @defgroup Event Library (EV) API specifications */
+/** @defgroup EV_ID_spec Event ID specifications */
+/** @defgroup EV_m_id Function specifying module ID instead of event ID */
+/** @defgroup EV_in internal specifications of the event library for user space (EV) */
+/** @defgroup EVK_in Internal specifications of the event library for kernel space (EVK) */
+/** @addtogroup EV_in
+ * @{ */
+
+/** EV thread information management table */
+EV_thread_info_type *EV_thread_info[EV_MAX_THREADS_IN_PROCESS];
+
+/*----------------------------------------------------------------------
+ * Return the registered position of the thread ID
+ * Allocate and initialize space for unregistered threads
+ * @brief Sending message (specified module-ID)
+ * @param index [OUT] Thread index
+ * @param flag [IN] Operating Mode
+ ----------------------------------------------------------------------*/
+EV_ERR
+EV_thread_id_check(int *index, int flag) {
+ int i, empty;
+
+ /* Current threadID */
+ pthread_t EV_self_thread_id;
+
+ /* Get thread ID */
+ EV_self_thread_id = pthread_self();
+
+ /* Control-process lock */
+ EV_PROCESS_MUTEX_LOCK;
+
+ /* Whether or not the thread has already been registered. */
+ for(i = 0, empty = -1; i < EV_MAX_THREADS_IN_PROCESS; i++) {
+ /* Free space */
+ if(EV_thread_info[i] == NULL) {
+ /* Set free space index */
+ empty = (empty == -1) ? i: empty;
+ continue;
+ }
+
+ if(EV_thread_info[i]->thread == EV_self_thread_id) {
+ *index = i;
+
+ /* Cancel in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+ return EV_OK;
+ }
+ }
+
+ if(flag == EV_THREAD_INFO_PEEK) {
+ EV_DEBUG_ERR("thread id is not found.\n");
+
+ /* Cancel in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+ return EV_ERR_Invalid_Thread;
+ }
+
+ /* If there are no unregistered threads and there is no space */
+ if(empty == -1) {
+ EV_DEBUG_ERR("thread id is full.\n");
+
+ /* Cancel in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+ return EV_ERR_Thread_Over;
+ }
+
+ /* Set to free space */
+ EV_thread_info[empty] = malloc(sizeof(*(EV_thread_info[empty])));
+ EV_thread_info_type *th = EV_thread_info[empty];
+
+ /* malloc failed */
+ if(th == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function malloc
+ /* Cancel in-process mutual exclusion */
+ // LCOV_EXCL_START 5: fail safe for glibc function malloc
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ EV_PROCESS_MUTEX_UNLOCK;
+ return EV_ERR_Fatal;
+ }
+ // LCOV_EXCL_STOP
+
+ /* Initialization */
+ memset(th, '\0', sizeof(*th));
+ th->thread = EV_self_thread_id;
+ /* th->num = 0; */
+
+ /* Cancel in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+
+ /* Set registration position */
+ *index = empty;
+
+ return EV_OK;
+}
+
+// free thread information when create event/message fail and no release thread buffer.
+// If no release thread buffer will cause be error:
+// Creation event's Thread count num less than MAX count(16) when one thread create event/message
+// fail and no longer to create event/message.
+static void
+free_thread_buffer(int th_index) {
+ /* in-process mutual exclusion */
+ EV_PROCESS_MUTEX_LOCK;
+ if ((th_index >= 0)
+ &&(th_index < EV_MAX_THREADS_IN_PROCESS)
+ && (NULL != EV_thread_info[th_index])
+ && (0 == EV_thread_info[th_index]->num)) {
+ free(EV_thread_info[th_index]);
+ EV_thread_info[th_index] = NULL;
+ EV_DEBUG_ERR("Free thread buffer by th_index:%d.\n", th_index);
+ }
+ /* in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+}
+
+/* EV_info update function */
+static void
+add_ev_info(int th_index, EV_ID id, int fd) {
+ /* Check storage position of ID information */
+ /* beginning of in-process mutual exclusion */
+ EV_PROCESS_MUTEX_LOCK;
+
+ int id_index = EV_thread_info[th_index]->num;
+ EV_assert(id_index < EV_MAX_IDS_IN_THREAD);
+
+ /* Set information */
+ EV_thread_info[th_index]->ev_info[id_index].id = id;
+ EV_thread_info[th_index]->ev_info[id_index].fd = fd;
+ EV_thread_info[th_index]->num++;
+
+ /* end of in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+}
+
+/* EV_info search function */
+static int
+find_ev_info(int th_index, EV_ID id) {
+ int i, j, start, end;
+ int ret = -1;
+
+ /* Search all threads */
+ if(th_index == EV_SEARCH_ALL_THREAD) {
+ start = 0;
+ end = EV_MAX_THREADS_IN_PROCESS;
+ } else {
+ start = th_index;
+ end = th_index + 1;
+ }
+
+ /* in-process mutual exclusion */
+ EV_PROCESS_MUTEX_LOCK;
+
+ for(j = start; j < end; j++) {
+ if(EV_thread_info[j] == NULL) {
+ continue;
+ }
+
+ for(i = 0; i < EV_thread_info[j]->num; i++) {
+ if(id == EV_thread_info[j]->ev_info[i].id) {
+ ret = EV_thread_info[j]->ev_info[i].fd;
+ break;
+ }
+ }
+ }
+
+ /* Cancel in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+
+ return ret;
+}
+
+static int
+delete_ev_info(EV_ID id) {
+ int fd = -1;
+ int i, j;
+ int found_th_index = -1;
+ int found_idx = -1;
+ EV_thread_info_type *th = NULL;
+
+ /* beginning of in-thread mutual exclusion */
+ EV_PROCESS_MUTEX_LOCK;
+
+ for(i = 0 ; i < EV_MAX_THREADS_IN_PROCESS && found_idx == -1 ; i++) {
+ th = EV_thread_info[i];
+ if (th == NULL) {
+ continue;
+ }
+ for(j = 0 ; j < th->num ; j++) {
+ if (th->ev_info[j].id == id) {
+ fd = th->ev_info[j].fd;
+ found_th_index = i;
+ found_idx = j;
+ break;
+ }
+ }
+ }
+
+ if(found_idx == -1) {
+ EV_PROCESS_MUTEX_UNLOCK;
+ return -1;
+ }
+
+ if (found_idx < th->num - 1) { /* pgr0060 */
+ memmove(&(th->ev_info[found_idx]), &(th->ev_info[found_idx+1]),
+ sizeof(th->ev_info[0]) * (size_t)(th->num - 1 - found_idx));
+ }
+ th->num--;
+
+ /* If everything is deleted */
+ if(th->num == 0 && EV_thread_info[found_th_index] != NULL) {
+ free(EV_thread_info[found_th_index]);
+ EV_thread_info[found_th_index] = NULL;
+ }
+ EV_PROCESS_MUTEX_UNLOCK;
+ return fd;
+}
+
+/** @} */
+/** @addtogroup EV
+ * @{ */
+
+static EV_ERR
+EV_create_flag_in(int th_index, EV_ID flag_id, int is64bit) {
+ int fd;
+
+ /* Open device driver */
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ int ret = ioctl(fd, is64bit ? EVK_IOC_CREATE_FLAG64:
+ EVK_IOC_CREATE_FLAG, flag_id);
+ int myerrno = errno;
+
+ if(ret < 0) {
+ if(myerrno == EEXIST) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function ioctl
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ close(fd); // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ EV_DEBUG_ERR("flag_id %x already exists.\n", flag_id); // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ return EV_ERR_Exist; // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ } else {
+ close(fd);
+ errno = myerrno;
+ return EV_ERR_Fatal;
+ }
+ }
+
+ ret = ioctl(fd, EVK_IOC_SET_POLL, flag_id);
+ if(ret < 0) {
+ close(fd);
+ EV_DEBUG_ERR("set_poll: internal error\n");
+ return EV_ERR_Fatal;
+ }
+
+ add_ev_info(th_index, flag_id, fd);
+ return EV_OK;
+}
+
+/** @brief Create flag
+ *
+ * Create a flag with the given ID.
+ * Return error if a flag with the same flag ID already exists
+ *
+ * @param flag_id [IN]flag ID
+ * @see EV_ID
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Specified an invalid flag ID
+ * @retval EV_ERR_Exist: A flag with the same ID already exists
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_create_flag (EV_ID flag_id) {
+ EV_ERR err;
+ int th_index;
+
+ /* Flag ID check */
+ if(!EV_ID_IS_FLAG(flag_id) || EV_ID_IS_AUTO_ID(flag_id)) {
+ EV_DEBUG_ERR("create_flag: Invalid flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ return err;
+ }
+
+ EV_DEBUG_INFO("EV_create_flag (th_index=%d)\n", th_index);
+
+ /* case of already created */
+ int fd = find_ev_info(th_index, flag_id);
+ if(fd >= 0) {
+ EV_DEBUG_ERR("create_flag: You already created flag_id %x.\n", flag_id);
+ return EV_ERR_Exist;
+ }
+
+ err = EV_create_flag_in(th_index, flag_id, 0);
+ if (EV_OK != err) {
+ free_thread_buffer(th_index);
+ }
+
+ return err;
+}
+
+/** @brief Create 64-bit flag
+ *
+ * Create a 64-bit flag with the given ID.
+ * Return error if a flag with the same flag ID already exists
+ *
+ * @param flag_id [IN]64-bit flag ID
+ * @see EV_ID
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Specified an invalid 64-bit flag ID
+ * @retval EV_ERR_Exist: A 64-bit flag with same ID already exists
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_create_flag64(EV_ID flag_id) {
+ EV_ERR err;
+ int th_index;
+
+ if(!EV_ID_IS_FLAG64(flag_id) || EV_ID_IS_AUTO_ID(flag_id)) {
+ EV_DEBUG_ERR("create_flag: Invalid flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ return err;
+ }
+
+ int fd = find_ev_info(th_index, flag_id);
+ if(fd >= 0) {
+ EV_DEBUG_ERR("create_flag: You already created flag_id %x.\n", flag_id);
+ return EV_ERR_Exist;
+ }
+
+ err = EV_create_flag_in(th_index, flag_id, 1);
+ if (EV_OK != err) {
+ free_thread_buffer(th_index);
+ }
+
+ return err;
+}
+
+/** @brief Create flag (auto-assign ID)
+ *
+ * Automatically assign a flag ID and creates a flag.
+ * Same as EV_create_flag(), except that ID is automatically assigned.
+ *
+ * @param flag_id [OUT]Area for storing the assigned flag ID
+ *
+ * @see EV_create_flag
+ */
+EV_ERR
+EV_create_flag_auto_id(EV_ID *flag_id) {
+ EV_assert(flag_id != NULL);
+
+ EV_ERR err;
+ int fd, th_index;
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ int ret = ioctl(fd, EVK_IOC_ALLOC_FLAG_ID, flag_id);
+ close(fd);
+ EV_assert(ret == 0);
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ *flag_id = EV_NO_ID;
+ return err;
+ }
+
+ err = EV_create_flag_in(th_index, *flag_id, 0);
+ if (err != EV_OK) {
+ free_thread_buffer(th_index);
+
+ *flag_id = EV_NO_ID;
+ return EV_ERR_Fatal;
+ }
+ return EV_OK;
+}
+
+/** @brief Create 64-bit flag(auto-assign ID)
+ *
+ * Automatically assign a 64-bit flag ID and creates a 64-bit flag.
+ * Same as EV_create_flag64(), except that ID is automatically assigned.
+ *
+ * @param flag_id [OUT]Area for storing the assigned 64-bit flag ID
+ *
+ * @see EV_create_flag64
+ */
+EV_ERR
+EV_create_flag64_auto_id(EV_ID *flag_id) {
+ EV_assert(flag_id != NULL);
+
+ EV_ERR err;
+ int fd, th_index;
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ int ret = ioctl(fd, EVK_IOC_ALLOC_FLAG64_ID, flag_id);
+ close(fd);
+ EV_assert(ret == 0);
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ *flag_id = EV_NO_ID;
+ return err;
+ }
+
+ err = EV_create_flag_in(th_index, *flag_id, 1);
+ if (err != EV_OK) {
+ free_thread_buffer(th_index);
+
+ *flag_id = EV_NO_ID;
+ return EV_ERR_Fatal;
+ }
+ return EV_OK;
+}
+
+static EV_ERR
+EV_create_queue_in(int th_index, EV_ID queue_id, UINT8 length,
+ UINT16 max_bytes, EV_Message_Queue_Type type) {
+ int fd;
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ EVK_Message_Queue_Request req;
+ req.queueID = queue_id;
+ req.length = length;
+ req.max_bytes = max_bytes;
+ req.type = type;
+
+ int ret = ioctl(fd, EVK_IOC_CREATE_MESSAGE_QUEUE, &req);
+ int myerrno = errno;
+ if (ret < 0) {
+ if (myerrno == EEXIST) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function ioctl
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ close(fd); // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ EV_DEBUG_ERR("queue %x already exists.\n", queue_id); // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ return EV_ERR_Exist; // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ } else {
+ close(fd);
+ errno = myerrno;
+ //EV_perror("create queue");
+ return EV_ERR_Fatal;
+ }
+ }
+
+ ret = ioctl(fd, EVK_IOC_SET_POLL, queue_id);
+ if (ret < 0) {
+ close(fd);
+ EV_DEBUG_ERR("set_poll: internal error\n");
+ return EV_ERR_Fatal;
+ }
+
+ add_ev_info(th_index, queue_id, fd);
+ return EV_OK;
+}
+
+/** @brief message event queue creation
+ *
+ * Create a queue of message event with the specified ID.
+ * Return error if a queue with the same ID already exists.
+ *
+ * A memory area corresponding to the specified maximum number of bytes x queue length is allocated dynamically.
+ *
+ * @param queue_id [IN] Message queue ID
+ * @param length [IN] Message queue length
+ * @param max_bytes [IN] - Maximum number of bytes per message
+ * @param type [IN] Type of action to take when more events are received when the queue is full
+ * @see EV_ID
+ * @see ev_message_queue_type
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Specified an invalid flag ID
+ * @retval EV_ERR_Exist: A flag with the same ID already exists
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_create_queue(EV_ID queue_id, UINT8 length, UINT16 max_bytes,
+ EV_Message_Queue_Type type) {
+ EV_ERR err;
+ int th_index;
+
+ if(!EV_ID_IS_QUEUE(queue_id) || EV_ID_IS_AUTO_ID(queue_id)) {
+ EV_DEBUG_ERR("create_queue: Invalid queue_id %x was specified.\n",
+ queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ return err;
+ }
+
+ int fd = find_ev_info(th_index, queue_id);
+ if(fd >= 0) {
+ EV_DEBUG_ERR("create_queue: You already created queue_id %x.\n",
+ queue_id);
+ return EV_ERR_Exist;
+ }
+
+ err = EV_create_queue_in(th_index, queue_id, length, max_bytes, type);
+ if (EV_OK != err) {
+ free_thread_buffer(th_index);
+ }
+
+ return err;
+}
+
+/** @brief message event queue creation(auto-assign ID)
+ *
+ * Automatically assigns a queue ID and creates a queue for message events.
+ * Same as EV_create_queue(), except that ID is automatically assigned.
+ *
+ * @param queue_id [OUT] Area for storing the assigned flag ID
+ * @param length [IN] Message queue length
+ * @param max_bytes [IN] - Maximum number of bytes per message
+ * @param type [IN] Type of action to take when more events are received when the queue is full
+ *
+ * @see EV_create_queue
+ */
+EV_ERR
+EV_create_queue_auto_id(EV_ID *queue_id, UINT8 length, UINT16 max_bytes,
+ EV_Message_Queue_Type type) {
+ int th_index;
+
+ EV_assert(queue_id != NULL);
+ EV_ERR err;
+ int fd;
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ int ret = ioctl(fd, EVK_IOC_ALLOC_QUEUE_ID, queue_id);
+ close(fd);
+ EV_assert(ret == 0);
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ *queue_id = EV_NO_ID;
+ return err;
+ }
+
+ err = EV_create_queue_in(th_index, *queue_id, length, max_bytes,
+ type);
+ if (err != EV_OK) {
+ free_thread_buffer(th_index);
+
+ *queue_id = EV_NO_ID;
+ return EV_ERR_Fatal;
+ }
+ return EV_OK;
+}
+
+/** @brief Deleting flag event
+ *
+ * Delete the flag with the specified ID.
+ * Only flags created by this process can be deleted.
+ *
+ * - differences in kernel versions
+ * EVK_destroy_flag can be used to delete any existing message event queue.
+ *
+ * @note The program wakes up that waiting for this queue (poll or wait)
+ * due to deletion.
+ *
+ * @param flag_id [IN] ID of flag
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_destroy_flag(EV_ID flag_id) {
+ int fd = delete_ev_info(flag_id);
+ if (fd < 0) {
+ EV_DEBUG_ERR("You haven't created flag/queue_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int ret = ioctl(fd, EVK_IOC_DESTROY_QUEUE, flag_id);
+ int myerrno = errno;
+ close(fd);
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_ERR("destroy: no such ID %x\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ } else {
+ errno = myerrno;
+ EV_perror("destroy");
+ return EV_ERR_Fatal;
+ }
+ }
+ return EV_OK;
+}
+
+/** @brief Delete message event queue
+ *
+ * Delete the message event queue with the specified ID.
+ * Only message event queues created by this process can be deleted.
+ *
+ * - differences in kernel versions
+ * EVK_destroy_queue can be used to delete any existing message event queue.
+ *
+ * @note The program wakes up that waiting for this queue (poll or wait)
+ * due to deletion.
+ *
+ * @param flag_id [IN] Message event queue ID
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The message queue with the specified ID does not exist,
+ * or there is no message event queue created by this process.
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_destroy_queue(EV_ID queue_id) {
+ return EV_destroy_flag(queue_id);
+}
+
+static EV_ERR
+EV_get_flag_in(EV_ID flag_id, EV_Flag *flag, int peek_only, int wait) {
+ EV_assert(flag != NULL);
+ flag->flagID = EV_NO_ID;
+ flag->bits = 0;
+
+ if (!EV_ID_IS_FLAG(flag_id)) {
+ EV_DEBUG_ERR("get_flag: %x is not a flag_id.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int fd = find_ev_info(EV_SEARCH_ALL_THREAD, flag_id);
+ if(fd < 0) {
+ EV_DEBUG_ERR("You have not created flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ EV_Event ev;
+ ev.type = EV_EVENT_Flag;
+ ev.u.flag.flagID = flag_id;
+ ev.u.flag.bits = 0;
+ int ret = ioctl(
+ fd,
+ (peek_only ? EVK_IOC_PEEK_EVENT : (wait ? EVK_IOC_WAIT_EVENT : EVK_IOC_GET_EVENT)),
+ &ev);
+
+ int myerrno = errno;
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_ERR("get_flag: No such flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+ else if (myerrno == EINTR) {
+ EV_DEBUG_ERR("get_flag: Interrupted\n");
+ return EV_ERR_Interrupted;
+ } else {
+ errno = myerrno;
+ EV_perror("get flag");
+ return EV_ERR_Fatal;
+ }
+ }
+
+ if (ev.type == EV_EVENT_Flag) {
+ flag->flagID = ev.u.flag.flagID;
+ flag->bits = ev.u.flag.bits;
+ }
+ return EV_OK;
+}
+
+static EV_ERR
+EV_get_flag64_in(EV_ID flag_id, EV_Flag64 *flag, int peek_only, int wait) {
+ EV_assert(flag != NULL);
+ flag->flagID = EV_NO_ID;
+ flag->bits = 0;
+
+ if (!EV_ID_IS_FLAG64(flag_id)) {
+ EV_DEBUG_ERR("get_flag: %x is not a flag_id.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int fd = find_ev_info(EV_SEARCH_ALL_THREAD, flag_id);
+ if (fd < 0) {
+ EV_DEBUG_ERR("You have not created flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ EV_Event ev;
+ ev.type = EV_EVENT_Flag64;
+ ev.u.flag64.flagID = flag_id;
+ ev.u.flag64.bits = 0;
+ int ret = ioctl(
+ fd,
+ (peek_only ? EVK_IOC_PEEK_EVENT : (wait ? EVK_IOC_WAIT_EVENT : EVK_IOC_GET_EVENT)),
+ &ev);
+
+ int myerrno = errno;
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_ERR("get_flag: No such flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+ else if (myerrno == EINTR) {
+ EV_DEBUG_ERR("get_flag: Interrupted\n");
+ return EV_ERR_Interrupted;
+ } else {
+ errno = myerrno;
+ EV_perror("get flag");
+ return EV_ERR_Fatal;
+ }
+ }
+
+ if (ev.type == EV_EVENT_Flag64) {
+ flag->flagID = ev.u.flag64.flagID;
+ flag->bits = ev.u.flag64.bits;
+ }
+ return EV_OK;
+}
+
+/** @brief Get flag event(non-block)
+ *
+ * Get the flag event with the specified ID, and clears the flag.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be used to determine no events.
+ * Only flags created by this process can be gotten.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] Flag Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_flag(EV_ID flag_id, EV_Flag *flag) {
+ return EV_get_flag_in(flag_id, flag, 0, 0);
+}
+
+/** @brief Get 64bit flag event(non-block)
+ *
+ * Get the 64-bit flag event with the specified ID, and clears the 64-bit flag.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be used to determine no events.
+ * Only flags created by this process can be gotten.
+ * Be sure to specify the flag ID created by specifying 64-bits.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] 64-bit flag struct
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_flag64(EV_ID flag_id, EV_Flag64 *flag) {
+ return EV_get_flag64_in(flag_id, flag, 0, 0);
+}
+
+/** @brief Get flag event(block)
+ *
+ * Get the flag event with the specified ID, and clear the flag.
+ * If there is no event, block until an event is received.
+ * However, if the interrupt is interrupted by a signal interrupt, EV_ERR_Interrupted is returned.
+ * If the flag is deleted while waiting, the wait is suspended
+ * and EV_ERR_Invalid_ID is returned.
+ * When interrupted, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be judged to have been interrupted.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] Flag Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval EV_ERR_Interrupted: Interrupted by a signal interrupt
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_wait_flag(EV_ID flag_id, EV_Flag *flag) {
+ return EV_get_flag_in(flag_id, flag, 0, 1);
+}
+
+/** @brief Get 64bit flag event(block)
+ *
+ * Get the 64-bit flag event with the specified ID, and clear the 64-bit flag.
+ * If there is no event, block until an event is received.
+ * However, if the interrupt is interrupted by a signal interrupt, EV_ERR_Interrupted is returned.
+ * If the flag is deleted while waiting, the wait is suspended
+ * and EV_ERR_Invalid_ID is returned.
+ * When interrupted, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be judged to have been interrupted.
+ * Be sure to specify the flag ID created by specifying 64 bits.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] 64-bit flag structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval EV_ERR_Interrupted: Interrupted by a signal interrupt
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_wait_flag64(EV_ID flag_id, EV_Flag64 *flag) {
+ return EV_get_flag64_in(flag_id, flag, 0, 1);
+}
+
+/** @brief Get flag event(non-destructive)
+ *
+ * Get the flag event with the specified ID non-destructively.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be used to determine no events.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] Flag Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_peek_flag(EV_ID flag_id, EV_Flag *flag) {
+ return EV_get_flag_in(flag_id, flag, 1, 0);
+}
+
+/** @brief Get 64bit flag event(non-destructive)
+ *
+ * Gets the 64-bit flag event with the specified ID non-destructively.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be used to determine no events.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] 64-bit flag structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_peek_flag64(EV_ID flag_id, EV_Flag64 *flag) {
+ return EV_get_flag64_in(flag_id, flag, 1, 0);
+}
+
+static EV_ERR
+EV_get_message_in(EV_ID queue_id, EV_Message *message, UINT32 senderInfo,
+ UINT32 length, const void *compare_bytes,
+ int peek_only, int wait) {
+ EV_assert(message != NULL);
+ message->queueID = EV_NO_ID;
+ message->senderInfo = 0;
+ message->length = 0;
+
+ if (!EV_ID_IS_QUEUE(queue_id)) {
+ EV_DEBUG_ERR("get_message: Invalid queue_id %x\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int fd = find_ev_info(EV_SEARCH_ALL_THREAD, queue_id);
+ if(fd < 0) {
+ EV_DEBUG_ERR("You have not created queue_id %x.\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ EV_Event ev;
+ ev.type = EV_EVENT_Message;
+ ev.u.message.queueID = queue_id;
+ ev.u.message.senderInfo = senderInfo;
+ if(length > 0 && compare_bytes != NULL) {
+ ev.u.message.length = length;
+ memcpy(ev.u.message.message, compare_bytes, length);
+ } else {
+ ev.u.message.length = 0;
+ }
+
+ int ret = ioctl(
+ fd,
+ (peek_only ? EVK_IOC_PEEK_EVENT : (wait ? EVK_IOC_WAIT_EVENT : EVK_IOC_GET_EVENT)),
+ &ev);
+
+ int myerrno = errno;
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_ERR("No such queue_id %x\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+ else if (myerrno == EINTR) {
+ EV_DEBUG_INFO("Interrupted.\n");
+ return EV_ERR_Interrupted;
+ } else {
+ errno = myerrno;
+ EV_perror("get message");
+ return EV_ERR_Fatal;
+ }
+ }
+
+ if(ev.type == EV_EVENT_Message) {
+ message->queueID = ev.u.message.queueID;
+ message->senderInfo = ev.u.message.senderInfo;
+ message->length = ev.u.message.length;
+ memcpy(message->message, ev.u.message.message,
+ ev.u.message.length);
+ }
+
+ return EV_OK;
+}
+
+/** @brief Get message events(non-block)
+ *
+ * Get one message event from the queue with the specified ID.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in message-> queue_id.
+ * The acquired message is deleted from the queue.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param message [OUT] Message Event Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Queue with specified ID does not exist
+ * Or not a message event queue created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_message(EV_ID queue_id, EV_Message *message) {
+ return EV_get_message_in(queue_id, message, 0, 0, NULL, 0, 0);
+}
+
+/** @brief Get message event(block)
+ *
+ * Get one message event from the queue with the specified ID.
+ * If there is no event, block until an event is received.
+ * However, if the interrupt is interrupted by a signal interrupt, EV_ERR_Interrupted is returned.
+ * If the queue is deleted while waiting, the waiting is suspended,
+ * EV_ERR_Invalid_ID is returned.
+ * When interrupted, EV_NO_ID is stored in message-> queue_id.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param message [OUT] Message Event Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Queue with specified ID does not exist
+ * Or not a message event queue created by invoking process
+ * @retval EV_ERR_Interrupted: Interrupted by a signal interrupt
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_wait_message(EV_ID queue_id, EV_Message *message) {
+ return EV_get_message_in(queue_id, message, 0, 0, NULL, 0, 1);
+}
+
+/** @brief Get message event(non-destructive)
+ *
+ * Get one message event queue of the specified ID non-destructively.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in message-> queue_id.
+ * Same as EV_get_message(), except that the retrieved message remains in the queue.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param message [OUT] Message Event Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Queue with specified ID does not exist
+ * Or not a message event queue created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_peek_message(EV_ID queue_id, EV_Message *message) {
+ return EV_get_message_in(queue_id, message, 0, 0, NULL, 1, 0);
+}
+
+static EV_ERR
+EV_get_next_event_in(EV_Event *ev, int peek_only) {
+ int i, th_index;
+ EV_ERR err;
+ EVK_Next_Event_Query query;
+
+ EV_assert(ev != NULL);
+ ev->type = EV_EVENT_None;
+
+ bzero(&query, sizeof(query));
+
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_PEEK);
+ if(err != EV_OK) {
+ return err;
+ }
+
+ EV_PROCESS_MUTEX_LOCK;
+ query.num = EV_thread_info[th_index]->num;
+ for(i = 0 ; i < query.num ; i++) {
+ query.ids[i] = EV_thread_info[th_index]->ev_info[i].id;
+ }
+ EV_PROCESS_MUTEX_UNLOCK;
+
+ if (query.num == 0) {
+ return EV_OK;
+ }
+
+ int fd;
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ int ret = ioctl(
+ fd,
+ (peek_only ? EVK_IOC_PEEK_NEXT_EVENT: EVK_IOC_GET_NEXT_EVENT),
+ &query);
+
+ int myerrno = errno;
+ close(fd);
+
+ if (ret < 0) {
+ errno = myerrno;
+ EV_perror("get_next_event");
+ return EV_ERR_Fatal;
+ }
+ memcpy(ev, &(query.ev), sizeof(*ev));
+ return EV_OK;
+}
+
+/** @brief Get the first event that arrived(non-block)
+ *
+ * Get the first arrival of a flag created by invoking process or an event
+ * that occurred in the message queue.
+ * If there are no events, EV_EVENT_None is stored in the ev->type and returned immediately.
+ *
+ * @param ev [OUT] Event Structure
+ * Whether the acquired event type is flag or message is determined
+ * by ev->type is EV_EVENT_Flag or EV_EVENT_Message.
+ *
+ * @retval EV_OK: Normal completion
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_next_event(EV_Event *ev) {
+ return EV_get_next_event_in(ev, 0);
+}
+
+/** @brief Get the first event that arrived(non-destructive)
+ *
+ * Get the first arrival of a flag created by invoking process or an event
+ * that occurred in the message queue non-destructively.
+ * The next call to EV_get_next_event() or EV_peek_next_event(),
+ * return the same event as long as no other program gets it.
+ * If there are no events, EV_EVENT_None is stored in the ev->type and returned immediately.
+ *
+ * @param ev [OUT] Event Structure
+ * Whether the acquired event flag or message is a message is determined
+ * by whether ev->type is EV_EVENT_Flag or EV_EVENT_Message.
+ *
+ * @retval EV_OK: Normal completion
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_peek_next_event(EV_Event *ev) {
+ return EV_get_next_event_in(ev, 1);
+}
+
+/** @brief Get message event(search by source info)
+ *
+ * If there is an event whose source information matches
+ * in the message event queue of the specified ID,it is gotten and deleted from the queue.
+ * If there are no such messages,
+ * EV_NO_ID is stored in message->queue_id, and the system call returns immediately.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param senderInfo [IN] Source Info
+ * @param message [OUT] Message Event Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Queue with specified ID does not exist
+ * Or not a message event queue created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_find_message_by_sender(EV_ID queue_id, UINT32 senderInfo,
+ EV_Message *message) {
+ EV_assert(message != NULL);
+ EV_assert(senderInfo != 0);
+ return EV_get_message_in(queue_id, message, senderInfo, 0, NULL, 0, 0);
+}
+
+/** @brief Get message event(search by content)
+ *
+ * If there is an event with byte sequence matching the specified bytes from the beginning
+ * in the message event queue of the specified ID,it is gotten and deleted from the queue.
+ * If there are no such messages,
+ * EV_NO_ID is stored in message->queue_id, and the system call returns immediately.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param bytes [IN] Bytes to compare
+ * @param compare_bytes [IN] Byte sequence to compare content against
+ * @param message [OUT] Message Event Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Queue with specified ID does not exist
+ * Or not a message event queue created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_find_message_by_content(EV_ID queue_id,
+ UINT16 bytes, const void *compare_bytes,
+ EV_Message *message) {
+ EV_assert(message != NULL);
+ EV_assert(bytes <= EV_MAX_MESSAGE_LENGTH);
+ EV_assert(compare_bytes != NULL);
+
+ return EV_get_message_in(queue_id, message, 0, bytes,
+ compare_bytes, 0, 0);
+}
+
+/** @brief Set flag event
+ *
+ * Set the flag with the specified ID.
+ *
+ * @param queue_id [IN] Flag ID
+ * @param bits [IN] Flag bit-pattern
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist.
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_set_flag(EV_ID flag_id, UINT32 bits) {
+ if (!EV_ID_IS_FLAG(flag_id)) {
+ EV_DEBUG_ERR("set_flag: %x is not a valid flag_id.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ EV_Flag flag;
+ flag.flagID = flag_id;
+ flag.bits = bits;
+
+ int ret = ioctl(fd, EVK_IOC_STORE_FLAG, &flag);
+ int myerrno = errno;
+ close(fd);
+
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_WARNING("set_flag: No such flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+ errno = myerrno;
+ EV_perror("set flag");
+ return EV_ERR_Fatal;
+ }
+ return EV_OK;
+}
+
+/** @brief Set 64bit flag event
+ *
+ * Set the flag with the specified ID.
+ *
+ * @param queue_id [IN] Flag ID
+ * @param bits [IN] Bit pattern of 64-bit flag
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist.
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_set_flag64(EV_ID flag_id, UINT64 bits) {
+ if (!EV_ID_IS_FLAG64(flag_id)) {
+ EV_DEBUG_ERR("set_flag: %x is not a valid flag_id.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ EV_Flag64 flag;
+ flag.flagID = flag_id;
+ flag.bits = bits;
+
+ int ret = ioctl(fd, EVK_IOC_STORE_FLAG64, &flag);
+ int myerrno = errno;
+ close(fd);
+
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_ERR("set_flag: No such flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ errno = myerrno;
+ EV_perror("set flag");
+ return EV_ERR_Fatal;
+ }
+
+ return EV_OK;
+}
+
+/** @brief Send Messaging Event
+ *
+ * Send a message event to the specified queue ID.
+ *
+ * @param queue_id [IN] Queue ID
+ * @param bytes [IN] Bytes to send
+ * @param buf [IN] Pointer to the byte sequence to send
+ * @param senderInfo [IN] Source info
+ * Specify this option to identify applications, etc.
+ * When not used, specify 0.
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Message event queue with specified ID does not exist
+ * @retval EV_ERR_Busy: Queue overflow
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_send_message(EV_ID queue_id, UINT16 bytes, const void *buf, UINT32 senderInfo) {
+ EV_assert(buf != NULL);
+ EV_assert(bytes <= EV_MAX_MESSAGE_LENGTH);
+ if (!EV_ID_IS_QUEUE(queue_id)) {
+ EV_DEBUG_ERR("send_message: %x is not a valid queue_id.\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+
+ /*
+ * Open fd at the first time of send_message in process,
+ * and continue to use the fd with it open after that.
+ * Reason:
+ * - Prevent frequent use of open/close system calls.
+ * - If the process is nonresident, the fd is close after the process is terminated.
+ * - Even for resident processes, there is no problem because processes
+ * that use event library normally continue to use event library
+ * from the beginning to the end.
+ */
+ static int fd = -1;
+ EV_PROCESS_MUTEX_LOCK;
+ if (fd < 0) {
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function open
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ EV_PROCESS_MUTEX_UNLOCK; // LCOV_EXCL_LINE 5: fail safe for glibc function open
+ return EV_ERR_Fatal; // LCOV_EXCL_LINE 5: fail safe for glibc function open
+ }
+ fcntl(fd, F_SETFD, FD_CLOEXEC|(fcntl(fd, F_GETFD, 0)));
+ }
+
+ EV_Message msg;
+ msg.queueID = queue_id;
+ msg.senderInfo = senderInfo;
+ msg.length = bytes;
+ memcpy(msg.message, buf, bytes);
+
+ int ret = ioctl(fd, EVK_IOC_STORE_MESSAGE, &msg);
+ int myerrno = errno;
+ EV_PROCESS_MUTEX_UNLOCK;
+
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_WARNING("send_message: No such queue_id %x.\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ } else if (myerrno == EBUSY) {
+ EV_DEBUG_WARNING("send_message: queue_id %x returned BUSY.\n", queue_id);
+ return EV_ERR_Busy;
+ }
+
+ errno = myerrno;
+ EV_perror("send message");
+ return EV_ERR_Fatal;
+ }
+
+ return EV_OK;
+}
+
+/** @brief Get fd for poll flag event
+ *
+ * Get file descriptor (FD) that used to wait for a flag
+ * with the specified ID in a poll/select.
+ * Only flags created by invoked process can be specified.
+ *
+ * This FD can only be used to specify a poll/select.
+ * Subsequent operations are not guaranteed if any other operations are performed.
+ * When use poll, only POLLIN can be specified in events.
+ * When use select, you can only check if it is readable.
+ *
+ * If the same flag_id is called more than once,
+ * The same FD is returned each time (unless there is a destroy/create during that time).
+ *
+ * - differences in kernel versions
+ * - This API is not provided in the EVK.
+ *
+ * @note If the flag is deleted during poll/select using the FD gotten by the API,
+ * the poll/select is exited.
+ * POLLERR is set as event for poll.
+ *
+ * @param flag_id [IN] Flag ID
+ * @param fd [OUT] Pointer to the area to store the file descriptor
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: An invalid flag ID was specified.
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_flag_fd(EV_ID flag_id, int *fd) {
+ EV_assert(fd != NULL);
+ *fd = -1;
+ if ((!EV_ID_IS_FLAG(flag_id))&& (!EV_ID_IS_FLAG64(flag_id))) {
+ EV_DEBUG_ERR("get_flag_fd: %x is not a valid flag_id.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ *fd = find_ev_info(EV_SEARCH_ALL_THREAD, flag_id);
+ if (*fd < 0) {
+ EV_DEBUG_ERR("You have not created flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ return EV_OK;
+}
+
+/** @brief Get fd for message event queue poll
+ *
+ * Get file descriptor (FD) that used to wait for a queue
+ * with the specified ID in a poll/select.
+ * Only message event queues created by invoked process can be specified.
+ *
+ * This FD can only be used to specify a poll/select.
+ * Subsequent operations are not guaranteed if any other operations are performed.
+ * When use poll, only POLLIN can be specified in events.
+ * When use select, you can only check if it is readable.
+ *
+ * If the same queue_id is called more than once,
+ * The same FD is returned each time (unless there is a destroy/create during that time).
+ *
+ * - differences in kernel versions
+ * - This API is not provided in the EVK.
+ *
+ * @note If the queue is deleted during poll/select using the FD gotten by the API,
+ * the poll/select is exited.
+ * POLLERR is set as event for poll.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param fd [OUT] Pointer to the area to store the file descriptor
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: An invalid flag ID was specified.
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_queue_fd(EV_ID queue_id, int *fd) {
+ EV_assert(fd != NULL);
+ *fd = -1;
+ if (!EV_ID_IS_QUEUE(queue_id)) {
+ EV_DEBUG_ERR("get_queue_fd: %x is not a valid queue_id.\n",
+ queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ *fd = find_ev_info(EV_SEARCH_ALL_THREAD, queue_id);
+ if (*fd < 0) {
+ EV_DEBUG_ERR("You have not created queue_id %x.\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+ return EV_OK;
+}
+
+/* \~english Functions that specify the module ID (16 bits) instead of the flag ID and queue ID */
+EV_ID EV_moduleID_to_flagID(UINT16 mID)
+{
+ return EV_Flag_ID_Base(mID);
+}
+
+EV_ID EV_moduleID_to_flag64ID(UINT16 mID)
+{
+ return EV_Flag64_ID_Base(mID);
+}
+
+EV_ID EV_moduleID_to_queueID(UINT16 mID)
+{
+ return EV_Queue_ID_Base(mID);
+}
+
+EV_ERR EV_create_flag_by_mID(UINT16 mID)
+{
+ return EV_create_flag(EV_moduleID_to_flagID(mID));
+}
+
+EV_ERR EV_create_flag64_by_mID(UINT16 mID)
+{
+ return EV_create_flag64(EV_moduleID_to_flag64ID(mID));
+}
+
+EV_ERR EV_create_queue_by_mID(UINT16 mID, UINT8 length,UINT16 max_bytes,
+ EV_Message_Queue_Type type)
+{
+ return EV_create_queue(EV_moduleID_to_queueID(mID), length, max_bytes, type);
+}
+
+EV_ERR EV_destroy_flag_by_mID(UINT16 mID)
+{
+ return EV_destroy_flag(EV_moduleID_to_flagID(mID));
+}
+
+EV_ERR EV_destroy_queue_by_mID(UINT16 mID)
+{
+ return EV_destroy_queue(EV_moduleID_to_queueID(mID));
+}
+
+EV_ERR EV_set_flag_by_mID(UINT16 mID, UINT32 bits)
+{
+ return EV_set_flag(EV_moduleID_to_flagID(mID), bits);
+}
+
+EV_ERR EV_set_flag64_by_mID(UINT16 mID, UINT64 bits)
+{
+ return EV_set_flag64(EV_moduleID_to_flag64ID(mID), bits);
+}
+
+EV_ERR EV_send_message_by_mID(UINT16 mID, UINT16 bytes, const void *message,
+ UINT32 senderInfo)
+{
+ return EV_send_message(EV_moduleID_to_queueID(mID),
+ bytes, message, senderInfo);
+}
+/** @} */
diff --git a/otherservice/other_service.mk b/otherservice/other_service.mk
new file mode 100755
index 0000000..85a2f2c
--- /dev/null
+++ b/otherservice/other_service.mk
@@ -0,0 +1,42 @@
+#############################################################
+#
+# Common Makefile for other_service
+# Copyright (C) 2017-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := other_service
+
+#############################################################
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/otherservice/posix_based_os001_legacy_library/LICENSE b/otherservice/posix_based_os001_legacy_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/otherservice/posix_based_os001_legacy_library/Makefile.client b/otherservice/posix_based_os001_legacy_library/Makefile.client
new file mode 100755
index 0000000..4192704
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/Makefile.client
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+SUBDIRS := library
+
+include ../other_service.mk
diff --git a/otherservice/posix_based_os001_legacy_library/library/Makefile b/otherservice/posix_based_os001_legacy_library/library/Makefile
new file mode 100755
index 0000000..874a431
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/Makefile
@@ -0,0 +1,48 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+INST_SHLIBS = libPosixBasedOS001legacy
+
+VPATH = ./src ./include/$(COMPONENT_NAME)/
+INST_HEADERS = strlcat.h strlcpy.h \
+itoa.h \
+PosixBasedOS001TimeApi.h \
+PosixBasedOS001ClockCycleApi.h \
+ultoa.h \
+posix_based_os001_legacy_library.h
+
+libPosixBasedOS001legacy_SRCS += strlcat.c strlcpy.c \
+itoa.c \
+PosixBasedOS001TimeApi.c \
+PosixBasedOS001ClockCycleApi.c \
+ultoa.c
+
+CPPFLAGS = -I./include
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wpointer-to-int-cast
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+
+
+include ../../other_service.mk
diff --git a/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h b/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h
new file mode 100755
index 0000000..2c3fb44
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h
@@ -0,0 +1,83 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_CLOCK_CYCLE_API_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_CLOCK_CYCLE_API_H_ // NOLINT(build/header_guard)
+
+#include <stdint.h>
+
+/******************************************************************************/
+/* define */
+
+/******************************************************************************/
+/* typedef */
+
+/******************************************************************************/
+/* struct */
+
+
+/******************************************************************************/
+/* function */
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file PosixBasedOS001ClockCycleApi.h
+ * @brief \~english This file provides ClockCycle API to get number of clock cycles.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ClockCycle
+/// \~english @par Brief
+/// Get the number of clock cycles.
+/// \~english @retval Microsecond
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+uint64_t ClockCycle(void);
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_CLOCK_CYCLE_API_H_
diff --git a/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h b/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h
new file mode 100755
index 0000000..616bda4
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// libraries for replacing PosixBasedOS001 to Linux
+// PosixBasedOS001TimeApi.h
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_TIMEAPI_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_TIMEAPI_H_ // NOLINT(build/header_guard)
+
+#include <sys/types.h>
+
+/*******************************************************************************/
+/* define */
+
+/*******************************************************************************/
+/* typedef */
+
+/*******************************************************************************/
+/* struct */
+
+/*******************************************************************************/
+/* function */
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file PosixBasedOS001TimeApi.h
+ * @brief \~english This file provides delay API to delay for the specified time.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup delay
+/// \~english @par Brief
+/// Delay for the specified time.
+/// \~english @param [in] duration
+/// unsigned int - The number of milliseconds for which to suspend the calling thread from execution
+/// \~english @retval EOK
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Detail
+/// If duration is more than 1000 milliseconds, return immediately.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+unsigned int delay(unsigned int duration); // NOLINT(readability/nolint)
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_TIMEAPI_H_
diff --git a/otherservice/posix_based_os001_legacy_library/library/include/other_service/itoa.h b/otherservice/posix_based_os001_legacy_library/library/include/other_service/itoa.h
new file mode 100755
index 0000000..4f26634
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/include/other_service/itoa.h
@@ -0,0 +1,74 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ITOA_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ITOA_H_ // NOLINT(build/header_guard)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file itoa.h
+ * @brief \~english This file provides itoa API to convert integer value to null terminated string
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup itoa
+/// \~english @par Brief
+/// Integer value to null terminated string.
+/// \~english @param [in] value
+/// int - value Number to convert
+/// \~english @param [out] buff
+/// char - buff Result string
+/// \~english @param [in] radix
+/// int - radix Radix of value
+/// \~english @retval String pointer
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+char* itoa(int value, char buff[], int radix); // NOLINT(readability/nolint)
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ITOA_H_
diff --git a/otherservice/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h b/otherservice/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h
new file mode 100755
index 0000000..188cb01
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english include all posix_based_os001_legacy_library head files
+ */
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_H_ // NOLINT(build/header_guard)
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <other_service/PosixBasedOS001TimeApi.h>
+#include <other_service/itoa.h>
+#include <other_service/strlcat.h>
+#include <other_service/strlcpy.h>
+#include <other_service/ultoa.h>
+
+
+/** @}*/ // posix_based_os001_legacy_library
+/** @}*/ // other_service
+/** @}*/ // BaseSystem
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_H_
diff --git a/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcat.h b/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcat.h
new file mode 100755
index 0000000..d42c136
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcat.h
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCAT_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCAT_H_ // NOLINT(build/header_guard)
+
+#include <strings.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file strlcat.h
+ * @brief \~english This file provides strlcat API to concatenate strings
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup strlcat
+/// \~english @par Brief
+/// Concatenate strings
+/// \~english @param [in/out] dst
+/// char * - Destination string
+/// \~english @param [in] src
+/// const char * - Concatenated string
+/// \~english @param [in] siz
+/// size_t - Size of dst
+/// \~english @retval String length after concatenation
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// Appends src to string dst of size siz (unlike strncat, siz is the full size of dst, not space left).
+/// At most siz-1 characters will be copied. Always NUL terminates (unless siz <= strlen(dst)).
+/// Returns strlen(src) + MIN(siz, strlen(initial dst)). If retval >= siz, truncation occurred.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+size_t strlcat(char *dst, const char *src, size_t siz); // NOLINT(readability/nolint)
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCAT_H_
diff --git a/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h b/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h
new file mode 100755
index 0000000..14c51fe
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCPY_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCPY_H_ // NOLINT(build/header_guard)
+
+#include <strings.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file strlcpy.h
+ * @brief \~english This file provides API to copy string
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup strlcpy
+/// \~english @par Brief
+/// Copy string
+/// \~english @param [in/out] dst
+/// char * - Destination string
+/// \~english @param [in] src
+/// const char * - Copy string
+/// \~english @param [in] siz
+/// size_t - Size of dst
+/// \~english @retval Length of copied character string
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// Copy src to string dst of size siz. At most siz-1 characters will be copied.
+/// Always NUL terminates (unless siz == 0).
+/// Returns strlen(src); if retval >= siz, truncation occurred.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+size_t strlcpy(char *dst, const char *src, size_t siz); // NOLINT(readability/nolint)
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCPY_H_
diff --git a/otherservice/posix_based_os001_legacy_library/library/include/other_service/ultoa.h b/otherservice/posix_based_os001_legacy_library/library/include/other_service/ultoa.h
new file mode 100755
index 0000000..2291f1a
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/include/other_service/ultoa.h
@@ -0,0 +1,74 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ULTOA_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ULTOA_H_ // NOLINT(build/header_guard)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file ultoa.h
+ * @brief \~english This file provides ultoa API to convert unsigned long type to NULL terminated character string
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ultoa
+/// \~english @par Brief
+/// Convert unsigned long type to NULL terminated character string.
+/// \~english @param [in] value
+/// int - value Number to convert
+/// \~english @param [out] buff
+/// char - buff Result string
+/// \~english @param [in] radix
+/// int - radix Radix of value
+/// \~english @retval String pointer
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Detail
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+char *ultoa(unsigned long value, char *buf, int radix); // NOLINT (readability/nolint)
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ULTOA_H_
diff --git a/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c b/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c
new file mode 100755
index 0000000..b4e73c5
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c
@@ -0,0 +1,56 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <time.h>
+
+/******************************************************************************/
+/*
+Overview :GetTickCount() like Win32 API
+Arguments :void
+Return :OK:usec NG:0
+Note :
+*/
+static uint64_t GetTickCount(void )
+{
+ struct timespec tp;
+ /*--------------------------------------------------------------------*/
+
+ if(clock_gettime(CLOCK_MONOTONIC, &tp) != 0) // LCOV_EXCL_BR_LINE 5: fail safe for libc clock_gettime
+ {
+ return 0;
+ }
+
+ return (uint64_t)(tp.tv_sec * 1000000 + tp.tv_nsec / 1000);
+}
+
+
+/******************************************************************************/
+/*
+Overview :Get the number of clock cycles
+Arguments :void
+Return :OK:usec NG:0
+Note :
+*/
+uint64_t ClockCycle( void )
+{
+ return GetTickCount();
+}
+
+/******************************************************************************/
+/* End of souce code.*/
+/******************************************************************************/
+
diff --git a/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c b/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c
new file mode 100755
index 0000000..2a1dd72
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// libraries for replacing PosixBasedOS001 to Linux
+// PosixBasedOS001TimeApi.c
+
+#include <other_service/PosixBasedOS001TimeApi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <unistd.h> // for using usleep()
+#include <time.h> // for using clock()
+
+// delay()
+// NOTE: Control a device
+// duration
+// The number of milliseconds for which to suspend the calling thread from execution.
+//
+// _CWORD72_ doesnot use return code of delay, and sets 1,100,and 1000.
+unsigned int delay( unsigned int duration ){
+
+ int ret;
+ useconds_t duration_usec = duration * 1000;
+
+ ret = EOK;
+
+ if( duration_usec > 1000000 ){
+ printf("delay():over flow!\n");
+ }else{
+
+ // using usec order
+ ret = usleep(duration_usec);
+
+ // error of usleep() = 0(E_OK), -1(ERROR)
+ // delay() cannot return error code. [data type unmatch]
+ if(ret < 0){ // LCOV_EXCL_BR_LINE 5: fail safe for libc function usleep
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("delay():error!\n"); // LCOV_EXCL_LINE 5: fail safe for libc function usleep
+ }
+ }
+
+ return EOK;
+}
diff --git a/otherservice/posix_based_os001_legacy_library/library/src/itoa.c b/otherservice/posix_based_os001_legacy_library/library/src/itoa.c
new file mode 100755
index 0000000..49a24bf
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/src/itoa.c
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+char* itoa( int value, char buff[], int radix ) {
+ static const char table[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+ char *head = buff;
+ char *tail = buff;
+ char temp;
+
+ // Converting minus sign to character
+ if ( value < 0 ){
+ *tail++ = '-';
+ value = -value;
+ }
+ // Converting integer to character
+ if ( value == 0 ){
+ *tail++ = '0';
+ }
+ else for ( head = tail ; value != 0 ; value /= radix ){
+ *tail++ = table[ value % radix ];
+ }
+ *tail = '\0';
+
+ // swapping characters
+ for ( tail-- ; head < tail ; head++, tail-- ){
+ temp = *head;
+ *head = *tail;
+ *tail = temp;
+ }
+
+ return buff;
+}
diff --git a/otherservice/posix_based_os001_legacy_library/library/src/strlcat.c b/otherservice/posix_based_os001_legacy_library/library/src/strlcat.c
new file mode 100755
index 0000000..8d11eab
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/src/strlcat.c
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+size_t
+strlcat(char *dst, const char *src, size_t size)
+{
+ size_t dstsize, srcsize, copysize;
+
+ dstsize = strnlen(dst, size);
+ srcsize = strlen(src);
+ if (dstsize == size) {
+ return dstsize + srcsize;
+ }
+
+ copysize = size - dstsize - 1;
+ if (srcsize < copysize) {
+ copysize = srcsize;
+ }
+
+ memcpy(dst + dstsize, src, copysize);
+ dst[dstsize + copysize] = '\0';
+
+ return dstsize + srcsize;
+}
diff --git a/otherservice/posix_based_os001_legacy_library/library/src/strlcpy.c b/otherservice/posix_based_os001_legacy_library/library/src/strlcpy.c
new file mode 100755
index 0000000..f440c0e
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/src/strlcpy.c
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+/*
+ * Copy src to string dst of size siz. At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+size_t
+strlcpy(char *dst, const char *src, size_t siz)
+{
+ char *d = dst;
+ const char *s = src;
+ size_t n = siz;
+
+ /* Copy as many bytes as will fit */
+ if (n != 0) {
+ while (--n != 0) {
+ if ((*d++ = *s++) == '\0')
+ break;
+ }
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++)
+ ;
+ }
+
+ return (size_t)(s - src - 1); /* count does not include NUL */
+}
diff --git a/otherservice/posix_based_os001_legacy_library/library/src/ultoa.c b/otherservice/posix_based_os001_legacy_library/library/src/ultoa.c
new file mode 100755
index 0000000..1984246
--- /dev/null
+++ b/otherservice/posix_based_os001_legacy_library/library/src/ultoa.c
@@ -0,0 +1,33 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+
+char *ultoa(unsigned long value, char *buf, int radix)
+{
+ const static char c[] = "0123456789abcdef";
+ char b[65];
+ char *p = b + sizeof(b);
+
+ *--p ='\0';
+ do {
+ *--p = c[value % (unsigned int)radix];
+ value /= (unsigned int)radix;
+ } while (value);
+ strcpy(buf, p);
+
+ return buf;
+}
diff --git a/otherservice/rpc_library/LICENSE b/otherservice/rpc_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/otherservice/rpc_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/otherservice/rpc_library/Makefile.client b/otherservice/rpc_library/Makefile.client
new file mode 100755
index 0000000..36a4dee
--- /dev/null
+++ b/otherservice/rpc_library/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := tool_for_arm library
+
+include ../other_service.mk
diff --git a/otherservice/rpc_library/library/Makefile b/otherservice/rpc_library/library/Makefile
new file mode 100755
index 0000000..75c734a
--- /dev/null
+++ b/otherservice/rpc_library/library/Makefile
@@ -0,0 +1,46 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+INST_SHLIBS := librpc
+librpc_SRCS := rpc_lib.c \
+ rpc_marshall.c \
+ rpc_event.c \
+ rpc_udp.c \
+ rpc_thread.c
+
+CPPFLAGS = -I../tool \
+ -I./include \
+ -D_GNU_SOURCE \
+
+CPPFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wpointer-to-int-cast
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS := -lrt -lcommon
+
+
+VPATH = ./src ./include/$(COMPONENT_NAME)
+INST_HEADERS := rpc.h \
+ rpc_id.h \
+ rpc_library.h \
+
+include ../../other_service.mk
diff --git a/otherservice/rpc_library/library/include/other_service/rpc.h b/otherservice/rpc_library/library/include/other_service/rpc.h
new file mode 100755
index 0000000..f669331
--- /dev/null
+++ b/otherservice/rpc_library/library/include/other_service/rpc.h
@@ -0,0 +1,765 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc.h
+ * @brief \~english RPC library --API define header file
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rpc_library
+ * @ingroup other_service
+ * @{
+ */
+#ifndef OTHERSERVICE_RPC_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPC_H_ // NOLINT(build/header_guard)
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <other_service/rpc_id.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+* @brief \~english RPC_ID max number
+*/
+#define RPC_MAX_THREADS_IN_PROCESS 64
+
+/** @brief \~english fd max number in one process.
+ * 0 = main/sub thread communication pipe fd.
+ * 1 = inotify() process listen fd.
+ * 2~129 = even num : API request data socket.
+ * odd num : secure stream socket.
+ * */
+#define RPC_MAX_FD_IN_PROCESS 130
+
+
+#define RPC_MAX_API_ARG_NUM 8
+///< \~english API call parameter max num
+
+
+#define RPC_MAX_API_ARG_SIZE 1024
+///< \~english API call one parameter max byte
+
+#define RPC_MAX_API_ARG_TOTAL_SIZE 1500
+///< \~english API call all parameter max byte
+
+#define RPC_MAX_APICALL_QUEUE 16
+///< \~english API call max queue num
+
+#define RPC_NO_PORT 0
+///< \~english invalid port num
+
+/** @brief \~english RPC library function return value
+ */
+enum rpc_result { // NOLINT (readability/nolint)
+ RPC_OK = 0, ///< \~english ok
+ RPC_ERR_No_Response = 0x8fff0000, ///< \~english has no response
+ RPC_ERR_Timeout, ///< \~english timeout
+ RPC_ERR_Busy, ///< \~english busy
+ RPC_ERR_API_Error, ///< \~english API error
+ RPC_ERR_API_Fatal, ///< \~english API fatal
+ RPC_ERR_Fatal, ///< \~english fatal
+ RPC_ERR_Configuration, ///< \~english configuration
+ RPC_ERR_Server_DeadLock, ///< \~english server deadlock
+ RPC_ERR_Server_Finish, ///< \~english server finish
+ RPC_ERR_Reject_connect, ///< \~english reject connect
+};
+/** @brief \~english RPC library function return type
+ * @see rpc_result
+ * */
+typedef INT32 RPC_Result;
+
+/** @brief \~english RPC ID
+ *
+ */
+typedef UINT32 RPC_ID;
+
+#define RPC_NO_ID RPC_NO_PORT
+///< \~english The ID when destination is invalid
+
+#define RPC_SELF_ID RPC_NO_PORT
+///< \~english The ID when destination is self
+
+/** @brief \~english The ID when destination is any
+ * */
+#define RPC_ANY_ID RPC_NO_PORT
+
+
+typedef RPC_Result (*RPC_dispatch_func_t)(UINT16 api_num,
+ const char *args_string,
+ unsigned int args_size,
+ char **ret_string,
+ unsigned int *ret_bytes);
+
+#ifdef RPC_DISPATCH_FUNC
+#error "Please include <rpc.h> before \"*_srvr.h\"."
+#else /* !RPC_DISPATCH_FUNC */
+#define RPC_DISPATCH_FUNC NULL
+#endif /* !RPC_DISPATCH_FUNC */
+
+/* RPC Library Start Function Macro */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_START_SERVER
+/// \~english @par Brief
+/// server start(certification of the client by UID)
+/// \~english @param [in] ID
+/// RPC_ID - program's RPC_ID
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Case of an input parameter error
+/// - Case of fail to information generation
+/// - When RPC_start has already been issued
+/// - Case of space reservation fails
+/// - Case of socket generation fails
+/// - Case of socket allocation fails
+/// - Case of creating a pipe fails
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - Used when the server program of RPC-API performs RPC library use start processing
+/// - ID specifies a symbol in the form of XXX_RPC_ID defined by rpc_id.h
+/// - Only one server program is permitted per thread
+/// - When the server program calls the API as a client of another server,
+/// it only needs to call RPC_START_SERVER, there is no need to call RPC_START_CLIENT
+/// \~english @see RPC_start, RPC_end
+////////////////////////////////////////////////////////////////////////////////////
+#define RPC_START_SERVER(ID) RPC_start((ID), RPC_DISPATCH_FUNC, NULL, NO_SECURE_CHECK)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_START_SECURE_SERVER
+/// \~english @par Brief
+/// server start(certification of the client by UID)
+/// \~english @param [in] ID
+/// RPC_ID - program's RPC_ID
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Case of an input parameter error
+/// - Case of fail to information generation
+/// - When RPC_start has already been issued
+/// - Case of space reservation fails
+/// - Case of socket generation fails
+/// - Case of socket allocation fails
+/// - Case of creating a pipe fails
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - Used when the server program of RPC-API performs RPC library use start processing
+/// - ID specifies a symbol in the form of XXX_RPC_ID defined by rpc_id.h
+/// - Only one server program is permitted per thread
+/// - When the server program calls the API as a client of another server,
+/// it only needs to call RPC_START_SERVER, there is no need to call RPC_START_CLIENT
+/// \~english @see RPC_start, RPC_end
+////////////////////////////////////////////////////////////////////////////////////
+#define RPC_START_SECURE_SERVER(ID) RPC_start((ID), RPC_DISPATCH_FUNC, NULL, NEED_SECURE_CHECK)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_START_CLIENT
+/// \~english @par Brief
+/// client start
+/// \~english @param [out] pID
+/// RPC_ID * - auto allocated program's RPC_ID
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - input parameter error
+/// - Unable to get the rpc lib info for the self-thread.
+/// - Memory allocation fail for id info.
+/// - Socket generation fail.
+/// - Socket allocation fail.
+/// - Unable to get the socket name.
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - This macro supports only client function of RPC library.
+/// - Run the start processing by using this macro only when the APIs provided by the other program are called.
+/// \~english @see RPC_start, RPC_end
+////////////////////////////////////////////////////////////////////////////////////
+#define RPC_START_CLIENT(pID) RPC_start((UINT16)RPC_NO_ID, NULL, (pID), NO_SECURE_CHECK)
+//!< \~english client start
+
+/* Client authentication by registering the server's UID list */
+#define NEED_SECURE_CHECK 1 ///< \~english has secure check
+#define NO_SECURE_CHECK 0 ///< \~english has no secure check
+
+/* Setting whether to register UID list of server */
+#define REGISTERED 1 ///< \~english registered
+#define NO_REGISTERED 0 ///< \~english not registered
+
+/* API Function Prototypes in the RPC Library */
+RPC_Result RPC_start(RPC_ID id, RPC_dispatch_func_t func, RPC_ID *pID, INT32 secure_check); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_get_fd
+/// \~english @par Brief
+/// Get the file descriptor to judge whether there is the request of RPC-API call or not.
+/// \~english @param [in] id
+/// RPC_ID - server program's RPC_ID
+/// \~english @param [out] fd
+/// int * - area for fd
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// RPC_START_SERVER or RPC_START_SECURE_SERVER is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Argument(id) is RPC_NO_ID.
+/// - Argument(fd) is NULL.
+/// - Unable to get the rpc lib info for the self-thread.
+/// - RPC sub thread doesn't exist.
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - This function returns the fd(file descriptor) to judge whether there is the request to server.
+/// - Return value(fd) is used only for poll function or select function parameter.
+/// - Usage
+/// - To get fd from this function.
+/// - Wait for the data to use poll function or select function.
+/// - After that, call RPC_process_API_request function.
+/// - As a result, the API call request from client is done(that is, run the server API).
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_get_fd(RPC_ID id, int *fd); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_process_API_request
+/// \~english @par Brief
+/// Run the processing of RPC-API call
+/// \~english @param [in] id
+/// RPC_ID - server program's RPC_ID
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// RPC_START_SERVER or RPC_START_SECURE_SERVER is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Argument(id) is RPC_NO_ID.
+/// - Unable to get the rpc lib info for the self-thread.
+/// - RPC sub thread doesn't exist.
+/// - fail to send UDP packet.
+/// - API processing from the client returns the error.
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - Process all the queued API running requests from the client.
+/// - API function of server program is called in this function.
+/// - If there are no requests to run API, this function doesn't wait and return immediately.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_process_API_request(RPC_ID id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_end
+/// \~english @par Brief
+/// End processing of RPC library.
+/// \~english @param [in] id
+/// RPC_ID - program's RPC_ID
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// RPC_START_SERVER or RPC_START_SECURE_SERVER or RPC_START_CLIENT is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - End processing(socket close and memory release etc) is done.
+/// - When there are no more program that uses RPC_ID, RPC sub thread started by RPC_start will be ended.
+/// - Need to call this function before the program is ended.
+/// - Need to call this function from which the thread called RPC_start.
+/// - Nothing is done when incorrect or no more used RPC_ID is designated.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+void RPC_end(RPC_ID id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_end_all
+/// \~english @par Brief
+/// End processing of RPC library(forcing to clean up).
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Delete the socket files created in process for communication. /n
+/// The program which use RPC library must call RPC_end() to free resource, /n
+/// This API is used for insurance processing when socket file's link lost. /n
+/// 1,Before process ends, call this API. /n
+/// When process is ending, auto running socket's close and memory free is not work. /n
+/// 2,After called this API, all the RPC's process(both server and client) become to useless. /n
+/// Even if after called this API, call RPC_START to repair it also can't make sure to active. /n
+/// RPC library which use Unix autobind is nothing to do. /n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+void RPC_end_all(void); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_set_API_timeout
+/// \~english @par Brief
+/// Set timeout time for server side API processing time
+/// \~english @param [in] sec
+/// INT32 - timeout time
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @retval RPC_ERR_Configuration Argument is out of range
+/// \~english @par Prerequisite
+/// RPC_START_SERVER or RPC_START_SECURE_SERVER is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Unable to get the rpc lib info for the self-thread.
+/// - Server id info doesn't exist.
+/// - Info for API call reception processing doesn't exist.
+/// - RPC_ERR_Fatal
+/// - The value of the argument(sec) is out of range.
+/// - RPC_ERR_Configuration
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_set_API_timeout(INT32 sec); // NOLINT (readability/nolint)
+
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_is_server_ready
+/// \~english @par Brief
+/// Return RPC server's status
+/// \~english @param [in] id
+/// RPC_ID - server program's RPC_ID
+///
+/// \~english @retval RPC_OK : Success
+/// \~english @retval RPC_ERR_No_Response : No response
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// return the server's work status.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_is_server_ready(RPC_ID id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_regist_credential
+/// \~english @par Brief
+/// Register UID and GID list
+/// \~english @param [in] uid_num
+/// int - UID number to regist(number of elements of UID list)
+/// \~english @param [in] uid_list
+/// uid_t* - head pointer of UID list
+/// \~english @param [in] gid_num
+/// int - GID number to regist(number of elements of GID list)
+/// \~english @param [in] uid_list
+/// gid_t* - head pointer of GID list
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @retval RPC_ERR_Configuration Argument is out of range
+/// \~english @par Prerequisite
+/// RPC_START_SECURE_SERVER is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Unable to get the rpc lib info for the self-thread.
+/// - Server id info doesn't exist.
+/// - Info for API call reception processing doesn't exist.
+/// - Arguments(client_uid and client_gid) are NULL.
+/// - Client authentication check is not necessary.
+/// - Authentication info is already registered.
+/// - Memory allocation fail for UID and GID lists.
+/// - RPC_ERR_Fatal
+/// - Values of Arguments(uid_num and gid_num) are out of range.
+/// - RPC_ERR_Configuration
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - Register the UID and GID lists acceptable by the RPC server.
+/// - If RPC_START_SECURE_SERVER is not called, this function returns the error.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_regist_credential(int uid_num, uid_t *uid_list, int gid_num, gid_t *gid_list); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_get_client_credential
+/// \~english @par Brief
+/// Get UID and GID of client that requested to run APIs processing
+/// \~english @param [out] client_uid
+/// uid_t* - UID of client that requested to run APIs processing
+/// \~english @param [out] client_gid
+/// gid_t* - GID of client that requested to run APIs processing
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// RPC_START_SECURE_SERVER is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Server id info doesn't exist.
+/// - Info for API call reception processing doesn't exist.
+/// - Arguments(client_uid and client_gid) are NULL.
+/// - Client authentication check is not necessary.
+/// - There are no running clients.
+/// - Info for the running client is not applicable.
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - This function is to get UID and GID of client that requested to run APIs processing.
+/// - If RPC_START_SECURE_SERVER is not called, this function returns the error.
+/// - If the running client doesn't exist, this function returns the error.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_get_client_credential(uid_t *client_uid, gid_t *client_gid); // NOLINT (readability/nolint)
+
+/*
+ * The following are only used in stub files
+ */
+#define RPC_RETCODE_LEN 9
+
+#define RPC_MARSHALL_FLAG_BITS_CODE 12
+#define RPC_MARSHALL_FLAG_BITS_IS_VARARRAY 1
+#define RPC_MARSHALL_FLAG_BITS_IS_POINTER 1
+#define RPC_MARSHALL_FLAG_BITS_IN_OUT 2
+
+/** @brief \~english APIcall property stored struct
+ *
+ */
+typedef union {
+ UINT32 all; ///< \~english all property
+ struct {
+ unsigned int code: RPC_MARSHALL_FLAG_BITS_CODE; ///< \~english value type
+ /** @brief \~english vararray or not
+ *
+ */
+ unsigned int is_vararray: RPC_MARSHALL_FLAG_BITS_IS_VARARRAY;
+ /** @brief \~english pointer or not
+ *
+ */
+ unsigned int is_pointer: RPC_MARSHALL_FLAG_BITS_IS_POINTER;
+ /** @brief \~english in/out parameter property
+ *
+ */
+ unsigned int in_out: RPC_MARSHALL_FLAG_BITS_IN_OUT;
+ /** @brief \~english string or user define type byte num.other is 0
+ *
+ */
+ UINT16 bytes;
+ } bits; ///< \~english variable properties
+} RPC_marshall_flag;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_API_call
+/// \~english @par brief
+/// API call execution function (client)
+/// \~english @param [in] id
+/// RPC_ID - RPC_ID of server program
+/// \~english @param [in] api_num
+/// UINT16 - Request API number
+/// \~english @param [in] args_string
+/// const char* - Argument string
+/// \~english @param [in] args_size
+/// unsigned int - Argument string length
+/// \~english @param [out] ret_string
+/// char** - Process result string
+/// \~english @param [out] ret_size
+/// unsigned int* - Process result string length
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal error
+/// \~english @retval RPC_ERR_No_Response No response
+/// \~english @retval RPC_ERR_Busy API call queue overflow
+/// \~english @retval RPC_ERR_Server_DeadLock RPC server deadlock
+/// \~english @retval RPC_ERR_Reject_connect The RPC server does not allow communication
+/// \~english @par Prerequisite
+/// The RPC server is running.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Acquisition of rpc library information for self thread fails
+/// - Generation of self-thread rpc library information fails
+/// - The RPC ID information does not exist
+/// - Failed to receive data from the server at initial authentication
+/// - Analysis of received data failed during initial authentication
+/// - Commands not expected to be received during initial authentication
+/// - Server response when initial authentication is API call error
+/// - Failed to receive data from the server at API processing request
+/// - Analysis of received data failed during API processing request
+/// - Commands not expected to be received during API processing request
+/// - Server response when API processing request is API call error
+/// - Error in server response other than deadlock when processing results are received
+/// - Server shut down
+/// - RPC_ERR_Fatal
+/// - UDP packet transmission fails at initial authentication
+/// - A timeout occurred in response from the server during initial authentication
+/// - UDP packet transmission failed at API processing request
+/// - A timeout occurred in response from the server during API processing request
+/// - RPC_ERR_No_Response
+/// - Server response when initial authentication is API call queue overflow
+/// - Server response when API processing request is API call queue overflow
+/// - RPC_ERR_Busy
+/// - When the server response is deadlocked on initial authentication
+/// - When the server response is deadlocked on API processing request
+/// - Server response is deadlocked when processing result is received
+/// - RPC_ERR_Server_DeadLock
+/// - Server response is not authenticated at initial authentication
+/// - RPC_ERR_Reject_connect
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - Request execution of RPC-API from the client side.
+/// - However, since this API is called from the automatically generated code, it is not used directly by the user.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_API_call(RPC_ID id, UINT16 api_num, // NOLINT (readability/nolint)
+ const char *args_string, unsigned int args_size,
+ char **ret_string, unsigned int *ret_size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_demarshall_arguments
+/// \~english @par Brief
+/// Confirm whether the input character string conforms to the prescribed format.
+/// \~english @param [in] from
+/// const char * - Input string
+/// \~english @param [in] size
+/// unsigned int - Byte length of the input string
+/// \~english @param [in] need_alloc
+/// int - Flag whether memory allocation is necessary or not.
+/// \~english @param [in] num_args
+/// int - Number of the variable length arguments
+/// \~english @param [in] ...
+/// void * - Variable length arguments
+/// \~english @retval 0 Normal End
+/// \~english @retval -1 Abnormal End
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Byte length of the input string is 0 bytes or less or larger than 1024 bytes.
+/// - The input character string doesn't conform to the prescribed format.
+/// - -1
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// This function is used in the stub file only and user must not call this function directly.
+/// \~english @see RPC_marshall_arguments
+////////////////////////////////////////////////////////////////////////////////////
+int RPC_demarshall_arguments(const char *from, unsigned int size, // NOLINT (readability/nolint)
+ int need_alloc, int num_args, ...);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_marshall_arguments
+/// \~english @par Brief
+/// Collect variable arguments, convert them to a format that matches the receiver's specification,
+/// and stuff them into the message buffer.
+/// \~english @param [in] size
+/// unsigned int * - data size after conversion
+/// \~english @param [in] dont_marshall_out_args
+/// int - input/output kind(when the argument is a pointer)
+/// \~english @param [in] num_args
+/// int - value of variable argument
+/// \~english @param [in] ...
+/// void * - variable argument
+/// \~english @retval char * Message buffer after conversion
+/// \~english @retval NULL Abnormal
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - When marshall work securing work area fails
+/// - When the specified type size is abnormal
+/// - When securing the area of the message buffer after conversion fails
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// This function is used in the stub file for client only and user must not call this function directly.
+/// \~english @see RPC_demarshalol_arguments
+////////////////////////////////////////////////////////////////////////////////////
+char *RPC_marshall_arguments(unsigned int *size, int dont_marshall_out_args, // NOLINT (readability/nolint)
+ int num_args, ...);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_marshall_free
+/// \~english @par Brief
+/// Variadic function for memory release
+/// \~english @param [in] num
+/// int - number of memory to be released
+/// \~english @param [in] ...
+/// void * - allocated memory
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - This function is used in the stub file only and user must not call this function directly.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+void RPC_marshall_free(int num, ...); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_free_return_string
+/// \~english @par Brief
+/// release memory allocated during running API call.
+/// \~english @param [in] ptr
+/// void * - allocated memory
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// RPC_API_call is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - This function is used in the stub file for client only and user must not call this function directly.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+void RPC_free_return_string(void *ptr); // NOLINT (readability/nolint)
+
+#ifdef DBG_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_record_dbg_log
+/// \~english @par Brief
+/// RPC-API call process's log
+/// \~english @param [in] filename
+/// const char - filename's point
+/// \~english @param [in] funcname
+/// const char - function name's point
+/// \~english @param [in] line
+/// int - file's line
+/// \~english @param [in] apiname
+/// const char - called API name's point
+/// \~english @param [out]
+///
+/// \~english @retval 0 : Success
+///
+/// \~english @par Prerequisite
+/// - DBG_ENABLE is defined.
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Receipt and record the client's filename, function name,
+/// line and called API's function name which called this API.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int RPC_record_dbg_log(const char *filename, const char *funcname, int line,
+ const char *apiname);
+#endif
+
+#define rpc_malloc malloc
+#define rpc_free free
+
+/*
+ * RPC debug message control
+ * if set to non-null and some critical information is displayed.
+ */
+extern char *RPC_DEBUG; // NOLINT (readability/nolint)
+
+/** @}*/ // end of rpc_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_RPC_H_
diff --git a/otherservice/rpc_library/library/include/other_service/rpc_id.h b/otherservice/rpc_library/library/include/other_service/rpc_id.h
new file mode 100755
index 0000000..e43e03c
--- /dev/null
+++ b/otherservice/rpc_library/library/include/other_service/rpc_id.h
@@ -0,0 +1,96 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_id.h
+ * @brief \~english RPC library -- RPC_ID(port no) define
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rpc_library
+ * @ingroup other_service
+ * @{
+ */
+
+/** @brief \~english define the RPC_ID used by program
+ * like #define XXX_RPC_ID ID
+ * but RPC_START_CLIENT() is not necessary
+ *
+ * RPC_ID as the following
+ * - UI Application : 50xxx
+ * - Application Service : 51xxx
+ * + HMI : 511xx
+ * + AV : 512xx
+ * + Radio : 513xx
+ * + Connectivity : 514xx
+ * + Navigation/Location: 515xx
+ * + Vehicle : 516xx
+ * + Communication : 517xx
+ * + BasePF : 518xx
+ * + System : 519xx
+ * + Others : 510xx
+ * - Common Service : 53xxx
+ * - Extension Service : 55xxx
+ * - System/Device Driver : 56xxx
+ *
+ * - 49152~59999 are Reserved.
+ * @note \~english RPC_ID==port num ,
+ * when not call from RPClibrary, and not well-known(~1023)/registered(1024~49151)
+ * use the fixed port num to IP communicate, use 6xxxx port number.
+ * @note \~english when RPC_START_CLIENT,and distribute automatically.
+ * use the linux kernel port distribute function
+ * 1024~4999 as the port num unused.
+ */
+
+#ifndef OTHERSERVICE_RPCID_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPCID_H_ // NOLINT(build/header_guard)
+
+
+#define test_RPC_ID 49999
+///< \~english sample(ID is used by RPClibrary test program)
+
+/* UI Aapplication : 50xxx */
+
+/* Application Service : 51xxx */
+#define MODEMANAGER_RPC_ID 51100 /* ModeManager */
+#define ACTIVITYMANAGER_RPC_ID 51101 /* ActivityManager */
+
+/* Common Service : 53xxx */
+#define TIMERENTRYDRV_RPC_ID 53000 /* TimerEntryDrv */
+#define TSKM_RPC_ID 53001 /* TaskManager */
+#define MSGBRK_RPC_ID 53002 /* MessageBroker */
+#define IPMANAGER_RPC_ID 53003 /* IPManager */
+#define IPMANAGER_RPC_ID 53003 /* IPManager */
+#define DEVICEMANAGER_RPC_ID 53004 /* DeviceManager */
+#define CAN_RPC_ID 53005 /* Communication(CAN) */
+#define _CWORD83__RPC_ID 53006 /* Communication(_CWORD83_) */
+#define SENSOR_RPC_ID 53007 /* Vehicle(Sensor) */
+#define GPS_RPC_ID 53008 /* Vehicle(GPS) */
+#define RESMGR_RPC_ID 53009 /* ResourceManager */
+#define GRAPHICS_RPC_ID 53010 /* Graphic */
+
+/* Extension Service : 55xxx */
+
+/* System/Device Driver : 56xxx */
+/** @}*/ // end of rpc_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#endif // OTHERSERVICE_RPCID_H_
diff --git a/otherservice/rpc_library/library/include/other_service/rpc_library.h b/otherservice/rpc_library/library/include/other_service/rpc_library.h
new file mode 100755
index 0000000..298f741
--- /dev/null
+++ b/otherservice/rpc_library/library/include/other_service/rpc_library.h
@@ -0,0 +1,41 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file
+ * @brief \~english include all rpc_library head files
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rpc_library
+ * @ingroup other_service
+ * @{
+ */
+#ifndef OTHERSERVICE_RPCLIBRARY_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPCLIBRARY_H_ // NOLINT(build/header_guard)
+
+#include <other_service/rpc.h>
+#include <other_service/rpc_id.h>
+
+#endif // OTHERSERVICE_RPCLIBRARY_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/otherservice/rpc_library/library/include/rpc_internal.h b/otherservice/rpc_library/library/include/rpc_internal.h
new file mode 100755
index 0000000..2b293ca
--- /dev/null
+++ b/otherservice/rpc_library/library/include/rpc_internal.h
@@ -0,0 +1,135 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_internal.h
+ * @brief RPC Library Internal Implementation-Type, macro, and function definitions used internally
+ *
+ */
+/** @addtogroup RPClib_in
+ */
+#ifndef OTHERSERVICE_RPCINTERNAL_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPCINTERNAL_H_ // NOLINT(build/header_guard)
+
+#include <unistd.h>
+#include <stdlib.h>
+
+#if defined(__linux__)
+/* Using unix autobind Features That Are Only Available in linux */
+#define RPC_USE_UNIX_AUTOBIND
+#endif /* __linux__ */
+
+#define RPC_USE_SYSLOG
+
+typedef RPC_ID *RPC_ID_p;
+
+#include "rpc_udp.h"
+#include "rpc_thread.h"
+
+RPC_Result RpcQueueAPIRequestBefore(RpcIdInfo *id,
+ UINT32 size, char **buff);
+RPC_Result RpcQueueAPIRequestAfter(RpcIdInfo *id, RPC_ID client,
+ const char *mesg, UINT32 size,
+ char *args);
+void RpcFreeAPIArgsString(char *args_string);
+UINT16 RpcGetAPIRequest(RpcIdInfo *id, RPC_ID_p client,
+ char **args_string, unsigned int *args_size);
+RPC_Result RpcSetAPIcallReturn(RpcIdInfo *id,
+ const char *mesg, UINT32 size);
+void RpcDiscardAPIcallReturn(RpcIdInfo *id);
+
+RPC_Result RpcDeleteSrvrPid(RpcIdInfo *idinfo, RPC_ID srvr_rpc_id, int wd);
+
+#define StrEqual(a, b) (strcmp((a), (b)) == 0)
+#define MemEqual(a, b, c) (memcmp((a), (b), (c)) == 0)
+
+#define RPC_IS_INVALID_ID(a) ((a) == RPC_NO_ID)
+#define RPC_INVALIDATE_ID(a) ((a) = RPC_NO_ID)
+#define RPC_ID_COPY(a, b) ((a) = (b))
+#define RPC_ID_Equal(a, b) ((a) == (b))
+
+/* inotify Events read Sizes */
+#define EVENT_SIZE ( sizeof(struct inotify_event) ) /* One inotify event size */
+#define BUF_LEN (4 * EVENT_SIZE) /* Read sizes */
+
+#define LESS_THAN <
+
+#define SET_NONBLOCK(fd) { \
+ int flag; \
+ flag = fcntl((fd), F_GETFL, 0); \
+ fcntl((fd), F_SETFL, O_NONBLOCK|flag); \
+ }
+
+#define SET_CLOSE_ON_EXEC(fd) { \
+ int flag; \
+ flag = fcntl((fd), F_GETFD, 0); \
+ fcntl((fd), F_SETFD, FD_CLOEXEC|flag); \
+ }
+
+#if defined(RPC_USE_SYSLOG)
+
+#include <syslog.h>
+
+#define RPC_LOG_CRIT(format, arg...) syslog(LOG_CRIT, format "\n", ##arg)
+#define RPC_LOG_ERR(format, arg...) syslog(LOG_ERR, format "\n", ##arg)
+#define RPC_LOG_STATE(format, arg...) syslog(LOG_INFO, format "\n", ##arg)
+#define RPC_LOG_DEBUG(format, arg...) syslog(LOG_DEBUG, format "\n", ##arg)
+
+#else // defined(RPC_USE_SYSLOG)
+
+#define RPC_LOG_CRIT(format, arg...) fprintf(stderr, "[RPC:CRIT](%d): " format "\n", getpid(), ##arg)
+#define RPC_LOG_ERR(format, arg...) fprintf(stderr, "[RPC:ERR](%d): " format "\n", getpid(), ##arg)
+#define RPC_LOG_STATE(format, arg...) fprintf(stderr, "[RPC:STATE](%d): " format "\n", getpid(), ##arg)
+#define RPC_LOG_DEBUG(format, arg...)
+
+#endif // defined(RPC_USE_SYSLOG)
+
+#include <sys/prctl.h>
+
+#define RPC_LOG_ERR_W_NAME(format, arg...) \
+do { \
+ char name[16]; \
+ prctl(PR_GET_NAME, name); \
+ name[15] = '\0'; \
+ RPC_LOG_ERR("(%s): " format, name, ##arg); \
+} while (0)
+
+#define RPC_LOG_PERROR(format, arg...) RPC_LOG_ERR("[%s:%d] %s : " format, __FILE__, __LINE__, strerror(errno), ##arg);
+
+#include <assert.h>
+#define rpc_assert assert
+
+#define BUG_ASSERT(cond, x) \
+ if (!(cond)) { \
+ rpc_assert("BUG ASSERTION! " #x " @ " __FILE__ ==NULL); \
+ }
+#define CONFIG_ASSERT(s) rpc_assert((s) == NULL)
+
+#define RUNS_IN_CALLERS_THREAD
+#define RUNS_IN_READING_THREAD
+
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+
+#define RPC_SOCKET_NAME "/tmp/RPC/%05d"
+
+static inline void
+rpc_set_socket_name(char *str, RPC_ID id) {
+ sprintf(str, RPC_SOCKET_NAME, id); // NOLINT (readability/nolint)
+}
+
+#endif /* !AUTOBIND */
+
+#endif // OTHERSERVICE_RPCINTERNAL_H_
diff --git a/otherservice/rpc_library/library/include/rpc_thread.h b/otherservice/rpc_library/library/include/rpc_thread.h
new file mode 100755
index 0000000..819e5a6
--- /dev/null
+++ b/otherservice/rpc_library/library/include/rpc_thread.h
@@ -0,0 +1,240 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_RPCTHREAD_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPCTHREAD_H_ // NOLINT(build/header_guard)
+
+#include <pthread.h>
+
+/** @addtogroup RPClib_in
+ * @{
+ */
+
+#define RPC_NO_SOCKET -1
+#define RPC_NO_THREAD 0
+
+#define RPC_MAIN_SUB_COMMAND "%-2d %-16lx"
+#define RPC_MAIN_SUB_COMMAND_SIZE 20
+#define RPC_MAIN_SUB_COMMANDs "%d %lx"
+/** Type of command sent from the main thread to the subthread */
+enum {
+ RPC_COMMAND_ADD_SERVER, /* Addition of RPC_ID */
+ RPC_COMMAND_REMOVE_SERVER, /* Remove RPC_ID */
+ RPC_COMMAND_EXIT, /* Sub-thread termination (when all RPC_ID are exhausted) */
+};
+
+#define APICALL_TIMEOUT_DEFAULT -1
+
+/** Periodic checking timeout (mSec) for detecting deadlocks */
+#define TIMEOUT_FOR_DEADLOCK_CHECK 1000
+
+/** Length of the socket name
+ API request datagram socket = '\0' + "5-digit number associated with RPC_ID"
+ Authentication stream socket = '\0' + "secure_" + "5-digit number associated with RPC_ID" */
+#define SOCK_NAME_LEN (1+5) /* API request datagram socket */
+#define SECURE_SOCK_NAME_LEN (1+12) /* Authentication stream socket */
+
+#define rpc_mutex_lock pthread_mutex_lock
+#define rpc_mutex_unlock pthread_mutex_unlock
+
+/** Upper limit of UID and GID list registration */
+#define CREDENTIAL_LIST_NUM_MAX 32
+
+/** Authentication result to be sent to the client */
+typedef struct {
+ UINT16 certify_res; /**< Client Authentication Result */
+ pid_t srvr_pid; /**< Server PID */
+} RpcCertifyResult;
+
+#define CERTIFY_OK 0
+#define CERTIFY_NG 1
+
+/** Received API call request */
+typedef struct {
+ RPC_ID client; /**< API ID of the requested program */
+ UINT16 api_num; /**< Calling API number */
+ char *args_string; /**< API Call Arguments */
+ UINT32 args_size; /**< Number of bytes in the argument */
+} rpc_apicall_queue;
+
+/** Source Client Socket Name Management Table */
+typedef struct RpcClientSockNameInfoST RpcClientSockNameInfo;
+struct RpcClientSockNameInfoST {
+ char client_sock_name[SOCK_NAME_LEN]; /**< Socket Name List for Source Client */
+ pid_t pid; /**< Source pid */
+ uid_t uid; /**< Source uid */
+ gid_t gid; /**< Source gid */
+ int wd; /**< Non-negative inotify monitored descriptors */
+ RpcClientSockNameInfo *next; /**< Pointer to the next node */
+};
+
+/** Communication server PID management table */
+typedef struct RpcSrvrPidInfoST RpcSrvrPidInfo;
+struct RpcSrvrPidInfoST {
+ RPC_ID srvr_rpc_id; /**< Communication destination server RPC_ID */
+ pid_t srvr_pid; /**< Communication destination server pid */
+ int wd; /**< Non-negative inotify monitored descriptors */
+ RpcSrvrPidInfo *next; /**< Pointer to the next node */
+};
+
+/** Buffer structure for API call acceptance processing.
+ * This function is allocated only when the dispatch function is specified by RPC_start().
+ */
+typedef struct {
+ RPC_dispatch_func_t dispatch_func;/**< Dispatch Functions to APIs (in stub) */
+#define RPC_apicall_dispatch_func(id) \
+ ((id)->apicall ? (id)->apicall->dispatch_func : 0)
+
+ INT32 pipe_sub_main[2];/**< Notification pipe from the subthread to the main thread */
+#define RPC_pipe_sub_main(th) ((th)->srvr_id->apicall->pipe_sub_main)
+
+ UINT16 num_queue;/**< Number of queued API call requests */
+#define RPC_apicall_num_queue(id) \
+ ((id)->apicall ? (id)->apicall->num_queue : 0)
+#define RPC_apicall_num_queue_inc(id) ((id)->apicall->num_queue++)
+#define RPC_apicall_num_queue_dec(id) ((id)->apicall->num_queue--)
+
+ rpc_apicall_queue queue[RPC_MAX_APICALL_QUEUE];/**< Queuing API Call Requests (FIFO) */
+#define RPC_apicall_queue(id, i) ((id)->apicall->queue[(i)])
+#define RPC_apicall_queue_client(id, i) ((id)->apicall->queue[(i)].client)
+#define RPC_apicall_queue_api_num(id, i) ((id)->apicall->queue[(i)].api_num)
+#define RPC_apicall_queue_args(id, i) ((id)->apicall->queue[(i)].args_string)
+#define RPC_apicall_queue_args_size(id, i) ((id)->apicall->queue[(i)].args_size)
+
+ RPC_ID in_process_client;/**< Clients running on ID */
+#define RPC_apicall_in_process_client(id) ((id)->apicall->in_process_client)
+
+ INT32 timeout_sec;/**< API processing timeout */
+#define RPC_apicall_api_timeout_sec(id) ((id)->apicall->timeout_sec)
+
+ INT32 secure_check;/**< Client Authentication Check Enabled/Disabled */
+#define RPC_secure_check(id) ((id)->apicall->secure_check)
+
+ INT32 regist_credential_info;/**< Registration of authentication information */
+#define RPC_regist_credential_info(id) ((id)->apicall->regist_credential_info)
+
+ uid_t *uid_list;/**< List of UIDs that can communicate */
+#define RPC_uid_list(id, i) ((id)->apicall->uid_list[(i)])
+
+ INT32 uid_num;/**< Number of UID list elements that can communicate */
+#define RPC_uid_num(id) ((id)->apicall->uid_num)
+
+ gid_t *gid_list;/**< GID list that can communicate */
+#define RPC_gid_list(id, i) ((id)->apicall->gid_list[(i)])
+
+ INT32 gid_num;/**< Number of GID list elements that can communicate */
+#define RPC_gid_num(id) ((id)->apicall->gid_num)
+
+ RpcClientSockNameInfo *sock_info_head;/**< Leading node of the source client's socket information management table */
+#define RPC_sock_info_head(id) ((id)->apicall->sock_info_head)
+#define RPC_client_sock_name(id) ((id)->apicall->sock_info_head->client_sock_name)
+#define RPC_client_sock_pid(id) ((id)->apicall->sock_info_head->pid)
+#define RPC_client_sock_next_node(id) ((id)->apicall->sock_info_head->next)
+
+ INT32 client_sock_name_num;/**< Number of elements in the source client's socket name list */
+#define RPC_client_sock_name_num(id) ((id)->apicall->client_sock_name_num)
+#define RPC_client_sock_name_num_inc(id) ((id)->apicall->client_sock_name_num++)
+#define RPC_client_sock_name_num_dec(id) ((id)->apicall->client_sock_name_num--)
+} RpcApicallInfo;
+
+struct RpcThreadInfo;
+
+/** Structure that holds information about each RPC_ID */
+typedef struct RpcIdInfo {
+ struct RpcThreadInfo *thread_info;
+
+ RPC_ID port;/**< Port number (=ID) used by the RPC library */
+#define RPC_port(id) ((id)->port)
+#define RPC_my_id(id) RPC_port(id)
+#define rpc_get_port(id) (id)
+
+ INT32 sock;/**< Sockets used by the RPC library */
+#define RPC_my_sock(id) ((id)->sock)
+
+ INT32 secure_sock;/**< Authentication socket used by the RPC library */
+#define RPC_my_secure_sock(id) ((id)->secure_sock)
+
+ int inotify_fd;/**< Server process monitoring inotify */
+#define RPC_clnt_inotify_fd(id) ((id)->inotify_fd)
+
+ INT32 count;/**< Number of clients using the same RPC_ID */
+#define RPC_clnt_count(id) ((id)->count)
+#define RPC_inc_clnt_count(id) ((id)->count++)
+#define RPC_dec_clnt_count(id) ((id)->count--)
+
+ RpcApicallInfo *apicall;/**< Information for API call acceptance processing */
+#define RPC_apicall_info(id) ((id)->apicall)
+
+ RpcSrvrPidInfo *srvr_pid_head;/**< Communication destination server PID management table top node */
+#define RPC_srvr_pid_head(id) ((id)->srvr_pid_head)
+#define RPC_srvr_rpc_id(id) ((id)->srvr_pid_head->srvr_rpc_id)
+#define RPC_srvr_pid(id) ((id)->srvr_pid_head->srvr_pid)
+#define RPC_srvr_pid_next_node(id) ((id)->srvr_pid_head->next)
+
+ UINT32 return_str_len;/**<Number of bytes in the returned string as a result of an API call*/
+ /* Including the terminating '\0' */
+#define RPC_apicall_return_str_len(id) ((id)->return_str_len)
+
+ UINT8 *return_str;/**<String returned as a result of an API call*/
+#define RPC_apicall_return_str(id) ((id)->return_str)
+} RpcIdInfo;
+
+/** Received response packet */
+typedef struct {
+ RPC_ID id;/**< ID of the thread that sent the response */
+ UINT16 type;/**< Response type */
+ UINT32 seq_num;/**< The packet number to which this was sent (the response to this) */
+} RpcResponse;
+
+/** Structure that stores the state of each thread that called the RPC library */
+typedef struct RpcThreadInfo {
+ pthread_mutex_t th_mtx;/**< Mutex for modifying this struct */
+#define RPC_THREAD_MUTEX_LOCK(th) (rpc_mutex_lock(&((th)->th_mtx)))
+#define RPC_THREAD_MUTEX_UNLOCK(th) (rpc_mutex_unlock(&((th)->th_mtx)))
+
+ pthread_t thread;/**< Thread calling the RPC library */
+#define RPC_main_thread(th) ((th)->thread)
+
+ UINT32 sequence_number;/**< Sequence number given to the transmitted packet */
+ /* Send 30 times per second from the beginning of the thread, then wrap around two years.
+ * It is not necessary to wrap around 0 because there is no comparison.
+ */
+ UINT32 magic;/**< Magic number to detect corrupted memories */
+
+ RpcIdInfo *srvr_id;/**< Information by RPC_ID (server) */
+#define RPC_srvr_idinfo(th) ((th)->srvr_id)
+
+ RpcIdInfo *clnt_id;/**< Info by RPC_ID (client) */
+#define RPC_clnt_idinfo(th) ((th)->clnt_id)
+} RpcThreadInfo;
+
+extern pthread_t g_rpc_thread;
+extern UINT32 g_rpc_thread_alive;
+
+#define PIPE_READ 0
+#define PIPE_WRITE 1
+extern int g_rpc_pipe_main_sub[2];
+
+RpcThreadInfo *RpcMyThreadInfo(void);
+RpcThreadInfo *RpcCreateThreadInfo(void);
+int RpcCreateIdInfo(RpcThreadInfo *th, RPC_ID id,
+ RPC_dispatch_func_t dispatch, INT32 secure_check);
+void RpcDestroyIdInfo(RpcThreadInfo *th, RpcIdInfo *idinfo);
+void RpcDestroyThreadInfo(void);
+void RpcUnlinkSocketFiles(void);
+
+/** @} */
+#endif // OTHERSERVICE_RPCTHREAD_H_
diff --git a/otherservice/rpc_library/library/include/rpc_udp.h b/otherservice/rpc_library/library/include/rpc_udp.h
new file mode 100755
index 0000000..8c45ce6
--- /dev/null
+++ b/otherservice/rpc_library/library/include/rpc_udp.h
@@ -0,0 +1,162 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_RPCUDP_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPCUDP_H_ // NOLINT(build/header_guard)
+
+/** @addtogroup RPClib_in */
+/** @{ */
+/** Number of bytes of payload that can be stored in a UDP packet */
+#define RPC_UDP_PAYLOAD RPC_MAX_API_ARG_TOTAL_SIZE
+
+/** UDP packet header
+ *
+ * Packet type, source ID, sequence number, packet size, packet position
+ */
+#define RPC_PACKET_HEADER "%-2d %-5x %-8x %-4u %1d "
+/** Number of bytes in the UDP packet header
+ */
+#define RPC_PACKET_HEADER_LEN (2+1 + 5+1 + 8+1 + 4+1 + 1+1)
+
+/** Number of bytes to store in the UDP packet */
+#define RPC_UDP_PACKET_SIZE (RPC_UDP_PAYLOAD + RPC_PACKET_HEADER_LEN)
+
+#define RPC_COMMAND_LEN 3
+
+/** Format string for UDP packet header analysis */
+#define RPC_PACKET_HEADER_scanf "%d %x %x %d"
+
+/** Header (API number) to be added to the API call packet */
+#define RPC_APICALL_FORMAT "%-4d "
+/** Number of bytes in the header of an API call packet */
+#define RPC_APICALL_FORMAT_ARGS_START 5
+
+#define RPC_MAX_RESPONSE_MESSAGE_SIZE 5
+
+#define RPC_SEQ_NUM_START 1
+#define RPC_SEQ_NUM_INVALID 0
+
+/** Internal API call number for checking server existence */
+#define RPC_API_NUM_RPC_ALIVE 0
+
+/** Type of packet that the RPC library sends */
+typedef enum {
+ RPC_PACKET_APICALL = 0,/**< API call request */
+
+ RPC_RESPONSE_APICALL,/**< Responding to API Call Requests */
+#define RPC_RESPONSE_NONE 0x0000
+#define RPC_RESPONSE_API_OK 0x0001
+#define RPC_RESPONSE_API_BUSY 0x0002
+#define RPC_RESPONSE_API_ERR 0x0004
+#define RPC_RESPONSE_API_DEADLOCK 0x0005 /* Server deadlock */
+#define RPC_RESPONSE_API_CERTIFY 0x0006 /* Authentication request */
+
+ RPC_PACKET_APIRETURN,/**< Result of the API call */
+
+ RPC_PACKET_NONE,
+} RPC_packet_type;
+
+/** Packet Location (Multi-Fragment Packet Support) */
+typedef enum {
+ RPC_PACKET_POS_ONEANDONLY = 0,/**< Complete with one packet */
+} rpc_packet_position;
+
+/** Transmitting buffer */
+typedef struct {
+ unsigned int bytes;
+ const void *buf;
+} rpc_send_buf;
+
+/** Valid bytes in the sockaddr_un struct specified for send */
+#define RPC_SOCKET_NAME_LEN 6 /**< Name: 5 characters + first NULL bytes */
+#define RPC_SOCKET_ADDR_LEN (sizeof(short) + RPC_SOCKET_NAME_LEN) // NOLINT (readability/nolint)
+
+enum {
+ RPC_SEND_TO_CLIENT,
+ RPC_SEND_TO_SERVER,
+ RPC_SEND_TO_SERVER_NO_RETRY,
+};
+
+struct RpcIdInfo;
+
+int RpcSendUdp(struct RpcIdInfo *id, RPC_ID receiver, int direction,
+ RPC_packet_type type, const void *mesg, unsigned int bytes);
+int RpcSendUdp2(struct RpcIdInfo *id, RPC_ID receiver, int direction,
+ RPC_packet_type type, unsigned int num, rpc_send_buf *sendbuf);
+RPC_Result RpcSendUdpResponse(struct RpcIdInfo *id, RPC_ID receiver,
+ int direction,
+ RPC_packet_type type,
+ UINT32 seq_num, char *mesg, UINT32 bytes);
+
+int RpcReadUdpPacket(const struct RpcIdInfo *id, UINT8 *buf);
+
+RPC_Result RpcParsePacketHeader(const char *str, RPC_packet_type *command,
+ RPC_ID_p id, UINT32 *seq_num, UINT32 *size);
+
+RPC_Result RpcClientWaitResponse(struct RpcIdInfo *idinfo,
+ UINT32 seq_num,
+ UINT32 timeout_msec, UINT16 *response);
+RPC_Result RpcClientWaitResult(struct RpcIdInfo *idinfo, RPC_ID srvr_id);
+
+#if defined(RPC_USE_UNIX_AUTOBIND)
+/* ===pathname of datagram sockets for API requests=== */
+static inline void
+RpcSetServerName(char *str, RPC_ID id) {
+ *str = '\0';
+ sprintf(str + 1, "S%04x", id); // NOLINT (readability/nolint)
+}
+
+static inline void
+RpcSetClientName(char *str, RPC_ID id) {
+ *str = '\0';
+ sprintf(str + 1, "%05x", id); // NOLINT (readability/nolint)
+}
+
+static inline void
+RpcGetClientName(const char *str, RPC_ID *id) {
+ char buf[6];
+ memcpy(buf, str + 1, 5);
+ buf[5] = '\0';
+ if (buf[1] == 'X') {
+ *id = (RPC_ID)(strtoul(buf + 1, NULL, 16));
+ } else {
+ *id = (RPC_ID)(strtoul(buf, NULL, 16));
+ }
+}
+
+/* ===pathname of stream-socket for authenticating=== */
+static inline void
+RpcSetServerSecureName(char *str, RPC_ID id) {
+ *str = '\0';
+ sprintf(str + 1, "secure_S%04x", id); // NOLINT (readability/nolint)
+}
+
+static inline void
+RpcSetClientSecureName(char *str, RPC_ID id) {
+ *str = '\0';
+ sprintf(str + 1, "secure_%05x", id); // NOLINT (readability/nolint)
+}
+
+static inline void
+RpcGetClientNameFromSock(const char *str, char *client_sock_name) {
+ memcpy(client_sock_name, str + 8, 5);
+ client_sock_name[5] = '\0';
+}
+
+#endif /* !AUTOBIND */
+
+/** @} */
+#endif // OTHERSERVICE_RPCUDP_H_
diff --git a/otherservice/rpc_library/library/librpc.ver b/otherservice/rpc_library/library/librpc.ver
new file mode 100755
index 0000000..2fbb9dc
--- /dev/null
+++ b/otherservice/rpc_library/library/librpc.ver
@@ -0,0 +1,29 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+######################
+# rpc version script #
+######################
+{
+ global:
+ ### .text section ###
+ RPC_*;
+ ### .data section ###
+ local:
+ *;
+};
+
+
diff --git a/otherservice/rpc_library/library/src/rpc_event.c b/otherservice/rpc_library/library/src/rpc_event.c
new file mode 100755
index 0000000..2e3fd38
--- /dev/null
+++ b/otherservice/rpc_library/library/src/rpc_event.c
@@ -0,0 +1,158 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_event.c
+ * @brief RPC Library Internal Implementation--Event Handling
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <native_service/cl_monitor.h>
+
+#include <other_service/rpc.h>
+#include "rpc_internal.h"
+
+/** @ingroup RPClib_in
+ */
+RUNS_IN_READING_THREAD
+RPC_Result
+RpcQueueAPIRequestBefore(RpcIdInfo *id, UINT32 size, char **buff) {
+ RPC_THREAD_MUTEX_LOCK(id->thread_info);
+
+ int n = RPC_apicall_num_queue(id); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_thread.h
+
+ if (n >= RPC_MAX_APICALL_QUEUE) {
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info);
+ RPC_LOG_STATE("Returned BUSY.");
+ return RPC_ERR_Busy;
+ } else {
+ *buff = rpc_malloc(size);/* malloc */
+ if (*buff == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc function malloc
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info); // LCOV_EXCL_START 5: fail safe for libc function malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_STATE("queue API request: No Memory");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ }
+ return RPC_OK;
+}
+/** @ingroup RPClib_in
+ */
+RUNS_IN_READING_THREAD
+RPC_Result
+RpcQueueAPIRequestAfter(RpcIdInfo *id, RPC_ID client,
+ const char *mesg, UINT32 size, char *args) {
+ int n = RPC_apicall_num_queue(id); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_thread.h
+
+ UINT16 api_num;
+ api_num = (UINT16)strtol(mesg, NULL, 10);
+ memcpy(args, mesg + RPC_APICALL_FORMAT_ARGS_START, size);
+ RPC_ID_COPY(RPC_apicall_queue_client(id, n), client);
+ RPC_apicall_queue_api_num(id, n) = api_num;
+ RPC_apicall_queue_args(id, n) = args;
+ RPC_apicall_queue_args_size(id, n) = size;
+ RPC_apicall_num_queue_inc(id);
+
+ /* set RUN state */
+ CL_MonitorSetEntry(CL_MONITOR_TYPE_RPC,
+ RPC_port(id),
+ CL_MONITOR_STATE_RUN,
+ (uint32_t)(RPC_apicall_api_timeout_sec(id)),
+ api_num);
+
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info);
+ return RPC_OK;
+}
+
+/** @ingroup RPClib_in
+ */
+RUNS_IN_CALLERS_THREAD
+void
+RpcFreeAPIArgsString(char *args_string) {
+ if (args_string != NULL) { // LCOV_EXCL_BR_LINE 5: free the memory, malloced in RpcQueueAPIRequestBefore(...)
+ rpc_free(args_string);/* free */
+ }
+}
+
+/** @ingroup RPClib_in
+ */
+RUNS_IN_CALLERS_THREAD
+UINT16
+RpcGetAPIRequest(RpcIdInfo *id, RPC_ID_p client,
+ char **args_string, unsigned int *args_size) {
+ UINT16 api_num = 0;
+
+ RPC_THREAD_MUTEX_LOCK(id->thread_info);
+
+ UINT32 n = RPC_apicall_num_queue(id); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_thread.h
+ if (n > 0) {
+ RPC_ID_COPY(*client, RPC_apicall_queue_client(id, 0));
+ api_num = RPC_apicall_queue_api_num(id, 0);
+ *args_string = RPC_apicall_queue_args(id, 0);
+ /* this string must be freed by the caller using discard_APIcall_return()*/
+ *args_size = RPC_apicall_queue_args_size(id, 0);
+
+ if (n > 1) {
+ memmove(&(RPC_apicall_queue(id, 0)), &(RPC_apicall_queue(id, 1)),
+ (n - 1) * sizeof(RPC_apicall_queue(id, 0)));
+ }
+ RPC_apicall_num_queue_dec(id);
+ }
+
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info);
+ return api_num;
+}
+
+/** @ingroup RPClib_in
+ */
+RUNS_IN_READING_THREAD
+RPC_Result
+RpcSetAPIcallReturn(RpcIdInfo *id, const char *mesg, UINT32 size) {
+ if (RPC_apicall_return_str(id) != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ RPC_LOG_STATE("previous APIcall return string was not used"); // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RpcDiscardAPIcallReturn(id);
+ } // LCOV_EXCL_STOP
+ RPC_THREAD_MUTEX_LOCK(id->thread_info);
+
+ RPC_apicall_return_str(id) = rpc_malloc(size);/* malloc */
+ if (RPC_apicall_return_str(id) == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc function malloc
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info); // LCOV_EXCL_START 5: fail safe for libc function malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_STATE("set APIcall return: No Memory");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ RPC_apicall_return_str_len(id) = size;
+ memcpy(RPC_apicall_return_str(id), mesg, size);
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info);
+ return RPC_OK;
+}
+
+/** @ingroup RPClib_in
+ */
+RUNS_IN_CALLERS_THREAD
+void
+RpcDiscardAPIcallReturn(RpcIdInfo *id) {
+ RPC_THREAD_MUTEX_LOCK(id->thread_info);
+ if (RPC_apicall_return_str(id) != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ rpc_free(RPC_apicall_return_str(id));/* free */
+ RPC_apicall_return_str_len(id) = 0;
+ RPC_apicall_return_str(id) = NULL;
+ }
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info);
+}
diff --git a/otherservice/rpc_library/library/src/rpc_lib.c b/otherservice/rpc_library/library/src/rpc_lib.c
new file mode 100755
index 0000000..76f0d49
--- /dev/null
+++ b/otherservice/rpc_library/library/src/rpc_lib.c
@@ -0,0 +1,1264 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_lib.c
+ * @brief RPC Library-API Function Implementation
+ *
+ */
+/** @mainpage
+ * This document describes the following API functions, structures,
+ * type declarations, and macros.
+ * - RPC library external specification
+ * - External specifications for RPC tools
+ *
+ * For an overview of other RPC libraries and tools and anomaly processing,
+ * to reference the Word version of the documentation.
+ * (external specifications and programming guides) */
+/** @defgroup RPClib RPC library external specification */
+/** @defgroup RPCtool RPC tool (rpc_apidef) */
+/** @defgroup RPC_ID_assign RPC_ID Assignment */
+/** @defgroup RPClib_in RPC library internal specifications (incomplete) */
+/** @addtogroup RPClib
+ * @{
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/select.h>
+#include <sys/poll.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <sys/un.h>
+#include <sys/inotify.h>
+
+#include <other_service/rpc.h>
+#include "rpc_internal.h"
+
+#include <native_service/cl_process.h> // for CL_INTFY_FILENAME_FORMAT
+#include <native_service/cl_monitor.h>
+
+
+/* Prototype declarations */
+static RPC_Result ProcessAPIcallRequest(RpcIdInfo *idinfo, RPC_ID client,
+ UINT16 api_num, char *args_string,
+ unsigned int args_size);
+static RPC_Result RpcAllDeleteSrvrPid(RpcIdInfo *idinfo);
+static RPC_Result RpcClientWaitCertification(RpcIdInfo *idinfo, pid_t *srvr_pid);
+static RPC_Result RpcRegistSrvrPid(RpcIdInfo *idinfo, RPC_ID srvr_rpc_id, pid_t srvr_pid, int wd);
+
+#define THREAD_INFO_CHECK(th) \
+ if ((th) == NULL) { \
+ RPC_LOG_STATE("No thread info"); \
+ return RPC_ERR_Fatal; \
+ }
+
+#define SUB_THREAD_CHECK() \
+ if (g_rpc_thread_alive == 0) { \
+ RPC_LOG_STATE("No sub thread -- shutdown"); \
+ RpcDestroyThreadInfo(); \
+ return RPC_ERR_Fatal; \
+ }
+
+/**
+ * Waiting for response packet for API call and API result transmission
+ * Timeout time in msec.
+ * If the other program is abnormal (process termination), delay occurs in the meanwhile.
+ * Confirm the operation on the actual machine and set again.
+ */
+#define RESPONSE_WAIT_MSEC_DEFAULT 2000
+static unsigned int Response_wait_msec = RESPONSE_WAIT_MSEC_DEFAULT;
+
+char *RPC_DEBUG = NULL;
+
+#if defined(RPC_USE_UNIX_AUTOBIND)
+
+ static RPC_Result
+CreateClientIdinfo(RpcThreadInfo *th, RPC_ID *pID) {
+ if (RpcCreateIdInfo(th, *pID, NULL, NO_SECURE_CHECK) < 0) {
+ RPC_LOG_ERR("Can't create id_info");
+ return RPC_ERR_Fatal;
+ }
+
+ *pID = RPC_my_id(RPC_clnt_idinfo(th));
+ RPC_LOG_DEBUG("RPC: assigned client ID %d", *pID);
+ if (RPC_DEBUG) { // LCOV_EXCL_BR_LINE 7: debug
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("RPC[%s]: client start finished.\n", RPC_DEBUG); // LCOV_EXCL_LINE 7: debug
+ }
+ return RPC_OK;
+}
+#else /* !AUTOBIND */
+
+#include <sys/file.h>
+
+ static int
+FindUniqClientId(void) {
+#define RPC_ID_FILE_NAME "/tmp/RPC/id"
+#define RPC_MIN_CLIENT_ID 1024
+#define RPC_MAX_CLIENT_ID (1024+32768-1)
+
+ int fd, found;
+ RPC_ID id, next;
+ struct stat statbuf;
+ char fname[32];
+
+ fd = open(RPC_ID_FILE_NAME, O_RDWR|O_CLOEXEC, 0777);
+ if (fd < 0) {
+ id = RPC_MIN_CLIENT_ID;
+ fd = open(RPC_ID_FILE_NAME, O_RDWR|O_CREAT|O_CLOEXEC, 0777);
+ if (fd < 0) {
+ return -1;
+ }
+ flock(fd, LOCK_EX); // Possible sleep here
+ } else {
+ flock(fd, LOCK_EX); // Possible sleep here
+ read(fd, &id, sizeof(id));
+ }
+
+ found = 0;
+ while(found == 0) {
+ rpc_set_socket_name(fname, id);
+ if (stat(fname, &statbuf) < 0) {
+ found = 1;
+ break;
+ }
+ id++;
+ if (id > RPC_MAX_CLIENT_ID) {
+ id = RPC_MIN_CLIENT_ID;
+ }
+ }
+
+ next = id + 1;
+ if (next > RPC_MAX_CLIENT_ID) {
+ next = RPC_MIN_CLIENT_ID;
+ }
+
+ lseek(fd, 0, SEEK_SET);
+ write(fd, &next, sizeof(next));
+ flock(fd, LOCK_UN);
+ close(fd);
+
+ return id;
+}
+
+ static RPC_Result
+CreateClientIdinfo(RpcThreadInfo *th, UINT16 port) {
+ if (RpcCreateIdInfo(th, port, NULL, NO_SECURE_CHECK) < 0) {
+ RPC_LOG_ERR("Can't create id_info");
+ return RPC_ERR_Fatal;
+ }
+ // LCOV_EXCL_BR_START 7: debug
+ if (RPC_DEBUG) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("RPC[%s]: client start finished.\n", RPC_DEBUG);
+ }
+ // LCOV_EXCL_BR_STOP
+ return RPC_OK;
+}
+#endif /* AUTOBIND */
+
+/** @fn RPC_START_SERVER(ID)
+ * @brief RPC_start() macro for the server
+ *
+ * Used by RPC-API server programs to activate the RPC library.
+ * ID specifies a symbol of the form XXX_RPC_ID defined in rpc_id.h.
+ * Only one server program per thread is allowed.
+ * When a server program calls an API as a client of another server,
+ * it only needs to call RPC_START_SERVER,
+ * not RPC_START_CLIENT.
+ *
+ * RPC_end() should be called when the RPC library is no longer needed.
+ * @param ID [IN]RPC_ID of the program
+ * @see RPC_start
+ * @see RPC_end
+ */
+/** @fn RPC_START_CLIENT(pID)
+ * @brief RPC_start() macro for clients
+ *
+ * Use only the client functions of the RPC library
+ * (only calling APIs provided by other programs),
+ * This macro is used for the start process.
+ *
+ *
+ * RPC_end() should be called when the RPC library is no longer needed.
+ *
+ * @param pID [OUT]Pointer to the RPC_ID of the program
+ * @see RPC_start
+ * @see RPC_end
+ */
+/** @brief Start processing of the RPC library
+ *
+ * - With an open socket, RPC_ID, and API call dispatching functions
+ * Register in the global variable (managed separately for each thread and RPC_ID)
+ * - Starting use as a server
+ * - func specifies a function pointer (defined in stub) that is not a NULL.
+ * - Specifies a fixed ID defined in rpc_id.h as the ID.
+ * - If the same thread has already started using the server, an error code is returned.
+ * - When the server function is started for the first time in a process,
+ * one subthread is started to process received packets
+ * in the background.
+ * - Starting use as a client
+ * - NULL is specified in the func.
+ * - In principle, an invalid ID value (RPC_NO_PORT) is specified.
+ * This function automatically assigns IDs and returns the assignment result to pID.
+ * - However, if another program has already started using it as a client,
+ * it shares the socket/RPC_ID instead of creating a new socket.
+ * - Exceptionally, it is allowed to specify a fixed ID defined in rpc_id.h as the ID.
+ * This is the only way to use RPC_start() in programs
+ * where it is difficult to always call RPC_end() at the end of use by program structure/design.
+ * - In this case, the pID argument is not referenced.
+ * - The maximum number of threads that use the RPC library in a process is
+ * specified by RPC_MAX_THREADS_IN_PROCESS.
+ *
+ * @param id [IN]RPC_ID of the program (in the case of RPC_NO_PORT, this means automatic assignment)
+ * @param dispatch_func Dispatching functions (defined in stub files for servers,
+ * and NULL specified in programs that do not provide APIs)
+ * @param pID [OUT]RPC_ID of the automatically assigned program
+ *
+ * @retval RPC_OK: normal completion
+ * @retval Otherwise: Abnormal termination (FATAL)
+ *
+ * @note Normally, this function is not called directly, but the following macro is used.
+ * - RPC_START_SERVER(ID)
+ * For programs that provide RPC server functions.
+ * This macro is also used when both server and client functions are used.
+ * - RPC_START_CLIENT(pID)
+ * For programs that use only the RPC client function.
+ */
+ RPC_Result
+RPC_start(RPC_ID id, RPC_dispatch_func_t func, RPC_ID *pID, INT32 secure_check)
+{
+#if defined(RPC_USE_SYSLOG)
+ static int init_syslog = 0;
+
+ if (init_syslog == 0) {
+ openlog("librpc", LOG_PID, LOG_USER);
+ setlogmask(LOG_UPTO(LOG_INFO));
+ /* setlogmask(LOG_MASK(LOG_DEBUG)); */
+ init_syslog = 1;
+ if (func != NULL)
+ RPC_LOG_STATE("RPC_START_SERVER(%#x)\n", id);
+ }
+#endif /* RPC_USE_SYSLOG */
+
+ if (func != NULL && id == RPC_NO_ID) { /* No ID is specified despite as a server */
+ RPC_LOG_ERR("Invalid RPC_start server arg");
+ return RPC_ERR_Fatal;
+ }
+ if (func != NULL && pID != NULL) { /* Requested obtaining pID despite as a server */ // LCOV_EXCL_BR_LINE 200: macro guarantee impossible both not NULL, RPC_START_***
+ RPC_LOG_ERR("Invalid RPC_start server arg"); // LCOV_EXCL_START 200: macro guarantee impossible both not NULL, RPC_START_***
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ if (func == NULL && id != RPC_NO_ID) { /* Specified ID despite as a client */
+ RPC_LOG_ERR("Invalid RPC_start server arg");
+ return RPC_ERR_Fatal;
+ }
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ if (func == NULL && pID == NULL) {
+ /* pID is NULL despite as a client (not supported for ID-specified clients) */
+ RPC_LOG_ERR_W_NAME("RPC_Start(ID, NULL, NULL) is no longer supported, ID is auto-assigned");
+ return RPC_ERR_Fatal;
+ }
+#else /* !AUTOBIND */
+ if (func == NULL && id == RPC_NO_ID && pID == NULL) {
+ /* pID is NULL despite as an auto-assigned client */
+ RPC_LOG_ERR("Invalid RPC_start arg");
+ return RPC_ERR_Fatal;
+ }
+#endif /* !AUTOBIND */
+ if ((secure_check != NO_SECURE_CHECK) && (secure_check != NEED_SECURE_CHECK)) { // LCOV_EXCL_BR_LINE 200: macro guarantee only two value, RPC_START_***
+ /* Check Arguments for Client Authentication */
+ RPC_LOG_ERR("Invalid RPC_start arg"); // LCOV_EXCL_START 200: macro guarantee only two value, RPC_START_***
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ if (th == NULL) {
+ th = RpcCreateThreadInfo();
+ if (th == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ return RPC_ERR_Fatal;
+ }
+ }
+
+ /* RPC_start is already done in the same thread */
+ if (func != NULL) {/* Server start */
+ if (RPC_srvr_idinfo(th) != NULL) {/* Server already started */
+ RPC_LOG_ERR("duplicated RPC_START_SERVER");
+ return RPC_ERR_Fatal;
+ }
+ } else { /* Client start */
+ if (RPC_clnt_idinfo(th) != NULL) {/* Client already started */
+ if (pID != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ *pID = (RPC_clnt_idinfo(th))->port;
+ RPC_LOG_DEBUG("use existing client ID=%d", *pID);
+ RPC_inc_clnt_count(RPC_clnt_idinfo(th));
+ }
+ /*
+ * When pID == NULL (RPC_ID fixed), there is no guarantee
+ * that RPC_end() will be called as many times as needed, so it does not count up.
+ */
+ return RPC_OK;
+ }
+ }
+
+ if (func == NULL) {/* Client start */
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ /* Automatically assign everything without supporting ID specification */
+ RPC_ID id_local = RPC_NO_ID;
+ RPC_Result ret = CreateClientIdinfo(th, &id_local);
+ if(RPC_OK != ret) return ret;
+
+ if (pID) { // LCOV_EXCL_BR_LINE 6: double check
+ *pID = id_local;
+ }
+ RPC_clnt_inotify_fd(RPC_clnt_idinfo(th)) = inotify_init1(IN_CLOEXEC);
+ return ret;
+#else /* !AUTOBIND */
+ if (id == RPC_NO_ID) {
+ /* No port number specified -> Automatically assign an ID and port number here */
+ /*
+ * FindUniqClientId() returns ID within the range of RPC_MIN_CLIENT_ID(1024) to RPC_MAX_CLIENT_ID(1024+32768-1)
+ */
+ int ret;
+ ret = FindUniqClientId();
+ if (ret < 0) {
+ return RPC_ERR_Fatal;
+ }
+ /* pID != NULL is already checked */
+ *pID = (UINT16)ret;
+ return CreateClientIdinfo(th, *pID);
+ } else {
+ /*
+ * Client start with specified port number
+ * Programs that cannot guarantee an RPC_end() call
+ * at termination specify a fixed RPC_ID from the upper level and use it.
+ * (To avoid memory shortage caused by building up socket-files in /tmp/RPC)
+ */
+ return CreateClientIdinfo(th, id);
+ }
+#endif /* !AUTOBIND */
+ }
+
+ /* Dispatch func specified (servers) -> bind */
+ CL_MonitorInit(CL_MONITOR_INIT_USER); /* Using the API for Error Monitoring */
+
+ if (RpcCreateIdInfo(th, id, func, secure_check) < 0) {
+ RPC_LOG_ERR("Can't create id_info");
+ return RPC_ERR_Fatal;
+ }
+
+ if (RPC_DEBUG) { // LCOV_EXCL_BR_LINE 7: debug
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("RPC[%s]: server thread invoked\n", RPC_DEBUG); // LCOV_EXCL_LINE 7: debug
+ }
+ char *env;
+ if ((env = getenv("RPC_RESPONSE_WAIT")) != NULL) {
+ Response_wait_msec = (unsigned int)strtol(env, NULL, 10);
+ }
+
+ return RPC_OK;
+}
+
+ static void
+RpcEndSub(RpcThreadInfo *th, RpcIdInfo *idinfo) {
+ int sockfd;
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+ char path[120];
+
+ rpc_set_socket_name(path, RPC_my_id(idinfo));
+#endif /* !AUTOBIND */
+ sockfd = idinfo->sock;
+ RpcDestroyIdInfo(th, idinfo);
+ close(sockfd);
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+ unlink(path);
+#endif /* !AUTOBIND */
+}
+
+/** @brief RPC Library End-of-Use Processing
+ *
+ * - Perform termination processing such as closing the opened socket, releasing the memory.
+ * (Server/Client Common)
+ * - If there are no programs in the thread that use RPC_ID,
+ * the subthread started by RPC_start is terminated.
+ * - Each RPC_ID must be called before the program exits.
+ * - RPC_end must be called by the thread that performed the RPC_start.
+ * - Ignored unused or no longer used RPC_ID if specified.
+ *
+ * @param ID [IN]RPC_ID of the program
+ */
+ void
+RPC_end(RPC_ID id) {
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ if (th == NULL) {
+ return;
+ }
+ RpcIdInfo *idinfo;
+ idinfo = RPC_srvr_idinfo(th);
+ if (idinfo != NULL && RPC_my_id(idinfo) == id) {/* srvr */
+ RpcEndSub(th, idinfo);
+ }
+
+ idinfo = RPC_clnt_idinfo(th);
+ if (idinfo != NULL && RPC_my_id(idinfo) == id) {/* client */
+
+ RPC_dec_clnt_count(idinfo);
+ if (RPC_clnt_count(idinfo) == 0) {
+ /* Deleting management table of the communication destination server PID */
+ RpcAllDeleteSrvrPid(idinfo);
+ close(RPC_clnt_inotify_fd(idinfo));
+
+ RpcEndSub(th, idinfo);
+ }
+ }
+ if (RPC_srvr_idinfo(th) == NULL && RPC_clnt_idinfo(th) == NULL) {
+ RPC_LOG_DEBUG("destroy thread info %p", th);
+ RpcDestroyThreadInfo();
+ }
+}
+
+/** @brief RPC library use termination processing (forced cleanup at process termination)
+ *
+ * Deletes the socket file created for RPC communication in the process.
+ * For to release the resources of programs that use the RPC library with RPC_end() in principle,
+ * but this API is an insurance process to eliminate socket file leaks.
+ *
+ * - Since it is assumed that the socket is called immediately before the process terminates,
+ * closing sockets and releasing memory is not performed automatically when the process terminates.
+ * - All RPC processing (both server and client) after this API call cannot be used.
+ * Operation is not guaranteed even if RPC_START is performed again after that.
+ *
+ * No action for versions of the RPC library that use Unix autobind.
+ */
+ void
+RPC_end_all(void) {
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+ RpcUnlinkSocketFiles();
+#endif
+}
+
+/**
+ * @fn RPC_Result RPC_set_API_timeout(RPC_ID id, UINT32 sec)
+ * @brief Setting the timeout period during server API processing
+ *
+ * @param sec [IN] Timeout (sec) Set within the range of 1 to 60 sec.
+ *
+ * @retval RPC_OK: normal completion
+ * @retval RPC_ERR_Configuration: Argument out of range
+ * @retval RPC_ERR_Fatal: Fatal error
+ */
+ RPC_Result
+RPC_set_API_timeout(INT32 sec) {
+ /* param check */
+ if ((sec > 60) || (sec < 1)) {
+ RPC_LOG_ERR( "RPC_set_API_timeout() : Invalid Param." );
+ return RPC_ERR_Configuration;
+ }
+
+ /* thread_info check */
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ THREAD_INFO_CHECK(th);
+
+ /* thread_info->id_info check */
+ if (RPC_srvr_idinfo(th) != NULL ) { // LCOV_EXCL_BR_LINE 200: server start abnormal can't test
+ RpcIdInfo *idinfo = RPC_srvr_idinfo(th);
+
+ /* thread_info->id_info->apicall_info check */
+ if( RPC_apicall_info(idinfo) != NULL ) { // LCOV_EXCL_BR_LINE 200: server start abnormal can't test
+ RPC_apicall_api_timeout_sec(idinfo) = sec;
+ } else { // LCOV_EXCL_START 200: server start abnormal can't test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR( "No apicall_info" );
+ return RPC_ERR_Fatal;
+ }
+
+ } else {
+ RPC_LOG_STATE("No srvr_id info");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ return RPC_OK;
+}
+
+
+/** @brief API call execution function (client side)
+ *
+ * (These functions are called from within a client-facing STUB. Users never use these directly.)
+ */
+ RPC_Result
+RPC_API_call(RPC_ID server, UINT16 api_num,
+ const char *args_string, unsigned int args_size,
+ char **ret_string, unsigned int *ret_size) {
+ *ret_string = NULL;
+
+ RpcThreadInfo *th = RpcMyThreadInfo();
+
+ THREAD_INFO_CHECK(th);
+
+ RpcIdInfo *idinfo;
+ idinfo = RPC_clnt_idinfo(th);
+
+ pid_t srvr_pid;
+
+ if (idinfo == NULL) { // LCOV_EXCL_BR_LINE 8: dead code, idinfo always isn't NULL
+ /*
+ * In the past, the remedy of uninitialized clients has been done here.
+ * However, because it becomes to accumulate garbage in the /tmp/RPC by changing UNIX sockets,
+ * as an error without remedies.
+ */
+ // LCOV_EXCL_START 8: dead code, idinfo always isn't NULL
+ RPC_LOG_ERR_W_NAME("warning!!! RPC call without RPC_start(): server=%d, api_num=%d", server, api_num);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ RPC_ID id = RPC_NO_ID;
+ RPC_Result ret = CreateClientIdinfo(th, &id);
+#else /* !AUTOBIND */
+ int id;
+ id = FindUniqClientId();
+ if (id < 0) {
+ return RPC_ERR_Fatal;
+ }
+ RPC_Result ret = CreateClientIdinfo(th, (UINT16)id);
+#endif /* !AUTOBIND */
+ if (ret != RPC_OK) {
+ return ret;
+ }
+ idinfo = RPC_clnt_idinfo(th);
+ if (idinfo == NULL) {
+ return RPC_ERR_Fatal;
+ }
+ } // LCOV_EXCL_STOP
+
+ char api_head[RPC_APICALL_FORMAT_ARGS_START + 1];
+ sprintf(api_head, RPC_APICALL_FORMAT, api_num);
+
+ rpc_send_buf sendbuf[2];
+ sendbuf[0].buf = api_head;
+ sendbuf[0].bytes = RPC_APICALL_FORMAT_ARGS_START;
+ if (args_size > 0) {
+ sendbuf[1].buf = args_string;
+ sendbuf[1].bytes = args_size;
+ }
+
+ int seq_num;
+
+send_api_call:
+ seq_num = RpcSendUdp2(idinfo, server,
+ (api_num == RPC_API_NUM_RPC_ALIVE
+ ? RPC_SEND_TO_SERVER_NO_RETRY
+ : RPC_SEND_TO_SERVER),
+ RPC_PACKET_APICALL,
+ (args_size > 0) ? 2 : 1, sendbuf);
+ if (seq_num < 0) {
+ return RPC_ERR_No_Response;
+ }
+
+ // wait for response
+ UINT16 response;
+ RPC_Result result = RpcClientWaitResponse(idinfo, (UINT32)seq_num, Response_wait_msec,
+ &response);
+ if (result != RPC_OK) {
+ return result;
+ }
+
+ if (response == RPC_RESPONSE_API_BUSY) { /* Server is busy */
+ return RPC_ERR_Busy;
+ } else if (response == RPC_RESPONSE_API_ERR) { /* API call error */
+ RPC_LOG_STATE("APIcall error (can't queue)");
+ return RPC_ERR_Fatal;
+ } else if (response == RPC_RESPONSE_API_DEADLOCK) { /* Server is in deadlock */
+ RPC_LOG_STATE("server DeadLock.");
+ return RPC_ERR_Server_DeadLock;
+ } else if (response == RPC_RESPONSE_API_CERTIFY) { /* Authentication request */
+ struct sockaddr_un srvr_sa_un, secure_sa_un;
+ socklen_t srvr_sa_len, secure_sa_len;
+ int secure_sock_un;
+
+ /* Create client socket for authentication */
+ memset(&secure_sa_un, 0, sizeof(secure_sa_un));
+ secure_sa_un.sun_family = AF_UNIX;
+ secure_sock_un = socket(PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
+ RpcSetClientSecureName(secure_sa_un.sun_path, RPC_port(idinfo));
+ secure_sa_len = (socklen_t)(sizeof(secure_sa_un.sun_family) + SECURE_SOCK_NAME_LEN);
+ if (bind(secure_sock_un, (struct sockaddr *)&secure_sa_un, secure_sa_len) < 0) {
+ RPC_LOG_PERROR("STREAM : bind(unix), ID:%#x", RPC_port(idinfo));
+ }
+ idinfo->secure_sock = secure_sock_un;
+
+ /* Destination Server Socket Setting */
+ memset(&srvr_sa_un, 0, sizeof(srvr_sa_un));
+ srvr_sa_un.sun_family = AF_UNIX;
+ RpcSetServerSecureName(srvr_sa_un.sun_path, server);
+ srvr_sa_len = (socklen_t)(sizeof(srvr_sa_un.sun_family) + SECURE_SOCK_NAME_LEN);
+
+ /* Connection */
+ int cr = connect(RPC_my_secure_sock(idinfo), (struct sockaddr *)&srvr_sa_un, srvr_sa_len);
+ if (0 > cr) {
+ RPC_LOG_STATE("client connect() is failed.");
+ return RPC_ERR_Fatal;
+ }
+
+ /* Waiting for server authentication */
+ RPC_Result ret_certify = RpcClientWaitCertification(idinfo, &srvr_pid);
+ close(RPC_my_secure_sock(idinfo));
+ if (RPC_OK != ret_certify) {/* Authentication NG */
+ RPC_LOG_STATE("denied the connection.");
+ return ret_certify;
+ }
+
+ /* inotify monitoring of server processes */
+ char intfy_fname[32];
+ snprintf(intfy_fname, sizeof(intfy_fname), CL_INTFY_FILENAME_FORMAT, srvr_pid);
+ int wd = inotify_add_watch(RPC_clnt_inotify_fd(idinfo), intfy_fname, IN_DELETE_SELF);
+ if (0 > wd) {
+ RPC_LOG_STATE("intfy_fname is Not Found [%s].", intfy_fname);
+ }
+
+ /* Register the communication destination server PID in the management table. */
+ if (RPC_OK != RpcRegistSrvrPid(idinfo, server, srvr_pid, wd)) {
+ return RPC_ERR_Fatal;
+ }
+ goto send_api_call; /* Sending the API request again */
+
+ } else if (response == RPC_RESPONSE_NONE) { // LCOV_EXCL_BR_LINE 8: dead code, not implement
+ // Not implemented to cancel processing
+ // LCOV_EXCL_START 8: dead code, not implement
+ RPC_LOG_STATE("No response for API call");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_No_Response;
+ } // LCOV_EXCL_STOP
+
+ // When the server ALIVE is queried, no result is returned, so return here
+ if (api_num == RPC_API_NUM_RPC_ALIVE) {
+ return RPC_OK;
+ }
+
+ // API call is accepted at server
+ // now wait for the return packet
+ result = RpcClientWaitResult(idinfo, server);
+ if (result != RPC_OK) {
+ RpcDiscardAPIcallReturn(idinfo);
+ return result;
+ }
+
+ /****** Function error and return value must be handled separately *******/
+ UINT8 *return_str = RPC_apicall_return_str(idinfo); /* pgr0689 */
+#ifdef APICALL_RETURN_TIMEOUT
+ if (return_str == NULL) {
+ RPC_LOG_STATE("APIcall return timeout");
+ return RPC_ERR_No_Response;
+ }
+#else
+ rpc_assert(return_str != NULL); // LCOV_EXCL_BR_LINE 6: double check
+#endif
+
+ RPC_THREAD_MUTEX_LOCK(idinfo->thread_info);
+
+ *ret_string = rpc_malloc(RPC_apicall_return_str_len(idinfo));
+ if (*ret_string != NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ if (ret_size) {
+ *ret_size = RPC_apicall_return_str_len(idinfo);
+ }
+ memcpy(*ret_string, RPC_apicall_return_str(idinfo),
+ RPC_apicall_return_str_len(idinfo));
+ } else {
+ RPC_LOG_STATE("APIcall: No Memory"); // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ result = RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ RPC_THREAD_MUTEX_UNLOCK(idinfo->thread_info);
+ RpcDiscardAPIcallReturn(idinfo);
+
+ return result;
+}
+
+/** @brief Releasing allocated memory while API call is processing
+ *
+ * (These functions are called from within a client-facing STUB. Users never use it directly.)
+ */
+ void
+RPC_free_return_string(void *ptr) {
+ if (ptr != NULL) {
+ rpc_free(ptr);
+ }
+}
+
+/** @brief Retrieving file descriptors for determining whether RPC-API calls are requested
+ *
+ * - This function returns a file descriptor used to determine whether or not there is a request to the server.
+ * - For the FD returned by this function, Don't use the other way than the FD specified
+ * in the poll or select parameter.
+ * - Intended use
+ * - Obtain FD using this function.
+ * - Wait for data to arrive by poll or select.
+ * - Call RPC_process_API_request() when data arrived.
+ * - This procedure performs handling request of the API call from the client.
+ * (Server-side API function is executed.)
+ *
+ * @param id [IN]RPC_ID of the server program.
+ * @param fd [OUT]Storage of file descriptor
+ *
+ * @retval RPC_OK: normal completion
+ * @retval Otherwise: Abnormal termination (FATAL)
+ * @see RPC_process_API_request
+ */
+ RPC_Result
+RPC_get_fd(RPC_ID id, int *fd) {
+ if ((id == RPC_NO_ID) || (fd == NULL)) {
+ return RPC_ERR_Fatal;
+ }
+ rpc_assert(fd != NULL); // LCOV_EXCL_BR_LINE 6: double check
+
+ RpcThreadInfo *th = RpcMyThreadInfo();
+
+ THREAD_INFO_CHECK(th);
+
+ SUB_THREAD_CHECK(); // LCOV_EXCL_BR_LINE 15: macro define in rpc_lib.c
+
+ RpcIdInfo *idinfo = RPC_srvr_idinfo(th);
+
+ rpc_assert(idinfo != NULL && RPC_my_id(idinfo) == id); // LCOV_EXCL_BR_LINE 6: double check
+
+ *fd = RPC_pipe_sub_main(th)[PIPE_READ];
+
+ return RPC_OK;
+}
+
+/** API Call Request Handling
+*/
+ static RPC_Result
+ProcessAPIcallRequest(RpcIdInfo *idinfo, RPC_ID client, UINT16 api_num,
+ char *args_string, unsigned int args_size) {
+ /* ----------------------------
+ * call API dispatch function
+ * ----------------------------
+ */
+
+ /* API Running Client RPC_ID Setting */
+ RPC_apicall_in_process_client(idinfo) = client;
+
+ char *ret_string = NULL;
+ unsigned int ret_size = 0;
+ RPC_dispatch_func_t dispatch = RPC_apicall_dispatch_func(idinfo);
+ rpc_assert(dispatch != NULL); // LCOV_EXCL_BR_LINE 6: double check
+ RPC_Result api_ret;
+ api_ret = dispatch(api_num, args_string, args_size, &ret_string, &ret_size); /* pgr0060 */
+
+ unsigned char retcode[RPC_RETCODE_LEN+1];
+ sprintf((char *)retcode, "%08x ", api_ret);
+
+ rpc_send_buf sendbuf[2];
+ sendbuf[0].buf = retcode;
+ sendbuf[0].bytes = sizeof(retcode) - 1;
+
+ int seq_num;
+
+ if (ret_string != NULL) {
+ sendbuf[1].buf = ret_string;
+ sendbuf[1].bytes = ret_size;
+ seq_num = RpcSendUdp2(idinfo, client, RPC_SEND_TO_CLIENT,
+ RPC_PACKET_APIRETURN, 2, sendbuf);
+ } else {
+ seq_num = RpcSendUdp2(idinfo, client, RPC_SEND_TO_CLIENT,
+ RPC_PACKET_APIRETURN, 1, sendbuf);
+ }
+ RPC_marshall_free(1, ret_string);
+
+ if (seq_num < 0) {
+ RPC_LOG_ERR("send result failed!");
+ return RPC_ERR_Fatal;
+ }
+
+ /* Set API Running Client RPC_ID to None */
+ RPC_apicall_in_process_client(idinfo) = RPC_NO_PORT;
+
+ /* Sleep API-processing entries */
+ RPC_THREAD_MUTEX_LOCK(idinfo->thread_info);
+ CL_MonitorSetEntry(CL_MONITOR_TYPE_RPC, RPC_port(idinfo),
+ CL_MONITOR_STATE_SLEEP, 0, 0);
+ RPC_THREAD_MUTEX_UNLOCK(idinfo->thread_info);
+
+ return api_ret;
+}
+
+/** @brief Executing RPC-API calls
+ *
+ * Process all queued API execution requests from clients.
+ * The API function of the server program is called from here.
+ * If there is no API execution request, the system returns normally immediately without waiting.
+ *
+ * @param id [IN]RPC_ID of the server program
+ * @retval RPC_OK: normal completion
+ * @retval Otherwise: Fatal errors
+ */
+ RPC_Result
+RPC_process_API_request(RPC_ID id) {
+ if (id == RPC_NO_ID) {
+ return RPC_ERR_Fatal;
+ }
+ RpcThreadInfo *th = RpcMyThreadInfo();
+
+ THREAD_INFO_CHECK(th);
+
+ SUB_THREAD_CHECK();
+
+ RpcIdInfo *idinfo = RPC_srvr_idinfo(th);
+
+ rpc_assert(idinfo != NULL && id == RPC_my_id(idinfo)); // LCOV_EXCL_BR_LINE 6: double check
+
+ rpc_assert(RPC_apicall_info(idinfo) != NULL /* pgr0689 */ // LCOV_EXCL_BR_LINE 6: double check
+ && RPC_apicall_dispatch_func(idinfo) != NULL); // LCOV_EXCL_BR_LINE 6: double check
+
+ char c;
+ read(RPC_pipe_sub_main(th)[PIPE_READ], &c, sizeof(c));
+
+ /* Process all API calls here */
+ UINT16 api_num;
+ RPC_ID client = RPC_NO_PORT;
+ RPC_Result result = RPC_OK;
+ char *args_string;
+ unsigned int args_size;
+ do {
+ api_num = RpcGetAPIRequest(idinfo, &client,
+ &args_string, &args_size);
+
+ if (api_num > 0) {/* API calls were queued */
+ result = ProcessAPIcallRequest(idinfo, client, api_num,
+ args_string, args_size);
+
+ RpcFreeAPIArgsString(args_string);
+
+ if (result == RPC_ERR_API_Fatal || result == RPC_ERR_Fatal) {
+ break;
+ } else {
+ result = RPC_OK;
+ }
+ }
+ } while(api_num > 0);
+
+ return result;
+}
+
+/** @brief Returns the operational state of the RPC server
+ *
+ * Returns whether or not the server with the specified RPC_ID is running.
+ *
+ * @param id [IN]RPC_ID of the server program
+ * @retval RPC_OK: Running
+ * @retval RPC_ERR_No_Response: Server is not running
+ */
+ RPC_Result
+RPC_is_server_ready(RPC_ID id) {
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ char *ret_string = NULL;
+ unsigned int ret_size;
+ RPC_Result ret;
+
+ // Invoke Internal-API Calls for Server ALIVE Queries
+ ret = RPC_API_call(id, RPC_API_NUM_RPC_ALIVE, NULL, 0,
+ &ret_string, &ret_size);
+ RPC_free_return_string(ret_string);
+
+ return ret;
+#else /* !AUTOBIND */
+ struct stat statbuf;
+ int err;
+ char sockname[128];
+
+ /* Check if server socket is created */
+ rpc_set_socket_name(sockname, id);
+ err = stat(sockname, &statbuf);
+ if (err == 0) {
+ return RPC_OK;
+ } else {
+ return RPC_ERR_No_Response;
+ }
+#endif /* !AUTOBIND */
+}
+
+/** @brief Registering UIDs and GID Lists
+ *
+ * Register a list of UIDs and GIDs that can be accepted by the RPC server.
+ * A function used by the RPC server after RPC_START_SECURE_SERVER().
+ * Return error if called from an RPC client or an RPC server that has not called RPC_START_SECURE_SERVER().
+ *
+ * @param uid_num [IN] Number of registered UIDs (number of elements in UID list array)
+ * @param *uid_list [IN] Start pointer of registered UID list
+ * @param gid_num [IN] Number of registered GIDs (number of elements in the array of GID lists)
+ * @param *gid_list [IN] Start pointer of registered GID list
+ * @retval RPC_OK: List registration completed
+ * @retval RPC_ERR_Fatal: Failed to save to list
+ */
+RPC_Result
+RPC_regist_credential(int uid_num, uid_t *uid_list, int gid_num, gid_t *gid_list) {
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ THREAD_INFO_CHECK(th);
+
+ if (NULL == RPC_srvr_idinfo(th)) {
+ RPC_LOG_ERR("No server thread info");
+ return RPC_ERR_Fatal;
+ }
+
+ RpcIdInfo *idinfo = RPC_srvr_idinfo(th);
+ if ((NULL == idinfo) || (NULL == RPC_apicall_info(idinfo))) { // LCOV_EXCL_BR_LINE 8: dead code, idinfo always isn't NULL
+ // LCOV_EXCL_START 8: dead code, idinfo always isn't NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("No RPC_ID info");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ /* Neither UID nor GID list is specified. */
+ if ((NULL == uid_list) && (NULL == gid_list)) {
+ RPC_LOG_ERR("RPC_regist_credential() : UID and GID list is NULL.");
+ return RPC_ERR_Fatal;
+ }
+
+ /* UID list argument check */
+ if ((NULL == uid_list) && ((0 < uid_num ) && (uid_num <= CREDENTIAL_LIST_NUM_MAX))) {/* UID list is invalid */
+ RPC_LOG_ERR("RPC_regist_credential() : UID list is illegal.");
+ return RPC_ERR_Fatal;
+ } else if ((NULL != uid_list) && ((1 > uid_num) || (uid_num > CREDENTIAL_LIST_NUM_MAX))) {/* Number of UID list elements is invalid */
+ RPC_LOG_ERR("RPC_regist_credential() : UID list num is illegal.");
+ return RPC_ERR_Configuration;
+ }
+
+ /* GID list argument check */
+ if ((NULL == gid_list) && ((0 < gid_num ) && (gid_num <= CREDENTIAL_LIST_NUM_MAX))) {/* GID list is invalid */
+ RPC_LOG_ERR("RPC_regist_credential() : GID list is illegal.");
+ return RPC_ERR_Fatal;
+ } else if ((NULL != gid_list) && ((1 > gid_num) || (gid_num > CREDENTIAL_LIST_NUM_MAX))) {/* Number of GID list elements is invalid */
+ RPC_LOG_ERR("RPC_regist_credential() : GID list num is illegal.");
+ return RPC_ERR_Configuration;
+ }
+
+ if (NO_SECURE_CHECK == RPC_secure_check(idinfo)) {/* Return error if registration is not necessary */
+ RPC_LOG_ERR("Needless secure check.");
+ return RPC_ERR_Fatal;
+ }
+
+ if (REGISTERED == RPC_regist_credential_info(idinfo)) {/* Return error if a list has already been registered */
+ RPC_LOG_ERR("credential info has been registered already.");
+ return RPC_ERR_Fatal;
+ }
+
+ /* Allocate as many memory areas as there are UID and GID lists */
+ RPC_apicall_info(idinfo)->uid_list = rpc_malloc(sizeof(uid_t) * (unsigned int)uid_num);
+ if (NULL == RPC_apicall_info(idinfo)->uid_list) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ RPC_LOG_ERR("Can't malloc uid_list."); // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ RPC_apicall_info(idinfo)->gid_list = rpc_malloc(sizeof(gid_t) * (unsigned int)gid_num);
+ if (NULL == RPC_apicall_info(idinfo)->gid_list) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ RPC_LOG_ERR("Can't malloc gid_list."); // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ /* Copy UID and GID registration list and number of elements */
+ memcpy(RPC_apicall_info(idinfo)->uid_list, uid_list, sizeof(uid_t) * (unsigned int)uid_num); /* UID list */
+ memcpy(RPC_apicall_info(idinfo)->gid_list, gid_list, sizeof(gid_t) * (unsigned int)gid_num); /* GID list */
+ RPC_uid_num(idinfo) = uid_num; /* Number of elements in the UID list */
+ RPC_gid_num(idinfo) = gid_num; /* Number of elements in the GID list */
+
+ /* Set whether to register authentication information to Yes/No */
+ RPC_regist_credential_info(idinfo) = REGISTERED;
+
+ return RPC_OK;
+}
+
+/** @brief Obtain authentication info (UID, GID) of API requesting client
+ *
+ * Obtain the UID and GID of the client that requested the API processing being executed.
+ * Return error if called from an RPC client or to an RPC server that has not called RPC_START_SECURE_SERVER().
+ * This function should be called within an API function (in other words, API is being executed) provided to the client.
+ * if called the other function, error is returned because there is no API being executed.
+ *
+ * @param *client_uid [OUT] Requesting client UID of running API
+ * @param *client_gid [OUT] Requesting client GID of running API
+ * @retval RPC_OK: Succeeded to obtain of authentication info
+ * @retval RPC_ERR_Fatal: Failed to obtain of authentication Info
+ */
+RPC_Result
+RPC_get_client_credential(uid_t *client_uid, gid_t *client_gid) {
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ THREAD_INFO_CHECK(th);
+
+ if (NULL == RPC_srvr_idinfo(th)) {
+ RPC_LOG_ERR("No server thread info");
+ return RPC_ERR_Fatal;
+ }
+
+ RpcIdInfo *idinfo = RPC_srvr_idinfo(th);
+ if ((NULL == idinfo) || (NULL == RPC_apicall_info(idinfo))) { // LCOV_EXCL_BR_LINE 8: dead code, idinfo always isn't NULL
+ // LCOV_EXCL_START 8: dead code, idinfo always isn't NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("No RPC_ID info");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ if ((NULL == client_uid) || (NULL == client_gid)) {/* Argument check */
+ RPC_LOG_ERR("RPC_regist_credential() : Invalid Param.");
+ return RPC_ERR_Fatal;
+ }
+
+ if (NO_SECURE_CHECK == RPC_secure_check(idinfo)) {/* Return error if no security */
+ RPC_LOG_ERR("Needless secure check.");
+ return RPC_ERR_Fatal;
+ }
+
+ if (RPC_NO_PORT == RPC_apicall_in_process_client(idinfo)) {/* Return error if the API is not being executed */
+ RPC_LOG_ERR("NOT in process APIcall.");
+ return RPC_ERR_Fatal;
+ }
+
+ char buf[7], client_path_name[SOCK_NAME_LEN]; /* Client socket name */
+
+ /* Converting client_id to the socket name associated with RPC_ID */
+ RpcSetClientName(buf, RPC_apicall_in_process_client(idinfo));
+ memcpy(client_path_name, buf + 1, 5);
+ client_path_name[5] = '\0';
+ RpcClientSockNameInfo *current = RPC_sock_info_head(idinfo);
+
+ /* Search info of running client from the management table */
+ while (NULL != current) {
+ if (0 == strcmp(current->client_sock_name, client_path_name)) {/* Match Running Client Info */
+ *client_uid = current->uid;
+ *client_gid = current->gid;
+ return RPC_OK;
+ }
+ current = current->next;
+ }
+ RPC_LOG_ERR("Nothing client credential info.");
+ return RPC_ERR_Fatal; /* Not found Client info */
+}
+
+/** @brief Waiting for server authentication
+ *
+ * When a client requests an API to the server,
+ * wait for the server to check whether it is allowed to communicate.
+ *
+ * @param *idinfo [IN] Information associated with the client's RPC_ID
+ *
+ * @retval RPC_OK: Authentication OK (communication with the server is permitted)
+ * @retval RPC_ERR_Reject_connect: Authentication NG (Communication denied)
+ */
+static RPC_Result
+RpcClientWaitCertification(RpcIdInfo *idinfo, pid_t *srvr_pid) {
+ fd_set fds;
+ RpcCertifyResult recv_ret; /* Authentication result from the server */
+ RPC_Result ret = RPC_ERR_Fatal;
+
+ for(;;) {
+ FD_ZERO(&fds);
+ FD_SET(RPC_my_secure_sock(idinfo), &fds);
+
+ int sret = select(RPC_my_secure_sock(idinfo) + 1, &fds, NULL, NULL, NULL);
+ if (sret < 0 && errno == EINTR) {/* signal interrupt */ // LCOV_EXCL_BR_LINE 5: fail safe for libc select
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue; // LCOV_EXCL_LINE 5: fail safe for libc select
+ } else if (sret > 0 && FD_ISSET(RPC_my_secure_sock(idinfo), &fds)) {
+ /* Check the response from the server */
+ ssize_t rret = recv(RPC_my_secure_sock(idinfo), (char*)&recv_ret, sizeof(RpcCertifyResult), 0);
+ if (0 < rret) { // LCOV_EXCL_BR_LINE 5: fail safe for libc recv
+ switch(recv_ret.certify_res) {
+ case CERTIFY_OK: /* OK */
+ ret = RPC_OK;
+ *srvr_pid = recv_ret.srvr_pid;
+ break;
+
+ case CERTIFY_NG: /* NG */
+ ret = RPC_ERR_Reject_connect;
+ break;
+
+ default:
+ ret = RPC_ERR_Fatal;
+ break;
+ }
+ goto exit_loop_ok;
+ } else if(0 == rret) { // LCOV_EXCL_START 5: fail safe for libc recv
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("server process terminate.");
+ return RPC_ERR_Fatal;
+ } else {
+ RPC_LOG_PERROR("certification_wait recv()");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ }
+ }
+exit_loop_ok:
+ return ret;
+}
+
+/** @brief Register the PID of the communication destination server in the management table.
+ *
+ * Register a pair of the PID and ID of the server in the management table.
+ *
+ * @param *idinfo [IN] Information associated with the client's RPC_ID
+ * @param srvr_rpc_id [IN] RPC_ID of the communication destination server
+ * @param srvr_pid [IN] PID of the communication destination server
+ *
+ * @retval RPC_OK : Registration completed
+ * @retval RPC_ERR_Fatal : Registration failed
+ */
+static RPC_Result
+RpcRegistSrvrPid(RpcIdInfo *idinfo, RPC_ID srvr_rpc_id, pid_t srvr_pid, int wd) {
+ if ((NULL == idinfo) || (srvr_rpc_id == RPC_NO_ID) || (0 > srvr_pid)) { // LCOV_EXCL_START 8: dead code, idinfo always isn't NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("RpcRegistSrvrPid() : Invalid Param.");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RpcSrvrPidInfo *srvr_pid_buf, *current;
+
+ srvr_pid_buf = rpc_malloc(sizeof(RpcSrvrPidInfo));
+ if( srvr_pid_buf == NULL ){ // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ srvr_pid_buf->srvr_rpc_id = srvr_rpc_id; /* Server RPC_ID */
+ srvr_pid_buf->srvr_pid = srvr_pid; /* Server PID */
+ srvr_pid_buf->wd = wd; /* wd */
+ srvr_pid_buf->next = NULL; /* Next node in the communication destination server PID management table */
+
+ if (0 == RPC_srvr_pid_head(idinfo)) {
+ RPC_srvr_pid_head(idinfo) = srvr_pid_buf;
+ } else {
+ for (current = RPC_srvr_pid_head(idinfo); current->next != NULL; current = current->next)
+ ;
+ current->next = srvr_pid_buf;
+ }
+ return RPC_OK;
+}
+
+/** @brief Delete Termination Process PID from Management Table
+ *
+ * Check whether the terminated process matches the communicating server process, and delete it from the management table.
+ *
+ * @param *idinfo [IN] Information associated with the client's RPC_ID
+ * @param srvr_rpc_id [IN] Currently communicating server RPC_ID
+ * @param wd [IN] Wd of the termination process
+ *
+ * @retval RPC_OK : Deletion completed
+ * @retval RPC_ERR_Server_Finish: Deletion completed (server process in communication terminated)
+ * @retval RPC_ERR_Fatal : Argument error
+ */
+ RPC_Result
+RpcDeleteSrvrPid(RpcIdInfo *idinfo, RPC_ID srvr_rpc_id, int wd) {
+ if ((NULL == idinfo) || (RPC_NO_ID == srvr_rpc_id)) { // LCOV_EXCL_START 8: dead code, idinfo always isn't NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("rpc_check_srvr_pid() : Invalid Param.");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RPC_Result ret = RPC_OK;
+ int cnt = 0;
+ RpcSrvrPidInfo *current, *previous;
+ current = RPC_srvr_pid_head(idinfo);
+
+ while (NULL != current) {
+ if (wd == current->wd) {
+
+ /* Check whether the termination process matches the communicating server process */
+ if (srvr_rpc_id == current->srvr_rpc_id) {
+ ret = RPC_ERR_Server_Finish;
+ }
+
+ /* Delete info from the Server info table */
+ if (0 == cnt) {/* Delete the start of the management table */
+ RPC_srvr_pid_head(idinfo) = RPC_srvr_pid_head(idinfo)->next;
+ rpc_free(current);
+ current = RPC_srvr_pid_head(idinfo);
+ cnt = -1;
+ } else {/* Delete all but the first element */
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ previous->next = current->next;
+ rpc_free(current);
+ current = previous->next;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ previous = current;
+ current = current->next;
+ }
+ cnt ++;
+ }
+ return ret;
+}
+
+/** @brief Delete all PID management tables of the communication destination server
+ *
+ * Releases the PID management table and deletes all data when the client terminates with RPC_end().
+ *
+ * @param *idinfo [IN] Information associated with the client's RPC_ID
+ *
+ * @retval RPC_OK : Deletion completed
+ * @retval RPC_ERR_Fatal : Argument error
+ */
+static RPC_Result
+RpcAllDeleteSrvrPid(RpcIdInfo *idinfo) {
+ if (NULL == idinfo) { // LCOV_EXCL_BR_LINE 6: double check in rpc_lib.c --> RPC_end()
+ RPC_LOG_ERR("RpcAllDeleteSrvrPid() : Invalid Param."); // LCOV_EXCL_START 6: double check in rpc_lib.c --> RPC_end()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RpcSrvrPidInfo *current = RPC_srvr_pid_head(idinfo);
+ while (NULL != current) {
+
+ if (0 <= current->wd) {
+ inotify_rm_watch(RPC_clnt_inotify_fd(idinfo), current->wd);
+ }
+
+ RpcSrvrPidInfo *previous = current;
+ current = current->next;
+
+ rpc_free(previous);
+ }
+ RPC_srvr_pid_head(idinfo) = NULL;
+ return RPC_OK;
+}
+
+/** @brief Logging RPC-API calling process
+ *
+ * Receive File name, function name and line-number of the client calling API and API-function-name, and logging them.
+ *
+ * @param filename [IN]Pointer to caller filename string
+ * @param funcname [IN]Pointer to caller function-name string
+ * @param line [IN]Line-number in the source file of the client
+ * @param apiname [IN]Pointer to call-API-function-name string
+ * @retval 0: normal completion
+ * @retval Otherwise: Fatal error
+ */
+ int
+RPC_record_dbg_log( const char *filename, const char *funcname, int line,
+ const char *apiname ) {
+ printf( "[RPC debug log]%s() called from %s() [%s, line %d]\n",
+ apiname, funcname, filename, line );
+ return 0;
+}
+
+/** @}*/
diff --git a/otherservice/rpc_library/library/src/rpc_marshall.c b/otherservice/rpc_library/library/src/rpc_marshall.c
new file mode 100755
index 0000000..8a4a56a
--- /dev/null
+++ b/otherservice/rpc_library/library/src/rpc_marshall.c
@@ -0,0 +1,740 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_marshall.c
+ * @brief RPC Library Internal Implementation--Argument Conversion During API Calls
+ *
+ */
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h>
+#include <math.h>
+
+#include <other_service/rpc.h>
+#include "rpc_internal.h"
+
+#include "apidef.tab.h"
+#include "apidef.h"
+
+/** @addtogroup RPClib_in
+ * @{
+ */
+/** Structures for String Add Operations */
+typedef struct {
+ char *start;
+ char *wp;
+ unsigned int units;
+ unsigned int remain;
+} RpcString;
+
+#ifdef STRETCH_STRING
+#define _STRING_ALLOC_UNIT 512
+#else
+/*
+ * Batch allocate total bytes of arguments + data to be added internally
+ * (maximal 6 bytes per argument)
+ */
+#define _STRING_ALLOC_UNIT \
+ (RPC_MAX_API_ARG_TOTAL_SIZE + RPC_MAX_API_ARG_NUM * (2 + 4))
+#endif
+
+#define _ENOUGH_SPACE_FOR_ALL_TYPES \
+ (sizeof(UINT64) > sizeof(double) ? sizeof(UINT64) : sizeof(double))
+
+static RpcString* NewRpcString(void);
+#ifdef STRETCH_STRING
+static int StretchString(RpcString *str, UINT16 bytes);
+#endif
+static char *CopyString(RpcString *str, unsigned int *size);
+static void DestroyString(RpcString *str);
+static inline int AppendString(RpcString *str,
+ const UINT8 *append, UINT16 applen);
+static inline int MarshallUINT8(RpcString *str, UINT8 uc);
+static inline int MarshallUINT16(RpcString *str, UINT16 uh);
+static inline int MarshallUINT32(RpcString *str, UINT32 ui);
+static inline int MarshallUINT64(RpcString *str, UINT64 ul);
+static inline int Marshallfloat(RpcString *str, float f);
+static inline int Marshalldouble(RpcString *str, double d);
+static inline int MarshallUINT8Stream(RpcString *str, const UINT8 *buf,
+ UINT16 bytes);
+static inline int MarshallString(RpcString *str, char *buf,
+ UINT16 bytes);
+static inline int MarshallNullPointer(RpcString *str);
+static inline int MarshallPointer(RpcString *str);
+
+static RpcString *
+NewRpcString(void) {
+ RpcString *str;
+
+ str = rpc_malloc(sizeof(RpcString));
+ if (str == NULL) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;
+ } // LCOV_EXCL_STOP
+
+ str->start = rpc_malloc(_STRING_ALLOC_UNIT);
+ if (str->start == NULL) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rpc_free(str);
+ return NULL;
+ } // LCOV_EXCL_STOP
+ str->start[0] = '\0';
+ str->wp = str->start;
+ str->units = 1;
+ str->remain = _STRING_ALLOC_UNIT - 1;
+
+ return str;
+}
+
+#ifdef STRETCH_STRING
+static int
+StretchString(RpcString *str, UINT16 bytes) {
+ unsigned int oldunits = str->units;
+ unsigned int units = 1 + (bytes / _STRING_ALLOC_UNIT) + oldunits;
+ if (units == oldunits) {
+ return 0;
+ }
+ unsigned int length = str->wp - str->start;
+ char *newp = rpc_malloc(units * _STRING_ALLOC_UNIT);
+ if (newp == NULL) {
+ return -1;
+ }
+ memcpy(newp, str->start, length);
+ rpc_free(str->start);
+ str->start = newp;
+ str->wp = str->start + length;
+ *(str->wp) = '\0';
+ str->units = units;
+ str->remain += (units - oldunits) * _STRING_ALLOC_UNIT;
+ return 0;
+}
+#endif /* STRETCH_STRING */
+
+static inline int
+AppendString(RpcString *str, const UINT8 *append, UINT16 applen) {
+ rpc_assert(append != NULL); // LCOV_EXCL_BR_LINE 6: double check
+#ifdef STRETCH_STRING
+ if (applen > str->remain) {
+ if (StretchString(str, applen - str->remain) < 0) {
+ return -1;
+ }
+ }
+#else
+ rpc_assert(applen <= str->remain); // LCOV_EXCL_BR_LINE 6: double check
+#endif
+ memcpy(str->wp, append, applen);
+ str->wp += applen;
+ str->remain -= applen;
+ return 0;
+}
+
+static char *
+CopyString(RpcString *str, unsigned int *size) {
+ unsigned int length = (unsigned int)(str->wp - str->start);
+ char *ret = rpc_malloc(length);
+ // LCOV_EXCL_BR_START 5: fail safe for libc malloc
+ if (ret == NULL) {
+ return NULL;
+ }
+ // LCOV_EXCL_BR_STOP
+ memcpy(ret, str->start, length);
+ if (size != NULL) {
+ *size = length;
+ }
+
+ return ret;
+}
+
+static void
+DestroyString(RpcString *str) {
+ rpc_free(str->start);
+ rpc_free(str);
+}
+
+static inline int
+MarshallUINT8(RpcString *str, UINT8 c) {
+ UINT8 buf[1 + sizeof(c)];
+ buf[0] = 'C';
+ buf[1] = c;
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+MarshallUINT8Stream(RpcString *str, const UINT8 *buf, UINT16 bytes) {
+ int ret = AppendString(str, (const UINT8 *)"B", 1);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 15: inline func rpc_marshall.c
+ return -1;
+ }
+ return AppendString(str, buf, bytes);
+}
+
+static inline int
+MarshallVararrayStream(RpcString *str, const UINT8 *buf, UINT16 bytes) {
+ char head_str[1+4+1+1]; /* Area where symbol "V" + size is stored */
+ sprintf(head_str, "V%03d ", bytes);
+ head_str[1+4+1] = '\0';
+
+ if (AppendString(str, (const UINT8 *)head_str, (UINT16)strlen(head_str)) < 0) { // LCOV_EXCL_BR_LINE 15: inline func rpc_marshall.c
+ return -1;
+ }
+
+ if (AppendString(str, buf, bytes) < 0) { // LCOV_EXCL_BR_LINE 15: inline func rpc_marshall.c
+ return -1;
+ }
+ return 0;
+}
+
+static inline int
+MarshallString(RpcString *str, char *buf, UINT16 bytes) {
+ char *p = buf;
+ UINT16 count = 0;
+ /* count the number of bytes in the argument */
+ while(*p != '\0' && count < (UINT16)(bytes - 1)) {
+ count++;
+ p++;
+ }
+
+ char count_str[1+strlen("1024")+1+1];
+ sprintf(count_str, "S%d ", count);
+
+ if (AppendString(str, (const UINT8 *)count_str, (UINT16)strlen(count_str)) < 0 || AppendString(str, (const UINT8 *)buf, count) < 0) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ return -1;
+ }
+ return 0;
+}
+
+static int
+MarshallUINT16(RpcString *str, UINT16 uh) {
+ UINT8 buf[1 + sizeof(uh)];
+ buf[0] = 'H';
+ memcpy(buf + 1, &uh, sizeof(uh));
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+MarshallUINT32(RpcString *str, UINT32 ui) {
+ UINT8 buf[1 + sizeof(ui)];
+ buf[0] = 'I';
+ memcpy(buf + 1, &ui, sizeof(ui));
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+Marshallint(RpcString *str, int i) {
+ return MarshallUINT32(str, (UINT32)i);
+}
+
+static inline int
+MarshallUINT64(RpcString *str, UINT64 ul) {
+ UINT8 buf[1 + sizeof(ul)];
+ buf[0] = 'L';
+ memcpy(buf + 1, &ul, sizeof(ul));
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+Marshallfloat(RpcString *str, float f) {
+ UINT8 buf[1 + sizeof(f)];
+ buf[0] = 'F';
+ memcpy(buf + 1, &f, sizeof(f));
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+Marshalldouble(RpcString *str, double d) {
+ UINT8 buf[1 + sizeof(d)];
+ buf[0] = 'D';
+ memcpy(buf + 1, &d, sizeof(d));
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+MarshallPointer(RpcString *str) {
+ /* only to specify that a non-NULL pointer was delivered */
+ return AppendString(str, (const UINT8 *)"P", 1);
+}
+
+static inline int
+MarshallNullPointer(RpcString *str /*, int code*/) {
+ return AppendString(str, (const UINT8 *)"N", 1);
+}
+
+/** @ingroup RPClib_in
+ */
+
+#define MACROMarshallPointer(TYPE) \
+ do { \
+ TYPE *p = (TYPE *)temp; \
+ error = Marshall##TYPE(str, *p); \
+ } while(0)
+
+#define MACROMarshallValue(TYPE, STACK_TYPE) \
+ do { \
+ TYPE value = (TYPE)va_arg(ap, STACK_TYPE); \
+ error = Marshall##TYPE(str, value); \
+ } while(0)
+
+char *
+RPC_marshall_arguments(unsigned int *size, int dont_marshall_out_pointer,
+ int num_args, ...) {
+ rpc_assert(num_args <= RPC_MAX_API_ARG_NUM); // LCOV_EXCL_BR_LINE 6: double check
+ va_list ap;
+
+ RpcString *str;
+ str = NewRpcString();
+ if (str == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ }
+
+ va_start(ap, num_args);
+
+ int ii, error;
+ error = 0;
+
+ for(ii = 0 ; ii < num_args && error == 0 ; ii++) {
+ unsigned int code, is_vararray, is_pointer, in_out, out_only;
+ UINT16 bytes;
+ unsigned int val = va_arg(ap, unsigned int);
+
+ RPC_marshall_flag flag;
+ flag.all = ntohl(val);
+ code = flag.bits.code;
+ is_vararray = flag.bits.is_vararray;
+ is_pointer = flag.bits.is_pointer;
+ in_out = flag.bits.in_out;
+ bytes = flag.bits.bytes;
+ rpc_assert(bytes <= RPC_MAX_API_ARG_SIZE); // LCOV_EXCL_BR_LINE 6: double check
+
+
+ out_only = 0;
+ if (in_out == RPC_OUT_ARG) { /* OUT only argument */
+ out_only = 1;
+ }
+
+ if (is_pointer) { /* Argument passed by pointer */
+
+ void *temp = (void *)va_arg(ap, void *);
+ if (temp == NULL) {
+ /* NULL pointer */
+ error = MarshallNullPointer(str);
+ } else if (dont_marshall_out_pointer && out_only) {
+ /* Not refer to the contents of a pointer */
+ error = MarshallPointer(str);
+ } else {/* Marshall the contents of pointers */
+ if (is_vararray) {
+ /* Variable-length array */
+ error = MarshallVararrayStream(str, temp, bytes);
+ } else {
+ switch(code) {
+ case rpc_CHAR:
+ case rpc_INT8:
+ case rpc_UINT8:
+ MACROMarshallPointer(UINT8);
+ break;
+ case rpc_INT16:
+ case rpc_UINT16:
+ MACROMarshallPointer(UINT16);
+ break;
+ case rpc_INT:
+ case rpc_SINT:
+ case rpc_UINT:
+ MACROMarshallPointer(int);
+ break;
+ case rpc_INT32:
+ case rpc_UINT32:
+ MACROMarshallPointer(UINT32);
+ break;
+ case rpc_INT64:
+ case rpc_UINT64:
+ MACROMarshallPointer(UINT64);
+ break;
+ case rpc_FLOAT:
+ MACROMarshallPointer(float);
+ break;
+ case rpc_DOUBLE:
+ MACROMarshallPointer(double);
+ break;
+ case rpc_STRING:
+ error = MarshallString(str, temp, bytes);
+ break;
+ case rpc_USER_DEFINED:
+ error = MarshallUINT8Stream(str, temp, bytes);
+ break;
+ default:
+ error = -1;
+ break;
+ }
+ }
+ }
+ } else {/* Argument passed by value */
+
+ /* Note: In this area, the code depends on the CPU architecture */
+
+ switch(code) {
+ case rpc_CHAR:
+ case rpc_INT8:
+ case rpc_UINT8:
+ MACROMarshallValue(UINT8, unsigned int);
+ break;
+ case rpc_INT16:
+ case rpc_UINT16:
+ MACROMarshallValue(UINT16, unsigned int);
+ break;
+ case rpc_INT:
+ case rpc_SINT:
+ case rpc_UINT:
+ MACROMarshallValue(int, int); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT32:
+ case rpc_UINT32:
+ MACROMarshallValue(UINT32, UINT32); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT64:
+ case rpc_UINT64:
+ MACROMarshallValue(UINT64, UINT64); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_FLOAT:
+ MACROMarshallValue(float, double); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_DOUBLE:
+ MACROMarshallValue(double, double); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_USER_DEFINED:
+ rpc_assert(bytes <= sizeof(UINT64));
+ /* This area is very architecture-dependent! */
+ if (bytes <= sizeof(UINT32)) {
+ UINT32 value = (UINT32)va_arg(ap, UINT32); // LCOV_EXCL_BR_LINE 15: macro defined in stdarg.h
+ error = MarshallUINT8Stream(str, (UINT8 *)&value, bytes);
+ } else if (bytes <= sizeof(UINT64)) { // LCOV_EXCL_BR_LINE 6: double check
+ UINT64 value = (UINT64)va_arg(ap, UINT64); // LCOV_EXCL_BR_LINE 15: macro defined in stdarg.h
+ error = MarshallUINT8Stream(str, (UINT8 *)&value, bytes);
+ }
+ break;
+ default:
+ error = -1;
+ break;
+ }
+ }
+ }
+ va_end(ap);
+
+ if (error != 0) {
+ DestroyString(str);
+ return NULL;
+ }
+
+ char *ret = CopyString(str, size);
+ DestroyString(str);
+ return ret;
+}
+
+static inline int DeMarshallUINT8(const char *from, UINT8 *ucp);
+static inline int DeMarshallUINT16(const char *from, UINT16 *uhp);
+static inline int DeMarshallUINT32(const char *from, UINT32 *uip);
+static inline int DeMarshallUINT64(const char *from, UINT64 *ulp);
+static inline int DeMarshallfloat(const char *from, float *fp);
+static inline int DeMarshalldouble(const char *from, double *dp);
+static inline int DeMarshallUINT8Stream(const char *from, UINT8 *buffer,
+ UINT16 bytes);
+static inline int DeMarshallString(const char *from, char *buffer,
+ UINT16 bytes);
+
+static inline int
+DeMarshallUINT8(const char *from, UINT8 *ucp) {
+ if (*from == 'C') {
+ *ucp = *(UINT8 *)(from + 1);
+ return 1 + sizeof(*ucp);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallUINT16(const char *from, UINT16 *uhp) {
+ if (*from == 'H') {
+ memcpy(uhp, from + 1, sizeof(*uhp));
+ return 1 + sizeof(*uhp);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallUINT32(const char *from, UINT32 *uip) {
+ if (*from == 'I') {
+ memcpy(uip, from + 1, sizeof(*uip));
+ return 1 + sizeof(*uip);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallint(const char *from, int *ip) {
+ return DeMarshallUINT32(from, (UINT32 *)ip);
+}
+
+static inline int
+DeMarshallUINT64(const char *from, UINT64 *ulp) {
+ if (*from == 'L') {
+ memcpy(ulp, from + 1, sizeof(*ulp));
+ return 1 + sizeof(*ulp);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallfloat(const char *from, float *fp) {
+ if (*from == 'F') {
+ memcpy(fp, from + 1, sizeof(*fp));
+ return 1 + sizeof(*fp);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshalldouble(const char *from, double *dp) {
+ if (*from == 'D') {
+ memcpy(dp, from + 1, sizeof(*dp));
+
+ return 1 + sizeof(*dp);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallUINT8Stream(const char *from, UINT8 *buffer, UINT16 bytes) {
+ if (*from == 'B') {
+ memcpy(buffer, from + 1, bytes);
+ return (int)(1 + bytes);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallString(const char *from, char *buffer, UINT16 bytes) {
+ if (*from == 'S') {
+ char *start;
+ long len = strtol(from + 1, &start, 10);
+ if (len < 0 || len >= bytes) { // LCOV_EXCL_BR_LINE 5: fail safe for libc strtol
+ return -1;
+ }
+ start++; /* skip ' ' */
+ int skip = (int)(start - from);
+ memcpy(buffer, start, (size_t)len);
+ buffer[len] = '\0';
+ return skip + (int)len;
+ } else {
+ return -1;
+ }
+}
+
+/* Variable-length array data */
+static inline int
+DemarshallVararrayInfo(const char *from, UINT16 *bytes/* OUT */) {
+ if (*from == 'V') {
+ char *end;
+ long len = strtol((char *)(from + 1), &end, 10);
+ if (len <= 0 || len > RPC_MAX_API_ARG_SIZE) { // LCOV_EXCL_BR_LINE 5: fail safe for libc strtol
+ return -1;
+ }
+ *bytes = (UINT16)len;
+ return (int)(end - from + 1); /* skip ' ' */
+ } else {
+ return -1;
+ }
+}
+
+/** @ingroup RPClib_in
+ */
+
+#define MACRODemarshall(TYPE) \
+ do {\
+ TYPE *p; \
+ if (need_alloc && is_pointer) { \
+ p = rpc_malloc(sizeof(TYPE)); \
+ *(TYPE **)temp = p; \
+ } else { \
+ p = (TYPE *)temp; \
+ } \
+ if (p != NULL) { \
+ ret = DeMarshall##TYPE(from, p); \
+ } \
+ } while(0)
+
+int
+RPC_demarshall_arguments(const char *from, unsigned int size,
+ int need_alloc, int num_args, ...) {
+ rpc_assert(num_args <= RPC_MAX_API_ARG_NUM); // LCOV_EXCL_BR_LINE 6: double check
+ va_list ap;
+ va_start(ap, num_args);
+
+ int ii, error;
+ error = 0;
+ int remain_len = (int)size;
+
+ for(ii = 0 ; ii < num_args && error == 0 && remain_len > 0 ; ii++) {
+ unsigned int code, is_pointer, is_vararray;
+ UINT16 bytes;
+ unsigned int val = va_arg(ap, unsigned int);
+ RPC_marshall_flag flag;
+ flag.all = ntohl(val);
+ code = flag.bits.code;
+ is_vararray = flag.bits.is_vararray;
+ is_pointer = flag.bits.is_pointer;
+ bytes = flag.bits.bytes;
+ rpc_assert(bytes <= RPC_MAX_API_ARG_SIZE); // LCOV_EXCL_BR_LINE 6: double check
+
+
+ void *temp = va_arg(ap, void *);
+ int ret = -1;
+
+ if (*from == 'N') { /* NULL pointer */
+ if (bytes > 0 || is_pointer != 0) {
+ if (need_alloc) {
+ *(void **)temp = NULL;
+ } else {
+ /* do nothing */
+ }
+ ret = 1;
+ }
+ } else if (*from == 'P') { /* Pointer(no content) */
+ if (need_alloc) {
+ if (bytes > 0) { /* String type or user-defined type */
+ *(void **)temp = rpc_malloc(bytes);
+ } else if (is_pointer != 0) { /* Other pointers */
+ *(void **)temp = rpc_malloc(_ENOUGH_SPACE_FOR_ALL_TYPES);
+ }
+ ret = 1;
+ }
+ } else { /* non-NULL pointer */
+ if ( is_vararray ) { /* Variable-length array */
+ ret = DemarshallVararrayInfo(from, &bytes);
+ if( ret < 0 ) {
+ va_end(ap);
+ return -1; /* pgr0524 */
+ }
+ char *p;
+ if (need_alloc) {
+ p = rpc_malloc(sizeof(char)*bytes);
+ *(char **)temp = p;
+ } else {
+ p = (char *)temp; /* pgr0524 */
+ }
+ if (p != NULL) {
+ memcpy(p, from + ret, bytes);
+ ret += bytes;
+ }
+ } else {
+ switch(code) {
+ case rpc_CHAR:
+ case rpc_INT8:
+ case rpc_UINT8:
+ MACRODemarshall(UINT8); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT16:
+ case rpc_UINT16:
+ MACRODemarshall(UINT16); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT:
+ case rpc_SINT:
+ case rpc_UINT:
+ MACRODemarshall(int); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT32:
+ case rpc_UINT32:
+ MACRODemarshall(UINT32); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT64:
+ case rpc_UINT64:
+ MACRODemarshall(UINT64); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_FLOAT:
+ MACRODemarshall(float); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_DOUBLE:
+ MACRODemarshall(double); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_USER_DEFINED: {
+ UINT8 *p;
+ if (need_alloc && is_pointer) {
+ p = rpc_malloc(bytes);
+ *(UINT8 **)temp = p;
+ } else {
+ p = (UINT8 *)temp; /* pgr0524 */
+ }
+ if (p != NULL) {
+ ret = DeMarshallUINT8Stream(from, p, bytes);
+ }
+ break;
+ }
+ case rpc_STRING: {
+ char *p;
+ if (need_alloc) {
+ p = rpc_malloc(sizeof(char)*bytes);
+ *(char **)temp = p;
+ } else {
+ p = (char *)temp; /* pgr0524 */
+ }
+ if (p != NULL) {
+ ret = DeMarshallString(from, p, bytes);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+ if (ret < 0) {
+ error = 1;
+ } else {
+ remain_len -= ret;
+ from += ret;
+ }
+ }
+ va_end(ap);
+
+ if (error) {
+ return -1; /* pgr0524 */
+ } else {
+ return 0; /* pgr0524 */
+ }
+}
+
+void
+RPC_marshall_free(int num, ...) {
+ va_list ap;
+ va_start(ap, num);
+
+ int i;
+ for(i = 0 ; i < num ; i++) {
+ void *ptr = va_arg(ap, void *); // LCOV_EXCL_BR_LINE 15: macro defined in stdarg.h
+ if (ptr != NULL) {
+ rpc_free(ptr);
+ }
+ }
+ va_end(ap);
+}
diff --git a/otherservice/rpc_library/library/src/rpc_thread.c b/otherservice/rpc_library/library/src/rpc_thread.c
new file mode 100755
index 0000000..df0f746
--- /dev/null
+++ b/otherservice/rpc_library/library/src/rpc_thread.c
@@ -0,0 +1,1224 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_thread.c
+ * @brief RPC Library Internal Implementation--Processing of Internally Generated Threads
+ *
+ */
+/** @addtogroup RPClib_in */
+/** @{ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <malloc.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/select.h>
+#include <sys/poll.h>
+#include <sys/prctl.h>
+
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <sys/inotify.h>
+
+#include <other_service/rpc.h>
+#include "rpc_internal.h"
+
+#include <native_service/cl_monitor.h>
+#include <native_service/cl_process.h>
+
+/** Sub-threads that wake up in the RPC library */
+static RpcThreadInfo *Thread_info[RPC_MAX_THREADS_IN_PROCESS];
+static int Num_thread_info;
+pthread_t g_rpc_thread = RPC_NO_THREAD;
+UINT32 g_rpc_thread_alive;/**< Sub-thread running */
+
+#define RPC_MAGIC_ID (('R'<<24)|('P'<<16)|('C'<<8)|'L')
+
+/** Pipes used for communication with sub-threads
+ * Read: Main thread, Write: Sub-thread */
+int g_rpc_pipe_main_sub[2] = { -1, -1 };
+
+static pthread_mutex_t process_global_mutex = PTHREAD_MUTEX_INITIALIZER;
+#define PROCESS_MUTEX_LOCK rpc_mutex_lock(&process_global_mutex)
+#define PROCESS_MUTEX_UNLOCK rpc_mutex_unlock(&process_global_mutex)
+
+static void *RpcThreadMain(void *ptr);
+static void NotifyMainThread(RpcThreadInfo *th);
+
+static void KillRpcThread(void);
+static void NotifyAddServer(RpcThreadInfo *th);
+static void NotifyRemoveServer(RpcThreadInfo *th);
+
+static RPC_Result RpcRegistSockName(RpcIdInfo *idinfo, char *client_sock_name, const struct ucred *cr, int wd);
+static RPC_Result RpcCheckSockName(RpcIdInfo *idinfo, RPC_ID client_id);
+static RPC_Result RpcDeleteSockName(RpcIdInfo *idinfo, int wd);
+static RPC_Result RpcAllDeleteSockName(RpcIdInfo *idinfo, int inotify_fd);
+static RPC_Result RpcCheckClientCredential(RpcIdInfo *idinfo, const struct ucred *cr);
+
+#define RPC_SUB_THREAD_WAIT_SEC 5
+
+#define WAIT_FOR_SUB_THREAD(loop_cond, sec) \
+{ \
+ struct timeval timeout; \
+ timeout.tv_sec = sec; \
+ timeout.tv_usec = 0; \
+ \
+ int fd = RPC_pipe_sub_main(th)[PIPE_READ]; \
+ fd_set fds; \
+ \
+ while((loop_cond)) { \
+ FD_ZERO(&fds); \
+ FD_SET(fd, &fds); \
+ int sret = select(fd + 1, &fds, NULL, NULL, &timeout); \
+ if (sret < 0 && errno == EINTR) { \
+ continue; \
+ } else if (sret > 0 && FD_ISSET(fd, &fds)) { \
+ char c; \
+ read(fd, &c, sizeof(c)); \
+ } else { \
+ break; \
+ } \
+ } \
+}
+
+RUNS_IN_CALLERS_THREAD
+ RpcThreadInfo *
+RpcMyThreadInfo(void) {
+ RpcThreadInfo *ret = NULL;
+ int i;
+ pthread_t me = pthread_self();
+
+ PROCESS_MUTEX_LOCK;
+ for(i = 0; i < RPC_MAX_THREADS_IN_PROCESS ; i++) {
+ if (Thread_info[i] != NULL
+ && pthread_equal(Thread_info[i]->thread, me)) {
+ ret = Thread_info[i];
+ break;
+ }
+ }
+ PROCESS_MUTEX_UNLOCK;
+ return ret;
+}
+
+RUNS_IN_CALLERS_THREAD
+ RpcThreadInfo *
+RpcCreateThreadInfo(void) {
+ int i;
+ pthread_t me = pthread_self();
+
+ PROCESS_MUTEX_LOCK;
+ /* Look for a free slot to store the thread info pointer */
+ for(i = 0; i < RPC_MAX_THREADS_IN_PROCESS ; i++) {
+ if (Thread_info[i] != NULL) {
+ if (pthread_equal(Thread_info[i]->thread, me)) { // LCOV_EXCL_BR_LINE 6: double check
+ PROCESS_MUTEX_UNLOCK; // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return Thread_info[i];
+ } // LCOV_EXCL_STOP
+ } else {
+ break;
+ }
+ }
+
+ if (i == RPC_MAX_THREADS_IN_PROCESS) {
+ PROCESS_MUTEX_UNLOCK;
+ //CONFIG_ASSERT("Must increase RPC_MAX_THREADS_IN_PROCESS");
+ RPC_LOG_ERR("Must increase RPC_MAX_THREADS_IN_PROCESS");
+ return NULL;
+ }
+
+ /* Allocate area for thread info */
+ // Because there is a timing when the server sub-thread is accessed without being initialized,
+ // corrected so as to fill up to 0 in the MUTEX.
+ RpcThreadInfo *th = rpc_malloc(sizeof(*th));
+ if (th != NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ memset(th, 0, sizeof(*th));
+ Thread_info[i] = th;
+ th->magic = RPC_MAGIC_ID;
+ Num_thread_info++;
+ }
+ PROCESS_MUTEX_UNLOCK;
+
+ if (th == NULL) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("Can't alloc thread_info.");
+ return NULL;
+ } // LCOV_EXCL_STOP
+
+ /* Initializing Thread Info */
+ th->thread = me;
+ pthread_mutex_init(&(th->th_mtx), NULL);
+ th->sequence_number = RPC_SEQ_NUM_START;
+
+ return th;
+}
+
+/*
+ * check if the allocated client ID conflicts with the server ID
+ * of the same thread
+ */
+ static int
+RpcCheckIdConflict(RpcThreadInfo *th, RPC_ID id) {
+ RpcIdInfo *idinfo;
+ idinfo = RPC_srvr_idinfo(th);
+ if (idinfo != NULL && RPC_my_id(idinfo) == id) { // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 1;
+ } // LCOV_EXCL_STOP
+ return 0;
+}
+
+/** Adding IDs with RPC_start()
+ *
+ * - Main: Create and initialize structures and tell sub-threads to add
+ * - Sub: Add pointer to thread info (RpcThreadInfo) and notify it to the main process
+ * - The main process waits for this procedure to finish.
+ * Use id_info->thread_info to determine completion (completed if not NULL)
+ */
+RUNS_IN_CALLERS_THREAD
+ int
+RpcCreateIdInfo(RpcThreadInfo *th,
+ RPC_ID id, RPC_dispatch_func_t dispatch, INT32 secure_check) {
+ RpcIdInfo *id_info = rpc_malloc(sizeof(*id_info));
+ if (id_info == NULL) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ } // LCOV_EXCL_STOP
+ memset(id_info, 0, sizeof(*id_info));
+
+ /*
+ * Creates a Unix domain socket based on a given number of ports
+ */
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ int sock_un = -1, secure_sock_un = -1;
+ socklen_t sa_len;
+ struct sockaddr_un sa_un;
+
+get_id_retry:
+ sock_un = socket(PF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0); /* Datagram socket for receiving API requests */
+ if (sock_un < 0) {
+ RPC_LOG_PERROR("socket");
+ goto error;
+ }
+ SET_NONBLOCK(sock_un);
+ SET_CLOSE_ON_EXEC(sock_un);
+
+ /*
+ * Naming Rules for Unix domain Sockets
+ * Server:(ID=50000-59999)
+ * sa_un.sun_path[0] = 0x00;
+ * sa_un.sun_path[1] = 'S';
+ * sa_un.sun_path[2-5] = sprintf("%04x", ID);
+ *
+ * Client:(ID=1-0xfffff)
+ * sa_un.sun_path[0] = 0x00;
+ * sa_un.sun_path[1-5] = sprintf("%05x", ID);
+ * ID is autobind by kernel during bind(see linux/net/unix/af_unix.c)
+ * ! Since it depends on the unix socket implementations of Linux, be careful when porting to other operating systems.
+ *
+ * ID=50000-59999 is duplicated in Server and Client,
+ * but generated it according to the above rules when sent in the RPClib (see rpc_udp.c)
+ *
+ * Because file deletion is leaked when the system is forcibly terminated and abnormal process termination
+ * by a traditional way to create and bind files under /tmp/RPC/,
+ * change to the above method(2009.02.04,2012.01.21)
+ */
+ memset(&sa_un, 0, sizeof(sa_un));
+ sa_un.sun_family = AF_UNIX;
+ if (dispatch != NULL) { // server
+ RpcSetServerName(sa_un.sun_path, id);
+ sa_len = sizeof(sa_un.sun_family) + SOCK_NAME_LEN;
+ } else { // client
+ // Automatically assign name (ID) by unix_autobind()
+ sa_len = sizeof(sa_un.sun_family);
+ }
+
+#else /* !AUTOBIND */
+ int sock_un = -1;
+ struct sockaddr_un sa_un;
+ sa_un.sun_family = AF_UNIX;
+ rpc_set_socket_name(sa_un.sun_path, id);
+ sock_un = socket(PF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
+ if (sock_un < 0) {
+ RPC_LOG_PERROR("socket(unix)");
+ goto error;
+ }
+ SET_NONBLOCK(sock_un);
+ SET_CLOSE_ON_EXEC(sock_un);
+ unlink(sa_un.sun_path);
+ sa_len = sizeof(sa_un);
+#endif /* !AUTOBIND */
+ if (bind(sock_un, (struct sockaddr *)&sa_un, sa_len) < 0) {
+ RPC_LOG_PERROR("DGRAM : bind(unix), ID:%#x", id);
+ goto error;
+ }
+
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ if (dispatch == NULL) { // client
+ // Retrieves the assigned name (ID)
+ socklen_t len = sizeof(sa_un);
+ if (getsockname(sock_un, (struct sockaddr *)&sa_un, &len) < 0) {
+ perror("getsockname");
+ goto error;
+ }
+ RpcGetClientName(sa_un.sun_path, &id);
+ if (RpcCheckIdConflict(th, id)) { // LCOV_EXCL_BR_LINE 8: dead code, RpcCheckIdConflict always is false
+ // LCOV_EXCL_START 8: dead code, RpcCheckIdConflict always is false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_STATE("ID %d conflicts with server -- get next one", id);
+ close(sock_un);
+ goto get_id_retry;
+ } // LCOV_EXCL_STOP
+ RPC_LOG_DEBUG("client %s", sa_un.sun_path + 1);
+ }
+#endif /* AUTOBIND */
+
+ id_info->port = id;
+ id_info->sock = sock_un;
+
+ if (dispatch != NULL) { /* server */
+ rpc_assert(th->srvr_id == NULL); // LCOV_EXCL_BR_LINE 6: double check
+ RpcApicallInfo *apicall = rpc_malloc(sizeof(*apicall));
+ if (apicall == NULL) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto error;
+ } // LCOV_EXCL_STOP
+
+ /* Create Socket for Authentication */
+ socklen_t secure_sa_len;
+ struct sockaddr_un secure_sa_un;
+
+ secure_sock_un = socket(PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0); /* stream socket for authentication */
+ if (secure_sock_un < 0) {
+ RPC_LOG_PERROR("socket");
+ rpc_free(apicall);
+ apicall = NULL;
+ goto error;
+ }
+ SET_NONBLOCK(secure_sock_un);
+ SET_CLOSE_ON_EXEC(secure_sock_un);
+
+ memset(&secure_sa_un, 0, sizeof(secure_sa_un));
+ secure_sa_un.sun_family = AF_UNIX;
+ RpcSetServerSecureName(secure_sa_un.sun_path, id);
+ secure_sa_len = sizeof(secure_sa_un.sun_family) + SECURE_SOCK_NAME_LEN;
+
+ /* Bind socket for authentication */
+ if (bind(secure_sock_un, (struct sockaddr *)&secure_sa_un, secure_sa_len) < 0) {
+ RPC_LOG_PERROR("STREAM : bind(unix), ID:%#x", id);
+ rpc_free(apicall);
+ apicall = NULL;
+ goto error;
+ }
+
+ id_info->secure_sock = secure_sock_un;
+
+ memset(apicall, 0, sizeof(*apicall));
+ apicall->dispatch_func = dispatch;
+ apicall->pipe_sub_main[PIPE_READ] = -1;
+ apicall->pipe_sub_main[PIPE_WRITE] = -1;
+ apicall->timeout_sec = 30; /* Server API processing timeout */
+ apicall->secure_check = secure_check; /* Authentication check by UID list */
+ if (NEED_SECURE_CHECK == secure_check) { /* Initializes the UID list with not-registered if secured given. */
+ apicall->regist_credential_info = NO_REGISTERED;
+ }
+ apicall->sock_info_head = NULL; /* Leading Node of Source Client Socket Info */
+ apicall->client_sock_name_num = 0; /* Number of elements in the source client's socket name list */
+ apicall->in_process_client = RPC_NO_PORT; /* Client RPC_ID during API processing */
+
+ id_info->apicall = apicall;
+ th->srvr_id = id_info;
+
+ /* Creating a pipe for communication pipe from sub-thread to main-thread direction */
+ if (pipe(apicall->pipe_sub_main) != 0) {
+ RPC_LOG_PERROR("pipe");
+ goto error;
+ }
+ SET_NONBLOCK(apicall->pipe_sub_main[PIPE_READ]);
+ SET_CLOSE_ON_EXEC(apicall->pipe_sub_main[PIPE_READ]);
+ SET_NONBLOCK(apicall->pipe_sub_main[PIPE_WRITE]);
+ SET_CLOSE_ON_EXEC(apicall->pipe_sub_main[PIPE_WRITE]);
+
+ PROCESS_MUTEX_LOCK;
+ if (g_rpc_thread == RPC_NO_THREAD) { /* There are no sub-threads. */
+ /* Creating a pipe for communication from main-thread to sub-thread direction */
+ if (pipe(g_rpc_pipe_main_sub) != 0) {
+ RPC_LOG_PERROR("pipe");
+ PROCESS_MUTEX_UNLOCK;
+ goto error;
+ }
+
+ SET_NONBLOCK(g_rpc_pipe_main_sub[PIPE_READ]);
+ SET_CLOSE_ON_EXEC(g_rpc_pipe_main_sub[PIPE_READ]);
+ SET_NONBLOCK(g_rpc_pipe_main_sub[PIPE_WRITE]);
+ SET_CLOSE_ON_EXEC(g_rpc_pipe_main_sub[PIPE_WRITE]);
+
+ /* Creating sub-thread */
+ pthread_t read_th;
+ if (pthread_create(&read_th, NULL, RpcThreadMain, 0) != 0) {
+ RPC_LOG_PERROR("pthread_create");
+ PROCESS_MUTEX_UNLOCK;
+ goto error;
+ }
+ g_rpc_thread = read_th;
+ }
+ PROCESS_MUTEX_UNLOCK;
+
+ /* Instruct a sub-thread to add and wait for completion */
+ NotifyAddServer(th);
+ // LCOV_EXCL_BR_START 15: macro define in rpc_thread.c
+ WAIT_FOR_SUB_THREAD((th->srvr_id->thread_info == NULL),
+ RPC_SUB_THREAD_WAIT_SEC);
+ // LCOV_EXCL_BR_STOP
+ rpc_assert(th->srvr_id->thread_info != NULL); // LCOV_EXCL_BR_LINE 6: double check
+
+ } else { /* dispatch == NULL => client */
+ id_info->count = 1;
+ id_info->thread_info = th;
+ th->clnt_id = id_info;
+ }
+ return 0; /* pgr0524 */
+
+error:
+ if (g_rpc_pipe_main_sub[PIPE_READ] >= 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc socket
+ close(g_rpc_pipe_main_sub[PIPE_READ]);
+ }
+ if (g_rpc_pipe_main_sub[PIPE_WRITE] >= 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc socket
+ close(g_rpc_pipe_main_sub[PIPE_WRITE]);
+ }
+ if (id_info->apicall != NULL) {
+ if (id_info->apicall->pipe_sub_main[PIPE_READ] >= 0) {
+ close(id_info->apicall->pipe_sub_main[PIPE_READ]);
+ }
+ if (id_info->apicall->pipe_sub_main[PIPE_WRITE] >= 0) {
+ close(id_info->apicall->pipe_sub_main[PIPE_WRITE]);
+ }
+ rpc_free(id_info->apicall);
+ }
+ if (sock_un != -1) {
+ close(sock_un);
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+ unlink(sa_un.sun_path);
+#endif /* !AUTOBIND */
+ }
+ if (secure_sock_un != -1) {
+ close(secure_sock_un);
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+ unlink(secure_sa_un.sun_path);
+#endif /* !AUTOBIND */
+ }
+ rpc_free(id_info);
+ th->srvr_id = NULL;
+ return -1; /* pgr0524 */
+}
+
+/*
+ * Notify an unfinished request of an error at server termination (RPC_end).
+ */
+ static void
+RpcSendErrorToPendingRequest(RpcThreadInfo *th, RpcIdInfo *idinfo) {
+ UINT16 api_num;
+ RPC_ID client;
+ char *args_string;
+ unsigned int args_size;
+ rpc_send_buf sendbuf;
+ char retcode[10];
+
+ do {
+ api_num = RpcGetAPIRequest(idinfo, &client,
+ &args_string, &args_size);
+ if (api_num > 0) { /* API calls are queued */
+
+ sprintf(retcode, "%08x ", RPC_ERR_Fatal);
+ sendbuf.buf = retcode;
+ sendbuf.bytes = sizeof(retcode) - 1;
+ RpcSendUdp2(idinfo, client, RPC_SEND_TO_CLIENT,
+ RPC_PACKET_APIRETURN, 1, &sendbuf);
+ RPC_LOG_STATE("sent error result to pending client %05x", client);
+ RpcFreeAPIArgsString(args_string);
+ }
+ } while(api_num > 0);
+}
+
+/*
+ * Notify unfinished request of deadlock when deadlock of the server is detected.
+ */
+ static void
+RpcSendDeadlockToPendingRequest(RpcThreadInfo *th, RpcIdInfo *idinfo) {
+ UINT16 api_num;
+ RPC_ID client;
+ char *args_string;
+ unsigned int args_size;
+ rpc_send_buf sendbuf;
+ char retcode[10];
+
+ do {
+ api_num = RpcGetAPIRequest(idinfo, &client,
+ &args_string, &args_size);
+ if (api_num > 0) { /* API calls are queued */
+
+ sprintf(retcode, "%08x ", RPC_ERR_Server_DeadLock);
+ sendbuf.buf = retcode;
+ sendbuf.bytes = sizeof(retcode) - 1;
+ RpcSendUdp2(idinfo, client, RPC_SEND_TO_CLIENT,
+ RPC_PACKET_APIRETURN, 1, &sendbuf);
+ RPC_LOG_STATE("sent deadlock result to pending client %05x", client);
+ RpcFreeAPIArgsString(args_string);
+ }
+ } while(api_num > 0);
+
+ if (RPC_NO_PORT != RPC_apicall_in_process_client(idinfo)) {
+ sprintf(retcode, "%08x ", RPC_ERR_Server_DeadLock);
+ sendbuf.buf = retcode;
+ sendbuf.bytes = sizeof(retcode) - 1;
+ RpcSendUdp2(idinfo, RPC_apicall_in_process_client(idinfo), RPC_SEND_TO_CLIENT,
+ RPC_PACKET_APIRETURN, 1, &sendbuf);
+ RPC_LOG_STATE("sent deadlock result to pending client %05x", RPC_apicall_in_process_client(idinfo));
+ RPC_apicall_in_process_client(idinfo) = RPC_NO_PORT;
+ }
+}
+
+/** Delete RPC_ID Info by RPC_end()
+ *
+ * - Main: Notify sub of deletion of RPC_ID info.
+ * - Sub: Delete a pointer from thread info (RpcThreadInfo) and notify main of that.
+ * - Main waits for this procedure to finish.
+ * Use id_info->thread_info to determine completion (completed if NULL).
+ * Then, release the memory related to RPC_ID info and close the socket.
+ */
+RUNS_IN_CALLERS_THREAD
+ void
+RpcDestroyIdInfo(RpcThreadInfo *th, RpcIdInfo *id_info) {
+ rpc_assert(id_info->count == 0); // LCOV_EXCL_BR_LINE 6: double check
+ if (id_info->apicall) {
+ if (g_rpc_thread_alive != 0) {
+ NotifyRemoveServer(th);
+ /* Wait for a sub-thread to recognize IDinfo deletion */
+ // LCOV_EXCL_BR_LINE 15: macro define in rpc_thread.c
+ WAIT_FOR_SUB_THREAD((th->srvr_id->thread_info != NULL),
+ RPC_SUB_THREAD_WAIT_SEC);
+ // LCOV_EXCL_BR_STOP
+ rpc_assert(th->srvr_id->thread_info == NULL); /* not recognized yet */ // LCOV_EXCL_BR_LINE 6: double check
+ }
+
+ if (id_info->apicall->pipe_sub_main[PIPE_READ] >= 0) {
+ close(id_info->apicall->pipe_sub_main[PIPE_READ]);
+ }
+ if (id_info->apicall->pipe_sub_main[PIPE_WRITE] >= 0) {
+ close(id_info->apicall->pipe_sub_main[PIPE_WRITE]);
+ }
+ if (id_info->secure_sock >= 0) {
+ close(id_info->secure_sock);
+ }
+ rpc_free(id_info->apicall);
+ th->srvr_id = NULL;
+ } else {
+ th->clnt_id = NULL;
+ }
+ rpc_free(id_info);
+}
+
+RUNS_IN_CALLERS_THREAD
+ void
+RpcDestroyThreadInfo(void) {
+ unsigned int i;
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ if (th == NULL) {
+ return;
+ }
+
+ RPC_THREAD_MUTEX_LOCK(th);
+ if (th->thread == RPC_NO_THREAD) { // LCOV_EXCL_BR_LINE 6: double check
+ RPC_THREAD_MUTEX_UNLOCK(th); // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return;
+ } // LCOV_EXCL_STOP
+ th->thread = RPC_NO_THREAD;
+ RPC_THREAD_MUTEX_UNLOCK(th);
+
+ PROCESS_MUTEX_LOCK;
+ /*
+ * Remove the pointer from the global variable.
+ * Subsequent calls to RpcMyThreadInfo() return NULL
+ */
+ for(i = 0; i < RPC_MAX_THREADS_IN_PROCESS ; i++) {
+ if (th == Thread_info[i]) {
+ Thread_info[i] = NULL;
+ Num_thread_info--;
+ break;
+ }
+ }
+ PROCESS_MUTEX_UNLOCK;
+ BUG_ASSERT(i < RPC_MAX_THREADS_IN_PROCESS, "No info in Thread_info[]"); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_internal.h
+
+ if (Num_thread_info == 0 && g_rpc_thread_alive != 0) {
+ KillRpcThread();
+ char name[32];
+ prctl(PR_GET_NAME, name);
+ RPC_LOG_DEBUG("[%s]waiting for sub thread to join...", name);
+ pthread_join(g_rpc_thread, NULL);
+ RPC_LOG_DEBUG("[%s]sub thread joined.", name);
+ g_rpc_thread = RPC_NO_THREAD; /* bug fix */
+ rpc_assert(g_rpc_thread_alive == 0); // LCOV_EXCL_BR_LINE 6: double check
+ close(g_rpc_pipe_main_sub[PIPE_READ]);
+ close(g_rpc_pipe_main_sub[PIPE_WRITE]);
+ }
+
+ if (th->srvr_id != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ RpcDestroyIdInfo(th, th->srvr_id); // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ th->srvr_id = NULL;
+ } // LCOV_EXCL_STOP
+ if (th->clnt_id != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ RpcDestroyIdInfo(th, th->clnt_id); // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ th->clnt_id = NULL;
+ } // LCOV_EXCL_STOP
+
+ pthread_mutex_destroy(&(th->th_mtx));
+ rpc_free(th);
+}
+
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+/**
+ * Sub-function of RPC_end_all()
+ *
+ * Assuming releasing memory and closing the socket are processing at immediately after the end of the process,
+ * Suppress socket file leaks by only deleting socket files because to avoid deadlocks and shorten the time
+ * by exclusive processing.
+ */
+ void
+RpcUnlinkSocketFiles(void) {
+ int i;
+ char sock_name[16];
+
+ for(i = 0; i < RPC_MAX_THREADS_IN_PROCESS ; i++) {
+ RpcThreadInfo *th = Thread_info[i];
+ if (th != NULL) {
+ if (th->srvr_id != NULL) {
+ rpc_set_socket_name(sock_name, RPC_port(th->srvr_id));
+ RPC_LOG_STATE("unlink srvr %s", sock_name);
+ unlink(sock_name);
+ }
+ if (th->clnt_id != NULL) {
+ rpc_set_socket_name(sock_name, RPC_port(th->clnt_id));
+ RPC_LOG_STATE("unlink clnt %s", sock_name);
+ unlink(sock_name);
+ }
+ }
+ }
+}
+#endif /* !AUTOBIND */
+
+/*
+ * Deadlock detection check for servers in the thread
+ */
+ static void
+RpcDeadlockCheck(RpcThreadInfo** thread_info, unsigned int num_thread_info) {
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+
+ unsigned int i = 0;
+ for(i = 0 ; i < num_thread_info ; i++) {
+ RpcThreadInfo *th = thread_info[i];
+ RpcIdInfo *idinfo = th->srvr_id;
+ CL_MonitorEntry_t entry;
+
+ if (0 == CL_MonitorGetEntry(CL_MONITOR_TYPE_RPC, RPC_port(idinfo), &entry)) {
+ if (entry.state == CL_MONITOR_STATE_RUN && entry.timeout <= ts.tv_sec) {
+ RPC_LOG_ERR("Time Out : RPC_ID = %#x API_NUM = %#x", entry.id, entry.user_data);
+ fprintf(stderr, "Time Out : RPC_ID = %#x API_NUM = %#x\n", entry.id, entry.user_data);
+ RpcSendDeadlockToPendingRequest(th, idinfo);
+ }
+ }
+ }
+}
+/** Main functions of the sub-threads (READING THREAD)
+*/
+RUNS_IN_READING_THREAD
+ static void *
+RpcThreadMain(void *ptr __attribute__((unused))) {
+ struct pollfd wait_files[RPC_MAX_FD_IN_PROCESS];
+ RpcThreadInfo *thread_info[RPC_MAX_THREADS_IN_PROCESS];
+ unsigned int num_thread_info = 0;
+
+ unsigned int poll_num;
+ int need_reset_sockfd = 1;
+ int normal_exit = 0;
+ RPC_Result result;
+ unsigned int i, j;
+
+ /* Monitoring for clients process with inotify() *//* Monitoring target filename */
+ const int inotify_fd = inotify_init1(IN_CLOEXEC); /* fd for process monitoring with inotify() */
+
+ UINT8 readbuf[RPC_UDP_PACKET_SIZE];
+ memset(readbuf, 0, sizeof(UINT8) * RPC_UDP_PACKET_SIZE);
+
+ g_rpc_thread_alive = 1;
+
+ CL_MonitorInit(CL_MONITOR_INIT_USER); /* Using the API for Error Monitoring */
+
+ // Name the thread created in the RPClib (append "_R")
+#define RPC_APPEND_NAME "_R"
+#ifndef PRF_SIZE_PROCESSNAME
+#define PRF_SIZE_PROCESSNAME 8 /* Limit name length for Profiler Analysis Tools */
+#endif
+ {
+ char *p, name[32];
+ prctl(PR_GET_NAME, name);
+ name[PRF_SIZE_PROCESSNAME] = '\0';
+ if (strlen(name) + strlen(RPC_APPEND_NAME) > PRF_SIZE_PROCESSNAME) {
+ p = name + PRF_SIZE_PROCESSNAME - strlen(RPC_APPEND_NAME);
+ } else {
+ p = name + strlen(name);
+ }
+ strcpy(p, RPC_APPEND_NAME);
+ prctl(PR_SET_NAME, name);
+ }
+
+ /* Set the communication pipe with the main thread to poll fd */
+ poll_num = 1;
+ wait_files[0].fd = g_rpc_pipe_main_sub[PIPE_READ];
+ wait_files[0].events = POLLIN;
+
+restart:
+ for( ; ; ) {
+ if (need_reset_sockfd) {
+ /* Set the UDP socket of each RPC_ID to poll fd */
+ PROCESS_MUTEX_LOCK;
+ for(i = 0, j = 0 ; i < RPC_MAX_THREADS_IN_PROCESS ; i++) {
+ if (Thread_info[i] != NULL) {
+ if (Thread_info[i]->magic != RPC_MAGIC_ID) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("Someone(me?) destroyed my area!"); // LCOV_EXCL_LINE 6: double check
+ }
+ if (Thread_info[i]->srvr_id != NULL
+ && Thread_info[i]->srvr_id->thread_info != NULL) {
+ thread_info[j] = Thread_info[i];
+ j++;
+ }
+ }
+ }
+ PROCESS_MUTEX_UNLOCK;
+ num_thread_info = j;
+
+ poll_num = 1;
+ /* Register fd for monitoring with inotify() in poll() */
+ wait_files[1].fd = inotify_fd;
+ wait_files[1].events = POLLIN;
+
+ poll_num = 2;
+ for(i = 0 ; i < num_thread_info ; i++) {
+ /* Datagram socket for API request */
+ wait_files[poll_num].fd = thread_info[i]->srvr_id->sock; /* pgr0000 */
+ wait_files[poll_num].events = POLLIN;
+ poll_num++;
+ // LCOV_EXCL_BR_START 5: fail safe for libc listen
+ /* Authentication stream socket */
+ if (0 != listen(thread_info[i]->srvr_id->secure_sock, 10)) { /* Number of queues */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_PERROR("listen(unix)"); // LCOV_EXCL_LINE 5: fail safe for libc listen
+ }
+ // LCOV_EXCL_BR_STOP
+ wait_files[poll_num].fd = thread_info[i]->srvr_id->secure_sock;
+ wait_files[poll_num].events = POLLIN;
+ poll_num++;
+ }
+ need_reset_sockfd = 0;
+ }
+
+ int pollret;
+ pollret = poll(wait_files, poll_num, TIMEOUT_FOR_DEADLOCK_CHECK);
+
+ int save_errno = errno;
+
+ RpcDeadlockCheck(thread_info, num_thread_info);
+ if (pollret < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc poll
+ if (save_errno == EINTR) { // LCOV_EXCL_START 5: fail safe for libc poll
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue;
+ } else {
+ rpc_assert(pollret > 0);
+ goto exit_read_thread;
+ } // LCOV_EXCL_STOP
+ }
+
+ /* Commands from the main thread (via pipe) */
+ if ((wait_files[0].revents & POLLIN) == POLLIN) {
+ char buf[RPC_MAIN_SUB_COMMAND_SIZE];
+ long ret, arg;
+ int cmd;
+ RpcThreadInfo *th;
+ ret = read(wait_files[0].fd, buf, sizeof(buf));
+ if (ret == sizeof(buf)) {
+ sscanf(buf, RPC_MAIN_SUB_COMMANDs, &cmd, &arg);
+ switch(cmd) {
+ case RPC_COMMAND_ADD_SERVER:
+ th = (RpcThreadInfo *)arg;
+ th->srvr_id->thread_info = th; /* Indicate the completion of the processing */
+ NotifyMainThread(th);
+ need_reset_sockfd = 1;
+ goto restart;
+ break;
+
+ case RPC_COMMAND_REMOVE_SERVER:
+ th = (RpcThreadInfo *)arg;
+ RpcSendErrorToPendingRequest(th, th->srvr_id);
+
+ RpcAllDeleteSockName(th->srvr_id, inotify_fd); /* delete client_sock_name_list */
+ rpc_free((th->srvr_id)->apicall->uid_list); /* delete uid_list */
+ rpc_free((th->srvr_id)->apicall->gid_list); /* delete gid_list */
+
+ th->srvr_id->thread_info = NULL;/* Indicate the completion of the processing */
+ NotifyMainThread(th);
+ need_reset_sockfd = 1;
+ goto restart;
+ break;
+
+ case RPC_COMMAND_EXIT:
+ /************ Termination request from the parent thread *************/
+ RPC_LOG_DEBUG("Received exit command from main thread.");
+ normal_exit = 1;
+ goto exit_read_thread;
+ break;
+ } /* switch */
+ } /* if (ret == sizeof(buf)) */
+ } /* Complete the processing of commands from the main thread */
+
+ /* Client Monitoring Events with inotify() */
+ if ((wait_files[1].revents & POLLIN) == POLLIN) {
+ UINT32 read_len = 0;
+ int length = 0;
+ char *buffer;
+ buffer = (char *)rpc_malloc(BUF_LEN);
+ if (NULL == buffer) {// LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("rpc_malloc() ERROR.");
+ goto exit_read_thread;
+ } // LCOV_EXCL_STOP
+
+ if( (length = (int)read( inotify_fd, buffer, BUF_LEN ) ) < 0 ) { // LCOV_EXCL_START 5: fail safe for libc read
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_PERROR("inotify read() ERROR.");
+ rpc_free(buffer);
+ buffer = NULL;
+ goto exit_read_thread;
+ } // LCOV_EXCL_STOP
+ while ( read_len < length ) {
+ struct inotify_event *event = ( struct inotify_event * )&buffer[read_len];
+
+ if ( event->mask & IN_DELETE_SELF ) {/* Terminating a Client Process */
+ int i; /* Looping variable */
+
+ /* Delete the source socket name from all RpcThreadInfo in the received thread */
+ for(i = 0 ; i < num_thread_info ; i++) {
+ RpcThreadInfo *th = thread_info[i];
+ RpcDeleteSockName(th->srvr_id, event->wd);
+ }
+ }
+ read_len += (UINT32)(EVENT_SIZE + event->len); /* Size of the inotify_event structure */
+ }
+ rpc_free(buffer);
+ goto restart;
+ } /* Client Monitoring Events Completed with inotify() */
+
+ for(i = 2 ; i < poll_num ; i++) {
+ /* Event to the API request datagram socket */
+ if ((i % 2 == 0) && ((wait_files[i].revents & POLLIN) == POLLIN)) {
+ unsigned int thread_info_num = ((i/2) - 1); /* Compute thread_info[thread_info_num] with events */
+ RpcThreadInfo *th = thread_info[thread_info_num]; /* pgr0000 */
+ RpcIdInfo *idinfo = th->srvr_id;
+ for(;;) {
+ /* RPClib packet received */
+ int readret = RpcReadUdpPacket(idinfo, readbuf);
+ if (readret < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc recvfrom
+ rpc_assert(readret >= 0); // LCOV_EXCL_START 5: fail safe for libc recvfrom
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit_read_thread;
+ // LCOV_EXCL_STOP
+ } else if (readret == 0) {
+ break;
+ }
+ /* successfully read udp packets */
+ /* parse the packet and queue events */
+ RPC_ID sender = RPC_NO_ID;
+ UINT32 seq_num = 0;
+ UINT32 size = 0;
+ RPC_packet_type command = RPC_PACKET_NONE;
+ if (RpcParsePacketHeader((const char *)readbuf, &command, &sender, &seq_num, &size) != RPC_OK) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ goto exit_read_thread;
+ }
+
+ long int api_num;
+ char *buff;
+
+ switch(command) {
+ case RPC_PACKET_APICALL:
+ if (RPC_DEBUG != NULL) { // LCOV_EXCL_BR_LINE 7: debug
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("RPC[%s]: received APIcall\n", RPC_DEBUG); // LCOV_EXCL_LINE 7: debug
+ }
+ // Return response without queuing for ALIVE query
+ api_num = strtol((const char *)(readbuf + RPC_PACKET_HEADER_LEN), NULL, 10);
+ if (api_num == RPC_API_NUM_RPC_ALIVE) {
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "OK", sizeof("OK"));
+ break;
+ }
+
+ /* Return BUSY if secure and unregistered in UID-list */
+ if ((NEED_SECURE_CHECK == RPC_secure_check(idinfo))
+ && (NO_REGISTERED == RPC_regist_credential_info(idinfo))) {
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "BUSY", sizeof("BUSY"));
+ RPC_LOG_ERR("Need UID list register.");
+ break;
+ }
+
+ result = RpcQueueAPIRequestBefore(idinfo, size, (char**)&buff);
+ if (result == RPC_OK) {
+ /* Check whether the source has been authenticated */
+ if(RPC_OK == RpcCheckSockName(idinfo, sender)) { /* Registerd the name of the source socket */
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "OK", sizeof("OK"));
+ RpcQueueAPIRequestAfter(idinfo, sender,
+ (const char *)(readbuf + RPC_PACKET_HEADER_LEN),
+ size, buff);
+ } else { /* Not registered (in other words, first communication with the source client) */
+ /* Authentication request to the client */
+ RPC_THREAD_MUTEX_UNLOCK(idinfo->thread_info);
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "CERT", sizeof("CERT"));
+ rpc_free(buff);
+ break;
+ }
+ } else if (result == RPC_ERR_Busy) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "BUSY", sizeof("BUSY"));
+ } else { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "ERR", sizeof("ERR"));
+ RPC_LOG_ERR("queueing APIcall failed.(%d)", result);
+ goto exit_read_thread;
+ } // LCOV_EXCL_STOP
+ NotifyMainThread(th);
+ if (RPC_DEBUG != NULL) { // LCOV_EXCL_BR_LINE 7: debug
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("RPC[%s]: notified APIcall\n", RPC_DEBUG); // LCOV_EXCL_LINE 7: debug
+ }
+ break;
+
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BUG_ASSERT(0, "Unknown UDP packet type"); // LCOV_EXCL_LINE 15: marco defined in rpc_internal.h
+ goto exit_read_thread;
+ break;
+ } /* switch(command) */
+ }/* for(;;) */
+
+ /* Event to the stream socket for authentication */
+ } else if ((i % 2 != 0) && ((wait_files[i].revents & POLLIN) == POLLIN)) {
+ unsigned int thread_info_num = ((i-1)/2 - 1); /* Compute thread_info[thread_info_num] with events */
+ struct sockaddr_un client_sa_un;
+ socklen_t client_len = sizeof(struct sockaddr_un);
+ struct ucred cr; /* Structure of client credit info */
+ RpcCertifyResult send_ret; /* Authentication result to pass to the client */
+ RpcThreadInfo *th = thread_info[thread_info_num];
+ RpcIdInfo *idinfo = th->srvr_id;
+
+ send_ret.certify_res = CERTIFY_NG;
+ send_ret.srvr_pid = 0;
+
+ /* Obtain client credit info from a connected socket */
+ int accept_sock = accept4(wait_files[i].fd, (struct sockaddr *)&client_sa_un, &client_len, SOCK_CLOEXEC);
+ int ret = getsockopt(accept_sock, SOL_SOCKET, SO_PEERCRED, &cr, &client_len);
+ if (ret == 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc getsockopt
+ client_sa_un = (struct sockaddr_un )client_sa_un;
+ /* Check if UID of client is allowed to communicate */
+ if (RPC_OK == RpcCheckClientCredential(idinfo, &cr)) {
+
+ /* Obtain the socket name associated with the RPC_ID of the client from the socket info */
+ char client_sock_name[SOCK_NAME_LEN];
+ RpcGetClientNameFromSock(client_sa_un.sun_path, client_sock_name);
+
+ /* Monitoring client processes with inotify */
+ char intfy_fname[32];
+ snprintf(intfy_fname, sizeof(intfy_fname), CL_INTFY_FILENAME_FORMAT, cr.pid);
+ int wd = inotify_add_watch(inotify_fd, intfy_fname, IN_DELETE_SELF);
+ if (0 > wd) { // LCOV_EXCL_BR_LINE 5: fail safe for libc inotify_add_watch
+ RPC_LOG_STATE("intfy_fname is Not Found [%s].", intfy_fname);
+ }
+
+ /* Register the source socket name in the management table */
+ RpcRegistSockName(idinfo, client_sock_name, &cr, wd);
+
+ /* Send server credit info to the client */
+ send_ret.certify_res = CERTIFY_OK;
+ send_ret.srvr_pid = getpid();
+ }
+ }
+
+ /* Send authentication result to client */
+ send(accept_sock, (char*)&send_ret, sizeof(RpcCertifyResult), 0);
+ close(accept_sock);
+
+ goto restart;
+
+ } else if ((wait_files[i].revents & ~POLLIN) != 0) { // LCOV_EXCL_START 5: fail safe for libc poll
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // POLLERR, etc. on UDP port
+ RPC_LOG_STATE("poll error %x", wait_files[i].revents);
+
+ if ((wait_files[i].revents & POLLNVAL) == POLLNVAL) {
+ need_reset_sockfd = 1;
+ goto restart;
+ }
+ } /* if ((wait_files[i].revents & POLLIN) == POLLIN) */ // LCOV_EXCL_STOP
+
+ } /* processing UDP packets finished */
+
+ } /* end of forever loop */
+
+exit_read_thread:
+
+ g_rpc_thread_alive = 0;
+ for(i = 0 ; i < num_thread_info ; i++) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NotifyMainThread(thread_info[i]); /* pgr0000 */ // LCOV_EXCL_LINE 6: double check
+ }
+
+ close(inotify_fd);
+
+ if (normal_exit == 0) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_CRIT("sub thread ABNORMALLY exited."); // LCOV_EXCL_LINE 6: double check
+ } else {
+ RPC_LOG_DEBUG("sub thread normally exited.");
+ }
+ return NULL;
+}
+
+/* Notification of sub-thread -> main-thread (via pipe) */
+RUNS_IN_READING_THREAD
+ static void
+NotifyMainThread(RpcThreadInfo *th) {
+ rpc_assert(th->srvr_id->apicall != NULL); // LCOV_EXCL_BR_LINE 6: double check
+ char c = 0;
+ write(th->srvr_id->apicall->pipe_sub_main[PIPE_WRITE], &c, sizeof(c));
+}
+
+/* Notification of main-thread -> sub-thread(via pipe) */
+/* Termination instruction */
+RUNS_IN_CALLERS_THREAD
+ static void
+KillRpcThread(void) {
+ char buf[RPC_MAIN_SUB_COMMAND_SIZE];
+ sprintf(buf, RPC_MAIN_SUB_COMMAND, RPC_COMMAND_EXIT, (unsigned long)0);
+ write(g_rpc_pipe_main_sub[PIPE_WRITE], buf, sizeof(buf));
+}
+
+/* AddRPC_ID */
+RUNS_IN_CALLERS_THREAD
+ static void
+NotifyAddServer(RpcThreadInfo *th) {
+ char buf[RPC_MAIN_SUB_COMMAND_SIZE];
+ sprintf(buf, RPC_MAIN_SUB_COMMAND, RPC_COMMAND_ADD_SERVER,
+ (unsigned long)th);
+ write(g_rpc_pipe_main_sub[PIPE_WRITE], buf, sizeof(buf));
+}
+
+/* Remove RPC_ID */
+RUNS_IN_CALLERS_THREAD
+ static void
+NotifyRemoveServer(RpcThreadInfo *th) {
+ char buf[RPC_MAIN_SUB_COMMAND_SIZE];
+ sprintf(buf, RPC_MAIN_SUB_COMMAND, RPC_COMMAND_REMOVE_SERVER,
+ (unsigned long)th);
+ write(g_rpc_pipe_main_sub[PIPE_WRITE], buf, sizeof(buf));
+}
+
+/* Register the socket name of the source client in the management table. */
+ static RPC_Result
+RpcRegistSockName(RpcIdInfo *idinfo, char *client_sock_name, const struct ucred *cr, int wd) {
+ if ((NULL == idinfo) || (NULL == client_sock_name) || (NULL == cr) || (0 > cr->pid)) { // LCOV_EXCL_BR_LINE 6: void *RpcThreadMain(void *ptr)
+ RPC_LOG_ERR("RpcRegistSockName() : Invalid Param."); // LCOV_EXCL_START 6: void *RpcThreadMain(void *ptr)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RpcClientSockNameInfo *sock_name_buf, *current;
+
+ sock_name_buf = rpc_malloc(sizeof(RpcClientSockNameInfo));
+ // LCOV_EXCL_BR_START 5: fail safe for libc malloc
+ if( sock_name_buf == NULL ){
+ return RPC_ERR_Fatal;
+ }
+ // LCOV_EXCL_BR_STOP
+ strcpy(sock_name_buf->client_sock_name, client_sock_name); /* Socket name */
+ sock_name_buf->pid = cr->pid; /* PID */
+ sock_name_buf->uid = cr->uid; /* UID */
+ sock_name_buf->gid = cr->gid; /* GID */
+ sock_name_buf->wd = wd; /* Non-negative inotify monitored descriptors */
+ sock_name_buf->next = NULL; /* Pointer to next node (NULL since last node) */
+
+ if (0 == RPC_client_sock_name_num(idinfo)) {
+ RPC_sock_info_head(idinfo) = sock_name_buf;
+ } else {
+ for (current = RPC_sock_info_head(idinfo); current->next != NULL; current = current->next)
+ ;
+ current->next = sock_name_buf;
+ }
+ RPC_client_sock_name_num_inc(idinfo);
+ return RPC_OK;
+}
+
+/* Check if the socket name of the source client is registered in the management table */
+ static RPC_Result
+RpcCheckSockName(RpcIdInfo *idinfo, RPC_ID client_id) {
+ if ((NULL == idinfo) || (client_id == RPC_NO_ID)) { // LCOV_EXCL_BR_LINE 6: void *RpcThreadMain(void *ptr)
+ RPC_LOG_ERR("RpcCheckSockName() : Invalid Param."); // LCOV_EXCL_START 6: void *RpcThreadMain(void *ptr)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ char buf[7], client_path_name[SOCK_NAME_LEN]; /* Client socket name */
+
+ /* Converting client_id to the socket name associated with RPC_ID */
+ RpcSetClientName(buf, client_id);
+ memcpy(client_path_name, buf + 1, 5);
+ client_path_name[5] = '\0';
+ RpcClientSockNameInfo *current = RPC_sock_info_head(idinfo);
+
+ /* Search source socket name in management table */
+ while (NULL != current) {
+ if (0 == strcmp(current->client_sock_name, client_path_name)) { /* Registered socket name (authenticated) */
+ return RPC_OK;
+ }
+ current = current->next;
+ }
+ return RPC_ERR_Fatal; /* Not registerd socket name (unauthenticated) */
+}
+
+/* Remove source client socket name from management table */
+ static RPC_Result
+RpcDeleteSockName(RpcIdInfo *idinfo, int wd) {
+ if ((NULL == idinfo) || (0 > wd)) {
+ RPC_LOG_ERR("RpcDeleteSockName() : Invalid Param.");
+ return RPC_ERR_Fatal;
+ }
+
+ RpcClientSockNameInfo *current, *previous;
+ current = RPC_sock_info_head(idinfo);
+ previous = current;
+ int cnt = 0;
+
+ /* Remove Source Socket Name in Management Table */
+ while (NULL != current) {
+ if (wd == current->wd) { /* Delete element */
+ if (0 == cnt) { /* Delete the start element in the management table */
+ RPC_sock_info_head(idinfo) = RPC_sock_info_head(idinfo)->next;
+ rpc_free(current);
+ current = RPC_sock_info_head(idinfo);
+ cnt = -1;
+ } else { /* Delete other than the start element in the management table */
+ previous->next = current->next;
+ rpc_free(current);
+ current = previous->next;
+ }
+ RPC_client_sock_name_num_dec(idinfo);
+ } else { /* Refer to the next node without deleting */
+ previous = current;
+ current = current->next;
+ }
+ cnt ++;
+ }
+
+ return RPC_OK;
+}
+
+/* Remove all source client socket names in the management table */
+ static RPC_Result
+RpcAllDeleteSockName(RpcIdInfo *idinfo, int inotify_fd) {
+ if (NULL == idinfo) { // LCOV_EXCL_BR_LINE 6: double check in void RpcDestroyThreadInfo(void)
+ RPC_LOG_ERR("RpcAllDeleteSockName() : Invalid Param."); // LCOV_EXCL_START 6: void RpcDestroyThreadInfo(void)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RpcClientSockNameInfo *current = RPC_sock_info_head(idinfo);
+
+ while (NULL != current) {
+ RpcClientSockNameInfo *previous = current;
+ current = current->next;
+
+ if (0 <= previous->wd) {
+ inotify_rm_watch(inotify_fd, previous->wd);
+ }
+
+ rpc_free(previous);
+ previous = NULL;
+ RPC_client_sock_name_num_dec(idinfo);
+ }
+
+ return RPC_OK;
+}
+
+
+/* Check if client is allowed to communicate */
+ static RPC_Result
+RpcCheckClientCredential(RpcIdInfo *idinfo, const struct ucred *cr) {
+ if ((NULL == idinfo) || (NULL == cr)) { // LCOV_EXCL_BR_LINE 6: double check in void *RpcThreadMain(void *ptr)
+ RPC_LOG_ERR("RpcCheckClientCredential() : Invalid Param."); // LCOV_EXCL_START 6: void *RpcThreadMain(void *ptr)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ /* Retern RPC_OK if authentication is not required */
+ if (NO_SECURE_CHECK == RPC_secure_check(idinfo)) {
+ return RPC_OK;
+ }
+
+ INT32 i = 0; /* Loop counter */
+
+ /* Search client UID in registered UID list */
+ for(i = 0; i < RPC_uid_num(idinfo); i++) {
+ if(RPC_uid_list(idinfo, i) == cr->uid) { /* Found UID in registered UID list */
+ return RPC_OK;
+ }
+ }
+
+ /* Search client GID in registered GID list */
+ for(i = 0; i < RPC_gid_num(idinfo); i++) {
+ if(RPC_gid_list(idinfo, i) == cr->gid) { /* Found GID in registered GID list. */
+ return RPC_OK;
+ }
+ }
+
+ RPC_LOG_ERR("[Client isn't authenticated!!!!]");
+ return RPC_ERR_Fatal; /* Not found UID in registered UID list */
+}
diff --git a/otherservice/rpc_library/library/src/rpc_udp.c b/otherservice/rpc_library/library/src/rpc_udp.c
new file mode 100755
index 0000000..0d4d59f
--- /dev/null
+++ b/otherservice/rpc_library/library/src/rpc_udp.c
@@ -0,0 +1,473 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_udp.c
+ * @brief RPC Library Internal Implementation--UDP Communication
+ *
+ */
+/** @addtogroup RPClib_in */
+/** @{ */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/poll.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h> // for usleep
+
+#include <fcntl.h>
+#include <sys/un.h>
+
+#include <sys/inotify.h>
+
+#include <other_service/rpc.h>
+#include "rpc_internal.h"
+
+static /*inline*/ UINT32
+RpcGetSequenceNumber(RpcThreadInfo *th) {
+ RPC_THREAD_MUTEX_LOCK(th);
+ UINT32 ret = th->sequence_number;
+ (th->sequence_number)++;
+ if (th->sequence_number == RPC_SEQ_NUM_INVALID) { // LCOV_EXCL_BR_LINE 200: overflow check, but test time is too long
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ th->sequence_number = RPC_SEQ_NUM_START; // LCOV_EXCL_LINE 200: overflow check, but test time is too long
+ }
+ RPC_THREAD_MUTEX_UNLOCK(th);
+ return ret;
+}
+
+/**
+ */
+int
+RpcReadUdpPacket(const RpcIdInfo *id, UINT8 *buf) {
+ struct sockaddr_un sa;
+ socklen_t sa_len = sizeof(sa);
+ // sa passed to recvfrom does not require initialization
+
+ for(;;) {
+
+ ssize_t ret = recvfrom(RPC_my_sock(id), buf, RPC_UDP_PACKET_SIZE,
+ 0, (struct sockaddr *)&sa, &sa_len);
+
+ if (ret < 0) {
+ if (errno == EAGAIN) { // LCOV_EXCL_BR_LINE 5: fail safe for libc recvfrom
+ //RPC_LOG_PERROR("recvfrom port %d", RPC_port(id));
+ return 0;
+ } else if (errno == EINTR) { // LCOV_EXCL_START 5: fail safe for libc recvfrom
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue;
+ } else {
+ RPC_LOG_PERROR("recvfrom port %d", RPC_port(id));
+ return -1;
+ } // LCOV_EXCL_STOP
+ } else if (ret == 0) {
+ RPC_LOG_STATE("*** recvfrom ret 0");
+ return 0;
+ } else {
+ return (int)ret;
+ }
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ } // LCOV_EXCL_LINE 10: final line
+}
+
+/** Number of sendto retries */
+#define RPC_SENDTO_RETRY 5
+
+RUNS_IN_CALLERS_THREAD
+RUNS_IN_READING_THREAD
+/**
+ */
+static int
+RpcSendUdpPacket(RpcIdInfo *id,
+ struct sockaddr_un *to, int do_retry,
+ void *mesg, unsigned int bytes) {
+ int nretry = 0;
+ ssize_t ret;
+ int myerr;
+ retry:
+ ret = sendto(RPC_my_sock(id), mesg, bytes, 0,
+ (struct sockaddr *)to, RPC_SOCKET_ADDR_LEN);
+ myerr = errno;
+
+ if (ret < 0) {
+ RPC_LOG_STATE("*** sendto %s ***", to->sun_path + 1);
+ if (myerr == EAGAIN || (do_retry && myerr==ECONNREFUSED && ++nretry <= RPC_SENDTO_RETRY)) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ usleep(100000);
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ RPC_LOG_DEBUG("*** sendto %s ***", to->sun_path + 1);
+#else /* AUTOBIND */
+ RPC_LOG_DEBUG("**************** sendto retry *********************");
+#endif /* !AUTOBIND */
+ goto retry;
+ }
+ errno = myerr;
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ if (do_retry) {
+ RPC_LOG_PERROR("sendto %s", to->sun_path + 1);
+ }
+#endif /* !AUTOBIND */
+ return -1;
+ } else if ((unsigned int)ret != bytes) {
+ RPC_LOG_STATE("can't send all");
+ return -1;
+ }
+ return 0;
+}
+
+RUNS_IN_CALLERS_THREAD
+RUNS_IN_READING_THREAD
+/**
+ */
+int
+RpcSendUdp(RpcIdInfo *id, const RPC_ID receiver, int direction, RPC_packet_type type, const void *mesg, unsigned int bytes) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rpc_send_buf sendbuf;
+ sendbuf.buf = mesg;
+ sendbuf.bytes = bytes;
+
+ return RpcSendUdp2(id, receiver, direction, type, 1, &sendbuf);
+} // LCOV_EXCL_STOP
+RUNS_IN_CALLERS_THREAD
+RUNS_IN_READING_THREAD
+/** UDP packet transmission process
+ *
+ * UDP packet format
+ * @verbatim
++--------------+--------------+
+|*1|*2|*3|*4|*5| PAYLOAD |
++--------------+--------------+
+@endverbatim
+ *
+ * *1 to *5 indicate the header. @see RPC_PACKET_HEADER
+ *
+ * - *1: [@%-2d] Type of packet
+ * - @see RPC_packet_type
+ * - *2: [@%-5x] Source RPC_ID
+ * - *3: [@%-8x] Sequence number
+ * - Set the value incremented from 1. This value must be unique for each source thread.
+ * - In the case of response packets, this field contains the sequence number of the packet from which the response was received.
+ * - *4: [@%-4u] Size of send data
+ * - In the case of sending data consists of single packet in PAYLOAD, this field contains number of the packet.
+ * - For a multipacket, the first packet contains the sum of the PAYLOAD of all packets,
+ * the last packet contains the PAYLOAD bytes of the packet.
+ * All other intermediate packets are filled with 0.(With up to two packets in the current constraint,
+ * there are no intermediate packets.)
+ * - *5: [@%1d] Position of packet
+ * - @see rpc_packet_position
+ */
+int
+RpcSendUdp2(struct RpcIdInfo *id, RPC_ID receiver, int direction,
+ RPC_packet_type type, unsigned int num, rpc_send_buf *sendbuf) {
+ unsigned char buf[RPC_UDP_PACKET_SIZE];
+ UINT32 seq_num = RpcGetSequenceNumber(id->thread_info);
+ unsigned int bytes = 0;
+ rpc_send_buf *sendbufp = sendbuf;
+ int i, do_retry = 1;
+ for(i = 0 ; i < num ; i++) {
+ bytes += sendbufp->bytes;
+ sendbufp++;
+ }
+ rpc_assert(bytes <= RPC_UDP_PAYLOAD); // LCOV_EXCL_BR_LINE 6: double check
+
+ struct sockaddr_un to;
+ memset(&to, 0, sizeof(to));
+ to.sun_family = AF_UNIX;
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ if (direction != RPC_SEND_TO_CLIENT) {
+ RpcSetServerName(to.sun_path, receiver);
+ if (direction == RPC_SEND_TO_SERVER_NO_RETRY) {
+ do_retry = 0;
+ }
+ } else {
+ RpcSetClientName(to.sun_path, receiver);
+ }
+#else /* !AUTOBIND */
+ rpc_set_socket_name(to.sun_path, rpc_get_port(receiver));
+#endif /* !AUTOBIND */
+
+ sprintf((char *)buf, RPC_PACKET_HEADER,
+ (int)type, RPC_my_id(id), seq_num, bytes,
+ RPC_PACKET_POS_ONEANDONLY);
+
+ unsigned char *bufp = buf + RPC_PACKET_HEADER_LEN;
+ for(i = 0 ; i < num ; i++) {
+ memcpy(bufp, sendbuf->buf, sendbuf->bytes);
+ bufp += sendbuf->bytes;
+ sendbuf++;
+ }
+ if (RpcSendUdpPacket(id, &to, do_retry,
+ buf, RPC_PACKET_HEADER_LEN + bytes) < 0) {
+ return -1;
+ }
+ return (int)seq_num;
+}
+
+RUNS_IN_READING_THREAD
+/**
+ */
+RPC_Result
+RpcSendUdpResponse(RpcIdInfo *id, const RPC_ID receiver, int direction,
+ RPC_packet_type type, UINT32 seq_num,
+ char *mesg, UINT32 bytes) {
+ rpc_assert(bytes <= RPC_MAX_RESPONSE_MESSAGE_SIZE); // LCOV_EXCL_BR_LINE 6: double check
+ char buf[RPC_PACKET_HEADER_LEN + RPC_MAX_RESPONSE_MESSAGE_SIZE];
+ sprintf(buf, RPC_PACKET_HEADER,
+ (int)type, RPC_my_id(id), seq_num, bytes,
+ (int)RPC_PACKET_POS_ONEANDONLY);
+ memcpy(buf + RPC_PACKET_HEADER_LEN, mesg, bytes);
+
+ struct sockaddr_un sa;
+ memset(&sa, 0, sizeof(sa));
+ sa.sun_family = AF_UNIX;
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ if (direction != RPC_SEND_TO_CLIENT) {
+ RpcSetServerName(sa.sun_path, receiver);
+ } else {
+ RpcSetClientName(sa.sun_path, receiver);
+ }
+#else /* !AUTOBIND */
+ rpc_set_socket_name(sa.sun_path, rpc_get_port(receiver));
+#endif /* !AUTOBIND */
+ return RpcSendUdpPacket(id, &sa, 0, buf, RPC_PACKET_HEADER_LEN + bytes);
+}
+
+/**
+ */
+RPC_Result
+RpcParsePacketHeader(const char *str, RPC_packet_type *command,
+ RPC_ID_p id, UINT32 *seq_num, UINT32 *size) {
+ // LCOV_EXCL_BR_START 6: double check
+ rpc_assert(str != NULL && command != NULL && id != NULL
+ && seq_num != NULL && size != NULL);
+ // LCOV_EXCL_BR_STOP
+
+ if (sscanf(str, RPC_PACKET_HEADER_scanf, (int *)command, id, seq_num, size) != 4) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ *command = RPC_PACKET_NONE; // LCOV_EXCL_START 5: fail safe for libc sscanf
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BUG_ASSERT(0, "Parsing packet failed");
+ // LCOV_EXCL_STOP
+ return RPC_ERR_Fatal;
+ }
+ return RPC_OK;
+}
+
+#include <sys/time.h>
+
+RPC_Result
+RpcClientWaitResponse(RpcIdInfo *idinfo, UINT32 seq_num,
+ UINT32 timeout_msec, UINT16 *response) {
+ unsigned char readbuf[RPC_UDP_PACKET_SIZE];
+ fd_set fds;
+ int fd = idinfo->sock;
+
+ struct timeval timeout;
+ timeout.tv_sec = (__time_t)(timeout_msec / 1000);
+ timeout.tv_usec = (__suseconds_t)((timeout_msec % 1000) * 1000);
+
+ *response = RPC_RESPONSE_NONE;
+
+ for(;;) {
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ int sret = select(fd + 1, &fds, NULL, NULL, &timeout);
+ if (sret < 0 && errno == EINTR) { /* signal interrupt */ // LCOV_EXCL_START 5: fail safe for libc select
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue;
+ // LCOV_EXCL_STOP
+ } else if (sret == 0) { /* timeout */
+ RPC_LOG_ERR("server response timeout");
+ return RPC_ERR_No_Response;
+ } else if (sret > 0 && FD_ISSET(fd, &fds)) { // LCOV_EXCL_BR_LINE 5: fail safe for libc select
+ RPC_ID sender;
+ UINT32 seq;
+ UINT32 size;
+ RPC_packet_type command;
+ int readret = RpcReadUdpPacket(idinfo, readbuf);
+ if (readret <= 0) { // LCOV_EXCL_START 5: fail safe for libc recvfrom
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* debug code to see socket status */
+ /* why recvfrom() returned 0 ? */
+ struct pollfd pfd;
+ pfd.fd = fd;
+ pfd.events = POLLIN|POLLHUP|POLLERR;
+ sret = poll(&pfd, 1, 0/* timeout 0 */);
+ RPC_LOG_STATE("** poll revents=%x", pfd.revents);
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ if (RpcParsePacketHeader((const char *)readbuf, &command, &sender, &seq, &size) != RPC_OK) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ return RPC_ERR_Fatal;
+ }
+ unsigned char c;
+ if (seq == seq_num) {
+ switch(command) {
+ case RPC_RESPONSE_APICALL:
+ c = readbuf[RPC_PACKET_HEADER_LEN];
+ switch(c) {
+ case 'O':
+ *response = RPC_RESPONSE_API_OK;
+ goto exit_loop_ok;
+ break;
+ case 'B':
+ *response = RPC_RESPONSE_API_BUSY;
+ goto exit_loop_ok;
+ break;
+ case 'E':
+ *response = RPC_RESPONSE_API_ERR;
+ goto exit_loop_ok;
+ break;
+ case 'D':
+ *response = RPC_RESPONSE_API_DEADLOCK;
+ goto exit_loop_ok;
+ break;
+ case 'C':
+ *response = RPC_RESPONSE_API_CERTIFY;
+ goto exit_loop_ok;
+ break;
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BUG_ASSERT(0, "illegal response\n"); // LCOV_EXCL_LINE 15: marco defined in rpc_internal.h
+ return RPC_ERR_Fatal;
+ break;
+ }
+ break;
+
+ default:
+ RPC_LOG_STATE("Unknown packet command=%d", command);
+ return RPC_ERR_Fatal;
+ break;
+ }
+ } else { /* sequence number mismatch == response to other request */
+ RPC_LOG_DEBUG("unwanted response received(delayed response?)");
+ continue;
+ }
+ } else { /* poll error */
+ RPC_LOG_PERROR("select in wait response");
+ return RPC_ERR_Fatal;
+ }
+ }
+ exit_loop_ok:
+ return RPC_OK;
+}
+
+RPC_Result
+RpcClientWaitResult(RpcIdInfo *idinfo, RPC_ID srvr_id) {
+ unsigned char readbuf[RPC_UDP_PACKET_SIZE];
+ fd_set fds;
+ int fd = idinfo->sock;
+ int inotify_fd = RPC_clnt_inotify_fd(idinfo);
+ int maxfd;
+ RPC_Result result = RPC_OK;
+
+ for(;;) {
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ FD_SET(inotify_fd, &fds);
+
+ /* Determine the maximum value of fd to wait */
+ if (fd > inotify_fd) {
+ maxfd = fd;
+ } else {
+ maxfd = inotify_fd;
+ }
+
+ int sret = select(maxfd + 1, &fds, NULL, NULL, NULL);
+ if (sret < 0 && errno == EINTR) { /* signal interrupt */ // LCOV_EXCL_START 5: fail safe for libc select
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue;
+ // LCOV_EXCL_STOP
+ } else if (sret > 0 && FD_ISSET(fd, &fds)) { /* success */ // LCOV_EXCL_BR_LINE 5: fail safe for libc select
+ RPC_ID sender;
+ UINT32 seq;
+ UINT32 size;
+ RPC_packet_type command;
+ int readret = RpcReadUdpPacket(idinfo, readbuf);
+ if (readret <= 0) { // LCOV_EXCL_START 5: fail safe for libc recvfrom
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rpc_assert(readret >= 0);
+ result = RPC_ERR_Fatal;
+ goto exit_loop_ok;
+ } // LCOV_EXCL_STOP
+ if (RpcParsePacketHeader((const char *)readbuf, &command, &sender, &seq, &size) != RPC_OK) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ // LCOV_EXCL_START 5: fail safe for libc sscanf
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ result = RPC_ERR_Fatal;
+ goto exit_loop_ok;
+ } // LCOV_EXCL_STOP
+ switch(command) {
+ case RPC_PACKET_APIRETURN:
+ result = RpcSetAPIcallReturn(idinfo,
+ (const char *)(readbuf + RPC_PACKET_HEADER_LEN),
+ size);
+ if(result == RPC_OK) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ if (sscanf((const char *)(readbuf + RPC_PACKET_HEADER_LEN), "%08x ", (unsigned int *)&result) != 1) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sscanf
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BUG_ASSERT(0, "Parsing packet failed"); // LCOV_EXCL_LINE 15: marco defined in rpc_internal.h
+ return RPC_ERR_Fatal;
+ }
+ }
+ goto exit_loop_ok;
+ default:
+ RPC_LOG_STATE("unwanted packet received while waiting for API return");
+ continue;
+ break;
+ }
+ } else if (sret > 0 && FD_ISSET(inotify_fd, &fds)) { /* server process is terminate. */
+ UINT32 read_len = 0;
+ int length = 0;
+ char *buffer;
+ buffer = (char *)rpc_malloc(BUF_LEN);
+ if (NULL == buffer) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("rpc_malloc() ERROR.");
+ } // LCOV_EXCL_STOP
+
+ if((length = (int)read( inotify_fd, buffer, BUF_LEN )) < 0 ) { // LCOV_EXCL_START 5: fail safe for libc read
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_PERROR("inotify read() ERROR.");
+ } // LCOV_EXCL_STOP
+ while (read_len < length) {
+ struct inotify_event *event = ( struct inotify_event * )&buffer[read_len];
+
+ if (event->mask & IN_DELETE_SELF) { /* Terminating a Server Process */
+ if (RPC_ERR_Server_Finish == RpcDeleteSrvrPid(idinfo, srvr_id, event->wd)) {
+ RPC_LOG_PERROR("server process is terminate. : srvr_ID = %x", srvr_id);
+ result = RPC_ERR_Fatal;
+ }
+ }
+ read_len += (UINT32)(EVENT_SIZE + event->len); /* Size of the inotify_event structure */
+ }
+ rpc_free(buffer);
+ if (RPC_OK != result) {
+ goto exit_loop_ok;
+ }
+
+ } else { /* poll error */ // LCOV_EXCL_START 5: fail safe for libc select
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_PERROR("select in wait result");
+ result = RPC_ERR_Fatal;
+ goto exit_loop_ok;
+ // LCOV_EXCL_STOP
+ }
+ }
+exit_loop_ok:
+
+ return result;
+}
+
+/** @} */
diff --git a/otherservice/rpc_library/tool/Makefile b/otherservice/rpc_library/tool/Makefile
new file mode 100755
index 0000000..8ffd816
--- /dev/null
+++ b/otherservice/rpc_library/tool/Makefile
@@ -0,0 +1,62 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+all: rpc_apidef
+
+clean:
+ rm -rf $(CLEAN_FILES)
+
+YACC := bison
+YFLAGS := -d -t
+LEX := flex
+LFLAGS := -d
+
+CPPFLAGS := -I../library/include -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+CFLAGS := -Wall -Wno-unused-function -Wno-unused-variable -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+rpc_apidef: apidef.tab.o lex.yy.o apidef.o
+ $(CXX) $(CPPFLAGS) -o $@ $^
+
+apidef.tab.o: apidef.tab.h apidef.tab.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c $^
+
+lex.yy.o: lex.yy.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c $^
+
+apidef.o: apidef.cc
+ $(CXX) $(CPPFLAGS) $(CFLAGS) -c $^
+
+apidef.tab.h apidef.tab.c: apidef.y
+ $(YACC) $(YFLAGS) $<
+
+lex.yy.c: apidef.l apidef.tab.h
+ $(LEX) $(LFLAGS) $<
+
+CLEAN_FILES := rpc_apidef *.o apidef.tab.h apidef.tab.c lex.yy.c
+
+CLEAN_TARGET := clean-all clean-all-sub clean-sub
+INSTALL_TARGET := install-header
+EMPTY_TARGET := install-prog install-data install-lib install-arlib install-shlib
+.PHONY: all install clean $(CLEAN_TARGET) $(INSTALL_TARGET) $(EMPTY_TARGET)
+
+$(CLEAN_TARGET): clean
+
+$(INSTALL_TARGET): install
+
+$(EMPTY_TARGET):
+
+include ../../other_service.mk
+
diff --git a/otherservice/rpc_library/tool/apidef.cc b/otherservice/rpc_library/tool/apidef.cc
new file mode 100755
index 0000000..ec0a489
--- /dev/null
+++ b/otherservice/rpc_library/tool/apidef.cc
@@ -0,0 +1,1104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file apidef.cc
+ * @brief RPC tools--Main processing(Implementations of APIDef classes)
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h>
+
+#include <other_service/rpc.h>
+
+#include "apidef.h"
+#include "apidef.tab.h"
+
+static APIDef *API_Def;
+
+extern "C" { // C interface functions
+
+void
+ApidefDefineId(const char *id) {
+ if (id != NULL) {
+ if (API_Def == NULL) {
+ API_Def = new APIDef();
+ }
+ API_Def->DefineId(id);
+ }
+}
+
+void
+ApidefAddHeader(const char *filename) {
+ if (filename != NULL) {
+ if (API_Def == NULL) {
+ API_Def = new APIDef();
+ }
+ API_Def->AddHeader(filename);
+ }
+}
+
+int
+ApidefPushFunctionArg(int arg_code, int buffer_bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out,
+ const char *var_name) {
+ if (API_Def == NULL) {
+ API_Def = new APIDef();
+ }
+ return API_Def->AddFunctionArg(arg_code, buffer_bytes, is_pointer,
+ is_vararray, is_array_size,
+ var_type_name, in_out, var_name);
+}
+
+void
+ApidefProcessFunction(const char *name) {
+ if (API_Def == NULL) {
+ API_Def = new APIDef();
+ }
+ API_Def->NameFunction(name);
+}
+
+void
+ApidefListFunctions(int with_args) {
+ if (API_Def != NULL) {
+ API_Def->Print(with_args);
+ }
+}
+
+void
+ApidefFreeAllocation(void) {
+ if (API_Def != NULL) {
+ delete API_Def;
+ API_Def = NULL;
+ }
+}
+
+int
+ApidefMakeStubs(void) {
+ if (API_Def != NULL) {
+ API_Def->MakeStubs();
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+} // extern "C"
+
+/*
+ * Retrieving Argument Names Without Decorators
+ */
+void
+Arg::GetUndecolatedName(string& name /* OUT */, int num) {
+ name = "v";
+ if (num > 0) {
+ /* Making Variable Names Sequential Numbers */
+ char num_str[5];
+ sprintf(num_str, "%d", num);
+ name += num_str;
+ } else {
+ /* Use a user-supplied pseudo-variable name */
+ name = m_name;
+ }
+}
+
+int
+Arg::PrintUndecoratedName(fstream& out, int num) {
+ /* Pointer argument */
+ if (m_is_pointer) {
+ out << "*";
+ }
+
+ if (num > 0) {
+ /* Making Variable Names Sequential Numbers */
+ out << "v" << num;
+ } else {
+ /* Use a user-supplied pseudo-variable name */
+ out << m_name;
+ }
+
+ return 0;
+}
+
+/*
+ * Outputs one argument in a function prototype declaration
+ * out: Destination file
+ * num: Handling of Formal Argument Names
+ * 0 :Formal argument name specified in the API definition file
+ * Non-zero: Use "v" + specified number(Examples: v1, v2, ...)
+ */
+int
+Arg::PrintPrototype(fstream& out, int num) {
+ const char *type = TypeCodeString(m_code);
+ if (type == NULL) {
+ type = m_type_name.c_str();
+ }
+ if (type == NULL) {
+ cout << "Internal Error Occurrence!!\n";
+ return 1;
+ }
+
+ /* Const non-output pointers */
+ if ((m_in_out & RPC_OUT_ARG) == 0 && (m_bytes != 0 || m_is_pointer != 0)) {
+ out << "const ";
+ }
+ out << type << " ";
+ if (m_is_pointer && m_bytes == 0) {/* Non-string pointer arguments */
+ out << "*";
+ }
+
+ if (num > 0) {/* Making variable names sequential numbers */
+ out << "v" << num;
+ } else {/* Use a user-supplied pseudo-variable name */
+ out << m_name;
+ }
+
+ /* Variable-length arrays */
+ if (m_is_vararray != 0) {
+ out << "/* VAR_ARRAY */";
+ }
+
+ /* Variable-length arrays length */
+ if (m_is_array_size != 0) {
+ out << "/* VAR_SIZE */";
+ }
+
+ /*
+ * Commenting on OUT/INOUT Arguments
+ * Maximum number of bytes of a string argument added to a comment
+ */
+ if ((m_in_out & RPC_OUT_ARG) != 0 || m_bytes != 0) {
+ out << "/* ";
+ if ((m_in_out & RPC_OUT_ARG) != 0) {
+ if ((m_in_out & RPC_IN_ARG) != 0) {
+ out << "IN";
+ }
+ out << "OUT ";
+ }
+ if (m_bytes) {
+ out << m_bytes << "Byte ";
+ }
+ out << "*/";
+ }
+
+ return 0;
+}
+
+int
+Arg::CreateMarshallArgs(fstream& out, int num) {
+ return CreateMarshallArgs(out, num, (RPC_IN_ARG|RPC_OUT_ARG));
+}
+
+int
+Arg::CreateMarshallArgs(fstream& out, int num, string &array_size_name) {
+ return CreateMarshallArgs(out, num, (RPC_IN_ARG|RPC_OUT_ARG), array_size_name);
+}
+
+int
+Arg::CreateMarshallArgs(fstream& out, int num, int in_out) {
+ string dummy = "";
+ return CreateMarshallArgs(out, num, in_out, dummy);
+}
+
+/*
+ * The arguments to rpc_marshall_args() are generated for each API argument.
+ * for each API argument.
+ * out: Destination file
+ * num: Number given to the variable name of the argument (Examples: 1 for v1)
+ * in_out: Specifying the IN or OUT Attributes
+ * Output only if the argument has the specified attribute
+ */
+int
+Arg::CreateMarshallArgs(fstream& out, int num, int in_out, string &array_size_name) {
+ if ((m_in_out & in_out) != 0) {
+ /*
+ * Collectively passes the argument type, pointer/non-pointer, IN/OUT attribute,
+ * and the maximum number of bytes of the argument type to one integer.
+ */
+ RPC_marshall_flag flag;
+ flag.bits.code = m_code & ((1<<RPC_MARSHALL_FLAG_BITS_CODE)-1);
+ flag.bits.is_vararray = ((array_size_name.size() != 0) ? 1: 0) &
+ ((1<<RPC_MARSHALL_FLAG_BITS_IS_VARARRAY)-1);
+ flag.bits.is_pointer = m_is_pointer & ((1<<RPC_MARSHALL_FLAG_BITS_IS_POINTER)-1);
+ flag.bits.in_out = m_in_out & ((1<<RPC_MARSHALL_FLAG_BITS_IN_OUT)-1);
+ flag.bits.bytes = (UINT16)(m_bytes);
+ char str[11];
+ sprintf(str, "0x%x", htonl(flag.all));
+ out << "\t\t\t" << str;
+
+ /*
+ * Add size of user-defined type to argument
+ */
+ if (m_code == rpc_USER_DEFINED) {
+ if (array_size_name.size() != 0) {
+ out << " + ntohs(sizeof(" << m_type_name << ") * " << array_size_name << ")";
+ } else {
+ out << " + ntohs(sizeof(" << m_type_name << "))";
+ }
+ } else if (array_size_name.size() != 0) {
+ out << " + ntohs(sizeof(" << TypeCodeString(m_code) << ") * " << array_size_name << ")";
+ }
+
+ out << ", v" << num;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+int
+Arg::CreateDemarshallArgs(fstream& out, int deliver_pointer, int num) {
+ return CreateDemarshallArgs(out, deliver_pointer, num, (RPC_IN_ARG|RPC_OUT_ARG));
+}
+
+int
+Arg::CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, string &array_size_name) {
+ return CreateDemarshallArgs(out, deliver_pointer, num, (RPC_IN_ARG|RPC_OUT_ARG), array_size_name);
+}
+
+int
+Arg::CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, int in_out) {
+ string dummy = "";
+ return CreateDemarshallArgs(out, deliver_pointer, num, in_out, dummy);
+}
+
+/*
+ * The arguments to rpc_demarshall_args() are generated for each API argument.
+ * for each API argument.
+ * out: Destination file
+ * deliver_pointer: Passing a Variable Pointer(non-0)
+ * num: Number given to the variable name of the argument (Examples: 1 for v1)
+ * in_out: Specifying the IN or OUT Attributes
+ * Output only if the argument has the specified attribute
+ */
+int
+Arg::CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, int in_out, string &array_size_name) {
+ if ((m_in_out & in_out) != 0) {
+ /*
+ * Collectively passes the argument type, pointer/non-pointer, IN/OUT attribute,
+ * and the maximum number of bytes of the argument type to one integer.
+ */
+ RPC_marshall_flag flag;
+ flag.bits.code = m_code & ((1<<RPC_MARSHALL_FLAG_BITS_CODE)-1);
+ flag.bits.is_vararray = ((array_size_name.size() != 0) ? 1: 0) &
+ ((1<<RPC_MARSHALL_FLAG_BITS_IS_VARARRAY)-1);
+ flag.bits.is_pointer = m_is_pointer & ((1<<RPC_MARSHALL_FLAG_BITS_IS_POINTER)-1);
+ flag.bits.in_out = m_in_out & ((1<<RPC_MARSHALL_FLAG_BITS_IN_OUT)-1);
+ flag.bits.bytes = (UINT16)(m_bytes);
+ char str[11];
+ sprintf(str, "0x%x", htonl(flag.all));
+ out << "\t\t\t" << str;
+
+ /*
+ * Add size of user-defined type to argument
+ */
+ if (m_code == rpc_USER_DEFINED) {
+ out << " + ntohs(sizeof(" << m_type_name << "))";
+ }
+
+ out << ", ";
+ if (deliver_pointer) {
+ /* Pass a pointer */
+ out << "&";
+ }
+ out << "v" << num;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+int
+Function::AppendArg(int code, int bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out, const char *var_name) {
+ if (NumOfArgs() >= RPC_MAX_API_ARG_NUM) {
+ cout << "Too many API function arguments.\n";
+ return -1;
+ }
+ Arg *a = new Arg(code, bytes, is_pointer, is_vararray, is_array_size,
+ var_type_name, in_out, var_name);
+ m_args.push_back(*a);
+ delete a;
+ return 0;
+}
+
+/*
+ * Generate prototype declarations for a single API function
+ * out: Destination file
+ */
+int
+Function::PrintPrototype(fstream& out, int server) {
+ int ret = 0;
+
+ const char *return_type
+ = server ? RPC_API_SERVER_RETURN : RPC_API_CLIENT_RETURN;
+#ifdef DBG_ENABLE
+ if ((server) || (!rpc_log_enable)) {
+ out << return_type << " " << m_name << "(";
+ } else {
+ out << return_type << " __" << m_name << "(";
+ }
+#else
+ out << return_type << " " << m_name << "(";
+#endif
+
+ list<Arg>::size_type num_args = m_args.size();
+ if (num_args > 0) {
+ list<Arg>::iterator a;
+ a = m_args.begin();
+ for (list<Arg>::size_type i = 1; i <= num_args; ++i, ++a) {
+ a->PrintPrototype(out);
+#ifdef DBG_ENABLE
+ if ((server) || (!rpc_log_enable)) {
+ if (i != num_args) {
+ out << ", ";
+ }
+ } else {
+ out << ", ";
+ }
+#else
+ if (i != num_args) {
+ out << ", ";
+ }
+#endif
+ }
+ } else {
+#ifdef DBG_ENABLE
+ if ((server) || (!rpc_log_enable)) {
+ out << "void";
+ }
+#else
+ out << "void";
+#endif
+ }
+#ifdef DBG_ENABLE
+ /* Debug information */
+ if ((!server) && (rpc_log_enable)) {
+ out << "const char *filename, const char *funcname, int line ";
+ }
+#endif
+ out << ");\n";
+ return ret;
+}
+
+#ifdef DBG_ENABLE
+int
+Function::PrintMacro(fstream& out) {
+ int ret = 0;
+ out << "#define " << m_name << "(";
+
+ int num_args = m_args.size();
+ if (num_args > 0) {
+ int i;
+ char c;
+ for (i = 1, c = 'a'; i <= num_args; i++, c++) {
+ out << c;
+ if (i != num_args) {
+ out << ", ";
+ }
+ }
+ out << ") \\\n\t";
+
+ /* Entity */
+ out << "__" << m_name << "(";
+ for (i = 1, c = 'a'; i <= num_args; i++, c++) {
+ out << c << ", ";
+ }
+ out << "__FILE__, __func__, __LINE__)\n";
+ } else { /* Without arguments */
+ out << ") " << "__" << m_name << "(__FILE__, __func__, __LINE__)\n";
+ }
+
+ return ret;
+}
+#endif
+
+int
+APIDef::MakeHeaderFiles(int server) {
+ char filename[MAX_FILENAME_LEN+1];
+ sprintf(filename, "%s%s", m_lowerid.c_str(),
+ (server ? SERVER_HEADER_FILE : CLIENT_HEADER_FILE));
+ int ret = 0;
+
+ fstream out(filename, ios::out);
+ if (!out.is_open()) {
+ cout << "ERROR: File " << filename << " Could not open.\n";
+ return 1;
+ }
+ cout << "info: Header file " << filename << " Creating.\n";
+
+ const char *define_str =
+ server ? SERVER_HEADER_DEFINE : CLIENT_HEADER_DEFINE;
+ const char *title = server ? SERVER_HEADER_TITLE : CLIENT_HEADER_TITLE;
+
+ out << "#ifndef _" << m_lowerid << define_str << "\n";
+ out << "#define _" << m_lowerid << define_str << "\n";
+ out << "/*\n";
+ out << " * " << m_id << " " << title << " " << filename << "\n";
+ out << " *\n";
+ out << RPCTOOL_WARNING_STRING << "\n";
+ out << " */\n\n";
+
+ list<string>::iterator i;
+ for (i = m_headers.begin(); i != m_headers.end(); ++i) {
+ out << "#include <" << *i << ">\n";
+ }
+ out << "\n";
+
+ if (server) {
+
+ out << EXTERN_C_START << "\n";
+
+ out << RPC_API_DISPATCH_RETURN << " "
+ << m_id << RPC_API_DISPATCH_FUNC_FULL << ";\n";
+
+ out << "#ifdef RPC_DISPATCH_FUNC\n"
+ << "#undef RPC_DISPATCH_FUNC\n"
+ << "#define RPC_DISPATCH_FUNC " << m_id << RPC_API_DISPATCH_FUNC_NAME
+ << "\n#else /* !RPC_DISPATCH_FUNC */\n"
+ << "#error \"Please include <rpc.h> first!!\"\n"
+ << "#endif /* !RPC_DISPATCH_FUNC */\n\n";
+
+ out << EXTERN_C_END << "\n";
+
+ }
+#ifdef DBG_ENABLE
+ else if (rpc_log_enable) {
+ /* DEBUG INFORMATION EMBEDDED MACRO */
+ out << "/* Debug information embedded macro definition */\n";
+ list<Function>::iterator f;
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ if (f->PrintMacro(out) != 0) {
+ ret = 1;
+ break;
+ }
+ }
+ out << "\n";
+ }
+#endif
+
+ out << EXTERN_C_START << "\n";
+
+ out << "/* API definitions */\n";
+ list<Function>::iterator f;
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ if (f->PrintPrototype(out, server) != 0) {
+ ret = 1;
+ break;
+ }
+ }
+ out << "\n";
+
+ out << EXTERN_C_END << "\n";
+
+ out << "#endif /* _" << m_lowerid << define_str << " */\n";
+ out.close();
+ return ret;
+}
+
+int
+Function::PrintServerStub(fstream& out) {
+ int num_args = NumOfArgs();
+
+ out << "\tcase " << RPC_API_NUM_PREFIX << m_name << ": {\n";
+
+ list<Arg>::iterator a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ const char *type = TypeCodeString(a->Code());
+ if (type == NULL) {
+ type = (a->TypeName()).c_str();
+ }
+ if (type == NULL) {
+ return 1;
+ }
+ out << "\t\t" << type << " ";
+ if (a->Bytes() > 0 || a->IsPointer()) {/* Pointer-passing argument */
+ if (a->Bytes() > 0) {
+ out << "v" << i << " = NULL;\n";
+ } else if (a->IsPointer()) {
+ out << "*v" << i << " = NULL;\n";
+ }
+ } else {/* Pass-by-value argument */
+ out << "v" << i << ";\n";
+ }
+ }
+ if (num_args > 0) {
+ out << "\t\tif (" << RPC_DEMARSHALL_FUNCTION
+ << " (args_string, args_size, 1, " << num_args << ",\n";
+ /* In the STUB of servers for all pre-call demarshall */
+ /* Passing Pointers to Local Variables in Server STUB */
+ /* Pointer/ Buffer will alloc the required space in demarshall_arguments() */
+
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->IsVararray() != 0) { /* Variable-length arrays */
+ a->CreateDemarshallArgs(out, 1, i, m_array_size_name);
+ } else {
+ a->CreateDemarshallArgs(out, 1, i);
+ }
+ if (i < num_args) {
+ out << ",";
+ }
+ out << "\n";
+ }
+ out << "\t\t ) < 0) {\n";
+ out << "\t\t\tgoto _" << m_name << "_Error;\n";
+ out << "\t\t}\n";
+ }
+
+ out << "\t\tresult = " << m_name << "(";
+ for (int i = 1; i <= num_args; i++) {
+ out << "v" << i;
+ if (i < num_args) {
+ out << ", ";
+ }
+ }
+ out << ");\n";
+
+ int to_process = NumOfInOutArgs(RPC_OUT_ARG);
+ if (to_process > 0) {
+ /* Only OUT-arguments marshall after the server stub is called. */
+ out << "\t\t/*if (result == RPC_OK) {*/\n";
+ out << "\t\t *ret_string = " << RPC_MARSHALL_FUNCTION
+ << "(ret_size, 0, " << to_process << ",\n";
+
+ a = m_args.begin();
+ int processed = 0;
+ int ret;
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->IsVararray() != 0) { /* Variable-length arrays */
+ ret = a->CreateMarshallArgs(out, i, RPC_OUT_ARG, m_array_size_name);
+ } else {
+ ret = a->CreateMarshallArgs(out, i, RPC_OUT_ARG);
+ }
+ if (ret) {
+ processed++;
+ if (processed < to_process) {
+ out << ",";
+ }
+ out << "\n";
+ }
+ }
+ out << "\t\t );\n"
+ << "\t\t if (*ret_string == NULL) {\n"
+ << "\t\t\tresult = " << RPC_API_SERVER_ERROR << ";\n"
+ << "\t\t }\n"
+ << "\t\t/*}*/\n";
+ }
+
+ if (num_args > 0) {
+ out << "_" << m_name << "_Error:\n";
+ }
+ int num_pointer_args = 0;
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->Bytes() || a->IsPointer()) {
+ num_pointer_args++;
+ }
+ }
+ if (num_pointer_args > 0) {
+ int processed = 0;
+ out << "\t\t" << RPC_MARSHALL_FREE_FUNCTION
+ << "(" << num_pointer_args << ", ";
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->Bytes() || a->IsPointer()) {
+ out << "v" << i;
+ processed++;
+ if (processed < num_pointer_args) {
+ out << ", ";
+ }
+ }
+ }
+ out << ");\n";
+ }
+ out << "\t\tbreak;\n\t}\n";
+ return 0;
+}
+
+int
+APIDef::MakeServerStub(void) {
+ char filename[MAX_FILENAME_LEN+1];
+ sprintf(filename, "%s%s", m_lowerid.c_str(), SERVER_STUB_FILE);
+ int ret = 0;
+
+ fstream out(filename, ios::out);
+ if (!out.is_open()) {
+ cout << "File " << filename << " Could not open.\n";
+ return 1;
+ }
+ cout << "info: Stub file " << filename << " Creating.\n";
+
+ const char *title = SERVER_STUB_TITLE;
+
+ out << "/*\n";
+ out << " * " << m_id << " " << title << " " << filename << "\n";
+ out << " *\n";
+ out << RPCTOOL_WARNING_STRING << "\n";
+ out << " */\n";
+ out << "#include <" RPC_GLOBAL_HEADER_FILE << ">\n";
+ out << "#include \"" << m_lowerid << SERVER_HEADER_FILE << "\"\n";
+ out << "#include <netinet/in.h> /* for ntohs() */\n\n";
+
+ int api_num = 1;
+ list<Function>::iterator f;
+
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f, ++api_num) {
+ if (api_num >= (1<<16)) {
+ cout << "Too many API functions.(Up to 65535)\n";
+ return 1;
+ }
+ out << "#define " << RPC_API_NUM_PREFIX << f->Name()
+ << " " << api_num << "\n";
+ }
+ out << "\n";
+
+ out << "RPC_Result\n";
+ out << m_id << RPC_API_DISPATCH_FUNC_FULL << "\n";
+ out << "{\n";
+ out << "\tRPC_Result result = " << RPC_API_SERVER_ERROR << ";\n";
+ out << "\t*ret_string = NULL;\n";
+ out << "\tswitch(api_num) {\n";
+
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ if (f->PrintServerStub(out) != 0) {
+ ret = 1;
+ break;
+ }
+ }
+
+ if (ret != 0) {
+ return ret;
+ }
+
+ out << "\tdefault:\n\t\tbreak;\n\t}\n";
+ out << "\treturn result;\n";
+ out << "}\n";
+
+ return ret;
+}
+
+int
+Function::PrintClientStub(const char *moduleid, fstream& out) {
+ int ret = 0;
+
+ list<Arg>::iterator a;
+ /* Function Names and Arguments */
+ out << RPC_API_CLIENT_RETURN << "\n";
+#ifdef DBG_ENABLE
+ if (rpc_log_enable) {
+ out << "__" << m_name << "(";
+ } else {
+ out << m_name << "(";
+ }
+#else
+ out << m_name << "(";
+#endif
+ int num_args = (int)(m_args.size());
+ if (num_args > 0) {
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->PrintPrototype(out, i)) {
+ return 1;
+ }
+#ifdef DBG_ENABLE
+ if (rpc_log_enable) {
+ out << ", ";
+ } else {
+ if (i < num_args) {
+ out << ", ";
+ }
+ }
+#else
+ if (i < num_args) {
+ out << ", ";
+ }
+#endif
+ }
+ } else {
+#ifndef DBG_ENABLE
+ out << "void";
+#else
+ if (!rpc_log_enable) {
+ out << "void";
+ }
+#endif
+ }
+#ifdef DBG_ENABLE
+ if (rpc_log_enable) {
+ out << "const char *filename, const char *funcname, int line ";
+ }
+#endif
+ out << ")\n";
+
+ out << "{\n";
+
+ /* Contents of stub functions */
+
+ /* If the argument is present and the variable-length array does not exist */
+ if ((num_args > 0) && (m_array_size_pos == 0)) {
+ int is_exist_mytype = 0;
+ /* Restricted specifications */
+ out << "#ifdef RPC_STATIC_ASSERT\n";
+ out << "\tchar RPC_TOTAL_ARGSIZE_ERROR_in_" << m_name << "[\n";
+ out << "\t(((";
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (i > 1) {
+ out << " + ";
+ }
+ out << "sizeof(";
+ a->PrintUndecoratedName(out, i);
+ out << ")";
+ /* For user types */
+ if ((!is_exist_mytype) && (NULL == TypeCodeString(a->Code()))) {
+ is_exist_mytype = 1;
+ }
+ }
+ out << ") > RPC_MAX_API_ARG_TOTAL_SIZE) ? -1: 1)\n";
+ out << "\t]__attribute__((unused));\n";
+
+ /* Have a user type */
+ if (is_exist_mytype) {
+ char c[3];
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (NULL == TypeCodeString(a->Code())) {
+ sprintf(c, "%d", i);
+ out << "\tchar RPC_ARGSIZE_ERROR_in_" << m_name << "_arg" << c;
+ out << "[\n\t(sizeof(";
+ a->PrintUndecoratedName(out, i);
+ out << ") > RPC_MAX_API_ARG_SIZE) ? -1: 1\n";
+ out << "\t]__attribute__((unused));\n";
+ }
+ }
+ }
+
+ out << "#endif /* RPC_STATIC_ASSERT */\n";
+
+ }
+
+ out << "\tRPC_Result result = " << RPC_API_CLIENT_ERROR << ";\n";
+ out << "\tunsigned int args_size = 0, ret_size;\n";
+ out << "\tchar retcode[9];\n";
+
+ if (num_args > 0) {
+ /* Advance preparation==Marshalling of arguments */
+ out << "\tchar *args_string = " << RPC_MARSHALL_FUNCTION
+ << "(&args_size, 1, " << num_args << ",\n";
+ /* In the clients STUB for all pre-call marshall */
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->IsVararray() != 0) { /* Variable-length arrays */
+ a->CreateMarshallArgs(out, i, m_array_size_name);
+ } else {
+ a->CreateMarshallArgs(out, i);
+ }
+ if (i < num_args) {
+ out << ",";
+ }
+ out << "\n";
+ }
+ out << "\t);\n";
+ out << "\tif (args_string == NULL) {\n"
+ << "\t\tgoto _" << m_name << "_Error;\n\t}\n";
+ } else {
+ out << "\tchar *args_string = NULL;\n";
+ }
+
+#ifdef DBG_ENABLE
+ if (rpc_log_enable) {
+ out << "\tif (" << moduleid << "_record_dbg_log(filename, funcname, line, \"";
+ out << m_name << "\") != 0) {\n";
+ out << "\t\tgoto _" << m_name << "_Error;\n\t}\n";
+ }
+#endif
+
+ /* RPC API call */
+ out << "\tchar *ret_string = NULL; /* pgr0431 */\n";
+#ifdef RPC_STRING_ID
+ out << "\tresult=RPC_API_call(\"" << moduleid << "\", ";
+#else
+ out << "\tresult=RPC_API_call(" << moduleid << "_RPC_ID, ";
+#endif
+ out << RPC_API_NUM_PREFIX << m_name;
+ out << ", args_string, args_size, &ret_string, &ret_size);\n";
+
+ // 2007.08.25 To avoid over run within the sscanf
+ // Locally copies strings needed for determining return values and uses strtol instead of sscanf
+ // (Since there is no guarantee that the byte sequence to be grabbed by communication is 0-terminated)
+ out << "\n"
+ << "\tif (result == RPC_OK && ret_string != NULL) {\n"
+ << "\t strncpy(retcode, ret_string, 8);\n"
+ << "\t retcode[8] = '\\0';\n"
+ << "\t result = (RPC_Result)strtoul(retcode, NULL, 16);\n";
+
+ /* Post-processing==Arguments de-marshalling, free() */
+ int num_of_out_args = NumOfInOutArgs(RPC_OUT_ARG);
+ if (num_of_out_args > 0) {
+ out << "\t if (" << RPC_DEMARSHALL_FUNCTION
+ << "(ret_string + RPC_RETCODE_LEN, ret_size - RPC_RETCODE_LEN, 0, "
+ << num_of_out_args << ",\n";
+
+ a = m_args.begin();
+ int processed = 0;
+ int ret;
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->IsVararray() != 0) { /* Variable-length arrays */
+ ret = a->CreateDemarshallArgs(out, 0, i, RPC_OUT_ARG, m_array_size_name);
+ } else {
+ ret = a->CreateDemarshallArgs(out, 0, i, RPC_OUT_ARG);
+ }
+ if (ret) {
+ processed++;
+ if (processed < num_of_out_args) {
+ out << ",";
+ }
+ out << "\n";
+ }
+ }
+ out << "\t ) < 0) {\n"
+ << "\t\tresult = " << RPC_API_CLIENT_ERROR << ";\n"
+ << "\t }\n";
+ }
+
+ out << "\t} else {\n\t //result = " << RPC_API_CLIENT_ERROR << ";\n"
+ << "\t}\n";
+
+ out << "\t" << RPC_RETURN_FREE_FUNCTION << "(ret_string);\n";
+ out << "\t" << RPC_MARSHALL_FREE_FUNCTION << "(1, args_string);\n";
+
+ /* END, RETURN */
+#ifndef DBG_ENABLE
+ if (num_args)
+#else
+ if ((num_args)||(rpc_log_enable))
+#endif
+ {
+ out << "_" << m_name << "_Error:\n";
+ }
+
+ out << "\treturn result;\n}\n";
+
+ return ret;
+}
+
+int
+APIDef::MakeClientStub(void) {
+ char filename[MAX_FILENAME_LEN+1];
+ sprintf(filename, "%s%s", m_lowerid.c_str(), CLIENT_STUB_FILE);
+ int ret = 0;
+
+ fstream out(filename, ios::out);
+ if (!out.is_open()) {
+ cout << "File " << filename << " Could not open.\n";
+ return 1;
+ }
+ cout << "info: Stub file " << filename << " Creating.\n";
+
+ const char *title = CLIENT_STUB_TITLE;
+
+ out << "/*\n";
+ out << " * " << m_id << " " << title << " " << filename << "\n";
+ out << " *\n";
+ out << RPCTOOL_WARNING_STRING << "\n";
+ out << " */\n";
+ out << "#include <" RPC_GLOBAL_HEADER_FILE << ">\n";
+ out << "#include <" << m_lowerid << CLIENT_HEADER_FILE << ">\n\n";
+ out << "#include <stdio.h> /* for sscanf() */\n";
+ out << "#include <stdlib.h> /* for getenv() */\n";
+ out << "#include <string.h> /* for strncpy() */\n";
+ out << "#include <netinet/in.h> /* for ntohs() */\n\n";
+
+ int api_num = 1;
+ list<Function>::iterator f;
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f, ++api_num) {
+ if (api_num >= (1<<16)) {
+ cout << "Too many API functions.(Up to 65535)\n";
+ return 1;
+ }
+ out << "#define " << RPC_API_NUM_PREFIX << f->Name()
+ << " " << api_num << "\n";
+ }
+ out << "\n";
+
+ /* Specification Restriction Debug Constants */
+ out << "/*#define RPC_STATIC_ASSERT*/\n";
+ out << "\n";
+
+#ifdef DBG_ENABLE
+ if (rpc_log_enable) {
+ int m_id_work_cnt;
+ string m_id_work = m_id;
+ for (m_id_work_cnt = 0; m_id_work_cnt < m_id_work.length(); m_id_work_cnt++) {
+ m_id_work[m_id_work_cnt] = toupper(m_id_work[m_id_work_cnt]);
+ }
+ out << "int\n" << m_id << "_record_dbg_log(const char *filename, " <<
+ "const char *funcname, int line, const char *apiname)\n";
+ out << "{\n\t";
+ out << "if (getenv(\"" << m_id_work << "_RPC_LOG\") != NULL) {\n\t\t";
+ out << "return RPC_record_dbg_log(filename, funcname, line, apiname);\n\t";
+ out << "}\n\t";
+ out << "return 0;\n";
+ out << "}\n\n";
+ }
+#endif
+
+ /* API definitions */
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ if (f->PrintClientStub(m_id.c_str(), out) != 0) {
+ ret = 1;
+ break;
+ }
+ }
+ return ret;
+}
+
+int
+Arg::IsArraySize(void) {
+ if (m_is_array_size != 0) {
+ if (IsTypeCodeNumeric(m_code) == 1) {
+ return 1;
+ } else {
+ cout << "Variable-length array length specification variables must be integers.\n";
+ return -1;
+ }
+ }
+ return 0;
+}
+
+int
+Function::CheckFuncArraySize(void) {
+ int num_args = (int)(m_args.size());
+ list<Arg>::iterator a;
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ int ret = a->IsArraySize();
+ if (ret > 0) {
+ if (m_array_size_pos != 0)
+ {
+ cout << "Two or more variable array length specification arguments exist.\n";
+ return 1;
+ }
+ m_array_size_pos = i;
+ a->GetUndecolatedName(m_array_size_name, i);
+ } else if (ret < 0) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int
+APIDef::CheckAllArraySize(void) {
+ list<Function>::iterator f;
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ if (f->CheckFuncArraySize() != 0) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int
+APIDef::MakeStubs(void) {
+ if (m_id.size() == 0) {
+ cout << "The module name is not specified.\n";
+ return 1;
+ }
+
+ if (m_id.size() > MAX_FILENAME_LEN - strlen(SERVER_STUB_FILE)) {
+ cout << "The module name is too long.\n";
+ return 1;
+ }
+
+ /* Pre-examine the ARRAYSIZE specification */
+ //cout << "<check_all_array_size>\n";
+ if (CheckAllArraySize() != 0) {
+ return 1;
+ }
+
+ //cout << "<MakeHeaderFiles(0)>\n";
+ if (MakeHeaderFiles(1) != 0) {
+ return 1;
+ }
+
+ //cout << "<MakeHeaderFiles(1)>\n";
+ if (MakeHeaderFiles(0) != 0) {
+ return 1;
+ }
+
+ if (MakeServerStub() != 0) {
+ return 1;
+ }
+
+ if (MakeClientStub() != 0) {
+ return 1;
+ }
+
+ return 0;
+}
+
+void
+Arg::Print(void) {
+ cout << "\t";
+ if (m_name.size() > 0) {
+ cout << "Variable name=" << m_name << " ";
+ }
+ cout << "Type=" << TypeCodeString(m_code) << "In bytes=" << m_bytes << " ";
+ if (m_is_pointer) {
+ cout << "Pointer ";
+ }
+ if ((m_in_out & RPC_OUT_ARG) != 0) {
+ cout << "Output ";
+ }
+ cout << "\n";
+}
+
+void
+Function::Print(int with_args) {
+ printf("Function name=%s\n", m_name.c_str());
+ if (with_args) {
+ list<Arg>::iterator a;
+ for (a = m_args.begin(); a != m_args.end(); ++a) {
+ a->Print();
+ }
+ }
+}
+
+void
+APIDef::Print(int with_args) {
+ list<Function>::iterator f;
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ f->Print(with_args);
+ }
+}
+
+void
+APIDef::IdTolower(void) {
+ char *lower = new char[m_id.size() + 1];
+ strcpy(lower, m_id.c_str());
+ char *p;
+ for (p = lower; *p; p++) {
+ *p = (char)(tolower(*p));
+ }
+ m_lowerid = lower;
+ delete[] lower;
+}
diff --git a/otherservice/rpc_library/tool/apidef.h b/otherservice/rpc_library/tool/apidef.h
new file mode 100755
index 0000000..b042a90
--- /dev/null
+++ b/otherservice/rpc_library/tool/apidef.h
@@ -0,0 +1,333 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file apidef.h
+ * @brief RPC tools--Function/macro definitions and APIDef class definitions
+ */
+/** @addtogroup RPCtool
+ *
+ * @brief Using the RPC Tool (rpc_apidef)
+ *
+ * rpc_apidef [CPP option...] API definition file name
+ *
+ * - CPP option
+ * The RPC tool calls the C preprocessor (CPP) internally
+ * for processing comments and #if directives.
+ * Here, you can specify options to be given to the CPP, such as symbol definitions
+ * for conditional branch descriptions in the API definition file.
+ * - API definition file name
+ * Pathname to the API definition file.
+ * The file name must be thread ID + ".api".
+ *
+ * The output file is as follows.
+ * "*" is a lowercase version of the API definition file name preceding ".api".
+ * - *_api.h(Client header files)
+ * - *_api_stub.c(Client stub file)
+ * - *_srvr.h(Server header file)
+ * - *_srvr_stub.c(Server stub file)
+ *
+ * Examples:
+ * - Examples1: rpc_apidef -DTEST XXX.api
+ * - Examples2: rpc_apidef XXX.api
+ * - => Xxx_api.h, xxx_api_stub.c, ... To the output
+ */
+#ifndef RPC_LIBRARY_TOOL_APIDEF_H_
+#define RPC_LIBRARY_TOOL_APIDEF_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef DBG_ENABLE
+extern char rpc_log_enable;
+#endif
+
+/* C++ to C I/F functions */
+const char *TypeCodeString(const int code);
+int IsTypeCodeNumeric(const int code);
+
+/*
+ * C to C++ I/F functions (APIDef class)
+ */
+void ApidefDefineId(const char *id);
+void ApidefAddHeader(const char *filename);
+int ApidefPushFunctionArg(int arg_code, int buffer_bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out,
+ const char *var_name);
+void ApidefProcessFunction(const char *funcname);
+void ApidefListFunctions(int with_args);
+void ApidefFreeAllocation(void);
+int ApidefMakeStubs(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#define RPC_IN_ARG 0x01
+#define RPC_OUT_ARG 0x02
+#define RPC_INOUT_ARG (RPC_IN_ARG|RPC_OUT_ARG)
+
+#define MAX_FILENAME_LEN 63
+#define SERVER_HEADER_FILE "_srvr.h"
+#define CLIENT_HEADER_FILE "_api.h"
+#define SERVER_STUB_FILE "_srvr_stub.c"
+#define CLIENT_STUB_FILE "_api_stub.c"
+#define SERVER_HEADER_DEFINE "_srvr_h_"
+#define CLIENT_HEADER_DEFINE "_api_h_"
+
+#define SERVER_HEADER_TITLE "Server header files"
+#define CLIENT_HEADER_TITLE "Client header files"
+#define SERVER_STUB_TITLE "Server stub file"
+#define CLIENT_STUB_TITLE "Client stub file"
+
+#define RPC_MARSHALL_FUNCTION "RPC_marshall_arguments"
+#define RPC_DEMARSHALL_FUNCTION "RPC_demarshall_arguments"
+#define RPC_MARSHALL_FREE_FUNCTION "RPC_marshall_free"
+#define RPC_RETURN_FREE_FUNCTION "RPC_free_return_string"
+
+#define RPC_API_SERVER_RETURN "RPC_Result"
+#define RPC_API_SERVER_ERROR "RPC_ERR_Fatal"
+#define RPC_API_CLIENT_RETURN "RPC_Result"
+#define RPC_API_CLIENT_ERROR "RPC_ERR_Fatal"
+#define RPC_API_DISPATCH_TYPE "RPC_dispatch_func_t"
+#define RPC_API_DISPATCH_RETURN "RPC_Result"
+#define RPC_API_DISPATCH_FUNC_FULL "_API_dispatch(UINT16 api_num, const char *args_string, unsigned int args_size, char **ret_string, unsigned int *ret_size)" // NOLINT (readability/nolint)
+#define RPC_API_DISPATCH_FUNC_NAME "_API_dispatch"
+#define RPC_API_NUM_PREFIX "RPC_API_NUM_"
+#define RPC_GLOBAL_HEADER_FILE "other_service/rpc.h"
+
+#define RPCTOOL_WARNING_STRING \
+" * The file created by the RPC tool.This file should not be edited."
+
+#define EXTERN_C_START \
+"#ifdef __cplusplus\n" \
+"extern \"C\" {\n" \
+"#endif\n"
+
+#define EXTERN_C_END \
+"#ifdef __cplusplus\n" \
+"}\n" \
+"#endif /* __cplusplus */\n"
+
+#ifdef __cplusplus
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <list>
+
+using namespace std; // NOLINT (readability/nolint)
+
+/** @ingroup RPCtool
+ * @class Arg
+ * @brief Class that stores and processes the arguments of functions read from the API definition file
+ */
+class Arg {
+ protected:
+ int m_code;
+ int m_bytes;
+ int m_is_pointer;
+ int m_in_out; /* Bit OR of _IN_ARG and _OUT_ARG */
+ int m_is_vararray;
+ int m_is_array_size;
+ string m_type_name;
+ string m_name;
+
+ public:
+ Arg() {
+ m_code = m_bytes = m_is_pointer = m_in_out = m_is_vararray = m_is_array_size = 0;
+ }
+ Arg(int code, int bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *type_name, int in_out,
+ const char *var_name) {
+ m_code = code;
+ m_bytes = bytes;
+ m_is_pointer = is_pointer;
+ m_is_vararray = is_vararray;
+ m_is_array_size = is_array_size;
+ m_in_out = in_out;
+ if (type_name) {
+ m_type_name = type_name;
+ }
+ if (var_name) {
+ m_name = var_name;
+ }
+ }
+ ~Arg() {}
+
+ int Code(void) { return m_code; }
+ int Bytes(void) { return m_bytes; }
+ int IsPointer(void) { return m_is_pointer; }
+ int InOut(void) { return m_in_out; }
+ string& TypeName(void) { return m_type_name; }
+ void GetUndecolatedName(string& name, int num); // NOLINT (readability/nolint)
+
+ int PrintUndecoratedName(fstream& out, int num);
+ int PrintPrototype(fstream& out, int num);
+ int PrintPrototype(fstream& out) { return PrintPrototype(out, 0); }
+
+ int CreateMarshallArgs(fstream& out, int num);
+ int CreateMarshallArgs(fstream& out, int num, string &array_size_name); // NOLINT (readability/nolint)
+ int CreateMarshallArgs(fstream& out, int num, int in_out);
+ int CreateMarshallArgs(fstream& out, int num, int in_out, string &array_size_name); // NOLINT (readability/nolint)
+ int CreateDemarshallArgs(fstream& out, int deliver_pointer, int num);
+ int CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, string &array_size_name); // NOLINT (readability/nolint)
+ int CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, int in_out);
+ int CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, int in_out, string &array_size_name); // NOLINT (readability/nolint)
+
+ int IsVararray(void) { return m_is_vararray; }
+ int IsArraySize(void);
+ void Print(void);
+};
+
+/** @ingroup RPCtool
+ * @class Function
+ * @brief Class that stores and processes function definitions read from the API definition file
+ */
+class Function {
+ protected:
+ string m_name;
+ list<Arg> m_args;
+ int m_array_size_pos;
+ string m_array_size_name;
+
+ public:
+ Function():m_array_size_name("") { m_array_size_pos = 0; }
+ ~Function() {
+ list<Arg>::size_type size = m_args.size();
+ for (list<Arg>::size_type i = 0 ; i < size ; i++) {
+ m_args.begin();
+ m_args.pop_front();
+ }
+ }
+
+ const char *Name(void) { return m_name.c_str(); }
+ void SetName(const char *funcname) {
+ m_name = funcname;
+ }
+
+ int NumOfArgs(void) {
+ return (int)(m_args.size()); // NOLINT (readability/nolint)
+ }
+ int NumOfInOutArgs(int in_out) {
+ int count = 0;
+ list<Arg>::iterator a;
+ for (a = m_args.begin(); a != m_args.end(); ++a) {
+ if ((a->InOut() & in_out) != 0) {
+ ++count;
+ }
+ }
+ return count;
+ }
+
+ int AppendArg(int code, int bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out, const char *var_name);
+
+ int PrintPrototype(fstream& out);
+ int PrintPrototype(fstream& out, int server);
+#ifdef DBG_ENABLE
+ int PrintMacro(fstream& out);
+#endif
+
+ int PrintServerStub(fstream& out);
+ int PrintClientStub(const char *moduleid, fstream& out);
+
+ int CheckFuncArraySize(void);
+ void Print(int with_args);
+};
+
+/** @ingroup RPCtool
+ * @class APIDef
+ * @brief Class that stores and processes the result of reading the API definition file
+ */
+class APIDef {
+ protected:
+ list<Function> m_funcs;
+ Function *m_work;
+ string m_id;
+ string m_lowerid;
+ list<string> m_headers;
+
+ public:
+ APIDef() { m_work = 0; }
+ ~APIDef() {
+ list<Function>::size_type size = m_funcs.size();
+ for (list<Function>::size_type i = 0; i < size; i++) {
+ m_funcs.begin();
+ m_funcs.pop_front();
+ }
+ if (m_work != NULL) {
+ delete m_work;
+ }
+ size = m_headers.size();
+ for (list<Function>::size_type i = 0; i < size; i++) {
+ m_headers.begin();
+ m_headers.pop_front();
+ }
+ }
+
+ void IdTolower(void);
+ void DefineId(const char *id) {
+ m_id = id;
+ IdTolower();
+ }
+ void AddHeader(const char *filename) {
+ string str = filename;
+ m_headers.push_back(str);
+ }
+
+ int AddFunctionArg(int arg_code, int buffer_bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out,
+ const char *var_name) {
+ if (m_work == NULL) {
+ m_work = new Function();
+ }
+ return m_work->AppendArg(arg_code, buffer_bytes, is_pointer,
+ is_vararray, is_array_size,
+ var_type_name, in_out, var_name);
+ }
+ void NameFunction(const char *funcname) {
+ if (m_work == NULL) {
+ m_work = new Function();
+ }
+ m_work->SetName(funcname);
+
+ AppendFunction(m_work);
+ delete m_work;
+ m_work = NULL;
+ }
+
+ void AppendFunction(Function *pfunc) {
+ m_funcs.push_back(*pfunc);
+ }
+
+ int CheckAllArraySize(void);
+
+ int MakeStubs(void);
+ void Print(int with_args);
+
+ private:
+ int MakeHeaderFiles(int server);
+ int MakeServerStub(void);
+ int MakeClientStub(void);
+};
+#endif /* __cplusplus */
+
+#endif // RPC_LIBRARY_TOOL_APIDEF_H_
diff --git a/otherservice/rpc_library/tool/apidef.l b/otherservice/rpc_library/tool/apidef.l
new file mode 100755
index 0000000..c2f246a
--- /dev/null
+++ b/otherservice/rpc_library/tool/apidef.l
@@ -0,0 +1,136 @@
+/**
+ * @file apidef.l
+ * @brief RPC tools--Defining lexical analysis rules for API definition files
+ *
+ */
+/** @ingroup RPCtool
+ * Defining Lexical Analysis Rules for Use with RPC Tools (apidef)
+ */
+%{
+#include <string.h>
+#include <stdlib.h>
+#include "apidef.tab.h"
+%}
+
+ALPHA [A-Za-z_]
+ALPHANUM [0-9\-A-Za-z_]
+ALPHANUMDOT [0-9.\-A-Za-z_/]
+
+%x include
+%s apidef
+%x str_num
+
+%%
+INCLUDE { BEGIN(include); return rpc_INCLUDE; }
+<include>\< { return '<'; }
+<include>{ALPHANUMDOT}+ {
+ yylval.strval = malloc(strlen(yytext)+1);
+ strcpy(yylval.strval, yytext);
+ return rpc_NAME_DOT;
+ }
+<include>\> { BEGIN(INITIAL); return '>'; }
+<include>. /* ignore */
+
+RPC_Result { BEGIN(apidef); return RPC_RESULT; }
+
+<apidef>STRING/[0-9]+ { BEGIN(str_num);
+ yylval.ival = rpc_STRING; return rpc_STRING; }
+<str_num>[0-9]+ {
+ BEGIN(apidef);
+ sscanf(yytext, "%d", &yylval.ival);
+ return rpc_NUM;
+ }
+<str_num>. /* ignore */
+
+<apidef>{
+char { yylval.ival = rpc_CHAR; return rpc_CHAR; }
+int { yylval.ival = rpc_INT; return rpc_INT; }
+signed[ \t\n]+int { yylval.ival = rpc_SINT; return rpc_SINT; }
+unsigned[ \t\n]+int { yylval.ival = rpc_UINT; return rpc_UINT; }
+INT8 { yylval.ival = rpc_INT8; return rpc_INT8; }
+INT16 { yylval.ival = rpc_INT16; return rpc_INT16; }
+INT32 { yylval.ival = rpc_INT32; return rpc_INT32; }
+INT64 { yylval.ival = rpc_INT64; return rpc_INT64; }
+UINT8 { yylval.ival = rpc_UINT8; return rpc_UINT8; }
+UINT16 { yylval.ival = rpc_UINT16; return rpc_UINT16; }
+UINT32 { yylval.ival = rpc_UINT32; return rpc_UINT32; }
+UINT64 { yylval.ival = rpc_UINT64; return rpc_UINT64; }
+float { yylval.ival = rpc_FLOAT; return rpc_FLOAT; }
+double { yylval.ival = rpc_DOUBLE; return rpc_DOUBLE; }
+void { yylval.ival = rpc_VOID; return rpc_VOID; }
+IN {
+ fprintf(stderr,
+ "Specification change: IN Pointer argument needs to be prefixed \"const\" instead of \"IN\".\n"
+ );
+ return rpc_UNKNOWN;
+ }
+OUT {
+ fprintf(stderr,
+ "Specification change: OUT argument no longer needs to be prefixed with \"OUT\".\n"
+ );
+ /* ignore */
+ }
+INOUT { yylval.ival = rpc_INOUT; return rpc_INOUT; }
+const { yylval.ival = rpc_CONST; return rpc_CONST; }
+VARARRAY { yylval.ival = rpc_VARARRAY; return rpc_VARARRAY; }
+ARRAYSIZE { yylval.ival = rpc_ARRAYSIZE; return rpc_ARRAYSIZE; }
+
+{ALPHA}+{ALPHANUM}* {
+ yylval.strval = malloc(strlen(yytext)+1);
+ strcpy(yylval.strval, yytext);
+ return rpc_NAME;
+ }
+
+\( { return '('; }
+\) { return ')'; }
+\* { return '*'; }
+, { return ','; }
+\; { BEGIN(INITIAL); return ';'; }
+
+} /* end of <apidef> */
+
+#.*\n /* ignore CPP directives */
+
+{ALPHANUMDOT}+ {
+ fprintf(stderr, "Unknown keyword %s\n", yytext);
+ return rpc_UNKNOWN;
+ }
+
+[ \t\n]+ /* eat up whitespace */
+
+%%
+#ifdef OLD_STUFFS
+%x portdef
+%x addr_num
+PORT { BEGIN(portdef); return DEFINE_PORT; }
+<portdef>[0-9]+ {
+ BEGIN(INITIAL);
+ sscanf(yytext, "%d", &yylval.ival);
+ return NUM;
+ }
+
+<apidef>ADDR/[0-9]+ { BEGIN(addr_num); yylval.ival = _ADDR; return _ADDR; }
+<addr_num>[0-9]+ {
+ BEGIN(apidef);
+ sscanf(yytext, "%d", &yylval.ival);
+ return NUM;
+ }
+#endif
+
+/*
+ * function to free the buffer which flex allocates but not frees
+ */
+void
+free_flex_buffer(void)
+{
+ yy_delete_buffer(YY_CURRENT_BUFFER);
+}
+
+/*
+ * dummy function to avoid a warning of not using 'yyunput'
+ */
+void
+dummy(void)
+{
+ yyunput(0, 0);
+}
diff --git a/otherservice/rpc_library/tool/apidef.y b/otherservice/rpc_library/tool/apidef.y
new file mode 100755
index 0000000..ce20c9c
--- /dev/null
+++ b/otherservice/rpc_library/tool/apidef.y
@@ -0,0 +1,615 @@
+/**
+ * @file apidef.y
+ * @brief RPC tools--API definition file syntax definition and read/front-end processing
+ *
+ */
+
+/*---------------------------------------------------------------------------*/
+/* C declarative statement */
+/*---------------------------------------------------------------------------*/
+%{
+#define YYDEBUG 1
+#define YYERROR_VERBOSE 1
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/*
+ * YACC to C I/F functions
+ */
+extern int yylex(void); /* LEX I/F */
+extern int yyerror(const char *); /* dummy */
+
+#include "apidef.h"
+
+/* YACC to C I/F functions */
+static void AddHeader(const char *header_file);
+static int push_function_arg(int arg_type, int num_of_bytes,
+ int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name,
+ int is_out, const char *var_name);
+static void process_function(const char *funcname);
+static void free_string(char *funcname);
+
+static int var_type;
+static int num_of_bytes;
+static int is_pointer;
+static int in_out;
+static int is_vararray;
+static int is_array_size;
+static char *var_type_name = NULL;
+
+%}
+
+/*---------------------------------------------------------------------------*/
+/* Bison declarations */
+/*---------------------------------------------------------------------------*/
+%union {
+ int ival;
+ char *strval;
+}
+
+%token '"'
+%left ','
+%left '('
+%right ')'
+%left '*'
+%token '{'
+%token '}'
+%token ';'
+%token '\n'
+%token <strval> rpc_INCLUDE 257
+%token <strval> RPC_RESULT 258
+%token <strval> rpc_NAME_DOT 259
+%token <strval> rpc_NAME 260
+%type <strval> funcdefs funcdef args
+%type <strval> nonvoid_args arg var_type
+%type <strval> var_primitive_type var_string_type var_user_defined_type
+/*
+%token <strval> rpc_OUT
+*/
+%token <strval> rpc_INOUT 261
+%token <strval> rpc_CONST 262
+%token <strval> rpc_VARARRAY 263
+%token <strval> rpc_ARRAYSIZE 264
+%token <ival> rpc_NUM 265
+%token <strval> rpc_VOID 266
+%token <ival> rpc_CHAR 267
+%token <ival> rpc_INT 268
+%token <ival> rpc_SINT 269
+%token <ival> rpc_UINT 270
+%token <ival> rpc_INT8 271
+%token <ival> rpc_INT16 272
+%token <ival> rpc_INT32 273
+%token <ival> rpc_INT64 274
+%token <ival> rpc_UINT8 275
+%token <ival> rpc_UINT16 276
+%token <ival> rpc_UINT32 277
+%token <ival> rpc_UINT64 278
+%token <ival> rpc_FLOAT 279
+%token <ival> rpc_DOUBLE 280
+%token <ival> rpc_STRING 281
+%token <ival> rpc_USER_DEFINED 282
+%token <ival> rpc_UNKNOWN 283
+
+/*---------------------------------------------------------------------------*/
+/* Grammar rule */
+/*---------------------------------------------------------------------------*/
+%%
+input: includes funcdefs
+;
+
+includes: /* empty input */
+ | includes include
+;
+
+include: rpc_INCLUDE '<' rpc_NAME_DOT '>'
+ { AddHeader($3); free_string($3); }
+;
+
+funcdefs: funcdef
+ | funcdefs funcdef
+;
+
+funcdef: RPC_RESULT rpc_NAME '(' args ')' ';'
+ { process_function($2); free_string($2);}
+;
+
+args: rpc_VOID
+ | nonvoid_args
+;
+
+nonvoid_args: arg
+ | nonvoid_args ',' arg
+;
+
+arg: var_type rpc_NAME
+ {
+ if (push_function_arg(var_type, num_of_bytes, is_pointer,
+ is_vararray, is_array_size,
+ var_type_name, in_out, $2) < 0) {
+ YYERROR;
+ }
+ if (var_type_name) { free_string(var_type_name); }
+ var_type_name = NULL;
+ free_string($2);
+ }
+ | var_type
+ {
+ if (push_function_arg(var_type, num_of_bytes, is_pointer,
+ is_vararray, is_array_size,
+ var_type_name, in_out, NULL) < 0) {
+ YYERROR;
+ }
+ if (var_type_name) { free_string(var_type_name); }
+ var_type_name = NULL;
+ }
+;
+
+/*
+ * Standard IN pointers are not allowed.
+ * When used as an array address, it is not clear how many bytes to copy.
+ * ->You are asked to declare the type and pass the address.
+ * Otherwise, you can simply pass it by value.
+ */
+var_type: var_primitive_type /* INT8, .. DOUBLE */
+ { is_pointer = 0; is_vararray = 0; is_array_size = 0; in_out =RPC_IN_ARG; }
+ | var_primitive_type '*' /* OUT INT8 *, ... OUT DOUBLE * */
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_OUT_ARG; }
+ /* if allow primitive IN pointer
+ | rpc_CONST var_primitive_type '*'
+ { is_pointer = 1; in_out = RPC_IN_ARG; }
+ */
+ | var_string_type
+ /* OUT STRING128, ... */
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_OUT_ARG; }
+ | rpc_CONST var_string_type
+ /* IN STRING128, ... */
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_IN_ARG; }
+ | var_user_defined_type
+ { is_pointer = 0; is_vararray = 0; is_array_size = 0; in_out = RPC_IN_ARG; }
+ | var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_OUT_ARG; }
+ | rpc_CONST var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_IN_ARG; }
+
+ /* INOUT specification */
+ | rpc_INOUT var_string_type
+ /* IN STRING128, ... */
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_INOUT_ARG; }
+ | rpc_INOUT var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_INOUT_ARG; }
+
+ /* Variable-length arrays */
+ | rpc_CONST rpc_VARARRAY var_primitive_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_IN_ARG; }
+ | rpc_VARARRAY var_primitive_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_OUT_ARG; }
+ | rpc_INOUT rpc_VARARRAY var_primitive_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_INOUT_ARG; }
+ | rpc_CONST rpc_VARARRAY var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_IN_ARG; }
+ | rpc_VARARRAY var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_OUT_ARG; }
+ | rpc_INOUT rpc_VARARRAY var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_INOUT_ARG; }
+
+ /* Variable length array size */
+ | rpc_ARRAYSIZE var_primitive_type
+ { is_pointer = 0; is_vararray = 0; is_array_size = 1; in_out = RPC_IN_ARG; }
+;
+
+var_primitive_type:
+ rpc_CHAR { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_INT { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_SINT { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_UINT { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_INT8 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_UINT8 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_INT16 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_UINT16 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_INT32 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_UINT32 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_INT64 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_UINT64 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_FLOAT { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_DOUBLE { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+;
+
+var_string_type: rpc_STRING rpc_NUM
+ { var_type = $1; num_of_bytes = $2; var_type_name = NULL; }
+;
+
+var_user_defined_type: rpc_NAME
+ { var_type = rpc_USER_DEFINED; num_of_bytes = 0; var_type_name = $1; }
+;
+
+%%
+
+/*---------------------------------------------------------------------------*/
+/* C additional code */
+/*---------------------------------------------------------------------------*/
+/* Including an older bison results in an error */
+/*#include "apidef.tab.h"*/
+
+#include <unistd.h>
+#include <assert.h>
+#include <string.h>
+/*
+ * YACC/Lex interface functions/variables
+ */
+extern int yydebug; /* for YACC debug */
+extern int yyparse(void);
+extern FILE *yyin;
+extern int yy_flex_debug; /* for FLEX debug */
+/* my own function to free the buffer flex allocates */
+extern void free_flex_buffer(void);
+
+#ifdef DBG_ENABLE
+char rpc_log_enable;
+#endif
+
+/**/
+static void
+AddHeader(const char *filename)
+{
+ ApidefAddHeader(filename);
+}
+
+static int
+push_function_arg(int arg_type, int num_of_bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out, const char *var_name)
+{
+ switch(arg_type) {
+ case rpc_CHAR:
+ case rpc_INT:
+ case rpc_SINT:
+ case rpc_UINT:
+ case rpc_INT8:
+ case rpc_INT16:
+ case rpc_INT32:
+ case rpc_INT64:
+ case rpc_UINT8:
+ case rpc_UINT16:
+ case rpc_UINT32:
+ case rpc_UINT64:
+ case rpc_FLOAT:
+ case rpc_DOUBLE:
+ case rpc_STRING:
+ case rpc_USER_DEFINED:
+ return ApidefPushFunctionArg(arg_type, num_of_bytes, is_pointer,
+ is_vararray, is_array_size,
+ var_type_name, in_out, var_name);
+ break;
+
+ default:
+ return -1;
+ break;
+ }
+}
+
+static void
+process_function(const char *funcname)
+{
+ ApidefProcessFunction(funcname);
+}
+
+static void
+free_string(char *s)
+{
+#ifdef DEBUG
+ fprintf(stderr, "freed %s\n", s);
+#endif
+ free(s);
+}
+
+static void
+extract_id(const char *filename, char **id)
+{
+ char *dotapi;
+ char *slash;
+ const char *start;
+
+ if (id == NULL) {
+ return;
+ }
+ dotapi = strrchr(filename, '.');
+ if (dotapi == NULL) {
+ return;
+ }
+ if (strcmp(dotapi, ".api")) {
+ return;
+ }
+
+ slash = strrchr(filename, '/');
+ start = filename;
+ if (slash != NULL) {
+ start = slash + 1;
+ }
+
+ *id = malloc((size_t)(dotapi - start + 1));
+ if (*id == NULL) {
+ return;
+ }
+ strncpy(*id, start, (size_t)(dotapi - start));
+ (*id)[dotapi - start] = '\0';
+}
+
+static void
+usage(const char *prog)
+{
+ fprintf(stdout,
+ "How to use: %s [CPPFLAGS] ... API definition file name\n",
+ prog);
+ fprintf(stdout, "Examples1: %s XXX.api\n", prog);
+ fprintf(stdout, "Examples2: %s -DSOME_DEFINES XXX.api\n", prog);
+}
+
+#define CPP_PROG "cpp"
+static void free_cpp_argv(char **argv);
+
+static char **
+prepare_cpp_argv(int argc, char *argv[])
+{
+ char **cpp_argv;
+ char **ret;
+
+ cpp_argv = malloc(sizeof(char *) * (long unsigned int)(argc+1));
+ if (cpp_argv == NULL) {
+ return NULL;
+ }
+ memset(cpp_argv, 0, sizeof(char *) * (long unsigned int)(argc+1));
+ ret = cpp_argv;
+
+ cpp_argv[0] = malloc(strlen(CPP_PROG)+1);
+ if (cpp_argv[0] == NULL) {
+ free_cpp_argv(ret);
+ return NULL;
+ }
+ strcpy(cpp_argv[0], CPP_PROG);
+ cpp_argv++;
+
+ for( ; *argv != NULL ; argv++, cpp_argv++) {
+ *cpp_argv = malloc(strlen(*argv)+1);
+ if (*cpp_argv == NULL) {
+ free_cpp_argv(ret);
+ return NULL;
+ }
+ strcpy(*cpp_argv, *argv);
+ }
+ *cpp_argv = NULL;
+ return ret;
+}
+
+static void
+free_cpp_argv(char **argv)
+{
+ char **orig; orig = argv;
+ while(*argv != NULL) {
+ free(*argv);
+ argv++;
+ }
+ free(orig);
+}
+
+/** @ingroup RPCtool
+ * @brief RPCtool main functions
+ *
+ * Perform the following processing.
+ *
+ * - Lexical context analysis of the API definition file(See apidef.y and apidef.l)
+ * - The API function definition read from the definition file is stored in the APIDef class.
+ * - Outputs stub and header files from function definitions stored in APIDef after a successful read
+ */
+int
+main(int argc, char *argv[])
+{
+ int start;
+ char **cpp_argv;
+ int pipefd[2];
+ int pid;
+ int ret;
+
+ if (argc < 2) {
+ usage(argv[0]);
+ return 1;
+ }
+
+ start = 1;
+ yy_flex_debug = 0;
+
+ if (!strcmp(argv[1], "-d")) {
+ yydebug=1;
+ yy_flex_debug = 1;
+ if (argc > 2) {
+ start++;
+ } else {
+ usage(argv[0]);
+ return 1;
+ }
+ }
+
+#ifdef DBG_ENABLE
+ /*
+ * If the second-to-last argument is a log specification
+ */
+ if ( ( argc >= 2 ) && (!strcmp(argv[argc-2], "-log")) ) {
+ rpc_log_enable = 1;
+ } else {
+ rpc_log_enable = 0;
+ }
+#endif
+
+ /*
+ * Extract ID from last argument (API definition file name)
+ */
+ {
+ char *moduleid;
+ moduleid = NULL;
+ extract_id(argv[argc-1], &moduleid);
+ if (moduleid == NULL) {
+ fprintf(stdout, "%s: The API definition file name is invalid.\n", argv[0]);
+ usage(argv[0]);
+ return 1;
+ }
+ ApidefDefineId(moduleid);
+ free(moduleid);
+ }
+
+ /*
+ * Preparing options to exec CPPs
+ */
+ cpp_argv = prepare_cpp_argv(argc, argv + start);
+ if (cpp_argv == NULL) {
+ printf("No Memory!\n");
+ return 1;
+ }
+
+#define PIPE_READ 0
+#define PIPE_WRITE 1
+
+ if (pipe(pipefd) != 0) {
+ perror("pipe");
+ return 1;
+ }
+
+ pid = fork();
+ if (pid < 0) {/* fork error */
+ close(pipefd[PIPE_READ]);
+ close(pipefd[PIPE_WRITE]);
+ perror("fork");
+ return 1;
+ }
+ if (pid == 0) {/* child process */
+ int must_be_1;
+ /*
+ * force stdout to be pipefd[PIPE_WRITE]
+ */
+ close(pipefd[PIPE_READ]);
+ close(1);
+ must_be_1 = dup(pipefd[PIPE_WRITE]);
+ assert(must_be_1 == 1);
+ close(pipefd[PIPE_WRITE]);
+ /*
+ * invoke C preprocessor with flags
+ */
+ execvp(CPP_PROG, cpp_argv);
+ perror("execvp");
+ exit(0);
+ } else {
+ /*
+ * parent process
+ */
+ int must_be_0;
+ free_cpp_argv(cpp_argv);
+
+ /*
+ * force stdin to be pipefd[PIPE_READ]
+ */
+ close(pipefd[PIPE_WRITE]);
+ close(0);
+ must_be_0 = dup(pipefd[PIPE_READ]);
+ assert(must_be_0 == 0);
+ close(pipefd[PIPE_READ]);
+ }
+
+ ret = yyparse();
+
+ free_flex_buffer();
+
+ if (ret == 0) {/* Parsed successfully */
+ //ApidefListFunctions(1);
+ ApidefMakeStubs();
+ } else {/* Parse error occurred */
+ fputs("The APIs that have been analyzed so far are as follows.\n", stdout);
+ fputs("-----start-----\n", stdout);
+ ApidefListFunctions(0);
+ fputs("------end------\n", stdout);
+ fputs("Check this API definition\n", stdout);
+ }
+ ApidefFreeAllocation();
+
+ return ret;
+}
+
+int
+yyerror(const char *s)
+{
+ printf("\nError: %s\n", s);
+ return 0;
+}
+
+int
+yywrap()
+{
+ return 1;
+}
+
+static char const *Types[] = {
+ "char",
+ "int",
+ "signed int",
+ "unsigned int",
+ "INT8",
+ "INT16",
+ "INT32",
+ "INT64",
+ "UINT8",
+ "UINT16",
+ "UINT32",
+ "UINT64",
+ "float",
+ "double",
+ "char *",
+};
+
+static const int TypeCodes[] = {
+ rpc_CHAR,
+ rpc_INT,
+ rpc_SINT,
+ rpc_UINT,
+ rpc_INT8,
+ rpc_INT16,
+ rpc_INT32,
+ rpc_INT64,
+ rpc_UINT8,
+ rpc_UINT16,
+ rpc_UINT32,
+ rpc_UINT64,
+ rpc_FLOAT,
+ rpc_DOUBLE,
+ rpc_STRING,
+};
+
+const char *
+TypeCodeString(const int code)
+{
+ int i;
+ int num;
+ num = sizeof(TypeCodes) / sizeof(int);
+
+ for(i = 0 ; i < num ; i++) {
+ if (code == TypeCodes[i]) {
+ return Types[i];
+ }
+ }
+ return NULL;
+}
+
+int
+IsTypeCodeNumeric( const int code )
+{
+ int i;
+
+ for(i = 0 ; i < sizeof(TypeCodes) / sizeof(TypeCodes[0]) ; i++) {
+ if (TypeCodes[i] == rpc_FLOAT) {
+ break;
+ }
+ if (code == TypeCodes[i]) {
+ return 1;
+ }
+ }
+ return 0;
+}
diff --git a/otherservice/rpc_library/tool_for_arm/Makefile b/otherservice/rpc_library/tool_for_arm/Makefile
new file mode 100755
index 0000000..67121b4
--- /dev/null
+++ b/otherservice/rpc_library/tool_for_arm/Makefile
@@ -0,0 +1,50 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+all test: apidef.tab.h
+
+clean:
+ rm -rf $(CLEAN_FILES)
+
+YACC := bison
+YFLAGS := -d -t
+
+VPATH += ../tool
+CPPFLAGS += -I../tool
+OUTPUTDIR += ../tool
+
+apidef.tab.h apidef.tab.c: apidef.y
+ cd ../tool; $(YACC) $(YFLAGS) $<
+
+CLEAN_FILES := ../tool/apidef.tab.h ../tool/apidef.tab.c
+
+CLEAN_TARGET := clean-test clean-all clean-all-test \
+clean-self clean-self-test clean-all-sub clean-self-sub #comment out for make clean errorclean-sub
+
+EMPTY_TARGET := install-test build-lib build-prog build-shlib build-arlib \
+build-test-mock-lib build-test-mock-arlib build-test-mock-shlib build-cfg \
+install install-header install-test-mock-header install-test-casename install-lib \
+install-shlib install-arlib install-prog install-data install-cfg install-preload
+
+
+.PHONY: all install test clean $(CLEAN_TARGET) $(EMPTY_TARGET)
+
+$(CLEAN_TARGET): clean
+
+$(EMPTY_TARGET):
+
+
+include ../../other_service.mk
diff --git a/otherservice/vehicle_parameter_library/LICENSE b/otherservice/vehicle_parameter_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/otherservice/vehicle_parameter_library/Makefile.client b/otherservice/vehicle_parameter_library/Makefile.client
new file mode 100755
index 0000000..172da8f
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/Makefile.client
@@ -0,0 +1,18 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+SUBDIRS := library
+
+include ../other_service.mk
diff --git a/otherservice/vehicle_parameter_library/library/Makefile b/otherservice/vehicle_parameter_library/library/Makefile
new file mode 100755
index 0000000..ae99cfa
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/Makefile
@@ -0,0 +1,40 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+INST_SHLIBS = libvp
+
+VPATH = ./src ./include/$(COMPONENT_NAME)
+
+INST_HEADERS = VP_GetEnv.h env_vehicle.h \
+ env_vehicleparameterlibrary.h env_vehicleparameterlibrary_serial.h env_ext.h \
+ VP_FuncCheck_CanRcv.h vehicle_parameter_library.h
+
+libvp_SRCS = VP_FuncCheck_CanRcv.c VP_GetEnv.c
+
+LDLIBS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lns_backup
+
+CPPFLAGS += -I./include
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wpointer-to-int-cast
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+CPPFLAGS += -DVP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE
+
+include ../../other_service.mk
diff --git a/otherservice/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h b/otherservice/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h
new file mode 100755
index 0000000..193e54a
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h
@@ -0,0 +1,90 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* ====================================================================== */
+/**
+ * @file VP_FuncCheck_CanRcv_private.h
+ * @brief Get function existence API internal header file
+ * @attention Cannot be included from external functions
+ *
+ * Exported because it will be inconvenient at MT
+ */
+/* ====================================================================== */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_VP_FUNCCHECK_CANRCV_PRIVATE_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_VP_FUNCCHECK_CANRCV_PRIVATE_H_
+
+/* ====================================================================== */
+/* Include public headers */
+/* ====================================================================== */
+#include <other_service/VP_FuncCheck_CanRcv.h>
+
+/* ====================================================================== */
+/* Internal definitions for debugging */
+/* ====================================================================== */
+#ifdef DEBUG_MT
+ #include <stdio.h>
+
+ #define MT_STATIC /**< Static definitions - Remove the static in order to remove the file scope at MT. */
+
+ /**< Debugging output function - Compile the entity at MT */
+ #define DEBUG_PRINT(msg) {printf("%s\n", (msg) ) ;}
+ /**< Debugging output function - Compile the entity at MT */
+ #define DEBUG_PRINTF(format, msg) {printf((format), (msg) ) ;}
+
+ /**< Static assertion */
+ #define VP_DEBUG_STATIC_ASSERT(expr) do { int static_assert[ (expr)? 1:-1 ]; }while(0);
+#else
+ /**< Static definitions. The scope shall be limited by static at the time of releasing.
+ * Remove the static in order to remove the file scope at MT.
+ */
+ #define MT_STATIC static
+
+ /**< Static definitions. The scope shall be limited by static at the time of releasing.
+ * Remove the static in order to remove the file scope at MT.
+ */
+ #define DEBUG_PRINT(msg)
+
+ /**< Static definitions. The scope shall be limited by static at the time of releasing.
+ * Remove the static in order to remove the file scope at MT.
+ */
+ #define DEBUG_PRINTF(format, msg)
+
+ /**< Static definitions. The scope shall be limited by static at the time of releasing.
+ * Remove the static in order to remove the file scope at MT.
+ */
+ #define VP_DEBUG_STATIC_ASSERT(expr)
+#endif
+
+/* ====================================================================== */
+/* General-purpose type definition - Redifined for internal use */
+/* ====================================================================== */
+/**< Internal boolean type - sys/type.h has no type definitions, so defined it here. FCCR: "F"unc"C"heck_"C"an"R"cv */
+typedef enum VP_FCCR_BOOL_Tag {
+ B_FALSE, /**< FALSE */
+ B_TRUE /**< TRUE */
+} VP_FCCR_BOOL;
+
+
+/* ====================================================================== */
+/* Structure */
+/* ====================================================================== */
+typedef struct TABLE_INDEX_INFO_tag {
+ char* code_str; /**< String that can be gotten from vehicle parameters */
+ unsigned int index; /**< Index for function existence */
+} TABLE_INDEX_INFO;
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_VP_FUNCCHECK_CANRCV_PRIVATE_H_
diff --git a/otherservice/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h b/otherservice/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h
new file mode 100755
index 0000000..17b4503
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h
@@ -0,0 +1,133 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* ====================================================================== */
+/**
+ * @file VP_FuncCheck_CanRcv.h
+ * @brief \~english Get function existence API header file
+ */
+/* ====================================================================== */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_FUNCCHECK_CANRCV_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_FUNCCHECK_CANRCV_H_
+
+#include <sys/types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+
+// typedef unsigned char u_int8;
+
+
+/**
+* @~english XM Audio
+*/
+#define XM_AUDIO ((u_int8_t)1)
+/**
+* @~english _CWORD76_
+*/
+#define _CWORD76_ ((u_int8_t)2)
+
+#define VP_CANRCV__CWORD27_ ((u_int8_t)3) /**< _CWORD27_ */
+/**
+* @~english WiFi HotSpot
+*/
+#define WIFI_HOTSPOT ((u_int8_t)4)
+/**
+* @~english standard driving rregulation of AREA1
+*/
+#define AREA1_STD_TRAF_LIMIT ((u_int8_t)5)
+/**
+* @~english HD Data (Include traffic)
+*/
+#define HD_DATA ((u_int8_t)6)
+/**
+* @~english WiFi 5G
+*/
+#define WIFI_5G ((u_int8_t)7)
+
+/**
+* @~english definiton of return value of API(VP_FuncCheck_CanRcv),which is used to get status of function implemention
+*/
+#define FUNCTION_CHECK_RESULT_OK ((u_int8_t)0)
+/**
+* @~english this function is invalid
+*/
+#define FUNCTION_CHECK_RESULT_NG ((u_int8_t)1)
+/**
+* @~english this function does not exist
+*/
+#define FUNCTION_CHECK_RESULT_UNKNOWN ((u_int8_t)2)
+/**
+* @~english reference out of AREA1
+*/
+#define FUNCTION_CHECK_RESULT_OUT_OF_AREA1 ((u_int8_t)3)
+
+/* Function prototype declaration */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup VP_FuncCheck_CanRcv
+/// \~english @par Brief
+/// VP_FuncCheck_CanRcv
+/// \~english @param [in] FunctionName
+/// function name
+/// \~english @retval FUNCTION_CHECK_RESULT_OK: This function is available
+/// \~english @retval FUNCTION_CHECK_RESULT_NG: This function is unavailable
+/// \~english @retval FUNCTION_CHECK_RESULT_UNKNOWN: This function does not exist
+/// \~english @retval FUNCTION_CHECK_RESULT_OUT_OF_AREA1: reference out of Area1
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - To get the function check result from
+/// - vehicle parameter:CAN info judge
+/// - vehicle parameter:country ID
+/// - country ID and function judge info in API
+/// - When vehicle parameter:CAN info judge
+/// is [CAN_judge] or [country_ID],
+/// and if country_ID is unacquainted or undefined, the API returns [available].
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+u_int8_t VP_FuncCheck_CanRcv(u_int8_t FunctionName);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_FUNCCHECK_CANRCV_H_
diff --git a/otherservice/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h b/otherservice/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h
new file mode 100755
index 0000000..69f6df2
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h
@@ -0,0 +1,114 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* ====================================================================== */
+/**
+ * @file VP_GetEnv.h
+ * @brief \~english Get vehicle parameter environment variable API header file
+ */
+/* ====================================================================== */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_GETENV_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_GETENV_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+#include <other_service/env_ext.h>
+
+/**
+* @~english the max length of vehicle parameter environment viarable
+*/
+
+#define VP_MAX_LENGTH 128
+
+/**
+* @~english definition of parameter environment viarable such as destination
+* destination diff
+*/
+
+#define VEHICLEPARAMETERLIBRARY_AREA "VEHICLEPARAMETERLIBRARY_AREA"
+
+/**
+* @~english brand diff
+*/
+#define VEHICLEPARAMETERLIBRARY_BRAND "VEHICLEPARAMETERLIBRARY_BRAND"
+
+/**
+* @~english definition of _CWORD31_ vehicle parameter environment viarable
+*/
+#include <other_service/env_vehicle.h>
+
+/**
+* @~english definition of vehicle parameter environment viarable
+*/
+#include <other_service/env_vehicleparameterlibrary.h>
+
+/**
+* @~english definition of Serial vehicle parameter environment viarable
+*/
+#include <other_service/env_vehicleparameterlibrary_serial.h>
+
+/* Function prototype declaration */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup VP_GetEnv
+/// \~english @par Brief
+/// VP_GetEnv
+/// \~english @param [in] pEnvStr
+/// The pointer of environment variable name string
+/// \~english @param [out] pEnvBuff
+/// The head address of saving environment variable value
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - To get the environment variable value by the environment variable name,
+/// and save it in pEnvBuff.
+/// - When environment variable name is NULL or an undefined value,
+/// a blank string shall be saved in pEnvBuff.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+void VP_GetEnv(const char *pEnvStr, char *pEnvBuff);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_GETENV_H_
diff --git a/otherservice/vehicle_parameter_library/library/include/other_service/env_ext.h b/otherservice/vehicle_parameter_library/library/include/other_service/env_ext.h
new file mode 100755
index 0000000..266e510
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/include/other_service/env_ext.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file env_ext.h
+ * @brief \~english Define of supplier vehicle parameter environment variable.
+ */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_EXT_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_EXT_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+
+//
+// Please describe supplier-specific definitions of the vehicle parameters.
+//
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_EXT_H_
diff --git a/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicle.h b/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicle.h
new file mode 100755
index 0000000..a0eaaf9
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicle.h
@@ -0,0 +1,331 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file env_vehicle.h
+ * @brief \~english Define of _CWORD31_ vehicle parameter environment variable
+ */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLE_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLE_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+
+/**
+* @~english _CWORD31_ version
+*/
+#define VP__CWORD31__VERSION "VP__CWORD31__version"
+/**
+* @~english _CWORD31_ class type of LAN
+*/
+
+#define VP__CWORD31__CLASS_TYPE_OF_LAN "VP__CWORD31__class_type_of_LAN"
+/**
+* @~english _CWORD31_ reverse signal
+*/
+
+#define VP__CWORD31__REVERSE "VP__CWORD31__reverse"
+/**
+* @~english _CWORD31_ PKB signal
+*/
+
+#define VP__CWORD31__PKB "VP__CWORD31__PKB"
+/**
+* @~english _CWORD31_ ADIM signal of _CWORD62_
+*/
+
+#define VP__CWORD31__ADIM__CWORD62_ "VP__CWORD31__ADIM__CWORD62_"
+/**
+* @~english _CWORD31_ telematics function
+*/
+
+#define VP__CWORD31__TELEMATICS_FUNCTION "VP__CWORD31__telematics_function"
+/**
+* @~english _CWORD31_ opening picture
+*/
+
+#define VP__CWORD31__OPENING_PICTURE "VP__CWORD31__opening_picture"
+/**
+* @~english _CWORD31_ theme color
+*/
+
+#define VP__CWORD31__THEME_COLOR "VP__CWORD31__theme_color"
+/**
+* @~english _CWORD31_ vehicle design vehicle body
+*/
+#define VP__CWORD31__VEHICLE_BODY "VP__CWORD31__vehicle_body"
+/**
+* @~english _CWORD31_ air conditioner on screen
+*/
+#define VP__CWORD31__AC_ONSCREEN "VP__CWORD31__AC_onscreen"
+/**
+* @~english _CWORD31_ air conditioner screen operation
+*/
+#define VP__CWORD31__AC_SCREEN_OPERATION "VP__CWORD31__AC_screen_operation"
+/**
+* @~english _CWORD31_ air conditioner home screen
+*/
+#define VP__CWORD31__AC_SCREEN_HOME "VP__CWORD31__AC_screen_home"
+/**
+* @~english _CWORD31_ air conditioner switch concierge
+*/
+#define VP__CWORD31__AC_SWITCH_CONCIERGE "VP__CWORD31__AC_switch_concierge"
+/**
+* @~english _CWORD31_ _CWORD113_
+*/
+#define VP__CWORD31___CWORD11_ "VP__CWORD31___CWORD11_"
+/**
+* @~english _CWORD31_ EF home screen
+*/
+#define VP__CWORD31___CWORD11__HOME "VP__CWORD31___CWORD11__home"
+/**
+* @~english _CWORD31_ drive wheel of _CWORD113_
+*/
+#define VP__CWORD31___CWORD11__DRIVE_WHEEL "VP__CWORD31___CWORD11__drive_wheel"
+/**
+* @~english _CWORD31_ drive type of _CWORD113_
+*/
+#define VP__CWORD31___CWORD11__DRIVE_TYPE "VP__CWORD31___CWORD11__drive_type"
+/**
+* @~english _CWORD31_ battery position of _CWORD113_
+*/
+#define VP__CWORD31___CWORD11__BATTERY_POSITION "VP__CWORD31___CWORD11__battery_position"
+/**
+* @~english _CWORD31_ _CWORD112_ trip
+*/
+#define VP__CWORD31___CWORD9__TRIP "VP__CWORD31___CWORD9__trip"
+/**
+* @~english _CWORD31_ FC home screen trip
+*/
+#define VP__CWORD31___CWORD9__HOME_TRIP "VP__CWORD31___CWORD9__home_trip"
+/**
+* @~english _CWORD31_ _CWORD112_ fuel
+*/
+#define VP__CWORD31___CWORD9__FUEL "VP__CWORD31___CWORD9__fuel"
+/**
+* @~english _CWORD31_ FC home screen fuel
+*/
+#define VP__CWORD31___CWORD9__HOME_FUEL "VP__CWORD31___CWORD9__home_fuel"
+/**
+* @~english _CWORD31_ FC eco safety point service
+*/
+#define VP__CWORD31__FC_ECO_SAFETY_POINT_SERVICE "VP__CWORD31__FC_eco_safety_point_service"
+/**
+* @~english _CWORD31_ FC GAS scale
+*/
+#define VP__CWORD31__FC_SCALE_GAS "VP__CWORD31__FC_scale_GAS"
+/**
+* @~english _CWORD31_ FC HV scale
+*/
+#define VP__CWORD31__FC_SCALE_HV "VP__CWORD31__FC_scale_HV"
+/**
+* @~english _CWORD31_ fuel consumption display function scale of fuel consumption (ForFC)
+*/
+#define VP__CWORD31__FC_SCALE_FC "VP__CWORD31__FC_scale_FC"
+/**
+* @~english _CWORD31_ fuel consumption display function scale of fuel consumption (ForEV)
+*/
+#define VP__CWORD31__FC_SCALE_EV "VP__CWORD31__FC_scale_EV"
+/**
+* @~english _CWORD31_ FC energy mark
+*/
+#define VP__CWORD31__FC_ENERGY_MARK "VP__CWORD31__FC_energy_mark"
+/**
+* @~english _CWORD31_ _CWORD112_ type
+*/
+#define VP__CWORD31___CWORD9__TYPE "VP__CWORD31___CWORD9__type"
+/**
+* @~english _CWORD31_ FC signal
+*/
+#define VP__CWORD31__FC_SIGNAL "VP__CWORD31__FC_SIGNAL"
+/**
+* @~english _CWORD31_ display setting screen
+*/
+#define VP__CWORD31__DISPLAY_SETTING_SCREEN "VP__CWORD31__display_setting_screen"
+/**
+* @~english _CWORD31_ clock type
+*/
+#define VP__CWORD31__CLOCK_TYPE "VP__CWORD31__clock_type"
+/**
+* @~english _CWORD31_ start up BGM
+*/
+#define VP__CWORD31__START_UP_BGM "VP__CWORD31__start_up_BGM"
+/**
+* @~english _CWORD31_ start up BGM type
+*/
+#define VP__CWORD31__START_UP_BGM_TYPE "VP__CWORD31__start_up_BGM_type"
+/**
+* @~english _CWORD31_ font left DTV antenna
+*/
+#define VP__CWORD31__DTV_ANTENNA_FL "VP__CWORD31__DTV_antenna_FL"
+/**
+* @~english _CWORD31_ font right DTV antenna
+*/
+#define VP__CWORD31__DTV_ANTENNA_FR "VP__CWORD31__DTV_antenna_FR"
+/**
+* @~english _CWORD31_ rear left DTV antenna
+*/
+#define VP__CWORD31__DTV_ANTENNA_RL "VP__CWORD31__DTV_antenna_RL"
+/**
+* @~english _CWORD31_ rear right DTV antenna
+*/
+#define VP__CWORD31__DTV_ANTENNA_RR "VP__CWORD31__DTV_antenna_RR"
+/**
+* @~english _CWORD31_ DTV antenna
+*/
+#define VP__CWORD31__DTV_ANTENNA "VP__CWORD31__DTV_antenna"
+/**
+* @~english _CWORD31_ antenna info antenna available / unavailable
+*/
+#define VP__CWORD31__BEACON_ANTENNA "VP__CWORD31__beacon_antenna"
+/**
+* @~english _CWORD31_ HF voice quality type
+*/
+#define VP__CWORD31__HF_VOICE_QUALITY_TYPE "VP__CWORD31__HF_voice_quality_type"
+/**
+* @~english _CWORD31_ DAB antenna
+*/
+#define VP__CWORD31__DAB_ANTENNA "VP__CWORD31__DAB_antenna"
+/**
+* @~english _CWORD31_ DAB screen display
+*/
+#define VP__CWORD31__DAB_SCREEN "VP__CWORD31__DAB_screen"
+/**
+* @~english _CWORD31_ hard switch beep
+*/
+#define VP__CWORD31__HARD_SWITCH_BEEP "VP__CWORD31__hard_switch_beep"
+/**
+* @~english _CWORD31_ beep while hard SW being pressed
+*/
+#define VP__CWORD31__SCREEN_SWITCH_BEEP "VP__CWORD31__screen_switch_beep"
+/**
+* @~english _CWORD31_ steering SW type of steering SW
+*/
+#define VP__CWORD31__STEERING_SWITCH_TYPE "VP__CWORD31__steering_switch_type"
+/**
+* @~english _CWORD31_ TEL switch of steering
+*/
+#define VP__CWORD31__STEERING_SWITCH_TEL "VP__CWORD31__steering_switch_tel"
+/**
+* @~english _CWORD31_ class circuit mode
+*/
+#define VP__CWORD31__CLASS_CIRCUIT_MODE "VP__CWORD31__class_circuit_mode"
+/**
+* @~english _CWORD31_ panel microcomputer
+*/
+#define VP__CWORD31__PANEL_MICROCOMPUTER "VP__CWORD31__panel_microcomputer"
+/**
+* @~english _CWORD31_ class watch at brake hold
+*/
+#define VP__CWORD31__CLASS_WATCH_AT_BRAKE_HOLD "VP__CWORD31__class_watch_at_brake_hold"
+/**
+* @~english _CWORD31_ GPS antenna
+*/
+#define VP__CWORD31__GPS_ANTENNA "VP__CWORD31__GPS_antenna"
+/**
+* @~english _CWORD31_ ILL- available / unavailable
+*/
+#define VP__CWORD31__ILL_SIGNAL "VP__CWORD31__ILL_signal"
+/**
+* @~english _CWORD31_ switch trigger
+*/
+#define VP__CWORD31__SWITCH_TRIGGER "VP__CWORD31__switch_trigger"
+/**
+* @~english _CWORD31_ sensitivity level
+*/
+#define VP__CWORD31__SENSITIVITY_LEVEL "VP__CWORD31__sensitivity_level"
+/**
+* @~english _CWORD31_ hadsfree bluetooth device name / WiFi AP name selection
+*/
+#define VP__CWORD31__BT_DEVICE_AP_NAME "VP__CWORD31__BT_device_AP_name"
+/**
+* @~english _CWORD31_ Eco drive max vol setting in D4 model
+*/
+#define VP__CWORD31__ECO_RUN_D4_VOL_MAX "VP__CWORD31__eco_run_D4_VOL_max"
+/**
+* @~english _CWORD31_ thumbnail type
+*/
+#define VP__CWORD31__THUMBNAIL_TYPE "VP__CWORD31__thumbnail_type"
+/**
+* @~english _CWORD31_ EOM function
+*/
+#define VP__CWORD31__EOM_FUNCTION "VP__CWORD31__EOM_function"
+/**
+* @~english _CWORD31_ Microphone Type
+*/
+#define VP__CWORD31__MICROPHONE_TYPE "VP__CWORD31__Microphone_Type"
+/**
+* @~english _CWORD31_ Microphone Location
+*/
+#define VP__CWORD31__MICROPHONE_LOCATION "VP__CWORD31__Microphone_Location"
+/**
+* @~english _CWORD31_ VR microphone parameter vehicle noize level
+*/
+#define VP__CWORD31__VEHICLE_NOIZE_LEVEL "VP__CWORD31__vehicle_noize_level"
+
+/**
+* @~english _CWORD31_ wide band FM
+*/
+#define VP__CWORD31__WIDE_BAND_FM "VP__CWORD31__Wide_band_FM"
+/**
+* @~english _CWORD31_ map color
+*/
+#define VP__CWORD31__MAP_COLOR "VP__CWORD31__map_color"
+/**
+* @~english _CWORD31_ cloud eco
+*/
+#define VP__CWORD31__CLOUD_ECO "VP__CWORD31__cloud_eco"
+/**
+* @~english _CWORD31_ eg type
+*/
+#define VP__CWORD31__EG_TYPE "VP__CWORD31__EG_type"
+
+/**
+* @~english _CWORD31_ display type
+*/
+#define VP__CWORD31__DISPLAY_TYPE "VP__CWORD31__display_type"
+/**
+* @~english _CWORD31_ clock display
+*/
+#define VP__CWORD31__CLOCK_DISPLAY "VP__CWORD31__clock_display"
+/**
+* @~english _CWORD31_ destination
+*/
+#define VP__CWORD31__DESTINATION "VP__CWORD31__destination"
+/**
+* @~english _CWORD31_ class operation
+*/
+#define VP__CWORD31__CLASS_OPERATION "VP__CWORD31__class_operation"
+/**
+* @~english _CWORD31_ DES function
+*/
+#define VP__CWORD31__DES_FUNCTION "VP__CWORD31__DES_function"
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLE_H_
diff --git a/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h b/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h
new file mode 100755
index 0000000..1c0020c
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h
@@ -0,0 +1,138 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file env_vehicleparameterlibrary.h
+ * @brief \~english Define of vehicle parameter environment variable
+ */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+
+/**
+* @~english version
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_VERSION "VP_VEHICLEPARAMETERLIBRARY_version"
+/**
+* @~english maker ID
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_MAKER_ID "VP_VEHICLEPARAMETERLIBRARY_maker_ID"
+/**
+* @~english area
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_AREA "VP_VEHICLEPARAMETERLIBRARY_area"
+/**
+* @~english grade
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_GRADE "VP_VEHICLEPARAMETERLIBRARY_grade"
+/**
+* @~english destination country code
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE "VP_VEHICLEPARAMETERLIBRARY_dest_c_code"
+/**
+* @~english DAB tuner number
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_DAB_TUNER_NUM "VP_VEHICLEPARAMETERLIBRARY_DAB_tuner_num"
+/**
+* @~english AM radio
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_AM_RADIO "VP_VEHICLEPARAMETERLIBRARY_AM_Radio"
+/**
+* @~english amp type
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_AMP_TYPE "VP_VEHICLEPARAMETERLIBRARY_AMP_type"
+/**
+* @~english display
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_DISPLAY "VP_VEHICLEPARAMETERLIBRARY_DISPLAY"
+/**
+* @~english touch panel
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_TOUCHPANEL "VP_VEHICLEPARAMETERLIBRARY_TOUCHPANEL"
+/**
+* @~english DECK
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_DECK "VP_VEHICLEPARAMETERLIBRARY_DECK"
+/**
+* @~english JP traffic information show
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_JPTRAFFICINFO_SHOW "VP_VEHICLEPARAMETERLIBRARY_JPTrafficInfo_show"
+/**
+* @~english connection server
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_CONNECTION_SERVER "VP_VEHICLEPARAMETERLIBRARY_CONNECTION_SERVER"
+/**
+* @~english _CWORD40_ generation
+*/
+#define VP_VEHICLEPARAMETERLIBRARY__CWORD40_ "VP_VEHICLEPARAMETERLIBRARY__CWORD40_"
+
+/**
+* @~english Radio reception level
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_RADIO_LV_DIAG "VP_VEHICLEPARAMETERLIBRARY_RADIO_LV_DIAG"
+
+/**
+* @~english Navigation model
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_NAVI "VP_VEHICLEPARAMETERLIBRARY_NAVI"
+
+/**
+* @~english Map update service
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_MAP_UPDATE "VP_VEHICLEPARAMETERLIBRARY_MAP_UPDATE"
+
+/**
+* @~english Headunit identification
+*/
+#define VP_HEAD_UNIT_ID "VP_HEAD_UNIT_ID"
+
+/**
+* @~english Serius raido
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_SDARS "VP_VEHICLEPARAMETERLIBRARY_SDARS"
+
+/**
+* @~english optional amp
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_ACCESSORY_AMP "VP_VEHICLEPARAMETERLIBRARY_ACCESSORY_AMP"
+
+/**
+* @~english Key trace
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_KEY_TRACE "VP_VEHICLEPARAMETERLIBRARY_KEY_TRACE"
+
+/**
+* @~english diatal TV
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_DTV "VP_VEHICLEPARAMETERLIBRARY_DTV"
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_H_
diff --git a/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h b/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h
new file mode 100755
index 0000000..04ae10e
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file env_vehicleparameterlibrary_serial.h
+ * @brief \~english Define of Serial vehicle parameter environment variable
+ */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_SERIAL_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_SERIAL_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+
+/**
+ * \~english Enviroment variable _CWORD49__ID
+ */
+#define VP_VEHICLEPARAMETERLIBRARY_SER__CWORD49__ID "VP_VEHICLEPARAMETERLIBRARY_SER__CWORD49__ID"
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_SERIAL_H_
diff --git a/otherservice/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h b/otherservice/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h
new file mode 100755
index 0000000..151bae5
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file vehicle_parameter_library.h
+ * @brief \~english include all vehicle_parameter_library head files
+ */
+
+#ifndef OTHERSERVICE_VEHICLEPARAMETERLIBRARY_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_VEHICLEPARAMETERLIBRARY_H_ // NOLINT(build/header_guard)
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+#include <other_service/VP_FuncCheck_CanRcv.h>
+#include <other_service/VP_GetEnv.h>
+#include <other_service/env_vehicleparameterlibrary.h>
+#include <other_service/env_vehicleparameterlibrary_serial.h>
+#include <other_service/env_vehicle.h>
+#include <other_service/env_ext.h>
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // OTHERSERVICE_VEHICLEPARAMETERLIBRARY_H_
diff --git a/otherservice/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c b/otherservice/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c
new file mode 100755
index 0000000..938ea7f
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c
@@ -0,0 +1,732 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file VP_FuncCheck_CanRcv.c
+ * @brief Get function existence API
+ */
+
+
+/* ====================================================================== */
+/* Header */
+/* ====================================================================== */
+#include <assert.h>
+#include <string.h>
+#include <regex.h>
+
+#include <other_service/VP_GetEnv.h>
+#include "VP_FuncCheck_CanRcv_private.h"
+
+/* ====================================================================== */
+/* Enumeration types */
+/* ====================================================================== */
+typedef enum VPFuncTableDestIndexTag{
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ VP_FUNC_TABLE_DEST_INDEX_A ,
+ VP_FUNC_TABLE_DEST_INDEX_B ,
+
+ VP_FUNC_TABLE_DEST_INDEX_MAX /**< Number of choices (index maximum value: 1) */
+} VP_FUNC_TABLE_DEST_INDEX;
+
+typedef enum VPFuncTableBrandTag{
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ VP_FUNC_TABLE_BRAND_A,
+ VP_FUNC_TABLE_BRAND_B,
+
+ VP_FUNC_TABLE_BRAND_INDEX_MAX /**< Number of choices (index maximum value: 1) */
+} VP_FUNC_TABLE_BRAND;
+
+typedef enum VPFuncTableGradeLTag{
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ VP_FUNC_TABLE_GRADE_A1,
+ VP_FUNC_TABLE_GRADE_A2,
+
+ VP_FUNC_TABLE_GRADE_A_INDEX_MAX /**< Number of choices (index maximum value: 1) */
+} VP_FUNC_TABLE_GRADE_A;
+
+typedef enum VPFuncTableGradeTTag{
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ VP_FUNC_TABLE_GRADE_B1,
+ VP_FUNC_TABLE_GRADE_B2,
+
+ VP_FUNC_TABLE_GRADE_B_INDEX_MAX /**< Number of choices (index maximum value: 1) */
+} VP_FUNC_TABLE_GRADE_B;
+
+typedef enum VPFuncTableFuncTypeIndexTag{
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN , /**< Unknown function */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_XM_AUDIO , /**< XM Audio */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_VP_CANRCV__CWORD27_ , /**< _CWORD27_ */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_HOTSPOT , /**< Wifi Hotspot */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_RESTRICT_FUNCTION , /**< Travel Restriction */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_HD_DATA , /**< HD Data */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_5G , /**< Wifi 5G */
+
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_MAX /**< Number of choices (index maximum value: 1) */
+} VP_FUNC_TABLE_FUNC_TYPE;
+
+/** Processing definitions for CAN information availability */
+typedef enum CANFuncCheckSwitchTag{
+ CAN_FUNC_CHEK_AVAILABLE ,
+ CAN_FUNC_CHEK_UNAVAILABLE ,
+ CAN_FUNC_CHEK_COUNTRY_CODE
+} CAN_FUNC_CHEK_SWITCH;
+
+
+
+/**< Definition of number of functions (required for initial definition of function availability table) */
+
+#define VP_FUNC_TABLE_FUNCTION_INDEX_MAX ((unsigned int)7)
+
+/* ====================================================================== */
+/* Macro definitions */
+/* ====================================================================== */
+/* Definition for return value from string functions */
+#define RET_STD_LIB_STRING_STR_CMP_OK ((int)0) /**< The return value of the strncmp. this value is returned when matched. */
+
+/* Default index values */
+#define DEFAULT_TABLE_INDEX_DEST (VP_FUNC_TABLE_DEST_INDEX_A) /* Initial value changed by the specification which returns the setting of the belonging property when the undefined country code is gotten. */
+#define DEFAULT_TABLE_INDEX_BRAND (VP_FUNC_TABLE_BRAND_A)
+#define DEFAULT_TABLE_INDEX_GRADE_A (VP_FUNC_TABLE_GRADE_A1)
+#define DEFAULT_TABLE_INDEX_GRADE_B (VP_FUNC_TABLE_GRADE_B1)
+#define DEFAULT_CAN_JUDGE_STATUS (CAN_FUNC_CHEK_COUNTRY_CODE)
+
+/* ====================================================================== */
+/* Constant definitions */
+/* ====================================================================== */
+
+/* ====================================================================== */
+/* Structures */
+/* ====================================================================== */
+
+/* ====================================================================== */
+/* Internal function prototype declarations */
+/* ====================================================================== */
+#ifdef VP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE
+MT_STATIC u_int8_t getResult_CanJudge( unsigned int idx_func );
+MT_STATIC unsigned int getIndexOfFunc( u_int8_t func );
+MT_STATIC unsigned int getIndexOfTable( const char vp_param_str[] , const TABLE_INDEX_INFO table_index_info[] , unsigned int info_size, unsigned int default_index );
+MT_STATIC VP_FCCR_BOOL hasMultipleCoutnry( const char dest_str[] , const char multiple_country_code_desig[] );
+#endif
+/* ====================================================================== */
+/* Public function definitions */
+/* ====================================================================== */
+/**
+ * @fn
+ * u_int8_t VP_FuncCheck_CanRcv( u_int8_t FunctionName )
+ * @brief Get function existence API(Public)
+ * @param[in] (FunctionName) Function Name (Number)
+ * @return FUNCTION_CHECK_RESULT_OK :This function is available
+ * FUNCTION_CHECK_RESULT_NG :This function is unavailable
+ * FUNCTION_CHECK_RESULT_UNKNOWN :This function does not exist
+ * @details Read the function name as feature name specified in the argument, then return one of the
+ * "This function is available"/"This function is unavailable"/"This function does not exist"
+ * of the feature as the following check-result:
+ * - vehicle parameter:CAN information availability(destination package) judge
+ * - vehicle parameter:country code
+ * - Whether or not supported the features corresponding to the country code in this API
+ *
+ * When CAN information availability (destination package) in vehicle parameters is
+ * "Control ON/OFF according to CAN information" or "Country code", return "This function is available"
+ * if this function is called when the country code from CAN is unacquired or undetermined country code.
+ */
+/* ====================================================================== */
+u_int8_t VP_FuncCheck_CanRcv( u_int8_t FunctionName )
+{
+#ifndef VP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE
+ u_int8_t result;
+
+ switch(FunctionName) {
+ case XM_AUDIO:
+ result = FUNCTION_CHECK_RESULT_NG;
+ break;
+
+ case VP_CANRCV__CWORD27_:
+ case WIFI_HOTSPOT:
+ case AREA1_STD_TRAF_LIMIT:
+ case HD_DATA:
+ case WIFI_5G:
+ result = FUNCTION_CHECK_RESULT_OK;
+ break;
+ default:
+ result = FUNCTION_CHECK_RESULT_UNKNOWN;
+ break;
+ }
+
+ return result;
+#else
+
+ /* ====================================================================== */
+ /* Internal table definition */
+ /* ====================================================================== */
+ /** Vehicle Parameter "CAN information Support/Not Support"- processing selector translation table */
+ const TABLE_INDEX_INFO TABLE_STATUS_INFO_CAN_JUDGE[] =
+ {
+ { "available" , CAN_FUNC_CHEK_AVAILABLE }, // Yes
+ { "unavailable" , CAN_FUNC_CHEK_UNAVAILABLE }, // None
+ { "CAN_judge" , CAN_FUNC_CHEK_COUNTRY_CODE }, // Control ON/OFF according to CAN information
+ { "country_ID" , CAN_FUNC_CHEK_COUNTRY_CODE } // Country code
+ };
+
+ /* ====================================================================== */
+ /* Table Size Definition */
+ /* ====================================================================== */
+ const unsigned int LENGTHOF_TABLE_INDEX_INFO_CAN_JUDGE = ( sizeof(TABLE_STATUS_INFO_CAN_JUDGE ) / sizeof( TABLE_INDEX_INFO ) );
+
+ /* ====================================================================== */
+ /* Internal variable declarations */
+ /* ====================================================================== */
+ u_int8_t result = FUNCTION_CHECK_RESULT_UNKNOWN;
+
+ unsigned int idx_func = 0;
+
+ unsigned int can_judge_status = CAN_FUNC_CHEK_COUNTRY_CODE;
+ char VP_canjudge[ VP_MAX_LENGTH ];
+ char VP_area[ VP_MAX_LENGTH ];
+
+ /* ====================================================================== */
+ /* Process */
+ /* ====================================================================== */
+ /* Get vehicle parameter */
+ VP_GetEnv( VEHICLEPARAMETERLIBRARY_AREA , &(VP_area[0]) );
+
+ DEBUG_PRINTF( "AREA = %s; " , VP_area )
+
+ /* Get feature name index */
+ idx_func = getIndexOfFunc( FunctionName );
+
+ DEBUG_PRINTF( "Function = %d; " , FunctionName )
+ DEBUG_PRINTF( "idx_func = %d\n" , idx_func )
+
+ /* Judge as other than area1 because it is not a area1 */
+ if ( strncmp( VP_area, "AREA1", VP_MAX_LENGTH ) != RET_STD_LIB_STRING_STR_CMP_OK )
+ {
+ result = FUNCTION_CHECK_RESULT_OUT_OF_AREA1;
+ }
+ else
+ {
+ /* If the feature is unknown, it is judged to be unknown before checking CAN information. */
+ if ( VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN == idx_func )
+ {
+ result = FUNCTION_CHECK_RESULT_UNKNOWN;
+ }
+ else
+ {
+ /* Get vehicle parameter */ /* It is unnecessary to get the parameter every time, but because there is no process to check the change, it is gotten every time as a precaution. */
+ VP_GetEnv( VP__CWORD31__TELEMATICS_FUNCTION , &(VP_canjudge[0]) );
+
+ /* Choose processing according to CAN information Support/Not Support. */
+ can_judge_status = getIndexOfTable(
+ &(VP_canjudge[0]),
+ &(TABLE_STATUS_INFO_CAN_JUDGE[0]),
+ LENGTHOF_TABLE_INDEX_INFO_CAN_JUDGE,
+ DEFAULT_CAN_JUDGE_STATUS
+ );
+
+ DEBUG_PRINTF( "VP_canjudge = %s; ", VP_canjudge )
+
+ /* When judging from CAN information or country code */
+ if ( CAN_FUNC_CHEK_COUNTRY_CODE == can_judge_status )
+ {
+ DEBUG_PRINT( "CAN judge : C_CODE or CAN_JUDGE" )
+ result = getResult_CanJudge( idx_func );
+ }
+ else
+ {
+ /* For available/unavailable */
+ /* Standard travel restriction of AREA1 */
+ if ( AREA1_STD_TRAF_LIMIT == idx_func )
+ {
+ result = FUNCTION_CHECK_RESULT_OK;
+ }
+ else
+ {
+ switch( can_judge_status )
+ {
+ case CAN_FUNC_CHEK_UNAVAILABLE:
+ DEBUG_PRINT( "CAN judge : UNAVAILABLE" )
+ result = FUNCTION_CHECK_RESULT_NG;
+ break;
+
+ case CAN_FUNC_CHEK_AVAILABLE:
+ default: /* If the default value of canjudge_status are set correctly, the default cannot be selected */
+ DEBUG_PRINT( "CAN judge : AVAILABLE" )
+ result = FUNCTION_CHECK_RESULT_OK;
+ break;
+ }
+ }
+ }
+ }
+ }
+ DEBUG_PRINTF( "RESULT = %d\n", result )
+
+ return result;
+
+#endif
+}
+
+/* ====================================================================== */
+/* Internal function definitions */
+/* ====================================================================== */
+#ifdef VP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE
+/* ====================================================================== */
+/**
+ * @brief Get function existence in consideration of country code
+ * @detials Internal-use functions - Processing when CAN information availability is "Country Code"
+ * @param[in] idx_func Table index corresponding to the feature (takes as its argument the value after conversion to a table index, not the feature name)
+ * @return Availability of the feature in current vehicle parameters
+ */
+/* ====================================================================== */
+MT_STATIC u_int8_t getResult_CanJudge( unsigned int idx_func )
+{
+ /* ====================================================================== */
+ /* Internal constant definition */
+ /* ====================================================================== */
+ static const char MULTIPLE_COUNTRY_CODE_DESIG[] = "^[0-9]{3}(;[0-9]{3})+;{0,1}"; /**< Regular Expression String for Multiple Countries (Attributes). Make sure at least two country codes are stored / delimited */
+
+ /* ====================================================================== */
+ /* Internal table definitions */
+ /* ====================================================================== */
+ /** Feature table index conversion table (country code) */
+ const TABLE_INDEX_INFO TABLE_INDEX_INFO_DESTINATION[] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ { "101" , VP_FUNC_TABLE_DEST_INDEX_A }, // Detination A
+ { "102" , VP_FUNC_TABLE_DEST_INDEX_B } // Detination B
+ };
+
+ /** @todo The consideration. For the feature table by country code, if it can be summarized the GRADE A1/GRADE A2 and GRADE B1/GRADE B2,
+ It can be also summarized the translation table.
+ However, it must be able to guarantee that there are no differences in the table format in L/T. */
+ /** Index Ttranslation Table for feature availability table (for grade A) */
+ const TABLE_INDEX_INFO TABLE_INDEX_INFO_GRADE_A[] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ { "A1" , VP_FUNC_TABLE_GRADE_A1 }, // GRADE A1
+ { "A2" , VP_FUNC_TABLE_GRADE_A2 } // GRADE A2
+ };
+
+ /** Index Translation Table for feature availability table (for grade B) */
+ const TABLE_INDEX_INFO TABLE_INDEX_INFO_GRADE_B[] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ { "B1" , VP_FUNC_TABLE_GRADE_B1 }, // GRADE B1
+ { "B2" , VP_FUNC_TABLE_GRADE_B2 }, // GRADE B2
+ };
+
+ /** Index Translation Table for feature availability table (brand) */
+ const TABLE_INDEX_INFO TABLE_INDEX_INFO_BRAND[] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ { "A" , VP_FUNC_TABLE_BRAND_A }, // BRAND A
+ { "B" , VP_FUNC_TABLE_BRAND_B } // BRAND B
+ };
+
+ /* ====================================================================== */
+ /**
+ * @brief Feature availability table for BRAND A
+ * @details Array of type u_int8_t accessed by the following index
+ */
+ /* ====================================================================== */
+ const u_int8_t VP_FUNC_CHECK_CANRCV_TABLE_A[ VP_FUNC_TABLE_DEST_INDEX_MAX ]
+ [ VP_FUNC_TABLE_GRADE_A_INDEX_MAX ]
+ [ VP_FUNC_TABLE_FUNCTION_INDEX_MAX ] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ /* Destination A */
+ {
+ // Unknown , XM Audio , _CWORD27_ , Wifi HotSpot , Travel Restriction , HD Data Wifi 5G
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE A1
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK } // GRADE A2
+ },
+
+ /* Destination B */
+ {
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE A1
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_NG } // GRADE A2
+ }
+ };
+
+ /* ====================================================================== */
+ /**
+ * @brief Feature availability table for BRAND B
+ */
+ /* ====================================================================== */
+ const u_int8_t VP_FUNC_CHECK_CANRCV_TABLE_B[ VP_FUNC_TABLE_DEST_INDEX_MAX ]
+ [ VP_FUNC_TABLE_GRADE_B_INDEX_MAX ]
+ [ VP_FUNC_TABLE_FUNCTION_INDEX_MAX ] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ /* Destination A */
+ {
+ // Unknown , XM Audio , _CWORD27_ , Wifi HotSpot , Travel Restriction , HD Data , Wifi 5G
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE B1
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK }, // GRADE B2
+ },
+
+ /* Detination B */
+ {
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE B1
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_NG }, // GRADE B2
+ }
+ };
+
+ /* ====================================================================== */
+ /* Table Size Definitions */
+ /* ====================================================================== */
+ const unsigned int SIZE_TABLE_INDEX_INFO_BRAND = ( sizeof(TABLE_INDEX_INFO_BRAND ) / sizeof( TABLE_INDEX_INFO ) );
+ const unsigned int SIZE_TABLE_INDEX_INFO_GRADE_A = ( sizeof(TABLE_INDEX_INFO_GRADE_A ) / sizeof( TABLE_INDEX_INFO ) );
+ const unsigned int SIZE_TABLE_INDEX_INFO_GRADE_B = ( sizeof(TABLE_INDEX_INFO_GRADE_B ) / sizeof( TABLE_INDEX_INFO ) );
+ const unsigned int SIZE_TABLE_INDEX_INFO_DESTINATION = ( sizeof(TABLE_INDEX_INFO_DESTINATION) / sizeof( TABLE_INDEX_INFO ) );
+
+ /* ====================================================================== */
+ /* Variable declarations */
+ /* ====================================================================== */
+ u_int8_t result = FUNCTION_CHECK_RESULT_UNKNOWN;
+
+ VP_FCCR_BOOL isMultipleCountry = B_FALSE;
+
+ unsigned int idx_dest = 0;
+ unsigned int idx_brand = 0;
+ unsigned int idx_grade = 0;
+
+ char VP_destination[ VP_MAX_LENGTH ];
+ char VP_brand[ VP_MAX_LENGTH ];
+ char VP_grade[ VP_MAX_LENGTH ];
+
+ /* ====================================================================== */
+ /* Static assertion */
+ /* ====================================================================== */
+ /* The following are expected to be identical */
+ VP_DEBUG_STATIC_ASSERT( SIZE_TABLE_INDEX_INFO_BRAND == VP_FUNC_TABLE_BRAND_INDEX_MAX )
+ VP_DEBUG_STATIC_ASSERT( SIZE_TABLE_INDEX_INFO_GRADE_A == VP_FUNC_TABLE_GRADE_A_INDEX_MAX )
+
+ /* Country code does not match because there are multiple countries. */
+ VP_DEBUG_STATIC_ASSERT( VP_FUNC_TABLE_DEST_INDEX_MAX > SIZE_TABLE_INDEX_INFO_DESTINATION )
+
+ /* ====================================================================== */
+ /* Process */
+ /* ====================================================================== */
+
+ /* Argument check */
+ if ( VP_FUNC_TABLE_FUNC_TYPE_INDEX_MAX <= idx_func )
+ {
+ DEBUG_PRINTF( "ERROR : tebale index overed idx_func = %d\n", idx_func )
+
+ // Return unknown if the table size is exceeded. (However, this function can be called only from the API at the moment.)
+ result = FUNCTION_CHECK_RESULT_UNKNOWN;
+ }
+ else
+ {
+
+ /* Get vehicle parameter */
+ VP_GetEnv( VP__CWORD31__DESTINATION, &(VP_destination[0]) );
+ VP_GetEnv( VEHICLEPARAMETERLIBRARY_BRAND , &(VP_brand[0]) );
+ VP_GetEnv( VP_VEHICLEPARAMETERLIBRARY_GRADE , &(VP_grade[0]) );
+
+ DEBUG_PRINTF( "VP_destination = %s\n", VP_destination )
+
+ /* Append NULL at the end just in case. (so as not to cause any problems using the strlen or regcomp later) */
+ VP_destination[ VP_MAX_LENGTH - 1 ] = '\0';
+ VP_brand[ VP_MAX_LENGTH - 1 ] = '\0';
+ VP_grade[ VP_MAX_LENGTH - 1 ] = '\0';
+
+ /* Check if the country code is NULL */
+ if ( VP_destination[0] == '\0' )
+ {
+ /* If NULL, set the index for the country code of the US. */
+ idx_dest = VP_FUNC_TABLE_DEST_INDEX_A;
+ DEBUG_PRINTF( "[debug]idx_dest = %d\n", idx_dest )
+ }
+ else
+ {
+ /* Check whether it is a member (multiple countries) */
+ isMultipleCountry = hasMultipleCoutnry( &(VP_destination[0]), &(MULTIPLE_COUNTRY_CODE_DESIG[0]) );
+
+ /* Get the index for a country code */
+ if ( B_TRUE == isMultipleCountry )
+ {
+ /* If it is dependent (multiple countries), set the index for the country code of the dependent */
+ DEBUG_PRINT( "isMultipleCountry = TRUE" )
+
+ idx_dest = VP_FUNC_TABLE_DEST_INDEX_B;
+ }
+ else
+ {
+ /* If it is not dependent (multiple countries), it searches the translation table and sets the index. */
+ DEBUG_PRINT( "isMultipleCountry = FALSE" )
+
+ idx_dest = getIndexOfTable( &(VP_destination[0]), &(TABLE_INDEX_INFO_DESTINATION[0]), SIZE_TABLE_INDEX_INFO_DESTINATION, DEFAULT_TABLE_INDEX_DEST );
+ }
+ }
+ DEBUG_PRINTF( "idx_dest = %d\n", idx_dest )
+
+ /* Get brand index */
+ idx_brand = getIndexOfTable( &(VP_brand[0]) , &(TABLE_INDEX_INFO_BRAND[0]) , SIZE_TABLE_INDEX_INFO_BRAND , DEFAULT_TABLE_INDEX_BRAND );
+
+ /*
+ * Get grade index
+ * Setting Defaults for each brand
+ * e.g. The default is A, so if it is not B, it is determined to be A.
+ */
+ if ( VP_FUNC_TABLE_BRAND_B == idx_brand )
+ {
+ DEBUG_PRINT( "idx_brand = B")
+
+ idx_grade = getIndexOfTable( &(VP_grade[0]) , &(TABLE_INDEX_INFO_GRADE_B[0]) , SIZE_TABLE_INDEX_INFO_GRADE_B , DEFAULT_TABLE_INDEX_GRADE_B );
+
+ /* Table access */
+ result = VP_FUNC_CHECK_CANRCV_TABLE_B[idx_dest][idx_grade][idx_func];
+
+ }
+ else
+ {
+ DEBUG_PRINT( "idx_brand = A")
+
+ idx_grade = getIndexOfTable( &(VP_grade[0]) , &(TABLE_INDEX_INFO_GRADE_A[0]) , SIZE_TABLE_INDEX_INFO_GRADE_A , DEFAULT_TABLE_INDEX_GRADE_A );
+
+ /* Table access */
+ result = VP_FUNC_CHECK_CANRCV_TABLE_A[idx_dest][idx_grade][idx_func];
+
+ }
+
+ //DEBUG_PRINTF( "RESULT = %d\n", result )
+ }
+
+ return result;
+}
+
+
+/* ====================================================================== */
+/**
+ * @brief Feature-Table Index Translation Function
+ * @detials Internal-use functions. It is translate the feature definition number to an index for the table.
+ * @param[in] Feature name defined by the func define
+ * @return The table index corresponding to the feature. If the given country code is invalid, return the index given by default_idx
+ */
+ /* ====================================================================== */
+MT_STATIC unsigned int getIndexOfFunc( u_int8_t func )
+{
+ /* ====================================================================== */
+ /* Internal table definitions */
+ /* ====================================================================== */
+ /** Index translation table for feature table (Features) */
+ const VP_FUNC_TABLE_FUNC_TYPE GET_INDEX_OF_FUNC[] = {
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN , //#define VP_FUNCCHECK_CANRCV_UNKNOWN ((u_int8_t)0) /* Unknown Features */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_XM_AUDIO , //#define XM_AUDIO ((u_int8_t)1) /* XM Audio */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_VP_CANRCV__CWORD27_ , //#define _CWORD27_ ((u_int8_t)3) /* _CWORD27_ */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_HOTSPOT , //#define WIFI_HOTSPOT ((u_int8_t)4) /* WiFi HotSpot */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_RESTRICT_FUNCTION , //#define AREA1_STD_TRAF_LIMIT ((u_int8_t)5) /* Standard Travel Restriction of AREA1 */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_HD_DATA , //#define HD_DATA ((u_int8_t)6) /* HD Data (Include traffic) */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_5G //#define WIFI_5G ((u_int8_t)7) /* WiFi 5G */
+
+ };
+
+
+ /* ====================================================================== */
+ /* Variable declarations */
+ /* ====================================================================== */
+ const unsigned int index_table_size = sizeof( GET_INDEX_OF_FUNC ) / sizeof( VP_FUNC_TABLE_FUNC_TYPE );
+
+ u_int8_t table_index = VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN;
+
+ /* ====================================================================== */
+ /* Static assertions */
+ /* ====================================================================== */
+ /* In the current configuration, the feature's defined value and index match, so the translation table size should also match (remove this assertion if there is no match) */
+ VP_DEBUG_STATIC_ASSERT( index_table_size == VP_FUNC_TABLE_FUNCTION_INDEX_MAX )
+
+ /* Translation tables or the enumeration pair (VP_FUNC_TABLE_FUNC_TYPE) must also be modified when the definition value changes.
+ It may also be changed, added, or deleted following asserts as appropriate according to the defined value. */
+ VP_DEBUG_STATIC_ASSERT( XM_AUDIO == VP_FUNC_TABLE_FUNC_TYPE_INDEX_XM_AUDIO )
+
+ VP_DEBUG_STATIC_ASSERT( VP_CANRCV__CWORD27_ == VP_FUNC_TABLE_FUNC_TYPE_INDEX_VP_CANRCV__CWORD27_ )
+ VP_DEBUG_STATIC_ASSERT( WIFI_HOTSPOT == VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_HOTSPOT )
+ VP_DEBUG_STATIC_ASSERT( AREA1_STD_TRAF_LIMIT == VP_FUNC_TABLE_FUNC_TYPE_INDEX_RESTRICT_FUNCTION )
+ VP_DEBUG_STATIC_ASSERT( HD_DATA == VP_FUNC_TABLE_FUNC_TYPE_INDEX_HD_DATA )
+ VP_DEBUG_STATIC_ASSERT( WIFI_5G == VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_5G )
+
+
+ /* ====================================================================== */
+ /* Process */
+ /* ====================================================================== */
+
+ /* Argument check: Treat as unknown feature if it is larger than index translation table */
+ if ( index_table_size <= func )
+ {
+ table_index = VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN;
+ }
+ else
+ {
+ table_index = (u_int8_t)(GET_INDEX_OF_FUNC[func]);
+ }
+
+ return table_index;
+
+}
+
+/* ====================================================================== */
+/**
+ * @brief Vehicle parameter string to integer conversion function
+ * @detials Internal-use function. Convert the given string (vehicle parameter) into an index for the table.
+ * The value gotten using VP_GetEnv() is assumed. Thus, the maximum length is VP_MAX_LENGTH.
+ * Return the value set in default_index if the conversion is failed.
+ * @param[in] vp_param_str String as source of convetion to the table index
+ * @param[in] table_index_info String corresponding to table index and an array of structs with table indexes set
+ * @param[in] info_size Size of the table_index_info array
+ * @param[in] default_index Default index. Return this value if none of table_index_info matches
+ * @return The table index corresponding to the vehicle parameter string given by the argument. Return the value given by the default_index argument if the given country code is invalid.
+ */
+ /* ====================================================================== */
+MT_STATIC unsigned int getIndexOfTable( const char vp_param_str[], const TABLE_INDEX_INFO table_index_info[], unsigned int info_size, unsigned int default_index )
+{
+ unsigned int table_index = 0;
+
+ table_index = default_index; /* Set as initial value so that it can return the set default if it is unknown */
+
+ //DEBUG_PRINTF("info_size = %d\n", info_size)
+
+ /* NULL checking */
+ if ( NULL != vp_param_str )
+ {
+ if ( NULL != table_index_info )
+ {
+ unsigned int i = 0;
+
+ for ( i = 0; i < info_size; i++ )
+ {
+ if ( RET_STD_LIB_STRING_STR_CMP_OK == strncmp( &(vp_param_str[0]), &((table_index_info[i]).code_str[0]), VP_MAX_LENGTH ) )
+ {
+ table_index = (table_index_info[i]).index;
+
+ break;
+ }
+ }
+ }
+ else
+ {
+ DEBUG_PRINT( "ERROR!! the Bad Teble overd." )
+ }
+ }
+
+ return table_index;
+}
+
+/* ====================================================================== */
+/**
+ * @brief Function to check whether country code is multiple countries or not
+ * @detials Internal-use functions. Check if the country code given in the argument contains more than one country.
+ * The determination whether multiple country code or not shall be true if it exactly matches the specified
+ * regular expression which is a characteristic of multiple countries.
+ * The exact match determination shall be the exact match if the length of the matched character matches
+ * the length of the character passed in the argument.
+ * @param[in] dest_str Country code string. The value gotten using VP_GetEnv() is assumed. Therefore, the maximum length is VP_MAX_LENGTH.
+ * @param[in] multiple_country_code_desig String for determining multiple country codes. Regular expression strings if a regular expression library is used. Otherwise, a single-character string representing the delimiter.
+ * If it gets trapped inside a function, it will have to stub the regcomp during function unit tests, which is very cumbersome and can be removed as arguments.
+ * @return True if country code indicates multiple countries, otherwise false
+ */
+/* ====================================================================== */
+MT_STATIC VP_FCCR_BOOL hasMultipleCoutnry( const char dest_str[], const char multiple_country_code_desig[] )
+{
+ /* ====================================================================== */
+ /* Variable declarations */
+ /* ====================================================================== */
+ VP_FCCR_BOOL isMultiple = B_FALSE;
+
+ /* ====================================================================== */
+ /* Processing */
+ /* ====================================================================== */
+
+ /* NULL checking for arguments */
+ if ( ( NULL != dest_str ) && ( NULL != multiple_country_code_desig ) )
+ {
+ regex_t preg;
+
+ if ( 0 == regcomp( &preg, multiple_country_code_desig, REG_EXTENDED ) )
+ {
+ regmatch_t pmatch = { 0, 0 };
+
+ if ( REG_NOMATCH != regexec( &preg, &(dest_str[0]), 1, &pmatch, 0) )
+ {
+ /** @note Exactly match is considered if the end-of-match offset matches the string length.
+ * Assumed that it should not be used as the end-of-line character so that "$" is not included in the C base character set.
+ */
+ if ( (strnlen( dest_str, VP_MAX_LENGTH ) == (unsigned int)(pmatch.rm_eo) ) )
+ {
+ isMultiple = B_TRUE;
+ }
+ else
+ {
+ isMultiple = B_FALSE;
+ }
+
+ DEBUG_PRINT( "FOUND" )
+ }
+ else
+ {
+ isMultiple = B_FALSE;
+
+ DEBUG_PRINT( "NOT FOUND" )
+ }
+
+ regfree( &preg );
+ }
+ else
+ {
+ /* In the case of a library error,
+ * return false so that the default value that is set by high layer works.
+ */
+
+ /** @todo Should output using FRAMEWORKUNIFIEDLOG for library errors? */
+ isMultiple = B_FALSE;
+
+ DEBUG_PRINT( "FOUND" )
+ }
+ }
+
+ return isMultiple;
+
+}
+#endif
diff --git a/otherservice/vehicle_parameter_library/library/src/VP_GetEnv.c b/otherservice/vehicle_parameter_library/library/src/VP_GetEnv.c
new file mode 100755
index 0000000..c6cd6a7
--- /dev/null
+++ b/otherservice/vehicle_parameter_library/library/src/VP_GetEnv.c
@@ -0,0 +1,291 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* ====================================================================== */
+/**
+ * @file VP_GetEnv.c
+ * @brief API to get vehicle parameter environment variable
+ */
+/* ====================================================================== */
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+#include <other_service/VP_GetEnv.h>
+#include <native_service/ns_backup.h>
+#include <native_service/ns_backup_id.h>
+
+#include "VP_FuncCheck_CanRcv_private.h"
+
+// copy from vpsvc.h
+#define VPSVC_COUNTRY_MAX (0x10) // Maximal number of country codes for 1 destination
+
+// copy from VehicleSens_Vpupdate.cpp
+
+#define VP_VEHICLEPARAMETERLIBRARY_DEST_LEN_MIN 5 // At least 5 characters for 1 destination(e.g. "I:104")
+#define VP_VEHICLEPARAMETERLIBRARY_DEST_NUM_MAX (VP_MAX_LENGTH/VP_VEHICLEPARAMETERLIBRARY_DEST_LEN_MIN)
+#define DS_PACK2_LEN_MAX 2+1 // Max. digits of destination package 2(+\0)
+
+typedef struct {
+ char dest_bdb[2]; // Destination symbol
+ char ds_pack2[DS_PACK2_LEN_MAX]; // Destination package 2
+ uint8_t coutry_num; // Number of Country Codes
+ uint16_t country_no[VPSVC_COUNTRY_MAX]; // Country Code
+} VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE_t;
+
+VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE_t g_vp_vehicleparameterlibrary_dest[VP_VEHICLEPARAMETERLIBRARY_DEST_NUM_MAX]; // Destination information get from environment variables
+static uint32_t g_vp_vehicleparameterlibrary_dest_num; // Number of destination information get from environment variables
+
+static void AnalyzeVpVehicleparameterlibraryDestEnv(void) {
+ char p_env_variable[VP_MAX_LENGTH] = {};
+ char dest_buf[VP_MAX_LENGTH] = { 0 }; // Destination data for environment variables
+ char *c_code_ascii; // Country Code(ASCII)
+ char *dest_bdb_buf; // Destination symbol
+ uint32_t dest_num = 0; // Number of destinations
+ int country_num = 0; // Number of Country Codes per Destination
+ char *token1, *saveptr1; // Destination break token
+ char *token2, *saveptr2; // Delimiter tokens in each destination
+ VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE_t *p_dest;
+ uint16_t *p_country;
+
+ g_vp_vehicleparameterlibrary_dest_num = 0;
+ memset(&g_vp_vehicleparameterlibrary_dest, 0x00, sizeof(VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE_t));
+
+ // Get environment variables
+ VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE, p_env_variable);
+ if (0 == strncmp(p_env_variable, "", VP_MAX_LENGTH)) {
+ DEBUG_PRINT("VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE is NULL");
+ return;
+ }
+
+ DEBUG_PRINTF("VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE=[%s]\n", p_env_variable);
+
+ // Begin analysis First, separate with ","
+ token1 = strtok_r(p_env_variable, ",", &saveptr1);
+ while (token1 != NULL) {
+ snprintf(dest_buf, VP_MAX_LENGTH, "%s", token1);
+ DEBUG_PRINTF("dest_buf\t[%s]", dest_buf);
+ p_dest = &g_vp_vehicleparameterlibrary_dest[dest_num];
+
+ // Get the country code 000-999
+ country_num = 0;
+ c_code_ascii = strchr(dest_buf, (int32_t)(':'));
+ if (c_code_ascii != NULL) {
+ c_code_ascii += 1;
+ token2 = strtok_r(c_code_ascii, "/", &saveptr2);
+ while (token2 != NULL) {
+ p_country = &(p_dest->country_no[country_num]);
+ errno = 0;
+ long int val = strtol(token2, (char **)NULL, 10);
+ if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN))
+ || (errno != 0 && val == 0)) {
+ DEBUG_PRINTF("country No format error [%s]", token2);
+ return;
+ }
+ *p_country = (uint16_t)val;
+
+ if (country_num >= VPSVC_COUNTRY_MAX) {
+ DEBUG_PRINTF("country num over [%s]", token2);
+ return;
+ }
+ country_num++;
+ token2 = strtok_r(NULL, "/", &saveptr2);
+ }
+ p_dest->coutry_num = (uint8_t)(country_num);
+ DEBUG_PRINTF("country_num\t[%d]", country_num);
+ }
+
+ // Get destination symbol (may not be available)
+ dest_bdb_buf = strchr(dest_buf, (int32_t)('&'));
+ if (dest_bdb_buf != NULL) {
+ p_dest->dest_bdb[0] = *(dest_bdb_buf + 1);
+ DEBUG_PRINTF("dest_bdb\t[%s]", p_dest->dest_bdb);
+ } else {
+ DEBUG_PRINT("dest_bdb is noting");
+ }
+
+ // Get destination packages
+ token2 = strtok_r(dest_buf, "&:", &saveptr2);
+ snprintf(p_dest->ds_pack2, DS_PACK2_LEN_MAX, "%s", token2);
+ DEBUG_PRINTF("ds_pack2\t[%s]\n", p_dest->ds_pack2);
+
+ dest_num++;
+ token1 = strtok_r(NULL, ",", &saveptr1);
+ }
+
+ g_vp_vehicleparameterlibrary_dest_num = dest_num;
+}
+
+// based VP_DspackToCountryCode
+// dest [in] Destination codes read from the bkup_manager
+// country_code [out] Country code string, separated by ";" for multi-country codes
+static BOOL VP_DspackToCountryCode(uint8_t* dest, char *country_code) {
+ BOOL ret = FALSE;
+ VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE_t *p;
+ typedef struct {
+ char dest_bdb[2]; // Destination symbol
+ char ds_pack2[DS_PACK2_LEN_MAX]; // Destination package 2
+ } VEHICLE_CAN_DEST_t;
+ VEHICLE_CAN_DEST_t can_dest = {};
+
+ AnalyzeVpVehicleparameterlibraryDestEnv();
+
+ // Setting CAN data
+ can_dest.dest_bdb[0] = (int8_t)dest[0]; // Get destination symbol
+
+ if (isalpha(dest[2]) != 0) { // Get destination packages
+ can_dest.ds_pack2[0] = (int8_t)dest[2];
+ } else {
+ DEBUG_PRINTF("ds_pack2 is neither Alpha character[%c]", (int32_t)dest[2]);
+ return ret;
+ }
+
+ // Comparison with vehicle parameter
+ for (uint32_t i = 0; i < g_vp_vehicleparameterlibrary_dest_num; i++) {
+ p = &g_vp_vehicleparameterlibrary_dest[i];
+ // Determination of destination packages
+ if (strncmp(p->ds_pack2, can_dest.ds_pack2, sizeof(can_dest.ds_pack2)) != 0) {
+ continue;
+ }
+
+ // Determination of destination symbol
+ if (p->dest_bdb[0] == 0) {
+ ret = TRUE; // When the destination code judgment is not required
+ break;
+ }
+
+ if (strncmp(p->dest_bdb, can_dest.dest_bdb, sizeof(can_dest.dest_bdb)) == 0) {
+ ret = TRUE;
+ break;
+ }
+ }
+
+ // Returned as a country code string
+ if (ret == TRUE) {
+ snprintf(country_code, VP_MAX_LENGTH, "%03d", p->country_no[0]);
+ for (uint32_t i = 1; i < p->coutry_num; i++) {
+ char buf[VP_MAX_LENGTH] = {};
+ snprintf(buf, VP_MAX_LENGTH, "%s;%03d", country_code, p->country_no[i]);
+ strncpy(country_code, buf, VP_MAX_LENGTH);
+ }
+ }
+ return ret;
+}
+// end of copy from VehicleSens_Vpupdate.cpp
+
+// copy from vehicle unit
+typedef struct {
+ uint8_t uc_hv; /* hv */
+ uint8_t uc_hv_status; /* hv status */
+ uint8_t uc_2wd4wd; /* 2wd4wd */
+ uint8_t uc_2wd4wd_status; /* 2wd4wd status */
+ uint8_t uc_dest[3]; /* Destination */
+ uint8_t uc_dest_status; /* Destination status */
+ uint8_t uc_stwheel; /* STEERING_WHEEL */
+ uint8_t uc_stwheel_status; /* STEERING_WHEEL status */
+ uint8_t uc_reserve[6]; /* Reserve */
+} VEHICLESENS_NON_VOLATILE_DATA;
+
+/* ====================================================================== */
+/**
+ * @fn
+ * void VP_GetVp_CWORD31_Destination(char *pEnvBuff)
+ * @breaf Get environment variables
+ * @param[out] (pEnvBuff) Start address of the area to store the get environment variable value
+ * @return None
+ * @detail Read and analyze D_BK_ID_VEHICLE_STABLE_DATA from BackupManager.
+ * The country code string is stored in the argument and returned.
+ */
+/* ====================================================================== */
+static void VP_GetVp_CWORD31_Destination(char *pEnvBuff)
+{
+ int32_t ret_api = BKUP_RET_NORMAL;
+ VEHICLESENS_NON_VOLATILE_DATA pstback_up_data;
+ memset(&pstback_up_data, 0x00, sizeof(VEHICLESENS_NON_VOLATILE_DATA));
+ char env_string[VP_MAX_LENGTH];
+
+ VP_GetEnv(VP__CWORD31__TELEMATICS_FUNCTION, env_string);
+
+ if ('\0' == env_string[0]) {
+ *pEnvBuff = '\0';
+ return;
+ } else {
+ // read from backup
+ ret_api = Backup_DataRd(D_BK_ID_VEHICLE_STABLE_DATA,
+ 0,
+ &pstback_up_data,
+ sizeof(VEHICLESENS_NON_VOLATILE_DATA));
+ if (BKUP_RET_NORMAL != ret_api) {
+ *pEnvBuff = '\0';
+ return;
+ }
+ }
+
+ if (0 == strncmp(env_string, "country_ID", strlen("country_ID"))) {
+ uint32_t country_code = 0;
+ country_code += (pstback_up_data.uc_dest[1]); // countory_code 3rd and 2nd digit
+ country_code = (country_code << 4); // shift
+ country_code += (pstback_up_data.uc_dest[2] >> 4); // countory_code 1st digit
+ snprintf(pEnvBuff, VP_MAX_LENGTH, "%x", country_code);
+ } else if(0 == strncmp(env_string, "CAN_judge", strlen("CAN_judge"))) {
+ VP_DspackToCountryCode(pstback_up_data.uc_dest, pEnvBuff);
+ } else {
+ *pEnvBuff = '\0';
+ }
+}
+
+/* ====================================================================== */
+/**
+ * @fn
+ * void VP_GetEnv(char *pEnvStr, char *pEnvBuff )
+ * @breaf Get Environment Variable
+ * @param[in] (pEnvStr) Pointer to the string of the environment variable name to be gotten
+ * @param[out] (pEnvBuff) Start address of the area to store the gotten value of the environment variable
+ * @return None
+ * @detail Read the value (string) of the environment variable specified by the argument and stores it in the specified address.
+ */
+/* ====================================================================== */
+void VP_GetEnv(const char *pEnvStr, char *pEnvBuff )
+{
+ const char *env_string;
+ size_t length;
+
+ if ((pEnvStr != NULL) && (pEnvBuff != NULL)) {
+ if (0 == strncmp(pEnvStr, VP__CWORD31__DESTINATION, strlen(VP__CWORD31__DESTINATION))) {
+ VP_GetVp_CWORD31_Destination(pEnvBuff);
+ } else {
+ env_string = getenv(pEnvStr);
+
+ if (env_string == NULL) {
+ *pEnvBuff = '\0';
+ } else {
+ length = strlen( env_string );
+ if (length < ((size_t)VP_MAX_LENGTH)) {
+ (void)strcpy(pEnvBuff, env_string);
+ } else {
+ (void)strncpy(pEnvBuff, env_string, (VP_MAX_LENGTH - 1));
+ pEnvBuff[ VP_MAX_LENGTH - 1 ] = '\0';
+ }
+ }
+ }
+ } else {
+ if(pEnvBuff != NULL) {
+ *pEnvBuff = '\0';
+ }
+ }
+}
diff --git a/peripheralservice/.gitattributes b/peripheralservice/.gitattributes
new file mode 100755
index 0000000..445b3c2
--- /dev/null
+++ b/peripheralservice/.gitattributes
@@ -0,0 +1,128 @@
+*.doc filter=lfs diff=lfs merge=lfs -text
+*.docx filter=lfs diff=lfs merge=lfs -text
+*.pdf filter=lfs diff=lfs merge=lfs -text
+*.ppt filter=lfs diff=lfs merge=lfs -text
+*.pptx filter=lfs diff=lfs merge=lfs -text
+*.vsd filter=lfs diff=lfs merge=lfs -text
+*.xls filter=lfs diff=lfs merge=lfs -text
+*.xlsm filter=lfs diff=lfs merge=lfs -text
+*.xlsx filter=lfs diff=lfs merge=lfs -text
+*.doC filter=lfs diff=lfs merge=lfs -text
+*.dOc filter=lfs diff=lfs merge=lfs -text
+*.dOC filter=lfs diff=lfs merge=lfs -text
+*.Doc filter=lfs diff=lfs merge=lfs -text
+*.DoC filter=lfs diff=lfs merge=lfs -text
+*.DOc filter=lfs diff=lfs merge=lfs -text
+*.DOC filter=lfs diff=lfs merge=lfs -text
+*.docX filter=lfs diff=lfs merge=lfs -text
+*.doCx filter=lfs diff=lfs merge=lfs -text
+*.doCX filter=lfs diff=lfs merge=lfs -text
+*.dOcx filter=lfs diff=lfs merge=lfs -text
+*.dOcX filter=lfs diff=lfs merge=lfs -text
+*.dOCx filter=lfs diff=lfs merge=lfs -text
+*.dOCX filter=lfs diff=lfs merge=lfs -text
+*.Docx filter=lfs diff=lfs merge=lfs -text
+*.DocX filter=lfs diff=lfs merge=lfs -text
+*.DoCx filter=lfs diff=lfs merge=lfs -text
+*.DoCX filter=lfs diff=lfs merge=lfs -text
+*.DOcx filter=lfs diff=lfs merge=lfs -text
+*.DOcX filter=lfs diff=lfs merge=lfs -text
+*.DOCx filter=lfs diff=lfs merge=lfs -text
+*.DOCX filter=lfs diff=lfs merge=lfs -text
+*.pdF filter=lfs diff=lfs merge=lfs -text
+*.pDf filter=lfs diff=lfs merge=lfs -text
+*.pDF filter=lfs diff=lfs merge=lfs -text
+*.Pdf filter=lfs diff=lfs merge=lfs -text
+*.PdF filter=lfs diff=lfs merge=lfs -text
+*.PDf filter=lfs diff=lfs merge=lfs -text
+*.PDF filter=lfs diff=lfs merge=lfs -text
+*.ppT filter=lfs diff=lfs merge=lfs -text
+*.pPt filter=lfs diff=lfs merge=lfs -text
+*.pPT filter=lfs diff=lfs merge=lfs -text
+*.Ppt filter=lfs diff=lfs merge=lfs -text
+*.PpT filter=lfs diff=lfs merge=lfs -text
+*.PPt filter=lfs diff=lfs merge=lfs -text
+*.PPT filter=lfs diff=lfs merge=lfs -text
+*.pptX filter=lfs diff=lfs merge=lfs -text
+*.ppTx filter=lfs diff=lfs merge=lfs -text
+*.ppTX filter=lfs diff=lfs merge=lfs -text
+*.pPtx filter=lfs diff=lfs merge=lfs -text
+*.pPtX filter=lfs diff=lfs merge=lfs -text
+*.pPTx filter=lfs diff=lfs merge=lfs -text
+*.pPTX filter=lfs diff=lfs merge=lfs -text
+*.Pptx filter=lfs diff=lfs merge=lfs -text
+*.PptX filter=lfs diff=lfs merge=lfs -text
+*.PpTx filter=lfs diff=lfs merge=lfs -text
+*.PpTX filter=lfs diff=lfs merge=lfs -text
+*.PPtx filter=lfs diff=lfs merge=lfs -text
+*.PPtX filter=lfs diff=lfs merge=lfs -text
+*.PPTx filter=lfs diff=lfs merge=lfs -text
+*.PPTX filter=lfs diff=lfs merge=lfs -text
+*.vsD filter=lfs diff=lfs merge=lfs -text
+*.vSd filter=lfs diff=lfs merge=lfs -text
+*.vSD filter=lfs diff=lfs merge=lfs -text
+*.Vsd filter=lfs diff=lfs merge=lfs -text
+*.VsD filter=lfs diff=lfs merge=lfs -text
+*.VSd filter=lfs diff=lfs merge=lfs -text
+*.VSD filter=lfs diff=lfs merge=lfs -text
+*.xlS filter=lfs diff=lfs merge=lfs -text
+*.xLs filter=lfs diff=lfs merge=lfs -text
+*.xLS filter=lfs diff=lfs merge=lfs -text
+*.Xls filter=lfs diff=lfs merge=lfs -text
+*.XlS filter=lfs diff=lfs merge=lfs -text
+*.XLs filter=lfs diff=lfs merge=lfs -text
+*.XLS filter=lfs diff=lfs merge=lfs -text
+*.xlsM filter=lfs diff=lfs merge=lfs -text
+*.xlSm filter=lfs diff=lfs merge=lfs -text
+*.xlSM filter=lfs diff=lfs merge=lfs -text
+*.xLsm filter=lfs diff=lfs merge=lfs -text
+*.xLsM filter=lfs diff=lfs merge=lfs -text
+*.xLSm filter=lfs diff=lfs merge=lfs -text
+*.xLSM filter=lfs diff=lfs merge=lfs -text
+*.Xlsm filter=lfs diff=lfs merge=lfs -text
+*.XlsM filter=lfs diff=lfs merge=lfs -text
+*.XlSm filter=lfs diff=lfs merge=lfs -text
+*.XlSM filter=lfs diff=lfs merge=lfs -text
+*.XLsm filter=lfs diff=lfs merge=lfs -text
+*.XLsM filter=lfs diff=lfs merge=lfs -text
+*.XLSm filter=lfs diff=lfs merge=lfs -text
+*.XLSM filter=lfs diff=lfs merge=lfs -text
+*.xlsX filter=lfs diff=lfs merge=lfs -text
+*.xlSx filter=lfs diff=lfs merge=lfs -text
+*.xlSX filter=lfs diff=lfs merge=lfs -text
+*.xLsx filter=lfs diff=lfs merge=lfs -text
+*.xLsX filter=lfs diff=lfs merge=lfs -text
+*.xLSx filter=lfs diff=lfs merge=lfs -text
+*.xLSX filter=lfs diff=lfs merge=lfs -text
+*.Xlsx filter=lfs diff=lfs merge=lfs -text
+*.XlsX filter=lfs diff=lfs merge=lfs -text
+*.XlSx filter=lfs diff=lfs merge=lfs -text
+*.XlSX filter=lfs diff=lfs merge=lfs -text
+*.XLsx filter=lfs diff=lfs merge=lfs -text
+*.XLsX filter=lfs diff=lfs merge=lfs -text
+*.XLSx filter=lfs diff=lfs merge=lfs -text
+*.XLSX filter=lfs diff=lfs merge=lfs -text
+*.json filter=lfs diff=lfs merge=lfs -text
+*.jsoN filter=lfs diff=lfs merge=lfs -text
+*.jsOn filter=lfs diff=lfs merge=lfs -text
+*.jsON filter=lfs diff=lfs merge=lfs -text
+*.jSon filter=lfs diff=lfs merge=lfs -text
+*.jSoN filter=lfs diff=lfs merge=lfs -text
+*.jSOn filter=lfs diff=lfs merge=lfs -text
+*.jSON filter=lfs diff=lfs merge=lfs -text
+*.Json filter=lfs diff=lfs merge=lfs -text
+*.JsoN filter=lfs diff=lfs merge=lfs -text
+*.JsOn filter=lfs diff=lfs merge=lfs -text
+*.JsON filter=lfs diff=lfs merge=lfs -text
+*.JSon filter=lfs diff=lfs merge=lfs -text
+*.JSoN filter=lfs diff=lfs merge=lfs -text
+*.JSOn filter=lfs diff=lfs merge=lfs -text
+*.JSON filter=lfs diff=lfs merge=lfs -text
+*.ods filter=lfs diff=lfs merge=lfs -text
+*.odS filter=lfs diff=lfs merge=lfs -text
+*.oDs filter=lfs diff=lfs merge=lfs -text
+*.oDS filter=lfs diff=lfs merge=lfs -text
+*.Ods filter=lfs diff=lfs merge=lfs -text
+*.OdS filter=lfs diff=lfs merge=lfs -text
+*.ODs filter=lfs diff=lfs merge=lfs -text
+*.ODS filter=lfs diff=lfs merge=lfs -text
diff --git a/peripheralservice/communication/LICENSE b/peripheralservice/communication/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/peripheralservice/communication/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/peripheralservice/communication/Makefile.client b/peripheralservice/communication/Makefile.client
new file mode 100755
index 0000000..8d25486
--- /dev/null
+++ b/peripheralservice/communication/Makefile.client
@@ -0,0 +1,18 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+SUBDIRS = client_can
+
+include ../peripheral_service.mk
diff --git a/peripheralservice/communication/Makefile.server b/peripheralservice/communication/Makefile.server
new file mode 100755
index 0000000..6ebcc1a
--- /dev/null
+++ b/peripheralservice/communication/Makefile.server
@@ -0,0 +1,18 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+SUBDIRS = server
+
+include ../peripheral_service.mk
diff --git a/peripheralservice/communication/client_can/Makefile b/peripheralservice/communication/client_can/Makefile
new file mode 100755
index 0000000..49d5708
--- /dev/null
+++ b/peripheralservice/communication/client_can/Makefile
@@ -0,0 +1,72 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+#INST_PROGS =
+
+######### installed library(*.a) #############
+#INST_LIBS =
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libCAN_API
+
+######### install unit representative headers(*.h) #############
+VPATH += ../server/include/$(COMPONENT_NAME)
+INST_HEADERS += communication_notifications.h communication.h ps_services.h
+
+######### install headers(*.h) #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += Canif_API.h communication_can.h
+
+######### compiled sources #############
+libCAN_API_SRCS += Canif_API.cpp
+
+######### add source path #############
+VPATH += ./src
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./../client_lan/include/
+CPPFLAGS += -I./../server/include
+CPPFLAGS += -I./../server/include/private
+CPPFLAGS += -I./../server/include/CAN/TxMsg
+CPPFLAGS += -I./../server/include/CAN/main
+CPPFLAGS += -I./../server/include/main
+CPPFLAGS += -I./../server/include/threads
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC -fdata-sections -ffunction-sections -DFLG_CORE
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### add library path #############
+LDFLAGS += -Wl,-M -Wl,--gc-sections
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### linked library (static) #############
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lrt
+
+include ../../peripheral_service.mk
diff --git a/peripheralservice/communication/client_can/include/API_Local_Common.h b/peripheralservice/communication/client_can/include/API_Local_Common.h
new file mode 100755
index 0000000..c5e3f78
--- /dev/null
+++ b/peripheralservice/communication/client_can/include/API_Local_Common.h
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_API_LOCAL_COMMON_H_
+#define COMMUNICATION_CLIENT_CAN_INCLUDE_API_LOCAL_COMMON_H_
+#include <string.h>
+enum CANIF_PROTOCOL_IDX {
+ CANIF_CAN = 0,
+ NUM_OF_CANIF_PROTOCOL
+};
+
+static inline const char *Canif_PidxTosname(enum CANIF_PROTOCOL_IDX idx) {
+ switch (idx) {
+ case CANIF_CAN:
+ return LAN_SERVICE_CAN;
+ break;
+ default:
+ return "Unknown";
+ break;
+ }
+}
+
+#define CANIF_NOTIFY_NAME_MAX_SIZE 15
+static inline bool Canif_CheckNotifyName(PCSTR notify_name) {
+ size_t n = CANIF_NOTIFY_NAME_MAX_SIZE + 1;
+
+ if (!notify_name)
+ return false;
+
+ return (strnlen(notify_name, n) < n);
+}
+
+static inline bool Canif_CheckNotifyNameWithoutNullCheck(PCSTR notify_name) {
+ size_t n = CANIF_NOTIFY_NAME_MAX_SIZE + 1;
+ return (strnlen(notify_name, n) < n);
+}
+
+static inline void Canif_CopyNotifyName(char *dest, PCSTR notify_name) {
+ strncpy(dest, notify_name,
+ strnlen(notify_name, CANIF_NOTIFY_NAME_MAX_SIZE));
+}
+#endif
diff --git a/peripheralservice/communication/client_can/include/Canif_API_Local.h b/peripheralservice/communication/client_can/include/Canif_API_Local.h
new file mode 100755
index 0000000..d17fcc5
--- /dev/null
+++ b/peripheralservice/communication/client_can/include/Canif_API_Local.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_
+#define COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_
+
+#define CAN_ID_MASK_CODE 0xE0000000UL // CAN ID Mask Codes
+static inline bool Canif_CheckCanID(CANID id) {
+ if (id == 0)
+ return false;
+
+ // upper 3 bit from MSB should be 0x0
+ if ((CAN_ID_MASK_CODE & id) != 0x0)
+ return false;
+
+ return true;
+}
+
+static inline bool Canif_IsCommand(uint32_t cmd_id) {
+ switch (cmd_id) {
+ case CAN_CMDID_FUELCALC_RST_REQ_DELIVERY:
+ case CAN_CMDID_STARTUP_FIN_REQ_TX:
+ case CAN_CMDID_MRST_INFO_REQ_TX:
+ case CAN_CMDID_VERSION_REQ_TX:
+ case CAN_CMDID_CONNECTION_NODE_REQ_TX:
+ case CAN_CMDID_FUELCALC_REQ_TX:
+ return true;
+ default:
+ return false;
+ }
+}
+
+#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_
diff --git a/peripheralservice/communication/client_can/include/Canif_TransmissionData.h b/peripheralservice/communication/client_can/include/Canif_TransmissionData.h
new file mode 100755
index 0000000..e9f82ac
--- /dev/null
+++ b/peripheralservice/communication/client_can/include/Canif_TransmissionData.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_TRANSMISSIONDATA_H_
+#define COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_TRANSMISSIONDATA_H_
+
+#define LAN_TYPE_21PF "CAN_21PF"
+
+typedef struct {
+ uint8_t dlc;
+ CAN_DATA_BIT dat;
+} CAN_TRANS_START_TABLE_VAL;
+
+typedef struct {
+ CANID canid;
+ CAN_TRANS_START_TABLE_VAL val;
+} CAN_INIT_TABLE;
+
+#include "Canif_TransmissionData21PF.h"
+
+static inline bool Canif_InitDataIsDefined21PF(CANID id) {
+ int32_t count;
+ int i;
+
+ count = sizeof(Can_TransInitData_21PF) /
+ sizeof(Can_TransInitData_21PF[0]);
+ for (i = 0; i < count; i++) {
+ if (id == Can_TransInitData_21PF[i].canid)
+ return true;
+ }
+
+ return false;
+}
+
+#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_TRANSMISSIONDATA_H_
diff --git a/peripheralservice/communication/client_can/include/Canif_TransmissionData21PF.h b/peripheralservice/communication/client_can/include/Canif_TransmissionData21PF.h
new file mode 100755
index 0000000..e608ca5
--- /dev/null
+++ b/peripheralservice/communication/client_can/include/Canif_TransmissionData21PF.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Following table could not be const because server will use this as R/W.
+static CAN_INIT_TABLE Can_TransInitData_21PF[] __attribute__((unused)) =
+{
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ { 0x0000, 1, { 0x00 } },
+ { 0x0001, 1, { 0x00 } },
+ { 0x0002, 8, { 0x00 } },
+ { 0x0100, 1, { 0x00 } },
+ { 0x0101, 8, { 0x00 } },
+ { 0x0102, 8, { 0x00 } }
+};
diff --git a/peripheralservice/communication/client_can/include/peripheral_service/Canif_API.h b/peripheralservice/communication/client_can/include/peripheral_service/Canif_API.h
new file mode 100755
index 0000000..a68783c
--- /dev/null
+++ b/peripheralservice/communication/client_can/include/peripheral_service/Canif_API.h
@@ -0,0 +1,1158 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+ * FILE Canif_API.h
+ * TITLE :Data header files needed to use the CAN I/F API
+ ****************************************************************************/
+
+#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_
+#define COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_
+
+/**
+ * @file Canif_API.h
+ * @~english
+ * @brief Canif API header
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup communication
+ * @ingroup peripheral_service
+ * @{
+ */
+/** @addtogroup CAN
+ * @ingroup communication
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <asm/unistd.h>
+#include <stub/com_message_header.h>
+
+/**
+ * \~english Defination of Service name
+ */
+#define LAN_SERVICE_CAN "CAN_COM_PROT"
+
+/**
+ * \~english Availability notification of CAN
+ */
+#define NTFY_Communication_CAN_ISAVAILABLE "Communication/CanIsAvailable"
+
+/*********************************************************************
+* Defining Return Values
+***********************************************************************/
+/* Normal system */
+/**
+ * \~english Suceess
+ */
+#define CANIF_RET_NORMAL 1
+/* Abnormal system */
+/**
+ * \~english Parameter error
+ */
+#define CANIF_RET_ERROR_PARAM 2
+/**
+ * \~english Buffer Full
+ */
+#define CANIF_RET_ERROR_BUFFULL 3
+/**
+ * \~english CAN ID FULL
+ */
+#define CANIF_RET_ERROR_CANIDFULL 4
+/**
+ * \~english ID unregister
+ */
+#define CANIF_RET_ERROR_UNDEF 5
+/**
+ * \~english Thread ID unmatched
+ */
+#define CANIF_RET_ERROR_PID 6
+/**
+ * \~english Timer error
+ */
+#define CANIF_RET_ERROR_TIMER 7
+/**
+ * \~english Event Creat Error
+ */
+#define CANIF_RET_ERROR_CREATE_EVENT 8
+/**
+ * \~english Error Cancel
+ */
+#define CANIF_RET_ERROR_CANCEL 9
+/**
+ * \~english Null Pointer
+ */
+#define CANIF_RET_ERROR_NULL 10
+
+/**
+ * \~english Flags for specifiy Delivery is echoback or not.
+ */
+enum CanIfEchoBackFlags {
+ /**
+ * \~english Delivery is recv data
+ */
+ CANIF_PURERECV = 0,
+ /**
+ * \~english Delivery is echo data
+ */
+ CANIF_ECHOBACK = 1
+};
+
+/**
+ * \~english Defination of Command ID ( CAN -> user )
+ */
+typedef enum _PS_CommunicationProtocol {
+ /**
+ * \~english Delivery CAN Data
+ */
+ CID_CAN_DATA_DELIVERY = 0x0401,
+ /**
+ * \~english CAN communication stop
+ */
+ CID_CAN_COMM_STOP,
+ /**
+ * \~english CAN communication restore
+ */
+ CID_CAN_COMM_RESTORE,
+ /**
+ * \~english CAN transmission result
+ */
+ CID_CAN_TX_RESULT,
+ /**
+ * \~english Delivery CAN command
+ */
+ CID_CAN_CMD_DELIVERY,
+ /**
+ * \~english CAN command transmission result
+ */
+ CID_CAN_CMD_TX_RESULT,
+ /**
+ * \~english Delivery CAN data to CANGW
+ */
+ CID_CAN_CANGW_DELIVERY,
+} PS_CommunicationProtocol;
+
+/**
+ * \~english Defination of Command ID ( CANIF -> CAN )
+ */
+typedef enum _PS_Communication_InternalProtocol {
+ /**
+ * \~english Delivery registration of CAN data
+ */
+ CID_CANIF_DELIVERY_ENTRY = 0x0501,
+ /**
+ * \~english Delivery deregistration of CAN data
+ */
+ CID_CANIF_DELIVERY_ERASE,
+ /**
+ * \~english CAN data transmission start
+ */
+ CID_CANIF_TX_START,
+ /**
+ * \~english CAN data communication stop watching
+ */
+ CID_CANIF_COMM_WATCH,
+ /**
+ * \~english CAN command control
+ */
+ CID_CANIF_CMD_CTRL,
+ /**
+ * \~english CAN data transmission start
+ */
+ CID_CANIF_TX_BIT_START,
+} PS_Communication_InternalProtocol;
+
+/*********************************************************************
+* Definitions of CAN command IDs
+***********************************************************************/
+/**
+* \~english Request CAN fuel calculator reset
+*/
+#define CAN_CMDID_FUELCALC_RST_REQ_DELIVERY 0x00
+/**
+* \~english Request CAN startup finished notification
+*/
+#define CAN_CMDID_STARTUP_FIN_REQ_TX 0x01
+/**
+* \~english Request CAN Master reset notification
+*/
+#define CAN_CMDID_MRST_INFO_REQ_TX 0x02
+/**
+* \~english Request CAN version
+*/
+#define CAN_CMDID_VERSION_REQ_TX 0x03
+/**
+* \~english Request CAN connected node notification
+*/
+#define CAN_CMDID_CONNECTION_NODE_REQ_TX 0x04
+/**
+* \~english Request CAN BUS status notification
+* ToDo@Bus error I/F is not required when CanGetBusStatus() is deleted, so it is scheduled to be deleted.
+*/
+#define CAN_CMDID_BUS_STATUS_REQ_TX 0x05
+/**
+* \~english Response of CAN fuel calculator reset
+*/
+#define CAN_CMDID_FUELCALC_REQ_TX 0x06
+/**
+* \~english Receive CAN fuel calculator reset request
+*/
+#define CAN_CMDID_FUELCALC_RST_REQ_RX 0x07
+/**
+* \~english Receive CAN startup finished notification
+*/
+#define CAN_CMDID_STARTUP_FIN_RESP_RX 0x08
+/**
+* \~english Receive CAN Master reset notification
+*/
+#define CAN_CMDID_MRST_INFO_RESP_RX 0x09
+/**
+* \~english Response of CAN version receive
+*/
+#define CAN_CMDID_VERSION_RESP_RX 0x0A
+/**
+* \~english Response of CAN connection node receive
+*/
+#define CAN_CMDID_CONNECTION_NODE_RESP_RX 0x0B
+/**
+* \~english Response of CAN bus status receive
+* ToDo@Bus error I/F is not required when CanGetBusStatus() is deleted, so it is scheduled to be deleted.
+*/
+#define CAN_CMDID_BUS_STATUS_RESP_RX 0x0C
+
+/*********************************************************************
+* Control Flag/Status Definition
+***********************************************************************/
+/* CANData Delivery control flag */
+/**
+* \~english Delivery stop
+*/
+#define CAN_DELIVERY_STOP 0
+/**
+* \~english Delivery restart
+*/
+#define CAN_DELIVARY_RESTART 1
+
+/* CANData Transmission result notification status */
+/**
+* \~english Success
+*/
+#define CAN_SUCCESS 0
+/**
+* \~english Retryout
+*/
+#define CAN_RETRYOUT 1
+/**
+* \~english Send buffer full
+*/
+#define CAN_BUFFERFUL 2
+
+/* IG linkage type */
+/**
+* \~english IG cooperation off
+*/
+#define CAN_IG_COOPERATION_OFF 0
+/**
+* \~english IG cooperation on
+*/
+#define CAN_IG_COOPERATION_ON 1
+
+/* N_TA */
+/**
+* \~english Invalid target address
+*/
+#define CAN_NTA_INVALID 0xFF
+
+/* Others */
+/**
+* \~english The code of resource ID which is not used
+*/
+#define CAN_RID_NOTUSE_CODE 0xFF
+
+/*********************************************************************
+* Data size definition
+***********************************************************************/
+/**
+* \~english MAX CAN data size used to send/receive message
+*/
+#define CAN_DATA_SIZE 63
+/**
+* \~english MAX CAN data size used to send message
+*/
+#define CAN_TXDATA_SIZE 8
+
+/* Data size relationship */
+/**
+* \~english MAX number of delivery entry
+* \~english ((528-16)-12)/4 = 125 12:event ID etc. , 4:size of CAN ID
+*/
+#define CAN_DELIVERY_CANID_ENTRY_MAX 125
+
+/**
+* \~english OPC MAX number of delivery entry
+*/
+#define CAN_DELIVERY_OPC_ENTRY_MAX 255
+
+/* Message size relationship */
+/**
+* \~english MAX size of message buffer
+*/
+#define CAN_MSGBUF_MAX_SIZE 528
+/**
+* \~english Size of message buffer header
+*/
+#define CAN_MSGBUF_HEADER_SIZE 16
+/**
+* \~english MAX size of message buffer header
+*/
+#define CAN_MSGBUF_DATAMAX_SIZE (CAN_MSGBUF_MAX_SIZE - CAN_MSGBUF_HEADER_SIZE)
+
+/**
+* \~english MAX size of CAN command data
+*/
+#define CANCMD_DAT_MAX 68
+
+/**
+* \~english MAX number of CANGW transmission data
+*/
+#define CANGW_SND_NUM_MAX 0x16
+/**
+* \~english MAX length of CANGW DLC
+*/
+#define CANGW_DLC_MAX_SIZE 0x08
+
+/*********************************************************************
+* Type definition
+***********************************************************************/
+/**
+* \~english CAN I/F API return code
+*/
+typedef int32_t CANIF_RET_API;
+/**
+* \~english define of CAN ID type
+*/
+typedef uint32_t CANID;
+
+/**
+* \~english data ID
+*/
+typedef uint32_t DID;
+
+/**
+* \~english Data struct used to transfer CAN data
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID can_id;
+ /**
+ * \~english Data Length
+ */
+ uint8_t dlc;
+ /**
+ * \~english reserve
+ */
+ uint8_t reserve[3];
+ /**
+ * \~english DATA[0] ~ DATA[N]
+ */
+ uint8_t data[CAN_DATA_SIZE];
+ /**
+ * \~english reserve
+ */
+ uint8_t reserve2;
+} CAN_MSG_CANDATA_DAT;
+
+/**
+* \~english Data struct used to transfer CAN message
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english data
+ */
+ CAN_MSG_CANDATA_DAT data;
+ /**
+ * \~english echoback flag
+ */
+ enum CanIfEchoBackFlags echoback;
+} CAN_MSG_CANDATA;
+
+/**
+* \~english Data struct used to transfer CAN data to CANGW
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID (upper byte)
+ */
+ uint8_t can_id_high;
+ /**
+ * \~english CAN ID (lower byte)
+ */
+ uint8_t can_id_low;
+ /**
+ * \~english Data Length
+ */
+ uint8_t dlc;
+ /**
+ * \~english data
+ */
+ uint8_t data[CANGW_DLC_MAX_SIZE];
+} CAN_MSG_CANGWDATA_DAT;
+
+/**
+* \~english Message struct used to transfer CAN data to CANGW
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN data
+ */
+ CAN_MSG_CANGWDATA_DAT data[CANGW_SND_NUM_MAX];
+ /**
+ * \~english Number of CAN data(max 22)
+ */
+ uint8_t num;
+} CAN_MSG_CANGWDATA;
+
+/**
+* \~english Data struct used to transfer CAN data
+* \~english (transfer data from user to CANIF API)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID can_id;
+ /**
+ * \~english Data Length
+ */
+ uint8_t dlc;
+ /**
+ * \~english reserve
+ */
+ uint8_t reserve[3];
+ /**
+ * \~english DATA
+ */
+ uint8_t data[CAN_DATA_SIZE + 1];
+} CAN_DATA;
+
+/**
+* \~english Data struct used to transfer CAN data
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ /**
+ * \~english Thread ID used by _CWORD64_
+ */
+ uint32_t ulEventId;
+ /**
+ * \~english Resource ID
+ */
+ uint8_t ucRid; /* Resources ID */
+ /**
+ * \~english Cycle of send message(Unit of 100ms)
+ */
+ uint16_t usFreq;
+ /**
+ * \~english CAN DATA
+ */
+ CAN_DATA stCandata;
+} CAN_TRANSMISSION_START_MSG_DAT;
+
+/**
+* \~english Data struct used to notify transmission result
+* \~english (transfer data from CAN API to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+ /**
+ * \~english Transmission result status
+ */
+ uint8_t ucStatus;
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve[3];
+} CAN_MSG_SENDSTS_DAT;
+
+/**
+* \~english Message struct used to notify transmission result
+* \~english (transfer message from CAN API to user)
+*/
+typedef struct {
+ /**
+ * \~english header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_MSG_SENDSTS_DAT data;
+} CAN_MSG_SENDSTS;
+
+/**
+* \~english Data struct used for regular transmission stop
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ /**
+ * \~english Event ID that use for _CWORD64_
+ */
+ uint32_t ulEventId;
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+} CAN_FREQ_TRANS_STOP_MSG_DAT;
+
+/**
+* \~english Data struct used for communication stop/restore
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Data ID
+ */
+ DID ulDid;
+} CAN_MSG_COMM_WATCHSTS_DAT;
+
+/**
+* \~english Data struct used for communication stop/restore
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_MSG_COMM_WATCHSTS_DAT data;
+} CAN_MSG_COMM_WATCHSTS;
+
+/**
+* \~english Data struct used for delivery entry
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ /**
+ * \~english Event ID use for _CWORD64_
+ */
+ uint32_t ulEventId;
+ /**
+ * \~english Number of CAN ID entry
+ */
+ uint16_t usCanNum;
+ /**
+ * \~english CAN ID entry array
+ */
+ CANID ulCanid[CAN_DELIVERY_CANID_ENTRY_MAX];
+} CAN_DELIVERY_ENTRY;
+
+/**
+* \~english Data struct used for communication stop
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP]; /* Destination thread name */
+ /**
+ * \~english Event ID
+ */
+ uint32_t ulEvtId;
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+ /**
+ * \~english Data ID
+ */
+ DID ulDid;
+ /**
+ * \~english Watch time for commuication stop (Unit of 100ms)
+ */
+ uint16_t usWatchTime;
+} CAN_COMM_WATCH_MSG_DAT;
+
+/**
+* \~english Data struct used for CAN command control
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Transfer to: ID */
+ /**
+ * \~english Event ID
+ */
+ uint32_t ulEvtId;
+ /**
+ * \~english Resource ID
+ */
+ uint8_t ucRid;
+ /**
+ * \~english CAN command ID
+ */
+ uint8_t ucCmdid;
+} CAN_CMD_CTRL_MSG_DAT;
+
+/**
+* \~english Data struct used for CAN command delivery
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN command ID
+ */
+ uint8_t cmd_id;
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve[3];
+ /**
+ * \~english Data
+ */
+ uint8_t data[CANCMD_DAT_MAX];
+} CAN_MSG_CANCMD_DAT;
+
+/**
+* \~english Message struct used for CAN command delivery
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_MSG_CANCMD_DAT data;
+} CAN_MSG_CANCMD;
+
+/**
+* \~english Data struct used for CAN command transmission result
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN command ID(same as delivery format)
+ */
+ uint32_t cmd_id;
+ /**
+ * \~english Delivery result status
+ */
+ uint8_t status;
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve[3];
+} CAN_CMD_MSG_SENDSTS_DAT;
+
+/**
+* \~english Data struct used for CAN command transmission result
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_CMD_MSG_SENDSTS_DAT data;
+} CAN_CMD_MSG_SENDSTS;
+
+/**
+* \~english Data struct for receiving message(work data)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM stHead;
+ /**
+ * \~english Data
+ */
+ uint8_t ucData[CAN_MSGBUF_DATAMAX_SIZE];
+} CAN_MSG_DATA;
+
+/**
+* \~english CAN data struct of communication stop registration
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ /**
+ * \~english Event ID for _CWORD64_
+ */
+ uint32_t ulEvtId;
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+ /**
+ * \~english Data ID
+ */
+ DID ulDid;
+ /**
+ * \~english Watch time for communication stop(Unit of 100ms)
+ */
+ uint16_t usWatchTime;
+ /**
+ * \~english has IG coopration or not
+ */
+ uint8_t ucIg;
+} CAN_COMM_WATCHEXT_MSG_DAT;
+
+/**
+* \~english Mask data struct for CAN data
+*/
+typedef struct {
+ /**
+ * \~english Mask data
+ */
+ uint8_t dat[CAN_TXDATA_SIZE];
+} CAN_DATA_MASK;
+
+/**
+* \~english Data struct used for CAN data transmission
+*/
+typedef struct {
+ /**
+ * \~english Transmission data
+ */
+ uint8_t dat[CAN_TXDATA_SIZE];
+} CAN_DATA_BIT;
+
+/**
+* \~english Data struct used for CAN data transmission registration
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID id;
+ /**
+ * \~english Mask data
+ */
+ CAN_DATA_MASK mask;
+ /**
+ * \~english Transmission data
+ */
+ CAN_DATA_BIT dat;
+ /**
+ * \~english Cycle of regular transmission
+ */
+ uint32_t freq;
+} CAN_TRANS_START_MSG_DAT;
+
+/***********************************************************************
+* CANIF API Functions Prototypes *
+************************************************************************/
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*******************************************************************************
+ * MODULE : Canif_DeliveryEntry
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_DeliveryEntry
+/// \~english @par Brief
+/// Delivery registration of CAN data
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] can_num
+/// uint8_t - Number of delivery registration CAN ID
+/// \~english @param [in] p_can_id
+/// CANID* - Pointer of delivery registration CAN ID array
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - can_num is 0 or bigger than 125.[CANIF_RET_ERROR_PARAM]
+/// - CAN ID pointer is null.[CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Delivery registration of CAN data. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_DeliveryEntry(HANDLE h_app, PCSTR notify_name,
+ uint8_t can_num, CANID *p_can_id);
+
+/*******************************************************************************
+ * MODULE : Canif_TransmissionStart
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_TransmissionStart
+/// \~english @par Brief
+/// CAN data transmission starting
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] rid
+/// uint8_t - Resource ID for CAN data transmission result notification
+/// \~english @param [in] freq
+/// uint16_t - Cycle of regular transmission
+/// \~english @param [in] p_data
+/// CAN_DATA* - Pointer of transmission data
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - Transmission data pointer is null.[CANIF_RET_ERROR_PARAM]
+/// - DLC size is bigger than 8 bytes.[CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - CAN ID is not defined in the _CWORD108_ bit asignment table
+/// [CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - The transmission of the CAN data starts(Regular/One). \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_TransmissionStart(HANDLE h_app, PCSTR notify_name,
+ uint8_t rid, uint16_t freq, CAN_DATA *p_data);
+
+/*******************************************************************************
+ * MODULE : Canif_CommandCtrl
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_CommandCtrl
+/// \~english @par Brief
+/// CAN command control
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] rid
+/// uint8_t - Resource ID
+/// \~english @param [in] cmd_id
+/// uint32_t - CAN command ID(32bit)
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - CAN command ID is invalid.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - Transmission control of CAN command. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_CommandCtrl(HANDLE h_app, PCSTR notify_name, uint8_t rid,
+ uint32_t cmd_id);
+
+/*******************************************************************************
+ * MODULE : Canif_CommWatch
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_CommWatch
+/// \~english @par Brief
+/// CAN data regular transmission stop
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] can_id
+/// CANID - CAN ID
+/// \~english @param [in] did
+/// DID - Data ID
+/// \~english @param [in] watch_time
+/// uint16_t - Communication watch suspension time(Unit of 100ms)
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - CAN data regular transmission stop. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_CommWatch(HANDLE h_app, PCSTR notify_name, CANID can_id,
+ DID did, uint16_t watch_time);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_TransStart
+/// \~english @par Brief
+/// Transmission CAN Command
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] can_id
+/// CANID - CAN ID
+/// \~english @param [in] mask
+/// CAN_DATA_MASK* - Mask Data
+/// \~english @param [in] dat
+/// CAN_DATA_BIT* - Transmission Data
+/// \~english @param [in] freq
+/// uint32_t - Transmission Cycle
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Transmission Cycle is bigger than 0xFFFF.[CANIF_RET_ERROR_PARAM]
+/// - CAN ID is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Mask Data is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Transmission Data is NULL.[CANIF_RET_ERROR_PARAM]
+/// - CAN ID is not defined in the _CWORD108_ bit asignment table
+/// [CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - Start Transmission CAN Command API. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_TransStart(HANDLE h_app, CANID can_id, CAN_DATA_MASK *mask,
+ CAN_DATA_BIT *dat, uint32_t freq);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_DeliveryEraseAll
+/// \~english @par Brief
+/// Delete all delivery entry
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Delete all delivery entry. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_DeliveryEraseAll(HANDLE h_app, PCSTR notify_name);
+
+/** @}*/ // end of CAN
+/** @}*/ // end of communication
+/** @}*/ // end of peripheral_service
+/** @}*/ // end of BaseSystem
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_
diff --git a/peripheralservice/communication/client_can/include/peripheral_service/communication_can.h b/peripheralservice/communication/client_can/include/peripheral_service/communication_can.h
new file mode 100755
index 0000000..8b6119a
--- /dev/null
+++ b/peripheralservice/communication/client_can/include/peripheral_service/communication_can.h
@@ -0,0 +1,28 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef PERIPHERALSERVICE_COMMUNICATIONCAN_H_ // NOLINT(build/header_guard)
+#define PERIPHERALSERVICE_COMMUNICATIONCAN_H_ // NOLINT(build/header_guard)
+
+/**
+ * @file communication_can.h
+ * @~english
+ * @brief communication_can unit header
+ */
+
+#include <peripheral_service/Canif_API.h>
+
+#endif // PERIPHERALSERVICE_COMMUNICATIONCAN_H_
diff --git a/peripheralservice/communication/client_can/libCAN_API.ver b/peripheralservice/communication/client_can/libCAN_API.ver
new file mode 100755
index 0000000..47e5e86
--- /dev/null
+++ b/peripheralservice/communication/client_can/libCAN_API.ver
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#########################
+# lib_CWORD83_ version script #
+#########################
+{
+ global:
+ ### .text section ###
+ Canif_DeliveryEntry;
+ Canif_DeliveryEraseAll;
+ Canif_TransmissionStart;
+ Canif_TransmissionStop;
+ Canif_CommandCtrl;
+ Canif_CommWatch;
+ Canif_TransStart;
+ Canif_TransStop;
+ Canif_Send;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/peripheralservice/communication/client_can/src/Canif_API.cpp b/peripheralservice/communication/client_can/src/Canif_API.cpp
new file mode 100755
index 0000000..499d187
--- /dev/null
+++ b/peripheralservice/communication/client_can/src/Canif_API.cpp
@@ -0,0 +1,301 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <peripheral_service/Canif_API.h>
+
+#include "API_Local_Common.h"
+#include "Canif_API_Local.h"
+#include "Canif_TransmissionData.h"
+#include "com_error_type.h"
+
+static __thread HANDLE g_sender = NULL;
+
+static EFrameworkunifiedStatus CanifMsgToSrv(HANDLE h, UI_32 cmd, size_t len, PCVOID data) {
+ if (data == NULL)
+ return eFrameworkunifiedStatusFail;
+
+ if (len > UINT32_MAX)
+ return eFrameworkunifiedStatusFail;
+
+ if (g_sender == NULL) {
+ g_sender = FrameworkunifiedMcOpenSender(h, LAN_SERVICE_CAN);
+ if (g_sender == NULL)
+ return eFrameworkunifiedStatusFail;
+ }
+ return FrameworkunifiedSendMsg(g_sender, cmd, (UI_32)len, data);
+}
+
+CANIF_RET_API Canif_DeliveryEntry(HANDLE h_app, PCSTR notify_name,
+ uint8_t can_num, CANID *p_can_id) {
+
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ CAN_DELIVERY_ENTRY pst_delivery_entry;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ PS_Communication_InternalProtocol cmd = CID_CANIF_DELIVERY_ENTRY;
+ void *tx = reinterpret_cast<void *>(&pst_delivery_entry);
+ size_t len = sizeof(pst_delivery_entry);
+ memset(tx, 0x0, len);
+ int32_t i;
+
+ if (NULL == h_app)
+ goto cleanup;
+
+ if (NULL == p_can_id)
+ goto cleanup;
+
+ if (!Canif_CheckNotifyName(notify_name))
+ goto cleanup;
+
+ if (0 == can_num)
+ goto cleanup;
+
+ if (CAN_DELIVERY_CANID_ENTRY_MAX < can_num)
+ goto cleanup;
+
+ for (i = 0; i < (int32_t)can_num; i++) {
+ if (!Canif_CheckCanID(p_can_id[i]))
+ goto cleanup;
+ }
+
+ Canif_CopyNotifyName(pst_delivery_entry.notifyName, notify_name);
+ pst_delivery_entry.usCanNum = (uint16_t)can_num;
+ memcpy(pst_delivery_entry.ulCanid, p_can_id, sizeof(CANID) * can_num);
+
+ e_status = CanifMsgToSrv(h_app, cmd, len, tx);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ return l_ret;
+}
+
+CANIF_RET_API Canif_TransmissionStart(HANDLE h_app, PCSTR notify_name,
+ uint8_t rid, uint16_t freq, CAN_DATA *p_data) {
+
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ CAN_TRANSMISSION_START_MSG_DAT pst_transmission_start;
+ PS_Communication_InternalProtocol cmd = CID_CANIF_TX_START;
+ void *tx = reinterpret_cast<void *>(&pst_transmission_start);
+ size_t len = sizeof(pst_transmission_start);
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ PCSTR _notify_name = notify_name;
+ memset(tx, 0x0, len);
+
+ if (h_app == NULL)
+ goto cleanup;
+
+ if (p_data == NULL)
+ goto cleanup;
+
+ if (rid == 0xFF) {
+ _notify_name = ""; // using dummy name;
+ }
+
+ if (!Canif_CheckNotifyName(_notify_name))
+ goto cleanup;
+
+ if (CAN_TXDATA_SIZE < (p_data->dlc))
+ goto cleanup;
+
+ if (!Canif_CheckCanID(p_data->can_id))
+ goto cleanup;
+
+ if (!Canif_InitDataIsDefined21PF(p_data->can_id))
+ goto cleanup;
+
+ Canif_CopyNotifyName(pst_transmission_start.notifyName, _notify_name);
+ pst_transmission_start.ucRid = rid;
+ pst_transmission_start.usFreq = freq;
+ memcpy(reinterpret_cast<void *>(&pst_transmission_start.stCandata),
+ reinterpret_cast<int8_t *>(p_data), (size_t)sizeof(CAN_DATA));
+ e_status = CanifMsgToSrv(h_app, cmd, len, tx);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ return l_ret;
+}
+
+CANIF_RET_API Canif_CommandCtrl(HANDLE h_app, PCSTR notify_name, uint8_t rid,
+ uint32_t cmd_id) {
+
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ CAN_CMD_CTRL_MSG_DAT pst_cmd_ctrl_msg;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ PS_Communication_InternalProtocol cmd = CID_CANIF_CMD_CTRL;
+ void *tx = reinterpret_cast<void *>(&pst_cmd_ctrl_msg);
+ size_t len = sizeof(pst_cmd_ctrl_msg);
+ PCSTR _notify_name = notify_name;
+ memset(tx, 0x0, len);
+
+ if (!Canif_IsCommand(cmd_id))
+ goto cleanup;
+
+ if (h_app == NULL)
+ goto cleanup;
+
+ if (rid == 0xFF) {
+ _notify_name = ""; // using dummy name;
+ }
+
+ if (!Canif_CheckNotifyName(_notify_name))
+ goto cleanup;
+
+ Canif_CopyNotifyName(pst_cmd_ctrl_msg.notifyName, _notify_name);
+ pst_cmd_ctrl_msg.ucRid = rid;
+ pst_cmd_ctrl_msg.ucCmdid = (uint8_t)cmd_id;
+
+ e_status = CanifMsgToSrv(h_app, cmd, len, tx);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ return l_ret;
+}
+
+CANIF_RET_API Canif_CommWatch(HANDLE h_app, PCSTR notify_name, CANID can_id,
+ DID did, uint16_t watch_time) {
+
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ CAN_COMM_WATCHEXT_MSG_DAT pst_comm_watch_msg;
+ PS_Communication_InternalProtocol cmd = CID_CANIF_COMM_WATCH;
+ void *tx = reinterpret_cast<void *>(&pst_comm_watch_msg);
+ size_t len = sizeof(pst_comm_watch_msg);
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ memset(tx, 0x0, len);
+
+ if (h_app == NULL)
+ goto cleanup;
+
+ if (!Canif_CheckNotifyName(notify_name))
+ goto cleanup;
+
+ if (!Canif_CheckCanID(can_id))
+ goto cleanup;
+
+ Canif_CopyNotifyName(pst_comm_watch_msg.notifyName, notify_name);
+ pst_comm_watch_msg.ulCanid = can_id;
+ pst_comm_watch_msg.ulDid = did;
+ pst_comm_watch_msg.ucIg = CAN_IG_COOPERATION_OFF;
+ pst_comm_watch_msg.usWatchTime = watch_time;
+
+ e_status = CanifMsgToSrv(h_app, cmd, len, tx);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ return l_ret;
+}
+
+CANIF_RET_API Canif_TransStart(HANDLE h_app, CANID can_id,
+ CAN_DATA_MASK *mask, CAN_DATA_BIT *dat, uint32_t freq) {
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ CAN_TRANS_START_MSG_DAT pst_trans_start;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ PS_Communication_InternalProtocol cmd = CID_CANIF_TX_BIT_START;
+ void *tx = reinterpret_cast<void *>(&pst_trans_start);
+ size_t len = sizeof(pst_trans_start);
+ memset(tx, 0x0, len);
+
+ if (h_app == NULL)
+ goto cleanup;
+
+ if (!Canif_CheckCanID(can_id))
+ goto cleanup;
+
+ if (!Canif_InitDataIsDefined21PF(can_id))
+ goto cleanup;
+
+ if (mask == NULL)
+ goto cleanup;
+
+ if (dat == NULL)
+ goto cleanup;
+
+ if (0xFFFF < freq)
+ goto cleanup;
+
+ pst_trans_start.id = can_id;
+ pst_trans_start.freq = freq;
+ memcpy(&pst_trans_start.mask.dat, mask->dat, sizeof(mask->dat));
+ memcpy(&pst_trans_start.dat.dat, dat->dat, sizeof(dat->dat));
+
+ e_status = CanifMsgToSrv(h_app, cmd, len, tx);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ return l_ret;
+}
+
+CANIF_RET_API Canif_DeliveryEraseAll(HANDLE h_app, PCSTR notify_name) {
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ HANDLE handle[NUM_OF_CANIF_PROTOCOL];
+ int i = 0;
+
+ for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) {
+ handle[i] = NULL;
+ }
+
+ if (NULL == h_app)
+ goto cleanup;
+
+ if (!Canif_CheckNotifyName(notify_name))
+ goto cleanup;
+
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) {
+ handle[i] = FrameworkunifiedMcOpenSender(h_app,
+ Canif_PidxTosname((enum CANIF_PROTOCOL_IDX)i));
+ if (!handle[i])
+ goto cleanup;
+ }
+
+ for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) {
+ e_status = FrameworkunifiedSendMsg(handle[i], CID_CANIF_DELIVERY_ERASE,
+ CANIF_NOTIFY_NAME_MAX_SIZE, (PCVOID)notify_name);
+ if (e_status != eFrameworkunifiedStatusOK)
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) {
+ if (handle[i] != NULL)
+ FrameworkunifiedMcClose(handle[i]);
+ }
+ return l_ret;
+}
+
diff --git a/peripheralservice/communication/server/Makefile b/peripheralservice/communication/server/Makefile
new file mode 100755
index 0000000..069c333
--- /dev/null
+++ b/peripheralservice/communication/server/Makefile
@@ -0,0 +1,96 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### add source path #############
+
+######### installed program #############
+INST_PROGS = communication
+
+######### installed library(*.a) #############
+
+######### installed shared library(*.so) #############
+
+######### compiled sources #############
+
+## from ./src/main
+communication_SRCS += ./src/main/communication_main.cpp
+communication_SRCS += ./src/main/communication_application.cpp
+
+## from ./src/threads
+communication_SRCS += ./src/threads/CAN_Thread.cpp
+communication_SRCS += ./src/threads/Thread_Common.cpp
+
+## from ./src/CAN/CommWatch/
+communication_SRCS += ./src/CAN/CommWatch/CAN_CommWatch.cpp
+
+## from ./src/CAN/Delivery/
+communication_SRCS += ./src/CAN/Delivery/CAN_Delivery.cpp
+
+## from ./src/CAN/TxMsg/
+communication_SRCS += ./src/CAN/TxMsg/CAN_TxMsg.cpp
+
+######### add source path #############
+VPATH += \
+ ./src/CAN/Command \
+ ./src/CAN/CommWatch \
+ ./src/CAN/Delivery \
+ ./src/CAN/main \
+ ./src/CAN/TxMsg \
+ ./src/main \
+
+
+######### add include path #############
+CPPFLAGS += \
+ -I./../client_can/include \
+ -I./include \
+ -I./include/CAN/Command \
+ -I./include/CAN/CommWatch \
+ -I./include/CAN/Delivery \
+ -I./include/CAN/main \
+ -I./include/CAN/TimerCtrl \
+ -I./include/CAN/TxMsg \
+ -I./include/main \
+ -I./include/threads \
+ -I./include/private
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fdata-sections -ffunction-sections -DFLG_CORE
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+######### add library path #############
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--gc-sections
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+LDLIBS += -Wl,-Bdynamic -lrt
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lcan_hal
+
+include ../../peripheral_service.mk
diff --git a/peripheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h b/peripheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h
new file mode 100755
index 0000000..16aa54f
--- /dev/null
+++ b/peripheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_
+#include <native_service/frameworkunified_types.h>
+#include <peripheral_service/Canif_API.h>
+#include <vector>
+#include <map>
+#include <string>
+#include "CommWatchCommon.h"
+
+typedef struct {
+ char notify_name[MAX_NAME_SIZE_APP];
+ uint32_t data_id;
+ uint8_t comm_watch_flag;
+ uint16_t set_time;
+ uint16_t timer_cnt;
+} CAN_COMM_WATCH_VAL;
+
+typedef std::multimap<CANID, CAN_COMM_WATCH_VAL> CAN_CommWatchTable;
+typedef std::pair<const CANID, CAN_COMM_WATCH_VAL> CAN_CommWatchTablePair;
+typedef CAN_CommWatchTable::iterator CAN_CommWatchTableIt;
+
+void CANCommWatchInit(void);
+EFrameworkunifiedStatus CANCommWatch(HANDLE h_app);
+EFrameworkunifiedStatus CANCommWatchTimeout(HANDLE h_app);
+void CANCommWatchClear(HANDLE h_app, CANID id);
+#endif // COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_
diff --git a/peripheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h b/peripheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h
new file mode 100755
index 0000000..7306214
--- /dev/null
+++ b/peripheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h
@@ -0,0 +1,22 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_COMMWATCH_COMMON_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_COMMWATCH_COMMON_H_
+#define CAN_COMM_OFF 0x00
+#define CAN_COMM_NORMAL 0x01
+#define CAN_COMM_STOP 0x02
+#endif
diff --git a/peripheralservice/communication/server/include/CAN/Command/CAN_Command.h b/peripheralservice/communication/server/include/CAN/Command/CAN_Command.h
new file mode 100755
index 0000000..43abcdc
--- /dev/null
+++ b/peripheralservice/communication/server/include/CAN/Command/CAN_Command.h
@@ -0,0 +1,21 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_
+EFrameworkunifiedStatus CANCommandTransmission(HANDLE h_app);
+RET_CAN CANCommandTxRslt(HANDLE h_app, CAN_MSG_DATA*);
+#endif // COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_
diff --git a/peripheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h b/peripheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h
new file mode 100755
index 0000000..01f2e2f
--- /dev/null
+++ b/peripheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_
+#include <native_service/frameworkunified_types.h>
+#include "CAN_Thread.h"
+#include <vector>
+#include <map>
+#include <string>
+#include <can_hal.h>
+
+typedef std::multimap<CANID, std::string> CAN_DeliveryEntryList;
+typedef CAN_DeliveryEntryList::iterator CAN_DeliveryEntryListIt;
+typedef std::pair<const CANID, std::string> CAN_DeliveryEntryListPair;
+
+void CANDeliveryInit(void);
+bool CANDeliveryInsert(CANID canid, std::string s);
+EFrameworkunifiedStatus CANDeliveryRcvProcess(HANDLE h_app, CanMessage *msg);
+EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app);
+EFrameworkunifiedStatus CANClearEntry(HANDLE h_app);
+EFrameworkunifiedStatus CANDeliverySndMsg(HANDLE h_app, CANID ul_canid, uint8_t n_ta,
+ uint8_t uc_dlc, const uint8_t *puc_data,
+ PS_CommunicationProtocol cid, enum CanIfEchoBackFlags flag = CANIF_PURERECV);
+EFrameworkunifiedStatus CANCommandDeliveryRcvProcess(HANDLE h_app,
+ CanMessage *msg, uint8_t cmd);
+#endif // COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_
diff --git a/peripheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h b/peripheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h
new file mode 100755
index 0000000..ae0302c
--- /dev/null
+++ b/peripheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h
@@ -0,0 +1,137 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERYDATA_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERYDATA_H_
+/******************************************************************************
+ * FILE :CAN_DeliveryData.h
+ * SYSTEM :_CWORD107_
+ * SUBSYSTEM :
+-----------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <peripheral_service/Canif_API.h>
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/* Data size relationship */
+#define CAN_DELIVERY_LIST_NUM 400 /* Maximum number of delivery destination management tables */
+#define CAN_DELIVERY_CANID_LIST_NUM 150 /* Delivery CAN ID control table max. */
+
+#define CAN_EXRCV_DATA_NUM 22 /* CAN Extended Reception Notification CAN Maximum Number of Data */
+#define CAN_EXRCV_DATA_SIZE 11 /* CAN Extended Reception Notification CAN Data Size */
+#define CAN_EXRCV_CANNUM_SIZE 1 /* CAN Extended Reception Notification CAN Data Number Size */
+#define CAN_EXRCV_DLC_MIN 1 /* CAN Extended Reception Notification DLC Minimum Value */
+#define CAN_EXRCV_DLC_MAX 8 /* CAN Extended Reception Notification DLC Maximum Value */
+
+/* Flag relationship */
+#define CAN_DELIVERY_OFF 0 /* Stopping data delivery */
+#define CAN_DELIVERY_ON 1 /* Data delivery in progress */
+
+/* CANDataControl code relationship used in the delivery relationship */
+#define CAN_DELIVERYLIST_STOP_CODE 0xFFFF /* Shipping Destination Management Table Stop Code */
+
+#define CAN_CANIDLIST_EMPTY 0xFFFF /* Availability of CAN ID control table */
+/************************************************************************
+* Struct definitions
+************************************************************************/
+/***************************************************
+* TAG : CAN_DELIVERY_DAT
+* ABSTRACT : Destination management table structure (1 item)
+* (CAN internal data management table)
+****************************************************/
+typedef struct { /* Type definition of delivery destination management data (1 item) */
+ CANID ul_canid; /* CAN ID */
+ char notify_name[MAX_NAME_SIZE_APP]; /* Destination thread name */
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ uint8_t uc_delivery_on; /* Delivery operation */
+ uint8_t reserve1; /* Reserved */
+ uint16_t us_link_id; /* Link ID */
+ uint8_t reserve2[2]; /* Reserved */
+} CAN_DELIVERY_DAT;
+
+/***************************************************
+* TAG : CAN_DELIVERY_LIST_DAT
+* ABSTRACT : Destination management table structure (all)
+* (CAN internal data management table)
+****************************************************/
+typedef struct { /* Type definition of the shipping management table */
+ uint16_t us_entry_num; /* Registered number */
+ uint8_t reserve[2]; /* Reserved */
+ CAN_DELIVERY_DAT st_list[CAN_DELIVERY_LIST_NUM]; /* Delivery destination management data */
+} CAN_DELIVERY_LIST_DAT;
+
+/***************************************************
+* TAG : CAN_DELIVERY_SPACE_DAT
+* ABSTRACT : Free space management structure in the destination management table (all)
+* (CAN internal data management table free space management table)
+****************************************************/
+typedef struct { /* Type definitions for free space management tables */
+ uint16_t space_num; /* Number of free spaces */
+ uint16_t index_list[CAN_DELIVERY_LIST_NUM]; /* Free space index list */
+} CAN_DELIVERY_SPACE_DAT;
+
+/***************************************************
+* TAG : CAN_CANID_DAT
+* ABSTRACT : Transport CAN ID control table structures (1 item)
+* (CAN internal data management table)
+****************************************************/
+typedef struct { /* Defining the type of delivery destination CAN ID (1 item) */
+ CANID ul_canid; /* CAN ID */
+ uint16_t us_start_id; /* Start ID */
+ uint16_t us_end_id; /* End ID */
+ uint16_t us_data_num; /* Number of data items */
+ uint8_t reserve[2]; /* Reserved */
+} CAN_CANID_DAT;
+
+/***************************************************
+* TAG : CAN_CANID_LIST_DAT
+* ABSTRACT : Delivery CAN ID control table structures (all)
+* (CAN internal data management table)
+****************************************************/
+typedef struct { /* Type definitions for the target CAN ID administration table */
+ uint16_t us_entry_num; /* Registered number */
+ uint8_t reserve[2]; /* Reserved */
+ CAN_CANID_DAT st_list[CAN_DELIVERY_CANID_LIST_NUM]; /* Shipping CAN ID */
+} CAN_CANID_LIST_DAT;
+
+/***************************************************
+* TAG : CAN_DELIVERY_SND_DAT
+* ABSTRACT : Destination thread name for sending a message of delivery data
+* (CAN-internal Work)
+****************************************************/
+/* Type definition of the target thread name list data to which the message is sent */
+typedef struct {
+ int32_t i_num; /* Number of messages sent */
+ char notify_name[CAN_DELIVERY_LIST_NUM][MAX_NAME_SIZE_APP]; /* Destination thread name */
+} CAN_DELIVERY_SND_DAT;
+
+typedef struct {
+ CAN_DELIVERY_LIST_DAT* p_dlvry_list;
+ CAN_DELIVERY_SPACE_DAT* p_dlvry_space;
+ CAN_CANID_LIST_DAT* p_canid_list;
+ CAN_DELIVERY_SND_DAT* p_dlvry_snd;
+} CAN_STRUCT_PTR;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void CANDeliveryDataInit(void); /* CANDataDelivery Management Data Initialization Process */
+EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app); /* CANDataDelivery registration process */
+void CANDeliveryBufferOut(FILE* fp_log); /* CAN shipping table log output processing */
+EFrameworkunifiedStatus CANClearEntry(HANDLE h_app);
+
+#endif // COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERYDATA_H_
diff --git a/peripheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h b/peripheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h
new file mode 100755
index 0000000..dc4f6e8
--- /dev/null
+++ b/peripheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_
+#include <vector>
+#include <map>
+#include <string>
+#include <can_hal.h>
+#include "CAN_Thread.h"
+#include "API_Local_Common.h"
+#include "Canif_API_Local.h"
+
+
+#define CAN_OPC_PAC_RX 0x00
+#define CAN_OPC_COMMAND_STARTUP_FIN_REQ_TX 0x00 // CAN start completion notification request transmission
+#define CAN_OPC_COMMAND_MRST_INFO_REQ_TX 0x01 // CAN master reset information notification request transmission
+#define CAN_OPC_COMMAND_VERSION_REQ_TX 0x02 // CAN Version Request Send
+#define CAN_OPC_COMMAND_CONNECTION_NODE_REQ_TX 0x03 // CAN connection node notification request transmission
+#define CAN_OPC_COMMAND_BUS_STATUS_REQ_TX 0x04 // CAN bus status notification request transmission
+#define CAN_OPC_COMMAND_FUELCALC_REQ_TX 0x05 // CAN section flame reset response transmission
+#define CAN_OPC_COMMAND_STARTUP_FIN_RESP_RX 0x06 // CAN startup completion notice received
+#define CAN_OPC_COMMAND_MRST_INFO_RESP_RX 0x07 // CAN Master Reset Information Notification Reception
+#define CAN_OPC_COMMAND_VERSION_RESP_RX 0x08 // CAN Version Response Reception
+#define CAN_OPC_COMMAND_CONNECTION_NODE_RESP_RX 0x09 // Receive CAN Connection Node Notification Response
+#define CAN_OPC_COMMAND_BUS_STATUS_RESP_RX 0x10 // CAN Bus Status Notification Response Reception
+#define CAN_OPC_COMMAND_FUELCALC_RST_REQ_RX 0x11 // RECEIVE REQUEST FREE OF CAN SECTION
+
+typedef struct {
+ uint8_t rid;
+ char notify_name[CANIF_NOTIFY_NAME_MAX_SIZE + 1];
+} CAN_SEND_STATUS_DAT;
+
+void CANTxMsgInit(void);
+EFrameworkunifiedStatus CANTxMsg(HANDLE h_app);
+EFrameworkunifiedStatus CANTxMsgBit(HANDLE h_app);
+void CANCommandSetFuelCalcRstReq(void);
+EFrameworkunifiedStatus CANTxMsgCommand(HANDLE h_app);
+EFrameworkunifiedStatus CANSndStsProcess(HANDLE h_app, CanSendResult *rcv_msg,
+ PS_CommunicationProtocol cid);
+#endif // COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_
diff --git a/peripheralservice/communication/server/include/com_error_type.h b/peripheralservice/communication/server/include/com_error_type.h
new file mode 100755
index 0000000..4d15f82
--- /dev/null
+++ b/peripheralservice/communication/server/include/com_error_type.h
@@ -0,0 +1,21 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_
+#define COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_
+const int32_t RET_NORMAL = 0;
+const int32_t RET_ERROR = -1;
+#endif // COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_
diff --git a/peripheralservice/communication/server/include/main/communication_cid.h b/peripheralservice/communication/server/include/main/communication_cid.h
new file mode 100755
index 0000000..d817624
--- /dev/null
+++ b/peripheralservice/communication/server/include/main/communication_cid.h
@@ -0,0 +1,33 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file has been generated automatically.
+ * User hand written code entry is not allowed. Do not modify the file content.
+ *
+ */
+#ifndef COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_
+#define COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_
+
+#define LAN_SERVICE_MAIN "Communication"
+
+typedef enum PSCommunicationServiceProtocol {
+ CID_COMMSYS_MSG_BASE = PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD, // Base command id.
+ CID_COMMSYS_CAN_READY, // CAN_COM_PROT->Communication
+ CID_COMMSYS_TIMEOUT, // Communication->CAN
+} PS_CommunicationServiceProtocol;
+
+#endif // COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_
diff --git a/peripheralservice/communication/server/include/main/communication_communicationlog.h b/peripheralservice/communication/server/include/main/communication_communicationlog.h
new file mode 100755
index 0000000..37016ad
--- /dev/null
+++ b/peripheralservice/communication/server/include/main/communication_communicationlog.h
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+/// \brief
+///
+///
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ * This file has been generated automatically.
+ * User hand written code entry is not allowed. Do not modify the file content.
+ *
+ */
+#ifndef COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_COMMUNICATIONLOG_H_
+#define COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_COMMUNICATIONLOG_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_APP ZONEMASK(13)
+#define ZONE__CWORD83__DEBUG ZONEMASK(14)
+#define ZONE_CAN_DEBUG ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_COMMSYS ZONEMASK(17)
+#define ZONE_ICR ZONEMASK(18)
+#define ZONE_ICR_TABLE ZONEMASK(19)
+#define ZONE_TRANSLOG ZONEMASK(20)
+#define ZONE_LOOPBACK ZONEMASK(22)
+#define ZONE_ENTRY ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_DEBUG ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ZONE_COMM_SYS_STS ZONEMASK(107)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "StateMachine Example"
+#define ZONE_TEXT_14 "_CWORD83_"
+#define ZONE_TEXT_15 "CAN"
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 "COMSYS"
+#define ZONE_TEXT_18 "ICR"
+#define ZONE_TEXT_19 "ICR_TABLE"
+#define ZONE_TEXT_20 "TRANSLOG"
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 "Debug"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_APP, ZONE_ERR, ZONE_WARN, ZONE_INFO, ZONE_COMM_SYS, ZONE_CAN_FILTER, ZONE_COMM_SYS_STS
+#endif
+
+#endif // COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_COMMUNICATIONLOG_H_
diff --git a/peripheralservice/communication/server/include/main/communication_version.h b/peripheralservice/communication/server/include/main/communication_version.h
new file mode 100755
index 0000000..7cd2c3b
--- /dev/null
+++ b/peripheralservice/communication/server/include/main/communication_version.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file version.h
+/// \ingroup
+/// \version 0.1.0
+/// \brief
+///
+/// \todo
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+// File name : version.h
+// Module : Communication
+// Description : TODO INSERT
+// Scope : < example:Legacy Architecture>
+// Platform : _CWORD3_002 Platform
+//
+// Customer :
+// System :
+// Reference :
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_VERSION_H_
+#define COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_VERSION_H_
+
+#define MAJORNO 0x01
+#define MINORNO 0x00
+#define REVISION 0x00
+
+#endif // COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_VERSION_H_
diff --git a/peripheralservice/communication/server/include/peripheral_service/communication.h b/peripheralservice/communication/server/include/peripheral_service/communication.h
new file mode 100755
index 0000000..94f5544
--- /dev/null
+++ b/peripheralservice/communication/server/include/peripheral_service/communication.h
@@ -0,0 +1,29 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file communication.h
+ * @~english
+ * @brief communication unit header
+ */
+
+#ifndef PERIPHERALSERVICE_COMMUNICATION_H_ // NOLINT(build/header_guard)
+#define PERIPHERALSERVICE_COMMUNICATION_H_ // NOLINT(build/header_guard)
+
+#include <peripheral_service/communication_notifications.h>
+#include <peripheral_service/communication_can.h>
+
+#endif // PERIPHERALSERVICE_COMMUNICATION_H_
diff --git a/peripheralservice/communication/server/include/peripheral_service/communication_notifications.h b/peripheralservice/communication/server/include/peripheral_service/communication_notifications.h
new file mode 100755
index 0000000..9c207f3
--- /dev/null
+++ b/peripheralservice/communication/server/include/peripheral_service/communication_notifications.h
@@ -0,0 +1,28 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file communication_notifications.h
+ * @~english
+ * @brief Defination of communication notification
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_PERIPHERAL_SERVICE_COMMUNICATION_NOTIFICATIONS_H_
+#define COMMUNICATION_SERVER_INCLUDE_PERIPHERAL_SERVICE_COMMUNICATION_NOTIFICATIONS_H_
+
+/*! @~english Defination of communication notification */
+#define NTFY_Communication_Availability "Communication/Availability"
+
+#endif // COMMUNICATION_SERVER_INCLUDE_PERIPHERAL_SERVICE_COMMUNICATION_NOTIFICATIONS_H_
diff --git a/peripheralservice/communication/server/include/peripheral_service/ps_services.h b/peripheralservice/communication/server/include/peripheral_service/ps_services.h
new file mode 100755
index 0000000..fd556d6
--- /dev/null
+++ b/peripheralservice/communication/server/include/peripheral_service/ps_services.h
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!------------------------------------------------------------------------------------------------
+ * @file ps_services.h
+ * @~english
+ * @brief Defines the names of the available peripheral services.
+ */
+
+#ifndef PERIPHERALSERVICE__CWORD121_SHADOW_CLIENT_INCLUDE_PERIPHERAL_SERVICE_PS_SERVICES_H_ // NOLINT(build/header_guard)
+#define PERIPHERALSERVICE__CWORD121_SHADOW_CLIENT_INCLUDE_PERIPHERAL_SERVICE_PS_SERVICES_H_ // NOLINT(build/header_guard)
+
+/**
+ * @file ps_services.h
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+
+/*------------------------------------------------------------------------------
+ * define
+ *----------------------------------------------------------------------------*/
+#define SERVICE_PSMSHADOW "PS_PSMShadow"
+/*!< @~english Define the name of SERVICE_PSMSHADOW */
+
+#define SERVICE_IPC "PS_IPC_DISP"
+/*!< @~english Define the name of SERVICE_IPC */
+
+#define SERVICE_IPC_DISP "PS_IPC"
+/*!< @~english Define the name of SERVICE_IPC_DISP */
+
+#define SERVICE_IPCTESTAPP "PS_IPC_TestApp"
+/*!< @~english Define the name of SERVICE_IPCTESTAPP */
+
+#define SERVICE_HMIKEYHANDLER "PS_KeyHandler"
+/*!< @~english PS_KeyHandler name SERVICE_HMIKEYHANDLER */
+
+#define SERVICE_MP_SHADOW "PS_IPC_MP_Shadow"
+/*!< @~english Define the name of SERVICE_MP_SHADOW */
+
+#define SERVICE_SENSORSHADOW "PS_SensorShadow"
+/*!< @~english Define the name of SERVICE_SENSORSHADOW */
+
+#define SERVICE_COMMUNICATIONDEBUGDUMPTEST "PS_COMMUNICATIONDebugDumpTest"
+/*!< @~english Define the name of SERVICE_COMMUNICATIONDEBUGDUMPTEST */
+
+#define SERVICE_PSMSHADOWTEST "PS_TEST_PSMShadow"
+/*!< @~english Define the name of SERVICE_PSMSHADOWTEST */
+
+#define SERVICE_LOGGERSHADOW "PS_LoggerShadow"
+/*!< @~english Define the name of SERVICE_LOGGERSHADOW */
+
+#define SERVICE_SOFTWAREUPDATESHADOW "PS_SoftwareUpdateShadow"
+/*!< @~english Define the name of SERVICE_SOFTWAREUPDATESHADOW */
+
+// #define SERVICE_LINSHADOW "LINShadowService"
+///*!< @~english Define the name of SERVICE_LINSHADOW */
+
+// #define SERVICE_RTCSHADOW "RTCShadowService"
+///*!< @~english Define the name of SERVICE_RTCSHADOW */
+
+// #define SERVICE_HBSHADOW "HBShadowService"
+///*!< @~english Define the name of SERVICE_HBSHADOW */
+
+// #define SERVICE_HBDUMMY "HBDummyService"
+///*!< @~english Define the name of SERVICE_HBDUMMY */
+
+// #define SERVICE_DISPLAYSHADOW "DisplayShadowService"
+///*!< @~english Define the name of SERVICE_DISPLAYSHADOW */
+
+// #define SERVICE_HMIALDUMMY "HMIALDummyService"
+///*!< @~english Define the name of SERVICE_HMIALDUMMY */
+
+/** @}*/ // end of peripheral_service
+/** @}*/ // end of BaseSystem
+
+#endif // PERIPHERALSERVICE__CWORD121_SHADOW_CLIENT_INCLUDE_PERIPHERAL_SERVICE_PS_SERVICES_H_ // NOLINT(build/header_guard)
diff --git a/peripheralservice/communication/server/include/threads/CAN_Thread.h b/peripheralservice/communication/server/include/threads/CAN_Thread.h
new file mode 100755
index 0000000..b6960ef
--- /dev/null
+++ b/peripheralservice/communication/server/include/threads/CAN_Thread.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_
+#define COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_
+#include <peripheral_service/Canif_API.h>
+#include <stdlib.h>
+
+#include "com_error_type.h"
+#include "communication_communicationlog.h"
+
+#if 0
+#define CAN_TX_COMMAND_SIZE (CAN_TRX_HEADER_SIZE + CAN_TX_OPERAND_SIZE)
+
+#define CAN_RX_CANDATA_SIZE CAN_DATA_SIZE /* Receive CANData(DATA#1 ~ #x)size */
+/* Reserve the structure if it is not a multiple of 4. */
+#define CAN_TX_CANDATA_SIZE CAN_DATA_SIZE /* Send CANData(DATA#1 ~ #x)size */
+/* Reserve the structure if it is not a multiple of 4. */
+#define CAN_RX_OPERAND_SIZE (CAN_TRX_CANID_SIZE + CAN_TRX_DLC_SIZE + CAN_RX_CANDATA_SIZE)
+#define CAN_TX_OPERAND_SIZE (CAN_TRX_CANID_SIZE + CAN_TRX_DLC_SIZE + CAN_TX_CANDATA_SIZE) // NOLINT(whitespace/line_length)
+/* Send operand size */
+
+#endif
+
+#define CAN_CMDSND_DATA_SIZE 0 /* Command transmission data section size (CAN command control) */
+
+#define CAN_TX_CMD_DELIVERY_SIZE 4 /* Transmitting CAN Command Delivery Data Size Common Block */
+#define CAN_TX_CMD_FUELCALC_RST_SIZE 0 /* Transmit CAN Command Delivery Data Size CAN Section Burn Cost Reset Request Receive Data */
+#define CAN_TX_CMD_STARTUP_FIN_SIZE 3 /* Transmit CAN Command Delivery Data Size CAN Startup Completion Notification Data */
+#define CAN_TX_CMD_MRST_INFO_SIZE 33 /* Transmit CAN Command Delivery Data Size CAN Master Reset Information Notification Receive Data */
+#define CAN_TX_CMD_VERSION_SIZE 4 /* Transmit CAN Command Delivery Data Size CAN Version Response Receive Data */
+
+#define CAN_TRX_HEADER_SIZE 7 /* Size of send/receive header section (data length excluding operands) */
+#define CAN_TRX_CANID_SIZE 4 /* Transmit/Receive CAN ID Size */
+#define CAN_TRX_DLC_SIZE 1 /* Transmit/Receive DLC Data Size */
+typedef CANIF_RET_API RET_CAN;
+EFrameworkunifiedStatus CANCallbackForTimeOut(HANDLE);
+#endif // COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_ \ No newline at end of file
diff --git a/peripheralservice/communication/server/include/threads/Thread_Common.h b/peripheralservice/communication/server/include/threads/Thread_Common.h
new file mode 100755
index 0000000..6cda5aa
--- /dev/null
+++ b/peripheralservice/communication/server/include/threads/Thread_Common.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef COMMUNICATION_SERVER_INCLUDE_THREADS_THREAD_COMMON_H_
+#define COMMUNICATION_SERVER_INCLUDE_THREADS_THREAD_COMMON_H_
+#include <stdint.h>
+#include <can_hal.h>
+#include <string>
+#include <sstream>
+#include <iostream>
+
+const int32_t CAN_AVAILABILITY = 0x1;
+
+void CommonInit(void);
+HANDLE CommonFindSender(HANDLE h_app, std::string s);
+BOOL CommGetAvailabilityCurrent(int32_t current);
+void CommSetAvailabilityCurrent(int32_t current);
+void CommClrAvailabilityCurrent(int32_t current);
+EFrameworkunifiedStatus CommonStartNotify(HANDLE h_app, PCSTR cmd);
+EFrameworkunifiedStatus CommonThreadStart(HANDLE h_app, const FrameworkunifiedProtocolCallbackHandler *cb,
+ UI_32 count, PCSTR cmd, EFrameworkunifiedStatus (*open_func)(HANDLE));
+EFrameworkunifiedStatus CommonThreadStop(HANDLE h_app, const PUI_32 cb, UI_32 count,
+ PCSTR cmd, EFrameworkunifiedStatus (*close_func)(HANDLE));
+EFrameworkunifiedStatus CommonCanHalErrorNotify(HANDLE h_app);
+
+static inline EFrameworkunifiedStatus ConvRet(CANHAL_RET_API ret) {
+ return ((ret != CANHAL_RET_NORMAL) ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK);
+}
+std::string MessageDataOutputLog(uint8_t *msg_data, uint32_t len);
+#endif \ No newline at end of file
diff --git a/peripheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp b/peripheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp
new file mode 100755
index 0000000..2ece107
--- /dev/null
+++ b/peripheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp
@@ -0,0 +1,240 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "CAN_CommWatch.h"
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <peripheral_service/Canif_API.h>
+#include <utility>
+#include <map>
+#include <string>
+#include "CAN_Thread.h"
+#include "Thread_Common.h"
+
+static CAN_CommWatchTable g_map_comm_watch_list_can;
+
+void CANCommWatchInit(void) {
+ g_map_comm_watch_list_can.clear();
+ return;
+}
+
+static CAN_CommWatchTableIt CANCommWatchFind(CANID k, CAN_COMM_WATCH_VAL *val) {
+ std::pair<CAN_CommWatchTableIt, CAN_CommWatchTableIt> range;
+ CAN_CommWatchTableIt it;
+ bool found = false;
+
+ range = g_map_comm_watch_list_can.equal_range(k);
+ for (it = range.first; it != range.second; it++) {
+ if (!memcmp(&(it->second.notify_name),
+ val->notify_name, sizeof(val->notify_name))) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ it = g_map_comm_watch_list_can.end();
+
+ return it;
+}
+
+static bool CANCommWatchInsert(CANID k, CAN_COMM_WATCH_VAL *val) {
+ CAN_CommWatchTableIt it = CANCommWatchFind(k, val);
+ CAN_CommWatchTablePair p = std::make_pair((const CANID)k, *val);
+ bool inserted = false;
+
+ if (it == g_map_comm_watch_list_can.end()) {
+ g_map_comm_watch_list_can.insert(p);
+ inserted = true;
+ }
+ return inserted;
+}
+
+static void CANCommWatchUpdate(HANDLE h_app, CANID key,
+ CAN_COMM_WATCH_VAL *val) {
+ if (CANCommWatchInsert(key, val)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch : "
+ "Entry (CANID=%x, DataID=%x, dst=%s, time=%d, cnt=%lu)",
+ key, val->data_id,
+ val->notify_name, val->set_time,
+ g_map_comm_watch_list_can.size());
+ } else {
+ CAN_CommWatchTableIt it = CANCommWatchFind(key, val);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch : Update the time "
+ "(CANID=%x, DataID=%x, dst=%s, time:%d -> %d, cnt =%lu)",
+ key, val->data_id, val->notify_name,
+ it->second.set_time, val->set_time,
+ g_map_comm_watch_list_can.size());
+ it->second.comm_watch_flag = val->comm_watch_flag;
+ it->second.set_time = val->set_time;
+ it->second.timer_cnt = val->timer_cnt;
+ it->second.data_id = val->data_id;
+ }
+
+ return;
+}
+
+static void CANCommWatchStop(HANDLE h_app, CANID key,
+ CAN_COMM_WATCH_VAL *val) {
+ CAN_CommWatchTableIt it = CANCommWatchFind(key, val);
+ if (it != g_map_comm_watch_list_can.end()) {
+ g_map_comm_watch_list_can.erase(it);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch : Stop the commwatch"
+ "(CANID=%x, dst=%s, cnt=%lu)",
+ key, val->notify_name, g_map_comm_watch_list_can.size());
+ }
+
+ return;
+}
+
+EFrameworkunifiedStatus CANCommWatch(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanCommWatch");
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_COMM_WATCHEXT_MSG_DAT rcv_msg;
+ CANID key;
+ CAN_COMM_WATCH_VAL val;
+ CAN_CommWatchTableIt it;
+
+ memset(&rcv_msg, 0, sizeof(rcv_msg));
+ memset(&val, 0, sizeof(val));
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ }
+ goto cleanup;
+ }
+
+ // Create search data
+ key = rcv_msg.ulCanid;
+ snprintf(val.notify_name, sizeof(val.notify_name), "%s", rcv_msg.notifyName);
+ val.data_id = rcv_msg.ulDid;
+ val.comm_watch_flag = CAN_COMM_NORMAL;
+ val.set_time = rcv_msg.usWatchTime;
+ val.timer_cnt = rcv_msg.usWatchTime;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "CAN CommWatch : dst=%s, CANID=%x, dataID=%x, time=%d",
+ rcv_msg.notifyName,
+ rcv_msg.ulCanid,
+ rcv_msg.ulDid, rcv_msg.usWatchTime);
+
+ if (0 == rcv_msg.usWatchTime) {
+ CANCommWatchStop(h_app, key, &val);
+ } else {
+ CANCommWatchUpdate(h_app, key, &val);
+ }
+ e_status = eFrameworkunifiedStatusOK;
+cleanup:
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANCommWatchSndMsg(HANDLE h_app,
+ CAN_COMM_WATCH_VAL *v, uint32_t cid) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_MSG_COMM_WATCHSTS msg;
+ HANDLE h_client = NULL;
+
+ memset(&msg, 0, sizeof(msg));
+ msg.hdr.hdr.cid = (uint16_t)cid;
+ msg.hdr.hdr.msgbodysize = sizeof(CAN_MSG_COMM_WATCHSTS_DAT);
+ msg.hdr.hdr.rid = 0;
+ msg.data.ulDid = v->data_id;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%x ulDid=%x",
+ msg.hdr.hdr.cid, msg.hdr.hdr.msgbodysize, msg.data.ulDid);
+
+ h_client = CommonFindSender(h_app, v->notify_name);
+ if (!h_client){
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CommonFindSender failed");
+ goto cleanup;
+ }
+
+ e_status = FrameworkunifiedSendMsg(h_client, cid, sizeof(msg), &msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__,
+ "FrameworkunifiedSendMSg Error(e_status:%d to %s)",
+ e_status, v->notify_name);
+ goto cleanup;
+ }
+
+ e_status = eFrameworkunifiedStatusOK;
+cleanup:
+ return e_status;
+}
+
+static void CANCommWatchTimeoutCore(HANDLE h_app, CAN_COMM_WATCH_VAL *v) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+
+ if (CAN_COMM_NORMAL != v->comm_watch_flag)
+ return;
+
+ if (v->timer_cnt != 0)
+ v->timer_cnt--;
+
+ if (v->timer_cnt != 0)
+ return;
+
+ e_status = CANCommWatchSndMsg(h_app, v, CID_CAN_COMM_STOP);
+ if (eFrameworkunifiedStatusOK == e_status) {
+ v->comm_watch_flag = CAN_COMM_STOP;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CANCommWatchSndMsg failed");
+ // retry at next timeout.
+ }
+}
+
+EFrameworkunifiedStatus CANCommWatchTimeout(HANDLE h_app) {
+ CAN_CommWatchTableIt it;
+
+ for (it = g_map_comm_watch_list_can.begin();
+ it != g_map_comm_watch_list_can.end(); it++) {
+ CANCommWatchTimeoutCore(h_app, &(it->second));
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static void CANCommWatchClearCore(HANDLE h_app, CANID id,
+ CAN_COMM_WATCH_VAL *v) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+
+ v->timer_cnt = v->set_time;
+
+ if (CAN_COMM_STOP != v->comm_watch_flag)
+ return;
+
+ e_status = CANCommWatchSndMsg(h_app, v, CID_CAN_COMM_RESTORE);
+ if (eFrameworkunifiedStatusOK == e_status) {
+ v->comm_watch_flag = CAN_COMM_NORMAL;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch Clear : CANID=%x", id);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CANCommWatchSndMsg failed");
+ // retry at next timeout.
+ }
+}
+
+void CANCommWatchClear(HANDLE h_app, CANID id) {
+ std::pair<CAN_CommWatchTableIt, CAN_CommWatchTableIt> range;
+ CAN_CommWatchTableIt it;
+
+ range = g_map_comm_watch_list_can.equal_range(id);
+ for (it = range.first; it != range.second; it++) {
+ CANCommWatchClearCore(h_app, id, &(it->second));
+ }
+}
diff --git a/peripheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp b/peripheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp
new file mode 100755
index 0000000..b991431
--- /dev/null
+++ b/peripheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp
@@ -0,0 +1,405 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "CAN_Delivery.h"
+
+#include <can_hal.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <peripheral_service/Canif_API.h>
+#include <can_hal.h>
+#include <utility>
+#include <map>
+#include <string>
+#include "CAN_TxMsg.h"
+#include "CAN_CommWatch.h"
+#include "Canif_API_Local.h"
+#include "API_Local_Common.h"
+#include "Thread_Common.h"
+
+static CAN_DeliveryEntryList g_map_delivery_list_can;
+// Member of g_msg_rx_msg exist as long as communication exists.
+static std::map<CANID, CanMessage *> g_can_rx_msg;
+
+void CANDeliveryInit(void) {
+ g_map_delivery_list_can.clear();
+ return;
+}
+
+static CanMessage *CANMsgFind(CANID k) {
+ std::map<CANID, CanMessage *>::iterator it;
+
+ it = g_can_rx_msg.find(k);
+ if (it == g_can_rx_msg.end())
+ return NULL;
+ return it->second;
+}
+
+static void CANMsgInsert(CANID k, CanMessage *msg) {
+ CanMessage *latest = CANMsgFind(k);
+ if (!latest) {
+ latest = new CanMessage();
+ }
+ g_can_rx_msg[k] = latest;
+ memcpy(latest, msg, sizeof(CanMessage));
+}
+
+static CAN_DeliveryEntryListIt CANDeliveryFind(CANID canid, std::string s) {
+ std::pair<CAN_DeliveryEntryListIt, CAN_DeliveryEntryListIt> range;
+ CAN_DeliveryEntryListPair p = std::make_pair(canid, s);
+ CAN_DeliveryEntryListIt it;
+ bool found = false;
+ range = g_map_delivery_list_can.equal_range(canid);
+ for (it = range.first; it != range.second; ++it) {
+ if (*it == p) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ it = g_map_delivery_list_can.end();
+
+ return it;
+}
+
+bool CANDeliveryInsert(CANID canid, std::string s) {
+ CAN_DeliveryEntryListIt it = CANDeliveryFind(canid, s);
+ CAN_DeliveryEntryListPair p = std::make_pair(canid, s);
+ bool inserted = false;
+
+ if (it == g_map_delivery_list_can.end()) {
+ g_map_delivery_list_can.insert(p);
+ inserted = true;
+ }
+
+ return inserted;
+}
+
+static EFrameworkunifiedStatus CANDeliverySndCmdSingle(HANDLE h_app, CANID cmd,
+ CanMessage *msg, std::string dest) {
+ CAN_MSG_CANCMD st_delivery_msg;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ HANDLE h_client;
+ uint16_t len = 0;
+
+ // Create delivery data
+ memset(&st_delivery_msg, 0, sizeof(st_delivery_msg));
+ switch (cmd) {
+ case CAN_CMDID_FUELCALC_RST_REQ_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_FUELCALC_RST_SIZE;
+ break;
+ case CAN_CMDID_STARTUP_FIN_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_STARTUP_FIN_SIZE;
+ break;
+ case CAN_CMDID_MRST_INFO_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_MRST_INFO_SIZE;
+ break;
+ case CAN_CMDID_VERSION_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_VERSION_SIZE;
+ break;
+ case CAN_CMDID_CONNECTION_NODE_RESP_RX:
+ len = (uint16_t)(CAN_TX_CMD_DELIVERY_SIZE + msg->data[0] + 1);
+ break;
+ default:
+ return e_status;
+ }
+ st_delivery_msg.hdr.hdr.rid = 0;
+ st_delivery_msg.hdr.hdr.cid = (uint16_t)CID_CAN_CMD_DELIVERY;
+ st_delivery_msg.hdr.hdr.msgbodysize = len;
+ st_delivery_msg.data.cmd_id = (uint8_t)cmd;
+ memcpy(&st_delivery_msg.data.data, msg->data,
+ (size_t)(len - CAN_TX_CMD_DELIVERY_SIZE));
+
+ h_client = CommonFindSender(h_app, dest);
+ if (!h_client) {
+ return e_status;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%x cmd_id=%x",
+ st_delivery_msg.hdr.hdr.cid, st_delivery_msg.hdr.hdr.msgbodysize,
+ st_delivery_msg.data.cmd_id);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(st_delivery_msg.data.data, len).c_str());
+
+ e_status = FrameworkunifiedSendMsg(h_client, CID_CAN_CMD_DELIVERY,
+ sizeof(st_delivery_msg), &st_delivery_msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)",
+ e_status, dest.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "CAN Delivery : dst = %s, CMD = %x, DLC = %x",
+ dest.c_str(), cmd, msg->dlc);
+ }
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANDeliverySndMsgSingle(HANDLE h_app, CANID ul_canid,
+ uint8_t uc_dlc, const uint8_t *puc_data,
+ enum CanIfEchoBackFlags flag, std::string dest) {
+ CAN_MSG_CANDATA st_delivery_msg;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ HANDLE h_client;
+ uint8_t uc_size = uc_dlc;
+
+ // Create delivery data
+ memset(&st_delivery_msg, 0, sizeof(st_delivery_msg));
+ st_delivery_msg.hdr.hdr.cid = CID_CAN_DATA_DELIVERY;
+ st_delivery_msg.hdr.hdr.msgbodysize = (uint16_t)(CAN_TRX_CANID_SIZE +
+ CAN_TRX_DLC_SIZE +
+ (uint32_t)uc_size);
+ st_delivery_msg.hdr.hdr.rid = 0;
+ st_delivery_msg.data.can_id = ul_canid;
+ st_delivery_msg.data.dlc = uc_size;
+ st_delivery_msg.echoback = flag;
+ if (uc_size > (uint8_t)CAN_DATA_SIZE)
+ uc_size = CAN_DATA_SIZE;
+ memcpy(st_delivery_msg.data.data, puc_data, (size_t)uc_size);
+
+ h_client = CommonFindSender(h_app, dest);
+ if (!h_client) {
+ return e_status;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "can_id=%x dlc=%x echoback=%d",
+ st_delivery_msg.data.can_id, st_delivery_msg.data.dlc,
+ st_delivery_msg.echoback);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(st_delivery_msg.data.data, uc_size).c_str());
+
+ e_status = FrameworkunifiedSendMsg(h_client, CID_CAN_DATA_DELIVERY,
+ sizeof(st_delivery_msg), &st_delivery_msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)",
+ e_status, dest.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "CAN Delivery : dst = %s, CANID = %x, DLC = %x",
+ dest.c_str(), ul_canid, uc_dlc);
+ }
+ return e_status;
+}
+
+EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanRecv");
+
+ uint16_t i;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ CAN_DELIVERY_ENTRY rcv_msg;
+ CAN_DeliveryEntryListIt it;
+ bool fail = false;
+
+ memset(&rcv_msg, 0, sizeof(rcv_msg));
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg,
+ sizeof(rcv_msg), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__,
+ "CAN DeliveryEntry FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ }
+ goto cleanup;
+ }
+
+ for (i = 0; i < rcv_msg.usCanNum; i++) {
+ CANID canid = rcv_msg.ulCanid[i];
+ CanMessage *latest = CANMsgFind(canid);
+
+ if (CANDeliveryInsert(canid, rcv_msg.notifyName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "(cnd:%lu) : CANID=0x%x, dst=%s",
+ g_map_delivery_list_can.size(), canid, rcv_msg.notifyName);
+ }
+
+ if (latest) {
+ switch (canid) {
+ case CAN_CMDID_FUELCALC_RST_REQ_RX:
+ case CAN_CMDID_STARTUP_FIN_RESP_RX:
+ case CAN_CMDID_MRST_INFO_RESP_RX:
+ case CAN_CMDID_VERSION_RESP_RX:
+ case CAN_CMDID_CONNECTION_NODE_RESP_RX:
+ if (eFrameworkunifiedStatusOK != CANDeliverySndCmdSingle(h_app, canid,
+ latest, rcv_msg.notifyName)) {
+ fail = true;
+ }
+ break;
+ default:
+ if (eFrameworkunifiedStatusOK != CANDeliverySndMsgSingle(h_app, canid,
+ static_cast<uint8_t>(latest->dlc),
+ latest->data, CANIF_PURERECV, rcv_msg.notifyName)) {
+ fail = true;
+ }
+ break;
+ }
+ }
+ }
+
+ if (fail)
+ e_status = eFrameworkunifiedStatusFail;
+
+cleanup:
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANDeliverySndMsgToClient(HANDLE h_app, CANID ul_canid,
+ void *data, size_t size, PS_CommunicationProtocol cid) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ HANDLE h_client = NULL;
+ CAN_DeliveryEntryListIt it;
+ std::pair<CAN_DeliveryEntryListIt, CAN_DeliveryEntryListIt> range;
+ bool fail = false;
+
+ it = g_map_delivery_list_can.find(ul_canid);
+ range = g_map_delivery_list_can.equal_range(ul_canid);
+ for (it = range.first; it != range.second; ++it) {
+ h_client = CommonFindSender(h_app, it->second);
+ if (!h_client) {
+ continue;
+ }
+
+ e_status = FrameworkunifiedSendMsg(h_client, cid, (UI_32)size, data);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)",
+ e_status, it->second.c_str());
+ fail = true;
+ }
+ }
+ return fail ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CANDeliverySndMsg(HANDLE h_app, CANID ul_canid, uint8_t n_ta,
+ uint8_t uc_dlc, const uint8_t *puc_data,
+ PS_CommunicationProtocol cid, enum CanIfEchoBackFlags flag) {
+ CAN_MSG_CANDATA st_delivery_msg;
+ uint8_t uc_size = uc_dlc;
+
+ // Create delivery data
+ memset(&st_delivery_msg, 0, sizeof(st_delivery_msg));
+ st_delivery_msg.hdr.hdr.cid = cid;
+ st_delivery_msg.hdr.hdr.msgbodysize = (uint16_t)(CAN_TRX_CANID_SIZE +
+ CAN_TRX_DLC_SIZE +
+ (uint32_t)uc_size);
+ st_delivery_msg.hdr.hdr.rid = 0;
+ st_delivery_msg.data.can_id = ul_canid;
+ st_delivery_msg.data.dlc = uc_size;
+ st_delivery_msg.echoback = flag;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "can_id=%x dlc=%x echoback=%d",
+ st_delivery_msg.data.can_id, st_delivery_msg.data.dlc,
+ st_delivery_msg.echoback);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(st_delivery_msg.data.data, uc_size).c_str());
+
+
+ if (uc_size > (uint8_t)CAN_DATA_SIZE)
+ uc_size = CAN_DATA_SIZE;
+ memcpy(st_delivery_msg.data.data, puc_data, (size_t)uc_size);
+
+ return CANDeliverySndMsgToClient(h_app, ul_canid, &st_delivery_msg,
+ sizeof(st_delivery_msg), cid);
+}
+
+EFrameworkunifiedStatus CANCommandDeliveryRcvProcess(HANDLE h_app,
+ CanMessage *msg, uint8_t cmd) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_MSG_CANCMD st_delivery_msg;
+ uint16_t len = 0;
+
+ memset(&st_delivery_msg, 0, sizeof(st_delivery_msg));
+ switch (cmd) {
+ case CAN_CMDID_FUELCALC_RST_REQ_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_FUELCALC_RST_SIZE;
+ break;
+ case CAN_CMDID_STARTUP_FIN_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_STARTUP_FIN_SIZE;
+ break;
+ case CAN_CMDID_MRST_INFO_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_MRST_INFO_SIZE;
+ break;
+ case CAN_CMDID_VERSION_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_VERSION_SIZE;
+ break;
+ case CAN_CMDID_CONNECTION_NODE_RESP_RX:
+ len = (uint16_t)(CAN_TX_CMD_DELIVERY_SIZE + msg->data[0] + 1);
+ break;
+ default:
+ return e_status;
+ }
+ st_delivery_msg.hdr.hdr.rid = 0;
+ st_delivery_msg.hdr.hdr.cid = (uint16_t)CID_CAN_CMD_DELIVERY;
+ st_delivery_msg.hdr.hdr.msgbodysize = len;
+ st_delivery_msg.data.cmd_id = cmd;
+ memcpy(&st_delivery_msg.data.data, msg->data,
+ (size_t)(len - CAN_TX_CMD_DELIVERY_SIZE));
+ CANMsgInsert(cmd, msg);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%x cmd_id=%x",
+ st_delivery_msg.hdr.hdr.cid, st_delivery_msg.hdr.hdr.msgbodysize,
+ st_delivery_msg.data.cmd_id);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(st_delivery_msg.data.data, len).c_str());
+
+ return CANDeliverySndMsgToClient(h_app, msg->can_id, &st_delivery_msg,
+ sizeof(st_delivery_msg), CID_CAN_CMD_DELIVERY);
+}
+
+EFrameworkunifiedStatus CANDeliveryRcvProcess(HANDLE h_app, CanMessage *msg) {
+ if (!Canif_CheckCanID(msg->can_id)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CANID is invalid (%x)", msg->can_id);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ CANCommWatchClear(h_app, msg->can_id);
+ CANMsgInsert(msg->can_id, msg);
+ if (eFrameworkunifiedStatusOK != CANDeliverySndMsg(h_app, msg->can_id, CAN_NTA_INVALID,
+ (uint8_t)msg->dlc, msg->data, CID_CAN_DATA_DELIVERY)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CAN Delivery Error");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CANClearEntry(HANDLE h_app) {
+ char notify_name[CANIF_NOTIFY_NAME_MAX_SIZE + 1] = {0};
+ CAN_DeliveryEntryListIt it;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &notify_name,
+ CANIF_NOTIFY_NAME_MAX_SIZE, eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__,
+ "#CAN thread# FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ }
+ return e_status;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "notify_name=%s", notify_name);
+
+ // To avoid destruction of iterator.
+ it = g_map_delivery_list_can.begin();
+ while (it != g_map_delivery_list_can.end()) {
+ size_t n = strnlen(it->second.c_str(), CANIF_NOTIFY_NAME_MAX_SIZE);
+ if (!strncmp(it->second.c_str(), notify_name, n)) {
+ g_map_delivery_list_can.erase(it++);
+ } else {
+ ++it;
+ }
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/peripheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp b/peripheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp
new file mode 100755
index 0000000..fa5d61d
--- /dev/null
+++ b/peripheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp
@@ -0,0 +1,416 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "CAN_TxMsg.h"
+#include "CAN_Delivery.h"
+#include <string.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <peripheral_service/Canif_API.h>
+#include <can_hal.h>
+#include <map>
+#include <string>
+#include "CAN_Thread.h"
+#include "Thread_Common.h"
+#include "Canif_API_Local.h"
+#include "CAN_TxMsg.h"
+#include "Canif_TransmissionData.h"
+
+static std::map<CANID, CAN_SEND_STATUS_DAT> g_m_send_sts;
+static bool can_cmd_rst_rcv = false;
+static std::map<CANID, CAN_TRANS_START_TABLE_VAL *> g_map_trans_data;
+
+void CANTxMsgInit(void) {
+ g_m_send_sts.clear();
+ uint32_t i;
+
+ for (i = 0; i < _countof(Can_TransInitData_21PF); i++) {
+ CANID canid = Can_TransInitData_21PF[i].canid;
+ CAN_TRANS_START_TABLE_VAL *val = &(Can_TransInitData_21PF[i].val);
+ g_map_trans_data[canid] = val;
+ }
+
+ return;
+}
+
+static bool CANCommandFuelCalcRstReqCheck(void) {
+ return can_cmd_rst_rcv;
+}
+
+void CANCommandSetFuelCalcRstReq(void) {
+ can_cmd_rst_rcv = true;
+}
+
+static void CANTxMsgErrorLog(const char *reason, const char *func,
+ CANID id, uint16_t len, HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, func, "%s Frame(0x%x) length=%hu from %s is ignored.",
+ reason, id, len, FrameworkunifiedGetMsgSrc(h_app));
+}
+
+static EFrameworkunifiedStatus CANCommandResponse(HANDLE h_app, CAN_MSG_CANCMD *msg,
+ size_t len, char *notifyName) {
+ HANDLE h_client = NULL;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+
+ h_client = CommonFindSender(h_app, notifyName);
+ if (!h_client) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Cannot open sender handle.");
+ return e_status;
+ }
+
+ msg->hdr.hdr.cid = (uint16_t)CID_CAN_CMD_DELIVERY;
+ e_status = FrameworkunifiedSendMsg(h_client, CID_CAN_CMD_DELIVERY, (uint32_t)len, msg);
+ if (e_status != eFrameworkunifiedStatusOK)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg is failed.");
+
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANCommandVersionReq(HANDLE h_app, char *notifyName) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CANHAL_RET_API ret = CANHAL_RET_NORMAL;
+ std::string version_info;
+ CAN_MSG_CANCMD msg;
+
+ memset(&msg, 0, sizeof(msg));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "@@@ Call CanGetVersion for can_hal");
+ ret = CanGetVersion(h_app, &version_info);
+ if (ret != CANHAL_RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Cannot get version from can_hal.");
+ return e_status;
+ }
+
+ if (CAN_TX_CMD_VERSION_SIZE != version_info.length()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid length of version.");
+ return e_status;
+ }
+
+ msg.hdr.hdr.rid = 0;
+ msg.hdr.hdr.msgbodysize = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_VERSION_SIZE;
+ msg.data.cmd_id = CAN_CMDID_VERSION_RESP_RX;
+ strncpy((char *)msg.data.data, version_info.c_str(), CAN_TX_CMD_VERSION_SIZE);
+ return CANCommandResponse(h_app, &msg, sizeof(msg), notifyName);
+}
+
+static EFrameworkunifiedStatus CANCommandFuelcalcRstReq(HANDLE h_app, char *notifyName) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ if (CANCommandFuelCalcRstReqCheck()) {
+ // CAN_CMDID_FUELCALC_RST_REQ_RX is already received from can_hal.
+ // so response it in direct.
+ CAN_MSG_CANCMD msg;
+ memset(&msg, 0, sizeof(msg));
+ msg.hdr.hdr.rid = 0;
+ msg.hdr.hdr.msgbodysize = CAN_TX_CMD_DELIVERY_SIZE +
+ CAN_TX_CMD_FUELCALC_RST_SIZE;
+ msg.data.cmd_id = CAN_CMDID_FUELCALC_RST_REQ_RX;
+ e_status = CANCommandResponse(h_app, &msg, sizeof(msg), notifyName);
+ } else {
+ CANDeliveryInsert(CAN_CMDID_FUELCALC_RST_REQ_RX, notifyName);
+ e_status = eFrameworkunifiedStatusOK;
+ }
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANCommandOther(HANDLE h_app, char *notifyName,
+ uint8_t cmd, uint8_t rid) {
+ CanMessage msg;
+ CANID wait = 0;
+ CANID can_id = (CANID)cmd;
+
+ memset(&msg, 0, sizeof(msg));
+ switch (cmd) {
+ case CAN_CMDID_STARTUP_FIN_REQ_TX:
+ wait = CAN_CMDID_STARTUP_FIN_RESP_RX;
+ break;
+ case CAN_CMDID_MRST_INFO_REQ_TX:
+ wait = CAN_CMDID_MRST_INFO_RESP_RX;
+ break;
+ case CAN_CMDID_CONNECTION_NODE_REQ_TX:
+ wait = CAN_CMDID_CONNECTION_NODE_RESP_RX;
+ break;
+ case CAN_CMDID_FUELCALC_REQ_TX:
+ wait = CAN_CMDID_FUELCALC_RST_REQ_RX;
+ break;
+ default:
+ CANTxMsgErrorLog("Unsupported cmd requested", __func__, cmd, 0, h_app);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (cmd != CAN_CMDID_FUELCALC_REQ_TX) {
+ CANDeliveryInsert(wait, notifyName);
+ }
+
+ if (rid != CAN_RID_NOTUSE_CODE) {
+ // cmd can be assumed same as can_id.
+ if (0 < g_m_send_sts.count(can_id)) {
+ if (g_m_send_sts[can_id].notify_name[0] != 0x00) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "Not yet deliver SendSts but updated(SendID=%x, CAN ID=%x, Nane=%s)",
+ g_m_send_sts[can_id].rid, can_id, g_m_send_sts[can_id].notify_name);
+ }
+ }
+ g_m_send_sts[can_id].rid = rid;
+ memcpy(g_m_send_sts[can_id].notify_name, notifyName,
+ sizeof(g_m_send_sts[can_id].notify_name));
+ }
+
+ msg.can_id = (CANID)cmd;
+ msg.rid = rid;
+ msg.dlc = (uint8_t)CAN_CMDSND_DATA_SIZE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "@@@ Call CanSend for can_hal");
+ if (CANHAL_RET_NORMAL != CanSend(h_app, &msg, CAN_HAL_TYPE_CAN)) {
+ CANTxMsgErrorLog("CAN CanSend failed", __func__, msg.can_id,
+ (uint16_t)msg.dlc, h_app);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CANTxMsgCommand(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanCommandCtl");
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_CMD_CTRL_MSG_DAT rcv_msg;
+
+ memset(&rcv_msg, 0, sizeof(rcv_msg));
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize)
+ FrameworkunifiedClearMsgData(h_app);
+ return e_status;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "notify_name=%s ulEvtId=%x ucRid=%x ucCmdid=%x",
+ rcv_msg.notifyName, rcv_msg.ulEvtId, rcv_msg.ucRid, rcv_msg.ucCmdid);
+
+ switch (rcv_msg.ucCmdid) {
+ case CAN_CMDID_VERSION_REQ_TX:
+ e_status = CANCommandVersionReq(h_app, rcv_msg.notifyName);
+ break;
+ case CAN_CMDID_FUELCALC_RST_REQ_DELIVERY:
+ e_status = CANCommandFuelcalcRstReq(h_app, rcv_msg.notifyName);
+ break;
+ default:
+ e_status = CANCommandOther(h_app,
+ rcv_msg.notifyName, rcv_msg.ucCmdid, rcv_msg.ucRid);
+ break;
+ }
+ return e_status;
+}
+
+static CAN_TRANS_START_TABLE_VAL *CANTxMsgFindMap(CAN_TRANS_START_MSG_DAT *msg) {
+ std::map<CANID, CAN_TRANS_START_TABLE_VAL *>::iterator it;
+ it = g_map_trans_data.find(msg->id);
+ if (it == g_map_trans_data.end())
+ return NULL;
+ return it->second;
+}
+
+static CAN_TRANS_START_TABLE_VAL *CanSendFind(CAN_TRANS_START_MSG_DAT *msg) {
+ return CANTxMsgFindMap(msg);
+}
+
+EFrameworkunifiedStatus CANTxMsgBit(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanSend(bit)");
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_TRANS_START_MSG_DAT rcv_msg;
+ CanMessage snd_msg;
+ CAN_TRANS_START_TABLE_VAL *store;
+ int32_t i = 0;
+ uint8_t *store_p;
+ uint8_t *data_p;
+ uint8_t *mask_p;
+
+ memset(&rcv_msg, 0, sizeof(rcv_msg));
+ memset(&snd_msg, 0, sizeof(snd_msg));
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize)
+ FrameworkunifiedClearMsgData(h_app);
+ goto cleanup;
+ }
+
+ e_status = eFrameworkunifiedStatusFail;
+
+ if (TRUE != CommGetAvailabilityCurrent(CAN_AVAILABILITY)) {
+ CANTxMsgErrorLog("CAN is not ready", __func__, 0, 0, h_app);
+ goto cleanup;
+ }
+
+ store = CanSendFind(&rcv_msg);
+ if (!store) {
+ CANTxMsgErrorLog("No initial value", __func__,
+ rcv_msg.id, sizeof(rcv_msg.dat), h_app);
+ goto cleanup;
+ }
+
+ store_p = store->dat.dat;
+ data_p = rcv_msg.dat.dat;
+ mask_p = rcv_msg.mask.dat;
+ for (i = 0; i < store->dlc; i++) {
+ *store_p &= (uint8_t)(~(*mask_p));
+ *store_p |= ((*mask_p) & (*data_p));
+ ++store_p;
+ ++data_p;
+ ++mask_p;
+ }
+
+ snd_msg.can_id = rcv_msg.id;
+ snd_msg.dlc = store->dlc;
+ snd_msg.rid = CAN_RID_NOTUSE_CODE;
+ memcpy(snd_msg.data, store->dat.dat, snd_msg.dlc);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "@@@ Call CanSend for can_hal : "
+ "can_id=%x dlc=%d rid=%x", snd_msg.can_id, snd_msg.dlc, snd_msg.rid);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(snd_msg.data, snd_msg.dlc).c_str());
+
+ if (CANHAL_RET_NORMAL != CanSend(h_app, &snd_msg, CAN_HAL_TYPE_CAN)) {
+ CANTxMsgErrorLog("CAN CanSend failed", __func__, snd_msg.can_id,
+ (uint16_t)snd_msg.dlc, h_app);
+ goto cleanup;
+ }
+
+ // echoback
+ e_status = CANDeliverySndMsg(h_app, snd_msg.can_id, 0, (uint8_t)snd_msg.dlc,
+ (const uint8_t *)snd_msg.data,
+ CID_CAN_DATA_DELIVERY, CANIF_ECHOBACK);
+cleanup:
+ return e_status;
+}
+
+EFrameworkunifiedStatus CANTxMsg(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanSend");
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_TRANSMISSION_START_MSG_DAT rcv_msg;
+ CanMessage snd_msg;
+ memset(&rcv_msg, 0, sizeof(rcv_msg));
+ memset(&snd_msg, 0, sizeof(snd_msg));
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize)
+ FrameworkunifiedClearMsgData(h_app);
+ goto cleanup;
+ }
+
+ e_status = eFrameworkunifiedStatusFail;
+
+ if (TRUE != CommGetAvailabilityCurrent(CAN_AVAILABILITY)) {
+ CANTxMsgErrorLog("CAN is not ready", __func__, 0, 0, h_app);
+ goto cleanup;
+ }
+
+ snd_msg.can_id = rcv_msg.stCandata.can_id;
+ snd_msg.dlc = rcv_msg.stCandata.dlc;
+ snd_msg.rid = rcv_msg.ucRid;
+ memcpy(snd_msg.data, rcv_msg.stCandata.data, snd_msg.dlc);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "@@@ Call CanSend for can_hal : "
+ "can_id=%x dlc=%d rid=%x", snd_msg.can_id, snd_msg.dlc, snd_msg.rid);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(snd_msg.data, snd_msg.dlc).c_str());
+
+ if (CANHAL_RET_NORMAL != CanSend(h_app, &snd_msg, CAN_HAL_TYPE_CAN)) {
+ CANTxMsgErrorLog("CAN CanSend failed", __func__, snd_msg.can_id,
+ (uint16_t)snd_msg.dlc, h_app);
+ goto cleanup;
+ }
+
+ // echoback
+ e_status = CANDeliverySndMsg(h_app, snd_msg.can_id, 0, (uint8_t)snd_msg.dlc,
+ (const uint8_t *)snd_msg.data,
+ CID_CAN_DATA_DELIVERY, CANIF_ECHOBACK);
+ if (rcv_msg.ucRid == (uint8_t)CAN_RID_NOTUSE_CODE)
+ goto cleanup;
+
+ if (0 < g_m_send_sts.count(snd_msg.can_id)) {
+ if (g_m_send_sts[snd_msg.can_id].notify_name[0] != 0x00) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "Not yet deliver SendSts but updated(SendID=%x, CAN ID=%x, Nane=%s)",
+ g_m_send_sts[snd_msg.can_id].rid, snd_msg.can_id,
+ g_m_send_sts[snd_msg.can_id].notify_name);
+ }
+ }
+
+ g_m_send_sts[snd_msg.can_id].rid = rcv_msg.ucRid;
+ memcpy(g_m_send_sts[snd_msg.can_id].notify_name,
+ rcv_msg.notifyName,
+ sizeof(g_m_send_sts[snd_msg.can_id].notify_name));
+cleanup:
+ return e_status;
+}
+
+EFrameworkunifiedStatus CANSndStsProcess(HANDLE h_app, CanSendResult *rcv_msg,
+ PS_CommunicationProtocol cid) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ CAN_MSG_SENDSTS snd_msg;
+ CANID can_id = rcv_msg->can_id;
+ HANDLE sender = NULL;
+ memset(&snd_msg, 0, sizeof(snd_msg));
+
+ if (0 == g_m_send_sts.count(can_id))
+ goto cleanup;
+
+ if (0x00 == (g_m_send_sts[can_id].notify_name[0]))
+ goto cleanup;
+
+ if (rcv_msg->rid != g_m_send_sts[can_id].rid)
+ goto cleanup;
+
+ snd_msg.hdr.hdr.cid = (uint16_t)cid;
+ snd_msg.hdr.hdr.msgbodysize = (uint16_t)(sizeof(snd_msg.data));
+ snd_msg.hdr.hdr.rid = rcv_msg->rid;
+ snd_msg.data.ulCanid = can_id;
+ snd_msg.data.ucStatus =
+ (CAN_SEND_RESULT_SUCCESS == rcv_msg->result) ? CAN_SUCCESS : CAN_RETRYOUT;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%d rid=%x can_id=%x ucStatus=%x",
+ snd_msg.hdr.hdr.cid, snd_msg.hdr.hdr.msgbodysize, snd_msg.hdr.hdr.rid,
+ snd_msg.data.ulCanid, snd_msg.data.ucStatus);
+
+ sender = CommonFindSender(h_app, g_m_send_sts[can_id].notify_name);
+ if (!sender) {
+ CANTxMsgErrorLog("Could not open sender.", __func__, can_id,
+ sizeof(snd_msg), h_app);
+ goto cleanup;
+ }
+
+ e_status = FrameworkunifiedSendMsg(sender, cid, sizeof(snd_msg), &snd_msg);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)",
+ e_status, g_m_send_sts[can_id].notify_name);
+ g_m_send_sts[can_id].notify_name[0] = 0x00;
+ g_m_send_sts[can_id].rid = 0x00;
+ goto cleanup;
+ }
+ g_m_send_sts[can_id].notify_name[0] = 0x00;
+ g_m_send_sts[can_id].rid = 0x00;
+
+ e_status = eFrameworkunifiedStatusOK;
+cleanup:
+ return e_status;
+}
diff --git a/peripheralservice/communication/server/src/main/communication_application.cpp b/peripheralservice/communication/server/src/main/communication_application.cpp
new file mode 100755
index 0000000..7240cdb
--- /dev/null
+++ b/peripheralservice/communication/server/src/main/communication_application.cpp
@@ -0,0 +1,226 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file has been generated automatically.
+ * User hand written code entry is allowed only inside protected zones.
+ */
+
+/*
+ * This file has been generated automatically.
+ * User hand written code entry is allowed only inside protected zones.
+ */
+
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <peripheral_service/communication_notifications.h>
+#include <peripheral_service/Canif_API.h>
+#include <stdio.h>
+#include <signal.h>
+#include <string>
+#include <sstream>
+#include <iostream>
+#include "communication_cid.h"
+#include "communication_communicationlog.h"
+#include "Thread_Common.h"
+
+extern EFrameworkunifiedStatus CANThreadStart(HANDLE h_app);
+extern EFrameworkunifiedStatus CANThreadStop(HANDLE h_app);
+
+HANDLE g_can_thread = NULL;
+
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ CommonInit();
+
+ // API to Register Notification for Service Availability.
+ e_status = FrameworkunifiedRegisterServiceAvailabilityNotification(h_app,
+ NTFY_Communication_Availability);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to Register Service Availability Notification.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "Service Availability Notification registered successfully.");
+ }
+
+ // API to Publish Service Availability Notification.
+ e_status = FrameworkunifiedPublishServiceAvailability(h_app, FALSE);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to Publish Service Availability Notification.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "Service Availability Notification published successfully.");
+ }
+
+ g_can_thread = FrameworkunifiedCreateChildThread(h_app, LAN_SERVICE_CAN,
+ CANThreadStart, CANThreadStop);
+ if (g_can_thread == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to create CAN");
+ }
+
+ // API to Publish Service Availability Notification.
+ e_status = FrameworkunifiedPublishServiceAvailability(h_app, TRUE);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to Publish Service Availability Notification.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "Service Availability Notification published successfully.");
+ }
+
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnWakeup(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CommThreadCheckAndStart(HANDLE p, HANDLE c,
+ UI_32 len, PCVOID data, BOOL current) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ if (TRUE != current) {
+ e_status = FrameworkunifiedStartChildThread(p, c, len, data);
+ }
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CommThreadCheckAndStop(HANDLE p, HANDLE c,
+ UI_32 len, PCVOID data, BOOL current) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ if (TRUE == current) {
+ e_status = FrameworkunifiedStopChildThread(p, c, len, data);
+ }
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]");
+
+ e_status = CommThreadCheckAndStart(h_app, g_can_thread,
+ 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY));
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Fail to Start CAN Thread. Status:%#x", e_status);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]");
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ e_status = CommThreadCheckAndStop(h_app, g_can_thread,
+ 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY));
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Fail to Stop CAN Thread. Status:%#x", e_status);
+ } else {
+ g_can_thread = NULL;
+ }
+
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]");
+
+ e_status = CommThreadCheckAndStart(h_app, g_can_thread,
+ 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY));
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Fail to Start CAN Thread. Status:%#x", e_status);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]");
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]");
+
+ e_status = CommThreadCheckAndStart(h_app, g_can_thread,
+ 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY));
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Fail to Start CAN Thread. Status:%#x", e_status);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]");
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]");
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]");
+ return e_status;
+}
+
+std::string MessageDataOutputLog(uint8_t *msg_data, uint32_t len){
+ std::string data_log;
+ int data_buf;
+ for(uint32_t i = 0; i < len; i++){
+ std::ostringstream ss;
+ data_buf = (int)msg_data[i];
+ ss << std::hex << data_buf;
+ data_log = ss.str() + " " + data_log;
+ }
+ return data_log;
+}
diff --git a/peripheralservice/communication/server/src/main/communication_main.cpp b/peripheralservice/communication/server/src/main/communication_main.cpp
new file mode 100755
index 0000000..39daae1
--- /dev/null
+++ b/peripheralservice/communication/server/src/main/communication_main.cpp
@@ -0,0 +1,154 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <errno.h>
+#include <sys/timerfd.h>
+#include <unistd.h>
+#include <poll.h>
+
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_multithreading.h>
+
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_system_if.h>
+#include <system_service/ss_sm_client_if.h>
+#include "communication_communicationlog.h"
+#include "communication_version.h"
+#include "communication_cid.h"
+
+#include "CAN_Thread.h"
+#include "Thread_Common.h"
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31},
+ FRAMEWORKUNIFIEDLOGZONES};
+
+extern HANDLE g_can_thread;
+static bool capture_log_flg = FALSE;
+
+#define COMMSYS_SND_ERR_CNT_MAX 10
+
+static void MessageHandler(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ e_status = FrameworkunifiedDispatchProcessWithoutLoop(h_app);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ // Ignore Error. Logging only.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedDispatchProcessWithoutLoop: %d", e_status);
+ }
+}
+
+static void TimeoutHandlerCAN(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ uint32_t dummy = 0;
+ static uint32_t snd_err_cnt_can = 0;
+
+ if (CommGetAvailabilityCurrent(CAN_AVAILABILITY)) {
+ e_status = FrameworkunifiedSendChild(h_app, g_can_thread,
+ CID_COMMSYS_TIMEOUT, 0, &dummy);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ snd_err_cnt_can++;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__,
+ "FrameworkunifiedSendChild(timeout for can) faild: %d", e_status);
+
+ if (capture_log_flg)
+ return;
+
+ if (snd_err_cnt_can < COMMSYS_SND_ERR_CNT_MAX)
+ return;
+
+ SendUserInvokedLoggingRequestToSystemManager(
+ e_SS_SM_CAPTURE_DTC_LOGS, "Send CAN TimeoutNtfy Error");
+ capture_log_flg = true;
+ } else {
+ snd_err_cnt_can = 0;
+ }
+ }
+}
+
+int main(int argc, char *argv[]) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FrameworkunifiedDefaultCallbackHandler cb_funcs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cb_funcs);
+ HANDLE h_app;
+ FRAMEWORKUNIFIED_SET_ZONES();
+ struct pollfd fds[2];
+ int ret;
+
+ e_status = FrameworkunifiedCreateDispatcherWithoutLoop(LAN_SERVICE_MAIN,
+ h_app, argc, argv, &cb_funcs, TRUE);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedCreateDispatcherWithoutLoop: %d", e_status);
+ return EXIT_FAILURE;
+ }
+
+ e_status = FrameworkunifiedGetDispatcherFD(h_app, &fds[0].fd);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetDispatcherFD: %d", e_status);
+ return EXIT_FAILURE;
+ }
+
+ if ((fds[1].fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_create: %d", errno);
+ return EXIT_FAILURE;
+ }
+
+ struct itimerspec tm;
+ tm.it_value.tv_sec = 0;
+ tm.it_value.tv_nsec = 100 * 1000 * 1000;
+ tm.it_interval.tv_sec = 0;
+ tm.it_interval.tv_nsec = 100 * 1000 * 1000;
+ if (timerfd_settime(fds[1].fd, 0, &tm, NULL) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_settime: %d", errno);
+ return EXIT_FAILURE;
+ }
+ fds[0].events = POLLIN;
+ fds[1].events = POLLIN;
+
+ while (1) {
+ ret = poll(fds, sizeof(fds) / sizeof(struct pollfd), -1);
+ if (ret < 0) {
+ if (errno == EINTR) {
+ continue;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "poll errno:%d", errno);
+ continue;
+ }
+
+ if ((fds[0].revents & POLLIN) != 0) {
+ MessageHandler(h_app);
+ continue;
+ }
+
+ if ((fds[1].revents & POLLIN) != 0) {
+ uint64_t exp;
+ read(fds[1].fd, &exp, sizeof(uint64_t));
+ TimeoutHandlerCAN(h_app);
+ continue;
+ }
+ }
+ return EXIT_SUCCESS;
+} \ No newline at end of file
diff --git a/peripheralservice/communication/server/src/threads/CAN_Thread.cpp b/peripheralservice/communication/server/src/threads/CAN_Thread.cpp
new file mode 100755
index 0000000..1b327e7
--- /dev/null
+++ b/peripheralservice/communication/server/src/threads/CAN_Thread.cpp
@@ -0,0 +1,238 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "CAN_Thread.h"
+
+extern "C" {
+#include <poll.h>
+#include <sys/timerfd.h>
+}
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_timer.h>
+#include <peripheral_service/Canif_API.h>
+#include <peripheral_service/communication_notifications.h>
+#include <can_hal.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <agl_thread.h>
+#include <string>
+#include "CAN_Delivery.h"
+#include "CAN_CommWatch.h"
+#include "CAN_TxMsg.h"
+
+#include "communication_communicationlog.h"
+#include "communication_cid.h"
+#include "Thread_Common.h"
+
+static EFrameworkunifiedStatus CANStateCallback(HANDLE h_app);
+static EFrameworkunifiedStatus CANHalRcvProcess(HANDLE h_app);
+static EFrameworkunifiedStatus CANHalSndStsProcess(HANDLE h_app);
+
+static const FrameworkunifiedProtocolCallbackHandler kCanPcbhs[] = {
+ {CID_CANIF_DELIVERY_ENTRY, CANDeliveryEntry},
+ {CID_CANIF_DELIVERY_ERASE, CANClearEntry},
+ {CID_COMMSYS_TIMEOUT, CANCallbackForTimeOut},
+ {CID_CANIF_TX_START, CANTxMsg},
+ {CID_CANIF_TX_BIT_START, CANTxMsgBit},
+ {CID_CANIF_COMM_WATCH, CANCommWatch},
+ {CID_CANIF_CMD_CTRL, CANTxMsgCommand},
+ {CID_CANHAL_CMD_CAN_READY, CANStateCallback},
+ {CID_CANHAL_CMD_ERROR_NOTIFY, CommonCanHalErrorNotify},
+ {CID_CANHAL_CMD_CAN_RECV, CANHalRcvProcess},
+ {CID_CANHAL_CMD_CAN_SEND_STATUS, CANHalSndStsProcess},
+};
+
+static UI_32 kCanPcbhsD[] = {
+ CID_CANIF_DELIVERY_ENTRY,
+ CID_CANIF_DELIVERY_ERASE,
+ CID_COMMSYS_TIMEOUT,
+ CID_CANIF_TX_START,
+ CID_CANIF_TX_BIT_START,
+ CID_CANIF_COMM_WATCH,
+ CID_CANIF_CMD_CTRL,
+ CID_CANHAL_CMD_CAN_READY,
+ CID_CANHAL_CMD_ERROR_NOTIFY,
+ CID_CANHAL_CMD_CAN_RECV,
+ CID_CANHAL_CMD_CAN_SEND_STATUS
+};
+
+static EFrameworkunifiedStatus CANStateCallback(HANDLE h_app) {
+ bool result;
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+
+ err = FrameworkunifiedGetMsgDataOfSize(h_app, &result, sizeof(result), eSMRRelease);
+ if (err != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize failed");
+ }
+ if (err == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ return eFrameworkunifiedStatusFail;
+ } else if (err != eFrameworkunifiedStatusOK) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ CommSetAvailabilityCurrent(CAN_AVAILABILITY);
+ return CommonStartNotify(h_app, NTFY_Communication_CAN_ISAVAILABLE);
+}
+
+static EFrameworkunifiedStatus CANThreadCanOpen(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ const char *result = "Unknown";
+ const char *called = "Unknown";
+ UI_16 z = ZONE_ERR;
+
+ e_status = ConvRet(CanOpen(h_app, CAN_HAL_TYPE_CAN));
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "CanOpen";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s", called, result);
+ return e_status;
+}
+
+EFrameworkunifiedStatus CANThreadStart(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ CommClrAvailabilityCurrent(CAN_AVAILABILITY);
+ CANDeliveryInit();
+ CANCommWatchInit();
+ CANTxMsgInit();
+
+ e_status = CommonThreadStart(h_app, kCanPcbhs, _countof(kCanPcbhs),
+ NTFY_Communication_CAN_ISAVAILABLE, CANThreadCanOpen);
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANThreadCanClose(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ const char *result = "Unknown";
+ const char *called = "Unknown";
+ UI_16 z = ZONE_ERR;
+
+ e_status = ConvRet(CanClose(h_app, CAN_HAL_TYPE_CAN));
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "CanClose";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s", called, result);
+ return e_status;
+}
+
+EFrameworkunifiedStatus CANThreadStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ CommClrAvailabilityCurrent(CAN_AVAILABILITY);
+ e_status = CommonThreadStop(h_app, kCanPcbhsD, _countof(kCanPcbhsD),
+ NTFY_Communication_CAN_ISAVAILABLE,
+ CANThreadCanClose);
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANHalRcvProcess(HANDLE h_app) {
+ CanMessage canhal_recv_data;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ uint8_t cmd = 0;
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &canhal_recv_data,
+ sizeof(canhal_recv_data), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : FrameworkunifiedGetMsgDataOfSize is failed, e_status=%d", e_status);
+ }
+
+ if (e_status == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ goto cleanup;
+ } else if (e_status != eFrameworkunifiedStatusOK) {
+ goto cleanup;
+ }
+
+ if (canhal_recv_data.dlc > CAN_MESSAGE_LEN) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : Invalid data length, dlc=%d", canhal_recv_data.dlc);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "can_id=%x dlc=%d rid=%x",
+ canhal_recv_data.can_id, canhal_recv_data.dlc, canhal_recv_data.rid);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(canhal_recv_data.data, canhal_recv_data.dlc).c_str());
+
+ cmd = (uint8_t)(canhal_recv_data.can_id & 0xFF);
+ switch (canhal_recv_data.can_id) {
+ case CAN_CMDID_STARTUP_FIN_RESP_RX:
+ e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd);
+ break;
+ case CAN_CMDID_MRST_INFO_RESP_RX:
+ e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd);
+ break;
+ case CAN_CMDID_VERSION_RESP_RX:
+ e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd);
+ break;
+ case CAN_CMDID_CONNECTION_NODE_RESP_RX:
+ e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd);
+ break;
+ case CAN_CMDID_FUELCALC_RST_REQ_RX:
+ CANCommandSetFuelCalcRstReq();
+ e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd);
+ break;
+ default:
+ e_status = CANDeliveryRcvProcess(h_app, &canhal_recv_data);
+ }
+cleanup:
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANHalSndStsProcess(HANDLE h_app) {
+ CanSendResult canhal_recv_data;
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+ uint8_t ui_can_rid;
+ PS_CommunicationProtocol cid;
+
+ err = FrameworkunifiedGetMsgDataOfSize(h_app, &canhal_recv_data,
+ sizeof(canhal_recv_data), eSMRRelease);
+ if (err != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : FrameworkunifiedGetMsgDataOfSize is failed, err=%d", err);
+ }
+
+ if (err == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ return eFrameworkunifiedStatusFail;
+ } else if (err != eFrameworkunifiedStatusOK) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ ui_can_rid = canhal_recv_data.rid;
+ if (CAN_RID_NOTUSE_CODE == ui_can_rid) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ switch (canhal_recv_data.can_id) {
+ case CAN_CMDID_MRST_INFO_REQ_TX:
+ case CAN_CMDID_CONNECTION_NODE_REQ_TX:
+ case CAN_CMDID_FUELCALC_REQ_TX:
+ cid = CID_CAN_CMD_TX_RESULT;
+ break;
+ default:
+ cid = CID_CAN_TX_RESULT;
+ break;
+ }
+
+ return CANSndStsProcess(h_app, &canhal_recv_data, cid);
+}
+
+EFrameworkunifiedStatus CANCallbackForTimeOut(HANDLE h_app) {
+ CANCommWatchTimeout(h_app);
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/peripheralservice/communication/server/src/threads/Thread_Common.cpp b/peripheralservice/communication/server/src/threads/Thread_Common.cpp
new file mode 100755
index 0000000..718d948
--- /dev/null
+++ b/peripheralservice/communication/server/src/threads/Thread_Common.cpp
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdint.h>
+#include <boost/atomic.hpp>
+#include <pthread.h>
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_timer.h>
+#include <agl_thread.h>
+#include <can_hal.h>
+#include "communication_communicationlog.h"
+#include "communication_cid.h"
+#include "Thread_Common.h"
+
+static std::map<std::string, HANDLE> g_map_sender;
+static pthread_mutex_t g_sender_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+static boost::atomic<int32_t> availabilityCurrent;
+
+void CommonInit(void) {
+ pthread_mutex_lock(&g_sender_mutex);
+ g_map_sender.clear();
+ pthread_mutex_unlock(&g_sender_mutex);
+}
+
+HANDLE CommonFindSender(HANDLE h_app, std::string s) {
+ HANDLE ret = NULL;
+ std::string app(FrameworkunifiedGetAppName(h_app));
+ std::string key = s + app;
+ std::map<std::string, HANDLE>::iterator it = g_map_sender.find(key);
+
+ pthread_mutex_lock(&g_sender_mutex);
+
+ if (it != g_map_sender.end()) {
+ ret = g_map_sender[key];
+ goto cleanup;
+ }
+
+ ret = FrameworkunifiedMcOpenSender(h_app, s.c_str());
+ if (ret) {
+ g_map_sender[key] = ret;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedMcOpenSender Error(to:%s)", s.c_str());
+ }
+
+cleanup:
+ pthread_mutex_unlock(&g_sender_mutex);
+ return ret;
+}
+
+void CommSetAvailabilityCurrent(int32_t current) {
+ availabilityCurrent |= current;
+}
+
+void CommClrAvailabilityCurrent(int32_t current) {
+ availabilityCurrent &= (~current);
+}
+
+BOOL CommGetAvailabilityCurrent(int32_t current) {
+ return !(!(availabilityCurrent & current));
+}
+
+EFrameworkunifiedStatus CommonStartNotify(HANDLE h_app, PCSTR cmd) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ const char *result = "Unknown";
+ const char *called = "Unknown";
+ const BOOL avail = TRUE;
+ UI_16 z = ZONE_ERR;
+
+ e_status = FrameworkunifiedNPPublishNotification(h_app, cmd, &avail , sizeof(avail));
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedNPPublishNotification";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status);
+ return e_status;
+}
+
+EFrameworkunifiedStatus CommonCanHalErrorNotify(HANDLE h_app) {
+ char msg[CANHAL_ERROR_MESSAGE_LEN] = {0};
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+
+ err = FrameworkunifiedGetMsgDataOfSize(h_app, &msg, sizeof(msg), eSMRRelease);
+ if (err != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize is failed, err=%d", err);
+ }
+
+ if (err == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ return eFrameworkunifiedStatusFail;
+ } else if (err != eFrameworkunifiedStatusOK) {
+ return eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "can_hal error : %s", msg);
+ return err;
+}
+
+EFrameworkunifiedStatus CommonThreadStart(HANDLE h_app, const FrameworkunifiedProtocolCallbackHandler *cb,
+ UI_32 count, PCSTR cmd, EFrameworkunifiedStatus (*open_func)(HANDLE)) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ const char *result = "Unknown";
+ const char *called = "Unknown";
+ UI_16 z = ZONE_ERR;
+
+ e_status = FrameworkunifiedAttachCallbacksToDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, cb, count);
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedAttachCallbacksFromDispatcher";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s(%d)", called, result, e_status);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ e_status = open_func(h_app);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ e_status = FrameworkunifiedNPRegisterNotification(h_app, cmd,
+ sizeof(EFrameworkunifiedStatus), eFrameworkunifiedStateVar);
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedNPRegisterNotification";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ return e_status;
+}
+
+EFrameworkunifiedStatus CommonThreadStop(HANDLE h_app, const PUI_32 cb,
+ UI_32 count, PCSTR cmd, EFrameworkunifiedStatus (*close_func)(HANDLE)) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ const BOOL avail = FALSE;
+ const char *result = "Unknown";
+ const char *called = "Unknown";
+ UI_16 z = ZONE_ERR;
+
+ e_status = FrameworkunifiedNPPublishNotification(h_app, cmd, &avail , sizeof(avail));
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedNPPublishNotification";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ e_status = FrameworkunifiedNPUnRegisterNotification(h_app, cmd);
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedNPUnRegisterNotification";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ e_status = FrameworkunifiedDetachCallbacksFromDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, cb, count);
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedDetachCallbacksFromDispatcher";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s(%d)", called, result, e_status);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ e_status = close_func(h_app);
+ if (e_status != eFrameworkunifiedStatusOK){
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: close_func() failed");
+ return e_status;
+ }
+
+ return e_status;
+}
+
diff --git a/peripheralservice/peripheral_service.mk b/peripheralservice/peripheral_service.mk
new file mode 100755
index 0000000..c054722
--- /dev/null
+++ b/peripheralservice/peripheral_service.mk
@@ -0,0 +1,44 @@
+#############################################################
+#
+# Common Makefile for peripheral_service
+# Copyright (C) 2017-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := peripheral_service
+
+#############################################################
+
+
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/positioning_hal/LICENSE b/positioning_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/positioning_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/positioning_hal/Makefile b/positioning_hal/Makefile
new file mode 100755
index 0000000..0b5a74d
--- /dev/null
+++ b/positioning_hal/Makefile
@@ -0,0 +1,91 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libpositioning_hal.so
+
+HEADER := hal_api/gps_hal.h hal_api/positioning_hal.h
+
+######### include paths/files ###################
+CXXFLAGS += -I.
+CXXFLAGS += -I./inc/Common
+CXXFLAGS += -I./inc/GpsCommon
+CXXFLAGS += -I./inc/LineSensDrv
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include/
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+CXXFLAGS += -DLINUX -D__CWORD71__VEHICLE_ -D__CWORD71_
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH := /usr/lib
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+#LIBS += -Wl,-Bdynamic -lgps_mng
+LIBS += -Wl,-Bdynamic -lPOS_base_API
+LIBS += -Wl,-Bdynamic -lns_backup
+
+######### source files ##########################
+VPATH := src/Common
+VPATH += src/GpsCommon
+VPATH += src/LineSensDrv
+
+OBJS += positioning_common.o
+OBJS += positioning_hal.o
+OBJS += MDev_Gps_API.o
+OBJS += MDev_Gps_Main.o
+OBJS += MDev_GpsRecv.o
+OBJS += MDev_Gps_Nmea.o
+OBJS += MDev_Gps_Common.o
+OBJS += MDev_Gps_Mtrx.o
+OBJS += MDev_Gps_TimerCtrl.o
+OBJS += LineSensDrv_Sensor.o
+OBJS += LineSensDrv_Thread.o
+OBJS += LineSensDrv_Api.o
+OBJS += MDev_GpsRollOver.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=:$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
+
+
diff --git a/positioning_hal/README.md b/positioning_hal/README.md
new file mode 100755
index 0000000..2d46d42
--- /dev/null
+++ b/positioning_hal/README.md
@@ -0,0 +1,3 @@
+positioning_hal library
+==================
+Positioning HAL implementation library for AGL Reference Board.
diff --git a/positioning_hal/hal_api/gps_hal.h b/positioning_hal/hal_api/gps_hal.h
new file mode 100755
index 0000000..3321275
--- /dev/null
+++ b/positioning_hal/hal_api/gps_hal.h
@@ -0,0 +1,932 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_GPS_HAL_H_
+#define HAL_API_GPS_HAL_H_
+
+/**
+ * @file gps_hal.h
+ */
+
+/** @addtogroup positioning
+ * @{
+ */
+/** @addtogroup positioning_hal
+ * @ingroup positioning
+ * @{
+ */
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include <native_service/frameworkunified_types.h>
+#include <vehicle_service/pos_message_header.h>
+#include <vehicle_service/std_types.h>
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+typedef int32 RET_API;
+typedef uint32_t DID;
+
+/*************************************************************************
+ * RET_API define
+ *************************************************************************/
+/*--- for message ---*/
+#define POS_TIMESTS_NG 0x00
+//!< \~english time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+#define POS_TIMESTS_RTC 0x01
+//!< \~english time output from RTC Backup(have time adjustment)
+#define POS_TIMESTS_OK 0x02 //!< \~english time adjustment completed
+
+/* command ID */
+#define CID_POSIF_REGISTER_LISTENER_GPS_TIME 0x0201
+//!< \~english GPS time delivery command ID
+
+#define POS_DID_GPS__CWORD82__SETINITIAL 0x80000033
+//!< \~english data ID of setting initial location and time to GPS
+
+#define POS_DID_GPS__CWORD82__SETRMODEEX 0x80000035
+//!< \~english data ID of setting GPS receiver mode(pull extension sentence)
+
+#define POS_DID_GPS__CWORD82__SELSENT 0x80000036
+//!< \~english data ID of setting command to GPS that output any sentence
+
+/* NAVIINFO_RET_API */
+#define NAVIINFO_RET_NORMAL (0) //!< \~english normal finish
+#define NAVIINFO_RET_ERROR_PARAM (-1) //!< \~english parameter error
+#define NAVIINFO_RET_ERROR_INNER (-2) //!< \~english internal error
+#define NAVIINFO_RET_ERROR_BUFFULL (-3) //!< \~english buffer full
+#define NAVIINFO_RET_ERROR_NOSUPPORT (-4) //!< \~english no support
+#define NAVIINFO_RET_ERROR_RESOURCE (-5) //!< \~english lack of resource
+
+/* Positioning Level/GPS Information Positioning Status Information Definition */
+#define NAVIINFO_DIAG_GPS_FIX_STS_NON (0) //!< \~english position not fix
+#define NAVIINFO_DIAG_GPS_FIX_STS_2D (1) //!< \~english 2D position fix
+#define NAVIINFO_DIAG_GPS_FIX_STS_3D (2) //!< \~english 3D position fix
+
+/* Reception status definition */
+#define NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE (0) //!< \~english not used
+#define NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING (1) //!< \~english searching
+#define NAVIINFO_DIAG_GPS_RCV_STS_TRACHING (2) //!< \~english tracking
+#define NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX (3) //!< \~english not used for position fix
+#define NAVIINFO_DIAG_GPS_RCV_STS_USEFIX (4) //!< \~english used for position fix
+
+/* GPS Response Status Definition */
+#define GPS_SENDOK 0 //!< \~english send result OK
+#define GPS_SENDNG 1 //!< \~english send result NG
+
+/* GPS reset request mode definition */
+#define GPS_RST_COLDSTART 0xff
+//!< \~english GPS reset request(cold start)
+
+#define RET_NORMAL 0 //!< \~english normally end
+
+#define RET_RCVMSG 1 //!< \~english receive message only
+#define RET_RCVSIG 2 //!< \~english receive signal only
+#define RET_RCVBOTH 3 //!< \~english receive message and signal
+#define RET_NOMSG 4 //!< \~english receive no message
+
+#define RET_QUE 5 //!< \~english insert signal
+#define RET_NOTQUE 6 //!< \~english do not insert signal
+#define RET_PROCDOWN 7 //!< \~english sub process down found
+#define RET_SLEEP 100 //!< \~english sleep time
+
+
+#define RET_OSERROR (-127) //!< \~english OS system call error
+
+#define RET_ERROR (-1)
+//!< \~english abnormally end(do not know reason)
+#define RET_ERRPARAM (-2) //!< \~english parameter error
+#define RET_ERRNOTRDY (-3)
+//!< \~english port or semphore ID is not created
+#define RET_ERRPROC (-4) //!< \~english error occurs in API process
+#define RET_ERRTIMEOUT (-5)
+//!< \~english timeout occurs but process unfinished
+#define RET_ERRMSGFULL (-6) //!< \~english message table full
+
+
+#define RET_ERROVERFLW (-7)
+//!< \~english message size exceeds receive buffer size
+
+#define RET_ERRINIT (-8) //!< \~english abnormally initialization
+
+#define RET_EV_NONE (-20) //!< \~english event does not exist
+#define RET_EV_MAX (-21) //!< \~english event value exceeds max value
+#define RET_EV_MIN (-22)
+//!< \~english event value is lower than min value
+
+/* POS_RET_API */
+#define POS_RET_NORMAL 0 //!< \~english normal finish
+#define POS_RET_ERROR (-1) //!< \~english error occured
+#define POS_RET_ERROR_DID (-2) //!< \~english data ID error
+#define POS_RET_ERROR_INNER (-3) //!< \~english internal error
+#define POS_RET_ERROR_PARAM (-4) //!< \~english parameter error
+#define POS_RET_ERROR_BUFFULL (-5) //!< \~english buffer full error
+#define POS_RET_ERROR_CREATE_EVENT (-6) //!< \~english create event error
+#define POS_RET_ERROR_OUTOF_MEMORY (-8)
+//!< \~english share memory allocation size error
+
+#define POS_RET_ERROR_SIZE (-9) //!< \~english memory size error
+#define POS_RET_ERROR_TIMEOUT (-10) //!< \~english timeout error
+#define POS_RET_ERROR_NOSUPPORT (-11) //!< \~english no support
+#define POS_RET_ERROR_BUSY (-12) //!< \~english busy
+#define POS_RET_ERROR_RESOURCE (-13) //!< \~english lack of resources
+#define POS_RET_ERROR_MIN (-13) //!< \~english min value of error
+
+
+#define NUM_OF_100msData (10)
+//!< \~english number of gyro data every 100ms
+
+
+#define CID_GPS_SERIAL1 (CID)0x0101
+//!< \~english Defination of notification about Gps Data has been receiced
+
+#define CID_GPS_SERIAL2 (CID)0x0102 //!< \~english notification about 1PPS interupt
+
+
+#define CID_GPS_SERIAL3 (CID)0x0103
+//!< \~english Defination of SIF2 Data
+
+#define CID_GPS_SERIAL4 (CID)0x0104
+//!< \~english Defination of _CWORD82_ command send
+
+#define CID_GPS_SERIAL5 (CID)0x0105
+//!< \~english Defination of _CWORD82_ command send
+
+#define CID_GPS_SERIAL6 (CID)0x0106
+//!< \~english Defination of u-blox request data
+
+#define CID_GPS_SERIAL7 (CID)0x0107
+//!< \~english Defination of u-blox ack data
+
+#define CID_GPS_RECVDATA (CID)(CID_GPS_BASE | CID_GPS_SERIAL1)
+//!< \~english gps data receiced CID
+
+#define CID_GPS_1PPSINT (CID)(CID_GPS_BASE | CID_GPS_SERIAL2)
+//!< \~english 1PPS interupt CID
+
+#define CID_GPS_SIF2DATA (CID)(CID_GPS_BASE | CID_GPS_SERIAL3)
+//!< \~english SIF2 Data CID
+
+/**
+ * \~english @brief _CWORD82_ command send CID
+ * \~english @brief Message structure\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message main structure @ref TgGpsSndData\n
+ * \~english @brief Message data(Vehicle sensor information setting message) structure @ref VEHICLE_MSG_SEND_DAT\n
+ */
+#define CID_GPS__CWORD82__REQUEST (CID)(CID_GPS_BASE | CID_GPS_SERIAL4)
+
+#define CID_GPS_CYCLEDATA_PROV (CID)(CID_GPS_BASE | CID_GPS_SERIAL5)
+//!< \~english Gps cycle data CID
+
+#define CID_GPS_RCV_REQUESTDATA (CID)(CID_GPS_BASE | CID_GPS_SERIAL6)
+//!< \~english u-blox request data CID
+
+#define CID_GPS_RCV_ACKDATA (CID)(CID_GPS_BASE | CID_GPS_SERIAL7)
+//!< \~english u-blox ack data CID
+
+#define CID_GPS_SERIAL8 (CID)0x0108
+//!< \~english Defination of Time Setting request
+
+#define CID_GPS_SERIAL9 (CID)0x0109
+//!< \~english Defination of Time Setting ack
+
+#define CID_GPS_SERIAL10 (CID)0x010A
+//!< \~english Defination of back up data read request
+
+#define CID_GPS_SERIAL11 (CID)0x010B
+//!< \~english Defination gps of week count request
+
+/**
+ * \~english @brief Defination of Time Setting request
+ * \~english @brief Message structure\n
+ * \~english @brief Message header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message body structure @ref TgGpsSndData\n
+ * \~english @brief Positioning information structure @ref POS_MSGINFO\n
+ * */
+#define CID_GPS_TIMESETTING (CID)(CID_GPS_BASE | CID_GPS_SERIAL8)
+
+/**
+ * \~english @brief Defination of Time Setting ack
+ * \~english @brief Message structure\n
+ * \~english @brief Message body structure @ref TG_GPS_RET_TIMESET_MSG\n
+ */
+#define CID_GPS_RETTIMESETTING (CID)(CID_GPS_BASE | CID_GPS_SERIAL9)
+
+/**
+ * \~english @brief Read backup data request CID
+ * \~english @brief When this command is received, the backup data is read.\n
+ * \~english @brief Message-Related Structures\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER
+ */
+#define CID_GPS_BACKUPDATA_LOAD (CID)(CID_GPS_BASE | CID_GPS_SERIAL10)
+
+/**
+ * \~english @brief Gps Week count request CID
+ * \~english @brief Message structure\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message data(Gps Week correction count notify message) structure @ref GpsWeekCorCntMsg\n
+ */
+#define CID_GPSWEEKCOR_CNT_NOTIFICATION (CID)(CID_GPS_BASE | CID_GPS_SERIAL11)
+
+
+
+/**
+ * \~english @brief GPS reset result delivery command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hThread, TN_POSITIONING_GPS, CID_POSIF_REQ_GPS_RESET, OnRecivePosResetMsg);
+ * @endcode
+ */
+#define CID_POSIF_REQ_GPS_RESET 0x0784
+
+#define POSHAL_DID_GPS_CONNECT_ERROR 0x800000B5U
+//!< \~english GPS receive error DID
+
+#define GPS_READ_LEN 316
+//!< \~english Gps NMEA FULLBINARY max length
+
+#define GPS_CMD_NMEA_GGA_SZ (71U) //!< \~english GGA
+#define GPS_CMD_NMEA_DGGA_SZ (75U) //!< \~english double precison GGA
+#define GPS_CMD_NMEA_VTG_SZ (37U) //!< \~english VTG
+#define GPS_CMD_NMEA_RMC_SZ (61U) //!< \~english RMC
+#define GPS_CMD_NMEA_DRMC_SZ (67U) //!< \~english double precison RMC
+#define GPS_CMD_NMEA_GLL_SZ (44U) //!< \~english GLL
+#define GPS_CMD_NMEA_DGLL_SZ (50U) //!< \~english double precison GLL
+#define GPS_CMD_NMEA_GSA_SZ (66U) //!< \~english GSA
+#define GPS_CMD_NMEA_GSV_SZ (70U) //!< \~english GSV
+#define GPS_CMD_NMEA__CWORD44__GP_3_SZ (78U) //!< \~english _CWORD44_,GP,3
+#define GPS_CMD_NMEA__CWORD44__GP_4_SZ (25U) //!< \~english _CWORD44_,GP,4
+#define GPS_CMD_NMEA_P_CWORD82_F_GP_0_SZ (50U) //!< \~english _CWORD44_,GP,0
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_1_SZ (31U) //!< \~english _CWORD44_,GP,1
+#define GPS_CMD_NMEA_P_CWORD82_I_GP_SZ (71U) //!< \~english P_CWORD82_I,GP
+#define GPS_CMD_NMEA_P_CWORD82_E_GP_0_SZ (50U) //!< \~english P_CWORD82_E,GP,0
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_0_SZ (63U) //!< \~english P_CWORD82_J,GP,0
+#define GPS_CMD_NMEA_P_CWORD82_E_GP_2_SZ (21U) //!< \~english P_CWORD82_E,GP,2
+#define GPS_CMD_NMEA_P_CWORD82_G_GP_0_SZ (34U) //!< \~english P_CWORD82_G,GP,0
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_7_SZ (37U) //!< \~english P_CWORD82_J,GP,7
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_8_SZ (45U) //!< \~english P_CWORD82_J,GP,8
+#define GPS_CMD_BINARY_SZ (81U) //!< \~english standard binary
+
+#define GPS_CMD_FULLBIN_SZ (316U)
+//!< \~english FULL binary(GPS10 format)
+
+#define GPS_CMD_FULLBIN_VINFO (30U + 160U + 25U + 8U)
+//!< \~english FULL bianry version
+
+#define GPS_NMEA_MAX_SZ (255U) //!< \~english NMEA max size
+#define GPS_DATASIZE_RTC (13U) //!< \~english RTC Data size
+#define GPS_NMEARCVSTS_SZ (1U) //!< \~english received NMEA size
+
+#define GPS_GPSANT_SZ (1U) //!< \~english gps antenna status size
+#define GPS_SNSCNT_SZ (1U) //!< \~english Sensor Count value size
+
+
+#define GPS_CMD_NMEA_PROV_SZ (GPS_CMD_NMEA_DRMC_SZ + GPS_CMD_NMEA_GSA_SZ + \
+ (GPS_CMD_NMEA_GSV_SZ*3) + GPS_CMD_NMEA__CWORD44__GP_3_SZ)
+//!< \~english NMEA size
+
+#define GPS_NMEA_SZ (GPS_NMEARCVSTS_SZ + GPS_GPSANT_SZ + GPS_SNSCNT_SZ + GPS_CMD_NMEA_PROV_SZ)
+//!< \~english NEMA size
+
+#define GPS_FULLBIN_SZ (GPS_GPSANT_SZ + GPS_SNSCNT_SZ + GPS_CMD_FULLBIN_SZ)
+//!< \~english FULLBIN size
+
+#define GPS__CWORD44_GP4_SZ (GPS_GPSANT_SZ + GPS_SNSCNT_SZ + GPS_CMD_NMEA__CWORD44__GP_4_SZ)
+//!< \~english _CWORD44_GP4 size
+
+#define GPS_MSGDATA_SZ_MAX (512U) //!< \~english message maximum data size
+#define GPS_TLGRM_LEN 253 //!< \~english message data length
+#define GPS_MSG_VSINFO_DSIZE 1904 //!< \~english message body size
+
+#define POS_MSG_INFO_DSIZE 1028 //!< \~english message body maximum size
+
+/**
+ * @enum MdevGpsDataKind
+ * \~english enumeration of gps data kind
+ */
+typedef enum MdevGpsDataKind {
+ MDEV_GPS_DATA_RAWDATA_NMEA = 0, //!< \~english raw NMEA data of GPS
+ MDEV_GPS_DATA_RAWDATA_FULLBIN, //!< \~english raw binary data of GPS
+ MDEV_GPS_DATA_RAWDATA__CWORD44_GP4, //!< \~english raw _CWORD44_ data of GPS
+ MDEV_GPS_DATA_NAVISPEED, //!< \~english speed data
+ MDEV_GPS_DATA_CUSTOMDATA, //!< \~english position information
+ MDEV_GPS_DATA_GPSTIME, //!< \~english GPS time
+ MDEV_GPS_DATA_GPSTIME_RAW, //!< \~english raw time of GPS
+ MDEV_GPS_DATA_INITIAL //!< \~english initialize data
+} MDEV_GPS_DATA_KIND;
+
+/**
+ * @struct NAVIINFO_UTCTIME
+ * \~english UTC time information structure
+ */
+typedef struct {
+ uint16_t year; //!< \~english year
+ uint8_t month; //!< \~english month
+ uint8_t date; //!< \~english day
+ uint8_t hour; //!< \~english hour
+ uint8_t minute; //!< \~english minute
+ uint8_t second; //!< \~english second
+ uint8_t reserved; //!< \~english reserve
+} NAVIINFO_UTCTIME;
+
+/**
+ * @struct SENSORLOCATION_LONLATINFO_DAT
+ * \~english longitude and latitude information data
+ * - Get method(getMethod)
+ * - SENSOR_GET_METHOD_GPS - longitude and latitude from GPS
+ * - SENSOR_GET_METHOD_NAVI - longitude and latitude from Navigation
+ * - Synchrony count(SyncCnt)
+ * - Count for position data synchronous \n
+ * When delivery altitude and heading data, position data can be synchronized by SyncCnt.\n
+ * But the data of different method can not be synchronized by SyncCnt.\n
+ * Example 1: [LonLat from GPS] and [Heading from GPS] can be synchronized by SyncCnt.\n
+ * Example 2: [LonLat from GPS] and [LonLat from Navi] can not be synchronized by SyncCnt.\n
+ * Caution: The sensor count in sensor data delivery is another data.
+ * - Enable or not(isEnable) \n
+ * To describe this delivery message is whether can be used or not
+ * - 0 - not avaliable
+ * - not 0 - avaliable
+ * - when GPS data is specified,longitude and latitude is invalid at following condition:\n
+ * so [not avaliable] provieded
+ * - After system start, GPS unit has not received current location data and GPS unit \n
+ * status is not positioning fixed.
+ * - If it is not initialized status, certainly provide [avaliable] when Navigation data specified
+ * - If the status is [not avaliable], data following can not be guaranteed.
+ * - Position status(posSts)
+ * - It is valid only when "Get method is Navigation" and "evironment is _CWORD80_".(otherwise it will be set as 0)
+ * - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+ * - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+ * - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
+ * maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+ * - Position accuracy(posAcc)
+ * - Detected accruray of current position:1LSB=1m \n
+ * - It is valid only when "Get method is Navigation" and "evironment is _CWORD80_".(otherwise it will be set as 0)\n
+ * 0000H:0m \n
+ * 0001H:1m \n
+ * :\n
+ * FFFDH:65533m \n
+ * FFFEH:65534m and larger than 65534m \n
+ * FFFFH:no data
+ * - Longitude : (WGS-84)(10^ -7degree as 1) \n
+ * East longitude is positive value and west longitude is negative value.
+ * - Latitude : (WGS-84)(10^ -7degree as 1) \n
+ * North latitude positive value and south latitude is negative value.
+ */
+typedef struct {
+ uint8_t getMethod; //!< \~english get method
+ uint8_t SyncCnt; //!< \~english Synchrony count
+ uint8_t isEnable; //!< \~english enable or not
+ uint8_t posSts; //!< \~english position status
+ uint16_t posAcc; //!< \~english position accuracy
+ int32_t Longitude; //!< \~english longitude(10^-7degree)
+ //!< \~english max: +180.0000000degree[east longitude]
+ //!< \~english min: -170.9999999degree[west longitude]
+ int32_t Latitude; //!< \~english latitude(10^-7degree)
+ //!< \~english max: +90.0000000degree[north Latitude]
+ //!< \~english min: -90.0000000degree[south Latitude]
+} SENSORLOCATION_LONLATINFO_DAT;
+
+
+/**
+ * @struct SENSORLOCATION_ALTITUDEINFO_DAT
+ * \~english altitude information data
+ * - Get method(getMethod)
+ * - SENSOR_GET_METHOD_GPS - altitude from GPS
+ * - SENSOR_GET_METHOD_NAVI - altitude from Navigation
+ * - Synchrony count(SyncCnt)
+ * - Count for position data synchronous \n
+ * When delivery altitude and heading data, position data can be synchronized by SyncCnt. \n
+ * But the data of different method can not be synchronized by SyncCnt.\n
+ * example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by SyncCnt.\n
+ * example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be
+ * synchronized by SyncCnt. \n
+ * Caution: The sensor count in sensor data delivery is another data.
+ * - Enable or not(isEnable) \n
+ * To describe this delivery message is whether can be used or not.
+ * - 0 - not avaliable
+ * - not 0 - avaliable
+ * - when GPS data specified, Altitude is invalid at following condition(so [not avaliable] provieded):
+ * - Immediately after system start, GPS unit has not received current location data and GPS unit status \n
+ * is not positioning fix
+ * - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+ * - If the status is [not avaliable], data following can not be guaranteed.
+ * - Altitude
+ * - altitude data(unit 0.01m)
+ */
+typedef struct {
+ uint8_t getMethod; //!< \~english get method
+ uint8_t SyncCnt; //!< \~english Synchrony count
+ uint8_t isEnable; //!< \~english enable or not
+ uint8_t Reserved[3]; //!< \~english reserve
+ int32_t Altitude; //!< \~english altitude(0.01m)
+} SENSORLOCATION_ALTITUDEINFO_DAT;
+
+
+/**
+ * @struct SENSORMOTION_HEADINGINFO_DAT
+ * \~english heading information data
+ * - Get method(getMethod)
+ * - SENSOR_GET_METHOD_GPS - Heading from GPS
+ * - SENSOR_GET_METHOD_NAVI - Heading from Navi
+ * - Synchrony count(SyncCnt)
+ * - Count for position data synchronous \n
+ * When delivery altitude and heading data, position data can be synchronized by this count. \n
+ * But the data of different method can not be synchronized by this count.\n
+ * example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n
+ * example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be \n
+ * synchronized by the count. \n
+ * Caution: The sensor count in sensor data delivery is another data.
+ * - Enable or not(isEnable) \n
+ * To describe this data is whether enable or not
+ * - 0 - not avaliable
+ * - not 0 - avaliable
+ * - Heading is invalid at following condition when GPS data specified, so [not avaliable] provieded \n
+ * - Immediately after system start, GPS unit has not received current location data and GPS unit status \n
+ * is not positioning fix
+ * - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+ * - If the status is [not avaliable], data following can not be guaranteed.
+ * - Position status(posSts)
+ * - It is valid only when "Get method is Navi" and "evironment is _CWORD80_".(otherwise it will be set as 0)
+ * - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+ * - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+ * - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
+ * maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+ * - Heading
+ * - Heading data(0.01degree as 1, based on north and clockwise count)\n
+ * But in environment _CWORD95_/_CWORD101___CWORD84_,the heading from Navi is a approximate that separate 360 degree \n
+ * into 16 part. \n
+ * example: 0, 2300, 4500, ..., 31500, 33800
+ */
+typedef struct {
+ uint8_t getMethod; //!< \~english get method
+ uint8_t SyncCnt; //!< \~english Synchrony count
+ uint8_t isEnable; //!< \~english enable or not
+ uint8_t posSts; //!< \~english position status
+ uint8_t Reserved1[2]; //!< \~english reserve
+ uint16_t Heading; //!< \~english heading(0.01degree)
+ //!< \~english max: 359.99 degree
+ //!< \~english min: 0.00 degree
+ uint8_t Reserved2[2]; //!< \~english reserve
+} SENSORMOTION_HEADINGINFO_DAT;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS_FIX_CNT
+ * \~english position fix count data structure
+ */
+typedef struct {
+ uint32_t ulCnt3d; //!< \~english position fix count:3D
+ uint32_t ulCnt2d; //!< \~english position fix count:2D
+ uint32_t ulCntElse; //!< \~english position fix count:not fix
+} NAVIINFO_DIAG_GPS_FIX_CNT;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS_FIX_XYZ
+ * \~english longitude and latitude data structure
+ */
+typedef struct {
+ int32_t lLat; //!< \~english GPS latitude
+ int32_t lLon; //!< \~english GPS longitude
+} NAVIINFO_DIAG_GPS_FIX_XYZ;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS_FIX
+ * \~english position fix information structure
+ */
+typedef struct {
+ uint8_t ucFixSts; //!< \~english fix status
+ uint8_t ucReserve[3]; //!< \~english reserve
+ NAVIINFO_DIAG_GPS_FIX_CNT stCnt; //!< \~english fix count data
+ NAVIINFO_DIAG_GPS_FIX_XYZ stWgs84; //!< \~english longitude and latitude data
+} NAVIINFO_DIAG_GPS_FIX;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS_PRN
+ * \~english satellite information structure
+ * - reception status(ucRcvSts)
+ * - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE : not used
+ * - NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING : searching
+ * - NAVIINFO_DIAG_GPS_RCV_STS_TRACHING : tracking
+ * - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX : not used for position fix
+ * - NAVIINFO_DIAG_GPS_RCV_STS_USEFIX : used for position fix
+ */
+typedef struct {
+ uint8_t ucRcvSts; //!< \~english reception status
+ uint8_t ucPrn; //!< \~english satellite No.
+ uint8_t ucelv; //!< \~english satellite dramatic angle
+ uint8_t ucLv; //!< \~english satellite signal level
+ uint16_t usAzm; //!< \~english satellite azimuth
+ uint8_t ucReserve[2]; //!< \~english reserve
+} NAVIINFO_DIAG_GPS_PRN;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS_SAT
+ * \~english all satellite information structure
+ */
+typedef struct {
+ NAVIINFO_DIAG_GPS_PRN stPrn[12]; //!< \~english all satellite information
+} NAVIINFO_DIAG_GPS_SAT;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS
+ * \~english position fixed and satellite information structure
+ */
+typedef struct {
+ NAVIINFO_DIAG_GPS_FIX stFix; //!< \~english position fixed information
+ NAVIINFO_DIAG_GPS_SAT stSat; //!< \~english all satellite information
+} NAVIINFO_DIAG_GPS;
+
+/**
+ * @struct NAVIINFO_NAVI_GPS
+ * \~english other GPS related information structure
+ * - altitude(altitude) \n
+ * As the altitude is used as unit [0.01m] in internal, \n
+ * the altitude data range is (-21,474,839~21,474,839).
+ * - UTC(utc)
+ * - The time set after rollover.
+ * - date and time status(tdsts)
+ * - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+ * - 1= time output from RTC Backup(have time adjustment result)
+ * - 2= time adjustment completed
+ */
+typedef struct {
+ int32_t altitude; //!< \~english altitude
+ uint16_t speed; //!< \~english speed
+ uint16_t heading; //!< \~english heading
+ NAVIINFO_UTCTIME utc; //!< \~english UTC time
+ uint8_t tdsts; //!< \~english date and time status
+ uint8_t reserve[3]; //!< \~english reserve
+} NAVIINFO_NAVI_GPS;
+
+/**
+ * @struct NAVIINFO_ALL
+ * \~english Navi data structure
+ */
+typedef struct {
+ uint8_t ucSensorCnt; //!< \~english sensor count
+ uint8_t reserve[3]; //!< \~english reserve
+ NAVIINFO_DIAG_GPS stDiagGps; //!< \~english position fix related information
+ NAVIINFO_NAVI_GPS stNaviGps; //!< \~english other GPS related information
+} NAVIINFO_ALL;
+
+/**
+ * @struct POS_MSGINFO
+ * \~english message delivery positioning sensor information
+ */
+typedef struct {
+ DID did; //!< \~english data ID
+ PNO pno; //!< \~english delivery destination PNO
+ uint16_t size; //!< \~english data body size
+ uint8_t rcv_flag; //!< \~english received flag
+ uint8_t reserve; //!< \~english reserve
+ uint8_t data[POS_MSG_INFO_DSIZE]; //!< \~english data body
+} POS_MSGINFO;
+
+/**
+ * @struct SENSOR_GPSTIME
+ * \~english GPS time information
+ * - date amd time status(tdsts)
+ * - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+ * - 1= time output from RTC Backup(have time adjustment result)
+ * - 2= time adjustment completed
+ */
+typedef struct {
+ NAVIINFO_UTCTIME utc; //!< \~english UTC time
+ uint8_t tdsts; //!< \~english time status
+ uint8_t reserve[3]; //!< \~english reserve
+} SENSOR_GPSTIME;
+
+#define SENSOR_MSG_GPSTIME SENSOR_GPSTIME //!< \~english GPS time information
+#define SENSOR_GPSTIME_RAW SENSOR_GPSTIME //!< \~english GPS time information
+
+/**
+ * @struct MdevGpsCustomData
+ * \~english Struct of Gps custom data
+ */
+typedef struct MdevGpsCustomData {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ SENSORLOCATION_LONLATINFO_DAT st_lonlat; //!< \~english longtitude,latitude
+ SENSORLOCATION_ALTITUDEINFO_DAT st_altitude; //!< \~english altitude
+ SENSORMOTION_HEADINGINFO_DAT st_heading; //!< \~english headings
+ SENSOR_MSG_GPSTIME st_gps_time; //!< \~english Gps Time
+ NAVIINFO_DIAG_GPS st_diag_gps; //!< \~english Gps data from diag
+} MDEV_GPS_CUSTOMDATA;
+
+/**
+ * @struct MdevGpsCustomDataMgs
+ * \~english Struct of Gps custom data message
+ */
+typedef struct MdevGpsCustomDataMgs {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_CUSTOMDATA st_data; //!< \~english Gps Custom Data
+} MDEV_GPS_CUSTOMDATA_MGS;
+
+/**
+ * @struct MdevGpsRtc
+ * \~english Struct of Gps RTC data
+ */
+typedef struct MdevGpsRtc {
+ u_int32 ul_retsts; //!< \~english return status
+ u_int8 uc_datalen; //!< \~english data length
+ u_int8 uc_ctrlcode; //!< \~english control code
+ u_int8 uc_bcd_year; //!< \~english year
+ u_int8 uc_bcd_month; //!< \~english month
+ u_int8 uc_bcd_day; //!< \~english day
+ u_int8 uc_bcd_hour; //!< \~english hour
+ u_int8 uc_bcd_min; //!< \~english minute
+ u_int8 uc_bcd_sec; //!< \~english second
+ u_int8 uc_status; //!< \~english status
+ u_int8 u_reserve[3]; //!< \~english reserve
+} MDEV_GPS_RTC;
+
+/**
+ * @struct MdevGpsGpsTime
+ * \~english Struct of Gps Time
+ */
+typedef struct MdevGpsGpsTime {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ MDEV_GPS_RTC st_rtc_data; //!< \~english Gps Time
+} MDEV_GPS_GPSTIME;
+
+/**
+ * @struct MdevGpsGpsTimeMgs
+ * \~english Struct of Gps Time message
+ */
+typedef struct MdevGpsGpsTimeMgs {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_GPSTIME st_data; //!< \~english Gps Time Data
+} MDEV_GPS_GPSTIME_MGS;
+
+/**
+ * @struct DevGpsUtcTime
+ * \~english Struct of Gps UTC time
+ */
+typedef struct DevGpsUtcTime {
+ u_int16 us_year; //!< \~english Year
+ u_int8 uc_month; //!< \~english month
+ u_int8 uc_date; //!< \~english day
+ u_int8 uc_hour; //!< \~english hour
+ u_int8 uc_minute; //!< \~english minute
+ u_int8 uc_second; //!< \~english second
+ u_int8 u_reserved; //!< \~english reserve
+} DEV_GPS_UTCTIME;
+
+/**
+ * @enum MdevGpsFixSts
+ * \~english enumeration of gps fix status
+ */
+typedef enum MdevGpsFixSts {
+ MDEV_GPS_NOTFIX = 0, //!< \~english not fix
+ MDEV_GPS_FIX //!< \~english fix
+} MDEV_GPS_FIX_STS;
+
+/**
+ * @struct MdevGpsNmea
+ * \~english Struct of gps NMEA Data
+ */
+typedef struct MdevGpsNmea {
+ u_int8 uc_nmea_data[GPS_MSG_VSINFO_DSIZE]; //!< \~english NMEA Data
+} MDEV_GPS_NMEA;
+
+/**
+ * @struct MdevGpsFullbin
+ * \~english Struct of Gps full bin data
+ */
+typedef struct MdevGpsFullbin {
+ u_int8 uc_fullbin_data[GPS_FULLBIN_SZ]; //!< \~english gps full bin data
+ u_int8 u_reserve[3]; //!< \~english reserve
+} MDEV_GPS_FULLBIN;
+
+/**
+ * @struct MdevGps_CWORD44_gp4
+ * \~english Struct of Gps _CWORD44_GP4 data
+ */
+typedef struct MdevGps_CWORD44_gp4 {
+ u_int8 uc__CWORD44_gp4_data[GPS__CWORD44_GP4_SZ]; //!< \~english gps _CWORD44_GP4 data
+ u_int8 u_reserve; //!< \~english reserve
+} MDEV_GPS__CWORD44_GP4;
+
+/**
+ * @struct MdevGpsCycledata
+ * \~english Struct of Gps cycle data
+ */
+typedef struct MdevGpsCycledata {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ u_int8 uc_data[GPS_MSGDATA_SZ_MAX - sizeof(MDEV_GPS_DATA_KIND)]; //!< \~english data
+} MDEV_GPS_CYCLEDATA;
+
+/**
+ * @struct MdevGpsCycledataMsg
+ * \~english Struct of Gps cycle data message
+ */
+typedef struct MdevGpsCycledataMsg {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_CYCLEDATA st_data; //!< \~english data
+} MDEV_GPS_CYCLEDATA_MSG;
+
+/**
+ * @struct MdevGpsRawdataNmea
+ * \~english Struct of Gps NMEA Raw Data
+ */
+typedef struct MdevGpsRawdataNmea {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ MDEV_GPS_NMEA st_nmea_data; //!< \~english NMEA Data
+} MDEV_GPS_RAWDATA_NMEA;
+
+/**
+ * @struct MdevGpsRawdataNmeaMsg
+ * \~english Struct of Gps NMEA Raw Data message
+ */
+typedef struct MdevGpsRawdataNmeaMsg {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header(see vs-positioning-base-library)
+ MDEV_GPS_RAWDATA_NMEA st_data; //!< \~english data
+} MDEV_GPS_RAWDATA_NMEA_MSG;
+
+/**
+ * @struct MdevGpsRawdataFullbin
+ * \~english Struct of Gps Full Bin Raw Data
+ */
+typedef struct MdevGpsRawdataFullbin {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ MDEV_GPS_FULLBIN st_fullbin_data; //!< \~english Full Binary Data
+} MDEV_GPS_RAWDATA_FULLBIN;
+
+/**
+ * @struct MdevGpsRawdataFullbinMsg
+ * \~english Struct of Gps Full Bin Raw Data message
+ */
+typedef struct MdevGpsRawdataFullbinMsg {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_RAWDATA_FULLBIN st_data; //!< \~english Gps Full Bin Data
+} MDEV_GPS_RAWDATA_FULLBIN_MSG;
+
+/**
+ * @struct MdevGpsRawdata_CWORD44_gp4
+ * \~english Struct of Gps _CWORD44_GP4 Raw Data
+ */
+typedef struct MdevGpsRawdata_CWORD44_gp4 {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ MDEV_GPS__CWORD44_GP4 st__CWORD44_gp4; //!< \~english Gps _CWORD44_GP4 Data
+} MDEV_GPS_RAWDATA__CWORD44_GP4;
+
+/**
+ * @struct MdevGpsRawdata_CWORD44_gp4Msg
+ * \~english Struct of Gps _CWORD44_GP4 Raw Data message
+ */
+typedef struct MdevGpsRawdata_CWORD44_gp4Msg {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_RAWDATA__CWORD44_GP4 st_data; //!< \~english Gps _CWORD44_GP4 Raw Data
+} MDEV_GPS_RAWDATA__CWORD44_GP4_MSG;
+
+/**
+ * @struct SENSORMOTION_SPEEDINFO_DAT
+ * \~english speed information data
+ * - Get method(getMethod)
+ * - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
+ * - SENSOR_GET_METHOD_NAVI - speed from Navi
+ * - Synchrony count(SyncCnt)
+ * - 0 (not change).
+ * - Enable or not(isEnable) \n
+ * To describe this data is whether enable or not
+ * - 0 - not avaliable
+ * - not 0 - avaliable
+ * - Speed is invalid at following condition when speed pulse specified, so [not avaliable] provieded
+ * - Immediately after system start, the sensor data have not been received from SYS micon
+ * - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+ * - If the status is [not avaliable], data following can not be guaranteed.
+ * - Speed
+ * - speed data(unit 0.01m/sec)
+ */
+typedef struct {
+ uint8_t getMethod; //!< \~english get method
+ uint8_t SyncCnt; //!< \~english Synchrony count
+ uint8_t isEnable; //!< \~english enable or not
+ uint8_t Reserved1[3]; //!< \~english reserve
+ uint16_t Speed; //!< \~english speed(0.01m/sec)
+ uint8_t Reserved2[2]; //!< \~english reserve
+} SENSORMOTION_SPEEDINFO_DAT;
+
+/**
+ * @struct MdevGpsNavispeed
+ * \~english Struct of Gps speed data
+ */
+typedef struct MdevGpsNavispeed {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ u_int16 us_speed_kmph; //!< \~english Speed(km/h)
+ u_int8 u_reserve[2]; //!< \~english reserve
+ SENSORMOTION_SPEEDINFO_DAT st_speed; //!< \~english speed data
+} MDEV_GPS_NAVISPEED;
+
+/**
+ * @struct MdevGpsNavispeedMsg
+ * \~english Struct of Gps speed data message
+ */
+typedef struct MdevGpsNavispeedMsg {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_NAVISPEED st_data; //!< \~english Gps Speed Data
+} MDEV_GPS_NAVISPEED_MSG;
+
+/**
+ * @struct TgGpsSndData
+ * \~english Struct of _CWORD82_ Gps send data
+ */
+typedef struct TgGpsSndData {
+ uint8_t reserve[4]; //!< \~english reserve
+ u_int16 us_size; //!< \~english send data length
+ u_int8 ub_data[502]; //!< \~english send data
+} TG_GPS_SND_DATA;
+
+/**
+ * @struct TgGpsRetPram
+ * \~english Gps Response data
+ */
+typedef struct TgGpsRetPram {
+ unsigned int ret_status; //!< \~english response flag
+ unsigned char data_len; //!< \~english data size
+ unsigned char ctrl_code; //!< \~english control code
+ unsigned char gps_data[GPS_TLGRM_LEN]; //!< \~english data contents
+} TG_GPS_RET_PRAM;
+
+/**
+ * @struct SensorWknRollOverHal
+ * \~english Struct of GPS week number
+ */
+typedef struct SensorWknRollOverHal {
+ uint16_t us_wkn; //!< \~english GPS week number
+} SENSOR_WKN_ROLLOVER_HAL;
+
+/**
+ * @struct POS_DATETIME
+ * \~english GPS time information structure
+ */
+typedef struct {
+ uint16_t year; //!< \~english year
+ uint8_t month; //!< \~english month
+ uint8_t date; //!< \~english day
+ uint8_t hour; //!< \~english hour
+ uint8_t minute; //!< \~english minute
+ uint8_t second; //!< \~english second
+ uint8_t reserved; //!< \~english reserve
+} POS_DATETIME;
+
+/**
+ * @struct TG_GPS_RET_RESET
+ * \~english GPS reset status
+ */
+typedef struct {
+ unsigned long ret_rst_status; //!< \~english response GPS reset status
+} TG_GPS_RET_RESET;
+
+/**
+ * @struct TG_GPS_RET_RESET_MSG
+ * \~english GPS reset information message
+ */
+typedef struct {
+ TG_GPS_RET_RESET data; //!< \~english GPS reset status data
+} TG_GPS_RET_RESET_MSG;
+
+/**
+ * @struct VEHICLE_MSG_SEND_DAT
+ * \~english Vehicle information setting message structure
+ */
+typedef struct {
+ DID did; //!< \~english Data ID
+ u_int16 size; //!< \~english Data size
+ u_int8 data[502]; //!< \~english Data
+} VEHICLE_MSG_SEND_DAT;
+
+/**
+ * @struct GpsWeekCorCntMsg
+ * \~english Gps Week correction count notify message structure
+ */
+typedef struct GpsWeekCorCntMsg {
+ T_APIMSG_MSGBUF_HEADER stHead; //!< \~english Message header
+ u_int8 gpsweekcorcnt; //!< \~english Gps Week correction count
+ int8 dummy[3]; //!< \~english Alignment adjustment
+} CLOCKGPS_GPSWEEKCOR_CNT_MSG;
+
+/** @}*/ // end of positioning_hal
+/** @}*/ // end of positioning
+
+/*---------------------------------------------------------------------------*/
+#endif // HAL_API_GPS_HAL_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/hal_api/positioning_hal.h b/positioning_hal/hal_api/positioning_hal.h
new file mode 100755
index 0000000..8a74b81
--- /dev/null
+++ b/positioning_hal/hal_api/positioning_hal.h
@@ -0,0 +1,872 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_POSITIONING_HAL_H_
+#define HAL_API_POSITIONING_HAL_H_
+
+/**
+ * @file positioning_hal.h
+ */
+
+/** @addtogroup positioning
+ * @{
+ */
+/** @addtogroup positioning_hal
+ * @ingroup positioning
+ * @{
+ */
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include <native_service/frameworkunified_types.h>
+#include <vehicle_service/pos_message_header.h>
+#include <vehicle_service/std_types.h>
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define POSHAL_THREAD_NAME_SENS "POS_Sens"
+//!< \~english Thread name for receive sensor
+#define POSHAL_THREAD_NAME_GPS_MAIN "POS_Gps"
+//!< \~english Thread name for GPS NMEA analysis and delivery message
+#define POSHAL_THREAD_NAME_GPS_RECV "POS_Gps_Recv"
+//!< \~english Thread name for receive GPS
+#define POSHAL_THREAD_NAME_GPS_ROLOVR "POS_Gps_Rolovr"
+//!< \~english Thread name for monitoring GPS rollover
+
+#define POSHAL_DID_SNS_COUNTER 0x8000001A
+//!< \~english Data ID of sensor counter
+#define POSHAL_DID_SPEED_PULSE 0x80000012
+//!< \~english Data ID of speed pulse
+#define POSHAL_DID_SPEED_PULSE_FLAG 0x80000076
+//!< \~english Data ID of speed pulse flag
+#define POSHAL_DID_SPEED_PULSE_FST 0x80000028
+//!< \~english Data ID of first time speed pulse
+#define POSHAL_DID_SPEED_PULSE_FLAG_FST 0x8000007D
+//!< \~english Data ID of first time speed pulse flag
+#define POSHAL_DID_SPEED_KMPH 0x80000013
+//!< \~english Data ID of KMPH speed
+#define POSHAL_DID_PULSE_TIME 0x8000003A
+//!< \~english Data ID of pulse time
+#define POSHAL_DID_GYRO_X 0x80000014
+//!< \~english Data ID of X axis of gyro
+#define POSHAL_DID_GYRO_Y 0x80000085
+//!< \~english Data ID of Y axis of gyro
+#define POSHAL_DID_GYRO_Z 0x80000086
+//!< \~english Data ID of Z axis ofgyro
+#define POSHAL_DID_GYRO POSHAL_DID_GYRO_X
+//!< \~english Data ID of gyro
+#define POSHAL_DID_GYRO_X_FST 0x80000029
+//!< \~english Data ID of first time X axis gyro
+#define POSHAL_DID_GYRO_Y_FST 0x80000043
+//!< \~english Data ID of first time Y axis gyro
+#define POSHAL_DID_GYRO_Z_FST 0x80000023
+//!< \~english Data ID of first time Z axis gyro
+#define POSHAL_DID_GYRO_FST POSHAL_DID_GYRO_X_FST
+//!< \~english Data ID of first time gyro
+#define POSHAL_DID_GYRO_EXT 0x80000027
+//!< \~english Data ID of extend gyro
+#define POSHAL_DID_GYRO_TEMP 0x80000090
+//!< \~english Data ID of gyro temperature
+#define POSHAL_DID_GYRO_TEMP_FST 0x80000091
+//!< \~english Data ID of first time gyro temperature
+#define POSHAL_DID_REV 0x80000017
+//!< \~english Data ID of reverse signal
+#define POSHAL_DID_REV_FST 0x8000007E
+//!< \~english Data ID of first time reverse signal
+#define POSHAL_DID_GSNS_X 0x80000015
+//!< \~english Data ID of x axis gsensor
+#define POSHAL_DID_GSNS_Y 0x80000016
+//!< \~english Data ID of Y axis gsensor
+#define POSHAL_DID_GSNS_Z 0x80000026
+//!< \~english Data ID of Z axis gsensor
+#define POSHAL_DID_GSNS_X_FST 0x80000087
+//!< \~english Data ID of first time x axis gsensor
+#define POSHAL_DID_GSNS_Y_FST 0x80000088
+//!< \~english Data ID of first time Y axis gsensor
+#define POSHAL_DID_GSNS_Z_FST 0x80000089
+//!< \~english Data ID of first time Z axis gsensor
+#define POSHAL_DID_GPS_NMEA 0x8000009AU
+//!< \~english Data ID of GPS NMEA sentence
+#define POSHAL_DID_GPS_ANTENNA 0x80000019
+//!< \~english Data ID of GPS antenna status
+#define POSHAL_DID_GPS_CUSTOMDATA 0x80000094U
+//!< \~english Data ID of GPS custom data
+#define POSHAL_DID_GPS_CUSTOMDATA_NAVI 0x800000A0
+//!< \~english Data ID of GPS custom data for navi
+#define POSHAL_DID_GPS_TIME 0x80000098
+//!< \~english Data ID of GPS time
+#define POSHAL_DID_GPS_TIME_RAW 0x800000B1U
+//!< \~english Data ID of GPS raw time
+#define POSHAL_DID_GPS_VERSION 0x8000001E
+//!< \~english Data ID of GPS version
+#define POSHAL_DID_GPS__CWORD82___CWORD44_GP4 0x80000031U
+//!< \~english Data ID of _CWORD82_ GPS _CWORD44_GP4 data
+#define POSHAL_DID_GPS__CWORD82__FULLBINARY 0x80000032U
+//!< \~english Data ID of _CWORD82_ GPS full binary data
+#define POSHAL_DID_GPS_WKNROLLOVER 0x800000B2U
+//!< \~english Data ID of GPS week counter
+#define POSHAL_DID_GPS_CLOCK_DRIFT 0x800000B3U
+//!< \~english Data ID of GPS time drift data
+#define POSHAL_DID_GPS_CLOCK_FREQ 0x800000B4U
+//!< \~english Data ID of GPS time frequency data
+#define POSHAL_DID_GPS_INTERRUPT_FLAG 0x80000077
+//!< \~english Data ID of GPS interrupt flag
+
+#define CONFIG_SENSOR_EXT_VALID 1 //!< \~english for first sensor
+
+#define CID_LINESENS_VEHICLE_DATA 0x0300 //!< \~english vehicle notify ID
+
+/**
+ * \~english @brief LineSensor Vehicle Signal Notification
+ * \~english @brief This command is sent when LineSensor vehicle signals are notified when sensor data is received.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataG\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatG\n
+ * \~english @brief Message body (vehicle signal notification message information) structure @ref LsdrvLsdataG\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_G 0x0303
+
+/**
+ * \~english @brief Gyro Failure Status Notification
+ * \~english @brief This command is sent when giro failure status is notified.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataGyroTrouble\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatGyroTrouble\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_GYRO_TROUBLE 0x0304
+
+/**
+ * \~english @brief Get SYS GPS Interrupt Signals
+ * \~english @brief This command is sent when SYS GPS interrupt signal is acquired.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataGpsInterruptSignal\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatGpsInterruptSignal\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_SYS_GPS_INTERRUPT_SIGNAL 0x0305
+
+
+/**
+ * \~english @brief Gyro Connection Status Notification
+ * \~english @brief This command is sent when giro connection status is notified.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataGyroConnectStatus\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatGyroConnectStatus\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_GYRO_CONNECT_STATUS 0x0306
+
+
+/**
+ * \~english @brief GPS Antenna Connection Status Notification
+ * \~english @brief This command is sent when the GPS antenna connection status is notified.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataGpsAntennaStatus\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatGpsAntennaStatus\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_GPS_ANTENNA_STATUS 0x0307
+
+
+/**
+ * \~english @brief LineSensor Vehicle Signal Notification(Initial Sensor)
+ * \~english @brief This command is sent when LineSensor vehicle signals (initial sensor) are notified.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataFst\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatFst\n
+ * \~english @brief Gyro X-axis @ref LsdrvLsdataFstGyroX\n
+ * \~english @brief Gyro Y-axis @ref LsdrvLsdataFstGyroY\n
+ * \~english @brief Gyro Z-axis @ref LsdrvLsdataFstGyroZ\n
+ * \~english @brief Velocity information @ref LsdrvLsdataFstSpeed\n
+ * \~english @brief Vehicle speed pulse @ref LsdrvLsdataFstSpeedPulseFlag\n
+ * \~english @brief REV flag @ref LsdrvLsdataFstRev\n
+ * \~english @brief Gyro Temperature @ref LsdrvLsdataFstGyroTemp\n
+ * \~english @brief G-sensor X-axis @ref LsdrvLsdataFstGsensorX\n
+ * \~english @brief G-sensor Y-axis @ref LsdrvLsdataFstGsensorY\n
+ * \~english @brief G-sensor Z-axis @ref LsdrvLsdataFstGsensorZ\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_FST 0x0302
+
+/**
+ * \~english @brief GPS data notification
+ * \~english @brief This command is used to notify the data input from the GPS receiver device.\n
+ * \~english @brief Message related structure @ref SensorMsgGpsdata\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref SensorMsgGpsdataDat\n
+ */
+#define CID_GPS_DATA 0x0301
+
+/**
+ * \~english @brief Notification of effective ephemeris number at shutdown
+ * \~english @brief This command is sent to notify the effective ephemeris number at shutdown.\n
+ * \~english @brief Message related structure @ref SensorMsgGpsdata\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message body structure @ref SensorMsgGpsdata\n
+ */
+#define CID_EPH_NUM_NOTIFICATION 0x0310
+
+
+#define LSDRV_FSTSNS_SENSOR_FIRST_SAVE_NUM 50
+//!< \~english number of save first sensor
+
+#define LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM 30
+//!< \~english number of send first sensor
+
+#define LSDRV_FSTSNS_DETAILED_DATA_GYRO_NUM 10
+//!< \~english number of gyro including detail data
+
+#define LSDRV_FSTSNS_DETAILED_DATA_GSENSOR_NUM 10
+//!< \~english number of Gsns includeing detail data
+
+#define LSDRV_FSTSNS_DSIZE_GYRO_X (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GYRO_NUM * 2)
+//!< \~english data size of X axis of gyro
+#define LSDRV_FSTSNS_DSIZE_GYRO_Y (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GYRO_NUM * 2)
+//!< \~english data size of Y axis of gyro
+#define LSDRV_FSTSNS_DSIZE_GYRO_Z (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GYRO_NUM * 2)
+//!< \~english data size of Z axis of gyro
+#define LSDRV_FSTSNS_DSIZE_SPEED (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * 2)
+//!< \~english data size of speed
+#define LSDRV_FSTSNS_DSIZE_SPEED_FLG LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM
+//!< \~english data size of speed pulse
+#define LSDRV_FSTSNS_DSIZE_REV LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM
+//!< \~english data size of reverse
+#define LSDRV_FSTSNS_DSIZE_GYRO_TEMP (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * 2)
+//!< \~english data size of gyro temperature
+#define LSDRV_FSTSNS_DSIZE_GSENSOR_X (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GSENSOR_NUM * 2)
+//!< \~english data size of X axis of Gsns
+
+#define LSDRV_FSTSNS_DSIZE_GSENSOR_Y (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GSENSOR_NUM * 2)
+ //!< \~english data size of Y axis of Gsns
+#define LSDRV_FSTSNS_DSIZE_GSENSOR_Z (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GSENSOR_NUM * 2)
+//!< \~english data size of Z axis of Gsns
+
+#define SENSOR_MSG_VSINFO_DSIZE 1904 //!< \~english message body max size
+
+
+// Thread control Command ID
+#define CID_THREAD_CREATE_COMP (0x0001) //!< \~english Thread Start Complete Notify Command ID
+#define CID_THREAD_STOP_REQ (0x0002) //!< \~english Thread Stop Request Command ID
+#define CID_THREAD_STOP_COMP (0x0003) //!< \~english Thread Stop Complete Notify Command ID
+
+// A vehicle signal of data size
+#define LSDRV_SNDMSG_DTSIZE_1 1 //!< \~english SndMSG data size 1Byte
+#define LSDRV_SNDMSG_DTSIZE_2 2 //!< \~english SndMSG data size 2Byte
+#define LSDRV_SNDMSG_DTSIZE_20 20 //!< \~english SndMSG data size 20Byte
+#define LSDRV_SNDMSG_DTSIZE_132 132 //!< \~english SndMSG data size 132Byte
+
+// NMEA receive flag
+#define POS_SNS_GPS_NMEA_GGA (0x00000001U) //!< \~english GGA sentence
+#define POS_SNS_GPS_NMEA_GLL (0x00000002U) //!< \~english GLL sentence
+#define POS_SNS_GPS_NMEA_GSA1 (0x00000004U) //!< \~english GSA1 sentence
+#define POS_SNS_GPS_NMEA_GSA2 (0x00000008U) //!< \~english GSA2 sentence
+#define POS_SNS_GPS_NMEA_GSA3 (0x00000010U) //!< \~english GSA3 sentence
+#define POS_SNS_GPS_NMEA_GSA4 (0x00000020U) //!< \~english GSA4 sentence
+#define POS_SNS_GPS_NMEA_GST (0x00000040U) //!< \~english GST sentence
+#define POS_SNS_GPS_NMEA_RMC (0x00000080U) //!< \~english RMC sentence
+#define POS_SNS_GPS_NMEA_VTG (0x00000100U) //!< \~english VTG sentence
+#define POS_SNS_GPS_NMEA_GSV1 (0x00000200U) //!< \~english GSV1 sentence
+#define POS_SNS_GPS_NMEA_GSV2 (0x00000400U) //!< \~english GSV2 sentence
+#define POS_SNS_GPS_NMEA_GSV3 (0x00000800U) //!< \~english GSV3 sentence
+#define POS_SNS_GPS_NMEA_GSV4 (0x00001000U) //!< \~english GSV4 sentence
+#define POS_SNS_GPS_NMEA_GSV5 (0x00002000U) //!< \~english GSV5 sentence
+#define POS_SNS_GPS_NMEA_GSV6 (0x00004000U) //!< \~english GSV6 sentence
+#define POS_SNS_GPS_NMEA_GSV7 (0x00008000U) //!< \~english GSV7 sentence
+#define POS_SNS_GPS_NMEA_GSV8 (0x00010000U) //!< \~english GSV8 sentence
+#define POS_SNS_GPS_NMEA_GSV9 (0x00020000U) //!< \~english GSV9 sentence
+#define POS_SNS_GPS_NMEA_GSV10 (0x00040000U) //!< \~english GSV10 sentence
+#define POS_SNS_GPS_NMEA_GSV11 (0x00080000U) //!< \~english GSV11 sentence
+#define POS_SNS_GPS_NMEA_GSV12 (0x00100000U) //!< \~english GSV12 sentence
+#define POS_SNS_GPS_NMEA_GSV13 (0x00200000U) //!< \~english GSV13 sentence
+#define POS_SNS_GPS_NMEA_RESERVE1 (0x00400000U) //!< \~english Reserved
+#define POS_SNS_GPS_NMEA_RESERVE2 (0x00800000U) //!< \~english Reserved
+
+
+/**
+ * @enum POS_SNS_GPS_NMEA_SNO
+ * \~english type of NMEA
+ */
+typedef enum {
+ POS_SNS_GPS_NMEA_SNO_GGA = 0, //!< \~english GGA sentence
+ POS_SNS_GPS_NMEA_SNO_GLL, //!< \~english GLL sentence
+ POS_SNS_GPS_NMEA_SNO_GSA1, //!< \~english GSA1 sentence
+ POS_SNS_GPS_NMEA_SNO_GSA2, //!< \~english GSA2 sentence
+ POS_SNS_GPS_NMEA_SNO_GSA3, //!< \~english GSA3 sentence
+ POS_SNS_GPS_NMEA_SNO_GSA4, //!< \~english GSA4 sentence
+ POS_SNS_GPS_NMEA_SNO_GST, //!< \~english GST sentence
+ POS_SNS_GPS_NMEA_SNO_RMC, //!< \~english RMC sentence
+ POS_SNS_GPS_NMEA_SNO_VTG, //!< \~english VTG sentence
+ POS_SNS_GPS_NMEA_SNO_GSV1, //!< \~english GSV1 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV2, //!< \~english GSV2 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV3, //!< \~english GSV3 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV4, //!< \~english GSV4 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV5, //!< \~english GSV5 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV6, //!< \~english GSV6 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV7, //!< \~english GSV7 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV8, //!< \~english GSV8 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV9, //!< \~english GSV9 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV10, //!< \~english GSV10 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV11, //!< \~english GSV11 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV12, //!< \~english GSV12 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV13, //!< \~english GSV13 sentence
+ POS_SNS_GPS_NMEA_SNO_RESERVE1, //!< \~english Reserved
+ POS_SNS_GPS_NMEA_SNO_RESERVE2, //!< \~english Reserved
+
+ POS_SNS_GPS_NMEA_SNO_MAX //!< \~english MAX sentence(invalid)
+} POS_SNS_GPS_NMEA_SNO;
+
+/**
+ * @enum LsDrvKind
+ * \~english type of Sensor
+ */
+typedef enum {
+ LSDRV_GYRO_X, //!< \~english Gyro X-Axis
+ LSDRV_GYRO_Y, //!< \~english Gyro Y-Axis
+ LSDRV_GYRO_Z, //!< \~english Gyro Z-Axis
+ LSDRV_SPEED_PULSE, //!< \~english Speed pulse
+ LSDRV_SPEED_PULSE_FLAG, //!< \~english Speed pulse Flag
+ LSDRV_SPEED_KMPH, //!< \~english Speed km/h
+ LSDRV_GYRO_EXT, //!< \~english extend Gyro
+ LSDRV_REV, //!< \~english Reverse
+ LSDRV_GYRO_TEMP, //!< \~english Gyro temperature
+ LSDRV_GSENSOR_X, //!< \~english G-sensor X-Axis
+ LSDRV_GSENSOR_Y, //!< \~english G-sensor Y-Axis
+ LSDRV_GSENSOR_Z, //!< \~english G-sensor Z-Axis
+ LSDRV_PULSE_TIME, //!< \~english Pulse time
+ LSDRV_SNS_COUNTER, //!< \~english Sensor counter
+ LSDRV_GPS_INTERRUPT_FLAG, //!< \~english GPS Interrupt Flag
+ LSDRV_KINDS_MAX //!< \~english MAX
+} LsDrvKind;
+
+
+/**
+ * @enum EnumTidPos
+ * \~english Thread id notified to positioning when starting or terminating each thread is completed.
+ */
+typedef enum EnumTidPos {
+ ETID_POS_MAIN = 0,
+ //!< \~english Thread for vehicle sensor(unused in hal)
+ ETID_POS_SENS,
+ //!< \~english Thread for receive sensor
+ ETID_POS_GPS,
+ //!< \~english Thread for GPS NMEA analysis and delivery message
+ ETID_POS_GPS_RECV,
+ //!< \~english Thread for receive GPS
+ ETID_POS_GPS_ROLLOVER,
+ //!< \~english Thread for monitoring GPS rollover
+ ETID_POS_MAX
+ //!< \~english Max thread id
+} EnumTID_POS;
+
+/**
+ * @struct LsdrvLsdata
+ * \~english Struct of LineSensor message
+ */
+typedef struct LsdrvLsdata {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 uc_rcvflag; //!< \~english receive flag
+ u_int8 uc_sns_cnt; //!< \~english sensor count
+ u_int8 u_reserve; //!< \~english reserve
+ u_int8 uc_data[132]; //!< \~english data contents
+} LSDRV_LSDATA;
+
+/**
+ * @struct LsdrvLsdataG
+ * \~english Struct of LineSensorG message
+ */
+typedef struct LsdrvLsdataG {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 uc_rcv_flag; //!< \~english receive flag
+ u_int8 uc_sns_cnt; //!< \~english sensor count
+ u_int8 reserve; //!< \~english reserve
+ u_int8 uc_data[132]; //!< \~english data content
+} LSDRV_LSDATA_G;
+
+/**
+ * @struct LsdrvLsdataFstGyroX
+ * \~english Struct of X axis of of gyro data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGyroX {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GYRO_X]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GYRO_X;
+
+/**
+ * @struct LsdrvLsdataFstGyroY
+ * \~english Struct of Y axis of of gyro data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGyroY {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GYRO_Y]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GYRO_Y;
+
+/**
+ * @struct LsdrvLsdataFstGyroZ
+ * \~english Struct of Z axis of of gyro data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGyroZ {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GYRO_Z]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GYRO_Z;
+
+/**
+ * @struct LsdrvLsdataFstSpeed
+ * \~english Struct of speed data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstSpeed {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_SPEED]; //!< \~english data contents
+} LSDRV_LSDATA_FST_SPEED;
+
+/**
+ * @struct LsdrvLsdataFstSpeedPulseFlag
+ * \~english Struct of speed pulse data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstSpeedPulseFlag {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_SPEED_FLG]; //!< \~english data contents
+} LSDRV_LSDATA_FST_SPEED_PULSE_FLAG;
+
+/**
+ * @struct LsdrvLsdataFstRev
+ * \~english Struct of reverse data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstRev {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_REV]; //!< \~english data contents
+} LSDRV_LSDATA_FST_REV;
+
+/**
+ * @struct LsdrvLsdataFstGyroTemp
+ * \~english Struct of gyro temperature data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGyroTemp {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GYRO_TEMP]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GYRO_TEMP;
+
+/**
+ * @struct LsdrvLsdataFstGsensorX
+ * \~english Struct of X axis of Gsns data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGsensorX {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GSENSOR_X]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GSENSOR_X;
+
+/**
+ * @struct LsdrvLsdataFstGsensorY
+ * \~english Struct of Y axis of Gsns data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGsensorY {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GSENSOR_Y]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GSENSOR_Y;
+
+/**
+ * @struct LsdrvLsdataFstGsensorZ
+ * \~english Struct of Z axis of Gsns data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGsensorZ {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GSENSOR_Z]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GSENSOR_Z;
+
+/**
+ * @struct LsdrvMsgLsdataDatFst
+ * \~english Struct of LineSensor data (first sensor message)
+ */
+typedef struct LsdrvMsgLsdataDatFst {
+ LSDRV_LSDATA_FST_GYRO_X st_gyro_x; //!< \~english data of X axis of gyro
+ LSDRV_LSDATA_FST_GYRO_Y st_gyro_y; //!< \~english data of Y axis of gyro
+ LSDRV_LSDATA_FST_GYRO_Z st_gyro_z; //!< \~english data of Z axis of gyro
+ LSDRV_LSDATA_FST_SPEED st_speed; //!< \~english data of speed
+ LSDRV_LSDATA_FST_SPEED_PULSE_FLAG st_spd_pulse_flg; //!< \~english data of speed pulse
+ LSDRV_LSDATA_FST_REV st_rev; //!< \~english data of reverse
+ LSDRV_LSDATA_FST_GYRO_TEMP st_gyro_temp; //!< \~english data of gyro temperature
+ LSDRV_LSDATA_FST_GSENSOR_X st_gsns_x; //!< \~english data of X axis of Gsns
+ LSDRV_LSDATA_FST_GSENSOR_Y st_gsns_y; //!< \~english data of Y axis of Gsns
+ LSDRV_LSDATA_FST_GSENSOR_Z st_gsns_z; //!< \~english data of Z axis of Gsns
+} LSDRV_MSG_LSDATA_DAT_FST;
+
+/**
+ * @struct LsdrvMsgLsdataDat
+ * \~english Struct of LineSensor package data
+ */
+typedef struct LsdrvMsgLsdataDat {
+ u_int8 uc_data_num; //!< \~english data number
+ u_int8 reserve[3]; //!< \~english reserve
+ LSDRV_LSDATA st_data[12]; //!< \~english data
+} LSDRV_MSG_LSDATA_DAT;
+
+/**
+ * @struct LsdrvMsgLsdata
+ * \~english Struct of LineSensor message data
+ */
+typedef struct LsdrvMsgLsdata {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT st_para; //!< \~english data of gyro
+} LSDRV_MSG_LSDATA;
+
+/**
+ * @struct LsdrvMsgLsdataDatG
+ * \~english Struct of LineSensorG package data
+ */
+typedef struct LsdrvMsgLsdataDatG {
+ u_int8 uc_data_num; //!< \~english data number
+ u_int8 reserve[3]; //!< \~english reserve
+ LSDRV_LSDATA_G st_data[15]; //!< \~english data
+} LSDRV_MSG_LSDATA_DAT_G;
+
+/**
+ * @struct LsdrvMsgLsdataG
+ * \~english Struct of LineSensorG message data
+ */
+typedef struct LsdrvMsgLsdataG {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_G st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_G;
+
+/**
+ * @struct LsdrvMsgLsdataDatGyroTrouble
+ * \~english Struct of Gyro trouble
+ */
+typedef struct LsdrvMsgLsdataDatGyroTrouble {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 reserve; //!< \~english reserve
+ u_int8 uc_data; //!< \~english data content
+ u_int8 reserve2; //!< \~english reserve
+} LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE;
+
+/**
+ * @struct LsdrvMsgLsdataGyroTrouble
+ * \~english Struct of message about Gyro trouble
+ */
+typedef struct LsdrvMsgLsdataGyroTrouble {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_GYRO_TROUBLE;
+
+/**
+ * @struct LsdrvMsgLsdataDatGpsInterruptSignal
+ * \~english Struct of Gps interrupt signal data
+ */
+typedef struct LsdrvMsgLsdataDatGpsInterruptSignal {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 reserve; //!< \~english reserve
+ u_int8 uc_data; //!< \~english data content
+ u_int8 reserve2; //!< \~english reserve
+} LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL;
+
+/**
+ * @struct LsdrvMsgLsdataGpsInterruptSignal
+ * \~english Struct of message about Gps interrupt signal
+ */
+typedef struct LsdrvMsgLsdataGpsInterruptSignal {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_GPS_INTERRUPT_SIGNAL;
+
+/**
+ * @struct LsdrvMsgLsdataDatGyroConnectStatus
+ * \~english Struct of Gyro connect status
+ */
+typedef struct LsdrvMsgLsdataDatGyroConnectStatus {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 reserve; //!< \~english reserve
+ u_int8 uc_data; //!< \~english data content
+ u_int8 reserve2; //!< \~english reserve
+} LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS;
+
+/**
+ * @struct LsdrvMsgLsdataGyroConnectStatus
+ * \~english Struct of message about Gyro connect status
+ */
+typedef struct LsdrvMsgLsdataGyroConnectStatus {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_GYRO_CONNECT_STATUS;
+
+/**
+ * @struct LsdrvMsgLsdataDatGpsAntennaStatus
+ * \~english Struct of Gps Antenna Status
+ */
+typedef struct LsdrvMsgLsdataDatGpsAntennaStatus {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 uc_rcv_flag; //!< \~english receive flag
+ u_int8 uc_sns_cnt; //!< \~english sensor count
+ u_int8 uc_data; //!< \~english data content
+} LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS;
+
+/**
+ * @struct LsdrvMsgLsdataGpsAntennaStatus
+ * \~english Struct of message about Gps Antenna Status
+ */
+typedef struct LsdrvMsgLsdataGpsAntennaStatus {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_GPS_ANTENNA_STATUS;
+
+/**
+ * @struct LsdrvLsdataFst
+ * \~english Struct of sensor data (first sensor message)
+ */
+typedef struct LsdrvLsdataFst {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[60]; //!< \~english data contents
+} LSDRV_LSDATA_FST;
+
+/**
+ * @struct LsdrvMsgLsdataFst
+ * \~english Struct of message about sensor data (first sensor message)
+ */
+typedef struct LsdrvMsgLsdataFst {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_FST st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_FST;
+
+/**
+ * @struct SensorMsgGpsdataDat
+ * \~english Struct of Gps data
+ * \~english @par Detail
+ * This data structure can have 7 types of data that identified by data ID.\n
+ * The contents are as follows.\n
+ * | data ID | content | data format |
+ * |:----------------------------------|:------------------------------------------|:------------------------------|
+ * | @ref POSHAL_DID_GPS_NMEA | NMEA data | @ref MdevGpsNmea "MDEV_GPS_NMEA" |
+ * | @ref POSHAL_DID_GPS_CUSTOMDATA | GPS custom data | @ref MdevGpsCustomDataMgs "MDEV_GPS_CUSTOMDATA" |
+ * | @ref POSHAL_DID_GPS_CLOCK_DRIFT | clock drift | @ref int32_t |
+ * | @ref POSHAL_DID_GPS_CLOCK_FREQ | clock frequency | @ref int32_t |
+ * | @ref POSHAL_DID_GPS_WKNROLLOVER | GPS week number | @ref SensorWknRollOverHal |
+ * | @ref POSHAL_DID_GPS_CONNECT_ERROR | GPS signal error(TRUE:Error, FALSE:Normal)| @ref BOOL |
+ * | @ref POSHAL_DID_GPS_TIME (_RAW) | GPS time information | @ref SENSOR_GPSTIME |
+ */
+typedef struct SensorMsgGpsdataDat {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 us_size; //!< \~english data size
+ u_int8 uc_rcv_flag; //!< \~english receive flag
+ u_int8 uc_sns_cnt; //!< \~english sensor count
+ u_int8 uc_gps_cnt_flag; //!< \~english GPS count
+ u_int8 reserve[3]; //!< \~english reserve
+ u_int8 uc_data[SENSOR_MSG_VSINFO_DSIZE]; //!< \~english data contents
+} SENSOR_MSG_GPSDATA_DAT;
+
+/**
+ * @struct SensorMsgGpsdata
+ * \~english Struct of message about GPS data
+ */
+typedef struct SensorMsgGpsdata {
+ T_APIMSG_MSGBUF_HEADER st_head;
+ //!< \~english message header(see vs-positioning-base-library)
+ SENSOR_MSG_GPSDATA_DAT st_para;
+ //!< \~english data of message
+} SENSOR_MSG_GPSDATA;
+
+/**
+ * @struct TG_GPS_RET_TIMESET_MSG
+ * \~english Struct of message about GPS time set response
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER header; //!< \~english message header
+ uint64_t status; //!< \~english response status
+} TG_GPS_RET_TIMESET_MSG;
+
+/**
+ * @struct TG_GPS_NMEA_SENTENCE_INFO
+ * \~english Struct of GPS NMEA sentence info
+ */
+typedef struct {
+ uint8_t uc_size; //!< \~english sentence size
+ uint8_t reserve; //!< \~english reserve
+ uint16_t us_offset; //!< \~english sentence start offset
+} TG_GPS_NMEA_SENTENCE_INFO;
+
+/**
+ * @struct TG_GPS_NMEA_INFO
+ * \~english Struct of GPS NMEA info
+ */
+typedef struct {
+ uint32_t ul_rcvsts; //!< \~english NMEA receive info
+ uint8_t reserve[4]; //!< \~english reserve
+ TG_GPS_NMEA_SENTENCE_INFO st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_MAX];
+ //!< \~english sentence infomation
+} TG_GPS_NMEA_INFO;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_hal
+/// \~english @par Brief
+/// - start thread of NMEA analysis and delivery message
+/// \~english @param [in] h_app
+/// HANDLE - handle
+///
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - This API can not change internal state
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// - start thread of NMEA analysis and delivery message
+/// - the API can only be used by 1 process
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus StartGpsMainThreadPositioning(HANDLE h_app);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_hal
+/// \~english @par Brief
+/// - start thread for receive GPS manager
+/// \~english @param [in] h_app
+/// HANDLE - handle
+///
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - This API can not change internal state.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// - start model for receive GPS manager
+/// - the API can only be used by 1 process
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus StartGpsRecvThreadPositioning(HANDLE h_app);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_hal
+/// \~english @par Brief
+/// - start thread for receive sensor
+/// \~english @param [in] h_app
+/// HANDLE - handle
+///
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - This API can not change internal state.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// - start thread for receive sensor
+/// - the API can only be used by 1 process
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus StartLineSensorThreadPositioning(HANDLE h_app);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_hal
+/// \~english @par Brief
+/// - start monitoring thread of GPS rollover
+/// \~english @param [in] h_app
+/// HANDLE - handle
+///
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - This API can not change internal state.
+/// \~english @par Conditions of processing failure
+/// - The parameter hApp is NULL [eFrameworkunifiedStatusFail]
+/// - When fail to start thread. [return value of FrameworkunifiedStartChildThread]
+/// \~english @par Detail
+/// - start monitoring thread of GPS rollover
+/// - the API can only be used by 1 process
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+/// FrameworkunifiedCreateChildThread, FrameworkunifiedStartChildThread
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus StartGpsRolloverThreadPositioning(HANDLE h_app);
+
+/** @}*/ // end of positioning_hal
+/** @}*/ // end of positioning
+
+/*---------------------------------------------------------------------------*/
+#endif // HAL_API_POSITIONING_HAL_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/Common/LineSensDrv_Api.h b/positioning_hal/inc/Common/LineSensDrv_Api.h
new file mode 100755
index 0000000..24c7f55
--- /dev/null
+++ b/positioning_hal/inc/Common/LineSensDrv_Api.h
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Api.h
+*/
+
+#ifndef INC_COMMON_LINESENSDRV_API_H_
+#define INC_COMMON_LINESENSDRV_API_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Define
+
+#define MUTEX_GPS_IRQ_FLG "MUTEX_GPS_IRQ_FLG"
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DeliveryLineSensorDataPositioning(LSDRV_MSG_LSDATA_G*, u_int8);
+BOOL LineSensDrvApiInitialize(void);
+void LineSensDrvApiInitEstGpsCnt(void);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_COMMON_LINESENSDRV_API_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/Common/MDev_Gps_API.h b/positioning_hal/inc/Common/MDev_Gps_API.h
new file mode 100755
index 0000000..d165a1e
--- /dev/null
+++ b/positioning_hal/inc/Common/MDev_Gps_API.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_API.h
+*/
+
+#ifndef INC_COMMON_MDEV_GPS_API_H_
+#define INC_COMMON_MDEV_GPS_API_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+RET_API SendNmeaGps(const MDEV_GPS_NMEA* p_nmea_data);
+RET_API SendCustomGps(const SENSOR_MSG_GPSTIME* p_gps_time,
+ const SENSORLOCATION_LONLATINFO_DAT* p_lonlat,
+ const SENSORLOCATION_ALTITUDEINFO_DAT* p_altitude,
+ const SENSORMOTION_HEADINGINFO_DAT* p_heading,
+ const NAVIINFO_DIAG_GPS* p_diag_data);
+RET_API SendSpeedGps(const SENSORMOTION_SPEEDINFO_DAT* p_seed, u_int16 us_peed);
+RET_API SendTimeGps(const MDEV_GPS_RTC* p_rtc);
+RET_API SendClockDriftGps(int32_t drift);
+RET_API SendClockFrequencyGps(uint32_t freq);
+RET_API DevGpsSndWknRollover(const SensorWknRollOverHal* p_week_rollover);
+int32 DevGpsRstAnsSend(PNO u_pno, RID uc_rid, u_int32 ul_rst_sts);
+int32 DevGpsTimesetAnsSend(PNO u_pno, RID uc_rid, u_int32 ul_rst_sts);
+RET_API DevSendGpsConnectError(BOOL);
+RET_API SndGpsTimeRaw(const SENSOR_GPSTIME_RAW* pst_gpstime_raw);
+/*---------------------------------------------------------------------------*/
+#endif // INC_COMMON_MDEV_GPS_API_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/Common/positioning_common.h b/positioning_hal/inc/Common/positioning_common.h
new file mode 100755
index 0000000..dad0272
--- /dev/null
+++ b/positioning_hal/inc/Common/positioning_common.h
@@ -0,0 +1,63 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file positioning_common.h
+*/
+
+#ifndef INC_COMMON_POSITIONING_COMMON_H_
+#define INC_COMMON_POSITIONING_COMMON_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Definition
+
+/*---------------------------------------------------------------------------*/
+// ENUMERATION
+
+/*---------------------------------------------------------------------------*/
+// STRUCTURE
+
+typedef struct PosResetinfo {
+ uint8_t mode; // Reset mode
+ uint8_t reserve[3]; // reserve
+ PNO sndpno; // Caller PNO
+ PNO respno; // Destination PNO
+} POS_RESETINFO;
+
+/*!
+ @brief Thread activation information
+*/
+typedef struct StThreadSetupInfo {
+ EnumSetupMode_POS mode; // Thread activation mode
+} ST_THREAD_SETUP_INFO;
+
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+EFrameworkunifiedStatus PosInitialize(HANDLE h_app);
+EnumSetupMode_POS PosSetupThread(HANDLE h_app, EnumTID_POS e_tid);
+void PosTeardownThread(EnumTID_POS e_tid);
+EFrameworkunifiedStatus PosCreateThread(HANDLE h_app, int8_t index);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_COMMON_POSITIONING_COMMON_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/Common/positioning_def.h b/positioning_hal/inc/Common/positioning_def.h
new file mode 100755
index 0000000..df95cb3
--- /dev/null
+++ b/positioning_hal/inc/Common/positioning_def.h
@@ -0,0 +1,307 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file positioning_def.h
+*/
+
+#ifndef INC_COMMON_POSITIONING_DEF_H_
+#define INC_COMMON_POSITIONING_DEF_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include <string.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <vehicle_service/std_types.h>
+#include <vehicle_service/pos_message_header.h>
+#include <vehicle_service/sys_timerapi.h>
+#include <vehicle_service/WPF_STD.h>
+
+#include "gps_hal.h"
+#include "positioning_hal.h"
+
+#include "positioning_log.h"
+
+/*---------------------------------------------------------------------------*/
+// Definition
+
+#define POS_THREAD_NAME "Positioning"
+
+/**
+ * @enum ENUM_GPS_NMEA_INDEX
+ * \~english NMEA index
+ */
+typedef enum {
+ GPS_NMEA_INDEX_GGA = 0, //!< \~english GGA
+ GPS_NMEA_INDEX_DGGA, //!< \~english DGGA
+ GPS_NMEA_INDEX_VTG, //!< \~english VTG
+ GPS_NMEA_INDEX_RMC, //!< \~english RMC
+ GPS_NMEA_INDEX_DRMC, //!< \~english DRMC
+ GPS_NMEA_INDEX_GLL, //!< \~english GLL
+ GPS_NMEA_INDEX_DGLL, //!< \~english DGLL
+ GPS_NMEA_INDEX_GSA, //!< \~english GSA
+ GPS_NMEA_INDEX_GSV1, //!< \~english GSV1
+ GPS_NMEA_INDEX_GSV2, //!< \~english GSV2
+ GPS_NMEA_INDEX_GSV3, //!< \~english GSV3
+ GPS_NMEA_INDEX_GSV4, //!< \~english GSV4
+ GPS_NMEA_INDEX_GSV5, //!< \~english GSV5
+ GPS_NMEA_INDEX_GST, //!< \~english GST
+ GPS_NMEA_INDEX__CWORD44__GP_3, //!< \~english _CWORD44_,GP,3
+ GPS_NMEA_INDEX__CWORD44__GP_4, //!< \~english _CWORD44_,GP,4
+ GPS_NMEA_INDEX_P_CWORD82_F_GP_0, //!< \~english _CWORD44_,GP,0
+ GPS_NMEA_INDEX_P_CWORD82_J_GP_1, //!< \~english _CWORD44_,GP,1
+ GPS_NMEA_INDEX_MAX //!< \~english GGA
+} ENUM_GPS_NMEA_INDEX;
+
+//!< \~english Gps cycle Data Event
+#define GPS_EVT_CYCLEDATA_PROV ("GPS_EVT_CYCLEDATA_PROV")
+//!< \~english Event value: Waiting.
+#define GPS_EVT_PROV_WAIT (0x00000000)
+//!< \~english Event value: Clear Waiting status.
+#define GPS_EVT_PROV_RELEASE (0x00000001)
+
+//!< \~english Gps received
+#define GPS_CYCLECMD_NOTRCV (0x00)
+//!< \~english Gps no received
+#define GPS_CYCLECMD_RCV (0x01)
+
+//!< \~english store position of Hour data
+#define GPSCMD_DRMC_HOUR_POS (7)
+//!< \~english store position of minute data
+#define GPSCMD_DRMC_MIN_POS (9)
+//!< \~english store position of second data
+#define GPSCMD_DRMC_SEC_POS (11)
+//!< \~english store position of status
+#define GPSCMD_DRMC_STATUS_POS (14)
+//!< \~english store position of day data
+#define GPSCMD_DRMC_DAY_POS (54)
+//!< \~english store position of month data
+#define GPSCMD_DRMC_MONTH_POS (56)
+//!< \~english store position of year data
+#define GPSCMD_DRMC_YEAR_POS (58)
+
+//!< \~english store position of control code
+#define GPSCMD_RTC_CTRLCODE_POS (0)
+//!< \~english store position of year data (BCD)
+#define GPSCMD_RTC_BCD_YEAR_POS (1)
+//!< \~english store position of month data(BCD)
+#define GPSCMD_RTC_BCD_MONTH_POS (2)
+//!< \~english store position of day data(BCD)
+#define GPSCMD_RTC_BCD_DAY_POS (3)
+//!< \~english store position of hour data(BCD)
+#define GPSCMD_RTC_BCD_HOUR_POS (4)
+//!< \~english store position of minute data(BCD)
+#define GPSCMD_RTC_BCD_MIN_POS (5)
+//!< \~english store position of second data(BCD)
+#define GPSCMD_RTC_BCD_SEC_POS (6)
+//!< \~english store position of status
+#define GPSCMD_RTC_STATUS_POS (7)
+
+#define GPSCMD_RTC_CTRLCODE (0xA4) //!< \~english control code (RTC)
+#define GPSCMD_RTC_STATUS_UTCTIME (0x00) //!< \~english Normal
+#define GPSCMD_RTC_STATUS_ERRTIME (0x03) //!< \~english AbNormal
+
+// Internal thread activation status determination
+#define THREAD_STS_MSK_POS_MAIN (0x01)
+#define THREAD_STS_MSK_POS_SENS (0x02)
+#define THREAD_STS_MSK_POS_GPS (0x04)
+#define THREAD_STS_MSK_POS_GPS_RECV (0x08)
+#define THREAD_STS_MSK_POS_GPS_ROLLOVER (0x10)
+#define POS_DID_GPS_NMEA 0x8000009AU /* QAC 1281 */
+#define POS_DID_GPS_CLOCK_DRIFT 0x800000B3U /* QAC 1281 */
+#define POS_DID_GPS_CLOCK_FREQ 0x800000B4U /* QAC 1281 */
+#define VEHICLE_DID_GPS_CUSTOMDATA 0x80000094U
+#define VEHICLE_DID_GPS_CLOCK_DRIFT POS_DID_GPS_CLOCK_DRIFT
+#define VEHICLE_DID_GPS_CLOCK_FREQ POS_DID_GPS_CLOCK_FREQ
+#define CID_NAVIINFO_DELIVER (0x0205) /* Navigation information setting CID */
+#define CID_NAVIINFO_SPEED_DELIVER (0x0206) /* Vehicle speed setting CID */
+#define VEHICLE_DID_GPS_WKNROLLOVER 0x800000B2U
+#define VEHICLE_DID_GPS_TIME_RAW 0x800000B1
+#define POS_DID_GYRO_TEMP 0x80000090
+#define VEHICLE_DID_SPEED_PULSE 0x80000012
+#define VEHICLE_DID_GYRO_X 0x80000014
+#define VEHICLE_DID_GYRO_Y 0x80000020
+#define VEHICLE_DID_GYRO_Z 0x80000021
+#define VEHICLE_DID_GYRO VEHICLE_DID_GYRO_X
+#define VEHICLE_DID_REV 0x80000017
+#define VEHICLE_DID_SNS_COUNTER 0x8000001A
+#define VEHICLE_DID_GPS_COUNTER 0x8000001B
+#define VEHICLE_DID_GYRO_EXT 0x80000027 /* 3 ~ 14bit A/D value,0bit:REV */
+#define VEHICLE_DID_SPEED_PULSE_FST 0x80000028 /* Pulse(Number) */
+#define VEHICLE_DID_GYRO_FST_X 0x80000029
+#define VEHICLE_DID_GYRO_FST_Y 0x80000022
+#define VEHICLE_DID_GYRO_FST_Z 0x80000023
+#define VEHICLE_DID_GYRO_FST VEHICLE_DID_GYRO_FST
+#define VEHICLE_DID_GYRO_TEMP POS_DID_GYRO_TEMP
+#define VEHICLE_DID_SPEED_KMPH 0x80000013
+#define VEHICLE_DID_GSNS_X 0x80000015
+#define VEHICLE_DID_GSNS_Y 0x80000016
+#define VEHICLE_DID_GSNS_Z 0x80000024
+#define VEHICLE_DID_PULSE_TIME 0x8000003A
+#define CID__CWORD83__CMD_RCV 0x0103
+#define CID__CWORD83__CMD_SND_STS 0x0104
+#define CID_GPS_SERIAL0 (CID)0x0100
+#define CID_GPS_REQRESET (CID)(CID_GPS_BASE | CID_GPS_SERIAL0)
+
+#define VEHICLE_CONFIG_GPS_UNITSET_NOGPS (0x00U) //!< \~english no Gps
+#define VEHICLE_CONFIG_GPS_UNITSET__CWORD82_ (0x01U) //!< \~english _CWORD82_ Gps
+#define VEHICLE_CONFIG_GPS_UNITSET_EXTBOX (0x02U) //!< \~english extern u-blox
+
+//!< \~english no Navi
+#define VEHICLE_CONFIG_NAVI_FUNCTION_NONAVI (0x00U)
+//!< \~english Navi has AW navi
+#define VEHICLE_CONFIG_NAVI_FUNCTION_AWNAVI (0x01U)
+
+#define VEHICLE_GPS_SYSTIME_YEAR_MAX (2085U) //!< \~english Gps Time allowed max year
+#define VEHICLE_GPS_SYSTIME_MONTH_MAX (12U) //!< \~english Gps Time allowed max month
+#define VEHICLE_GPS_SYSTIME_DAY_MAX (31U) //!< \~english Gps Time allowed max day
+#define VEHICLE_GPS_SYSTIME_HOUR_MAX (23U) //!< \~english Gps Time allowed max hour
+#define VEHICLE_GPS_SYSTIME_MINUTE_MAX (59U) //!< \~english Gps Time allowed max minute
+#define VEHICLE_GPS_SYSTIME_SECOND_MAX (59U) //!< \~english Gps Time allowed max second
+
+#define VEHICLE_GPS_SYSTIME_YEAR_MIN (1986U) //!< \~english Gps Time allowed min year
+#define VEHICLE_GPS_SYSTIME_MONTH_MIN (1U) //!< \~english Gps Time allowed min month
+#define VEHICLE_GPS_SYSTIME_DAY_MIN (1U) //!< \~english Gps Time allowed min day
+#define VEHICLE_GPS_SYSTIME_HOUR_MIN (0U) //!< \~english Gps Time allowed min hour
+#define VEHICLE_GPS_SYSTIME_MINUTE_MIN (0U) //!< \~english Gps Time allowed min minute
+#define VEHICLE_GPS_SYSTIME_SECOND_MIN (0U) //!< \~english Gps Time allowed min second
+#define VEHICLE_EVENT_VAL_INIT (-14) /* Event initial value */
+//!< \~english check OK (value not change)
+#define MDEV_GPS_SRAM_CHK_OK (0)
+//!< \~english check OK(vaule change)
+#define MDEV_GPS_SRAM_CHK_CHG (1)
+//!< \~english check NG
+#define MDEV_GPS_SRAM_CHK_NG (-1)
+
+/*---------------------------------------------------------------------------*/
+// ENUMERATION
+
+/*!
+ @brief Positioning operating status definitions
+*/
+typedef enum EnumExeStsPos {
+ EPOS_EXE_STS_STOP = 0, /* Stopped */
+ EPOS_EXE_STS_RUNNING, /* Running (from FrameworkunifiedOnStart to FrameworkunifiedOnStop) */
+ EPOS_EXE_STS_RUNNING_COLDSTART /* Running after cold start */
+} EnumExeSts_POS;
+
+/*!
+ @brief Positioning Thread Startup Modes
+*/
+typedef enum EnumSetupModePos {
+ EPOS_SETUP_MODE_NORMAL = 0, /* Normal start */
+ EPOS_SETUP_MODE_DATA_RESET /* Data reset start */ /* QAC 930 */
+} EnumSetupMode_POS;
+
+/**
+ * @struct TG_GPS_RCV_DATA
+ * \~english Struct of Gps receive data for VehicleSens
+ */
+typedef struct TgGpsRcvData {
+ uint32_t dwret_status; //!< \~english return status
+ uint16_t bydata_len; //!< \~english data length
+ uint8_t bygps_data[GPS_READ_LEN]; //!< \~english receive data
+ uint8_t u_reserve2[2]; //!< \~english reserve
+} TG_GPS_RCV_DATA;
+
+/**
+ * @struct TG_GPS_NMEA_DAT
+ * \~english Struct of NMEA data
+ */
+typedef struct TgGpsNmeaDat {
+ u_int8 uc_data[GPS_NMEA_MAX_SZ]; //!< \~english NMEA data
+} TG_GPS_NMEA_DAT;
+
+/**
+ * @struct TG_GPS_CYCLEDATA_NMEA
+ * \~english Struct of NMEA cycle data
+ */
+typedef struct TgGpsCycledataNmea {
+ //!< \~english receive flag
+ u_int8 uc_rcvflag[GPS_NMEA_INDEX_MAX];
+ //!< \~english reserve
+ u_int8 u_reserve[3];
+ //!< \~english structure of NMEA data
+ TG_GPS_NMEA_DAT st_nmea[GPS_NMEA_INDEX_MAX];
+} TG_GPS_CYCLEDATA_NMEA;
+
+/**
+ * @struct TG_GPS_CYCLEDATA_BINARY
+ * \~english Struct of binary cycle data
+ */
+typedef struct TgGpsCycledataBinary {
+ u_int8 uc_rcvflag; //!< \~english receive flag
+ u_int8 u_reserve[3]; //!< \~english reserve
+ u_int8 uc_data[GPS_CMD_BINARY_SZ]; //!< \~english binary data
+ u_int8 u_reserve2[3]; //!< \~english reserve flag
+} TG_GPS_CYCLEDATA_BINARY;
+
+/**
+ * @struct TG_GPS_CYCLEDATA_FULLBIN
+ * \~english Struct of full bin cycle data
+ */
+typedef struct TgGpsCycledataFullbin {
+ u_int8 uc_rcvflag; //!< \~english receive flag
+ u_int8 u_reserve[3]; //!< \~english reserve
+ u_int8 uc_data[GPS_CMD_FULLBIN_SZ]; //!< \~english fullbin data
+ u_int8 u_reserve2; //!< \~english reserve
+} TG_GPS_CYCLEDATA_FULLBIN;
+
+/**
+ * @struct TG_GPS_CYCLEDATA_RTC
+ * \~english Struct of RTC cycle data
+ */
+typedef struct TgGpsCycledataRtc {
+ u_int8 uc_rcvflag; //!< \~english receive flag
+ u_int8 u_reserve[3]; //!< \~english reserve
+ u_int8 uc_data[GPS_DATASIZE_RTC]; //!< \~english Rtc data
+} TG_GPS_CYCLEDATA_RTC;
+
+/**
+ * @struct TG_GPS_CYCLEDATA
+ * \~english Struct of Gps cycle data
+ */
+typedef struct TgGpsCycledata {
+ u_int8 uc_sesncnt; //!< \~english count value
+ u_int8 u_reserve[3]; //!< \~english reserve
+ TG_GPS_CYCLEDATA_NMEA st_nmea_data; //!< \~english NMEA Data
+ TG_GPS_CYCLEDATA_BINARY st_binary_data; //!< \~english binary Data
+ TG_GPS_CYCLEDATA_FULLBIN st_fullbin_data; //!< \~english Full Bin Data
+ TG_GPS_CYCLEDATA_RTC st_rtc_data; //!< \~english RTC Data
+} TG_GPS_CYCLEDATA;
+
+typedef struct {
+ u_int16 year; /* YEAR */
+ u_int8 month; /* MONTH */
+ u_int8 date; /* DAY */
+ u_int8 hour; /* HOUR */
+ u_int8 minute;/* MINUTE */
+ u_int8 second;/* SECOND */
+ u_int8 flag; /* Whether or not the time is set */
+} ST_GPS_SET_TIME;
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_COMMON_POSITIONING_DEF_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/Common/positioning_log.h b/positioning_hal/inc/Common/positioning_log.h
new file mode 100755
index 0000000..6ca4c96
--- /dev/null
+++ b/positioning_hal/inc/Common/positioning_log.h
@@ -0,0 +1,43 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file positioning_log.h
+*/
+
+#ifndef INC_COMMON_POSITIONING_LOG_H_
+#define INC_COMMON_POSITIONING_LOG_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include <stdio.h>
+
+/*---------------------------------------------------------------------------*/
+// Definition
+
+// #define POSITIONING_DEBUG
+
+#ifdef POSITIONING_DEBUG
+#define POSITIONING_LOG(...) printf(__VA_ARGS__)
+#else
+#define POSITIONING_LOG(...)
+#endif
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_COMMON_POSITIONING_LOG_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h b/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h
new file mode 100755
index 0000000..6ea4787
--- /dev/null
+++ b/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h
@@ -0,0 +1,170 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_GpsRecv.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPSRECV_H_
+#define INC_GPSCOMMON_MDEV_GPSRECV_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Define
+
+/* ++ GPS _CWORD82_ support */
+#define GPS__CWORD82__CMD_LEN_MAX 200
+/* -- GPS _CWORD82_ support */
+
+/* ++ GPS _CWORD82_ support */
+#define GPS__CWORD82__RET_START_SEQ_NONE 0 /* _CWORD82_ Start Sequence Determination Result = None */
+#define GPS__CWORD82__RET_START_SEQ_NMEA 1 /* _CWORD82_ Start Sequence Determination Result = NMEA */
+#define GPS__CWORD82__RET_START_SEQ_FULL 2 /* _CWORD82_ Start Sequence Determination Result = Full customization */
+#define GPS__CWORD82__RET_START_SEQ_BIN 3 /* _CWORD82_ Start Sequence Determination Result = Standard binary #GPF_60_024 */
+
+#define GPS_UBLOX_RET_START_SEQ_UBX 4 /* Ublox Start Sequence Decision Result = UBX Protocol (binary) */
+#define GPS__CWORD82__FULLBINARY_LEN GPS_CMD_FULLBIN_SZ /* _CWORD82_ Full Customization Instruction Length */
+
+#define GPS__CWORD82__NORMALBINARY_LEN 81 /* _CWORD82_ standard binary instruction length #GPF_60_024 */
+/* -- GPS _CWORD82_ support */
+
+/* Maximum size of serial data read */
+#define GPS_RCV_MAXREADSIZE (2048) /* Changed from 256 -> 2048 #01 */
+
+/* Receive data storage buffer size */
+#define GPS_RCV_RCVBUFSIZE 512 /* Maximum size of the command to be received must be larger than the maximum size */
+
+/* Max-size receive commands ID4:(188+8)byte */
+/* Analysis data buffer size */
+#define GPS_RCV_ANADATABUFSIZE (GPS_RCV_MAXREADSIZE + GPS_RCV_RCVBUFSIZE)
+
+/* Receive frame buffer size */
+#define GPS_RCV_RCVFRAMEBUFSIZE GPS_RCV_RCVBUFSIZE /* Maximum size of the command to be received must be larger than the maximum size */
+
+/* Reception notification data buffer size */
+#define GPS_RCV_SNDCMD_SIZE_MAX
+
+/* Common return values */
+#define GPS_RCV_RET_ERR_EXT (-4) /* External cause error */
+#define GPS_RCV_RET_ERR_SYSTEM (-3) /* System error */
+#define GPS_RCV_RET_ERR (-1) /* Abnormality */
+#define GPS_RCV_RET_NML 0 /* Normal */
+
+// Reception thread reception frame detection result
+#define GPS_RCV_FRMSRCH_ERR_FORMAT (-1) /* Frame format error */
+#define GPS_RCV_FRMSRCH_FIXED 0 /* Frame determination */
+#define GPS_RCV_FRMSRCH_NOT_FIXED 1 /* Frame undetermined */
+#define GPS_RCV_FRMSRCH_NO_DATA 2 /* No analysis data */
+
+// Result of receive thread receive frame analysis
+#define GPS_RCV_FRMANA_ERR_PRM (-3) /* Parameter error */
+#define GPS_RCV_FRMANA_ERR_FORMAT (-2) /* Frame format error */
+#define GPS_RCV_FRMANA_ERR_CS (-1) /* Sumcheck error */
+#define GPS_RCV_FRMANA_OK 0 /* Normal data */
+
+/* Serial reception event determination result */
+enum GpsRcvRet {
+ GPS_RCV_REVT_NML = 0, /* Receiving(Normal) */
+ GPS_RCV_REVT_ERR, /* Receiving(Error) */
+ GPS_RCV_REVT_NUM /* Number of events received */
+};
+
+// Error logging
+#define ERLG_SER_FRAMEERR "Serial Framing Error"
+#define ERLG_SER_OVERRUNERR "Serial Overrun Error"
+#define ERLG_SER_PARITYERR "Serial Parity Error"
+#define ERLG_RCVEV_JDGERR "DEV_Gps_Recv_JdgSerEvt error"
+#define ERLG_RCVDATA_SNDERR "DEV_Gps_Recv_SndRcvData error"
+#define ERLG_COMEVNT_WAITERR "WaitCommEvent error"
+
+/*---------------------------------------------------------------------------*/
+// Struct
+
+// Serial receive buffer structure
+typedef struct GPSRecvData {
+ u_int16 us_read_size; /* Serial data read data size */
+ u_int8 uc_reserve[2]; /* Preliminary */
+ u_int8 uc_read_data[GPS_RCV_MAXREADSIZE]; /* Serial read data */
+} TG_GPS_RECV_RcvData;
+
+// Receive data storage buffer structure
+typedef struct GPSRecvBuf {
+ u_int16 r_size; /* Received size */
+ u_int8 rsv[2]; /* Reserved */
+ u_int8 r_buf[GPS_RCV_RCVBUFSIZE]; /* Receive command data */
+} TG_GPS_RECV_RcvBuf;
+
+// Data analysis buffer
+typedef struct GPSRecvAnaDataBuf {
+ u_int16 datsize; /* Size of the data */
+ u_int16 offset; /* Analysis start offset */
+ u_int8 datbuf[GPS_RCV_ANADATABUFSIZE]; /* Analysis data */
+} TG_GPS_RECV_AnaDataBuf;
+
+// Receive frame buffer
+typedef struct GPSRecvFrameBuf {
+ u_int16 size; /* Frame-size */
+ u_int8 rsv[2]; /* Reserved */
+ u_int8 buf[GPS_RCV_RCVFRAMEBUFSIZE]; /* Command data */
+} TG_GPS_RECV_RcvFrameBuf;
+
+/*---------------------------------------------------------------------------*/
+// External variable
+
+extern TG_GPS_RECV_RcvData g_gps_rcvdata; /* Serial receive buffer */
+extern TG_GPS_RECV_RcvBuf g_gps_rcvbuf; /* Receive data storage buffer */
+extern TG_GPS_RECV_AnaDataBuf g_gps_ana_databuf; /* Analysis data buffer */
+extern TG_GPS_RECV_RcvFrameBuf g_gps_rcv_framebuf; /* Receive frame buffer */
+extern u_int16 g_wrecv_err; /* Number of reception errors */
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+/* Initializing process */
+void DevGpsRecvInit(void);
+
+/* Buffer clear processing */
+void DevGpsRecvClrRcvBuf(void);
+
+/* Receive (normal) receive processing */
+void DevGpsRecvRcvNormal(void);
+
+/* Data reception processing */
+int32 DevGpsRecvReadRcvData(TG_GPS_RECV_RcvData* pst_rcv_data);
+
+/* Frame detection processing */
+int32 DevGpsRecvSearchFrameData(const TG_GPS_RECV_AnaDataBuf *adbuf_p, u_int16 *ana_size);
+
+/* Receive data transmission processing */
+void DevGpsRecvSndRcvData(const TG_GPS_RECV_RcvFrameBuf *p_frame_buf);
+
+/* Acknowledgement */
+RET_API DevRcvData(const TG_GPS_RCV_DATA* ptg_rcv_data);
+
+/* Pos_Gps_Recv Thread Stop Processing */
+void DevGpsRecvThreadStopProcess(void);
+
+EFrameworkunifiedStatus DevGpsRecvThread(HANDLE h_app);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPSRECV_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h b/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h
new file mode 100755
index 0000000..22da3c9
--- /dev/null
+++ b/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_GpsRollOver.h
+*/
+#ifndef INC_GPSCOMMON_MDEV_GPSROLLOVER_H_
+#define INC_GPSCOMMON_MDEV_GPSROLLOVER_H_
+
+#include <vehicle_service/WPF_STD.h>
+
+typedef struct TimRolovrYMD {
+ u_int16 year;
+ u_int16 month;
+ u_int16 day;
+ u_int8 dummy[2];
+} TG_TIM_ROLOVR_YMD;
+
+
+void GPSRollOverConvTime(TG_TIM_ROLOVR_YMD* base_ymd, TG_TIM_ROLOVR_YMD* conv_ymd, u_int8 gpsweekcorcnt);
+
+#endif // INC_GPSCOMMON_MDEV_GPSROLLOVER_H_
diff --git a/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h b/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h
new file mode 100755
index 0000000..7812858
--- /dev/null
+++ b/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h
@@ -0,0 +1,187 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Common.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_COMMON_H_
+#define INC_GPSCOMMON_MDEV_GPS_COMMON_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+#include "MDev_Gps_Main.h"
+
+/*---------------------------------------------------------------------------*/
+// Define
+
+#define NMEA_CHECKSUM_CHAR '*' /* *## (HEX) */
+#define NMEA_DATA_SEPARATOR ','
+
+#define GPS_NMEA_FIELD_LEN_MAX (GPS_NMEA_MAX_SZ)
+
+// NMEA GGA Sentence
+/* Fix Status */
+#define GPS_NMEA_GGA_FIX_STATUS_NON 0 /* invalid */
+#define GPS_NMEA_GGA_FIX_STATUS_GPS 1 /* GPS SPS Mode, Fix valid */
+#define GPS_NMEA_GGA_FIX_STATUS_DGPS 2 /* DGPS SPS Mode, Fix valid */
+#define GPS_NMEA_GGA_FIX_STATUS_DR 6 /* Estimated/Dead Reckoning */
+/* Field No */
+#define GPS_NMEA_FNO_GGA_FS 6
+#define GPS_NMEA_FNO_GGA_MSL 9
+
+/* number of SV Fields */
+#define GPS_NMEA_NUM_GSA_SV 12
+/* Fix Status */
+#define GPS_NMEA_GSA_FIX_STS_NON 1
+#define GPS_NMEA_GSA_FIX_STS_2D 2
+#define GPS_NMEA_GSA_FIX_STS_3D 3
+/* Field No */
+#define GPS_NMEA_FNO_GSA_FS 2
+#define GPS_NMEA_FNO_GSA_SV 3
+
+/* number of Satellite Infomation Fields (sv+elv+az+cno) */
+#define GPS_NMEA_NUM_GSV_SINFO 4
+ /* Field No */
+#define GPS_NMEA_FNO_GSV_NOSV 3
+#define GPS_NMEA_FNO_GSV_SV 4
+#define GPS_NMEA_FNO_GSV_ELV 5
+#define GPS_NMEA_FNO_GSV_AZ 6
+#define GPS_NMEA_FNO_GSV_CNO 7
+
+#define GPS_NMEA_RMC_STS_INVALID 'V'
+#define GPS_NMEA_RMC_STS_VALID 'A'
+#define GPS_NMEA_RMC_IND_NORTH 'N'
+#define GPS_NMEA_RMC_IND_EAST 'E'
+
+/* Field No */
+#define GPS_NMEA_FNO_RMC_UTC 1
+#define GPS_NMEA_FNO_RMC_STATUS 2
+#define GPS_NMEA_FNO_RMC_LATITUDE 3
+#define GPS_NMEA_FNO_RMC_NS 4
+#define GPS_NMEA_FNO_RMC_LONGITUDE 5
+#define GPS_NMEA_FNO_RMC_EW 6
+#define GPS_NMEA_FNO_RMC_SPEED 7
+#define GPS_NMEA_FNO_RMC_COG 8
+#define GPS_NMEA_FNO_RMC_DATE 9
+
+// Diag Fix Count
+#define GPS_DIAG_FIX_COUNT_3D (0x01)
+#define GPS_DIAG_FIX_COUNT_2D (0x02)
+#define GPS_DIAG_FIX_COUNT_ELSE (0x04)
+
+/* GPS time setting related */
+#define GPS_SETTIME_RANGE 5 /* 5 seconds : Valid range of GPS time setting */
+#define GPS_TIME_RANGE 10 /* 10 seconds : GPS time change range */
+
+/* NAV-SVINFO logging status */
+#define GPS_NAVSVINFO_STS_INIT 0
+#define GPS_NAVSVINFO_STS_READY 1
+#define GPS_NAVSVINFO_STS_DONE 2
+#define GPS_NAVSVINFO_STS_SETTING 3
+
+/* Time setting information */
+#define GPS_TIME_RX 0 /* Time not set */
+#define GPS_TIME_ROLOVR 1 /* First GPS reception(for rollover) */
+#define GPS_TIME_SET 2 /* Time setting in progress */
+
+/*!
+ @brief Satellite position information
+*/
+typedef struct GpsSatelliteInfoStr {
+ uint8_t sv; /* Satellite number */
+ uint8_t elv; /* Height 0-99 */
+ uint16_t az; /* Orientation 0-359 */
+ uint8_t cno; /* Signal strength */
+ uint8_t sts; /* Reception status */
+} GpsSatelliteInfo;
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+extern BOOL g_gps_rcv_thread_stop;
+extern uint8_t g_is_gpstime_sts;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void ChangeStatusGpsCommon(u_int32 sts);
+void RtyResetGpsCommon(void);
+void SendRtyResetGpsCommon(void);
+void SendReqGpsCommon(void);
+void GPSResetReqGpsCommon(void);
+void CyclDataTimeOutGpsCommon(void);
+RET_API CheckFrontStringPartGpsCommon(const u_char *p_tartget, const u_char *p_start);
+int32 JudgeFormatGpsCommon(u_char *p_send_data, u_int32 ul_length, TG_GPS_OUTPUT_FORMAT *p_format);
+RET_API CheckSumGpsCommon(const u_int8 p_uc_data[], u_int32 ul_length, TG_GPS_OUTPUT_FORMAT e_cmd_info);
+u_int8 AtoHGpsCommon(u_int8 ascii);
+RET_API DevGpsSaveCmd(TG_GPS_SAVECMD *p_send_data);
+void SendSaveCmdGpsCommon(void);
+void DeleteSaveCmdGpsCommon(void);
+void DeleteAllSaveCmdGpsCommon(void);
+void RcvCyclCmdNmeaGpsCommon(u_int8 *p_uc_data, u_int32 ul_len, TG_GPS_OUTPUT_FORMAT s_output_format);
+int32 CheckSendCmdGpsCommon(const u_char *p_rcv_data, u_int32 ul_length, TG_GPS_OUTPUT_FORMAT *p_format);
+int32_t GetStringFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, char* p_dst, size_t size);
+double GetNumericFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+int32 GetIntegerFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src);
+int32 GetLonLatFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+u_int16 GetHeadingFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+int32 GetAltitudeFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+u_int16 GetSpeedFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+void StopThreadGpsCommon(void);
+uint8_t JudgeFormatOrderGpsCommon(TG_GPS_OUTPUT_FORMAT s_format_1, TG_GPS_OUTPUT_FORMAT s_format_2);
+ENUM_GPS_NMEA_INDEX GetNmeaIdxGpsCommon(TG_GPS_OUTPUT_FORMAT s_output_format);
+void SendResetReqGpsCommon(void);
+
+
+void WriteGpsTimeToBackup(uint8_t flag, POS_DATETIME* pst_datetime);
+void DevGpsCommSettingTime(void);
+RET_API GpsSetPosBaseEvent(uint16_t snd_pno, int32_t event_val);
+uint8_t HardResetChkGpsCommon(void);
+void RcvCyclCmdExtGpsCommon(u_int8 *p_data, u_int32 len, TG_GPS_OUTPUT_FORMAT format);
+
+BOOL DevGpsRcvProcGpsResetResp(TG_GPS_RCV_DATA*);
+void DevGpsRcvProcTimeSetResp(TG_GPS_RCV_DATA*);
+void DevGpsRcvProcWknRolloverGetResp(TG_GPS_RCV_DATA* p_data);
+void DevGpsRcvProcNavSvinfoAddResp(TG_GPS_RCV_DATA* p_data);
+void DevGpsReadGpsTime(POS_DATETIME* p_st_datetime);
+RET_API DevGpsRcvProcCmnResp(TG_GPS_RCV_DATA* p_data, uint8_t cmd);
+RET_API DevGpsResetReq(PNO us_pno, RID uc_rid);
+void DevGpsSettingTime(POS_DATETIME* p_st_datetime);
+int DevGpsYMD2JD(int y, int m, int d);
+BOOL DevGpsYMD2GPSTIME(const int32 y, const int32 m, const int32 d,
+ const int32 hh, const int32 mm, const int32 ss,
+ u_int16* gpsw, u_int32* gpsws);
+void DevGpsSetChkSum(u_int8* uc_buffer, u_int32 ul_length);
+RET_API DevGpsCatPollReq(uint8_t *p_ublox_data, uint16_t kind);
+void DevGpsSetGpsweekcorcnt(void);
+RET_API DevGpsNavTimeUTCAddReq(void);
+RET_API DevGpsWknRolloverGetReq(void);
+BOOL DevGpsCheckGpsTime(uint16_t set_gpsw, uint32_t set_gpsws,
+ uint16_t rcv_gpsw, uint32_t rcv_gpsws, int32_t offset_range);
+
+void DevGpsCnvLonLatNavi(SENSORLOCATION_LONLATINFO_DAT* p_lonlat,
+ u_int8 fix_sts, int32 lon, int32 lat);
+void DevGpsCnvAltitudeNavi(SENSORLOCATION_ALTITUDEINFO_DAT* p_altitude,
+ u_int8 fix_sts, int32 alt);
+void DevGpsCnvHeadingNavi(SENSORMOTION_HEADINGINFO_DAT* p_heading,
+ u_int8 fix_sts, u_int16 heading);
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_COMMON_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h b/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h
new file mode 100755
index 0000000..d40cb0c
--- /dev/null
+++ b/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h
@@ -0,0 +1,311 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Main.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_MAIN_H_
+#define INC_GPSCOMMON_MDEV_GPS_MAIN_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+// #include "gps_hal.h"
+// #include "MDev_Gps_Nmea.h"
+// #include "LineSensDrv_Api.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define OFF 0 /* OFF */
+#define ON 1 /* ON */
+#define OK 0 /* Normal */
+#define NG (-1L) /* Abnormality */
+#define DAT_END 0xff /* Exit code */
+
+// State
+typedef enum GpsMatrixSts {
+ GPS_STS_STARTUP = 0, /* Startup confirmation */
+ GPS_STS_NORMAL, /* In operation */
+ GPS_STS_SENT, /* Command sent status */
+ GPS_STS_NUM
+}TG_GPS_MATRIX_STS;
+
+// Event
+typedef enum GpsMatrixEvt {
+ GPS_EVT_SENDREQ = 0, /* Transmission request */
+ GPS_EVT_RESETREQ, /* GPS reset request */
+ GPS_EVT_RECVCYCLDAT, /* Cyclic reception command reception */
+ GPS_EVT_RECVRSPDAT, /* Receive response command */
+ GPS_EVT_TIMEOUT_RSPDAT, /* Response monitoring timeout */
+ GPS_EVT_TIMEOUT_CYCLDAT, /* Periodic reception data monitoring timeout */
+ GPS_EVT_TIMEOUT_NAVI, /* Navigation providing data monitoring timeout */
+ GPS_EVT_TIMEOUT_DIAGCLKGUARD, /* Diagnosis provision time guard monitoring timeout*/
+ GPS_EVT_ACC_OFF, /* In-function ACC-OFF instructions */
+ GPS_EVT_NAVI_LOCATIONINFO, /* Providing navigation information */
+ GPS_EVT_NAVI_SPEEDINFO, /* Navigation speed information service */
+ GPS_EVT_TIMESETTING, /* GPS time setting instruction */
+ GPS_EVT_TIMEOUT_NMEADATAGUARD, /* NMEA data-providing guard monitoring timeout*/
+ GPS_EVT_BACKUPDATA_LOAD, /* Backup data read request */
+ GPS_EVT_STOPREQ, /* Thread stop request */
+ GPS_EVT_WEEKCOR_CNT_NOTIFICATIO, /* GPS Week Adjustment Counter Notification */
+ GPS_EVT_TIMEOUT_RECOVERY, /* GPS error monitoring reset timer */
+ GPS_EVT_TIMEOUT_RECEIVERERR, /* GPS receiver anomaly detection timeout */
+ GPS_EVT_NUM
+} TG_GPS_MATRIX_EVT;
+
+typedef enum GpsOutputFormat {
+ GPS_FORMAT_MIN = -1, /* Minimum Receive Format(Initialization) */
+ GPS_FORMAT_BINARY, /* Standard binary */
+ GPS_FORMAT_FULLBIN, /* Full binary */
+ GPS_FORMAT_GGA, /* GGA */
+ GPS_FORMAT_DGGA, /* DGGA */
+ GPS_FORMAT_VTG, /* VTG */
+ GPS_FORMAT_RMC, /* RMC */
+ GPS_FORMAT_DRMC, /* DRMC */
+ GPS_FORMAT_GLL, /* GLL */
+ GPS_FORMAT_DGLL, /* DGLL */
+ GPS_FORMAT_GSA, /* GSA */
+ GPS_FORMAT_GSV1, /* GSV(1) */
+ GPS_FORMAT_GSV2, /* GSV(2) */
+ GPS_FORMAT_GSV3, /* GSV(3) */
+ GPS_FORMAT_GSV4, /* GSV(4) */
+ GPS_FORMAT_GSV5, /* GSV(5) */
+ GPS_FORMAT_GST, /* GST */
+ GPS_FORMAT__CWORD44__GP3, /* _CWORD44_,GP,3 */
+ GPS_FORMAT__CWORD44__GP4, /* _CWORD44_,GP,4 */
+ GPS_FORMAT_P_CWORD82_F_GP0, /* P_CWORD82_F,GP,0 */
+ GPS_FORMAT_P_CWORD82_J_GP1, /* P_CWORD82_J,GP,1 */
+ GPS_FORMAT_P_CWORD82_I_GP, /* P_CWORD82_I,GP */
+ GPS_FORMAT_P_CWORD82_E_GP0, /* P_CWORD82_E,GP,0 */
+ GPS_FORMAT_P_CWORD82_J_GP0, /* P_CWORD82_J,GP,0 */
+ GPS_FORMAT_P_CWORD82_E_GP2, /* P_CWORD82_E,GP,2 */
+ GPS_FORMAT_P_CWORD82_G_GP0, /* P_CWORD82_G,GP,0 */
+ GPS_FORMAT_P_CWORD82_J_GP7, /* P_CWORD82_J,GP,7 */
+ GPS_FORMAT_P_CWORD82_J_GP8, /* P_CWORD82_J,GP,8 */
+ GPS_FORMAT_MON_VER, /* MON-VER */
+ GPS_FORMAT_AID_INI, /* AID-INI */
+ GPS_FORMAT_ACK_ACKNACK, /* ACK-ACKNACK */
+ GPS_FORMAT_NAV_TIMEUTC, /* NAV-TIMEUTC */
+ GPS_FORMAT_NAV_CLOCK, /* NAV-CLOCK */
+ GPS_FORMAT_RXM_RTC5, /* RXM-RTC5 */
+ GPS_FORMAT_NAV_SVINFO, /* NAV-SVINFO */
+ GPS_FORMAT_CFG_NAVX5, /* CFG-NAVX5 */
+ GPS_FORMAT_NMEA, /* NMEA (Sentence unspecified) */
+ GPS_FORMAT_UBX, /* UBX Protocol (binary) */
+ GPS_FORMAT_MAX /* Maximum Receive Format */
+} TG_GPS_OUTPUT_FORMAT;
+
+// Return value
+#define RETRY_OFF 0 /* No retry */
+#define RETRY_ON 1 /* Retry exists */
+#define RETRY_OUT 2 /* Retry out */
+#define NG_RETRYOUT 4 /* Transmission failure retry out */
+
+#define GPSRET_NOPCMD (0) /* Non notification target command #GPF_60_024 */
+#define GPSRET_SNDCMD (1) /* Notification target command #GPF_60_024 */
+#define GPSRET_CMDERR (-1) /* No applicable command #GPF_60_024 */
+
+// Number of Retries
+#define SRSET_MAX 4 /* Maximum serial reset retry value */
+#define HRSET_MAX 3 /* Maximum value of hard reset retry */
+#define SNDNG_MAX 4 /* Maximum retry value of transmission failure */
+
+/* The actual number of retries is SNDNG_MAX-1. */
+#define GPS_RECV_ERR_MAX 5 /* Maximum number of reception errors #GPF_60_024 */
+
+// Others
+#define SAV_MAX 11
+#define GPS_ALTITUDE_INVALID_VAL (-1000000) /* Value when fix altitude is invalid */
+#define GPS_HEADING_INVALID_VAL 36100 /* Value when measurement orientation is invalid */
+
+#define GPS_RECVOK 0 /* Normal reception #13 */
+#define GPS_RECVNG 1 /* Reception error #13 */
+#define GPS_OVERRUN 2 /* Overrun detection #13 */
+#define GPS_PARITY 3 /* Parity detection #13 */
+#define GPS_FRAMING 4 /* Framing detection #13 */
+
+// For the communication management thread
+#define GPS_NON_RECV 0 /* Not received */
+#define GPS_RECV_ACK 1 /* ACK received */
+#define GPS_RECV_DATA 2 /* Receive response command */
+
+#define GPS_SEND_ERR_MAX 5 /* Maximum number of transmission errors */
+#define GPS_CNCT_ERR_MAX 5 /* Maximum number of connection errors */
+
+#define GPS_START_EVT "GPS_EVT" /* Interthread synchronization events */
+#define GPS_EVT_VAL 99 /* Event settings */
+#define GPS_MSGDAT_BUF_SZ 500 /* Receive message buffer size */
+
+// Definition for receive command analysis table #GPF_60_024
+#define SENTENCE_STR_MAX 12 /* Maximum string for judging sentence */
+
+#define SENSOR_MSG_VSINFO_DSIZE 1904 //!< \~english message body max size
+
+/*---------------------------------------------------------------------------*/
+// Structure
+
+/********************************************************************************
+ * TAG :TG_GPS_MNG
+ * ABSTRACT :GPS process management information
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsMng {
+ u_int32 sts; /* Matrix state */
+ u_int32 event; /* Matrix event code */
+ u_int32 rcvsts; /* Response reception status */
+ u_int32 sndcnt; /* Number of transmission attempts */
+ u_int32 hrsetcnt; /* Number of tries before hard reset */
+ u_int32 sndngcnt; /* Number of failed-to-send attempts */
+ TG_GPS_OUTPUT_FORMAT rcv_cmd; /* Types of received GPS commands */
+ TG_GPS_OUTPUT_FORMAT resp_cmd; /* Types of GPS commands during response monitoring */
+ PNO resp_pno; /* Destination PNO */
+ RID resp_rid; /* RID to be notified when responding */
+ u_int8 resp_rst_flag; /* Response command reset flag */
+ BOOL rcv_err_flag; /* GPS receiver error detection flag */
+} TG_GPS_MNG;
+
+/********************************************************************************
+ * TAG :TG_GPS_SAVECMD
+ * ABSTRACT :GPS process pending command
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsSaveCmd {
+ TG_GPS_SND_DATA sndcmd; /* Sending commands(_CWORD82_ command) */
+ PNO us_pno; /* Result notification destination process number(Unused) */
+ RID uc_rid; /* Result Notification Resource ID(Unused) */
+ u_int8 uc_rst; /* Reset flag */
+ TG_GPS_OUTPUT_FORMAT e_cmd_info; /* Command information */
+} TG_GPS_SAVECMD;
+
+/********************************************************************************
+ * TAG :TG_GPS_SAVEBUF
+ * ABSTRACT :GPS process pending buffer management information
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsSaveBuf {
+ u_int32 saveno; /* Current pending index number */
+ u_int32 sendno; /* Current send index number */
+ u_int32 bufsav; /* Number of pending buffers used */
+ TG_GPS_SAVECMD savebuf[SAV_MAX]; /* Pending buffer */
+} TG_GPS_SAVEBUF;
+
+/********************************************************************************
+ * TAG :TG_GPS_MSGRCV
+ * ABSTRACT :Receive message
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsMsgRcv {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ u_int8 msgdat[SENSOR_MSG_VSINFO_DSIZE + 12];
+} TG_GPS_MSGRCV;
+
+/********************************************************************************
+ * TAG :TG_GPS_MSGEVTCHNG
+ * ABSTRACT :GPS message event translation table
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsMsgEvtChng {
+ u_int32 cid; /* Matrix state */
+ u_int32 event; /* Matrix event code */
+} TG_GPS_MSGEVTCHNG;
+
+/********************************************************************************
+ * TAG :TG_GPS_TIMEVTCHNG
+ * ABSTRACT :GPS timer ID and event translation table
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsTimEvtChng {
+ u_int16 tim_id; /* Timer ID information */
+ u_int16 reserve; /* Reserved */
+ u_int32 event; /* Matrix event code */
+} TG_GPS_TIMEVTCHNG;
+
+/********************************************************************************
+ * TAG :Gps_Jmp_Tbl
+ * ABSTRACT :GPS jump table
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsJmpTbl {
+ void (*func)( void ); /* Jump-to module */
+} TG_GPS_JMP_TBL;
+
+/********************************************************************************
+ * TAG :TG_GPS_CMD_ANA_TBL
+ * ABSTRACT :Receive command analysis table structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct TgGpsCmdAnaTbl {
+ u_char c_sentence[SENTENCE_STR_MAX]; /* Sentence identifier */
+ u_int32 ul_length; /* Length of the command */
+ u_int32 ul_rcv_kind; /* Receiving type */
+ BOOL b_snd_cmd_flg; /* Command notification flag */
+ TG_GPS_OUTPUT_FORMAT e_rcv_format; /* Receive Format */
+} TG_GPS_CMD_ANA_TBL;
+
+/********************************************************************************
+ * TAG :TG_GPS_TIME_BCD
+ * ABSTRACT :Time information (BCD) structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsTimeBCD {
+ u_int8 uc_year; /* Year information */
+ u_int8 uc_month; /* Month information */
+ u_int8 uc_day; /* Day information */
+ u_int8 uc_hour; /* Time information */
+ u_int8 uc_min; /* Minute information */
+ u_int8 uc_sec; /* Second information */
+} TG_GPS_TIME_BCD;
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+#define MDEV_GPSMSGCHKC_MAX 10
+#define MDEV_PSTIMCHKC_MAX 11
+extern const TG_GPS_MSGEVTCHNG kGpsMsgchkC[MDEV_GPSMSGCHKC_MAX]; /* Ignore -> MISRA-C:2004 Rule 8.12 */
+extern const TG_GPS_TIMEVTCHNG kGpsTimchkC[MDEV_PSTIMCHKC_MAX]; /* Ignore -> MISRA-C:2004 Rule 8.12 */
+extern const TG_GPS_JMP_TBL kGpsMatxC[GPS_STS_NUM][GPS_EVT_NUM];
+
+#define MDEV_GPSCMDANATBLNMEA_MAX 20
+extern const TG_GPS_CMD_ANA_TBL* kGpsCmdAnaTbl;
+extern const TG_GPS_CMD_ANA_TBL kGpsCmdAnaTblUblox[MDEV_GPSCMDANATBLNMEA_MAX];
+
+extern TG_GPS_SAVEBUF g_gps_save_cmdr;
+extern TG_GPS_MSGRCV g_gps_msg_rcvr;
+extern TG_GPS_MNG g_gps_mngr;
+
+extern u_int16 g_wsend_err; /* Number of transmission errors */
+extern u_int16 g_wcnct_err; /* Number of connection errors */
+extern TG_GPS_OUTPUT_FORMAT g_rcv_format; /* Receive Format */
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+EFrameworkunifiedStatus DevGpsMainThread(HANDLE h_app);
+BOOL DevGpsInit(void);
+void DevGpsRcvMsg(void);
+void DevGpsMsgEventCheck(void);
+void DevGpsTimEventCheck(void);
+void DevGpsGpsVersionCheck(void);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_MAIN_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h b/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h
new file mode 100755
index 0000000..610b8d4
--- /dev/null
+++ b/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h
@@ -0,0 +1,90 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Mtrx.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_MTRX_H_
+#define INC_GPSCOMMON_MDEV_GPS_MTRX_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DevGpsNop(void);
+void DevGpsInitStartSendReq(void);
+void DevGpsInitStartGPSResetReq(void);
+void DevGpsInitStartRcvCyclCmd(void);
+void DevGpsInitStartCyclDataTimeOut(void);
+void DevGpsInitStartNaviDataTimeOut(void); /* #GPF_60_077 */
+void DevGpsInitStartDiagClkGuardTimeOut(void); /* #GPF_60_077 */
+void DevGpsInitStartAccOffStart(void); /* #GPF_60_024 */
+void DevGpsInitStartNaviInfoDeliver(void); /* #GPF_60_077 */
+void DevGpsInitStartNaviSpeedDeliver(void); /* #GPF_60_077 */
+void DevGpsInitStartSettingTime(void); /* #GPF_60_077 */
+void DevGpsInitStartNmeaDataGuardTimeOut(void); /* #GPF_60_109 */
+
+void DevGpsInitStartBackupDataLoadReq(void);
+void DevGpsInitStartStopReq(void);
+void DevGpsInitStartGpsweekcorcntNtf(void);
+void DevGpsInitStartRecoveryTimeOut(void);
+void DevGpsInitStartGpsReceiverErrTimeOut(void);
+
+void DevGpsNormalSendReq(void);
+void DevGpsNormalGPSResetReq(void);
+void DevGpsNormalRcvCyclCmd(void);
+void DevGpsNormalCyclDataTimeOut(void);
+void DevGpsNormalNaviDataTimeOut(void); /* #GPF_60_077 */
+void DevGpsNormalDiagClkGuardTimeOut(void); /* #GPF_60_077 */
+void DevGpsNormalAccOffStart(void); /* #GPF_60_024 */
+void DevGpsNormalNaviInfoDeliver(void); /* #GPF_60_077 */
+void DevGpsNormalNaviSpeedDeliver(void); /* #GPF_60_077 */
+void DevGpsNormalSettingTime(void); /* #GPF_60_077 */
+void DevGpsNormalNmeaDataGuardTimeOut(void); /* #GPF_60_109 */
+
+void DevGpsNormalBackupDataLoadReq(void);
+void DevGpsNormalStopReq(void);
+void DevGpsNormalGpsweekcorcntNtf(void);
+void DevGpsNormalRecoveryTimeOut(void);
+void DevGpsNormalGpsReceiverErrTimeOut(void);
+
+void DevGpsSendSendReq(void);
+void DevGpsSendGPSResetReq(void);
+void DevGpsSendRcvCyclCmd(void);
+void DevGpsSendRcvRspCmd(void); /* #GPF_60_040 */
+void DevGpsSendRspDataTimeOut(void); /* #GPF_60_040 */
+void DevGpsSendCyclDataTimeOut(void);
+void DevGpsSendNaviDataTimeOut(void); /* #GPF_60_077 */
+void DevGpsSendDiagClkGuardTimeOut(void); /* #GPF_60_077 */
+void DevGpsSendAccOffStart(void); /* #GPF_60_040 */
+void DevGpsSendNaviInfoDeliver(void); /* #GPF_60_077 */
+void DevGpsSendNaviSpeedDeliver(void); /* #GPF_60_077 */
+void DevGpsSendSettingTime(void); /* #GPF_60_077 */
+void DevGpsSendNmeaDataGuardTimeOut(void); /* #GPF_60_109 */
+
+void DevGpsSendBackupDataLoadReq(void);
+void DevGpsSendStopReq(void);
+void DevGpsSendGpsweekcorcntNtf(void);
+void DevGpsSendRecoveryTimeOut(void);
+void DevGpsSendGpsReceiverErrTimeOut(void);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_MTRX_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h b/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h
new file mode 100755
index 0000000..a19e3d9
--- /dev/null
+++ b/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h
@@ -0,0 +1,313 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_GpsUblox.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_NMEA_H_
+#define INC_GPSCOMMON_MDEV_GPS_NMEA_H_
+
+/*---------------------------------------------------------------------------*/
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define TEST_NMEA (0) /* 0:Normal mode 1:Testing mode */
+
+#define GPS_MAX_NUM_VISIBLE_SATELLITES (20) /* Maximum Number of Visible Satellites *Assume the GSV1~GSV5 */
+
+/* UBX command *****************************/
+
+/* CFG */
+#define UBX_CMD_SIZE_CFG_RST (12) /* size of CFG-RST of UBX sentences */
+#define UBX_CMD_SIZE_CFG_MSG (11) /* size of CFG-MSG of UBX sentences */
+#define UBX_CMD_SIZE_CFG_NAV5 (44) /* size of CFG-NAV5 of UBX sentences */
+#define UBX_CMD_SIZE_CFG_NAV5_POLL (8)
+#define UBX_CMD_SIZE_CFG_NAV5_PLUS_POLL (UBX_CMD_SIZE_CFG_NAV5 + UBX_CMD_SIZE_CFG_NAV5_POLL)
+#define UBX_CMD_SIZE_CFG_NAVX5_POLL (8)
+#define UBX_CMD_OFFSET_WKNROLLOVER (18) /* offset from the top of 'payload' */
+
+/* MON */
+#define UBX_CMD_SIZE_MON_VER (108) /* size of MON-VER of UBX sentences */
+#define UBX_CMD_SIZE_MON_VER_POLL (8)
+#define UBX_CMD_SIZE_MON_VER_SW_VER (30)
+
+/* AID */
+#define UBX_CMD_SIZE_AID_INI (56) /* size of AID-INI of UBX sentences */
+#define UBX_CMD_SIZE_AID_INI_POLL (8)
+#define UBX_CMD_SIZE_AID_INI_PLUS_POLL (UBX_CMD_SIZE_AID_INI + UBX_CMD_SIZE_AID_INI_POLL)
+
+/* ACK */
+#define UBX_CMD_OFFSET_ACKNAK (3) /* offset to Ack/Nack Infomation */
+
+/* NAV */
+#define UBX_CMD_MSK_NAV_TIMEUTC_VALID_TOW (1) /* mask bit for 'validTow' of NAV-TIMEUTC */
+#define UBX_CMD_MSK_NAV_TIMEUTC_VALID_WKN (2) /* mask bit for 'validKwn' of NAV-TIMEUTC */
+#define UBX_CMD_MSK_NAV_TIMEUTC_VALID_UTC (4) /* mask bit for 'validUtc' of NAV-TIMEUTC */
+
+/* Common */
+#define UBX_CMD_SIZE_HDR (2) /* size of 'header' of UBX sentence */
+#define UBX_CMD_SIZE_ID (2) /* size of 'id' of UBX sentence */
+#define UBX_CMD_SIZE_LEN (2) /* size of 'length' of UBX sentence */
+#define UBX_CMD_SIZE_MAX (400) /* size of NAV-SVINFO (numCh=32) */
+#define UBX_CMD_OFFSET_PAYLOAD (UBX_CMD_SIZE_HDR + UBX_CMD_SIZE_ID + UBX_CMD_SIZE_LEN)
+ /* offset to 'payload' of UBX sentence */
+
+/* Types of UBX Poll Request Commands ************/
+#define UBX_POLL_CMD_KIND_AID_INI (1)
+#define UBX_POLL_CMD_KIND_CFG_NAV5 (2)
+
+// GPS-command (_CWORD82_ NMEA) related definitions #GPF_60_024
+/* Command identification character string */
+#define GPS_CMD_NMEA_GGA ("$GPGGA") /* GGA/double precision GGAs */
+#define GPS_CMD_NMEA_VTG ("$GPVTG") /* VTG */
+#define GPS_CMD_NMEA_RMC ("$GPRMC") /* RMC/double precision RMCs */
+#define GPS_CMD_NMEA_GLL ("$GPGLL") /* GLL/double precision GLL */
+#define GPS_CMD_NMEA_GSA ("$GPGSA") /* GSA */
+#define GPS_CMD_NMEA_GSV_1 ("$GPGSV,*,1") /* GSV(1) */
+#define GPS_CMD_NMEA_GSV_2 ("$GPGSV,*,2") /* GSV(2) */
+#define GPS_CMD_NMEA_GSV_3 ("$GPGSV,*,3") /* GSV(3) */
+#define GPS_CMD_NMEA__CWORD44__GP_3 ("$_CWORD44_,GP,3") /* _CWORD44_,GP,3 */
+#define GPS_CMD_NMEA__CWORD44__GP_4 ("$_CWORD44_,GP,4") /* _CWORD44_,GP,4 */
+#define GPS_CMD_NMEA_P_CWORD82_F_GP_0 ("$P_CWORD82_F,GP,0") /* P_CWORD82_F,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_1 ("$P_CWORD82_J,GP,1") /* P_CWORD82_J,GP,1 */
+#define GPS_CMD_NMEA_P_CWORD82_I_GP ("$P_CWORD82_I,GP") /* P_CWORD82_I,GP */
+#define GPS_CMD_NMEA_P_CWORD82_E_GP_0 ("$P_CWORD82_E,GP,0") /* P_CWORD82_E,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_0 ("$P_CWORD82_J,GP,0") /* P_CWORD82_J,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_E_GP_2 ("$P_CWORD82_E,GP,2") /* P_CWORD82_E,GP,2 */
+#define GPS_CMD_NMEA_P_CWORD82_G_GP_0 ("$P_CWORD82_G,GP,0") /* P_CWORD82_G,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_7 ("$P_CWORD82_J,GP,7") /* P_CWORD82_J,GP,7 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_8 ("$P_CWORD82_J,GP,8") /* P_CWORD82_J,GP,8 */
+#define GPS_CMD_NMEA_GST ("$GPGST") /* GST */
+#define GPS_CMD_NMEA_GSV_4 ("$GPGSV,*,4") /* GSV(4) */
+#define GPS_CMD_NMEA_GSV_5 ("$GPGSV,*,5") /* GSV(5) */
+
+/*-------------------------------------------------------------------------------
+ * GPS-command (_CWORD82_ Binary) related definitions #GPF_60_024
+ -------------------------------------------------------------------------------*/
+#define GPS_CMD_BINARY (0xC6) /* Standard binary */
+#define GPS_CMD_FULLBIN (0xB0) /* FULL binaries */
+
+#define ENDMARK "ENDENDEND" /* Table termination */
+#define GPSCMDANATBL_MAX 25 /* Maximum number of elements in table */
+#define RCV_CYCLE 0x01 /* Reception type cycle reception command*/
+#define RCV_RESP 0x02 /* Reception type response command */
+
+// Length of FULLBINARY commands
+#define GPS_CMD_FULLBIN1_SZ 30
+#define GPS_CMD_FULLBIN2_SZ 160
+#define GPS_CMD_FULLBIN3_SZ 25
+#define GPS_CMD_FULLBIN4_SZ 26
+#define GPS_CMD_FULLBIN5_SZ 14
+#define GPS_CMD_FULLBIN6_SZ 61
+
+/* Start offset of FULLBINARY command */
+#define GPS_CMD_FULLBIN1_OFFSET 0
+#define GPS_CMD_FULLBIN2_OFFSET (GPS_CMD_FULLBIN1_OFFSET + GPS_CMD_FULLBIN1_SZ)
+#define GPS_CMD_FULLBIN3_OFFSET (GPS_CMD_FULLBIN2_OFFSET + GPS_CMD_FULLBIN2_SZ)
+#define GPS_CMD_FULLBIN4_OFFSET (GPS_CMD_FULLBIN3_OFFSET + GPS_CMD_FULLBIN3_SZ)
+#define GPS_CMD_FULLBIN5_OFFSET (GPS_CMD_FULLBIN4_OFFSET + GPS_CMD_FULLBIN4_SZ)
+#define GPS_CMD_FULLBIN6_OFFSET (GPS_CMD_FULLBIN5_OFFSET + GPS_CMD_FULLBIN6_SZ)
+
+
+/* SUM value offset of FULLBINARY commands */
+#define GPS_CMD_FULLBIN1_SUMOFFSET (GPS_CMD_FULLBIN1_OFFSET + GPS_CMD_FULLBIN1_SZ - 2)
+#define GPS_CMD_FULLBIN2_SUMOFFSET (GPS_CMD_FULLBIN2_OFFSET + GPS_CMD_FULLBIN2_SZ - 2)
+#define GPS_CMD_FULLBIN3_SUMOFFSET (GPS_CMD_FULLBIN3_OFFSET + GPS_CMD_FULLBIN3_SZ - 2)
+#define GPS_CMD_FULLBIN4_SUMOFFSET (GPS_CMD_FULLBIN4_OFFSET + GPS_CMD_FULLBIN4_SZ - 2)
+#define GPS_CMD_FULLBIN5_SUMOFFSET (GPS_CMD_FULLBIN5_OFFSET + GPS_CMD_FULLBIN5_SZ - 2)
+#define GPS_CMD_FULLBIN6_SUMOFFSET (GPS_CMD_FULLBIN6_OFFSET + GPS_CMD_FULLBIN6_SZ - 2)
+#define GPS_CMD_FULLBIN_MASK 0x8F
+
+#define GPS_CMD_RESET 1 /* Reset request command */
+#define GPS_CMD_TIMESET 2 /* Time setting request command */
+#define GPS_CMD_VERSION 3 /* GPS version request command */
+#define GPS_CMD_SENTENCEADD_NMEAGST 4 /* Add sentence command NMEA GST */
+#define GPS_CMD_SENTENCEADD_NAVTIMEUTC 5 /* Add sentence command NAV-TIMEUTC */
+#define GPS_CMD_SENTENCEADD_NAVCLOCK 6 /* Add sentence command NAV-CLOCK */
+#define GPS_CMD_SENTENCEADD_RXMRTC5 7 /* Add sentence command RXM-RTC5 */
+#define GPS_CMD_SENTENCEADD_NAVSVINFO 8 /* Add sentence command NAV-SVINFO */
+#define GPS_CMD_AUTOMOTIVEMODE 9 /* Automatic mode request command */
+#define GPS_CMD_WKNROLLOVER 10 /* GPS rollover standard week number request command */
+#define GPS_CMD_NOTRST 0 /* Other request command */
+
+/*---------------------------------------------------------------------------*/
+// Struct
+
+/*!
+ @brief UBX command headers
+*/
+typedef struct GpsUbxPacketHeader {
+ u_int8 uc_sync_char1; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_sync_char2; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_class; /* Class */
+ u_int8 uc_id; /* ID */
+ u_int16 us_length; /* Length */
+} TG_GPS_UBX_PACKET_HEADER;
+
+/*!
+ @brief Command-structure without UBX data
+*/
+typedef struct GpsUbxCmdNoData {
+ TG_GPS_UBX_PACKET_HEADER header;
+ u_int8 uc_cka; /* Checksum_A */
+ u_int8 uc_ckb; /* Checksum_B */
+} TG_GPS_UBX_COMMAND_NO_DATA;
+
+/*!
+ @brief
+*/
+typedef struct GpsUbxAidIniPolled {
+ u_int8 uc_sync_char1; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_sync_char2; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_class; /* Class */
+ u_int8 uc_id; /* ID */
+ u_int8 uc_length[2]; /* Length */
+ u_int8 uc_ecefx_or_lat[4]; /* WGS84 ECEF X coordinate or latitude */
+ u_int8 uc_ecefy_or_lon[4]; /* WGS84 ECEF Y coordinate or longitude */
+ u_int8 uc_ecefz_or_alt[4]; /* WGS84 ECEF Z coordinate or altitude */
+ u_int8 uc_pos_acc[4]; /* Position accuracy (stddev) */
+ u_int8 uc_tm_cfg[2]; /* Time mark configuration */
+ u_int8 wn[2]; /* Actual week number */
+ u_int8 tow[4]; /* Actual time of week */
+ u_int8 uc_tow_ns[4]; /* Sub-millisecond part of time of week */
+ u_int8 uc_tacc_ms[4]; /* Milliseconds part of time accuracy */
+ u_int8 uc_tacc_ns[4]; /* Nanoseconds part of time accuracy */
+ u_int8 uc_clk_d_or_freq[4]; /* Clock drift or frequency */
+ u_int8 uc_clk_dacc_or_freqacc[4]; /* Accuracy of clock drift or frequency */
+ u_int8 uc_flags[4]; /* Bitmask with the following flags */
+ u_int8 uc_cka; /* Checksum_A */
+ u_int8 uc_ckb; /* Checksum_B */
+} TG_GPS_UBX_AID_INI_POLLED;
+
+/*!
+ @brief UBX ACK command data structures
+*/
+typedef struct GpsUbxAckData {
+ uint8_t uc_msg_class; /* Message Class */
+ uint8_t uc_msg_id; /* Message Identifier */
+} TG_GPS_UBX_ACK_DATA;
+
+/*!
+ @brief UBX NAV-TIMEUTC command data structures
+*/
+typedef struct GpsUbxNavUTC {
+ uint32_t ul_itow; /* GPS time of week */
+ uint32_t ul_tacc; /* Time accuracy estimate (UTC) */
+ int32_t nano; /* Fraction of second */
+ uint16_t year; /* Year, range 1999..2099 (UTC) */
+ uint8_t month; /* Month, range 1..12 (UTC) */
+ uint8_t day; /* Day of month, range 1..31 (UTC) */
+ uint8_t hour; /* Hour of day, range 0..23 (UTC) */
+ uint8_t min; /* Minute of hour, range 0..59 (UTC) */
+ uint8_t sec; /* Seconds of minute, range 0..60 (UTC) */
+ uint8_t valid; /* Validity Flags */
+} TG_GPS_UBX_NAV_TIMEUTC_DATA;
+
+/*!
+ @brief USB NAV-CLOCK command data structures
+*/
+typedef struct GpsUbxNavClock {
+ uint32_t ul_itow; /**< GPS Time of week */
+ int32_t l_clkb; /**< Clock bias */
+ int32_t l_clkd; /**< Clock drift */
+ uint32_t ul_tacc; /**< Time accuaracy estimate */
+ uint32_t ul_facc; /**< Frequency accuracy estimate */
+} TG_GPS_UBX_NAV_CLOCK;
+
+/*!
+ @brief GPS RXM-RTC5 command data structures
+*/
+typedef struct GpsUbxRxmRtc5 {
+ uint32_t ul_rtag_hw; /**< RTAG high word */
+ uint32_t ul_rtag_lw; /**< RTAG low word */
+ uint32_t freq; /**< Clock frequency */
+ uint32_t ul_freq_frac; /**< Clock frequency fractional part */
+ uint32_t ul_tow_frac; /**< Time of week fractional part */
+ uint32_t tow; /**< Time of week */
+ uint16_t wno; /**< GPS week number */
+ uint8_t uc_tow_valid; /**< TOW is valid flag */
+ uint8_t uc_freq_valid; /**< Frequency is valid flag */
+} TG_GPS_UBX_RXM_RTC5;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA_NMEA
+ * ABSTRACT :Cyclic data (NMEA) area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvDataNMEA {
+ u_int8 uc_rcv_flag[GPS_NMEA_INDEX_MAX]; /* Receive flag */
+ u_int8 u_reserve[3]; /* Reserved */
+ TG_GPS_NMEA_DAT st_nmea[GPS_NMEA_INDEX_MAX]; /* NMEA data area */
+} TG_GPS_RCVDATA_NMEA;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA_BINARY
+ * ABSTRACT :Cyclic data (standard binary) area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvDataBinary {
+ u_int8 uc_rcv_flag; /* Receive flag */
+ u_int8 u_reserve[3]; /* Reserved */
+ u_int8 uc_data[GPS_CMD_BINARY_SZ]; /* Standard binary data area */
+ u_int8 u_reserve2[3]; /* Reserved */
+} TG_GPS_RCVDATA_BINARY;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA_FULLBIN
+ * ABSTRACT :Cyclic data (full binary) area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvDataFullbin {
+ u_int8 uc_rcv_flag; /* Receive flag */
+ u_int8 u_reserve[3]; /* Reserved */
+ u_int8 uc_data[GPS_CMD_FULLBIN_SZ]; /* Full binary data area */
+ u_int8 u_reserve2; /* Reserved */
+} TG_GPS_RCVDATA_FULLBIN;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA
+ * ABSTRACT :Cyclic data storage area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvData {
+ u_int8 uc_sns_cnt; /* Sensor counter value */
+ u_int8 u_reserve[3]; /* Reserved */
+ TG_GPS_RCVDATA_NMEA st_nmea_data; /* NMEA data area */
+ TG_GPS_RCVDATA_BINARY st_binary_data; /* Standard binary region */
+ TG_GPS_RCVDATA_FULLBIN st_fullbin_data; /* Full binary data area */
+} TG_GPS_RCVDATA;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DevGpsSndCycleDataNmea(void);
+void DevGpsRcvCyclCmd(void);
+u_int8 DevGpsGetGpsRcvSts(u_int8 sv);
+void DevGpsAnalyzeNmea(NAVIINFO_ALL* navilocinfo);
+void DevGpsCycleDataClear(void);
+void DevGpsCycleDataSetNmea(const u_int8*, u_int32, ENUM_GPS_NMEA_INDEX);
+BOOL DevGpsCycleDataGetNmea(u_int8*, u_int32, ENUM_GPS_NMEA_INDEX);
+void DevGpsCmdEventCheckNmea(void);
+void DevGpsSetChkSum(u_int8* buffer, u_int32 length);
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_NMEA_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h b/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h
new file mode 100755
index 0000000..96616ef
--- /dev/null
+++ b/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h
@@ -0,0 +1,113 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_TimerCtrl.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
+#define INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+/* GPS-related timer value */
+#define TIMVAL_GPS_STARTUP 500 /* 5Sec Start confirmation monitoring timer */
+#define TIMVAL_GPS_RCVCYCLDAT 500 /* 5Sec Periodic reception data monitoring timer */
+#define TIMVAL_GPS_RCVACK 500 /* 5Sec ACK reception monitoring timer */
+#define TIMVAL_GPS_RCVDAT 500 /* 5Sec Data reception monitoring timer(Unused) */
+#define TIMVAL_GPS_NAVIFST 3000 /* 30sec Initial navigation monitoring timer */
+#define TIMVAL_GPS_NAVICYCLE 300 /* 3sec Navigation monitoring timer */
+#define TIMVAL_GPS_NAVIDISRPT 1000 /* 10Sec Navigation monitoring disruption log output timer */
+#define TIMVAL_GPS_DIAGCLKGUARD 1000 /* 10sec Diagnosis provision time guard monitoring timer */
+#define TIMVAL_GPS_NMEADATAGUARD 1000 /* 10sec NMEA data-providing guard monitoring timer */
+#define TIMVAL_GPS_RECOVERY 60000 /* 600sec GPS recovery timer */
+#define TIMVAL_GPS_RECEIVERERR 60000 /* 600sec GPS receiver anomaly detection timer */
+
+/* Sensor-related timer value */
+#define TIMVAL_SNS_RCVFSTDAT 3000 /* 30Sec Initial sensor data reception monitoring timer */
+#define TIMVAL_SNS_RCVCYCLDAT 300 /* 3Sec Cyclic sensor data reception monitoring timer */
+#define TIMVAL_SNS_RCVDISRPT 1000 /* 10Sec Cyclic sensor data interruption log output timer */
+
+/* Timer management table */
+#define TIM_NON 0x00 /* Timer counter initial value */
+#define TIM_CNTMIN 0x01 /* Timer counter minimum value */
+#define TIM_CNTMAX 0xff /* Maximum value of timer counter */
+#define TIMER_OFF 0 /* Timer enable flag OFF */
+#define TIMER_ON 1 /* Timer enable flag ON */
+
+/*!
+ @brief Timer type
+ */
+typedef enum GpsTimKind {
+ GPS_STARTUP_TIMER = 0, /* 0 Start confirmation monitoring timer */
+ GPS_CYCL_TIMER, /* 1 Cyclic GPS data reception monitoring timer */
+ GPS_RECV_ACK_TIMER, /* 2 ACK reception monitoring timer */
+ GPS_NAVIFST_TIMER, /* 3 Initial navigation monitoring timer */
+ GPS_NAVICYCLE_TIMER, /* 4 Navigation monitoring timer */
+ GPS_NAVIDISRPT_TIMER, /* 5 Navigation monitoring disruption log output timer */
+ GPS_DIAGCLK_GUARDTIMER, /* 6 Diagnosis provision time guard monitoring timer */
+ GPS_NMEADATA_GUARDTIMER, /* 7 NMEA data-providing guard monitoring timer */
+ GPS_RECOVERY_TIMER, /* 8 GPS recovery timer */
+ GPS_RECEIVERERR_TIMER, /* 9 GPS receiver anomaly detection timer */
+ SNS_FST_TIMER, /* 10 Initial sensor data reception monitoring timer */
+ SNS_CYCLE_TIMER, /* 11 Cyclic sensor data reception monitoring timer */
+ SNS_DISRPT_TIMER, /* 12 Cyclic sensor data interruption log output timer */
+ TIM_NUM /* 13 Number of timer types */
+} GPS_TIM_KIND;
+
+/*!
+ @brief Timer status
+*/
+typedef struct GpsTimSts {
+ u_int8 flag; /**< Timer flag OFF:Stop,ON:Start */
+ u_int8 cnt; /**< Start counter */
+ int8 rsv[2]; /**< Reserved */
+} GPS_TIM_STS;
+
+/*!
+ @brief Timer status management table
+ */
+typedef struct GpsTimMng {
+ GPS_TIM_STS sts[TIM_NUM]; /**< Timer status */
+} GPS_TIM_MNG;
+
+/*!
+ @brief Timer setting information table
+*/
+typedef struct GpsTimInfo {
+ uint32_t timer_val; /**< Timer value */
+ PNO pno; /**< Event notification destination process number */
+} GPS_TIM_INFO;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DevGpsTimInit(void);
+BOOL DevGpsTimeSet(GPS_TIM_KIND tim_kind);
+BOOL DevGpsTimeStop(GPS_TIM_KIND tim_kind);
+u_int16 DevGpsTimeMakSeqNo(GPS_TIM_KIND tim_kind);
+BOOL DevGpsTimeJdgKind(u_int16 seqno);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/LineSensDrv/LineSensDrv_Sensor.h b/positioning_hal/inc/LineSensDrv/LineSensDrv_Sensor.h
new file mode 100755
index 0000000..1b996b7
--- /dev/null
+++ b/positioning_hal/inc/LineSensDrv/LineSensDrv_Sensor.h
@@ -0,0 +1,183 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Sensor.h
+*/
+
+#ifndef INC_LINESENSDRV_LINESENSDRV_SENSOR_H_
+#define INC_LINESENSDRV_LINESENSDRV_SENSOR_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Macro definitions
+
+/* Message related */
+/* Message identification number definition received from the ICR */
+#define LSDRV_RCVMSG_INVALID 0x00 /* Not applicable */
+#define LSDRV_RCVMSG_SENSOR 0x12 /* Sensor data */
+
+/* LineSensor vehicle signal notification */
+
+#define LSDRV_SENS_MASK 0xFFF /* Sensor data MASK */
+#define LSDRV_PLSMAX 65536 /* Maximum vehicle speed pulse number */
+/* #011 start */
+#define LSDRV_SENS_COEFFICIENT 14.1287284284144427 /* Vehicle speed calculation factor */
+#define LSDRV_SPKMPH_METHOD_FST 0 /* Vehicle speed calculation method(Initial Sensor Data) */
+#define LSDRV_SPKMPH_METHOD_NML 1 /* Vehicle speed calculation method(Sensor data) */
+#define LSDRV_SPKMPH_AVE_TIME 29 /* Effective time for average calculation data(in units of 100ms) */ /* #013 */
+#define LSDRV_SPKMPH_NOISE_TIME (LSDRV_SPKMPH_AVE_TIME + 2) /* Effective Time for Noise Detection(in units of 100ms) */ /* #017 */
+#define LSDRV_SPKMPH_INVALID 1 /* No pulse of previous vehicle speed */
+#define LSDRV_SPKMPH_VALID 0 /* Last vehicle speed pulse */
+#define LSDRV_SENSCNT_BRW_ADD 256 /* Measures for borrow occurrence during search of sensor counters */
+/* #011 end */
+#define LSDRV_FSENS_NRCV 0 /* Not received */
+#define LSDRV_FSENS_RCV 1 /* Receiving */
+#define LSDRV_FSENS_RCVCOMP 2 /* Reception completion */
+#define LSDRV_FSENS_NORMAL 0 /* Receive data normal */ /* #001 */
+#define LSDRV_FSENS_ERROR 1 /* Receive data anomaly */ /* #001 */
+/* #016 start */
+#define LSDRV_PLSDATA_NRCV 0 /* Not received */
+#define LSDRV_PLSDATA_RCV 1 /* Received */
+#define LSDRV_SENSCNT_MAX 255 /* Maximum value of sensor counter */
+#define LSDRV_SPKMPH_MIN_DATA_N 6 /* Number of data required for vehicle speed calculation */
+#define LSDRV_FSPDPLS_NUM 3 /* Number of cumulative pulses registered for the first time */
+/* #016 end */
+#define LSDRV_REV_MASK 0x0040 /* REV-data MASK(Before endian conversion) */
+#define LSDRV_BITSHIFT_REV 6 /* REV data bit shift */
+#define LSDRV_TEMP_MASK 0x07FF /* Gyro temperature data MASK(after endian conversion) */
+#define LSDRV_PLSTIME_LEN 232 /* Data length when inter-pulse time exists */
+
+
+#define LSDRV_DETAILED_DATA_MULTI_ENABLE TRUE /* Detailed data multiplexing of initial sensor data Enabled/Disabled */
+
+#if LSDRV_DETAILED_DATA_MULTI_ENABLE
+#define LSDRV_DETAILED_DATA_MULTI_MAX_NUM 2 /* Detailed data multiplexing of initial sensor data Maximum number */
+#else
+#define LSDRV_DETAILED_DATA_MULTI_MAX_NUM 1 /* Detailed data multiplexing of initial sensor data Maximum number */
+#endif
+
+/* Total number of partitions of initial sensor data : Maximum value */
+#define LSDRV_FSENS_TOTAL_NUM_MAX LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM
+
+/* Detailed data of initial sensor data : Maximum number of acquisitions */
+#define LSDRV_DETAILED_DATA_MAX_NUM (LSDRV_FSENS_TOTAL_NUM_MAX * LSDRV_DETAILED_DATA_MULTI_MAX_NUM)
+
+/* Initial sensor data : Maximum number of saved messages */
+#define LSDRV_FSENS_SAVE_MSG_NUM (LSDRV_FSENS_TOTAL_NUM_MAX + 1)
+
+/* Initial sensor data : Maximum number of data stored */
+#define LSDRV_FSENS_SAVE_DATA_NUM (LSDRV_FSENS_SAVE_MSG_NUM * LSDRV_DETAILED_DATA_MULTI_MAX_NUM)
+
+#define LSDRV_DETAILED_DATA_GYRO_NUM LSDRV_FSTSNS_DETAILED_DATA_GYRO_NUM
+#define LSDRV_DETAILED_DATA_GSENSOR_NUM LSDRV_FSTSNS_DETAILED_DATA_GSENSOR_NUM
+#define LSDRV_DETAILED_DATA_GSENSOR_X_OFFSET 0 /* G-Sensor data X-axis offset included in detail data */
+#define LSDRV_DETAILED_DATA_GSENSOR_Y_OFFSET 1 /* G-Sensor data Y-axis offsets included in the detail data */
+#define LSDRV_DETAILED_DATA_GSENSOR_OFFSET 3 /* G-Sensor data access offset included in the detail data */
+
+/* Gyro Output Specifications:11500 ~ 54036LSB */
+#define GYRO_OUTPUPT_SPEC_LOWER_LIMIT 11500U
+#define GYRO_OUTPUPT_SPEC_UPPER_LIMIT 54036U
+
+/* Gyro Failure Status : How many normal status continues should be made to Gyro Failure Status normal when it is judged to be "error -> normal" */
+#define GYRO_TROUBLE_NORMAL_COUNTER_THRESHOLD 10U /* 10 ms (Gyro data acquisition interval) * 10 times = 100ms */
+
+/* Gyro Failure Status : How many error status continues should be made to Gyro Failure Status error when it is judged to be "normal -> error" */
+#define GYRO_TROUBLE_ERROR_COUNTER_THRESHOLD 3000U /* 10 ms (Gyro data acquisition interval) * 3000 times = 30s */
+
+/* SYS GPS Interrupt Signal : How many disable continues should be made to SYS GPS Interrupt Signal disable when it is judged to be "enable -> disable" */
+#define SYS_GPS_INTERRUPT_SIGNAL_INVALID_COUNTER_THRESHOLD 10U
+
+/* Gyro Failure Status : Match values with SENSORMOTION_NORMAL and ERROR,UNFIXED in SensorMotion_API.h */
+#define GYRO_NORMAL (0U)
+#define GYRO_ERROR (1U)
+#define GYRO_UNFIXED (2U)
+
+/* Gyro connection status : Match values with SENSOR_CONNECT and SENSOR_DISCONNECT in Sensor_API.h */
+#define GYRO_DISCONNECT (0U)
+#define GYRO_CONNECT (1U)
+
+/*** Data table for calculating vehicle speed *****************************************/
+#define LSDRV_SPKMPH_TBL_NUM 32 /* Number of data tables */ /* #50836 */
+#define LSDRV_SPKMPH_DATA_EN 0x01 /* Data storage flag valid */
+#define LSDRV_SPKMPH_DATA_DIS 0x00 /* Data storage flag invalid */
+
+/*** Operation code *********************************************/
+#define LSDRV_OPC_WILDCARD 0xFF /* Wildcarded #012 */
+
+#define LSDRV_OPC_EXTTERM_R 0x89 /* External pin status request */
+#define LSDRV_OPC_EXTTERM_A 0x99 /* External pin status notification */
+#define LSDRV_OPC_SENSOR 0xC1 /* Sensor data */
+#define LSDRV_OPC_FSENS_R 0xE4 /* Initial sensor data request */
+#define LSDRV_OPC_FSENS_A 0xF4 /* Initial sensor data response */
+
+/*---------------------------------------------------------------------------*/
+// Enum
+
+/*---------------------------------------------------------------------------*/
+// Struct
+
+typedef struct {
+ u_int16 uc_sensor_x; /* G-Sensor X data */
+ u_int16 uc_sensor_y; /* G-Sensor Y data */
+ u_int16 uc_sensor_z; /* G-Sensor Z data */
+} SENSORINPUT_INFO_DAT_GSENS;
+
+// TAG : LSDRV_SPEEDKMPH_DAT
+// ABSTRACT : Data Table Structure for Vehicle Speed Calculation
+typedef struct LsDrvSpeedKmph {
+ u_int8 uc_flag; /* Data storage flag */
+ u_int8 uc_sens_cnt; /* Sensor counter */
+ u_int16 us_speed_pulse; /* Vehicle speed pulse */
+ u_int8 uc_noise_flag; /* Noise flag */ /* #017 */
+ u_int8 u_reserve[3]; /* Reserved */ /* #017 */
+} LSDRV_SPEEDKMPH_DAT_DAT;
+
+typedef struct LsDrvSpeedKmphLast {
+ u_int8 uc_flag; /* Data storage flag */
+ u_int8 uc_sens_cnt; /* Sensor counter */
+ u_int16 us_speed_pulse; /* Vehicle speed pulse */
+} LSDRV_SPEEDKMPH_LAST_DAT;
+
+typedef struct LsDrvSpeedKmphDat {
+ u_int8 uc_ptr; /* Data storage pointer */
+ u_int8 uc_fstsns_rcv; /* Initial sensor data reception status */ /* #016 */
+ u_int8 uc_sns_rcv; /* Sensor data reception status */ /* #016 */
+ u_int8 uc_calc_start; /* Vehicle speed calculation start flag */ /* #016 */
+ LSDRV_SPEEDKMPH_LAST_DAT st_last_data; /* Previous vehicle speed pulse information */
+ LSDRV_SPEEDKMPH_DAT_DAT st_data[LSDRV_SPKMPH_TBL_NUM]; /* Data portion */
+} LSDRV_SPEEDKMPH_DAT;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void LineSensDrvSensor(u_int8*);
+u_int16 LineSensDrvSpeedCalc(u_int8);
+void LineSensDrvSpeedKmphDataInit(void);
+void LineSensDrvSpeedPulseSave(u_int16, u_int16, u_int8);
+u_int8 LineSensDrvCheckNoise(u_int8);
+
+u_int8 LineSensDrvGetLastSpeedPulse(u_int16*, u_int16, u_int8);
+void LineSensDrvSetLastSpeedPulse(u_int16, u_int8);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_LINESENSDRV_LINESENSDRV_SENSOR_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/inc/LineSensDrv/LineSensDrv_Thread.h b/positioning_hal/inc/LineSensDrv/LineSensDrv_Thread.h
new file mode 100755
index 0000000..54a01dc
--- /dev/null
+++ b/positioning_hal/inc/LineSensDrv/LineSensDrv_Thread.h
@@ -0,0 +1,66 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Thread.h
+*/
+
+#ifndef INC_LINESENSDRV_LINESENSDRV_THREAD_H_
+#define INC_LINESENSDRV_LINESENSDRV_THREAD_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "LineSensDrv_Api.h"
+#include "LineSensDrv_Sensor.h"
+
+/*---------------------------------------------------------------------------*/
+// Define
+
+// Return value
+#define RET_LSDRV_SUCCESS RET_NORMAL // API processing success
+#define RET_LSDRV_ERROR RET_ERROR // API processing failed
+
+/*---------------------------------------------------------------------------*/
+// Rcv Message Related
+
+// Size of data section
+#define LSDRV_RCVMSG_MSGBUF 512 // Byte count of RcvMSG data section
+
+/*---------------------------------------------------------------------------*/
+// Struct
+
+// TAG : LSDRV_RCVDATA
+// ABSTRACT : Message receive buffer structure
+typedef struct LsDrvRcvData {
+ T_APIMSG_MSGBUF_HEADER st_head; // Message header
+ u_int8 uc_data[LSDRV_RCVMSG_MSGBUF]; // Data portion
+} LSDRV_RCVDATA;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+int32 LineSensDrvMainThreadInit(HANDLE);
+void LineSensDrvParamInit(void);
+
+EFrameworkunifiedStatus LineSensDrvThread(HANDLE);
+void LineSensDrvThreadStopProcess(void);
+u_int8 LineSensDrvGetSysRecvFlag(void);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_LINESENSDRV_LINESENSDRV_THREAD_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/Common/positioning_common.cpp b/positioning_hal/src/Common/positioning_common.cpp
new file mode 100755
index 0000000..00b3a8b
--- /dev/null
+++ b/positioning_hal/src/Common/positioning_common.cpp
@@ -0,0 +1,388 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file positioning_common.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_common.h"
+#include "MDev_Gps_Common.h"
+#include "MDev_GpsRecv.h"
+#include "LineSensDrv_Thread.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define DATMOD_RETRY (3) /* Number of shared memory generation retries */
+#define DATMOD_PREINIT (0) /* Shared Memory State [Before initialization] */
+#define PRIM_NAME_MAX (32) /* Maximum Name Size */
+#define VEHICLE_SHARE_NAME ("POS_VEHICLE_SHARE_MEMORY") /* Shared memory name */
+
+/* Mask for managing various notification reception conditions */
+#define NTFY_MSK_NONE (0x00)
+/* Service availability notification */
+#define NTFY_MSK_COMMUNICATION_AVAILABILITY (0x01)
+#define NTFY_MSK_PS_COMMUSB_AVAILABILITY (0x02)
+#define NTFY_MSK_PS_PSMSHADOW_AVAILABILITY (0x04)
+#define NTFY_MSK_CLOCK_AVAILABILITY (0x08)
+#define NTFY_MSK_NS_BACKUPMGR_AVAILABILITY (0x10)
+#define NTFY_MSK_SS_DEVDETSRV_AVAILABILITY (0x20)
+/* Other Notices */
+#define NTFY_MSK_PS_PSMSHADOW_INIT_COMP (0x01) /* PSMShadow startup completion notice */
+#define NTFY_MSK_PS_LANSERVER_DEVICE_UPDATE (0x02) /* LanServer device configuration change notification */
+#define NTFY_MSK_PS_LANSERVER_WAKEUP_COMP (0x04) /* LanServer start completion notice */
+
+/* Thread state */
+#define THREAD_STS_NOEXIST (0x00)
+#define THREAD_STS_CREATING (0x01)
+#define THREAD_STS_CREATED (0x02)
+
+/*---------------------------------------------------------------------------*/
+// ENUMERATION
+
+/*---------------------------------------------------------------------------*/
+// STRUCTURE
+
+typedef struct StThreadInfo {
+ EnumTID_POS e_id; /**< Thread ID */
+ const int8_t* p_name; /**< Thread name */
+ PNO p_no; /**< Process number */
+ CbFuncPtr cb_routine; /**< Start routine */
+ uint8_t msk_available; /**< Dependent services Availability */
+ uint8_t msk_ntfy; /**< Dependent notification */
+ uint8_t msk_thread; /**< Dependent threads */
+ BOOL b_is_depended; /**< Positioning/Availability->TRUE change dependency */
+ uint8_t uc_status; /**< Thread activation state */
+ uint8_t uc_order; /**< Boot Sequence(Performance) */
+ uint8_t u_reserve[2];
+} ST_THREAD_CREATE_INFO;
+
+typedef struct {
+ char share_data_name[PRIM_NAME_MAX]; /**< Shared data name */
+ u_int32 data_size; /**< Shared data size */
+} ST_SHAREDATA;
+
+static const int8_t kThreadNamePosMain[15] = "POS_Main";
+static const int8_t kThreadNamePosSens[15] = "POS_Sens";
+static const int8_t kThreadNamePosGps[15] = "POS_Gps";
+static const int8_t kThreadNamePosGpsRecv[15] = "POS_Gps_Recv";
+static const int8_t kThreadNamePosGpsRollover[15] = "POS_Gps_Rolovr";
+
+static ST_THREAD_CREATE_INFO g_pos_thread_create_info[] = {
+ { /* POS_Main */
+ ETID_POS_MAIN, /* (1) */
+ NULL, /* (2) */
+ 0, /* (3) */
+ NULL, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ 0, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* POS_sens */
+ ETID_POS_SENS, /* (1) */
+ kThreadNamePosSens, /* (2) */
+ PNO_LINE_SENS_DRV, /* (3) */
+ &LineSensDrvThread, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ 0, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* POS_Gps */
+ ETID_POS_GPS, /* (1) */
+ kThreadNamePosGps, /* (2) */
+ PNO_NAVI_GPS_MAIN, /* (3) */
+ &DevGpsMainThread, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ 0, /* (7) */
+ TRUE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* POS_Gps_Recv */
+ ETID_POS_GPS_RECV, /* (1) */
+ kThreadNamePosGpsRecv, /* (2) */
+ PNO_NAVI_GPS_RCV, /* (3) */
+ &DevGpsRecvThread, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ THREAD_STS_MSK_POS_GPS, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* POS_Gps_Rolovr */
+ ETID_POS_GPS_ROLLOVER, /* (1) */
+ NULL, /* (2) */
+ 0, /* (3) */
+ NULL, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ 0, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Termination */
+ ETID_POS_MAX, /* (1) */
+ NULL, /* (2) */
+ 0, /* (3) */
+ NULL, /* (4) */
+ NTFY_MSK_NONE, /* (5) */
+ NTFY_MSK_NONE, /* (6) */
+ 0, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+};
+
+static ST_SHAREDATA g_sharedata_tbl[] = {
+ /* Shared data name to be generated, Shared data size */
+ { {VEHICLE_SHARE_NAME}, 512 * 11 }, /* Vehicle sensor information acquisition */
+#if 0 /* Not used in _CWORD71_ below */
+ { {"SENSOR_SHARE_MEMORY"}, 512 * 11 }, /* Vehicle sensor information Pkg acquisition */
+ { {"GPS_INT_SIGNAL_SHARE_MEMORY"}, 4 }, /* GPS interrupt signal acquisition */
+ { {"LOG_SETTING_SHARE_MEMORY"}, 36 }, /* DR feature log acquisition */
+ { {"GYRO_CONNECT_STTS_SHARE_MEMORY"}, 4 }, /* Gyro connection status acquisition */
+ { {"EPHEMERIS_NUM_SHARE_MEMORY"}, 4 }, /* Effective ephemeris count acquisition at shutdown */
+ { {"LOCALTIME_SHARE_MEMORY"}, 12 }, /* Local time acquisition at shutdown */
+ { {"LONLAT_SHARE_MEMORY"}, 8 }, /* Location acquisition at shutdown */
+#endif
+ { {(int8)NULL}, 0 } /* Termination */
+};
+
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+static EFrameworkunifiedStatus PosStopThreadDummy(HANDLE h_app) {
+ return eFrameworkunifiedStatusOK;
+}
+
+static uint32_t PosGetMsg(HANDLE h_app, void** p_buf, uint32_t ul_size) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ uint32_t tmp_size = 0;
+ void* p_rev_buf = NULL;
+
+ if ((h_app == NULL) || (p_buf == NULL)) {
+ POSITIONING_LOG("Argument ERROR!! [h_app = %p, pBuf = %p]", h_app , p_buf);
+ } else {
+ /* Check the size of received data */
+ tmp_size = FrameworkunifiedGetMsgLength(h_app);
+ if (tmp_size > ul_size) {
+ POSITIONING_LOG("Message ul_size ERROR!! [tmp_size = %d, maxsize = %d]", tmp_size, ul_size);
+ tmp_size = 0;
+ } else {
+ /* Obtain data */
+ e_status = FrameworkunifiedGetDataPointer(h_app, &p_rev_buf);
+
+ if (e_status == eFrameworkunifiedStatusOK) {
+ *p_buf = p_rev_buf;
+ } else if (e_status == eFrameworkunifiedStatusInvldBufSize) {
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, *p_buf, tmp_size);
+
+ if (e_status != eFrameworkunifiedStatusOK) {
+ POSITIONING_LOG("FrameworkunifiedGetMsgDataOfSize ERROR [e_status:%d]", e_status);
+ tmp_size = 0;
+ }
+ } else {
+ POSITIONING_LOG("FrameworkunifiedGetDataPointer ERROR [e_status:%d]", e_status);
+ tmp_size = 0;
+ }
+ }
+ }
+
+ return tmp_size;
+}
+
+static void PosCreateSharedMemory(void) {
+ RET_API ret_api = RET_NORMAL;
+ void *mod_exec_dmy; /* Module data pointer(dummy) */
+ int retry; /* Retry counter */
+ ST_SHAREDATA *p_shm_tbl;
+
+ /* Configure Shared Data Generating Tables */
+ p_shm_tbl = g_sharedata_tbl;
+
+ while (*(p_shm_tbl->share_data_name) != (int8)NULL) {
+ for (retry = 0; retry < DATMOD_RETRY; retry++) {
+ /* Shared Memory Generation */
+ ret_api = _pb_CreateShareData(p_shm_tbl->share_data_name, p_shm_tbl->data_size, &mod_exec_dmy);
+ if (ret_api == RET_NORMAL) {
+ /* Set the shared memory status flag to "Before initialization (0)" */
+ *reinterpret_cast<u_int32 *>(mod_exec_dmy) = DATMOD_PREINIT;
+ break;
+ } else {
+ /* Error Handling */
+ POSITIONING_LOG("_pb_CreateShareData ERROR [ret_api:%d]", ret_api);
+ }
+ }
+
+ if (retry >= DATMOD_RETRY) {
+ POSITIONING_LOG("_pb_CreateShareData failed more %d times.", DATMOD_RETRY);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ /* Next shared memory generation */
+ p_shm_tbl++;
+ }
+ return;
+}
+
+EFrameworkunifiedStatus PosInitialize(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ RET_API ret_api;
+ ret_api = _pb_Setup_CWORD64_API(h_app);
+ if (ret_api != RET_NORMAL) {
+ POSITIONING_LOG("_pb_Setup_CWORD64_API ERROR!! [ret_api = %d]", ret_api);
+
+ e_status = eFrameworkunifiedStatusFail;
+ } else {
+ PosCreateSharedMemory();
+ }
+ return e_status;
+}
+
+/**
+ * @brief
+ * Common processing after thread startup
+ *
+ * Thread naming, message queue creation, thread startup response
+ *
+ * @param[in] h_app Application handle
+ * @param[in] eTid Thread ID
+ *
+ * @return Thread startup mode
+ */
+EnumSetupMode_POS PosSetupThread(HANDLE h_app, EnumTID_POS e_tid) {
+ RET_API ret = RET_NORMAL;
+ ST_THREAD_CREATE_INFO* p_thread_info = g_pos_thread_create_info;
+ ST_THREAD_CREATE_INFO* p_info = p_thread_info + e_tid;
+ ST_THREAD_SETUP_INFO st_setup_info;
+ ST_THREAD_SETUP_INFO* pst_setup_info = &st_setup_info;
+ /* Application handle setting */
+ _pb_SetAppHandle(h_app);
+ /* Create Message Queue */
+ _pb_CreateMsg(p_info->p_no);
+ /* Get thread startup information */
+ pst_setup_info->mode = EPOS_SETUP_MODE_NORMAL;
+ (void)PosGetMsg(h_app, reinterpret_cast<void**>(&pst_setup_info), sizeof(ST_THREAD_SETUP_INFO));
+
+ POSITIONING_LOG("[mode = %d]", pst_setup_info->mode);
+
+ /* Issue thread creation completion notice */
+ ret = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_THREAD_CREATE_COMP,
+ sizeof(EnumTID_POS),
+ reinterpret_cast<const void*>(&e_tid),
+ 0);
+
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("_pb_SndMsg_Ext ERROR!! [ret = %d]", ret);
+ }
+
+ return pst_setup_info->mode;
+}
+
+/**
+ * @brief
+ * Common processing at thread stop
+ *
+ * Thread stop response, thread destruction
+ *
+ * @param[in] e_tid Thread ID
+ */
+void PosTeardownThread(EnumTID_POS e_tid) {
+ RET_API e_ret = RET_NORMAL;
+ ST_THREAD_CREATE_INFO* p_thread_info = g_pos_thread_create_info;
+
+ (p_thread_info + e_tid)->uc_status = THREAD_STS_NOEXIST;
+ /* Issue thread stop completion notice */
+ e_ret = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_THREAD_STOP_COMP,
+ sizeof(EnumTID_POS),
+ reinterpret_cast<const void*>(&e_tid),
+ 0);
+
+ if (e_ret != RET_NORMAL) {
+ POSITIONING_LOG("_pb_SndMsg_Ext ERROR!! [e_ret = %d]", e_ret);
+ }
+
+ /* Thread destruction */
+ _pb_ExitThread((DWORD)0);
+
+ return;
+}
+
+/**
+ * @brief
+ * Positioning in-process thread creation
+ *
+ * @param[in] hApp Application handle
+ */
+EFrameworkunifiedStatus PosCreateThread(HANDLE h_app, int8_t index) {
+ HANDLE thread_handle;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ ST_THREAD_CREATE_INFO* p_thread_info = g_pos_thread_create_info;
+
+ p_thread_info += index;
+
+ static EnumSetupMode_POS g_setup_mode;
+
+ if (NULL == h_app) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ if (index < ETID_POS_MAX) {
+ if ((p_thread_info->uc_status == THREAD_STS_NOEXIST) && (p_thread_info->cb_routine != NULL)) {
+ /* Thread creation */
+ thread_handle = FrameworkunifiedCreateChildThread(h_app,
+ (PCSTR)(p_thread_info->p_name),
+ p_thread_info->cb_routine,
+ &PosStopThreadDummy);
+
+ if (thread_handle == NULL) {
+ POSITIONING_LOG("FrameworkunifiedCreateChildThread ERROR!! [tHandle=%p]", thread_handle);
+ } else {
+ e_status = FrameworkunifiedStartChildThread(h_app,
+ thread_handle,
+ sizeof(EnumSetupMode_POS),
+ &g_setup_mode);
+
+ if (e_status != eFrameworkunifiedStatusOK) {
+ POSITIONING_LOG("FrameworkunifiedStartChildThread ERROR!! [e_status=%d, name=%s]", e_status, p_thread_info->p_name);
+ } else {
+ p_thread_info->uc_status = THREAD_STS_CREATING;
+ POSITIONING_LOG("name=%s\n", p_thread_info->p_name);
+ }
+ }
+ }
+ }
+ return e_status;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/Common/positioning_hal.cpp b/positioning_hal/src/Common/positioning_hal.cpp
new file mode 100755
index 0000000..94f79c4
--- /dev/null
+++ b/positioning_hal/src/Common/positioning_hal.cpp
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file positioning_hal.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include <stdio.h>
+
+#include "positioning_hal.h"
+#include "positioning_def.h"
+#include "positioning_common.h"
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+EFrameworkunifiedStatus StartGpsMainThreadPositioning(HANDLE h_app) {
+ return PosCreateThread(h_app, ETID_POS_GPS);
+}
+
+EFrameworkunifiedStatus StartGpsRecvThreadPositioning(HANDLE h_app) {
+ return PosCreateThread(h_app, ETID_POS_GPS_RECV);
+}
+
+EFrameworkunifiedStatus StartLineSensorThreadPositioning(HANDLE h_app) {
+ return PosCreateThread(h_app, ETID_POS_SENS);
+}
+
+EFrameworkunifiedStatus StartGpsRolloverThreadPositioning(HANDLE h_app) {
+ return eFrameworkunifiedStatusErrOther;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/GpsCommon/MDev_GpsRecv.cpp b/positioning_hal/src/GpsCommon/MDev_GpsRecv.cpp
new file mode 100755
index 0000000..13159b4
--- /dev/null
+++ b/positioning_hal/src/GpsCommon/MDev_GpsRecv.cpp
@@ -0,0 +1,608 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_GpsRecv.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "MDev_GpsRecv.h"
+#include "MDev_Gps_Common.h"
+#include "positioning_common.h"
+#include "MDev_Gps_API.h"
+//extern "C" {
+//#include <stub/gps_mng_api.h>
+//}
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+#define FTEN_DRIVER 0
+#define TEST_HAL2
+
+#if FTEN_DRIVER
+static GpsMngApiObj g_gps_mng_obj;
+#endif
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_RecvThread
+ * ABSTRACT : GPS communication management reception thread
+ * FUNCTION : GPS communication management reception thread main
+ * ARGUMENT : PVOID pv....Thread creation arguments
+ * NOTE : -
+ * RETURN : TRUE
+ ******************************************************************************/
+EFrameworkunifiedStatus DevGpsRecvThread(HANDLE h_app) {
+ int32 ret = GPS_RCV_RET_NML;
+ int32 gps_ret = 0;
+ BOOL* p_thread_stop_req = &g_gps_rcv_thread_stop;
+
+ (void)PosSetupThread(h_app, ETID_POS_GPS_RECV);
+
+ /* Initializing process */
+ DevGpsRecvInit();
+
+#if FTEN_DRIVER
+ gps_ret = GpsMngApiOpen(&g_gps_mng_obj);
+ if (gps_ret != GPS_CTL_RET_SUCCESS) {
+ printf("[For test] GpsMngApiOpen open failed\n");
+ }
+#endif
+
+ while (1) {
+ /* Thread stop request is received */
+ if (TRUE == *p_thread_stop_req) {
+ /* Thread stop processing */
+ DevGpsRecvThreadStopProcess();
+ }
+
+ ret = DevGpsRecvReadRcvData(&g_gps_rcvdata);
+
+ if (GPS_RCV_RET_NML == ret) {
+ /* For reception (normal) */
+ DevGpsRecvRcvNormal();
+ }
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Recv_Init
+ * ABSTRACT : Receive thread initialization processing
+ * FUNCTION : Initialize the receive thread
+ * ARGUMENT : -
+ * NOTE : -
+ * RETURN : -
+ ******************************************************************************/
+void DevGpsRecvInit(void) {
+ /* Clears the receive buffer */
+ DevGpsRecvClrRcvBuf();
+
+ /* Clear receive error count */
+ g_wrecv_err = 0;
+
+ return;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Recv_ClrRcvBuf
+ * ABSTRACT : Buffer clear processing
+ * FUNCTION : Clears the receive buffer for serial reception.
+ * ARGUMENT : -
+ * NOTE : -
+ * RETURN : -
+ ******************************************************************************/
+void DevGpsRecvClrRcvBuf(void) {
+ /*-----------------------------------------------------------------------*/
+ /* Clear serial receive data storage buffer */
+ /*-----------------------------------------------------------------------*/
+ memset(&g_gps_rcvdata, 0, sizeof(TG_GPS_RECV_RcvData));
+
+ /*-----------------------------------------------------------------------*/
+ /* Clear receive data storage buffer */
+ /*-----------------------------------------------------------------------*/
+ memset(&g_gps_rcvbuf, 0, sizeof(TG_GPS_RECV_RcvBuf));
+
+ /*-----------------------------------------------------------------------*/
+ /* Clear analysis data buffer */
+ /*-----------------------------------------------------------------------*/
+ memset(&g_gps_ana_databuf, 0, sizeof(TG_GPS_RECV_AnaDataBuf));
+
+ /*-----------------------------------------------------------------------*/
+ /* Clear receive frame buffer */
+ /*-----------------------------------------------------------------------*/
+ memset(&g_gps_rcv_framebuf, 0, sizeof(TG_GPS_RECV_RcvFrameBuf));
+}
+
+/*******************************************************************************
+ * MODULE : DevGpsRecvJudgeStartSeqence
+ * ABSTRACT : Start sequence determination process
+ * FUNCTION : Determine whether or not the beginning of the data is the start sequence of the _CWORD82_ command
+ * ARGUMENT : const u_char *buf_p ... Pointer to analysis data
+ * u_int16 ana_size ... Size of data to be analyzed
+ * NOTE :
+ * RETURN : GPS__CWORD82__RET_START_SEQ_NONE ... No start sequence
+ * GPS__CWORD82__RET_START_SEQ_NMEA ... NMEA Start Sequences
+ * GPS__CWORD82__RET_START_SEQ_FULL ... Full Customization Start Sequence
+ ******************************************************************************/
+static int32 DevGpsRecvJudgeStartSeqence(const u_char *buf_p, u_int16 ana_size) {
+ int32 ret = GPS__CWORD82__RET_START_SEQ_NONE;
+
+ if ((ana_size >= 1) && (buf_p[0] == 0x24u)) {
+ /* Ignore -> No applicable rules for MISRA-C */ /* 0x24: '$' QAC 285 */
+ ret = GPS__CWORD82__RET_START_SEQ_NMEA;
+ } else if ((ana_size >= 1) && (buf_p[0] == 0xB0)) {
+ ret = GPS__CWORD82__RET_START_SEQ_FULL;
+ } else if ((ana_size >= 1) && (buf_p[0] == 0xC6)) {
+ /* #GPF_60_024 */
+ ret = GPS__CWORD82__RET_START_SEQ_BIN;
+ } else if ((ana_size >= 1) && (buf_p[0] == 0xB5)) {
+ /* #GPF_60_024 */
+ ret = GPS_UBLOX_RET_START_SEQ_UBX;
+ } else {
+ ret = GPS__CWORD82__RET_START_SEQ_NONE;
+ }
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Recv_SearchFrameData
+ * ABSTRACT : Frame detection processing
+ * FUNCTION : Find if a frame exists in the data
+ * ARGUMENT : TG_GPS_RECV_AnaDataBuf *adbuf_p ... Pointer to the analysis data storage buffer
+ * u_int16 *ana_size; ... Analysis completion data size
+ * NOTE : Since it is assumed that the beginning of the frame is stored in the analysis start offset,
+ * when the beginning of the frame is detected in the middle of the buffer,
+ * the processing is terminated with the data up to that point as abnormal format data.
+ * RETURN : GPS_RCV_FRMSRCH_ERR_FORMAT ... Frame format error
+ * GPS_RCV_FRMSRCH_FIXED ... Frame determination
+ * GPS_RCV_FRMSRCH_NOT_FIXED ... Frame undetermined
+ * GPS_RCV_FRMSRCH_NO_DATA ... No analysis data
+ ******************************************************************************/
+int32 DevGpsRecvSearchFrameData(const TG_GPS_RECV_AnaDataBuf *adbuf_p, u_int16 *ana_size) {
+ int32 ret = GPS_RCV_FRMSRCH_ERR_FORMAT; /* Return value(Frame format error) */
+ /* ++ GPS _CWORD82_ support */
+ int32 start_seq_type = GPS__CWORD82__RET_START_SEQ_NONE; /* Fully customized or NMEA */
+ /* -- GPS _CWORD82_ support */
+ u_int16 start_offset = 0; /* Analysis start offset */
+ u_int16 i = 0;
+ u_int16 d_size = 0; /* Unanalyzed data size */
+
+ /* Offset Initialization */
+ start_offset = adbuf_p->offset; /* Start of analysis */ /* Ignore -> No applicable rules for MISRA-C */
+
+ /* Setting of unanalyzed data size */
+ d_size = adbuf_p->datsize - start_offset;
+
+ /* For size 0 */
+ if (d_size == 0) {
+ /* No analysis data */
+ ret = GPS_RCV_FRMSRCH_NO_DATA;
+ /* Set the analysis completion size to 0. */
+ *ana_size = 0; /* Ignore -> No applicable rules for MISRA-C */
+ } else {
+ /* Since it is assumed that beginning of the frame is stored in the analysis start offset, */
+ /* determine if the start sequence is the first one. */
+
+ /* ++ GPS _CWORD82_ support */
+ start_seq_type = DevGpsRecvJudgeStartSeqence(&(adbuf_p->datbuf[start_offset]), d_size);
+
+ if (start_seq_type != GPS__CWORD82__RET_START_SEQ_NONE) {
+ /* -- GPS _CWORD82_ support */
+ /* Set the frame as undetermined */
+ ret = GPS_RCV_FRMSRCH_NOT_FIXED;
+
+ /* ++ GPS _CWORD82_ support */
+ /* Find end sequence */
+ if (start_seq_type == GPS__CWORD82__RET_START_SEQ_NMEA) {
+ for (i = 0; i < d_size; i++) {
+ if (adbuf_p->datbuf[(start_offset + i)] == 0x0A) {
+ /* If the end sequence is found, */
+ /* end as frame fix. */
+ ret = GPS_RCV_FRMSRCH_FIXED;
+
+ /* Set the frame size for the analysis completion size. */
+ *ana_size = i + 1;
+
+ break;
+ }
+ }
+
+ if (i == d_size) {
+ if (i >= GPS__CWORD82__CMD_LEN_MAX) {
+ /* If no end sequence is found, */
+ /* frame format error. */
+ ret = GPS_RCV_FRMSRCH_ERR_FORMAT;
+ /* After that, searching for start sequence. */
+ } else {
+ /* Because the end sequence cannot be analyzed, */
+ /* frame undetermined. */
+ ret = GPS_RCV_FRMSRCH_NOT_FIXED;
+
+ /* Set the size of unanalyzed data for the analysis completion size. */
+ *ana_size = d_size;
+ }
+ }
+ } else if (start_seq_type == GPS__CWORD82__RET_START_SEQ_FULL) {
+ /* #GPF_60_024 */
+ /* Is there one frame of data for full customization information? */
+ if (d_size >= GPS__CWORD82__FULLBINARY_LEN) {
+ /* Is there an end sequence? */
+ if (adbuf_p->datbuf[( (start_offset + GPS__CWORD82__FULLBINARY_LEN) - 1)] == 0xDA) {
+ /* Ignore -> MISRA-C:2004 Rule 12.1 */
+ /* If an end sequence is found, */
+ /* end as frame fix. */
+ ret = GPS_RCV_FRMSRCH_FIXED;
+
+ /* Set the frame size for the analysis completion size. */
+ *ana_size = GPS__CWORD82__FULLBINARY_LEN;
+ } else {
+ /* If it is not an end sequence, */
+ /* frame format error. */
+ ret = GPS_RCV_FRMSRCH_ERR_FORMAT;
+ /* Searching for Start Sequence */
+ }
+ } else {
+ /* Because the end sequence cannot be analyzed, */
+ /* frame undetermined. */
+ ret = GPS_RCV_FRMSRCH_NOT_FIXED;
+
+ /* Set the size of unanalyzed data for the analysis completion size. */
+ *ana_size = d_size;
+ }
+ } else if (start_seq_type == GPS__CWORD82__RET_START_SEQ_BIN) {
+ /* Is there data for one standard binary frame? */
+ if (d_size >= GPS__CWORD82__NORMALBINARY_LEN) {
+ /* Is there an end sequence? */
+ if (adbuf_p->datbuf[((start_offset + GPS__CWORD82__NORMALBINARY_LEN) - 1)] == 0xDA) {
+ /* Ignore -> MISRA-C:2004 Rule 12.1 */
+ /* If an end sequence is found, */
+ /* end as frame fix. */
+ ret = GPS_RCV_FRMSRCH_FIXED;
+
+ /* Set the frame size for the analysis completion size. */
+ *ana_size = GPS__CWORD82__NORMALBINARY_LEN;
+ } else {
+ /* If it is not an end sequence, */
+ /* frame format error. */
+ ret = GPS_RCV_FRMSRCH_ERR_FORMAT;
+ /* Searching for Start Sequence */
+ }
+ } else {
+ /* Because the end sequence cannot be analyzed, */
+ /* frame undetermined. */
+ ret = GPS_RCV_FRMSRCH_NOT_FIXED;
+
+ /* Set the size of unanalyzed data for the analysis completion size. */
+ *ana_size = d_size;
+ }
+ } else if (start_seq_type == GPS_UBLOX_RET_START_SEQ_UBX) {
+ /* TODO Checksum calculation using data from start_offset to d_size */
+ /* TODO Check that the checksum is correct. (See test code.) */
+ /* If the if checksums match, */
+ /* end as frame fix. */
+ ret = GPS_RCV_FRMSRCH_FIXED;
+
+ /* Set the frame size for the analysis completion size. */
+ *ana_size = d_size;
+ } else {
+ }
+ /* -- #GPF_60_024 */
+ } else {
+ /* It is not a start sequence, so it is regarded as a frame format error. */
+ ret = GPS_RCV_FRMSRCH_ERR_FORMAT;
+
+ /* After that, searching for Start Sequence. */
+ }
+
+ /* If the frame format is abnormal, search for the start sequence. */
+ if (ret == GPS_RCV_FRMSRCH_ERR_FORMAT) {
+ POSITIONING_LOG("FORMAT ERROR [start_seq_type:%d]\n", start_seq_type);
+
+ /* Assuming that the start sequence has not been found until the end, */
+ /* the size of the analysis completed is set as the size of the unanalyzed data. */
+ *ana_size = d_size;
+
+ /* ++ GPS _CWORD82_ support (Search from the second byte for safety (at least the first byte is checked at the beginning of the function)))*/
+ for (i = start_offset + 1; i < (u_int32)(start_offset + d_size); i++) {
+ /* for( i = (start_offset + 2); i < (u_int32)(start_offset + d_size); i++ ) */
+ /* -- GPS _CWORD82_ support */
+ /* Start Sequence? */
+ /* ++ GPS _CWORD82_ support */
+ if (DevGpsRecvJudgeStartSeqence(&(adbuf_p->datbuf[i]), d_size) != GPS__CWORD82__RET_START_SEQ_NONE) {
+ /* if( (adbuf_p->datbuf[(i-1)] == GPS_CODE_START_SQ_HI) && */
+ /* (adbuf_p->datbuf[i] == GPS_CODE_START_SQ_LOW) ) */
+ /* -- GPS _CWORD82_ support */
+ /* In the case of a start sequence, the analysis is completed before that. #01 */
+ *ana_size = (i - start_offset - 1);
+
+ break;
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Recv_ReadRcvData
+ * ABSTRACT : Data reception processing
+ * FUNCTION : Read serial data
+ * ARGUMENT : TG_GPS_RECV_RcvData* pst_rcv_data : Receive data read buffer
+ * NOTE : -
+ * RETURN : T_ErrCodes Error code
+ * MCSUB_NML Normal
+ * MCCOM_ERR_SYSTEM Abnormality
+ ******************************************************************************/
+int32 DevGpsRecvReadRcvData(TG_GPS_RECV_RcvData* pst_rcv_data) {
+ int32 ret = GPS_RCV_RET_ERR;
+ INT32 gps_ret = 0;
+
+#if FTEN_DRIVER
+ static int msg_kind = GPS_RCV_NMEA_GGA;
+
+ // Serial data capture
+ GpsMngApiDat gps_mng_data;
+
+ memset(&gps_mng_data, 0, sizeof(gps_mng_data));
+#ifdef TEST_HAL2
+ if (msg_kind > GPS_RCV_NMEA_RMC) {
+ msg_kind = GPS_RCV_NMEA_GGA;
+ }
+#else
+ if (msg_kind == GPS_RCV_NMEA_GGA) {
+ msg_kind = GPS_RCV_NMEA_RMC;
+ } else if (msg_kind == GPS_RCV_NMEA_RMC) {
+ msg_kind = GPS_RCV_NMEA_GGA;
+ } else {
+ msg_kind = GPS_RCV_NMEA_GGA;
+ }
+#endif
+
+ gps_ret = GpsMngApiGetRcvMsg(&g_gps_mng_obj, msg_kind, &gps_mng_data);
+
+#ifdef TEST_HAL2
+ msg_kind++;
+#endif
+
+ pst_rcv_data->us_read_size = (u_int16)gps_mng_data.dataLength;
+
+ if (pst_rcv_data->us_read_size >= GPS_RCV_MAXREADSIZE) {
+ return GPS_RCV_RET_ERR_SYSTEM;
+ }
+
+ memcpy(pst_rcv_data->uc_read_data, gps_mng_data.data, pst_rcv_data->us_read_size);
+
+ // Add '\0'
+ pst_rcv_data->uc_read_data[pst_rcv_data->us_read_size] = '\0';
+
+ if (GPS_CTL_RET_SUCCESS != gps_ret) {
+ ret = GPS_RCV_RET_ERR_SYSTEM;
+ } else {
+ ret = GPS_RCV_RET_NML;
+ }
+#endif
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Recv_RcvNormal
+ * ABSTRACT : Receive (normal) Receive processing
+ * FUNCTION : Receive (normal) Processing at event reception
+ * ARGUMENT : -
+ * NOTE :
+ * RETURN : -
+ ******************************************************************************/
+void DevGpsRecvRcvNormal(void) {
+ TG_GPS_RECV_RcvData* pst_rcv_data = NULL; /* Buffer for reading serial data */
+ TG_GPS_RECV_RcvBuf* pst_rcv_buf = NULL; /* Receive data storage buffer */
+ TG_GPS_RECV_AnaDataBuf* pst_ana_data_buf = NULL; /* Analysis data storage buffer */
+ TG_GPS_RECV_RcvFrameBuf* pst_rcv_frame_buf = NULL; /* Receive frame buffer */
+ int32 i_ret = 0; /* Frame Detection Result */
+ u_int16 ana_size = 0; /* Data analysis size storage */
+
+ /* Initializing process */
+ pst_ana_data_buf = &g_gps_ana_databuf;
+
+ /* Fast _CWORD71_ processing(memset fix) */
+ /* Initializes the offset that needs initialization in the receive data storage buffer. */
+ pst_ana_data_buf->offset = 0;
+
+ /* Serial continuous reception data analysis processing */
+ pst_rcv_data = &g_gps_rcvdata;
+ pst_rcv_buf = &g_gps_rcvbuf;
+ memcpy(&(pst_ana_data_buf->datbuf[0]), &(pst_rcv_buf->r_buf[0]), pst_rcv_buf->r_size);
+ memcpy(&(pst_ana_data_buf->datbuf[pst_rcv_buf->r_size]),
+ &(pst_rcv_data->uc_read_data[0]),
+ pst_rcv_data->us_read_size);
+
+ pst_ana_data_buf->datsize = pst_rcv_buf->r_size + pst_rcv_data->us_read_size;
+
+ /* Serial receive data analysis process */
+ do {
+ /* Frame detection processing */
+ i_ret = DevGpsRecvSearchFrameData(pst_ana_data_buf, &ana_size);
+
+ /* For frame determination */
+ if (i_ret == GPS_RCV_FRMSRCH_FIXED) {
+ /* Frames are stored in the receive frame buffer. */
+ pst_rcv_frame_buf = &g_gps_rcv_framebuf;
+ memset(pst_rcv_frame_buf, 0, sizeof(TG_GPS_RECV_RcvFrameBuf)); /* Ignore -> No applicable rules for MISRA-C */
+ /* Ignore -> No applicable rules for MISRA-C */ /* QAC 3200 */
+ memcpy(& (pst_rcv_frame_buf->buf[0]),
+ &(pst_ana_data_buf->datbuf[pst_ana_data_buf->offset]),
+ ana_size);
+ pst_rcv_frame_buf->size = ana_size;
+
+ /* Reception of the command */
+ /* Send receipt notice (command) to main thread */
+ /* Send Received Data to Main Thread */
+ DevGpsRecvSndRcvData(pst_rcv_frame_buf);
+ } else if (i_ret == GPS_RCV_FRMSRCH_NOT_FIXED) {
+ /* Store unconfirmed data in the received data storage buffer, */
+ /* and leave no unanalyzed data. */
+ memset(pst_rcv_buf, 0, sizeof(TG_GPS_RECV_RcvBuf)); /* Ignore -> No applicable rules for MISRA-C */
+ memcpy(& (pst_rcv_buf->r_buf[0]),
+ &(pst_ana_data_buf->datbuf[pst_ana_data_buf->offset]),
+ ana_size);
+ pst_rcv_buf->r_size = ana_size;
+ i_ret = GPS_RCV_FRMSRCH_NO_DATA;
+ } else if (i_ret == GPS_RCV_FRMSRCH_ERR_FORMAT) {
+ /* [Measures against resetting with 1S + _CWORD82_]From here */
+ /* Clears the unanalyzed data stored in the receive data storage buffer, */
+ /* and flag is set to "No Unparsed Data" so that data can be parsed from the beginning of the next. */
+ memset(&(pst_rcv_buf->r_buf[0]), 0, pst_rcv_buf->r_size);
+ pst_rcv_buf->r_size = 0;
+ i_ret = GPS_RCV_FRMSRCH_NO_DATA;
+ /* [Measures against resetting with 1S + _CWORD82_]Up to this point */
+ /* Since this section discards garbage data, */
+ /* not subject to diagnosis registration. */
+ /* Diagnosis registration check */
+ } else if (i_ret == GPS_RCV_FRMSRCH_NO_DATA) {
+ /* Ignore -> No applicable rules for MISRA-C */
+ memset(pst_rcv_buf, 0, sizeof(TG_GPS_RECV_RcvBuf));
+ /* Termination */
+ } else {
+ /* No unanalyzed data is assumed because it is impossible. */
+ i_ret = GPS_RCV_FRMSRCH_NO_DATA;
+
+ /* Ignore -> No applicable rules for MISRA-C */
+ memset(pst_rcv_buf, 0, sizeof(TG_GPS_RECV_RcvBuf));
+ }
+
+ /* Update analysis data offset */
+ pst_ana_data_buf->offset += ana_size;
+
+ /* Repeat until no unanalyzed data is found. */
+ } while (i_ret != GPS_RCV_FRMSRCH_NO_DATA);
+}
+
+/********************************************************************************
+ * MODULE : DEV_RcvDATA
+ * ABSTRACT : Acknowledgement
+ * FUNCTION : Send message notifications to the communication management thread
+ * ARGUMENT : TG_GPS_RCV_DATA *ptg_rcv_data....I/F information between the receiving thread
+ * and the communication management thread
+ * NOTE :
+ * RETURN : RET_API :RET_NORMAL:Normal completion
+ * :RET_ERROR:ABENDs
+ ********************************************************************************/
+RET_API DevRcvData(const TG_GPS_RCV_DATA* ptg_rcv_data) {
+ RET_API ret = RET_NORMAL; /* Return value */
+ u_int16 w_size = 0; /* Data length setting */
+ u_int16 w_all_len = 0; /* Sent message length */
+ u_int16 w_mode = 0; /* Mode information */
+ RID req_id = 0; /* Resources ID */
+ T_APIMSG_MSGBUF_HEADER tg_header; /* Message header */
+
+ // Initialzie struct
+ memset(&tg_header, 0, sizeof(tg_header));
+
+ /* Transmitting buffer */
+ u_int8 by_snd_buf[(sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(TG_GPS_RCV_DATA))];
+
+ /* Calculation of transmission data length */
+ w_size = ptg_rcv_data->bydata_len + sizeof(ptg_rcv_data->dwret_status) + sizeof(ptg_rcv_data->bydata_len);
+
+ /* <<Creation of message header section>>>> */
+ tg_header.signo = 0; /* Signal information setting */
+ tg_header.hdr.sndpno = PNO_NAVI_GPS_RCV; /* Source thread No. setting */
+ tg_header.hdr.respno = 0; /* Destination process No. */
+ tg_header.hdr.cid = CID_GPS_RECVDATA; /* Command ID setting */
+ tg_header.hdr.msgbodysize = w_size; /* Message data length setting */
+ tg_header.hdr.rid = req_id; /* Resource ID Setting */
+ tg_header.hdr.reserve = 0; /* Reserved area clear */
+
+ memcpy(&by_snd_buf[ 0 ], &tg_header, sizeof(T_APIMSG_MSGBUF_HEADER));
+ /* <<Creation of data section>> */
+ /* Copy data to send buffer */
+ memcpy(&by_snd_buf[ sizeof(T_APIMSG_MSGBUF_HEADER)], ptg_rcv_data, w_size);
+
+ /* <<Messaging>> */
+ /* Calculation of Sent Message Length */
+ w_all_len = w_size + sizeof(T_APIMSG_MSGBUF_HEADER);
+
+ /* Mode information(Reserved) */
+ w_mode = 0;
+
+ /* Message transmission request */
+ ret = _pb_SndMsg(PNO_NAVI_GPS_MAIN, w_all_len, reinterpret_cast<void*>(by_snd_buf), w_mode);
+
+ /* End of the process */
+ return ret;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Recv_SndRcvData
+ * ABSTRACT : Receive data transmission processing
+ * FUNCTION : Transmit received data
+ * ARGUMENT : TG_GPS_RECV_RcvFrameBuf *frame_baf Receive frame buffer pointer
+ * NOTE : Fetches a command from the receive frame buffer and
+ * issue received data notifications to the main thread
+ * RETURN : None
+ ********************************************************************************/
+void DevGpsRecvSndRcvData(const TG_GPS_RECV_RcvFrameBuf* p_frame_buf) {
+ TG_GPS_RCV_DATA tg_rcv_data;
+ u_int16 w_cmd_len = 0;
+
+ // Initialzie struct
+ memset(&tg_rcv_data, 0, sizeof(tg_rcv_data));
+
+ if (p_frame_buf != NULL) {
+ w_cmd_len = p_frame_buf->size;
+
+ if (w_cmd_len <= GPS_READ_LEN) {
+ /* Ignore -> No applicable rules for MISRA-C */
+ memset(&tg_rcv_data, 0, sizeof(TG_GPS_RCV_DATA));
+
+ /* Status Settings */
+ tg_rcv_data.dwret_status = GPS_RECVOK;
+
+ /* Command length setting */
+ tg_rcv_data.bydata_len = w_cmd_len;
+
+ /* Receive data setting */
+ /* Sending from the Beginning of the Sirf Binary #03 */
+ memcpy(&tg_rcv_data.bygps_data[0], &p_frame_buf->buf[0], w_cmd_len);
+
+ /* Issuance of reception notice */
+ DevRcvData(&tg_rcv_data); /* Ignore -> No applicable rules for MISRA-C */
+ }
+ }
+}
+
+/**
+ * @brief
+ * Pos_Gps_Recv Thread Stop Processing
+ */
+void DevGpsRecvThreadStopProcess(void) {
+#if FTEN_DRIVER
+ GpsMngApiClose(&g_gps_mng_obj);
+#endif
+ PosTeardownThread(ETID_POS_GPS_RECV);
+ return;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/GpsCommon/MDev_GpsRollOver.cpp b/positioning_hal/src/GpsCommon/MDev_GpsRollOver.cpp
new file mode 100755
index 0000000..62227c2
--- /dev/null
+++ b/positioning_hal/src/GpsCommon/MDev_GpsRollOver.cpp
@@ -0,0 +1,275 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_GpsRollOver.cpp
+*/
+
+#include "MDev_GpsRollOver.h"
+
+#define TIM_ROLOVR_CALCORCNT_DAYS (1024 * 7) /*1024 weeks * 7 days */
+
+#define TMT_OK (1) /* Definition indicating normal status */
+#define TMT_NG (0) /* Definitions indicating abnormal status */
+#define TMT_TRUE (1) /* Definitions indicating the status for which the condition is true */
+#define TMT_FALSE (0) /* Definitions indicating a status in which the condition is false */
+
+#define TIM_ROLOVR_LEAPYEARDAYS (366) /*Number of days in the leap year */
+#define TIM_ROLOVR_NOTLEAPYEARDAYS (365) /*Year days in non-leap years */
+
+static const WORD kMonth[2][12] = {
+ {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, /* Number of days per month(For non-leap year) */
+ {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} /* Number of days per month(For leap years) */
+};
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : ChkLeapYear
+ * Function : Leap year determination processing
+ * Feature Overview : Determine whether it is a leap year
+ * Input : u_int16 year
+ * Output : None
+ * Return value : u_int32
+ TMT_TRUE Leap year
+ TMT_FALSE Non-leap year
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static u_int32 ChkLeapYear(u_int16 year) {
+ int32 leap_year;
+
+ /* Leap year determination processing (select subscripts in the [LEAP YEAR] table) *The processing that matches the time correction processing after time difference value addition/subtraction is used. */
+ leap_year = TMT_FALSE;
+ if ((year % 4) == 0) {
+ leap_year = TMT_TRUE;
+ }
+ if ((year % 100) == 0) {
+ leap_year = TMT_FALSE;
+ }
+
+ if ((year % 400) == 0) {
+ leap_year = TMT_TRUE;
+ }
+
+ return (leap_year);
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : RollOverFormerLaterDays
+ * Function : Calculation of the number of days before and after
+ * Feature Overview : The number of days from the beginning of the month to the previous day of the specified date,
+ and calculates the number of days after a given date, up to the end of the month
+ * Input : TG_TIM_ROLOVR_YMD* base_ymd Reference date
+ * Output : u_int32* former_days Number of days before (number of days before the specified date from the beginning of the month)
+ u_int32* later_days Number of days after(Number of days following the specified date until the end of the month)
+ * Return value : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void RollOverFormerLaterDays(TG_TIM_ROLOVR_YMD* base_ymd, u_int32* former_days, u_int32* later_days) {
+ int32 leap_year;
+
+ leap_year = ChkLeapYear(base_ymd->year);
+
+ *former_days = base_ymd->day - 1;
+
+ *later_days = kMonth[leap_year][base_ymd->month - 1] - base_ymd->day;
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : RollOverCalDaysWithinBY
+ * Function : Calculation of the difference in the number of days in the base year
+ * Feature Overview : Calculate the difference in the number of days between the base date and the conversion target date.
+ [Restriction]If the base date > conversion target date, the number of days difference is 0.
+ * Input : TG_TIM_ROLOVR_YMD* base_ymd Reference date
+ TG_TIM_ROLOVR_YMD* conv_ymd Conversion Date
+ * Output : None
+ * Return value : u_int32 Difference in the number of days(positive only)
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static u_int32 RollOverCalDaysWithinBY(TG_TIM_ROLOVR_YMD* base_ymd, TG_TIM_ROLOVR_YMD* conv_ymd) {
+ int32 leap_year; /* Subscripts in the [LEAP YEAR] table */
+ u_int32 days; /* Day Difference Calculation Result */
+ u_int32 l_days; /* Number of days after the reference month */
+ u_int32 f_days; /* Number of days before the conversion target month */
+ u_int32 dmy_days; /* Dummy days(For storing unnecessary number of days in this function) */
+ u_int32 m_days; /* Sum of the number of days in the month between the base month and the month to be converted */
+ int32 cnt; /* A counter that sums the number of days in a month between the base month and the month to be converted */
+ u_int16 diff_month; /* Difference between the conversion target month and the base month */
+ u_int16 chk_month; /* Number of days of month to be acquired */
+
+ days = 0;
+
+ if (base_ymd->month == conv_ymd->month) {
+ if (base_ymd->day <= conv_ymd->day) {
+ days = conv_ymd->day - base_ymd->day;
+ } else {
+ days = 0; /* Set the difference to 0(Negative difference in number of days is not calculated.) */
+ }
+ } else if (base_ymd->month < conv_ymd->month) {
+ RollOverFormerLaterDays(base_ymd, &dmy_days, &l_days);
+
+ m_days = 0;
+ diff_month = conv_ymd->month - base_ymd->month;
+
+ leap_year = ChkLeapYear(base_ymd->year);
+
+ /* Calculate the sum of the number of days in the month between the base month and the conversion target month B */
+ chk_month = base_ymd->month + 1;
+ for (cnt = 0; cnt < (diff_month - 1); cnt++) {
+ m_days += kMonth[leap_year][chk_month - 1];
+ chk_month++;
+ }
+
+ RollOverFormerLaterDays(conv_ymd, &f_days, &dmy_days);
+
+ days = l_days + m_days + f_days + 1; /* Calculate the difference in number of days as A+B+C+1 */
+
+ } else {
+ days = 0; /* Set the difference to 0(Negative difference in number of days is not calculated.) */
+ }
+
+ return days;
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : RollOverGetAYearDays
+ * Function : Process of obtaining the number of days per year
+ * Feature Overview : Get the number of days in a given year
+ * Input : u_int16 base_year Year
+ * Output : None
+ * Return value : u_int32 Number of days
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static u_int32 RollOverGetAYearDays(u_int16 base_year) {
+ int32 leap_year; /* Subscripts in the [LEAP YEAR] table */
+ u_int32 days;
+
+ leap_year = ChkLeapYear(base_year); /* Leap year determination processing */
+
+ if (leap_year == TMT_TRUE) {
+ days = TIM_ROLOVR_LEAPYEARDAYS;
+ } else {
+ days = TIM_ROLOVR_NOTLEAPYEARDAYS;
+ }
+
+ return days;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : RollOverConvYMDWithoutBY
+ * Function : Date conversion processing outside the base year, month, and day
+ * Feature Overview : Calculate the date shifted by the specified number of days from the specified date.
+ *If less than (1024 weeks x 7 days) is specified as the number of days difference, the calculation result is
+ returns the specified date(No correction)
+ * Input : TG_TIM_ROLOVR_YMD* base_ymd Reference date
+ u_int32 days Difference in the number of days
+ u_int32 days_by Number of days after + number of days after month
+ * Output : TG_TIM_ROLOVR_YMD* conv_ymd Date of the conversion result
+ * Return value : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void RollOverConvYMDWithoutBY(TG_TIM_ROLOVR_YMD* base_ymd, u_int32 days,
+ u_int32 days_by, TG_TIM_ROLOVR_YMD* conv_ymd) {
+ int32 leap_year; /* Subscripts in the [LEAP YEAR] table */
+ u_int32 rest_days; /* Remaining number of days */
+ u_int16 cal_year; /* For year calculation */
+ u_int16 cal_month; /* For monthly calculation */
+ u_int32 cal_days; /* To calculate the number of days */
+
+ rest_days = days - days_by; /* Remaining number of days is different from the number of initialization days.-(Number of days after + Number of days after month) */
+ cal_year = base_ymd->year + 1; /* The year is set to the year following the year of the initialization reference date. */ /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+
+ cal_days = RollOverGetAYearDays(cal_year); /* Process of obtaining the number of days per year */
+
+ while (rest_days > cal_days) {
+ rest_days -= cal_days; /* Remaining Days = Remaining Days-Updated as Days of Year */
+
+ cal_year++; /* Increment Year */
+
+ cal_days = RollOverGetAYearDays(cal_year); /* Process of obtaining the number of days per year */
+ }
+
+ /* Year Finalization */
+ conv_ymd->year = cal_year; /* Year Calculated */
+
+ cal_month = 1; /* Initialize Month January */
+
+ leap_year = ChkLeapYear(conv_ymd->year); /* Leap year determination processing */
+
+ cal_days = kMonth[leap_year][cal_month - 1]; /* Acquisition processing of the number of days/month */ /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+
+ while (rest_days > cal_days) {
+ rest_days -= cal_days; /* Remaining Days = Remaining Days-Updated as Days of Month */
+
+ cal_month++; /* Increment month */
+
+ cal_days = kMonth[leap_year][cal_month - 1]; /* Acquisition processing of the number of days/month */ /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Fix month */
+ conv_ymd->month = cal_month; /* Month Calculated */
+
+ /* Date set */
+ conv_ymd->day = (u_int16)rest_days; /* Day calculated Remaining number of days */
+}
+
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : RollOverConvYMD
+ * Function : Date conversion processing
+ * Feature Overview : Calculate the date shifted by the specified number of days from the specified date.
+ *If the base date is shifted by the number of days but the year is the same as the base date, the result returns the base date
+ * Input : TG_TIM_ROLOVR_YMD* base_ymd Reference date
+ u_int32 days Difference in the number of days
+ * Output : TG_TIM_ROLOVR_YMD* conv_ymd Date of the conversion result
+ * Return value : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void RollOverConvYMD(TG_TIM_ROLOVR_YMD* base_ymd, u_int32 days, TG_TIM_ROLOVR_YMD* conv_ymd) {
+ u_int32 days_by; /* Number of days after + number of days after month(=difference in number of days from the base date to the end of the year) */
+ TG_TIM_ROLOVR_YMD tmp_ymd;
+
+
+ /* (number of days after + number of days after)Set calculation date( 12/31 ) */
+ tmp_ymd.year = base_ymd->year;
+ tmp_ymd.month = 12;
+ tmp_ymd.day = 31;
+
+ days_by = RollOverCalDaysWithinBY(base_ymd, &tmp_ymd); /* Calculation of the difference in the number of days in the base year */
+
+ if (days_by >= days) {
+ memcpy(conv_ymd, base_ymd, sizeof(TG_TIM_ROLOVR_YMD)); /* Returns the base date regardless of the number of days difference */
+
+ } else {
+ RollOverConvYMDWithoutBY(base_ymd, days, days_by, conv_ymd);
+ }
+}
+
+
+
+/**
+ * @brief
+ * Conversion to a time that takes the GPS week correction counter into account
+ *
+ * Converting the GPS Week Correction Counter to a Considered Time
+ *
+ * @param[in] TG_TIM_ROLOVR_YMD* base_ymd Reference date
+ * @param[in] u_int8 gpsweekcorcnt GPS weekly correction counter
+ * @param[out] TG_TIM_ROLOVR_YMD* conv_ymd Correction Date
+ * @return none
+ * @retval none
+ */
+void GPSRollOverConvTime(TG_TIM_ROLOVR_YMD* base_ymd, TG_TIM_ROLOVR_YMD* conv_ymd, u_int8 gpsweekcorcnt) {
+ u_int32 days; /* Difference in the number of days */
+
+ days = TIM_ROLOVR_CALCORCNT_DAYS * gpsweekcorcnt; /* (1024 weeks x 7 days) x GPS week correction counter to calculate the difference in the number of days */
+
+ RollOverConvYMD(base_ymd, days, conv_ymd); /* Date conversion processing */
+}
diff --git a/positioning_hal/src/GpsCommon/MDev_Gps_API.cpp b/positioning_hal/src/GpsCommon/MDev_Gps_API.cpp
new file mode 100755
index 0000000..35f5201
--- /dev/null
+++ b/positioning_hal/src/GpsCommon/MDev_Gps_API.cpp
@@ -0,0 +1,491 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_API.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "MDev_Gps_API.h"
+#include "positioning_hal.h"
+#include "positioning_def.h"
+#include "MDev_Gps_Nmea.h"
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+/******************************************************************************
+@brief SendNmeaGps<BR>
+ NMEA transmission process
+@outline Send NMEA to VehicleSensor Thread
+@param[in] TG_GPS_NMEA* : pstNmeaData ... NMEA data
+@param[out] none
+@return RET_API
+@retval RET_NORMAL : Normal completion
+@retval RET_ERROR : ABENDs
+*******************************************************************************/
+RET_API SendNmeaGps(const MDEV_GPS_NMEA* p_nmea_data) {
+ MDEV_GPS_RAWDATA_NMEA_MSG s_send_msg;
+ SENSOR_MSG_GPSDATA s_msg_buf;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /* Create GPS Data Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /* Message header */
+ s_send_msg.h_dr.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.h_dr.hdr.respno = 0x0000;
+ s_send_msg.h_dr.hdr.cid = CID_GPS_DATA;
+ s_send_msg.h_dr.hdr.msgbodysize = sizeof(MDEV_GPS_RAWDATA_NMEA);
+ s_send_msg.h_dr.hdr.rid = 0x00;
+
+ /* Message data */
+ s_send_msg.st_data.e_kind = MDEV_GPS_DATA_RAWDATA_NMEA;
+ (void)memcpy(&(s_send_msg.st_data.st_nmea_data), p_nmea_data, sizeof(s_send_msg.st_data.st_nmea_data));
+
+ /* Create message buffer */
+ (void)memset(&s_msg_buf, 0, sizeof(s_msg_buf));
+ (void)memcpy(&(s_msg_buf.st_head.hdr), &(s_send_msg.h_dr.hdr), sizeof(T_APIMSG_HEADER));
+
+ s_msg_buf.st_para.ul_did = POS_DID_GPS_NMEA;
+ s_msg_buf.st_para.us_size = GPS_NMEA_SZ;
+
+ (void)memcpy(&(s_msg_buf.st_para.uc_data), &(s_send_msg.st_data.st_nmea_data), s_msg_buf.st_para.us_size);
+
+ ret = _pb_SndMsg(u_pno, sizeof(s_msg_buf), &s_msg_buf, 0);
+
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("_pb_SndMsg ERROR!! [ret=%d]\n", ret);
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS processing data transmission process
+ *
+ * @param[in] pstGpsTime SENSOR_MSG_GPSTIME - GPS time information
+ * @param[in] p_lonlat SENSORLOCATION_LONLATINFO - Latitude and longitude information
+ * @param[in] p_altitude SENSOR_LOCATION_ALTITUDEINFO - Altitude information
+ * @param[in] p_heading SENSORMOTION_HEADINGINFO_DAT - Bearing information
+ *
+ * @return RET_NORMAL Normal completion
+ * RET_ERROR ABENDs
+ */
+RET_API SendCustomGps(const SENSOR_MSG_GPSTIME* p_gps_time,
+ const SENSORLOCATION_LONLATINFO_DAT* p_lonlat,
+ const SENSORLOCATION_ALTITUDEINFO_DAT* p_altitude,
+ const SENSORMOTION_HEADINGINFO_DAT* p_heading,
+ const NAVIINFO_DIAG_GPS* p_diag_data) {
+ SENSOR_MSG_GPSDATA s_send_msg = {0};
+ MDEV_GPS_CUSTOMDATA* p_custom_data = NULL;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ /* Fast _CWORD71_ processing(memset fix) */
+ /* Initializes an area whose value is undefined in the message buffer. */
+ (void)memset(&s_send_msg.st_head, 0x00, sizeof(s_send_msg.st_head));
+
+ /** Message header */
+ s_send_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.st_head.hdr.respno = 0x0000;
+ s_send_msg.st_head.hdr.cid = CID_GPS_DATA;
+ s_send_msg.st_head.hdr.msgbodysize = sizeof(MDEV_GPS_CUSTOMDATA);
+ s_send_msg.st_head.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_para.ul_did = VEHICLE_DID_GPS_CUSTOMDATA;
+ s_send_msg.st_para.us_size = sizeof(MDEV_GPS_CUSTOMDATA);
+ p_custom_data = reinterpret_cast<MDEV_GPS_CUSTOMDATA *>(&(s_send_msg.st_para.uc_data));
+
+ (void)memcpy(&(p_custom_data->st_lonlat), p_lonlat, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+ (void)memcpy(&(p_custom_data->st_altitude), p_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+ (void)memcpy(&(p_custom_data->st_heading), p_heading, sizeof(SENSORMOTION_HEADINGINFO_DAT));
+ (void)memcpy(&(p_custom_data->st_diag_gps), p_diag_data, sizeof(NAVIINFO_DIAG_GPS));
+ (void)memcpy(&(p_custom_data->st_gps_time), p_gps_time, sizeof(SENSOR_MSG_GPSTIME));
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, sizeof(s_send_msg), reinterpret_cast<void*>(&s_send_msg), 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/******************************************************************************
+@brief SendSpeedGps<BR>
+ Rate information transmission processing
+@outline Sending speed information to vehicle sensor thread
+@param[in] SENSORMOTION_SPEEDINFO_DAT* : p_seed ... Velocity information
+@param[in] u_int16 : us_peed ... Vehicle speed(km/h)
+@param[out] none
+@return RET_API
+@retval RET_NORMAL : Normal completion
+@retval RET_ERROR : ABENDs
+*******************************************************************************/
+RET_API SendSpeedGps(const SENSORMOTION_SPEEDINFO_DAT* p_seed, u_int16 us_peed) {
+ MDEV_GPS_NAVISPEED_MSG s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message header */
+ s_send_msg.h_dr.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.h_dr.hdr.respno = 0x0000;
+ s_send_msg.h_dr.hdr.cid = CID_GPS_DATA;
+ s_send_msg.h_dr.hdr.msgbodysize = sizeof(MDEV_GPS_NAVISPEED);
+ s_send_msg.h_dr.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_data.e_kind = MDEV_GPS_DATA_NAVISPEED;
+ s_send_msg.st_data.us_speed_kmph = us_peed;
+
+ (void)memcpy( &s_send_msg.st_data.st_speed, p_seed, sizeof(s_send_msg.st_data.st_speed) );
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, (sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(MDEV_GPS_NAVISPEED)), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/* ++ #GPF_60_103 */
+/******************************************************************************
+@brief SendTimeGps<BR>
+ Time information transmission processing
+@outline Send GPS time information to vehicle sensor thread
+@param[in] MDEV_GPS_RTC* : p_rtc ... GPS time information
+@param[out] none
+@return RET_API
+@retval RET_NORMAL : Normal completion
+@retval RET_ERROR : ABENDs
+*******************************************************************************/
+RET_API SendTimeGps(const MDEV_GPS_RTC* p_rtc) {
+ MDEV_GPS_GPSTIME_MGS s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS data notification message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message header */
+ s_send_msg.h_dr.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.h_dr.hdr.respno = 0x0000;
+ s_send_msg.h_dr.hdr.cid = CID_GPS_DATA;
+ s_send_msg.h_dr.hdr.msgbodysize = sizeof(MDEV_GPS_GPSTIME);
+ s_send_msg.h_dr.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_data.e_kind = MDEV_GPS_DATA_GPSTIME;
+
+ (void)memcpy(&s_send_msg.st_data.st_rtc_data, p_rtc, sizeof(s_send_msg.st_data.st_rtc_data));
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, (sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(MDEV_GPS_GPSTIME)), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS clock drift transmit process
+ *
+ * @param[in] drift Clock drift
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABENDs
+ */
+RET_API SendClockDriftGps(int32_t drift) {
+ SENSOR_MSG_GPSDATA s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message header */
+ s_send_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.st_head.hdr.respno = 0x0000;
+ s_send_msg.st_head.hdr.cid = CID_GPS_DATA;
+ s_send_msg.st_head.hdr.msgbodysize = sizeof(SENSOR_MSG_GPSDATA_DAT);
+ s_send_msg.st_head.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_para.ul_did = VEHICLE_DID_GPS_CLOCK_DRIFT;
+ s_send_msg.st_para.us_size = sizeof(int32_t);
+
+ (void)memcpy(&(s_send_msg.st_para.uc_data), &drift, s_send_msg.st_para.us_size);
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, sizeof(s_send_msg), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS clock-frequency transmit process
+ *
+ * @param[in] Freq Clocking frequencies
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABENDs
+ */
+RET_API SendClockFrequencyGps(uint32_t freq) {
+ SENSOR_MSG_GPSDATA s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message header */
+ s_send_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.st_head.hdr.respno = 0x0000;
+ s_send_msg.st_head.hdr.cid = CID_GPS_DATA;
+ s_send_msg.st_head.hdr.msgbodysize = sizeof(SENSOR_MSG_GPSDATA_DAT);
+ s_send_msg.st_head.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_para.ul_did = VEHICLE_DID_GPS_CLOCK_FREQ;
+ s_send_msg.st_para.us_size = sizeof(uint32_t);
+
+ (void)memcpy(&(s_send_msg.st_para.uc_data), &freq, s_send_msg.st_para.us_size);
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, sizeof(s_send_msg), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return(ret);
+}
+
+/**
+ * @brief
+ * GPS rollover standard week number transmission processing
+ *
+ * @param[in] *p_week_rollover GPS rollover base week number
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABENDs
+ */
+RET_API DevGpsSndWknRollover(const SensorWknRollOverHal* p_week_rollover) {
+ SENSOR_MSG_GPSDATA s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset( &s_send_msg, 0x00, sizeof(s_send_msg) );
+
+ /** Message header */
+ s_send_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.st_head.hdr.respno = 0x0000;
+ s_send_msg.st_head.hdr.cid = CID_GPS_DATA;
+ s_send_msg.st_head.hdr.msgbodysize = sizeof(SensorWknRollOverHal);
+ s_send_msg.st_head.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_para.ul_did = VEHICLE_DID_GPS_WKNROLLOVER;
+ s_send_msg.st_para.us_size = sizeof(SensorWknRollOverHal);
+
+ (void)memcpy(&(s_send_msg.st_para.uc_data), p_week_rollover, s_send_msg.st_para.us_size);
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, sizeof(s_send_msg), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/******************************************************************************
+@brief DevGpsRstAnsSend<BR>
+ Reset response issuance processing
+@outline Issue a reset response
+@param[in] PNO : u_pno ... Notify-To Process No.
+@param[in] RID : uc_rid ... Response resource ID
+@param[in] u_int32 : ul_rst_sts ... Response result
+@param[out] none
+@return int32
+@retval RET_NORMAL : Normal
+@retval RET_ERROR : Abnormality
+*******************************************************************************/
+int32 DevGpsRstAnsSend(PNO u_pno, RID uc_rid, u_int32 ul_rst_sts) {
+ TG_GPS_RET_RESET_MSG s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PCSTR l_thread_name;
+
+ if (u_pno != PNO_NONE) {
+ /** Create GPS Reset Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message data */
+ s_send_msg.data.ret_rst_status = ul_rst_sts;
+
+ /* Messaging */
+ l_thread_name = _pb_CnvPno2Name(u_pno);
+ /* External Process Transmission and Reception Messages */
+ ret = _pb_SndMsg_Ext(l_thread_name,
+ CID_POSIF_REQ_GPS_RESET,
+ sizeof(s_send_msg.data),
+ reinterpret_cast<void *>(&(s_send_msg.data)),
+ 0);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("GpsCommCtl # DevGpsRstAnsSend SndMsg Error ret[%d] pno[%03X]\n", ret, u_pno);
+ ret = RET_ERROR;
+ }
+ }
+
+ return ret;
+}
+
+
+/**
+ * @brief Time setting response issuance processing
+ *
+ * @param[in] us_pno Notify-To Process No.
+ * @param[in] uc_rid Response resource ID
+ * @param[in] ul_rst_sts Response result
+ *
+ * @return Processing result
+ * @retval RET_NORMAL : Normal
+ * @retval RET_ERROR : Abnormality
+ */
+int32 DevGpsTimesetAnsSend(PNO us_pno, RID uc_rid, u_int32 ul_rst_sts) {
+ TG_GPS_RET_TIMESET_MSG st_snd_msg;
+ RET_API ret = RET_NORMAL;
+
+ /** Create GPS Reset Notification Message */
+ memset( &st_snd_msg, 0x00, sizeof(st_snd_msg) ); /* QAC 3200 */
+ /** Message header */
+ st_snd_msg.header.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ st_snd_msg.header.hdr.respno = 0x0000;
+ st_snd_msg.header.hdr.cid = CID_GPS_RETTIMESETTING;
+ st_snd_msg.header.hdr.msgbodysize = sizeof(st_snd_msg.status);
+ st_snd_msg.header.hdr.rid = uc_rid;
+ /** Message data */
+ st_snd_msg.status = ul_rst_sts;
+
+ /* Messaging */
+ if (us_pno != PNO_NONE) {
+ ret = _pb_SndMsg(us_pno, sizeof(st_snd_msg), &st_snd_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("DevGpsTimesetAnsSend SndMsg Error ret[%d] pno[%03X] \r\n", ret, us_pno);
+
+ ret = RET_ERROR;
+ }
+ }
+
+ return(ret);
+}
+
+
+/**
+ * @brief
+ * GPS clock drift transmit process
+ *
+ * @param[in] drift Clock drift
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABENDs
+ *
+ */
+RET_API DevSendGpsConnectError(BOOL is_err) {
+ SENSOR_MSG_GPSDATA s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message header */
+ s_send_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.st_head.hdr.respno = 0x0000;
+ s_send_msg.st_head.hdr.cid = CID_GPS_DATA;
+ s_send_msg.st_head.hdr.msgbodysize = sizeof(SENSOR_MSG_GPSDATA_DAT);
+ s_send_msg.st_head.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_para.ul_did = POSHAL_DID_GPS_CONNECT_ERROR;
+ s_send_msg.st_para.us_size = sizeof(uint32_t);
+
+ (void)memcpy(&(s_send_msg.st_para.uc_data), &is_err, s_send_msg.st_para.us_size);
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, sizeof(s_send_msg), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+
+RET_API SndGpsTimeRaw(const SENSOR_GPSTIME_RAW* ps_gpstime_raw) {
+ SENSOR_MSG_GPSDATA st_snd_msg;
+ RET_API ret;
+ PNO _us_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset( &st_snd_msg, 0x00, sizeof(st_snd_msg) ); /* QAC 3200 */
+ /** Message header */
+ st_snd_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ st_snd_msg.st_head.hdr.respno = 0x0000;
+ st_snd_msg.st_head.hdr.cid = CID_GPS_DATA;
+ st_snd_msg.st_head.hdr.msgbodysize = sizeof(SENSOR_MSG_GPSDATA_DAT);
+ st_snd_msg.st_head.hdr.rid = 0x00;
+ /** Message data */
+ st_snd_msg.st_para.ul_did = VEHICLE_DID_GPS_TIME_RAW;
+ st_snd_msg.st_para.us_size = sizeof(SENSOR_GPSTIME_RAW);
+ (void)memcpy(&(st_snd_msg.st_para.uc_data), ps_gpstime_raw, st_snd_msg.st_para.us_size); /* QAC 3200 */
+
+ /* Messaging */
+ ret = _pb_SndMsg( _us_pno, sizeof(st_snd_msg), &st_snd_msg, 0 );
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("_pb_SndMsg ERROR!! [ret=%d]\n", ret);
+ ret = RET_ERROR;
+ }
+
+ return(ret);
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/GpsCommon/MDev_Gps_Common.cpp b/positioning_hal/src/GpsCommon/MDev_Gps_Common.cpp
new file mode 100755
index 0000000..c8b5c9a
--- /dev/null
+++ b/positioning_hal/src/GpsCommon/MDev_Gps_Common.cpp
@@ -0,0 +1,2105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Common.h
+*/
+
+/*---------------------------------------------------------------------------*/
+
+#include "MDev_Gps_Common.h"
+
+#include <native_service/ns_backup.h>
+#include <native_service/ns_backup_id.h>
+#include "positioning_common.h"
+#include "MDev_Gps_API.h"
+#include "MDev_Gps_TimerCtrl.h"
+#include "MDev_Gps_Nmea.h"
+#include "MDev_GpsRecv.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define BK_ID_POS_GPS_TD_STS_SZ 1 /* Datetime Status-Size */
+#define BK_GPSFIXCNT_OFFSET_CHK 12 /* Fix Count-Offset-Check SRAM */
+#define BK_GPSFIXCNT_RAM_OK 0 /* Fix Count RAM Status OK */
+#define BK_GPSFIXCNT_RAM_FILE_NG 1 /* Fix Count RAM Status FILE NG */
+#define BK_GPSFIXCNT_RAM_NG 2 /* Fix Count RAM Status NG */
+
+#define JULIAN_DAY (-32044.0f) /* Be based on March 1, 4800 BC */
+#define MODIFIED_JULIAN_DAY_OFFSET (2400000.5f)
+#define GPS_WS_MAX (7 * 24 * 60 * 60) /* GPS time(Weekly seconds)*/
+#define GET_METHOD_GPS (1) //!< \~english GPS
+
+/* Presence information definitions DR */
+#define SENSORLOCATION_EXISTDR_NODR (0) /* Without DR */
+#define SENSORLOCATION_EXISTDR_DR (1) /* There DR */
+/* DR state definition */
+#define SENSORLOCATION_DRSTATUS_INVALID (0) /* Invalid */
+#define SENSORLOCATION_DRSTATUS_GPS_NODR (1) /* Information use GPS, not yet implemented DR */
+#define SENSORLOCATION_DRSTATUS_NOGPS_DR (2) /* No information available GPS, DR implementation */
+#define SENSORLOCATION_DRSTATUS_GPS_DR (3) /* Information use GPS, DR implementation */
+
+#define SENSORLOCATION_STATUS_DISABLE (0) //!< \~english Not available
+#define SENSORLOCATION_STATUS_ENABLE (1) //!< \~english Available
+/*---------------------------------------------------------------------------*/
+// Global values
+
+uint8_t g_gps_reset_cmd_sending = FALSE; /* Reset command transmission in progress judgment flag */
+uint8_t g_is_gpstime_sts = FALSE; /* Date/Time Status Fixed Value Setting Indication Flag */
+uint8_t g_gpstime_raw_tdsts = 0;
+extern u_int8 g_gps_week_cor_cnt;
+/*---------------------------------------------------------------------------*/
+// Functions
+void WriteGpsTimeToBackup(uint8_t flag, POS_DATETIME* pst_datetime) {
+ int32_t ret;
+ ST_GPS_SET_TIME buf;
+
+ memset(reinterpret_cast<void *>(&buf), 0, (size_t)sizeof(buf));
+
+ buf.flag = flag;
+ buf.year = pst_datetime->year;
+ buf.month = pst_datetime->month;
+ buf.date = pst_datetime->date;
+ buf.hour = pst_datetime->hour;
+ buf.minute = pst_datetime->minute;
+ buf.second = pst_datetime->second;
+
+ ret = Backup_DataWt(D_BK_ID_POS_GPS_TIME_SET_INFO, &buf, 0, sizeof(ST_GPS_SET_TIME));
+ if (ret != BKUP_RET_NORMAL) {
+ POSITIONING_LOG("Backup_DataWt ERROR!! [ret=%d]", ret);
+ }
+
+ return;
+}
+
+
+
+/********************************************************************************
+ * MODULE : ChangeStatusGpsCommon
+ * ABSTRACT : State transition processing
+ * FUNCTION : Changes the state of the GPS communication management process to the specified state
+ * ARGUMENT : u_int32 sts : State of the transition destination
+ * NOTE :
+ * RETURN : None
+ ********************************************************************************/
+void ChangeStatusGpsCommon(u_int32 sts ) {
+ /* Set the transition destination state in the management information state */
+ g_gps_mngr.sts = sts;
+}
+
+/********************************************************************************
+ * MODULE : RtyResetGpsCommon
+ * ABSTRACT : Reset retry counter(Periodic reception)
+ * FUNCTION : Reset the retry counter
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ********************************************************************************/
+void RtyResetGpsCommon(void) {
+ g_gps_mngr.hrsetcnt = 0; /* Initialization of the number of tries until a hard reset */
+ g_gps_mngr.sndngcnt = 0; /* Initialization of the number of tries until serial reset */
+}
+
+/******************************************************************************
+@brief SendRtyResetGpsCommon<BR>
+ Reset retry counter(ACK response)
+@outline Reset the retry counter
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void SendRtyResetGpsCommon(void) {
+ g_gps_mngr.sndcnt = 0; /* Initialization of the number of transmission retries */
+}
+
+uint8_t HardResetChkGpsCommon(void) {
+ uint8_t ret = RETRY_OFF; /* Return value */
+ static uint8_t uc_hardreset_cnt = 0; /* Number of hard resets */
+
+ g_gps_mngr.hrsetcnt++; /* Add number of tries until hard reset */
+
+ if (g_gps_mngr.hrsetcnt >= HRSET_MAX) {
+ // Todo For test don't have hardReset Method.
+ // DEV_Gps_HardReset();
+
+ g_gps_mngr.hrsetcnt = 0; /* Initialization of the number of tries until a hard reset */
+ /* Discard all pending commands */
+ DeleteAllSaveCmdGpsCommon();
+ /* Determination of the number of hard reset executions */
+ uc_hardreset_cnt++;
+ if (uc_hardreset_cnt >= 3) {
+ ret = RETRY_OFF; /* Set the return value (No retry: Specified number of hard resets completed) */
+ uc_hardreset_cnt = 0; /* Clear the number of hard resets */
+ } else {
+ ret = RETRY_OUT; /* Set the return value (retry out: hardware reset) */
+ }
+ } else { /* When the number of tries until the hard reset is less than the maximum value */
+ ret = RETRY_ON; /* Set return value (with retry) */
+ }
+
+ return (ret); /* End of the process */
+}
+
+
+/******************************************************************************
+@brief SendReqGpsCommon<BR>
+ Common-Transmit Request Reception Matrix Function
+@outline Common processing when receiving a transmission request
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void SendReqGpsCommon(void) {
+ RET_API ret = RET_NORMAL;
+ TG_GPS_SND_DATA* p_rcv_data = NULL;
+ TG_GPS_SAVECMD s_send_data;
+ TG_GPS_OUTPUT_FORMAT s_output_format;
+
+ p_rcv_data = reinterpret_cast<TG_GPS_SND_DATA*>(&(g_gps_msg_rcvr.msgdat[0])); /* Incoming message structure */
+
+ /** Transmit Data Format Check */
+ ret = CheckSendCmdGpsCommon(p_rcv_data->ub_data, p_rcv_data->us_size, &s_output_format);
+
+ /** Normal format */
+ if (ret == RET_NORMAL) {
+ memset( &s_send_data, 0x00, sizeof(s_send_data) ); /* Ignore -> MISRA-C:2004 Rule 16.10 */
+
+ s_send_data.us_pno = 0; /* Result notification destination process number */
+ s_send_data.uc_rid = 0; /* Result Notification Resource ID */
+ s_send_data.uc_rst = GPS_CMD_NOTRST; /* Reset flag */
+ s_send_data.e_cmd_info = s_output_format; /* Command information */
+ memcpy( &s_send_data.sndcmd, p_rcv_data, sizeof(TG_GPS_SND_DATA) ); /* Sending commands */
+
+ /* Command is suspended and terminated. */
+ ret = DevGpsSaveCmd(&s_send_data); /* #GPF_60_040 */
+
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("GPS Command Reserve bufferFull ! \r\n");
+ }
+ } else {
+ POSITIONING_LOG("# GpsCommCtl # GPS Command Format Error!! \r\n");
+ }
+
+ return;
+}
+
+/******************************************************************************
+@brief GPSResetReqGpsCommon<BR>
+ Common-GPS reset request reception matrix function
+@outline Common processing at GPS reset reception
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void GPSResetReqGpsCommon(void) {
+ RET_API ret = RET_NORMAL;
+ POS_RESETINFO st_rcv_msg;
+
+ memset(&st_rcv_msg, 0x00, sizeof(st_rcv_msg)); /* 2015/03/31 Coverity CID: 21530 support */
+
+ if (g_gps_reset_cmd_sending == FALSE) {
+ memcpy(&st_rcv_msg, reinterpret_cast<POS_RESETINFO *>(&(g_gps_msg_rcvr.msgdat)),
+ sizeof(POS_RESETINFO));
+ ret = DevGpsResetReq(st_rcv_msg.respno, 0);
+ if (ret == RET_NORMAL) {
+ /* Set the reset command transmission judgment flag to transmission in progress */
+ g_gps_reset_cmd_sending = TRUE;
+ /* Send reset command(Normal response transmission)*/
+ GpsSetPosBaseEvent(st_rcv_msg.sndpno, POS_RET_NORMAL);
+ } else if (ret == RET_EV_NONE) {
+ /* nop */
+ } else {
+ /* Send reset command(Internal Processing Error Response Transmission)*/
+ GpsSetPosBaseEvent(st_rcv_msg.sndpno, POS_RET_ERROR_INNER);
+ }
+ } else {
+ memcpy(&st_rcv_msg, reinterpret_cast<POS_RESETINFO*>(&(g_gps_msg_rcvr.msgdat)), sizeof(POS_RESETINFO));
+ GpsSetPosBaseEvent(st_rcv_msg.sndpno, POS_RET_ERROR_BUSY);
+ }
+ return;
+}
+
+/******************************************************************************
+@brief CyclDataTimeOutGpsCommon<BR>
+ Common-Receive data monitoring timeout matrix function
+@outline Common processing at reception cycle data monitoring timeout
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void CyclDataTimeOutGpsCommon(void) {
+ g_wcnct_err++; /* Count number of connection errors */
+
+ /* Stop all timers */
+ DevGpsTimeStop(GPS_STARTUP_TIMER); /* Start confirmation monitoring timer */ /* Ignore -> MISRA-C:2004 Rule 16.10 */
+ DevGpsTimeStop(GPS_RECV_ACK_TIMER); /* ACK reception monitoring timer */ /* Ignore -> MISRA-C:2004 Rule 16.10 */
+
+ /* Clear cyclic receive data up to now */
+ DevGpsCycleDataClear();
+
+ /* Start confirmation monitoring timer setting */
+ DevGpsTimeSet(GPS_STARTUP_TIMER); /* Ignore -> MISRA-C:2004 Rule 16.10 */
+
+ /* State-transition(Start Confirmation Monitor) */
+ ChangeStatusGpsCommon(GPS_STS_STARTUP);
+
+ return;
+}
+
+/********************************************************************************
+ * MODULE : CheckFrontStringPartGpsCommon
+ * ABSTRACT : Message start character string determination processing
+ * FUNCTION : Check that the message starts with the specified string
+ * ARGUMENT : pubTarget : Message
+ * : pubStart : Character string
+ * NOTE : When target is equal to start, it is also judged to be TRUE.
+ * : "*" in the start is treated as a single-character wildcard.
+ * RETURN : RET_NORMAL : Decision success
+ * : RET_ERROR : Decision failure
+ ********************************************************************************/
+RET_API CheckFrontStringPartGpsCommon(const u_char *p_tartget, const u_char *p_start) {
+ RET_API ret = RET_ERROR;
+
+ while (((*p_tartget == *p_start)
+ || ('*' == *p_start)) /* #GPF_60_024 */ /* Ignore -> No applicable rules for MISRA-C */
+ && (*p_tartget != '\0')
+ && (*p_start != '\0')) {
+ p_tartget++; /* Ignore -> MISRA-C:2004 Rule 17.4 */
+ p_start++; /* Ignore -> MISRA-C:2004 Rule 17.4 */
+ }
+
+ if (*p_start == '\0') {
+ ret = RET_NORMAL;
+ } else {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/******************************************************************************
+@brief JudgeFormatGpsCommon<BR>
+ Format determination processing
+@outline Determine the format of the received GPS data
+@param[in] pubSndData : Message to be judged
+@param[in] ul_length : Message length
+@param[out] peFormat : Where to Return the Format
+@input none
+@return int32
+@retval GPSRET_SNDCMD : Commands to be notified
+@retval GPSRET_NOPCMD : User unset command
+@retval GPSRET_CMDERR : No applicable command
+*******************************************************************************/
+int32 JudgeFormatGpsCommon(u_char *p_send_data, u_int32 ul_length, TG_GPS_OUTPUT_FORMAT *p_format) {
+ int32 ret = GPSRET_NOPCMD; /* Return value */
+ u_int32 cnt = 0; /* Ignore -> MISRA-C:2004 Rule 5.6 */
+
+ for (cnt = 0; cnt < (u_int32)GPSCMDANATBL_MAX; cnt++) {
+ /** End-of-table decision */
+ if (CheckFrontStringPartGpsCommon((const u_char*)ENDMARK, kGpsCmdAnaTbl[cnt].c_sentence) == RET_NORMAL) {
+ /** When there is no matching sentence, */
+ /** set return value. */
+ ret = GPSRET_NOPCMD; /* Ignore -> MISRA-C:2004 Rule 3.1 */
+ break;
+ }
+
+ /* ++ #GPF_60_040 */
+ /* Sentence determination of received command */
+
+ if (kGpsCmdAnaTbl[cnt].e_rcv_format == g_gps_mngr.rcv_cmd) {
+ /* Format set */
+ (*p_format) = g_gps_mngr.rcv_cmd;
+
+ /* Notification judgment */
+ if (kGpsCmdAnaTbl[cnt].b_snd_cmd_flg == TRUE) {
+ /* Checksum implementation */
+ if (CheckSumGpsCommon(reinterpret_cast<u_int8*>(p_send_data),
+ ul_length,
+ kGpsCmdAnaTbl[cnt].e_rcv_format) != RET_NORMAL) {
+ /* Receive data anomaly */
+ POSITIONING_LOG("# GpsCommCtl # GPS Data SUM ERROR! \r\n");
+
+ g_wrecv_err++;
+
+ /* Set data error in return value */
+ ret = GPSRET_CMDERR;
+ } else {
+ /* Notification to vehicle sensor */
+ ret = GPSRET_SNDCMD;
+ g_wrecv_err = 0;
+ }
+ }
+
+ break;
+ }
+ }
+
+ return ret;
+}
+
+
+/******************************************************************************
+@brief CheckSumGpsCommon<BR>
+ Checksum processing
+@outline Checking the integrity of GPS commands
+@param[in] none
+@param[out] none
+@input u_int8 : p_uc_data[] ... Receive data pointer
+@input u_int32 : ul_length ... Data length
+@input u_int32 : e_cmd_info ... Command information<BR>
+ -FORMAT_NMEA NMEA data<BR>
+ -FORMAT_BIN Standard binary<BR>
+ -FORMAT_FULLBIN FULL binaries
+@return RET_API
+@retval RET_NORMAL : Normal completion
+@retval RET_ERROR : ABENDs
+*******************************************************************************/
+RET_API CheckSumGpsCommon(const u_int8 p_uc_data[], u_int32 ul_length, TG_GPS_OUTPUT_FORMAT e_cmd_info) {
+ RET_API l_ret = RET_ERROR;
+ u_int32 i = 0;
+ u_int8 uc_char = 0;
+ u_int8 uc_sum = 0;
+ u_int8 uc_cmp = 0;
+ int32_t ret = 0;
+
+ static u_int8 uc_work[UBX_CMD_SIZE_MAX];
+
+ if ((GPS_FORMAT_MON_VER == e_cmd_info)
+ || (GPS_FORMAT_AID_INI == e_cmd_info)
+ || (GPS_FORMAT_ACK_ACKNACK == e_cmd_info)
+ || (GPS_FORMAT_NAV_TIMEUTC == e_cmd_info)
+ || (GPS_FORMAT_NAV_CLOCK == e_cmd_info)
+ || (GPS_FORMAT_RXM_RTC5 == e_cmd_info)
+ || (GPS_FORMAT_NAV_SVINFO == e_cmd_info)
+ || (GPS_FORMAT_CFG_NAVX5 == e_cmd_info)) {
+ (void)memcpy(uc_work, p_uc_data, ul_length - 2);
+ DevGpsSetChkSum(uc_work, ul_length);
+
+ ret = memcmp(uc_work, p_uc_data, ul_length);
+
+ if (ret == 0) {
+ l_ret = RET_NORMAL;
+ } else {
+ }
+ } else {
+ /** XOR each character between '$' and '*' */
+ for ( i = 1; i < ul_length; i++ ) {
+ if (p_uc_data[i] == (u_int8)'*') {
+ /** '*'Detection */
+ l_ret = RET_NORMAL; /* #GPF_60_111 */
+ break;
+ } else {
+ /** '*'Not detected */
+ uc_char = p_uc_data[i];
+ uc_sum ^= uc_char;
+ }
+ }
+
+ /** When the position of '*' is within two characters following '*' (access check of the receive buffer range) */
+ if ( (l_ret == RET_NORMAL) && ((GPS_READ_LEN - 2) > i) ) {
+ /** Convert two characters following '*' to two hexadecimal digits */
+ uc_cmp = (AtoHGpsCommon(p_uc_data[i + 1]) * 16) + AtoHGpsCommon(p_uc_data[i + 2]);
+
+ /** Checksum result determination */
+ if ( uc_cmp != uc_sum ) {
+ /** Abnormality */
+ l_ret = RET_ERROR;
+ }
+ } else {
+ /** '*' Not detected, data length invalid */
+ /** Abnormality */
+ l_ret = RET_ERROR;
+ }
+ }
+
+ return l_ret;
+}
+
+/******************************************************************************
+@brief AtoHGpsCommon<BR>
+ ASCII-> hexadecimal conversions
+@outline Convert ASCII codes to hexadecimal
+@param[in] none
+@param[out] none
+@input u_int8 : ascii ... ASCII code('0' ~ '9', 'a' ~ 'f', 'A' ~ 'F')
+@return u_int8
+@retval Hexadecimal number
+*******************************************************************************/
+u_int8 AtoHGpsCommon(u_int8 ascii) {
+ u_int8 hex = 0;
+ if ((ascii >= '0') && (ascii <= '9')) {
+ hex = ascii - '0';
+ } else if ((ascii >= 'a') && (ascii <= 'f')) {
+ hex = (ascii - 'a') + 0xa; /* Ignore -> MISRA-C:2004 Rule 12.1 */
+ } else if ( (ascii >= 'A') && (ascii <= 'F') ) {
+ hex = (ascii - 'A') + 0xa; /* Ignore -> MISRA-C:2004 Rule 12.1 */
+ } else {
+ /* nop */
+ }
+
+ return hex;
+}
+
+/******************************************************************************
+@brief DevGpsSaveCmd<BR>
+ Command pending processing
+@outline Temporarily save commands to be sent to GPS
+@param[in] TG_GPS_SND_DATA* pstSndMsg : Sending commands
+@param[out] none
+@return RET_API
+@retval RET_NORMAL : Normal completion
+@retval RET_ERROR : ABENDs(buffer full)
+*******************************************************************************/
+RET_API DevGpsSaveCmd(TG_GPS_SAVECMD *p_send_data) {
+ RET_API ret = RET_NORMAL;
+ u_int32 savp = 0; /* Holding buffer location storage */
+
+ /* Pending buffer full */
+ if ( g_gps_save_cmdr.bufsav >= SAV_MAX ) {
+ /* Return an abend */
+ ret = RET_ERROR;
+ } else {
+ savp = g_gps_save_cmdr.saveno; /* Get pending buffer position */
+
+ /* Copy data to pending buffer */
+ memset(&g_gps_save_cmdr.savebuf[savp], 0x00, sizeof(g_gps_save_cmdr.savebuf[savp]));
+ memcpy(&g_gps_save_cmdr.savebuf[savp], p_send_data, sizeof(TG_GPS_SAVECMD));
+
+ g_gps_save_cmdr.saveno++; /* Pending index addition */
+
+ if (g_gps_save_cmdr.saveno >= SAV_MAX) {
+ g_gps_save_cmdr.saveno = 0; /* Reset Pending Index */
+ }
+
+ g_gps_save_cmdr.bufsav++; /* Number of pending buffers added */
+ }
+
+ return ret;
+}
+
+/******************************************************************************
+@brief SendSaveCmdGpsCommon<BR>
+ Pending command transmission processing
+@outline Send Pending Commands to GPS
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void SendSaveCmdGpsCommon(void) {
+ u_int32 sndp = 0; /* Holding buffer location storage */
+ // TG_GPS_SND_DATA* p_send_data = NULL; /* Pointer to the pending command */
+ BOOL b_ret = FALSE; /* Command send return value */
+
+ /** Retrieves one pending command, if any, and sends it. */
+ if (g_gps_save_cmdr.bufsav != 0) {
+ /** Send position acquisition */
+ sndp = g_gps_save_cmdr.sendno;
+ // p_send_data = reinterpret_cast<TG_GPS_SND_DATA*>(&(g_gps_save_cmdr.savebuf[sndp]));
+
+ // todo For test No Uart
+ // b_ret = DEV_Gps_CmdWrite( p_send_data->us_size, &(p_send_data->uc_data[0]) );/* #GPF_60_106 */
+ if ( b_ret != TRUE ) {
+ POSITIONING_LOG("DEV_Gps_CmdWrite fail. ret=[%d]\n", b_ret);
+ // ucResult = SENSLOG_RES_FAIL;
+ }
+
+ /* ++ #GPF_60_040 */
+ /** Configure Monitored Commands */
+ g_gps_mngr.resp_cmd = g_gps_save_cmdr.savebuf[ sndp ].e_cmd_info;
+ g_gps_mngr.resp_pno = g_gps_save_cmdr.savebuf[ sndp ].us_pno;
+ g_gps_mngr.resp_rid = g_gps_save_cmdr.savebuf[ sndp ].uc_rid;
+ g_gps_mngr.resp_rst_flag = g_gps_save_cmdr.savebuf[ sndp ].uc_rst;
+
+ /** Perform response monitoring */
+ DevGpsTimeSet(GPS_RECV_ACK_TIMER); /* Ignore -> MISRA-C:2004 Rule 16.10 */
+ /* State transition processing(sending) */
+ ChangeStatusGpsCommon(GPS_STS_SENT);
+ } else {
+ /** No monitored commands */
+ g_gps_mngr.resp_cmd = GPS_FORMAT_MIN;
+ g_gps_mngr.resp_pno = 0x0000;
+ g_gps_mngr.resp_rid = 0x00;
+ g_gps_mngr.resp_rst_flag = GPS_CMD_NOTRST;
+ }
+
+ return;
+}
+
+/* ++ #GPF_60_040 */
+/******************************************************************************
+@brief DeleteSaveCmdGpsCommon<BR>
+ Pending command deletion processing
+@outline Deleting a Pending Command
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DeleteSaveCmdGpsCommon(void) {
+ u_int32 sndp = 0; /* Holding buffer location storage */
+
+ /** Delete one pending command, if any. */
+ if (g_gps_save_cmdr.bufsav != 0) {
+ /** Send position acquisition */
+ sndp = g_gps_save_cmdr.sendno;
+
+ /** Clear Stored Data */
+ memset(&g_gps_save_cmdr.savebuf[sndp], 0x00, sizeof(g_gps_save_cmdr.savebuf[sndp]));
+
+ /** Transmit index addition */
+ g_gps_save_cmdr.sendno++;
+ if ( g_gps_save_cmdr.sendno >= SAV_MAX ) {
+ /** Transmit index MAX or higher */
+ /** Initialize transmission index */
+ g_gps_save_cmdr.sendno = 0;
+ }
+
+ /** Subtract pending buffers */
+ g_gps_save_cmdr.bufsav--;
+ }
+
+ return;
+}
+
+/******************************************************************************
+@brief DeleteAllSaveCmdGpsCommon<BR>
+ Hold command abort processing
+@outline Discards all pending commands and returns a reset response
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DeleteAllSaveCmdGpsCommon(void) {
+ u_int32 sndp = 0; /* Holding buffer location storage */
+ PNO us_pno = 0; /* Ignore -> MISRA-C:2004 Rule 5.6 */
+ RID uc_rid = 0; /* Ignore -> MISRA-C:2004 Rule 5.6 */
+
+ while (g_gps_save_cmdr.bufsav != 0) {
+ /** Determine whether it is a pending command that requires a response. */
+ sndp = g_gps_save_cmdr.sendno;
+
+ if (g_gps_save_cmdr.savebuf[ sndp ].uc_rst == GPS_CMD_RESET) {
+ /** In the case of a reset request, a reset response (communication error) is notified. */
+ us_pno = g_gps_save_cmdr.savebuf[ sndp ].us_pno;
+ uc_rid = g_gps_save_cmdr.savebuf[ sndp ].uc_rid;
+ DevGpsRstAnsSend(us_pno, uc_rid, GPS_SENDNG); /* Ignore -> MISRA-C:2004 Rule 16.10 */
+ }
+
+ /** Delete */
+ DeleteSaveCmdGpsCommon();
+ }
+
+ return;
+}
+/******************************************************************************
+@brief RcvCyclCmdNmeaGpsCommon<BR>
+ Cyclic data (NMEA) notification process
+@outline Notifying VehicleSensor of Cyclic Data (NMEA) Reception
+@param[in] u_int8 : *p_uc_data ... Receive data pointer
+@param[in] u_int32 : ul_len ... Received data length
+@param[in] TG_GPS_OUTPUT_FORMAT : s_output_format ... Receive Format
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void RcvCyclCmdNmeaGpsCommon(u_int8 *p_uc_data, u_int32 ul_len, TG_GPS_OUTPUT_FORMAT s_output_format) {
+ NAVIINFO_ALL navilocinfo; /* Navigation information */
+ BOOL bcycle_rcv_flag = FALSE; /* Cyclic reception judgment result */
+
+ if (JudgeFormatOrderGpsCommon(s_output_format, g_rcv_format) == 0) {
+ /** If a sentence is received before the last received sentence, */
+ /** determine as the beginning of cyclic data. */
+ bcycle_rcv_flag = TRUE;
+ }
+
+ if (bcycle_rcv_flag == TRUE) {
+ DevGpsSndCycleDataNmea();
+
+ /* Reset navigation information */
+ memset(&navilocinfo, 0x00, sizeof(NAVIINFO_ALL));
+
+ /* NMEA data analysis */
+ DevGpsAnalyzeNmea(&navilocinfo);
+
+ /** Clear Buffer */
+ // DevGpsCycleDataClear();
+ }
+
+ DevGpsCycleDataSetNmea(p_uc_data, (u_int32)ul_len, GetNmeaIdxGpsCommon(s_output_format));
+
+ /** Update receive format */
+ g_rcv_format = s_output_format;
+
+ return;
+}
+
+
+/**
+ * @brief
+ * Cyclic data (UBX) notification processing
+ *
+ * Notify vehicle sensor of reception of cyclic data (UBX)
+ *
+ * @param[in] u_int8 : *p_uc_data ... Receive data pointer
+ * @param[in] u_int32 : ul_len ... Received data length
+ * @param[in] TG_GPS_OUTPUT_FORMAT : eFormat ... Receive Format
+ */
+void RcvCyclCmdExtGpsCommon(u_int8 *p_uc_data, u_int32 ul_len, TG_GPS_OUTPUT_FORMAT e_format) {
+ SENSOR_GPSTIME_RAW st_gpstime_raw;
+ TG_GPS_UBX_NAV_TIMEUTC_DATA *pst_navtime_utc;
+ BOOL b_validtow; /* Valid Time of Week */
+ BOOL b_validwkn; /* Valid Week of Number */
+ BOOL b_validutc; /* Valid UTC Time */
+
+ /* For NAV-TIMEUTC */
+ if (e_format == GPS_FORMAT_NAV_TIMEUTC) {
+ memset(&st_gpstime_raw, 0x00, sizeof(st_gpstime_raw));
+
+ /* NAV-TIMEUTC analysis */
+ pst_navtime_utc = reinterpret_cast<TG_GPS_UBX_NAV_TIMEUTC_DATA*>(p_uc_data + UBX_CMD_OFFSET_PAYLOAD);
+
+ st_gpstime_raw.utc.year = pst_navtime_utc->year;
+ st_gpstime_raw.utc.month = pst_navtime_utc->month;
+ st_gpstime_raw.utc.date = pst_navtime_utc->day;
+ st_gpstime_raw.utc.hour = pst_navtime_utc->hour;
+ st_gpstime_raw.utc.minute = pst_navtime_utc->min;
+ st_gpstime_raw.utc.second = pst_navtime_utc->sec;
+ b_validtow = (BOOL)(((pst_navtime_utc->valid) & UBX_CMD_MSK_NAV_TIMEUTC_VALID_TOW)
+ >> (uint8_t)(UBX_CMD_MSK_NAV_TIMEUTC_VALID_TOW / 2));
+ b_validwkn = (BOOL)(((pst_navtime_utc->valid) & UBX_CMD_MSK_NAV_TIMEUTC_VALID_WKN)
+ >> (uint8_t)(UBX_CMD_MSK_NAV_TIMEUTC_VALID_WKN / 2));
+ b_validutc = (BOOL)(((pst_navtime_utc->valid) & UBX_CMD_MSK_NAV_TIMEUTC_VALID_UTC)
+ >> (uint8_t)(UBX_CMD_MSK_NAV_TIMEUTC_VALID_UTC / 2));
+
+ if ((b_validtow == TRUE) && (b_validwkn == TRUE)) {
+ st_gpstime_raw.tdsts = 2; /* Calibrated */
+ g_gpstime_raw_tdsts = 2;
+ } else {
+ st_gpstime_raw.tdsts = 0; /* Uncalibrated */
+ g_gpstime_raw_tdsts = 0;
+ }
+
+ b_validutc = b_validutc;
+ POSITIONING_LOG("year=%04d, month=%02d, date=%02d, hour=%02d, minute=%02d,"
+ " second=%02d, validTow=%d, validWkn=%d, validUtc=%d",
+ st_gpstime_raw.utc.year, st_gpstime_raw.utc.month, st_gpstime_raw.utc.date,
+ st_gpstime_raw.utc.hour, st_gpstime_raw.utc.minute, st_gpstime_raw.utc.second,
+ b_validtow, b_validwkn, b_validutc);
+ /* Notify GPS time to vehicle sensor */
+ SndGpsTimeRaw((const SENSOR_GPSTIME_RAW*)&st_gpstime_raw);
+ } else {
+ POSITIONING_LOG("Forbidden ERROR!![e_format=%d]", e_format);
+ }
+
+ /** Update Receive Format */
+ g_rcv_format = e_format;
+
+ return;
+}
+
+/******************************************************************************
+@brief CheckSendCmdGpsCommon<BR>
+ Send command check processing
+@outline Check the format of the send command
+@param[in] const u_char* pubRcvData : Receive command
+@param[in] u_int32 ul_length : Length of the command
+@param[out] TG_GPS_OUTPUT_FORMAT* peFormat : Command format information
+@return int32
+@retval RET_NORMAL : Normal
+@retval RET_ERROR : Abnormality
+*******************************************************************************/
+int32 CheckSendCmdGpsCommon(const u_char *p_rcv_data, u_int32 ul_length, TG_GPS_OUTPUT_FORMAT *p_format) {
+ u_int32 ret = RET_NORMAL;
+ u_int32 cnt = 0; /* Ignore -> MISRA-C:2004 Rule 5.6 */
+
+ /** Analysis of received commands */
+ for (cnt = 0; cnt < (u_int32)GPSCMDANATBL_MAX; cnt++) {
+ /** End-of-table decision */
+ if (CheckFrontStringPartGpsCommon((const u_char*)ENDMARK, kGpsCmdAnaTbl[cnt].c_sentence) == RET_NORMAL) {
+ /** When there is no matching sentence */
+
+ /** Return value setting */
+ ret = RET_ERROR; /* Ignore -> MISRA-C:2004 Rule 3.1 */
+ break;
+ }
+
+ /** Sentence determination of received command */
+ if (CheckFrontStringPartGpsCommon(p_rcv_data, kGpsCmdAnaTbl[cnt].c_sentence) == RET_NORMAL) {
+ if (ul_length == kGpsCmdAnaTbl[cnt].ul_length) {
+ /** When the sentences match */
+
+ /** Reception type determination */
+ if ( kGpsCmdAnaTbl[cnt].ul_rcv_kind == RCV_RESP ) {
+ /** Response monitor format setting */
+ *p_format = kGpsCmdAnaTbl[cnt].e_rcv_format;
+ } else {
+ /** Return value setting */
+ ret = RET_ERROR; /* Ignore -> MISRA-C:2004 Rule 3.1 */
+ }
+
+ break; /* Ignore -> MISRA-C:2004 Rule 14.6 */
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+/**
+ * @brief
+ * Get a string of fields from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_dst Pointer to the output area
+ * @param[in] size Maximum output size
+ *
+ * @return Size
+ */
+int32_t GetStringFromNmeaGpsCommon(u_int8 field_number, u_int8* p_src, char* p_dst, size_t size ) {
+ uint8_t* ptr = NULL;
+ /* int32_t numeric; */
+ uint32_t i = 0;
+ int32_t cnt = 0;
+ int8_t buf[GPS_NMEA_FIELD_LEN_MAX] = {0};
+
+ /* Null check */
+ if ((p_src == NULL) || (p_dst == NULL)) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p, p_dst=%p]", p_src, p_dst);
+ return 0;
+ }
+
+ ptr = p_src;
+
+ for (i = 0; i <= GPS_NMEA_MAX_SZ; i++) {
+ if (cnt == field_number) {
+ break;
+ }
+
+ if (*ptr == NMEA_DATA_SEPARATOR) {
+ cnt++;
+ }
+
+ ptr++;
+ }
+
+ i = 0;
+ if (*ptr != NMEA_DATA_SEPARATOR) {
+ for (i = 0; i < (GPS_NMEA_FIELD_LEN_MAX - 1); i++) {
+ buf[i] = *ptr;
+ ptr++;
+
+ if ((*ptr == NMEA_DATA_SEPARATOR) || (*ptr == NMEA_CHECKSUM_CHAR)) {
+ i++;
+ break;
+ }
+ }
+ }
+
+ buf[i] = '\0';
+ strncpy(p_dst, (const char *)buf, size);
+
+ return i;
+}
+
+/**
+ * @brief
+ * Get the number (real type) of a field from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_valid Validity of numerical data
+ *
+ * @return Real-number - double
+ */
+double_t GetNumericFromNmeaGpsCommon(u_int8 field_number, u_int8* p_src, BOOL* p_valid) {
+ double_t numeric = 0;
+ char buf[GPS_NMEA_FIELD_LEN_MAX] = {0};
+ int32_t ret = 0;
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ ret = GetStringFromNmeaGpsCommon(field_number, p_src, buf, GPS_NMEA_FIELD_LEN_MAX);
+
+ if (ret > 0) {
+ numeric = atof((const char *)buf);
+ *p_valid = TRUE;
+ } else {
+ *p_valid = FALSE;
+ }
+
+ return numeric;
+}
+
+/**
+ * @brief
+ * Get the integer value (integer type) of a field from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ *
+ * @return Integer - int32
+ */
+int32 GetIntegerFromNmeaGpsCommon(u_int8 field_number, u_int8* p_src) {
+ int32_t integer = 0;
+ char buf[GPS_NMEA_FIELD_LEN_MAX] = {0};
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ GetStringFromNmeaGpsCommon(field_number, p_src, buf, GPS_NMEA_FIELD_LEN_MAX);
+ integer = atoi((const char *)buf);
+
+ return integer;
+}
+
+/**
+ * @brief
+ * Get the latitude/longitude of the given fi eld from the NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_valid Validity of the data
+ *
+ * @return Latitude and longitude [1/256 sec]
+ */
+int32_t GetLonLatFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid) {
+ int32_t result = 0;
+ double_t value = 0.0;
+ int32_t deg = 0;
+ double_t min = 0.0;
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ value = GetNumericFromNmeaGpsCommon(field_number, p_src, p_valid);
+
+ if ((value < 0.0) || (value > 0.0)) {
+ deg = (int32_t)(value / 100.0f);
+ min = (double_t)(value - (deg * 100.0f));
+ result = (int32_t)(((60.0f * 60.0f * 256.0f) * deg) + ((60.0f * 256.0f) * min));
+ }
+
+ return result;
+}
+
+/**
+ * @brief
+ * Get the orientation of any fields from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_valid Validity of the data
+ *
+ * @return Orientation[0.01 degree]
+ */
+u_int16 GetHeadingFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid) {
+ u_int16 result = 0;
+ double_t value = 0.0;
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ value = GetNumericFromNmeaGpsCommon(field_number, p_src, p_valid);
+
+ result = (u_int16)((value + 0.005f) * 100.0f);
+
+ return result;
+}
+
+
+/**
+ * @brief
+ * Get the orientation of any fields from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_valid Validity of the data
+ *
+ * @return speed[0.01m/s]
+ */
+u_int16 GetSpeedFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid) {
+ u_int16 result = 0;
+ double_t value = 0.0;
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ value = GetNumericFromNmeaGpsCommon(field_number, p_src, p_valid);
+
+ // speed[0.01m/s]
+ result = static_cast<u_int16>(value * 1.852 * 100 / 3.6);
+
+ return result;
+}
+
+/**
+ * @brief
+ * Get the altitude of certain fields from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_valid Validity of the data
+ *
+ * @return Altitude [0.01m]
+ */
+int32 GetAltitudeFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid) {
+ int32 result = 0;
+ double_t value = 0.0;
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ value = GetNumericFromNmeaGpsCommon(field_number, p_src, p_valid);
+
+ result = static_cast<int32>((value + 0.005f) * 100.0f);
+
+ return result;
+}
+
+/**
+ * @brief
+ * GPS Control Thread Stop Processing
+ */
+void StopThreadGpsCommon(void) {
+ /** Stop the start confirmation monitoring timer */
+ (void)DevGpsTimeStop(GPS_STARTUP_TIMER); /* Start confirmation monitoring timer */
+
+ /** Stop the periodic reception data monitoring timer */
+ (void)DevGpsTimeStop(GPS_CYCL_TIMER); /* Periodic reception data monitoring timer */
+
+ /** Stop the ACK reception monitoring timer */
+ (void)DevGpsTimeStop(GPS_RECV_ACK_TIMER); /* ACK reception monitoring timer */
+
+ /** Stop the Navigation Providing Monitor Timer */
+ (void)DevGpsTimeStop(GPS_NAVIFST_TIMER); /* Initial Navigation Monitoring Timer */
+
+ /** Stop the Navigation Providing Monitor Timer */
+ (void)DevGpsTimeStop(GPS_NAVICYCLE_TIMER); /* Navi monitoring timer */
+
+ /** Stop the Navigation Providing Monitor Timer */
+ (void)DevGpsTimeStop(GPS_NAVIDISRPT_TIMER); /* Navigation Monitoring Disruption Log Output Timer */
+
+ /** Stop Time Offering Monitor Timer */
+ /* (void)DevGpsTimeStop(GPS_DIAGCLK_GUARDTIMER); */ /* Time Offering Monitoring Timer */
+
+ PosTeardownThread(ETID_POS_GPS);
+
+ /* don't arrive here */
+ return;
+}
+
+/**
+ * @brief
+ * GPS format order determination process
+ *
+ * @param[in] s_format_1 GPS format1
+ * @param[in] s_format_2 GPS format2
+ * @return 0 Format 1 first<br>
+ * 1 Format 2 first<br>
+ * 2 Same as<br>
+ * 3 Unable to determine
+ */
+uint8_t JudgeFormatOrderGpsCommon(TG_GPS_OUTPUT_FORMAT s_format_1, TG_GPS_OUTPUT_FORMAT s_format_2) {
+ uint8_t ret = 3;
+ u_int32 cnt = 0;
+
+ if (s_format_1 == s_format_2) {
+ ret = 2;
+ } else if ((s_format_1 == GPS_FORMAT_MAX) || (s_format_2 == GPS_FORMAT_MIN)) {
+ ret = 1;
+ } else {
+ for (cnt = 0; cnt < static_cast<u_int32>(GPSCMDANATBL_MAX); cnt++) {
+ /** End-of-table decision */
+ if (CheckFrontStringPartGpsCommon((const u_char*)ENDMARK, kGpsCmdAnaTbl[cnt].c_sentence) == RET_NORMAL) {
+ /** There is no matching sentence */
+ ret = 3;
+ break;
+ }
+
+ if (kGpsCmdAnaTbl[cnt].e_rcv_format == s_format_1) {
+ ret = 0;
+ break;
+ } else if (kGpsCmdAnaTbl[cnt].e_rcv_format == s_format_2) {
+ ret = 1;
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Get NMEA index process
+ *
+ * @param[in] iFmt GPS formats
+ * @return NMEA indexes
+ */
+ENUM_GPS_NMEA_INDEX GetNmeaIdxGpsCommon(TG_GPS_OUTPUT_FORMAT s_output_format) {
+ ENUM_GPS_NMEA_INDEX ret = GPS_NMEA_INDEX_MAX;
+
+ switch (s_output_format) {
+ case GPS_FORMAT_GGA:
+ /* GGA */
+ ret = GPS_NMEA_INDEX_GGA;
+ break;
+ case GPS_FORMAT_DGGA:
+ /* DGGA */
+ ret = GPS_NMEA_INDEX_DGGA;
+ break;
+ case GPS_FORMAT_VTG:
+ /* VTG */
+ ret = GPS_NMEA_INDEX_VTG;
+ break;
+ case GPS_FORMAT_RMC:
+ /* RMC */
+ ret = GPS_NMEA_INDEX_RMC;
+ break;
+ case GPS_FORMAT_DRMC:
+ /* DRMC */
+ ret = GPS_NMEA_INDEX_DRMC;
+ break;
+ case GPS_FORMAT_GLL:
+ /* GLL */
+ ret = GPS_NMEA_INDEX_GLL;
+ break;
+ case GPS_FORMAT_DGLL:
+ /* DGLL */
+ ret = GPS_NMEA_INDEX_DGLL;
+ break;
+ case GPS_FORMAT_GSA:
+ /* GSA */
+ ret = GPS_NMEA_INDEX_GSA;
+ break;
+ case GPS_FORMAT_GSV1:
+ /* GSV(1) */
+ ret = GPS_NMEA_INDEX_GSV1;
+ break;
+ case GPS_FORMAT_GSV2:
+ /* GSV(2) */
+ ret = GPS_NMEA_INDEX_GSV2;
+ break;
+ case GPS_FORMAT_GSV3:
+ /* GSV(3) */
+ ret = GPS_NMEA_INDEX_GSV3;
+ break;
+ case GPS_FORMAT_GSV4:
+ /* GSV(4) */
+ ret = GPS_NMEA_INDEX_GSV4;
+ break;
+ case GPS_FORMAT_GSV5:
+ /* GSV(5) */
+ ret = GPS_NMEA_INDEX_GSV5;
+ break;
+ case GPS_FORMAT_GST:
+ /* GST */
+ ret = GPS_NMEA_INDEX_GST;
+ break;
+ case GPS_FORMAT__CWORD44__GP3:
+ /* _CWORD44_,GP,3 */
+ ret = GPS_NMEA_INDEX__CWORD44__GP_3;
+ break;
+ case GPS_FORMAT__CWORD44__GP4:
+ /* _CWORD44_,GP,4 */
+ ret = GPS_NMEA_INDEX__CWORD44__GP_4;
+ break;
+ case GPS_FORMAT_P_CWORD82_F_GP0:
+ /* P_CWORD82_F,GP,0 */
+ ret = GPS_NMEA_INDEX_P_CWORD82_F_GP_0;
+ break;
+ case GPS_FORMAT_P_CWORD82_J_GP1:
+ /* P_CWORD82_J,GP,1 */
+ ret = GPS_NMEA_INDEX_P_CWORD82_J_GP_1;
+ break;
+ default:
+ /* nop */
+ break;
+ }
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS reset request command transmission processing
+ */
+void SendResetReqGpsCommon(void) {
+ T_APIMSG_MSGBUF_HEADER s_msg_header; /* Message header */
+ POS_RESETINFO s_send_msg; /* Reset information */
+ u_int8 uc_send_buf[(sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(POS_RESETINFO))]; /* Transmitting buffer */
+ RET_API ret = RET_NORMAL;
+
+ /* Send reset request */
+ POSITIONING_LOG("GPS Reset Request");
+
+ /* <<Creation of message header section>>>> */
+ s_msg_header.signo = 0; /* Signal information setting */
+ s_msg_header.hdr.sndpno = PNO_NAVI_GPS_MAIN; /* Source thread No. setting */
+ s_msg_header.hdr.respno = PNO_NAVI_GPS_MAIN; /* Destination process No. */
+ s_msg_header.hdr.cid = CID_GPS_REQRESET; /* Command ID setting */
+ s_msg_header.hdr.msgbodysize = sizeof(POS_RESETINFO); /* Message data length setting */
+ s_msg_header.hdr.rid = 0; /* Resource ID Setting */
+ s_msg_header.hdr.reserve = 0; /* Reserved area clear */
+
+ (void)memcpy(&uc_send_buf[ 0 ], &s_msg_header, sizeof(T_APIMSG_MSGBUF_HEADER));
+
+ /* <<Creation of data section>> */
+ s_send_msg.mode = GPS_RST_COLDSTART; /* Reset mode */
+ s_send_msg.sndpno = PNO_NAVI_GPS_MAIN; /* Caller PNo. */
+ s_send_msg.respno = PNO_NAVI_GPS_MAIN; /* Destination PNo. */
+ s_send_msg.reserve[0] = 0;
+ s_send_msg.reserve[1] = 0;
+ s_send_msg.reserve[2] = 0;
+
+ /* Copy data to send buffer */
+ (void)memcpy( &uc_send_buf[ sizeof( T_APIMSG_MSGBUF_HEADER ) ], &s_send_msg, sizeof(POS_RESETINFO) );
+
+ /* <<Messaging>> */
+ ret = _pb_SndMsg(PNO_NAVI_GPS_MAIN, sizeof(uc_send_buf), reinterpret_cast<void *>(uc_send_buf), 0);
+
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("GPS Reset Request Error[ret = %d]", ret);
+ }
+}
+
+
+
+void DevGpsCommSettingTime(void) {
+ TG_GPS_SND_DATA *pst_rcv_data;
+ RET_API ret = RET_NORMAL;
+
+ pst_rcv_data = reinterpret_cast<TG_GPS_SND_DATA*>(&(g_gps_msg_rcvr.msgdat[0]));
+
+ ret = DevGpsResetReq(PNO_NONE, 0);
+ if (RET_NORMAL != ret) {
+ POSITIONING_LOG("DevGpsResetReq failed.");
+ } else {
+ /* Time setting(u-blox) */
+ DevGpsSettingTime(reinterpret_cast<POS_DATETIME *>(pst_rcv_data->ub_data));
+ }
+ return;
+}
+
+void DevGpsReadGpsTime(POS_DATETIME* pst_datetime) {
+ int32_t ret;
+ ST_GPS_SET_TIME buf;
+ POS_DATETIME st_datetime;
+ memset(&st_datetime, 0, sizeof(st_datetime));
+
+ // if (isGpsTimeStatusProof == TRUE) {
+ /* Clear the flag if the date and time status has already been calibrated. */
+ // WriteGpsTimeToBackup(FALSE, &st_datetime);
+ // POSITIONING_LOG("D_BK_ID_POS_GPS_TIME_SET_INFO:W:Clear");
+ // } else {
+ /* Read from backup RAM */
+ ret = Backup_DataRd(D_BK_ID_POS_GPS_TIME_SET_INFO, 0, &buf, sizeof(ST_GPS_SET_TIME));
+ if (ret == BKUP_RET_NORMAL) {
+ pst_datetime->year = buf.year;
+ pst_datetime->month = buf.month;
+ pst_datetime->date = buf.date;
+ pst_datetime->hour = buf.hour;
+ pst_datetime->minute = buf.minute;
+ pst_datetime->second = buf.second;
+
+ /* Update of the date/time status fixed value setting indication flag */
+ if (buf.flag == TRUE) {
+ g_is_gpstime_sts = TRUE;
+ POSITIONING_LOG("g_is_gpstime_sts = TRUE");
+ POSITIONING_LOG("%d/%d/%d %d:%d:%d", buf.year,
+ buf.month,
+ buf.date,
+ buf.hour,
+ buf.minute,
+ buf.second);
+ } else {
+ g_is_gpstime_sts = FALSE;
+ POSITIONING_LOG("g_is_gpstime_sts = FALSE");
+ }
+ } else {
+ POSITIONING_LOG("Backup_DataRd ERROR!! [ret=%d]", ret);
+ }
+ // }
+ return;
+}
+
+RET_API GpsSetPosBaseEvent(uint16_t ul_snd_pno, int32_t event_val) {
+ RET_API ret = RET_ERROR; /* Return value */
+ EventID ul_eventid = 0; /* Event ID */
+ char event_name[32]; /* Event name character string buffer */
+
+ memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name));
+ snprintf(event_name, sizeof(event_name), "VEHICLE_%X", ul_snd_pno);
+ /* Event Generation */
+ ul_eventid = _pb_CreateEvent(FALSE, 0, event_name);
+
+ // initialize EventID
+ if (0 != ul_eventid) {
+ ret = _pb_SetEvent(ul_eventid, SAPI_EVSET_ABSOLUTE, VEHICLE_EVENT_VAL_INIT);
+ if (RET_NORMAL != ret) {
+ /* Delete event and return event generation failed */
+ ret = _pb_DeleteEvent(ul_eventid);
+ ul_eventid = 0;
+ }
+ }
+
+ if (0 != ul_eventid) {
+ /* Event publishing(Event wait release) */
+ ret = _pb_SetEvent(ul_eventid, SAPI_EVSET_ABSOLUTE, event_val);
+ if (RET_NORMAL != ret) {
+ /* Event issuance failure */
+ POSITIONING_LOG("set Event failed.");
+ }
+ /* Event deletion */
+ _pb_DeleteEvent(ul_eventid);
+ } else {
+ /* Event generation failure */
+ POSITIONING_LOG("create Event failed.");
+ }
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS reset response command reception processing
+ *
+ * @param[in] p_data Pointer to the received GPS command
+ */
+BOOL DevGpsRcvProcGpsResetResp(TG_GPS_RCV_DATA* p_data) {
+ RET_API ret;
+ u_int32 ul_reset_sts = GPS_SENDNG;
+ BOOL b_snd_flag = TRUE;
+ uint8_t *p_gps_data;
+ char date[6]; /* ddmmyy */
+ char work[8]; /* Work buffer for converting String data */
+
+ if (p_data == NULL) {
+ POSITIONING_LOG("Argument ERROR!! [p_data = %p]", p_data);
+ } else {
+ p_gps_data = p_data->bygps_data;
+
+ /* Checksum determination */
+ ret = CheckSumGpsCommon(p_gps_data, p_data->bydata_len, GPS_FORMAT_RMC);
+ if (ret == RET_NORMAL) {
+ /* Get Date information */
+ GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_DATE, p_gps_data, date, 6);
+
+ strncpy(work, &date[4], 2);
+
+ if (atoi(work) == 0) {
+ ul_reset_sts = GPS_SENDOK; /* Reset Successful */
+ /* Reissuing commands to a GPS device from here */
+ /* Send NAV-TIMEUTC sentence addition requests */
+ DevGpsNavTimeUTCAddReq();
+ }
+ POSITIONING_LOG("reset flag = %d, year after reset = %s", ul_reset_sts, work);
+ } else {
+ b_snd_flag = FALSE; /* If the checksum is NG, wait for the next reply message without sending a callback. */
+ POSITIONING_LOG("wrong checksum [ret = %d]", ret);
+ }
+
+ if (b_snd_flag == TRUE) {
+ /** Drop the time status to an abnormal time */
+ // Todo Suntec MACRO __CWORD71_ Disable, This Functions do nothing actrually.
+ // DEV_Gps_SetTimeStatus_NG();
+
+ /** Send Reset Response(Successful transmission) */
+ DevGpsRstAnsSend(g_gps_mngr.resp_pno, g_gps_mngr.resp_rid, ul_reset_sts);
+
+ POSITIONING_LOG("DEV_Gps_RstAndSend CALL!! [ul_reset_sts = %d]", ul_reset_sts);
+
+ /** Clear reset command sending judgment flag */
+ g_gps_reset_cmd_sending = FALSE;
+ }
+ }
+ return b_snd_flag;
+}
+
+/**
+ * @brief
+ * GPS time setting response command reception processing
+ *
+ * @param[in] p_data Pointer to the received GPS command
+ */
+void DevGpsRcvProcTimeSetResp(TG_GPS_RCV_DATA* p_data) {
+ u_int32 ul_reset_sts = GPS_SENDNG;
+ BOOL b_snd_flag = TRUE;
+ POS_DATETIME st_datetime; /* Setting time */
+ uint16_t set_gpsw;
+ uint32_t set_gpsws;
+ uint16_t rcv_gpsw;
+ uint32_t rcv_gpsws;
+ BOOL ret = FALSE;
+ int32_t status;
+
+ if (p_data == NULL) {
+ POSITIONING_LOG("Argument ERROR!! [p_data = %p]", p_data);
+ } else {
+ /* Read from backup RAM */
+ status = Backup_DataRd(D_BK_ID_POS_GPS_TIME_SET_INFO, 0, &st_datetime, sizeof(ST_GPS_SET_TIME));
+ if (status == BKUP_RET_NORMAL) {
+ /* Convert to GSP week number, GPS week second */
+ DevGpsYMD2GPSTIME(static_cast<int32>(st_datetime.year),
+ static_cast<int32>(st_datetime.month),
+ static_cast<int32>(st_datetime.date), static_cast<int32>(st_datetime.hour),
+ static_cast<int32>(st_datetime.minute),
+ static_cast<int32>(st_datetime.second), &set_gpsw, &set_gpsws);
+
+ memcpy(&rcv_gpsw, &(p_data->bygps_data[24]), sizeof(uint16_t));
+ memcpy(&rcv_gpsws, &(p_data->bygps_data[26]), sizeof(uint32_t));
+ rcv_gpsws /= 1000; /* Convert week (ms) to week (s) */
+ POSITIONING_LOG("recived gpsw[%d] gpsws[%d]\n", rcv_gpsw, rcv_gpsws);
+
+ /* Check if GPS week number and GPS week second are within valid range */
+ ret = DevGpsCheckGpsTime(set_gpsw, set_gpsws, rcv_gpsw, rcv_gpsws, GPS_SETTIME_RANGE);
+ if (ret == TRUE) {
+ /* Date/Time Status Fixed Value Setting Indication Flag ON */
+ g_is_gpstime_sts = TRUE;
+ POSITIONING_LOG("g_is_gpstime_sts = TRUE");
+
+ /* Time Setting Successful : Update backup RAM time */
+ ul_reset_sts = GPS_SENDOK;
+ WriteGpsTimeToBackup(TRUE, &st_datetime);
+ POSITIONING_LOG("SetGpsTime Success");
+ POSITIONING_LOG("D_BK_ID_POS_GPS_TIME_SET_INFO:W:%d/%d/%d %d:%d:%d",
+ st_datetime.year,
+ st_datetime.month,
+ st_datetime.date,
+ st_datetime.hour,
+ st_datetime.minute,
+ st_datetime.second);
+ } else {
+ /* Time setting error (Difference in set time): Time deletion of backup RAM */
+ memset(&st_datetime, 0, sizeof(st_datetime));
+ WriteGpsTimeToBackup(FALSE, &st_datetime);
+ POSITIONING_LOG("SetGpsTime failed\n");
+ POSITIONING_LOG("D_BK_ID_POS_GPS_TIME_SET_INFO:W:Clear\n");
+ }
+ } else {
+ /* Backup RAM read failed */
+ b_snd_flag = FALSE;
+ POSITIONING_LOG("Backup_DataRd ERROR!! [status=%d", status);
+ }
+
+ if (b_snd_flag == TRUE) {
+ /** Send Time Set Response */
+ DevGpsTimesetAnsSend(g_gps_mngr.resp_pno, g_gps_mngr.resp_rid, ul_reset_sts);
+
+ POSITIONING_LOG("DEV_Gps_TimesetAndSend CALL!! [ul_reset_sts = %d]", ul_reset_sts);
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+ * GPS rollover standard week number acquisition response reception processing
+ *
+ * @param[in] p_data Pointer to the received GPS command
+ */
+void DevGpsRcvProcWknRolloverGetResp(TG_GPS_RCV_DATA* p_data) {
+ RET_API ret;
+ SENSOR_WKN_ROLLOVER_HAL st_wkn_rollover;
+
+ if (p_data == NULL) {
+ POSITIONING_LOG("Argument ERROR!! [p_data = %p]", p_data);
+ } else {
+ /* Checksum determination */
+ ret = CheckSumGpsCommon(p_data->bygps_data, p_data->bydata_len, GPS_FORMAT_CFG_NAVX5);
+ if (ret == RET_NORMAL) {
+ /* Version information extraction */
+ (void)memcpy(&(st_wkn_rollover.us_wkn),
+ &(p_data->bygps_data[UBX_CMD_OFFSET_PAYLOAD + UBX_CMD_OFFSET_WKNROLLOVER]),
+ sizeof(st_wkn_rollover.us_wkn));
+ POSITIONING_LOG("wknRollover=%d", st_wkn_rollover.us_wkn);
+
+ // gwknRollover = st_wkn_rollover.us_wkn;
+
+ /* Send reference week number to vehicle sensor */
+ ret = DevGpsSndWknRollover(&st_wkn_rollover);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("VehicleUtility_pb_SndMsg ERROR!! [ret=%d]", ret);
+ }
+ } else {
+ POSITIONING_LOG("CheckSumGpsCommon ERROR!! [ret = %d]", ret);
+ }
+
+ if (ret != RET_NORMAL) {
+ /* GPS rollover standard week number acquisition request retransmission */
+ ret = DevGpsWknRolloverGetReq();
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("DevGpsWknRolloverGetReq ERROR!! [ret=%d]", ret);
+ }
+ }
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Receiving additional responses to NAV-SVINFO commands
+ *
+ * @param[in] p_data Pointer to the received GPS command
+ */
+void DevGpsRcvProcNavSvinfoAddResp(TG_GPS_RCV_DATA* p_data) {
+ RET_API ret;
+ /* Common Response Command Reception Processing */
+ ret = DevGpsRcvProcCmnResp(p_data, GPS_CMD_SENTENCEADD_NAVSVINFO);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("DEV_Gps_RcvProcCmnResp(ADD_NAVSVINFO) ERROR!!");
+ /* Retransmission of requests to add NAV-SVINFO commands */
+ (void)DevGpsNavTimeUTCAddReq();
+ }
+ return;
+}
+
+
+/**
+ * @brief
+ * Common processing when a GPS receiver error is detected
+ */
+void GpsReceiverErrGpsCommon(void) {
+ BOOL *pb_rcv_err = &(g_gps_mngr.rcv_err_flag); /* GSP receiver error detection status */
+
+ /* Update GPS receiver anomaly detection flag */
+ *pb_rcv_err = TRUE;
+
+ DevSendGpsConnectError(TRUE);
+
+ return;
+}
+
+
+/**
+ * @brief
+ * GPS device setting response reception processing
+ *
+ * @param[in] p_data Pointer to the received GPS command
+ * @param[in] cmd Command in the configuration request
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR ABENDs
+ */
+RET_API DevGpsRcvProcCmnResp(TG_GPS_RCV_DATA* p_data, uint8_t cmd) {
+ RET_API ret = RET_ERROR;
+ uint8_t is_ack; /* 1=ACK, 0=NACK */
+ TG_GPS_UBX_ACK_DATA st_ack;
+ uint8_t *puc_msg_class = &(st_ack.uc_msg_class);
+ uint8_t *puc_msg_id = &(st_ack.uc_msg_id);
+
+ if (p_data == NULL) {
+ POSITIONING_LOG("Argument ERROR!![p_data=%p]", p_data);
+ } else {
+ /* Checksum determination */
+ ret = CheckSumGpsCommon(p_data->bygps_data, p_data->bydata_len, GPS_FORMAT_ACK_ACKNACK);
+ if (ret == RET_NORMAL) {
+ is_ack = p_data->bygps_data[UBX_CMD_OFFSET_ACKNAK];
+ if (is_ack == 1) {
+ /* Response command information extraction */
+ (void)memcpy(&st_ack, &(p_data->bygps_data[UBX_CMD_OFFSET_PAYLOAD]), sizeof(st_ack));
+ POSITIONING_LOG("msgClass=0x%02x, msgID=0x%02x", *puc_msg_class, *puc_msg_id);
+
+ /* When the response wait command does not match the reception command */
+ if (((cmd == GPS_CMD_SENTENCEADD_NMEAGST) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x01))) ||
+ ((cmd == GPS_CMD_SENTENCEADD_NAVTIMEUTC) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x01))) ||
+ ((cmd == GPS_CMD_SENTENCEADD_NAVCLOCK) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x01))) ||
+ ((cmd == GPS_CMD_SENTENCEADD_RXMRTC5) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x01))) ||
+ ((cmd == GPS_CMD_SENTENCEADD_NAVSVINFO) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x01))) ||
+ ((cmd == GPS_CMD_AUTOMOTIVEMODE) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x24)))) {
+ POSITIONING_LOG("Invalid ACK/NACK!! [cmd=%d, msgClass=0x%02x, msgID=0x%02x]\n",
+ cmd, *puc_msg_class, *puc_msg_id);
+ ret = RET_ERROR;
+ }
+ } else {
+ ret = RET_ERROR;
+ }
+ } else {
+ POSITIONING_LOG("DEV_Gps_ChkSum ERROR!![ret=%d]", ret);
+ }
+ }
+ return ret;
+}
+
+
+RET_API DevGpsResetReq(PNO us_pno, RID uc_rid) {
+ RET_API ret;
+ TG_GPS_SAVECMD st_save_cmd;
+ TG_GPS_SND_DATA* pst_snd_data;
+ uint8_t* p_ublox_data;
+
+ /* SYNC_CHAR_1_2 CLASS ID length(L/U) */
+ static const u_int8 csnd_cmd[] = { 0xB5, 0x62, 0x06, 0x04, 0x04, 0x00,
+ /* navBbrMask(L/U) resetMode/res CK_A CK_B */
+ 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00 };
+
+ pst_snd_data = &(st_save_cmd.sndcmd);
+ p_ublox_data = pst_snd_data->ub_data;
+
+ memset(&st_save_cmd, 0x00, sizeof(st_save_cmd));
+ memcpy(p_ublox_data, csnd_cmd, UBX_CMD_SIZE_CFG_RST);
+
+ /* Checksum assignment */
+ DevGpsSetChkSum(p_ublox_data, UBX_CMD_SIZE_CFG_RST);
+
+ pst_snd_data->us_size = UBX_CMD_SIZE_CFG_RST;
+ st_save_cmd.us_pno = us_pno; /* Result notification destination process number */
+ st_save_cmd.uc_rid = uc_rid; /* Result Notification Resource ID */
+ st_save_cmd.uc_rst = GPS_CMD_RESET; /* Reset flag */
+ st_save_cmd.e_cmd_info = GPS_FORMAT_RMC; /* Command information */
+
+ /* Command is suspended and terminated. */
+ ret = DevGpsSaveCmd(&st_save_cmd);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("# GpsCommCtl # GPS Command Reserve bufferFull !");
+
+ /** When the pending buffer is full, a reset response (communication error) is returned. */
+ DevGpsRstAnsSend(st_save_cmd.us_pno, st_save_cmd.uc_rid, GPS_SENDNG);
+ }
+
+ return ret;
+}
+
+void DevGpsSettingTime(POS_DATETIME* pst_datetime) {
+ RET_API ret;
+ TG_GPS_SAVECMD st_save_cmd;
+ TG_GPS_SND_DATA* pst_snd_data;
+ uint8_t* p_ublox_data;
+ TG_GPS_UBX_AID_INI_POLLED* pst_ublox_data;
+
+ uint16_t gpsw;
+ uint32_t gpsws;
+
+ if (pst_datetime == NULL) {
+ POSITIONING_LOG("Argument ERROR!! [pstDataTime = %p]", pst_datetime);
+ } else {
+ pst_snd_data = &(st_save_cmd.sndcmd);
+ p_ublox_data = pst_snd_data->ub_data;
+
+ (void)memset(&st_save_cmd, 0x00, sizeof(st_save_cmd));
+
+ /* Convert to GSP week number, GPS week second */
+ (void)DevGpsYMD2GPSTIME(static_cast<int32>(pst_datetime->year),
+ static_cast<int32>(pst_datetime->month),
+ static_cast<int32>(pst_datetime->date),
+ static_cast<int32>(pst_datetime->hour),
+ static_cast<int32>(pst_datetime->minute),
+ static_cast<int32>(pst_datetime->second), &gpsw, &gpsws);
+
+
+ /* Send command sequence generation */
+ pst_ublox_data = reinterpret_cast<TG_GPS_UBX_AID_INI_POLLED*>(reinterpret_cast<void *>(p_ublox_data));
+ pst_ublox_data->uc_sync_char1 = 0xB5;
+ pst_ublox_data->uc_sync_char2 = 0x62;
+ pst_ublox_data->uc_class = 0x0B;
+ pst_ublox_data->uc_id = 0x01;
+ pst_ublox_data->uc_length[0] = 0x30;
+ pst_ublox_data->uc_length[1] = 0x00;
+ pst_ublox_data->uc_flags[0] = 0x02; /* Time setting: The second bit from the low order is 1. */
+
+ (void)memcpy(pst_ublox_data->wn, &gpsw, sizeof(uint16_t));
+
+ gpsws *= 1000;
+ (void)memcpy(pst_ublox_data->tow, &gpsws, sizeof(uint32_t));
+
+ /* Checksum assignment */
+ DevGpsSetChkSum(reinterpret_cast<u_int8 *>(reinterpret_cast<void*>(pst_ublox_data)),
+ UBX_CMD_SIZE_AID_INI);
+
+ /* Concatenate Poll Request Command */
+ ret = DevGpsCatPollReq(p_ublox_data, UBX_POLL_CMD_KIND_AID_INI);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("DEV_Gps_CatPollReqUblox ERROR!! [ret = %d]", ret);
+ } else {
+ pst_snd_data->us_size = UBX_CMD_SIZE_AID_INI_PLUS_POLL;
+ st_save_cmd.us_pno = PNO_VEHICLE_SENSOR; /* Result notification destination process number */
+ st_save_cmd.uc_rid = 0; /* Result Notification Resource ID */
+ st_save_cmd.uc_rst = GPS_CMD_TIMESET; /* Response flag */
+ st_save_cmd.e_cmd_info = GPS_FORMAT_AID_INI;/* Command information */
+
+ /* Command is suspended and terminated. */
+ ret = DevGpsSaveCmd(&st_save_cmd);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("DevGpsSaveCmd ERROR!! [ret = %d]", ret);
+ /* Todo: retransmission by timer */
+ }
+ /* Update non-volatile of time setting */
+ WriteGpsTimeToBackup(FALSE, pst_datetime);
+ /* Waiting for a GPS device to respond */
+ g_is_gpstime_sts = FALSE;
+ POSITIONING_LOG("Start SetGpsTime\n");
+ POSITIONING_LOG("D_BK_ID_POS_GPS_TIME_SET_INFO:W:%d/%d/%d %d:%d:%d\n",
+ pst_datetime->year,
+ pst_datetime->month,
+ pst_datetime->date,
+ pst_datetime->hour,
+ pst_datetime->minute,
+ pst_datetime->second);
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Converting from the Gregorian calendar to the Julian Day of Modification
+ *
+ * @param[in] y year
+ * @param[in] m month
+ * @param[in] d day
+ *
+ * @return Modified Julian Date
+ */
+int DevGpsYMD2JD(int y, int m, int d) {
+ double jd = JULIAN_DAY;
+ double tmp;
+ int mjd = 0;
+
+ if (m <= 2) { /* In January, February in December and 14th of the previous year */
+ y--;
+ m += 12;
+ }
+ y += 4800;
+ m -= 3;
+ d -= 1;
+
+ tmp = static_cast<double>(y / 400);
+ y %= 400;
+ jd += tmp * 146097;
+
+ tmp = static_cast<double>(y / 100);
+ y %= 100;
+ jd += tmp * 36524;
+
+ tmp = static_cast<double>(y / 4);
+ y %= 4;
+ jd += tmp * 1461;
+ jd += static_cast<double>(y * 365);
+
+ tmp = static_cast<double>(m / 5);
+ m %= 5;
+ jd += tmp * 153;
+
+ tmp = static_cast<double>(m / 2);
+ m %= 2;
+ jd += tmp * 61;
+ jd += static_cast<double>(m * 31);
+ jd += static_cast<double>(d);
+
+ mjd = static_cast<int>(jd - MODIFIED_JULIAN_DAY_OFFSET); /* Julian Date-> Modified Julian Date */
+
+ return mjd;
+}
+
+/**
+ * @brief
+ * Converting from year, month, day, hour, minute and second (GPS hour) to GPS week and GPS week seconds
+ *
+ * Converting y:year, m:month, d:day, hh:hour, mm:minute, ss:second (GPS hour) to GPS week/GPS week second
+ *
+ * @param[in] y year
+ * @param[in] m month
+ * @param[in] d day
+ * @param[in] hh hour
+ * @param[in] mm munites
+ * @param[in] ss sec
+ * @param[out] gpsw
+ * @param[out] gpsws
+ *
+ * @return TRUE / FALSE
+ */
+BOOL DevGpsYMD2GPSTIME(const int32 y, const int32 m, const int32 d, const int32 hh,
+ const int32 mm, const int32 ss, u_int16* gpsw, u_int32* gpsws) {
+ /*
+ MJD :Y year M month D date modified Julian date (Convert date to modified Julian date)
+ GPSW : GPS week
+ GPSWS: GPS week second
+ */
+ int mjd = DevGpsYMD2JD(y, m, d);
+
+ *gpsw = (uint16_t)((mjd - 44244) / 7);
+ *gpsws = (uint32_t)(((mjd - 44244 - (*gpsw * 7)) * 86400) +
+ (hh * 3600) + (mm * 60) + ss + 16); /* Add leap seconds ( 16 seconds) at 2015/1/1 */
+
+ if (*gpsws >= GPS_WS_MAX) {
+ (*gpsw)++;
+ *gpsws -= GPS_WS_MAX;
+ }
+
+ POSITIONING_LOG("*gpsw = %d, *gpsws = %d", *gpsw, *gpsws);
+
+ return TRUE;
+}
+
+/**
+ * @brief
+ * Concatenating Poll Request commands to UBX commands
+ *
+ * @param[in/out] *p_ublox_data Pointer to the concatenated UBX command
+ * @param[in] kind Additional command types
+ *
+ * @return RET_NORAML / RET_ERROR
+ */
+RET_API DevGpsCatPollReq(uint8_t *p_ublox_data, uint16_t kind) {
+ RET_API ret_api = RET_NORMAL;
+ TG_GPS_UBX_PACKET_HEADER *pst_ubx_pkg_hdr;
+ TG_GPS_UBX_COMMAND_NO_DATA *pst_ubx_poll_req;
+ uint32_t length;
+
+ /* Header ID length Checksum */
+ static uint8_t c_aidini_poll_cmd[] = {0xB5, 0x62, 0x0B, 0x01, 0x00, 0x00, 0x00, 0x00};
+ static uint8_t c_cfgnav5_poll_cmd[] = {0xB5, 0x62, 0x06, 0x24, 0x00, 0x00, 0x00, 0x00};
+
+ uint8_t* p_poll_cmd;
+ uint16_t poll_cmd_length;
+
+ if (p_ublox_data == NULL) {
+ POSITIONING_LOG("Argument ERROR!! [p_ublox_data=%p]", p_ublox_data);
+ ret_api = RET_ERROR;
+ } else {
+ if (kind == UBX_POLL_CMD_KIND_AID_INI) {
+ p_poll_cmd = c_aidini_poll_cmd;
+ poll_cmd_length = UBX_CMD_SIZE_AID_INI_POLL;
+ } else if (kind == UBX_POLL_CMD_KIND_CFG_NAV5) {
+ p_poll_cmd = c_cfgnav5_poll_cmd;
+ poll_cmd_length = UBX_CMD_SIZE_CFG_NAV5_POLL;
+ } else {
+ POSITIONING_LOG("Argument ERROR!! [kind=%d]", kind);
+ ret_api = RET_ERROR;
+ }
+
+ if (ret_api != RET_ERROR) {
+ pst_ubx_pkg_hdr = reinterpret_cast<TG_GPS_UBX_PACKET_HEADER*>(reinterpret_cast<void*>(p_ublox_data));
+ length = pst_ubx_pkg_hdr->us_length;
+
+ if (length == 0) {
+ POSITIONING_LOG("pst_ubx_pkg_hdr->us_length=0 ERROR!!");
+ ret_api = RET_ERROR;
+ } else {
+ /* Add Poll Request Command */
+ pst_ubx_poll_req = reinterpret_cast<TG_GPS_UBX_COMMAND_NO_DATA*>(reinterpret_cast<void*>(p_ublox_data +
+ length +
+ sizeof(TG_GPS_UBX_COMMAND_NO_DATA)));
+
+ memcpy(reinterpret_cast<void*>(pst_ubx_poll_req), reinterpret_cast<void*>(p_poll_cmd), poll_cmd_length);
+
+ DevGpsSetChkSum(reinterpret_cast<u_int8 *>(reinterpret_cast<void*>(pst_ubx_poll_req)), poll_cmd_length);
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+void DevGpsSetGpsweekcorcnt(void) {
+ CLOCKGPS_GPSWEEKCOR_CNT_MSG gpsweekcor_cnt_msg;
+ memcpy(&gpsweekcor_cnt_msg, &g_gps_msg_rcvr, sizeof(CLOCKGPS_GPSWEEKCOR_CNT_MSG));
+ g_gps_week_cor_cnt = gpsweekcor_cnt_msg.gpsweekcorcnt;
+ return;
+}
+
+RET_API DevGpsNavTimeUTCAddReq(void) {
+ RET_API ret;
+ TG_GPS_SAVECMD st_save_cmd;
+ TG_GPS_SND_DATA* pst_snd_data;
+ uint8_t* p_ublox_data;
+
+ /* SYNC_CHAR_1_2 CLASS ID length(L/U) Payload CK_A CK_B */
+ static const u_int8 csnd_cmd[] = { 0xB5, 0x62, 0x06, 0x01, 0x03, 0x00, 0x01, 0x21, 0x01, 0x00, 0x00 };
+
+ pst_snd_data = &(st_save_cmd.sndcmd);
+ p_ublox_data = pst_snd_data->ub_data;
+
+ memset(&st_save_cmd, 0x00, sizeof(st_save_cmd));
+
+ /* Send command generation */
+ memcpy(p_ublox_data, csnd_cmd, UBX_CMD_SIZE_CFG_MSG);
+
+ /* Checksum assignment */
+ DevGpsSetChkSum(p_ublox_data, UBX_CMD_SIZE_CFG_MSG);
+
+ pst_snd_data->us_size = UBX_CMD_SIZE_CFG_MSG;
+ st_save_cmd.us_pno = PNO_VEHICLE_SENSOR; /* Result notification destination process number */
+ st_save_cmd.uc_rid = 0; /* Result notification resource ID */
+ st_save_cmd.uc_rst = GPS_CMD_SENTENCEADD_NAVTIMEUTC; /* Response flag */
+ st_save_cmd.e_cmd_info = GPS_FORMAT_ACK_ACKNACK; /* Command information */
+
+ /* Command is suspended and terminated. */
+ ret = DevGpsSaveCmd(&st_save_cmd);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("# GpsCommCtl # GPS Command Reserve bufferFull !");
+ }
+
+ return ret;
+}
+
+RET_API DevGpsWknRolloverGetReq(void) {
+ RET_API ret;
+ TG_GPS_SAVECMD st_save_cmd;
+ TG_GPS_SND_DATA* pst_snd_data;
+ uint8_t* p_ublox_data;
+
+ /* SYNC_CHAR_1_2 CLASS ID length(L/U) CK_A CK_B */
+ static const u_int8 csnd_cmd[] = { 0xB5, 0x62, 0x06, 0x23, 0x00, 0x00, 0x00, 0x00 };
+
+ pst_snd_data = &(st_save_cmd.sndcmd);
+ p_ublox_data = pst_snd_data->ub_data;
+
+ (void)memset(&st_save_cmd, 0x00, sizeof(st_save_cmd)); /* QAC 3200 */
+
+ /* Send command generation */
+ (void)memcpy(p_ublox_data, csnd_cmd, UBX_CMD_SIZE_CFG_NAVX5_POLL); /* QAC 3200 */
+
+ /* Checksum assignment */
+ DevGpsSetChkSum(p_ublox_data, UBX_CMD_SIZE_CFG_NAVX5_POLL);
+
+ pst_snd_data->us_size = UBX_CMD_SIZE_CFG_NAVX5_POLL;
+ st_save_cmd.us_pno = PNO_VEHICLE_SENSOR; /* Result notification destination process number */
+ st_save_cmd.uc_rid = 0; /* Result notification resource ID */
+ st_save_cmd.uc_rst = GPS_CMD_WKNROLLOVER; /* Response flag */
+ st_save_cmd.e_cmd_info = GPS_FORMAT_CFG_NAVX5; /* Command information */
+
+ /* Command is suspended and terminated. */
+ ret = DevGpsSaveCmd(&st_save_cmd);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("# GpsCommCtl # GPS Command Reserve bufferFull !");
+ /* If an error occurs at this point that is not expected due to a command queue full error, retransmission control is required. */
+ }
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS time setting validity check process
+ *
+ * @param[in] set_gpsw Set GPS week
+ * @param[in] set_gpsws Set GPS Week
+ * @param[in] rcv_gpsw Answer GPS Week
+ * @param[in] rcv_gpsws Answer GPS Weeksec
+ * @param[in] offset_range Tolerance time difference[sec]
+ * @return BOOL TRUE:Effective time / FALSE:Invalid time
+ */
+BOOL DevGpsCheckGpsTime(uint16_t set_gpsw, uint32_t set_gpsws,
+ uint16_t rcv_gpsw, uint32_t rcv_gpsws, int32_t offset_range) {
+ BOOL ret = FALSE;
+ int16_t gap_gpsw = 0;
+ int32_t gap_gpsws = 0;
+
+ /* Check if GPS week number and GPS week second are within valid range */
+ /* NG when Set Time > Receive Time */
+ gap_gpsw = (int16_t)(rcv_gpsw - set_gpsw); /* QAC 3758 */
+ if (gap_gpsw == 0) {
+ /* There is no difference between the set GPS week and the received GPS week */
+ gap_gpsws = (int32_t)(rcv_gpsws - set_gpsws); /* QAC 3771 */
+ if ((0 <= gap_gpsws) && (gap_gpsws <= offset_range)) {
+ /* Setting of GPS time succeeded if the difference between GPS week seconds is within the range. */
+ ret = TRUE;
+ }
+ } else if (gap_gpsw == 1) {
+ /* Difference between the set GPS week and the received GPS week is 1 (over 7 weeks) */
+ gap_gpsws = (int32_t)((rcv_gpsws + GPS_WS_MAX) - set_gpsws); /* QAC 3771 */
+ if ((0 <= gap_gpsws) && (gap_gpsws <= offset_range)) {
+ /* Setting of GPS time succeeded if the difference between GPS week seconds is within the range. */
+ ret = TRUE;
+ }
+ } else {
+ /* Set GPS time failed except above */
+ }
+
+ return ret;
+}
+
+
+/****************************************************************************
+@brief DevGpsCnvLonLatNavi<BR>
+ Longitude/latitude information conversion process(Navigation-provided data)
+@outline Converts the latitude/longitude information provided by the navigation system into the format provided to the vehicle sensor.
+@param[in] u_int8 : fix_sts ... Current positioning status
+@param[in] int32 : lon ... Longitude information
+@param[in] int32 : lat ... Latitude-information
+@param[out] SENSORLOCATION_LONLATINFO_DAT* : p_lonlat ... Latitude and longitude information after conversion
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsCnvLonLatNavi(SENSORLOCATION_LONLATINFO_DAT* p_lonlat, u_int8 fix_sts, int32 lon, int32 lat) {
+ int32 longtitude;
+ int32 latitude;
+ int64_t tmp;
+ BOOL b_ret_lon = TRUE;
+ BOOL b_ret_lat = TRUE;
+ BOOL b_fix_sts = TRUE;
+
+ /** Provides latitude/longitude info for positioning status (2D/3D) */
+ if ((NAVIINFO_DIAG_GPS_FIX_STS_2D == fix_sts ) ||
+ (NAVIINFO_DIAG_GPS_FIX_STS_3D == fix_sts)) {
+ /** Get longitude information */
+ tmp = (int64_t)lon * 10000000;
+ longtitude = static_cast<int32>(tmp / (int64_t)(256 * 60 * 60));
+ if (longtitude == -1800000000) {
+ /** West longitude 180 degrees -> East longitude 180 degrees */
+ longtitude = +1800000000;
+ }
+ if ((longtitude > +1800000000) ||
+ (longtitude < -1800000000)) {
+ /** Longitude range error */
+ b_ret_lon = FALSE;
+ }
+ /** Get latitude information */
+ tmp = (int64_t)lat * 10000000;
+
+ latitude = static_cast<int32>(tmp / (int64_t)(256 * 60 * 60));
+
+ if ((latitude > +900000000) ||
+ (latitude < -900000000)) {
+ /** Latitude range error */
+ b_ret_lat = FALSE;
+ }
+ } else {
+ /** Does not provide latitude/longitude information in non-positioning state. */
+ b_fix_sts = FALSE;
+ }
+
+ /** Provided data setting */
+ p_lonlat->getMethod = GET_METHOD_GPS;
+ p_lonlat->SyncCnt = 0x00; /* Synchronization counter value(fixed to 0) */ /* Ignore -> No applicable rules for MISRA-C */
+ /** Available/Unusable Decision */
+ if ((b_fix_sts == TRUE) && (b_ret_lon == TRUE) && (b_ret_lat == TRUE)) {
+ p_lonlat->isEnable = SENSORLOCATION_STATUS_ENABLE; /* Available status: Available */
+ p_lonlat->Longitude = longtitude; /* Longitude */ /* Ignore -> MISRA-C:2004 Rule 9.1 */
+ p_lonlat->Latitude = latitude; /* Latitude */ /* Ignore -> MISRA-C:2004 Rule 9.1 */
+ } else {
+ p_lonlat->isEnable = SENSORLOCATION_STATUS_DISABLE; /* Available status: Not available */
+ p_lonlat->Longitude = 0; /* Longitude 0 degree fixed */
+ p_lonlat->Latitude = 0; /* Latitude fixed to 0 degrees */
+ }
+ return;
+}
+
+
+/****************************************************************************
+@brief DevGpsCnvAltitudeNavi<BR>
+ Altitude information conversion process(Navigation-provided data)
+@outline Converts the altitude information provided by the navigation system into the format provided to the vehicle sensor.
+@param[in] u_int8 : fix_sts ... Current positioning status
+@param[in] int32 : alt ... Altitude information
+@param[out] SENSORLOCATION_ALTITUDEINFO_DAT* : p_altitude ... Converted altitude information
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsCnvAltitudeNavi(SENSORLOCATION_ALTITUDEINFO_DAT* p_altitude, u_int8 fix_sts, int32 alt) {
+ int32 altitude;
+ BOOL b_fix_sts = TRUE;
+
+ /** Provides altitude information when in Fix Status (2D/3D) */
+ if (((NAVIINFO_DIAG_GPS_FIX_STS_2D == fix_sts) ||
+ (NAVIINFO_DIAG_GPS_FIX_STS_3D == fix_sts)) &&
+ (alt != GPS_ALTITUDE_INVALID_VAL)) {
+ /* The unit of alt is [0.01m], so conversion is not necessary. */
+ altitude = alt;
+ } else {
+ /** Does not provide altitude information in the non-positioning state. */
+ b_fix_sts = FALSE;
+ }
+ /** Provided data setting */
+ p_altitude->getMethod = GET_METHOD_GPS;
+ p_altitude->SyncCnt = 0x00; /* Synchronization counter value(fixed to 0) */ /* Ignore -> No applicable rules for MISRA-C */
+ /** Available/Unusable Decision */
+ if (b_fix_sts == TRUE) {
+ p_altitude->isEnable = SENSORLOCATION_STATUS_ENABLE; /* Available status: Available */
+ p_altitude->Altitude = altitude; /* Altitude */ /* Ignore -> MISRA-C:2004 Rule 9.1 */
+ } else {
+ p_altitude->isEnable = SENSORLOCATION_STATUS_DISABLE; /* Available status: Not available */
+ p_altitude->Altitude = 0; /* Altitude 0m fixed */
+ }
+ return;
+}
+
+/****************************************************************************
+@brief DevGpsCnvHeadingNavi<BR>
+ Orientation information conversion processing(Navigation-provided data)
+@outline Converts the orientation information provided by the navigation system into the format provided to the vehicle sensor.
+@param[in] u_int8 : fix_sts ... Current positioning status
+@param[in] u_int16 : head ... Bearing information
+@param[out] SENSORMOTION_HEADINGINFO_DAT* : p_heading ... Converted backward direction information
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsCnvHeadingNavi(SENSORMOTION_HEADINGINFO_DAT* p_heading, u_int8 fix_sts, u_int16 head) {
+ u_int16 us_heading;
+ BOOL b_fix_sts = TRUE;
+
+ /** Provides orientation when in Fix Status (2D/3D) */
+ if (((NAVIINFO_DIAG_GPS_FIX_STS_2D == fix_sts ) ||
+ (NAVIINFO_DIAG_GPS_FIX_STS_3D == fix_sts)) &&
+ (head != GPS_HEADING_INVALID_VAL)) {
+ /** Orientation information conversion */
+ us_heading = head;
+ /* Units of head are [0.01 degree] so no conversion is necessary. */
+ us_heading -= (u_int16)((us_heading / 36000) * 36000);
+ } else {
+ /** Azimuth information is not provided in the non-positioning state. */
+ b_fix_sts = FALSE;
+ }
+
+ /** Provided data setting */
+ p_heading->getMethod = GET_METHOD_GPS;
+ p_heading->SyncCnt = 0x00; /* Synchronization counter value(fixed to 0) */ /* Ignore -> No applicable rules for MISRA-C */
+ /** Available/Unusable Decision */
+ if (b_fix_sts == TRUE) {
+ p_heading->isEnable = SENSORLOCATION_STATUS_ENABLE; /* Available status: Available */
+ p_heading->Heading = us_heading; /* Orientation */ /* Ignore -> MISRA-C:2004 Rule 9.1 */
+ } else {
+ p_heading->isEnable = SENSORLOCATION_STATUS_DISABLE; /* Available status: Not available */
+ p_heading->Heading = 0; /* Azimuth 0 degree fixed */
+ }
+
+ return;
+}
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/GpsCommon/MDev_Gps_Main.cpp b/positioning_hal/src/GpsCommon/MDev_Gps_Main.cpp
new file mode 100755
index 0000000..0b9a4be
--- /dev/null
+++ b/positioning_hal/src/GpsCommon/MDev_Gps_Main.cpp
@@ -0,0 +1,362 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Main.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "MDev_Gps_Main.h"
+#include "positioning_common.h"
+#include "MDev_Gps_Mtrx.h"
+#include "MDev_Gps_TimerCtrl.h"
+#include "MDev_Gps_Common.h"
+#include "MDev_Gps_Nmea.h"
+#include "MDev_GpsRecv.h"
+#include "LineSensDrv_Thread.h"
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+BOOL g_gps_rcv_thread_stop = FALSE;
+
+/********************************************************************************
+ * Matrix event translation table(Message input)
+ ********************************************************************************/
+const TG_GPS_MSGEVTCHNG kGpsMsgchkC[MDEV_GPSMSGCHKC_MAX] = {
+ /* ++ #GPF_60_024 */
+ /* Matrix Event Translation Table for _CWORD82_ NMEA */
+ {CID_GPS__CWORD82__REQUEST, GPS_EVT_SENDREQ}, /* NMEA transmission request */
+ {CID_INI_INTERNAL_ACCOFF_START, GPS_EVT_ACC_OFF}, /* In-function ACC-OFF instructions */
+ {CID_GPS_REQRESET, GPS_EVT_RESETREQ}, /* GPS reset request */
+ {CID_NAVIINFO_DELIVER, GPS_EVT_NAVI_LOCATIONINFO}, /* Providing navigation information */
+ {CID_NAVIINFO_SPEED_DELIVER, GPS_EVT_NAVI_SPEEDINFO}, /* Navigation speed information service */
+ {CID_GPS_TIMESETTING, GPS_EVT_TIMESETTING}, /* GPS time setting instruction */
+ {CID_GPS_BACKUPDATA_LOAD, GPS_EVT_BACKUPDATA_LOAD}, /* Backup memory read request */
+ {CID_THREAD_STOP_REQ, GPS_EVT_STOPREQ}, /* Thread stop request */
+ {CID_GPSWEEKCOR_CNT_NOTIFICATION, GPS_EVT_WEEKCOR_CNT_NOTIFICATIO}, /* GPS Week Adjustment Counter Notification */
+ {DAT_END, DAT_END} /* Table end */
+ /* -- #GPF_60_024 */
+};
+
+/********************************************************************************
+ * Matrix event translation table(Input Timeout [ Timer ID])
+ ********************************************************************************/
+const TG_GPS_TIMEVTCHNG kGpsTimchkC[MDEV_PSTIMCHKC_MAX] = {
+ {GPS_STARTUP_TIMER, 0, GPS_EVT_TIMEOUT_CYCLDAT}, /* Start confirmation monitoring timer */
+ {GPS_CYCL_TIMER, 0, GPS_EVT_TIMEOUT_CYCLDAT}, /* Periodic reception data monitoring timer */
+ {GPS_RECV_ACK_TIMER, 0, GPS_EVT_TIMEOUT_RSPDAT}, /* ACK reception monitoring timer */
+ {GPS_NAVIFST_TIMER, 0, GPS_EVT_TIMEOUT_NAVI}, /* Initial NAVI monitoring timer */
+ {GPS_NAVICYCLE_TIMER, 0, GPS_EVT_TIMEOUT_NAVI}, /* NAVIGATION monitoring timer */
+ {GPS_NAVIDISRPT_TIMER, 0, GPS_EVT_TIMEOUT_NAVI}, /* NAVIGATION Disruption Log Output Timer */
+ {GPS_DIAGCLK_GUARDTIMER, 0, GPS_EVT_TIMEOUT_DIAGCLKGUARD}, /* Diagnosis provision time guard monitoring timer */
+ {GPS_NMEADATA_GUARDTIMER, 0, GPS_EVT_TIMEOUT_NMEADATAGUARD}, /* NMEA data-providing guard monitoring timer */
+ {GPS_RECOVERY_TIMER, 0, GPS_EVT_TIMEOUT_RECOVERY}, /* GPS recovery timer */
+ {GPS_RECEIVERERR_TIMER, 0, GPS_EVT_TIMEOUT_RECEIVERERR}, /* GPS receiver anomaly detection timer */
+ {DAT_END, 0, DAT_END} /* Table end */
+};
+
+/********************************************************************************
+ * Processing Branch Table
+ ********************************************************************************/
+/********************************************************************************
+ * TAG : TG_GPS_JMP_TBL
+ * ABSTRACT : GPS jump table
+ * NOTE : GPS Communication Management Matrix Table
+ ********************************************************************************/
+const TG_GPS_JMP_TBL kGpsMatxC[GPS_STS_NUM][GPS_EVT_NUM] = {
+ /* - - - - - Confirming Start - - - - - */
+ {
+ {&DevGpsInitStartSendReq}, /* Transmission request */
+ {&DevGpsInitStartGPSResetReq}, /* GPS reset request */
+ {&DevGpsInitStartRcvCyclCmd}, /* Cyclic reception command reception */
+ {&DevGpsNop}, /* Receive Response Command */
+ {&DevGpsNop}, /* Response monitoring timeout */
+ {&DevGpsInitStartCyclDataTimeOut}, /* Periodic reception data monitoring timeout */
+ {&DevGpsInitStartNaviDataTimeOut}, /* Navigation providing data monitoring timeout */
+ {&DevGpsInitStartDiagClkGuardTimeOut}, /* Diagnosis provision time guard monitoring timeout */
+ {&DevGpsInitStartAccOffStart}, /* In-function ACC-OFF instructions */
+ {&DevGpsInitStartNaviInfoDeliver}, /* Providing navigation information */
+ {&DevGpsInitStartNaviSpeedDeliver}, /* Navigation speed information service */
+ {&DevGpsInitStartSettingTime}, /* GPS time setting instruction */
+ {&DevGpsInitStartNmeaDataGuardTimeOut}, /* NMEA data-providing guard monitoring timeout */
+ {&DevGpsInitStartBackupDataLoadReq}, /* Backup data read request */
+ {&DevGpsInitStartStopReq}, /* Thread stop request */
+ {&DevGpsInitStartGpsweekcorcntNtf}, /* GPS Week Adjustment Counter Notification */
+ {&DevGpsInitStartRecoveryTimeOut}, /* GPS error monitoring timer out */
+ {&DevGpsInitStartGpsReceiverErrTimeOut} /* GPS receiver anomaly detection timeout */
+ },
+ /* - - - - - - In operation - - - - - - */
+ {
+ {&DevGpsNormalSendReq}, /* Transmission request */
+ {&DevGpsNormalGPSResetReq}, /* GPS reset request */
+ {&DevGpsNormalRcvCyclCmd}, /* Cyclic reception command reception */
+ {&DevGpsNop}, /* Receive Response Command */
+ {&DevGpsNop}, /* Response monitoring timeout */
+ {&DevGpsNormalCyclDataTimeOut}, /* Periodic reception data monitoring timeout */
+ {&DevGpsNormalNaviDataTimeOut}, /* Navigation providing data monitoring timeout */
+ {&DevGpsNormalDiagClkGuardTimeOut}, /* Diagnosis provision time guard monitoring timeout */
+ {&DevGpsNormalAccOffStart}, /* In-function ACC-OFF instructions */
+ {&DevGpsNormalNaviInfoDeliver}, /* Providing navigation information */
+ {&DevGpsNormalNaviSpeedDeliver}, /* Navigation speed information service */
+ {&DevGpsNormalSettingTime}, /* GPS time setting instruction */
+ {&DevGpsNormalNmeaDataGuardTimeOut}, /* NMEA data-providing guard monitoring timeout */
+ {&DevGpsNormalBackupDataLoadReq}, /* Backup data read request */
+ {&DevGpsNormalStopReq}, /* Thread stop request */
+ {&DevGpsNormalGpsweekcorcntNtf}, /* GPS Week Adjustment Counter Notification */
+ {&DevGpsNormalRecoveryTimeOut}, /* GPS error monitoring timer out */
+ {&DevGpsNormalGpsReceiverErrTimeOut} /* GPS receiver anomaly detection timeout */
+ },
+ /* - - - - -- Sending - - - - - - */
+ {
+ {&DevGpsSendSendReq}, /* Transmission request */
+ {&DevGpsSendGPSResetReq}, /* GPS reset request */
+ {&DevGpsSendRcvCyclCmd}, /* Cyclic reception command reception */
+ {&DevGpsSendRcvRspCmd}, /* Receive Response Command */
+ {&DevGpsSendRspDataTimeOut}, /* Response monitoring timeout */
+ {&DevGpsSendCyclDataTimeOut}, /* Periodic reception data monitoring timeout */
+ {&DevGpsSendNaviDataTimeOut}, /* Navigation providing data monitoring timeout */
+ {&DevGpsSendDiagClkGuardTimeOut}, /* Diagnosis provision time guard monitoring timeout */
+ {&DevGpsSendAccOffStart}, /* In-function ACC-OFF instructions */
+ {&DevGpsSendNaviInfoDeliver}, /* Providing navigation information */
+ {&DevGpsSendNaviSpeedDeliver}, /* Navigation speed information service */
+ {&DevGpsSendSettingTime}, /* GPS time setting instruction */
+ {&DevGpsSendNmeaDataGuardTimeOut}, /* NMEA data-providing guard monitoring timeout */
+ {&DevGpsSendBackupDataLoadReq}, /* Backup data read request */
+ {&DevGpsSendStopReq}, /* Thread stop request */
+ {&DevGpsSendGpsweekcorcntNtf}, /* GPS Week Adjustment Counter Notification */
+ {&DevGpsSendRecoveryTimeOut}, /* GPS error monitoring timer out */
+ {&DevGpsSendGpsReceiverErrTimeOut} /* GPS receiver anomaly detection timeout */
+ }
+};
+
+// Receive command analysis table(NMEA format)
+const TG_GPS_CMD_ANA_TBL* kGpsCmdAnaTbl = kGpsCmdAnaTblUblox;
+
+//GPS process pending buffer management table
+TG_GPS_MSGRCV g_gps_msg_rcvr; /* Incoming message */
+TG_GPS_MNG g_gps_mngr; /* GPS process management information */
+
+// Global variable for GPS communication management
+u_int16 g_wsend_err; /* Number of transmission errors */
+u_int16 g_wcnct_err; /* Number of connection errors */
+TG_GPS_OUTPUT_FORMAT g_rcv_format; /* Receive Format */
+
+// Global variable for the receive thread
+TG_GPS_RECV_RcvData g_gps_rcvdata; /* Serial receive buffer */
+TG_GPS_RECV_RcvBuf g_gps_rcvbuf; /* Receive data storage buffer */
+TG_GPS_RECV_AnaDataBuf g_gps_ana_databuf; /* Analysis data buffer */
+TG_GPS_RECV_RcvFrameBuf g_gps_rcv_framebuf; /* Receive frame buffer */
+TG_GPS_SAVEBUF g_gps_save_cmdr; /* Command pending buffer */
+u_int16 g_wrecv_err; /* Number of reception errors */
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+/********************************************************************************
+ * MODULE : DEV_Gps_MainThread
+ * ABSTRACT : Communication Management Thread Domain Processing
+ * FUNCTION : Receive a request from the host application and send a command to the serial port.
+ * ARGUMENT : PVOID pv....Thread Creation Arguments
+ * NOTE :
+ * RETURN : TRUE :Normal completion
+ * FALSE:ABENDs
+ ********************************************************************************/
+EFrameworkunifiedStatus DevGpsMainThread(HANDLE h_app) {
+ BOOL ret = FALSE;
+
+ PosSetupThread(h_app, ETID_POS_GPS);
+
+ ret = DevGpsInit();
+
+ if (TRUE == ret) {
+ g_gps_rcv_thread_stop = FALSE;
+
+ /* Start receiving message */
+ DevGpsRcvMsg();
+ } else {
+ /* Initialization failed */
+ POSITIONING_LOG("DevGpsMainThread Init Fail \n");
+ }
+
+ return eFrameworkunifiedStatusFail;
+}
+
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Init
+ * ABSTRACT : Communication management thread initialization processing
+ * FUNCTION : Initialize internal tables and serial ports
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : TRUE :Normal completion
+ * FALSE:ABENDs
+ ********************************************************************************/
+BOOL DevGpsInit(void) {
+ BOOL ret = FALSE;
+
+ /* Global variable initialization(GPS Communication Management Thread Internal Use Variable) */
+ /* Clear process management information */
+ memset(&g_gps_mngr, 0x00, sizeof(g_gps_mngr)); /* #05 */
+
+ /* Clear the message receive buffer */
+ memset(&g_gps_msg_rcvr, 0x00, sizeof(g_gps_msg_rcvr)); /* #05 */
+
+ /* Clear the pending buffer */
+ memset(&g_gps_save_cmdr, 0x00, sizeof(g_gps_save_cmdr)); /* #05 */
+
+ /* Clear RTC backup-related data */
+ g_gps_mngr.rcv_cmd = GPS_FORMAT_MIN; /* #GPF_60_040 */
+ g_gps_mngr.resp_cmd = GPS_FORMAT_MIN; /* #GPF_60_040 */
+ g_gps_mngr.rcv_err_flag = FALSE;
+
+ g_wsend_err = 0; /* Initialization of the number of transmission errors */
+ g_wcnct_err = 0; /* Connection error count initialization */
+ g_rcv_format = GPS_FORMAT_MIN; /* Initialize Receive Format #GPF_60_024*/
+
+ /* Initialize the timer function initialization processing management table */
+ DevGpsTimInit();
+
+ /* Start confirmation monitoring timer setting(5Sec) */
+ ret = DevGpsTimeSet(GPS_STARTUP_TIMER);
+
+ /* GPS receiver anomaly detection timer setting(600Sec) */
+ ret = DevGpsTimeSet(GPS_RECEIVERERR_TIMER);
+
+ // Set command table
+ kGpsCmdAnaTbl = kGpsCmdAnaTblUblox;
+
+ /* State transition processing(Start Confirmation Monitor) */
+ ChangeStatusGpsCommon(GPS_STS_STARTUP);
+
+ return(ret);
+}
+
+/******************************************************************************
+@brief DEV_Gps_RcvMsg<BR>
+ Message reception processing
+@outline Receive a message and distribute processing into a matrix
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsRcvMsg(void) {
+ RET_API ret = RET_NORMAL;
+ void* p_rcv_msg = &g_gps_msg_rcvr;
+
+ while (1) {
+ p_rcv_msg = &g_gps_msg_rcvr;
+
+ // Receive meaasge
+ ret = _pb_RcvMsg(PNO_NAVI_GPS_MAIN, sizeof(g_gps_msg_rcvr), &p_rcv_msg, RM_WAIT);
+
+ if (RET_RCVMSG == ret) {
+ memcpy(&g_gps_msg_rcvr, p_rcv_msg, sizeof(g_gps_msg_rcvr));
+
+ /* Message Event Check Processing */
+ DevGpsMsgEventCheck();
+
+ if ((u_int32)NG != g_gps_mngr.event) {
+ /* If the event check is successful */
+ /* Start Processing by Matrix */
+ (kGpsMatxC[g_gps_mngr.sts][g_gps_mngr.event].func)();
+ }
+ } else {
+ /** MSG reception error */
+ POSITIONING_LOG("DevGpsRcvMsg error ret[%d] \n", ret);
+ }
+ }
+}
+
+static inline void SetStopFlag(void) {
+ g_gps_rcv_thread_stop = TRUE;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_MsgEventCheck
+ * ABSTRACT : Message Event Check Processing
+ * FUNCTION : Check received messages and convert them to events
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ********************************************************************************/
+void DevGpsMsgEventCheck(void) {
+ u_int32 ul_cnt = 0;
+
+ /* Set Error to Event No. */
+ g_gps_mngr.event = (u_int32)NG;
+
+ /* For timeout notification */
+ if (g_gps_msg_rcvr.header.hdr.cid == CID_TIMER_TOUT) {
+ /* Get event number from sequence number */
+ DevGpsTimEventCheck();
+ } else if (g_gps_msg_rcvr.header.hdr.cid == CID_GPS_RECVDATA) {
+ DevGpsCmdEventCheckNmea();
+ } else {
+ while (kGpsMsgchkC[ul_cnt].cid != DAT_END) {
+ if (g_gps_msg_rcvr.header.hdr.cid == kGpsMsgchkC[ul_cnt].cid) {
+ POSITIONING_LOG("DevGpsMsgEventCheck: cid = %d", g_gps_msg_rcvr.header.hdr.cid);
+
+ /* Get event number */
+ g_gps_mngr.event = kGpsMsgchkC[ul_cnt].event;
+
+ if (GPS_EVT_STOPREQ == g_gps_mngr.event) {
+ SetStopFlag();
+ LineSensDrvThreadStopProcess();
+ }
+
+ break;
+ }
+
+ ul_cnt++;
+ }
+ }
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_TimEventCheck
+ * ABSTRACT : Timeout-Event check processing
+ * FUNCTION : Check received timeout messages and convert them to events
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ********************************************************************************/
+void DevGpsTimEventCheck(void) {
+ u_int8 uc_time_kind = 0;
+ TimerToutMsg st_rcv_msg;
+ BOOL ret = FALSE;
+
+ // Set Error to Event No.
+ g_gps_mngr.event = (u_int32)NG;
+
+ // Get message
+ memcpy(&st_rcv_msg, &g_gps_msg_rcvr, sizeof(TimerToutMsg));
+
+ // Time judge kind
+ ret = DevGpsTimeJdgKind((u_int16)st_rcv_msg.TimerSeq);
+
+ if (TRUE == ret) {
+ /* If the sequence numbers match, */
+ /* Set the conversion code to the event number */
+ uc_time_kind = (u_int8)((st_rcv_msg.TimerSeq >> 8) & 0x00FF);
+ g_gps_mngr.event = kGpsTimchkC[uc_time_kind].event;
+ }
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/GpsCommon/MDev_Gps_Mtrx.cpp b/positioning_hal/src/GpsCommon/MDev_Gps_Mtrx.cpp
new file mode 100755
index 0000000..b36a617
--- /dev/null
+++ b/positioning_hal/src/GpsCommon/MDev_Gps_Mtrx.cpp
@@ -0,0 +1,866 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Mtrx.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+#include "MDev_Gps_Mtrx.h"
+#include "positioning_def.h"
+
+#include "MDev_Gps_Main.h"
+#include "MDev_Gps_API.h"
+#include "MDev_GpsRecv.h"
+#include "MDev_Gps_Common.h"
+#include "MDev_Gps_Nmea.h"
+#include "MDev_Gps_TimerCtrl.h"
+
+extern uint8_t g_gps_reset_cmd_sending;
+/*---------------------------------------------------------------------------*/
+// Functions
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Nop
+ * ABSTRACT : No processing
+ * FUNCTION : NOP processing of the matrix
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ********************************************************************************/
+void DevGpsNop(void) {
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_InitStart_SendReq
+ * ABSTRACT : Startup confirmation - Transmit request reception matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsInitStartSendReq(void) {
+ /** Send Request Receive Common Processing Call */
+ SendReqGpsCommon();
+ /* -- #GPF_60_040 */
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_InitStart_GPSResetReq
+ * ABSTRACT : Startup confirmation - GPS reset request reception matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsInitStartGPSResetReq(void) {
+ /** Reset request reception common processing call */
+ GPSResetReqGpsCommon();
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_InitStart_RcvCyclCmd
+ * ABSTRACT : Startup confirmation - Cyclic receive command receive matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsInitStartRcvCyclCmd(void) {
+ BOOL* pb_rcverr = &(g_gps_mngr.rcv_err_flag); /* GSP receiver error detection status */
+
+ /* Stop start confirmation monitoring timer */
+ (void)DevGpsTimeStop(GPS_STARTUP_TIMER); /* Ignore -> MISRA-C:2004 Rule 16.10 */ /* QAC 3200 */
+
+ /* GPS receiver anomaly detection timer stopped */
+ (void)DevGpsTimeStop(GPS_RECEIVERERR_TIMER);
+
+ /* State transition processing(in operation) */
+ ChangeStatusGpsCommon(GPS_STS_NORMAL);
+
+ // Send NAV-TIMEUTC sentence addition requests
+ DevGpsNavTimeUTCAddReq();
+
+ DevGpsWknRolloverGetReq();
+
+ /* Receive command analysis(u-blox) */
+ if (g_gps_reset_cmd_sending == FALSE) {
+ DevGpsRcvCyclCmd();
+ }
+
+ /* If a GPS receiver error is detected, the diagnosis code (current) is deleted. */
+ if (*pb_rcverr == TRUE) {
+ *pb_rcverr = FALSE;
+ DevSendGpsConnectError(FALSE);
+ }
+ // }
+ /* Reset retry counter */
+ RtyResetGpsCommon();
+
+ /* Sending pending commands */
+ SendSaveCmdGpsCommon(); /* State transition if pending commands exist( -> Sending) */
+
+ /* Cyclic reception data monitoring timer setting */
+ (void)DevGpsTimeSet(GPS_CYCL_TIMER); /* Ignore -> MISRA-C:2004 Rule 16.10 */ /* QAC 3200 */
+
+ /* GPS receiver anomaly detection timer setting */
+ (void)DevGpsTimeSet(GPS_RECEIVERERR_TIMER);
+
+ /* -- #GPF_60_024 */
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_InitStart_CyclDataTimeOut
+ * ABSTRACT : Startup confirmation - Reception cycle data monitoring timeout matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsInitStartCyclDataTimeOut(void) {
+ uint8_t ret = RETRY_OFF;
+
+ POSITIONING_LOG("DEV_Gps_InitStart_CyclDataTimeOut");
+
+ g_wcnct_err++; /* Count number of connection errors */
+
+ /* Stop all timers */
+ DevGpsTimeStop(GPS_STARTUP_TIMER);
+
+ DevGpsTimeStop(GPS_CYCL_TIMER);
+
+ DevGpsTimeStop(GPS_RECV_ACK_TIMER);
+
+ /* Hard reset judgment processing */
+ ret = HardResetChkGpsCommon();
+ if (RETRY_ON == ret) {
+ DevGpsResetReq(PNO_NONE, 0);
+
+ SendSaveCmdGpsCommon(); /* State transition if pending commands exist( -> Sending) */
+ } else if (RETRY_OFF == ret) {
+ /* Fixed number of hard resets completed */
+ } else {
+ /* Retrying(with hard reset) */
+ }
+ /* Clear cyclic receive data up to now */
+ DevGpsCycleDataClear();
+ /* Start confirmation monitoring timer setting */
+ DevGpsTimeSet(GPS_STARTUP_TIMER);
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_InitStart_NaviDataTimeOut<BR>
+ Startup confirmation - Navigation providing data monitoring timeout matrix function
+@outline Navigation providing data monitoring timeout matrix processing during startup confirmation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartNaviDataTimeOut(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_InitStart_DiagClkGuardTimeOut<BR>
+ Startup confirmation - Time guard monitoring timeout matrix functions provided by diagnosis
+@outline Diagnosis provision time guard monitoring timeout matrix process during startup checking
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartDiagClkGuardTimeOut(void) {
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_InitStart_AccOffStart
+ * ABSTRACT : Startup confirmation - Feature ACC-OFF instruction matrix functions
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsInitStartAccOffStart(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_InitStart_NaviInfoDeliver<BR>
+ Startup confirmation - Navigation information provision matrix processing
+@outline Navigation information provision matrix processing during startup confirmation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartNaviInfoDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_InitStart_NaviSpeedDeliver<BR>
+ Startup confirmation - Navigation vehicle speed information provision matrix processing
+@outline Navigation speed information provision matrix processing during startup confirmation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartNaviSpeedDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_InitStart_SettingTime<BR>
+ Startup confirmation - GPS time setting matrix processing
+@outline GPS time setting matrix process during startup confirmation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartSettingTime(void) {
+ POSITIONING_LOG("DEV_Gps_InitStart_SettingTime\n");
+ DevGpsCommSettingTime();
+ return;
+}
+
+/* start #GPF_60_109 */
+/******************************************************************************
+@brief DEV_Gps_InitStart_NmeaDataGuardTimeOut<BR>
+ Startup confirmation - NMEA monitoring timeout matrix processing
+@outline NMEA data-providing guard monitoring timeout process during startup checking
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartNmeaDataGuardTimeOut(void) {
+}
+
+/**
+ * @brief
+ * Startup confirmation - Backup memory read request matrix processing
+ */
+void DevGpsInitStartBackupDataLoadReq(void) {
+ POS_DATETIME st_date_time;
+ memset(&st_date_time, 0x00, sizeof(st_date_time));
+ /* Import GPS date and time settings */
+ DevGpsReadGpsTime(&st_date_time);
+ // Todo For Test don't need gstGpsFixCnt??
+ // DEV_Gps_ReadGpsFixCnt(); /* Read GPS fix count */
+ if (g_is_gpstime_sts == TRUE) {
+ DevGpsSettingTime(&st_date_time); /* Time setting */
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Startup confirmation - Thread stop request matrix processing
+ */
+void DevGpsInitStartStopReq(void) {
+ /* Thread stop processing */
+ StopThreadGpsCommon();
+
+ return;
+}
+
+/**
+ * @brief
+ * Startup confirmation - GPS week adjustment counter notification process
+ */
+void DevGpsInitStartGpsweekcorcntNtf(void) {
+ DevGpsSetGpsweekcorcnt();
+ return;
+}
+
+/**
+ * @brief
+ * Startup confirmation - GPS recovery timeout process
+ */
+void DevGpsInitStartRecoveryTimeOut(void) {
+ return;
+}
+
+/**
+ * @brief
+ * Startup confirmation - GPS receiver anomaly detection timeout processing
+ */
+void DevGpsInitStartGpsReceiverErrTimeOut(void) {
+ BOOL* pb_rcverr = &(g_gps_mngr.rcv_err_flag); /* GSP receiver error detection status */
+
+ *pb_rcverr = TRUE;
+ DevSendGpsConnectError(TRUE);
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Normal_SendReq
+ * ABSTRACT : In operation - Transmit request reception matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsNormalSendReq(void) {
+ /** Store in a pending buffer #GPF_60_040 */
+ SendReqGpsCommon();
+
+ /** Send the command #GPF_60_040 */
+ SendSaveCmdGpsCommon();
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Normal_GPSResetReq
+ * ABSTRACT : In operation - GPS reset request reception matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsNormalGPSResetReq(void) {
+ /** Store in a pending buffer #GPF_60_040 */
+ GPSResetReqGpsCommon();
+
+ /** Send the command #GPF_60_040 */
+ SendSaveCmdGpsCommon();
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Normal_RcvCyclCmd_Nmea
+ * ABSTRACT : In operation - Cyclic receive command receive matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsNormalRcvCyclCmd(void) {
+ /* Cyclic reception data monitoring timer stopped */
+ (void)DevGpsTimeStop(GPS_CYCL_TIMER);
+ /* GPS receiver anomaly detection timer stopped */
+ (void)DevGpsTimeStop(GPS_RECEIVERERR_TIMER);
+
+ /* Notify Vehicle Sensor */
+ if (g_gps_reset_cmd_sending == FALSE) {
+ DevGpsRcvCyclCmd();
+ }
+
+ /* Reset retry counter */
+ RtyResetGpsCommon();
+
+ /* Cyclic reception data monitoring timer setting */
+ (void)DevGpsTimeSet(GPS_CYCL_TIMER); /* Ignore -> MISRA-C:2004 Rule 16.10 */ /* QAC 3200 */
+
+ /* GPS receiver anomaly detection timer setting */
+ (void)DevGpsTimeSet(GPS_RECEIVERERR_TIMER);
+
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Normal_CyclDataTimeOut
+ * ABSTRACT : In operation - Reception cycle data monitoring timeout matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsNormalCyclDataTimeOut(void) {
+ /* Cyclic reception timeout common processing call */
+ CyclDataTimeOutGpsCommon();
+}
+
+/******************************************************************************
+@brief DEV_Gps_Normal_NaviDataTimeOut<BR>
+ In operation - Navigation providing data monitoring timeout matrix function
+@outline Navigation providing data monitoring timeout matrix processing during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalNaviDataTimeOut(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Normal_DiagClkGuardTimeOut<BR>
+ In operation - Time guard monitoring timeout matrix functions provided by diagnosis
+@outline Diagnosis provision time guard monitoring timeout matrix process during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalDiagClkGuardTimeOut(void) {
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Normal_AccOffStart
+ * ABSTRACT : Startup confirmation - Feature ACC-OFF instruction matrix functions
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsNormalAccOffStart(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Normal_NaviInfoDeliver<BR>
+ In operation - Navigation information provision matrix processing
+@outline Navigation information provision matrix processing during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalNaviInfoDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Normal_NaviSpeedDeliver<BR>
+ In operation - Navigation vehicle speed information provision matrix processing
+@outline Navigation vehicle speed information provision matrix processing during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalNaviSpeedDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Normal_SettingTime<BR>
+ In operation - GPS time setting matrix processing
+@outline GPS time setting matrix processing during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalSettingTime(void) {
+ POSITIONING_LOG("DEV_Gps_Normal_SettingTime");
+ DevGpsCommSettingTime();
+ /** Send the command */
+ SendSaveCmdGpsCommon();
+
+ return;
+}
+
+/* start #GPF_60_109 */
+/******************************************************************************
+@brief DEV_Gps_Normal_NmeaDataGuardTimeOut<BR>
+ In operation - NMEA monitoring timeout matrix processing
+@outline NMEA data-providing guard monitoring timeout process during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalNmeaDataGuardTimeOut(void) {
+}
+
+/**
+ * @brief
+ * In operation - Backup memory read request matrix processing
+ */
+void DevGpsNormalBackupDataLoadReq(void) {
+ POS_DATETIME st_date_time;
+ memset(&st_date_time, 0x00, sizeof(st_date_time));
+ /* Import GPS date and time settings */
+ DevGpsReadGpsTime(&st_date_time);
+ // Todo For test don't need gstGpsFixCnt??
+ // DEV_Gps_ReadGpsFixCnt(); /* Read GPS fix count */
+ if (g_is_gpstime_sts == TRUE) {
+ DevGpsSettingTime(&st_date_time); /* Time setting */
+ }
+ return;
+}
+
+/**
+ * @brief
+ * In operation - Thread stop request matrix processing
+ */
+void DevGpsNormalStopReq(void) {
+ /* Thread stop processing */
+ StopThreadGpsCommon();
+
+ return;
+}
+
+/**
+ * @brief
+ * In operation - GPS week adjustment counter notification process
+ */
+void DevGpsNormalGpsweekcorcntNtf(void) {
+ DevGpsSetGpsweekcorcnt();
+ return;
+}
+
+/**
+ * @brief
+ * In operation - GPS recovery timeout processing
+ */
+void DevGpsNormalRecoveryTimeOut(void) {
+}
+
+/**
+ * @brief
+ * In operation - GPS receiver anomaly detection timeout processing
+ */
+void DevGpsNormalGpsReceiverErrTimeOut(void) {
+ BOOL* pb_rcverr = &(g_gps_mngr.rcv_err_flag); /* GSP receiver error detection status */
+
+ *pb_rcverr = TRUE;
+ DevSendGpsConnectError(TRUE);
+ return;
+}
+
+/* ++ #GPF_60_040 */
+/******************************************************************************
+@brief DEV_Gps_Send_SendReq<BR>
+ Sending - Transmit request reception matrix function
+@outline Processing for receiving a transmission request during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendSendReq(void) {
+ SendReqGpsCommon();
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_GPSResetReq<BR>
+ Sending - GPS reset request reception matrix function
+@outline Processing when receiving a GPS reset request during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendGPSResetReq(void) {
+ GPSResetReqGpsCommon();
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_RcvCyclCmd<BR>
+ Sending - Cyclic receive command receive matrix function
+@outline Processing at the reception of cyclic reception command during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendRcvCyclCmd(void) {
+ /* Cyclic reception data monitoring timer stopped */
+ DevGpsTimeStop(GPS_CYCL_TIMER);
+
+ /* GPS receiver anomaly detection timer stopped */
+ DevGpsTimeStop(GPS_RECEIVERERR_TIMER);
+
+ /* Notify Vehicle Sensor */
+ if (g_gps_reset_cmd_sending == FALSE) {
+ DevGpsRcvCyclCmd();
+ }
+
+ /* Reset retry counter */
+ RtyResetGpsCommon();
+
+ /* Cyclic reception data monitoring timer setting */
+ (void)DevGpsTimeSet(GPS_CYCL_TIMER);
+
+ (void)DevGpsTimeSet(GPS_RECEIVERERR_TIMER);
+
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_RcvRspCmd<BR>
+ Sending - Response command reception matrix function
+@outline Processing when receiving a response command during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendRcvRspCmd(void) {
+ TG_GPS_OUTPUT_FORMAT rcv_cmd = g_gps_mngr.rcv_cmd;
+ BOOL b_snd_flag = TRUE;
+
+ /** Check whether the command matches the command being monitored. */
+ if (rcv_cmd == g_gps_mngr.resp_cmd) {
+ /** When the command being monitored is a cold start request */
+ if (g_gps_mngr.resp_rst_flag == GPS_CMD_RESET) {
+ POSITIONING_LOG("GPS_CMD_RESET\n");
+ b_snd_flag = DevGpsRcvProcGpsResetResp(reinterpret_cast<TG_GPS_RCV_DATA*>
+ (reinterpret_cast<void*>(g_gps_msg_rcvr.msgdat)));
+ } else if (g_gps_mngr.resp_rst_flag == GPS_CMD_TIMESET) {
+ POSITIONING_LOG("GPS_CMD_TIMESET\n");
+ DevGpsRcvProcTimeSetResp(reinterpret_cast<TG_GPS_RCV_DATA*>
+ (reinterpret_cast<void*>(g_gps_msg_rcvr.msgdat)));
+ } else if (g_gps_mngr.resp_rst_flag == GPS_CMD_SENTENCEADD_NAVTIMEUTC) {
+ POSITIONING_LOG("GPS_CMD_SENTENCEADD_NAVTIMEUTC\n");
+ DevGpsRcvProcNavSvinfoAddResp(reinterpret_cast<TG_GPS_RCV_DATA*>
+ (reinterpret_cast<void*>(g_gps_msg_rcvr.msgdat)));
+ } else if ( g_gps_mngr.resp_rst_flag == GPS_CMD_WKNROLLOVER ) {
+ POSITIONING_LOG("GPS_CMD_WKNROLLOVER\n");
+ DevGpsRcvProcWknRolloverGetResp(reinterpret_cast<TG_GPS_RCV_DATA*>
+ (reinterpret_cast<void*>(g_gps_msg_rcvr.msgdat)));
+ } else {
+ POSITIONING_LOG("g_gps_mngr.resp_rst_flag INVALID!! [resp_rst_flag = %d]", g_gps_mngr.resp_rst_flag);
+ }
+
+ if (b_snd_flag == TRUE) {
+ /** Stop ACK monitoring timer */
+ DevGpsTimeStop(GPS_RECV_ACK_TIMER);
+ /* State transition processing(in operation) */
+ ChangeStatusGpsCommon(GPS_STS_NORMAL);
+ /** Reset retry counter */
+ SendRtyResetGpsCommon();
+ /** Delete command from pending buffer */
+ DeleteSaveCmdGpsCommon();
+ /* Sending pending commands */
+ SendSaveCmdGpsCommon();
+ }
+ } else {
+ }
+
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_RspDataTimeOut<BR>
+ Sending - Response monitoring timeout reception matrix function
+@outline Processing at reception of response monitoring timeout during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendRspDataTimeOut(void) {
+ DevGpsTimeStop(GPS_RECV_ACK_TIMER);
+ /** Send retry count */
+ g_gps_mngr.sndcnt++;
+
+ /** Retry judgment */
+ if (g_gps_mngr.sndcnt == SNDNG_MAX) {
+ /** At the time of retry */
+ POSITIONING_LOG("GPS Hw Reset : sndcnt[%d]", g_gps_mngr.sndcnt);
+
+ /** When the command being monitored is a cold start request */
+ if (g_gps_mngr.resp_rst_flag == GPS_CMD_RESET) {
+ POSITIONING_LOG("g_gps_mngr.sndcnt == SNDNG_MAX (GPS_CMD_RESET)");
+ /** Send Reset ResponseCommunication error */
+ DevGpsRstAnsSend(g_gps_mngr.resp_pno, g_gps_mngr.resp_rid, GPS_SENDNG);
+ g_gps_reset_cmd_sending = FALSE;
+
+ } else if (g_gps_mngr.resp_rst_flag == GPS_CMD_TIMESET) {
+ POSITIONING_LOG("g_gps_mngr.sndcnt == SNDNG_MAX (GPS_CMD_TIMESET)");
+ DevGpsTimesetAnsSend(g_gps_mngr.resp_pno, g_gps_mngr.resp_rid, GPS_SENDNG);
+ } else if (g_gps_mngr.resp_rst_flag == GPS_CMD_SENTENCEADD_NAVTIMEUTC) {
+ POSITIONING_LOG("g_gps_mngr.sndcnt == SNDNG_MAX (GPS_CMD_SENTENCEADD_NAVTIMEUTC)");
+ DevGpsNavTimeUTCAddReq(); /* Retransmission of requests to add NAV-SVINFO commands */
+ } else if (g_gps_mngr.resp_rst_flag == GPS_CMD_WKNROLLOVER) { /* GPS rollover reference date acquisition response */
+ POSITIONING_LOG("g_gps_mngr.sndcnt == SNDNG_MAX (GPS_CMD_WKNROLLOVER)");
+ DevGpsWknRolloverGetReq(); /* GPS rollover standard week number acquisition request retransmission */
+ } else {
+ POSITIONING_LOG("g_gps_mngr.resp_rst_flag INVALID!! [resp_rst_flag = %d]", g_gps_mngr.resp_rst_flag);
+ }
+
+ DeleteSaveCmdGpsCommon();
+
+ ChangeStatusGpsCommon(GPS_STS_NORMAL);
+
+ SendSaveCmdGpsCommon();
+ /** Reset retry counter */
+ SendRtyResetGpsCommon();
+ } else {
+ POSITIONING_LOG("GPS Send Retry : sndcnt[%d]", g_gps_mngr.sndcnt);
+ /** Retransmission of pending command */
+ SendSaveCmdGpsCommon();
+ }
+
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_CyclDataTimeOut<BR>
+ Sending - Reception cycle data monitoring timeout matrix function
+@outline Processing when receiving periodic reception data monitoring timeout during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendCyclDataTimeOut(void) {
+ CyclDataTimeOutGpsCommon();
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_NaviDataTimeOut<BR>
+ Sending - Navigation providing data monitoring timeout matrix function
+@outline Navigation providing data monitoring timeout matrix processing during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendNaviDataTimeOut(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_DiagClkGuardTimeOut<BR>
+ Sending - Time guard monitoring timeout matrix functions provided by diagnosis
+@outline Diagnosis providing time guard monitoring timeout matrix process during sending
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendDiagClkGuardTimeOut(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_AccOffStart<BR>
+ Sending - Feature ACC-OFF instruction reception matrix functions
+@outline Processing when receiving ACC-OFF instruction in function being transmitted
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendAccOffStart(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_NaviInfoDeliver<BR>
+ Sending - Navigation information provision matrix processing
+@outline Navigation information provision matrix processing during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendNaviInfoDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_NaviSpeedDeliver<BR>
+ Sending - Navigation vehicle speed information provision matrix processing
+@outline Navigation vehicle speed information provision matrix processing during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendNaviSpeedDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_SettingTime<BR>
+ Sending - GPS time setting matrix processing
+@outline GPS time setting matrix processing during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendSettingTime(void) {
+ DevGpsCommSettingTime();
+ return;
+}
+
+/* start #GPF_60_109 */
+/******************************************************************************
+@brief DEV_Gps_Send_NmeaDataGuardTimeOut<BR>
+ Sending - NMEA monitoring timeout matrix processing
+@outline Sending NMEA monitoring timeouts
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendNmeaDataGuardTimeOut(void) {
+}
+
+/**
+ * @brief
+ * Sending - Backup memory read request matrix processing
+ */
+void DevGpsSendBackupDataLoadReq(void) {
+ POS_DATETIME st_date_time;
+
+ memset(&st_date_time, 0x00, sizeof(st_date_time));
+ /* Import GPS date and time settings */
+ DevGpsReadGpsTime(&st_date_time);
+ // Todo For test don't need gstGpsFixCnt??
+ // DEV_Gps_ReadGpsFixCnt(); /* Read GPS fix count */
+ if (g_is_gpstime_sts == TRUE) {
+ DevGpsSettingTime(&st_date_time); /* Time setting */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Sending - Thread stop request matrix processing
+ */
+void DevGpsSendStopReq(void) {
+ /* Thread stop processing */
+ StopThreadGpsCommon();
+ return;
+}
+
+/**
+ * @brief
+ * Sending - GPS week adjustment counter notification process
+ */
+void DevGpsSendGpsweekcorcntNtf(void) {
+ DevGpsSetGpsweekcorcnt();
+ return;
+}
+
+/**
+ * @brief
+ * Sending - GPS recovery timeout processing
+ */
+void DevGpsSendRecoveryTimeOut(void) {
+ return;
+}
+
+/**
+ * @brief
+ * Sending - GPS receiver anomaly detection timeout processing
+ */
+void DevGpsSendGpsReceiverErrTimeOut(void) {
+ BOOL* pb_rcverr = &(g_gps_mngr.rcv_err_flag); /* GSP receiver error detection status */
+
+ *pb_rcverr = TRUE;
+ DevSendGpsConnectError(TRUE);
+ return;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/GpsCommon/MDev_Gps_Nmea.cpp b/positioning_hal/src/GpsCommon/MDev_Gps_Nmea.cpp
new file mode 100755
index 0000000..60fa1d8
--- /dev/null
+++ b/positioning_hal/src/GpsCommon/MDev_Gps_Nmea.cpp
@@ -0,0 +1,928 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Nmea.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "MDev_Gps_Nmea.h"
+#include "positioning_common.h"
+#include "MDev_Gps_API.h"
+#include "MDev_Gps_Main.h"
+#include "MDev_GpsRecv.h"
+#include "MDev_Gps_Common.h"
+#include "MDev_GpsRollOver.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+#define ROLOVR_GPSWEEKCOR_NG 0xFF /* WEEK COMP. CORRECT CORRECTOR INVALUE */
+#define TMT_TGET_INI_INTERVAL (100) /* GPS time compensation interval immediately after startup (value with 10[msec] as 1) */
+#define TMT_DISCONTINUITY_TIME_TOUT_SEQ (0x5051) /* Sequence number of GPS time acquisition timeout based on date/time discontinuity */
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+static TG_GPS_RCVDATA g_st_gpscycle_data;
+u_int8 g_gps_week_cor_cnt = ROLOVR_GPSWEEKCOR_NG;
+
+extern uint8_t g_gpstime_raw_tdsts;
+
+const TG_GPS_CMD_ANA_TBL kGpsCmdAnaTblUblox[MDEV_GPSCMDANATBLNMEA_MAX] = {
+ /* Sentences Maximum length Receiving type Presence of notification Receive Format */
+ /* NMEA */
+ {{GPS_CMD_NMEA_RMC}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_RMC }, /* RMC information */
+ {{GPS_CMD_NMEA_VTG}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_VTG }, /* VTG information */
+ {{GPS_CMD_NMEA_GGA}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GGA }, /* GGA information */
+ {{GPS_CMD_NMEA_GSA}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSA }, /* GSA information */
+ {{GPS_CMD_NMEA_GSV_1}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSV1 }, /* GSV information1 */
+ {{GPS_CMD_NMEA_GSV_2}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSV2 }, /* GSV information2 */
+ {{GPS_CMD_NMEA_GSV_3}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSV3 }, /* GSV information3 */
+ {{GPS_CMD_NMEA_GSV_4}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSV4 }, /* GSV information4 */
+ {{GPS_CMD_NMEA_GSV_5}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSV5 }, /* GSV information5 */
+ {{GPS_CMD_NMEA_GLL}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GLL }, /* GLL information */
+ {{GPS_CMD_NMEA_GST}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GST }, /* GST information */
+ /* UBX */
+ {{0xB5, 0x62, 0x0A, 0x04}, GPS_NMEA_MAX_SZ, RCV_RESP, TRUE, GPS_FORMAT_MON_VER }, /* MON-VER */
+ {{0xB5, 0x62, 0x0B, 0x01}, GPS_NMEA_MAX_SZ, RCV_RESP, TRUE, GPS_FORMAT_AID_INI }, /* AID-INI */
+ {{0xB5, 0x62, 0x05 }, GPS_NMEA_MAX_SZ, RCV_RESP, TRUE, GPS_FORMAT_ACK_ACKNACK }, /* ACK-ACKNACK */
+ {{0xB5, 0x62, 0x01, 0x21}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_NAV_TIMEUTC }, /* NAV-TIMEUTC */
+ {{0xB5, 0x62, 0x01, 0x22}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_NAV_CLOCK }, /* NAV-CLOCK */
+ {{0xB5, 0x62, 0x02, 0x23}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_RXM_RTC5 }, /* RXM-RTC5 */
+ {{0xB5, 0x62, 0x01, 0x30}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_NAV_SVINFO }, /* NAV-SVINFO */
+ {{0xB5, 0x62, 0x06, 0x23}, GPS_NMEA_MAX_SZ, RCV_RESP, TRUE, GPS_FORMAT_CFG_NAVX5 }, /* CFG-NAVX5 */
+ {{ENDMARK}, 0, 0, FALSE, GPS_FORMAT_MIN } /* Table termination */
+};
+
+/*---------------------------------------------------------------------------*/
+// Functions
+/**
+ * @brief
+ * Time Calculation Process Considering Rollover
+ *
+ * @param[in/out]
+ *
+ * @return none
+ * @retval none
+ */
+static BOOL DevCalcRollOverTime(TG_TIM_ROLOVR_YMD* base_ymd, TG_TIM_ROLOVR_YMD* conv_ymd) {
+ BOOL ret = TRUE;
+ static u_int16 year_old = 0;
+ static u_int16 confirm_cnt = 0;
+ u_int8 gps_week_corr = g_gps_week_cor_cnt;
+
+ if (gps_week_corr == ROLOVR_GPSWEEKCOR_NG) {
+ gps_week_corr = 0;
+ ret = FALSE;
+ } else {
+ if (year_old > base_ymd->year) {
+ confirm_cnt++;
+ if (confirm_cnt >= 10) {
+ confirm_cnt = 0;
+ year_old = base_ymd->year;
+ g_gps_week_cor_cnt = ROLOVR_GPSWEEKCOR_NG;
+ /* Starting the GPS time acquisition timer (1 second timer) based on date/time discontinuity */
+ _pb_ReqTimerStart(PNO_CLK_GPS, TMT_DISCONTINUITY_TIME_TOUT_SEQ, TIMER_TYPE_USN, TMT_TGET_INI_INTERVAL);
+ }
+ ret = FALSE;
+ } else {
+ confirm_cnt = 0;
+ year_old = base_ymd->year;
+ }
+ }
+ /* Calculate time for rollover */
+ GPSRollOverConvTime(base_ymd, conv_ymd, gps_week_corr);
+
+ return ret;
+}
+/******************************************************************************************************/
+
+
+/**
+ * @brief
+ * NMEA data notification
+ */
+void DevGpsSndCycleDataNmea(void) {
+ /* Notifying vehicle sensor of NMEA */
+
+ MDEV_GPS_NMEA st_nmea;
+ TG_GPS_NMEA_INFO st_gps_nmea_info;
+ RET_API l_ret = RET_NORMAL;
+ BOOL b_get = FALSE;
+ u_int8 uc_nmea_data[GPS_NMEA_MAX_SZ];
+ u_int32 ul_strlen = 0;
+ u_int16 us_offset = sizeof(TG_GPS_NMEA_INFO);
+
+ memset(&st_nmea, 0x00, sizeof(st_nmea) ); /* QAC 3200 */
+ memset(&st_gps_nmea_info, 0x00, sizeof(st_gps_nmea_info) ); /* QAC 3200 */
+ memset(uc_nmea_data, 0x00, sizeof(uc_nmea_data) ); /* QAC 3200 */
+
+ /* Get received NMEA data from storage area(GGA) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GGA);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GGA; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GGA].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GGA].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GLL) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GLL);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GLL; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GLL].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GLL].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSA) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GSA);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSA1; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSA1].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSA1].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GST) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GST);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GST; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GST].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GST].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(RMC) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_RMC);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_RMC; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_RMC].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_RMC].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(VTG) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_VTG);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_VTG; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_VTG].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_VTG].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSV1) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GSV1);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSV1; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV1].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV1].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSV2) */
+ b_get = DevGpsCycleDataGetNmea( uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GSV2 );
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSV2; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV2].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV2].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSV3) */
+ b_get = DevGpsCycleDataGetNmea( uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GSV3 );
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSV3; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV3].uc_size = static_cast<u_int8>(ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV3].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSV4) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GSV4);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSV4; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV4].uc_size = static_cast<u_int8>(ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV4].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSV5) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GSV5);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSV5; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV5].uc_size = static_cast<u_int8>(ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV5].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ if (0 != st_gps_nmea_info.ul_rcvsts) {
+ /* Receive flag */
+ (void)memcpy(&(st_nmea.uc_nmea_data[0]), &st_gps_nmea_info, sizeof(st_gps_nmea_info));
+
+ /* Provided to vehicle sensor */
+ l_ret = SendNmeaGps(&st_nmea);
+
+ if (RET_NORMAL != l_ret) {
+ POSITIONING_LOG("SendNmeaGps SndMsg Error\n");
+ }
+ } else {
+ /* Do not provide to vehicle sensor when data acquisition fails or no data */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Analysis of the received command
+ */
+void DevGpsRcvCyclCmd(void) {
+ int32 i_ret = 0;
+ TG_GPS_OUTPUT_FORMAT e_format = GPS_FORMAT_MIN;
+
+ TG_GPS_RCV_DATA st_rcv_data; /* Pointer to the received message */
+ (void)memcpy(&st_rcv_data, &(g_gps_msg_rcvr.msgdat[0]), sizeof(st_rcv_data) ); /* QAC 3200 */
+
+ /* Analysis of received commands */
+ i_ret = JudgeFormatGpsCommon(reinterpret_cast<u_char*>(&(st_rcv_data.bygps_data[0])),
+ static_cast<u_int32>(st_rcv_data.bydata_len),
+ &e_format);
+
+ if (i_ret == GPSRET_SNDCMD) {
+ /* For NMEA formats */
+ if ((e_format == GPS_FORMAT_RMC) ||
+ (e_format == GPS_FORMAT_VTG) ||
+ (e_format == GPS_FORMAT_GGA) ||
+ (e_format == GPS_FORMAT_GSA) ||
+ (e_format == GPS_FORMAT_GSV1) ||
+ (e_format == GPS_FORMAT_GSV2) ||
+ (e_format == GPS_FORMAT_GSV3) ||
+ (e_format == GPS_FORMAT_GSV4) ||
+ (e_format == GPS_FORMAT_GSV5) ||
+ (e_format == GPS_FORMAT_GLL) ||
+ (e_format == GPS_FORMAT_GST)) {
+ /* NMEA reception process */
+ RcvCyclCmdNmeaGpsCommon(&(st_rcv_data.bygps_data[0]), (u_int32)st_rcv_data.bydata_len, e_format);
+ } else if ((e_format == GPS_FORMAT_MON_VER) ||
+ (e_format == GPS_FORMAT_AID_INI) ||
+ (e_format == GPS_FORMAT_ACK_ACKNACK) ||
+ (e_format == GPS_FORMAT_NAV_TIMEUTC) ||
+ (e_format == GPS_FORMAT_NAV_CLOCK) ||
+ (e_format == GPS_FORMAT_RXM_RTC5) ||
+ (e_format == GPS_FORMAT_NAV_SVINFO)) {
+ /* UBX reception process */
+ RcvCyclCmdExtGpsCommon(&(st_rcv_data.bygps_data[0]), (u_int32)st_rcv_data.bydata_len, e_format);
+ } else {
+ POSITIONING_LOG("Forbidden ERROR!![e_format=%d]", (int)e_format);
+ }
+ } else if (i_ret == GPSRET_CMDERR) {
+ /* Receive command error */
+
+ /* Discard previously received data */
+ DevGpsCycleDataClear();
+ /* Initialize receive format */
+ g_rcv_format = GPS_FORMAT_MIN;
+ } else {
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Check of the received command
+ */
+void DevGpsCmdEventCheckNmea(void) {
+ u_int32 ul_cnt = 0;
+ TG_GPS_RCV_DATA st_rcv_data;
+ u_char* pub_rcv_data = NULL;
+ BOOL brk_flg = FALSE;
+
+ memset(&st_rcv_data, 0, sizeof(TG_GPS_RCV_DATA));
+ memcpy( &st_rcv_data, &(g_gps_msg_rcvr.msgdat[0]), sizeof(TG_GPS_RCV_DATA) );
+ pub_rcv_data = reinterpret_cast<u_char*>(&(st_rcv_data.bygps_data[0]));
+
+ /* Analysis of received commands */
+ for (ul_cnt = 0; ul_cnt < (u_int32)GPSCMDANATBL_MAX; ul_cnt++) {
+ /* End-of-table decision */
+ if (CheckFrontStringPartGpsCommon(reinterpret_cast<const u_char*>(ENDMARK),
+ reinterpret_cast<const u_char*>(kGpsCmdAnaTbl[ul_cnt].c_sentence)) == RET_NORMAL ) {
+ g_wrecv_err++;
+
+ /* Data error is set to Event ID. */
+ g_gps_mngr.event = (u_int32)NG;
+
+ brk_flg = TRUE;
+ } else if (CheckFrontStringPartGpsCommon(pub_rcv_data, kGpsCmdAnaTbl[ul_cnt].c_sentence) == RET_NORMAL) {
+ /* Reception type determination */
+
+ /* Using $GPRMC in responses to resets */
+ if ((g_gps_mngr.sts == GPS_STS_SENT) &&
+ (g_gps_mngr.resp_cmd == GPS_FORMAT_RMC) &&
+ (kGpsCmdAnaTbl[ul_cnt].e_rcv_format == GPS_FORMAT_RMC)) {
+ POSITIONING_LOG("Received response ($GPRMC) form GPS device.\n");
+
+ /** Response command */
+ g_gps_mngr.event = GPS_EVT_RECVRSPDAT;
+
+ /** Receive format setting */
+ g_gps_mngr.rcv_cmd = kGpsCmdAnaTbl[ul_cnt].e_rcv_format;
+ } else if (kGpsCmdAnaTbl[ul_cnt].ul_rcv_kind == RCV_CYCLE) {
+ /* Cyclic receive command */
+ g_gps_mngr.event = GPS_EVT_RECVCYCLDAT;
+
+ /* Receive format setting */
+ g_gps_mngr.rcv_cmd = kGpsCmdAnaTbl[ul_cnt].e_rcv_format;
+ } else if (kGpsCmdAnaTbl[ul_cnt].ul_rcv_kind == RCV_RESP) {
+ /** Response command */
+ g_gps_mngr.event = GPS_EVT_RECVRSPDAT;
+
+ /** Receive format setting */
+ g_gps_mngr.rcv_cmd = kGpsCmdAnaTbl[ul_cnt].e_rcv_format;
+ } else {
+ /* Undefined value */
+ /* Data error is set to Event ID. */
+ g_gps_mngr.event = (u_int32)NG;
+ }
+
+ brk_flg = TRUE;
+ }
+
+ if (brk_flg == TRUE) {
+ break;
+ }
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get GPS reception status
+ *
+ * By analyzing the last received GSA-sentence and using the satellite-number as the Satellite number
+ * Determines the reception status based on whether or not notification has been made, and returns it.
+ *
+ * @param[in] no_sv Satellite number
+ *
+ * @return NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX - Positioning not used
+ * NAVIIFNO_DIAG_GPS_RCV_STS_USEFIX - Positioning use
+ */
+u_int8 DevGpsGetGpsRcvSts(u_int8 sv) {
+ u_int8 rcv_sts = NAVIINFO_DIAG_GPS_RCV_STS_TRACHING; /* Tracking in progress */
+ u_int8 uc_nmea_data[GPS_NMEA_MAX_SZ];
+ u_int8 uc_no = 0;
+ BOOL b_get = FALSE;
+ int32 i = 0;
+
+ /* Get received NMEA data from storage area(GSA) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GSA);
+
+ if (b_get == TRUE) {
+ for (i = 0; i < GPS_NMEA_NUM_GSA_SV; i++) {
+ /* Get satellite number */
+ uc_no = (uint8_t)GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSA_SV + (u_int8)(1 * i), uc_nmea_data);
+
+ if (uc_no == sv) {
+ rcv_sts = NAVIINFO_DIAG_GPS_RCV_STS_USEFIX; /* Positioning use */
+ break;
+ }
+ }
+ }
+
+ return rcv_sts;
+}
+
+/**
+ * @brief
+ * GPS information analysis
+ *
+ * Analyzing received NMEA sentences
+ * @param[out] navilocinfo Navigation information
+ */
+void DevGpsAnalyzeNmea(NAVIINFO_ALL* navilocinfo) {
+ u_int8 uc_nmea_data[GPS_NMEA_MAX_SZ];
+ int32 no_sv = 0; /* number of Satellites in View */
+ int32 __offset = 0;
+ char utc_time[12]; /* hhmmss.sss */
+ char _date[6]; /* ddmmyy */
+ char _status = 0; /* 'V' or 'A' */
+ char indicator; /* 'N' or 'S' or 'E' or 'W' */
+ char work[8]; /* Work buffer for converting String data */
+ BOOL b_get = FALSE;
+ uint8_t fixsts = NAVIINFO_DIAG_GPS_FIX_STS_NON;
+ uint8_t fixsts_gga;
+ BOOL bvalid_lon = FALSE;
+ BOOL bvalid_lat = FALSE;
+ BOOL bvalid = FALSE;
+ TG_TIM_ROLOVR_YMD base_ymd;
+ TG_TIM_ROLOVR_YMD conv_ymd;
+ BOOL roll_over_sts;
+ u_int8 _tdsts = g_gpstime_raw_tdsts;
+
+ GpsSatelliteInfo st_visible_satellite_list[GPS_MAX_NUM_VISIBLE_SATELLITES]; /* Visible satellite list */
+ GpsSatelliteInfo st_tmp_buf;
+
+ int32 i = 0;
+ int32 j = 0;
+ int32 k = 0;
+
+ SENSORLOCATION_LONLATINFO_DAT st_lonlat;
+ SENSORLOCATION_ALTITUDEINFO_DAT st_altitude;
+ SENSORMOTION_HEADINGINFO_DAT st_heading;
+ // MDEV_GPS_RTC st_rtc;
+ SENSOR_MSG_GPSTIME st_gps_time;
+ SENSORMOTION_SPEEDINFO_DAT st_speed;
+
+ memset(&st_lonlat, 0x00, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+ memset(&st_altitude, 0x00, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+ memset(&st_heading, 0x00, sizeof(SENSORMOTION_HEADINGINFO_DAT));
+ // memset(&st_rtc, 0x00, sizeof(MDEV_GPS_RTC));
+ memset(&st_gps_time, 0x00, sizeof(SENSOR_MSG_GPSTIME));
+ memset(&st_speed, 0x00, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ /* Satellite signal strength list initialization */
+ (void)memset(st_visible_satellite_list, 0x00, sizeof(GpsSatelliteInfo) * GPS_MAX_NUM_VISIBLE_SATELLITES);
+
+ /* Get received NMEA data from storage area(GSA) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GSA);
+
+ if (b_get == TRUE) {
+ fixsts = static_cast<uint8_t>(GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSA_FS, uc_nmea_data));
+ }
+
+ /* Get received NMEA data from storage area(RMC) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_RMC);
+
+ if (b_get == TRUE) {
+ navilocinfo->stDiagGps.stFix.stWgs84.lLat =
+ GetLonLatFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_LATITUDE, uc_nmea_data, &bvalid_lat); /* GPS location information and latitude */
+
+ GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_NS, uc_nmea_data, &indicator, sizeof(indicator));
+
+ if (indicator != GPS_NMEA_RMC_IND_NORTH) {
+ navilocinfo->stDiagGps.stFix.stWgs84.lLat *= -1;
+ }
+
+ POSITIONING_LOG("lLat = %d", navilocinfo->stDiagGps.stFix.stWgs84.lLat);
+
+ navilocinfo->stDiagGps.stFix.stWgs84.lLon =
+ GetLonLatFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_LONGITUDE, uc_nmea_data, &bvalid_lon); /* GPS position information and longitude */
+
+ GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_EW, uc_nmea_data, &indicator, sizeof(indicator));
+
+ if (indicator != GPS_NMEA_RMC_IND_EAST) {
+ navilocinfo->stDiagGps.stFix.stWgs84.lLon *= -1;
+ }
+
+ st_lonlat.Longitude = navilocinfo->stDiagGps.stFix.stWgs84.lLon;
+ st_lonlat.Latitude = navilocinfo->stDiagGps.stFix.stWgs84.lLat;
+
+ POSITIONING_LOG("lLon = %d", navilocinfo->stDiagGps.stFix.stWgs84.lLon);
+
+ /* Get Date information */
+ (void)GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_DATE, uc_nmea_data, _date, 6);
+ (void)memset(&base_ymd, 0, sizeof(base_ymd)); /* QAC 3200 */
+ (void)memset(&conv_ymd, 0, sizeof(conv_ymd)); /* QAC 3200 */
+ (void)memset(work, 0, sizeof(work)); /* QAC 3200 */
+
+ (void)strncpy(work, &_date[4], 2); /* QAC 3200 */
+ base_ymd.year = (u_int16)(2000 + atoi(work)); /* YEAR */
+
+ st_gps_time.utc.year = (uint8_t)atoi(work);
+
+ (void)strncpy(work, &_date[2], 2); /* QAC 3200 */
+ base_ymd.month = (u_int16)(atoi(work)); /* MONTH */
+
+ st_gps_time.utc.month = (uint8_t)atoi(work);
+
+ (void)strncpy(work, &_date[0], 2); /* QAC 3200 */
+ base_ymd.day = (u_int16)(atoi(work)); /* DAY */
+
+ st_gps_time.utc.date = (uint8_t)atoi(work);
+
+ POSITIONING_LOG("year = %d", base_ymd.year);
+ POSITIONING_LOG("month = %d", base_ymd.month);
+ POSITIONING_LOG("date = %d", base_ymd.day);
+
+ /* UTC time information acquisition */
+ (void)GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_UTC, uc_nmea_data, utc_time, 12);
+
+ (void)strncpy(work, &utc_time[0], 2); /* QAC 3200 */
+ navilocinfo->stNaviGps.utc.hour = (uint8_t)atoi(work); /* HOUR */
+
+ st_gps_time.utc.hour = navilocinfo->stNaviGps.utc.hour;
+ POSITIONING_LOG("hour = %d", navilocinfo->stNaviGps.utc.hour);
+
+ (void)strncpy(work, &utc_time[2], 2); /* QAC 3200 */
+ navilocinfo->stNaviGps.utc.minute = (uint8_t)atoi(work); /* MINUTE */
+
+ st_gps_time.utc.minute = navilocinfo->stNaviGps.utc.minute;
+ POSITIONING_LOG("minute = %d", navilocinfo->stNaviGps.utc.minute);
+
+ (void)strncpy(work, &utc_time[4], 2); /* QAC 3200 */
+ navilocinfo->stNaviGps.utc.second = (uint8_t)atoi(work); /* SECOND */
+
+ st_gps_time.utc.second = navilocinfo->stNaviGps.utc.second;
+ POSITIONING_LOG("second = %d", navilocinfo->stNaviGps.utc.second);
+
+ /* Compass information acquisition */
+ navilocinfo->stNaviGps.heading =
+ GetHeadingFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_COG, uc_nmea_data, &bvalid);
+
+ st_heading.Heading = navilocinfo->stNaviGps.heading;
+ POSITIONING_LOG("heading = %u", navilocinfo->stNaviGps.heading);
+
+ st_speed.Speed = GetSpeedFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_SPEED, uc_nmea_data, &bvalid);
+
+ /* Fix Status/Time Status Calculation */
+ (void)GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_STATUS, uc_nmea_data, &_status, sizeof(_status));
+
+ if ((_status == GPS_NMEA_RMC_STS_VALID) && (bvalid_lat == TRUE) && (bvalid_lon == TRUE)) {
+ /* Fix status information */
+ switch (fixsts) {
+ case GPS_NMEA_GSA_FIX_STS_NON:
+ navilocinfo->stDiagGps.stFix.ucFixSts = NAVIINFO_DIAG_GPS_FIX_STS_NON;
+ break;
+ case GPS_NMEA_GSA_FIX_STS_2D:
+ navilocinfo->stDiagGps.stFix.ucFixSts = NAVIINFO_DIAG_GPS_FIX_STS_2D;
+ break;
+ case GPS_NMEA_GSA_FIX_STS_3D:
+ navilocinfo->stDiagGps.stFix.ucFixSts = NAVIINFO_DIAG_GPS_FIX_STS_3D;
+ break;
+ default:
+ POSITIONING_LOG("GSA Nav Mode Error [fixsts:%d]", fixsts);
+ break;
+ }
+
+ if (_tdsts == POS_TIMESTS_OK) {
+ roll_over_sts = DevCalcRollOverTime(&base_ymd, &conv_ymd);
+ navilocinfo->stNaviGps.utc.year = conv_ymd.year; /* year (after conversion) */
+ navilocinfo->stNaviGps.utc.month = (u_int8)(conv_ymd.month); /* month (after conversion) */
+ navilocinfo->stNaviGps.utc.date = (u_int8)(conv_ymd.day); /* dat (after conversion) */
+ if (roll_over_sts == FALSE) {
+ navilocinfo->stNaviGps.tdsts = POS_TIMESTS_NG;
+ /* Reserve[0] is time setting information: anomaly time, but can be calculated by rolling over. */
+ navilocinfo->stNaviGps.reserve[0] = GPS_TIME_ROLOVR;
+ } else {
+ /* When the location information is normal, the time information is also judged to be normal. */
+ navilocinfo->stNaviGps.tdsts = POS_TIMESTS_OK; /* Time calibration completed */
+ /* Reserve[0] is time setting information: Use time status received from GPS device. */
+ navilocinfo->stNaviGps.reserve[0] = GPS_TIME_RX;
+ }
+ } else {
+ navilocinfo->stNaviGps.tdsts = POS_TIMESTS_NG; /* Time uncalibrated */
+ /* Reserve[0] is time setting information: Use time status received from GPS device. */
+ navilocinfo->stNaviGps.reserve[0] = GPS_TIME_RX;
+ navilocinfo->stNaviGps.utc.year = base_ymd.year; /* year(after conversion) */
+ navilocinfo->stNaviGps.utc.month = (u_int8)(base_ymd.month); /* month (after conversion) */
+ navilocinfo->stNaviGps.utc.date = (u_int8)(base_ymd.day); /* day (after conversion) */
+ }
+
+ if (bvalid != TRUE) {
+ /* Invalid value if measurement orientation is invalid. */
+ navilocinfo->stNaviGps.heading = GPS_HEADING_INVALID_VAL;
+ // POSITIONING_LOG("RMC Heading[cog] Invalid");
+ }
+ } else {
+ /* Fix status information: Non-position fix is set regardless of FS of GSA. */
+ navilocinfo->stDiagGps.stFix.ucFixSts = NAVIINFO_DIAG_GPS_FIX_STS_NON;
+ /* If the location information is invalid, the time information is also judged to be invalid. */
+ /* Time not calibrated after receiver reset (time entry or master reset or CSF activation) */
+ navilocinfo->stNaviGps.tdsts = POS_TIMESTS_NG;
+ /* Reserve[0] is time setting information: Use time status received from GPS device. */
+ navilocinfo->stNaviGps.reserve[0] = GPS_TIME_RX;
+ navilocinfo->stNaviGps.utc.year = base_ymd.year; /* year (after conversion) */
+ navilocinfo->stNaviGps.utc.month = (u_int8)(base_ymd.month); /* month (after conversion) */
+ navilocinfo->stNaviGps.utc.date = (u_int8)(base_ymd.day); /* day (after conversion) */
+ // POSITIONING_LOG("RMC Invalid[status:%d, bvalidLat:%d, bvalidLon:%d]", _status, bvalid_lat, bvalid_lon);
+ }
+
+ // POSITIONING_LOG("year(Fix) = %d", navilocinfo->stNaviGps.utc.year);
+ // POSITIONING_LOG("month(Fix) = %d", navilocinfo->stNaviGps.utc.month);
+ // POSITIONING_LOG("date(Fix) = %d", navilocinfo->stNaviGps.utc.date);
+ // POSITIONING_LOG("tdsts = %d", navilocinfo->stNaviGps.tdsts);
+ }
+
+ /* Get received NMEA data from storage area(GGA) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GGA);
+
+ if (b_get == TRUE) {
+ /* Data status acquisition */
+ fixsts_gga = (uint8_t)GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GGA_FS, uc_nmea_data);
+
+ /* Altitude information acquisition */
+ if (((fixsts == GPS_NMEA_GSA_FIX_STS_2D) ||
+ (fixsts == GPS_NMEA_GSA_FIX_STS_3D)) &&
+ ((fixsts_gga == GPS_NMEA_GGA_FIX_STATUS_GPS) ||
+ (fixsts_gga == GPS_NMEA_GGA_FIX_STATUS_DGPS) ||
+ (fixsts_gga == GPS_NMEA_GGA_FIX_STATUS_DR))) {
+ navilocinfo->stNaviGps.altitude =
+ GetAltitudeFromNmeaGpsCommon(GPS_NMEA_FNO_GGA_MSL, uc_nmea_data, &bvalid);
+
+ if (bvalid != TRUE) {
+ /* If the location information is invalid, set an invalid value. */
+ navilocinfo->stNaviGps.altitude = GPS_ALTITUDE_INVALID_VAL;
+ // POSITIONING_LOG("GGA Altitude[msl] Invalid");
+ }
+ } else {
+ /* If the location information is invalid, set an invalid value. */
+ navilocinfo->stNaviGps.altitude = GPS_ALTITUDE_INVALID_VAL;
+ // POSITIONING_LOG("GGA Invalid[fixsts:%d, fixstsGGA:%d]", fixsts, fixsts_gga);
+ }
+
+ st_altitude.Altitude = navilocinfo->stNaviGps.altitude;
+ // POSITIONING_LOG("altitude = %d", navilocinfo->stNaviGps.altitude);
+ }
+
+ DevGpsCnvLonLatNavi(&st_lonlat, navilocinfo->stDiagGps.stFix.ucFixSts, navilocinfo->stDiagGps.stFix.stWgs84.lLon,
+ navilocinfo->stDiagGps.stFix.stWgs84.lLat);
+
+ DevGpsCnvAltitudeNavi(&st_altitude, navilocinfo->stDiagGps.stFix.ucFixSts, navilocinfo->stNaviGps.altitude);
+
+ DevGpsCnvHeadingNavi(&st_heading, navilocinfo->stDiagGps.stFix.ucFixSts, navilocinfo->stNaviGps.heading);
+
+ SendCustomGps(&st_gps_time, &st_lonlat, &st_altitude, &st_heading, &navilocinfo->stDiagGps);
+ // For test todo don't needed
+ // SendTimeGps(&st_rtc);
+ // SendSpeedGps(&st_speed, 0);
+
+ /* Create visual satellite information list from GSV1~GSV5 and GSV */
+ for (i = 0; i < 5; i++) {
+ /* Get received NMEA data from storage area */
+ b_get = DevGpsCycleDataGetNmea( uc_nmea_data, sizeof(uc_nmea_data),
+ (ENUM_GPS_NMEA_INDEX)(GPS_NMEA_INDEX_GSV1 + i));
+
+ if (b_get == TRUE) {
+ /* Get number of Satellites in View */
+ no_sv = GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSV_NOSV, uc_nmea_data);
+
+ for (j = 0; j < GPS_NMEA_NUM_GSV_SINFO; j++) {
+ if (__offset >= no_sv) {
+ break;
+ }
+
+ st_visible_satellite_list[__offset].sv = static_cast<uint8_t>(
+ GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSV_SV + (u_int8)(4 * j), uc_nmea_data)); /* Satellite information_No */
+ st_visible_satellite_list[__offset].elv = static_cast<uint8_t>(
+ GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSV_ELV + (u_int8)(4 * j), uc_nmea_data)); /* Satellite information_elevation */
+ st_visible_satellite_list[__offset].az = static_cast<uint16_t>(
+ GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSV_AZ + (u_int8)(4 * j), uc_nmea_data)); /* Satellite Information_Azimuth */
+ st_visible_satellite_list[__offset].cno = static_cast<uint8_t>(
+ GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSV_CNO + (u_int8)(4 * j), uc_nmea_data)); /* Satellite information_level */
+ st_visible_satellite_list[__offset].sts = DevGpsGetGpsRcvSts(st_visible_satellite_list[__offset].sv);
+
+ /* Sort in ascending order of status (priority to use fix) and received signal strength */
+ for (k = __offset; k > 0; k--) {
+ if (((st_visible_satellite_list[k].sts == NAVIINFO_DIAG_GPS_RCV_STS_USEFIX) &&
+ (st_visible_satellite_list[k - 1].sts == NAVIINFO_DIAG_GPS_RCV_STS_TRACHING)) ||
+ ((st_visible_satellite_list[k - 1].sts == st_visible_satellite_list[k].sts) &&
+ (st_visible_satellite_list[k].cno > st_visible_satellite_list[k - 1].cno))) {
+ (void)memcpy(&st_tmp_buf, &st_visible_satellite_list[k], sizeof(GpsSatelliteInfo));
+ (void)memcpy(&st_visible_satellite_list[k], &st_visible_satellite_list[k - 1], sizeof(GpsSatelliteInfo));
+ (void)memcpy(&st_visible_satellite_list[k - 1], &st_tmp_buf, sizeof(GpsSatelliteInfo));
+ } else {
+ break;
+ }
+ }
+
+ __offset++;
+ }
+ }
+ }
+
+ return;
+}
+
+/****************************************************************************
+@brief DevGpsCycleDataClear<BR>
+ Cyclic data storage area clear processing
+@outline Clear the cyclic data storage area
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsCycleDataClear(void) {
+ int32 i = 0;
+
+ /* Sensor counter, reception flag initialization */
+ g_st_gpscycle_data.uc_sns_cnt = 0;
+
+ for (i = 0; i < GPS_NMEA_INDEX_MAX; i++) {
+ g_st_gpscycle_data.st_nmea_data.uc_rcv_flag[i] = GPS_CYCLECMD_NOTRCV;
+ }
+
+ g_st_gpscycle_data.st_binary_data.uc_rcv_flag = GPS_CYCLECMD_NOTRCV;
+ g_st_gpscycle_data.st_fullbin_data.uc_rcv_flag = GPS_CYCLECMD_NOTRCV;
+}
+
+/******************************************************************************
+@brief DEV_Gps_CycleData_SetNmea<BR>
+ NMEA data setting process
+@outline Set NMEA data in cyclic data storage area
+@param[in] u_int8* : p_data ... NMEA data to be set
+@param[in] u_int32 : ul_length ... Data length
+@param[in] ENUM_GPS_NMEA_INDEX: e_format ... Sentence identification
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsCycleDataSetNmea(const u_int8* p_data, u_int32 ul_length, ENUM_GPS_NMEA_INDEX e_format) {
+ u_int32 ul_copy_sz = 0;
+
+ /** Anomaly detection */
+ if (e_format >= GPS_NMEA_INDEX_MAX) {
+ POSITIONING_LOG("# GpsCommCtl_API # Set NMEA Sentence ERROR ! \r\n");
+ } else {
+ /** Storage size determination */
+ if (GPS_NMEA_MAX_SZ < ul_length) {
+ ul_copy_sz = GPS_NMEA_MAX_SZ;
+ POSITIONING_LOG("# GpsCommCtl_API # Set NMEA Cmd Size ERROR ! \r\n");
+ } else {
+ ul_copy_sz = ul_length;
+ }
+
+ /** Storing */
+ g_st_gpscycle_data.st_nmea_data.uc_rcv_flag[e_format] = GPS_CYCLECMD_RCV;
+ memset(&(g_st_gpscycle_data.st_nmea_data.st_nmea[e_format].uc_data[0]), 0x00, GPS_NMEA_MAX_SZ);
+ memcpy(&(g_st_gpscycle_data.st_nmea_data.st_nmea[e_format].uc_data[0]), p_data, ul_copy_sz);
+ }
+
+ return;
+}
+
+/******************************************************************************
+@brief DevGpsCycleDataGetNmea<BR>
+ NMEA data setting process
+@outline Set NMEA data in cyclic data storage area
+@param[in] u_int32 : ul_buf_size ... Storage destination buffer size
+@param[in] ENUM_GPS_NMEA_INDEX: e_format ... Sentence identification
+@param[out] u_int8* : p_data ... Storage destination buffer pointer
+@return BOOL
+@retval TRUE : Data present
+@retval FALSE : No data
+*******************************************************************************/
+BOOL DevGpsCycleDataGetNmea(u_int8 *p_data, u_int32 ul_buf_size, ENUM_GPS_NMEA_INDEX e_format) {
+ BOOL ret = TRUE;
+
+ /** Determining whether data exists in the cyclic data area */
+ if (GPS_CYCLECMD_RCV == g_st_gpscycle_data.st_nmea_data.uc_rcv_flag[e_format]) {
+ if (GPS_NMEA_MAX_SZ <= ul_buf_size) {
+ /** Copy to storage destination buffer */
+ memcpy(p_data, &(g_st_gpscycle_data.st_nmea_data.st_nmea[e_format].uc_data[0]), GPS_NMEA_MAX_SZ);
+ } else {
+ /** Storage destination buffer size is small */
+ ret = FALSE;
+ }
+ } else {
+ /** Not received */
+ ret = FALSE;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Setting of the check sum
+ *
+ * @param[in] buffer Pointer of data
+ * @param[in] length length of data
+ */
+void DevGpsSetChkSum(u_int8* buffer, u_int32 length) {
+ u_int16 i = 0;
+ u_int8 ck_a = 0;
+ u_int8 ck_b = 0;
+
+ if (buffer != NULL) {
+ for (i = 2; i < (length - 2); i++) {
+ ck_a = ck_a + buffer[i];
+ ck_b = ck_b + ck_a;
+ }
+
+ /* Checksum_Set */
+ buffer[length - 2] = ck_a;
+ buffer[length - 1] = ck_b;
+ } else {
+ }
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/GpsCommon/MDev_Gps_TimerCtrl.cpp b/positioning_hal/src/GpsCommon/MDev_Gps_TimerCtrl.cpp
new file mode 100755
index 0000000..8dbf8dc
--- /dev/null
+++ b/positioning_hal/src/GpsCommon/MDev_Gps_TimerCtrl.cpp
@@ -0,0 +1,293 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_TimerCtrl.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "MDev_Gps_TimerCtrl.h"
+
+// #include "MDev_Gps_Main.h"
+// #include "MDev_GpsRecv.h"
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+static GPS_TIM_MNG g_st_tim_mng;
+
+/** Timer setting information table */
+static const GPS_TIM_INFO kTimInfo[TIM_NUM] = {
+ /* GSP related */
+ {TIMVAL_GPS_STARTUP, PNO_NAVI_GPS_MAIN}, /* Start confirmation monitoring timer */
+ {TIMVAL_GPS_RCVCYCLDAT, PNO_NAVI_GPS_MAIN}, /* Periodic reception data monitoring timer */
+ {TIMVAL_GPS_RCVACK, PNO_NAVI_GPS_MAIN}, /* ACK reception monitoring timer */
+ {TIMVAL_GPS_NAVIFST, PNO_NAVI_GPS_MAIN}, /* Initial Navigation Monitoring Timer */
+ {TIMVAL_GPS_NAVICYCLE, PNO_NAVI_GPS_MAIN}, /* Navi monitoring timer */
+ {TIMVAL_GPS_NAVIDISRPT, PNO_NAVI_GPS_MAIN}, /* Navigation Monitoring Disruption Log Output Timer */
+ {TIMVAL_GPS_DIAGCLKGUARD, PNO_NAVI_GPS_MAIN}, /* Diagnosis provision time guard monitoring timer */
+ {TIMVAL_GPS_NMEADATAGUARD, PNO_NAVI_GPS_MAIN}, /* NMEA data providing guard monitoring timer */
+ {TIMVAL_GPS_RECOVERY, PNO_NAVI_GPS_MAIN}, /* GPS recovery timer */
+ {TIMVAL_GPS_RECEIVERERR, PNO_NAVI_GPS_MAIN}, /* GPS receiver anomaly detection timer */
+ /* Sensor related */
+ {TIMVAL_SNS_RCVFSTDAT, PNO_VEHICLE_SENSOR}, /* Initial cyclic sensor data reception monitoring timer */
+ {TIMVAL_SNS_RCVCYCLDAT, PNO_VEHICLE_SENSOR}, /* Cyclic sensor data reception monitoring timer */
+ {TIMVAL_SNS_RCVDISRPT, PNO_VEHICLE_SENSOR}, /* Cyclic sensor data interruption log output timer */
+};
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+static uint16_t TimeMakSeqNo(GPS_TIM_KIND tim_kind) {
+ GPS_TIM_MNG* pst_tim_mng = NULL;
+ u_int16 seq_no = 0; /* Timer sequence number */
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ /*------------------------------------------------------------------------*/
+ /* Definition of Sequence Number */
+ /* |------------------- Sequence number(2Byte) -----------------------| */
+ /* 15 8 7 0 */
+ /* +-------------------------------+-----------------------------------+ */
+ /* | Timer type(1Byte) | Counter(1Byte)(0x01 ? 0xFF) | */
+ /* +-------------------------------+-----------------------------------+ */
+ /* The timer type is 0x00. ? (Number of timers-1) */
+ /* counters is 0x01 ? 0xFF(Do not use 0x00) */
+ /* (Counters are counted up each time a timer is started. */
+ /* If the counter counts up when it is 0xFF, */
+ /* be counted up from the 0x01.) */
+ /*------------------------------------------------------------------------*/
+ seq_no = ((u_int16)tim_kind << 8) | (pst_tim_mng->sts[tim_kind].cnt);
+
+ return seq_no;
+}
+
+static BOOL VehicleUtilitySetTimer(GPS_TIM_KIND tim_kind) {
+ GPS_TIM_MNG* pst_tim_mng = NULL;
+ const uint32_t * p_time_val;
+ const PNO* p_pno;
+ RET_API api_ret = RET_NORMAL;
+ u_int16 seq_no = 0;
+ BOOL ret = TRUE;
+
+ // Initialize
+ pst_tim_mng = &g_st_tim_mng;
+ p_time_val = &(kTimInfo[tim_kind].timer_val); /* Timer set value */
+ p_pno = &(kTimInfo[tim_kind].pno); /* Notify party PNO */
+
+ if (pst_tim_mng->sts[tim_kind].flag == TIMER_ON) {
+ /*-----------------------------------------------------------------------*/
+ /* When the same timer has already started, */
+ /* terminate without starting the timer because the timer is set multiple times. */
+ /*-----------------------------------------------------------------------*/
+ ret = FALSE;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* Count up the timer counter of the corresponding timer by 1. */
+ /*-----------------------------------------------------------------------*/
+ if (pst_tim_mng->sts[tim_kind].cnt >= TIM_CNTMAX) {
+ /*-----------------------------------------------------------------------*/
+ /* When the count reaches the maximum number, it counts again from 1. */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].cnt = TIM_CNTMIN;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* If the count has not reached the maximum, it is counted up. */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].cnt++;
+ }
+
+ /*-----------------------------------------------------------------------*/
+ /* Creating timer sequence numbers */
+ /*-----------------------------------------------------------------------*/
+ seq_no = TimeMakSeqNo(tim_kind);
+
+ /*-----------------------------------------------------------------------*/
+ /* Start the timer */
+ /*-----------------------------------------------------------------------*/
+ api_ret = _pb_ReqTimerStart(*p_pno, seq_no, TIMER_TYPE_USN, static_cast<u_int32>(*p_time_val));
+ if (api_ret != RET_NORMAL) {
+ ret = FALSE;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* If successful timer start, */
+ /* set the start/stop flag of the corresponding timer to start (MCSUB_ON). */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].flag = TIMER_ON;
+ }
+ }
+
+ return ret;
+}
+
+static BOOL VehicleUtilityStopTimer(GPS_TIM_KIND tim_kind) {
+ GPS_TIM_MNG* pst_tim_mng = NULL;
+ const PNO* p_pno;
+ BOOL ret = TRUE;
+ RET_API api_ret = RET_NORMAL;
+ u_int16 seq_no = 0;
+
+ // Initialize
+ pst_tim_mng = &g_st_tim_mng;
+ p_pno = &(kTimInfo[tim_kind].pno); /* Notify party PNO */
+
+ /* Check timer start/stop flag */
+ if (pst_tim_mng->sts[tim_kind].flag == TIMER_OFF) {
+ /* If it is already stopped, do nothing. */
+ ret = FALSE;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* Creating timer sequence numbers */
+ /*-----------------------------------------------------------------------*/
+ seq_no = TimeMakSeqNo(tim_kind);
+
+ /*-----------------------------------------------------------------------*/
+ /* Set the corresponding timer to stop */
+ /*-----------------------------------------------------------------------*/
+ api_ret = _pb_TimerStop(*p_pno, seq_no, TIMER_TYPE_USN);
+
+ if (api_ret != RET_NORMAL) {
+ ret = FALSE;
+ }
+
+ /*-----------------------------------------------------------------------*/
+ /* Set the start/stop flag of the corresponding timer to stop (MCSUB_OFF) */
+ /* Set the ID of the corresponding timer to invalid (DEV_TED_INVALID) */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].flag = TIMER_OFF;
+ }
+
+ return ret;
+}
+
+static BOOL VehicleUtilityTimeJdgKnd(uint16_t seqno) {
+ GPS_TIM_MNG* pst_tim_mng = NULL;
+ BOOL ret = FALSE;
+ u_int8 timekind = 0;
+ u_int8 count = 0;
+
+ // Initialize
+ pst_tim_mng = &g_st_tim_mng;
+
+ timekind = (u_int8)((seqno & 0xff00) >> 8);
+ count = (u_int8)(seqno & 0x00ff);
+
+ /* Timer type is unexpected */
+ if (timekind >= TIM_NUM) {
+ ret = FALSE;
+ } else {
+ if ((pst_tim_mng->sts[timekind].cnt == count) && (pst_tim_mng->sts[timekind].flag == TIMER_ON)) {
+ /* The counter matches and the counter start/stop flag is "Start". */
+ ret = TRUE;
+ } else {
+ /* Not applicable due to differences */
+ ret = FALSE;
+ }
+ }
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Tim_Init
+ * ABSTRACT : Timer function initialization processing
+ * FUNCTION : Initialize the timer function
+ * ARGUMENT : None
+ * NOTE : 1.Initialize timer management table
+ * RETURN : None
+ ******************************************************************************/
+void DevGpsTimInit(void) {
+ GPS_TIM_MNG* pst_tim_mng = NULL;
+ u_int32 i = 0;
+
+ // Initialie
+ pst_tim_mng = &g_st_tim_mng;
+
+ /* Initialize timer management table */
+ memset(pst_tim_mng, 0x00, sizeof(GPS_TIM_MNG));
+
+ for (i = 0; i < TIM_NUM; i++) {
+ pst_tim_mng->sts[i].flag = TIMER_OFF;
+ pst_tim_mng->sts[i].cnt = 0;
+ }
+
+ return;
+}
+
+/*******************************************************************************
+ * MODULE : DevGpsTimeSet
+ * ABSTRACT : Timer start processing
+ * FUNCTION : Starts a timer of the specified type
+ * ARGUMENT : GPS_TIM_KIND tim_kind Timer type
+ * NOTE : 1.Increment total number of timer start
+ * 2.Timer Sequence Number Creation
+ * 3.Get timeout value
+ * 4.Timer start
+ * RETURN : TRUE : Normal completion
+ * : FALSE : ABENDs
+ ******************************************************************************/
+BOOL DevGpsTimeSet(GPS_TIM_KIND tim_kind) {
+ BOOL ret = TRUE;
+
+ /* Binding of unused timer */
+ if ((tim_kind != GPS_RECV_ACK_TIMER)
+ && (tim_kind != GPS_STARTUP_TIMER)
+ && (tim_kind != GPS_CYCL_TIMER)
+ && (tim_kind != GPS_NAVIFST_TIMER)
+ && (tim_kind != GPS_NAVICYCLE_TIMER)
+ && (tim_kind != GPS_NAVIDISRPT_TIMER)
+ && (tim_kind != GPS_RECOVERY_TIMER)
+ && (tim_kind != GPS_RECEIVERERR_TIMER)) {
+ return ret;
+ }
+ ret = VehicleUtilitySetTimer(tim_kind);
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : DevGpsTimeStop
+ * ABSTRACT : Timer stop processing
+ * FUNCTION : Stops a timer of the specified type
+ * ARGUMENT : GPS_TIM_KIND tim_kind Timer type
+ * NOTE : 1.Get the sequence number of the specified type
+ * 2.Timer stop
+ * RETURN : TRUE : Normal completion
+ * : FALSE : ABENDs
+ ******************************************************************************/
+BOOL DevGpsTimeStop(GPS_TIM_KIND tim_kind) {
+ BOOL ret = TRUE;
+ ret = VehicleUtilityStopTimer(tim_kind);
+ return ret;
+}
+
+/********************************************************************************
+ * MODULE : DevGpsTimeJdgKind
+ * ABSTRACT : Timer Sequence Number Determination
+ * FUNCTION : Determine whether the timer sequence number corresponds to the one being managed
+ * ARGUMENT : Timer Sequence Number
+ * NOTE :
+ * RETURN : TRUE : Normal completion(No problem)
+ * : FALSE : ABENDs(Unusual number)
+ ********************************************************************************/
+BOOL DevGpsTimeJdgKind(u_int16 seqno) {
+ BOOL ret;
+ ret = VehicleUtilityTimeJdgKnd(seqno);
+ return ret;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/LineSensDrv/LineSensDrv_Api.cpp b/positioning_hal/src/LineSensDrv/LineSensDrv_Api.cpp
new file mode 100755
index 0000000..d363a4b
--- /dev/null
+++ b/positioning_hal/src/LineSensDrv/LineSensDrv_Api.cpp
@@ -0,0 +1,136 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Api.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "LineSensDrv_Api.h"
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Macro definitions
+
+#define LSDRV_GPS_DATA_TOP_TH 5 // Threshold for determining the beginning of GPS data
+#define LSDRV_SENS_DATA_RCV_WAIT_TIME 400 // Sensor data wait time of GPS reception flag ON(Total)
+#define LSDRV_SENS_DATA_RCV_WAIT_TERM 50 // Sensor data wait time of GPS reception flag ON(1 time)
+
+#define LSDRV_EST_GPS_CNT_ARRAY_NUM 3U // Number of arrays for holding estimated GPS counter
+#define LSDRV_EST_GPS_CNT_ENABLE_TH 5U // Estimated GPS counter enable/disable determination threshold
+#define LSDRV_EST_GPS_CNT_ADD_VALUE 10U // Estimated GPS counter update addition value
+
+// GPS data reception cycle:1sec sensor counters: 100ms
+
+// for debug
+#define LINE_SENS_DRV_API_DEBUG_SWITCH 0 // 0:OFF 1:ON
+
+/*---------------------------------------------------------------------------*/
+// Global variable
+
+static HANDLE g_gps_irq_mutex = NULL; // GPS received flag Mutex handles
+static BOOL g_rcv_pps_int = FALSE; // PPS interrupt reception flag (GPS->_CWORD102_)
+static BOOL g_rcv_gps_irq = FALSE; // GPS reception flag (GPS->_CWORD56_)
+static u_int8 g_rcv_gps_sens_cnt_tmp = 0; // Sensor counter when GPS reception flag is ON(for retention)
+static u_int8 g_rcv_gps_sens_cnt = 0; // Sensor counter when GPS reception flag is ON
+static u_int8 g_gps_sens_cnt_top = 0; // Sensor counter when first GPS data is received
+static u_int8 g_est_gps_cnt[LSDRV_EST_GPS_CNT_ARRAY_NUM]; // Array for storing estimated GPS counter values
+static BOOL g_est_gps_cnt_available = FALSE; // Estimated GPS counter value enable/disable judgment
+
+typedef struct VehicleSensDataMaster {
+ DID ul_did; // Data ID
+ u_int16 us_size; // Size of the data
+ u_int8 uc_rcv_flag; // Receive flag
+ u_int8 uc_sns_cnt; // Sensor counter
+ u_int8 uc_data[132]; // Vehicle sensor data
+} VEHICLESENS_DATA_MASTER;
+
+
+/*******************************************************************************
+ * MODULE : DeliveryLineSensorDataPositioning
+ * ABSTRACT : LineSensor vehicle signaling notification messages sending process
+ * FUNCTION : Send LineSensor vehicle signalling notification messages
+ * ARGUMENT : *pstSendBuf:Transmitted data
+ * : uc_data_num :Number of sent data
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void DeliveryLineSensorDataPositioning(LSDRV_MSG_LSDATA_G* pst_send_buf, u_int8 uc_data_num) {
+ if (pst_send_buf != NULL) {
+ /* Initializing sent messages */
+ memset(reinterpret_cast<void *>(&(pst_send_buf->st_head)), 0, sizeof(T_APIMSG_MSGBUF_HEADER));
+
+ /* Message Header Settings */
+ pst_send_buf->st_head.hdr.sndpno = PNO_LINE_SENS_DRV; /* Source process number */
+ pst_send_buf->st_head.hdr.cid = CID_LINESENS_VEHICLE_DATA_G; /* Command ID */
+ pst_send_buf->st_head.hdr.msgbodysize = sizeof(LSDRV_MSG_LSDATA_DAT_G); /* Message data body length */
+
+ /* Message data is already set */
+ pst_send_buf->st_para.uc_data_num = uc_data_num;
+
+ /* Send messages */
+ (void)_pb_ZcSndMsg(PNO_VEHICLE_SENSOR, sizeof( LSDRV_MSG_LSDATA_G ), 0);
+ }
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrvApi_Initialize
+ * ABSTRACT : LineSensDrvApi initialization process
+ * FUNCTION : LineSensDrvApi initialization process
+ * ARGUMENT : -
+ * NOTE :
+ * RETURN : -
+ ******************************************************************************/
+BOOL LineSensDrvApiInitialize(void) {
+ BOOL ret = TRUE;
+
+ g_gps_irq_mutex = _pb_CreateMutex(NULL, FALSE, MUTEX_GPS_IRQ_FLG);
+
+ if (g_gps_irq_mutex == 0) {
+ ret = FALSE;
+ } else {
+ g_rcv_gps_irq = FALSE;
+ g_rcv_gps_sens_cnt_tmp = 0;
+ LineSensDrvApiInitEstGpsCnt();
+ ret = TRUE;
+ }
+
+ return (ret);
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrvApi_InitEstGpsCnt
+ * ABSTRACT : Estimated GPS counter related parameter initialization processing
+ * FUNCTION : Estimated GPS counter related parameter initialization processing
+ * ARGUMENT : -
+ * NOTE :
+ * RETURN : -
+ ******************************************************************************/
+void LineSensDrvApiInitEstGpsCnt(void) {
+ /* Initializing process */
+ g_rcv_pps_int = FALSE;
+ g_rcv_gps_sens_cnt = 0;
+ g_gps_sens_cnt_top = 0;
+
+ (void)memset(reinterpret_cast<void *>(&g_est_gps_cnt[0]), 0, sizeof(g_est_gps_cnt));
+ g_est_gps_cnt_available = FALSE;
+
+ return;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/LineSensDrv/LineSensDrv_Sensor.cpp b/positioning_hal/src/LineSensDrv/LineSensDrv_Sensor.cpp
new file mode 100755
index 0000000..78ae488
--- /dev/null
+++ b/positioning_hal/src/LineSensDrv/LineSensDrv_Sensor.cpp
@@ -0,0 +1,622 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Snesor.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "LineSensDrv_Sensor.h"
+#include "LineSensDrv_Api.h"
+
+/*---------------------------------------------------------------------------*/
+// Value Define
+
+#define LSDRV_MASK_WORD_L 0x00FF
+#define LSDRV_MASK_WORD_U 0xFF00
+
+#define LINE_SENS_DRV_SENSOR_DEBUG_FACTORY 0
+#define LINE_SENS_DRV_SENSOR_DEBUG_DIAG 0
+
+#define VEHICLE_SNS_INFO_PULSE_NUM 32
+
+/*---------------------------------------------------------------------------*/
+// Global variable
+
+static LSDRV_SPEEDKMPH_DAT g_speed_kmph_data;
+static uint8_t g_rcv_data_len; /* Receive SYS data length */
+extern uint8_t g_uc_vehicle_reverse;
+/*---------------------------------------------------------------------------*/
+// Functions
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_Sensor
+ * ABSTRACT : Sensor data reception processing
+ * FUNCTION : Convert sensor data to delivery format
+ * ARGUMENT : *ucRcvdata : Data pointer
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void LineSensDrvSensor(u_int8* uc_rcvdata) {
+ u_int8 uc_sens_cnt = 0;
+ u_int16 us_sp_kmph = 0; /* Vehicle speed(km/h) */
+ u_int16 us_sp_pls1 = 0; /* Total vehicle speed pulse(Latest) */
+ u_int16 us_sp_pls2 = 0; /* Total vehicle speed pulse(Last time) */
+ u_int8 us_sp_ret = 0; /* Last vehicle speed information acquisition result */
+ u_int8 uc_size = 0; /* Size of the data */
+ u_int16 us_cnt = 0; /* Data counter */
+ u_int16 us_cnt2 = 0; /* Data counter */
+ u_int8* uc_data_pos = NULL; /* Data storage location */
+ LSDRV_MSG_LSDATA_G* p_snd_buf = NULL;
+ LSDRV_LSDATA_G* p_snd_data_base = NULL;
+ LSDRV_LSDATA_G* p_snd_data = NULL;
+ RET_API ret = RET_NORMAL;
+
+ /* Receive sensor data top address acquisition */
+ uc_data_pos = (uc_rcvdata);
+
+ /* Create send buffer/delivery all received data */
+ ret = _pb_GetZcSndBuf(PNO_VEHICLE_SENSOR, reinterpret_cast<void**>(&p_snd_buf));
+ if ((ret == RET_NORMAL) && (p_snd_buf != NULL)) {
+ p_snd_data_base = p_snd_buf->st_para.st_data;
+ (void)memset(p_snd_data_base, 0, LSDRV_KINDS_MAX * sizeof( LSDRV_LSDATA_G ));
+
+ /* Sensor counter */
+ p_snd_data = p_snd_data_base + LSDRV_SNS_COUNTER;
+ uc_sens_cnt = (u_int8)*(uc_data_pos);
+ p_snd_data->ul_did = VEHICLE_DID_SNS_COUNTER; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_1; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ p_snd_data->uc_data[0] = uc_sens_cnt; /* Data content */
+ uc_data_pos = (uc_data_pos + LSDRV_SNDMSG_DTSIZE_1);
+
+ /* Gyro output */
+ p_snd_data = p_snd_data_base + LSDRV_GYRO_EXT;
+ p_snd_data->ul_did = VEHICLE_DID_GYRO_EXT; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_20; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ for (us_cnt = 0; us_cnt < LSDRV_SNDMSG_DTSIZE_20; us_cnt++) {
+ /* Since [0] is older and [9] is newer, the order of received data is switched. */
+ /* Be in reverse order for endian conversion */
+ p_snd_data->uc_data[LSDRV_SNDMSG_DTSIZE_20 - (us_cnt + 1)] = (u_int8)*(uc_data_pos + us_cnt);
+ }
+ uc_data_pos = (uc_data_pos + LSDRV_SNDMSG_DTSIZE_20);
+
+ p_snd_data = p_snd_data_base + LSDRV_GYRO_X;
+ p_snd_data->ul_did = VEHICLE_DID_GYRO; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_20; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ for (us_cnt = 0; us_cnt < LSDRV_SNDMSG_DTSIZE_20; us_cnt++) {
+ /* Since [0] is older and [9] is newer, the order of received data is switched. */
+ /* Be in reverse order for endian conversion */
+ p_snd_data->uc_data[LSDRV_SNDMSG_DTSIZE_20 - (us_cnt + 1)] = (u_int8)*(uc_data_pos + us_cnt);
+ }
+ uc_data_pos = (uc_data_pos + LSDRV_SNDMSG_DTSIZE_20);
+
+ /* Reverse flag */
+ p_snd_data = p_snd_data_base + LSDRV_REV;
+ p_snd_data->ul_did = VEHICLE_DID_REV; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_1; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor Counter */
+ p_snd_data->uc_data[0] = g_uc_vehicle_reverse;
+ /* Gyro Temperature */
+ p_snd_data = p_snd_data_base + LSDRV_GYRO_TEMP;
+ p_snd_data->ul_did = VEHICLE_DID_GYRO_TEMP; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_2; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ p_snd_data->uc_data[1] = (u_int8)(*(uc_data_pos ) & (u_int8)(LSDRV_TEMP_MASK >> 8));
+ p_snd_data->uc_data[0] = (u_int8)(*(uc_data_pos + 1) & (u_int8)(LSDRV_TEMP_MASK));
+ uc_data_pos = (uc_data_pos + LSDRV_SNDMSG_DTSIZE_2);
+
+ /* Vehicle speed pulse */
+ p_snd_data = p_snd_data_base + LSDRV_SPEED_PULSE;
+ p_snd_data->ul_did = VEHICLE_DID_SPEED_PULSE; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_20; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ for (us_cnt = 0; us_cnt < LSDRV_SNDMSG_DTSIZE_20; us_cnt++) {
+ /* Since [0] is older and [9] is newer, the order of received data is switched. */
+ /* Be in reverse order for endian conversion */
+ p_snd_data->uc_data[LSDRV_SNDMSG_DTSIZE_20 - (us_cnt + 1)] = (u_int8)*(uc_data_pos + us_cnt);
+ }
+ uc_data_pos = (uc_data_pos + LSDRV_SNDMSG_DTSIZE_20);
+
+ /* Vehicle speed(km/h) */
+ p_snd_data = p_snd_data_base + LSDRV_SPEED_PULSE;
+ us_sp_kmph = 0;
+ us_sp_pls1 = (u_int16)p_snd_data->uc_data[1];
+ us_sp_pls1 = (u_int16)((us_sp_pls1 << 8) | p_snd_data->uc_data[0]);
+ us_sp_ret = LineSensDrvGetLastSpeedPulse(&us_sp_pls2, us_sp_pls1, uc_sens_cnt);
+
+ LineSensDrvSetLastSpeedPulse(us_sp_pls1, uc_sens_cnt);
+
+ p_snd_data = p_snd_data_base + LSDRV_SPEED_KMPH;
+ if (us_sp_ret != LSDRV_SPKMPH_INVALID) {
+ /* Vehicle speed pulse before 100 ms is valid */
+ LineSensDrvSpeedPulseSave(us_sp_pls1, us_sp_pls2, uc_sens_cnt);
+ us_sp_kmph = LineSensDrvSpeedCalc(uc_sens_cnt);
+ /* The size can be set only when the vehicle speed [km/h] is calculated. "0" is notified to the vehicle sensor when the size cannot be set. */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_2; /* Size of the data */
+ }
+ p_snd_data->ul_did = VEHICLE_DID_SPEED_KMPH; /* Data ID */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ p_snd_data->uc_data[0] = (u_int8)(us_sp_kmph & 0x00FF);
+ p_snd_data->uc_data[1] = (u_int8)(us_sp_kmph >> 8);
+
+ POSITIONING_LOG("[LOG, %d(cnt), %d(km/h), %d(pls1), %d(pls2)] \r\n",
+ uc_sens_cnt,
+ us_sp_kmph,
+ us_sp_pls1,
+ us_sp_pls2);
+
+ /* G-Sensor X-axes */
+ p_snd_data = p_snd_data_base + LSDRV_GSENSOR_X;
+ p_snd_data->ul_did = VEHICLE_DID_GSNS_X; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_20; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ us_cnt2 = p_snd_data->uc_size - 1;
+ for (us_cnt = 0; us_cnt < 10; us_cnt++) {
+ /* Since [0] is older and [9] is newer, the order of received data is switched. */
+ p_snd_data->uc_data[us_cnt2 ] = (u_int8)*( uc_data_pos + (sizeof(SENSORINPUT_INFO_DAT_GSENS) * us_cnt) );
+ p_snd_data->uc_data[us_cnt2 - 1] = (u_int8)*( uc_data_pos + (sizeof(SENSORINPUT_INFO_DAT_GSENS) * us_cnt) + 1);
+ us_cnt2 = us_cnt2 - 2;
+ }
+
+ /* G-Sensor Y-axes */
+ p_snd_data = p_snd_data_base + LSDRV_GSENSOR_Y;
+ p_snd_data->ul_did = VEHICLE_DID_GSNS_Y; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_20; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ us_cnt2 = p_snd_data->uc_size - 1;
+ for (us_cnt = 0; us_cnt < 10; us_cnt++) {
+ /* Since [0] is older and [9] is newer, the order of received data is switched. */
+ p_snd_data->uc_data[us_cnt2] = (u_int8)*( (uc_data_pos + sizeof(u_int16)) \
+ + (sizeof(SENSORINPUT_INFO_DAT_GSENS) * us_cnt));
+
+ p_snd_data->uc_data[us_cnt2-1] = (u_int8)*( (uc_data_pos + sizeof(u_int16)) \
+ + (sizeof(SENSORINPUT_INFO_DAT_GSENS) * us_cnt) + 1);
+ us_cnt2 = us_cnt2 - 2;
+ }
+ uc_data_pos = ( uc_data_pos + (sizeof(SENSORINPUT_INFO_DAT_GSENS) * 10) );
+
+ /* Inter-Pulse time */
+ p_snd_data = p_snd_data_base + LSDRV_PULSE_TIME;
+ p_snd_data->ul_did = VEHICLE_DID_PULSE_TIME; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_132; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+
+ /* Clear the buffer for variable length */
+ (void)memset(&p_snd_data->uc_data[0], 0x00, sizeof(p_snd_data->uc_data));
+
+ if (g_rcv_data_len == LSDRV_PLSTIME_LEN) {
+ /* Inter-Pulse time (number of items + time). The number of items is stored at the beginning. */
+ uc_size = (u_int8)*uc_data_pos;
+ if (uc_size > VEHICLE_SNS_INFO_PULSE_NUM) {
+ uc_size = VEHICLE_SNS_INFO_PULSE_NUM;
+ }
+ p_snd_data->uc_data[0] = uc_size;
+ p_snd_data->uc_data[1] = 0x00;
+ p_snd_data->uc_data[2] = 0x00;
+ p_snd_data->uc_data[3] = 0x00;
+ uc_data_pos = ( uc_data_pos + sizeof(u_int8) );
+
+ /* Since [0] is old and [31] is new in the received time, the order is changed. */
+ /* Be in reverse order for endian conversion */
+ for (us_cnt = 0; us_cnt < (uc_size * sizeof(u_int32)); us_cnt++) {
+ p_snd_data->uc_data[(uc_size * sizeof(u_int32)) - (us_cnt + 1) + 4] = (u_int8)*(uc_data_pos + us_cnt);
+ }
+ }
+
+ /* Messaging */
+ DeliveryLineSensorDataPositioning(p_snd_buf, LSDRV_KINDS_MAX);
+ }
+
+ return;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_SpeedCalc
+ * ABSTRACT : Vehicle speed calculation processing for sensor data
+ * FUNCTION : Calculate vehicle speed for sensor data
+ * ARGUMENT : uc_sens_cnt : Sensor counter
+ * NOTE :
+ * RETURN : Vehicle speed(0.01km/h)
+ ******************************************************************************/
+u_int16 LineSensDrvSpeedCalc(u_int8 uc_sens_cnt) {
+ u_int32 ul_sp_caluc = 0; /* Vehicle speed(2^-8km/h) */
+ u_int16 us_speed = 0; /* Vehicle speed(km/h) */
+ u_int8 uc_ptr = 0; /* Data storage pointer for sensor data */ /* #010 */
+ u_int8 uc_ptr2 = 0; /* Data storage pointer for sensor data */ /* #010 */
+ u_int32 ul_work = 0; /* Variables for unsigned 32-bit type calculations */ /* #010 */
+ double d_work = 0.0; /* Variables for calculating double types */ /* #010 */ /* Ignore -> MISRA-C++:2008 Rule 3-9-2 */
+ u_int16 us_sens_cnt_search = 0; /* Sensor counter to be searched */ /* #010 */
+ u_int16 us_sens_cnt_ref = 0; /* Sensor counters to be compared */ /* #010 */
+ int32 i = 0; /* Generic counters */ /* #010 */
+ int32 j = 0; /* Generic counters */ /* #010 */
+ u_int16 us_offset = 0; /* Offset value */ /* #010 */
+
+ /* #016 start */
+ /* Is the number of data that can be calculated at the vehicle speed already received? */
+ if (LSDRV_PLSDATA_NRCV == g_speed_kmph_data.uc_calc_start) {
+ /* Do not compute if there is not enough data. */
+ } else {
+ if (0 == g_speed_kmph_data.uc_ptr) {
+ uc_ptr = LSDRV_SPKMPH_TBL_NUM - 1;
+ uc_ptr2 = LSDRV_SPKMPH_TBL_NUM - 1;
+ } else {
+ uc_ptr = g_speed_kmph_data.uc_ptr - 1; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ uc_ptr2 = g_speed_kmph_data.uc_ptr - 1; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ ul_work = 0;
+ if (LSDRV_SPKMPH_AVE_TIME > uc_sens_cnt) {
+ us_offset = LSDRV_SENSCNT_BRW_ADD;
+ } else {
+ us_offset = 0;
+ }
+
+ us_sens_cnt_search = (u_int16)uc_sens_cnt + us_offset - LSDRV_SPKMPH_AVE_TIME;
+
+ for (i = 0; i < LSDRV_SPKMPH_TBL_NUM; i++) {
+ /* Invalid data is detected, and the search is completed. */
+ if (LSDRV_SPKMPH_DATA_DIS == g_speed_kmph_data.st_data[uc_ptr].uc_flag) {
+ break;
+ }
+
+ /* When the sensor counter is 29 or less, the borrow is considered. */
+ if (LSDRV_SPKMPH_AVE_TIME > g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt) {
+ us_sens_cnt_ref = g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt + us_offset;
+ } else {
+ us_sens_cnt_ref = g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt;
+ }
+
+ /* Checking the sensor counter to finish search */
+ if (us_sens_cnt_search >= us_sens_cnt_ref) {
+ break;
+ }
+
+ /* Add to calculate average value */
+ ul_work += (u_int32)g_speed_kmph_data.st_data[uc_ptr].us_speed_pulse;
+
+ if (0 == uc_ptr) {
+ uc_ptr = LSDRV_SPKMPH_TBL_NUM - 1; /* To the end of the data table */
+ } else {
+ uc_ptr--; /* To the previous data */
+ }
+ }
+
+ /* Averaging computation */
+ if (0 == i) {
+ d_work = 0;
+ } else {
+ if (ul_work == 1) {
+ for (j = 0; j < LSDRV_SPKMPH_TBL_NUM; j++) {
+ if ((g_speed_kmph_data.st_data[uc_ptr2].us_speed_pulse == 1)
+ && (g_speed_kmph_data.st_data[uc_ptr2].uc_noise_flag == 1)) {
+ ul_work = 0;
+ break;
+ } else if (g_speed_kmph_data.st_data[uc_ptr2].us_speed_pulse == 1 &&
+ g_speed_kmph_data.st_data[uc_ptr2].uc_noise_flag == 0) {
+ ul_work = 1;
+ break;
+ } else {
+ /* nop */
+ }
+
+ /* Borrow actions for pointer values */
+ if (0 == uc_ptr2) {
+ uc_ptr2 = LSDRV_SPKMPH_TBL_NUM - 1; /* To the end of the data table */
+ } else {
+ uc_ptr2--; /* To the previous data */
+ }
+ }
+ }
+
+ d_work = static_cast<double>(ul_work);
+ d_work = d_work / static_cast<double>(i);
+ d_work = d_work * static_cast<double>(LSDRV_SENS_COEFFICIENT);
+ d_work = d_work * 100; /* [1km/h] -> [0.01km/h] */
+ d_work = d_work + 0.5; /* Preparation for rounding */
+ }
+
+ ul_sp_caluc = static_cast<int32>(d_work);
+
+ /* When the vehicle speed calculation result overflows, the upper limit value is used for clipping. */
+ if (LSDRV_PLSMAX - 1 >= ul_sp_caluc) {
+ us_speed = (u_int16)ul_sp_caluc;
+ } else {
+ us_speed = (u_int16)(LSDRV_PLSMAX - 1);
+ }
+ }
+
+ return us_speed;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_SpeedKmphDataInit
+ * ABSTRACT : Data table initialization process for vehicle speed calculation
+ * FUNCTION : Initialize the data table for calculating the vehicle speed
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void LineSensDrvSpeedKmphDataInit(void) {
+ int32 i = 0;
+
+ memset(reinterpret_cast<void*>(&g_speed_kmph_data), static_cast<int32>(0), (size_t)sizeof(g_speed_kmph_data));
+
+ /* Disable all data storage flags */
+ for (i = 0; i < LSDRV_SPKMPH_TBL_NUM; i++) {
+ g_speed_kmph_data.st_data[i].uc_flag = LSDRV_SPKMPH_DATA_DIS;
+ }
+
+ return;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_SpeedPulseSave
+ * ABSTRACT : Sensor data vehicle speed pulse save processing
+ * FUNCTION : Saving the vehicle speed pulse of the sensor data to the data table for calculating the vehicle speed
+ * ARGUMENT : us_sp1 : Vehicle speed pulse of the latest information
+ * : us_sp2 : Vehicle speed pulse of the previous information
+ * : uc_sens_cnt : Sensor counter
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void LineSensDrvSpeedPulseSave(u_int16 us_sp1, u_int16 us_sp2, u_int8 uc_sens_cnt) {
+ u_int16 us_sp_diff = 0; /* Vehicle speed pulse difference */
+ u_int8 uc_ptr = 0; /* Data storage pointer for sensor data */ /* #010 */
+ u_int8 us_last_ptr = 0; /* Last pointer */ /* #010 */
+ int32 i = 0; /* Generic counters */ /* #010 */
+ u_int8 uc_fstsns_cnt = 0; /* Initial sensor data sensor counter value */ /* #016 */
+ int32 l_data_num = 0; /* Number of registered data */ /* #016 */
+ u_int8 uc_noise_flag = 0; /* Noise flag */ /* #017 */
+
+ /* Calculate the vehicle speed pulse difference between the latest and last 100ms information */
+ if (us_sp1 >= us_sp2) {
+ /* The cumulative pulse number of the latest information is larger. */
+ us_sp_diff = us_sp1 - us_sp2; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ } else {
+ /* The cumulative pulse number of the latest information is smaller (the accumulated pulse overflows) */
+ us_sp_diff = (LSDRV_PLSMAX - us_sp2) + us_sp1; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Call noise check only if us_sp_diff is 1 */
+ if (us_sp_diff == 1) {
+ uc_noise_flag = LineSensDrvCheckNoise(uc_sens_cnt);
+ }
+
+ /* Saving sensor data vehicle speed pulse in data table for vehicle speed calculation */
+ if (LSDRV_PLSDATA_NRCV == g_speed_kmph_data.uc_sns_rcv) {
+ if (LSDRV_PLSDATA_RCV == g_speed_kmph_data.uc_fstsns_rcv) {
+ /* If the sensor data has already been received for the first time, set the temporary sensor counter value when the sensor data has been saved for the first time. */
+ uc_fstsns_cnt = uc_sens_cnt;
+ for (i = (LSDRV_SPKMPH_TBL_NUM - 1); i >= 0 ; i--) {
+ if (LSDRV_SPKMPH_DATA_EN == g_speed_kmph_data.st_data[i].uc_flag) {
+ /* Data storage flag is valid */
+ if (0 != uc_fstsns_cnt) {
+ uc_fstsns_cnt--;
+ } else {
+ uc_fstsns_cnt = LSDRV_SENSCNT_MAX;
+ }
+
+ g_speed_kmph_data.st_data[i].uc_sens_cnt = uc_fstsns_cnt;
+ }
+ }
+ }
+
+ /* Sensor data reception status <- "Received" */
+ g_speed_kmph_data.uc_sns_rcv = LSDRV_PLSDATA_RCV;
+ }
+
+ uc_ptr = g_speed_kmph_data.uc_ptr;
+
+ /* If the sensor counter is the same as the previous one, overwrite update */
+ if (0 == uc_ptr) {
+ us_last_ptr = LSDRV_SPKMPH_TBL_NUM - 1;
+ } else {
+ us_last_ptr = uc_ptr - 1; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ if (g_speed_kmph_data.st_data[us_last_ptr].uc_sens_cnt == uc_sens_cnt) {
+ /* Next update of the data storage location */
+ if (0 == g_speed_kmph_data.uc_ptr) {
+ g_speed_kmph_data.uc_ptr = LSDRV_SPKMPH_TBL_NUM - 1;
+ } else {
+ g_speed_kmph_data.uc_ptr--;
+ }
+
+ uc_ptr = g_speed_kmph_data.uc_ptr;
+ }
+
+ /* Input into data table for calculation of vehicle speed */
+ g_speed_kmph_data.st_data[uc_ptr].uc_flag = LSDRV_SPKMPH_DATA_EN; /* Data validity */
+ g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt = uc_sens_cnt; /* Sensor counter input */
+ g_speed_kmph_data.st_data[uc_ptr].us_speed_pulse = us_sp_diff; /* Vehicle speed pulse difference */
+ g_speed_kmph_data.st_data[uc_ptr].uc_noise_flag = uc_noise_flag; /* Noise flag */ /* #017 */
+
+ /* Next update of the data storage location */
+ if ((LSDRV_SPKMPH_TBL_NUM - 1) <= g_speed_kmph_data.uc_ptr) {
+ g_speed_kmph_data.uc_ptr = 0;
+ } else {
+ g_speed_kmph_data.uc_ptr++;
+ }
+
+ /* Determine whether the vehicle speed can be calculated. */
+ if (g_speed_kmph_data.uc_calc_start == LSDRV_PLSDATA_NRCV) {
+ /* Data count detection */
+ l_data_num = 0;
+ for (i = 0; i < LSDRV_SPKMPH_TBL_NUM; i++) {
+ if (LSDRV_SPKMPH_DATA_EN == g_speed_kmph_data.st_data[i].uc_flag) {
+ l_data_num++;
+ }
+ }
+
+ if (LSDRV_SPKMPH_MIN_DATA_N <= l_data_num) {
+ /* Vehicle Speed Calculation Required Data Number Received */
+ g_speed_kmph_data.uc_calc_start = LSDRV_PLSDATA_RCV;
+ }
+ }
+
+ return;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_CheckNoise
+ * ABSTRACT : Sensor data noise check processing
+ * FUNCTION : The vehicle speed pulse is saved in the data table for the vehicle speed calculation.
+ * ARGUMENT : uc_sens_cnt : Sensor counter of the latest data
+ * NOTE :
+ * RETURN : Noise flag
+ ******************************************************************************/
+u_int8 LineSensDrvCheckNoise(u_int8 uc_sens_cnt) {
+ int32 i = 0; /* Generic counters */
+ u_int16 us_sens_cnt_search = 0; /* Sensor counter to be searched*/
+ u_int8 uc_ptr = 0; /* Data storage pointer */
+ u_int16 us_offset = 0; /* Offset value */
+ u_int8 noise_flag = 0; /* Noise flag */
+ u_int16 us_sens_cnt_ref = 0; /* Sensor counters to be compared */
+
+ /* If there is no point where the difference in vehicle speed pulse is 1 or more
+ between -1 and -14 of sensor counter of the latest data,
+ set the noise flag of the latest data to 1. */
+ /* Set the noise flag to 1 */
+ noise_flag = 1;
+
+ /* The Target is the one before the storage location of the latest data. */
+ if (0 == g_speed_kmph_data.uc_ptr) {
+ uc_ptr = LSDRV_SPKMPH_TBL_NUM - 1;
+ } else {
+ uc_ptr = g_speed_kmph_data.uc_ptr - 1; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ if (LSDRV_SPKMPH_NOISE_TIME > uc_sens_cnt) {
+ us_offset = LSDRV_SENSCNT_BRW_ADD;
+ } else {
+ us_offset = 0;
+ }
+
+ us_sens_cnt_search = (u_int16)uc_sens_cnt + us_offset - LSDRV_SPKMPH_NOISE_TIME;
+
+ for (i = 0; i < LSDRV_SPKMPH_NOISE_TIME; i++) {
+ /* When the sensor counter is 15 or less, the borrow is considered. */
+ if (LSDRV_SPKMPH_NOISE_TIME > g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt) {
+ us_sens_cnt_ref = g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt + us_offset;
+ } else {
+ us_sens_cnt_ref = g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Checking the sensor Counter to Finish Search */
+ if (us_sens_cnt_ref <= us_sens_cnt_search) {
+ noise_flag = 1;
+ break;
+ } else {
+ if (g_speed_kmph_data.st_data[uc_ptr].us_speed_pulse >= 1) {
+ noise_flag = 0;
+ break;
+ }
+ }
+
+ /* Borrow actions for pointer values */
+ if (0 == uc_ptr) {
+ uc_ptr = LSDRV_SPKMPH_TBL_NUM - 1; /* To the end of the data table */
+ } else {
+ uc_ptr--; /* To the previous data */
+ }
+ }
+
+ return noise_flag;
+}
+
+/**
+ * @brief
+ * Return the last (100ms ago) vehicle speed pulse
+ *
+ * @param[out] us_sp2 Last vehicle speed pulse
+ * @param[in] us_sp1 The latest vehicle speed pulse
+ * @param[in] uc_sens_cnt Latest sensor counter
+ *
+ * @return LSDRV_SPKMPH_INVALID Vehicle speed pulse information valid<br>
+ * LSDRV_SPKMPH_VALID Vehicle speed pulse information invalid
+ */
+u_int8 LineSensDrvGetLastSpeedPulse(u_int16* us_sp2, u_int16 us_sp1, u_int8 uc_sens_cnt) {
+ u_int8 ret = LSDRV_SPKMPH_INVALID; /* Return value */
+ u_int16 sp_pls_diff = 0; /* Vehicle speed pulse difference */
+ u_int16 sp_pls = 0; /* Vehicle speed pulse every 100 ms */
+ u_int8 cnt_diff = 0; /* Sensor counter difference */
+
+ /* Check if the last vehicle speed pulse has been set */
+ if (g_speed_kmph_data.st_last_data.uc_flag == LSDRV_SPKMPH_DATA_EN) {
+ /* Differential calculation of sensor counter */
+ if (uc_sens_cnt >= g_speed_kmph_data.st_last_data.uc_sens_cnt) {
+ /* Latest sensor counter is larger */
+ cnt_diff = uc_sens_cnt - g_speed_kmph_data.st_last_data.uc_sens_cnt;
+ } else {
+ /* Last sensor counter is larger(sensor counter overflows) */
+ cnt_diff = (LSDRV_SENSCNT_MAX - g_speed_kmph_data.st_last_data.uc_sens_cnt) + uc_sens_cnt + 1;
+ }
+
+ /* Check if sensor counter is continuous */
+ if (cnt_diff <= 1) {
+ /* Continuous or same as the previous one, so the previous (100ms previous) vehicle speed pulse is set as it is */
+ *us_sp2 = g_speed_kmph_data.st_last_data.us_speed_pulse;
+ } else {
+ /* Determine the vehicle speed pulse 100ms ago from the average considering the skipped portion because it is not consecutive. */
+ if (us_sp1 >= g_speed_kmph_data.st_last_data.us_speed_pulse) {
+ /* Larger latest cumulative vehicle speed pulse */
+ sp_pls_diff = us_sp1 - g_speed_kmph_data.st_last_data.us_speed_pulse;
+ } else {
+ /* Last cumulative vehicle speed pulse is larger(Cumulative vehicle speed pulse overflows) */
+ sp_pls_diff = (LSDRV_PLSMAX - g_speed_kmph_data.st_last_data.us_speed_pulse) + us_sp1;
+ }
+
+ /* Calculate average vehicle speed pulse including skip period */
+ sp_pls = (u_int16)(sp_pls_diff / cnt_diff);
+
+ /* Calculate the vehicle speed pulse 100ms ahead from the vehicle speed average */
+ if (us_sp1 >= sp_pls) {
+ /* Does not overflow even if the 100ms vehicle speed pulse is pulled from the latest one. */
+ *us_sp2 = us_sp1 - sp_pls;
+ } else {
+ /* Subtracting a 100ms vehicle speed pulse from the latest one overflows */
+ *us_sp2 = LSDRV_PLSMAX - (sp_pls - us_sp1);
+ }
+ }
+
+ ret = LSDRV_SPKMPH_VALID;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Return the last (100ms ago) vehicle speed pulse
+ *
+ * @param[in] us_sp Vehicle speed pulse
+ * @param[in] uc_sens_cnt Sensor counter
+ */
+void LineSensDrvSetLastSpeedPulse(u_int16 us_sp, u_int8 uc_sens_cnt) {
+ /* Vehicle speed pulse information valid setting */
+ g_speed_kmph_data.st_last_data.uc_flag = LSDRV_SPKMPH_DATA_EN;
+ /* Sensor counter setting */
+ g_speed_kmph_data.st_last_data.uc_sens_cnt = uc_sens_cnt;
+ /* Vehicle speed pulse setting */
+ g_speed_kmph_data.st_last_data.us_speed_pulse = us_sp;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/positioning_hal/src/LineSensDrv/LineSensDrv_Thread.cpp b/positioning_hal/src/LineSensDrv/LineSensDrv_Thread.cpp
new file mode 100755
index 0000000..9fb1c29
--- /dev/null
+++ b/positioning_hal/src/LineSensDrv/LineSensDrv_Thread.cpp
@@ -0,0 +1,125 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Thread.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "LineSensDrv_Thread.h"
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include "positioning_def.h"
+#include "positioning_common.h"
+/*---------------------------------------------------------------------------*/
+// Global variable
+
+static u_int8 g_sys_recv_flg = 0; // For debugging
+char g_threadname[] = "POS_Sens";
+uint8_t g_uc_vehicle_reverse = 0;
+uint8_t g_uc_reverse_state = 0;
+static BOOL g_line_sens_thread_stop = FALSE;
+
+#define POS_REV_STATE_PROCESSING 0
+#define POS_REV_STATE_IDLE 1
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_Thread
+ * ABSTRACT : LineSensor driver thread main process
+ * FUNCTION : Main processing
+ * ARGUMENT : lpvPara :
+ * NOTE :
+ * RETURN :
+ ******************************************************************************/
+EFrameworkunifiedStatus LineSensDrvThread(HANDLE h_app) {
+ int32 l_ret = RET_LSDRV_SUCCESS;
+ EFrameworkunifiedStatus l_status = eFrameworkunifiedStatusOK;
+
+
+ (void)PosSetupThread(h_app, ETID_POS_SENS);
+
+ /* Execute the initialization processes */
+ l_ret = LineSensDrvMainThreadInit(h_app);
+ if (RET_LSDRV_SUCCESS != l_ret) {
+ l_status = eFrameworkunifiedStatusFail;
+ }
+
+ return l_status;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_MainThread_Init
+ * ABSTRACT : Thread initialization process
+ * FUNCTION : Initialize thread
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : RET_LSDRV_SUCCESS:Success in initialization
+ * RET_LSDRV_ERROR :Initialization failed
+ ******************************************************************************/
+int32 LineSensDrvMainThreadInit(HANDLE h_app) {
+ int32 l_ret = RET_LSDRV_SUCCESS;
+ BOOL b_ret = TRUE;
+
+ /****** Global variable initialization **********/
+ LineSensDrvParamInit();
+
+ /****** LineSensDrvApi initialization **********/
+ b_ret = LineSensDrvApiInitialize();
+
+ if (TRUE != b_ret) {
+ l_ret = RET_LSDRV_ERROR;
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_Param_Init
+ * ABSTRACT : Global variable initialization processing
+ * FUNCTION : Initialize global variables
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void LineSensDrvParamInit(void) {
+ LineSensDrvSpeedKmphDataInit(); // Data table initialization process for vehicle speed calculation
+}
+
+/**
+ * @brief
+ * Pos_Sens thread stop processing
+ */
+void LineSensDrvThreadStopProcess(void) {
+ g_line_sens_thread_stop = TRUE;
+
+ if (POS_REV_STATE_IDLE == g_uc_reverse_state) {
+ PosTeardownThread(ETID_POS_SENS);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get initial sensor data reception flag
+ */
+u_int8 LineSensDrvGetSysRecvFlag(void) {
+ return g_sys_recv_flg;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/power_hal/LICENSE b/power_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/power_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/power_hal/Makefile b/power_hal/Makefile
new file mode 100755
index 0000000..b0a0c28
--- /dev/null
+++ b/power_hal/Makefile
@@ -0,0 +1,66 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libpower_hal.so
+
+HEADER := hal_api/power_hal.h
+
+######### include paths/files ###################
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+#CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include/stub
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH := /usr/agl/lib
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+#LIBS += -Wl,-Bdynamic -lCommUSB
+
+######### source files ##########################
+VPATH := src
+OBJS := power_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/power_hal/README.md b/power_hal/README.md
new file mode 100755
index 0000000..6841186
--- /dev/null
+++ b/power_hal/README.md
@@ -0,0 +1,3 @@
+power_hal library
+==================
+Power HAL implementation library for AGL Reference Board.
diff --git a/power_hal/hal_api/power_hal.h b/power_hal/hal_api/power_hal.h
new file mode 100755
index 0000000..f1acc42
--- /dev/null
+++ b/power_hal/hal_api/power_hal.h
@@ -0,0 +1,572 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file power_hal.h
+ * @brief Interface and struct define for power_hal
+ */
+
+#ifndef HAL_API_POWER_HAL_H_
+#define HAL_API_POWER_HAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup system_manager
+ * @{
+ */
+/** @addtogroup power_hal
+ * @ingroup system_manager
+ * @{
+ */
+/** @}*/ // end of power_hal
+/** @}*/ // end of system_manager
+
+/** @addtogroup power_supply_manager_shadow
+ * @{
+ */
+/** @addtogroup power_hal
+ * @ingroup power_supply_manager_shadow
+ * @{
+ */
+
+/**
+ * \~english Definition of program update is not occured
+ */
+#define PWR_PROGUPDATE_STATE_NONE (0x0)
+
+/**
+ * \~english Bit position of program update
+ */
+#define PWR_PROGUPDATE_STATE_UPDATED (0x01)
+
+/**
+ * \~english Bit position of map update
+ */
+#define PWR_PROGUPDATE_STATE_MAP_UPDATED (0x02)
+
+/**
+ * \~english Bit position of map difference update
+ */
+#define PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED (0x04)
+
+/**
+ * \~english None reset state
+ */
+#define PWR_DATA_RESET_STATE_NONE 0
+
+/**
+ * \~english Reset state for initialization of user information
+ */
+#define PWR_DATA_RESET_STATE_USER 1
+
+/**
+ * \~english Reset state for factory initialization
+ */
+#define PWR_DATA_RESET_STATE_FACTORY 2
+
+/*
+ * @~english
+ * @brief Command ID power_hal -> User
+ */
+/*! @~english power_hal command receive notification */
+#define CID_PWR_CMD_RCV 0x0103
+
+/*! @~english power_hal command send result notification */
+#define CID_PWR_CMD_SND_STS 0x0104
+
+/**
+ * \~english DRAM backup status
+ */
+enum PsmSysupDramT {
+ /**
+ * \~english normal value
+ */
+ PSM_SYSUP_DRAM_NORMAL,
+
+ /**
+ * \~english abnormal Soft Reset(software abnormality)
+ */
+ PSM_SYSUP_DRAM_SFTERRSR,
+
+ /**
+ * \~english need to discard backup dram
+ */
+ PSM_SYSUP_DRAM_DISCARD,
+
+ /**
+ * \~english max value
+ */
+ PSM_SYSUP_DRAM_MAX,
+};
+
+/**
+ * \~english Start Status
+ */
+enum PsmStartStatusT {
+ /**
+ * \~english cold start
+ */
+ PSM_START_STATUS_FACTRESET,
+
+ /**
+ * \~english hot start
+ */
+ PSM_START_STATUS_NORMAL,
+
+ /**
+ * \~english max value
+ */
+ PSM_START_STATUS_MAX,
+};
+
+/**
+ * \~english Communication state
+ */
+enum PsmComStsT {
+ /**
+ * \~english Communication normal
+ */
+ PSM_COM_STS_NORMAL,
+
+ /**
+ * \~english Communication abnormal
+ */
+ PSM_COM_STS_ABNORMAL,
+
+ /**
+ * \~english max value
+ */
+ PSM_COM_STS_MAX,
+};
+
+/**
+ * \~english DRAM power supply abnormality check result
+ */
+enum PsmDramStsT {
+ /**
+ * \~english DRAM power supply abnormality check result normal
+ */
+ PSM_DRAM_STS_NORMAL,
+
+ /**
+ * \~english DRAM power supply abnormality check result abnormal
+ */
+ PSM_DRAM_STS_ABNORMAL,
+
+ /**
+ * \~english max value
+ */
+ PSM_DRAM_STS_MAX,
+};
+
+/**
+ * \~english ACC customize setting.
+ */
+enum PsmAccCustomizeT {
+ /**
+ * \~english ACC customize setting OFF.
+ */
+ PSM_ACC_CUSTOMIZE_OFF,
+ /**
+ * \~english ACC customize setting ON.
+ */
+ PSM_ACC_CUSTOMIZE_ON
+};
+
+/**
+ * \~english Reset history recording flag.
+ */
+#define PSM_RESET_HISTORY (0x10000000)
+
+/**
+ * \~english Reset(Start-up) factor.
+ */
+enum PsmFactorT {
+ /**
+ * \~english none
+ */
+ PSM_FACTOR_NONE,
+ /**
+ * \~english Restart due to AGL.
+ */
+ PSM_FACTOR_AGL,
+ /**
+ * \~english Restart due to Tier1.
+ */
+ PSM_FACTOR_TIER1,
+ /**
+ * \~english Restart due to user.
+ */
+ PSM_FACTOR_USER,
+ /**
+ * \~english Restart due to AGL(Need to record reset history).
+ */
+ PSM_FACTOR_AGL_WITH_HISTORY = (PSM_RESET_HISTORY | PSM_FACTOR_AGL),
+ /**
+ * \~english Restart due to Tier1(Need to record reset history).
+ */
+ PSM_FACTOR_TIER1_WITH_HISTORY = (PSM_RESET_HISTORY | PSM_FACTOR_TIER1),
+ /**
+ * \~english Restart due to user(Need to record reset history).
+ */
+ PSM_FACTOR_USER_WITH_HISTORY = (PSM_RESET_HISTORY | PSM_FACTOR_USER)
+};
+
+/**
+ * \~english Reset information type.
+ */
+enum PowerHalResetInfoId {
+ /**
+ * \~english Count of error log.
+ */
+ AGL_ERRLOG_COUNTER = 0,
+ /**
+ * \~english Abnormal reset count detected by AGL.
+ */
+ AGL_RESET_COUNTER,
+ /**
+ * \~english State of program update.
+ */
+ AGL_PROGUPDATE_STATE,
+ /**
+ * \~english Data reset state.
+ */
+ AGL_DATARESET_STATE,
+ /**
+ * \~english Flag of abnormal reset.
+ */
+ AGL_ILLRESET_FLAG,
+ /**
+ * \~english Max of reset information type.
+ */
+ AGL_RESERVED_LIMIT = 32
+};
+
+/**
+ * \ingroup PsmNaviResetPower
+ * \~english @par Brief
+ * API to do navi reset that is forced reset if end sequence of MainSoC is not completed.
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [in] reset_factor Reset factor
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do navi reset process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmNaviResetPower(HANDLE h_app, PsmFactorT reset_factor);
+
+/**
+ * \ingroup PsmClrRamJudgeFlgPower
+ * \~english @par Brief
+ * API to do ram judge flag clear
+ * \~english @param [in] h_app Handle for Application
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do ram judge flag clear process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmClrRamJudgeFlgPower(HANDLE h_app);
+
+/**
+ * \ingroup PsmGetDramBackupStatusPower
+ * \~english @par Brief
+ * API to do get dram backup status
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_dram1 DRAM1 BackUp Status
+ * \~english @param [out] p_dram2 DRAM2 BackUp Status
+ * \~english @param [out] p_dram3 DRAM3 BackUp Status
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get dram backup status process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetDramBackupStatusPower(HANDLE h_app, PsmSysupDramT *p_dram1, PsmSysupDramT *p_dram2, PsmSysupDramT *p_dram3);
+
+/**
+ * \ingroup PsmGetStartStatusPower
+ * \~english @par Brief
+ * API to do get start status
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_start_sts start status
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get startup state process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetStartStatusPower(HANDLE h_app, PsmStartStatusT *p_start_sts);
+
+/**
+ * \ingroup PsmGetSyscomStatusPower
+ * \~english @par Brief
+ * API to do get communication status between mainsoc-sys
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_com_sts communication status between mainsoc-sys
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get communication status between mainsoc-sys process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetSyscomStatusPower(HANDLE h_app, PsmComStsT *p_com_sts);
+
+/**
+ * \ingroup PsmGetDramPowerSupplyAbnormalityCheckResultPower
+ * \~english @par Brief
+ * API to do get dram power supply abnormality check result
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_dram_sts DRAM power supply abnormality check result
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get dram power supply abnormality check result process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetDramPowerSupplyAbnormalityCheckResultPower(HANDLE h_app, PsmDramStsT *p_dram_sts);
+
+/**
+ * \ingroup PsmGetAccCustomizeSetting
+ * \~english @par Brief
+ * API to do get ACC customize setting
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_acc_customize ACC customize Setting
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get ACC customize setting.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT* p_acc_customize);
+
+/**
+ * \ingroup PsmChgAccCustomizeSetting
+ * \~english @par Brief
+ * API to do change ACC customize setting
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [in] acc_customize ACC customize Setting
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do set ACC customize setting.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmChgAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT acc_customize);
+
+/**
+ * \ingroup PsmGetStartupFactor
+ * \~english @par Brief
+ * API to do get start-up factor.
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_startup_factor Start-up factor
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get Start-up factor.
+ * - After the API call, start-up factor is clear.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetStartupFactor(HANDLE h_app, PsmFactorT* p_startup_factor);
+
+/**
+ * \ingroup PowerHalSetResetInfo
+ * \~english @par Brief
+ * API to do set reset information.
+ * \~english @param [in] id Reset information type.
+ * \~english @param [in] val setting value.
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * - Save error to non-volatile memory. [-1]
+ * \~english @par Detail
+ * - Do set value to Reset information type(\ref PowerHalResetInfoId). \n
+ * \ref AGL_PROGUPDATE_STATE is not applicable(Only get value used by \ref PowerHalGetResetInfo). \n
+ * Domains of each reset information type are as below. \n
+ * \ref AGL_ERRLOG_COUNTER : 0 <= val <= UINT32_MAX \n
+ * \ref AGL_RESET_COUNTER : 0 <= val <= UINT32_MAX \n
+ * \ref AGL_DATARESET_STATE : It is set as below in each state of data reset. \n
+ * None reset state == \ref PWR_DATA_RESET_STATE_NONE \n
+ * Reset state for initialization of user information == \ref PWR_DATA_RESET_STATE_USER \n
+ * Reset state for factory initialization == \ref PWR_DATA_RESET_STATE_FACTORY \n
+ * \ref AGL_ILLRESET_FLAG : val = 0 or 1 (Abnormal reset is 1)
+ * - When the API is success, setting value is saved as non-volatile data.
+ * - Non-volatile memory is allocated \ref AGL_RESERVED_LIMIT for extendability.
+ * - Values setting by the API are saved when it is cold start(is_batterydiscon is true of PsmSysMcEVSysResUpChkPrmT notified from power_hal).
+ * - The API is completed within 1msec after the API is called.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * PowerHalGetResetInfo
+ */
+int PowerHalSetResetInfo(enum PowerHalResetInfoId id, uint32_t val);
+
+/**
+ * \ingroup PowerHalGetResetInfo
+ * \~english @par Brief
+ * API to do get setting value of reset information .
+ * \~english @param [in] id Reset information type.
+ * \~english @param [out] val Buffer of value.
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * - Read fail of value. [-1]
+ * \~english @par Detail
+ * - Do get value from each reset information type(\ref PowerHalResetInfoId).
+ * - Value of \ref AGL_PROGUPDATE_STATE, low 3bits are assigned as below, \n
+ * and corresponding bit is set if state is updating. \n
+ * Low 1bit(\ref PWR_PROGUPDATE_STATE_UPDATED) : Program update \n
+ * Low 2bit(\ref PWR_PROGUPDATE_STATE_MAP_UPDATED) : Map update \n
+ * Low 3bit(\ref PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED) : Map difference update \n
+ * - The API is completed within 1msec after the API is called.
+ * - Completeness of data getting by the API is assured by lower layer than power_hal, \n
+ * and return -1 as internal IO error when it is occurred abnormal error.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * PowerHalSetResetInfo
+ */
+int PowerHalGetResetInfo(enum PowerHalResetInfoId id, uint32_t *val);
+
+/** @}*/ // end of power_hal
+/** @}*/ // end of power_supply_manager_shadow
+
+#endif // HAL_API_POWER_HAL_H_
diff --git a/power_hal/src/power_hal.cpp b/power_hal/src/power_hal.cpp
new file mode 100755
index 0000000..aba2d1e
--- /dev/null
+++ b/power_hal/src/power_hal.cpp
@@ -0,0 +1,97 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "power_hal.h"
+
+int PsmNaviResetPower(HANDLE h_app, PsmFactorT reset_factor) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmClrRamJudgeFlgPower(HANDLE h_app) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetDramBackupStatusPower(HANDLE h_app, PsmSysupDramT *p_dram1, PsmSysupDramT *p_dram2, PsmSysupDramT *p_dram3) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetStartStatusPower(HANDLE h_app, PsmStartStatusT *p_start_sts) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetSyscomStatusPower(HANDLE h_app, PsmComStsT *p_com_sts) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetDramPowerSupplyAbnormalityCheckResultPower(HANDLE h_app, PsmDramStsT *p_dram_sts) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT* p_acc_customize) {
+ if (NULL == h_app) {
+ return -1;
+ }
+ *p_acc_customize = PSM_ACC_CUSTOMIZE_ON;
+ return 0;
+}
+
+int PsmChgAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT acc_customize) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetStartupFactor(HANDLE h_app, PsmFactorT* p_startup_factor) {
+ if (NULL == h_app) {
+ return -1;
+ }
+ *p_startup_factor = PSM_FACTOR_NONE;
+ return 0;
+}
+
+int PowerHalSetResetInfo(enum PowerHalResetInfoId id, uint32_t val) {
+ return 0;
+}
+
+int PowerHalGetResetInfo(enum PowerHalResetInfoId id, uint32_t *val) {
+ return 0;
+}
diff --git a/security_hal/LICENSE b/security_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/security_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/security_hal/Makefile b/security_hal/Makefile
new file mode 100755
index 0000000..5435be7
--- /dev/null
+++ b/security_hal/Makefile
@@ -0,0 +1,67 @@
+#
+# @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libsecurity_hal.so
+
+HEADER := hal_api/security_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := security_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
+
diff --git a/security_hal/hal_api/security_hal.h b/security_hal/hal_api/security_hal.h
new file mode 100755
index 0000000..5d2bf90
--- /dev/null
+++ b/security_hal/hal_api/security_hal.h
@@ -0,0 +1,1131 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_SECURITY_HAL_H_
+#define HAL_API_SECURITY_HAL_H_
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * @file security_hal.h
+ */
+
+/** @addtogroup update_service
+ * @{
+ */
+/** @addtogroup security_hal
+ * @ingroup update_service
+ * @{
+ */
+
+/**
+ * \~english The max size of RSA modulus
+ */
+#define RSA_MODULUS_MAX_SIZE 2048
+/**
+ * \~english The max size of RSA public exponent
+ */
+#define RSA_PUBLIC_EXPONENT_MAX_SIZE 2048
+/**
+ * \~english The max size of RSA private exponent
+ */
+#define RSA_PRIVATE_EXPONENT_MAX_SIZE 2048
+/**
+ * \~english The minimum size of RSA padding
+ */
+#define RSA_PADDING_MINIMUM_SIZE 11
+
+/**
+ * \~english Cipher type
+ */
+enum CipherType {
+ /**
+ * \~english AES symmetric cipher
+ */
+ SYMMETRIC_CIPHER_AES = 1,
+ /**
+ * \~english BLOWFISH symmetric cipher
+ */
+ SYMMETRIC_CIPHER_BLOWFISH,
+ /**
+ * \~english CAST5 symmetric cipher
+ */
+ SYMMETRIC_CIPHER_CAST5,
+ /**
+ * \~english DES symmetric cipher
+ */
+ SYMMETRIC_CIPHER_DES,
+ /**
+ * \~english DESEDA symmetric cipher
+ */
+ SYMMETRIC_CIPHER_DESEDA,
+ /**
+ * \~english DESEDA3 symmetric cipher
+ */
+ SYMMETRIC_CIPHER_DESEDA3,
+ /**
+ * \~english IDEA symmetric cipher
+ */
+ SYMMETRIC_CIPHER_IDEA,
+ /**
+ * \~english RC2 symmetric cipher
+ */
+ SYMMETRIC_CIPHER_RC2,
+ /**
+ * \~english RC4 symmetric cipher
+ */
+ SYMMETRIC_CIPHER_RC4,
+ /**
+ * \~english RC5 symmetric cipher
+ */
+ SYMMETRIC_CIPHER_RC5,
+ /**
+ * \~english RSA asymmetric cipher
+ */
+ ASYMMETRIC_CIPHER_RSA,
+ /**
+ * \~english DSA asymmetric cipher
+ */
+ ASYMMETRIC_CIPHER_DSA,
+ /**
+ * \~english ECDSA asymmetric cipher
+ */
+ ASYMMETRIC_CIPHER_ECDSA
+};
+
+/**
+ * \~english Symmetric Cipher Mode
+ */
+enum SymmetricCipherMode {
+ /**
+ * \~english Stream symmetric cipher mode
+ */
+ SYMMETRIC_CIPHER_MODE_STREAM = 0x00000001,
+ /**
+ * \~english ECB symmetric cipher mode
+ */
+ SYMMETRIC_CIPHER_MODE_BLOCK_ECB = 0x00000002,
+ /**
+ * \~english CBC symmetric cipher mode
+ */
+ SYMMETRIC_CIPHER_MODE_BLOCK_CBC = 0x00000004,
+ /**
+ * \~english CFB symmetric cipher mode
+ */
+ SYMMETRIC_CIPHER_MODE_BLOCK_CFB = 0x00000008,
+ /**
+ * \~english OFB symmetric cipher mode
+ */
+ SYMMETRIC_CIPHER_MODE_BLOCK_OFB = 0x00000010
+};
+
+/**
+ * \~english Symmetric cipher Block Size
+ */
+enum SymmetricCipherBlockSize {
+ /**
+ * \~english Symmetric cipher block size is 4 bytes
+ */
+ SYMMETRIC_CIPHER_BLOCK_SIZE_4 = 0x00000001,
+ /**
+ * \~english Symmetric cipher block size is 8 bytes
+ */
+ SYMMETRIC_CIPHER_BLOCK_SIZE_8 = 0x00000002,
+ /**
+ * \~english Symmetric cipher block size is 16 bytes
+ */
+ SYMMETRIC_CIPHER_BLOCK_SIZE_16 = 0x00000004,
+ /**
+ * \~english Symmetric cipher block size is 32 bytes
+ */
+ SYMMETRIC_CIPHER_BLOCK_SIZE_32 = 0x00000008
+};
+
+/**
+ * \~english Symmetric Cipher Round
+ */
+enum SymmetricCipherRound {
+ /**
+ * \~english Symmetric cipher round is 1
+ */
+ SYMMETRIC_CIPHER_ROUND_1 = 0x00000001,
+ /**
+ * \~english Symmetric cipher round is 2
+ */
+ SYMMETRIC_CIPHER_ROUND_2 = 0x00000002,
+ /**
+ * \~english Symmetric cipher round is 8.5
+ */
+ SYMMETRIC_CIPHER_ROUND_8_5 = 0x00000004,
+ /**
+ * \~english Symmetric cipher round is 10
+ */
+ SYMMETRIC_CIPHER_ROUND_10 = 0x00000008,
+ /**
+ * \~english Symmetric cipher round is 12
+ */
+ SYMMETRIC_CIPHER_ROUND_12 = 0x00000010,
+ /**
+ * \~english Symmetric cipher round is 14
+ */
+ SYMMETRIC_CIPHER_ROUND_14 = 0x00000020,
+ /**
+ * \~english Symmetric cipher round is 16
+ */
+ SYMMETRIC_CIPHER_ROUND_16 = 0x00000040
+};
+
+/**
+ * \~english Asymmetric Padding Mode
+ */
+enum AsymmetricPaddingMode {
+ /**
+ * \~english RSA PKCS1 asymmetric padding mode
+ */
+ ASYMMETRIC_PADDING_MODE_RSA_PKCS1 = 1,
+ /**
+ * \~english RSA SSLV23 asymmetric padding mode
+ */
+ ASYMMETRIC_PADDING_MODE_RSA_SSLV23,
+ /**
+ * \~english RSA NOPADDING asymmetric padding mode
+ */
+ ASYMMETRIC_PADDING_MODE_RSA_NOPADDING,
+ /**
+ * \~english RSA OAEP asymmetric padding mode
+ */
+ ASYMMETRIC_PADDING_MODE_RSA_OAEP,
+ /**
+ * \~english RSA PSS asymmetric padding mode
+ */
+ ASYMMETRIC_PADDING_MODE_RSA_PSS
+};
+
+/**
+ * @union CipherParameter
+ * \~english @par Brief
+ * Union of cipher parameter
+ */
+union CipherParameter {
+ /**
+ * \~english Struct of symmetric cipher parameter
+ */
+ struct SymmetricCipherParameter {
+ /**
+ * \~english Symmetric cipher mode
+ */
+ enum SymmetricCipherMode mode;
+ /**
+ * \~english Symmetric cipher block size
+ */
+ enum SymmetricCipherBlockSize block_size;
+ /**
+ * \~english Symmetric cipher round
+ */
+ enum SymmetricCipherRound round;
+ /**
+ * \~english Padding ON/OFF. Only used in CBC mode and ECB mode.
+ * Padding ON :
+ * Encrypt:
+ * 1.If plaintext length isn't aligned with block size, the
+ * ciphertext length is aligned with block size.
+ * 2.If plaintext length is aligned with block size, the
+ * ciphertext length is equal to plaintext length + 1 block size.
+ * Decrypt:
+ * 1.If ciphertext length isn't aligned with block size, return error.
+ * 2.If ciphertext length is aligned with block size, plaintext length
+ * is equal to ciphertext length minus padding length. Padding length
+ * is greater than 0 and not greater than block size.
+ * Padding OFF:
+ * Encrypt:
+ * 1.If plaintext length isn't aligned with block size, return error.
+ * 2.If plaintext length is aligned with block size, the
+ * ciphertext length is equal to plaintext length.
+ * Decrypt:
+ * 1.If ciphertext length isn't aligned with block size, return error.
+ * 2.If ciphertext length is aligned with block size, the
+ * plaintext length is equal to ciphertext length.
+ */
+ bool to_pad;
+ } symmetric;
+
+ /**
+ * \~english Struct of asymmetric cipher parameter
+ */
+ struct AsymmetricCipherParameter {
+ /**
+ * \~english Asymmetric padding mode
+ */
+ enum AsymmetricPaddingMode mode;
+ } asymmetric;
+};
+
+
+/**
+ * \~english Symmetric cipher key type
+ */
+enum SymmetricCipherKeyType {
+ /**
+ * \~english Key is managed by hardware/chip
+ */
+ SYMMETRIC_CIPHER_KEY_TYPE_MANAGED,
+ /**
+ * \~english Key is provided by user
+ */
+ SYMMETRIC_CIPHER_KEY_TYPE_USER
+};
+
+/**
+ * @struct RsaPrivateKey
+ * \~english @par Brief
+ * Struct of RSA private key
+ */
+struct RsaPrivateKey {
+ /**
+ * \~english Private exponent
+ */
+ uint8_t d[RSA_PRIVATE_EXPONENT_MAX_SIZE];
+ /**
+ * \~english Modulus
+ */
+ uint8_t n[RSA_MODULUS_MAX_SIZE];
+ /**
+ * \~english The length of private exponent
+ */
+ uint32_t d_length;
+ /**
+ * \~english The length of modulus
+ */
+ uint32_t n_length;
+};
+
+/**
+ * @union PrivateKey
+ * \~english @par Brief
+ * Union of private key
+ */
+union PrivateKey {
+ /**
+ * \~english Rsa private key
+ */
+ struct RsaPrivateKey rsa;
+};
+
+/**
+ * @struct RsaPublicKey
+ * \~english @par Brief
+ * Union of RSA public key
+ */
+struct RsaPublicKey {
+ /**
+ * \~english Public exponent
+ */
+ uint8_t e[RSA_PUBLIC_EXPONENT_MAX_SIZE];
+ /**
+ * \~english Modulus
+ */
+ uint8_t n[RSA_MODULUS_MAX_SIZE];
+ /**
+ * \~english The length of public exponent
+ */
+ uint32_t e_length;
+ /**
+ * \~english The length of modulus
+ */
+ uint32_t n_length;
+};
+
+/**
+ * @union PublicKey
+ * \~english @par Brief
+ * Union of public key
+ */
+union PublicKey {
+ /**
+ * \~english Struct of rsa public key
+ */
+ struct RsaPublicKey rsa;
+};
+
+/**
+ * \~english Asymmetric cipher key type
+ */
+enum AsymmetricCipherKeyType {
+ /**
+ * \~english Key is managed by hardware/chip
+ */
+ ASYMMETRIC_CIPHER_KEY_TYPE_MANAGED,
+ /**
+ * \~english Public key is provided by user
+ */
+ ASYMMETRIC_CIPHER_KEY_TYPE_USER_PUBLIC,
+ /**
+ * \~english Private key is provided by user
+ */
+ ASYMMETRIC_CIPHER_KEY_TYPE_USER_PRIVATE
+};
+
+/**
+ * @union KeyParam
+ * \~english @par Brief
+ * Union of key parameter
+ */
+union KeyParam {
+ /**
+ * \~english Struct of symmetric key paramater
+ */
+ struct SymmetricKeyParam {
+ /**
+ * \~english Symmetric cipher key type
+ */
+ enum SymmetricCipherKeyType key_type;
+ /**
+ * \~english Union of symmetric key parameter
+ */
+ union {
+ /**
+ * \~english The symmetric key index
+ */
+ uint32_t managed_key_index;
+ /**
+ * \~english Struct of user key
+ */
+ struct {
+ /**
+ * \~english Key source
+ */
+ uint8_t* key;
+ /**
+ * \~english Key length
+ */
+ uint32_t key_len;
+ /**
+ * \~english Key Initialization vector.
+ */
+ uint8_t* iv;
+ /**
+ * \~english Initialization vector length.The length should be
+ * equal to block size, otherwise return error.
+ */
+ uint32_t iv_len;
+ } user_key;
+ } key_param;
+ } symmetric;
+ /**
+ * \~english Struct of asymmetric key parameter
+ */
+ struct AsymmetricKeyParam {
+ /**
+ * \~english Asymmetric cipher key type
+ */
+ enum AsymmetricCipherKeyType key_type;
+ /**
+ * \~english Union of asymmetric key parameter
+ */
+ union {
+ /**
+ * \~english The asymmetric key index
+ */
+ uint32_t managed_key_index;
+ /**
+ * \~english Union of user key
+ */
+ union {
+ /**
+ * \~english Public key
+ */
+ union PublicKey* public_key;
+ /**
+ * \~english Private key
+ */
+ union PrivateKey* private_key;
+ } user_key;
+ } key_param;
+ } asymmetric;
+};
+
+/**
+ * \~english hash type
+ */
+enum HashType {
+ /**
+ * \~english hash type is md5
+ */
+ HASH_TYPE_MD5 = 1,
+ /**
+ * \~english hash type is sha1
+ */
+ HASH_TYPE_SHA1,
+ /**
+ * \~english hash type is sha224
+ */
+ HASH_TYPE_SHA224,
+ /**
+ * \~english hash type is sha256
+ */
+ HASH_TYPE_SHA256,
+ /**
+ * \~english hash type is sha384
+ */
+ HASH_TYPE_SHA384,
+ /**
+ * \~english hash type is sha512
+ */
+ HASH_TYPE_SHA512
+};
+
+/**
+ * \ingroup EncryptStart
+ * \~english @par Brief
+ * Initialize the encrypt context information.
+ * \~english @param [in] cipher_type
+ * enum CipherType - Cipher type.
+ * \~english @param [in] param
+ * union CipherParameter* - Cipher parameter
+ * \~english @param [in] key
+ * union KeyParam* - Key parameter
+ * \~english @param [out] ctx
+ * void** - The encrypt information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize
+ * fail or hardware I/O operation fail or
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter "cipher_type" is less than SYMMETRIC_CIPHER_AES
+ * or greater than ASYMMETRIC_CIPHER_ECDSA [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "param" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "key" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle initialize failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Initialize the encrypt context information according to cipher type,
+ * cipher parameter and key parameter.
+ * - If EncryptStart() was called successfully, EncryptCleanup() should
+ * be called to clean up encrypt context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * EncryptUpdate, EncryptFinish, EncryptCleanup
+ */
+EFrameworkunifiedStatus EncryptStart(enum CipherType cipher_type, union CipherParameter* param,
+ union KeyParam* key, void** ctx);
+
+/**
+ * \ingroup EncryptUpdate
+ * \~english @par Brief
+ * Encrypt plaintext information.
+ * \~english @param [in] ctx
+ * void* - The encrypt information context handle.
+ * \~english @param [in] in
+ * const uint8_t* - The plaintext to be encrypted.
+ * \~english @param [in] in_len
+ * uint32_t - The input buffer length
+ * in_len shall be greater than 0 for symmetric encrypt.
+ * in_len shall be greater than 0 and not greater than
+ * RSA_PRIVATE_EXPONENT_MAX_SIZE/8 - RSA_PADDING_MINIMUM_SIZE
+ * for RSA asymmetric encrypt.
+ * \~english @param [out] out
+ * uint8_t* - The ciphertext after plaintext had been encrypted.
+ * \~english @param [in] out_len
+ * uint32_t - The output buffer length.
+ * out_len shall not be less than in_len + 1 block size for symmetric encrypt.
+ * out_len shall not be less than RSA_PRIVATE_EXPONENT_MAX_SIZE/8 for RSA asymmetric encrypt.
+ * \~english @param [out] true_length
+ * uint32_t* - The ciphertext length.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - EncryptStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in_len" is 0 for symmetric encrypt[eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in_len" is 0 or greater than
+ * RSA_PRIVATE_EXPONENT_MAX_SIZE/8 - RSA_PADDING_MINIMUM_SIZE for RSA asymmetric encrypt[eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than in_len + 1 block size
+ * for symmetric encrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than RSA_PRIVATE_EXPONENT_MAX_SIZE/8
+ * for RSA asymmetric encrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusFail]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Update the plaintext to ciphertext by symmetric or asymmetric encrypt algorithm.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * EncryptStart, EncryptFinish, EncryptCleanup
+ */
+EFrameworkunifiedStatus EncryptUpdate(void* ctx, const uint8_t* in, uint32_t in_len,
+ uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup EncryptFinish
+ * \~english @par Brief
+ * Encrypt the final plaintext information.
+ * \~english @param [in] ctx
+ * void* - The encrypt information context handle.
+ * \~english @param [out] out
+ * uint8_t* - The ciphertext after plaintext had been encrypted.
+ * out is useless for RSA asymmetric encrypt.
+ * \~english @param [in] out_len
+ * uint32_t - The final output buffer length.
+ * out_len shall not be less than 1 block size for symmetric encrypt.
+ * out_len is useless for RSA asymmetric encrypt.
+ * \~english @param [out] true_length
+ * uint32_t* - The ciphertext length.
+ * true_length is useless for RSA asymmetric encrypt.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - EncryptStart() and EncryptUpdate() were called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than 1 block size
+ * for symmetric encrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Update the final plaintext to ciphertext for symmetric encrypt and do nothing for asymmetric encrypt.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * EncryptStart, EncryptUpdate, EncryptCleanup
+ */
+EFrameworkunifiedStatus EncryptFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup EncryptCleanup
+ * \~english @par Brief
+ * Clean up encrypt context information.
+ * \~english @param [in] ctx
+ * void* - The encrypt information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - EncryptStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * \~english @par Detail
+ * - Clean up encrypt context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * EncryptStart, EncryptUpdate, EncryptFinish
+ */
+EFrameworkunifiedStatus EncryptCleanup(void* ctx);
+
+/**
+ * \ingroup DecryptStart
+ * \~english @par Brief
+ * Initialize the decrypt context information.
+ * \~english @param [in] cipher_type
+ * enum CipherType - Cipher type.
+ * \~english @param [in] param
+ * union CipherParameter* - Cipher parameter
+ * \~english @param [in] key
+ * union KeyParam* - Key parameter
+ * \~english @param [out] ctx
+ * void** - The decrypt information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail or hardware I/O
+ * operation fail or hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter "cipher_type" is less than SYMMETRIC_CIPHER_AES
+ * or greater than ASYMMETRIC_CIPHER_ECDSA [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "param" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "key" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle initialize failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Initialize the decrypt context information according to cipher type, cipher parameter and key parameter.
+ * - If DecryptStart() was called successfully, DecryptCleanup() should be called
+ * to clean up decrypt context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * DecryptUpdate, DecryptFinish, DecryptCleanup
+ */
+EFrameworkunifiedStatus DecryptStart(enum CipherType cipher_type, union CipherParameter* param,
+ union KeyParam *key, void** ctx);
+
+/**
+ * \ingroup DecryptUpdate
+ * \~english @par Brief
+ * Decrypt ciphertext information.
+ * \~english @param [in] ctx
+ * void* - The decrypt information context handle.
+ * \~english @param [in] in
+ * const uint8_t* - The ciphertext to be decrypted.
+ * \~english @param [in] in_len
+ * uint32_t - The input buffer length
+ * in_len shall be greater than 0 for symmetric decrypt.
+ * in_len shall be equal to RSA_PRIVATE_EXPONENT_MAX_SIZE/8
+ * for RSA asymmetric decrypt.
+ * \~english @param [out] out
+ * uint8_t* - The plaintext after ciphertext had been decrypted.
+ * \~english @param [in] out_len
+ * uint32_t - The output buffer length.
+ * out_len shall not be less than in_len + 1 block size for symmetric decrypt.
+ * out_len shall not be less than RSA_PRIVATE_EXPONENT_MAX_SIZE/8 - RSA_PADDING_MINIMUM_SIZE
+ * for RSA asymmetric decrypt.
+ * \~english @param [out] true_length
+ * uint32_t* - The plaintext length.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - DecryptStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in_len" is 0 for symmetric decrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in_len" isn't equal to
+ * RSA_PRIVATE_EXPONENT_MAX_SIZE/8 for RSA asymmetric decrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than in_len
+ * for symmetric decrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than RSA_PRIVATE_EXPONENT_MAX_SIZE/8 - RSA_PADDING_MINIMUM_SIZE
+ * for RSA asymmetric decrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Update the ciphertext to plaintext by symmetric or asymmetric decrypt algorithm.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * DecryptStart, DecryptFinish, DecryptCleanup
+ */
+EFrameworkunifiedStatus DecryptUpdate(void* ctx, const uint8_t* in, uint32_t in_len,
+ uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup DecryptFinish
+ * \~english @par Brief
+ * Decrypt the final ciphertext information.
+ * \~english @param [in] ctx
+ * void* - The decrypt information context handle.
+ * \~english @param [out] out
+ * uint8_t* - The plaintext after ciphertext had been decrypted.
+ * out is useless for RSA asymmetric decrypt.
+ * \~english @param [in] out_len
+ * uint32_t - The final output buffer length.
+ * out_len shall not be less than 1 block size for symmetric decrypt.
+ * out_len is useless for RSA asymmetric decrypt.
+ * \~english @param [out] true_length
+ * uint32_t* - The plaintext length.
+ * true_length is useless for RSA asymmetric decrypt.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - DecryptStart() and DecryptUpdate() were called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than 1 block size
+ * for symmetric decrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Update the final ciphertext to plaintext for symmetric decrypt and do nothing for asymmetric decrypt.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * DecryptStart, DecryptUpdate, DecryptCleanup
+ */
+EFrameworkunifiedStatus DecryptFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup DecryptCleanup
+ * \~english @par Brief
+ * Clean up decrypt context information.
+ * \~english @param [in] ctx
+ * void* - The decrypt information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+
+ * \~english @par Prerequisite
+ * - DecryptStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * \~english @par Detail
+ * - Clean up decrypt context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * DecryptStart, DecryptUpdate, DecryptFinish
+ */
+EFrameworkunifiedStatus DecryptCleanup(void* ctx);
+
+/**
+ * \ingroup HashStart
+ * \~english @par Brief
+ * Initialize hash context information.
+ * \~english @param [in] hash_type
+ * enum HashType - Hash type.
+ * \~english @param [out] ctx
+ * void** - The hash information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail or hardware I/O operation
+ * fail or hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter "hash_type" less than HASH_TYPE_MD5
+ * or greater than HASH_TYPE_SHA512 [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle initialize failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Initialize hash context information according to hash type.
+ * - If HashStart() was called successfully, HashCleanup() should be called
+ * to clean up hash context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * HashUpdate, HashFinish, HashCleanup
+ */
+EFrameworkunifiedStatus HashStart(enum HashType hash_type, void** ctx);
+
+/**
+ * \ingroup HashUpdate
+ * \~english @par Brief
+ * Caculate hash value of input data.
+ * \~english @param [in] ctx
+ * void* - The hash information context handle.
+ * \~english @param [in] in
+ * const uint8_t* - The input data to be hashed.
+ * \~english @param [in] in_len
+ * uint32_t - The input buffer length
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - HashStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in_len" is 0 [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Caculate hash value of input data.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * HashStart, HashFinish, HashCleanup
+ */
+EFrameworkunifiedStatus HashUpdate(void* ctx, const uint8_t* in, uint32_t in_len);
+
+/**
+ * \ingroup HashFinish
+ * \~english @par Brief
+ * Caculate final message digest.
+ * \~english @param [in] ctx
+ * void* - The hash information context handle.
+ * \~english @param [out] out
+ * uint8_t* - The message digest after all input data had been hashed.
+ * \~english @param [in] out_len
+ * uint32_t - The output buffer length.
+ * \~english @param [out] true_length
+ * uint32_t* - The message digest length.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - HashStart() and HashUpdate() were called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is 0 [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Caculate final message digest.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * HashStart, HashUpdate, HashCleanup
+ */
+EFrameworkunifiedStatus HashFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup HashCleanup
+ * \~english @par Brief
+ * Clean up hash context information.
+ * \~english @param [in] ctx
+ * void* - The hash information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - HashStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * \~english @par Detail
+ * - Clean up hash context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * HashStart, HashUpdate, HashFinish
+ */
+EFrameworkunifiedStatus HashCleanup(void* ctx);
+
+/**
+ * \ingroup RandomInit
+ * \~english @par Brief
+ * Initialize random number context information.
+ * \~english @param [out] ctx
+ * void** - The random number information context handle.
+ * \~english @param [in] seed_buffer
+ * uint8_t* - The random number seed buffer.
+ * \~english @param [in] buffer_len
+ * uint32_t - The random number seed buffer length.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail or hardware I/O operation
+ * fail or hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "seed_buffer" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "buffer_len" is 0 [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle initialize failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Initialize random number context information according to random number seed.
+ * - If RandomInit() was called successfully, RandomCleanup() should be called to
+ * clean up random number context information. If RandomInit() was called faild,
+ * RandomCleanup() must not be called.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * RandomGet, RandomCleanup
+ */
+EFrameworkunifiedStatus RandomInit(void** ctx, uint8_t* seed_buffer, uint32_t buffer_len);
+
+/**
+ * \ingroup RandomGet
+ * \~english @par Brief
+ * Get random number.
+ * \~english @param [in] ctx
+ * void* - The random number information context handle.
+ * \~english @param [out] out
+ * uint8_t* - The random number that caculated by random number seed.
+ * \~english @param [in] out_len
+ * uint32_t - The output buffer length.
+ * \~english @param [out] true_length
+ * uint32_t* - The random number length.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - RandomInit() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is 0 [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Get random number.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * RandomInit, RandomCleanup
+ */
+EFrameworkunifiedStatus RandomGet(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup RandomCleanup
+ * \~english @par Brief
+ * Clean up random number context information.
+ * \~english @param [in] ctx
+ * void* - The random number information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - RandomInit() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * \~english @par Detail
+ * - Clean up random number context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * RandomInit, RandomGet
+ */
+EFrameworkunifiedStatus RandomCleanup(void* ctx);
+
+/**
+ * \ingroup ResetSecurityIC
+ * \~english @par Brief
+ * Security IC Reset.
+ * \~english @param none
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware initialize fail, hardware I/O operation fail,
+ * hardware device busy.
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the hardware initialize failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Security IC Reset.
+ * - The API can be used by multiple processes.
+ * - This API does not cleanup context information when EncryptStart(), DecryptStart() or HashStart() is successfull.
+ * Use EncryptCleanup(), DecryptCleanup() or RandomCleanup() to cleanup context information.
+ * \~english @see
+ * None
+ */
+EFrameworkunifiedStatus ResetSecurityIC(void);
+
+/** @}*/ // end of security_hal
+/** @}*/ // end of update_service
+
+#endif // HAL_API_SECURITY_HAL_H_
diff --git a/security_hal/inc/security_hal_securityhallog.h b/security_hal/inc/security_hal_securityhallog.h
new file mode 100755
index 0000000..44de2ac
--- /dev/null
+++ b/security_hal/inc/security_hal_securityhallog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_SECURITY_HAL_SECURITYHALLOG_H_
+#define INC_SECURITY_HAL_SECURITYHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_SECURITY_HAL_SECURITYHALLOG_H_
diff --git a/security_hal/src/security_hal.cpp b/security_hal/src/security_hal.cpp
new file mode 100755
index 0000000..ee9f7ea
--- /dev/null
+++ b/security_hal/src/security_hal.cpp
@@ -0,0 +1,615 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "security_hal.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "security_hal_securityhallog.h"
+
+#define MD5_DIGEST_LENGTH 16 // md5 digest length
+#define SHA1_DIGEST_LENGTH 20 // sha1 digest length
+#define SHA224_DIGEST_LENGTH 28 // sha224 digest length
+#define SHA256_DIGEST_LENGTH 32 // sha256 digest length
+#define SHA384_DIGEST_LENGTH 48 // sha384 digest length
+#define SHA512_DIGEST_LENGTH 64 // sha512 digest length
+#define BITS_PER_BYTE 8 // the number of bits per byte
+#define KEY_SOURCE_SIZE_128 16 // the size of key source is 128 bits
+#define KEY_SOURCE_SIZE_192 24 // the size of key source is 192 bits
+#define KEY_SOURCE_SIZE_256 32 // the size of key source is 256 bits
+
+/**
+ * the max length of input buffer for RSA asymmetric encrypt or
+ * the minimum length of output buffer for RSA asymmetric decrypt
+ */
+#define RSA_PRIVATE_MAX_SIZE_BYTE \
+ (RSA_PRIVATE_EXPONENT_MAX_SIZE/BITS_PER_BYTE - RSA_PADDING_MINIMUM_SIZE)
+
+/**
+ * cipher context information
+ */
+struct CipherContext {
+ enum CipherType cipher_type;
+ union CipherParameter cipher_parameter;
+ union KeyParam key_param;
+};
+
+/**
+ * hash context information
+ */
+struct HashContext {
+ enum HashType hash_type;
+};
+
+/**
+ * random number context information
+ */
+struct RandomContext {
+ uint8_t* seed_buffer;
+ uint32_t buffer_len;
+};
+
+bool CheckParameterVaildity(enum CipherType cipher_type,
+ union CipherParameter* param, union KeyParam* key) {
+ if (SYMMETRIC_CIPHER_AES == cipher_type) {
+ // check cipher mode for symmetric encrypt/decrypt
+ if (SYMMETRIC_CIPHER_MODE_BLOCK_ECB != param->symmetric.mode &&
+ SYMMETRIC_CIPHER_MODE_BLOCK_CBC != param->symmetric.mode &&
+ SYMMETRIC_CIPHER_MODE_BLOCK_CFB != param->symmetric.mode &&
+ SYMMETRIC_CIPHER_MODE_BLOCK_OFB != param->symmetric.mode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the cipher mode for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ // check cipher block size for AES symmetric encrypt/decrypt
+ if (SYMMETRIC_CIPHER_BLOCK_SIZE_16 != param->symmetric.block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the block size for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ // check cipher key type for AES symmetric encrypt/decrypt
+ if (SYMMETRIC_CIPHER_KEY_TYPE_MANAGED != key->symmetric.key_type &&
+ SYMMETRIC_CIPHER_KEY_TYPE_USER != key->symmetric.key_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the cipher key type for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ if (SYMMETRIC_CIPHER_KEY_TYPE_MANAGED == key->symmetric.key_type) {
+ // check cipher rounds for AES symmetric encrypt/decrypt
+ if (SYMMETRIC_CIPHER_ROUND_10 != param->symmetric.round &&
+ SYMMETRIC_CIPHER_ROUND_12 != param->symmetric.round &&
+ SYMMETRIC_CIPHER_ROUND_14 != param->symmetric.round) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the cipher round for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ } else {
+ // check parameter of key provided by user for AES symmetric encrypt/decrypt
+ if (NULL == key->symmetric.key_param.user_key.key) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "user_key.key is NULL");
+ return false;
+ }
+ if (KEY_SOURCE_SIZE_128 == key->symmetric.key_param.user_key.key_len) {
+ if (SYMMETRIC_CIPHER_ROUND_10 != param->symmetric.round) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "cipher round should be 10 if key len is 128 bits");
+ return false;
+ }
+ } else if (KEY_SOURCE_SIZE_192 == key->symmetric.key_param.user_key.key_len) {
+ if (SYMMETRIC_CIPHER_ROUND_12 != param->symmetric.round) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "cipher round should be 12 if key len is 192 bits");
+ return false;
+ }
+ } else if (KEY_SOURCE_SIZE_256 == key->symmetric.key_param.user_key.key_len) {
+ if (SYMMETRIC_CIPHER_ROUND_14 != param->symmetric.round) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "cipher round should be 14 if key len is 256 bits");
+ return false;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "key len should be 128, 192 or 256 bits for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ if (SYMMETRIC_CIPHER_MODE_BLOCK_ECB != param->symmetric.mode) {
+ if (NULL == key->symmetric.key_param.user_key.iv) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "user_key.iv is NULL");
+ return false;
+ }
+ if (key->symmetric.key_param.user_key.iv_len != param->symmetric.block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "user_key.iv_len is not equal to block size for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ }
+ }
+ } else if (ASYMMETRIC_CIPHER_RSA == cipher_type) {
+ // check the padding mode for RSA asymmetric encrypt/decrypt
+ if (ASYMMETRIC_PADDING_MODE_RSA_PKCS1 != param->asymmetric.mode &&
+ ASYMMETRIC_PADDING_MODE_RSA_SSLV23 != param->asymmetric.mode &&
+ ASYMMETRIC_PADDING_MODE_RSA_NOPADDING != param->asymmetric.mode &&
+ ASYMMETRIC_PADDING_MODE_RSA_OAEP != param->asymmetric.mode &&
+ ASYMMETRIC_PADDING_MODE_RSA_PSS != param->asymmetric.mode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the cipher mode for asymmetric encrypt/decrypt");
+ return false;
+ }
+ // check cipher key type for RSA asymmetric encrypt/decrypt
+ if (ASYMMETRIC_CIPHER_KEY_TYPE_MANAGED != key->asymmetric.key_type &&
+ ASYMMETRIC_CIPHER_KEY_TYPE_USER_PUBLIC != key->asymmetric.key_type &&
+ ASYMMETRIC_CIPHER_KEY_TYPE_USER_PRIVATE != key->asymmetric.key_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the cipher key type for asymmetric encrypt/decrypt");
+ return false;
+ }
+ if (ASYMMETRIC_CIPHER_KEY_TYPE_USER_PUBLIC == key->asymmetric.key_type) {
+ // check parameter of public key provided by user for RSA asymmetric encrypt/decrypt
+ if (NULL == key->asymmetric.key_param.user_key.public_key) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "public_key is NULL");
+ return false;
+ }
+ if (RSA_PUBLIC_EXPONENT_MAX_SIZE <
+ key->asymmetric.key_param.user_key.public_key->rsa.e_length ||
+ RSA_MODULUS_MAX_SIZE <
+ key->asymmetric.key_param.user_key.public_key->rsa.n_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "e_length or n_length is too large, e_length:%d, n_length:%d",
+ key->asymmetric.key_param.user_key.public_key->rsa.e_length,
+ key->asymmetric.key_param.user_key.public_key->rsa.n_length);
+ return false;
+ }
+ } else if (ASYMMETRIC_CIPHER_KEY_TYPE_USER_PRIVATE == key->asymmetric.key_type) {
+ // check parameter of key provided by user for RSA asymmetric encrypt/decrypt
+ if (NULL == key->asymmetric.key_param.user_key.private_key) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "private_key is NULL");
+ return false;
+ }
+ if (RSA_PRIVATE_EXPONENT_MAX_SIZE <
+ key->asymmetric.key_param.user_key.private_key->rsa.d_length ||
+ RSA_MODULUS_MAX_SIZE <
+ key->asymmetric.key_param.user_key.private_key->rsa.n_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "d_length or n_length is too large, d_length:%d, n_length:%d",
+ key->asymmetric.key_param.user_key.private_key->rsa.d_length,
+ key->asymmetric.key_param.user_key.private_key->rsa.n_length);
+ return false;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "the cipher_type isn't support");
+ return false;
+ }
+ return true;
+}
+
+// Initialize the encrypt context information
+EFrameworkunifiedStatus EncryptStart(enum CipherType cipher_type, union CipherParameter* param,
+ union KeyParam* key, void** ctx) {
+ if (SYMMETRIC_CIPHER_AES != cipher_type && ASYMMETRIC_CIPHER_RSA != cipher_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "the cipher_type isn't support");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == param || NULL == key || NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "param, key or ctx is NULL, param:%p key:%p ctx:%p", param, key, ctx);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ bool ret = CheckParameterVaildity(cipher_type, param, key);
+ if (true != ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "parameter error");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ void* ctx_temp = malloc(sizeof(CipherContext));
+ if (NULL == ctx_temp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to malloc %lu byte for ctx, errno=%d",
+ sizeof(CipherContext), errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ memset(ctx_temp, 0, sizeof(CipherContext));
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx_temp);
+ pcipher_context->cipher_type = cipher_type;
+ pcipher_context->cipher_parameter = *param;
+ pcipher_context->key_param = *key;
+ *ctx = ctx_temp;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Encrypt plaintext information
+EFrameworkunifiedStatus EncryptUpdate(void* ctx, const uint8_t* in, uint32_t in_len,
+ uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx || NULL == in || NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ctx, in, out or true_length is NULL, ctx:%p in:%p out:%p true_length:%p",
+ ctx, in, out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == in_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "in_len is equal to 0");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx);
+ if (SYMMETRIC_CIPHER_AES == pcipher_context->cipher_type) { // symmetric encrypt
+ uint32_t block_size = pcipher_context->cipher_parameter.symmetric.block_size;
+ if (out_len < in_len + block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is less than in_len plus block_size");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memcpy(out, in, in_len);
+ *true_length = in_len;
+ } else if (ASYMMETRIC_CIPHER_RSA == pcipher_context->cipher_type) { // asymmetric encrypt
+ if (RSA_PRIVATE_MAX_SIZE_BYTE < in_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "in_len is greater than RSA_PRIVATE_MAX_SIZE_BYTE");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (RSA_PRIVATE_EXPONENT_MAX_SIZE/BITS_PER_BYTE > out_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "out_len is less than RSA_PRIVATE_EXPONENT_MAX_SIZE/BITS_PER_BYTE");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ // out_len is greater than in_len
+ memcpy(out, in, in_len);
+ *true_length = in_len;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "the cipher_type isn't support, cipher_type:%d", pcipher_context->cipher_type);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+// Encrypt the final plaintext information
+EFrameworkunifiedStatus EncryptFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx);
+ if (SYMMETRIC_CIPHER_AES == pcipher_context->cipher_type) { // symmetric encrypt
+ if (NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "out or true_length is NULL, out:%p true_length:%p", out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ uint32_t block_size = pcipher_context->cipher_parameter.symmetric.block_size;
+ if (out_len < block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is less than block_size");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (true == pcipher_context->cipher_parameter.symmetric.to_pad) {
+ // Padding on, the true_length is equal to block_size.
+ *true_length = block_size;
+ } else {
+ // Padding off, true_length is equal to 0.
+ *true_length = 0;
+ }
+ } else if (ASYMMETRIC_CIPHER_RSA == pcipher_context->cipher_type) {
+ // EncryptFinish is useless for RSA asymmetric encrypt. So do nothing.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "the cipher_type isn't support, cipher_type:%d", pcipher_context->cipher_type);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+// Clean up encrypt context information
+EFrameworkunifiedStatus EncryptCleanup(void* ctx) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memset(ctx, 0, sizeof(CipherContext));
+ free(ctx);
+ return eFrameworkunifiedStatusOK;
+}
+
+// Initialize the decrypt context information
+EFrameworkunifiedStatus DecryptStart(enum CipherType cipher_type, union CipherParameter* param,
+ union KeyParam *key, void** ctx) {
+ if (SYMMETRIC_CIPHER_AES != cipher_type && ASYMMETRIC_CIPHER_RSA != cipher_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "the cipher_type isn't support");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == param || NULL == key || NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "param, key or ctx is NULL, param:%p key:%p ctx:%p", param, key, ctx);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ bool ret = CheckParameterVaildity(cipher_type, param, key);
+ if (true != ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "parameter error");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ void* ctx_temp = malloc(sizeof(CipherContext));
+ if (NULL == ctx_temp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to malloc %lu byte for ctx, errno=%d",
+ sizeof(CipherContext), errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ memset(ctx_temp, 0, sizeof(CipherContext));
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx_temp);
+ pcipher_context->cipher_type = cipher_type;
+ pcipher_context->cipher_parameter = *param;
+ pcipher_context->key_param = *key;
+ *ctx = ctx_temp;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Decrypt ciphertext information
+EFrameworkunifiedStatus DecryptUpdate(void* ctx, const uint8_t* in, uint32_t in_len,
+ uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx || NULL == in || NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ctx, in, out or true_length is NULL, ctx:%p in:%p out:%p true_length:%p",
+ ctx, in, out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx);
+ if (SYMMETRIC_CIPHER_AES == pcipher_context->cipher_type) { // symmetric decrypt
+ if (0 == in_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "in_len is equal to 0");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ uint32_t block_size = pcipher_context->cipher_parameter.symmetric.block_size;
+ if (out_len < in_len + block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is less than in_len plus block_size");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memcpy(out, in, in_len);
+ *true_length = in_len;
+ } else if (ASYMMETRIC_CIPHER_RSA == pcipher_context->cipher_type) { // asymmetric decrypt
+ if (RSA_PRIVATE_EXPONENT_MAX_SIZE/BITS_PER_BYTE != in_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "in_len isn't equal to RSA_PRIVATE_EXPONENT_MAX_SIZE/BITS_PER_BYTE");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (SHA256_DIGEST_LENGTH > out_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "out_len is less than SHA256_DIGEST_LENGTH");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memcpy(out, in, SHA256_DIGEST_LENGTH);
+ *true_length = SHA256_DIGEST_LENGTH;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "the cipher_type isn't support, cipher_type:%d", pcipher_context->cipher_type);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+// Decrypt the final ciphertext information
+EFrameworkunifiedStatus DecryptFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx);
+ if (SYMMETRIC_CIPHER_AES == pcipher_context->cipher_type) { // symmetric encrypt
+ if (NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "out or true_length is NULL, out:%p true_length:%p", out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ uint32_t block_size = pcipher_context->cipher_parameter.symmetric.block_size;
+ if (out_len < block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is less than block_size");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (true == pcipher_context->cipher_parameter.symmetric.to_pad) {
+ // Padding on, the true_length is equal to block_size - padding_length. Because security_hal
+ // is stub implement, padding_length is unknown. Set true_length to 0.
+ *true_length = 0;
+ } else {
+ // Padding off, true_length is equal to 0.
+ *true_length = 0;
+ }
+ } else if (ASYMMETRIC_CIPHER_RSA == pcipher_context->cipher_type) {
+ // EncryptFinish is useless for RSA asymmetric decrypt. So do nothing.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "the cipher_type isn't support, cipher_type:%d", pcipher_context->cipher_type);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+// Clean up decrypt context information
+EFrameworkunifiedStatus DecryptCleanup(void* ctx) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memset(ctx, 0, sizeof(CipherContext));
+ free(ctx);
+ return eFrameworkunifiedStatusOK;
+}
+
+// Initialize hash context information
+EFrameworkunifiedStatus HashStart(enum HashType hash_type, void** ctx) {
+ if (HASH_TYPE_MD5 > hash_type || HASH_TYPE_SHA512 < hash_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "the hash_type isn't support");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ void* ctx_temp = malloc(sizeof(HashContext));
+ if (NULL == ctx_temp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to malloc %lu byte for ctx, errno=%d",
+ sizeof(HashContext), errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ memset(ctx_temp, 0, sizeof(HashContext));
+ HashContext* phash_context = reinterpret_cast<HashContext*>(ctx_temp);
+ phash_context->hash_type = hash_type;
+ *ctx = ctx_temp;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Caculate hash value of input data
+EFrameworkunifiedStatus HashUpdate(void* ctx, const uint8_t* in, uint32_t in_len) {
+ if (NULL == ctx || NULL == in) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx or in is NULL, ctx:%p in:%p", ctx, in);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == in_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "in_len is equal to 0");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+// Caculate final message digest
+EFrameworkunifiedStatus HashFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx || NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ctx, out or true_length is NULL, ctx:%p out:%p true_length:%p",
+ ctx, out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ HashContext* phash_context = reinterpret_cast<HashContext*>(ctx);
+ uint32_t digest_length = 0;
+ switch (phash_context->hash_type) {
+ case HASH_TYPE_MD5:
+ digest_length = HASH_TYPE_MD5;
+ break;
+ case HASH_TYPE_SHA1:
+ digest_length = SHA1_DIGEST_LENGTH;
+ break;
+ case HASH_TYPE_SHA224:
+ digest_length = SHA224_DIGEST_LENGTH;
+ break;
+ case HASH_TYPE_SHA256:
+ digest_length = SHA256_DIGEST_LENGTH;
+ break;
+ case HASH_TYPE_SHA384:
+ digest_length = SHA384_DIGEST_LENGTH;
+ break;
+ case HASH_TYPE_SHA512:
+ digest_length = SHA512_DIGEST_LENGTH;
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "the hash_type isn't support, hash_type:%d", phash_context->hash_type);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (out_len < digest_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is less than %u", digest_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memset(out, 0x00, digest_length);
+ *true_length = digest_length;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Clean up hash context information
+EFrameworkunifiedStatus HashCleanup(void* ctx) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memset(ctx, 0, sizeof(HashContext));
+ free(ctx);
+ return eFrameworkunifiedStatusOK;
+}
+
+// Initialize random number context information
+EFrameworkunifiedStatus RandomInit(void** ctx, uint8_t* seed_buffer, uint32_t buffer_len) {
+ if (NULL == ctx || NULL == seed_buffer) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ctx or seed_buffer is NULL, ctx:%p seed_buffer:%p", ctx, seed_buffer);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == buffer_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "buffer_len is equal to 0");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ void* ctx_temp = malloc(sizeof(RandomContext));
+ if (NULL == ctx_temp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to malloc %lu byte for ctx, errno=%d",
+ sizeof(RandomContext), errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ memset(ctx_temp, 0, sizeof(RandomContext));
+ RandomContext* prandom_context = reinterpret_cast<RandomContext*>(ctx_temp);
+ prandom_context->seed_buffer = reinterpret_cast<uint8_t*>(malloc(buffer_len));
+ if (NULL == prandom_context->seed_buffer) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to malloc %d byte for seed_buffer, errno=%d",
+ buffer_len, errno);
+ free(ctx_temp);
+ ctx_temp = NULL;
+ return eFrameworkunifiedStatusFail;
+ }
+ memcpy(prandom_context->seed_buffer, seed_buffer, buffer_len);
+ prandom_context->buffer_len = buffer_len;
+ *ctx = ctx_temp;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Get random number
+EFrameworkunifiedStatus RandomGet(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx || NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ctx, out or true_length is NULL, ctx:%p out:%p true_length:%p",
+ ctx, out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == out_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is equal to 0");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ // Because security_hal is stub implement, don't assignment value to out or true_length.
+ return eFrameworkunifiedStatusOK;
+}
+
+// Clean up random number context information
+EFrameworkunifiedStatus RandomCleanup(void* ctx) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ RandomContext* prandom_context;
+ prandom_context = reinterpret_cast<RandomContext*>(ctx);
+ if (NULL != prandom_context->seed_buffer) {
+ memset(prandom_context->seed_buffer, 0, prandom_context->buffer_len);
+ free(prandom_context->seed_buffer);
+ prandom_context->seed_buffer = NULL;
+ }
+ memset(prandom_context, 0, sizeof(RandomContext));
+ free(prandom_context);
+ prandom_context = NULL;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Reset Security IC
+EFrameworkunifiedStatus ResetSecurityIC(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/soc_temperature_hal/LICENSE b/soc_temperature_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/soc_temperature_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/soc_temperature_hal/Makefile b/soc_temperature_hal/Makefile
new file mode 100755
index 0000000..fa30b35
--- /dev/null
+++ b/soc_temperature_hal/Makefile
@@ -0,0 +1,66 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libsoc_temperature_hal.so
+
+HEADER := hal_api/soc_temperature_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := soc_temperature_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/soc_temperature_hal/hal_api/soc_temperature_hal.h b/soc_temperature_hal/hal_api/soc_temperature_hal.h
new file mode 100755
index 0000000..16c5f6d
--- /dev/null
+++ b/soc_temperature_hal/hal_api/soc_temperature_hal.h
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file soc_temperature_hal.h
+ */
+
+#ifndef HAL_API_SOC_TEMPERATURE_HAL_H_
+#define HAL_API_SOC_TEMPERATURE_HAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup soc_temperature_hal
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/**
+ * \ingroup GetSoCTemperature
+ * \~english @par Brief
+ * Get SoC temperature value(unit:celsius).
+ * \~english @param [out] temperature
+ * float* - degree celsius
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error (system error)
+ * \~english @par Prerequisite
+ * - The SoC has temperature sensor, and the thermal driver is available.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Parameter temperature is NULL[eFrameworkunifiedStatusNullPointer]
+ * - System error(open/read/close failed)[eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Get SoC temperature value.
+ * - On success eFrameworkunifiedStatusOK is returned and the parameter temperature is set.
+ * - Not eFrameworkunifiedStatusOK is returned if an error occurred.
+ * - Return value shall be checked before temperature is refered.
+ * - Sample code:
+ * @code
+ * #include <stdio.h>
+ * #include <stdlib.h>
+ * #include <soc_temperature_hal.h>
+ * #include <native_service/frameworkunified_types.h>
+ *
+ * int main(int argc, char *argv[]) {
+ * float temperature = 0.0f;
+ * EFrameworkunifiedStatus status = GetSoCTemperature(&temperature);
+ * if (status != eFrameworkunifiedStatusOK) {
+ * printf("Get SoC temperature failed\n");
+ * exit(EXIT_FAILURE);
+ * }
+ * printf("SoC temperature: %f\n", temperature);
+ * exit(EXIT_SUCCESS);
+ * }
+ * @endcode
+ * \~english @see
+ * - None
+ */
+EFrameworkunifiedStatus GetSoCTemperature(float* temperature);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+/** @}*/ // end of soc_temperature_hal
+
+#endif // HAL_API_SOC_TEMPERATURE_HAL_H_
+
diff --git a/soc_temperature_hal/inc/soc_temperature_hal_soctemperaturehallog.h b/soc_temperature_hal/inc/soc_temperature_hal_soctemperaturehallog.h
new file mode 100755
index 0000000..6e256e8
--- /dev/null
+++ b/soc_temperature_hal/inc/soc_temperature_hal_soctemperaturehallog.h
@@ -0,0 +1,75 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_SOC_TEMPERATURE_HAL_SOCTEMPERATUREHALLOG_H_
+#define INC_SOC_TEMPERATURE_HAL_SOCTEMPERATUREHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+#endif // INC_SOC_TEMPERATURE_HAL_SOCTEMPERATUREHALLOG_H_
diff --git a/soc_temperature_hal/src/soc_temperature_hal.cpp b/soc_temperature_hal/src/soc_temperature_hal.cpp
new file mode 100755
index 0000000..33b96ee
--- /dev/null
+++ b/soc_temperature_hal/src/soc_temperature_hal.cpp
@@ -0,0 +1,106 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "soc_temperature_hal.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "soc_temperature_hal_soctemperaturehallog.h"
+
+#define MAX_TEMPERATURE_FROM_DRIVER_LENGTH (9) // 9bytes can content -999999\n\0 - 9999999\n\0 (unit:millicelsius)
+#define DECIMAL (10)
+#define THERMAL_ZONE0_TEMPERATURE_PATH "/sys/class/thermal/thermal_zone0/temp"
+#define THERMAL_ZONE1_TEMPERATURE_PATH "/sys/class/thermal/thermal_zone1/temp"
+#define THERMAL_ZONE2_TEMPERATURE_PATH "/sys/class/thermal/thermal_zone2/temp"
+
+EFrameworkunifiedStatus GetCoreTemperature(int64_t* temperature, const char* node_path) {
+ if ((NULL == temperature) || (NULL == node_path)) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ char sz_temperature[MAX_TEMPERATURE_FROM_DRIVER_LENGTH] = { 0 };
+
+ // read temperature
+ int fd = open(node_path, O_RDONLY);
+ if (0 > fd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open error(%d,%s)", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ ssize_t ret = read(fd, sz_temperature, MAX_TEMPERATURE_FROM_DRIVER_LENGTH - 1);
+ int read_error = errno;
+ close(fd);
+ if (-1 == ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read error(%d,%s)", read_error, strerror(read_error));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ errno = 0;
+ int64_t temp = strtol(sz_temperature, NULL, DECIMAL);
+ if (errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "strtol error(%d,%s)", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ *temperature = temp;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Get SoC temperature value.
+EFrameworkunifiedStatus GetSoCTemperature(float *temperature) {
+ if (NULL == temperature) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "parameter *temperature is null");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ // Get temperature from thermal_zone0
+ int64_t temperature0 = 0;
+ EFrameworkunifiedStatus e_status = GetCoreTemperature(&temperature0, THERMAL_ZONE0_TEMPERATURE_PATH);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "get temperature0 failed");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // Get temperature from thermal_zone1
+ int64_t temperature1 = 0;
+ e_status = GetCoreTemperature(&temperature1, THERMAL_ZONE1_TEMPERATURE_PATH);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "get temperature1 failed");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // Get temperature from thermal_zone2
+ int64_t temperature2 = 0;
+ e_status = GetCoreTemperature(&temperature2, THERMAL_ZONE2_TEMPERATURE_PATH);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "get temperature2 failed");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // get max temperature
+ int64_t max_temperature = temperature0;
+ if (max_temperature < temperature1) {
+ max_temperature = temperature1;
+ }
+ if (max_temperature < temperature2) {
+ max_temperature = temperature2;
+ }
+
+ *temperature = max_temperature / 1000.0f;
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/stub/clock/LICENSE b/stub/clock/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/stub/clock/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/stub/clock/Makefile.client b/stub/clock/Makefile.client
new file mode 100755
index 0000000..e469633
--- /dev/null
+++ b/stub/clock/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client_clock client_display_time
+
+include ../stub.mk
diff --git a/stub/clock/client_clock/Makefile b/stub/clock/client_clock/Makefile
new file mode 100755
index 0000000..9124b7d
--- /dev/null
+++ b/stub/clock/client_clock/Makefile
@@ -0,0 +1,45 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libClock_API
+
+######### install headers(*.h) #############
+INST_HEADERS = Clock_API.h clock_clock.h
+
+######### compiled sources #############
+libClock_API_SRCS = Clock_API.cpp
+
+######### add source path #############
+VPATH += ./src ./include/stub
+
+######### add include path #############
+CPPFLAGS += -I./include
+
+######### add compile option #############
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+
+include ../../stub.mk
diff --git a/stub/clock/client_clock/include/stub/Clock_API.h b/stub/clock/client_clock/include/stub/Clock_API.h
new file mode 100755
index 0000000..375354e
--- /dev/null
+++ b/stub/clock/client_clock/include/stub/Clock_API.h
@@ -0,0 +1,503 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file Clock_API.h
+ * @brief System community functions header file.
+ */
+
+/*******************************************************************************
+* $Header:: $
+* $Revision:: $
+*******************************************************************************/
+
+ /******************************************************************************
+ * file name : Clock_API.h
+ * system name : PND-A
+ * sub system name : system common function group header file
+ * program name :
+****************************************************************************/
+#ifndef CLOCK_CLIENT_CLOCK_INCLUDE_VEHICLE_SERVICE_CLOCK_API_H_
+#define CLOCK_CLIENT_CLOCK_INCLUDE_VEHICLE_SERVICE_CLOCK_API_H_
+
+#include <time.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup clock
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english The time corrected by GPS.
+ */
+#define CLOCK_CORRECTED_TIME (0U)
+
+/**
+ * \~english The time not corrected by GPS.
+ */
+#define CLOCK_NOT_CORRECTED_TIME (1U)
+
+/**
+ * \~english The time synchronized by GPS RTC.
+ */
+#define CLOCK_RTC_TIME (2U)
+
+/**
+ * \~english GPS time error.
+ */
+#define CLOCK_INVALID_TIME (3U)
+
+/**
+ * \~english The max size memory for time zone.
+ */
+#define TIME_ZONE_MAX_SIZE 256
+
+/**
+ * \~english Return value define.
+ */
+typedef enum tagCLOCK_RETURN {
+ CLOCK_OK, //!< \~english Return successful
+ CLOCK_ERROR, //!< \~english Return failed
+ CLOCK_ERROR_ARGUMENTS //!< \~english Arguments error
+} CLOCK_RETURN;
+/*
+ data type definition
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ \~english API function prototype defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * \ingroup Clock_getSystemTime
+ * \~english @par Brief
+ * - Get the system time.
+ * \~english @param [out] time Store system time data
+ * \~english @param [out] status Store time data status\n
+ * Time status:\n
+ * Valid time : CLOCK_CORRECTED_TIME\n
+ * Invalid time: CLOCK_INVALID_TIME\n
+ * NOTE:When can't communication with Clock service, return "CLOCK_INVALID_TIME"
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The argument used for store system time data is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The argument used for store time data status is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - Get system time error. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return after call end), please check it when used the API.
+ * - Call this API to get the system time and status.
+ * - NOTE:Local time can be got by calling Clock_getLocalTime which parameter is the result of this API.
+ * - The time returned by calling this API is UTC time, its range is from\n
+ * "1970-01-01 00:00:00" to "2038-01-19 03:14:07".
+ * - Clock_getSystemTimeY2K38 can be used to get time later than "2038-01-19 03:14:08".
+ * - Result : "System time and time status" to "System time and status" will be stored in arguments.
+ * \~english @see Clock_getLocalTime, Clock_getSystemTimeY2K38, McOpenSender,\n
+ * McCreateInvokerName, McOpenSyncReceiver, McInvokeSync
+ */
+CLOCK_RETURN Clock_getSystemTime(struct timespec* time, uint8_t* status);
+
+/**
+ * \ingroup Clock_getLocalTime
+ * \~english @par Brief
+ * - Get the local time.
+ * \~english @param [in] base_time Pointer to store base time(seconds)
+ * \~english @param [out] local_time Pointer to store local time
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The argument used to store base time(seconds) is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The argument used to store local time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - Get local time failed. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to get local time.
+ * - The time returned by calling this API is UTC time, its range is from\n
+ * "1970-01-01 00:00:00" to "2038-01-19 03:14:07".
+ * - Clock_getSystemTimeY2K38 can be used to get time later than "2038-01-19 03:14:08".
+ * - Result : Local time will be stored in arguments.
+ * - tm which is changed base on base_time will be returned when the timezone is not set.
+ * \~english @see Clock_getSystemTime, Clock_getSystemTimeY2K38
+ */
+CLOCK_RETURN Clock_getLocalTime(const time_t* base_time, struct tm* local_time);
+
+/**
+ * \ingroup Clock_CnvSecToDate
+ * \~english @par Brief
+ * - Convert specified elapsed seconds to date and time.\n
+ * The specified elapsed seconds are regarded as elapsed time from 1970/01/01 00:00:00.
+ * \~english @param [in] timep The pointer to store the seconds
+ * \~english @param [out] result The pointer to store date time
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The pointer used to store the seconds from base date time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The pointer used to store the date time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - Convert the seconds from base date time to date time failed. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to convert the seconds which is "1970-01-01 00:00:00" to date time.
+ * - The time returned by calling this API is UTC time, its range is from\n
+ * "1970-01-01 00:00:00" to "2038-01-19 03:14:07".
+ * - Clock_getSystemTimeY2K38 can be used to get time later than "2038-01-19 03:14:08".
+ * - Result :Convert the seconds to date time. The seconds is from "1970-01-01 00:00:00".
+ * \~english @see Clock_CnvDateToSec, Clock_CnvSecToDateY2K38
+ */
+CLOCK_RETURN Clock_CnvSecToDate(const time_t* timep, struct tm *result);
+
+/**
+ * \ingroup Clock_CnvDateToSec
+ * \~english @par Brief
+ * - Convert specified date and time to elapsed seconds from 1970/01/01 00:00:00.
+ * \~english @param [in] tm The pointer to store date time to convert
+ * \~english @param [out] result The pointer to store seconds from base time
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The pointer used to store the date time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The pointer used to store the seconds from base date time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to convert the seconds which from "1970-01-01 00:00:00" to date time.
+ * - The API is used when UTC time is in the range from "1970-01-01 00:00:00" to "2038-01-19 03:14:07".
+ * - For more then "2038-01-19 03:14:08", please use Clock_CnvDateToSecY2K38.
+ * - Result : Convert date time to seconds from "1970-01-01 00:00:00".
+ * \~english @see Clock_CnvSecToDate, Clock_CnvDateToSecY2K38
+ */
+CLOCK_RETURN Clock_CnvDateToSec(const struct tm* tm, time_t* result);
+
+/**
+ * \ingroup Clock_setUserTime
+ * \~english @par Brief
+ * - Set the display time when GPS synchronization setting is off.
+ * \~english @param [in] user_time The pointer to store the time(second from base time)
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The pointer used to store the time from base date time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - Get thread name of caller failed. [CLOCK_ERROR]
+ * - Get handle of Clock service message queue failed. [CLOCK_ERROR]
+ * - Generate message queue name for sync call failed. [CLOCK_ERROR]
+ * - Generate message queue for receiving failed. [CLOCK_ERROR]
+ * - Message sync communicate failed. [CLOCK_ERROR]
+ * - Message buffer received sync communicate message is error. [CLOCK_ERROR]
+ * - Clock service handle failed. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - This API called for user set time to user time when GPS corrected off.
+ * - Result : Set user time when GPS corrected off.
+ * \~english @see Clock_getUserTime, Clock_addUserTimeOffset, McOpenSender,\n
+ * McCreateInvokerName, McOpenSyncReceiver, McInvokeSync
+ */
+CLOCK_RETURN Clock_setUserTime(const time_t* user_time);
+
+/**
+ * \ingroup Clock_getUserTime
+ * \~english @par Brief
+ * - Get the display time when GPS synchronization setting is off.
+ * \~english @param [out] user_time The pointer to store the time(second from base time)
+ * \~english @param [out] status The pointer to store time status\n
+ * time status\n
+ * Valid time: CLOCK_CORRECTED_TIME\n
+ * Invalid time: CLOCK_INVALID_TIME\n
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When GPS corrected off, the pointer to store user time date is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The pointer to store time status is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The caller thread name get failed. [CLOCK_ERROR]
+ * - Get Clock service message queue handle failed. [CLOCK_ERROR]
+ * - Generate message queue name for sync call failed. [CLOCK_ERROR]
+ * - Generate message queue handle for sync call failed. [CLOCK_ERROR]
+ * - Message sync communicate failed. [CLOCK_ERROR]
+ * - Message buffer received sync communicate message is error. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call the API, can get the status for user time invalid or valid, when GPS corrected off.
+ * - Note : Get local time, use Clock_getLocalTIme with arguments.\n
+ * The API used to get user time when GPS corrected off.
+ * - Result : Get user time when GPS corrected off.
+ * \~english @see Clock_setUserTime, Clock_addUserTimeOffset, Clock_getLocalTime,\n
+ * McOpenSender, McCreateInvokerName, McOpenSyncReceiver, McInvokeSync
+ */
+CLOCK_RETURN Clock_getUserTime(time_t* user_time, uint8_t* status);
+
+/**
+ * \ingroup Clock_addUserTimeOffset
+ * \~english @par Brief
+ * - Adjust the display time when GPS synchronization setting is off.
+ * \~english @param [in] offset The pointer to store offset for add(sub) user time.\n
+ * Note : Member has limit as follow. \n
+ * int tm_hour: hour(-12 to 12)\n
+ * int tm_min : minute(-59 to 59)\n
+ * year, month, day, second and so on not used, please set 0.
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The pointer to store offset for add(sub) user time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_sec set second not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_mday set day not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_mon set month not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_year set year not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_wday set day in week not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_yday set day in year not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_isdst set daylight save time not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_hour set hour bigger then 12. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_hour set hour smaller then -12. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_min set minute bigger then 59. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_min set minute smaller then -59. [CLOCK_ERROR_ARGUMENTS]
+ * - The caller thread name get failed. [CLOCK_ERROR]
+ * - Get Clock service message queue handle failed. [CLOCK_ERROR]
+ * - Generate message queue name for sync call failed. [CLOCK_ERROR]
+ * - Generate message queue handle for sync call failed. [CLOCK_ERROR]
+ * - Message sync communicate failed. [CLOCK_ERROR]
+ * - Clock service handle failed. [CLOCK_ERROR]
+ * - Message buffer received sync communicate message is error. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - The API used for add(sub) user time when user set GPS correct off.
+ * - Result : User time add(sub) offset when GPS correct off.
+ * \~english @see Clock_setUserTime, Clock_getUserTime, McOpenSender, McCreateInvokerName,\n
+ * McOpenSyncReceiver, McInvokeSync
+ */
+CLOCK_RETURN Clock_addUserTimeOffset(const struct tm* offset);
+
+/* Clock_getSystemTimeY2K38 can be used to get time later than "2038-01-19 03:14:08"(UTC). */
+/**
+ * \ingroup Clock_getSystemTimeY2K38
+ * \~english @par Brief
+ * - Get the system time(2038 issue fixed).
+ * \~english @param [out] time Store system time data
+ * \~english @param [out] status Store time data status\n
+ * Time status:\n
+ * Valid time : CLOCK_CORRECTED_TIME\n
+ * Invalid time: CLOCK_INVALID_TIME\n
+ * Note : When can't communication with Clock service, return "CLOCK_INVALID_TIME".
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the storage area of the system time data is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - When the time data status storage area is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - In case of system time acquisition failure. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call the API, can get the status for system time invalid or valid.
+ * - Get local time, use Clock_getLocalTIme with arguments. The API used to get system time.
+ * - The API is used when UTC time is in the range from "1970-01-01 00:00:00" to "2016-01-19 03:14:07".
+ * - Result : System time and time status will be stored in arguments.
+ * \~english @see Clock_getSystemTime, Clock_getLocalTimeY2K38, McOpenSender,\n
+ * McCreateInvokerName, McOpenSyncReceiver, McInvokeSync
+ */
+CLOCK_RETURN Clock_getSystemTimeY2K38(uint32_t* time, uint8_t* status);
+
+/**
+ * \ingroup Clock_getLocalTimeY2K38
+ * \~english @par Brief
+ * - Get the local time(2038 issue fixed).
+ * \~english @param [in] base_time Pointer to store base time(seconds)
+ * \~english @param [out] local_time Pointer to store local time
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The argument used to store base time(seconds) is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The argument used to store local time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The argument named base_time bigger then up limit(4293400447) of fixed 2038 issue. [CLOCK_ERROR_ARGUMENTS]
+ * - Get local time failed. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to get local time.
+ * - Return local time by add time zone information to base time.
+ * - The API is used when UTC time is in the range from "1970-01-01 00:00:00" to "2106-01-19 03:14:07".
+ * - The parameter base_time bigger then up limit(4293400447), convert error.
+ * - Also, this API does not support day of the week (Member tm_wday acquired always stores -1.)\n
+ * what the caller sought from year/nomth/data information.
+ * - Result : Local time will be stored in arguments.
+ * - If time zone not set, it will return change base_time type to tm
+ * \~english @see Clock_getLocalTime, Clock_getSystemTimeY2K38
+ */
+CLOCK_RETURN Clock_getLocalTimeY2K38(const uint32_t* base_time, struct tm* local_time);
+
+/**
+ * \ingroup Clock_CnvSecToDateY2K38
+ * \~english @par Brief
+ * - Convert specified elapsed seconds to date and time(2038 issue fixed).\n
+ * The specified elapsed seconds are regarded as elapsed time from 1970/01/01 00:00:00.
+ * \~english @param [in] time Pointer to the storage destination
+ * \~english @param [out] result Pointer to storage location of converted date/time
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the accumulated second storage area from the date conuting point to be converted is NULL.\n
+ * [CLOCK_ERROR_ARGUMENTS]
+ * - When the converted date/time storage area is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - When the regerence time (seconds) specified by the argument time is greater than\n
+ * the conuntermeasure upper limit value (4293400447) of the 2038 root problem. [CLOCK_ERROR_ARGUMENTS]
+ * - In case of a date/time conversion failure as a cumulative second from the specified date\n
+ * in the specified integration seconds. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to convert the specified integration seconds to the date and\n
+ * time as the integration seconds from "1970-01-01 00:00:00" at the date conuting point.
+ * - The API is used when UTC time is in the range from "1970-01-01 00:00:00" to "2106-01-19 03:14:07".
+ * - If the argument time exceeds the above upper limit(4293400447), it can not be converted properly.
+ * - Also, this API does not support day of the week (Member tm_wday acquired always stores -1.)\n
+ * what the caller sought from year/nomth/data information.
+ * - Result: Converts the specified integration seconds to the date and time\n
+ * as the integration seconds from "1970-01-01 00:00:00" at the date conuting point.
+ * \~english @see Clock_CnvSecToDate, Clock_CnvDateToSecY2K38
+ */
+CLOCK_RETURN Clock_CnvSecToDateY2K38(const uint32_t* time, struct tm *result);
+
+/**
+ * \ingroup Clock_CnvDateToSecY2K38
+ * \~english @par Brief
+ * - Convert specified date and time to elapsed seconds from 1970/01/01 00:00:00.(2038 issue fixed)
+ * \~english @param [in] tm Pointer to the storage location of the date and time to be converted.
+ * \~english @param [out] result Pointer to storage detination of accumulated seconds from date counting point.
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR_ARGUMENTS Invalide parameter
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the date time storage area to be converted is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - When the accumulated second storage area from the date conuting point is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - When the conversion result (result) is greater than the conuntermeasure upper\n
+ * limit value (4293400447) of the 2038 root problem. [CLOCK_ERROR_ARGUMENTS]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to convert the specified time to integration seconds from "1970-01-01 00:00:00"\n
+ * (date conuting point).
+ * - The API is used when UTC time is in the range from "1970-01-01 00:00:00" to "2106-01-19 03:14:07".
+ * - The maximum value of result that can be obtained is 4293400447(sec).
+ * - Result: Converts the specified date and time to integration seconds from "1970-01-01 00:00:00"\n
+ * (date counting point).
+ * \~english @see Clock_CnvDateToSec, Clock_CnvSecToDateY2K38
+ */
+CLOCK_RETURN Clock_CnvDateToSecY2K38(const struct tm* tm, uint32_t* result);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+/** @}*/ // end of clock
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // CLOCK_CLIENT_CLOCK_INCLUDE_VEHICLE_SERVICE_CLOCK_API_H_
diff --git a/stub/clock/client_clock/include/stub/clock_clock.h b/stub/clock/client_clock/include/stub/clock_clock.h
new file mode 100755
index 0000000..b1a1c99
--- /dev/null
+++ b/stub/clock/client_clock/include/stub/clock_clock.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file clock_clock.h
+ * @brief clock module of clock unit common header file.
+ */
+#ifndef VEHICLESERVICE_CLOCKCLOCK_H_ // NOLINT(build/header_guard) unit common special
+#define VEHICLESERVICE_CLOCKCLOCK_H_ // NOLINT(build/header_guard) unit common special
+
+#include <stub/Clock_API.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup clock
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/** @}*/ // end of clock
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLESERVICE_CLOCKCLOCK_H_
diff --git a/stub/clock/client_clock/libClock_API.ver b/stub/clock/client_clock/libClock_API.ver
new file mode 100755
index 0000000..b26c9cf
--- /dev/null
+++ b/stub/clock/client_clock/libClock_API.ver
@@ -0,0 +1,29 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#########################
+# libClock_API version script #
+#########################
+{
+ global:
+ ### .text section ###
+ Clock_*;
+ ### .data section ###
+ *clock_msg_handle;
+ local:
+ *;
+};
+
diff --git a/stub/clock/client_clock/src/Clock_API.cpp b/stub/clock/client_clock/src/Clock_API.cpp
new file mode 100755
index 0000000..360c7bf
--- /dev/null
+++ b/stub/clock/client_clock/src/Clock_API.cpp
@@ -0,0 +1,118 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <stub/Clock_API.h>
+
+/* static variable definition */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ function prototype
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+CLOCK_RETURN Clock_getSystemTime(struct timespec* time, uint8_t* status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_getLocalTime(const time_t* base_time, struct tm* local_time) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_CnvSecToDate(const time_t* timep, struct tm *result) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_CnvDateToSec(const struct tm* tm, time_t* result) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_setUserTime(const time_t* user_time) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_getUserTime(time_t* user_time, uint8_t* status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_addUserTimeOffset(const struct tm* offset) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_getSystemTimeY2K38(uint32_t* time, uint8_t* status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_getLocalTimeY2K38(const uint32_t* base_time, struct tm* local_time) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_CnvSecToDateY2K38(const uint32_t* time, struct tm *result) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_CnvDateToSecY2K38(const struct tm* tm, uint32_t* result) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
diff --git a/stub/clock/client_display_time/Makefile b/stub/clock/client_display_time/Makefile
new file mode 100755
index 0000000..48b2261
--- /dev/null
+++ b/stub/clock/client_display_time/Makefile
@@ -0,0 +1,47 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libDTime_Api
+
+######### install headers(*.h) #############
+INST_HEADERS = DTime_Api.h clock_notifications.h clock_display_time.h
+
+######### compiled sources #############
+libDTime_Api_SRCS = DTime_Api.cpp
+
+######### add source path #############
+VPATH += ./src ./include/stub
+
+######### add include path #############
+CPPFLAGS += -I./include
+
+######### add compile option #############
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += -Wl,--no-as-needed
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+
+include ../../stub.mk
diff --git a/stub/clock/client_display_time/include/stub/DTime_Api.h b/stub/clock/client_display_time/include/stub/DTime_Api.h
new file mode 100755
index 0000000..7a07d19
--- /dev/null
+++ b/stub/clock/client_display_time/include/stub/DTime_Api.h
@@ -0,0 +1,916 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file DTime_Api.h
+ * @brief display time middle API header file.
+ */
+#ifndef CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_DTIME_API_H_
+#define CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_DTIME_API_H_
+
+/****************************************************************************
+ * File name : DTime_Api.h
+ * System name :
+ * Sub system name : Display time middle API header
+ * Title : Data Header Files Required for Using Display Time Middle
+ ****************************************************************************/
+#include <native_service/frameworkunified_types.h>
+#include <stub/clock_notifications.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup clock
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/**
+ * \~english commod ID (from display time middle)
+ */
+typedef enum _ClockServiceProtocol {
+ CID_DTIME_NOTIFY = 0x00000712, //!< \~english Display time notice
+} ClockServiceProtocol;
+
+/******************************************************************************
+* Structure : T_TimeData
+* Function : Time structure
+* Note : Stores the system/user time obtained from the Clock
+ *******************************************************************************/
+/**
+ * \~english Time structure T_TimeData, store system time/user time acquired from clock.
+ */
+typedef struct _tag_T_TimeData {
+ uint16_t Year; //!< \~english Year
+ uint8_t Month; //!< \~english Month
+ uint8_t Day; //!< \~english Day
+ uint8_t Hour; //!< \~english Hour
+ uint8_t Minute; //!< \~english Minute
+ uint8_t Second; //!< \~english Second
+ uint8_t rsv; //!< \~english Reserve
+} T_TimeData;
+
+/**
+ * \~english +(plus)
+ */
+#define DTIME_TIMEDIFF_SIGN_PLUSE FALSE
+/**
+ * \~english -(minus)
+ */
+#define DTIME_TIMEDIFF_SIGN_MINUS TRUE
+
+/**
+ * \~english Time zone structure.
+ */
+typedef struct _tag_T_TimeDiff {
+ BOOL Sign; //!< \~english Sign
+ uint8_t Hour_Diff; //!< \~english Time difference (hour)
+ uint8_t Minute_Diff; //!< \~english Time difference (minutes)
+ uint8_t rsv[2]; //!< \~english Reserve
+} T_TimeDiff;
+
+/**
+ * \~english Time offset setting structure.
+ */
+typedef struct _tag_T_TimeOffset {
+ int8_t Hour_Offset; //!< \~english Time difference (hour)
+ int8_t Minute_Offset; //!< \~english Time difference (minutes)
+ int8_t rsv[2]; //!< \~english Reserve
+} T_TimeOffset;
+
+/**
+ * \~english GPS automatic adjustment OFF (use system time).
+ */
+#define DTIME_SETTING_GPS_MANUAL FALSE
+
+/**
+ * \~english GPS automatic adjustment Auto (use display time when GPS correction OFF).
+ */
+#define DTIME_SETTING_GPS_AUTO TRUE
+
+/**
+ * \~english Notation in 12H.
+ */
+#define DTIME_SETTING_FORMAT_12H FALSE
+
+/**
+ * \~english Notation in 24H.
+ */
+#define DTIME_SETTING_FORMAT_24H TRUE
+
+/**
+ * \~english DST manual setting.
+ */
+#define DTIME_SETTING_DST_MANUAL FALSE
+
+/**
+ * \~english DST automatic setting.
+ */
+#define DTIME_SETTING_DST_AUTO TRUE
+
+/**
+ * \~english DST OFF
+ */
+#define DTIME_SETTING_DST_OFF FALSE
+
+/**
+ * \~english DST ON
+ */
+#define DTIME_SETTING_DST_ON TRUE
+
+/**
+ * \~english Time zone manual setting.
+ */
+#define DTIME_SETTING_TIMEZONE_MANUAL FALSE
+
+/**
+ * \~english Time zone automatic setting.
+ */
+#define DTIME_SETTING_TIMEZONE_AUTO TRUE
+
+/**
+ * \~english Display setting structure.
+ */
+typedef struct _tag_T_DisplaySetting {
+ BOOL GPS_Auto; //!< \~english GPS automatic setting
+ BOOL Format; //!< \~english 12H/24H display setting
+ BOOL DST_Auto; //!< \~english DST automatic settting
+ BOOL DST_Setting; //!< \~english DST_ON/OFF setting
+ BOOL TimeZone_Auto; //!< \~english Time zone automatic setting
+ T_TimeDiff TimeZone_Setting; //!< \~english Time zone time difference setting
+ T_TimeOffset TimeOffset; //!< \~english Time offset
+} T_DisplaySetting;
+
+/**
+ * \~english Display time invalid.
+ */
+#define DTIME_DISP_TIME_INVALID FALSE
+
+/**
+ * \~english Display time valid.
+ */
+#define DTIME_DISP_TIME_VALID TRUE
+
+/**
+ * \~english Invalid AM/PM.
+ */
+#define DTIME_DISP_MERIDIEM_INVALID 0
+
+/**
+ * \~english AM
+ */
+#define DTIME_DISP_MERIDIEM_AM 1
+
+/**
+ * \~english PM
+ */
+#define DTIME_DISP_MERIDIEM_PM 2
+
+/**
+ * \~english AM/PM unidentified in 12H display.
+ */
+#define DTIME_DISP_MERIDIEM_12H_INVALID 3
+
+/**
+ * \~english Display time structure.
+ */
+typedef struct _tag_T_DTimeData {
+ BOOL TimeValidity; //!< \~english Validity of time display
+ uint8_t Meridiem; //!< \~english AM/PM
+ uint16_t DYear; //!< \~english Display date(year)
+ uint8_t DMonth; //!< \~english Display date(month)
+ uint8_t DDay; //!< \~english Display date(day)
+ uint8_t DHour; //!< \~english Display time(hour)
+ uint8_t DMinute; //!< \~english Display time(minute)
+ uint8_t rsv; //!< \~english Reserve
+} T_DTimeData;
+
+/******************************************************************************
+* Structure : T_DTIME_MSG_NOTIFY_DTIME
+* Function : Display time notification transmission data structure
+* Note :
+ ******************************************************************************/
+/**
+ * \~english Display time notification transmission data structure T_DTIME_MSG_NOTIFY_DTIME.
+ */
+typedef struct _tag_T_DTIME_MSG_NOTIFY_DTIME {
+ T_DTimeData disp_time; //!< \~english Display time
+ T_DisplaySetting disp_setting; //!< \~english Display setting
+ T_TimeData org_time; //!< \~english Time(origin data)
+} T_DTIME_MSG_NOTIFY_DTIME;
+
+/******************************************************************************
+* Structure : T_DTIME_MSG_GPSTIME
+* Function : GPS time setting data structure
+* Note :
+ ******************************************************************************/
+/**
+ * \~english GPS UTC time setting structure.
+ */
+typedef struct _tag_T_DTIME_GPSTIME {
+ uint16_t year; //!< \~english Year
+ uint8_t month; //!< \~english Month
+ uint8_t date; //!< \~english Day
+ uint8_t hour; //!< \~english Hour
+ uint8_t minute; //!< \~english Minute
+ uint8_t second; //!< \~english Second
+ uint8_t reserved; //!< \~english Reserve
+} T_DTIME_GPSTIME;
+
+/**
+ * \~english Time uncalibrated after receiver reset.
+ */
+#define DTIME_GPS_STATUS_INVALID 0x00
+
+/**
+ * \~english Time output by RTC backup (with time calibration results).
+ */
+#define DTIME_GPS_STATUS_RTC 0x01
+
+/**
+ * \~english Time calibration completed.
+ */
+#define DTIME_GPS_STATUS_CORRECT 0x02
+
+/**
+ * \~english GPS time setting data structure.
+ */
+typedef struct _tag_T_DTIME_MSG_GPSTIME {
+ T_DTIME_GPSTIME utc; //!< \~english GPS UTC time
+ uint8_t tdsts; //!< \~english Date and time status
+ uint8_t reserve[3]; //!< \~english Reserve
+} T_DTIME_MSG_GPSTIME;
+
+/** Other definitions *********************************/
+/**
+ * \~english AM
+ */
+#define DTIME_SET_MERIDIEM_AM TRUE
+
+/**
+ * \~english PM
+ */
+#define DTIME_SET_MERIDIEM_PM FALSE
+
+/* Displayed Time Middle API Prototypes *************/
+/**
+ * \ingroup DTime_loadDisplaySetting
+ * \~english @par Brief
+ * - Load display settings.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Setting Display setting
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Display time is available after this API is called by SettingService.\n
+ * (It is assumed to call it only once at startup)
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When storage area of the display setting is NULL [eFrameworkunifiedStatusFail]
+ * - When the time difference(hour)specified by the argument Setting->TimeZone_Setting.Hour_Diff\n
+ * is greater than the time difference(hour)upper limit(13)[eFrameworkunifiedStatusFail]
+ * - Incorrect time difference(minutes)specified by argument Setting->TimeZone_Setting.Minute_Diff\n
+ * (when the value is not 0, 15, 30, 45). [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage synchronization communication fails. [eFrameworkunifiedStatusFail]
+ * - When processing of loading display setting fails in clock service. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - Since this API is synchronous processing(completion recovery),\n
+ * it should be used in consideration of this.
+ * - When display time is used before this API is called by SettingService,\n
+ * even if DTime_registListener_DisplayTime() is used, display time notification can not be received.
+ * - (Since clock service does not publish display time notification.)
+ * - With this API, the following is information necessary for calculation of\n
+ * display time can be collectively set to Clock service.
+ * - GPS automatic setting, 12H/24H display setting, DST setting, time zone setting, time offset.
+ * - Set the time offset to 0 when GPS correction is OFF.
+ * - If the display time distribution has already been regitered,\n
+ * the Clock service will publish the display time notification immediately when this API is called.
+ * \~english @see DTime_getDisplaySetting, DTime_regist_Listener_DisplayTime, FrameworkunifiedMcOpenSender, FrameworkunifiedInvokeSync
+ */
+EFrameworkunifiedStatus DTime_loadDisplaySetting(HANDLE h_app, T_DisplaySetting *setting); /* Load display setting */
+
+/**
+ * \ingroup DTime_getDisplaySetting
+ * \~english @par Brief
+ * - Load display settings.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Setting Display setting
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - This API should be called after DTime_loadDisplaySetting() is called.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When storage area of the display setting is NULL [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage synchronization communication fails. [eFrameworkunifiedStatusFail]
+ * - When message length received by synchronous communication\n
+ * and length of storage buffer are different. [eFrameworkunifiedStatusFail]
+ * - When display setting on Clock service side is not loaded. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - Since this API is synchronous processing(completion recovery),\n
+ * it should be used in consideration of this.
+ * - This API assumes that the Diag service will use it to acquire time difference information etc.
+ * - With this API, you can acquire the information on the right set at display time.\n
+ * GPS automatic setiting, 12H/24H display setting, DST setting, time zone setting, time offse.
+ * \~english @see DTime_loadDisplaySetting, FrameworkunifiedMcOpenSender, FrameworkunifiedInvokeSync
+ */
+EFrameworkunifiedStatus DTime_getDisplaySetting(HANDLE h_app, T_DisplaySetting *setting); /* Get display setting */
+
+/**
+ * \ingroup DTime_setGpsTime
+ * \~english @par Brief
+ * - Set the GPS time on the clock.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] gps_time GPS data setting
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the setting of storage area set by the GPS data/time setting is NULL. [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called when the positioning service acquires/updates the GPS time.
+ * - Note : Do not use POS_RegisterListenerGPStime() from Clock service.
+ * - The GPS time notification command to the external clock is transmitted\n
+ * when this API is called.
+ * - With this API, GPS time can be set to clock function.
+ * GPS date and time (year, month, day, hour, minute, second)\n
+ * GPS date and time status\n
+ * 0 = Time not correct after receiver reset(time input or manager reset or CSF startup),\n
+ * 1 = RTC backup according to time output(actual result of time correction),\n
+ * 2 = Time correct done.
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setGpsTime(HANDLE h_app, T_DTIME_MSG_GPSTIME *gps_time); /* GPS time setting */
+
+/**
+ * \ingroup DTime_registerListener_DTime
+ * \~english @par Brief
+ * - Register delivery of display time notification.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] notifyName Delivery destination thread name. Note : Set it to 15 characters or less.
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the storage area specified by the destination thread name is NULL. [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - The maximum number of registered listeners is 20.
+ * - If listeners are registered more than once from the same thread, count as one listener.\n
+ * however, in this case, the display time notification is immediately issued.
+ * - With this API, delivery of this display time notification to the thread\n
+ * designated as the argument is started.
+ * - When this API call is called, if the display setting is not loaded,\n
+ * you can not calculate the display time, so do not deliver the display time notification.
+ * - When this API is called, if the display setting has already been loaded,\n
+ * the Clock service immediately issues a display time notification.
+ * - A message is notified with a command "CID_DTIME_NOTIFY" when display time is deliveried.
+ * - The client receives the data of the T_DTIME_MSG_NOTIFY_DTIME structure in the above delivery message.
+ * - Message communication uses interprocess communication by NSFW.
+ * - Specify ClockMng thread (TN_CLOCK_MNG) as the sender when registering callback for receiving display time.
+ * - Display time is not delivered until SettingService calls DTime_loadDisplaySetting.
+ * \~english @see DTime_UnregisterListener_DTime, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_registerListener_DTime(HANDLE h_app, PCSTR notify_name); /* Display time delivery registration */
+
+/**
+ * \ingroup DTime_UnregisterListener_DTime
+ * \~english @par Brief
+ * - Release delivery of display time notification.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] notifyName Delivery destination thread name. Note : Set it to 15 characters or less.
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the storage area specified by the destination thread name is NULL. [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - With this API, releasing delivery registration of display time notification\n
+ * to the thread specified as argument is canceled.
+ * - Especially when the nonresident service is registering for delivery,\n
+ * be sure to cancel registration with this API in termination processing.
+ * \~english @see DTime_registerListener_DTime, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_UnregisterListener_DTime(HANDLE h_app, PCSTR notify_name); /* Release display time delivery registration */
+
+/**
+ * \ingroup DTime_setAutoAdjust
+ * \~english @par Brief
+ * - Set GPS automatic adjustment.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Setting Display setting.\n
+ * DTIME_SETTING_GPS_AUTO: GPS automatic adjust AUTO(use display time when GPS correction OFF)\n
+ * DTIME_SETTING_GPS_MANUAL: GPS automatic adjust OFF(use of system time)
+ * \~english @param [in] Offset Time offset.\n
+ * GPS correction is ON: User set hour offset, minute offset.\n
+ * GPS correction is OFF: set zero
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the storage area of the time offset is NULL. [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, it is possible to switch the absolute time\n
+ * (GPS time or display time in the case of GPS correction off) which is the source of display time.
+ * - When GPS correction is OFF, count from the default time (2017/1/1 1:00).
+ * - When GPS correction OFF, set the time offset to zero and set the time\n
+ * offset with this API when GPS correction is ON.
+ * - When this API is called, if the display time distribution has already been refistered,\n
+ * the Clock service immediately issues a display time notification.
+ * - However, when an external clock is connected, the display time is not issued immediately\n
+ * and the display time is delivered at the timing of receiving the "Time notification".
+ * - When an external clock is connected, since the data master at the offset time\n
+ * becomes an external clock, the following processing is performed.
+ * - If the received time offset is
+ * - 1) When it is more than 1 hour ahead of the offset of the external clock \n
+ * -> Set to add 1 hour offsets to external clock.
+ * - 2) If it is less than 1 hour, 1 minute or more after the offset of the external clock \n
+ * -> Set to add 1 minute offsets to external clock.
+ * - 3) When it is more than -1 hour earlier of the offset of the external clock \n
+ * -> Set the external clock to subtract 1 hour offsets.
+ * - 4) When it is less than 1 hour or more than -1 minute from the offset of the external clock \n
+ * -> Set the external clock to subtract 1 minute offsets.
+ * - 5) When both hours and minutes are zero\n
+ * -> Set the external clock to clear zero.
+ * - Do not reflect changes in offset when GPS correction OFF<-->ON is switched.
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setAutoAdjust(HANDLE h_app, BOOL setting, T_TimeOffset *off_set); /* GPS automatic adjustment */
+
+/**
+ * \ingroup DTime_increaseHour
+ * \~english @par Brief
+ * - Adjust the time.
+ * \~english @param [in] hApp Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, display time can be increased by one hour. Set the display\n
+ * time in the case of GPS correction off used when GPS correction OFF is set.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered at\n
+ * the timing of receiving the "time notification".
+ * - When an external clock is connected, set the absolute time hour (+) instruction to\n
+ * the external clock with the "setting SW information notification" command.
+ * \~english @see DTime_decreaseHour, DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_increaseHour(HANDLE h_app); /* Adjust the time (hour increaase) */
+
+/**
+ * \ingroup DTime_decreaseHour
+ * \~english @par Brief
+ * - Adjust time (decrease hour by 1 hour).
+ * \~english @param [in] hApp Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, display time can be reduced by 1 hour. Set the display time\n
+ * in the case of GPS correction off used when GPS correction OFF is set.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - When an external clock is connected, set the absolute time hour (-) instruction\n
+ * with the "setting SW information notification" command to the external clock.
+ * \~english @see DTime_increaseHour, DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_decreaseHour(HANDLE h_app); /* Adjust the time (hour decrease) */
+
+/**
+ * \ingroup DTime_increaseMinute
+ * \~english @par Brief
+ * - Adjust the time (increase time by 1 minute).
+ * \~english @param [in] hApp Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, display time can be increased by one minute. Set the display time\n
+ * in the case of GPS correction off used when GPS correction OFF is set.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - When an external clock is connected, set the absolute time minute (+) instruction\n
+ * to the external clock with the "setting SW information notification" command.
+ * \~english @see DTime_decreaseMinute, DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_increaseMinute(HANDLE h_app); /* Adjust the time (minute increaase) */
+
+/**
+ * \ingroup DTime_decreaseMinute
+ * \~english @par Brief
+ * - Adjust the time (decrease time by 1 minute).
+ * \~english @param [in] hApp Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, display time can be reduced by 1 minute. Set the display time\n
+ * in the case of GPS correction off used when GPS correction OFF is set.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - When an external clock is connected, set the absolute time minute (-) instruction\n
+ * with the "setting SW information notification" command to the external clock.
+ * \~english @see DTime_increaseMinute, DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_decreaseMinute(HANDLE h_app); /* Adjust the time (minute decrease) */
+
+/**
+ * \ingroup DTime_clearMinute
+ * \~english @par Brief
+ * - Adjust the time (set the time to 0 minute).
+ * \~english @param [in] hApp Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, the display time can be set to 0 minutes.
+ * - When the display time is 30 to 59 minutes, increase the display time by one hour\n
+ * and then set the display time to 0 minutes.
+ * - If the display time is 0 to 29 minutes, set the dispaly time to 0 minutes only.
+ * - Set the internal offset to be used when GPS correction OFF.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - When an external clock is connected, set the absolute time minute (-) instruction\n
+ * with the "setting SW information notification" command to the external clock.
+ * \~english @see DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_clearMinute(HANDLE h_app); /* Adjust the time (minute clear) */
+
+/**
+ * \ingroup DTime_setAMPM
+ * \~english @par Brief
+ * - Set AM/PM.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Meridiem AM/PM setting\n
+ * AM : DTIME_SET_MERIDIEM_AM(TRUE)\n
+ * PM : DTIME_SET_MERIDIEM_PM(FALSE)
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When message asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, AM/PM of display time can be switched.
+ * - When PM is selected with the display time (Hour of T_DTimeData) set to\n
+ * AM (0 to 11 o'clock), the display time is +12h.
+ * - When AM is selected at the display time (Hour of T_DTimeData) at PM (12 to 23 o'clock),\n
+ * it makes -12h at display time.
+ * - Set the internal offset to be used when GPS correction OFF.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * \~english @see DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setAMPM(HANDLE h_app, BOOL meridiem); /* AM/PM setting */
+
+/**
+ * \ingroup DTime_setFormat
+ * \~english @par Brief
+ * - 12h/24h sets the display format.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Setting Display setting\n
+ * DTIME_SETTING_FORMAT_12H(FALSE): Notation in 12H\n
+ * DTIME_SETTING_FORMAT_24H(TRUE): Notation in 24H
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, it is possible to switch the display time 12H notation/24H notation.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setFormat(HANDLE h_app, BOOL setting); /* format setting */
+
+/**
+ * \ingroup DTime_setTimeZone
+ * \~english @par Brief
+ * - Set the time zone.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Auto Time zone automatic setting\n
+ * DTIME_SETTING_TIMEZONE_AUTO (TRUE): Time zone automatic setting\n
+ * DTIME_SETTING_TIMEZONE_MANUAL (FALSE): Time zone manual setting
+ * \~english @param [in] Diff Time zone time difference setting
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the time zone time time difference setting storage area is NULL. [eFrameworkunifiedStatusFail]
+ * - When the time difference(hour)specified by the argument Diff->Hour_Diff\n
+ * is greater than the time difference(hour)upper limit value(13)[eFrameworkunifiedStatusFail]
+ * - When the time difference(minutes)specified by the argument Diff->Minute_Diff\n
+ * is incorrect (When the time difference (minutes) specified by the argument\n
+ * Diff->Minute_Diff is not 0, 15, 30, 45). [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, you can set time zone automatic switching and time zone setting.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - Depending on the time zone automatic setting of the second argument, set the third argument as follows.
+ * - MANUAL: User's setting value.
+ * - MANUAL/AUTO Time zones update each time the time zone setting changes.
+ * - Note : When MANUAL, it is not necessary to call this API each time "TZ status notification" is received.
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setTimeZone(HANDLE h_app, BOOL b_auto, T_TimeDiff *diff); /* time zone setting */
+
+/**
+ * \ingroup DTime_setDST
+ * \~english @par Brief
+ * - Set DST.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Auto Time zone automatic setting\n
+ * DTIME_SETTING_DST_AUTO (TRUE): DST automatic setting\n
+ * DTIME_SETTING_DST_MANUAL (FALSE): DST manual setting
+ * \~english @param [in] Setting Time zone time difference setting
+ * DTIME_SETTING_DST_ON (TRUE)\n
+ * DTIME_SETTING_DST_OFF (FALSE)
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, you can compete for automatic switching of DST, and can set ON/OFF.
+ * - When this API is called, the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - Depending on the DST automatic setting of the second argument, set the third argument as follows.
+ * - MANUAL: User's setting value.
+ * - MANUAL/AUTO update each DST ON/OFF setting if there is a change.
+ * - Note : When MANUAL, it is not necessary to call this API each time "DST status notification" is received.
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setDST(HANDLE h_app, BOOL b_auto, BOOL setting); /* DST setting */
+
+/**
+ * \ingroup DTime_notifySwOff
+ * \~english @par Brief
+ * - Notify SW OFF information.
+ * \~english @param [in] h_app Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, you can notify SW OFF informations of image operations to Extern clock(Meter Device).
+ * - Note : Do nothing while Extern clock doesn't exist.
+ * - After calling this API,the SW OFF will not be notified immediately,it will be notified while Meter exists.
+ * - while error occurs(API return eFrameworkunifiedStatusFail),need to recall this API.\n
+ * \n
+ * - Switch ON notification should be executed among the corresponding API of operations as followed.
+ * <table>
+ * <tr><th>API name(Switch ON notification) </th><th>OFF notification neccessary/unneccessary </th><th>note(reason of unneccessary)</th></tr>
+ * <tr><td>DTime_loadDisplaySetting </td><td>unneccessary </td><td>apart from button operation</td></tr>
+ * <tr><td>DTime_getDisplaySetting </td><td>unneccessary </td><td>apart from button operation</td></tr>
+ * <tr><td>DTime_setGpsTime </td><td>unneccessary </td><td>apart from button operation</td></tr>
+ * <tr><td>DTime_registerListener_DTime </td><td>unneccessary </td><td>apart from button operation</td></tr>
+ * <tr><td>DTime_UnregisterListener_DTime </td><td>unneccessary </td><td>apart from button operation</td></tr>
+ * <tr><td>DTime_setAutoAdjust </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_increaseHour </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_decreaseHour </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_increaseMinute </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_decreaseMinute </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_clearMinute </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_setAMPM </td><td>unneccessary </td><td>extern clock is unneccessary</td></tr>
+ * <tr><td>DTime_setFormat </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_setTimeZone </td><td>unneccessary </td><td>there is no extern clock SW ON/OFF notification</td></tr>
+ * <tr><td>DTime_setDST </td><td>unneccessary </td><td>there is no extern clock SW ON/OFF notification</td></tr>
+ * </table>
+ * \n
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_notifySwOff(HANDLE h_app); /* SW OFF notification */
+
+/** @}*/ // end of clock
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_DTIME_API_H_
diff --git a/stub/clock/client_display_time/include/stub/clock_display_time.h b/stub/clock/client_display_time/include/stub/clock_display_time.h
new file mode 100755
index 0000000..1cf19db
--- /dev/null
+++ b/stub/clock/client_display_time/include/stub/clock_display_time.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file clock_display_time.h
+ * @brief display time module of clock unit common header file.
+ */
+#ifndef VEHICLESERVICE_CLOCKDISPLAYTIME_H_ // NOLINT(build/header_guard) unit common special
+#define VEHICLESERVICE_CLOCKDISPLAYTIME_H_ // NOLINT(build/header_guard) unit common special
+
+#include <stub/DTime_Api.h>
+#include <stub/clock_notifications.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup clock
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/** @}*/ // end of clock
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLESERVICE_CLOCKDISPLAYTIME_H_
diff --git a/stub/clock/client_display_time/include/stub/clock_notifications.h b/stub/clock/client_display_time/include/stub/clock_notifications.h
new file mode 100755
index 0000000..29eb836
--- /dev/null
+++ b/stub/clock/client_display_time/include/stub/clock_notifications.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file clock_notifications.h
+ * @brief Notification names defined in the file.
+ */
+#ifndef CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_CLOCK_NOTIFICATIONS_H_
+#define CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_CLOCK_NOTIFICATIONS_H_
+
+#include <agl_thread.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup clock
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/**
+ * \~english clock service availability notify.
+ */
+#define NTFY_Clock_Availability MN_CLOCK"/Availability"
+
+/** @}*/ // end of clock
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_CLOCK_NOTIFICATIONS_H_
diff --git a/stub/clock/client_display_time/libDTime_Api.ver b/stub/clock/client_display_time/libDTime_Api.ver
new file mode 100755
index 0000000..47e22d4
--- /dev/null
+++ b/stub/clock/client_display_time/libDTime_Api.ver
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#########################
+# libDTime_Api version script #
+#########################
+{
+ global:
+ ### .text section ###
+ extern "C++" {
+ DTime_*;
+ };
+ ### .data section ###
+ *s_clock_hApp;
+ local:
+ *;
+};
+
diff --git a/stub/clock/client_display_time/src/DTime_Api.cpp b/stub/clock/client_display_time/src/DTime_Api.cpp
new file mode 100755
index 0000000..cf1f96b
--- /dev/null
+++ b/stub/clock/client_display_time/src/DTime_Api.cpp
@@ -0,0 +1,246 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <stub/DTime_Api.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#define DTIME_PARAM_NG FALSE
+#define DTIME_PARAM_OK TRUE
+
+/******************************************************************************
+ * API name : DTime_loadDisplaySetting
+ * Function : Load display setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_loadDisplaySetting(HANDLE h_app, T_DisplaySetting *setting ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_getDisplaySetting
+ * Function : Get display setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_getDisplaySetting(HANDLE h_app, T_DisplaySetting *setting ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setGpsTime
+ * Function : GPS time setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setGpsTime(HANDLE h_app, T_DTIME_MSG_GPSTIME *gps_time ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_registerListener_DTime
+ * Function : Display time delivery registration
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_registerListener_DTime(HANDLE h_app, PCSTR notify_name) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_UnregisterListener_DTime
+ * Function : Release time delivery registration
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_UnregisterListener_DTime(HANDLE h_app, PCSTR notify_name) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setAutoAdjust
+ * Function : GPS auto adjust setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setAutoAdjust(HANDLE h_app, BOOL setting, T_TimeOffset *offset) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_increaseHour
+ * Function : Adjust the time (hour increaase)
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_increaseHour(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_decreaseHour
+ * Function : Adjust the time (hour decrease)
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_decreaseHour(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_increaseMinute
+ * Function : Adjust the time (minute increaase)
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_increaseMinute(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_decreaseMinute
+ * Function : Adjust the time (minute decrease)
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_decreaseMinute(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_clearMinute
+ * Function : Adjust the time (minute clear)
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_clearMinute(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setAMPM
+ * Function : AM/PM setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setAMPM(HANDLE h_app, BOOL meridiem) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setFormat
+ * Function : Format setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setFormat(HANDLE h_app, BOOL setting ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setTimeZone
+ * Function : Time zone setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setTimeZone(HANDLE h_app, BOOL b_auto, T_TimeDiff *diff ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setDST
+ * Function : DST setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setDST(HANDLE h_app, BOOL b_auto, BOOL setting ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+
+/******************************************************************************
+ * API name : DTime_notifySwOff
+ * Function : SW OFF notification
+ * Outline :
+ * Note : Used to notify the SW OFF of on-screen operations.
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_notifySwOff(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/** Parameter check functions **/
+BOOL CheckParamTimeZone(T_TimeDiff *diff) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DTIME_PARAM_OK;
+}
diff --git a/stub/clock/localtime/Makefile b/stub/clock/localtime/Makefile
new file mode 100755
index 0000000..fc75dd8
--- /dev/null
+++ b/stub/clock/localtime/Makefile
@@ -0,0 +1,49 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##
+## Makefile - Makefile for TimeZone file
+##
+
+ZONEINFDIR = $(DESTDIR)/usr/share/zoneinfo/
+ZONEINFLNK = /etc/
+ZONEINFDIR2 = $(DESTDIR)/etc/
+ZONEINFLNK2 = /tmp/bs/clock/
+ZONEINFFILE= localtime
+DSTDIR = $(ZONEINFDIR)DST
+CLEAN_DIRS = $(ZONEINFDIR)
+
+LDFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+install-data:
+ rm -rf $(ZONEINFDIR) ;\
+ mkdir -p $(DSTDIR) ;\
+ mkdir -p $(ZONEINFDIR2) ;
+
+## /usr/sbin/zic -d $(ZONEINFDIR) zoneinfo_base;
+ zic -d $(ZONEINFDIR) zoneinfo_base;
+
+ ln -f -s $(ZONEINFLNK)$(ZONEINFFILE) $(ZONEINFDIR)$(ZONEINFFILE); \
+ ln -f -s $(ZONEINFLNK2)$(ZONEINFFILE) $(ZONEINFDIR2)$(ZONEINFFILE)
+
+include ../../stub.mk
diff --git a/stub/clock/localtime/zoneinfo_base b/stub/clock/localtime/zoneinfo_base
new file mode 100755
index 0000000..944eabd
--- /dev/null
+++ b/stub/clock/localtime/zoneinfo_base
@@ -0,0 +1,232 @@
+# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
+Rule DST min max - Jan 1 0:00u 1:00 -
+
+# DST OFF
+# Zone NAME UTCOFF RULES FORMAT [UNTIL]
+Zone UTC-1345 -13:45 - UTC-13
+Zone UTC-1330 -13:30 - UTC-13
+Zone UTC-1315 -13:15 - UTC-13
+Zone UTC-1300 -13 - UTC-13
+Zone UTC-1245 -12:45 - UTC-12
+Zone UTC-1230 -12:30 - UTC-12
+Zone UTC-1215 -12:15 - UTC-12
+Zone UTC-1200 -12 - UTC-12
+Zone UTC-1145 -11:45 - UTC-11
+Zone UTC-1130 -11:30 - UTC-11
+Zone UTC-1115 -11:15 - UTC-11
+Zone UTC-1100 -11 - UTC-11
+Zone UTC-1045 -10:45 - UTC-10
+Zone UTC-1030 -10:30 - UTC-10
+Zone UTC-1015 -10:15 - UTC-10
+Zone UTC-1000 -10 - UTC-10
+Zone UTC-0945 -9:45 - UTC-9
+Zone UTC-0930 -9:30 - UTC-9
+Zone UTC-0915 -9:15 - UTC-9
+Zone UTC-0900 -9 - UTC-9
+Zone UTC-0845 -8:45 - UTC-8
+Zone UTC-0830 -8:30 - UTC-8
+Zone UTC-0815 -8:15 - UTC-8
+Zone UTC-0800 -8 - UTC-8
+Zone UTC-0745 -7:45 - UTC-7
+Zone UTC-0730 -7:30 - UTC-7
+Zone UTC-0715 -7:15 - UTC-7
+Zone UTC-0700 -7 - UTC-7
+Zone UTC-0645 -6:45 - UTC-6
+Zone UTC-0630 -6:30 - UTC-6
+Zone UTC-0615 -6:15 - UTC-6
+Zone UTC-0600 -6 - UTC-6
+Zone UTC-0545 -5:45 - UTC-5
+Zone UTC-0530 -5:30 - UTC-5
+Zone UTC-0515 -5:15 - UTC-5
+Zone UTC-0500 -5 - UTC-5
+Zone UTC-0445 -4:45 - UTC-4
+Zone UTC-0430 -4:30 - UTC-4
+Zone UTC-0415 -4:15 - UTC-4
+Zone UTC-0400 -4 - UTC-4
+Zone UTC-0345 -3:45 - UTC-3
+Zone UTC-0330 -3:30 - UTC-3
+Zone UTC-0315 -3:15 - UTC-3
+Zone UTC-0300 -3 - UTC-3
+Zone UTC-0245 -2:45 - UTC-2
+Zone UTC-0230 -2:30 - UTC-2
+Zone UTC-0215 -2:15 - UTC-2
+Zone UTC-0200 -2 - UTC-2
+Zone UTC-0145 -1:45 - UTC-1
+Zone UTC-0130 -1:30 - UTC-1
+Zone UTC-0115 -1:15 - UTC-1
+Zone UTC-0100 -1 - UTC-1
+Zone UTC-0045 -0:45 - UTC-0
+Zone UTC-0030 -0:30 - UTC-0
+Zone UTC-0015 -0:15 - UTC-0
+Zone UTC+0000 0 - UTC+0
+Zone UTC+0015 0:15 - UTC+0
+Zone UTC+0030 0:30 - UTC+0
+Zone UTC+0045 0:45 - UTC+0
+Zone UTC+0100 1 - UTC+1
+Zone UTC+0115 1:15 - UTC+1
+Zone UTC+0130 1:30 - UTC+1
+Zone UTC+0145 1:45 - UTC+1
+Zone UTC+0200 2 - UTC+2
+Zone UTC+0215 2:15 - UTC+2
+Zone UTC+0230 2:30 - UTC+2
+Zone UTC+0245 2:45 - UTC+2
+Zone UTC+0300 3 - UTC+3
+Zone UTC+0315 3:15 - UTC+3
+Zone UTC+0330 3:30 - UTC+3
+Zone UTC+0345 3:45 - UTC+3
+Zone UTC+0400 4 - UTC+4
+Zone UTC+0415 4:15 - UTC+4
+Zone UTC+0430 4:30 - UTC+4
+Zone UTC+0445 4:45 - UTC+4
+Zone UTC+0500 5 - UTC+5
+Zone UTC+0515 5:15 - UTC+5
+Zone UTC+0530 5:30 - UTC+5
+Zone UTC+0545 5:45 - UTC+5
+Zone UTC+0600 6 - UTC+6
+Zone UTC+0615 6:15 - UTC+6
+Zone UTC+0630 6:30 - UTC+6
+Zone UTC+0645 6:45 - UTC+6
+Zone UTC+0700 7 - UTC+7
+Zone UTC+0715 7:15 - UTC+7
+Zone UTC+0730 7:30 - UTC+7
+Zone UTC+0745 7:45 - UTC+7
+Zone UTC+0800 8 - UTC+8
+Zone UTC+0815 8:15 - UTC+8
+Zone UTC+0830 8:30 - UTC+8
+Zone UTC+0845 8:45 - UTC+8
+Zone UTC+0900 9 - UTC+9
+Zone UTC+0915 9:15 - UTC+9
+Zone UTC+0930 9:30 - UTC+9
+Zone UTC+0945 9:45 - UTC+9
+Zone UTC+1000 10 - UTC+10
+Zone UTC+1015 10:15 - UTC+10
+Zone UTC+1030 10:30 - UTC+10
+Zone UTC+1045 10:45 - UTC+10
+Zone UTC+1100 11 - UTC+11
+Zone UTC+1115 11:15 - UTC+11
+Zone UTC+1130 11:30 - UTC+11
+Zone UTC+1145 11:45 - UTC+11
+Zone UTC+1200 12 - UTC+12
+Zone UTC+1215 12:15 - UTC+12
+Zone UTC+1230 12:30 - UTC+12
+Zone UTC+1245 12:45 - UTC+12
+Zone UTC+1300 13 - UTC+13
+Zone UTC+1315 13:15 - UTC+13
+Zone UTC+1330 13:30 - UTC+13
+Zone UTC+1345 13:45 - UTC+13
+
+# DST ON
+# Zone NAME UTCOFF RULES FORMAT [UNTIL]
+Zone DST/UTC-1345 -13:45 DST UTC-13
+Zone DST/UTC-1330 -13:30 DST UTC-13
+Zone DST/UTC-1315 -13:15 DST UTC-13
+Zone DST/UTC-1300 -13 DST UTC-13
+Zone DST/UTC-1245 -12:45 DST UTC-12
+Zone DST/UTC-1230 -12:30 DST UTC-12
+Zone DST/UTC-1215 -12:15 DST UTC-12
+Zone DST/UTC-1200 -12 DST UTC-12
+Zone DST/UTC-1145 -11:45 DST UTC-11
+Zone DST/UTC-1130 -11:30 DST UTC-11
+Zone DST/UTC-1115 -11:15 DST UTC-11
+Zone DST/UTC-1100 -11 DST UTC-11
+Zone DST/UTC-1045 -10:45 DST UTC-10
+Zone DST/UTC-1030 -10:30 DST UTC-10
+Zone DST/UTC-1015 -10:15 DST UTC-10
+Zone DST/UTC-1000 -10 DST UTC-10
+Zone DST/UTC-0945 -9:45 DST UTC-9
+Zone DST/UTC-0930 -9:30 DST UTC-9
+Zone DST/UTC-0915 -9:15 DST UTC-9
+Zone DST/UTC-0900 -9 DST UTC-9
+Zone DST/UTC-0845 -8:45 DST UTC-8
+Zone DST/UTC-0830 -8:30 DST UTC-8
+Zone DST/UTC-0815 -8:15 DST UTC-8
+Zone DST/UTC-0800 -8 DST UTC-8
+Zone DST/UTC-0745 -7:45 DST UTC-7
+Zone DST/UTC-0730 -7:30 DST UTC-7
+Zone DST/UTC-0715 -7:15 DST UTC-7
+Zone DST/UTC-0700 -7 DST UTC-7
+Zone DST/UTC-0645 -6:45 DST UTC-6
+Zone DST/UTC-0630 -6:30 DST UTC-6
+Zone DST/UTC-0615 -6:15 DST UTC-6
+Zone DST/UTC-0600 -6 DST UTC-6
+Zone DST/UTC-0545 -5:45 DST UTC-5
+Zone DST/UTC-0530 -5:30 DST UTC-5
+Zone DST/UTC-0515 -5:15 DST UTC-5
+Zone DST/UTC-0500 -5 DST UTC-5
+Zone DST/UTC-0445 -4:45 DST UTC-4
+Zone DST/UTC-0430 -4:30 DST UTC-4
+Zone DST/UTC-0415 -4:15 DST UTC-4
+Zone DST/UTC-0400 -4 DST UTC-4
+Zone DST/UTC-0345 -3:45 DST UTC-3
+Zone DST/UTC-0330 -3:30 DST UTC-3
+Zone DST/UTC-0315 -3:15 DST UTC-3
+Zone DST/UTC-0300 -3 DST UTC-3
+Zone DST/UTC-0245 -2:45 DST UTC-2
+Zone DST/UTC-0230 -2:30 DST UTC-2
+Zone DST/UTC-0215 -2:15 DST UTC-2
+Zone DST/UTC-0200 -2 DST UTC-2
+Zone DST/UTC-0145 -1:45 DST UTC-1
+Zone DST/UTC-0130 -1:30 DST UTC-1
+Zone DST/UTC-0115 -1:15 DST UTC-1
+Zone DST/UTC-0100 -1 DST UTC-1
+Zone DST/UTC-0045 -0:45 DST UTC-0
+Zone DST/UTC-0030 -0:30 DST UTC-0
+Zone DST/UTC-0015 -0:15 DST UTC-0
+Zone DST/UTC+0000 0 DST UTC+0
+Zone DST/UTC+0015 0:15 DST UTC+0
+Zone DST/UTC+0030 0:30 DST UTC+0
+Zone DST/UTC+0045 0:45 DST UTC+0
+Zone DST/UTC+0100 1 DST UTC+1
+Zone DST/UTC+0115 1:15 DST UTC+1
+Zone DST/UTC+0130 1:30 DST UTC+1
+Zone DST/UTC+0145 1:45 DST UTC+1
+Zone DST/UTC+0200 2 DST UTC+2
+Zone DST/UTC+0215 2:15 DST UTC+2
+Zone DST/UTC+0230 2:30 DST UTC+2
+Zone DST/UTC+0245 2:45 DST UTC+2
+Zone DST/UTC+0300 3 DST UTC+3
+Zone DST/UTC+0315 3:15 DST UTC+3
+Zone DST/UTC+0330 3:30 DST UTC+3
+Zone DST/UTC+0345 3:45 DST UTC+3
+Zone DST/UTC+0400 4 DST UTC+4
+Zone DST/UTC+0415 4:15 DST UTC+4
+Zone DST/UTC+0430 4:30 DST UTC+4
+Zone DST/UTC+0445 4:45 DST UTC+4
+Zone DST/UTC+0500 5 DST UTC+5
+Zone DST/UTC+0515 5:15 DST UTC+5
+Zone DST/UTC+0530 5:30 DST UTC+5
+Zone DST/UTC+0545 5:45 DST UTC+5
+Zone DST/UTC+0600 6 DST UTC+6
+Zone DST/UTC+0615 6:15 DST UTC+6
+Zone DST/UTC+0630 6:30 DST UTC+6
+Zone DST/UTC+0645 6:45 DST UTC+6
+Zone DST/UTC+0700 7 DST UTC+7
+Zone DST/UTC+0715 7:15 DST UTC+7
+Zone DST/UTC+0730 7:30 DST UTC+7
+Zone DST/UTC+0745 7:45 DST UTC+7
+Zone DST/UTC+0800 8 DST UTC+8
+Zone DST/UTC+0815 8:15 DST UTC+8
+Zone DST/UTC+0830 8:30 DST UTC+8
+Zone DST/UTC+0845 8:45 DST UTC+8
+Zone DST/UTC+0900 9 DST UTC+9
+Zone DST/UTC+0915 9:15 DST UTC+9
+Zone DST/UTC+0930 9:30 DST UTC+9
+Zone DST/UTC+0945 9:45 DST UTC+9
+Zone DST/UTC+1000 10 DST UTC+10
+Zone DST/UTC+1015 10:15 DST UTC+10
+Zone DST/UTC+1030 10:30 DST UTC+10
+Zone DST/UTC+1045 10:45 DST UTC+10
+Zone DST/UTC+1100 11 DST UTC+11
+Zone DST/UTC+1115 11:15 DST UTC+11
+Zone DST/UTC+1130 11:30 DST UTC+11
+Zone DST/UTC+1145 11:45 DST UTC+11
+Zone DST/UTC+1200 12 DST UTC+12
+Zone DST/UTC+1215 12:15 DST UTC+12
+Zone DST/UTC+1230 12:30 DST UTC+12
+Zone DST/UTC+1245 12:45 DST UTC+12
+Zone DST/UTC+1300 13 DST UTC+13
+Zone DST/UTC+1315 13:15 DST UTC+13
+Zone DST/UTC+1330 13:30 DST UTC+13
+Zone DST/UTC+1345 13:45 DST UTC+13
+
+Link UTC+0000 UTC
diff --git a/stub/communication_subcpu/LICENSE b/stub/communication_subcpu/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/stub/communication_subcpu/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/stub/communication_subcpu/Makefile b/stub/communication_subcpu/Makefile
new file mode 100755
index 0000000..80a31b7
--- /dev/null
+++ b/stub/communication_subcpu/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../stub.mk
diff --git a/stub/communication_subcpu/client/Makefile b/stub/communication_subcpu/client/Makefile
new file mode 100755
index 0000000..b232f9c
--- /dev/null
+++ b/stub/communication_subcpu/client/Makefile
@@ -0,0 +1,43 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libCommSubCpu
+
+######### install headers(*.h) #############
+INST_HEADERS = CommSubCpu_API.h com_message_header.h
+
+######### compiled sources #############
+libCommSubCpu_SRCS += ./src/CommSubCpu_API.cpp
+
+######### add source path #############
+VPATH += src
+VPATH += include/stub
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/$(COMPONENT_NAME)
+
+######### add compile option #############
+
+######### linked library #############
+
+######### linked library (dynamic) #############
+
+######### add library path #############
+
+
+include ../../stub.mk
diff --git a/stub/communication_subcpu/client/include/stub/CommSubCpu_API.h b/stub/communication_subcpu/client/include/stub/CommSubCpu_API.h
new file mode 100755
index 0000000..020c361
--- /dev/null
+++ b/stub/communication_subcpu/client/include/stub/CommSubCpu_API.h
@@ -0,0 +1,266 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMSUBCPU_API_H_
+#define COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMSUBCPU_API_H_
+
+/**
+ * @file CommSubCpu_API.h
+ * @~english
+ * @brief communication_subcpu API header
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup communication_subcpu
+ * @ingroup peripheral_service
+ * @{
+ */
+
+#include <sys/types.h>
+#include <native_service/frameworkunified_types.h>
+#include <agldd/moduleid.h>
+#include <stub/com_message_header.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /*__cplusplus*/
+
+/*! @~english CommSubCpu I/F API return code */
+typedef int32_t COMMSUBCPU_RET_API;
+
+/*! @~english Thread name */
+#define LAN_SERVICE_SYSCOM_MAIN "DEV_SYSCOM_MAIN"
+
+/**
+ * \~english The ICR command receive notification
+ */
+#define CID_ICR_CMD_RCV (0x0A00)
+
+/**
+ * \~english The ICR command send result notification
+ */
+#define CID_ICR_CMD_SND_CNF (0x0A01)
+
+/*! @~english The MAX length of send command */
+#define ICRCMD_OPELAND_SND_MAX (2048)
+/*! @~english The MAX length of send ICR command */
+#define ICRCMD_OPELAND_MAX (252)
+
+/**
+ * \~english ICR command format
+ */
+typedef struct {
+ uint16_t phyadr_from; //!< \~english Physical address
+ uint8_t service_type; //!< \~english Communication type
+ uint8_t lgadr_from; //!< \~english Source logical address
+ uint8_t lgadr_to; //!< \~english Forwarding destination logical address
+ uint8_t opc; //!< \~english Operation code
+ uint8_t d_length; //!< \~english Data size
+ uint8_t data[ICRCMD_OPELAND_MAX]; //!< \~english Command data
+ uint8_t reserve; //!< \~english Reserve
+} T_ICR_CMD_DATA;
+
+/**
+ * \~english Send command structure
+ */
+typedef struct {
+ uint16_t phyadr_from; //!< \~english Physical address
+ uint8_t service_type; //!< \~english Communication type
+ uint8_t lgadr_from; //!< \~english Source logical address
+ uint8_t lgadr_to; //!< \~english Forwarding destination logical address
+ uint8_t opc; //!< \~english Operation code
+ uint16_t d_length; //!< \~english Data size
+ uint8_t data[ICRCMD_OPELAND_SND_MAX]; //!< \~english Command data
+} T_ICR_CMD_SND_DATA;
+
+/**
+ * \~english ICR command data
+ */
+typedef struct {
+ T_ICR_CMD_SND_DATA cmd_data; //!< \~english Command information
+} T_ICR_CMD;
+
+/**
+ * \~english The message of command receive notification
+ */
+typedef struct {
+ /*! @~english The header of message */
+ T_APIMSG_MSGBUF_HEADER_COMM msg_hdr;
+ /*! @~english The message data for send result */
+ T_ICR_CMD_DATA cmd_data;
+} T_ICR_CMD_RCV;
+
+/*!
+ * @~english Status of message send result
+ */
+typedef enum {
+ /*! @~english Send success */
+ ICR_SND_SUCCESS = 0,
+ /*! @~english Initialize error */
+ ICR_SND_ERR_INIT,
+ /*! @~english Send error */
+ ICR_SND_ERR,
+ /*! @~english Send error(retry out) */
+ ICR_SND_ERR_RETRYOUT,
+ /*! @~english Send error(buffer full) */
+ ICR_SND_ERR_BUFFERFULL,
+ /*! @~english Send error(micon abnormal) */
+ ICR_SND_ERR_MC,
+ /*! @~english The MAX */
+ ICR_SND_ERR_MAX
+} ICR_ERROR_CODE;
+
+/*!
+ * @~english Structure for message send status data
+ */
+typedef struct {
+ /*! @~english Result of send message */
+ ICR_ERROR_CODE cnf_sts;
+} T_ICR_CMDSNDCNF_STS;
+
+
+ /**
+ * \~english The send result notification
+ */
+typedef struct {
+ /*! @~english The header of message */
+ T_APIMSG_MSGBUF_HEADER_COMM msg_hdr;
+ /*! @~english The message data for send result */
+ T_ICR_CMDSNDCNF_STS sts;
+} T_ICR_CMDSNDCNF;
+
+
+#define COMMSUBCPU_RET_NORMAL 0 //!< \~english Normal termination
+#define COMMSUBCPU_RET_ERROR_CANCEL 1 //!< \~english Abnormal termination
+#define COMMSUBCPU_RET_ERROR_PARAM 2 //!< \~english Abnormality of parameter
+#define COMMSUBCPU_RET_ERROR_BUFFULL 3 //!< \~english Buffer FULL
+#define COMMSUBCPU_RET_ERROR_OVERLAPPED 4 //!< \~english Entry overlapped
+#define COMMSUBCPU_RET_ERROR_CREATE_EVENT 5 //!< \~english Event generation failure
+
+/**
+ * \ingroup CommSubCpu
+ * \~english @par Brief
+ * CommSubCpu moudle init
+ * \~english @retval COMMSUBCPU_RET_NORMAL : Success
+ * \~english @par Prerequisite
+ * None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * None
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+COMMSUBCPU_RET_API CommSubCpu_Init();
+
+/**
+ * \ingroup CommSubCpu
+ * \~english @par Brief
+ * CommSubCpu moudle deinitializes
+ * \~english @retval COMMSUBCPU_RET_NORMAL : Success
+ * \~english @par Prerequisite
+ * CommSubCpu moudle init completely
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * None
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+COMMSUBCPU_RET_API CommSubCpu_DeInit();
+
+/**
+ * \ingroup CommSubCpu
+ * \~english @par Brief
+ * Delivery registration of CommSubCpu command
+ * \~english @param [in] name
+ * PCSTR - Receiver thread name
+ * \~english @param [in] from
+ * uint8_t - Sender logical address
+ * \~english @param [in] to
+ * uint8_t - Receiver logical address
+ * \~english @param [in] opc
+ * uint8_t - Operation code
+ * \~english @param [in] callback_id
+ * uint8_t - callback ID
+ * \~english @param [in] cid
+ * uint16_t - CID
+ * \~english @retval COMMSUBCPU_RET_NORMAL : Success
+ * \~english @retval COMMSUBCPU_RET_ERROR_PARAM : Paramter error
+ * \~english @par Prerequisite
+ * Availability of Communication is TRUE
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - COMMSUBCPU_RET_ERROR_PARAM
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Async
+ * \~english @see
+ * None
+ */
+COMMSUBCPU_RET_API CommSubCpu_DeliveryMsgEntry(PCSTR name, uint8_t from, uint8_t to, uint8_t opc,
+ uint8_t callback_id, uint16_t cid);
+
+/**
+ * \ingroup CommSubCpu
+ * \~english @par Brief
+ * CommSubCpu command transmission request
+ * \~english @param [in] name
+ * PCSTR - Sender thread name
+ * \~english @param [in] snd_cmd
+ * T_ICR_CMD* - Pointer to send command
+ * \~english @param [in] req_id
+ * uint8_t - RID of the results
+ * \~english @retval COMMSUBCPU_RET_NORMAL : Success
+ * \~english @retval COMMSUBCPU_RET_ERROR_PARAM : Paramter error
+ * \~english @par Prerequisite
+ * Availability of Communication is TRUE
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - COMMSUBCPU_RET_ERROR_PARAM
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Async
+ * \~english @see
+ * None
+ */
+COMMSUBCPU_RET_API CommSubCpu_Transmission(PCSTR name, T_ICR_CMD *snd_cmd, uint8_t req_id);
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus */
+
+#endif // COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMSUBCPU_API_H_
diff --git a/stub/communication_subcpu/client/include/stub/com_message_header.h b/stub/communication_subcpu/client/include/stub/com_message_header.h
new file mode 100755
index 0000000..707cca5
--- /dev/null
+++ b/stub/communication_subcpu/client/include/stub/com_message_header.h
@@ -0,0 +1,65 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COM_MESSAGE_HEADER_H_
+#define COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COM_MESSAGE_HEADER_H_
+
+/**
+ * @file com_message_header.h
+ * @~english
+ * @brief Defination of structure for message header
+ */
+
+#include <sys/types.h>
+
+/****************************************************************************
+ * TAG : typedef T_APIMSG_HEADER
+ * ABSTRACT : _CWORD64_API message header structure
+ * NOTE :
+ ****************************************************************************/
+/*!
+ * @~english
+ * @brief Structure for message header
+ */
+typedef struct {
+ uint16_t replyid; //!< \~english Send Result ID
+ uint16_t sndpno; //!< \~english Send process No
+ uint16_t respno; //!< \~english Response No
+ uint16_t cid; //!< \~english Command ID
+ uint16_t msgbodysize; //!< \~english Message body size
+ uint8_t rid; //!< \~english Resource ID
+ uint8_t reserve; //!< \~english Reserve
+ uint8_t filler[2]; //!< \~english filler
+} T_APIMSG_HEADER_COMM;
+
+/*!
+ * @~english
+ * @brief Structure for buffer message header
+ */
+typedef struct {
+ uint32_t signo; //!< \~english Signal No
+ T_APIMSG_HEADER_COMM hdr; //!< \~english Message Header
+} T_APIMSG_MSGBUF_HEADER_COMM;
+
+/*!
+ * @~english @brief Check for assert do not overflow buffer when Re-arrangement was cast to another structure
+ */
+#define assert_static(e) \
+ do { \
+ enum { assert_static__ = 1 / (e) }; \
+ } while (0)
+
+#endif // COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COM_MESSAGE_HEADER_H_
diff --git a/stub/communication_subcpu/client/src/CommSubCpu_API.cpp b/stub/communication_subcpu/client/src/CommSubCpu_API.cpp
new file mode 100755
index 0000000..69e06e3
--- /dev/null
+++ b/stub/communication_subcpu/client/src/CommSubCpu_API.cpp
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <stub/CommSubCpu_API.h>
+
+COMMSUBCPU_RET_API CommSubCpu_Init() {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return COMMSUBCPU_RET_NORMAL;
+}
+
+COMMSUBCPU_RET_API CommSubCpu_DeInit() {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return COMMSUBCPU_RET_NORMAL;
+}
+
+COMMSUBCPU_RET_API CommSubCpu_DeliveryMsgEntry(PCSTR name, uint8_t from, uint8_t to, uint8_t opc,
+ uint8_t callback_id, uint16_t cid) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return COMMSUBCPU_RET_NORMAL;
+}
+
+
+COMMSUBCPU_RET_API CommSubCpu_Transmission(PCSTR name, T_ICR_CMD *snd_cmd, uint8_t req_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return COMMSUBCPU_RET_NORMAL;
+}
diff --git a/stub/communication_usb/LICENSE b/stub/communication_usb/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/stub/communication_usb/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/stub/communication_usb/Makefile b/stub/communication_usb/Makefile
new file mode 100755
index 0000000..80a31b7
--- /dev/null
+++ b/stub/communication_usb/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../stub.mk
diff --git a/stub/communication_usb/client/Makefile b/stub/communication_usb/client/Makefile
new file mode 100755
index 0000000..fbefaed
--- /dev/null
+++ b/stub/communication_usb/client/Makefile
@@ -0,0 +1,43 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libCommUSB
+
+######### install headers(*.h) #############
+INST_HEADERS = commusb_api.h commusb_notifications.h
+
+######### compiled sources #############
+libCommUSB_SRCS += src/commusb_api.cpp
+
+######### add source path #############
+VPATH += src
+VPATH += include/stub
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/$(COMPONENT_NAME)
+
+######### add compile option #############
+
+######### linked library #############
+
+######### linked library (dynamic) #############
+
+######### add library path #############
+
+
+include ../../stub.mk
diff --git a/stub/communication_usb/client/include/stub/commusb_api.h b/stub/communication_usb/client/include/stub/commusb_api.h
new file mode 100755
index 0000000..f602faa
--- /dev/null
+++ b/stub/communication_usb/client/include/stub/commusb_api.h
@@ -0,0 +1,186 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!-----------------------------------------------------------------------------
+ * @file commusb_api.h
+ * @~english
+ * @brief CommUSB I/F
+ */
+#ifndef COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_API_H_
+#define COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_API_H_
+
+#include <sys/types.h>
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup communication_usb
+ * @ingroup peripheral_service
+ * @{
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/**
+ * @~english Service Name of PS_CommUSB Thread
+ */
+#define LAN_SERVICE_COMMUSB_MAIN "PS_CommUSB"
+
+/**
+ * @~english The maximum number of delivery entry
+ */
+#define COMMUSB_DELIVERY_DATA_MAX 0xFF
+
+/**
+ * @~english Authentication info
+ */
+typedef enum {
+ /**
+ *@~english Authentication is NG
+ */
+ COMMUSB_AUTH_NG = 0x00,
+
+ /**
+ *@~english Authentication is OK
+ */
+ COMMUSB_AUTH_OK
+} COMMUSB_AUTH_INFO;
+
+/**
+ * @~english Transmit class
+ */
+typedef enum {
+ /**
+ *@~english Individual transmission
+ */
+ COMMUSB_TRANS_INDIVIDUAL = 0x00,
+
+ /**
+ *@~english Group broadcast transmission
+ */
+ COMMUSB_TRANS_GROUP,
+
+ /**
+ *@~english Simultaneous broadcast transmission
+ */
+ COMMUSB_TRANS_ALL
+} COMMUSB_TRANS_CLASS;
+
+/**
+ * @~english Clear type of DeliveryEntry table (for debug)
+ */
+typedef enum {
+ /**
+ * @~english Clear all
+ */
+ USB_CLEAR_TYPE_ALL = 0,
+
+ /**
+ * @~english Clear only table without wild card
+ */
+ USB_CLEAR_TYPE_WITHOUT_WILDCARD,
+
+ /**
+ * @~english Clear only table with wild card
+ */
+ USB_CLEAR_TYPE_WITH_WILDCARD,
+} USB_CLEAR_TYPE;
+
+/**
+ * \ingroup USB_Auth_Info
+ * \~english @par Brief
+ * Set the authentication status of the service PS_CommUSB.
+ * \~english @param [in] h_app
+ * HANDLE - handle for application
+ * \~english @param [in] auth_info
+ * uint8_t - Authentication status,refer to @ref COMMUSB_AUTH_INFO
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ * \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ * \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ * \~english @retval eFrameworkunifiedStatusErrNoEINTR
+ * An interrupt is generated by the system call (signal)
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ * \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ * \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+ * \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * (System error, Avaiability is FALSE, internal status error)
+ * \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ * \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+ * \~english @retval eFrameworkunifiedStatusErrOther
+ * Other error has occurred(Cannot access shared memory, etc.)
+ * \~english @par Preconditons
+ * - Availability of PS_CommUSB is TRUE and Authentication state is TRUE.
+ * \~english @par Change of internal status
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - Parameter h_app is null
+ * - eFrameworkunifiedStatusInvldHandle
+ * - Parameter auth_info is invalid
+ * - eFrameworkunifiedStatusInvldParam
+ * - Internal process error
+ * - Availability of PS_CommUSB is not TRUE
+ * - The size of the message received by PS_CommUSB is illegal
+ * - eFrameworkunifiedStatusFail
+ * - Execute the process name is not ExtUnitAuth
+ * - eFrameworkunifiedStatusMsgNotProcessed
+ * - Internal process error(ns_framework error)
+ * - eFrameworkunifiedStatusInvldHandle
+ * - eFrameworkunifiedStatusMsgQFull
+ * - eFrameworkunifiedStatusErrNoEBADF
+ * - eFrameworkunifiedStatusErrNoEINTR
+ * - eFrameworkunifiedStatusNullPointer
+ * - eFrameworkunifiedStatusInvldBufSize
+ * - eFrameworkunifiedStatusInvldBuf
+ * - eFrameworkunifiedStatusBadConnection
+ * - eFrameworkunifiedStatusFail
+ * - eFrameworkunifiedStatusInvldHndlType
+ * - eFrameworkunifiedStatusInvldQName
+ * - eFrameworkunifiedStatusErrOther
+ * \~english @par classification
+ * Public
+ * \~english @par Type
+ * Method only
+ * \~english @par Details
+ * Set the authentication status for PS_CommUSB.
+ * \~english @par
+ * when using this API,please note the following points:
+ * - The status of service PS_CommUSB and the availability of this
+ * API, refer to PS_CommUSB available function list of BaseSystem
+ * external specification.
+ * - This API is designed for the ExtUnitAuth process, If it is used by
+ * other process, return eFrameworkunifiedStatusMsgNotProcessed.
+ * \~english @see None
+ */
+EFrameworkunifiedStatus USB_Auth_Info(HANDLE h_app, uint8_t auth_info);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+/** @}*/ // end of communication_usb
+/** @}*/ // end of peripheral_service
+/** @}*/ // end of BaseSystem
+#endif // COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_API_H_
diff --git a/stub/communication_usb/client/include/stub/commusb_notifications.h b/stub/communication_usb/client/include/stub/commusb_notifications.h
new file mode 100755
index 0000000..9a75cbb
--- /dev/null
+++ b/stub/communication_usb/client/include/stub/commusb_notifications.h
@@ -0,0 +1,56 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file commusb_notifications.h
+ * @~english
+ * @brief commusb_notifications I/F
+ */
+#ifndef COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_NOTIFICATIONS_H_
+#define COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_NOTIFICATIONS_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup communication_usb
+ * @ingroup peripheral_service
+ * @{
+ */
+
+/**
+ * \~english PS_CommUSB service availability notify.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_CommUSB_Availability, OnRcvAvailable_USBEx);
+ * @endcode
+ */
+#define NTFY_CommUSB_Availability "PS_CommUSB/Availability"
+
+/**
+ * \~english USB Device Enumeration complete notify.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_CommUSB_DeviceValidity, OnRcvDeviceValidity);
+ * @endcode
+ */
+#define NTFY_CommUSB_DeviceValidity "PS_CommUSB/DeviceValidity"
+
+/** @}*/ // end of communication_usb
+/** @}*/ // end of peripheral_service
+/** @}*/ // end of BaseSystem
+#endif // COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_NOTIFICATIONS_H_
diff --git a/stub/communication_usb/client/src/commusb_api.cpp b/stub/communication_usb/client/src/commusb_api.cpp
new file mode 100755
index 0000000..c0aa021
--- /dev/null
+++ b/stub/communication_usb/client/src/commusb_api.cpp
@@ -0,0 +1,33 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <stub/commusb_api.h>
+
+EFrameworkunifiedStatus USB_Auth_Info(HANDLE h_app, uint8_t auth_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
diff --git a/stub/diag_code/LICENSE b/stub/diag_code/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/stub/diag_code/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/stub/diag_code/Makefile b/stub/diag_code/Makefile
new file mode 100755
index 0000000..5d374f8
--- /dev/null
+++ b/stub/diag_code/Makefile
@@ -0,0 +1,18 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SUBDIRS := library library_dummy_dccc
+
+include ../stub.mk
diff --git a/stub/diag_code/library/Makefile b/stub/diag_code/library/Makefile
new file mode 100755
index 0000000..274f147
--- /dev/null
+++ b/stub/diag_code/library/Makefile
@@ -0,0 +1,51 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+######### installed program #############
+
+######### installed library(*.a) #############
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libDiagCodeAPI
+
+######### install headers(*.h) #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += DiagCodeAPI.h DIAGCODE.h ss_diag.h
+
+######### compiled sources #############
+libDiagCodeAPI_SRCS += DiagCodeAPI.cpp
+
+######### add source path #############
+VPATH += ./src
+
+######### add include path #############
+CPPFLAGS += -I./include/stub
+CPPFLAGS += -I./../library_dummy_dccc/include/
+
+######### add compile option #############
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+######### dynamic linked library path #############
+
+######### add library path #############
+
+
+include ../../stub.mk
diff --git a/stub/diag_code/library/include/stub/DIAGCODE.h b/stub/diag_code/library/include/stub/DIAGCODE.h
new file mode 100755
index 0000000..5cbcfad
--- /dev/null
+++ b/stub/diag_code/library/include/stub/DIAGCODE.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file DIAGCODE.h
+ */
+/****************************************************************************
+ * FILE : DIAGCODE.h
+ * SYSTEM : Integrated PF middleware system
+ * SUBSYSTEM : ommon system
+ * TITLE : DiagCode
+ ****************************************************************************/
+#ifndef DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODE_H_
+#define DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODE_H_
+
+/*************************************************************************
+ * DiagCode difinition
+ *************************************************************************/
+
+/*************************************************************************
+ * DiagCode code definition name
+ *************************************************************************/
+
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+#define DIAGCODE_DIAGCODEEX_DEFAULT 0x0000U /* - */
+#define DIAGCODE_DIAGCODEEX_EEPROM__CWORD84_ 0x0000U /* - */
+#define DIAGCODE_DIAGCODEEX_STORAGE_ERR__CWORD84_ 0x0000U /* - */
+#define DIAGCODE_DIAGCODEEX_TEL_ECU_ERR 0x0000U /* - */
+
+#endif /* DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODE_H_ */
diff --git a/stub/diag_code/library/include/stub/DiagCodeAPI.h b/stub/diag_code/library/include/stub/DiagCodeAPI.h
new file mode 100755
index 0000000..de831eb
--- /dev/null
+++ b/stub/diag_code/library/include/stub/DiagCodeAPI.h
@@ -0,0 +1,1226 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file DiagCodeAPI.h
+ */
+/*******************************************************************************
+ * FILE : DiagCodeAPI.h
+ * SYSTEM : LinuxPF
+ * SUBSYSTEM :
+ * TITLE : DiagCode management function include definition
+ ******************************************************************************/
+
+#ifndef DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODEAPI_H_
+#define DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODEAPI_H_
+
+/**
+ * @file DiagCodeAPI.h
+ * @~english
+ * @brief Diag code API header
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup diag_code
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! @~english API return value */
+typedef int DGCODE_RET_API;
+
+/**
+ * \~english The definition of diag code processing result
+ */
+/*! @~english Success */
+#define DGCODE_RET_NORMAL (0)
+/*! @~english Fail */
+#define DGCODE_RET_ERROR (-1)
+/*! @~english Illegal parameter */
+#define DGCODE_RET_PARA_ERR (-2)
+
+/**
+ * \~english Category ID definition
+ */
+
+/*! @~english none device */
+#define DGCODE_DIV_UNIT_NONE (0x00)
+/*! @~english device base */
+#define DGCODE_DIV_UNIT_BASE (0x10)
+/*! @~english Your own device */
+#define DGCODE_DIV_UNIT__CWORD92_ (DGCODE_DIV_UNIT_BASE + 0x00)
+/*! @~english Other devices */
+#define DGCODE_DIV_UNIT_OTHER (DGCODE_DIV_UNIT_BASE + 0x01)
+/*! @~english device maximum number definition */
+#define DGCODE_DIV_UNIT_MAX (DGCODE_DIV_UNIT_OTHER)
+
+/*! @~english proto base */
+#define DGCODE_DIV_PROT_BASE (0x20)
+/*! @~english _CWORD43_ */
+#define DGCODE_DIV_PROT__CWORD43_ (DGCODE_DIV_PROT_BASE + 0x00)
+/*! @~english USB */
+#define DGCODE_DIV_PROT_USB (DGCODE_DIV_PROT_BASE + 0x02)
+/*! @~english _CWORD119_ */
+#define DGCODE_DIV_PROT__CWORD119_ (DGCODE_DIV_PROT_BASE + 0x03)
+/*! @~english proto device maximum number definition */
+#define DGCODE_DIV_PROT_MAX (DGCODE_DIV_PROT_USB)
+/*! @~english Communication full selection */
+#define DGCODE_DIV_PROT_ALL (DGCODE_DIV_PROT_BASE + 0x0F)
+/*! @~english All select */
+#define DGCODE_DIV_ALL (DGCODE_DIV_UNIT_BASE + DGCODE_DIV_PROT_BASE)
+/*! \~english Public RoB selection */
+#define DGCODE_DIV_ROB_PUBLIC (1)
+/*! \~english Private Rob selection */
+#define DGCODE_DIV_ROB_PRIVATE (2)
+/*! \~english RoB All select selection*/
+#define DGCODE_DIV_ROB_ALL (DGCODE_DIV_ROB_PUBLIC + DGCODE_DIV_ROB_PRIVATE)
+
+/**
+ * \~english Past present registered flag definition
+ */
+/*! @~english Past and present */
+#define DGCODE_TYPE_PAST_PRES (0)
+/*! @~english Present only */
+#define DGCODE_TYPE_PAST (1)
+/*! @~english Past only */
+#define DGCODE_TYPE_PRES (2)
+/*! @~english Unspecified */
+#define DGCODE_TYPE_NOTSPECIFIED (3)
+
+/**
+ * \~english FF data registration flag definition
+ */
+/*! @~english Do not register FF data */
+#define DGCODE_FFDATA_REG_OFF (0)
+/*! @~english FF data registered */
+#define DGCODE_FFDATA_REG_ON (1)
+/*! @~english Unspecified */
+#define DGCODE_FFDATA_REG_NOTSPECIFIED (2)
+
+/**
+ * \~english Validity invalid time definition
+ */
+/*! @~english Time information invalid */
+#define DGCODE_TIME_INVALID (0)
+/*! @~english Time information valid */
+#define DGCODE_TIME_VALID (1)
+/*! @~english Unspecified */
+#define DGCODE_TIME_NOTSPECIFIED (2)
+
+/**
+ * \~english Diag code existence check result definition
+ */
+/*! @~english Diag code not registered */
+#define DGCODE_CHECK_NOT_EXIST (0)
+/*! @~english Diag code registered */
+#define DGCODE_CHECK_EXIST (1)
+
+/**
+ * \~english Diag code type definition
+ */
+/*! @~english Development diag code */
+#define DGCODE_KIND_DEVELOPMENT (0)
+/*! @~english Service diag code */
+#define DGCODE_KIND_SERVICE (1)
+/*! @~english Communication diag code */
+#define DGCODE_KIND_COMMUNICATION (2)
+/*! @~english Manufacturer diag code */
+#define DGCODE_KIND_MAKER (3)
+
+/**
+ * \~english RoB code type definition
+ */
+/*! \~english Public(service use) */
+#define DGCODE_ROB_KIND_PUBLIC (0)
+/*! \~english Private(only design) */
+#define DGCODE_ROB_KIND_PRIVATE (1)
+
+/**
+ * \~english type of rob_code specification
+ */
+/*! \~english Specify all RoB codes. */
+#define DGCODE_GET_ALL_ROB_CODE (0xFFFF)
+
+/**
+ * \~english Logical unit number definition
+ */
+/*! @~english Unit number 0X */
+#define DGCODE_MAKER_UNIT_0 (0x00)
+/*! @~english Unit number 1X */
+#define DGCODE_MAKER_UNIT_1 (0x01)
+/*! @~english Unit number 2X */
+#define DGCODE_MAKER_UNIT_2 (0x02)
+/*! @~english Unit number 3X */
+#define DGCODE_MAKER_UNIT_3 (0x03)
+/*! @~english Unit number 4X */
+#define DGCODE_MAKER_UNIT_4 (0x04)
+/*! @~english Unit number 5X */
+#define DGCODE_MAKER_UNIT_5 (0x05)
+/*! @~english Unit number 6X */
+#define DGCODE_MAKER_UNIT_6 (0x06)
+/*! @~english Unit number 7X */
+#define DGCODE_MAKER_UNIT_7 (0x07)
+/*! @~english Unit number 8X */
+#define DGCODE_MAKER_UNIT_8 (0x08)
+/*! @~english Unit number 9X */
+#define DGCODE_MAKER_UNIT_9 (0x09)
+/*! @~english Unit number AX */
+#define DGCODE_MAKER_UNIT_A (0x0A)
+/*! @~english Unit number BX */
+#define DGCODE_MAKER_UNIT_B (0x0B)
+/*! @~english Unit number CX */
+#define DGCODE_MAKER_UNIT_C (0x0C)
+/*! @~english Unit number DX */
+#define DGCODE_MAKER_UNIT_D (0x0D)
+/*! @~english Unit number EX */
+#define DGCODE_MAKER_UNIT_E (0x0E)
+/*! @~english Unit number FX */
+#define DGCODE_MAKER_UNIT_F (0x0F)
+/*! @~english All above */
+#define DGCODE_MAKER_UNIT_ALL (0x10)
+
+/**
+ * \~english All designation definitions of registered devices
+ */
+/*! @~english Error designation of all registered devices */
+#define DGCODE_PHYSADR_ALL (0xFFFF)
+
+/**
+ * \~english Diag code registration / deletion notification type definition
+ */
+/*! @~english Diag code registration */
+#define DGCODE_NOTIFY_PUT (0)
+/*! @~english Diag code clear */
+#define DGCODE_NOTIFY_DELETE (1)
+/*! \~english DTC registration */
+#define DGCODE_NOTIFY_DTC_PUT (2)
+/*! \~english RoB registration */
+#define DGCODE_NOTIFY_ROB_PUT (3)
+/*! \~english DTC clear */
+#define DGCODE_NOTIFY_DTC_DELETE (4)
+/*! \~english RoB clear */
+#define DGCODE_NOTIFY_ROB_DELETE (5)
+
+/**
+ * \~english Type of activation definition
+ */
+/*! @~english Hot start */
+#define DGCODE_START_KIND_HOT (0)
+/*! @~english Cold start */
+#define DGCODE_START_KIND_COLD (1)
+
+/**
+ * \~english Analysis support log saved DTC event presence / absence flag definition
+ */
+
+/*!
+ @~english The unnecessary diag code of saving analysis support log
+*/
+#define DGCODE_DTC_EVENT_LOG_OFF (0)
+/*!
+ @~english The necessary diag code of saving analysis support Log
+*/
+#define DGCODE_DTC_EVENT_LOG_ON (1)
+
+/**
+ * \~english Diag code registration mask setting definition
+ */
+/*! @~english Diag code registration mask OFF */
+#define DGCODE_PUT_MASK_OFF (0)
+/*! @~english Diag code registration mask ON */
+#define DGCODE_PUT_MASK_ON (1)
+
+/**
+ * \~english Diag code unique count value definition
+ */
+/*! @~english Normal count */
+#define DGC_TIMESTAMP_NORMAL 0U
+/*! @~english Original count */
+#define DGC_TIMESTAMP_INDIPENDENT 1U
+
+/**
+ * \~english Availability register id define.
+ */
+/*! @~english Backup manager register id */
+#define DGC_REG_AVAILABILITY_BACKUP 0x01
+/*! @~english Clock register id */
+#define DGC_REG_AVAILABILITY_CLOCK 0x02
+/*! @~english diag_record register id */
+#define DGC_REG_AVAILABILITY_PFDRECTHREAD 0x04
+/*! @~english Vehicle register id */
+#define DGC_REG_AVAILABILITY_VEHICLE 0x08
+/*! @~english Postion register id */
+#define DGC_REG_AVAILABILITY_POSITION 0x10
+
+/**
+ * \~english Diag code registration / erasing detailed setting structure
+ */
+typedef struct _DGCODE_MEMINFO_CUSTOM {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_MEMINFO_CUSTOM;
+
+/**
+ * \~english Time information for SSR information
+ */
+typedef struct _DGCODE_SSR_INFO_TIME_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_SSR_INFO_TIME_INFO;
+
+/**
+ * \~english DTC SSR information
+ */
+typedef struct _DGCODE_DTC_SSR_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DTC_SSR_INFO;
+
+/**
+ * \~english RoB SSR information
+ */
+typedef struct _DGCODE_ROB_SSR_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_ROB_SSR_INFO;
+
+/**
+ * \~english Diag code list acquisition setting structure
+ */
+typedef struct _DGCODE_GET_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_GET_LIST_INFO;
+
+/**
+ * \~english Diag code list information structure
+ */
+typedef struct _DGCODE_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_LIST_INFO;
+
+/**
+ * \~english DTC list acquisition setting structure
+ */
+typedef struct _DGCODE_GET_DTC_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_GET_DTC_LIST_INFO;
+
+/**
+ * \~english DTC list information structure
+ */
+typedef struct _DGCODE_DTC_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DTC_LIST_INFO;
+
+
+/**
+ * \~english RoB list acquisition setting structure
+ */
+typedef struct _DGCODE_GET_ROB_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_GET_ROB_LIST_INFO;
+
+/**
+ * \~english RoB list information structure
+ */
+typedef struct _DGCODE_ROB_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_ROB_LIST_INFO;
+
+/**
+ * \~english FF data list information structure
+ */
+typedef struct _DGCODE_FFDATA_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_FFDATA_LIST_INFO;
+
+/**
+ * \~english Diag code list delete setting structure
+ */
+typedef struct _DGCODE_DELETE_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DELETE_INFO;
+
+/**
+ * \~english DTC list delete setting structure
+ */
+typedef struct _DGCODE_DELETE_DTC_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DELETE_DTC_INFO;
+
+/**
+ * \~english RoB list delete setting structure
+ */
+typedef struct _DGCODE_DELETE_ROB_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DELETE_ROB_INFO;
+
+/**
+ * \~english DID change structure
+ */
+typedef struct _DGCODE_DID_LIST {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DID_LIST;
+
+/****************************************/
+/* DiagCodeAPI */
+/****************************************/
+/// \~english Subscribe the availability of the external module
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_SubscribeAvailability
+/// \~english @par Overview
+/// - Notify the availability status of the external module
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] availabilityId The availability id(refer to DGC_REG_AVAILABILITY_XXX)
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - None
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Subscribe the availability callback to NSFW failed [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - Subscribe the availability of the external module
+/// - Use "|" to subscribe the availability of the multiply modules
+/// example: Use the follow way to subscribe the availability of the backup manager and the clock
+/// Diag_SubscribeAvailability(hApp, DGC_REG_AVAILABILITY_BACKUP | DGC_REG_AVAILABILITY_CLOCK)
+/// \~english @see Diag_NotifyAvailability
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_SubscribeAvailability(HANDLE hApp, uint8_t availabilityId);
+
+/// \~english Notify the availability of external module
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_NotifyAvailability
+/// \~english @par Overview
+/// - Notify the availability status of the external module
+/// \~english @param [in] availabilityId The availability id(refer to DGC_REG_AVAILABILITY_XXX)
+/// \~english @param [in] bAvailability Availability status(TRUE: Available, FALSE: Unavailable)
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @par Precondition
+/// - None
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - Notify the available status of external module
+/// - Use "|" to notify the availability status of the multiply modules
+/// example: Use the follow way to notify that the backup manager and the clock are available
+/// Diag_NotifyAvailability(DGC_REG_AVAILABILITY_BACKUP | DGC_REG_AVAILABILITY_CLOCK, TRUE)
+/// \~english @see Diag_SubscribeAvailability
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_NotifyAvailability(uint8_t availabilityId, BOOL bAvailability);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_InitDiagCode
+/// \~english @par Overview
+/// - Perform initialization processing of diag code management.
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] start_kind activation type
+/// \~english @param [in] fpOnCmd fpOnCmd callback definition
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - PFDRECThread is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - When activation type is invalid [DGCODE_RET_PARA_ERR]
+/// - When diag work memory allocation fails [DGCODE_RET_ERROR]
+/// - Failure occurs when read data from the backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when write data to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when write data to the backup area. [DGCODE_RET_ERROR]
+/// - In case acquisition of application name from argument hApp failed [DGCODE_RET_ERROR]
+/// - Failed to register callback information specified by argument fpOnCmd [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - The API should be called only by DiagService
+/// - Call this API, before registering, deleting, checking and acquiring the code.
+/// - Call this API, before registering, deleting, checking and acquiring the DTC information.
+/// - Call this API, before registering, deleting, checking and acquiring the RoB information.
+/// - Call this API, before update all StatusOfDTC.
+/// - This API is a process that is called only once at system startup and should be called with NS_BackupMgr with
+/// Avalability set to TRUE.
+/// - Calls the specified callback function when diag code registration / deletion is executed.
+/// - Calls the specified callback function when DTC information registration / deletion is executed.
+/// - Calls the specified callback function when RoB information registration / deletion is executed.
+/// - You can get message data by calling FrameworkunifiedGetMsgDataOfSize in the callback function.
+/// - message data, a diag code registration / erasure notification structure is set.
+/// \~english @see none
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_InitDiagCode(HANDLE hApp, uint8_t start_kind, CbFuncPtr fpOnCmd);
+
+/// \~english Setting of diag code registration mask information
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_SetDiagCodeMask
+/// \~english @par Overview
+/// - Perform diag code registration mask setting.
+/// \~english @param [in] onoff Diag code registration mask setting
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Diag code registration mask setting is invalid [DGCODE_RET_ERROR]
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - Failure occurs when write data to the backup area [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - The API should be called only by DiagService
+/// - Set the registration mask of the diag code. If + B OFF, the setting information is held. (Initial state,
+/// registration mask OFF)
+/// - If diag code registration mask setting is ON, when Diag_PutDiagCode,
+/// Diag_PutDiagCode_Custom of the diag code registration API is called,
+/// do not register diag code and register FF data.
+/// \~english @see Diag_PutDiagCode, Diag_PutDiagCode_Custom
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_SetDiagCodeMask(uint8_t onoff);
+
+/// \~english Synchronization of time stamp information
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_SyncTimeStamp
+/// \~english @par Overview
+/// - Synchronize time stamp information.
+/// \~english @param [in] time_cnt time counter
+/// \~english @param [in] trip_cnt Trip counter
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - Failure occurs when export data from backup area [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - The API should be called only by DiagService
+/// - Updates the time stamp information held by the library with the value of the specified time counter and
+/// Trip counter.
+/// - The diagnosis service should synchronize the time counter and Trip counter with this API when time
+/// information from the time master is received.
+/// - However, if any of the time counter and Trip counter specified in the argument is Fail value,
+/// do not perform synchronization processing and and update the time stamp information with Fail value.
+/// \~english @see DGC_TIMESTAMP_GETTIME
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_SyncTimeStamp(uint32_t time_cnt, uint16_t trip_cnt);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_SyncDcmTime
+/// \~english @par Brief
+/// - Synchronize Hour information.
+/// \~english @param [in] hour_info Hour information
+/// - #DGCODE_SSR_INFO_TIME_INFO : SSR infomation (Time infomation for SSR, Time infomation for RoB)
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The pointer of Hour information is NULL [#DGCODE_RET_PARA_ERR]
+/// - Initialization of diagcode management information is fail [#DGCODE_RET_ERROR]
+/// - Get mutex failed [#DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Detail
+/// - This API should be called only by DiagService.
+/// - Updates the Hour information held by the library with the value of the specified Hour information.
+/// - DiagService should synchronize Hour information with this API,
+/// when DiagService received the Hour information from the DCM.
+/// - If any of Hour information specified is Fail value,
+/// do not perform synchronization processing, and update the Hour information with Fail value(0xFF).
+/// \~english @see None
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_SyncDcmTime(const DGCODE_SSR_INFO_TIME_INFO * const hour_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_SyncOdometer
+/// \~english @par Overview
+/// - Synchronize odo meter information.
+/// \~english @param [in] mileage accumulative mileage
+/// \~english @param [in] unit odo unit
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The accumulative mileage is invalid (mileage > 999,999) [\ref DGCODE_RET_PARA_ERR]
+/// - Initialization of diagcode management information is fail [\ref DGCODE_RET_ERROR]
+/// - Failure occurs when export data from backup area [\ref DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - The API should be called only by DiagService
+/// - Updates the odo meter information held by the library with the value of the specified accumulative mileage
+/// and odo unit.
+/// - The diagnosis service should synchronize the accumulative mileage and odo unit with this API when time
+/// information from the odo meter is received.
+/// \~english @see None
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_SyncOdometer(const uint32_t mileage, const uint8_t unit);
+
+/// \~english Inhibit diag code register
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_InhibitPutDiagCode
+/// \~english @par Overview
+/// - Inhibit diag code register.
+/// \~english @param none
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - The initialization of diag memory is finished.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - Get mutex failed [DGCODE_RET_ERROR]
+/// - The diag code's inhibit flag has not been initialized [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - The API should be called only by DiagService
+/// - Diag code register inhibit.
+/// \~english @see none
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_InhibitPutDiagCode(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_PutDTCInfo
+/// \~english @par Overview
+/// - Register of DTC info.
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] dtc_id DTC ID\n
+/// Use diag code definition defined in DIAGCODE.h.\n
+/// \~english @param [in] test_result StatusOfDTC\n
+/// testFailed(bit0 not Failed:0 Failed:1)\n
+/// \~english @param [in] ssr_info SSR data info
+/// \~english @param [in] spply_code Supplementary code
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - Diagcode mask is unset.
+/// - BackupMgr is available
+/// - PFDRECThread is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of DTC management information is fail [DGCODE_RET_ERROR]
+/// - DTC ID does not match the defination of DTC ROM table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the DTC ROM table is invalid [DGCODE_RET_ERROR]
+/// - The communication unit ID(division) in the DTC ROM table is
+/// none device(#DGCODE_DIV_UNIT_NONE) [DGCODE_RET_ERROR]
+/// - Allocation of work memory fails when writing the DTC. [DGCODE_RET_ERROR]
+/// - Failure occurs when reading data from backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when writing to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when writing to the backup area [DGCODE_RET_ERROR]
+/// - Communication unit is not _CWORD92_ or other device when registering individual Diag Code. [DGCODE_RET_PARA_ERR]
+/// - The pointer of DTC inhibit info is NULL [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync x Sync
+/// \~english @par Details
+/// - Register DTC info.
+/// - When register development diag code for supplier, set the DTC ID assigned to supplier.
+/// - Register MM DiagRecord, too.
+/// - But if the register mask of DTC is set ON, this API returns DGCODE_RET_NORMAL
+/// not registering the DTC info.
+/// - diag_code sets the following bit of StatusOfDTC.\n
+/// bit1:testFailedThisOperationCycle\n
+/// bit2:pendingDTC\n
+/// bit3:confirmedDTC\n
+/// bit4:testNotCompletedSinceLastClear\n
+/// bit5:testFailedSinceLastClear\n
+/// bit6:testNotCompletedThisOperationCycle\n
+/// - diag_code sets TimeStamp, Odometer and clock time of SSR.
+/// - Treat current position longitude and current latitude of SSR as all 0 in this API.
+/// - Set supplementary code if it is need.
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_PutDTCInfo(const HANDLE hApp, const uint64_t dtc_id, const uint8_t test_result,
+ const DGCODE_DTC_SSR_INFO* ssr_info,
+ const uint16_t spply_code);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_PutRoBInfo
+/// \~english @par Overview
+/// - Register of RoB info.
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] rob_id RoB ID\n
+/// Use diag code definition defined in DIAGCODE.h.\n
+/// \~english @param [in] ssr_info SSR data info
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - Diagcode mask is unset.
+/// - BackupMgr is available
+/// - PFDRECThread is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of RoB management information is fail [DGCODE_RET_ERROR]
+/// - RoB ID does not match the defination of RoB ROM table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the RoB ROM table is invalid [DGCODE_RET_ERROR]
+/// - The communication unit ID(division) in the RoB ROM table is
+/// none device(#DGCODE_DIV_UNIT_NONE) [DGCODE_RET_ERROR]
+/// - Allocation of work memory fails when writing the diag code. [DGCODE_RET_ERROR]
+/// - Failure occurs when read data from backup area [DGCODE_RET_ERROR]
+/// - Failure occur when write to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when write to the backup area [DGCODE_RET_ERROR]
+/// - The pointer of RoB inhibit info is NULL [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync x Sync
+/// \~english @par Details
+/// - Register RoB info.
+/// - When register development diag code for supplier, set the RoB ID assigned to supplier.
+/// - Register MM DiagRecord, too.
+/// - But if the register mask of Diag Code is set ON, this API returns DGCODE_RET_NORMAL
+/// not registering the RoB info.
+/// - Set SSR info related RoB ID to SSR data info(SSR info not related RoB ID is unnecessary).\n
+/// diag_code sets TimeStamp, Odometer and clock time of SSR.
+/// - Treat current position longitude and current latitude of SSR as all 0 in this API.
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_PutRoBInfo(const HANDLE hApp, const uint64_t rob_id, const DGCODE_ROB_SSR_INFO* ssr_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_DeleteDTCInfo
+/// \~english @par Overview
+/// - Delete specified DTC.
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] err_id DTC detail info
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - PFDRECThread is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - The param[err_id] do not match the defination in the diagcode ROM table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the diagcode ROM table is invalid [DGCODE_RET_ERROR]
+/// - If the communication unit ID(division) is other in the diagcode ROM table,
+/// and failure occur when getting unit number. [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Fire and Forget only
+/// \~english @par Details
+/// - For the latest diag which has been registered, do the erase procedure due to the fact that the DTC is initialized.
+/// - If diagcode which specified is not registered, return DGCODE_RET_NORMAL.
+/// - Register removal DTC to MM Diag Record.
+/// - Delete SSR information,too.
+/// - Delete status of DTC, too.
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_DeleteDTCInfo(const HANDLE hApp, const uint64_t err_id);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_GetDTCInfoList_CWORD29_
+/// \~english @par Overview
+/// - Get the List of specified DTC
+/// \~english @param [in] get_info Get info of DTC list
+/// - #DGCODE_GET_DTC_LIST_INFO : DTC list acquisition setting structure
+/// \~english @param [out] list_info List info of DTC
+/// - #DGCODE_DTC_LIST_INFO : DTC list information structure
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - The initialization of diag memory is finished.
+/// - BackupMgr is available
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The pointer get_info of acquisition setting is NULL [DGCODE_RET_PARA_ERR]
+/// - The pointer list_info of storage area is NULL [DGCODE_RET_PARA_ERR]
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - The flag of diag registration start is not OK yet(The function of diagcode is not prepared yet).
+/// [DGCODE_RET_ERROR]
+/// - The acquirement kind(diagcode) is invalid [DGCODE_RET_PARA_ERR]
+/// - Common Diagnosis When the Diag code definition Name acquired from the memory
+/// error table do not match the definition of the diagcode ROM Table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the diag code ROM talble is not valid [DGCODE_RET_ERROR]
+/// - If the acquisition type is development or service and the division ID is other than the self device and
+/// other devices [DGCODE_RET_PARA_ERR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - Get the DTC list of conditions specified by get_info.
+/// - Acquisition type must be set to diag code type definition value.
+/// - StatusOfDTC information must be set to StatusOfDTC of getting DTC.\n
+/// Targeting bit of StatusOfDTC information that is 1, this API gets DTC
+/// that every target bit of StatusOfDTC is also 1.\n
+/// Examples of getting DTC, when StatusOfDTC information is set 0b00100111 : 0b00101111、0b00100111
+/// - Category ID must be set to category ID definition.
+/// - If category ID is other than DGCODE_DIV_UNIT__CWORD92_, error registered device physical address must be set.
+/// - If category ID is DGCODE_DIV_UNIT__CWORD92_, error registered device physical address is not used,
+/// and thus an arbitary value may be set.
+/// - Logic unit number for maker diag must be set DGCODE_MAKER_UNIT_ALL.
+/// - All DTC that matches above condition store in list_info(list_info is variable length).
+/// - The maximum number of DTC that can be acquired at a time is 64.
+/// - By setting any value from 0 to 255 as the DTC acquisition start index position,
+/// 64 DTC can be acquired from that position.\n
+/// To acquire from Nth DTC, N-1 should be set.\n
+/// example : If the number of previous acquisitions is 64 and "DTC acquisition start index position" is
+/// set to 64, DTC from 65th to 128th can be acquired.
+/// - When the number of items remaining from DTC acquisition start index position to set
+/// the last registered DTC is less than 64, only the remaining items are acquired.
+/// example : If the case where 100 items of DTC are registered , when 64 is set
+/// as the "DTC acquisition start index position", 36 items from 65th to 100th can be acquired.
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_GetDTCInfoList_CWORD29_(const DGCODE_GET_DTC_LIST_INFO* const get_info,
+ DGCODE_DTC_LIST_INFO* const list_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_DeleteDTCInfoList
+/// \~english @par Overview
+/// - Delete the list of specified DTC.
+/// \~english @param [in] del_info Deletion info of DTC list
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available.
+/// - The initialization of diag memory is finished.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The pointer del_info of acquisition setting is NULL [DGCODE_RET_PARA_ERR]
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - The flag of diag registration start is not OK yet(The function of diagcode is not prepared yet).
+/// [DGCODE_RET_ERROR]
+/// - Failure occurs when read data from the backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when write data to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when export data from backup area. [DGCODE_RET_ERROR]
+/// - When the Category ID is invalid [DGCODE_RET_PARA_ERR]
+/// - Register error of own device at all deletion Device physical address is invalid [DGCODE_RET_PARA_ERR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - Delete the list of specified DTC by Category ID.
+/// - Delete SSR information,too.
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_DeleteDTCInfoList(const DGCODE_DELETE_DTC_INFO* const del_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_DeleteRoBInfo
+/// \~english @par Overview
+/// - Set the diagcode detail info and delete the diagcode.
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] rob_id RoB detail info
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - PFDRECThread is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - The param[rob_id] do not match the defination in the diagcode ROM table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the diagcode ROM table is invalid [DGCODE_RET_ERROR]
+/// - If the communication unit ID(division) is other in the diagcode ROM table,
+/// and failure occur when getting unit number. [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Fire and Forget only
+/// \~english @par Details
+/// - For the RoB which has been registered, do the erase procedure due to the fact that the RoB is initialized.
+/// - If diagcode which specified is not registered, return DGCODE_RET_NORMAL.
+/// - Delete SSR information,too.
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_DeleteRoBInfo(const HANDLE hApp, const uint64_t rob_id);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_GetRoBInfoList
+/// \~english @par Overview
+/// - Get the List of specified RoB
+/// \~english @param [in] get_info Get info of RoB list
+/// \~english @param [out] list_info List info of RoB
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - The initialization of diag memory is finished.
+/// - BackupMgr is available
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The pointer get_info of acquisition setting is NULL [DGCODE_RET_PARA_ERR]
+/// - The pointer list_info of storage area is NULL [DGCODE_RET_PARA_ERR]
+/// - Initialization of RoB code management information is fail [DGCODE_RET_ERROR]
+/// - The flag of diag registration start is not OK yet(The function of RoB code is not prepared yet).
+/// [DGCODE_RET_ERROR]
+/// - When the acquisition type is other than "RoB code type definition" [DGCODE_RET_PARA_ERR]
+/// - Common Diagnosis When the RoB code definition Name acquired from the memory
+/// error table do not match the definition of the RoB code ROM Table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the RoB code ROM table is not valid [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - Get the RoB list of conditions specified by get_info.
+/// - Acquisition type must be set to RoB code type definition value.
+/// - Category ID must be set DGCODE_DIV_UNIT__CWORD92_.
+/// - Error registered device physical address is not used, and thus an arbitary value may be set.
+/// - Logic unit number for maker diag must be set DGCODE_MAKER_UNIT_ALL.
+/// - For the RoB code, set the "RoB code" described in the diag code generation tool of the RoB
+/// to be acquired.
+/// - When the RoB code is #DGCODE_GET_ALL_ROB_CODE, the latest RoB is acquired one of the registered RoB
+/// for each RoB define.
+/// - When th RoB code is other than #DGCODE_GET_ALL_ROB_CODE,
+/// the list of RoB matching the RoB code is acquired.
+/// - All DTC that matches above conditions store in list_info(list_info is variable length).
+/// - The maximum number of RoB that can be acquired at a time is 64.
+/// - By setting any value from 0 to 255 as the RoB acquisition start index position,
+/// 64 RoB can be acquired from that position.\n
+/// To acquire from Nth RoB, N-1 should be set.\n
+/// example : If the number of previous acquisitions is 64 and "RoB acquisition start index position" is
+/// set to 64, RoB from 65th to 128th can be acquired.
+/// - When the number of items remaining from RoB acquisition start index position to set
+/// the last registered RoB is less than 64, only the remaining items are acquired.
+/// example : If the case where 100 items of RoB are registered , when 64 is set
+/// as the "RoB acquisition start index position", 36 items from 65th to 100th can be acquired.
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_GetRoBInfoList(const DGCODE_GET_ROB_LIST_INFO* const get_info,
+ DGCODE_ROB_LIST_INFO* const list_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_GetDIDList
+/// \~english @par Overview
+/// - Get DID list which relates DTC/RoB code.
+/// \~english @param [in] code DTC or RoB
+/// \~english @param [out] list structure of DID list
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - None.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Parameter of list is NULL. [\ref DGCODE_RET_PARA_ERR]
+/// - DTC or RoB is associated parameter of code is not exist. [\ref DGCODE_RET_ERROR]
+/// - Initialization of diagcode management information is fail [\ref DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - Return DID list which is associated parameter of DTC or RoB.
+/// \~english @see None
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_GetDIDList(const uint64_t code, DGCODE_DID_LIST* const list);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_DeleteRoBInfoList
+/// \~english @par Overview
+/// - Delete the list of specified RoB.
+/// \~english @param [in] del_info Deletion info of RoB code list
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available.
+/// - The initialization of diag memory is finished.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The pointer del_info of acquisition setting is NULL [DGCODE_RET_PARA_ERR]
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - The flag of diag registration start is not OK yet(The function of diagcode is not prepared yet).
+/// [DGCODE_RET_ERROR]
+/// - Failure occurs when read data from the backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when write data to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when export data from backup area. [DGCODE_RET_ERROR]
+/// - When the Category ID is invalid [DGCODE_RET_PARA_ERR]
+/// - Register error of own device at all deletion Device physical address is invalid [DGCODE_RET_PARA_ERR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - Delete the list of specified RoB by Category ID.
+/// - Delete SSR information,too.
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_DeleteRoBInfoList(const DGCODE_DELETE_ROB_INFO* const del_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_StartupAllStatusOfDTC
+/// \~english @par Overview
+/// - Update all StatusOfDTC for startup of OperationCycle.
+/// \~english @param none
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - DTC ID does not match the defination of DTC ROM table [DGCODE_RET_ERROR]
+/// - Allocation of work memory fails when update the StatusOfDTC. [DGCODE_RET_ERROR]
+/// - Failure occurs when reading data from backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when writing to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when writing to the backup area [DGCODE_RET_ERROR]
+/// - The pointer of DTC inhibit info is NULL [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - This API should be called only by SystemManager.
+/// - Update all StatusOfDTC for startup of OperationCycle.
+/// - This API sets the following bit of StatusOfDTC.\n
+/// bit0:testFailed is set to '0'.\n
+/// bit1:testFailedThisOperationCycle is set to '0'.\n
+/// bit2:pendingDTC is set to '0' only when bit1 and bit6 (before update) are both '0'.\n
+/// bit6:testNotCompletedThisOperationCycle is set to '1'.
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_StartupAllStatusOfDTC(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_ClearAllStatusOfDTC
+/// \~english @par Overview
+/// - Update all StatusOfDTC when receiving ClearDiagnosticInformation.
+/// \~english @param none
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - DTC ID does not match the defination of DTC ROM table [DGCODE_RET_ERROR]
+/// - Allocation of work memory fails when update the StatusOfDTC. [DGCODE_RET_ERROR]
+/// - Failure occurs when reading data from backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when writing to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when writing to the backup area [DGCODE_RET_ERROR]
+/// - The pointer of DTC inhibit info is NULL [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - This API should be called only by DiagService.
+/// - Update all StatusOfDTC for startup of OperationCycle.
+/// - This API sets the following bit of StatusOfDTC.\n
+/// bit0:testFailed is set to '0'.\n
+/// bit1:testFailedThisOperationCycle is set to '0'.\n
+/// bit2:pendingDTC is set to '0'.\n
+/// bit3:confirmedDTC is set to '0'.\n
+/// bit4:testNotCompletedSinceLastClear is set to '1'.\n
+/// bit5:testFailedSinceLastClear is set to '0'.\n
+/// bit6:testNotCompletedThisOperationCycle is set to '1'.
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_ClearAllStatusOfDTC(void);
+
+/// \~english Acquire time counter value
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DGC_TIMESTAMP_GETTIME
+/// \~english @par Overview
+/// - This is a macro definition for extracting the time counter value included in the time counter information.
+/// \~english @param [in] x time counter information
+/// \~english @retval time counter value
+/// \~english @par Precondition
+/// - None.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - None.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - Mask the unique count identification value and return only the time counter value.
+/// \~english @see Diag_SyncTimeStamp
+///
+/////////////////////////////////////////////////////////////////////////////////////
+#define DGC_TIMESTAMP_GETTIME(x) ((x) & (0x00FFFFFFU))
+
+/// \~english Get unique count value
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DGC_TIMESTAMP_GETFLAG
+/// \~english @par Overview
+/// - This is a macro definition for extracting the unique counter identification value included in the time
+/// counter information.
+/// \~english @param [in] x time counter information
+/// \~english @retval unique counter identification value
+/// \~english @par Precondition
+/// - None.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - None.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - Mask the time counter value and return only the unique count identification value.
+/// \~english @see Diag_SyncTimeStamp
+///
+/////////////////////////////////////////////////////////////////////////////////////
+#define DGC_TIMESTAMP_GETFLAG(x) (((x) & (0xE0000000U)) >> (29U))
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of diag_code
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODEAPI_H_
diff --git a/stub/diag_code/library/include/stub/ss_diag.h b/stub/diag_code/library/include/stub/ss_diag.h
new file mode 100755
index 0000000..0ba9b74
--- /dev/null
+++ b/stub/diag_code/library/include/stub/ss_diag.h
@@ -0,0 +1,24 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_SS_DIAG_H_
+#define DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_SS_DIAG_H_
+
+#include <stub/DiagCodeAPI.h>
+
+#define SS_PUTDIAG(hApp, code)
+
+#endif // DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_SS_DIAG_H_
diff --git a/stub/diag_code/library/libDiagCodeAPI.ver b/stub/diag_code/library/libDiagCodeAPI.ver
new file mode 100755
index 0000000..ca53e88
--- /dev/null
+++ b/stub/diag_code/library/libDiagCodeAPI.ver
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# DiagCodeAPILib version script
+#
+{
+ global:
+ ### .text section ###
+ Diag_PutDiagCode;
+ Diag_DeleteDiagCode;
+ Diag_PutDiagCode_Custom;
+ Diag_PutDiagCodeWithSSR_Custom;
+ Diag_DeleteDiagCode_Custom;
+ Diag_DeleteDiagCodeWithSSR_Custom;
+ Diag_CheckExistDiagCode;
+ Diag_GetDiagCodeList;
+ Diag_GetDiagCodeListWithSSR;
+ Diag_DeleteDiagCodeList;
+ Diag_DeleteDiagCodeListWithSSR;
+ Diag_DeleteMakerDiagCodeList;
+ Diag_CheckExistFFData;
+ Diag_GetFFDataList;
+ Diag_DeleteFFDataList;
+
+ Diag_GetServiceCodeNum;
+ Diag_InitDiagCode;
+ Diag_SetDiagCodeMask;
+ Diag_SyncTimeStamp;
+
+ Diag_InhibitPutDiagCode;
+
+ Diag_SubscribeAvailability;
+ Diag_NotifyAvailability;
+ Diag_PutDTCInfo;
+ Diag_PutRoBInfo;
+ Diag_DeleteDTCInfo;
+ Diag_DeleteRoBInfo;
+ Diag_GetDTCInfoList;
+ Diag_GetRoBInfoList;
+ Diag_DeleteDTCInfoList;
+ Diag_DeleteRoBInfoList;
+ Diag_SyncOdometer;
+ Diag_GetDIDList;
+ Diag_StartupAllStatusOfDTC;
+ Diag_ClearAllStatusOfDTC;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/stub/diag_code/library/src/DiagCodeAPI.cpp b/stub/diag_code/library/src/DiagCodeAPI.cpp
new file mode 100755
index 0000000..95d9047
--- /dev/null
+++ b/stub/diag_code/library/src/DiagCodeAPI.cpp
@@ -0,0 +1,202 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <DiagCodeAPI.h>
+
+DGCODE_RET_API Diag_SubscribeAvailability(HANDLE hApp, uint8_t availabilityId) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_NotifyAvailability(uint8_t availabilityId, BOOL bAvailability) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_PutDiagCode(HANDLE hApp, uint64_t err_id, uint16_t diagcode_code) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_DeleteDiagCode(HANDLE hApp, uint64_t err_id, uint16_t diagcode_code) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_PutDiagCode_Custom(HANDLE hApp, DGCODE_MEMINFO_CUSTOM* err_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_PutDTCInfo(const HANDLE hApp, const uint64_t dtc_id, const uint8_t test_result,
+ const DGCODE_DTC_SSR_INFO &ssr_info,
+ const uint16_t spply_code) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_PutRoBInfo(const HANDLE hApp, const uint64_t rob_id, const DGCODE_ROB_SSR_INFO* ssr_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_DeleteDTCInfo(const HANDLE hApp, const uint64_t err_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_DeleteRoBInfo(const HANDLE hApp, const uint64_t rob_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_GetDTCInfoList_CWORD29_(const DGCODE_GET_DTC_LIST_INFO* const get_info,
+ DGCODE_DTC_LIST_INFO* const list_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_GetRoBInfoList(const DGCODE_GET_ROB_LIST_INFO* const get_info,
+ DGCODE_ROB_LIST_INFO* const list_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_DeleteDTCInfoList(const DGCODE_DELETE_DTC_INFO* const del_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_DeleteRoBInfoList(const DGCODE_DELETE_ROB_INFO* const del_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_InitDiagCode(HANDLE hApp, uint8_t start_kind, CbFuncPtr fpOnCmd) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_SetDiagCodeMask(uint8_t onoff) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_SyncTimeStamp(uint32_t time_cnt, uint16_t trip_cnt) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_SyncDcmTime(const DGCODE_SSR_INFO_TIME_INFO * const hour_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_SyncOdometer(const uint32_t mileage, const uint8_t unit) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_InhibitPutDiagCode(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_GetDIDList(const uint64_t code, DGCODE_DID_LIST* const list) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_StartupAllStatusOfDTC(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_ClearAllStatusOfDTC(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
diff --git a/stub/diag_code/library_dummy_dccc/Makefile b/stub/diag_code/library_dummy_dccc/Makefile
new file mode 100755
index 0000000..6e818df
--- /dev/null
+++ b/stub/diag_code/library_dummy_dccc/Makefile
@@ -0,0 +1,46 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_SHLIBS = libDiagApiDccc
+
+######### install headers #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += DIAG_API_DCCC.h
+
+######### compiled sources #############
+libDiagApiDccc_SRCS = src/DIAG_API_DCCC.cpp
+
+######### compile switch #############
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+######### add include path #############
+CPPFLAGS += -I./include/stub
+
+######### dynamic linked library path #############
+
+######## CXX Link ###############
+
+######### compiled options #############
+
+######### common mk #############
+include ../../stub.mk
diff --git a/stub/diag_code/library_dummy_dccc/include/stub/DIAG_API_DCCC.h b/stub/diag_code/library_dummy_dccc/include/stub/DIAG_API_DCCC.h
new file mode 100755
index 0000000..dc92190
--- /dev/null
+++ b/stub/diag_code/library_dummy_dccc/include/stub/DIAG_API_DCCC.h
@@ -0,0 +1,109 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*****************************************************************************
+ * @file DIAG_API_DCCC.h
+ * @brief Diagcode feature API defined
+*****************************************************************************/
+
+
+/*****************************************************************************
+ * *********************************
+ * * Diagcode feature API defined *
+ * *********************************
+ *
+ * ** Creation and release considerations **
+ * -Because DiagCode API depends on product specifications, it is created at the product level.
+ *
+ * -Submit and request the created headers and dummy Lib(empty functions defined only for I/F)
+ * from DiagService to BaseSystem and build them from BaseSystem.
+ *
+ * -The century Lib created(not dummy Lib) is built from DiagService.
+ *
+ * ->Since this API is also used in BaseSystem,
+ * the API must be inserted from the BaseSystem built to avoid errors in JointBuild.
+ *
+ * ** Notes on change **
+ * -When modifying a header without cahnging the I/F,
+ * only the header should be submitted to the BaseSystem and requested.
+ *
+ * -Submit header and source code for dummy Lib when the header is modified due to an I/F change.
+ *
+ * -When the legitimate Lib is changed without changing headers and I/F,
+ * no need to submit or request to BaseSystem.
+ *
+*****************************************************************************/
+
+
+#ifndef DIAG_CODE_LIBRARY_DUMMY_DCCC_INCLUDE_VEHICLE_SERVICE_DIAG_API_DCCC_H_
+#define DIAG_CODE_LIBRARY_DUMMY_DCCC_INCLUDE_VEHICLE_SERVICE_DIAG_API_DCCC_H_
+
+#include <native_service/frameworkunified_framework_if.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#define NTFY_DiagService_Availability_DCCC ("DiagService/Availability")
+
+/***********************************************************
+ Enumerated type
+***********************************************************/
+/*! @brief Return value for DiagCode re-checking and clearing feature APIs */
+typedef enum {
+ RET_DIAG_API_DCCC_NORMAL = 0, //!<Success
+ RET_DIAG_API_DCCC_ERROR //!<Error
+} RET_DIAG_API_DCCC;
+
+/***********************************************************
+ Constant
+***********************************************************/
+// Common
+/*! @brief message ID */
+#define MSGID_DIAG_API_DCCC_DELIVERY_ENTRY (0xFF000001) // Delivery registration notice
+#define MSGID_DIAG_API_DCCC_SND_RECHECK (0xFF000002) // Re-assay instruction
+#define MSGID_DIAG_API_DCCC_RET_RECHECK (0xFF000003) // Re-assay completion notice
+#define MSGID_DIAG_API_DCCC_SND_DIAGCODECLR (0xFF000004) // Diag deletion instruction
+#define MSGID_DIAG_API_DCCC_RET_DIAGCODECLR (0xFF000005) // Daig deletion completion notice
+
+/*! @brief Delivery features */
+#define DIAG_API_DCCC_DELIVERY_RECHECK (0x00000001) // Recheck
+#define DIAG_API_DCCC_DELIVERY_DIAGCODECLR (0x00000002) // Diag delete
+#define DIAG_API_DCCC_DELIVERY_ALL (0xFFFFFFFF) // All function
+
+/*! @brief Result of re-assay execution */
+#define DIAG_API_DCCC_RET_RECHECK_SUCCESS (0x00000000) // Recheck successed
+#define DIAG_API_DCCC_RET_RECHECK_ERROR (0x00000001) // Recheck failed
+
+
+/*! @brief Diag deletion result */
+#define DIAG_API_DCCC_RET_DIAGCODECLR_SUCCESS (0x00000000) // Diag deleion successed
+#define DIAG_API_DCCC_RET_DIAGCODECLR_ERROR (0x00000001) // Diag deleion failed
+
+/***********************************************************
+ API
+***********************************************************/
+extern RET_DIAG_API_DCCC DIAG_API_DCCC_DeliveryEntry(HANDLE hApp, PCSTR notifyName, u_int32_t delivery);
+extern RET_DIAG_API_DCCC DIAG_API_DCCC_SND_ReCheck(HANDLE hApp, PCSTR notifyName);
+extern RET_DIAG_API_DCCC DIAG_API_DCCC_RET_ReCheck(HANDLE hApp, PCSTR notifyName, u_int32_t status);
+extern RET_DIAG_API_DCCC DIAG_API_DCCC_SND_DiagCodeCLR(HANDLE hApp, PCSTR notifyName);
+extern RET_DIAG_API_DCCC DIAG_API_DCCC_RET_DiagCodeCLR(HANDLE hApp, PCSTR notifyName, u_int32_t status);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // DIAG_CODE_LIBRARY_DUMMY_DCCC_INCLUDE_VEHICLE_SERVICE_DIAG_API_DCCC_H_
diff --git a/stub/diag_code/library_dummy_dccc/src/DIAG_API_DCCC.cpp b/stub/diag_code/library_dummy_dccc/src/DIAG_API_DCCC.cpp
new file mode 100755
index 0000000..f1da82b
--- /dev/null
+++ b/stub/diag_code/library_dummy_dccc/src/DIAG_API_DCCC.cpp
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <DIAG_API_DCCC.h>
+
+RET_DIAG_API_DCCC DIAG_API_DCCC_DeliveryEntry(HANDLE hApp, PCSTR notifyName, u_int32_t delivery) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DIAG_API_DCCC_NORMAL;
+}
+
+RET_DIAG_API_DCCC DIAG_API_DCCC_SND_ReCheck(HANDLE hApp, PCSTR notifyName) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DIAG_API_DCCC_NORMAL;
+}
+
+RET_DIAG_API_DCCC DIAG_API_DCCC_RET_ReCheck(HANDLE hApp, PCSTR notifyName, u_int32_t status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DIAG_API_DCCC_NORMAL;
+}
+
+RET_DIAG_API_DCCC DIAG_API_DCCC_SND_DiagCodeCLR(HANDLE hApp, PCSTR notifyName) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DIAG_API_DCCC_NORMAL;
+}
+
+RET_DIAG_API_DCCC DIAG_API_DCCC_RET_DiagCodeCLR(HANDLE hApp, PCSTR notifyName, u_int32_t status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DIAG_API_DCCC_NORMAL;
+}
+
diff --git a/stub/diag_record/LICENSE b/stub/diag_record/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/stub/diag_record/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/stub/diag_record/Makefile b/stub/diag_record/Makefile
new file mode 100755
index 0000000..8b85cd9
--- /dev/null
+++ b/stub/diag_record/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := library_record_api library_dummy_drec library_record_thread
+
+include ../stub.mk
diff --git a/stub/diag_record/library_dummy_drec/Makefile b/stub/diag_record/library_dummy_drec/Makefile
new file mode 100755
index 0000000..e96152c
--- /dev/null
+++ b/stub/diag_record/library_dummy_drec/Makefile
@@ -0,0 +1,48 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_SHLIBS = libMM_DREC_API
+
+######### install headers #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += MM_DREC_API.h
+
+######### compiled sources #############
+libMM_DREC_API_SRCS = src/MM_DREC_API.cpp
+
+######### compile switch #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/stub
+CPPFLAGS += -I./../library_record_api/include
+
+LDFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######## CXX Link ###############
+LINK_SHLIB=Y
+
+######### compiled options #############
+LDFLAGS += -Wl,--no-as-needed
+
+######### common mk #############
+include ../../stub.mk
diff --git a/stub/diag_record/library_dummy_drec/include/stub/MM_DREC_API.h b/stub/diag_record/library_dummy_drec/include/stub/MM_DREC_API.h
new file mode 100755
index 0000000..7d0568c
--- /dev/null
+++ b/stub/diag_record/library_dummy_drec/include/stub/MM_DREC_API.h
@@ -0,0 +1,2203 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/////////////////////////////////////////////////////////////////////////////
+/// \file MM_DREC_API.h
+/////////////////////////////////////////////////////////////////////////////
+
+/*****************************************************************************
+ * @file MM_DREC_API.h
+ * @brief MM diag recorder function API definition
+*****************************************************************************/
+
+
+/*****************************************************************************
+ * ---------------
+ * - Die-Record Function API Operation -
+ * ---------------
+ *
+ * $$ Notes on Creation and Release $$
+ * - Submit and request the created headers and dummy libs (empty functions defined only for I/F)
+ * from DiagService to BaseSystem and build them from BaseSystem.
+ *
+ * - The created regular Lib (not dummy Lib) is built from DiagService.
+ *
+ * -> Since this API is also used in BaseSystem, the API must be inserted
+ * from the BaseSystem build to avoid errors in JointBuild.
+ *
+ * $$ Notes on change $$
+ * - When modifying a header without changing the I/F, submit and request only the header to the BaseSystem.
+ *
+ * - Submit header and source code for dummy Lib when the header is modified due to an I/F change.
+ *
+ * - When the legitimate lib is changed without changing headers and I/F, no need to submit or request to BaseSystem.
+ *
+ *****************************************************************************/
+
+#if !defined( __MM_DREC_API_H__ )
+#define __MM_DREC_API_H__
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <stub/PFDREC_API.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/***********************************************************
+ Macro Functions
+***********************************************************/
+#define ENDIAN16(val) \
+ (((val << 8) & 0xFF00) | ((val >> 8) & 0x00FF)) //!< \~english ENDIAN conversion(16bit)
+
+#define ENDIAN32(val) \
+ ((val << 24) & 0xFF000000) | ((val << 8) & 0x00FF0000) | ((val >> 8) & 0x0000FF00) | ((val >> 24) & 0x000000FF) //!< \~english ENDIAN conversion(32bit)
+
+/***********************************************************
+ Data Frame/Size Definition
+***********************************************************/
+
+/***********************************************************
+ Data Frame Related/Structure (Common)
+***********************************************************/
+/**
+ * \~english ACC OFF information
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_ACC;
+
+/**
+ * \~english GPS time information
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_GPS;
+
+/**
+ * \~english Frame for searching recording stop and start
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_REC;
+
+/**
+ * \~english Common data frame
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_COMMON_DATAFRAME;
+
+/***********************************************************
+ Data Frame/Structure Definition
+***********************************************************/
+
+/**
+ * \~english Power trace data frame
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCPWR;
+
+/**
+ * \~english Power trace data frame_system time attached
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCPWR_WITHSYSTIME;
+
+/**
+ * \~english Mode control/vehicle signal trace (mode control)
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCMODE;
+
+/**
+ * \~english Mode control/vehicle signal trace (vehicle signal)
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCVEHICLESIGNAL;
+
+/**
+ * \~english Key trace
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCKEY;
+
+/**
+ * \~english Key trace (key information for 23byte)
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCKEY_EXP;
+
+/**
+ * \~english Key trace(voice operation)
+ */
+typedef struct _T_DREC_TRCKEY_VOICE {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCKEY_VOICE;
+
+/**
+ * \~english Error trace
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCERR;
+
+/**
+ * \~english CAN communication trace
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCCAN;
+
+/**
+ * \~english AW Trace data (trace output of the own car position difference/ Monitoring trace log output of the distributed application PF/ Usage trace log output of the distributed application PF/ Trace output of DSRC/ETC communication)
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCAWDATA;
+
+/**
+ * \~english Bluetooth trace
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCBTCONNECT;
+
+/**
+ * \~english Bluetooth trace
+ */
+typedef struct _T_DREC_TRCBTINTERNAL {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCBTINTERNAL;
+
+/**
+ * \~english Bluetooth trace
+ */
+typedef struct _T_DREC_TRCBT {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCBT;
+
+/**
+ * \~english SSID information
+ */
+typedef struct _T_DREC_TRCWIFI_SSID_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCWIFI_SSID_INFO;
+
+/**
+ * \~english WiFi trace
+ */
+typedef struct _T_DREC_TRCWIFI {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCWIFI;
+
+/**
+ * \~english Trace data of the version information
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCVERSION;
+
+/**
+ * \~english Trace of the radio wave receipt
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCWAVE;
+
+/**
+ * \~english GPS information
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCGPS;
+
+/**
+ * \~english ETC watch log trace
+ */
+typedef struct _T_DREC_TRCETCWATCH {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCETCWATCH;
+
+/**
+ * \~english ROB log trace
+ */
+typedef struct _T_DREC_TRCROB {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCROB;
+
+/**
+ * \~english Optical beacon down-link information trace
+ */
+typedef struct _T_DREC_TRCOPTBEACON_DOWN_LINK {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCOPTBEACON_DOWN_LINK;
+
+/**
+ * \~english Optical beacon up-link information trace
+ */
+typedef struct _T_DREC_TRCOPTBEACON_UP_LINK {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCOPTBEACON_UP_LINK;
+
+/***********************************************************
+ Enumeration definitions
+***********************************************************/
+
+/**
+ * \~english Diag record API return value
+ */
+typedef enum {
+ RET_DREC_NORMAL = 0, //!< \~english Normal end
+ RET_DREC_ERROR, //!< \~english Abnormal end
+ RET_DREC_ERR_ARGUMENTS, //!< \~english Incorrect argument
+} RET_DREC_API;
+
+/**
+ * \~english Diag record ACC state
+ */
+typedef enum {
+ E_DREC_ACC_OFF = 0, //!< \~english ACC OFF
+ E_DREC_ACC_ON, //!< \~english ACC ON
+} E_DREC_ACC;
+
+/**
+ * \~english Diag recording function state
+ */
+typedef enum {
+ E_DREC_REC_OFF = 0, //!< \~english Recording stop
+ E_DREC_REC_ON //!< \~english Recording start
+} E_DREC_REC;
+
+/**
+ * \~english Maker peculiarity trace output state
+ */
+typedef enum {
+ DREC_OUTPUT_STATE_START = 1, //!< \~english Output start
+ DREC_OUTPUT_STATE_END, //!< \~english Output end
+} DREC_OUTPUT_STATE;
+
+/**
+ * \~english Maker peculiarity trace output result
+ */
+typedef enum {
+ DREC_OUTPUT_NOTIFY_OK = 0, //!< \~english OK
+ DREC_OUTPUT_NOTIFY_NG, //!< \~english NG
+} DREC_OUTPUT_RESULT;
+
+/**
+ * \~english Maker peculiarity trace function state
+ */
+typedef enum {
+ DREC_OUTPUT_FUNC_ON = 0, //!< \~english Function ON
+ DREC_OUTPUT_FUNC_OFF, //!< \~english Function OFF
+} DREC_OUTPUT_FUNC;
+
+/**
+ * \~english Maker peculiarity trace notification restrict
+ */
+typedef enum {
+ DREC_NOTIFY_RESTRICT_API, //!< \~english restrict API
+ DREC_NOTIFY_RESTRICT_CAN, //!< \~english restrict CAN
+ DREC_NOTIFY_RESTRICT_NONE, //!< \~english non-restrict
+} DREC_NOTIFY_RESTRICT;
+
+/***********************************************************
+ Constant
+***********************************************************/
+#define DREC_COM_GPS_ID_CORD 0xF0 //!< \~english GPS time information identification code
+#define DREC_COM_RECORD_STOP 0xF1 //!< \~english Recording stop
+#define DREC_COM_RECORD_START 0xF2 //!< \~english Recording start
+
+/***********************************************************
+ API
+***********************************************************/
+/** @addtogroup ApplicationManagement
+ * @{
+ */
+/** @addtogroup Vehicle
+ * @ingroup ApplicationManagement
+ * @{
+ */
+/** @addtogroup Diag
+ * @ingroup Vehicle
+ * @{
+ */
+/** @addtogroup Diag_DrecOperate
+ * @ingroup Diag
+ * @{
+ */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_ChangeRecording
+/// \~english @par Brief
+/// Instruct the record function start/stop and write the start/stop information.
+/// \~english @param [in] state
+/// \ref E_DREC_REC - Function start/stop state
+/// \~english @par
+/// - Set either in the following "Diag recording function states" for the argument (state) (Function start/stop state)
+/// \~english @code
+/// Diag recording function states
+/// E_DREC_REC_OFF : Recording stop
+/// E_DREC_REC_ON : Recording start
+/// @endcode
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @par Prerequisite
+/// - \ref PFDREC_OpenSession must be called prior to calling this API.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// The log output of Diag Record is output in the following format by calling this API.\n
+/// \n
+/// < Function ON >\n
+/// Record "Recording start information" in each trace data. Notify the function start of the recording function to BaseSystem.\n
+/// Register GPS time information from Diag service by \ref DREC_WriteTrcGPS.\n
+/// \n
+/// < Function OFF >\n
+/// Record "Recording stop information" in each trace data. Notify the function stop of the recording function to BaseSystem.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_ChangeRecording(E_DREC_REC state);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_AccOffOn
+/// \~english @par Brief
+/// Write ACCOFF time information to the memory at ACC OFF.
+/// \~english @param [in] state
+/// \ref E_DREC_ACC - ACCOFFON (reset) state
+/// \~english @par
+/// - Set either in the following "Diag record ACC state" for the argument (state) (ACCOFFON (reset) state)
+/// \~english @code
+/// Diag record ACC state
+/// E_DREC_ACC_OFF : ACC OFF
+/// E_DREC_ACC_ON : ACC ON
+/// @endcode
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Wrapper executes the following processes by calling this API. \n
+/// This API must be called when this Diag service detects FrameworkunifiedOnStop. (Called only by the service having Diag recorder function.) \n
+/// Wrapper writes ACCOFF information in each trace file. \n
+/// Wrapper writes #power OFF state by the power trace output based on the notification from SYS. \n
+/// Wrapper writes GPS time at Function OFF and at ACCOFF (reset) in preparation for a case that GPS time information cannot be acquired at the start up. \n
+/// Wrapper does not reaquire GPS time if valid GPS time cannot be acquired at the startup. \n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_AccOffOn(E_DREC_ACC state);
+/** @}*/ // end of Diag_DrecOperate
+/** @addtogroup Diag_DrecWriteTrc
+ * @ingroup Diag
+ * @{
+ */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcPwr
+/// \~english @par Brief
+/// Write the power trace output information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCPWR* - Pointer to the power trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the power trace output information to the memory.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcPwr(T_DREC_TRCPWR* data, u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcPwr_Tick
+/// \~english @par Brief
+/// Write the power trace output information to the memory (tick specification exists).
+/// \~english @param [in] data
+/// \ref T_DREC_TRCPWR_WITHSYSTIME* - Pointer to the power trace data (with the system time)
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @param [in] tick
+/// u_int32_t - TICK value of the current SYS internal
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the power trace output information to the memory (tick specification exists).
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcPwr_Tick(T_DREC_TRCPWR_WITHSYSTIME* data,
+ u_int32_t num, u_int32_t tick);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcMode
+/// \~english @par Brief
+/// Write the mode control parts of the mode control/vehicle signal trace output information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCMODE* - The pointer to mode management trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the mode control parts of the mode control/vehicle signal trace output information to the memory.\n
+/// The system time is gotten by wrapper library and added.\n
+/// This API adds the vehicle signal state fixed at 0xFF.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcMode(T_DREC_TRCMODE* data, u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcVehicleSignal
+/// \~english @par Brief
+/// Write the vehicle signal parts of the mode control/vehicle signal trace output information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCVEHICLESIGNAL* - Pointer to the vehicle signal trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the vehicle signal parts of the mode control/vehicle signal trace output information to the memory.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcVehicleSignal(T_DREC_TRCVEHICLESIGNAL* data,
+ u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcKey
+/// \~english @par Brief
+/// Write the key trace output information to the memory (for 11byte key information).
+/// \~english @param [in] data
+/// \ref T_DREC_TRCKEY* - The pointer to key trace data (Key information for 11 bytes)
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the key trace output information to the memory (for 11byte key information).\n
+/// (The caller uses only when size of the key information is 11 bytes. For data which it is 27 bytes, the caller uses \ref DREC_WriteTrcKey_Exp .)\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcKey_Exp
+/// \~english @par Brief
+/// Write the key trace output information to the memory (for 23byte key information).
+/// \~english @param [in] data
+/// \ref T_DREC_TRCKEY_EXP* - The pointer to key trace data (Key information for 23 bytes)
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 50)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the key trace output information to the memory (for 23byte key information).\n
+/// (For data which key information is 11 bytes, the caller uses \ref DREC_WriteTrcKey .)\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcKey_Exp(T_DREC_TRCKEY_EXP* data,
+ u_int32_t num);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcKey_Voice
+/// \~english @par Brief
+/// Write the voice trace output information to the memory(for voice operation).
+/// \~english @param[in] data
+/// T_DREC_TRCKEY_VOICE* - The pointer to key trace data()
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @par
+/// Number of written frames (1 to 50)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the voice trace output information to the memory(for voice operation).
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcKey_Voice(T_DREC_TRCKEY_VOICE* data,
+ u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcErr
+/// \~english @par Brief
+/// Write the error trace output information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCERR* - The pointer to error trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DIAG_API_DCCC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the error trace output information to the memory.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcErr(T_DREC_TRCERR* data, u_int32_t num);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcCan
+/// \~english @par Brief
+/// Write CAN communication trace output information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCCAN* - Pointer to CAN communication trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @param [in] tick
+/// u_int32_t - TICK value of the current SYS internal
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DIAG_API_DCCC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write CAN communication trace output information to the memory.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcCan(T_DREC_TRCCAN* data, u_int32_t num,
+ u_int32_t tick);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcDeliveryPFWatchLog
+/// \~english @par Brief
+/// Write the monitoring trace log output information of the distributed application PF to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCAWDATA* - The pointer to monitoring log data of the distribution application PF
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the monitoring trace log output information of the distributed application PF to the memory.\n
+/// The library side adds the system time. The caller must call for each segment of data.\n
+/// The library side adds the system time to the beginning of the data and ALL 0 to from the head of the remaining data to 3 bytes.\n
+/// This API adds the system time to the beginning with a single call and regarding data exceeding one frame, divides and registers it.\n
+/// The caller must not call some headers and data record parts together. (Because system time can not be added for each section.)\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcDeliveryPFWatchLog(T_DREC_TRCAWDATA* data);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcDeliveryPFUseLog
+/// \~english @par Brief
+/// Write the usage trace log output information of the distributed application PF to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCAWDATA* - The pointer to usage log data of the distribution application PF
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the usage trace log output information of the distributed application PF to the memory.\n
+/// The library side adds the system time. The caller must call for each segment of data.\n
+/// The library side adds the system time to the beginning of the data and ALL 0 to from the head of the remaining data to 3 bytes.\n
+/// This API adds the system time to the beginning with a single call and regarding data exceeding one frame, divides and registers it.\n
+/// The caller must not call some headers and data record parts together. (Because system time can not be added for each section.)\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcDeliveryPFUseLog(T_DREC_TRCAWDATA* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcBT
+/// \~english @par Brief
+/// Write the trace output information of Bluetooth to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCBT* - The pointer to write data
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of Bluetooth to the memory.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcBT(T_DREC_TRCBT* data, u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcBTInternal
+/// \~english @par Brief
+/// (Only in the specific Supplier) Write the trace output information of Bluetooth internal to the memory.
+/// \~english @param [in] data
+/// u_int8_t* - The pointer to write data
+/// \~english @param [in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// This API is API for specific supplier.(TECHWG-443)\n
+/// Write the trace output information of Bluetooth internal to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcBTInternal(u_int8_t* data,
+ u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcWiFi
+/// \~english @par Brief
+/// Write the trace output information of WiFi to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCWIFI* - The pointer to write data
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of WiFi to the memory.\n
+/// \ref T_DREC_TRCWIFI Structure\n
+/// Data frame format are different by setting value of WiFi setting state.\n
+/// WiFi Setting state( \ref T_DREC_TRCWIFI.processing )\n
+/// - Connection(0x00), Auto connection(0x01) and Disconnection(0x02) data format definition \ref notinitialdata used.\n
+/// - Creation Mode(0x03) and Deletion Mode((0x04)) data format definition \ref modedata used.\n
+/// - Initial is activation(0x10) format definition \ref initialdata used.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcWiFi(T_DREC_TRCWIFI* data, u_int32_t num);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcWiFiInternal
+/// \~english @par Brief
+/// (Only in the specific Supplier) Write the trace output information of WiFi internal to the memory.
+/// \~english @param [in] data
+/// u_int8_t* - The pointer to write data
+/// \~english @param [in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// This API is API for specific supplier.(TECHWG-443)\n
+/// Write the trace output information of WiFi internal to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcWiFiInternal(u_int8_t* data, u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcCenter
+/// \~english @par Brief
+/// Write the trace output information of the communication with the center to the memory.
+/// \~english @param [in] data
+/// u_int8_t* - The pointer to write data
+/// \~english @param [in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of the communication with the center to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcCenter(u_int8_t* data, u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcVersion
+/// \~english @par Brief
+/// Write the trace output information of the version information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCVERSION* - Pointer to the Trace data of the version information
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 25)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of the version information to the memory.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcVersion(T_DREC_TRCVERSION* data,
+ u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcDCM
+/// \~english @par Brief
+/// Write the trace output information of DCM communication to the memory.
+/// \~english @param [in] data
+/// u_int8_t* - The pointer to write data
+/// \~english @param [in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of DCM communication to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcDCM(u_int8_t* data, u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcDSRC
+/// \~english @par Brief
+/// Write the trace output information of DSRC/ETC communication to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCAWDATA* - The pointer to DSRC/ETC communication trace data
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of DSRC/ETC communication to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcDSRC(T_DREC_TRCAWDATA* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrc_CWORD17_
+/// \~english @par Brief
+/// Write the trace output information of _CWORD5_ communication to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCCAN* - Pointer to the _CWORD5_ communication trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @param [in] tick
+/// u_int32_t - TICK value of the current SYS internal
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of _CWORD5_ communication to the memory.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrc_CWORD17_(T_DREC_TRCCAN* data, u_int32_t num,
+ u_int32_t tick);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcWave
+/// \~english @par Brief
+/// Write the trace output information of the radio wave receipt to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCWAVE* - The pointer to trace data of the electric wave reception
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of the radio wave receipt to the memory.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcWave(T_DREC_TRCWAVE* data, u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcUSB
+/// \~english @par Brief
+/// Write the trace output information of USB I/F connected application internal to the memory.
+/// \~english @param [in] data
+/// u_int8_t* - The pointer to wrire data
+/// \~english @param [in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of USB I/F connected application internal to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcUSB(u_int8_t* data, u_int32_t size);
+
+
+/** @}*/ // end of Diag_DrecWriteTrc
+/** @addtogroup Diag_DrecOperate
+ * @ingroup Diag
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_GetRecordSize
+/// \~english @par Brief
+/// Acquire the number of Diag record registration whose type is specified.
+/// \~english @param [in] type
+/// \ref E_PFDREC_CATEGORY_TYPE - Type to acquire the record size
+/// \~english @param [out] num
+/// u_int32_t * - Pointer to the number of registered records.
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - \ref PFDREC_OpenSession must be called prior to calling this API.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (num) is NULL. [RET_DREC_ERROR]
+/// - The argument (type) is not the defined value. [RET_DREC_ERROR]
+/// - The caller is not calling \ref PFDREC_OpenSession in advance. [RET_DREC_ERROR]
+/// - Message synchronous communication (FrameworkunifiedInvokeSync) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Acquire the number of record registration whose type is specified.\n
+/// In BaseSystem, returns the number of records of the specified type. \n
+/// The caller determines the total size with the number of records and each record length.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_GetRecordSize(E_PFDREC_CATEGORY_TYPE type,
+ u_int32_t *num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_GetRecordData
+/// \~english @par Brief
+/// Acquire the registered Diag record whose type is specified.
+/// \~english @param [in] type
+/// \ref E_PFDREC_CATEGORY_TYPE - Type to acquire the record size (\ref E_PFDREC_CATEGORY_TRC_PWR - ref E_PFDREC_CATEGORY_TRC_TRAF )
+/// \~english @param [in] num
+/// u_int32_t - The number of records to acquire (1 to 100)
+/// \~english @param [in] record_ptr
+/// u_int32_t - The start point of the record to acquire
+/// \~english @param [out] data
+/// u_int8_t *- Pointer to the storage area for the record to acquire
+/// \~english @param [out] out_num
+/// u_int32_t *- Pointer to the size of the stored record
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - \ref PFDREC_OpenSession must be called prior to calling this API.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (data) is NULL [RET_DREC_ERROR]
+/// - The argument (out_num) is NULL [RET_DREC_ERROR]
+/// - The argument (type) is not the defined value [RET_DREC_ERROR]
+/// - The argument (num) is 0 or greater than 100. [RET_DREC_ERROR]
+/// - The caller is not calling \ref PFDREC_OpenSession in advance. [RET_DREC_ERROR]
+/// - Message synchronous communication (FrameworkunifiedInvokeSync) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Acquire the record whose type is specified. \n
+/// In BaseSystem, acquire the records of the specified type and the specified number. In this case, the caller specifies from which number of record is acquired.\n
+/// The caller is supposed to acquire data in order from the beginning in several batches.\n
+/// When the number of record requested to acquire is more than that of registered records, acquire the registered number only and returns it. \n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_GetRecordData(E_PFDREC_CATEGORY_TYPE type,
+ u_int32_t num, u_int32_t record_ptr,
+ u_int8_t *data, u_int32_t *out_num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_GetRecordState
+/// \~english @par Brief
+/// Acquire the start/stop state of the record function.
+/// \~english @param [out] state
+/// \ref E_DREC_REC* - Pointer to the start/stop state of the record function.
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - \ref PFDREC_OpenSession must be called prior to calling this API.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (state) is NULL [RET_DREC_ERROR]
+/// - The caller is not calling \ref PFDREC_OpenSession in advance. [RET_DREC_ERROR]
+/// - Message synchronous communication (FrameworkunifiedInvokeSync) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Acquire the start/stop state of the record function.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_GetRecordState(E_DREC_REC* state);
+/** @}*/ // end of Diag_DrecOperate
+/** @addtogroup Diag_DrecOperate
+ * @ingroup Diag
+ * @{
+ */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_SetSysemTimeDifference
+/// \~english @par Brief
+/// Set the system time difference.
+/// \~english @param [in] data
+/// u_int32_t - System time difference
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Store the system time difference in the shared memory.\n
+/// Reflect the stored value in the addition process of the system time.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_SetSysemTimeDifference(u_int32_t data);
+/** @}*/ // end of Diag_DrecOperate
+/** @addtogroup Diag_DrecWriteTrc
+ * @ingroup Diag
+ * @{
+ */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcGPS
+/// \~english @par Brief
+/// Set GPS time information to each trace data.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCGPS* - Pointer to the GPS information
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Set the GPS time information \n
+/// The target is all trace outputs belonging to the unit in which this API is called. \n
+/// When registering the trace data in BaseSystem, regarding the key trace, GPS information is separately passed as the argument (The second argument of PFDREC_ComDataBuckup).\n
+/// After Function ON, when a valid GPS time can be acquired after ACCON, the Diag service must register it.\n
+/// During Function ON, when a valid GPS time cannot be acquired, retry must be performed until the acquired time is registered.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcGPS(T_DREC_TRCGPS* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcUSBETC
+/// \~english @par Brief
+/// Write USB log information of DSRC/ETC communication trace output into the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCAWDATA* - The pointer to DSRC/ETC communication trace data
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write USB log information of DSRC/ETC communication trace output into the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcUSBETC(T_DREC_TRCAWDATA* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcUplink
+/// \~english @par Brief
+/// Write the uplink log information of DSRC/ETC communication trace output into the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCAWDATA* - The pointer to DSRC/ETC communication trace data
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the uplink log information of DSRC/ETC communication trace output into the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcUplink(T_DREC_TRCAWDATA* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcETCWatch
+/// \~english @par Brief
+/// Write trace output of the ETC watch to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCETCWATCH* - Pointer to the trace data of the ETC watch.
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the monitoring trace output information of the ETC to the memory.\n
+/// \ref T_DREC_TRCETCWATCH structure\n
+/// Data format is different by device type / frame type( \ref T_DREC_TRCETCWATCH.frameType )\n
+/// 0:ETC status notification log \n
+/// 1:ETC latest charge notification log \n
+/// 2:ETC operation response log \n
+/// Use the \ref T_DREC_TRCETCWATCH.command format destination.\n
+/// 3:ETC communication log \n
+/// Use the \ref T_DREC_TRCETCWATCH.com_command format destination.\n
+/// 4:Diag Clear event log \n
+/// 5:Diagnosis detection event log \n
+/// 6:Diagnosis recovery event log \n
+/// Use the \ref T_DREC_TRCETCWATCH.diag format destination.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcETCWatch(T_DREC_TRCETCWATCH* data,
+ u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcRoB
+/// \~english @par Brief
+/// Write the trace output information of RoB log to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCROB* - The pointer to write data
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of RoB log to the memory.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcRoB(T_DREC_TRCROB* data,
+ u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcEvaluation
+/// \~english @par Brief
+/// Write the evaluation trace output information to the memory.
+/// \~english @param[in] data
+/// u_int8_t* - The pointer to write data
+/// \~english @param[in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the evaluation trace output information to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcEvaluation(u_int8_t* data,
+ u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_DeleteTrcDeliveryPFUseLog
+/// \~english @par Brief
+/// Delete the trace of distribution application PF usage log.
+/// \~english @param None
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - \ref PFDREC_OpenSession must be called prior to calling this API.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (func) is NULL [RET_DREC_ERROR]
+/// - The caller is not calling \ref PFDREC_OpenSession in advance. [RET_DREC_ERROR]
+/// - Message synchronous communication (FrameworkunifiedInvokeSync) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Delete the trace of distribution application PF usage log.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_DeleteTrcDeliveryPFUseLog(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_DeleteTrcDeliveryPFUseLog_inSession
+/// \~english @par Brief
+/// Delete the trace of distribution application PF usage log.
+/// - Execute "Session start(\ref PFDREC_OpenSession)" before the deletion.
+/// - Execute "Session termination(\ ref PFDREC_CloseSession)" after the deletion.
+/// \~english @param None
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - \ref PFDREC_OpenSession failed. [RET_DREC_ERROR]
+/// - \ref PFDREC_CloseSession failed. [RET_DREC_ERROR]
+/// - Message synchronous communication (FrameworkunifiedInvokeSync) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Execute "Session starti(\ref PFDREC_OpenSession)" before the deletion.\n
+/// Delete the trace of distribution application PF usage log \n
+/// Execute "Session termination(\ref PFDREC_CloseSession)" after the deletion. \n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_DeleteTrcDeliveryPFUseLog_inSession(HANDLE hThread);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcOptBeaconDownLink
+/// \~english @par Brief
+/// Write Optical beacon down-link information trace to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCOPTBEACON_DOWN_LINK* - Pointer to the trace data of the Optical beacon down-link information.
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the Optical beacon down-link information trace to the memory.\n
+/// \ref T_DREC_TRCOPTBEACON_DOWN_LINK structure\n
+/// Data format is different by rcv type( \ref T_DREC_TRCOPTBEACON_DOWN_LINK.rcvkind )\n
+/// 01h : Route signal information \n
+/// Use the \ref T_DREC_TRCOPTBEACON_DOWN_LINK.downlinkinfo format destination.\n
+/// 02h : Lack route signal information\n
+/// 03h : No route signal information \n
+/// Use the \ref T_DREC_TRCOPTBEACON_DOWN_LINK.rcvgpspositioningdata format destination.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcOptBeaconDownLink(
+ T_DREC_TRCOPTBEACON_DOWN_LINK* data, u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcOptBeaconUpLink
+/// \~english @par Brief
+/// Write Optical beacon up-link information trace to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCOPTBEACON_UP_LINK* - Pointer to the trace data of the Optical beacon up-link information.
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the Optical beacon up-link information trace to the memory.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcOptBeaconUpLink(T_DREC_TRCOPTBEACON_UP_LINK* data,
+ u_int32_t num);
+
+/** @}*/ // end of Diag_DrecWriteTrc
+/** @addtogroup Diag_Drec_MakerTrace
+ * @ingroup Diag
+ * @{
+ */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_DeliveryEntry
+/// \~english @par Brief
+/// Register the delivery destination application for Maker peculiarity trace
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Registers the handle and thread name for the delivery destination application in the delivery registration table.\n
+/// The client must call this API on a thread that needs to receive that are related to the Maker peculiarity trace in advance.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_DeliveryEntry(HANDLE hApp,
+ PCSTR notifyName);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_SizeRequest
+/// \~english @par Brief
+/// Request to get record size of Maker peculiarity trace.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Private
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Request to get record size of Maker peculiarity trace to the registered application for delivery.\n
+/// Message ID sended by DiagService is as follows\n
+/// MSGID_DREC_MAKERTRACE_SIZEREQUEST
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_SizeRequest(HANDLE hApp,
+ PCSTR notifyName);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_SizeResponce
+/// \~english @par Brief
+/// Send record size of Maker peculiarity trace to DiagService.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] size
+/// u_int32_t - Data size (Unit: Byte)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Send record size of Maker peculiarity trace to DiagService.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_SizeResponce(HANDLE hApp,
+ PCSTR notifyName,
+ u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_OutputRequest
+/// \~english @par Brief
+/// Request to output of Maker peculiarity trace.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] output
+/// PCSTR - Output destination
+/// \~english @param[in] state
+/// DREC_OUTPUT_STATE - Status (output start or output stop)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Private
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Request to output of Maker peculiarity trace to the registered application for delivery.\n
+/// Message ID sended by DiagService is as follows\n
+/// MSGID_DREC_MAKERTRACE_OUTPUTREQUEST
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_OutputRequest(HANDLE hApp,
+ PCSTR notifyName,
+ PCSTR output,
+ DREC_OUTPUT_STATE state);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_OutputResponce
+/// \~english @par Brief
+/// Send output status of Maker peculiarity trace to DiagService.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] progress
+/// u_int8_t - Progress rate (0 to 100)
+/// \~english @param[in] state
+/// DREC_OUTPUT_RESULT - Status (OK or NG)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Send output status of Maker peculiarity trace to DiagService.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_OutputResponce(HANDLE hApp,
+ PCSTR notifyName,
+ u_int8_t progress,
+ DREC_OUTPUT_RESULT state);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_DeleteRequest
+/// \~english @par Brief
+/// Request to delete of Maker peculiarity trace.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Private
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Request to delete of Maker peculiarity trace to the registered application for delivery.\n
+/// Message ID sended by DiagService is as follows\n
+/// MSGID_DREC_MAKERTRACE_DELETEREQUEST
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_DeleteRequest(HANDLE hApp,
+ PCSTR notifyName);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_DeleteResponce
+/// \~english @par Brief
+/// Send result of delete Maker peculiarity trace to DiagService.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] state
+/// DREC_OUTPUT_RESULT - Status (OK or NG)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Send result of delete Maker peculiarity trace to DiagService.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_DeleteResponce(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_RESULT state);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_FuncStatusRequest
+/// \~english @par Brief
+/// Request to change function status of Maker peculiarity trace.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] func
+/// DREC_OUTPUT_FUNC - Function status (function ON or ffunction OFF)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Private
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Request to change function status of Maker peculiarity trace to the registered application for delivery.\n
+/// Message ID sended by DiagService is as follows\n
+/// MSGID_DREC_MAKERTRACE_FUNCSTATUSREQUEST
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_FuncStatusRequest(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_FUNC func);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_FuncStatusResponce
+/// \~english @par Brief
+/// Send result of change function status of Maker peculiarity trace to DiagService.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] state
+/// DREC_OUTPUT_RESULT - Status (OK or NG)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Send result of change function status of Maker peculiarity trace to DiagService.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_FuncStatusResponce(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_RESULT state);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_NotifyRestrict
+/// \~english @par Brief
+/// Restrict notify of Maker peculiarity trace
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] notifyRestrict
+/// DREC_NOTIFY_RESTRICT - Restrict kind of Maker peculiarity trace
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Restrict trace notifications triggered by the specified notifyRestrict.
+/// Restrict notification(MessageID) are as follows.
+/// - MSGID_DREC_MAKERTRACE_SIZEREQUEST
+/// - MSGID_DREC_MAKERTRACE_OUTPUTREQUEST
+/// - MSGID_DREC_MAKERTRACE_DELETEREQUEST
+/// - MSGID_DREC_MAKERTRACE_FUNCSTATUSREQUEST
+/// \n
+/// if this API is not called, not restrict(Status is DREC_NOTIFY_RESTRICT_NONE).
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// DREC_MakerTrace_FuncStatusRequest, DREC_MakerTrace_DeleteRequest,
+/// DREC_MakerTrace_OutputRequest, DREC_MakerTrace_SizeRequest
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_NotifyRestrict(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_NOTIFY_RESTRICT notifyRestrict);
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+/** @}*/ // end of Diag_Drec_MakerTrace
+/** @}*/ // end of Diag
+/** @}*/ // end of Vehicle
+/** @}*/ // end of ApplicationManagement
+#endif // __MM_DREC_API_H__
+
diff --git a/stub/diag_record/library_dummy_drec/src/MM_DREC_API.cpp b/stub/diag_record/library_dummy_drec/src/MM_DREC_API.cpp
new file mode 100755
index 0000000..5ecd943
--- /dev/null
+++ b/stub/diag_record/library_dummy_drec/src/MM_DREC_API.cpp
@@ -0,0 +1,450 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "MM_DREC_API.h"
+
+RET_DREC_API DREC_ChangeRecording(E_DREC_REC state) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_AccOffOn(E_DREC_ACC state) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcPwr(T_DREC_TRCPWR* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcPwr_Tick(T_DREC_TRCPWR_WITHSYSTIME* data, u_int32_t num, u_int32_t tick) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcMode(T_DREC_TRCMODE* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcVehicleSignal(T_DREC_TRCVEHICLESIGNAL* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcKey(T_DREC_TRCKEY* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcKey_Exp(T_DREC_TRCKEY_EXP* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcKey_Voice(T_DREC_TRCKEY_VOICE* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcErr(T_DREC_TRCERR* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcCan(T_DREC_TRCCAN* data, u_int32_t num, u_int32_t tick) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcOwnCarPosition(T_DREC_TRCAWDATA* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcDeliveryPFWatchLog(T_DREC_TRCAWDATA* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcDeliveryPFUseLog(T_DREC_TRCAWDATA* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcBT(T_DREC_TRCBT* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcBTInternal(u_int8_t* data, u_int32_t size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcWiFiInternal(u_int8_t* data, u_int32_t size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcWiFi(T_DREC_TRCWIFI* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcCenter(u_int8_t* data, u_int32_t size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcVersion(T_DREC_TRCVERSION* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcDCM(u_int8_t* data, u_int32_t size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcDSRC(T_DREC_TRCAWDATA* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrc_CWORD17_(T_DREC_TRCCAN* data, u_int32_t num, u_int32_t tick) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcWave(T_DREC_TRCWAVE* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcUSB(u_int8_t* data, u_int32_t size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_GetRecordSize(E_PFDREC_CATEGORY_TYPE type, u_int32_t *num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_GetRecordData(E_PFDREC_CATEGORY_TYPE type, u_int32_t num,
+ u_int32_t record_ptr, u_int8_t *data, u_int32_t *out_num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_GetRecordState(E_DREC_REC* state) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_SetSysemTimeDifference(u_int32_t data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcGPS(T_DREC_TRCGPS* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+
+RET_DREC_API DREC_WriteTrcUSBETC(T_DREC_TRCAWDATA* data)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcUplink(T_DREC_TRCAWDATA* data)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcETCWatch(T_DREC_TRCETCWATCH* data, u_int32_t num)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcRoB(T_DREC_TRCROB* data, u_int32_t num)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcEvaluation(u_int8_t* data, u_int32_t size)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_DeleteTrcDeliveryPFUseLog(void)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_DeleteTrcDeliveryPFUseLog_inSession(HANDLE hThread)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcOptBeaconDownLink(T_DREC_TRCOPTBEACON_DOWN_LINK* data, u_int32_t num)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcOptBeaconUpLink(T_DREC_TRCOPTBEACON_UP_LINK* data, u_int32_t num)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_DeliveryEntry(HANDLE hApp,
+ PCSTR notifyName)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_SizeRequest(HANDLE hApp,
+ PCSTR notifyName)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_SizeResponce(HANDLE hApp,
+ PCSTR notifyName,
+ u_int32_t size)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_OutputRequest(HANDLE hApp,
+ PCSTR notifyName,
+ PCSTR output,
+ DREC_OUTPUT_STATE state)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_OutputResponce(HANDLE hApp,
+ PCSTR notifyName,
+ u_int8_t progress,
+ DREC_OUTPUT_RESULT state)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_DeleteRequest(HANDLE hApp,
+ PCSTR notifyName)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_DeleteResponce(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_RESULT state)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_FuncStatusRequest(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_FUNC func)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_FuncStatusResponce(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_RESULT state)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_NotifyRestrict(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_NOTIFY_RESTRICT notifyRestrict)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
diff --git a/stub/diag_record/library_record_api/Makefile b/stub/diag_record/library_record_api/Makefile
new file mode 100755
index 0000000..9efbd4f
--- /dev/null
+++ b/stub/diag_record/library_record_api/Makefile
@@ -0,0 +1,47 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libDiagRecordAPI
+
+######### install headers(*.h) #############
+INST_HEADERS += PFDREC_API.h
+
+######### compiled sources #############
+libDiagRecordAPI_SRCS = DiagRecordAPI.cpp
+
+######### add source path #############
+VPATH += ./include/$(COMPONENT_NAME) ./src
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/stub
+
+######### add compile option #############
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lstdc++
+
+include ../../stub.mk
diff --git a/stub/diag_record/library_record_api/include/stub/PFDREC_API.h b/stub/diag_record/library_record_api/include/stub/PFDREC_API.h
new file mode 100755
index 0000000..b4ad71c
--- /dev/null
+++ b/stub/diag_record/library_record_api/include/stub/PFDREC_API.h
@@ -0,0 +1,975 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file PFDREC_API.h
+ * @brief diag_record API header file
+ */
+/*******************************************************************************
+ * FILE : PFDREC_API.h
+ * SYSTEM : LinuxPF
+ * SUBSYSTEM :
+ * TITLE : Diag record managementfeature include definition
+ ******************************************************************************/
+
+#ifndef DIAG_RECORD_LIBRARY_RECORD_API_INCLUDE_VEHICLE_SERVICE_PFDREC_API_H_
+#define DIAG_RECORD_LIBRARY_RECORD_API_INCLUDE_VEHICLE_SERVICE_PFDREC_API_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup diag_record
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <time.h>
+#include <agl_thread.h>
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english The definition of the processing result value
+ */
+typedef int RET_PFDREC_API;
+
+/**
+ * \~english The definition of the diag_record thread
+ */
+#ifndef TN_PFDRECTHREAD
+#define TN_PFDRECTHREAD "PFDRECThread"
+#endif
+
+/**
+ * \~english The definition of the diag_record thread availability.
+ */
+#define NTFY_PFDRECThread_Availability "PFDRECThread/Availability"
+
+/**
+ * \~english The definition of the processing normal result.
+ */
+#define RET_PFDREC_NORMAL (0)
+/**
+ * \~english The definition of the processing abnormal result.
+ */
+#define RET_PFDREC_ERROR (-1)
+/**
+ * \~english The definition of the invalid arguments result.
+ */
+#define RET_PFDREC_ERR_ARGUMENTS (-2)
+/**
+ * \~english The definition of the stop status result.
+ */
+#define RET_PFDREC_STOP (-3)
+
+/**
+ * \~english The definition of the invalid time information
+ */
+#define PFDREC_TIME_INFO_INVALID (0)
+
+/**
+ * \~english The definition of the invalid unique ID
+ */
+#define PFDREC_UNIQUE_INVALID (0xFFFFFFFFFFFFFFFF)
+
+
+/*! @~english The size of the record frame of PWR */
+#define PFDREC_FRAME_SIZE_TRC_PWR (16)
+/*! @~english The size of the record frame of MODE */
+#define PFDREC_FRAME_SIZE_TRC_MODE (16)
+/*! @~english The size of the record frame of KEY */
+#define PFDREC_FRAME_SIZE_TRC_KEY (16)
+/*! @~english The size of the record frame of ERR */
+#define PFDREC_FRAME_SIZE_TRC_ERR (16)
+/*! @~english The size of the record frame of CAN */
+#define PFDREC_FRAME_SIZE_TRC_CAN (16)
+/*! @~english The size of the record frame of DAPS */
+#define PFDREC_FRAME_SIZE_TRC_DAPS (16)
+/*! @~english The size of the record frame of DAPU */
+#define PFDREC_FRAME_SIZE_TRC_DAPU (16)
+/*! @~english The size of the record frame of BT */
+#define PFDREC_FRAME_SIZE_TRC_BT (16)
+/*! @~english The size of the record frame of BT_INTERNAL */
+#define PFDREC_FRAME_SIZE_TRC_BT_INTERNAL (16)
+/*! @~english The size of the record frame of WIFI */
+#define PFDREC_FRAME_SIZE_TRC_WIFI (16)
+/*! @~english The size of the record frame of WIFI_INTERNAL */
+#define PFDREC_FRAME_SIZE_TRC_WIFI_INTERNAL (16)
+/*! @~english The size of the record frame of CENTER */
+#define PFDREC_FRAME_SIZE_TRC_CENTER (16)
+/*! @~english The size of the record frame of VERSION */
+#define PFDREC_FRAME_SIZE_TRC_VERSION (16)
+/*! @~english The size of the record frame of DCM */
+#define PFDREC_FRAME_SIZE_TRC_DCM (16)
+/*! @~english The size of the record frame of ETC */
+#define PFDREC_FRAME_SIZE_TRC_ETC (16)
+
+/*! @~english The size of the record frame of USB_ETC */
+#define PFDREC_FRAME_SIZE_TRC_USB_ETC (16)
+/*! @~english The size of the record frame of DSRC_UPLINK */
+#define PFDREC_FRAME_SIZE_TRC_DSRC_UPLINK (16)
+
+/*! @~english The size of the record frame of _CWORD119_ */
+#define PFDREC_FRAME_SIZE_TRC__CWORD119_ (16)
+/*! @~english The size of the record frame of RADIO */
+#define PFDREC_FRAME_SIZE_TRC_RADIO (16)
+/*! @~english The size of the record frame of USB_UNIT */
+#define PFDREC_FRAME_SIZE_TRC_USB_UNIT (16)
+/*! @~english The size of the record frame of USB_API */
+#define PFDREC_FRAME_SIZE_TRC_USB_API (16)
+/*! @~english The size of the record frame of ETH */
+#define PFDREC_FRAME_SIZE_TRC_ETH (16)
+/*! @~english The size of the record frame of ETC_WATCH */
+#define PFDREC_FRAME_SIZE_TRC_ETC_WATCH (16)
+/*! @~english The size of the record frame of ROB */
+#define PFDREC_FRAME_SIZE_TRC_ROB (16)
+/*! @~english The size of the record frame of EVAL */
+#define PFDREC_FRAME_SIZE_TRC_EVAL (16)
+/*! @~english The size of the record frame of OPT_BEACON_DOWN */
+#define PFDREC_FRAME_SIZE_TRC_OPT_BEACON_DOWN (16)
+/*! @~english The size of the record frame of OPT_BEACON_UP */
+#define PFDREC_FRAME_SIZE_TRC_OPT_BEACON_UP (16)
+
+/**
+ * \~english The definition of the callback function.
+ */
+typedef void (*PFDREC_CALLBACK_FUNC)(RET_PFDREC_API result);
+
+/**
+ * \~english The definition of the record function status
+ */
+typedef enum _E_PFDREC_FUNC {
+ /*! @~english The record function is ON */
+ E_PFDREC_FUNC_ON = 0,
+ /*! @~english The record function is OFF */
+ E_PFDREC_FUNC_OFF
+}E_PFDREC_FUNC;
+
+/**
+ * \~english The definition of the category
+ */
+typedef enum _E_PFDREC_CATEGORY_TYPE {
+ /*! @~english The defination of PWR trace*/
+ E_PFDREC_CATEGORY_TRC_PWR = 0,
+ /*! @~english The defination of MODE trace */
+ E_PFDREC_CATEGORY_TRC_MODE,
+ /*! @~english The defination of KEY trace */
+ E_PFDREC_CATEGORY_TRC_KEY,
+ /*! @~english The defination of ERR trace */
+ E_PFDREC_CATEGORY_TRC_ERR,
+ /*! @~english The defination of CAN trace */
+ E_PFDREC_CATEGORY_TRC_CAN,
+ /*! @~english The defination of DAPS trace */
+ E_PFDREC_CATEGORY_TRC_DAPS,
+ /*! @~english The defination of DAPU trace */
+ E_PFDREC_CATEGORY_TRC_DAPU,
+ /*! @~english The defination of BT trace */
+ E_PFDREC_CATEGORY_TRC_BT,
+ /*! @~english The defination of BT_INTERNAL trace */
+ E_PFDREC_CATEGORY_TRC_BT_INTERNAL,
+ /*! @~english The defination of WIFI trace */
+ E_PFDREC_CATEGORY_TRC_WIFI,
+ /*! @~english The defination of WIFI_INTERNAL trace */
+ E_PFDREC_CATEGORY_TRC_WIFI_INTERNAL,
+ /*! @~english The defination of CENTER trace */
+ E_PFDREC_CATEGORY_TRC_CENTER,
+ /*! @~english The defination of VERSION trace */
+ E_PFDREC_CATEGORY_TRC_VERSION,
+ /*! @~english The defination of DCM trace */
+ E_PFDREC_CATEGORY_TRC_DCM,
+ /*! @~english The defination of ETC trace */
+ E_PFDREC_CATEGORY_TRC_ETC,
+
+ /*! @~english The defination of USB_ETC trace */
+ E_PFDREC_CATEGORY_TRC_USB_ETC,
+ /*! @~english The defination of DSRC_UPLINK trace */
+ E_PFDREC_CATEGORY_TRC_DSRC_UPLINK,
+
+ /*! @~english The defination of _CWORD119_ trace */
+ E_PFDREC_CATEGORY_TRC__CWORD119_,
+ /*! @~english The defination of RADIO trace */
+ E_PFDREC_CATEGORY_TRC_RADIO,
+ /*! @~english The defination of USB_UNIT trace */
+ E_PFDREC_CATEGORY_TRC_USB_UNIT,
+ /*! @~english The defination of USB_API trace */
+ E_PFDREC_CATEGORY_TRC_USB_API,
+ /*! @~english The defination of ETH trace*/
+ E_PFDREC_CATEGORY_TRC_ETH,
+ /*! @~english The defination of ETC_WATCH trace */
+ E_PFDREC_CATEGORY_TRC_ETC_WATCH,
+ /*! @~english The defination of ROB trace */
+ E_PFDREC_CATEGORY_TRC_ROB,
+ /*! @~english The defination of EVAL trace */
+ E_PFDREC_CATEGORY_TRC_EVAL,
+ /*! @~english The defination of OPT_BEACON_DOWN trace */
+ E_PFDREC_CATEGORY_TRC_OPT_BEACON_DOWN,
+ /*! @~english The defination of OPT_BEACON_UP trace */
+ E_PFDREC_CATEGORY_TRC_OPT_BEACON_UP,
+
+ /*! @~english The defination of max value */
+ E_PFDREC_CATEGORY_TRC_MAX
+}E_PFDREC_CATEGORY_TYPE;
+
+/**
+ * \~english The definition of the trace data extraction mode
+ */
+typedef enum _E_PFDREC_EXTRACT_MODE {
+ /*! @~english The extraction mode is OFF */
+ E_PFDREC_EXTRACT_MODE_OFF = 0,
+ /*! @~english The extraction mode is ON */
+ E_PFDREC_EXTRACT_MODE_ON
+}E_PFDREC_EXTRACT_MODE;
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_FuncStartStop
+/// \~english @par Summary
+/// - Switch the ON/OFF status of the record function
+/// \~english @param [in] status The ON/OFF status of the record function\n
+/// Set the one of the following values.\n
+/// E_PFDREC_FUNC_ON(The record function is ON)\n
+/// E_PFDREC_FUNC_OFF(The record function is OFF)\n
+/// See E_PFDREC_FUNC.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available.
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument ON/OFF status is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to transmit synchronous message to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When MM Diag Recorder failed to switch the function ON/OFF status. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Start or stop the transmission of record.
+/// - When the function is OFF, no data is executed even if the data recording API is called,
+/// and RET_PFDREC_NORMAL is returned.
+/// - Record the ON/OFF information into the backup memory.
+/// - Restore the retained value to the default E_PFDREC_FUNC_ON at +B OFF / factory shipment.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_FuncStartStop(E_PFDREC_FUNC status);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_DeleteData
+/// \~english @par Summary
+/// - Delete the recorded data.
+/// \~english @param [in] func callback function\n
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument callback function is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the session with the MM Diag Recorder has not been established yet. [RET_PFDREC_ERROR]
+/// - When the callback function of deletion end was already setted. [RET_PFDREC_ERROR]
+/// - When failed to regist the callback information to the dispatcher. [RET_PFDREC_ERROR]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to transmit asynchronous message to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - To delete the data recorded in the temporary buffer and nonvolatile memory.
+/// - The callback function specified by argument will be called when data deletion end.
+/// - typedef void (*DERC_CALLBACK_FUNC)( RET_PFDREC_API result);\n
+/// The deletion result is stored in the argument result when the callback function is called.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Method
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedSendMsg
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_DeleteData(PFDREC_CALLBACK_FUNC func);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_DeleteIndividual
+/// \~english @par Summary
+/// - Delete the individual recorded data.
+/// \~english @param [in] category The category information of the trace data to record\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When the argument category is invalid in MM Diag recorder management information table. [RET_PFDREC_ERROR]
+/// - When the MM Diag Recorder failed to allocate memory for writting the recorded data. [RET_PFDREC_ERROR]
+/// - When failed to write the initialization date to ROM. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - To delete the individual data recorded in the temporary buffer and nonvolatile memory.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_DeleteIndividual(E_PFDREC_CATEGORY_TYPE category);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_ComDataBackup
+/// \~english @par Summary
+/// - Record the trace data.
+/// \~english @param [in] category The category information of the trace data to record\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] time_info The time information.
+/// \~english @param [in] frame_num The number of frames of the trace data to record.
+/// \~english @param [in] data The trace data to record\n
+/// The size of the data buffer is the number of frames * 1 frame size,\n
+/// and should be secured by the caller.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument frame_num is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument frame_num exceeds the upper limit value (100). [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When failed to get the message queue handle for transmission to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// - When failed to the transmit asynchronous message. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Record the trace data into the buffer temporarily, and when the size of data in buffer reaches the maximum,
+/// move the data to ROM firstly.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Fire and Forget
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedSendMsg
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_ComDataBackup(E_PFDREC_CATEGORY_TYPE category,
+ time_t time_info,
+ uint32_t frame_num,
+ uint8_t* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_ReadMemData
+/// \~english @par Summary
+/// - Read memory data.
+/// \~english @param [in] category The category information of the trace data to read\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] offset The start position of the frame to read\n
+/// The offset is 0, which means the earliest recorded data.
+/// \~english @param [in] read_num The number of the frames to read.
+/// \~english @param [out] data The readed trace data\n
+/// The size of the data buffer is the number of frames * 1 frame size,\n
+/// and should be secured by the caller.
+/// \~english @param [out] out_num The number of readed trace data.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - The argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - The argument read_num is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument read_num is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument read_num exceeds the upper limit value (100). [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0 [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message. [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When the argument category is invalid in the record management information table of MM Diag recorder.
+/// [RET_PFDREC_ERROR]
+/// - When the MM Diag Recorder failed to allocate memory for reading out the recorded data. [RET_PFDREC_ERROR]
+/// - When the MM Diag Recorder failed in the process of reading the recorded data. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed from the diagnosis service and the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - Read the number of recorded data from the position specified by offset.
+/// - When the end of the recorded data is reached, stop reading and return the number of readed data.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_ReadMemData(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t offset,
+ uint32_t read_num,
+ uint8_t* data,
+ uint32_t* out_num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_GetDataInfo
+/// \~english @par Summary
+/// - Get the information of the recorded data.
+/// \~english @param [in] category The category information\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [out] frame_num The number of the recorded frames.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument frame_num is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message. [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When the argument category is invalid in the record management information table of MM Diag recorder.
+/// [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed from the diagnosis service and the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - Return the number of frames recorded in the record data area of the specified category.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_GetDataInfo(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t* frame_num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_GetFuncStartStop
+/// \~english @par Summary
+/// - Get the ON/OFF status of the record function.
+/// \~english @param [out] status The ON/OFF status of the record function\n
+/// Set the one of the following values.\n
+/// E_PFDREC_FUNC_ON(The record function is ON)\n
+/// E_PFDREC_FUNC_OFF(The record function is OFF)\n
+/// See E_PFDREC_FUNC.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument ON/OFF status is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to transmit synchronous message to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_GetFuncStartStop(E_PFDREC_FUNC* status);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_OutputData
+/// \~english @par Summary
+/// - Move the recorded data to ROM.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When MM Diag Recorder failed to move the recorded data to ROM. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Move the data recorded in the temporary buffer to the ROM.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_OutputData(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_ReadData
+/// \~english @par Summary
+/// - Read the recorded data from the specified position.
+/// \~english @param [in] category The category information of the trace data to read\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] unique_id The unique ID of the frame to start reading\n
+/// If the unique_id is invalid, return error and do not read.
+/// \~english @param [in] read_num The number of frames to read.
+/// \~english @param [out] data The readed data.\n
+/// The size of the data buffer is the number of frames * 1 frame size,\n
+/// and should be secured by the caller.
+/// \~english @param [out] out_num The number of the readed frames.
+/// \~english @param [out] end_unique_id The unique ID of the end of the readed data.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument out_num is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument end_unique_id is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument unique_id is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument read_num is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument read_num exceeds the upper limit value (100). [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0 [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When the MM Diag Recorder failed in the process of reading the recorded data. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed from the diagnosis service and the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - When the end of the recorded data is reached, stop reading and return the number of readed data.
+/// - Read the number of recorded data from the position specified by unique ID.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_ReadData(E_PFDREC_CATEGORY_TYPE category,
+ uint64_t unique_id,
+ uint32_t read_num,
+ uint8_t* data,
+ uint32_t* out_num,
+ uint64_t* end_unique_id);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_SearchData
+/// \~english @par Summary
+/// - Search the recorded data by the specified time information.
+/// \~english @param [in] category The information of category\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] time_info The time information is used to search in recorded data.\n
+/// If the time information is invalid, to return error and do not search.
+/// \~english @param [out] unique_id The unique ID
+/// \~english @param [out] data The result obtained by searching for the time information.\n
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument unique_id is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When setting search time information is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to trasmite the synchronization message. [RET_PFDREC_ERROR]
+/// - When the length of synchronous communication received is different from the already set length.
+/// [RET_PFDREC_ERROR]
+/// - When the argument category is invalid in MM Diag recorder management information table. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed from the diagnosis service and the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - When the end of the recorded data is reached, stop reading and return the number of readed data.
+/// - If the recorded time information is invalid, to skip searching.\n
+/// Also, to make sure that the input argument time_info(note) is available for searching.\n
+/// (note)"1"(from 1970/1/1/0:00.01) or more.
+/// - The frame data more than the specified time could not be found, or \n
+/// If time_info is invalid, RET_PFDREC_ERROR will be returned.
+/// - For the categories which can be searched by time, see the searchable trace.
+/// - If the specified category is not searchable, RET_PFDREC_ERROR will be returned.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_SearchData(E_PFDREC_CATEGORY_TYPE category,
+ time_t time_info,
+ uint64_t* unique_id,
+ uint8_t* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_OpenSession
+/// \~english @par Summary
+/// - Establish a session with the MM Diag Recorder.
+/// \~english @param [in] h_app The application handle
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument h_app is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - If the message queue handle for transmission is not NULL\n
+/// (when the PFDREC_OpenSession has already been called) [RET_PFDREC_ERROR]
+/// - When failed to generate a message queue handle for transmission. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Establish a session with the MM Diag Recorder.
+/// - The API should be called before calling the following APIs of the MM Diag Record function.\n
+/// PFDREC_FuncStartStop\n
+/// PFDREC_DeleteData\n
+/// PFDREC_ReadMemData\n
+/// PFDREC_GetDataInfo\n
+/// PFDREC_GetFuncStartStop\n
+/// PFDREC_OutputData\n
+/// PFDREC_ReadData\n
+/// PFDREC_SearchData\n
+/// PFDREC_SetExtractionMode\n
+/// PFDREC_SetExtractionMode_Exp\n
+/// PFDREC_SearchDataY2K38\n
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_FuncStartStop, PFDREC_DeleteData, PFDREC_ReadMemData, PFDREC_GetDataInfo, \n
+/// PFDREC_GetFuncStartStop, PFDREC_OutputData, PFDREC_ReadData, PFDREC_SearchData, \n
+/// PFDREC_SetExtractionMode, PFDREC_SetExtractionMode_Exp, PFDREC_SearchDataY2K38, \n
+/// PFDREC_CloseSession, FrameworkunifiedMcOpenSender
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_OpenSession(HANDLE h_app);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_CloseSession
+/// \~english @par Summary
+/// - Release the session with the MM Diag Recorder.
+/// \~english @param [in] h_app The application handle
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - When the session with MM Diag Recorder becomes unnecessary.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument h_app is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to close the message queue transmission handle. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Release the session with the MM Diag Recorder.
+/// - To call the API When the session with MM Diag Recorder becomes unnecessary.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedMcClose
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_CloseSession(HANDLE h_app);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_OverwriteData
+/// \~english @par Summary
+/// - Overwrite and record the data of one frame to the specified offset.
+/// \~english @param [in] category The category information\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] offset The position to overwrite the frame data.\n
+/// The offset is 0, which means the earliest recorded data.
+/// \~english @param [in] data The frame data to be overwrite.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - Whe argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When failed to get the message queue handle for transmission to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// - When failed to the transmit asynchronous message. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Overwrite and record the data of one frame to the specified offset.
+/// - When the frame data specified by offset is not exist, RET_PFDREC_ERROR will be returned.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Fire and Forget
+/// \~english @see McOpenSender, McSend
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_OverwriteData(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t offset,
+ uint8_t* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_SetExtractionMode
+/// \~english @par Summary
+/// - Switch the trace data extraction mode.
+/// \~english @param [in] category The category information\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] mode The information of the trace data extraction mode.\n
+/// See E_PFDREC_EXTRACT_MODE.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument mode is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When MM Diag Recorder failed to switch the trace data extraction mode. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Switch the trace data extraction mode.
+/// - Save the trace data to the extraction area during the extraction mode is ON.\n
+/// - When the size of the recorded extraction data reaches the maximum,\n
+/// to discard the next data.
+/// - And when the extraction mode switched from ON to OFF, write the data to the temporary buffer are.
+/// - For the categories which the trace data extraction mode is effective,\n
+/// See 3.4.1.2.8 The switchable trace in trace data extraction mode.
+/// - If you specify something other than a valid category, RET_PFDREC_ERROR will be returned.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_SetExtractionMode(const E_PFDREC_CATEGORY_TYPE category,
+ const E_PFDREC_EXTRACT_MODE mode);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_SetExtractionMode_Exp
+/// \~english @par Summary
+/// - Switch the trace data extraction mode.(The AppDataReporting service, which is a supplier-specific service)
+/// \~english @param [in] category The category information\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] mode The information of the trace data extraction mode.\n
+/// See E_PFDREC_EXTRACT_MODE.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument mode is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When MM Diag Recorder failed to switch the trace data extraction mode. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - Switch the trace data extraction mode.
+/// - Save the trace data to the extraction area during the extraction mode is ON.\n
+/// - When the size of the recorded extraction data reaches the maximum,\n
+/// to discard the next data.
+/// - And when the extraction mode switched from ON to OFF, write the data to the temporary buffer are.
+/// - For the categories which the trace data extraction mode is effective,\n
+/// See 3.4.1.2.8 The switchable trace in trace data extraction mode.
+/// - If you specify something other than a valid category, RET_PFDREC_ERROR will be returned.
+/// - If the data recorded is deleted from the diagnosis service, the request data recorded may not be obtained\n
+/// from the AppDataReporting service, which is a supplier-specific service.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_SetExtractionMode_Exp(const E_PFDREC_CATEGORY_TYPE category,
+ const E_PFDREC_EXTRACT_MODE mode);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_ComDataBackupY2K38
+/// \~english @par Summary
+/// - Record the trace data.
+/// \~english @param [in] category The category information of the trace data to record\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] time_info The time information.
+/// \~english @param [in] frame_num The number of frames of the trace data to record.
+/// \~english @param [in] data The trace data to record\n
+/// The size of the data buffer is the number of frames * 1 frame size,\n
+/// and should be secured by the caller.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument frame_num is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument frame_num exceeds the upper limit value (100). [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When failed to get the message queue handle for transmission to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// - When failed to the transmit asynchronous message. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - The API is used to fix the problem of time beyond 2038, and the function is the same as the
+/// PFDREC_ComDataBackup function
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Fire and Forget
+/// \~english @see PFDREC_OpenSession, McOpenSender, McSend
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_ComDataBackupY2K38(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t time_info,
+ uint32_t frame_num,
+ uint8_t* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_SearchDataY2K38
+/// \~english @par Summary
+/// - Search the recorded data by the specified time information
+/// \~english @param [in] category The information of category\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] time_info The time information is used to search in recorded data.\n
+/// If the time information is invalid, to return error and do not search.
+/// \~english @param [out] unique_id The unique ID
+/// \~english @param [out] data The result obtained by searching for the time information.\n
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument unique_id is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When setting search time information is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to trasmite the synchronization message. [RET_PFDREC_ERROR]
+/// - When the length of synchronous communication received is different from the already set length.
+/// [RET_PFDREC_ERROR]
+/// - When the argument category is invalid in MM Diag recorder management information table. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed from the diagnosis service and the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - The API is used to fix the problem that the time more than 2038, \n
+/// and the function is same as the PFDREC_SearchData function.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_SearchDataY2K38(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t time_info,
+ uint64_t* unique_id,
+ uint8_t* data);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of diag_record
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // DIAG_RECORD_LIBRARY_RECORD_API_INCLUDE_VEHICLE_SERVICE_PFDREC_API_H_
diff --git a/stub/diag_record/library_record_api/libDiagRecordAPI.ver b/stub/diag_record/library_record_api/libDiagRecordAPI.ver
new file mode 100755
index 0000000..6ce89fc
--- /dev/null
+++ b/stub/diag_record/library_record_api/libDiagRecordAPI.ver
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# DiagRecordAPILib version script
+#
+{
+ global:
+ ### .text section ###
+ PFDREC_FuncStartStop;
+ PFDREC_DeleteData;
+
+ PFDREC_DeleteIndividual;
+ PFDREC_ComDataBackup;
+ PFDREC_ReadMemData;
+ PFDREC_GetDataInfo;
+ PFDREC_GetFuncStartStop;
+ PFDREC_OutputData;
+ PFDREC_ReadData;
+ PFDREC_SearchData;
+ PFDREC_OpenSession;
+ PFDREC_CloseSession;
+ PFDREC_OverwriteData;
+ PFDREC_SetExtractionMode;
+ PFDREC_ComDataBackupY2K38;
+ PFDREC_SearchDataY2K38;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/stub/diag_record/library_record_api/src/DiagRecordAPI.cpp b/stub/diag_record/library_record_api/src/DiagRecordAPI.cpp
new file mode 100755
index 0000000..b2c5363
--- /dev/null
+++ b/stub/diag_record/library_record_api/src/DiagRecordAPI.cpp
@@ -0,0 +1,178 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "PFDREC_API.h"
+
+RET_PFDREC_API PFDREC_FuncStartStop(E_PFDREC_FUNC status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_DeleteData(PFDREC_CALLBACK_FUNC func) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_DeleteIndividual(E_PFDREC_CATEGORY_TYPE category) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_ComDataBackup(E_PFDREC_CATEGORY_TYPE category,
+ time_t time_info,
+ uint32_t frame_num,
+ uint8_t* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_ReadMemData(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t offset,
+ uint32_t read_num,
+ uint8_t* data,
+ uint32_t* out_num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_GetDataInfo(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t* frame_num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_GetFuncStartStop(E_PFDREC_FUNC* status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_OutputData(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_ReadData(E_PFDREC_CATEGORY_TYPE category,
+ uint64_t unique_id,
+ uint32_t read_num,
+ uint8_t* data,
+ uint32_t* out_num,
+ uint64_t* end_unique_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_SearchData(E_PFDREC_CATEGORY_TYPE category,
+ time_t time_info,
+ uint64_t* unique_id,
+ uint8_t* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+RET_PFDREC_API PFDREC_OpenSession(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_CloseSession(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_OverwriteData(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t offset,
+ uint8_t* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_SetExtractionMode(const E_PFDREC_CATEGORY_TYPE category,
+ const E_PFDREC_EXTRACT_MODE mode) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_SetExtractionMode_Exp(const E_PFDREC_CATEGORY_TYPE category,
+ const E_PFDREC_EXTRACT_MODE mode) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_ComDataBackupY2K38(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t time_info,
+ uint32_t frame_num,
+ uint8_t* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_SearchDataY2K38(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t time_info,
+ uint64_t* unique_id,
+ uint8_t* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
diff --git a/stub/diag_record/library_record_thread/Makefile b/stub/diag_record/library_record_thread/Makefile
new file mode 100755
index 0000000..350cd90
--- /dev/null
+++ b/stub/diag_record/library_record_thread/Makefile
@@ -0,0 +1,47 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed library(*.a) #############
+INST_LIBS = libPFDRECThread
+
+######### install headers(*.h) #############
+INST_HEADERS += pfdrec_thread_ifc.h
+
+######### compiled sources #############
+libPFDRECThread_SRCS += pfdrec_thread.cpp
+
+######### add source path #############
+VPATH += ./src ./include/$(COMPONENT_NAME)
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/stub
+CPPFLAGS += -I./../library_record_api/include
+
+######### add compile option #############
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lstdc++
+
+include ../../stub.mk
diff --git a/stub/diag_record/library_record_thread/include/stub/pfdrec_thread_ifc.h b/stub/diag_record/library_record_thread/include/stub/pfdrec_thread_ifc.h
new file mode 100755
index 0000000..9592939
--- /dev/null
+++ b/stub/diag_record/library_record_thread/include/stub/pfdrec_thread_ifc.h
@@ -0,0 +1,168 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef DIAG_RECORD_LIBRARY_RECORD_THREAD_INCLUDE_VEHICLE_SERVICE_PFDREC_THREAD_IFC_H_
+#define DIAG_RECORD_LIBRARY_RECORD_THREAD_INCLUDE_VEHICLE_SERVICE_PFDREC_THREAD_IFC_H_
+
+/**
+ * @file pfdrec_thread_ifc.h
+ * @brief diag_record thread header file
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup diag_record
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * @class CPFDRECThread
+ * \~english @brief diag_record thread
+ * \~english @par Brief Introduction
+ * Class to provide the trace data record function
+ *
+ */
+class CPFDRECThread {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CPFDRECThread
+ /// \~english @par Summary
+ /// Constructor of CPFDRECThread class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a CPFDRECThread class. \n
+ /// Member variables initialize. \n
+ /// After the constructor, be sure to call Initialize method.
+ /// \~english @see ~CPFDRECThread, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ CPFDRECThread();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CPFDRECThread
+ /// \~english @par Summary
+ /// Destructor of CPFDRECThread class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a CPFDRECThread class.
+ /// \~english @see CPFDRECThread
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CPFDRECThread();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Initialize
+ /// \~english @par Summary
+ /// - Initialize diag_record thread.
+ /// \~english @param [in] h_app The application handle
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusFail Failure
+ /// \~english @par Precondition
+ /// - BackupMgr is available.
+ /// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+ /// \~english @par Changes in internal status
+ /// - There is no changes in internal status when the API is called.
+ /// \~english @par Conditions of processing failure
+ /// - When fail to create TN_PFDRECTHREAD. [eFrameworkunifiedStatusFail]
+ /// \~english @par Details
+ /// - The API is assumed to be executed only from the SS_LoggerService.
+ /// - Initialize diag_record thread.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync
+ /// \~english @see FrameworkunifiedCreateChildThread, FrameworkunifiedStartChildThread
+ /////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Initialize(HANDLE h_app);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Finalize
+ /// \~english @par Summary
+ /// - Finalize diag_record thread.
+ /// \~english @param [in] h_app The application handle
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @par Precondition
+ /// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+ /// - The diag_record thread is running.
+ /// \~english @par Changes in internal status
+ /// - There is no changes in internal status when the API is called.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Details
+ /// - The API is assumed to be executed only from the SS_LoggerService.
+ /// - Finalize diag_record thread.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync
+ /// \~english @see FrameworkunifiedStopChildThread
+ /////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Finalize(HANDLE h_app);
+
+ private:
+ EFrameworkunifiedStatus Start(HANDLE h_thread);
+ EFrameworkunifiedStatus Stop(HANDLE h_thread);
+
+ EFrameworkunifiedStatus SetFuncOnOff(HANDLE h_thread);
+ EFrameworkunifiedStatus GetFuncOnOff(HANDLE h_thread);
+ EFrameworkunifiedStatus DeleteData(HANDLE h_thread);
+
+ EFrameworkunifiedStatus DeleteIndividual(HANDLE f_hThread);
+ EFrameworkunifiedStatus ComDataBackup(HANDLE h_thread);
+ EFrameworkunifiedStatus ReadMemData(HANDLE h_thread);
+ EFrameworkunifiedStatus GetDataInfo(HANDLE h_thread);
+ EFrameworkunifiedStatus OutputData(HANDLE h_thread);
+ EFrameworkunifiedStatus ReadData(HANDLE h_thread);
+ EFrameworkunifiedStatus SearchData(HANDLE h_thread);
+ EFrameworkunifiedStatus OverwriteData(HANDLE h_thread);
+ EFrameworkunifiedStatus SetExtractMode(HANDLE h_thread);
+
+ HANDLE m_thread;
+};
+
+/** @}*/ // end of diag_record
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // DIAG_RECORD_LIBRARY_RECORD_THREAD_INCLUDE_VEHICLE_SERVICE_PFDREC_THREAD_IFC_H_
diff --git a/stub/diag_record/library_record_thread/src/pfdrec_thread.cpp b/stub/diag_record/library_record_thread/src/pfdrec_thread.cpp
new file mode 100755
index 0000000..164fcfb
--- /dev/null
+++ b/stub/diag_record/library_record_thread/src/pfdrec_thread.cpp
@@ -0,0 +1,162 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "pfdrec_thread_ifc.h"
+
+CPFDRECThread::CPFDRECThread()
+: m_thread(NULL) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+}
+
+CPFDRECThread::~CPFDRECThread() {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+}
+
+EFrameworkunifiedStatus CPFDRECThread::Initialize(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+
+EFrameworkunifiedStatus CPFDRECThread::Finalize(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+
+EFrameworkunifiedStatus CPFDRECThread::Start(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::Stop(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::SetFuncOnOff(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::GetFuncOnOff(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::DeleteData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::DeleteIndividual(HANDLE hThread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+
+EFrameworkunifiedStatus CPFDRECThread::ComDataBackup(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::ReadMemData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::GetDataInfo(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::OutputData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::ReadData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::SearchData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::OverwriteData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::SetExtractMode(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/stub/memory_gpio_access_library/LICENSE b/stub/memory_gpio_access_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/stub/memory_gpio_access_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/stub/memory_gpio_access_library/Makefile b/stub/memory_gpio_access_library/Makefile
new file mode 100755
index 0000000..f30423a
--- /dev/null
+++ b/stub/memory_gpio_access_library/Makefile
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+SUBDIRS := client
+
+include ../stub.mk
diff --git a/stub/memory_gpio_access_library/client/Makefile b/stub/memory_gpio_access_library/client/Makefile
new file mode 100755
index 0000000..202fce9
--- /dev/null
+++ b/stub/memory_gpio_access_library/client/Makefile
@@ -0,0 +1,44 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS += libextension
+
+######### install headers(*.h) #############
+INST_HEADERS += el_gpio.h el_mem.h
+
+######### compiled sources #############
+libextension_SRCS += el_gpio.c el_mem.c
+
+######### add source path #############
+VPATH += src
+VPATH += include/stub
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/$(COMPONENT_NAME)
+
+######### add compile option #############
+CPPFLAGS += -std=c++11
+
+######### linked library #############
+
+######### linked library (dynamic) #############
+
+######### add library path #############
+
+
+include ../../stub.mk
diff --git a/stub/memory_gpio_access_library/client/include/stub/el_gpio.h b/stub/memory_gpio_access_library/client/include/stub/el_gpio.h
new file mode 100755
index 0000000..a9d5639
--- /dev/null
+++ b/stub/memory_gpio_access_library/client/include/stub/el_gpio.h
@@ -0,0 +1,802 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file el_gpio.h
+ * @brief el_gpio function header file
+ */
+
+#ifndef MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_GPIO_H_
+#define MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_GPIO_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup memory_gpio_access_library
+ * @ingroup native_service
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stdbool.h>
+
+/**
+ * \~english Definitions of the GPIO Control Symbol
+ */
+enum {
+ EL_GPO_SUB_RST_N = 0 ,
+ EL_GPO_NAVI_DET,
+ EL_GPI_ILG_RST_N,
+ EL_GPI_GPS_INT,
+ EL_GPO_GPS_P_OFF,
+ EL_GPO_CP_RST_N,
+ EL_GPO_TP_RST_N,
+ EL_GPI_SEC_ST1,
+ EL_GPI_SEC_ST0,
+ EL_GPO__CWORD52__RST,
+ EL_GPI__CWORD32__INT,
+ EL_GPO__CWORD32__RST,
+ EL_GPO_XM_RST,
+ EL_GPO_NFC_RST,
+ EL_GPO_USB1_PWEN,
+ EL_GPI_USB1_OVC,
+ EL_GPO__CWORD52__VUP,
+ EL_GPO_WL_EN,
+ EL_GPO_BT_EN,
+ EL_GPO_AVB_RST_N,
+ EL_GPO_SEC_RST_N,
+ EL_SPI_NAVI_REQ,
+ EL_SPI_NAVI_RDY,
+ EL_GPI_USB0_QVC,
+ EL_GPO_USB0_PWE,
+ EL_GPO_GVIFTX1_RST_N,
+ EL_GPO_GVIFTX0_RST_N,
+ EL_GPO_EMMC_ON_N,
+ EL_SPI_GVIF_D_UCS,
+ EL_GPO__CWORD65__RST_N,
+ EL_GPO_GVIFRX_RST_N,
+ EL_GPI_IOEX_INT,
+ EL_GPO_FBRQ,
+ EL_GPO_IOEX_RST_N,
+ EL_GPI_GVIFTX1_GPIO3,
+ EL_GPI_DARC_INT,
+ EL_GPI_GVIFTX0_GPIO3,
+ EL_GPI_GVIF_REQ_INT,
+ EL_GPI_ACC_DET_OUT,
+ EL_GPI_GVIFRX_GPIO3,
+ EL_GPO_DTCP_RST_N,
+ EL_NAVI_NMI_N,
+ EL_GPI_SDPCHK,
+ EL_GPO_XM_SHDN,
+ EL_GPI_GVIF_D_REQ_INT,
+ EL_SPI_GVIF_D_DCS,
+ EL_GPO_EMMC_PU_ON,
+ EL_GPIO_GVIFRX_GPIO0,
+ EL_GPI_GVIFRX_GPIO2,
+ EL_GPI_GVIFRX_LOS,
+ EL_GPIO_GVIFTX0_GPIO0,
+ EL_GPI_GVIFTX0_GPIO2,
+ EL_GPIO_GVIFTX1_GPIO0,
+ EL_GPI_GVIFTX1_GPIO2,
+ EL_GPO_USBHUB_RST,
+ EL_GPI__CWORD65__BOOT_ERR,
+ EL_GPO_CKECNT,
+ EL_GPO_SDPCLR,
+ EL_GPO_SENSOR_RST,
+ EL_GPI_SENSOR_INT,
+ EL_GPO_DAC_MUTE,
+ EL_GPO_DSRC_PON,
+ EL_GPI_2PULSE_REV,
+ EL_GPI_ILL_DET,
+ EL_GPI_DAB_DET,
+ EL_GPI_FAN_DET,
+
+ EL_GPO_SOC_DIAG_OUT,
+ EL_GPI_SOC_DIAG_IN,
+
+ EL_GPIO_SYMBOL_MAX,
+};
+
+/**
+ * \~english Rising level trigger
+ */
+#define EL_GPIO_IRQ_TRIGGER_RISING (0x01)
+
+/**
+ * \~english Falling level trigger
+ */
+#define EL_GPIO_IRQ_TRIGGER_FALLING (0x02)
+
+/**
+ * \~english High level trigger
+ */
+#define EL_GPIO_IRQ_TRIGGER_HIGH (0x04)
+
+/**
+ * \~english Low level trigger
+ */
+#define EL_GPIO_IRQ_TRIGGER_LOW (0x08)
+
+/**
+ * \~english Trigger mask
+ */
+#define EL_GPIO_IRQ_TRIGGER_MASK (EL_GPIO_IRQ_TRIGGER_RISING | \
+ EL_GPIO_IRQ_TRIGGER_FALLING | \
+ EL_GPIO_IRQ_TRIGGER_HIGH | \
+ EL_GPIO_IRQ_TRIGGER_LOW)
+
+/**
+ * \~english None timeout
+ */
+#define EL_GPIO_IRQ_NO_TIMEOUT (-1)
+
+/**\ingroup EL_Gpio_write
+* \~english @par Brief
+* Write data to specified GPIO.
+* \~english @param [in] symbol
+* int - symbol(Definitions of the GPIO Control Symbol)
+* \~english @param [in] value
+* bool - setting value(0 or 1)
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @retval 0 Success
+* \~english @retval -1 Error:Set errno according to error type when error occurs.
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - There is authority to access the specified GPIO, writing data is possiable only\n
+* when GPIO port is an output port.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_read
+*/
+int EL_Gpio_write(int symbol , bool value); // NOLINT[readability/naming]
+
+/** \ingroup EL_Gpio_read
+* \~english @par Brief
+* Read data from specified GPIO.
+* \~english @param [in] symbol
+* int - symbol(Definitions of the GPIO Control Symbol)
+* \~english @param [out] value
+* bool * - setting value
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @retval 0 Success
+* \~english @retval -1 Error:Set errno according to error type when error occurs.
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - Reading data is possiable when there is authority to access the specified GPIO.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_write
+*/
+int EL_Gpio_read(int symbol , bool *value); // NOLINT[readability/naming]
+
+/** \ingroup EL_Gpio_attachInterruptControl
+* \~english @par Brief
+* Register interruption control of specified GPIO.
+* \~english @param [in] symbol
+* int - symbol(Definitions of the GPIO Control Symbol)
+* \~english @param [in] irq_flags
+* unsigned long - Interruption control flag of GPIO.
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @par
+* Interruption control flag of GPIO
+* - EL_GPIO_IRQ_TRIGGER_RISING :Rising level trigger
+* - EL_GPIO_IRQ_TRIGGER_FALLING :Falling level trigger
+* - EL_GPIO_IRQ_TRIGGER_HIGH :High level trigger
+* - EL_GPIO_IRQ_TRIGGER_LOW :Low level trigger
+* \~english @retval 0 Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Flag specified by irq_flags is not defined flag. [-1]
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - Register interruption control of specified GPIO.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_detachInterruptControl
+*/
+int EL_Gpio_attachInterruptControl(int symbol , unsigned long irq_flags); // NOLINT [readability/nolint]
+
+/** \ingroup EL_Gpio_detachInterruptControl
+* \~english @par Brief
+* Detach interruption control of specified GPIO.
+* \~english @param [in] symbol
+* int - symbol(Definitions of the GPIO Control Symbol)
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @retval 0 Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - Detach interruption control of specified GPIO.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_attachInterruptControl
+*/
+int EL_Gpio_detachInterruptControl(int symbol); // NOLINT[readability/naming]
+
+/** \ingroup EL_Gpio_waitInterrupt
+* \~english @par Brief
+* Waiting interruption of specified GPIO occured without timeout.
+* \~english @param [in] symbol
+* int - symbol(Definitions of the GPIO Control Symbol)
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @retval 0 Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - Interruption of specified GPIO was registered by \ref EL_Gpio_attachInterruptControl.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - Waiting interruption of specified GPIO occured without timeout.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_waitInterrupt_timeout
+*/
+int EL_Gpio_waitInterrupt(int symbol); // NOLINT[readability/naming]
+
+/** \ingroup EL_Gpio_waitInterrupt_timeout
+* \~english @par Brief
+* Waiting interruption of specified GPIO with timeout.
+* \~english @param [in] symbol
+* int - Symbol(Definitions of the GPIO Control Symbol)
+* \~english @param [in] timeout
+* int - Timeout of time(unit: jiffies)
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @retval 0 Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - Interruption of specified GPIO was registered by \ref EL_Gpio_attachInterruptControl .
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - Waiting interruption of specified GPIO with timeout.
+* - If the value of timeout is not greater than 0, timeout will not happened.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see none
+*/
+int EL_Gpio_waitInterrupt_timeout(int symbol, int timeout); // NOLINT[readability/naming]
+
+/** \ingroup EL_Gpio_finalize
+* \~english @par Brief
+* End processing.
+* \~english @retval 0 Return 0
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - none
+* \~english @par Detail
+* - Change IO-Expander device to reset status.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_write, EL_Gpio_read
+*/
+int EL_Gpio_finalize(void); // NOLINT[readability/naming]
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+/** @}*/ // end of memory_gpio_access_library
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+#endif // MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_GPIO_H_
diff --git a/stub/memory_gpio_access_library/client/include/stub/el_mem.h b/stub/memory_gpio_access_library/client/include/stub/el_mem.h
new file mode 100755
index 0000000..b6f6855
--- /dev/null
+++ b/stub/memory_gpio_access_library/client/include/stub/el_mem.h
@@ -0,0 +1,396 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file el_mem.h
+ * @brief el_mem function header file
+ */
+
+#ifndef MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_MEM_H_
+#define MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_MEM_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup memory_gpio_access_library
+ * @ingroup native_service
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stdbool.h>
+#include <sys/types.h>
+
+/**
+* \~english Definitions of the Parametar of type
+*/
+enum {
+ EL_MEM_TYPE_REGION_SYS, //!< \~english SYS region
+ EL_MEM_TYPE_REGION_LOG, //!< \~english LOG region
+ EL_MEM_TYPE_REGION_COM, //!< \~english COMMUNICATION region
+ EL_MEM_TYPE_REGION_NAVI, //!< \~english NAVI region
+ EL_MEM_TYPE_REGION_SH4A, //!< \~english SH4A region
+ EL_MEM_TYPE_REGION_PRAMFS, //!< \~english PRAMFS region
+ EL_MEM_TYPE_REGION_STARTUPBGM, //!< \~english STARTUPBGM region
+ EL_MEM_TYPE_REGION_NAVI_IR, //!< \~english NAVI picture recognition region
+ EL_MEM_TYPE_REGION_MAX //!< \~english (internal use)
+};
+
+/**
+* \~english Definitions of the Parametar of memory id
+*/
+enum {
+ // SYS region
+ EL_MEM_ID_SYS_ALL = 0x0001, //!< \~english all SYS region
+ EL_MEM_ID_SYS_BOOT, //!< \~english particular: BOOT region
+
+ // LOG region
+ EL_MEM_ID_LOG_ALL = 0x1001, //!< \~english all LOG region
+
+ // COM region
+ EL_MEM_ID_COM_ALL = 0x2001, //!< \~english all COMMUNICATION region
+ EL_MEM_ID_COM_SH4A, //!< \~english particular: SH4A abnornal observation
+
+ // NAVI region
+ EL_MEM_ID_NAVI_ALL = 0x3001, //!< \~english NAVI region
+ EL_MEM_ID_NAVI_LOG, //!< \~english particular: NAVI(AW) LOG region
+
+ // SH4A region
+ EL_MEM_ID_SH4A_ALL = 0x4001, //!< \~english SH4A region
+ EL_MEM_ID_SH4A_SHM, //!< \~english particular: SH4A SH share memory region
+
+ // PRAMFS region NOTE:Can be used only when ROM operation
+ EL_MEM_ID_PRAMFS_ALL = 0x5001, //!< \~english all PRAMFS region
+
+ // STARTUPBGM region
+ EL_MEM_ID_STARTUPBGM_ALL = 0x6001, //!< \~english all STARTUPBGM region
+
+ // NAVI region (Picture Recognition: For Image Recognition)
+ EL_MEM_ID_NAVI_IR_ALL = 0x7001, //!< \~english all NAVI picture recognition region
+};
+
+/**
+ * \~english Valid cache_flag
+ */
+#define EL_MEM_CACHE_VALID 1
+
+/**
+ * \~english Invalid cache_flag
+ */
+#define EL_MEM_CACHE_INVALID 0
+
+/**\ingroup EL_mem_getOffset
+* \~english @par Brief
+* Get offset of function region according to mem_id.
+* \~english @param [in] mem_id
+* int - memory id
+* \~english @par
+* Defined memory id as follows.
+* \~english @code
+* enum {
+* // SYS
+* EL_MEM_ID_SYS_ALL = 0x0001, // all SYS region
+* EL_MEM_ID_SYS_BOOT, // particular: BOOT region
+* // COM
+* EL_MEM_ID_COM_ALL = 0x2001, // all COMMUNICATION region
+* EL_MEM_ID_COM_SH4A, // particular: SH4A abnornal observation
+* // NAVI
+* EL_MEM_ID_NAVI_ALL = 0x3001, // NAVI region
+* EL_MEM_ID_NAVI_LOG, // particular: NAVI(AW) LOG region
+* // SH4A
+* EL_MEM_ID_SH4A_ALL = 0x4001, // SH4A region
+* EL_MEM_ID_SH4A_SHM, // particular: SH4A SH share memory region
+* // PRAMFS NOTE:ROM only
+* EL_MEM_ID_PRAMFS_ALL = 0x5001, // all PRAMFS region
+* // STARTUPBGM
+* EL_MEM_ID_STARTUPBGM_ALL = 0x6001, // all STARTUPBGM region
+* // NAVI (Image Recognition)
+* EL_MEM_ID_NAVI_IR_ALL = 0x7001, // all NAVI picture recognition region
+* };
+* @endcode
+* \~english @retval offset Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Parameter mem_id is not defined.[-1]
+* \~english @par Detail
+* - Get offset of function region according to mem_id.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see none
+*/
+off_t EL_mem_getOffset(int mem_id); // NOLINT [readability/naming]
+
+/**\ingroup EL_mem_getLength
+* \~english @par Brief
+* Get length of function region according to mem_id.
+* \~english @param [in] mem_id
+* int - memory id
+* \~english @par
+* Defined memory id as follows.
+* \~english @code
+* enum {
+* // SYS
+* EL_MEM_ID_SYS_ALL = 0x0001, // all SYS region
+* EL_MEM_ID_SYS_BOOT, // particular: BOOT region
+* // COM
+* EL_MEM_ID_COM_ALL = 0x2001, // all COMMUNICATION region
+* EL_MEM_ID_COM_SH4A, // particular: SH4A abnornal observation
+* // NAVI
+* EL_MEM_ID_NAVI_ALL = 0x3001, // NAVI region
+* EL_MEM_ID_NAVI_LOG, // particular: NAVI(AW) LOG region
+* // SH4A
+* EL_MEM_ID_SH4A_ALL = 0x4001, // SH4A region
+* EL_MEM_ID_SH4A_SHM, // particular: SH4A SH share memory region
+* // PRAMFS NOTE:ROM only
+* EL_MEM_ID_PRAMFS_ALL = 0x5001, // all PRAMFS region
+* // STARTUPBGM
+* EL_MEM_ID_STARTUPBGM_ALL = 0x6001, // all STARTUPBGM region
+* // NAVI (Image Recognition)
+* EL_MEM_ID_NAVI_IR_ALL = 0x7001, // all NAVI picture recognition region
+* };
+* @endcode
+* \~english @retval length Success
+* \~english @retval 0 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Parameter mem_id is not defined.[0]
+* - syscall error(open(), ioctl()).[0]
+* \~english @par Detail
+* - Get length of function region according to mem_id.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see none
+*/
+size_t EL_mem_getLength(int mem_id); // NOLINT [readability/naming]
+
+/**\ingroup EL_mem_exram_mmap_simple
+* \~english @par Brief
+* Map device file to memory.(simple)
+* \~english @param [in] mem_id
+* int - memory id
+* \~english @param [in] prot
+* int - Linux standard (same to mmap() of /dev/mem)
+* \~english @param [in] flags
+* int - Linux standard (same to mmap() of /dev/mem)
+* \~english @param [in] cache_flag
+* int - cache flag valid/invalid
+* \~english @par
+* Defined memory id as follows.
+* \~english @code
+* enum {
+* // SYS
+* EL_MEM_ID_SYS_ALL = 0x0001, // all SYS region
+* EL_MEM_ID_SYS_BOOT, // particular: BOOT region
+* // COM
+* EL_MEM_ID_COM_ALL = 0x2001, // all COMMUNICATION region
+* EL_MEM_ID_COM_SH4A, // particular: SH4A abnornal observation
+* // NAVI
+* EL_MEM_ID_NAVI_ALL = 0x3001, // NAVI region
+* EL_MEM_ID_NAVI_LOG, // particular: NAVI(AW) LOG region
+* // SH4A
+* EL_MEM_ID_SH4A_ALL = 0x4001, // SH4A region
+* EL_MEM_ID_SH4A_SHM, // particular: SH4A SH share memory region
+* // PRAMFS NOTE:ROM only
+* EL_MEM_ID_PRAMFS_ALL = 0x5001, // all PRAMFS region
+* // STARTUPBGM
+* EL_MEM_ID_STARTUPBGM_ALL = 0x6001, // all STARTUPBGM region
+* // NAVI (Image Recognition)
+* EL_MEM_ID_NAVI_IR_ALL = 0x7001, // all NAVI picture recognition region
+* };
+* @endcode
+* \~english @par
+* Cache flag as follows.
+* \~english @code
+* #define EL_MEM_CACHE_VALID 1 // valid cache
+* #define EL_MEM_CACHE_INVALID 0 // invalid cache
+* @endcode
+* \~english @retval address Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Parameter mem_id is not defined.[-1]
+* - Open device file failed.[-1]
+* - Map device file to memory error.[-1]
+* \~english @par Detail
+* - Get type, offset and length from internal table specified by mem_id, then\n
+* call \ref EL_mem_exram_mmap.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_mem_getLength, EL_mem_exram_mmap, EL_mem_exram_munmap
+*/
+void *EL_mem_exram_mmap_simple(int mem_id , int prot, int flags , int cache_flag); // NOLINT [readability/naming]
+
+/**\ingroup EL_mem_exram_mmap
+* \~english @par Brief
+* Map device file to memory.
+* \~english @param [in] type
+* int - memory type
+* \~english @param [in] offset
+* off_t - offset(From 0\ref EL_mem_getOffset)
+* \~english @param [in] length
+* size_t - length(From 1\ref EL_mem_getLength)
+* \~english @param [in] prot
+* int - Linux standard (same to mmap() of /dev/mem)
+* \~english @param [in] flags
+* int - Linux standard (same to mmap() of /dev/mem)
+* \~english @param [in] cache_flag
+* int - cache flag valid/invalid
+* \~english @par
+* Defined memory type as follows.
+* \~english @code
+* enum {
+* EL_MEM_TYPE_REGION_SYS, // SYS
+* EL_MEM_TYPE_REGION_COM, // COMMUNICATION
+* EL_MEM_TYPE_REGION_NAVI, // NAVI
+* EL_MEM_TYPE_REGION_SH4A, // SH4A
+* EL_MEM_TYPE_REGION_PRAMFS, // PRAMFS
+* EL_MEM_TYPE_REGION_STARTUPBGM, // STARTUPBGM
+* EL_MEM_TYPE_REGION_NAVI_IR, // NAVI IMAGE
+* };
+* @endcode
+* \~english @par
+* Cache flag as follows.
+* \~english @code
+* #define EL_MEM_CACHE_VALID 1 // valid cache
+* #define EL_MEM_CACHE_INVALID 0 // invalid cache
+* @endcode
+* \~english @retval address Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Open device file failed.[-1]
+* - Map device file to memory error.[-1]
+* \~english @par Detail
+* - Access device file specified by memory type, map function region to user space.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_mem_exram_munmap
+*/
+void *EL_mem_exram_mmap(int type, off_t offset , size_t length , int prot, int flags , int cache_flag); // NOLINT [readability/naming]
+
+/**\ingroup EL_mem_exram_munmap
+* \~english @par Brief
+* Unmap device file from memory.
+* \~english @param [in] addr
+* void * - address
+* \~english @param [in] length
+* size_t - size (1 ~ \ref EL_mem_getLength)
+* \~english @retval 0 Success
+* \~english @retval -1 Error:Set errno according to error type when error occurs.
+* \~english @par Prerequisite
+* - Map device file to memory(\ref EL_mem_exram_mmap,
+* \ref EL_mem_exram_mmap_simple).
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Unmap device file from memory error.[-1]
+* \~english @par Detail
+* - Unmap specified address.Error occurs when refer to this memory after unmap.
+* - Automatic unmap when process ends.
+* - The memory will not be unmap even the file descriptor is closed.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_mem_exram_mmap, EL_mem_exram_mmap_simple
+*/
+int EL_mem_exram_munmap(void *addr, size_t length); // NOLINT [readability/naming]
+
+/**\ingroup EL_mem_getPhysicalAddress
+* \~english @par Brief
+* Get physical address.
+* \~english @param [in] mem_id
+* int - memory id
+* \~english @par
+* Defined memory id as follows.
+* \~english @code
+* enum {
+* // SYS
+* EL_MEM_ID_SYS_ALL = 0x0001, // all SYS region
+* EL_MEM_ID_SYS_BOOT, // particular: BOOT region
+* // COM
+* EL_MEM_ID_COM_ALL = 0x2001, // all COMMUNICATION region
+* EL_MEM_ID_COM_SH4A, // particular: SH4A abnornal observation
+* // NAVI
+* EL_MEM_ID_NAVI_ALL = 0x3001, // NAVI region
+* EL_MEM_ID_NAVI_LOG, // particular: NAVI(AW) LOG region
+* // SH4A
+* EL_MEM_ID_SH4A_ALL = 0x4001, // SH4A region
+* EL_MEM_ID_SH4A_SHM, // particular: SH4A SH share memory region
+* // PRAMFS NOTE:ROM only
+* EL_MEM_ID_PRAMFS_ALL = 0x5001, // all PRAMFS region
+* // STARTUPBGM
+* EL_MEM_ID_STARTUPBGM_ALL = 0x6001, // all STARTUPBGM region
+* // NAVI (Image Recognition)
+* EL_MEM_ID_NAVI_IR_ALL = 0x7001, // all NAVI picture recognition region
+* };
+* @endcode
+* \~english @retval physical address Success
+* \~english @retval 0 Error: Failed to open device file or get physical address(ioctl)
+* \~english @retval -1 Error: Parameter mem_id is not defined.
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Parameter mem_id is not defined.[-1]
+* - Get physical address error.[0]
+* \~english @par Detail
+* - Get physical address from dummy-memory driver according to device file specified by mem_id.
+* - Return the sum value of physical address and offset specified by mem_id.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see none
+*/
+u_int64_t EL_mem_getPhysicalAddress(int mem_id); // NOLINT [readability/naming]
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+/** @}*/ // end of memory_gpio_access_library
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+#endif // MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_MEM_H_
diff --git a/stub/memory_gpio_access_library/client/src/el_gpio.c b/stub/memory_gpio_access_library/client/src/el_gpio.c
new file mode 100755
index 0000000..c6f76ca
--- /dev/null
+++ b/stub/memory_gpio_access_library/client/src/el_gpio.c
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "stub/el_gpio.h"
+
+int EL_Gpio_write(int symbol , bool value) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_read(int symbol , bool *value) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_attachInterruptControl(int symbol , unsigned long irq_flags) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_detachInterruptControl(int symbol) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_waitInterrupt(int symbol) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_waitInterrupt_timeout(int symbol, int timeout) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_finalize(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
diff --git a/stub/memory_gpio_access_library/client/src/el_mem.c b/stub/memory_gpio_access_library/client/src/el_mem.c
new file mode 100755
index 0000000..0b1e2f9
--- /dev/null
+++ b/stub/memory_gpio_access_library/client/src/el_mem.c
@@ -0,0 +1,73 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "stub/el_mem.h"
+
+off_t EL_mem_getOffset(int mem_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+size_t EL_mem_getLength(int mem_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 1;
+}
+
+int dummy[1] = {0}; /* dummy area for mmap() */
+
+void *EL_mem_exram_mmap(int type, off_t offset , size_t length , int prot, int flags , int cache_flag) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return ((void *)dummy);
+}
+
+void *EL_mem_exram_mmap_simple(int mem_id , int prot, int flags , int cache_flag) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return ((void *)dummy);
+}
+
+int EL_mem_exram_munmap(void *addr, size_t length) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+u_int64_t EL_mem_getPhysicalAddress(int mem_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
diff --git a/stub/stub.mk b/stub/stub.mk
new file mode 100755
index 0000000..44fb1e3
--- /dev/null
+++ b/stub/stub.mk
@@ -0,0 +1,42 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := stub
+
+#############################################################
+
+
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
+
diff --git a/stub/vehicle/LICENSE b/stub/vehicle/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/stub/vehicle/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/stub/vehicle/Makefile b/stub/vehicle/Makefile
new file mode 100755
index 0000000..3fb575e
--- /dev/null
+++ b/stub/vehicle/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../stub.mk
diff --git a/stub/vehicle/client/Makefile b/stub/vehicle/client/Makefile
new file mode 100755
index 0000000..f9e6b09
--- /dev/null
+++ b/stub/vehicle/client/Makefile
@@ -0,0 +1,60 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libVehicle_API
+
+
+######### installed static library(*.a) #############
+INST_LIBS = libVehicle_API
+
+
+######### install headers(*.h) #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS = Vehicle_API.h vehicle_notifications.h Vehicle_Sensor_Common_API.h
+
+######### compiled sources #############
+libVehicle_API_SRCS = Vehicle_API.cpp
+
+######### add source path #############
+VPATH += ./src
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/stub
+
+######### add compile option #############
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+#### FOR DEBUG OPTIONS
+
+######### add library path #############
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+include ../../stub.mk
diff --git a/stub/vehicle/client/include/stub/Vehicle_API.h b/stub/vehicle/client/include/stub/Vehicle_API.h
new file mode 100755
index 0000000..43fd066
--- /dev/null
+++ b/stub/vehicle/client/include/stub/Vehicle_API.h
@@ -0,0 +1,298 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_API_H_
+#define VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_API_H_
+/**
+ * @file Vehicle_API.h
+ * @brief vehicle api header file
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/******************************************************************************
+ * Fine name :Vehicle_API.h
+ * System name :GPF
+ * Subsystem name :Vehicle I/F library
+ ******************************************************************************/
+#include <peripheral_service/Canif_API.h>
+#include <stub/Vehicle_Sensor_Common_API.h>
+#include <stub/vehicle_notifications.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+/************************************************************************
+ * Macro definition *
+ ************************************************************************/
+/*----------------------------------------------------------------------*
+ * VECHILE_RET_API definition *
+ *----------------------------------------------------------------------*/
+/* Normal */
+/**
+ * \~english Sucess
+ */
+#define VEHICLE_RET_NORMAL 0
+
+/**
+ * \~english No register data ID
+ */
+#define VEHICLE_RET_ERROR_DID (-2)
+
+/**
+ * \~english Input parameter error
+ */
+#define VEHICLE_RET_ERROR_PARAM (-4)
+
+/**
+ * \~english Create event error
+ */
+#define VEHICLE_RET_ERROR_CREATE_EVENT (-6)
+
+/*----------------------------------------------------------------------*
+ * Vehicle sensor information delivery registration API related *
+ *----------------------------------------------------------------------*/
+/* Delivery control */
+/**
+ * \~english Register delivery
+ */
+#define VEHICLE_DELIVERY_REGIST 0x01
+
+#if 0
+/**
+ * \~english Stop delivery
+ */
+#define VEHICLE_DELIVERY_STOP 0x02
+
+/**
+ * \~english Restart delivery
+ */
+#define VEHICLE_DELIVERY_RESTART 0x03
+#endif
+
+/* Delivery opportunities */
+/**
+ * \~english Delivery timing(update)
+ */
+#define VEHICLE_DELIVERY_TIMING_UPDATE 0x01
+
+/**
+ * \~english Delivery timing(change)
+ */
+#define VEHICLE_DELIVERY_TIMING_CHANGE 0x02
+
+/* Drive mode switching */
+/**
+ * \~english TAB mode
+ */
+#define VEHICLE_DRIVE_MODE_TAB 0
+
+/**
+ * \~english AIAPI mode(USB)
+ */
+#define VEHICLE_DRIVE_MODE_ATAPI 1
+
+/*----------------------------------------------------------------------*
+ * Message related *
+ *----------------------------------------------------------------------*/
+/* Command ID */
+/* Since it is defined in #define the commodity code, the public CID is defined in #define */
+/**
+ * \~english Vehicle sensor information notify commandID
+ */
+#define CID_VEHICLESENS_VEHICLE_INFO 0x00000200
+
+/* Message body size(byte) */
+/**
+ * \~english Vehicle sensor information data max size
+ */
+#define VEHICLE_VSINFO_DSIZE 80
+
+/************************************************************************
+ * typedef definition *
+ ************************************************************************/
+/**
+ * \~english API return value
+ */
+typedef int32_t VEHICLE_RET_API;
+
+/************************************************************************
+ * struct definition *
+ ************************************************************************/
+
+/************************************************************************
+ * TAG : VEHICLE_MSG_VSINFO_DAT
+ * ABSTRACT : Vehicle sensor information notification message(->User)
+ ************************************************************************/
+/** \~english Vehicle sensor information notification message */
+/**
+ * \~english Vehicle sensor information notify message data
+ */
+typedef struct {
+ /**
+ * \~english Vehicle sensor information data ID
+ */
+ uint32_t did;
+
+ /**
+ * \~english Vehicle sensor information data size
+ */
+ uint16_t size;
+
+ /**
+ * \~english Vehicle sensor information receive flag
+ */
+ uint8_t rcvFlag;
+
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve;
+
+ /**
+ * \~english Vehicle sensor information data
+ */
+ uint8_t data[VEHICLE_VSINFO_DSIZE];
+} VEHICLE_MSG_VSINFO_DAT;
+
+/**
+ * \~english Vehicle sensor information notify message
+ */
+typedef struct {
+ /**
+ * \~english Vehicle sensor information data struct
+ */
+ VEHICLE_MSG_VSINFO_DAT data;
+} VEHICLE_MSG_VSINFO;
+
+/************************************************************************
+ * Function prototype *
+ ************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*[VEHICLE_API Public API]*/
+/* Display time middle API prototype *************/
+
+/**
+ * \ingroup Vehicle_DeliveryEntry
+ * \~english @par Overview
+ * - Register delivery of vehicle information.
+ * \~english @param [in] h_app
+ * HANDLE - The application handle of the calling thread
+ * \~english @param [in] notify_name
+ * PCSTR - Vehicle information notification destination threa name
+ * \~english @param [in] ul_did
+ * uint32_t - Vehicle Data ID
+ * \~english @param [in] uc_ctrl_flg
+ * uint8_t - Register delivery
+ * \~english @param [in] uc_delivery_timing
+ * uint8_t - Delivery timing(change/update)
+ * \~english @retval VEHICLE_RET_NORMAL : Success(register successful)
+ * \~english @retval VEHICLE_RET_ERROR_CREATE_EVENT : Failure(event generation failure)
+ * \~english @retval VEHICLE_RET_ERROR_PARAM : Invalid parameter
+ * \~english @par Precondition
+ * - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+ * - The availability of the vehicle process is TRUE.
+ * \~english @par Changing internal state
+ * - No change of internal state by this API occurs.
+ * \~english @par Processing failure condition
+ * - Delivery control flag(uc_ctrl_flg) is not VEHICLE_DELIVERRY_REGIST [VEHICLE_RET_ERROR_PARAM]
+ * - Delivery timing is invalid(not change/update) [VEHICLE_RET_ERROR_PARAM]
+ * - Failed to generate a message queue handle for transmission with
+ * the vehicle process [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * - Synchronous communication received on the vehicle process side failed to
+ * get data [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * - The data ID does not exit in the management list on the vehicle process [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * - The number of delivery registrations has reached the max number [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Details
+ * - By calling this API, we request to register delivery specified vehicle information.
+ * - It returns from this API by returning the delivery registration result by the Return value.
+ * - The specified vehicle information is notified after delivery registration.
+ * - Data delivery/reception is performed by asynchronous communication,
+ * and the receiving side acquires with command"CID_VEHICLESENS_VEHICLE_INFO".
+ * - An example in which a process using NSFW registers"CID_VEHICLESENS_VEHICLE_INFO" is shown below.
+ * - Example) when above CID received, callback function(SampleCallBackFunc) is executed.
+ * - FrameworkunifiedAttachCallbackToDispatcher(hApp, TN_VEHICLE_SENS, CID_VEHICLESENS_VEHICLE_INFO, SampleCallBackFunc).
+ * \~english @see Vehicle_GetVehicleData, FrameworkunifiedMcOpenSender, FrameworkunifiedInvokeSync
+ */
+VEHICLE_RET_API Vehicle_DeliveryEntry(HANDLE h_app, PCSTR notify_name,
+ uint32_t ul_did, uint8_t uc_ctrl_flg,
+ uint8_t uc_delivery_timing);
+
+/**
+ * \ingroup Vehicle_GetVehicleData
+ * \~english @par Overview
+ * - Get vehicle information data(arbitrary data).
+ * \~english @param [in] h_app
+ * HANDLE - The application handle of the calling thread
+ * \~english @param [in] ul_did
+ * uint32_t - Vehicle Data ID
+ * \~english @param [out] p_dest_data
+ * void * - Data buffer
+ * \~english @param [in] us_dest_size
+ * uint16_t - Data buffer size(byte)
+ * \~english @retval Integer(>0) : The stored data size
+ * \~english @retval VEHICLE_RET_ERROR_CREATE_EVENT : Failure(event generation failure)
+ * \~english @retval VEHICLE_RET_ERROR_PARAM : Invalid parameter
+ * \~english @par Precondition
+ * - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+ * - The availability of the vehicle process is TRUE.
+ * \~english @par Changing internal state
+ * - No change of internal state by this API occurs.
+ * \~english @par Processing failure condition
+ * - Failed to generate a message queue handle for transmission with
+ * the vehicle process [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * - Input data buffer size(us_dest_size) is zero [VEHICLE_RET_ERROR_PARAM]
+ * - Input data buffer(p_dest_data) is NULL [VEHICLE_RET_ERROR_PARAM]
+ * - Synchronous communication received on the vehicle process side failed to
+ * get data [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * - The data ID does not exit in the management list on the vehicle process [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Details
+ * - By calling this API, we obtain specified vehicle information.
+ * - The vehicle data will be written to parameter(pDestData).
+ * - Data delivery/reception is performed by asynchronous communication,
+ * and the receiving side acquires with command"CID_VEHICLESENS_VEHICLE_INFO".
+ * \~english @see Vehicle_DeliveryEntry, FrameworkunifiedMcOpenSender, FrameworkunifiedInvokeSync
+ */
+int32_t Vehicle_GetVehicleData(HANDLE h_app, uint32_t ul_did, void *p_dest_data,
+ uint16_t us_dest_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of vehicle
+/** @}*/ // end of VehicleService
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_API_H_
diff --git a/stub/vehicle/client/include/stub/Vehicle_Sensor_Common_API.h b/stub/vehicle/client/include/stub/Vehicle_Sensor_Common_API.h
new file mode 100755
index 0000000..810e46a
--- /dev/null
+++ b/stub/vehicle/client/include/stub/Vehicle_Sensor_Common_API.h
@@ -0,0 +1,502 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_SENSOR_COMMON_API_H_
+#define VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_SENSOR_COMMON_API_H_
+
+/**
+ * @file Vehicle_Sensor_Common_API.h
+ * @brief vehicle common id defined header file
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/******************************************************************************
+ * File name :Vehicle_Sensor_Common_API.h
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle I/F library, Sensor I/F library
+ ******************************************************************************/
+
+/************************************************************************
+ * Macro definition *
+ ************************************************************************/
+
+#if 1 // Ignore -> MISRA-C++ Rules 16-1-2, 16-2-2
+/* #GPF_60_023 For testing */
+#ifndef CONFIG_EXTTERM_INPUT_DAB2BIT // Ignore -> MISRA-C++ Rules 16-1-2, 16-2-2
+/**
+ * \~english DAB data 2 bits macro
+ */
+#define CONFIG_EXTTERM_INPUT_DAB2BIT 1 // Ignore -> MISRA-C++ Rules 16-2-2
+#endif
+#ifndef CONFIG_EXTTERM_INPUT_GPS2BIT // Ignore -> MISRA-C++ Rules 16-1-2, 16-2-2
+/**
+ * \~english GPS data 2 bits macro
+ */
+#define CONFIG_EXTTERM_INPUT_GPS2BIT 1 // Ignore -> MISRA-C++ Rules 16-2-2
+#endif
+#ifndef CONFIG_EXTTERM_INPUT_IMAGETERMINAL // Ignore -> MISRA-C++ Rules 16-1-2, 16-2-2
+/**
+ * \~english Image terminal macro
+ */
+#define CONFIG_EXTTERM_INPUT_IMAGETERMINAL 1 // Ignore -> MISRA-C++ Rules 16-2-2
+#endif
+#endif
+/* The above definition is a remnant of the external terminal processing part inside *
+ * the sennsor that was enabled or disabled, and is not originally required at all. *
+ * Enable all sensor internal processing and then delete. */
+
+/*----------------------------------------------------------------------*
+ * Data ID corresponding to vehicle sensor information *
+ *----------------------------------------------------------------------*/
+/*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+
+/**
+ * \~english Destination information
+ */
+#define VEHICLE_DID_DESTINATION (0x00000001UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Hybrid electric vehicle information
+ */
+#define VEHICLE_DID_HV (0x00000002UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Steering wheel information
+ */
+#define VEHICLE_DID_STEERING_WHEEL (0x00000003UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Voltage
+ */
+#define VEHICLE_DID_VB (0x00000004UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english IG information
+ */
+#define VEHICLE_DID_IG (0x00000005UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Microphone information
+ */
+#define VEHICLE_DID_MIC (0x00000006UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Back door information
+ */
+#define VEHICLE_DID_BACKDOOR (0x00000007UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Parking brake information
+ */
+#define VEHICLE_DID_PKB (0x00000008UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ADIM information
+ */
+#define VEHICLE_DID_ADIM (0x00000009UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Illumination information
+ */
+#define VEHICLE_DID_ILL (0x0000000AUL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english RHEOSTAT information
+ */
+#define VEHICLE_DID_RHEOSTAT (0x0000000BUL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english System temperature information
+ */
+#define VEHICLE_DID_SYSTEMP (0x0000000CUL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Reverse information
+ */
+#define VEHICLE_DID_REV (0x00000017UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Reverse information(line sensor)
+ */
+#define VEHICLE_DID_REV_LINE (0x0000000EUL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Reverse CAN information
+ */
+#define VEHICLE_DID_REV_CAN (0x0000000FUL) // Ignore -> MISRA-C++ Rule 16-2-2
+/**
+ * \~english SPEED information
+ */
+#define VEHICLE_DID_SPEED (0x00000010UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english SPEED PULSE information
+ */
+#define VEHICLE_DID_SPEED_PULSE (0x00000011UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english VB information
+ */
+#define VEHICLE_DID_VBLOW (0x00000012UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Drive information(2WD/4WD)
+ */
+#define VEHICLE_DID_DVINF (0x00000013UL)
+
+/**
+ * \~english Transmission information
+ */
+#define VEHICLE_DID_VARTRM1 (0x00000014UL)
+
+/**
+ * \~english Shift position signal(R, P, N, D)
+ */
+#define VEHICLE_DID_SHIFT (0x00000015UL)
+
+/**
+ * \~english Direct line sensor(PKB)
+ */
+#define VEHICLE_DID_PKB_LINE (0x00000016UL)
+
+/**
+ * \~english D seat door signal switch
+ */
+#define VEHICLE_DID_DSEAT_DOOR (0x0000000DUL)
+
+/**
+ * \~english P seat door signal switch
+ */
+#define VEHICLE_DID_PSEAT_DOOR (0x00000018UL)
+
+/**
+ * \~english RR seat door signal switch
+ */
+#define VEHICLE_DID_RRSEAT_DOOR (0x00000019UL)
+
+/**
+ * \~english RL seat door signal switch
+ */
+#define VEHICLE_DID_RLSEAT_DOOR (0x0000001AUL)
+
+/**
+ * \~english IGP information
+ */
+#define VEHICLE_DID_IGP (0x0000001BUL)
+
+/**
+ * \~english HV information status
+ */
+#define VEHICLE_DID_HV_STS (0x0000001CUL)
+
+/**
+ * \~english Shift position signal(Unspecified)
+ */
+#define VEHICLE_DID_SHIFT_U (0x0000001DUL)
+
+/**
+ * \~english USB power supply
+ */
+#define VEHICLE_DID_USBPOWERSUPPLY (0x800000A0UL)
+
+/**
+ * \~english Analog Microphone Connect information
+ */
+#define VEHICLE_DID_ANALOG_MIC (0x800000B0UL)
+
+/**
+ * \~english MultiMic Connect information
+ */
+#define VEHICLE_DID_MULTI_MIC (0x800000B1UL)
+
+/*----------------------------------------------------------------------*
+ * Vehicle sensor information data *
+ *----------------------------------------------------------------------*/
+/**
+ * \~english OFF
+ */
+#define VEHICLE_SNS_OFF (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ON
+ */
+#define VEHICLE_SNS_ON (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+#define VEHICLE_SNS_BLACKOUT (0x02U) // Disruptions
+/**
+ * \~english Undefined
+ */
+#define VEHICLE_SNS_UNDEF (0x03U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Disconnection
+ */
+#define VEHICLE_SNS_UNCONNECTION (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Connection
+ */
+#define VEHICLE_SNS_CONNECTION (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Uncertainty
+ */
+#define VEHICLE_SNS_BW_UNCERTAINTY (0x02U)
+
+/**
+ * \~english Unspecified
+ */
+#define VEHICLE_SNS_UNSPECIFIED (0x03U) // Ignore -> MISRA-C++ Rule 16-2-2
+/* #GPF_60_023 ADD START */
+#if (CONFIG_EXTTERM_INPUT_DAB2BIT | CONFIG_EXTTERM_INPUT_GPS2BIT) // Ignore -> MISRA-C++ Rules 16-1-2, 16-2-2
+/**
+ * \~english Short
+ */
+#define VEHICLE_SNS_SHORT (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+#endif
+/* #GPF_60_023 ADD END */
+
+/**
+ * \~english Hybrid electric vehicle
+ */
+#define VEHICLE_SNS_HV (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Plug-in hybrid electric vehicle
+ */
+#define VEHICLE_SNS_PHV (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Electric vehicle
+ */
+#define VEHICLE_SNS_EV (0x03U)
+
+/**
+ * \~english Fuel Cell vehicle
+ */
+#define VEHICLE_SNS_FCV (0x04U)
+
+/**
+ * \~english 1 motor vehicle
+ */
+#define VEHICLE_SNS_1MOT (0x05U)
+
+/**
+ * \~english Conventional(48V) vehicle
+ */
+#define VEHICLE_SNS_48V (0x06U)
+
+/**
+ * \~english S&S vehicle
+ */
+#define VEHICLE_SNS_SANDS (0x07U)
+
+/**
+ * \~english Conventional vehicle
+ */
+#define VEHICLE_SNS_NONHV (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Two wheel drive
+ */
+#define VEHICLE_SNS_2WD (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**gb
+ * \~english Four wheel drive
+ */
+#define VEHICLE_SNS_4WD (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Left handle
+ */
+#define VEHICLE_SNS_LH (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Right handle
+ */
+#define VEHICLE_SNS_RH (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Close
+ */
+#define VEHICLE_SNS_CLOSE (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Open
+ */
+#define VEHICLE_SNS_OPEN (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Back door uncertainty
+ */
+#define VEHICLE_SNS_BD_UNCERTAINTY (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ADIM uncertainty
+ */
+#define VEHICLE_SNS_ADIM_UNCERTAINTY (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ADIM undefined
+ */
+#define VEHICLE_SNS_ADIM_UNDEF (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ADIM off
+ */
+#define VEHICLE_SNS_ADIM_OFF (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ADIM on
+ */
+#define VEHICLE_SNS_ADIM_ON (0x03U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Drive information(2WD)
+ */
+#define VEHICLE_SNS_DVINF_2WD (0x00U)
+
+/**
+ * \~english Drive information(4WD)
+ */
+#define VEHICLE_SNS_DVINF_4WD (0x01U)
+
+/**
+ * \~english Drive information uncertainty
+ */
+#define VEHICLE_SNS_DVINF_UNCERTAINTY (0x03U)
+
+/**
+ * \~english Transmission information(MT)
+ */
+#define VEHICLE_SNS_VARTRM1_MT (0x00U)
+
+/**
+ * \~english Transmission information(AT)
+ */
+#define VEHICLE_SNS_VARTRM1_AT (0x01U)
+
+/**
+ * \~english Transmission information(CVT)
+ */
+#define VEHICLE_SNS_VARTRM1_CVT (0x02U)
+
+/**
+ * \~english Transmission information(MMT)
+ */
+#define VEHICLE_SNS_VARTRM1_MMT (0x03U)
+
+/**
+ * \~english Transmission information(SMT)
+ */
+#define VEHICLE_SNS_VARTRM1_SMT (0x04U)
+
+/**
+ * \~english Transmission information(HV_AT)
+ */
+#define VEHICLE_SNS_VARTRM1_HV_AT (0x05U)
+
+/**
+ * \~english Transmission information uncertainty
+ */
+#define VEHICLE_SNS_VARTRM1_UNCERTAINTY (0x0FU)
+
+/**
+ * \~english D seat door uncertainty
+ */
+#define VEHICLE_SNS_DS_UNCERTAINTY (0x02U)
+
+/**
+ * \~english P seat door uncertainty
+ */
+#define VEHICLE_SNS_PS_UNCERTAINTY (0x02U)
+
+/**
+ * \~english RR seat door uncertainty
+ */
+#define VEHICLE_SNS_RRS_UNCERTAINTY (0x02U)
+
+/**
+ * \~english RL seat door uncertainty
+ */
+#define VEHICLE_SNS_RLS_UNCERTAINTY (0x02U)
+
+/**
+ * \~english HV information not decision
+ */
+#define VEHICLE_SNS_HV_NOT_DECISION (0x00U)
+
+/**
+ * \~english HV information decision
+ */
+#define VEHICLE_SNS_HV_DECISION (0x01U)
+
+/**
+ * @enum VehicleSnsAnlogMicBit
+ * \~english ANALOGMIC connect bit information
+ */
+enum VehicleSnsAnlogMicBit {
+ VEHICLE_SNS_ANALOG_MIC1_BIT = 0x02, //!< \~english ANALOGMIC1 connect
+ VEHICLE_SNS_ANALOG_MIC2_BIT = 0x04, //!< \~english ANALOGMIC2 connect
+};
+
+/**
+ * @enum VehicleSnsMultiMicBit
+ * \~english MULTI MIC connect bit information
+ */
+enum VehicleSnsMultiMicBit {
+ VEHICLE_SNS_A2B_HUB_BIT = 0x01, //!< \~english A2BHUB connect
+ VEHICLE_SNS_MULTI_MIC1_BIT = 0x02, //!< \~english MULTIMIC1 connect
+ VEHICLE_SNS_MULTI_MIC2_BIT = 0x04, //!< \~english MULTIMIC2 connect
+ VEHICLE_SNS_MULTI_MIC3_BIT = 0x08, //!< \~english MULTIMIC3 connect
+ VEHICLE_SNS_MULTI_MIC4_BIT = 0x10, //!< \~english MULTIMIC4 connect
+ VEHICLE_SNS_MULTI_MIC5_BIT = 0x20, //!< \~english MULTIMIC5 connect
+ VEHICLE_SNS_MULTI_MIC6_BIT = 0x40, //!< \~english MULTIMIC6 connect
+ VEHICLE_SNS_ANC_BIT = 0x80, //!< \~english ANC connect
+};
+
+/*-------------------------------------------------------------------------------
+ * Time status return value
+ -------------------------------------------------------------------------------*/
+/**
+ * \~english Real time clock
+ */
+#define GPS_TIMESTS_RTC (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Exception time
+ */
+#define GPS_TIMESTS_NG (0x03U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/** @}*/ // end of vehicle
+/** @}*/ // end of VehicleService
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_SENSOR_COMMON_API_H_
diff --git a/stub/vehicle/client/include/stub/vehicle_notifications.h b/stub/vehicle/client/include/stub/vehicle_notifications.h
new file mode 100755
index 0000000..8348147
--- /dev/null
+++ b/stub/vehicle/client/include/stub/vehicle_notifications.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_NOTIFICATIONS_H_
+#define VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_NOTIFICATIONS_H_
+
+/**
+ * @file vehicle_notifications.h
+ * @brief vehicle notification name define header file
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <agl_thread.h>
+
+/**
+ * \~english Vehicle notification availability
+ */
+#define NTFY_Vehicle_Availability MN_VEHICLE"/Availability"
+
+/** @}*/ // end of vehicle
+/** @}*/ // end of VehicleService
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_NOTIFICATIONS_H_
diff --git a/stub/vehicle/client/libVehicle_API.ver b/stub/vehicle/client/libVehicle_API.ver
new file mode 100755
index 0000000..14be907
--- /dev/null
+++ b/stub/vehicle/client/libVehicle_API.ver
@@ -0,0 +1,28 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#########################
+# libVehicle_API version script #
+#########################
+{
+ global:
+ ### .text section ###
+ Vehicle_*;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/stub/vehicle/client/src/Vehicle_API.cpp b/stub/vehicle/client/src/Vehicle_API.cpp
new file mode 100755
index 0000000..cefee01
--- /dev/null
+++ b/stub/vehicle/client/src/Vehicle_API.cpp
@@ -0,0 +1,43 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "Vehicle_API.h"
+
+VEHICLE_RET_API Vehicle_DeliveryEntry(HANDLE h_app, PCSTR notify_name,
+ uint32_t ul_did, uint8_t uc_ctrl_flg,
+ uint8_t uc_delivery_timing) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return VEHICLE_RET_NORMAL;
+}
+
+int32_t Vehicle_GetVehicleData(HANDLE h_app, uint32_t ul_did, void *p_dest_data,
+ uint16_t us_dest_size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 1;
+}
+
diff --git a/systemservice/config/LICENSE b/systemservice/config/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/systemservice/config/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/systemservice/config/Makefile.client b/systemservice/config/Makefile.client
new file mode 100755
index 0000000..0a186c5
--- /dev/null
+++ b/systemservice/config/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := library
+
+include ../system_service.mk
diff --git a/systemservice/config/library/Makefile b/systemservice/config/library/Makefile
new file mode 100755
index 0000000..f326127
--- /dev/null
+++ b/systemservice/config/library/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := system_manager_config
+
+include ../../system_service.mk
diff --git a/systemservice/config/library/system_manager_config/Makefile b/systemservice/config/library/system_manager_config/Makefile
new file mode 100755
index 0000000..fbb09d7
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/Makefile
@@ -0,0 +1,21 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+SUBDIRS := src
+
+include ../../../system_service.mk
+
diff --git a/systemservice/config/library/system_manager_config/include/system_service/ss_access_if_private.h b/systemservice/config/library/system_manager_config/include/system_service/ss_access_if_private.h
new file mode 100755
index 0000000..1753bf0
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/include/system_service/ss_access_if_private.h
@@ -0,0 +1,80 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_access_if_private.h
+ * @brief \~english This file contains declaration of structures RAM_AccessPrivate and ROM_AccessPrivate
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup config
+ * @ingroup system_service
+ * @{
+ */
+#ifndef CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_ACCESS_IF_PRIVATE_H_
+#define CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_ACCESS_IF_PRIVATE_H_
+
+#include <system_service/ss_sm_rom_access.h>
+#include <system_service/ss_sm_ram_access.h>
+
+// Should be design the data so that the default value is 0.
+
+// Product private area for DRAM BACKUP
+
+/**
+ * @struct RAM_AccessPrivate
+ * @brief \~english RAM Access Private data define
+ */
+typedef struct {
+ union {
+ //! \~english _CWORD80_ error define
+ struct {
+ /*
+ * Note.
+ * This feature needs to be defined depending on the product specification by the vendor.
+ */
+ };
+ //! \~english RAM product private max
+ uint8_t max[RAM_PRODUCT_PRIVATE_MAX];
+ };
+} RAM_AccessPrivate;
+
+/**
+ * @struct ROM_AccessPrivate
+ * @brief \~english ROM Access Private data define
+ */
+typedef struct {
+ union {
+ // Since data is accessed with 32 bit width at the low level, data must be allocated using 32 bits algin
+ struct {
+ /*
+ * Note.
+ * This feature needs to be defined depending on the product specification by the vendor.
+ */
+ };
+ //! \~english ROM product private max
+ uint8_t max[ROM_PRODUCT_PRIVATE_MAX];
+ };
+} ROM_AccessPrivate;
+
+#endif // CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_ACCESS_IF_PRIVATE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/config/library/system_manager_config/include/system_service/ss_package.h b/systemservice/config/library/system_manager_config/include/system_service/ss_package.h
new file mode 100755
index 0000000..788fd2c
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/include/system_service/ss_package.h
@@ -0,0 +1,65 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_package.h
+ * @brief \~english This file contains declaration of common package values
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_PACKAGE_H_
+#define CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_PACKAGE_H_
+
+// _CWORD71_ package name list
+#define SS_PKG_MAIN_EMMC "MAIN_EMMC" // define MAIN_EMMC for main_emmc
+#define SS_PKG_MAIN_PRODUCT_SI "MAIN_PRODUCT_SI" // define MAIN_PRODUCT_SI for main_product_si
+#define SS_PKG_TARGETBOARD "TARGETBOARD" // define TARGETBOARD for target boar
+#define SS_PKG_MAIN_LPF_SI "MAIN_LPF_SI" // define MAIN_LPF_SI for main_lpf_si
+
+#define SS_PKG_NAVI_GPS _Pragma ("GCC warning \"'SS_NAVI_GPS' macro is deprecated\"") "NAVI_GPS"
+#define SS_PKG_SERIES_INFO _Pragma ("GCC warning \"'SS_PKG_SERIES_INFO' macro is deprecated\"") "SERIES_INFO"
+
+#define MSG_PSM_REBOOT_NOTIFY 0x11 // define ps_psmshadow reboot notice id
+
+// AGL reserved version list.
+#define SS_PKG_DIAG_CPU_INFO_001 "DIAG_CPU_INFO_001"
+#define SS_PKG_DIAG_CPU_INFO_002 "DIAG_CPU_INFO_002"
+#define SS_PKG_DIAG_CPU_INFO_003 "DIAG_CPU_INFO_003"
+#define SS_PKG_DIAG_CPU_INFO_004 "DIAG_CPU_INFO_004"
+#define SS_PKG_DIAG_CPU_INFO_005 "DIAG_CPU_INFO_005"
+#define SS_PKG_DIAG_CPU_INFO_006 "DIAG_CPU_INFO_006"
+#define SS_PKG_DIAG_CPU_INFO_007 "DIAG_CPU_INFO_007"
+#define SS_PKG_DIAG_CPU_INFO_008 "DIAG_CPU_INFO_008"
+#define SS_PKG_DIAG_CPU_INFO_009 "DIAG_CPU_INFO_009"
+#define SS_PKG_DIAG_CPU_INFO_010 "DIAG_CPU_INFO_010"
+#define SS_PKG_DIAG_CPU_INFO_011 "DIAG_CPU_INFO_011"
+#define SS_PKG_DIAG_CPU_INFO_012 "DIAG_CPU_INFO_012"
+#define SS_PKG_DIAG_CPU_INFO_013 "DIAG_CPU_INFO_013"
+#define SS_PKG_DIAG_CPU_INFO_014 "DIAG_CPU_INFO_014"
+#define SS_PKG_DIAG_CPU_INFO_015 "DIAG_CPU_INFO_015"
+
+#endif // CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_PACKAGE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/config/library/system_manager_config/include/system_service/ss_system_manager_conf.h b/systemservice/config/library/system_manager_config/include/system_service/ss_system_manager_conf.h
new file mode 100755
index 0000000..5354da8
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/include/system_service/ss_system_manager_conf.h
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_system_manager_conf.h
+ * @brief \~english This file contains declaration of structures T_SS_SM_INIT_HOOK_IN_PARAM, T_SS_SM_INIT_HOOK_OUT_PARAM and api initial Hook
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup config
+ * @ingroup system_service
+ * @{
+ */
+#ifndef CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_SYSTEM_MANAGER_CONF_H_
+#define CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_SYSTEM_MANAGER_CONF_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <vector>
+#include <string>
+
+/**
+ * @struct T_SS_SM_INIT_HOOK
+ * @brief \~english Version up mode, Callback function
+ */
+typedef struct T_SS_SM_INIT_HOOK {
+ //! \~english Version up mode
+ BOOL bIsVupMode;
+ //! \~english Call back function
+ EFrameworkunifiedStatus (*cbRebootNoticeFunc)(HANDLE hApp);
+
+ T_SS_SM_INIT_HOOK()
+ : bIsVupMode(FALSE),
+ cbRebootNoticeFunc(NULL) {
+ }
+} T_SS_SM_INIT_HOOK_IN_PARAM;
+
+
+/**
+ * @struct T_SS_SM_INIT_HOOK_OUT_PARAM
+ * @brief \~english Not in OOM Killer's service object, Group Relaunch service.
+ */
+typedef struct {
+ std::vector<std::string> protectedSvcs;
+ //! \~english Not in OOM Killer's service object.
+ std::vector<std::string> groupRelaunchSvcs;
+ //! \~english Group Relaunch service.
+} T_SS_SM_INIT_HOOK_OUT_PARAM;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ss_sm_initHook
+/// \~english @par Summary
+///
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE Application
+/// \~english @param [in] inPrm
+/// T_SS_SM_INIT_HOOK_IN_PARAM -
+/// \~english @param [in] outPrm
+/// T_SS_SM_INIT_HOOK_OUT_PARAM -
+/// \~english @par
+/// T_SS_SM_INIT_HOOK_IN_PARAM struct
+/// \~english @code
+/// typedef struct T_SS_SM_INIT_HOOK {
+/// BOOL bIsVupMode; /* version up model */
+/// EFrameworkunifiedStatus (*cbRebootNoticeFunc)(HANDLE hApp); /* call back function */
+/// T_SS_SM_INIT_HOOK()
+/// : bIsVupMode(FALSE),
+/// cbRebootNoticeFunc(NULL) {
+/// } /* constructor */
+/// } T_SS_SM_INIT_HOOK_IN_PARAM;
+/// @endcode
+/// \~english @par
+/// T_SS_SM_INIT_HOOK_IN_PARAM struct
+/// \~english @code
+/// typedef struct {
+/// std::vector<std::string> protectedSvcs; /* OOM Killer's protected service */
+/// std::vector<std::string> groupRelaunchSvcs; /* group relunch service */
+/// } T_SS_SM_INIT_HOOK_OUT_PARAM;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - None
+/// \~english @par Change of the internal state
+/// - save inPrm->cbRebootNoticeFunc to s_confCtx.cbRebootNoticeFunc.
+/// \~english @par Causes of failures
+/// -
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid. \n
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of \n
+/// the System Manager message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid. \n
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session. \n
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. \n
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// get env val from application,and write these to Launch Config file.
+/// \~english @par
+/// eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Fail
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus ss_sm_initHook(HANDLE hApp, const T_SS_SM_INIT_HOOK_IN_PARAM *inPrm,
+ T_SS_SM_INIT_HOOK_OUT_PARAM *outPrm);
+
+#endif // CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_SYSTEM_MANAGER_CONF_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/config/library/system_manager_config/include/system_service/system_manager_config.h b/systemservice/config/library/system_manager_config/include/system_service/system_manager_config.h
new file mode 100755
index 0000000..2f44f98
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/include/system_service/system_manager_config.h
@@ -0,0 +1,26 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ */
+#ifndef SYSTEMSERVICE_SYSTEMMANAGERCONFIG_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_SYSTEMMANAGERCONFIG_H_ // NOLINT(build/header_guard)
+
+#include <system_service/ss_access_if_private.h>
+#include <system_service/ss_package.h>
+#include <system_service/ss_system_manager_conf.h>
+
+#endif // SYSTEMSERVICE_SYSTEMMANAGERCONFIG_H_
diff --git a/systemservice/config/library/system_manager_config/last2order/Makefile b/systemservice/config/library/system_manager_config/last2order/Makefile
new file mode 100755
index 0000000..f38ee77
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/last2order/Makefile
@@ -0,0 +1,71 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# ==== Customization ================
+#Directory path located XMLs for conversion
+CONFXML_DIR_PATH ?= $(SDKTARGETSYSROOT)/usr/agl/conf/sm_last2order
+
+#path to order file
+ORDER_DEF_PATH ?= $(SDKTARGETSYSROOT)/usr/agl/include/agl_wakeup_order.h
+
+#path to be installed CFO file
+CONF_INSTALL_DIR ?= $(SDKTARGETSYSROOT)/usr/agl/conf/systemmanager
+
+# ==================================
+
+HOST_CPP = cpp
+MKL_LAST2ORDER = mklast2ordertbl.pl
+
+#path located last2order tools
+TOOLPATH = ./tool
+
+VPATH = $(CONFXML_DIR_PATH) $(TOOLPATH)
+
+XMLFILES = $(shell cd $(CONFXML_DIR_PATH); ls *.xml)
+XMLTMPFILES = $(XMLFILES:%.xml=%.xml.pped)
+CFOFILES = $(XMLFILES:%.xml=%.cfo)
+
+_all:$(CFOFILES)
+
+install:install-pre install-cfo
+
+install-pre:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/sm_last2order;\
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/systemmanager sm_last2order.cfo
+
+install-cfo:_all
+ set -e ;\
+ install -d -m 775 $(CONF_INSTALL_DIR) ;\
+ for cfofile in $(CFOFILES); do \
+ install -m 644 -t $(CONF_INSTALL_DIR) $$cfofile; \
+ done
+
+%.cfo:%.xml.pped $(MKL_LAST2ORDER)
+ ln -fs $(TOOLPATH)/$(MKL_LAST2ORDER)
+ ./$(MKL_LAST2ORDER) $< $@
+
+%.xml.pped:%.xml
+ $(HOST_CPP) -P -include $(ORDER_DEF_PATH) $< > $@
+
+clean:clean_local
+clean-sub:clean_local
+
+clean_local:
+ rm -f *.cfo *.pped *.pl
+
+.PHONY:install-cfo _all
+
+include ../../../../system_service.mk
diff --git a/systemservice/config/library/system_manager_config/last2order/sm_last2order.cfo b/systemservice/config/library/system_manager_config/last2order/sm_last2order.cfo
new file mode 100755
index 0000000..2463eec
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/last2order/sm_last2order.cfo
Binary files differ
diff --git a/systemservice/config/library/system_manager_config/last2order/tool/mklast2ordertbl.pl b/systemservice/config/library/system_manager_config/last2order/tool/mklast2ordertbl.pl
new file mode 100755
index 0000000..9b7dcab
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/last2order/tool/mklast2ordertbl.pl
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+use strict;
+
+use XML::XPath;
+
+my $LOCAL_XML = "./last2order.xml.tmp";
+my $LOCAL_DTD = "./last2order.dtd";
+
+my $DTD = <<'EODTD';
+<!ELEMENT last2order_tbl (last2order*) >
+
+<!ELEMENT last2order EMPTY>
+<!ATTLIST last2order
+ front_video CDATA "EMPTY"
+ front_sub_video CDATA "EMPTY"
+ front_audio CDATA "EMPTY"
+ rear_video CDATA "EMPTY"
+ rear_audio CDATA "EMPTY"
+ ordername CDATA #REQUIRED
+>
+EODTD
+
+sub usage(){
+ print STDERR "USAGE:$0 *.xml *.cfo\n";
+}
+
+#==== MAIN ====
+my $ret=system("which xmllint > /dev/null");
+if($ret != 0){
+ die("xmllint is not installed \n");
+}
+
+if(2 != @ARGV){
+ usage();
+ exit 1;
+}
+
+my $inXmlFile= $ARGV[0];
+my $outCfgXmlFile= $ARGV[1];
+
+
+#ARG CHECK
+if(! -e $inXmlFile){
+ die("$inXmlFile not found");
+}
+
+
+system("cp $inXmlFile $LOCAL_XML");
+
+open FOUT,'>',$LOCAL_DTD or die("can't open $LOCAL_DTD");
+print FOUT $DTD;
+close FOUT;
+
+$ret=system("xmllint --noout --valid $LOCAL_XML ");
+if($ret != 0){
+ die("$inXmlFile is NOT VAILD");
+}
+
+my $xml = XML::XPath->new(filename=>$LOCAL_XML);
+
+my $last2order_tbl = $xml->find('/last2order_tbl/last2order');
+
+my @nodelist = $last2order_tbl->get_nodelist;
+my $numOfElement = @nodelist;
+
+printf("num of element :$numOfElement\n");
+
+my $writeValue;
+open FOUT,'+>',$outCfgXmlFile or die("can't open $outCfgXmlFile");
+binmode(FOUT);
+
+$writeValue = pack("A4","CTOO"); print FOUT $writeValue;
+$writeValue = pack("L",$numOfElement); print FOUT $writeValue;
+
+foreach my $last2order( @nodelist ) {
+ $writeValue = $last2order->findvalue('@front_video');
+ printf("FV:$writeValue ");
+ $writeValue = pack("a128",$writeValue); print FOUT $writeValue;
+
+ $writeValue = $last2order->findvalue('@front_sub_video');
+ printf("FSV:$writeValue ");
+ $writeValue = pack("a128",$writeValue); print FOUT $writeValue;
+
+ $writeValue = $last2order->findvalue('@front_audio');
+ printf("FA:$writeValue ");
+ $writeValue = pack("a128",$writeValue); print FOUT $writeValue;
+
+ $writeValue = $last2order->findvalue('@rear_video');
+ printf("RV:$writeValue ");
+ $writeValue = pack("a128",$writeValue); print FOUT $writeValue;
+
+ $writeValue = $last2order->findvalue('@rear_audio');
+ printf("RA:$writeValue ");
+ $writeValue = pack("a128",$writeValue); print FOUT $writeValue;
+
+ $writeValue = $last2order->findvalue('@ordername');
+ printf("ON:$writeValue ");
+ $writeValue = pack("a64",$writeValue); print FOUT $writeValue;
+
+ printf("\n");
+}
+
+close(FOUT);
+
+system("rm $LOCAL_XML $LOCAL_DTD");
+
+
diff --git a/systemservice/config/library/system_manager_config/order/Makefile b/systemservice/config/library/system_manager_config/order/Makefile
new file mode 100755
index 0000000..38af0ee
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/order/Makefile
@@ -0,0 +1,64 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#HOST TOOLS
+HOST_CPP = cpp
+HOST_ORDER_XML2CFG = ./launch_order_xml2cfg.pl
+
+CONF_DIR = $(SDKTARGETSYSROOT)/usr/agl/conf
+CONF_WON_H = $(SDKTARGETSYSROOT)/usr/agl/include/agl_wakeup_order.h
+
+LAUNCH_XMLFILES = $(shell cd $(CONF_DIR)/sm_launch; ls *.xml)
+ORDER_XMLFILES = $(LAUNCH_XMLFILES:%.xml=%.order)
+ORDER_CFGFILES = $(ORDER_XMLFILES:%.order=%.order.cfg)
+
+INST_CONFDIR = $(SDKTARGETSYSROOT)/usr/agl/conf/systemmanager
+
+CLEAN_FILES = launch_order_body.xml $(ORDER_CFGFILES)
+
+VPATH = $(CONF_DIR)/sm_launch
+VPATH += ../xml
+
+install:install-pre install-cfg
+
+install-pre:
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/sm_launch system_launcher_main.xml
+
+install-cfg:$(ORDER_CFGFILES)
+ set -e ;\
+ install -d -m 775 $(INST_CONFDIR) ;\
+ for cfgfile in $(ORDER_CFGFILES);do \
+ install -m 644 -t $(INST_CONFDIR) $$cfgfile;\
+ done ;\
+
+#Create CFG file
+%.order.cfg:%.order %.cfg
+ echo $@
+ set -e; \
+ $(HOST_CPP) $(CPPFLAGS) -P -include $(CONF_WON_H) $< > launch_in.order; \
+ $(HOST_ORDER_XML2CFG) launch_in.order $(filter %.cfg,$+) > $@ ; \
+ rm -fr launch_in.order;
+
+%.order:
+ echo $@
+ set -e; \
+ if [ ! -e $@ ] ; then \
+ touch $@ ; \
+ fi
+
+PHONY:install-cfg
+
+include ../../../../system_service.mk
diff --git a/systemservice/config/library/system_manager_config/order/launch_order_body.xml b/systemservice/config/library/system_manager_config/order/launch_order_body.xml
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/order/launch_order_body.xml
diff --git a/systemservice/config/library/system_manager_config/order/launch_order_main.xml b/systemservice/config/library/system_manager_config/order/launch_order_main.xml
new file mode 100755
index 0000000..ee22646
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/order/launch_order_main.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" ?>
+
+<!DOCTYPE launch_order [
+ <!ELEMENT launch_order (order*) >
+
+ <!ELEMENT order (group+) >
+ <!ATTLIST order
+ oname ID #REQUIRED
+ fixed_group CDATA "NULL"
+ >
+
+ <!ELEMENT group EMPTY >
+ <!ATTLIST group
+ gname CDATA #REQUIRED
+ waittime CDATA "0"
+ >
+
+ <!ENTITY launch_order_body SYSTEM "launch_order_body.xml">
+]>
+
+<launch_order>
+ &launch_order_body;
+</launch_order>
diff --git a/systemservice/config/library/system_manager_config/order/launch_order_xml2cfg.pl b/systemservice/config/library/system_manager_config/order/launch_order_xml2cfg.pl
new file mode 100755
index 0000000..1060107
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/order/launch_order_xml2cfg.pl
@@ -0,0 +1,171 @@
+#!/usr/bin/perl -w
+use strict;
+
+use XML::XPath;
+use File::Copy;
+
+my $main_file="launch_order_main.xml";
+my $body_file="launch_order_body.xml";
+
+
+sub usage(){
+ print STDERR "USAGE:$0 *.order *.cfg\n"
+}
+
+
+
+
+#=== MAIN ===
+my $ret=system("which xmllint > /dev/null");
+if($ret != 0){
+ print STDERR "It need xmllint. Please install it.\n";
+ exit 1;
+}
+
+if(2 != @ARGV){
+ usage();
+ exit 1;
+}
+
+my $infile=$ARGV[0];
+my $launchfile=$ARGV[1];
+
+
+#ARG CHECK
+if($infile !~ /.+\.order$/){
+ print STDERR "$infile is not *.order\n";
+ exit 1;
+}elsif(! -e $infile){
+ print "$infile not found\n";
+ usage();
+ exit 1;
+}
+
+if($launchfile !~ /.+\.cfg$/){
+ print STDERR "$launchfile is not *.cfg\n";
+ exit 1;
+}elsif(! -e $launchfile){
+ print "$launchfile not found\n";
+ usage();
+ exit 1;
+}
+
+
+system("cp -f $infile $body_file");
+
+#check xml vaild
+$ret=system("xmllint --noout --valid $main_file");
+if($ret != 0){
+ print STDERR "XML is Invalid. \n";
+ exit 1;
+}
+
+my $date=`LANG=en date`;
+print "# This file is created from $infile and $launchfile\n";
+print "# created date : $date\n";
+
+my %gnamemap;
+my %gidmap;
+
+open(FIN,"<$launchfile") or die("error :$!");
+while (my $line = <FIN>){
+ if($line =~ /^Launch/){
+ $line =~ s/^[^|]+=//g;
+ my @args = split(/\|/,$line);
+ $gnamemap{$args[0]}=$args[1];
+ $gidmap{$args[1]}=$args[0];
+ }
+}
+close(FIN);
+
+foreach my $key (sort{$a <=> $b} keys(%gidmap)){
+ print "#$key:$gidmap{$key}\n";
+}
+
+
+my $xml = XML::XPath->new(filename=>$main_file);
+
+my $orders = $xml->find('/launch_order/order');
+foreach my $order ($orders->get_nodelist) {
+ my $groups = $order->find('./group');
+
+ my $oname=$order->findvalue('@oname');
+ my $fixed_group=$order->findvalue('@fixed_group');
+
+ print "[$oname]\n";
+ print "order=";
+
+ my %l_gidmap = %gidmap;
+ my $sep="";
+ #fix groups
+ if($fixed_group ne "NULL"){
+ if(! exists $gnamemap{$fixed_group}){
+ die("$fixed_group not found");
+ }
+ foreach my $gid (sort{$a <=> $b} keys(%l_gidmap)){
+ print "$sep$gid";
+ $sep="|";
+ my $str=$l_gidmap{$gid};
+ delete $l_gidmap{$gid};
+ if($str eq $fixed_group){
+ last;
+ }
+ }
+ }
+
+ # re-order group via *.order
+ my %waitow;
+ foreach my $group ($groups->get_nodelist) {
+ my $gname=$group->findvalue('@gname');
+ my $waittime=XML::XPath::Number::value($group->findvalue('@waittime'));
+
+ my $gid=$gnamemap{$gname};
+
+ if(! exists $gnamemap{$gname}){
+ die("$oname:$gname is not defined");
+ }
+
+ if(! exists $l_gidmap{$gid}){
+ die("$oname:$gname is multiple defined");
+ }
+
+ print "$sep$gid";
+ $sep="|";
+ delete $l_gidmap{$gid};
+
+ if($waittime > 0){
+ $waitow{$gname} = $waittime;
+ }
+ }
+
+# Output waittime configuration
+
+ #out rest groups
+ foreach my $gid (sort{$a <=> $b} keys(%l_gidmap)){
+ print "$sep$gid";
+ $sep="|";
+ }
+
+ print "\n";
+ if(keys(%waitow) > 0 ){
+ print "owlist=";
+ $sep="";
+ foreach my $owgroup ( keys(%waitow)) {
+ print "${sep}oww_${owgroup}";
+ $sep="|";
+ }
+ print "\n";
+
+ foreach my $owgroup ( keys(%waitow)) {
+ print "oww_${owgroup}=$waitow{$owgroup}\n";
+ }
+
+
+ }
+ print "\n";
+}
+
+
+
+
+
diff --git a/systemservice/config/library/system_manager_config/order/system_launcher_main.order.cfg b/systemservice/config/library/system_manager_config/order/system_launcher_main.order.cfg
new file mode 100755
index 0000000..dc49cd7
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/order/system_launcher_main.order.cfg
@@ -0,0 +1,3 @@
+# This file is created from launch_in.order and system_launcher_main.cfg
+# created date : Tue Aug 29 13:45:54 JST 2017
+
diff --git a/systemservice/config/library/system_manager_config/order/system_launcher_main.xml b/systemservice/config/library/system_manager_config/order/system_launcher_main.xml
new file mode 100755
index 0000000..2dd97d9
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/order/system_launcher_main.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" ?>
+
+<!DOCTYPE system_launcher [
+ <!ELEMENT system_launcher (group+) >
+
+ <!ELEMENT group (launch+) >
+ <!ATTLIST group
+ name CDATA #REQUIRED
+ wait_time CDATA #REQUIRED
+ trigger (True|False) #REQUIRED
+ >
+
+ <!ELEMENT launch EMPTY >
+ <!ATTLIST launch
+ name CDATA #REQUIRED
+ path CDATA #REQUIRED
+ priority CDATA #REQUIRED
+ critical CDATA #REQUIRED
+ retry_cnt CDATA #REQUIRED
+ arguments CDATA #REQUIRED
+ logging_mask CDATA "NULL"
+ restart (me|NULL) #REQUIRED
+ is_start_required (True|False) #REQUIRED
+ shutdown_critical CDATA #REQUIRED
+ shutdown_wait_time CDATA #REQUIRED
+ fast_shutdown_wait_time CDATA #REQUIRED
+ user_name CDATA #REQUIRED
+ env_cond CDATA #IMPLIED
+ >
+
+ <!ENTITY system_launcher_body SYSTEM "system_launcher_body.xml">
+]>
+
+<system_launcher>
+ &system_launcher_body;
+</system_launcher>
diff --git a/systemservice/config/library/system_manager_config/src/Makefile b/systemservice/config/library/system_manager_config/src/Makefile
new file mode 100755
index 0000000..9fbc9cc
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/src/Makefile
@@ -0,0 +1,45 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#HOST TOOLS
+INST_SHLIBS = libsssmcfg
+
+VPATH = ./ ../include/$(COMPONENT_NAME)
+
+INST_HEADERS = ss_system_manager_conf.h
+INST_HEADERS += ss_package.h
+INST_HEADERS += ss_access_if_private.h
+INST_HEADERS += system_manager_config.h
+
+libsssmcfg_SRCS = ss_system_manager_conf.cpp
+
+
+
+CPPFLAGS += -I../include
+
+LDFLAGS += -Wl,--no-as-needed
+
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lSS_RomAccessIf
+LDLIBS += -Wl,-Bdynamic -lssver
+
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lvp
+
+DUMMY_SHLIB += libSS_RomAccessIf.so
+DUMMY_SHLIB += libSS_SystemIfUnified.so
+
+include ../../../../system_service.mk
diff --git a/systemservice/config/library/system_manager_config/src/libsssmcfg.ver b/systemservice/config/library/system_manager_config/src/libsssmcfg.ver
new file mode 100755
index 0000000..4d61996
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/src/libsssmcfg.ver
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libsssmcfg version script
+#
+{
+ global:
+ ### .text section ###
+ extern "C++" {
+ ss_sm_initHook*;
+ ss_sm_avilavbilityHook*;
+ };
+ local:
+ *;
+};
+
diff --git a/systemservice/config/library/system_manager_config/src/ss_system_manager_conf.cpp b/systemservice/config/library/system_manager_config/src/ss_system_manager_conf.cpp
new file mode 100755
index 0000000..16ec02a
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/src/ss_system_manager_conf.cpp
@@ -0,0 +1,489 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fstream>
+#include <string.h>
+#include <agl_thread.h>
+#include <other_service/VP_GetEnv.h>
+
+#include <system_service/ss_templates.h>
+#include <system_service/ss_sm_ram_access.h>
+#include <system_service/ss_ver.h>
+
+#include "system_service/ss_package.h"
+#include "system_service/ss_access_if_private.h"
+#include "system_service/ss_system_manager_conf.h"
+
+#ifndef ZONE_WARN
+#define ZONE_WARN ZONEMASK(30)
+#endif
+#ifndef ZONE_INFO
+#define ZONE_INFO ZONEMASK(29)
+#endif
+
+/* Environment variable name */
+const CHAR LaunchConfigFileNameEnvVariable[] = "APPS_CONFIG_FILENAME";
+const CHAR AreaTypeEnvVariable[] = "VEHICLEPARAMETERLIBRARY_AREA";
+const CHAR BrandTypeEnvVariable[] = "VEHICLEPARAMETERLIBRARY_BRAND";
+const CHAR GradeEnvVariable[] = "VP_VEHICLEPARAMETERLIBRARY_grade";
+
+/* Environment variable value */
+const CHAR EnvValueYes[] = "y";
+const CHAR EnvValueNo[] = "n";
+
+const CHAR EnvValueAvailable[] = "available";
+const CHAR EnvValueUnavailable[] = "unavailable";
+
+/*
+ * Note.
+ * Define areas, brands, and grades by the vendor.
+ * For example, an area is a destination of a product.
+ * Examples of areas : JP(Japan), EU, etc.
+ */
+const CHAR EnvValueArea1[] = "Area1";
+const CHAR EnvValueArea2[] = "Area2";
+const CHAR EnvValueArea3[] = "Area3";
+const CHAR EnvValueArea4[] = "Area4";
+const CHAR EnvValueBrand1[] = "Brand1";
+const CHAR EnvValueBrand2[] = "Brand2";
+const CHAR EnvValueGrade1[] = "Grade1";
+const CHAR EnvValueGrade2[] = "Grade2";
+const CHAR EnvValueGrade3[] = "Grade3";
+
+/* Package information */
+const CHAR PkgInfoGen2[] = "Gen2";
+
+
+typedef struct T_SS_SM_CONF_CTX {
+ EFrameworkunifiedStatus (*cbRebootNoticeFunc)(HANDLE hApp);
+ T_SS_SM_CONF_CTX()
+ : cbRebootNoticeFunc(NULL) {
+ }
+} T_SS_SM_CONF_CTX_INFO;
+
+static T_SS_SM_CONF_CTX_INFO s_confCtx;
+
+/***********************************************************************
+ * registProtectSvcs
+ ***********************************************************************/
+static void registProtectSvcs(std::vector<std::string> & protectedSvcs) {
+ protectedSvcs.push_back(MN_NS_SHAREDMEM);
+ protectedSvcs.push_back(MN_NS_NPPSERVICE);
+ protectedSvcs.push_back(MN_NS_BACKUPMGR);
+ protectedSvcs.push_back(MN_SS_LOGGERSRV);
+ protectedSvcs.push_back(MN_COMMUNICATION);
+ protectedSvcs.push_back(MN_PS_PSMSHADOW);
+ protectedSvcs.push_back(MN_SS_POWERSERVICE);
+}
+
+/***********************************************************************
+ * registGroupRelaunchSvcs
+ ***********************************************************************/
+static void registGroupRelaunchSvcs(
+ std::vector<std::string> & groupRelaunchSvcs) {
+ groupRelaunchSvcs.push_back(MN_ENFORMSERVICE);
+ groupRelaunchSvcs.push_back(MN_NAVIPROXY);
+ groupRelaunchSvcs.push_back(MN_AWBPROXY);
+ groupRelaunchSvcs.push_back(MN_TFFPROXY);
+ groupRelaunchSvcs.push_back(MN_AWNPRIMARY);
+ groupRelaunchSvcs.push_back(MN_AWMPRIMARY);
+ groupRelaunchSvcs.push_back(MN_AWBPRIMARY);
+ groupRelaunchSvcs.push_back(MN_AWTPRIMARY);
+}
+
+/***********************************************************************
+ * setEvnVariableForLaunchConfigFile
+ ***********************************************************************/
+static EFrameworkunifiedStatus setEvnVariableForLaunchConfigFile(std::string f_sEnvFile,
+ std::string f_sEnvBrand,
+ std::string f_sEnvGrade,
+ BOOL f_bIsVup) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ const CHAR VupLaunchConfigFileName[] = "sm_launch_vup.cfg";
+ const CHAR LaunchConfigFileName1[] = "sm_launch.cfg";
+ const CHAR LaunchConfigFileName2[] = "sm_launch.cfg";
+
+ // If an environment variable is set, that value is used, so set only when it is not set
+ if (f_sEnvFile.empty()) {
+ const CHAR *l_pLaunchConfigFile = NULL;
+
+ if (f_bIsVup) {
+ l_pLaunchConfigFile = VupLaunchConfigFileName;
+ } else {
+ // Change the file read by Brand and Grade
+ if ((f_sEnvBrand == EnvValueBrand2) && (f_sEnvGrade != EnvValueGrade1)) {
+ l_pLaunchConfigFile = LaunchConfigFileName1;
+ } else {
+ l_pLaunchConfigFile = LaunchConfigFileName2;
+ }
+
+ std::string cnfPath = "/usr/agl/conf/BS/ss/system_manager/rwdata/";
+ cnfPath += l_pLaunchConfigFile;
+ if (access(cnfPath.c_str(), F_OK) != 0) {
+ l_pLaunchConfigFile = LaunchConfigFileName1;
+ }
+ }
+
+ if (0 != setenv(LaunchConfigFileNameEnvVariable, l_pLaunchConfigFile, 1)) {
+ SS_ASERT_ERRNO(0);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ return l_eStatus;
+}
+
+/***********************************************************************
+ * setEvnVariableForLaunchCus
+ ***********************************************************************/
+static EFrameworkunifiedStatus setEvnVariableForLaunchCus(std::string f_sEnvArea) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ const CHAR LaunchCusEnvVariable[] = "SM_CONF_LAUNCH_CUS";
+
+ const CHAR *l_pSetValue =
+ (EnvValueArea1 == f_sEnvArea || EnvValueArea2 == f_sEnvArea) ?
+ EnvValueYes : EnvValueNo;
+
+ if (0 != setenv(LaunchCusEnvVariable, l_pSetValue, 1)) {
+ SS_ASERT_ERRNO(0);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+/***********************************************************************
+ * setEvnVariableForLaunchTFF
+ ***********************************************************************/
+static EFrameworkunifiedStatus setEvnVariableForLaunchTFF(std::string f_sEnvArea) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ const CHAR LaunchTFFEnvVariable[] = "SM_CONF_LAUNCH_TFF";
+
+ const CHAR *l_pSetValue = EnvValueNo;
+
+ BOOL l_bArea1 = (f_sEnvArea == EnvValueArea1) ? TRUE : FALSE;
+ BOOL l_bArea2 = (f_sEnvArea == EnvValueArea2) ? TRUE : FALSE;
+
+ if (l_bArea1 || l_bArea2) {
+ l_pSetValue = EnvValueYes;
+ } else {
+ l_pSetValue = EnvValueNo;
+ }
+
+ if (0 != setenv(LaunchTFFEnvVariable, l_pSetValue, 1)) {
+ SS_ASERT_ERRNO(0);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+/***********************************************************************
+ * getEnvValiavleWithDefault
+ ***********************************************************************/
+static std::string getEnvValiavleWithDefault(const CHAR *f_pEnvName,
+ const CHAR *f_pDefault) {
+ std::string l_sReturnValue;
+ char buf[VP_MAX_LENGTH];
+
+ VP_GetEnv(f_pEnvName, buf);
+ if (buf[0] == '\0') {
+ l_sReturnValue = (NULL != f_pDefault) ? f_pDefault : "";
+ } else {
+ l_sReturnValue = buf;
+ }
+ return l_sReturnValue;
+}
+
+
+/***********************************************************************
+ * getPkgInfoWithDefault
+ ***********************************************************************/
+static std::string
+getPkgInfoWithDefault(const CHAR *f_pPkgName, const CHAR *f_pDefault){
+ std::string l_sReturnValue = (NULL != f_pDefault) ? f_pDefault : "";
+
+ try {
+ SSVER_PkgInfo pkgInfo = {0};
+ CSSVer cVersion;
+
+ if(!cVersion.empty()){
+ EFrameworkunifiedStatus ret = cVersion.getPkgInfo(f_pPkgName, &pkgInfo);
+ if((ret == eFrameworkunifiedStatusOK) && ('\0' != pkgInfo.version[0])){
+ l_sReturnValue = pkgInfo.version;
+ }
+ }
+ } catch(EFrameworkunifiedStatus ee){
+ SS_ASERT(0);
+ }
+
+ return l_sReturnValue;
+}
+
+/***********************************************************************
+ * setEvnVariableForPkgSeriesInfo
+ ***********************************************************************/
+static EFrameworkunifiedStatus
+setEvnVariableForPkgSeriesInfo(std::string f_sPkgSeriesInfo){
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ const CHAR PkgSeriesEnvVariable[] = "SM_CONF_PKG_SERIES";
+
+ if (f_sPkgSeriesInfo.empty()) {
+ SS_ASERT(0);
+ }
+
+ if (0 != setenv(PkgSeriesEnvVariable, f_sPkgSeriesInfo.c_str(), 1)) {
+ SS_ASERT_ERRNO(0);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+/***********************************************************************
+ * setVersionInfo subfunction(version,date settings)
+ ***********************************************************************/
+static EFrameworkunifiedStatus setVerInfo_version_date(const char* VerPath) {
+ EFrameworkunifiedStatus configRet = eFrameworkunifiedStatusOK;
+ CSSVer ver;
+ SSVER_PkgInfo pkgInfo;
+
+ bzero(&pkgInfo, sizeof(pkgInfo));
+ std::string line;
+ std::ifstream verFin(VerPath);
+ if (verFin) {
+ if (std::getline(verFin, line)) {
+ snprintf(pkgInfo.version, sizeof(pkgInfo.version), "%s",
+ line.c_str());
+ }
+
+ if (std::getline(verFin, line)) {
+ snprintf(pkgInfo.date, sizeof(pkgInfo.date), "%s", line.c_str());
+ }
+
+ configRet = ver.setPkgInfo(SS_PKG_MAIN_LPF_SI, pkgInfo);
+ SS_ASERT(configRet == eFrameworkunifiedStatusOK);
+ } else {
+ SS_ASERT_ERRNO(0);
+ }
+ return configRet;
+}
+
+/***********************************************************************
+ * Set version information
+ ***********************************************************************/
+static EFrameworkunifiedStatus setVersionInfo(void) {
+ EFrameworkunifiedStatus configRet = eFrameworkunifiedStatusOK;
+
+ try {
+ CSSVer ver;
+ SSVER_PkgInfo pkgInfo;
+ const char targetEnv[] = "TARGET_BOARD";
+
+ // HARDWARE
+ snprintf(pkgInfo.version, sizeof(pkgInfo.version), "%s",
+ getEnvValiavleWithDefault(targetEnv, NULL).c_str());
+ pkgInfo.date[0] = '\0';
+ configRet = ver.setPkgInfo(SS_PKG_TARGETBOARD, pkgInfo);
+ SS_ASERT(configRet == eFrameworkunifiedStatusOK);
+
+ // Set PRODUCT version information
+ const char prdVersion[] = "/usr/agl/share/BS/ss/system_manager/rodata/version.txt";
+ {
+ std::string line;
+ std::ifstream prdFin(prdVersion);
+ if (prdFin) {
+ bzero(&pkgInfo, sizeof(pkgInfo));
+ if (std::getline(prdFin, line)) {
+ snprintf(pkgInfo.version, sizeof(pkgInfo.version), "%s",
+ line.c_str());
+ }
+ configRet = ver.setPkgInfo(SS_PKG_MAIN_EMMC, pkgInfo);
+ SS_ASERT(configRet == eFrameworkunifiedStatusOK);
+
+ bzero(&pkgInfo, sizeof(pkgInfo));
+ if (std::getline(prdFin, line)) {
+ snprintf(pkgInfo.version, sizeof(pkgInfo.version), "%s",
+ line.c_str());
+ }
+ configRet = ver.setPkgInfo(SS_PKG_MAIN_PRODUCT_SI, pkgInfo);
+ SS_ASERT(configRet == eFrameworkunifiedStatusOK);
+ } else {
+ SS_ASERT_ERRNO(0);
+ }
+ }
+
+ // PHASE_INFO
+ const char phaseVersion[] = "/usr/agl/share/BS/ss/system_manager/rodata/PhaseInfo.txt";
+ {
+ configRet = setVerInfo_version_date(phaseVersion);
+ }
+
+ } catch (EFrameworkunifiedStatus ee) {
+ SS_ASERT(0);
+ configRet = ee;
+ }
+ return configRet;
+}
+
+// If _CWORD83_ common header is added, replace with century definition
+#define NTFY_PSMShadowService_Availability MN_PS_PSMSHADOW"/Availability"
+
+EFrameworkunifiedStatus cbPsmNotificationFunc(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (MSG_PSM_REBOOT_NOTIFY != FrameworkunifiedGetMsgProtocol(hApp)) {
+ SS_ASERT(0);
+ goto ERROR;
+ }
+
+ if (NULL != s_confCtx.cbRebootNoticeFunc) {
+ l_eStatus = s_confCtx.cbRebootNoticeFunc(hApp);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ SS_ASERT(0);
+ goto ERROR;
+ }
+ } else {
+ SS_ASERT(0);
+ goto ERROR;
+ }
+
+ERROR:
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus cbServiceNotificationFunc(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ PCSTR l_availabilityName;
+ BOOL l_serviceAvailability;
+
+ l_availabilityName = FrameworkunifiedGetLastNotification(hApp);
+ if (l_availabilityName == NULL) {
+ SS_ASERT(0);
+ goto ERROR;
+ }
+ l_serviceAvailability = FrameworkunifiedIsServiceAvailable(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s : %s", l_availabilityName,
+ l_serviceAvailability ? "TRUE" : "FALSE");
+
+ // Since it is necessary to guarantee SYNC of RAMD at _CWORD71_
+ // within 200msec after receiving reboot notice from SYS mcu,
+ // do UMOUNT RAMD immediately after receiving reboot notice by SystemManager.
+ if ((strcmp(NTFY_PSMShadowService_Availability, l_availabilityName) == 0)
+ && (l_serviceAvailability)) {
+ l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE,
+ MSG_PSM_REBOOT_NOTIFY,
+ cbPsmNotificationFunc);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ SS_ASERT(0);
+ goto ERROR;
+ }
+ }
+
+ERROR:
+ return l_eStatus;
+}
+
+/***********************************************************************
+ * ss_sm_initHook
+ ***********************************************************************/
+EFrameworkunifiedStatus ss_sm_initHook(HANDLE hApp, const T_SS_SM_INIT_HOOK_IN_PARAM *inPrm,
+ T_SS_SM_INIT_HOOK_OUT_PARAM *outPrm) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_sEnvFile;
+ std::string l_sEnvArea;
+ std::string l_sEnvBrand;
+ std::string l_sEnvGrade;
+
+ std::string l_sPkgSeriesInfo;
+
+ // Register non-recoverable services for OOM Killer
+ registProtectSvcs(outPrm->protectedSvcs);
+
+ // Register services for Group Relaunch
+ registGroupRelaunchSvcs(outPrm->groupRelaunchSvcs);
+
+ if (NULL == inPrm->cbRebootNoticeFunc) {
+ SS_ASERT(0);
+ } else {
+ s_confCtx.cbRebootNoticeFunc = inPrm->cbRebootNoticeFunc;
+ }
+
+ /** Set Version information **/
+ if (eFrameworkunifiedStatusOK != setVersionInfo()) {
+ SS_ASERT(0);
+ }
+
+ /** Get environment variable **/
+
+ // APPS_CONFIG_FILENAME (not set by default)
+ l_sEnvFile = getEnvValiavleWithDefault(LaunchConfigFileNameEnvVariable, NULL);
+
+ // VEHICLEPARAMETERLIBRARY_AREA
+ l_sEnvArea = getEnvValiavleWithDefault(AreaTypeEnvVariable, EnvValueArea1);
+
+ // VEHICLEPARAMETERLIBRARY_BRAND
+ l_sEnvBrand = getEnvValiavleWithDefault(BrandTypeEnvVariable, NULL);
+
+ // VEHICLEPARAMETERLIBRARY_grade
+ l_sEnvGrade = getEnvValiavleWithDefault(GradeEnvVariable, NULL);
+
+
+ /** Get Package information **/
+
+ // SERIES_INFO
+ l_sPkgSeriesInfo = getPkgInfoWithDefault(SS_PKG_SERIES_INFO, NULL);
+
+
+ /** Set environment variable **/
+ // APPS_CONFIG_FILENAME
+ if (eFrameworkunifiedStatusOK
+ != setEvnVariableForLaunchConfigFile(l_sEnvFile, l_sEnvBrand,
+ l_sEnvGrade, inPrm->bIsVupMode)) {
+ SS_ASERT(0);
+ }
+
+ // SM_CONF_PKG_SERIES
+ if (eFrameworkunifiedStatusOK != setEvnVariableForPkgSeriesInfo(l_sPkgSeriesInfo)) {
+ SS_ASERT(0);
+ }
+
+
+ // SM_CONF_LAUNCH_CUS
+ if (eFrameworkunifiedStatusOK != setEvnVariableForLaunchCus(l_sEnvArea)) {
+ SS_ASERT(0);
+ }
+
+ // SM_CONF_LAUNCH_TFF
+ if (eFrameworkunifiedStatusOK
+ != setEvnVariableForLaunchTFF(l_sEnvArea)) {
+ SS_ASERT(0);
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(
+ hApp, NTFY_PSMShadowService_Availability, cbServiceNotificationFunc))) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error: FrameworkunifiedSubscribeNotificationWithCallback(" "hApp, %s) errored: %d/'%s'",
+ NTFY_PSMShadowService_Availability, l_eStatus, GetStr(l_eStatus).c_str());
+ }
+
+ return l_eStatus;
+}
+
diff --git a/systemservice/config/library/system_manager_config/xml/Makefile b/systemservice/config/library/system_manager_config/xml/Makefile
new file mode 100755
index 0000000..e11288c
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/xml/Makefile
@@ -0,0 +1,53 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#HOST TOOLS
+HOST_CPP = cpp
+HOST_LAUNCH_XML2CFG = ./launch_xml2cfg.sh
+
+CONF_DIR = $(SDKTARGETSYSROOT)/usr/agl/conf
+CONF_THREAD_H = $(SDKTARGETSYSROOT)/usr/agl/include/agl_thread.h
+
+LAUNCH_XMLFILES = $(shell cd $(CONF_DIR)/sm_launch; ls *.xml)
+LAUNCH_CFGFILES = $(LAUNCH_XMLFILES:%.xml=%.cfg)
+
+INST_CONFDIR = $(SDKTARGETSYSROOT)/usr/agl/conf/systemmanager
+
+CLEAN_FILES = system_launcher_body.xml $(LAUNCH_CFGFILES)
+
+VPATH = $(CONF_DIR)/sm_launch
+
+install:install-pre install-cfg
+
+install-pre:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf;\
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/sm_launch;\
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/systemmanager;\
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/sm_launch sm_launch_agl.xml
+
+install-cfg:$(LAUNCH_CFGFILES)
+ set -e ;\
+ install -d -m 775 $(INST_CONFDIR) ;\
+ for cfgfile in $(LAUNCH_CFGFILES);do \
+ install -m 644 -t $(INST_CONFDIR) $$cfgfile;\
+ done ;\
+
+#Create CFG file
+# %.cfg:%.xml # defined in agl.mk
+
+PHONY:install-cfg
+
+include ../../../../system_service.mk
diff --git a/systemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh b/systemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh
new file mode 100755
index 0000000..57b6ee2
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+#
+# Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+export infile=$1
+export g_group=1
+
+if ! [[ "$infile" =~ .+\.cfg ]] ;then
+ echo "$infile is not *.cfg"
+ exit 1
+elif ! [ -e $infile ];then
+ echo "$infile not found"
+ exit 1
+fi
+
+#GROUP extraction
+cat ${infile} | while read line
+do
+ if ! [[ "${line}" =~ ^[#\[] ]]; then #Remove first #[
+ echo $line | sed 's/Launch[0-9]\+=//g' | cut -d '|' -f1-4
+ fi
+done | uniq | while read line
+do
+ echo "<!-- group_id=$g_group -->"
+ echo "<group name=\"`echo $line | cut -d '|' -f1`\" wait_time=\"`echo $line | cut -d '|' -f3`\" trigger=\"`echo $line | cut -d '|' -f4`\" >"
+
+ cat ${infile} | while read line
+ do
+ if ! [[ "${line}" =~ ^[#\[] ]]; then #Remove first #[
+ l_group=`echo $line | sed 's/Launch[0-9]\+=//g' | cut -d '|' -f2`
+
+ #Extract only LAUNCH applicable to g_group
+ if [ ${l_group} = ${g_group} ]; then
+ echo $line | sed 's/Launch[0-9]\+=//g' | cut -d '|' -f5-
+ fi
+ fi
+ done | while read line
+ do
+ echo " <launch "
+ echo " name=\"`echo $line | cut -d '|' -f1`\" path=\"`echo $line | cut -d '|' -f2`\" priority=\"`echo $line | cut -d '|' -f3`\""
+ echo " critical=\"`echo $line | cut -d '|' -f4`\" retry_cnt=\"`echo $line | cut -d '|' -f5`\" arguments=\"`echo $line | cut -d '|' -f6`\""
+ echo " logging_mask=\"`echo $line | cut -d '|' -f7`\" restart=\"`echo $line | cut -d '|' -f8`\" is_start_required=\"`echo $line | cut -d '|' -f9`\""
+ echo " shutdown_critical=\"`echo $line | cut -d '|' -f10`\" shutdown_wait_time=\"`echo $line | cut -d '|' -f11`\" fast_shutdown_wait_time=\"`echo $line | cut -d '|' -f12`\""
+ echo " user_name=\"`echo $line | cut -d '|' -f13`\""
+ echo " />"
+ done
+
+ echo "</group>"
+
+ g_group=$(($g_group + 1))
+done
+
+
+
+
diff --git a/systemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh b/systemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh
new file mode 100755
index 0000000..20fa097
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh
@@ -0,0 +1,116 @@
+#!/bin/bash
+
+#
+# Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#xpath is slow, so use sed as much as possible
+
+infile=$1
+
+main_file=system_launcher_main.xml
+body_file=system_launcher_body.xml
+
+
+#check xmllint is exist
+if ! which xmllint > /dev/null ; then
+ echo "It need xmllint. Please install it."
+ exit 1;
+fi
+
+#check xpath is exist
+if ! which xpath > /dev/null ; then
+ echo "It need xpath Please install it."
+ exit 1;
+fi
+
+#arg check
+if ! [[ "$infile" =~ .+\.xml ]] ;then
+ echo "$infile is not *.xml"
+ exit 1
+elif ! [ -e $infile ];then
+ echo "$infile not found"
+ exit 1
+fi
+
+cp -f $infile $body_file
+
+#check xml vaild
+if ! xmllint --noout --valid $main_file ;then
+ echo "XML is Invalid. "
+ exit 1;
+fi
+
+#Read into memory after shaping with xpath
+xmem=`xpath -q -e /system_launcher $main_file`
+
+echo "# This file is created from $infile."
+echo "# created date : `LANG=en date`"
+echo "[ModulesLaunchConfig]"
+
+#GROUP LOOP
+group_num=`echo $xmem | xpath -e /system_launcher/group 2>&1 | grep Found | cut -d ' ' -f2`
+
+l_idx=1
+cur_group=1
+until [ $cur_group -gt $group_num ];
+do
+ #LAUNCH LOOP
+ group_text=`echo $xmem | xpath -q -e /system_launcher/group[$cur_group]` #group full XML text
+ group_attr=`echo $group_text | sed 's/\(<group[^>]\+>\)\(.*\)/\1/g'`
+
+ g_name=`echo $group_attr | sed 's/\(.* name="\)\([^"]*\)\(.*\)/\2/g'`
+ g_wait_time=`echo $group_attr | sed 's/\(.* wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ g_trigger=`echo $group_attr | sed 's/\(.* trigger="\)\([^"]*\)\(.*\)/\2/g'`
+
+# echo $g_name $g_wait_time $g_trigger
+ l_launch_num=`echo $xmem | xpath -e /system_launcher/group[$cur_group]/launch 2>&1 | grep Found | cut -d ' ' -f2`
+
+ cur_launch=1;
+ until [ $cur_launch -gt $l_launch_num ]; do
+ launch_text=`echo $xmem | xpath -q -e /system_launcher/group[$cur_group]/launch[$cur_launch]`
+
+ l_attr="Launch${l_idx}=$g_name|$cur_group|$g_wait_time|$g_trigger"
+ l_attr+="|"`echo $launch_text | sed 's/\(.* name="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* path="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* priority="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* critical="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* retry_cnt="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* arguments="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* logging_mask="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* restart="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* is_start_required="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* shutdown_critical="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* shutdown_wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* fast_shutdown_wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* user_name="\)\([^"]*\)\(.*\)/\2/g'`
+ if echo "$launch_text" | grep -sq 'env_cond=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* env_cond="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|"
+ fi
+
+ echo $l_attr
+
+ cur_launch=$(($cur_launch+1))
+ l_idx=$(($l_idx+1))
+ done
+
+ cur_group=$(($cur_group+1))
+done
+
+
+
+
diff --git a/systemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg b/systemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg
new file mode 100755
index 0000000..876ab41
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg
@@ -0,0 +1,7 @@
+# This file is created from sm_launch_agl.xml.tmp.
+# created date : Tue Aug 29 13:31:32 JST 2017
+[ModulesLaunchConfig]
+Launch1=CoreModules|1|0|False|NS_NPPService|/usr/agl/bin/NS_NPPService|25|True|0|-a SS_SysManager -r output=0x2|NULL|NULL|False|True|20|1000||
+Launch2=CoreModules|1|0|False|NS_BackupMgr|/usr/agl/bin/NS_BackupMgr|25|True|0|-l console|NULL|NULL|True|True|15|1000||
+Launch3=SS_Logger|2|0|False|SS_DevDetectSrv|/tmp/SS_DeviceDetectionService|20|True|0|-l console|NULL|NULL|True|False|1|1000||
+Launch4=SS_Logger|2|0|False|SS_LoggerSrv|/usr/agl/bin/SS_LoggerService|0|True|0|-l console -p thrd=pdg.LogQueReader:30,thrd=pdg.TransmitQueReader:30,thrd=pdg.DumpQueReader:11,thrd=pdg.PerformanceQueReader:11,thrd=pdg.LogQueWriter:30,thrd=pdg.TransmitQueWriter:30,thrd=pdg.EvntLogQue:8,thrd=pdg.UdpQueWriter:10|NULL|NULL|True|True|10|1000||
diff --git a/systemservice/config/library/system_manager_config/xml/sm_launch_agl.xml b/systemservice/config/library/system_manager_config/xml/sm_launch_agl.xml
new file mode 100755
index 0000000..a433be3
--- /dev/null
+++ b/systemservice/config/library/system_manager_config/xml/sm_launch_agl.xml
@@ -0,0 +1,35 @@
+<!-- group_id=1 -->
+<group name="CoreModules" wait_time="0" trigger="False" >
+ <launch
+ name="NS_NPPService" path="/usr/agl/bin/NS_NPPService" priority="25"
+ critical="True" retry_cnt="0" arguments="-a SS_SysManager -r output=0x2"
+ logging_mask="NULL" restart="NULL" is_start_required="False"
+ shutdown_critical="True" shutdown_wait_time="20" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+ <launch
+ name="NS_BackupMgr" path="/usr/agl/bin/NS_BackupMgr" priority="25"
+ critical="True" retry_cnt="0" arguments="-l console"
+ logging_mask="NULL" restart="NULL" is_start_required="True"
+ shutdown_critical="True" shutdown_wait_time="15" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+<!-- group_id=2 -->
+<group name="SS_Logger" wait_time="0" trigger="False" >
+ <launch
+ name="SS_DevDetectSrv" path="/tmp/SS_DeviceDetectionService" priority="20"
+ critical="True" retry_cnt="0" arguments="-l console"
+ logging_mask="NULL" restart="NULL" is_start_required="True"
+ shutdown_critical="False" shutdown_wait_time="1" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+ <launch
+ name="SS_LoggerSrv" path="/usr/agl/bin/SS_LoggerService" priority="0"
+ critical="True" retry_cnt="0" arguments="-l console -p thrd=pdg.LogQueReader:30,thrd=pdg.TransmitQueReader:30,thrd=pdg.DumpQueReader:11,thrd=pdg.PerformanceQueReader:11,thrd=pdg.LogQueWriter:30,thrd=pdg.TransmitQueWriter:30,thrd=pdg.EvntLogQue:8,thrd=pdg.UdpQueWriter:10"
+ logging_mask="NULL" restart="NULL" is_start_required="True"
+ shutdown_critical="True" shutdown_wait_time="10" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+
diff --git a/systemservice/interface_unified/LICENSE b/systemservice/interface_unified/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/systemservice/interface_unified/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/systemservice/interface_unified/Makefile.client b/systemservice/interface_unified/Makefile.client
new file mode 100755
index 0000000..de16e15
--- /dev/null
+++ b/systemservice/interface_unified/Makefile.client
@@ -0,0 +1,33 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := library
+
+install:install_cfg install_cfg_pram
+
+install_cfg_pram:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ss/system_manager/rwdata
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ss/system_manager/rwdata scfg_pram/gpf_ss_sm_config_data.cfg
+
+install_cfg:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ss/power_service/rodata
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ss/power_service/rodata scfg/gpf_ss_ps_config.cfg
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ss/logger_service/rodata
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ss/logger_service/rodata scfg/ss_logger.cfg
+
+include ../system_service.mk
+
+.PHONY:install_cfg install_cfg_pram
diff --git a/systemservice/interface_unified/library/Makefile b/systemservice/interface_unified/library/Makefile
new file mode 100755
index 0000000..e784550
--- /dev/null
+++ b/systemservice/interface_unified/library/Makefile
@@ -0,0 +1,127 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# installed shared library(.so)
+INST_SHLIBS := libSS_SystemIfUnified
+
+# compiled sources
+libSS_SystemIfUnified_SRCS := ss_framework_if.cpp \
+ ss_heartbeat_client.cpp \
+ ss_sm_client.cpp \
+ ss_string_maps.cpp \
+ ss_system_process.cpp \
+ ss_system_timer.cpp \
+ ss_last_to_order.cpp
+libSS_SystemIfUnified_SRCS += ss_devicedetection_service_ifc.cpp
+libSS_SystemIfUnified_SRCS += ss_logger_service_ifc.cpp
+libSS_SystemIfUnified_SRCS += ss_power_client.cpp \
+ ss_pwrsvc_if.cpp
+
+# additional source path
+VPATH += ./src
+VPATH += ./include/$(COMPONENT_NAME)
+
+# installed headers
+INST_HEADERS = interface_unified.h
+INST_HEADERS += interfaceunified_system_application.h \
+ interfaceunified_system_types.h \
+ ss_client_names.h \
+ ss_devicedetection_service.h \
+ ss_devicedetection_service_ifc.h \
+ ss_devicedetection_service_notifications.h \
+ ss_devicedetection_service_protocol.h \
+ ss_devicedetection_service_types.h \
+ ss_error_event_common.h \
+ ss_error_message.h \
+ ss_heartbeat_if.h \
+ ss_heartbeat_notifications.h \
+ ss_heartbeat_service_protocol.h \
+ ss_logger_service.h \
+ ss_logger_service_ifc.h \
+ ss_logger_service_notifications.h \
+ ss_logger_service_protocol.h \
+ ss_power_service_if.h \
+ ss_power_service_notifications.h \
+ ss_power_service_protocol.h \
+ ss_power_service.h \
+ ss_services.h \
+ ss_sm_client_if.h \
+ ss_sys_boot_area_map.h \
+ ss_sm_thread_names.h \
+ ss_string_maps.h \
+ ss_system_if.h \
+ ss_system_manager_if.h \
+ ss_system_manager_notifications.h \
+ ss_system_manager_protocol.h \
+ ss_system_process.h \
+ ss_system_timer.h \
+ ss_system_types.h \
+ ss_boot_map.h \
+ ss_templates.h \
+ ss_test_clients.h \
+ ss_version.h \
+ ss_last_to_order.h
+INST_HEADERS += ss_logger_store_logs.h
+INST_HEADERS += ss_devicedetection_service_local.h \
+ ss_devicedetection_service_protocol_local.h \
+ ss_devicedetection_service_types_local.h \
+ ss_error_event_common_local.h \
+ ss_sm_client_if_local.h \
+ ss_sm_thread_names_local.h \
+ ss_system_manager_if_local.h \
+ ss_system_manager_notifications_local.h \
+ ss_system_manager_protocol_local.h \
+ ss_logger_service_local.h \
+ ss_power_service_local.h \
+ ss_power_service_notifications_local.h
+
+
+
+# additional include path
+CPPFLAGS += -I./include/
+CPPFLAGS += -I../../rom_access_library/library/include/
+
+# additional compile option
+CPPFLAGS += -DLINUX -fdata-sections -ffunction-sections
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+
+CPPFLAGS_ss_devicedetection_service_ifc.os = -fno-exceptions
+CPPFLAGS_ss_logger_service_ifc.os = -fno-exceptions
+CPPFLAGS_ss_system_timer.os = -fno-exceptions
+CPPFLAGS_ss_string_maps.os = -fno-exceptions
+CPPFLAGS_ss_client_session.os = -fno-exceptions
+CPPFLAGS_ss_framework_if.os = -fno-exceptions
+CPPFLAGS_ss_ss_heartbeat_client.os = -fno-exceptions
+CPPFLAGS_ss_parameter.os = -fno-exceptions
+CPPFLAGS_ss_parameter_map.os = -fno-exceptions
+CPPFLAGS_ss_str_stream.os = -fno-exceptions
+CPPFLAGS_ss_system_config_reader.os = -fno-exceptions
+CPPFLAGS_ss_system_shared_memory.os = -fno-exceptions
+CPPFLAGS_ss_plm_if.os = -fno-exceptions
+CPPFLAGS_ss_power_client.os = -fno-exceptions
+CPPFLAGS_ss_pwrsvc_if.os = -fno-exceptions
+
+LDFLAGS += -Wl,--no-as-needed
+
+# linked libraries
+LDLIBS += -Wl,-Bdynamic
+LDLIBS += -Wl,-Bdynamic
+LDLIBS += -Wl,-Bdynamic -lstdc++
+
+LDFLAGS += -g -Wl,--gc-sections -shared
+
+
+include ../../system_service.mk
diff --git a/systemservice/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h b/systemservice/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h
new file mode 100755
index 0000000..62f32b9
--- /dev/null
+++ b/systemservice/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_DeviceDetection
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_DEVICEDETECTION_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_DEVICEDETECTION_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR
+#endif // FRAMEWORKUNIFIEDLOGAPPZONES
+
+extern const CHAR AppName[];
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_DEVICEDETECTION_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
diff --git a/systemservice/interface_unified/library/include/ss_last_to_order_local.h b/systemservice/interface_unified/library/include/ss_last_to_order_local.h
new file mode 100755
index 0000000..889a733
--- /dev/null
+++ b/systemservice/interface_unified/library/include/ss_last_to_order_local.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_last_to_order_local.h
+ * @brief \~english This file contains declaration of SS_LAST_TO_ORDER_CONF_PATH
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LAST_TO_ORDER_LOCAL_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LAST_TO_ORDER_LOCAL_H_
+
+#include <string>
+
+#define SS_LAST_TO_ORDER_CONF_PATH "/usr/agl/conf/BS/ss/system_manager/rodata/sm_last2order.cfo"
+
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LAST_TO_ORDER_LOCAL_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h b/systemservice/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h
new file mode 100755
index 0000000..8989bf6
--- /dev/null
+++ b/systemservice/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_Logger
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LOGGER_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LOGGER_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR
+#endif
+
+extern const CHAR AppName[];
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LOGGER_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
diff --git a/systemservice/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h b/systemservice/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h
new file mode 100755
index 0000000..d198030
--- /dev/null
+++ b/systemservice/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerServiceIf
+/// \brief This file supports 002 application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_POWER_IF_INTERFACEUNIFIEDLOG_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_POWER_IF_INTERFACEUNIFIEDLOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT, LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern const CHAR AppName[];
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_POWER_IF_INTERFACEUNIFIEDLOG_H_
diff --git a/systemservice/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h b/systemservice/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h
new file mode 100755
index 0000000..81ef016
--- /dev/null
+++ b/systemservice/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_IF_INTERFACEUNIFIEDLOG_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_IF_INTERFACEUNIFIEDLOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern const CHAR AppName[];
+
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_IF_INTERFACEUNIFIEDLOG_H_
diff --git a/systemservice/interface_unified/library/include/ss_system_timer_local.h b/systemservice/interface_unified/library/include/ss_system_timer_local.h
new file mode 100755
index 0000000..d694bdd
--- /dev/null
+++ b/systemservice/interface_unified/library/include/ss_system_timer_local.h
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_system_timer_local.h
+ * @brief \~english This file supports a generic timer abstraction.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_TIMER_LOCAL_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_TIMER_LOCAL_H_
+
+enum {
+ NS_PER_MS = 1000000,
+ DEFAULT_TIMERID = 1000,
+ DEFAULT_NTIMERS = 10,
+};
+
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_TIMER_LOCAL_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/interface_unified.h b/systemservice/interface_unified/library/include/system_service/interface_unified.h
new file mode 100755
index 0000000..a25423a
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/interface_unified.h
@@ -0,0 +1,100 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file interface_unified.h
+ * @brief \~english include all interface_unified head files
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+// include guard
+#ifndef SYSTEMSERVICE_INTERFACEUNIFIED_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_INTERFACEUNIFIED_H_
+
+#include "system_service/interfaceunified_system_application.h"
+#include "system_service/interfaceunified_system_types.h"
+#include "system_service/ss_boot_map.h"
+#include "system_service/ss_client_names.h"
+#include "system_service/ss_devicedetection_service.h"
+#include "system_service/ss_devicedetection_service_ifc.h"
+#include "system_service/ss_devicedetection_service_notifications.h"
+#include "system_service/ss_devicedetection_service_protocol.h"
+#include "system_service/ss_devicedetection_service_types.h"
+#include "system_service/ss_error_event_common.h"
+#include "system_service/ss_error_message.h"
+#include "system_service/ss_heartbeat_if.h"
+#include "system_service/ss_heartbeat_notifications.h"
+#include "system_service/ss_heartbeat_service_protocol.h"
+#include "system_service/ss_last_to_order.h"
+#include "system_service/ss_logger_service.h"
+#include "system_service/ss_logger_service_ifc.h"
+#include "system_service/ss_logger_service_notifications.h"
+#include "system_service/ss_logger_service_protocol.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_sm_client_if.h"
+#include "system_service/ss_sm_thread_names.h"
+#include "system_service/ss_string_maps.h"
+#include "system_service/ss_sys_boot_area_map.h"
+#include "system_service/ss_system_if.h"
+#include "system_service/ss_system_manager_if.h"
+#include "system_service/ss_system_manager_notifications.h"
+#include "system_service/ss_system_manager_protocol.h"
+#include "system_service/ss_system_process.h"
+#include "system_service/ss_system_timer.h"
+#include "system_service/ss_system_types.h"
+#include "system_service/ss_templates.h"
+#include "system_service/ss_test_clients.h"
+#include "system_service/ss_version.h"
+
+// reference from logger_store_logs
+#include "system_service/ss_logger_store_logs.h"
+
+// files with local
+// reference from device_detection_service
+#include "system_service/ss_devicedetection_service_local.h"
+#include "system_service/ss_devicedetection_service_protocol_local.h"
+#include "system_service/ss_devicedetection_service_types_local.h"
+// reference from system_manager
+#include "system_service/ss_error_event_common_local.h"
+#include "system_service/ss_sm_client_if_local.h"
+#include "system_service/ss_sm_thread_names_local.h"
+#include "system_service/ss_system_manager_if_local.h"
+#include "system_service/ss_system_manager_notifications_local.h"
+
+#include "system_service/ss_system_manager_protocol_local.h"
+// reference from logger_service
+#include "system_service/ss_logger_service_local.h"
+
+// reference from power_service
+#include "system_service/ss_power_service_if.h"
+#include "system_service/ss_power_service_notifications.h"
+#include "system_service/ss_power_service_protocol.h"
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_power_service_local.h"
+#include "system_service/ss_power_service_notifications_local.h"
+
+#endif // SYSTEMSERVICE_INTERFACEUNIFIED_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/interfaceunified_system_application.h b/systemservice/interface_unified/library/include/system_service/interfaceunified_system_application.h
new file mode 100755
index 0000000..fe5224e
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/interfaceunified_system_application.h
@@ -0,0 +1,219 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file interfaceunified_system_application.h
+ * @brief This file supports the System Manager AGL framework client
+ * interface.
+ */
+
+#ifndef INTERFACEUNIFIED_SYSTEM_APPLICATION_H_ // NOLINT (build/header_guard)
+#define INTERFACEUNIFIED_SYSTEM_APPLICATION_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#include <native_service/frameworkunified_types.h>
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup InterfaceunifiedSystemConnectToPowerSerivce
+ /// \~english @par Summary
+ /// Subscribe and attach call backs to notifications, to PowerSerivce!
+ /// \~english @param [in] hApp
+ /// HANDLE - App handle
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument.
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded
+ /// the maximum number of Notification.[eFrameworkunifiedStatusFail]
+ /// - The acquisition of the buffer for storing a plurality of information of
+ /// Notification Handler specified by the argument has failed. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue name of HANDLE specified in the argument (hApp)
+ /// is not appropriate(The name is NULL, more than 20byte) [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to the NPP Service.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message
+ /// for the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for the NPP Service.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Subscribe and attach call backs to notifications, to PowerSerivce! \n
+ /// if callback has not subscribe,resubscribe! \n
+ /// if callback has been subscribed,initialize!
+ /// \~english @see FrameworkunifiedGetAppName FrameworkunifiedSubscribeNotificationsWithCallback
+ ////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToPowerSerivce(HANDLE hApp);
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup InterfaceunifiedSystemConnectToPowerSerivce
+ /// \~english @par Summary
+ /// Called from framework for every app to start connection to HeartBeat
+ /// \~english @param [in] hApp
+ /// HANDLE - App handle, Handle to message queue of HeartBeat Service.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified
+ /// in the argument. [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded
+ /// the maximum number of Notification. [eFrameworkunifiedStatusFail]
+ /// - The acquisition of the buffer for storing a plurality of information of
+ /// Notification Handler specified by the argument has failed. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue name of HANDLE specified in the argument (hApp)
+ /// is not appropriate(The name is NULL, more than 20byte) [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+ // [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to the NPP Service.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of
+ /// the session message for the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to the NPP Service.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to the NPP Service.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message
+ /// for the NPP Service. [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Called from framework for every app to start connection to HeartBeat \n
+ /// if app has not connection,reconnection! \n
+ /// if app has been connectioned,initialize it!
+ /// \~english @see FrameworkunifiedGetAppName FrameworkunifiedAttachCallbacksToDispatcher
+ ////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToHeartBeatService(HANDLE hApp);
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup InterfaceunifiedSystemConnectToPowerSerivce
+ /// \~english @par Summary
+ /// Subscribe and attach callbacks to System Manager Service!
+ /// \~english @param [in] hApp
+ /// HANDLE - App handle.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - Pointer (pNtfyHandler) is NULL to the structure of
+ /// the Notification Handler specified in the argument. [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount)
+ /// has exceeded the maximum number of Notification. [eFrameworkunifiedStatusFail]
+ /// - The acquisition of the buffer for storing a plurality of information of
+ /// Notification Handler specified by the argument has failed. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of
+ /// the message for transmission (malloc). [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument message queue HANDLE in (hApp)
+ /// is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue name of HANDLE specified in the argument (hApp)
+ /// is not appropriate(The name is NULL, more than 20byte) [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue type of HANDLE specified in the argument (hApp)
+ /// is not a transmission. [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to the NPP Service.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of
+ /// the session message for the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for
+ /// the NPP Service. [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Subscribe and attach callbacks to System Manager Service! \n
+ /// if app has not Subscribed,resubscribe!
+ /// \~english @see FrameworkunifiedGetAppName SystemManagerOpenSender
+ ////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToSystemManagerService(HANDLE hApp);
+
+/** @}*/
+/** @}*/
+/** @}*/
+
+
+#endif /* INTERFACEUNIFIED_SYSTEM_APPLICATION_H_ */ // NOLINT (build/header_guard)
diff --git a/systemservice/interface_unified/library/include/system_service/interfaceunified_system_types.h b/systemservice/interface_unified/library/include/system_service/interfaceunified_system_types.h
new file mode 100755
index 0000000..d3d3abd
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/interfaceunified_system_types.h
@@ -0,0 +1,165 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file interfaceunified_system_types.h
+ * @brief \~english This file supports the System Manager audio source types.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef INTERFACEUNIFIED_SYSTEM_TYPES_H_ // NOLINT (build/header_guard)
+#define INTERFACEUNIFIED_SYSTEM_TYPES_H_
+
+
+typedef enum _SS_Sources {
+ SS_SOURCE_NA = 0,
+ SS_SOURCE_FM = 1, //## To be integrated into SS_SOURCE_AMFM for _CWORD71_
+ SS_SOURCE_AM = 2, //## To be integrated into SS_SOURCE_AMFM for _CWORD71_
+
+ SS_SOURCE_CD = 3, // For Audio CDs
+ SS_SOURCE_AUX = 4,
+
+ SS_SOURCE_PHONE = 5, // Will be deprecated soon, use specific Incoming or Outgoing call.
+ SS_SOURCE_TA = 6, // ## To be integrated into SS_SOURCE_AMFM for _CWORD71_
+ SS_SOURCE_CHIMES = 7,
+ SS_SOURCE_NAVI = 8,
+
+ SS_SOURCE_MSC = 9, ///< Any mass storage device (USB-MSC, SD, HDD etc.,)
+ SS_SOURCE_MTP = 10, ///< _CWORD104_, MTP protocol devices(like _CWORD28_ over USB)
+
+ SS_SOURCE__CWORD57_ = 11, // ## To be integrated into SS_SOURCE_USB and SS_SOURCE_USB2 for _CWORD71_
+
+ SS_SOURCE__CWORD73__APP = 12, ///< _CWORD73_ based audio application (_CWORD74_ over BT/USB) - _CWORD22_, _CWORD13_ etc.,
+ SS_SOURCE__CWORD73__VIDEO_MODE = 13, ///< _CWORD73_ Video Mode (_CWORD57_ playback)
+
+ SS_SOURCE_STREAMING = 14, ///< Streaming over Wi-fi
+ SS_SOURCE_BT_AUDIO = 15, ///< Bluetooth Audio
+ SS_SOURCE_BT_SPP = 16, ///< Bluetooth SPP based audio application (_CWORD28_/BB etc.,)
+
+ SS_SOURCE_SPEECH = 17, ///< Speech audio playback
+
+ SS_SOURCE_USB = SS_SOURCE_MSC, ///< will be deprecated soon
+
+ SS_SOURCE__CWORD59_ = 18,
+ SS_SOURCE_ADRM = 19,
+ SS_SOURCE__CWORD60_ = 20,
+ SS_SOURCE_ADRA = 21,
+
+
+ SS_SOURCE_INCOMING_CALL = SS_SOURCE_PHONE,
+
+ SS_SOURCE_PRIVATE_MODE_CALL = 24,
+
+ SS_SOURCE_HANDSFREE_SPEAKING = 25,
+
+ SS_SOURCE_FM_DAB = 29,
+ SS_SOURCE_SD_CARD = 30,
+ SS_SOURCE_SDARS = 31,
+ SS_SOURCE_BROWSER_ENT = 32,
+ SS_SOURCE_ML_ENT = 33,
+ SS_SOURCE_ML_INFO = 34,
+
+ SS_SOURCE_DATA_CD = 35, // For Data CDs
+
+ SS_SOURCE_TAS = 40, // TA on same frequency
+
+ SS_SOURCE_DTV = 41,
+ SS_SOURCE_DVD = 42,
+ SS_SOURCE_BD = 43,
+ SS_SOURCE_DELIVERY_APP = 44,
+ SS_SOURCE_ENTUNE_ENT = 45,
+ SS_SOURCE_HDD_AUDIO = 46,
+ SS_SOURCE_JOYFUL_TALK = 47,
+ SS_SOURCE_CLEARANCE_SONAR = 48, // Not used, To be deleted
+ SS_SOURCE_DSRC = 49,
+ SS_SOURCE_ENTUNE_INFO = 50, // Not used, To be deleted
+ SS_SOURCE_HELPNET = 51,
+ SS_SOURCE_OTV = 52,
+ SS_SOURCE_MIRACAST = 53,
+ SS_SOURCE_RSE = 54,
+ SS_SOURCE_INSIDER = 55,
+ SS_SOURCE_MAIL = 56,
+ SS_SOURCE_MAIL_RINGTONE = 57,
+ SS_SOURCE_BD_REAR = 58,
+ SS_SOURCE_HDMI_REAR = 59,
+ SS_SOURCE_SD_CARD_REAR = 60,
+ SS_SOURCE_MIRACAST_REAR = 61,
+ SS_SOURCE_USB_REAR = 62, // Not used, To be deleted
+ SS_SOURCE_DLNA_REAR = 63,
+ SS_SOURCE_BROWSER_INFO = 64,
+ SS_SOURCE_DSRC_ENT = 65,
+ SS_SOURCE_RECDATA_PLAY = 66,
+// add Source ##
+ SS_SOURCE_AMFM = SS_SOURCE_FM,
+ SS_SOURCE_DLNA = 67,
+ SS_SOURCE_USB2 = 68,
+// add interrupt audio source ##
+ SS_SOURCE_VDSP = 69,
+ SS_SOURCE_NAVI_VR = 70,
+ SS_SOURCE_STARTUPBGM = 71,
+ SS_SOURCE_STARTUPBGM_INIT = 72,
+ SS_SOURCE_MAIL_INFO = 73,
+
+ SS_SOURCE_DIAG = 74,
+ SS_SOURCE_MAYDAY = 75,
+ SS_SOURCE_DCM = 76,
+ SS_SOURCE_SD_VIDEO = 77,
+
+ SS_SOURCE_DELIVERY_APP_INFO = 78,
+
+ SS_SOURCE__CWORD27__INFO = 86,
+
+ // Declaration of special sources starting from 100
+ SS_SOURCE_POWER_OFF = 100 // Being used by Mode
+}SS_SOURCE, *PSS_SOURCE;
+
+
+typedef enum _SS_Zones {
+ SS_ZONE_NA = 0,
+ SS_ZONE_DRIVER = 1, ///< Zero/Driver zone
+ SS_ZONE_REAR1,
+ SS_ZONE_REAR2,
+ SS_ZONE_REAR3,
+ SS_ZONE_ALL
+}SS_ZONE, *PSS_ZONE;
+
+
+typedef enum E_AUDIO_PORT {
+ SS_AUDIO_INPUT_PORT_1 = 0x01, ///< Enum representing MCASP2
+ SS_AUDIO_INPUT_PORT_2 = 0x02, ///< Enum representing MCBSP
+ SS_AUDIO_INPUT_PORT_3 = 0x03, ///< Enum representing MCASP3
+ SS_AUDIO_INPUT_PORT_4 = 0x04, ///< Enum representing MCASP3
+ SS_AUDIO_INPUT_PORT_5 = 0x05 ///< Enum representing other port
+}SS_AUDIO_INPUT_PORT, *PSS_AUDIO_INPUT_PORT;
+
+typedef enum _SS_Device_Context {
+ SINGLE_CONTEXT = 0,
+ MULTI_CONTEXT = 1
+}SS_DEVICE_CONTEXT, *PSS_DEVICE_CONTEXT;
+
+#endif /* INTERFACEUNIFIED_SYSTEM_TYPES_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_boot_map.h b/systemservice/interface_unified/library/include/system_service/ss_boot_map.h
new file mode 100755
index 0000000..364d5ed
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_boot_map.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ */
+#ifndef _SS_BOOT_MAP_H_ // NOLINT (build/header_guard)
+#define _SS_BOOT_MAP_H_
+
+#include <system_service/ss_sm_boot_access.h>
+
+#endif //_SS_BOOT_MAP_H_ // NOLINT (build/header_guard)
+
diff --git a/systemservice/interface_unified/library/include/system_service/ss_client_names.h b/systemservice/interface_unified/library/include/system_service/ss_client_names.h
new file mode 100755
index 0000000..23604a1
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_client_names.h
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_client_names.h
+ * @brief This file supports contains the queue names of the client
+ * services that System Services needs to know about.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_CLIENT_NAMES_H_ // NOLINT (build/header_guard)
+#define SS_CLIENT_NAMES_H_
+
+#define SERVICE__CWORD69_ "_CWORD69_"
+#define SERVICE_AS_AUDIO "AS_AudioService"
+#define SERVICE_AS_MODE "AS_ModeService"
+#define SERVICE_BR_BROWSER "BR_BrowserService"
+#define SERVICE_CAN_SHADOW "VS_CANShadow"
+#define SERVICE__CWORD51__BT "_CWORD51__BT"
+#define SERVICE__CWORD51__DR "_CWORD51__DR"
+#define SERVICE_DAB "RS_Master_Tuner"
+#define SERVICE_HMI "HMI"
+#define SERVICE_HMI__CWORD46_ "HMI__CWORD46_Service"
+#define SERVICE_HMI__CWORD77_ "HMI__CWORD77_Service"
+#define SERVICE_IPC_MP_SHADOW "PS_IPC_MP_Shadow"
+#define SERVICE_KEY_HANDLER "PS_KeyHandler"
+#define SERVICE_MM_ICD "MM_ICDService"
+#define SERVICE_MM_MEDIA "MM_MediaService"
+#define SERVICE_MM__CWORD21_ "MM__CWORD21_Service"
+#define SERVICE_NAV "NAV_NavigationService"
+#define SERVICE_NAV_LOC "NAV_LocationService"
+#define SERVICE_NS_NPP "NS_NPPService"
+#define SERVICE_NS_SHARED_MEM "NS_SharedMem"
+#define SERVICE_NW_BT "NW_BluetoothService"
+#define SERVICE_NW_CONNECTION "NW_ConnectionService"
+#define SERVICE_NW_MESSAGING "NW_MessagingService"
+#define SERVICE_NW_PHONE "NW_PhoneService"
+#define SERVICE_NW_PHONE_BOOK "NW_PhoneBookService"
+#define SERVICE_PSM_SHADOW "PS_PSMShadow"
+#define SERVICE_PS_IPC "PS_IPC"
+#define SERVICE_PS_SWDL_SHADOW "PS_SoftwareUpdateShadow"
+#define SERVICE_SDARS "RS_XSDARSService"
+#define SERVICE_TUNER "RS_Radio"
+#define SERVICE_VS__CWORD85_ "VS__CWORD85_Service"
+#define SERVICE_VS_DIAG "VS_DiagService"
+#define SERVICE_VS_DIAG_DISP "DiagDispatcherService"
+#define SERVICE_VS_RVC "VS_RVCService"
+#define SERVICE_VS_VEHICLE "VS_VehicleService"
+
+#endif /* SS_CLIENT_NAMES_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service.h b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service.h
new file mode 100755
index 0000000..134ab1f
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service.h
@@ -0,0 +1,640 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_devicedetection_service.h
+ * @brief This file supports the Device Detection service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup device_detection_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef _SS_DEVICEDETECTION_SERVER_H_ // NOLINT (build/header_guard)
+#define _SS_DEVICEDETECTION_SERVER_H_
+
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "system_service/ss_devicedetection_service_types.h"
+
+/**
+ * \~english The max size of the file path.
+ */
+#define FILEPATH_SIZE (256)
+
+/**
+ * \~english The max size of URL.
+ */
+#define URL_SIZE (256)
+
+/**
+ * \~english The max size of the device name.
+ */
+#define SS_DEV_DEVICE_NAME_SIZE (64)
+
+/**
+ * \~english The max size of the name.
+ */
+#define SS_DEV_NAME_SIZE (256)
+
+
+/**
+ * \~english Structure for FuseDAV info.
+ */
+typedef struct _FuseDAVInfo {
+ /**
+ * \~english FuseDAV server address
+ */
+ int8_t url[URL_SIZE]; // FuseDAV server address
+}SS_FuseDAVInfo;
+
+/**
+ * \~english Structure for USB device info.
+ */
+typedef struct _UsbInfo {
+ /**
+ * \~english Bus Number
+ */
+ uint8_t bus_no; // Bus Number
+ /**
+ * \~english Device Number
+ */
+ uint8_t dev_no; // Device Number
+ /**
+ * \~english Vendor ID
+ */
+ uint16_t idVendor; // Vendor ID
+ /**
+ * \~english Product ID
+ */
+ uint16_t idProduct; // Product ID
+ /**
+ * \~english reserved area
+ */
+ uint8_t reserved[2];
+ /**
+ * \~english Manufacturer Name
+ */
+ CHAR manufacturerName[SS_DEV_NAME_SIZE]; // Manufacturer Name
+ /**
+ * \~english Product Name
+ */
+ CHAR productName[SS_DEV_NAME_SIZE]; // Product Name
+ /**
+ * \~english Serial Number
+ */
+ CHAR serial_no[SS_DEV_NAME_SIZE]; // Serial Number
+ /**
+ * \~english Device file path
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Device file path
+}SS_UsbInfo;
+
+/**
+ * \~english CID(Card Identification Register Data)of SD/MMC card
+ */
+typedef struct _CID {
+ /**
+ * \~english Manufacturer ID
+ */
+ uint8_t manufacturerID; /* Manufacturer ID */
+ /**
+ * \~english Application ID
+ */
+ uint16_t applicationID; /* Application ID */
+ /**
+ * \~english Product Revision (PRV)
+ */
+ uint8_t revision; /* Product Revision (PRV) */
+ /**
+ * \~english Product Serial Number (PSN)
+ */
+ uint32_t serialNumber; /* Product Serial Number (PSN) */
+ /**
+ * \~english Product Name (PNM)
+ */
+ uint8_t productName[6]; /* Product Name (PNM) */
+ /**
+ * \~english Reserved area
+ */
+ uint8_t reserve[2]; /* Reserve */
+ /**
+ * \~english Manufacture date (MDT)
+ */
+ uint16_t manufactureDate; /* Manufacture date (MDT) */
+}SS_CID;
+
+// CSD(Card Specification Register Data)of SD/MMC card
+/**
+ * \~english CSD(Card Specification Register Data)of SD/MMC card
+ */
+typedef struct _CSD {
+ /**
+ * \~english CSD structure
+ */
+ uint8_t csd_structure; /* CSD structure */
+ /**
+ * \~english data read access-time-1
+ */
+ uint8_t taac; /* data read access-time-1 */
+ /**
+ * \~english data read access-time-2 in CLK cycles (NSAC*100)
+ */
+ uint8_t nsac; /* data read access-time-2 in CLK cycles (NSAC*100) */
+ /**
+ * \~english max. data transfer rate
+ */
+ uint8_t tran_speed; /* max. data transfer rate */
+ /**
+ * \~english card command classes
+ */
+ uint16_t ccc; /* card command classes */
+ /**
+ * \~english max. read data block length
+ */
+ uint8_t read_bl_len; /* max. read data block length */
+ /**
+ * \~english partial blocks for read allowed
+ */
+ uint8_t read_bl_partial; /* partial blocks for read allowed */
+ /**
+ * \~english write block misalignment
+ */
+ uint8_t write_blk_misalign; /* write block misalignment */
+ /**
+ * \~english read block misalignment
+ */
+ uint8_t read_blk_misalign; /* read block misalignment */
+ /**
+ * \~english DSR implemented
+ */
+ uint8_t dsr_imp; /* DSR implemented */
+ /**
+ * \~english Reserve area 1
+ */
+ uint8_t reserve1; /* Reserve 1 */
+ /**
+ * \~english device size
+ */
+ uint32_t c_size; /* device size */
+ /**
+ * \~english max. read current -VDD min
+ */
+ uint8_t vdd_r_curr_min; /* max. read current @VDD min */
+ /**
+ * \~english max. read current -VDD max
+ */
+ uint8_t vdd_r_curr_max; /* max. read current @VDD max */
+ /**
+ * \~english max. write current -VDD min
+ */
+ uint8_t vdd_w_curr_min; /* max. write current @VDD min */
+ /**
+ * \~english max. write current -VDD max
+ */
+ uint8_t vdd_w_curr_max; /* max. write current @VDD max */
+ /**
+ * \~english device size multiplier
+ */
+ uint8_t c_size_mult; /* device size multiplier */
+ /**
+ * \~english erase single block enable
+ */
+ uint8_t erase_blk_en; /* erase single block enable */
+ /**
+ * \~english erase sector size
+ */
+ uint8_t sector_size; /* erase sector size */
+ /**
+ * \~english write protect group size
+ */
+ uint8_t wp_grp_size; /* write protect group size */
+ /**
+ * \~english write protect group enable
+ */
+ uint8_t wp_grp_enable; /* write protect group enable */
+ /**
+ * \~english write speed factor
+ */
+ uint8_t r2w_factor; /* write speed factor */
+ /**
+ * \~english max. write data block length
+ */
+ uint8_t write_bl_len; /* max. write data block length */
+ /**
+ * \~english partial blocks for write allowed
+ */
+ uint8_t write_bl_partial; /* partial blocks for write allowed */
+ /**
+ * \~english File format group
+ */
+ uint8_t file_format_grp; /* File format group */
+ /**
+ * \~english copy flag
+ */
+ uint8_t copy; /* copy flag */
+ /**
+ * \~english permanent write protection
+ */
+ uint8_t perm_write_protect; /* permanent write protection */
+ /**
+ * \~english temporary write protection
+ */
+ uint8_t tmp_write_protect; /* temporary write protection */
+ /**
+ * \~english File format
+ */
+ uint8_t file_format; /* File format */
+ /**
+ * \~english Reserve area 2
+ */
+ uint8_t reserve2[3]; /* Reserve 2 */
+} SS_CSD;
+
+// Structure for SD device info.
+/**
+ * \~english Structure for SD device info.
+ */
+typedef struct _SdInfo {
+ /**
+ * \~english CID
+ */
+ SS_CID cid; // CID
+ /**
+ * \~english CSD
+ */
+ SS_CSD csd; // CSD
+ /**
+ * \~english Device file path
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Device file path
+ /**
+ * \~english Current Partion No
+ */
+ int32_t part_num; // Current Partion No
+ /**
+ * \~english Number of partions
+ */
+ int32_t nparts; // Number of partions
+}SS_SdInfo;
+
+// Structure for DISC info.
+/**
+ * \~english Structure for DISC info.
+ */
+typedef struct _DiscInfo {
+ /**
+ * \~english Device file path
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Device file path
+ /**
+ * \~english Disc Type(eCD, eDVD, eBD)
+ */
+ EDISC_TYPE disc_type; // Disc Type(eCD, eDVD, eBD)
+}SS_DiscInfo;
+
+// Structure that is available when SS_DEV_ANY_USB_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_ANY_USB_EV is published.
+ */
+typedef struct _UsbDeviceInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+}SS_UsbDeviceInfo;
+
+// Structure for device info.
+/**
+ * \~english Structure for device info.
+ */
+typedef union _DeviceInfo {
+ /**
+ * \~english usb device info
+ */
+ SS_UsbInfo usb_info; // usb device info
+ /**
+ * \~english sd info
+ */
+ SS_SdInfo sd_info; // sd info
+ /**
+ * \~english disc info
+ */
+ SS_DiscInfo disc_info; // disc info
+ /**
+ * \~english fusedav info
+ */
+ SS_FuseDAVInfo fusedav_info; // fusedav info
+}SS_DeviceInfo;
+
+// Structure for volume label infomation.
+/**
+ * \~english Structure for volume label infomation.
+ */
+typedef struct _VolumeInfo {
+ /**
+ * \~english volume label's availability
+ */
+ BOOL volume_label_availability; // volume label's availability
+ /**
+ * \~english volume label
+ */
+ CHAR volume_label[SS_DEV_NAME_SIZE]; // volume label
+}SS_VolumeInfo;
+
+// Structure that is available when SS_DEV_DETECT*_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT*_EV is published.
+ */
+typedef struct _MediaDetectInfo {
+ /**
+ * \~english Deive type(eUSB,eSD...)
+ */
+ EDEVICE_TYPE dev_type; // Deive type(eUSB,eSD...)
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english Device Infomation
+ */
+ SS_DeviceInfo dev_info; // Device Infomation
+ /**
+ * \~english Mount path
+ */
+ CHAR deviceMountpath[FILEPATH_SIZE]; // Mount path
+ /**
+ * \~english Do Not Used.(This member is for compatibility)
+ */
+ CHAR filepathName[FILEPATH_SIZE]; // Do Not Used.(This menber is for compatibility)
+ /**
+ * \~english FuseDav:TRUE, Not FuseDav:FALSE
+ */
+ BOOL bIsFuseDav;
+ /**
+ * \~english result of mount NORMAL:SS_DEV_OK, ERR:SS_DEV_ERR_MOUNT
+ */
+ SS_DEV_ERROR err_code; // result of mount NORMAL:SS_DEV_OK, ERR:SS_DEV_ERR_MOUNT
+ /**
+ * \~english volume infomation (USB mass storage only support)
+ */
+ SS_VolumeInfo volume_info; // volume infomation (USB mass storage only support)
+}SS_MediaDetectInfo, *PSS_MediaDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_NCM_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_NCM_EV is published.
+ */
+typedef struct _NcmDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Network Name
+ */
+ int8_t networkName[SS_DEV_DEVICE_NAME_SIZE]; // Network Name
+}SS_NcmDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB__CWORD57__EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB__CWORD57__EV is published.
+ */
+typedef struct __CWORD57_DetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+}SS__CWORD57_DetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_ACM_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_ACM_EV is published.
+ */
+typedef struct _AcmDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english ACM device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // ACM device file
+}SS_AcmDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_DEV_MNG_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_DEV_MNG_EV is published.
+ */
+typedef struct _DevMngDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Device Manager device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Device Manager device file
+}SS_DevMngDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_DEV_VEHICLE_CTRL_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_DEV_VEHICLE_CTRL_EV is published.
+ */
+typedef struct _VehicleCtrlDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Vehicle control device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Vehicle control device file
+}SS_VehicleCtrlDetectInfo;
+
+// Structure for audio detect info.
+/**
+ * \~english Structure for audio detect info.
+ */
+typedef struct _AudioDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable;
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info;
+ /**
+ * \~english Audio control device file
+ */
+ int8_t audio_ctrl[FILEPATH_SIZE];
+ /**
+ * \~english Audio Playback device file
+ */
+ int8_t audio_play[FILEPATH_SIZE];
+ /**
+ * \~english Audio Capture device file
+ */
+ int8_t audio_capture[FILEPATH_SIZE];
+}SS_AudioDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_DSRC_APP_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_DSRC_APP_EV is published.
+ */
+typedef struct _DsrcAppDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Dsrc Application device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Dsrc Application device file
+}SS_DsrcAppDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_DSRC_CTRL_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_DSRC_CTRL_EV is published.
+ */
+typedef struct _DsrcCtrlDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Dsrc Control device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Dsrc Control device file
+}SS_DsrcCtrlDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_IR_VICS_DATA_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_IR_VICS_DATA_EV is published.
+ */
+typedef struct _IrVicsDataDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Ir Vics Data device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Ir Vics Data device file
+}SS_IrVicsDataDetectInfo;
+
+/**
+ * \~english USB overcurrent error info.
+ */
+typedef struct _UsbOverCurrentErrInfo {
+ /**
+ * \~english error port no
+ */
+ uint8_t portNo; // error port no
+} SS_UsbOverCurrentErrInfo;
+
+// Structure that is available when SS_DEV_INFO_USB_NOTIFY_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_INFO_USB_NOTIFY_EV is published.
+ */
+typedef struct _UsbNotifyInfo {
+ /**
+ * \~english notify code
+ */
+ SS_NOTIFY_CODE nofity_code; // notify code
+ /**
+ * \~english USB device information's availability
+ */
+ BOOL usb_info_availability; // USB device information's availability
+ /**
+ * \~english USB device information
+ */
+ SS_UsbInfo usb_info; // USB device information
+} SS_UsbNotifyInfo;
+
+// Structure that is available when SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV is published.
+ */
+typedef struct __CWORD57_RoleDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+} SS__CWORD57_RoleDetectInfo;
+
+// Structure that is available when SS_DEV_INFO_SD_FORMAT_COMP_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_INFO_SD_FORMAT_COMP_EV is published.
+ */
+typedef struct _SDFormatInfo {
+ /**
+ * \~english Result of SD Format.
+ */
+ SS_DEV_ERROR result; // Result of SD Format.
+} SS_SDFormatInfo;
+
+#endif /* _SS_DEVICEDETECTION_SERVER_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of device_detection_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h
new file mode 100755
index 0000000..1ad7e67
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h
@@ -0,0 +1,1118 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_devicedetection_service_ifc.h
+ * @brief This file supports the Device Detection service interface.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup device_detection_service
+ * @ingroup system_service
+ * @{
+ */
+/** @addtogroup device_manager
+ * @ingroup device_detection_service
+ * @{
+ */
+
+#ifndef SS_DEVICE_DETECTION_SERVICE_IFC_H_ // NOLINT (build/header_guard)
+#define SS_DEVICE_DETECTION_SERVICE_IFC_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include "system_service/ss_devicedetection_service_protocol.h"
+
+// CID(Card Identification Register Data)of SD/MMC card
+typedef struct T_cid {
+ UI_8 mid; // Manufacture ID
+ UI_8 oid[3]; // OEM/Application ID
+ UI_8 pnm[6]; // Product name
+ UI_8 prv; // Product revision
+ UI_32 psn; // Product serial number
+ UI_16 mdt; // Manufacture date code
+ UI_8 cr7cs; // CRC7 Check sum
+} Tcid;
+
+/**
+ * @class DeviceDetectionServiceIf
+ * \~english @brief Device detection
+ * \~english @par Brief Introduction
+ * Class to provide the device detection function
+ *
+ */
+class DeviceDetectionServiceIf {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DeviceDetectionServiceIf
+ /// \~english @par Summary
+ /// Constructor of DeviceDetectionServiceIf class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a DeviceDetectionServiceIf class. \n
+ /// Member variables (m_hApp, m_hService, m_hSession) to be NULL initialization. \n
+ /// After the constructor, be sure to call Initialize method.
+ /// \~english @see ~DeviceDetectionServiceIf, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ DeviceDetectionServiceIf();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~DeviceDetectionServiceIf
+ /// \~english @par Summary
+ /// Destructor of DeviceDetectionServiceIf class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a DeviceDetectionServiceIf class. \n
+ /// Session is the case still open, to close the session.\n
+ /// Service is the case still open, to close the service.
+ /// Member variables (m_hApp, m_hService, m_hSession) to be NULL initialization.
+ /// \~english @see DeviceDetectionServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~DeviceDetectionServiceIf();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Initialize
+ /// \~english @par Summary
+ /// API to initialize the DeviceDetectionServiceIf class.
+ /// \~english @param [in] hApp
+ /// HANDLE - HANDLE for Application
+ /// \~english @retval TRUE Success
+ /// \~english @retval FALSE Failure
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// Conditions for return FALSE is as follows.
+ /// - NULL handle specified in the argument
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Application to use the services of device_detection_service is, after generating a \n
+ /// DeviceDetectionServiceIf class, which is a method to be executed first. \n
+ /// Member variable(m_hApp) of DeviceDetectionServiceIf class initialized with hApp \n
+ /// that has been specified by the argument.
+ /// \~english @see DeviceDetectionServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Initialize(HANDLE hApp);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnDeviceDetectionAvailability
+ /// \~english @par Summary
+ /// API to set the Callback function for Availability notification of Device Detection Service.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Pointer to function callback for Device Detection Service Availability Notification
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Can not get the App/Thread name from HANDLE in the class member variables (m_hApp).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - The acquisition of the buffer that stores the Callback information specified in the argument failed.
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hApp). [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue HANDLE in HANDLE (m_hApp) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - It is not appropriate message queue name of HANDLE (m_hApp) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hApp) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to register a Callback function for the initialization of the \n
+ /// device_detection_service receives the timing at which the start (open) is possible \n
+ /// of completed service.\n
+ /// (Native Service of API: Use the FrameworkunifiedSubscribeNotificationsWithCallback, to register \n
+ /// a Callback function for Availability notification of Device Detection Service.)
+ /// \~english @see DetachDeviceDetectionAvailabilityCb
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnDeviceDetectionAvailability(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnOpenSessionAck
+ /// \~english @par Summary
+ /// API to set the Callback function for OpenSessionRequest response from the Device Detection Service.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for receiving the response of OpenSessionRequest
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To register the Callback function for receiving a response of completion of OpenSessionRequest to
+ /// Dispatcher. \n
+ /// (Native Service of API: Use the FrameworkunifiedAttachCallbackToDispatcher, to register a Callback function for receiving
+ /// \n
+ /// a response of completion of OpenSessionRequest to Dispatcher.) \n
+ /// On successful session establishment, the client can register for device information.
+ /// \~english @see DetachOpenSessionAckCb
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnOpenSessionAck(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnCloseSessionAck
+ /// \~english @par Summary
+ /// API to set the Callback function for CloseSessionRequest response from the Device Detection Service.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for receiving the response of CloseSessionRequest
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To register the Callback function for receiving a response of completion of CloseSessionRequest to
+ /// Dispatcher. \n
+ /// (Native Service of API: Use the FrameworkunifiedAttachCallbackToDispatcher, to register a Callback function for receiving
+ /// \n
+ /// a response of completion of CloseSessionRequest to Dispatcher.) \n
+ /// \~english @see DetachCloseSessionAckCb
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnCloseSessionAck(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup OpenSessionRequest
+ /// \~english @par Summary
+ /// API to perform the generation of the service/session of Device Detection Service
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Service of Device Detection Service is not Availability state. [eFrameworkunifiedStatusFail]
+ /// - Service of Device Detection Service can not be opened (can not start). [eFrameworkunifiedStatusFail]
+ /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Pub-Sub
+ /// \~english @par Detail
+ /// And generate the service of device_detection_service, which is a method for generating a session.\n
+ /// (To send the command of PROTOCOL_OPEN_SESSION_REQ to device_detection_service.)\n
+ /// If you already service has been created, once to close the service.
+ /// \~english @see CloseSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenSessionRequest();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DecodeOpenSessionResponse
+ /// \~english @par Summary
+ /// API to perform the generation of the service/session of Device Detection Service
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Incorrect PROTOCOL_OPEN_SESSION_ACK message length of Device Detection Service. [eFrameworkunifiedStatusFail]
+ /// - PROTOCOL_OPEN_SESSION_ACK message of Device Detection Service can not be acquired. [eFrameworkunifiedStatusFail]
+ /// - Can not session generation of message transmission to Device Detection Service. [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Get the session initiation response message(PROTOCOL_OPEN_SESSION_ACK) of Device Detection \n
+ /// Service, and get the session ID from the message. \n
+ /// Acquired session ID, (after opening the message transmission queue) created after a session \n
+ /// of message transmission, hold as the session information in the session HANDLE (m_hSession).\n
+ /// of the class member variable.
+ /// \~english @see OpenSessionRequest, CloseSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DecodeOpenSessionResponse();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RegisterForDeviceDetectionEvent
+ /// \~english @par Summary
+ /// API to register a Callback function for receiving the timing of when an event occurs in the device.
+ /// \~english @param [in] f_eDevDetectEvent
+ /// SS_DeviceDetectionServerEvents - Event type (USB/SD/...etc event)
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Pointer to a callback function that corresponds to the event
+ /// \~english @param [in] pfilepath
+ /// PCSTR - Pointer to the file path name(Non-support:Be NULL)
+ /// \~english @par
+ /// Event type (enum values of SS_DeviceDetectionServerEvents)
+ /// - SS_DEV_DETECT_ANY_USB_EV : Notify the insertion and mount path of USB MassStorage class(USB
+ /// mass storage is subject)
+ /// - SS_DEV_DETECT_ANY_SD_EV : Notify the insertion and mount path of SD card
+ /// - SS_DEV_INFO_ANY_USB_EV : Notify the USB device insertion and removal detection(All USB
+ /// devices are subject)
+ /// - SS_DEV_DETECT_ANY_DISC_EV : Notify the insertion of DISC(BD, DVD, CD) and mount path of block
+ /// devices
+ /// - SS_DEV_DETECT_ANY_USB_NCM_EV : Notify the insertion and network IF name of the USB NCM class
+ /// device(for MirrorLink)
+ /// - SS_DEV_DETECT_ANY_USB__CWORD57__EV : Notify the insertion and removal and the device file name of the
+ /// _CWORD57_ device(Rather than the _CWORD57_ only class, the device is subject)
+ /// - SS_DEV_DETECT_ANY_USB_ACM_EV : Notify the insertion and removal and device file name of the USB
+ /// ACM class device(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_DEV_MNG_EV : Notify the insertion and removal and device file name of the USB
+ /// DeviceManagementModel class(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV : Notify the insertion and removal and device file name of the USB
+ /// Vehicle Control class(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_DSRC_APP_EV : Notify the insertion and removal and device file name of the USB
+ /// DSRC Application class(for DSRC device)
+ /// - SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV : Notify the insertion and removal and device file name of the USB
+ /// DSRC Control class(for DSRC device)
+ /// - SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV : Notify the insertion and removal and device file name of the USB
+ /// IR-VICS Data class(for DSRC device)
+ /// - SS_DEV_ERR_USB_OVER_CURRENT_EV : Notify the overcurrent detection error of USB
+ /// - SS_DEV_DETECT_ANY_USB_MTP_EV : Notify the insertion and mount path of USB MTP class device
+ /// - SS_DEV_INFO_ANY_USB_NOTIFY_EV : Notify the connection of non-compliant USB device
+ /// - SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV : Notify the insertion and removal of the _CWORD57_ device after
+ /// RoleSW(Rather than the _CWORD57_ only class, the device is subject)
+ /// - SS_DEV_INFO_SD_FORMAT_COMP_EV : Notify the SD format results
+ /// - SS_DEV_DETECT_ANY_USB_DCM_NCM_EV : Notify the insertion and removal and network IF name of the USB
+ /// NCM class device(for DCM)
+ /// - SS_DEV_INFO_ANY_USB_DVDP_EV : Notify the insertion and removal of the DVD-P device
+ /// \~english @par
+ /// For SS_DEV_INFO_ANY_USB_NOTIFY_EV, it is also notified in the event the following conditions.
+ /// - When the enumeration failed.
+ /// - When it detects the current excess of the USB device connected to the bus power HUB.
+ /// - When it is detected that the number of the USB device has exceeded the number of support.
+ /// - When it is detected that the HUB is connected beyond the HUB number that supports.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE in the class member variables (m_hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_DeviceDetectionService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to register a callback function for receiving the timing of the \n
+ /// occurrence of an event in the device. \n
+ /// \~english @see UnRegisterForDeviceDetectionEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterForDeviceDetectionEvent(
+ SS_DeviceDetectionServerEvents f_eDevDetectEvent, CbFuncPtr f_pCallBackFn,
+ PCSTR pfilepath = NULL);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup UnRegisterForDeviceDetectionEvent
+ /// \~english @par Summary
+ /// API to release a Callback function that corresponds to the event notification from the device
+ /// \~english @param [in] f_eDevDetectEvent
+ /// SS_DeviceDetectionServerEvents - Event notification type (USB/SD/...etc event)
+ /// \~english @par
+ /// Releasable event notification type (enum values of SS_DeviceDetectionServerEvents)
+ /// - SS_DEV_DETECT_ANY_USB_EV : Notify the insertion and mount path of USB MassStorage class(USB
+ /// mass storage is subject)
+ /// - SS_DEV_DETECT_ANY_SD_EV : Notify the insertion and mount path of SD card
+ /// - SS_DEV_INFO_ANY_USB_EV : Notify the USB device insertion and removal detection(All USB
+ /// devices are subject)
+ /// - SS_DEV_DETECT_ANY_DISC_EV : Notify the insertion of DISC(BD, DVD, CD) and mount path of block
+ /// devices
+ /// - SS_DEV_DETECT_ANY_USB_NCM_EV : Notify the insertion and network IF name of the USB NCM class
+ /// device(for MirrorLink)
+ /// - SS_DEV_DETECT_ANY_USB__CWORD57__EV : Notify the insertion and removal and the device file name of the
+ /// _CWORD57_ device(Rather than the _CWORD57_ only class, the device is subject)
+ /// - SS_DEV_DETECT_ANY_USB_ACM_EV : Notify the insertion and removal and device file name of the USB
+ /// ACM class device(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_DEV_MNG_EV : Notify the insertion and removal and device file name of the USB
+ /// DeviceManagementModel class(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV : Notify the insertion and removal and device file name of the USB
+ /// Vehicle Control class(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_DSRC_APP_EV : Notify the insertion and removal and device file name of the USB
+ /// DSRC Application class(for DSRC device)
+ /// - SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV : Notify the insertion and removal and device file name of the USB
+ /// DSRC Control class(for DSRC device)
+ /// - SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV : Notify the insertion and removal and device file name of the USB
+ /// IR-VICS Data class(for DSRC device)
+ /// - SS_DEV_ERR_USB_OVER_CURRENT_EV : Notify the overcurrent detection error of USB
+ /// - SS_DEV_DETECT_ANY_USB_MTP_EV : Notify the insertion and mount path of USB MTP class device
+ /// - SS_DEV_INFO_ANY_USB_NOTIFY_EV : Notify the connection of non-compliant USB device
+ /// - SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV : Notify the insertion and removal of the _CWORD57_ device after
+ /// RoleSW(Rather than the _CWORD57_ only class, the device is subject)
+ /// - SS_DEV_INFO_SD_FORMAT_COMP_EV : Notify the SD format results
+ /// - SS_DEV_DETECT_FILEPATHNAME_EV : Notify the specified file access in pfilepath
+ /// - SS_DEV_DETECT_ANY_USB_DCM_NCM_EV : Notify the insertion and removal and network IF name of the USB
+ /// NCM class device(for DCM)
+ /// - SS_DEV_INFO_ANY_USB_DVDP_EV : Notify the insertion and removal of the DVD-P device
+ /// \~english @par
+ /// For SS_DEV_INFO_ANY_USB_NOTIFY_EV, it is also notified in the event the following conditions.
+ /// - When the enumeration failed.
+ /// - When it detects the current excess of the USB device connected to the bus power HUB.
+ /// - When it is detected that the number of the USB device has exceeded the number of support.
+ /// - When it is detected that the HUB is connected beyond the HUB number that supports.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE in the class member variables (m_hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam]
+ /// - The service can not be determined from the HANDLE in the class member variables (m_hApp). [eFrameworkunifiedStatusFail]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_DeviceDetectionService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to release a callback function for receiving the timing of the \n
+ /// occurrence of an event in the device. \n
+ /// \~english @see RegisterForDeviceDetectionEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnRegisterForDeviceDetectionEvent(
+ SS_DeviceDetectionServerEvents f_eDevDetectEvent);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CloseSessionRequest
+ /// \~english @par Summary
+ /// API to perform the destruction of services/session of Device Detection Service
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Method
+ /// \~english @par Detail
+ /// And destruct the service of device_detection_service, which is a method for destructing a session.\n
+ /// (To send the command of PROTOCOL_CLOSE_SESSION_REQ to device_detection_service.)\n
+ /// \~english @see OpenSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseSessionRequest();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DetachDeviceDetectionAvailabilityCb
+ /// \~english @par Summary
+ /// API to release the Callback function for Availability notification of Device Detection Service.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// - The call-back function for Availability notification has been registered.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Can not get the App/Thread name from HANDLE in the class member variables (m_hApp).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hApp). [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue HANDLE in HANDLE (m_hApp) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - It is not appropriate message queue name of HANDLE (m_hApp) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hApp) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Callback function for Availability notification is not registered. [eFrameworkunifiedStatusFail]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Is a method for releasing a Callback function registered to receive the timing \n
+ /// initialization is completed device_detection_service
+ /// (Native Service of API: Use the FrameworkunifiedUnsubscribeNotificationWithCallback, to release \n
+ /// a Callback function for Availability notification of Device Detection Service.)
+ /// \~english @see NotifyOnDeviceDetectionAvailability
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DetachDeviceDetectionAvailabilityCb();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DetachOpenSessionAckCb
+ /// \~english @par Summary
+ /// API to release the Callback function for OpenSessionRequest response from the Device Detection Service.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Not Callback function information of the release target is present. [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To cancel the Callback function for receiving a response of completion of OpenSessionRequest from
+ /// Dispatcher. \n
+ /// (Native Service of API: Use the FrameworkunifiedDetachCallbackFromDispatcher, to cancel a Callback function for receiving
+ /// \n
+ /// a response of completion of OpenSessionRequest from Dispatcher.) \n
+ /// \~english @see NotifyOnOpenSessionAck
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DetachOpenSessionAckCb();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DetachCloseSessionAckCb
+ /// \~english @par Summary
+ /// API to release the Callback function for CloseSessionRequest response from the Device Detection Service.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Not Callback function information of the release target is present. [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To cancel the Callback function for receiving a response of completion of CloseSessionRequest from
+ /// Dispatcher. \n
+ /// (Native Service of API: Use the FrameworkunifiedDetachCallbackFromDispatcher, to cancel a Callback function for receiving
+ /// \n
+ /// a response of completion of CloseSessionRequest from Dispatcher.) \n
+ /// \~english @see NotifyOnCloseSessionAck
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DetachCloseSessionAckCb();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup MountSD
+ /// \~english @par Summary
+ /// API to mount the specified SD partition
+ /// \~english @param [in] part_num
+ /// uint8_t - Partition number of SD card(From 0 to 3)
+ /// \~english @param [out] already_mounted
+ /// BOOL* - Mount existence result
+ /// \~english @par
+ /// - TRUE : Already mount
+ /// - FALSE : Mount request is accepted. Wait for mount notification.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusAccessError Access error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - SD card partition number (part_num) exceeds the 3 specified by the argument. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not have access to the device file for the SD. [eFrameworkunifiedStatusAccessError]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL.
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method only
+ /// \~english @par Detail
+ /// The API is a method used to mount the specified partition (area).\n
+ /// The target device is an SD card.
+ /// Service(Thread) to call this method is not limited. Therefore, \n
+ /// to be utilized as a mismatch does not occur between the service \n
+ /// to use the SD card. \n
+ /// SD card in the specified partition, already returned eFrameworkunifiedStatusOK \n
+ /// if mount existence results (already_mounted) in the TRUE that is mounted.\n
+ /// If it is not already mounted mount existence results (already_mounted) \n
+ /// and to FALSE, then carry out the SD of the mount request to Device \n
+ /// Detection Service.
+ /// \~english @see UmountSD, RegisterForDeviceDetectionEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus MountSD(uint8_t part_num, BOOL *already_mounted);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup UmountSD
+ /// \~english @par Summary
+ /// API to mount the specified SD partition
+ /// \~english @param [in] part_num
+ /// uint8_t - Partition number of SD card(From 0 to 3)
+ /// \~english @param [out] already_umounted
+ /// BOOL* - Mount existence result
+ /// \~english @par
+ /// - TRUE : Already umount
+ /// - FALSE : Umount request is accepted. Wait for umount notification.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusAccessError Access error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - SD card partition number (part_num) exceeds the 3 specified by the argument. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not have access to the device file for the SD. [eFrameworkunifiedStatusAccessError]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL.
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method only
+ /// \~english @par Detail
+ /// The API is a method used to mount the specified partition (area).\n
+ /// The target device is an SD card.
+ /// Service(Thread) to call this method is not limited. Therefore, \n
+ /// to be utilized as a mismatch does not occur between the service \n
+ /// to use the SD card. \n
+ /// SD card in the specified partition, already returned eFrameworkunifiedStatusOK \n
+ /// if unmount existence results (already_unmounted) in the TRUE that is unmounted.
+ /// If it is not already unmounted unmount existence results (already_unmounted) \n
+ /// and to FALSE, then carry out the SD of the unmount request to Device \n
+ /// Detection Service. \n
+ /// That all of the services specifically, to call this API after the close \n
+ /// completion of the directory and file of the SD card. \n
+ /// Also, do not call this API in a state in which a directory on the SD card \n
+ /// in the current directory. (At SD drive processing threads in SS_DeviceDetectionService, \n
+ /// umount fails, error of SS_DEV_ERR_BUSY is returned as an asynchronous notification \n
+ /// events.)
+ /// \~english @see MountSD, RegisterForDeviceDetectionEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UmountSD(uint8_t part_num, BOOL *already_umounted);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup UsbVBusReset
+ /// \~english @par Summary
+ /// API to reset the VBUS of the specified USB port
+ /// \~english @param [in] port
+ /// uint8_t - USB port number
+ /// \~english @param [in] inteval
+ /// uint8_t - interval (interval * 100 [msec])
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// - Checking USB port number should be done before calling this API.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Environment variable (TARGET_BOARD) is not defined. [eFrameworkunifiedStatusFail]
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Name of the target board in the environment variable (TARGET_BOARD) is not correct. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL.
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget only
+ /// \~english @par Detail
+ /// The API is a method for resetting the VBUS of the specified USB port.\n
+ /// Environment variable (TARGET_BOARD) is defined in the configure options \n
+ /// specified at the time of build. \n
+ /// (Example. TARGET_BOARD:_CWORD71__CWORD91__e2_na_t__CWORD84_2__CWORD71_) \n
+ /// Before reset USB port for DCM, the device files(dcm_acm, dcm_vc, dcm_wdm) \n
+ /// related to DCM-related must be closed. \n
+ /// *) Device file may not be created correctly when the process of Disconnect/Connect \n
+ /// without closing to work.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UsbVBusReset(int8_t port);
+ EFrameworkunifiedStatus UsbVBusReset(int8_t port, uint8_t interval);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RoleSwStateNotify
+ /// \~english @par Summary
+ /// API to notify RoleSW state
+ /// \~english @param [in] state
+ /// SS_DEV_ROLE_SW_STATE - RoleSW state
+ /// \~english @par
+ /// enum variable SS_DEV_ROLE_SW_STATE
+ /// - SS_DEV_ROLE_SW_START : Start
+ /// - SS_DEV_ROLE_SW_BEGIN_END : Beginning of End
+ /// - SS_DEV_ROLE_SW_END : End
+ /// - SS_DEV_ROLE_SW_RESTART : Restart
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusInvldQName Invalid Message Queue Name
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - It failed to open the message queue for messages received from SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - It failed to buffer acquisition for messages received from SS_DeviceDetectionService(malloc failure).
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to create a sequence ID of the message to be sent to the SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL.
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE name in the HANDLE (m_hSession) in the class member variables is NULL.
+ /// [eFrameworkunifiedStatusInvldQName]
+ /// - Message queue HANDLE name in the HANDLE (hService) in the class member variables exceeds 20byte.
+ /// [eFrameworkunifiedStatusInvldQName]
+ /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid send and receive file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the send and receive of the session message
+ /// for SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the send and receive buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the send and receive of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for send and receive of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrOther]
+ /// - It failed to connect to the socket for the response message to be received from SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to wait control of the response message received from SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - Interruption by the system call (signal) has occurred in wait in the response message received from
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - After the failure at the time of the response message received from SS_DeviceDetectionService, it failed
+ /// to re-connection of the Socket. [eFrameworkunifiedStatusBadConnection]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync x Method
+ /// \~english @par Detail
+ /// By executing this API, Device Detection Service recognizes the state \n
+ /// has been switched from the USB Host due to RoleSW to USB Function. \n
+ /// The initial state of Detection is a state(SS_DEV_ROLE_SW_END:End state) \n
+ /// that has not been RoleSW. \n
+ /// (It is a state that accepts a SS_DEV_ROLE_SW_START:Start.)
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RoleSwStateNotify(SS_DEV_ROLE_SW_STATE state);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FormatSD
+ /// \~english @par Summary
+ /// API to Format SD
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusAccessError Access error occurred
+ /// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Can not have access to the device file for the SD. [eFrameworkunifiedStatusAccessError]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL.
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Detail
+ /// The SD card inserted into the _CWORD84_ side in this API is formatted in compliance with the SD standard.\n
+ /// A result of format implementation is notified by SS_DEV_INFO_SD_FORMAT_COMP_EV events.\n
+ /// String pickled notification content and the result is as follows.\n
+ /// - SS_DEV_OK : Format success \n
+ /// - SS_DEV_ERR_BUSY : For unmount unexecuted, format failure \n
+ /// - SS_DEV_ERR : Format fails for any other factors
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Method
+ /// \~english @par
+ /// This API is able to call after the SD card umount completion and the device file close of \n
+ /// SD card is complete.\n
+ /// If the SD card umount of has not been completed, SS_DEV_ERR_BUSY is notified.\n
+ /// If the device file of the SD card has not been close, although it is the format becomes \n
+ /// the operation completed, there can be no assurance of the operation.
+ /// \~english @see MountSD, UmountSD, RegisterForDeviceDetectionEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FormatSD(void);
+
+ private:
+ HANDLE OpenService();
+ UI_8 Crc7Checksum(UI_8 *data, UI_8 sz);
+ HANDLE m_hApp;
+ HANDLE m_hService;
+ HANDLE m_hSession;
+ BOOL CheckDetectEvent(SS_DeviceDetectionServerEvents f_eDevDetectEvent);
+};
+
+#endif /* SS_DEVICE_DETECTION_SERVICE_IFC_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of device_manager
+/** @}*/ // end of device_detection_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_local.h b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_local.h
new file mode 100755
index 0000000..c85e6b3
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_local.h
@@ -0,0 +1,37 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief This is local header file of Device Detection service.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServicesIf
+/// \brief This file supports the Device Detection service.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _SS_DEVICEDETECTION_SERVER_LOCAL_H_ // NOLINT (build/header_guard)
+#define _SS_DEVICEDETECTION_SERVER_LOCAL_H_
+
+
+// Structure for SS_DEV_REMOUNT_PARTITION
+typedef struct _RemountPatitionInfo {
+ unsigned long mountflags; // NOLINT (runtime/int)
+ CHAR deviceMountpath[FILEPATH_SIZE]; // Mount path
+} SS_RemountPatitionInfo;
+
+#endif /* _SS_DEVICEDETECTION_SERVER_LOCAL_H_ */ // NOLINT (build/header_guard)
diff --git a/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h
new file mode 100755
index 0000000..7de03b9
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_devicedetection_service_notifications.h
+ * @brief This file supports the Device Detection service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup device_detection_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_DEVICE_DETECTION_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define SS_DEVICE_DETECTION_SERVICE_NOTIFICATIONS_H_
+
+#include "system_service/ss_services.h"
+
+/**
+ * \~english SS_DeviceDetection service availability notification.
+ */
+#define NTFY_SS_Device_Detection_Service_Availability SS_DEV_DETECT_SRV"/Availability"
+
+/**
+ * \~english SS_DeviceDetection service USB error notification.
+ */
+#define NTFY_SS_Device_Detection_USB_Error SS_DEV_DETECT_SRV"/USBError"
+
+/**
+ * \~english SS_DeviceDetection service MMCSD error notification.
+ */
+#define NTFY_SS_Device_Detection_MMCSD_Error SS_DEV_DETECT_SRV"/MMCSDError"
+
+#endif /* SS_DEVICE_DETECTION_SERVICE_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of device_detection_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h
new file mode 100755
index 0000000..cb54ee5
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h
@@ -0,0 +1,143 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_devicedetection_service_protocol.h
+ * @brief This file supports the Device Detection service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup device_detection_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard)
+#define _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include "system_service/ss_devicedetection_service.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english Event type (USB/SD/...etc event)
+ */
+typedef enum _DeviceDetectionServerEvents {
+ /**
+ * \~english Notify whenever a USB MassStorage device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_USB_EV = 121,
+ /**
+ * \~english Notify whenever a SD device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_SD_EV = 122,
+ /**
+ * \~english Notify all events for all devices
+ */
+ SS_DEV_DETECT_FILEPATHNAME_EV = 123,
+ /**
+ * \~english Notify whenever a Navi Emmc device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_EMMC_NAV_EV = 124,
+ /**
+ * \~english Notify whenever a USB device is connected/removed
+ */
+ SS_DEV_INFO_ANY_USB_EV = 125,
+ /**
+ * \~english Notify whenever a DISC(block) device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_DISC_EV = 126,
+ /**
+ * \~english Notify whenever a USB NCM device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_USB_NCM_EV = 127,
+ /**
+ * \~english Notify whenever a USB _CWORD57_ device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_USB__CWORD57__EV = 128,
+ /**
+ * \~english Notify whenever a USB ACM device is connected/removed (for DCM)
+ */
+ SS_DEV_DETECT_ANY_USB_ACM_EV = 129,
+ /**
+ * \~english Notify whenever a USB Device Management device is connected/removed (for DCM)
+ */
+ SS_DEV_DETECT_ANY_USB_DEV_MNG_EV = 130,
+ /**
+ * \~english Notify whenever a USB Vics Control device is connected/removed (for DCM)
+ */
+ SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV = 131,
+ /**
+ * \~english Notify whenever a USB DSRC Application device is connected/removed (for DSRC)
+ */
+ SS_DEV_DETECT_ANY_USB_DSRC_APP_EV = 132,
+ /**
+ * \~english Notify whenever a USB DSRC Control device is connected/removed (for DSRC)
+ */
+ SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV = 133,
+ /**
+ * \~english Notify whenever a USB IR Vics Data device is connected/removed (for DSRC)
+ */
+ SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV = 134,
+ /**
+ * \~english Notify whenever USB Over Current is Detected
+ */
+ SS_DEV_ERR_USB_OVER_CURRENT_EV = 135,
+ /**
+ * \~english Notify whenever USB MTP Device is Detected
+ */
+ SS_DEV_DETECT_ANY_USB_MTP_EV = 136,
+ /**
+ * \~english Notify whenever USB Authentication Error Notify
+ */
+ SS_DEV_INFO_ANY_USB_NOTIFY_EV = 137,
+ /**
+ * \~english Notify whenever a USB _CWORD57_ device is connected/removed after RoleSW.
+ */
+ SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV = 138,
+ /**
+ * \~english Notify whenever SD is formated.
+ */
+ SS_DEV_INFO_SD_FORMAT_COMP_EV = 139,
+ /**
+ * \~english Notify whenever a USB NCM device is connected/removed (for DCM)
+ */
+ SS_DEV_DETECT_ANY_USB_DCM_NCM_EV = 140,
+ /**
+ * \~english Notify whenever a DVD-P device is connected/removed
+ */
+ SS_DEV_INFO_ANY_USB_DVDP_EV = 141,
+} SS_DeviceDetectionServerEvents;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of device_detection_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h
new file mode 100755
index 0000000..4b7be37
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h
@@ -0,0 +1,69 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServicesIf
+/// \brief This file supports the Device Detection service.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef _SS_DEVICEDETECTION_SERVICE_PROTOCOL_LOCAL_H_ // NOLINT (build/header_guard)
+#define _SS_DEVICEDETECTION_SERVICE_PROTOCOL_LOCAL_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum _DeviceDetectionServerProtocol {
+ SS_DEV_DETECT_GET_APP_INFO = 0x10, /// client to service: not really needed
+ SS_DEV_DETECT_RETURN_APP_INFO = 0x11, /// service to client: not really needed
+ SS_UDEV_DEV_DETECT_INFO = 0x12, /// UDEV to service: device detect info sent to service
+ SS_UDEV_DEV_DETECT_FILEPATHNAME_INFO = 0x13, /// File pathname info cmd
+ SS_REGISTER_FILEPATHNAME = 0x14, /// Register file pathname cmd
+ SS_BSP_DEV_DETECT_ERR_INFO = 0x15, /// BSP / MCD device insert/removal/mount error report.
+ SS_REGISTER_DETECT_EVENT = 0x16, /// Register DeviceDetection Event
+ SS_UDEV_DEV_DEVICE_INFO = 0x17, /// UDEV to service: device info sent to service
+ SS_UDEV_DEV_DETECT_NCM_INFO = 0x18, /// UDEV to service: detect ncm sent to service
+ SS_UDEV_DEV_DETECT__CWORD57__INFO = 0x19, /// UDEV to service: detect _CWORD57_ sent to service
+ SS_UDEV_DEV_DETECT_ACM_INFO = 0x1a, /// UDEV to service: detect ACM sent to service
+ SS_UDEV_DEV_DETECT_MNG_INFO = 0x1b, /// UDEV to service: detect DeviceManagementModel sent to service
+ SS_UDEV_DEV_DETECT_VEHICLE_CTRL_INFO = 0x1c, /// UDEV to service: detect Vehicle Control sent to service
+ SS_UDEV_DEV_DETECT_DSRCCTL_INFO = 0x1d, /// UDEV to service: detect DSRC Application sent to service
+ SS_UDEV_DEV_DETECT_DSRCAPP_INFO = 0x1e, /// UDEV to service: detect DSRC Control sent to service
+ SS_UDEV_DEV_DETECT_IRVICS_DATA_INFO = 0x1f, /// UDEV to service: detect IR-VICS Data sent to service
+ SS_DETECT_USB_OVC_ERR = 0x20, /// USB Monitor OVC to service: detect OverCurrent Error
+ SS_UDEV_DEV_DETECT_MTP_INFO = 0x21, /// UDEV to service: detect MTP Device
+ SS_DEV_MOUNT_SD = 0x22, /// client to service: mount SD partion
+ SS_DEV_UMOUNT_SD = 0x23, /// client to service: umount SD partion
+ SS_DEV_REMOUNT_PARTITION = 0x24, /// client to service: Remount partion
+ SS_UNREGISTER_DETECT_EVENT = 0x25, /// UnRegister DeviceDetection event
+ SS_USB_VBUS_RESET = 0x26, /// client to service: USB Vbus Reset
+ SS_UDEV_USB_AUTHENTICATION_ERR_INFO = 0x27, /// USB Monitor to service: USB Authentication Error Notify
+ SS_UDEV_DEV_DETECT_USB_FUNC_INFO = 0x28, /// USB Monitor to service: detect USB Func to service
+ SS_DEV_ROLE_SW_STATE_NOTIFY = 0x29, /// client to service: notify RoleSw state
+ SS_DEV_FORMAT_SD = 0x2a, /// client to service: Format SD
+ SS_INFO_FORMAT_SD = 0x2b, /// SDDRV to service: Infomation Format SD result
+}SS_DeviceDetectionServerProtocol;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SS_DEVICEDETECTION_SERVICE_PROTOCOL_LOCAL_H_ */ // NOLINT (build/header_guard)
+
diff --git a/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types.h b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types.h
new file mode 100755
index 0000000..c5ab1c3
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types.h
@@ -0,0 +1,186 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_devicedetection_service_types.h
+ * @brief This file supports the Device Detection service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup device_detection_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_DEVDETECT_TYPES_H_ // NOLINT (build/header_guard)
+#define SS_DEVDETECT_TYPES_H_
+
+/**
+ * \~english Deive type(eUSB,eSD...)
+ */
+typedef enum _DeviceType {
+ /**
+ * \~english USB
+ */
+ eUSB,
+ /**
+ * \~english SD
+ */
+ eSD,
+ /**
+ * \~english EMMC
+ */
+ eMMC,
+ /**
+ * \~english DISC
+ */
+ eDISC,
+ /**
+ * \~english MTP
+ */
+ eMTP
+} EDEVICE_TYPE;
+
+/**
+ * \~english Action result
+ */
+typedef enum _SsDevError {
+ /**
+ * \~english success
+ */
+ SS_DEV_OK,
+ /**
+ * \~english error
+ */
+ SS_DEV_ERR,
+ /**
+ * \~english mount error
+ */
+ SS_DEV_ERR_MOUNT,
+ /**
+ * \~english device busy
+ */
+ SS_DEV_ERR_BUSY,
+} SS_DEV_ERROR;
+
+/**
+ * \~english USB port
+ */
+typedef enum _USBPort {
+ /**
+ * \~english USB0(IF-BOX)
+ */
+ SS_DEV_USB_PORT0, // IF-BOX
+ /**
+ * \~english USB1(DCM)
+ */
+ SS_DEV_USB_PORT1, // DCM
+ /**
+ * \~english USB2(DSRC/ETC)
+ */
+ SS_DEV_USB_PORT2, // DSRC/ETC
+ /**
+ * \~english USB3(External deck)
+ */
+ SS_DEV_USB_PORT3, // External DECK
+ /**
+ * \~english USB4(Drive recorder)
+ */
+ SS_DEV_USB_PORT4, // Supplies drive recorder
+ /**
+ * \~english USB number max.
+ */
+ SS_DEV_USB_MAX // MAX
+} SS_DEV_USBPORT;
+
+/**
+ * \~english notify code
+ */
+typedef enum SsNotifyCode {
+ /**
+ * \~english Unsupport USB device
+ */
+ SS_DEV_UNSUPPORT_USB, // Un support USB device
+ /**
+ * \~english The connected device has no response.
+ */
+ SS_DEV_NON_RESPONSE_USB, // Enemuration Error
+ /**
+ * \~english It detects a USB device of current excess that has been connected to the bus power HUB.
+ */
+ SS_DEV_HIGH_POWER_USB, // It detects a USB device of current excess that
+ // has been connected to the bus power HUB.
+ /**
+ * \~english Over support USB(3 or more units)
+ */
+ SS_DEV_OVER_SUPPORT_USB, // Over support USB(3 or more units)
+ /**
+ * \~english Over number of USB HUB(2 or more units)
+ */
+ SS_DEV_OVER_NUM_USB_HUB, // Over number of USB HUB(2 or more units)
+} SS_NOTIFY_CODE;
+
+/**
+ * \~english RoleSw state
+ */
+typedef enum _SsDevRoleSwState {
+ /**
+ * \~english start
+ */
+ SS_DEV_ROLE_SW_START,
+ /**
+ * \~english begin end
+ */
+ SS_DEV_ROLE_SW_BEGIN_END,
+ /**
+ * \~english end
+ */
+ SS_DEV_ROLE_SW_END,
+ /**
+ * \~english restart
+ */
+ SS_DEV_ROLE_SW_RESTART,
+} SS_DEV_ROLE_SW_STATE;
+
+/**
+ * \~english Disc Type(eCD, eDVD, eBD)
+ */
+typedef enum _DiscType {
+ /**
+ * \~english CD
+ */
+ eCD,
+ /**
+ * \~english DVD
+ */
+ eDVD,
+ /**
+ * \~english BD
+ */
+ eBD,
+} EDISC_TYPE;
+
+#endif /* SS_DEVDETECT_TYPES_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of device_detection_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h
new file mode 100755
index 0000000..dafd4d4
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServicesIf
+/// \brief This file supports the Device Detection service.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef SS_DEVDETECT_TYPES_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_DEVDETECT_TYPES_LOCAL_H_
+
+/**
+ * \~english Service state.
+ */
+typedef enum _ServiceStatus {
+ eInit, //!< \~english Initialize.
+ ePre, //!< \~english In-vehicle.
+ eBackground, //!< \~english Background boot.
+ eStart, //!< \~english Normal boot.
+ eStop, //!< \~english Stop.
+} ESERVICESTATUS;
+
+typedef enum _USBMount {
+ SS_DEV_RO, // Read Only
+ SS_DEV_RW // Read/Write
+} SS_DEV_USB_REMOUNT;
+
+#endif /* SS_DEVDETECT_TYPES_LOCAL_H_ */ // NOLINT (build/header_guard)
diff --git a/systemservice/interface_unified/library/include/system_service/ss_error_event_common.h b/systemservice/interface_unified/library/include/system_service/ss_error_event_common.h
new file mode 100755
index 0000000..ce7677f
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_error_event_common.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_error_event_common.h
+ * @brief This file supports SM logging.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef __SS_ERROR_EVENT_COMMON_H__ // NOLINT (build/header_guard)
+#define __SS_ERROR_EVENT_COMMON_H__
+
+#include <native_service/frameworkunified_types.h> // added for test build
+
+
+// Do not change enumeration order.
+// HMI hard codes error event square
+// colors based on expected enum order.
+enum EErrorEventType {
+ eErrorEventTypeProcessCrash = 0,
+ eErrorEventTypeHeartBeatFailure,
+ eErrorEventTypeSystemLowMemory,
+ eErrorEventTypeReserved1, // Formerly SS_SM_EVENT_ERROR_HIGH_CPU_LOAD, now HMI enum place holder.
+ eErrorEventTypeUserInvokedUserForceReset,
+ eErrorEventTypeReserved2,
+ eErrorEventTypeReserved3,
+ eErrorEventTypeUserInvokedCollectAllLogs,
+ eErrorEventTypeBootMicroReset,
+ eErrorEventTypeProcessExit,
+ eErrorEventTypeUserInvokedCollectScreenShot,
+ eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs,
+ eErrorEventTypeEelExport,
+ eErrorEventTypeInterfaceunifiedEmmcLogs,
+ eErrorEventTypeDiagEvent,
+ eErrorEventTypeCanEvent,
+ eErrorEventTypeDtcEvent,
+ eErrorEventTypeModConnFailed,
+ eErrorEventTypeStartRespFailed,
+ eErrorEventTypeUserInvokedCollectDevLogs,
+ eErrorEventTypeModuleInvokedResetRequest,
+ eErrorEventTypeModuleInvokedCollectDebugLogs,
+ eErrorEventTypeUserInvokedClearLogs,
+ eErrorEventTypeUserInvokedCollectNaviLog,
+ eErrorEventTypeGroupRelaunch,
+ eErrorEventTypeMaxValue
+};
+
+/* Value range of EArtifactId must be defined within 32, */
+/* because of it's definition is used by 4byte bitmask. */
+enum EArtifactId {
+ eArtifactIdInterfaceunifiedDebugLog = 0,
+ eArtifactIdTransmitLog,
+ eArtifactIdPerformanceLog,
+ eArtifactIdBootMicroLog,
+ eArtifactIdSystemDataCsv,
+ eArtifactIdShowMemTxt, // << ID 5
+ eArtifactIdProcessCore,
+ eArtifactIdDebugDumpLog,
+ eArtifactIdKernelLog,
+ eArtifactIdDRInitialLog,
+ eArtifactIdDRLocationLog, // << ID 10
+ eArtifactIdCpuHighLoadMonteCarloLogs,
+ eArtifactIdMetaCoreLogs,
+ eArtifactIdCmsLogs,
+ eArtifactIDInternalDTC,
+ eArtifactIdComDebugLog, // << ID 15
+ eArtifactIdKernelBootLog,
+ eArtifactIdPstoreLog,
+ eArtifactIdClearAllLog,
+ eArtifactIdNaviLog,
+ eArtifactIdScreenShot, // These three Log entries have to remain
+ eArtifactIdDebugFolder2Content, // at the end of the list
+ eArtifactIdDebugFolderContent,
+ eArtifactIdMaxValue // << 23
+};
+
+struct ARTIFACT_RESPONSE {
+ EArtifactId ArtifactId;
+ CHAR FilePathAndName[MAX_PATH_LENGTH];
+};
+
+
+#endif /* __SS_ERROR_EVENT_COMMON_H___ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_error_event_common_local.h b/systemservice/interface_unified/library/include/system_service/ss_error_event_common_local.h
new file mode 100755
index 0000000..47da0d3
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_error_event_common_local.h
@@ -0,0 +1,63 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_error_event_common_local.h
+ * @brief This file supports SM logging.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef __SS_ERROR_EVENT_COMMON_LOCAL_H__ // NOLINT (build/header_guard)
+#define __SS_ERROR_EVENT_COMMON_LOCAL_H__
+
+#define SS_ERROR_EVENT_START_REQ_TO_SEC (5)
+#define SS_ERROR_EVENT_DEBUG_DUMP_RSPN_TO_SEC (1)
+#define SS_ERROR_EVENT_BOOT_MICRO_LOG_RESPONSE_TO_SEC (2)
+#define SS_ERROR_EVENT_CORE_FILE_POLL_TO_MS (100)
+
+// Do not change enumeration order.
+// HMI hard codes error event square
+// colors based on expected enum order.
+enum EErrorEventPrio { /* Higher number = higher priority. */
+ eErrorEventPrioDiagLogRequest = 8,
+ eErrorEventPrioUserInvokedCollectAllLogs = 7,
+ eErrorEventPrioUserInvokedCollectScreenShot = 6,
+ eErrorEventPrioUserInvokedCollectInterfaceunifiedLogs = 5,
+ eErrorEventPrioModuleInvokedCollectDebugLogs = 4,
+ eErrorEventPrioUserInvokedUserForceReset = 3,
+ eErrorEventPrioEelStorageFilePresent = 2,
+ eErrorEventPrioEmmcLogsFilePresent = 1,
+ eErrorEventPrioDefault = 0
+};
+
+
+#endif /* __SS_ERROR_EVENT_COMMON_LOCAL_H__ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
+
diff --git a/systemservice/interface_unified/library/include/system_service/ss_error_message.h b/systemservice/interface_unified/library/include/system_service/ss_error_message.h
new file mode 100755
index 0000000..e810d7b
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_error_message.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_error_message.h
+ * @brief \~english This file contains declaration of system error message
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef _SS_ERROR_MESSAGE_H_ // NOLINT (build/header_guard)
+#define _SS_ERROR_MESSAGE_H_
+
+#define SS_ERROR_MSG_USB_DISCON "UsbDisconnected"
+#define SS_ERROR_MSG__CWORD84__ABNORMAL_SHUTDOWN "_CWORD84_AbnormalShutdown"
+
+#endif // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_heartbeat_if.h b/systemservice/interface_unified/library/include/system_service/ss_heartbeat_if.h
new file mode 100755
index 0000000..e5a94e5
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_heartbeat_if.h
@@ -0,0 +1,165 @@
+/**
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_heartbeat_if.h
+ * @brief \~english This file supports the System Manager Heartbeat Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_HEARTBEAT_IF_H_ // NOLINT (build/header_guard)
+#define SS_HEARTBEAT_IF_H_
+
+#include <string>
+
+typedef struct {
+ BOOL fAvailable;
+ HANDLE hService;
+ std::string szServiceName;
+}THeartBeatSession;
+
+
+class CHeartBeatServiceIf {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Constructor of CHeartBeatServiceIf class.
+ /// \~english @param [in] avail
+ /// BOOL avail - default value of HBSession available
+ /// \~english @param [in] service
+ /// HANDLE service - set default value of Service handle
+ /// \~english @param [in] name
+ /// PSTR name - set application name used by client
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Constructor of CHeartBeatServiceIf class. \n
+ /// variables (g_tHeartBeatSession) to be initialization.
+ /// \~english @see ~CHeartBeatServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ CHeartBeatServiceIf(BOOL avail, HANDLE service, PCSTR name);
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Destructor of CHeartBeatServiceIf class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a CHeartBeatServiceIf class. \n
+ /// pHeartBeatServiceIf is not NULL, to delete it.\n
+ /// \~english @see CHeartBeatServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CHeartBeatServiceIf();
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Subscribe hApp to message queue of the HeartBeat client application.
+ /// \~english @param [in] f_hApp
+ /// HANDLE - Handle to message queue of the HeartBeat client application.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument.
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded the maximum number of
+ /// Notification. [eFrameworkunifiedStatusFail]
+ /// - The acquisition of the buffer for storing a plurality of information of Notification Handler specified by
+ /// the argument has failed. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more
+ /// than 20byte) [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to the NPP Service.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for the NPP Service.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Subscribe hApp to message queue of the HeartBeat client application. \n
+ /// if service hApp is NULL and hApp is not be Subscribed,return eFrameworkunifiedStatusNullPointer.\n
+ /// if service hApp is Subscribe to Heartbeat Serivceand hApp is not NULL,then subscribe hApp to message
+ /// queue of the HeartBeat client application.
+ /// \~english @see FrameworkunifiedGetAppName FrameworkunifiedSubscribeNotificationsWithCallback
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnHeartBeatRequest(HANDLE hApp);
+
+ private:
+ THeartBeatSession g_tHeartBeatSession;
+
+
+ friend EFrameworkunifiedStatus DBG_CloseHeatBeat(HANDLE hApp);
+};
+
+#endif /* SS_HEARTBEAT_IF_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_heartbeat_notifications.h b/systemservice/interface_unified/library/include/system_service/ss_heartbeat_notifications.h
new file mode 100755
index 0000000..8b25fe1
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_heartbeat_notifications.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_heartbeat_notifications.h
+ * @brief This file supports the System Manager Heartbeat Service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_HEARTBEAT_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define SS_HEARTBEAT_NOTIFICATIONS_H_
+
+#include "system_service/ss_services.h"
+
+/// Indicates if HeartBeat is available or unavailable
+#define NTFY_HeartBeatAvailability SERVICE_HEARTBEAT"/Availability"
+
+#endif /* SS_HEARTBEAT_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h b/systemservice/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h
new file mode 100755
index 0000000..6d31d04
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h
@@ -0,0 +1,72 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// Handle HeartBeat Module Start and Stop notifications.
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ss_heartbeat_service_protocol.h
+ * @brief API Header for HeartBeat messages used by senders and receivers.
+ *
+ * Declares the external Protocol messages to the HeartBeat.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_HEARTBEAT_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard)
+#define SS_HEARTBEAT_SERVICE_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+
+/// \brief HeatBeat Protocol Command
+/// heartbeat service protocol --> define all protocol messages in and out of heart beat thread
+/// that are pertinent to the functionality offered by heart beat thread.
+typedef enum T_SMHBProtocolMessages {
+ // Diagnostic Protocol
+ SS_HEARTBEAT_PRINT_CONNECTIONS = 0x32, ///< client to hb thread
+ SS_HEARTBEAT_PRINT_STACK = 0x33, ///< client to hb thread
+ SS_HEARTBEAT_PERIODIC_STATUS_REQ = 0xD0, ///< sysmgr to hb thread
+ SS_HEARTBEAT_PERIODIC_RESP = 0xD1, ///< hb thread to sysmgr
+ SS_HEARTBEAT_START = 0xD2, ///< sysmgr to hb thread
+ SS_HEARTBEAT_STOP = 0xD3, ///< sysmgr to hb thread
+ SS_HEARTBEAT_DELETE_MODULE_ENTRY = 0xD5, ///< sysmgr to hb thread
+ SS_HEARTBEAT_MSG_CATEGORY_REPORT = 0xD6, ///< report message
+ SS_HEARTBEAT_ERROR_DETECTED = 0xD8, ///< hb thread to sysmgr
+ SS_HEARTBEAT_APPEND_MODULE_ENTRY = 0xD9, ///< sysmgr to hb thread
+ SS_HEARTBEAT_AVAIL_CHECK_REQ = 0xDA, ///< sysmgr to hb thread
+ SS_HEARTBEAT_AVAIL_CHECK_RESP = 0xDB, ///< sysmgr to hb thread
+ SS_HEARTBEAT_RESPONSE = 0xE0, ///< client to hb thread
+ SS_HEARTBEAT_REQUEST = 0xE1 ///< hb thread to client
+}EHBProtocolMessages;
+
+#endif /* SS_HEARTBEAT_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_last_to_order.h b/systemservice/interface_unified/library/include/system_service/ss_last_to_order.h
new file mode 100755
index 0000000..5a3b8b0
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_last_to_order.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_last_to_order.h
+ * @brief \~english This file contains declaration of enum SS_CONT_CATEGORY_t and api convert lastinfo to order
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef _SS_CONTID_TO_ORDER_H_ // NOLINT (build/header_guard)
+#define _SS_CONTID_TO_ORDER_H_
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include <string>
+
+typedef enum {
+ SS_CCAT_F_VIDEO,
+ SS_CCAT_F_SUB_VIDEO,
+ SS_CCAT_F_AUDIO,
+ SS_CCAT_R_VIDEO,
+ SS_CCAT_R_AUDIO,
+ SS_CCAT_MAX,
+}SS_CONT_CATEGORY_t;
+
+typedef std::string SS_CONTENT_NAME_t;
+
+typedef std::map<SS_CONT_CATEGORY_t, SS_CONTENT_NAME_t> SS_LAST_INFO_t;
+
+EFrameworkunifiedStatus SS_ConvLastInfoToOrder(SS_LAST_INFO_t &curLastMode, std::string &order, const char* p_cfgPath = NULL); //NOLINT (runtime/references)
+
+
+#endif // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_logger_service.h b/systemservice/interface_unified/library/include/system_service/ss_logger_service.h
new file mode 100755
index 0000000..67ecb08
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_logger_service.h
@@ -0,0 +1,255 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_service.h
+ * @brief \~english This file supports the the Logger Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_LOGGER_SERVICE_H_ // NOLINT (build/header_guard)
+#define SS_LOGGER_SERVICE_H_
+
+
+#include <native_service/frameworkunified_types.h>
+
+#define MAX_STATISTICAL_BUFFER 240
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Shared Memory names
+///////////////////////////////////////////////////////////////////////////////
+#define SHMEM_DRLOCATIONLOG "/DRLocationLog"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Shared Memory names
+///////////////////////////////////////////////////////////////////////////////
+#define SHMEM_DRINITIALLOG "/DRInitialLog"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief VIN numbers
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _TVINnumber {
+ static const UI_8 VIN_LEN = 18;
+ CHAR VINstr[VIN_LEN];
+} STVIN_NUMBER;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief CAN Diagnostic status data
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _TInterfaceunifiedCANMileageInfo {
+ UI_8 DidA_ExtTest_Pres;
+ UI_8 EngRun_Stat;
+ UI_8 Odo_MSB_H;
+ UI_8 Odo_MSB_L;
+ UI_8 Odo_LSB_H;
+ UI_8 Odo_LSB_L;
+ UI_8 PN14_SupBat_Volt;
+} STLOGGER_CANDIAGSTAT;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief CAN current date and time
+///////////////////////////////////////////////////////////////////////////////
+/**
+* @struct __CWORD62_DateAndTime
+* @brief \~english CAN current date and time
+*/
+typedef struct __CWORD62_DateAndTime {
+ UI_8 DateTime_Stat; /*!< \~english Date time status*/
+ UI_8 DateTimeDay; /*!< \~english Date*/
+ UI_8 DateTimeHour; /*!< \~english Hour*/
+ UI_8 DateTimeMinute; /*!< \~english Minute*/
+ UI_8 DateTimeMonth; /*!< \~english Month*/
+ UI_8 DateTimeSecond; /*!< \~english Second*/
+ UI_8 DateTimeYear; /*!< \~english Year*/
+ UI_8 TimeFormat; /*!< \~english Format*/
+}STCanCurrentDateTime;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger Device Type
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _ELoggerDeviceTypes {
+ eDevUSB1,
+ eDevUSB2,
+ eDevSD,
+ eTotalDevicesTypes,
+ eInvalid_DevType
+}EDEV_TYPE;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger State
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _ELoggerState {
+ eDeactivate,
+ eActivate,
+ eInvalid_LoggerState
+}ELOGGER_STAT;
+
+typedef enum _ELoggerErrorCodes {
+ eSelectedDeviceNotFound = 0x0001,
+ eWriteToDeviceFailed = 0x0002,
+ eScreenCaptureFailed = 0x0003,
+ eScreenCaptureSaveTimeExpired = 0x0004,
+ eScreenCaptureStoreTimeExpired = 0x0005,
+ eNoLogToStore = 0x0006,
+}ELOGGERERR_CODES;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Screen Capture Event data
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _TInterfaceunifiedScreenCaptureEvt {
+ static const UI_16 STR_BUFF_LEN = 64;
+ BOOL fSucessful;
+ UI_32 uiSceenShotId;
+ CHAR strNameAndLocation[STR_BUFF_LEN];
+ UI_32 uiFaultReasonCode;
+}STScreenCaptureEvt;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief USB source number to store event logs.
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _EEventLoggerUSBDeviceNumber {
+ USB0 = 0,
+ USB1 = 1,
+ SD = 2
+}EEvtLogUSBDevNumber;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief USB source number to store emergency error logs.
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _EDevNumber {
+ eEEL_USB1 = 1,
+ eEEL_USB2 = 2,
+ eEEL_SD = 3
+}EDevNumber;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Counter group ID.
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _ECounterGroupID {
+ STARTUP_SHUTDOWN_COUNTER_GROUP = 0x01,
+ APP_USAGE_COUNTER_GROUP,
+ F_BLK_STABILITY_COUNTER_GROUP,
+ MAX_COUNTER_GROUP
+}EStatCounterGroupID;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Statistical counter.
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _SStatisticalCounter {
+ UI_16 u16StartupCounterLength; ///< No of Counter from startup phase
+ UI_16 u16NormalCounterLength; ///< No of Counter from Normal phase
+ UI_16 u16ShutDownCounterLength; ///< No of Counter from Shut down phase
+ UI_8 StatisticalCountBuffer[MAX_STATISTICAL_BUFFER]; ///< Counter values for startup,normal and shutsown phases
+}SStatisticalCounter;
+
+typedef enum _EEventLoggerSuccessCode {
+ COPY_EVT_USB_SUCCESS = 0x20,
+ CLEAR_EVENT_LOG_SUCCESS = 0x21,
+ STATISTICAL_COUNTER_READ_SUCCESS = 0x22
+}EEvtLoggerSuccessCode;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event Logger error code
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _EEventLoggerErrorCode {
+ USB_DEVICE_NOT_AVAILABLE = 0x10,
+ USB_DEVICE_WRITE_ERROR = 0x11,
+ CLEAR_EVENT_LOG_FAILED = 0x12,
+ STATISTICAL_COUNTER_READ_FAILED = 0x13,
+ NO_ERROR_INFO = 0x14
+}EEvtLoggerErrorCode;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Emergency Log error code
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _EEmergencyLogErrorCode {
+ eDEVICE_NOT_AVAILABLE = 0x10,
+ eDEVICE_WRITE_ERROR = 0x11,
+ eNO_ERROR_INFO = 0x12
+}EELL_ErrorCode;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event logger common information
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _SEventLoggerCommonInfo {
+ UI_8 BodyCAN_Stat:4;
+ UI_8 HeadUnitCAN_Stat:4;
+ UI_8 HMIInteraction:4;
+ UI_8 IGN_Status:4;
+ UI_8 FOT_Temp:2;
+ UI_8 SystemVoltage:6;
+}STEventLoggerCommonInfo;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event logger resets counter information
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _SEventLoggerResetInfo {
+ UI_8 _CWORD56__ResetInfo;
+ UI_8 _CWORD102__ResetInfo;
+}STEventLoggerResetInfo;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event logger _CWORD56_ events information
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _SEventLoggerEventInfo {
+ UI_8 NumberOfEvents;
+ UI_8 EventGroup;
+ UI_8 EventIdentifier;
+ UI_8 EventData[4];
+}STEventLoggerEventInfo;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event logger CAN events information
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _SEventCANLoggerEventInfo {
+ BOOL success;
+ BOOL valid;
+ UI_32 triggerNumber;
+ STCanCurrentDateTime dateAndTime;
+}STEventCANLoggerEventInfo;
+
+#endif /* SS_LOGGER_SERVICE_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+
diff --git a/systemservice/interface_unified/library/include/system_service/ss_logger_service_ifc.h b/systemservice/interface_unified/library/include/system_service/ss_logger_service_ifc.h
new file mode 100755
index 0000000..2646c73
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_logger_service_ifc.h
@@ -0,0 +1,1865 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_service_ifc.h
+ * @brief \~english This file supports the the Logger Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup logger_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_LOGGER_SERVICE_IFC_H_ // NOLINT (build/header_guard)
+#define SS_LOGGER_SERVICE_IFC_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include "system_service/ss_logger_service.h"
+#include "system_service/ss_logger_service_protocol.h"
+
+/**
+ * @class LoggerServiceIf
+ * \~english @brief logger_service
+ * \~english @par Brief Introduction
+ * Class to provide LoggerServiceIf
+ *
+ */
+class LoggerServiceIf {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerServiceIf
+ /// \~english @par Summary
+ /// Constructor of LoggerServiceIf class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a LoggerServiceIf class, and initialize member variables(m_hApp, m_hService, m_hSession) to be
+ /// NULL. \n
+ /// After the constructor, be sure to call the Initialize.
+ /// \~english @see ~LoggerServiceIf, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ LoggerServiceIf();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~LoggerServiceIf
+ /// \~english @par Summary
+ /// Destructor of LoggerServiceIf class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a LoggerServiceIf class. \n
+ /// If the service and the session is started (open) state, causing the end (closed).
+ /// \~english @see LoggerServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~LoggerServiceIf();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Initialize
+ /// \~english @par Summary
+ /// API to initialize the LoggerServiceIf class.
+ /// \~english @param [in] hApp
+ /// HANDLE - HANDLE for Application
+ /// \~english @retval TRUE Success
+ /// \~english @retval FALSE Failure
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLE(hApp) specified in the argument is NULL. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Application to use the services of SS_LoggerService is, after generating a LoggerServiceIf class, which is a
+ /// method to be executed first. \n
+ /// Member variable(m_hApp) of LoggerServiceIf class initialized with hApp that has been specified by the
+ /// argument.
+ /// \~english @see LoggerServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Initialize(HANDLE hApp);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnLoggerServiceAvailability
+ /// \~english @par Summary
+ /// API to set the Callback function for Availability notification of SS_LoggerService.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Pointer to function callback for SS_LoggerService Availability Notification
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Can not get the App/Thread name from HANDLE in the class member variables (m_hApp).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - The acquisition of the buffer that stores the Callback information specified in the argument failed.
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hApp). [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue HANDLE in HANDLE (m_hApp) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - It is not appropriate message queue name of HANDLE (m_hApp) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hApp) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_LoggerService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_LoggerService. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_LoggerService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to register a Callback function for the initialization of the SS_LoggerService receives
+ /// the timing at which the start (open) is possible of completed service.\n
+ /// (Using API:FrameworkunifiedSubscribeNotificationsWithCallback of Native Service, to register a Callback function for
+ /// Availability notification of SS_LoggerService.)
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnLoggerServiceAvailability(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnOpenSessionAck
+ /// \~english @par Summary
+ /// API to set the Callback function for OpenSessionRequest response from SS_LoggerService.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for receiving the response of OpenSessionRequest
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To register the Callback function for receiving a response of completion of OpenSessionRequest to
+ /// Dispatcher. \n
+ /// (Using API:FrameworkunifiedAttachCallbackToDispatcher of Native Service, to register a Callback function for receiving a
+ /// response of completion of OpenSessionRequest to Dispatcher.)
+ /// \~english @see NotifyOnCloseSessionAck
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnOpenSessionAck(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnCloseSessionAck
+ /// \~english @par Summary
+ /// API to set the Callback function for CloseSessionRequest response from SS_LoggerService.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for receiving the response of OpenSessionRequest
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To register the Callback function for receiving a response of completion of CloseSessionRequest to
+ /// Dispatcher. \n
+ /// (Using API:FrameworkunifiedAttachCallbackToDispatcher of Native Service, to register a Callback function for receiving a
+ /// response of completion of CloseSessionRequest to Dispatcher.) \n
+ /// \~english @see NotifyOnOpenSessionAck
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnCloseSessionAck(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup OpenSessionRequest
+ /// \~english @par Summary
+ /// API to generate service/session of SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Availability of SS_LoggerService is TRUE.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// - Use the NotifyOnOpenSessionAck(), that you register a callback function for receiving a completion
+ /// response of OpenSessionRequest to Dispatcher
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - SS_LoggerService is not Availability state. [eFrameworkunifiedStatusFail]
+ /// - SS_LoggerService can not be opened (can not start). [eFrameworkunifiedStatusFail]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method for generating service/session of SS_LoggerService.\n
+ /// (To send the command of PROTOCOL_OPEN_SESSION_REQ to SS_LoggerService.)\n
+ /// If you already service has been created, once to close the service, and to re-open.
+ /// \~english @see CloseSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenSessionRequest();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DecodeOpenSessionResponse
+ /// \~english @par Summary
+ /// API to hold the session ID in SS_LoggerServiceIf class
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Incorrect PROTOCOL_OPEN_SESSION_ACK message length of SS_LoggerService. [eFrameworkunifiedStatusFail]
+ /// - PROTOCOL_OPEN_SESSION_ACK message of SS_LoggerService can not be acquired. [eFrameworkunifiedStatusFail]
+ /// - Can not session generation of message transmission to SS_LoggerService. [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Get the session initiation response message(PROTOCOL_OPEN_SESSION_ACK) of SS_LoggerService, and get the
+ /// session ID from the message. \n
+ /// Acquired session ID, (after opening the message transmission queue) created after a session of message
+ /// transmission, hold as the session information in the session HANDLE(m_hSession) of the class member
+ /// variable.
+ /// \~english @see OpenSessionRequest, CloseSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DecodeOpenSessionResponse();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CloseSessionRequest
+ /// \~english @par Summary
+ /// API to discard service/session of SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// - Use the NotifyOnCloseSessionAck(), that you register a callback function for receiving a completion
+ /// response of CloseSessionRequest to Dispatcher
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// which is a method for discarding service/session of SS_LoggerService.\n
+ /// (To send the command of PROTOCOL_CLOSE_SESSION_REQ to SS_LoggerService.)
+ /// \~english @see OpenSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseSessionRequest();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RegisterForLoggerEvent
+ /// \~english @par Summary
+ /// API to register a Callback function for SS_LoggerService.
+ /// \~english @param [in] f_eLoggerEvent
+ /// SS_LoggerServerEvents - Event type
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Pointer to a callback function that corresponds to the event
+ /// \~english @par
+ /// SS_LoggerServerEvents enum value
+ /// \~english @code
+ /// typedef enum _LoggerServerEvents
+ /// {
+ /// SS_LOGGER_SCREENCAPTURE_EVT = 0xA0, /* Event notification of the Screen Capture */
+ /// SS_LOGGER_ERRORINFO_EVT, /* Event notification of error log information */
+ /// SS_LOGGER_LOGINFO_EVT, /* Event notification of log information */
+ /// SS_LOGGER_LOGSTARTED_EVT /* Event notification at the time of log start */
+ /// }SS_LoggerServerEvents;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Which is a method to register a callback function for receiving the timing of the occurrence of an event in
+ /// the SS_LoggerService to the Dispatcher. \n
+ /// (To send the command of PROTOCOL_REGISTER_EVENTS to SS_LoggerService.)
+ /// \~english @see UnRegisterForLoggerEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterForLoggerEvent(SS_LoggerServerEvents f_eLoggerEvent, CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup UnRegisterForLoggerEvent
+ /// \~english @par Summary
+ /// API to cancel a Callback function for SS_LoggerService.
+ /// \~english @param [in] f_eLoggerEvent
+ /// SS_LoggerServerEvents - Event type
+ /// \~english @par
+ /// SS_LoggerServerEvents enum value
+ /// \~english @code
+ /// typedef enum _LoggerServerEvents
+ /// {
+ /// SS_LOGGER_SCREENCAPTURE_EVT = 0xA0, /* Event notification of the Screen Capture */
+ /// SS_LOGGER_ERRORINFO_EVT, /* Event notification of error log information */
+ /// SS_LOGGER_LOGINFO_EVT, /* Event notification of log information */
+ /// SS_LOGGER_LOGSTARTED_EVT /* Event notification at the time of log start */
+ /// }SS_LoggerServerEvents;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Which is a method to cancel a callback function for receiving the timing of the occurrence of an event in
+ /// the SS_LoggerService. \n
+ /// \~english @see RegisterForLoggerEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnRegisterForLoggerEvent(SS_LoggerServerEvents f_eLoggerEvent);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SendDiagStat
+ /// \~english @par Summary
+ /// API to send CAN Diagnostic status data(it has mileage information) to SS_LoggerService.
+ /// \~english @param [in] pCanDiagStat_t
+ /// STLOGGER_CANDIAGSTAT - Pointer to structure of CAN Diagnostic state data
+ /// \~english @par
+ /// STLOGGER_CANDIAGSTAT Structure
+ /// \~english @code
+ /// typedef struct _TInterfaceunifiedCANMileageInfo
+ /// {
+ /// UI_8 DidA_ExtTest_Pres; /* For extended test(unused) */
+ /// UI_8 EngRun_Stat; /* Engine run state(unused) */
+ /// UI_8 Odo_MSB_H; /* Mileage information(MSB:High) */
+ /// UI_8 Odo_MSB_L; /* Mileage information(MSB:Low) */
+ /// UI_8 Odo_LSB_H; /* Mileage information(LSB:High) */
+ /// UI_8 Odo_LSB_L; /* Mileage information(LSB:Low) */
+ /// UI_8 PN14_SupBat_Volt; /* Battery voltage(unused) */
+ /// }STLOGGER_CANDIAGSTAT;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send the mileage information in the CAN diagnostic state data to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_MILEAGE_DATA to SS_LoggerService. \n
+ /// SS_LoggerService uses the log write thread, to output a log of the mileage information.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SendDiagStat(STLOGGER_CANDIAGSTAT *pCanDiagStat_t);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_CANGetCurrentDateAndTime
+ /// \~english @par Summary
+ /// API to send the current date and time of the CAN to SS_LoggerService.
+ /// \~english @param [in] stDateAndTime
+ /// STCanCurrentDateTime - Structure of CAN current date and time
+ /// \~english @par
+ /// STCanCurrentDateTime Structure
+ /// \~english @code
+ /// typedef struct __CWORD62_DateAndTime
+ /// {
+ /// UI_8 DateTime_Stat; /* Date and Time State */
+ /// UI_8 DateTimeDay; /* Day */
+ /// UI_8 DateTimeHour; /* Hour */
+ /// UI_8 DateTimeMinute; /* Minute */
+ /// UI_8 DateTimeMonth; /* Month */
+ /// UI_8 DateTimeSecond; /* Second */
+ /// UI_8 DateTimeYear; /* Year */
+ /// UI_8 TimeFormat; /* Time display format */
+ /// }STCanCurrentDateTime;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send current date and time of the CAN to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_SET_DATETIME to SS_LoggerService.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_CANGetCurrentDateAndTime(STCanCurrentDateTime stDateAndTime);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_CANSetVIN
+ /// \~english @par Summary
+ /// API to send the Vehicle Identification Number(VIN) to SS_LoggerService.
+ /// \~english @param [in] stVinNumber
+ /// STVIN_NUMBER& - Structure of Vehicle Identification Number(VIN)
+ /// \~english @par
+ /// STVIN_NUMBER Structure
+ /// \~english @code
+ /// typedef struct _TVINnumber
+ /// {
+ /// static const UI_8 VIN_LEN = 18;
+ /// CHAR VINstr[VIN_LEN]; /* Vehicle Identification Number(VIN) */
+ /// }STVIN_NUMBER;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send the Vehicle Identification Number(VIN) to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_SET_VIN to Logger Service. \n
+ /// SS_LoggerService uses the log write thread, to output a log of the Vehicle Identification Number(VIN).
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_CANSetVIN(STVIN_NUMBER& stVinNumber); // NOLINT (runtime/references)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_SetLoggerParams
+ /// \~english @par Summary
+ /// API to send the logging propriety information of the selected device to SS_LoggerService.
+ /// \~english @param [in] eLoggerStatus
+ /// ELOGGER_STAT - Logging propriety information
+ /// \~english @param [in] eDevType
+ /// EDEV_TYPE - Device type
+ /// \~english @par
+ /// ELOGGER_STAT enum value
+ /// \~english @code
+ /// typedef enum _ELoggerState
+ /// {
+ /// eDeactivate, /* Logging impossible(Deativate) */
+ /// eActivate, /* Logging possible(Activate) */
+ /// eInvalid_LoggerState /* Invalid logging state */
+ /// }ELOGGER_STAT;
+ /// @endcode
+ /// \~english @par
+ /// EDEV_TYPE enum value
+ /// \~english @code
+ /// typedef enum _ELoggerDeviceTypes
+ /// {
+ /// eDevUSB1, /* USB1 */
+ /// eDevUSB2, /* USB2 */
+ /// eDevSD, /* SD */
+ /// eTotalDevicesTypes, /* Total device types */
+ /// eInvalid_DevType /* Invalid device type */
+ /// }EDEV_TYPE;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send the logging propriety information of the selected device to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_SET_PARAMS to SS_LoggerService. \n
+ /// SS_LoggerService is based on the logging propriety information of the transmission selection device, and
+ /// update as a member variable of the class.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_SetLoggerParams(ELOGGER_STAT eLoggerStatus, EDEV_TYPE eDevType);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_UDPLogging
+ /// \~english @par Summary
+ /// API to send the logging propriety information of UDP to SS_LoggerService.
+ /// \~english @param [in] eLoggerStatus
+ /// ELOGGER_STAT - Logging propriety information
+ /// \~english @par
+ /// ELOGGER_STAT enum value
+ /// \~english @code
+ /// typedef enum _ELoggerState
+ /// {
+ /// eDeactivate, /* Logging impossible(Deativate) */
+ /// eActivate, /* Logging possible(Activate) */
+ /// eInvalid_LoggerState /* Invalid logging state */
+ /// }ELOGGER_STAT;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send the logging propriety information of UDP to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_UDP_LOGGING to SS_LoggerService. \n
+ /// SS_LoggerService is based on the logging propriety information of the transmission UDP, and update as a
+ /// member variable of the class.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_UDPLogging(ELOGGER_STAT eLoggerStatus);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_ScreenCaptureEventACK
+ /// \~english @par Summary
+ /// API to send the event response of screen capture to SS_LoggerService.
+ /// \~english @param [in] stScreenCaptureInfo
+ /// STScreenCaptureEvt - Structure of event data of screen capture
+ /// \~english @par
+ /// STScreenCaptureEvt Structure
+ /// \~english @code
+ /// typedef struct _TInterfaceunifiedScreenCaptureEvt
+ /// {
+ /// static const UI_16 STR_BUFF_LEN = 64;
+ /// BOOL fSucessful; /* Success propriety flag */
+ /// UI_32 uiSceenShotId; /* Screen capture ID */
+ /// CHAR strNameAndLocation[STR_BUFF_LEN]; /* Screen capture save file name */
+ /// UI_32 uiFaultReasonCode; /* Failure reason code */
+ /// }STScreenCaptureEvt;
+ /// @endcode
+ /// \~english @par
+ /// uiFaultReasonCode : Failure reason code (plm::screen_shot::status List)
+ /// - ok : Success
+ /// - invalid_window_handle : Invalid window handle
+ /// - invalid_context_handle : Invalid context handle
+ /// - display_count_error : Display count error
+ /// - rgb_display_not_found : RGB display not found
+ /// - create_pixmap_error : Create error of PIXMAP
+ /// - usage_pixmap_property_error : Usage error of PIXMAP property
+ /// - format_pixmap_property_error : Format error of PIXMAP property
+ /// - buffer_pixmap_property_error : Buffer error of PIXMAP property
+ /// - create_pixmap_buffer_error : Create error of PIXMAP buffer
+ /// - render_pixmap_property_error : Render error of PIXMAP property
+ /// - pointer_pixmap_property_error : Pointer error of PIXMAP property
+ /// - stride_pixmap_property_error : Stride error of PIXMAP property
+ /// - window_read_error : Window read error
+ /// - write_bitmap_file_error : Writing error of bitmap files
+ /// - window_post_error : Window post error
+ /// - window_property_error : Window property error
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// As the data in the event the response of the screen capture to SS_LoggerService, which is a method for
+ /// transmitting the information of the screen capture ID and screen capture save file name.\n
+ /// Send a message in the command ID of SS_LOGGER_SCREENCAPTURE_EVT_ACK to SS_LoggerService. \n
+ /// This API is an API for screen capture in PLM(Physical Layer Management) function support. In PLM
+ /// non-support, to prohibit the use.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_ScreenCaptureEventACK(STScreenCaptureEvt stScreenCaptureInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_EventLoggingCommonInfo
+ /// \~english @par Summary
+ /// API to send the event information of the common log in SS_LoggerService.
+ /// \~english @param [in] stEventCommonInfo
+ /// STEventLoggerCommonInfo - Event information structure of the common log
+ /// \~english @par
+ /// STEventLoggerCommonInfo Structure
+ /// \~english @code
+ /// typedef struct _SEventLoggerCommonInfo
+ /// {
+ /// UI_8 BodyCAN_Stat:4; /* CAN state of the body */
+ /// UI_8 HeadUnitCAN_Stat:4; /* CAN state of the Head Unit */
+ /// UI_8 HMIInteraction:4; /* HMI Interaction */
+ /// UI_8 IGN_Status:4; /* Ignition state */
+ /// UI_8 FOT_Temp:2; /* Field Operation Tests Temporary */
+ /// UI_8 SystemVoltage:6; /* System Voltage */
+ /// }STEventLoggerCommonInfo;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// It is a method to send the event information of the common log to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_EVENT_COMMONINFO to SS_LoggerService. \n
+ /// Using the log write thread, SS_LoggerService outputs the following log information.
+ /// - CAN state of the body
+ /// - CAN state of the Head Unit
+ /// - HMI Interaction
+ /// - Ignition state
+ /// - System Voltage
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_EventLoggingCommonInfo(STEventLoggerCommonInfo stEventCommonInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_EventLoggingEventInfo
+ /// \~english @par Summary
+ /// API to send the event information of the _CWORD56_ log to SS_LoggerService.
+ /// \~english @param [in] stEventInfo
+ /// STEventLoggerEventInfo - Event information structure of _CWORD56_ log
+ /// \~english @par
+ /// STEventLoggerEventInfo Structure
+ /// \~english @code
+ /// typedef struct _SEventLoggerCommonInfo
+ /// {
+ /// UI_8 NumberOfEvents; /* Event count */
+ /// UI_8 EventGroup; /* Event group */
+ /// UI_8 EventIdentifier; /* Event identifier */
+ /// UI_8 EventData[4]; /* Event data */
+ /// }STEventLoggerEventInfo;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// It is a method to send the event information of _CWORD56_ log to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER__CWORD56__EVENT_INFO to SS_LoggerService.\n
+ /// Using the log write thread, SS_LoggerService outputs the following log information.
+ /// - Event count
+ /// - Event group
+ /// - Event identifier
+ /// - Event data
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_EventLoggingEventInfo(STEventLoggerEventInfo stEventInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_EventLoggingResetInfo
+ /// \~english @par Summary
+ /// API to send the event information of _CWORD56_ reset count to SS_LoggerService.
+ /// \~english @param [in] stResetInfo
+ /// STEventLoggerResetInfo - Event information structure of _CWORD56_ reset counter
+ /// \~english @par
+ /// STEventLoggerResetInfo Structure
+ /// \~english @code
+ /// typedef struct _SEventLoggerResetInfo
+ /// {
+ /// UI_8 _CWORD56__ResetInfo; /* Reset counter information of _CWORD56_ */
+ /// UI_8 _CWORD102__ResetInfo; /* Reset counter information of _CWORD102_ */
+ /// }STEventLoggerResetInfo;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// It is a method to send the event information of _CWORD56_ reset counter to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER__CWORD56__RESET_INFO to SS_LoggerService. \n
+ /// Using the log write thread, SS_LoggerService outputs the following log information.
+ /// - Reset counter information of _CWORD56_
+ /// - Reset counter information of _CWORD102_
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_EventLoggingResetInfo(STEventLoggerResetInfo stResetInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_PersistEventLogOnActiveDTC
+ /// \~english @par Summary
+ /// API to persist the event log on the DTC to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send a message of the order to immediately persist the event log on the DTC(Diagnostic
+ /// Trouble Code) to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_DIAGDTC_ACTIVE to SS_LoggerService.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_PersistEventLogOnActiveDTC(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_Shutdown_Complete
+ /// \~english @par Summary
+ /// API to send a shutdown completion message to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to send a shutdown completion message to SS_LoggerService.\n
+ /// Send a message in the command ID of SS_LOGGER_SHUTDOWN_COMPLETE to SS_LoggerService.\n
+ /// SS_LoggerService stops the thread for the log writing, and the Availability of self-service is set to FALSE,
+ /// to disable the service.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_Shutdown_Complete(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StoreEventLogsToUSB
+ /// \~english @par Summary
+ /// API to request an event log output to USB/SD to SS_LoggerService.
+ /// \~english @param [in] eUSBDevNumber
+ /// EEvtLogUSBDevNumber - Event Log output destination USB/SD device number
+ /// \~english @par
+ /// EEvtLogUSBDevNumber enum value
+ /// \~english @code
+ /// typedef enum _EEventLoggerUSBDeviceNumber
+ /// {
+ /// USB0=0, /* USB0 */
+ /// USB1=1, /* USB1 */
+ /// SD=2 /* SD */
+ /// }EEvtLogUSBDevNumber;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to request the event log output to USB/SD to SS_LoggerService.\n
+ /// To send a message in the command ID of SS_LOGGERCOPYEVENTUSB against SS_LoggerService. \n
+ /// Using the event log writing thread, SS_LoggerService output the event log to the specified device (USB/SD).
+ /// \n
+ /// As a result of the event output, the message is notified to the caller of the API in the command ID below.
+ /// - Success: SS_LOGGERCOPYEVENTUSB_SUCCESS_RESP
+ /// - Failure: SS_LOGGERCOPYEVENTUSB_ERROR_RESP
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus StoreEventLogsToUSB(EEvtLogUSBDevNumber eUSBDevNumber);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StoreEmergencyErrorLogsToUSB
+ /// \~english @par Summary
+ /// API to request the emergency error log output to USB/SD to SS_LoggerService.
+ /// \~english @param [in] eDevNumber
+ /// EDevNumber - Emergency error log output destination USB/SD device number
+ /// \~english @par
+ /// EDevNumber value of enum
+ /// \~english @code
+ /// typedef enum _EDevNumber
+ /// {
+ /// eEEL_USB1=1, /* USB0 */
+ /// eEEL_USB2=2, /* USB1 */
+ /// eEEL_SD=3 /* SD */
+ /// }EDevNumber ;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to request the emergency error log output to USB/SD to SS_LoggerService.\n
+ /// To send a message in the command ID of SS_LOGGERCOPYEMERGENCYLOGS against SS_LoggerService. \n
+ /// Using the diagnostic log output function of System Manager, SS_LoggerService output the emergency error log
+ /// to the specified device(USB/SD). \n
+ /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the
+ /// command ID below.
+ /// - Success: SS_LOGGERCOPYEMERGENCYLOGS_SUCCESS_RESP
+ /// - Failure: SS_LOGGERCOPYEMERGENCYLOGS_ERROR_RESP
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus StoreEmergencyErrorLogsToUSB(EDevNumber eDevNumber);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StartCANLogging
+ /// \~english @par Summary
+ /// API to request the start of CAN logging to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to request the start of CAN logging against SS_LoggerService. \n
+ /// This function is called by CAN to trigger Logging to USB. \n
+ /// Progress is published by notifications eSSLoggerCANEventStart, eSSLoggerCANEventError and
+ /// eSSLoggerCANEventFinished. \n
+ /// To send a message in the command ID of eSSLoggerCANProtocolIDCANTrigger against SS_LoggerService. \n
+ /// SS_LoggerService requests the logging start of CAN to the System Manager.
+ /// \~english @see RegisterLoggingStartNotification, RegisterLoggingFinishNotification
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus StartCANLogging(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RegisterLoggingStartNotification
+ /// \~english @par Summary
+ /// API to set a callback function for CAN logging start notification.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for CAN logging start notification
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Handle name of the session message queue is NULL to SS_LoggerService. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE of the session message to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE of the session message to SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of the session message to SS_LoggerService(The name is NULL, more
+ /// than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_LoggerService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_LoggerService. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_LoggerService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// Use the StartCANLogging, after the request of the start of the CAN logging operation, which is a method to
+ /// register a callback function to receive a notification of the start of the logging operation.\n
+ /// (Using API:FrameworkunifiedSubscribeToSessionEventWithCallback of Native Service, to register a Callback function for CAN
+ /// logging start notification.) \n
+ /// SS_LoggerService publish the logging start of CAN in the notification of eSSLoggerCANEventStart to
+ /// Subscribers.
+ /// \~english @see StartCANLogging, RegisterLoggingFinishNotification
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterLoggingStartNotification(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RegisterLoggingFinishNotification
+ /// \~english @par Summary
+ /// API to set a callback function for CAN logging finish notification.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for CAN logging finish notification
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Handle name of the session message queue is NULL to SS_LoggerService. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE of the session message to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE of the session message to SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of the session message to SS_LoggerService(The name is NULL, more
+ /// than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_LoggerService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_LoggerService. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_LoggerService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to register a callback function to receive a notification of the finish of the logging
+ /// operation.\n
+ /// (Using API:FrameworkunifiedSubscribeToSessionEventWithCallback of Native Service, to register a Callback function for CAN
+ /// logging finish notification.) \n
+ /// SS_LoggerService publish the logging finish of CAN in the notification of eSSLoggerCANEventFinished to
+ /// Subscribers.
+ /// \~english @see StartCANLogging, RegisterLoggingStartNotification
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterLoggingFinishNotification(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StartDTCLoggingToEmmc
+ /// \~english @par Summary
+ /// API to request the start of CAN logging to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to request the start of CAN logging to SS_LoggerService. \n
+ /// This function is called by CAN at the time of the trigger of the error that occurred in the DTC. \n
+ /// Progress is published by notifications eSSLoggerCANEventStart, eSSLoggerCANEventError and
+ /// eSSLoggerCANEventFinished. \n
+ /// To send a message in the command ID of eSSLoggerCANProtocolIDDTCTrigger against SS_LoggerService. \n
+ /// SS_LoggerService sends a message in the command ID of eThrdCmdImmPersistEvtLog against the event log writing
+ /// thread. \n
+ /// Event log writing thread will immediately start with respect to the event log for Persistent.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus StartDTCLoggingToEmmc(UI_32 f_dtc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ClearEventLogs
+ /// \~english @par Summary
+ /// API to request to clear the event log to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to request to clear the event log to SS_LoggerService. \n
+ /// To send a message in the command ID of SS_LOGGERCLEAREVENT against SS_LoggerService. \n
+ /// SS_LoggerService sends a message in the command ID of eThrdCmdClearEvntLogs against the event log writing
+ /// thread. \n
+ /// Event log write thread, delete all the event logs that are queued in the log write waiting. \n
+ /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the
+ /// command ID below.
+ /// - Success: SS_LOGGERCLEAREVENT_SUCCESS_RESP
+ /// - Failure: SS_LOGGERCLEAREVENT_ERROR_RESP
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearEventLogs(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ReadStatisticalCounter
+ /// \~english @par Summary
+ /// API to request a statistics counter reading of the event log to SS_LoggerService.
+ /// \~english @param [in] eCounterGroup
+ /// EStatCounterGroupID - Group ID of the statistics counter
+ /// \~english @par
+ /// EStatCounterGroupID enum value
+ /// \~english @code
+ /// typedef enum _ECounterGroupID
+ /// {
+ /// STARTUP_SHUTDOWN_COUNTER_GROUP =0x01, /* Statistics counter group for StartUp/Shutdown */
+ /// APP_USAGE_COUNTER_GROUP, /* Statistics counter group for application usage */
+ /// F_BLK_STABILITY_COUNTER_GROUP, /* Do not use : Statistics counter for flash access */
+ /// MAX_COUNTER_GROUP /* Max value of statistics counter group */
+ /// }EStatCounterGroupID ;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Fire and Forget
+ /// \~english @par Detail
+ /// Against SS_LoggerService, which is a method that requires a reading of the statistics counter corresponding
+ /// to the statistics counter groups in the event log. \n
+ /// To send a message in the command ID of SS_LOGGER_READ_STATL_COUNTER against SS_LoggerService. \n
+ /// SS_LoggerService sends a message in the command ID of eThrdCmdStatisticalCounter against the event log
+ /// writing thread. \n
+ /// Event log write thread read the statistics counter corresponding to the statistics counter groups in the
+ /// event log. \n
+ /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the
+ /// command ID below.
+ /// - Success: SS_LOGGER_READ_STATL_COUNTER_SUCCESS_RESP
+ /// - Failure: SS_LOGGER_READ_STATL_COUNTER_ERROR_RESP
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ReadStatisticalCounter(EStatCounterGroupID eCounterGroup);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ResetStatisticalCounter
+ /// \~english @par Summary
+ /// API to request the reset of statistics counters of the event log to SS_LoggerService.
+ /// \~english @param [in] eCounterGroup
+ /// EStatCounterGroupID - Group ID of the statistics counter
+ /// \~english @par
+ /// EStatCounterGroupID enum value
+ /// \~english @code
+ /// typedef enum _ECounterGroupID
+ /// {
+ /// STARTUP_SHUTDOWN_COUNTER_GROUP =0x01, /* Statistics counter group for StartUp/Shutdown */
+ /// APP_USAGE_COUNTER_GROUP, /* Statistics counter group for application usage */
+ /// F_BLK_STABILITY_COUNTER_GROUP, /* Do not use : Statistics counter for flash access */
+ /// MAX_COUNTER_GROUP /* Max value of statistics counter group */
+ /// }EStatCounterGroupID ;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// Against SS_LoggerService, which is a method to reset the statistics counters corresponding to the statistics
+ /// counter groups in the event log. \n
+ /// To send a message in the command ID of SS_LOGGER_READ_STATL_COUNTER against SS_LoggerService. \n
+ /// SS_LoggerService sends a message in the command ID of eThrdCmdStatisticalCounter against the event log
+ /// writing thread. \n
+ /// Event log write thread reset the statistics counter corresponding to the statistics counter groups in the
+ /// event log. \n
+ /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the
+ /// command ID below.
+ /// - Success: SS_LOGGER_RESET_STATL_COUNTER_SUCCESS_RESP
+ /// - Failure: SS_LOGGER_RESET_STATL_COUNTER_ERROR_RESP
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ResetStatisticalCounter(EStatCounterGroupID eCounterGroup);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_SetDiagID
+ /// \~english @par Summary
+ /// API to send the diagnosis ID to SS_LoggerService.
+ /// \~english @param [in] f_u16DiagID
+ /// UI_16 - Diagnosis ID
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// It is a method to send the diagnosis ID to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_SET_DIAGID to SS_LoggerService. \n
+ /// SS_LoggerService sets the diagnosis ID as a part of the suffix name of the event log storage file name.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_SetDiagID(UI_16 f_u16DiagID);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_UploadEventLog
+ /// \~english @par Summary
+ /// API to request the upload of the event log to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to request the upload of the event log to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_UPLOAD_EVENTLOG to SS_LoggerService. \n
+ /// SS_LoggerService sends a message in the command ID of eThrdCmdUploadEventLog against the event log writing
+ /// thread. \n
+ /// Event log write thread upload the event log in the interior of the buffer. \n
+ /// Upload a result, the message is notified in the command ID of SS_LOGGER_UPLOAD_EVENTLOG_RES to the caller of
+ /// the API.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_UploadEventLog();
+
+ private:
+ HANDLE OpenService();
+ EFrameworkunifiedStatus SendMessage(UI_32 f_cmdID, UI_32 f_size, void* f_pData);
+
+ HANDLE m_hApp;
+ HANDLE m_hService;
+ HANDLE m_hSession;
+};
+
+#endif /* SS_LOGGER_SERVICE_IFC_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of logger_service
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_logger_service_local.h b/systemservice/interface_unified/library/include/system_service/ss_logger_service_local.h
new file mode 100755
index 0000000..0261f2e
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_logger_service_local.h
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_service_local.h
+ * @brief \~english This file supports the the Logger Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup logger_service
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_LOGGER_SERVICE_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_LOGGER_SERVICE_LOCAL_H_
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Screen Capture Event data
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _TInterfaceunifiedSetLoggerParams {
+ ELOGGER_STAT Logger_State;
+ EDEV_TYPE Device_Type;
+}STLoggerSetParams;
+
+typedef struct _TInterfaceunifiedSetLoggerAllParams {
+ ELOGGER_STAT Logger_State;
+ EDEV_TYPE Device_Type;
+ ELOGGER_STAT Logger_UDPState;
+ UI_32 Log_FolderCnt;
+}STLoggerSetAllParams;
+
+typedef struct _TErrorLogger_FolderInfo {
+ static const UI_16 STR_BUFF_LEN = 64;
+ CHAR FoldernameAndLogname[STR_BUFF_LEN];
+ CHAR StorageTarget[STR_BUFF_LEN];
+}STLoggerFolderInfo;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event logger resets counter information
+///////////////////////////////////////////////////////////////////////////////
+typedef union _uEvtLoggerCommonInfo {
+ STEventLoggerCommonInfo u_stEvtLoggerCommonInfo;
+ UI_8 CommonData[4];
+}UEvtLoggerCommonInfo;
+
+#pragma pack(1)
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger Event information
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _stLogEventss_ {
+ UI_32 ts;
+ UI_8 grp_ID;
+ UI_8 event_id;
+ UI_8 data[4];
+}st_LogEvent_ss;
+#pragma pack(0)
+
+/// Macros definition for the Event Logs
+#define MAX_EVT_RECORDS 20000
+#define MAX_EVENTLOG_SIZE 10*MAX_EVT_RECORDS ///< Max size for event logging
+
+typedef struct _TInterfaceunifiedEventLogPersistBuffer {
+ static const UI_16 EVT_BUFMAXSIZE = MAX_EVT_RECORDS;
+ st_LogEvent_ss EvtLog_Buffer[EVT_BUFMAXSIZE];
+ UI_16 Current_Log_Size;
+}STEventLogPersistBuffer;
+
+#endif /* SS_LOGGER_SERVICE_LOCAL_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+
+
diff --git a/systemservice/interface_unified/library/include/system_service/ss_logger_service_notifications.h b/systemservice/interface_unified/library/include/system_service/ss_logger_service_notifications.h
new file mode 100755
index 0000000..7a5fc3d
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_logger_service_notifications.h
@@ -0,0 +1,47 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_service_notifications.h
+ * @brief \~english This file supports the the Logger Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup logger_service
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_LOGGER_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define SS_LOGGER_SERVICE_NOTIFICATIONS_H_
+
+#include "system_service/ss_services.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger Service Availability Notification
+///////////////////////////////////////////////////////////////////////////////
+#define NTFY_SS_LoggerService_Availability SERVICE_LOGGER"/Availability"
+
+#endif /* SS_LOGGER_SERVICE_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+
diff --git a/systemservice/interface_unified/library/include/system_service/ss_logger_service_protocol.h b/systemservice/interface_unified/library/include/system_service/ss_logger_service_protocol.h
new file mode 100755
index 0000000..36c602c
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_logger_service_protocol.h
@@ -0,0 +1,146 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_service_protocol.h
+ * @brief \~english This file supports the the Logger Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef _SS_LOGGER_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard)
+#define _SS_LOGGER_SERVICE_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger service event IDs
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _LoggerServiceProtocol {
+ SS_LOGGER_MILEAGE_DATA = 0x60,
+ SS_LOGGER_SET_PARAMS,
+ SS_LOGGER_STORE_SCREENCAPTURE_AND_LOG, // CLR+1+3
+ SS_LOGGER_STORE_SCREENCAPTURE, // CLR+1+2
+ SS_LOGGER_STORE_LOG, // ONHOOK+7+9
+ SS_LOGGER_SCREENCAPTURE_EVT_ACK, // Screen shot response (filename)
+ SS_LOGGER_EVENT_COMMONINFO,
+ SS_LOGGER__CWORD56__EVENT_INFO,
+ SS_LOGGER__CWORD56__RESET_INFO,
+ SS_LOGGER_SET_DATETIME,
+ SS_LOGGER_SET_VIN,
+ SS_LOGGER_UDP_LOGGING,
+ SS_LOGGER_ERROR_EVENT_ARTIFACT_REQ,
+ SS_LOGGER_ERROR_EVENT_ARTIFACT_RESP,
+ SS_LOGGER_SHUTDOWN_COMPLETE,
+ SS_LOGGER_DIAGDTC_ACTIVE,
+ SS_LOGGER_SET_DIAGID,
+ // Timer protocol IDs
+ SS_LOGGER_ERROR_EVENT_TIMER_ID_LOGGING_START_RSPN,
+ SS_LOGGER_ERROR_EVENT_TIMER_ID_ARTIFACT_RESPONSE,
+ SS_LOGGER_ERROR_EVENT_TIMER_ID_SCREEN_CAPTURE_RSPN,
+}SS_LoggerServiceProtocol;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger service event IDs
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _SS_LOGGERSERVICEPROTOCOL {
+ SS_LOGGERCOPYEVENTUSB = 0x80, // HMI to Dispatcher
+ SS_LOGGERCOPYEVENTUSB_SUCCESS_RESP,
+ SS_LOGGERCOPYEVENTUSB_ERROR_RESP,
+ SS_LOGGERCOPYEMERGENCYLOGS,
+ SS_LOGGERCOPYEMERGENCYLOGS_SUCCESS_RESP,
+ SS_LOGGERCOPYEMERGENCYLOGS_ERROR_RESP,
+ SS_LOGGERCLEAREVENT, // HMI to Dispatcher
+ SS_LOGGERCLEAREVENT_SUCCESS_RESP,
+ SS_LOGGERCLEAREVENT_ERROR_RESP,
+ SS_LOGGER_READ_STATL_COUNTER,
+ SS_LOGGER_READ_STATL_COUNTER_SUCCESS_RESP,
+ SS_LOGGER_READ_STATL_COUNTER_ERROR_RESP,
+ SS_LOGGER_RESET_STATL_COUNTER,
+ SS_LOGGER_RESET_STATL_COUNTER_SUCCESS_RESP,
+ SS_LOGGER_RESET_STATL_COUNTER_ERROR_RESP,
+ SS_LOGGER_ENG_READ_NUMOFEVENTS,
+ SS_LOGGER_ENG_READ_NUMOFEVENTS_RESP,
+ SS_LOGGER_ENG_READ_STATISTICAL_COUNTERS,
+ SS_LOGGER_ENG_READ_STATISTICAL_COUNTERS_RESP,
+ SS_LOGGER_UPLOAD_EVENTLOG,
+ SS_LOGGER_UPLOAD_EVENTLOG_RESP
+}SS_loggerserviceprotocol;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Private events for the following categories of devices
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _LoggerServerEvents {
+ SS_LOGGER_SCREENCAPTURE_EVT = 0xA0, // Screen shot request from PLM.
+ SS_LOGGER_ERRORINFO_EVT,
+ SS_LOGGER_LOGINFO_EVT,
+ SS_LOGGER_LOGSTARTED_EVT
+}SS_LoggerServerEvents;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \brief eSSLoggerCANProtocolID
+///
+/// \note These IDs depict the possible events coming from CAN to logger_service
+///
+/////////////////////////////////////////////////////////////////////////////////////
+enum eSSLoggerCANProtocolID {
+ eSSLoggerCANProtocolIDCANTrigger = 0x10000000, /// Start logging to USB
+ eSSLoggerCANProtocolIDDTCTrigger /// Start logging of DTC to emmc
+};
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \brief eSSLoggerCANEvent
+///
+/// \note Events that are published to CAN for HK and CAN logging. Data structures
+/// attached to the single events can be found in below table
+/// | EventId | Return type |
+/// | :------------------------ | :------------------------ |
+/// | eSSLoggerCANEventStart | None |
+/// | eSSLoggerCANEventError | STEventCANLoggerEventInfo |
+/// | eSSLoggerCANEventFinished | STEventCANLoggerEventInfo |
+///
+/////////////////////////////////////////////////////////////////////////////////////
+enum eSSLoggerCANEvent {
+ eSSLoggerCANEventStart = 0x10001000, /// Logging has started for HK and CAN events
+ eSSLoggerCANEventError, /// Logging has aborted with an error
+ eSSLoggerCANEventFinished /// Logging has finished succesfully
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_logger_store_logs.h b/systemservice/interface_unified/library/include/system_service/ss_logger_store_logs.h
new file mode 100755
index 0000000..7c68fd9
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_logger_store_logs.h
@@ -0,0 +1,81 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_store_logs.h
+ * @brief This file supports the logger service interface for SystemManager.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_LOGGER_STORE_LOGS_H_ // NOLINT (build/header_guard)
+#define SS_LOGGER_STORE_LOGS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include "system_service/interfaceunified_system_types.h"
+
+#include <string>
+#include <vector>
+
+
+#ifdef _cplusplus
+extern "C" {
+#endif
+#define SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG"
+
+typedef enum {
+ SS_STORELOGS_INTERFACEUNIFIEDLOG = 0,
+ SS_STORELOGS_ILLEGAL,
+ SS_STORELOGS_ACCOFFON,
+
+ SS_STORELOGS_SYS_ILLEGAL,
+ SS_STORELOGS_ACCOFFON_PRESS,
+
+ SS_STORELOGS_MAX
+} SS_STORELOGS_OPE_TYPE;
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+///
+/// \brief SSLoggerSrvIfWriteDebugLogs
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SS_LoggerStoreLogs(SS_STORELOGS_OPE_TYPE type);
+
+EFrameworkunifiedStatus SS_LoggerStoreLogs_deleteOldLogAbnrm(const std::string& log_path, std::vector<std::string>& l_vector,
+ const std::string& f_archive_destination, SI_32 max_num,
+ UI_32 abnrm_total);
+
+EFrameworkunifiedStatus StartRtUsbLogThread(HANDLE hApp);
+EFrameworkunifiedStatus StopRtUsbLogThread(HANDLE hApp);
+
+#ifdef _cplusplus
+}
+#endif
+
+#endif /* SS_LOGGER_STORE_LOGS_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_power_service.h b/systemservice/interface_unified/library/include/system_service/ss_power_service.h
new file mode 100755
index 0000000..15ba033
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_power_service.h
@@ -0,0 +1,535 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service.h
+ * @brief \~english This file supports the Power Service interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup power_service
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_POWER_SERVICE_H_ // NOLINT (build/header_guard)
+#define SS_POWER_SERVICE_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include "system_service/ss_system_types.h"
+
+
+
+typedef enum _PwLevelTypes {
+ epspltUNKNOWN,
+ epspltWAKEUP = 0x99,
+ epspltNORMAL,
+ epspltSHUTDOWN,
+ epspltEMERGENCY,
+} PowerSrvLevelType, EPWR_LEVEL_TYPE;
+
+
+typedef enum {
+ epsstUNKNOWN,
+ epsstBASIC,
+ epsstSUPERVISOR,
+ epsstSYSTEM,
+} PowerSrvSessionType, EPWR_SESSION_TYPE;
+
+
+typedef enum {
+ epscnINVALID = 0xFF,
+ epscnCANWAKEUP = 0x07, //< All modules up with Display Off and Audio Muted
+ epscnCANSLEEP = 0x08, //< Communication and all modules shut down
+} ePowerSrvCANStates, EPWR_CAN_STATE_TYPE;
+
+
+
+// Not in use for PastModel003*1. Can be used for Platform
+typedef enum {
+ epswlINVALID = 0xFF,
+ epswlFULLRUN = 0x0A, //< Normal ignition on and full wakeup
+ epswlLOCALWAKEUP = 0x0B, //< Only certain modules are up.
+} ePowerSrvWakeupLevels, EPWR_WAKEUP_LEVEL_TYPE;
+
+typedef EPWR_WAKEUP_LEVEL_TYPE * PEPWR_WAKEUP_LEVEL_TYPE;
+
+typedef enum {
+ epswsINVALID = 0xFF,
+ epswsPWRON = 0x00, //< Enable Display and Audio
+ epswsPWROFF = 0x01, //< Disable Audio and HMI
+} ePowerSrvPowerStates, EPWR_POWER_STATE_TYPE;
+
+
+typedef enum {
+ epsvsINVALID = 0xFF,
+ epsvsNORMAL = 0x20,
+ epsvsLVI1 = 0x22,
+ epsvsLVI2 = 0x24,
+} ePowerSrvVoltageStates, EPWR_VOLTAGE_STATE_TYPE;
+
+typedef EPWR_VOLTAGE_STATE_TYPE * PEPWR_VOLTAGE_STATE_TYPE;
+
+typedef enum {
+ epscsINVALID = 0xFF,
+ epscsENTRY = 0xA0,
+ epscsEXIT = 0xA2,
+} ePowerSrvCrankStates, EPWR_CRANK_STATE_TYPE;
+
+
+//******************************************************************************
+// Startup Reason / EPWR_WAKEUP_FACTOR_TYPE typedefs *
+// *
+/**
+ * \~english
+ */
+typedef enum {
+ epswfINVALID = 0xFF, //!< \~english
+ epswfTESTACC = 0x00, //!< \~english
+ epswfON_KEY = 0x01, //!< \~english
+ epswfIGN_ACC = 0x02, //!< \~english
+ epswfDR_OPEN_CLOSE = 0x03, //!< \~english
+ epswfDX_ACTIVATION = 0x04, //!< \~english
+ epswfPASS_ACTIVATION = 0x05, //!< \~english
+ epswfSPVACTIVATION = 0x06, //!< \~english
+ epswfUSER_DATA_RESET = 0x07 //!< \~english
+//
+// Carry-over enums from CCR
+//
+// epswfPWRBUTTONON = 0x0C,
+// epswfIGNON = 0x0D,
+// epswfDISCEJECT = 0x0F,
+// epswfSHOWTIME = 0x11,
+// epswfPHONECALL = 0x12,
+//
+// End of Carry-over enums from CCR
+//
+} ePowerSrvWakeupFactors, EPWR_WAKEUP_FACTOR_TYPE;
+typedef EPWR_WAKEUP_FACTOR_TYPE * PEPWR_WAKEUP_FACTOR_TYPE;
+// *
+// End of Startup Reason / EPWR_WAKEUP_FACTOR_TYPE *
+//******************************************************************************
+
+//****************************************************************************
+// Shutdown Popup Protocol enums & typedefs *
+// *
+typedef enum { // *
+ epsspPowerSave1 = 0x00, // *
+ epsspPowerSave2 = 0x01, // *
+ epsspPowerSave3 = 0x02, // *
+ epsspPowerSaveClr = 0x03, // *
+ epsspLowVoltage1 = 0x04, // *
+ epsspLowVoltage2 = 0x05, // *
+ epsspLowVoltage3 = 0x06, // *
+ epsspLowVoltageClr = 0x07, // *
+ epsspBattCouplingSW1 = 0x08, // *
+ epsspBattCouplingSW2 = 0x09, // *
+ epsspBattCouplingSW3 = 0x0A, // *
+ epsspBattCouplingSWClr = 0x0B, // *
+ epsspAbnormalTemp_1st = 0x0C, // *
+ epsspAbnormalTemp_Clr = 0x0D, // *
+ epsspLimpHome_1st = 0x0E, // *
+ epsspLimpHome_2nd = 0x0F, // *
+ epsspLimpHome_3rd = 0x10, // *
+ epsspLimpHome_Clr = 0x11, // *
+ epsspProdMd_1st = 0x12, // *
+ epsspProdMd_Clr = 0x13, // *
+ epsspTransMd_1st = 0x14, // *
+ epsspTransMd_Clr = 0x15, // *
+ epsspAllClr = 0xFF // *
+} ePwrServiceShutdownPopupType, EPWR_SHUTDOWN_POPUP_TYPE; // *
+ // *
+// *
+// End of Shutdown Condition Protocol enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// CPMShowPowerPopup Protocol enums & typedefs *
+// *
+typedef enum { // *
+ epssppNormal = 0x00, // *
+ epssppCritical = 0x01, // *
+ epssppAppCritical = 0x02, // *
+ epssppAllClr = 0xFF // *
+} ePwrServicePowerPopupType, EPWR_POWER_POPUP_TYPE; // *
+ // *
+// *
+// End of CPMShowPowerPopup Protocol enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Limp Home Cutoff Protocol enums & typedefs *
+// *
+typedef enum { // *
+ epslhcINVALID = 0xFF, // *
+ epslhcDISABLED = 0x00, // *
+ epslhcENABLED = 0x01 // *
+} ePwrServiceLHCType, EPWR_LHC_TYPE; // *
+ // *
+// *
+// End of Limp Home Cutoff Protocol enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Production Mode Protocol enums & typedefs *
+// *
+typedef enum { // *
+ epspmINVALID = 0xFF, // *
+ epspmDISABLED = 0x00, // *
+ epspmENABLED = 0x01 // *
+} ePwrServiceProdModeType, EPWR_PROD_MODE_TYPE; // *
+ // *
+// *
+// End of Production Mode Protocol enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Transport Mode Protocol enums & typedefs *
+// *
+typedef enum { // *
+ epstmINVALID = 0xFF, // *
+ epstmDISABLED = 0x00, // *
+ epstmENABLED = 0x01 // *
+} ePwrServiceTransportModeType, EPWR_TRANSPORT_MODE_TYPE; // *
+ // *
+// *
+// End of Transport Mode Protocol enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Last User Mode, User Mode , User Mode Change Reason Protocol enums & *
+// typedefs *
+// *
+/**
+ * \~english
+ */
+typedef enum {
+ epsumINVALID = 0xFF, //!< \~english
+ epsumOFF = 0x00, //!< \~english
+ epsumON = 0x01 //!< \~english
+} ePwrServiceUserModeType, EPWR_USER_MODE_TYPE;
+
+/**
+ * \~english State transition reason.
+ */
+typedef enum {
+ epsumcrNOT_AVAILABLE = 0x00, //!< \~english Not available.
+ epsumcrON_KEY = 0x01, //!< \~english
+ epsumcrPARKING_B, //!< \~english Parking(+B) Power state transition.
+ epsumcrPRE_BA, //!< \~english Pre-boot(+BA) Power state transition.
+ epsumcrNORMAL, //!< \~english Normal-boot Power state transition.
+ epsumcrBACKGROUND_BA, //!< \~english Background-boot(+BA) Power state transition.
+} ePwrServiceUserModeChangeReasonType, EPWR_USER_MODE_CHANGE_REASON_TYPE;
+ // *
+// *
+// End of Last User Mode, User Mode Protocol enums & typedefs *
+//****************************************************************************
+
+/**
+ * \~english
+ */
+typedef struct _upinfo {
+ EPWR_WAKEUP_LEVEL_TYPE level; //!< \~english
+ EPWR_WAKEUP_FACTOR_TYPE factor; //!< \~english
+ EPWR_USER_MODE_CHANGE_REASON_TYPE userModeChangeReason; //!< \~english State transition reason.
+} upInfo;
+
+/**
+ * \~english
+ */
+typedef struct _wakeinfo {
+ EPWR_POWER_STATE_TYPE powerupType; //!< \~english
+ upInfo up; //!< \~english
+} wakeInfo;
+
+//****************************************************************************
+// System Mode Info enums & typedefs *
+// *
+typedef enum { // *
+ epssinfINVALID = 0xFF, // *
+ epssinfNORMAL = 0x00, // *
+ epssinfPROGRAMMING = 0x08, // *
+}ePowerSrvSystemModeInfo, EPWR_SYSTEM_MODE_INFO; // *
+ // *
+typedef enum { // *
+ epssusfINVALID = 0xFF, // *
+ epssusSYSTEM_SERVICES_STARTED = 0x00, // *
+ epssusALL_SERVICES_LAUNCHED = 0x01 // *
+}ePowerSrvStartupStageType, EPWR_STARTUP_STAGE_TYPE; // *
+ // *
+typedef struct _SystemModeInfo { // *
+ EPWR_USER_MODE_TYPE lastUserMode; // NOTE: Don't use this. just only remained for backward compatibility.
+ EPWR_LHC_TYPE limpHomeCutoff; // *
+ EPWR_PROD_MODE_TYPE productionMode; // *
+ EPWR_TRANSPORT_MODE_TYPE transportMode; // *
+ EPWR_SYSTEM_MODE_INFO systemMode; // *
+ EPWR_STARTUP_STAGE_TYPE startupStage; // *
+} SystemModeInfo; // *
+// *
+// End of System Mode Info enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Startup Confirmation enums & typedefs *
+// *
+typedef enum { // *
+ eps_CWORD56_bmINVALID = 0xFF, // *
+ eps_CWORD56_bmAPPLICATION_MODE = 0x00, // *
+ eps_CWORD56_bmPROGRAMMING_MODE = 0x08 // *
+} EPWR_SC__CWORD56__BOOT_MODE_TYPE; // *
+ // *
+typedef enum { // *
+ epsstINVALID = 0xFF, // *
+ epsstWARMSTART = 0x00, // *
+ epsstCOLDSTART = 0x01 // *
+} EPWR_SC_WAKEUP_TYPE; // *
+ // *
+typedef enum { // *
+ epsscrtINVALID = 0xFF, // *
+ epsscrtNOT_REQUIRED = 0x00, // *
+ epsscrtREQUIRED = 0x01 // *
+} EPWR_SC_COLD_START_REQ_TYPE; // *
+ // *
+typedef enum { // *
+ epsssINVALID = 0xFF, // *
+ epsssUNLOCK = 0x00, // *
+ epsssLOCK = 0x01 // *
+} EPWR_SC_SECURITY_STATUS; // *
+ // *
+typedef struct { // *
+ EPWR_SC__CWORD56__BOOT_MODE_TYPE _CWORD56_BootMode; // *
+ EPWR_SC_WAKEUP_TYPE wakeupType; // *
+ EPWR_SC_COLD_START_REQ_TYPE coldStartRequest; // *
+ EPWR_SC_SECURITY_STATUS securityStatus; // *
+ UI_32 HWVersion; // *
+ UI_32 matchedHardwareType; // *
+ UI_32 softwareType; // *
+ UI_32 imageType; // *
+ UI_32 majorVersion; // *
+ UI_32 minorVersion; // *
+ UI_32 SWVersionYear; // *
+ UI_32 SWVersionWeek; // *
+ UI_32 SWVersionPatchLevel; // *
+} StartupConfirmationMsgStrut, EPWR_SC_MSG_STRUCT; // *
+// *
+// End of Startup Confirmation enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Power Request Message enums & typedefs *
+// *
+/**
+ * _CWORD102_ Startup Information
+ */
+typedef enum {
+ epsprm_CWORD102_siINVALID = 0xFF, //!< \~english
+ epsprm_CWORD102_si_CWORD102__STARTUP_NORMAL = 0x00, //!< Normal Startup
+ epsprm_CWORD102_si_CWORD102__STARTUP_AFTER_RESET = 0x01 //!< Startup after Irregular Reset
+}ePowerSrv_CWORD102_StartupInfoType, EPWR__CWORD102__STARTUP_INFO_TYPE;
+/**
+ * Opening Type
+ */
+typedef enum {
+ epsprmotINVALID = 0xFF, //!< \~english
+ epsprmotTIMING_TYPE_1 = 0x00, //!< CI/DI Show timing type1
+ epsprmotTIMING_TYPE_2 = 0x01 //!< CI/DI Show timing type2
+} ePowerSrvPwrReqMsgCIDIOpeningType, EPWR_OPENING_TYPE;
+/**
+ * Manual Reset Information
+ */
+typedef enum {
+ epsprmriINVALID = 0xFF, //!< \~english
+ epsprmriNORMAL = 0x00, //!< \~english
+ epsprmriWAKEUP_AFTER_RESET = 0x01 //!< \~english
+} ePowerSrvPwrManResetInfoType, EPWR_MAN_RESET_INFO_TYPE;
+/**
+ * Last System Retention Request
+ */
+typedef enum {
+ epsprlsrrINVALID = 0xFF, //!< \~english
+ epsprlsrrLAST_SYSTEM_OFF = 0x00, //!< \~english
+ epsprlsrrLAST_SYSTEM_ON = 0x01 //!< \~english
+} ePowerSrvTypeLastSysRetReq, EPWR_LAST_SYS_RET_REQ_TYPE;
+
+// *
+typedef struct { // *
+ EPWR__CWORD102__STARTUP_INFO_TYPE startupType; // *
+ EPWR_OPENING_TYPE openingType; // *
+ EPWR_WAKEUP_FACTOR_TYPE startupReason; // *
+ EPWR_USER_MODE_TYPE lastUserMode; // *
+ EPWR_MAN_RESET_INFO_TYPE manResetInfo; // *
+ EPWR_LAST_SYS_RET_REQ_TYPE lastSystemRetentionReq; // *
+ EPWR_USER_MODE_TYPE userMode; // *
+} PowerRequestMsgStrut, EPWR_POWER_REQUEST_MSG_STRUCT; // *
+
+/**
+ * \~english structure for power request message
+ */
+typedef struct {
+ EPWR__CWORD102__STARTUP_INFO_TYPE startupType; //!< \~english
+ EPWR_OPENING_TYPE openingType; //!< \~english
+ EPWR_WAKEUP_FACTOR_TYPE startupReason; //!< \~english
+ EPWR_USER_MODE_TYPE lastUserMode; //!< \~english
+ EPWR_MAN_RESET_INFO_TYPE manResetInfo; //!< \~english
+ EPWR_LAST_SYS_RET_REQ_TYPE lastSystemRetentionReq; //!< \~english
+ EPWR_USER_MODE_TYPE userMode; //!< \~english
+ EPWR_USER_MODE_CHANGE_REASON_TYPE userModeChangeReason; //!< \~english State transition reason.
+} PowerRequestMsgStrutWithUMCR, EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR;
+// *
+// End of Power Request Message enums & typedefs *
+//****************************************************************************
+
+
+
+//****************************************************************************
+// Shutdown Request Message enums & typedefs *
+// *
+// ONS *
+// *
+typedef enum { // *
+ epssdmonsINVALID = 0xFF, // *
+ epssdmonsNO_ONS = 0x00, // *
+ epssdmonsONS = 0x01 // *
+} ePowerSrvONSType, EPWR_ONS_TYPE; // *
+// *
+// Shutdown Trigger *
+// *
+typedef enum { // *
+ epssdmsdtINVALID = 0xFF, // *
+ epssdmsdtTESTACC_OFF = 0x00, // *
+ epssdmsdtON_KEY = 0x01, // *
+ epssdmsdtIGN_LOCK = 0x02, // *
+ epssdmsdtPWR_SAVE = 0x03, // *
+ epssdmsdtTMP_STARTUP = 0x04, // *
+ epssdmsdtDIAG_DEACTIVATION = 0x05, // *
+ epssdmsdtABNORMAL_VOLTAGE = 0x06, // *
+ epssdmsdtABNORMAL_TEMP = 0x07, // *
+ epssdmsdtBATTERYCUTOFF = 0x08, // *
+ epssdmsdtLIMPHOME = 0x09, // *
+ epssdmsdtHU_CAN_ERROR = 0x0A, // *
+ epssdmsdtBODY_CAN_ERROR = 0x0B, // *
+ epssdmsdtTRANSPORT_MODE = 0x0C, // *
+ epssdmsdtPRODUCTION_MODE = 0x0D, // *
+ epssdmsdtIGN_OFF = 0x0E, // *
+ epssdmsdtGENERIC_ERROR_RESET = 0x0F, // *
+ epssdmsdtFATAL_ERROR_RESET = 0x10, // *
+ epssdmsdtUSER_DATA_RESET = 0x11, // *
+ epssdmsdtFACTORY_DATA_RESET = 0x12, // *
+ epssdmsdtFAST_SLEEP_MODE = 0x13, // *
+ epssdmsdtNORMAL_RESET = 0x14, // *
+ epssdmsdtPROGUPDATE_RESET = 0x15, // cannot use this
+ // *
+ // Note to self: Make sure to update all enum-to-enum and *
+ // enum-to-string maps when changing these enums ! *
+} ePowerSrvPwrShutdownTriggerType, EPWR_SHUTDOWN_TRIGGER_TYPE; // *
+// *
+typedef struct { // *
+ EPWR_ONS_TYPE ONS_Type; // *
+ EPWR_SHUTDOWN_TRIGGER_TYPE shutdownTrigger; // *
+ EPWR_USER_MODE_TYPE lastUserMode; // *
+ EPWR_TRANSPORT_MODE_TYPE transportMode; // *
+ EPWR_PROD_MODE_TYPE productionMode; // *
+ EPWR_LHC_TYPE limpHomeCutoffRequest; // *
+} ShutdownRequestMsgStrut, EPWR_SHUTDOWN_REQUEST_MSG_STRUCT; // *
+// *
+// End of Shutdown Request Message enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// HeartBeat enums & typedefs *
+// *
+// HeartBeat Request Message *
+typedef struct { // *
+ UI_8 IntervalSec; // *
+} EPWR_HB_REQ_MSG_STRUCT; // *
+// *
+// HeartBeat Response Message *
+// Zero byte data message returned. *
+// End of HeartBeat enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// CPU Reset Reason enums & typedefs *
+typedef enum { // *
+ epsCpuResetReasonGeneric = 0 // *
+ , epsCpuResetReasonFatalError // *
+ , epsCpuResetReasonUserDataReset // *
+ , epsCpuResetReasonFactoryDataReset // *
+ , epsCpuResetReasonUserForceReset // *
+ , epsCpuResetReasonShipmentModeReset // *
+ , epsCpuResetReasonHeadUnitReset // *
+ , epsCpuResetReasonNormalReset // *
+ , epsCpuResetReasonProgupdateReset // cannot use this
+} epsCpuResetReason; // *
+//
+typedef struct {
+#define PWR_RESET_MSG_STR_SIZE 32
+ epsCpuResetReason resetReason; // *
+ CHAR messageStr[PWR_RESET_MSG_STR_SIZE]; // *
+} SS_Pwr_CpuResetMsgStruct;
+// *
+// End of CPU Reset Reason enums & typedefs *
+//****************************************************************************
+
+typedef struct {
+ union _data {
+ wakeInfo wake;
+
+ struct _crank {
+ EPWR_CRANK_STATE_TYPE state;
+ }crank;
+
+ struct _voltage {
+ EPWR_VOLTAGE_STATE_TYPE state;
+ }voltage;
+
+ struct _ws_complete {
+ EPWR_WAKEUP_LEVEL_TYPE level;
+ EPWR_WAKEUP_FACTOR_TYPE factor;
+ }wk_shdwn_complete;
+
+ struct _commwake {
+ EPWR_CAN_STATE_TYPE state;
+ }commwake;
+
+ struct _UserMode {
+ EPWR_USER_MODE_TYPE mode;
+ } user_mode;
+
+ struct _ShutdownPopup {
+ EPWR_SHUTDOWN_POPUP_TYPE shutdownPopupEvent;
+ } shutdownPopup;
+
+ struct _PowerPopup {
+ EPWR_POWER_POPUP_TYPE powerPopupEvent;
+ } powerPopup;
+
+ StartupConfirmationMsgStrut startupConfirmationMsg;
+ PowerRequestMsgStrutWithUMCR powerRequestMsg;
+ ShutdownRequestMsgStrut shutdownRequestMsg;
+ }data;
+} Pwr_ServiceSetInterface;
+
+#endif /* SS_POWER_SERVICE_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of power_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_power_service_if.h b/systemservice/interface_unified/library/include/system_service/ss_power_service_if.h
new file mode 100755
index 0000000..d0ace60
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_power_service_if.h
@@ -0,0 +1,606 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service_if.h
+ * @brief \~english This file supports the Power Service client interface.
+ */
+/**
+ * @file
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup power_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_IF_H_ // NOLINT (build/header_guard)
+#define POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_IF_H_
+
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_power_service_protocol.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup OpenPowerService
+/// \~english @par Summary
+/// Obtain a handle for using the PowerService.
+/// \~english @param [in] f_hApp
+/// HANDLE - Application handle
+/// \~english @retval Handle Success
+/// \~english @retval NULL Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// - The API creates a communication resource between
+/// the user service and the PowerService
+/// and returns a handle for using the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE OpenPowerService(HANDLE f_hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ClosePowerService
+/// \~english @par Summary
+/// Free a handle for using PowerService.
+/// \~english @param [in] f_hApp
+/// HANDLE - Application handle
+/// \~english @param [in] f_hService
+/// HANDLE - PowerService handle
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail
+/// - The API terminates the communication resource between
+/// the user service and the PowerServiceand frees the given handle. \n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus ClosePowerService(HANDLE f_hApp, HANDLE f_hService);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceOpenSessionRequest
+/// \~english @par Summary
+/// Make the PowerService available.
+/// \~english @param [in] f_hService
+/// HANDLE - PowerService handle
+/// \~english @param [in] f_eSessionType
+/// EPWR_SESSION_TYPE - Session type
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget x Method
+/// \~english @par Detail
+/// - The API opens a session between the user service
+/// and the PowerService and makes the PowerService available. \n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceOpenSessionRequest(HANDLE f_hService,
+ EPWR_SESSION_TYPE f_eSessionType);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceCloseSessionRequest
+/// \~english @par Summary
+/// End using the PowerService.
+/// \~english @param [in] f_hService
+/// HANDLE - PowerService handle
+/// \~english @param [in] f_hSession
+/// HANDLE - Session type
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget x Method
+/// \~english @par Detail
+/// - The API closes the session between the user service
+/// and the PowerService and terminatesthe PowerSerivce use. \n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceCloseSessionRequest(HANDLE f_hService, HANDLE f_hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceDecodeOpenSessionResponse
+/// \~english @par Summary
+/// Obtain a handle for OpenSessionRequest response message.
+/// \~english @param [in] f_hApp
+/// HANDLE - Application handle
+/// \~english @param [in] f_hSession
+/// HANDLE& - Address of storing session handle
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// - The API obtains a handle for OpenSessionRequest
+/// response message using the given application handle.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceDecodeOpenSessionResponse(HANDLE f_hApp,
+ HANDLE& f_hSession); // NOLINT (runtime/references)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSetVoltageState
+/// \~english @par Summary
+/// Set power supply state.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eVoltage_state
+/// EPWR_VOLTAGE_STATE_TYPE - Power supply status value
+/// \~english @par
+/// - Power supply status value
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epsvsINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epsvsNORMAL</td><td>0x20</td></tr>
+/// <tr><td>epsvsLVI1</td><td>0x22</td></tr>
+/// <tr><td>epsvsLVI2</td><td>0x24</td></tr>
+/// </table>
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail
+/// - The API sets power supply state to the PowerService. \n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSetVoltageState(HANDLE f_hSession,
+ EPWR_VOLTAGE_STATE_TYPE f_eVoltage_state);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSetCrankState
+/// \~english @par Summary
+/// Set crank state.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eCrank_state
+/// EPWR_CRANK_STATE_TYPE - Crank state value
+/// \~english @par
+/// - Crank state value
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epscsINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epscsENTRY</td><td>0xA0</td></tr>
+/// <tr><td>epscsEXIT</td><td>0xA2</td></tr>
+/// </table>
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// - The API sets crank state to the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSetCrankState(HANDLE f_hSession,
+ EPWR_CRANK_STATE_TYPE f_eCrank_state);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSystemModeInfoRequest
+/// \~english @par Summary
+/// Request to obtain the system mode information.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method x Method
+/// \~english @par Detail
+/// - The API requests the PowerService to obtain
+/// the system mode information.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSystemModeInfoRequest(HANDLE f_hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendInitCompReport
+/// \~english @par Summary
+/// Send an initialize complete response.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forgeat x Fire and Forget
+/// \~english @par Detail
+/// - The API sends an initialize complete response to the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendInitCompReport(HANDLE f_hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendSetShutdownPopupRequest
+/// \~english @par Summary
+/// Obtain shutdown state.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eShutdownPopup
+/// EPWR_SHUTDOWN_POPUP_TYPE - Shutdown state
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail
+/// - The API obtains the shutdown state from the PowerService. \n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendSetShutdownPopupRequest(HANDLE f_hSession,
+ EPWR_SHUTDOWN_POPUP_TYPE f_eShutdownPopup);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendStartupConfirmationMsgRequest
+/// \~english @par Summary
+/// Send startup confirmation request.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eState
+/// EPWR_SC_MSG_STRUCT
+/// - Address of the structure for startup confirmation request message
+/// \~english @par
+/// - Structure for startup confirmation request message
+/// \~english @code
+/// typedef struct {
+/// EPWR_SC__CWORD56__BOOT_MODE_TYPE _CWORD56_BootMode;
+/// EPWR_SC_WAKEUP_TYPE wakeupType;
+/// EPWR_SC_COLD_START_REQ_TYPE coldStartRequest;
+/// EPWR_SC_SECURITY_STATUS securityStatus;
+/// UI_32 HWVersion;
+/// UI_32 matchedHardwareType;
+/// UI_32 softwareType;
+/// UI_32 imageType;
+/// UI_32 majorVersion;
+/// UI_32 minorVersion;
+/// UI_32 SWVersionYear;
+/// UI_32 SWVersionWeek;
+/// UI_32 SWVersionPatchLevel;
+/// } StartupConfirmationMsgStrut, EPWR_SC_MSG_STRUCT;
+/// @endcode\n
+/// \n
+/// - EPWR_SC__CWORD56__BOOT_MODE_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>eps_CWORD56_bmINVALID</td><td>0xFF</td></tr>
+/// <tr><td>eps_CWORD56_bmAPPLICATION_MODE</td><td>0x00</td></tr>
+/// <tr><td>eps_CWORD56_bmPROGRAMMING_MODE</td><td>0x08</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_SC_WAKEUP_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epsstINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epsstWARMSTART</td><td>0x00</td></tr>
+/// <tr><td>epsstCOLDSTART</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_SC_COLD_START_REQ_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epsscrtINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epsscrtNOT_REQUIRED</td><td>0x00</td></tr>
+/// <tr><td>epsscrtREQUIRED</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_SC_SECURITY_STATUS
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epsssINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epsssUNLOCK</td><td>0x00</td></tr>
+/// <tr><td>epsssLOCK</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget x Fire and Forget
+/// \~english @par Detail
+/// - The API sends a startup confirmation request to the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendStartupConfirmationMsgRequest(HANDLE f_hSession
+ , EPWR_SC_MSG_STRUCT f_eState);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendPowerRequest
+/// \~english @par Brief
+/// Send power request.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eState
+/// \ref PowerRequestMsgStrutWithUMCR "EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR&" - Address of the structure for power request message
+/// \~english @par
+/// \n
+/// Of the eight elements of the \ref PowerRequestMsgStrutWithUMCR "EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR" structure, five elements set fixed values.\n
+/// startupType = \ref epsprm_CWORD102_si_CWORD102__STARTUP_NORMAL\n
+/// openingType = \ref epsprmotTIMING_TYPE_1\n
+/// lastUserMode = \ref epsumON\n
+/// manResetInfo = \ref epsprmriNORMAL\n
+/// lastSystemRetentionReq = \ref epsprlsrrLAST_SYSTEM_OFF\n
+/// \n
+/// For the following, set different values at system startup and shutdown.\n
+/// (Element name) = (Startup settings or Shutdown settings)\n
+/// startupReason = (\ref epswfIGN_ACC or \ref epswfINVALID)\n
+/// userMode = (\ref epsumON or \ref epsumOFF)\n
+/// \n
+/// For the following, set different values at power state transition.\n
+/// <table>
+/// <tr bgcolor="black"><th>Element name</th><th>Power state</th><th>Value</th></tr>
+/// <tr><td rowspan=7>userModeChangeReason</td><tr><td>Not Available</td><td>\ref epsumcrNOT_AVAILABLE</td></tr>
+/// <tr><td> </td><td>\ref epsumcrON_KEY</td></tr>
+/// <tr><td>Parking(+B)</td><td>\ref epsumcrPARKING_B</td></tr>
+/// <tr><td>Pre-boot(+BA)</td> <td>\ref epsumcrPRE_BA</td></tr>
+/// <tr><td>Normal-boot</td> <td>\ref epsumcrNORMAL</td></tr>
+/// <tr><td>Background-boot(+BA)</td> <td>\ref epsumcrBACKGROUND_BA</td></tr>
+/// </table>
+/// \n
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - When the session handle (f_hSession) specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - The process fails for some reason. [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail
+/// - The API send a power request to the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendPowerRequest(HANDLE f_hSession,
+ EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR& f_eState);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendShutdownRequest
+/// \~english @par Summary
+/// Send shutdown request.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eState
+/// EPWR_SHUTDOWN_REQUEST_MSG_STRUCT&
+/// - Address of the structure for shutdown request message
+/// \~english @par
+/// - Structure for shutdown request message
+/// \~english @code
+/// typedef struct {
+/// EPWR_ONS_TYPE ONS_Type;
+/// EPWR_SHUTDOWN_TRIGGER_TYPE shutdownTrigger;
+/// EPWR_USER_MODE_TYPE lastUserMode;
+/// EPWR_TRANSPORT_MODE_TYPE transportMode;
+/// EPWR_PROD_MODE_TYPE productionMode;
+/// EPWR_LHC_TYPE limpHomeCutoffRequest;
+/// } ShutdownRequestMsgStrut, EPWR_SHUTDOWN_REQUEST_MSG_STRUCT
+/// @endcode\n
+/// \n
+/// - EPWR_ONS_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epssdmonsINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epssdmonsNO_ONS</td><td>0x00</td></tr>
+/// <tr><td>epssdmonsONS</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_SHUTDOWN_TRIGGER_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epssdmsdtINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epssdmsdtTESTACC_OFF</td><td>0x00</td></tr>
+/// <tr><td>epssdmsdtON_KEY</td><td>0x01</td></tr>
+/// <tr><td>epssdmsdtIGN_LOCK</td><td>0x02</td></tr>
+/// <tr><td>epssdmsdtPWR_SAVE</td><td>0x03</td></tr>
+/// <tr><td>epssdmsdtTMP_STARTUP</td><td>0x04</td></tr>
+/// <tr><td>epssdmsdtDIAG_DEACTIVATION</td><td>0x05</td></tr>
+/// <tr><td>epssdmsdtABNORMAL_VOLTAGE</td><td>0x06</td></tr>
+/// <tr><td>epssdmsdtABNORMAL_TEMP</td><td>0x07</td></tr>
+/// <tr><td>epssdmsdtBATTERYCUTOFF</td><td>0x08</td></tr>
+/// <tr><td>epssdmsdtLIMPHOME</td><td>0x09</td></tr>
+/// <tr><td>epssdmsdtHU_CAN_ERROR</td><td>0x0A</td></tr>
+/// <tr><td>epssdmsdtBODY_CAN_ERROR</td><td>0x0B</td></tr>
+/// <tr><td>epssdmsdtTRANSPORT_MODE</td><td>0x0C</td></tr>
+/// <tr><td>epssdmsdtPRODUCTION_MODE</td><td>0x0D</td></tr>
+/// <tr><td>epssdmsdtIGN_OFF</td><td>0x0E</td></tr>
+/// <tr><td>epssdmsdtGENERIC_ERROR_RESET</td><td>0x0F</td></tr>
+/// <tr><td>epssdmsdtFATAL_ERROR_RESET</td><td>0x10</td></tr>
+/// <tr><td>epssdmsdtUSER_DATA_RESET</td><td>0x11</td></tr>
+/// <tr><td>epssdmsdtFACTORY_DATA_RESET</td><td>0x12</td></tr>
+/// <tr><td>epssdmsdtFAST_SLEEP_MODE</td><td>0x13</td></tr>
+/// <tr><td>epssdmsdtNORMAL_RESET</td><td>0x14</td></tr>
+/// <tr><td>epssdmsdtPROGUPDATE_RESET</td><td>0x15</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_USER_MODE_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epsumINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epsumOFF</td><td>0x00</td></tr>
+/// <tr><td>epsumON</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_TRANSPORT_MODE_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epstmINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epstmDISABLED</td><td>0x00</td></tr>
+/// <tr><td>epstmENABLED</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_PROD_MODE_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epspmINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epspmDISABLED</td><td>0x00</td></tr>
+/// <tr><td>epspmENABLED</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_LHC_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epslhcINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epslhcDISABLED</td><td>0x00</td></tr>
+/// <tr><td>epslhcENABLED</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method x Method
+/// \~english @par Detail
+/// - The API sends shutdown request to the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendShutdownRequest(
+ HANDLE f_hSession
+ , EPWR_SHUTDOWN_REQUEST_MSG_STRUCT &f_eState); // NOLINT (runtime/references)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendHeartBeatRequest
+/// \~english @par Summary
+/// Send a request for HeartBeat monitoring start.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eHbReqMsg
+/// EPWR_HB_REQ_MSG_STRUCT*
+/// - Address of the structure for HeartBeat monitoring start request message
+/// \~english @par
+/// - Structure for HeartBeat monitoring start request message
+/// \~english @code
+/// typedef struct {
+/// UI_8 IntervalSec;
+/// } EPWR_HB_REQ_MSG_STRUCT;
+/// @endcode\n
+/// \n
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method x Method
+/// \~english @par Detail
+/// - The API sends HeartBeat monitoring start\n
+/// request to the PowerService\n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendHeartBeatRequest(
+ HANDLE f_hSession,
+ EPWR_HB_REQ_MSG_STRUCT *f_eHbReqMsg);
+
+#endif // POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_IF_H_ // NOLINT (build/header_guard)
+
+/** @}*/ // end of PowerService
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_power_service_local.h b/systemservice/interface_unified/library/include/system_service/ss_power_service_local.h
new file mode 100755
index 0000000..51a284a
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_power_service_local.h
@@ -0,0 +1,66 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service_local.h
+ * @brief \~english This file supports the Power Service interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_POWER_SERVICE_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_POWER_SERVICE_LOCAL_H_
+
+
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include "system_service/ss_system_types.h"
+
+
+
+
+
+const UI_32 MaxTestCaseName = 128;
+const UI_32 MaxRespMsg = 2048;
+
+typedef enum _PwLVIStatus {
+ ePwSrvLVI_Status_InActive,
+ ePwSrvLVI_Status_Active
+} PowerSrvLVIStatus, EPWER_LVI_STATUS;
+
+typedef struct _PwCompleteAck {
+ UI_16 unSessionId;
+ CHAR szServiceName[MAX_QUEUE_NAME_SIZE];
+} StartCompleteAck;
+
+typedef struct _SS_PSCurrentState {
+ CHAR testCaseId[MaxTestCaseName];
+ CHAR printRespmsg[MaxRespMsg];
+}SS_PSCurrentState;
+
+
+#endif /* SS_POWER_SERVICE_LOCAL_H_ */ // NOLINT (build/header_guard)
+/** @}*/ // end of power_service
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications.h b/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications.h
new file mode 100755
index 0000000..b25172d
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service_notifications.h
+ * @brief \~english This file supports the Power Service interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup power_service
+ * @ingroup system_service
+ * @{
+ */
+#ifndef POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_NOTIFICATIONS_H_
+
+#include "system_service/ss_services.h"
+
+
+
+
+/// Indicated if Power Service is available or not portion of this message is BOOL
+#define szNTFY_PowerAvailability SERVICE_POWER"/Availability"
+
+/// @}
+
+#endif // POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+/** @}*/ // end of power_service
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications_local.h b/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications_local.h
new file mode 100755
index 0000000..a06c030
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications_local.h
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service_notifications_local.h
+ * @brief \~english This file supports the Power Service interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_POWER_SERVICE_NOTIFICATIONS_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_POWER_SERVICE_NOTIFICATIONS_LOCAL_H_
+
+#include "system_service/ss_services.h"
+
+
+/// \addtogroup system_manager
+/// @{
+
+/// Depreciated !!
+#define szNTFY_PowerLVI1 SERVICE_POWER"/LVI1"
+/// Depreciated !!
+#define szNTFY_PowerLVI2 SERVICE_POWER"/LVI2"
+/// Indicates the current power level state
+#define szNTFY_PowerLevel SERVICE_POWER"/Level"
+
+/// Notification that Power Service publishes for subscribers ( ie, HMI ) to
+/// display a popup indicating the type of shutdown condition.
+/// 1. Power Save
+/// 2. BatteryCut
+/// 3. Low Voltage
+#define szNTFY_ShutdownPopup SERVICE_POWER"/ShutdownPopup"
+
+/// Notification that Power Service publishes for subscribers ( ie, HMI ) to
+/// display a popup indicating the type of CPMShowPowerPopup.
+/// 1. Normal
+/// 2. Critical
+/// 3. Application Critical
+#define szNTFY_PowerPopup SERVICE_POWER"/PowerPopup"
+
+/// @}
+
+#endif /* SS_POWER_SERVICE_NOTIFICATIONS_LOCAL_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_power_service_protocol.h b/systemservice/interface_unified/library/include/system_service/ss_power_service_protocol.h
new file mode 100755
index 0000000..92860e8
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_power_service_protocol.h
@@ -0,0 +1,201 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service_protocol.h
+ * @brief \~english This file supports the Power Service interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard)
+#define POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_PROTOCOL_H_
+
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include "system_service/ss_power_service.h"
+
+/// \ingroup PSM_Local
+/**
+ * power service protocol --> define all protocol messages in and out of power that are pertinent to the functionality offered by power.
+ */
+typedef enum _SS_PowerServiceProtocol {
+ // Diagnostic Protocol
+ SS_POWER_PRINT_CONNECTIONS = 0x32, //!< client to service
+ SS_POWER_PRINT_STACK = 0x33, //!< client to service
+
+ SS_POWER_WAKEUP_COMPLETE = 0x41, //!< service to client // used by power state machine
+ SS_POWER_SHUTDOWN_COMPLETE = 0x42, //!< service to client // used by power state machine
+ SS_POWER_VOLTAGE_STATE = 0x43, //!< client to service
+ SS_POWER_LVI2_SHUTDOWN_COMPLETE = 0x44, //!< service to client
+ SS_POWER_CRANK_STATE = 0x45, //!< client to service
+
+
+ // System Manager commands
+ SS_POWER_WAKEUP_MODULES_CMPL_RSPN = 0x51, //!< service to shadow
+ SS_POWER_SYSTEM_LAUNCH_COMPLETE = 0x56, //!< client to service
+
+
+ // SSM Service commands
+ SS_POWER_STATE_CHANGE_REQ = 0x40, //!< client to service : send wakeup to System Manager
+ SS_POWER_STATE_CHANGE_RESP = 0x46, //!< \~english Response to request of power state transition to power_supply_manager_shadow.
+
+ SS_POWER_COMM_WAKEUP = 0x58, //!< client to service : Power On expected
+
+ SS_POWER_SHUTDOWN_REQ = 0x59, //!< client to service : Comm Sleep from Shadow
+ SS_POWER_SHUTDOWN_RESP = 0x57, //!< service to shadow : Shutdown complete from System Manager
+
+ SS_POWER_CRNT_STATE_QUERY = 0x60, //!< client to service
+ SS_POWER_CRNT_STATE_QUERY_RSPN = 0x61, //!< service to client
+
+ SS_POWER_SYSTEM_MODE_INFO_REQ = 0x63, //!< Client (Shadow) to Service (Power Service)
+ SS_POWER_SYSTEM_MODE_INFO_RESP = 0x64, //!< Service to client *****
+
+ SS_POWER_INITCOMP_REP = 0x70, //!< Client (Shadow) to Service (Power Service)
+
+ //*************************************************************************
+ // CPMShowPowerPopup Notification Protocol: *
+ // *
+ // Request by the Power Shadow to the Power Service to publish a *
+ // 'Voltage State' notification. *
+ // *
+ // The Request message carries the requested notification. *
+ // The Response message carries the EFrameworkunifiedStatus of the request. *
+ SS_POWER_PUBLISH_POWER_POPUP_REQ, //!< Shadow to Pwr Svc
+ SS_POWER_PUBLISH_POWER_POPUP_RESP, //!< Pwr Svc to Shadow
+ // *
+ // End of CPMShowPowerPopup Notification Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Shutdown Condition Notification Protocol: *
+ // *
+ // Request by the Power Shadow to the Power Service to publish the *
+ // 'Shutdown Condition' notification. *
+ // *
+ // The Request message carries the requested PowerPopup. *
+ // The Response message carries the EFrameworkunifiedStatus of the request. *
+ SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ, //!< Shadow to Pwr Svc
+ SS_POWER_PUBLISH_SHUTDOWN_CONDITION_RESP, //!< Pwr Svc to Shadow
+ // *
+ // End of Shutdown Condition Notification Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Startup Confirmation Protocol: *
+ // *
+ // Request by the Power Shadow to the Power Service to forward to the *
+ // System Manager the Startup Confirmation message. *
+ // *
+ // The Request message carries the Startup Confirmation message. *
+ // The Response message carries the EFrameworkunifiedStatus of the request. *
+ SS_POWER_FWD_START_CONFIRMATION_MSG_REQ, //!< Shadow to Pwr Svc
+ SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, //!< Pwr Svc to Shadow
+ // *
+ // End of Startup Confirmation Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Power Request Protocol: *
+ // *
+ // Power Request message from the Power Shadow to the Power Service with *
+ // _CWORD56_'s "Power_Request" IPC_Command data. *
+ // *
+ // The Request message carries the _CWORD56_'s data. *
+ // The Response message will use the SS_POWER_STATE_CHANGE_RESP protocol *
+ // ID. *
+ SS_POWER_POWER_REQUEST_MSG, //!< Shadow to Pwr Svc
+ // *
+ // End of Power Request Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Shutdown Request Protocol: *
+ // *
+ // Shutdown Request message from the Power Shadow to the Power Service *
+ // with _CWORD56_'s "Shutdown_Request" IPC_Command data. *
+ // *
+ // The Request message carries the _CWORD56_'s data. *
+ // The Response message will use the SS_POWER_STATE_CHANGE_RESP protocol *
+ // ID. *
+ SS_POWER_SHUTDOWN_REQUEST_MSG, //!< Shadow to Pwr Svc
+ // *
+ // End of Shutdown Request Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // User Mode Protocol: *
+ // *
+ // Request by the Power Service to the System Manager, originally from *
+ // the Power Shadow, to turn on or off the video & audio output of HMI *
+ // and Audio services. *
+ // User Mode 'On' => turn video & audio output on *
+ // User Mode 'Off' => turn video & audio output off *
+ // *
+ // The Request message carries the requested User Mode state. *
+ // The Response message carries the actual User Mode state. *
+ SS_POWER_USER_MODE_SET_RESP, //!< Power Service to Shadow
+ // *
+ // Note: See the corresponding Power Service / System Manager *
+ // 'SS_SystemManagerProtocol' enums in /SystemServices/inc/ *
+ // ss_system_manager_protocol.h *
+ // *
+ // End of User Mode Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Heartbeat Protocol: *
+ // *
+ // Request by the Power Service to the System Manager, originally from *
+ // the Power Shadow, to support the heartbeat request response system. *
+ // *
+ // The Request message carries the expected application processor *
+ // heartbeat response interval in units of seconds. *
+ // The Response message has a data length of zero and serves as a *
+ // periodic heartbeat message to the boot micro. *
+ SS_POWER_HEARTBEAT_REQ, //!< Shadow to Power Service
+ SS_POWER_HEARTBEAT_RESP, //!< Power Service to Shadow
+ // *
+ // End of Heartbeat Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Hard Reset Request Protocol : *
+ // *
+ // Request by the Power Service to the Shadow to support the sending of *
+ // a reset request with type argument to the boot micro. *
+ // *
+ // The Request message carries epsCpuResetReason as data payload. *
+ SS_POWER_HARD_RESET_REQ, //!< Power Service to Shadow
+ // *
+ // End of Hard Reset Request Protocol *
+ //*************************************************************************
+}SS_PowerServiceProtocol;
+
+#endif /* POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard)
+/** @}*/ // end of interface_unified
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
+// EOF
diff --git a/systemservice/interface_unified/library/include/system_service/ss_services.h b/systemservice/interface_unified/library/include/system_service/ss_services.h
new file mode 100755
index 0000000..d414670
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_services.h
@@ -0,0 +1,63 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_services.h
+ * @brief \~english This file supports contains the queue names of all System Services processes.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_SERVICES_H_ // NOLINT (build/header_guard)
+#define SS_SERVICES_H_
+
+#include <agl_thread.h>
+
+
+// Caution:ServiceName length mas is 15
+// System_Services domain services 0123456789ABCDE
+#define SS_DEV_DETECT_THD "SS_Dev_Detect_Thd"
+#define SS_DEV_DETECT_SRV MN_SS_DEVDETECTSRV
+#define SS_DEV_DETECT_BSP_THD "SS_DeviceDetectErr"
+#define SS_GROUP_LAUNCH_TRIGGER "SS_GroupLaunchTrigger"
+#define SERVICE_HEARTBEAT "SS_HeartBeatService"
+#define SERVICE_LOGGER MN_SS_LOGGERSRV
+#define SS_UDEV_DEV_DETECT_DLL "SS_UDEV_DeviceDetect"
+#define SS_PLM_SERVICE "SS_PLMService"
+#define SERVICE_POWER MN_SS_POWERSERVICE
+#define SS_RESOURCE_MONITOR_SERVICE "SS_ResourceMonitorService"
+#define SERVICE_SOFTWAREUPDATE "SS_SofUpdateSrv"
+#define SERVICE_SYSMANAGER MN_SS_SYSMANAGER
+#define SS_WINSYS MN_SS_WINSYS
+#define SS_RESOURCE_MANAGER MN_SS_RESOURCEMGR
+#define SS_TASK_MANAGER MN_SS_TASKMANAGER
+#define SERVICE_VUP MN_VUPSERVICE
+#define SS_UPDATESERVICE MN_SS_UPDATESERVICE
+
+/// @}
+
+#endif /* SS_SERVICES_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_sm_client_if.h b/systemservice/interface_unified/library/include/system_service/ss_sm_client_if.h
new file mode 100755
index 0000000..70b9425
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_sm_client_if.h
@@ -0,0 +1,1064 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_client_if.h
+ * @brief \~english This file supports the AGL framework client interface to System manager.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+
+
+#ifndef __SS_SYSTEM_MANAGER_CLIENT_IF_H__ // NOLINT (build/header_guard)
+#define __SS_SYSTEM_MANAGER_CLIENT_IF_H__
+
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/ns_logger_if.h>
+#include <string>
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_system_manager_if.h"
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RegisterSMSessionAckCallback
+/// \~english @par Summary
+/// API for setting the FrameworkunifiedOnStop response
+/// \~english @param [in] CallbackPtr
+/// EFrameworkunifiedStatus - Pointer to a callback function
+/// \~english @par
+/// - TRUE : Not carried out in the automatic response.
+/// - FALSE : Carry out the response in automatic. (Default)
+/// \~english @retval VOID None
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// In the case of is_start_required = TURE, Client Services of System Manager, automatically \n
+/// System Manager and the session at the same time is building and start-up. \n
+/// It is possible to receive a call back at the timing when the session establishment is completed \n
+/// by this API. \n
+/// is_start_required is, as a Launch Configuration information, have the following meanings.
+/// \~english @par
+/// is_start_required \n
+/// - True: Create a session with the System Manager.(Service to use the Dispatcher.) \n
+/// - False: Not create a session with the System Manager.(Do not use the Dispatcher Service.)
+/// OnStart/Stop/DebugDump Callback is not called. HeartBeat function does not apply.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus RegisterSMSessionAckCallback(EFrameworkunifiedStatus (*CallbackPtr)(HANDLE));
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SetDataResetModeToSystemManager
+/// \~english @par Summary
+/// API to record the data reset mode of the next boot in a non-volatile area.
+/// \~english @param [in] dataResetMode
+/// ESMDataResetModeInfo - Data reset mode information
+/// \~english @par
+/// - e_SS_SM_DATA_RESET_MODE_NONE : Do not initialize
+/// - e_SS_SM_DATA_RESET_MODE_USER : User data initialization
+/// - e_SS_SM_DATA_RESET_MODE_FACTORY : Factory initialization
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusBadConnection Socket connection error
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - Specified log type is invalid(In the case of value which does not correspond to enum eSMUserLogType).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a send and receive type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Send and receive for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the send and receive of the System
+/// Manager message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the send and receive buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Send and receive and reception of System Manager message for the session fails to socket connection.
+/// [eFrameworkunifiedStatusBadConnection]
+/// - Any error has occurred at the time of send and receive of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Send and receive of System Manager message for the session fails to shared memory access.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget x Method
+/// \~english @par Detail
+/// The data reset mode to save in a non-volatile area, the function return.\n
+/// System Manager is to expand the resident service data reset mode of the non-volatile area as\n
+/// an argument of FrameworkunifiedOnStart.\n
+/// Task Manager is Callback data initialization interface of the same information as an argument.\n
+/// All of, the completion of the FrameworkunifiedOnStart processing of all resident services (System Manager) \n
+/// and, at the timing when the Callback of data initialization interface of all non-resident \n
+/// service has been completed (Task Manager), a data reset mode, initialized to e_SS_SM_DATA_RESET_ NONE. \n
+/// In other words, when the reset until initialization occurs, the same data reset mode again to \n
+/// the argument, FrameworkunifiedOnStart or, Callback of data initialization interface is performed.
+/// \~english @see SetProgUpdateStateToSystemManager
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SetDataResetModeToSystemManager(ESMDataResetModeInfo dataResetMode);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SetProgUpdateStateToSystemManager
+/// \~english @par Summary
+/// API to record the program update state in the non-volatile information.
+/// \~english @param [in] updateState
+/// SMProgUpdateState - Program update status
+/// \~english @par
+/// - SS_SM_PROG_UPDATE_STATE_UPDATED : Program update
+/// - SS_SM_PROG_UPDATE_STATE_MAP_UPDATED : Map update
+/// - SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED : Map difference updating
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusBadConnection Socket connection error
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - Specified program update status information is invalid (in the case of a value that does not correspond to
+/// the enum SMProgUpdateState). [eFrameworkunifiedStatusInvldParam]
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a send and receive type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Send and receive for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the send and receive of the System
+/// Manager message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the send and receive buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Send and receive and reception of System Manager message for the session fails to socket connection.
+/// [eFrameworkunifiedStatusBadConnection]
+/// - Any error has occurred at the time of send and receive of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Send and receive of System Manager message for the session fails to shared memory access.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// The program update state to save in a non-volatile area, the function return.\n
+/// updateState is it is possible to specify more than one by setting the OR.\n
+/// Based on the setting state, to determine isProgUpdated, isMapUpdated, the value \n
+/// of the isMapDiffUpdated provided in GetInterfaceunifiedOnStartExtInfo and GetInterfaceunifiedOnStopExtInfo.\n
+/// Task Manager is provided in data initialization interface, the same information to the non-resident service.\n
+/// Set state is initialized with the same timing as data reset mode.\n
+/// (See SetDataResetModeToSystemManager)
+/// \~english @see SetDataResetModeToSystemManager, GetInterfaceunifiedOnStartExtInfo, GetInterfaceunifiedOnStopExtInfo
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SetProgUpdateStateToSystemManager(SMProgUpdateState progUpdateState);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendCpuResetRequestToSystemManager
+/// \~english @par Summary
+/// API to request LOG saved to the internal non-volatile area
+/// \~english @param [in] l_eCpuResetReason
+/// ESMCpuResetReason - Reset factor
+/// \~english @param [in] f_messageStr
+/// std::string - Abnormal message string
+/// \~english @param [in] f_suffixStr
+/// std::string - Suffix string of abnormal LOG file
+/// \~english @par
+/// enum ESMCpuResetReason Variable
+/// - e_SS_SM_CPU_RESET_REASON_NORMAL : Normal Reset
+/// - e_SS_SM_CPU_RESET_REASON_DATA_RESET : Data Reset
+/// - e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET : User forced reset
+/// - e_SS_SM_CPU_RESET_REASON_GENERIC_ERR : Generic Error reset
+/// - e_SS_SM_CPU_RESET_REASON_DSP_ERR : DSP Error
+/// - e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL : Reset immediately
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Collect the LOG information and stores it in the built-in non-volatile area.\n
+/// String specified in f_suffixStr is added as a suffix to the end of the abnormal LOG file name.
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendCpuResetRequestToSystemManager(ESMCpuResetReason l_eCpuResetReason,
+ std::string f_messageStr = "", std::string f_suffixStr = "");
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SetNextWakeupTypeToSystemManager
+/// \~english @par Summary
+/// Set the next wakeup type.
+/// \~english @param [in] f_wakeupType
+/// ESMNextWakeupType - Wakeup type
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail
+/// - The API sets the next wakeup type (COLD/HOT/Not specified).
+/// \n
+/// - Include ss_sm_client_if.h
+/// - Library libSS_SystemIfUnified.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SetNextWakeupTypeToSystemManager(ESMNextWakeupType f_wakeupType);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar
+/// \~english @par Summary
+/// API for setting the FrameworkunifiedOnStop response
+/// \~english @param [in] f_setTrue
+/// BOOL - Response presence or absence of specified
+/// \~english @par
+/// - TRUE : Not carried out in the automatic response.
+/// - FALSE : Carry out the response in automatic. (Default)
+/// \~english @retval VOID None
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// In case you can not return the response in the synchronized by FrameworkunifiedOnStop, by setting to \n
+/// TRUE in this API, it is possible to implement the completion notice to the system_manager \n
+/// the service side.
+/// At this time, the service is by to Publish the Notification of "service name/StopComp", \n
+/// you are possible to notify the STOP completion to system_manager.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+VOID Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar(BOOL f_SetTrue);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendUserInvokedLoggingRequestToSystemManager
+/// \~english @par Summary
+/// API to request LOG saved to the internal non-volatile area
+/// \~english @param [in] f_userInvokedLogType
+/// \ref eSMUserLogType - User invoked log type.
+/// \~english @param [in] f_messageStr
+/// std::string - Abnormal message string
+/// \~english @param [in] f_suffixStr
+/// std::string - Suffix string of abnormal LOG file
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - Log type is invalid(In the case of value which does not correspond to enum eSMUserLogType).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Collect the LOG information and stores it in the built-in non-volatile area.\n
+/// String specified in f_suffixStr is added as a suffix to the end of the abnormal LOG file name.
+/// \~english @see SendClearLogsRequestToSystemManager
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendUserInvokedLoggingRequestToSystemManager(eSMUserLogType f_userInvokedLogType,
+ std::string f_messageStr = "", std::string f_suffixStr = "");
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendInterfaceunifiedOnStopResponseToSystemManager
+/// \~english @par Summary
+/// API to send a FrameworkunifiedOnStop response
+/// \~english @param [in] f_eStatus
+/// EFrameworkunifiedStatus - End status
+/// \~english @par
+/// - eFrameworkunifiedStatusOK : End processing completion
+/// - eFrameworkunifiedStatusFail : End processing uncompleted
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// In case you can not return the response in the synchronized by FrameworkunifiedOnStop, by setting to \n
+/// TRUE in this API, it is possible to implement the completion notice to the system_manager \n
+/// the service side.
+/// At this time, the service is by to Publish the Notification of "service name/StopComp", \n
+/// you are possible to notify the STOP completion to system_manager.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInterfaceunifiedOnStopResponseToSystemManager(EFrameworkunifiedStatus f_eStatus);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetInterfaceunifiedOnStartExtInfo
+/// \~english @par Summary
+/// API to get the extended information of the start-up parameters.
+/// \~english @param [out] f_info
+/// T_SS_SM_START_ExtDataStructType - Startup parameters extended information
+/// \~english @par
+/// T_SS_SM_START_ExtDataStructType Structure
+/// \~english @code
+/// typedef struct {
+/// {
+/// BOOL isProgUpdated;
+/// EMRelaunchStatus relaunchStatus;
+/// BOOL isMapUpdated;
+/// BOOL isMapDiffUpdated;
+/// uint8_t reserved[];
+/// }T_SS_SM_START_ExtDataStructType;
+/// @endcode
+/// \~english @par
+/// isProgUpdated:Presence or absence of a program update
+/// - TRUE : Yes program update
+/// - FALSE : No program update
+/// \~english @par
+/// relaunchStatus:Relaunch state of self-service
+/// - e_SS_SM_RELAUNCH_STATUS_NONE : Relaunch non-occurrence (first start)
+/// - e_SS_SM_RELAUNCH_STATUS_SAFE : Normal Relaunch
+/// - e_SS_SM_RELAUNCH_STATUS_ERR : Abnormal Relaunch
+/// \~english @par
+/// isMapUpdated:Presence or absence of a map update
+/// - TRUE : Yes map update
+/// - FALSE : No map update
+/// \~english @par
+/// isMapDiffUpdated:The presence or absence of the map difference updating
+/// - TRUE : Yes map difference update
+/// - FALSE : No map difference update
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusBadConnection Failure to socket connection
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred(Socket Connection/Memory Allocation/Event Control)
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Transmission and reception of System Manager message for the session fails to socket connection.
+/// [eFrameworkunifiedStatusBadConnection]
+/// - In the case of the message queue open error for reception of System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - System Manager message for the session fails to acquire the message buffer for reception. [eFrameworkunifiedStatusFail]
+/// - System Manager message for the session fails in the event control for the reception. [eFrameworkunifiedStatusFail]
+/// - Any error has occurred at the time of transmission and receive of the System Manager message for the
+/// session. [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Returns the extended information of the parameters of FrameworkunifiedOnStart(). \n
+/// It is assumed that that will be called in the FrameworkunifiedOnStart (), return the correct value when it is called prior
+/// \n
+/// to the issuance FrameworkunifiedOnStart() is not guaranteed.\n
+/// System startup to relaunchStatus is e_SS_SM_RELAUNCH_STATUS_NONE, the service is a case that has been Relaunch
+/// \n
+/// by the exit (SS_SM_EXIT_RELAUNCH) _SS_SM_RELAUNCH_STATUS_SAFE, if the Relaunch due to the abnormality occurs
+/// to \n
+/// set the e_SS_SM_RELAUNCH_STATUS_ERR.
+/// \~english @see GetInterfaceunifiedOnStopExtInfo, FrameworkunifiedOnStart
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetInterfaceunifiedOnStartExtInfo(T_SS_SM_START_ExtDataStructType &f_info); // NOLINT (runtime/references)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetInterfaceunifiedOnStopExtInfo
+/// \~english @par Summary
+/// API to get the extended information of the end parameter.
+/// \~english @param [out] f_info
+/// T_SS_SM_STOP_ExtDataStructType - Exit extended parameter information
+/// \~english @par
+/// T_SS_SM_STOP_ExtDataStructType Structure
+/// \~english @code
+/// typedef struct {
+/// {
+/// BOOL isProgUpdated;
+/// uint8_t reserved[];
+/// }T_SS_SM_START_ExtDataStructType;
+/// @endcode
+/// \~english @par
+/// isProgUpdated:Presence or absence of a program update
+/// - TRUE : Yes program update
+/// - FALSE : No program update
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusBadConnection Failure to socket connection
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred(Socket Connection/Memory Allocation/Event Control)
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a send and receive type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor not for the transmission and reception of the System Manager of the session message.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) occurs during the transmission and reception of the System Manager
+/// of the session message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - The size of the transmit and receive buffer of the System Manager of the session message is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - It failed to socket connection for transmission and reception of the System Manager of the session message.
+/// [eFrameworkunifiedStatusBadConnection]
+/// - Open error of the message queue for the reception of the System Manager of the session message.
+/// [eFrameworkunifiedStatusFail]
+/// - And fail to acquire the message buffer for reception of the System Manager of the session message.
+/// [eFrameworkunifiedStatusFail]
+/// - It failed in the event control for the reception of the System Manager of the session message.
+/// [eFrameworkunifiedStatusFail]
+/// - It failed during transmission and reception of the System Manager of the session message. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission and reception of the System Manager of the session
+/// message. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Returns the extended information of the parameters of FrameworkunifiedOnStop(). \n
+/// It is assumed that that will be called in the FrameworkunifiedOnStop (), return of the correct value in the case \n
+/// that has been called before FrameworkunifiedOnStop() entry into force is not guaranteed.
+/// \~english @see GetInterfaceunifiedOnStartExtInfo, FrameworkunifiedOnStop
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetInterfaceunifiedOnStopExtInfo(T_SS_SM_STOP_ExtDataStructType &f_info); // NOLINT (runtime/references)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendDebugDumpResponseToSystemManager
+/// \~english @par Summary
+/// Send a debug dump response to system_manager
+/// \~english @param [in] f_bFormatStrRequired
+/// BOOL - Specify whether to dump the application name or not
+/// \~english @param [in] f_cFormat
+/// PCSTR - Display format for the dump (the same character strings format as the printf format)
+/// \~english @param [in] arg_list
+/// ... - Dump data in line with f_cFormat format
+/// \~english @par
+/// f_bFormatStrRequired
+/// - true Dump the application name
+/// - false Do not dump the application name
+/// \~english @retval None
+/// \~english @par Precondition
+/// - None
+/// \~english @par Change in the internal status
+/// - The change in the internal status does not occur by this API.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// When f_bFormatStrRequired is true, write the application name to the buffer for dump. \n
+/// Write the data to the buffer for dump in line with f_cFormat. \n
+/// Send OnDebugDumpResponseReceived to the SystemManger in order to request the SystemManger to
+/// write the contents in the buffer for dump to the log file for debug. \n
+/// The maximum size of the buffer for dump is 4Kbyte and the string size of the application name
+/// is deducted when the application name is dumped. \n
+/// When dumping a string which exceeds 4Kbyte, drop what exceeds the buffer.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////
+void SendDebugDumpResponseToSystemManager(BOOL f_bFormatStrRequired, PCSTR f_cFormat, ...)
+#ifdef __GNUC__
+ __attribute__((format(printf, 2, 3)));
+#endif
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendInterfaceunifiedEmmcLogsRequestToSystemManager
+/// \~english @par Summary
+/// API to request a copy to the specified path of the LOG file of the built-in non-volatile area.
+/// \~english @param [in] f_path
+/// std::string - LOG destination file PATH
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - LOG destination file PATH is NULL(If f_path.c_str() is NULL). [eFrameworkunifiedStatusInvldBuf]
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail
+/// To copy all of the files that exist in LOG storage area of the built-in non-volatile area in \n
+/// the path specified in the f_path. \n
+/// If you do not have a copy target, asynchronous response command: Returns the eFrameworkunifiedStatusOK as \n
+/// the message data of SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN.
+/// \~english @see SendClearLogsRequestToSystemManager
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInterfaceunifiedEmmcLogsRequestToSystemManager(std::string f_path);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendClearLogsRequestToSystemManager
+/// \~english @par Summary
+/// API to clear the stored in the built-in non-volatile area log.
+/// \~english @param [in] f_info
+/// TSystemManagerClearLogsInfo - A pointer to the LOG clear information
+/// \~english @par
+/// TSystemManagerClearLogsInfo Structure
+/// \~english @code
+/// typedef struct T_SystemManagerClearLogsInfo{
+/// {
+/// void *rsv;
+/// }TSystemManagerClearLogsInfo;
+/// @endcode
+/// \~english @par
+/// rsv : Reserve area
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - Pointer to the LOG clear information (f_info) is NULL [eFrameworkunifiedStatusInvldParam]
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget x Sync
+/// \~english @par Detail
+/// To delete a LOG stored in the built-in non-volatile area.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendClearLogsRequestToSystemManager(TSystemManagerClearLogsInfo *f_info);
+
+/** @}*/ // end of SystemIf
+/** @}*/ // end of interface_unified
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief AttachCallbackToSystemManager
+///
+/// \note This function is called by System Manager session clients to attach
+/// a callback function to the client application with System Manager
+/// configured as the specified sender of the specified protocol message.
+///
+/// \param [in] f_hApp
+/// HANDLE - Handle to message queue of the System Manager attached client.
+/// \param [in] iCmd
+/// UI_32 iCmd - Command ID
+/// \param [in] fpOnCmd
+/// CbFuncPtr fpOnCmd - Function pointer to be called in the form upon
+/// the invokation of the specified command ID. The callback function
+/// must have the following signature : void (*)(HANDLE).
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus AttachCallbackToSystemManager(HANDLE hApp, UI_32 iCmd, CbFuncPtr fpOnCmd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief Set of complementary detach functions that accept same arguments
+/// as the InterfaceunifiedAttach_XYZ_ToDispatcher() functions do.
+///
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus DetachCallbacksFromInterfaceunifiedDispatcher(HANDLE hApp,
+ PCSTR pServiceName,
+ const FrameworkunifiedProtocolCallbackHandler* pMsgHandler,
+ UI_32 uiHandlerCount,
+ HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+/// \brief
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus DetachParentCallbacksFromInterfaceunifiedDispatcher(HANDLE hChildApp,
+ const FrameworkunifiedProtocolCallbackHandler* pMsgHandler,
+ UI_32 uiHandlerCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief GetSystemManagerSessionHandle
+///
+/// \note This function returns the session handle with System Manager
+///
+/// \return HANDLE - A session handle with System Manager
+/////////////////////////////////////////////////////////////////////////////////////
+extern HANDLE GetSystemManagerSessionHandle(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendShutdownToSystemManager
+///
+/// \note This function is called to send Shutdown command to System Manager
+///
+/// \param [in] pData
+/// Pwr_ServiceSetInterface *pData - Pointer to Shutdown Command data
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendShutdownToSystemManager(Pwr_ServiceSetInterface *pData);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendSystemModeRequestToSystemManager
+///
+/// \note This function is called to send system mode request to System Manager
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendSystemModeRequestToSystemManager(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendInitCompReportToSystemManager
+///
+/// \note This function is called to send init comp report to System Manager
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendInitCompReportToSystemManager(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendWakeUpToSystemManager
+///
+/// \note This function is called to send the Wakeup command to System Manager
+///
+/// \param [in] pData
+/// wakeInfo *pData - Pointer to Wakeup Command data
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendWakeUpToSystemManager(wakeInfo *pData);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendStartupConfirmationToSystemManager
+///
+/// \note This function is called to send the startup confirmation information
+/// to System Manager
+///
+/// \param [in] l_startupConfirmationMsg
+/// StartupConfirmationMsgStrut &l_startupConfirmationMsg - startup confirmation
+/// data
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendStartupConfirmationToSystemManager(StartupConfirmationMsgStrut
+ &l_startupConfirmationMsg);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendSystemErrorToSystemManager
+///
+/// \note This function is called by an application via Native Services to send
+/// notice of a critical error to System Manager when a non recoverable
+/// run-time error is encountered.
+///
+/// \param [in]
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendSystemErrorToSystemManager(EFrameworkunifiedSystemError f_systemError);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief Send_CWORD56_HeartBeatRequestToSystemManager
+///
+/// \note This function forwards a _CWORD56_ heartbeat request received by power
+/// services from the power shadow to System Manager.
+///
+/// \param [in]
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Send_CWORD56_HeartBeatRequestToSystemManager(EPWR_HB_REQ_MSG_STRUCT f_HbReq);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendBootMicroResetNotificationToSystemManager
+///
+/// \param ResetReason Enumerated boot micro reset reason.
+///
+/// This function is called by Logging Shadow to inform System Manager of a
+/// boot micro reset condition.
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendBootMicroResetNotificationToSystemManager(eSMBootMicroResetReason ResetReason);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendDiagLogEventRequestToSystemManager
+///
+/// \note This function is called by logger to initiate log artifact collection
+/// and storage on behalf of diagnostic services.
+///
+/// \param f_copyDestPathStr
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendDiagLoggingRequestToSystemManager(std::string f_copyDestPathStr);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendCANLoggingRequestToSystemManager
+///
+/// \note This function is called by logger to initiate log artifact collection
+/// and storage when signaled via CAN.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendCANLoggingRequestToSystemManager(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendDTCLoggingRequestToSystemManager
+///
+/// \note This function is called by logger to initiate log artifact collection
+/// and storage when signaled via diagnostic command.
+///
+/// \param f_dtc Diagnostic trouble code.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendDTCLoggingRequestToSystemManager(UI_32 f_dtc);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief RegisterBootMicroLogRequestCb
+///
+/// This function is called by Logging Shadow to register a callback function for
+/// the boot micro log request that may be generated by System Manager when an
+/// error event occurs.
+///
+/// \param [in] hApp AGL Framework Application Handle
+///
+/// \param [in] fpOnCmd Call back function with the signature:
+/// EFrameworkunifiedStatus fnct(HANDLE hApp);
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RegisterBootMicroLogRequestCb(HANDLE hApp, CbFuncPtr fpOnCmd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendBootMicroLogResponseToSystemManager
+///
+/// This function is called by Logging Shadow to provide a string representation of
+/// the binary boot-micro log data.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendBootMicroLogResponseToSystemManager(std::string f_logString);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+/// \brief Redirect either formatted, or unformatted response output to System Manager.
+///
+/// \see SendDebugDumpResponseToSystemManager
+////////////////////////////////////////////////////////////////////////////////////////////
+#define SSDEBUGDUMP(args...) (SendDebugDumpResponseToSystemManager(TRUE, ## args))
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SM_Deletable
+////////////////////////////////////////////////////////////////////////////////////////////
+#define SSDEBUGDUMP_RAW(args...) (SendDebugDumpResponseToSystemManager(FALSE, ## args))
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendLogStartRequestToSystemManager
+///
+/// \note This function is call by SS_Logger when the logging process has
+/// completed and no additional request for artifacts will be generated.
+///
+/// \param none.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogStartRequestToSystemManager(EErrorEventType f_errorEventType);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendLogArtifactRequestToSystemManager
+///
+/// \note This function is call by SS_Logger to request SM to acquire and
+// return by reference (filename), the specified logging artifact.
+///
+/// \param [in] f_artifactId, enumerated artifact number.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogArtifactRequestToSystemManager(EArtifactId f_artifactId);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendLogCompleteRequestToSystemManager
+///
+/// \note This function is call by SS_Logger when the logging process has
+/// completed and no additional request for artifacts will be generated.
+///
+/// \param none.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogCompleteRequestToSystemManager(EFrameworkunifiedStatus f_eStatus = eFrameworkunifiedStatusOK);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendEelExportRequestToSystemManager
+///
+/// \note This function forwards the Device Detection EEL_export trigger
+/// received by SS Logger to System Manager.
+///
+/// \param f_path Destination path for the trigger artifacts.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendEelExportRequestToSystemManager(std::string f_path);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief DebugDump request callback function.
+///
+/// \note This function is called when System Manager requests the receiving
+/// application to generate their debugdump.
+///
+/// \param hApp
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnSystemManagerDebugDump(HANDLE hApp);
+
+#endif // __SS_SYSTEM_MANAGER_CLIENT_IF_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_sm_client_if_local.h b/systemservice/interface_unified/library/include/system_service/ss_sm_client_if_local.h
new file mode 100755
index 0000000..a4d0fa9
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_sm_client_if_local.h
@@ -0,0 +1,66 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_sm_client_if_local.h
+ * @brief \~english This file supports the api of debug dump response to System Manager
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef __SS_SYSTEM_MANAGER_CLIENT_IF_LOCAL_H__ // NOLINT (build/header_guard)
+#define __SS_SYSTEM_MANAGER_CLIENT_IF_LOCAL_H__
+
+#include <native_service/frameworkunified_framework_types.h>
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \~english @par Summary:
+/// Responds to SystemManager that debug dump output has finished
+/// \~english @param [in] f_messageStr
+/// std::string & - Dump data
+/// \~english @retval
+/// - None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Change of the internal state:
+/// - No change of internal state by this API occurs
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Detail:
+/// Send OnDebugDumpResponseReceived to SystemManager and request
+/// to write the contents of dump data to /tmp/systemmanager_debugdump.log.\n
+/// The maximum size of the dump buffer is 4KByte.\n
+/// When dumping more than 4KBytes, the overflow from the buffer is discarded.
+///
+/// \~english @par Classification:
+/// - Public
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+
+VOID SendDebugDumpResponseToSystemManager(std::string & f_messageStr); // NOLINT (runtime/references)
+
+#endif /*__SS_SYSTEM_MANAGER_CLIENT_IF_LOCAL_H__*/ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names.h b/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names.h
new file mode 100755
index 0000000..61ee275
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_thread_names.h
+ * @brief This file supports System Manager thread naming.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_SM_THREAD_NAMES_H_ // NOLINT (build/header_guard)
+#define SS_SM_THREAD_NAMES_H_
+
+// thread name max length is 15
+// 0123456789ABCDE
+#define SS_SMHeartbeat "SM.Heartbeat"
+
+#endif /* SS_SM_THREAD_NAMES_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names_local.h b/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names_local.h
new file mode 100755
index 0000000..36dda06
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names_local.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_thread_names_local.h
+ * @brief This file supports System Manager thread naming.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_SM_THREAD_NAMES_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_SM_THREAD_NAMES_LOCAL_H_
+
+// thread name max length is 15
+// 0123456789ABCDE
+#define SS_SMLauncher "SM.ProcLaunch"
+#define SS_SMLowMemMonitor "SM.LowMemMon"
+
+#endif /* SS_SM_THREAD_NAMES_LOCAL_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_string_maps.h b/systemservice/interface_unified/library/include/system_service/ss_string_maps.h
new file mode 100755
index 0000000..4001ed4
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_string_maps.h
@@ -0,0 +1,680 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_string_maps.h
+ * @brief \~english This file supports the a generic std::map<std::string> wrapper.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_STRING_MAPS_H_ // NOLINT (build/header_guard)
+#define SS_STRING_MAPS_H_
+
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_system_manager_if.h"
+#include "system_service/ss_system_manager_protocol.h"
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from BOOL type to string
+/// \~english @param [in] f_enum
+/// BOOL - the member what will convert farm BOOL type to string type
+/// \~english @code
+/// typedef int BOOL;
+/// #define TRUE (1==1)
+/// #define true (1==1)
+/// #define FALSE (0==1)
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from BOOL type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(BOOL f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EErrorEventType type to string
+/// \~english @param [in] f_enum
+/// EErrorEventType - the member what will convert farm EErrorEventType type to string type.error event type.
+/// \~english @code
+/// enum EErrorEventType {
+/// eErrorEventTypeProcessCrash = 0,
+/// eErrorEventTypeHeartBeatFailure,
+/// eErrorEventTypeSystemLowMemory,
+/// eErrorEventTypeReserved1, // Formerly SS_SM_EVENT_ERROR_HIGH_CPU_LOAD, now HMI enum place holder.
+/// eErrorEventTypeUserInvokedUserForceReset,
+/// eErrorEventTypeReserved2,
+/// eErrorEventTypeReserved3,
+/// eErrorEventTypeUserInvokedCollectAllLogs,
+/// eErrorEventTypeBootMicroReset,
+/// eErrorEventTypeProcessExit,
+/// eErrorEventTypeUserInvokedCollectScreenShot,
+/// eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs,
+/// eErrorEventTypeEelExport,
+/// eErrorEventTypeInterfaceunifiedEmmcLogs,
+/// eErrorEventTypeDiagEvent,
+/// eErrorEventTypeCanEvent,
+/// eErrorEventTypeDtcEvent,
+/// eErrorEventTypeModConnFailed,
+/// eErrorEventTypeStartRespFailed,
+/// eErrorEventTypeUserInvokedCollectDevLogs,
+/// eErrorEventTypeModuleInvokedResetRequest,
+/// eErrorEventTypeModuleInvokedCollectDebugLogs,
+/// eErrorEventTypeUserInvokedClearLogs,
+/// eErrorEventTypeUserInvokedCollectNaviLog,
+/// eErrorEventTypeGroupRelaunch,
+/// eErrorEventTypeMaxValue
+/// };
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EErrorEventType type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EErrorEventType f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EFrameworkunifiedSystemError type to string
+/// \~english @param [in] f_enum
+/// EFrameworkunifiedSystemError - the member what will convert farm EFrameworkunifiedSystemError type to string type.The type of system
+/// error.
+/// \~english @codes
+/// typedef enum _EFrameworkunifiedSystemError {
+/// eFrameworkunifiedSystemErrorNone = 0,
+/// eFrameworkunifiedDSPHardwareReset = 1
+/// } EFrameworkunifiedSystemError;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EFrameworkunifiedSystemError type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EFrameworkunifiedSystemError f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_LHC_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_LHC_TYPE - the member what will convert farm EPWR_LHC_TYPE type to string type.Limp home cutoff
+/// protocol type.
+/// \~english @codes
+/// typedef enum {
+/// epslhcINVALID = 0xFF,
+/// epslhcDISABLED = 0x00,
+/// epslhcENABLED = 0x01
+/// } ePwrServiceLHCType, EPWR_LHC_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_LHC_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_LHC_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_PROD_MODE_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_PROD_MODE_TYPE - the member what will convert farm EPWR_PROD_MODE_TYPE type to string type.The type of
+/// production mode protocol.
+/// \~english @codes
+/// typedef enum {
+/// epspmINVALID = 0xFF,
+/// epspmDISABLED = 0x00,
+/// epspmENABLED = 0x01
+/// } ePwrServiceProdModeType, EPWR_PROD_MODE_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_PROD_MODE_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_PROD_MODE_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_SC_COLD_START_REQ_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_SC_COLD_START_REQ_TYPE - the member what will convert farm EFrameworkunifiedSystemError type to string type.The type
+/// of cold start.
+/// \~english @codes
+/// typedef enum {
+/// epsscrtINVALID = 0xFF,
+/// epsscrtNOT_REQUIRED = 0x00,
+/// epsscrtREQUIRED = 0x01
+/// } EPWR_SC_COLD_START_REQ_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_SC_COLD_START_REQ_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_SC_COLD_START_REQ_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_SC__CWORD56__BOOT_MODE_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_SC__CWORD56__BOOT_MODE_TYPE - the member what will convert farm EPWR_SC__CWORD56__BOOT_MODE_TYPE type to string
+/// type.The type of startup confirmation.
+/// \~english @codes
+/// typedef enum {
+/// eps_CWORD56_bmINVALID = 0xFF,
+/// eps_CWORD56_bmAPPLICATION_MODE = 0x00,
+/// eps_CWORD56_bmPROGRAMMING_MODE = 0x08
+/// } EPWR_SC__CWORD56__BOOT_MODE_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_SC__CWORD56__BOOT_MODE_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_SC__CWORD56__BOOT_MODE_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_SHUTDOWN_TRIGGER_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_SHUTDOWN_TRIGGER_TYPE - the member what will convert farm EPWR_SHUTDOWN_TRIGGER_TYPE type to string
+/// type.The type of shutdown trigger.
+/// \~english @codes
+/// typedef enum {
+/// epssdmsdtINVALID = 0xFF,
+/// epssdmsdtTESTACC_OFF = 0x00,
+/// epssdmsdtON_KEY = 0x01,
+/// epssdmsdtIGN_LOCK = 0x02,
+/// epssdmsdtPWR_SAVE = 0x03,
+/// epssdmsdtTMP_STARTUP = 0x04,
+/// epssdmsdtDIAG_DEACTIVATION = 0x05,
+/// epssdmsdtABNORMAL_VOLTAGE = 0x06,
+/// epssdmsdtABNORMAL_TEMP = 0x07,
+/// epssdmsdtBATTERYCUTOFF = 0x08,
+/// epssdmsdtLIMPHOME = 0x09,
+/// epssdmsdtHU_CAN_ERROR = 0x0A,
+/// epssdmsdtBODY_CAN_ERROR = 0x0B,
+/// epssdmsdtTRANSPORT_MODE = 0x0C,
+/// epssdmsdtPRODUCTION_MODE = 0x0D,
+/// epssdmsdtIGN_OFF = 0x0E,
+/// epssdmsdtGENERIC_ERROR_RESET = 0x0F,
+/// epssdmsdtFATAL_ERROR_RESET = 0x10,
+/// epssdmsdtUSER_DATA_RESET = 0x11,
+/// epssdmsdtFACTORY_DATA_RESET = 0x12,
+/// epssdmsdtFAST_SLEEP_MODE = 0x13,
+/// epssdmsdtNORMAL_RESET = 0x14,
+/// epssdmsdtPROGUPDATE_RESET = 0x15,
+/// } ePowerSrvPwrShutdownTriggerType, EPWR_SHUTDOWN_TRIGGER_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_SHUTDOWN_TRIGGER_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_SHUTDOWN_TRIGGER_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_STARTUP_STAGE_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_STARTUP_STAGE_TYPE - the member what will convert farm EPWR_STARTUP_STAGE_TYPE type to string type.The
+/// type of startup stage.
+/// \~english @codes
+/// typedef enum {
+/// epssusfINVALID = 0xFF,
+/// epssusSYSTEM_SERVICES_STARTED = 0x00,
+/// epssusALL_SERVICES_LAUNCHED = 0x01
+/// }ePowerSrvStartupStageType, EPWR_STARTUP_STAGE_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_STARTUP_STAGE_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_STARTUP_STAGE_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_SYSTEM_MODE_INFO type to string
+/// \~english @param [in] f_enum
+/// EPWR_SYSTEM_MODE_INFO - the member what will convert farm EPWR_SYSTEM_MODE_INFO type to string type.The type
+/// of system mode info.
+/// \~english @codes
+/// typedef enum {
+/// epssinfINVALID = 0xFF,
+/// epssinfNORMAL = 0x00,
+/// epssinfPROGRAMMING = 0x08,
+/// }ePowerSrvSystemModeInfo, EPWR_SYSTEM_MODE_INFO;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_SYSTEM_MODE_INFO type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_SYSTEM_MODE_INFO f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_TRANSPORT_MODE_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_TRANSPORT_MODE_TYPE - the member what will convert farm EPWR_TRANSPORT_MODE_TYPE type to string
+/// type.The type of transport mode protocol.
+/// \~english @codes
+/// typedef enum {
+/// epstmINVALID = 0xFF,
+/// epstmDISABLED = 0x00,
+/// epstmENABLED = 0x01
+/// } ePwrServiceTransportModeType, EPWR_TRANSPORT_MODE_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_TRANSPORT_MODE_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_TRANSPORT_MODE_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" type to string
+/// \~english @param [in] f_enum
+/// \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" - the member what will convert farm \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" type
+/// to string type.The type of user mode change reason.
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from type \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_USER_MODE_CHANGE_REASON_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_USER_MODE_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_USER_MODE_TYPE - the member what will convert farm EPWR_USER_MODE_TYPE type to string type.The type of
+/// user mode.
+/// \~english @codes
+/// typedef enum {
+/// epsumINVALID = 0xFF,
+/// epsumOFF = 0x00,
+/// epsumON = 0x01,
+/// } ePwrServiceUserModeType, EPWR_USER_MODE_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_USER_MODE_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_USER_MODE_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_WAKEUP_FACTOR_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_WAKEUP_FACTOR_TYPE - the member what will convert farm EPWR_WAKEUP_FACTOR_TYPE type to string type.The
+/// type of startup reason.
+/// \~english @codes
+/// typedef enum {
+/// epswfINVALID = 0xFF,
+/// epswfTESTACC = 0x00,
+/// epswfON_KEY = 0x01,
+/// epswfIGN_ACC = 0x02,
+/// epswfDR_OPEN_CLOSE = 0x03,
+/// epswfDX_ACTIVATION = 0x04,
+/// epswfPASS_ACTIVATION = 0x05,
+/// epswfSPVACTIVATION = 0x06,
+/// epswfUSER_DATA_RESET = 0x07
+/// } ePowerSrvWakeupFactors, EPWR_WAKEUP_FACTOR_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_WAKEUP_FACTOR_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_WAKEUP_FACTOR_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr JP_ZPT
+/// \~english @par Summary
+/// change member from EFrameworkunifiedStatus type to string
+/// \~english @param [in] f_enum
+/// EFrameworkunifiedStatus - the member what will convert farm EFrameworkunifiedStatus type to string type.Status and return types.
+/// \~english @codes
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EFrameworkunifiedStatus type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EFrameworkunifiedStatus f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from ESMBootModeInfo type to string
+/// \~english @param [in] f_enum
+/// ESMBootModeInfo - the member what will convert farm ESMBootModeInfo type to string type.The type of boot
+/// mode information.
+/// \~english @codes
+/// typedef enum {
+/// e_SS_SM_BOOT_MODE_INVALID = -1
+/// , e_SS_SM_BOOT_MODE_APPLICATION
+/// , e_SS_SM_BOOT_MODE_PROGRAMMING
+/// }ESMBootModeInfo;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from ESMBootModeInfo type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(ESMBootModeInfo f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from ESMCpuResetReason type to string
+/// \~english @param [in] f_enum
+/// ESMCpuResetReason - the member what will convert farm ESMCpuResetReason type to string type.The type of CPU
+/// reset reason.
+/// \~english @codes
+/// typedef enum {
+/// e_SS_SM_CPU_RESET_REASON_INVALID = -1
+/// , e_SS_SM_CPU_RESET_REASON_NORMAL = 0
+/// , e_SS_SM_CPU_RESET_REASON_DATA_RESET
+/// , e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET
+/// , e_SS_SM_CPU_RESET_REASON_GENERIC
+/// , e_SS_SM_CPU_RESET_REASON_GENERIC_ERR = e_SS_SM_CPU_RESET_REASON_GENERIC
+/// , e_SS_SM_CPU_RESET_REASON_DSP_ERR
+/// , e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL
+/// , e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR
+/// }ESMCpuResetReason;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from ESMCpuResetReason type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(ESMCpuResetReason f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from \ref _SS_SystemManagerProtocol "SS_SystemManagerProtocol" type to string
+/// \~english @param [in] f_enum
+/// \ref _SS_SystemManagerProtocol "SS_SystemManagerProtocol" - the member what will convert farm \ref SS_SystemManagerProtocol "SS_SystemManagerProtocol" type to string
+/// type.The type of system manager protocol.
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from \ref _SS_SystemManagerProtocol) "SS_SystemManagerProtocol" type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(SS_SystemManagerProtocol f_enum);
+
+#endif /* SS_STRING_MAPS_H_ */ // NOLINT (build/header_guard)
+// EOF ss_string_maps.h
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_sys_boot_area_map.h b/systemservice/interface_unified/library/include/system_service/ss_sys_boot_area_map.h
new file mode 100755
index 0000000..7df0c88
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_sys_boot_area_map.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_sys_boot_area_map.h
+ * @brief \~english This file supports system area type definitions
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef __SS_SYS_BOOT_AREA_MAP_H__ // NOLINT (build/header_guard)
+#define __SS_SYS_BOOT_AREA_MAP_H__
+
+#include <system_service/ss_sm_boot_access.h>
+
+#endif /* __SS_SYS_BOOT_AREA_MAP_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_system_if.h b/systemservice/interface_unified/library/include/system_service/ss_system_if.h
new file mode 100755
index 0000000..1e3ef14
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_system_if.h
@@ -0,0 +1,119 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_system_if.h
+ * @brief \~english This file contains api build the session of heartbeat observation system manager
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_SYSTEM_IF_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_IF_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_sm_framework_if.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \~english @par Summary:
+/// Establish SystemManger and HeartBeat monitoring session
+/// \~english @param [in] hApp
+/// HANDLE - Handle for application
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Handle error
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue error
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF File descriptor error
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR System call error
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Message buffer error
+/// \~english @retval eFrameworkunifiedStatusErrOther Session establishment failure
+/// \~english @retval eFrameworkunifiedStatusFail Message sharing memory error
+
+/// \~english @par Preconditions:
+/// - Dispather for application is created / initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.)
+/// \~english @par Change of the internal state:
+/// - No change of internal state by this API occurs
+/// \~english @par Causes of failures:
+/// - Handle(hApp) specified in the argument is not appropriate(invalid) [eFrameworkunifiedStatusNullPointer]
+/// - Management information area acquisition(malloc) failed [eFrameworkunifiedStatusNullPointer]
+/// - Message queue for session for service is full [eFrameworkunifiedStatusMsgQFull]
+/// - Invalid file descriptor for sending session messages for service [eFrameworkunifiedStatusErrNoEBADF]
+/// - System call(signal) interrupt occurs
+/// while sending a session message for a service [eFrameworkunifiedStatusErrNoEINTR]
+/// - The size of the message transmission buffer for service is incorrect [eFrameworkunifiedStatusInvldBufSize]
+/// - Some error occurred when sending session message for service [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending session messages for service [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail:
+/// Establish HeartBeat monitoring and SystemManager session.\n
+///
+/// \~english @par Classification:
+/// Public
+/// \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedSendMsg
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(IMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND)
+#define FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(x) \
+ x.onInitilization = FrameworkunifiedOnInitialization; \
+ x.onDestroy = FrameworkunifiedOnDestroy; \
+ x.onStart = FrameworkunifiedOnStart; \
+ x.onStop = FrameworkunifiedOnStop; \
+ x.onDebugDump = FrameworkunifiedOnDebugDump; \
+ x.createStateMachine = FrameworkunifiedCreateStateMachine; \
+ x.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface; \
+ x.onPreStart = FrameworkunifiedOnDummy; \
+ x.onPreStop = FrameworkunifiedOnDummy; \
+ x.onBackgroundStart = FrameworkunifiedOnDummy; \
+ x.onBackgroundStop = FrameworkunifiedOnDummy;
+#else
+#define FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(x) \
+ x.onInitilization = FrameworkunifiedOnInitialization; \
+ x.onDestroy = FrameworkunifiedOnDestroy; \
+ x.onStart = FrameworkunifiedOnStart; \
+ x.onStop = FrameworkunifiedOnStop; \
+ x.onDebugDump = FrameworkunifiedOnDebugDump; \
+ x.createStateMachine = FrameworkunifiedCreateStateMachine; \
+ x.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface; \
+ x.onPreStart = FrameworkunifiedOnPreStart; \
+ x.onPreStop = FrameworkunifiedOnPreStop; \
+ x.onBackgroundStart = FrameworkunifiedOnBackgroundStart; \
+ x.onBackgroundStop = FrameworkunifiedOnBackgroundStop;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* SS_SYSTEM_IF_H_ */ // NOLINT (build/header_guard)
+/** @}*/ // end of interface_unified
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/interface_unified/library/include/system_service/ss_system_manager_if.h b/systemservice/interface_unified/library/include/system_service/ss_system_manager_if.h
new file mode 100755
index 0000000..e6b4f8d
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_system_manager_if.h
@@ -0,0 +1,335 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_system_manager_if.h
+/// \brief This file supports the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_MANAGER_IF_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_MANAGER_IF_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_sm_ram_access.h>
+#include "system_service/ss_system_if.h"
+#include "system_service/ss_error_event_common.h"
+#include "system_service/ss_power_service.h"
+
+/// \ingroup system_manager
+/// \brief Boot mode information
+typedef enum {
+ e_SS_SM_BOOT_MODE_INVALID = -1
+ , e_SS_SM_BOOT_MODE_APPLICATION
+ , e_SS_SM_BOOT_MODE_PROGRAMMING
+}ESMBootModeInfo;
+
+/// \ingroup system_manager
+/// \brief Data reset mode information
+typedef enum {
+ e_SS_SM_DATA_RESET_MODE_NONE
+ , e_SS_SM_DATA_RESET_MODE_USER
+ , e_SS_SM_DATA_RESET_MODE_FACTORY
+ , e_SS_SM_DATA_RESET_MODE_PROGUPDATE // cannot use this
+}ESMDataResetModeInfo;
+
+/// \ingroup system_manager
+/// \brief Program update status
+typedef UI_32 SMProgUpdateState;
+#define SS_SM_PROG_UPDATE_STATE_NONE 0x0000
+#define SS_SM_PROG_UPDATE_STATE_UPDATED 0x0001
+#define SS_SM_PROG_UPDATE_STATE_MAP_UPDATED 0x0002
+#define SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED 0x0004
+
+/// Set Next Wakeup type information
+typedef enum {
+ e_SS_SM_NEXT_WAKEUP_TYPE_NONE = 0
+ , e_SS_SM_NEXT_WAKEUP_TYPE_COLD
+ , e_SS_SM_NEXT_WAKEUP_TYPE_HOT
+}ESMNextWakeupType;
+
+/// \ingroup system_manager
+/// \brief DRAM backup status
+typedef enum {
+ e_SS_SM_DRAM_BACKUP_UNSET = -1
+ , e_SS_SM_DRAM_BACKUP_OK
+ , e_SS_SM_DRAM_BACKUP_NG
+}ESMDramBackupStatus;
+
+/// \ingroup system_manager
+/// \brief Reset status
+typedef enum {
+ e_SS_SM_RESET_STATUS_UNSET = -1
+ , e_SS_SM_RESET_STATUS_NONE
+ , e_SS_SM_RESET_STATUS_NG
+ , e_SS_SM_RESET_STATUS_IMMEDIATE
+}ESMResetStatus;
+
+/// \ingroup system_manager
+/// \brief Relaunch status
+typedef enum {
+ e_SS_SM_RELAUNCH_STATUS_NONE
+ , e_SS_SM_RELAUNCH_STATUS_SAFE
+ , e_SS_SM_RELAUNCH_STATUS_ERR
+}EMRelaunchStatus;
+
+
+/// \ingroup system_manager
+/// \brief CPU Reset Reason
+typedef enum {
+ e_SS_SM_CPU_RESET_REASON_INVALID = -1
+ , e_SS_SM_CPU_RESET_REASON_NORMAL = 0
+ , e_SS_SM_CPU_RESET_REASON_DATA_RESET
+ , e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET
+ , e_SS_SM_CPU_RESET_REASON_GENERIC
+ , e_SS_SM_CPU_RESET_REASON_GENERIC_ERR = e_SS_SM_CPU_RESET_REASON_GENERIC
+ , e_SS_SM_CPU_RESET_REASON_DSP_ERR
+ , e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL
+ , e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR // DRAM backup will be discarded after reset
+}ESMCpuResetReason;
+
+/// \ingroup system_manager
+/// \brief CPU Reset Info
+typedef struct T_SystemManagerCpuResetInfo {
+#define SS_SM_RESET_MSG_STR_SIZE 64
+#define SS_SM_SUFFIX_STR_SIZE 32
+ ESMCpuResetReason resetReason;
+ CHAR messageStr[SS_SM_RESET_MSG_STR_SIZE];
+ CHAR suffixStr[SS_SM_SUFFIX_STR_SIZE];
+ T_SystemManagerCpuResetInfo
+ () : resetReason(e_SS_SM_CPU_RESET_REASON_INVALID) {
+ }
+}TSystemManagerCpuResetInfo;
+
+
+/// \ingroup system_manager
+/// \brief Data Reset Reason
+typedef enum {
+ e_SS_SM_DATA_RESET_TYPE_USER = 0
+ , e_SS_SM_DATA_RESET_TYPE_FACTORY // AKA Shipment Mode
+ , e_SS_SM_DATA_RESET_TYPE_CONFIGURATION
+ , e_SS_SM_DATA_RESET_TYPE_PROGUPDATE // cannot use this
+}ESMDataResetType;
+
+typedef enum {
+ e_SS_SM_SVC_WAKEUP_STATUS_COMPLETE = 0x01
+}ESMServiceWakeupStatus;
+
+/// \ingroup system_manager
+/// \brief Data Reset Reason
+typedef struct T_SS_BootModeListStruct {
+ ESMBootModeInfo hostBootMode;
+ EPWR_SC__CWORD56__BOOT_MODE_TYPE _CWORD56_BootMode;
+} TSS_BootModeListStruct;
+
+//****************************************************************************
+/// \ingroup system_manager *
+/// Data passed in the NTFY_SSSystemMgrPowerOnOff and *
+/// NTFY_SSSystemMgrUserMode notification messages *
+
+/// \ingroup system_manager
+typedef struct T_SS_SM_UserModeOnOffNotification_Struct { // *
+ BOOL isUserModeOn; // *
+ EPWR_WAKEUP_FACTOR_TYPE startupReason; // *
+ EPWR_USER_MODE_CHANGE_REASON_TYPE userModeChangeReason; // *
+ T_SS_SM_UserModeOnOffNotification_Struct // *
+ () : isUserModeOn(FALSE), // *
+ startupReason(epswfINVALID), // *
+ userModeChangeReason(epsumcrNOT_AVAILABLE) { // *
+ } // *
+ T_SS_SM_UserModeOnOffNotification_Struct // *
+ (BOOL f_bUserMode, // *
+ EPWR_WAKEUP_FACTOR_TYPE f_startupReason, // *
+ EPWR_USER_MODE_CHANGE_REASON_TYPE f_changeReason) // *
+ : isUserModeOn(f_bUserMode), // *
+ startupReason(f_startupReason), // *
+ userModeChangeReason(f_changeReason) { // *
+ } // *
+ // *
+} T_SS_SM_UserModeOnOffNotification_StructType; // *
+// *
+// End of Data passed as part of NTFY_SSSystemMgrPowerOnOff notification ... *
+//****************************************************************************
+
+
+//****************************************************************************
+/// \ingroup system_manager
+/**
+ * \~english Parameters of the following message. \n
+ * SS_SM_START 'FrameworkunifiedOnStart'/'evStart' \n
+ * SS_SM_PRE_START 'FrameworkunifiedOnPreStart'/'evPreStart' \n
+ * SS_SM_BACKGROUND_START 'FrameworkunifiedOnBackgroundStart'/'evBackgroundStart' \n
+ */
+typedef struct T_SS_SM_START_DataStruct {
+ EPWR_WAKEUP_FACTOR_TYPE startupReason; //!< \~english
+ BOOL isUserModeOn; //!< \~english
+ ESMDataResetModeInfo dataResetMode; //!< \~english
+ EPWR_SC_SECURITY_STATUS securityStatus; //!< \~english
+ EPWR_SC_WAKEUP_TYPE wakeupType; //!< \~english
+ ESMDramBackupStatus dramBackupStatus; //!< \~english
+ ESMResetStatus resetStatus; //!< \~english
+ UI_32 errResetCount; //!< \~english
+ /**
+ * \~english Constructor
+ */
+ T_SS_SM_START_DataStruct
+ () : startupReason(epswfINVALID),
+ isUserModeOn(FALSE),
+ dataResetMode(e_SS_SM_DATA_RESET_MODE_NONE),
+ securityStatus(epsssINVALID),
+ wakeupType(epsstINVALID),
+ dramBackupStatus(e_SS_SM_DRAM_BACKUP_UNSET),
+ resetStatus(e_SS_SM_RESET_STATUS_UNSET),
+ errResetCount(0) {}
+ /**
+ * \~english Constructor
+ */
+ T_SS_SM_START_DataStruct
+ (EPWR_WAKEUP_FACTOR_TYPE f_startupReason,
+ BOOL f_isUserModeOn,
+ ESMDataResetModeInfo f_dataResetMode,
+ EPWR_SC_SECURITY_STATUS f_securityStatus,
+ EPWR_SC_WAKEUP_TYPE f_wakeupType,
+ ESMDramBackupStatus f_dramBackupStatus,
+ ESMResetStatus f_resetStatus,
+ UI_32 f_resetCount)
+ : startupReason(f_startupReason),
+ isUserModeOn(f_isUserModeOn),
+ dataResetMode(f_dataResetMode),
+ securityStatus(f_securityStatus),
+ wakeupType(f_wakeupType),
+ dramBackupStatus(f_dramBackupStatus),
+ resetStatus(f_resetStatus),
+ errResetCount(f_resetCount) {}
+} T_SS_SM_START_DataStructType;
+// *
+// End of Data passed as part of SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message *
+//****************************************************************************
+
+//****************************************************************************
+/// \ingroup system_manager
+/// Data passed as part of SS_SM_STOP 'FrameworkunifiedOnStop'/'evStop' message *
+typedef struct T_SS_SM_STOP_DataStruct { // *
+ EPWR_SHUTDOWN_TRIGGER_TYPE shutdownTrigger; // *
+ EPWR_USER_MODE_TYPE lastUserMode; // *
+} T_SS_SM_STOP_DataStructType; // *
+// *
+// End of Data passed as part of SS_SM_STOP 'FrameworkunifiedOnStop'/'evStop' message // *
+//****************************************************************************
+
+//****************************************************************************
+/// \ingroup system_manager
+/// Extended Parameter for FrameworkunifiedOnStart *
+typedef struct { // *
+#define SS_SM_START_EXT_INFO_SIZE 64 // *
+#define SS_SM_START_EXT_BODY_SIZE ( sizeof(BOOL) \
+ + sizeof(EMRelaunchStatus) \
+ + sizeof(BOOL) \
+ + sizeof(BOOL) \
+ )
+
+#define SS_SM_START_EXT_RSV_SIZE SS_SM_START_EXT_INFO_SIZE \
+ - SS_SM_START_EXT_BODY_SIZE // *
+ BOOL isProgUpdated; // *
+ EMRelaunchStatus relaunchStatus; // *
+ BOOL isMapUpdated; // *
+ BOOL isMapDiffUpdated; // *
+ uint8_t reserved[SS_SM_START_EXT_RSV_SIZE]; // *
+} T_SS_SM_START_ExtDataStructType; // *
+// *
+// End of Extended Parameter for FrameworkunifiedOnStart *
+//****************************************************************************
+
+//****************************************************************************
+/// \ingroup system_manager
+/// Extended Parameter for FrameworkunifiedOnStop *
+typedef struct { // *
+#define SS_SM_STOP_EXT_INFO_SIZE 64 // *
+#define SS_SM_STOP_EXT_BODY_SIZE (sizeof(BOOL)) // *
+#define SS_SM_STOP_EXT_RSV_SIZE SS_SM_STOP_EXT_INFO_SIZE \
+ - SS_SM_STOP_EXT_BODY_SIZE // *
+ BOOL isProgUpdated; // *
+ uint8_t reserved[SS_SM_STOP_EXT_RSV_SIZE]; // *
+}T_SS_SM_STOP_ExtDataStructType; // *
+// *
+// End of Extended Parameter for FrameworkunifiedOnStop *
+//****************************************************************************
+
+struct SMErrorEventNtfData {
+#define SM_MODULE_NAME_SIZE 64
+ EErrorEventType EventType;
+ CHAR ModuleName[SM_MODULE_NAME_SIZE];
+ BOOL isNeedReboot;
+};
+
+//*************************************************************************
+// Boot Micro Logging Protocol *
+// *
+enum eSMBootMicroResetReason {
+ SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET = 0,
+ SS_SM_BOOT_MICRO_RESET_REASON_USER_FORCE_RESET,
+ SS_SM_BOOT_MICRO_RESET_REASON_DSP_RESET,
+ SS_SM_BOOT_MICRO_RESET_REASON_HB_TIMEOUT
+};
+// *
+// End of Boot Micro Logging Protocol *
+//*************************************************************************
+
+
+//****************************************************************************
+/// \ingroup system_manager *
+/// Error Event Logging enumerations *
+///
+enum eSMUserLogType {
+ e_SS_SM_CAPTURE_ALL_LOGS = 1, //!< \~english Capture all logs
+ e_SS_SM_SCREEN_CAPTURE, //!< \~english Capture screenshot
+ e_SS_SM_CAPTURE_INTERFACEUNIFIED_LOGS, //!< \~english Capture application log
+ e_SS_SM_USER_FORCE_RESET, //!< \~english Capture logs are forcibily reset
+ e_SS_SM_CAPTURE_DEV_LOGS, //!< \~english Capture device log
+ e_SS_SM_CAPTURE_MODULE_LOGS, //!< \~english Capture debug log
+ e_SS_SM_CAPTURE_DTC_LOGS, //!< \~english Capture DTC event log
+ e_SS_SM_CAPTURE_NAVI_LOGS, //!< \~english Capture Navi event log
+ e_SS_SM_CAPTURE_GROUP_RELAUNCH //!< \~english Capture log by Group Relaunch
+};
+// *
+// Error Event Logging enumerations *
+//****************************************************************************
+
+//****************************************************************************
+/// \ingroup system_manager *
+/// \brief Error Event Logging Info *
+typedef struct T_SystemManagerLoggingRequestInfo {
+#define SS_SM_LOG_MSG_STR_SIZE 64
+ eSMUserLogType logType;
+ CHAR messageStr[SS_SM_LOG_MSG_STR_SIZE];
+ CHAR suffixStr[SS_SM_SUFFIX_STR_SIZE];
+}TSystemManagerLoggingRequestInfo;
+//
+// Error Event Logging Info *
+//****************************************************************************
+
+//****************************************************************************
+/// \ingroup system_manager *
+/// \brief Error Event Clear Logs Info *
+typedef struct T_SystemManagerClearLogsInfo {
+ void *rsv;
+}TSystemManagerClearLogsInfo;
+//
+// Error Event Clear Logs Info *
+//****************************************************************************
+
+#endif /* SS_SYSTEM_MANAGER_IF_H_ */ // NOLINT (build/header_guard)
diff --git a/systemservice/interface_unified/library/include/system_service/ss_system_manager_if_local.h b/systemservice/interface_unified/library/include/system_service/ss_system_manager_if_local.h
new file mode 100755
index 0000000..5c67aa6
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_system_manager_if_local.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_system_manager_if_local.h
+/// \brief This file supports the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_MANAGER_IF_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_MANAGER_IF_LOCAL_H_
+
+#define SS_MAX_NUM_MODULES (128)
+
+// EXIT_SUCCESS exit succeccfully
+// EXIT_FAILURE exit with failure
+// SS_SM_EXIT_RELAUNCH exit for relaunch request
+#define SS_SM_EXIT_RELAUNCH (2)
+
+/// \ingroup system_manager
+/// Message data payload structure from system manager to heartbeat
+typedef struct T_SMRequestMsg {
+ CHAR pstModuleName[MAX_QUEUE_NAME_SIZE];
+}TSMRequestMessage;
+
+#endif /* SS_SYSTEM_MANAGER_IF_LOCAL_H_ */ // NOLINT (build/header_guard)
diff --git a/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications.h b/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications.h
new file mode 100755
index 0000000..008d4f3
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications.h
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_system_manager_notifications.h
+/// \brief This file supports the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_MANAGER_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_MANAGER_NOTIFICATIONS_H_
+
+#include "system_service/ss_services.h"
+
+/// \addtogroup system_manager
+/// @{
+
+#define NTFY_SSSystemMgrAvailability SERVICE_SYSMANAGER"/Availability" ///< System Manager availability -
+ // eFrameworkunifiedServiceAvailable or eInterfaceunifiedServiceUnavailable
+#define NTFY_SSSystemMgrState SERVICE_SYSMANAGER"/State" ///< System Manager state - Init,
+ // Connecting, Disconnecting and Ready
+#define NTFY_SSSystemMgrPowerOnOff SERVICE_SYSMANAGER"/PowerOnOffState" ///< Power ON notification for
+ // Audio & Display
+#define NTFY_SSSystemMgrStartUpType SERVICE_SYSMANAGER"/StartUpType" ///< Notification for start up type
+#define NTFY_SSServiceWakeupStatus SERVICE_SYSMANAGER"/ServiceWakeupStatus" ///< Service Wakeup state
+#define NTFY_SSNeedAplRestart SERVICE_SYSMANAGER"/NeedAplRestart" ///< Notification for Need APL Restart
+
+
+/// Notification used by HMI to know when a Shutdown Request has been received
+/// from the _CWORD56_
+#define NTFY_SSSystemMgrShutdownStarted SERVICE_SYSMANAGER"/ShutdownStarted"
+
+/// @}
+
+#endif /* SS_SYSTEM_MANAGER_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
diff --git a/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h b/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h
new file mode 100755
index 0000000..cbb743f
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_system_manager_notifications_local.h
+ * @brief \~english This file supports the System Manager client interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_SYSTEM_MANAGER_NOTIFICATIONS_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_MANAGER_NOTIFICATIONS_LOCAL_H_
+
+
+/// TRUE : UserMode is UserOn
+/// FALSE : UserMode is UserOff
+/// Notification for User Mode
+#define NTFY_SSSystemMgrUserMode SERVICE_SYSMANAGER"/UserMode"
+
+/// Notification for data reset
+#define NTFY_SSSystemMgrDataReset SERVICE_SYSMANAGER"/DataReset"
+
+/// Notification used by Audio and System Services for Dynamic Launch
+#define NTFY_SSLastSourceType SERVICE_SYSMANAGER"/LastSourceType"
+
+
+#endif /* SS_SYSTEM_MANAGER_NOTIFICATIONS_LOCAL_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol.h b/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol.h
new file mode 100755
index 0000000..99d7e13
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol.h
@@ -0,0 +1,329 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_system_manager_protocol.h
+/// \brief This file supports the System Manager client interface.
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SYSTEM_MANAGER_PROTOCOL_H__ // NOLINT (build/header_guard)
+#define __SS_SYSTEM_MANAGER_PROTOCOL_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+/// \addtogroup system_manager
+/// @{
+
+#define SS_SM_MAX_MODULE_NAME_LENGTH (256)
+#define SS_SM_MAX_TEST_CASE_NAME_SIZE (128)
+#define SS_SM_MAX_RESP_MSG_SIZE (2048)
+
+// system manager protocol --> define all protocol messages in and out of system manager
+// that are pertinent to the functionality offered by system manager.
+/**
+ * \~english System control protocol type.
+ */
+typedef enum _SS_SystemManagerProtocol {
+ // System Manager - command Protocol
+ SS_SYSTEM_MANAGER_PROTOCOL_BEGINNING_INDEX = 0x800, //!< \~english
+ SS_SM_NOTIFY_SYSTEM_LAUNCH_COMPLETE = SS_SYSTEM_MANAGER_PROTOCOL_BEGINNING_INDEX //!< System Manager to Power manager
+ , SS_SM_PROTOCOL_INTERFACE_END //!< \~english
+
+ // SystemManager-command Protocol
+ , SS_SM_START //!< \~english Normal-boot start request.
+ , SS_SM_START_COMPL_RSPN //!< \~english Normal-boot start completion notification.
+ , SS_SM_STOP //!< \~english Shutdown request.
+ , SS_SM_STOP_COMPL_RSPN //!< \~english Shutdown completion notification.
+ // SystemManager-command Protocol
+ , SS_SM_WAKEUP_MODULES_CMPL_RSPN //!< \~english Response to request of power state transition to power_service.(message format to use: \ref _wakeinfo "wakeInfo")
+ , SS_SM_SHUTDOWN_MODULES_CMPL_RSPN //!< SM to power
+
+ , SS_SM_WAKEUP_MODULES //!< client to service
+ , SS_SM_POWER_OFF_MODULES //!< client to service
+ , SS_SM_SHUTDOWN_MODULES //!< client to service
+
+ , SS_SM_CRNT_STATE_QUERY //!< client to service
+ , SS_SM_CRNT_STATE_QUERY_RSPN //!< service to client
+ , SS_SM_SYSTEM_MODE_INFO_REQ //!< client to service
+ , SS_SM_SYSTEM_MODE_INFO_RSPN //!< service to client
+ , SS_SM_INITCOMP_REP //!< client to service
+
+ , SS_SM_PROTOCOL_OPEN_SESSION_REQ //!< \~english
+ , SS_SM_PROTOCOL_OPEN_SESSION_ACK //!< \~english
+
+ //*************************************************************************
+ // Get Extended Parameter Protocol *
+ // *
+ // Protocol between applications and SM *
+ , SS_SM_GET_START_EXT_INFO //!< FrameworkunifiedOnStart Extended Parameter
+ , SS_SM_GET_STOP_EXT_INFO //!< FrameworkunifiedOnStop Extended Parameter
+ // End of Get Extended Parameter Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Reset Mode Protocol: *
+ // *
+ // Request by Privileged clients to set the data reset mode: *
+ // None, UserData Reset or *
+ // Factory Reset *
+ // *
+ // The Set Request message carries the requested reset Mode. *
+ // Set Result message is not defined, because the Set Request is send by *
+ // FrameworkunifiedInvokeSync() *
+ , SS_SM_DATA_RESET_MODE_SET_REQ //!< Client to Service (Sys Mgr)
+ // *
+ // End of Reset Mode Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Program Update Status Protocol: *
+ // *
+ // Request by Privileged clients to set the program update status: *
+ // None or Program Updated *
+ // *
+ // The Set Request message carries the requested program update status. *
+ // Set Result message is not defined, because the Set Request is send by *
+ // FrameworkunifiedInvokeSync() *
+ , SS_SM_PROG_UPDATE_STATE_SET_REQ //!< Client to Service (Sys Mgr)
+ // *
+ // End of Reset Mode Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // 'CPU Reset' Protocol: *
+ // *
+ // CPU Reset request from applications to SM and SM to PS *
+ // /// < Client to Service when *
+ // /// message originating from *
+ // /// Application to SS\SM. *
+ // /// < Service to Client when *
+ // /// message originating from *
+ // /// SS\SM to SS\PS. *
+ , SS_SM_CPU_RESET_REQ //!< \~english
+ // *
+ // End of CPU Reset Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // 'Local Data Reset' Protocol: *
+ // *
+ // Local Data Reset request from applications to SM. *
+ // /// < Client to Service when *
+ // /// message originating from *
+ // /// Application to SS\SM. *
+ , SS_SM_LOCAL_DATA_RESET_REQ //!< \~english
+ // *
+ // End of Local Data Reset Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // 'Remote Data Reset' Protocol: *
+ // *
+ // Remote Data Reset request from SM to PS *
+ // /// < Service to Client when *
+ // /// message originating from *
+ // /// SS\SM to SS\PS. *
+ , SS_SM_REMOTE_DATA_RESET_REQ //!< \~english
+ // *
+ // End of Remote Data Reset Protocol *
+ //*************************************************************************
+
+
+ //*************************************************************************
+ // Startup Confirmation Protocol: *
+ // *
+ // Request by the Power Shadow to the Power Service to forward to the *
+ // System Manager the Startup Confirmation message. *
+ // *
+ // The Request message carries the Startup Confirmation message. *
+ // The Response message carries the EFrameworkunifiedStatus of the request. *
+ , SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ //!< Pwr Svc to Sys Mgr
+ , SS_SM_FWD_START_CONFIRMATION_MSG_RESP //!< Sys Mgr to Pwr Svc
+ // *
+ // End of Startup Confirmation Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Power Request Protocol: *
+ // *
+ // Power Request message from the Power Shadow to the System Manager with *
+ // _CWORD56_'s "Power_Request" IPC_Command data. *
+ // *
+ // The Request message carries the _CWORD56_'s data. *
+ // The Response message carries the EFrameworkunifiedStatus of the request. *
+ , SS_SM_POWER_REQUEST_MSG //!< \~english Startup process start request from power_service.
+ , SS_SM_POWER_REQUEST_MSG_RESP //!< Sys Mgr to Pwr Svc
+ // *
+ // End of Power Request Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // User Mode Protocol: *
+ // *
+ // Request from the Power Service to the System Manager, originally from *
+ // the Power Shadow, to turn on or off the video & audio output of HMI *
+ // and Audio services. *
+ // User Mode 'On' => turn video & audio output on *
+ // User Mode 'Off' => turn video & audio output off *
+ // *
+ // The Request message carries the requested User Mode state. *
+ // The Response message carries the actual User Mode state. *
+ , SS_SM_USER_MODE_SET_RESP //!< Service (Sys Mgr) to Client (Pwr Svc)
+ // *
+ // Note: See the corresponding Power Shadow / Power Service *
+ // 'SS_PowerServiceProtocol' enums in *
+ // /SystemServices/inc/ss_power_service_protocol.h *
+ // End of User Mode Protocol *
+ //*************************************************************************
+
+ , SS_SM_NEXT_WAKEUP_TYPE_SET_REQ //!< \~english
+
+ //*************************************************************************
+ // Error Event Protocol *
+ //
+ , SS_SM_EVENT_ERROR //!< SM to HMI(_CWORD77_)
+ , SS_SM_EVENT_ERROR_TO_SSL //!< SM to SSL
+ , SS_SM_ERROR_EVENT_LOGGING_START_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_LOGGING_START_RSPN //!< SM to SSL
+ , SS_SM_ERROR_EVENT_ARTIFACT_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_ARTIFACT_RSPN //!< SM to SSL
+ , SS_SM_ERROR_EVENT_LOGGING_COMPLETE //!< SSL to SM
+ , SS_SM_ERROR_EVENT_LOGGING_COMPLETE_RSPN //!< SM to SSL
+
+ , SS_SM_ERROR_EVENT_TIMER_ID_LOGGER_START_REQ //!< \~english
+ , SS_SM_ERROR_EVENT_TIMER_ID_DEBUG_DUMP_RSPN //!< \~english
+ , SS_SM_ERROR_EVENT_TIMER_ID_BOOT_MICRO_LOG_RSPN //!< \~english
+ , SS_SM_ERROR_EVENT_TIMER_ID_CORE_FILE_POLL //!< \~english
+
+ , SS_SM_USER_INVOKED_LOG_REQ //!< Key Shadow to SM
+
+ , SS_SM_ERROR_EVENT_EEL_EXPORT_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN //!< SM to SVC
+ , SS_SM_ERROR_EVENT_CLR_LOGS_REQ //!< SVC to SM
+ , SS_SM_ERROR_EVENT_PROCESS_EXIT //!< SM\CD to SM
+ , SS_SM_ERROR_EVENT_DIAG_LOG_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_CAN_LOG_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_DTC_LOG_REQ //!< SSL to SM
+ //
+ // End of Error Event Protocol *
+ //*************************************************************************
+
+ , SS_SM_GROUP_LAUNCH_TRIGGER //!< \~english
+
+ //*************************************************************************
+ // Debug Dump Protocol *
+ // *
+ // Protocol between applications and SM *
+ , SS_SM_DEBUG_DUMP //!< SM to client
+ , SS_SM_DEBUG_DUMP_RSPN //!< client to SM
+ // *
+ // End of Debug Dump Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // IAT Propagate Error (Module Relaunch Request) *
+ // *
+ // Protocol between applications and SM *
+ , SS_SM_MODULE_RELAUNCH_REQ //!< client to SM
+ // *
+ // End of IAT Propagate Error (Module Relaunch Request) *
+ //*************************************************************************
+
+ //*************************************************************************
+ // CPU High Load *
+ // *
+ // Protocol between SS_CPU_Monitor and SM *
+ , SS_SM_CPU_HIGH_LOAD_DETECTED //!< client to SM
+ // *
+ // End of CPU High Load *
+ //*************************************************************************
+
+ //*************************************************************************
+ // IAT Propagate Error (System Error) *
+ // *
+ // Protocol between application and SM *
+ , SS_SM_PROPAGATE_SYSTEM_ERROR //!< client to SM
+ // *
+ // End of IAT Propagate Error (System Error) *
+ //*************************************************************************
+
+ //*************************************************************************
+ // _CWORD56_ HeartBeat Request Protocol *
+ // *
+ // Protocol between Power Services and SM *
+ , SS_SM__CWORD56__HEARTBEAT_REQ //!< PS to SM
+ , SS_SM__CWORD56__HEARTBEAT_RSPN //!< SM to PS
+ // *
+ // End of _CWORD56_ HeartBeat Request Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // User Data Reset Event Protocol *
+ // *
+ // Protocol between SM and Service *
+ , SS_SM_EVENT_USER_DATA_RESET //!< SM to MS
+ // *
+ // End of User Data Reset Event Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Boot Micro Logging Protocol *
+ // *
+ // Protocol between SS_Logger and SM. *
+ , SS_SM_BOOT_MICRO_RESET_NTF //!< Logging Shadow to SM
+ , SS_SM_BOOT_MICRO_LOG_REQ //!< SM to Logging Shadow
+ , SS_SM_BOOT_MICRO_LOG_RSP //!< Logging Shadow to SM aka ENDING_INDEX
+ // *
+ // End Boot Micro Logging Protocol *
+ //*************************************************************************
+
+ // SystemManager-command Protocol
+ , SS_SM_PRE_START //!< \~english Pre-boot(+BA) start request.
+ , SS_SM_PRE_START_COMPL_RSPN //!< \~english Pre-boot(+BA) start completion notification.
+ , SS_SM_PRE_STOP //!< \~english Pre-boot(+BA) stop request.
+ , SS_SM_PRE_STOP_COMPL_RSPN //!< \~english Pre-boot(+BA) stop completion notification.
+ , SS_SM_BACKGROUND_START //!< \~english Background-boot(+BA) start request.
+ , SS_SM_BACKGROUND_START_COMPL_RSPN //!< \~english Background-boot(+BA) start completion notification.
+ , SS_SM_BACKGROUND_STOP //!< \~english Background-boot(+BA) stop request.
+ , SS_SM_BACKGROUND_STOP_COMPL_RSPN //!< \~english Background-boot(+BA) stop completion notification.
+
+ // UPDATE IF ANOTHER 'LAST' ENUMERATION IS ADDED !
+ , SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX = SS_SM_BACKGROUND_STOP_COMPL_RSPN //!< \~english
+} SS_SystemManagerProtocol;
+
+typedef struct _SS_SMCurrentState {
+ CHAR testCaseIdString[SS_SM_MAX_TEST_CASE_NAME_SIZE];
+ CHAR respMsgString[SS_SM_MAX_RESP_MSG_SIZE];
+}SS_SMCurrentState;
+
+typedef struct _SMCompleteAck {
+ UI_16 unSessionId;
+ CHAR szServiceName[MAX_QUEUE_NAME_SIZE];
+} SMStopCompleteAck;
+
+typedef struct _SMGroupLaunchTrigger {
+ UI_32 NextGroupId;
+}SMGroupLaunchTrigger;
+//*************************************************************************
+
+
+/// @}
+
+#endif /* __SS_SYSTEM_MANAGER_PROTOCOL_H__ */ // NOLINT (build/header_guard)
+// EOF
diff --git a/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h b/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h
new file mode 100755
index 0000000..5f86820
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_system_manager_protocol_local.h
+/// \brief This file supports the System Manager client interface.
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SYSTEM_MANAGER_PROTOCOL_LOCAL_H__ // NOLINT (build/header_guard)
+#define __SS_SYSTEM_MANAGER_PROTOCOL_LOCAL_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+/// \addtogroup system_manager
+/// @{
+
+#define SS_SM_MAX_MODULE_LOG_MASK_LENGTH (50)
+#define SS_SM_MAX_MODULE_PATH_LENGTH (256)
+#define SS_SM_MAX_MODULE_ARGS_LENGTH (512)
+
+//*************************************************************************
+// Version Number Structure Specification: *
+typedef UI_64 SS_VersionNumberType;
+// End of Version Number Structure Specification *
+//*************************************************************************
+
+/// @}
+
+#endif /* __SS_SYSTEM_MANAGER_PROTOCOL_LOCAL_H__ */ // NOLINT (build/header_guard)
+// EOF
diff --git a/systemservice/interface_unified/library/include/system_service/ss_system_process.h b/systemservice/interface_unified/library/include/system_service/ss_system_process.h
new file mode 100755
index 0000000..a4ae743
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_system_process.h
@@ -0,0 +1,1118 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServicesIf
+/// \brief This file supports the System Manager OS process abstraction.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ss_system_process.h
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef __Process_H__ // NOLINT (build/header_guard)
+#define __Process_H__
+
+#include <spawn.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/cl_process.h>
+#include <system_service/ss_system_types.h>
+#include <signal.h>
+#include <vector>
+#include <string>
+#include <map>
+
+const long lProcess_VALIDATION_VALUE = 2198645; // NOLINT (runtime/int)
+// Used to define a unique value that represents this class.
+// This value is stored in the object when the object is created,
+// and cleared when the object is destroyed.
+
+const int iProcess_DEFAULT_PROCESS_PRIORITY = 10;
+// This is the default process priority that all new processes will use.
+
+const int iProcess_MAXIMUM_PROCESS_PRIORITY = 60;
+// This is the maximum priority a process can have
+
+const long iProcess_DEFAULT_PROCESS_FLAGS = POSIX_SPAWN_SETSCHEDULER // NOLINT (runtime/int)
+ | POSIX_SPAWN_SETSCHEDPARAM;
+
+// This flag field is a bit wise OR of spawning options to use when a process
+// is created.
+
+const int iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS = 25;
+// This is the maximum number of command line (i.e. argv[]) arguments we can
+// send to a process. This includes; exectuable file name + process arguments + NULL
+
+const int iProcess_MAXIMUM_PROCESS_NAME_LENGTH = 32;
+// This is the maximum number of characters that a process name can be in bytes.
+
+class Process;
+
+typedef std::map<SS_String, Process *> ProcessMap;
+
+/**
+ * @class TimerCtrl
+ * \~english @brief OS process
+ * \~english @par Brief Introduction
+ * This class is the System Manager OS process abstraction.
+ *
+ */
+class Process {
+ public:
+ enum eProcessLoadMode {
+ WAIT, // The invoked program is loaded into available memory, is executed,
+ // and then the original program resumes execution.
+ NOWAIT, // Causes the current program to execute concurrently with the new child process.
+ };
+
+ enum eProcessSchedulingPolicy {
+ FIFO, // A fixed priority scheduler in which the highest ready process runs until it
+ // blocks or is preempted by a higher priority process.
+ ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice.
+ OTHER // A general time sharing scheduler in which a process decays in priority if it
+ // consumes too much processor before blocking. It reverts to its default priority
+ // when it blocks. Should it fail to run over a 2 second period and it has decayed
+ // then it's boosted one priority level up to a maximum of its default priority.
+ };
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Process
+ /// \~english @par Summary
+ /// - Default Constructor, called when the class is instantiated.
+ /// \~english @param [in] - cpu_assign
+ /// - Assignment information of CPU.
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - initialize all var
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - initialize all var in class as default value
+ /// \~english @see ~Process
+ ////////////////////////////////////////////////////////////////////////////////////
+ Process(int cpu_assign = 0x0);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Process
+ /// \~english @par Summary
+ /// - Copy Constructor
+ /// \~english @param [in] - p_rhs_i
+ /// - Process - Reference to a Process that you want to copy.
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Used to create an object and copy another object to the new object.
+ /// \~english @see ~Process
+ ////////////////////////////////////////////////////////////////////////////////////
+ Process(const Process& p_rhs_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~Process
+ /// \~english @par Summary
+ /// - Destructor function
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - set m_lValidationTag with 0
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Destructor, called when the object is destroyed.\n
+ /// set m_lValidationTag with 0 and kill process.
+ /// \~english @see Process
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~Process();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup operator=
+ /// \~english @par Summary
+ /// - Assignment Operator
+ /// \~english @param [in]
+ /// \~english @retval Process - New Process object
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Assignment Operator, called when one object is assigned to another object.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ Process& operator=(const Process& p_rhs_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetProcessId
+ /// \~english @par Summary
+ /// - get process id
+ /// \~english @param None
+ /// \~english @retval process pid - the process pid of the process running.
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - This method will return to the caller the PosixBasedOS001 Specific Process ID.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ int const GetProcessId(void) {
+ return static_cast<int>(m_tProcessId);
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetCallingArgumentList
+ /// \~english @par Summary
+ /// - This method will set the calling argument list that this object represents
+ /// \~english @param [in] p_pcArgv_i
+ /// - const char *[] - Pointer to array of null terminated parameter list.
+ /// \~english @param [in] p_iArgc_i
+ /// - const int - - Number of arguments in the array passed.
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - put the new arguments into m_strlstArgv
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Set the executable filename first. This is always the 1st argument
+ /// - in the argument list. Then set the argument list for the process
+ /// - which is held in m_strlstArgv.
+ /// - First make sure that the argument list is empty.
+ /// - Once empty, put the new arguments into the list
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetCallingArgumentList(const char *p_pcArgv_i[], const int p_iArgc_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetCallingArgumentList
+ /// \~english @par Summary
+ /// - This method will set the calling argument list that this object represents.
+ /// \~english @param [in] p_strlstParameters_i
+ /// - const StringList& - String list of arguments that will be used to start.
+ /// \~english @retval None.
+ /// \~english @par Preconditions
+ /// - no preconditions.
+ /// \~english @par Change of the internal state
+ /// - set m_strlstArgv with p_strlstParameters_i.
+ /// \~english @par Causes of failures
+ /// - None.
+ /// \~english @par Classification
+ /// - Public.
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - if p_strlstParameters_i is not empty,then clear m_strlstArgv \n
+ /// - and set m_strlstArgv with p_strlstParameters_i.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetCallingArgumentList(const StringList& p_strlstParameters_i);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetExecutableFileName
+/// \~english @par Summary
+/// - Get executable file name
+/// \~english @param None
+/// \~english @retval Pointer
+/// - Points to SS_String object that holds the path and executable file name for this process
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will return a pointer to the executable filename that this object represents
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ const char * const GetExecutableFileName() {
+ return m_strFile.c_str();
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetProcessReturnCode
+ /// \~english @par Summary
+ /// - This function will return the processes exit/return code.
+ /// \~english @param None
+ /// \~english @retval process exit code - Code for the last process to execute
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - set m_iReturnCode with WEXITSTATUS(iProcessReturn)
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - This function will return the processes exit/return code.\n
+ /// This is not the value of ERRNO as returned by GetLastPosixBasedOS001ErrorCode().
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ int GetProcessReturnCode(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetSchedulingPolicy
+ /// \~english @par Summary
+ /// - This method will change the scheduling policy for the process this object represents.
+ /// \~english @param [in] p_eSchedulingPolicy_i
+ /// - const eProcessSchedulingPolicy - Scheduling Policy for this process
+ /// \~english @par
+ /// - eProcessSchedulingPolicy
+ /// \~english @code
+ /// - enum eProcessSchedulingPolicy {
+ /// FIFO, A fixed priority scheduler in which the highest ready process runs until it\n
+ /// blocks or is preempted by a higher priority process.
+ /// ROUND_ROBIN, The same as FIFO, except processes at the same priority level time-slice.
+ /// OTHER A general time sharing scheduler in which a process decays in priority if it\n
+ /// consumes too much processor before blocking. It reverts to its default priority\n
+ /// when it blocks. Should it fail to run over a 2 second period and it has decayed\n
+ /// then it's boosted one priority level up to a maximum of its default priority.
+ /// };
+ /// @endcode
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// -If the result of function is not 0,then set m_iErrorCode with errno
+ /// - else set m_iErrorCode with 0.
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Attempt to change the scheduling policy for the process that this object
+ /// represents. If the change fails, restore the previous settings.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetSchedulingPolicy(
+ const eProcessSchedulingPolicy p_eSchedulingPolicy_i);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetSchedulingPolicy
+/// \~english @par Summary
+/// - Get currently configured scheduling policy
+/// \~english @param None
+/// \~english @retval FIFO - A fixed priority scheduler in which the highest ready process runs until it\n
+/// blocks or is preempted by a higher priority process.
+/// \~english @retval ROUND_ROBIN - The same as FIFO, except processes at the same priority level time-slice.
+/// \~english @retval OTHER - A general time sharing scheduler in which a process decays in priority if it\n
+/// consumes too much processor before blocking. It reverts to its default priority\n
+/// when it blocks. Should it fail to run over a 2 second period and it has decayed\n
+/// then it's boosted one priority level up to a maximum of its default priority.
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - If the result of calling function sched_getscheduler(m_tProcessId) is -1
+/// then set m_iErrorCode with errno
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will return to the caller the currently configured process scheduling policy.
+/// If the result of calling function sched_getscheduler(m_tProcessId) is -1,
+/// then return ROUND_ROBIN.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ eProcessSchedulingPolicy const GetSchedulingPolicy(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetPriority
+ /// \~english @par Summary
+ /// - This method will change the priority for the process this object represents.
+ /// \~english @param [in] p_iPriority_i
+ /// - int - Priority of the process
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - If the result of function sched_setparam(m_tProcessId, &cur_sch_params)\n
+ /// is -1,then set m_iErrorCode with errno, else set m_iErrorCode with 0.
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Using p_iPriority_i to change the priority for the process\n
+ /// this object represents,if the result of function \n
+ /// sched_setparam(m_tProcessId, &cur_sch_params) is -1
+ /// m_iErrorCode will be seted with errno,else be seted with 0
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetPriority(const int p_iPriority_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetPriority Notice:Can't find the body of this function
+ /// \~english @par Summary
+ /// - This method will change the priority for the specified process ID.
+ /// \~english @param [in] p_iPid_i
+ /// - pid_t - PID of the process to change the priority
+ /// \~english @param [in] p_iPriority_i
+ /// - int - Priority of the process
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// -
+ /// \~english @par Causes of failures
+ /// -
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// -none
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetPriority(const pid_t p_iPid_i, const int p_iPriority_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IncreasePriorityByOne
+ /// \~english @par Summary
+ /// - This method will increase the priority for the process this\n
+ /// object represents by one.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Retrieve the current priority of the process. Check to see if already at max.\n
+ /// If so just return. Otherwise increase by one and set the priority...
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void IncreasePriorityByOne(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DecreasePriorityByOne
+ /// \~english @par Summary
+ /// - This method will decrease the priority for the process this object represents by one.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no precondition
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Retrieve the current priority of the process. Check to see if already at minimum.
+ /// If so just return. Otherwise decrease by one and set the priority...
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void DecreasePriorityByOne(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetPriority
+ /// \~english @par Summary
+ /// - This method will return to the caller the currently configured process priority.
+ /// \~english @param None
+ /// \~english @retval int priority - process priority
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - If the result of function sched_getparam(m_tProcessId, &cur_sch_params) is less than -1,\n
+ /// then m_iErrorCode will be seted with errno.
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - If the result of function sched_getparam(m_tProcessId, &cur_sch_params)\n
+ /// is less than -1,will be return -1,else return Currently configured process priority.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ int const GetPriority(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetProcessName
+ /// \~english @par Summary
+ /// - This method will set this objects process name member variable to the provided string value.
+ /// \~english @param [in] p_strProcessName_i
+ /// - SS_String - Process Name to set the m_strProcessName member variable to
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - Using p_strProcessName_i to set m_strProcessName
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - This method will set this objects process name member variable to the provided string value.\n
+ /// If the user of this object wishes to register the name with PosixBasedOS001 OS,\n
+ /// the AttachName() method should be called.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetProcessName(const SS_String& p_strProcessName_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetProcessName
+ /// \~english @par Summary
+ /// - Get process name
+ /// \~english @param None
+ /// \~english @retval SS_String - Process Name
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - This method will return to the caller the registered name of this process.\n
+ /// been registered with the OS, a NULL string will be returned. If a name has not
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ SS_String GetProcessName(void) const {
+ return m_strProcessName;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateProcess
+ /// \~english @par Summary
+ /// - This method will create a process with the executable provided and \n
+ /// mode as a calling parameter.The caller can also provide a list of arguments \n
+ /// that will be provided to the executable at startup.
+ /// \~english @param [in] p_strFile_i
+ /// - SS_String - Path and Filename of executable to create process for
+ /// \~english @param [in] p_strlstArgv_i
+ /// - StringList - List of ARGV values for new process
+ /// \~english @param [in] p_eMode_i
+ /// - eProcessLoadMode - Mode to create and load new process
+ /// \~english @param [in] p_strProcessName_i
+ /// - SS_String - This is the name that will be registered to the OS for this process
+ /// \~english @param [in] p_eSchedulingPolicy_i
+ /// - eProcessSchedulingPolicy
+ /// \~english @param [in] p_iPriority_i
+ /// - int - Priority for this process
+ /// \~english @param [in] unix_user_name
+ /// - char* - unix user name
+ /// \~english @param [in] p_lSpawnFlags_i
+ /// - long - Spawning flags. These are PosixBasedOS001 specific....
+ /// \~english @par
+ /// eProcessLoadMode enum
+ /// \~english @code
+ /// - enum eProcessLoadMode {
+ /// WAIT, //The invoked program is loaded into available memory, is executed,
+ /// //and then the original program resumes execution.
+ /// NOWAIT, // Causes the current program to execute concurrently with the new child process.
+ /// };
+ /// @endcode
+ /// \~english @par
+ /// eProcessSchedulingPolicy enum
+ /// \~english @code
+ /// - enum eProcessSchedulingPolicy {
+ /// FIFO, // A fixed priority scheduler in which the highest ready process runs until it
+ /// // blocks or is preempted by a higher priority process.
+ /// ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice.
+ /// OTHER // A general time sharing scheduler in which a process decays in priority if it
+ /// // consumes too much processor before blocking. It reverts to its default priority
+ /// // when it blocks. Should it fail to run over a 2 second period and it has decayed
+ /// // then it's boosted one priority level up to a maximum of its default priority.
+ /// };
+ /// @endcode
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - set m_iErrorCode with 0
+ /// set m_iReturnCode with 0
+ /// set m_eProcessLoadMode with p_eMode_i;
+ /// set m_strFile with p_strFile_i;
+ /// set m_strProcessName with p_strProcessName_i;
+ /// use the result of function CL_ProcessCreate() to set m_tProcessId
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// -This method will create a PosixBasedOS001 process with the executable provided\n
+ /// and mode as a calling parameter.The caller can also provide a list of arguments\n
+ /// that will be provided to the executable at startup.The calling p_strProcessName \m
+ /// parameter is a textual name that will be associated with the newly created process\n
+ /// by the OS. The process state information will be maintained by this object.\n
+ /// Upon successful creation of the process, the scheduling policy and priority\n
+ /// of the process will be set to the provided values. The user can change these\n
+ /// values through the SetSchedulingPolicy() and SetPriority() method calls.\n
+ /// Using unix_user_name to get uid and gid,set uid and gid when calling\n
+ /// CL_ProcessCreateAttrSetUid() and CL_ProcessCreateAttrSetGid\n
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const StringList& p_strlstArgv_i, // List of ARGV values for new process
+ const eProcessLoadMode p_eMode_i, // Mode to create and load new process
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const eProcessSchedulingPolicy p_eSchedulingPolicy_i, // Scheduling Policy for this process
+ const int p_iPriority_i, // Priority for this process
+ const char* unix_user_name, const long p_lSpawnFlags_i); // Spawning flags. These are PosixBasedOS001 specific.... // NOLINT (runtime/int)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateProcess
+ /// \~english @par Summary
+ /// - This method will create a PosixBasedOS001 process with the executable\n
+ /// provided and mode as a calling parameter.
+ /// \~english @param [in] p_strFile_i
+ /// - SS_String - Path and Filename of executable to create process for
+ /// \~english @param [in] p_strProcessName_i
+ /// - SS_String - This is the name that will be registered to the OS for this process
+ /// \~english @param [in] unix_user_name
+ /// - char* - unix user name
+ /// \~english @param [in] p_lSpawnFlags_i
+ /// - long - Posix Spawning flags. These are PosixBasedOS001 specific
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - The caller can also provide a list of arguments that will be provided\n
+ /// to the executable at startup.The calling p_strProcessName parameter is a textual name\n
+ /// that will be associated with the newly created process by the OS.\n
+ /// The process state information will be maintained by this object.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int)
+ iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags.
+ // These are PosixBasedOS001 specific....
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateProcess
+ /// \~english @par Summary
+ /// - This method will create a process with the executable
+ /// provided and mode as a calling parameter.
+ /// \~english @param [in] p_strFile_i
+ /// - SS_String - Path and Filename of executable to create
+ /// process for
+ /// \~english @param [in] p_strProcessName_i
+ /// - SS_String - This is the name that will be registered to the
+ /// OS for this process
+ /// \~english @param [in] p_iPriority_i
+ /// - int - Priority of process
+ /// \~english @param [in] unix_user_name
+ /// - char* - unix user name
+ /// \~english @param [in] p_lSpawnFlags_i
+ /// - long - Posix Spawning flags. These are PosixBasedOS001
+ /// specific
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - The caller can also provide a list of arguments that will be
+ /// provided\n
+ /// to the executable at startup.The calling p_strProcessName
+ /// parameter is a textual name\n
+ /// that will be associated with the newly created process by
+ /// the OS.\n
+ /// The process state information will be maintained by this
+ /// object.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const int p_iPriority_i, // Priority of this process
+ const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int)
+ iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags.
+ // These are PosixBasedOS001 specific....
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CreateProcess
+/// \~english @par Summary
+/// - This method will create a process with the executable provided and mode as a calling parameter.
+/// \~english @param [in] p_strFile_i
+/// - SS_String - p_strFile_i Path and Filename of executable to create process for
+/// \~english @param [in] unix_user_name
+/// - char* - unix user name
+/// \~english @param [in] p_lSpawnFlags_i
+/// - long - Spawning flags. These are PosixBasedOS001 specific.
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - The caller can also provide a list of arguments that will be provided\n
+/// to the executable at startup.The calling p_strProcessName parameter is a textual name\n
+/// that will be associated with the newly created process by the OS.\n
+/// The process state information will be maintained by this object.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int)
+ iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags.
+ // These are PosixBasedOS001 specific....
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CreateProcess
+/// \~english @par Summary
+/// - This method will create a process with the executable provided and mode as a calling parameter.
+/// \~english @param [in] p_strFile_i
+/// - SS_String - p_strFile_i Path and Filename of executable to create process for
+/// \~english @param [in] p_strProcessName_i
+/// - SS_String - This is the name that will be registered to the OS for this process
+/// \~english @param [in] p_strlstArgv_i
+/// - StringList - List of ARGV values for new process
+/// \~english @param [in] unix_user_name
+/// - char* - unix user name
+/// \~english @param [in] p_lSpawnFlags_i
+/// - long - Spawning flags. These are PosixBasedOS001 specific.
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - The caller can also provide a list of arguments that will be provided\n
+/// to the executable at startup.The calling p_strProcessName parameter is a textual name\n
+/// that will be associated with the newly created process by the OS.\n
+/// The process state information will be maintained by this object.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const StringList& p_strlstArgv_i, // List of ARGV values for new process
+ const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int)
+ iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags.
+ // These are PosixBasedOS001 specific....
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CreateProcess
+/// \~english @par Summary
+/// - This method will create a process with the executable provided and mode as a calling parameter.
+/// \~english @param [in] p_strFile_i
+/// - SS_String - Path and Filename of executable to create process for
+/// \~english @param [in] p_strProcessName_i
+/// - SS_String - This is the name that will be registered to the OS for this process
+/// \~english @param [in] p_iPriority_i
+/// - int - Priority for this process
+/// \~english @param [in] p_strlstArgv_i
+/// - StringList - List of ARGV values for new process
+/// \~english @param [in] unix_user_name
+/// - char* - unix user name
+/// \~english @param [in] p_lSpawnFlags_i
+/// - long - Spawning flags.These are PosixBasedOS001 specific.
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - The caller can also provide a list of arguments that will be provided\n
+/// to the executable at startup.The calling p_strProcessName parameter is a textual name\n
+/// that will be associated with the newly created process by the OS.\n
+/// The process state information will be maintained by this object.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const int p_iPriority_i, // Priority for this process
+ const StringList& p_strlstArgv_i, // List of ARGV values for new process
+ const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int)
+ iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags.
+ // These are PosixBasedOS001 specific....
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateProcess
+ /// \~english @par Summary
+ /// - This method will create a process with the executable provided and mode as a calling parameter.
+ /// \~english @param [in] p_strFile_i
+ /// - SS_String - Path and Filename of executable to create process for
+ /// \~english @param [in] c_argv
+ /// - char - This is the argument that will be registered to the OS for this process
+ /// \~english @param [in] environment_string
+ /// - char - enviroment for this process
+ /// \~english @param [in] cl_attr
+ /// - CL_ProcessAttr_t - List of ARGV values for new process
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - The caller can also provide a list of arguments that will be provided\n
+ /// that will be associated with the newly created process by the OS.\n
+ /// The process state information will be maintained by this object.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String* p_str_file, char* const * c_argv,
+ char* environment_string, const CL_ProcessAttr_t *cl_attr);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CreateProcessWait
+/// \~english @par Summary
+/// - This method will create a process with the executable provided.
+/// \~english @param [in] p_strFile_i
+/// - SS_String - Path and Filename of executable to create process for
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will create a process with the executable provided.\n
+/// The process state information will be maintained by this object.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcessWait(const SS_String& p_strFile_i); // Path and Filename of executable to create process for
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CreateProcessWait
+/// \~english @par Summary
+/// - This method will create a PosixBasedOS001 process with the executable provided.
+/// \~english @param [in] p_strFile_i
+/// - SS_String - Path and Filename of executable to create process for
+/// \~english @param [in] p_strlstArguments_i
+/// - StringList - List of process calling arguments
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will create a PosixBasedOS001 process with the executable provided.\n
+/// The process state information will be maintained by this object.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcessWait(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const StringList& p_strlstArguments_i); // List of process calling arguments
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup KillProcess
+/// \~english @par Summary
+/// - This method will send the specified signal to the process represented by this object
+/// \~english @param [in] signal
+/// - int - signal
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - Intialize the objects m_iErrorCode member variable to 0
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will send the specified signal to the process represented by this object.\n
+/// All variables associated with this object will be initialized to a know value.\n
+/// If this process has a name registered with the OS, that name will be removed.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void KillProcess(int signal = SIGKILL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DoesProcessExist
+/// \~english @par Summary
+/// -Check if the process existed
+/// \~english @param None
+/// \~english @retval TRUE - Process Exists
+/// \~english @retval FALSE - Process does not exist
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// -None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will return a BOOLean indicating whether this process exists.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+ BOOL DoesProcessExist(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DisableAutoKill
+/// \~english @par Summary
+/// -none
+/// \~english @param None
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - set m_fAutoKill as FALSE
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will disable the Auto Kill function in the destructor,\n
+/// thus letting the process whom this object represents continue running.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void DisableAutoKill(void) {
+ m_fAutoKill = FALSE;
+ }
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EnableAutoKill
+/// \~english @par Summary
+/// - Enable the Auto Kill
+/// \~english @param None
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - set m_fAutoKill as TRUE
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will Enable the Auto Kill function in the destructor,\n
+/// thus killing the process whom this object represents.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void EnableAutoKill(void) {
+ m_fAutoKill = TRUE;
+ }
+
+ private:
+ // Class Data Members
+ //---------------------------------------------
+
+ long m_lValidationTag; // Used to check if this is a valid // NOLINT (runtime/int)
+ // object or not.
+
+ int m_cpu_assign;
+ pid_t m_tProcessId; // This is the process ID for this process. All command, control,
+ // and status gathering will use this ID.
+ eProcessLoadMode m_eProcessLoadMode; // This is the process load mode provided by the caller when this
+ // process was created.
+ SS_String m_strFile; // This is the executable path and file name of this process
+ StringList m_strlstArgv; // This is the calling parameter Argv list provided by the caller.
+ SS_String m_strProcessName; // This is the name that was registered to the OS for process identification
+
+ int m_iErrorCode; // This was the returned PosixBasedOS001 error code for the last call. The programmer
+ // can look at this error code if an error was detected and an
+ // exception was thrown.
+ BOOL m_fAutoKill; // Used to indicate to destructor to kill the process whom this object
+ // represents on exit.
+ int m_iReturnCode;
+
+ //////////////////////////////////////////////////////////////////////
+ /// Copy
+ ///
+ /// Copies data members from the specified object to this object.
+ /// No attempt is made to free dynamically allocated objects within
+ /// this object (you must do that before calling this function).
+ ///
+ ///////////////////////////////////////////////////////////////////////
+ void Copy(const Process& p_rhs_i);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ConvertToPosixBasedOS001SchedularPolicy
+ /// This method will return to the caller the equivalent PosixBasedOS001 schedular policy for the process
+ /// that this object represents
+ ///
+ ///
+ /// Calling Arguments:
+ /// Scheduling Policy
+ ///
+ /// \return policy
+ /// FIFO, A fixed priority scheduler in which the highest ready process runs until it
+ /// blocks or is preempted by a higher priority process.
+ /// ROUND_ROBIN, The same as FIFO, except processes at the same priority level time-slice.
+ /// OTHER A general time sharing scheduler in which a process decays in priority if it
+ /// consumes too much processor before blocking. It reverts to its default priority
+ /// when it blocks. Should it fail to run over a 2 second period and it has decayed
+ /// then it's boosted one priority level up to a maximum of its default priority.
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////
+ int const ConvertToPosixBasedOS001SchedularPolicy(
+ const eProcessSchedulingPolicy p_eSchedulingPolicy_i);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ConvertFromPosixBasedOS001SchedularPolicy
+ ///
+ /// This method will return to the caller the eProcessSchedulingPolicy based on the PosixBasedOS001 schedular
+ /// policy for the process that this object represents
+ ///
+ ///
+ /// Calling Arguments:
+ /// PosixBasedOS001 Scheduling Policy
+ ///
+ /// \return policy
+ /// FIFO, A fixed priority scheduler in which the highest ready process runs until it
+ /// blocks or is preempted by a higher priority process.
+ /// ROUND_ROBIN, The same as FIFO, except processes at the same priority level time-slice.
+ /// OTHER A general time sharing scheduler in which a process decays in priority if it
+ /// consumes too much processor before blocking. It reverts to its default priority
+ /// when it blocks. Should it fail to run over a 2 second period and it has decayed
+ /// then it's boosted one priority level up to a maximum of its default priority.
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////
+ eProcessSchedulingPolicy const ConvertFromPosixBasedOS001SchedularPolicy(
+ const int p_iPosixBasedOS001chedulingPolicy_i);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemServicesIf
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \brief Check environment variable MOCK_LIBRARY where Mock Library Name to set in LD_PRELOAD is set
+ /// and output character string to set in LD_PRELOAD if there is setting.
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void CheckLdPreLoad(SS_String *process_path, char *environment_string);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemServicesIf
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \brief Acquire the character string of the environment variable and set it in String Vector
+ /// and return in a pointer of Vector.
+ /// \return vector<SS_String> pointer
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ std::vector<SS_String> *GetEnvironVector(void);
+// ----------------------------------------
+// ---------------- End -------------------
+};
+#endif // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/interface_unified/library/include/system_service/ss_system_timer.h b/systemservice/interface_unified/library/include/system_service/ss_system_timer.h
new file mode 100755
index 0000000..f95d1f9
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_system_timer.h
@@ -0,0 +1,670 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// brief This file supports a generic timer abstraction.
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ss_system_timer.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_manager
+ * @ingroup system_service
+ * @{
+ */
+
+
+#ifndef SS_SYSTEM_TIMER_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_TIMER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <list>
+#include <map>
+
+
+const PCSTR TIMER_SERVICE_NAME = "TIMER";
+
+
+/**
+ * @class Timer
+ * \~english @brief Timer
+ * \~english @par Brief Introduction
+ * Class to provide Timer function
+ *
+ */
+class Timer {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Timer
+ /// \~english @par Summary
+ /// Default constructor of Timer class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// To generate a Timer class, and initialize member variables. \n
+ /// After the constructor, be sure to call the Initialize. \n
+ /// \~english @see ~Timer, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ Timer();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Timer
+ /// \~english @par Summary
+ /// Constructor of Timer class.
+ /// \~english @param [in] hdl
+ /// HANDLE - HANDLE for Application
+ /// \~english @param [in] id
+ /// UI_32 - Timer ID corresponding to the callback function
+ /// \~english @param [in] CbFn
+ /// CbFuncPtr - Pointer to a callback function to be called when the timer expires
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a Timer class. \n
+ /// To initialize timer information structure of the member variables. \n
+ /// To initialize the member variables of the class with an argument. Therefore, there is no need to call the
+ /// Initialize() function when using this constructor.
+ /// \~english @see ~Timer, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ Timer(HANDLE hdl, UI_32 id, CbFuncPtr CbFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~Timer
+ /// \~english @par Summary
+ /// Destructor of Timer class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a Timer class. \n
+ /// If the initialization is complete state, to end by calling the Shutdown().
+ /// \~english @see Timer
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~Timer();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Initialize
+ /// \~english @par Summary
+ /// Initialization of the Timer class.
+ /// \~english @param [in] hApp
+ /// HANDLE - HANDLE for Application
+ /// \~english @param [in] id
+ /// UI_32 - Timer ID corresponding to the callback function
+ /// \~english @param [in] CbFn
+ /// CbFuncPtr - Pointer to a callback function to be called when the timer expires
+ /// \~english @retval TRUE Initialization success
+ /// \~english @retval FALSE Initialization failed
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Handle(hApp) that has been specified by the argument is NULL. [FALSE]
+ /// - Timer ID(id) that has been specified by the argument is 0. [FALSE]
+ /// - Pointer to a callback function that has been specified by the argument is NULL. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To initialize the member variables of the following.
+ /// - HANDLE for Application
+ /// - Timer information structure
+ /// - Pointer to a callback function
+ /// - HANDLE of message queue
+ /// - Timer Object
+ /// \~english @par
+ /// A timer class to initialization completion state.
+ /// \~english @see ~Timer, Shutdown
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Initialize(HANDLE hApp, UI_32 id, CbFuncPtr CbFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Reinitialize
+ /// \~english @par Summary
+ /// - Reinitialize the timer by specifying a timer value information
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to reinitialize
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - set m_tTi.iCmd with id
+ /// - using the result of function McOpenSender(FrameworkunifiedGetAppName(m_hApp)) to set m_hSnd
+ /// - create a timer and give the handle to m_hTmr
+ /// - set m_bInit with TRUE
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Method only
+ /// \~english @par Detail
+ /// Reinitialize the timer by specifying a timer value information, \n
+ /// create a new timer if it is not initialize.
+ /// \~english @see Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ void Reinitialize(UI_32 id);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Shutdown
+ /// \~english @par Summary
+ /// The end of the Timer class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// In the case of initialization completion state, it is completed by the following process.\n
+ /// - Stop the Timer
+ /// - Delete Timer Object
+ /// - Set NULL to a timer object variable
+ /// - Close message queue
+ /// - Set NULL to a message queue HANDLE variable
+ /// - The timer class to uninitialized.
+ /// \~english @par
+ /// \nIf you want to re-use this timer, call again Initialize() function.
+ /// \~english @see Timer, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ void Shutdown();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetTime
+ /// \~english @par Summary
+ /// Set the timer value information.
+ /// \~english @param [in] ss
+ /// UI_32 - Timeout expiration time(sec)
+ /// \~english @param [in] sms
+ /// UI_32 - Timeout expiration time(nano sec)
+ /// \~english @param [in] rs
+ /// UI_32 - Timeout expiration time at the time of repeat(sec)
+ /// \~english @param [in] rms
+ /// UI_32 - Timeout expiration time at the time of repeat(nano sec)
+ /// \~english @retval TRUE Setting success
+ /// \~english @retval FALSE Setting failed
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Not been initialized. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Set a timer value information specified by the argument to the timer information structure.
+ /// \~english @see Timer
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL SetTime(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Start
+ /// \~english @par Summary
+ /// The start of the timer by specifying a timer value information.
+ /// \~english @param [in] ss
+ /// UI_32 - Timeout expiration time(sec)
+ /// \~english @param [in] sms
+ /// UI_32 - Timeout expiration time(nano sec)
+ /// \~english @param [in] rs
+ /// UI_32 - Timeout expiration time at the time of repeat(sec)
+ /// \~english @param [in] rms
+ /// UI_32 - Timeout expiration time at the time of repeat(nano sec)
+ /// \~english @retval TRUE Stop success
+ /// \~english @retval FALSE Stop failed
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Not been initialized. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method only
+ /// \~english @par Detail
+ /// In the case of initialization completion state, start the timer. \n
+ /// After timer start, again, if you start the timer, it does not work guarantee.
+ /// \~english @see Stop
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Start(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Start
+ /// \~english @par Summary
+ /// Stop the timer.
+ /// \~english @param None
+ /// \~english @retval TRUE Stop success
+ /// \~english @retval FALSE Stop failed
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// - Set the timeout value in SetTime().
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Not been initialized. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method only
+ /// \~english @par Detail
+ /// In the case of initialization completion state, start the timer. \n
+ /// After timer start, again, if you start the timer, it does not work guarantee.
+ /// \~english @see SetTime, Stop
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Start();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Stop
+ /// \~english @par Summary
+ /// Stop the timer.
+ /// \~english @param None
+ /// \~english @retval TRUE Stop success
+ /// \~english @retval FALSE Stop failed
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// - The timer has been started
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Not been initialized. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method only
+ /// \~english @par Detail
+ /// In the case of initialization completion state, stop the timer. \n
+ /// After the timer has stopped, again, if you stop the timer, it does not do anything to just processing
+ /// Internal error occurs.
+ /// \~english @see Start
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Stop();
+
+ private:
+ BOOL m_bInit; /// flag that indicated if the class has been initialized or not
+ HANDLE m_hApp; /// refs to an applications hApp handle
+ HANDLE m_hSnd; /// refs to applications message queue
+ HANDLE m_hTmr; /// refs to a timer handle
+ NSTimerInfo m_tTi; /// timer parameters
+ CbFuncPtr m_CbFn; /// pointer to the callback method
+};
+
+/** @}*/ // end of Timer
+/** @}*/ // end of system_manager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
+
+/**
+ * @class TimerCtrl
+ * \~english @brief TimerCtrl
+ * \~english @par Brief Introduction
+ * Class to provide TimerCtrl function
+ *
+ */
+class TimerCtrl {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup TimerCtrl
+ /// \~english @par Summary
+ /// Default Constructor, called when the class is instantiated.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ ///
+ /// \~english @par Change of the internal state
+ /// - set m_hApp as NULL,m_nTimersMax as DEFAULT_NTIMERS
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// To generate a TimerCtrl class. \n
+ /// After the constructor, be sure to call the Initialize. \n
+ /// \~english @see ~TimerCtrl, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ TimerCtrl();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup TimerCtrl
+ /// \~english @par Summary
+ /// Constructor, called when the class is instantiated.
+ /// \~english @param [in] ntimers
+ /// UI_32 - number of timers objects in the pool
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ ///
+ /// \~english @par Change of the internal state
+ /// - initialize var m_hApp and m_nTimersMax
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// To generate a TimerCtrl class. \n
+ /// After the constructor, be sure to call the Initialize. \n
+ /// \~english @see ~TimerCtrl, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ TimerCtrl(UI_32 ntimers); // NOLINT (runtime/explicit)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Initialize
+ /// \~english @par Summary
+ /// Initialize the class after instantiation.
+ /// \~english @param [in] hApp
+ /// HANDLE - HANDLE to you applications hApp.
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ ///
+ /// \~english @par Change of the internal state
+ /// - initialize var m_hApp and m_aTimers
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// The function is to initialize the member val of the class with param hApp,\n
+ /// if hApp is not null, then set m_hApp with hApp and initialize m_aTimers.
+ /// \~english @see ~TimerCtrl, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ VOID Initialize(HANDLE hApp);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Shutdown
+ /// \~english @par Summary
+ /// handle something when shut down timer control.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize()..
+ /// \~english @par Change of the internal state
+ /// - Clear m_aTimer,shut down timer in m_rTimer and delete it.clear m_rTimer.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Completely shuts down the timer control, this method calls Stop, cleans up. You must call
+ /// Initialize again if you want reuse this class.
+ /// \~english @see ~TimerCtrl, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ VOID Shutdown();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateTimer
+ /// \~english @par Summary
+ /// get a timer control from pool
+ /// \~english @param [in] CbFn
+ /// CbFn - Pointer to a callback function to be called when the timer expires
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - insert one Timer to m_rTimers
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// gets a the first id from m_aTimers if m_aTimer is not empty, using this id to create a timer,\n
+ /// put this timer into m_rTimers,and return the id.
+ /// \~english @see DeleteTimer
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 CreateTimer(CbFuncPtr CbFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DeleteTimer
+ /// \~english @par Summary
+ /// delete a timer from m_rTimers using the param.
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to delete
+ /// \~english @retval Timer id -If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - delete one Timer to m_rTimers that id is the param.\n
+ /// and put id of the timer into m_aTimers.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// delete your timer and returns it's id to the pool of timers.
+ /// \~english @see CreateTimer
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 DeleteTimer(UI_32 id);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetTimer
+ /// \~english @par Summary
+ /// Sets the timer timeout values
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to set
+ /// \~english @param [in] ss
+ /// UI_32 - Start time in seconds
+ /// \~english @param [in] sms
+ /// UI_32 - Start time in milliseconds
+ /// \~english @param [in] rs
+ /// UI_32 - Repeat time in seconds
+ /// \~english @param [in] rms
+ /// UI_32 - Repeat time in milliseconds
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - set the timer infomation in m_rTimers with ss, sms, rs, rms
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// using ss, sms, rs, rms to set the timer infomation, timer'is is param.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 SetTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StartTimer
+ /// \~english @par Summary
+ /// Sets the timer timeout values and starts the timer.
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to start
+ /// \~english @param [in] ss
+ /// UI_32 - Timeout expiration time(sec)
+ /// \~english @param [in] sms
+ /// UI_32 - Timeout expiration time(nano sec)
+ /// \~english @param [in] rs
+ /// UI_32 - Timeout expiration time at the time of repeat(sec)
+ /// \~english @param [in] rms
+ /// UI_32 - Timeout expiration time at the time of repeat(nano sec)
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// In the case of initialization completion state, start the timer that id is the first param. \n
+ /// After timer start, again, if you start the timer, it does not work guarantee.
+ /// \~english @see Stop
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 StartTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StartTimerMulti
+ /// \~english @par Summary
+ /// The start of the timer by specifying a timer value information and reinitialize timer id.
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to start
+ /// \~english @param [in] ss
+ /// UI_32 - Timeout expiration time(sec)
+ /// \~english @param [in] sms
+ /// UI_32 - Timeout expiration time(nano sec)
+ /// \~english @param [in] rs
+ /// UI_32 - Timeout expiration time at the time of repeat(sec)
+ /// \~english @param [in] rms
+ /// UI_32 - Timeout expiration time at the time of repeat(nano sec)
+ /// \~english @param [in] subId
+ /// UI_32 - using subId to reinitialize timer id
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Finds the timer by specifying, shut down the timer, \n
+ /// and reinitialize it using new id of this timer and starts the timer
+ /// \~english @see Stop
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 StartTimerMulti(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms, UI_32 subId);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StartTimer
+ /// \~english @par Summary
+ /// Start the timer.
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to start
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is in not m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// - Set the timeout value in SetTimer().
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// In the case of initialization completion state, \n
+ /// start of the timer by specifying a timer value information.
+ /// \~english @see SetTime, Stop
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 StartTimer(UI_32 id);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StopTimer
+ /// \~english @par Summary
+ /// Stop the timer.
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to stop
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// - Set the timeout value in SetTimer().
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// In the case of start completion state, \n
+ /// stop of the timer by specifying a timer value information
+ /// \~english @see SetTimer, StartTimer
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 StopTimer(UI_32 id);
+
+ private:
+ HANDLE m_hApp; ///
+ UI_32 m_nTimersMax; ///
+ std::list<UI_32> m_aTimers; ///
+ std::map<UI_32, Timer*> m_rTimers; ///
+};
+
+
+#endif /* SS_SYSTEM_TIMER_H_ */ // NOLINT (build/header_guard)
diff --git a/systemservice/interface_unified/library/include/system_service/ss_system_types.h b/systemservice/interface_unified/library/include/system_service/ss_system_types.h
new file mode 100755
index 0000000..adcaf2b
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_system_types.h
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServicesIf
+/// \brief This file supports string vector type definitions.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef SS_SYSTEM_TYPES_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_TYPES_H_
+
+#include <vector>
+#include <string>
+
+
+typedef std::string SS_String;
+typedef std::vector< std::string > StringList;
+typedef std::vector< std::string >::iterator StringListIter;
+
+#endif /* SS_SYSTEM_TYPES_H_ */ // NOLINT (build/header_guard)
diff --git a/systemservice/interface_unified/library/include/system_service/ss_templates.h b/systemservice/interface_unified/library/include/system_service/ss_templates.h
new file mode 100755
index 0000000..581e616
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_templates.h
@@ -0,0 +1,303 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// This file supports templates for high use common tasks.
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ss_templates.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef __SS_TEMPLATES_H__ // NOLINT (build/header_guard)
+#define __SS_TEMPLATES_H__
+
+#include <stdio.h>
+#include <errno.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <map>
+#include "system_service/ss_system_types.h"
+#include "system_service/ss_string_maps.h"
+
+#ifndef ZONE_ERR
+#define ZONE_ERR ZONEMASK(31)
+#endif
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ReadMsg
+/// \~english @par Summary
+/// check the data information of msg.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE Application
+/// \~english @param [in] Data
+/// T - The reference to the Data memory location
+/// \~english @param [in] f_eRetrieveMethod
+/// ESMRetrieveTypes - The msg retrieval method ( release or retain )
+/// \~english @par
+/// T template type
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Preconditions
+/// -
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - data'size is not corruct. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail
+/// Check hApp ptr, msg size, msg reception, read msg if all ok
+/// \~english @par
+/// eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Fail
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+template <typename T> EFrameworkunifiedStatus ReadMsg(
+ HANDLE hApp,
+ T &Data, // NOLINT (runtime/references)
+ ESMRetrieveTypes f_eRetrieveMethod = eSMRRelease) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if ( NULL == hApp ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: NULL = hApp");
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ } else if (sizeof(Data) != FrameworkunifiedGetMsgLength(hApp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__
+ , " Error: message buffer sizes mismatch: expected %ld, received %d"
+ , sizeof(Data), FrameworkunifiedGetMsgLength(hApp));
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else if ( eFrameworkunifiedStatusOK != (l_eStatus =
+ FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&Data, sizeof(Data), f_eRetrieveMethod))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__
+ , " Error: FrameworkunifiedGetMsgDataOfSize() errored: 0x%x", l_eStatus);
+ }
+ return l_eStatus;
+} // End of template <typename T> EFrameworkunifiedStatus ReadMsg ()
+ /* Copy & paste easy-to-use little 't' template
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if ( eFrameworkunifiedStatusOK != ( l_eStatus = ReadMsg<T>
+ ( hApp
+ , Data )))
+ {
+ LOG_ERROR("ReadMsg()");
+ }
+ else
+ */
+
+//****************************************************************************
+/*!
+ \def LOG_ERROR(pStr)
+ Log pStr and l_eStatus
+ */
+#define LOG_ERROR(pStr) \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__ \
+ , " Error: %s errored: %d/'%s'" \
+ , pStr \
+ , l_eStatus \
+ , GetStr(static_cast<EFrameworkunifiedStatus>(l_eStatus)).c_str());
+
+//****************************************************************************
+/*!
+ \def LOG_ERROR(pStr)
+ Log pStr and l_eStatus
+ */
+#define LOG_SUCCESS(pStr) \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s successful", pStr);
+
+//****************************************************************************
+/*!
+ \def LOG_STATUS(l_eStatus,pStr)
+ Log pStr and success or failure. Include l_eStatus when not successful.
+ */
+#define LOG_STATUS(l_eStatus, pStr) \
+ if ( eFrameworkunifiedStatusOK != l_eStatus ) \
+ { \
+ LOG_ERROR(pStr); \
+ } \
+ else \
+ { \
+ LOG_SUCCESS(pStr); \
+ } // End of #define LOG_STATUS(l_eStatus,pStr)
+
+//****************************************************************************
+/*!
+ \def CALL_AND_LOG_STATUS(fnc)
+ Call the function and log the returned EFrameworkunifiedStatus.
+ */
+#define CALL_AND_LOG_STATUS(fnc) \
+ l_eStatus = (fnc); \
+ LOG_STATUS(l_eStatus, #fnc)
+ // End of #define CALL_AND_LOG_STATUS(fnc)
+
+//****************************************************************************
+/*!
+ \def LOG_STATUS_IF_ERRORED(l_eStatus, pStr)
+ Log pStr on failure, including EFrameworkunifiedStatus.
+ */
+#define LOG_STATUS_IF_ERRORED(l_eStatus, pStr) \
+ if ( eFrameworkunifiedStatusOK != l_eStatus ) \
+ { \
+ LOG_ERROR(pStr); \
+ } // End of #define LOG_STATUS_IF_ERRORED(l_eStatus,pStr)
+
+//****************************************************************************
+/*!
+ \def CALL_AND_LOG_STATUS_IF_ERRORED(fnc)
+ Call the function and log the returned EFrameworkunifiedStatus on failure.
+ */
+#define CALL_AND_LOG_STATUS_IF_ERRORED(fnc) \
+ l_eStatus = (fnc); \
+ LOG_STATUS_IF_ERRORED(l_eStatus, #fnc)
+ // End of #define CALL_AND_LOG_STATUS_IF_ERRORED(fnc)
+
+//****************************************************************************
+/*!
+ \def MAP_ENTRY( f_map, f_enum )
+ Simplify initializing string map entry.
+
+ Use to set a map entry's key and value to the specified enum and the enum's
+ literal text ( i.e., stringified ) equivalent.
+ */
+#define MAP_ENTRY(f_map, f_enum) \
+ f_map[ f_enum ] = #f_enum
+
+//****************************************************************************
+/*!
+ \def INTERFACEUNIFIEDLOG_RECEIVED_FROM
+ Log whom we received message or notification from.
+
+ Use this macro to ensure that the string "Received from" is uniformly
+ logged; this string can be grepped on to find when/where callback functions
+ were invoked.
+ */
+#define INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp) \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from %s", FrameworkunifiedGetMsgSrc(hApp))
+
+//****************************************************************************
+/*!
+ \def INTERFACEUNIFIEDLOG_WHEN_COMPILED
+ Log when this file was compiled.
+
+ Useful when overlaying a delivered object file ( from an official build ) with
+ a debug-built obj file - verifies that the debug file did indeed get loaded.
+ */
+#define INTERFACEUNIFIEDLOG_WHEN_COMPILED \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s was compiled at %s @ %s", \
+ __FILE__, __DATE__, __TIME__);
+
+
+#define SS_ASERT(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT"); \
+ }
+
+#define SS_ASERT_ERRNO(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT %d:%s", errno, strerror(errno)); \
+ }
+
+#define SS_ASERT_LOG(x, fmt, ...) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT " fmt, ## __VA_ARGS__); \
+ }
+
+#define SS_STATIC_ASERT(expr) \
+ { \
+ char STATIC_ASSERTION_FAILED[(expr) ? 1 : -1]; \
+ (void)STATIC_ASSERTION_FAILED; \
+ }
+
+/**
+ * @class EnumStringMap
+ * \~english @brief EnumStringMap
+ * \~english @par Brief Introduction
+ * Class to provide EnumStringMap template function
+ *
+ */
+template <typename enumT, void(*fp)(std::map<enumT, SS_String> & m_strMap)> class EnumStringMap { // NOLINT (runtime/references)
+public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup EnumStringMap
+ /// \~english @par Summary
+ /// Default constructor of EnumStringMap class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a EnumStringMap class, and initialize member variables. \n
+ /// After the constructor, be sure to call the Initialize. \n
+ /// \~english @see ~EnumStringMap, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ EnumStringMap() {
+ (*fp)(m_strMap);
+ }
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~EnumStringMap
+ /// \~english @par Summary
+ ///
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a EnumStringMap object. \n
+ /// \~english @see EnumStringMap
+ ////////////////////////////////////////////////////////////////////////////////////
+ ~EnumStringMap() {}
+ SS_String GetStr( enumT f_enum) { return m_strMap[ f_enum ];}
+private:
+ std::map<enumT, SS_String> m_strMap;
+};
+// End of template <typename enumT, void(*fp)(std::map<enumT, SS_String> & m_strMap)> class EnumStringMap
+
+#endif /* __SS_TEMPLATES_H__ */ // NOLINT (build/header_guard)
+
diff --git a/systemservice/interface_unified/library/include/system_service/ss_test_clients.h b/systemservice/interface_unified/library/include/system_service/ss_test_clients.h
new file mode 100755
index 0000000..a50e61f
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_test_clients.h
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_test_clients.h
+/// \brief This file supports test client queue names.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_TC_SERVICES_H_ // NOLINT (build/header_guard)
+#define SS_TC_SERVICES_H_
+
+
+#define TC_Power "PwrTestClient"
+#define TC_SysManager "SMTestClient"
+
+#endif /* SS_TC_SERVICES_H_ */ // NOLINT (build/header_guard)
diff --git a/systemservice/interface_unified/library/include/system_service/ss_version.h b/systemservice/interface_unified/library/include/system_service/ss_version.h
new file mode 100755
index 0000000..856f334
--- /dev/null
+++ b/systemservice/interface_unified/library/include/system_service/ss_version.h
@@ -0,0 +1,33 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup sys_resource
+/// \file ss_version.h
+/// \brief This file supports System Manager version number management.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_VERSION_H__ // NOLINT (build/header_guard)
+#define SS_VERSION_H__
+
+#define MAJORNO 0x01
+#define MINORNO 0x00
+#define REVISION 0x01
+
+#endif // SS_VERSION_H__ // NOLINT (build/header_guard)
+
+
diff --git a/systemservice/interface_unified/library/src/libSS_SystemIfUnified.ver b/systemservice/interface_unified/library/src/libSS_SystemIfUnified.ver
new file mode 100755
index 0000000..7a646f2
--- /dev/null
+++ b/systemservice/interface_unified/library/src/libSS_SystemIfUnified.ver
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libNS_FrameworkUnified version script
+#
+{
+ global:
+ ### .text section ###
+ extern "C++" {
+ AttachCallbackToSystemManager*;
+ DetachCallbacksFromInterfaceunifiedDispatcher*;
+ DetachParentCallbacksFromInterfaceunifiedDispatcher*;
+ GetStr*;
+ GetSystemManagerSessionHandle*;
+ SendInterfaceunifiedOnStopResponseToSystemManager*;
+ GetInterfaceunifiedOnStartExtInfo*;
+ GetInterfaceunifiedOnStopExtInfo*;
+ OnSystemManagerDebugDump*;
+ FrameworkunifiedSSFrameworkInterface*;
+ RegisterSMSessionAckCallback*;
+ RemountPartition*;
+ SendBootModeSetRequestToSystemManager*;
+ SetDataResetModeToSystemManager*;
+ SetProgUpdateStateToSystemManager*;
+ SendCANLoggingRequestToSystemManager*;
+ SendCpuResetRequestToSystemManager*;
+ SendDTCLoggingRequestToSystemManager*;
+ SendDebugDumpResponseToSystemManager*;
+ SendDiagLoggingRequestToSystemManager*;
+ SendEelExportRequestToSystemManager*;
+ SendLogArtifactRequestToSystemManager*;
+ SendLogCompleteRequestToSystemManager*;
+ SendLogStartRequestToSystemManager*;
+ SendInterfaceunifiedEmmcLogsRequestToSystemManager*;
+ SendClearLogsRequestToSystemManager*;
+ SendShutdownToSystemManager*;
+ SendStartupConfirmationToSystemManager*;
+ SendSystemModeRequestToSystemManager*;
+ SendInitCompReportToSystemManager*;
+ Send_CWORD56_HeartBeatRequestToSystemManager*;
+ SendVarCodeDataToSystemManager*;
+ SendWakeUpToSystemManager*;
+ SetBootLoaderInfoRequestToSystemManager*;
+
+ GetBootLoaderInfoRequestToSystemManager*;
+
+ SetWakeupOrderToSystemManager*;
+ SetNextWakeupTypeToSystemManager*;
+ Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar*;
+ SendUserInvokedLoggingRequestToSystemManager*;
+ RegisterBootMicroLogRequestCb*;
+ SendBootMicroResetNotificationToSystemManager*;
+ SendBootMicroLogResponseToSystemManager*;
+ SS_ConvLastInfoToOrder*;
+ DeviceDetectionServiceIf::*;
+ LoggerServiceIf::*;
+ Process::*;
+ Timer::*;
+ TimerCtrl::*;
+ };
+ local:
+ *;
+};
+
diff --git a/systemservice/interface_unified/library/src/makefile_PosixBasedOS001 b/systemservice/interface_unified/library/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..68fa52e
--- /dev/null
+++ b/systemservice/interface_unified/library/src/makefile_PosixBasedOS001
@@ -0,0 +1,180 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = SS_PowerServiceIf
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+##COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+ifdef DYNAMIC_OFF
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC_OFF
+# For a dynamic library
+ $(SLIB_CMD)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
+
diff --git a/systemservice/interface_unified/library/src/ss_devicedetection_service_ifc.cpp b/systemservice/interface_unified/library/src/ss_devicedetection_service_ifc.cpp
new file mode 100755
index 0000000..1f68df6
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_devicedetection_service_ifc.cpp
@@ -0,0 +1,673 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_DeviceDetection
+/// \brief This file contains service interface functions.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_devicedetection_service_ifc.h"
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <string.h>
+
+#ifdef AGL_STUB
+#else
+#include "dcmd_sim_mmcsd.h"
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#ifdef AGL_STUB
+#else
+#include <sys/dcmd_cam.h>
+#endif
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <linux/cdrom.h>
+#include <asm-generic/param.h>
+
+#include "system_service/ss_services.h"
+#include "system_service/ss_devicedetection_service_protocol.h"
+#include "system_service/ss_devicedetection_service_protocol_local.h"
+#include "system_service/ss_devicedetection_service_notifications.h"
+#include "system_service/ss_devicedetection_service_local.h"
+#include "system_service/ss_devicedetection_service_types_local.h"
+#include "ss_devicedetection_service_if_interfaceunifiedlog.h"
+
+DeviceDetectionServiceIf::DeviceDetectionServiceIf()
+ : m_hApp(NULL),
+ m_hService(NULL),
+ m_hSession(NULL) {
+}
+
+DeviceDetectionServiceIf::~DeviceDetectionServiceIf() {
+ CloseSessionRequest(); // if the session is still connected
+ if ((NULL != m_hApp) && (NULL != m_hService)) {
+ FrameworkunifiedCloseService(m_hApp, m_hService);
+ }
+ m_hService = NULL;
+ m_hSession = NULL;
+ m_hApp = NULL;
+} // LCOV_EXCL_BR_LINE 10:Because destructor
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::NotifyOnDeviceDetectionAvailability(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ // Subscriptions
+ FrameworkunifiedNotificationCallbackHandler
+ g_aryDeviceDetect_Notif_Cbs[] = {
+ // Notifications name, Call back function
+ { NTFY_SS_Device_Detection_Service_Availability, f_pCallBackFn},
+ };
+
+ if (0 != strcmp(SS_DEV_DETECT_SRV, FrameworkunifiedGetAppName(m_hApp))) {
+ // Subscribe and attach call backs to notifications
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedSubscribeNotificationsWithCallback(
+ m_hApp, g_aryDeviceDetect_Notif_Cbs,
+ _countof(g_aryDeviceDetect_Notif_Cbs)))) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error: FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::DetachDeviceDetectionAvailabilityCb() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp) {
+ if (0 != strcmp(SS_DEV_DETECT_SRV, FrameworkunifiedGetAppName(m_hApp))) {
+ // Unsubscribe and detach call backs to notifications
+ if (eFrameworkunifiedStatusOK != (eStatus =
+ FrameworkunifiedUnsubscribeNotificationWithCallback(m_hApp, NTFY_SS_Device_Detection_Service_Availability))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: InterfaceunifiedDetachNotificationCallback Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::NotifyOnOpenSessionAck(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ PROTOCOL_OPEN_SESSION_ACK,
+ f_pCallBackFn))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::DetachOpenSessionAckCb() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ PROTOCOL_OPEN_SESSION_ACK))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedDetachCallbackFromDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::NotifyOnCloseSessionAck(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ PROTOCOL_CLOSE_SESSION_ACK,
+ f_pCallBackFn))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::DetachCloseSessionAckCb() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hApp) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(
+ m_hApp,
+ SS_DEV_DETECT_SRV,
+ PROTOCOL_CLOSE_SESSION_ACK))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedDetachCallbackFromDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::RegisterForDeviceDetectionEvent(
+ SS_DeviceDetectionServerEvents f_eDevDetectEvent, CbFuncPtr f_pCallBackFn,
+ PCSTR pFilepath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ char l_filepathname[FILEPATH_SIZE] = { '\0' };
+ int len = 0;
+
+ if (NULL != pFilepath) {
+ len = strlen(pFilepath);
+ strcpy(l_filepathname, pFilepath); // NOLINT (runtime/printf)
+ }
+
+ if (NULL != m_hSession && NULL != f_pCallBackFn) {
+ if (CheckDetectEvent(f_eDevDetectEvent)) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ f_eDevDetectEvent,
+ f_pCallBackFn, m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+
+ eStatus = FrameworkunifiedSendMsg(m_hSession, SS_REGISTER_DETECT_EVENT,
+ sizeof(SS_DeviceDetectionServerEvents),
+ &f_eDevDetectEvent);
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ f_eDevDetectEvent,
+ f_pCallBackFn, m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+
+ // client registers for the event
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedRegisterEvent(m_hSession, f_eDevDetectEvent))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedRegisterEvents Failed Status:0x%x", eStatus);
+ }
+
+ if (NULL != pFilepath) {
+ eStatus = FrameworkunifiedSendMsg(m_hSession, SS_REGISTER_FILEPATHNAME, len,
+ l_filepathname);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::UnRegisterForDeviceDetectionEvent(
+ SS_DeviceDetectionServerEvents f_eDevDetectEvent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ f_eDevDetectEvent,
+ m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: InterfaceunifiedDetachCallbackToDispatcher Failed Status:0x%x ", eStatus);
+ }
+
+ // client registers for the event
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedUnRegisterEvent(m_hSession, f_eDevDetectEvent))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedUnRegisterEvents Failed Status:0x%x", eStatus);
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(m_hSession, SS_UNREGISTER_DETECT_EVENT,
+ sizeof(SS_DeviceDetectionServerEvents),
+ &f_eDevDetectEvent))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "UnRegister Detect Event[0x%x] Send Error[0x%x]", f_eDevDetectEvent, eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+BOOL DeviceDetectionServiceIf::Initialize(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_eStatus = TRUE;
+
+ if (NULL != hApp) {
+ m_hApp = hApp;
+ } else {
+ l_eStatus = FALSE; // eFrameworkunifiedStatusInvldHandle;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::OpenSessionRequest() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp) {
+ // if the session is there then we need to close it first!
+ if (NULL != m_hService) {
+ CloseSessionRequest();
+ FrameworkunifiedCloseService(m_hApp, m_hService);
+ m_hService = NULL;
+ }
+ BOOL l_bServiceAvailable = FrameworkunifiedIsServiceAvailable(m_hApp);
+ if (FALSE == l_bServiceAvailable) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "DeviceError: Service is unavailable");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // Now open the service.
+ if (l_bServiceAvailable
+ && (NULL != (m_hService = OpenService()))) { // LCOV_EXCL_BR_LINE 8:Because l_bServiceAvailable is always TRUE
+ // [DM: TODO] Check if we need to open a session with some data sent to Server.
+ UI_32 l_pTestData = 1;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedOpenSessionWithData(m_hService,
+ (PVOID) &l_pTestData,
+ sizeof(UI_32)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: FrameworkunifiedOpenSessionWithData Failed");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: FrameworkunifiedOpenService Failed");
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: OpenSessionRequest Failed %X",
+ l_eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+HANDLE DeviceDetectionServiceIf::OpenService() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ HANDLE l_hService = NULL;
+
+ if (NULL == (l_hService = FrameworkunifiedOpenService(m_hApp, SS_DEV_DETECT_SRV))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: FrameworkunifiedOpenService : Failed to open Device Detection Service");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_hService;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::DecodeOpenSessionResponse() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hApp) { // LCOV_EXCL_BR_LINE 8:Because when m_hApp is NULL, m_hService is NULL
+ if (NULL == (m_hSession = FrameworkunifiedGetOpenSessionHandle(m_hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: Error in extracting OpenSessionAck response.");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Logger Session Name: %s, Session Id: %d",
+ FrameworkunifiedGetSessionName(m_hSession), FrameworkunifiedGetSessionId(m_hSession));
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error. m_hService: %p, m_hApp: %p is NULL. Open session handle not acquired,"
+ " l_eStatus: eFrameworkunifiedStatusInvldHandle.", m_hService, m_hApp);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::CloseSessionRequest() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseSession(m_hService, m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedCloseSession Failed");
+ }
+ m_hSession = NULL; // clear our session handle
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+BOOL DeviceDetectionServiceIf::CheckDetectEvent(
+ SS_DeviceDetectionServerEvents f_eDevDetectEvent) {
+ BOOL chkevt = FALSE;
+
+ switch (f_eDevDetectEvent) {
+ case SS_DEV_INFO_ANY_USB_EV:
+ case SS_DEV_DETECT_ANY_USB_EV:
+ case SS_DEV_DETECT_ANY_SD_EV:
+ case SS_DEV_DETECT_ANY_DISC_EV:
+ case SS_DEV_DETECT_ANY_USB_NCM_EV:
+
+ case SS_DEV_DETECT_ANY_USB_DCM_NCM_EV:
+ case SS_DEV_DETECT_ANY_USB__CWORD57__EV:
+ case SS_DEV_DETECT_ANY_USB_ACM_EV:
+ case SS_DEV_DETECT_ANY_USB_DEV_MNG_EV:
+ case SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV:
+ case SS_DEV_DETECT_ANY_USB_DSRC_APP_EV:
+ case SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV:
+ case SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV:
+ case SS_DEV_ERR_USB_OVER_CURRENT_EV:
+ case SS_DEV_DETECT_ANY_USB_MTP_EV:
+ case SS_DEV_INFO_ANY_USB_NOTIFY_EV:
+ case SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV:
+ case SS_DEV_INFO_SD_FORMAT_COMP_EV:
+ case SS_DEV_INFO_ANY_USB_DVDP_EV:
+ chkevt = TRUE;
+ break;
+ default:
+ break;
+ }
+ return chkevt;
+}
+
+static void ReadString(const char *file, char *buf, int len) {
+ int fd;
+ ssize_t r;
+ char *tmp;
+
+ if (file == NULL) { // LCOV_EXCL_BR_LINE 8:Because file is not NULL
+ // LCOV_EXCL_START 8:Because file is not NULL
+ buf[0] = '\0';
+ return;
+ // LCOV_EXCL_STOP
+ }
+
+ fd = open(file, O_RDONLY);
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 6:Because the sequence at the time of open failure cannot be passed
+ // LCOV_EXCL_START 6:Because the sequence at the time of open failure cannot be passed
+ buf[0] = '\0';
+ return;
+ // LCOV_EXCL_STOP
+ }
+
+ r = read(fd, buf, len);
+ close(fd);
+ if (r > 0 && r < len) {
+ buf[r] = '\0';
+ r--;
+ /* If there is a line feed code'\n' at the end of the acquired data, replace it with '\0' */
+ while (buf[r] == '\n') {
+ buf[r] = '\0';
+ if (r == 0)
+ break;
+ r--;
+ }
+ /* If there is a line feed code'\n' in the middle of the acquired data, replace with '\0' */
+ tmp = buf;
+ while ((tmp = strchr(tmp, '\n')) != NULL) {
+ *tmp = ' ';
+ tmp++;
+ }
+ return;
+ } else {
+ buf[0] = '\0';
+ }
+}
+
+static bool isMounttedDir(char* pMountDir) {
+ char buf[4096];
+
+ if (!pMountDir) { // LCOV_EXCL_BR_LINE 8:Because pMountDir is not NULL
+ // LCOV_EXCL_START 8:Because pMountDir is not NULL
+ return false;
+ // LCOV_EXCL_STOP
+ }
+
+ ReadString("/proc/mounts", buf, sizeof(buf));
+ if (strstr(buf, pMountDir)) { // The mount folder is already in use as a mount point
+ return true;
+ }
+
+ return false;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::MountSD(uint8_t part_num,
+ BOOL *already_mounted) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "part_num %d", part_num);
+
+ if (NULL == m_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_hSession is NULL");
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ if (part_num > 3) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ char mount_dir[256];
+ if (part_num != 0) {
+ sprintf(mount_dir, "/mnt/mmcblk1p%d", part_num); // NOLINT (runtime/printf)
+ } else {
+ sprintf(mount_dir, "/mnt/mmcblk1"); // NOLINT (runtime/printf)
+ }
+ if (isMounttedDir(mount_dir)) {
+ *already_mounted = TRUE;
+ return eFrameworkunifiedStatusOK;
+ } else {
+ *already_mounted = FALSE;
+ }
+
+ char filename[256];
+ struct stat st;
+ if (part_num != 0) {
+ sprintf(filename, "/dev/mmcblk1p%d", part_num); // NOLINT (runtime/printf)
+ } else {
+ sprintf(filename, "/dev/mmcblk1"); // NOLINT (runtime/printf)
+ }
+ if (stat(filename, &st) != 0) {
+ return eFrameworkunifiedStatusAccessError;
+ }
+
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedSendMsg(m_hSession, SS_DEV_MOUNT_SD, sizeof(uint8_t),
+ &part_num))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Send MountSD msg Sucessfully");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::UmountSD(uint8_t part_num,
+ BOOL *already_umounted) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "part_num %d", part_num);
+
+ if (NULL == m_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_hSession is NULL");
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ if (part_num > 3) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ char mount_dir[256];
+ if (part_num != 0) {
+ sprintf(mount_dir, "/mnt/mmcblk1p%d", part_num); // NOLINT (runtime/printf)
+ } else {
+ sprintf(mount_dir, "/mnt/mmcblk1"); // NOLINT (runtime/printf)
+ }
+
+ if (isMounttedDir(mount_dir)) {
+ *already_umounted = FALSE;
+ } else {
+ *already_umounted = TRUE;
+ return eFrameworkunifiedStatusOK;
+ }
+
+ char filename[256];
+ struct stat st;
+
+ if (part_num != 0) {
+ sprintf(filename, "/dev/mmcblk1p%d", part_num); // NOLINT (runtime/printf)
+ } else {
+ sprintf(filename, "/dev/mmcblk1"); // NOLINT (runtime/printf)
+ }
+ if (stat(filename, &st) != 0) {
+ return eFrameworkunifiedStatusAccessError;
+ }
+
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedSendMsg(m_hSession, SS_DEV_UMOUNT_SD, sizeof(uint8_t),
+ &part_num))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Send UmountSD msg Sucessfully");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
+
+static const uint8_t VBUS_RESET_INTERVAL_MIN = 11;
+
+static EFrameworkunifiedStatus SendUsbVBusResetMsg(HANDLE handle, int8_t port, uint8_t interval) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == handle) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Invalid Handle.");
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ int16_t data[] = {port, interval};
+ eStatus = FrameworkunifiedSendMsg(handle, SS_USB_VBUS_RESET, sizeof(data), data);
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Send Error[0x%x]", eStatus);
+ return eStatus;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::UsbVBusReset(int8_t port, uint8_t interval) {
+ return SendUsbVBusResetMsg(m_hSession, port, interval);
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::UsbVBusReset(int8_t port) {
+ return SendUsbVBusResetMsg(m_hSession, port, VBUS_RESET_INTERVAL_MIN);
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::RoleSwStateNotify(
+ SS_DEV_ROLE_SW_STATE state) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ EFrameworkunifiedStatus result = eFrameworkunifiedStatusFail;
+ UI_32 rcvlength = 0;
+ UI_32 bufflength;
+
+ if (NULL == m_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "No Session");
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ bufflength = sizeof(EFrameworkunifiedStatus);
+ eStatus = FrameworkunifiedInvokeSync(m_hSession, SS_DEV_ROLE_SW_STATE_NOTIFY,
+ sizeof(SS_DEV_ROLE_SW_STATE), &state, bufflength,
+ &result, &rcvlength);
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Send Error[0x%x]", eStatus);
+ return eStatus;
+ }
+
+ if (bufflength != rcvlength) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedInvokeSync Response Error. bufflen[%d], rcvlen[%d]", bufflength,
+ rcvlength);
+ return eStatus;
+ }
+
+ eStatus = result;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::FormatSD(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == m_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid Handle.");
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ if (access("/dev/mmcblk1", F_OK) != 0) {
+ return eFrameworkunifiedStatusAccessError;
+ }
+
+ eStatus = FrameworkunifiedSendMsg(m_hSession, SS_DEV_FORMAT_SD, 0, NULL);
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Send Error[0x%x]", eStatus);
+ return eStatus;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+} // LCOV_EXCL_BR_LINE 10:Because the last line
+
diff --git a/systemservice/interface_unified/library/src/ss_framework_if.cpp b/systemservice/interface_unified/library/src/ss_framework_if.cpp
new file mode 100755
index 0000000..91d323a
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_framework_if.cpp
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager AGL framework
+/// interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <string.h>
+#include "system_service/ss_system_if.h"
+#include "system_service/interfaceunified_system_application.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_test_clients.h"
+#include "system_service/ss_templates.h"
+#include "ss_system_if_interfaceunifiedlog.h"
+
+HANDLE g_SystemIf_hApp = NULL;
+
+EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ g_SystemIf_hApp = hApp;
+ PCSTR pAppNameStr = FrameworkunifiedGetAppName(hApp);
+
+ if (0 != strcmp(SERVICE_SYSMANAGER, pAppNameStr) &&
+ 0 != strcmp(TC_Power, pAppNameStr)) {
+ l_eStatus = InterfaceunifiedSystemConnectToSystemManagerService(hApp);
+ LOG_STATUS(l_eStatus, "InterfaceunifiedSystemConnectToSystemManagerService()");
+
+ if (0 != strcmp(TC_SysManager, pAppNameStr)) {
+ l_eStatus = InterfaceunifiedSystemConnectToHeartBeatService(hApp);
+ LOG_STATUS(l_eStatus, "InterfaceunifiedSystemConnectToHeartBeatService()");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // LCOV_EXCL_BR_LINE 10:Because the last line
diff --git a/systemservice/interface_unified/library/src/ss_heartbeat_client.cpp b/systemservice/interface_unified/library/src/ss_heartbeat_client.cpp
new file mode 100755
index 0000000..a080e9a
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_heartbeat_client.cpp
@@ -0,0 +1,156 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager client
+/// heartbeat service interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <new>
+#include "system_service/ss_heartbeat_service_protocol.h"
+#include "system_service/ss_heartbeat_notifications.h"
+#include "system_service/ss_heartbeat_if.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_sm_thread_names.h"
+#include "system_service/ss_templates.h"
+#include "ss_system_if_interfaceunifiedlog.h"
+
+CHeartBeatServiceIf * pHeartBeatServiceIf = NULL;
+
+template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)>
+
+// LCOV_EXCL_START 6:Because process initialization
+EFrameworkunifiedStatus HeartBeatIfCallback(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNullPointer;
+ C * pObj = static_cast<C *>(pHeartBeatServiceIf);
+ if (pObj) {
+ l_eStatus = (pObj->*M)(hApp);
+ }
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: InterfaceunifiedSystemConnectToHeartBeatService
+ @note: . Called from framework for every app to start connection to HeartBeat
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+*****************************************************************************/
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToHeartBeatService(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ /// Avoid opening a session to the HeartBeat
+ /// service Since it uses the framework as well
+ /// Avoid opening a session to System Manager For testing
+ // TODO(my_username): Remove system manager check
+ if ((0 != strcmp(SERVICE_SYSMANAGER, FrameworkunifiedGetAppName(hApp)))) {
+ FrameworkunifiedProtocolCallbackHandler g_aryHeartBeat_Protocol_Cbs[] = {
+ // Command ID, Call back functions
+ { SS_HEARTBEAT_REQUEST, HeartBeatIfCallback<CHeartBeatServiceIf, &CHeartBeatServiceIf::OnHeartBeatRequest>}
+ }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ /// Attach the valid callback for this service
+ if ( eFrameworkunifiedStatusOK != // LCOV_EXCL_BR_LINE 6:Because process initialization
+ (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hApp,
+ SS_SMHeartbeat,
+ g_aryHeartBeat_Protocol_Cbs,
+ _countof(g_aryHeartBeat_Protocol_Cbs)))) {
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher()");
+ } else {
+ // LCOV_EXCL_BR_LINE 5:Because constructor
+ pHeartBeatServiceIf =
+ new(std::nothrow) CHeartBeatServiceIf(FALSE, NULL, FrameworkunifiedGetAppName(hApp));
+ } // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Heartbeat service name duplicated.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_eStatus; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: CHeartBeatServiceIf constructor
+ @param -
+*****************************************************************************/
+CHeartBeatServiceIf::CHeartBeatServiceIf(BOOL avail, HANDLE service, PCSTR name) {
+ g_tHeartBeatSession.szServiceName = name; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ g_tHeartBeatSession.fAvailable = avail;
+ g_tHeartBeatSession.hService = service;
+}
+
+// LCOV_EXCL_START 10:Because destructor
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: CHeartBeatServiceIf destructor
+*****************************************************************************/
+CHeartBeatServiceIf::~CHeartBeatServiceIf() {
+ if (pHeartBeatServiceIf != NULL) {
+ delete pHeartBeatServiceIf;
+ pHeartBeatServiceIf = NULL;
+ }
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 6:Because process initialization
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: OnHeartBeatRequest
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatServiceIf::OnHeartBeatRequest(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_availability;
+
+ if (g_tHeartBeatSession.hService == NULL) {
+ if ( NULL == (g_tHeartBeatSession.hService = FrameworkunifiedMcOpenSender(hApp, SS_SMHeartbeat)) ) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedMcOpenSender(%s) returned NULL",
+ SS_SMHeartbeat);
+ return l_eStatus;
+ }
+ }
+
+ if ( (0 == strcmp(SS_SMHeartbeat, FrameworkunifiedGetMsgSrc(hApp))) ) {
+ if (NULL != g_tHeartBeatSession.hService) {
+ l_availability = FrameworkunifiedGetSelfAvailability(hApp);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(g_tHeartBeatSession.hService, SS_HEARTBEAT_RESPONSE,
+ sizeof(l_availability), &l_availability))) {
+ LOG_ERROR("FrameworkunifiedSendMsg");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid handle[_g_hHeartBeatSessionHandle = :NULL]");
+ }
+ }
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
diff --git a/systemservice/interface_unified/library/src/ss_last_to_order.cpp b/systemservice/interface_unified/library/src/ss_last_to_order.cpp
new file mode 100755
index 0000000..140101f
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_last_to_order.cpp
@@ -0,0 +1,186 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <agl_wakeup_order.h>
+#include <list>
+#include <fstream>
+#include <iostream>
+#include <stdexcept>
+#include <string>
+#include "system_service/ss_last_to_order.h"
+#include "ss_last_to_order_local.h"
+
+#include "system_service/ss_templates.h"
+#include "ss_system_if_interfaceunifiedlog.h"
+#define SCO_STATE_LOG(...) FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, __VA_ARGS__);
+#define SCO_ERROR_LOG(...) FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, __VA_ARGS__);
+#define SCO_ASSERT(x) SS_ASERT(x);
+
+//************* CONFIG FILE Format ****************
+#define ORDERNAME_MAX 64
+#define CONTENT_NAME_MAX 128
+#pragma pack(push, 1)
+typedef struct {
+ char lastinfo[SS_CCAT_MAX][CONTENT_NAME_MAX];
+ char orderName[ORDERNAME_MAX];
+}SS_LASTINFO_TO_OEDER_PACKED_t;
+#pragma pack(pop)
+//*************************************************
+
+
+typedef struct {
+ SS_LAST_INFO_t lastinfo;
+ std::string orderName;
+}SS_LASTINFO_TO_OEDER_t;
+
+
+
+//****************************
+// load configuration file
+//****************************
+static int
+loadConfig(std::string &cfgPath, std::list<SS_LASTINFO_TO_OEDER_t> *p_cfgList) throw() { // NOLINT (runtime/references)
+ int ret = 0;
+
+ try {
+ std::ifstream fin(cfgPath.c_str(), std::ios::in | std::ios::binary);
+ if (!fin) {
+ SCO_ERROR_LOG("cfg file error %s", cfgPath.c_str());
+ throw std::domain_error("open error");
+ }
+ char magic[4];
+
+ fin.read(reinterpret_cast<char*>(&magic), sizeof(magic));
+ if (fin.fail()) {
+ throw std::domain_error("read magic");
+ }
+
+ if (memcmp(magic, "CTOO", sizeof(magic)) != 0) {
+ throw std::domain_error("magic error");
+ }
+
+ uint32_t numOfElement = 0;
+ fin.read(reinterpret_cast<char*>(&numOfElement), sizeof(numOfElement));
+ if ( fin.fail() ) {
+ throw std::domain_error("read numOfElement");
+ }
+
+ for (uint32_t ii = 0; ii < numOfElement; ii++) {
+ SS_LASTINFO_TO_OEDER_PACKED_t element;
+ fin.read(reinterpret_cast<char*>(&element), sizeof(element));
+ if ( fin.fail() ) {
+ throw std::domain_error("read element");
+ }
+ SS_LASTINFO_TO_OEDER_t tmp;
+ tmp.lastinfo[SS_CCAT_F_VIDEO] = element.lastinfo[SS_CCAT_F_VIDEO];
+ tmp.lastinfo[SS_CCAT_F_SUB_VIDEO] = element.lastinfo[SS_CCAT_F_SUB_VIDEO];
+ tmp.lastinfo[SS_CCAT_F_AUDIO] = element.lastinfo[SS_CCAT_F_AUDIO];
+ tmp.lastinfo[SS_CCAT_R_VIDEO] = element.lastinfo[SS_CCAT_R_VIDEO];
+ tmp.lastinfo[SS_CCAT_R_AUDIO] = element.lastinfo[SS_CCAT_R_AUDIO];
+ tmp.orderName = element.orderName;
+ p_cfgList->push_back(tmp);
+ }
+ SCO_STATE_LOG("%s is loaded", cfgPath.c_str());
+ } catch (std::exception &e) {
+ if (ret == 0) ret = -1;
+ SCO_ERROR_LOG("%s", e.what());
+ SCO_ASSERT(0);
+ } catch (...) {
+ SCO_ASSERT(0);
+ ret = -1;
+ }
+ return ret;
+}
+
+
+
+static
+bool
+isPassCondition(SS_CONT_CATEGORY_t cat, SS_LAST_INFO_t &lastInfo, SS_LASTINFO_TO_OEDER_t &tblElement) { // NOLINT (runtime/references)
+ std::string &tblStr = tblElement.lastinfo[cat];
+
+ if (tblStr != "EMPTY") {
+ //Category with content specification
+ SS_LAST_INFO_t::iterator iteCont = lastInfo.find(cat);
+ if (iteCont == lastInfo.end() || iteCont->second != tblStr) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
+
+//****************************
+// SS_ConvLastInfoToOrder
+//****************************
+EFrameworkunifiedStatus
+SS_ConvLastInfoToOrder(SS_LAST_INFO_t &curInfo, std::string &order, const char* p_cfgPath/* = NULL*/) { // NOLINT (runtime/references)
+ std::string cfgPath = (p_cfgPath) ? p_cfgPath : SS_LAST_TO_ORDER_CONF_PATH;
+
+ static std::list<SS_LASTINFO_TO_OEDER_t> s_convList;
+ static std::string s_readCfgPath = "__default__";
+ bool isHit = false;
+
+ // If the same CONFIG, do not READ after the second.
+ if (s_readCfgPath != cfgPath) {
+ int ret;
+ s_convList.clear();
+
+ ret = loadConfig(cfgPath, &s_convList);
+ if (ret != 0) { goto ERROR; }
+ s_readCfgPath = cfgPath;
+
+#if 0 // DEBUG
+ for (std::list<SS_LASTINFO_TO_OEDER_PACKED_t>::iterator tblElt = s_convList.begin();
+ tblElt != s_convList.end();
+ tblElt++) {
+ SCO_STATE_LOG("FV:%s FSV:%s FA:%s RV:%s RA:%s O:%s",
+ tblElt->lastinfo[SS_CCAT_F_VIDEO], tblElt->lastinfo[SS_CCAT_F_SUB_VIDEO], tblElt->lastinfo[SS_CCAT_F_AUDIO],
+ tblElt->lastinfo[SS_CCAT_R_VIDEO], tblElt->lastinfo[SS_CCAT_R_AUDIO], tblElt->orderName);
+ }
+#endif
+ }
+
+ for (std::list<SS_LASTINFO_TO_OEDER_t>::iterator tblElt = s_convList.begin();
+ tblElt != s_convList.end();
+ tblElt++) {
+ if (isPassCondition(SS_CCAT_F_VIDEO , curInfo, *tblElt) == false) {
+ continue;
+ } else if (isPassCondition(SS_CCAT_F_SUB_VIDEO, curInfo, *tblElt) == false) {
+ continue;
+ } else if (isPassCondition(SS_CCAT_F_AUDIO , curInfo, *tblElt) == false) {
+ continue;
+ } else if (isPassCondition(SS_CCAT_R_VIDEO , curInfo, *tblElt) == false) {
+ continue;
+ } else if (isPassCondition(SS_CCAT_R_AUDIO , curInfo, *tblElt) == false) {
+ continue;
+ }
+
+ isHit = true;
+ order = tblElt->orderName;
+ break;
+ }
+ if (!isHit) {
+ order = WON_DEFAULT;
+ }
+ return eFrameworkunifiedStatusOK;
+ERROR:
+ return eFrameworkunifiedStatusFail;
+}
diff --git a/systemservice/interface_unified/library/src/ss_logger_service_ifc.cpp b/systemservice/interface_unified/library/src/ss_logger_service_ifc.cpp
new file mode 100755
index 0000000..1766bfa
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_logger_service_ifc.cpp
@@ -0,0 +1,781 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_Logger
+/// \brief This file supports the _CWORD77_ logger service.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_logger_service_ifc.h"
+#include <string.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <string>
+#include "system_service/ss_logger_service_protocol.h"
+#include "system_service/ss_logger_service_notifications.h"
+#include "system_service/ss_logger_service.h"
+#include "system_service/ss_logger_service_local.h"
+#include "system_service/ss_services.h"
+#include "ss_logger_service_if_interfaceunifiedlog.h"
+
+LoggerServiceIf::LoggerServiceIf()
+ : m_hApp(NULL),
+ m_hService(NULL),
+ m_hSession(NULL) {
+}
+
+LoggerServiceIf::~LoggerServiceIf() {
+ CloseSessionRequest(); // if the session is still connected
+
+ m_hService = NULL;
+ m_hSession = NULL;
+ m_hApp = NULL;
+} // LCOV_EXCL_BR_LINE 10:Because destructor
+
+EFrameworkunifiedStatus LoggerServiceIf::NotifyOnLoggerServiceAvailability(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ // Subscriptions
+ FrameworkunifiedNotificationCallbackHandler g_aryLogger_Notif_Cbs[] = {
+ // Notifications name, Call back function
+ { NTFY_SS_LoggerService_Availability, f_pCallBackFn }, };
+
+ if (0 != strcmp(SERVICE_LOGGER, FrameworkunifiedGetAppName(m_hApp))) {
+ // Subscribe and attach call backs to notifications
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedSubscribeNotificationsWithCallback(
+ m_hApp, g_aryLogger_Notif_Cbs, _countof(g_aryLogger_Notif_Cbs)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::NotifyOnOpenSessionAck(CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SERVICE_LOGGER,
+ PROTOCOL_OPEN_SESSION_ACK,
+ f_pCallBackFn))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::NotifyOnCloseSessionAck(CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SERVICE_LOGGER,
+ PROTOCOL_CLOSE_SESSION_ACK,
+ f_pCallBackFn))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+BOOL LoggerServiceIf::Initialize(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_eStatus = TRUE;
+
+ if (NULL != hApp) {
+ m_hApp = hApp;
+ } else {
+ l_eStatus = FALSE; // eFrameworkunifiedStatusInvldHandle;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::OpenSessionRequest() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp) {
+ // if the session is there then we need to close it first!
+ if (NULL != m_hService) {
+ CloseSessionRequest();
+ m_hService = NULL;
+ }
+ BOOL l_bServiceAvailable = FrameworkunifiedIsServiceAvailable(m_hApp);
+ if (FALSE == l_bServiceAvailable) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Service is unavailable");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // Now open the service.
+ if (l_bServiceAvailable
+ && (NULL != (m_hService = OpenService()))) { // LCOV_EXCL_BR_LINE 8:Because bServiceAvailable is always TRUE
+ // [DM: TODO] Check if we need to open a session with some data sent to Server.
+ UI_32 l_pTestData = 1;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedOpenSessionWithData(m_hService,
+ (PVOID) &l_pTestData,
+ sizeof(UI_32)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "FrameworkunifiedOpenSessionWithData Failed, errval :%d", l_eStatus);
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "FrameworkunifiedOpenService Failed, errval :%d", l_eStatus);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+HANDLE LoggerServiceIf::OpenService() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ HANDLE l_hService = NULL;
+
+ if (NULL == (l_hService = FrameworkunifiedOpenService(m_hApp, SERVICE_LOGGER))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "FrameworkunifiedOpenService : Failed to open Logger Service");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_hService;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::DecodeOpenSessionResponse() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ std::string l_strSessionName;
+ if (NULL != m_hService
+ && NULL != m_hApp) { // LCOV_EXCL_BR_LINE 8:Because there is no case where m_hApp is NULL and m_hService is not NULL
+ if (NULL == (m_hSession = FrameworkunifiedGetOpenSessionHandle(m_hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "Error in extracting OpenSessionAck response.");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ l_strSessionName = FrameworkunifiedGetSessionName(m_hSession);
+ if (l_strSessionName.empty()) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SessionName is empty");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (FrameworkunifiedSetSessionHandle(m_hApp, l_strSessionName.c_str(), m_hSession))) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSetSessionHandle() failed");
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::CloseSessionRequest() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseSession(m_hService, m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedCloseSession Failed");
+ }
+ m_hSession = NULL; // clear our session handle
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::RegisterForLoggerEvent(
+ SS_LoggerServerEvents f_eLoggerEvent, CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hSession && NULL != f_pCallBackFn) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SERVICE_LOGGER,
+ f_eLoggerEvent,
+ f_pCallBackFn, m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus);
+ }
+
+ // client registers for the event
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedRegisterEvent(m_hSession, f_eLoggerEvent))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedRegisterEvents Failed Status:0x%x",
+ eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedRegisterEvents Status:0x%x", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::UnRegisterForLoggerEvent(
+ SS_LoggerServerEvents f_eLoggerEvent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hSession) {
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendDiagStat
+/// API to send CAN Diagnostic status data(it has mileage info) to Logger Service
+/// (Command: SS_LOGGER_MILEAGE_DATA)
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus LoggerServiceIf::SendDiagStat(STLOGGER_CANDIAGSTAT *pCanDiagStat_t) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ STLOGGER_CANDIAGSTAT l_candiagstat;
+
+ memcpy(&l_candiagstat, pCanDiagStat_t, sizeof(STLOGGER_CANDIAGSTAT));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Before Valid Session");
+ if (NULL != m_hService && NULL != m_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Entered Valid Session");
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_MILEAGE_DATA,
+ sizeof(STLOGGER_CANDIAGSTAT), &l_candiagstat))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Msg Send Successfully");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_CANGetCurrentDateAndTime
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_CANGetCurrentDateAndTime(
+ STCanCurrentDateTime stDateAndTime) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_DATETIME,
+ sizeof(stDateAndTime), &stDateAndTime))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_CANSetVIN
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_CANSetVIN(STVIN_NUMBER& stVinNumber) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ stVinNumber.VINstr[stVinNumber.VIN_LEN - 1] = '\0';
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_VIN,
+ sizeof(STVIN_NUMBER), &stVinNumber))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg() Failed with error: %X",
+ l_eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Service or Session Handle NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// LoggerIf_SetLoggerParams
+/// API is to inform Logger Service about the device selected to store the logs
+/// and about Enable/Disable Logging.
+/// (Command: SS_LOGGER_SET_PARAMS)
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_SetLoggerParams(ELOGGER_STAT eLoggerStatus,
+ EDEV_TYPE eDevType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ STLoggerSetParams l_stLoggerParams;
+
+ l_stLoggerParams.Logger_State = eLoggerStatus;
+ l_stLoggerParams.Device_Type = eDevType;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_PARAMS,
+ sizeof(STLoggerSetParams), &l_stLoggerParams))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// LoggerIf_UDPLogging
+/// API is to inform Logger Service about UDP logging
+/// and about Enable/Disable Logging.
+/// (Command: SS_LOGGER_UDP_LOGGING)
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_UDPLogging(ELOGGER_STAT eLoggerStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_UDP_LOGGING,
+ sizeof(ELOGGER_STAT), &eLoggerStatus))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_ScreenCaptureEventACK(
+ STScreenCaptureEvt stScreenCaptureInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SCREENCAPTURE_EVT_ACK,
+ sizeof(stScreenCaptureInfo),
+ &stScreenCaptureInfo))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Screen shot ACK sent successfully.");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. m_hSession is NULL. Screen shot capture ACK not sent.");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_EventLoggingCommonInfo
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingCommonInfo(
+ STEventLoggerCommonInfo stEventCommonInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_EVENT_COMMONINFO,
+ sizeof(stEventCommonInfo),
+ &stEventCommonInfo))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_EventLoggingEventInfo
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingEventInfo(
+ STEventLoggerEventInfo stEventInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER__CWORD56__EVENT_INFO,
+ sizeof(stEventInfo), &stEventInfo))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_EventLoggingResetInfo
+/// (Command: SS_LOGGER__CWORD56__RESET_INFO)
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingResetInfo(
+ STEventLoggerResetInfo stResetInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER__CWORD56__RESET_INFO,
+ sizeof(stResetInfo), &stResetInfo))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_EventLoggingResetInfo
+/// (Command: SS_LOGGER_DIAGDTC_ACTIVE)
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_PersistEventLogOnActiveDTC(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_DIAGDTC_ACTIVE, 0x00,
+ NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_EventLoggingResetInfo
+/// (Command: SS_LOGGER_SHUTDOWN_COMPLETE)
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_Shutdown_Complete(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SHUTDOWN_COMPLETE,
+ 0x00, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :StoreEventLogsToUSB
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::StoreEventLogsToUSB(
+ EEvtLogUSBDevNumber eUSBDevNumber) {
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Copy the Event logs in to USB command received:%X", eUSBDevNumber);
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCOPYEVENTUSB,
+ sizeof(EEvtLogUSBDevNumber), &eUSBDevNumber))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :StoreEmergencyErrorLogsToUSB
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::StoreEmergencyErrorLogsToUSB(
+ EDevNumber eDevNumber) {
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO, __FUNCTION__,
+ "Copy the Emergency Error logs in to External Device command received:%X",
+ eDevNumber);
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCOPYEMERGENCYLOGS,
+ sizeof(EDevNumber), &eDevNumber))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :ClearEventLogs
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::ClearEventLogs(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request for clearing the event logs");
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCLEAREVENT, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :ReadStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::ReadStatisticalCounter(
+ EStatCounterGroupID eCounterGroup) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Request to read the statistical counter for group ID:%X",
+ eCounterGroup);
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_READ_STATL_COUNTER,
+ sizeof(EStatCounterGroupID), &eCounterGroup))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :ReadStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::ResetStatisticalCounter(
+ EStatCounterGroupID eCounterGroup) {
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Request to reset the statistical counter for group ID:%X",
+ eCounterGroup);
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_RESET_STATL_COUNTER,
+ sizeof(EStatCounterGroupID), &eCounterGroup))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function LoggerServiceIf::StartDTCLoggingToEmmc
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::StartDTCLoggingToEmmc(UI_32 f_dtc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request to start logging for DTC:0x%4X",
+ f_dtc);
+ l_eStatus = this->SendMessage(eSSLoggerCANProtocolIDDTCTrigger,
+ (UI_32) sizeof(f_dtc), &f_dtc);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function LoggerServiceIf::StartCANLogging
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::StartCANLogging(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request to start CAN logging.");
+ l_eStatus = this->SendMessage(eSSLoggerCANProtocolIDCANTrigger, 0, NULL);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function LoggerServiceIf::RegisterLoggingStartNotification
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::RegisterLoggingStartNotification(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == this->m_hApp) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == this->m_hApp)");
+ } else if (NULL == f_pCallBackFn) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == f_pCallBackFn)");
+ } else {
+ l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback(this->m_hApp,
+ eSSLoggerCANEventStart,
+ f_pCallBackFn,
+ this->m_hSession);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "FrameworkunifiedSubscribeToSessionEventWithCallback(eSSLoggerCANEventStart) returned %X",
+ l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function LoggerServiceIf::RegisterLoggingStartNotification
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::RegisterLoggingFinishNotification(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == this->m_hApp) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == this->m_hApp)");
+ } else if (NULL == f_pCallBackFn) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == f_pCallBackFn)");
+ } else {
+ l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback(
+ this->m_hApp, eSSLoggerCANEventFinished, f_pCallBackFn,
+ this->m_hSession);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "FrameworkunifiedSubscribeToSessionEventWithCallback(eSSLoggerCANEventFinished) returned %X",
+ l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :SendMessage
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::SendMessage(UI_32 f_cmdID, UI_32 f_size,
+ void* f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if ((NULL != m_hSession)
+ && ((f_pData != NULL) || (f_size == 0))) { // LCOV_EXCL_BR_LINE 8:Because there is no case where f_pData is NULL and f_size is not 0
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, f_cmdID, f_size, f_pData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_SetDiagID
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_SetDiagID(UI_16 f_u16DiagID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_DIAGID,
+ sizeof(UI_16), &f_u16DiagID))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed %d", l_eStatus);
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_UploadEventLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_UploadEventLog() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_UPLOAD_EVENTLOG, 0x00,
+ NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed %d", l_eStatus);
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // LCOV_EXCL_BR_LINE 10:Because the last line
diff --git a/systemservice/interface_unified/library/src/ss_power_client.cpp b/systemservice/interface_unified/library/src/ss_power_client.cpp
new file mode 100755
index 0000000..30bdbaa
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_power_client.cpp
@@ -0,0 +1,254 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerServiceIf
+/// \brief This file supports Power Service client management.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <inttypes.h>
+#include <string.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <string>
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_power_service_protocol.h"
+#include "system_service/ss_power_service_notifications.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_system_if.h"
+#include "system_service/ss_templates.h"
+#include "ss_power_if_interfaceunifiedlog.h"
+
+typedef struct {
+ BOOL fAvailable;
+ HANDLE hSession;
+ HANDLE hService;
+ std::string szServiceName;
+} TPowerSession;
+
+static EFrameworkunifiedStatus OnPowerCloseSesionAck(HANDLE hApp);
+static EFrameworkunifiedStatus OnPowerOpenSessionAck(HANDLE hApp);
+static EFrameworkunifiedStatus OnPowerAvailability(HANDLE hApp);
+static EFrameworkunifiedStatus OnPowerAvailable(HANDLE hApp);
+static EFrameworkunifiedStatus OnPowerUnavailable(HANDLE hApp);
+static TPowerSession g_tPowerSession = { };
+
+/// Base on the a user group affiliation we will call there start and stop methods
+/// Note: there group and subgroup strings are empty we will call start on the every
+/// first case of
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToPowerSerivce(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Subscriptions
+ FrameworkunifiedNotificationCallbackHandler g_aryPower_Notif_Cbs[] = {
+ // Notifications name, Call back function
+ { szNTFY_PowerAvailability, OnPowerAvailability }, };
+
+ /// Avoid opening a session to the Power
+ /// service Since it uses the framework as well
+ if (0 != strcmp(SERVICE_POWER, FrameworkunifiedGetAppName(hApp))) {
+ // Subscribe and attach call backs to notifications, to Notification Service!
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedSubscribeNotificationsWithCallback(
+ hApp, g_aryPower_Notif_Cbs, _countof(g_aryPower_Notif_Cbs)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ",
+ eStatus);
+ } else {
+ /// Need to save the Group and Subgroup values
+ g_tPowerSession.szServiceName = FrameworkunifiedGetAppName(hApp);
+
+ /// Cleanup any other data members
+ g_tPowerSession.fAvailable = FALSE;
+ g_tPowerSession.hService = NULL;
+ g_tPowerSession.hSession = NULL;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus OnPowerAvailability(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Power Service Availability notification received ****");
+
+ if (sizeof(BOOL) == FrameworkunifiedGetMsgLength(hApp)) {
+ BOOL avalibility = FALSE;
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &avalibility, sizeof(BOOL)))) {
+ if (TRUE == avalibility) {
+ eStatus = OnPowerAvailable(hApp);
+ } else {
+ eStatus = OnPowerUnavailable(hApp);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus OnPowerAvailable(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ // if the service is available before the close happens then close the session and service first.
+ if (NULL != g_tPowerSession.hService && NULL != g_tPowerSession.hSession) {
+ EFrameworkunifiedStatus interfaceunifiedRet = FrameworkunifiedCloseSession(g_tPowerSession.hService,
+ g_tPowerSession.hSession);
+ SS_ASERT(interfaceunifiedRet == eFrameworkunifiedStatusOK);
+ g_tPowerSession.hSession = NULL;
+ g_tPowerSession.hService = NULL;
+ }
+
+ PCSTR power_name = FrameworkunifiedGetMsgSrc(hApp);
+
+ // opening the service
+ if (NULL == (g_tPowerSession.hService = FrameworkunifiedOpenService(hApp, power_name))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_ERR, __FUNCTION__, "Power: Failed to open service");
+ } else {
+ FrameworkunifiedProtocolCallbackHandler g_aryPower_Protocol_Cbs[] = {
+ // Command ID, Call back functions
+ { PROTOCOL_OPEN_SESSION_ACK, OnPowerOpenSessionAck },
+ { PROTOCOL_CLOSE_SESSION_ACK, OnPowerCloseSesionAck }, };
+
+ /// Attach the valid callback for this service
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hApp, power_name, g_aryPower_Protocol_Cbs,
+ _countof(g_aryPower_Protocol_Cbs)))) {
+ EPWR_SESSION_TYPE tOpenSessionReq = epsstBASIC;
+ /// opening the session with service
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedOpenSessionWithData(g_tPowerSession.hService,
+ &tOpenSessionReq,
+ sizeof(tOpenSessionReq)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedOpenSession Failed Status:0x%x ",
+ eStatus);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "%s has received PowerService Available.",
+ FrameworkunifiedGetAppName(hApp));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher Failed Status:0x%x ", eStatus);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus OnPowerUnavailable(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ if (0 == strcmp(SERVICE_POWER, FrameworkunifiedGetAppName(hApp))) {
+ if ((g_tPowerSession.hSession != NULL)
+ && (g_tPowerSession.hService != NULL)) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedCloseSession(g_tPowerSession.hService,
+ g_tPowerSession.hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedCloseSession Failed Status:0x%x",
+ eStatus);
+ }
+ g_tPowerSession.hSession = NULL;
+ g_tPowerSession.hService = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "%s has received PowerService Unavailable.", FrameworkunifiedGetAppName(hApp));
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error INVALID HANDLE [g_tPowerSession.hSession :0x%" PRIxPTR "]; [g_tPowerSession.hService :0x%" PRIxPTR "] ", // NOLINT (whitespace/line_length)
+ (uintptr_t) g_tPowerSession.hSession, (uintptr_t) g_tPowerSession.hService);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: OnHeartBeatClientOpenSessionAck
+/// HeartBeat Service OpenSession callback
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnPowerOpenSessionAck(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ g_tPowerSession.hSession = FrameworkunifiedGetOpenSessionHandle(hApp);
+ if (NULL != g_tPowerSession.hSession) {
+ g_tPowerSession.fAvailable = TRUE;
+ eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "%s Session to PowerService has been successfully opened.",
+ FrameworkunifiedGetAppName(hApp));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetOpenSessionHandle returned : %" PRIxPTR "",
+ (uintptr_t) g_tPowerSession.hSession);
+ g_tPowerSession.hSession = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: OnHeartBeatClientCloseSessionAck
+/// HeartBeat Service CloseSession callback
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnPowerCloseSesionAck(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Close Service
+ if (NULL != g_tPowerSession.hService) {
+ eStatus = FrameworkunifiedCloseService(hApp, g_tPowerSession.hService);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: FrameworkunifiedCloseService() errored %d/'%s",
+ eStatus, GetStr(eStatus).c_str());
+ }
+ g_tPowerSession.hService = NULL;
+ g_tPowerSession.hSession = NULL;
+ }
+ g_tPowerSession.fAvailable = FALSE;
+ eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "%s Session to PowerService has been successfully closed.",
+ FrameworkunifiedGetAppName(hApp));
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
diff --git a/systemservice/interface_unified/library/src/ss_pwrsvc_if.cpp b/systemservice/interface_unified/library/src/ss_pwrsvc_if.cpp
new file mode 100755
index 0000000..86d8ebb
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_pwrsvc_if.cpp
@@ -0,0 +1,343 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerServiceIf
+/// \brief This file supports the Power Service module interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_power_service_if.h"
+#include <string.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_power_service_protocol.h"
+#include "system_service/ss_power_service_notifications.h"
+#include "system_service/ss_system_if.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_string_maps.h"
+#include "system_service/ss_templates.h"
+#include "ss_power_if_interfaceunifiedlog.h"
+
+HANDLE OpenPowerService(HANDLE f_hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ HANDLE l_hService = NULL;
+ if (NULL == f_hApp) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_App");
+ } else if (NULL == (l_hService = FrameworkunifiedOpenService(f_hApp, SERVICE_POWER))) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedOpenService(f_hApp, SERVICE_POWER)");
+ }
+ return l_hService;
+}
+
+EFrameworkunifiedStatus ClosePowerService(HANDLE f_hApp, HANDLE f_hService) {
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hApp) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_App");
+ } else if (NULL == f_hService) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hService");
+ } else {
+ l_eStatus = FrameworkunifiedCloseService(f_hApp, f_hService);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedCloseService(f_hApp, f_hService)");
+ f_hService = NULL;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// Session Related Requests
+/// Any client can also use FrameworkunifiedOpenSession and FrameworkunifiedOpenSessionWithData.
+/// In that case, the PVOID data passed as a parameter should be MM_OpenSessionRequestIf
+/// to open a session with the Power Service.
+/// The client can also use the below API for Opening a session with Power Service.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus PwrServiceOpenSessionRequest(HANDLE f_hService,
+ EPWR_SESSION_TYPE f_eSessionType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == f_hService) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hService");
+ } else if (epsstUNKNOWN == f_eSessionType) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("epsstUNKNOWN == f_eSessionType");
+ } else {
+ l_eStatus = FrameworkunifiedOpenSessionWithData(f_hService, &f_eSessionType,
+ sizeof(f_eSessionType));
+ LOG_STATUS(l_eStatus, "FrameworkunifiedOpenSessionWithData()");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceCloseSessionRequest(HANDLE f_hService, HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == f_hService) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hService");
+ } else if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ CALL_AND_LOG_STATUS(FrameworkunifiedCloseSession(f_hService, f_hSession));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceDecodeOpenSessionResponse(HANDLE f_hApp,
+ HANDLE& f_hSession) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == f_hApp) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_App");
+ } else {
+ if (NULL == (f_hSession = FrameworkunifiedGetOpenSessionHandle(f_hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedGetOpenSessionHandle('%s') returned NULL",
+ FrameworkunifiedGetAppName(f_hApp));
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceSetVoltageState(HANDLE f_hSession,
+ EPWR_VOLTAGE_STATE_TYPE f_eVoltage_state) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else if (epsvsINVALID == f_eVoltage_state) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("epsvsINVALID == f_eVoltage_state");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ l_tServiceSetIf.data.voltage.state = f_eVoltage_state;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_VOLTAGE_STATE,
+ sizeof(l_tServiceSetIf), (PVOID) &l_tServiceSetIf);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_VOLTAGE_STATE)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceSetCrankState(HANDLE f_hSession,
+ EPWR_CRANK_STATE_TYPE f_eCrank_state) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else if (epscsINVALID == f_eCrank_state) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("epsvsINVALID == f_eCrank_state");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ l_tServiceSetIf.data.crank.state = f_eCrank_state;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_CRANK_STATE,
+ sizeof(l_tServiceSetIf), (PVOID) &l_tServiceSetIf);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_CRANK_STATE)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceSendShutdownRequest(
+ HANDLE f_hSession, EPWR_SHUTDOWN_REQUEST_MSG_STRUCT &f_eState) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ l_tServiceSetIf.data.shutdownRequestMsg = f_eState;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_SHUTDOWN_REQUEST_MSG,
+ sizeof(l_tServiceSetIf), &l_tServiceSetIf);
+
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_SHUTDOWN_REQUEST_MSG)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus PwrServiceSendShutdownRequest(
+
+EFrameworkunifiedStatus PwrServiceSendSetShutdownPopupRequest(
+ HANDLE f_hSession, EPWR_SHUTDOWN_POPUP_TYPE f_eShutdownPopup) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ switch (f_eShutdownPopup) {
+ case epsspPowerSave1:
+ case epsspPowerSave2:
+ case epsspPowerSave3:
+ case epsspPowerSaveClr:
+ case epsspLowVoltage1:
+ case epsspLowVoltage2:
+ case epsspLowVoltage3:
+ case epsspLowVoltageClr:
+ case epsspBattCouplingSW1:
+ case epsspBattCouplingSW2:
+ case epsspBattCouplingSW3:
+ case epsspBattCouplingSWClr:
+ case epsspAbnormalTemp_1st:
+ case epsspAbnormalTemp_Clr:
+ case epsspLimpHome_1st:
+ case epsspLimpHome_2nd:
+ case epsspLimpHome_3rd:
+ case epsspLimpHome_Clr:
+ case epsspProdMd_1st:
+ case epsspProdMd_Clr:
+ case epsspTransMd_1st:
+ case epsspTransMd_Clr:
+ case epsspAllClr:
+ l_tServiceSetIf.data.shutdownPopup.shutdownPopupEvent =
+ f_eShutdownPopup;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession,
+ SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ,
+ sizeof(l_tServiceSetIf), &l_tServiceSetIf);
+ LOG_STATUS(l_eStatus,
+ "FrameworkunifiedSendMsg(SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ)");
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Unknown 'ShutdownPopup' value: 0x%X/%d",
+ f_eShutdownPopup, f_eShutdownPopup);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus PwrServiceSendSetShutdownPopupRequest( HANDLE f_hSession,
+
+EFrameworkunifiedStatus PwrServiceSendStartupConfirmationMsgRequest(
+ HANDLE f_hSession, EPWR_SC_MSG_STRUCT f_eState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ l_tServiceSetIf.data.startupConfirmationMsg = f_eState;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_FWD_START_CONFIRMATION_MSG_REQ,
+ sizeof(l_tServiceSetIf), &l_tServiceSetIf);
+
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_FWD_START_CONFIRMATION_MSG_REQ)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus PwrServiceSendStartupConfirmationMsgRequest ( HANDLE f_hSession,
+
+EFrameworkunifiedStatus PwrServiceSystemModeInfoRequest(HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_SYSTEM_MODE_INFO_REQ, 0, NULL);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_SYSTEM_MODE_INFO_REQ)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceSendInitCompReport(HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_INITCOMP_REP, 0, NULL);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_INITCOMP_REP)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceSendPowerRequest(
+ HANDLE f_hSession, EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR &f_eState) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ l_tServiceSetIf.data.powerRequestMsg = f_eState;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_POWER_REQUEST_MSG,
+ sizeof(l_tServiceSetIf), (PVOID) &l_tServiceSetIf);
+
+ char l_cBuf[200] = { 0 };
+ snprintf(
+ l_cBuf,
+ sizeof(l_cBuf),
+ "FrameworkunifiedSendMsg(SS_POWER_POWER_REQUEST_MSG(%s, %s))",
+ GetStr(l_tServiceSetIf.data.powerRequestMsg.userMode).c_str(),
+ GetStr(l_tServiceSetIf.data.powerRequestMsg.userModeChangeReason).c_str());
+ LOG_STATUS(l_eStatus, l_cBuf);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus PwrServiceSendPowerRequest( HANDLE f_hSession
+
+EFrameworkunifiedStatus PwrServiceSendHeartBeatRequest(HANDLE f_hSession,
+ EPWR_HB_REQ_MSG_STRUCT *f_eHbReqMsg) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_HEARTBEAT_REQ,
+ sizeof(EPWR_HB_REQ_MSG_STRUCT),
+ reinterpret_cast<void *>(f_eHbReqMsg));
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_HEARTBEAT_REQ)");
+ }
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // LCOV_EXCL_BR_LINE 10:Because the last line
diff --git a/systemservice/interface_unified/library/src/ss_sm_client.cpp b/systemservice/interface_unified/library/src/ss_sm_client.cpp
new file mode 100755
index 0000000..664a98d
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_sm_client.cpp
@@ -0,0 +1,1509 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_sm_client_if.h"
+#include <sys/mount.h>
+#include <errno.h>
+#include <string.h>
+#include <fcntl.h>
+
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+
+#include <string>
+
+#include "system_service/ss_system_manager_if.h"
+#include "system_service/ss_system_manager_protocol.h"
+#include "system_service/ss_system_manager_notifications.h"
+#include "system_service/ss_system_if.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_power_service_protocol.h"
+#include "system_service/ss_templates.h"
+#include "system_service/ss_string_maps.h"
+#include "system_service/ss_error_message.h"
+#include "system_service/ss_sm_client_if_local.h"
+
+#include "system_service/ss_boot_map.h"
+#include "ss_system_if_interfaceunifiedlog.h"
+
+typedef struct {
+ BOOL fAvailable;
+ HANDLE hService;
+ std::string szServiceName;
+ std::string strIAm;
+} TSystemManagerSession; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+typedef enum {
+ MODULE_STATE_INVALID = 0, /// Initial state of all modules
+ MODULE_STATE_CONNECTING, /// Attempting to established a session connection
+ MODULE_STATE_CONNECTED, /// A session connection has been established
+ MODULE_STATE_STARTING, /// Received a START from System Manager,
+ /// called FrameworkunifiedOnStart or enqueued evStart
+ MODULE_STATE_START_FAILED, /// Application returned error from FrameworkunifiedOnStart
+ MODULE_STATE_STARTED, /// Sent Start Response to System Manager
+ MODULE_STATE_STOPPING, /// Received a Stop Request from System Manager,
+ /// called FrameworkunifiedOnStop or enqueued evStop
+ MODULE_STATE_STOP_FAILED, /// Application returned error from FrameworkunifiedOnStop
+ MODULE_STATE_STOPPED, /// Sent Start Response to System Manager
+ MODULE_STATE_DEBUG_DUMPING,
+ MODULE_STATE_STARTED_PRE, //!< Sent Pre-Start Response to System Manager
+ MODULE_STATE_START_PRE_FAILED, //!< Application returned error from FrameworkunifiedOnPreStart
+ MODULE_STATE_STOPPED_PRE, //!< Sent Pre-Stop Response to System Manager
+ MODULE_STATE_STOP_PRE_FAILED, //!< Application returned error from FrameworkunifiedOnPreStop
+ MODULE_STATE_STARTED_BACKGROUND, //!< Sent Background-Start Response to System Manager
+ MODULE_STATE_START_BACKGROUND_FAILED, //!< Application returned error from FrameworkunifiedOnBackgroundStart
+ MODULE_STATE_STOPPED_BACKGROUND, //!< Sent Background-Stop Response to System Manager
+ MODULE_STATE_STOP_BACKGROUND_FAILED //!< Application returned error from FrameworkunifiedOnBackgroundStop
+} ModuleStateType;
+
+static SMStopCompleteAck g_responseCompleteAck;
+
+static EFrameworkunifiedStatus OnSystemManagerStart(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerStop(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerPreStart(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerPreStop(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerBackgroundStart(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerBackgroundStop(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerOpenSessionAck(HANDLE hApp);
+static EFrameworkunifiedStatus DebugDumpAppCbStatistics(HANDLE hApp);
+static EFrameworkunifiedStatus DebugDumpMemoryMap(HANDLE hApp);
+static EFrameworkunifiedStatus SystemManagerOpenSender(HANDLE hApp);
+
+static TSystemManagerSession g_tSystemManagerSession = { }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+static pthread_mutex_t gMutexObj = PTHREAD_MUTEX_INITIALIZER;
+
+static EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, UI_32 uiLength,
+ PCVOID pData);
+static EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName,
+ UI_32 uiLength, PCVOID pData);
+
+static EFrameworkunifiedStatus InvokeSyncRequestToSystemManager(UI_32 uiCmd,
+ PCSTR f_pCmdName,
+ UI_32 uiLength, PCVOID pData,
+ UI_32 uiResLength,
+ PVOID pResData);
+
+static EFrameworkunifiedStatus CommonSystemManagerStartStopCallbackProcessing(
+ HANDLE hApp, UI_32 f_InterfaceunifiedEvID, SS_String f_pInterfaceunifiedEvName, CbFuncPtr f_InterfaceunifiedFncCb,
+ PCSTR f_pInterfaceunifiedFncName, ModuleStateType f_moduleSuccessState,
+ ModuleStateType f_moduleFailureState, BOOL f_bUseNotificationVsFncFlag,
+ PCSTR f_pUseNotificationText, SS_SystemManagerProtocol f_ProtocolId,
+ PCSTR f_pProtocolName);
+
+static EFrameworkunifiedStatus SendInterfaceunifiedOnResponseToSystemManager(
+ SS_SystemManagerProtocol f_ProtocolID, PCSTR f_pProtocolName,
+ PCSTR f_InterfaceunifiedOnFncName, ModuleStateType f_moduleSuccessState,
+ ModuleStateType f_moduleFailureState, EFrameworkunifiedStatus f_eStatus);
+
+// Pointer of function which is called when SM OpenSession Ack is received.
+// client can register this function pointer using RegisterSMSessionAckCallback() API
+static CbFuncPtr CallbackFnPtr = NULL;
+
+static BOOL UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc = FALSE;
+
+static VOID LoadCbHandlerCmdIDsIntoDetachCbIDsArray(
+ const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, UI_32 * puiCmdIdArray,
+ UI_32 uiHandlerCount);
+
+static VOID SetModuleState(ModuleStateType f_moduleState, BOOL f_bLog = TRUE);
+
+static ModuleStateType g_moduleState = MODULE_STATE_INVALID;
+extern HANDLE g_SystemIf_hApp;
+
+//******************************************************************************
+void Init_SS_IF_ModuleState_StrMap(
+ std::map<ModuleStateType, SS_String> & m_strMap) { // NOLINT (runtime/references)
+// LCOV_EXCL_BR_START 11:Unexpected branch
+ MAP_ENTRY(m_strMap, MODULE_STATE_INVALID);
+ MAP_ENTRY(m_strMap, MODULE_STATE_CONNECTING);
+ MAP_ENTRY(m_strMap, MODULE_STATE_CONNECTED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STARTING);
+ MAP_ENTRY(m_strMap, MODULE_STATE_START_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STARTED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOPPING);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOP_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOPPED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STARTED_PRE);
+ MAP_ENTRY(m_strMap, MODULE_STATE_START_PRE_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOPPED_PRE);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOP_PRE_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STARTED_BACKGROUND);
+ MAP_ENTRY(m_strMap, MODULE_STATE_START_BACKGROUND_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOPPED_BACKGROUND);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOP_BACKGROUND_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_DEBUG_DUMPING);
+// LCOV_EXCL_BR_STOP
+} // End of void Init_SS_IF_ModuleState_StrMap(std::map<ModuleStateType, SS_String> & m_strMap)
+
+class EnumStringMap<ModuleStateType, Init_SS_IF_ModuleState_StrMap> g_oSS_IF_ModuleStateStrMap;
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(ModuleStateType f_enum) {
+ return g_oSS_IF_ModuleStateStrMap.GetStr(f_enum);
+}
+
+HANDLE GetSystemManagerSessionHandle(void) {
+ return g_tSystemManagerSession.hService;
+} // End of HANDLE GetSystemManagerSessionHandle(void)
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToSystemManagerService(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CallbackFnPtr = NULL;
+
+ /// Avoid opening a session to the SystemManager
+ /// service Since it uses the framework as well
+ if (0 != strcmp(SERVICE_SYSMANAGER, FrameworkunifiedGetAppName(hApp))) {
+ // LCOV_EXCL_BR_LINE 6:Duplicate check(AppName has been checked by the caller)
+ memset(&g_responseCompleteAck, 0, sizeof(g_responseCompleteAck));
+ g_responseCompleteAck.unSessionId = 0;
+ strcpy(g_responseCompleteAck.szServiceName, SERVICE_SYSMANAGER); // NOLINT (runtime/printf)
+
+ pthread_mutex_lock(&gMutexObj);
+
+ /// Need to save the Group and Subgroup values
+ g_tSystemManagerSession.szServiceName = SERVICE_SYSMANAGER;
+ g_tSystemManagerSession.strIAm = FrameworkunifiedGetAppName(hApp);
+
+ /// Cleanup any other data members
+ g_tSystemManagerSession.fAvailable = FALSE;
+ g_tSystemManagerSession.hService = NULL;
+
+ pthread_mutex_unlock(&gMutexObj);
+
+ l_eStatus = SystemManagerOpenSender(hApp);
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SystemManagerOpenSender()");
+ } else {
+ // LCOV_EXCL_START 6:Duplicate check(AppName has been checked by the caller)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " I am SystemManager ! Not registering for '%s' notification",
+ NTFY_SSSystemMgrAvailability);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SystemManagerOpenSender
+///
+///////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus SystemManagerOpenSender(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ pthread_mutex_lock(&gMutexObj);
+
+ // LCOV_EXCL_START 6:Duplicate check(hService is NULL only)
+ if (g_tSystemManagerSession.hService != NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warn: hService != NULL");
+ pthread_mutex_unlock(&gMutexObj);
+ return eFrameworkunifiedStatusFail;
+ }
+ // LCOV_EXCL_STOP
+
+ // opening the service
+ if (NULL
+ == (g_tSystemManagerSession.hService = FrameworkunifiedMcOpenSender(hApp,
+ SERVICE_SYSMANAGER))) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedMcOpenSender(SERVICE_SYSMANAGER)");
+ } else {
+ FrameworkunifiedProtocolCallbackHandler l_SystemManager_Protocol_Cbs[] = {
+ // Command ID, Call back functions
+ { SS_SM_PROTOCOL_OPEN_SESSION_ACK, OnSystemManagerOpenSessionAck },
+ { SS_SM_START, OnSystemManagerStart },
+ { SS_SM_STOP, OnSystemManagerStop },
+ { SS_SM_PRE_START, OnSystemManagerPreStart },
+ { SS_SM_PRE_STOP, OnSystemManagerPreStop },
+ { SS_SM_BACKGROUND_START, OnSystemManagerBackgroundStart },
+ { SS_SM_BACKGROUND_STOP, OnSystemManagerBackgroundStop },
+ { SS_SM_DEBUG_DUMP, OnSystemManagerDebugDump },
+ }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ /// Attach the valid callback for this service
+ if (eFrameworkunifiedStatusOK != // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hApp, SERVICE_SYSMANAGER, l_SystemManager_Protocol_Cbs,
+ _countof(l_SystemManager_Protocol_Cbs)))) {
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher()");
+ } else if (eFrameworkunifiedStatusOK != // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ (l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService,
+ SS_SM_PROTOCOL_OPEN_SESSION_REQ, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: FrameworkunifiedSendMsg(%s) errored: 0x%X/%s",
+ g_tSystemManagerSession.szServiceName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ } // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ pthread_mutex_unlock(&gMutexObj);
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ g_moduleState = MODULE_STATE_CONNECTING;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+}
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerOpenSessionAck
+/// Service Manager OpenSession callback
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnSystemManagerOpenSessionAck(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL == hApp) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("NULL == hApp");
+ } else {
+ pthread_mutex_lock(&gMutexObj);
+ if (NULL == g_tSystemManagerSession.hService) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetOpenSessionHandle()");
+ g_tSystemManagerSession.fAvailable = FALSE;
+ } else {
+ LOG_SUCCESS("FrameworkunifiedGetOpenSessionHandle(hApp)");
+ g_tSystemManagerSession.fAvailable = TRUE;
+ g_moduleState = MODULE_STATE_CONNECTED;
+ }
+ pthread_mutex_unlock(&gMutexObj);
+
+ if ((eFrameworkunifiedStatusOK == l_eStatus) && (CallbackFnPtr != NULL)) {
+ // Call the RegisterSMSessionAckCallback()-registered function
+ if (eFrameworkunifiedStatusOK != (l_eStatus = (CallbackFnPtr)(hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: The 'CallbackFnPtr' function as set by "
+ "the RegisterSMSessionAckCallback() function "
+ "errored: 0x%x/%s",
+ l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // EFrameworkunifiedStatus OnSystemManagerOpenSessionAck( HANDLE hApp )
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////
+/// Macro:
+///
+///////////////////////////////////////////////////////////
+#define SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING( \
+ hApp, evInterfaceunifiedId, InterfaceunifiedFnc, ModStateSuccess, ModStateFailure, \
+ NotifFlag, NotifText, ProtocolId) \
+ l_eStatus = CommonSystemManagerStartStopCallbackProcessing( \
+ hApp, \
+ evInterfaceunifiedId, \
+ #evInterfaceunifiedId, \
+ InterfaceunifiedFnc, \
+ #InterfaceunifiedFnc "()", \
+ ModStateSuccess, \
+ ModStateFailure, \
+ NotifFlag, \
+ NotifText, \
+ ProtocolId, \
+ #ProtocolId); \
+ LOG_STATUS(l_eStatus, \
+ "CommonSystemManagerStartStopCallbackProcessing(" #InterfaceunifiedFnc "())");
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerStart
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnSystemManagerStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart), cbFuncs.onStart, MODULE_STATE_STARTED,
+ MODULE_STATE_START_FAILED, FALSE, "", SS_SM_START_COMPL_RSPN);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerStart( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerStop
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnSystemManagerStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStop), cbFuncs.onStop, MODULE_STATE_STOPPED,
+ MODULE_STATE_STOP_FAILED, UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc,
+ " 'UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc' is 'True': "
+ "setting 'l_eStatus' to 'eFrameworkunifiedStatusFail'",
+ SS_SM_STOP_COMPL_RSPN);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerStop( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerPreStart
+///
+///////////////////////////////////////////////////////////
+static EFrameworkunifiedStatus OnSystemManagerPreStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedPreStart),
+ cbFuncs.onPreStart,
+ MODULE_STATE_STARTED_PRE,
+ MODULE_STATE_START_PRE_FAILED,
+ FALSE,
+ "",
+ SS_SM_PRE_START_COMPL_RSPN);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerPreStart( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerPreStop
+///
+///////////////////////////////////////////////////////////
+static EFrameworkunifiedStatus OnSystemManagerPreStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedPreStop),
+ cbFuncs.onPreStop,
+ MODULE_STATE_STOPPED_PRE,
+ MODULE_STATE_STOP_PRE_FAILED,
+ FALSE,
+ "",
+ SS_SM_PRE_STOP_COMPL_RSPN);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerPreStop( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerBackgroundStart
+///
+///////////////////////////////////////////////////////////
+static EFrameworkunifiedStatus OnSystemManagerBackgroundStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedBackgroundStart),
+ cbFuncs.onBackgroundStart,
+ MODULE_STATE_STARTED_BACKGROUND,
+ MODULE_STATE_START_BACKGROUND_FAILED,
+ FALSE,
+ "",
+ SS_SM_BACKGROUND_START_COMPL_RSPN);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerBackgroundStart( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerBackgroundStop
+///
+///////////////////////////////////////////////////////////
+static EFrameworkunifiedStatus OnSystemManagerBackgroundStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedBackgroundStop),
+ cbFuncs.onBackgroundStop,
+ MODULE_STATE_STOPPED_BACKGROUND,
+ MODULE_STATE_STOP_BACKGROUND_FAILED,
+ FALSE,
+ "",
+ SS_SM_BACKGROUND_STOP_COMPL_RSPN);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerBackgroundStop( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: CommonSystemManagerStartStopCallbackProcessing
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CommonSystemManagerStartStopCallbackProcessing(
+ HANDLE hApp, UI_32 f_InterfaceunifiedEvID, SS_String f_pInterfaceunifiedEvName, CbFuncPtr f_InterfaceunifiedFncCb,
+ PCSTR f_pInterfaceunifiedFncName, ModuleStateType f_moduleSuccessState,
+ ModuleStateType f_moduleFailureState, BOOL f_bUseNotificationVsFncFlag,
+ PCSTR f_pUseNotificationText, SS_SystemManagerProtocol f_ProtocolId,
+ PCSTR f_pProtocolName) {
+ EFrameworkunifiedStatus l_eStatus;
+ EFrameworkunifiedStatus l_StatusFncReturned;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SS_String l_pInterfaceunifiedFncName;
+
+ if (f_moduleSuccessState == g_moduleState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Module state already is '%s', just "
+ "returning '%s' to System Manager",
+ GetStr(g_moduleState).c_str(), f_pProtocolName);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ l_StatusFncReturned = l_eStatus;
+ } else {
+ // If client application is a state machine, post an Event instead of calling
+ // InterfaceunifiedOnXYZ()
+ if (FrameworkunifiedIsStateMachineApp(hApp)) {
+ l_pInterfaceunifiedFncName = "FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(" + f_pInterfaceunifiedEvName + " ))";
+ CFrameworkunifiedHSMFramework* l_pStateMachine = FrameworkunifiedGetStateMachine(hApp);
+ if (NULL == l_pStateMachine) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetStateMachine()");
+ l_StatusFncReturned = l_eStatus;
+ } else {
+ l_eStatus = l_pStateMachine->FrameworkunifiedPostEvent(f_InterfaceunifiedEvID);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: l_pStateMachine->FrameworkunifiedPostEvent(%s) "
+ "errored: %d/'%s'",
+ f_pInterfaceunifiedEvName.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+ l_StatusFncReturned = l_eStatus;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " f_bUseNotificationVsFncFlag is '%s'",
+ GetStr(f_bUseNotificationVsFncFlag).c_str());
+ if (f_bUseNotificationVsFncFlag) {
+ //
+ // DON'T send an 'Ok' back to the SendInterfaceunifiedOnResponse function: if
+ // it detects a 'Ok' it will send a SS_SM_<protocol>_RSPN back
+ // to System Manager, telling System Manager that the request
+ // has been completely serviced.
+ l_StatusFncReturned = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", f_pUseNotificationText);
+ } else {
+ //
+ // Always send an 'Ok' back for the evInterfaceunified<protocol> version
+ // of InterfaceunifiedOn<protocol>; the l_eStatus applies to the
+ // FrameworkunifiedPostEvent() function, not the actual <protocol> event
+ // handler.
+ l_StatusFncReturned = eFrameworkunifiedStatusOK;
+ }
+ } // End else successful FrameworkunifiedPostEvent()
+ } // End else valid FrameworkunifiedGetStateMachine()
+ } else { // End if FrameworkunifiedIsStateMachineApp() is TRUE
+ l_pInterfaceunifiedFncName = f_pInterfaceunifiedFncName;
+ if (f_InterfaceunifiedFncCb) {
+ l_eStatus = (f_InterfaceunifiedFncCb)(hApp);
+ LOG_STATUS(l_eStatus, f_pInterfaceunifiedFncName);
+ l_StatusFncReturned = l_eStatus;
+ } else {
+ SS_ASERT(0);
+ l_StatusFncReturned = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+
+ l_eStatus = SendInterfaceunifiedOnResponseToSystemManager(f_ProtocolId, f_pProtocolName,
+ l_pInterfaceunifiedFncName.c_str(),
+ f_moduleSuccessState,
+ f_moduleFailureState,
+ l_StatusFncReturned);
+ const char l_cFormat[] = "SendInterfaceunifiedOnResponseToSystemManager(%s)";
+ char l_cBuf[sizeof(l_cFormat) + strlen(f_pProtocolName) + 1]; // NOLINT (runtime/arrays)
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, f_pProtocolName);
+ LOG_STATUS_IF_ERRORED(l_eStatus, l_cBuf);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of CommonSystemManagerStartStopCallbackProcessing(
+
+
+///////////////////////////////////////////////////////////
+/// Function: SendInterfaceunifiedOnStopResponseToSystemManager()
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInterfaceunifiedOnStopResponseToSystemManager(EFrameworkunifiedStatus f_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendInterfaceunifiedOnResponseToSystemManager(
+ SS_SM_STOP_COMPL_RSPN, "SS_SM_STOP_COMPL_RSPN", "FrameworkunifiedOnStop()",
+ MODULE_STATE_STOPPED, MODULE_STATE_STOP_FAILED, f_eStatus);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendInterfaceunifiedOnResponseToSystemManager("
+ "SS_SM_STOP_COMPL_RSPN");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendInterfaceunifiedOnStopResponseToSystemManager(EFrameworkunifiedStatus f_eStatus)
+
+///////////////////////////////////////////////////////////
+/// Function: GetInterfaceunifiedOnStartExtInfo()
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetInterfaceunifiedOnStartExtInfo(T_SS_SM_START_ExtDataStructType &f_info) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = InvokeSyncRequestToSystemManager(
+ SS_SM_GET_START_EXT_INFO, "SS_SM_GET_START_EXT_INFO", 0, NULL,
+ sizeof(T_SS_SM_START_ExtDataStructType), (PVOID) & f_info);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: GetInterfaceunifiedOnStopExtInfo()
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetInterfaceunifiedOnStopExtInfo(T_SS_SM_STOP_ExtDataStructType &f_info) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = InvokeSyncRequestToSystemManager(
+ SS_SM_GET_STOP_EXT_INFO, "SS_SM_GET_STOP_EXT_INFO", 0, NULL,
+ sizeof(T_SS_SM_STOP_ExtDataStructType), (PVOID) & f_info);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerDebugDump
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnSystemManagerDebugDump(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+
+ g_moduleState = MODULE_STATE_DEBUG_DUMPING;
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ if (cbFuncs.onDebugDump) {
+ l_eStatus = cbFuncs.onDebugDump(hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedOnDebugDump()");
+ } else {
+ SS_ASERT(0);
+ }
+
+ l_eStatus = DebugDumpAppCbStatistics(hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "DebugDumpAppCbStatistics()");
+
+ l_eStatus = DebugDumpMemoryMap(hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "DebugDumpMemoryMap()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerDebugDump( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: DebugDumpAppCbStatistics
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DebugDumpAppCbStatistics(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+l_eStatus = eFrameworkunifiedStatusOK;
+
+FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: DebugDumpMemoryMap
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DebugDumpMemoryMap(HANDLE hApp) {
+#define MEM_MAP_READ_SIZE 4096
+#define DUMP_MAX_SIZE 131072 // 128KB
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ char buf[MEM_MAP_READ_SIZE];
+ std::string bufString;
+ int fd, ret;
+
+ fd = open("/proc/self/maps", O_RDONLY);
+ if (fd != -1) {
+ while ((ret = read(fd, buf, MEM_MAP_READ_SIZE)) > 0) {
+ if ((bufString.size() + ret) > DUMP_MAX_SIZE) {
+ // If read it again, it will break because it overflows
+ break;
+ }
+ bufString.append(buf, ret);
+ }
+ close(fd);
+ if (ret >= 0) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ SendDebugDumpResponseToSystemManager(bufString);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// SendDebugDumpResponseToSystemManager
+//////////////////////////////////////////
+VOID SendDebugDumpResponseToSystemManager(BOOL f_bFormatStrRequired,
+ PCSTR f_cFormat, ...) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ va_list l_argList;
+ const UI_32 l_maxDebugDumpMsgSize = (1024 * 4);
+ CHAR l_cMsg[l_maxDebugDumpMsgSize] = { 0 };
+ PCSTR l_pAppName;
+
+ pthread_mutex_lock(&gMutexObj);
+
+ l_pAppName = FrameworkunifiedGetAppName(g_SystemIf_hApp); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ if (f_bFormatStrRequired) {
+ // build a format string
+ // Format: AppName/debugdump_data
+ snprintf(l_cMsg, l_maxDebugDumpMsgSize, "%s/", l_pAppName);
+ }
+
+ va_start(l_argList, f_cFormat);
+ vsnprintf(&l_cMsg[strlen(l_cMsg)], l_maxDebugDumpMsgSize - strlen(l_cMsg),
+ f_cFormat, l_argList);
+ va_end(l_argList);
+
+ if (0 == strcmp(SERVICE_SYSMANAGER, l_pAppName)) {
+ l_eStatus = FrameworkunifiedSendSelf(g_SystemIf_hApp, SS_SM_DEBUG_DUMP_RSPN,
+ strlen(l_cMsg) + 1, l_cMsg); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendSelf(SS_SM_DEBUG_DUMP_RSPN)");
+ } else if (NULL != g_tSystemManagerSession.hService) {
+ l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService,
+ SS_SM_DEBUG_DUMP_RSPN, strlen(l_cMsg) + 1, l_cMsg); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg(SS_SM_DEBUG_DUMP_RSPN)");
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Invalid handle[g_tSystemManagerSession.hService == NULL]");
+ }
+
+ pthread_mutex_unlock(&gMutexObj);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // End of EFrameworkunifiedStatus SendDebugDumpResponseToSystemManager( HANDLE hApp )
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+//////////////////////////////////////////
+// SendDebugDumpResponseToSystemManager
+//////////////////////////////////////////
+VOID SendDebugDumpResponseToSystemManager(std::string & f_messageStr) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ pthread_mutex_lock(&gMutexObj);
+
+ if (0 == strcmp(SERVICE_SYSMANAGER, FrameworkunifiedGetAppName(g_SystemIf_hApp))) {
+ l_eStatus = FrameworkunifiedSendSelf(g_SystemIf_hApp, SS_SM_DEBUG_DUMP_RSPN,
+ f_messageStr.size() + 1, f_messageStr.c_str());
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendSelf(SS_SM_DEBUG_DUMP_RSPN)");
+ } else if (NULL != g_tSystemManagerSession.hService) {
+ l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService,
+ SS_SM_DEBUG_DUMP_RSPN, f_messageStr.size() + 1,
+ f_messageStr.c_str());
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg(SS_SM_DEBUG_DUMP_RSPN)");
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: hService = NULL");
+ }
+
+ pthread_mutex_unlock(&gMutexObj);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // End of EFrameworkunifiedStatus SendDebugDumpResponseToSystemManager(std::string & f_messageStr)
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////
+/// Function: SendInterfaceunifiedOnResponseToSystemManager()
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInterfaceunifiedOnResponseToSystemManager(
+ SS_SystemManagerProtocol f_ProtocolID, PCSTR f_pProtocolName,
+ PCSTR f_InterfaceunifiedOnFncName, ModuleStateType f_moduleSuccessState,
+ ModuleStateType f_moduleFailureState, EFrameworkunifiedStatus f_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (eFrameworkunifiedStatusOK != f_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: '%s' returned %d/%s, NOT sending '%s' to System Manager",
+ f_InterfaceunifiedOnFncName, f_eStatus, GetStr(f_eStatus).c_str(),
+ f_pProtocolName);
+ l_eStatus = f_eStatus;
+ SetModuleState(f_moduleFailureState);
+ } else {
+ if (f_moduleSuccessState == g_moduleState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Module state already is '%s', just "
+ "returning '%s' to System Manager",
+ GetStr(g_moduleState).c_str(), f_pProtocolName);
+ }
+
+ l_eStatus = SendMsgToSystemManager(static_cast<UI_32>(f_ProtocolID),
+ f_pProtocolName,
+ sizeof(g_responseCompleteAck),
+ &g_responseCompleteAck); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ const char l_cFormat[] = "SendMsgToSystemManager(%s)";
+ char l_cBuf[sizeof(l_cFormat) + strlen(f_pProtocolName) + 1]; // NOLINT (runtime/arrays)
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, f_pProtocolName);
+ LOG_STATUS(l_eStatus, l_cBuf);
+ SetModuleState(f_moduleSuccessState);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of SendInterfaceunifiedOnResponseToSystemManager(
+
+///////////////////////////////////////////////////////////
+/// Function: SendMsgToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName, UI_32 uiLength,
+ PCVOID pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Sending %s", f_pCmdName);
+
+ return SendMsgToSystemManager(uiCmd, uiLength, pData);
+} // End of EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName, UI_32 uiLength, PCVOID pData)
+
+///////////////////////////////////////////////////////////
+/// Function: SendMsgToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, UI_32 uiLength, PCVOID pData) {
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == g_tSystemManagerSession.hService) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("NULL == g_tSystemManagerSession.hService");
+ } else {
+ pthread_mutex_lock(&gMutexObj);
+ l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService, uiCmd, uiLength,
+ pData);
+ pthread_mutex_unlock(&gMutexObj);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg()");
+ }
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, UI_32 uiLength, PCVOID pData)
+
+///////////////////////////////////////////////////////////
+/// Function: InvokeSyncRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus InvokeSyncRequestToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName,
+ UI_32 uiLength, PCVOID pData,
+ UI_32 uiResLength, PVOID pResData) {
+ EFrameworkunifiedStatus l_eStatus;
+ UI_32 uiRcvLength = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Sending %s", f_pCmdName);
+
+ if (NULL == g_tSystemManagerSession.hService) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("NULL == g_tSystemManagerSession.hService");
+ } else {
+ pthread_mutex_lock(&gMutexObj);
+ l_eStatus = FrameworkunifiedInvokeSync(g_tSystemManagerSession.hService, uiCmd, uiLength,
+ pData, uiResLength, pResData, &uiRcvLength); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (uiResLength != uiRcvLength) {
+ LOG_ERROR("uiResLength != uiRcvLength");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ pthread_mutex_unlock(&gMutexObj);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedInvokeSync()");
+ }
+ return l_eStatus;
+} // End of Function
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: SendWakeUpToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendWakeUpToSystemManager(wakeInfo *pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_WAKEUP_MODULES,
+ "SS_SM_WAKEUP_MODULES",
+ sizeof(wakeInfo),
+ (PCVOID) pData);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendWakeUpToSystemManager(wakeInfo *pData)
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: SendShutdownToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendShutdownToSystemManager(Pwr_ServiceSetInterface *pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_SHUTDOWN_MODULES,
+ "SS_SM_SHUTDOWN_MODULES",
+ sizeof(Pwr_ServiceSetInterface),
+ (PCVOID) pData);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendShutdownToSystemManager(Pwr_ServiceSetInterface *pData)
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////
+/// Function: RegisterSMSessionAckCallback
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RegisterSMSessionAckCallback(EFrameworkunifiedStatus (*CallbackPtr)(HANDLE)) {
+ CallbackFnPtr = CallbackPtr;
+ return eFrameworkunifiedStatusOK;
+} // End of EFrameworkunifiedStatus RegisterSMSessionAckCallback(EFrameworkunifiedStatus (*CallbackPtr)(HANDLE))
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: SendSystemModeRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendSystemModeRequestToSystemManager(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_SYSTEM_MODE_INFO_REQ,
+ "SS_SM_SYSTEM_MODE_INFO_REQ", 0,
+ NULL);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendSystemModeRequestToSystemManager(void)
+
+///////////////////////////////////////////////////////////
+/// Function: SendInitCompReportToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInitCompReportToSystemManager(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_INITCOMP_REP,
+ "SS_SM_INITCOMP_REP", 0, NULL);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendInitCompReportToSystemManager(void)
+
+
+///////////////////////////////////////////////////////////
+/// Function: AttachCallbackToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus AttachCallbackToSystemManager(HANDLE hApp, UI_32 iCmd,
+ CbFuncPtr fpOnCmd) {
+ return FrameworkunifiedAttachCallbackToDispatcher(
+ hApp, g_tSystemManagerSession.szServiceName.c_str(), iCmd, fpOnCmd);
+} // End of EFrameworkunifiedStatus AttachCallbackToSystemManager( HANDLE hApp, UI_32 iCmd, CbFuncPtr fpOnCmd )
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////
+/// Function: SetDataResetModeToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetDataResetModeToSystemManager(ESMDataResetModeInfo dataResetMode) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_resData;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ switch (dataResetMode) {
+ case e_SS_SM_DATA_RESET_MODE_NONE:
+ case e_SS_SM_DATA_RESET_MODE_USER:
+ case e_SS_SM_DATA_RESET_MODE_FACTORY:
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "dataResetMode %d", dataResetMode);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ l_eStatus = InvokeSyncRequestToSystemManager(SS_SM_DATA_RESET_MODE_SET_REQ,
+ "SS_SM_DATA_RESET_MODE_SET_REQ",
+ sizeof(dataResetMode),
+ (PVOID) & dataResetMode,
+ sizeof(l_resData),
+ (PVOID) & l_resData); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()");
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (eFrameworkunifiedStatusOK != l_resData) {
+ l_eStatus = l_resData;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " l_eStatus %d", l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SetDataResetModeToSystemManager(ESMDataResetModeInfo dataResetMode)
+
+///////////////////////////////////////////////////////////
+/// Function: SetProgUpdateStateToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetProgUpdateStateToSystemManager(
+ SMProgUpdateState progUpdateState) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_resData;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (progUpdateState & SS_SM_PROG_UPDATE_STATE_UPDATED) {
+ } else if (progUpdateState & SS_SM_PROG_UPDATE_STATE_MAP_UPDATED) {
+ } else if (progUpdateState & SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED) {
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "unknown %#x", progUpdateState);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ l_eStatus = InvokeSyncRequestToSystemManager(
+ SS_SM_PROG_UPDATE_STATE_SET_REQ, "SS_SM_PROG_UPDATE_STATE_SET_REQ",
+ sizeof(progUpdateState), (PVOID) & progUpdateState, sizeof(l_resData),
+ (PVOID) & l_resData); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()");
+
+ if ((eFrameworkunifiedStatusOK == l_eStatus) && (eFrameworkunifiedStatusOK != l_resData)) {
+ l_eStatus = l_resData;
+ LOG_ERROR("SM RESP");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SetProgUpdateStateToSystemManager(SMProgUpdateState progUpdateState)
+
+///////////////////////////////////////////////////////////
+/// Function: SetNextWakeupTypeToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetNextWakeupTypeToSystemManager(ESMNextWakeupType f_wakeupType) {
+ EFrameworkunifiedStatus l_eStatus;
+ EFrameworkunifiedStatus l_resData;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ switch (f_wakeupType) {
+ case e_SS_SM_NEXT_WAKEUP_TYPE_NONE:
+ case e_SS_SM_NEXT_WAKEUP_TYPE_COLD:
+ case e_SS_SM_NEXT_WAKEUP_TYPE_HOT:
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "unknown type(%d)", f_wakeupType);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ l_eStatus = InvokeSyncRequestToSystemManager(SS_SM_NEXT_WAKEUP_TYPE_SET_REQ,
+ "SS_SM_NEXT_WAKEUP_TYPE_SET_REQ",
+ sizeof(f_wakeupType),
+ (PVOID) & f_wakeupType,
+ sizeof(l_resData),
+ (PVOID) & l_resData); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()");
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (eFrameworkunifiedStatusOK != l_resData) {
+ l_eStatus = l_resData;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " l_eStatus %d", l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SendCpuResetRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendCpuResetRequestToSystemManager(
+ ESMCpuResetReason l_eCpuResetReason, std::string f_messageStr/* = "" */,
+ std::string f_suffixStr/* = "" */) {
+ TSystemManagerCpuResetInfo l_resetInfo; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_resetInfo.resetReason = l_eCpuResetReason;
+ snprintf(l_resetInfo.messageStr, SS_SM_RESET_MSG_STR_SIZE, "%s",
+ f_messageStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ snprintf(l_resetInfo.suffixStr, SS_SM_SUFFIX_STR_SIZE, "%s",
+ f_suffixStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_CPU_RESET_REQ, "SS_SM_CPU_RESET_REQ",
+ sizeof(l_resetInfo),
+ (PVOID) & l_resetInfo); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of SendCpuResetRequestToSystemManager
+
+///////////////////////////////////////////////////////////
+/// Function: SendStartupConfirmationToSystemManager
+///
+///////////////////////////////////////////////////////////
+// LCOV_EXCL_START 6:Because the condition cannot be set
+EFrameworkunifiedStatus SendStartupConfirmationToSystemManager(
+ StartupConfirmationMsgStrut &f_startupConfirmationMsg) { //NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ Pwr_ServiceSetInterface tServiceSetIf;
+ tServiceSetIf.data.startupConfirmationMsg = f_startupConfirmationMsg;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ,
+ "SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ",
+ sizeof(Pwr_ServiceSetInterface),
+ (PCVOID) & tServiceSetIf);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendStartupConfirmationToSystemManager(
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+EFrameworkunifiedStatus SendSystemErrorToSystemManager(EFrameworkunifiedSystemError f_systemError) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_PROPAGATE_SYSTEM_ERROR,
+ sizeof(f_systemError),
+ reinterpret_cast<void*>(&f_systemError));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus Send_CWORD56_HeartBeatRequestToSystemManager(
+ EPWR_HB_REQ_MSG_STRUCT f_HbReq) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM__CWORD56__HEARTBEAT_REQ,
+ sizeof(f_HbReq),
+ reinterpret_cast<void*>(&f_HbReq));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+VOID Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar(BOOL f_SetTrue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc = f_SetTrue;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc set '%s'",
+ UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc ? "True" : "False");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus SendBootMicroResetNotificationToSystemManager(
+ eSMBootMicroResetReason f_ResetReason) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_BOOT_MICRO_RESET_NTF,
+ "SS_SM_BOOT_MICRO_RESET_NTF",
+ sizeof(f_ResetReason), &f_ResetReason);
+
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendMsgToSystemManager(SS_SM_BOOT_MICRO_RESET_NTF)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus SendUserInvokedLoggingRequestToSystemManager(
+ eSMUserLogType f_userInvokedLogType, std::string f_messageStr/* = "" */,
+ std::string f_suffixStr/* = "" */) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ switch (f_userInvokedLogType) {
+ case e_SS_SM_CAPTURE_ALL_LOGS:
+ case e_SS_SM_SCREEN_CAPTURE:
+ case e_SS_SM_CAPTURE_INTERFACEUNIFIED_LOGS:
+ case e_SS_SM_CAPTURE_DEV_LOGS:
+ case e_SS_SM_CAPTURE_MODULE_LOGS:
+ case e_SS_SM_CAPTURE_DTC_LOGS:
+ case e_SS_SM_CAPTURE_NAVI_LOGS:
+ case e_SS_SM_CAPTURE_GROUP_RELAUNCH:
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Unknown key ID '%d'",
+ f_userInvokedLogType);
+ throw eFrameworkunifiedStatusInvldParam;
+ break;
+ }
+
+ TSystemManagerLoggingRequestInfo l_logInfo = { };
+
+ snprintf(l_logInfo.messageStr, SS_SM_LOG_MSG_STR_SIZE, "%s",
+ f_messageStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ snprintf(l_logInfo.suffixStr, SS_SM_SUFFIX_STR_SIZE, "%s",
+ f_suffixStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ l_logInfo.logType = f_userInvokedLogType;
+ l_eStatus = SendMsgToSystemManager(SS_SM_USER_INVOKED_LOG_REQ,
+ "SS_SM_USER_INVOKED_LOG_REQ",
+ sizeof(l_logInfo), &l_logInfo); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendMsgToSystemManager(SS_SM_USER_INVOKED_LOG_REQ)");
+ } catch (EFrameworkunifiedStatus e) {
+ l_eStatus = e;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+}
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+EFrameworkunifiedStatus SendDiagLoggingRequestToSystemManager(
+ std::string f_copyDestPathStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_DIAG_LOG_REQ,
+ "SS_SM_ERROR_EVENT_DIAG_LOG_REQ",
+ f_copyDestPathStr.length() + 1,
+ f_copyDestPathStr.c_str());
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_DIAG_LOG_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus SendCANLoggingRequestToSystemManager(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_CAN_LOG_REQ,
+ "SS_SM_ERROR_EVENT_CAN_LOG_REQ", 0, NULL);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_CAN_LOG_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus SendDTCLoggingRequestToSystemManager(UI_32 f_dtc) {
+ SS_ASERT(0);
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus RegisterBootMicroLogRequestCb(HANDLE hApp, CbFuncPtr fpOnCmd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == hApp) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("(NULL == hApp)");
+ } else if (NULL == fpOnCmd) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("(NULL == fpOnCmd)");
+ } else {
+ l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback(
+ hApp, SS_SM_BOOT_MICRO_LOG_REQ, fpOnCmd,
+ g_tSystemManagerSession.hService); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "FrameworkunifiedSubscribeToSessionEventWithCallback(SS_SM_BOOT_MICRO_LOG_REQ)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus SendBootMicroLogResponseToSystemManager(std::string f_logString) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_BOOT_MICRO_LOG_RSP,
+ "SS_SM_BOOT_MICRO_LOG_RSP",
+ f_logString.size() + 1,
+ f_logString.c_str());
+
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendMsgToSystemManager(SS_SM_BOOT_MICRO_LOG_RSP)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+EFrameworkunifiedStatus DetachCallbacksFromInterfaceunifiedDispatcher(
+ HANDLE hApp, PCSTR pServiceName,
+ const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, UI_32 uiHandlerCount,
+ HANDLE hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ PUI_32 l_puiCmdIdArray;
+
+ if (NULL == pServiceName) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("NULL == pServiceName");
+ } else if (NULL == pMsgHandler) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("NULL == pMsgHandler");
+ } else if (0 == uiHandlerCount) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("0 == uiHandlerCount");
+ } else if (NULL == hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("NULL == hSession");
+ } else if (NULL
+ == (l_puiCmdIdArray = new (std::nothrow) UI_32[uiHandlerCount])) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("new (std::nothrow)UI_32[ uiHandlerCount ]");
+ } else {
+ LoadCbHandlerCmdIDsIntoDetachCbIDsArray(pMsgHandler, l_puiCmdIdArray,
+ uiHandlerCount);
+
+ l_eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hApp, pServiceName,
+ l_puiCmdIdArray,
+ uiHandlerCount, hSession);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedDetachCallbacksFromDispatcher()");
+ delete[] l_puiCmdIdArray;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus DetachCallbacksFromInterfaceunifiedDispatcher(HANDLE hApp,
+
+EFrameworkunifiedStatus DetachParentCallbacksFromInterfaceunifiedDispatcher(
+ HANDLE hApp, const FrameworkunifiedProtocolCallbackHandler* pMsgHandler,
+ UI_32 uiHandlerCount) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ PUI_32 l_puiCmdIdArray;
+
+ if (NULL == pMsgHandler) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("NULL == pMsgHandler");
+ } else if (0 == uiHandlerCount) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("0 == uiHandlerCount");
+ } else if (NULL
+ == (l_puiCmdIdArray = new (std::nothrow) UI_32[uiHandlerCount])) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("new (std::nothrow)UI_32[ uiHandlerCount ]");
+ } else {
+ LoadCbHandlerCmdIDsIntoDetachCbIDsArray(pMsgHandler, l_puiCmdIdArray,
+ uiHandlerCount);
+
+ l_eStatus = FrameworkunifiedDetachParentCallbacksFromDispatcher(hApp, l_puiCmdIdArray,
+ uiHandlerCount);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedDetachParentCallbacksFromDispatcher()");
+ delete[] l_puiCmdIdArray;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus DetachParentCallbacksFromInterfaceunifiedDispatcher(HANDLE hApp,
+
+VOID LoadCbHandlerCmdIDsIntoDetachCbIDsArray(
+ const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, UI_32 * puiCmdIdArray,
+ UI_32 uiHandlerCount) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ for (UI_32 i = 0; i < uiHandlerCount; i++) {
+ puiCmdIdArray[i] = pMsgHandler[i].iCmd;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // End of VOID LoadCbHandlerCmdIDsIntoDetachCbIDsArray(const FrameworkunifiedProtocolCallbackHandler* pMsgHandler,
+
+///////////////////////////////////////////////////////////
+/// Function: SendLogStartRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogStartRequestToSystemManager(EErrorEventType f_errorEvent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_START_REQ,
+ "SS_SM_ERROR_EVENT_LOGGING_START_REQ",
+ sizeof(f_errorEvent), &f_errorEvent);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_START_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SendLogArtifactRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogArtifactRequestToSystemManager(EArtifactId f_artifactId) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_ARTIFACT_REQ,
+ "SS_SM_ERROR_EVENT_ARTIFACT_REQ",
+ sizeof(f_artifactId), &f_artifactId);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_ARTIFACT_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SendLogCompleteRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogCompleteRequestToSystemManager(EFrameworkunifiedStatus f_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (eFrameworkunifiedStatusOK != f_eStatus) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_eStatus = f_eStatus;
+ }
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_COMPLETE,
+ "SS_SM_ERROR_EVENT_LOGGING_COMPLETE",
+ sizeof(l_eStatus), &l_eStatus);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_COMPLETE)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SendEelExportRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendEelExportRequestToSystemManager(std::string f_path) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_EEL_EXPORT_REQ,
+ "SS_SM_ERROR_EVENT_EEL_EXPORT_REQ",
+ f_path.length() + 1, f_path.c_str());
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_EEL_EXPORT_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////
+/// Function: SendInterfaceunifiedEmmcLogsRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInterfaceunifiedEmmcLogsRequestToSystemManager(std::string f_path) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ,
+ "SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ",
+ f_path.length() + 1, f_path.c_str());
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SendClearLogsRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendClearLogsRequestToSystemManager(
+ TSystemManagerClearLogsInfo *f_info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (!f_info) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_CLR_LOGS_REQ,
+ "SS_SM_ERROR_EVENT_CLR_LOGS_REQ", 0,
+ NULL);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_CLR_LOGS_REQ)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+VOID SetModuleState(ModuleStateType f_moduleState, BOOL f_bLog) {
+ if (f_bLog) { // LCOV_EXCL_BR_LINE 8:f_bLog is true only
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Changing SM_IF state from '%s' to '%s'",
+ GetStr(g_moduleState).c_str(), GetStr(f_moduleState).c_str());
+ }
+ g_moduleState = f_moduleState;
+} // LCOV_EXCL_BR_LINE 10:Because the last line
+// End of VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState )
+
+// EOF /SS_SystemIf/src/ss_sm_client.cpp
diff --git a/systemservice/interface_unified/library/src/ss_string_maps.cpp b/systemservice/interface_unified/library/src/ss_string_maps.cpp
new file mode 100755
index 0000000..629043a
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_string_maps.cpp
@@ -0,0 +1,462 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "system_service/ss_string_maps.h"
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+#include <map>
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_templates.h"
+#include "system_service/ss_system_manager_if.h"
+#include "system_service/ss_system_manager_protocol.h"
+#include "ss_system_if_interfaceunifiedlog.h"
+
+/*
+ * 't'emplate for string-map initialization functions
+void Init_SS_xyz_StrMap(std::map<SS_xyz, SS_String> &m_strMap)
+{
+ MAP_ENTRY( m_strMap, );
+ MAP_ENTRY( m_strMap, );
+} // End of void Init_SS_xyz_StrMap(std::map<SS_xyz, SS_String> &m_strMap)
+*/
+
+
+//******************************************************************************
+void Init_eSMBootMicroResetReason_StrMap(std::map<eSMBootMicroResetReason,
+ SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_USER_FORCE_RESET);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_DSP_RESET);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_HB_TIMEOUT);
+}
+class EnumStringMap< eSMBootMicroResetReason,
+ Init_eSMBootMicroResetReason_StrMap>
+ m_oeSMBootMicroResetReasonMap;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(eSMBootMicroResetReason f_enum) {
+ return m_oeSMBootMicroResetReasonMap.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_EInterfaceunifiedSystemError_StrMap(std::map<EFrameworkunifiedSystemError, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, eFrameworkunifiedSystemErrorNone);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedDSPHardwareReset);
+}
+class EnumStringMap< EFrameworkunifiedSystemError, Init_EInterfaceunifiedSystemError_StrMap> m_oEInterfaceunifiedSystemErrorMap;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(EFrameworkunifiedSystemError f_enum) {
+ return m_oEInterfaceunifiedSystemErrorMap.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_EErrorEventType_StrMap(std::map<EErrorEventType, SS_String> & m_strMap); // NOLINT (runtime/references)
+class EnumStringMap< EErrorEventType, Init_EErrorEventType_StrMap> m_oEErrorEventTypeMap;
+SS_String GetStr(EErrorEventType f_enum) {
+ return m_oEErrorEventTypeMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_BOOL_StrMap(std::map<BOOL, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, TRUE);
+ MAP_ENTRY(m_strMap, FALSE);
+} // End of void Init_BOOL_StrMap(std::map<BOOL, SS_String> & m_strMap)
+class EnumStringMap< BOOL, Init_BOOL_StrMap> m_oBOOLMap;
+SS_String GetStr(BOOL f_enum) {
+ return m_oBOOLMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_LimpHomeCutoff_StrMap(std::map<EPWR_LHC_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epslhcINVALID);
+ MAP_ENTRY(m_strMap, epslhcDISABLED);
+ MAP_ENTRY(m_strMap, epslhcENABLED);
+} // End of void Init_SS_LimpHomeCutoff_StrMap(std::map<EPWR_LHC_TYPE, SS_String> & m_strMap)
+class EnumStringMap< EPWR_LHC_TYPE, Init_SS_LimpHomeCutoff_StrMap> m_oSS_LimpHomeCutoffMap;
+SS_String GetStr(EPWR_LHC_TYPE f_enum) {
+ return m_oSS_LimpHomeCutoffMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_ProductionMode_StrMap(std::map<EPWR_PROD_MODE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epspmINVALID);
+ MAP_ENTRY(m_strMap, epspmDISABLED);
+ MAP_ENTRY(m_strMap, epspmENABLED);
+} // End of void Init_SS_ProductionMode_StrMap(std::map<EPWR_PROD_MODE_TYPE, SS_String> & m_strMap)
+class EnumStringMap< EPWR_PROD_MODE_TYPE, Init_SS_ProductionMode_StrMap>
+ m_oSS_ProductionModeMap;
+SS_String GetStr(EPWR_PROD_MODE_TYPE f_enum) {
+ return m_oSS_ProductionModeMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_StartupStage_StrMap(std::map<EPWR_STARTUP_STAGE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epssusfINVALID);
+ MAP_ENTRY(m_strMap, epssusSYSTEM_SERVICES_STARTED);
+ MAP_ENTRY(m_strMap, epssusALL_SERVICES_LAUNCHED);
+} // End of void Init_SS_StartupStage_StrMap(std::map<EPWR_STARTUP_STAGE_TYPE, SS_String> & m_strMap)
+class EnumStringMap< EPWR_STARTUP_STAGE_TYPE, Init_SS_StartupStage_StrMap>
+ m_oSS_StartupStageMap;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(EPWR_STARTUP_STAGE_TYPE f_enum) {
+ return m_oSS_StartupStageMap.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_SS_SystemMode_StrMap(std::map<EPWR_SYSTEM_MODE_INFO, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epssinfINVALID);
+ MAP_ENTRY(m_strMap, epssinfNORMAL);
+ MAP_ENTRY(m_strMap, epssinfPROGRAMMING);
+} // End of void Init_SS_SystemMode_StrMap(std::map<EPWR_SYSTEM_MODE_INFO, SS_String> & m_strMap)
+class EnumStringMap< EPWR_SYSTEM_MODE_INFO, Init_SS_SystemMode_StrMap>
+ m_oSS_SystemModeMap;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(EPWR_SYSTEM_MODE_INFO f_enum) {
+ return m_oSS_SystemModeMap.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_SS_TransportMode_StrMap(std::map<EPWR_TRANSPORT_MODE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epstmINVALID);
+ MAP_ENTRY(m_strMap, epstmDISABLED);
+ MAP_ENTRY(m_strMap, epstmENABLED);
+} // End of void Init_SS_TransportMode_StrMap(std::map<EPWR_TRANSPORT_MODE_TYPE, SS_String> & m_strMap)
+class EnumStringMap< EPWR_TRANSPORT_MODE_TYPE, Init_SS_TransportMode_StrMap>
+ m_oSS_TransportModeMap;
+SS_String GetStr(EPWR_TRANSPORT_MODE_TYPE f_enum) {
+ return m_oSS_TransportModeMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_EInterfaceunifiedStatus_StrMap(std::map<EFrameworkunifiedStatus, SS_String> & m_strMap); // NOLINT (runtime/references)
+class EnumStringMap< EFrameworkunifiedStatus, Init_EInterfaceunifiedStatus_StrMap> m_oEInterfaceunifiedStatusMap;
+SS_String GetStr(EFrameworkunifiedStatus f_enum) {
+ return m_oEInterfaceunifiedStatusMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_SystemManagerProtocol_StrMap(std::map<SS_SystemManagerProtocol,
+ SS_String> & m_strMap); // NOLINT (runtime/references)
+class EnumStringMap< SS_SystemManagerProtocol,
+ Init_SS_SystemManagerProtocol_StrMap> m_oSSSMProtocolMap;
+SS_String GetStr(SS_SystemManagerProtocol f_enum) {
+ return m_oSSSMProtocolMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_ColdStart_StrMap(std::map<EPWR_SC_COLD_START_REQ_TYPE,
+ SS_String> &m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epsscrtINVALID);
+ MAP_ENTRY(m_strMap, epsscrtNOT_REQUIRED);
+ MAP_ENTRY(m_strMap, epsscrtREQUIRED);
+}
+class EnumStringMap< EPWR_SC_COLD_START_REQ_TYPE,
+ Init_SS_ColdStart_StrMap> m_oSSColdStart_Map;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(EPWR_SC_COLD_START_REQ_TYPE f_enum) {
+ return m_oSSColdStart_Map.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_SS__CWORD56__BootMode_StrMap(std::map<EPWR_SC__CWORD56__BOOT_MODE_TYPE, SS_String> &m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, eps_CWORD56_bmINVALID);
+ MAP_ENTRY(m_strMap, eps_CWORD56_bmAPPLICATION_MODE);
+ MAP_ENTRY(m_strMap, eps_CWORD56_bmPROGRAMMING_MODE);
+} // End of void Init_SS__CWORD56__BootMode_StrMap(std::map<EPWR_SC__CWORD56__BOOT_MODE_TYPE, SS_String> &m_strMap)
+class EnumStringMap< EPWR_SC__CWORD56__BOOT_MODE_TYPE,
+ Init_SS__CWORD56__BootMode_StrMap> m_oSS_CWORD56_BootMode_Map;
+SS_String GetStr(EPWR_SC__CWORD56__BOOT_MODE_TYPE f_enum) {
+ return m_oSS_CWORD56_BootMode_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS__CWORD102__BootMode_StrMap(std::map<ESMBootModeInfo, SS_String> &m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, e_SS_SM_BOOT_MODE_INVALID);
+ MAP_ENTRY(m_strMap, e_SS_SM_BOOT_MODE_APPLICATION);
+ MAP_ENTRY(m_strMap, e_SS_SM_BOOT_MODE_PROGRAMMING);
+} // End of void Init_SS__CWORD102__BootMode_StrMap(std::map<ESMBootModeInfo, SS_String> &m_strMap)
+
+class EnumStringMap< ESMBootModeInfo,
+ Init_SS__CWORD102__BootMode_StrMap> m_oSS_CWORD102_BootMode_Map;
+SS_String GetStr(ESMBootModeInfo f_enum) {
+ return m_oSS_CWORD102_BootMode_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_ShutdownTrigger_StrMap(std::map<EPWR_SHUTDOWN_TRIGGER_TYPE,
+ SS_String> & m_strMap); // NOLINT (runtime/references)
+class EnumStringMap< EPWR_SHUTDOWN_TRIGGER_TYPE,
+ Init_SS_ShutdownTrigger_StrMap> m_oSSShutdownTrigger_Map;
+SS_String GetStr(EPWR_SHUTDOWN_TRIGGER_TYPE f_enum) {
+ return m_oSSShutdownTrigger_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_UserMode_StrMap(std::map<EPWR_USER_MODE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ // Map of System Services User Mode enum values to string description
+ MAP_ENTRY(m_strMap, epsumINVALID);
+ MAP_ENTRY(m_strMap, epsumOFF);
+ MAP_ENTRY(m_strMap, epsumON);
+} // End of void Init_SS_UserMode_StrMap(std::map<EPWR_USER_MODE_TYPE, SS_String> & m_strMap)
+
+class EnumStringMap< EPWR_USER_MODE_TYPE,
+ Init_SS_UserMode_StrMap> m_oSSUserMode_Map;
+SS_String GetStr(EPWR_USER_MODE_TYPE f_enum) {
+ return m_oSSUserMode_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_CpuResetReason_StrMap(std::map<ESMCpuResetReason, SS_String> &m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_NORMAL);
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_DATA_RESET);
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET);
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_GENERIC_ERR);
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_DSP_ERR);
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR);
+} // End of void Init_SS_CpuResetReason_StrMap(std::map<ESMCpuResetReason, SS_String> &m_strMap)
+class EnumStringMap< ESMCpuResetReason,
+ Init_SS_CpuResetReason_StrMap> m_oSS_CpuResetReason_Map;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(ESMCpuResetReason f_enum) {
+ return m_oSS_CpuResetReason_Map.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_SS_UserModeChangeReason_StrMap(std::map<ePwrServiceUserModeChangeReasonType, SS_String> &m_strMap) { // NOLINT (runtime/references)
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov restrictions(other)
+ MAP_ENTRY(m_strMap, epsumcrNOT_AVAILABLE);
+ MAP_ENTRY(m_strMap, epsumcrON_KEY);
+ MAP_ENTRY(m_strMap, epsumcrPARKING_B);
+ MAP_ENTRY(m_strMap, epsumcrPRE_BA);
+ MAP_ENTRY(m_strMap, epsumcrNORMAL);
+ MAP_ENTRY(m_strMap, epsumcrBACKGROUND_BA);
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov restrictions(other)
+}
+class EnumStringMap< EPWR_USER_MODE_CHANGE_REASON_TYPE,
+ Init_SS_UserModeChangeReason_StrMap> m_oSS_UMCR_Map;
+SS_String GetStr(EPWR_USER_MODE_CHANGE_REASON_TYPE f_enum) {
+ return m_oSS_UMCR_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_StartupReason_StrMap(std::map<EPWR_WAKEUP_FACTOR_TYPE,
+ SS_String> & m_strMap); // NOLINT (runtime/references)
+class EnumStringMap< EPWR_WAKEUP_FACTOR_TYPE ,
+ Init_SS_StartupReason_StrMap> m_oSSStartupReason_Map;
+SS_String GetStr(EPWR_WAKEUP_FACTOR_TYPE f_enum) {
+ return m_oSSStartupReason_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_EErrorEventType_StrMap(std::map<EErrorEventType, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, eErrorEventTypeProcessCrash);
+ MAP_ENTRY(m_strMap, eErrorEventTypeHeartBeatFailure);
+ MAP_ENTRY(m_strMap, eErrorEventTypeSystemLowMemory);
+ MAP_ENTRY(m_strMap, eErrorEventTypeReserved1);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedUserForceReset);
+ MAP_ENTRY(m_strMap, eErrorEventTypeReserved2);
+ MAP_ENTRY(m_strMap, eErrorEventTypeReserved3);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectAllLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeBootMicroReset);
+ MAP_ENTRY(m_strMap, eErrorEventTypeProcessExit);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectScreenShot);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeEelExport);
+ MAP_ENTRY(m_strMap, eErrorEventTypeInterfaceunifiedEmmcLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeDiagEvent);
+ MAP_ENTRY(m_strMap, eErrorEventTypeCanEvent);
+ MAP_ENTRY(m_strMap, eErrorEventTypeDtcEvent);
+ MAP_ENTRY(m_strMap, eErrorEventTypeModConnFailed);
+ MAP_ENTRY(m_strMap, eErrorEventTypeStartRespFailed);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectDevLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeModuleInvokedResetRequest);
+ MAP_ENTRY(m_strMap, eErrorEventTypeModuleInvokedCollectDebugLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedClearLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeGroupRelaunch);
+ MAP_ENTRY(m_strMap, eErrorEventTypeMaxValue);
+} // End of void Init_EErrorEventType_StrMap(std::map<EErrorEventType, SS_String> & m_strMap)
+
+void Init_SS_SystemManagerProtocol_StrMap(std::map<SS_SystemManagerProtocol, SS_String> &m_strMap) { // NOLINT (runtime/references)
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov restrictions(other)
+ MAP_ENTRY(m_strMap, SS_SM_NOTIFY_SYSTEM_LAUNCH_COMPLETE);
+ MAP_ENTRY(m_strMap, SS_SM_PROTOCOL_INTERFACE_END);
+ MAP_ENTRY(m_strMap, SS_SM_START);
+ MAP_ENTRY(m_strMap, SS_SM_START_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_STOP);
+ MAP_ENTRY(m_strMap, SS_SM_STOP_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_PRE_START);
+ MAP_ENTRY(m_strMap, SS_SM_PRE_START_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_PRE_STOP);
+ MAP_ENTRY(m_strMap, SS_SM_PRE_STOP_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_START);
+ MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_START_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_STOP);
+ MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_STOP_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_GET_START_EXT_INFO);
+ MAP_ENTRY(m_strMap, SS_SM_GET_STOP_EXT_INFO);
+ MAP_ENTRY(m_strMap, SS_SM_WAKEUP_MODULES_CMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_SHUTDOWN_MODULES_CMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_WAKEUP_MODULES);
+ MAP_ENTRY(m_strMap, SS_SM_SHUTDOWN_MODULES);
+ MAP_ENTRY(m_strMap, SS_SM_CRNT_STATE_QUERY);
+ MAP_ENTRY(m_strMap, SS_SM_CRNT_STATE_QUERY_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_SYSTEM_MODE_INFO_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_SYSTEM_MODE_INFO_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_INITCOMP_REP);
+ MAP_ENTRY(m_strMap, SS_SM_DATA_RESET_MODE_SET_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_PROG_UPDATE_STATE_SET_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_CPU_RESET_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_REMOTE_DATA_RESET_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_FWD_START_CONFIRMATION_MSG_RESP);
+ MAP_ENTRY(m_strMap, SS_SM_POWER_REQUEST_MSG);
+ MAP_ENTRY(m_strMap, SS_SM_POWER_REQUEST_MSG_RESP);
+ MAP_ENTRY(m_strMap, SS_SM_USER_MODE_SET_RESP);
+
+ MAP_ENTRY(m_strMap, SS_SM_EVENT_ERROR);
+ MAP_ENTRY(m_strMap, SS_SM_EVENT_ERROR_TO_SSL);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_START_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_START_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_ARTIFACT_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_ARTIFACT_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_COMPLETE);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_COMPLETE_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_LOGGER_START_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_DEBUG_DUMP_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_BOOT_MICRO_LOG_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_CORE_FILE_POLL);
+ MAP_ENTRY(m_strMap, SS_SM_USER_INVOKED_LOG_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_EEL_EXPORT_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_CLR_LOGS_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_PROCESS_EXIT);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_DIAG_LOG_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_CAN_LOG_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_GROUP_LAUNCH_TRIGGER);
+ MAP_ENTRY(m_strMap, SS_SM_DEBUG_DUMP);
+ MAP_ENTRY(m_strMap, SS_SM_DEBUG_DUMP_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_CPU_HIGH_LOAD_DETECTED);
+ MAP_ENTRY(m_strMap, SS_SM_PROPAGATE_SYSTEM_ERROR);
+ MAP_ENTRY(m_strMap, SS_SM__CWORD56__HEARTBEAT_REQ);
+ MAP_ENTRY(m_strMap, SS_SM__CWORD56__HEARTBEAT_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_NTF);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_LOG_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_LOG_RSP);
+ MAP_ENTRY(m_strMap, SS_SM_NEXT_WAKEUP_TYPE_SET_REQ);
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov restrictions(other)
+} // End of void Init_SS_SystemManagerProtocol_StrMap(std::map<SS_SystemManagerProtocol, SS_String> &m_strMap)
+
+
+
+void Init_EInterfaceunifiedStatus_StrMap(std::map<EFrameworkunifiedStatus, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusEmptyMediaList);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSessionLimitMaxedOut);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbRecNotFound);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbResultError);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbExecuteFail);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSemCloseFail);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSemUnlockFail);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSemLockFail);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFail);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrOther);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusOK);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldBuf);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldHandle);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldHndlType);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldQName);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusMsgQFull);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldNotification);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldParam);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldBufSize);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldID);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusCannotRelease);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusBadConnection);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusExit);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusNotImplemented);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadBusy);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadSelfJoin);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadInvalidVal);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadNotExist);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFault);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusServNotFound);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusServerInUse);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbIndexing);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusNullPointer);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusMsgNotProcessed);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFileLoadSuccess);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFileLoadError);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusAccessError);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDuplicate);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusMsgQEmpty);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadAlreadyRunning);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrNoEBADF);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrNoEAGAIN);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrNoEINTR);
+} // End of void Init_EInterfaceunifiedStatus_StrMap(std::map<EFrameworkunifiedStatus, SS_String> & m_strMap){
+
+void Init_SS_ShutdownTrigger_StrMap(std::map<EPWR_SHUTDOWN_TRIGGER_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epssdmsdtINVALID);
+ MAP_ENTRY(m_strMap, epssdmsdtTESTACC_OFF);
+ MAP_ENTRY(m_strMap, epssdmsdtON_KEY);
+ MAP_ENTRY(m_strMap, epssdmsdtIGN_LOCK);
+ MAP_ENTRY(m_strMap, epssdmsdtPWR_SAVE);
+ MAP_ENTRY(m_strMap, epssdmsdtTMP_STARTUP);
+ MAP_ENTRY(m_strMap, epssdmsdtDIAG_DEACTIVATION);
+ MAP_ENTRY(m_strMap, epssdmsdtABNORMAL_VOLTAGE);
+ MAP_ENTRY(m_strMap, epssdmsdtABNORMAL_TEMP);
+ MAP_ENTRY(m_strMap, epssdmsdtBATTERYCUTOFF);
+ MAP_ENTRY(m_strMap, epssdmsdtLIMPHOME);
+ MAP_ENTRY(m_strMap, epssdmsdtHU_CAN_ERROR);
+ MAP_ENTRY(m_strMap, epssdmsdtBODY_CAN_ERROR);
+ MAP_ENTRY(m_strMap, epssdmsdtTRANSPORT_MODE);
+ MAP_ENTRY(m_strMap, epssdmsdtPRODUCTION_MODE);
+ MAP_ENTRY(m_strMap, epssdmsdtIGN_OFF);
+ MAP_ENTRY(m_strMap, epssdmsdtGENERIC_ERROR_RESET);
+ MAP_ENTRY(m_strMap, epssdmsdtFATAL_ERROR_RESET);
+ MAP_ENTRY(m_strMap, epssdmsdtUSER_DATA_RESET);
+ MAP_ENTRY(m_strMap, epssdmsdtFACTORY_DATA_RESET);
+ MAP_ENTRY(m_strMap, epssdmsdtFAST_SLEEP_MODE);
+ MAP_ENTRY(m_strMap, epssdmsdtNORMAL_RESET);
+} // End of void Init_SS_ShutdownTrigger_StrMap(std::map<EPWR_SHUTDOWN_TRIGGER_TYPE, SS_String> & m_strMap)
+
+void Init_SS_StartupReason_StrMap(std::map<EPWR_WAKEUP_FACTOR_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epswfINVALID);
+ MAP_ENTRY(m_strMap, epswfTESTACC);
+ MAP_ENTRY(m_strMap, epswfON_KEY);
+ MAP_ENTRY(m_strMap, epswfIGN_ACC);
+ MAP_ENTRY(m_strMap, epswfDR_OPEN_CLOSE);
+ MAP_ENTRY(m_strMap, epswfDX_ACTIVATION);
+ MAP_ENTRY(m_strMap, epswfPASS_ACTIVATION);
+ MAP_ENTRY(m_strMap, epswfSPVACTIVATION);
+ MAP_ENTRY(m_strMap, epswfUSER_DATA_RESET);
+} // LCOV_EXCL_BR_LINE 10:Because the last line
+// End of void Init_SS_WakeupFactor_StrMap(std::map<EPWR_WAKEUP_FACTOR_TYPE, SS_String> & m_strMap)
+
+// EOF ss_string_maps.cpp
+
+
diff --git a/systemservice/interface_unified/library/src/ss_system_process.cpp b/systemservice/interface_unified/library/src/ss_system_process.cpp
new file mode 100755
index 0000000..71a969a
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_system_process.cpp
@@ -0,0 +1,1147 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "system_service/ss_system_process.h"
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <limits.h>
+#include <pwd.h>
+#include <grp.h>
+#include <elfio/elfio_dump.hpp>
+
+#include <string.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <assert.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <vector>
+#include "ss_system_if_interfaceunifiedlog.h"
+
+const char* iProcess_DEFAULT_PROCESS_USER_NAME = "default_user";
+uid_t iProcess_DEFAULT_PROCESS_USER = 4999;
+gid_t iPrpocess_DEFAULT_PROCESS_GROUP = 4999;
+
+/**
+ * Process: Called when the class is instantiated.
+ *
+ * @return
+ */
+Process::Process(int cpu_assign) :
+ m_lValidationTag(lProcess_VALIDATION_VALUE),
+ m_cpu_assign(cpu_assign),
+ m_tProcessId(-1),
+ m_eProcessLoadMode(NOWAIT),
+ m_strFile(""),
+ m_strProcessName(""),
+ m_iErrorCode(0),
+ m_fAutoKill(TRUE),
+ m_iReturnCode(0) {
+}
+
+
+/**
+ * ~Process: Called when the object is destroyed.
+ *
+ * @return
+ */
+Process::~Process() {
+ // ASSERT_VALID (this);
+
+ //
+ // Set the validation tag to NOT valid
+ m_lValidationTag = 0;
+
+ //
+ // Cleanup after ourselves...
+ //
+ if ((m_fAutoKill) && (m_tProcessId != -1) && (m_tProcessId != getpid())) {
+ KillProcess(); // Then remove the process from PosixBasedOS001
+ }
+}
+
+/**
+ * Process: Used to create an object and copy another
+ * object to the new object.
+ *
+ * @param p_rhs_i Reference to the class being copied from.
+ * @return Process( const
+ */
+Process::Process(const Process& p_rhs_i) {
+ // Copy data from the specified object to this object.
+ Copy(p_rhs_i);
+}
+
+
+/**
+ * operator=: Called when one object is assigned
+ * to another object.
+ *
+ * @param p_rhs_i Reference to the class being copied from.
+ * @return Process&
+ */
+Process& Process::operator= (const Process& p_rhs_i) {
+ // Don't do anything if we're being copied on to ourselves.
+ if (this == &p_rhs_i) return (*this);
+
+ // Copy data from the specified object to this object.
+ Copy(p_rhs_i);
+
+ return (*this);
+}
+
+
+/**
+ * Copy: Copies data members from the specified object to this object.
+ * No attempt is made to free dynamically allocated objects within
+ * this object (you must do that before calling this function).
+ *
+ * @param p_rhs_i
+ * @return void
+ */
+void Process::Copy(const Process& p_rhs_i) {
+ // Copy data from the specified object to this object.
+ m_lValidationTag = p_rhs_i.m_lValidationTag;
+
+ m_tProcessId = p_rhs_i.m_tProcessId;
+ m_eProcessLoadMode = p_rhs_i.m_eProcessLoadMode;
+ m_strFile = p_rhs_i.m_strFile;
+ m_strlstArgv = p_rhs_i.m_strlstArgv;
+ m_strProcessName = p_rhs_i.m_strProcessName;
+ m_iErrorCode = p_rhs_i.m_iErrorCode;
+ m_fAutoKill = p_rhs_i.m_fAutoKill;
+ m_iReturnCode = p_rhs_i.m_iReturnCode;
+}
+
+/**
+ * GetProcessReturnCode: This function will return the processes
+ * exit/return code. This is not the value of ERRNO as returned by
+ * GetLastPosixBasedOS001ErrorCode().
+ *
+ * @return code from the process
+ */
+int Process::GetProcessReturnCode() {
+ int iProcessReturn = 0;
+ if (waitpid(m_tProcessId, &iProcessReturn, WNOHANG) > 0) {
+ m_iReturnCode = WEXITSTATUS(iProcessReturn);
+ }
+
+ return m_iReturnCode;
+}
+
+static int getIdsFromUserName(const char* user_name, uid_t *uid, gid_t *gid) {
+ int ret = -1;
+
+ try {
+ if (NULL == user_name) {
+ *uid = geteuid();
+ *gid = getegid();
+ } else {
+ static __thread size_t bufSize = 0;
+ static __thread char *buf = NULL;
+ struct passwd pwd;
+ struct passwd *result;
+
+ if (0 == bufSize) {
+ struct stat statInfo;
+
+ bufSize = -1;
+
+ if (0 != stat("/etc/passwd", &statInfo) || 0 >= statInfo.st_size) {
+ throw "/etc/passwd is not exist";
+ }
+
+ bufSize = statInfo.st_size * 2;
+
+ // Since SystemManager is a resident service,
+ // the area secured here is not explicity released by free()
+ // in anticipation of release at the end of the process
+ buf = reinterpret_cast<char *>(malloc(sizeof(char) * bufSize));
+ if (NULL == buf) {
+ throw "malloc()";
+ }
+ }
+
+ if (NULL == buf) {
+ throw "buf = NULL";
+ }
+
+ ret = getpwnam_r(user_name, &pwd, buf, bufSize, &result);
+ if (ret == 0 && result != NULL) {
+ *uid = pwd.pw_uid;
+ *gid = pwd.pw_gid;
+ } else {
+ throw "getpwnam_r()";
+ }
+ }
+
+ ret = 0;
+ }
+
+ catch (const char *e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "ERROR:%s", e);
+ }
+
+ return ret;
+}
+
+/**
+ * CreateProcess: This method will create a PosixBasedOS001 process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ * Upon successful creation of the process, the scheduling policy and priority
+ * of the process will be set to the provided values. The user can change these
+ * values through the SetSchedulingPolicy() and SetPriority() method calls.
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_strlstArgv_i List of ARGV values for new process
+ * @param p_eMode_i Mode to create and load new process
+ * WAIT - The invoked program is loaded into available memory, is executed,
+ * and then the original program resumes execution.
+ * NOWAIT - Causes the current program to execute concurrently with the new child process.
+ * @param p_strProcessName_i This is the name that will be registered to the OS for this process
+ * @param p_eSchedulingPolicy_i Scheduling Policy for this process
+ * FIFO - A fixed priority scheduler in which the highest ready process runs until it
+ * blocks or is preempted by a higher priority process.
+ * ROUND_ROBIN - The same as FIFO, except processes at the same priority level time-slice.
+ * OTHER - A general time sharing scheduler in which a process decays in priority if it
+ * consumes too much processor before blocking. It reverts to its default priority
+ * when it blocks. Should it fail to run over a 2 second period and it has decayed
+ * then it's boosted one priority level up to a maximum of its default priority.
+ * @param p_iPriority_i Priority for this process
+ * @param p_lSpawnFlags_i Spawning flags. These are PosixBasedOS001 specific....
+ * @return void
+ */
+void Process::CreateProcess(
+ const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const StringList& p_strlstArgv_i, // List of ARGV values for new process
+ const eProcessLoadMode p_eMode_i, // Mode to create and load new process
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const eProcessSchedulingPolicy p_eSchedulingPolicy_i, // Scheduling Policy for this process
+ const int p_iPriority_i, // Priority for this process
+ const char* unix_user_name,
+ const long p_lSpawnFlags_i // Posix Spawning flags. These are PosixBasedOS001 specific.... // NOLINT (runtime/int)
+) {
+ //========================================================================================
+ // Perform some idiot checking of the parameters that are passed in.
+ // Check the priority level that is being set to make sure it is in bounds.
+ // Then save off the calling parameters into the objects member variables.
+ // Also check the number of valid calling (argv[]) parameters passed in
+ //========================================================================================
+ m_iErrorCode = 0; // Initialize to NO ERROR
+ m_iReturnCode = 0; // Initialize value (0 usually means good in unix/PosixBasedOS001)
+
+ //
+ // Process filename os provided
+ //
+ if (p_strFile_i.empty()) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+
+ //
+ // Save off process calling arguments
+ //
+ m_eProcessLoadMode = p_eMode_i;
+
+ m_strFile = p_strFile_i;
+
+ if (!p_strProcessName_i.empty())
+ m_strProcessName = p_strProcessName_i;
+
+ //
+ // Copy Argument List...
+ //
+ SetCallingArgumentList(p_strlstArgv_i);
+
+ //
+ // Valid number of calling arguments
+ //
+ int iNumberElements = m_strlstArgv.size();
+ if (iNumberElements > (iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS - 3)) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+
+
+ //========================================================================================
+ // Initialize to the beginning of the provided argument list.
+ // Allocate an array of buffer pointers that will be used for the ARGV calling parameters
+ // for the specified process.
+ // Set the ARGV[0] equal to the process name being created
+ // Set the ARGV[1] equal to the process name to be registered with the OS.
+ // If p_strProcessName_is NULL, do not set the cArgv[1] parameter
+ // Populate the array that will hold the argument list for the new process we are creating.
+ //========================================================================================
+ //
+
+ int iLoop = 1;
+ char * cArgv[iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS];
+
+ cArgv[0] = basename(const_cast<char *>(p_strFile_i.c_str())); // Set the executable filename
+
+ // Go through the list of provided argv calling parameters to the CreateProcess
+ // function, and copy the arguments to the ARGV[] calling argument which will be passed
+ // into the process being created.
+ StringListIter at = m_strlstArgv.begin();
+ for (; at != m_strlstArgv.end(); at++, iLoop++) {
+ cArgv[iLoop] = const_cast<char *>(at->c_str());
+ }
+
+ cArgv[iLoop] = NULL;
+
+ try {
+ CL_ProcessAttr_t clAttr;
+ CL_ProcessSchedPolicy_t clPolicy = CL_PROCESS_SCHED_POLICY_OTHER;
+ int clPriority = 0;
+
+ if (0 != CL_ProcessCreateAttrInit(&clAttr)) {
+ throw "CL_ProcessCreateAttrInit()";
+ }
+
+
+ // In order to collect even the child processes of the service, all are group leaders.
+ if (0 != CL_ProcessCreateAttrSetGroup(&clAttr, 1)) {
+ throw "CL_ProcessCreateAttrInit()";
+ }
+
+ if (0 != CL_ProcessCreateAttrSetCpuAssign(&clAttr, m_cpu_assign)) {
+ throw "CL_ProcessCreateAttrSetCpuAssign()";
+ }
+
+ switch (p_eSchedulingPolicy_i) {
+ case FIFO:
+ clPolicy = CL_PROCESS_SCHED_POLICY_FIFO;
+ break;
+ case ROUND_ROBIN:
+ clPolicy = CL_PROCESS_SCHED_POLICY_RR;
+ break;
+ case OTHER:
+ clPolicy = CL_PROCESS_SCHED_POLICY_OTHER;
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "p_eSchedulingPolicy_i = %d", p_eSchedulingPolicy_i);
+ break;
+ }
+
+ switch (p_eSchedulingPolicy_i) {
+ case FIFO:
+ case ROUND_ROBIN:
+ if ((1 > p_iPriority_i) || (p_iPriority_i > 99)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "p_eSchedulingPolicy_i = %d", p_eSchedulingPolicy_i);
+ } else {
+ clPriority = p_iPriority_i;
+ }
+ break;
+ case OTHER:
+ default:
+ if ((-20 > p_iPriority_i) || (p_iPriority_i > 19)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "p_eSchedulingPolicy_i = %d", p_eSchedulingPolicy_i);
+ } else {
+ clPriority = p_iPriority_i;
+ }
+ break;
+ }
+
+ if (0 != CL_ProcessCreateAttrSetSchedule(&clAttr, clPolicy, clPriority)) {
+ throw "CL_ProcessCreateAttrSetSchedule()";
+ }
+
+ uid_t uid = 0;
+ gid_t gid = 0;
+
+ if (0 != getIdsFromUserName(unix_user_name, &uid, &gid)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "unexpected unix_user_name [%s]", unix_user_name);
+ uid = geteuid();
+ gid = getegid();
+ }
+ if (uid == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "!! uid=root %s", m_strFile.c_str());
+ uid = UINT_MAX;
+ }
+ if (0 != CL_ProcessCreateAttrSetUid(&clAttr, uid)) {
+ throw "CL_ProcessCreateAttrSetUid()";
+ }
+
+ if (0 != CL_ProcessCreateAttrSetGid(&clAttr, gid)) {
+ throw "CL_ProcessCreateAttrSetGid()";
+ }
+
+ if (0 != CL_ProcessCreateAttrSetDisableCloseFds(&clAttr)) {
+ throw "CL_ProcessCreateAttrSetDisableCloseFds()";
+ }
+ char environment_string[2048] = {0}; // Size is provisional
+ fprintf(stderr, "[%s](%d)Process Create Target : %s \n", __func__, __LINE__, m_strFile.c_str());
+
+ CheckLdPreLoad(&m_strFile, environment_string);
+
+ CreateProcess(&m_strFile, const_cast<char* const*>(cArgv), environment_string, &clAttr);
+ }
+
+ catch(const char *e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "%s", e);
+ }
+}
+
+/**
+ * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ * @param p_str_file Path and Filename of executable to create process for
+ * @param c_argv use process arguments
+ * @param environment_string Set LD_PRELOAD string
+ * @param cl_attr CL_ProcessAttr_t
+ * @return void
+ */
+void Process::CreateProcess(const SS_String *p_str_file, char* const*c_argv, char* environment_string,
+ const CL_ProcessAttr_t *cl_attr) {
+ try {
+ if ((p_str_file == NULL) || (c_argv == NULL) || (cl_attr == NULL)) {
+ throw "CreateProcess() Invaild Param";
+ }
+
+ int process_id = -1;
+ if (environment_string[0] == '\0') {
+ // If there is no LD_PRELOAD setting, set envp to NULL
+ process_id = CL_ProcessCreate(p_str_file->c_str(), c_argv, NULL, cl_attr);
+ } else {
+ // vector holding preferences
+ std::vector<SS_String> *vec_environ = GetEnvironVector();
+
+ // Set LD_PRELOAD string as the last element
+ SS_String ld_preload_string = SS_String(environment_string);
+ vec_environ->push_back(environment_string);
+
+ // Number of acquired environment variables + 1(For terminal) memory allocation
+ size_t env_num = sizeof(char*) * (vec_environ->size() + 1);
+ char **p_environment = static_cast<char **>(malloc(env_num));
+ memset(p_environment, 0x00, env_num);
+
+ // Create environment variable list
+ int i = 0;
+ char **p_environment_tmp = p_environment;
+ for (std::vector<SS_String>::iterator itr = vec_environ->begin(); itr != vec_environ->end(); itr++, i++) {
+ p_environment_tmp[i] = static_cast<char *>(malloc(sizeof(char) * (itr->length() + 1)));
+
+ snprintf(p_environment_tmp[i], itr->length() + 1, "%s", itr->c_str());
+ }
+
+ // Set envp for environment variable
+ process_id = CL_ProcessCreate(p_str_file->c_str(), c_argv, p_environment, cl_attr);
+
+ // Free memory
+ i = 0;
+ p_environment_tmp = p_environment;
+ for (std::vector<SS_String>::iterator itr = vec_environ->begin(); itr != vec_environ->end(); itr++, i++) {
+ free(p_environment_tmp[i]);
+ }
+
+ free(p_environment);
+ delete(vec_environ);
+ }
+
+ if (process_id == -1) {
+ throw "CL_ProcessCreate()";
+ }
+
+ m_tProcessId = process_id;
+ }
+ catch (const char *e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "%s", e);
+ }
+}
+/**
+ * CreateProcess: This method will create a PosixBasedOS001 process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_strProcessName This is the name that will be registered to the OS for this process
+ * @return void
+ */
+void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName,
+ const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int)
+ StringList strlstArgv;
+
+ try {
+ CreateProcess(p_strFile_i,
+ strlstArgv,
+ NOWAIT,
+ p_strProcessName,
+ FIFO,
+ iProcess_DEFAULT_PROCESS_PRIORITY,
+ unix_user_name,
+ p_lSpawnFlags_i);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+/**
+ * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_strProcessName This is the name that will be registered to the OS for this process
+ * @param p_iPriority_i Priority of process
+ * @return void
+ */
+void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName, const int p_iPriority_i,
+ const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int)
+ StringList strlstArgv;
+
+ try {
+ eProcessSchedulingPolicy policy;
+
+ if (0 < p_iPriority_i) {
+ policy = FIFO;
+ } else {
+ policy = OTHER;
+ }
+
+ CreateProcess(p_strFile_i,
+ strlstArgv,
+ NOWAIT,
+ p_strProcessName,
+ policy,
+ p_iPriority_i,
+ unix_user_name,
+ p_lSpawnFlags_i);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+/**
+ * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_lSpawnFlags_i Spawning flags. These are PosixBasedOS001 specific.
+ * @return void
+ */
+void Process::CreateProcess(const SS_String& p_strFile_i, const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int)
+ StringList strlstArgv;
+
+ try {
+ CreateProcess(p_strFile_i,
+ strlstArgv,
+ NOWAIT,
+ basename(const_cast<char *>(p_strFile_i.c_str())),
+ FIFO,
+ iProcess_DEFAULT_PROCESS_PRIORITY,
+ unix_user_name,
+ p_lSpawnFlags_i);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+
+/**
+ * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_strProcessName This is the name that will be registered to the OS for this process
+ * @param p_strlstArgv_i List of ARGV values for new process
+ * @param p_lSpawnFlags_i Spawning flags. These are PosixBasedOS001 specific.
+ * @return void
+ */
+void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName_i,
+ const StringList& p_strlstArgv_i, const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int)
+ try {
+ CreateProcess(p_strFile_i,
+ p_strlstArgv_i,
+ NOWAIT,
+ p_strProcessName_i,
+ FIFO,
+ iProcess_DEFAULT_PROCESS_PRIORITY,
+ unix_user_name,
+ p_lSpawnFlags_i);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName_i, const int p_iPriority_i,
+ const StringList& p_strlstArgv_i, const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int)
+ try {
+ eProcessSchedulingPolicy policy;
+
+ if (0 < p_iPriority_i) {
+ policy = FIFO;
+ } else {
+ policy = OTHER;
+ }
+
+ CreateProcess(p_strFile_i,
+ p_strlstArgv_i,
+ NOWAIT,
+ p_strProcessName_i,
+ policy,
+ p_iPriority_i,
+ unix_user_name,
+ p_lSpawnFlags_i);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+/**
+ * CreateProcessWait: This method will create a process with the executable provided.
+ * The process state information will be maintained by this object.
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @return void
+ */
+void Process::CreateProcessWait(const SS_String& p_strFile_i) {
+ StringList strlstArgv;
+
+ try {
+ CreateProcess(p_strFile_i,
+ strlstArgv,
+ WAIT,
+ basename(const_cast<char *>(p_strFile_i.c_str())),
+ FIFO,
+ iProcess_DEFAULT_PROCESS_PRIORITY,
+ iProcess_DEFAULT_PROCESS_USER_NAME,
+ iProcess_DEFAULT_PROCESS_FLAGS);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+/**
+ * CreateProcessWait: This method will create a PosixBasedOS001 process with the executable provided.
+ * The process state information will be maintained by this object.
+ *
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_strlstArguments_i List of process calling arguments
+ * @return void
+ */
+void Process::CreateProcessWait(const SS_String& p_strFile_i, const StringList& p_strlstArguments_i) {
+ try {
+ CreateProcess(p_strFile_i,
+ p_strlstArguments_i,
+ WAIT,
+ basename(const_cast<char *>(p_strFile_i.c_str())),
+ FIFO,
+ iProcess_DEFAULT_PROCESS_PRIORITY,
+ iProcess_DEFAULT_PROCESS_USER_NAME,
+ iProcess_DEFAULT_PROCESS_FLAGS);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+
+/**
+ * KillProcess: This method will delete the process represented by this object. All variables associated
+ * with this object will be initialized to a know value.
+ *
+ * @param
+ * @return void
+ */
+void Process::KillProcess(int signal) {
+ //=====================================================================================
+ // Intialize the objects m_iErrorCode member variable to 0 (no error).
+ // Then try to delete the process that this object represents.
+ m_iErrorCode = 0;
+
+ if (DoesProcessExist()) {
+ if (-1 == killpg(m_tProcessId, signal)) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+ }
+
+ //
+ // If no errors, clear out any process specific member variables for this object
+ //
+ m_tProcessId = -1;
+ m_strProcessName = "";
+}
+
+/**
+ * SetSchedulingPolicy: This method will change the scheduling policy for the process this
+ * object represents.
+ *
+ * @param p_eSchedulingPolicy_i Scheduling policy
+ * @return void
+ */
+void Process::SetSchedulingPolicy(
+ const eProcessSchedulingPolicy p_eSchedulingPolicy_i // Scheduling policy
+) {
+ //=======================================================================================
+ // Attempt to change the scheduling policy for the process that this object
+ // represents. If the change fails, restore the previous settings.
+ //
+ m_iErrorCode = 0;
+ struct sched_param cur_sch_params;
+ sched_getparam(m_tProcessId, &cur_sch_params);
+ if (0 != sched_setscheduler(m_tProcessId, ConvertToPosixBasedOS001SchedularPolicy(p_eSchedulingPolicy_i),
+ &cur_sch_params)) {
+ m_iErrorCode = errno;
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+/**
+ * SetPriority: This method will change the priority for the process this
+ * object represents.
+ *
+ * @param p_iPriority_i Scheduling Policy for this process
+ * @return void
+ */
+void Process::SetPriority(const int p_iPriority_i) {
+ //=======================================================================================
+ // Attempt to change the priority for the process that this object
+ // represents. If the change fails, restore the previous settings.
+ //
+ m_iErrorCode = 0;
+ struct sched_param cur_sch_params;
+ sched_getparam(m_tProcessId, &cur_sch_params);
+ cur_sch_params.sched_priority = p_iPriority_i;
+
+ if (-1 == sched_setparam(m_tProcessId, &cur_sch_params)) {
+ m_iErrorCode = errno;
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+/**
+ * IncreasePriorityByOne: This method will increase the priority for the process this
+ * object represents by one.
+ *
+ * @param
+ * @return void
+ */
+void Process::IncreasePriorityByOne(void) {
+ //================================================================================
+ // Retrieve the current priority of the process. Check to see if already at max.
+ // If so just return. Otherwise increase by one and set the priority...
+ //
+ try {
+ int iCurrentPriority = GetPriority();
+ if (iCurrentPriority < iProcess_MAXIMUM_PROCESS_PRIORITY) {
+ SetPriority(iCurrentPriority + 1);
+ }
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+/**
+ * DecreasePriorityByOne: This method will decrease the priority for the process this
+ * object represents by one.
+ *
+ *
+ * @return void
+ */
+void Process::DecreasePriorityByOne(void) {
+ //================================================================================
+ // Retrieve the current priority of the process. Check to see if already at minimum.
+ // If so just return. Otherwise decrease by one and set the priority...
+ //
+ try {
+ int iCurrentPriority = GetPriority();
+ if (iCurrentPriority > 1) {
+ SetPriority(iCurrentPriority - 1);
+ }
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// ConvertToPosixBasedOS001SchedularPolicy
+//
+// This method will return to the caller the equivalent PosixBasedOS001 schedular policy for the process
+// that this object represents
+//
+//
+// Calling Arguments:
+// NONE
+//
+// Return Argument:
+// FIFO, // A fixed priority scheduler in which the highest ready process runs until it
+// // blocks or is preempted by a higher priority process.
+// ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice.
+// OTHER // A general time sharing scheduler in which a process decays in priority if it
+// // consumes too much processor before blocking. It reverts to its default priority
+// // when it blocks. Should it fail to run over a 2 second period and it has decayed
+// // then it's boosted one priority level up to a maximum of its default priority.
+//
+int const Process::ConvertToPosixBasedOS001SchedularPolicy(const eProcessSchedulingPolicy p_eSchedulingPolicy_i) {
+ int iReturnValue = SCHED_RR; // Default is RR
+ switch (p_eSchedulingPolicy_i) {
+ case FIFO:
+ {
+ iReturnValue = SCHED_FIFO;
+ break;
+ }
+
+ case ROUND_ROBIN:
+ {
+ iReturnValue = SCHED_RR;
+ break;
+ }
+
+ case OTHER:
+ {
+ iReturnValue = SCHED_OTHER;
+ break;
+ }
+ }
+
+ return iReturnValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// ConvertFromPosixBasedOS001SchedularPolicy
+//
+// This method will return to the caller the eProcessSchedulingPolicy based on the PosixBasedOS001 schedular
+// policy for the process that this object represents
+//
+//
+// Calling Arguments:
+// PosixBasedOS001 Scheduling Policy
+//
+// Return Argument:
+// FIFO, // A fixed priority scheduler in which the highest ready process runs until it
+// // blocks or is preempted by a higher priority process.
+// ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice.
+// OTHER // A general time sharing scheduler in which a process decays in priority if it
+// // consumes too much processor before blocking. It reverts to its default priority
+// // when it blocks. Should it fail to run over a 2 second period and it has decayed
+// // then it's boosted one priority level up to a maximum of its default priority.
+//
+Process::eProcessSchedulingPolicy const Process::ConvertFromPosixBasedOS001SchedularPolicy
+ (const int p_iPosixBasedOS001chedulingPolicy_i) {
+ eProcessSchedulingPolicy ePolicy = ROUND_ROBIN; // Default is RR
+ switch (p_iPosixBasedOS001chedulingPolicy_i) {
+ case SCHED_FIFO:
+ {
+ ePolicy = FIFO;
+ break;
+ }
+
+ case SCHED_RR:
+ {
+ ePolicy = ROUND_ROBIN;
+ break;
+ }
+ case SCHED_OTHER:
+ {
+ ePolicy = OTHER;
+ break;
+ }
+ } // Switch
+
+ return ePolicy;
+}
+
+
+/**
+ * DoesProcessExist: This method will return a BOOLean indicating whether this
+ * process exists.
+ *
+ * @return BOOL TRUE - Process Exists, FALSE - Process does not exist
+ */
+BOOL Process::DoesProcessExist(void) {
+ struct sched_param cur_sch_params;
+ if (-1 >= sched_getparam(m_tProcessId, &cur_sch_params)) { // or the segment data
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+
+/**
+ * SetProcessName: This method will set this objects process name member variable to the
+ * provided string value.
+ *
+ * @param p_strProcessName_i Process Name to set the m_strProcessName member variable to
+ * @return void
+ */
+void Process::SetProcessName(const SS_String& p_strProcessName_i) {
+ //
+ // Idiot checking
+ //
+ assert(!p_strProcessName_i.empty());
+
+ m_strProcessName = p_strProcessName_i;
+}
+
+/**
+ * GetSchedulingPolicy: This method will return to the caller the
+ * currently configured process scheduling policy.
+ *
+ * @return Process::eProcessSchedulingPolicy const
+ */
+Process::eProcessSchedulingPolicy const Process::GetSchedulingPolicy(void) {
+ int policy = 0;
+ if (-1 == (policy = sched_getscheduler(m_tProcessId))) {
+ m_iErrorCode = errno;
+ return ROUND_ROBIN; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+
+ return (ConvertFromPosixBasedOS001SchedularPolicy (policy));
+}
+
+
+
+/**
+ * GetPriority: This method will return to the caller the currently configured
+ * process priority.
+ *
+ * @return int const
+ */
+int const Process::GetPriority(void) {
+ struct sched_param cur_sch_params;
+ if (-1 >= sched_getparam(m_tProcessId, &cur_sch_params)) {
+ m_iErrorCode = errno;
+ return -1; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+
+ return (cur_sch_params.sched_priority);
+}
+
+
+
+/**
+ * SetCallingArgumentList: This method will set the calling argument list
+ * that this object represents.
+ *
+ * @param p_pcArgv_i Pointer to NULL terminated argument list.
+ * @param p_iArgc_i Number of parameters
+ * @return void
+ */
+void Process::SetCallingArgumentList(const char *p_pcArgv_i[], const int p_iArgc_i) {
+ ////////////////////////////////////////////////////////////////////////
+ // Set the executable filename first. This is always the 1st argument
+ // in the argument list. Then set the argument list for the process
+ // which is held in m_strlstArgv.
+ //
+ if (p_iArgc_i > (iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS - 3)) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+
+ //
+ // First make sure that the argument list is empty.
+ //
+ if (!m_strlstArgv.empty()) {
+ m_strlstArgv.clear(); // Remove all elements from the current list
+ } // Process Argument list is NOT empty
+
+ //
+ // Once empty, put the new arguments into the list
+ //
+ StringListIter at = m_strlstArgv.begin();
+ int iLoop;
+ for (iLoop = 0; iLoop < p_iArgc_i; iLoop ++) {
+ at = m_strlstArgv.insert(at, p_pcArgv_i[iLoop]);
+ }
+}
+
+
+/**
+ * SetCallingArgumentList: This method will set the calling argument
+ * list that this object represents.
+ *
+ * @param p_strlstParameters_i List of parameters
+ * @return void
+ */
+void Process::SetCallingArgumentList(const StringList& p_strlstParameters_i) {
+ if (p_strlstParameters_i.size()) {
+ m_strlstArgv.clear(); // Empty the current list.
+ m_strlstArgv = p_strlstParameters_i;
+ }
+}
+
+/**
+ * Search if libTestFwCommon.so is dynamically linked.
+ *
+ * @param process_path Search target binary path
+ * @return bool
+ */
+static bool CheckLinkedTestfwLibrary(SS_String *process_path) {
+ if (NULL == process_path) {
+ fprintf(stderr, "[%s](%d)Invaild Param.\n", __func__, __LINE__);
+ return false;
+ }
+
+ ELFIO::elfio reader;
+ if (!reader.load(process_path->c_str())) {
+ fprintf(stderr, "[%s](%d)%s is not ELF!\n", __func__, __LINE__, process_path->c_str());
+ return false;
+ }
+
+ ELFIO::Elf_Half n = reader.sections.size();
+ for ( ELFIO::Elf_Half i = 0; i < n; ++i ) {
+ ELFIO::section* sec = reader.sections[i];
+ if ( SHT_DYNAMIC == sec->get_type() ) {
+ ELFIO::dynamic_section_accessor dynamic(reader, sec);
+
+ ELFIO::Elf_Xword dynamic_num = dynamic.get_entries_num();
+ if ( dynamic_num > 0 ) {
+ for ( ELFIO::Elf_Xword i = 0; i < dynamic_num; ++i ) {
+ ELFIO::Elf_Xword dynamic_tag = 0;
+ ELFIO::Elf_Xword dynamic_value = 0;
+ SS_String dynamic_str;
+ dynamic.get_entry(i, dynamic_tag, dynamic_value, dynamic_str);
+
+ // Search if the acquired dynamic section string contains libTestFwCommon.so
+ if (SS_String::npos != dynamic_str.find("libTestFwCommon.so")) {
+ fprintf(stderr, "[%s](%d)libTestFwCommon is linked.\n", __func__, __LINE__);
+ return true;
+ }
+
+ // Check for continuation of dynamic section element
+ if ( DT_NULL == dynamic_tag ) {
+ break;
+ }
+ }
+ } else {
+ // If dynamic section is not found
+ fprintf(stderr, "[%s](%d)dynamic symbol is not find.\n", __func__, __LINE__);
+ }
+ }
+ }
+
+ fprintf(stderr, "[%s](%d)libTestFwCommon is not find. \n", __func__, __LINE__);
+ return false;
+}
+
+/**
+ * This method is a private method to be called from CreateProcess func.
+ * Check environment variable MOCK_LIBRARY where Mock Library Name to set in LD_PRELOAD is set
+ * and output character string to set in LD_PRELOAD if there is setting.
+ *
+ * @param process_path,environment_string
+ * @return void
+ */
+void Process::CheckLdPreLoad(SS_String *process_path, char *environment_string) {
+ if ((process_path == NULL || environment_string == NULL)) {
+ fprintf(stderr, "[%s](%d)Invaild Param.\n", __func__, __LINE__);
+ return;
+ }
+
+ // Check if environment variable MOCK_LIBRARY for LD_PRELOAD setting is set
+ char *value_mock_library = getenv("MOCK_LIBRARY");
+
+ if (value_mock_library != NULL) {
+ // When MOCK_LIBRARY is set
+ fprintf(stderr, "[%s](%d)MOCK_LIBRARY = %s \n", __func__, __LINE__, value_mock_library);
+
+ // Check whether the process to be started is a core unit or TestFW, and execute LD_PRELOAD if libTestFwCommon.so is linked
+ if (CheckLinkedTestfwLibrary(process_path)) {
+ SS_String key_value;
+ SS_String key_ld_preload = "LD_PRELOAD=";
+
+ // Create LD_PRELOAD setting string
+ // LD_PRELOAD is enabled when the string is an envp argument in the form "LD_PRELOAD=hoge_mock.so hoge_mock.so ..."
+ key_value = key_ld_preload + value_mock_library;
+ strncpy(environment_string, key_value.c_str(), key_value.length());
+ fprintf(stderr, "[%s](%d)Set envp: %s \n", __func__, __LINE__, environment_string);
+ return;
+ } else {
+ // If the unit does not require LD_PRELOAD setting, set envairoment_string to NULL.
+ fprintf(stderr, "[%s](%d)Core Unit is not setting LD_PRELOAD\n", __func__, __LINE__);
+ return;
+ }
+ } else {
+ // If it is not set to MOCK_LIBRARY, it is not necessary to set LD_PRELOAD, so set envairoment_string to NULL.
+ fprintf(stderr, "[%s](%d)The MOCK_LIBRARY variable was unestablished.\n", __func__, __LINE__);
+ return;
+ }
+}
+
+/**
+ * Acquire the character string of the environment variable and set it in String Vector
+ * and return in a pointer of Vector.
+ *
+ * @param process_path,environment_string
+ * @return vector<SS_String> pointer
+ */
+extern char ** environ;
+std::vector<SS_String> *Process::GetEnvironVector(void) {
+ // If LD_PRELOAD is set, copy existing environment settings and set to environment_pointer
+
+ std::vector<SS_String>* vector_environ = new std::vector<SS_String>;
+
+ char **environ_tmp = environ;
+
+ // Insert environ_string into the vector table
+ int i = 0;
+ while (environ_tmp[i] != NULL) {
+ SS_String str_env(environ_tmp[i]);
+ vector_environ->push_back(str_env);
+ i++;
+ }
+
+ return vector_environ;
+}
+// ----------------------------------------
diff --git a/systemservice/interface_unified/library/src/ss_system_timer.cpp b/systemservice/interface_unified/library/src/ss_system_timer.cpp
new file mode 100755
index 0000000..24209fb
--- /dev/null
+++ b/systemservice/interface_unified/library/src/ss_system_timer.cpp
@@ -0,0 +1,228 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "system_service/ss_system_timer.h"
+#include <native_service/ns_timer_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <utility>
+#include "ss_system_timer_local.h"
+
+Timer::Timer() :
+ m_bInit(FALSE), m_hApp(NULL), m_hSnd(NULL), m_hTmr(NULL) {
+ bzero(&m_tTi, sizeof(m_tTi));
+}
+
+Timer::Timer(HANDLE hdl, UI_32 id, CbFuncPtr CbFn):
+ m_bInit(FALSE), m_hApp(NULL), m_hSnd(NULL), m_hTmr(NULL) {
+ bzero(&m_tTi, sizeof(m_tTi));
+ Initialize(hdl, id, CbFn);
+}
+
+Timer::~Timer() {
+ if (m_bInit) {
+ Shutdown();
+ }
+} // LCOV_EXCL_BR_LINE 10:Because destructor
+
+BOOL Timer::Initialize(HANDLE hApp, UI_32 id, CbFuncPtr CbFn) {
+ if (!m_bInit && hApp && id && CbFn) {
+ m_hApp = hApp;
+ m_tTi.iCmd = id;
+ m_tTi.t_sec = 0;
+ m_tTi.t_nsec = 0;
+ m_tTi.rpt_sec = 0;
+ m_tTi.rpt_nsec = 0;
+ m_CbFn = CbFn;
+ m_hSnd = McOpenSender(FrameworkunifiedGetAppName(m_hApp));
+ m_hTmr = NS_TimerCreate(m_tTi, CALLBACK_MESSAGE, m_hSnd);
+ m_bInit = TRUE;
+ }
+ return m_bInit;
+}
+
+void Timer::Reinitialize(UI_32 id) {
+ if (!m_bInit && id) {
+ m_tTi.iCmd = id;
+
+ m_tTi.t_sec = 0;
+ m_tTi.t_nsec = 0;
+ m_tTi.rpt_sec = 0;
+ m_tTi.rpt_nsec = 0;
+
+ m_hSnd = McOpenSender(FrameworkunifiedGetAppName(m_hApp));
+ m_hTmr = NS_TimerCreate(m_tTi, CALLBACK_MESSAGE, m_hSnd);
+ m_bInit = TRUE;
+ }
+ return;
+}
+
+void Timer::Shutdown() {
+ if (m_bInit) {
+ Stop();
+ NS_TimerDelete(m_hTmr);
+ m_hTmr = NULL;
+ McClose(m_hSnd);
+ m_hSnd = NULL;
+ m_bInit = FALSE;
+ }
+}
+
+BOOL Timer::SetTime(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) {
+ if (m_bInit) {
+ m_tTi.t_sec = ss;
+ m_tTi.t_nsec = (ss || sms) ? sms*NS_PER_MS : 1; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ m_tTi.rpt_sec = rs;
+ m_tTi.rpt_nsec = rms*NS_PER_MS;
+ }
+ return m_bInit;
+}
+
+BOOL Timer::Start(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) {
+ if (m_bInit) {
+ SetTime(ss, sms, rs, rms);
+ FrameworkunifiedAttachCallbackToDispatcher(m_hApp, TIMER_SERVICE_NAME, m_tTi.iCmd, m_CbFn);
+ NS_TimerSetTime(m_hTmr, m_tTi);
+ }
+ return m_bInit;
+}
+
+BOOL Timer::Start() {
+ if (m_bInit) {
+ FrameworkunifiedAttachCallbackToDispatcher(m_hApp, TIMER_SERVICE_NAME, m_tTi.iCmd, m_CbFn);
+ m_tTi.t_nsec = (m_tTi.t_sec || m_tTi.t_nsec) ? m_tTi.t_nsec : 1; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ NS_TimerSetTime(m_hTmr, m_tTi);
+ }
+ return m_bInit;
+}
+
+BOOL Timer::Stop() {
+ if (m_bInit) {
+ NSTimerInfo ti = m_tTi;
+ ti.t_sec = 0;
+ ti.t_nsec = 0;
+ ti.rpt_sec = 0;
+ ti.rpt_nsec = 0;
+ NS_TimerSetTime(m_hTmr, ti);
+ FrameworkunifiedDetachCallbackFromDispatcher(m_hApp, TIMER_SERVICE_NAME, ti.iCmd);
+ }
+ return m_bInit;
+}
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+TimerCtrl::TimerCtrl()
+ : m_hApp(NULL), m_nTimersMax(DEFAULT_NTIMERS) {
+}
+
+TimerCtrl::TimerCtrl(UI_32 ntimers)
+ : m_hApp(NULL), m_nTimersMax(ntimers) {
+}
+
+void TimerCtrl::Initialize(HANDLE hApp) {
+ if ( NULL != hApp ) {
+ m_hApp = hApp;
+ if (m_aTimers.empty() && m_rTimers.empty()) {
+ for (UI_32 i = DEFAULT_TIMERID; i < DEFAULT_TIMERID+m_nTimersMax; ++i) {
+ m_aTimers.push_back(i);
+ }
+ }
+ }
+}
+
+void TimerCtrl::Shutdown() {
+ m_aTimers.clear();
+ while (m_rTimers.begin() != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.begin()->second;
+ p_timer->Shutdown();
+ delete p_timer;
+ m_rTimers.erase(m_rTimers.begin());
+ }
+}
+
+UI_32 TimerCtrl::CreateTimer(CbFuncPtr CbFn) {
+ if (!m_aTimers.empty()) {
+ UI_32 id = m_aTimers.front();
+ m_aTimers.pop_front();
+ Timer* p_timer = new Timer(m_hApp, id, CbFn);
+ m_rTimers.insert(std::pair<UI_32, Timer*>(id, p_timer));
+ return id;
+ }
+ return 0;
+}
+
+UI_32 TimerCtrl::DeleteTimer(UI_32 id) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->Shutdown();
+ delete p_timer;
+ m_rTimers.erase(m_rTimers.find(id));
+ m_aTimers.push_back(id);
+ return id;
+ }
+ return 0;
+}
+
+UI_32 TimerCtrl::SetTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->SetTime(ss, sms, rs, rms);
+ return id;
+ }
+ return 0;
+}
+UI_32 TimerCtrl::StartTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->Start(ss, sms, rs, rms);
+ return id;
+ }
+ return 0;
+}
+
+UI_32 TimerCtrl::StartTimerMulti(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms, UI_32 subId) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->Shutdown();
+ p_timer->Reinitialize(id + subId);
+ p_timer->Start(ss, sms, rs, rms);
+ return id;
+ }
+ return 0;
+}
+
+UI_32 TimerCtrl::StartTimer(UI_32 id) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->Start();
+ return id;
+ }
+ return 0;
+}
+
+UI_32 TimerCtrl::StopTimer(UI_32 id) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->Stop();
+ return id;
+ }
+ return 0;
+}
+// LCOV_EXCL_STOP
diff --git a/systemservice/interface_unified/scfg/gpf_ss_cpu_mon_config.cfg b/systemservice/interface_unified/scfg/gpf_ss_cpu_mon_config.cfg
new file mode 100755
index 0000000..dcf4d02
--- /dev/null
+++ b/systemservice/interface_unified/scfg/gpf_ss_cpu_mon_config.cfg
@@ -0,0 +1,14 @@
+# CPU Monitor Group Configuration File
+
+[Monitor]
+StartupDelayMs=20000
+SamplePeriodMs=1000
+HistoryLengthMs=10000
+
+[Trigger]
+IdleThresholdBelowPercent=10
+IdleThresholdTimeToExceedMs=3000
+PostDetectNextSampleTimeMs=3000
+
+[MonteCarlo]
+Enabled=FALSE
diff --git a/systemservice/interface_unified/scfg/gpf_ss_ps_config.cfg b/systemservice/interface_unified/scfg/gpf_ss_ps_config.cfg
new file mode 100755
index 0000000..4d30809
--- /dev/null
+++ b/systemservice/interface_unified/scfg/gpf_ss_ps_config.cfg
@@ -0,0 +1,20 @@
+[PowerLogicPlugin]
+dll=ss_powerlogic.dll
+
+[LVI1]
+Hysteresis_Enabled=TRUE
+Hysteresis_Tries=1
+Hysteresis_Timeout=200
+Timeouts_Timeout=200
+
+[LVI2]
+Hysteresis_Enabled=TRUE
+Hysteresis_Tries=1
+Hysteresis_Timeout=200
+Timeouts_Timeout=200
+
+[Shutdown]
+Hysteresis_Enabled=TRUE
+Hysteresis_Tries=1
+Hysteresis_Timeout=200
+Timeouts_Timeout=200
diff --git a/systemservice/interface_unified/scfg/gpf_ss_showmem.cfg b/systemservice/interface_unified/scfg/gpf_ss_showmem.cfg
new file mode 100755
index 0000000..0067483
--- /dev/null
+++ b/systemservice/interface_unified/scfg/gpf_ss_showmem.cfg
@@ -0,0 +1,6 @@
+# CPU Monitor, Show Memory Configuration File
+
+[Monitor]
+Enabled=TRUE
+StartupDelayMs=0
+SamplePeriodMs=1000
diff --git a/systemservice/interface_unified/scfg/ss_cpu_high_load_monitor.cfg b/systemservice/interface_unified/scfg/ss_cpu_high_load_monitor.cfg
new file mode 100755
index 0000000..9ae63d6
--- /dev/null
+++ b/systemservice/interface_unified/scfg/ss_cpu_high_load_monitor.cfg
@@ -0,0 +1,85 @@
+# CPU High Load Monitor Configuration File
+
+[Monitor]
+Enabled=TRUE
+
+[MonteCarlo]
+Enabled=TRUE
+SamplingTimeSec=3
+SamplingIntervalMicroSec=500
+InitiationTimingSec=15
+AnlysisProcessCount=3
+SleepTimeMSec=100
+LogCount=5
+
+[TopCalculation]
+Count=10
+TimeDivisionModuloArg=1000
+SleepTimeMilliSec=50
+
+# ClearThreadPrio is 1 and CountUpThreadPrio is 11.
+[WDT0]
+PrioMin=1
+PrioMax=10
+TriggerCount=10
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
+
+# ClearThreadPrio is 11 and CountUpThreadPrio is 17
+[WDT1]
+PrioMin=11
+PrioMax=16
+TriggerCount=10
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
+
+# ClearThreadPrio is 17 and CountUpThreadPrio is 19.
+# GtfStartup (Prio18) and _CWORD77_(Prio17) tend to occupy CPU, so I created dedicated group.
+[WDT2]
+PrioMin=17
+PrioMax=18
+TriggerCount=10
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
+
+# ClearThreadPrio is 19 and CountUpThreadPrio is 31
+[WDT3]
+PrioMin=19
+PrioMax=30
+TriggerCount=10
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
+
+# ClearThreadPrio is 31 and CountUpThreadPrio is 49
+[WDT4]
+PrioMin=31
+PrioMax=48
+TriggerCount=5
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
+
+# ClearThreadPrio is 49 and CountUpThreadPrio is 255
+[WDT5]
+PrioMin=49
+PrioMax=254
+TriggerCount=5
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
diff --git a/systemservice/interface_unified/scfg/ss_logger.cfg b/systemservice/interface_unified/scfg/ss_logger.cfg
new file mode 100755
index 0000000..ffb4c50
--- /dev/null
+++ b/systemservice/interface_unified/scfg/ss_logger.cfg
@@ -0,0 +1,133 @@
+[LOGGING]
+LogMaxFileSize=5242880
+PerformanceLogSize=262144
+EmmcOutputPath=/nv/BS/ss/logger_service/rwdata/frameworkunifiedlog
+EmmcOutputNaviLogPath=/nv/BS/ss/logger_service/rwdata/log2/awlog
+Usb0MountPath=/mnt/sda1
+Usb1MountPath=/mnt/sdb1
+SdMountPath=/fs/sd0
+EmmcOutputMax=56
+#Value of EmmcOutputErrMax is related to SM function of logging or not,
+#caused by error-reboot, illegal-reset.
+#So,check to influece upon each other in case of changing this value.
+EmmcOutputErrMax=10
+EmmcOutputGrpRelaunchMax=5
+EmmcOutputNaviLogMax=10
+EmmcOutputNaviLogNmlMax=20
+EmmcOutputNaviLogErrMax=10
+ExternalLogNum=6
+ExternalLogMax=20
+
+# "[EXTERNAL_X]" have to start from "1" to ExternalLogNum
+# "ExtLogPath" is file or directory path of External log
+# "OutputPath" is file or directory path in Archive file
+# "Remove" is removed or not after it is archived
+
+[EXTERNAL_1]
+ExtLogPath=/ramd/log/frameworkunifiedlog/radio
+OutputPath=radio
+Remove=false
+
+[EXTERNAL_2]
+ExtLogPath=/ramd/log/frameworkunifiedlog/connectivity
+OutputPath=connectivity
+Remove=false
+
+[EXTERNAL_3]
+ExtLogPath=/ramd/log/frameworkunifiedlog/graphics.log
+OutputPath=graphics.log
+Remove=false
+
+[EXTERNAL_4]
+ExtLogPath=/ramd/log/frameworkunifiedlog/winsys.log
+OutputPath=winsys.log
+Remove=false
+
+[EXTERNAL_5]
+ExtLogPath=/ramd/log/frameworkunifiedlog/appfw
+OutputPath=appfw
+Remove=false
+
+[EXTERNAL_6]
+ExtLogPath=/nv/ptdata/sec/tomoyo
+OutputPath=tomoyo
+Remove=true
+
+[SETLOGMASK]
+MASK0=0xDC000000
+MASK1=0x00000000
+MASK2=0x00000000
+MASK3=0x00000000
+MASK4=0x00000000
+MASK5=0x00000000
+MASK6=0x00000000
+MASK7=0x00000000
+MASK8=0x00000000
+MASK9=0x00000000
+MASK10=0x00000000
+MASK11=0x00000000
+MASK12=0x00000000
+MASK13=0x00000000
+MASK14=0x00000000
+MASK15=0x00000000
+
+[STORAGE]
+ThreadName=/SSLoggerStrage
+Priority=34
+Timeout=50000
+TimeoutAfter=5
+
+
+# Reader types
+# 0 : eReaderWriterTypeFile : not valid for reading
+# 1 : eReaderWriterTypeQueue : reading from a queue
+# 2 : eReaderWriterTypeUdp : not valid for reading
+# 3 : eReaderWriterTypeUdpAndFile : not valid for reading
+# 4 : eReaderWriterTypeInvalid : invalid type
+
+# Writer types
+# 0 : eReaderWriterTypeFile : Writing to file only
+# 1 : eReaderWriterTypeQueue : not implemented yet
+# 2 : eReaderWriterTypeUdp : writing to UDP only
+# 3 : eReaderWriterTypeUdpAndFile : writing to File and UDP
+# 4 : eReaderWriterTypeInvalid : invalid type
+
+[READERWRITER]
+Count=3
+
+[READERWRITER_00]
+ThreadName=pdg.LogQueR
+Priority=30
+ReaderType=1
+ReaderName=/NSLog
+WriterType=3
+WriterName1=/tmp/frameworkunified_debug.log
+WriterSize1=5242880
+WriterName2=169.254.80.9
+WriterSize2=0
+
+
+[READERWRITER_01]
+ThreadName=pdg.TranQueR
+Priority=30
+ReaderType=1
+ReaderName=/TRANSMIT
+WriterType=3
+WriterName1=/tmp/interfaceunified_transmit.log
+WriterSize1=5242880
+WriterName2=169.254.80.9
+WriterSize2=0
+
+
+[READERWRITER_02]
+ThreadName=pdg.PerformQueR
+Priority=11
+ReaderType=1
+ReaderName=/NSplog
+WriterType=0
+WriterName1=/tmp/frameworkunified_performance.log
+WriterSize1=262144
+WriterName2=
+WriterSize2=0
+
+
diff --git a/systemservice/interface_unified/scfg/system_launch_flashloader.cfg b/systemservice/interface_unified/scfg/system_launch_flashloader.cfg
new file mode 100755
index 0000000..49012de
--- /dev/null
+++ b/systemservice/interface_unified/scfg/system_launch_flashloader.cfg
@@ -0,0 +1,8 @@
+# Version:1.0.0v Service queue names changed and updated Lancher-FL sheet - FL
+# Region:FL
+# Generated on Tuesday, July 23, 2013 6:57:49 PM
+# Launch#|GroupName|Group#|Group Launch Wait Time|GroupTrigger|name|path| priority| critical| retry_cnt| arguments|logging_mask| restart| is_start_required| shutdown_critical| shutdown_wait_time
+[ModulesLaunchConfig]
+Launch1=CoreModules|1|100000|False|NS_NPPService|/agl/bin/NS_NPPService|51|True|1|--a SS_SystemManager|NULL|me|False|True|15
+Launch2=CoreModules|1|100000|False|SS_LoggerService|/agl/bin/SS_LoggerService|10|False|3|-p thrd=pdg.LogQueReader:30,thrd=pdg.TransmitQueReader:30,thrd=pdg.DumpQueReader:11,thrd=pdg.PerformanceQueReader:11,thrd=pdg.LogQueWriter:30,thrd=pdg.TransmitQueWriter:30,thrd=pdg.EvntLogQue:8,thrd=pdg.UdpQueWriter:10|NULL|me|True|True|4
+Launch3=SystemModules|2|100000|False|SS_PowerService|/agl/bin/SS_PowerService|12|True|3|NULL|NULL|me|True|False|0
diff --git a/systemservice/interface_unified/scfg_pram/gpf_ss_sm_config_data.cfg b/systemservice/interface_unified/scfg_pram/gpf_ss_sm_config_data.cfg
new file mode 100755
index 0000000..9aef5b8
--- /dev/null
+++ b/systemservice/interface_unified/scfg_pram/gpf_ss_sm_config_data.cfg
@@ -0,0 +1,26 @@
+[Heartbeat]
+MaxHeartBeatRetryCount=4
+AppHeartBeatIntervalInitial=40
+AppHeartBeatIntervalRepeat=30
+
+[CrashDetector]
+Enabled=TRUE
+
+[SysLowMemory]
+TimerValue=5000
+MaxRetryCount=6
+ThresholdValue=5242880
+InterfaceunifiedLogIntervalMs=30000
+
+[UserModeNotification]
+IsBoolean=FALSE
+
+[Module]
+# Set 'ModuleConnectionNumTimesToCheck' to '0' to disable Module Connection checking
+ModuleConnectionNumTimesToCheck=3
+ModuleConnectionTimeOutSec=40
+ModuleStartRespTimeOutSec=120
+
+[CriticalApps]
+CriticalAppsMaxShutdownTimeFastSleep=2;
+CriticalAppsMaxShutdownTimeNormalReset=15; \ No newline at end of file
diff --git a/systemservice/logger_service/LICENSE b/systemservice/logger_service/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/systemservice/logger_service/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/systemservice/logger_service/Makefile.server b/systemservice/logger_service/Makefile.server
new file mode 100755
index 0000000..13612f8
--- /dev/null
+++ b/systemservice/logger_service/Makefile.server
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := server
+
+include ../system_service.mk
diff --git a/systemservice/logger_service/server/Makefile b/systemservice/logger_service/server/Makefile
new file mode 100755
index 0000000..5292a18
--- /dev/null
+++ b/systemservice/logger_service/server/Makefile
@@ -0,0 +1,28 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS += lib work
+
+SUBDIRS += realtimeUsbLog
+
+all:
+
+install-data:install_data
+
+install_data:
+ install -d -m 755 $(DESTDIR)/nv/BS/ss/logger_service/rwdata/frameworkunifiedlog
+
+include ../../system_service.mk
diff --git a/systemservice/logger_service/server/SS_LoggerService.conf_bin b/systemservice/logger_service/server/SS_LoggerService.conf_bin
new file mode 100755
index 0000000..440d361
--- /dev/null
+++ b/systemservice/logger_service/server/SS_LoggerService.conf_bin
@@ -0,0 +1,4 @@
+/usr/agl/bin|${OSW_reldbg}
+debug|dbg
+release|rel
+product|rel
diff --git a/systemservice/logger_service/server/include/loggerservicedebug_loggerservicelog.h b/systemservice/logger_service/server/include/loggerservicedebug_loggerservicelog.h
new file mode 100755
index 0000000..5a2f56e
--- /dev/null
+++ b/systemservice/logger_service/server/include/loggerservicedebug_loggerservicelog.h
@@ -0,0 +1,81 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_LogTraceSender
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_LOGGERSERVICELOG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_LOGGERSERVICELOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_PRD_INFO3 ZONEMASK(26)
+#define ZONE_PRD_INFO2 ZONEMASK(27)
+#define ZONE_PRD_INFO1 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 "Product Info3"
+#define ZONE_TEXT_27 "Product Info2"
+#define ZONE_TEXT_28 "Product Info1"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS(LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INFO, ZONE_FUNC, ZONE_ERR, ZONE_WARN, ZONE_PRD_INFO1, ZONE_PRD_INFO2, ZONE_PRD_INFO3
+#endif
+
+extern const CHAR AppName[];
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_LOGGERSERVICELOG_H_
diff --git a/systemservice/logger_service/server/include/loggerservicedebug_thread_if.h b/systemservice/logger_service/server/include/loggerservicedebug_thread_if.h
new file mode 100755
index 0000000..8a43511
--- /dev/null
+++ b/systemservice/logger_service/server/include/loggerservicedebug_thread_if.h
@@ -0,0 +1,319 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_LogTraceSender
+/// \brief This file supports the logging thread interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_THREAD_IF_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_THREAD_IF_H_
+
+#include <pthread.h>
+#ifdef AGL_STUB
+#else
+#include <sys/neutrino.h>
+#include <sys/dispatch.h>
+#endif
+#include <errno.h>
+#include <sched.h>
+#include <stdio.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_logger_service_local.h>
+#include <string>
+#include "loggerservicedebug_loggerservicelog.h"
+
+typedef std::string ThreadName; //< service name
+
+typedef enum _EThreadCommandIds {
+ eThrdCmdUsbEject = 5463, ///< USB eject --> frameworkunifieddebug
+ eThrdCmdUsbCaptureLogs, ///< USB Capture log --> frameworkunifieddebug
+ eThrdCmdUsbStoreLogs, ///< USB Store log --> frameworkunifieddebug
+ eThrdCmdWriteFilesToUsb, ///< frameworkunifieddebug --> Writer
+ eThrdCmdWriteDataToFile, ///< Reader --> Writer
+ eThrdCmdWriterStop, ///< frameworkunifieddebug --> Writer (Stop writing to the file)
+ eThrdCmdWriterResume, ///< frameworkunifieddebug --> Writer (Continue writing to the file)
+ eThrdCmdCaptureLogScriptExit, ///< LogCaptureScript - > frameworkunifieddebug
+ eThrdCmdWriteEvntFilesToUsb, ///< Wreite Event files to USB
+ eThrdCmdcopytofile,
+ eThrdCmdClearEvntLogs, ///< Clear event logs
+ eThrdCmdStatisticalCounter, ///< Read statistical counter
+ eThrdCmdStatisticalCounterSuccessResp, ///< Statistical counter positiv Response from child thread
+ eThrdCmdStatisticalCounterErrorResp, ///< Statistical counter Negative Response from child thread
+ eThrdCmdResetStatisticalCntrs,
+ eThrdCmdCopyEventLogUSBResponse, ///< Copy event logs to usb response from child thread
+ eThrdCmdClearEventLogResponse, ///< Clear event logs response fromchild thread
+ eThrdCmdPersistLogs, ///< Statistical counter Response fromchild thread
+ eThrdCmdSetVINnumber,
+ eThrdCmdImmPersistEvtLog,
+ eThrdCmdMileageData,
+ eThrdCmdGetNumberOfEventsLogged,
+ eThrdCmdNumberOfEventsLoggedResponse,
+ eThrdCmdUploadEventLog,
+ eThrdCmdUploadEventLogResponse,
+ eThrdCmdCopyEvntLogToTmp,
+ eThrdCmdCopyEvntLogToTmpResponse
+} EThreadCommandIds;
+
+typedef struct _TThrdWriteDataToFileEvt {
+ static const UI_32 LN_LEN = 1024;
+ CHAR line[LN_LEN];
+ UI_32 length;
+} TThrdWriteLogDataToFileEvt, TThrdWriteTransmitDataToFileEvt;
+
+typedef struct _TThrdWriteFilesToUsbEvt {
+ static const UI_32 LOC_PATH_LEN = 256;
+ CHAR location[LOC_PATH_LEN]; ///< full path where files should be copied too
+ UI_32 loc_len;
+} TThrdWriteLogFilesToUsbEvt, TThrdWriteTransmitFilesToUsbEvt;
+
+typedef struct _TThrdCaptureLogsEvt {
+ static const UI_32 FN_LEN = 256;
+ CHAR location[FN_LEN];
+ CHAR parse_fn[FN_LEN]; ///< full path an name of the file that should be parsed for event actions.
+} TThrdCaptureLogsEvt;
+
+// Structure to hold the USB device informaton
+typedef struct _TThrdEvtLogStore {
+ BOOL IsDeviceAvailable;
+ static const UI_32 FN_LEN = 256;
+ CHAR location[FN_LEN];
+ CHAR parse_fn[FN_LEN]; ///< full path an name of the file that should be parsed for event actions.
+} TThrdEvtLogStore;
+
+typedef struct _TInitFlag {
+ UI_8 mileage_flagbit :1;
+ UI_8 statcounter_flagbit :1;
+ UI_8 eventlog_flagbit :1;
+ UI_8 reghandlers_flagbit :1;
+} TInitFlag;
+
+typedef struct _TSessionData {
+ std::string strSrcName;
+ UI_32 session_id;
+} TSessionData;
+
+typedef struct _TEvntNumber {
+ TSessionData stSessiondata;
+ UI_16 u16numberofeventslogged;
+} TEvntsLogged;
+
+typedef struct _TWriteFilesToUsbCmdData {
+ TSessionData stSessiondata;
+ EEvtLogUSBDevNumber eDevId;
+} TWriteFilesToUsbCmdData;
+
+typedef struct _TWriteFilesToUsbCmdResponse {
+ TSessionData stSessiondata;
+ UI_8 u8Response;
+} TWriteFilesToUsbCmdResponse;
+
+typedef struct _TClearEvntLogCmdResponse {
+ TSessionData stSessiondata;
+ UI_8 u8Response;
+} TClearEvntLogCmdResponse;
+
+typedef struct _TStatisticalCountersCmd {
+ TSessionData stSessiondata;
+ EStatCounterGroupID eGroupId;
+} TStatisticalCountersCmd;
+
+typedef struct _TStatisticalCntCmdSuccessResp {
+ TSessionData stSessiondata;
+ SStatisticalCounter stBuffer;
+} TStatisticalCntCmdSuccessResp;
+
+typedef struct _TUploadEventLogResp {
+ TSessionData stSessiondata;
+ STEventLogPersistBuffer stEventLogBuffer;
+} TUploadEventLogResp;
+
+typedef struct _TEventLogCopyStatus {
+ static const UI_8 FilePathSize = 64;
+ CHAR EventLogFilePath[FilePathSize];
+ UI_8 status;
+} TEventLogCopyStatus;
+
+typedef enum _ECaptureLogScriptResp {
+ ekCLSStatusCompleteSuccessful,
+ ekCLSStatusInitError,
+ ekCLSStatusExecuteError,
+ ekCLSStatusCopyError,
+ ekCLSStatusChmodError,
+} ECaptureLogScriptResp;
+
+class ThreadWrapper {
+ public:
+
+ ThreadWrapper(const char* t_name, void* (*routine)(void*), void* arg) { // LCOV_EXCL_START 8:ThreadWrapper class is never used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ pthread_attr_t attr;
+ struct sched_param params;
+
+ if (EOK != pthread_attr_init(&attr)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_init failed errno: %d", errno);
+ }
+ if (EOK != pthread_attr_getschedparam(&attr, &params)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_getschedparam failed errno: %d", errno);
+ }
+ SI_32 prio = frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(
+ std::string(t_name));
+ if (-1 != prio) {
+ params.sched_priority = prio;
+ if (EOK != pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_setinheritsched failed errno: %d", errno);
+ }
+ if (EOK != pthread_attr_setschedparam(&attr, &params)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_setschedparam failed errno: %d", errno);
+ }
+ }
+
+ if (EOK != pthread_create(&m_thread, &attr, routine, arg)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: pthread_create failed errno: %d",
+ errno);
+ }
+ }
+ // LCOV_EXCL_STOP
+
+
+ ~ThreadWrapper() { // LCOV_EXCL_START 8:ThreadWrapper class is never used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+// todo: Need a clean way to cleanup thread in case class closes
+ }
+ // LCOV_EXCL_STOP
+
+
+ operator pthread_t() const { // LCOV_EXCL_START 8:ThreadWrapper class is never used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_thread;
+ }
+ // LCOV_EXCL_STOP
+
+ private:
+ pthread_t m_thread;
+};
+
+
+class CChild {
+ public:
+ CChild(const char* parentsName, const char * sendDataToQue,
+ const char * clientsName, void* (*routine)(void*),
+ const char * sendToUdpQue = "")
+ : m_clientName(clientsName),
+ m_parentName(parentsName),
+ m_sendDataToQueuName(sendDataToQue),
+ m_sendDataToUdpQueName(sendToUdpQue),
+ m_barInit(InitBarrier()),
+ m_thread(clientsName, routine, reinterpret_cast<void*>(this)) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP
+
+ void Join() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (EOK != pthread_join(m_thread, NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: pthread_join failed errno: %d",
+ errno);
+ }
+ }
+ // LCOV_EXCL_STOP
+
+ const char * ParentName() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_parentName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ const char * ClientName() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_clientName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ const char * SendDataToQue() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_sendDataToQueuName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ const char * SendDataToUdpQueue() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_sendDataToUdpQueName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ bool IsValidWaitBarrier() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (m_barInit) {
+ int wbret = pthread_barrier_wait(&m_barrier);
+ return ( PTHREAD_BARRIER_SERIAL_THREAD == wbret) || (0 == wbret);
+ }
+
+ return false;
+ }
+ // LCOV_EXCL_STOP
+
+ private:
+ bool InitBarrier() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /// Note: the count value should match the number of threads that are readers and usb notifiers
+ return (EOK == pthread_barrier_init(&m_barrier, NULL, 2) ? true : false);
+ }
+ // LCOV_EXCL_STOP
+
+ private:
+ ThreadName m_clientName;
+ ThreadName m_parentName;
+ ThreadName m_sendDataToQueuName;
+ ThreadName m_sendDataToUdpQueName;
+ bool m_barInit;
+ ThreadWrapper m_thread;
+ pthread_barrier_t m_barrier;
+};
+
+class LoggerserviceDebugChildThread {
+ public:
+ typedef enum e {
+ kLoggerserviceDebugLogQueReader,
+ kLoggerserviceDebugTransmitQueReader,
+ kLoggerservicePerformanceLogQueReader,
+ kLoggerserviceDebugCaptureLogScript,
+ kLoggerserviceDebugEventLogque,
+ kLoggerserviceDebugMax
+ } ELoggerserviceDebugThreads;
+
+ LoggerserviceDebugChildThread();
+ virtual ~LoggerserviceDebugChildThread();
+ BOOL Start(ELoggerserviceDebugThreads id, const char* parentsName,
+ const char * sendDataToQue, void* (*routine)(void*),
+ const char * sendToUdpQue = "");
+ void Stop(ELoggerserviceDebugThreads id);
+ void StopAll();
+ const char * Name(ELoggerserviceDebugThreads id);
+ void LiftWaitBarrier(ELoggerserviceDebugThreads id);
+ BOOL Running(ELoggerserviceDebugThreads id) const;
+ private:
+ ThreadName names[kLoggerserviceDebugMax];
+ CChild * threads[kLoggerserviceDebugMax];
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_THREAD_IF_H_
diff --git a/systemservice/logger_service/server/include/loggerservicedebug_writer_Evntworker.h b/systemservice/logger_service/server/include/loggerservicedebug_writer_Evntworker.h
new file mode 100755
index 0000000..cef5c18
--- /dev/null
+++ b/systemservice/logger_service/server/include/loggerservicedebug_writer_Evntworker.h
@@ -0,0 +1,211 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_LogTraceSender
+/// \brief frameworkunifieddebug writer thread class, handles writing a log file
+/// all really done by my_writer class.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_WRITER_EVNTWORKER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_WRITER_EVNTWORKER_H_
+
+#include <stdlib.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_eventlogger.h>
+#include <map>
+#include <iostream>
+#include <deque>
+#include "loggerservicedebug_thread_if.h"
+
+
+// File path names for Evnet and counter logs
+extern const CHAR DEBUG_EVNTLOG_PATH_FN[];
+extern const CHAR g_strEvntLogQueWorkerName[];
+extern const CHAR DEBUG_LOG_PATH_FN[];
+extern const CHAR Counter_LOG_PATH_FN[];
+extern const CHAR Counter_LOG_PATH_STARTFN[];
+extern const CHAR Counter_LOG_PATH_SHUTFN[];
+extern const CHAR Mileage_LOG_PATH_FN[];
+
+typedef struct _TevntWriterInfo {
+ static const UI_32 FN_LEN = 256;
+ UI_32 max_filelen;
+ CHAR base_cnt_filename[FN_LEN];
+ CHAR mileage_filename[FN_LEN];
+} TEvntWriterInfo;
+
+typedef enum _eDatatype_ {
+ COMMON_DATA,
+ EVENT_SPECIFIC_DATA
+} EDatatype_SS;
+
+typedef enum _eSystemPhase_ {
+ STARTUP_SS = 0x21,
+ NORMAL_SS = 0x22,
+ SHUTDOWN_SS = 0x23
+} ESystemPhase_SS;
+
+#pragma pack(1)
+typedef struct _stLogEventFull_ {
+ UI_32 ts;
+ UI_8 grp_ID;
+ UI_8 event_id;
+ UI_8 data[4];
+ ESystemPhase_SS phase;
+ UI_16 cnt_ID;
+ EDatatype_SS typeofdata;
+} st_LogEvent_full;
+#pragma pack(0)
+
+// Deque to hold the Event information
+typedef std::deque<st_LogEvent_ss> DEQUE_Event_Type;
+
+// Map to hold the Counter information on phase
+typedef std::map<UI_16, UI_32> Counter;
+
+/*Map to hold the all the counter information */
+typedef std::map<EStatCounterGroupID, Counter> CounterInformation;
+
+class CEvntWriterWorker {
+ public:
+ CEvntWriterWorker();
+ CEvntWriterWorker(TEvntWriterInfo & wi); // NOLINT (runtime/references)
+ virtual ~CEvntWriterWorker();
+ // initialize the object
+ EFrameworkunifiedStatus Initialize(HANDLE hThread);
+
+ /// Copy event logs to USB request from parent thread
+ EFrameworkunifiedStatus OnCmdWriteEventFilesToUsb(HANDLE hThread);
+
+ /// Event logging request from NS logger
+ EFrameworkunifiedStatus OnCmdEventLog(UI_8* pbuf);
+
+ /// Clear event logs request from parent thread
+ EFrameworkunifiedStatus OnCmdClearEventLogs(HANDLE hThread);
+
+ /// Read statistical counter request from parent thread
+ EFrameworkunifiedStatus OnCmdReadStatisticalCounter(HANDLE hThread);
+
+ /// Read statistical counter based on counter group ID
+ EFrameworkunifiedStatus ReadStatisticalCounter(EStatCounterGroupID eStatCounterGroupID,
+ SStatisticalCounter& buffer); // NOLINT (runtime/references)
+
+ /// Reset statistical counter request from parent thread
+ EFrameworkunifiedStatus OnCmdResetStatisticalCounter(HANDLE hThread);
+
+ /// Reset statistical counter based on counter group ID
+ EFrameworkunifiedStatus ResetStatisticalCounter(EStatCounterGroupID eStatCounterGroupID);
+
+ EFrameworkunifiedStatus OnCmdStop(HANDLE hThread);
+
+ EFrameworkunifiedStatus OnCmdStart(HANDLE hThread);
+
+ /// Counter logging request from NS logger
+ EFrameworkunifiedStatus OnCmdIncrcount(UI_8* pbuf);
+
+ /// Event and Counter logging request from NS logger
+ EFrameworkunifiedStatus OnCmdIncrwriteevent(UI_8* pbuf);
+
+ /// Reading counter value from file based on phase
+ EFrameworkunifiedStatus readCountFromFile(PCSTR filename);
+
+ /// Writing counter value from file based on phase
+ EFrameworkunifiedStatus writeCountToFile(PCSTR filename);
+
+ /// Writing event value from file based on phase
+ EFrameworkunifiedStatus write_event_to_file(const CHAR* filename);
+
+ /// Copy event files to USB based onUSB device number
+ UI_8 copy_event_files_to_usb(TThrdEvtLogStore *pStUSBIndo);
+
+ /// Functioncall to populate the counter value to map
+ VOID OnCmdIncrcount_phase(st_LogCount *cnt);
+
+ /// Function call to populate the event value to deque
+ VOID OnCmdWriteEventLogs(st_LogEvent_ss *ev);
+
+ /// Set the VIN number
+ EFrameworkunifiedStatus OnCmdSetVIN(HANDLE hThread);
+
+ /// Get the VIN number
+ VOID OnCmdGetVIN(STVIN_NUMBER& f_stVIN_Number); // NOLINT (runtime/references)
+
+ /// Functional call to write events from deque to local buffer
+ VOID write_events_to_buffer(STEventLogPersistBuffer* f_stEvtLogBuf);
+
+ /// Functional call to read events from buffer to deque
+ VOID read_events_from_buffer(STEventLogPersistBuffer* f_stEvtLogBuf);
+
+ /// Functional call to immediate persist event log
+ EFrameworkunifiedStatus immediate_persist_event_log(HANDLE hThread);
+
+ /// Functional call to set mileage information in Evt thread space
+ EFrameworkunifiedStatus EvtThd_SetMileage(HANDLE hThread);
+
+ /// Functional call to write mileage data to file for persisting
+ EFrameworkunifiedStatus write_mileage_to_file(const CHAR* filename);
+
+ /// Functional call to read mileage data from persistent file during startup
+ EFrameworkunifiedStatus read_mileage_from_file(const CHAR* filename);
+
+ EFrameworkunifiedStatus OnCmdReadNumberOfEventsLogged(HANDLE hThread);
+
+ EFrameworkunifiedStatus EventLogRegisterCbHandlers(HANDLE hThread);
+
+ EFrameworkunifiedStatus OnCmdUploadEventLog(HANDLE hThread);
+
+ EFrameworkunifiedStatus OnCmdCopyEvntLogToTmp(HANDLE hThread);
+ /// Static Members for Event and counter logging
+ static CounterInformation counter;
+ static DEQUE_Event_Type deque_event_info;
+
+ private:
+ STVIN_NUMBER m_stVINnumber;
+ UI_32 m_u32MileageData;
+ UI_32 m_u32NumberEventsLogged;
+ TUploadEventLogResp m_stUploadEventLogResp;
+ EFrameworkunifiedStatus counterIncrementByValue(EStatCounterGroupID group, UI_16 id,
+ UI_32 value);
+ EFrameworkunifiedStatus writeGroupToFile(FILE *fp, EStatCounterGroupID group);
+};
+
+/// Event logging Child thread start and shut down functions
+EFrameworkunifiedStatus EvntWriterWorkerOnStart(HANDLE hThread);
+EFrameworkunifiedStatus EvntWriterWorkerOnStop(HANDLE hThread);
+
+/// USBdevice detectioncall backs
+EFrameworkunifiedStatus DD_USBSrvDetectionCallBack(HANDLE hApp);
+EFrameworkunifiedStatus DD_USBServiceAvailabilityCallBack(HANDLE hThread);
+EFrameworkunifiedStatus DD_USBOpenSessionAckCallBack(HANDLE hThread);
+EFrameworkunifiedStatus DD_USBCloseSessionAckCallBack(HANDLE hApp);
+
+inline void u16copy(PUI_8 pDest, UI_16 Source) {
+ *(pDest++) = (UI_8) (Source & 0x00FF);
+ *(pDest++) = (UI_8) ((Source & 0xFF00) >> 8);
+}
+inline void u32copy(PUI_8 pDest, UI_32 Source) {
+ *(pDest++) = (UI_8) (Source & 0x000000FF);
+ *(pDest++) = (UI_8) ((Source & 0x0000FF00) >> 8);
+ *(pDest++) = (UI_8) ((Source & 0x00FF0000) >> 16);
+ *(pDest++) = (UI_8) ((Source & 0xFF000000) >> 24);
+}
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_WRITER_EVNTWORKER_H_
diff --git a/systemservice/logger_service/server/include/readerWriter/reader/mem_reader.h b/systemservice/logger_service/server/include/readerWriter/reader/mem_reader.h
new file mode 100755
index 0000000..a5c65ec
--- /dev/null
+++ b/systemservice/logger_service/server/include/readerWriter/reader/mem_reader.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * mem_reader.h
+ *
+ * Created on: Oct 22, 2013
+ */
+
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_MEM_READER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_MEM_READER_H_
+
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_reader.h>
+#include <string>
+#include "reader.h"
+
+namespace ReaderWriter {
+class CMemReader : public ReaderWriter::CReader {
+ public:
+ CMemReader();
+ virtual ~CMemReader();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize);
+ EFrameworkunifiedStatus Read(UI_8* f_data, UI_32 f_length, SI_32& f_bytesRead); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus ReadToFile(std::string f_fileName, UI_32& f_Written); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus Open(void);
+ BOOL IsOpen(void);
+ void Close();
+ EFrameworkunifiedStatus ResetPosition(void);
+
+ private:
+ CNSSharedMemReader* m_pSharedBuf;
+ UI_32 m_sharedBufSize;
+};
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_MEM_READER_H_
diff --git a/systemservice/logger_service/server/include/readerWriter/reader/queue_reader.h b/systemservice/logger_service/server/include/readerWriter/reader/queue_reader.h
new file mode 100755
index 0000000..139796a
--- /dev/null
+++ b/systemservice/logger_service/server/include/readerWriter/reader/queue_reader.h
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_QUEUE_READER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_QUEUE_READER_H_
+
+#include <mqueue.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "reader.h"
+
+namespace ReaderWriter {
+
+class CQueueReader : public CReader {
+ public:
+ CQueueReader();
+ virtual ~CQueueReader();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize);
+ EFrameworkunifiedStatus Read(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesRead); // NOLINT (runtime/references)
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ void Close();
+ private:
+ mqd_t m_handle;
+ std::string m_queName;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_QUEUE_READER_H_
diff --git a/systemservice/logger_service/server/include/readerWriter/reader/reader.h b/systemservice/logger_service/server/include/readerWriter/reader/reader.h
new file mode 100755
index 0000000..7b0141d
--- /dev/null
+++ b/systemservice/logger_service/server/include/readerWriter/reader/reader.h
@@ -0,0 +1,52 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_READER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_READER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer_cfg.h"
+#include "ss_logger_cfg.h"
+
+namespace ReaderWriter {
+
+class CReader {
+ public:
+ CReader();
+ virtual ~CReader();
+
+ static CReader* OpenReader(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
+ std::string f_name, UI_32 f_maxSize);
+ virtual EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize) = 0;
+ virtual BOOL IsOpen(void) = 0;
+ virtual EFrameworkunifiedStatus Open(void) = 0;
+ virtual EFrameworkunifiedStatus Read(UI_8* f_data, UI_32 f_length, SI_32& f_bytesRead) = 0; // NOLINT (runtime/references)
+ virtual EFrameworkunifiedStatus ReadToFile(std::string f_fileName, UI_32& f_Written); // NOLINT (runtime/references)
+
+ virtual void Close() = 0;
+ virtual EFrameworkunifiedStatus ResetPosition(void);
+
+ protected:
+ CLoggerCfg * m_pLoggerCfg;
+};
+} // namespace ReaderWriter
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_READER_H_
diff --git a/systemservice/logger_service/server/include/readerWriter/reader_writer.h b/systemservice/logger_service/server/include/readerWriter/reader_writer.h
new file mode 100755
index 0000000..b075472
--- /dev/null
+++ b/systemservice/logger_service/server/include/readerWriter/reader_writer.h
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_H_
+
+#include <pthread.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer_cfg.h"
+#include "readerWriter/reader/reader.h"
+#include "readerWriter/writer/writer.h"
+
+namespace ReaderWriter {
+
+class CReaderWriter {
+ public:
+ CReaderWriter();
+ virtual ~CReaderWriter();
+
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, EReaderType f_readerType,
+ std::string f_readerName, UI_32 f_readerMaxSize,
+ EWriterType f_writerType, std::string f_writer1Name,
+ UI_32 f_writer1MaxSize);
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, EReaderType f_readerType,
+ std::string f_readerName, UI_32 f_readerMaxSize,
+ EWriterType f_writerType, std::string f_writer1Name,
+ UI_32 f_writer1MaxSize, std::string f_writer2Name,
+ UI_32 f_writer2MaxSize);
+ EFrameworkunifiedStatus Start(std::string f_readerName);
+ EFrameworkunifiedStatus Stop();
+ void ThreadFunction(CReaderWriter* l_pObj);
+ void Cleanup(CReaderWriter* l_pObj);
+ EFrameworkunifiedStatus FlushCache(std::string f_filename);
+ EFrameworkunifiedStatus UpdateLoggingParameters(void);
+
+ private:
+ void Pause(void);
+ void Resume(void);
+ static void* ThreadFunctionWrapper(void* param);
+
+ static void CleanupWrapper(void* param);
+ CLoggerCfg* m_pLoggerCfg;
+ CReader* m_reader;
+ CWriter* m_writer;
+ BOOL m_running;
+ pthread_t m_thread;
+ pthread_barrier_t m_barrier;
+ std::string m_readerName;
+
+ pthread_mutex_t m_writeMutex;
+ pthread_mutex_t m_pauseMutex;
+ pthread_cond_t m_condVariable;
+ BOOL m_paused;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_H_
diff --git a/systemservice/logger_service/server/include/readerWriter/reader_writer_cfg.h b/systemservice/logger_service/server/include/readerWriter/reader_writer_cfg.h
new file mode 100755
index 0000000..b39353b
--- /dev/null
+++ b/systemservice/logger_service/server/include/readerWriter/reader_writer_cfg.h
@@ -0,0 +1,35 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_CFG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_CFG_H_
+namespace ReaderWriter {
+typedef enum _ERWType {
+ eReaderWriterTypeFile,
+ eReaderWriterTypeQueue,
+ eReaderWriterTypeUdp,
+ eReaderWriterTypeUdpAndFile, // Only for writer | pass filename and queueName
+ eReaderWriterTypeMem,
+ eReaderWriterTypeInvalid
+} EReaderType, EWriterType;
+}
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_CFG_H_
diff --git a/systemservice/logger_service/server/include/readerWriter/writer/cached_file_writer.h b/systemservice/logger_service/server/include/readerWriter/writer/cached_file_writer.h
new file mode 100755
index 0000000..ad28658
--- /dev/null
+++ b/systemservice/logger_service/server/include/readerWriter/writer/cached_file_writer.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_CACHED_FILE_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_CACHED_FILE_WRITER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include "file_writer.h"
+
+#define CACHED_BLOCK_SIZE (UI_32)(4*1024)
+
+namespace ReaderWriter {
+
+class CCachedFileWriter : public CFileWriter {
+ public:
+ CCachedFileWriter();
+ virtual ~CCachedFileWriter();
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus FlushCache(void);
+ private:
+ UI_8 m_buffer[CACHED_BLOCK_SIZE ];
+ UI_32 m_index;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_CACHED_FILE_WRITER_H_
diff --git a/systemservice/logger_service/server/include/readerWriter/writer/file_writer.h b/systemservice/logger_service/server/include/readerWriter/writer/file_writer.h
new file mode 100755
index 0000000..caf81c9
--- /dev/null
+++ b/systemservice/logger_service/server/include/readerWriter/writer/file_writer.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_FILE_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_FILE_WRITER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "writer.h"
+
+namespace ReaderWriter {
+
+class CFileWriter : public CWriter {
+ public:
+ CFileWriter();
+ virtual ~CFileWriter();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2, UI_32 f_size2);
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ void Close();
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ protected:
+ EFrameworkunifiedStatus WriteData(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ private:
+ int m_FileHandle;
+ off_t m_fileposn;
+ UI_32 m_maxFileSize;
+ std::string m_filename;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_FILE_WRITER_H_
diff --git a/systemservice/logger_service/server/include/readerWriter/writer/udp_file_writer.h b/systemservice/logger_service/server/include/readerWriter/writer/udp_file_writer.h
new file mode 100755
index 0000000..65e58e0
--- /dev/null
+++ b/systemservice/logger_service/server/include/readerWriter/writer/udp_file_writer.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_FILE_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_FILE_WRITER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "writer.h"
+#include "udp_writer.h"
+#include "file_writer.h"
+
+namespace ReaderWriter {
+
+class CUdpFileWriter : public CWriter {
+ public:
+ CUdpFileWriter();
+ virtual ~CUdpFileWriter();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2, UI_32 f_size2);
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ void Close();
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ EFrameworkunifiedStatus FlushCache(void);
+ EFrameworkunifiedStatus UpdateLoggingParameters(void);
+ private:
+ CUdpWriter *m_pUdpWriter;
+ CFileWriter *m_pFileWriter;
+ CLoggerCfg* m_pLoggerCfg;
+ std::string m_ipAddress;
+ UI_32 m_port;
+ std::string m_FileName;
+ UI_32 m_FileSize;
+};
+} // namespace ReaderWriter
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_FILE_WRITER_H_
diff --git a/systemservice/logger_service/server/include/readerWriter/writer/udp_writer.h b/systemservice/logger_service/server/include/readerWriter/writer/udp_writer.h
new file mode 100755
index 0000000..cf0944a
--- /dev/null
+++ b/systemservice/logger_service/server/include/readerWriter/writer/udp_writer.h
@@ -0,0 +1,63 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_WRITER_H_
+
+#include <netinet/in.h>
+#include <string>
+#include "writer.h"
+
+#define REMOTE_IP_PORT 3500
+namespace ReaderWriter {
+#define UDP_MAX_LENGTH (UI_32)1024*4
+#define UDP_CACHED_BLOCK_SIZE (UI_32)1024*4
+#define SEND_RETRY_VALUE (UI_8) 5
+
+#define OWN_ADDRESS "169.254.80.8"
+class CUdpWriter : public CWriter {
+ public:
+ CUdpWriter();
+ virtual ~CUdpWriter();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2, UI_32 f_size2);
+
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ void Close();
+ EFrameworkunifiedStatus UpdateLoggingParameters(void);
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ EFrameworkunifiedStatus FlushCache(void);
+ private:
+ EFrameworkunifiedStatus WriteData(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+
+ int m_SocketHandle;
+ sockaddr_in m_oSAInfo;
+ std::string m_IPAddress;
+ UI_32 m_index;
+ UI_32 m_port;
+ BOOL m_InitialTimeElapsed;
+ UI_8 m_buffer[UDP_CACHED_BLOCK_SIZE];
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_WRITER_H_
diff --git a/systemservice/logger_service/server/include/readerWriter/writer/writer.h b/systemservice/logger_service/server/include/readerWriter/writer/writer.h
new file mode 100755
index 0000000..15d93aa
--- /dev/null
+++ b/systemservice/logger_service/server/include/readerWriter/writer/writer.h
@@ -0,0 +1,56 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_WRITER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer_cfg.h"
+#include "ss_logger_cfg.h"
+
+namespace ReaderWriter {
+
+class CWriter {
+ public:
+ CWriter();
+ virtual ~CWriter();
+
+ static CWriter* OpenWriter(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
+ std::string f_Name1, UI_32 f_size1,
+ std::string f_Name2, UI_32 f_size2);
+ virtual EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2,
+ UI_32 f_size2) = 0;
+ virtual EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length,
+ SI_32 &f_bytesWritten) = 0; // NOLINT (runtime/references)
+ virtual void Close() = 0;
+ virtual EFrameworkunifiedStatus FlushCache(void);
+ virtual EFrameworkunifiedStatus UpdateLoggingParameters(void);
+ virtual BOOL IsOpen(void) = 0;
+ virtual EFrameworkunifiedStatus Open(void) = 0;
+
+ protected:
+ CLoggerCfg * m_pLoggerCfg;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_WRITER_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_cfg.h b/systemservice/logger_service/server/include/ss_logger_cfg.h
new file mode 100755
index 0000000..93aaef9
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_cfg.h
@@ -0,0 +1,185 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief Provide support for SS Logger module configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
+
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_logger_if.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_logger_service_local.h>
+#include <string>
+#include <vector>
+#include "loggerservicedebug_loggerservicelog.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// CONFIGURATION CLASS DEFINITION
+///////////////////////////////////////////////////////////////////////////////
+/*Default values for the storage thread*/
+#define ERROR_EVENT_STORAGE_QUEUE_NAME "/SSLoggerStrage"
+#define ERROR_EVENT_STORAGE_PRIORITY (UI_8)30
+#define ERROR_EVENT_STORAGE_SLEEP_TIME (useconds_t)50000
+#define ERROR_EVENT_STORAGE_SLEEP_AFTER (UI_8)5
+
+#if ENABLE_PRODUCTION_BUILD == 1
+#define SS_LOGGER_DEFAULT_VALUE eDeactivate
+#else
+#define SS_LOGGER_DEFAULT_VALUE eActivate
+#endif
+
+#define LOGGERSERVICELOG_EMMC_COUNTER_MAX 99999u
+
+struct SLoggerStorageInfo {
+ SLoggerStorageInfo()
+ : Name(ERROR_EVENT_STORAGE_QUEUE_NAME),
+ Priority(ERROR_EVENT_STORAGE_PRIORITY),
+ Timeout(ERROR_EVENT_STORAGE_SLEEP_TIME),
+ TimeoutAfter(ERROR_EVENT_STORAGE_SLEEP_AFTER) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ std::string Name;
+ SI_32 Priority;
+ SI_32 Timeout;
+ SI_32 TimeoutAfter;
+};
+
+enum EInsertEventType {
+ eInsertEventEELStorage,
+ eInsertEventEELActive,
+ eInsertEventLoggerserviceEmmcLogs,
+ eInsertEventInvalid
+};
+
+struct ExternalLogInfo {
+ std::string dirname;
+ std::string path;
+ BOOL remove;
+};
+
+struct ExternalLogList {
+ SI_32 num;
+ SI_32 max;
+ ExternalLogInfo* p_info;
+};
+
+class CLoggerCfg {
+ public:
+ CLoggerCfg(void);
+ ~CLoggerCfg(void);
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus Load(const std::string &f_filePathAndName);
+ EFrameworkunifiedStatus Validate(void);
+ void Print(void);
+
+ EFrameworkunifiedStatus SetLoggingParams(HANDLE f_hApp,
+ STLoggerSetParams f_stLoggerSetParams);
+
+ EFrameworkunifiedStatus SetUDPLogging(HANDLE f_hApp, const ELOGGER_STAT f_eUDPLoggingStatus);
+
+ EFrameworkunifiedStatus PersistLoggingParam(HANDLE f_hApp);
+ std::string getEmmcOutputPath(void);
+ std::string getEmmcOutputNaviLogPath(void);
+ std::string getUsb0MountPath(void);
+ std::string getUsb1MountPath(void);
+ std::string getSdMountPath(void);
+ std::string getDeviceName(void);
+ void setUsb0MountPath(std::string &f_deviceMountpath); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus GetUserInvokedDestination(std::string &f_dest); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus GetEmmcDestination(std::string &f_dest); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus GetEmmcNaviLogDestination(std::string &f_dest); // NOLINT (runtime/references)
+
+ UI_32 GetUserInvokedCounter(void);
+ EFrameworkunifiedStatus GetIncrementAndPersistUserInvokedCounter(HANDLE f_hApp,
+ UI_32 &f_counter); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus GetAndIncrementEmmcCounter(UI_32 &f_counter); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus RefreshEmmcCounter(UI_32 &f_counter) const; // NOLINT (runtime/references)
+
+ void ResetEmmcCounter(void);
+
+ SI_32 m_logMaxFileSize;
+ UI_32 m_logMask[ZONE_MASK_ARRAY_ELTS];
+ SI_32 m_performanceLogMaxFileSize;
+ SI_32 m_emmcOutputMax;
+ SI_32 m_emmcOutputErrMax;
+ SI_32 m_emmcOutputGrpRelaunchMax;
+ SI_32 m_emmcOutputNaviLogMax;
+ SI_32 m_emmcOutputNaviLogNmlMax;
+ SI_32 m_emmcOutputNaviLogErrMax;
+ ExternalLogList m_ExternalLogList;
+
+ std::string m_emmcOutputPath;
+ std::string m_emmcOutputNaviLogPath;
+ std::string m_usb0MountPath;
+ std::string m_usb1MountPath;
+ std::string m_sdMountPath;
+
+ EDEV_TYPE GetConnectedDevice(std::string f_devPath);
+ EInsertEventType GetInsertEventType(std::string f_relPath);
+
+ std::string GetEELActivateRelPath(void);
+ std::string GetDebugFolderContentRelPath(void);
+ std::string GetEELExportRelPath(void);
+
+ BOOL IsUDPLoggingEnabled(void);
+ void AddLoggingParamCB(CbFuncPtr f_fp);
+
+ EFrameworkunifiedStatus GetLoggerStorageInfo(SLoggerStorageInfo &f_info); // NOLINT (runtime/references)
+ BOOL IsLoggingEnabled(void);
+ EFrameworkunifiedStatus EelActivateLogging(HANDLE f_hApp);
+ ExternalLogList GetExternalLogList(void);
+
+ private:
+ void UpdateLoggingStatus(void);
+ std::vector<CbFuncPtr> m_LoggingCallBack;
+ void GetHighestEmmcCounterValue(UI_32 &f_counter); // NOLINT (runtime/references)
+
+ EDEV_TYPE m_eDevType;
+ UI_32 m_UserInvokedLoggingNumber;
+ UI_32 m_EmmcCounter;
+ ELOGGER_STAT m_eLoggerUDPLoggingStatus;
+ BOOL m_udpEnvFlag;
+ ELOGGER_STAT m_eLoggerStatus;
+
+ std::string m_EELStorageRelPath;
+
+ std::string m_EELActivateRelPath;
+
+ std::string m_LoggerserviceEmmcLogsRelPath;
+
+ EFrameworkunifiedStatus SetandPersistLoggingParams(HANDLE f_hApp,
+ STLoggerSetAllParams f_Params,
+ BOOL f_InitCall);
+ SLoggerStorageInfo m_loggerStorageInfo;
+
+ void RemoveCarriageReturn(std::string &f_str); // NOLINT (runtime/references)
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
+
diff --git a/systemservice/logger_service/server/include/ss_logger_common.h b/systemservice/logger_service/server/include/ss_logger_common.h
new file mode 100755
index 0000000..80a56af
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_common.h
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains the callback for Notifications and Protocol
+/// commands.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup logger_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_COMMON_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_COMMON_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+const CHAR DEBUG_LOG_PATH_DIR[] = "/tmp/frameworkunifiedlog";
+const CHAR DEBUG_LOG_PATH_FN[] = "/tmp/frameworkunified_debug.log";
+const CHAR TRANSMIT_LOG_PATH_FN[] = "/tmp/interfaceunified_transmit.log";
+const CHAR PERFORMANCE_LOG_PATH_FN[] = "/tmp/frameworkunified_performance.log";
+const CHAR DRINITIAL_LOG_PATH_FN[] = "/tmp/loggerservice_drinitial.log";
+const CHAR DRLOCATION_LOG_PATH_FN[] = "/tmp/loggerservice_drlocation.log";
+const CHAR KERNEL_LOG_PATH_FN[] = "/tmp/kernel.log";
+const CHAR KERNEL_BOOT_LOG_PATH_FN[] = "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/kernelboot.log";
+
+const UI_32 PERFORMANCELOG_FILE_SZ = 256 * 1024;
+
+#define CLEAR_LOG_PATH_FN "/nv/BS/ss/logger_service/rwdata/frameworkunifiedlog/"
+#define NULLCHAR '\0'
+
+#define DEBUG_USB_PATH "/mnt/sda1"
+#define KERNEL_LOG_PATH_DIR "kernellog"
+
+template<typename C, EFrameworkunifiedStatus (C::*M)(HANDLE)>
+class cpp_callback {
+ public:
+ static CallbackFunctionPtr set(void* pInst) {
+ if (pInst == NULL)
+ throw;
+ ms_pInst = pInst;
+ return &cpp_callback::call;
+ }
+ static EFrameworkunifiedStatus call(HANDLE y) {
+ if (ms_pInst == NULL)
+ return eFrameworkunifiedStatusFault;
+ C* c = static_cast<C*>(ms_pInst);
+ return (c->*M)(y);
+ }
+ private:
+ static void* ms_pInst;
+};
+
+template<typename C, EFrameworkunifiedStatus (C::*M)(HANDLE)>
+void* cpp_callback<C, M>::ms_pInst = NULL;
+
+typedef enum _LoggerServiceStatus {
+ eLSInit,
+ eLSStart,
+ eLSStop,
+} ELOGGERSERVICESTATUS;
+
+typedef enum {
+ SS_LOGGER_KLOG_GET, /* type : get kernel.log */
+ SS_LOGGER_KBOOTLOG_CREATE /* type : create kernelboot.log */
+} SS_LOGGER_KLOG_OPE_TYPE;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StopLoggingFunction
+/// \~english @par Summary
+/// Stop the logging function.
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @retval
+/// None
+/// \~english @par Detail
+/// - The API stops the logging function.\n
+/// \n
+/// - Include ss_logger_common.h
+/// - Library libSS_SystemIfUnified.so
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+void StopLoggingFunction(HANDLE hApp);
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_COMMON_H_
+
+/** @}*/ // end of LoggerService
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/logger_service/server/include/ss_logger_device_detection.h b/systemservice/logger_service/server/include/ss_logger_device_detection.h
new file mode 100755
index 0000000..5ee67c0
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_device_detection.h
@@ -0,0 +1,66 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief This file supports USB logging threads.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_DEVICE_DETECTION_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_DEVICE_DETECTION_H_
+
+#include <system_service/ss_devicedetection_service_notifications.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include "ss_logger_cfg.h"
+#include "ss_logger_util.h"
+
+extern const char * USB_INSERTED_RULE;
+
+// USB device is ejected
+extern const CHAR USB_EJECTED_RULE[];
+
+// The trigger event file (/log/retrievelog.evt) file is found on USB
+extern const CHAR USB_CAPTURE_LOG_EVENT_RULE[];
+
+// When the command to update system with script is executed all the console
+// output will be redirected to this file on /tmp folder. later it will be
+// moved to USB stick
+extern const CHAR CAPTURE_LOG_FILENAME[];
+
+//
+extern const SI_32 INVALID_FD;
+class CLoggerDeviceDetection {
+ public:
+ CLoggerDeviceDetection();
+ ~CLoggerDeviceDetection();
+
+ EFrameworkunifiedStatus Initialize(HANDLE hApp, CLoggerCfg *f_pLoggerCfg);
+ EFrameworkunifiedStatus DD_ServiceAvailabilityCallBack(HANDLE hApp);
+ EFrameworkunifiedStatus DD_OpenSessionAckCallBack(HANDLE hApp);
+ EFrameworkunifiedStatus DD_CloseSessionAckCallBack(HANDLE hApp);
+ EFrameworkunifiedStatus DD_CloseSessionWithDevDetectionSrv(HANDLE hApp);
+ EFrameworkunifiedStatus DD_MediaDetectCallBack(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnStop(void);
+ private:
+ CLoggerCfg *m_pLoggerCfg;
+
+ /// Device Detection Class Instance
+ DeviceDetectionServiceIf m_devDetect;
+
+ CLoggerUtil *m_loggerUtil;
+};
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_DEVICE_DETECTION_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_error_event.h b/systemservice/logger_service/server/include/ss_logger_error_event.h
new file mode 100755
index 0000000..177c074
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_error_event.h
@@ -0,0 +1,156 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_H_
+
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_system_types.h>
+#include <system_service/ss_system_timer.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <string>
+#include <vector>
+#include "ss_logger_popups.h"
+#include "ss_logger_common.h"
+#include "ss_logger_reader_writer_control.h"
+#include "ss_logger_error_event_cfg.h"
+#include "ss_logger_cfg.h"
+#include "ss_logger_util.h"
+#include "readerWriter/reader_writer.h"
+#include "readerWriter/reader_writer_cfg.h"
+#include "ss_logger_error_event_storage.h"
+#include "ss_logger_error_event_can_evt_reply.h"
+
+class CErrorEvent {
+ public:
+ CErrorEvent();
+ ~CErrorEvent();
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp, CLoggerCfg *f_pLoggerCfg,
+ CReaderWriterControl *f_pReaderWriterControl,
+ HANDLE f_thrdEvntLogWriter,
+ std::string f_strEvntLogQueWorkerName);
+
+ EFrameworkunifiedStatus RegisterSessionErrorEvent(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnOpenSession(HANDLE f_hApp, PCSTR f_pRequesterName,
+ HANDLE f_hSession);
+
+ EFrameworkunifiedStatus OnCloseSession(HANDLE f_hApp, PCSTR f_pRequesterName,
+ HANDLE f_hSession);
+
+ EFrameworkunifiedStatus StartLogging(HANDLE f_hApp, EErrorEventType f_eventType);
+
+ EFrameworkunifiedStatus sendDiagEventErrorResponse(EELL_ErrorCode f_errCode);
+
+ EFrameworkunifiedStatus sendDiagEventErrorResponse(EELL_ErrorCode f_errCode,
+ std::string f_destName);
+
+ EFrameworkunifiedStatus sendDiagEventResponse(void);
+
+ EFrameworkunifiedStatus SetDiagEventSourceName(std::string f_serviceName);
+
+ void SetMileage(UI_32 f_mileage);
+
+ void SetDiagSessionHandle(HANDLE hSession);
+
+ EFrameworkunifiedStatus SaveNaviLog(EPWR_SHUTDOWN_TRIGGER_TYPE errorType);
+ EFrameworkunifiedStatus CreateKernelLog(HANDLE f_hApp, SS_LOGGER_KLOG_OPE_TYPE type);
+
+ private:
+ typedef enum {
+ kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN,
+ kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN,
+ kSSL_ERROR_EVENT_TIMER_END
+ } ESSLErrorEventTimers;
+
+ // Logging Protocol Function Prototypes
+ EFrameworkunifiedStatus OnStartLogging(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnLogStartResponse(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnLogStartResponseTimeout(HANDLE f_hApp);
+ EFrameworkunifiedStatus RequestNextArtifact(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnArtifactResponse(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnArtifactResponseTimeout(HANDLE f_hApp);
+
+ // Protocol functions sent to self.
+ EFrameworkunifiedStatus OnArtifactRequest(HANDLE f_hApp);
+
+ // Error Event Artifact Request Function Prototypes
+ EFrameworkunifiedStatus SendLogArtifactResponseToSelf(
+ HANDLE f_hApp, EArtifactId f_artifactId,
+ std::string f_artifactFilePathAndName);
+
+ EFrameworkunifiedStatus OnObtainLoggerserviceLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainTransmitLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainPerformanceLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainScreenShotRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainScreenShotResponse(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainKernelLogInfoRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainDRInitialLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainDRLocationLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseOk(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseWriteFailed(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseNotFound(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseNoWritten(HANDLE f_hApp);
+ EFrameworkunifiedStatus CheckPathForArtifact(HANDLE f_hApp, TLoggingArtifact f_artifact);
+ EFrameworkunifiedStatus OnClearAllLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnNaviLogRequest(HANDLE f_hApp);
+
+ // verify function for external storage
+ EFrameworkunifiedStatus VerifyExtStorage(TLoggerErrorEvent event);
+ bool IsNeedVerify(EErrorEventType type);
+
+ HANDLE m_hApp;
+ bool m_bIsPrevEventCompleted;
+ CErrorEventCfg m_errorEventCfg;
+ TLoggerErrorEvent m_errorEventNtfData;
+ Timer m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_END];
+ std::vector<TLoggingArtifact> m_artifactRequestVec;
+ TArtifactResponseVec m_artifactResponseVec;
+ std::vector<FrameworkunifiedProtocolCallbackHandler> m_requesterCallbacksVec;
+ std::string m_archiveDestination;
+ CLoggerUtil m_loggerUtil;
+ CLoggerPopups m_loggerPopups;
+ CLoggerCfg* m_pLoggerCfg;
+ CLoggerErrorEventStorage m_loggerStorage;
+ CLoggerErrorEventCANEvtReply m_loggerCanEvent;
+ static const UI_32 m_loggingStartRspnToSec = 1;
+ static const UI_32 m_screenShotRspnToSec = 2;
+ CReaderWriterControl* m_pReaderWriterControl;
+
+ std::string m_ServiceName;
+ uint32_t m_time;
+ UI_32 m_currentEventTriggerNumber;
+ HANDLE m_diagsessionhandle;
+
+ HANDLE m_thrdEvntLogWriter;
+
+ public:
+ int m_sfd;
+};
+
+EFrameworkunifiedStatus SSLogger_SendtoSM(HANDLE f_hApp, TLoggingArtifact f_artifact);
+EFrameworkunifiedStatus SSLogger_SendtoSelf(HANDLE f_hApp, TLoggingArtifact f_artifact);
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_H_
+
diff --git a/systemservice/logger_service/server/include/ss_logger_error_event_archive.h b/systemservice/logger_service/server/include/ss_logger_error_event_archive.h
new file mode 100755
index 0000000..2b5212d
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_error_event_archive.h
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_ARCHIVE_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_ARCHIVE_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <libtar_listhash.h>
+#include <libtar.h>
+
+#include <system_service/ss_system_types.h>
+#include <string>
+#include <vector>
+
+class CErrorEventArchive {
+ public:
+ CErrorEventArchive();
+ ~CErrorEventArchive();
+
+ EFrameworkunifiedStatus openArchive(std::string f_pathAndName);
+
+ EFrameworkunifiedStatus addToArchive(std::vector<std::string> f_filePathAndNameList);
+
+ EFrameworkunifiedStatus addToArchive(std::string f_filePathAndName,
+ std::string f_destinationName, UI_8 f_depth =
+ CErrorEventArchive::MAX_DIRECTORY_DEPTH);
+
+ EFrameworkunifiedStatus closeArchive(void);
+
+ static SI_32 gzOpenArchive(PCHAR f_pcPathname, SI_32 f_siOflags,
+ SI_32 f_siMode);
+
+ static SI_32 gzCloseArchive();
+
+ static ssize_t gzWriteArchive(int fd, const void* buf, size_t count);
+
+ static ssize_t gzReadArchive(int fd, void* buf, size_t count);
+
+ static const UI_8 MAX_DIRECTORY_DEPTH = 4;
+
+ private:
+ EFrameworkunifiedStatus addFileToArchive(std::string f_filename,
+ std::string f_destinationName);
+
+ EFrameworkunifiedStatus addDirectoryToArchive(std::string f_path,
+ std::string f_destinationName, UI_8 f_depth =
+ CErrorEventArchive::MAX_DIRECTORY_DEPTH);
+
+ tartype_t m_gztype;
+ TAR *m_pTarInfo;
+ std::string m_pathAndName;
+ std::string m_tmpName;
+
+ static const UI_32 TARMODE = 0644;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_ARCHIVE_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_error_event_can_evt_reply.h b/systemservice/logger_service/server/include/ss_logger_error_event_can_evt_reply.h
new file mode 100755
index 0000000..b976cdb
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_error_event_can_evt_reply.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports notifying CAN abou HK and CAN error events
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CAN_EVT_REPLY_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CAN_EVT_REPLY_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_logger_service_protocol.h>
+
+#include "ss_logger_cfg.h"
+#include "ss_logger_error_event_cfg.h"
+#include "ss_logger_common.h"
+class CLoggerErrorEventCANEvtReply {
+ public:
+ CLoggerErrorEventCANEvtReply();
+ virtual ~CLoggerErrorEventCANEvtReply();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg);
+
+ BOOL IsEventNeeded(TLoggerErrorEvent f_event);
+ EFrameworkunifiedStatus PublishStartEvent(HANDLE f_hApp, TLoggerErrorEvent f_event);
+ EFrameworkunifiedStatus PublishEndEvent(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ UI_32 f_triggerNumber, uint32_t f_time);
+
+ EFrameworkunifiedStatus PublishErrorEvent(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ BOOL f_isValid, UI_32 f_triggerNumber,
+ uint32_t f_time);
+ private:
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CAN_EVT_REPLY_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_error_event_cfg.h b/systemservice/logger_service/server/include/ss_logger_error_event_cfg.h
new file mode 100755
index 0000000..1a0e39e
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_error_event_cfg.h
@@ -0,0 +1,135 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
+#include <system_service/ss_system_manager_if.h>
+#include <vector>
+#include <map>
+#include <string>
+
+#include "ss_logger_cfg.h"
+
+typedef UI_32 ARTIFACT_BIT_MASK;
+typedef UI_32 EVENT_BIT_MASK;
+
+#define NBR_ARTIFACT_BITS (sizeof(ARTIFACT_BIT_MASK) * 8)
+
+enum EVENT_BIT {
+ EVENT_BIT_NONE = 0x00000000,
+ EVENT_BIT_POPUP = 1 << (UI_32) 1,
+ EVENT_BIT_CAN_NOTIFICATION = 1 << (UI_32) 2,
+ EVENT_BIT_DIAG = 1 << (UI_32) 3,
+};
+
+struct TLoggingErrorEventInformation {
+ ARTIFACT_BIT_MASK ArtifactBitMask;
+ EVENT_BIT_MASK EventBitMask;
+};
+struct TLoggingArtifactCfg {
+ EErrorEventType ErrorType;
+ TLoggingErrorEventInformation Information;
+};
+struct TLoggerErrorEvent {
+ TLoggerErrorEvent()
+ : EventType(eErrorEventTypeMaxValue),
+ ModuleName(""),
+ isNeedReboot(FALSE),
+ EventBitMask(EVENT_BIT_NONE) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ TLoggerErrorEvent(SMErrorEventNtfData l_SMErrorEvent) { // NOLINT (runtime/explicit)
+ EventType = l_SMErrorEvent.EventType;
+ ModuleName = l_SMErrorEvent.ModuleName;
+ isNeedReboot = l_SMErrorEvent.isNeedReboot;
+ EventBitMask = EVENT_BIT_NONE;
+ }
+ EErrorEventType EventType;
+ std::string ModuleName;
+ BOOL isNeedReboot;
+ EVENT_BIT_MASK EventBitMask;
+};
+struct TLoggingArtifact;
+
+typedef EFrameworkunifiedStatus (*TLoggingCbFunction)(HANDLE, TLoggingArtifact);
+
+enum ECallbackType {
+ eCbTypePath = 0,
+ eCbTypeFunction,
+ eCbTypeInvalid
+};
+
+struct TLoggingArtifactCallback {
+ ECallbackType Type;
+ std::string Path;
+ TLoggingCbFunction Function;
+};
+
+struct TLoggingArtifactInformation {
+ std::string OwnerServiceName;
+ UI_32 RequestTimeoutMs;
+ TLoggingArtifactCallback Cb;
+ BOOL Remove;
+};
+struct TLoggingArtifact {
+ EArtifactId ArtifactId;
+ TLoggingArtifactInformation Information;
+};
+
+struct TLoggingArtifactResponse {
+ EArtifactId ArtifactId;
+ std::string Filepath;
+ BOOL Remove;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////
+///// External function definition for Logger callbacks
+//////////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SSLogger_SendtoSM(HANDLE f_hApp, TLoggingArtifact f_artifact);
+extern EFrameworkunifiedStatus SSLogger_SendtoSelf(HANDLE f_hApp,
+ TLoggingArtifact f_artifact);
+
+typedef std::map<EErrorEventType, TLoggingErrorEventInformation> TArtifactBitMaskMap;
+typedef std::map<EArtifactId, TLoggingArtifactInformation> TArtifactMap;
+typedef std::vector<TLoggingArtifactResponse> TArtifactResponseVec;
+
+class CErrorEventCfg {
+ public:
+ CErrorEventCfg(void);
+
+ ~CErrorEventCfg(void);
+
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* p_logger_cfg);
+
+ void GetArtifactRequestVec(
+ EErrorEventType f_eventType,
+ std::vector<TLoggingArtifact> &f_refArtifactRequestVec); // NOLINT (runtime/references)
+ EVENT_BIT_MASK GetEventsForErrorEvent(EErrorEventType f_eventType);
+ private:
+ UI_32 ValidateConfiguration();
+ TArtifactBitMaskMap m_errorEventTypeToArtifactBitMaskMap;
+ TArtifactMap m_errorArtifactMap;
+ UI_32 m_ext_log_num;
+
+ static TLoggingArtifactCfg m_loggerErrorEventCfgTbl[eErrorEventTypeMaxValue];
+ static TLoggingArtifact m_loggerErrorArtifactCfgTbl[eArtifactIdMaxValue];
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_error_event_storage.h b/systemservice/logger_service/server/include/ss_logger_error_event_storage.h
new file mode 100755
index 0000000..8a2cbd4
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_error_event_storage.h
@@ -0,0 +1,82 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_STORAGE_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_STORAGE_H_
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <mqueue.h>
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <ss_logger_error_event_cfg.h>
+#include <stub/Clock_API.h>
+#include <string>
+#include "ss_logger_cfg.h"
+
+enum ELoggerStorageThreadCommands {
+ eLoggerStorageThreadCmdOK = 0xAFFE,
+ eLoggerStorageThreadCmdWriteFailed,
+ eLoggerStorageThreadCmdNotFound,
+ eLoggerStorageThreadCmdNoWritten
+};
+
+class CLoggerErrorEventStorage {
+ public:
+ CLoggerErrorEventStorage();
+ virtual ~CLoggerErrorEventStorage();
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp, std::string f_ParentName,
+ CLoggerCfg *f_pLoggerCfg);
+
+ EFrameworkunifiedStatus Start(std::string f_target, TArtifactResponseVec f_responseVector,
+ uint32_t f_time);
+
+ void ThreadFunction(void);
+ void Cleanup(void);
+
+ private:
+ static void* ThreadFunctionWrapper(void* param);
+ static void CleanupWrapper(void* param);
+
+ EFrameworkunifiedStatus PackageAndPlaceArtifacts(std::string f_archiveDestination,
+ TArtifactResponseVec &f_responseVector, // NOLINT (runtime/references)
+ uint32_t l_logTime);
+
+ SI_32 CopyFiles(std::string f_archiveDestination,
+ TArtifactResponseVec &f_responseVector, BOOL isDeleteFiles); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus RemoveDeprecatedArtifacts(TArtifactResponseVec &f_responseVector); // NOLINT (runtime/references)
+ HANDLE m_parentMcQueue;
+ pthread_t m_thread;
+ pthread_mutex_t m_mutex;
+ mqd_t m_sendQueue;
+ mqd_t m_receiveQueue;
+ std::string m_destination;
+ TArtifactResponseVec m_responseVec;
+ struct mq_attr m_mqattr;
+ SI_32 m_mutexInit;
+ CLoggerCfg *m_pLoggerCfg;
+ SLoggerStorageInfo m_loggerStorageInfo;
+ uint32_t m_logTime;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_STORAGE_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_fs_directory.h b/systemservice/logger_service/server/include/ss_logger_fs_directory.h
new file mode 100755
index 0000000..7e8da15
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_fs_directory.h
@@ -0,0 +1,108 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file contains declaration of class CFSDirectory.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_FS_DIRECTORY_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_FS_DIRECTORY_H_
+#include <native_service/frameworkunified_types.h>
+#include<string>
+
+// Class to provide file system directory operations like create,delete etc.
+class CFSDirectory {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFSDirectory
+ /// Constructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFSDirectory
+ /// Destructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to check if the directory exists.
+ ///
+ /// \param [in] f_cDirPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL DoesDirectoryExist(std::string &f_cDirPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to create a directory.
+ ///
+ /// \param [in] f_cDirPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus CreateDirectory(std::string &f_cDirPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to verify directory.
+ ///
+ /// \param [in] f_cPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL IsDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to delete directory.
+ ///
+ /// \param [in] f_cPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL RemoveDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to delete file in direcotry.
+ ///
+ /// \param [in] f_cPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL RemoveSubDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_FS_DIRECTORY_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_popups.h b/systemservice/logger_service/server/include/ss_logger_popups.h
new file mode 100755
index 0000000..b5b50e8
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_popups.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_POPUPS_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_POPUPS_H_
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <string>
+#include <vector>
+
+#include "ss_logger_cfg.h"
+#include "ss_logger_error_event_cfg.h"
+class CLoggerPopups {
+ public:
+ CLoggerPopups();
+ virtual ~CLoggerPopups();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg);
+ BOOL IsPopupNeeded(TLoggerErrorEvent f_event);
+ BOOL CanShowStartPopup(std::vector<TLoggingArtifact>* f_remainingArtifact);
+ EFrameworkunifiedStatus ShowStartPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ std::vector<TLoggingArtifact>* f_remainingArtifact,
+ std::string f_dest);
+ EFrameworkunifiedStatus ShowEndPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ std::string f_dest);
+ EFrameworkunifiedStatus ShowErrorPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ UI_16 f_errCode);
+ std::string getDeviceName(std::string f_dest);
+ private:
+ CLoggerCfg *m_pLoggerCfg;
+ BOOL m_startShown;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_POPUPS_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_reader_writer_control.h b/systemservice/logger_service/server/include/ss_logger_reader_writer_control.h
new file mode 100755
index 0000000..04d1937
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_reader_writer_control.h
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * ss_logger_reader_writer_control.h
+ */
+
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_READER_WRITER_CONTROL_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_READER_WRITER_CONTROL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer.h"
+#include "ss_logger_cfg.h"
+
+enum EReaderWriterType {
+ eReaderWriterLogDebug,
+ eReaderWriterLogTransmit,
+ eReaderWriterLogPerformance,
+ eReaderWriterLogInvalid
+};
+class CReaderWriterControl {
+ public:
+ CReaderWriterControl();
+ virtual ~CReaderWriterControl();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg);
+ EFrameworkunifiedStatus UpdateLoggingParams(void* param);
+ EFrameworkunifiedStatus FlushCache(EReaderWriterType f_type);
+ private:
+ CLoggerCfg * m_pLoggerCfg;
+ ReaderWriter::CReaderWriter m_debugReaderWriter;
+ ReaderWriter::CReaderWriter m_transmitReaderWriter;
+ ReaderWriter::CReaderWriter m_performanceReaderWriter;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_READER_WRITER_CONTROL_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_scrshot.h b/systemservice/logger_service/server/include/ss_logger_scrshot.h
new file mode 100755
index 0000000..5cc9dd9
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_scrshot.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_
+
+#define JPEG_PATH_CH0 "/nv/BS/ss/logger_service/rwdata/screenShot/screen_shot_Ch0.jpeg"
+#define JPEG_PATH_CH1 "/nv/BS/ss/logger_service/rwdata/screenShot/screen_shot_Ch1.jpeg"
+#define SCRSHOT_EXE_PATH "/usr/agl/bin/SS_ScrShot"
+#define SCREEN_SHOT_PATH "/nv/BS/ss/logger_service/rwdata/screenShot"
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_service_callbacks.h b/systemservice/logger_service/server/include/ss_logger_service_callbacks.h
new file mode 100755
index 0000000..786054c
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_service_callbacks.h
@@ -0,0 +1,96 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file contains the callback for Notifications and Protocol
+/// commands.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SERVICE_CALLBACKS_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SERVICE_CALLBACKS_H_
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <system_service/ss_error_event_common.h>
+#include "ss_logger_error_event.h"
+#include "ss_logger_reader_writer_control.h"
+#include "ss_logger_cfg.h"
+
+class CLoggerServiceCallbacks {
+ private:
+ static const UI_32 kNUMBER_PROTOCOL_HANDLERS = 17u;
+ FrameworkunifiedProtocolCallbackHandler m_protocolHandlers[kNUMBER_PROTOCOL_HANDLERS];
+ CLoggerCfg *m_pLoggerCfg;
+ CErrorEvent *m_pErrorEvent;
+
+ public:
+ CLoggerServiceCallbacks();
+ ~CLoggerServiceCallbacks();
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp, CLoggerCfg *f_pLoggerCfg,
+ CErrorEvent *f_pErrorEvent);
+
+ EFrameworkunifiedStatus LoggerServerOnOpenSession(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServerOnCloseSession(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_SetMileageData(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_SetLoggerParams(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_UDPLogging(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_SetCurrentDateTime(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_UpdateCommonInfo(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_Handle_CWORD56_Events(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_LogResetEvents(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnCopyEmergencyLog(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnCANTrigger(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnDTCTrigger(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus LoggerServer_On_SHTDWN_Complete(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnSetVIN(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnCopyEvntLog(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnClearEvntLog(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnReadNumberOfEvents(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnReadStatCounter(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnResetStatCounter(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnSetDiagID(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_UploadEventLog(HANDLE hApp);
+
+ HANDLE RetrieveRegisteredClientHandle(HANDLE hApp, PCSTR pRequester);
+};
+
+EFrameworkunifiedStatus LoggerService_OnStop(HANDLE hApp);
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SERVICE_CALLBACKS_H_
+
diff --git a/systemservice/logger_service/server/include/ss_logger_types.h b/systemservice/logger_service/server/include/ss_logger_types.h
new file mode 100755
index 0000000..11542a5
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_types.h
@@ -0,0 +1,52 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports shared internal logger module data types.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_TYPES_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_TYPES_H_
+
+#include <native_service/frameworkunified_sm_eventdata.h>
+
+typedef enum _ENPS_Archivetype {
+ ARCHTYPE_COMPRESSION = 0, // Compression
+ ARCHTYPE_DECOMPRESSION = 1 // DeCompression
+} ENPS_Archivetype;
+
+typedef CHAR CopyInfoStr[MAX_PATH_LENGTH]; ///< Information passed via the framework
+
+typedef enum _LOGGERSERVICE_COMPRESSION_TYPE {
+ eLoggerserviceNone = 0, // No Compression before file persistence
+ eLoggerserviceDefaultCompression, // Compress file before persistence using default compression method
+ eLoggerserviceCompressUsingLibz // Compress file before persistence using libz
+} LOGGERSERVICE_COMPRESSION_TYPE;
+
+typedef struct _NPS_CopyInfoMsg {
+ CopyInfoStr m_cSourcePath; // Source path
+ CopyInfoStr m_cDestinationPath; // Destination path
+ ENPS_Archivetype m_eArchiveType; // Compression or DeCompression
+ LOGGERSERVICE_COMPRESSION_TYPE m_eCompressionType; // Check for Compression of the file
+} NSP_CopyInfoCmd;
+
+typedef struct _NPS_CopyStatus {
+ BOOL m_bPersistenceChk; // Persistence Success or Failure
+ LOGGERSERVICE_COMPRESSION_TYPE m_eCompressionType; // Check for Compression of the file
+} NSP_CopyStatusResponse, NSP_CopyCancel;
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_TYPES_H_
diff --git a/systemservice/logger_service/server/include/ss_logger_util.h b/systemservice/logger_service/server/include/ss_logger_util.h
new file mode 100755
index 0000000..a49e022
--- /dev/null
+++ b/systemservice/logger_service/server/include/ss_logger_util.h
@@ -0,0 +1,127 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief Provide support for SS Logger module utility functions.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_UTIL_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_UTIL_H_
+
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_system_manager_if.h>
+#include <string>
+#include <vector>
+#include "ss_logger_error_event_cfg.h"
+#include "loggerservicedebug_loggerservicelog.h"
+#include "ss_logger_cfg.h"
+///////////////////////////////////////////////////////////////////////////////
+// DEFINE
+///////////////////////////////////////////////////////////////////////////////
+// If you changed BUF_MAX_SIZE, To contact the secure team.
+// Because There is impact for decrypt tool.
+#define BUF_MAX_SIZE (1024*8)
+#define USB_PATH_SIZE 64
+#ifdef RELEASE_BUILD
+#define DEV_ENC_EXTENSION ".enc1"
+#define REL_ENC_EXTENSION ".enc2"
+#define ALIGNMENT_SIZE 4
+#endif // RELEASE_BUILD
+#define LOGGER_TMP_FN "__LOGGER.tmp"
+
+///////////////////////////////////////////////////////////////////////////////
+// CONFIGURATION CLASS DEFINITION
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _ELoggerserviceLogType {
+ eLoggerservicelogTypeNormal,
+ eLoggerservicelogTypeAbnormal,
+ eLoggerservicelogTypeGrpRelaunch,
+ eLoggerservicelogTypeOther,
+} ELOGGERSERVICELOGTYPE;
+
+class CLoggerUtil {
+ public:
+ CLoggerUtil(void);
+
+ ~CLoggerUtil(void);
+
+ EFrameworkunifiedStatus Initialize(CLoggerCfg *f_pLoggerCfg);
+
+ EFrameworkunifiedStatus checkDestinationAvailable(TLoggerErrorEvent &f_eventNtfData); // NOLINT (runtime/references)
+ std::string getDestination(TLoggerErrorEvent &f_eventNtfData); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus getFilePathAndName(HANDLE f_hApp,
+ TLoggerErrorEvent &f_eventNtfData, // NOLINT (runtime/references)
+ uint32_t f_time, std::string &f_pathAndName); // NOLINT (runtime/references)
+ void SetMilage(UI_32 f_milage);
+
+ EFrameworkunifiedStatus getEmmcNaviLogParams(uint32_t f_time,
+ EPWR_SHUTDOWN_TRIGGER_TYPE errorType,
+ std::string &f_pathAndName, UI_32 &f_logMax); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus deleteOldLog(std::string log_path,
+ std::vector<std::string> &l_vector, // NOLINT (runtime/references)
+ std::string &f_archive_destination, UI_32 max_num); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus deleteOldEmmcLog(std::string &f_archive_destination, // NOLINT (runtime/references)
+ EErrorEventType type);
+ static EFrameworkunifiedStatus forceDeleteOldLog(std::string f_archive_destination,
+ size_t f_req_size);
+ static size_t deleteRequestLogs(std::string f_emmcpath, ELOGGERSERVICELOGTYPE f_reqtype,
+ size_t f_reqsize, ELOGGERSERVICELOGTYPE f_deltype);
+ static EFrameworkunifiedStatus CopyFile(std::string f_source, std::string f_destination);
+ static EFrameworkunifiedStatus CopyUntyped(std::string f_source,
+ std::string f_destination);
+ static EFrameworkunifiedStatus CopyDirectory(std::string f_source,
+ std::string f_destination);
+
+ static EFrameworkunifiedStatus MoveFile(std::string f_source, std::string f_destination);
+ static EFrameworkunifiedStatus MoveUntyped(std::string f_source,
+ std::string f_destination);
+ static EFrameworkunifiedStatus MoveDirectory(std::string f_source,
+ std::string f_destination);
+
+ static ELOGGERSERVICELOGTYPE QueryLoggerservicelogType(std::string f_logname);
+ static void SyncDir(std::string f_dir_path);
+#ifdef RELEASE_BUILD
+ static EFrameworkunifiedStatus PathCheckAndCopyFile(std::string f_source,
+ std::string f_destination);
+#endif // RELEASE_BUILD
+ void SetUsbMountPath(std::string usbpath);
+
+ private:
+ std::string GetUserInvokedFilename(HANDLE f_hApp, uint32_t f_time);
+ std::string GetEmmcFilename(uint32_t f_time);
+ std::string GetEmmcErrorFilename(uint32_t f_time);
+ std::string GetEmmcNaviLogFilename(uint32_t f_time);
+ std::string GetTimeString(uint32_t f_time);
+
+ EFrameworkunifiedStatus getNaviLogFilePathAndName(std::string &f_prefix, uint32_t f_time, // NOLINT (runtime/references)
+ std::string &f_pathAndName); // NOLINT (runtime/references)
+
+ CLoggerCfg *m_pCfg;
+ UI_32 m_Milage;
+ UI_32 m_bootCount;
+ static char m_usbpath[USB_PATH_SIZE];
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_UTIL_H_
+
diff --git a/systemservice/logger_service/server/lib/Makefile b/systemservice/logger_service/server/lib/Makefile
new file mode 100755
index 0000000..fff8c36
--- /dev/null
+++ b/systemservice/logger_service/server/lib/Makefile
@@ -0,0 +1,62 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+
+
+######### installed library(*.a) #############
+INST_LIBS = libSS_LoggerStoreLogs
+
+######### installed shared library(*.so) #############
+
+
+######### install headers(*.h) #############
+
+
+######### compiled sources #############
+libSS_LoggerStoreLogs_SRCS += ss_logger_store_logs.cpp
+
+######### add source path #############
+
+
+######### add include path #############
+CPPFLAGS += -I./
+CPPFLAGS += -I../include
+
+CPPFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30
+CPPFLAGS += -fno-exceptions
+
+######### linked library #############
+
+
+######### linked library (dynamic) #############
+
+
+######### add library path #############
+LDFLAGS += -g -shared
+LDFLAGS += -Wl,--no-as-needed
+include ../../../system_service.mk
diff --git a/systemservice/logger_service/server/lib/ss_logger_store_logs.cpp b/systemservice/logger_service/server/lib/ss_logger_store_logs.cpp
new file mode 100755
index 0000000..2bd8b79
--- /dev/null
+++ b/systemservice/logger_service/server/lib/ss_logger_store_logs.cpp
@@ -0,0 +1,2233 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_Logger
+/// \brief This file supports the logger service interface for SystemManager.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_logger_store_logs.h"
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <libtar_listhash.h>
+#include <libtar.h>
+#include <zlib.h>
+#include <sys/klog.h>
+
+#include <stdlib.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_system_types.h>
+#include <native_service/ns_ringbuffer.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/cl_lockid.h>
+#include <stub/Clock_API.h>
+#include <vector>
+#include <sstream>
+#include <iomanip>
+#include <string>
+#include <algorithm>
+#include "ss_logger_store_logs_loggerservicelog.h"
+#include "ss_logger_cfg.h"
+
+#define LOGGERSERVICELOG_CONFIG_PATH "/usr/agl/conf/BS/ss/logger_service/rodata/ss_logger.cfg"
+#define LOGGER_TMP_FN "__LOGGER.tmp"
+#define LOGGERSERVICELOG_TMP_OUTPUT_PATH "/tmp"
+#define PSTORE_DIR_PATH "/dev/pstore"
+#define KERNEL_BOOT_LOG_FN "kernelboot.log"
+#define KERNEL_LOG_FN "kernel.log"
+#define COMMUNICATION_DIR_NAME "communication"
+#define ACCOFFON_DIR_NAME "accoffon"
+
+#define PATHNAME_SEPARATOR '/'
+#define PATHNAME_SEPARATOR_STR "/"
+#define SS_STORE_FILENAME_SYSILG_TERM "_SYS_ILG_RESET.tar.gz"
+#define SS_STORE_FILENAME__CWORD52__TERM "__CWORD52_.log"
+#define LOGARCHIVE_FILENAME_STORE_ARCHIVE "/tmp/ss_logger_ilgfilenum"
+#define TMPFILE_MODE 0640
+#define SSLOGGER_PATHNAME (255 + 1)
+#define FILENUMBER_UPPER_LIMIT_OVER 100000u
+#define FILENUMBER_LOWER_LIMIT 1u
+#define FILENUMBER_DIGIT_NUM 5
+#define INVALID_FILENUMBER (FILENUMBER_UPPER_LIMIT_OVER)
+
+
+/* Read all messages remaining in the ring buffer. (allowed for non-root) */
+#define SYSLOG_ACTION_READ_ALL 3
+/* Return size of the log buffer */
+#define SYSLOG_ACTION_SIZE_BUFFER 10
+
+#define ENABLE_DEBUG_LOG 0
+#if ENABLE_DEBUG_LOG
+#define DEB_LOGGERSERVICELOG(zone,funcname,print_fmt, ...) if(zone!=ZONE_FUNC) \
+fprintf(stderr,"%d/%s/%d:="print_fmt"\n", zone, funcname, __LINE__,##__VA_ARGS__)
+#else
+#define DEB_LOGGERSERVICELOG(zone,funcname,print_fmt, ...)
+#endif
+
+typedef struct {
+ std::string output_path;
+ SI_32 output_max;
+ SI_32 output_errmax;
+ SI_32 external_log_num;
+ SI_32 external_log_max;
+} CfgInfo;
+
+typedef struct {
+ std::string file_path;
+ std::string dest_name;
+ BOOL tmp_file_delete;
+} LogInfo;
+
+typedef struct {
+ std::string path;
+ int index;
+} LoggerservicelogInfo;
+
+
+static const char* sys_illegal_log[] = {
+ "frameworkunified_sys.log",
+ };
+
+
+typedef enum {
+ SS_STORELOGS_KERNEL_LOG = 0,
+ SS_STORELOGS_KERNEL_BOOT_LOG
+} SS_STORELOGS_KERNEL_LOG_TYPE;
+
+typedef void (*GetLogFileFunc)(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list); // NOLINT (runtime/references)
+
+static const UI_8 MAX_DIRECTORY_DEPTH = 4;
+static const UI_32 TARMODE = 0644;
+
+static EFrameworkunifiedStatus addToArchive(TAR* f_pTarInfo, std::string f_filePathAndName,
+ std::string f_destinationName, UI_8 f_depth =
+ MAX_DIRECTORY_DEPTH);
+static EFrameworkunifiedStatus addDirectoryToArchive(TAR* f_pTarInfo, std::string f_path,
+ std::string f_destinationName,
+ UI_8 f_depth = MAX_DIRECTORY_DEPTH);
+static SI_32 gzOpenArchive(PCHAR f_pcPathname, SI_32 f_siOflags,
+ SI_32 f_siMode);
+static SI_32 gzCloseArchive();
+static ssize_t gzWriteArchive(int fd, const void* buf, size_t count);
+static ssize_t gzReadArchive(int fd, void* buf, size_t count);
+static EFrameworkunifiedStatus addFileToArchive(TAR* f_pTarInfo, std::string f_filename,
+ std::string f_destinationName);
+static EFrameworkunifiedStatus addAllFileToArchive (TAR* f_pTarInfo, std::string collectDir);
+static EFrameworkunifiedStatus copyFile(std::string f_source, std::string f_destination);
+static EFrameworkunifiedStatus copyDirectory (std::string f_source, std::string f_destination);
+static EFrameworkunifiedStatus copyUntyped (std::string f_source, std::string f_destination);
+static EFrameworkunifiedStatus copyFileToAccOffOnDir(std::vector<LogInfo>& list, SS_STORELOGS_OPE_TYPE type);
+static void getLoggerservicelogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list, // NOLINT (runtime/references)
+ std::vector<LoggerservicelogInfo> &loggerservicelogList); // NOLINT (runtime/references)
+static void getKernellogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list); // NOLINT (runtime/references)
+static void getLastKernelLog(std::vector<LogInfo>& list); // NOLINT (runtime/references)
+static void getKernelLog(std::vector<LogInfo>& list); // NOLINT (runtime/references)
+static void getKernelBootLog(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list); // NOLINT (runtime/references)
+static void getCommunicationlogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list); // NOLINT (runtime/references)
+static void getExternallogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list); // NOLINT (runtime/references)
+
+//static std::string getFileName(std::string &path, uint32_t f_time, // NOLINT (runtime/references)
+// SS_STORELOGS_OPE_TYPE type);
+static std::string getFileName(std::string &path, uint32_t f_time, // NOLINT (runtime/references)
+ SS_STORELOGS_OPE_TYPE type, UI_32 l_counter);
+
+static void getEmmcCounter(std::string &path, UI_32& f_counter); // NOLINT (runtime/references)
+static void getConfigInfo(CfgInfo& f_cfginfo); // NOLINT (runtime/references)
+static EFrameworkunifiedStatus deleteOldEmmcLog(CfgInfo& f_cfginfo, // NOLINT (runtime/references)
+ std::string& f_archive_destination, // NOLINT (runtime/references)
+ SS_STORELOGS_OPE_TYPE type);
+static EFrameworkunifiedStatus storeLogs(SS_STORELOGS_OPE_TYPE type);
+static EFrameworkunifiedStatus deleteOldLog(std::string log_path,
+ std::vector<std::string>& l_vector, // NOLINT (runtime/references)
+ std::string& f_archive_destination, // NOLINT (runtime/references)
+ UI_32 max_num);
+static size_t deleteRequestLogs(std::string f_emmcpath, ELOGGERSERVICELOGTYPE f_reqtype,
+ size_t f_reqsize, ELOGGERSERVICELOGTYPE f_deltype);
+static EFrameworkunifiedStatus forceDeleteOldLog(std::string f_archive_destination,
+ size_t f_req_size);
+static ELOGGERSERVICELOGTYPE QueryLoggerservicelogType(std::string f_logname);
+static void SyncDir(std::string f_dir_path);
+static BOOL RemoveSubDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+static void CreateSaveFinFlag(SS_STORELOGS_OPE_TYPE type);
+static void ClearLoggerservicelogBuffer(std::vector<LoggerservicelogInfo> &loggerservicelogList); // NOLINT (runtime/references)
+static void copyLoggerservicelogFile(std::string distPath);
+static void deleteTmpAccOffOn(std::string accOffOnDir);
+static void deleteAccOffOnDir(std::string deletePath);
+static void deleteAccOffOnUntyped(std::string deletePath);
+
+static EFrameworkunifiedStatus getFileNumber(const std::string &filename,UI_32 &number);
+static bool compareFileNumber(UI_32 filename1_number,const std::string &filename2);
+static EFrameworkunifiedStatus removeFiles(const std::string &log_path, std::vector<std::string> &l_vector,
+ size_t begin_pos, size_t end_pos);
+static EFrameworkunifiedStatus removeSameNumFiles(std::vector<std::string>::iterator &itr, const std::string &log_path,
+ std::vector<std::string> &l_vector);
+static EFrameworkunifiedStatus deleteOldLogAbnrm(const std::string& log_path, std::vector<std::string>& l_vector,
+ const std::string& f_archive_destination, SI_32 max_num, UI_32 abnrm_total);
+static EFrameworkunifiedStatus storeTempArchive(const std::string &real_name);
+static EFrameworkunifiedStatus getFileNumberFromTempArchive(UI_32 &filenumber);
+
+
+static std::string m_pathAndName; // NOLINT (runtime/string)
+static std::string m_tmpName; // NOLINT (runtime/string)
+
+const GetLogFileFunc GetLogFuncTbl[] = { getKernellogFile,
+ getCommunicationlogFile,
+ getExternallogFile
+ };
+// GZF save variables
+static gzFile g_gztype;
+
+// ->Bus-Error avoidance
+static tartype_t l_gztype;
+
+static EFrameworkunifiedStatus openArchive(TAR** f_pTarInfo, std::string f_pathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+// ->Bus-Error avoidance (because of local variables, content becomes indeterminate when functions exit)
+// tartype_t l_gztype;
+
+ *f_pTarInfo = NULL;
+ g_gztype = NULL;
+ l_gztype.openfunc = (openfunc_t) &gzOpenArchive;
+ l_gztype.closefunc = (closefunc_t) &gzCloseArchive;
+ l_gztype.readfunc = (readfunc_t) &gzReadArchive;
+ l_gztype.writefunc = (writefunc_t) &gzWriteArchive;
+
+ m_pathAndName = f_pathAndName;
+
+ /* check if directory exists */
+ size_t l_found = f_pathAndName.find_last_of('/');
+ std::string l_path = f_pathAndName.substr(0, l_found);
+
+ if (0 != access(l_path.c_str(), F_OK)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory does not exist. Creating...");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ /* create archive in tmp */
+ m_tmpName = "/tmp/log.tar.gz";
+
+ int l_tarRetVal = tar_open(f_pTarInfo, const_cast<char*>(m_tmpName.c_str()), &l_gztype,
+ O_WRONLY | O_CREAT, TARMODE, TAR_GNU);
+
+ if ((l_tarRetVal != 0) || (*f_pTarInfo == NULL) || g_gztype == NULL) { // LCOV_EXCL_BR_LINE 6: tar_open must return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: tar_open must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open TAR-Archive!");
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+static EFrameworkunifiedStatus addToArchive(TAR* f_pTarInfo, std::string f_filePathAndName,
+ std::string f_destinationName, UI_8 f_depth) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFileLoadError;
+ struct stat l_stat;
+ int l_statRetVal;
+
+ if (0 != access(f_filePathAndName.c_str(), F_OK)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. The specified file path and name does not exist: %s",
+ f_filePathAndName.c_str());
+ } else if (0 != (l_statRetVal = stat(f_filePathAndName.c_str(), &l_stat))) { // LCOV_EXCL_BR_LINE 5: stat's error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5: stat's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. stat() for file or directory returned error: %s -> %d",
+ f_filePathAndName.c_str(), l_statRetVal);
+ // LCOV_EXCL_STOP
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ if (0 < f_depth) { // LCOV_EXCL_BR_LINE 6: f_depth must be greater than 0
+ l_eFrameworkunifiedStatus = addDirectoryToArchive(f_pTarInfo, f_filePathAndName,
+ f_destinationName, f_depth);
+ } else {
+ // LCOV_EXCL_START 6: f_depth must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Maximum recursive depth reached! File %s not added to archive.",
+ f_filePathAndName.c_str());
+ // LCOV_EXCL_STOP
+ }
+ } else if (0 != S_ISREG(l_stat.st_mode)) {
+ char path[PATH_MAX];
+ if (realpath(f_filePathAndName.c_str(), path) != NULL) {
+ f_filePathAndName = path;
+ l_eFrameworkunifiedStatus = addFileToArchive(f_pTarInfo, f_filePathAndName,
+ f_destinationName);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Archive not opened or could not access file: \"%s\"",
+ f_filePathAndName.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. specified file may be a symbolic link or other non 'regular' type. File: %s, mode: 0x%04X.",
+ f_filePathAndName.c_str(), l_stat.st_mode);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+
+static EFrameworkunifiedStatus getFileNumberFromTempArchive(UI_32 &filenumber)
+{
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ char buf[FILENUMBER_DIGIT_NUM + 1];
+ int fd;
+ int result;
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ fd = open(LOGARCHIVE_FILENAME_STORE_ARCHIVE, O_RDONLY);
+ if (fd == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. open(). path = %s ,errno = %d", LOGARCHIVE_FILENAME_STORE_ARCHIVE, errno);
+ return eFrameworkunifiedStatusAccessError;
+ }
+
+ result = read(fd, buf, FILENUMBER_DIGIT_NUM);
+ if (result != FILENUMBER_DIGIT_NUM) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. read(). path = %s ,result = %d, errno = %d",
+ LOGARCHIVE_FILENAME_STORE_ARCHIVE, result, errno);
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ } else {
+ char *endptr;
+ int error_number;
+ int temp_value;
+ buf[FILENUMBER_DIGIT_NUM] = '\x0';
+ errno = EOK;
+ temp_value = strtol(buf, &endptr, 10);
+ error_number = errno;
+ if ((error_number != EOK) || (*endptr != '\x0')) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. Failed to comvert string. source = %s ,errno = %d", buf, errno);
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ filenumber = temp_value;
+ }
+ }
+ result = close(fd);
+ if (result != 0) { // LCOV_EXCL_BR_LINE 6: close() must return ok
+ // LCOV_EXCL_START 6: close() must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. close(). path = %s ,errno = %d", LOGARCHIVE_FILENAME_STORE_ARCHIVE, errno);
+ // LCOV_EXCL_STOP
+ }
+ result = remove(LOGARCHIVE_FILENAME_STORE_ARCHIVE);
+ if (result != 0) { // LCOV_EXCL_BR_LINE 6: remove() must return ok
+ // LCOV_EXCL_START 6: remove() must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. remove(). path = %s ,errno = %d", LOGARCHIVE_FILENAME_STORE_ARCHIVE, errno);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eFrameworkunifiedStatus;
+}
+
+static EFrameworkunifiedStatus storeTempArchive(const std::string &real_name)
+{
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string filename;
+ size_t pos;
+ int fd;
+ int result;
+ const char *p_real_filename;
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ fd = open(LOGARCHIVE_FILENAME_STORE_ARCHIVE, O_CREAT | O_WRONLY, TMPFILE_MODE);
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: open's error case
+ // LCOV_EXCL_START 5: open's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. open(). path = %s ,errno = %d", LOGARCHIVE_FILENAME_STORE_ARCHIVE, errno);
+ return eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+
+ pos = real_name.find_last_of(PATHNAME_SEPARATOR);
+ if (pos == std::string::npos) { // LCOV_EXCL_BR_LINE 6: there must be '/' in string real_name
+ // LCOV_EXCL_START 6: there must be '/' in string real_name
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ p_real_filename = real_name.c_str();
+ // LCOV_EXCL_STOP
+ } else {
+ p_real_filename = &real_name[pos + 1];
+ }
+
+ result = write(fd, p_real_filename, FILENUMBER_DIGIT_NUM);
+ if (result != FILENUMBER_DIGIT_NUM) { // LCOV_EXCL_BR_LINE 5: write's error case
+ // LCOV_EXCL_START 5: write's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. write(). path = %s ,result = %d, errno = %d",
+ LOGARCHIVE_FILENAME_STORE_ARCHIVE, result, errno);
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+
+ result = close(fd);
+ if (result != 0) { // LCOV_EXCL_BR_LINE 5: close's error case
+ // LCOV_EXCL_START 5: close's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. close(). path = %s ,errno = %d", LOGARCHIVE_FILENAME_STORE_ARCHIVE, errno);
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eFrameworkunifiedStatus;
+}
+
+
+
+//static EFrameworkunifiedStatus closeArchive(TAR* f_pTarInfo) {
+static EFrameworkunifiedStatus closeArchive(TAR* f_pTarInfo, SS_STORELOGS_OPE_TYPE type) {
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (0 != tar_append_eof(f_pTarInfo)) { // LCOV_EXCL_BR_LINE 5: tar_append_eof's error case
+ // LCOV_EXCL_START 5: tar_append_eof's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_append_eof()");
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ if (0 != tar_close(f_pTarInfo)) { // LCOV_EXCL_BR_LINE 5: tar_close's error case
+ // LCOV_EXCL_START 5: tar_close's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not close archive");
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eFrameworkunifiedStatus) { // LCOV_EXCL_BR_LINE 6: l_eFrameworkunifiedStatus must be eFrameworkunifiedStatusOK
+ l_eFrameworkunifiedStatus = copyFile(m_tmpName, m_pathAndName);
+ if (eFrameworkunifiedStatusOK == l_eFrameworkunifiedStatus) {
+
+ if (type == SS_STORELOGS_ILLEGAL) {
+ l_eFrameworkunifiedStatus = storeTempArchive(m_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eFrameworkunifiedStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error. Failed to store temporary file.");
+ }
+ }
+
+ l_eFrameworkunifiedStatus =
+ (0 == remove(m_tmpName.c_str())) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFault;
+ if (eFrameworkunifiedStatusOK != l_eFrameworkunifiedStatus) { // LCOV_EXCL_BR_LINE 5: remove's error case
+ // LCOV_EXCL_START 5: remove's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_WARN,
+ __FUNCTION__,
+ " Warning. Failed to remove temporary archive. Will overwrite on next event");
+ // LCOV_EXCL_STOP
+ }
+ } else if (eFrameworkunifiedStatusErrNoEAGAIN == l_eFrameworkunifiedStatus) { // LCOV_EXCL_BR_LINE 4: no space error case
+ // LCOV_EXCL_START 4: no space error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // disk space full
+ struct stat st_buf;
+ size_t req_size;
+ if (stat(m_tmpName.c_str(), &st_buf) != -1) {
+ req_size = st_buf.st_size;
+ if (eFrameworkunifiedStatusOK == forceDeleteOldLog(m_pathAndName, req_size)) {
+ l_eFrameworkunifiedStatus = copyFile(m_tmpName, m_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eFrameworkunifiedStatus) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Try Again but Error. Failed to copy to destination.%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. force delete failed.%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " emmc full: dest=%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Warning. Failed to get tmp log file stat. dest=%s",
+ m_pathAndName.c_str());
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ /* should we copy lost archive to emmc?? */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Failed to copy to destination. %s", m_pathAndName.c_str());
+ }
+ remove(m_tmpName.c_str());
+ m_tmpName = "";
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+static EFrameworkunifiedStatus addFileToArchive(TAR* f_pTarInfo, std::string f_filename,
+ std::string f_destinationName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK; /* check if Tar is open and if file can be read */
+
+ if ((NULL != f_pTarInfo) && (0 == access(f_filename.c_str(), R_OK))
+ && (0 != f_destinationName.length())) {
+ int l_tarRetVal = tar_append_file(f_pTarInfo, const_cast<char*>(f_filename.c_str()),
+ const_cast<char*>(f_destinationName.c_str()));
+ if (0 != l_tarRetVal) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not add file \'%s\' to tar archive.", f_filename.c_str());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Archive not opened or could not access file: \"%s\"",
+ f_filename.c_str());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+static EFrameworkunifiedStatus addAllFileToArchive (TAR* f_pTarInfo, std::string collectDir)
+{
+ struct dirent l_pDirent;
+ struct dirent* next;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR * l_pDir = opendir(collectDir.c_str());
+ if (l_pDir == NULL) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s", collectDir.c_str());
+ } else {
+ while (0 == readdir_r(l_pDir,&l_pDirent,&next) && next != NULL) {
+ if ( ( 0 != strcmp( l_pDirent.d_name, "." ) ) &&
+ ( 0 != strcmp( l_pDirent.d_name, ".." )) &&
+ ( 0 != strcmp( l_pDirent.d_name, "lost+found" )) &&
+ ( '.' != l_pDirent.d_name[0] ) ) {
+ std::string l_fileSource = collectDir;
+ l_fileSource.append("/");
+ l_fileSource.append(l_pDirent.d_name);
+ std::string l_fileDestination = l_pDirent.d_name;
+ l_eStatus = addToArchive(f_pTarInfo,l_fileSource,l_fileDestination);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ break;
+ }
+ }
+ }
+ closedir (l_pDir);
+ }
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus addDirectoryToArchive(TAR* f_pTarInfo, std::string f_path,
+ std::string f_destinationName,
+ UI_8 f_depth) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ DIR *l_pDir = opendir(f_path.c_str());
+ if (l_pDir != NULL) {
+ struct dirent* l_pDirent;
+ while ((l_pDirent = readdir(l_pDir)) != NULL) {
+ if ((0 != strcmp(l_pDirent->d_name, ".")) && /* Ignore special . directory. */
+ (0 != strcmp(l_pDirent->d_name, "..")) && /* Ignore special .. directory. */
+ ('.' != l_pDirent->d_name[0])) { /* Ignore hidden files */
+ std::string l_extension = "/";
+ std::string l_fileName = f_path;
+ std::string l_destName = f_destinationName;
+ l_extension.append(l_pDirent->d_name);
+ l_fileName.append(l_extension);
+ l_destName.append(l_extension);
+ l_eFrameworkunifiedStatus = addToArchive(f_pTarInfo, l_fileName, l_destName,
+ static_cast<UI_8>(f_depth - 1));
+ }
+ }
+ closedir(l_pDir);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+static SI_32 gzOpenArchive(PCHAR f_pcPathname, SI_32 f_siOflags,
+ SI_32 f_siMode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SI_32 l_siFileDescriptor = -1;
+
+ if (f_pcPathname) {
+ PCHAR l_pcGzoflags;
+
+ switch (f_siOflags & O_ACCMODE) { // LCOV_EXCL_BR_LINE 200: only O_WRONLY be set
+ case O_WRONLY:
+ l_pcGzoflags = (PCHAR) "wb";
+ break;
+ // LCOV_EXCL_START 200: only O_WRONLY be set
+ case O_RDONLY:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_pcGzoflags = (PCHAR) "rb";
+ break;
+ // LCOV_EXCL_STOP
+ case O_RDWR:
+ default:
+ return -1;
+ }
+ if (-1 == (l_siFileDescriptor = open(f_pcPathname, f_siOflags, f_siMode))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ }
+
+ if ((f_siOflags & O_CREAT) && fchmod(l_siFileDescriptor, f_siMode)) {
+ close(l_siFileDescriptor);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ }
+
+ g_gztype = gzdopen(l_siFileDescriptor, l_pcGzoflags);
+ if (!g_gztype) {
+ close(l_siFileDescriptor);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path empty.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (SI_32) l_siFileDescriptor;
+}
+
+static SI_32 gzCloseArchive() {
+ return gzclose(g_gztype);
+}
+
+static ssize_t gzWriteArchive(int fd, const void* buf, size_t count) {
+ return gzwrite(g_gztype, const_cast<void*>(buf), (unsigned int) count);
+}
+
+static ssize_t gzReadArchive(int fd, void* buf, size_t count) {
+ return gzread(g_gztype, buf, (unsigned int) count);
+}
+
+static EFrameworkunifiedStatus copyFile(std::string f_source, std::string f_destination) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ssize_t l_nrd;
+ ssize_t l_nwr;
+ char l_buf[1024];
+
+ int l_if = open(f_source.c_str(), O_RDONLY | O_CLOEXEC);
+ if (-1 == l_if) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to open file: %s for reading.", f_source.c_str());
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ std::string l_tmpDest;
+ size_t l_pos = f_destination.find_last_of('/');
+
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 6: there must be '/' in string f_destination
+ l_tmpDest = f_destination.substr(0, l_pos);
+ l_tmpDest.append("/");
+ l_tmpDest.append(LOGGER_TMP_FN);
+ if (unlink(l_tmpDest.c_str()) != 0) {
+ // always delete tmpLog, and create new tmpLog.
+ }
+ } else {
+ // LCOV_EXCL_START 6: there must be '/' in string f_destination
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_tmpDest = f_destination;
+ // LCOV_EXCL_STOP
+ }
+
+ int l_of = open(l_tmpDest.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC,
+ 0640);
+ if (-1 == l_of) { // LCOV_EXCL_BR_LINE 5: open's error case
+ // LCOV_EXCL_START 5: open's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "dest open fail:%s,errno:%d,msg:%s",
+ l_tmpDest.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ do {
+ l_nrd = read(l_if, l_buf, sizeof(l_buf));
+ if (l_nrd == -1) { // LCOV_EXCL_BR_LINE 5: read's error case
+ // LCOV_EXCL_START 5: read's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail:%s,errno:%d,msg:%s",
+ f_source.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ l_nwr = write(l_of, l_buf, l_nrd);
+ if (l_nwr == -1) { // LCOV_EXCL_BR_LINE 5: write's error case
+ // LCOV_EXCL_START 5: write's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (ENOSPC == errno) { // LCOV_EXCL_BR_LINE 4: no space error case
+ // LCOV_EXCL_START 4: no space error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "write fail(ENOSPC):%s,errno:%d,msg:%s", l_tmpDest.c_str(),
+ errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusErrNoEAGAIN;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail:%s,errno:%d,msg%s",
+ l_tmpDest.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ } while (l_nrd > 0);
+ fsync(l_of);
+ close(l_of);
+ }
+ close(l_if);
+
+ if (rename(l_tmpDest.c_str(), f_destination.c_str()) != 0) { // LCOV_EXCL_BR_LINE 5: rename's error case
+ // LCOV_EXCL_START 5: rename's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "rename %s to %s fail,errno:%d,msg:%s",
+ l_tmpDest.c_str(), f_destination.c_str(), errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 6: there must be '/' in string f_destination
+ std::string l_destPath = f_destination.substr(0, l_pos);
+ SyncDir(l_destPath);
+ } else {
+ // LCOV_EXCL_START 6: there must be '/' in string f_destination
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "dest invalid:%s", f_destination.c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+static EFrameworkunifiedStatus copyDirectory (std::string f_source, std::string f_destination)
+{
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ DIR * l_pDir = opendir(f_source.c_str());
+ if (l_pDir == NULL) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s", f_source.c_str());
+ } else {
+ if (mkdir(f_destination.c_str(),0775) == -1) {
+ if (errno == EEXIST) {
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "Directory: %s already exists.", f_destination.c_str());
+ } else {
+ DEB_LOGGERSERVICELOG(ZONE_ERR, __FUNCTION__, "Could not create directory: %s. Errno: %s", f_destination.c_str(),strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ SyncDir(f_destination);
+ size_t l_pos = f_destination.find_last_of('/');
+ if (l_pos != std::string::npos) {
+ std::string l_destPath = f_destination.substr(0, l_pos);
+ SyncDir(l_destPath);
+ }
+ }
+
+ struct dirent l_pDirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_pDir,&l_pDirent,&next) && next != NULL) {
+ if ( ( 0 != strcmp( l_pDirent.d_name, "." ) ) &&
+ ( 0 != strcmp( l_pDirent.d_name, ".." )) &&
+ ( 0 != strcmp( l_pDirent.d_name, "lost+found" )) &&
+ ( '.' != l_pDirent.d_name[0] ) ) {
+ std::string l_fileSource = f_source;
+ std::string l_fileDestination = f_destination;
+ l_fileSource.append("/");
+ l_fileSource.append(l_pDirent.d_name);
+ l_fileDestination.append("/");
+ l_fileDestination.append(l_pDirent.d_name);
+ l_eStatus = copyUntyped(l_fileSource,l_fileDestination);
+ }
+ }
+ closedir (l_pDir);
+ }
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus copyUntyped (std::string f_source, std::string f_destination)
+{
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ struct stat l_stat;
+ SI_8 l_statRetVal;
+ if (0 != access(f_source.c_str(), F_OK)) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR,__FUNCTION__," Error. The specified file path and name does not exist: %s", f_source.c_str());
+ } else if (0 != (l_statRetVal = lstat(f_source.c_str(), &l_stat))) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR,__FUNCTION__," Error. stat() for file or directory returned error: %s -> %d", f_source.c_str(), l_statRetVal);
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ l_eStatus = copyDirectory(f_source, f_destination);
+ } else if (0 != S_ISLNK(l_stat.st_mode)) {
+ l_eStatus = copyDirectory(f_source, f_destination);
+ } else if (0 != S_ISREG(l_stat.st_mode)) {
+ l_eStatus = copyFile(f_source, f_destination);
+ } else {
+ DEB_LOGGERSERVICELOG(ZONE_ERR,__FUNCTION__," Error. specified file may be a symbolic link or other non 'regular' type. File: %s, mode: 0x%04X.",f_source.c_str(),l_stat.st_mode);
+ }
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus copyFileToAccOffOnDir(std::vector<LogInfo>& list, SS_STORELOGS_OPE_TYPE type)
+{
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ std::string f_destination = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ f_destination.append("/");
+ f_destination.append(ACCOFFON_DIR_NAME);
+ DIR * l_pDir = opendir(LOGGERSERVICELOG_TMP_OUTPUT_PATH);
+ if (l_pDir == NULL) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s", LOGGERSERVICELOG_TMP_OUTPUT_PATH);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ return l_eStatus;
+ } else {
+ closedir (l_pDir);
+ if (mkdir(f_destination.c_str(), 0775) == -1) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR, __FUNCTION__, "Could not create directory: %s. Errno: %s", f_destination.c_str(),strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ return l_eStatus;
+ }
+ } if (list.size() != 0) {
+ for (UI_32 j = 0; j < list.size(); j++) {
+ std::string dest_name = f_destination;
+ dest_name.append("/");
+ dest_name.append(list.at(j).dest_name);
+ l_eFrameworkunifiedStatus = copyUntyped(list.at(j).file_path, dest_name);
+ if (l_eFrameworkunifiedStatus != eFrameworkunifiedStatusOK) {
+ DEB_LOGGERSERVICELOG(ZONE_WARN, __FUNCTION__, " Error. File %s failed to archive.", list.at(j).file_path.c_str());
+ l_eStatus = l_eFrameworkunifiedStatus;
+ }
+ }
+ copyLoggerservicelogFile(f_destination);
+ }
+ return l_eStatus;
+}
+
+ELOGGERSERVICELOGTYPE QueryLoggerservicelogType(std::string f_logname) {
+// if (f_logname.find("_ILG_RESET.tar.gz") != std::string::npos
+ if (f_logname.find(SS_STORE_FILENAME_SYSILG_TERM) != std::string::npos) {
+ return eLoggerservicelogTypeSysAbnormal;
+ } else if (f_logname.find(SS_STORE_FILENAME__CWORD52__TERM) != std::string::npos) {
+ return eLoggerservicelogType_CWORD52_;
+ } else if (f_logname.find("_ILG_RESET.tar.gz") != std::string::npos
+
+ || f_logname.find("_ERR.tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeAbnormal;
+ } else if (f_logname.find("_GRP_RELAUNCH.tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeGrpRelaunch;
+ } else if (f_logname.find(".tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeNormal;
+ } else {
+ return eLoggerservicelogTypeOther;
+ }
+}
+
+void SyncDir(std::string f_dir_path) {
+ int fd = open(f_dir_path.c_str(), O_RDONLY | O_DIRECTORY | O_CLOEXEC);
+#define OPE_ERR_MSG "%s %s failed. errno:%d,msg:%s"
+ if (fd == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "open",
+ errno, strerror(errno));
+ } else {
+ if (fsync(fd) == -1) { // LCOV_EXCL_BR_LINE 5: fsync's error case
+ // LCOV_EXCL_START 5: fsync's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "fsync",
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ if (close(fd) == -1) { // LCOV_EXCL_BR_LINE 5: close's error case
+ // LCOV_EXCL_START 5: close's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "close",
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+#undef OPE_ERR_MSG
+}
+
+// LCOV_EXCL_START 4: no space error case
+size_t deleteRequestLogs(std::string f_emmcpath, ELOGGERSERVICELOGTYPE f_reqtype,
+ size_t f_reqsize, ELOGGERSERVICELOGTYPE f_deltype) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR* l_dirp = NULL;
+ std::vector<std::string> vect;
+ std::vector<std::string>::iterator it;
+ UI_32 l_count = 0;
+ size_t l_totalsize = 0;
+
+ ELOGGERSERVICELOGTYPE filetype;
+
+
+ // create saved file list on eMMC
+ l_dirp = opendir(f_emmcpath.c_str());
+ if (l_dirp != NULL) {
+ struct dirent l_dirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_dirp, &l_dirent, &next) && next != NULL) {
+ std::string l_filename = l_dirent.d_name;
+
+// if (QueryLoggerservicelogType(l_filename) == f_deltype) {
+// vect.push_back(l_filename);
+// }
+ if ((l_filename == ".") && (l_filename == "..")) {
+ continue;
+ }
+ filetype = QueryLoggerservicelogType(l_filename);
+ if (f_deltype == eLoggerservicelogTypeAbnormal) {
+ if ((filetype == eLoggerservicelogTypeAbnormal) || (filetype == eLoggerservicelogTypeSysAbnormal) ||
+ (filetype == eLoggerservicelogType_CWORD52_)) {
+ vect.push_back(l_filename);
+ }
+ } else if (filetype == f_deltype) {
+ vect.push_back(l_filename);
+ }
+
+ }
+ closedir(l_dirp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " open failed eMMC path: %s",
+ f_emmcpath.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return 0;
+ }
+
+ // get num of delete logs
+ std::sort(vect.begin(), vect.end());
+ for (it = vect.begin(); it != vect.end(); it++) {
+ l_count++;
+
+ std::string l_filename = *it;
+ struct stat st_buf;
+ std::string l_tmpstr = f_emmcpath;
+ l_tmpstr.append(l_filename.c_str());
+ if (stat(l_tmpstr.c_str(), &st_buf) != -1) {
+ l_totalsize += st_buf.st_size;
+ }
+
+ if (l_totalsize > f_reqsize) {
+ break;
+ }
+ }
+
+ // start delete logs
+ if ((l_totalsize > f_reqsize) || (f_reqtype == eLoggerservicelogTypeAbnormal)
+ || (f_reqtype == eLoggerservicelogTypeGrpRelaunch)) {
+ for (it = vect.begin(); it != vect.end() && l_count > 0; it++) {
+ l_count--;
+
+ std::string l_filename = *it;
+ std::string l_tmpstr = f_emmcpath;
+ l_tmpstr.append(l_filename.c_str());
+ if (unlink(l_tmpstr.c_str()) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " unlink failed %s:%d,msg:%s",
+ l_tmpstr.c_str(), errno, strerror(errno));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " del-file=%s total=%d", l_tmpstr.c_str(),
+ l_totalsize);
+ }
+
+ if (f_reqtype == eLoggerservicelogTypeAbnormal) {
+ removeSameNumFiles(it, f_emmcpath, vect);
+ }
+
+ SyncDir(f_emmcpath);
+ } else {
+ l_totalsize = 0;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ " nothing to delete logs req-type=%d del-logtype=%d total=%d, log_count=%d",
+ f_reqtype, f_deltype, l_totalsize, l_count);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_totalsize;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 4: no space error case
+EFrameworkunifiedStatus forceDeleteOldLog(std::string f_archive_destination,
+ size_t f_req_size) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string l_emmc_path;
+ size_t l_delsize = 0;
+ ELOGGERSERVICELOGTYPE l_logtype = eLoggerservicelogTypeOther;
+
+ size_t l_pos = f_archive_destination.find_last_of('/');
+ if (std::string::npos != l_pos) {
+ l_emmc_path = f_archive_destination.substr(0, l_pos);
+ l_emmc_path.append("/");
+ l_logtype = QueryLoggerservicelogType(
+ f_archive_destination.substr(l_pos + 1,
+ f_archive_destination.size() - l_pos + 1));
+
+ if ((l_logtype == eLoggerservicelogTypeSysAbnormal) || (l_logtype == eLoggerservicelogType_CWORD52_)) {
+ l_logtype = eLoggerservicelogTypeAbnormal;
+ }
+
+ }
+
+ if (l_logtype == eLoggerservicelogTypeOther) {
+ // not found
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Invalid Parameter. dest=%s",
+ f_archive_destination.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // remove dirty-file if exist
+ if (unlink(f_archive_destination.c_str()) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " unlink failed %s:%d.",
+ f_archive_destination.c_str(), errno);
+ }
+
+ // delete normal log
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, f_req_size,
+ eLoggerservicelogTypeNormal);
+ if (l_delsize >= f_req_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete normal logs success: req-size=%d, del-size=%d", f_req_size,
+ l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (l_logtype == eLoggerservicelogTypeAbnormal) {
+ // delete abnormal log if request type is abnormal
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " continue delete abnormal logs: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ size_t l_tmpsize = f_req_size;
+ l_tmpsize -= l_delsize;
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, l_tmpsize,
+ eLoggerservicelogTypeAbnormal);
+ if (l_delsize >= l_tmpsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete abnormal logs success: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " abnormal log delete not complete. req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ }
+ } else if (l_logtype == eLoggerservicelogTypeGrpRelaunch) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " continue delete group relaunch logs: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ size_t l_tmpsize = f_req_size;
+ l_tmpsize -= l_delsize;
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, l_tmpsize,
+ eLoggerservicelogTypeGrpRelaunch);
+ if (l_delsize >= l_tmpsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete group relaunch logs success: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " group relaunch log delete not complete. req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " normal log del not complete. req-size=%d, del-size=%d", f_req_size,
+ l_delsize);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function SS_LoggerStoreDebugLogs
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SS_LoggerStoreLogs(SS_STORELOGS_OPE_TYPE type) {
+ if (type < SS_STORELOGS_MAX) {
+ return storeLogs(type);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error. Bad enum number %d", type);
+ return eFrameworkunifiedStatusFail;
+ }
+}
+
+
+EFrameworkunifiedStatus SS_LoggerStoreLogs_deleteOldLogAbnrm(const std::string& log_path,
+ std::vector<std::string>& l_vector,
+ const std::string& f_archive_destination,
+ SI_32 max_num,
+ UI_32 abnrm_total) {
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus;
+ l_eFrameworkunifiedStatus = deleteOldLogAbnrm(log_path, l_vector, f_archive_destination, max_num, abnrm_total);
+ return l_eFrameworkunifiedStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsDirectory
+/// Method to check if the entity is a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+static BOOL IsDirectory(std::string &f_cPath) { // NOLINT (runtime/references)
+ BOOL l_bReturn = FALSE;
+ struct stat st_buf;
+
+ if (-1 == stat(f_cPath.c_str(), &st_buf)) { // LCOV_EXCL_BR_LINE 5: stat's error case // NOLINT (runtime/references) // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5: stat's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: stat failed for path/file %s, errno %d", f_cPath.c_str(),
+ errno);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ // LCOV_EXCL_STOP
+ } else if (S_ISDIR(st_buf.st_mode)) {
+ l_bReturn = TRUE; // return true if f_cPath is a directory
+ }
+ return l_bReturn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveDirectory
+/// Method to remove a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+static BOOL RemoveDirectory(std::string &f_cPath) { // NOLINT (runtime/references)
+ BOOL l_bReturn = FALSE;
+
+ if (RemoveSubDirectory(f_cPath)) { // LCOV_EXCL_BR_LINE 6: RemoveSubDirectory always return true
+ // delete the parent directory
+ if (0 == rmdir(f_cPath.c_str())) { // LCOV_EXCL_BR_LINE 5: rmdir's error case
+ l_bReturn = TRUE;
+ }
+ }
+ return l_bReturn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveSubDirectory
+/// Method to remove a sub directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+static BOOL RemoveSubDirectory(std::string &f_cPath) { // NOLINT (runtime/references)
+ BOOL l_bReturn = TRUE;
+
+ if (!f_cPath.empty()) { // LCOV_EXCL_BR_LINE 6: f_cPath can't be empty
+ std::string l_cFilePath = "";
+ struct dirent l_Dirent;
+ struct dirent* next;
+ DIR *l_pDir = NULL;
+
+ l_pDir = opendir(f_cPath.c_str());
+ if (NULL != l_pDir) { // LCOV_EXCL_BR_LINE 5: opendir's error case
+ if ('/' != f_cPath[f_cPath.length() - 1]) { // LCOV_EXCL_BR_LINE 6: there must be no '/'
+ f_cPath.append("/");
+ }
+
+ while (0 == readdir_r(l_pDir, &l_Dirent, &next) && next != NULL) {
+ if (0 != std::strcmp(l_Dirent.d_name, ".")
+ && 0 != std::strcmp(l_Dirent.d_name, "..")
+ && 0 != std::strcmp(l_Dirent.d_name, "lost+found")) {
+ l_cFilePath.assign(f_cPath);
+ l_cFilePath.append(l_Dirent.d_name); // concatenate the strings to get the complete f_cPath
+ if (TRUE == IsDirectory(l_cFilePath)) {
+ l_bReturn = RemoveDirectory(l_cFilePath);
+ } else {
+ // it's a file, we can use unlink
+ if (unlink(l_cFilePath.c_str()) == -1) { // LCOV_EXCL_BR_LINE 5: unlink's error case
+ // LCOV_EXCL_START 5: unlink's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_bReturn = FALSE;
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+ closedir(l_pDir); // close the directory
+ SyncDir(f_cPath);
+ } else {
+ // LCOV_EXCL_START 5: opendir's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pDir is NULL");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_cPath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Pathname empty.");
+ l_bReturn = FALSE;
+ // LCOV_EXCL_STOP
+ }
+ return l_bReturn;
+}
+
+static void CreateSaveFinFlag(SS_STORELOGS_OPE_TYPE type) {
+ if (type == SS_STORELOGS_INTERFACEUNIFIEDLOG) {
+ int fd;
+ fd = open(SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG,
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0640);
+ if (fd == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error. Create %s. errno %d msg :%s",
+ SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG, errno, strerror(errno));
+ } else {
+ fsync(fd);
+ close(fd);
+ std::string l_flagPath = SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG;
+ size_t l_pos = l_flagPath.find_last_of('/');
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 6: there must be '/' in l_flagPath
+ std::string l_dirPath = l_flagPath.substr(0, l_pos);
+ SyncDir(l_dirPath);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "create saveflag finish.");
+ fprintf(stderr, "%s:Completed\n", __FUNCTION__);
+ }
+ }
+ }
+}
+
+static void deleteAccOffOnUntyped(std::string deletePath)
+{
+ struct stat l_stat;
+ SI_8 l_statRetVal;
+ if (0 != access(deletePath.c_str(), F_OK)) {
+ DEB_LOGGERSERVICELOG(ZONE_WARN, __FUNCTION__, "access error (%s)", deletePath.c_str());
+ } else if (0 != (l_statRetVal = lstat(deletePath.c_str(), &l_stat))) {
+ DEB_LOGGERSERVICELOG(ZONE_WARN, __FUNCTION__, "get stat error (%s)", deletePath.c_str());
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ deleteAccOffOnDir(deletePath);
+ } else if (0 != S_ISREG(l_stat.st_mode)) {
+ unlink(deletePath.c_str());
+ }
+}
+
+static void deleteAccOffOnDir(std::string deletePath)
+{
+ DIR * l_pDir = opendir(deletePath.c_str());
+ if (l_pDir != NULL) {
+ struct dirent l_pDirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_pDir,&l_pDirent,&next) && next != NULL) {
+ if ( ( 0 != strcmp( l_pDirent.d_name, "." ) ) &&
+ ( 0 != strcmp( l_pDirent.d_name, ".." )) &&
+ ( 0 != strcmp( l_pDirent.d_name, "lost+found" )) &&
+ ( '.' != l_pDirent.d_name[0] ) ) {
+ std::string l_deletePath = deletePath;
+ l_deletePath.append("/");
+ l_deletePath.append(l_pDirent.d_name);
+ deleteAccOffOnUntyped(l_deletePath);
+ }
+ }
+ closedir (l_pDir);
+ }
+ RemoveDirectory(deletePath);
+}
+
+static EFrameworkunifiedStatus storeLogs(SS_STORELOGS_OPE_TYPE type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ std::string file_name;
+ std::vector<LogInfo> list;
+ std::vector<LoggerservicelogInfo> loggerservicelogList;
+ TAR* tar_info = NULL;
+ uint32_t time_info;
+ uint8_t status;
+ CfgInfo cfginfo;
+
+ UI_32 l_counter = INVALID_FILENUMBER;
+
+
+ // load ss_logger configuration file.
+ getConfigInfo(cfginfo);
+
+
+ if (type == SS_STORELOGS_SYS_ILLEGAL) {
+ if (getFileNumberFromTempArchive(l_counter) != eFrameworkunifiedStatusOK) {
+ // ------------------------------------ //
+ // no made ILG_RESET.tar.gz //
+ // when is abnormal logging count over. //
+ // ------------------------------------ //
+ return eFrameworkunifiedStatusOK;
+ }
+ }
+
+
+// Clock_getSystemTimeY2K38(&time_info, &status);
+
+// file_name = getFileName(cfginfo.output_path, time_info, type);
+//
+// // prepare log files for collectting
+// for (UI_32 i = 0; i < _countof(GetLogFuncTbl); i++) {
+// GetLogFuncTbl[i](type, list);
+// }
+ file_name = getFileName(cfginfo.output_path, time_info, type, l_counter);
+
+ if (type != SS_STORELOGS_SYS_ILLEGAL) {
+ // prepare log files for collectting
+ for (UI_32 i = 0; i < _countof(GetLogFuncTbl); i++) {
+ GetLogFuncTbl[i](type, list);
+ }
+ }
+
+ if (type == SS_STORELOGS_ACCOFFON) {
+ copyFileToAccOffOnDir(list, type);
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "- : FrameworkunifiedStatus = %d", l_eFrameworkunifiedStatus);
+ return l_eFrameworkunifiedStatus;
+ } else if (type != SS_STORELOGS_ACCOFFON_PRESS) {
+ // loggerservicelogList used with clear buffer
+ getLoggerservicelogFile(type, list, loggerservicelogList);
+ }
+
+ // ---------------------------------------------------------------- //
+ // Warning!!! Logs by using FRAMEWORKUNIFIEDLOG macro, are not saved from here!! //
+ // You can saved logs by FRAMEWORKUNIFIEDLOG after finished to clear buffer. //
+ // ---------------------------------------------------------------- //
+
+ if (list.size() != 0) {
+ // delete old archive before create new one.
+ deleteOldEmmcLog(cfginfo, file_name, type);
+
+ l_eFrameworkunifiedStatus = openArchive(&tar_info, file_name);
+ if (l_eFrameworkunifiedStatus == eFrameworkunifiedStatusOK) {
+ if (type == SS_STORELOGS_ACCOFFON_PRESS) {
+ std::string collectPath;
+ collectPath = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ collectPath.append("/");
+ collectPath.append(ACCOFFON_DIR_NAME);
+ if (0 != access(collectPath.c_str(), F_OK)) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR,__FUNCTION__," Error. The specified file path and name does not exist: %s", collectPath.c_str());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ return l_eFrameworkunifiedStatus;
+ } else {
+ l_eFrameworkunifiedStatus = addAllFileToArchive(tar_info,collectPath);
+ }
+ } else {
+ for (UI_32 j = 0; j < list.size(); j++) {
+ l_eFrameworkunifiedStatus = addToArchive(tar_info, list.at(j).file_path, list.at(j).dest_name);
+ if(l_eFrameworkunifiedStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Error. File %s failed to archive.", list.at(j).file_path.c_str());
+ }
+ }
+ }
+
+// l_eFrameworkunifiedStatus = closeArchive(tar_info);
+ l_eFrameworkunifiedStatus = closeArchive(tar_info, type);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "finish archiving logs(%d)", type);
+
+ // when finish archiving, clear frameworkunifiedlog buffer.
+ if (type == SS_STORELOGS_ACCOFFON_PRESS) {
+ deleteTmpAccOffOn((std::string)ACCOFFON_DIR_NAME);
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "- : FrameworkunifiedStatus = %d", l_eFrameworkunifiedStatus);
+ return (l_eFrameworkunifiedStatus);
+ } else {
+ ClearLoggerservicelogBuffer(loggerservicelogList);
+ }
+
+ // create flag of archiving completed
+ CreateSaveFinFlag(type);
+
+ // -------------------------------------------- //
+ // You can save logs by FRAMEWORKUNIFIEDLOG macro from here. //
+ // -------------------------------------------- //
+ }
+
+ // remove temporary or unnecessary files.
+ for (UI_32 k = 0; k < list.size(); k++) {
+ if (list.at(k).tmp_file_delete == TRUE) {
+ struct stat l_stat;
+ if (0 != stat(list.at(k).file_path.c_str(), &l_stat)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error. stat(%s) errno. %d",
+ list.at(k).file_path.c_str(), errno);
+ } else if (S_ISDIR(l_stat.st_mode)) {
+ RemoveDirectory(list.at(k).file_path);
+ } else {
+ if (0 != unlink(list.at(k).file_path.c_str())) { // LCOV_EXCL_BR_LINE 5: unlink's error case
+ // LCOV_EXCL_START 5: unlink's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Error. unlink(%s) errno. %d",
+ list.at(k).file_path.c_str(), errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : FrameworkunifiedStatus = %d", l_eFrameworkunifiedStatus);
+ return (l_eFrameworkunifiedStatus);
+}
+
+static void getCommunicationlogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+
+ LogInfo log_info;
+
+ log_info.file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ log_info.file_path.append("/");
+ log_info.file_path.append(COMMUNICATION_DIR_NAME);
+ log_info.dest_name = COMMUNICATION_DIR_NAME;
+ log_info.tmp_file_delete = FALSE;
+ list.push_back(log_info);
+}
+
+static void getExternallogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ExternalLogList ext_log;
+ memset(&ext_log, 0, sizeof(&ext_log));
+
+ CNSConfigReader *l_pReaderCfg = new CNSConfigReader();
+
+ if (NULL == l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5: new's error case
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Unable to allocate CNSConfigReader object.");
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(LOGGERSERVICELOG_CONFIG_PATH))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->Parse(%s) returned: 0x%X", LOGGERSERVICELOG_CONFIG_PATH);
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogNum", ext_log.num))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetInt(LOGGING.ExternalLogNum)");
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogMax", ext_log.max))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetInt(LOGGING.EmmcOutputMax)");
+ } else {
+ if (ext_log.num > 0) {
+ std::string str = "EXTERNAL_";
+ UI_32 num = 0;
+
+ if (ext_log.num <= ext_log.max) {
+ num = ext_log.num;
+ } else {
+ num = ext_log.max;
+ }
+
+ ext_log.p_info = new ExternalLogInfo[num];
+
+ // Load external log info
+ for (UI_32 i = 0; i < num; i++) {
+ std::string query = str + std::to_string(i+1);
+ if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetString((query+".OutputPath"), ext_log.p_info[i].dirname))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetString(EXTERNAL.OutputPath)");
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetString((query+".ExtLogPath"), ext_log.p_info[i].path))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetString(EXTERNAL.ExtLogPath)");
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetBool((query+".Remove"), ext_log.p_info[i].remove))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetBool(EXTERNAL.Remove)");
+ } else {
+ LogInfo log_info;
+ log_info.file_path = ext_log.p_info[i].path;
+ log_info.dest_name = ext_log.p_info[i].dirname;
+ log_info.tmp_file_delete = ext_log.p_info[i].remove;
+
+ list.push_back(log_info);
+ }
+ }
+
+ delete[] ext_log.p_info;
+
+ } else {
+ // None external log
+ }
+ }
+ delete l_pReaderCfg;
+ }
+}
+
+
+
+
+static void getLoggerservicelogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list, // NOLINT (runtime/references)
+ std::vector<LoggerservicelogInfo>& loggerservicelogList) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_DumpSize = 0;
+ std::string src_file_path;
+ std::string dst_file_path;
+ PCSTR file_name;
+ UI_32 file_num;
+ LogInfo log_info;
+ LoggerservicelogInfo loggerservicelog_info;
+
+ file_num = NSLogGetFrameworkunifiedlogFileTotalNum();
+ for (UI_32 cont = 0; cont < file_num; cont++) {
+ file_name = NSLogGetFrameworkunifiedlogFileName(cont);
+ if (file_name == NULL) {
+ break;
+ }
+ src_file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ src_file_path.append("/");
+ src_file_path.append(file_name);
+ dst_file_path = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ dst_file_path.append("/");
+ dst_file_path.append(file_name);
+
+ int index;
+ index = NSLogGetFrameworkunifiedlogIndex(src_file_path.c_str());
+ CNSRingBuffer* l_pLoggerservicelog = new (std::nothrow) CNSRingBuffer(
+ src_file_path, 0, index + LOCK_NSLOG_ACCES_IF_1);
+ if (l_pLoggerservicelog == NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer handle is NULL %s",
+ src_file_path.c_str());
+ continue;
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer Open failed %s %d",
+ src_file_path.c_str(), l_eStatus);
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pLoggerservicelog->DumpToFile(dst_file_path.c_str(),
+ &l_DumpSize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer DumpToFile failed %s %d",
+ src_file_path.c_str(), l_eStatus);
+ } else {
+ log_info.file_path = dst_file_path;
+ log_info.dest_name = file_name;
+ log_info.tmp_file_delete = TRUE;
+ list.push_back(log_info);
+ // save frameworkunifiedlog-info for using clear frameworkunifiedlog buffer
+ loggerservicelog_info.path = src_file_path;
+ loggerservicelog_info.index = index;
+ loggerservicelogList.push_back(loggerservicelog_info);
+ }
+ (void) l_pLoggerservicelog->Close();
+ }
+ delete l_pLoggerservicelog;
+ }
+}
+
+static void copyLoggerservicelogFile(std::string distPath)
+{
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_DumpSize = 0;
+ std::string src_file_path;
+ std::string dst_file_path;
+ PCSTR file_name;
+ UI_32 file_num;
+
+ file_num = NSLogGetFrameworkunifiedlogFileTotalNum();
+
+ for (UI_32 cont = 0; cont < file_num; cont++) {
+ file_name = NSLogGetFrameworkunifiedlogFileName(cont);
+
+ if (file_name == NULL) {
+ break;
+ }
+
+ src_file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ src_file_path.append("/");
+ src_file_path.append(file_name);
+
+ dst_file_path = distPath;
+ dst_file_path.append("/");
+ dst_file_path.append(file_name);
+
+ int index;
+ index = NSLogGetFrameworkunifiedlogIndex(src_file_path.c_str());
+ CNSRingBuffer* l_pLoggerservicelog = new (std::nothrow)CNSRingBuffer(src_file_path,0,index+LOCK_NSLOG_ACCES_IF_1);
+ if (l_pLoggerservicelog == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FRAMEWORKUNIFIEDLOG RingBuffer handle is NULL %s", src_file_path.c_str());
+ continue;
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,"Error: FRAMEWORKUNIFIEDLOG RingBuffer Open failed %s %d", src_file_path.c_str(), l_eStatus);
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->DumpToFile(dst_file_path.c_str(), &l_DumpSize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,"Error: FRAMEWORKUNIFIEDLOG RingBuffer DumpToFile failed %s %d", src_file_path.c_str(), l_eStatus);
+ }
+ (void)l_pLoggerservicelog->Close();
+ }
+ delete l_pLoggerservicelog;
+ }
+}
+
+static void deleteTmpAccOffOn(std::string accOffOnDir)
+{
+ std::string l_tmpAccOffOnPath = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ l_tmpAccOffOnPath.append("/");
+ l_tmpAccOffOnPath.append(accOffOnDir.c_str());
+ DIR * l_pDir = opendir(l_tmpAccOffOnPath.c_str());
+ if (l_pDir != NULL) {
+ struct dirent l_pDirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_pDir,&l_pDirent,&next) && next != NULL) {
+ if ( ( 0 != strcmp( l_pDirent.d_name, "." ) ) &&
+ ( 0 != strcmp( l_pDirent.d_name, ".." )) &&
+ ( 0 != strcmp( l_pDirent.d_name, "lost+found" )) &&
+ ( '.' != l_pDirent.d_name[0] ) ) {
+ std::string l_deletePath = l_tmpAccOffOnPath;
+ l_deletePath.append("/");
+ l_deletePath.append(l_pDirent.d_name);
+ deleteAccOffOnUntyped(l_deletePath);
+ }
+ }
+ closedir (l_pDir);
+ }
+ RemoveDirectory(l_tmpAccOffOnPath);
+}
+
+static void ClearLoggerservicelogBuffer(std::vector<LoggerservicelogInfo> &loggerservicelogList) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::vector<LoggerservicelogInfo>::iterator ite = loggerservicelogList.begin();
+
+ if (ite == loggerservicelogList.end()) {
+ // target not found...
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "nothing to clear");
+ } else {
+ for (ite = loggerservicelogList.begin(); ite != loggerservicelogList.end(); ite++) {
+ CNSRingBuffer* l_pLoggerservicelog = new (std::nothrow) CNSRingBuffer(
+ ite->path.c_str(), 0, ite->index + LOCK_NSLOG_ACCES_IF_1);
+ if (l_pLoggerservicelog == NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer handle is NULL %s", ite->path.c_str());
+ continue;
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer Open failed %s %d", ite->path.c_str(),
+ l_eStatus);
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->ClearBuf())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer ClearBuf failed %s %d",
+ ite->path.c_str(), l_eStatus);
+ }
+ (void) l_pLoggerservicelog->Close();
+ }
+ delete l_pLoggerservicelog;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Completed");
+ fprintf(stderr, "%s:Completed\n", __FUNCTION__);
+}
+
+static void createKernelLog(SS_STORELOGS_KERNEL_LOG_TYPE type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ int len;
+ int fd;
+ char* buf;
+ ssize_t wr_len;
+
+ len = klogctl(SYSLOG_ACTION_SIZE_BUFFER, NULL, 0);
+ if (len < 0) { // LCOV_EXCL_BR_LINE 5: klogctl's error case
+ // LCOV_EXCL_START 5: klogctl's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to get syslog buffer size: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ buf = reinterpret_cast<char*>(malloc(len));
+ if (buf != NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+ len = klogctl(SYSLOG_ACTION_READ_ALL, buf, len);
+ if ((len < 0) || (len == 0)) { // LCOV_EXCL_BR_LINE 5: klogctl's error case
+ // LCOV_EXCL_START 5: klogctl's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to read syslog buffer: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ std::string file_put_path = "";
+
+ switch (type) {
+ case SS_STORELOGS_KERNEL_LOG:
+ file_put_path = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ file_put_path.append("/");
+ file_put_path.append(KERNEL_LOG_FN);
+ fd = open(file_put_path.c_str(),
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
+ break;
+ case SS_STORELOGS_KERNEL_BOOT_LOG:
+ file_put_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ file_put_path.append("/");
+ file_put_path.append(KERNEL_BOOT_LOG_FN);
+ fd = open(file_put_path.c_str(),
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
+ break;
+ default:
+ fd = -1;
+ break;
+ }
+
+ if (fd == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to open file: %s: %d, %s",
+ file_put_path.c_str(), errno, strerror(errno));
+ } else {
+ wr_len = write(fd, buf, len);
+ if (wr_len == -1) { // LCOV_EXCL_BR_LINE 5: write's error case
+ // LCOV_EXCL_START 5: write's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. File write failed. errno: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ fsync(fd);
+ close(fd);
+ }
+ }
+ free(buf);
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation Failed %s",
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+static void getKernellogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+ getLastKernelLog(list);
+
+ getKernelLog(list);
+
+ if (type != SS_STORELOGS_ACCOFFON) {
+ getKernelBootLog(type, list);
+ }
+}
+
+static void getLastKernelLog(std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+ LogInfo log_info;
+
+ log_info.file_path = PSTORE_DIR_PATH;
+ log_info.dest_name = "kernellog";
+ log_info.tmp_file_delete = FALSE;
+ list.push_back(log_info);
+}
+
+static void getKernelLog(std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+ createKernelLog(SS_STORELOGS_KERNEL_LOG);
+
+ LogInfo log_info;
+
+ std::string klog_path = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ klog_path.append("/");
+ klog_path.append(KERNEL_LOG_FN);
+
+ if (0 == access(klog_path.c_str(), F_OK)) {
+ log_info.file_path = klog_path;
+ log_info.dest_name = KERNEL_LOG_FN;
+ log_info.tmp_file_delete = TRUE;
+ list.push_back(log_info);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Info: %s not found.", klog_path.c_str());
+ }
+}
+
+static void getKernelBootLog(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+ createKernelLog(SS_STORELOGS_KERNEL_BOOT_LOG);
+
+ LogInfo log_info;
+
+ std::string klog_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ klog_path.append("/");
+ klog_path.append(KERNEL_BOOT_LOG_FN);
+
+ if (0 == access(klog_path.c_str(), F_OK)) {
+ std::string klog_out_path = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ klog_out_path.append("/");
+ klog_out_path.append(KERNEL_BOOT_LOG_FN);
+
+ if (eFrameworkunifiedStatusOK == copyFile(klog_path.c_str(), klog_out_path.c_str())) { // LCOV_EXCL_BR_LINE 6: copyFile must return ok // NOLINT[whitespace/line_length]
+ log_info.file_path = klog_out_path;
+ log_info.dest_name = KERNEL_BOOT_LOG_FN;
+ log_info.tmp_file_delete = TRUE;
+ list.push_back(log_info);
+ } else {
+ // LCOV_EXCL_START 6: copyFile must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Info: copyFile src:%s dest:%s failed.",
+ klog_path.c_str(), klog_out_path.c_str());
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Info: %s not found.", klog_path.c_str());
+ }
+}
+
+
+//static std::string getFileName(std::string &path, uint32_t f_time, // NOLINT (runtime/references)
+// SS_STORELOGS_OPE_TYPE type) {
+static std::string getFileName(std::string &path, uint32_t f_time,
+ SS_STORELOGS_OPE_TYPE type, UI_32 l_counter) {
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::stringstream l_nameStream;
+
+// UI_32 l_counter = 0;
+ std::string l_time_str = "00000000_000000";
+ std::string l_ret;
+ char buffer[20];
+ struct tm l_time_tmp;
+
+
+// getEmmcCounter(path, l_counter);
+ if (l_counter == INVALID_FILENUMBER) {
+ l_counter = 0;
+ getEmmcCounter(path, l_counter);
+ }
+
+
+// CLOCK_RETURN clock_ret = Clock_getLocalTimeY2K38(&f_time, &l_time_tmp);
+// if (clock_ret == CLOCK_OK) {
+// if (0 != strftime(buffer, sizeof(buffer), "%Y%m%d_%H%M%S", &l_time_tmp)) {
+// l_time_str = buffer;
+// }
+// }
+
+// l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec
+// << l_counter << '_';
+ l_nameStream << std::setw(FILENUMBER_DIGIT_NUM) << std::setfill('0') << std::right << std::dec
+ << l_counter << '_';
+
+
+ switch (type) {
+ case SS_STORELOGS_ILLEGAL:
+ l_nameStream << std::setw(15) << l_time_str << "_ILG_RESET.tar.gz";
+ break;
+ case SS_STORELOGS_INTERFACEUNIFIEDLOG:
+ l_nameStream << std::setw(15) << l_time_str << "_ACCOFF.tar.gz";
+ break;
+ case SS_STORELOGS_ACCOFFON:
+ case SS_STORELOGS_ACCOFFON_PRESS:
+ l_nameStream << std::setw(15) << l_time_str << "_ACCOFFON.tar.gz";
+ break;
+
+ case SS_STORELOGS_SYS_ILLEGAL:
+ l_nameStream << std::setw(15) << l_time_str << SS_STORE_FILENAME_SYSILG_TERM;
+ break;
+
+ default:
+ //Set the file name as usual for cases other than the anomaly log specification.
+ l_nameStream << std::setw(15) << l_time_str << ".tar.gz";
+ break;
+ }
+
+ l_ret = path;
+ l_ret.append("/");
+ l_ret.append(l_nameStream.str());
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+static void getEmmcCounter(std::string &path, UI_32& f_counter) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_checkFileName;
+ std::vector<UI_32> l_vector;
+ DIR *l_dirp;
+ struct dirent *l_direntp;
+ size_t l_pos;
+ UI_32 l_count;
+ UI_32 l_maxCount = 0;
+
+ l_dirp = opendir(path.c_str());
+ if (l_dirp != NULL) {
+ for (;;) {
+ l_direntp = readdir(l_dirp);
+ if (l_direntp == NULL) {
+ break;
+ }
+ l_checkFileName = l_direntp->d_name;
+ l_pos = l_checkFileName.find(".tar.gz");
+ if (std::string::npos != l_pos) {
+ l_pos = l_checkFileName.find("_");
+ if (std::string::npos != l_pos) {
+ std::string l_numberString = l_checkFileName.substr(0, l_pos);
+ l_count = static_cast<UI_32>(strtoul(l_numberString.c_str(), NULL, 10));
+ l_vector.push_back(l_count);
+ l_maxCount = std::max(l_count, l_maxCount);
+ }
+ }
+ }
+ closedir(l_dirp);
+ }
+ l_maxCount++;
+
+// if (l_maxCount >= 100000u) {
+// l_maxCount = 1;
+ if (l_maxCount >= FILENUMBER_UPPER_LIMIT_OVER) {
+ l_maxCount = FILENUMBER_LOWER_LIMIT;
+
+ for (;;) {
+ std::vector<UI_32>::iterator find_itr = std::find(l_vector.begin(),
+ l_vector.end(),
+ l_maxCount);
+ if (find_itr == l_vector.end()) {
+ break;
+ }
+ l_maxCount++;
+ }
+ }
+ f_counter = l_maxCount;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+static void getConfigInfo(CfgInfo& f_cfginfo) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ f_cfginfo.output_path = "";
+ f_cfginfo.output_max = 0;
+
+ CNSConfigReader *l_pReaderCfg = new CNSConfigReader();
+
+ if (NULL == l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5: new's error case
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Unable to allocate CNSConfigReader object.");
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(LOGGERSERVICELOG_CONFIG_PATH))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->Parse(%s) returned: 0x%X",
+ LOGGERSERVICELOG_CONFIG_PATH, l_eStatus);
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetString("LOGGING.EmmcOutputPath",
+ f_cfginfo.output_path))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->GetString(LOGGING.EmmcOutputPath)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputMax",
+ f_cfginfo.output_max))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->GetInt(LOGGING.EmmcOutputMax)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputErrMax",
+ f_cfginfo.output_errmax))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->GetInt(LOGGING.EmmcOutputErrMax)");
+ }
+ delete l_pReaderCfg;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+static EFrameworkunifiedStatus deleteOldLog(std::string log_path,
+ std::vector<std::string>& l_vector, // NOLINT (runtime/references)
+ std::string& f_archive_destination, // NOLINT (runtime/references)
+ UI_32 max_num) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ size_t l_pos = f_archive_destination.find_last_of('/');
+
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 6: '/' must exist in f_archive_destination
+ std::sort(l_vector.begin(), l_vector.end());
+ std::vector<std::string>::iterator itr = l_vector.begin();
+ for (UI_32 i = static_cast<UI_32>(l_vector.size()); (max_num - 1) < i; i--, itr++) {
+ if (itr == l_vector.end()) { // LCOV_EXCL_BR_LINE 6: itr can't be l_vector.end()
+ // LCOV_EXCL_START 6: itr can't be l_vector.end()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break;
+ // LCOV_EXCL_STOP
+ }
+ std::string l_FilePath = log_path;
+ std::string l_FileName = *itr;
+ l_FilePath.append("/");
+ l_FilePath.append(l_FileName.c_str());
+ if (0 != unlink(l_FilePath.c_str())) {
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete old log file %s:%d.",
+ l_FilePath.c_str(), errno);
+ }
+ }
+ SyncDir(log_path);
+ } else {
+ // LCOV_EXCL_START 6: '/' must exist in f_archive_destination
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete target not found. %s",
+ f_archive_destination.c_str());
+ // LCOV_EXCL_STOP
+ }
+ return l_eStatus;
+}
+
+
+static EFrameworkunifiedStatus getFileNumber(const std::string &filename,UI_32 &number) {
+ char buf[16];
+ size_t pos;
+ size_t offset;
+ size_t length;
+ UI_32 temp_value;
+
+ offset = filename.find_last_of(PATHNAME_SEPARATOR) + 1;
+ pos = filename.find_first_of('_', offset);
+ length = pos-offset;
+ if (std::string::npos == pos) {
+ return eFrameworkunifiedStatusInvldParam;
+ } else if (sizeof(buf) <= length) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ char *endptr;
+ int error_number;
+
+ memcpy(buf, filename.c_str() + offset, length);
+ buf[length] = '\x0';
+
+ errno = EOK;
+ temp_value = strtol(buf, &endptr, 10);
+ error_number = errno;
+ if ((error_number != EOK) || (*endptr != '\x0')) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ number = temp_value;
+ return eFrameworkunifiedStatusOK;
+}
+
+static bool compareFileNumber(UI_32 filename1_number, const std::string &filename2) {
+ EFrameworkunifiedStatus l_eStatus;
+ bool result;
+ UI_32 filename2_number;
+
+ l_eStatus = getFileNumber(filename2, filename2_number);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ return false;
+ }
+ result = (filename1_number == filename2_number);
+ return result;
+}
+
+static EFrameworkunifiedStatus removeFiles(const std::string &log_path, std::vector<std::string> &l_vector,
+ size_t begin_pos, size_t end_pos) {
+ std::string l_FilePath;
+ size_t i;
+ int result;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_ePartStatus = eFrameworkunifiedStatusOK;
+ l_FilePath.reserve(SSLOGGER_PATHNAME);
+ for (i = begin_pos; i < end_pos; i++) {
+ l_FilePath = log_path + PATHNAME_SEPARATOR_STR + l_vector[i];
+ result = unlink(l_FilePath.c_str());
+ if (0 != result) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. unlink() filename = %s ,errno = %d.", l_FilePath.c_str(), errno);
+ l_ePartStatus = eFrameworkunifiedStatusAccessError;
+ if (l_ePartStatus != eFrameworkunifiedStatusOK) {
+ l_eStatus = l_ePartStatus;
+ }
+ }
+ }
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus removeSameNumFiles(std::vector<std::string>::iterator &itr, const std::string &log_path,
+ std::vector<std::string> &l_vector) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (l_vector.begin() == itr) { // LCOV_EXCL_BR_LINE 4: itr is l_vector.begin() only when no space error case
+ // LCOV_EXCL_START 4: itr is l_vector.begin() only when no space error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+ std::string &removed_filename = *(itr - 1);
+ UI_32 removed_filenumber;
+ if (getFileNumber(removed_filename, removed_filenumber) != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 6: double check, must return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: double check, must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warning. Type mismatch filename. = %s", removed_filename.c_str());
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+
+ std::string l_FilePath;
+ EFrameworkunifiedStatus l_ePartStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int result;
+ for (;itr < l_vector.end(); itr++) {
+ const std::string &exist_filename = (*itr);
+ if (compareFileNumber(removed_filenumber, exist_filename) == true) {
+ l_FilePath = log_path + PATHNAME_SEPARATOR_STR + exist_filename;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Remove file = %s.", l_FilePath.c_str());
+ result = unlink(l_FilePath.c_str());
+ if (0 != result) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. unlink() filename = %s , errno = %d.", l_FilePath.c_str(), errno);
+ l_ePartStatus = eFrameworkunifiedStatusAccessError;
+ if (l_ePartStatus != eFrameworkunifiedStatusOK) {
+ l_eStatus = l_ePartStatus;
+ }
+ }
+ } else {
+ break;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus deleteOldLogAbnrm(const std::string& log_path, std::vector<std::string>& l_vector,
+ const std::string& f_archive_destination, SI_32 max_num, UI_32 abnrm_total) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ size_t l_pos = f_archive_destination.find_last_of(PATHNAME_SEPARATOR);
+ if (std::string::npos == l_pos) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete target not found. %s", f_archive_destination.c_str());
+ return eFrameworkunifiedStatusFail;
+ }
+ if (l_vector.size() == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. empty array.");
+ return eFrameworkunifiedStatusFail;
+ }
+ //FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " max_num = %d , vect_abnrm.size() = %d", max_num, vect_abnrm.size());
+
+ size_t i;
+ EFrameworkunifiedStatus l_ePartStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t end_pos = l_vector.size();
+ SI_32 abnrm_count = 0;
+ UI_32 exist_filenumber;
+ ELOGGERSERVICELOGTYPE filetype;
+
+ max_num = abnrm_total - max_num + 1;
+ std::sort(l_vector.begin(), l_vector.end());
+ for (i = 0; i < end_pos; i++) {
+ const std::string &exist_filename = l_vector[i];
+ if (getFileNumber(exist_filename, exist_filenumber) != eFrameworkunifiedStatusOK) {
+ continue;
+ }
+ filetype = QueryLoggerservicelogType(exist_filename);
+ if (filetype == eLoggerservicelogTypeAbnormal) {
+ abnrm_count++;
+ if (max_num <= abnrm_count) {
+ end_pos = i + 1;
+ break;
+ }
+ }
+ }
+ l_ePartStatus = removeFiles(log_path, l_vector, 0, end_pos);
+ if (l_ePartStatus != eFrameworkunifiedStatusOK) {
+ l_eStatus = l_ePartStatus;
+ }
+ if (end_pos < l_vector.size()) {
+ std::vector<std::string>::iterator itr = l_vector.begin() + end_pos;
+ l_ePartStatus = removeSameNumFiles(itr, log_path, l_vector);
+ if (l_ePartStatus != eFrameworkunifiedStatusOK) {
+ l_eStatus = l_ePartStatus;
+ }
+ }
+ SyncDir(log_path);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+
+static EFrameworkunifiedStatus deleteOldEmmcLog(CfgInfo& f_cfginfo, // NOLINT (runtime/references)
+ std::string& f_archive_destination, // NOLINT (runtime/references)
+ SS_STORELOGS_OPE_TYPE type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR *l_dirp = NULL;
+ struct dirent *l_direntp = NULL;
+ std::vector<std::string> vect_abnrm;
+ std::vector<std::string> vect_nrm;
+ std::vector<std::string> vect_rlnc;
+ std::string l_emmc_path = f_cfginfo.output_path;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ UI_32 abnrm_count = 0;
+
+ if (SS_STORELOGS_SYS_ILLEGAL == type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+ }
+
+
+ l_dirp = opendir(l_emmc_path.c_str());
+ if (l_dirp != NULL) {
+ while ((l_direntp = readdir(l_dirp)) != NULL) {
+ std::string l_findFileName = l_direntp->d_name;
+
+// if ((std::string::npos != l_findFileName.find("_ILG_RESET.tar.gz"))
+// || (std::string::npos != l_findFileName.find("_ERR.tar.gz"))) {
+ if ((l_findFileName == ".") || (l_findFileName == "..")) {
+ continue;
+ } else if (std::string::npos != l_findFileName.find(SS_STORE_FILENAME_SYSILG_TERM)) {
+ vect_abnrm.push_back(l_findFileName);
+ } else if (std::string::npos != l_findFileName.find(SS_STORE_FILENAME__CWORD52__TERM)) {
+ vect_abnrm.push_back(l_findFileName);
+ } else if((std::string::npos != l_findFileName.find("_ILG_RESET.tar.gz")) ||
+ (std::string::npos != l_findFileName.find("_ERR.tar.gz"))) {
+
+ vect_abnrm.push_back(l_findFileName);
+
+ abnrm_count++;
+
+ } else if (std::string::npos
+ != l_findFileName.find("_GRP_RELAUNCH.tar.gz")) {
+ vect_rlnc.push_back(l_findFileName);
+ } else if (std::string::npos != l_findFileName.find(".tar.gz")) {
+ vect_nrm.push_back(l_findFileName);
+ }
+ }
+ closedir(l_dirp);
+ }
+
+ if (SS_STORELOGS_ILLEGAL == type) {
+ if ((UI_32) f_cfginfo.output_errmax <= vect_abnrm.size()) {
+ l_eStatus = deleteOldLog(l_emmc_path, vect_abnrm, f_archive_destination,
+ (UI_32) f_cfginfo.output_errmax);
+ }
+ } else {
+ if ((UI_32) f_cfginfo.output_max <= vect_nrm.size()) {
+ l_eStatus = deleteOldLog(l_emmc_path, vect_nrm, f_archive_destination,
+ (UI_32) f_cfginfo.output_max);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/systemservice/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h b/systemservice/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h
new file mode 100755
index 0000000..31d1caa
--- /dev/null
+++ b/systemservice/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h
@@ -0,0 +1,96 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_Logger
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_LIB_SS_LOGGER_STORE_LOGS_LOGGERSERVICELOG_H_
+#define LOGGER_SERVICE_SERVER_LIB_SS_LOGGER_STORE_LOGS_LOGGERSERVICELOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_FUNC
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern const CHAR AppName[];
+
+typedef enum _ELoggerserviceLogType {
+ eLoggerservicelogTypeNormal,
+ eLoggerservicelogTypeAbnormal,
+
+ eLoggerservicelogTypeSysAbnormal,
+ eLoggerservicelogType_CWORD52_,
+
+ eLoggerservicelogTypeGrpRelaunch,
+ eLoggerservicelogTypeOther,
+} ELOGGERSERVICELOGTYPE;
+
+#endif // LOGGER_SERVICE_SERVER_LIB_SS_LOGGER_STORE_LOGS_LOGGERSERVICELOG_H_
diff --git a/systemservice/logger_service/server/realtimeUsbLog/Makefile b/systemservice/logger_service/server/realtimeUsbLog/Makefile
new file mode 100755
index 0000000..420c13e
--- /dev/null
+++ b/systemservice/logger_service/server/realtimeUsbLog/Makefile
@@ -0,0 +1,22 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+SUBDIRS += work
+
+
+
+include ../../../system_service.mk
diff --git a/systemservice/logger_service/server/realtimeUsbLog/realtimeUsbLog.conf_bin b/systemservice/logger_service/server/realtimeUsbLog/realtimeUsbLog.conf_bin
new file mode 100755
index 0000000..440d361
--- /dev/null
+++ b/systemservice/logger_service/server/realtimeUsbLog/realtimeUsbLog.conf_bin
@@ -0,0 +1,4 @@
+/usr/agl/bin|${OSW_reldbg}
+debug|dbg
+release|rel
+product|rel
diff --git a/systemservice/logger_service/server/realtimeUsbLog/src/Makefile b/systemservice/logger_service/server/realtimeUsbLog/src/Makefile
new file mode 100755
index 0000000..c3733b3
--- /dev/null
+++ b/systemservice/logger_service/server/realtimeUsbLog/src/Makefile
@@ -0,0 +1,74 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = realtimeUsbLog
+
+######### installed library(*.a) #############
+
+
+######### installed shared library(*.so) #############
+
+
+######### install headers(*.h) #############
+
+
+######### compiled sources #############
+realtimeUsbLog_SRCS += ss_logger_realtime_usb.cpp
+realtimeUsbLog_SRCS += loggerservice_main.cpp
+######### add source path #############
+VPATH += ../src
+
+######### add include path #############
+CPPFLAGS += -I./
+
+#CPPFLAGS += -I../inc
+#CPPFLAGS += -I../../inc
+CPPFLAGS += -I../../include
+CPPFLAGS += -I../../../../system_manager/server/include
+CPPFLAGS += -I../../../../system_manager/server/include/processlauncher
+
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30
+######### linked library #############
+
+
+######### linked library (dynamic) #############
+#LDLIBS += -Wl,-Bdynamic -lxxx
+LDLIBS += -Wl,-Bdynamic -lcommon
+#LDLIBS += -Wl,-Bdynamic -lextension
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+
+LDLIBS += -Wl,-Bdynamic -lsssmcfg
+LDLIBS += -Wl,-Bdynamic -lresm
+LDLIBS += -Wl,-Bdynamic -lssver
+LDLIBS += -Wl,-Bdynamic -lSS_RomAccessIf
+#LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI
+LDLIBS += -Wl,-Bdynamic -ltar -lz
+LDLIBS += -Wl,-Bdynamic -lrt
+
+
+######### add library path #############
+
+LDFLAGS += -g -Wl,--gc-sections
+
+LINK_CXX=Y
+include ../../../../system_service.mk
diff --git a/systemservice/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp b/systemservice/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp
new file mode 100755
index 0000000..d5dfd00
--- /dev/null
+++ b/systemservice/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief Application entry point.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <errno.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <system_service/ss_system_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_version.h>
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_system_types.h>
+#include <system_service/ss_logger_store_logs.h>
+#include <fstream>
+#include <cstdlib>
+
+BOOL g_isExec = FALSE;
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnInitialization
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ eStatus = StartRtUsbLogThread(hApp);
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnDestroy
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) {
+ return eFrameworkunifiedStatusOK;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnDummy
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDummy(HANDLE hApp) {
+ return eFrameworkunifiedStatusOK;
+}
+
+//////////////////////////////////////////
+// Function : main
+//////////////////////////////////////////
+int main(int argc, char *argv[]) {
+ HANDLE hApp;
+ int nsFd;
+ char clientName[16] = "realtimeUsbLog";
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+
+ cbFuncs.onInitilization = FrameworkunifiedOnInitialization;
+ cbFuncs.onDestroy = FrameworkunifiedOnDestroy;
+
+ cbFuncs.onStart = FrameworkunifiedOnDummy;
+ cbFuncs.onStop = FrameworkunifiedOnDummy;
+ cbFuncs.onDebugDump = FrameworkunifiedOnDummy;
+ cbFuncs.createStateMachine = FrameworkunifiedOnDummy;
+ cbFuncs.ssFrameworkInterface = FrameworkunifiedOnDummy;
+
+ FrameworkunifiedCreateDispatcherWithoutLoop(clientName, hApp, argc, argv, &cbFuncs, FALSE);
+
+ FrameworkunifiedGetDispatcherFD(hApp, &nsFd);
+
+ g_isExec = TRUE;
+ while (g_isExec) {
+ fd_set fds;
+ int maxFd = 0;
+
+ FD_ZERO(&fds);
+
+ FD_SET(nsFd, &fds);
+ maxFd = nsFd;
+
+ select(maxFd + 1, &fds, NULL, NULL, NULL);
+
+ if (FD_ISSET(nsFd, &fds)) {
+ FrameworkunifiedDispatchProcessWithoutLoop(hApp);
+ }
+ }
+
+ FrameworkunifiedDestroyDispatcherWithoutLoop(hApp);
+ return 0;
+}
diff --git a/systemservice/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp b/systemservice/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp
new file mode 100755
index 0000000..c318f1a
--- /dev/null
+++ b/systemservice/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp
@@ -0,0 +1,722 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief This file contains the standard set functions called by the NS
+// dispatcher on application initialization, cleanup and wakeup.
+///
+///////////////////////////////////////////////////////////////////////////////
+// System Headers
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <mqueue.h>
+#include <errno.h>
+#include <string.h>
+#include <dirent.h>
+#include <time.h>
+#include <loggerservicedebug_loggerservicelog.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <native_service/frameworkunified_timer.h>
+#include <system_service/ss_devicedetection_service_notifications.h>
+#include <system_service/ss_devicedetection_service.h>
+#include <system_service/ss_devicedetection_service_protocol.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_types.h>
+#include <queue>
+#include <string>
+
+// System definition
+#ifndef TN_LOGGERRTIME
+#define TN_LOGGERRTIME "LoggerRtime"
+#define PR_LOGGERRTIME_S PR_TSS_S
+#define PR_LOGGERRTIME PR_TSS
+#endif // TN_LOGGERRTIME
+// Queue resource
+#define USB_REALTIME_MSGMAX 256
+#define USB_REALTIME_SIZMAX 4096
+#define USB_REALTIME_QNAME "/PlRtLogger"
+// Folder path
+#define USB_RT_FOLDERPATH_ "/REALTIME_"
+
+// older path
+#define USB_RT_TMP_PATH "/tmp"
+// File name
+#define USB_RT_LOGNAME_TMP "usbrt_tmp.log"
+#define ENC_BUF_MAX_SIZE (1024*8)
+
+#ifdef RELEASE_BUILD
+// encrypt values
+#define DEV_ENC_EXTENSION ".enc1"
+#define REL_ENC_EXTENSION ".enc2"
+#define ALIGNMENT_SIZE 4
+#endif // RELEASE_BUILD
+
+// File path
+#define USB_RT_LOGNAME_ "loggerservice_usb__realtime"
+// Max size of each log file
+#define USB_RT_FILE_SIZE (1024*1024)
+// Num of logs to write in std::queue at one time
+#define QUELOG_WRITE_BLOCK_NUM 300
+// Max of logs to save in std::queue
+#define QUELOG_SAVE_MAX 12000
+#define QUELOG_DELNUM (QUELOG_WRITE_BLOCK_NUM*2) // num of deletion at one time
+// TIMER ID
+#define USB_RT_TIMER_EV 0x89
+#define USB_RT_TIMER_SYNC 1 // kind
+#define USB_RT_TIMER_CYCLE 10000 // cycle of timeout(msec)
+
+static HANDLE g_rt_tid = NULL;
+static int g_wfd = -1;
+static mqd_t g_qid = (mqd_t) - 1;
+static int g_num_of_file = 1;
+static char g_mnt_path[MAXPATHLEN];
+static char g_fld_path[MAXPATHLEN];
+static char g_log_path[MAXPATHLEN];
+static char *g_log_name;
+static bool g_need_sync = false;
+static size_t g_filesize = 0;
+
+//static queue<string> g_saveq;
+static std::queue<std::string> g_saveq;
+
+static DeviceDetectionServiceIf g_devDetect;
+static bool g_usb_available = false;
+
+static char g_log_tmp_path[MAXPATHLEN];
+
+EFrameworkunifiedStatus rtUsbLogThread(HANDLE hApp);
+EFrameworkunifiedStatus rtUsbLogTShutdown(HANDLE hApp);
+EFrameworkunifiedStatus OnPowerOnOffNotification(HANDLE hApp);
+
+EFrameworkunifiedStatus StartTimer(HANDLE hApp, const UI_32 timeout);
+EFrameworkunifiedStatus CancelTimer(void);
+
+// DeviceDetection Related funcs
+EFrameworkunifiedStatus OnDeviceDetectionAvailability(HANDLE hApp);
+EFrameworkunifiedStatus OnDeviceDetectionOpenSessionACK(HANDLE hApp);
+EFrameworkunifiedStatus onDeviceDetectionCloseSessionACK(HANDLE hApp);
+EFrameworkunifiedStatus onUsbDetectCallback(HANDLE hApp);
+
+EFrameworkunifiedStatus EncryptAndCopyFile(void);
+
+EFrameworkunifiedStatus StartRtUsbLogThread(HANDLE hApp) {
+ FrameworkunifiedChildThreadAttr attr;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (g_rt_tid != NULL) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ // Create Realtime USB Logging Thread and start
+ memset(&attr, 0, sizeof(FrameworkunifiedChildThreadAttr));
+ // One time while to break on Error
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedCreateChildThreadAttrSetSched(&attr,
+ eFrameworkunifiedSchedPolicyTSS,
+ PR_LOGGERRTIME))) {
+ return l_eStatus;
+ }
+ g_rt_tid = FrameworkunifiedCreateChildThreadWithAttribute(hApp, TN_LOGGERRTIME,
+ rtUsbLogThread,
+ rtUsbLogTShutdown, &attr);
+ if (g_rt_tid == NULL) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_eStatus = FrameworkunifiedStartChildThread(hApp, g_rt_tid, 0, (PVOID) NULL);
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus StopRtUsbLogThread(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // Close fd to sync
+ if (g_wfd != -1) {
+ if (0 != close(g_wfd)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ EncryptAndCopyFile();
+ }
+ // Close message queue
+ if (g_qid != (mqd_t) - 1) {
+ if (0 != mq_close(g_qid)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ // Terminate Thread
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedStopChildThread(hApp, g_rt_tid, 0, NULL)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedDestroyChildThread(hApp, g_rt_tid)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus OnPowerOnOffNotification(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ T_SS_SM_UserModeOnOffNotification_StructType onoff_mode;
+
+ l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID) &onoff_mode,
+ sizeof(onoff_mode));
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ fprintf(stderr, "%s: Failed to fetch OnOff Mode\n", __FUNCTION__);
+ return l_eStatus;
+ }
+ if (!onoff_mode.isUserModeOn) { // ACC-OFF
+ // Close fd to sync
+ if (g_wfd >= 0) {
+ syncfs(g_wfd);
+ if (0 != close(g_wfd)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ EncryptAndCopyFile();
+ g_wfd = -2; // ACC-OFF detected
+ }
+ }
+ return l_eStatus;
+}
+
+static int getStartFileNum(void) {
+ int start = 0;
+ int num;
+ DIR *dirp;
+ struct dirent entry;
+ struct dirent *next;
+
+ if ((dirp = opendir(g_fld_path)) == NULL) {
+ fprintf(stderr, "%s: Failed in opendir, errno=%d\n", __FUNCTION__, errno);
+ return -1;
+ }
+ for (;;) {
+ if (readdir_r(dirp, &entry, &next) != 0) {
+ fprintf(stderr, "%s: Failed in readdir_r, errno=%d\n", __FUNCTION__,
+ errno);
+ closedir(dirp);
+ return -1;
+ }
+ if (next == NULL) { // NO more
+ break;
+ }
+ if (strncmp(entry.d_name, g_log_name, strlen(g_log_name)) != 0) {
+ continue;
+ }
+ num = atoi(entry.d_name + strlen(g_log_name));
+ if (num > start) {
+ start = num;
+ }
+ }
+ closedir(dirp);
+ start++;
+
+ return start;
+}
+
+EFrameworkunifiedStatus WriteAndSwitchLogFile(const char* data, ssize_t size) {
+ ssize_t wrotelen;
+ char logpath[MAXPATHLEN];
+
+ wrotelen = write(g_wfd, data, size);
+ if (wrotelen != size) {
+ close(g_wfd);
+ g_wfd = -1;
+ g_filesize = 0;
+ EncryptAndCopyFile();
+ fprintf(stderr, "%s: Failed to write, size=%d, wrotelen=%d, errno=%d\n",
+
+// __FUNCTION__, static_cast<int32_t>size, static_cast<int32_t>wrotelen, errno);
+ __FUNCTION__, static_cast<int32_t>(size), static_cast<int32_t>(wrotelen), errno);
+
+ return eFrameworkunifiedStatusFail;
+ } else {
+ g_filesize += wrotelen;
+ g_need_sync = true;
+ if (static_cast<int>(g_filesize) >= USB_RT_FILE_SIZE) {
+ g_filesize = 0;
+ close(g_wfd);
+ EncryptAndCopyFile();
+ g_num_of_file++;
+
+
+// snprintf(logpath, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+ snprintf(logpath, MAXPATHLEN, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+
+ if ((g_wfd = open(logpath, O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0644))
+ == -1) {
+ fprintf(stderr, "%s: Failed to open file %s, errno=%d\n", __FUNCTION__,
+ logpath, errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus OnMessageQueueReceived(HANDLE hApp) {
+ ssize_t len, len2;
+ char msg[USB_REALTIME_SIZMAX], msg2[USB_REALTIME_SIZMAX];
+ char logpath[MAXPATHLEN];
+ unsigned int prior;
+ struct stat stbuf;
+
+// string work_str;
+ std::string work_str;
+
+ bool pushed = false;
+ const struct timespec tspec = { 0, 0 };
+
+ // write loop
+ while (1) {
+ pushed = false;
+ if (g_qid == (mqd_t) - 1) { // Already ACC-OFFed
+ return eFrameworkunifiedStatusOK;
+ }
+ len = mq_timedreceive(g_qid, msg, sizeof(msg), &prior, &tspec);
+ if (len == (ssize_t) - 1) { // NO more data
+ if (errno != ETIMEDOUT) {
+ fprintf(stderr, "%s: Unexpected error %d\n", __FUNCTION__, errno);
+ }
+ break;
+ }
+ // Remove overflowed log
+ if (g_saveq.size() > QUELOG_SAVE_MAX) {
+ int delnum = g_saveq.size() - QUELOG_SAVE_MAX + QUELOG_DELNUM;
+ for (int i = 0; i < delnum; i++) {
+ g_saveq.pop();
+ }
+ }
+ // check if file is opened
+ if (g_wfd == -1) {
+ /*
+ * Make folder and open log file
+ */
+ // save dequeued log
+
+// g_saveq.push(string((const char*) msg, len));
+ g_saveq.push(std::string((const char*) msg, len));
+
+ pushed = true; // request pushed or NON-log message -> NO NEED to write this data to log file
+ // Check USB mounted
+ if (!g_usb_available) {
+ // No mount event is received
+ continue;
+ }
+ // Check USB mounted
+ if (stat(g_mnt_path, &stbuf) != 0) {
+ // No mount path found
+ continue;
+ }
+ // Check and make subfolder
+ int mkdres = mkdir(g_fld_path, 0666);
+ if (mkdres == 0) {
+ g_num_of_file = 1;
+ } else if (mkdres == -1 && errno == EEXIST) {
+ // Decide file number to start(Check current log files)
+ g_num_of_file = getStartFileNum();
+ if (g_num_of_file <= 0) {
+ fprintf(stderr, "%s: Failed in getStartFileNum\n", __FUNCTION__);
+ continue;
+ }
+ } else {
+ fprintf(stderr, "%s: Failed to mkdir %s, errno=%d\n", __FUNCTION__,
+ g_fld_path, errno);
+ continue;
+ }
+
+ // Open File
+ g_filesize = 0;
+
+
+// snprintf(logpath, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+ snprintf(logpath, MAXPATHLEN, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+
+ if ((g_wfd = open(logpath, O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0644))
+ == -1) {
+ fprintf(stderr, "%s: Failed to open file %s, errno=%d\n", __FUNCTION__,
+ logpath, errno);
+ continue;
+ }
+ } else if (g_wfd == -2) {
+ // Already ACC-OFF, Just throw the logs away
+ continue;
+ }
+ // Write out saved log if any
+ int written_once = QUELOG_WRITE_BLOCK_NUM; // num of written at once
+ while (1) {
+ if (g_saveq.empty()) {
+ break;
+ }
+ if (written_once >= QUELOG_WRITE_BLOCK_NUM) {
+ written_once = 0;
+ while (1) {
+ // read request queue
+ len2 = mq_timedreceive(g_qid, msg2, sizeof(msg2), &prior, &tspec);
+ if (len2 == (ssize_t) - 1) { // NO MORE data
+ if (errno != ETIMEDOUT) {
+ fprintf(stderr, "%s: Unexpected error %d\n", __FUNCTION__, errno);
+ }
+ break;
+ }
+
+// g_saveq.push(string((const char*) msg2, len2));
+ g_saveq.push(std::string((const char*) msg2, len2));
+
+ }
+ }
+ work_str = g_saveq.front();
+ if (eFrameworkunifiedStatusOK
+ != WriteAndSwitchLogFile(work_str.data(), work_str.length())) {
+ fprintf(stderr, "%s: Failed in write Saved data, errno=%d\n",
+ __FUNCTION__, errno);
+ break;
+ } else {
+ written_once++;
+ g_saveq.pop();
+ }
+ }
+ if (pushed || g_wfd == -1) {
+ continue;
+ }
+ // write data
+ if (eFrameworkunifiedStatusOK != WriteAndSwitchLogFile(msg, len)) {
+ fprintf(stderr, "%s: Failed in write Saved data-2, errno=%d\n",
+ __FUNCTION__, errno);
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus OnSyncTimeout(HANDLE hApp) {
+ if (g_need_sync) {
+ if (g_wfd != -1 && g_wfd != -2) {
+ char logpath[MAXPATHLEN];
+ fsync(g_wfd);
+ close(g_wfd);
+ g_wfd = -1;
+ EncryptAndCopyFile();
+
+// snprintf(logpath, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+ snprintf(logpath, MAXPATHLEN, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+
+ if ((g_wfd = open(logpath, O_RDWR | O_CREAT | O_APPEND | O_CLOEXEC, 0644))
+ == -1) {
+ fprintf(stderr, "%s: Failed to open file %s, errno=%d (%s)\n",
+ __FUNCTION__, logpath, errno, strerror(errno));
+ // because in order to continue to obtain logs.
+ return eFrameworkunifiedStatusOK;
+ }
+ g_need_sync = false;
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus rtUsbLogThread(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ struct mq_attr qattr;
+ const struct timespec idle_time = { 1, 0 }; // 1sec
+ HANDLE timer_handle = NULL;
+
+ // Subscribe Boot Mode Notifcation to SysMgr
+ l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp,
+ NTFY_SSSystemMgrPowerOnOff,
+ OnPowerOnOffNotification);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ fprintf(stderr, "%s: Subscribe PowerOnOff failed, status=%d\n",
+ __FUNCTION__, l_eStatus);
+ }
+ // Subscribe Device Detection Availability
+ while (1) {
+ if (g_devDetect.Initialize(hApp)) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = g_devDetect.NotifyOnDeviceDetectionAvailability(
+ OnDeviceDetectionAvailability))) {
+ fprintf(stderr,
+ "%s: DevDetec AvailabilityCallback registration failed\n",
+ __FUNCTION__);
+ }
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = g_devDetect.NotifyOnOpenSessionAck(
+ OnDeviceDetectionOpenSessionACK))) {
+ fprintf(stderr, "%s: DevDetec OpenSession ACK registration failed\n",
+ __FUNCTION__);
+ }
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = g_devDetect.NotifyOnCloseSessionAck(
+ onDeviceDetectionCloseSessionACK))) {
+ fprintf(stderr, "%s: DevDetec CloseSession ACK registration failed\n",
+ __FUNCTION__);
+ }
+ break;
+ } else {
+ fprintf(stderr, "%s: Device Detection Object Initialization failed\n",
+ __FUNCTION__);
+ nanosleep(&idle_time, NULL);
+ }
+ }
+
+ // open message queue
+ while (1) {
+ qattr.mq_flags = 0;
+ qattr.mq_maxmsg = USB_REALTIME_MSGMAX;
+ qattr.mq_msgsize = USB_REALTIME_SIZMAX;
+ qattr.mq_curmsgs = 0;
+ if ((g_qid = mq_open(USB_REALTIME_QNAME, O_RDWR | O_CREAT, 0666, &qattr))
+ >= (mqd_t) 0) {
+ break;
+ }
+ fprintf(stderr, "%s: Failed in mq_open, errno=%d\n", __FUNCTION__, errno);
+ nanosleep(&idle_time, NULL);
+ }
+
+ // Attach callback func to message queue fd
+ l_eStatus = FrameworkunifiedAttachCallbackToDispatcherWithFd(hApp, static_cast<int>(g_qid),
+ OnMessageQueueReceived);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ fprintf(
+ stderr,
+ "%s: Error in FrameworkunifiedAttachCallbackToDispatcherWithFd with mq_fd, status=%d\n",
+ __FUNCTION__, l_eStatus);
+ return l_eStatus;
+ }
+ // Start Cyclic Timer
+ timer_handle = FrameworkunifiedAttachTimerCallback(hApp, USB_RT_TIMER_CYCLE,
+ USB_RT_TIMER_CYCLE,
+ OnSyncTimeout);
+ if (timer_handle == NULL) {
+ fprintf(stderr, "%s: Error in FrameworkunifiedAttachTimerCallback\n", __FUNCTION__);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // Enter dispatcher ==> Just return
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus rtUsbLogTShutdown(HANDLE hApp) {
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus OnDeviceDetectionAvailability(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (FrameworkunifiedIsServiceAvailable(hApp)) {
+ if (eFrameworkunifiedStatusOK != (eStatus = g_devDetect.OpenSessionRequest())) {
+ fprintf(stderr, "%s: Open session request failed\n", __FUNCTION__);
+ }
+ } else {
+ if (eFrameworkunifiedStatusOK != (eStatus = g_devDetect.CloseSessionRequest())) {
+ fprintf(stderr, "%s: Close session request failed\n", __FUNCTION__);
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus OnDeviceDetectionOpenSessionACK(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = g_devDetect.DecodeOpenSessionResponse())) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = g_devDetect.RegisterForDeviceDetectionEvent(
+ SS_DEV_DETECT_ANY_USB_EV, onUsbDetectCallback))) {
+ fprintf(stderr, "%s: Registration for SS_DEV_DETECT_ANY_USB_EV failed\n",
+ __FUNCTION__);
+ }
+ } else {
+ fprintf(stderr, "%s: Decode open session response failed\n", __FUNCTION__);
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus onDeviceDetectionCloseSessionACK(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CloseSessionAck tCloseSessionAck;
+
+ if (hApp) {
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tCloseSessionAck,
+ sizeof(tCloseSessionAck)))) {
+ if (eFrameworkunifiedStatusOK != tCloseSessionAck.eStatus) {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus onUsbDetectCallback(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SS_MediaDetectInfo l_tMediaDetectInfo;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_tMediaDetectInfo,
+ sizeof(l_tMediaDetectInfo)))) {
+ fprintf(stderr, "%s: FrameworkunifiedGetMsgDataOfSize Failed Status:0x%x\n",
+ __FUNCTION__, l_eStatus);
+ } else {
+ if (l_tMediaDetectInfo.dev_type != eUSB) { // NOT mass storage device
+ return l_eStatus;
+ }
+ if (l_tMediaDetectInfo.bIsDeviceAvailable) {
+ if (g_usb_available) { // Already mounted
+ return l_eStatus;
+ }
+ // set USB device available
+ g_usb_available = true;
+ // Organize paths to access
+ strncpy(g_mnt_path, l_tMediaDetectInfo.deviceMountpath,
+ sizeof(g_mnt_path));
+
+ snprintf(g_fld_path, MAXPATHLEN, "%s%s", g_mnt_path, USB_RT_FOLDERPATH_);
+ snprintf(g_log_path, MAXPATHLEN, "%s/%s", g_fld_path, USB_RT_LOGNAME_);
+ g_log_name = const_cast<char*>(USB_RT_LOGNAME_);
+
+
+
+// snprintf(g_log_tmp_path, "%s", USB_RT_TMP_PATH);
+ snprintf(g_log_tmp_path, MAXPATHLEN, "%s", USB_RT_TMP_PATH);
+
+
+ } else {
+ // unset USB device available
+ if (strcmp(l_tMediaDetectInfo.deviceMountpath, g_mnt_path) == 0) {
+ g_usb_available = false;
+ g_mnt_path[0] = 0;
+ if (g_wfd != -1 && g_wfd != -2) {
+ close(g_wfd);
+ g_wfd = -1;
+ EncryptAndCopyFile();
+ }
+ }
+ }
+ }
+
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus EncryptAndCopyFile(void) {
+ char usblogpath[MAXPATHLEN];
+ char logpath[MAXPATHLEN];
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int rfd, wfd;
+ int ret;
+ struct stat istat_buf;
+
+
+// snprintf(usblogpath, "%s%05d.log", g_log_path, g_num_of_file);
+
+// snprintf(logpath, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+ snprintf(usblogpath, MAXPATHLEN, "%s%05d.log", g_log_path, g_num_of_file);
+
+ snprintf(logpath, MAXPATHLEN, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+
+
+ rfd = open(logpath, O_RDWR | O_CLOEXEC);
+ if (rfd == -1) {
+ fprintf(stderr, "%s: Error. Failed to open file: %s for reading.\n",
+ __FUNCTION__, logpath);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ ret = fstat(rfd, &istat_buf);
+ if (ret < 0) {
+ fprintf(stderr, "%s: Error. stat(%s). errno: %d, %s \n", __FUNCTION__,
+ logpath, errno, strerror(errno));
+ close(rfd);
+ return eFrameworkunifiedStatusFail;
+ } else {
+ BYTE *pData;
+ int total_len;
+ int read_len;
+ off_t total_size = istat_buf.st_size;
+
+ wfd = open(usblogpath, O_RDWR | O_APPEND | O_TRUNC | O_CREAT | O_CLOEXEC,
+ 0644);
+ if (wfd == -1) {
+ fprintf(stderr, "%s: Error. Failed to open file: %s for reading.\n",
+ __FUNCTION__, usblogpath);
+ close(rfd);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ pData = reinterpret_cast<BYTE*>(malloc(ENC_BUF_MAX_SIZE));
+ if (pData == NULL) {
+ fprintf(stderr, "%s: Error. Failed to malloc %d byte for dst \n",
+ __FUNCTION__, ENC_BUF_MAX_SIZE);
+ close(rfd);
+ close(wfd);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ total_len = static_cast<int>(total_size);
+ do {
+ read_len = read(rfd, pData, ENC_BUF_MAX_SIZE);
+ if (read_len == -1) {
+ fprintf(stderr, "%s: Error. File read failed. errno: %d, %s \n",
+ __FUNCTION__, errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ ret = write(wfd, pData, read_len);
+ if (ret == -1) {
+ fprintf(stderr, "%s: Error. length(%d) no space to write: %d, %s \n",
+ __FUNCTION__, ret, errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ total_len -= read_len;
+ } while (total_len > 0);
+
+ fsync(wfd);
+ free(pData);
+ close(wfd);
+ close(rfd);
+
+ if (l_eStatus == eFrameworkunifiedStatusFail) {
+ return l_eStatus;
+ }
+ {
+ // Synchronization security
+ struct stat ostat_buf;
+ while (1) {
+ ret = stat(usblogpath, &ostat_buf);
+ if (ret < 0) {
+ fprintf(stderr, "%s: Error. stat(%s). errno: %d, %s", __FUNCTION__,
+ usblogpath, errno, strerror(errno));
+ break;
+ }
+ if (ostat_buf.st_size >= total_size) {
+ break;
+ }
+ usleep(1000); // interval
+ }
+ }
+ }
+ return l_eStatus;
+}
diff --git a/systemservice/logger_service/server/realtimeUsbLog/work/Makefile b/systemservice/logger_service/server/realtimeUsbLog/work/Makefile
new file mode 100755
index 0000000..ee9c7e8
--- /dev/null
+++ b/systemservice/logger_service/server/realtimeUsbLog/work/Makefile
@@ -0,0 +1,23 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#ADD_EXT:=rel
+
+
+LDLIBS += -Wl,-Bdynamic -lcrypto
+CPPFLAGS += -DRELEASE_BUILD
+
+include ../src/Makefile
diff --git a/systemservice/logger_service/server/realtimeUsbLog/work_debug/Makefile b/systemservice/logger_service/server/realtimeUsbLog/work_debug/Makefile
new file mode 100755
index 0000000..8ad806a
--- /dev/null
+++ b/systemservice/logger_service/server/realtimeUsbLog/work_debug/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ADD_EXT:=dbg
+
+include ../src/Makefile
diff --git a/systemservice/logger_service/server/screenShot/Makefile b/systemservice/logger_service/server/screenShot/Makefile
new file mode 100755
index 0000000..f52e40c
--- /dev/null
+++ b/systemservice/logger_service/server/screenShot/Makefile
@@ -0,0 +1,52 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = SS_ScrShot
+
+######### installed library(*.a) #############
+
+
+######### installed shared library(*.so) #############
+
+
+######### install headers(*.h) #############
+
+
+######### compiled sources #############
+SS_ScrShot_SRCS = ss_logger_scrshot.cpp
+
+######### add source path #############
+
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -fno-exceptions
+
+######### linked library #############
+
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -ldu
+LDLIBS += -Wl,-Bdynamic -ljpeg
+#LDLIBS += -Wl,-Bdynamic -lextension
+LDLIBS += -Wl,-Bdynamic -ldrm
+
+######### add library path #############
+LDFLAGS += -Wl,--gc-sections
+
+LINK_CXX=Y
+include ../../../system_service.mk
diff --git a/systemservice/logger_service/server/screenShot/ss_logger_scrshot.cpp b/systemservice/logger_service/server/screenShot/ss_logger_scrshot.cpp
new file mode 100755
index 0000000..db5bcba
--- /dev/null
+++ b/systemservice/logger_service/server/screenShot/ss_logger_scrshot.cpp
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <jpeglib.h>
+#include <du.h>
+
+#define MAX_IMAGE_WIDTH 1280
+#define MAX_IMAGE_HEIGHT 480
+#define COLOR_COMPONENT 4
+
+int SS_Logger_SaveScreenShot(const char* filename, int type) {
+ FILE *outfile;
+ struct SCRSHOT_capture_arg stSCR;
+ struct jpeg_compress_struct cinfo;
+ struct jpeg_error_mgr jerr;
+ unsigned char *work_buf;
+
+ stSCR.du = type; // 0:E2 1:M2
+ stSCR.fmt = SCRSHOT_FMT_ARGB8888;
+ stSCR.buff = malloc(MAX_IMAGE_WIDTH * MAX_IMAGE_HEIGHT * COLOR_COMPONENT);
+ stSCR.buff_len = MAX_IMAGE_WIDTH * MAX_IMAGE_HEIGHT * COLOR_COMPONENT;
+ stSCR.ev_handler = NULL; // sync mode
+
+ if (stSCR.buff == NULL) {
+ exit(1);
+ }
+
+ if (SCRSHOT_RET_SUCCESS != SCRSHOT_capture(&stSCR)) {
+ exit(1);
+ }
+
+ cinfo.err = jpeg_std_error(&jerr);
+ jpeg_create_compress(&cinfo);
+
+ if ((outfile = fopen(filename, "wb")) == NULL) {
+ exit(1);
+ }
+ jpeg_stdio_dest(&cinfo, outfile);
+ cinfo.image_width = stSCR.width;
+ cinfo.image_height = stSCR.height;
+ cinfo.input_components = COLOR_COMPONENT;
+ cinfo.in_color_space = JCS_EXT_BGRA;
+ jpeg_set_defaults(&cinfo);
+ jpeg_start_compress(&cinfo, TRUE);
+
+ work_buf = (unsigned char*) stSCR.buff;
+ for (unsigned int i = 0; i < stSCR.height; i++) {
+ jpeg_write_scanlines(&cinfo, (JSAMPARRAY) & (work_buf), 1);
+ work_buf += stSCR.width * COLOR_COMPONENT;
+ }
+
+ jpeg_finish_compress(&cinfo);
+ jpeg_destroy_compress(&cinfo);
+ free(stSCR.buff);
+ fclose(outfile);
+ exit(0);
+}
+
+int main(int argc, char *argv[]) {
+ if (argc < 3) {
+ exit(1);
+ }
+ int chType = atoi(argv[2]);
+ SS_Logger_SaveScreenShot(argv[1], chType);
+
+ return 0;
+}
diff --git a/systemservice/logger_service/server/src/cached_file_writer.cpp b/systemservice/logger_service/server/src/cached_file_writer.cpp
new file mode 100755
index 0000000..92c02f5
--- /dev/null
+++ b/systemservice/logger_service/server/src/cached_file_writer.cpp
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/writer/cached_file_writer.h"
+#include <native_service/frameworkunified_types.h>
+
+namespace ReaderWriter {
+
+CCachedFileWriter::CCachedFileWriter() {
+ std::memset(this->m_buffer, 0, CACHED_BLOCK_SIZE);
+ m_index = 0u;
+}
+
+CCachedFileWriter::~CCachedFileWriter() {
+}
+
+EFrameworkunifiedStatus CCachedFileWriter::Write(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesWritten) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // length check
+ if (f_data != NULL) { // LCOV_EXCL_BR_LINE 200: f_data can not be null
+ if ((this->m_index + f_length) > CACHED_BLOCK_SIZE) { // LCOV_EXCL_BR_LINE 200: data size can not over 4*1024
+ l_eStatus = this->FlushCache();
+ }
+ if (f_length > CACHED_BLOCK_SIZE) { // LCOV_EXCL_BR_LINE 200: data size can not over 4*1024
+ // LCOV_EXCL_START 200: data size can not over 4*1024
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Possible memory corruption.");
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Length(%d) bigger than cache. Will dump memory to core and ignore data. ",
+ f_length);
+ // LCOV_EXCL_STOP
+ } else {
+ (void) std::memcpy(&this->m_buffer[this->m_index], f_data, f_length);
+ this->m_index += f_length;
+ f_bytesWritten = f_length;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CCachedFileWriter::FlushCache(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SI_32 l_written = 0;
+ SI_32 l_writtenTotal = 0;
+ while (((l_writtenTotal >= 0) && ((UI_32) l_writtenTotal < this->m_index))
+ && (eFrameworkunifiedStatusOK == l_eStatus)) {
+ l_eStatus = this->WriteData(&this->m_buffer[l_writtenTotal],
+ this->m_index - l_writtenTotal, l_written);
+ l_writtenTotal += l_written;
+ l_written = 0;
+ }
+ this->m_index = 0;
+ return l_eStatus;
+}
+} // namespace ReaderWriter
diff --git a/systemservice/logger_service/server/src/file_writer.cpp b/systemservice/logger_service/server/src/file_writer.cpp
new file mode 100755
index 0000000..221a1d4
--- /dev/null
+++ b/systemservice/logger_service/server/src/file_writer.cpp
@@ -0,0 +1,122 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/writer/file_writer.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string>
+
+namespace ReaderWriter {
+CFileWriter::CFileWriter()
+ : m_FileHandle(-1),
+ m_fileposn(-1),
+ m_maxFileSize(0) {
+}
+
+CFileWriter::~CFileWriter() {
+ if (this->m_FileHandle != -1) { // LCOV_EXCL_BR_LINE 200: it aways open, so m_FileHandle can not be -1
+ this->Close();
+ this->m_FileHandle = -1;
+ }
+}
+
+EFrameworkunifiedStatus CFileWriter::Initialize(CLoggerCfg* f_pLoggerCfg,
+ std::string f_Name1, UI_32 f_size1,
+ std::string f_Name2, UI_32 f_size2) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ this->m_pLoggerCfg = f_pLoggerCfg;
+ this->m_maxFileSize = f_size1;
+ if ((f_Name1.length() != 0) && (this->m_FileHandle == -1)) { // LCOV_EXCL_BR_LINE 6:Due to the initial status
+ m_filename = f_Name1;
+ l_eStatus = this->Open();
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CFileWriter::Open(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if (this->m_FileHandle != -1) { // LCOV_EXCL_BR_LINE 6:Due to the initial status
+ // File already opened, no action required.
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (m_filename.length() != 0) { // LCOV_EXCL_BR_LINE 6:Because the applicable variable cannot be changed from the external API
+ this->m_FileHandle = open(m_filename.c_str(),
+ O_WRONLY | O_CREAT | O_TRUNC,
+ 0644);
+ if (-1 != this->m_FileHandle) { // LCOV_EXCL_BR_LINE 5:The open cannot pass because it cannot be mock
+ l_eStatus = eFrameworkunifiedStatusOK;
+ m_fileposn = lseek(m_FileHandle, 0L, SEEK_CUR);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+BOOL CFileWriter::IsOpen(void) {
+ return (-1 == m_FileHandle) ? FALSE : TRUE;
+}
+
+EFrameworkunifiedStatus CFileWriter::Write(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesWritten) {
+ return (this->WriteData(f_data, f_length, f_bytesWritten));
+}
+
+EFrameworkunifiedStatus CFileWriter::WriteData(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesWritten) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ f_bytesWritten = 0;
+ if (-1 == m_FileHandle) { // LCOV_EXCL_BR_LINE 200: m_FileHandle can not be null
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ while ((eFrameworkunifiedStatusOK == l_eStatus)
+ && ((f_bytesWritten >= 0) && ((UI_32) f_bytesWritten < f_length))) {
+ SI_32 l_bytesWritten = -1;
+ m_fileposn = lseek(m_FileHandle, 0L, SEEK_CUR);
+ if ((m_fileposn + (UI_32) f_length) >= this->m_maxFileSize) {
+ SI_32 l_deltaLength = static_cast<SI_32>(this->m_maxFileSize - m_fileposn);
+ l_bytesWritten = static_cast<SI_32>(write(m_FileHandle, &f_data[f_bytesWritten],
+ l_deltaLength));
+ f_bytesWritten += l_bytesWritten;
+ if ((l_bytesWritten >= 0) && (l_deltaLength == l_bytesWritten)) {
+ m_fileposn = lseek(m_FileHandle, 0L, SEEK_SET);
+ }
+ } else {
+ l_bytesWritten = static_cast<SI_32>(write(m_FileHandle, &f_data[f_bytesWritten],
+ f_length - f_bytesWritten));
+ f_bytesWritten += l_bytesWritten;
+ }
+ l_eStatus = (l_bytesWritten > -1) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
+ }
+
+ return (l_eStatus);
+}
+
+void CFileWriter::Close() { // LCOV_EXCL_START 6:Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (this->m_FileHandle != -1) {
+ (void) close(this->m_FileHandle);
+ this->m_FileHandle = -1;
+ }
+}
+// LCOV_EXCL_STOP
+} // namespace ReaderWriter
diff --git a/systemservice/logger_service/server/src/loggerservice_application.cpp b/systemservice/logger_service/server/src/loggerservice_application.cpp
new file mode 100755
index 0000000..2d39fb2
--- /dev/null
+++ b/systemservice/logger_service/server/src/loggerservice_application.cpp
@@ -0,0 +1,952 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief This file contains the standard set functions called by the NS
+// dispatcher on application initialization, cleanup and wakeup.
+///
+///////////////////////////////////////////////////////////////////////////////
+// System Headers
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/cl_process.h>
+
+#include <native_service/nslogutil_cmd_if.h>
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_protocol.h>
+
+#include <loggerservicedebug_loggerservicelog.h>
+#include <loggerservicedebug_thread_if.h>
+#include <loggerservicedebug_writer_Evntworker.h>
+
+#include <native_service/frameworkunified_timer.h>
+#include <ss_logger_device_detection.h>
+
+#include <ss_logger_cfg.h>
+#include <system_service/ss_logger_service_notifications.h>
+#include <system_service/ss_logger_service.h>
+#include <ss_logger_service_callbacks.h>
+
+#include <system_service/ss_sm_client_if.h>
+
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_system_manager_notifications.h>
+
+#include <system_service/ss_devicedetection_service_notifications.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <system_service/ss_services.h>
+#include <ss_logger_error_event.h>
+#include <ss_logger_reader_writer_control.h>
+#include <ss_logger_common.h>
+#include <stub/pfdrec_thread_ifc.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_logger_store_logs.h>
+#include <queue>
+#include <string>
+
+// const definitions
+#define TMPFS_PATH "/tmp"
+
+#define SYS_ILLEGAL_LOG_DELAY_TIME ( 20 * 1000 )
+const CHAR LOGGERSERVICELOGGER_SETPARAMS[] = TMPFS_PATH "/loggerservicelogger_setparams.log";
+const CHAR Counter_LOG_PATH_FN[] = TMPFS_PATH "/loggerservice_counter.log";
+const CHAR Mileage_LOG_PATH_FN[] = TMPFS_PATH "/loggerservice_mileage.log";
+
+const CHAR g_strLogQueWriterWorkerName[] = "pdg.LogQueWriter";
+const CHAR g_strTransmitQueWriterWorkerName[] = "pdg.TransmitQueWriter";
+const CHAR g_strUdpQueWriterWorkerName[] = "pdg.UdpQueWriter";
+const CHAR g_strEvntLogQueWorkerName[] = "pdg.EvntLogQue";
+
+// handles to writer threads
+static HANDLE g_thrdLogWriter = NULL; // Var. that holds the child handle to the Log Writer thread
+static HANDLE g_thrdTxWriter = NULL; // Var. that holds the child handle to the Tx Writer thread
+
+/// Event_logger
+HANDLE g_thrdEvntLogWriter = NULL; // Var. that holds the child handle to the EVNTLOGGER Writer thread
+static TEvntWriterInfo Evntlog_wi = { };
+TUploadEventLogResp g_stUploadEventLogResp;
+
+// global variable to store the service status
+ELOGGERSERVICESTATUS g_eLoggerServiceStatus = eLSInit;
+
+// class to usb and reader threads
+LoggerserviceDebugChildThread g_loggerservicedebug_threads;
+
+/// Device Detection Class Instance
+DeviceDetectionServiceIf g_devDetect_t;
+
+CLoggerCfg g_loggerCfg;
+CErrorEvent g_errorEventHandler;
+CLoggerServiceCallbacks g_serviceCallbacks;
+CLoggerDeviceDetection g_deviceDetection;
+CReaderWriterControl g_ReaderWriterControl;
+CPFDRECThread g_PFDRECThread;
+
+/// Decide the function NormalStartupProcess execution
+static bool g_normal_startup_status = false;
+
+/// Callbacks for messages that will be received and processed by this module
+static EFrameworkunifiedStatus OnUsbEject(HANDLE hApp);
+
+static EFrameworkunifiedStatus OnUsbStoreLogs(HANDLE hApp);
+
+static EFrameworkunifiedStatus SMSessionAckCb(HANDLE hApp);
+
+/// Positive Response Call backs from child thread for statistical counter read
+static EFrameworkunifiedStatus cbStatisticalCounterSuccessResp(HANDLE hApp);
+
+/// Error Response Call backs from child thread for statistical counter read
+static EFrameworkunifiedStatus cbStatisticalCounterErrorResp(HANDLE hApp);
+
+/// Response Call backs from child thread for clear event logs
+static EFrameworkunifiedStatus cbClearEventLogsResponse(HANDLE hApp);
+
+/// Response Call backs from child thread for copying event logs to USB
+static EFrameworkunifiedStatus cbCopyEventLogsUSBResponse(HANDLE hApp);
+
+/// Response Call backs from child thread for Reading number of events logged
+static EFrameworkunifiedStatus cbReadNumbOfEventsResponse(HANDLE hApp);
+
+/// Response Call backs from child thread for Upload eventlog
+static EFrameworkunifiedStatus cbUploadEventLogResponse(HANDLE hApp);
+
+/// Notificatin from SystemManager when All Services wakeup completed
+static EFrameworkunifiedStatus cbServiceWakeupStatus(HANDLE hApp);
+
+
+/// generate SYS_ILG_LOG
+static EFrameworkunifiedStatus SysIllegalLogTimer_OnInterval(HANDLE hApp);
+
+
+/// Call back tables for response from event logger child thread
+FrameworkunifiedProtocolCallbackHandler evtLogChildThread_handler[] = { { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ eThrdCmdStatisticalCounterSuccessResp, cbStatisticalCounterSuccessResp }, {
+ eThrdCmdStatisticalCounterErrorResp, cbStatisticalCounterErrorResp }, {
+ eThrdCmdCopyEventLogUSBResponse, cbCopyEventLogsUSBResponse }, {
+ eThrdCmdClearEventLogResponse, cbClearEventLogsResponse }, {
+ eThrdCmdNumberOfEventsLoggedResponse, cbReadNumbOfEventsResponse }, {
+ eThrdCmdUploadEventLogResponse, cbUploadEventLogResponse } };
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnInitialization
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // 1. Register Srv Availability Notification
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hApp, NTFY_SS_LoggerService_Availability))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:0x%x ", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ // 2. Publish Service not available
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:%d ", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = g_loggerCfg.Initialize(hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_loggerCfg.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ std::string l_cfgFilePathAndName =
+ "/usr/agl/conf/BS/ss/logger_service/rodata/ss_logger.cfg";
+ if (eFrameworkunifiedStatusOK != (l_eStatus = g_loggerCfg.Load(l_cfgFilePathAndName))) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " Error. Failed to load SS_Logger configuration from %s with error: %d",
+ l_cfgFilePathAndName.c_str(), l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = g_loggerCfg.Validate())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Configuration validation failed with error: %d.",
+ l_eStatus);
+ }
+
+ g_loggerCfg.Print(); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ l_eStatus = g_deviceDetection.Initialize(hApp, &g_loggerCfg); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_deviceDetection.Initialize"); // LCOV_EXCL_BR_LINE 15: macro
+
+ l_eStatus = g_ReaderWriterControl.Initialize(&g_loggerCfg); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_ReaderWriterControl.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ if (NULL == (g_thrdEvntLogWriter = FrameworkunifiedCreateChildThreadWithPriority( hApp, g_strEvntLogQueWorkerName, EvntWriterWorkerOnStart, EvntWriterWorkerOnStop, frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(std::string(g_strEvntLogQueWorkerName))))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "FrameworkunifiedCreateChildThreadWithPriority Failed Status:0x%x for thread create of %s",
+ l_eStatus, g_strEvntLogQueWorkerName);
+ return (l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG( // LCOV_EXCL_BR_LINE 15: macro
+ ZONE_INFO,
+ __FUNCTION__,
+ "FrameworkunifiedCreateChildThreadWithPriority Success Status: for thread create of %s",
+ g_strEvntLogQueWorkerName); // LCOV_EXCL_BR_LINE 15: macro
+ }
+
+ l_eStatus = g_errorEventHandler.Initialize(hApp, &g_loggerCfg, // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ &g_ReaderWriterControl,
+ g_thrdEvntLogWriter,
+ g_strEvntLogQueWorkerName); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. g_errorEventHandler.Initialize() returned: %d.", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+ l_eStatus = g_serviceCallbacks.Initialize(hApp, &g_loggerCfg,
+ &g_errorEventHandler); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_serviceCallbacks.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ // Callback to Event log child Thread
+ l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hApp, g_strEvntLogQueWorkerName, evtLogChildThread_handler,
+ _countof(evtLogChildThread_handler)); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, // LCOV_EXCL_BR_LINE 15: macro
+ "Status of callback for child thread attach:%X", l_eStatus); // LCOV_EXCL_BR_LINE 15: macro
+
+ // setup call backs for my children
+ FrameworkunifiedAttachCallbackToDispatcher(hApp, AppName, eThrdCmdUsbEject, OnUsbEject); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ FrameworkunifiedAttachCallbackToDispatcher(hApp, AppName, eThrdCmdUsbStoreLogs,
+ OnUsbStoreLogs);
+
+ // Publications
+ FrameworkunifiedNotificationsList publish_notifs[] = {
+ // Notifications name,length, state
+ { NTFY_LOGGER_SETCONTROLMASK, sizeof(CHANGELOGPARAMS), eFrameworkunifiedStateVar } };
+
+ // Indicate to Notification Service what I will be Publishing!
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedNPRegisterNotifications(hApp, publish_notifs, _countof(publish_notifs)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedNPRegisterNotifications Failed Status:0x%x ", l_eStatus);
+ return (l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ /// Start the Writer threads
+ strncpy(Evntlog_wi.mileage_filename, Mileage_LOG_PATH_FN,
+ Evntlog_wi.FN_LEN - 1);
+ Evntlog_wi.mileage_filename[Evntlog_wi.FN_LEN - 1] = '\0';
+ strncpy(Evntlog_wi.base_cnt_filename, Counter_LOG_PATH_FN,
+ Evntlog_wi.FN_LEN - 1);
+ Evntlog_wi.base_cnt_filename[Evntlog_wi.FN_LEN - 1] = '\0';
+ Evntlog_wi.max_filelen = g_loggerCfg.m_logMaxFileSize;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(hApp, g_thrdEvntLogWriter, sizeof(Evntlog_wi), &Evntlog_wi))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "Fail to Start Writer Worker thread. Status:0x%x", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = RegisterSMSessionAckCallback(SMSessionAckCb); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "RegisterSMSessionAckCallback()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ l_eStatus = g_PFDRECThread.Initialize(hApp); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_PFDRECThread.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, TRUE))) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:0x%x ", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_SSServiceWakeupStatus, cbServiceWakeupStatus); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSubscribeNotificationWithCallback()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ // Set Service status to init
+ g_eLoggerServiceStatus = eLSInit;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+static void *accOffOnCollect(void* param) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SS_LoggerStoreLogs(SS_STORELOGS_ACCOFFON_PRESS);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return NULL;
+}
+
+// Normal startup process
+static EFrameworkunifiedStatus NormalStartupProcess(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (false == g_normal_startup_status) {
+ T_SS_SM_START_DataStructType prm;
+
+ l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &prm, sizeof(T_SS_SM_START_DataStructType), eSMRRetain);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Failed PasGetMsgDataOfSize() [%d]", l_eStatus);
+ }
+
+ if (prm.resetStatus == e_SS_SM_RESET_STATUS_NG) {
+ HANDLE timer =
+ FrameworkunifiedAttachTimerCallback(hApp, SYS_ILLEGAL_LOG_DELAY_TIME, 0, SysIllegalLogTimer_OnInterval);
+ if (timer == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, " Failed to register timer.");
+ }
+ }
+
+ if (0 == access("/tmp/accoffon", F_OK)) {
+ pthread_t threadAccOffOn;
+ pthread_create( &threadAccOffOn, NULL, accOffOnCollect, NULL);
+ }
+
+ if (g_eLoggerServiceStatus == eLSStop) {
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, TRUE))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:0x%x ",
+ l_eStatus);
+ }
+
+ // Start the Writer threads
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedStartChildThread(hApp, g_thrdEvntLogWriter,
+ sizeof(Evntlog_wi), &Evntlog_wi))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "Fail to Start Writer Worker thread. Status:0x%x", l_eStatus);
+ }
+ }
+ // Set Service status to init
+ g_eLoggerServiceStatus = eLSStart;
+
+ // Set normal_startup_status flag (true)
+ g_normal_startup_status = true;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = NormalStartupProcess(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = NormalStartupProcess(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = NormalStartupProcess(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus SysIllegalLogTimer_OnInterval(HANDLE hApp) { // LCOV_EXCL_START 200: There is no SUBCP_STS_COMNG case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = SS_LoggerStoreLogs(SS_STORELOGS_SYS_ILLEGAL);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, " Failed SS_LoggerStoreLogs()");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ /*Get stop factor form hApp*/
+ T_SS_SM_STOP_DataStructType errorType;
+
+ // LCOV_EXCL_BR_START 4: NSFW error
+ if (eFrameworkunifiedStatusOK
+ != FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID) &errorType, sizeof(errorType),
+ eSMRRelease)) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ " FrameworkunifiedGetMsgDataOfSize failed with error");
+ // LCOV_EXCL_STOP
+ } else {
+ EFrameworkunifiedStatus loggerserviceRet = SS_LoggerStoreLogs(SS_STORELOGS_INTERFACEUNIFIEDLOG);
+ LOG_STATUS_IF_ERRORED(loggerserviceRet, "Fail to save Loggerservice Log");
+ EFrameworkunifiedStatus naviLog_status = g_errorEventHandler.SaveNaviLog(
+ errorType.shutdownTrigger);
+ LOG_STATUS_IF_ERRORED(naviLog_status, "Fail to save Navi Log");
+ }
+ StopLoggingFunction(hApp);
+
+ if (g_eLoggerServiceStatus == eLSStart) { // LCOV_EXCL_BR_LINE 200: g_eLoggerServiceStatus must be eLSStart on ACC-OFF
+ LoggerService_OnStop(hApp);
+ }
+
+ // Set normal_startup_status flag (false)
+ g_normal_startup_status = false;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * EFrameworkunifiedStatus LoggerService_OnStop(HANDLE hApp)
+ * @brief Logger Stop is called on Shutdown complete cmd
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus LoggerService_OnStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Set Service status to init
+ g_eLoggerServiceStatus = eLSStop;
+
+ /// Start the Writer threads
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStopChildThread(hApp, g_thrdEvntLogWriter, sizeof(Evntlog_wi), &Evntlog_wi))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "Fail to Start Writer Worker thread. Status:0x%x", l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "Successful in Sending Stop to ChildThread");
+ }
+
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:0x%x ", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus SMSessionAckCb(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ HANDLE l_hSession;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: macro
+
+ l_hSession = FrameworkunifiedGetOpenSessionHandle(hApp);
+
+ if (NULL == l_hSession) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " Error. FrameworkunifiedGetSessionHandle() returned a NULL session handle. "
+ "Error events originating from System Manager will not be detected.");
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = FrameworkunifiedSetSessionHandle(hApp, FrameworkunifiedGetMsgSrc(hApp), l_hSession);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSessionHandle()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ l_eStatus = g_errorEventHandler.RegisterSessionErrorEvent(l_hSession);
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: macro
+ "g_errorEventHandler.RegisterSessionErrorEvent()");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnWakeup(HANDLE hApp) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnShutdown
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE hApp) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnEShutdown
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE hApp) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnDebugDump
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// HACK! mb20100701
+/// \todo Add behavior to this function
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) { // LCOV_EXCL_START 14:For process termination processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusNotImplemented;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus OnUsbEject(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ if (g_loggerservicedebug_threads.Running(
+ LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript)) {
+ g_loggerservicedebug_threads.Stop(LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript);
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Stopped Thread: %s",
+ g_loggerservicedebug_threads.Name(
+ LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus OnUsbStoreLogs(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ TThrdCaptureLogsEvt evt = { };
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &evt, sizeof(evt)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize Failed Status:0x%x ",
+ l_eStatus);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return l_eStatus;
+ }
+
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdLogWriter, eThrdCmdWriterStop, 0, NULL);
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdTxWriter, eThrdCmdWriterStop, 0, NULL);
+
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdLogWriter, eThrdCmdWriteFilesToUsb,
+ sizeof(evt), &evt);
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdTxWriter, eThrdCmdWriteFilesToUsb,
+ sizeof(evt), &evt);
+
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdLogWriter, eThrdCmdWriterResume, 0,
+ NULL);
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdTxWriter, eThrdCmdWriterResume, 0, NULL);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :cbStatisticalCounterPosResponse
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbStatisticalCounterSuccessResp(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ TStatisticalCntCmdSuccessResp l_stCmdSuccessResp;
+ SS_loggerserviceprotocol l_eResponseCmd;
+ HANDLE l_hSession = NULL;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TStatisticalCntCmdSuccessResp>(hApp,
+ l_stCmdSuccessResp))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (NULL
+ != (l_hSession = FrameworkunifiedGetSessionHandle(
+ hApp, l_stCmdSuccessResp.stSessiondata.strSrcName.c_str(),
+ l_stCmdSuccessResp.stSessiondata.session_id))) {
+ l_eResponseCmd = SS_LOGGER_READ_STATL_COUNTER_SUCCESS_RESP;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hSession, l_eResponseCmd,
+ sizeof(SStatisticalCounter),
+ &l_stCmdSuccessResp.stBuffer))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :cbStatisticalCounterErrResponse
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbStatisticalCounterErrorResp(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ TSessionData l_stSessiondata;
+ SS_loggerserviceprotocol l_eResponseCmd;
+ HANDLE l_hSession = NULL;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TSessionData>(hApp, l_stSessiondata))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (NULL
+ != (l_hSession = FrameworkunifiedGetSessionHandle(hApp,
+ l_stSessiondata.strSrcName.c_str(),
+ l_stSessiondata.session_id))) {
+ l_eResponseCmd = SS_LOGGER_READ_STATL_COUNTER_ERROR_RESP;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hSession, l_eResponseCmd, 0x00, NULL))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :cbClearEventLogsResponse
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbClearEventLogsResponse(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TClearEvntLogCmdResponse l_stCmdResponse;
+ HANDLE l_hSession = NULL;
+ SS_loggerserviceprotocol l_eResponseCmd;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TClearEvntLogCmdResponse>(hApp, l_stCmdResponse))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (NULL
+ != (l_hSession = FrameworkunifiedGetSessionHandle(
+ hApp, l_stCmdResponse.stSessiondata.strSrcName.c_str(),
+ l_stCmdResponse.stSessiondata.session_id))) {
+ if (l_stCmdResponse.u8Response == (UI_8) CLEAR_EVENT_LOG_SUCCESS) {
+ l_eResponseCmd = SS_LOGGERCLEAREVENT_SUCCESS_RESP;
+ } else {
+ l_eResponseCmd = SS_LOGGERCLEAREVENT_ERROR_RESP;
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hSession, l_eResponseCmd, 0x00, NULL))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :cbCopyEventLogsUSBResponse
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbCopyEventLogsUSBResponse(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TWriteFilesToUsbCmdResponse l_stCmdResponse;
+ HANDLE l_hSession = NULL;
+ SS_loggerserviceprotocol l_eResponseCmd;
+ EEvtLoggerErrorCode l_eResponseCode;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TWriteFilesToUsbCmdResponse>(hApp,
+ l_stCmdResponse))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (NULL
+ != (l_hSession = FrameworkunifiedGetSessionHandle(
+ hApp, l_stCmdResponse.stSessiondata.strSrcName.c_str(),
+ l_stCmdResponse.stSessiondata.session_id))) {
+ if (l_stCmdResponse.u8Response == (UI_8) COPY_EVT_USB_SUCCESS) {
+ l_eResponseCmd = SS_LOGGERCOPYEVENTUSB_SUCCESS_RESP;
+ l_eResponseCode = NO_ERROR_INFO;
+ } else {
+ l_eResponseCmd = SS_LOGGERCOPYEVENTUSB_ERROR_RESP;
+ l_eResponseCode = (EEvtLoggerErrorCode) l_stCmdResponse.u8Response;
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hSession, l_eResponseCmd,
+ sizeof(EEvtLoggerErrorCode),
+ &l_eResponseCode))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbReadNumbOfEventsResponse(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_16 l_NumOfEvents = 0;
+ TEvntsLogged l_stNumberOfEvtsLogged;
+ HANDLE l_hsession = NULL;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TEvntsLogged>(hApp, l_stNumberOfEvtsLogged))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ l_NumOfEvents = l_stNumberOfEvtsLogged.u16numberofeventslogged;
+ if (NULL
+ != (l_hsession = FrameworkunifiedGetSessionHandle(
+ hApp, l_stNumberOfEvtsLogged.stSessiondata.strSrcName.c_str(),
+ l_stNumberOfEvtsLogged.stSessiondata.session_id))) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hsession,
+ SS_LOGGER_ENG_READ_NUMOFEVENTS_RESP,
+ sizeof(UI_16), &l_NumOfEvents))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbUploadEventLogResponse(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ HANDLE l_hsession = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "UploadEventLog Response Msg Len = %d",
+ FrameworkunifiedGetMsgLength(hApp));
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TUploadEventLogResp>(hApp, g_stUploadEventLogResp))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (NULL
+ != (l_hsession = FrameworkunifiedGetSessionHandle(
+ hApp, g_stUploadEventLogResp.stSessiondata.strSrcName.c_str(),
+ g_stUploadEventLogResp.stSessiondata.session_id))) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hsession, SS_LOGGER_UPLOAD_EVENTLOG_RESP,
+ sizeof(STEventLogPersistBuffer),
+ &g_stUploadEventLogResp.stEventLogBuffer))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus cbServiceWakeupStatus(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = g_errorEventHandler.CreateKernelLog(hApp,
+ SS_LOGGER_KBOOTLOG_CREATE);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "CreateKernelLog(SS_LOGGER_KBOOTLOG_CREATE)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+void StopLoggingFunction(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // PFDRECThread Stop
+ EFrameworkunifiedStatus l_eStatus = g_PFDRECThread.Finalize(hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_PFDRECThread.Finalize()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
diff --git a/systemservice/logger_service/server/src/loggerservice_main.cpp b/systemservice/logger_service/server/src/loggerservice_main.cpp
new file mode 100755
index 0000000..a7ee212
--- /dev/null
+++ b/systemservice/logger_service/server/src/loggerservice_main.cpp
@@ -0,0 +1,59 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief Application entry point.
+///
+///////////////////////////////////////////////////////////////////////////////
+// System Headers
+#include <pthread.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_application.h>
+#include <system_service/ss_system_if.h>
+#include <loggerservicedebug_loggerservicelog.h>
+#include <system_service/ss_version.h>
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_services.h>
+#include <cstdlib>
+#include <iostream>
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { FRAMEWORKUNIFIEDLOGOPTIONS, {
+ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ZONE_TEXT_31 }, FRAMEWORKUNIFIEDLOGZONES };
+
+const CHAR AppName[] = SERVICE_LOGGER;
+
+//////////////////////////////////////////
+// Function : main
+//////////////////////////////////////////
+int main(int argc, char *argv[]) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cbFuncs); // LCOV_EXCL_BR_LINE 15: macro
+ FRAMEWORKUNIFIED_SET_ZONES(); // LCOV_EXCL_BR_LINE 15: macro
+
+ eStatus = FrameworkunifiedDispatcherWithArguments(AppName, argc, argv, &cbFuncs); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ return eStatus;
+} // LCOV_EXCL_BR_LINE 10:the last line
diff --git a/systemservice/logger_service/server/src/loggerservicedebug_child_thread.cpp b/systemservice/logger_service/server/src/loggerservicedebug_child_thread.cpp
new file mode 100755
index 0000000..4a8668f
--- /dev/null
+++ b/systemservice/logger_service/server/src/loggerservicedebug_child_thread.cpp
@@ -0,0 +1,134 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief Class that threads for usb, and readers use to AGL and get
+/// information from the parent.
+///
+///////////////////////////////////////////////////////////////////////////////
+// System Headers
+#include <loggerservicedebug_thread_if.h>
+#include <new>
+
+const CHAR g_strLogQueReaderWorkerName[] = "pdg.LogQueR";
+const CHAR g_strTransmitQueReaderWorkerName[] = "pdg.TransQueR";
+const CHAR g_strPerformanceQueReaderWorkerName[] = "pdg.PerformQueR";
+const CHAR g_strUsbEjectWorkerName[] = "pdg.UsbEject";
+const CHAR g_strUsbLogCaptureWorkerName[] = "pdg.UsbLogCapt";
+const CHAR g_strCaptureLogScriptExeName[] = "pdg.CaptLogScri";
+
+LoggerserviceDebugChildThread::LoggerserviceDebugChildThread() {
+ names[LoggerserviceDebugChildThread::kLoggerserviceDebugLogQueReader] =
+ g_strLogQueReaderWorkerName;
+ names[LoggerserviceDebugChildThread::kLoggerserviceDebugTransmitQueReader] =
+ g_strTransmitQueReaderWorkerName;
+ names[LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript] =
+ g_strCaptureLogScriptExeName;
+ names[LoggerserviceDebugChildThread::kLoggerservicePerformanceLogQueReader] =
+ g_strPerformanceQueReaderWorkerName;
+
+ threads[LoggerserviceDebugChildThread::kLoggerserviceDebugLogQueReader] = NULL;
+ threads[LoggerserviceDebugChildThread::kLoggerserviceDebugTransmitQueReader] = NULL;
+ threads[LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript] = NULL;
+ threads[LoggerserviceDebugChildThread::kLoggerservicePerformanceLogQueReader] = NULL;
+} // LCOV_EXCL_BR_LINE 10:the last line
+
+LoggerserviceDebugChildThread::~LoggerserviceDebugChildThread() { // LCOV_EXCL_START 14:global instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+BOOL LoggerserviceDebugChildThread::Start(ELoggerserviceDebugThreads id, const char* parentsName,
+ const char * sendDataToQue,
+ void* (*routine)(void*),
+ const char * sendToUdpQue) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL rtn = FALSE;
+ if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
+ if (threads[id] == NULL) {
+ if ( NULL
+ != (threads[id] = new (std::nothrow) CChild(parentsName,
+ sendDataToQue,
+ names[id].c_str(),
+ routine, sendToUdpQue))) {
+ rtn = TRUE;
+ }
+ } else {
+ rtn = TRUE;
+ }
+ }
+
+ return rtn;
+}
+// LCOV_EXCL_STOP
+
+void LoggerserviceDebugChildThread::Stop(ELoggerserviceDebugThreads id) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
+ if (threads[id] != NULL) {
+ delete threads[id];
+ threads[id] = NULL;
+ }
+ }
+}
+// LCOV_EXCL_STOP
+
+BOOL LoggerserviceDebugChildThread::Running(ELoggerserviceDebugThreads id) const { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL rtn = FALSE;
+ if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
+ if (threads[id] != NULL) {
+ rtn = TRUE;
+ }
+ }
+
+ return rtn;
+}
+// LCOV_EXCL_STOP
+
+void LoggerserviceDebugChildThread::StopAll() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ for (int id = kLoggerserviceDebugLogQueReader; id < kLoggerserviceDebugMax; id++) {
+ if (threads[id] != NULL) {
+ threads[id]->Join();
+ delete threads[id];
+ threads[id] = NULL;
+ }
+ }
+}
+// LCOV_EXCL_STOP
+
+const char * LoggerserviceDebugChildThread::Name(ELoggerserviceDebugThreads id) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
+ return names[id].c_str();
+ }
+
+ return NULL;
+}
+// LCOV_EXCL_STOP
+
+void LoggerserviceDebugChildThread::LiftWaitBarrier(ELoggerserviceDebugThreads id) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
+ if (threads[id] != NULL) {
+ threads[id]->IsValidWaitBarrier();
+ }
+ }
+}
+// LCOV_EXCL_STOP
+
diff --git a/systemservice/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp b/systemservice/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp
new file mode 100755
index 0000000..5d29a58
--- /dev/null
+++ b/systemservice/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp
@@ -0,0 +1,1362 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_LogTraceSender
+/// \brief frameworkunifieddebug writer thread class, handles writing a log file
+/// all really done by my_writer class.
+///
+///////////////////////////////////////////////////////////////////////////////
+// System Headers
+#include "loggerservicedebug_writer_Evntworker.h"
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/timeb.h>
+#include <boost/bind.hpp>
+#include <errno.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_timer.h>
+#include <loggerservicedebug_thread_if.h>
+#include <loggerservicedebug_loggerservicelog.h>
+#include <system_service/ss_logger_service_notifications.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_templates.h>
+#include <stub/Clock_API.h>
+#include <new>
+#include <utility>
+#include <string>
+
+/// Macros definition for the constants
+#define SIZE_0 (size_t)0
+#define SIZE_1 (size_t)1
+#define COUNTER_SIZE 6 ///< Counter ID 2 bytes and Counter Value is 4 bytes
+#define SINGLE_EVENT_INFO_SIZE 10 ///< Event log size
+#define INITIAL_CNT_VALUE 0x00000001 ///< Init count value for counter logging
+#define MAX_CNT_VALUE 0xFFFFFFFF ///< Max count calue for counter logging
+#define MAX_USB_DEVICE 2 ///< Max USB devices
+
+// Temp path for event logs that used for copying to USB
+const CHAR TMP_DEBUG_EVNTLOG_PATH_FN[] = "/tmp/loggerservice_Evntdebug.dat";
+
+// Structure to hold the USB device information
+TThrdEvtLogStore gSUSBDevInfo[MAX_USB_DEVICE] = { };
+
+// Structure to hold the SD card device information
+TThrdEvtLogStore gSSDCardevInfo = { };
+
+// Object for device detection class
+DeviceDetectionServiceIf m_device_detector_obj;
+
+// Map container for startup phase counter
+CounterInformation CEvntWriterWorker::counter;
+
+// Deque container for event logging
+DEQUE_Event_Type CEvntWriterWorker::deque_event_info;
+
+static CEvntWriterWorker * pObj = new (std::nothrow) CEvntWriterWorker(); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+static TEvntWriterInfo wi = { };
+
+// Event Common Info global structure
+extern UEvtLoggerCommonInfo g_uEvtLoggerCommonInfo;
+extern UI_16 g_u16DiagId;
+static EFrameworkunifiedStatus ReadEventLogQueue(HANDLE hThread);
+// created global variables as they are used in non member function
+HANDLE g_hReceive = NULL;
+HANDLE g_hEvtLogTimer = NULL;
+
+CEvntWriterWorker::CEvntWriterWorker()
+ : m_u32MileageData(0),
+ m_u32NumberEventsLogged(0) {
+ memset(m_stVINnumber.VINstr, 0, m_stVINnumber.VIN_LEN);
+}
+
+CEvntWriterWorker::~CEvntWriterWorker() { // LCOV_EXCL_START 14:global instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CEvntWriterWorker::Initialize(HANDLE hThread) {
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :EventLogRegisterCbHandlers
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::EventLogRegisterCbHandlers(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FrameworkunifiedProtocolCallbackHandler aParentHandlers[] = { {
+ eThrdCmdWriteEvntFilesToUsb, boost::bind(
+ &CEvntWriterWorker::OnCmdWriteEventFilesToUsb, this, _1) }, {
+ eThrdCmdClearEvntLogs, boost::bind(
+ &CEvntWriterWorker::OnCmdClearEventLogs, this, _1) }, {
+ eThrdCmdStatisticalCounter, boost::bind(
+ &CEvntWriterWorker::OnCmdReadStatisticalCounter, this, _1) }, {
+ eThrdCmdResetStatisticalCntrs, boost::bind(
+ &CEvntWriterWorker::OnCmdResetStatisticalCounter, this, _1) }, {
+ eThrdCmdSetVINnumber, boost::bind(&CEvntWriterWorker::OnCmdSetVIN, this,
+ _1) }, { eThrdCmdImmPersistEvtLog,
+ boost::bind(&CEvntWriterWorker::immediate_persist_event_log, this, _1) },
+ { eThrdCmdMileageData, boost::bind(&CEvntWriterWorker::EvtThd_SetMileage,
+ this, _1) }, {
+ eThrdCmdGetNumberOfEventsLogged, boost::bind(
+ &CEvntWriterWorker::OnCmdReadNumberOfEventsLogged, this, _1) }, {
+ eThrdCmdUploadEventLog, boost::bind(
+ &CEvntWriterWorker::OnCmdUploadEventLog, this, _1) } };
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedAttachParentCallbacksToDispatcher(
+ hThread, aParentHandlers, _countof(aParentHandlers)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: parent call backs attach failed , err code: %d", l_eStatus);
+ }
+
+ // TO DO replace the queue name with macro EVENTLOG_MSGQ_NAME, after NS delivers it.
+ if (NULL != (g_hReceive = McOpenReceiverNotBlocked("/EvntLogQue"))) {
+ if (NULL
+ == (g_hEvtLogTimer = FrameworkunifiedAttachTimerCallback(hThread, 100, 1000,
+ ReadEventLogQueue))) {
+ LOG_ERROR("FrameworkunifiedAttachTimerCallback()");
+ }
+ } else {
+ LOG_ERROR("McOpenReceiverNotBlocked");
+ }
+
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus ReadEventLogQueue(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ CHAR source[MAX_QUEUE_NAME_SIZE];
+ UI_32 l_cmd = 0;
+ UI_8 pbuf[MAX_QUEUE_MSG_SIZE];
+
+ if (NULL != g_hReceive) { // LCOV_EXCL_BR_LINE 6: g_hReceive is always null
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ while (1) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = McReceive(g_hReceive, source, &l_cmd,
+ MAX_QUEUE_MSG_SIZE,
+ pbuf))) {
+ break;
+ } else {
+ switch (l_cmd) {
+ case SS_MSG_EVTLOG:
+ if (pObj) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = pObj->OnCmdEventLog(pbuf))) {
+ LOG_ERROR("OnCmdEventLog()");
+ }
+ } else {
+ LOG_ERROR("pObj NULL");
+ }
+ break;
+
+ case SS_MSG_LOGGERCNT:
+ if (pObj) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = pObj->OnCmdIncrcount(pbuf))) {
+ LOG_ERROR("OnCmdIncrcount()");
+ }
+ } else {
+ LOG_ERROR("pObj NULL");
+ }
+ break;
+
+ case SS_MSG_LOGGER_CNT_EVTLOG:
+ if (pObj) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = pObj->OnCmdIncrwriteevent(pbuf))) {
+ LOG_ERROR("OnCmdIncrwriteevent()");
+ }
+ } else {
+ LOG_ERROR("pObj NULL");
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ LOG_ERROR("Receive Handle NULL"); // LCOV_EXCL_BR_LINE 15:macro
+ }
+
+ if (eFrameworkunifiedStatusErrNoEAGAIN == l_eStatus) { // LCOV_EXCL_BR_LINE 6: l_eStatus is always eFrameworkunifiedStatusOK
+ l_eStatus = eFrameworkunifiedStatusOK; // LCOV_EXCL_LINE 6: l_eStatus is always eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////
+/// Function :EvntWriterWorkerOnStart
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus EvntWriterWorkerOnStart(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hThread, (PVOID) &wi, sizeof(wi), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Unable to read handle from FrameWork Thread.%d", eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Successfully read handle from FrameWork Thread.\n"); // LCOV_EXCL_BR_LINE 15:macro
+ }
+
+ // Device Detection Obj initialization
+ if (m_device_detector_obj.Initialize(hThread)) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ memset(&gSUSBDevInfo, 0, sizeof(gSUSBDevInfo));
+ memset(&gSSDCardevInfo, 0, sizeof(gSSDCardevInfo));
+
+ if (eFrameworkunifiedStatusOK != (eStatus = m_device_detector_obj.NotifyOnDeviceDetectionAvailability( DD_USBServiceAvailabilityCallBack))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: ServiceAvailabilityCallback registration failed");
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = m_device_detector_obj.NotifyOnOpenSessionAck( DD_USBOpenSessionAckCallBack))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: OpenSessionAckCallback registration failed");
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = m_device_detector_obj.NotifyOnCloseSessionAck( DD_USBCloseSessionAckCallBack))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: CloseSessionCallback registration failed");
+ }
+ } else {
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Device Detection Object Initialization failed!");
+ // LCOV_EXCL_STOP
+ }
+
+ if (pObj) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ FrameworkunifiedSetThreadSpecificData(hThread, pObj);
+ if (eFrameworkunifiedStatusOK != (eStatus = pObj->Initialize(hThread))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: CEvntWriterWorker Initialize Failed");
+ }
+ } else {
+ // LCOV_EXCL_START 200:As it is always TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pObj is NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :EvntWriterWorkerOnStop
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus EvntWriterWorkerOnStop(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ if (pObj) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ if (NULL != g_hEvtLogTimer) { // LCOV_EXCL_BR_LINE 200:As it is always NULL
+ // LCOV_EXCL_START 200:As it is always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CALL_AND_LOG_STATUS(FrameworkunifiedDetachTimerCallback(hThread, g_hEvtLogTimer));
+ g_hEvtLogTimer = NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ /// To Read all msgs of EventLog queue on shutdown
+ CALL_AND_LOG_STATUS(ReadEventLogQueue(hThread)); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ /// Close ReadEventLog Queue receive handle
+ if (NULL != g_hReceive) { // LCOV_EXCL_BR_LINE 200:As it is always NULL
+ // LCOV_EXCL_START 200:As it is always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CALL_AND_LOG_STATUS(McClose(g_hReceive));
+ g_hReceive = NULL;
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdIncrcount_phase
+///////////////////////////////////////////////////////////////////////
+VOID CEvntWriterWorker::OnCmdIncrcount_phase(st_LogCount *cnt) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ if (NULL != cnt) {
+ EStatCounterGroupID group;
+ UI_16 counterID = ((*cnt).cnt_id);
+ group = static_cast<EStatCounterGroupID>((counterID >> 8) & 0x00FF);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "Increment counter(%04X) for group(%02X) by one", counterID, group);
+ counterIncrementByValue(group, counterID, 0x01u);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "Function call without parameter");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdIncrcount
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdIncrcount(UI_8 *pbuf) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ st_LogCount cnt;
+
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = McGetDataOfSize(pbuf, (PVOID) &cnt, sizeof(cnt)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "call increment function cnt.phase=%x,cnt.ID=%x", cnt.phase,
+ cnt.cnt_id);
+ OnCmdIncrcount_phase(&cnt);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "Not recieved data from q");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdIncrwriteevent
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdIncrwriteevent(UI_8* pbuf) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ st_LogEvent EC;
+ st_LogEvent_ss ev = { };
+ st_LogCount C;
+
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = McGetDataOfSize(pbuf, (PVOID) &EC, sizeof(EC)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "Successful increment");
+ ev.event_id = EC.event_id;
+ ev.data[0] = EC.data[0];
+ ev.data[1] = EC.data[1];
+ ev.data[2] = EC.data[2];
+ ev.data[3] = EC.data[3];
+ OnCmdWriteEventLogs(&ev);
+ C.phase = (SystemPhase) (EC.phase);
+ C.cnt_id = EC.cnt_ID;
+ OnCmdIncrcount_phase(&C);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "Not recieved data from q");
+ }
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdWriteEventLogs
+///////////////////////////////////////////////////////////////////////
+VOID CEvntWriterWorker::OnCmdWriteEventLogs(st_LogEvent_ss *ev) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ UI_32 u32deque_size = 0;
+ u32deque_size = static_cast<UI_32>(deque_event_info.size());
+ u32deque_size = u32deque_size * SINGLE_EVENT_INFO_SIZE; // Existing Event Info size
+ u32deque_size += SINGLE_EVENT_INFO_SIZE;
+ // FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Deque size before write:%X ",u32deque_size);
+
+ if (u32deque_size > MAX_EVENTLOG_SIZE) {
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Deque size will be exceeded after new event:%X ",u32deque_size);
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Removed the oldest event and add latest event in the the end");
+ deque_event_info.pop_front();
+ u32deque_size = static_cast<UI_32>(deque_event_info.size());
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Deque size after pop:%X ",(u32deque_size*SINGLE_EVENT_INFO_SIZE));
+ }
+ deque_event_info.push_back(*ev);
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Deque size after write:%X ",
+// (deque_event_info.size()*SINGLE_EVENT_INFO_SIZE));
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+UI_32 LS_ConvertEndian(UI_32 * pvar) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ UI_32 retVal = (UI_32) 0;
+ UI_32 var = *pvar;
+ retVal = (((var & 0xFF000000) >> 24) | ((var & 0x00FF0000) >> 8)
+ | ((var & 0x0000FF00) << 8) | ((var & 0x000000FF) << 24));
+ return (retVal);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdEventLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdEventLog(UI_8* pbuf) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ st_LogEvent_ss ev = { };
+ st_LogEvent_full ev_full = { };
+ UI_32 l_mileage;
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = McGetDataOfSize(pbuf, &ev_full, sizeof(ev_full)))) {
+ if (0 != ev_full.grp_ID) {
+ if (0x01 == ev_full.grp_ID) {
+ // copied to local var as m_u32MileageData value is persisted
+ l_mileage = m_u32MileageData;
+ ev.ts = LS_ConvertEndian(&l_mileage);
+ } else {
+ ev.ts = ev_full.ts;
+ }
+ ev.grp_ID = ev_full.grp_ID;
+ ev.event_id = ev_full.event_id;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "TS %u, GRPID %d, EVTID %d", ev.ts,
+ ev.grp_ID, ev.event_id);
+ // FRAMEWORKUNIFIEDLOG_EVT(Zone,EventId,4,data0,data1,data2,data3)
+ // Data in tool should be represented in Little Endian format means data3(MSB)..data0(LSB)
+ // In the COMMON_DATA, 1st element of structure u_stEvtLoggerCommonInfo is stored in the CommonData[0],
+ // ie BodayCAN_Stat,
+ // in the data array, byte0=>MSB, byte3=>LSB in the tool
+ if (ev_full.typeofdata == COMMON_DATA) {
+ for (UI_8 j = 0; j < 3; j++) {
+ ev.data[j] = g_uEvtLoggerCommonInfo.CommonData[j];
+ }
+ // byte0 param
+ ev.data[3] = ev_full.data[0];
+ } else {
+ // in array data[0] => MSB in tool, data[3] => LSB in the tool
+ for (UI_8 i = 4, j = 0; i > 0 && j < 4; i--, j++) {
+ ev.data[i - 1] = ev_full.data[j];
+ }
+ }
+ OnCmdWriteEventLogs(&ev);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Invalid event");
+ }
+ }
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdStop
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdStop(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdStart(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :read_count_from_file
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::readCountFromFile(PCSTR filename) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_32 counter_ID = 0;
+ UI_32 counter_val = 0;
+ FILE* fp;
+ if (filename != NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Open counter file:%s", filename);
+ if (NULL != (fp = ::fopen(filename, "r"))) {
+ while (!feof(fp)) {
+ EStatCounterGroupID group;
+ UI_8 groupID;
+ UI_8 count = static_cast<UI_8>(::fscanf(fp, "%04X%08X", &counter_ID, &counter_val));
+ groupID = (counter_ID >> 8) & 0xFF;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Read: 0x%04X 0x%08X", counter_ID,
+ counter_val);
+ if ((count == 2u)
+ && (groupID >= static_cast<UI_8>(STARTUP_SHUTDOWN_COUNTER_GROUP))
+ && (groupID <= static_cast<UI_8>(APP_USAGE_COUNTER_GROUP))) {
+ // Check if group is valid before casting it o EStatCounterGroup
+ group = static_cast<EStatCounterGroupID>(groupID);
+ counterIncrementByValue(group, static_cast<UI_16>(counter_ID), counter_val);
+ }
+ }
+ ::fclose(fp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Normal File failed to open");
+ eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Filename is NULL-pointer");
+ eStatus = eFrameworkunifiedStatusAccessError;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus CEvntWriterWorker::writeGroupToFile(FILE *fp,
+ EStatCounterGroupID group) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (fp != NULL) {
+ CounterInformation::iterator countInfIt = counter.find(group);
+ if (countInfIt != counter.end()) {
+ Counter count = countInfIt->second;
+ if (!count.empty()) {
+ Counter::iterator countIt;
+ for (countIt = count.begin(); countIt != count.end(); ++countIt) {
+ ::fprintf(fp, "%04X%08X\n", countIt->first, countIt->second);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Written %d entries for Group 0x%02X",
+ (UI_8)count.size(), (UI_8)group);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Group 0x%02X is empty", (UI_8)group);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Group not found in map");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Parameter fp is NULL-pointer");
+ eStatus = eFrameworkunifiedStatusAccessError;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :writeCountToFile
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::writeCountToFile(PCSTR filename) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FILE *fp;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CounterInformation::iterator countInfIt;
+ if (0 == strcmp(filename, Counter_LOG_PATH_FN)) {
+ if (NULL != (fp = ::fopen(filename, "w"))) {
+ for (countInfIt = counter.begin(); countInfIt != counter.end();
+ ++countInfIt) {
+ (void) writeGroupToFile(fp, countInfIt->first);
+ }
+ ::fclose(fp);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Not valid file");
+ eStatus = eFrameworkunifiedStatusErrNoEBADF;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :read_events_from_buffer
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+VOID CEvntWriterWorker::read_events_from_buffer(
+ STEventLogPersistBuffer* f_pstEvtLogBuf) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ deque_event_info.clear();
+ for (int i = 0; i < (f_pstEvtLogBuf->Current_Log_Size); i++) {
+ if (i < f_pstEvtLogBuf->EVT_BUFMAXSIZE) {
+ deque_event_info.push_back(f_pstEvtLogBuf->EvtLog_Buffer[i]);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: EventLog buffer size greater than EVT_BUFMAXSIZE");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Size of DEQUE event is :%d",
+ static_cast<int>(deque_event_info.size()));
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :write_events_to_buffer
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+VOID CEvntWriterWorker::write_events_to_buffer(
+ STEventLogPersistBuffer* f_pstEvtLogBuf) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ st_LogEvent_ss l_event_info;
+ DEQUE_Event_Type::iterator deque_it;
+ deque_it = deque_event_info.begin();
+ int i = 0;
+
+ memset(f_pstEvtLogBuf, 0x00, sizeof(STEventLogPersistBuffer));
+ while (deque_it != deque_event_info.end()) {
+ if (0x00 != deque_it->grp_ID) {
+ l_event_info.ts = deque_it->ts;
+ l_event_info.grp_ID = deque_it->grp_ID;
+ l_event_info.event_id = deque_it->event_id;
+ memcpy(l_event_info.data, deque_it->data, sizeof(l_event_info.data));
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Event record is:%X ",++EventRecordCnt);
+ if (i < f_pstEvtLogBuf->EVT_BUFMAXSIZE) {
+ memcpy(&f_pstEvtLogBuf->EvtLog_Buffer[i], &l_event_info,
+ sizeof(l_event_info));
+ }
+ }
+ deque_it++;
+ i++;
+ }
+ f_pstEvtLogBuf->Current_Log_Size = static_cast<UI_16>(deque_event_info.size());
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Size of DEQUE event is :%d",
+ static_cast<int>(deque_event_info.size()));
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :write_event_to_file
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::write_event_to_file(const CHAR* filename) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_32 u32File_Size;
+ st_LogEvent_ss Sevent_Info;
+ DEQUE_Event_Type::iterator deque_it;
+ FILE *fp;
+
+ if (NULL != (fp = ::fopen(filename, "wb"))) {
+ deque_it = deque_event_info.begin();
+ while (deque_it != deque_event_info.end()) {
+ Sevent_Info.ts = deque_it->ts;
+ Sevent_Info.grp_ID = deque_it->grp_ID;
+ Sevent_Info.event_id = deque_it->event_id;
+ memcpy(Sevent_Info.data, deque_it->data, sizeof(Sevent_Info.data));
+
+ if (0x00 != deque_it->grp_ID) {
+ if (SIZE_1
+ != (u32File_Size = static_cast<UI_32>(::fwrite(&Sevent_Info, sizeof(Sevent_Info), 1,
+ fp)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Writing in to file is failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ }
+ deque_it++;
+ }
+ ::fclose(fp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: File failed to open");
+ eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdClearEventLogs
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdClearEventLogs(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSessionData l_stSessionData;
+ TClearEvntLogCmdResponse l_stCmdResponse;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TSessionData>(hThread,
+ l_stCmdResponse.stSessiondata))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ deque_event_info.clear();
+ if (eFrameworkunifiedStatusOK != (l_eStatus = immediate_persist_event_log(hThread))) {
+ l_stCmdResponse.u8Response = (UI_8) CLEAR_EVENT_LOG_FAILED;
+ } else {
+ l_stCmdResponse.u8Response = (UI_8) CLEAR_EVENT_LOG_SUCCESS;
+ }
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread, eThrdCmdClearEventLogResponse,
+ sizeof(TClearEvntLogCmdResponse),
+ &l_stCmdResponse))) {
+ LOG_ERROR("FrameworkunifiedSendParent()");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP 8
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdSetVIN
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdSetVIN(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ STVIN_NUMBER l_stVIN_Number;
+
+ if (eFrameworkunifiedStatusOK
+ == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hThread, &l_stVIN_Number,
+ sizeof(l_stVIN_Number), eSMRRelease))) {
+ memcpy(&m_stVINnumber, &l_stVIN_Number, sizeof(STVIN_NUMBER));
+ }
+
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdGetVIN
+///////////////////////////////////////////////////////////////////////
+VOID CEvntWriterWorker::OnCmdGetVIN(STVIN_NUMBER& f_stVIN_Number) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memcpy(&f_stVIN_Number, &m_stVINnumber, sizeof(STVIN_NUMBER));
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdWriteEventFilesToUsb
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdWriteEventFilesToUsb(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TWriteFilesToUsbCmdData l_stCmdData;
+ TWriteFilesToUsbCmdResponse l_stCmdResponse;
+
+ TThrdEvtLogStore evt = { };
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TWriteFilesToUsbCmdData>(hThread, l_stCmdData))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if ((USB0 == l_stCmdData.eDevId) || (USB1 == l_stCmdData.eDevId)) {
+ memcpy(&evt, &gSUSBDevInfo[l_stCmdData.eDevId], sizeof(TThrdEvtLogStore));
+ } else if (SD == l_stCmdData.eDevId) {
+ memcpy(&evt, &gSSDCardevInfo, sizeof(TThrdEvtLogStore));
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ LOG_ERROR("Invalid DeviceId()");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "USB dev info:Available %d, Location %s, Parse %s ",
+ evt.IsDeviceAvailable, evt.parse_fn, evt.location);
+ l_stCmdResponse.u8Response = copy_event_files_to_usb(&evt);
+ l_stCmdResponse.stSessiondata.strSrcName = l_stCmdData.stSessiondata.strSrcName;
+ l_stCmdResponse.stSessiondata.session_id = l_stCmdData.stSessiondata.session_id;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread, eThrdCmdCopyEventLogUSBResponse,
+ sizeof(TWriteFilesToUsbCmdResponse),
+ &l_stCmdResponse))) {
+ LOG_ERROR("FrameworkunifiedSendParent()");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdReadStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdReadStatisticalCounter(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SStatisticalCounter buffer = { 0 };
+ TStatisticalCntCmdSuccessResp l_stCmdSuccessResp;
+
+ if (hThread != NULL) {
+ TStatisticalCountersCmd l_stCmdData;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TStatisticalCountersCmd>(hThread, l_stCmdData))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadStatisticalCounter(l_stCmdData.eGroupId, buffer))) {
+ LOG_ERROR("ReadStatisticalCounter()");
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread,
+ eThrdCmdStatisticalCounterErrorResp,
+ sizeof(TSessionData),
+ &l_stCmdData.stSessiondata))) {
+ LOG_ERROR("FrameworkunifiedSendParent()");
+ }
+ } else {
+ (VOID) memcpy(&l_stCmdSuccessResp.stBuffer, &buffer,
+ sizeof(SStatisticalCounter));
+ (VOID) memcpy(&l_stCmdSuccessResp.stSessiondata,
+ &l_stCmdData.stSessiondata, sizeof(TSessionData));
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread,
+ eThrdCmdStatisticalCounterSuccessResp,
+ sizeof(TStatisticalCntCmdSuccessResp),
+ &l_stCmdSuccessResp))) {
+ LOG_ERROR("FrameworkunifiedSendParent()");
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :ReadStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus CEvntWriterWorker::ReadStatisticalCounter(
+ EStatCounterGroupID eCounterGroup, SStatisticalCounter& buffer) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_32 size = 0u;
+
+ CounterInformation::iterator countInfIt = counter.find(eCounterGroup);
+ if (counter.end() != countInfIt) {
+ Counter count = countInfIt->second;
+ Counter::iterator countIt;
+ if (((UI_16) count.size()) <= 40) {
+ for (countIt = count.begin(); countIt != count.end(); ++countIt) {
+ UI_16 counterID = countIt->first;
+ UI_32 counterVal = countIt->second;
+ u16copy(&buffer.StatisticalCountBuffer[size], counterID);
+ size += static_cast<UI_16>( sizeof(counterID));
+
+ counterVal = countIt->second;
+ u32copy(&buffer.StatisticalCountBuffer[size], counterVal);
+ size += static_cast<UI_16>( sizeof(counterVal));
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Too many counter elements %02d > 42 ", static_cast<int>(count.size()));
+ }
+ } else {
+ /*OK, here: empty buffer will be returned*/
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdResetStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdResetStatisticalCounter(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TStatisticalCountersCmd l_stCmdData;
+
+ if (hThread != NULL) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TStatisticalCountersCmd>(hThread, l_stCmdData))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ResetStatisticalCounter(l_stCmdData.eGroupId))) {
+ LOG_ERROR("ResetStatisticalCounter()");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+///////////////////////////////////////////////////////////////////////
+/// Function :ResetStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus CEvntWriterWorker::ResetStatisticalCounter(
+ EStatCounterGroupID eCounterGroup) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ CounterInformation::iterator countInfIt;
+ countInfIt = counter.find(eCounterGroup);
+ if (counter.end() != countInfIt) {
+ countInfIt->second.clear();
+ counter.erase(countInfIt->first);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Erased group: 0x%02X from map",
+ (UI_8)eCounterGroup);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :_GetCurrentTimeString
+///////////////////////////////////////////////////////////////////////
+PSTR _GetCurrentTimeString(PCHAR TempFileName, PSTR f_pstrVIN) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ uint32_t rawtime;
+ uint8_t status;
+ struct tm local_time;
+ CHAR tbuf[30];
+ UI_8 l_len = 0;
+ std::string l_strVIN = f_pstrVIN;
+
+ // Time string is based on current date and time. Time string format is <year-mon-dayThhmm>.
+ Clock_getSystemTimeY2K38(&rawtime, &status);
+ Clock_getLocalTimeY2K38(&rawtime, &local_time);
+ if (0
+ != (l_len = static_cast<UI_8>(strftime(tbuf, sizeof(tbuf), "%Y-%m-%dT%H%M",
+ &local_time)))) {
+ sprintf(TempFileName, "%s_%s_%04X.dat", l_strVIN.c_str(), tbuf, // NOLINT (runtime/printf)
+ g_u16DiagId);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "EventLog File Name :%s, tbuf_len = %d",
+ TempFileName, l_len);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return TempFileName;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :copy_event_files_to_usb
+///////////////////////////////////////////////////////////////////////
+UI_8 CEvntWriterWorker::copy_event_files_to_usb(TThrdEvtLogStore *pStUSBIndo) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ CHAR buffer[10];
+ CHAR TempFileName[MAX_SYS_INFO_SIZE];
+ STVIN_NUMBER l_stVIN_Number;
+ std::string _filename("");
+ UI_8 u8Result = COPY_EVT_USB_SUCCESS;
+
+ // Initializing all Char arrays.
+ memset(buffer, 0, 10);
+ memset(TempFileName, 0, MAX_SYS_INFO_SIZE);
+
+ if (pStUSBIndo->IsDeviceAvailable == TRUE) {
+ _filename = pStUSBIndo->location;
+ OnCmdGetVIN(l_stVIN_Number);
+ _filename += _GetCurrentTimeString(TempFileName, l_stVIN_Number.VINstr);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = write_event_to_file(_filename.c_str()))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Write to file failed:%d",
+ l_eStatus);
+ u8Result = (UI_8) USB_DEVICE_WRITE_ERROR;
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Device not available, so event logs can not be copied");
+ u8Result = (UI_8) USB_DEVICE_NOT_AVAILABLE;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return u8Result;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :DD_USBSrvDetectionCallBack
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DD_USBSrvDetectionCallBack(HANDLE hApp) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ SS_MediaDetectInfo tMediaDetectInfo = { };
+ std::string FilePathStr;
+ UI_8 u8Pos = 0;
+
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tMediaDetectInfo,
+ sizeof(tMediaDetectInfo)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "MediaDetectCallBack FrameworkunifiedGetMsgDataOfSize Failed Status:0x%x ",
+ eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Device = %d", tMediaDetectInfo.dev_type);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Availability = %d",
+ tMediaDetectInfo.bIsDeviceAvailable);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " device path = %s",
+ tMediaDetectInfo.deviceMountpath);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " File path = %s",
+ tMediaDetectInfo.filepathName);
+
+ FilePathStr.append(tMediaDetectInfo.deviceMountpath);
+
+ if (tMediaDetectInfo.dev_type == eUSB) {
+ if (tMediaDetectInfo.bIsDeviceAvailable == TRUE) {
+ u8Pos = static_cast<UI_8>(FilePathStr.find_last_of("/\\"));
+
+ if (FilePathStr.compare(u8Pos + 1, 12, "usb-00-d0-p0") == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB1 Detected ");
+ gSUSBDevInfo[0].IsDeviceAvailable = TRUE;
+ snprintf(gSUSBDevInfo[0].parse_fn, gSUSBDevInfo[0].FN_LEN, "%s/",
+ FilePathStr.c_str());
+ snprintf(gSUSBDevInfo[0].location, gSUSBDevInfo[0].FN_LEN, "%s/",
+ FilePathStr.c_str());
+ } else if (FilePathStr.compare(u8Pos + 1, 12, "usb-01-d0-p0") == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB2 Detected ");
+ gSUSBDevInfo[1].IsDeviceAvailable = TRUE;
+ snprintf(gSUSBDevInfo[1].parse_fn, gSUSBDevInfo[1].FN_LEN, "%s/",
+ FilePathStr.c_str());
+ snprintf(gSUSBDevInfo[1].location, gSUSBDevInfo[1].FN_LEN, "%s/",
+ FilePathStr.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB Detected :%s", FilePathStr.c_str());
+ }
+ } else {
+ u8Pos = static_cast<UI_8>(FilePathStr.find_last_of("/\\"));
+
+ if (FilePathStr.compare(u8Pos + 1, 12, "usb-00-d0-p0") == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB1 Ejected ");
+ gSUSBDevInfo[0].IsDeviceAvailable = FALSE;
+ } else if (FilePathStr.compare(u8Pos + 1, 12, "usb-01-d0-p0") == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB2 Ejected ");
+ gSUSBDevInfo[1].IsDeviceAvailable = FALSE;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB Ejected :%s", FilePathStr.c_str());
+ }
+ }
+
+ } else if (tMediaDetectInfo.dev_type == eSD) {
+ if (tMediaDetectInfo.bIsDeviceAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SD card Detected ");
+ gSSDCardevInfo.IsDeviceAvailable = TRUE;
+ snprintf(gSSDCardevInfo.parse_fn, gSSDCardevInfo.FN_LEN, "%s/",
+ FilePathStr.c_str());
+ snprintf(gSSDCardevInfo.location, gSSDCardevInfo.FN_LEN, "%s/",
+ FilePathStr.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SD card Ejected ");
+ gSSDCardevInfo.IsDeviceAvailable = FALSE;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : DD_USBServiceAvailabilityCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus DD_USBServiceAvailabilityCallBack(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (FrameworkunifiedIsServiceAvailable(hThread)) {
+ if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE:200 Because the IF of DetectionService is guaranteed to be successful
+ != (eStatus = m_device_detector_obj.OpenSessionRequest())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Open session request failed");
+ }
+ } else {
+ if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE:200 Because the IF of DetectionService is guaranteed to be successful
+ != (eStatus = m_device_detector_obj.CloseSessionRequest())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Close session request failed");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : DD_USBOpenSessionAckCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus DD_USBOpenSessionAckCallBack(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = // LCOV_EXCL_BR_LINE:200 Because the IF of DetectionService is guaranteed to be successful
+ m_device_detector_obj.DecodeOpenSessionResponse())) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = m_device_detector_obj.RegisterForDeviceDetectionEvent( // LCOV_EXCL_BR_LINE:200 Because the IF of DetectionService is guaranteed to be successful // NOLINT[whitespace/line_length]
+ SS_DEV_DETECT_ANY_USB_EV, DD_USBSrvDetectionCallBack))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Registration for SS_DEV_DETECT_ANY_USB_EV failed");
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = m_device_detector_obj.RegisterForDeviceDetectionEvent( // LCOV_EXCL_BR_LINE:200 Because the IF of DetectionService is guaranteed to be successful // NOLINT[whitespace/line_length]
+ SS_DEV_DETECT_ANY_SD_EV, DD_USBSrvDetectionCallBack))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Registration for SS_DEV_DETECT_ANY_SD_EV failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Decode open session response failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+//////////////////////////////////////////
+// Function : DD_USBCloseSessionAckCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus DD_USBCloseSessionAckCallBack(HANDLE hApp) { // LCOV_EXCL_START 200: CloseSessionRequest can not be called // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CloseSessionAck tCloseSessionAck = { };
+
+ if (hApp) {
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tCloseSessionAck,
+ sizeof(tCloseSessionAck)))) {
+ if (eFrameworkunifiedStatusOK == tCloseSessionAck.eStatus) {
+ UI_32 l_uiSessionId = tCloseSessionAck.sessionId;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "session %d closed successfully",
+ l_uiSessionId);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus CEvntWriterWorker::counterIncrementByValue(EStatCounterGroupID group,
+ UI_16 id, UI_32 value) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus result = eFrameworkunifiedStatusFail;
+ CounterInformation::iterator count_inf_it;
+ count_inf_it = counter.find(group);
+ if (counter.end() == count_inf_it) {
+ Counter newCounter;
+ newCounter.insert(std::pair<UI_16, UI_32>(id, value));
+ counter.insert(std::pair<EStatCounterGroupID, Counter>(group, newCounter));
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "Added new Counter for group %d, id: 0x%04X, value: 0x%08X",
+ (UI_8)group, id, value);
+ } else {
+ Counter::iterator count_it;
+ count_it = count_inf_it->second.find(id);
+ if (count_inf_it->second.end() == count_it) {
+ count_inf_it->second.insert(std::pair<UI_16, UI_32>(id, value));
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "Added new Entry for group %d, id: 0x%04X, value: 0x%08X",
+ (UI_8)group, id, value);
+ } else {
+ if (count_it->second != MAX_CNT_VALUE) {
+ count_it->second += value;
+ }
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_FUNC,
+ __FUNCTION__,
+ "Modified Entry for group %d, id: 0x%04X, by value: 0x%08X, new value: 0x%08X",
+ (UI_8)group, id, value, count_it->second);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return result;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CEvntWriterWorker::immediate_persist_event_log(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ STEventLogPersistBuffer* l_evtlogbuf;
+ l_evtlogbuf = new (std::nothrow) STEventLogPersistBuffer;
+
+ if (NULL != l_evtlogbuf) {
+ if (pObj) {
+ pObj->write_events_to_buffer(l_evtlogbuf);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: CEvntWriterWorker Object handle is NULL");
+ }
+ delete l_evtlogbuf;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: New failed to allocate memory, err: %s", strerror(errno));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CEvntWriterWorker::EvtThd_SetMileage(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_u32mileage;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hThread, &l_u32mileage,
+ sizeof(l_u32mileage)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize Failed Status:%d ",
+ l_eStatus);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ m_u32MileageData = l_u32mileage;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :write_mileage_to_file
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::write_mileage_to_file(const CHAR* filename) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_32 u32File_Size;
+ SI_32 fd = -1;
+
+ if (-1 != (fd = ::open(filename, O_WRONLY | O_CREAT | O_TRUNC,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP))) {
+ if (SIZE_0
+ >= (u32File_Size = static_cast<UI_32>(::write(fd, &m_u32MileageData, sizeof(UI_32))))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Writing in to file is failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ ::close(fd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: File failed to open");
+ eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :read_mileage_from_file
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::read_mileage_from_file(const CHAR* filename) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+// UI_32 u32File_Size;
+ SI_32 fd = -1;
+
+ if (NULL != filename) {
+ if (-1 != (fd = ::open(filename, O_RDONLY, S_IRUSR))) {
+ if (-1 == ::read(fd, &m_u32MileageData, sizeof(UI_32))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Reading file failed, %s",
+ strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "m_u32MileageData = %d",
+ m_u32MileageData);
+ }
+ ::close(fd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: File failed to open");
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Filename is NULL");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdReadNumberOfEventsLogged
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdReadNumberOfEventsLogged(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TEvntsLogged l_stEventsLogged;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TSessionData>(hThread,
+ l_stEventsLogged.stSessiondata))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ l_stEventsLogged.u16numberofeventslogged = (UI_16) deque_event_info.size();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Number of Events Read: %d",
+ l_stEventsLogged.u16numberofeventslogged);
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread,
+ eThrdCmdNumberOfEventsLoggedResponse,
+ sizeof(TEvntsLogged), &l_stEventsLogged))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Error: FrameworkunifiedSendMsg failed %d", l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdUploadEventLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdUploadEventLog(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TSessionData>(
+ hThread, m_stUploadEventLogResp.stSessiondata))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (pObj) {
+ pObj->write_events_to_buffer(&m_stUploadEventLogResp.stEventLogBuffer);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread, eThrdCmdUploadEventLogResponse,
+ sizeof(TUploadEventLogResp),
+ &m_stUploadEventLogResp))) {
+ LOG_ERROR("FrameworkunifiedSendParent()");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: CEvntWriterWorker Object handle is NULL");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdCopyEvntLogToTmp
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdCopyEvntLogToTmp(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
diff --git a/systemservice/logger_service/server/src/mem_reader.cpp b/systemservice/logger_service/server/src/mem_reader.cpp
new file mode 100755
index 0000000..5ad6a6c
--- /dev/null
+++ b/systemservice/logger_service/server/src/mem_reader.cpp
@@ -0,0 +1,125 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports reading from a shared mem area.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/reader/mem_reader.h"
+#include <string>
+
+namespace ReaderWriter {
+
+CMemReader::CMemReader()
+ : m_pSharedBuf(NULL),
+ m_sharedBufSize(0) {
+}
+
+CMemReader::~CMemReader() {
+ this->Close();
+}
+
+EFrameworkunifiedStatus CMemReader::Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+ m_sharedBufSize = f_maxSize;
+ m_pSharedBuf = new (std::nothrow) CNSSharedMemReader(f_name, TRUE); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ if (NULL != m_pSharedBuf) { // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ l_eStatus = this->Open();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CMemReader::Open(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+ if (NULL != m_pSharedBuf) { // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_pSharedBuf will noe be null
+ if (!m_pSharedBuf->IsOpen()) {
+ // maps the shared memory buffer
+ l_eStatus = m_pSharedBuf->Open();
+ } else {
+ // Already opened no action required
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+BOOL CMemReader::IsOpen(void) {
+ return this->m_pSharedBuf->IsOpen();
+}
+
+EFrameworkunifiedStatus CMemReader::Read(UI_8* f_data, UI_32 f_length, SI_32& f_bytesRead) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (this->m_pSharedBuf != NULL) {
+ if (TRUE != this->m_pSharedBuf->IsOpen()) {
+ l_eStatus = m_pSharedBuf->Open();
+ }
+ if (l_eStatus == eFrameworkunifiedStatusOK) {
+ f_bytesRead = m_pSharedBuf->Read(reinterpret_cast<char *>(f_data), f_length);
+ if (NS_SHM_ERROR != f_bytesRead) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CMemReader::ReadToFile(std::string f_fileName, UI_32& f_Written) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ if ((NULL != m_pSharedBuf) && // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_pSharedBuf will noe be null
+ (f_fileName.length() != 0)) {
+ l_eStatus = m_pSharedBuf->DumpToFile(f_fileName.c_str(), &f_Written);
+ }
+
+ return l_eStatus;
+}
+
+void CMemReader::Close(void) {
+ if (NULL != m_pSharedBuf) { // LCOV_EXCL_BR_LINE 6: m_pSharedBuf can not be null
+ // un-map the shared memory object
+ (void) m_pSharedBuf->Close();
+
+ delete m_pSharedBuf;
+ m_pSharedBuf = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CMemReader::ResetPosition(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNullPointer;
+ if (NULL != m_pSharedBuf) { // LCOV_EXCL_BR_LINE 6:Because m_pSharedBuf is always NULL
+ // un-map the shared memory object
+ l_eStatus = m_pSharedBuf->SetReadPtrToWritePtr();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_pSharedBuf->SetReadPtrToWritePtr();"); // LCOV_EXCL_BR_LINE 15:Macro
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+} // namespace ReaderWriter
diff --git a/systemservice/logger_service/server/src/mod_version.c b/systemservice/logger_service/server/src/mod_version.c
new file mode 100755
index 0000000..0594b74
--- /dev/null
+++ b/systemservice/logger_service/server/src/mod_version.c
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_LogTraceSender
+/// \brief This file supports logging module version identification.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <native_service/frameworkunified_types.h>
+
+#define MOD_VERSION_LENGTH 12
+
+static CHAR s_ModVersion[MOD_VERSION_LENGTH + 1] = "0.0.0";
+
+SI_8 GetModuleVersion (CHAR* pRetBuf, UI_8 nBufLen)
+{ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ UI_8 CopyLen = 0;
+ SI_8 RetVal = -1;
+
+ if (NULL != pRetBuf)
+ {
+ CopyLen = MIN_VAL(nBufLen, MOD_VERSION_LENGTH);
+ strncpy(pRetBuf, s_ModVersion, CopyLen);
+ pRetBuf[CopyLen] = '\0';
+ RetVal = 0;
+ }
+ return RetVal;
+}
+// LCOV_EXCL_STOP 8: dead code
+
diff --git a/systemservice/logger_service/server/src/queue_reader.cpp b/systemservice/logger_service/server/src/queue_reader.cpp
new file mode 100755
index 0000000..6c056c3
--- /dev/null
+++ b/systemservice/logger_service/server/src/queue_reader.cpp
@@ -0,0 +1,101 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/reader/queue_reader.h"
+#include <string>
+
+namespace ReaderWriter {
+CQueueReader::CQueueReader()
+ : m_handle(-1),
+ m_queName("") { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+}
+
+CQueueReader::~CQueueReader() {
+ if (this->IsOpen()) {
+ this->Close();
+ }
+}
+
+EFrameworkunifiedStatus CQueueReader::Initialize(CLoggerCfg* f_pLoggerCfg,
+ std::string f_name, UI_32 f_maxSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+ if (f_pLoggerCfg != NULL) { // LCOV_EXCL_BR_LINE 6:Because the applicable variable cannot be changed from the external API
+ this->m_pLoggerCfg = f_pLoggerCfg;
+ // Check for invalid name
+ if (f_name.length() != 0) { // LCOV_EXCL_BR_LINE 6:it can not be 0
+ m_queName = f_name;
+ l_eStatus = this->Open();
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CQueueReader::Open(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+
+ if (-1 != m_handle) { // LCOV_EXCL_BR_LINE 6:Because m_handle is always -1
+ // Queue already opened, no action required.
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (m_queName.length() != 0) { // LCOV_EXCL_BR_LINE 6:Because m_queName is not always an empty string
+ const UI_32 MAX_MESSAGES_STORED_IN_QUEUE = 512;
+ struct mq_attr mqattr;
+ mqattr.mq_flags = 0;
+ mqattr.mq_maxmsg = MAX_MESSAGES_STORED_IN_QUEUE;
+ mqattr.mq_msgsize = MAX_QUEUE_MSG_SIZE;
+
+ this->m_handle = mq_open(m_queName.c_str(), O_RDONLY | O_CREAT, 0666,
+ &mqattr);
+ if (-1 != m_handle) { // LCOV_EXCL_BR_LINE 5:mq_open cannot be passed because it cannot be turned mock
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+BOOL CQueueReader::IsOpen(void) {
+ return (-1 != m_handle) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 6:Because the condition cannot be set
+}
+
+EFrameworkunifiedStatus CQueueReader::Read(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesRead) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ if (this->m_handle != -1) { // LCOV_EXCL_BR_LINE 6:Because the condition cannot be set
+ if (f_length <= MAX_QUEUE_MSG_SIZE) { // LCOV_EXCL_BR_LINE 6:Because the applicable variable cannot be changed from the external API
+ f_bytesRead = static_cast<SI_32>(mq_receive(this->m_handle, reinterpret_cast<char *>(f_data),
+ (size_t) MAX_QUEUE_MSG_SIZE, NULL));
+
+ if ((0 <= f_bytesRead) && ((UI_32) f_bytesRead <= f_length)) { // LCOV_EXCL_BR_LINE 6:Because the condition cannot be set
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ return (l_eStatus);
+}
+
+void CQueueReader::Close(void) {
+ if (this->m_handle != -1) { // LCOV_EXCL_BR_LINE 200: m_handle is aways not -1
+ (void) mq_close(this->m_handle);
+ }
+}
+} // namespace ReaderWriter
diff --git a/systemservice/logger_service/server/src/reader.cpp b/systemservice/logger_service/server/src/reader.cpp
new file mode 100755
index 0000000..04880f0
--- /dev/null
+++ b/systemservice/logger_service/server/src/reader.cpp
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/reader/reader.h"
+#include <string>
+#include <new>
+#include <iostream>
+#include "readerWriter/reader/queue_reader.h"
+#include "readerWriter/reader/mem_reader.h"
+#include "ss_logger_cfg.h"
+namespace ReaderWriter {
+CReader::CReader()
+ : m_pLoggerCfg(NULL) {
+}
+
+CReader::~CReader() {
+}
+
+CReader* CReader::OpenReader(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
+ std::string f_name, UI_32 f_maxSize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CReader* l_ret = NULL;
+ if (f_pLoggerCfg != NULL) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ if (f_name.length() != 0) { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
+ switch (f_type) { // LCOV_EXCL_BR_LINE 200:As it must be eReaderWriterTypeQueue or eReaderWriterTypeMem
+ case eReaderWriterTypeFile:
+ break;
+
+ case eReaderWriterTypeQueue:
+ l_ret = new (std::nothrow) CQueueReader(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ break;
+
+ case eReaderWriterTypeMem:
+ l_ret = new (std::nothrow) CMemReader(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ break;
+
+ default:
+ break;
+ }
+ }
+ if (NULL != l_ret) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ if (eFrameworkunifiedStatusOK != l_ret->Initialize(f_pLoggerCfg, f_name, f_maxSize)) {
+ delete (l_ret);
+ l_ret = NULL;
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_ret;
+}
+
+
+EFrameworkunifiedStatus CReader::ReadToFile(std::string f_fileName, UI_32& f_Written) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNotImplemented;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CReader::ResetPosition(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNotImplemented;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+} // namespace ReaderWriter
diff --git a/systemservice/logger_service/server/src/reader_writer.cpp b/systemservice/logger_service/server/src/reader_writer.cpp
new file mode 100755
index 0000000..ef32384
--- /dev/null
+++ b/systemservice/logger_service/server/src/reader_writer.cpp
@@ -0,0 +1,282 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/reader_writer.h"
+#include <errno.h>
+#include <loggerservicedebug_loggerservicelog.h>
+#include <system_service/ss_templates.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <string>
+
+namespace ReaderWriter {
+
+CReaderWriter::CReaderWriter()
+ : m_pLoggerCfg(NULL),
+ m_reader(NULL),
+ m_writer(NULL),
+ m_running(FALSE),
+ m_thread(-1),
+ m_readerName(""),
+ m_paused(FALSE) {
+
+ pthread_cond_init(&m_condVariable, NULL);
+}
+
+CReaderWriter::~CReaderWriter() { // LCOV_EXCL_START 14:global instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (NULL != this->m_reader) {
+ delete (this->m_reader);
+ this->m_reader = NULL;
+ }
+
+ if (NULL != this->m_writer) {
+ delete (this->m_writer);
+ this->m_writer = NULL;
+ }
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CReaderWriter::Initialize(CLoggerCfg* f_pLoggerCfg,
+ EReaderType f_readerType,
+ std::string f_readerName,
+ UI_32 f_readerMaxSize,
+ EWriterType f_writerType,
+ std::string f_writer1Name,
+ UI_32 f_writer1MaxSize,
+ std::string f_writer2Name,
+ UI_32 f_writer2MaxSize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (NULL == (this->m_pLoggerCfg = f_pLoggerCfg)) { // LCOV_EXCL_BR_LINE 6:Because the applicable variable cannot be changed from the external API
+ // FRAMEWORKUNIFIEDLOG not needed... If this starts we won't be able to print loggerservicelogs anyways.
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ } else {
+ this->m_reader = CReader::OpenReader(f_pLoggerCfg, f_readerType, // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ f_readerName, f_readerMaxSize);
+ this->m_writer = CWriter::OpenWriter(f_pLoggerCfg, f_writerType, // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ f_writer1Name, f_writer1MaxSize,
+ f_writer2Name, f_writer2MaxSize);
+
+ if ((NULL == this->m_reader) || (NULL == this->m_writer)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+
+ this->Cleanup(this);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CReaderWriter::Start(std::string f_readerName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNullPointer;
+ if (this->m_running == FALSE) { // LCOV_EXCL_BR_LINE 6:Because m_running is always FALSE
+ this->m_readerName = f_readerName;
+ BOOL l_barInit =
+ // LCOV_EXCL_BR_START 5:pthread cannot be passed because it cannot be turned mock
+ (EOK == pthread_barrier_init(&m_barrier, NULL, 2)) ? TRUE : FALSE;
+ if (l_barInit) {
+ // LCOV_EXCL_BR_STOP
+ pthread_attr_t attr;
+ struct sched_param params;
+ pthread_attr_init(&attr);
+ pthread_attr_getschedparam(&attr, &params);
+ SI_32 prio = frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(
+ f_readerName);
+ if (-1 != prio) { // LCOV_EXCL_BR_LINE 6:Because prio is always -1
+ // LCOV_EXCL_START 6:Because the prio is not always -1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ params.sched_priority = prio;
+ pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
+ pthread_attr_setschedparam(&attr, &params);
+ // LCOV_EXCL_STOP
+ }
+
+ if (EOK == pthread_create(&m_thread, &attr, &CReaderWriter::ThreadFunctionWrapper, this)) { // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock // NOLINT[whitespace/line_length]
+ this->m_running = TRUE;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ pthread_barrier_wait(&this->m_barrier); /* Wait for thread to take off*/
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+void* CReaderWriter::ThreadFunctionWrapper(void* param) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CReaderWriter* l_pObj = reinterpret_cast<CReaderWriter *>(param);
+
+ l_pObj->ThreadFunction(l_pObj);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. ThreadFunction has exited");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return NULL;
+}
+
+void CReaderWriter::ThreadFunction(CReaderWriter* l_pObj) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int l_oldState;
+
+ pthread_setname_np(pthread_self(), this->m_readerName.c_str());
+ pthread_cleanup_push(&CReaderWriter::CleanupWrapper, this);
+ pthread_mutex_init(&m_writeMutex, NULL);
+ pthread_mutex_init(&m_pauseMutex, NULL);
+ int l_wait = pthread_barrier_wait(&m_barrier);
+
+ if ((eFrameworkunifiedStatusOK == l_eStatus)
+ // LCOV_EXCL_BR_START 5:pthread cannot be passed because it cannot be turned mock
+ && (((PTHREAD_BARRIER_SERIAL_THREAD == l_wait) || (0 == l_wait)))) {
+ // LCOV_EXCL_BR_STOP
+ UI_8 data[MAX_QUEUE_MSG_SIZE + 1];
+ while (TRUE) {
+ if (TRUE == this->m_paused) {
+ if (EOK == pthread_mutex_lock(&this->m_pauseMutex)) { // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock
+ (void)pthread_cond_wait(&m_condVariable, &m_pauseMutex); // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock
+ (void) pthread_mutex_unlock(&this->m_pauseMutex); // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock
+ }
+ }
+ if (!this->m_reader->IsOpen() || !this->m_writer->IsOpen()) { // LCOV_EXCL_BR_LINE 6:As it is not always open
+ (void)this->m_reader->Open(); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ (void)this->m_writer->Open(); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+
+ if (!this->m_reader->IsOpen() || !this->m_writer->IsOpen()) {
+
+// ->Reduced frequency of accesses to IsOpen()
+ usleep(1000*1000); // LCOV_EXCL_BR_LINE 5:C function
+ } else {
+ while ((eFrameworkunifiedStatusOK == l_eStatus) && (FALSE == this->m_paused)) {
+ SI_32 l_bytesRead = -1;
+ SI_32 l_bytesWritten = -1;
+ l_eStatus = this->m_reader->Read(data,
+ MAX_QUEUE_MSG_SIZE,
+ l_bytesRead); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
+ &l_oldState);
+ if (EOK == pthread_mutex_lock(&this->m_writeMutex)) { // LCOV_EXCL_BR_LINE 5: c code error case
+ l_eStatus = this->m_writer->Write(data,
+ (UI_32) l_bytesRead,
+ l_bytesWritten);
+ (void) pthread_mutex_unlock(&this->m_writeMutex);
+ }
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,
+ &l_oldState);
+ }
+ }
+ l_eStatus = eFrameworkunifiedStatusOK; // Reset l_eStatus
+ }
+ }
+ }
+
+ pthread_cleanup_pop(1);
+}
+
+
+void CReaderWriter::CleanupWrapper(void* param) {
+ CReaderWriter* l_pObj = reinterpret_cast<CReaderWriter *>(param);
+
+ l_pObj->Cleanup(l_pObj);
+}
+
+void CReaderWriter::Cleanup(CReaderWriter* l_pObj) {
+
+// (void) pthread_mutex_unlock(&this->m_pauseMutex);
+// (void) pthread_mutex_unlock(&this->m_writeMutex);
+
+
+ if (this->m_reader != NULL) { // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_reader can not be null
+ delete (this->m_reader);
+ this->m_reader = NULL;
+ }
+ if (this->m_writer != NULL) { // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_writer can not be null
+ delete (this->m_writer);
+ this->m_writer = NULL;
+ }
+ this->m_running = FALSE;
+}
+
+EFrameworkunifiedStatus CReaderWriter::FlushCache(std::string f_filename) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (TRUE == this->m_pLoggerCfg->IsLoggingEnabled()) { // LCOV_EXCL_BR_LINE 6: it can not be false
+ if (EOK == pthread_mutex_lock(&this->m_writeMutex)) { // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock
+ if (this->m_writer != NULL) { // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_writer can not be null
+ l_eStatus = this->m_writer->FlushCache();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "this->m_writer->FlushCache()")
+ }
+ (void) pthread_mutex_unlock(&this->m_writeMutex);
+ }
+
+ UI_32 l_written;
+ if (NULL != this->m_reader) { // LCOV_EXCL_BR_LINE 6:Because it depends on the startup process
+ l_eStatus = this->m_reader->ReadToFile(f_filename, l_written);
+ /*Don't output error, if function not implemented*/
+ l_eStatus =
+ (l_eStatus == eFrameworkunifiedStatusNotImplemented) ? eFrameworkunifiedStatusOK : l_eStatus;
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "this->m_reader->ReadToFile(f_filename, l_written)");
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CReaderWriter::UpdateLoggingParameters(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (EOK == pthread_mutex_lock(&this->m_writeMutex)) { // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock
+ if (this->m_writer != NULL) {
+ l_eStatus = this->m_writer->UpdateLoggingParameters();
+ }
+ (void) pthread_mutex_unlock(&this->m_writeMutex);
+ }
+ BOOL l_enabled = this->m_pLoggerCfg->IsLoggingEnabled();
+ if ((this->m_paused == FALSE) && (FALSE == l_enabled)) {
+ this->Pause();
+ } else if ((this->m_paused == TRUE) && (TRUE == l_enabled)) {
+ this->Resume();
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : %d", l_eStatus);
+ return (l_eStatus);
+}
+
+void CReaderWriter::Pause(void) {
+ (void) pthread_mutex_lock(&this->m_pauseMutex);
+ this->m_paused = TRUE;
+
+ (void) pthread_mutex_unlock(&this->m_pauseMutex);
+}
+
+void CReaderWriter::Resume(void) {
+ (void) pthread_mutex_lock(&this->m_pauseMutex);
+ if (this->m_reader != NULL) { // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_reader can not be null
+ (void) this->m_reader->ResetPosition();
+ }
+ pthread_cond_signal(&m_condVariable);
+ this->m_paused = FALSE;
+ (void) pthread_mutex_unlock(&this->m_pauseMutex);
+}
+} // namespace ReaderWriter
diff --git a/systemservice/logger_service/server/src/ss_logger_cfg.cpp b/systemservice/logger_service/server/src/ss_logger_cfg.cpp
new file mode 100755
index 0000000..b353bbe
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_cfg.cpp
@@ -0,0 +1,754 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief Provide support for CPU high load monitor configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_cfg.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <boost/bind.hpp>
+#include <native_service/nslogutil_cmd_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <system_service/ss_logger_service_notifications.h>
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <string>
+#include <algorithm>
+#include <vector>
+
+const static UI_32 cMAX_EMMC_COUNTER_VALUE = 100000u; // NOLINT (build/storage_class)
+///////////////////////////////////////////////////////////////////////////////
+// CLASS METHODS
+///////////////////////////////////////////////////////////////////////////////
+
+CLoggerCfg::CLoggerCfg()
+ : m_logMaxFileSize(0),
+ m_performanceLogMaxFileSize(0),
+ m_emmcOutputMax(0),
+ m_emmcOutputErrMax(0),
+ m_emmcOutputGrpRelaunchMax(0),
+ m_emmcOutputNaviLogMax(0),
+ m_emmcOutputNaviLogNmlMax(0),
+ m_emmcOutputNaviLogErrMax(0),
+ m_emmcOutputPath(""),
+ m_emmcOutputNaviLogPath(""),
+ m_usb0MountPath(""),
+ m_usb1MountPath(""),
+ m_sdMountPath(""),
+ m_eDevType(eDevUSB1),
+ m_UserInvokedLoggingNumber(1u),
+ m_EmmcCounter(0u),
+ m_eLoggerUDPLoggingStatus(eDeactivate),
+ m_eLoggerStatus(SS_LOGGER_DEFAULT_VALUE) {
+ m_udpEnvFlag = FALSE;
+ std::memset(m_logMask, 0, sizeof(m_logMask));
+ std::memset(&m_ExternalLogList, 0, sizeof(&m_ExternalLogList));
+ }
+
+CLoggerCfg::~CLoggerCfg(void) { // LCOV_EXCL_START 14:global instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ if (m_ExternalLogList.p_info != NULL) {
+ delete[] m_ExternalLogList.p_info;
+ m_ExternalLogList.p_info = NULL;
+ }
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerCfg::Initialize(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ char* l_udp_env = getenv("UDPLOGS_ON");
+ m_udpEnvFlag = (
+ l_udp_env == NULL ?
+ FALSE : (strcmp("TRUE", l_udp_env) == 0 ? TRUE : FALSE));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+EFrameworkunifiedStatus CLoggerCfg::SetandPersistLoggingParams(HANDLE f_hApp,
+ STLoggerSetAllParams f_Params,
+ BOOL f_InitCall) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_paramChanged = f_InitCall;
+ BOOL l_updateLoggerState = f_InitCall;
+
+ if ((TRUE == l_paramChanged) // LCOV_EXCL_BR_LINE 200:l_paramChanged is never TRUE
+ ||
+ (m_eLoggerStatus != f_Params.Logger_State)
+ || // LCOV_EXCL_BR_LINE 200:Because m_UserInvokedLoggingNumber != f_Params.Log_FolderCnt is never false
+ (m_UserInvokedLoggingNumber != f_Params.Log_FolderCnt)
+ || (m_eLoggerUDPLoggingStatus != f_Params.Logger_UDPState)
+ || (m_eDevType != f_Params.Device_Type)) {
+ l_paramChanged = TRUE;
+ } else {
+ l_paramChanged = FALSE;
+ }
+
+ l_updateLoggerState =
+ ((l_updateLoggerState == TRUE)
+ || (m_eLoggerStatus != f_Params.Logger_State)) ? TRUE : FALSE;
+
+ // After startup Logging will be set to default value
+ if (TRUE == f_InitCall) { // LCOV_EXCL_BR_LINE 200:f_InitCall is never TRUE
+ // LCOV_EXCL_START 200:f_InitCall is never TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ m_eLoggerStatus = SS_LOGGER_DEFAULT_VALUE;
+ // LCOV_EXCL_STOP
+ } else {
+ m_eLoggerStatus = f_Params.Logger_State;
+ }
+ m_eLoggerUDPLoggingStatus = f_Params.Logger_UDPState;
+ m_UserInvokedLoggingNumber = f_Params.Log_FolderCnt;
+ m_eDevType = f_Params.Device_Type;
+
+ if (TRUE == l_paramChanged) {
+ l_eStatus = PersistLoggingParam(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: macro
+ "PersistLoggingParam()");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::SetLoggingParams(HANDLE f_hApp,
+ const STLoggerSetParams f_stLoggerSetParams) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ STLoggerSetAllParams l_Params;
+
+ l_Params.Logger_UDPState = m_eLoggerUDPLoggingStatus;
+ l_Params.Log_FolderCnt = m_UserInvokedLoggingNumber;
+ l_Params.Logger_State = f_stLoggerSetParams.Logger_State;
+ l_Params.Device_Type = f_stLoggerSetParams.Device_Type;
+
+ l_eStatus = SetandPersistLoggingParams(f_hApp, l_Params, FALSE);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SetandPersistLoggingParams()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::SetUDPLogging(HANDLE f_hApp,
+ const ELOGGER_STAT f_eUDPLoggingStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ STLoggerSetAllParams l_Params;
+
+ l_Params.Logger_UDPState = f_eUDPLoggingStatus;
+ l_Params.Log_FolderCnt = m_UserInvokedLoggingNumber;
+ l_Params.Logger_State = m_eLoggerStatus;
+ l_Params.Device_Type = m_eDevType;
+
+ l_eStatus = SetandPersistLoggingParams(f_hApp, l_Params, FALSE);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SetandPersistLoggingParams()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::PersistLoggingParam(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO, __FUNCTION__,
+ "LoggerState = %d, Device_Type = %d,UDPLogging = %d, TriggerNumber = %d",
+ m_eLoggerStatus, m_eDevType, m_eLoggerUDPLoggingStatus,
+ m_UserInvokedLoggingNumber); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ this->UpdateLoggingStatus();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+void CLoggerCfg::RemoveCarriageReturn(std::string &f_str) {
+ if (f_str.empty()) { // LCOV_EXCL_BR_LINE 8: Because there is no empty string case
+ return;
+ }
+
+ if ('\r' == f_str.at(f_str.size() - 1)) {
+ f_str.erase(f_str.size() - 1, 1);
+ }
+}
+EFrameworkunifiedStatus CLoggerCfg::Load(const std::string &f_filePathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+
+ if ("" == f_filePathAndName) { // LCOV_EXCL_BR_LINE 200: Because there is no empty string case
+ // LCOV_EXCL_START 200: Because there is no empty string case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Invalid configuration file name detected.");
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Reading Configuration Data from %s", f_filePathAndName.c_str());
+
+ CNSConfigReader *l_pReaderCfg = new CNSConfigReader(); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (NULL == l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5:new error
+ // LCOV_EXCL_START 5:new error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Unable to allocate CNSConfigReader object.");
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(f_filePathAndName))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->Parse(%s) returned: 0x%X",
+ f_filePathAndName.c_str(), l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.LogMaxFileSize", m_logMaxFileSize))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(LOGGING.LogMaxFileSize)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.PerformanceLogSize", m_performanceLogMaxFileSize))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(LOGGING.LogMaxFileSize)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("LOGGING.EmmcOutputPath", m_emmcOutputPath))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.EmmcOutputPath)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("LOGGING.EmmcOutputNaviLogPath", m_emmcOutputNaviLogPath))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputNaviLogPath)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("LOGGING.Usb0MountPath", m_usb0MountPath))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.Usb0MountPath)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("LOGGING.Usb1MountPath", m_usb1MountPath))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.Usb1MountPath)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("LOGGING.SdMountPath", m_sdMountPath))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.SdMountPath)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputMax", m_emmcOutputMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.EmmcOutputMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputErrMax", m_emmcOutputErrMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputErrMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputGrpRelaunchMax", m_emmcOutputGrpRelaunchMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputGrpRelaunchMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputNaviLogMax", m_emmcOutputNaviLogMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputNaviLogMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputNaviLogNmlMax", m_emmcOutputNaviLogNmlMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputNaviLogNmlMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputNaviLogErrMax", m_emmcOutputNaviLogErrMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputNaviLogErrMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("STORAGE.ThreadName", m_loggerStorageInfo.Name))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(STORAGE.ThreadName)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("STORAGE.Priority", m_loggerStorageInfo.Priority))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(STORAGE.Priority)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("STORAGE.Timeout", m_loggerStorageInfo.Timeout))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(STORAGE.Timeout)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("STORAGE.TimeoutAfter", m_loggerStorageInfo.TimeoutAfter))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(STORAGE.TimeoutAfter)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogNum", m_ExternalLogList.num))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.ExternalLogNum)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogMax", m_ExternalLogList.max))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.ExternalLogMax)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ } else {
+ RemoveCarriageReturn(m_emmcOutputPath);
+ RemoveCarriageReturn(m_emmcOutputNaviLogPath);
+ RemoveCarriageReturn(m_usb0MountPath);
+ RemoveCarriageReturn(m_usb1MountPath);
+ RemoveCarriageReturn(m_sdMountPath);
+ RemoveCarriageReturn(m_loggerStorageInfo.Name);
+
+ for (UI_32 i = 0; i < ZONE_MASK_ARRAY_ELTS; i++) {
+ SI_32 l_logMaskTemp;
+ std::stringstream l_cfgParamName;
+
+ l_cfgParamName << "SETLOGMASK.MASK" << i;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt(l_cfgParamName.str(), l_logMaskTemp))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->GetInt(%s) failed with error: %d.",
+ l_cfgParamName.str().c_str(), l_eStatus);
+
+ break;
+ // LCOV_EXCL_STOP
+ } else {
+ m_logMask[i] = (UI_32) l_logMaskTemp;
+ }
+ }
+
+ m_EELStorageRelPath = "/EEL_export";
+ m_EELActivateRelPath = "/EEL_activate";
+ m_LoggerserviceEmmcLogsRelPath = "/LOGGERSERVICE_EMMC_LOGS";
+
+ if (m_ExternalLogList.num > 0) {
+ std::string str = "EXTERNAL_"; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ UI_32 num = 0;
+
+ if (m_ExternalLogList.num <= m_ExternalLogList.max) {
+ num = m_ExternalLogList.num;
+ } else {
+ num = m_ExternalLogList.max;
+ }
+
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov constraints (others)
+ m_ExternalLogList.p_info = new ExternalLogInfo[num];
+
+ // Load external log info
+ for (UI_32 i = 0; i < num; i++) {
+ std::string query = str + std::to_string(i+1);
+ if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetString((query+".OutputPath"), m_ExternalLogList.p_info[i].dirname))) {
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(EXTERNAL.OutputPath)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetString((query+".ExtLogPath"), m_ExternalLogList.p_info[i].path))) {
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(EXTERNAL.ExtLogPath)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetBool((query+".Remove"), m_ExternalLogList.p_info[i].remove))) {
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetBool(EXTERNAL.Remove)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ } else {
+ RemoveCarriageReturn(m_ExternalLogList.p_info[i].dirname);
+ RemoveCarriageReturn(m_ExternalLogList.p_info[i].path);
+ }
+ }
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov constraints (others)
+ } else {
+ // None external log
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Configuration successfully loaded."); // LCOV_EXCL_BR_LINE 15: macro
+ }
+ }
+
+ delete l_pReaderCfg; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::Validate(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+
+ if (m_logMaxFileSize == 0) { // LCOV_EXCL_BR_LINE 200:Because the size is never 0
+ // LCOV_EXCL_START 200:Because the size is never 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected. LogMaxFileSize: %d Must be > 0.",
+ m_logMaxFileSize);
+ // LCOV_EXCL_STOP
+ } else if (m_emmcOutputPath == "") {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected."
+ " EmmcOutputPath: %s Must be a valid path containing a trailing backslash.",
+ m_emmcOutputPath.c_str());
+ } else if (m_emmcOutputNaviLogPath == "") { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
+ // LCOV_EXCL_START 200:Because it is not always an empty string
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected."
+ " EmmcOutputNaviLogPath: %s Must be a valid path containing a trailing backslash.",
+ m_emmcOutputNaviLogPath.c_str());
+ // LCOV_EXCL_STOP
+ } else if (m_usb0MountPath == "") { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
+ // LCOV_EXCL_START 200:Because it is not always an empty string
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected."
+ " Usb0MountPath: %s Must be a valid path containing a trailing backslash.",
+ m_usb0MountPath.c_str());
+ // LCOV_EXCL_STOP
+ } else if (m_usb1MountPath == "") { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
+ // LCOV_EXCL_START 200:Because it is not always an empty string
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected."
+ " Usb1MountPath: %s Must be a valid path containing a trailing backslash.",
+ m_usb1MountPath.c_str());
+ // LCOV_EXCL_STOP
+ } else if (m_sdMountPath == "") { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
+ // LCOV_EXCL_START 200:Because it is not always an empty string
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected. SdMountPath: %s Must be a valid path containing a trailing backslash.",
+ m_sdMountPath.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+void CLoggerCfg::Print(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+std::string CLoggerCfg::getEmmcOutputPath(void) {
+ return (m_emmcOutputPath);
+}
+
+std::string CLoggerCfg::getEmmcOutputNaviLogPath(void) {
+ return (m_emmcOutputNaviLogPath);
+}
+
+std::string CLoggerCfg::getUsb0MountPath(void) {
+ return (m_usb0MountPath);
+}
+void CLoggerCfg::setUsb0MountPath(std::string& f_deviceMountpath) {
+ m_usb0MountPath = f_deviceMountpath;
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetUserInvokedDestination(std::string& f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ f_dest = "";
+ switch (m_eDevType) {
+ case eDevUSB1:
+ f_dest = m_usb0MountPath;
+ break;
+
+ case eDevUSB2:
+ f_dest = m_usb1MountPath;
+ break;
+
+ case eDevSD:
+ f_dest = m_sdMountPath;
+ break;
+
+ case eTotalDevicesTypes:
+ case eInvalid_DevType:
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Unknown device type: %d",
+ m_eDevType);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetEmmcDestination(std::string& f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ f_dest = m_emmcOutputPath;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetEmmcNaviLogDestination(std::string& f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ f_dest = m_emmcOutputNaviLogPath;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+UI_32 CLoggerCfg::GetUserInvokedCounter(void) {
+ return m_UserInvokedLoggingNumber;
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetIncrementAndPersistUserInvokedCounter(
+ HANDLE f_hApp, UI_32 &f_counter) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ f_counter = m_UserInvokedLoggingNumber;
+ m_UserInvokedLoggingNumber++;
+ l_eStatus = PersistLoggingParam(f_hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetAndIncrementEmmcCounter(UI_32 &f_counter) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_checkFileName;
+ std::vector<UI_32> l_vector;
+ DIR *l_dirp;
+ struct dirent l_dirent;
+ struct dirent* next = NULL;
+ size_t l_pos;
+ UI_32 l_count;
+ UI_32 l_maxCount;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (m_EmmcCounter == 0u) {
+ l_maxCount = 0;
+ l_dirp = opendir(m_emmcOutputPath.c_str());
+ if (l_dirp != NULL) { // LCOV_EXCL_BR_LINE 5: m_emmcOutputPath is not null, opendir is C code, always ok
+ for (;;) {
+ int l_ret = readdir_r(l_dirp, &l_dirent, &next);
+ if (((l_ret == 0) && (next == NULL))
+ || (l_ret > 0)) {
+ break;
+ }
+ l_checkFileName = l_dirent.d_name;
+ l_pos = l_checkFileName.find(".tar.gz");
+ if (std::string::npos != l_pos) {
+ l_pos = l_checkFileName.find("_");
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 200: tar.gz file is aways has "_"
+ std::string l_numberString = l_checkFileName.substr(0, l_pos);
+ l_count = static_cast<UI_32>(strtoul(l_numberString.c_str(), NULL, 10));
+ l_vector.push_back(l_count);
+ l_maxCount = std::max(l_count, l_maxCount);
+ }
+ }
+ }
+ closedir(l_dirp);
+ } else {
+ // LCOV_EXCL_START 5: m_emmcOutputPath is not null, opendir is C code, always ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ f_counter = 1;
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+
+ // reach at max number
+ if (l_maxCount >= LOGGERSERVICELOG_EMMC_COUNTER_MAX) {
+ RefreshEmmcCounter(m_EmmcCounter);
+ } else {
+ m_EmmcCounter = l_maxCount + 1;
+ }
+ } else if (m_EmmcCounter >= LOGGERSERVICELOG_EMMC_COUNTER_MAX) {
+ // reach at max number
+ RefreshEmmcCounter(m_EmmcCounter);
+ } else {
+ m_EmmcCounter++;
+ }
+
+ f_counter = m_EmmcCounter;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::RefreshEmmcCounter(UI_32& f_counter) const {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_checkFileName;
+ std::vector<std::string> l_vector;
+ DIR *l_dirp;
+ struct dirent l_dirent;
+ struct dirent* next = NULL;
+ size_t l_pos;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // get filename saved frameworkunifiedlog on eMMC Device
+ l_dirp = opendir(m_emmcOutputPath.c_str());
+ if (l_dirp != NULL) { // LCOV_EXCL_BR_LINE 5: m_emmcOutputPath is not null, opendir is C code, always ok
+ for (;;) {
+ int l_ret = readdir_r(l_dirp, &l_dirent, &next);
+ if (((l_ret == 0) && (next == NULL)) || (l_ret > 0)) {
+ break;
+ }
+ l_checkFileName = l_dirent.d_name;
+ l_pos = l_checkFileName.find(".tar.gz");
+ if (std::string::npos != l_pos) {
+ l_pos = l_checkFileName.find("_");
+ if (std::string::npos != l_pos) {
+ l_vector.push_back(l_checkFileName);
+ }
+ }
+ }
+ closedir(l_dirp);
+ } else {
+ // LCOV_EXCL_START 5: m_emmcOutputPath is not null, opendir is C code, always ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // ignore opendir failure. this means saved frameworkunifiedlog is nothing on eMMC Device
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open dir error path=%s errno=%s.",
+ m_emmcOutputPath.c_str(), strerror(errno));
+ f_counter = 1;
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+
+ // sort at log count
+ std::sort(l_vector.begin(), l_vector.end());
+
+ std::vector<std::string>::iterator it;
+ std::string l_orgFilePath;
+ std::string l_renameFilePath;
+ UI_32 l_wpt = 0;
+ UI_32 l_count;
+
+ it = l_vector.begin();
+ while (it != l_vector.end()) {
+ std::stringstream l_nameStream;
+ // get log counter parts
+ l_wpt++;
+ l_checkFileName = *it;
+ l_pos = l_checkFileName.find("_");
+ std::string l_numberString = l_checkFileName.substr(0, l_pos);
+ l_count = static_cast<UI_32>(strtoul(l_numberString.c_str(), NULL, 10));
+
+ // rename file if necessary
+ if (l_count != l_wpt) {
+ l_renameFilePath = l_orgFilePath = m_emmcOutputPath.c_str();
+ l_renameFilePath.append("/");
+ l_orgFilePath.append("/");
+ l_orgFilePath.append(l_checkFileName);
+
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right
+ << std::dec << l_wpt;
+ l_checkFileName.replace(0, l_pos, l_nameStream.str());
+
+ l_renameFilePath.append(l_checkFileName);
+
+ if (rename(l_orgFilePath.c_str(), l_renameFilePath.c_str()) != 0) { // LCOV_EXCL_BR_LINE 5: rename is C code
+ // LCOV_EXCL_START 5: rename is C code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // rename failed but continue reamin log rename because new log need to be saved.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "log file[%s]->[%s] rename failed: err=%s.",
+ l_orgFilePath.c_str(), l_renameFilePath.c_str(), strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+ it++;
+ }
+
+ f_counter = l_wpt + 1;
+
+ // set return value as next log counter
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+BOOL CLoggerCfg::IsUDPLoggingEnabled(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_ret =
+ ((this->m_eLoggerUDPLoggingStatus == eActivate)
+ || (this->m_udpEnvFlag == TRUE)) ? TRUE : FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : %s", (TRUE == l_ret)?"TRUE":"FALSE");
+ return (l_ret);
+}
+
+void CLoggerCfg::AddLoggingParamCB(CbFuncPtr f_fp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (f_fp != NULL) { // LCOV_EXCL_BR_LINE 6: it aways not be null
+ this->m_LoggingCallBack.push_back(f_fp);
+ (void) f_fp(NULL);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+void CLoggerCfg::UpdateLoggingStatus(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::vector<CbFuncPtr>::iterator l_iter;
+ for (l_iter = m_LoggingCallBack.begin(); l_iter != m_LoggingCallBack.end(); l_iter++) { // LCOV_EXCL_BR_LINE 11:Unexpected branch // NOLINT[whitespace/line_length]
+ (void) (*l_iter)(NULL);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetLoggerStorageInfo(SLoggerStorageInfo &f_info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ f_info = m_loggerStorageInfo;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+BOOL CLoggerCfg::IsLoggingEnabled(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ return (this->m_eLoggerStatus == eActivate) ? TRUE : FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+ExternalLogList CLoggerCfg::GetExternalLogList(void) {
+ return (m_ExternalLogList);
+} // LCOV_EXCL_BR_LINE 10:the last line
diff --git a/systemservice/logger_service/server/src/ss_logger_device_detection.cpp b/systemservice/logger_service/server/src/ss_logger_device_detection.cpp
new file mode 100755
index 0000000..04bc4b5
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_device_detection.cpp
@@ -0,0 +1,209 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief This file supports USB logging threads.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+// System Headers
+#include <errno.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#ifdef AGL_STUB
+#else
+#include <sys/usbdi.h>
+#endif
+#include <limits.h>
+#include <string.h>
+#include <native_service/ns_message_center_if.h>
+#include <ss_logger_fs_directory.h>
+#include <boost/bind.hpp>
+
+// Pasa Logs
+#include <loggerservicedebug_loggerservicelog.h>
+#include <ss_logger_device_detection.h>
+#include <loggerservicedebug_thread_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_devicedetection_service_notifications.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <system_service/ss_sm_client_if.h>
+#include <string>
+#include "ss_logger_common.h"
+
+//
+const SI_32 INVALID_FD = -1;
+
+// Max command line length
+const UI_32 MAX_SYS_CMD_LN_LENGTH = 120;
+
+CLoggerDeviceDetection::CLoggerDeviceDetection() :
+ m_pLoggerCfg(NULL),
+ m_loggerUtil(NULL) {
+}
+
+CLoggerDeviceDetection::~CLoggerDeviceDetection() { // LCOV_EXCL_START 14:global instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerDeviceDetection::Initialize(HANDLE f_hApp, CLoggerCfg * f_pLoggerCfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ m_pLoggerCfg = f_pLoggerCfg;
+ // Device Detection Obj initialization
+ if (m_devDetect.Initialize(f_hApp)) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ if (eFrameworkunifiedStatusOK != (l_eStatus = m_devDetect.NotifyOnDeviceDetectionAvailability(
+ boost::bind(&CLoggerDeviceDetection::DD_ServiceAvailabilityCallBack, this, _1) ))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ServiceAvailabilityCallback registration failed");
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = m_devDetect.NotifyOnOpenSessionAck(
+ boost::bind(&CLoggerDeviceDetection::DD_OpenSessionAckCallBack, this, _1) ))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "OpenSessionAckCallback registration failed");
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = m_devDetect.NotifyOnCloseSessionAck(
+ boost::bind(&CLoggerDeviceDetection::DD_CloseSessionAckCallBack, this, _1) ))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CloseSessionCallback registration failed");
+ }
+ } else {
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Device Detection Object Initialization failed!");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+// Function : ServiceAvailabilityCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerDeviceDetection::DD_ServiceAvailabilityCallBack(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (FrameworkunifiedIsServiceAvailable(hApp)) {
+ if (eFrameworkunifiedStatusOK != (eStatus = m_devDetect.OpenSessionRequest())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Open session request failed");
+ }
+ } else {
+ if (eFrameworkunifiedStatusOK != (eStatus = m_devDetect.CloseSessionRequest())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Close session request failed");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : OpenSessionAckCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerDeviceDetection::DD_OpenSessionAckCallBack(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = m_devDetect.DecodeOpenSessionResponse())) {
+ if (eFrameworkunifiedStatusOK != (eStatus = m_devDetect.RegisterForDeviceDetectionEvent(SS_DEV_DETECT_ANY_USB_EV,
+ boost::bind(&CLoggerDeviceDetection::DD_MediaDetectCallBack, this, _1)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Registration for SS_DEV_DETECT_ANY_USB_EV failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Decode open session response failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+//////////////////////////////////////////
+// Function : OpenSessionAckCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerDeviceDetection::DD_CloseSessionAckCallBack(HANDLE hApp) { // LCOV_EXCL_START 200: can not called from devicedetection_service // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CloseSessionAck tCloseSessionAck;
+
+ if (hApp) {
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tCloseSessionAck, sizeof (tCloseSessionAck)))) {
+ if (eFrameworkunifiedStatusOK == tCloseSessionAck.eStatus) {
+ UI_32 l_uiSessionId = tCloseSessionAck.sessionId;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "session %d closed successfully", l_uiSessionId);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerDeviceDetection::DD_CloseSessionWithDevDetectionSrv(HANDLE hApp) { // LCOV_EXCL_START 200: can not called from devicedetection_service // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = m_devDetect.
+ NotifyOnCloseSessionAck(boost::bind(&CLoggerDeviceDetection::DD_CloseSessionAckCallBack, this, _1)))) {
+ if (eFrameworkunifiedStatusOK != (eStatus = m_devDetect.CloseSessionRequest())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to send CloseSessionRequest");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to register closeSessionAckCallback");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerDeviceDetection::DD_MediaDetectCallBack(HANDLE hApp) { // LCOV_EXCL_START 200: can not called from devicedetection_service // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_devstr;
+ std::string l_filePathStr;
+ SS_MediaDetectInfo l_tMediaDetectInfo;
+
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_tMediaDetectInfo, sizeof (l_tMediaDetectInfo)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "FrameworkunifiedGetMsgDataOfSize Failed Status:0x%x ", l_eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Device = %d", l_tMediaDetectInfo.dev_type);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Availability = %d", l_tMediaDetectInfo.bIsDeviceAvailable);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " device path = %s", l_tMediaDetectInfo.deviceMountpath);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " File path = %s", l_tMediaDetectInfo.filepathName);
+
+ if (l_tMediaDetectInfo.dev_type == eUSB) {
+ if (l_tMediaDetectInfo.bIsDeviceAvailable == TRUE && m_pLoggerCfg != NULL) {
+ std::string l_usbMountPath;
+ l_usbMountPath = l_tMediaDetectInfo.deviceMountpath;
+ m_pLoggerCfg->setUsb0MountPath(l_usbMountPath);
+ m_loggerUtil->SetUsbMountPath(l_usbMountPath);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
diff --git a/systemservice/logger_service/server/src/ss_logger_error_event.cpp b/systemservice/logger_service/server/src/ss_logger_error_event.cpp
new file mode 100755
index 0000000..6e82da7
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_error_event.cpp
@@ -0,0 +1,1047 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_error_event.h"
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <boost/bind.hpp>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_client_names.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <stub/el_mem.h>
+#include <native_service/cl_process.h>
+#include <stub/Clock_API.h>
+#include <string>
+#include "loggerservicedebug_loggerservicelog.h"
+#include "loggerservicedebug_thread_if.h"
+#include "ss_logger_service_callbacks.h"
+#include "ss_logger_error_event_archive.h"
+#include "ss_logger_common.h"
+#include "ss_logger_types.h"
+#include "ss_logger_fs_directory.h"
+
+CErrorEvent::CErrorEvent()
+ : m_hApp(NULL),
+ m_bIsPrevEventCompleted(true),
+ m_errorEventNtfData(),
+ m_pLoggerCfg(NULL),
+ m_pReaderWriterControl(NULL),
+ m_ServiceName(""),
+ m_time(0),
+ m_currentEventTriggerNumber(0),
+ m_diagsessionhandle(NULL),
+ m_thrdEvntLogWriter(NULL),
+ m_sfd(-1) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+CErrorEvent::~CErrorEvent() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CErrorEvent::Initialize(HANDLE f_hApp, CLoggerCfg *f_pLoggerCfg,
+ CReaderWriterControl *f_pReaderWriterControl,
+ HANDLE f_thrdEvntLogWriter,
+ std::string f_strEvntLogQueWorkerName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ Timer *l_pTimer;
+
+ m_sfd = CL_ProcessInit();
+ if (m_sfd == -1) { // LCOV_EXCL_BR_LINE 8:Because the process initialization is guaranteed to be successful
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. m_sfd CL_ProcessInit() failed \n."); // LCOV_EXCL_LINE 8:Because the process initialization is guaranteed to be successful
+ }
+
+ SS_LoggerServerEvents l_errorEventStateEvents[] = {
+ SS_LOGGER_SCREENCAPTURE_EVT };
+
+ FrameworkunifiedProtocolCallbackHandler l_smCallbacks[] = {
+ // Logging Protocol Callbacks
+ { SS_SM_EVENT_ERROR_TO_SSL, boost::bind(&CErrorEvent::OnStartLogging,
+ this, _1) }, {
+ SS_SM_ERROR_EVENT_LOGGING_START_RSPN, boost::bind(
+ &CErrorEvent::OnLogStartResponse, this, _1) }, {
+ SS_SM_ERROR_EVENT_ARTIFACT_RSPN, boost::bind(
+ &CErrorEvent::OnArtifactResponse, this, _1) } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ FrameworkunifiedProtocolCallbackHandler l_selfCallbacks[] = {
+ // Logging Protocol Callbacks
+ { SS_LOGGER_ERROR_EVENT_ARTIFACT_REQ, boost::bind(
+ &CErrorEvent::OnArtifactRequest, this, _1) }, {
+ SS_SM_ERROR_EVENT_ARTIFACT_RSPN, boost::bind(
+ &CErrorEvent::OnArtifactResponse, this, _1) } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ FrameworkunifiedProtocolCallbackHandler l_requesterCallbacks[] = { {
+ SS_LOGGER_SCREENCAPTURE_EVT_ACK, boost::bind(
+ &CErrorEvent::OnObtainScreenShotResponse, this, _1) } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ FrameworkunifiedProtocolCallbackHandler l_storageThreadCallbacks[] = { {
+ eLoggerStorageThreadCmdOK, boost::bind(&CErrorEvent::OnStorageResponseOk,
+ this, _1) }, {
+ eLoggerStorageThreadCmdWriteFailed, boost::bind(
+ &CErrorEvent::OnStorageResponseWriteFailed, this, _1) }, {
+ eLoggerStorageThreadCmdNotFound, boost::bind(
+ &CErrorEvent::OnStorageResponseNotFound, this, _1) }, {
+ eLoggerStorageThreadCmdNoWritten, boost::bind(
+ &CErrorEvent::OnStorageResponseNoWritten, this, _1) } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ for (UI_32 i = 0; i < _countof(l_requesterCallbacks); i++) {
+ m_requesterCallbacksVec.push_back(l_requesterCallbacks[i]); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+
+ if (NULL == f_hApp) { // LCOV_EXCL_BR_LINE 6:As it is not always NULL
+ // LCOV_EXCL_START 6:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " Error. Argument f_hApp passed NULL pointer. Initialization failed.");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (m_thrdEvntLogWriter = f_thrdEvntLogWriter)) { // LCOV_EXCL_BR_LINE 6:As it is not always NULL
+ // LCOV_EXCL_START 6:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " Error. Argument f_hApp passed NULL pointer. Initialization failed.");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_errorEventCfg.Initialize(f_pLoggerCfg))) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_errorEventCfg.Initialize() returned: %d.", l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(f_hApp, SERVICE_LOGGER, l_selfCallbacks, _countof(l_selfCallbacks)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. FrameworkunifiedAttachCallbacksToDispatcher(SERVICE_SYSMANAGER) returned: %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(f_hApp, SERVICE_SYSMANAGER, l_smCallbacks, _countof(l_smCallbacks)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. FrameworkunifiedAttachCallbacksToDispatcher(SERVICE_SYSMANAGER) returned: %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedDefineStateEvents(f_hApp, &l_errorEventStateEvents, static_cast<UI_32>(_countof(l_errorEventStateEvents))))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. FrameworkunifiedDefineStateEvents(SS_LOGGER_SCREENCAPTURE_EVT) returned: %d",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (NULL == f_pLoggerCfg) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ // LCOV_EXCL_START 200:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. f_pLoggerCfg passed NULL pointer.");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_loggerPopups.Initialize(f_pLoggerCfg))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_loggerPopups.Initialize(f_pLoggerCfg) returned: %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (NULL == f_pReaderWriterControl) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ // LCOV_EXCL_START 200:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Argument f_pReaderWriterControl passed NULL pointer.");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_loggerStorage.Initialize(f_hApp, AppName, f_pLoggerCfg))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_loggerPopups.Initialize(f_pLoggerCfg) returned: %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher( f_hApp, ERROR_EVENT_STORAGE_QUEUE_NAME, l_storageThreadCallbacks, _countof(l_storageThreadCallbacks)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. FrameworkunifiedAttachCallbacksToDispatcher(ERROR_EVENT_STORAGE_QUEUE_NAME) returned: %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_loggerCanEvent.Initialize(f_pLoggerCfg))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_loggerCanEvent.Initialize() returned: %d.", l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ m_hApp = f_hApp;
+ m_pLoggerCfg = f_pLoggerCfg;
+ m_pReaderWriterControl = f_pReaderWriterControl;
+ l_eStatus = m_loggerUtil.Initialize(m_pLoggerCfg); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 5:macro
+ "CLoggerUtil::m_loggerUtil.Initialize(m_pLoggerCfg)");
+
+ l_pTimer = &m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN];
+ l_pTimer->Initialize(
+ f_hApp, SS_LOGGER_ERROR_EVENT_TIMER_ID_LOGGING_START_RSPN,
+ boost::bind(&CErrorEvent::OnLogStartResponseTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ l_pTimer = &m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN];
+ l_pTimer->Initialize(
+ f_hApp, SS_LOGGER_ERROR_EVENT_TIMER_ID_ARTIFACT_RESPONSE,
+ boost::bind(&CErrorEvent::OnArtifactResponseTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ m_ServiceName = "";
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : RegisterSessionErrorEvent
+// brief : Register session event. This function is called within the
+// context of the System Manager session acknowledgment handler.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::RegisterSessionErrorEvent(HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = FrameworkunifiedRegisterEvent(f_hSession, SS_SM_EVENT_ERROR_TO_SSL);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedRegisterEvent(SS_SM_EVENT_ERROR_TO_SSL)"); // LCOV_EXCL_BR_LINE 5:macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnOpenSession
+// brief : Called when a requester opens a session with SS_Logger
+// service. This function attaches error event callbacks
+// to the dispatcher with the source set to the requester.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnOpenSession(HANDLE f_hApp, PCSTR f_pRequesterName,
+ HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(f_hApp, f_pRequesterName,
+ &m_requesterCallbacksVec[0],
+ static_cast<UI_32>(m_requesterCallbacksVec.size()),
+ f_hSession);
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedAttachCallbacksToDispatcher(f_hSession)"); // LCOV_EXCL_BR_LINE 5:macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnOpenSession
+// brief : Called when a requester opens a session with SS_Logger
+// service. This function attaches error event callbacks
+// to the dispatcher with the source set to the requester.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnCloseSession(HANDLE f_hApp, PCSTR f_pRequesterName,
+ HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_cmdIdArr[m_requesterCallbacksVec.size()]; // NOLINT (runtime/arrays)
+
+ for (UI_32 i = 0; i < m_requesterCallbacksVec.size(); i++) {
+ l_cmdIdArr[i] = m_requesterCallbacksVec[i].iCmd;
+ }
+
+ l_eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(f_hApp, f_pRequesterName,
+ l_cmdIdArr,
+ static_cast<UI_32>(m_requesterCallbacksVec.size()),
+ f_hSession);
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedAttachCallbacksToDispatcher()"); // LCOV_EXCL_BR_LINE 5:macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnStartLogging
+// brief : Called by SS_Logger and external services to begin logging
+// artifact collection. This function sends a logging request
+// to System Manager. See SS_SM_EVENT_ERROR_TO_SSL.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnStartLogging(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SMErrorEventNtfData l_eventErrorNtfData;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 5:macro
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<SMErrorEventNtfData>(f_hApp, l_eventErrorNtfData))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // when failed to ReadMsg, we can't know event-type for action, so nothing is able to do.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 200:To ensure success
+ } else {
+ if (TRUE == this->m_pLoggerCfg->IsLoggingEnabled()) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ if (TRUE == m_bIsPrevEventCompleted) {
+ TLoggerErrorEvent l_eventData = l_eventErrorNtfData;
+
+ if (IsNeedVerify(l_eventData.EventType)) {
+ // if need output log to external storage, check whether device is authenticated or not.
+ VerifyExtStorage(l_eventData);
+ }
+
+ uint8_t status;
+ Clock_getSystemTimeY2K38(&m_time, &status);
+ m_currentEventTriggerNumber = m_pLoggerCfg->GetUserInvokedCounter();
+ l_eStatus = m_loggerUtil.checkDestinationAvailable(l_eventData);
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ m_bIsPrevEventCompleted = false; /* See timer start / timeout handler below. */
+
+ m_artifactResponseVec.clear();
+
+ m_errorEventNtfData = l_eventErrorNtfData; /* Overwrite m_eventErrorNtfData when logging complete. */
+ m_errorEventNtfData.EventBitMask = m_errorEventCfg
+ .GetEventsForErrorEvent(l_eventErrorNtfData.EventType);
+ l_eStatus = SendLogStartRequestToSystemManager(
+ m_errorEventNtfData.EventType);
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendLogStartRequestToSystemManager()");
+ l_eStatus = m_loggerCanEvent.PublishStartEvent(f_hApp,
+ m_errorEventNtfData);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerCanEvent.PublishStartEvent(f_hApp,m_errorEventNtfData);");
+
+ bool result =
+ m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN]
+ .Start(m_loggingStartRspnToSec, 0, 0, 0);
+ if (FALSE == result) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ // LCOV_EXCL_START 200:As it is always TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Failed to start timer kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN.");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. Destination not available. ");
+ m_errorEventNtfData = l_eventErrorNtfData; /* Overwrite m_eventErrorNtfData when logging complete. */
+ m_errorEventNtfData.EventBitMask = m_errorEventCfg
+ .GetEventsForErrorEvent(l_eventErrorNtfData.EventType);
+ l_eStatus = OnStorageResponseNotFound(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnStorageResponseNotFound(f_hApp)");
+ }
+ } else {
+ // Not-Need Resp to SM, because of keep logging sequance.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Logging already in progress. Event dropped.");
+ }
+ } else {
+ // LCOV_EXCL_START 200:As it is always TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (l_eventErrorNtfData.isNeedReboot == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "System will reboot soon, so stop logging function.");
+ StopLoggingFunction(f_hApp);
+ }
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Logging is disabled! Dropping Event. Sending Complete to SS_SystemManager");
+ l_eStatus = SendLogCompleteRequestToSystemManager(eFrameworkunifiedStatusFail);
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendLogCompleteRequestToSystemManager()");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnLogStartResponse
+// brief : Called by System Manager after the acknowledgment of the
+// logging session start request. This function starts the
+// artifact collection process. See
+// SS_SM_ERROR_EVENT_LOGGING_START_RSPN.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnLogStartResponse(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN].Stop();
+ m_errorEventCfg.GetArtifactRequestVec(m_errorEventNtfData.EventType,
+ m_artifactRequestVec);
+
+ l_eStatus = RequestNextArtifact(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "RequestNextArtifact()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnLogStartResponseTimeout
+// brief : Called when / if SM fails to respond to a logging start
+// request and the logging star response timer expires.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnLogStartResponseTimeout(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. SM failed to respond to a logging start request in the required amount of time.");
+
+ m_bIsPrevEventCompleted = TRUE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : RequestNextArtifact
+// brief : This function requests the next artifact from the service
+// that owns the artifact. If no artifacts remain, this
+// function performs initiates artifact post processing.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::RequestNextArtifact(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_timeoutSec;
+ UI_32 l_timeoutMs;
+
+ if (0 != m_artifactRequestVec.size()) {
+ TLoggingArtifact &l_nextArtifact = m_artifactRequestVec.back();
+ l_eStatus = m_loggerPopups.ShowStartPopup(
+ f_hApp, m_errorEventNtfData, &m_artifactRequestVec,
+ m_loggerUtil.getDestination(m_errorEventNtfData));
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerPopups.ShowStartPopup(f_hApp,m_errorEventNtfData,&m_artifactRequestVec )");
+
+ TEXT(__FUNCTION__,
+ "Requesting next artifact ID:%d from:%s, with timeout:%d ms.",
+ l_nextArtifact.ArtifactId,
+ l_nextArtifact.Information.OwnerServiceName.c_str(),
+ l_nextArtifact.Information.RequestTimeoutMs);
+
+ l_timeoutSec = l_nextArtifact.Information.RequestTimeoutMs / 1000;
+ l_timeoutMs = l_nextArtifact.Information.RequestTimeoutMs % 1000;
+ bool result =
+ m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN].Start(
+ l_timeoutSec, l_timeoutMs, 0, 0);
+ if (FALSE == result) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ // LCOV_EXCL_START 200:As it is always TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to start timer kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN.");
+ // LCOV_EXCL_STOP
+ }
+ switch (l_nextArtifact.Information.Cb.Type) {
+ case eCbTypePath: {
+ l_eStatus = CheckPathForArtifact(f_hApp, l_nextArtifact);
+ }
+ break;
+
+ case eCbTypeFunction: {
+ if (l_nextArtifact.Information.Cb.Function == NULL) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 200:As it is not always NULL
+ } else {
+ l_eStatus = l_nextArtifact.Information.Cb.Function(f_hApp,
+ l_nextArtifact);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "l_nextArtifact.Information.Cb.Function(f_hApp, l_nextArtifact)");
+ }
+ }
+ break;
+
+ case eCbTypeInvalid:
+ default:
+ {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Unknown artifact or artifact owner for artifact ID:"
+ " %d. Invalid logging artifact configuration likely.",
+ l_nextArtifact.ArtifactId);
+ }
+ break;
+ }
+ } else {
+ if ((m_errorEventNtfData.EventType == eErrorEventTypeUserInvokedClearLogs)
+ || (m_errorEventNtfData.EventType
+ == eErrorEventTypeUserInvokedCollectNaviLog)) {
+ l_eStatus = this->OnStorageResponseOk(f_hApp);
+ return (l_eStatus);
+ }
+ uint8_t status;
+ Clock_getSystemTimeY2K38(&m_time, &status);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. All logging error event artifacts have been collected.");
+ l_eStatus = m_loggerUtil.checkDestinationAvailable(m_errorEventNtfData);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerUtil.checkDestinationAvailable(m_errorEventNtfData)");
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ /* Check one last time after all logs have been collected */
+ /* if we should show popup for archiving and writing to USB */
+ l_eStatus = m_loggerPopups.ShowStartPopup(
+ f_hApp, m_errorEventNtfData, &m_artifactRequestVec,
+ m_loggerUtil.getDestination(m_errorEventNtfData));
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerPopups.ShowStartPopup(f_hApp,m_errorEventNtfData,&m_artifactRequestVec )");
+
+ l_eStatus = m_loggerUtil.getFilePathAndName(f_hApp, m_errorEventNtfData,
+ m_time, m_archiveDestination);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerUtil.getFilePathAndName()");
+
+ std::string destination_path = m_loggerUtil.getDestination(
+ m_errorEventNtfData);
+ if (destination_path.compare(m_pLoggerCfg->m_emmcOutputPath) == 0) {
+ if (eFrameworkunifiedStatusOK
+ != m_loggerUtil.deleteOldEmmcLog(m_archiveDestination,
+ m_errorEventNtfData.EventType)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_loggerUtil.deleteOldEmmcLog()");
+ }
+ }
+
+ l_eStatus = this->m_loggerStorage.Start(m_archiveDestination,
+ this->m_artifactResponseVec,
+ m_time);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerStorage.Start()");
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ l_eStatus = this->OnStorageResponseWriteFailed(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "this->OnStorageResponseWriteFailed(f_hApp)");
+ }
+ } else {
+ l_eStatus = this->OnStorageResponseNotFound(f_hApp);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "this->OnStorageResponseNotFound(f_hApp)");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnArtifactResponse
+// brief : This function is called when an artifact has been made ready
+// by the owning service.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnArtifactResponse(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ARTIFACT_RESPONSE l_artifactResponse;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<ARTIFACT_RESPONSE>(f_hApp, l_artifactResponse))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 200:To ensure success
+ } else {
+ m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN].Stop();
+
+ // Prevent processing of artifacts that arrive after the error event logging session has completed.
+ if (m_artifactRequestVec.size() > 0) {
+ TEXT(__FUNCTION__, "Artifact ID:%d received.",
+ l_artifactResponse.ArtifactId);
+
+ TLoggingArtifact &l_artifactCurr = m_artifactRequestVec.back();
+ if (l_artifactCurr.ArtifactId != l_artifactResponse.ArtifactId) {
+ TEXT(
+ __FUNCTION__,
+ "Failure collecting current artifact. Expected artifact ID:%d, received artifact ID:%d."
+ " Ignoring received artifact.",
+ l_artifactCurr.ArtifactId, l_artifactResponse.ArtifactId);
+ } else {
+ TLoggingArtifactResponse l_response;
+ l_response.ArtifactId = l_artifactResponse.ArtifactId;
+ l_response.Filepath = l_artifactResponse.FilePathAndName;
+ l_response.Remove = l_artifactCurr.Information.Remove;
+ m_artifactResponseVec.push_back(l_response);
+ m_artifactRequestVec.pop_back(); // Remove received artifact from request vector.
+ l_eStatus = RequestNextArtifact(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "RequestNextArtifact()");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Received spurious artifact ID: %d. No error event logging session active.",
+ l_artifactResponse.ArtifactId); // LCOV_EXCL_BR_LINE 5:macro
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnArtifactResponseTimeout
+// brief : This function is called when a requested artifact response
+// fails to arrive in the required amount of time.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnArtifactResponseTimeout(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (m_artifactRequestVec.size() > 0) { // LCOV_EXCL_BR_LINE 200:As it cannot always be 0
+ TLoggingArtifact &l_artifactCurr = m_artifactRequestVec.back();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Artifact response timer expired for artifact ID: %d.",
+ l_artifactCurr.ArtifactId);
+
+ // Remove artifact from request vector.
+ m_artifactRequestVec.pop_back();
+
+ RequestNextArtifact(f_hApp);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnArtifactRequest
+// brief : This function services an artifact request generated by
+// the error event sub system. The requested artifact will
+// be one of the artifacts owned by SSL.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnArtifactRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EArtifactId l_requestedArtifactId;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<EArtifactId>(f_hApp, l_requestedArtifactId))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ switch (l_requestedArtifactId) {
+ case eArtifactIdInterfaceunifiedDebugLog:
+ l_eStatus = OnObtainLoggerserviceLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainLoggerserviceLogRequest()");
+ break;
+
+ case eArtifactIdTransmitLog:
+ l_eStatus = OnObtainTransmitLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainTransmitLogRequest()");
+ break;
+
+ case eArtifactIdPerformanceLog:
+ l_eStatus = OnObtainPerformanceLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainPerformanceLogRequest()");
+ break;
+
+ case eArtifactIdScreenShot:
+ l_eStatus = OnObtainScreenShotRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainScreenShotRequest()");
+ break;
+
+ case eArtifactIdKernelLog:
+ l_eStatus = OnObtainKernelLogInfoRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainKernelLogInfoRequest()");
+ break;
+
+ case eArtifactIdDRInitialLog:
+ l_eStatus = OnObtainDRInitialLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainDRInitialLogRequest()");
+ break;
+
+ case eArtifactIdDRLocationLog:
+ l_eStatus = OnObtainDRLocationLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainDRLocationLogRequest()");
+ break;
+
+ case eArtifactIdClearAllLog:
+ l_eStatus = OnClearAllLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnClearAllLogRequest()");
+ break;
+
+ case eArtifactIdNaviLog:
+ l_eStatus = OnNaviLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnNaviLogRequest()");
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Unsupported logging artifact requested: %d.",
+ l_requestedArtifactId);
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnStorageResponseOk
+// brief : This function services response from the storage thread. It
+// is called when the logs have been stored successfully.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnStorageResponseOk(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = this->m_loggerPopups.ShowEndPopup(f_hApp, m_errorEventNtfData,
+ m_archiveDestination);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "this->m_loggerPopups.ShowEndPopup(f_hApp,m_errorEventNtfData,m_archiveDestination)");
+
+ if (m_errorEventNtfData.EventType == eErrorEventTypeDiagEvent) {
+ l_eStatus = sendDiagEventResponse();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "sendDiagEventResponse()");
+ }
+ if (m_errorEventNtfData.isNeedReboot == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "System will reboot soon, so stop logging function.");
+ StopLoggingFunction(f_hApp);
+ }
+ m_bIsPrevEventCompleted = true;
+ l_eStatus = SendLogCompleteRequestToSystemManager(eFrameworkunifiedStatusOK);
+
+ l_eStatus = m_loggerCanEvent.PublishEndEvent(f_hApp, m_errorEventNtfData,
+ m_currentEventTriggerNumber,
+ m_time);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_loggerCanEvent.PublishEndEvent();");
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendLogCompleteRequestToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnStorageResponseWriteFailed
+// brief : This function services response from the storage thread. It
+// is called when the logs failed to be written to the target
+// destination.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnStorageResponseWriteFailed(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = m_loggerPopups.ShowErrorPopup(f_hApp, m_errorEventNtfData,
+ (UI_16) eWriteToDeviceFailed);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "m_loggerPopups.ShowErrorPopup(f_hApp, eWriteToDeviceFailed)");
+
+ if (m_errorEventNtfData.EventType == eErrorEventTypeDiagEvent) {
+ sendDiagEventErrorResponse(eDEVICE_WRITE_ERROR);
+ }
+ if (m_errorEventNtfData.isNeedReboot == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "System will reboot soon, so stop logging function.");
+ StopLoggingFunction(f_hApp);
+ }
+ m_bIsPrevEventCompleted = true;
+ l_eStatus = SendLogCompleteRequestToSystemManager(eFrameworkunifiedStatusFail);
+
+ l_eStatus = m_loggerCanEvent.PublishErrorEvent(f_hApp, m_errorEventNtfData,
+ TRUE,
+ m_currentEventTriggerNumber,
+ m_time);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_loggerCanEvent.PublishErrorEvent();");
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendLogCompleteRequestToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnStorageResponseNotFound
+// brief : This function services response from the storage thread. It
+// is called when the logs failed to be written to the target
+// destination because the target was not found
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnStorageResponseNotFound(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = m_loggerPopups.ShowErrorPopup(f_hApp, m_errorEventNtfData,
+ (UI_16) eSelectedDeviceNotFound);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerPopups.ShowErrorPopup(f_hApp, eSelectedDeviceNotFound)");
+
+ if (m_errorEventNtfData.EventType == eErrorEventTypeDiagEvent) {
+ l_eStatus = sendDiagEventErrorResponse(eDEVICE_NOT_AVAILABLE);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "sendDiagEventErrorResponse(eDEVICE_NOT_AVAILABLE)");
+ }
+ if (m_errorEventNtfData.isNeedReboot == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "System will reboot soon, so stop logging function.");
+ StopLoggingFunction(f_hApp);
+ }
+ m_bIsPrevEventCompleted = true;
+ l_eStatus = SendLogCompleteRequestToSystemManager(eFrameworkunifiedStatusFail);
+
+ l_eStatus = m_loggerCanEvent.PublishErrorEvent(f_hApp, m_errorEventNtfData,
+ TRUE,
+ m_currentEventTriggerNumber,
+ m_time);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_loggerCanEvent.PublishErrorEvent();");
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendLogCompleteRequestToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnStorageResponseNoWritten
+// brief : This function services response from the storage thread. It
+// is called when no logs where found.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnStorageResponseNoWritten(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = m_loggerPopups.ShowErrorPopup(f_hApp, m_errorEventNtfData,
+ (UI_16) eNoLogToStore);
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "m_loggerPopups.ShowErrorPopup(f_hApp, eNoLogToStore)");
+
+ if (m_errorEventNtfData.EventType == eErrorEventTypeDiagEvent) {
+ l_eStatus = sendDiagEventErrorResponse(eNO_ERROR_INFO);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "sendDiagEventErrorResponse(eNO_ERROR_INFO)");
+ }
+ if (m_errorEventNtfData.isNeedReboot == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "System will reboot soon, so stop logging function.");
+ StopLoggingFunction(f_hApp);
+ }
+ m_bIsPrevEventCompleted = true;
+ l_eStatus = SendLogCompleteRequestToSystemManager(eFrameworkunifiedStatusOK);
+
+ l_eStatus = m_loggerCanEvent.PublishErrorEvent(f_hApp, m_errorEventNtfData,
+ TRUE,
+ m_currentEventTriggerNumber,
+ m_time);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_loggerCanEvent.PublishErrorEvent();");
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendLogCompleteRequestToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEvent::sendDiagEventErrorResponse(EELL_ErrorCode f_errCode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (this->m_ServiceName.length() > 0) {
+ l_eStatus = sendDiagEventErrorResponse(f_errCode, this->m_ServiceName);
+ this->m_ServiceName = "";
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEvent::sendDiagEventErrorResponse(EELL_ErrorCode f_errCode,
+ std::string f_destName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(m_diagsessionhandle, SS_LOGGERCOPYEMERGENCYLOGS_ERROR_RESP, sizeof(EELL_ErrorCode), &f_errCode))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SS_LOGGERCOPYEMERGENCYLOGS_ERROR_RESP Msg send failed = %x",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEvent::sendDiagEventResponse(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(m_diagsessionhandle, SS_LOGGERCOPYEMERGENCYLOGS_SUCCESS_RESP, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SS_LOGGERCOPYEMERGENCYLOGS_SUCCESS_RESP Msg send failed = %x",
+ l_eStatus);
+ }
+
+ m_ServiceName = "";
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEvent::SetDiagEventSourceName(std::string f_serviceName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if ((f_serviceName.length() > 0)
+ && (this->m_ServiceName.length() == 0)) {
+ this->m_ServiceName = f_serviceName;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. f_serviceName(%s), m_serviceName(%s)",
+ f_serviceName.c_str(), m_ServiceName.c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+void CErrorEvent::SetDiagSessionHandle(HANDLE f_sessionhandle) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_diagsessionhandle = f_sessionhandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+void CErrorEvent::SetMileage(UI_32 f_mileage) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ this->m_loggerUtil.SetMilage(f_mileage);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+// LCOV_EXCL_START 200:
+EFrameworkunifiedStatus CErrorEvent::SaveNaviLog(EPWR_SHUTDOWN_TRIGGER_TYPE errType) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_logMaxNum = 0;
+ std::string l_Filename = "";
+
+ uint32_t l_time;
+ uint8_t status;
+ Clock_getSystemTimeY2K38(&l_time, &status);
+ l_eStatus = m_loggerUtil.getEmmcNaviLogParams(l_time, errType, l_Filename,
+ l_logMaxNum);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: getEmmcNaviLogParams NaviLog update failed %d", l_eStatus);
+ } else {
+ if (l_logMaxNum == 0) {
+ /*OutputNaviLogNmlMax or OutputNaviLogErrMax = 0. */
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_WARN,
+ __FUNCTION__,
+ " Warning: Not update NaviLog. OutputNaviLogNmlMax or OutputNaviLogErrMax = 0");
+ } else {
+ FILE *fp;
+ void *p;
+ p = EL_mem_exram_mmap_simple(EL_MEM_ID_NAVI_LOG, PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+ EL_MEM_CACHE_INVALID);
+ if (p == MAP_FAILED) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error : EL_mem_exram_mmap_simple MAP_FAILD");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ fp = fopen(l_Filename.c_str(), "wb");
+ if (fp == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open file %s",
+ l_Filename.c_str());
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ } else {
+ fwrite(p, sizeof(unsigned char), EL_mem_getLength(EL_MEM_ID_NAVI_LOG),
+ fp);
+ fclose(fp);
+ }
+ if (0 != EL_mem_exram_munmap(p, EL_mem_getLength(EL_MEM_ID_NAVI_LOG))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : EL_mem_exram_munmap");
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CErrorEvent::VerifyExtStorage(TLoggerErrorEvent event) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string f_path;
+
+ f_path = m_pLoggerCfg->getUsb0MountPath();
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+
+ if (eFrameworkunifiedStatusFail == l_eStatus) {
+ // timeout or error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : get secure log failed or timeout");
+ }
+ } else {
+ // timeout
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : ticket verify timeout.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+bool CErrorEvent::IsNeedVerify(EErrorEventType type) {
+ bool ret = false;
+ switch (type) {
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeInterfaceunifiedEmmcLogs:
+ case eErrorEventTypeEelExport:
+ case eErrorEventTypeDiagEvent:
+ case eErrorEventTypeCanEvent:
+ ret = true;
+ break;
+ default:
+ break;
+ }
+ return ret;
+}
diff --git a/systemservice/logger_service/server/src/ss_logger_error_event_archive.cpp b/systemservice/logger_service/server/src/ss_logger_error_event_archive.cpp
new file mode 100755
index 0000000..b718705
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_error_event_archive.cpp
@@ -0,0 +1,413 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_error_event_archive.h"
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <libtar_listhash.h>
+#include <libtar.h>
+#include <zlib.h>
+#include <stdio.h>
+#include <boost/bind.hpp>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include "ss_logger_util.h"
+#include "loggerservicedebug_loggerservicelog.h"
+#include "ss_logger_fs_directory.h"
+
+// GZF save variables
+static gzFile g_gzFile;
+
+CErrorEventArchive::CErrorEventArchive(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_pTarInfo = NULL;
+ g_gzFile = NULL;
+ m_gztype.openfunc = (openfunc_t) &CErrorEventArchive::gzOpenArchive;
+ m_gztype.closefunc = (closefunc_t) &CErrorEventArchive::gzCloseArchive;
+ m_gztype.readfunc = (readfunc_t) &CErrorEventArchive::gzReadArchive;
+ m_gztype.writefunc = (writefunc_t) &CErrorEventArchive::gzWriteArchive;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+CErrorEventArchive::~CErrorEventArchive(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (NULL != m_pTarInfo) { // LCOV_EXCL_BR_LINE 6: it will close after close
+ // LCOV_EXCL_START 6: it will close after close
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void) closeArchive();
+ m_pTarInfo = NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus CErrorEventArchive::openArchive(std::string f_pathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == m_pTarInfo) { // LCOV_EXCL_BR_LINE 6: closeArchive will be set to null
+ m_pathAndName = f_pathAndName;
+
+ /* check if directory exists */
+ size_t l_found = f_pathAndName.find_last_of('/');
+ std::string l_path = f_pathAndName.substr(0, l_found);
+
+ if (0 != access(l_path.c_str(), F_OK)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Directory does not exist. Creating...");
+ l_eFrameworkunifiedStatus = CFSDirectory::CreateDirectory(l_path);
+ }
+
+ /* create archive in tmp */
+ m_tmpName = "/tmp/log.tar.gz";
+
+ int l_tarRetVal = tar_open(&m_pTarInfo, const_cast<char*>(m_tmpName.c_str()),
+ &m_gztype,
+ O_WRONLY | O_CREAT,
+ TARMODE,
+ TAR_GNU);
+
+ if ((l_tarRetVal != 0) || (m_pTarInfo == NULL) || (g_gzFile == NULL)) { // LCOV_EXCL_BR_LINE 5: tar_open's error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5: tar_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open TAR-Archive!");
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: closeArchive will be set to null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Tar is still open");
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+EFrameworkunifiedStatus CErrorEventArchive::addToArchive(std::string f_filePathAndName,
+ std::string f_destinationName,
+ UI_8 f_depth) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFileLoadError;
+ struct stat l_stat;
+ int l_statRetVal;
+
+ if (0 != access(f_filePathAndName.c_str(), F_OK)) { // LCOV_EXCL_BR_LINE 200: file is aways exist
+ // LCOV_EXCL_START 200: file is aways exist
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. The specified file path and name does not exist: %s",
+ f_filePathAndName.c_str());
+ // LCOV_EXCL_STOP
+ } else if (0 != (l_statRetVal = stat(f_filePathAndName.c_str(), &l_stat))) { // LCOV_EXCL_BR_LINE 5: stat's error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5: stat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. stat() for file or directory returned error: %s -> %d",
+ f_filePathAndName.c_str(), l_statRetVal);
+ // LCOV_EXCL_STOP
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ if (0 < f_depth) { // LCOV_EXCL_BR_LINE 6: it aways 4
+ l_eFrameworkunifiedStatus = addDirectoryToArchive(f_filePathAndName, f_destinationName,
+ f_depth);
+ } else {
+ // LCOV_EXCL_START 6: it aways 4
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Maximum recursive depth reached! File %s not added to archive.",
+ f_filePathAndName.c_str());
+ // LCOV_EXCL_STOP
+ }
+ } else if (0 != S_ISREG(l_stat.st_mode)) { // LCOV_EXCL_BR_LINE 200: it can not be a symbolic link
+ l_eFrameworkunifiedStatus = addFileToArchive(f_filePathAndName, f_destinationName);
+ } else {
+ // LCOV_EXCL_START 200: it can not be a symbolic link
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. specified file may be a symbolic link or other non 'regular' type. File: %s, mode: 0x%04X.",
+ f_filePathAndName.c_str(), l_stat.st_mode);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CErrorEventArchive::addToArchive(
+ std::vector<std::string> f_filePathAndNameList) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ std::vector<std::string>::iterator l_vIter = f_filePathAndNameList.begin();
+ while ((eFrameworkunifiedStatusOK == l_eFrameworkunifiedStatus)
+ && (l_vIter != f_filePathAndNameList.end())) {
+ l_eFrameworkunifiedStatus = addToArchive(*l_vIter, *l_vIter);
+ l_vIter++;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CErrorEventArchive::closeArchive(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (0 != tar_append_eof(m_pTarInfo)) { // LCOV_EXCL_BR_LINE 5: tar_append_eof's error case.
+ // LCOV_EXCL_START 5: tar_append_eof's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_append_eof()");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ if (0 != tar_close(m_pTarInfo)) { // LCOV_EXCL_BR_LINE 5: tar_close's error case.
+ // LCOV_EXCL_START 5: tar_close's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not close archive");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ m_pTarInfo = NULL;
+ g_gzFile = NULL;
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 6: it aways be ok
+#ifdef RELEASE_BUILD
+ l_eStatus = CLoggerUtil::PathCheckAndCopyFile(m_tmpName, m_pathAndName);
+#else
+ l_eStatus = CLoggerUtil::CopyFile(m_tmpName, m_pathAndName);
+#endif // RELEASE_BUILD
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ l_eStatus =
+ (0 == remove(m_tmpName.c_str())) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFault;
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 5: remove's error case.
+ // LCOV_EXCL_START 5: remove's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_WARN,
+ __FUNCTION__,
+ " Warning. Failed to remove temporary archive. Will overwrite on next event");
+ // LCOV_EXCL_STOP
+ }
+ } else if (eFrameworkunifiedStatusErrNoEAGAIN == l_eStatus) { // LCOV_EXCL_BR_LINE 200: write can not be ErrNoEAGAIN
+ // LCOV_EXCL_START 200: write can not be ErrNoEAGAIN
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // disk space full
+ struct stat st_buf;
+ size_t req_size;
+ if (stat(m_tmpName.c_str(), &st_buf) != -1) { // LCOV_EXCL_BR_LINE 5: stat's error case.
+ req_size = st_buf.st_size;
+ if (eFrameworkunifiedStatusOK
+ == CLoggerUtil::forceDeleteOldLog(m_pathAndName, req_size)) {
+#ifdef RELEASE_BUILD
+ l_eStatus = CLoggerUtil::PathCheckAndCopyFile(m_tmpName, m_pathAndName);
+#else
+ l_eStatus = CLoggerUtil::CopyFile(m_tmpName, m_pathAndName);
+#endif // RELEASE_BUILD
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200: PathCheckAndCopyFile can not be fail
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Try Again but Error. Failed to copy to destination.%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. force delete failed.%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " emmc full: dest=%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ } else {
+ // LCOV_EXCL_START 5: stat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Warning. Failed to get tmp log file stat. dest=%s",
+ m_pathAndName.c_str());
+ // LCOV_EXCL_STOP
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ /*should we copy lost archive to emmc??*/
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Failed to copy to destination. %s", m_pathAndName.c_str());
+ }
+ remove(m_tmpName.c_str());
+ m_tmpName = "";
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEventArchive::addFileToArchive(std::string f_filename,
+ std::string f_destinationName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK; /*check if Tar is open and if file can be read */
+
+ char path[PATH_MAX];
+
+ if ((NULL != m_pTarInfo) && (0 != f_destinationName.length()) // LCOV_EXCL_BR_LINE 200: it will awalys be true
+ && (realpath(f_filename.c_str(), path) != NULL)) {
+ int l_tarRetVal = tar_append_file(m_pTarInfo, path,
+ const_cast<char*>(f_destinationName. c_str()));
+ if (0 != l_tarRetVal) { // LCOV_EXCL_BR_LINE 5: tar_append_file's error case.
+ // LCOV_EXCL_START 5: tar_append_file's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not add file \'%s\' to tar archive.", f_filename.c_str());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: it will awalys be true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Archive not opened or could not access file: \"%s\"",
+ f_filename.c_str());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+EFrameworkunifiedStatus CErrorEventArchive::addDirectoryToArchive(
+ std::string f_path, std::string f_destinationName, UI_8 f_depth) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ struct dirent l_pDirent;
+ struct dirent* next;
+
+ DIR *l_pDir = opendir(f_path.c_str());
+ if (l_pDir != NULL) { // LCOV_EXCL_BR_LINE 5: opendir's error case.
+ while (0 == readdir_r(l_pDir, &l_pDirent, &next) && next != NULL) {
+ if ((0 != strcmp(l_pDirent.d_name, ".")) && /* Ignore special . directory. */
+ (0 != strcmp(l_pDirent.d_name, "..")) && /* Ignore special .. directory. */
+ (0 != strcmp(l_pDirent.d_name, "lost+found")) && /* Ignore lost+found. */
+ ('.' != l_pDirent.d_name[0])) { /* Ignore hidden files */
+ std::string l_extension = "/";
+ std::string l_fileName = f_path;
+ std::string l_destName = f_destinationName;
+ l_extension.append(l_pDirent.d_name);
+ l_fileName.append(l_extension);
+ l_destName.append(l_extension);
+ l_eFrameworkunifiedStatus = addToArchive(l_fileName, l_destName, static_cast<UI_8>(f_depth - 1));
+ }
+ }
+
+ closedir(l_pDir);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+SI_32 CErrorEventArchive::gzOpenArchive(PCHAR f_pcPathname, SI_32 f_siOflags,
+ SI_32 f_siMode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SI_32 l_siFileDescriptor = -1;
+
+ if (f_pcPathname) { // LCOV_EXCL_BR_LINE 6: Pathname is awalys be set
+ PCHAR l_pcGzoflags;
+
+ switch (f_siOflags & O_ACCMODE) { // LCOV_EXCL_BR_LINE 6: only O_WRONLY be set
+ case O_WRONLY: {
+ l_pcGzoflags = (PCHAR) "wb";
+ break;
+ }
+ // LCOV_EXCL_START 6: only O_WRONLY be set
+ case O_RDONLY: {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_pcGzoflags = (PCHAR) "rb";
+ break;
+ }
+ // LCOV_EXCL_STOP
+ case O_RDWR:
+ default: {
+ return -1;
+ }
+ }
+
+ if (-1 == (l_siFileDescriptor = // LCOV_EXCL_BR_LINE 5: open's error case.
+ open(f_pcPathname, f_siOflags, f_siMode))) {
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ if ((f_siOflags & O_CREAT) // LCOV_EXCL_BR_LINE 5: fchmod's error case.
+ && fchmod(l_siFileDescriptor, f_siMode)) {
+ // LCOV_EXCL_START 5: fchmod's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(l_siFileDescriptor);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ g_gzFile = gzdopen(l_siFileDescriptor, l_pcGzoflags);
+ if (!g_gzFile) { // LCOV_EXCL_BR_LINE 5: gzdopen's error case.
+ // LCOV_EXCL_START 5: gzdopen's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(l_siFileDescriptor);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path empty.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (SI_32) l_siFileDescriptor;
+}
+SI_32 CErrorEventArchive::gzCloseArchive() {
+ return gzclose(g_gzFile);
+}
+
+ssize_t CErrorEventArchive::gzWriteArchive(int fd, const void* buf,
+ size_t count) {
+ return gzwrite(g_gzFile, const_cast<void*>(buf), (unsigned int) count);
+}
+
+ssize_t CErrorEventArchive::gzReadArchive(int fd, void* buf, size_t count) {
+ return gzread(g_gzFile, buf, (unsigned int) count);
+}
diff --git a/systemservice/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp b/systemservice/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp
new file mode 100755
index 0000000..f400e83
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp
@@ -0,0 +1,147 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports notifying CAN abou HK and CAN error events
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
+#include <time.h>
+#include <stub/Clock_API.h>
+#include "ss_logger_error_event_can_evt_reply.h"
+CLoggerErrorEventCANEvtReply::CLoggerErrorEventCANEvtReply() {
+}
+
+CLoggerErrorEventCANEvtReply::~CLoggerErrorEventCANEvtReply() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerErrorEventCANEvtReply::Initialize(CLoggerCfg* f_pLoggerCfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+BOOL CLoggerErrorEventCANEvtReply::IsEventNeeded(TLoggerErrorEvent f_event) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_ret =
+ ((f_event.EventBitMask & EVENT_BIT_CAN_NOTIFICATION) != 0) ? TRUE : FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+EFrameworkunifiedStatus CLoggerErrorEventCANEvtReply::PublishStartEvent(
+ HANDLE f_hApp, TLoggerErrorEvent f_event) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (TRUE == IsEventNeeded(f_event)) {
+ l_eStatus = FrameworkunifiedPublishPublicEvent(f_hApp, eSSLoggerCANEventStart, NULL, 0);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "FrameworkunifiedPublishPublicEvent(f_hApp,eSSLoggerCANEventStart,NULL,0)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerErrorEventCANEvtReply::PublishEndEvent(
+ HANDLE f_hApp, TLoggerErrorEvent f_event, UI_32 f_triggerNumber,
+ uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (TRUE == IsEventNeeded(f_event)) {
+ STEventCANLoggerEventInfo l_info;
+ struct tm l_tm;
+ CLOCK_RETURN clock_ret = Clock_getLocalTimeY2K38(&f_time, &l_tm);
+ if (CLOCK_OK == clock_ret) {
+ l_info.valid = TRUE;
+ l_info.success = TRUE;
+ l_info.triggerNumber = f_triggerNumber;
+ l_info.dateAndTime.DateTime_Stat = 0;
+ l_info.dateAndTime.DateTimeDay = static_cast<UI_8>(l_tm.tm_mday);
+ l_info.dateAndTime.DateTimeHour = static_cast<UI_8>(l_tm.tm_hour);
+ l_info.dateAndTime.DateTimeMinute = static_cast<UI_8>(l_tm.tm_min);
+ l_info.dateAndTime.DateTimeMonth = static_cast<UI_8>(l_tm.tm_mon + 1);
+ l_info.dateAndTime.DateTimeSecond = static_cast<UI_8>(l_tm.tm_sec);
+ l_info.dateAndTime.DateTimeYear = static_cast<UI_8>(l_tm.tm_year % 100);
+ l_info.dateAndTime.TimeFormat = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Time sent to CAN is: 20%2d/%2d/%2d %2d:%2d:%2d",
+ l_info.dateAndTime.DateTimeYear, l_info.dateAndTime.DateTimeMonth,
+ l_info.dateAndTime.DateTimeDay, l_info.dateAndTime.DateTimeHour,
+ l_info.dateAndTime.DateTimeMinute,
+ l_info.dateAndTime.DateTimeSecond);
+
+ } else {
+ l_info.success = TRUE;
+ l_info.valid = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Passed time is invalid.");
+ }
+ l_eStatus = FrameworkunifiedPublishPublicEvent(f_hApp, eSSLoggerCANEventFinished,
+ &l_info, sizeof(l_info));
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "FrameworkunifiedPublishPublicEvent(f_hApp,eSSLoggerCANEventFinished,NULL,0)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerErrorEventCANEvtReply::PublishErrorEvent(
+ HANDLE f_hApp, TLoggerErrorEvent f_event, BOOL f_isValid,
+ UI_32 f_triggerNumber, uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (TRUE == IsEventNeeded(f_event)) {
+ STEventCANLoggerEventInfo l_info;
+ struct tm l_tm;
+ CLOCK_RETURN clock_ret = Clock_getLocalTimeY2K38(&f_time, &l_tm);
+ l_info.valid = f_isValid;
+ l_info.success = FALSE;
+ if (CLOCK_OK == clock_ret) {
+ l_info.triggerNumber = f_triggerNumber;
+ l_info.dateAndTime.DateTime_Stat = 0;
+ l_info.dateAndTime.DateTimeDay = static_cast<UI_8>(l_tm.tm_mday);
+ l_info.dateAndTime.DateTimeHour = static_cast<UI_8>(l_tm.tm_hour);
+ l_info.dateAndTime.DateTimeMinute = static_cast<UI_8>(l_tm.tm_min);
+ l_info.dateAndTime.DateTimeMonth = static_cast<UI_8>(l_tm.tm_mon + 1);
+ l_info.dateAndTime.DateTimeSecond = static_cast<UI_8>(l_tm.tm_sec);
+ l_info.dateAndTime.DateTimeYear = static_cast<UI_8>(l_tm.tm_year % 100);
+ l_info.dateAndTime.TimeFormat = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Time sent to CAN is: 20%2d/%2d/%2d %2d:%2d:%2d",
+ l_info.dateAndTime.DateTimeYear, l_info.dateAndTime.DateTimeMonth,
+ l_info.dateAndTime.DateTimeDay, l_info.dateAndTime.DateTimeHour,
+ l_info.dateAndTime.DateTimeMinute,
+ l_info.dateAndTime.DateTimeSecond);
+
+ } else {
+ l_info.valid = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Passed time is invalid.");
+ }
+ l_eStatus = FrameworkunifiedPublishPublicEvent(f_hApp, eSSLoggerCANEventFinished,
+ &l_info, sizeof(l_info));
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: macro
+ l_eStatus,
+ "FrameworkunifiedPublishPublicEvent(f_hApp,eSSLoggerCANEventFinished,NULL,0)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
diff --git a/systemservice/logger_service/server/src/ss_logger_error_event_cfg.cpp b/systemservice/logger_service/server/src/ss_logger_error_event_cfg.cpp
new file mode 100755
index 0000000..fcd733e
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_error_event_cfg.cpp
@@ -0,0 +1,335 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <vector>
+#include "loggerservicedebug_loggerservicelog.h"
+#include "ss_logger_error_event_cfg.h"
+
+enum ARTIFACT_BIT {
+ ARTIFACT_BIT_NONE = 0x00000000,
+ ARTIFACT_BIT_LOGGERSERVICE_DEBUG_LOG = 1 << (UI_32) eArtifactIdInterfaceunifiedDebugLog,
+ ARTIFACT_BIT_TRANSMIT_LOG = 1 << (UI_32) eArtifactIdTransmitLog,
+ ARTIFACT_BIT_PERFORMANCE_LOG = 1 << (UI_32) eArtifactIdPerformanceLog,
+ ARTIFACT_BIT_BOOT_MICRO_LOG = 1 << (UI_32) eArtifactIdBootMicroLog,
+ ARTIFACT_BIT_SYSTEM_DATA_LOG = 1 << (UI_32) eArtifactIdSystemDataCsv,
+ ARTIFACT_BIT_SHOW_MEM_TXT = 1 << (UI_32) eArtifactIdShowMemTxt,
+ ARTIFACT_BIT_PROCESS_CORE = 1 << (UI_32) eArtifactIdProcessCore,
+ ARTIFACT_BIT_DEBUG_DUMP_LOG = 1 << (UI_32) eArtifactIdDebugDumpLog,
+ ARTIFACT_BIT_KERNEL_LOG = 1 << (UI_32) eArtifactIdKernelLog,
+ ARTIFACT_BIT_KERNEL_BOOT_LOG = 1 << (UI_32) eArtifactIdKernelBootLog,
+ ARTIFACT_BIT_DRINITIAL_LOG = 1 << (UI_32) eArtifactIdDRInitialLog,
+ ARTIFACT_BIT_DRLOCATION_LOG = 1 << (UI_32) eArtifactIdDRLocationLog,
+ ARTIFACT_BIT_CHLM_MC_LOGS = 1 << (UI_32) eArtifactIdCpuHighLoadMonteCarloLogs,
+ ARTIFACT_BIT_METACORE_LOGS = 1 << (UI_32) eArtifactIdMetaCoreLogs,
+ ARTIFACT_BIT_SCREEN_SHOT = 1 << (UI_32) eArtifactIdScreenShot,
+ ARTIFACT_BIT_CMS_LOGS = 1 << (UI_32) eArtifactIdCmsLogs,
+ ARTIFACT_BIT_INTERNAL_DTC_LOG = 1 << (UI_32) eArtifactIDInternalDTC,
+ ARTIFACT_BIT_CLEAR_ALL_LOG = 1 << (UI_32) eArtifactIdClearAllLog,
+ ARTIFACT_BIT_NAVI_LOG = 1 << (UI_32) eArtifactIdNaviLog,
+ ARTIFACT_BIT_DEBUG_FOLDER_CONTENT = 1
+ << (UI_32) eArtifactIdDebugFolderContent,
+ ARTIFACT_BIT_DEBUG_FOLDER2_CONTENT = 1
+ << (UI_32) eArtifactIdDebugFolder2Content,
+ ARTIFACT_BIT_COM_LOG = 1 << (UI_32) eArtifactIdComDebugLog,
+ ARTIFACT_BIT_PSTORE_LOG = 1 << (UI_32) eArtifactIdPstoreLog
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////
+///// Definition for Logging Artifact Filepaths
+//////////////////////////////////////////////////////////////////////////////////////////
+const char LAF_DEBUG_FOLDER[] = "/nv/BS/ss/logger_service/rwdata";
+const char LAF_DEBUG_FOLDER2[] = "/nv/BS/ss/logger_service/rwdata/log2";
+const char LAF_MONTECARLO_FN[] = "/tmp/MonteCarlo";
+const char LAF_METACORE_FN[] = "/tmp/MetaCore";
+const char LAF_CMS_FN[] = "/tmp/cms";
+const char LAF_INT_DTC_FN[] = "/tmp/dtc_error.log";
+const char LAF_LOGGERSERVICELOG_COM[] = "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/communication";
+const char LAF_KERNEL_BOOT_FN[] = "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/kernelboot.log";
+const char LAF_PSTORELOG[] = "/dev/pstore";
+
+#define ARTIFACT_BIT_ALL_OUTPUT_LOG (ARTIFACT_BIT_LOGGERSERVICE_DEBUG_LOG | \
+ ARTIFACT_BIT_DEBUG_DUMP_LOG | \
+ ARTIFACT_BIT_SYSTEM_DATA_LOG | \
+ ARTIFACT_BIT_SHOW_MEM_TXT | \
+ ARTIFACT_BIT_COM_LOG | \
+ ARTIFACT_BIT_KERNEL_LOG | \
+ ARTIFACT_BIT_KERNEL_BOOT_LOG | \
+ ARTIFACT_BIT_SCREEN_SHOT | \
+ ARTIFACT_BIT_TRANSMIT_LOG | \
+ ARTIFACT_BIT_PERFORMANCE_LOG | \
+ ARTIFACT_BIT_DRINITIAL_LOG | \
+ ARTIFACT_BIT_DRLOCATION_LOG | \
+ ARTIFACT_BIT_CHLM_MC_LOGS | \
+ ARTIFACT_BIT_INTERNAL_DTC_LOG | \
+ ARTIFACT_BIT_METACORE_LOGS | \
+ ARTIFACT_BIT_PSTORE_LOG)
+
+TLoggingArtifactCfg CErrorEventCfg::m_loggerErrorEventCfgTbl[eErrorEventTypeMaxValue] = {
+ { eErrorEventTypeProcessCrash, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeProcessExit, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeHeartBeatFailure, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeSystemLowMemory, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeUserInvokedUserForceReset, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeUserInvokedCollectAllLogs, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_POPUP | EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeUserInvokedCollectScreenShot, { (ARTIFACT_BIT_NONE
+ | ARTIFACT_BIT_SCREEN_SHOT),
+
+ (EVENT_BIT_POPUP | EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_POPUP | EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeUserInvokedCollectDevLogs, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_NONE) }
+ },
+
+ { eErrorEventTypeBootMicroReset, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeEelExport, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_POPUP | EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeInterfaceunifiedEmmcLogs, { (ARTIFACT_BIT_DEBUG_FOLDER_CONTENT
+ | ARTIFACT_BIT_DEBUG_FOLDER2_CONTENT),
+
+ (EVENT_BIT_POPUP | EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeDiagEvent, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_DIAG) } },
+
+ { eErrorEventTypeCanEvent, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeDtcEvent, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG),
+
+ (EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeModConnFailed, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeStartRespFailed, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeModuleInvokedResetRequest, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeModuleInvokedCollectDebugLogs,
+ { (ARTIFACT_BIT_ALL_OUTPUT_LOG | ARTIFACT_BIT_NAVI_LOG),
+ (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeUserInvokedClearLogs, { (ARTIFACT_BIT_NONE
+ | ARTIFACT_BIT_CLEAR_ALL_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeUserInvokedCollectNaviLog, { (ARTIFACT_BIT_NONE
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeGroupRelaunch, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeReserved1, { (ARTIFACT_BIT_NONE), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeReserved2, { (ARTIFACT_BIT_NONE), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeReserved3, { (ARTIFACT_BIT_NONE), (EVENT_BIT_NONE) } } };
+
+TLoggingArtifact CErrorEventCfg::m_loggerErrorArtifactCfgTbl[eArtifactIdMaxValue] = { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ /*Artifact ID Owner Timeout Callback Type Path CallBack Function Delete tmp artifact*/
+ { eArtifactIdInterfaceunifiedDebugLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdTransmitLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdPerformanceLog, { SERVICE_LOGGER, 5, { eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } },
+ { eArtifactIdBootMicroLog, { SERVICE_SYSMANAGER, 1000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } },
+ { eArtifactIdSystemDataCsv, { SERVICE_SYSMANAGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } },
+ { eArtifactIdShowMemTxt, { SERVICE_SYSMANAGER, 8000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } },
+ { eArtifactIdProcessCore, { SERVICE_SYSMANAGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } },
+ { eArtifactIdDebugDumpLog, { SERVICE_SYSMANAGER, 4000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } },
+ { eArtifactIdScreenShot, { SERVICE_LOGGER, 1100, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdDebugFolderContent, { SERVICE_LOGGER, 50000, { eCbTypePath, LAF_DEBUG_FOLDER, NULL }, FALSE } },
+ { eArtifactIdDebugFolder2Content, { SERVICE_LOGGER, 50000, { eCbTypePath, LAF_DEBUG_FOLDER2, NULL }, FALSE } },
+ { eArtifactIdKernelLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdKernelBootLog, { SERVICE_LOGGER, 5000, { eCbTypePath, LAF_KERNEL_BOOT_FN, NULL }, FALSE } },
+ { eArtifactIdDRInitialLog, { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdDRLocationLog, { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdCpuHighLoadMonteCarloLogs, { SERVICE_LOGGER, 50, { eCbTypePath, LAF_MONTECARLO_FN, NULL }, TRUE } },
+ { eArtifactIdMetaCoreLogs, { SERVICE_LOGGER, 50, { eCbTypePath, LAF_METACORE_FN, NULL }, TRUE } },
+ { eArtifactIdCmsLogs, { SERVICE_LOGGER, 500, { eCbTypePath, LAF_CMS_FN, NULL }, TRUE } },
+ { eArtifactIDInternalDTC, { SERVICE_LOGGER, 500, { eCbTypePath, LAF_INT_DTC_FN, NULL }, TRUE } },
+ { eArtifactIdComDebugLog, { SERVICE_LOGGER, 500, { eCbTypePath, LAF_LOGGERSERVICELOG_COM, NULL }, FALSE } },
+ { eArtifactIdPstoreLog, { SERVICE_LOGGER, 50, { eCbTypePath, LAF_PSTORELOG, NULL }, FALSE } },
+ { eArtifactIdClearAllLog, { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } },
+ { eArtifactIdNaviLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } },
+}; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+CErrorEventCfg::CErrorEventCfg() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+CErrorEventCfg::~CErrorEventCfg() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CErrorEventCfg::Initialize(CLoggerCfg* p_logger_cfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_cnt;
+
+ m_ext_log_num = 0;
+ ExternalLogList ext_log = p_logger_cfg->GetExternalLogList();
+
+ for (l_cnt = 0; l_cnt < eArtifactIdMaxValue; l_cnt++) {
+ EArtifactId l_artifactId = m_loggerErrorArtifactCfgTbl[l_cnt].ArtifactId;
+ TLoggingArtifactInformation l_artifactInformation =
+ m_loggerErrorArtifactCfgTbl[l_cnt].Information;
+ m_errorArtifactMap[l_artifactId] = l_artifactInformation; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ for (l_cnt = 0; l_cnt < eErrorEventTypeMaxValue; l_cnt++) {
+ EErrorEventType l_eventType = m_loggerErrorEventCfgTbl[l_cnt].ErrorType;
+ TLoggingErrorEventInformation l_errorEvtInformation =
+ m_loggerErrorEventCfgTbl[l_cnt].Information;
+ m_errorEventTypeToArtifactBitMaskMap[l_eventType] = l_errorEvtInformation;
+ }
+
+ // Set external log info
+ if (ext_log.num > 0) {
+ if (ext_log.num <= ext_log.max) {
+ m_ext_log_num = ext_log.num;
+ } else {
+ m_ext_log_num = ext_log.max;
+ }
+
+ for (UI_32 i = 0; i < m_ext_log_num; i++) {
+ EArtifactId l_artifactId = (EArtifactId) (eArtifactIdMaxValue + i);
+ TLoggingArtifactInformation artifact_info;
+ artifact_info.Cb.Function = NULL;
+ artifact_info.Cb.Path = ext_log.p_info[i].path;
+ artifact_info.Cb.Type = eCbTypePath;
+ artifact_info.OwnerServiceName = SERVICE_LOGGER;
+ artifact_info.Remove = ext_log.p_info[i].remove;
+ artifact_info.RequestTimeoutMs = 5000;
+ m_errorArtifactMap[l_artifactId] = artifact_info;
+ }
+ }
+
+ l_eStatus = (EFrameworkunifiedStatus) ValidateConfiguration();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "ValidateConfiguration()"); // LCOV_EXCL_BR_LINE 5:macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+UI_32 CErrorEventCfg::ValidateConfiguration(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ UI_32 l_return = 0;
+
+ if ((eArtifactIdMaxValue + m_ext_log_num) != m_errorArtifactMap.size()) { // LCOV_EXCL_BR_LINE 6:Be sure not to exceed the eArtifactIdMaxValue
+ // LCOV_EXCL_START 6:Be sure not to exceed the eArtifactIdMaxValue
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Artifact map size mismatch: Expected: %d, Found: %d",
+ (eArtifactIdMaxValue + m_ext_log_num), m_errorArtifactMap.size());
+ l_return |= 1;
+ // LCOV_EXCL_STOP
+ }
+ if (eErrorEventTypeMaxValue != m_errorEventTypeToArtifactBitMaskMap.size()) { // LCOV_EXCL_BR_LINE 6:Be sure not to exceed the eErrorEventTypeMaxValue
+ // LCOV_EXCL_START 6:Be sure not to exceed the eErrorEventTypeMaxValue
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error event map size mismatch: Expected: %d, Found: %d",
+ eErrorEventTypeMaxValue, m_errorEventTypeToArtifactBitMaskMap.size());
+ l_return |= 4;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_return);
+}
+
+void CErrorEventCfg::GetArtifactRequestVec(
+ EErrorEventType f_eventType,
+ std::vector<TLoggingArtifact> &f_refArtifactRequestVec) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ ARTIFACT_BIT_MASK l_artifactRequestBits = 0;
+ ARTIFACT_BIT l_artifactBit;
+ TLoggingArtifact l_artifact;
+ UI_32 l_artifactId;
+
+ f_refArtifactRequestVec.clear();
+
+ if (f_eventType < eErrorEventTypeMaxValue) {
+ l_artifactRequestBits = m_errorEventTypeToArtifactBitMaskMap[f_eventType]
+ .ArtifactBitMask;
+ }
+
+ if (l_artifactRequestBits > 0) {
+ for (l_artifactId = 0; l_artifactId < eArtifactIdMaxValue; l_artifactId++) {
+ l_artifactBit = (ARTIFACT_BIT) (1 << l_artifactId);
+ if ((l_artifactRequestBits & l_artifactBit) > 0) {
+ l_artifact.ArtifactId = (EArtifactId) l_artifactId;
+ l_artifact.Information = m_errorArtifactMap[l_artifact.ArtifactId];
+ f_refArtifactRequestVec.push_back(l_artifact);
+ }
+ }
+
+ // Set external log info
+ if (m_ext_log_num > 0) {
+ for (l_artifactId = 0; l_artifactId < m_ext_log_num; l_artifactId++) {
+ l_artifact.ArtifactId = (EArtifactId) (eArtifactIdMaxValue + l_artifactId);
+ l_artifact.Information = m_errorArtifactMap[l_artifact.ArtifactId];
+ f_refArtifactRequestVec.push_back(l_artifact);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EVENT_BIT_MASK CErrorEventCfg::GetEventsForErrorEvent(
+ EErrorEventType f_eventType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EVENT_BIT_MASK l_events = EVENT_BIT_NONE;
+ if (f_eventType < eErrorEventTypeMaxValue) { // LCOV_EXCL_BR_LINE 6:Be sure not to exceed the eErrorEventTypeMaxValue
+ l_events = m_errorEventTypeToArtifactBitMaskMap[f_eventType].EventBitMask;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_events);
+} // LCOV_EXCL_BR_LINE 10:the last line
diff --git a/systemservice/logger_service/server/src/ss_logger_error_event_responses.cpp b/systemservice/logger_service/server/src/ss_logger_error_event_responses.cpp
new file mode 100755
index 0000000..dc23d8b
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_error_event_responses.cpp
@@ -0,0 +1,625 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <boost/bind.hpp>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/klog.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_reader.h>
+#include <native_service/ns_ringbuffer.h>
+#include <native_service/ns_logger_if.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <native_service/cl_process.h>
+#include <native_service/cl_lockid.h>
+#include <sstream>
+#include <string>
+#include "loggerservicedebug_loggerservicelog.h"
+#include "loggerservicedebug_thread_if.h"
+#include "ss_logger_error_event.h"
+#include "ss_logger_service_callbacks.h"
+#include "ss_logger_scrshot.h"
+#include "ss_logger_fs_directory.h"
+#include "ss_logger_common.h"
+#include "ss_logger_types.h"
+
+EFrameworkunifiedStatus SSLogger_SendtoSM(HANDLE f_hApp, TLoggingArtifact f_artifact) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = SendLogArtifactRequestToSystemManager(f_artifact.ArtifactId);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. SendLogArtifactRequestToSystemManager returned: %d for artifact ID: %d",
+ l_eStatus, f_artifact.ArtifactId);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus SSLogger_SendtoSelf(HANDLE f_hApp, TLoggingArtifact f_artifact) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNullPointer;
+ if (NULL != f_hApp) { // LCOV_EXCL_BR_LINE 6: double check
+ l_eStatus = FrameworkunifiedSendSelf(f_hApp, SS_LOGGER_ERROR_EVENT_ARTIFACT_REQ,
+ sizeof(f_artifact.ArtifactId),
+ &f_artifact.ArtifactId);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. FrameworkunifiedSendSelf(SS_LOGGER_ERROR_EVENT_ARTIFACT_REQ) returned error: %d for artifact ID: %d.",
+ l_eStatus, f_artifact.ArtifactId);
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+///////////////////////////////////////////////////////////////////////////
+// Function : SendLogArtifactResponseToSelf
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::SendLogArtifactResponseToSelf(
+ HANDLE f_hApp, EArtifactId f_artifactId,
+ std::string f_artifactFilePathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ARTIFACT_RESPONSE l_artifactResponse;
+
+ l_artifactResponse.ArtifactId = f_artifactId;
+
+ strncpy(l_artifactResponse.FilePathAndName, f_artifactFilePathAndName.c_str(),
+ sizeof(l_artifactResponse.FilePathAndName) - 1);
+
+ l_eStatus = FrameworkunifiedSendSelf(f_hApp, SS_SM_ERROR_EVENT_ARTIFACT_RSPN,
+ sizeof(l_artifactResponse), &l_artifactResponse);
+
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedSendSelf(SS_SM_ERROR_EVENT_ARTIFACT_RSPN)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainLoggerserviceLogRequest
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainLoggerserviceLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string dir_path = DEBUG_LOG_PATH_DIR;
+
+ l_eStatus = CFSDirectory::CreateDirectory(dir_path);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Create FRAMEWORKUNIFIEDLOG tmp directory %d",
+ l_eStatus);
+ } else {
+ UI_32 l_DumpSize = 0;
+ std::string src_file_path;
+ std::string dst_file_path;
+ PCSTR file_name;
+ UI_32 num;
+ bool log_clear = true;
+
+ switch (m_errorEventNtfData.EventType) {
+ // _DIAG
+ case eErrorEventTypeUserInvokedUserForceReset:
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeDiagEvent:
+ case eErrorEventTypeCanEvent:
+ case eErrorEventTypeDtcEvent:
+ case eErrorEventTypeModuleInvokedCollectDebugLogs:
+ // _DEBUG
+ case eErrorEventTypeUserInvokedCollectDevLogs:
+ log_clear = false;
+ break;
+ default:
+ break;
+ }
+
+ num = NSLogGetFrameworkunifiedlogFileTotalNum();
+ for (UI_32 cont = 0; cont < num; cont++) {
+ file_name = NSLogGetFrameworkunifiedlogFileName(cont);
+ if (file_name == NULL) {
+ break;
+ }
+ src_file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ src_file_path.append("/");
+ src_file_path.append(file_name);
+ dst_file_path = DEBUG_LOG_PATH_DIR;
+ dst_file_path.append("/");
+ dst_file_path.append(file_name);
+ CNSRingBuffer* l_pLoggerservicelog;
+ int index;
+ index = NSLogGetFrameworkunifiedlogIndex(src_file_path.c_str());
+ l_pLoggerservicelog = new (std::nothrow) CNSRingBuffer(
+ src_file_path, 0, index + LOCK_NSLOG_ACCES_IF_1);
+ if (l_pLoggerservicelog == NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer handle is NULL %s",
+ src_file_path.c_str());
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer Open failed %s %d",
+ src_file_path.c_str(), l_eStatus);
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pLoggerservicelog->DumpToFile(dst_file_path.c_str(),
+ &l_DumpSize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer DumpToFile failed %s %d",
+ src_file_path.c_str(), l_eStatus);
+ }
+ if (NULL != l_pLoggerservicelog) { // LCOV_EXCL_BR_LINE 5: new's error case
+ if (log_clear) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->ClearBuf())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer ClearBuf failed %s %d",
+ src_file_path.c_str(), l_eStatus);
+ }
+ }
+ (void) l_pLoggerservicelog->Close();
+ delete l_pLoggerservicelog;
+ }
+ }
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdInterfaceunifiedDebugLog,
+ DEBUG_LOG_PATH_DIR);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdInterfaceunifiedDebugLog)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainLoggerserviceLogRequest
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainTransmitLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_RootPath;
+
+ l_eStatus = m_pReaderWriterControl->FlushCache(eReaderWriterLogTransmit);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_pReaderWriterControl->FlushCache(eReaderWriterLogTransmit)");
+ l_RootPath = TRANSMIT_LOG_PATH_FN;
+ if (access(l_RootPath.c_str(), R_OK) != 0) {
+ l_RootPath = "";
+ }
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdTransmitLog,
+ l_RootPath.c_str());
+
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendLogArtifactResponseToSelf(eArtifactIdTransmitLog)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainLoggerserviceLogRequest
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainPerformanceLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = m_pReaderWriterControl->FlushCache(eReaderWriterLogPerformance);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_pReaderWriterControl->FlushCache(eReaderWriterLogPerformance)");
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdPerformanceLog,
+ PERFORMANCE_LOG_PATH_FN);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdPerformanceLog)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainScreenShotRequest
+// brief : Collect screen shot artifact from PLM and return a response
+// to SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainScreenShotRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdScreenShot,
+ SCREEN_SHOT_PATH);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdScreenShot)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainScreenShotResponse
+// brief : Callback from PLM when the screen shot file has been written
+// to storage. The data received contains the file path and
+// name to the written screen shot file. See
+// SS_LOGGER_SCREENCAPTURE_EVT_ACK.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainScreenShotResponse(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ STScreenCaptureEvt l_ScreenCaptureEvtAck;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<STScreenCaptureEvt>(f_hApp, l_ScreenCaptureEvtAck))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP
+ } else {
+ if (FALSE == l_ScreenCaptureEvtAck.fSucessful) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Screen shot acquisition failed. l_ScreenCaptureEvtAck.fSucessful == FALSE.");
+ l_ScreenCaptureEvtAck.strNameAndLocation[0] = '\0';
+ }
+
+ l_eStatus = SendLogArtifactResponseToSelf(
+ f_hApp, eArtifactIdScreenShot,
+ l_ScreenCaptureEvtAck.strNameAndLocation); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 5:macro
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdScreenShot)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainKernelLogInfoRequest
+// brief : Collect kernel log artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainKernelLogInfoRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = CreateKernelLog(f_hApp, SS_LOGGER_KLOG_GET);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainDRInitialLogRequest
+// brief : Collect DRInitialLog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainDRInitialLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_DumpSize = 0;
+
+ CNSSharedMemReader* l_pDRInitial = new (std::nothrow) CNSSharedMemReader(
+ SHMEM_DRINITIALLOG, FALSE);
+
+ if (NULL == l_pDRInitial) { // LCOV_EXCL_BR_LINE 5: new's error case
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRInitial SharedMem handle is NULL");
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pDRInitial->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRInitial Open failed %d", l_eStatus);
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pDRInitial->DumpToFile(DRINITIAL_LOG_PATH_FN,
+ &l_DumpSize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRInitial DumpToFile failed %d",
+ l_eStatus);
+ } else {
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdDRInitialLog,
+ DRINITIAL_LOG_PATH_FN);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdDRInitialLog)");
+ }
+
+ if (NULL != l_pDRInitial) { // LCOV_EXCL_BR_LINE 5: new's error case
+ (void) l_pDRInitial->Close();
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainDRLocationLogRequest
+// brief : Collect DRLocationLog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainDRLocationLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_DumpSize = 0;
+
+ CNSSharedMemReader* l_pDRLocation = new (std::nothrow) CNSSharedMemReader(
+ SHMEM_DRLOCATIONLOG, FALSE);
+
+ if (NULL == l_pDRLocation) { // LCOV_EXCL_BR_LINE 5: new's error case
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRInitial SharedMem handle is NULL");
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pDRLocation->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRLocation Open failed %d",
+ l_eStatus);
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pDRLocation->DumpToFile(DRLOCATION_LOG_PATH_FN,
+ &l_DumpSize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRLocation DumpToFile failed %d",
+ l_eStatus);
+ } else {
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdDRLocationLog,
+ DRLOCATION_LOG_PATH_FN);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdDRLocationLog)");
+ }
+
+ if (NULL != l_pDRLocation) { // LCOV_EXCL_BR_LINE 5: new's error case
+ (void) l_pDRLocation->Close();
+ delete l_pDRLocation;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnClearAllLogRequest
+// brief : Callback from LoggerService when the event log file has been delete
+// from storage. The data received contains the file path.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnClearAllLogRequest(HANDLE f_hApp) {
+ std::string clear_file_path = CLEAR_LOG_PATH_FN;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (CFSDirectory::RemoveSubDirectory(clear_file_path)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "SS_Logger Clear %s directory delete successful.",
+ clear_file_path.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SS_Logger Clear %s directory delete failed.",
+ clear_file_path.c_str());
+ }
+
+ clear_file_path = "/nv/BS/ss/logger_service/rwdata/log2/awlog/";
+ if (CFSDirectory::RemoveSubDirectory(clear_file_path)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "SS_Logger Clear %s directory delete successful.",
+ clear_file_path.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SS_Logger Clear %s directory delete failed.",
+ clear_file_path.c_str());
+ }
+
+ clear_file_path = "/nv/BS/ss/logger_service/rwdata/log2/core/";
+ if (CFSDirectory::RemoveSubDirectory(clear_file_path)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "SS_Logger Clear %s directory delete successful.",
+ clear_file_path.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SS_Logger Clear %s directory delete failed.",
+ clear_file_path.c_str());
+ }
+
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdClearAllLog,
+ clear_file_path.c_str());
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendLogArtifactResponseToSelf(eArtifactIdClearAllLog)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnNaviLogRequest
+// brief : Callback from LoggerService when the event log file has been xxxxxx BUGBUG
+// from storage. The data received contains the file path.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnNaviLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ EFrameworkunifiedStatus naviLog_status;
+ switch (m_errorEventNtfData.EventType) {
+ case eErrorEventTypeProcessCrash:
+ case eErrorEventTypeProcessExit:
+ case eErrorEventTypeHeartBeatFailure:
+ case eErrorEventTypeSystemLowMemory:
+ case eErrorEventTypeBootMicroReset:
+ case eErrorEventTypeModConnFailed:
+ case eErrorEventTypeStartRespFailed:
+ case eErrorEventTypeModuleInvokedResetRequest:
+ case eErrorEventTypeGroupRelaunch:
+ naviLog_status = SaveNaviLog(epssdmsdtGENERIC_ERROR_RESET);
+ break;
+ default:
+ naviLog_status = SaveNaviLog(epssdmsdtNORMAL_RESET);
+ break;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Fail to save Navi Log %d",
+ naviLog_status);
+
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdNaviLog, "");
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendLogArtifactResponseToSelf(eArtifactIdNaviLog)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEvent::CheckPathForArtifact(HANDLE f_hApp,
+ TLoggingArtifact f_artifact) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+ std::string l_Path;
+
+ if (f_artifact.Information.Cb.Type == eCbTypePath) {
+ l_Path = f_artifact.Information.Cb.Path;
+ if (access(l_Path.c_str(), R_OK) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "File/Directory %s not found. Returning empty string.",
+ l_Path.c_str());
+ l_Path = "";
+ }
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, f_artifact.ArtifactId,
+ l_Path.c_str());
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendLogArtifactResponseToSelf()");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+/* Read all messages remaining in the ring buffer. (allowed for non-root) */
+#define SYSLOG_ACTION_READ_ALL 3
+/* Return size of the log buffer */
+#define SYSLOG_ACTION_SIZE_BUFFER 10
+
+EFrameworkunifiedStatus CErrorEvent::CreateKernelLog(HANDLE f_hApp,
+ SS_LOGGER_KLOG_OPE_TYPE type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int len;
+ int fd;
+ char* buf;
+ ssize_t wr_len;
+
+ len = klogctl(SYSLOG_ACTION_SIZE_BUFFER, NULL, 0);
+ if (len < 0) { // LCOV_EXCL_BR_LINE 5: klogctl's error case
+ // LCOV_EXCL_START 5: klogctl's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to get syslog buffer size: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ buf = reinterpret_cast<char*>(malloc(len));
+ if (buf != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ len = klogctl(SYSLOG_ACTION_READ_ALL, buf, len);
+ if ((len < 0) || (len == 0)) { // LCOV_EXCL_BR_LINE 5: klogctl's error case
+ // LCOV_EXCL_START 5: klogctl's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to read syslog buffer: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ std::string file_put_path = "";
+ EArtifactId artifact_id = eArtifactIdMaxValue;
+ switch (type) {
+ case SS_LOGGER_KLOG_GET:
+ file_put_path = KERNEL_LOG_PATH_FN;
+ artifact_id = eArtifactIdKernelLog;
+ fd = open(file_put_path.c_str(),
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
+ break;
+ case SS_LOGGER_KBOOTLOG_CREATE:
+ file_put_path = KERNEL_BOOT_LOG_PATH_FN;
+ artifact_id = eArtifactIdKernelBootLog;
+ fd = open(file_put_path.c_str(),
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
+ break;
+ default:
+ fd = -1;
+ break;
+ }
+
+ if (fd == -1) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to open file: %s: %d, %s",
+ file_put_path.c_str(), errno, strerror(errno));
+ } else {
+ wr_len = write(fd, buf, len);
+ if (wr_len == -1) { // LCOV_EXCL_BR_LINE 5: write's error case
+ // LCOV_EXCL_START 5: write's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. File write failed. errno: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ fsync(fd);
+ close(fd);
+
+ if (SS_LOGGER_KLOG_GET == type) {
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, artifact_id,
+ file_put_path.c_str());
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "SendLogArtifactResponseToSelf failed. EFrameworkunifiedStatus:%d, ArtifactID:%d, Path:%s",
+ l_eStatus, artifact_id, file_put_path.c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+ free(buf);
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation Failed %s",
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
diff --git a/systemservice/logger_service/server/src/ss_logger_error_event_storage.cpp b/systemservice/logger_service/server/src/ss_logger_error_event_storage.cpp
new file mode 100755
index 0000000..ffdebe7
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_error_event_storage.cpp
@@ -0,0 +1,628 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_error_event_storage.h"
+#include <stdlib.h>
+#include <sched.h>
+#include <string.h>
+#include <errno.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <string>
+#include "ss_logger_util.h"
+#include "ss_logger_error_event_archive.h"
+#include "ss_logger_fs_directory.h"
+#include "ss_logger_common.h"
+
+CLoggerErrorEventStorage::CLoggerErrorEventStorage()
+ : m_parentMcQueue(NULL),
+ m_thread(-1),
+ m_sendQueue(-1),
+ m_receiveQueue(-1),
+ m_destination(""),
+ m_mutexInit(-1),
+ m_pLoggerCfg(NULL),
+ m_logTime(0) {
+ m_responseVec.clear();
+ m_mqattr.mq_flags = 0;
+ m_mqattr.mq_maxmsg = 1;
+ m_mqattr.mq_msgsize = 32;
+ m_mqattr.mq_curmsgs = 0;
+}
+
+CLoggerErrorEventStorage::~CLoggerErrorEventStorage() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ this->Cleanup();
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerErrorEventStorage::Initialize(HANDLE f_hApp,
+ std::string f_ParentName,
+ CLoggerCfg *f_pLoggerCfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ pthread_attr_t l_attr;
+ struct sched_param l_params;
+
+ /* Open the queue */
+ if (NULL == (m_pLoggerCfg = f_pLoggerCfg)) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ // LCOV_EXCL_START 200:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Parameter f_pLoggerCfg is NULL.");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_pLoggerCfg->GetLoggerStorageInfo(m_loggerStorageInfo))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetLoggerStorageInfo(m_loggerStorageInfo)");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (m_parentMcQueue = McOpenSender(f_ParentName.c_str()))) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. McOpenSender(f_ParentName)");
+ // LCOV_EXCL_STOP
+ } else if (-1 == (this->m_sendQueue = mq_open(m_loggerStorageInfo.Name.c_str(), O_CREAT | O_WRONLY, 0666, &m_mqattr))) { // LCOV_EXCL_BR_LINE 5:C code eror // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. mq_open(ERROR_EVENT_STORAGE_QUEUE_NAME,O_CREAT | O_WRONLY, 0666, NULL)");
+ // LCOV_EXCL_STOP
+ } else if (-1 == (this->m_receiveQueue = mq_open(m_loggerStorageInfo.Name.c_str(), O_RDONLY))) { // LCOV_EXCL_BR_LINE 5:C code eror // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusSessionLimitMaxedOut;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. mq_open(ERROR_EVENT_STORAGE_QUEUE_NAME,O_RDONLY)");
+ // LCOV_EXCL_STOP
+ } else if (EOK != (m_mutexInit = pthread_mutex_init(&this->m_mutex, NULL))) { // LCOV_EXCL_BR_LINE 5:C code eror
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. pthread_mutex_init(&this->m_mutex, NULL)");
+ // LCOV_EXCL_STOP
+ } else if (EOK != pthread_attr_init(&l_attr)) { // LCOV_EXCL_BR_LINE 5:C code eror
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusSemUnlockFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. pthread_attr_init()");
+ // LCOV_EXCL_STOP
+ } else if (EOK != pthread_attr_getschedparam(&l_attr, &l_params)) { // LCOV_EXCL_BR_LINE 5:C code eror
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusSemCloseFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. pthread_attr_getschedparam()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_params.sched_priority = m_loggerStorageInfo.Priority;
+ if (EOK != pthread_attr_setinheritsched(&l_attr, PTHREAD_EXPLICIT_SCHED)) { // LCOV_EXCL_BR_LINE 5:C code eror
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. pthread_attr_setinheritsched()");
+ // LCOV_EXCL_STOP
+ } else if (EOK != pthread_attr_setschedparam(&l_attr, &l_params)) { // LCOV_EXCL_BR_LINE 5:C code eror
+ l_eStatus = eFrameworkunifiedStatusDbResultError;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error but continue. pthread_attr_setschedparam(), priority = %d: %s",
+ m_loggerStorageInfo.Priority, strerror(errno)); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ if (EOK != pthread_create(&this->m_thread, &l_attr, &CLoggerErrorEventStorage::ThreadFunctionWrapper, this)) { // LCOV_EXCL_BR_LINE 5:C code eror // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. pthread_create()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ this->Cleanup(); // LCOV_EXCL_LINE 200:To ensure success
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerErrorEventStorage::Start(
+ std::string f_target, TArtifactResponseVec f_responseVector,
+ uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ /* Start the thread*/
+ if (EOK == pthread_mutex_lock(&this->m_mutex)) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ this->m_destination = f_target;
+ this->m_responseVec = f_responseVector;
+ this->m_logTime = f_time;
+ (void) pthread_mutex_unlock(&this->m_mutex);
+ }
+ UI_8 l_cmd[MAX_QUEUE_MSG_SIZE];
+ l_cmd[0] = 1;
+ if (-1 == mq_send(this->m_sendQueue, reinterpret_cast<CHAR*>(l_cmd), m_mqattr.mq_msgsize, 0)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. mq_send(this->m_sendQueue %d) return %s", m_sendQueue,
+ strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+void CLoggerErrorEventStorage::ThreadFunction(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ char l_data[MAX_QUEUE_MSG_SIZE] = { };
+ SI_32 l_bytesRead = -1;
+ SI_32 l_oldState;
+ ELoggerStorageThreadCommands l_cmdId = eLoggerStorageThreadCmdWriteFailed;
+ EFrameworkunifiedStatus l_eStatus;
+
+ (void) pthread_setname_np(pthread_self(), ERROR_EVENT_STORAGE_QUEUE_NAME);
+
+ pthread_cleanup_push(&CLoggerErrorEventStorage::CleanupWrapper, this);
+ while (-1 // LCOV_EXCL_BR_LINE 200: mq_send can not send size of -1
+ != (l_bytesRead =
+ static_cast<SI_32>(mq_receive(this->m_receiveQueue, reinterpret_cast<char *>(l_data),
+ (size_t) m_mqattr.mq_msgsize, NULL)))) {
+ std::string l_target;
+ TArtifactResponseVec l_responseVec;
+ uint32_t l_logTime;
+ uint8_t status;
+ Clock_getSystemTimeY2K38(&l_logTime, &status);
+ (void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &l_oldState);
+ if (EOK == pthread_mutex_lock(&this->m_mutex)) { // LCOV_EXCL_BR_LINE 5: pthread_mutex_lock's error case.
+ l_target = this->m_destination;
+ l_responseVec = this->m_responseVec;
+ l_logTime = this->m_logTime;
+ this->m_responseVec.clear();
+ this->m_destination = "";
+
+ (void) pthread_mutex_unlock(&this->m_mutex);
+ }
+ (void) pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &l_oldState);
+ if (access(l_target.c_str(), F_OK) == 0) {
+ if (CFSDirectory::IsDirectory(l_target)) { // LCOV_EXCL_BR_LINE 6: can not be a dir
+ // LCOV_EXCL_START 6: new file create, it can not be find
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL isDeleteFiles = FALSE;
+ SI_32 l_filesCopied = this->CopyFiles(l_target, l_responseVec,
+ isDeleteFiles);
+
+ switch (l_filesCopied) {
+ case -1:
+ /*Error while moving files*/
+ l_cmdId = eLoggerStorageThreadCmdWriteFailed;
+ break;
+ case 0:
+ /*No files where moved*/
+ l_cmdId = eLoggerStorageThreadCmdNoWritten;
+ break;
+ default:
+ if (l_filesCopied > 0) {
+ l_cmdId = eLoggerStorageThreadCmdOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. %d files successfully copied.", l_filesCopied);
+ }
+ break;
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = this->PackageAndPlaceArtifacts(l_target,
+ l_responseVec,
+ l_logTime))) {
+ /*Write Error.*/
+ l_cmdId = eLoggerStorageThreadCmdWriteFailed;
+ } else {
+ l_cmdId = eLoggerStorageThreadCmdOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Archive successfully written.");
+ }
+ if (eFrameworkunifiedStatusOK != RemoveDeprecatedArtifacts(l_responseVec)) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_WARN, __FUNCTION__,
+ " Warning. Wasn't able to delete all deprecated log artifacts.");
+ }
+ }
+
+ std::string l_usb_path;
+ size_t l_usb_path_length = 0;
+ if (m_pLoggerCfg != NULL) { // LCOV_EXCL_BR_LINE 6: m_pLoggerCfg can not be null
+ l_usb_path = m_pLoggerCfg->getUsb0MountPath();
+ l_usb_path_length = l_usb_path.length();
+ if ((l_usb_path_length > 1)
+ && (l_usb_path[l_usb_path.length() - 1] == '/')) {
+ l_usb_path_length--;
+ }
+ }
+ if ((l_usb_path_length > 0)
+ && (l_target.compare(0, l_usb_path_length, l_usb_path, 0,
+ l_usb_path_length) != 0)) {
+ l_usb_path_length = 0;
+ }
+ if ((l_usb_path_length == 0)
+ && (l_target.compare(0, sizeof(DEBUG_USB_PATH) - 1, DEBUG_USB_PATH, 0,
+ sizeof(DEBUG_USB_PATH) - 1) == 0)) {
+ l_usb_path = DEBUG_USB_PATH;
+ l_usb_path_length = sizeof(DEBUG_USB_PATH) - 1;
+ }
+ if (l_usb_path_length > 1) { // if USB path is '/' only, length is 1.
+ // So conditions to be syncfs is greater than 1
+ // sync usb device
+ DIR* l_dirp = opendir(l_usb_path.c_str());
+ if (l_dirp != NULL) { // LCOV_EXCL_BR_LINE 5: c code error case
+ int fd = dirfd(l_dirp);
+ if (fd != -1) { // LCOV_EXCL_BR_LINE 5: c code error case
+ if (syncfs(fd) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. syncfs failed path=%s [%s]", l_usb_path.c_str(),
+ strerror(errno));
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. syncfs get fd failed path=%s, [%s]",
+ l_usb_path.c_str(), strerror(errno));
+ }
+ closedir(l_dirp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. syncfs opendir failed path=%s, [%s]",
+ l_usb_path.c_str(), strerror(errno));
+ }
+ {
+#define USB_MEMORY_SYNC_WAITTIME 8 // 8 sec
+ const struct timespec intval = { USB_MEMORY_SYNC_WAITTIME, 0 };
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "%d sec:Waiting for USB Memory Synchronization.(%s)",
+ USB_MEMORY_SYNC_WAITTIME, l_usb_path.c_str());
+ nanosleep(&intval, NULL);
+ }
+ }
+ if (eFrameworkunifiedStatusOK
+ != McSend(this->m_parentMcQueue, m_loggerStorageInfo.Name.c_str(),
+ l_cmdId, 0, NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. McSend(this->m_parentMcQueue)");
+ }
+ }
+ pthread_cleanup_pop(1);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+void CLoggerErrorEventStorage::Cleanup(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (-1 != this->m_receiveQueue) { // LCOV_EXCL_BR_LINE 200: m_receiveQueue cam not be -1
+ if (-1 == mq_close(this->m_receiveQueue)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. mq_close()");
+ }
+ this->m_receiveQueue = -1;
+ }
+ if (-1 != this->m_sendQueue) { // LCOV_EXCL_BR_LINE 200: m_sendQueue cam not be -1
+ if (-1 == mq_close(this->m_sendQueue)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. mq_close()");
+ }
+ this->m_sendQueue = -1;
+ if (-1 == mq_unlink(m_loggerStorageInfo.Name.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. mq_unlink()");
+ }
+ }
+
+ if (-1 != m_mutexInit) { // LCOV_EXCL_BR_LINE 200: m_mutexInit cam not be -1
+ if (EOK != pthread_mutex_destroy(&this->m_mutex)) { // LCOV_EXCL_BR_LINE 5: c code error case
+ // LCOV_EXCL_START 5: c code error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. mq_unlink()");
+ // LCOV_EXCL_STOP
+ }
+ m_mutexInit = -1;
+ }
+
+ if (NULL != m_parentMcQueue) { // LCOV_EXCL_BR_LINE 200: m_parentMcQueue cam not be null
+ if (eFrameworkunifiedStatusOK != McClose(m_parentMcQueue)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. McClose()");
+ }
+ this->m_parentMcQueue = NULL;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+void* CLoggerErrorEventStorage::ThreadFunctionWrapper(void* param) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CLoggerErrorEventStorage* l_pObj =
+ reinterpret_cast<CLoggerErrorEventStorage *>(param);
+
+ l_pObj->ThreadFunction();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return NULL;
+}
+
+void CLoggerErrorEventStorage::CleanupWrapper(void* param) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CLoggerErrorEventStorage* l_pObj =
+ reinterpret_cast<CLoggerErrorEventStorage *>(param);
+
+ l_pObj->Cleanup();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : PackageAndPlaceArtifacts
+// brief : This function creates an archive for all collected artifacts
+// and places the archive in the required location depending
+// on the event type and required naming criteria.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerErrorEventStorage::PackageAndPlaceArtifacts(
+ std::string f_archiveDestination, TArtifactResponseVec &f_responseVector,
+ uint32_t f_logTime) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_coreFileName = "";
+ SI_32 l_ret = 0;
+
+ if (f_archiveDestination.size() == 0) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Unknown package file path and name. Logging artifacts not stored!");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ CErrorEventArchive l_archiver;
+ l_eStatus = l_archiver.openArchive(f_archiveDestination);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: it can not be fail
+ // LCOV_EXCL_START 6: it can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Failed to create logging archive: %s. Log archive will not be stored!",
+ f_archiveDestination.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ for (UI_32 i = 0; (i < f_responseVector.size()); i++) {
+ if (f_responseVector[i].Filepath != std::string("")) {
+ std::string l_destName = f_responseVector[i].Filepath;
+
+ if ((f_responseVector[i].Filepath.find(".bmp") // LCOV_EXCL_BR_LINE 200: no bmp file be set
+ == f_responseVector[i].Filepath.find_last_of('.'))
+ && (f_responseVector[i].Filepath.find(".bmp")
+ != std::string::npos)) {
+ // LCOV_EXCL_START 200: no bmp file be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ char buffer[20];
+ struct tm local_time;
+ Clock_getLocalTimeY2K38(&f_logTime, &local_time);
+ if (0
+ != strftime(buffer, sizeof(buffer), "%Y%m%d%H%M%S.bmp",
+ &local_time)) {
+ l_destName = buffer;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ l_destName = f_responseVector[i].Filepath.substr(
+ f_responseVector[i].Filepath.find_last_of('/') + 1);
+ }
+ if (f_responseVector[i].ArtifactId == eArtifactIdPstoreLog) { // LCOV_EXCL_BR_LINE 200: can not be eArtifactIdPstoreLog // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_destName = KERNEL_LOG_PATH_DIR; // LCOV_EXCL_LINE 200: can not be eArtifactIdPstoreLog
+ }
+ l_eStatus = l_archiver.addToArchive(f_responseVector[i].Filepath,
+ l_destName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200: can not be fail
+ // LCOV_EXCL_START 200: can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Failed to add artifact: %s to archive %s. Continuing with next artifact.",
+ f_responseVector[i].Filepath.c_str(),
+ f_archiveDestination.c_str());
+ // LCOV_EXCL_STOP
+ }
+ l_ret++;
+ if ((l_ret % m_loggerStorageInfo.TimeoutAfter) == 0) {
+ usleep(m_loggerStorageInfo.Timeout);
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != l_archiver.closeArchive()) { // LCOV_EXCL_BR_LINE 200: closeArchive can not be fail
+ // LCOV_EXCL_START 200: closeArchive can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_archiver.closeArchive()");
+ // LCOV_EXCL_STOP
+ } else {
+ // Cleanup artifacts that are no longer required.
+ int rc = access(f_archiveDestination.c_str(), F_OK);
+ if (0 != rc) { // LCOV_EXCL_BR_LINE 5: f_archiveDestination is aways exist
+ // LCOV_EXCL_START 5: f_archiveDestination is aways exist
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Archive verification failed. Errno: %d, %s.", errno,
+ strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ TEXT(__FUNCTION__,
+ " Error Event: A archive successfully written to: %s.",
+ f_archiveDestination.c_str());
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////
+/// File Copy
+/// arg:
+/// isDeleteFiles : TRUE - delete original files after copy.
+/// FALSE - not delete after copy.
+/// returns:
+/// -1: error while writing
+/// else, number of files written
+///////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: can not be called
+SI_32 CLoggerErrorEventStorage::CopyFiles(
+ std::string f_destination, TArtifactResponseVec &f_responseVector,
+ BOOL isDeleteFiles) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SI_32 l_ret = 0;
+ BOOL l_isFaile = FALSE;
+ for (UI_32 i = 0; i < f_responseVector.size(); i++) {
+ if (f_responseVector[i].Filepath != "") {
+ if (CFSDirectory::IsDirectory(f_responseVector[i].Filepath)) {
+ DIR * l_pDir = opendir(f_responseVector[i].Filepath.c_str());
+ if (l_pDir == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s",
+ f_responseVector[i].Filepath.c_str());
+ } else {
+ struct dirent l_pDirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_pDir, &l_pDirent, &next) && next != NULL) {
+ if ((0 != strcmp(l_pDirent.d_name, ".")) && /* Ignore special . directory. */
+ (0 != strcmp(l_pDirent.d_name, "..")) && /* Ignore special .. directory. */
+ (0 != strcmp(l_pDirent.d_name, "lost+found")) && /* Ignore lost+found. */
+ ('.' != l_pDirent.d_name[0])) { /* Ignore hidden files */
+ std::string l_fileSource = f_responseVector[i].Filepath;
+ std::string l_fileDestination = f_destination;
+ l_fileSource.append("/");
+ l_fileSource.append(l_pDirent.d_name);
+ l_fileDestination.append("/");
+ l_fileDestination.append(l_pDirent.d_name);
+ EFrameworkunifiedStatus loggerserviceRet = eFrameworkunifiedStatusOK;
+ if (isDeleteFiles == TRUE) {
+ loggerserviceRet = CLoggerUtil::MoveUntyped(l_fileSource,
+ l_fileDestination);
+ } else {
+ loggerserviceRet = CLoggerUtil::CopyUntyped(l_fileSource,
+ l_fileDestination);
+ }
+
+ if (eFrameworkunifiedStatusOK == loggerserviceRet) {
+ l_ret++;
+ if ((l_ret % m_loggerStorageInfo.TimeoutAfter) == 0) {
+ usleep(m_loggerStorageInfo.Timeout);
+ }
+ } else {
+ l_isFaile = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not move: %s",
+ l_fileSource.c_str());
+ }
+ }
+ }
+ (void) closedir(l_pDir);
+ }
+ } else {
+ std::string l_filename = f_responseVector[i].Filepath.substr(
+ f_responseVector[i].Filepath.find_last_of('/'));
+ std::string l_destination = std::string(f_destination).append(
+ l_filename);
+ if (eFrameworkunifiedStatusOK
+ == CLoggerUtil::MoveUntyped(f_responseVector[i].Filepath,
+ l_destination)) {
+ l_ret++;
+ if ((l_ret % m_loggerStorageInfo.TimeoutAfter) == 0) {
+ usleep(m_loggerStorageInfo.Timeout);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not move: %s",
+ f_responseVector[i].Filepath.c_str());
+ l_isFaile = TRUE;
+ }
+ }
+ }
+ }
+ if (l_isFaile)
+ l_ret = -1;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerErrorEventStorage::RemoveDeprecatedArtifacts(
+ TArtifactResponseVec &f_responseVector) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_success = TRUE;
+ for (UI_32 i = 0; i < f_responseVector.size(); i++) {
+ if ((f_responseVector[i].Filepath != "")
+ && (TRUE == f_responseVector[i].Remove)) {
+ if (CFSDirectory::IsDirectory(f_responseVector[i].Filepath)) {
+ if (TRUE
+ != CFSDirectory::RemoveDirectory(f_responseVector[i].Filepath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. Directory %s failed to be deleted.",
+ f_responseVector[i].Filepath.c_str());
+ l_success &= FALSE;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Directory %s has been successfully deleted.",
+ f_responseVector[i].Filepath.c_str());
+ }
+
+ } else {
+ errno = 0;
+ if (0 != remove(f_responseVector[i].Filepath.c_str())) { // LCOV_EXCL_BR_LINE 5: c code error case
+ // LCOV_EXCL_START 5: c code error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == ENOENT) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. %s not available. Skipping file deletion.",
+ f_responseVector[i].Filepath.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. File %s failed to be deleted.",
+ f_responseVector[i].Filepath.c_str());
+ l_success &= FALSE;
+ }
+ errno = 0;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. File %s has been successfully deleted.",
+ f_responseVector[i].Filepath.c_str());
+ }
+ }
+ }
+ }
+ l_eStatus = (l_success == TRUE) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/systemservice/logger_service/server/src/ss_logger_fs_directory.cpp b/systemservice/logger_service/server/src/ss_logger_fs_directory.cpp
new file mode 100755
index 0000000..4cb3996
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_fs_directory.cpp
@@ -0,0 +1,236 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file contains declaration of class CFSDirectory.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_fs_directory.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string>
+#include "loggerservicedebug_loggerservicelog.h"
+#include "ss_logger_types.h"
+#include "ss_logger_util.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFSDirectory
+/// Constructor of CFSDirectory class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFSDirectory::CFSDirectory() { // LCOV_EXCL_START 14:static instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFSDirectory
+/// Destructor of CFSDirectory class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFSDirectory::~CFSDirectory() { // LCOV_EXCL_START 14:static instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateDirectory
+/// Method to create a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFSDirectory::CreateDirectory(std::string &f_cDirPath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (!f_cDirPath.empty()) { // LCOV_EXCL_BR_LINE 6: f_cDirPath is aways not empty
+ PSTR l_cTempDirPath;
+ PSTR l_cParsedDirPath;
+ PCSTR l_cCopypath = f_cDirPath.c_str();
+
+ l_cTempDirPath = const_cast<PSTR>(f_cDirPath.c_str());
+ while (l_eStatus == eFrameworkunifiedStatusOK
+ && (l_cParsedDirPath = std::strchr(l_cTempDirPath, '/')) != 0) {
+ if (l_cParsedDirPath != l_cTempDirPath) {
+ /* Neither root nor double slash in path */
+ *l_cParsedDirPath = '\0';
+ if (0
+ != mkdir(l_cCopypath,
+ S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+ if (EEXIST != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Cannot Create directory %s",
+ l_cCopypath);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // file already exist
+ }
+ }
+ *l_cParsedDirPath = '/';
+ }
+ l_cTempDirPath = l_cParsedDirPath + 1;
+ }
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (0
+ != mkdir(l_cCopypath,
+ S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+ if (EEXIST != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Cannot Create directory %s",
+ l_cCopypath);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // file already exist
+ }
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_cDirPath is aways not empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "String Empty.");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DoesDirectoryExist
+/// Method to check if a directory exists.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::DoesDirectoryExist(std::string &f_cDirPath) {
+ DIR* l_pDirDescriptor = opendir(f_cDirPath.c_str());
+ if (NULL != l_pDirDescriptor) {
+ closedir(l_pDirDescriptor);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsDirectory
+/// Method to check if the entity is a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::IsDirectory(std::string &f_cPath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReturn = FALSE;
+
+ if (!f_cPath.empty()) { // LCOV_EXCL_BR_LINE 6: f_cPath can not be empty
+ struct stat st_buf;
+ if (-1 == stat(f_cPath.c_str(), &st_buf)) { // LCOV_EXCL_BR_LINE 5: c code.
+ // LCOV_EXCL_START 5: c code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: stat failed for path/file %s, errno %d", f_cPath.c_str(),
+ errno);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ l_bReturn = FALSE;
+ return l_bReturn;
+ // LCOV_EXCL_STOP
+ }
+
+ // Get the status of the file
+ if (S_ISREG(st_buf.st_mode)) {
+ l_bReturn = FALSE; // return false if f_cPath is a regular file
+ }
+ if (S_ISDIR(st_buf.st_mode)) {
+ l_bReturn = TRUE; // return true if f_cPath is a directory
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_cPath can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Pathname empty.");
+ l_bReturn = FALSE;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReturn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveDirectory
+/// Method to remove a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::RemoveDirectory(std::string &f_cPath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReturn = FALSE;
+
+ if (RemoveSubDirectory(f_cPath)) {
+ // delete the parent directory
+ if (0 == rmdir(f_cPath.c_str())) { // LCOV_EXCL_BR_LINE 5: c code error case
+ l_bReturn = TRUE;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReturn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveSubDirectory
+/// Method to remove a sub directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::RemoveSubDirectory(std::string &f_cPath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReturn = TRUE;
+
+ if (!f_cPath.empty()) { // LCOV_EXCL_BR_LINE 6: f_cPath can not be empty
+ std::string l_cFilePath = "";
+
+ struct dirent l_Dirent;
+ struct dirent* next;
+ DIR *l_pDir = NULL;
+
+ l_pDir = opendir(f_cPath.c_str());
+ if (NULL != l_pDir) { // LCOV_EXCL_BR_LINE 5: c code.
+ if ('/' != f_cPath[f_cPath.length() - 1]) {
+ f_cPath.append("/");
+ }
+
+ while (0 == readdir_r(l_pDir, &l_Dirent, &next) && next != NULL) {
+ if (0 != std::strcmp(l_Dirent.d_name, ".")
+ && 0 != std::strcmp(l_Dirent.d_name, "..")
+ && 0 != std::strcmp(l_Dirent.d_name, "lost+found")) {
+ l_cFilePath.assign(f_cPath);
+ l_cFilePath.append(l_Dirent.d_name); // concatenate the strings to get the complete f_cPath
+
+ if (TRUE == IsDirectory(l_cFilePath)) {
+ l_bReturn = RemoveDirectory(l_cFilePath);
+ } else {
+ // it's a file, we can use unlink
+ if (unlink(l_cFilePath.c_str()) == -1) {
+ l_bReturn = FALSE;
+ }
+ }
+ }
+ }
+ closedir(l_pDir); // close the directory
+ CLoggerUtil::SyncDir(f_cPath);
+ } else {
+ // LCOV_EXCL_START 5: c code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pDir is NULL");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_cPath can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Pathname empty.");
+ l_bReturn = FALSE;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReturn;
+}
diff --git a/systemservice/logger_service/server/src/ss_logger_popups.cpp b/systemservice/logger_service/server/src/ss_logger_popups.cpp
new file mode 100755
index 0000000..92a5737
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_popups.cpp
@@ -0,0 +1,176 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_popups.h"
+#include <string>
+#include <vector>
+CLoggerPopups::CLoggerPopups()
+ : m_pLoggerCfg(NULL),
+ m_startShown(FALSE) {
+}
+
+CLoggerPopups::~CLoggerPopups() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerPopups::Initialize(CLoggerCfg* f_pLoggerCfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ this->m_pLoggerCfg = f_pLoggerCfg;
+ l_eStatus = (m_pLoggerCfg == NULL) ? eFrameworkunifiedStatusNullPointer : eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+BOOL CLoggerPopups::IsPopupNeeded(TLoggerErrorEvent f_event) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_ret = ((f_event.EventBitMask & EVENT_BIT_POPUP) != 0) ? TRUE : FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+BOOL CLoggerPopups::CanShowStartPopup(
+ std::vector<TLoggingArtifact>* f_remainingArtifact) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_ret = FALSE;
+ if (f_remainingArtifact != NULL) {
+ l_ret = TRUE;
+ std::vector<TLoggingArtifact>::iterator l_iter;
+ for (l_iter = f_remainingArtifact->begin();
+ f_remainingArtifact->end() != l_iter; l_iter++) {
+ if (l_iter->ArtifactId == eArtifactIdScreenShot) {
+ l_ret = FALSE;
+ break;
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+std::string CLoggerPopups::getDeviceName(std::string f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "";
+ if (f_dest.length() == 0) {
+ } else if (f_dest.find(this->m_pLoggerCfg->m_usb0MountPath) != std::string::npos) {
+ l_ret = "USB 1";
+ } else if (f_dest.find(this->m_pLoggerCfg->m_usb1MountPath) != std::string::npos) {
+ l_ret = "USB 2";
+ } else if (f_dest.find(this->m_pLoggerCfg->m_sdMountPath) != std::string::npos) {
+ l_ret = "SD card";
+ } else if (f_dest.find(this->m_pLoggerCfg->m_emmcOutputPath)
+ != std::string::npos) {
+ l_ret = "Emmc";
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. No matching Path found for %s",
+ f_dest.c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %s", l_ret.c_str());
+ return (l_ret);
+}
+
+EFrameworkunifiedStatus CLoggerPopups::ShowStartPopup(
+ HANDLE f_hApp, TLoggerErrorEvent f_event,
+ std::vector<TLoggingArtifact>* f_remainingArtifact, std::string f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (this->m_startShown != FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Pop up already shown");
+ } else if (TRUE != IsPopupNeeded(f_event)) {
+ this->m_startShown = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Start pop up not needed for event %d.",
+ f_event.EventType);
+ } else if (TRUE != CanShowStartPopup(f_remainingArtifact)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Screenshot still in artifact vector.");
+ } else {
+ this->m_startShown = TRUE;
+ STLoggerFolderInfo l_folderInfo;
+ l_folderInfo.FoldernameAndLogname[0] = '\0';
+ std::string l_dest = this->getDeviceName(f_dest);
+ std::size_t l_len = l_dest.copy(l_folderInfo.StorageTarget,
+ sizeof(l_folderInfo.StorageTarget) - 1u, 0);
+ l_folderInfo.StorageTarget[l_len] = '\0';
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. Show start pop up. Destination: %s",
+ l_folderInfo.StorageTarget);
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, SS_LOGGER_LOGSTARTED_EVT,
+ NULL,
+ &l_folderInfo, sizeof(l_folderInfo));
+
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedPublishEvent(SS_LOGGER_LOGSTARTED_EVT)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerPopups::ShowEndPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ std::string f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ this->m_startShown = FALSE;
+ if (TRUE != IsPopupNeeded(f_event)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. No pop up needed at end of Logging.");
+ } else {
+ STLoggerFolderInfo l_folderInfo;
+ std::size_t l_len = f_dest.copy(
+ l_folderInfo.FoldernameAndLogname,
+ sizeof(l_folderInfo.FoldernameAndLogname) - 1u,
+ f_dest.find_last_of('/') + 1);
+ l_folderInfo.FoldernameAndLogname[l_len] = '\0';
+
+ std::string l_dest = this->getDeviceName(f_dest);
+ l_len = l_dest.copy(l_folderInfo.StorageTarget,
+ sizeof(l_folderInfo.StorageTarget) - 1, 0);
+ l_folderInfo.StorageTarget[l_len] = '\0';
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Show end pop up. Filepath: %s, Device: %s",
+ l_folderInfo.FoldernameAndLogname, l_folderInfo.StorageTarget);
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, SS_LOGGER_LOGINFO_EVT,
+ NULL,
+ &l_folderInfo, sizeof(l_folderInfo));
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedPublishEvent(SS_LOGGER_LOGINFO_EVT)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerPopups::ShowErrorPopup(HANDLE f_hApp,
+ TLoggerErrorEvent f_event,
+ UI_16 f_errCode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_16 l_errorcode = (UI_16) f_errCode;
+ this->m_startShown = FALSE;
+ if (IsPopupNeeded(f_event) == TRUE) {
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, SS_LOGGER_ERRORINFO_EVT,
+ NULL,
+ &l_errorcode, sizeof(l_errorcode));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedPublishEvent(SS_LOGGER_ERRORINFO_EVT)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
diff --git a/systemservice/logger_service/server/src/ss_logger_reader_writer_control.cpp b/systemservice/logger_service/server/src/ss_logger_reader_writer_control.cpp
new file mode 100755
index 0000000..692cab8
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_reader_writer_control.cpp
@@ -0,0 +1,151 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * ss_logger_reader_writer_control.cpp
+ */
+#include "ss_logger_reader_writer_control.h"
+#include <boost/bind.hpp>
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_transmit_log.h>
+#include <native_service/ns_logger_if.h>
+#include <string>
+#include "ss_logger_common.h"
+
+#define LOGGERSERVICELOG_REMOTE_IP_PORT 3500
+#define TRANSMIT_REMOTE_IP_PORT 3500
+
+CReaderWriterControl::CReaderWriterControl()
+ : m_pLoggerCfg(NULL) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+}
+
+CReaderWriterControl::~CReaderWriterControl() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CReaderWriterControl::Initialize(CLoggerCfg * f_pLoggerCfg) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (NULL != f_pLoggerCfg) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ this->m_pLoggerCfg = f_pLoggerCfg;
+
+ l_eStatus = m_debugReaderWriter.Initialize( // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ f_pLoggerCfg, ReaderWriter::eReaderWriterTypeMem, std::string(FRAMEWORKUNIFIEDLOG_SHAREDMEM_NAME),
+ FRAMEWORKUNIFIEDLOG_SHAREDMEM_SIZE, ReaderWriter::eReaderWriterTypeUdp,
+ std::string("169.254.80.9"), LOGGERSERVICELOG_REMOTE_IP_PORT, "", 0); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ l_eStatus = m_debugReaderWriter.Start(std::string("pdg.LogQueR"));
+ }
+
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus, "m_debugReaderWriter.Start(std::string(pdg.TransQueR)");
+
+
+ l_eStatus = m_transmitReaderWriter.Initialize( // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ f_pLoggerCfg, ReaderWriter::eReaderWriterTypeMem,
+ std::string(TRANSMIT_LOG_SHAREDMEM_NAME), TRANSMIT_LOG_SHAREDMEM_SIZE,
+ ReaderWriter::eReaderWriterTypeUdp, std::string("169.254.80.9"),
+ TRANSMIT_REMOTE_IP_PORT, "", 0); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 6:it can not be fail
+ l_eStatus = m_transmitReaderWriter.Start(std::string("pdg.TransQueR")); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus, "m_transmitReaderWriter.Start(std::string(pdg.TransQueR)");
+
+
+ l_eStatus = m_performanceReaderWriter.Initialize( // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ f_pLoggerCfg, ReaderWriter::eReaderWriterTypeQueue, std::string("/NSplog"), 0,
+ ReaderWriter::eReaderWriterTypeFile, std::string(PERFORMANCE_LOG_PATH_FN),
+ f_pLoggerCfg->m_performanceLogMaxFileSize, std::string("169.254.80.9"),
+ 0); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 6:it can not be fail
+ l_eStatus = m_performanceReaderWriter.Start(
+ std::string("pdg.PerformQueR")); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus,
+ "m_performanceReaderWriter.Start(std::string(pdg.PerformQueR)");
+
+
+ this->m_pLoggerCfg->AddLoggingParamCB(
+ boost::bind(&CReaderWriterControl::UpdateLoggingParams, this, _1));
+ }
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CReaderWriterControl::UpdateLoggingParams(void* param) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = this->m_debugReaderWriter.UpdateLoggingParameters();
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15:macro
+ "this->m_debugReaderWriter.UpdateLoggingParameters()");
+
+ l_eStatus = this->m_transmitReaderWriter.UpdateLoggingParameters();
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus, "this->m_transmitReaderWriter.UpdateLoggingParameters()");
+
+ l_eStatus = this->m_performanceReaderWriter.UpdateLoggingParameters();
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus,
+ "this->m_performanceReaderWriter."
+ "UpdateLoggingParameters()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CReaderWriterControl::FlushCache(EReaderWriterType f_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+ switch (f_type) { // LCOV_EXCL_BR_LINE 8: eReaderWriterLogDebug and eReaderWriterLogInvalid can not be called
+ // LCOV_EXCL_START 8: dead code
+ case eReaderWriterLogDebug:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = this->m_debugReaderWriter.FlushCache(
+ std::string(DEBUG_LOG_PATH_FN));
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "this->m_debugReaderWriter.FlushCache(DEBUG_LOG_PATH_FN)");
+ break;
+ // LCOV_EXCL_STOP
+ case eReaderWriterLogTransmit:
+ l_eStatus = this->m_transmitReaderWriter.FlushCache(
+ std::string(TRANSMIT_LOG_PATH_FN));
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "this->m_debugReaderWriter.FlushCache(TRANSMIT_LOG_PATH_FN)");
+ break;
+
+ case eReaderWriterLogPerformance:
+ l_eStatus = this->m_performanceReaderWriter.FlushCache(
+ std::string(PERFORMANCE_LOG_PATH_FN));
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "this->m_debugReaderWriter.FlushCache(PERFORMANCE_LOG_PATH_FN)");
+ break;
+ // LCOV_EXCL_START 8: dead code
+ case eReaderWriterLogInvalid:
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : %d", l_eStatus);
+ return (l_eStatus);
+}
+
diff --git a/systemservice/logger_service/server/src/ss_logger_server_callbacks.cpp b/systemservice/logger_service/server/src/ss_logger_server_callbacks.cpp
new file mode 100755
index 0000000..82a677b
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_server_callbacks.cpp
@@ -0,0 +1,900 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file contains the callback for Notifications and Protocol
+/// commands.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_service_callbacks.h"
+#include <string.h>
+#include <boost/bind.hpp>
+#include <errno.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_logger_service.h>
+#include <ss_logger_common.h>
+#include <system_service/ss_logger_service_notifications.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/nslogutil_cmd_if.h>
+#include <system_service/ss_sm_client_if.h>
+#include <queue>
+#include <new>
+#include <string>
+#include "ss_logger_error_event.h"
+#include "loggerservicedebug_loggerservicelog.h"
+#include "loggerservicedebug_thread_if.h"
+extern CErrorEvent g_errorEventHandler;
+extern HANDLE g_thrdEvntLogWriter;
+
+// Global variables
+STCanCurrentDateTime g_stDateAndTime = { 0 };
+UEvtLoggerCommonInfo g_uEvtLoggerCommonInfo;
+UI_16 g_u16DiagId = 0;
+
+CLoggerServiceCallbacks::CLoggerServiceCallbacks()
+ : m_pLoggerCfg(NULL),
+ m_pErrorEvent(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FrameworkunifiedProtocolCallbackHandler l_protocolHandlers[kNUMBER_PROTOCOL_HANDLERS] =
+ { { SS_LOGGER_MILEAGE_DATA, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_SetMileageData, this, _1) },
+ { SS_LOGGER_SET_PARAMS, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_SetLoggerParams, this, _1) },
+ { SS_LOGGER_UDP_LOGGING, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_UDPLogging, this, _1) },
+ { SS_LOGGERCOPYEVENTUSB, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnCopyEvntLog, this,_1) },
+ { SS_LOGGERCLEAREVENT, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnClearEvntLog, this, _1) },
+ { SS_LOGGER_READ_STATL_COUNTER, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnReadStatCounter, this, _1) },
+ { SS_LOGGER_EVENT_COMMONINFO, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_UpdateCommonInfo, this, _1) },
+ { SS_LOGGER__CWORD56__EVENT_INFO, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_Handle_CWORD56_Events, this, _1) },
+ { SS_LOGGER_RESET_STATL_COUNTER, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnResetStatCounter, this, _1) },
+ { SS_LOGGER_SET_VIN, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnSetVIN, this, _1) },
+ { SS_LOGGERCOPYEMERGENCYLOGS, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnCopyEmergencyLog, this, _1) },
+ { eSSLoggerCANProtocolIDCANTrigger, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnCANTrigger, this, _1) },
+ { eSSLoggerCANProtocolIDDTCTrigger, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnDTCTrigger, this, _1) },
+ { SS_LOGGER_SHUTDOWN_COMPLETE, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_On_SHTDWN_Complete, this, _1) },
+ { SS_LOGGER_ENG_READ_NUMOFEVENTS, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnReadNumberOfEvents, this, _1) },
+ { SS_LOGGER_SET_DIAGID, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnSetDiagID, this, _1) },
+ { SS_LOGGER_UPLOAD_EVENTLOG, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_UploadEventLog, this, _1) } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ for (UI_8 i = 0u; i < kNUMBER_PROTOCOL_HANDLERS; i++) {
+ m_protocolHandlers[i].iCmd = l_protocolHandlers[i].iCmd;
+ m_protocolHandlers[i].callBack = l_protocolHandlers[i].callBack; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+CLoggerServiceCallbacks::~CLoggerServiceCallbacks() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::Initialize(HANDLE f_hApp,
+ CLoggerCfg *f_pLoggerCfg,
+ CErrorEvent* f_pErrorEvent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ m_pLoggerCfg = f_pLoggerCfg;
+ m_pErrorEvent = f_pErrorEvent;
+
+ if ((NULL == m_pLoggerCfg) || (NULL == m_pErrorEvent)) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ // LCOV_EXCL_START 200:As it is always TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "NULL pointer passed to Initialize function!!!!!");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ // Attach callback : Open Session Request
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(f_hApp, FRAMEWORKUNIFIED_ANY_SOURCE, PROTOCOL_OPEN_SESSION_REQ, boost::bind(&CLoggerServiceCallbacks::LoggerServerOnOpenSession, this, _1)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher PROTOCOL_OPEN_SESSION_REQ (FRAMEWORKUNIFIED_ANY_SOURCE) Failed Status:0x%x ",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if ( eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(f_hApp, NTFY_SS_LoggerService_Availability))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:0x%x ", l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+//////////////////////////////////////////
+// Function : DevDetectionServerOnOpenSession
+// Callback for PROTOCOL_OPEN_SESSION_REQ
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServerOnOpenSession(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ HANDLE l_hClientService = NULL;
+ HANDLE l_hSession = NULL;
+
+ // Get the requester name
+ PCSTR pRequester = FrameworkunifiedGetMsgSrc(hApp);
+ OpenSessionAck tOpenAck;
+
+ if (pRequester) { // LCOV_EXCL_BR_LINE 4:NSFW
+ l_hClientService = FrameworkunifiedMcOpenSender(hApp, pRequester);
+
+ if (l_hClientService) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // Create a session
+ l_hSession = FrameworkunifiedCreateSession(hApp, pRequester);
+ UI_32 l_nSessionId = 0;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher( hApp, pRequester, m_protocolHandlers, kNUMBER_PROTOCOL_HANDLERS, l_hSession))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __PRETTY_FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher ss_logger_server_protocol_handlers Failed Status:0x%x ",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = this->m_pErrorEvent->OnOpenSession(hApp, pRequester,
+ l_hSession);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_pErrorEvent->OnOpenSession(%s, %p) returned: %d.",
+ pRequester, l_hSession, l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ // Attach callback : close Session Request
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, pRequester, PROTOCOL_CLOSE_SESSION_REQ, boost::bind(&CLoggerServiceCallbacks::LoggerServerOnCloseSession, this, _1)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher " "PROTOCOL_CLOSE_SESSION_REQ (FRAMEWORKUNIFIED_ANY_SOURCE) Failed Status:0x%x ",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ l_nSessionId = FrameworkunifiedGetSessionId(l_hSession);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Session id is %d", l_nSessionId); // LCOV_EXCL_BR_LINE 15:macro
+ // sending the session open
+ tOpenAck.eStatus = eFrameworkunifiedStatusOK;
+ tOpenAck.sessionId = l_nSessionId;
+ tOpenAck.sessionType = 1;
+
+ // Copy session name to data structure
+ strncpy(tOpenAck.cSessionName, FrameworkunifiedGetAppName(hApp),
+ MAX_QUEUE_NAME_SIZE - 1);
+ tOpenAck.cSessionName[MAX_QUEUE_NAME_SIZE - 1] = '\0';
+
+ // send OpenSession ACK
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(l_hClientService, PROTOCOL_OPEN_SESSION_ACK, sizeof(OpenSessionAck), (PVOID) &tOpenAck))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "FrameworkunifiedSendMsg PROTOCOL_OPEN_SESSION_ACK Failed Status:0x%x ",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = FrameworkunifiedSetSessionHandle(hApp, FrameworkunifiedGetMsgSrc(hApp), l_hSession);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSessionHandle()"); // LCOV_EXCL_BR_LINE 15:macro
+ }
+ }
+ l_eStatus = FrameworkunifiedMcClose(l_hClientService);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedMcClose()"); // LCOV_EXCL_BR_LINE 15:macro
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+// Function : DevDetectionServerOnCloseSession
+// Callback for PROTOCOL_CLOSE_SESSION_REQ
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServerOnCloseSession(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ HANDLE hSession = NULL;
+ HANDLE l_hClientService = NULL;
+ // Get the requester name
+ PCSTR pRequester = FrameworkunifiedGetMsgSrc(hApp);
+ CloseSessionAck tCloseAck;
+ CloseSessionReq tClose;
+
+ if (pRequester) { // LCOV_EXCL_BR_LINE 4:NSFW
+ l_hClientService = FrameworkunifiedMcOpenSender(hApp, pRequester);
+ if (l_hClientService) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // Read the data from the message
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tClose, sizeof(tClose), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize Failed");
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(l_hClientService))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedMcClose failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+ // LCOV_EXCL_STOP
+ }
+
+ hSession = FrameworkunifiedGetSessionHandle(hApp, pRequester, tClose.sessionId);
+
+ // Create a list of commands to be detached from the dispatcher
+ UI_32 cmd_array[kNUMBER_PROTOCOL_HANDLERS] = { 0 };
+ for (UI_32 i = 0; i < kNUMBER_PROTOCOL_HANDLERS; i++) {
+ cmd_array[i] = m_protocolHandlers[i].iCmd;
+ }
+
+ if (NULL != hSession) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // Detach callbacks associated with client
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hApp, pRequester, cmd_array, kNUMBER_PROTOCOL_HANDLERS, hSession))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __PRETTY_FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher ss_logger_server_protocol_handlers Failed Status:0x%x ",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ eStatus = m_pErrorEvent->OnCloseSession(hApp, pRequester, hSession);
+ if (eFrameworkunifiedStatusOK != eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_pErrorEvent->OnCloseSession(%s, %p) returned: %d.",
+ pRequester, hSession, eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ // API to destroy the session handle and remove it from the Application Framework.
+ // LCOV_EXCL_BR_START 4:NSFW
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroySession(hApp, // Application Handle
+ hSession))) { // Session Handle
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session destroy failed");
+ // LCOV_EXCL_STOP
+ }
+ }
+ // sending the session close ack
+ tCloseAck.eStatus = eFrameworkunifiedStatusOK;
+ tCloseAck.sessionId = tClose.sessionId;
+
+ // send CloseSession ACK
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(l_hClientService, PROTOCOL_CLOSE_SESSION_ACK, sizeof(CloseSessionAck), (PVOID) &tCloseAck))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "FrameworkunifiedSendMsg PROTOCOL_CLOSE_SESSION_ACK Failed Status:0x%x ",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(l_hClientService))) { // LCOV_EXCL_BR_LINE 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedMcClose failed"); // LCOV_EXCL_LINE 15:macro
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : LoggerServer_SetMileageData
+// Callback for SS_LOGGER_MILEAGE_DATA
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_SetMileageData(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ STLOGGER_CANDIAGSTAT MileageInfo_t;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ memset(&MileageInfo_t, 0x00, sizeof(STLOGGER_CANDIAGSTAT));
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &MileageInfo_t, sizeof(MileageInfo_t), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ UI_32 l_mileage = (MileageInfo_t.Odo_MSB_H << 24
+ | MileageInfo_t.Odo_MSB_L << 16 | MileageInfo_t.Odo_LSB_H << 8
+ | MileageInfo_t.Odo_LSB_L);
+ // if value set to SNA
+ if (0xFFFFFFFF != l_mileage) {
+ this->m_pErrorEvent->SetMileage(l_mileage);
+ // Immediate Persist Event Log
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, eThrdCmdMileageData, sizeof(UI_32), &l_mileage))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendChild msg failed:%d", l_eStatus); // LCOV_EXCL_LINE 15:macro
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+// Function : LoggerServer_SetLoggerParams
+// Callback for SS_LOGGER_SET_PARAMS
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_SetLoggerParams(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ STLoggerSetParams l_stLoggerSetParams = { eInvalid_LoggerState, eDevUSB1 };
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_stLoggerSetParams, sizeof(l_stLoggerSetParams), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize Failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+ // LCOV_EXCL_STOP
+ } else {
+ eStatus = m_pLoggerCfg->SetLoggingParams(hApp, l_stLoggerSetParams);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : LoggerServer_SetLoggerParams
+// Callback for SS_LOGGER_SET_PARAMS
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_UDPLogging(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ELOGGER_STAT l_eUDPLoggingStatus = eInvalid_LoggerState;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_eUDPLoggingStatus, sizeof(l_eUDPLoggingStatus), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize Failed");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = m_pLoggerCfg->SetUDPLogging(hApp, l_eUDPLoggingStatus);
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus,
+ "m_pLoggerCfg->SetUDPLogging()");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_UpdateCommonInfo(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &g_uEvtLoggerCommonInfo.u_stEvtLoggerCommonInfo, sizeof(g_uEvtLoggerCommonInfo.u_stEvtLoggerCommonInfo), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_Handle_CWORD56_Events(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ STEventLoggerEventInfo l_stEventLoggingEventInfo;
+ UI_16 l_evtid = 0;
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_stEventLoggingEventInfo, sizeof(l_stEventLoggingEventInfo), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ l_evtid = static_cast<UI_16>(((l_stEventLoggingEventInfo.EventGroup & 0x00FF) << 8)
+ | (l_stEventLoggingEventInfo.EventIdentifier & 0x00FF));
+ FRAMEWORKUNIFIEDLOG_EVT(ZONE_INFO, l_evtid, 4, l_stEventLoggingEventInfo.EventData[3],
+ l_stEventLoggingEventInfo.EventData[2],
+ l_stEventLoggingEventInfo.EventData[1],
+ l_stEventLoggingEventInfo.EventData[0]);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnCopyEmergencyLog(
+ HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EDevNumber l_eDevNumber;
+ std::string l_path = "";
+ std::string l_srcName = "";
+
+ if (NULL != f_hApp) { // LCOV_EXCL_BR_LINE 6: it can't be null.
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(f_hApp);
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 6: it can't be null.
+ l_srcName = l_tmp_srcname;
+ }
+
+ if (eFrameworkunifiedStatusOK
+ == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_eDevNumber,
+ sizeof(l_eDevNumber), eSMRRelease))) {
+ switch (l_eDevNumber) {
+ case eEEL_USB1:
+ l_path = m_pLoggerCfg->m_usb0MountPath;
+ break;
+
+ case eEEL_USB2:
+ l_path = m_pLoggerCfg->m_usb1MountPath;
+ break;
+
+ case eEEL_SD:
+ l_path = m_pLoggerCfg->m_sdMountPath;
+ break;
+
+ default:
+ /*send back error response wrong param*/
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Could not get msg Data.");
+ }
+
+ HANDLE l_hSession = NULL;
+ if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(f_hApp))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ m_pErrorEvent->SetDiagSessionHandle(l_hSession);
+ }
+ if (0 == l_srcName.length()) { // LCOV_EXCL_BR_LINE 6: it can't be 0.
+ // LCOV_EXCL_START 6: it can't be 0.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Could not get name of source service.");
+ // LCOV_EXCL_STOP
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ } else if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Invalid parameter l_eDevNumber(%d).", l_eDevNumber);
+ l_eStatus = m_pErrorEvent->sendDiagEventErrorResponse(eNO_ERROR_INFO,
+ l_srcName);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_pErrorEvent->sendDiagEventErrorResponse(l_srcName)");
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = m_pErrorEvent->SetDiagEventSourceName(l_srcName))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_pErrorEvent->SetDiagEventSourceName() returned %d.", l_eStatus);
+ l_eStatus = m_pErrorEvent->sendDiagEventErrorResponse(eNO_ERROR_INFO,
+ l_srcName);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_pErrorEvent->sendDiagEventErrorResponse(l_srcName)");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus =
+ SendDiagLoggingRequestToSystemManager(l_path))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* call System Manager interface*/
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. SendDiagLoggingRequestToSystemManager() returned %d.", l_eStatus);
+ l_eStatus = m_pErrorEvent->sendDiagEventErrorResponse(eNO_ERROR_INFO);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_pErrorEvent->sendDiagEventErrorResponse()");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Log Request passed to SystemManager.");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnCANTrigger(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = SendCANLoggingRequestToSystemManager();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendCANLoggingRequestToSystemManager()"); // LCOV_EXCL_BR_LINE 15:macro
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnDTCTrigger(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_dtc;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_dtc, sizeof(l_dtc), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Could not get msg Data.");
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = SendDTCLoggingRequestToSystemManager(l_dtc);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendDTCLoggingRequestToSystemManager(dtc)"); // LCOV_EXCL_BR_LINE 15:macro
+ // Immediate Persist Event Log
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(f_hApp, g_thrdEvntLogWriter, eThrdCmdImmPersistEvtLog, 0x00, NULL))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendChild msg failed:%X", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_On_SHTDWN_Complete(
+ HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = LoggerService_OnStop(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "LoggerService_OnStop()"); // LCOV_EXCL_BR_LINE 15:macro
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnSetVIN
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnSetVIN(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ STVIN_NUMBER l_stVIN_Number;
+
+ if (eFrameworkunifiedStatusOK == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_stVIN_Number, sizeof(l_stVIN_Number), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, eThrdCmdSetVINnumber, sizeof(STVIN_NUMBER), &l_stVIN_Number))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendChild msg failed:%X", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize failed errval: %X",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnCopyEvntLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnCopyEvntLog(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ TWriteFilesToUsbCmdData l_stCmdData;
+ HANDLE l_hSession = NULL;
+
+ if (hApp != NULL) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ l_stCmdData.stSessiondata.strSrcName = l_tmp_srcname;
+ }
+ if (l_stCmdData.stSessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ // LCOV_EXCL_START 6: it can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_stCmdData.stSessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<EEvtLogUSBDevNumber>(hApp, l_stCmdData.eDevId))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, // LCOV_EXCL_BR_LINE 4:NSFW
+ eThrdCmdWriteEvntFilesToUsb,
+ sizeof(TWriteFilesToUsbCmdData),
+ &l_stCmdData))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()"); // LCOV_EXCL_LINE 4:NSFW
+ }
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid App handler"); // LCOV_EXCL_LINE 6: it can not be null
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnClearEvntLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnClearEvntLog(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (hApp != NULL) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ TSessionData l_sessiondata;
+ HANDLE l_hSession = NULL;
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 4:NSFW
+ l_sessiondata.strSrcName = l_tmp_srcname;
+ }
+ if (l_sessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 4:As it is guaranteed by NSFW and is not always an empty string
+ // LCOV_EXCL_START 4:As it is guaranteed by NSFW and is not always an empty string
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_sessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, eThrdCmdClearEvntLogs, sizeof(TSessionData), &l_sessiondata))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()");
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnReadStatCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnReadStatCounter(
+ HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (hApp != NULL) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ TStatisticalCountersCmd l_stCmdData;
+ HANDLE l_hSession = NULL;
+
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ l_stCmdData.stSessiondata.strSrcName = l_tmp_srcname;
+ }
+ if (l_stCmdData.stSessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_stCmdData.stSessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<EStatCounterGroupID>(hApp,
+ l_stCmdData.eGroupId))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, // LCOV_EXCL_BR_LINE 4:NSFW
+ eThrdCmdStatisticalCounter,
+ sizeof(TStatisticalCountersCmd),
+ &l_stCmdData))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()");// LCOV_EXCL_LINE 4:NSFW
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnResetStatCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnResetStatCounter(
+ HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (hApp != NULL) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ TStatisticalCountersCmd l_stCmdData;
+ HANDLE l_hSession = NULL;
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ l_stCmdData.stSessiondata.strSrcName = l_tmp_srcname;
+ }
+ if (l_stCmdData.stSessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_stCmdData.stSessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<EStatCounterGroupID>(hApp,
+ l_stCmdData.eGroupId))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, // LCOV_EXCL_BR_LINE 4:NSFW
+ eThrdCmdResetStatisticalCntrs,
+ sizeof(TStatisticalCountersCmd),
+ &l_stCmdData))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()"); // LCOV_EXCL_LINE 4:NSFW
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnReadNumberOfEvents
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnReadNumberOfEvents(
+ HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSessionData l_sessiondata;
+ HANDLE l_hSession = NULL;
+
+ l_sessiondata.strSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ if (l_sessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_sessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, // LCOV_EXCL_BR_LINE 4:NSFW
+ eThrdCmdGetNumberOfEventsLogged,
+ sizeof(TSessionData), &l_sessiondata))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()"); // LCOV_EXCL_LINE 4:NSFW
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnSetDiagID
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnSetDiagID(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_16 l_DiagId = 0;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<UI_16>(hApp, l_DiagId))) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP
+ } else {
+ g_u16DiagId = l_DiagId;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_UploadEventLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_UploadEventLog(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSessionData l_sessiondata;
+ HANDLE l_hSession = NULL;
+
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ l_sessiondata.strSrcName = l_tmp_srcname;
+ }
+ if (l_sessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ // LCOV_EXCL_START 6: it can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_sessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, // LCOV_EXCL_BR_LINE 4:NSFW
+ eThrdCmdUploadEventLog,
+ sizeof(TSessionData), &l_sessiondata))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()"); // LCOV_EXCL_LINE 4:NSFW
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
diff --git a/systemservice/logger_service/server/src/ss_logger_util.cpp b/systemservice/logger_service/server/src/ss_logger_util.cpp
new file mode 100755
index 0000000..6ac7225
--- /dev/null
+++ b/systemservice/logger_service/server/src/ss_logger_util.cpp
@@ -0,0 +1,1273 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief Provide support for SS Logger module utility functions.
+///
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_util.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stub/Clock_API.h>
+#include <iomanip>
+#include <sstream>
+#include <string>
+#include <algorithm>
+#include <vector>
+#include "ss_logger_common.h"
+
+#include <system_service/ss_logger_store_logs.h>
+
+#define SS_STORE_FILENAME_SYSILG_TERM "_SYS_ILG_RESET.tar.gz"
+#define SS_STORE_FILENAME__CWORD52__TERM "__CWORD52_.log"
+
+
+char CLoggerUtil::m_usbpath[USB_PATH_SIZE];
+
+///////////////////////////////////////////////////////////////////////////////
+// CLASS METHODS
+///////////////////////////////////////////////////////////////////////////////
+CLoggerUtil::CLoggerUtil(void)
+ : m_pCfg(NULL),
+ m_Milage(0),
+ m_bootCount(0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_usbpath[0] = '\0';
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+CLoggerUtil::~CLoggerUtil(void) { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerUtil::Initialize(CLoggerCfg *f_pLoggerCfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ m_pCfg = f_pLoggerCfg;
+ l_eStatus = (NULL != f_pLoggerCfg) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusInvldParam;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+std::string CLoggerUtil::getDestination(TLoggerErrorEvent &f_eventNtfData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+: %d ", f_eventNtfData.EventType);
+ std::string l_path = "";
+ EFrameworkunifiedStatus l_eStatus;
+
+ switch (f_eventNtfData.EventType) {
+ case eErrorEventTypeProcessCrash:
+ case eErrorEventTypeHeartBeatFailure:
+ case eErrorEventTypeSystemLowMemory:
+ case eErrorEventTypeBootMicroReset:
+ case eErrorEventTypeProcessExit:
+ case eErrorEventTypeUserInvokedUserForceReset:
+ case eErrorEventTypeModConnFailed:
+ case eErrorEventTypeStartRespFailed:
+ case eErrorEventTypeUserInvokedCollectDevLogs:
+ case eErrorEventTypeModuleInvokedResetRequest:
+ case eErrorEventTypeModuleInvokedCollectDebugLogs:
+ case eErrorEventTypeDtcEvent:
+ case eErrorEventTypeUserInvokedClearLogs:
+ case eErrorEventTypeGroupRelaunch:
+ l_eStatus = m_pCfg->GetEmmcDestination(l_path);
+ break;
+
+ case eErrorEventTypeUserInvokedCollectNaviLog:
+ l_eStatus = m_pCfg->GetEmmcNaviLogDestination(l_path);
+ break;
+
+ case eErrorEventTypeEelExport:
+ l_path = f_eventNtfData.ModuleName;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ case eErrorEventTypeInterfaceunifiedEmmcLogs:
+ l_path = f_eventNtfData.ModuleName;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeCanEvent:
+ l_eStatus = m_pCfg->GetUserInvokedDestination(l_path);
+ break;
+
+ case eErrorEventTypeDiagEvent:
+ l_path = f_eventNtfData.ModuleName;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ default:
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Could not get filepath ");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %s", l_path.c_str());
+ return (l_path);
+}
+EFrameworkunifiedStatus CLoggerUtil::checkDestinationAvailable(
+ TLoggerErrorEvent &f_eventNtfData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string l_path = CLoggerUtil::getDestination(f_eventNtfData);
+ std::string::size_type ret;
+
+ if (l_path.length() > 0) {
+ ret = l_path.find(DEBUG_USB_PATH);
+ if (ret != std::string::npos && ret == 0) {
+ if (0 == access(m_usbpath, W_OK)) { // LCOV_EXCL_BR_LINE 5:C code
+ // LCOV_EXCL_START 5:C code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::string path = l_path.substr(sizeof(DEBUG_USB_PATH) - 1);
+ f_eventNtfData.ModuleName = m_usbpath;
+ f_eventNtfData.ModuleName.append(path);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ if (0 == access(l_path.c_str(), W_OK)) { // LCOV_EXCL_BR_LINE 5:C code
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Failed the check path: l_eStatus(%d), l_path(%s)",
+ l_eStatus, l_path.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+static void SetSuffixFromType(std::string &pathAndName, EErrorEventType type) { // NOLINT (runtime/references)
+ switch (type) {
+ case eErrorEventTypeProcessCrash:
+ case eErrorEventTypeHeartBeatFailure:
+ case eErrorEventTypeSystemLowMemory:
+ case eErrorEventTypeBootMicroReset:
+ case eErrorEventTypeProcessExit:
+ case eErrorEventTypeModConnFailed:
+ case eErrorEventTypeStartRespFailed:
+ case eErrorEventTypeModuleInvokedResetRequest:
+ pathAndName.insert(pathAndName.find(".tar.gz"), "_ERR");
+ break;
+ case eErrorEventTypeUserInvokedUserForceReset:
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeDiagEvent:
+ case eErrorEventTypeCanEvent:
+ case eErrorEventTypeDtcEvent:
+ case eErrorEventTypeModuleInvokedCollectDebugLogs:
+ pathAndName.insert(pathAndName.find(".tar.gz"), "_DIAG");
+ break;
+ case eErrorEventTypeUserInvokedCollectDevLogs:
+ pathAndName.insert(pathAndName.find(".tar.gz"), "_DEBUG");
+ break;
+ case eErrorEventTypeGroupRelaunch:
+ pathAndName.insert(pathAndName.find(".tar.gz"), "_GRP_RELAUNCH");
+ break;
+ default:
+ break;
+ }
+}
+
+EFrameworkunifiedStatus CLoggerUtil::getFilePathAndName(HANDLE f_hApp,
+ TLoggerErrorEvent &f_eventNtfData,
+ uint32_t f_time,
+ std::string &f_pathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ f_pathAndName = "";
+
+ switch (f_eventNtfData.EventType) { // LCOV_EXCL_BR_LINE 200: eErrorEventTypeEelExport ex. can not be run
+ case eErrorEventTypeProcessCrash:
+ case eErrorEventTypeProcessExit:
+ case eErrorEventTypeHeartBeatFailure:
+ case eErrorEventTypeSystemLowMemory:
+ case eErrorEventTypeBootMicroReset:
+ case eErrorEventTypeModConnFailed:
+ case eErrorEventTypeStartRespFailed:
+ case eErrorEventTypeGroupRelaunch:
+ l_eStatus = m_pCfg->GetEmmcDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6:it will aways return ok
+ // LCOV_EXCL_START 6:it will aways return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetEmmcDestination() returned %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetEmmcFilename(f_time));
+ }
+ break;
+
+ case eErrorEventTypeUserInvokedUserForceReset:
+ case eErrorEventTypeUserInvokedCollectDevLogs:
+ l_eStatus = m_pCfg->GetEmmcDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6:it will aways return ok
+ // LCOV_EXCL_START 6:it will aways return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetEmmcDestination() returned %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetEmmcFilename(f_time));
+ }
+ break;
+ case eErrorEventTypeModuleInvokedResetRequest:
+ case eErrorEventTypeModuleInvokedCollectDebugLogs:
+ case eErrorEventTypeDtcEvent:
+ l_eStatus = m_pCfg->GetEmmcDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6:it will aways return ok
+ // LCOV_EXCL_START 6:it will aways return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetEmmcDestination() returned %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetEmmcFilename(f_time));
+ if (!f_eventNtfData.ModuleName.empty()) { // LCOV_EXCL_BR_LINE 6: ModuleName can not be empty
+ size_t l_pos = f_pathAndName.find(".tar.gz");
+ if (l_pos != std::string::npos) { // LCOV_EXCL_BR_LINE 6: ".tar.gz" is aways exist
+ f_pathAndName.insert(l_pos, f_eventNtfData.ModuleName);
+ }
+ }
+ }
+ break;
+ case eErrorEventTypeEelExport: // LCOV_EXCL_START 6: impossible to confirm because it can not get in
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ f_pathAndName = f_eventNtfData.ModuleName;
+ f_pathAndName.append("/");
+ f_pathAndName.append("loggerservicelogs_export_");
+ f_pathAndName.append(GetTimeString(f_time));
+ f_pathAndName.append(".tar.gz");
+ break;
+ // LCOV_EXCL_STOP
+ case eErrorEventTypeInterfaceunifiedEmmcLogs: // LCOV_EXCL_START 6: impossible to confirm because it can not get in
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // store the target location on event trigger
+ f_pathAndName = f_eventNtfData.ModuleName;
+ break;
+ // LCOV_EXCL_STOP
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ l_eStatus = m_pCfg->GetUserInvokedDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: impossible to confirm because it can not be fail
+ // LCOV_EXCL_START 6: impossible to confirm because it can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetUserInvokedDestination() returned %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ std::string l_emmc_path = m_pCfg->getEmmcOutputPath();
+ f_pathAndName.append(l_emmc_path);
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetUserInvokedFilename(f_hApp, f_time));
+ if (!f_eventNtfData.ModuleName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ size_t l_pos = f_pathAndName.find(".tar.gz");
+ if (l_pos != std::string::npos) { // LCOV_EXCL_BR_LINE 6: ".tar.gz" is aways exist
+ f_pathAndName.insert(l_pos, f_eventNtfData.ModuleName);
+ }
+ }
+ }
+ break;
+
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeCanEvent:
+ l_eStatus = m_pCfg->GetUserInvokedDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: impossible to confirm because it can not be fail
+ // LCOV_EXCL_START 6: impossible to confirm because it can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetUserInvokedDestination() returned %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetUserInvokedFilename(f_hApp, f_time));
+ }
+ break;
+
+ case eErrorEventTypeDiagEvent: // LCOV_EXCL_START 6: impossible to confirm because it can not get in
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ f_pathAndName = f_eventNtfData.ModuleName;
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetUserInvokedFilename(f_hApp, f_time));
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+ // LCOV_EXCL_STOP
+ case eErrorEventTypeUserInvokedClearLogs:
+ case eErrorEventTypeUserInvokedCollectNaviLog:
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Unknown event type: %d.",
+ f_eventNtfData.EventType);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+
+ SetSuffixFromType(f_pathAndName, f_eventNtfData.EventType);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+// LCOV_EXCL_START 13:
+EFrameworkunifiedStatus CLoggerUtil::getNaviLogFilePathAndName(std::string &f_prefix,
+ uint32_t f_time,
+ std::string &f_pathAndName) { // LCOV_EXCL_BR_LINE 13:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = m_pCfg->GetEmmcNaviLogDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetEmmNaviLogDestination() returned %d.",
+ l_eStatus);
+ } else {
+ f_pathAndName.append("/");
+ f_pathAndName.append(f_prefix);
+ f_pathAndName.append(GetEmmcNaviLogFilename(f_time));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 200:
+EFrameworkunifiedStatus CLoggerUtil::getEmmcNaviLogParams(
+ uint32_t f_time, EPWR_SHUTDOWN_TRIGGER_TYPE errorType,
+ std::string &f_pathName, UI_32 &f_logMax) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR *l_dirp = NULL;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_prefix = "";
+
+ std::vector<std::string> l_vector;
+ std::string l_path = m_pCfg->getEmmcOutputNaviLogPath();
+
+ if ((errorType == epssdmsdtGENERIC_ERROR_RESET)
+ || (errorType == epssdmsdtFATAL_ERROR_RESET)) {
+ /*When reset occured !!*/
+ f_logMax = m_pCfg->m_emmcOutputNaviLogErrMax;
+ l_prefix = "ERR_";
+ } else {
+ /* ACC OFF occured*/
+ f_logMax = m_pCfg->m_emmcOutputNaviLogNmlMax;
+ l_prefix = "NML_";
+ }
+
+ if (f_logMax == 0) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ return l_eStatus;
+ }
+
+ l_dirp = opendir(l_path.c_str());
+ if (l_dirp != NULL) {
+ struct dirent l_dirent;
+ struct dirent* next;
+
+ while (0 == readdir_r(l_dirp, &l_dirent, &next) && next != NULL) {
+ std::string l_findFileName = l_dirent.d_name;
+ size_t l_find_pos_top = l_findFileName.find(l_prefix.c_str());
+ size_t l_find_pos = l_findFileName.find(".log");
+ if (std::string::npos != l_find_pos
+ && std::string::npos != l_find_pos_top) {
+ l_vector.push_back(l_findFileName);
+ }
+ }
+ closedir(l_dirp);
+ }
+ std::sort(l_vector.begin(), l_vector.end());
+
+ for (UI_32 i = static_cast<UI_32>(l_vector.size()); i != 0; i--) {
+ std::string l_FilePath = l_path;
+ std::string l_FileName = l_vector.at(i - 1);
+ l_FilePath.append("/");
+ l_FilePath.append(l_FileName.c_str());
+
+ if (i < f_logMax) {
+ size_t l_pos = l_FileName.find("_", l_prefix.size());
+ if (std::string::npos != l_pos) {
+ std::string l_renameFilePath = l_path;
+ std::stringstream l_numStream;
+ l_numStream << std::setw(5) << std::setfill('0') << std::right << std::dec << (i + 1);
+ l_renameFilePath.append("/");
+ l_renameFilePath.append(l_prefix);
+ l_renameFilePath.append(l_numStream.str());
+ l_renameFilePath.append(l_FileName, l_pos, (l_FileName.size() - l_pos));
+ if (0 != rename(l_FilePath.c_str(), l_renameFilePath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. rename navilog file %s:%d.",
+ l_FilePath.c_str(), errno);
+ }
+ }
+ } else {
+ if (0 != unlink(l_FilePath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete navilog file %s:%d.",
+ l_FilePath.c_str(), errno);
+ }
+ }
+ }
+ // sync parent directory
+ SyncDir(l_path);
+
+ l_eStatus = getNaviLogFilePathAndName(l_prefix, f_time, f_pathName);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 200: can not be called
+size_t CLoggerUtil::deleteRequestLogs(std::string f_emmcpath,
+ ELOGGERSERVICELOGTYPE f_reqtype, size_t f_reqsize,
+ ELOGGERSERVICELOGTYPE f_deltype) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR* l_dirp = NULL;
+ std::vector<std::string> vect;
+ std::vector<std::string>::iterator it;
+ UI_32 l_count = 0;
+ size_t l_totalsize = 0;
+
+ // create saved file list on eMMC
+ l_dirp = opendir(f_emmcpath.c_str());
+ if (l_dirp != NULL) {
+ struct dirent l_dirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_dirp, &l_dirent, &next) && next != NULL) {
+ std::string l_filename = l_dirent.d_name;
+ if (CLoggerUtil::QueryLoggerservicelogType(l_filename) == f_deltype) {
+ vect.push_back(l_filename);
+ }
+ }
+ closedir(l_dirp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " open failed eMMC path: %s",
+ f_emmcpath.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return 0;
+ }
+
+ // get num of delete logs
+ std::sort(vect.begin(), vect.end());
+ for (it = vect.begin(); it != vect.end(); it++) {
+ l_count++;
+
+ std::string l_filename = *it;
+ struct stat st_buf;
+ std::string l_tmpstr = f_emmcpath;
+ l_tmpstr.append(l_filename.c_str());
+ if (stat(l_tmpstr.c_str(), &st_buf) != -1) {
+ l_totalsize += st_buf.st_size;
+ }
+
+ if (l_totalsize > f_reqsize) {
+ break;
+ }
+ }
+
+ // start delete logs
+ if ((l_totalsize > f_reqsize) || (f_reqtype == eLoggerservicelogTypeAbnormal)
+ || (f_reqtype == eLoggerservicelogTypeGrpRelaunch)) {
+ for (it = vect.begin(); it != vect.end() && l_count > 0; it++) {
+ l_count--;
+
+ std::string l_filename = *it;
+ std::string l_tmpstr = f_emmcpath;
+ l_tmpstr.append(l_filename.c_str());
+ if (unlink(l_tmpstr.c_str()) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " unlink failed %s:%d.",
+ l_tmpstr.c_str(), errno);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " del-file=%s total=%d", l_tmpstr.c_str(),
+ l_totalsize);
+ }
+ SyncDir(f_emmcpath);
+ } else {
+ l_totalsize = 0;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ " nothing to delete logs req-type=%d del-logtype=%d total=%d, log_count=%d",
+ f_reqtype, f_deltype, l_totalsize, l_count);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_totalsize;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 200: can not be called
+EFrameworkunifiedStatus CLoggerUtil::forceDeleteOldLog(std::string f_archive_destination,
+ size_t f_req_size) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string l_emmc_path;
+ size_t l_delsize = 0;
+ ELOGGERSERVICELOGTYPE l_logtype = eLoggerservicelogTypeOther;
+
+ size_t l_pos = f_archive_destination.find_last_of('/');
+ if (std::string::npos != l_pos) {
+ l_emmc_path = f_archive_destination.substr(0, l_pos);
+ l_emmc_path.append("/");
+ l_logtype = CLoggerUtil::QueryLoggerservicelogType(
+ f_archive_destination.substr(l_pos + 1,
+ f_archive_destination.size() - l_pos + 1));
+ }
+
+ if (l_logtype == eLoggerservicelogTypeOther) {
+ // not found
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Invalid Parameter. dest=%s",
+ f_archive_destination.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // remove dirty-file if exist
+ if (unlink(f_archive_destination.c_str()) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " unlink failed %s:%d.",
+ f_archive_destination.c_str(), errno);
+ }
+
+ // delete normal log
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, f_req_size,
+ eLoggerservicelogTypeNormal);
+ if (l_delsize >= f_req_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete normal logs success: req-size=%d, del-size=%d", f_req_size,
+ l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (l_logtype == eLoggerservicelogTypeAbnormal) {
+ // delete abnormal log if request type is abnormal
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " continue delete abnormal logs: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ size_t l_tmpsize = f_req_size;
+ l_tmpsize -= l_delsize;
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, l_tmpsize,
+ eLoggerservicelogTypeAbnormal);
+ if (l_delsize >= l_tmpsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete abnormal logs success: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " abnormal log delete not complete. req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ }
+ } else if (l_logtype == eLoggerservicelogTypeGrpRelaunch) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " continue delete group relaunch logs: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ size_t l_tmpsize = f_req_size;
+ l_tmpsize -= l_delsize;
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, l_tmpsize,
+ eLoggerservicelogTypeGrpRelaunch);
+ if (l_delsize >= l_tmpsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete group relaunch logs success: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " group relaunch log delete not complete. req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " normal log del not complete. req-size=%d, del-size=%d", f_req_size,
+ l_delsize);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerUtil::deleteOldLog(std::string log_path,
+ std::vector<std::string>& l_vector,
+ std::string& f_archive_destination,
+ UI_32 max_num) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_pos = f_archive_destination.find_last_of('/');
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 200: there is always '/' in f_destination
+ std::sort(l_vector.begin(), l_vector.end());
+ std::vector<std::string>::iterator itr = l_vector.begin();
+ for (UI_32 i = static_cast<UI_32>(l_vector.size()); (max_num - 1) < i; i--, itr++) {
+ if (itr == l_vector.end()) { // LCOV_EXCL_BR_LINE 200: (max_num - 1) can not be -1.
+ break;
+ }
+ std::string l_FilePath = log_path;
+ std::string l_FileName = *itr;
+ l_FilePath.append("/");
+ l_FilePath.append(l_FileName.c_str());
+ if (0 != unlink(l_FilePath.c_str())) {
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete old log file %s:%d.",
+ l_FilePath.c_str(), errno);
+ }
+ }
+ SyncDir(log_path);
+ } else {
+ // LCOV_EXCL_START 200: there is always '/' in f_destination
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete target not found. %s",
+ f_archive_destination.c_str());
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CLoggerUtil::deleteOldEmmcLog(std::string& f_archive_destination,
+ EErrorEventType type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR *l_dirp = NULL;
+ std::vector<std::string> vect_abnrm; /* ILLEGAL RESET LOG INFO or ERROR EXIT LOG INFO */
+ std::vector<std::string> vect_nrm; /* NORMAL LOG INFO */
+ std::vector<std::string> vect_rlnc; /* RELAUNCH LOG INFO */
+ std::string l_emmc_path = m_pCfg->getEmmcOutputPath();
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ UI_32 abnrm_count = 0;
+
+ l_dirp = opendir(l_emmc_path.c_str());
+ if (l_dirp != NULL) { // LCOV_EXCL_BR_LINE 5: opendir's error case.
+ struct dirent l_dirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_dirp, &l_dirent, &next) && next != NULL) {
+ std::string l_findFileName = l_dirent.d_name;
+
+// if ((std::string::npos != l_findFileName.find("_ILG_RESET.tar.gz"))
+// || (std::string::npos != l_findFileName.find("_ERR.tar.gz"))) {
+// vect_abnrm.push_back(l_findFileName);
+ if ((l_findFileName == ".") || (l_findFileName == "..")) {
+ continue;
+ } else if (std::string::npos != l_findFileName.find(SS_STORE_FILENAME_SYSILG_TERM)) {
+ vect_abnrm.push_back(l_findFileName);
+ } else if(std::string::npos != l_findFileName.find(SS_STORE_FILENAME__CWORD52__TERM)) { // LCOV_EXCL_BR_LINE 8: SS_STORE_FILENAME__CWORD52__TERM can not be set // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ vect_abnrm.push_back(l_findFileName); // LCOV_EXCL_LINE 8: SS_STORE_FILENAME_SYSILG_TERM can not be set // NOLINT[whitespace/line_length]
+ } else if((std::string::npos != l_findFileName.find("_ILG_RESET.tar.gz")) ||
+ (std::string::npos != l_findFileName.find("_ERR.tar.gz"))) {
+ vect_abnrm.push_back(l_findFileName);
+ abnrm_count++;
+
+ } else if (std::string::npos
+ != l_findFileName.find("_GRP_RELAUNCH.tar.gz")) {
+ vect_rlnc.push_back(l_findFileName);
+ } else if (std::string::npos != l_findFileName.find(".tar.gz")) {
+ vect_nrm.push_back(l_findFileName);
+ }
+ }
+ closedir(l_dirp);
+ }
+
+ switch (type) {
+ case eErrorEventTypeProcessCrash:
+ case eErrorEventTypeProcessExit:
+ case eErrorEventTypeHeartBeatFailure:
+ case eErrorEventTypeSystemLowMemory:
+ case eErrorEventTypeBootMicroReset:
+ case eErrorEventTypeModConnFailed:
+ case eErrorEventTypeStartRespFailed:
+ case eErrorEventTypeModuleInvokedResetRequest:
+
+// if ((UI_32) m_pCfg->m_emmcOutputErrMax <= vect_abnrm.size()) {
+// l_eStatus = deleteOldLog(l_emmc_path, vect_abnrm, f_archive_destination,
+// (UI_32) m_pCfg->m_emmcOutputErrMax);
+ if ((UI_32)m_pCfg->m_emmcOutputErrMax <= abnrm_count) {
+ l_eStatus = SS_LoggerStoreLogs_deleteOldLogAbnrm(l_emmc_path, vect_abnrm, f_archive_destination,
+ (UI_32)m_pCfg->m_emmcOutputErrMax, abnrm_count);
+
+ }
+ break;
+ case eErrorEventTypeGroupRelaunch:
+ if ((UI_32) m_pCfg->m_emmcOutputGrpRelaunchMax <= vect_rlnc.size()) {
+ l_eStatus = deleteOldLog(l_emmc_path, vect_rlnc, f_archive_destination,
+ (UI_32) m_pCfg->m_emmcOutputGrpRelaunchMax);
+ }
+ break;
+ default:
+ if ((UI_32) m_pCfg->m_emmcOutputMax <= vect_nrm.size()) {
+ l_eStatus = deleteOldLog(l_emmc_path, vect_nrm, f_archive_destination,
+ (UI_32) m_pCfg->m_emmcOutputMax);
+ }
+ break;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+void CLoggerUtil::SetMilage(UI_32 f_Milage) {
+ m_Milage = f_Milage;
+}
+
+std::string CLoggerUtil::GetUserInvokedFilename(HANDLE f_hApp, uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "";
+ std::stringstream l_nameStream;
+ UI_32 l_seqNumber = 0;
+
+ EFrameworkunifiedStatus l_eStatus = m_pCfg->GetIncrementAndPersistUserInvokedCounter(
+ f_hApp, l_seqNumber);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "GetIncrementAndPersistUserInvokedCounter()");
+
+ /* new counter value was not persisted if l_eStatus != eFrameworkunifiedStatusOK */
+
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec << l_seqNumber << '_';
+ l_nameStream << std::setw(8) << std::setfill('0') << std::right << std::dec << m_Milage << '_';
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec << m_bootCount << '_';
+ l_nameStream << std::setw(15) << GetTimeString(f_time) << ".tar.gz";
+
+ l_ret = l_nameStream.str();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+std::string CLoggerUtil::GetEmmcFilename(uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "";
+ std::stringstream l_nameStream;
+ UI_32 l_counter = 0;
+
+ m_pCfg->GetAndIncrementEmmcCounter(l_counter);
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec << l_counter << '_';
+ l_nameStream << std::setw(15) << this->GetTimeString(f_time) << ".tar.gz";
+
+ l_ret = l_nameStream.str();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+// LCOV_EXCL_START 8: dead code
+std::string CLoggerUtil::GetEmmcErrorFilename(uint32_t f_time) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "";
+ std::stringstream l_nameStream;
+ UI_32 l_counter = 0;
+
+ m_pCfg->GetAndIncrementEmmcCounter(l_counter);
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec << l_counter << '_';
+ l_nameStream << std::setw(15) << this->GetTimeString(f_time) << "_ERR.tar.gz";
+
+ l_ret = l_nameStream.str();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 13:
+std::string CLoggerUtil::GetEmmcNaviLogFilename(uint32_t f_time) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "";
+ std::stringstream l_nameStream;
+ UI_32 l_counter = 1;
+
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec << l_counter << '_';
+ l_nameStream << std::setw(15) << this->GetTimeString(f_time) << ".log";
+
+ l_ret = l_nameStream.str();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+// LCOV_EXCL_STOP
+
+std::string CLoggerUtil::GetTimeString(uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "00000000_000000";
+ struct tm local_time;
+ Clock_getLocalTimeY2K38(&f_time, &local_time);
+ char buffer[20];
+ if (0
+ != strftime(buffer, sizeof(buffer), "%Y%m%d_%H%M%S", // LCOV_EXCL_BR_LINE 5: c code
+ &local_time)) {
+ l_ret = buffer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+void CLoggerUtil::SetUsbMountPath(std::string usbpath) {
+ strncpy(m_usbpath, usbpath.c_str(), USB_PATH_SIZE - 1);
+ m_usbpath[USB_PATH_SIZE - 1] = '\0';
+}
+#ifdef RELEASE_BUILD
+EFrameworkunifiedStatus CLoggerUtil::PathCheckAndCopyFile(std::string f_source,
+ std::string f_destination) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string::size_type ret;
+
+ ret = f_destination.find(m_usbpath);
+ l_eStatus = CopyFile(f_source, f_destination);
+
+ return l_eStatus;
+}
+#endif // RELEASE_BUILD
+/////////////////////////////////////////////////////////////////////////
+///// Static Functions
+/////////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus CLoggerUtil::CopyFile(std::string f_source,
+ std::string f_destination) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ssize_t l_nrd;
+ ssize_t l_nwr;
+ char l_buf[BUF_MAX_SIZE];
+
+ int l_if = open(f_source.c_str(), O_RDONLY | O_CLOEXEC, 0);
+ if (-1 == l_if) { // LCOV_EXCL_BR_LINE 5: open's error case.
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "src open fail:%s,errno:%d,msg:%s",
+ f_source.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ bool isWebdav = false;
+ std::string l_tmpDest;
+ size_t l_pos = f_destination.find_last_of('/');
+
+ l_tmpDest = f_destination;
+ if (f_destination.find("/mnt/import") != std::string::npos) { // LCOV_EXCL_BR_LINE 13:
+ // if output to webdav's directory, don't create temporary file.
+ // because of being unable to rename the file on it.
+ isWebdav = true;
+ }
+
+ int l_of = open(l_tmpDest.c_str(), O_WRONLY | O_CREAT | O_CLOEXEC, 0640);
+ if (-1 == l_of) { // LCOV_EXCL_BR_LINE 5: open's error case.
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "dest open fail:%s,errno:%d,msg:%s",
+ l_tmpDest.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ do {
+ l_nrd = read(l_if, l_buf, sizeof(l_buf));
+ if (l_nrd == -1) { // LCOV_EXCL_BR_LINE 5: read's error case.
+ // LCOV_EXCL_START 5: read's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail:%s,errno:%d,msg:%s",
+ f_source.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ l_nwr = write(l_of, l_buf, l_nrd);
+ if (l_nwr == -1) { // LCOV_EXCL_BR_LINE 5: write's error case.
+ // LCOV_EXCL_START 5: write's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (ENOSPC == errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "write fail(ENOSPC):%s,errno:%d,msg:%s", l_tmpDest.c_str(),
+ errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusErrNoEAGAIN;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail:%s,errno:%d,msg%s",
+ l_tmpDest.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ } while (l_nrd > 0);
+
+ fsync(l_of);
+ close(l_of);
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 6: can not be fail
+ // LCOV_EXCL_START 6: can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(l_if);
+ return l_eStatus;
+ // LCOV_EXCL_STOP
+ }
+
+ {
+ struct stat istat_buf, ostat_buf;
+ int ret;
+ ret = fstat(l_if, &istat_buf);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case.
+ // LCOV_EXCL_START 5: fstat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. stat(%s). errno: %d, %s",
+ f_source.c_str(), errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ while (1) {
+ ret = stat(l_tmpDest.c_str(), &ostat_buf);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: stat's error case.
+ // LCOV_EXCL_START 5: stat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. stat(%s). errno: %d, %s",
+ l_tmpDest.c_str(), errno, strerror(errno));
+ break;
+ // LCOV_EXCL_STOP
+ }
+ if (ostat_buf.st_size >= istat_buf.st_size) { // LCOV_EXCL_BR_LINE 5: read and write can not fail, so the size is same // NOLINT[whitespace/line_length]
+ break;
+ }
+ usleep(10000); // interval
+ }
+ }
+ }
+ }
+ close(l_if);
+
+ if (!isWebdav) { // LCOV_EXCL_BR_LINE 6: isWebdav is aways false
+ if (rename(l_tmpDest.c_str(), f_destination.c_str()) != 0) { // LCOV_EXCL_BR_LINE 5: rename's error case.
+ // LCOV_EXCL_START 5: rename's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "rename %s to %s fail,errno:%d,msg:%s",
+ l_tmpDest.c_str(), f_destination.c_str(), errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 200: there is always '/' in f_destination
+ std::string l_destPath = f_destination.substr(0, l_pos);
+ SyncDir(l_destPath);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "dest invalid:%s", f_destination.c_str()); // LCOV_EXCL_LINE 200: there is always '/' in f_destination // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CLoggerUtil::CopyUntyped(std::string f_source,
+ std::string f_destination) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ struct stat l_stat;
+ int l_statRetVal;
+ if (0 != access(f_source.c_str(), F_OK)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. The specified file path and name does not exist: %s",
+ f_source.c_str());
+ } else if (0 != (l_statRetVal = lstat(f_source.c_str(), &l_stat))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. stat() for file or directory returned error: %s -> %d",
+ f_source.c_str(), l_statRetVal);
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ l_eStatus = CopyDirectory(f_source, f_destination);
+ } else if (0 != S_ISLNK(l_stat.st_mode)) {
+ // avoid duplicate copy for eErrorEventTypeInterfaceunifiedEmmcLogs: /nv/log/awlog -> /nv/BS/ss/logger_service/rwdata/log2/awlog
+ if (f_source.find("/nv/BS/ss/logger_service/rwdata/awlog") == std::string::npos) {
+ l_eStatus = CopyDirectory(f_source, f_destination);
+ }
+ } else if (0 != S_ISREG(l_stat.st_mode)) {
+#ifdef RELEASE_BUILD
+ l_eStatus = PathCheckAndCopyFile(f_source, f_destination);
+#else
+ l_eStatus = CopyFile(f_source, f_destination);
+#endif // RELEASE_BUILD
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. specified file may be a symbolic link or other non 'regular' type. File: %s, mode: 0x%04X.",
+ f_source.c_str(), l_stat.st_mode);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CLoggerUtil::CopyDirectory(std::string f_source,
+ std::string f_destination) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ DIR * l_pDir = opendir(f_source.c_str());
+
+ if (l_pDir == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s",
+ f_source.c_str());
+ } else {
+ if (mkdir(f_destination.c_str(), 0775) == -1) {
+ if (errno == EEXIST) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Directory: %s already exists.",
+ f_destination.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not create directory: %s. Errno: %s",
+ f_destination.c_str(), strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ SyncDir(f_destination);
+ size_t l_pos = f_destination.find_last_of('/');
+ if (l_pos != std::string::npos) {
+ std::string l_destPath = f_destination.substr(0, l_pos);
+ SyncDir(l_destPath);
+ }
+ }
+
+ struct dirent l_pDirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_pDir, &l_pDirent, &next) && next != NULL) {
+ if ((0 != strcmp(l_pDirent.d_name, ".")) && /* Ignore special . directory. */
+ (0 != strcmp(l_pDirent.d_name, "..")) && /* Ignore special .. directory. */
+ (0 != strcmp(l_pDirent.d_name, "lost+found")) && /* Ignore lost+found. */
+ ('.' != l_pDirent.d_name[0])) { /* Ignore hidden files */
+ std::string l_fileSource = f_source;
+ std::string l_fileDestination = f_destination;
+ l_fileSource.append("/");
+ l_fileSource.append(l_pDirent.d_name);
+ l_fileDestination.append("/");
+ l_fileDestination.append(l_pDirent.d_name);
+ l_eStatus = CopyUntyped(l_fileSource, l_fileDestination);
+ }
+ }
+
+ closedir(l_pDir);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CLoggerUtil::MoveFile(std::string f_source,
+ std::string f_destination) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+#ifdef RELEASE_BUILD
+ l_eStatus = CLoggerUtil::PathCheckAndCopyFile(f_source, f_destination);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "CLoggerUtil::PathCheckAndCopyFile()");
+#else
+ l_eStatus = CLoggerUtil::CopyFile(f_source, f_destination);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "CLoggerUtil::CopyFile()");
+#endif // RELEASE_BUILD
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ l_eStatus = (0 == remove(f_source.c_str())) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
+ if (l_eStatus == eFrameworkunifiedStatusOK) {
+ size_t l_pos = f_source.find_last_of('/');
+ if (std::string::npos != l_pos) {
+ std::string l_emmc_path = f_source.substr(0, l_pos);
+ SyncDir(l_emmc_path);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CLoggerUtil::MoveUntyped(std::string f_source,
+ std::string f_destination) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ struct stat l_stat;
+ int l_statRetVal;
+ if (0 != access(f_source.c_str(), F_OK)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. The specified file path and name does not exist: %s",
+ f_source.c_str());
+ } else if (0 != (l_statRetVal = stat(f_source.c_str(), &l_stat))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. stat() for file or directory returned error: %s -> %d",
+ f_source.c_str(), l_statRetVal);
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ l_eStatus = CLoggerUtil::MoveDirectory(f_source, f_destination);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "CLoggerUtil::MoveDirectory(f_source, f_destination);");
+ } else if (0 != S_ISREG(l_stat.st_mode)) {
+ l_eStatus = CLoggerUtil::MoveFile(f_source, f_destination);
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "CLoggerUtil::MoveFile(f_source, f_destination)");
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. specified file may be a symbolic link or other non 'regular' type. File: %s, mode: 0x%04X.",
+ f_source.c_str(), l_stat.st_mode);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CLoggerUtil::MoveDirectory(std::string f_source,
+ std::string f_destination) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ DIR * l_pDir = opendir(f_source.c_str());
+
+ if (l_pDir == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s",
+ f_source.c_str());
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ errno = 0;
+ if (mkdir(f_destination.c_str(), 0666) == -1) {
+ if (errno == EEXIST) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Directory: %s already exists.",
+ f_destination.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not create directory: %s. Errno: %s",
+ f_destination.c_str(), strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ errno = 0;
+ } else {
+ SyncDir(f_destination);
+ size_t l_pos = f_destination.find_last_of('/');
+ if (l_pos != std::string::npos) {
+ std::string l_destPath = f_destination.substr(0, l_pos);
+ SyncDir(l_destPath);
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) { /* if directory already exists or has been newly created */
+ struct dirent l_pDirent;
+ struct dirent* next;
+
+ while (0 == readdir_r(l_pDir, &l_pDirent, &next) && next != NULL) {
+ if ((0 != strcmp(l_pDirent.d_name, ".")) && /* Ignore special . directory. */
+ (0 != strcmp(l_pDirent.d_name, "..")) && /* Ignore special .. directory. */
+ (0 != strcmp(l_pDirent.d_name, "lost+found")) && /* Ignore lost+found. */
+ ('.' != l_pDirent.d_name[0])) { /* Ignore hidden files */
+ std::string l_fileSource = f_source;
+ std::string l_fileDestination = f_destination;
+ l_fileSource.append("/");
+ l_fileSource.append(l_pDirent.d_name);
+ l_fileDestination.append("/");
+ l_fileDestination.append(l_pDirent.d_name);
+ l_eStatus = MoveUntyped(l_fileSource, l_fileDestination);
+ }
+ }
+ } else {
+ }
+ closedir(l_pDir);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 200: can not be called
+ELOGGERSERVICELOGTYPE CLoggerUtil::QueryLoggerservicelogType(std::string f_logname) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+// if (f_logname.find("_ILG_RESET.tar.gz") != std::string::npos
+ if (f_logname.find(SS_STORE_FILENAME_SYSILG_TERM) != std::string::npos) {
+ return eLoggerservicelogTypeAbnormal;
+ } else if (f_logname.find(SS_STORE_FILENAME__CWORD52__TERM) != std::string::npos) {
+ return eLoggerservicelogTypeAbnormal;
+ } else if (f_logname.find("_ILG_RESET.tar.gz") != std::string::npos
+
+ || f_logname.find("_ERR.tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeAbnormal;
+ } else if (f_logname.find("_GRP_RELAUNCH.tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeGrpRelaunch;
+ } else if (f_logname.find(".tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeNormal;
+ } else {
+ return eLoggerservicelogTypeOther;
+ }
+}
+// LCOV_EXCL_STOP
+
+void CLoggerUtil::SyncDir(std::string f_dir_path) {
+ int fd = open(f_dir_path.c_str(), O_RDONLY | O_DIRECTORY | O_CLOEXEC);
+#define OPE_ERR_MSG "%s %s failed. errno:%d,msg:%s"
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: open's error case.
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "open",
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ if (fsync(fd) == -1) { // LCOV_EXCL_BR_LINE 5: open's error case.
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "fsync",
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ if (close(fd) == -1) { // LCOV_EXCL_BR_LINE 5: open's error case.
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "close",
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+#undef OPE_ERR_MSG
+}
+
diff --git a/systemservice/logger_service/server/src/testapps/fopen b/systemservice/logger_service/server/src/testapps/fopen
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/systemservice/logger_service/server/src/testapps/fopen
diff --git a/systemservice/logger_service/server/src/testapps/testapps.log b/systemservice/logger_service/server/src/testapps/testapps.log
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/systemservice/logger_service/server/src/testapps/testapps.log
diff --git a/systemservice/logger_service/server/src/testapps/testapps.tar.gz b/systemservice/logger_service/server/src/testapps/testapps.tar.gz
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/systemservice/logger_service/server/src/testapps/testapps.tar.gz
diff --git a/systemservice/logger_service/server/src/udp_file_writer.cpp b/systemservice/logger_service/server/src/udp_file_writer.cpp
new file mode 100755
index 0000000..c07db07
--- /dev/null
+++ b/systemservice/logger_service/server/src/udp_file_writer.cpp
@@ -0,0 +1,161 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/writer/udp_file_writer.h"
+#include "readerWriter/writer/file_writer.h"
+#include "readerWriter/writer/cached_file_writer.h"
+
+namespace ReaderWriter {
+
+// LCOV_EXCL_START 8:dead code
+CUdpFileWriter::CUdpFileWriter()
+ : m_pUdpWriter(NULL),
+ m_pFileWriter(NULL),
+ m_pLoggerCfg(NULL),
+ m_ipAddress(""),
+ m_port(0),
+ m_FileName(""),
+ m_FileSize(0) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+CUdpFileWriter::~CUdpFileWriter() { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (this->m_pFileWriter != NULL) {
+ delete (this->m_pFileWriter);
+ this->m_pFileWriter = NULL;
+ }
+ if (this->m_pUdpWriter != NULL) {
+ delete (this->m_pUdpWriter);
+ this->m_pUdpWriter = NULL;
+ }
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus CUdpFileWriter::Initialize(CLoggerCfg* f_pLoggerCfg,
+ std::string f_Name1, UI_32 f_size1,
+ std::string f_Name2, UI_32 f_size2) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if ((NULL == this->m_pFileWriter) && (NULL == this->m_pUdpWriter)
+ && (NULL != f_pLoggerCfg)) {
+ this->m_pFileWriter = new (std::nothrow) CCachedFileWriter();
+ this->m_pUdpWriter = new (std::nothrow) CUdpWriter();
+ m_pLoggerCfg = f_pLoggerCfg;
+ m_ipAddress = f_Name2;
+ m_port = f_size2;
+ m_FileName = f_Name1;
+ m_FileSize = f_size1;
+ EFrameworkunifiedStatus l_eStatus1 = this->m_pUdpWriter->Initialize(m_pLoggerCfg,
+ m_ipAddress, m_port,
+ "", 0);
+ EFrameworkunifiedStatus l_eStatus2 = this->m_pFileWriter->Initialize(m_pLoggerCfg,
+ m_FileName,
+ m_FileSize, "", 0);
+ l_eStatus =
+ ((l_eStatus1 != eFrameworkunifiedStatusOK) || (eFrameworkunifiedStatusOK != l_eStatus2)) ?
+ eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+ if (l_eStatus == eFrameworkunifiedStatusOK) {
+ l_eStatus = this->Open();
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CUdpFileWriter::Open(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if ((NULL != this->m_pFileWriter) && (NULL != this->m_pUdpWriter)) {
+ EFrameworkunifiedStatus l_eStatus1 = this->m_pUdpWriter->Open();
+ EFrameworkunifiedStatus l_eStatus2 = this->m_pFileWriter->Open();
+ l_eStatus =
+ ((l_eStatus1 != eFrameworkunifiedStatusOK) || (eFrameworkunifiedStatusOK != l_eStatus2)) ?
+ eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+ }
+
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+BOOL CUdpFileWriter::IsOpen(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL l_ret = FALSE;
+ if ((this->m_pUdpWriter != NULL) && (this->m_pFileWriter != NULL)) {
+ l_ret = (m_pUdpWriter->IsOpen() && m_pFileWriter->IsOpen());
+ }
+ return l_ret;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus CUdpFileWriter::Write(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesWritten) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if ((NULL != this->m_pUdpWriter)) {
+ l_eStatus = this->m_pUdpWriter->Write(f_data, f_length, f_bytesWritten);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "this->m_pUdpWriter->Write() failed.");
+ }
+
+ if ((NULL != this->m_pFileWriter)) {
+ l_eStatus = this->m_pFileWriter->Write(f_data, f_length, f_bytesWritten);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "this->m_pFileWriter->Write() failed.");
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+void CUdpFileWriter::Close() { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (this->m_pFileWriter != NULL) {
+ this->m_pFileWriter->Close();
+ delete (this->m_pFileWriter);
+ this->m_pFileWriter = NULL;
+ }
+ if (this->m_pUdpWriter != NULL) {
+ this->m_pUdpWriter->Close();
+ delete (this->m_pUdpWriter);
+ this->m_pUdpWriter = NULL;
+ }
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CUdpFileWriter::FlushCache(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (this->m_pFileWriter->FlushCache());
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CUdpFileWriter::UpdateLoggingParameters(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (this->m_pUdpWriter->UpdateLoggingParameters());
+}
+} // namespace ReaderWriter
+
+// LCOV_EXCL_STOP
diff --git a/systemservice/logger_service/server/src/udp_writer.cpp b/systemservice/logger_service/server/src/udp_writer.cpp
new file mode 100755
index 0000000..8fc4d84
--- /dev/null
+++ b/systemservice/logger_service/server/src/udp_writer.cpp
@@ -0,0 +1,295 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/writer/udp_writer.h"
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <string.h>
+#include <inttypes.h>
+#ifdef AGL_STUB
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#else
+#include <sys/syspage.h>
+#include <sys/neutrino.h>
+#endif
+#include <native_service/ns_logger_if.h>
+#include <string>
+#include <algorithm>
+
+#define TIME_UNTIL_UDP_START (UI_32)25
+
+namespace ReaderWriter {
+
+CUdpWriter::CUdpWriter()
+ : m_SocketHandle(-1),
+ m_IPAddress(""),
+ m_index(0),
+ m_port(REMOTE_IP_PORT),
+ m_InitialTimeElapsed(FALSE) {
+ std::memset(&m_oSAInfo, 0, sizeof(sockaddr_in));
+ std::memset(&m_buffer[0], 0, UDP_CACHED_BLOCK_SIZE);
+}
+
+CUdpWriter::~CUdpWriter() {
+ if (m_SocketHandle != -1) {
+ this->Close();
+ }
+}
+
+EFrameworkunifiedStatus CUdpWriter::Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2,
+ UI_32 f_size2) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ this->m_pLoggerCfg = f_pLoggerCfg;
+ this->m_IPAddress = f_Name1;
+ if (NULL == f_pLoggerCfg) { // LCOV_EXCL_BR_LINE 200: f_pLoggerCfg can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 200: f_pLoggerCfg can not be null
+ } else if ((f_pLoggerCfg->IsUDPLoggingEnabled())) {
+ if (m_IPAddress.length() > 0) {
+ this->m_port = f_size1;
+ l_eStatus = this->Open();
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "this->Open() failed. UDP logging disabled. Enable via Engineering Menu.");
+ // Continue without UDP Logging;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ this->m_SocketHandle = -1;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+BOOL CUdpWriter::IsOpen(void) {
+ BOOL l_ret = (-1 != m_SocketHandle) ? TRUE : FALSE;
+ if (TRUE == l_ret) {
+#ifdef AGL_STUB
+ UI_32 l_elapsed = ((UI_32)((F_64)ClockCycle()/1000000));
+#else
+ UI_32 l_elapsed = ((UI_32) ((F_64) ClockCycle()
+ / (F_64) (SYSPAGE_ENTRY(qtime)->cycles_per_sec)));
+#endif
+ // check if 20 Seconds have elapsed since startup
+ if (TIME_UNTIL_UDP_START <= l_elapsed) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "%d seconds elapsed. Starting UDP logging", l_elapsed);
+ m_InitialTimeElapsed = TRUE;
+ l_ret = TRUE;
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Time before starting UDP not yet elapsed. Waiting for %d more seconds",
+ (TIME_UNTIL_UDP_START - l_elapsed));
+ usleep((TIME_UNTIL_UDP_START - l_elapsed)*1000);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Starting UDP now!");
+ }
+ }
+ return l_ret;
+}
+
+EFrameworkunifiedStatus CUdpWriter::Open() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if ((m_IPAddress.length() > 0)) {
+ int l_SocketOption = 1;
+ // Set the domain using the classes domain value.
+ m_oSAInfo.sin_family = AF_INET;
+ m_oSAInfo.sin_addr.s_addr = inet_addr(OWN_ADDRESS); // m_IPAddress.c_str()); // "192.168.1.2");//htonl(INADDR_ANY);
+ m_oSAInfo.sin_port = htons(this->m_port);
+ if (FALSE == this->m_pLoggerCfg->IsUDPLoggingEnabled()) {
+ this->Close();
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else if (this->m_SocketHandle != -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. socket already opened. No action required");
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (-1 == (this->m_SocketHandle = socket(AF_INET, SOCK_DGRAM, 0))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. socket(AF_INET, SOCK_DGRAM, 0) returned -1. errno: %s",
+ strerror(errno));
+ errno = 0;
+ l_eStatus = eFrameworkunifiedStatusDbExecuteFail;
+ } else if (setsockopt(m_SocketHandle, SOL_SOCKET, SO_REUSEADDR,
+ &l_SocketOption, sizeof(l_SocketOption)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "setsockopt(SO_REUSEADDR) failed.errno: %s", strerror(errno));
+ errno = 0;
+ l_eStatus = eFrameworkunifiedStatusDbResultError;
+ }
+#ifdef AGL_STUB
+ else if (setsockopt(m_SocketHandle, SOL_SOCKET, SO_REUSEADDR , // LCOV_EXCL_BR_LINE 6: the same calls will get the same return // NOLINT (readability/braces)
+ &l_SocketOption, sizeof(l_SocketOption)) == -1)
+#else
+ else if (setsockopt(m_SocketHandle, SOL_SOCKET, SO_REUSEPORT, // NOLINT (readability/braces)
+ &l_SocketOption, sizeof(l_SocketOption)) == -1)
+#endif
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "setsockopt(SO_REUSEPORT) failed. errno: %s", strerror(errno));
+ errno = 0;
+ l_eStatus = eFrameworkunifiedStatusDbResultError;
+ } else if (setsockopt(m_SocketHandle, SOL_SOCKET, SO_DONTROUTE,
+ &l_SocketOption, sizeof(l_SocketOption)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "setsockopt(SO_DONTROUTE) failed. errno: %s", strerror(errno));
+ errno = 0;
+ l_eStatus = eFrameworkunifiedStatusDbResultError;
+ } else if (INADDR_NONE == m_oSAInfo.sin_addr.s_addr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Invalid local address.");
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ } else if (0
+ != bind(this->m_SocketHandle, (const struct sockaddr *) &m_oSAInfo,
+ sizeof(m_oSAInfo))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. bind() returned not zero. errno: %s", strerror(errno));
+ errno = 0;
+ l_eStatus = eFrameworkunifiedStatusSemUnlockFail;
+ } else {
+ m_oSAInfo.sin_addr.s_addr = inet_addr(m_IPAddress.c_str());
+ if (INADDR_NONE == m_oSAInfo.sin_addr.s_addr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Invalid target address.");
+ l_eStatus = eFrameworkunifiedStatusFault;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ this->Close();
+ m_SocketHandle = -1;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CUdpWriter::WriteData(UI_8 *f_data, UI_32 f_length,
+ SI_32 &f_bytesWritten) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_8 l_retry = SEND_RETRY_VALUE;
+ if (this->m_SocketHandle == -1) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ while ((0 != l_retry)
+ && ((f_bytesWritten >= 0) && ((UI_32) f_bytesWritten != f_length))) {
+ SI_32 l_bytesWritten = (SI_32)(sendto(m_SocketHandle, &f_data[f_bytesWritten],
+ f_length - f_bytesWritten, 0,
+ (const struct sockaddr *) &m_oSAInfo,
+ sizeof(m_oSAInfo)));
+ f_bytesWritten += l_bytesWritten;
+ l_eStatus = (l_bytesWritten >= 0) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "l_retry: %d, errno: %s", l_retry,
+ strerror(errno));
+ errno = 0;
+ l_retry--;
+ usleep(100);
+ } else {
+ l_retry = SEND_RETRY_VALUE;
+ }
+ }
+ }
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CUdpWriter::Write(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesWritten) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ f_bytesWritten = 0;
+ if ((f_data == NULL)) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ } else if ((-1 == m_SocketHandle)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (f_length > UDP_MAX_LENGTH) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Possible memory corruption.");
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Length(%d) bigger than cache. ",
+ f_length);
+ } else {
+ UI_32 l_remainingIndex = 0;
+
+ while (l_remainingIndex != f_length) {
+ UI_32 l_offset = (UDP_CACHED_BLOCK_SIZE - this->m_index);
+ l_offset = std::min(l_offset, (f_length - l_remainingIndex));
+ (void) std::memcpy(&this->m_buffer[this->m_index],
+ &f_data[l_remainingIndex], l_offset);
+ l_remainingIndex += l_offset;
+ this->m_index += l_offset;
+ if (this->m_index == UDP_CACHED_BLOCK_SIZE) {
+ (void) this->FlushCache();
+ this->m_index = 0;
+ }
+ }
+ f_bytesWritten = f_length;
+ }
+ }
+ return (l_eStatus);
+}
+void CUdpWriter::Close() {
+ if (m_SocketHandle != -1) {
+ (void) close(m_SocketHandle);
+ m_SocketHandle = -1;
+ }
+}
+
+EFrameworkunifiedStatus CUdpWriter::UpdateLoggingParameters(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (this->m_pLoggerCfg != NULL) {
+ BOOL l_enabled = this->m_pLoggerCfg->IsUDPLoggingEnabled();
+ if ((TRUE == l_enabled) && (m_SocketHandle == -1)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. Opening UDP.");
+ l_eStatus = this->Open();
+ } else if (((FALSE == l_enabled) && (m_SocketHandle != -1))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. Closing UDP.");
+ l_eStatus = eFrameworkunifiedStatusOK;
+ this->Close();
+ } else {
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- :%d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CUdpWriter::FlushCache(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SI_32 l_written = 0;
+ SI_32 l_writtenTotal = 0;
+ while (((l_writtenTotal >= 0) && ((UI_32) l_writtenTotal < this->m_index))
+ && (eFrameworkunifiedStatusOK == l_eStatus)) {
+ l_eStatus = this->WriteData(&this->m_buffer[l_writtenTotal],
+ this->m_index - l_writtenTotal, l_written);
+ l_writtenTotal += l_written;
+ l_written = 0;
+ }
+ this->m_index = 0;
+ return l_eStatus;
+}
+} // namespace ReaderWriter
diff --git a/systemservice/logger_service/server/src/writer.cpp b/systemservice/logger_service/server/src/writer.cpp
new file mode 100755
index 0000000..907b202
--- /dev/null
+++ b/systemservice/logger_service/server/src/writer.cpp
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include <new>
+#include <iostream>
+#include "readerWriter/writer/writer.h"
+#include "readerWriter/writer/file_writer.h"
+#include "readerWriter/writer/udp_writer.h"
+#include "readerWriter/writer/udp_file_writer.h"
+#include "readerWriter/writer/cached_file_writer.h"
+
+namespace ReaderWriter {
+
+CWriter::CWriter()
+ : m_pLoggerCfg(NULL) {
+}
+
+CWriter::~CWriter() {
+}
+
+CWriter* CWriter::OpenWriter(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
+ std::string f_Name1, UI_32 f_size1,
+ std::string f_Name2, UI_32 f_size2) {
+ CWriter* l_ret = NULL;
+ if ((f_Name1.length() != 0) && (f_pLoggerCfg != NULL)) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ switch (f_type) {// LCOV_EXCL_BR_LINE 200:As it must be eReaderWriterTypeQueue or eReaderWriterTypeMem
+ case eReaderWriterTypeFile:
+ l_ret = new (std::nothrow) CCachedFileWriter(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ break;
+
+ case eReaderWriterTypeUdp:
+ l_ret = new (std::nothrow) CUdpWriter(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ break;
+ case eReaderWriterTypeUdpAndFile: // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (f_Name2.length() != 0) {
+ l_ret = new (std::nothrow) CUdpFileWriter();
+ }
+ // LCOV_EXCL_STOP
+ default:
+ break;
+ }
+ }
+ if (NULL != l_ret) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ if (eFrameworkunifiedStatusOK != l_ret->Initialize(f_pLoggerCfg, f_Name1, f_size1, f_Name2, f_size2)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Open Writer Failed");
+ delete (l_ret);
+ l_ret = NULL;
+ }
+ }
+
+ return l_ret;
+}
+
+EFrameworkunifiedStatus CWriter::FlushCache(void) { // LCOV_EXCL_START 8:Base class virtual functions
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Default function called!");
+ return (eFrameworkunifiedStatusOK);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CWriter::UpdateLoggingParameters(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Default function called!");
+ return (eFrameworkunifiedStatusOK);
+}
+} // namespace ReaderWriter
+
diff --git a/systemservice/logger_service/server/work/Makefile b/systemservice/logger_service/server/work/Makefile
new file mode 100755
index 0000000..79cef35
--- /dev/null
+++ b/systemservice/logger_service/server/work/Makefile
@@ -0,0 +1,126 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = SS_LoggerService
+
+
+######### compiled sources #############
+SS_LoggerService_SRCS += mod_version.c
+SS_LoggerService_SRCS += cached_file_writer.cpp
+SS_LoggerService_SRCS += file_writer.cpp
+SS_LoggerService_SRCS += mem_reader.cpp
+SS_LoggerService_SRCS += loggerservice_application.cpp
+SS_LoggerService_SRCS += loggerservice_main.cpp
+SS_LoggerService_SRCS += loggerservicedebug_child_thread.cpp
+SS_LoggerService_SRCS += loggerservicedebug_writer_Evntworker.cpp
+SS_LoggerService_SRCS += queue_reader.cpp
+SS_LoggerService_SRCS += reader.cpp
+SS_LoggerService_SRCS += reader_writer.cpp
+SS_LoggerService_SRCS += ss_logger_cfg.cpp
+SS_LoggerService_SRCS += ss_logger_device_detection.cpp
+SS_LoggerService_SRCS += ss_logger_error_event.cpp
+SS_LoggerService_SRCS += ss_logger_error_event_archive.cpp
+SS_LoggerService_SRCS += ss_logger_error_event_can_evt_reply.cpp
+SS_LoggerService_SRCS += ss_logger_error_event_cfg.cpp
+SS_LoggerService_SRCS += ss_logger_error_event_responses.cpp
+SS_LoggerService_SRCS += ss_logger_error_event_storage.cpp
+SS_LoggerService_SRCS += ss_logger_fs_directory.cpp
+SS_LoggerService_SRCS += ss_logger_popups.cpp
+SS_LoggerService_SRCS += ss_logger_reader_writer_control.cpp
+SS_LoggerService_SRCS += ss_logger_server_callbacks.cpp
+SS_LoggerService_SRCS += ss_logger_util.cpp
+SS_LoggerService_SRCS += udp_writer.cpp
+SS_LoggerService_SRCS += writer.cpp
+SS_LoggerService_SRCS += udp_file_writer.cpp
+
+######## add source path #############
+VPATH += ../src
+VPATH += ../include/$(COMPONENT_NAME)
+VPATH += -I../include/readerWriter/reader
+VPATH += -I../include/readerWriter/writer
+
+
+######### add include path #############
+CPPFLAGS += -I./
+CPPFLAGS += -I../include
+CPPFLAGS += -I../include/readerWriter
+CPPFLAGS += -I../include/readerWriter/reader
+CPPFLAGS += -I../include/readerWriter/writer
+CPPFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+######### add compile option #############
+CPPFLAGS += -DRELEASE_BUILD
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+CPPFLAGS_mem_reader.o = -fno-exceptions
+CPPFLAGS_reader.o = -fno-exceptions
+CPPFLAGS_reader_writer.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event_archive.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event_can_evt_reply.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event_cfg.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event_responses.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event_storage.o = -fno-exceptions
+CPPFLAGS_ss_logger_fs_directory.o = -fno-exceptions
+CPPFLAGS_ss_logger_popups.o = -fno-exceptions
+CPPFLAGS_ss_logger_reader_writer_control.o = -fno-exceptions
+CPPFLAGS_ss_logger_server_callbacks.o = -fno-exceptions
+CPPFLAGS_ss_logger_util.o = -fno-exceptions
+CPPFLAGS_writer.o = -fno-exceptions
+CPPFLAGS_mod_version.o = -fno-exceptions
+CPPFLAGS_cashed_file_writer.o = -fno-exceptions
+CPPFLAGS_file_writer.o = -fno-exceptions
+CPPFLAGS_loggerservice_application.o = -fno-exceptions
+CPPFLAGS_loggerservice_main.o = -fno-exceptions
+CPPFLAGS_loggerservicedebug_child_thread.o = -fno-exceptions
+CPPFLAGS_loggerservicedebug_writer_Evntworker.o = -fno-exceptions
+CPPFLAGS_queue_reader.o = -fno-exceptions
+CPPFLAGS_ss_logger_device_detection.o = -fno-exceptions
+CPPFLAGS_udp_file_writer.o = -fno-exceptions
+CPPFLAGS_udp_writer.o = -fno-exceptions
+
+######### linked library #############
+LDFLAGS += -L../lib/
+LDLIBS += -Wl,-Bstatic -lSS_LoggerStoreLogs
+LDLIBS += -Wl,-Bstatic -lPFDRECThread
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lc #Substitute for libsocket
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lrt # for mq_xxx
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -ltar
+LDLIBS += -Wl,-Bdynamic -lz
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+LDLIBS += -Wl,-Bdynamic -lns_backup #for PFDRECTread
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lcrypto
+LDLIBS += -Wl,-Bdynamic -lextension
+LDLIBS += -Wl,-Bdynamic -lClock_API
+
+
+LINK_CXX=Y
+include ../../../system_service.mk
diff --git a/systemservice/power_service/LICENSE b/systemservice/power_service/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/systemservice/power_service/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/systemservice/power_service/Makefile.server b/systemservice/power_service/Makefile.server
new file mode 100755
index 0000000..b11e0d8
--- /dev/null
+++ b/systemservice/power_service/Makefile.server
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS = server
+
+include ../system_service.mk
diff --git a/systemservice/power_service/server/Makefile b/systemservice/power_service/server/Makefile
new file mode 100755
index 0000000..f81d2ba
--- /dev/null
+++ b/systemservice/power_service/server/Makefile
@@ -0,0 +1,51 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = SS_PowerService
+
+
+######### compiled sources #############
+SS_PowerService_SRCS += ./src/powerservice_application.cpp
+SS_PowerService_SRCS += ./src/powerservice_main.cpp
+SS_PowerService_SRCS += ./src/ss_power.cpp
+SS_PowerService_SRCS += ./src/ss_power_config.cpp
+SS_PowerService_SRCS += ./src/ss_power_session.cpp
+SS_PowerService_SRCS += ./src/ss_power_state_machine.cpp
+SS_PowerService_SRCS += ./src/ss_pwr_test_client_handlers.cpp
+SS_PowerService_SRCS += ./src/ss_supervisor_handlers.cpp
+SS_PowerService_SRCS += ./src/ss_system_handlers.cpp
+
+
+######### add include path #############
+CPPFLAGS += -I./include
+
+
+######### add compile option #############
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x09 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,13,9,8,3 ## open log-tag
+CPPFLAGS += -DTARGET_SOC_$(TARGET_SOC)
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+
+######### add library path #############
+LDFLAGS += -g -Wl,--gc-sections
+
+include ../../system_service.mk
diff --git a/systemservice/power_service/server/include/ss_power.h b/systemservice/power_service/server/include/ss_power.h
new file mode 100755
index 0000000..b1e3de5
--- /dev/null
+++ b/systemservice/power_service/server/include/ss_power.h
@@ -0,0 +1,318 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief Handles Power Service Business logic
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_H_
+
+#include <system_service/ss_power_service.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_templates.h>
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include <vector>
+#include <string>
+#include <exception>
+
+#include "ss_power_session.h"
+#include "ss_power_config.h"
+#include "ss_power_state_machine.h"
+#include "ss_power_powerservicelog.h"
+
+typedef enum _SS_PSState {
+ SS_PS_READY_TO_WAKEUP = 0x01,
+ SS_PS_WAKEUP_INITIATED,
+ SS_PS_WAKEUP_COMPLETE,
+ SS_PS_POWER_ON_COMPLETE,
+ SS_PS_POWER_OFF_INITIATED,
+ SS_PS_POWER_OFF_COMPLETE,
+ SS_PS_SHUTDOWN_INITIATED,
+ SS_PS_SHUTDOWN_COMPLETE
+ // This is not real state, used only to know total states
+ ,
+ SS_PS_STATE_MAX
+} SS_PSState;
+
+typedef struct {
+ std::string m_cmd;
+ UI_64 m_time;
+ std::string m_sender;
+} Ts_cmdHist;
+
+typedef std::vector<Ts_cmdHist> cmdHist;
+typedef cmdHist::iterator cmdHistIter;
+
+class Power {
+ public:
+ Power();
+ virtual ~Power();
+ EFrameworkunifiedStatus Initialize(HANDLE h_app);
+ static Power & GetInstance();
+
+ /// Session Request Handlers
+ EFrameworkunifiedStatus OnOpenSession(HANDLE h_app);
+ EFrameworkunifiedStatus OnCloseSession(HANDLE h_app);
+
+ /// Session Response\Ack Handlers
+ EFrameworkunifiedStatus OnWakeUpComplete(HANDLE h_app);
+ EFrameworkunifiedStatus OnShutdownComplete(HANDLE h_app);
+ EFrameworkunifiedStatus OnPrintConnections(HANDLE h_app);
+ EFrameworkunifiedStatus OnPrintStack(HANDLE h_app);
+
+ /// SSM Handlers
+
+ /// Supervisor Handlers
+ EFrameworkunifiedStatus OnPowerRequestMsg(HANDLE h_app);
+ EFrameworkunifiedStatus OnSetPowerState(HANDLE h_app);
+ EFrameworkunifiedStatus OnSetCommWakeUp(HANDLE h_app);
+ EFrameworkunifiedStatus OnSetCommSleep(HANDLE h_app);
+ EFrameworkunifiedStatus OnShutdownRequestMsg(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnPowerOnOffNotification(HANDLE h_app);
+ EFrameworkunifiedStatus OnStartModules(HANDLE h_app);
+ EFrameworkunifiedStatus OnShutdownModules(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnHysteresisTimeout(HANDLE h_app);
+
+ // System Handlers
+ EFrameworkunifiedStatus OnSystemLaunchComplete(HANDLE h_app);
+ EFrameworkunifiedStatus OnSystemShutdownComplete(HANDLE h_app);
+ EFrameworkunifiedStatus OnWakeUpTimeout(HANDLE h_app);
+ EFrameworkunifiedStatus OnShutdownTimeout(HANDLE h_app);
+
+ // Get Result query from power test client
+ EFrameworkunifiedStatus OnCurrentPowerStateQuery(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnSetVoltageState(HANDLE h_app);
+ EFrameworkunifiedStatus OnSetCrankState(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnSystemModeInfoRequest(HANDLE h_app);
+ EFrameworkunifiedStatus OnSystemModeInfoResponse(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnInitCompReport(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnSystemMgrConnectionEstablished(HANDLE h_app);
+
+ //
+ // Start Confirmation callback functions
+ //
+ EFrameworkunifiedStatus OnSendStartupConfirmationRequest(HANDLE h_app);
+ EFrameworkunifiedStatus OnSendStartupConfirmationResponse(HANDLE h_app);
+
+ //
+ // User Mode Protocol callback functions
+ //
+ EFrameworkunifiedStatus OnUserModeResponse(HANDLE h_app);
+
+ //
+ // Shutdown Condition Notification Protocol function
+ //
+ EFrameworkunifiedStatus OnPublishShutdownPopupRequest(HANDLE h_app);
+
+ //
+ // Power Popup Notification Protocol function
+ //
+ EFrameworkunifiedStatus OnPublishPowerPopupRequest(HANDLE h_app);
+
+ //
+ // HeartBeat Protocol callback functions
+ //
+ EFrameworkunifiedStatus On_CWORD56_HeartBeatRequest(HANDLE h_app);
+ EFrameworkunifiedStatus OnSM_CWORD56_HeartBeatResponse(HANDLE h_app);
+
+ //
+ // Hard Reset Protocol callback functions
+ //
+ EFrameworkunifiedStatus OnCpuResetRequest(HANDLE h_app);
+
+ //
+ // Remote Data Reset Protocol callback functions
+ //
+ EFrameworkunifiedStatus OnRemoteDataResetRequest(HANDLE h_app);
+ EFrameworkunifiedStatus OnRemoteDataResetResponse(HANDLE h_app);
+
+ cmdHist m__CWORD56_RepHist;
+ cmdHistIter m__CWORD56_RepIter;
+ cmdHist m_PubCmdHist;
+ cmdHistIter m_PubHistIter;
+ cmdHist m_ErrHist;
+ cmdHistIter m_ErrHistIter;
+ cmdHist m_VCmdHist;
+ cmdHistIter m_VHistIter;
+
+ void SSPowerDebugDump(HANDLE h_app);
+
+ private:
+#define LOG_POWERSERVICELOG_CNT(caseid, Cnt) \
+ FRAMEWORKUNIFIEDLOG_CNT(ZONE_INFO, Cnt, 0); \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " case " #caseid \
+ ": FRAMEWORKUNIFIEDLOG_CNT(ZONE_INFO, " #Cnt ", 0)");
+
+#define LOG_POWERSERVICELOG_EVT(caseid, Evt, Data0) \
+ FRAMEWORKUNIFIEDLOG_EVT(ZONE_INFO, Evt, 1, Data0); \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " case " #caseid \
+ ": FRAMEWORKUNIFIEDLOG_EVT(ZONE_INFO, " #Evt ", " #Data0 ")");
+
+#define LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(l_eStatus, pStr) \
+ if (eFrameworkunifiedStatusOK != l_eStatus) { \
+ LOG_ERROR(pStr); \
+ SetCmdHist(pStr, m_ErrHist, m_ErrHistIter, GetStr(static_cast<EFrameworkunifiedStatus>(l_eStatus)).c_str()); \
+ } // End of #define LOG_STATUS_IF_ERRORED(l_eStatus,pStr)
+
+#define SS_PWR_LOG_HIST(cmd, hist, it, sender, l_eStatus) \
+ if (eFrameworkunifiedStatusOK == l_eStatus) { \
+ SetCmdHist((static_cast< std::string> (cmd)), (static_cast<cmdHist&> (hist)), \
+ (static_cast<cmdHistIter&> (it)), (static_cast< std::string> (sender))); \
+ }
+ //**************************************************************************
+ // Counter Logging enums & typedefs *
+ // *
+ // Counter Event IDs *
+ typedef enum { // *
+ CT_Startup_CanSignal = 0x0114, // *
+ CT_Startup_DiagMsg = 0x0118, // *
+ // *
+ CT_Shutdown_CanSignal = 0x0121, // *
+ CT_Shutdown_Timeout = 0x0124, // *
+ CT_Shutdown_Temperature = 0x0125, // *
+ CT_Shutdown_Error = 0x0126, // *
+ CT_Shutdown_Voltage = 0x0127 // *
+ } EPWR_COUNTER_EVENT_ID_TYPE; // *
+ // *
+ // End of Counter Logging enums & typedefs *
+ //**************************************************************************
+
+ //**************************************************************************
+ // Event Logging enums & typedefs *
+ // *
+ // Event ID *
+ typedef enum { // *
+ // Startup Event IDs *
+ Ei_StartUp_Cansignal = 0x0101, // *
+ Ei_StartUp_HK_On = 0x0102, // *
+ // 0x0103 not specified // *
+ // 0x0104 not specified // *
+ // 0x0105 System Svcs not responsible// *
+ // 0x0106 not specified // *
+ Ei_StartUp_ActivationLine = 0x0107, // *
+ Ei_StartUp_DiagMsg = 0x0108, // *
+ // *
+ // Shutdown Event IDs *
+ Ei_shutdown_CANsignal = 0x0201, // *
+ Ei_shutdown_HkOFF = 0x0202, // *
+ // 0x0203 not specified // *
+ // 0x0204 not specified // *
+ Ei_shutdown_Temperature = 0x0205, // *
+ Ei_shutdown_NetworkError = 0x0206, // *
+ Ei_shutdown_Voltage = 0x0207 // *
+ } EPWR_LOGGING_EVENT_ID_TYPE; // *
+ // *
+ // Ei_StartUp_CanSignal byte0 Event Detail *
+ typedef enum { // *
+ epseisuedIGNITION = 0x00, // *
+ epseisuedHK_ON = 0x01, // *
+ epseisuedDOOR_MODULES = 0x02, // *
+ // 0x03 not specified // *
+ // 0x04 not specified // *
+ epseisuedPASS = 0x05, // *
+ epseisuedIHTM = 0x06, // *
+ epseisuedMPM = 0x07, // *
+ epseisuedSNA = 0xFF // *
+ } EPWR_LOGGING_EVT_DETAIL_SU_CAN_TYPE; // *
+
+ //
+ // Ei_StartUp_HkOn
+ typedef enum {
+ epseisuedHK_ON_Key = 0x00
+ } EPWR_LOGGING_EVT_DETAIL_SU_KEY_TYPE;
+
+ //
+ // Ei_StartUp_ActivationLine
+ typedef enum {
+ epseisuedACV_LINE = 0x00
+ } EPWR_LOGGING_EVT_DETAIL_SU_LINE_TYPE;
+
+ // *
+ // Ei_StartUp_DiagMsg byte0 Event Detail *
+ typedef enum { // *
+ epseisuedHU = 0x01, // *
+ epseisuedCAN = 0x02, // *
+ } EPWR_LOGGING_EVT_DETAIL_SU_DIAG_TYPE; // *
+ // *
+ // Ei_ShutDown_CanSignal byte0 Event Detail *
+ typedef enum { // *
+ epseisdcsIGN_STATE = 0x00, // *
+ epseisdcsHK_ON = 0x01 // *
+ } EPWR_LOGGING_EVT_DETAIL_SD_CAN_TYPE; // *
+ // *
+ // Ei_ShutDown_Temperature byte0 Event Detail *
+ typedef enum { // *
+ epseisdtempECU_LOW = 0x00, // *
+ epseisdtempECU_HIGH = 0x01, // *
+ } EPWR_LOGGING_EVT_DETAIL_SD_TEMP_TYPE; // *
+ // *
+ // Ei_ShutDown_NetworkError byte0 Event Detail *
+ typedef enum { // *
+ epseisdneHMI_CAN = 0x00, // *
+ epseisdneHU_CAN = 0x01 // *
+ } EPWR_LOGGING_EVT_DETAIL_SD_NETWORK_ERROR_TYPE; // *
+ // *
+ // Ei_ShutDown_Voltage byte0 Event Detail *
+ typedef enum { // *
+ epseisdnvoltBATTERY_CUT_OFF = 0x00, // *
+ epseisdnvoltLIMP_HOME = 0x01, // *
+ epseisdnvoltUNKNOWN = 0xFF // *
+ } EPWR_LOGGING_EVT_DETAIL_SD_VOLTAGE_TYPE; // *
+ // *
+ // End of Event Logging enums & typedefs *
+ //**************************************************************************
+
+ PowerSessionHandler m_oSessionHandler;
+ PowerConfigParams m_tConfigData;
+ PowerStateMachine m_oStateMachine;
+ UI_32 m_aTimerIDs[15];
+ wakeInfo m_WakeUpData; /// WakeUp data received from SPM
+ SS_PSState m_PowerState;
+ ePowerSrvVoltageStates m_VoltageState;
+ ePowerSrvCrankStates m_CrankState;
+ UI_32 m_MaxShutdownTimeout;
+ std::map<SS_PSState, std::string> m_PPStateStrMap;
+
+ // Notify Module on Voltage change detected.
+ EFrameworkunifiedStatus PublishVoltageStateChange(HANDLE h_app);
+ EFrameworkunifiedStatus ConstructPwrStateResponse(CHAR *f_MessageResponse);
+ EFrameworkunifiedStatus AddStateInformationToResponse(CHAR *f_MessageResponse);
+ EFrameworkunifiedStatus AddVoltageInformationToResponse(CHAR *f_MessageResponse);
+ EFrameworkunifiedStatus AddCrankInformationToResponse(CHAR *f_MessageResponse);
+ EFrameworkunifiedStatus RegisterAllCallbacksAndNofitications(HANDLE h_app);
+ VOID SetPowerServiceState(SS_PSState f_NewState);
+ EFrameworkunifiedStatus ValidateUserModeMessage(HANDLE h_app,
+ EPWR_USER_MODE_TYPE &l_eUserModeState); // NOLINT (runtime/references)
+
+ pthread_mutex_t pwr_hist_mutex;
+
+ void SetCmdHist(std::string cmd,
+ cmdHist &hist, // NOLINT (runtime/references)
+ cmdHistIter &it, // NOLINT (runtime/references)
+ std::string sender);
+};
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_H_
diff --git a/systemservice/power_service/server/include/ss_power_config.h b/systemservice/power_service/server/include/ss_power_config.h
new file mode 100755
index 0000000..09ca70d
--- /dev/null
+++ b/systemservice/power_service/server/include/ss_power_config.h
@@ -0,0 +1,147 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports power service configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_
+
+
+#include <system_service/ss_system_types.h>
+#include <system_service/ss_templates.h>
+#include <native_service/ns_config_parser_if.h>
+#include <list>
+#include <string>
+#include "ss_power_powerservicelog.h"
+
+typedef std::list<SS_String> RequiredModuleList;
+typedef RequiredModuleList::iterator RequiredModuleListIter;
+
+#define SS_PWR__CWORD56__REP_HIST_SIZE (10u)
+#define SS_PWR_PUB_CMD_HIST_SIZE (5u)
+#define SS_PWR_ERR_HIST_SIZE (5u)
+#define SS_PWR_V_HIST_SIZE (10u)
+#define SS_PWR_DEBUG_DUMP_MAX_SIZE (4096u)
+
+typedef struct _PowerConfigParams { // NOLINT (readability/naming) // LCOV_EXCL_BR_LINE 14:it will be called when poweron
+ typedef struct {
+ SI_32 timeout;
+ struct {
+ BOOL enabled;
+ SI_32 timeout;
+ SI_32 tries;
+ } hysteresis;
+ } PowerOffInfo;
+
+ SS_String power_logic_plugin;
+ PowerOffInfo lvi1;
+ PowerOffInfo lvi2;
+ PowerOffInfo shutdown;
+ RequiredModuleList wakeup_modules;
+ RequiredModuleList shutdown_modules;
+ RequiredModuleList lvi2_modules;
+} PowerConfigParams;
+
+class PowerConfiguration {
+ public:
+ // define all the configuration parmeters that will be used to get data
+ static const char * kPowerLogicPlugin;
+ static const char * kLVI1Timeout;
+ static const char * kLVI1HysteresisTimeout;
+ static const char * kLVI1HysteresisEnabled;
+ static const char * kLVI1HysteresisTries;
+ static const char * kLVI2Timeout;
+ static const char * kLVI2HysteresisTimeout;
+ static const char * kLVI2HysteresisEnabled;
+ static const char * kLVI2HysteresisTries;
+ static const char * kShutdownTimeout;
+ static const char * kShutdownHysteresisTimeout;
+ static const char * kShutdownHysteresisEnabled;
+ static const char * kShutdownHysteresisTries;
+
+ /// < defines the names in the xml file that are used to get required modules names
+ static const char * kRequiredWakeupModules; /// < once all the modules have been wakened up send wake-up complete
+ static const char * kRequiredShutdownModules; /// < once all the modules have been shutdown send shutdown complete
+ static const char * kRequiredLvi2Modules; /// < once all the modules have been wakened up send wake-up complete
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PowerConfiguration
+ /// \brief Here it is checked whether the new connection is to be connected or not, if yes then whether the old
+ /// connection is to be disconnected or to be paused or to be played simultaneously.
+ ///
+ /// \param [in] f_configFileName Configuration file name.
+ ///
+ /// \return NA
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ explicit PowerConfiguration(std::string f_configfilename);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~PowerConfiguration
+ /// \brief Here it is checked whether the new connection is to be connected or not, if yes then whether the old
+ /// connection is to be disconnected or to be paused or to be played simultaneously.
+ ///
+ /// \param [in] pRequestingSrc
+ /// Source* - Pointer to the requesting source.
+ ///
+ /// \return bool
+ /// bool - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~PowerConfiguration();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// LoadParameters
+ /// \brief Load module parameters from configuration file.
+ ///
+ /// \param [in] params - Ref to variable which to store the loaded module parameters.
+ ///
+ /// \return bool
+ /// bool - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL LoadParameters(PowerConfigParams & params); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// LoadDefaultParameters
+ /// \brief Laod default power services parameters.
+ ///
+ /// \param [in] params - Ref to variable for which to store the default module parameters.
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void LoadDefaultParameters(PowerConfigParams & params); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintConfigInfo
+ /// \brief Print configuration information.
+ ///
+ /// \param [in] params - Ref to variable containing the configuration parameters to load.params
+ ///
+ /// \return none.
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void PrintConfigInfo(PowerConfigParams & f_params); // NOLINT (runtime/references)
+
+ protected:
+ PowerConfiguration(const PowerConfiguration &);
+ PowerConfiguration & operator =(const PowerConfiguration &); // NOLINT (runtime/references)
+
+ private:
+ std::string m_ConfigFileName;
+};
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_
diff --git a/systemservice/power_service/server/include/ss_power_powerservicelog.h b/systemservice/power_service/server/include/ss_power_powerservicelog.h
new file mode 100755
index 0000000..3d912fa
--- /dev/null
+++ b/systemservice/power_service/server/include/ss_power_powerservicelog.h
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports 002 application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_POWERSERVICELOG_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_POWERSERVICELOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_FUNC_IPC ZONEMASK(13)
+#define ZONE_POWER_MONITOR ZONEMASK(14)
+#define ZONE_POWER_STATEMACHINE ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_INFO_IPC ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "Ipc Function"
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 "Power StateMachine"
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 "Ipc Info"
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR //, ZONE_INFO,ZONE_POWER_STATEMACHINE, ZONE_DEBUG_DUMP, ZONE_FUNC
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern const CHAR AppName[]; // NOLINT (readability/naming)
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_POWERSERVICELOG_H_
diff --git a/systemservice/power_service/server/include/ss_power_session.h b/systemservice/power_service/server/include/ss_power_session.h
new file mode 100755
index 0000000..47a4a4a
--- /dev/null
+++ b/systemservice/power_service/server/include/ss_power_session.h
@@ -0,0 +1,70 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports power service session management.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_SESSION_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_SESSION_H_
+
+#include <system_service/ss_power_service.h>
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include <string>
+#include "ss_power_config.h"
+
+typedef std::string SubscriberName; // The name of the module that is trying to open a session with Power
+
+/*
+ *
+ */
+class PowerSessionHandler {
+ public:
+ PowerSessionHandler();
+ virtual ~PowerSessionHandler();
+ EFrameworkunifiedStatus OpenSesion(HANDLE h_app);
+ EFrameworkunifiedStatus CloseSession(HANDLE h_app);
+ EFrameworkunifiedStatus StartComplete(HANDLE h_app);
+ EFrameworkunifiedStatus StopComplete(HANDLE h_app);
+
+ VOID Print();
+
+ // Methods that do the heavy lifting
+ BOOL WakeupComplete(RequiredModuleList & wakeup_modules); // NOLINT (runtime/references)
+ BOOL ShutdownComplete(RequiredModuleList & shutdown_modules); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus SendToSupervisor(UI_32 cmd, UI_32 length, PVOID data);
+ BOOL AllClientsInGroupStarted(UI_32 f_ungrpid);
+ BOOL ClientPresent(PCSTR f_sclientname);
+
+ private:
+ struct PwSessionInfo {
+ std::string sz_name;
+ std::string sz_servicename;
+ HANDLE hsession;
+ BOOL frunning;
+ EPWR_SESSION_TYPE esessiontype;
+ UI_32 ui_groupid;
+ };
+
+ typedef std::map<SubscriberName, PwSessionInfo> PwSessionMap;
+ typedef PwSessionMap::iterator PwSessionIter;
+
+ PwSessionMap m_mapSessions;
+};
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_SESSION_H_
diff --git a/systemservice/power_service/server/include/ss_power_state_hysteresis.h b/systemservice/power_service/server/include/ss_power_state_hysteresis.h
new file mode 100755
index 0000000..c136630
--- /dev/null
+++ b/systemservice/power_service/server/include/ss_power_state_hysteresis.h
@@ -0,0 +1,74 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports power service hysteresis management.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_HYSTERESIS_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_HYSTERESIS_H_
+
+#include "ss_power_config.h"
+
+class PowerStateHysteresis {
+ public:
+ PowerStateHysteresis()
+ : m_unTries(0) {
+ bzero(&m_tHysteresisInfo, sizeof(m_tHysteresisInfo));
+ }
+
+ virtual ~PowerStateHysteresis() { // LCOV_EXCL_START 14: do it when power off
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ m_unTries = 0;
+ }
+ // LCOV_EXCL_STOP 14: do it when power off
+ explicit PowerStateHysteresis(PowerConfigParams::PowerOffInfo & info) // NOLINT (runtime/references)
+ : m_unTries(0),
+ m_tHysteresisInfo(info) {
+ }
+ void set(PowerConfigParams::PowerOffInfo & info) { // NOLINT (runtime/references)
+ m_tHysteresisInfo = info;
+ }
+ BOOL getEnabled() const {
+ return m_tHysteresisInfo.hysteresis.enabled;
+ }
+ UI_32 getTimeout() const {
+ return m_tHysteresisInfo.hysteresis.timeout;
+ }
+ UI_32 getTries() const {
+ return m_tHysteresisInfo.hysteresis.tries;
+ }
+
+ void clearTryCounter() {
+ m_unTries = 0;
+ }
+ void bumbTryCounter() {
+ m_unTries++;
+ }
+ BOOL maxTries() const {
+ if (m_unTries < getTries())
+ return FALSE;
+ else
+ return TRUE;
+ }
+
+ private:
+ UI_32 m_unTries;
+ PowerConfigParams::PowerOffInfo m_tHysteresisInfo;
+};
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_HYSTERESIS_H_
diff --git a/systemservice/power_service/server/include/ss_power_state_machine.h b/systemservice/power_service/server/include/ss_power_state_machine.h
new file mode 100755
index 0000000..086f36c
--- /dev/null
+++ b/systemservice/power_service/server/include/ss_power_state_machine.h
@@ -0,0 +1,414 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports the power service state machine.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_MACHINE_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_MACHINE_H_
+
+#include <system_service/ss_power_service.h>
+#include "ss_power_state_hysteresis.h"
+
+class PowerSessionHandler;
+
+class PowerStateMachine {
+ class Base_State {
+ public:
+ virtual void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ virtual void onStartComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ virtual void onLaunchComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+ virtual void onStopComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ virtual void onShutdownComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onSoftwareUpdate(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onHysteresisAborted(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onHysteresisTimeout(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+ virtual PCSTR name() = 0;
+
+ /// State Entry and Exit methods
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+ };
+
+ friend class Base_State;
+
+ class Wakeup : public Base_State {
+ public:
+ void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onSoftwareUpdate(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ virtual PCSTR name();
+
+ // LCOV_EXCL_START 8: fist status, no entry
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 8: fist status, no entry
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ };
+
+ friend class Wakeup;
+
+ class WakeupActive : public Wakeup {
+ public:
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ };
+
+ friend class WakeupActive;
+
+ class WakeupPending : public Wakeup {
+ public:
+ void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onStartComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLaunchComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ };
+
+ friend class WakeupPending;
+
+ class Shutdown : public Base_State {
+ public:
+ void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisAborted(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisTimeout(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class Shutdown;
+
+ class ShutdownActive : public Base_State {
+ public:
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class ShutdownActive;
+
+ class LowVoltage1 : public Base_State {
+ public:
+ void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisAborted(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisTimeout(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class LowVoltage1;
+
+ class LowVoltage1Active : public Base_State {
+ public:
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class LowVoltage1Active;
+
+ class LowVoltage2 : public Base_State {
+ public:
+ void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisAborted(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisTimeout(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class LowVoltage2;
+
+ class LowVoltage2Active : public Base_State {
+ public:
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class LowVoltage2Active;
+
+ class NormalVoltage : public Base_State {
+ public:
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onSoftwareUpdate(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class NormalVoltage;
+
+ class SoftwareUpdate : public Base_State {
+ public:
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class SoftwareUpdate;
+
+ public:
+ typedef enum _Power_State_Machine_Events {
+ epsmeWAKEUP = epswsPWRON,
+ epsmeSHUTDOWN = epscnCANSLEEP,
+ epsmeLVI1_ENCOUNTERED = epsvsLVI1,
+ epsmeLVI2_ENCOUNTERED = epsvsLVI2,
+ epsmeNORMAL_VOLTAGE_ENCOUNTERED = epsvsNORMAL,
+ epsmeSTART_COMPLETE = 0xD1,
+ epsmeSTOP_COMPLETE = 0xD2,
+ epsmeSOFTWARE_UPDATE = 0xE1,
+ epsmeSHUTDOWN_HYSTERESIS_ABORTED = 0xF1,
+ epsmeLVI1_HYSTERESIS_ABORTED = 0xF2,
+ epsmeLVI2_HYSTERESIS_ABORTED = 0xF3,
+ epsmeSHUTDOWN_HYSTERESIS_TM_OUT = 0xFA,
+ epsmeLVI1_HYSTERESIS_TM_OUT = 0xFB,
+ epsmeLVI2_HYSTERESIS_TM_OUT = 0xFC,
+ } ePowerStateMachineEvents;
+
+ PowerStateMachine();
+ virtual ~PowerStateMachine();
+ void onEvent(HANDLE h_app, PowerSessionHandler & oSession, // NOLINT (runtime/references)
+ ePowerStateMachineEvents evt);
+ EFrameworkunifiedStatus initialize(HANDLE h_app, PowerConfigParams & refConfigParms); // NOLINT (runtime/references)
+ PCSTR name();
+
+ private:
+ static Wakeup WakeupState;
+ static WakeupActive WakeupActiveState;
+ static WakeupPending WakeupPendingState;
+ static LowVoltage1 LowVoltage1State;
+ static LowVoltage1Active LowVoltage1ActiveState;
+ static LowVoltage2 LowVoltage2State;
+ static LowVoltage2Active LowVoltage2ActiveState;
+ static Shutdown ShutdownState;
+ static ShutdownActive ShutdownActiveState;
+ static NormalVoltage NormalVoltageState;
+ static SoftwareUpdate SoftwareUpdateState;
+
+ Base_State *m_pCurrentState;
+ Base_State *m_pPreviousState;
+ Base_State *m_pOnHysteresisTimeoutState;
+ PowerStateHysteresis m_oShutdownHysteresis;
+ PowerStateHysteresis m_oLowVoltage1Hysteresis;
+ PowerStateHysteresis m_oLowVoltage2Hysteresis;
+ RequiredModuleList m_lstWakeupModules;
+ RequiredModuleList m_lstShutdownModules;
+ RequiredModuleList m_lstLvi2Modules;
+ HANDLE m_hHysteresisTimer;
+
+ typedef struct _state_info {
+ EPWR_POWER_STATE_TYPE wake;
+ EPWR_VOLTAGE_STATE_TYPE voltage;
+ EPWR_WAKEUP_LEVEL_TYPE level;
+ EPWR_WAKEUP_FACTOR_TYPE factor;
+ EPWR_CRANK_STATE_TYPE crank;
+ } Pwr_StateInfo;
+
+ Pwr_StateInfo m_tStateInfo;
+
+ PowerStateMachine(PowerStateMachine&);
+ PowerStateMachine & operator=(PowerStateMachine &);
+
+ /// Helper methods
+ void NextState(Base_State & refState, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void GotoStateOnHysteresisTimeout(Base_State & refState); // NOLINT (runtime/references)
+ void startHysteresisTimer(PowerStateHysteresis & hys_info); // NOLINT (runtime/references)
+ void reStartHysteresisTimer(PowerStateHysteresis & hys_info); // NOLINT (runtime/references)
+ void stopHysteresisTimer(PowerStateHysteresis & hys_info); // NOLINT (runtime/references)
+ void publishPowerLVIStatus(HANDLE h_app, PCSTR nNotifNm, UI_32 value);
+ void publishPowerLevelType(HANDLE h_app, UI_32 value);
+
+ void OnVoltage(Base_State * pState, HANDLE h_app,
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+};
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_MACHINE_H_
diff --git a/systemservice/power_service/server/src/powerservice_application.cpp b/systemservice/power_service/server/src/powerservice_application.cpp
new file mode 100755
index 0000000..4c44459
--- /dev/null
+++ b/systemservice/power_service/server/src/powerservice_application.cpp
@@ -0,0 +1,236 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file contains the standard set functions called by the NS
+// dispatcher on application initialization, cleanup and wakeup.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <system_service/ss_services.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+#include "ss_power_powerservicelog.h"
+#include "ss_power.h"
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app)
+ * @brief Handles setup for SS_Power subsystem, registers with
+ * NP_Service and indicates that its ready.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ eStatus = Power::GetInstance().Initialize(h_app);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+/**
+ * EFrameworkunifiedStatus PowerserviceOnWakepup(HANDLE h_app)
+ * @brief This is not handled by the Power Subsystem since send out the
+ * notifications that indicated Wakeup.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus PowerserviceOnWakepup(HANDLE h_app) { // LCOV_EXCL_START 200: not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 200: not called by NSFW
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE h_app)
+ * @brief This is not handled by the Power Subsystem since send out the
+ * notifications that indicated Shutdown.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE h_app) { // LCOV_EXCL_START 200: not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 200: not called by NSFW
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE h_app)
+ * @brief This is not handled by the Power Subsystem since send out the
+ * notifications that indicated Emergency Shutdown.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE h_app) { // LCOV_EXCL_START 200: not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 200: not called by NSFW
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app)
+ * @brief SS_Power will exit when this method is invoked,
+ * return value will always be invalid.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app) { // LCOV_EXCL_START 200: not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__,
+ " This method is not valid for %s, returning "
+ "eFrameworkunifiedStatusNotImplemented",
+ SERVICE_POWER);
+ return eFrameworkunifiedStatusNotImplemented;
+}
+// LCOV_EXCL_STOP 200: not called by NSFW
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app)
+ * @brief Used to ask SS_Power to dump its vital information about the subsystem.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app) { // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ Power* l_instance = &Power::GetInstance();
+
+ if (l_instance != NULL) {
+ l_instance->SSPowerDebugDump(h_app);
+
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ return eStatus;
+}
+// LCOV_EXCL_STOP 7: debug code
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app)
+ * @brief Used to .
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app)
+ * @brief Used to .
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app)
+ * @brief Used to .
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app) { // LCOV_EXCL_START 200: not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 200: not called by NSFW
+// EOF
+
diff --git a/systemservice/power_service/server/src/powerservice_main.cpp b/systemservice/power_service/server/src/powerservice_main.cpp
new file mode 100755
index 0000000..0b1ccfe
--- /dev/null
+++ b/systemservice/power_service/server/src/powerservice_main.cpp
@@ -0,0 +1,70 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief Application entry point.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <system_service/ss_services.h>
+#include <system_service/ss_version.h>
+#include <system_service/ss_system_if.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/ns_message_center_if.h>
+
+#include "ss_power_powerservicelog.h"
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+
+/// \brief: Name of the Queue that will be
+/// used to read data from.
+const CHAR AppName[] = SERVICE_POWER;
+
+/// \brief: public structure that is used
+/// for logging by NSLogger.
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+FRAMEWORKUNIFIEDLOGOPTIONS, {
+ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ZONE_TEXT_31 }, FRAMEWORKUNIFIEDLOGZONES };
+
+/**
+ *int main(int argc, char *argv[])
+ * @brief Main function for SS_Power subsystem.
+ *
+ * @param argc number of arguments passed to SS_Power
+ * @param argv array of arguments passed to SS_Power
+ *
+ * @return int status of applications exit.
+ */
+int main(int argc, char *argv[]) {
+ FRAMEWORKUNIFIED_SET_ZONES();
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cbFuncs);
+
+ EFrameworkunifiedStatus eStatus = FrameworkunifiedDispatcherWithArguments(AppName, argc, argv,
+ &cbFuncs);
+ return eStatus;
+}
+
diff --git a/systemservice/power_service/server/src/ss_power.cpp b/systemservice/power_service/server/src/ss_power.cpp
new file mode 100755
index 0000000..26e8881
--- /dev/null
+++ b/systemservice/power_service/server/src/ss_power.cpp
@@ -0,0 +1,1672 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief Handles Power Service Business logic
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "ss_power.h"
+#include <inttypes.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service.h>
+#include <system_service/ss_power_service_notifications_local.h>
+#include <system_service/ss_power_service_local.h>
+#include <native_service/frameworkunified_timer.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <utility>
+#include <string>
+
+#include "ss_power_powerservicelog.h"
+
+using namespace std; // NOLINT (build/namespaces)
+
+static Power g_PowerSubsystem;
+
+/**
+ * @brief
+ *
+ * @param
+ * @param
+ *
+ * @return
+ */
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus PowerCallback(
+ HANDLE h_app) {
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ C * pObj = static_cast<C *>(&g_PowerSubsystem);
+
+ if (pObj) {
+ l_eStatus = (pObj->*M)(h_app);
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// GetInstance
+/// Return global instance of Power object. Power is singleton class
+///
+//////////////////////////////////////////////////////////////////////
+Power & Power::GetInstance() {
+ return g_PowerSubsystem;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Power
+/// Constructor of Power class
+///
+//////////////////////////////////////////////////////////////////////
+Power::Power()
+ : m__CWORD56_RepHist(SS_PWR__CWORD56__REP_HIST_SIZE),
+ m_PubCmdHist(SS_PWR_PUB_CMD_HIST_SIZE),
+ m_ErrHist(SS_PWR_ERR_HIST_SIZE),
+ m_VCmdHist(SS_PWR_V_HIST_SIZE),
+ m_PowerState(SS_PS_READY_TO_WAKEUP),
+ m_VoltageState(epsvsINVALID),
+ m_CrankState(epscsINVALID),
+ m_MaxShutdownTimeout(0) {
+ m_PPStateStrMap[SS_PS_READY_TO_WAKEUP] = "SS_PS_READY_TO_WAKEUP";
+ m_PPStateStrMap[SS_PS_WAKEUP_INITIATED] = "SS_PS_WAKEUP_INITIATED";
+ m_PPStateStrMap[SS_PS_WAKEUP_COMPLETE] = "SS_PS_WAKEUP_COMPLETE";
+ m_PPStateStrMap[SS_PS_POWER_ON_COMPLETE] = "SS_PS_POWER_ON_COMPLETE";
+ m_PPStateStrMap[SS_PS_POWER_OFF_INITIATED] = "SS_PS_POWER_OFF_INITIATED";
+ m_PPStateStrMap[SS_PS_POWER_OFF_COMPLETE] = "SS_PS_POWER_OFF_COMPLETE";
+ m_PPStateStrMap[SS_PS_SHUTDOWN_INITIATED] = "SS_PS_SHUTDOWN_INITIATED";
+ m_PPStateStrMap[SS_PS_SHUTDOWN_COMPLETE] = "SS_PS_SHUTDOWN_COMPLETE";
+ m_PPStateStrMap[SS_PS_STATE_MAX] = "SS_PS_STATE_MAX";
+
+ m__CWORD56_RepIter = m__CWORD56_RepHist.begin();
+ m_PubHistIter = m_PubCmdHist.begin();
+ m_ErrHistIter = m_ErrHist.begin();
+ m_VHistIter = m_VCmdHist.begin();
+ bzero(&m_WakeUpData, sizeof(m_WakeUpData));
+}
+
+///////////////////////////////////////////////////////////////////////
+/// ~Power
+/// Destructor of Power class
+///
+//////////////////////////////////////////////////////////////////////
+Power::~Power() { // LCOV_EXCL_START 14 Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP 14 Resident process, not called by NSFW
+
+///////////////////////////////////////////////////////////////////////
+/// Initialize
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::Initialize(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ BOOL l_SpecifiedCfgLoaded;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ SetPowerServiceState(SS_PS_READY_TO_WAKEUP);
+
+ pthread_mutex_init(&pwr_hist_mutex, NULL);
+
+ /// Open and parse the configuration data for Power
+ const CHAR configFileName[] = "/usr/agl/conf/BS/ss/power_service/rodata/gpf_ss_ps_config.cfg";
+
+ PowerConfiguration config(configFileName);
+ l_SpecifiedCfgLoaded = config.LoadParameters(m_tConfigData);
+ if (FALSE == l_SpecifiedCfgLoaded) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ "Reading configuration from file: %s failed. Using default parameters.",
+ configFileName);
+ config.LoadDefaultParameters(m_tConfigData);
+ }
+
+ config.PrintConfigInfo(m_tConfigData);
+
+ /// init PowerStateMachine
+ m_oStateMachine.initialize(h_app, m_tConfigData);
+
+ // Register all callbacks to dispatcher and notifications
+ l_eStatus = RegisterAllCallbacksAndNofitications(h_app);
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus, "RegisterAllCallbacksAndNofitications()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// RegisterAllCallbacksAndNofitications
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::RegisterAllCallbacksAndNofitications(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(h_app, szNTFY_PowerAvailability))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(
+ "FrameworkunifiedRegisterServiceAvailabilityNotification( "szNTFY_PowerAvailability" )");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_eStatus = FrameworkunifiedPublishServiceAvailability(h_app, FALSE);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedPublishServiceAvailability()");
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ SS_PWR_LOG_HIST("FrameworkunifiedPublishServiceAvailability()", m_PubCmdHist,
+ m_PubHistIter, "", l_eStatus);
+ }
+
+ // Attach Notification callbacks to dispatcher
+ FrameworkunifiedNotificationsList
+ ss_power_notifications[] = {
+ { szNTFY_PowerLVI1, sizeof(PowerSrvLVIStatus), eFrameworkunifiedStateVar}
+ , {szNTFY_PowerLVI2, sizeof(PowerSrvLVIStatus), eFrameworkunifiedStateVar}
+ , {szNTFY_PowerLevel, sizeof(PowerSrvLevelType), eFrameworkunifiedStateVar}
+ , {szNTFY_ShutdownPopup, sizeof(EPWR_SHUTDOWN_POPUP_TYPE), eFrameworkunifiedStateVar}
+ , {szNTFY_PowerPopup, sizeof(EPWR_POWER_POPUP_TYPE), eFrameworkunifiedStateVar}
+ };
+ // Register Notifications
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedNPRegisterNotifications(h_app, ss_power_notifications, _countof(ss_power_notifications)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedNPRegisterNotifications(ss_power_notifications)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ // Subscribe and attach call back for notification
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(h_app, NTFY_SSSystemMgrPowerOnOff, PowerCallback<Power, &Power::OnPowerOnOffNotification>))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSubscribeNotificationWithCallback()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+//*************************
+
+/// < Attach to the following session handles.
+ FrameworkunifiedProtocolCallbackHandler ss_power_session_req_handlers[] = {
+ /// session handles.
+ { PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
+ &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
+ PowerCallback<Power, &Power::OnCloseSession> }, {
+ SS_POWER_STATE_CHANGE_REQ, PowerCallback<Power,
+ &Power::OnSetPowerState> }, { SS_POWER_POWER_REQUEST_MSG,
+ PowerCallback<Power, &Power::OnPowerRequestMsg> }, {
+ SS_POWER_COMM_WAKEUP,
+ PowerCallback<Power, &Power::OnSetCommWakeUp> }, {
+ SS_POWER_SHUTDOWN_REQ,
+ PowerCallback<Power, &Power::OnSetCommSleep> }, {
+ SS_POWER_SHUTDOWN_REQUEST_MSG, PowerCallback<Power,
+ &Power::OnShutdownRequestMsg> }
+
+ /// Wake-up / Shutdown Protocol commands for System Manager.
+ , { SS_SM_WAKEUP_MODULES_CMPL_RSPN, PowerCallback<Power,
+ &Power::OnWakeUpComplete> }, { SS_SM_SHUTDOWN_MODULES_CMPL_RSPN,
+ PowerCallback<Power, &Power::OnShutdownComplete> }
+ //
+ , { SS_POWER_PRINT_CONNECTIONS, PowerCallback<Power,
+ &Power::OnPrintConnections> }, { SS_POWER_PRINT_STACK,
+ PowerCallback<Power, &Power::OnPrintStack> }
+ /// Set Voltage & Crank states from shadow?
+ , { SS_POWER_VOLTAGE_STATE, PowerCallback<Power,
+ &Power::OnSetVoltageState> }, { SS_POWER_CRANK_STATE,
+ PowerCallback<Power, &Power::OnSetCrankState> }
+ /// Current Power Service State inquiry from Test Client
+ , { SS_POWER_CRNT_STATE_QUERY, PowerCallback<Power,
+ &Power::OnCurrentPowerStateQuery> }, {
+ SS_POWER_SYSTEM_MODE_INFO_REQ, PowerCallback<Power,
+ &Power::OnSystemModeInfoRequest> }, {
+ SS_SM_SYSTEM_MODE_INFO_RSPN, PowerCallback<Power,
+ &Power::OnSystemModeInfoResponse> }
+ /// InitComp report to SystemManager
+ , { SS_POWER_INITCOMP_REP, PowerCallback<Power,
+ &Power::OnInitCompReport> }
+ //
+ // Startup Confirmation Request ( from Power Shadow ) and
+ // Startup Confirmation Response ( from System Manager )
+ , { SS_POWER_FWD_START_CONFIRMATION_MSG_REQ, PowerCallback<Power,
+ &Power::OnSendStartupConfirmationRequest> }, {
+ SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, PowerCallback<Power,
+ &Power::OnSendStartupConfirmationResponse> }
+ //
+ // User Mode Request ( from Power Shadow ) and
+ // User Mode Response ( from System Manager )
+ , { SS_SM_USER_MODE_SET_RESP, PowerCallback<Power,
+ &Power::OnUserModeResponse> }
+
+ //
+ // Heartbeat Request ( from Power Shadow )
+ , { SS_POWER_HEARTBEAT_REQ, PowerCallback<Power,
+ &Power::On_CWORD56_HeartBeatRequest> }, { SS_SM__CWORD56__HEARTBEAT_RSPN,
+ PowerCallback<Power, &Power::OnSM_CWORD56_HeartBeatResponse> }
+
+ // System Manager to Power Services
+ , { SS_SM_CPU_RESET_REQ, PowerCallback<Power,
+ &Power::OnCpuResetRequest> }, { SS_SM_REMOTE_DATA_RESET_REQ,
+ PowerCallback<Power, &Power::OnRemoteDataResetRequest> } };
+
+ // Attach callback
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, ss_power_session_req_handlers, _countof(ss_power_session_req_handlers)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher( ss_power_session_req_handlers )");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ //*************************
+
+ // Publish szNTFY_PowerAvailable so that other services can start connecting via sessions.
+
+ l_eStatus = RegisterSMSessionAckCallback(
+ PowerCallback<Power, &Power::OnSystemMgrConnectionEstablished>);
+ LOG_STATUS(l_eStatus, "RegisterSMSessionAckCallback()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnSetCommWakeUp
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSetCommWakeUp(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ Pwr_ServiceSetInterface l_CanStatesData;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_CanStatesData))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else if (l_CanStatesData.data.commwake.state == epscnCANWAKEUP) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Received WakeUp from %s, Processing Ignored !!",
+ FrameworkunifiedGetMsgSrc(h_app));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnSetCommSleep
+///
+///
+//////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 200: can not be called from power class
+EFrameworkunifiedStatus Power::OnSetCommSleep(HANDLE h_app) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ Pwr_ServiceSetInterface l_CanStatesData;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_CanStatesData))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else if (l_CanStatesData.data.commwake.state != epscnCANSLEEP) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: %s: l_CanStatesData.data.commwake.state != epscnCANSLEEP",
+ FrameworkunifiedGetMsgSrc(h_app));
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Received Sleep from %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+
+ // Send to System Manager to WakeUp Modules
+ l_eStatus = SendShutdownToSystemManager(&l_CanStatesData);
+ if (l_eStatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("SendShutdownToSystemManager()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ SetPowerServiceState(SS_PS_SHUTDOWN_INITIATED);
+ LOG_SUCCESS("SendShutdownToSystemManager()");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP 200: can not be called from power class
+
+///////////////////////////////////////////////////////////////////////
+/// SetPowerServiceState
+///
+///
+//////////////////////////////////////////////////////////////////////
+VOID Power::SetPowerServiceState(SS_PSState f_NewState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Changing State from '%s' to '%s'",
+ m_PPStateStrMap[m_PowerState].c_str(),
+ m_PPStateStrMap[f_NewState].c_str());
+
+ m_PowerState = f_NewState;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnPowerOnOffNotification
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnPowerOnOffNotification(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ T_SS_SM_UserModeOnOffNotification_StructType l_userModeOnOffStruct;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<T_SS_SM_UserModeOnOffNotification_StructType>(h_app, l_userModeOnOffStruct))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " User Mode is '%s', User Mode Change Reason is '%s'",
+ GetStr(l_userModeOnOffStruct.isUserModeOn).c_str(),
+ GetStr(l_userModeOnOffStruct.userModeChangeReason).c_str());
+ SetPowerServiceState(
+ l_userModeOnOffStruct.isUserModeOn ?
+ SS_PS_POWER_ON_COMPLETE : SS_PS_POWER_OFF_COMPLETE);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// ProcessSystemWakeUp
+/// On receipt of this notification send wake up notification to
+/// System Manager to wake up (START) all modules
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSetPowerState(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ Pwr_ServiceSetInterface l_serviceSetIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_serviceSetIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ switch (l_serviceSetIf.data.wake.powerupType) {
+ case epswsPWRON:
+ case epswsPWROFF:
+ m_WakeUpData = l_serviceSetIf.data.wake;
+
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO, __FUNCTION__, " Received Power %s from %s, level 0x%X",
+ l_serviceSetIf.data.wake.powerupType == epswsPWRON ? "On" : "Off",
+ FrameworkunifiedGetMsgSrc(h_app), m_WakeUpData.up.level);
+ // Send to System Manager to WakeUp Modules
+ l_eStatus = SendWakeUpToSystemManager(&m_WakeUpData);
+ if (l_eStatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ SetPowerServiceState(SS_PS_WAKEUP_INITIATED);
+ LOG_SUCCESS("SendWakeUpToSystemManager()");
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("SendWakeUpToSystemManager()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ break;
+ default:
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Invalid PowerOnOff State received: 0x%X",
+ l_serviceSetIf.data.wake.powerupType);
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+/// Session Request Handlers
+///
+//////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus Power::OnOpenSession(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
+ l_eStatus = m_oSessionHandler.OpenSesion(h_app);
+
+ /// < Test Code TODO: Remove ME!!!
+ // m_oSessionHandler.Print();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnCloseSession(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
+ l_eStatus = m_oSessionHandler.CloseSession(h_app);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnWakeUpComplete(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ wakeInfo l_Wake;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<wakeInfo>(h_app, l_Wake))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else if (l_Wake.up.level == m_WakeUpData.up.level) {
+ SetPowerServiceState(SS_PS_WAKEUP_COMPLETE);
+
+ /// < send the state machine a wakeup event.
+ m_oStateMachine.onEvent(h_app, m_oSessionHandler,
+ PowerStateMachine::epsmeWAKEUP);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Sending SS_POWER_STATE_CHANGE_RESP(%s) to PSM",
+ l_Wake.powerupType == epswsPWRON ? "User_On" : "User_Off");
+
+ // send Wake-up complete response to Supervisor
+ m_oSessionHandler.SendToSupervisor(SS_POWER_STATE_CHANGE_RESP,
+ sizeof(l_Wake), (PVOID) &l_Wake);
+ SS_PWR_LOG_HIST("SS_POWER_STATE_CHANGE_RESP", m__CWORD56_RepHist, m__CWORD56_RepIter,
+ "SS_PS_WAKEUP_COMPLETE", l_eStatus);
+
+ /// < Test Code TODO: Remove ME!!!
+ // m_oSessionHandler.Print();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error: Power WakeUp Threshold (%d) and SM WakeUp Threshold (%d) Mismatch",
+ m_WakeUpData.up.level, l_Wake.up.level);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnShutdownComplete(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ SetPowerServiceState(SS_PS_SHUTDOWN_COMPLETE);
+
+ m_oStateMachine.onEvent(h_app, m_oSessionHandler,
+ PowerStateMachine::epsmeSHUTDOWN);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending SS_POWER_SHUTDOWN_RESP to PSM");
+ // send Shutdown complete response to Power Shadow / Supervisor
+ m_oSessionHandler.SendToSupervisor(SS_POWER_SHUTDOWN_RESP, 0, (PVOID) NULL);
+
+ SS_PWR_LOG_HIST("SS_POWER_SHUTDOWN_RESP", m__CWORD56_RepHist, m__CWORD56_RepIter,
+ "SS_PS_SHUTDOWN_COMPLETE", l_eStatus);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnShutdownComplete(HANDLE h_app)
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnPrintConnections(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_oSessionHandler.Print();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnPrintStack(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_oSessionHandler.Print();
+ // m_oStateMachine.Print();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnHysteresisTimeout(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_oStateMachine.onEvent(h_app, m_oSessionHandler,
+ PowerStateMachine::epsmeLVI1_HYSTERESIS_TM_OUT);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus PowerStateMachine::initialize(HANDLE h_app,
+ PowerConfigParams & refConfigParms) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ /// Set all hysteresis objects with the configuration data obtained from PowerService.xml
+ m_oShutdownHysteresis.set(refConfigParms.shutdown);
+ m_oLowVoltage1Hysteresis.set(refConfigParms.lvi1);
+ m_oLowVoltage2Hysteresis.set(refConfigParms.lvi2);
+
+ /// Copy the list of required modules.
+ m_lstWakeupModules = refConfigParms.wakeup_modules;
+ m_lstShutdownModules = refConfigParms.shutdown_modules;
+ m_lstLvi2Modules = refConfigParms.lvi2_modules;
+
+ m_hHysteresisTimer = FrameworkunifiedAttachTimerCallback(
+ h_app, 0, 0, PowerCallback<Power, &Power::OnHysteresisTimeout>);
+ if (NULL == m_hHysteresisTimer) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedAttachTimerCallback() returned NULL");
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PowerSessionHandler::OpenSesion(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // check if the subscriber is already in map
+ PwSessionIter iter = m_mapSessions.find(FrameworkunifiedGetMsgSrc(h_app));
+
+ // the iter is set to the end then the subscriber is not in the map
+ if (m_mapSessions.end() == iter) {
+ string subscriber(FrameworkunifiedGetMsgSrc(h_app));
+ PwSessionInfo newEntry;
+ newEntry.frunning = FALSE;
+ newEntry.hsession = FrameworkunifiedMcOpenSender(h_app, subscriber.c_str());
+ newEntry.sz_name = subscriber;
+ newEntry.sz_servicename = ""; // we will get this on the start complete.
+ newEntry.esessiontype = epsstBASIC;
+ newEntry.ui_groupid = 0;
+
+ if (NULL != newEntry.hsession) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ //
+ // Set the Session Handle for Framework so FrameworkunifiedSendResponse won't error due to a null
+ // session handle.
+ //
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK
+ // [in] PCSTR - Name of the associated service name
+ // [in] HANDLE - Session handle
+ != (l_eStatus = FrameworkunifiedSetSessionHandle(h_app, subscriber.c_str(), newEntry.hsession))) { // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error case.
+ LOG_ERROR("FrameworkunifiedSetSessionHandle()");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ OpenSessionAck openSessionAck;
+ memset(&openSessionAck, 0, sizeof(openSessionAck));
+ strcpy(openSessionAck.cSessionName, SERVICE_POWER); // NOLINT (runtime/printf)
+ openSessionAck.eStatus = eFrameworkunifiedStatusOK;
+ openSessionAck.sessionId = 0; /// Only one session handles all the heartbeat clients
+
+ // Send Ack to subscriber
+ l_eStatus = FrameworkunifiedSendMsg(newEntry.hsession, PROTOCOL_OPEN_SESSION_ACK,
+ sizeof(OpenSessionAck), (PVOID) &openSessionAck);
+ char l_cBuf[100];
+ snprintf(l_cBuf, sizeof(l_cBuf),
+ "FrameworkunifiedSendMsg(%s, PROTOCOL_OPEN_SESSION_ACK)", subscriber.c_str());
+ LOG_STATUS(l_eStatus, l_cBuf);
+ }
+
+ // If this is not a basic module then we will need to register some other protocols
+ if (0 != FrameworkunifiedGetMsgLength(h_app)) {
+ EPWR_SESSION_TYPE tOpenSessionReq;
+ if (sizeof(EPWR_SESSION_TYPE) == FrameworkunifiedGetMsgLength(h_app)) {
+ if (eFrameworkunifiedStatusOK
+ == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tOpenSessionReq,
+ sizeof(EPWR_SESSION_TYPE)))) {
+ switch (tOpenSessionReq) {
+ case epsstBASIC: {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Subscriber : %s , open a session using type: BASIC",
+ subscriber.c_str());
+ FrameworkunifiedProtocolCallbackHandler ss_power_session_basic_handlers[] = { {
+ PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
+ &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
+ PowerCallback<Power, &Power::OnCloseSession> } };
+
+ // Attach callback : Power Session Requests
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, subscriber.c_str(), ss_power_session_basic_handlers, _countof(ss_power_session_basic_handlers)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(
+ "FrameworkunifiedAttachCallbacksToDispatcher(ss_power_session_basic_handlers)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Subscriber '%s' opened a type 'BASIC' session",
+ subscriber.c_str());
+ }
+ break;
+ case epsstSUPERVISOR: {
+ FrameworkunifiedProtocolCallbackHandler ss_power_sprv_session_handlers[] = { {
+ PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
+ &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
+ PowerCallback<Power, &Power::OnCloseSession> }, {
+ SS_POWER_FWD_START_CONFIRMATION_MSG_REQ, PowerCallback<Power,
+ &Power::OnSendStartupConfirmationRequest> }, {
+ SS_POWER_STATE_CHANGE_REQ, PowerCallback<Power,
+ &Power::OnSetPowerState> }, { SS_POWER_SHUTDOWN_REQ,
+ PowerCallback<Power, &Power::OnShutdownRequestMsg> }
+ , { SS_POWER_SYSTEM_MODE_INFO_REQ, PowerCallback<Power,
+ &Power::OnSystemModeInfoRequest> }, {
+ SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ, PowerCallback<
+ Power, &Power::OnPublishShutdownPopupRequest> }, {
+ SS_POWER_PUBLISH_POWER_POPUP_REQ, PowerCallback<Power,
+ &Power::OnPublishPowerPopupRequest> }, {
+ SS_POWER_POWER_REQUEST_MSG, PowerCallback<Power,
+ &Power::OnPowerRequestMsg> } };
+
+ // Attach callback : Power Supervisor Session Requests
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, subscriber.c_str(), ss_power_sprv_session_handlers, _countof(ss_power_sprv_session_handlers)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(
+ "FrameworkunifiedAttachCallbacksToDispatcher(ss_power_sprv_session_handlers)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Subscriber '%s' opened a 'SUPERVISOR' session",
+ subscriber.c_str());
+ newEntry.esessiontype = tOpenSessionReq;
+
+ static BOOL first_supervisor = TRUE;
+ if (first_supervisor) {
+ AttachCallbackToSystemManager( // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ h_app, SS_SM_SYSTEM_MODE_INFO_RSPN,
+ PowerCallback<Power, &Power::OnSystemModeInfoResponse>);
+ first_supervisor = FALSE;
+ }
+ }
+ break;
+ case epsstSYSTEM: {
+ FrameworkunifiedProtocolCallbackHandler ss_power_system_session_handlers[] = {
+ { PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
+ &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
+ PowerCallback<Power, &Power::OnCloseSession> }, {
+ SS_POWER_SYSTEM_LAUNCH_COMPLETE, PowerCallback<Power,
+ &Power::OnSystemLaunchComplete> }, {
+ SS_POWER_SHUTDOWN_RESP, PowerCallback<Power,
+ &Power::OnSystemShutdownComplete> } };
+
+ // Attach callback : Power System Session Requests
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, subscriber.c_str(), ss_power_system_session_handlers, _countof(ss_power_system_session_handlers)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(
+ "FrameworkunifiedAttachCallbacksToDispatcher(ss_power_session_handlers)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Subscriber '%s' opened a 'SYSTEM' session",
+ subscriber.c_str());
+ newEntry.esessiontype = tOpenSessionReq;
+ }
+ break;
+ case epsstUNKNOWN: {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Subscriber '%s' tried to open a type 'UNKNOWN' session",
+ subscriber.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ // insert this newEntry into the map
+ m_mapSessions.insert(make_pair(subscriber, newEntry));
+ } else {
+ // This Subscriber is already in our map, just send and ack to keep them quote.
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO, __FUNCTION__,
+ "Subscriber : %s , is already in the map, will Just send back an ACK",
+ iter->second.sz_name.c_str());
+ if (NULL != iter->second.hsession) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ OpenSessionAck openSessionAck;
+ memset(&openSessionAck, 0, sizeof(openSessionAck));
+ strcpy(openSessionAck.cSessionName, SERVICE_POWER); // NOLINT (runtime/printf)
+ openSessionAck.eStatus = eFrameworkunifiedStatusOK;
+ // I can't think of a reason why we would need more that one session per subscriber.
+ openSessionAck.sessionId = 0;
+
+ // Send Ack to subscriber
+ l_eStatus = FrameworkunifiedSendMsg(iter->second.hsession, PROTOCOL_OPEN_SESSION_ACK,
+ sizeof(OpenSessionAck), (PVOID) &openSessionAck);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "FrameworkunifiedSendMsg Success to : %s , status: 0x%x",
+ iter->second.sz_name.c_str(), l_eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "What! NULL == iter->second.hsession TODO: Need to handle this!");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PowerSessionHandler::StopComplete(HANDLE h_app) { // LCOV_EXCL_START 8: can not be called
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // ToDo Jay 2012 November 02 Can this be deleted ?
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " No-op function - It's here, but it doesn't do anything");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP 8: can not be called
+
+///////////////////////////////////////////////////////////////////////
+/// ProcessVoltageNotifyRequest
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::PublishVoltageStateChange(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ PowerSrvLVIStatus l_LVIStatus;
+ PowerSrvLevelType l_PowerLevel;
+
+ switch (m_VoltageState) { // LCOV_EXCL_BR_LINE 6: double check
+ case epsvsNORMAL:
+ l_PowerLevel = epspltNORMAL;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLevel, &l_PowerLevel, sizeof(PowerSrvLevelType));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLevel ", epspltNORMAL)");
+
+ l_LVIStatus = ePwSrvLVI_Status_InActive;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI1, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI1 ", ePwSrvLVI_Status_InActive)");
+
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI2, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI2 ", ePwSrvLVI_Status_InActive)");
+ break;
+
+ case epsvsLVI1:
+ l_PowerLevel = epspltEMERGENCY;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLevel, &l_PowerLevel, sizeof(PowerSrvLevelType));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLevel ", epspltEMERGENCY)");
+
+ l_LVIStatus = ePwSrvLVI_Status_Active;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI1, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI1 ", ePwSrvLVI_Status_Active)");
+
+ l_LVIStatus = ePwSrvLVI_Status_InActive;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI2, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI2 ", ePwSrvLVI_Status_InActive)");
+ break;
+
+ case epsvsLVI2:
+ l_PowerLevel = epspltEMERGENCY;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLevel, &l_PowerLevel, sizeof(PowerSrvLevelType));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLevel ", epspltEMERGENCY)");
+
+ l_LVIStatus = ePwSrvLVI_Status_InActive;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI1, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI1 ", ePwSrvLVI_Status_InActive)");
+
+ l_LVIStatus = ePwSrvLVI_Status_Active;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI2, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI2 ", ePwSrvLVI_Status_Active)");
+ break;
+
+ case epsvsINVALID:
+ // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR(" epsvsINVALID == m_VoltageState");
+ break;
+ // LCOV_EXCL_STOP 6: double check
+
+ default:
+ // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Invalid 'm_VoltageState' value detected: 0x%X/%d",
+ m_VoltageState, m_VoltageState);
+ break;
+ // LCOV_EXCL_STOP 6: double check
+ }
+
+ SS_PWR_LOG_HIST("PublishVoltageStateChange()", m_PubCmdHist, m_PubHistIter,
+ "", l_eStatus);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////
+/// OnSystemModeInfoResponse
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSystemModeInfoResponse(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SystemModeInfo l_SystemModeInfo;
+
+ std::memset(&l_SystemModeInfo, 0, sizeof(SystemModeInfo));
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<SystemModeInfo>(h_app, l_SystemModeInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Sending SS_POWER_SYSTEM_MODE_INFO_RESP to PSM");
+ // send Wake-up complete response to System Power Manager
+ l_eStatus = m_oSessionHandler.SendToSupervisor(
+ SS_POWER_SYSTEM_MODE_INFO_RESP, sizeof(SystemModeInfo),
+ (PVOID) &l_SystemModeInfo);
+
+ SS_PWR_LOG_HIST("SS_POWER_SYSTEM_MODE_INFO_RESP", m__CWORD56_RepHist,
+ m__CWORD56_RepIter, "", l_eStatus);
+
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus, "m_oSessionHandler.SendToSupervisor( "
+ "SS_POWER_SYSTEM_MODE_INFO_RESP)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnSystemModeInfoRequest
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSystemModeInfoRequest(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = SendSystemModeRequestToSystemManager())) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("SendSystemModeRequestToSystemManager()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnInitCompReport
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnInitCompReport(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = SendInitCompReportToSystemManager())) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("SendInitCompReportToSystemManager()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnCurrentPowerStateQuery
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnCurrentPowerStateQuery(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SS_PSCurrentState l_CurrentState;
+ std::memset(&l_CurrentState, 0, sizeof(SS_PSCurrentState));
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<SS_PSCurrentState>(h_app, l_CurrentState))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = ConstructPwrStateResponse(l_CurrentState.printRespmsg))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ConstructPwrStateResponse(l_CurrentState.printRespmsg)");
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Response is %s",
+ l_CurrentState.printRespmsg);
+ // Send Power State to client
+
+ HANDLE l_handle = FrameworkunifiedOpenService(h_app, FrameworkunifiedGetMsgSrc(h_app));
+ if (NULL != l_handle) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ l_eStatus = FrameworkunifiedSendMsg(l_handle, SS_POWER_CRNT_STATE_QUERY_RSPN,
+ sizeof(SS_PSCurrentState),
+ (PVOID) &l_CurrentState);
+
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_CRNT_STATE_QUERY_RSPN)");
+
+ l_eStatus = FrameworkunifiedCloseService(h_app, l_handle);
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(l_eStatus,
+ "FrameworkunifiedCloseService()");
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error. FrameworkunifiedOpenService(%s) returned NULL",
+ FrameworkunifiedGetMsgSrc(h_app));
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnSetVoltageState
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSetVoltageState(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string stLvl = "INVALID";
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ Pwr_ServiceSetInterface l_VoltageState;
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_VoltageState))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ m_VoltageState = static_cast<ePowerSrvVoltageStates>(l_VoltageState.data
+ .voltage.state);
+ if (eFrameworkunifiedStatusOK != (l_eStatus = PublishVoltageStateChange(h_app))) { // LCOV_EXCL_BR_LINE 4:NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("PublishVoltageStateChange()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ SS_PWR_LOG_HIST("OnSetVoltageState", m_PubCmdHist, m_PubHistIter,
+ "PublishVoltageStateChange()", l_eStatus);
+
+ switch (l_VoltageState.data.voltage.state) {
+ case epsvsINVALID: {
+ stLvl = "INVALID";
+ }
+ break;
+
+ case epsvsNORMAL: {
+ stLvl = "NORMAL";
+ }
+ break;
+
+ case epsvsLVI1: {
+ stLvl = "LVI1";
+ }
+ break;
+
+ case epsvsLVI2: {
+ stLvl = "LVI2";
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ SS_PWR_LOG_HIST("OnSetVoltageState()", m_VCmdHist, m_VHistIter, stLvl,
+ l_eStatus);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnSetCrankState
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSetCrankState(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ Pwr_ServiceSetInterface l_CrankState;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_CrankState))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ m_CrankState = static_cast<ePowerSrvCrankStates>(l_CrankState.data.crank
+ .state);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus Power::OnSystemMgrConnectionEstablished(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedPublishServiceAvailability(h_app, TRUE);
+
+ SS_PWR_LOG_HIST("FrameworkunifiedPublishServiceAvailability()", m_PubCmdHist,
+ m_PubHistIter, "", l_eStatus);
+
+ LOG_STATUS(l_eStatus,
+ "FrameworkunifiedPublishServiceAvailability(" szNTFY_PowerAvailability ",TRUE)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus Power::OnUserModeResponse(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ EPWR_USER_MODE_TYPE l_eUserModeState = epsumINVALID;
+ Pwr_ServiceSetInterface tServiceSetIf;
+
+ l_eStatus = ValidateUserModeMessage(h_app, l_eUserModeState);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("ValidateUserModeMessage(&l_eUserModeState)");
+ } else {
+ PCSTR p_sStateName = l_eUserModeState == epsumON ? "epsumON" : "epsumOFF";
+ tServiceSetIf.data.user_mode.mode = l_eUserModeState;
+
+ l_eStatus = m_oSessionHandler.SendToSupervisor(
+ SS_POWER_USER_MODE_SET_RESP, sizeof(Pwr_ServiceSetInterface),
+ (PVOID) &tServiceSetIf);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error: m_oSessionHandler.SendToSupervisor(" " SS_POWER_USER_MODE_SET_RESP, %s) errored: %d/'%s'",
+ p_sStateName, l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ SS_PWR_LOG_HIST("SS_POWER_USER_MODE_SET_RESP", m__CWORD56_RepHist,
+ m__CWORD56_RepIter, p_sStateName, l_eStatus);
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ " m_oSessionHandler.SendToSupervisor(" " SS_POWER_USER_MODE_SET_RESP, %s) successful ",
+ p_sStateName);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnUserModeResponse( HANDLE h_app )
+
+EFrameworkunifiedStatus Power::ValidateUserModeMessage(
+ HANDLE h_app, EPWR_USER_MODE_TYPE &l_eUserModeState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ Pwr_ServiceSetInterface tServiceSetIf;
+ EPWR_USER_MODE_TYPE l_my_eUserModeState;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceSetIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_my_eUserModeState = tServiceSetIf.data.user_mode.mode;
+ switch (l_my_eUserModeState) {
+ case epsumINVALID:
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("l_eUserModeState == epsumINVALID");
+ break;
+
+ case epsumOFF:
+ case epsumON:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Validated '%s'",
+ l_my_eUserModeState == epsumON ? "epsumON" : "epsumOFF");
+ l_eUserModeState = l_my_eUserModeState;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Unknown 'l_my_eUserModeState' value: 0x%x",
+ l_my_eUserModeState);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ } // End switch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::ValidateUserModeMessage( HANDLE h_app, EPWR_USER_MODE_TYPE &l_eUserModeState )
+
+//*****************************************************************************
+// Start Confirmation Protocol callback functions
+//
+EFrameworkunifiedStatus Power::OnSendStartupConfirmationRequest(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ EFrameworkunifiedStatus l_responseStatus = eFrameworkunifiedStatusOK;
+ Pwr_ServiceSetInterface tServiceSetIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceSetIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ StartupConfirmationMsgStrut l_startupConfirmationMsg = tServiceSetIf.data
+ .startupConfirmationMsg;
+ l_eStatus = SendStartupConfirmationToSystemManager(
+ l_startupConfirmationMsg);
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus, "SendStartupConfirmationToSystemManager()");
+ }
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:interface_unified if can not be error.
+ // LCOV_EXCL_START 200:interface_unified if can not be error.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_responseStatus = l_eStatus; // Save the current status as-is to
+ // send in the message response to the
+ // requester.
+ l_eStatus = m_oSessionHandler.SendToSupervisor(
+ SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, sizeof(EFrameworkunifiedStatus),
+ (PVOID) &l_responseStatus);
+
+ SS_PWR_LOG_HIST("SS_POWER_FWD_START_CONFIRMATION_MSG_RESP", m__CWORD56_RepHist,
+ m__CWORD56_RepIter, "", l_eStatus);
+
+ LOG_STATUS(
+ l_eStatus,
+ "m_oSessionHandler.SendToSupervisor( " "SS_POWER_FWD_START_CONFIRMATION_MSG_RESP)");
+ // LCOV_EXCL_STOP 200:interface_unified if can not be error.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " SendStartupConfirmationToSystemManager() successful");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnSendStartupConfirmationRequest( HANDLE h_app )
+
+EFrameworkunifiedStatus Power::OnSendStartupConfirmationResponse(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ EFrameworkunifiedStatus l_responseStatus;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<EFrameworkunifiedStatus>(h_app, l_responseStatus))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_eStatus = m_oSessionHandler.SendToSupervisor(
+ SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, sizeof(EFrameworkunifiedStatus),
+ (PVOID) &l_responseStatus);
+
+ SS_PWR_LOG_HIST("SS_POWER_FWD_START_CONFIRMATION_MSG_RESP", m__CWORD56_RepHist,
+ m__CWORD56_RepIter, "", l_eStatus);
+
+ LOG_STATUS(
+ l_eStatus,
+ "m_oSessionHandler.SendToSupervisor(" " SS_POWER_FWD_START_CONFIRMATION_MSG_RESP)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnSendStartupConfirmationResponse( HANDLE h_app )
+//
+// End of Start Confirmation Protocol callback functions
+//*****************************************************************************
+
+//*****************************************************************************
+// Start HeartBeat Protocol callback functions
+// Theory of operation: Forward HB request to SM. If SM crashes, then the HB
+// will cease between SM and the _CWORD56_. Consequently, the _CWORD56_ will reset the
+// system.
+EFrameworkunifiedStatus Power::On_CWORD56_HeartBeatRequest(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EPWR_HB_REQ_MSG_STRUCT l_HbReq;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_CWORD56_ HeartBeat Request received.");
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<EPWR_HB_REQ_MSG_STRUCT>(h_app, l_HbReq))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = Send_CWORD56_HeartBeatRequestToSystemManager(l_HbReq))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("Send_CWORD56_HeartBeatRequestToSystemManager()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus Power::OnSM_CWORD56_HeartBeatResponse(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from SM.");
+
+ l_eStatus = m_oSessionHandler.SendToSupervisor(SS_POWER_HEARTBEAT_RESP, 0,
+ NULL);
+
+ SS_PWR_LOG_HIST("SS_POWER_HEARTBEAT_RESP", m__CWORD56_RepHist, m__CWORD56_RepIter, "",
+ l_eStatus);
+
+ LOG_STATUS(l_eStatus,
+ "m_oSessionHandler.SendToSupervisor( SS_POWER_HEARTBEAT_RESP)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+//
+// End of Heartbeat Protocol callback functions
+//*****************************************************************************
+
+//*****************************************************************************
+// Start CPU Reset Request Protocol callback functions
+//
+EFrameworkunifiedStatus Power::OnCpuResetRequest(HANDLE h_app) { // SS_SM_CPU_RESET_REQ
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSystemManagerCpuResetInfo l_SmCpuResetInfo; // SS Type
+ SS_Pwr_CpuResetMsgStruct l_PsCpuResetInfo; // SS Type translated to PSM type.
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<TSystemManagerCpuResetInfo>(h_app, l_SmCpuResetInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CPU Reset Type: %d",
+ l_SmCpuResetInfo.resetReason);
+
+ switch (l_SmCpuResetInfo.resetReason) {
+ case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR:
+ case e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR:
+ l_PsCpuResetInfo.resetReason = epsCpuResetReasonGeneric;
+ break;
+
+ case e_SS_SM_CPU_RESET_REASON_DSP_ERR:
+ l_PsCpuResetInfo.resetReason = epsCpuResetReasonFatalError;
+ break;
+
+ case e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET:
+ l_PsCpuResetInfo.resetReason = epsCpuResetReasonUserForceReset;
+ break;
+
+ case e_SS_SM_CPU_RESET_REASON_NORMAL:
+ l_PsCpuResetInfo.resetReason = epsCpuResetReasonNormalReset;
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Reset reason '%d' not defined",
+ l_SmCpuResetInfo.resetReason);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (eFrameworkunifiedStatusInvldParam);
+ }
+
+ snprintf(l_PsCpuResetInfo.messageStr, PWR_RESET_MSG_STR_SIZE, "%s",
+ l_SmCpuResetInfo.messageStr);
+
+ l_eStatus = m_oSessionHandler.SendToSupervisor(SS_POWER_HARD_RESET_REQ,
+ sizeof(l_PsCpuResetInfo),
+ (PVOID) &l_PsCpuResetInfo);
+
+ SS_PWR_LOG_HIST("SS_POWER_HARD_RESET_REQ", m__CWORD56_RepHist, m__CWORD56_RepIter, "",
+ l_eStatus);
+
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus, "m_oSessionHandler.SendToSupervisor( "
+ "SS_POWER_HARD_RESET_REQ)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//
+// End of CPU Reset Request Protocol callback functions
+//*****************************************************************************
+
+///////////////////////////////////////////////////////////////////////
+/// SetCmdHist
+///
+///
+//////////////////////////////////////////////////////////////////////
+void Power::SetCmdHist(std::string cmd, cmdHist &hist, cmdHistIter &it,
+ std::string sender) {
+ pthread_mutex_lock(&pwr_hist_mutex);
+
+ UI_64 l_clkcycles = ClockCycle();
+ /* find out how many cycles per millisecond */
+ UI_64 l_totalmsec = l_clkcycles / 1000;
+
+ it->m_time = l_totalmsec;
+ it->m_cmd = cmd;
+ it->m_sender = sender;
+ it++;
+
+ if (it == hist.end()) {
+ it = hist.begin();
+ }
+
+ pthread_mutex_unlock(&pwr_hist_mutex);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SSPowerDebugDump
+/// implement post mortem function
+///
+/// \param
+///
+/// \return void
+///////////////////////////////////////////////////////////////////////////////
+VOID Power::SSPowerDebugDump(HANDLE h_app) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ char l_debugDumpData[SS_PWR_DEBUG_DUMP_MAX_SIZE];
+ UI_16 l_byteCount = 0;
+ cmdHistIter i;
+ memset((void*) l_debugDumpData, 0x00, sizeof(l_debugDumpData)); // NOLINT (readability/casting)
+
+ l_byteCount = snprintf(l_debugDumpData, SS_PWR_DEBUG_DUMP_MAX_SIZE,
+ ("\n <SS POWER DUMP DATA> \n"));
+
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n ***Error history***\n");
+
+ for (i = m_ErrHist.begin(); i != m_ErrHist.end(); ++i) {
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n %s @ %llums EC:%s \n", i->m_cmd.c_str(),
+ i->m_time, i->m_sender.c_str());
+ }
+
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n ***_CWORD56_ Reply history***\n");
+
+ for (i = m__CWORD56_RepHist.begin(); i != m__CWORD56_RepHist.end(); ++i) {
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n %s @ %llums\n", i->m_cmd.c_str(), i->m_time);
+ }
+
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n ***Voltage history***\n");
+
+ for (i = m_VCmdHist.begin(); i != m_VCmdHist.end(); ++i) {
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n %s @ %llums %s \n", i->m_cmd.c_str(), i->m_time,
+ i->m_sender.c_str());
+ }
+
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n ***Publishshing history***\n");
+
+ for (i = m_PubCmdHist.begin(); i != m_PubCmdHist.end(); ++i) {
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n %s @ %llums \n", i->m_cmd.c_str(), i->m_time);
+ }
+
+ SSDEBUGDUMP("%s", (const char *) &l_debugDumpData);
+}
+// LCOV_EXCL_STOP 7:debug code
+
+//*****************************************************************************
+// Start Remote Data Reset Protocol callback functions
+// From SM to PS
+EFrameworkunifiedStatus Power::OnRemoteDataResetRequest(HANDLE h_app) { // SS_SM_REMOTE_DATA_RESET_REQ
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ESMDataResetType l_eSmDataResetType; // SS Type
+ epsCpuResetReason l_ePsCpuResetReason; // SS Type translated to PSM CPU reset reason.
+ BOOL l_bResetRequired;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<ESMDataResetType>(h_app, l_eSmDataResetType))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Remote Data Reset Type: %d",
+ l_eSmDataResetType);
+ l_bResetRequired = FALSE;
+ switch (l_eSmDataResetType) {
+ case e_SS_SM_DATA_RESET_TYPE_USER:
+ l_ePsCpuResetReason = epsCpuResetReasonUserDataReset;
+ l_bResetRequired = TRUE;
+ break;
+
+ case e_SS_SM_DATA_RESET_TYPE_FACTORY:
+ l_ePsCpuResetReason = epsCpuResetReasonFactoryDataReset;
+ l_bResetRequired = TRUE;
+ break;
+
+ case e_SS_SM_DATA_RESET_TYPE_CONFIGURATION: // No reset action required.
+ l_bResetRequired = FALSE;
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Remote Reset Data type : %d not defined",
+ l_eSmDataResetType);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (eFrameworkunifiedStatusInvldParam);
+ }
+
+ if (TRUE == l_bResetRequired) {
+ SS_Pwr_CpuResetMsgStruct l_PsCpuResetInfo = { };
+ l_PsCpuResetInfo.resetReason = l_ePsCpuResetReason;
+ l_eStatus = m_oSessionHandler.SendToSupervisor(SS_POWER_HARD_RESET_REQ,
+ sizeof(l_PsCpuResetInfo),
+ (PVOID) &l_PsCpuResetInfo);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error: m_oSessionHandler.SendToSupervisor( " "SS_POWER_HARD_RESET_REQ, Reason '%d') errored:%d/'%s'",
+ l_ePsCpuResetReason, l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "SS_POWER_HARD_RESET_REQ Reason '%d' sent to PSMShadow",
+ l_ePsCpuResetReason);
+ }
+ SS_PWR_LOG_HIST("SS_POWER_HARD_RESET_REQ", m__CWORD56_RepHist, m__CWORD56_RepIter,
+ "", l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//
+// End of Remote Data Reset Protocol callback functions
+//*****************************************************************************
+
+// EOF of /SS_PowerService/src/ss_power.cpp
+
diff --git a/systemservice/power_service/server/src/ss_power_config.cpp b/systemservice/power_service/server/src/ss_power_config.cpp
new file mode 100755
index 0000000..3975b56
--- /dev/null
+++ b/systemservice/power_service/server/src/ss_power_config.cpp
@@ -0,0 +1,188 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports power service configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ss_power_config.h"
+
+// define all the configuration parmeters that will be used to get data
+const char * PowerConfiguration::kPowerLogicPlugin = "PowerLogicPlugin.dll";
+const char * PowerConfiguration::kLVI1Timeout = "LVI1.Timeouts_Timeout";
+const char * PowerConfiguration::kLVI1HysteresisTimeout =
+ "LVI1.Hysteresis_Timeout";
+const char * PowerConfiguration::kLVI1HysteresisEnabled =
+ "LVI1.Hysteresis_Enabled";
+const char * PowerConfiguration::kLVI1HysteresisTries = "LVI1.Hysteresis_Tries";
+const char * PowerConfiguration::kLVI2Timeout = "LVI2.Timeouts_Timeout";
+const char * PowerConfiguration::kLVI2HysteresisTimeout =
+ "LVI2.Hysteresis_Timeout";
+const char * PowerConfiguration::kLVI2HysteresisEnabled =
+ "LVI2.Hysteresis_Enabled";
+const char * PowerConfiguration::kLVI2HysteresisTries = "LVI2.Hysteresis_Tries";
+const char * PowerConfiguration::kShutdownTimeout = "Shutdown.Timeouts_Timeout";
+const char * PowerConfiguration::kShutdownHysteresisTimeout =
+ "Shutdown.Hysteresis_Timeout";
+const char * PowerConfiguration::kShutdownHysteresisEnabled =
+ "Shutdown.Hysteresis_Enabled";
+const char * PowerConfiguration::kShutdownHysteresisTries =
+ "Shutdown.Hysteresis_Tries";
+/// < defines the names in the cfg file that are used to get required modules names
+const char * PowerConfiguration::kRequiredWakeupModules =
+ "Wakeup.RequiredModules."; /// < once all the modules have been wakened up send wake-up complete
+const char * PowerConfiguration::kRequiredShutdownModules =
+ "Shutdown.RequiredModules."; /// < once all the modules have been shutdown send shutdown complete
+const char * PowerConfiguration::kRequiredLvi2Modules =
+ "LVI2.RequiredModules."; /// < once all the modules have been wakened up send wake-up complete
+
+PowerConfiguration::PowerConfiguration(std::string f_configfilename)
+ : m_ConfigFileName(f_configfilename) {
+}
+
+PowerConfiguration::~PowerConfiguration() {
+}
+
+BOOL PowerConfiguration::LoadParameters(PowerConfigParams & params) {
+ EFrameworkunifiedStatus l_eStatus;
+ BOOL l_rtnCode = FALSE;
+
+ CNSConfigReader *l_pReaderCfg = new CNSConfigReader();
+ if (NULL == l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5:new error case
+ // LCOV_EXCL_START 5:new error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. new CNSConfigReader() returned NULL pointer.");
+ // LCOV_EXCL_STOP 5:new error case
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(m_ConfigFileName))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->Open(%s) returned NULL pointer.",
+ m_ConfigFileName.c_str());
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kShutdownTimeout,
+ params.shutdown.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus, "l_pReaderCfg->GetInt(ShutdownTimeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI1Timeout, params.lvi1.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus, "l_pReaderCfg->GetInt(LVI1Timeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI2Timeout, params.lvi2.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus, "l_pReaderCfg->GetInt(LVI2Timeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kShutdownHysteresisTimeout,
+ params.shutdown.hysteresis.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(ShutdownHysteresisTimeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI1HysteresisTimeout,
+ params.lvi1.hysteresis.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI1HysteresisTimeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI2HysteresisTimeout,
+ params.lvi2.hysteresis.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI2HysteresisTimeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kShutdownHysteresisTries,
+ params.shutdown.hysteresis.tries))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(ShutdownHysteresisTries)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI1HysteresisTries,
+ params.lvi1.hysteresis.tries))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI1HysteresisTries)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI2HysteresisTries,
+ params.lvi2.hysteresis.tries))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI2HysteresisTries)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetBool(
+ kShutdownHysteresisEnabled, params.shutdown.hysteresis.enabled))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(ShutdownHysteresisEnabled)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetBool(kLVI1HysteresisEnabled,
+ params.lvi1.hysteresis.enabled))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI1HysteresisEnabled)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetBool(kLVI2HysteresisEnabled,
+ params.lvi2.hysteresis.enabled))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI2HysteresisEnabled)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetString(kPowerLogicPlugin,
+ params.power_logic_plugin))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus, "l_pReaderCfg->GetInt(PowerLogicPlugin)");
+ } else {
+ l_rtnCode = TRUE;
+ }
+
+ delete l_pReaderCfg;
+ }
+
+ return (l_rtnCode);
+}
+
+void PowerConfiguration::LoadDefaultParameters(PowerConfigParams & params) {
+ params.power_logic_plugin = "ss_powerlogic.dll";
+ params.shutdown.timeout = 600; // thats 5mins
+ params.shutdown.hysteresis.enabled = FALSE; // There should be hysteresis for Shutdown
+ params.shutdown.hysteresis.timeout = 0; // Don't Care since disabled.
+ params.shutdown.hysteresis.tries = 0; // Don't Care since disabled.
+ params.lvi1.timeout = 2; // thats 2secs
+ params.lvi1.hysteresis.enabled = TRUE; // Enable LVI1 hysteresis
+ params.lvi1.hysteresis.tries = 2; // check twice before switching to LVI1
+ params.lvi1.hysteresis.timeout = 500; // thats 500 msecs
+ params.lvi2.timeout = 2; // thats 2secs
+ params.lvi2.hysteresis.enabled = TRUE; // Enable LVI2 hysteresis
+ params.lvi2.hysteresis.tries = 2; // check twice before switching to LVI2
+ params.lvi2.hysteresis.timeout = 100; // thats 100 msecs
+}
+
+void PowerConfiguration::PrintConfigInfo(PowerConfigParams & f_params) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown.timeout: %d",
+ f_params.shutdown.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi1.timeout: %d", f_params.lvi1.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi2.timeout: %d", f_params.lvi2.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown.hysteresis.timeout: %d",
+ f_params.shutdown.hysteresis.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi1.hysteresis.timeout: %d",
+ f_params.lvi1.hysteresis.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi2.hysteresis.timeout: %d",
+ f_params.lvi2.hysteresis.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown.hysteresis.tries: %d",
+ f_params.shutdown.hysteresis.tries);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi1.hysteresis.tries: %d",
+ f_params.lvi1.hysteresis.tries);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi1.hysteresis.tries: %d",
+ f_params.lvi1.hysteresis.tries);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown.hysteresis.enabled: %d",
+ f_params.shutdown.hysteresis.enabled);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi1.hysteresis.enabled: %d",
+ f_params.lvi1.hysteresis.enabled);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi2.hysteresis.enabled: %d",
+ f_params.lvi2.hysteresis.enabled);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "power_logic_plugin: %s",
+ f_params.power_logic_plugin.c_str());
+ return;
+}
diff --git a/systemservice/power_service/server/src/ss_power_session.cpp b/systemservice/power_service/server/src/ss_power_session.cpp
new file mode 100755
index 0000000..20db4a9
--- /dev/null
+++ b/systemservice/power_service/server/src/ss_power_session.cpp
@@ -0,0 +1,276 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Power
+/// \brief This file supports power service session management.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_power_session.h"
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_power_service.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_power_service_local.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+#include "ss_power_powerservicelog.h"
+
+
+PowerSessionHandler::PowerSessionHandler() {
+ // TODO(my_username) Auto-generated constructor stub
+}
+
+PowerSessionHandler::~PowerSessionHandler() { // LCOV_EXCL_START 14 Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // TODO(my_username) Auto-generated destructor stub
+}
+// LCOV_EXCL_STOP 14 Resident process, not called by NSFW
+
+EFrameworkunifiedStatus PowerSessionHandler::CloseSession(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
+
+ // find the subscriber...
+ PwSessionIter iter = m_mapSessions.find(FrameworkunifiedGetMsgSrc(h_app));
+
+ // the iter is set to the end then the subscriber is not in the map
+ if (m_mapSessions.end() == iter) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error: Subscriber '%s' was not found in the map; the Close " "Session Request is being ignored!",
+ FrameworkunifiedGetMsgSrc(h_app));
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ } else if (NULL == iter->second.hsession) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("Client's PwSessionInfo handle");
+ // LCOV_EXCL_STOP 11:unexpected branch
+ } else {
+ CloseSessionAck closeSessionAck;
+ closeSessionAck.sessionId = FrameworkunifiedGetSessionId(iter->second.hsession);
+ closeSessionAck.eStatus = eFrameworkunifiedStatusOK;
+
+ // Send Ack to subscriber
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(iter->second.hsession, PROTOCOL_CLOSE_SESSION_ACK, sizeof(CloseSessionAck), (PVOID) &closeSessionAck))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error: FrameworkunifiedSendMsg(%s, PROTOCOL_CLOSE_SESSION_ACK) " "errored: %d/'%s'",
+ iter->second.sz_name.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " FrameworkunifiedSendMsg(%s, PROTOCOL_CLOSE_SESSION_ACK) successful",
+ iter->second.sz_name.c_str());
+ iter->second.frunning = FALSE;
+
+ //
+ // ToDo Jay 2012 November 05 1) Can't detach just basic callbacks;
+ // client could be Supervisor or System. This has been solved
+ // in another Power Service Change Set. Need to get all
+ // Change Sets merged and delivered.
+ UI_32 ss_power_basic_session_ids[] = { PROTOCOL_CLOSE_SESSION_REQ };
+
+ // Detach callback : Power System Session Requests
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(h_app, iter->second.sz_name.c_str(), ss_power_basic_session_ids, _countof(ss_power_basic_session_ids)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedDetachCallbacksFromDispatcher()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " FrameworkunifiedDetachCallbacksFromDispatcher() successful");
+ }
+
+ CALL_AND_LOG_STATUS(FrameworkunifiedDestroySession(h_app, iter->second.hsession));
+ iter->second.hsession = NULL;
+ m_mapSessions.erase(iter);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PowerSessionHandler::StartComplete(HANDLE h_app) { // LCOV_EXCL_START 8: can not be called
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ StartCompleteAck ack;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<StartCompleteAck>(h_app, ack))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ } else {
+ // find the subscriber...
+ PwSessionIter iter = m_mapSessions.find(FrameworkunifiedGetMsgSrc(h_app));
+
+ // the iter is set to the end then the subscriber is not in the map
+ if (m_mapSessions.end() != iter) {
+ iter->second.sz_servicename = ack.szServiceName;
+ iter->second.frunning = TRUE;
+
+ if (AllClientsInGroupStarted(iter->second.ui_groupid)) {
+ // NOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Subscriber: %s , was not found in the map, the close session is being ignored!",
+ FrameworkunifiedGetMsgSrc(h_app));
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP 8: can not be called
+VOID PowerSessionHandler::Print() {
+ // find the subscriber...
+ PwSessionIter iter = m_mapSessions.begin();
+ for (; iter != m_mapSessions.end(); iter++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG_DUMP, __FUNCTION__,
+ " Power Service is session-connected to '%s'; running: %s",
+ iter->second.sz_name.data(), (iter->second.frunning ? "YES" : "NO"));
+ }
+}
+
+// LCOV_EXCL_START 8: can not be called
+BOOL PowerSessionHandler::WakeupComplete(RequiredModuleList & wakeup_modules) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL rtn = TRUE; // set the return TRUE until we find a missing module
+ RequiredModuleListIter iter = wakeup_modules.begin();
+ for (; iter != wakeup_modules.end(); iter++) {
+ PwSessionIter psi = m_mapSessions.find(*iter);
+ if (m_mapSessions.end() == psi) {
+ rtn = FALSE; // Module Not Found in Power Service Session Handler
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Required Wakeup: %s has not connected to Power Service, Wakeup NOT COMPLETE!",
+ iter->data());
+ } else if (FALSE == psi->second.frunning) {
+ rtn = FALSE; // Module Found in Power Service Session Handler but hasn't started yet
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Required Wakeup: %s has connected to Power Service but is not running (FrameworkunifiedStart Response missing),"
+ " Wakeup NOT COMPLETE!",
+ iter->data());
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return rtn;
+}
+// LCOV_EXCL_STOP 8: can not be called
+
+BOOL PowerSessionHandler::ShutdownComplete(
+ RequiredModuleList & shutdown_modules) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL rtn = TRUE; // set the return TRUE until we find a missing module
+ RequiredModuleListIter iter = shutdown_modules.begin();
+ for (; iter != shutdown_modules.end(); iter++) {
+ PwSessionIter psi = m_mapSessions.find(*iter);
+ if (m_mapSessions.end() == psi) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Required Shutdown: %s is not in Power Service session list, Shutdown pending!",
+ iter->data());
+ } else if (TRUE == psi->second.frunning) {
+ rtn = FALSE; // Module Found in Power Service Session Handler but hasn't stopped yet
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Required Shutdown: %s is connected to Power Service but is running (Stop Response missing),"
+ " Shutdown NOT COMPLETE!",
+ iter->data());
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return rtn;
+}
+
+EFrameworkunifiedStatus PowerSessionHandler::SendToSupervisor(UI_32 cmd, UI_32 length,
+ PVOID data) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL == data && length > 0) { // LCOV_EXCL_BR_LINE 6: it will not be true at the other place
+ // LCOV_EXCL_START 6: it will not be true at the other place
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("NULL == data && length > 0");
+ l_eStatus = eFrameworkunifiedStatusInvldBuf;
+ // LCOV_EXCL_STOP 6: it will not be true at the other place
+ } else {
+ // get first client from the map...
+ PwSessionIter iter = m_mapSessions.begin();
+ BOOL l_bFoundSupervisor = FALSE;
+
+ for (; iter != m_mapSessions.end() && !l_bFoundSupervisor; iter++) {
+ l_bFoundSupervisor = (epsstSUPERVISOR == iter->second.esessiontype);
+ if (l_bFoundSupervisor) {
+ l_eStatus = FrameworkunifiedSendMsg(iter->second.hsession, cmd, length, data);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg()");
+ }
+ }
+ if (!l_bFoundSupervisor) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ "Error: Did not find a Supervisor session; did not " "send cmd %d !",
+ cmd);
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+BOOL PowerSessionHandler::AllClientsInGroupStarted(UI_32 f_ungrpid) { // LCOV_EXCL_START 8: can not be called
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL fStatus = TRUE;
+ BOOL fGrpFnd = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ PwSessionIter iter = m_mapSessions.begin();
+
+ if (iter == m_mapSessions.end())
+ fStatus = TRUE;
+
+ for (; iter != m_mapSessions.end() && fStatus; iter++) {
+ if (f_ungrpid == iter->second.ui_groupid) {
+ fGrpFnd = TRUE;
+ if (FALSE == iter->second.frunning) {
+ fStatus = FALSE;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- return flag: %s",
+ ((fStatus && fGrpFnd) ? "TRUE" : "FALSE"));
+ return (fStatus && fGrpFnd);
+}
+// LCOV_EXCL_STOP 8: can not be called
diff --git a/systemservice/power_service/server/src/ss_power_state_machine.cpp b/systemservice/power_service/server/src/ss_power_state_machine.cpp
new file mode 100755
index 0000000..28291e5
--- /dev/null
+++ b/systemservice/power_service/server/src/ss_power_state_machine.cpp
@@ -0,0 +1,924 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports the power service state machine.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "ss_power_state_machine.h"
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_power_service.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service_local.h>
+#include <system_service/ss_power_service_notifications_local.h>
+#include <system_service/ss_services.h>
+#include <native_service/ns_timer_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+
+#include "ss_power_session.h"
+#include "ss_power_powerservicelog.h"
+
+/// Define static members of the class.
+PowerStateMachine::Wakeup PowerStateMachine::WakeupState;
+PowerStateMachine::WakeupActive PowerStateMachine::WakeupActiveState;
+PowerStateMachine::WakeupPending PowerStateMachine::WakeupPendingState;
+PowerStateMachine::LowVoltage1 PowerStateMachine::LowVoltage1State;
+PowerStateMachine::LowVoltage1Active PowerStateMachine::LowVoltage1ActiveState;
+PowerStateMachine::LowVoltage2 PowerStateMachine::LowVoltage2State;
+PowerStateMachine::LowVoltage2Active PowerStateMachine::LowVoltage2ActiveState;
+PowerStateMachine::Shutdown PowerStateMachine::ShutdownState;
+PowerStateMachine::ShutdownActive PowerStateMachine::ShutdownActiveState;
+PowerStateMachine::NormalVoltage PowerStateMachine::NormalVoltageState;
+PowerStateMachine::SoftwareUpdate PowerStateMachine::SoftwareUpdateState;
+
+/// Constructor
+PowerStateMachine::PowerStateMachine()
+ : m_pCurrentState(&WakeupState),
+ m_pPreviousState(NULL),
+ m_pOnHysteresisTimeoutState(NULL),
+ m_oShutdownHysteresis(),
+ m_oLowVoltage1Hysteresis(),
+ m_oLowVoltage2Hysteresis(),
+ m_hHysteresisTimer(NULL),
+ m_tStateInfo() {
+}
+
+/// Deconstructor
+PowerStateMachine::~PowerStateMachine() { // LCOV_EXCL_START 14 Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP 14 Resident process, not called by NSFW
+
+void PowerStateMachine::onEvent(HANDLE h_app, PowerSessionHandler & oSession,
+ ePowerStateMachineEvents evt) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "(ENTRY) Power StateMachine Current State: %s, Previous State: %s",
+ m_pCurrentState->name(),
+ (m_pPreviousState == NULL ? "Ivalid" : m_pPreviousState->name()));
+
+ switch (evt) { // LCOV_EXCL_BR_LINE 8: dead code
+ case PowerStateMachine::epsmeWAKEUP:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeWAKEUP");
+ m_pCurrentState->onWakeup(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeSTART_COMPLETE: // LCOV_EXCL_START 8: no one send the event
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSTART_COMPLETE");
+ m_pCurrentState->onStartComplete(*this, h_app, oSession);
+ break;
+ // LCOV_EXCL_STOP 8: no one send the event
+ case PowerStateMachine::epsmeSHUTDOWN:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSHUTDOWN");
+ m_pCurrentState->onShutdown(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeSTOP_COMPLETE: // LCOV_EXCL_START 8: no one send the event
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSTOP_COMPLETE");
+ m_pCurrentState->onStopComplete(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeLVI1_ENCOUNTERED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_ENCOUNTERED");
+ m_pCurrentState->onLowVoltage1Encountered(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeLVI2_ENCOUNTERED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_ENCOUNTERED");
+ m_pCurrentState->onLowVoltage2Encountered(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeNORMAL_VOLTAGE_ENCOUNTERED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "Power StateMachine Event Received: epsmeNORMAL_VOLTAGE_ENCOUNTERED");
+ m_pCurrentState->onNormalVoltageEncountered(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeSOFTWARE_UPDATE:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSOFTWARE_UPDATE");
+ m_pCurrentState->onSoftwareUpdate(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeSHUTDOWN_HYSTERESIS_ABORTED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "Power StateMachine Event Received: epsmeSHUTDOWN_HYSTERESIS_ABORTED");
+ case PowerStateMachine::epsmeLVI1_HYSTERESIS_ABORTED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_HYSTERESIS_ABORTED");
+ case PowerStateMachine::epsmeLVI2_HYSTERESIS_ABORTED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_HYSTERESIS_ABORTED");
+ m_pCurrentState->onHysteresisAborted(*this, h_app, oSession);
+ break;
+ // LCOV_EXCL_STOP 8: no one send the event
+ case PowerStateMachine::epsmeSHUTDOWN_HYSTERESIS_TM_OUT:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ "Power StateMachine Event Received: epsmeSHUTDOWN_HYSTERESIS_TM_OUT"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ case PowerStateMachine::epsmeLVI1_HYSTERESIS_TM_OUT:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_HYSTERESIS_TM_OUT"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ case PowerStateMachine::epsmeLVI2_HYSTERESIS_TM_OUT:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_HYSTERESIS_TM_OUT"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ m_pCurrentState->onHysteresisTimeout(*this, h_app, oSession);
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: WAS INVALID"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ break;
+ } // ZONE_POWER_STATEMACHINE
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "(EXIT) Power StateMachine Current State: %s, Previous State: %s",
+ m_pCurrentState->name(),
+ (m_pPreviousState == NULL ? "Ivalid" : m_pPreviousState->name()));
+}
+
+PCSTR PowerStateMachine::name() { // LCOV_EXCL_START 8: do not be called
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (NULL != m_pCurrentState) {
+ return m_pCurrentState->name();
+ }
+
+ return "Invalid Current State is NULL...";
+}
+// LCOV_EXCL_STOP 8: do not be called
+
+/// Switch to the next State and save the previous state.
+void PowerStateMachine::NextState(Base_State & refState, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ m_pPreviousState = m_pCurrentState;
+ m_pPreviousState->onExit(*this, h_app, oSession);
+ m_pCurrentState = &refState;
+ m_pCurrentState->onEntry(*this, h_app, oSession);
+}
+
+// LCOV_EXCL_START 8: do not be called
+void PowerStateMachine::OnVoltage(Base_State * pState, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (sizeof(Pwr_ServiceSetInterface) == FrameworkunifiedGetMsgLength(h_app)) {
+ Pwr_ServiceSetInterface tServiceIf;
+
+ if (eFrameworkunifiedStatusOK
+ == FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tServiceIf,
+ sizeof(Pwr_ServiceSetInterface))) {
+ /// Need to store the voltage information
+ m_tStateInfo.voltage = tServiceIf.data.voltage.state;
+
+ if (NULL != pState) {
+ NextState(*pState, h_app, oSession);
+ }
+ }
+ }
+}
+// LCOV_EXCL_STOP 8: do not be called
+void PowerStateMachine::GotoStateOnHysteresisTimeout(Base_State & refState) {
+ m_pOnHysteresisTimeoutState = &refState;
+}
+
+void PowerStateMachine::startHysteresisTimer(PowerStateHysteresis & hys_info) {
+ /// clear the try counter.
+ hys_info.clearTryCounter();
+
+ /// bump the hysteresis try counter (prime the counter).
+ hys_info.bumbTryCounter();
+
+ /// setup the hysteresis timer
+ NSTimerInfo turn_on_hysteresis = { WholeSeconds(hys_info.getTimeout()),
+ MSToNS(RemainderMs(hys_info.getTimeout())), 0, 0, 0 };
+
+ /// start the hysteresis timer
+ NS_TimerSetTime(m_hHysteresisTimer, turn_on_hysteresis);
+}
+
+void PowerStateMachine::reStartHysteresisTimer(
+ PowerStateHysteresis & hys_info) {
+ /// bump the hysteresis try counter.
+ hys_info.bumbTryCounter();
+
+ /// setup the hysteresis timer (one shot)
+ NSTimerInfo turn_on_hysteresis = { WholeSeconds(hys_info.getTimeout()),
+ MSToNS(RemainderMs(hys_info.getTimeout())), 0, 0, 0 };
+ /// start the hysteresis timer
+ NS_TimerSetTime(m_hHysteresisTimer, turn_on_hysteresis);
+}
+
+void PowerStateMachine::stopHysteresisTimer(PowerStateHysteresis & hys_info) {
+ NSTimerInfo turn_off_hysteresis = { 0, 0, 0, 0, 0 };
+ NS_TimerSetTime(m_hHysteresisTimer, turn_off_hysteresis);
+ /// clear the try counter.
+ hys_info.clearTryCounter();
+}
+
+// LCOV_EXCL_START 8: can not be called
+void PowerStateMachine::publishPowerLVIStatus(HANDLE h_app, PCSTR nNotifNm,
+ UI_32 value) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ PowerSrvLVIStatus eLviStatus = static_cast<PowerSrvLVIStatus>(value);
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedNPPublishNotification(h_app, nNotifNm, &eLviStatus,
+ sizeof(eLviStatus)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedNPPublishNotification( %s ) errored: 0x%X", nNotifNm,
+ eStatus);
+ }
+}
+// LCOV_EXCL_STOP 8: can not be called
+void PowerStateMachine::publishPowerLevelType(HANDLE h_app, UI_32 value) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ PowerSrvLevelType eLevelType = static_cast<PowerSrvLevelType>(value);
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedNPPublishNotification (h_app, szNTFY_PowerLevel, &eLevelType, sizeof (eLevelType)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedNPPublishNotification %s Failed Status:0x%x ",
+ szNTFY_PowerLevel, eStatus);
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Base_State::onStartComplete(
+ PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ oSession.StartComplete(h_app);
+}
+// LCOV_EXCL_STOP 8: do not be called
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Base_State::onStopComplete(
+ PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ oSession.StopComplete(h_app);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: no one call this function
+void PowerStateMachine::Base_State::onLaunchComplete(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FrameworkunifiedDeferMessage(h_app);
+}
+// LCOV_EXCL_STOP 8: do not be called
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Base_State::onShutdownComplete(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FrameworkunifiedDeferMessage(h_app);
+}
+// LCOV_EXCL_STOP 8: no one call this function
+PCSTR PowerStateMachine::Wakeup::name() {
+ return "Wakeup";
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Wakeup::onLowVoltage1Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage1State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: do not be called
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Wakeup::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage2State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::Wakeup::onNormalVoltageEncountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "NORMAL ENCOUNTERED %s (no switch)", FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+void PowerStateMachine::Wakeup::onShutdown(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ u.NextState(ShutdownState, h_app, oSession);
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Wakeup::onSoftwareUpdate(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.NextState(SoftwareUpdateState, h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Wakeup::onWakeup(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ Pwr_ServiceSetInterface tServiceIf;
+ if (sizeof(Pwr_ServiceSetInterface) == FrameworkunifiedGetMsgLength(h_app)) {
+ if (eFrameworkunifiedStatusOK
+ == FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tServiceIf,
+ sizeof(Pwr_ServiceSetInterface))) {
+ if (epswsPWRON == tServiceIf.data.wake.powerupType) {
+ /// Need to store the wakeup \ shutdown information
+ u.m_tStateInfo.wake = tServiceIf.data.wake.powerupType;
+ u.m_tStateInfo.level = tServiceIf.data.wake.up.level;
+ u.m_tStateInfo.factor = tServiceIf.data.wake.up.factor;
+
+ u.NextState(WakeupPendingState, h_app, oSession);
+ }
+ }
+ }
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+PCSTR PowerStateMachine::WakeupActive::name() {
+ return "Wakeup Active";
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::WakeupActive::onLowVoltage1Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage1State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::WakeupActive::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage2State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+void PowerStateMachine::WakeupActive::onShutdown(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ u.NextState(ShutdownState, h_app, oSession);
+}
+
+PCSTR PowerStateMachine::WakeupPending::name() {
+ return "Wakeup Pending";
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::WakeupPending::onNormalVoltageEncountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&NormalVoltageState, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::WakeupPending::onStartComplete(
+ PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ oSession.StartComplete(h_app);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: no one call this function
+void PowerStateMachine::WakeupPending::onLaunchComplete(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ oSession.SendToSupervisor(SS_POWER_WAKEUP_COMPLETE, 0, NULL);
+ if (epsvsNORMAL == u.m_tStateInfo.voltage) {
+ u.NextState(NormalVoltageState, h_app, oSession);
+ }
+}
+// LCOV_EXCL_STOP 8: no one call this function
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::WakeupPending::onWakeup(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (oSession.WakeupComplete(u.m_lstWakeupModules)) {
+ oSession.SendToSupervisor(SS_POWER_WAKEUP_COMPLETE, 0, NULL);
+ }
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+void PowerStateMachine::WakeupPending::onEntry(PowerStateMachine &u,
+ HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ if (!FrameworkunifiedIsDeferQueueEmpty(h_app)) {
+ FrameworkunifiedRetrieveDeferMessage(h_app);
+ }
+}
+
+PCSTR PowerStateMachine::Shutdown::name() {
+ return "Shutdown";
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Shutdown::onLowVoltage1Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(LowVoltage1State);
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW VOLTAGE 1 ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::Shutdown::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(LowVoltage2State);
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW VOLTAGE 2 ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::Shutdown::onHysteresisAborted(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.NextState(*(u.m_pPreviousState), h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+void PowerStateMachine::Shutdown::onHysteresisTimeout(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ if (!u.m_oShutdownHysteresis.maxTries()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "epsmeSHUTDOWN_TM_OUT tries: %d", u.m_oShutdownHysteresis.getTries());
+
+ u.reStartHysteresisTimer(u.m_oShutdownHysteresis);
+ } else {
+ // Move directorly to next state.
+ u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
+ }
+}
+
+void PowerStateMachine::Shutdown::onEntry(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ if (u.m_oShutdownHysteresis.getEnabled()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "Starting epsmeSHUTDOWN_HYSTERESIS_TM_OUT timeout: %d tries: %d",
+ u.m_oShutdownHysteresis.getTimeout(),
+ u.m_oShutdownHysteresis.getTries());
+ // Set the goto state state.
+ u.GotoStateOnHysteresisTimeout(ShutdownActiveState);
+ // Start the hysteresis timer for low voltage 2
+ u.startHysteresisTimer(u.m_oShutdownHysteresis);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "SHUTDOWN_HYSTERESIS is not enabled. Going directly to ShutdownActiveState");
+ // Move directly to next state.
+ u.NextState(ShutdownActiveState, h_app, oSession);
+ }
+}
+
+void PowerStateMachine::Shutdown::onExit(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ u.stopHysteresisTimer(u.m_oShutdownHysteresis);
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) Shutdown State");
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Shutdown::onWakeup(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(WakeupPendingState);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+PCSTR PowerStateMachine::ShutdownActive::name() {
+ return "Shutdown Active";
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::ShutdownActive::onLowVoltage1Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage1State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::ShutdownActive::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage2State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+void PowerStateMachine::ShutdownActive::onEntry(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ u.publishPowerLevelType(h_app, epspltSHUTDOWN);
+
+ if (oSession.ShutdownComplete(u.m_lstShutdownModules)) {
+ oSession.SendToSupervisor(SS_POWER_SHUTDOWN_COMPLETE, 0, NULL);
+ }
+}
+
+void PowerStateMachine::ShutdownActive::onShutdown(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ if (oSession.ShutdownComplete(u.m_lstShutdownModules)) {
+ oSession.SendToSupervisor(SS_POWER_SHUTDOWN_COMPLETE, 0, NULL);
+ }
+}
+
+PCSTR PowerStateMachine::LowVoltage1::name() { // LCOV_EXCL_START 8: can not be LowVoltage1status
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "Low Voltage I";
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage1status
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage1::onHysteresisAborted(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.NextState(*(u.m_pPreviousState), h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be LowVoltage1status
+void PowerStateMachine::LowVoltage1::onHysteresisTimeout(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (!u.m_oLowVoltage1Hysteresis.maxTries()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT tries: %d",
+ u.m_oLowVoltage1Hysteresis.getTries());
+
+ u.reStartHysteresisTimer(u.m_oLowVoltage1Hysteresis);
+ } else {
+ // Move directorly to next state.
+ u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
+ }
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage1::onWakeup(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(NormalVoltageState);
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage1status
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage1::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(LowVoltage2State);
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW VOLTAGE 2 ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage1::onNormalVoltageEncountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(NormalVoltageState);
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be LowVoltage1status
+void PowerStateMachine::LowVoltage1::onEntry(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (u.m_oLowVoltage1Hysteresis.getEnabled()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "Starting epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT timeout: %d tries: %d",
+ u.m_oLowVoltage1Hysteresis.getTimeout(),
+ u.m_oLowVoltage1Hysteresis.getTries());
+ // Set the goto state state.
+ u.GotoStateOnHysteresisTimeout(LowVoltage1ActiveState);
+ // Start the hysteresis timer for low voltage 1
+ u.startHysteresisTimer(u.m_oLowVoltage1Hysteresis);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW_VOLTAGE_HYSTERESIS is not enabled. Going directly to LowVoltage1ActiveState");
+ // Move directly to next state.
+ u.NextState(LowVoltage1ActiveState, h_app, oSession);
+ }
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage1::onExit(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.stopHysteresisTimer(u.m_oLowVoltage1Hysteresis);
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) LowVoltage1 State");
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+PCSTR PowerStateMachine::LowVoltage1Active::name() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "Low Voltage I Active";
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage1status
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage1Active::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage2State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage1Active::onNormalVoltageEncountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&NormalVoltageState, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL VOLTAGE ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be LowVoltage1Activestatus
+void PowerStateMachine::LowVoltage1Active::onEntry(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.publishPowerLevelType(h_app, epspltEMERGENCY);
+u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI1, ePwSrvLVI_Status_Active);
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage1Active::onExit(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI1, ePwSrvLVI_Status_InActive);
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage1Activestatus
+
+PCSTR PowerStateMachine::LowVoltage2::name() { // LCOV_EXCL_START 8: can not be LowVoltage2status
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+return "Low Voltage II";
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage2status
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage2::onHysteresisAborted(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.NextState(*(u.m_pPreviousState), h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be LowVoltage2status
+void PowerStateMachine::LowVoltage2::onHysteresisTimeout(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+if (!u.m_oLowVoltage2Hysteresis.maxTries()) {
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "epsmeLOW_VOLTAGE2_HYSTERESIS_TM_OUT tries: %d",
+ u.m_oLowVoltage2Hysteresis.getTries());
+
+u.reStartHysteresisTimer(u.m_oLowVoltage2Hysteresis);
+} else {
+// Move directorly to next state.
+u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
+}
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2::onEntry(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+if (u.m_oLowVoltage2Hysteresis.getEnabled()) {
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "Starting epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT timeout: %d tries: %d",
+ u.m_oLowVoltage2Hysteresis.getTimeout(),
+ u.m_oLowVoltage2Hysteresis.getTries());
+// Set the goto state state.
+u.GotoStateOnHysteresisTimeout(LowVoltage2ActiveState);
+// Start the hysteresis timer for low voltage 2
+u.startHysteresisTimer(u.m_oLowVoltage2Hysteresis);
+} else {
+FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW_VOLTAGE2_HYSTERESIS is not enabled. Going directly to LowVoltage2ActiveState");
+// Move directly to next state.
+u.NextState(LowVoltage2ActiveState, h_app, oSession);
+}
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2::onExit(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.stopHysteresisTimer(u.m_oLowVoltage2Hysteresis);
+FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) LowVoltage2 State");
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2::onWakeup(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.GotoStateOnHysteresisTimeout(WakeupPendingState);
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage2status
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage2::onLowVoltage1Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.GotoStateOnHysteresisTimeout(LowVoltage1State);
+u.OnVoltage(NULL, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW VOLTAGE 1 ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2::onNormalVoltageEncountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.GotoStateOnHysteresisTimeout(NormalVoltageState);
+u.OnVoltage(NULL, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+PCSTR PowerStateMachine::LowVoltage2Active::name() { // LCOV_EXCL_START 8: can not be LowVoltage2Activestatus
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+return "Low Voltage II Active";
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage2Activestatus
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage2Active::onLowVoltage1Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&LowVoltage1State, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2Active::onNormalVoltageEncountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&NormalVoltageState, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL VOLTAGE ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be LowVoltage2Activestatus
+void PowerStateMachine::LowVoltage2Active::onEntry(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.publishPowerLevelType(h_app, epspltEMERGENCY);
+u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI2, ePwSrvLVI_Status_Active);
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2Active::onExit(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI2, ePwSrvLVI_Status_InActive);
+oSession.SendToSupervisor(SS_POWER_LVI2_SHUTDOWN_COMPLETE, 0, NULL);
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage2Activestatus
+
+PCSTR PowerStateMachine::NormalVoltage::name() { // LCOV_EXCL_START 8: can not be NormalVoltageState
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+return "Normal Voltage";
+}
+// LCOV_EXCL_STOP 8: can not be NormalVoltageState
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::NormalVoltage::onLowVoltage1Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&LowVoltage1State, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::NormalVoltage::onLowVoltage2Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&LowVoltage2State, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be NormalVoltageState
+void PowerStateMachine::NormalVoltage::onShutdown(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.NextState(ShutdownState, h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: can not be NormalVoltageState
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::NormalVoltage::onSoftwareUpdate(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.NextState(SoftwareUpdateState, h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be NormalVoltageState
+void PowerStateMachine::NormalVoltage::onEntry(PowerStateMachine &u,
+ HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.publishPowerLevelType(h_app, epspltNORMAL);
+}
+// LCOV_EXCL_STOP 8: can not be NormalVoltageState
+
+PCSTR PowerStateMachine::SoftwareUpdate::name() { // LCOV_EXCL_START 8: can not be SoftwareUpdatestatus
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+return "Software Update";
+}
+// LCOV_EXCL_STOP 8: can not be SoftwareUpdatestatus
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::SoftwareUpdate::onLowVoltage1Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&LowVoltage1State, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::SoftwareUpdate::onLowVoltage2Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&LowVoltage2State, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be SoftwareUpdatestatus
+void PowerStateMachine::SoftwareUpdate::onShutdown(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::SoftwareUpdate::onEntry(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::SoftwareUpdate::onExit(PowerStateMachine &u,
+ HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP 8: can not be SoftwareUpdatestatus
diff --git a/systemservice/power_service/server/src/ss_pwr_test_client_handlers.cpp b/systemservice/power_service/server/src/ss_pwr_test_client_handlers.cpp
new file mode 100755
index 0000000..1542281
--- /dev/null
+++ b/systemservice/power_service/server/src/ss_pwr_test_client_handlers.cpp
@@ -0,0 +1,204 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports the power service test client.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "ss_power.h"
+#include <system_service/ss_power_service_local.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <other_service/itoa.h>
+#include <map>
+#include <string>
+#include "ss_power_powerservicelog.h"
+
+using namespace std; // NOLINT (build/namespaces)
+
+#define SS_CRANK_STATE_STRING_LENGTH 5
+#define SS_VOLTAGE_STATE_STRING_LENGTH 5
+#define SS_MODULE_STATE_STRING_LENGTH 5
+#define SS_HEX_BASE_VALUE 16
+
+const CHAR ReeadyToWakeUpDescription[] = "_READY_TO_WAKEUP:";
+const CHAR WakeUpInitiatedDescription[] = "_WAKEUP_INITIATED:";
+const CHAR WakeUpCompletedDescription[] = "_WAKEUP_COMPLETED:";
+const CHAR PowerOnCompletedDescription[] = "_POWER_ON_COMPLETED:";
+const CHAR PowerOffInitiatedDescription[] = "_POWER_OFF_INITIATED:";
+const CHAR PowerOffCompletedDescription[] = "_POWER_OFF_COMPLETED:";
+const CHAR ShutdownInitiatedDescription[] = "_SHUTDOWN_INITIATED:";
+const CHAR ShutdownCompletedDescription[] = "_SHUTDOWN_COMPLETED:";
+
+const CHAR CrankInvalidDescription[] = "_INVALID:";
+const CHAR CrankEntryDescription[] = "_ENTRY:";
+const CHAR CrankExitDescription[] = "_EXIT:";
+
+const CHAR VoltageInvalidDescription[] = "_INVALID:";
+const CHAR VoltageNormalDescription[] = "_NORMAL:";
+const CHAR VoltageLVI1Description[] = "_LVI1:";
+const CHAR VoltageLVI2Description[] = "_LVI2:";
+
+///////////////////////////////////////////////////////////////////////
+/// AddCrankInformationToResponse
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::AddCrankInformationToResponse(CHAR *f_MessageResponse) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR l_Buffer[SS_CRANK_STATE_STRING_LENGTH] = { 0 };
+ UI_32 l_Index = 0;
+
+ std::map<ePowerSrvCrankStates, std::string> CrankMap;
+ CrankMap[epscsINVALID] = CrankInvalidDescription;
+ CrankMap[epscsENTRY] = CrankEntryDescription;
+ CrankMap[epscsEXIT] = CrankExitDescription;
+
+ // confirm that CrankState value would fit in buffer array
+ if (m_CrankState < 0xFFFF) { // LCOV_EXCL_BR_LINE 8: dead code
+ itoa(m_CrankState, l_Buffer, SS_HEX_BASE_VALUE);
+ while (l_Buffer[l_Index]) {
+ l_Buffer[l_Index] = toupper(l_Buffer[l_Index]);
+ l_Index++;
+ }
+ }
+
+ if (MaxRespMsg > (strlen(f_MessageResponse) + strlen(CrankMap[m_CrankState].c_str()) + strlen(l_Buffer))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ strcat(f_MessageResponse, l_Buffer); // NOLINT (runtime/printf)
+ strcat(f_MessageResponse, CrankMap[m_CrankState].c_str()); // NOLINT (runtime/printf)
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Buffer Overrun Condition : Failed to add Crank State description to response");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////
+/// AddVoltageInformationToResponse
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::AddVoltageInformationToResponse(CHAR *f_MessageResponse) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR l_Buffer[SS_VOLTAGE_STATE_STRING_LENGTH] = { 0 };
+ UI_32 l_Index = 0;
+
+ std::map<ePowerSrvVoltageStates, std::string> VoltageMap;
+ VoltageMap[epsvsINVALID] = VoltageInvalidDescription;
+ VoltageMap[epsvsNORMAL] = VoltageNormalDescription;
+ VoltageMap[epsvsLVI1] = VoltageLVI1Description;
+ VoltageMap[epsvsLVI2] = VoltageLVI2Description;
+
+ // confirm that VoltageState value would fit in buffer array
+ if (m_VoltageState < 0xFFFF) { // LCOV_EXCL_BR_LINE 8: dead code
+ itoa(m_VoltageState, l_Buffer, SS_HEX_BASE_VALUE);
+ while (l_Buffer[l_Index]) {
+ l_Buffer[l_Index] = toupper(l_Buffer[l_Index]);
+ l_Index++;
+ }
+ }
+
+ if (MaxRespMsg > (strlen(f_MessageResponse) + strlen(VoltageMap[m_VoltageState].c_str()) + strlen(l_Buffer))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ strcat(f_MessageResponse, l_Buffer); // NOLINT (runtime/printf)
+ strcat(f_MessageResponse, VoltageMap[m_VoltageState].c_str()); // NOLINT (runtime/printf)
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Buffer Overrun Condition : Failed to add Voltage State description to response");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////
+/// AddStateInformationToResponse
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::AddStateInformationToResponse(CHAR *f_MessageResponse) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR l_Buffer[SS_MODULE_STATE_STRING_LENGTH] = { 0 };
+ UI_32 l_Index = 0;
+
+ std::map<SS_PSState, std::string> StateMap; // State Map
+ StateMap[SS_PS_READY_TO_WAKEUP] = ReeadyToWakeUpDescription;
+ StateMap[SS_PS_WAKEUP_INITIATED] = WakeUpInitiatedDescription;
+ StateMap[SS_PS_WAKEUP_COMPLETE] = WakeUpCompletedDescription;
+ StateMap[SS_PS_POWER_ON_COMPLETE] = PowerOnCompletedDescription;
+ StateMap[SS_PS_POWER_OFF_INITIATED] = PowerOffInitiatedDescription;
+ StateMap[SS_PS_POWER_OFF_COMPLETE] = PowerOffCompletedDescription;
+ StateMap[SS_PS_SHUTDOWN_INITIATED] = ShutdownInitiatedDescription;
+ StateMap[SS_PS_SHUTDOWN_COMPLETE] = ShutdownCompletedDescription;
+
+ // confirm that PowerState value would fit in buffer array
+ if (m_PowerState < 0xFFFF) { // LCOV_EXCL_BR_LINE 8: dead code
+ itoa(m_PowerState, l_Buffer, SS_HEX_BASE_VALUE);
+ while (l_Buffer[l_Index]) {
+ l_Buffer[l_Index] = toupper(l_Buffer[l_Index]);
+ l_Index++;
+ }
+ }
+
+ if (MaxRespMsg > (strlen(f_MessageResponse) + strlen(StateMap[m_PowerState].c_str()) + strlen(l_Buffer))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ strcat(f_MessageResponse, l_Buffer); // NOLINT (runtime/printf)
+ strcat(f_MessageResponse, StateMap[m_PowerState].c_str()); // NOLINT (runtime/printf)
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Buffer Overrun Condition : Failed to add Module State description to response");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// ConstructPwrStateResponse
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::ConstructPwrStateResponse(CHAR *f_MessageResponse) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_MessageResponse == NULL) { // LCOV_EXCL_BR_LINE 8: dead code
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (eFrameworkunifiedStatusOK == (l_eStatus = AddStateInformationToResponse(f_MessageResponse))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_eStatus = AddVoltageInformationToResponse(f_MessageResponse))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_eStatus = AddCrankInformationToResponse(f_MessageResponse))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Response Constructed");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/systemservice/power_service/server/src/ss_supervisor_handlers.cpp b/systemservice/power_service/server/src/ss_supervisor_handlers.cpp
new file mode 100755
index 0000000..4bd88d9
--- /dev/null
+++ b/systemservice/power_service/server/src/ss_supervisor_handlers.cpp
@@ -0,0 +1,498 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief Handles SSM message for Wakeup State, Crank State, and Voltage
+/// State.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "ss_power.h"
+#include <stdio.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service.h>
+#include <system_service/ss_power_service_notifications_local.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_services.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <map>
+
+#include "ss_power_powerservicelog.h"
+
+
+EFrameworkunifiedStatus Power::OnPowerRequestMsg(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // ToDo Jay 2012 December 05 Would like to provide better general overall
+ // solution then this local hack - but, for the time being...
+ std::map<EPWR_USER_MODE_TYPE, EPWR_POWER_STATE_TYPE> UserModeToPowerTypeMap;
+ UserModeToPowerTypeMap[epsumON] = epswsPWRON;
+ UserModeToPowerTypeMap[epsumOFF] = epswsPWROFF;
+ // End of ToDo Jay 2012 December 05 Would like to provide better general
+
+ Pwr_ServiceSetInterface tServiceIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ BOOL b_isValid = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "StartupReason is '%s'",
+ GetStr(tServiceIf.data.powerRequestMsg.startupReason).c_str());
+
+ switch (tServiceIf.data.powerRequestMsg.startupReason) {
+ case epswfINVALID:
+ case epswfTESTACC:
+ case epswfUSER_DATA_RESET:
+ // Not startup conditions; don't log
+ b_isValid = TRUE;
+ break;
+
+ case epswfON_KEY:
+ LOG_POWERSERVICELOG_EVT(epswfON_KEY, Ei_StartUp_HK_On, epseisuedHK_ON_Key);
+ b_isValid = TRUE;
+ break;
+
+ case epswfIGN_ACC:
+ LOG_POWERSERVICELOG_EVT(epswfIGN_ACC, Ei_StartUp_Cansignal, epseisuedIGNITION);
+ LOG_POWERSERVICELOG_CNT(epswfIGN_ACC, CT_Startup_CanSignal);
+ b_isValid = TRUE;
+ break;
+
+ case epswfDR_OPEN_CLOSE:
+ LOG_POWERSERVICELOG_EVT(epswfDR_OPEN_CLOSE, Ei_StartUp_Cansignal,
+ epseisuedDOOR_MODULES);
+ LOG_POWERSERVICELOG_CNT(epswfDR_OPEN_CLOSE, CT_Startup_CanSignal);
+ b_isValid = TRUE;
+ break;
+
+ case epswfDX_ACTIVATION:
+ LOG_POWERSERVICELOG_EVT(epswfDX_ACTIVATION, Ei_StartUp_DiagMsg, epseisuedHU);
+ LOG_POWERSERVICELOG_CNT(epswfDX_ACTIVATION, CT_Startup_DiagMsg);
+ b_isValid = TRUE;
+ break;
+
+ case epswfPASS_ACTIVATION:
+ LOG_POWERSERVICELOG_EVT(epswfPASS_ACTIVATION, Ei_StartUp_Cansignal,
+ epseisuedPASS);
+ LOG_POWERSERVICELOG_CNT(epswfPASS_ACTIVATION, CT_Startup_CanSignal);
+ b_isValid = TRUE;
+ break;
+
+ case epswfSPVACTIVATION:
+ LOG_POWERSERVICELOG_EVT(epswfSPVACTIVATION, Ei_StartUp_Cansignal, epseisuedSNA);
+ LOG_POWERSERVICELOG_CNT(epswfSPVACTIVATION, CT_Startup_CanSignal);
+ b_isValid = TRUE;
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ } // End switch(tServiceIf.data.powerRequestMsg.startupReason)
+
+ if (FALSE == b_isValid) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " Error: Unknown 'powerRequestMsg.startupReason' value: " "0x%X / %d",
+ tServiceIf.data.powerRequestMsg.startupReason,
+ tServiceIf.data.powerRequestMsg.startupReason);
+ // LCOV_EXCL_STOP 11:unexpected branch
+ } else {
+ m_WakeUpData.powerupType = UserModeToPowerTypeMap[tServiceIf.data
+ .powerRequestMsg.userMode];
+ m_WakeUpData.up.factor = tServiceIf.data.powerRequestMsg.startupReason;
+ m_WakeUpData.up.level = epswlFULLRUN;
+ m_WakeUpData.up.userModeChangeReason = tServiceIf.data.powerRequestMsg.userModeChangeReason;
+
+ l_eStatus = FrameworkunifiedSendMsg(GetSystemManagerSessionHandle(),
+ SS_SM_POWER_REQUEST_MSG, sizeof(tServiceIf),
+ &tServiceIf);
+ char l_cBuf[200];
+ snprintf(
+ l_cBuf, sizeof(l_cBuf),
+ "FrameworkunifiedSendMsg( SS_SM_POWER_REQUEST_MSG, %s, %s)",
+ GetStr(tServiceIf.data.powerRequestMsg.userMode).c_str(),
+ GetStr(tServiceIf.data.powerRequestMsg.userModeChangeReason).c_str());
+ LOG_STATUS(l_eStatus, l_cBuf);
+ }
+ } // End else a good ReadMsg()
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnpowerRequestMsg( HANDLE h_app )
+
+EFrameworkunifiedStatus Power::OnShutdownRequestMsg(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ Pwr_ServiceSetInterface tServiceIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ BOOL b_isValid = FALSE;
+ EPWR_SHUTDOWN_TRIGGER_TYPE l_shutdownTrigger = tServiceIf.data
+ .shutdownRequestMsg.shutdownTrigger;
+ switch (l_shutdownTrigger) {
+ case epssdmsdtINVALID:
+ case epssdmsdtTESTACC_OFF:
+ // Not shutdown conditions; don't log
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtON_KEY:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtON_KEY, Ei_shutdown_HkOFF, 0x00);
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtIGN_LOCK:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtIGN_LOCK, Ei_shutdown_CANsignal,
+ epseisdcsIGN_STATE);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtIGN_LOCK, CT_Shutdown_CanSignal);
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtPWR_SAVE: // test from peripheralservice/power_supply_manager_shadow
+ LOG_POWERSERVICELOG_CNT(epssdmsdtPWR_SAVE, CT_Shutdown_Timeout); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtTMP_STARTUP:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtTMP_STARTUP, CT_Shutdown_Timeout); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtDIAG_DEACTIVATION:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtDIAG_DEACTIVATION, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtABNORMAL_VOLTAGE:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtABNORMAL_VOLTAGE, Ei_shutdown_Voltage, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ epseisdnvoltUNKNOWN);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtABNORMAL_VOLTAGE, CT_Shutdown_Voltage); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtABNORMAL_TEMP:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtABNORMAL_TEMP, Ei_shutdown_Temperature, 0x00); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ LOG_POWERSERVICELOG_CNT(epssdmsdtABNORMAL_TEMP, CT_Shutdown_Temperature); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtBATTERYCUTOFF:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtBATTERYCUTOFF, Ei_shutdown_Voltage, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ epseisdnvoltBATTERY_CUT_OFF);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtBATTERYCUTOFF, CT_Shutdown_Voltage); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtLIMPHOME:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtLIMPHOME, Ei_shutdown_Voltage, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ epseisdnvoltLIMP_HOME);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtLIMPHOME, CT_Shutdown_Voltage); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtHU_CAN_ERROR:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtHU_CAN_ERROR, Ei_shutdown_NetworkError, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ epseisdneHU_CAN);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtHU_CAN_ERROR, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtBODY_CAN_ERROR:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtBODY_CAN_ERROR, Ei_shutdown_NetworkError, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ epseisdneHMI_CAN);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtBODY_CAN_ERROR, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtTRANSPORT_MODE:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtTRANSPORT_MODE, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtPRODUCTION_MODE:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtPRODUCTION_MODE, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtIGN_OFF:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtIGN_OFF, CT_Shutdown_CanSignal); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtGENERIC_ERROR_RESET:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtGENERIC_ERROR_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtFATAL_ERROR_RESET:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtFATAL_ERROR_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtUSER_DATA_RESET:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtUSER_DATA_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtFACTORY_DATA_RESET:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtFACTORY_DATA_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtFAST_SLEEP_MODE:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtFAST_SLEEP_MODE, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtNORMAL_RESET:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtNORMAL_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtPROGUPDATE_RESET: // this is dead code
+ LOG_POWERSERVICELOG_CNT(epssdmsdtPROGUPDATE_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ } // End switch(l_shutdownTrigger)
+ if (FALSE == b_isValid) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error: Unknown 'shutdownRequestMsg.shutdownTrigger' " "value: 0x%X/%d",
+ l_shutdownTrigger, l_shutdownTrigger);
+ // LCOV_EXCL_STOP 11:unexpected branch
+ } else {
+ l_eStatus = SendShutdownToSystemManager(&tServiceIf);
+ LOG_STATUS(l_eStatus, "SendShutdownToSystemManager()");
+ if (l_eStatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ SetPowerServiceState(SS_PS_SHUTDOWN_INITIATED);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnShutdownRequestMsg( HANDLE h_app )
+
+//*****************************************************************************
+// Shutdown Condition Notification Protocol function
+//
+EFrameworkunifiedStatus Power::OnPublishShutdownPopupRequest(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ Pwr_ServiceSetInterface tServiceIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ BOOL b_isValid = FALSE;
+ EPWR_SHUTDOWN_POPUP_TYPE l_eShutdownPopup = tServiceIf.data.shutdownPopup
+ .shutdownPopupEvent;
+ switch (l_eShutdownPopup) {
+ case epsspPowerSave1:
+ case epsspPowerSave2:
+ case epsspPowerSave3:
+ case epsspPowerSaveClr:
+ case epsspLowVoltage1:
+ case epsspLowVoltage2:
+ case epsspLowVoltage3:
+ case epsspLowVoltageClr:
+ case epsspBattCouplingSW1:
+ case epsspBattCouplingSW2:
+ case epsspBattCouplingSW3:
+ case epsspBattCouplingSWClr:
+ case epsspAbnormalTemp_1st:
+ case epsspAbnormalTemp_Clr:
+ case epsspLimpHome_1st:
+ case epsspLimpHome_2nd:
+ case epsspLimpHome_3rd:
+ case epsspLimpHome_Clr:
+ case epsspProdMd_1st:
+ case epsspProdMd_Clr:
+ case epsspTransMd_1st:
+ case epsspTransMd_Clr:
+ case epsspAllClr:
+ l_eStatus = FrameworkunifiedNPPublishNotification(h_app
+ , szNTFY_ShutdownPopup
+ , &l_eShutdownPopup
+ , sizeof(EPWR_SHUTDOWN_POPUP_TYPE));
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedNPPublishNotification(%s, %d) errored: %d/'%s'",
+ szNTFY_ShutdownPopup, l_eShutdownPopup, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ SS_PWR_LOG_HIST("szNTFY_ShutdownPopup()", m_PubCmdHist, m_PubHistIter,
+ "", l_eStatus);
+
+ b_isValid = TRUE;
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ } // End switch
+
+ if (FALSE == b_isValid) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Unknown 'l_eShutdownPopup' value: 0x%X / %d",
+ l_eShutdownPopup, l_eShutdownPopup);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP 11:unexpected branch
+ } else {
+ EFrameworkunifiedStatus l_responseStatus = l_eStatus; // Save the current status as-is to
+ // send in the message response to the
+ // requester.
+ l_eStatus = FrameworkunifiedSendResponse(h_app,
+ SS_POWER_PUBLISH_SHUTDOWN_CONDITION_RESP,
+ sizeof(EFrameworkunifiedStatus),
+ (PVOID) &l_responseStatus);
+
+ char l_cBuf[200];
+ snprintf(l_cBuf, sizeof(l_cBuf),
+ "FrameworkunifiedSendResponse(%s, %s, status: %d/'%s')", FrameworkunifiedGetMsgSrc(h_app),
+ "SS_POWER_PUBLISH_SHUTDOWN_CONDITION_RESP", l_responseStatus,
+ GetStr(l_responseStatus).c_str());
+ LOG_STATUS(l_eStatus, l_cBuf);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnPublishShutdownPopupRequest( HANDLE h_app )
+//
+// End of Shutdown Condition Notification Protocol function
+//*****************************************************************************
+
+//*****************************************************************************
+// Power Popup Notification Protocol function
+//
+EFrameworkunifiedStatus Power::OnPublishPowerPopupRequest(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ Pwr_ServiceSetInterface tServiceIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ BOOL b_isValid = FALSE;
+ EPWR_POWER_POPUP_TYPE l_ePowerPopup = tServiceIf.data.powerPopup
+ .powerPopupEvent;
+ switch (l_ePowerPopup) {
+ case epssppNormal:
+ case epssppCritical:
+ case epssppAppCritical:
+ case epssppAllClr:
+ l_eStatus = FrameworkunifiedNPPublishNotification(h_app
+ , szNTFY_PowerPopup
+ , &l_ePowerPopup
+ , sizeof(EPWR_POWER_POPUP_TYPE));
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedNPPublishNotification(%s, %d) errored: %d/'%s'",
+ szNTFY_PowerPopup, l_ePowerPopup, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ SS_PWR_LOG_HIST("OnPublishPowerPopupRequest()", m_PubCmdHist,
+ m_PubHistIter, "", l_eStatus);
+
+ b_isValid = TRUE;
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ } // End switch
+
+ if (FALSE == b_isValid) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Unknown 'l_ePowerPopup' value: 0x%X/%d", l_ePowerPopup,
+ l_ePowerPopup);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP 11:unexpected branch
+ } else {
+ EFrameworkunifiedStatus l_responseStatus = l_eStatus; // Save the current status as-is to
+ // send in the message response to the
+ // requester.
+ l_eStatus = FrameworkunifiedSendResponse(h_app, SS_POWER_PUBLISH_POWER_POPUP_RESP,
+ sizeof(EFrameworkunifiedStatus),
+ (PVOID) &l_responseStatus);
+ char l_cBuf[200];
+ snprintf(l_cBuf, sizeof(l_cBuf),
+ "FrameworkunifiedSendResponse(%s, %s, status: %d/'%s')", FrameworkunifiedGetMsgSrc(h_app),
+ "SS_POWER_PUBLISH_POWER_POPUP_RESP", l_responseStatus,
+ GetStr(l_responseStatus).c_str());
+ LOG_STATUS(l_eStatus, l_cBuf);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnPublishPowerPopupRequest( HANDLE h_app )
+//
+// End of Power Popup Notification Protocol function
+//*****************************************************************************
+
+// EOF of /SS_PowerService/src/ss_supervisor_handlers.cpp
diff --git a/systemservice/power_service/server/src/ss_system_handlers.cpp b/systemservice/power_service/server/src/ss_system_handlers.cpp
new file mode 100755
index 0000000..60a9980
--- /dev/null
+++ b/systemservice/power_service/server/src/ss_system_handlers.cpp
@@ -0,0 +1,52 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief Handles Power Service Business logic
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "ss_power.h"
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_power_service.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include "ss_power_powerservicelog.h"
+
+EFrameworkunifiedStatus Power::OnSystemLaunchComplete(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Power Service received SS_POWER_SYSTEM_LAUNCH_COMPLETE from: %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- return EFrameworkunifiedStatus: 0x%X", eStatus);
+ return eStatus;
+}
+
+// test from peripheralservice/power_supply_manager_shadow
+EFrameworkunifiedStatus Power::OnSystemShutdownComplete(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Power Service received SS_POWER_SYSTEM_SHUTDOWN_COMPLETE from: %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- return EFrameworkunifiedStatus: 0x%X", eStatus);
+ return eStatus;
+}
diff --git a/systemservice/resource_manager/LICENSE b/systemservice/resource_manager/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/systemservice/resource_manager/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/systemservice/resource_manager/Makefile.client b/systemservice/resource_manager/Makefile.client
new file mode 100755
index 0000000..2f9b64b
--- /dev/null
+++ b/systemservice/resource_manager/Makefile.client
@@ -0,0 +1,21 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+MODULE_NAME=resmgr
+
+SUBDIRS := client mock
+
+include ../system_service.mk
diff --git a/systemservice/resource_manager/Makefile.server b/systemservice/resource_manager/Makefile.server
new file mode 100755
index 0000000..2257507
--- /dev/null
+++ b/systemservice/resource_manager/Makefile.server
@@ -0,0 +1,23 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+MODULE_NAME=resmgr
+
+SUBDIRS := server
+
+SUBDIRS += drop_caches
+
+include ../system_service.mk
diff --git a/systemservice/resource_manager/client/Makefile b/systemservice/resource_manager/client/Makefile
new file mode 100755
index 0000000..a2bde46
--- /dev/null
+++ b/systemservice/resource_manager/client/Makefile
@@ -0,0 +1,58 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### add source path #############
+VPATH += ./
+VPATH += ./src
+VPATH += ./include
+VPATH += ../server/include
+VPATH += ../server/include/system_service
+
+######### install headers(*.h) #############
+INST_HEADERS += resm.h
+INST_HEADERS += resm_type.h
+INST_HEADERS += resource_manager.h
+
+######### installed program #############
+
+
+######### installed library(*.a) #############
+INST_LIBS =
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libresm
+RPC_API := RESMGR
+
+######### compiled sources #############
+libresm_SRCS += resmgr_api_stub.c
+libresm_SRCS += resmgr_api_lib.c
+
+######### add include path #############
+CPPFLAGS += -I./
+CPPFLAGS += -I./include
+CPPFLAGS += -I../server/include
+
+######## add compile option ########
+
+######### add library path #############
+LDFLAGS += -Wl,--no-as-needed
+
+######### linked library (dynamic) #############
+LDLIBS += -lrpc
+LDLIBS += -Wl,-Bdynamic -lev
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+include ../../system_service.mk
diff --git a/systemservice/resource_manager/client/RESMGR.api b/systemservice/resource_manager/client/RESMGR.api
new file mode 100755
index 0000000..7bd9734
--- /dev/null
+++ b/systemservice/resource_manager/client/RESMGR.api
@@ -0,0 +1,12 @@
+/*
+ * Resource Manager API
+ */
+
+INCLUDE <system_service/resm.h>
+
+RPC_Result RESM_ReqEvent(uint32_t ssnld, const RESM_REQ_EVENT_t* p_reqEvent);
+RPC_Result RESM_GetStatus(uint32_t ssnld, RESM_STATUS_t* p_status);
+RPC_Result RESM_SV_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnld);
+RPC_Result RESM_SV_Close(uint32_t ssnld);
+RPC_Result RESM_SV_ChkSsnId(uint32_t ssnld);
+
diff --git a/systemservice/resource_manager/client/include/resmgr_api_resourcemanagerlog.h b/systemservice/resource_manager/client/include/resmgr_api_resourcemanagerlog.h
new file mode 100755
index 0000000..b9d66fa
--- /dev/null
+++ b/systemservice/resource_manager/client/include/resmgr_api_resourcemanagerlog.h
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _resmgr_api_resourcemanagerlog_h_ // NOLINT
+#define _resmgr_api_resourcemanagerlog_h_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10) // LIB common definition
+#define ZONE_FUNC ZONEMASK(11) // LIB common definition
+#define ZONE_MEM ZONEMASK(12) // LIB common definition
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29) // LIB common definition
+#define ZONE_WARN ZONEMASK(30) // LIB common definition
+#define ZONE_ERR ZONEMASK(31) // LIB common definition
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT, LSHAREDMEM
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_INFO
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+#endif /* !_resmgr_api_resourcemanagerlog_h_ */ // NOLINT
diff --git a/systemservice/resource_manager/client/libresm.ver b/systemservice/resource_manager/client/libresm.ver
new file mode 100755
index 0000000..fc56632
--- /dev/null
+++ b/systemservice/resource_manager/client/libresm.ver
@@ -0,0 +1,28 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libresm version script
+#
+{
+ global:
+ ### .text section ###
+ RESM_*;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/systemservice/resource_manager/client/src/#resmgr_api_lib.c# b/systemservice/resource_manager/client/src/#resmgr_api_lib.c#
new file mode 100755
index 0000000..02e84e4
--- /dev/null
+++ b/systemservice/resource_manager/client/src/#resmgr_api_lib.c#
@@ -0,0 +1,142 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <other_service/rpc.h>
+#include "resm_internal.h"
+#include "resmgr_api.h"
+#include "resmgr_api_resourcemanagerlog.h"
+
+/**********************************************
+ * External variable definitions
+ **********************************************/
+RPC_ID __thread rpcId;
+
+/*******************************************************************************
+ * RPC public API
+ *******************************************************************************/
+/* Connection */
+RESM_ERR_t
+RESM_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnId)
+{
+
+ RESM_ERR_t resmRet;
+ EV_ERR evRet;
+
+ // Argument check
+ if( p_ssnId == NULL ) {
+ return RESM_E_PAR;
+ }
+
+ // RPC resources
+ if( RPC_OK != RPC_START_CLIENT(&rpcId) ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: RPC_START Error"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return RESM_E_NG;
+ }
+
+
+ // Session connection
+ resmRet = RESM_SV_Open(p_prim, p_ssnId);
+ if( resmRet != RESM_E_OK ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: Open Session Error. ret[%d]", resmRet); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return RESM_E_NG;
+ }
+
+ // Create Event Flag
+ evRet = EV_create_flag(Resm_Flag_ID_Base + *p_ssnId);
+ if( evRet != EV_OK ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: create_flag Error. ret[%d]", evRet);
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/* Disconnection */
+RESM_ERR_t
+RESM_Close(uint32_t ssnId)
+{
+
+ RESM_ERR_t resmRet;
+
+ // Disconnect session
+ resmRet = RESM_SV_Close(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return resmRet;
+ }
+
+ // Destroy RPC Resources
+ RPC_end(rpcId);
+
+ return RESM_E_OK;
+}
+
+/* Get event FD */
+RESM_ERR_t
+RESM_GetEventFd(uint32_t ssnId, int32_t* p_fd)
+{
+
+ RESM_ERR_t resmRet;
+
+ // Argument check
+ if( p_fd == NULL ) {
+ return RESM_E_PAR;
+ }
+ // Session ID check
+ resmRet = RESM_SV_ChkSsnId(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return RESM_E_PAR;
+ }
+
+ if( EV_OK != EV_get_flag_fd(Resm_Flag_ID_Base + ssnId, p_fd) ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr GetEventFd Error");
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/* Get event */
+RESM_ERR_t
+RESM_GetEvent(uint32_t ssnId, RESM_EV_t* p_evFlag)
+{
+
+ RESM_ERR_t resmRet;
+ EV_Flag flag;
+
+ // Argument check
+ if( p_evFlag == NULL ) {
+ return RESM_E_PAR;
+ }
+ // Session ID Check
+ resmRet = RESM_SV_ChkSsnId(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return RESM_E_PAR;
+ }
+
+ if( EV_OK != EV_get_flag(Resm_Flag_ID_Base + ssnId, &flag)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr GetEvent(get_flag) Error");
+ return RESM_E_NG;
+ }
+
+ if( flag.bits == 0 ) {
+ // No event
+ return RESM_E_NG;
+ }
+
+ *p_evFlag = flag.bits;
+
+ return RESM_E_OK;
+}
diff --git a/systemservice/resource_manager/client/src/resmgr_api_lib.c b/systemservice/resource_manager/client/src/resmgr_api_lib.c
new file mode 100755
index 0000000..02e84e4
--- /dev/null
+++ b/systemservice/resource_manager/client/src/resmgr_api_lib.c
@@ -0,0 +1,142 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <other_service/rpc.h>
+#include "resm_internal.h"
+#include "resmgr_api.h"
+#include "resmgr_api_resourcemanagerlog.h"
+
+/**********************************************
+ * External variable definitions
+ **********************************************/
+RPC_ID __thread rpcId;
+
+/*******************************************************************************
+ * RPC public API
+ *******************************************************************************/
+/* Connection */
+RESM_ERR_t
+RESM_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnId)
+{
+
+ RESM_ERR_t resmRet;
+ EV_ERR evRet;
+
+ // Argument check
+ if( p_ssnId == NULL ) {
+ return RESM_E_PAR;
+ }
+
+ // RPC resources
+ if( RPC_OK != RPC_START_CLIENT(&rpcId) ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: RPC_START Error"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return RESM_E_NG;
+ }
+
+
+ // Session connection
+ resmRet = RESM_SV_Open(p_prim, p_ssnId);
+ if( resmRet != RESM_E_OK ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: Open Session Error. ret[%d]", resmRet); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return RESM_E_NG;
+ }
+
+ // Create Event Flag
+ evRet = EV_create_flag(Resm_Flag_ID_Base + *p_ssnId);
+ if( evRet != EV_OK ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: create_flag Error. ret[%d]", evRet);
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/* Disconnection */
+RESM_ERR_t
+RESM_Close(uint32_t ssnId)
+{
+
+ RESM_ERR_t resmRet;
+
+ // Disconnect session
+ resmRet = RESM_SV_Close(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return resmRet;
+ }
+
+ // Destroy RPC Resources
+ RPC_end(rpcId);
+
+ return RESM_E_OK;
+}
+
+/* Get event FD */
+RESM_ERR_t
+RESM_GetEventFd(uint32_t ssnId, int32_t* p_fd)
+{
+
+ RESM_ERR_t resmRet;
+
+ // Argument check
+ if( p_fd == NULL ) {
+ return RESM_E_PAR;
+ }
+ // Session ID check
+ resmRet = RESM_SV_ChkSsnId(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return RESM_E_PAR;
+ }
+
+ if( EV_OK != EV_get_flag_fd(Resm_Flag_ID_Base + ssnId, p_fd) ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr GetEventFd Error");
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/* Get event */
+RESM_ERR_t
+RESM_GetEvent(uint32_t ssnId, RESM_EV_t* p_evFlag)
+{
+
+ RESM_ERR_t resmRet;
+ EV_Flag flag;
+
+ // Argument check
+ if( p_evFlag == NULL ) {
+ return RESM_E_PAR;
+ }
+ // Session ID Check
+ resmRet = RESM_SV_ChkSsnId(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return RESM_E_PAR;
+ }
+
+ if( EV_OK != EV_get_flag(Resm_Flag_ID_Base + ssnId, &flag)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr GetEvent(get_flag) Error");
+ return RESM_E_NG;
+ }
+
+ if( flag.bits == 0 ) {
+ // No event
+ return RESM_E_NG;
+ }
+
+ *p_evFlag = flag.bits;
+
+ return RESM_E_OK;
+}
diff --git a/systemservice/resource_manager/drop_caches/Makefile b/systemservice/resource_manager/drop_caches/Makefile
new file mode 100755
index 0000000..03b31cf
--- /dev/null
+++ b/systemservice/resource_manager/drop_caches/Makefile
@@ -0,0 +1,38 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = drop_caches
+
+######### install headers(*.h) #############
+INST_HEADERS =
+
+######### compiled sources #############
+drop_caches_SRCS = ./src/drop_caches.cpp
+
+######### add include path #############
+CPPFLAGS = -I../server/include
+
+######## define options ########
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 \
+ -DFRAMEWORKUNIFIEDLOGAPPZONES=31
+CPPFLAGS += -fno-exceptions
+LDFLAGS += -Wl,--no-as-needed
+######### linked library (dynamic) #############
+LDLIBS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+include ../../system_service.mk
diff --git a/systemservice/resource_manager/drop_caches/src/drop_caches.cpp b/systemservice/resource_manager/drop_caches/src/drop_caches.cpp
new file mode 100755
index 0000000..d192705
--- /dev/null
+++ b/systemservice/resource_manager/drop_caches/src/drop_caches.cpp
@@ -0,0 +1,183 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "ss_resm_resourcemanagerlog.h"
+
+#define DROP_CACHES "/proc/sys/vm/drop_caches"
+
+// FRAMEWORKUNIFIEDLOG
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+// echo 1 > /proc/sys/vm/drop_caches
+#define DROP_CACHES_INTVAL_TIMESEC (1 * 10) // 10 sec
+
+#define MEMINFO_FILE "/proc/meminfo"
+
+/* memFree threshold */
+#define MEMFREE_THRETHOLD (100*1024)
+/* LowFree - CmaFree threshold */
+#define LOWFREE_THRETHOLD (50*1024)
+
+static uint32_t mainFree_kib;
+static uint32_t lowFree_kib;
+static uint32_t cmaFree_kib;
+// meminfo table
+typedef struct {
+ const char* name;
+ uint32_t* value;
+} meminfo_tbl;
+
+static int32_t get_meminfo(void);
+static int32_t comp_meminfo_tbl(const void* data1, const void* data2);
+static bool judge_cachedrop(void);
+
+static void
+exec_drop_caches(void) {
+ int fd;
+
+ fd = open(DROP_CACHES, O_RDWR);
+ if (fd >= 0) {
+ write(fd, (const void *)"1", 1);
+ close(fd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "%s open error (fd:%d, errno:%d)", DROP_CACHES, fd, errno);
+ }
+}
+
+int
+main(int argc, char* argv[]) {
+ const struct timespec drop_caches_intval = {DROP_CACHES_INTVAL_TIMESEC, 0};
+
+ FRAMEWORKUNIFIED_SET_ZONES();
+
+ while (1) {
+ /* Get meminfo */
+ get_meminfo();
+ if (judge_cachedrop()) {
+ exec_drop_caches();
+ }
+ nanosleep(&drop_caches_intval, NULL);
+ }
+
+ return 0;
+}
+
+/* Compare memory information */
+static int32_t
+comp_meminfo_tbl(const void* data1, const void* data2) {
+ return strcmp(((const meminfo_tbl*)data1)->name,
+ ((const meminfo_tbl*)data2)->name);
+}
+
+/* Get memory information */
+static int32_t
+get_meminfo(void) {
+ int32_t meminfo_fd = -1;
+ char srch_name[16];
+ char buf[2048];
+ meminfo_tbl target = {srch_name, NULL};
+ meminfo_tbl* found;
+ char* head;
+ char* tail;
+ int32_t read_byte;
+ /* Strings must be in ascending order when adding entries to this table (for bsearch) */
+ static const meminfo_tbl mem_table[] = {
+ {"CmaFree", &cmaFree_kib},
+ {"LowFree", &lowFree_kib},
+ {"MemFree", &mainFree_kib},
+ };
+ const int32_t mem_table_count = sizeof(mem_table)/sizeof(meminfo_tbl);
+
+ if (meminfo_fd == -1) {
+ meminfo_fd = open(MEMINFO_FILE, O_RDONLY);
+ if (meminfo_fd == -1) {
+ fflush(NULL);
+ return -1;
+ }
+ }
+
+ lseek(meminfo_fd, 0L, SEEK_SET);
+ read_byte = read (meminfo_fd, buf, sizeof(buf) - 1);
+ if (read_byte < 0) {
+ fflush(NULL);
+ close(meminfo_fd);
+ return -1;
+ }
+ buf[read_byte] = '\0';
+
+ head = buf;
+ while (1) {
+ tail = strchr(head, ':');
+ if (!tail) {
+ break;
+ }
+ *tail = '\0';
+ if (strlen (head) >= sizeof(srch_name)) {
+ head = tail + 1;
+ } else {
+ strcpy(srch_name, head); // NOLINT
+ found = reinterpret_cast<meminfo_tbl *>(bsearch(&target, mem_table, mem_table_count,
+ sizeof(meminfo_tbl), comp_meminfo_tbl));
+ head = tail + 1;
+ if (found) {
+ *(found->value) = strtoul(head, &tail, 10);
+ }
+ }
+ tail = strchr(head, '\n');
+ if (!tail)
+ break;
+ head = tail + 1;
+ }
+ close(meminfo_fd);
+
+ return 0;
+}
+
+static bool
+judge_cachedrop(void) {
+ if (mainFree_kib < MEMFREE_THRETHOLD) {
+ return true;
+ }
+
+ if ((lowFree_kib - cmaFree_kib) < LOWFREE_THRETHOLD) {
+ return true;
+ }
+
+ return false;
+}
diff --git a/systemservice/resource_manager/server/Makefile b/systemservice/resource_manager/server/Makefile
new file mode 100755
index 0000000..cae9191
--- /dev/null
+++ b/systemservice/resource_manager/server/Makefile
@@ -0,0 +1,55 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = resm
+
+######### compiled sources #############
+resm_SRCS += resm.cpp
+resm_SRCS += proc_watch.cpp
+resm_SRCS += resourcemanager_application.cpp
+resm_SRCS += cpuload_custom.cpp
+resm_SRCS += resmgr_srvr_stub.cpp
+
+######### add source path #############
+VPATH += ./src
+VPATH += ./include/$(COMPONENT_NAME)
+VPATH += ../client
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I../client
+
+######## add compile option ########
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGAPPZONES=104,64,31,30,29,28
+CPPFLAGS += -DTARGET_SOC_$(TARGET_SOC)
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+CPPFLAGS += -fno-exceptions
+
+######### linked library (dynamic) #############
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lsoc_temperature_hal
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lrpc
+
+LDLIBS += -Wl,-Bdynamic -lev
+
+include ../../system_service.mk
diff --git a/systemservice/resource_manager/server/include/proc_watch.h b/systemservice/resource_manager/server/include/proc_watch.h
new file mode 100755
index 0000000..8a98afd
--- /dev/null
+++ b/systemservice/resource_manager/server/include/proc_watch.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_PROC_WATCH_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_PROC_WATCH_H_
+
+/**********************************************
+ * Prototype declaration
+ **********************************************/
+void *PRCW_main(void *p);
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_PROC_WATCH_H_
diff --git a/systemservice/resource_manager/server/include/resm_cfg.h b/systemservice/resource_manager/server/include/resm_cfg.h
new file mode 100755
index 0000000..e48cdce
--- /dev/null
+++ b/systemservice/resource_manager/server/include/resm_cfg.h
@@ -0,0 +1,132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+File name : resm_cfg.h
+******************************************************************************/
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_RESM_CFG_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_RESM_CFG_H_
+
+/******************************************************************************
+Configuration
+******************************************************************************/
+/*************************************************
+ * Delay time from process start to monitoring start (sec)
+ * def:60 max:- min:0
+ * (0: stop timer)
+ *************************************************/
+#define MONITORING_START_DELAT_TIME (60)
+
+
+/*************************************************
+ * Delay time until authentication service monitoring start (sec)
+ * def:30 max:- min:0
+ * (0: stop timer)
+ * MONITORING_START_DELAT_TIME > set to this value
+ *************************************************/
+#define EUA_MONITORING_START_DELAT_TIME (30)
+
+
+/*************************************************
+ * Delay from drop_caches process startup (sec)
+ * def:20 max:- min:0
+ * (0: stop timer)
+ *************************************************/
+#define DROP_CACHES_START_DELAT_TIME (20)
+
+
+///*************************************************
+// * CPU load threshold (%)
+// * def:70 max:100 min:0
+// *************************************************/
+//#define CPU_LOAD_THRESHOLD (70)
+/*************************************************
+ * CPU load threshold(%:XX.X)
+ * threshold:875 max:1000 min:0
+ *************************************************/
+#define CPU_LOAD_THRESHOLD (875)
+
+
+/*************************************************
+ * Number of CPU overload processes to be logged (rows)
+ * def:5 max:- min:0
+ *************************************************/
+#define CPU_HIGH_LOAD_P_LOG_NUM (5)
+
+
+///*************************************************
+// * Log output frequency during CPU overload continuation (sec)
+// * def:30 max:- min:0
+// *
+// * Specify as a multiple of the polling interval(WTC_CPU_INTERVAL) for CPU load monitoring
+// *************************************************/
+//#define CPU_HIGH_LOAD_LOG_FREQ (30)
+/*************************************************
+ * Log output frequency during CPU overload continuation (sec)
+ * def:60 max:- min:0
+ *
+ * Specify as a multiple of the polling interval(WTC_CPU_INTERVAL) for CPU load monitoring
+ *************************************************/
+#define CPU_HIGH_LOAD_LOG_FREQ (60)
+
+
+/*************************************************
+ * perf Profiling/Measurement Processes
+ * def:1 max:- min:1
+ *************************************************/
+#define PERF_MAX_PROCS (1)
+
+/*************************************************
+ * perf profiling/Output rows (functions)
+ * def:5 max:- min:1
+ *************************************************/
+#define PERF_MAX_LINES (5)
+
+/*************************************************
+ * perf pofiling/perf-record running time (sec)
+ * def:1 max:- min:1
+ *************************************************/
+#define PERF_RECORD_SPAN (1)
+
+#define TOP_TIMEOUT (60)
+
+#define RESET_SEC (60)
+
+
+#define WTC_CPU_INTERVAL (6)
+
+#define TASK_STAT_THRESHOLD (70)
+#define FIFO_TIMER_LIMIT (6)
+#define TSS_TIMER_LIMIT (60)
+
+#define CPU_TASK_INIT (1)
+#define CPU_TASK_SHOW_BF (2)
+#define CPU_TASK_SHOW_AF (3)
+#define FIFO_TASK_SHOW (4)
+#define TSS_TASK_SHOW (5)
+#define CPU_FIFO_TASK_GET_ID (6)
+#define CPU_TSS_TASK_GET_ID (7)
+#define CPU_FIFO_TASK_GET_OCCUPANCY (8)
+#define CPU_TSS_TASK_GET_OCCUPANCY (9)
+
+#define STATUS_IDOL (1)
+#define STATUS_CHECK_CPU (2)
+#define STATUS_WATCH_PROCESS (3)
+
+#define TASK_STAT_RANK_NUM (5)
+
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_RESM_CFG_H_
diff --git a/systemservice/resource_manager/server/include/resm_internal.h b/systemservice/resource_manager/server/include/resm_internal.h
new file mode 100755
index 0000000..090814e
--- /dev/null
+++ b/systemservice/resource_manager/server/include/resm_internal.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_RESM_INTERNAL_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_RESM_INTERNAL_H_
+
+#include <agldd/moduleid.h>
+#include <agldd/ev_common.h>
+
+#include <other_service/ev_lib.h>
+#include "system_service/resm_type.h"
+
+#define Resm_Flag_ID_Base EV_Flag_ID_Base(RESMGR_MID)
+
+/*******************************************************************************
+ * User defined
+ *******************************************************************************/
+#define MY_MAX(a, b) ((a) > (b) ? (a) : (b))
+
+/***********************************************************
+ * Internal API definitions
+ ***********************************************************/
+RESM_ERR_t RESM_SV_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnld);
+RESM_ERR_t RESM_SV_Close(uint32_t ssnld);
+RESM_ERR_t RESM_SV_ChkSsnId(uint32_t ssnld);
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_RESM_INTERNAL_H_
diff --git a/systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h b/systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h
new file mode 100755
index 0000000..94c16b3
--- /dev/null
+++ b/systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h
@@ -0,0 +1,82 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SS_RESM_RESOURCEMANAGERLOG_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SS_RESM_RESOURCEMANAGERLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10) // LIB common definition
+#define ZONE_FUNC ZONEMASK(11) // LIB common definition
+#define ZONE_MEM ZONEMASK(12) // LIB common definition
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_RESM_DEBUG ZONEMASK(28) // DEBUG
+#define ZONE_INFO ZONEMASK(29) // LIB common definition
+#define ZONE_WARN ZONEMASK(30) // LIB common definition
+#define ZONE_ERR ZONEMASK(31) // LIB common definition
+
+#define ZONE_SOC_TEMP ZONEMASK(104)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 "ResmDebug"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT,LSHAREDMEM
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_INFO
+// #define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN,ZONE_ERR,ZONE_INFO,ZONE_RESM_DEBUG //DEBUG
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SS_RESM_RESOURCEMANAGERLOG_H_
diff --git a/systemservice/resource_manager/server/include/system_service/resm.h b/systemservice/resource_manager/server/include/system_service/resm.h
new file mode 100755
index 0000000..d3b8850
--- /dev/null
+++ b/systemservice/resource_manager/server/include/system_service/resm.h
@@ -0,0 +1,325 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file resm.h
+ * @brief \~english This file contains declaration of APIs for resm library
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup resource_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_H_
+
+#include "system_service/resm_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_Open
+/// \~english @par Summary
+/// Opens the session with resource manager.
+/// \~english @param [in] p_prim
+/// RESM_RSV_t* - Unused, NULL
+/// \~english @param [out] p_ssnId
+/// uint32_t* - Pointer to session ID
+/// \~english @par
+/// RESM_RSV_t Variables
+/// \~english @code
+/// #define RESM_RSV_t int32_t
+/// #define RESM_RSV_NULL (0x00) // NULL
+/// @endcode
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - Availability of ResourceManager must be TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_ssnId is NULL. [RESM_E_PAR]
+/// - The global variable for getting RPC_ID of program (rpcId) is NULL. [RESM_E_NG]
+/// - The area for RPC ID(rpcId) is not gotten. [RESM_E_NG]
+/// - The number of the thread able to register in a process exceeds limit. [RESM_E_NG]
+/// - It failed to get the area for thread information. [RESM_E_NG]
+/// - It failed to get the area for ID information storage. [RESM_E_NG]
+/// - It failed to generate the datagram socket for API request receiving. [RESM_E_NG]
+/// - It failed to bind a socket. [RESM_E_NG]
+/// - It failed to get a socket name. [RESM_E_NG]
+/// - The number of sessions exceeds the maximum value. [RESM_E_NG]
+/// - There is no space in the thread information area for event registration. [RESM_E_NG]
+/// - It failed to get the thread information area for event registration. [RESM_E_NG]
+/// - The file descriptor for getting an event is created. [RESM_E_NG]
+/// - The generated session ID exists (EEXIST error at ioctl). [RESM_E_NG]
+/// - Any error occurred during registering an event flag (EEXIST error at ioctl). [RESM_E_NG]
+/// - Any error occurred during processing poling setting (error at ioctl). [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Opens a session. \n
+/// An application can use another API by using the gotten ssnID.
+/// \~english @see RESM_Close
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnld);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_Close
+/// \~english @par Summary
+/// Closes the session with resource manager.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Closes a session.
+/// \~english @see RESM_Open
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_Close(uint32_t ssnld);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_ReqEvent
+/// \~english @par Summary
+/// Requests to issue an event.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [in] p_reqEvent
+/// RESM_REQ_EVENT_t* - Pointer to event
+/// \~english @par
+/// RESM_REQ_EVENT_t Structure
+/// \~english @code
+/// typedef struct {
+/// RESM_EV_t reqEvent; /* Event flag necessary to report */
+/// struct {
+/// uint32_t restMemThresh; /* Threshold of the remaining capacity of system memory */
+/// } prm;
+/// }RESM_REQ_EVENT_t;
+/// @endcode
+/// \~english @par
+/// RESM_EV_t Variables
+/// \~english @code
+/// #define RESM_EV_t uint32_t
+/// #define RESM_EV_NOP (0x00)
+/// #define RESM_EV_MEM (0x01)
+/// #define RESM_EV_NAND_STATUS (0x02)
+/// @endcode
+/// \~english @par
+/// - RESM_EV_NOP : No event notification
+/// - RESM_EV_MEM : Event notification for memory
+/// - RESM_EV_NAND_STATUS : Eventnotification for NAND state
+/// \~english @par
+/// Notes
+/// - restMemThresh is valid only when RESM_EV_MEM is set to reqEvent. \n
+/// ResourceManager issues RESM_EV_MEM event at the timing
+/// when the remaining capacity of system memory fell below the value (unit is BYTE)
+/// which an application specifies.
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_reqEvent is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Requests to issue an event.
+/// This API is called from the RPC library.
+/// \~english @see RESM_GetEvent
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_ReqEvent(uint32_t ssnld, const RESM_REQ_EVENT_t* p_reqEvent);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_GetEventFd
+/// \~english @par Summary
+/// Gets FD of the event to receive from resource manager.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [out] p_fd
+/// int* - Pointer to file descriptor
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_fd is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// - ssnId rewrites bit for an event flag decision by invalid values. [RESM_E_NG]
+/// - The file descriptor corresponding to ssnId is not found. [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Gets FD of the event to receive from resource manager. \n
+/// An application can do simultaneous wait of other events with the event of ResourceManager
+/// by oversighting the gotten FD by select,poll etc.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_GetEventFd(uint32_t ssnld, int* p_fd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_GetEvent
+/// \~english @par Summary
+/// Gets the event from resource manager.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [out] p_evFlag
+/// RESM_EV_t* - Pointer to event
+/// \~english @par
+/// RESM_EV_t Variables
+/// \~english @code
+/// #define RESM_EV_t uint32_t
+/// #define RESM_EV_NOP (0x00)
+/// #define RESM_EV_MEM (0x01)
+/// #define RESM_EV_NAND_STATUS (0x02)
+/// @endcode
+/// \~english @par
+/// - RESM_EV_NOP : No event notification
+/// - RESM_EV_MEM : Event notification for memory
+/// - RESM_EV_NAND_STATUS : Event notification for NAND state
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_evFlag is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// - ssnId rewrites bit for an event flag decision by invalid values. [RESM_E_NG]
+/// - The file descriptor corresponding to ssnId is not found. [RESM_E_NG]
+/// - The flag of ssnId is not registered. (The returned value of ioctl is EOENT.) [RESM_E_NG]
+/// - Any interruption occurred during getting an event. (The returned value of ioctl is EINTR.) [RESM_E_NG]
+/// - Any error occurred during getting an event. (The returned value of ioctl is the error value
+/// except for EOENT and EINTR.) [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// When an event flag is not set, this is blocked. \n
+/// If an event flag is set, this stores event contents to p_evFlag and this ends. \n
+/// If this ends, it clears all of event flags.
+/// \~english @see RESM_ReqEvent
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_GetEvent(uint32_t ssnld, RESM_EV_t* p_evFlag);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_GetStatus
+/// \~english @par Summary
+/// Gets system state.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [out] p_status
+/// RESM_STATUS_t* - Pointer to system state
+/// \~english @par
+/// RESM_STATUS_t Structure
+/// \~english @code
+/// typedef struct {
+/// uint32_t restMemSize; /* Remaining memory length (KB) */
+/// RESM_NAND_WRITE_STATUS_t nandWriteStatus; /* Access permission / Prohibition state to NAND flash */
+/// RESM_INET_STATUS_t inetStatus; /* Network IF statistical information after start */
+/// } RESM_STATUS_t;
+/// @endcode
+/// \~english @par
+/// enum RESM_NAND_WRITE_STATUS_t Variables
+/// - RESM_NAND_WRITE_ENABLE : NAND access permission
+/// - RESM_NAND_WRITE_DISABLE : NAND access prohibition
+/// \~english @par
+/// Notes
+/// - When system records in NAND flash and it influences the lifetime of a device,
+/// STATUS(nandWriteStatus) becomes RESM_NAND_WRITE_DISABLE. It is not in the state where WRITE fails. \n
+/// \~english @par
+/// RESM_INET_STATUS_t Structure
+/// \~english @code
+/// typedef struct {
+/// uint32_t ifNum; /* Valid array at the number of interface and ifInfo */
+/// struct {
+/// char name[64]; /* Interface name */
+/// uint64_t rxSize; /* Receiving data length (KiB) */
+/// uint64_t txSize; /* Transmission data length (KiB) */
+/// uint8_t hwaddr[HWADDR_LEN]; /* Hardware address (MAC address) */
+/// } ifInfo[RESM_INET_IF_MAX];
+/// }RESM_INET_STATUS_t;
+/// @endcode
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_evFlag is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// - It failed to open the device file for network. [RESM_E_NG]
+/// - The number of the gotten network IF is 0. [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Gets system state.
+/// This API is called from the RPC library.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_GetStatus(uint32_t ssnld, RESM_STATUS_t* p_status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_H_
+
+/** @}*/ // end of ResourceManager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/resource_manager/server/include/system_service/resm_type.h b/systemservice/resource_manager/server/include/system_service/resm_type.h
new file mode 100755
index 0000000..1adbf37
--- /dev/null
+++ b/systemservice/resource_manager/server/include/system_service/resm_type.h
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file resm_type.h
+ * @brief \~english This file contains declaration of common enum and structures for resm library
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup resource_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_TYPE_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_TYPE_H_
+
+#include <agl_thread.h>
+
+#define NTFY_ResourceMgr_Availability MN_SS_RESOURCEMGR"/Availability"
+
+#define RESM_ERR_t int32_t
+#define RESM_E_OK (0)
+#define RESM_E_PAR (-1)
+#define RESM_E_NG (-2)
+
+// Event flags (bit pattern)
+#define RESM_EV_t uint32_t
+#define RESM_EV_NOP (0x00)
+#define RESM_EV_MEM (0x01)
+#define RESM_EV_NAND_STATUS (0x02)
+
+#define RESM_RSV_t int32_t
+
+typedef enum {
+ RESM_NAND_WRITE_ENABLE = 0,
+ RESM_NAND_WRITE_DISABLE = -1
+} RESM_NAND_WRITE_STATUS_t;
+
+typedef struct {
+ RESM_EV_t reqEvent;
+ struct {
+ uint32_t restMemThresh;
+ } prm;
+} RESM_REQ_EVENT_t;
+
+#define RESM_INET_IF_MAX 5 /* tentative */
+#define HWADDR_LEN (6)
+typedef struct {
+ uint32_t ifNum;
+ struct {
+ char name[64];
+ uint64_t rxSize;
+ uint64_t txSize;
+ uint8_t hwaddr[HWADDR_LEN];
+ } ifInfo[RESM_INET_IF_MAX];
+} RESM_INET_STATUS_t;
+
+typedef struct {
+ uint32_t restMemSize;
+ RESM_NAND_WRITE_STATUS_t nandWriteStatus;
+ RESM_INET_STATUS_t inetStatus;
+} RESM_STATUS_t;
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_TYPE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/resource_manager/server/include/system_service/resource_manager.h b/systemservice/resource_manager/server/include/system_service/resource_manager.h
new file mode 100755
index 0000000..48c7a4c
--- /dev/null
+++ b/systemservice/resource_manager/server/include/system_service/resource_manager.h
@@ -0,0 +1,43 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file resource_manager.h
+ * @brief \~english include all resm_library head files
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup resource_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESOURCE_MANAGER_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESOURCE_MANAGER_H_
+
+#include "system_service/resm.h"
+#include "system_service/resm_type.h"
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESOURCE_MANAGER_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/resource_manager/server/src/cpuload_custom.cpp b/systemservice/resource_manager/server/src/cpuload_custom.cpp
new file mode 100755
index 0000000..c6a8e75
--- /dev/null
+++ b/systemservice/resource_manager/server/src/cpuload_custom.cpp
@@ -0,0 +1,512 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <string.h>
+#include <errno.h>
+#include <sched.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "ss_resm_resourcemanagerlog.h"
+
+#include "resm_cfg.h"
+
+typedef struct _task_stat {
+ struct _task_stat *next;
+ char path[64];
+ pid_t pid_nr_ns;
+ char tcomm[64];
+ char state;
+ pid_t ppid;
+ pid_t pgid;
+ unsigned long utime; // NOLINT
+ unsigned long stime; // NOLINT
+ int priority;
+ int nice;
+ int task_cpu;
+ unsigned int task_rt_priority;
+ unsigned int task_policy;
+} TASK_STAT;
+
+
+typedef struct _task_rank
+{
+ pid_t pid_nr_ns;
+ char state;
+ unsigned long taskOccupancy;
+ unsigned long utime;
+ unsigned long stime;
+ int priority;
+ unsigned int task_policy;
+ int task_cpu;
+ char tcomm[64];
+} TASK_RANK;
+
+
+static TASK_STAT *g_task_stat = NULL;
+
+static int32_t g_fifo_task_pid = -1;
+static int32_t g_tss_task_pid = -1;
+static unsigned long g_fifo_task_occ = -1;
+static unsigned long g_tss_task_occ = -1;
+static int32_t g_fifo_show_timer = 0;
+static int32_t g_tss_show_timer = 0;
+static unsigned int g_startTime = 0;
+static char g_fifo_path[64];
+static char g_tss_path[64];
+static unsigned long g_fifo_utime;
+static unsigned long g_fifo_stime;
+static unsigned long g_tss_utime;
+static unsigned long g_tss_stime;
+
+
+static void cleanup_task_stat(void) {
+ TASK_STAT *p, *q;
+
+ p = g_task_stat;
+ while (p) {
+ q = p->next;
+ free(p);
+ p = q;
+ }
+ g_task_stat = NULL;
+}
+
+static int add_task_stat(TASK_STAT *tstat) {
+ TASK_STAT *p;
+
+ p = reinterpret_cast<TASK_STAT *>(malloc(sizeof(TASK_STAT)));
+ if (p == NULL) { // LCOV_EXCL_BR_LINE 5: malloc error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: malloc error case
+ }
+ memcpy(p, tstat, sizeof(TASK_STAT));
+ p->next = 0;
+
+ if (g_task_stat) {
+ p->next = g_task_stat;
+ }
+ g_task_stat = p;
+
+ return 0;
+}
+
+// No error : > 0
+static int get_task_stat(const char *path, TASK_STAT *tstat) {
+ pid_t sid;
+ int tty_nr, tty_pgrp;
+ unsigned long task_flags; // NOLINT
+ unsigned long min_flt, cmin_flt, maj_flt, cmaj_flt; // NOLINT
+ signed long cutime, cstime; // NOLINT
+ int num_threads, zero1;
+ unsigned long long start_time; // NOLINT
+ unsigned long vsize, mm_rss, rsslim, start_code, end_code, start_stack; // NOLINT
+ unsigned long esp, eip, task_pending_signal_sig, task_blocked_sig; // NOLINT
+ unsigned long sigign_sig, sigcatch_sig, wchan, zero2, zero3; // NOLINT
+ int exit_signal;
+ unsigned long long delayacct_blkio_ticks; // NOLINT
+ unsigned long guest_time; // NOLINT
+ signed long cguest_time; // NOLINT
+
+ int fd;
+ int ret = -1;
+#define READ_MAX_SIZE 4096
+ char buf[READ_MAX_SIZE];
+
+ fd = open(path, O_RDONLY);
+ if (fd != -1) {
+ if (read(fd, buf, sizeof(buf)) != -1) { // LCOV_EXCL_BR_LINE 5: read's error case
+ ret =
+ sscanf(
+ buf,
+ "%d %32s %c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %d %d %d %d %llu %lu %lu"
+ " %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld",
+ &(tstat->pid_nr_ns), tstat->tcomm, &(tstat->state),
+ &(tstat->ppid), &(tstat->pgid), &sid, &tty_nr, &tty_pgrp,
+ &task_flags, &min_flt, &cmin_flt, &maj_flt, &cmaj_flt,
+ &(tstat->utime), &(tstat->stime), &cutime, &cstime,
+ &(tstat->priority), &(tstat->nice), &num_threads, &zero1,
+ &start_time, &vsize, &mm_rss, &rsslim, &start_code, &end_code,
+ &start_stack, &esp, &eip, &task_pending_signal_sig,
+ &task_blocked_sig, &sigign_sig, &sigcatch_sig, &wchan, &zero2,
+ &zero3, &exit_signal, &(tstat->task_cpu),
+ &(tstat->task_rt_priority), &(tstat->task_policy),
+ &delayacct_blkio_ticks, &guest_time, &cguest_time);
+ }
+ close(fd);
+ }
+ return ret;
+}
+
+static void get_current_task_stat(void) {
+ TASK_STAT tstat;
+ DIR *dirp;
+ struct dirent entry;
+ struct dirent *result;
+ char path[64];
+
+ struct timespec tp;
+
+ dirp = opendir("/proc");
+ if (dirp == NULL) { // LCOV_EXCL_BR_LINE 5: opendir error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return; // LCOV_EXCL_LINE 5: opendir error case
+ }
+
+ if (clock_gettime (CLOCK_MONOTONIC, &tp) == 0) {
+ g_startTime = ((tp.tv_sec * 1000) + (tp.tv_nsec / 1000000)); // Unit is msec
+ } else {
+ g_startTime = 0;
+ }
+
+ while ((readdir_r(dirp, &entry, &result) == 0) && (result != NULL)) {
+ if ((entry.d_name[0] >= '1') && (entry.d_name[0] <= '9')) {
+ DIR *dirp2;
+ struct dirent entry2;
+ struct dirent *result2;
+
+ sprintf(path, "/proc/%s/task", entry.d_name); // NOLINT
+ dirp2 = opendir(path);
+ if (dirp2 == NULL) { // LCOV_EXCL_BR_LINE 5: opendir error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue; // LCOV_EXCL_LINE 5: opendir error case
+ }
+
+ while ((readdir_r(dirp2, &entry2, &result2) == 0) && (result2 != NULL)) {
+ if ((entry2.d_name[0] >= '1') && (entry2.d_name[0] <= '9')) {
+ char path2[64];
+ int ret;
+ struct timespec req = { 0, 1000000 }; // 1msec
+
+ sprintf(path2, "%s/%s/stat", path, entry2.d_name); // NOLINT
+ ret = get_task_stat(path2, &tstat);
+
+// if ((ret > 0) && (tstat.task_policy == SCHED_FIFO)) {
+ if (ret > 0) { // LCOV_EXCL_BR_LINE 200: ret must be bigger than 0
+
+ strcpy(tstat.path, path2); // NOLINT
+ add_task_stat(&tstat);
+ }
+ nanosleep(&req, NULL);
+ }
+ }
+ closedir(dirp2);
+ }
+ }
+ closedir(dirp);
+}
+
+static void show_cpuload(void) {
+ int ret;
+ TASK_STAT tstat;
+ TASK_STAT *p = g_task_stat;
+
+ TASK_RANK ttaskRankData[TASK_STAT_RANK_NUM+1];
+ TASK_RANK t_eva_taskRank;
+ int setRankDatanum = 0;
+ int checkCounter;
+
+ unsigned long dtime; // NOLINT
+ unsigned long dtime_urank;
+ unsigned long dtime_drank;
+ struct timespec tp;
+ unsigned int endTime = 0;
+
+// if (p) {
+// FRAMEWORKUNIFIEDLOG(
+// ZONE_INFO,
+// __FUNCTION__,
+// "[CpuHighLoad]Please check User backtrace of following processes in kernel.log");
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+// "[CpuHighLoad] PID ST PRI POLICY cpuX %%CPU (ut:st) comm");
+// }
+ if (clock_gettime (CLOCK_MONOTONIC, &tp) == 0) {
+ endTime = ((tp.tv_sec * 1000) + (tp.tv_nsec / 1000000)); // Unit is msec
+ } else {
+ endTime = (WTC_CPU_INTERVAL * 1000) + g_startTime;
+ }
+ if (endTime - g_startTime <= 0) { // LCOV_EXCL_BR_LINE 200: (endTime - g_startTime) must be bigger than 0
+ // LCOV_EXCL_START 200: (endTime - g_startTime) must be bigger than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG (ZONE_WARN, __FUNCTION__, "[CpuHighLoad] Timer abnormality.");
+ endTime = g_startTime + 1;
+ // LCOV_EXCL_STOP
+ }
+
+ while (p) {
+ ret = get_task_stat(p->path, &tstat);
+ if (ret >= 0) {
+
+#if 0
+ dtime = (tstat.utime + tstat.stime) - (p->utime + p->stime);
+ if (dtime > 0) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "[CpuHighLoad]%5d %c %3d %5s cpu%d %4lu (%lu:%lu) %s",
+ p->pid_nr_ns,
+ p->state,
+ p->priority,
+ p->task_policy == SCHED_FIFO ? "FIFO" :
+ p->task_policy == SCHED_RR ? "RR" : "OTHER",
+ p->task_cpu, dtime, tstat.utime - p->utime, tstat.stime - p->stime,
+ p->tcomm);
+ if ((dtime >= 70) // %%CPU 70% over only
+ && (getpid() != p->pid_nr_ns) // except current process
+ && (strcmp(p->tcomm, "(NS_BackupMgr)"))) { // except "BackupMgr"
+// print_backtrace_pid (p->pid_nr_ns); // backtrace in kernel.log
+ }
+ }
+ }
+ p = p->next;
+ }
+#endif
+ dtime = (((tstat.utime + tstat.stime) - (p->utime + p->stime)) * 1000) / (endTime - g_startTime);
+ if (((tstat.utime + tstat.stime) - (p->utime + p->stime)) > 0) {
+ if (setRankDatanum <= TASK_STAT_RANK_NUM) {
+ ttaskRankData[setRankDatanum].pid_nr_ns = p->pid_nr_ns;
+ ttaskRankData[setRankDatanum].state = p->state;
+ ttaskRankData[setRankDatanum].priority = p->priority;
+ ttaskRankData[setRankDatanum].task_policy = p->task_policy;
+ ttaskRankData[setRankDatanum].task_cpu = p->task_cpu;
+ ttaskRankData[setRankDatanum].taskOccupancy = dtime;
+ ttaskRankData[setRankDatanum].utime = tstat.utime - p->utime;
+ ttaskRankData[setRankDatanum].stime = tstat.stime - p->stime;
+ strcpy(ttaskRankData[setRankDatanum].tcomm, p->tcomm);
+ setRankDatanum++;
+ } else {
+ ttaskRankData[TASK_STAT_RANK_NUM].pid_nr_ns = p->pid_nr_ns;
+ ttaskRankData[TASK_STAT_RANK_NUM].state = p->state;
+ ttaskRankData[TASK_STAT_RANK_NUM].priority = p->priority;
+ ttaskRankData[TASK_STAT_RANK_NUM].task_policy = p->task_policy;
+ ttaskRankData[TASK_STAT_RANK_NUM].task_cpu = p->task_cpu;
+ ttaskRankData[TASK_STAT_RANK_NUM].taskOccupancy = dtime;
+ ttaskRankData[TASK_STAT_RANK_NUM].utime = tstat.utime - p->utime;
+ ttaskRankData[TASK_STAT_RANK_NUM].stime = tstat.stime - p->stime;
+ strcpy(ttaskRankData[TASK_STAT_RANK_NUM].tcomm, p->tcomm);
+ }
+ for (checkCounter = (setRankDatanum - 1); checkCounter > 0; checkCounter--) {
+ dtime_urank = ttaskRankData[checkCounter - 1].utime + ttaskRankData[checkCounter - 1].stime;
+ dtime_drank = ttaskRankData[checkCounter].utime + ttaskRankData[checkCounter].stime;
+ if (dtime_urank < dtime_drank) {
+ t_eva_taskRank.pid_nr_ns = ttaskRankData[checkCounter].pid_nr_ns;
+ t_eva_taskRank.state = ttaskRankData[checkCounter].state;
+ t_eva_taskRank.priority = ttaskRankData[checkCounter].priority;
+ t_eva_taskRank.task_policy = ttaskRankData[checkCounter].task_policy;
+ t_eva_taskRank.task_cpu = ttaskRankData[checkCounter].task_cpu;
+ t_eva_taskRank.taskOccupancy = ttaskRankData[checkCounter].taskOccupancy;
+ t_eva_taskRank.utime = ttaskRankData[checkCounter].utime;
+ t_eva_taskRank.stime = ttaskRankData[checkCounter].stime;
+ strcpy(t_eva_taskRank.tcomm, ttaskRankData[checkCounter].tcomm);
+
+ ttaskRankData[checkCounter].pid_nr_ns = ttaskRankData[checkCounter - 1].pid_nr_ns;
+ ttaskRankData[checkCounter].state = ttaskRankData[checkCounter - 1].state;
+ ttaskRankData[checkCounter].priority = ttaskRankData[checkCounter - 1].priority;
+ ttaskRankData[checkCounter].task_policy = ttaskRankData[checkCounter - 1].task_policy;
+ ttaskRankData[checkCounter].task_cpu = ttaskRankData[checkCounter - 1].task_cpu;
+ ttaskRankData[checkCounter].taskOccupancy = ttaskRankData[checkCounter - 1].taskOccupancy;
+ ttaskRankData[checkCounter].utime = ttaskRankData[checkCounter - 1].utime;
+ ttaskRankData[checkCounter].stime = ttaskRankData[checkCounter - 1].stime;
+ strcpy(ttaskRankData[checkCounter].tcomm, ttaskRankData[checkCounter - 1].tcomm);
+
+ ttaskRankData[checkCounter - 1].pid_nr_ns = t_eva_taskRank.pid_nr_ns;
+ ttaskRankData[checkCounter - 1].state = t_eva_taskRank.state;
+ ttaskRankData[checkCounter - 1].priority = t_eva_taskRank.priority;
+ ttaskRankData[checkCounter - 1].task_policy = t_eva_taskRank.task_policy;
+ ttaskRankData[checkCounter - 1].task_cpu = t_eva_taskRank.task_cpu;
+ ttaskRankData[checkCounter - 1].taskOccupancy = t_eva_taskRank.taskOccupancy;
+ ttaskRankData[checkCounter - 1].utime = t_eva_taskRank.utime;
+ ttaskRankData[checkCounter - 1].stime = t_eva_taskRank.stime;
+ strcpy(ttaskRankData[checkCounter - 1].tcomm, t_eva_taskRank.tcomm);
+ } else {
+ break;
+ }
+ }
+ if ((dtime >= TASK_STAT_THRESHOLD) && // %%CPU over only
+ (getpid() != p->pid_nr_ns) && // except current process
+ (strcmp (p->tcomm, "(NS_BackupMgr)"))) { // except "BackupMgr"
+ if (p->task_policy == SCHED_FIFO) {
+ if ((g_fifo_task_occ < dtime) && (g_fifo_show_timer == 0)) { // first time only
+ g_fifo_task_pid = p->pid_nr_ns;
+ g_fifo_task_occ = dtime;
+ g_fifo_utime = tstat.utime;
+ g_fifo_stime = tstat.stime;
+ strcpy(g_fifo_path,p->path);
+ } else if (g_fifo_task_pid == p->pid_nr_ns) {
+ g_fifo_task_occ = dtime;
+ g_fifo_utime = tstat.utime;
+ g_fifo_stime = tstat.stime;
+ strcpy(g_fifo_path,p->path);
+ }
+ } else {
+ if ((g_tss_task_occ < dtime) && (g_tss_show_timer == 0)) { // first time only
+ g_tss_task_pid = p->pid_nr_ns;
+ g_tss_task_occ = dtime;
+ g_tss_utime = tstat.utime;
+ g_tss_stime = tstat.stime;
+ strcpy(g_tss_path,p->path);
+ } else if (g_tss_task_pid == p->pid_nr_ns) {
+ g_tss_task_occ = dtime;
+ g_tss_utime = tstat.utime;
+ g_tss_stime = tstat.stime;
+ strcpy(g_tss_path,p->path);
+ }
+ }
+ }
+ }
+ }
+ p = p->next;
+ }
+
+ if (setRankDatanum != 0) {
+ FRAMEWORKUNIFIEDLOG (ZONE_WARN, __FUNCTION__, "[CpuHighLoad] PID ST PRI POLICY cpuX %%CPU (%%ut:%%st) comm");
+ for (checkCounter = 0;
+ checkCounter < (setRankDatanum < TASK_STAT_RANK_NUM ? setRankDatanum : TASK_STAT_RANK_NUM); checkCounter++) {
+ FRAMEWORKUNIFIEDLOG (ZONE_WARN, __FUNCTION__, "[CpuHighLoad]%5d %c %3d %5s cpu%d %4lu (%2lu.%03lu:%2lu.%03lu) %s",
+ ttaskRankData[checkCounter].pid_nr_ns,
+ ttaskRankData[checkCounter].state,
+ ttaskRankData[checkCounter].priority,
+ ttaskRankData[checkCounter].task_policy == SCHED_FIFO ? "FIFO"
+ : ttaskRankData[checkCounter].task_policy == SCHED_RR ? "RR" : "TSS",
+ ttaskRankData[checkCounter].task_cpu,
+ ttaskRankData[checkCounter].taskOccupancy,
+ ttaskRankData[checkCounter].utime * 100 / ((endTime - g_startTime)/10),
+ ttaskRankData[checkCounter].utime * 100 % ((endTime - g_startTime)/10),
+ ttaskRankData[checkCounter].stime * 100 / ((endTime - g_startTime)/10),
+ ttaskRankData[checkCounter].stime * 100 % ((endTime - g_startTime)/10),
+ ttaskRankData[checkCounter].tcomm);
+ }
+ FRAMEWORKUNIFIEDLOG (ZONE_WARN, __FUNCTION__, "[CpuHighLoad] -------------------------------------------------");
+ }
+
+}
+
+
+static void
+show_cpuload_onetask(int loadType) {
+ int ret;
+ TASK_STAT tstat;
+ unsigned long dtime;
+ struct timespec tp;
+ unsigned int endTime = 0;
+ char loadPath[64];
+ unsigned long beforeUtime;
+ unsigned long beforeStime;
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) {
+ endTime = ((tp.tv_sec * 1000) + (tp.tv_nsec / 1000000)); // Unit is msec
+ } else {
+ endTime = (WTC_CPU_INTERVAL * 1000) + g_startTime;
+ }
+ if (endTime - g_startTime <= 0) { // LCOV_EXCL_BR_LINE 200: (endTime - g_startTime) must be bigger than 0
+ // LCOV_EXCL_START 200: (endTime - g_startTime) must be bigger than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG (ZONE_WARN, __FUNCTION__, "[CpuHighLoad] Timer abnormality.");
+ endTime = g_startTime + 1;
+ // LCOV_EXCL_STOP
+ }
+ if (loadType == FIFO_TASK_SHOW) { // LCOV_EXCL_BR_LINE 200: loadType can't be FIFO_TASK_SHOW
+ // LCOV_EXCL_START 200: loadType can't be FIFO_TASK_SHOW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ strcpy(loadPath,g_fifo_path);
+ beforeUtime = g_fifo_utime;
+ beforeStime = g_fifo_stime;
+ // LCOV_EXCL_STOP
+ } else {
+ strcpy(loadPath,g_tss_path);
+ beforeUtime = g_tss_utime;
+ beforeStime = g_tss_stime;
+ }
+ if (strlen(loadPath) > 0) {
+ ret = get_task_stat(loadPath, &tstat);
+ if (ret >= 0) {
+ dtime = (((tstat.utime + tstat.stime) - (beforeUtime + beforeStime)) * 1000) / (endTime - g_startTime);
+ if (tstat.task_policy == SCHED_FIFO) {
+ g_fifo_task_occ = dtime;
+ g_fifo_utime = tstat.utime;
+ g_fifo_stime = tstat.stime;
+ } else {
+ g_tss_task_occ = dtime;
+ g_tss_utime = tstat.utime;
+ g_tss_stime = tstat.stime;
+ }
+ }
+ }
+}
+
+
+
+//void logging_cpuload_custom(void) {
+// struct timespec req = { 1, 0 }; // 1sec
+//
+// cleanup_task_stat();
+// get_current_task_stat();
+//
+// nanosleep(&req, NULL);
+//
+// show_cpuload();
+//}
+unsigned long
+logging_cpuload_custom(int32_t tmode) {
+ int32_t res = 0;
+ if (tmode == CPU_TASK_INIT) {
+ g_fifo_task_pid = -1;
+ g_tss_task_pid = -1;
+ g_fifo_task_occ = 0;
+ g_tss_task_occ = 0;
+ g_fifo_utime = 0;
+ g_fifo_stime = 0;
+ g_tss_utime = 0;
+ g_tss_stime = 0;
+ memset(g_fifo_path, 0x00, sizeof(g_fifo_path));
+ memset(g_tss_path, 0x00, sizeof(g_tss_path));
+ cleanup_task_stat();
+ get_current_task_stat();
+ } else if (tmode == CPU_TASK_SHOW_BF) {
+ cleanup_task_stat();
+ get_current_task_stat();
+ } else if (tmode == CPU_TASK_SHOW_AF) {
+ show_cpuload();
+ } else if (tmode == FIFO_TASK_SHOW) { // LCOV_EXCL_BR_LINE 200: tmode can't be FIFO_TASK_SHOW
+ // LCOV_EXCL_START 200: tmode can't be FIFO_TASK_SHOW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ show_cpuload_onetask(FIFO_TASK_SHOW);
+ // LCOV_EXCL_STOP
+ } else if (tmode == TSS_TASK_SHOW) {
+ show_cpuload_onetask(TSS_TASK_SHOW);
+ } else if (tmode == CPU_FIFO_TASK_GET_ID) {
+ res = g_fifo_task_pid;
+ g_fifo_show_timer = 0;
+ } else if (tmode == CPU_TSS_TASK_GET_ID) {
+ res = g_tss_task_pid;
+ g_tss_show_timer = 0;
+ } else if (tmode == CPU_FIFO_TASK_GET_OCCUPANCY) {
+ g_fifo_show_timer = g_fifo_show_timer + WTC_CPU_INTERVAL;
+ res = g_fifo_task_occ;
+ g_fifo_task_occ = 0;
+ } else if (tmode == CPU_TSS_TASK_GET_OCCUPANCY) { // LCOV_EXCL_BR_LINE 200: tmode can't be other value
+ g_tss_show_timer = g_tss_show_timer + WTC_CPU_INTERVAL;
+ res = g_tss_task_occ;
+ g_tss_task_occ = 0;
+ }
+ return res;
+}
+
diff --git a/systemservice/resource_manager/server/src/proc_watch.cpp b/systemservice/resource_manager/server/src/proc_watch.cpp
new file mode 100755
index 0000000..c432af1
--- /dev/null
+++ b/systemservice/resource_manager/server/src/proc_watch.cpp
@@ -0,0 +1,285 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/timerfd.h>
+#include <sys/vfs.h> /* or <sys/statfs.h> */
+#include <dirent.h>
+#include <stdlib.h>
+
+#include <soc_temperature_hal.h>
+
+#include "ss_resm_resourcemanagerlog.h"
+#include "proc_watch.h"
+#include "resm_cfg.h"
+#include "resm_internal.h"
+
+#define WTC_TMPFS_INTERVAL (5)
+#define WTC_MEM_INTERVAL (5)
+#define DEBUG_INFO_OUTPUT_FREQ (1)
+
+extern int isNfs;
+extern void watchMem(void);
+extern void outputResouceInfo(void);
+extern EFrameworkunifiedStatus resourcemanagerlog_flag_check(UI_8 *mode);
+
+#define _SOC_TEMP_MONITOR_
+
+#if defined(_SOC_TEMP_MONITOR_)
+
+/*********************************************************************************
+ * Soc Temperature
+ register THSSR : T = CTEMP[5-0] x 5 - 65 [Celsius]
+ *********************************************************************************/
+#define SOC_TEMP_WATCH_INTVAL_TIMESEC (3 * 60) // 3 minutes
+// #define SOC_TEMP_WATCH_INTVAL_TIMESEC (1 * 5) // for debug
+#define THSSR_TEMP_MASK 0x0000003F
+#define TEMP_120 (120)
+
+static float last_temp;
+
+static void soc_temp_init(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_SOC_TEMP, __FUNCTION__, "start");
+ last_temp = 0.0f;
+}
+
+static void soc_temp(void) {
+ float temp = 0.0f;
+ EFrameworkunifiedStatus e_status = GetSoCTemperature(&temp);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_SOC_TEMP, __FUNCTION__,
+ "THSSR:GetSoCTemperature e_status(%d)", e_status);
+ return;
+ }
+
+ if (TEMP_120 <= temp) {
+ // FRAMEWORKUNIFIEDLOG
+ FRAMEWORKUNIFIEDLOG(ZONE_SOC_TEMP, __FUNCTION__, "%f", temp); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ // FRAMEWORKUNIFIEDLOG
+ if (TEMP_120 <= last_temp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_SOC_TEMP, __FUNCTION__, "%f", temp); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ }
+ last_temp = temp;
+}
+#endif // defined ( _SOC_TEMP_MONITOR_ )
+
+//
+// Monitor /tmp
+//
+#define TMP_USED_SIZE (100*1024) // 100MB
+#define TMPFS_PATH "/tmp"
+static int watch_tmpfs_enable = 1;
+
+static void printdir(const char* path) {
+ DIR *dirp;
+ struct dirent entry, *next;
+ char buf[512];
+
+ dirp = opendir(path);
+ if (dirp == NULL) { // LCOV_EXCL_BR_LINE 5: opendir's error case.
+ // LCOV_EXCL_START 5: opendir's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "opendir(%s) error.(%d)\n", path, errno);
+ return;
+ // LCOV_EXCL_STOP 5: opendir's error case.
+ }
+ while ((readdir_r(dirp, &entry, &next) == 0) && next != NULL) {
+ if (((strlen(entry.d_name) == 1) && (strcmp(entry.d_name, ".") == 0))
+ || ((strlen(entry.d_name) == 2) && (strcmp(entry.d_name, "..") == 0))) {
+ continue;
+ }
+ if ((strlen(path) + strlen(entry.d_name) + 2) <= sizeof(buf)) {/* 2: '/','\0' */
+ struct stat stat_buf;
+
+ strcpy(buf, path); // NOLINT
+ strcat(buf, "/"); // NOLINT
+ strcat(buf, entry.d_name); // NOLINT
+ if (stat(buf, &stat_buf) == -1) { // LCOV_EXCL_BR_LINE 5: stat error case
+ // LCOV_EXCL_START 5: stat error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s stat error! (%d)\n", buf, errno);
+ // LCOV_EXCL_STOP 5: stat's error case.
+ } else if (S_ISDIR(stat_buf.st_mode)) {
+ printdir(buf);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s %ld bytes", buf, stat_buf.st_size);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "path(%s) name(%s) length over!\n", path,
+ entry.d_name);
+ }
+ }
+ closedir(dirp);
+
+ return;
+}
+
+static void watchtmpfs(void) {
+ int ret;
+ struct statfs buf;
+ long used; // NOLINT
+
+ if (!watch_tmpfs_enable) {
+ return;
+ }
+ ret = statfs(TMPFS_PATH, &buf);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: statfs error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return; // LCOV_EXCL_LINE 5: statfs error case
+ }
+ used = (buf.f_blocks - buf.f_bavail) * buf.f_bsize / 1024; // KB
+ if (used > TMP_USED_SIZE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s Used %ld KB > %d KB",
+ TMPFS_PATH,
+ used, TMP_USED_SIZE);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "----- print %s start -----", TMPFS_PATH);
+ printdir(TMPFS_PATH);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "----- print %s end -----", TMPFS_PATH);
+ watch_tmpfs_enable = 0;
+ }
+}
+
+/*********************************************************************************
+ * proc_watch thread main
+ *********************************************************************************/
+void *
+PRCW_main(void *p) {
+ fd_set fds;
+ int32_t maxFd = 0;
+ int32_t timerFd;
+ struct itimerspec tm;
+ int32_t sec = 0;
+ EFrameworkunifiedStatus flagRet;
+ uint64_t exp;
+ int ret;
+ UI_8 mode;
+#if defined(_SOC_TEMP_MONITOR_)
+ int32_t timerFd2;
+ struct itimerspec tm2;
+#endif // defined(_SOC_TEMP_MONITOR_)
+
+ /* Memory monitoring and display debug information */
+ timerFd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
+ if (timerFd == -1) { // LCOV_EXCL_BR_LINE 5: timerfd_create error case
+ // LCOV_EXCL_START 5: timerfd_create error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create timerFd Failed. errno[%d]", errno);
+ // LCOV_EXCL_STOP 5: timerfd_create error case
+ } else {
+ tm.it_value.tv_sec = MONITORING_START_DELAT_TIME;
+ tm.it_value.tv_nsec = 0;
+ tm.it_interval.tv_sec = 1;
+ tm.it_interval.tv_nsec = 0;
+ if (timerfd_settime(timerFd, 0, &tm, NULL) == -1) { // LCOV_EXCL_BR_LINE 5: timerfd_create error case
+ // LCOV_EXCL_START 5: timerfd_settime error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Set timerFd Failed. errno[%d]", errno);
+ // LCOV_EXCL_STOP 5: timerfd_settime error case
+ }
+ }
+
+#if defined(_SOC_TEMP_MONITOR_)
+ /* Soc temperature monitoring */
+ timerFd2 = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
+ if (timerFd2 == -1) { // LCOV_EXCL_BR_LINE 5: timerfd_create error case
+ // LCOV_EXCL_START 5: timerfd_create error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create timerFd2 Failed. errno[%d]", errno);
+ // LCOV_EXCL_STOP 5: timerfd_create error case
+ } else {
+ tm2.it_value.tv_sec = 1;
+ tm2.it_value.tv_nsec = 0;
+ tm2.it_interval.tv_sec = SOC_TEMP_WATCH_INTVAL_TIMESEC;
+ tm2.it_interval.tv_nsec = 0;
+ if (timerfd_settime(timerFd2, 0, &tm2, NULL) == -1) { // LCOV_EXCL_BR_LINE 5: timerfd_settime error case
+ // LCOV_EXCL_START 5: timerfd_settime error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Set timerFd2 Failed. errno[%d]", errno);
+ // LCOV_EXCL_STOP 5: timerfd_settime error case
+ }
+ soc_temp_init();
+ }
+#endif // defined(_SOC_TEMP_MONITOR_)
+
+ while (1) {
+ FD_ZERO(&fds);
+ if (timerFd != -1) { // LCOV_EXCL_BR_LINE 5: timerfd_create's error case
+ FD_SET(timerFd, &fds);
+ maxFd = MY_MAX(maxFd, timerFd);
+ }
+#if defined(_SOC_TEMP_MONITOR_)
+ if (timerFd2 != -1) { // LCOV_EXCL_BR_LINE 5: timerfd_create's error case
+ FD_SET(timerFd2, &fds);
+ maxFd = MY_MAX(maxFd, timerFd2);
+ }
+#endif // defined(_SOC_TEMP_MONITOR_)
+
+ ret = select(maxFd + 1, &fds, NULL, NULL, NULL);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: select error case
+ // LCOV_EXCL_START 5: select error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Handle Error");
+ exit(EXIT_FAILURE);
+ }
+ continue;
+ // LCOV_EXCL_STOP 5: select error case
+ }
+
+ if ((timerFd != -1) && FD_ISSET(timerFd, &fds)) {
+ read(timerFd, &exp, sizeof(uint64_t));
+ /* Memory monitoring */
+ if ((sec % WTC_MEM_INTERVAL) == 0) {
+ watchMem();
+ }
+ /* tmpfs monitoring */
+ if (!isNfs && ((sec % WTC_TMPFS_INTERVAL) == 0)) {
+ watchtmpfs();
+ }
+ /* Display debug information */
+ if ((sec % DEBUG_INFO_OUTPUT_FREQ) == 0) {
+ flagRet = resourcemanagerlog_flag_check(&mode);
+ if ((flagRet == eFrameworkunifiedStatusOK) && (mode == FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG)) {
+ outputResouceInfo();
+ }
+ }
+ if (sec >= RESET_SEC) {
+ sec = 0;
+ }
+ sec++;
+ }
+#if defined(_SOC_TEMP_MONITOR_)
+ if ((timerFd2 != -1) && FD_ISSET(timerFd2, &fds)) {
+ read(timerFd2, &exp, sizeof(uint64_t));
+ soc_temp();
+ }
+#endif // defined(_SOC_TEMP_MONITOR_)
+ }
+ return p;
+}
diff --git a/systemservice/resource_manager/server/src/resm.cpp b/systemservice/resource_manager/server/src/resm.cpp
new file mode 100755
index 0000000..41caa19
--- /dev/null
+++ b/systemservice/resource_manager/server/src/resm.cpp
@@ -0,0 +1,2667 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <ctype.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdint.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/timerfd.h>
+#include <sys/wait.h>
+#include <sched.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <signal.h>
+
+// NSFW
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_services.h>
+#include <native_service/frameworkunified_application.h>
+#include <system_service/ss_system_if.h>
+#include <system_service/ss_version.h>
+#include <native_service/cl_process.h>
+#include <system_service/ss_system_process.h>
+#include <other_service/rpc.h>
+#include "resmgr_srvr.h"
+#include "resm_internal.h"
+#include "resmgr_api.h"
+#include "ss_resm_resourcemanagerlog.h"
+#include "resm_cfg.h"
+#include "proc_watch.h"
+
+
+// NSFW
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+/**********************************************
+ * Constant definitions
+ **********************************************/
+#define Resm_Flag_ID_Base EV_Flag_ID_Base(RESMGR_MID)
+#define RESM_SUB_PRIORITY (0)
+
+// #define WTC_CPU_INTERVAL (3)
+
+#define CPULOAD_INVALID (-2)
+#define CPULOAD_READY (-1)
+#define CPULOG_TIMER_CLEAR (1)
+#define CPULOG_LOGGING (0)
+#define CPULOG_NO_LOGGING (-1)
+
+#define PROCNET_DEV_FILE "/proc/net/dev"
+#define MEMINFO_FILE "/proc/meminfo"
+#define PROC_STAT_FILE "/proc/stat"
+
+#define BYTE_TO_KIBIBYTE (1024)
+#define KIBIBYTE_TO_BYTE (1024)
+#define PERF_PNAME_MAX 128 // Max path name of process
+#define PERF_PATH "/usr/bin/perf"
+#define PERF_FILE "/tmp/perf"
+#define PERF_DUMP "/tmp/perf_dump"
+#define PERF_REPORT_DELAY 1 // 1 sec
+#define PERF_REPORT_RETRY 3 // retry 3 times
+#define CPULOAD_NICEVAL 10 // value of nice() to lower priority
+
+#define DEBUG_INFO_DIRPATH "/tmp/diag_analysis"
+#define DEBUG_INFO_FPATH DEBUG_INFO_DIRPATH"/dispinfo_resource.dbg"
+#define DEBUG_INFO_TMPPATH DEBUG_INFO_DIRPATH"/dispinfo_resource.tmp"
+#define DEBUG_INFO_MEM_LETTERS (25)
+#define DEBUG_INFO_CPU_TOP_LINES (10)
+#define DEBUG_INFO_CMA_MIN (160000) // in KB
+#define DEBUG_INFO_CMA_LETTERS (20)
+#define DEBUG_INFO_DSP_PG_PATH "/usr/agl/bin/bs_analysis_dispinfo_debug"
+
+#define DROP_CACHES_PG_PATH "/usr/agl/bin/drop_caches"
+
+#define READLINE_MAX_SIZE 512
+#define READ_MAX_SIZE 4096
+#define LF (0x0A)
+
+/**********************************************
+ * Structure definitions
+ **********************************************/
+// App session information
+typedef struct {
+ BOOL useFlag;
+ RESM_REQ_EVENT_t reqEv; // event request
+} SSN_INFO_t;
+
+// CPU usage information
+typedef struct {
+ char cpuname[8];
+ int32_t user;
+ int32_t nice;
+ int32_t system;
+ int32_t idle;
+ int32_t iowait;
+ int32_t irq;
+ int32_t softirq;
+ int32_t steal;
+ int32_t guest;
+ int32_t guest_nice;
+} CPU_INFO_t;
+
+//Context
+typedef struct {
+ char procName[128];
+ HANDLE hApp; // DispatcherHandle
+ int32_t nsFd; // For receiving from the NSFW
+
+ // Session information
+ SSN_INFO_t ssnInfo[EV_MAX_IDS_IN_THREAD];
+
+ // Memory information
+ uint32_t restMem; // Remaining memory information
+ BOOL restMemFlag;
+
+ // CMA information
+ uint32_t restCma;
+ BOOL restCmaFlag;
+
+
+ // CPU load information
+// int32_t cpuloadRate;
+} SVC_COMMON_t;
+
+// meminfo table
+typedef struct {
+ const char* name;
+ uint32_t* value;
+} meminfo_tbl;
+
+/**********************************************
+ * External variable definitions
+ **********************************************/
+// FRAMEWORKUNIFIEDLOG
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+ FRAMEWORKUNIFIEDLOGOPTIONS, {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31
+ }, FRAMEWORKUNIFIEDLOGZONES
+};
+
+int isNfs; // NFS env : 1
+
+static SVC_COMMON_t g_resmgr; // NOLINT (readability/nolint)
+static int32_t g_sock = -1;
+static uint32_t inactFile_kib;
+static uint32_t mainFree_kib;
+static uint32_t memTotal_kib;
+static uint32_t cmaFree_kib;
+static uint32_t cmaTotal_kib;
+static uint32_t minRestMem; // Minimum memory available
+static uint32_t minRestCma; // Minimum CMA available
+static int32_t g_cpuloadRate1000;
+static int g_cpu_num;
+static CPU_INFO_t *g_cpuload_pre;
+static CPU_INFO_t *g_cpuload;
+
+static int32_t g_fifo_status = STATUS_IDOL;
+static int32_t g_tss_status = STATUS_IDOL;
+static int32_t g_fifo_timer = 0;
+static int32_t g_tss_timer = 0;
+
+
+/**********************************************
+ * Local function definition
+ **********************************************/
+static void ctxCreate(SVC_COMMON_t* p_ctx, int32_t argc, char* argv[]);
+
+// Session related
+static int32_t get_new_id(uint32_t* ssnId);
+
+// Memory monitoring
+void watchMem(void);
+static int32_t comp_meminfo_tbl(const void* a, const void* b);
+static int32_t get_meminfo(void);
+
+// Network monitoring
+static int32_t getInetStatus(RESM_INET_STATUS_t* p_iStatus);
+static char* get_aliasName(char* name, char* line);
+static int32_t get_hwaddr(char* name, char* hwaddr);
+
+// CPU monitoring
+
+static void watchCPUStatus(void);
+static void watchCPU(void);
+static int32_t get_cpuload(CPU_INFO_t* p_cpu);
+static int32_t calc_cpuloadRate(void);
+static int32_t calc_cpuloadRate_each(int num);
+
+// static int32_t chk_logging(int32_t cpuload, int32_t timer);
+// static void logging_cpuload(void);
+
+static void trim_end(char* buf);
+
+// static void escape_percent(char* in, char* out);
+static void init_cpuload(void);
+
+// extern void logging_cpuload_custom(void);
+static void exec_perf(int32_t t_pid);
+extern unsigned long logging_cpuload_custom(int32_t tmode);
+
+
+// Debug information output
+void outputResouceInfo(void);
+static int write_meminfo_work(FILE *wfp);
+static int write_cpuinfo_work(FILE *wfp);
+static int write_cmainfo_work(FILE *wfp);
+static int write_resourcemanagerloginfo_work(void);
+
+/*******************************************************************************
+ * RPC public API
+ *******************************************************************************/
+/* Event issuance request */
+RESM_ERR_t RESM_ReqEvent(uint32_t ssnId, const RESM_REQ_EVENT_t* p_reqEvent) {
+ // Argument check
+ if (p_reqEvent == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr ReqEvent Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (ssnId >= EV_MAX_IDS_IN_THREAD) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr ReqEvent Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (!g_resmgr.ssnInfo[ssnId].useFlag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr ReqEvent Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ // Event type check
+ if (p_reqEvent->reqEvent == RESM_EV_MEM) {
+ // Record event issuance request
+ memcpy(&g_resmgr.ssnInfo[ssnId].reqEv, p_reqEvent,
+ sizeof(RESM_REQ_EVENT_t));
+ }
+
+ return RESM_E_OK;
+}
+
+/* Get system status */
+RESM_ERR_t RESM_GetStatus(uint32_t ssnId, RESM_STATUS_t* p_status) {
+ int32_t ret;
+
+ // Argument check
+ if (p_status == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr GetStatus Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (ssnId >= EV_MAX_IDS_IN_THREAD) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr GetStatus Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (!g_resmgr.ssnInfo[ssnId].useFlag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr GetStatus Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (!g_resmgr.restMemFlag) {
+ // No remaining memory information
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr GetStatus get restmem Error"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ return RESM_E_NG;
+ }
+ p_status->restMemSize = g_resmgr.restMem;
+ p_status->nandWriteStatus = RESM_NAND_WRITE_ENABLE; //[]Always possible
+
+ ret = getInetStatus(&p_status->inetStatus);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr GetStatus getInetStatus Error");
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/*******************************************************************************
+ * Internal API
+ *******************************************************************************/
+/* Session connection */
+RESM_ERR_t RESM_SV_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnId) {
+ int32_t ret;
+
+ ret = get_new_id(p_ssnId);
+ if (ret != 0) {
+ return RESM_E_NG;
+ }
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ResMgr Open Session:ID=[%d]", *p_ssnId);
+
+ return RESM_E_OK;
+}
+
+/* Session disconnection */
+RESM_ERR_t RESM_SV_Close(uint32_t ssnId) {
+ // Argument check
+ if (ssnId >= EV_MAX_IDS_IN_THREAD) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr Close Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (!g_resmgr.ssnInfo[ssnId].useFlag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr Close Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ // Turn off used flag
+ g_resmgr.ssnInfo[ssnId].useFlag = FALSE;
+
+ // Clear event request
+ memset(&g_resmgr.ssnInfo[ssnId].reqEv, 0, sizeof(RESM_REQ_EVENT_t));
+
+ return RESM_E_OK;
+}
+
+/* Session ID check */
+RESM_ERR_t RESM_SV_ChkSsnId(uint32_t ssnId) {
+ if (ssnId >= EV_MAX_IDS_IN_THREAD) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr ssnId[%d] over MAX", ssnId);
+ return RESM_E_NG;
+ }
+
+ if (!g_resmgr.ssnInfo[ssnId].useFlag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr ssnId[%d] is unidentified",
+ ssnId);
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/**********************************************
+ * Initialization function
+ **********************************************/
+/* Context Initialization */
+static void ctxCreate(SVC_COMMON_t* p_ctx, int32_t argc, char* argv[]) {
+ EFrameworkunifiedStatus resourcemanagerRet;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cbFuncs);
+ FRAMEWORKUNIFIED_SET_ZONES();
+
+ memset(p_ctx, 0, sizeof(SVC_COMMON_t));
+ strcpy(p_ctx->procName, SS_RESOURCE_MANAGER); // NOLINT
+
+ // Create a Dispatcher
+ resourcemanagerRet = FrameworkunifiedCreateDispatcherWithoutLoop(p_ctx->procName, p_ctx->hApp, argc,
+ argv, &cbFuncs, TRUE);
+ if (resourcemanagerRet != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create Dispatcher Failed. ret[%d]", resourcemanagerRet);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ resourcemanagerRet = FrameworkunifiedGetDispatcherFD(p_ctx->hApp, &p_ctx->nsFd);
+ if (resourcemanagerRet != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Get Dispatcher FD Failed. ret[%d]", resourcemanagerRet);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ // Initialize session
+ memset(p_ctx->ssnInfo, 0, sizeof(p_ctx->ssnInfo));
+
+
+// // Initialize CPU Information
+// g_resmgr.cpuloadRate = CPULOAD_INVALID;
+
+
+ return;
+}
+
+/**********************************************
+ * Get FRAMEWORKUNIFIEDLOG BasePF Flag
+ **********************************************/
+static EFrameworkunifiedStatus resourcemanagerlog_output_debug_info;
+#define RESOURCEMANAGERLOG_BASEPF_FLAG_ID (11)
+
+EFrameworkunifiedStatus resourcemanagerlog_flag_check(UI_8 *mode) {
+ if (resourcemanagerlog_output_debug_info != eFrameworkunifiedStatusOK)
+ return eFrameworkunifiedStatusFail;
+
+ return NsLogGetFrameworkunifiedLogFlag(RESOURCEMANAGERLOG_BASEPF_FLAG_ID, mode);
+}
+
+/* drop_caches Start update Task */
+static void start_drop_caches(void) {
+ pid_t pid = fork();
+ if (pid == 0) {
+ if (setuid(0) == -1) { // LCOV_EXCL_BR_LINE 5: setuid's error case
+ // LCOV_EXCL_START 5: setuid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to setuid(0)-1, errno=%d", errno);
+ // LCOV_EXCL_STOP
+ } else {
+ struct sched_param param;
+ // Exec drop_caches
+ param.sched_priority = 0;
+ if (sched_setscheduler(getpid(), SCHED_OTHER, &param) < 0) { // LCOV_EXCL_BR_LINE 5: sched_setscheduler's error case
+ // LCOV_EXCL_START 5: sched_setscheduler's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to sched_setscheduler errno=%d",
+ errno);
+ // LCOV_EXCL_STOP
+ } else {
+ execl(DROP_CACHES_PG_PATH, basename(DROP_CACHES_PG_PATH), NULL);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to execl %s errno=%d",
+ DROP_CACHES_PG_PATH,
+ errno);
+ }
+ }
+ exit(1);
+ }
+ if (pid == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork=-1, errno=%d", errno);
+ // LCOV_EXCL_STOP
+ }
+}
+
+/**********************************************
+ * Main Function
+ **********************************************/
+int32_t main(int32_t argc, char* argv[]) {
+ int32_t mainRet = -1;
+ int32_t rpcFd;
+ int32_t timerFd;
+ struct itimerspec tm;
+ int32_t timerFd2;
+ struct itimerspec tm2;
+ uint64_t exp;
+ int32_t maxFd = 0;
+ fd_set fds;
+ struct sched_param prcwParam;
+ pthread_t ptPRCW;
+ int32_t sec = 0;
+ int32_t ret;
+
+ int32_t cpu_ret;
+ bool fork_dsp_task = false;
+ CL_ProcessAttr_t attr;
+ const char *prName;
+ const char *args[iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS];
+ UI_8 mode;
+ EFrameworkunifiedStatus eRet;
+ struct stat statbuf;
+
+ RPC_ID rpcId = RESMGR_RPC_ID;
+ SVC_COMMON_t* p_ctx = &g_resmgr;
+ EFrameworkunifiedStatus resourcemanagerRet = eFrameworkunifiedStatusOK;
+
+ {
+ const char* nfsenv = getenv("AGL_NFS");
+ isNfs = (nfsenv && strcmp(nfsenv, "y") == 0) ? 1 : 0;
+ }
+
+ /* Clear context */
+ ctxCreate(p_ctx, argc, argv);
+
+ /* Start debug information display task */
+ {
+ char *tmp;
+ tmp = getenv("AGL_DEVDIAG_FLAG");
+ if ((tmp == NULL) || strcmp(tmp, "ON")) { // != "ON"
+ resourcemanagerlog_output_debug_info = eFrameworkunifiedStatusFail;
+ } else {
+ resourcemanagerlog_output_debug_info = eFrameworkunifiedStatusOK;
+ }
+ }
+ eRet = resourcemanagerlog_flag_check(&mode);
+ if (eRet == eFrameworkunifiedStatusOK && mode == FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG) {
+ fork_dsp_task = true;
+ }
+ if (fork_dsp_task) {
+ // LCOV_EXCL_START 8: there is no bs_analysis_dispinfo_debug
+ if (0 == stat(DEBUG_INFO_DSP_PG_PATH, &statbuf)) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (0 != CL_ProcessCreateAttrInit(&attr)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_ProcessCreateAttrInit Error"); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ prName = basename(DEBUG_INFO_DSP_PG_PATH);
+ if (0 != CL_ProcessCreateAttrSetName(&attr, prName)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Set Name Error"); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ args[0] = prName;
+ args[1] = NULL;
+ if (CL_ProcessCreate(DEBUG_INFO_DSP_PG_PATH, (char* const *) args, NULL,
+ &attr) < 0) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_ProcessCreate Error"); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+ // LCOV_EXCL_STOP 8: there is no bs_analysis_dispinfo_debug
+ }
+
+ /* Create socket */
+ g_sock = socket(AF_INET, SOCK_DGRAM, 0);
+ if (g_sock < 0) { // LCOV_EXCL_BR_LINE 5: socket error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[RESM_ERR]ResMgr Create Socket Failed"); // LCOV_EXCL_LINE 5: socket error case
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "[%s:%d] ResMgr Wakeup", p_ctx->procName,
+ getpid());
+
+ RPC_START_SERVER(rpcId); // Start RPC Server
+ RPC_get_fd(rpcId, &rpcFd); // Event reception FD of RPC
+
+ /* Create proc_watch thread */
+ ret = pthread_create(&ptPRCW, NULL, &PRCW_main, reinterpret_cast<void*>(NULL));
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: pthread_create error case
+ // LCOV_EXCL_START 5: pthread_create error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create Thread Failed. code[%d]", ret);
+ // LCOV_EXCL_STOP 5: pthread_create error case
+ } else {
+ prcwParam.sched_priority = RESM_SUB_PRIORITY;
+ ret = pthread_setschedparam(ptPRCW, SCHED_OTHER, &prcwParam);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: pthread_setschedparam error case
+ // LCOV_EXCL_START 5: pthread_setschedparam error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Set Thread Schedparam Failed. code[%d]", ret);
+ // LCOV_EXCL_STOP 5: pthread_setschedparam error case
+ }
+ }
+
+ /* Create timer */
+ if ((timerFd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create timerFd Failed. errno[%d]", errno);
+ exit(EXIT_FAILURE);
+ }
+ // for drop_caches
+ {
+ if ((timerFd2 = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create timerFd2 Failed. errno[%d]", errno);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ // Initialize remaining memory acquisition
+ mainFree_kib = 0;
+ inactFile_kib = 0;
+ memTotal_kib = 0;
+ cmaFree_kib = 0;
+ cmaTotal_kib = 0;
+ get_meminfo();
+ g_resmgr.restMem = mainFree_kib + inactFile_kib;
+ minRestMem = g_resmgr.restMem;
+ g_resmgr.restMemFlag = TRUE;
+ g_resmgr.restCma = cmaFree_kib;
+ minRestCma = g_resmgr.restCma;
+ g_resmgr.restCmaFlag = TRUE;
+
+ tm.it_value.tv_sec = MONITORING_START_DELAT_TIME;
+ tm.it_value.tv_nsec = 0;
+ tm.it_interval.tv_sec = 1;
+ tm.it_interval.tv_nsec = 0;
+ if (timerfd_settime(timerFd, 0, &tm, NULL) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Set timerFd Failed. errno[%d]", errno);
+ exit(EXIT_FAILURE);
+ }
+
+ tm2.it_value.tv_sec = DROP_CACHES_START_DELAT_TIME;
+ tm2.it_value.tv_nsec = 0;
+ tm2.it_interval.tv_sec = 0;
+ tm2.it_interval.tv_nsec = 0;
+ if (timerfd_settime(timerFd2, 0, &tm2, NULL) == -1) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (coverage measurement revision by DeathTest)
+ // LCOV_EXCL_START 11:Gcov constraints (coverage measurement revision by DeathTest)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Set timerFd2 Failed. errno[%d]", errno);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_END 11:Gcov constraints (coverage measurement revision by DeathTest)
+ }
+
+ /* API to Publish Service Availability Notification. */
+ resourcemanagerRet = FrameworkunifiedPublishServiceAvailability(p_ctx->hApp, TRUE);
+ if (eFrameworkunifiedStatusOK != resourcemanagerRet) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to Publish Service Availability Notification:0x%x", resourcemanagerRet);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+
+ /* CPU Load init */
+ g_fifo_status = STATUS_CHECK_CPU;
+ g_tss_status = STATUS_CHECK_CPU;
+ g_cpuloadRate1000 = 0;
+ init_cpuload();
+ cpu_ret = get_cpuload(g_cpuload);
+ if ( cpu_ret != 0 ) { // LCOV_EXCL_BR_LINE 200: cpu_ret must be 0
+ // LCOV_EXCL_START 200: cpu_ret must be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "Get cpuload Failed");
+ g_cpuloadRate1000 = 0;
+ // LCOV_EXCL_STOP
+ }
+
+
+ while (1) {
+ FD_ZERO(&fds);
+ FD_SET(rpcFd, &fds);
+ maxFd = MY_MAX(maxFd, rpcFd);
+
+ FD_SET(p_ctx->nsFd, &fds);
+ maxFd = MY_MAX(maxFd, p_ctx->nsFd);
+
+ FD_SET(timerFd, &fds);
+ maxFd = MY_MAX(maxFd, timerFd);
+
+ if (timerFd2 != -1) {
+ FD_SET(timerFd2, &fds);
+ maxFd = MY_MAX(maxFd, timerFd2);
+ }
+ ret = select(maxFd + 1, &fds, NULL, NULL, NULL);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: select error case
+ // LCOV_EXCL_START 5: select error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Handle Error");
+ exit(EXIT_FAILURE);
+ }
+ continue;
+ // LCOV_EXCL_STOP 5: select error case
+ }
+ /* API CALL from RPC */
+ if ((timerFd2 != -1) && FD_ISSET(timerFd2, &fds)) {
+ start_drop_caches();
+ timerFd2 = -1;
+ }
+
+ /* API CALL from RPC */
+ if (FD_ISSET(rpcFd, &fds)) {
+ RPC_process_API_request(rpcId);
+ }
+ /* Events from the NSFW */
+ if (FD_ISSET(p_ctx->nsFd, &fds)) {
+ FrameworkunifiedDispatchProcessWithoutLoop(p_ctx->hApp);
+ }
+
+ /* Timer expiration */
+ if (FD_ISSET(timerFd, &fds)) {
+ read(timerFd, &exp, sizeof(uint64_t));
+ /* CPU load monitoring */
+ if ((sec % WTC_CPU_INTERVAL) == 0) {
+ watchCPUStatus();
+ }
+
+ if (sec >= RESET_SEC) {
+ sec = 0;
+ }
+ sec++;
+ }
+ }
+
+ // Close socket
+ close(g_sock);
+
+ mainRet = 0;
+ RPC_end(rpcId);
+
+ return mainRet;
+}
+
+/*********************************************************************************
+ * Session Related
+ *********************************************************************************/
+/* Numbering session ID */
+static int32_t get_new_id(uint32_t* ssnId) {
+ int32_t i;
+ SSN_INFO_t* p_ssnInfo;
+
+ for (i = 0; i < EV_MAX_IDS_IN_THREAD; i++) {
+ p_ssnInfo = &g_resmgr.ssnInfo[i];
+
+ if (p_ssnInfo->useFlag) {
+ // in-use
+ continue;
+ }
+ *ssnId = i;
+ p_ssnInfo->useFlag = TRUE;
+
+ return 0;
+ }
+
+ return -1;
+}
+
+/*********************************************************************************
+ * Memory monitoring
+ *********************************************************************************/
+/* Memory monitoring */
+void watchMem(void) {
+ uint32_t restMem_b;
+ SSN_INFO_t* p_ssnInfo;
+ uint32_t ssnId;
+ int32_t i;
+ int32_t ret;
+
+ // Get remaining memory
+ mainFree_kib = 0;
+ inactFile_kib = 0;
+ memTotal_kib = 0;
+ cmaFree_kib = 0;
+ cmaTotal_kib = 0;
+ g_resmgr.restMemFlag = FALSE;
+ g_resmgr.restCmaFlag = FALSE;
+ ret = get_meminfo();
+ // KiB -> Byte
+ // [Note] Unit of the value gotten by the meminfo is KiB
+ restMem_b = (mainFree_kib + inactFile_kib) * KIBIBYTE_TO_BYTE;
+
+ if (ret != 0) {
+ // Failed to get remaining memory info
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr get_meminfo Failed");
+ return;
+ }
+ g_resmgr.restMem = mainFree_kib + inactFile_kib;
+ g_resmgr.restMemFlag = TRUE;
+ g_resmgr.restCma = cmaFree_kib;
+ g_resmgr.restCmaFlag = TRUE;
+
+ if (g_resmgr.restMem < minRestMem) {
+ // Update minimum available memory
+ minRestMem = g_resmgr.restMem;
+ }
+ if (g_resmgr.restCma < minRestCma) {
+ // Update minimum available CMA
+ minRestCma = g_resmgr.restCma;
+ }
+
+ for (i = 0; i < RESM_INET_IF_MAX; i++) {
+ p_ssnInfo = &g_resmgr.ssnInfo[i];
+ if (!p_ssnInfo->useFlag) {
+ // Unused sessions
+ continue;
+ }
+ ssnId = i;
+
+ // Check event type
+ if (p_ssnInfo->reqEv.reqEvent != RESM_EV_MEM) {
+ // Other than memory monitoring
+ continue;
+ }
+ // Check free memory
+ if (p_ssnInfo->reqEv.prm.restMemThresh > restMem_b) {
+ // Issue event
+ ret = EV_set_flag(Resm_Flag_ID_Base + ssnId, RESM_EV_MEM);
+ if (ret != EV_OK) { // LCOV_EXCL_BR_LINE 200: EV_set_flag will not return ng
+ // LCOV_EXCL_START 200: EV_set_flag will not return ng
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr EV_set_flag Failed. ssnId[%d]", ssnId);
+ // LCOV_EXCL_STOP 200: EV_set_flag will not return ng
+ }
+ }
+ }
+
+ return;
+}
+
+void FlushMemInfo(void) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "MEMORY Info(KB):<PEAK>REST(%d) [Memtotal(%d)] / CMA Info(KB):<PEAK>REST(%d) [CMAtotal(%d)]",
+ minRestMem, memTotal_kib, minRestCma, cmaTotal_kib);
+}
+
+/* Compare memory information */
+static int32_t comp_meminfo_tbl(const void* data1, const void* data2) {
+ return strcmp(((const meminfo_tbl*) data1)->name,
+ ((const meminfo_tbl*) data2)->name);
+}
+
+/* Get memory information */
+static int32_t get_meminfo(void) {
+ int32_t meminfo_fd = -1;
+ char srch_name[16];
+ char buf[2048];
+ meminfo_tbl target = { srch_name, NULL };
+ meminfo_tbl* found;
+ char* head;
+ char* tail;
+ int32_t read_byte;
+ /* Strings must be in ascending order when adding entries to this table (for bsearch) */
+ static const meminfo_tbl mem_table[] = {
+ { "CmaFree", &cmaFree_kib },
+ { "CmaTotal", &cmaTotal_kib },
+ { "Inactive(file)", &inactFile_kib },
+ { "MemFree", &mainFree_kib },
+ { "MemTotal", &memTotal_kib },
+ };
+ const int32_t mem_table_count = sizeof(mem_table) / sizeof(meminfo_tbl);
+
+ if (meminfo_fd == -1) {
+ meminfo_fd = open(MEMINFO_FILE, O_RDONLY);
+ if (meminfo_fd == -1) {
+ fflush(NULL);
+ return -1;
+ }
+ }
+
+ lseek(meminfo_fd, 0L, SEEK_SET);
+ read_byte = read(meminfo_fd, buf, sizeof buf - 1);
+ if (read_byte < 0) { // LCOV_EXCL_BR_LINE 200: if file exist, it will not be -1
+ // LCOV_EXCL_START 200: if file exist, it will not be -1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fflush(NULL);
+ close(meminfo_fd);
+ return -1;
+ // LCOV_EXCL_STOP 200: if file exis, it will not be -1
+ }
+ buf[read_byte] = '\0';
+
+ head = buf;
+ while (1) {
+ tail = strchr(head, ':');
+ if (!tail) {
+ break;
+ }
+
+ *tail = '\0';
+ if (strlen(head) >= sizeof(srch_name)) {
+ head = tail + 1;
+ } else {
+ strcpy(srch_name, head); // NOLINT
+ found = reinterpret_cast<meminfo_tbl *>(bsearch(&target, mem_table, mem_table_count,
+ sizeof(meminfo_tbl), comp_meminfo_tbl));
+ head = tail + 1;
+ if (found) {
+ *(found->value) = strtoul(head, &tail, 10);
+ }
+ }
+ tail = strchr(head, '\n');
+ if (!tail)
+ break;
+ head = tail + 1;
+ }
+ close(meminfo_fd);
+
+ return 0;
+}
+
+/*********************************************************************************
+ * Network monitoring
+ *********************************************************************************/
+/* Get system information */
+static int32_t getInetStatus(RESM_INET_STATUS_t* p_iStatus) {
+ FILE* fh;
+ char buf[READLINE_MAX_SIZE];
+ char* tmp;
+ char name[IFNAMSIZ];
+ char hwaddr[HWADDR_LEN];
+ uint32_t rx_b;
+ uint32_t rx_pckt;
+ uint32_t rx_err;
+ uint32_t rx_drp;
+ uint32_t rx_fifo;
+ uint32_t rx_frm;
+ uint32_t rx_mlt;
+ uint32_t tx_b;
+ uint32_t tx_pckt;
+ uint32_t tx_err;
+ uint32_t tx_drp;
+ uint32_t tx_fifo;
+ uint32_t tx_cll;
+ uint32_t tx_crr;
+ int32_t ret;
+
+ // Open file
+ fh = fopen(PROCNET_DEV_FILE, "r");
+ if (fh == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr getInetStatus() File Open Error. errno[%d]", errno);
+ return -1;
+ }
+
+ // Initialize interface count
+ p_iStatus->ifNum = 0;
+
+ while (fgets(buf, sizeof(buf), fh)) {
+ // Get Alias name
+ tmp = get_aliasName(name, buf);
+ if (tmp == NULL) {
+ // No alias name
+ continue;
+ }
+ // Get amount of receive/transmit data
+ ret = sscanf(tmp, "%u%u%u%u%u%u%u%*u%u%u%u%u%u%u%u", &rx_b, &rx_pckt,
+ &rx_err, &rx_drp, &rx_fifo, &rx_frm, &rx_mlt, &tx_b, &tx_pckt,
+ &tx_err, &tx_drp, &tx_fifo, &tx_cll, &tx_crr);
+ if (ret != 14) { // LCOV_EXCL_BR_LINE 200: ret is always 14
+ // LCOV_EXCL_START 200: ret is always 14
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr getInetStatus() GET Rx and Tx size Failed");
+ continue;
+ // LCOV_EXCL_STOP 200: ret is always 14
+ }
+ // Get hardware address
+ ret = get_hwaddr(name, hwaddr);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: get_hwaddr will not return !0
+ // LCOV_EXCL_START 5: get_hwaddr will not return !0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr getInetStatus() GET hwaddr Failed");
+ continue;
+ // LCOV_EXCL_STOP 5: get_hwaddr will not return !0
+ }
+
+ // Set values in the system information structure
+ strcpy(p_iStatus->ifInfo[p_iStatus->ifNum].name, name); // NOLINT
+ p_iStatus->ifInfo[p_iStatus->ifNum].rxSize = rx_b / BYTE_TO_KIBIBYTE;
+ p_iStatus->ifInfo[p_iStatus->ifNum].txSize = tx_b / BYTE_TO_KIBIBYTE;
+ memcpy(p_iStatus->ifInfo[p_iStatus->ifNum].hwaddr, hwaddr, HWADDR_LEN);
+
+ p_iStatus->ifNum++;
+
+ if (p_iStatus->ifNum >= RESM_INET_IF_MAX) {
+ break;
+ }
+ }
+
+ // Termination processing
+ fclose(fh);
+
+ if (p_iStatus->ifNum == 0) {
+ return -1;
+ }
+ return 0;
+}
+
+/* Get Alias name */
+static char *get_aliasName(char* name, char* line) {
+ char* dot;
+ char* dotname;
+
+ while (isspace(*line)) {
+ line++;
+ }
+ while (*line) {
+ if (isspace(*line)) {
+ *name++ = '\0';
+ return NULL;
+ }
+
+ if (*line == ':') {
+ dot = line, dotname = name;
+ *name++ = *line++;
+
+ while (isdigit(*line)) {
+ *name++ = *line++;
+ }
+ if (*line != ':') {
+ line = dot;
+ name = dotname;
+ }
+ if (*line == '\0') {
+ return NULL;
+ }
+ line++;
+ break;
+ }
+ *name++ = *line++;
+ }
+ *name++ = '\0';
+
+ return line;
+}
+
+/* Get hardware address */
+static int32_t get_hwaddr(char* name, char* hwaddr) {
+ struct ifreq ifr;
+ int32_t ret;
+
+ if (g_sock < 0) { // LCOV_EXCL_BR_LINE 6: g_sock is not -1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 6: g_sock is not -1
+ }
+ // Initialization
+ memset(&ifr, 0, sizeof(ifr));
+
+ // Set alias name
+ strncpy(ifr.ifr_name, name, (sizeof(ifr.ifr_name) - 1));
+
+ // Get hardware address
+ ret = ioctl(g_sock, SIOCGIFHWADDR, &ifr);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: ioctl error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: ioctl error case
+ }
+ memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, HWADDR_LEN);
+
+ return 0;
+}
+
+/*********************************************************************************
+ * CPU monitoring
+ *********************************************************************************/
+// // CPU monitoring
+// static void watchCPU() {
+// Main processing of CPU monitoring
+static void watchCPUStatus() {
+ unsigned long fifo_task_occ = 0;
+ unsigned long tss_task_occ = 0;
+ int32_t fifo_status = g_fifo_status;
+ int32_t tss_status = g_tss_status;
+ int32_t cpu_load_status = CPU_TASK_INIT;
+
+// int32_t ret;
+// static int32_t cpuLogTimer = 0;
+ if ((g_fifo_status == STATUS_CHECK_CPU) || (g_tss_status == STATUS_CHECK_CPU)) {
+ watchCPU();
+
+// if (cpuLogTimer > 0) { // LCOV_EXCL_BR_LINE 6:Because the condition cannot be set
+// // Make to progress the timer
+// cpuLogTimer -= WTC_CPU_INTERVAL; // LCOV_EXCL_LINE 6:Because the condition cannot be set
+// }
+ if (g_cpuloadRate1000 >= CPU_LOAD_THRESHOLD) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CPU TOTAL:(%d.%d%%)",g_cpuloadRate1000/10, g_cpuloadRate1000%10);
+ int i;
+ int32_t cpuloadRate1000;
+ for (i = 1; i < g_cpu_num; i++) {
+ char buf[16];
+ cpuloadRate1000 = calc_cpuloadRate_each(i);
+ sprintf (buf, "%s(%d.%d%%) ", g_cpuload[i].cpuname, cpuloadRate1000/10, cpuloadRate1000%10);
+ FRAMEWORKUNIFIEDLOG (ZONE_INFO, __FUNCTION__, "%s", buf);
+ }
+ if (g_fifo_status == STATUS_CHECK_CPU) { // LCOV_EXCL_BR_LINE 6: g_fifo_status must be STATUS_CHECK_CPU
+ fifo_status = STATUS_WATCH_PROCESS;
+ g_fifo_timer = 0;
+ }
+ if (g_tss_status == STATUS_CHECK_CPU) { // LCOV_EXCL_BR_LINE 6: g_tss_status must be STATUS_CHECK_CPU
+ tss_status = STATUS_WATCH_PROCESS;
+ g_tss_timer = 0;
+ }
+ if ((g_fifo_status != STATUS_WATCH_PROCESS ) && ( g_tss_status != STATUS_WATCH_PROCESS)) { // LCOV_EXCL_BR_LINE 6: g_fifo_status must be STATUS_CHECK_CPU and g_tss_status must be STATUS_CHECK_CPU // NOLINT[whitespace/line_length]
+ logging_cpuload_custom(CPU_TASK_INIT);
+ }
+ }
+ }
+
+#if 0
+ // Get CPU usage
+ if (g_resmgr.cpuloadRate == CPULOAD_INVALID) {
+ // First time
+ init_cpuload();
+ ret = get_cpuload(g_cpuload);
+ if (ret == 0) { // LCOV_EXCL_BR_LINE 5: get_cpuload will not return -1
+ g_resmgr.cpuloadRate = CPULOAD_READY;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "watchCPU() Get cpuload Failed"); // LCOV_EXCL_LINE 5: get_cpuload will not return -1 // NOLINT[whitespace/line_length]
+ }
+#endif
+ if ((g_fifo_status == STATUS_WATCH_PROCESS) || (g_tss_status == STATUS_WATCH_PROCESS)) {
+ if (g_fifo_status == STATUS_WATCH_PROCESS) {
+ g_fifo_timer = g_fifo_timer + WTC_CPU_INTERVAL;
+ if ((g_fifo_timer == WTC_CPU_INTERVAL) || (g_fifo_timer >= FIFO_TIMER_LIMIT)) { // LCOV_EXCL_BR_LINE 200: g_fifo_timer must be bigger than WTC_CPU_INTERVAL/FIFO_TIMER_LIMIT // NOLINT[whitespace/line_length]
+ cpu_load_status = CPU_TASK_SHOW_AF;
+ } else {
+ // LCOV_EXCL_START 200: g_fifo_timer must be bigger than WTC_CPU_INTERVAL/FIFO_TIMER_LIMIT
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ logging_cpuload_custom(FIFO_TASK_SHOW);
+ // LCOV_EXCL_STOP
+ }
+ }
+#if 0
+ return;
+ } else {
+ memcpy(g_cpuload_pre, g_cpuload, sizeof(*g_cpuload_pre)*g_cpu_num);
+ ret = get_cpuload(g_cpuload);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: get_cpuload will not return -1
+ // LCOV_EXCL_START 5: get_cpuload will not return -1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "watchCPU() Get cpuload Failed");
+ return;
+ // LCOV_EXCL_STOP 5: get_cpuload will not return -1
+#endif
+ if (g_tss_status == STATUS_WATCH_PROCESS) {
+ g_tss_timer = g_tss_timer + WTC_CPU_INTERVAL;
+ if ((g_tss_timer == WTC_CPU_INTERVAL) || (g_tss_timer >= TSS_TIMER_LIMIT)) {
+ cpu_load_status = CPU_TASK_SHOW_AF;
+ } else {
+ logging_cpuload_custom(TSS_TASK_SHOW);
+ }
+ }
+#if 0
+ }
+ // Calculate CPU usage (Notes! Return as a thousandth rate(10 times of %)
+ g_cpuloadRate1000 = calc_cpuloadRate();
+ g_resmgr.cpuloadRate = g_cpuloadRate1000 / 10;
+
+ ret = chk_logging(g_resmgr.cpuloadRate, cpuLogTimer);
+ if (ret == CPULOG_LOGGING) {
+ // Logging
+#endif
+ if (cpu_load_status == CPU_TASK_SHOW_AF) {
+#if 0
+ int i;
+ int32_t cpuloadRate1000;
+ char *cpunames = (char *) malloc( // NOLINT
+ sizeof("[CpuHighLoad]") + (sizeof("cpuXX(xxx%) ") * g_cpu_num));
+ cpuloadRate1000 = calc_cpuloadRate();
+ sprintf(cpunames, "[CpuHighLoad]%s(%d%%) ", g_cpuload[0].cpuname, cpuloadRate1000/10); // NOLINT
+ for (i = 1; i < g_cpu_num; i++) {
+ char buf[16];
+ cpuloadRate1000 = calc_cpuloadRate_each(i);
+ sprintf(buf, "%s(%d%%) ", g_cpuload[i].cpuname, cpuloadRate1000 / 10); // NOLINT
+ strcat(cpunames, buf); // NOLINT
+ }
+ free(cpunames);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", cpunames);
+ }
+#endif
+ logging_cpuload_custom(cpu_load_status);
+ }
+ if (g_fifo_status == STATUS_WATCH_PROCESS) {
+ fifo_task_occ = logging_cpuload_custom(CPU_FIFO_TASK_GET_OCCUPANCY);
+ if ((fifo_task_occ >= TASK_STAT_THRESHOLD) && (g_fifo_timer >= FIFO_TIMER_LIMIT)) {
+ fifo_status = STATUS_IDOL;
+ g_fifo_timer = 0;
+ exec_perf(logging_cpuload_custom(CPU_FIFO_TASK_GET_ID));
+ } else if (fifo_task_occ < TASK_STAT_THRESHOLD) {
+ fifo_status = STATUS_CHECK_CPU;
+ g_fifo_timer = 0;
+ logging_cpuload_custom(CPU_FIFO_TASK_GET_ID);
+ }
+ }
+ if (g_tss_status == STATUS_WATCH_PROCESS) {
+ tss_task_occ = logging_cpuload_custom(CPU_TSS_TASK_GET_OCCUPANCY);
+ if ((tss_task_occ >= TASK_STAT_THRESHOLD) && (g_tss_timer >= TSS_TIMER_LIMIT)) {
+ tss_status = STATUS_IDOL;
+ g_tss_timer = 0;
+ exec_perf(logging_cpuload_custom(CPU_TSS_TASK_GET_ID));
+ } else if(tss_task_occ < TASK_STAT_THRESHOLD) {
+ tss_status = STATUS_CHECK_CPU;
+ g_tss_timer = 0;
+ logging_cpuload_custom(CPU_TSS_TASK_GET_ID);
+ }
+ }
+#if 0
+ logging_cpuload_custom();
+ logging_cpuload();
+ // Set timer
+ cpuLogTimer = CPU_HIGH_LOAD_LOG_FREQ;
+ } else if (ret == CPULOG_TIMER_CLEAR) {
+ // Clear Timer
+ cpuLogTimer = 0;
+ }
+
+ return;
+#endif
+ logging_cpuload_custom(CPU_TASK_SHOW_BF);
+ }
+ if ((g_fifo_status == STATUS_IDOL) || (g_tss_status == STATUS_IDOL)) {
+ if (g_fifo_status == STATUS_IDOL) {
+ g_fifo_timer = g_fifo_timer + WTC_CPU_INTERVAL;
+ if (g_fifo_timer >= CPU_HIGH_LOAD_LOG_FREQ) {
+ fifo_status = STATUS_CHECK_CPU;
+ g_fifo_timer = 0;
+ }
+ }
+ if (g_tss_status == STATUS_IDOL) {
+ g_tss_timer = g_tss_timer + WTC_CPU_INTERVAL;
+ if (g_tss_timer >= CPU_HIGH_LOAD_LOG_FREQ) {
+ tss_status = STATUS_CHECK_CPU;
+ g_tss_timer = 0;
+ }
+ }
+ }
+ g_fifo_status = fifo_status;
+ g_tss_status = tss_status;
+
+ return;
+}
+
+
+
+// CPU monitoring
+static void
+watchCPU() {
+ int32_t ret;
+
+ memcpy(g_cpuload_pre, g_cpuload, sizeof(*g_cpuload_pre)*g_cpu_num);
+ ret = get_cpuload(g_cpuload);
+ if ( ret != 0 ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "watchCPU() Get cpuload Failed");
+ g_cpuloadRate1000 = 0;
+ } else {
+ // Calculate CPU usage (Notes! Return as a thousandth rate(10 times of percentage)
+ g_cpuloadRate1000 = calc_cpuloadRate();
+ }
+
+ return;
+}
+
+
+static void init_cpuload(void) {
+ int fd;
+ char buf[READ_MAX_SIZE];
+ int32_t ret;
+ CPU_INFO_t p_cpu;
+ ssize_t rsize;
+ char *p, *ep;
+ struct timespec req = { 0, 1000000 }; // 1msec
+
+ g_cpu_num = 0;
+ g_cpuload_pre = NULL;
+
+ fd = open(PROC_STAT_FILE, O_RDONLY);
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: open error case
+ // LCOV_EXCL_START 5: open error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr File Open Error. errno[%d]",
+ errno);
+ return;
+ // LCOV_EXCL_STOP 5: open error case
+ }
+ rsize = read(fd, buf, sizeof(buf));
+ if (rsize == -1) { // LCOV_EXCL_BR_LINE 5: read error case
+ // LCOV_EXCL_START 5: read error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr File Read Error. errno[%d]",
+ errno);
+ close(fd);
+ return;
+ // LCOV_EXCL_STOP 5: read error case
+ }
+ nanosleep(&req, NULL);
+ p = buf;
+ ep = buf + rsize;
+ while (p < ep) {
+ if (strncmp(p, "cpu", 3) == 0) {
+ ret = sscanf(p, "%8s %d %d %d %d %d %d %d %d %d %d", &p_cpu.cpuname[0],
+ &p_cpu.user, &p_cpu.nice, &p_cpu.system, &p_cpu.idle,
+ &p_cpu.iowait, &p_cpu.irq, &p_cpu.softirq, &p_cpu.steal,
+ &p_cpu.guest, &p_cpu.guest_nice);
+ if (ret < 11) { // LCOV_EXCL_BR_LINE 200: ret will always 11
+ // LCOV_EXCL_START 200: ret will always 11
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr get_cpuload() File Read Error");
+ close(fd);
+ return;
+ // LCOV_EXCL_STOP 200: ret will always 11
+ }
+ g_cpu_num++;
+ while (++p < ep) {
+ if (*p == LF) {
+ p++;
+ break;
+ }
+ }
+ } else {
+ break;
+ }
+ }
+ close(fd);
+
+ g_cpuload_pre = reinterpret_cast<CPU_INFO_t *>(malloc(sizeof(CPU_INFO_t) * g_cpu_num));
+ g_cpuload = reinterpret_cast<CPU_INFO_t *>(malloc(sizeof(CPU_INFO_t) * g_cpu_num));
+ if ((g_cpuload_pre == NULL) || (g_cpuload == NULL)) { // LCOV_EXCL_BR_LINE 5: malloc error case
+ // LCOV_EXCL_START 5: malloc error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr malloc Error. g_cpu_num[%d] errno[%d]", g_cpu_num, errno);
+ return;
+ // LCOV_EXCL_STOP 5: malloc error case
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr cpu_num:%d", g_cpu_num);
+
+ return;
+}
+
+// Get CPU usage
+static int32_t get_cpuload(CPU_INFO_t* p_cpu) {
+ int fd;
+ char buf[READ_MAX_SIZE];
+ int32_t ret;
+ int i = 0;
+ ssize_t rsize;
+ char *p, *ep;
+ struct timespec req = { 0, 1000000 }; // 1msec
+
+ // Open file
+ fd = open(PROC_STAT_FILE, O_RDONLY);
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: open's error case
+ // LCOV_EXCL_START 5: open's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr get_cpuload() File Open Error. errno[%d]", errno);
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+ rsize = read(fd, buf, sizeof(buf));
+ if (rsize == -1) { // LCOV_EXCL_BR_LINE 5: read error case
+ // LCOV_EXCL_START 5: read error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr File Read Error. errno[%d]",
+ errno);
+ close(fd);
+ return -1;
+ // LCOV_EXCL_STOP 5: read error case
+ }
+ nanosleep(&req, NULL);
+ p = buf;
+ ep = buf + rsize;
+ while (p < ep) {
+ if (strncmp(p, "cpu", 3) == 0) {
+ ret = sscanf(p, "%8s %d %d %d %d %d %d %d %d %d %d", &p_cpu[i].cpuname[0],
+ &p_cpu[i].user, &p_cpu[i].nice, &p_cpu[i].system,
+ &p_cpu[i].idle, &p_cpu[i].iowait, &p_cpu[i].irq,
+ &p_cpu[i].softirq, &p_cpu[i].steal, &p_cpu[i].guest,
+ &p_cpu[i].guest_nice);
+ if (ret < 11) { // LCOV_EXCL_BR_LINE 200: ret will always 11
+ // LCOV_EXCL_START 200: ret will always 11
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr get_cpuload() File Read Error");
+ close(fd);
+ return -1;
+ // LCOV_EXCL_STOP 200: ret will always 11
+ }
+ i++;
+ while (++p < ep) {
+ if (*p == LF) {
+ p++;
+ break;
+ }
+ }
+ } else {
+ break;
+ }
+ }
+ close(fd);
+
+ return 0;
+}
+
+// Calcurate CPU usage
+static int32_t calc_cpuloadRate(void) {
+ int val;
+ int val_others;
+ int total;
+ int rate;
+ CPU_INFO_t* info;
+ CPU_INFO_t* info_pre;
+
+ info = &g_cpuload[0];
+ info_pre = &g_cpuload_pre[0];
+
+ val = (info->user - info_pre->user)
+ + (info->system - info_pre->system)
+ + (info->irq - info_pre->irq)
+ + (info->softirq - info_pre->softirq);
+
+ val_others = (info->idle - info_pre->idle)
+ + (info->iowait - info_pre->iowait);
+
+ total = val + val_others;
+ rate = (total > 0) ? (val*1000 / total) : 0;
+
+ return rate;
+}
+
+// Calcurate CPU usage for each CPU
+static int32_t calc_cpuloadRate_each(int num) {
+ int val, valn;
+ int rate;
+ CPU_INFO_t* info;
+ CPU_INFO_t* info_pre;
+
+ // cpu
+ info = &g_cpuload[0];
+ info_pre = &g_cpuload_pre[0];
+ val = (info->user - info_pre->user)
+ + (info->system - info_pre->system)
+ + (info->irq - info_pre->irq)
+ + (info->softirq - info_pre->softirq);
+
+ // cpu-num
+ info = &g_cpuload[num];
+ info_pre = &g_cpuload_pre[num];
+ valn = (info->user - info_pre->user)
+ + (info->system - info_pre->system)
+ + (info->softirq - info_pre->softirq);
+
+ rate = valn * 1000 / val;
+ return rate;
+}
+
+
+//// Logging check at CPU overload
+//static int32_t chk_logging(int32_t cpuload, int32_t timer) {
+// if (cpuload >= CPU_LOAD_THRESHOLD) {
+// if (timer > 0) {
+// return CPULOG_NO_LOGGING;
+// }
+// return CPULOG_LOGGING;
+// }
+//
+// return CPULOG_TIMER_CLEAR;
+//}
+
+
+// Check if cmd to perf
+ // LCOV_EXCL_START 8: dead code
+bool valid_perf_cmd(char *buf) { // LCOV_EXCL_BR_LINE 8: dead code
+ const char *cmd2exclude[] = { "top", "init", "bash", NULL };
+ char cmdstr[64];
+
+ for (int i = 0;; i++) {
+ if (cmd2exclude[i] == NULL) {
+ break;
+ }
+ sprintf(cmdstr, " %s ", cmd2exclude[i]); // NOLINT
+ if (strstr(buf, cmdstr) == NULL) {
+ continue;
+ } else {
+ return false;
+ }
+ }
+ return true;
+}
+ // LCOV_EXCL_STOP 8: dead code
+
+//// exec perf to pids
+//static pid_t pids[PERF_MAX_PROCS];
+
+
+static bool lower_sched_priority(int niceval) {
+ struct sched_param sparam = { };
+ sparam.sched_priority = 0;
+ if (sched_setscheduler(0, SCHED_OTHER, &sparam) == -1) { // LCOV_EXCL_BR_LINE 5: sched_setscheduler's error case
+ // LCOV_EXCL_START 5: sched_setscheduler's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed change scheduler to TSS, errno=%d",
+ errno);
+ return false;
+ // LCOV_EXCL_STOP
+ }
+ if (nice(niceval) == -1) { // LCOV_EXCL_BR_LINE 5: nice's error case
+ // LCOV_EXCL_START 5: nice's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to add nice val %d, errno=%d",
+ niceval, errno);
+ return false;
+ // LCOV_EXCL_STOP
+ }
+ return true;
+}
+
+/*********************************************************************************
+ * exec_perf sub function RECORD perf data processing
+ *********************************************************************************/
+static void exec_perf_Record_Perf_Data(
+ pid_t* c_pids, char* perf_file, char* pidstr, int* status,
+
+// char pnames[PERF_MAX_PROCS][PERF_PNAME_MAX]) {
+ pid_t pids[PERF_MAX_PROCS]) {
+
+ int i;
+ int fd;
+ pid_t term_pid;
+ int waitret;
+ bool do_sigkill = false;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "+");
+
+ /* RECORD perf data */
+ for (i = 0; i < PERF_MAX_PROCS; i++) {
+ if (pids[i] <= 0) {
+ break;
+ }
+ sprintf(perf_file, PERF_FILE"%06d", pids[i]); // NOLINT
+ sprintf(pidstr, "%d", pids[i]); // NOLINT
+ if ((c_pids[i] = fork()) == 0) {
+ if (lower_sched_priority(CPULOAD_NICEVAL) == false) { // LCOV_EXCL_BR_LINE 200: lower_sched_priority() must be true
+ // LCOV_EXCL_START 200: lower_sched_priority() must be true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to lower scheduler-1");
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ if (setuid(0) == -1) { // LCOV_EXCL_BR_LINE 5: setuid's error case
+ // LCOV_EXCL_START 5: setuid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to setuid(0)-1, errno=%d",
+ errno);
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ // Redirect STDERR
+ fd = open("/dev/null", O_WRONLY);
+ if (fd > 0) { // LCOV_EXCL_BR_LINE 5: open's error case
+ dup2(fd, 2);
+ }
+ // Exec perf
+ execl(PERF_PATH, basename(PERF_PATH), "record", "-p", pidstr, "-o",
+ perf_file, NULL);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to execl %s record, errno=%d",
+ PERF_PATH,
+ errno);
+ exit(1);
+ }
+ if (c_pids[i] == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork-1, errno=%d", errno);
+ continue;
+ // LCOV_EXCL_STOP
+ }
+ // Kill perf after PERF_RECORD_SPAN sec
+ // (Killed by child process to avoid making resm process super-user with setuid.)
+ if ((term_pid = fork()) == 0) {
+ const struct timespec delay = { PERF_RECORD_SPAN, 0 };
+ if (setuid(0) == -1) { // LCOV_EXCL_BR_LINE 5: setuid's error case
+ // LCOV_EXCL_START 5: setuid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to setuid(0)-2, errno=%d",
+ errno);
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ nanosleep(&delay, NULL); // Let perf record run for a while before kill it.
+ if (kill(c_pids[i], SIGINT) == -1) { // LCOV_EXCL_BR_LINE 5: kill's error case
+ // LCOV_EXCL_START 5: kill's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to kill(SIGINT), pid=%d, errno=%d", (int) c_pids[i],
+ errno);
+ // LCOV_EXCL_STOP
+ }
+ nanosleep(&delay, NULL); // Allow perf to do ending procedure.
+ exit(0);
+ } else if (term_pid == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork-2, errno=%d", errno);
+ continue;
+ // LCOV_EXCL_STOP
+ } else {
+ if (waitpid(term_pid, status, 0) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to waitpid of killer %d, errno=%d", term_pid, errno);
+ continue;
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ // NOT block even if perf is not terminated
+ if ((waitret = waitpid(c_pids[i], status, WNOHANG)) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to waitpid of RECORD %d, errno=%d",
+ c_pids[i], errno);
+ // LCOV_EXCL_STOP
+ } else if (waitret == 0) {
+ // NOT exited
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to terminate perf record, pid=%d",
+ c_pids[i]);
+ pids[i] = -2; // Skip following sequences
+ do_sigkill = true;
+ } else if (WEXITSTATUS(*status) != 0 && WEXITSTATUS(*status) != 2) {
+
+// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+// "perf record %d exited abnormally, target=%s(%d), status=%d",
+// c_pids[i], pnames[i], pids[i], WEXITSTATUS(*status));
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "perf record %d exited abnormally, target=(%d), status=%d",
+ c_pids[i], pids[i], WEXITSTATUS(*status));
+
+ pids[i] = -2; // Skip following sequences
+ do_sigkill = false;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ if (pids[i] == -2) {
+ if ((term_pid = fork()) == 0) {
+ const struct timespec delay = { PERF_RECORD_SPAN, 0 };
+ if (setuid(0) == -1) { // LCOV_EXCL_BR_LINE 5: setuid's error case
+ // LCOV_EXCL_START 5: setuid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to setuid(0)-2B, errno=%d",
+ errno);
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ // Kill "perf record" by SIGKILL signal
+ if (do_sigkill) {
+ int sigret = kill(c_pids[i], SIGKILL);
+ if (sigret == 0) { // LCOV_EXCL_BR_LINE 5: kill case
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SIGKILL has been sent to perf record process, pid=%d",
+ c_pids[i]);
+ } else {
+ // LCOV_EXCL_START 5: kill case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "sending SIGKILL to perf record failed, pid=%d, errno=%d",
+ c_pids[i], errno);
+ // LCOV_EXCL_STOP 5: kill case
+ }
+ }
+ nanosleep(&delay, NULL);
+ // remove perf data file possibly made
+ unlink(perf_file);
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ exit(0);
+ } else if (term_pid == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork-2B, errno=%d", errno);
+ // LCOV_EXCL_STOP
+ } else {
+ if (waitpid(term_pid, status, 0) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to waitpid of killer-2 %d, errno=%d", term_pid, errno);
+ // LCOV_EXCL_STOP
+ }
+ if (do_sigkill) {
+ if ((waitret = waitpid(c_pids[i], status, WNOHANG)) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to waitpid of RECORD(2) %d, errno=%d", c_pids[i],
+ errno);
+ // LCOV_EXCL_STOP
+ } else if (waitret == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to terminate perf record by SIGKILL, pid=%d",
+ c_pids[i]);
+ }
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+}
+
+/*********************************************************************************
+ * exec_perf sub function make perf file available to default user processing
+ *********************************************************************************/
+
+//static int32_t exec_perf_Make_Perf_File(pid_t* c_pids, char* perf_file) {
+static int32_t exec_perf_Make_Perf_File(pid_t* c_pids, char* perf_file, pid_t pids[PERF_MAX_PROCS]) {
+
+ int i;
+
+ /* make perf file available to default user */
+ if ((c_pids[0] = fork()) == 0) {
+ if (setuid(0) == -1) { // LCOV_EXCL_BR_LINE 5: setuid's error case
+ // LCOV_EXCL_START 5: setuid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to setuid(0)-3, errno=%d", errno);
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ for (i = 0; i < PERF_MAX_PROCS; i++) {
+ if (pids[i] == -2) {
+ // killed by SIGKILL
+ continue;
+ }
+ if (pids[i] <= 0) {
+ break;
+ }
+ sprintf(perf_file, PERF_FILE"%06d", pids[i]); // NOLINT
+ if (chmod(perf_file, 0666) != 0) { // LCOV_EXCL_BR_LINE 5: chmod's error case
+ // LCOV_EXCL_START 5: chmod's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to chmod %s, errno=%d\n",
+ perf_file, errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ exit(0);
+ }
+ if (c_pids[0] == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork-3, errno=%d", errno);
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+ if (waitpid(c_pids[0], NULL, 0) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to waitpid of CHMOD %d, errno=%d\n",
+ c_pids[0], errno);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ return 0;
+}
+
+/*********************************************************************************
+ * exec_perf sub function REPORT perf data into dump file processing
+ *********************************************************************************/
+static void exec_perf_Report_Perf_Data(pid_t* c_pids, char* perf_file,
+
+// char* perf_dump, int* status) {
+ char* perf_dump, int* status, pid_t pids[PERF_MAX_PROCS]) {
+
+ int i;
+ int fd;
+ int waitret;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ /* REPORT perf data into dump file */
+ for (i = 0; i < PERF_MAX_PROCS; i++) {
+ const struct timespec delay = { PERF_REPORT_DELAY, 0 };
+ if (pids[i] == -2) {
+ // killed by SIGKILL
+ continue;
+ }
+ if (pids[i] <= 0) {
+ break;
+ }
+ sprintf(perf_file, PERF_FILE"%06d", pids[i]); // NOLINT
+ sprintf(perf_dump, PERF_DUMP"%06d", pids[i]); // NOLINT
+ if ((c_pids[i] = fork()) == 0) {
+ if (lower_sched_priority(CPULOAD_NICEVAL) == false) { // LCOV_EXCL_BR_LINE 200: lower_sched_priority() will not return false
+ // LCOV_EXCL_START 200: lower_sched_priority() will not return false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to lower scheduler-2");
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ if ((fd = open(perf_dump, (O_CREAT | O_WRONLY), 0666)) < 0) { // LCOV_EXCL_BR_LINE 5: open error case
+ // LCOV_EXCL_START 5: open error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open %s, errno=%d\n",
+ perf_dump, errno);
+ // LCOV_EXCL_STOP 5: open error case
+ } else {
+ // Redirect STDOUT
+ dup2(fd, 1);
+ close(fd);
+ // Redirect STDERR
+ fd = open("/dev/null", O_WRONLY);
+ if (fd > 0) { // redirect stderr // LCOV_EXCL_BR_LINE 5: open's error case
+ dup2(fd, 2);
+ close(fd);
+ }
+ // Exec perf
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "execl perf report");
+ execl(PERF_PATH, basename(PERF_PATH), "report", "-i", perf_file, NULL);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to execl %s report, errno=%d",
+ PERF_PATH,
+ errno);
+ }
+ exit(1);
+ }
+ if (c_pids[i] == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork-4, errno=%d", errno);
+ continue;
+ // LCOV_EXCL_STOP
+ }
+ int ii = 0;
+ for (; ii < PERF_REPORT_RETRY; ii++) {
+ nanosleep(&delay, NULL); // Make sure waitpid() to killer returns after perf process exited.
+ if ((waitret = waitpid(c_pids[i], status, WNOHANG)) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to waitpid for REPORT %d, errno=%d", c_pids[i], errno);
+ pids[i] = -2; // Skip FRAMEWORKUNIFIEDLOG perf data
+ break;
+ // LCOV_EXCL_STOP
+ } else if (waitret == c_pids[i]) {
+ break;
+ }
+ }
+ if (ii >= PERF_REPORT_RETRY) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "perf report Failed to exit, pid=%d",
+ c_pids[i]);
+ pids[i] = -2; // Skip FRAMEWORKUNIFIEDLOG perf data
+ }
+ if (pids[i] == -2) {
+ // Terminate perf report with SIGKILL
+ const struct timespec delay = { PERF_RECORD_SPAN, 0 };
+ int sigret = kill(c_pids[i], SIGKILL);
+ if (sigret != 0) { // LCOV_EXCL_BR_LINE 5: kill's error case
+ // LCOV_EXCL_START 5: kill's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed in sending SIGKILL to perf report, pid=%d, errno=%d",
+ c_pids[i], errno);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SIGKILL has been sent to perf report process, pid=%d",
+ c_pids[i]);
+ }
+ nanosleep(&delay, NULL); // Make sure waitpid() to killer returns after perf process exited.
+ if ((waitret = waitpid(c_pids[i], status, WNOHANG)) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to waitpid of REPORT(2) %d, errno=%d", c_pids[i], errno);
+ // LCOV_EXCL_STOP
+ } else if (waitret == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to terminate perf report by SIGKILL, pid=%d", c_pids[i]);
+ }
+ // Cleanup
+ unlink(perf_dump);
+ unlink(perf_file);
+ }
+ }
+}
+
+/*********************************************************************************
+ * exec_perf FRAMEWORKUNIFIEDLOG perf data processing
+ *********************************************************************************/
+static void exec_perf_Resourcemanagerlog_Perf_Data(
+ char* perf_file, char* perf_dump,
+
+// char pnames[PERF_MAX_PROCS][PERF_PNAME_MAX]) {
+ pid_t pids[PERF_MAX_PROCS]) {
+
+ int i;
+ int perf_lines;
+ char buf[READLINE_MAX_SIZE];
+ FILE *rfd;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ /* FRAMEWORKUNIFIEDLOG perf data */
+ for (i = 0; i < PERF_MAX_PROCS; i++) {
+ if (pids[i] == -2) {
+ // killed by SIGKILL
+ continue;
+ }
+ if (pids[i] <= 0) {
+ break;
+ }
+ sprintf(perf_file, PERF_FILE"%06d", pids[i]); // NOLINT
+ sprintf(perf_dump, PERF_DUMP"%06d", pids[i]); // NOLINT
+ if ((rfd = fopen(perf_dump, "r")) == NULL) { // LCOV_EXCL_BR_LINE 5: fopen error case
+ // LCOV_EXCL_START 5: fopen error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open-2 %s, errno=%d\n",
+ perf_dump, errno);
+ continue;
+ // LCOV_EXCL_STOP 5: fopen error case
+ }
+ perf_lines = 0;
+ while (fgets(buf, sizeof(buf), rfd) > 0) {
+ if (perf_lines >= PERF_MAX_LINES) {
+ break;
+ }
+ /* skip header */
+ if (buf[0] == '#') {
+ continue;
+ }
+ if (buf[0] == '\n' || buf[0] == '\r') {
+ continue;
+ }
+ trim_end(buf);
+ if (perf_lines == 0) {
+
+// FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHLPerf:%s(%d)]report by result of 'perf record -p %d'",
+// pnames[i], pids[i], pids[i]);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHLPerf:(%d)]report by result of 'perf record -p %d'",
+ pids[i], pids[i]);
+
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHLPerf]%s\n", buf);
+ perf_lines++;
+ }
+ fclose(rfd);
+ // Check if no line is acquired
+ if (perf_lines == 0) {
+
+// FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHLPerf:%s(%d)] NO_DATA_acquired",
+// pnames[i], pids[i]);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHLPerf:(%d)] NO_DATA_acquired",
+ pids[i]);
+
+ }
+ // Cleanup
+ unlink(perf_dump);
+ unlink(perf_file);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "-");
+}
+
+/*********************************************************************************
+ * exec_perf Main processing
+ *********************************************************************************/
+
+//static void exec_perf(char pnames[PERF_MAX_PROCS][PERF_PNAME_MAX]) {
+static void exec_perf(int32_t t_pid) {
+
+ pid_t c_pids[PERF_MAX_PROCS]; // max process to exec perf(forked child pids)
+
+ pid_t pids[PERF_MAX_PROCS];
+ char perf_file[128];
+ char perf_dump[128];
+ char pidstr[64];
+ struct stat statbuf;
+ int status;
+
+ /* Check existance of perf exec file */
+ if (stat(PERF_PATH, &statbuf) == -1 || !(statbuf.st_mode & S_IXUSR)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "%s is not available", PERF_PATH);
+ return;
+ }
+
+ FRAMEWORKUNIFIEDLOG (ZONE_INFO, __FUNCTION__, "[CpuHighLoad]Please check User backtrace of following processes in kernel.log");
+// print_backtrace_pid(t_pid);
+ for (int i = 0; i < PERF_MAX_PROCS; i++) {
+ pids[i] = -1;
+ }
+
+ pids[0] = t_pid;
+
+
+ /* RECORD perf data */
+
+// exec_perf_Record_Perf_Data(c_pids, perf_file, pidstr, &status, pnames);
+ exec_perf_Record_Perf_Data(c_pids, perf_file, pidstr, &status, pids);
+
+
+ /* make perf file available to default user */
+
+// if (exec_perf_Make_Perf_File(c_pids, perf_file) != 0)
+ if (exec_perf_Make_Perf_File(c_pids, perf_file, pids) != 0)
+
+ return;
+
+ /* REPORT perf data into dump file */
+
+// exec_perf_Report_Perf_Data(c_pids, perf_file, perf_dump, &status);
+ exec_perf_Report_Perf_Data(c_pids, perf_file, perf_dump, &status, pids);
+
+
+ /* FRAMEWORKUNIFIEDLOG perf data */
+
+// exec_perf_Resourcemanagerlog_Perf_Data(perf_file, perf_dump, pnames);
+ exec_perf_Resourcemanagerlog_Perf_Data(perf_file, perf_dump, pids);
+
+}
+
+// Logging at CPU overload
+#define WAIT_RETRY 3 // 3sec
+
+
+#if 0
+static void logging_cpuload(void) {
+ int32_t pipe_fd[2]; // 0:stdin,1:stdout
+ pid_t c_pid;
+ char buf[READLINE_MAX_SIZE];
+ char buf2[READLINE_MAX_SIZE];
+ char tmp[READLINE_MAX_SIZE];
+ int32_t logLine = 0;
+ char* ptr;
+ int32_t ret;
+ int32_t status;
+ int32_t perfNum = 0;
+ char pnames[PERF_MAX_PROCS][PERF_PNAME_MAX] = { };
+ int save_0 = -1;
+ int kill_flag = 1;
+ int waitret;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "+");
+
+ // Create pipe
+ ret = pipe(pipe_fd);
+
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: pipe error case
+ // LCOV_EXCL_START 5: pipe error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr logging_cpuload() pipe Error");
+ return;
+ // LCOV_EXCL_STOP 5: pipe error case
+ }
+
+ // Create child process
+ c_pid = fork();
+ if (c_pid < 0) { // LCOV_EXCL_BR_LINE 5: fork error case
+ // LCOV_EXCL_START 5: fork error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr logging_cpuload() fork Error");
+ close(pipe_fd[0]);
+ close(pipe_fd[1]);
+
+ return;
+ // LCOV_EXCL_STOP 5: fork error case
+ }
+
+ if (c_pid == 0) {
+ /*******************************************************
+ * Child-process
+ * The use of dup() and Close() between fork()-> exec() has been
+ * confirmed no probrem.
+ *******************************************************/
+ if (lower_sched_priority(CPULOAD_NICEVAL) == false) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to lower scheduler");
+ exit(1);
+ }
+ close(pipe_fd[0]); // Unneeded pipes (close stdin)
+
+ close(1); // Close stdout
+ dup2(pipe_fd[1], 1); // Duplicate stdout to pipe_fd[1]
+ close(pipe_fd[1]);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "execl top");
+ execl("/usr/bin/top", "top", "-n", "1", "-b", NULL);
+ // error
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr logging_cpuload() execl Error");
+ exit(1);
+ } else {
+ close(pipe_fd[1]); // Unneeded pipes(Close stdout)
+
+ save_0 = dup(0);
+ close(0); // Close stdin
+ dup2(pipe_fd[0], 0); // Duplicate stdin to pipe_fd[0]
+ close(pipe_fd[0]);
+
+ for (int i = 0; i < PERF_MAX_PROCS; i++) {
+ pids[i] = -1;
+ }
+
+ {
+ fd_set fds;
+ int32_t maxFd;
+ int ret;
+ struct timeval tmout = { TOP_TIMEOUT, 0 };
+
+ FD_ZERO(&fds);
+ FD_SET(STDIN_FILENO, &fds);
+ maxFd = STDIN_FILENO;
+ ret = select(maxFd + 1, &fds, NULL, NULL, &tmout);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: select error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "[RESM]Handle Error errno:%d", errno); // LCOV_EXCL_LINE 5: select error case
+ } else if (FD_ISSET(STDIN_FILENO, &fds)) {
+ kill_flag = 0;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM]'top': No response during %d seconds", TOP_TIMEOUT);
+ }
+ if (kill_flag) {
+ // Kill top after TOP_TIMEOUT sec
+ // (Killed by child process to avoid making resm process super-user with setuid.)
+ if (kill(c_pid, SIGKILL) == -1) { // LCOV_EXCL_BR_LINE 5: kill error case
+ // LCOV_EXCL_START 5: kill error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to kill(SIGKILL), pid=%d, errno=%d", (int) c_pid,
+ errno);
+ // LCOV_EXCL_STOP 5: kill error case
+ }
+ } else {
+ while (fgets(buf, sizeof(buf), stdin) > 0) {
+ // Save ProcessName and Process ID to exec perf
+ if (logLine >= 2 && perfNum < PERF_MAX_PROCS) {
+ buf2[0] = 0;
+ strncat(buf2, buf, sizeof(buf2) - 1);
+ buf2[sizeof(buf2) - 1] = 0;
+ if (valid_perf_cmd(buf2)) {
+ pids[perfNum] = atoi(buf2);
+ trim_end(buf2);
+ strncat(pnames[perfNum], rindex(buf2, ' ') + 1,
+ sizeof(pnames[0]) - 1);
+ if (pids[perfNum] >= 0
+ && strnlen(pnames[perfNum], sizeof(pnames[perfNum]) - 1)) {
+ perfNum++;
+ } else {
+ pids[perfNum] = -1;
+ }
+ }
+ }
+ if (logLine == 0) {
+ if ((buf[0] != 'C') && (buf[0] != '%')) {
+ continue;
+ }
+ ptr = strstr(buf, "sy");
+ if (ptr == NULL) {
+ continue;
+ }
+ while (isalpha(*ptr)) {
+ ptr++;
+ }
+ *ptr = '\0';
+ escape_percent(buf, tmp);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHighLoad]%s", tmp);
+ logLine++;
+ } else if (logLine == 1) {
+ ptr = strstr(buf, "PID");
+ if (ptr == NULL) {
+ continue;
+ }
+ trim_end(buf);
+ escape_percent(buf, tmp);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHighLoad]%s", tmp);
+ logLine++;
+ } else if (logLine < (CPU_HIGH_LOAD_P_LOG_NUM + 2)) {
+ trim_end(buf);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHighLoad]%s", buf);
+ logLine++;
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "wait pid(%d) kill_flag(%d)", c_pid, kill_flag);
+ if (kill_flag) {
+ const struct timespec delay = {1, 0};
+ int i;
+ for (i = 0; i < WAIT_RETRY; i++) {
+ nanosleep(&delay, NULL);
+ if ((waitret = waitpid(c_pid, &status, WNOHANG)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to waitpid for top %d, errno=%d", c_pid, errno);
+ break;
+ } else if (waitret == c_pid) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "waitpid OK");
+ break;
+ }
+ }
+ if (i >= WAIT_RETRY) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "top Failed to exit, pid=%d", c_pid);
+ }
+ } else {
+ if ((waitret = waitpid(static_cast<int>(c_pid), &status, 0)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "waitpid(%d) Error errno(%d)", c_pid, errno);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "waitpid(%d) returned (%d) errno(%d) status=%d",
+ c_pid, waitret, errno, WEXITSTATUS(*status));
+ if (save_0 >= 0) {
+ dup2(save_0, 0); // Reset the stdin to 0
+ close(save_0);
+ }
+ if (!kill_flag) {
+ exec_perf(pnames);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "-");
+
+ return;
+}
+#endif
+
+
+// Tail adjustment
+static void trim_end(char* buf) {
+ int32_t len;
+
+ len = strlen(buf);
+ while (len > 0) {
+ if (isspace(buf[len - 1])) {
+ buf[len - 1] = '\0';
+ len--;
+ continue;
+ }
+ break;
+ }
+
+ return;
+}
+
+
+#if 0
+// Escape character "%"
+static void escape_percent(char* in, char* out) {
+ char* head;
+ char* tail;
+
+ head = in;
+
+ out[0] = '\0';
+
+ while (1) {
+ tail = strchr(head, '%');
+ if (tail == NULL) {
+ strcat(out, head); // NOLINT
+ break;
+ }
+ *tail = '\0';
+
+ strcat(out, head); // NOLINT
+ strcat(out, "%%"); // NOLINT
+
+ tail++;
+ head = tail;
+ }
+
+ return;
+}
+#endif
+
+
+/*********************************************************************************
+ * Output debug information display
+ *********************************************************************************/
+void outputResouceInfo(void) {
+ static bool madedir = false;
+ struct stat sbuf;
+ FILE *wfp;
+
+ // Create directory
+ if (!madedir) {
+ if (stat(DEBUG_INFO_DIRPATH, &sbuf) != 0) { // LCOV_EXCL_BR_LINE 5: stat's error case
+ if (mkdir(DEBUG_INFO_DIRPATH, 0777) != 0) { // LCOV_EXCL_BR_LINE 5: mkdir's error case
+ // LCOV_EXCL_START 5: mkdir's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to mkdir %s, errno=%d",
+ DEBUG_INFO_DIRPATH,
+ errno);
+ return;
+ // LCOV_EXCL_STOP
+ }
+ }
+ madedir = true;
+ }
+ // Open files to work
+ if ((wfp = fopen(DEBUG_INFO_TMPPATH, "w")) == NULL) { // LCOV_EXCL_BR_LINE 5: fopen error case
+ // LCOV_EXCL_START 5: fopen error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open %s, errno=%d",
+ DEBUG_INFO_TMPPATH,
+ errno);
+ return;
+ // LCOV_EXCL_STOP 5: fopen error case
+ }
+ // Output memory information work
+ if (write_meminfo_work(wfp) != 0) { // LCOV_EXCL_BR_LINE 6: write_meminfo_work will not be error
+ // LCOV_EXCL_START 6: write_meminfo_work will not be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to edit and output in write_meminfo_work()");
+ fclose(wfp);
+ return;
+ // LCOV_EXCL_STOP 6: write_meminfo_work will not be error
+ }
+ // Get CMA MEMORY information and output working info
+ if (write_cmainfo_work(wfp) != 0) { // LCOV_EXCL_BR_LINE 6: write_cmainfo_work will not be error
+ // LCOV_EXCL_START 6: write_cmainfo_work will not be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to edit and output in write_cmainfo_work()");
+ fclose(wfp);
+ return;
+ // LCOV_EXCL_STOP 6: write_cmainfo_work will not be error
+ }
+ // Get top information and output work info
+ if (write_cpuinfo_work(wfp) != 0) { // LCOV_EXCL_BR_LINE 6: write_cpuinfo_work will not be error
+ // LCOV_EXCL_START 6: write_cpuinfo_work will not be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to edit and output in write_cpuinfo_work()");
+ fclose(wfp);
+ return;
+ // LCOV_EXCL_STOP 6: write_cpuinfo_work will not be error
+ }
+ fclose(wfp);
+ // Create output file
+ if (rename(DEBUG_INFO_TMPPATH, DEBUG_INFO_FPATH) != 0) { // LCOV_EXCL_BR_LINE 5:rename error case
+ // LCOV_EXCL_START 5:rename error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to make output file %s, errno=%d",
+ DEBUG_INFO_FPATH,
+ errno);
+ // LCOV_EXCL_STOP 5:rename error case
+ }
+ // Write information and output FRAMEWORKUNIFIEDLOG
+ if (write_resourcemanagerloginfo_work() != 0) { // LCOV_EXCL_BR_LINE 6: write_resourcemanagerloginfo_work will not be error
+ // LCOV_EXCL_START 6: write_resourcemanagerloginfo_work will not be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to output in write_resourcemanagerloginfo_work()");
+ // LCOV_EXCL_STOP 6: write_resourcemanagerloginfo_work will not be error
+ }
+}
+
+// Output memory information work
+static int write_meminfo_work(FILE *wfp) {
+ float total;
+ float avail;
+ float used;
+ float min_remain;
+ uint32_t used_rate;
+ uint32_t used_letters;
+ // Output meminfo: Getting info from the proc/meminfo is performed at 5-second intervals in watchMem, so it is diverted.
+ avail = static_cast<float>((mainFree_kib + inactFile_kib));
+ total = static_cast<float>(memTotal_kib);
+ used = total - avail;
+ min_remain = static_cast<float>(minRestMem);
+ // "*MEMORY @@@@@@ Warning!! @@@@@"
+ fprintf(wfp, "*MEMORY");
+ if (avail * 10 < total) { // (Less than 1/10)
+ fprintf(wfp, " @@@@@@ Warning!! @@@@@\n");
+ } else {
+ fprintf(wfp, " \n");
+ }
+ // "used/avail/total/used max xxx.xMB / xxx.xMB / xxx.xMB(xx.x%) / xxx.xMB
+ used /= 1024;
+ avail /= 1024;
+ total /= 1024;
+ min_remain /= 1024;
+ if (total == 0) {
+ used_rate = 0;
+ } else {
+ used_rate = (uint32_t) (used * 1000 / total);
+ if (used_rate >= 1000) {
+ used_rate = 999;
+ }
+ }
+ fprintf(
+ wfp,
+ " used/avail/total/min remain %5.1fMB / %5.1fMB / %5.1fMB(%2d.%d%%) / %5.1fMB\n",
+ used, avail, total, used_rate / 10, used_rate % 10, min_remain);
+ if (total == 0) {
+ used_letters = 0;
+ } else {
+ used_letters = (uint32_t) (DEBUG_INFO_MEM_LETTERS * used / total);
+ if (used_letters > DEBUG_INFO_MEM_LETTERS) {
+ used_letters = DEBUG_INFO_MEM_LETTERS;
+ }
+ }
+ // "------------------*******"
+ int i;
+ for (i = 0; i < static_cast<int>(used_letters); i++) {
+ fprintf(wfp, "-");
+ }
+ for (; i < DEBUG_INFO_MEM_LETTERS; i++) {
+ fprintf(wfp, "*");
+ }
+ fprintf(wfp, "\n\n");
+
+ return 0;
+}
+// Get top information and Output work
+static int write_cpuinfo_work(FILE *wfp) {
+ int32_t pipe_fd[2]; // 0:stdin,1:stdout
+ pid_t c_pid;
+ char buf[READLINE_MAX_SIZE];
+ int32_t logLine = 0;
+ char* ptr;
+ int32_t ret;
+ int32_t status;
+ int save_0 = -1;
+ int32_t cpu_rate;
+ char fields[12][128];
+ int kill_flag = 1;
+ int waitret;
+
+ // Output CPU load
+ cpu_rate = g_cpuloadRate1000 < 0 ? 0 : g_cpuloadRate1000;
+ fprintf(wfp, "*CPU %2d.%d%%\n", cpu_rate / 10, cpu_rate % 10);
+
+ // Create pipe
+ ret = pipe(pipe_fd);
+
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: pipe error case
+ // LCOV_EXCL_START 5: pipe error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pipe Error");
+ return -1;
+ // LCOV_EXCL_STOP 5: pipe error case
+ }
+
+ // Create child process
+ c_pid = fork();
+ if (c_pid < 0) { // LCOV_EXCL_BR_LINE 5: fork error case
+ // LCOV_EXCL_START 5: fork error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fork Error");
+ close(pipe_fd[0]);
+ close(pipe_fd[1]);
+
+ return -1;
+ // LCOV_EXCL_STOP 5: fork error case
+ }
+
+ if (c_pid == 0) {
+ /*******************************************************
+ * Child process
+ *******************************************************/
+ if (lower_sched_priority(CPULOAD_NICEVAL) == false) { // LCOV_EXCL_BR_LINE 200: lower_sched_priority can't be false
+ // LCOV_EXCL_START 200: lower_sched_priority can't be false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to lower scheduler");
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ close(pipe_fd[0]); // Unneeded pipes (close stdin)
+
+ close(1); // Close stdout
+ dup2(pipe_fd[1], 1); // Duplicate stdout to pipe_fd[1]
+ close(pipe_fd[1]);
+
+ execl("/usr/bin/top", "top", "-n", "1", "-b", NULL);
+ // error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "execl top Error");
+ exit(1);
+ } else {
+ close(pipe_fd[1]); // Unneeded pipes(Close stdout)
+
+ save_0 = dup(0);
+ close(0); // Close stdin
+ dup2(pipe_fd[0], 0); // Duplicate stdin to pipe_fd[0]
+ close(pipe_fd[0]);
+
+ {
+ fd_set fds;
+ int32_t maxFd;
+ int ret;
+ struct timeval tmout = { TOP_TIMEOUT, 0 };
+
+ FD_ZERO(&fds);
+ FD_SET(STDIN_FILENO, &fds);
+ maxFd = STDIN_FILENO;
+ ret = select(maxFd + 1, &fds, NULL, NULL, &tmout);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: select error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "[RESM]Handle Error errno:%d", errno); // LCOV_EXCL_LINE 5: select error case
+ } else if (FD_ISSET(STDIN_FILENO, &fds)) { // LCOV_EXCL_BR_LINE 5: FD_ISSET's error case
+ kill_flag = 0;
+ } else {
+ // LCOV_EXCL_START 5: FD_ISSET's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM]'top': No response during %d seconds", TOP_TIMEOUT);
+ // LCOV_EXCL_STOP
+ }
+ if (kill_flag) { // LCOV_EXCL_BR_LINE 200: kill_flag must be 0
+ // LCOV_EXCL_START 200: kill_flag must be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // Kill top after TOP_TIMEOUT sec
+ // (Killed by child process to avoid making resm process super-user with setuid.)
+ if (kill(c_pid, SIGKILL) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to kill(SIGKILL), pid=%d, errno=%d", (int) c_pid,
+ errno);
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ while (fgets(buf, sizeof(buf), stdin) > 0) {
+ if (logLine == 0) {
+ if (buf[0] != 'C') {
+ continue;
+ }
+ if (strstr(buf, "Cpu(s)") == NULL || strstr(buf, "sy") == NULL) {
+ continue;
+ }
+ logLine++;
+ } else if (logLine == 1) {
+ ptr = strstr(buf, "PID");
+ if (ptr == NULL) {
+ continue;
+ }
+ logLine++;
+ } else if (logLine < (DEBUG_INFO_CPU_TOP_LINES + 2)) {
+ ret = sscanf(buf, "%128s %128s %128s %128s %128s %128s %128s %128s %128s %128s %128s %128s", fields[0],
+ fields[1], fields[2], fields[3], fields[4], fields[5],
+ fields[6], fields[7], fields[8], fields[9], fields[10],
+ fields[11]);
+ fprintf(wfp, "%4s%% %s\n", fields[8], fields[11]);
+ logLine++;
+ }
+ }
+ fprintf(wfp, "\n\n");
+ }
+ }
+ ret = 0;
+ if (kill_flag) { // LCOV_EXCL_BR_LINE 200: kill_flag must be 0
+ // LCOV_EXCL_START 200: kill_flag must be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const struct timespec delay = {1, 0};
+ int i;
+ for (i = 0; i < WAIT_RETRY; i++) {
+ nanosleep(&delay, NULL);
+ if ((waitret = waitpid(c_pid, &status, WNOHANG)) == -1) {
+ ret = -1;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to waitpid for top %d, errno=%d", c_pid, errno);
+ break;
+ } else if (waitret == c_pid) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "waitpid OK");
+ break;
+ }
+ }
+ if (i >= WAIT_RETRY) {
+ ret = -1;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "top Failed to exit, pid=%d", c_pid);
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ if ((waitret = waitpid(static_cast<int>(c_pid), &status, 0)) < 0) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -1;
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "waitpid(%d) Error errno(%d)", c_pid, errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 200: ret must be 0
+ // LCOV_EXCL_START 200: ret must be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "wait Error");
+ if (save_0 >= 0) {
+ close(save_0);
+ }
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+ if (save_0 >= 0) {
+ dup2(save_0, 0); // Reset the stdin to 0
+ close(save_0);
+ }
+ }
+
+ return 0;
+}
+// Get CMA information and Output work
+static int write_cmainfo_work(FILE *wfp) {
+ float total;
+ float avail;
+ float used;
+ float min_remain;
+ uint32_t used_rate;
+ uint32_t used_letters;
+
+ avail = static_cast<float>(cmaFree_kib);
+ total = static_cast<float>(cmaTotal_kib);
+ used = total - avail;
+ min_remain = static_cast<float>(minRestCma);
+ // "*CMA MEMORY @@@@@@ Warning!! @@@@@"
+ fprintf(wfp, "*CMA MEMORY");
+ if (used * 5 > total * 4) { // (4/5 Or more)
+ fprintf(wfp, " @@@@@@ Warning!! @@@@@\n");
+ } else {
+ fprintf(wfp, " \n");
+ }
+ // "used/avail/total xxx.xMB / xxx.xMB / xxx.xMB(xx.x%)
+ used /= 1024;
+ avail /= 1024;
+ total /= 1024;
+ min_remain /= 1024;
+ if (total != 0) {
+ used_rate = (uint32_t) (used * 1000 / total);
+ } else {
+ used_rate = 0;
+ }
+ if (used_rate >= 1000) {
+ used_rate = 999;
+ }
+ fprintf(
+ wfp,
+ " used/avail/total/min remain %5.1fMB / %5.1fMB / %5.1fMB(%2d.%d%%) / %5.1fMB\n",
+ used, avail, total, used_rate / 10, used_rate % 10, min_remain);
+ if (total == 0) {
+ used_letters = 0;
+ } else {
+ used_letters = (uint32_t) (DEBUG_INFO_CMA_LETTERS * used / total);
+ if (used_letters > DEBUG_INFO_CMA_LETTERS) {
+ used_letters = DEBUG_INFO_CMA_LETTERS;
+ }
+ }
+ // "------------------*******"
+ int i;
+ for (i = 0; i < static_cast<int>(used_letters); i++) {
+ fprintf(wfp, "-");
+ }
+ for (; i < DEBUG_INFO_CMA_LETTERS; i++) {
+ fprintf(wfp, "*");
+ }
+ fprintf(wfp, "\n\n");
+
+ return 0;
+}
+// Write information and Output FRAMEWORKUNIFIEDLOG
+static int write_resourcemanagerloginfo_work(void) {
+ FILE *wfp;
+ char l_read[READLINE_MAX_SIZE];
+ int ret;
+
+ wfp = fopen(DEBUG_INFO_FPATH, "r");
+ if (wfp == NULL) { // LCOV_EXCL_BR_LINE 5: fopen error case
+ // LCOV_EXCL_START 5: fopen case error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open %s, errno=%d",
+ DEBUG_INFO_FPATH,
+ errno);
+ return -1;
+ // LCOV_EXCL_STOP 5: fopen case error
+ }
+ while (1) {
+ if (fgets(l_read, READLINE_MAX_SIZE, wfp) == NULL) {
+ ret = feof(wfp);
+ if (ret == 0) { // LCOV_EXCL_BR_LINE 5: feof case error
+ // LCOV_EXCL_START 5: feof case error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "Failed to fgets %s",
+ DEBUG_INFO_FPATH);
+ // LCOV_EXCL_STOP 5: feof case error
+ }
+ break;
+ } else {
+ char *line;
+ line = strchr(l_read, '\n');
+ if (line != NULL) {
+ *line = '\0';
+ }
+ if (l_read[0] != '\0') {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "%s", l_read);
+ }
+ }
+ }
+ fclose(wfp);
+ return 0;
+}
diff --git a/systemservice/resource_manager/server/src/resourcemanager_application.cpp b/systemservice/resource_manager/server/src/resourcemanager_application.cpp
new file mode 100755
index 0000000..225160b
--- /dev/null
+++ b/systemservice/resource_manager/server/src/resourcemanager_application.cpp
@@ -0,0 +1,155 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+#include "ss_resm_resourcemanagerlog.h"
+#include "system_service/resm_type.h"
+
+extern void FlushMemInfo(void);
+
+// Called at process startup
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+ *
+ * System callbacks that applications should address.
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // API to Register Notification for Service Availability.
+ eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hApp, NTFY_ResourceMgr_Availability);
+ if (eFrameworkunifiedStatusOK != eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to Register Service Availability Notification:%s",
+ NTFY_ResourceMgr_Availability);
+ return eStatus;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ // API to Publish Service Availability Notification.
+ eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE);
+ if (eFrameworkunifiedStatusOK != eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to Publish Service Availability Notification:0x%x", eStatus);
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+// Called at process termination
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnDestroy
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) { // LCOV_EXCL_START 14 Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP 14 Resident process, not called by NSFW
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnDebugDump
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp) { //LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//LCOV_EXCL_STOP 7:debug code
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FlushMemInfo();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 8: not use StateMachine
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP 8: not use StateMachine
+// EOF
diff --git a/systemservice/rom_access_library/LICENSE b/systemservice/rom_access_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/systemservice/rom_access_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/systemservice/rom_access_library/Makefile.client b/systemservice/rom_access_library/Makefile.client
new file mode 100755
index 0000000..adb1845
--- /dev/null
+++ b/systemservice/rom_access_library/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS += library mock
+
+include ../system_service.mk
diff --git a/systemservice/rom_access_library/library/Makefile b/systemservice/rom_access_library/library/Makefile
new file mode 100755
index 0000000..e8c64b2
--- /dev/null
+++ b/systemservice/rom_access_library/library/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := nor rom
+
+include ../../system_service.mk
diff --git a/systemservice/rom_access_library/library/include/rom_access_library_nor.h b/systemservice/rom_access_library/library/include/rom_access_library_nor.h
new file mode 100755
index 0000000..417b78f
--- /dev/null
+++ b/systemservice/rom_access_library/library/include/rom_access_library_nor.h
@@ -0,0 +1,43 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file rom_access_library_nor.h
+ * @brief This file include the head file of nor access
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_NOR_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_NOR_H_
+
+#include "system_service/nor_backup.h"
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_NOR_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/rom_access_library/library/include/rom_access_library_rom.h b/systemservice/rom_access_library/library/include/rom_access_library_rom.h
new file mode 100755
index 0000000..1e02e6e
--- /dev/null
+++ b/systemservice/rom_access_library/library/include/rom_access_library_rom.h
@@ -0,0 +1,45 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file rom_access_library_rom.h
+ * @brief This file include all head file of rom access
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_ROM_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_ROM_H_
+
+#include "system_service/ss_sm_rom_access.h"
+#include "system_service/ss_sm_boot_access.h"
+#include "system_service/ss_sm_ram_access.h"
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_ROM_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/rom_access_library/library/include/ss_rom_access_define.h b/systemservice/rom_access_library/library/include/ss_rom_access_define.h
new file mode 100755
index 0000000..689fea2
--- /dev/null
+++ b/systemservice/rom_access_library/library/include/ss_rom_access_define.h
@@ -0,0 +1,38 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_DEFINE_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_DEFINE_H_
+
+#include <errno.h>
+
+#define ROM_ACCESS_ASERT(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT"); \
+ }
+
+#define ROM_ACCESS_ERRNO(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT %d:%s", errno, strerror(errno)); \
+ }
+
+#define ROM_ACCESS_STATIC_ASERT(expr) \
+ { \
+ char STATIC_ASSERTION_FAILED[(expr) ? 1 : -1]; \
+ (void)STATIC_ASSERTION_FAILED; \
+ }
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_DEFINE_H_
diff --git a/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h b/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h
new file mode 100755
index 0000000..e62b5af
--- /dev/null
+++ b/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_RomAccess
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_IF_ROMACCESSLIBRARYLOG_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_IF_ROMACCESSLIBRARYLOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+// #define ZONE_WARN ZONEMASK(30)
+// #define ZONE_ERR ZONEMASK(31)
+
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, WARN
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern const CHAR kAppName[];
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_IF_ROMACCESSLIBRARYLOG_H_
diff --git a/systemservice/rom_access_library/library/include/ss_sm_checksum.h b/systemservice/rom_access_library/library/include/ss_sm_checksum.h
new file mode 100755
index 0000000..271964c
--- /dev/null
+++ b/systemservice/rom_access_library/library/include/ss_sm_checksum.h
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides for checksum calculation.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_SM_CHECKSUM_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_SM_CHECKSUM_H_
+
+#include <native_service/frameworkunified_types.h>
+class CSMChecksum {
+ public:
+ CSMChecksum();
+ ~CSMChecksum();
+ UI_32 cal_checksum(const void* p_buf, size_t buf_size);
+
+ private:
+};
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_SM_CHECKSUM_H_
diff --git a/systemservice/rom_access_library/library/include/system_service/nor_backup.h b/systemservice/rom_access_library/library/include/system_service/nor_backup.h
new file mode 100755
index 0000000..8c95a10
--- /dev/null
+++ b/systemservice/rom_access_library/library/include/system_service/nor_backup.h
@@ -0,0 +1,212 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file nor_backup.h
+ * @brief This file provides API for get nor flash information
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_NOR_BACKUP_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_NOR_BACKUP_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+#if defined(__cplusplus)
+extern "C" {
+#endif // __cplusplus
+
+/**
+ * \~english Common return value: Normal return value of API
+ */
+#define RET_DEV_NORMAL 0
+
+/**
+ * \~english Common return value: Parameter error return value of API
+ */
+#define RET_DEV_ERR_PARAM 3
+
+/**
+ * \~english Common return value: Error of getting device info
+ */
+#define RET_DEV_ERROR 4
+
+/**
+ * \~english Read API return value: Internal error
+ */
+#define RET_DEV_RD_ERR_OTHER 1
+
+/**
+ * \~english Read API return value: Acquire buffer error(malloc)
+ */
+#define RET_DEV_RD_ERR 2
+
+/**
+ * \~english Read API return value: error type 1
+ */
+#define RET_DEV_RD_ERR_1 -1
+
+/**
+ * \~english Read API return value: error type 2
+ */
+#define RET_DEV_RD_ERR_2 -2
+
+/**
+ * \~english Read API return value: error type 3
+ */
+#define RET_DEV_RD_ERR_3 -3
+
+/**
+ * \~english Read API return value: error type 4
+ */
+#define RET_DEV_RD_ERR_4 -4
+
+/**
+ * \~english Write API return value: Other error
+ */
+#define RET_DEV_WT_ERR_OTHER 1
+
+/**
+ * \~english Write API return value: Internal error
+ */
+#define RET_DEV_WT_ERR 2
+
+/**\ingroup mtdn_backup_Read
+ * \~english @par Brief
+ * Read data from norflash device.
+ * \~english @param [in] path_name
+ * const char* - Device path to read(such as "/dev/mtd1ro")
+ * \~english @param [in] i_id
+ * int - Main block ID(0, 2, 4, ...)
+ * \~english @param [in] i_offset
+ * int - Data offset
+ * \~english @param [in] i_size
+ * int - Data size to read
+ * \~english @param [in] p_buff
+ * Void* - Buffer for storing read data
+ * \~english @retval RET_DEV_NORMAL OK
+ * \~english @retval RET_DEV_ERROR Get device error
+ * \~english @retval RET_DEV_ERR_PARAM Parameter error
+ * \~english @retval RET_DEV_RD_ERR_OTHER Internal error
+ * \~english @retval RET_DEV_RD_ERR Acquire buffer error(malloc)
+ * \~english @retval RET_DEV_RD_ERR_1 Error type 1
+ * \~english @retval RET_DEV_RD_ERR_2 Error type 2
+ * \~english @retval RET_DEV_RD_ERR_3 Error type 3
+ * \~english @retval RET_DEV_RD_ERR_4 Error type 4
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Parameter path_name is NULL. [RET_DEV_ERR_PARAM]
+ * - Parameter p_buff is NULL. [RET_DEV_ERR_PARAM]
+ * - Value of parameter i_id is less than 0. [RET_DEV_ERR_PARAM]
+ * - Value of parameter i_offset is less than 0 or value of parameter i_size
+ * is not greater than 0. [RET_DEV_ERR_PARAM]
+ * - Device specified by path_name is invalid. [RET_DEV_ERR_PARAM]
+ * - Sum value of i_offset and i_size is greater than block size - 16byte.
+ * [RET_DEV_ERR_PARAM]
+ * - Failed to get device info. [RET_DEV_ERROR]
+ * - Failed to acquire the send/receive buffer(malloc). [RET_DEV_RD_ERR]
+ * - Internal IO error(open, read, close, ioctl, lseek, other error).
+ * [RET_DEV_RD_ERR_OTHER]
+ * - Check text error of main block and backup block. [RET_DEV_RD_ERR_1]
+ * - Check text error of main block and checksum error of backup block.
+ * [RET_DEV_RD_ERR_2]
+ * - Checksum error of main block and check text error of backup block.
+ * [RET_DEV_RD_ERR_3]
+ * - Checksum error of main block and backup block. [RET_DEV_RD_ERR_4]
+ * \~english @par Detail
+ * - This API gets data from main or backup block according to specified\n
+ * norflash device pathname and main block ID.
+ * \~english @par
+ * - When this API is executed, read data from main block first. If failed to\n
+ * read main block, return RET_DEV_RD_ERR_OTHER. If read main block success,\n
+ * but check main block data error, turn to read data from backup block which\n
+ * block ID is i_id + 1.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync Only
+ * \~english @see mtdn_backup_Write
+ */
+int mtdn_backup_Read(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff);
+
+/**\ingroup mtdn_backup_Write
+ * \~english @par Brief
+ * Write data to norflash device.
+ * \~english @param [in] path_name
+ * const char* - Device path to write(such as "/dev/mtd")
+ * \~english @param [in] i_id
+ * int - Main block ID(0, 2, 4, ...)
+ * \~english @param [in] i_offset
+ * int - Data offset
+ * \~english @param [in] i_size
+ * int - Data size to write
+ * \~english @param [in] p_buff
+ * Void* - Buffer for storing written data
+ * \~english @retval RET_DEV_NORMAL OK
+ * \~english @retval RET_DEV_ERROR Get device error
+ * \~english @retval RET_DEV_ERR_PARAM Parameter error
+ * \~english @retval RET_DEV_WT_ERR_OTHER Other error
+ * \~english @retval RET_DEV_WT_ERR Internal error
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Parameter path_name is NULL. [RET_DEV_ERR_PARAM]
+ * - Parameter p_buff is NULL. [RET_DEV_ERR_PARAM]
+ * - Value of parameter i_id is less than 0. [RET_DEV_ERR_PARAM]
+ * - Value of parameter i_offset is less than 0 or value of parameter i_size
+ * is not greater than 0. [RET_DEV_ERR_PARAM]
+ * - Device specified by path_name is invalid. [RET_DEV_ERR_PARAM]
+ * - Sum value of i_offset and i_size is greater than block size - 16byte.
+ * [RET_DEV_ERR_PARAM]
+ * - Failed to get device info. [RET_DEV_ERROR]
+ * - Internal processing error(Other error). [RET_DEV_WT_ERR_OTHER]
+ * - Internal IO error(open, write, close, ioctl, malloc, lseek).
+ * [RET_DEV_WT_ERR]
+ * \~english @par Detail
+ * - This API writes data to main and backup blocks according to specified\n
+ * norflash device pathname and main block ID.
+ * \~english @par
+ * - When this API is executed, p_buff data will be write to main and backup\n
+ * blocks. If failed to write any block, return RET_DEV_WT_ERR.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync Only
+ * \~english @see mtdn_backup_Read
+ */
+int mtdn_backup_Write(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff);
+
+#if defined(__cplusplus)
+}
+#endif // __cplusplus
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_NOR_BACKUP_H_
diff --git a/systemservice/rom_access_library/library/include/system_service/rom_access_library.h b/systemservice/rom_access_library/library/include/system_service/rom_access_library.h
new file mode 100755
index 0000000..50e44b1
--- /dev/null
+++ b/systemservice/rom_access_library/library/include/system_service/rom_access_library.h
@@ -0,0 +1,47 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file rom_access_library.h
+ * @brief This file include all head file of rom and nor access library
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SYSTEMSERVICE_ROMACCESSLIBRARY_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_ROMACCESSLIBRARY_H_
+
+#include "system_service/nor_backup.h"
+
+#include "system_service/ss_sm_rom_access.h"
+#include "system_service/ss_sm_boot_access.h"
+#include "system_service/ss_sm_ram_access.h"
+
+#endif // SYSTEMSERVICE_ROMACCESSLIBRARY_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h b/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h
new file mode 100755
index 0000000..bac051c
--- /dev/null
+++ b/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h
@@ -0,0 +1,362 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_boot_access.h
+ * @brief This file provides API for get boot information from nor flash
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_BOOT_ACCESS_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_BOOT_ACCESS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+// Top memory map of LINUX management outside domain (SYS area)
+// Must not use it other than the model of C language specifications to refer to BOOT
+
+#define LBM_UINT32 unsigned int
+#define LBM_UINT16 uint16_t
+#define LBM_UINT8 unsigned char
+#define LBM_INT64 int64_t
+#define LBM_INT32 unsigned int
+#define LBM_INT16 uint16_t
+#define LBM_INT8 unsigned char
+
+// Each domain size
+#define LBM_NOR_MIRROR_SIZE 0x10000 // MIRROR area of NOR
+#define LBM_DRAM_SIZE 0x10000 // RAM area to share with BOOT in LINUX
+
+#define LBM_NOR_BOOT_SIZE 128
+#define LBM_NOR_TSKM_SIZE 128
+#define LBM_NOR_VUP_SIZE 1024
+#define LBM_NOR_ANA_SIZE 32
+#define LBM_NOR_VEHI_SIZE 32
+#define LBM_NOR_DEVMGR_SIZE 32
+
+
+//********* Value of the field ****************
+/* SDRAMstart identification */
+#define SYSUP_DRAM_NORMAL (LBM_UINT32)0x4E524E52 /* normal value NRNR*/
+#define SYSUP_DRAM_SFTERRSR (LBM_UINT32)0x73667366 /* abnormal Soft Reset(softwareabnormality) sfsf*/
+#define SYSUP_DRAM_DISCARD (LBM_UINT32)0x44434443 /* need to discard backup DCDC*/
+
+/* Start is in a state (navigator initial use)/System start state */
+#define SYSUP_CND_FACTRESET (LBM_UINT16)0x434c /* COLD START */
+#define SYSUP_CND_NORMAL (LBM_UINT16)0x4853 /* HOT START */
+
+/* Start mode preservation table level */
+#define SYSUP_MODE_NORMAL (LBM_UINT32)0x4E524E52 /* normal mode */
+#define SYSUP_MODE_VERUP (LBM_UINT32)0x56555655 /* versionup mode */
+
+/* Communication state between NAVI-SYS */
+#define SUBCPU_STS_NOMAL (LBM_UINT32)0x00000000 /* Communication normal */
+#define SUBCPU_STS_COMNG (LBM_UINT32)0x88888888 /* Communication abnormal */
+
+/* SDRAM power supply abnormality detection */
+#define SDRAM_STS_NOMAL (LBM_UINT32)0x11111111 /* backup power supply is normal */
+#define SDRAM_STS_BUPNG (LBM_UINT32)0x99999999 /* backup power supply is abnormal */
+
+/* HWDT Outbreak */
+#define HWDT_STS_NOMAL (LBM_UINT32)0x22222222 /* WDT normal */
+#define HWDT_STS_WDTTO (LBM_UINT32)0xAAAAAAAA /* WDT time-out outbreak */
+
+/* SWDT Outbreak */
+#define SWDT_STS_NOMAL HWDT_STS_NOMAL /* SWDT normal */
+#define SWDT_STS_WDTTO HWDT_STS_WDTTO /* SWDT time-out outbreak */
+
+/* Start side */
+#define IFS_PROG1_CODE (LBM_UINT8)0xAA /* Side PROG1 */
+#define IFS_PROG2_CODE (LBM_UINT8)0x55 /* Side PROG2 */
+
+/* Start infomation ID */
+#define UPTBLE_ID_MAX (LBM_UINT8)0x20 /* LBM_UPTBLINFO Maximum value */
+#define UPTBLE_ID_NORBOOT (LBM_UINT8)0x00 /* NOR-BOOT ID */
+#define UPTBLE_ID_SCRLDR (LBM_UINT8)0x01 /* SecureLoader ID */
+#define UPTBLE_ID_NANDBOOT (LBM_UINT8)0x02 /* NAND-BOOT ID */
+#define UPTBLE_ID_ROOTFS (LBM_UINT8)0x03 /* Rootfs1 ID */
+#define UPTBLE_ID_ROOTFS2 (LBM_UINT8)0x04 /* Rootfs2 ID */
+
+/* Start status */
+#define STUP_STS_NORMAL (LBM_UINT32)0x00000000 /* normal status */
+/* Rollback of protectionism is necessary by abnormal reset repetition */
+#define STUP_STS_ERROR_DETEC (LBM_UINT32)0x22222222
+#define STUP_STS_UPDATING (LBM_UINT32)0x33333333 /* updating status */
+/* not for use(will be removed) */
+#define STUP_STS_SIGNVRFY_ERROR (LBM_UINT32)0x11111111
+
+/* mdUpdate/sdUpdate */
+#define UPDATE_NOTI_NONE (LBM_UINT32)0x00000000 /* Notify is NOT required. */
+#define UPDATE_NOTI_EXIST (LBM_UINT32)0xEEEEEEEE /* Notify is required. */
+
+/* RAM Judge Flag */
+#define RAMJUDGE_STS_NOMAL (LBM_UINT32)0x44444444 /* RAM Judge Port is High */
+#define RAMJUDGE_STS_NG (LBM_UINT32)0xDDDDDDDD /* RAM Judge Port is Low */
+
+/* DRAM Self Refresh */
+#define SELF_REFRESH_OK (LBM_UINT32)0x55555555 /* DRAM Self Refresh is OK */
+#define SELF_REFRESH_NG (LBM_UINT32)0xCCCCCCCC /* DRAM Self Refresh is NG */
+
+/* Release ROM type */
+#define PRODUCTROM (LBM_UINT32)0x11111111
+#define RELEASEROM (LBM_UINT32)0x22222222
+#define RELEASEROM_REMAIN_USBBOOT (LBM_UINT32)0x44444444
+#define DEBUGROM (LBM_UINT32)0x88888888
+
+/* Boot write Nor */
+#define WRITE_NONE (LBM_UINT32)0x00000000
+#define WRITE_DONE (LBM_UINT32)0x11111111
+
+
+/* opdtLoadSatus */
+#define DEFAULT_OPIMAGE_DRAM_BACKUPED (LBM_UINT32)0x00000000
+#define DEFAULT_OPIMAGE_FROM_EMMC (LBM_UINT32)0xAAAAAAAA
+#define SPECIFIC_OPIMAGE_DRAM_BACKUPED (LBM_UINT32)0x11111111
+#define SPECIFIC_OPIMAGE_FROM_EMMC (LBM_UINT32)0xBBBBBBBB
+
+/* opdtLoadFactor */
+#define SPECIFIC_OPIMAGE_FLAG_NONE (LBM_UINT32)0x00000000
+#define SPECIFIC_OPIMAGE_FILE_NONE (LBM_UINT32)0x11111111
+#define SPECIFIC_OPIMAGE_FILESIZE_0 (LBM_UINT32)0x22222222
+#define SPECIFIC_OPIMAGE_FILE_EXIST (LBM_UINT32)0xEEEEEEEE
+
+
+#pragma pack(push, 4)
+
+// Memory map of the SYS area of the mem0
+
+#define SS_SYS_AREA_BOOT_MAX_SIZE (0x00010000UL)
+
+#define SS_SYS_AREA_ROM_OFFSET (0x00010000UL)
+#define SS_SYS_AREA_ROM_MAX_SIZE (0x00001000UL)
+
+#define SS_SYS_AREA_RAM_OFFSET (0x00011000UL)
+#define SS_SYS_AREA_RAM_MAX_SIZE (0x00001000UL)
+
+//********* NOR area ****************
+typedef struct LBM_boot_wpinfo_t {
+ LBM_UINT32 currentside; // IFS_PROG*_CODE
+ LBM_UINT32 stupStsA; // STUP_STS_*
+ LBM_UINT32 stupStsB; // STUP_STS_*
+}LBM_UPTBLINFO;
+
+typedef struct LBM_boot_t {
+ LBM_UINT32 sts1; // SYSUP_CND_*
+ LBM_UINT32 btmode; // SYSUP_MODE_*
+ LBM_UINT32 sts2; // SYSUP_CND_*
+ LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX];
+ LBM_UINT32 sts3; // SYSUP_CND_*
+}LBM_NOR_t;
+
+//********* DRAM area ****************
+typedef struct _tmb_ram_t {
+ LBM_UINT32 dram1; // SYSUP_DRAM_*
+ LBM_UINT32 sts; // SYSUP_CND_*
+ LBM_UINT32 upmode; // SYSUP_MODE_*
+ LBM_UINT32 dram2; // SYSUP_DRAM_*
+ LBM_UINT32 syscomSts; // SUBCPU_STS_*
+ LBM_UINT32 pwSts; // SDRAM_STS_*
+ LBM_UINT32 hwdtSts; // HWDT_STS_*
+ LBM_UINT32 dram3; // SYSUP_DRAM_*
+ LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX];
+ LBM_UINT32 sectorNo; // NOR Shared SectorNo
+ LBM_UINT32 mdUpdate; // UPDATE_NOTI_* LanServer Update Notification
+ LBM_UINT32 sdUpdate; // UPDATE_NOTI_* SettingService Update Notification
+ LBM_UINT32 ramjudgeSts; // RAMJUDGE_STS_*
+ LBM_UINT32 swdtSts; // SWDT_STS_*
+ LBM_UINT32 dram_self_refresh; // DRAM Self Refresh
+ LBM_UINT32 releaseNorType;
+ LBM_UINT32 socCpuType; // H2/E2/M2
+ LBM_UINT32 socEsNumber; // ES1x/ES2x/ES3x
+ LBM_UINT32 spiBootDevice; // NorDeviceID
+ LBM_UINT32 bootNorWrite; // uboot-api
+ LBM_UINT32 naviDetFactor;
+
+ LBM_UINT32 emmcTap; //emmcTap
+ LBM_UINT32 opdtUpdateReq;
+ LBM_UINT32 opdtLoadSatus;
+ LBM_UINT32 opdtLoadFactor;
+
+}LBM_RAM_t;
+
+#pragma pack(pop)
+
+
+/**
+* \~english Access type to the boot information
+*/
+typedef enum {
+ BAI_OPEN_RO, /* \~english Access type for the Read only*/
+ BAI_OPEN_RW /* \~english Access type for the Read and Write*/
+}BAI_OPEN_t;
+
+/**
+ * @class BOOT_AccessIf
+ * \~english @brief BOOT_AccessIf
+ * \~english @par Brief Introduction
+ * Class to provide the function of BOOT AccessIf
+ *
+ */
+class BOOT_AccessIf{
+ private:
+ static void* g_m_plock;
+ BAI_OPEN_t m_type;
+
+ public:
+ /**
+ * \ingroup BOOT_AccessIf
+ * \~english @par Summary:
+ * Obtain the access permission to the boot information (secondary storage area).
+ * \~english @param [in] type
+ * BAI_OPEN_t - Access type to the boot information\n
+ * \~english @par
+ * BAI_OPEN_t
+ * - BAI_MTD_DEV_RO Access type for the Read only \n
+ * - BAI_MTD_DEV_RW Access type for the Read and Write
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * None
+ * \~english @par Detail:
+ * Obtain the access permission to the boot information \n
+ * When the access permission is locked, the API waits for Mutex until the access permission is released. \n
+ * This API is assumed to be called by SystemManager.
+ * \~english @see ~BOOT_AccessIf, CL_LockMap, CL_LockGet
+ */
+explicit BOOT_AccessIf(BAI_OPEN_t type);
+
+ /**
+ * \ingroup ~BOOT_AccessIf
+ * \~english @par Summary:
+ * Release the access permission to the boot information (secondary storage area).
+ * \~english @param None
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * None
+ * \~english @par Detail:
+ * Release the access permission to the boot information.\n
+ * \~english @see BOOT_AccessIf, CL_LockRelease
+ */
+ ~BOOT_AccessIf();
+
+/**
+ * \ingroup getBootInfo
+ * \~english @par Summary:
+ * Read the boot information (secondary storage area).
+ * \~english @param [out] p_boot_info
+ * LBM_NOR_t * - Destination buffer to read the boot information
+ * \~english @par
+ * LBM_NOR_t Structure body
+ * \~english @code
+ * typedef struct LBM_boot_t{
+ * LBM_UINT32 sts1; //SYSUP_CND_*
+ * LBM_UINT32 btmode; //SYSUP_MODE_*
+ * LBM_UINT32 sts2; //SYSUP_CND_*
+ * LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX];
+ * LBM_UINT32 sts3; //SYSUP_CND_*
+ * }LBM_NOR_t;
+ * @endcode
+ * Refer to "ss_boot_map.h" for the parameters to be set to the member of struct LBM_NOR_t.
+ * \~english @retval eFrameworkunifiedStatusOK Reading success
+ * \~english @retval eFrameworkunifiedStatusFail Reading failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If p_boot_info is NULL [eFrameworkunifiedStatusFail]
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Copy the boot information stored in the secondary storage area to p_boot_info. \n
+ * \~english @see setBootInfo
+ */
+ EFrameworkunifiedStatus getBootInfo(LBM_NOR_t* p_boot_info);
+
+ /**
+ * \ingroup setBootInfo
+ * \~english @par Summary:
+ * Write the boot information (secondary storage area).
+ * \~english @param [in] p_boot_info
+ * LBM_NOR_t * - Original buffer to write the boot information
+ * \~english @par
+ * LBM_NOR_tStructure body
+ * \~english @code
+ * typedef struct LBM_boot_t{
+ * LBM_UINT32 sts1; //SYSUP_CND_*
+ * LBM_UINT32 btmode; //SYSUP_MODE_*
+ * LBM_UINT32 sts2; //SYSUP_CND_*
+ * LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX];
+ * LBM_UINT32 sts3; //SYSUP_CND_*
+ * }LBM_NOR_t;
+ * @endcode
+ * Refer to "ss_boot_map.h" for the parameters to be set to the member of struct LBM_NOR_t.
+ * \~english @retval eFrameworkunifiedStatusOK Write success
+ * \~english @retval eFrameworkunifiedStatusFail Write failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If p_boot_info is NULL [eFrameworkunifiedStatusFail]
+ * - BOOT_AccessIf Opened secondary storage area with BAI_MTD_DEV_RO [eFrameworkunifiedStatusFail]
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Write the boot information stored in p_boot_info to the secondary storage area. \n
+ * \~english @see getBootInfo
+ */
+ EFrameworkunifiedStatus setBootInfo(LBM_NOR_t* p_boot_info);
+};
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_BOOT_ACCESS_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h b/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h
new file mode 100755
index 0000000..f96966b
--- /dev/null
+++ b/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h
@@ -0,0 +1,235 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_ram_access.h
+ * @brief This file provides API for get ram information from extension memory
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_RAM_ACCESS_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_RAM_ACCESS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+/**
+ * \~english max length of ram product private
+ */
+#define RAM_PRODUCT_PRIVATE_MAX (96)
+/**
+ * \~english max length of order file name
+ */
+#define SS_SM_ORDER_NAME_MAX (32)
+
+/**
+ * \~english System management information
+ */
+typedef struct {
+ char signature_in[4];
+ BOOL isImmediateReset;
+ BOOL needRenotifyStartPrm;
+ uint32_t lastWakeupType;
+ uint32_t lastDramBackupStatus;
+ uint32_t lastResetStatus;
+ char productPrivate[RAM_PRODUCT_PRIVATE_MAX];
+ char order_name[SS_SM_ORDER_NAME_MAX];
+ BOOL isErrorReset;
+ char signature_out[4];
+}RAM_SM_INFO_t;
+
+/**
+ * \~english System wakeup state type
+ */
+typedef enum {
+ RAM_WAKEUP_STATE_DONT_CARE = 0, /* \~english Don't care wakeup state*/
+ RAM_WAKEUP_STATE_BACKUP_NG, /* \~english Wakeup state is backup NG*/
+ RAM_WAKEUP_STATE_BATTERY_DOWN /* \~english Wakeup state is battery down*/
+}RAM_WAKEUP_STATE;
+
+/**
+ * @class RAM_AccessIf
+ * \~english @brief RAM_AccessIf
+ * \~english @par Brief Introduction
+ * Class to provide the function of RAM AccessIf
+ *
+ */
+class RAM_AccessIf{
+ private:
+ static void* g_m_plock;
+ static void* g_m_bakup_map;
+ static bool g_m_is_first_access;
+ RAM_SM_INFO_t m_buf;
+ bool m_dirty;
+ void initRamBackupEnable(RAM_WAKEUP_STATE wup_state);
+ void finalRamBackupEnable(void);
+
+ public:
+/**
+ * \ingroup RAM_AccessIf
+ * \~english @par Summary:
+ * Obtain the access permission to the system management information.
+ * \~english @param [in] wup_state
+ * RAM_WAKEUP_STATE - System maneger wakeup state type
+ * \~english @par
+ * RAM_WAKEUP_STATE
+ * - RAM_WAKEUP_STATE_DONT_CARE Don't care wakeup state\n
+ * - RAM_WAKEUP_STATE_BACKUP_NG Wakeup state is backup NG\n
+ * - RAM_WAKEUP_STATE_BATTERY_DOWN Wakeup state is battery down
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * None
+ * \~english @par Detail:
+ * Obtain the access permission to the system management information \n
+ * When the access permission is locked, the API waits for Mutex until the access permission is released. \n
+ * This API is supposed to be called by SystemManager.
+ * \~english @see ~RAM_AccessIf, CL_LockMap, CL_LockGet
+ */
+explicit RAM_AccessIf(RAM_WAKEUP_STATE wup_state = RAM_WAKEUP_STATE_DONT_CARE);
+
+/**
+ * \ingroup ~RAM_AccessIf
+ * \~english @par Summary:
+ * Release the access permission to the system management information.
+ * \~english @param None
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * None
+ * \~english @par Detail:
+ * Release the access permission to the system management information.\n
+ * \~english @see RAM_AccessIf, CL_LockRelease
+ */
+ ~RAM_AccessIf();
+
+/**
+ * \ingroup getRamInfo
+ * \~english @par Summary:
+ * Read the system management information.
+ * \~english @param [out] p_boot_info
+ * RAM_SM_INFO_t * - Destination buffer to read the system management information.
+ * \~english @par
+ * RAM_SM_INFO_t Structure body
+ * \~english @code
+ * typedef struct {
+ * char signature_in[4];
+ * BOOL isImmediateReset;
+ * BOOL needRenotifyStartPrm;
+ * uint32_t lastWakeupType;
+ * uint32_t lastDramBackupStatus;
+ * uint32_t lastResetStatus;
+ * char productPrivate[RAM_PRODUCT_PRIVATE_MAX];
+ * char order_name[SS_SM_ORDER_NAME_MAX];
+ * BOOL isErrorReset;
+ * char signature_out[4];
+ * }RAM_SM_INFO_t;
+ * @endcode
+ * \~english @retval eFrameworkunifiedStatusOK Reading success
+ * \~english @retval eFrameworkunifiedStatusFail Reading failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If p_boot_info is NULL [eFrameworkunifiedStatusFail]
+ * - If read data from secondary storage area or /nv/BS/ss/rom_access_library/rwdata/ramdata.dat
+ * failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Copy the system information stored in the secondary storage area or
+ * in /nv/BS/ss/rom_access_library/rwdata/ramdata.dat to p_boot_info. \n
+ * \~english @see setRamInfo
+ */
+ EFrameworkunifiedStatus getRamInfo(RAM_SM_INFO_t* p_boot_info);
+
+/**
+ * \ingroup setRamInfo
+ * \~english @par Summary:
+ * Write the system management information.
+ * \~english @param [in] p_boot_info
+ * RAM_SM_INFO_t * - Original buffer to write the system management information
+ * \~english @par
+ * RAM_SM_INFO_t Structure body
+ * \~english @code
+ * typedef struct {
+ * char signature_in[4];
+ * BOOL isImmediateReset;
+ * BOOL needRenotifyStartPrm;
+ * uint32_t lastWakeupType;
+ * uint32_t lastDramBackupStatus;
+ * uint32_t lastResetStatus;
+ * char productPrivate[RAM_PRODUCT_PRIVATE_MAX];
+ * char order_name[SS_SM_ORDER_NAME_MAX];
+ * BOOL isErrorReset;
+ * char signature_out[4];
+ * }RAM_SM_INFO_t;
+ * @endcode
+ * \~english @retval eFrameworkunifiedStatusOK Write success
+ * \~english @retval eFrameworkunifiedStatusFail Write failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If p_boot_info is NULL [eFrameworkunifiedStatusFail]
+ * - If write data to secondary storage area or /nv/BS/ss/rom_access_library/rwdata/ramdata.dat
+ * failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Write the system manegement information stored in p_boot_info to the
+ * secondary storage area or /nv/BS/ss/rom_access_library/rwdata/ramdata.dat. \n
+ * \~english @see getRamInfo
+ */
+ EFrameworkunifiedStatus setRamInfo(RAM_SM_INFO_t* p_boot_info);
+};
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_RAM_ACCESS_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h b/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h
new file mode 100755
index 0000000..4ba1a76
--- /dev/null
+++ b/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h
@@ -0,0 +1,1010 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_rom_access.h
+ * @brief This file provides API for get rom information from extension memory
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_ROM_ACCESS_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_ROM_ACCESS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+#include "system_service/ss_sm_boot_access.h"
+
+/**
+ * \~english boot mode information
+ */
+typedef enum {
+ APPLICATION_MODE = 0,
+ PROGRAMMING_MODE
+}EBOOT_MODE;
+
+/**
+ * \~english active flash load information
+ */
+typedef enum {
+ NEW_FLASHLOADER = 0,
+ OLD_FLASHLOADER
+}EACTIVE_FLASHLOADER;
+
+/**
+ * \~english user mode information
+ */
+typedef enum {
+ USER_OFF = 0,
+ USER_ON
+}EUSER_MODE;
+
+/**
+ * \~english control mode information
+ */
+typedef enum {
+ DISABLE_MODE = 0,
+ ENABLE_MODE
+}ECONTROL_MODE;
+
+/**
+ * \~english data reset mode information
+ */
+typedef enum {
+ DATARESET_NONE = 0,
+ DATARESET_USER,
+ DATARESET_FACTORY
+}EDATARESET_MODE;
+
+/**
+ * \~english last illegal reset mode information
+ */
+typedef enum {
+ LAST_ILGRESET_NORMAL = 0,
+ LAST_ILGRESET_NG
+}ELASTILGRESET_MODE;
+
+/**
+ * \~english Program update state information
+ */
+typedef uint32_t EPROGUPDATE_STATE;
+
+/**
+ * \~english next wakeup type
+ */
+typedef enum {
+ NEXT_WAKEUP_TYPE_NONE = 0,
+ NEXT_WAKEUP_TYPE_COLD,
+ NEXT_WAKEUP_TYPE_HOT,
+}ENEXT_WAKEUP_TYPE;
+
+/**
+ * \~english DRAM backup state
+ */
+typedef enum {
+ DRAM_BACKUP_STATE_OK = 0,
+ DRAM_BACKUP_STATE_NG
+}DRAM_BACKUP_STATE;
+
+/**
+ * \~english max length of rom product private
+ */
+#define ROM_PRODUCT_PRIVATE_MAX 128
+
+/**
+ * @class ROM_AccessIf
+ * \~english @brief ROM_AccessIf
+ * \~english @par Brief Introduction
+ * Class to provide the function of ROM AccessIf
+ *
+ */
+class ROM_AccessIf {
+ private:
+ BOOT_AccessIf* m_pBoot;
+ static void* g_m_plock;
+ static void* g_m_bakup_map;
+ static bool g_m_is_dram_valid;
+ LBM_NOR_t m_nor;
+ bool m_norIsDirty;
+
+ EFrameworkunifiedStatus LBA_Read(UI_32 offset, UI_32* buffer, UI_32 word_count);
+
+ EFrameworkunifiedStatus LBA_Write(UI_32 offset, UI_32 value);
+
+ EFrameworkunifiedStatus LBA_Write(UI_32 offset, UI_32* value, UI_32 size);
+
+ EFrameworkunifiedStatus GetDataResetMode_sub(EDATARESET_MODE* p_data_reset_mode);
+
+ public:
+/**
+ * \ingroup ROM_AccessIf
+ * \~english @par Summary:
+ * Obtain the access permission to SYS area (secondary storage area).
+ * \~english @param None
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * None
+ * \~english @par Detail:
+ * Obtain the access permission to SYS area. \n
+ * When the access permission is locked, the API watis for Mutex until the access permission is released. \n
+ * This API is assumed to be called by the SystemManager.
+ * \~english @see ~ROM_AccessIf, CL_LockMap, CL_LockGet
+ */
+ ROM_AccessIf();
+
+/**
+ * \ingroup ~ROM_AccessIf
+ * \~english @par Summary:
+ * Release the access permission to SYS area (secondary storage area).
+ * \~english @param None
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * None
+ * \~english @par Detail:
+ * Release the access permission to SYS area.
+ * \~english @see ROM_AccessIf, CL_LockRelease
+ */
+ ~ROM_AccessIf();
+
+/**
+ * \ingroup Initialize
+ * \~english @par Summary:
+ * Synchronize SYS area (secondary storage area) and the mirror data in DRAM
+ * \~english @param None
+ * \~english @retval eFrameworkunifiedStatusOK Synchronization success
+ * \~english @retval eFrameworkunifiedStatusFail Synchronization failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If system call mmap failed. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Prepare the access to SYS area. \n
+ * \~english @see EL_mem_exram_mmap
+ */
+ EFrameworkunifiedStatus Initialize();
+
+/**
+ * \ingroup SetProductPrivate
+ * \~english @par Summary:
+ * Write data information depending on the product specification to the secondary storage area.
+ * \~english @param [in] buf[ROM_PRODUCT_PRIVATE_MAX]
+ * UI_8[] - Data information depending on the product specification
+ * \~english @par
+ * Definition of ROM_PRODUCT_PRIVATE_MAX
+ * \~english @code
+ * #define ROM_PRODUCT_PRIVATE_MAX 128
+ * @endcode
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Write data information depending on the product specification to the secondary storage area. \n
+ * \~english @see GetProductPrivate
+ */
+ EFrameworkunifiedStatus SetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]);
+
+/**
+ * \ingroup GetProductPrivate
+ * \~english @par Summary:
+ * Read the data information depending on the product specification from the secondary storage area.
+ * \~english @param [out] buf[ROM_PRODUCT_PRIVATE_MAX]
+ * UI_8[] - Storing destination of data information depending on the product specification
+ * \~english @par
+ * Definition of ROM_PRODUCT_PRIVATE_MAX
+ * \~english @code
+ * #define ROM_PRODUCT_PRIVATE_MAX 128
+ * @endcode
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Read data information depending on the product specification from the secondary storage area. \n
+ * \~english @see SetProductPrivate
+ */
+ EFrameworkunifiedStatus GetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]);
+
+/**
+ * \ingroup SystemInitialize
+ * \~english @par Summary:
+ * Initialize the handles used for ROM access.
+ * \~english @param [in] bkup_state
+ * \~english @par
+ * DRAM_BACKUP_STATE
+ * - DRAM_BACKUP_STATE_OK
+ * - DRAM_BACKUP_STATE_NG
+ * \~english @retval eFrameworkunifiedStatusOK Initialize the handles used for ROM access success
+ * \~english @retval eFrameworkunifiedStatusFail Initialize the handles used for ROM access failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If system call mmap failed. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Initialize the handles used for ROM access. \n
+ * \~english @see EL_mem_exram_mmap
+ */
+ EFrameworkunifiedStatus SystemInitialize(DRAM_BACKUP_STATE bkup_state);
+
+/**
+ * \ingroup GetBootMode
+ * \~english @par Summary:
+ * Get boot mode information.
+ * \~english @param [out] p_boot_mode
+ * EBOOT_MODE* - Destination buffer to store information of boot mode.
+ * \~english @par
+ * EBOOT_MODE
+ * - APPLICATION_MODE
+ * - PROGRAMMING_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get boot mode information from the secondary storage area. \n
+ * \~english @see SetBootMode
+ */
+ EFrameworkunifiedStatus GetBootMode(EBOOT_MODE* p_boot_mode);
+
+/**
+ * \ingroup SetBootMode
+ * \~english @par Summary:
+ * Set boot mode information.
+ * \~english @param [in] boot_mode
+ * EBOOT_MODE - Boot mode information which write to the secondary storage area.
+ * \~english @par
+ * EBOOT_MODE
+ * - APPLICATION_MODE
+ * - PROGRAMMING_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set boot mode information to the secondary storage area. \n
+ * \~english @see GetBootMode
+ */
+ EFrameworkunifiedStatus SetBootMode(EBOOT_MODE boot_mode);
+
+/**
+ * \ingroup GetSignature
+ * \~english @par Summary:
+ * Get signature information.
+ * \~english @param [out] p_sig_value
+ * UI_32 - Destination buffer to store signature information
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write signature information to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get signature information from the secondary storage area. \n
+ * \~english @see SetSignature
+ */
+ EFrameworkunifiedStatus GetSignature(UI_32* p_sig_value);
+
+/**
+ * \ingroup SetSignature
+ * \~english @par Summary:
+ * Set signature information.
+ * \~english @param [in] sig_value
+ * UI_32 - Signature information which write to the secondary storage area.
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write signature information to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set signature information to the secondary storage area. \n
+ * \~english @see GetSignature
+ */
+ EFrameworkunifiedStatus SetSignature(UI_32 sig_value);
+
+/**
+ * \ingroup SetActiveFlashloader
+ * \~english @par Summary:
+ * Set active flash loader information.
+ * \~english @param [in] active_flash_loader
+ * EACTIVE_FLASHLOADER - Active flash loader information which write to secondary storage area.
+ * \~english @par
+ * EBOOT_MODE
+ * - APPLICATION_MODE
+ * - PROGRAMMING_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set active flash loader information to the secondary storage area. \n
+ * \~english @see GetBootMode
+ */
+ EFrameworkunifiedStatus SetActiveFlashloader(EACTIVE_FLASHLOADER active_flash_loader);
+
+/**
+ * \ingroup GetLastUserMode
+ * \~english @par Summary:
+ * Get last user mode information.
+ * \~english @param [out] p_user_mode
+ * EUSER_MODE* - Destination buffer to store information of user mode.
+ * \~english @par
+ * EUSER_MODE
+ * - USER_ON
+ * - USER_OFF
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get last user mode information from the secondary storage area. \n
+ * \~english @see SetLastUserMode
+ */
+ EFrameworkunifiedStatus GetLastUserMode(EUSER_MODE* p_user_mode);
+
+/**
+ * \ingroup SetLastUserMode
+ * \~english @par Summary:
+ * Set last user mode information.
+ * \~english @param [in] user_mode
+ * EUSER_MODE - User mode information which write to the secondary storage area.
+ * \~english @par
+ * EUSER_MODE
+ * - USER_ON
+ * - USER_OFF
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set last user mode information to the secondary storage area. \n
+ * \~english @see GetLastUserMode
+ */
+ EFrameworkunifiedStatus SetLastUserMode(EUSER_MODE user_mode);
+
+/**
+ * \ingroup GetTransportMode
+ * \~english @par Summary:
+ * Get transport mode information.
+ * \~english @param [out] p_control_mode
+ * ECONTROL_MODE* - Destination buffer to store information of transport mode.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get transport mode information from the secondary storage area. \n
+ * \~english @see SetTransportMode
+ */
+ EFrameworkunifiedStatus GetTransportMode(ECONTROL_MODE* p_control_mode);
+
+/**
+ * \ingroup SetTransportMode
+ * \~english @par Summary:
+ * Set transport mode information.
+ * \~english @param [in] control_mode
+ * ECONTROL_MODE - Transport mode information which write to the secondary storage area.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set transport mode information to the secondary storage area. \n
+ * \~english @see GetTransportMode
+ */
+ EFrameworkunifiedStatus SetTransportMode(ECONTROL_MODE control_mode);
+
+/**
+ * \ingroup GetProductionMode
+ * \~english @par Summary:
+ * Get production mode information.
+ * \~english @param [out] p_control_mode
+ * ECONTROL_MODE* - Destination buffer to store information of production mode.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get production mode information from the secondary storage area. \n
+ * \~english @see SetProductionMode
+ */
+ EFrameworkunifiedStatus GetProductionMode(ECONTROL_MODE* p_control_mode);
+
+/**
+ * \ingroup SetProductionMode
+ * \~english @par Summary:
+ * Set transport mode information.
+ * \~english @param [in] control_mode
+ * ECONTROL_MODE - Production mode information which write to the secondary storage area.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set production mode information to the secondary storage area. \n
+ * \~english @see GetProductionMode
+ */
+ EFrameworkunifiedStatus SetProductionMode(ECONTROL_MODE control_mode);
+
+/**
+ * \ingroup GetLimpHomeCutOffReqMode
+ * \~english @par Summary:
+ * Get limp home cut off request mode information.
+ * \~english @param [out] p_control_mode
+ * ECONTROL_MODE* - Destination buffer to store information of limp home cut off request mode.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get limp home cut off request mode information from the secondary storage area. \n
+ * \~english @see SetLimpHomeCutOffReqMode
+ */
+ EFrameworkunifiedStatus GetLimpHomeCutOffReqMode(ECONTROL_MODE* p_control_mode);
+
+/**
+ * \ingroup SetLimpHomeCutOffReqMode
+ * \~english @par Summary:
+ * Set limp home cut off request mode information.
+ * \~english @param [in] control_mode
+ * ECONTROL_MODE - Limp home cut off request mode information which write to the secondary storage area.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set limp home cut off request mode information to the secondary storage area. \n
+ * \~english @see GetLimpHomeCutOffReqMode
+ */
+ EFrameworkunifiedStatus SetLimpHomeCutOffReqMode(ECONTROL_MODE control_mode);
+
+/**
+ * \ingroup GetDataResetMode
+ * \~english @par Summary:
+ * Get reserved data reset mode information.
+ * \~english @param [out] p_data_reset_mode
+ * EDATARESET_MODE* - Destination buffer to store information of reserved data reset mode.
+ * \~english @par
+ * EDATARESET_MODE
+ * - DATARESET_NONE
+ * - DATARESET_USER
+ * - DATARESET_FACTORY
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get reserved data reset mode information from the secondary storage area. \n
+ * \~english @see SetDataResetMode
+ */
+ EFrameworkunifiedStatus GetDataResetMode(EDATARESET_MODE* p_data_reset_mode);
+
+/**
+ * \ingroup GetDataResetModeFast
+ * \~english @par Summary:
+ * Get reserved data reset mode information faster.This api can get correct value before
+ * calling SetDataResetMode.So it shoud be used only immediately after boot.
+ * \~english @param [out] p_data_reset_mode
+ * EDATARESET_MODE* - Destination buffer to store information of reserved data reset mode faster.
+ * \~english @par
+ * EDATARESET_MODE
+ * - DATARESET_NONE
+ * - DATARESET_USER
+ * - DATARESET_FACTORY
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * - If system call mmap failed. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get reserved data reset mode information faster from the secondary storage area.This api can get
+ * correct value before calling SetDataResetMode.So it shoud be used only immediately after boot.
+ * \~english @see SetDataResetMode
+ */
+ EFrameworkunifiedStatus GetDataResetModeFast(EDATARESET_MODE* p_data_reset_mode);
+
+/**
+ * \ingroup SetDataResetMode
+ * \~english @par Summary:
+ * Set reserve data reset mode information.
+ * \~english @param [in] data_reset_mode
+ * EDATARESET_MODE - Reserve data reset mode information which write to the secondary storage area.
+ * \~english @par
+ * EDATARESET_MODE
+ * - DATARESET_NONE
+ * - DATARESET_USER
+ * - DATARESET_FACTORY
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set reserve data reset mode information to the secondary storage area. \n
+ * \~english @see GetDataResetMode
+ */
+ EFrameworkunifiedStatus SetDataResetMode(EDATARESET_MODE data_reset_mode);
+
+/**
+ * \ingroup GetResetCount
+ * \~english @par Summary:
+ * Get reset count information.
+ * \~english @param [out] p_reset_count
+ * UI_32* - Destination buffer to store information of reset count.
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get reset count from the secondary storage area. \n
+ * \~english @see SetResetCount
+ */
+ EFrameworkunifiedStatus GetResetCount(UI_32* p_reset_count);
+
+/**
+ * \ingroup SetResetCount
+ * \~english @par Summary:
+ * Set reset count information.
+ * \~english @param [in] reset_count
+ * UI_32 - Reset count information which write to the secondary storage area.
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set reset count information to the secondary storage area. \n
+ * \~english @see GetResetCount
+ */
+ EFrameworkunifiedStatus SetResetCount(UI_32 reset_count);
+
+/**
+ * \ingroup GetLastIlgReset
+ * \~english @par Summary:
+ * Get last illegal reset information.
+ * \~english @param [out] p_last_ilg_reset
+ * ELASTILGRESET_MODE* - Destination buffer to store information of last illegal reset.
+ * \~english @par
+ * ELASTILGRESET_MODE
+ * - LAST_ILGRESET_NORMAL
+ * - LAST_ILGRESET_NG
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get last illegal reset information from the secondary storage area. \n
+ * \~english @see SetLastIlgReset
+ */
+ EFrameworkunifiedStatus GetLastIlgReset(ELASTILGRESET_MODE* p_last_ilg_reset);
+
+/**
+ * \ingroup SetLastIlgReset
+ * \~english @par Summary:
+ * Set last illegal reset information.
+ * \~english @param [in] last_ilg_reset
+ * ELASTILGRESET_MODE - Last illegal reset information which write to the secondary storage area.
+ * \~english @par
+ * ELASTILGRESET_MODE
+ * - LAST_ILGRESET_NORMAL
+ * - LAST_ILGRESET_NG
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set last illegal reset information to the secondary storage area. \n
+ * \~english @see GetLastIlgReset
+ */
+ EFrameworkunifiedStatus SetLastIlgReset(ELASTILGRESET_MODE last_ilg_reset);
+
+/**
+ * \ingroup GetProgUpdateState
+ * \~english @par Summary:
+ * Get program update status information.
+ * \~english @param [out] p_prog_update_state
+ * EPROGUPDATE_STATE* - Destination buffer to store information of program update status.
+ * \~english @par
+ * typedef uint32_t EPROGUPDATE_STATE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get program update status information from the secondary storage area. \n
+ * \~english @see SetProgUpdateState
+ */
+ EFrameworkunifiedStatus GetProgUpdateState(EPROGUPDATE_STATE* p_prog_update_state);
+
+/**
+ * \ingroup SetProgUpdateState
+ * \~english @par Summary:
+ * Set program update status information.
+ * \~english @param [in] prog_update_state
+ * EPROGUPDATE_STATE - Program update status information which write to the secondary storage area.
+ * \~english @par
+ * typedef uint32_t EPROGUPDATE_STATE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set program update status information to the secondary storage area. \n
+ * \~english @see GetProgUpdateState
+ */
+ EFrameworkunifiedStatus SetProgUpdateState(EPROGUPDATE_STATE prog_update_state);
+
+/**
+ * \ingroup GetErrLogCount
+ * \~english @par Summary:
+ * Get error logging count information.
+ * \~english @param [out] p_err_log_count
+ * UI_32* - Destination buffer to store information of error logging count.
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get error logging count information from the secondary storage area. \n
+ * \~english @see SetErrLogCount
+ */
+ EFrameworkunifiedStatus GetErrLogCount(UI_32* p_err_log_count);
+
+/**
+ * \ingroup SetErrLogCount
+ * \~english @par Summary:
+ * Get error logging count information.
+ * \~english @param [out] err_log_count
+ * UI_32* - Destination buffer to store information of error logging count.
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get error logging count information from the secondary storage area. \n
+ * \~english @see GetErrLogCount
+ */
+ EFrameworkunifiedStatus SetErrLogCount(UI_32 err_log_count);
+
+/**
+ * \ingroup GetNextWakeupType
+ * \~english @par Summary:
+ * Get next wakeup type information.
+ * \~english @param [out] p_next_wakeup_type
+ * ENEXT_WAKEUP_TYPE* - Destination buffer to store information of next wakeup type.
+ * \~english @par
+ * ENEXT_WAKEUP_TYPE
+ * - NEXT_WAKEUP_TYPE_NONE
+ * - NEXT_WAKEUP_TYPE_COLD
+ * - NEXT_WAKEUP_TYPE_HOT
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get next wakeup type information from the secondary storage area. \n
+ * \~english @see SetNextWakeupType
+ */
+ EFrameworkunifiedStatus GetNextWakeupType(ENEXT_WAKEUP_TYPE *p_next_wakeup_type);
+
+/**
+ * \ingroup SetNextWakeupType
+ * \~english @par Summary:
+ * Get next wakeup type information.
+ * \~english @param [out] next_wakeup_type
+ * ENEXT_WAKEUP_TYPE* - Destination buffer to store information of next wakeup type.
+ * \~english @par
+ * ENEXT_WAKEUP_TYPE
+ * - NEXT_WAKEUP_TYPE_NONE
+ * - NEXT_WAKEUP_TYPE_COLD
+ * - NEXT_WAKEUP_TYPE_HOT
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get next wakeup type information from the secondary storage area. \n
+ * \~english @see GetNextWakeupType
+ */
+ EFrameworkunifiedStatus SetNextWakeupType(ENEXT_WAKEUP_TYPE next_wakeup_type);
+};
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_ROM_ACCESS_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/rom_access_library/library/nor/Makefile b/systemservice/rom_access_library/library/nor/Makefile
new file mode 100755
index 0000000..f30c271
--- /dev/null
+++ b/systemservice/rom_access_library/library/nor/Makefile
@@ -0,0 +1,46 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### search paths #############
+VPATH += src
+VPATH += ../include/$(COMPONENT_NAME)
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libssaccess
+
+######### headers to be installed(*.h) #############
+INST_HEADERS = nor_backup.h
+
+######### compiled sources #############
+libssaccess_SRCS = nor_backup.c
+
+######### add include path #############
+CPPFLAGS += -I../include/
+
+######### frameworkunifiedlog options #############
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+
+######### add compile option #############
+LINK_SHLIB_CXX := y
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+include ../../../system_service.mk
diff --git a/systemservice/rom_access_library/library/nor/libBlkDev_API.ver b/systemservice/rom_access_library/library/nor/libBlkDev_API.ver
new file mode 100755
index 0000000..5ebddcb
--- /dev/null
+++ b/systemservice/rom_access_library/library/nor/libBlkDev_API.ver
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# CommonLib version script
+#
+{
+ global:
+ ### .text section ###
+ blkDrv_DirectReadData;
+ blkDrv_DirectWriteData;
+ blkDrv_GetBlockInfo;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/systemservice/rom_access_library/library/nor/libssaccess.ver b/systemservice/rom_access_library/library/nor/libssaccess.ver
new file mode 100755
index 0000000..c4bd070
--- /dev/null
+++ b/systemservice/rom_access_library/library/nor/libssaccess.ver
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# CommonLib version script
+#
+{
+ global:
+ ### .text section ###
+ mtdn_backup_GetErCnt;
+ mtdn_backup_Read;
+ mtdn_backup_Write;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/systemservice/rom_access_library/library/nor/src/nor_backup.c b/systemservice/rom_access_library/library/nor/src/nor_backup.c
new file mode 100755
index 0000000..8a133b0
--- /dev/null
+++ b/systemservice/rom_access_library/library/nor/src/nor_backup.c
@@ -0,0 +1,807 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+* $Header:: $
+* $Revision:: $
+*******************************************************************************/
+
+/*******************************************************************************
+@file mtd_backup.c
+@system
+@process
+@detail
+ ******************************************************************************/
+#include "system_service/nor_backup.h"
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <asm/unistd.h>
+#include <mtd/mtd-user.h>
+
+#define BACKUP_RETRY_CNT 3
+
+/* Invalid Value */
+#define FLSBACKUP_SEMAPHORE_INVALID (0)
+
+
+#define BACKUP_SECTOR_SIZ 1024 // Secter Size
+
+#define BACKUP_CHECK_OFFSET 16
+#define BACKUP_CHECK_SIZE 12
+#define BACKUP_CHECK_TEXT "MTD_BACKUPDT"
+#define BACKUP_CHECK_DAT1 1 // Lower 8bit
+#define BACKUP_CHECK_DAT2 2 // Upper 8bit
+
+#define NOR_ERRLOG(fmt, args...) \
+ fprintf(stderr, "[ERR]%ld/%s/%d/= "fmt"\n", syscall(__NR_gettid), __func__, __LINE__, ##args)
+
+static pthread_mutex_t g_semid_flash = PTHREAD_MUTEX_INITIALIZER; /* Semaphore ID of dram area access */
+static int g_backup_init = FLSBACKUP_SEMAPHORE_INVALID;
+
+typedef enum {
+ RET_WT_CHK_OK = 0,
+ RET_WT_ERR_OTHER,
+ RET_WT_DEV_ERR,
+} NOR_WRITE_BLK_CHK;
+
+typedef enum {
+ RET_RD_CHK_OK = 0,
+ RET_RD_ERR_OTHER,
+ RET_RD_DEV_ERR,
+ RET_RD_ERR_1 = -1,
+ RET_RD_ERR_2 = -2,
+ RET_RD_ERR_3 = -3,
+ RET_RD_ERR_4 = -4,
+} NOR_READ_BLK_CHK;
+
+typedef enum {
+ RET_CHK_OK = 0,
+ RET_CHK_TEXT_ERR,
+ RET_CHK_BCC_ERR,
+} NOR_BLK_CHK;
+
+typedef enum {
+ NOR_IDLE = 0, // 0:Read-out of block data
+ NOR_ORG_TEXT, // 1:OrgText Error
+ NOR_ORG_BCC, // 2:OrgBcc error
+ NOR_READ_OK, // 3:Normal read-out
+ NOR_READ_END // 4:end state
+} NOR_R_STATE;
+
+typedef enum {
+ NOR_IDEL = 0, // 0:IDEL
+ NOR_READ_ERR, // 1:Read Error
+ NOR_ORG_READ, // 2:Org Read OK
+ NOR_BAK_WRT, // 3:Bak Write OK
+ NOR_BACK_READ, // 4:Bak Read OK
+ NOR_ORG_WRITE, // 5:Org Write OK
+ NOR_WRITE_END // 6:end state
+} NOR_W_STATE;
+
+NOR_READ_BLK_CHK MtdnBackupReadSub(
+ const char * path_name, int i_id, int i_offset, int i_size,
+ void *p_buff, mtd_info_t * mtd_info, int * get_state);
+NOR_WRITE_BLK_CHK MtdnBackupWriteSub(
+ const char * path_name, int i_id, int i_offset, int i_size,
+ void *p_buff, mtd_info_t * mtd_info);
+
+int MtdnBackupWriteBase(
+ const char * path_name, int i_id, int i_offset, int i_size,
+ void *p_buff, mtd_info_t * mtd_info);
+int MtdnBackupReadBase(
+ const char * path_name, int i_id, int i_offset, int i_size,
+ void *p_buff, mtd_info_t * mtd_info);
+
+int MtdBackupInfo(const char * path_name, mtd_info_t * mtd_info); // INFO Get
+
+NOR_BLK_CHK MtdBackupCheksumRead(char * p_buff, int erase_size, int * ret_sum); // check SUM
+int MtdBackupCheksumWrite(char * p_buff, int erase_size); // check SUM
+
+/***************************************************************************
+@brief mtdn_backup_Read
+@outline Read-out of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@return int
+@retval 0 : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+int mtdn_backup_Read(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff ) {
+ int ret_status = RET_DEV_NORMAL;
+
+ if (path_name == NULL) {
+ NOR_ERRLOG("invalid path:%p", path_name);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (p_buff == NULL) {
+ NOR_ERRLOG("invalid buf:%p", p_buff);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (i_id < 0) {
+ NOR_ERRLOG("invalid id:%d", i_id);
+ return RET_DEV_ERR_PARAM;
+ }
+ if ((i_offset < 0) || (i_size <= 0)) {
+ NOR_ERRLOG("invalid size:%d offset:%d", i_size, i_offset);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (g_backup_init == FLSBACKUP_SEMAPHORE_INVALID) { // LCOV_EXCL_BR_LINE 200: g_backup_init is static variable
+ pthread_mutex_init(&g_semid_flash, NULL);
+ g_backup_init = ~FLSBACKUP_SEMAPHORE_INVALID;
+ }
+ mtd_info_t mtd_info;
+ memset(&mtd_info, 0, sizeof(mtd_info_t));
+ ret_status = MtdBackupInfo((const char *)path_name, &mtd_info);
+ if (ret_status == RET_DEV_NORMAL) {
+ if (mtd_info.type != MTD_NORFLASH) {
+ NOR_ERRLOG("invalid type:%d", mtd_info.type);
+ ret_status = RET_DEV_ERR_PARAM;
+ } else {
+ if ((i_offset + i_size) > (int)(mtd_info.erasesize - BACKUP_CHECK_OFFSET)) {
+ NOR_ERRLOG("invalid size:%d offset:%d erasesize:%d", i_size, i_offset, mtd_info.erasesize);
+ ret_status = RET_DEV_ERR_PARAM;
+ }
+ }
+ if (ret_status == RET_DEV_NORMAL) {
+ /* Start Semaphore(flash) */
+ pthread_mutex_lock(&g_semid_flash);
+ int get_state; // Read status
+ ret_status = (int)MtdnBackupReadSub(path_name, i_id, i_offset, i_size,
+ p_buff, &mtd_info, &get_state);
+
+ /* End Semaphore(flash) */
+ pthread_mutex_unlock(&g_semid_flash);
+ }
+ }
+ if (ret_status != RET_DEV_NORMAL) {
+ NOR_ERRLOG("error return:%d", ret_status);
+ }
+ return ret_status;
+}
+
+/***************************************************************************
+@brief mtdn_backup_Write
+@outline Writing of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@return int
+@retval 0 : No error
+@retval Except: Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+int mtdn_backup_Write(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff) {
+ int ret_status = RET_DEV_NORMAL;
+
+ if (path_name == NULL) {
+ NOR_ERRLOG("invalid path:%p", path_name);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (p_buff == NULL) {
+ NOR_ERRLOG("invalid buf:%p", p_buff);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (i_id < 0) {
+ NOR_ERRLOG("invalid id:%d", i_id);
+ return RET_DEV_ERR_PARAM;
+ }
+ if ((i_offset < 0) || (i_size <= 0)) {
+ NOR_ERRLOG("invalid size:%d offset:%d", i_size, i_offset);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (g_backup_init == FLSBACKUP_SEMAPHORE_INVALID) {
+ pthread_mutex_init(&g_semid_flash, NULL);
+ g_backup_init = ~FLSBACKUP_SEMAPHORE_INVALID;
+ }
+ mtd_info_t mtd_info;
+ memset(&mtd_info, 0, sizeof(mtd_info_t));
+ ret_status = MtdBackupInfo((const char *)path_name, &mtd_info);
+ if (ret_status == RET_DEV_NORMAL) {
+ if (mtd_info.type != MTD_NORFLASH) {
+ NOR_ERRLOG("invalid type:%d", mtd_info.type);
+ ret_status = RET_DEV_ERR_PARAM;
+ } else if (mtd_info.erasesize == 0) {
+ NOR_ERRLOG("invalid erasesize:%d", mtd_info.erasesize);
+ ret_status = RET_DEV_ERR_PARAM;
+ } else {
+ if ((i_offset + i_size) > (int)(mtd_info.erasesize - BACKUP_CHECK_OFFSET)) {
+ NOR_ERRLOG("invalid size:%d offset:%d erasesize:%d", i_size, i_offset, mtd_info.erasesize);
+ ret_status = RET_DEV_ERR_PARAM;
+ }
+ }
+ if (ret_status == RET_DEV_NORMAL) {
+ /* Start Semaphore(flash) */
+ pthread_mutex_lock(&g_semid_flash);
+ ret_status = (int)MtdnBackupWriteSub(path_name, i_id, i_offset, i_size, p_buff, &mtd_info);
+
+ /* End Semaphore(flash) */
+ pthread_mutex_unlock(&g_semid_flash);
+ }
+ }
+ if (ret_status != RET_DEV_NORMAL) {
+ NOR_ERRLOG("error return:%d", ret_status);
+ }
+ return ret_status;
+}
+
+/***************************************************************************
+@brief MtdnBackupReadSub
+@outline Read-out of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@param[in] mtd_info_t * mtd_info : info
+@param[in] int * get_state : 0:Rrg Normal 1:Bak Normal
+@return NOR_READ_BLK_CHK
+@retval RET_RD_CHK_OK : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+NOR_READ_BLK_CHK MtdnBackupReadSub(const char * path_name, int i_id, int i_offset, int i_size,
+ void *p_buff, mtd_info_t * mtd_info, int * get_state) {
+ NOR_READ_BLK_CHK ret_status = RET_RD_CHK_OK;
+ char * lp_buffer;
+
+ if (mtd_info->erasesize != 0) { // LCOV_EXCL_BR_LINE 6: double check
+ lp_buffer = (char *)malloc(mtd_info->erasesize);
+ if (lp_buffer == NULL) {
+ NOR_ERRLOG("malloc:%p", lp_buffer);
+ ret_status = RET_RD_DEV_ERR; // error
+ }
+ } else {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("invalid erasesize:%d", mtd_info->erasesize);
+ ret_status = RET_RD_DEV_ERR; // error
+ // LCOV_EXCL_STOP
+ }
+ if (ret_status == RET_RD_CHK_OK) {
+ memset(lp_buffer, 0x00, mtd_info->erasesize);
+ NOR_R_STATE cycle_state = NOR_IDLE;
+ int block_check_mode = 0;
+ int ret_sum = 0;
+ while ((cycle_state < NOR_READ_END)
+ &&(ret_status == RET_RD_CHK_OK)) {
+ switch (cycle_state) {
+ case NOR_IDLE:
+ // Read-out of block data
+ if (0 != MtdnBackupReadBase((const char *)path_name, i_id, 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ ret_status = RET_RD_ERR_OTHER; // Other abnormalities
+ } else {
+ NOR_BLK_CHK ret = MtdBackupCheksumRead(lp_buffer, (int)mtd_info->erasesize, (int *)&ret_sum);
+ if (ret == RET_CHK_TEXT_ERR) { // Text character sequence Abnormalities
+ cycle_state = NOR_ORG_TEXT;
+ } else if (ret == RET_CHK_BCC_ERR) { // (BCC)error
+ cycle_state = NOR_ORG_BCC;
+ } else {
+ block_check_mode = 0; // Org Normal
+ cycle_state = NOR_READ_OK;
+ }
+ }
+ break;
+ case NOR_ORG_TEXT: // OrgText Error
+ // Read-out of block data
+ if (0 != MtdnBackupReadBase((const char *)path_name, (i_id+1), 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ // other error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = RET_RD_ERR_OTHER; // LCOV_EXCL_LINE 5: c API error case.
+ } else {
+ NOR_BLK_CHK ret = MtdBackupCheksumRead(lp_buffer, (int)mtd_info->erasesize,
+ (int *)&ret_sum); // check SUM
+ if (ret == RET_CHK_TEXT_ERR) { // Text character sequence Abnormalities
+ ret_status = RET_RD_ERR_1; // Uninitialized.
+ } else if (ret == RET_CHK_BCC_ERR) { // BCC error
+ ret_status = RET_RD_ERR_2; // write error
+ }
+ block_check_mode = 1; // Bak Normal
+ cycle_state = NOR_READ_OK;
+ }
+ break;
+ case NOR_ORG_BCC: // OrgBcc error
+ // Read-out of block data
+ if (0 != MtdnBackupReadBase((const char *)path_name, (i_id+1), 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ // other error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = RET_RD_ERR_OTHER; // LCOV_EXCL_LINE 5: c API error case.
+ } else {
+ NOR_BLK_CHK ret = MtdBackupCheksumRead(lp_buffer, (int)mtd_info->erasesize,
+ (int *)&ret_sum); // check SUM
+ if (ret == RET_CHK_TEXT_ERR) { // Text character sequence Abnormalities
+ ret_status = RET_RD_ERR_3; // write error
+ } else if (ret == RET_CHK_BCC_ERR) { // BCC error
+ ret_status = RET_RD_ERR_4; // write error
+ }
+ block_check_mode = 1; // Bak Normal
+ cycle_state = NOR_READ_OK;
+ }
+ break;
+ case NOR_READ_OK: // Normal read-out
+ // The pickup of the read data
+ memcpy(p_buff, &lp_buffer[i_offset], (size_t)i_size);
+ cycle_state = NOR_READ_END;
+ break;
+ default:
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("invalid state:%d", cycle_state);
+ // other error
+ ret_status = RET_RD_ERR_OTHER;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+ *get_state = block_check_mode; // 0:OrgNormal 1:BakNormal
+ free(lp_buffer);
+ }
+ return ret_status; // Normal
+}
+
+static inline NOR_WRITE_BLK_CHK MtdnBackupWriteRetryCount(int *count, NOR_WRITE_BLK_CHK cur_state) {
+ NOR_WRITE_BLK_CHK ret_state = cur_state;
+ (*count)++;
+ if (*count > BACKUP_RETRY_CNT) {
+ NOR_ERRLOG("retry over!! state:%d count:%d", ret_state, *count);
+ ret_state = RET_WT_DEV_ERR;
+ }
+ return ret_state;
+}
+
+/***************************************************************************
+@brief MtdnBackupWriteSub
+@outline Writing of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@param[in] mtd_info_t * mtd_info : info
+@return NOR_WRITE_BLK_CHK
+@retval RET_WT_CHK_OK : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+NOR_WRITE_BLK_CHK MtdnBackupWriteSub(const char * path_name, int i_id, int i_offset,
+ int i_size, void *p_buff, mtd_info_t * mtd_info) {
+ NOR_WRITE_BLK_CHK ret_status = RET_WT_CHK_OK;
+ char* lp_buffer;
+
+ lp_buffer = (char *)malloc(mtd_info->erasesize);
+ if (lp_buffer == NULL) {
+ NOR_ERRLOG("malloc:%p", lp_buffer);
+ ret_status = RET_WT_DEV_ERR; // error
+ } else {
+ memset(lp_buffer, 0x00, mtd_info->erasesize);
+ NOR_W_STATE cycle_state = NOR_IDEL;
+ int retry_cnt = 0;
+ int get_state = 0; // Read status
+
+ while ((cycle_state < NOR_WRITE_END)
+ &&(ret_status == RET_WT_CHK_OK)) {
+ switch (cycle_state) {
+ case NOR_IDEL: // IDLE
+ if (RET_RD_CHK_OK != MtdnBackupReadSub((const char *)path_name, i_id, 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info, &get_state)) {
+ cycle_state = NOR_READ_ERR; // read error
+ } else {
+ // write data set
+ memcpy(&lp_buffer[i_offset], p_buff, (size_t)i_size);
+ if (get_state == 0) {
+ cycle_state = NOR_ORG_READ; // Org read Normal
+ } else {
+ // Bakread Normal
+ cycle_state = NOR_BACK_READ;
+ }
+ // Embedding of write-in data
+ memcpy(&lp_buffer[i_offset], p_buff, (size_t)i_size);
+ }
+ break;
+ case NOR_READ_ERR: // read error
+ memset((char *)lp_buffer, 0x00, mtd_info->erasesize);
+ // Embedding of write-in data
+ memcpy(&lp_buffer[i_offset], p_buff, (size_t)i_size);
+ cycle_state = NOR_ORG_READ; // Org read Normal
+ break;
+ case NOR_ORG_READ: // Orgread Normal
+ // LCOV_EXCL_BR_START 6: double check
+ if (0 != MtdBackupCheksumWrite(lp_buffer, (int)mtd_info->erasesize )) { // check SUM
+ // LCOV_EXCL_BR_STOP
+ // error(It does not generate.)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = RET_WT_DEV_ERR; // LCOV_EXCL_LINE 8: dead code
+ } else {
+ // data write
+ if (0 == MtdnBackupWriteBase((const char *)path_name, (i_id+1), 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ cycle_state = NOR_BAK_WRT; // Bakwrite Success
+ retry_cnt = 0;
+ } else {
+ ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status);
+ }
+ }
+ break;
+ case NOR_BAK_WRT: // BakWriteSuccess
+ // Data write
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (0 == MtdnBackupWriteBase((const char *)path_name, i_id, 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ // LCOV_EXCL_BR_STOP
+ cycle_state = NOR_WRITE_END; // Normal end
+ } else {
+ // LCOV_EXCL_START 5: c API error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status);
+ // LCOV_EXCL_STOP
+ }
+ break;
+ case NOR_BACK_READ: // Bak read normal
+ // LCOV_EXCL_BR_START 6: double check
+ if (0 != MtdBackupCheksumWrite(lp_buffer, (int)mtd_info->erasesize )) { // check SUM
+ // LCOV_EXCL_BR_STOP
+ // Retry over
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = RET_WT_DEV_ERR; // LCOV_EXCL_LINE 8: dead code
+ } else {
+ // data write
+ if (0 == MtdnBackupWriteBase((const char *)path_name, i_id, 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ // Org write Succses
+ cycle_state = NOR_ORG_WRITE;
+ retry_cnt = 0;
+ } else {
+ // LCOV_EXCL_START 5: c API error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status);
+ // LCOV_EXCL_STOP
+ }
+ }
+ break;
+ case NOR_ORG_WRITE: // Org write Succses
+ // data write
+ if (0 == MtdnBackupWriteBase((const char *)path_name, (i_id+1), 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ // Normal end
+ cycle_state = NOR_WRITE_END;
+ } else {
+ // LCOV_EXCL_START 5: c API error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status);
+ // LCOV_EXCL_STOP
+ }
+ break;
+ default:
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("invalid state:%d", cycle_state);
+ // other error
+ ret_status = RET_WT_ERR_OTHER;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+ free(lp_buffer);
+ }
+ return ret_status; // Normal
+}
+
+/***************************************************************************
+@brief MtdnBackupReadBase
+@outline Read-out of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@param[in] mtd_info_t * mtd_info :
+@return int
+@retval 0 : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+int MtdnBackupReadBase(const char * path_name, int i_id, int i_offset,
+ int i_size, void *p_buff, mtd_info_t * mtd_info) {
+ int ret_status = RET_DEV_NORMAL;
+
+ int mtd_fd = open(path_name, O_RDONLY|O_CLOEXEC);
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (mtd_fd == -1) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 5:It's impossible to mock open() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("open(%s):%s", path_name, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ int seek_top = i_id * (int)mtd_info->erasesize + i_offset;
+ int sector_size = BACKUP_SECTOR_SIZ;
+ int block_size = (int)mtd_info->erasesize / sector_size; // Division number
+ int llpi;
+ int buff_top = 0;
+ int get_size = i_size;
+ char * work_buff = (char *)p_buff;
+ ssize_t read_size;
+
+ // It reads several sector minutes.
+ for (llpi=0; llpi < block_size; llpi++) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // It moves to a head.
+ if (-1 == (off_t)lseek(mtd_fd, seek_top, SEEK_SET)) {
+ NOR_ERRLOG("lseek():%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+ if (get_size >= sector_size) { // LCOV_EXCL_BR_LINE 6:double check
+ read_size = read(mtd_fd, &work_buff[buff_top], (size_t)sector_size);
+ if (read_size < 0) {
+ NOR_ERRLOG("read():%zd %s", read_size, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+
+ get_size -= sector_size;
+ if (get_size <= 0) {
+ break;
+ }
+ } else {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ read_size = read(mtd_fd, &work_buff[buff_top], (size_t)get_size);
+ if (read_size < 0) {
+ NOR_ERRLOG("read():%zd %s", read_size, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ seek_top += (int)read_size;
+ buff_top += (int)read_size;
+ }
+ // LCOV_EXCL_BR_START 5:It's impossible to mock close() function,so this line can not be passed.
+ if (0 != close(mtd_fd)) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 5:It's impossible to mock close() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("close():%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+ return ret_status;
+}
+
+/***************************************************************************
+@brief MtdnBackupWriteBase
+@outline Writing of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@param[in] mtd_info_t * mtd_info :
+@return int
+@retval 0 : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+int MtdnBackupWriteBase(const char * path_name, int i_id, int i_offset,
+ int i_size, void *p_buff, mtd_info_t * mtd_info) {
+ int ret_status = RET_DEV_NORMAL;
+
+ int mtd_fd = open(path_name, O_RDWR|O_CLOEXEC);
+ if (mtd_fd == -1) {
+ NOR_ERRLOG("open(%s):%s", path_name, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ } else {
+ erase_info_t s_mtd_erase;
+ s_mtd_erase.start = (__u32)i_id * mtd_info->erasesize;
+ s_mtd_erase.length = mtd_info->erasesize;
+ // erase
+ if (ioctl(mtd_fd, MEMERASE, &s_mtd_erase) < 0) {
+ NOR_ERRLOG("ioctl(MEMERASE):%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ } else {
+ // write
+ int seek_top = i_id * (int)mtd_info->erasesize + i_offset;
+ int sector_size = BACKUP_SECTOR_SIZ; //
+ int block_size = (int)mtd_info->erasesize/sector_size;
+ int llpi;
+ int buff_top = 0;
+ int put_size = i_size;
+ char * work_buff = (char *)p_buff;
+ ssize_t write_size;
+
+ for (llpi=0; llpi < block_size; llpi++) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (-1 == (off_t)lseek(mtd_fd, seek_top, SEEK_SET)) {
+ NOR_ERRLOG("lseek():%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+ if (put_size >= sector_size) { // LCOV_EXCL_BR_LINE 6:double check
+ write_size = write(mtd_fd, &work_buff[buff_top], (size_t)sector_size);
+ if (write_size < 0) {
+ NOR_ERRLOG("write():%zd %s", write_size, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+ put_size -= sector_size;
+ if (put_size <= 0) {
+ break;
+ }
+ } else {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ write_size = write(mtd_fd, &work_buff[buff_top], (size_t)put_size);
+ if (write_size < 0) {
+ NOR_ERRLOG("write():%zd %s", write_size, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ seek_top += (int)write_size;
+ buff_top += (int)write_size;
+ }
+ }
+ // LCOV_EXCL_BR_START 5:It's impossible to mock close() function,so this line can not be passed.
+ if (0 != close(mtd_fd)) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 5:It's impossible to mock close() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("close():%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+ return ret_status;
+}
+
+/***************************************************************************
+int backup_cheksum_read(char * p_buff, int erase_size ,int * ret_sum)
+ * A text character sequence and a sum value are checked.
+ IN: char * p_buff ...top address
+ int erase_size ...erase size
+ int * ret_sum ...return sum
+
+ OUT: NOR_BLK_CHK RET_CHK_OK:Normal
+ RET_CHK_TEXT_ERR:test error
+ RET_CHK_BCC_ERR:sum error Except:other error
+ Remarks:
+*****************************************************************************/
+NOR_BLK_CHK MtdBackupCheksumRead(char * p_buff, int erase_size, int * ret_sum) {
+ if (erase_size > BACKUP_CHECK_OFFSET) { // LCOV_EXCL_BR_LINE 6: double check
+ // The check of the compatibility of block data
+ if (0 != memcmp(&p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_TEXT, BACKUP_CHECK_SIZE)) {
+ char tmp[BACKUP_CHECK_SIZE + 1];
+ memcpy(tmp, &p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_SIZE);
+ tmp[BACKUP_CHECK_SIZE] = '\0';
+ NOR_ERRLOG("invalid check_text:%s", tmp);
+ return RET_CHK_TEXT_ERR;
+ }
+ // The check of the compatibility of block data
+ int llpi;
+ int get_sum;
+ int work_sum = 0;
+ get_sum = ((int)p_buff[(erase_size-BACKUP_CHECK_DAT2)] & 0xff) +
+ (((int)p_buff[(erase_size-BACKUP_CHECK_DAT1)]) << 8 & 0xff00);
+
+ for (llpi=0; llpi < (erase_size-BACKUP_CHECK_OFFSET); llpi++) {
+ work_sum += p_buff[llpi];
+ }
+ work_sum = (work_sum & 0xffff);
+ if (work_sum != get_sum) {
+ NOR_ERRLOG("invalid checksum: work:%d get:%d", work_sum, get_sum);
+ return RET_CHK_BCC_ERR; // checksum error
+ }
+ if (ret_sum != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ *ret_sum = work_sum; // chesum Storing
+ }
+ } else {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("invalid erase_size:%d", erase_size);
+ // checksum error
+ return RET_CHK_BCC_ERR;
+ // LCOV_EXCL_STOP
+ }
+ return RET_CHK_OK;
+}
+
+/***************************************************************************
+int backup_cheksum_write(char * p_buff, int erase_size )
+ * A text character sequence and a sum value are written in a buffer.
+ IN: char * p_buff ...top address
+ int erase_size ...erase size
+
+ OUT: int 0:normal Except:error
+ Remarks:
+*****************************************************************************/
+int MtdBackupCheksumWrite(char * p_buff, int erase_size ) {
+ int sum_add = 0;
+
+ if (erase_size > BACKUP_CHECK_OFFSET) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ int ret_status;
+ // The check of the compatibility of block data
+ ret_status = memcmp(&p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_TEXT, BACKUP_CHECK_SIZE);
+ if (ret_status != 0) {
+ memcpy(&p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_TEXT, BACKUP_CHECK_SIZE);
+ }
+ int llpi;
+ for (llpi=0; llpi < (erase_size-BACKUP_CHECK_OFFSET); llpi++) {
+ sum_add += p_buff[llpi];
+ }
+ }
+ p_buff[(erase_size-BACKUP_CHECK_DAT2)] = (char)(sum_add & 0xff);
+ p_buff[(erase_size-BACKUP_CHECK_DAT1)] = (char)((sum_add>>8) & 0xff);
+ return RET_DEV_NORMAL;
+}
+
+/***************************************************************************
+@brief MtdBackupInfo( mtd_info_t * mtd_info)
+@outline The information to obtain is obtained.
+@type Completion return type
+@param[in] mtd_info_t * mtd_info
+@return int
+@retval 0 : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+int MtdBackupInfo(const char * path_name, mtd_info_t * mtd_info) {
+ int ret_status = RET_DEV_NORMAL;
+
+ int mtd_fd = open(path_name, O_RDONLY|O_CLOEXEC);
+ if (mtd_fd == -1) {
+ NOR_ERRLOG("open(%s):%s", path_name, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ } else {
+ // device control mtdchar_ioctl of mtdchar.c
+ if (ioctl(mtd_fd, MEMGETINFO, mtd_info) < 0) {
+ NOR_ERRLOG("ioctl(MEMGETINFO):%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ }
+ if (0 != close(mtd_fd)) {
+ NOR_ERRLOG("close():%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ }
+ }
+ return ret_status;
+}
+
+/**************************************************************
+ End Of Files
+**************************************************************/
diff --git a/systemservice/rom_access_library/library/rom/Makefile b/systemservice/rom_access_library/library/rom/Makefile
new file mode 100755
index 0000000..81acd8a
--- /dev/null
+++ b/systemservice/rom_access_library/library/rom/Makefile
@@ -0,0 +1,62 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### search paths #############
+VPATH += src
+VPATH += ../include/$(COMPONENT_NAME)
+
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libSS_RomAccessIf
+
+######### headers to be installed(*.h) #############
+INST_HEADERS = rom_access_library.h ss_sm_boot_access.h ss_sm_ram_access.h ss_sm_rom_access.h
+
+######### compiled sources #############
+libSS_RomAccessIf_SRCS += ss_sm_rom_access.cpp ss_sm_boot_access.cpp ss_sm_ram_access.cpp ss_sm_checksum.cpp
+
+######### add include path #############
+CPPFLAGS += -I./../include
+
+######### frameworkunifiedlog options #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### add compile option #############
+LDFLAGS += -L./../nor/
+LINK_SHLIB_CXX := y
+LDFLAGS += -g -Wl,--gc-sections -shared
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lssaccess
+LDLIBS += -Wl,-Bdynamic -lextension
+
+CPPFLAGS_ss_sm_checksum.o += -fno-exceptions
+CPPFLAGS_ss_sm_checksum.os += -fno-exceptions
+CPPFLAGS_ss_sm_ram_access.o += -fno-exceptions
+CPPFLAGS_ss_sm_ram_access.os += -fno-exceptions
+
+include ../../../system_service.mk
diff --git a/systemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp b/systemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp
new file mode 100755
index 0000000..44e8a53
--- /dev/null
+++ b/systemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp
@@ -0,0 +1,122 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "system_service/ss_sm_boot_access.h"
+#include <stdio.h>
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+#include "system_service/nor_backup.h"
+#include "ss_rom_access_if_romaccesslibrarylog.h"
+#include "ss_rom_access_define.h"
+
+#define BAI_MTD_DEV_RO "/dev/mtd1ro" // NOR device for RO
+#define BAI_MTD_DEV_RW "/dev/mtd1" // NOR device for RW
+
+#define BAI_SERCTOR_OFFSET 0
+#define BAI_DATA_OFFSET 0
+
+void* BOOT_AccessIf::g_m_plock = NULL;
+
+BOOT_AccessIf::BOOT_AccessIf(BAI_OPEN_t type)
+ : m_type(type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!(m_type == BAI_OPEN_RO // LCOV_EXCL_BR_LINE 6: double check
+ || m_type == BAI_OPEN_RW)) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ throw __LINE__; // LCOV_EXCL_LINE 6: double check
+ }
+
+ if (g_m_plock == NULL) {
+ g_m_plock = CL_LockMap(LOCK_BOOT_ACCESS_IF);
+
+ if (g_m_plock == MAP_FAILED) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ "CL_LockMap Error, please check whether you call CL_LockProcessInit");
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+
+ if (g_m_plock) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ ROM_ACCESS_ASERT(0 == CL_LockGet(g_m_plock)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+BOOT_AccessIf::~BOOT_AccessIf() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (g_m_plock) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ ROM_ACCESS_ASERT(0 == CL_LockRelease(g_m_plock)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus BOOT_AccessIf::getBootInfo(LBM_NOR_t* p_bootInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eRet = eFrameworkunifiedStatusOK;
+ try {
+ int ret;
+ if (p_bootInfo == NULL) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw __LINE__;
+ }
+ ret = mtdn_backup_Read((const char *) BAI_MTD_DEV_RO, BAI_SERCTOR_OFFSET,
+ BAI_DATA_OFFSET, sizeof(LBM_NOR_t), p_bootInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ if (ret != 0) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw __LINE__;
+ }
+ } catch (...) {
+ eRet = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eRet;
+}
+
+EFrameworkunifiedStatus BOOT_AccessIf::setBootInfo(LBM_NOR_t* p_bootInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eRet = eFrameworkunifiedStatusOK;
+ try {
+ int ret;
+ if (p_bootInfo == NULL) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw __LINE__;
+ }
+ if (m_type != BAI_OPEN_RW) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw __LINE__;
+ }
+ ret = mtdn_backup_Write((const char *) BAI_MTD_DEV_RW, BAI_SERCTOR_OFFSET,
+ BAI_DATA_OFFSET, sizeof(LBM_NOR_t), p_bootInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5:c API error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_LINE 5:c API error case
+ throw __LINE__; // LCOV_EXCL_LINE 5:c API error case
+ }
+ } catch (...) {
+ eRet = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eRet;
+}
+
diff --git a/systemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp b/systemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp
new file mode 100755
index 0000000..52cb114
--- /dev/null
+++ b/systemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp
@@ -0,0 +1,37 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides for checksum calculation.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_sm_checksum.h"
+
+CSMChecksum::CSMChecksum() {}
+CSMChecksum::~CSMChecksum() {}
+UI_32 CSMChecksum::cal_checksum(const void* p_buf, size_t bufSize) {
+ size_t num;
+ UI_32 sum = 0;
+ const UI_32 *p_calcBuf = reinterpret_cast<const UI_32 *>(p_buf);
+ num = bufSize / sizeof(UI_32);
+
+ for (size_t i = 0; i < num; i++) {
+ sum += p_calcBuf[i];
+ }
+ return sum;
+}
+
diff --git a/systemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp b/systemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp
new file mode 100755
index 0000000..b5cf244
--- /dev/null
+++ b/systemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp
@@ -0,0 +1,215 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "system_service/ss_sm_ram_access.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+#include <stub/el_mem.h>
+#include "system_service/ss_sm_boot_access.h"
+#include "ss_rom_access_if_romaccesslibrarylog.h"
+#include "ss_sm_checksum.h"
+#include "ss_rom_access_define.h"
+
+
+
+#define RAM_PATH "/nv/BS/ss/rom_access_library/rwdata/ramdata.dat"
+#define RAM_OLD_PATH RAM_PATH".old"
+static const uint8_t kSigNature[] = { 0xDE, 0xAD, 0xBE, 0xEF };
+static const uint8_t kMagic[] = { 0xDE, 0xAD, 0xBE, 0xEF };
+
+void* RAM_AccessIf::g_m_plock = NULL;
+void* RAM_AccessIf::g_m_bakup_map = MAP_FAILED;
+bool RAM_AccessIf::g_m_is_first_access = false;
+
+typedef struct {
+ char magic_in[4];
+ RAM_SM_INFO_t data0;
+ uint32_t checksum0;
+ RAM_SM_INFO_t data1;
+ uint32_t checksum1;
+ char magic_out[4];
+} RAM_SM_DRAM_INFO_t;
+
+void RAM_AccessIf::initRamBackupEnable(RAM_WAKEUP_STATE wupState) {
+ RAM_SM_DRAM_INFO_t* p_buf;
+ CSMChecksum l_checksum;
+
+ ROM_ACCESS_STATIC_ASERT(sizeof(RAM_SM_DRAM_INFO_t) <= SS_SYS_AREA_RAM_MAX_SIZE);
+ // Checking sizes because checksum calculations expect 4 bytes alignments
+ ROM_ACCESS_STATIC_ASERT((sizeof(RAM_SM_DRAM_INFO_t) % sizeof(UI_32)) == 0);
+
+ if (g_m_bakup_map == MAP_FAILED) {
+ g_m_bakup_map = EL_mem_exram_mmap( // LCOV_EXCL_BR_LINE 11:unexpected branch
+ EL_MEM_TYPE_REGION_SYS,
+ EL_mem_getOffset(EL_MEM_ID_SYS_BOOT) + SS_SYS_AREA_RAM_OFFSET, // LCOV_EXCL_BR_LINE 11:unexpected branch
+ SS_SYS_AREA_RAM_MAX_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
+ EL_MEM_CACHE_INVALID);
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed
+ if (g_m_bakup_map == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0); // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed
+ return; // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed
+ }
+ }
+ p_buf = static_cast<RAM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+
+ // LCOV_EXCL_BR_START 6:impossible to confirm because wupState can not be changed
+ if ((RAM_WAKEUP_STATE_BACKUP_NG == wupState) ||
+ (RAM_WAKEUP_STATE_BATTERY_DOWN == wupState) ||
+ (memcmp(p_buf->magic_out, kMagic, sizeof(kMagic)) != 0) ||
+ (memcmp(p_buf->magic_in, p_buf->magic_out, sizeof(p_buf->magic_in)) != 0)) {
+ // LCOV_EXCL_BR_STOP
+ // BACKUP NG
+ g_m_is_first_access = false;
+ bzero(p_buf, sizeof(RAM_SM_DRAM_INFO_t));
+ }
+
+ if (!g_m_is_first_access) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if ((memcmp(p_buf->data0.signature_in, kSigNature, sizeof(kSigNature)) == 0)
+ && (memcmp(p_buf->data0.signature_out, kSigNature,
+ sizeof(kSigNature)) == 0)
+ && (l_checksum.cal_checksum(&(p_buf->data0), sizeof(p_buf->data0)) == p_buf->checksum0)) {
+ // LCOV_EXCL_BR_STOP
+ // Use data0 content
+ memcpy(&(p_buf->data1), &(p_buf->data0), sizeof(p_buf->data1));
+ p_buf->checksum1 = p_buf->checksum0;
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ } else if ((memcmp(p_buf->data1.signature_in, kSigNature, sizeof(kSigNature)) == 0)
+ && (memcmp(p_buf->data1.signature_out, kSigNature,
+ sizeof(kSigNature)) == 0)
+ && (l_checksum.cal_checksum(&(p_buf->data1), sizeof(p_buf->data1)) == p_buf->checksum1)) {
+ // LCOV_EXCL_BR_STOP
+ // Use data1 content
+ memcpy(&(p_buf->data0), &(p_buf->data1), sizeof(p_buf->data0));
+ p_buf->checksum0 = p_buf->checksum1;
+ } else {
+ // BACKUP NG or SIGNATURE CHECK or CHECK SUM NG
+ bzero(p_buf, sizeof(RAM_SM_DRAM_INFO_t));
+ memcpy(p_buf->magic_in, kMagic, sizeof(kMagic));
+ // data0
+ memcpy(p_buf->data0.signature_in, kSigNature, sizeof(kSigNature));
+ memcpy(p_buf->data0.signature_out, kSigNature, sizeof(kSigNature));
+ p_buf->checksum0 =
+ l_checksum.cal_checksum(&(p_buf->data0), sizeof(p_buf->data0)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // data1
+ memcpy(p_buf->data1.signature_in, kSigNature, sizeof(kSigNature));
+ memcpy(p_buf->data1.signature_out, kSigNature, sizeof(kSigNature));
+ p_buf->checksum1 =
+ l_checksum.cal_checksum(&(p_buf->data1), sizeof(p_buf->data1)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ memcpy(p_buf->magic_out, kMagic, sizeof(kMagic));
+ }
+ }
+ memcpy(&m_buf, &(p_buf->data0), sizeof(p_buf->data0));
+}
+
+void RAM_AccessIf::finalRamBackupEnable(void) {
+ RAM_SM_DRAM_INFO_t* p_buf;
+ CSMChecksum l_checksum;
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed
+ if (g_m_bakup_map == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed
+ return; // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed
+ }
+
+ p_buf = static_cast<RAM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+
+ // kSigNature is cleared during writing
+ bzero(m_buf.signature_in, sizeof(kSigNature));
+
+ // data0
+ memcpy(&(p_buf->data0), &m_buf, sizeof(p_buf->data0));
+ memcpy(p_buf->data0.signature_in, kSigNature, sizeof(kSigNature));
+ p_buf->checksum0 = l_checksum.cal_checksum(&(p_buf->data0), // LCOV_EXCL_BR_LINE 11:unexpected branch
+ sizeof(p_buf->data0));
+
+ // data1
+ memcpy(&(p_buf->data1), &m_buf, sizeof(p_buf->data1));
+ memcpy(p_buf->data1.signature_in, kSigNature, sizeof(kSigNature));
+ p_buf->checksum1 = l_checksum.cal_checksum(&(p_buf->data1), // LCOV_EXCL_BR_LINE 11:unexpected branch
+ sizeof(p_buf->data1));
+
+ // Set kSigNature
+ memcpy(m_buf.signature_in, kSigNature,
+ sizeof(kSigNature));
+}
+
+RAM_AccessIf::RAM_AccessIf(
+ RAM_WAKEUP_STATE wupState /* = RAM_WAKEUP_STATE_DONT_CARE */)
+ : m_buf(),
+ m_dirty(false) {
+
+ if (g_m_plock == NULL) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ g_m_plock = CL_LockMap(LOCK_RAM_ACCESS_IF);
+ if (g_m_plock == MAP_FAILED) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ "CL_LockMap Error, please check whether you call CL_LockProcessInit");
+ // LCOV_EXCL_BR_STOP
+ g_m_plock = NULL;
+ }
+ }
+ if (g_m_plock) {
+ if (0 != CL_LockGet(g_m_plock)) {
+ ROM_ACCESS_ASERT(0);
+ }
+ }
+
+ if (RAM_WAKEUP_STATE_BATTERY_DOWN == wupState) { // LCOV_EXCL_BR_LINE 13:
+ // Models without DRAM backups are initialized when +B is down.
+ // Deletes files because models with DRAM backups are also backwards compatible
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ unlink(RAM_PATH); // LCOV_EXCL_LINE 13:
+ unlink(RAM_OLD_PATH); // LCOV_EXCL_LINE 13:
+ }
+
+ initRamBackupEnable(wupState);
+ g_m_is_first_access = true;
+}
+
+RAM_AccessIf::~RAM_AccessIf() {
+ if (m_dirty) {
+ finalRamBackupEnable();
+ }
+ if (g_m_plock) {
+ ROM_ACCESS_ASERT(0 == CL_LockRelease(g_m_plock));
+ }
+
+ return;
+}
+
+EFrameworkunifiedStatus RAM_AccessIf::getRamInfo(RAM_SM_INFO_t* p_bootInfo) {
+ *p_bootInfo = m_buf;
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus RAM_AccessIf::setRamInfo(RAM_SM_INFO_t* p_bootInfo) {
+ if (0 != memcmp(&m_buf, p_bootInfo, sizeof(m_buf))) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ m_buf = *p_bootInfo;
+ m_dirty = true;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/systemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp b/systemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp
new file mode 100755
index 0000000..53589c2
--- /dev/null
+++ b/systemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp
@@ -0,0 +1,969 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_RomAccess
+/// \brief This file supports ROM Access.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_sm_rom_access.h"
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+#include <stub/el_mem.h>
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+
+#include "ss_rom_access_if_romaccesslibrarylog.h"
+#include "ss_sm_checksum.h"
+#include "ss_rom_access_define.h"
+
+#define ROM_ACCESS_DIR "/nv/BS/ss/rom_access_library/rwdata"
+#define ROM_ACCESS_FILE "romdata.dat"
+const CHAR kDefaultRomDevice[] = ROM_ACCESS_DIR"/"ROM_ACCESS_FILE;
+const CHAR kRecoveryRomDevice[] = ROM_ACCESS_DIR"/"ROM_ACCESS_FILE".old";
+static const uint8_t kMagic[] = { 0xDE, 0xAD, 0xBE, 0xEF };
+
+typedef enum {
+ INDEX_BOOTFLAG = 0,
+ INDEX_ACTIVE_FLASHLOADER,
+ INDEX_PARTITIONS_RW_FLAG,
+ INDEX_LAST_USER_MODE,
+ INDEX_TRANSPORT_MODE,
+ INDEX_PRODUCTION_MODE,
+ INDEX_LIMP_HOME_CUT_OFF_REQUEST,
+ INDEX_DATARESET_MODE,
+ INDEX_RESET_COUNT,
+ INDEX_LAST_ILGRESET,
+ INDEX_PROGUPDATE_STATE,
+ INDEX_ERR_LOG_COUNT,
+ INDEX_NEXT_WAKEUP_TYPE,
+ INDEX_SIGNATURE = 15, // As far as possible, do not modify this index value!!!!!
+ INDEX_PROG_STATE = 20,
+ INDEX_PROG_STATE_END = 63,
+ INDEX_PRODUCT_PRIVATE, // 64
+ INDEX_PRODUCT_PRIVATE_END = (INDEX_PRODUCT_PRIVATE + ROM_PRODUCT_PRIVATE_MAX
+ - 1),
+ INDEX_MAX
+} eRomIndices;
+
+void* ROM_AccessIf::g_m_plock = NULL;
+void* ROM_AccessIf::g_m_bakup_map = MAP_FAILED;
+bool ROM_AccessIf::g_m_is_dram_valid = false;
+
+typedef struct {
+ char magic_in[4];
+ bool is_dirty;
+ UI_32 data[INDEX_MAX];
+ uint32_t checksum;
+ char magic_out[4];
+} ROM_SM_DRAM_INFO_t;
+
+ROM_AccessIf::ROM_AccessIf()
+ : m_pBoot(NULL),
+ m_norIsDirty(false) {
+ bzero(&m_nor, sizeof(m_nor));
+
+ if (g_m_plock == NULL) {
+ g_m_plock = CL_LockMap(LOCK_ROM_ACCESS_IF);
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ if (g_m_plock == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ "CL_LockMap Error, please check whether you call CL_LockProcessInit");
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ if (g_m_plock) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ if (0 != CL_LockGet(g_m_plock)) {
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ }
+ }
+}
+
+ROM_AccessIf::~ROM_AccessIf() {
+ if (m_pBoot) {
+ if (m_norIsDirty) {
+ ROM_ACCESS_ASERT(eFrameworkunifiedStatusOK == m_pBoot->setBootInfo(&m_nor)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ delete m_pBoot; // LCOV_EXCL_BR_LINE 11:unexpected branch
+ m_pBoot = NULL;
+ }
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ if (g_m_plock) {
+ ROM_ACCESS_ASERT(0 == CL_LockRelease(g_m_plock));
+ } // LCOV_EXCL_BR_STOP
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::LBA_Read(UI_32 offset, UI_32* buffer,
+ UI_32 word_count) {
+ ROM_SM_DRAM_INFO_t* p_buf;
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed
+ if (g_m_bakup_map == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " g_m_bakup_map uninitialize");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+ memcpy(buffer, &p_buf->data[offset], word_count * sizeof(UI_32));
+
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::LBA_Write(UI_32 offset, UI_32 value) {
+ UI_32 l_value = value;
+ return LBA_Write(offset, &l_value, sizeof(UI_32));
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::LBA_Write(UI_32 offset, UI_32* value, UI_32 size) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ const CHAR *l_file = kDefaultRomDevice;
+ SI_32 fd = -1;
+ ROM_SM_DRAM_INFO_t* p_buf;
+ if (g_m_bakup_map == MAP_FAILED) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " g_m_bakup_map uninitialize");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+
+ if (memcmp(&p_buf->data[offset], value, size) == 0) {
+ // Not Write when the value does not change
+ return eFrameworkunifiedStatusOK;
+ }
+
+ p_buf->is_dirty = true;
+ memcpy(&p_buf->data[offset], value, size);
+
+ CSMChecksum l_checksum;
+ p_buf->checksum = l_checksum.cal_checksum(&(p_buf->data), // LCOV_EXCL_BR_LINE 11:unexpected branch
+ sizeof(p_buf->data)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ if (0 != rename(kDefaultRomDevice, kRecoveryRomDevice)) {
+ ROM_ACCESS_ERRNO(0);
+ } else {
+ int sync_fd;
+ sync_fd = open(kRecoveryRomDevice, O_RDWR | O_DSYNC | O_CLOEXEC); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (sync_fd != -1) {
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ERRNO(0 == fsync(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ROM_ACCESS_ERRNO(0 == close(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0); // LCOV_EXCL_LINE 5:It's impossible to mock open() function,so this line can not be passed.
+ }
+ }
+ fd = open(l_file, O_CREAT | O_TRUNC | O_RDWR | O_DSYNC | O_CLOEXEC, 00664); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (fd == -1) {
+ ROM_ACCESS_ERRNO(0);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: open(%s) returned -1", l_file);
+ eStatus = eFrameworkunifiedStatusFail;
+ goto ERROR;
+ }
+
+ /** Write the value of 32-bits at offset location */
+ if (sizeof(p_buf->data) != write(fd, p_buf->data, sizeof(p_buf->data))) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 5:It's impossible to mock write() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: write(%s) returned -1", l_file);
+ eStatus = eFrameworkunifiedStatusFail;
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ ROM_ACCESS_ERRNO(0 == close(fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ fd = -1;
+
+ if (0 != unlink(kRecoveryRomDevice)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 5:It's impossible to mock unlink() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0);
+ // LCOV_EXCL_STOP
+ }
+
+ int sync_fd;
+ sync_fd = open(ROM_ACCESS_DIR, O_RDONLY); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (sync_fd != -1) {
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ERRNO(0 == fsync(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ROM_ACCESS_ERRNO(0 == close(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0); // LCOV_EXCL_LINE 5:It's impossible to mock open() function,so this line can not be passed.
+ }
+ }
+ p_buf->is_dirty = false;
+ ERROR: if (fd != -1) { // LCOV_EXCL_BR_LINE 5:It's impossible to mock open() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(fd); // LCOV_EXCL_LINE 5:It's impossible to mock write() function,so this line can not be passed.
+ }
+ // @todo memory value is not restored if non-volatile area writing fails after writing to memory
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetDataResetMode_sub(EDATARESET_MODE* pDataResetMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_DATARESET_MODE,
+ reinterpret_cast<UI_32 *>(pDataResetMode), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+// This function may be called in duplicate,
+// so it is necessary to operate normally even if it is called in duplicate.
+EFrameworkunifiedStatus ROM_AccessIf::SystemInitialize(DRAM_BACKUP_STATE bkupState) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ ROM_ACCESS_STATIC_ASERT(sizeof(ROM_SM_DRAM_INFO_t) <= SS_SYS_AREA_ROM_MAX_SIZE);
+
+ // Checksum calculations expect 4-bytes alignments
+ ROM_ACCESS_STATIC_ASERT((sizeof(ROM_SM_DRAM_INFO_t) % sizeof(UI_32)) == 0);
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed
+ if (g_m_bakup_map == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ g_m_bakup_map = EL_mem_exram_mmap(
+ EL_MEM_TYPE_REGION_SYS,
+ EL_mem_getOffset(EL_MEM_ID_SYS_BOOT) + SS_SYS_AREA_ROM_OFFSET,
+ SS_SYS_AREA_ROM_MAX_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
+ EL_MEM_CACHE_INVALID);
+ if (g_m_bakup_map == MAP_FAILED) {
+ ROM_ACCESS_ERRNO(0);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+
+ if (bkupState
+ == DRAM_BACKUP_STATE_NG) {
+ // BACKUP NG
+ ROM_SM_DRAM_INFO_t* p_buf;
+ CSMChecksum l_checksum;
+
+ p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+ bzero(&(p_buf->magic_in), sizeof(p_buf->magic_in));
+ bzero(&(p_buf->magic_out), sizeof(p_buf->magic_out));
+ g_m_is_dram_valid = false;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::Initialize() {
+ const CHAR *l_file = kDefaultRomDevice;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CSMChecksum l_checksum;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (g_m_bakup_map == MAP_FAILED) {
+ g_m_bakup_map = EL_mem_exram_mmap( // LCOV_EXCL_BR_LINE 11:unexpected branch
+ EL_MEM_TYPE_REGION_SYS,
+ EL_mem_getOffset(EL_MEM_ID_SYS_BOOT) + SS_SYS_AREA_ROM_OFFSET, // LCOV_EXCL_BR_LINE 11:unexpected branch
+ SS_SYS_AREA_ROM_MAX_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
+ EL_MEM_CACHE_INVALID);
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed
+ if (g_m_bakup_map == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ERRNO(0);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ if (!g_m_is_dram_valid) {
+ SI_32 fd = -1;
+ ROM_SM_DRAM_INFO_t* p_buf;
+ p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+ if ((p_buf->is_dirty)
+ || (memcmp(kMagic, p_buf->magic_in, sizeof(kMagic)) != 0)
+ || (memcmp(kMagic, p_buf->magic_out, sizeof(kMagic)) != 0)
+ || ((l_checksum.cal_checksum(&(p_buf->data), sizeof(p_buf->data)) != p_buf->checksum))) {
+ // Need to synchronize the NVs with the data on the DRAM
+ struct stat stutInfo;
+ if (0 != stat(ROM_ACCESS_DIR, &stutInfo)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock stat() function,so this line can not be passed.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s not found", ROM_ACCESS_DIR);
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ASERT(0 == mkdir(ROM_ACCESS_DIR, 0775)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ int expectSize = (INT32)(INDEX_MAX * sizeof(UI_32));
+ int sigSize = (INT32)((INDEX_SIGNATURE + 1) * sizeof(UI_32));
+
+ if (access(kRecoveryRomDevice, F_OK) == 0) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock access() function,so this line can not be passed.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s is found", kRecoveryRomDevice);
+ // LCOV_EXCL_BR_STOP
+ if (0 != unlink(kDefaultRomDevice)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock unlink() function,so this line can not be passed.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error:unlink(%s)", kDefaultRomDevice);
+ // LCOV_EXCL_BR_STOP
+ }
+ if (0 != rename(kRecoveryRomDevice, kDefaultRomDevice)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ROM_ACCESS_ERRNO(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ }
+ if (0 == stat(kDefaultRomDevice, &stutInfo) // LCOV_EXCL_BR_LINE 11:unexpected branch
+ && stutInfo.st_size >= sigSize) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // Use this value if there are more sizes than SIGNITURE
+ #define ROM_ACCESS_INFO_SIZE (sizeof(ROM_SM_DRAM_INFO_t) - (sizeof(UI_32)*INDEX_MAX))
+ #define ROM_ACCESS_MAX_SIZE (INT32)(SS_SYS_AREA_ROM_MAX_SIZE - ROM_ACCESS_INFO_SIZE)
+ // Maximum size of RAM area - An upper size limit of the management info size
+ if (stutInfo.st_size > ROM_ACCESS_MAX_SIZE) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ stutInfo.st_size = ROM_ACCESS_MAX_SIZE;
+ }
+ fd = open(l_file, // LCOV_EXCL_BR_LINE 11:unexpected branch
+ O_RDWR | O_DSYNC | O_CLOEXEC); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (fd != -1) {
+ int ret;
+ if (stutInfo.st_size < expectSize) {
+ // If the files are large, APPEND them
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "PADDING");
+ ret = ftruncate(fd, expectSize);
+ ROM_ACCESS_ERRNO(ret == 0);
+ fsync(fd);
+ } else if (stutInfo.st_size > expectSize) {
+ // If the files are small, TRANC them
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "CUT");
+ ret = ftruncate(fd, expectSize);
+ ROM_ACCESS_ERRNO(ret == 0);
+ fsync(fd);
+ }
+ }
+ // LCOV_EXCL_BR_STOP
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s size is not crrect",
+ kDefaultRomDevice);
+ // LCOV_EXCL_BR_STOP
+ fd = open(l_file, O_CREAT | O_TRUNC | O_RDWR | O_DSYNC | O_CLOEXEC,
+ 00664); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (fd != -1) {
+ UI_32 buf[INDEX_MAX];
+ bzero(buf, sizeof(buf));
+ ROM_ACCESS_ASERT(sizeof(buf) == write(fd, buf, sizeof(buf)))
+ fsync(fd);
+ }
+ // LCOV_EXCL_BR_STOP
+ }
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (fd != -1) {
+ // LCOV_EXCL_BR_STOP
+ UI_32 read_buf[INDEX_MAX];
+ if (-1 == lseek(fd, 0, SEEK_SET)) {
+ // LCOV_EXCL_START 5:It's impossible to mock lseek() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0);
+ // LCOV_EXCL_STOP
+ } else {
+ if (-1 == read(fd, read_buf, sizeof(read_buf))) {
+ // LCOV_EXCL_START 5:It's impossible to mock read() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0);
+ // LCOV_EXCL_STOP
+ } else {
+ memcpy(p_buf->magic_in, kMagic, sizeof(kMagic));
+ memcpy(&p_buf->data, read_buf, sizeof(p_buf->data));
+ p_buf->checksum = l_checksum.cal_checksum(&(p_buf->data),
+ sizeof(p_buf->data));
+ memcpy(p_buf->magic_out, kMagic, sizeof(kMagic));
+ p_buf->is_dirty = false;
+
+ // Synchronization of NV data with data on the DRAM completed
+ g_m_is_dram_valid = true;
+ }
+ }
+ close(fd);
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:open(%s)", l_file);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ // No need to synchronize NV data with data on the DRAM
+ g_m_is_dram_valid = true;
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " alreay initialized");
+ // LCOV_EXCL_BR_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetSignature(UI_32* pSigValue) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_SIGNATURE,
+ reinterpret_cast<UI_32 *>(pSigValue), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetSignature(UI_32 sigValue) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_SIGNATURE,
+ sigValue))) {
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(0x%X) errored: 0x%X",
+ sigValue, eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetBootMode(EBOOT_MODE* pBootMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_BOOTFLAG,
+ reinterpret_cast<UI_32 *>(pBootMode), 1))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: LBA_Read() errored: 0x%X", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetBootMode(EBOOT_MODE bootMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_BOOTFLAG, bootMode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%d) errored: 0x%X",
+ bootMode, eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetLastUserMode(EUSER_MODE* pUserMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_LAST_USER_MODE,
+ reinterpret_cast<UI_32 *>(pUserMode), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetLastUserMode(EUSER_MODE userMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_LAST_USER_MODE, userMode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X",
+ userMode == USER_OFF ? "USER_OFF" : "USER_ON", eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetTransportMode(ECONTROL_MODE* pControlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_TRANSPORT_MODE,
+ reinterpret_cast<UI_32 *>(pControlMode), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetTransportMode(ECONTROL_MODE controlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_TRANSPORT_MODE, controlMode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X",
+ controlMode == DISABLE_MODE ? "DISABLE_MODE" : "ENABLE_MODE",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+
+EFrameworkunifiedStatus ROM_AccessIf::GetProductionMode(ECONTROL_MODE* pControlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_PRODUCTION_MODE,
+ reinterpret_cast<UI_32 *>(pControlMode), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetProductionMode(ECONTROL_MODE controlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_PRODUCTION_MODE, controlMode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X",
+ controlMode == DISABLE_MODE ? "DISABLE_MODE" : "ENABLE_MODE",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetLimpHomeCutOffReqMode(ECONTROL_MODE* pControlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_LIMP_HOME_CUT_OFF_REQUEST,
+ reinterpret_cast<UI_32 *>(pControlMode), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetLimpHomeCutOffReqMode(ECONTROL_MODE controlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_LIMP_HOME_CUT_OFF_REQUEST, controlMode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X",
+ controlMode == DISABLE_MODE ? "DISABLE_MODE" : "ENABLE_MODE",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetDataResetMode(EDATARESET_MODE* pDataResetMode) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ try {
+ UI_32 sts;
+ if (m_pBoot == NULL) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because m_pBoot can not be changed
+ m_pBoot = new BOOT_AccessIf(BAI_OPEN_RW); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != m_pBoot->getBootInfo(&m_nor)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw eFrameworkunifiedStatusFail;
+ }
+ }
+
+ if ((m_nor.sts1 == m_nor.sts2) || (m_nor.sts1 == m_nor.sts3)) {
+ sts = m_nor.sts1;
+ } else if (m_nor.sts2 == m_nor.sts3) {
+ sts = m_nor.sts2;
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ sts = SYSUP_CND_NORMAL;
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ if (sts == SYSUP_CND_FACTRESET) {
+ *pDataResetMode = DATARESET_FACTORY;
+ } else {
+ eStatus = GetDataResetMode_sub(pDataResetMode); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ } catch (const EFrameworkunifiedStatus& e) {
+ eStatus = e;
+ } catch (...) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusFail;
+ } // LCOV_EXCL_STOP
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetDataResetModeFast(EDATARESET_MODE* pDataResetMode) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ void* p_map = MAP_FAILED;
+ size_t mapSize = 0;
+ try {
+ LBM_RAM_t* p_lbm = NULL;
+ mapSize = SS_SYS_AREA_BOOT_MAX_SIZE;
+
+ if (EL_mem_getLength(EL_MEM_ID_SYS_BOOT) < SS_SYS_AREA_BOOT_MAX_SIZE) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ mapSize = EL_mem_getLength(EL_MEM_ID_SYS_BOOT); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ p_map = reinterpret_cast<LBM_RAM_t*>(EL_mem_exram_mmap(EL_MEM_TYPE_REGION_SYS,
+ EL_mem_getOffset(EL_MEM_ID_SYS_BOOT),
+ mapSize, PROT_READ | PROT_WRITE,
+ MAP_SHARED, EL_MEM_CACHE_INVALID));
+ // LCOV_EXCL_BR_STOP
+ if (p_map == MAP_FAILED) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because p_map can not be changed
+ ROM_ACCESS_ERRNO(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because p_map can not be changed
+ throw eFrameworkunifiedStatusFail;
+ }
+ p_lbm = static_cast<LBM_RAM_t*>(p_map);
+ if (p_lbm->sts == SYSUP_CND_FACTRESET) {
+ *pDataResetMode = DATARESET_FACTORY;
+ } else {
+ eStatus = GetDataResetMode_sub(pDataResetMode); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ } catch (const EFrameworkunifiedStatus& e) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ eStatus = e;
+ } catch (...) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ASERT(0);
+ eStatus = eFrameworkunifiedStatusFail;
+ } // LCOV_EXCL_STOP
+
+ if (p_map != MAP_FAILED) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because p_map can not be changed
+ ROM_ACCESS_ERRNO(0 == EL_mem_exram_munmap(p_map, // LCOV_EXCL_BR_LINE 11:unexpected branch
+ mapSize));
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:unexpected branch
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetDataResetMode(EDATARESET_MODE dataResetMode) {
+ EFrameworkunifiedStatus eStatus;
+ EDATARESET_MODE l_mode = dataResetMode;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ try {
+ if (m_pBoot == NULL) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because m_pBoot can not be changed
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ m_pBoot = new BOOT_AccessIf(BAI_OPEN_RW);
+ // LCOV_EXCL_BR_STOP
+ if (eFrameworkunifiedStatusOK != m_pBoot->getBootInfo(&m_nor)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw eFrameworkunifiedStatusFail;
+ }
+ }
+ m_norIsDirty = true;
+ if (dataResetMode == DATARESET_FACTORY) {
+ m_nor.sts1 = m_nor.sts2 = m_nor.sts3 = SYSUP_CND_FACTRESET;
+ l_mode = DATARESET_NONE;
+ } else {
+ m_nor.sts1 = m_nor.sts2 = m_nor.sts3 = SYSUP_CND_NORMAL;
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_DATARESET_MODE, l_mode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ } catch (const EFrameworkunifiedStatus& e) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ eStatus = e;
+ } catch (...) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ASERT(0);
+ eStatus = eFrameworkunifiedStatusFail;
+ } // LCOV_EXCL_STOP
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetResetCount(UI_32* pResetCount) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_RESET_COUNT, reinterpret_cast<UI_32 *>(pResetCount),
+ 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+EFrameworkunifiedStatus ROM_AccessIf::SetResetCount(UI_32 resetCount) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (eFrameworkunifiedStatusOK != (eStatus = // LCOV_EXCL_BR_LINE 11:unexpected branch
+ LBA_Write(INDEX_RESET_COUNT, resetCount))) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch
+ eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+EFrameworkunifiedStatus ROM_AccessIf::GetLastIlgReset(ELASTILGRESET_MODE* pLastIlgReset) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_LAST_ILGRESET,
+ reinterpret_cast<UI_32 *>(pLastIlgReset), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetLastIlgReset(ELASTILGRESET_MODE lastIlgReset) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_LAST_ILGRESET, lastIlgReset))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch
+ eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetProgUpdateState(
+ EPROGUPDATE_STATE* pProgUpdateState) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_PROGUPDATE_STATE,
+ reinterpret_cast<UI_32 *>(pProgUpdateState), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetProgUpdateState(EPROGUPDATE_STATE progUpdateState) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_PROGUPDATE_STATE, progUpdateState))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch
+ eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetErrLogCount(UI_32* pErrLogCount) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_ERR_LOG_COUNT,
+ reinterpret_cast<UI_32 *>(pErrLogCount), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetErrLogCount(UI_32 errLogCount) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK != (eStatus = // LCOV_EXCL_BR_LINE 11:unexpected branch
+ LBA_Write(INDEX_ERR_LOG_COUNT, errLogCount))) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch
+ eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetNextWakeupType(ENEXT_WAKEUP_TYPE *pNextWakeupType) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_NEXT_WAKEUP_TYPE,
+ reinterpret_cast<UI_32 *>(pNextWakeupType), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetNextWakeupType(ENEXT_WAKEUP_TYPE nextWakeupType) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_NEXT_WAKEUP_TYPE, nextWakeupType))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Write() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetActiveFlashloader(
+ EACTIVE_FLASHLOADER activeFlashloader) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_ACTIVE_FLASHLOADER, activeFlashloader))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error: LBA_Write(%s) errored: 0x%X",
+ activeFlashloader == NEW_FLASHLOADER ?
+ "NEW_FLASHLOADER" : "OLD_FLASHLOADER",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_PRODUCT_PRIVATE, reinterpret_cast<UI_32*>(buf),
+ ROM_PRODUCT_PRIVATE_MAX / sizeof(UI_32)))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Read(INDEX_PRODUCT_PRIVATE, reinterpret_cast<UI_32 *>(buf),
+ ROM_PRODUCT_PRIVATE_MAX / sizeof(UI_32)))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Read() errored: 0x%X", eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
diff --git a/systemservice/system_manager/LICENSE b/systemservice/system_manager/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/systemservice/system_manager/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/systemservice/system_manager/Makefile.server b/systemservice/system_manager/Makefile.server
new file mode 100755
index 0000000..83bc39b
--- /dev/null
+++ b/systemservice/system_manager/Makefile.server
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS += server
+
+include ../system_service.mk
diff --git a/systemservice/system_manager/server/Makefile b/systemservice/system_manager/server/Makefile
new file mode 100755
index 0000000..04185f9
--- /dev/null
+++ b/systemservice/system_manager/server/Makefile
@@ -0,0 +1,118 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = SS_SystemManager
+
+######### installed library(*.a) #############
+
+
+######### installed shared library(*.so) #############
+
+
+######### install headers(*.h) #############
+
+
+######### compiled sources #############
+SS_SystemManager_SRCS += ./src/processlauncher/ProcessLauncher.cpp
+SS_SystemManager_SRCS += ./src/processlauncher/ProcessLauncher_if.cpp
+SS_SystemManager_SRCS += ./src/heartbeat/ss_hb_if.cpp
+SS_SystemManager_SRCS += ./src/heartbeat/ss_hb_service_protocol.cpp
+SS_SystemManager_SRCS += ./src/heartbeat/ss_hb_session.cpp
+SS_SystemManager_SRCS += ./src/heartbeat/ss_hb_thread.cpp
+SS_SystemManager_SRCS += ./src/systemmanager_application.cpp
+SS_SystemManager_SRCS += ./src/systemmanager_main.cpp
+SS_SystemManager_SRCS += ./src/ss_sm_config.cpp
+SS_SystemManager_SRCS += ./src/ss_sm_dynamic_launcher.cpp
+SS_SystemManager_SRCS += ./src/ss_sm_version.cpp
+SS_SystemManager_SRCS += ./src/ss_system_manager.cpp
+SS_SystemManager_SRCS += ./src/ss_system_manager_callbacks.cpp
+SS_SystemManager_SRCS += ./src/ss_system_manager_error_event.cpp
+SS_SystemManager_SRCS += ./src/ss_system_manager_error_event_responses.cpp
+SS_SystemManager_SRCS += ./src/ss_system_manager_error_event_triggers.cpp
+SS_SystemManager_SRCS += ./src/ss_system_memory_monitor.cpp
+
+######### add source path #############
+
+
+######### add include path #############
+CPPFLAGS += -I./
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/heartbeat
+CPPFLAGS += -I./include/processlauncher
+CPPFLAGS += -I./../../interface_unified/library/include
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+CPPFLAGS_ProcessLauncher.o = -fno-exceptions
+CPPFLAGS_ProcessLauncher_if.o = -fno-exceptions
+CPPFLAGS_ss_hb_if.o = -fno-exceptions
+CPPFLAGS_ss_hb_thread.o = -fno-exceptions
+CPPFLAGS_systemmanager_application.o = -fno-exceptions
+CPPFLAGS_systemmanager_main.o = -fno-exceptions
+CPPFLAGS_ss_system_memory_monitor.o = -fno-exceptions
+CPPFLAGS_ss_hb_service_protocol.o = -fno-exceptions
+CPPFLAGS_ss_hb_session.o = -fno-exceptions
+CPPFLAGS_ss_sm_dynamic_launcher.o = -fno-exceptions
+CPPFLAGS_ss_sm_version.o = -fno-exceptions
+CPPFLAGS_ss_system_manager.o = -fno-exceptions
+CPPFLAGS_ss_system_manager_error_event.o = -fno-exceptions
+
+######### linked library #############
+#LDLIBS += -Wl,-Bstatic -lxxx
+LDLIBS += -Wl,-Bstatic -lSS_LoggerStoreLogs
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lrt # for mq_xxx
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lssver
+
+LDLIBS += -Wl,-Bdynamic -lresm
+LDLIBS += -Wl,-Bdynamic -lsssmcfg
+LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI
+LDLIBS += -Wl,-Bdynamic -lClock_API
+LDLIBS += -Wl,-Bdynamic -lpower_hal
+
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+LDLIBS += -Wl,-Bdynamic -lvp
+LDLIBS += -Wl,-Bdynamic -ltar -lz
+LDLIBS += -Wl,-Bdynamic -lrpc -lev
+
+######### add library path #############
+LDFLAGS += -g -Wl,--gc-sections
+LDFLAGS += -Wl,--warn-unresolved-symbols
+LDFLAGS += -Wl,--no-as-needed
+
+LINK_CXX=Y
+
+install-data: install_data
+
+install_data:
+ cpp -P -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_thread.h ./sm_launch__CWORD84_.xml ./sm_launch.tmp.xml
+ $(SDKTARGETSYSROOT)/usr/agl/share/launch_xml2cfg.sh ./sm_launch.tmp.xml > ./sm_launch.cfg
+ install -d -m 755 $(DESTDIR)/usr/agl/conf/BS/ss/system_manager/rwdata
+ install -m 644 ./sm_launch.cfg $(DESTDIR)/usr/agl/conf/BS/ss/system_manager/rwdata
+ install -d -m 755 $(DESTDIR)/nv/BS/ss/system_manager/rwdata
+ install -d -m 755 $(DESTDIR)/usr/agl/share/BS/ss/system_manager/rodata
+ install -m 644 ./version.txt $(DESTDIR)/usr/agl/share/BS/ss/system_manager/rodata
+ install -m 644 ./PhaseInfo.txt $(DESTDIR)/usr/agl/share/BS/ss/system_manager/rodata
+
+include ../../system_service.mk
diff --git a/systemservice/system_manager/server/PhaseInfo.txt b/systemservice/system_manager/server/PhaseInfo.txt
new file mode 100755
index 0000000..7ed792b
--- /dev/null
+++ b/systemservice/system_manager/server/PhaseInfo.txt
@@ -0,0 +1,2 @@
+Unknown
+20191026
diff --git a/systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h b/systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h
new file mode 100755
index 0000000..ae05af4
--- /dev/null
+++ b/systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for child process exit detection.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_CRASH_DETECTOR_H_ // NOLINT
+#define SS_CRASH_DETECTOR_H_
+
+#include <string>
+
+class CCrashDetector {
+ public:
+ CCrashDetector();
+ virtual ~CCrashDetector();
+ EFrameworkunifiedStatus CrashDetectorInitialize(HANDLE hApp);
+ PCSTR CrashDetectorGetThreadName();
+
+ HANDLE m_hSmQueue;
+
+ private:
+ SI_32 CrashDetectorGetThreadPriority();
+
+ HANDLE m_hApp;
+ pthread_t m_ThreadId;
+ std::string m_ThreadName;
+ SI_32 m_siPriority;
+};
+
+#endif // SS_CRASH_DETECTOR_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/heartbeat/ss_hb_if.h b/systemservice/system_manager/server/include/heartbeat/ss_hb_if.h
new file mode 100755
index 0000000..8d6618f
--- /dev/null
+++ b/systemservice/system_manager/server/include/heartbeat/ss_hb_if.h
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef HEARTBEAT_INTERFACE_H_ // NOLINT
+#define HEARTBEAT_INTERFACE_H_
+
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+
+/**
+ * Enumeration: message category
+ */
+typedef enum HB_STATUS {
+ HB_STATUS_INVALID
+ , HB_STATUS_REGISTERED
+ , HB_STATUS_GOOD
+ , HB_STATUS_FAILED
+ , HB_STATUS_TIMEOUT
+} EHBStatus;
+
+/*
+ * Structure: report message data
+ */
+typedef struct MODULE_INFO {
+#define SS_SM_HB_MAX_PROC_NAME_SIZE 16
+ EHBStatus ProcHBState;
+ UI_32 HeartBeatRetryCount;
+ // "ProcQueueName" is limited 16 bytes (included terminal-character NULL), so that the size of "THbReportData" will be lower than 4K Bytes.
+ CHAR ProcQueueName[SS_SM_HB_MAX_PROC_NAME_SIZE];
+} TSmModuleInfo;
+
+typedef struct HB_REPORT_DATA {
+ EHBStatus eEntireState; ///< entire state for a request.
+ ///< if all modules are success, it's success, otherwise failed.
+ UI_32 nNumOfModules; ///< number of modules
+ TSmModuleInfo tModuleList[SS_MAX_NUM_MODULES]; ///< module information list, which include module IDs and states
+} THbReportData;
+
+typedef struct HB_AVAIL_CHECK {
+ BOOL isOk;
+ CHAR serviceName[SS_SM_HB_MAX_PROC_NAME_SIZE];
+} THbAvailCheck;
+
+
+EFrameworkunifiedStatus HBThreadStart(HANDLE hThread);
+EFrameworkunifiedStatus HBThreadStop(HANDLE hThread);
+
+#endif // HEARTBEAT_INTERFACE_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/heartbeat/ss_hb_session.h b/systemservice/system_manager/server/include/heartbeat/ss_hb_session.h
new file mode 100755
index 0000000..5414f09
--- /dev/null
+++ b/systemservice/system_manager/server/include/heartbeat/ss_hb_session.h
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_HEARTBEAT_SESSION_H_ // NOLINT
+#define SS_HEARTBEAT_SESSION_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+#include <map>
+#include <string>
+
+#include "ss_hb_if.h"
+
+// The name of the module that is trying to open a session with Heart Beat
+typedef std::string SubscriberName;
+
+/*
+ *
+ */
+class CHeartBeatSessionHandler {
+ public:
+ CHeartBeatSessionHandler();
+ virtual ~CHeartBeatSessionHandler();
+
+ EFrameworkunifiedStatus HBProcessClientResponse(HANDLE hApp);
+
+ EFrameworkunifiedStatus HBEntrySubscriber(SubscriberName &f_Subscriber); // NOLINT
+ EFrameworkunifiedStatus HBSendRequest(HANDLE hApp, SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex);
+ EFrameworkunifiedStatus HBCheckResponses(THbReportData &f_tReportData, UI_32 f_MaxHeartBeatRetryCount, // NOLINT
+ SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex);
+
+ EFrameworkunifiedStatus HBDeleteRegisteredClientEntry(HANDLE f_hThread, PSTR pQueueName);
+ EFrameworkunifiedStatus HBAvailableCheck(THbAvailCheck &check); // NOLINT
+
+ VOID HBPrintConnection();
+ VOID HBPrintStack(UI_32 f_MaxHeartBeatRetryCount);
+
+ private:
+ class HbSessionInfo {
+ public:
+ std::string szName;
+ HANDLE hSession;
+ BOOL fRunning;
+ BOOL fHeartBeatRequestSent;
+ BOOL fHeartBeatResponseReceived;
+ UI_8 HeartBeatRetryCount;
+ BOOL fHeartBeatTimedOut;
+ BOOL fisAvailability;
+
+ // Copy constructor
+ HbSessionInfo(const HbSessionInfo &f_SessionInfo) {
+ szName = f_SessionInfo.szName;
+ hSession = f_SessionInfo.hSession;
+ fRunning = f_SessionInfo.fRunning;
+ fHeartBeatRequestSent = f_SessionInfo.fHeartBeatRequestSent;
+ fHeartBeatResponseReceived = f_SessionInfo.fHeartBeatResponseReceived;
+ HeartBeatRetryCount = f_SessionInfo.HeartBeatRetryCount;
+ fHeartBeatTimedOut = f_SessionInfo.fHeartBeatTimedOut;
+ fisAvailability = f_SessionInfo.fisAvailability;
+ }
+
+ explicit HbSessionInfo(SubscriberName f_Subscriber);
+ };
+
+ typedef std::map<SubscriberName, HbSessionInfo> HbSessionMap;
+ typedef HbSessionMap::iterator HbSessionIter;
+
+ HbSessionMap m_mapHbSessions;
+};
+#endif // SS_HEARTBEAT_SESSION_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h b/systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h
new file mode 100755
index 0000000..7ca8e17
--- /dev/null
+++ b/systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h
@@ -0,0 +1,206 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef HEARTBEAT_WORKER_H_ // NOLINT
+#define HEARTBEAT_WORKER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_system_timer.h>
+
+#include "ss_hb_session.h"
+#include "ss_sm_config.h"
+
+
+class CHeartBeatThread {
+ public:
+ explicit CHeartBeatThread(HANDLE f_hThread);
+ virtual ~CHeartBeatThread();
+
+ ///////////////////////////
+ /// HBPublishAvailabilityStatus
+ /// At HeartBeat sends NTFY_Availability with availability
+ /// notification to alert client that HeartBeat is available/not available.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBPublishAvailabilityStatus(HANDLE hThread, BOOL f_AvailabiltyStatus);
+
+ ///////////////////////////
+ /// HBOnStartThread
+ /// Creates and starts the HeartBeat timer
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnStartThread(HANDLE hThread);
+
+
+ ///////////////////////////
+ /// HBOnStopThread
+ /// Stops and deletes the HeartBeat timer
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnStopThread(HANDLE hThread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HBOnPrintConnections
+ /// Prints all active sessions connected to HeartBeat
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnPrintConnections(HANDLE hThread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HBOnPrintStack
+ /// Prints all sessions connected to HeartBeat
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnPrintStack(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnTimerExpiry
+ /// When APP timer expires, this method sends the HeartBeat request to the client.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnTimerExpiry(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnClientResponse
+ /// When the response from a client is received, this method updates the map
+ /// containing client status to indicate the response.
+ ///
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnClientResponse(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnPeriodicStatusRequest
+ /// Reply to Status request from System Manager
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnPeriodicStatusRequest(HANDLE hThread);
+
+
+ ///////////////////////////
+ /// HBOnAvailCheckRequest
+ /// Reply to service's availability condition request from System Manager
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnAvailCheckRequest(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnRemoveModule
+ /// Upon receiving delete module notification from sysmgr, this method removes
+ /// a client from the client session map.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnRemoveModule(HANDLE hApp);
+
+ ///////////////////////////
+ /// HBOnAppendModule
+ /// Upon receiving append module notification from sysmgr, this method append
+ /// a client from the client session map.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnAppendModule(HANDLE hApp);
+
+ // Service notification handlers
+ EFrameworkunifiedStatus HBSendRequest(HANDLE hApp);
+ EFrameworkunifiedStatus HBCheckHeartBeatResponses(HANDLE hThread);
+ EFrameworkunifiedStatus HBDeleteRegisteredClientEntry(PSTR pModuleName);
+
+ EFrameworkunifiedStatus HeartBeatTimerInit(HANDLE hThread);
+ EFrameworkunifiedStatus HeartBeatTimersDelete(void);
+
+ private:
+ CHeartBeatSessionHandler m_oSessionHandler;
+ TimerCtrl m_oTimerCtrl;
+ UI_32 m_HBTimerID;
+ HBConfigParameters m_HBConfigParams;
+ SI_32 m_NextChkIndex;
+ HANDLE m_hThread;
+};
+#endif // HEARTBEAT_WORKER_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h b/systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h
new file mode 100755
index 0000000..409524f
--- /dev/null
+++ b/systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef CPROCESSLAUNCHER_H_ // NOLINT
+#define CPROCESSLAUNCHER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_process.h>
+#include <string>
+#include "ss_system_manager.h"
+#include "ss_sm_process_launcher.h"
+
+/*
+ *
+ */
+class CProcessLauncher {
+ public:
+ CProcessLauncher();
+ explicit CProcessLauncher(void *);
+ virtual ~CProcessLauncher();
+
+ EFrameworkunifiedStatus PLOnCmdTerminateModule(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdModuleStatus(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdLaunchModule(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdRelaunchModule(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdHeartbeatStatusReq(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdStop(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdStart(HANDLE hThread);
+ protected:
+ ProcessMap m_mapOfProcesses;
+
+ private:
+ EFrameworkunifiedStatus PLCmdLaunchModule(HANDLE hThread,
+ UI_32 f_protocol_ID,
+ std::string f_protocol_str);
+ EFrameworkunifiedStatus PLLaunchModule(HANDLE hThread, T_ProcessLaunchResp &f_LaunchRespData); // NOLINT
+ EFrameworkunifiedStatus PLTerminateModule(HANDLE hThread, T_ProcessLauncherTerminationResp *f_pTerminateRespData = NULL);
+};
+#endif // CPROCESSLAUNCHER_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h b/systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h
new file mode 100755
index 0000000..f8d047a
--- /dev/null
+++ b/systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef PROCESSLAUNCHER_IF_H_ // NOLINT
+#define PROCESSLAUNCHER_IF_H_
+
+EFrameworkunifiedStatus ProcessLauncherOnStart(HANDLE hThread);
+EFrameworkunifiedStatus ProcessLauncherOnStop(HANDLE hThread);
+
+#endif // NOLINT
+
diff --git a/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h b/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h
new file mode 100755
index 0000000..1ca177c
--- /dev/null
+++ b/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_PROCESS_LAUNCHER_H_ // NOLINT
+#define SS_SM_PROCESS_LAUNCHER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+
+#include "ss_sm_config.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// System manager launches the modules using the process launcher.
+/// The system manager launches the modules by sending the data about the process to be launched by
+/// the message ePLThrdCmd_LAUNCH_MODULE_REQST.
+/// SM => PL
+///////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ CHAR name[SS_SM_MAX_MODULE_NAME_LENGTH];
+ CHAR path[SS_SM_MAX_MODULE_PATH_LENGTH];
+ CHAR args[SS_SM_MAX_MODULE_ARGS_LENGTH];
+ UI_32 priority;
+ CHAR logging_mask[SS_SM_MAX_MODULE_LOG_MASK_LENGTH];
+ GroupLaunchMapIter groupIterator;
+ ModuleLaunchListIter moduleIterator;
+ int cpu_assign;
+} T_ProcessLauncherLaunchReq;
+
+///////////////////////////////////////////////////////////////////////////////
+/// After successfully launching an module, the process launcher sends the
+/// pid of the launched process along with the process name and arguments
+/// by the message ePLThrdCmd_LAUNCH_MODULE_RESP.
+/// System manager will verify the process name and the arguments and update
+/// the pid in its process table.
+///
+/// This message will be sent for every module that is launched by process launcher.
+/// Launch success returns a number > 0 for ProcessID, which is the PID of the
+/// newly created process.
+/// Launch failure returns -1 for ProcessID.
+/// PL => SM
+///////////////////////////////////////////////////////////////////////////////
+/// The response of the module relaunch message from process launcher to system
+/// manager ePLThrdCmd_RELAUNCH_MODULE_RESP is defined by the below structure
+/// A process ID value of > 0 indicates the success of the operation.
+/// The process name and args are used to ensure correct mapping of requests
+/// and responses.
+/// PL => SM
+///////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ SI_32 pid;
+ CHAR name[SS_SM_MAX_MODULE_NAME_LENGTH];
+ CHAR path[SS_SM_MAX_MODULE_PATH_LENGTH];
+ CHAR args[SS_SM_MAX_MODULE_ARGS_LENGTH];
+ UI_32 priority;
+ GroupLaunchMapIter groupIterator;
+ ModuleLaunchListIter moduleIterator;
+} T_ProcessLaunchResp;
+
+///////////////////////////////////////////////////////////////////////////////
+/// System manager terminates the process when it detects there is something
+/// wrong with the process. The system manager send the message
+/// ePLThrdCmd_TERMINATE_MODULE_REQST to process launcher as required.
+/// The request data is defined as below
+/// SM => PL
+///////////////////////////////////////////////////////////////////////////////
+typedef T_ProcessLauncherLaunchReq T_ProcessLauncherTerminationReq;
+
+///////////////////////////////////////////////////////////////////////////////
+/// The response of the module termination response message from process
+/// launcher to system manager
+/// ePLThrdCmd_TERMINATE_MODULE_RESP is defined by the below structure
+/// A ProcessID value of 0 indicates the success of the operation.
+/// The process name and args are used to ensure correct mapping of requests
+/// and responses.
+/// PL => SM
+///////////////////////////////////////////////////////////////////////////////
+typedef T_ProcessLaunchResp T_ProcessLauncherTerminationResp;
+
+///////////////////////////////////////////////////////////////////////////////
+/// The system manager requests a module relaunch by the message
+/// ePLThrdCmd_RELAUNCH_MODULE_REQST.
+/// The message data is described by the below structure
+/// The old process ID is passed sent in the request and a new process ID is
+/// expected in the response.
+/// The process launcher launches the module and does internal retries for this
+/// kind of request in case of failure.
+/// SM => PL
+///////////////////////////////////////////////////////////////////////////////
+typedef T_ProcessLauncherLaunchReq T_ProcessLauncherRelaunchReq;
+
+#endif // SS_SM_PROCESS_LAUNCHER_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h b/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h
new file mode 100755
index 0000000..cd69832
--- /dev/null
+++ b/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h
@@ -0,0 +1,62 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_PROCESS_LAUNCHER_PROTOCOL_H_ // NOLINT
+#define SS_SM_PROCESS_LAUNCHER_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+#include <system_service/ss_system_manager_protocol.h>
+
+typedef enum _ESMPLThreadCommandIds {
+ //// <
+ ePLThrdCmd_LAUNCH_MODULE_REQST = 0x543, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_LAUNCH_MODULE_RESP, ///< SM.ProcessLauncher --> SM
+
+ //// <
+ ePLThrdCmd_TERMINATE_MODULE_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_TERMINATE_MODULE_RESP, ///< SM.ProcessLauncher --> SM
+
+ //// <
+ ePLThrdCmd_RELAUNCH_MODULE_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_RELAUNCH_MODULE_RESP, ///< SM.ProcessLauncher --> SM
+
+ //// <
+ ePLThrdCmd_MODULE_STATUS_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_THREAD_STATUS_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_THREAD_STATUS_RESP, ///< SM.ProcessLauncher --> SM
+
+ ePLThrdCmd_NONE, ///< Not sent. Used for initialization.
+} ESMPLThreadCommandIds;
+
+
+#endif // SS_SM_PROCESS_LAUNCHER_PROTOCOL_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_config.h b/systemservice/system_manager/server/include/ss_sm_config.h
new file mode 100755
index 0000000..19736f6
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_config.h
@@ -0,0 +1,543 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_CONFIG_H_ // NOLINT
+#define SS_SM_CONFIG_H_
+
+#include <native_service/ns_config_parser_if.h>
+#include <system_service/ss_system_types.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_string_maps.h>
+#include <list>
+#include <map>
+#include <string>
+#include <vector>
+#include "ss_sm_process_launcher_protocol.h"
+
+
+/// All timer values are **position-dependent** in the timer calls ! These
+/// defines are currently all used as Start and Restart Seconds parameters.
+/// \param [in] id
+/// UI_32 - timer id that you want to start
+/// \param [in] ss
+/// UI_32 - Start time in seconds
+/// \param [in] sms
+/// UI_32 - Start time in milliseconds
+/// \param [in] rs
+/// UI_32 - Repeat time in seconds
+/// \param [in] rms
+/// UI_32 - Repeat time in milliseconds
+#define SS_GROUP_LAUNCH_TIMER_CONFIG (3)
+#define SS_HEARTBEAT_MONITOR_TIMER_CONFIG (10)
+#define SS_PROCESSLAUNCHER_MONITOR_TIMER_CONFIG (10)
+#define SS_CLIENT_START_MONITOR_TIMER_CONFIG (3)
+#define SS_CLIENT_STOP_MONITOR_TIMER_CONFIG (1)
+#define SS_NPP_STATUS_CHECK_MONITOR_TIME_SEC (5)
+#define SS_LAUNCH_GROUP_TRIGGER_TIMER_CONFIG (10)
+// size of the internal debug dump buffer
+#define SS_SM_DEBUG_DUMP_MAX_SIZE (12288u)
+// number of _CWORD56_ command history log entries for the debug dump
+#define SS_SM__CWORD56__CMD_HIST_SIZE (10u)
+// number of timer history log entries for the debug dump
+#define SS_SM_TIMER_CMD_HIST_SIZE (10u)
+// number of message history log entries for the debug dump
+#define SS_SM_CMD_HIST_SIZE (20u)
+// number of publishing history log entries for the debug dump
+#define SS_SM_PUB_CMD_HIST_SIZE (5u)
+// number of error history log entries for the debug dump
+#define SS_SM_ERR_HIST_SIZE (5u)
+
+// When occurs repeat to abnormal rebooting, logging cause of error at first time and next time.
+// When it occurs "ILG_RESET", Maximum number of log is 4 so that the log will be stored at the just after the startup.
+// Need reconsideration if maximum number of abnormal logging is less than 4 using SSL.
+#define SS_SM_ERR_LOGGING_LIMIT (8)
+
+// Maximum number of continuous processing of "NaviReset" by errors.
+// It try to recover by NaviDet when it exceeds this limit.
+#define SS_SM_ERR_NAVI_RESET_LIMIT (5)
+
+typedef enum {
+ MODULE_STATE_INVALID = 0 /// Initial state of all modules
+ , MODULE_STATE_SKIPPED /// Non-critical module has crossed max re-launch limit
+ /// or hSession was null when attempted to start
+ , MODULE_STATE_LAUNCHING /// Module launch has been requested
+ , MODULE_STATE_LAUNCHED /// Module has been launched but a session
+ /// connection has NOT been established
+ , MODULE_STATE_LAUNCH_FAILED /// Oops
+ , MODULE_STATE_CONNECTED /// A session connection has been established
+ , MODULE_STATE_START_SENT /// SM has sent START to the module
+ , MODULE_STATE_START_FAILED /// FrameworkunifiedSendMsg(SS_SM_START) failed
+ , MODULE_STATE_STARTED /// Module has replied START Complete to SM
+ , MODULE_STATE_STOP_SENT /// SM has sent STOP to the module
+ , MODULE_STATE_STOP_FAILED /// FrameworkunifiedSendMsg(SS_SM_STOP) failed
+ , MODULE_STATE_STOPPED /// Module has replied STOP Complete to SM
+ , MODULE_STATE_START_PRE_SENT //!< SM has sent Pre-boot start to the module
+ , MODULE_STATE_START_PRE_FAILED //!< FrameworkunifiedSendMsg(SS_SM_PRE_START) failed
+ , MODULE_STATE_STARTED_PRE //!< Module has replied Pre-boot start Complete to SM
+ , MODULE_STATE_STOP_PRE_SENT //!< SM has sent Pre-boot stop to the module
+ , MODULE_STATE_STOP_PRE_FAILED //!< FrameworkunifiedSendMsg(SS_SM_PRE_STOP) failed
+ , MODULE_STATE_STOPPED_PRE //!< Module has replied Pre-boot stopComplete to SM
+ , MODULE_STATE_START_BACKGROUND_SENT //!< SM has sent Background-boot start to the module
+ , MODULE_STATE_START_BACKGROUND_FAILED //!< FrameworkunifiedSendMsg(SS_SM_BACKGROUND_START) failed
+ , MODULE_STATE_STARTED_BACKGROUND //!< Module has replied Background-boot start Complete to SM
+ , MODULE_STATE_STOP_BACKGROUND_SENT //!< SM has sent Background-boot stop to the module
+ , MODULE_STATE_STOP_BACKGROUND_FAILED //!< FrameworkunifiedSendMsg(SS_SM_BACKGROUND_STOP) failed
+ , MODULE_STATE_STOPPED_BACKGROUND //!< Module has replied Background-boot stop Complete to SM
+} SMModuleState;
+//
+// Module State string map type
+typedef std::map<SMModuleState, std::string> SMModuleStateStrMapType;
+
+typedef enum {
+ MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED = 0
+ , MODULE_DEBUG_DUMP_STATE_REQUEST_SENT
+ , MODULE_DEBUG_DUMP_STATE_RESPONSE_RECEIVED
+} SMModuleDebugDumpState;
+
+typedef std::map<SMModuleDebugDumpState, std::string> SMModuleDebugDumpStateStrMapType;
+
+/*
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration>
+ <!-- System Service Launch control elements -->
+ <SystemManager>
+ <Launch>
+ <Group1>
+ <group_name>CoreModules</group_name>
+ <group_id>1</group_id>
+ <Member1>
+ <name>TRUE</name>
+ <path>1</path>
+ <priority>200</priority>
+ <critical>TRUE</critical>
+ <retry_cnt>1</retry_cnt>
+ <arguments></arguments>
+ <logging_mask></logging_msk>
+ <restart>group</restart>
+ <shudown_critical></shudown_critical>
+ <shudown_wait_time></shudown_wait_time>
+ </Member1>
+ <Member2>
+ <name>TRUE</name>
+ <path>1</path>
+ <priority>200</priority>
+ <critical>TRUE</critical>
+ <retry_cnt>1</retry_cnt>
+ <arguments></arguments>
+ <logging_mask></logging_msk>
+ <restart>me</restart>
+ <shudown_critical></shudown_critical>
+ <shudown_wait_time></shudown_wait_time>
+ </Member2>
+ </Group1>
+ </Launch>
+ </SystemManager>
+</Configuration>
+*/
+
+//******************************************************************************
+//* CTimeSpan class *
+//* *
+class CTimeSpan {
+ public:
+ CTimeSpan(): initial(0), final(0), delta(0) {}
+ CTimeSpan(UI_64 f_initial) // NOLINT
+ : initial(f_initial), final(0), delta(0) {}
+ ~CTimeSpan() {}
+ /*
+ * Set Initial time, reset Final and Delta to zero, return time
+ */
+ UI_64 Begin();
+ /*
+ * Set Final time, calculate Delta time, return time
+ */
+ UI_64 End();
+ UI_64 GetInitial();
+ UI_64 GetFinal();
+ UI_64 GetDelta();
+ UI_64 GetTimeMilliseconds();
+
+ private:
+ UI_64 initial;
+ UI_64 final;
+ UI_64 delta;
+}; // End of class CTimeSpan
+//******************************************************************************
+
+
+typedef enum {
+ NotStopped,
+ StoppedByModuleStopComplete,
+ StoppedByModuleStopFail,
+ StoppedByGroupStopTimeout,
+ StoppedByCriticalAppsTimeout,
+ StoppedByModulePreStopComplete,
+ StoppedByModulePreStopFail,
+ StoppedByModuleBackgroundStopComplete,
+ StoppedByModuleBackgroundStopFail
+} EStopReasonType;
+
+typedef enum {
+ NotStarted,
+ StartedByModuleStartComplete,
+ StartedByModuleStartFail,
+ StartedByModulePreStartComplete,
+ StartedByModulePreStartFail,
+ StartedByModuleBackgroundStartComplete,
+ StartedByModuleBackgroundStartFail
+} EStartReasonType;
+
+//******************************************************************************
+//* CTimeEvent class *
+//* *
+template <typename EEventType>
+class CTimeEvent : public CTimeSpan {
+ public:
+ CTimeEvent() {
+ bzero(&m_eventReason, sizeof(m_eventReason));
+ }
+ ~CTimeEvent() {}
+
+ VOID SetReason(EEventType f_eventReason)
+ { m_eventReason = f_eventReason; }
+ private:
+ EEventType m_eventReason;
+}; // End of class CTimeEvent
+//******************************************************************************
+
+typedef enum {
+ NotRelaunched,
+ RelaunchSafe,
+ RelaunchErr
+} ERelaunchStatusType;
+
+
+typedef CTimeEvent<EStartReasonType> CStartReason;
+typedef CTimeEvent<EStopReasonType> CStopReason;
+typedef CHAR TUserNameBuffer[128]; // TODO(yaomingwu): Stuff. Does Posix define a useful
+ // constant representing max length of user id?
+
+class ModuleLaunchParams {
+ public:
+ // Move to private to prevent direct access
+ // SMModuleState module_state;
+ //
+ SS_String name;
+ SS_String path;
+ SS_String arguments;
+ SS_String restart;
+ UI_32 configuration_priority;
+ int cpu_assign;
+ UI_32 previous_priority;
+ UI_32 current_priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ SS_String logging_msk_str;
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+ UI_32 fast_shutdown_wait_time;
+ SI_32 pid;
+ HANDLE hsession;
+ UI_32 relaunch_count;
+ ERelaunchStatusType relaunch_status;
+ UI_32 group_id;
+ TUserNameBuffer unix_user_name;
+
+ BOOL m_serviceAvailability; // Not set because it does not watch Availability for speeding up start up process.
+
+ CStartReason m_startReason;
+ CStopReason m_stopReason;
+
+ ModuleLaunchParams();
+ ~ModuleLaunchParams();
+ SMModuleState GetModuleState(void);
+ BOOL IsModuleState(SMModuleState f_moduleState);
+ BOOL IsModuleConnected() const;
+ VOID SetModuleState(SMModuleState f_moduleState, BOOL f_bLog = TRUE);
+ std::string ModuleStateStr(void);
+
+ SMModuleDebugDumpState GetModuleDebugDumpState(void);
+ std::string GetModuleDebugDumpStateStr(void);
+ VOID SetModuleDebugDumpState(SMModuleDebugDumpState f_moduleDebugDumpState, BOOL f_bLog = TRUE);
+ EFrameworkunifiedStatus SendMsgAndUpdateState(
+ const UI_32 f_iCmd, const T_SS_SM_START_DataStructType* const f_startData);
+ EFrameworkunifiedStatus SendMsgAndUpdateState(T_SS_SM_STOP_DataStruct const* f_stopData);
+
+ EFrameworkunifiedStatus GetPriority(UI_32& f_Priority); // NOLINT
+ EFrameworkunifiedStatus SetPriority(UI_32 f_Priority);
+
+ BOOL IsAGLUnit(void) const { return is_agl_unit; }
+ BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; }
+ BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; }
+ void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; }
+ void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) {
+ disable_agl_resethistory = f_disable_agl_resethistory;
+ }
+ void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) {
+ disable_nonagl_resethistory = f_disable_nonagl_resethistory;
+ }
+
+ private:
+ SMModuleState m_moduleState;
+ SMModuleStateStrMapType m_ModuleStateStrMap;
+ SMModuleDebugDumpState m_ModuleDebugDumpState;
+ SMModuleDebugDumpStateStrMapType m_ModuleDebugDumpStateStrMap;
+ BOOL is_agl_unit;
+ BOOL disable_agl_resethistory;
+ BOOL disable_nonagl_resethistory;
+};
+
+typedef std::list<ModuleLaunchParams> ModuleLaunchList;
+typedef ModuleLaunchList::iterator ModuleLaunchListIter;
+
+typedef struct _GroupLaunchInfo { // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ BOOL launch_complete;
+ BOOL start_complete;
+ BOOL stop_complete;
+ SS_String name;
+ UI_32 id;
+ UI_32 grp_launch_wait;
+ UI_32 grp_wait_for_trigger;
+ ModuleLaunchList modules;
+} GroupLaunchInfo;
+
+typedef std::list<GroupLaunchInfo> GroupLaunchList;
+typedef GroupLaunchList::iterator GroupLaunchListIter;
+
+typedef std::map<UI_32, GroupLaunchInfo> GroupLaunchMap;
+typedef GroupLaunchMap::iterator GroupLaunchMapIter;
+
+typedef std::list<GroupLaunchList> GroupList;
+typedef GroupList::iterator GroupListIter;
+
+// Process Binary Name (key) to ModuleLaunchList iterator (ModuleLaunchParams).
+typedef std::map<std::string, ModuleLaunchListIter>ProcessNameMap;
+typedef ProcessNameMap::iterator ProcessNameMapIter;
+
+// Config Parameters specific to Heart Beat Thread
+typedef struct _HBConfigParams {
+ SI_32 MaxHeartBeatRetryCount; /// Retry heart beat check before error report is sent to SM
+ SI_32 ApplicationHeartBeatIntervalInitial; /// Initial Timer interval
+ /// between two heart beat requests & response check
+ SI_32 ApplicationHeartBeatIntervalRepeat; /// Repeat Timer interval between two heart beat requests & response check
+} HBConfigParameters;
+
+typedef struct _CDConfigParams {
+ BOOL CrashDetectorEnabled;
+} CDConfigParameters;
+
+typedef struct _SLMConfigParams { // SLM - System Low Memory
+ SI_32 SLMTimerValue;
+ SI_32 SLMMaxRetryCount;
+ SI_32 SLMThresholdValue;
+ SI_32 SLMSystemmanagerLogIntervalMs;
+} SLMConfigParameters;
+
+typedef struct _UserMModeConfigParams {
+ BOOL IsUserModeNotificationABOOL;
+} UserModeConfigParameters;
+
+typedef struct _ModuleConnectTimeConfigParams {
+ SI_32 ModuleConnectionNumTimesToCheck;
+ SI_32 ModuleConnectionTimeOutSec;
+ SI_32 ModuleStartRespTimeOutSec;
+} ModuleConfigParams;
+
+typedef struct _CriticalAppsMaxShutdownTime {
+ SI_32 CriticalAppsMaxShutdownTimeFastSleep;
+ SI_32 CriticalAppsMaxShutdownTimeNormalReset;
+} CriticalAppsMaxShutdownTime;
+
+typedef struct _ConfigurationData {
+ // Parameters specific to System Manager
+
+ // Parameters specific to Heart Beat Thread
+ HBConfigParameters HBConfig;
+
+ // Parameters specific to Launcher Thread
+
+ // Parameters specific to Crash Detector Thread
+ CDConfigParameters CDConfig;
+
+ // Parameters specific to System Low Memory
+
+ // Parameters specific to Sys Low Memory Thread
+ SLMConfigParameters SLMConfig;
+
+ // Parameters specific to User Mode Notification Data Structure
+ UserModeConfigParameters UMConfig;
+
+ // Parameters specific to Module connection timeout with SM
+ ModuleConfigParams MCConfig;
+
+ // Parameters specific to Critical Apps Max shutdown time
+ CriticalAppsMaxShutdownTime CAMSTConfig;
+} ConfigurationData;
+
+typedef std::vector<UI_32> LaunchOrderedVector;
+typedef LaunchOrderedVector::iterator LaunchOrderedIter;
+
+class SMConfigParams {
+ public:
+ SMConfigParams();
+ virtual ~SMConfigParams();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// LoadSMConfigParameters
+ /// \brief Read System Manager configuration parameters from cfg file or
+ /// use defaults values in case cfg file is not available
+ ///
+ /// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
+ /// \param [in] f_FileName - Configuration file name.
+ ///
+ /// \return BOOL
+ /// BOOL - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL LoadSMConfigParameters(ConfigurationData& f_ConfigParams, // NOLINT
+ SS_String f_FileName);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSMConfigInformation
+ /// \brief Read config data from cfg file and populate the configuration data structure
+ ///
+ /// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
+ /// \param [in] f_FileName - Configuration file name.
+ ///
+ /// \return BOOL
+ /// BOOL - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL GetSMConfigInformation(ConfigurationData& f_ConfigParams, // NOLINT
+ SS_String f_FileName);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintConfigInfo
+ /// \brief Print the configuration data stored in config structure
+ ///
+ /// \param [in] configata
+ /// ConfigurationData & - Ref to structure that get populated.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintConfigInfo(ConfigurationData const& f_ConfigParams);
+};
+
+class SysMgrConfiguration {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SysMgrConfiguration
+ /// \brief
+ ///
+ /// \return NA
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ SysMgrConfiguration();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~SysMgrConfiguration
+ /// \brief
+ ///
+ /// \return NA
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~SysMgrConfiguration();
+
+// ////////////////////////////////////////////////////////////////////////////////////////////
+// /// LoadParameters
+// /// \brief
+// ///
+// /// \param [in] groups
+// /// GroupLaunchList & - Ref to GroupLaunchList that get populated.
+// ///
+// /// \return BOOL
+// /// BOOL - TRUE or FALSE
+// ////////////////////////////////////////////////////////////////////////////////////////////
+// BOOL LoadParameters(GroupLaunchMap & groups_map);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// LoadParametersCfg
+ /// \brief
+ ///
+ /// \param [in] groups
+ /// GroupLaunchList & - Ref to GroupLaunchList that gets populated.
+ /// ProcessNameMap & - Ref to ProcessNameMap that gets populated.
+ /// LaunchOrderedVector & - Ref to LaunchOrderedVector that gets populated.
+ ///
+ /// \param [in] f_launchOrderName - launch order name.
+ ///
+ /// \return BOOL
+ /// BOOL - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL LoadParametersCfg(GroupLaunchMap& groups_map, // NOLINT
+ ProcessNameMap& f_processNameMap, // NOLINT
+ LaunchOrderedVector& f_OrderList, // NOLINT
+ SS_String& f_launchOrderName, // NOLINT
+ SS_String& f_launchCfgFn); // NOLINT
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintGroupInfo
+ /// \brief Print method for GroupLaunchInfo only prints the group info not the module info
+ ///
+ /// \param [in] refGrpInfo
+ /// GroupLaunchInfo & - Ref to a GroupLaunchInfo object that will be printed.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintGroupInfo(GroupLaunchInfo& refGrpInfo); // NOLINT
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintModuleInfo
+ /// \brief Print method for a Module's Params.
+ ///
+ /// \param [in] refMbrInfo
+ /// ModuleLaunchParams & - Ref to ModuleLaunchParams object that will be printed.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintModuleInfo(ModuleLaunchParams& refMbrInfo); // NOLINT
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintAllInfo
+ /// \brief Print all the information in the GroupLaunchList.
+ ///
+ /// \param [in] refGrpList
+ /// GroupLaunchList & - Ref to GroupLaunchList object that will be printed.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintAllInfo(GroupLaunchMap& refGrpMap); // NOLINT
+
+ protected:
+ // define all the configuration parameters that will be used to get data
+
+ CNSConfigReader * l_pReaderCfg;
+
+ SysMgrConfiguration(const SysMgrConfiguration&) : l_pReaderCfg(NULL) {}
+ SysMgrConfiguration & operator = (const SysMgrConfiguration &);
+
+ private:
+ BOOL ParseBoolParameter(PCSTR f_value, BOOL f_default = FALSE) const;
+};
+
+#endif // SS_SM_CONFIG_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_default_paths.h b/systemservice/system_manager/server/include/ss_sm_default_paths.h
new file mode 100755
index 0000000..8ffafd9
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_default_paths.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for default path names.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef SYSTEM_MANAGER_SERVER_INCLUDE_SS_SM_DEFAULT_PATHS_H_
+#define SYSTEM_MANAGER_SERVER_INCLUDE_SS_SM_DEFAULT_PATHS_H_
+/*
+ * Environment variables
+ */
+const CHAR BaseDirPathEnvVariable[] = "BASE_DIR";
+const CHAR LaunchConfigFileNameEnvVariable[] = "APPS_CONFIG_FILENAME";
+const CHAR SMConfigDataFileNameEnvVariable[] = "SM_CONFIG_DATA_FILENAME";
+const CHAR UsingVMPlayerVariable[] = "USING_VM_PLAYER";
+
+/*
+ * Default paths to be used in case Environment variables are not set
+ */
+const CHAR DefaultBasePath[] = "";
+const CHAR DefaultBinaryPath[] = "/agl/bin/";
+const CHAR DefaultConfigFilesPath[] = "/usr/agl/conf/BS/ss/system_manager/rwdata/";
+const CHAR DefaultLaunchConfigFileName[] = "sm_launch.cfg";
+const CHAR DefaultSMConfigFileName[] = "gpf_ss_sm_config_data.cfg";
+
+#endif // SYSTEM_MANAGER_SERVER_INCLUDE_SS_SM_DEFAULT_PATHS_H_
+
diff --git a/systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h b/systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h
new file mode 100755
index 0000000..685b43b
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h
@@ -0,0 +1,72 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_DYNAMIC_LAUNCH_TABLE_H_ // NOLINT
+#define SS_SM_DYNAMIC_LAUNCH_TABLE_H_
+
+#include "ss_sm_dynamic_launcher.h"
+
+DynamicLaunchInfo g_arrDynamicLaunchTableCfg[] = {
+ // TUNER
+ { SS_SOURCE_FM,
+ (const PCHAR)"FM", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ { SS_SOURCE_AM,
+ (const PCHAR)"AM", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ { SS_SOURCE_FM_DAB,
+ (const PCHAR)"FM_DAB", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ { SS_SOURCE_SDARS,
+ (const PCHAR)"SDARS", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ // MEDIA
+ { SS_SOURCE_SD_CARD,
+ (const PCHAR)"SDCard", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_MSC,
+ (const PCHAR)"MCS", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_MTP, (const PCHAR)"MTP",
+ (const PCHAR)"Audio", (const PCHAR)"Multimedia", (const PCHAR)"HMI",
+ (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE__CWORD57_,
+ (const PCHAR)"_CWORD57_", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE__CWORD73__APP,
+ (const PCHAR)"_CWORD57__APP", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE__CWORD73__VIDEO_MODE,
+ (const PCHAR)"_CWORD57__VM", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_USB,
+ (const PCHAR)"USB", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_DATA_CD,
+ (const PCHAR)"DATA_CD", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_CD,
+ (const PCHAR)"AUDIO_CD", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+};
+
+#endif // SS_SM_DYNAMIC_LAUNCH_TABLE_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h b/systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h
new file mode 100755
index 0000000..a6efb1f
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_DYNAMIC_LAUNCHER_H_ // NOLINT
+#define SS_SM_DYNAMIC_LAUNCHER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/interfaceunified_system_types.h>
+#include <vector>
+
+#include "ss_sm_config.h"
+
+using std::vector;
+
+
+typedef struct _tDynamicLaunchParams {
+ SS_SOURCE source;
+ const PCHAR source_name;
+ const PCHAR before_group_name;
+ const PCHAR start_group_name;
+ const PCHAR after_group_name;
+ const PCHAR aviage_trigger_name;
+ BOOL group_trigger;
+} DynamicLaunchInfo;
+
+
+class DynamicLaunchBase {
+ public:
+ DynamicLaunchBase();
+ virtual ~DynamicLaunchBase();
+ UI_32 get_id() const;
+ UI_32 advance_id();
+ UI_32 decrement_id();
+ BOOL is_begin();
+ BOOL is_end();
+ VOID to_begin();
+ VOID to_end();
+ VOID print_info();
+
+ protected:
+ typedef std::vector<UI_32> DynamicOrderedVector;
+ typedef DynamicOrderedVector::iterator DynamicOrderedIter;
+ DynamicOrderedVector m_vOrderedGroup;
+ DynamicOrderedIter m_iterOrderedGroup;
+};
+
+class DynamicModuleStart;
+
+class DynamicLauncher: public DynamicLaunchBase {
+ public:
+ DynamicLauncher();
+ virtual ~DynamicLauncher();
+ BOOL dynamic_launch_enabled() const;
+ VOID configure_dynamic_launch(const SS_SOURCE & source_type, // NOLINT
+ GroupLaunchMap & group_info, LaunchOrderedVector & order_info); // NOLINT
+ VOID copyDynOrderedVector(DynamicModuleStart &);
+
+ private:
+ // Disable class copy constructors
+ explicit DynamicLauncher(const DynamicLauncher& f_source)
+ : m_nLaunchGroupId(f_source.m_nLaunchGroupId)
+ , m_nLaunchBeforeGroupId(f_source.m_nLaunchBeforeGroupId)
+ , m_nLaunchAfterGroupId(f_source.m_nLaunchAfterGroupId)
+ , m_nAviageTriggerId(f_source.m_nAviageTriggerId)
+ , m_bDynamicLaunchEnabled(f_source.m_bDynamicLaunchEnabled)
+ , m_eSourceType(f_source.m_eSourceType) {}
+ DynamicLauncher & operator = (const DynamicLauncher &);
+
+ // helper methods..
+ DynamicLaunchInfo* get_dynamic_source_info(const SS_SOURCE& source_type, // NOLINT
+ BOOL& source_trigger, BOOL &is_aviage_required); // NOLINT
+ UI_32 get_id_using_group_name(PCSTR group_name, GroupLaunchMap& group_info); // NOLINT
+ VOID create_normal_launch_vector(GroupLaunchMap& group_info, LaunchOrderedVector& order_info); // NOLINT
+ BOOL is_inGroupLaunchMap(UI_32& id, GroupLaunchMap& group_info); // NOLINT
+
+ // Data Members
+ UI_32 m_nLaunchGroupId;
+ UI_32 m_nLaunchBeforeGroupId;
+ UI_32 m_nLaunchAfterGroupId;
+ UI_32 m_nAviageTriggerId;
+ BOOL m_bDynamicLaunchEnabled;
+ SS_SOURCE m_eSourceType;
+};
+
+class DynamicModuleStart: public DynamicLaunchBase {
+ public:
+ DynamicModuleStart();
+ virtual ~DynamicModuleStart();
+ VOID setGroupVector(DynamicOrderedVector&);
+};
+
+#endif // SS_SM_DYNAMIC_LAUNCHER_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_launch_configuration.h b/systemservice/system_manager/server/include/ss_sm_launch_configuration.h
new file mode 100755
index 0000000..7296714
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_launch_configuration.h
@@ -0,0 +1,191 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_LAUNCH_CONFIGURATION_H_ // NOLINT
+#define SS_SM_LAUNCH_CONFIGURATION_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_client_names.h>
+
+typedef struct _DefaultModuleLaunchParams {
+ const PCHAR name;
+ const PCHAR binary_name;
+ const PCHAR arguments;
+ const PCHAR restart;
+ UI_32 priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ const PCHAR logging_msk_str;
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+} DefaultModuleLaunchParams;
+
+typedef struct _DefaultGroupLaunchInfo {
+ const PCHAR name;
+ UI_32 id;
+ DefaultModuleLaunchParams *modules;
+} DefaultGroupLaunchInfo;
+
+
+#define prefix
+
+prefix DefaultModuleLaunchParams CoreModulesGroup[] = {
+ // Queue name binary_name arguments
+ {(const PCHAR)SERVICE_NS_SHARED_MEM,
+ (const PCHAR)"NS_SharedMem", (const PCHAR)"", (const PCHAR)"me",
+ 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE_NS_NPP, (const PCHAR)"NS_NPPService",
+ (const PCHAR)"", (const PCHAR)"me", 20, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, TRUE, 15},
+ {(const PCHAR)SERVICE_LOGGER, (const PCHAR)SERVICE_LOGGER,
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE__CWORD69_, (const PCHAR)"_CWORD69_.exe",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams ShadowModulesGroup[] = {
+ // Queue name binary_name arguments
+ {(const PCHAR)SERVICE_PS_IPC, (const PCHAR)"PS_IPC",
+ (const PCHAR)"", (const PCHAR)"group", 50, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE_PSM_SHADOW, (const PCHAR)"PS_PSMShadow",
+ (const PCHAR)"", (const PCHAR)"group", 12, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_KEY_HANDLER, (const PCHAR)"PS_KeyHandler",
+ (const PCHAR)"", (const PCHAR)"group", 12, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_IPC_MP_SHADOW, (const PCHAR)"PS_IPC_MP_Shadow",
+ (const PCHAR)"", (const PCHAR)"group", 20, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams SystemModulesGroup[] = {
+ {(const PCHAR)SERVICE_POWER, (const PCHAR)SERVICE_POWER,
+ (const PCHAR)"", (const PCHAR)"me", 12, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SS_DEV_DETECT_SRV, (const PCHAR)SS_DEV_DETECT_SRV,
+ (const PCHAR)"", (const PCHAR)"me", 12, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SS_PLM_SERVICE, (const PCHAR)SS_PLM_SERVICE,
+ (const PCHAR)"", (const PCHAR)"me", 12, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams AudioModulesGroup[] = {
+ {(const PCHAR)SERVICE_AS_AUDIO, (const PCHAR)"AS_AudioService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_AS_MODE, (const PCHAR)"AS_ModeService",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams RadioModulesGroup[] = {
+ {(const PCHAR)SERVICE_TUNER, (const PCHAR)"Radio",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_DAB, (const PCHAR)"Master_Tuner",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_SDARS, (const PCHAR)"Ext_SDARS_Service",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3,
+ (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams MultimediaModulesGroup[] = {
+ {(const PCHAR)SERVICE_MM_ICD, (const PCHAR)"MM_ICDService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_MM_MEDIA, (const PCHAR)"MediaService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams HMIModulesGroup[] = {
+ {(const PCHAR)SERVICE_HMI, (const PCHAR)"GtfStartup",
+ (const PCHAR)"/eb/gtf_5.2.1/models/PastModel004/gtfStartup.cfg", (const PCHAR)"me",
+ 13, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE_HMI__CWORD77_, (const PCHAR)"HMI__CWORD77_",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_HMI__CWORD46_, (const PCHAR)"HMI__CWORD46_Service", (const PCHAR)"",
+ (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams NavigationModulesGroup[] = {
+ {(const PCHAR)SERVICE_NAV_LOC, (const PCHAR)"NAV_LocationService", (const PCHAR)"", (const PCHAR)"me",
+ 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NAV, (const PCHAR)"NAV_NavigationService", (const PCHAR)"", (const PCHAR)"me",
+ 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0, (const PCHAR)0, (const PCHAR)0,
+ 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams SoftwareUpdateModulesGroup[] = {
+ {(const PCHAR)SERVICE_SOFTWAREUPDATE, (const PCHAR)"SS_SoftwareUpdateService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_PS_SWDL_SHADOW, (const PCHAR)"PS_SoftwareUpdateShadow",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams NetworkingModulesGroup[] = {
+ {(const PCHAR)SERVICE__CWORD51__BT, (const PCHAR)"_CWORD51__BT.exe",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_BT, (const PCHAR)"NW_BluetoothService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_CONNECTION, (const PCHAR)"NW_ConnectionService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_PHONE, (const PCHAR)"NW_PhoneService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_PHONE_BOOK, (const PCHAR)"NW_PhoneBookService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_MESSAGING, (const PCHAR)"NW_MessagingService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams BrowserModulesGroup[] = {
+ {(const PCHAR)SERVICE_BR_BROWSER, (const PCHAR)"BR_BrowserService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultGroupLaunchInfo g_arrLaunchTable[] = {
+ {(const PCHAR)"CoreModules", 1, CoreModulesGroup },
+ {(const PCHAR)"ShadowModules", 2, ShadowModulesGroup },
+ {(const PCHAR)"SystemModules", 3, SystemModulesGroup },
+ {(const PCHAR)"Audio", 4, AudioModulesGroup },
+ {(const PCHAR)"Radio", 5, RadioModulesGroup },
+ {(const PCHAR)"Multimedia", 6, MultimediaModulesGroup },
+ {(const PCHAR)"HMI", 7, HMIModulesGroup },
+ {(const PCHAR)"Navigation", 8, NavigationModulesGroup },
+ {(const PCHAR)"SoftwareUpdate", 9, SoftwareUpdateModulesGroup },
+ {(const PCHAR)"Networking", 10, NetworkingModulesGroup },
+ {(const PCHAR)"Browser", 11, BrowserModulesGroup },
+};
+
+#endif // SS_SM_LAUNCH_CONFIGURATION_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_signals.h b/systemservice/system_manager/server/include/ss_sm_signals.h
new file mode 100755
index 0000000..4c52b32
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_signals.h
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file supports process termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_SIGNALS_H_ // NOLINT
+#define SS_SM_SIGNALS_H_
+
+#include <signal.h>
+
+#define SS_SM_ABORT_SIGNAL (SIGABRT)
+#define SS_SM_KILL_SIGNAL (SIGKILL)
+#define SS_SM_TERMINATE_SIGNAL (SIGTERM)
+
+#endif // SS_SM_SIGNALS_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h b/systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h
new file mode 100755
index 0000000..0499751
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file supports agl application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SM_SYSTEMMANAGERLOG_H__ // NOLINT
+#define __SS_SM_SYSTEMMANAGERLOG_H__
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_FUNC_IPC ZONEMASK(13)
+#define ZONE_APP_LAUNCH ZONEMASK(14)
+#define ZONE_ACTIVE_INDEX ZONEMASK(15)
+#define ZONE_CONFIG_TABLE ZONEMASK(16)
+#define ZONE_FUNC_ARGS ZONEMASK(17)
+#define ZONE_LOG_FILE ZONEMASK(18)
+#define ZONE_MSG ZONEMASK(19)
+#define ZONE_TIMER ZONEMASK(20)
+#define ZONE_LAUNCH_TIME ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_UNUSED ZONEMASK(23)
+#define ZONE_PERIODIC_FUNC ZONEMASK(24)
+#define ZONE_PERIODIC_INFO ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_DYNAMIC_LNCH ZONEMASK(27)
+#define ZONE_STATE ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_SYSLOG ZONE_SYSTEMDATA
+#define ZONE_PERFORM ZONE_PERFORMANCE
+#define ZONE_PROC_LAUNCH_INFO ZONE_FUNC
+
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "Ipc Function"
+#define ZONE_TEXT_14 "Active Index"
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 "Config Table"
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 "Ipc Info"
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_STATE, ZONE_SYSLOG, ZONE_PERFORM, ZONE_NS_WAR, ZONE_NS_ERR
+#endif // FRAMEWORKUNIFIEDLOGAPPZONES
+
+#endif // __SS_SM_SYSTEMMANAGERLOG_H__ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_version.h b/systemservice/system_manager/server/include/ss_sm_version.h
new file mode 100755
index 0000000..ea0a775
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_version.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for module version management.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_VERSION_H_ // NOLINT
+#define SS_SM_VERSION_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include "ss_sm_process_launcher_protocol.h"
+
+class CSMVersion {
+ public:
+ CSMVersion();
+ ~CSMVersion();
+ EFrameworkunifiedStatus get_version(SS_VersionNumberType& f_VersionNumber); // NOLINT
+ EFrameworkunifiedStatus get_build_info(std::string& f_buildInfoStr); // NOLINT
+
+ private:
+};
+#endif // SS_SM_VERSION_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_system_manager.h b/systemservice/system_manager/server/include/ss_system_manager.h
new file mode 100755
index 0000000..12d5bad
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_system_manager.h
@@ -0,0 +1,760 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager business logic.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SYSTEM_MANAGER_H__ // NOLINT
+#define __SS_SYSTEM_MANAGER_H__
+
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_error_event_common_local.h>
+#include <system_service/ss_system_timer.h>
+#include <crashdetector/ss_crashdetector.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <heartbeat/ss_hb_if.h>
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_system_manager_conf.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+#include <system_service/ss_logger_store_logs.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <power_hal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <inttypes.h>
+#include <map>
+#include <string>
+#include <vector>
+#include <queue>
+#include <sstream>
+#include <set>
+#include <list>
+#include <utility>
+
+#include "ss_sm_config.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_system_thread_info.h"
+#include "ss_system_memory_monitor.h"
+#include "ss_sm_dynamic_launcher.h"
+
+static_assert((SS_SM_PROG_UPDATE_STATE_NONE == PWR_PROGUPDATE_STATE_NONE),
+ "SS_SM_PROG_UPDATE_STATE_NONE should be equal to "
+ "PWR_PROGUPDATE_STATE_NONE");
+static_assert((SS_SM_PROG_UPDATE_STATE_UPDATED == PWR_PROGUPDATE_STATE_UPDATED),
+ "SS_SM_PROG_UPDATE_STATE_UPDATED should be equal to "
+ "PWR_PROGUPDATE_STATE_UPDATED");
+static_assert((SS_SM_PROG_UPDATE_STATE_MAP_UPDATED ==
+ PWR_PROGUPDATE_STATE_MAP_UPDATED),
+ "SS_SM_PROG_UPDATE_STATE_MAP_UPDATED should be equal to "
+ "PWR_PROGUPDATE_STATE_MAP_UPDATED");
+static_assert((SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED ==
+ PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED),
+ "SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED should be equal to "
+ "PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED");
+
+#define SM_SHUTDOWN_COMPLETE_MONITOR_TIMEOUT 60
+
+typedef enum {
+ eSM_TIMER_GROUP_MONITOR = 0x00
+ , eSM_TIMER_PROCESS_LAUNCH_MONITOR
+ , eSM_TIMER_HEARTBEAT_MONITOR
+ , eSM_TIMER_PROCESSLAUNCHER_MONITOR
+ , eSM_TIMER_CLIENT_START_MONITOR
+ , eSM_TIMER_NPP_STATUS_CHECK_MONITOR
+ , eSM_TIMER__CWORD56__HEARTBEAT_RESPONSE
+ , eSM_TIMER_LAUNCH_GROUP_TRIGGER_PROC_RESP_TIMER
+ , eSM_TIMER_GROUP_LAUNCH_WAIT_TIMER
+ , eSM_TIMER_MODULE_CONNECT_WAIT_TIMER
+ , eSM_TIMER_START_RESP_MONITOR_WAIT_TIMER
+ , eSM_TIMER_SHUTDOWN_COMPLETE_MONITOR
+ , eSM_TIMER_CLIENT_STOP_MONITOR
+ , eSM_TIMERS_END
+} ESMTimerIDs;
+
+typedef enum {
+ eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ
+ , eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN
+ , eSM_ERROR_EVENT_TIMER_BOOT_MICRO_LOG_RSPN
+ , eSM_ERROR_EVENT_TIMER_CORE_FILE_POLL
+ , eSM_ERROR_EVENT_TIMER_END
+} ESMErrorEventTimers;
+
+typedef enum {
+ eErrorEventResetTypeNone = 0,
+ eErrorEventResetTypeHard
+} EErrorEventResetType;
+
+typedef enum _ESMInternalProtocol {
+ SS_SM_SendTriggerToSelf = SS_SM_PROTOCOL_INTERFACE_END ///< System Manager to System Manager
+} ESMInternalProtocol;
+
+typedef enum _SS_SMGroupHirarchy {
+ SS_SM_INVALID_GROUP = 0
+ , SS_SM_INITIAL_GROUP
+ , SS_SM_SECOND_GROUP
+ , SS_SM_THIRD_GROUP
+} SS_SMGroupHirarchy;
+
+typedef enum _SS_SMModuleState {
+ SS_SM_READY_TO_LAUNCH_APP = 0x00
+ , SS_SM_APPS_LAUNCH_IN_PROGRESS
+ , SS_SM_APPS_LAUNCHED_READY_TO_START
+ , SS_SM_APPS_START_IN_PROGRESS
+ , SS_SM_APPS_START_COMPLETE
+ , SS_SM_APPS_STOPPING_AT__CWORD56__REQ
+ , SS_SM_APPS_STOPPING_AT_INTERNAL_REQ
+ , SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ
+ , SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ
+ , SS_SM_APPS_PRE_START_IN_PROGRESS
+ , SS_SM_APPS_PRE_STOP_IN_PROGRESS
+ , SS_SM_APPS_PRE_RUN_COMPLETE
+ , SS_SM_APPS_BACKGROUND_START_IN_PROGRESS
+ , SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS
+ , SS_SM_APPS_BACKGROUND_RUN_COMPLETE
+} SS_SMModuleState;
+
+typedef struct _SMProcessExitInfo {
+ _SMProcessExitInfo() {
+ this->pid = 0;
+ this->exitValue = 0;
+ this->signalNumber = 0;
+ this->binaryFileName[0] = '\0';
+ }
+
+ UI_32 pid;
+ SI_32 exitValue;
+ SI_32 signalNumber;
+ CHAR binaryFileName[MAX_PATH_LENGTH];
+} SMProcessExitInfo;
+
+typedef struct _SMLoggingInfo { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ _SMLoggingInfo() {
+ this->pid = 0;
+ this->exitValue = 0;
+ this->signalNumber = 0;
+ this->binaryFileName[0] = '\0';
+ this->messageStr = "";
+ this->suffixStr = "";
+ this->path = "";
+ this->resetReason = e_SS_SM_CPU_RESET_REASON_INVALID;
+ }
+
+ UI_32 pid;
+ SI_32 exitValue;
+ SI_32 signalNumber;
+ CHAR binaryFileName[MAX_PATH_LENGTH];
+ std::string messageStr;
+ std::string suffixStr;
+ std::string path;
+ ESMCpuResetReason resetReason;
+} SMLoggingInfo;
+
+struct ERROR_EVENT_INFO { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ERROR_EVENT_INFO() :
+ m_eventEnqueueTimeStamp(""),
+ m_moduleQueueName(""),
+ m_eventType(eErrorEventTypeMaxValue),
+ m_prio(eErrorEventPrioDefault),
+ m_uniqueCycles(ClockCycle()), // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_errorEventResetType(eErrorEventResetTypeNone) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ std::string m_eventEnqueueTimeStamp;
+ std::string m_moduleQueueName;
+ EErrorEventType m_eventType;
+ SMLoggingInfo m_loggingInfo;
+ EErrorEventPrio m_prio;
+ UI_64 m_uniqueCycles;
+ EErrorEventResetType m_errorEventResetType;
+};
+
+struct ERROR_EVENT_COMPARE {
+ bool operator() (const ERROR_EVENT_INFO& lhs,
+ const ERROR_EVENT_INFO& rhs) const {
+ if ((eErrorEventPrioDefault == lhs.m_prio) &&
+ (eErrorEventPrioDefault == rhs.m_prio)) {
+ return (lhs.m_uniqueCycles < rhs.m_uniqueCycles);
+ } else {
+ return (lhs.m_prio > rhs.m_prio);
+ }
+ }
+};
+
+typedef std::set<ERROR_EVENT_INFO, ERROR_EVENT_COMPARE> ERROR_EVENT_QUEUE;
+typedef ERROR_EVENT_QUEUE::iterator ERROR_EVENT_QUEUE_ITER;
+typedef std::pair<ERROR_EVENT_QUEUE_ITER, BOOL> ERROR_EVENT_QUEUE_RET;
+
+typedef EFrameworkunifiedStatus (*HndlrCb)(HANDLE hApp);
+typedef EFrameworkunifiedStatus (*FncCbType2)(HANDLE hApp, UI_32 f_UI_32);
+typedef BOOL (*FncCbType3)(UI_32 f_UI_32);
+
+typedef std::pair<SS_SystemManagerProtocol, Pwr_ServiceSetInterface> SM_POWER_EVENT_INFO;
+typedef std::queue<SM_POWER_EVENT_INFO> SM_POWER_EVENT_QUEUE;
+
+typedef struct {
+ std::string m_cmd;
+ UI_64 m_time;
+ std::string m_sender;
+} Ts_cmdHist;
+
+typedef std::list<std::string> ErrorGroupList;
+typedef ErrorGroupList::iterator ErrorGroupListIter;
+
+typedef std::vector<Ts_cmdHist> cmdHist;
+typedef cmdHist::iterator cmdHistIter;
+
+typedef std::vector<std::string> HBList;
+typedef HBList::iterator HBListIter;
+
+class CVersionNumInfo {
+ public:
+ CVersionNumInfo() : m_VersionNumber(0), m_eSystemmanagerStatus(eFrameworkunifiedStatusErrOther) {}
+ CVersionNumInfo(SS_VersionNumberType f_vn, EFrameworkunifiedStatus f_eStatus)
+ : m_VersionNumber(f_vn), m_eSystemmanagerStatus(f_eStatus) {}
+
+ // System Manager's local data store; write once on initialization,
+ // read as needed at clients' request
+ SS_VersionNumberType m_VersionNumber;
+ EFrameworkunifiedStatus m_eSystemmanagerStatus; // Validity / status of version number
+};
+
+#define SS_SM_RELAUNCH_NO_LIMIT -1
+typedef struct _PreLaunchModuleParams {
+ _PreLaunchModuleParams() {
+ this->LaunchFunc = NULL;
+ this->name = "";
+ this->binaryFileName = "";
+ this->critical = FALSE;
+ this->relaunchLimit = 0;
+ this->pid = -1;
+ this->relaunchCount = 0;
+ }
+
+ int (*LaunchFunc)(); // Launching function
+ std::string name; // Process name
+ std::string binaryFileName; // Binary file name
+ BOOL critical; // Reboot attribute
+ int relaunchLimit; // Maximum number of Relaunch
+ int pid; // pid
+ int relaunchCount; // Count of Relaunching
+} PreLaunchModuleParams;
+
+typedef std::list<PreLaunchModuleParams> PreLaunchModuleList;
+typedef PreLaunchModuleList::iterator PreLaunchModuleListIter;
+
+typedef struct _GroupRelaunchModuleParams {
+ _GroupRelaunchModuleParams() {
+ this->name = "";
+ this->bIsKilled = FALSE;
+ }
+
+ std::string name; // Process name
+ BOOL bIsKilled; // Flag indicates while forced quit process
+} GroupRelaunchModuleParams;
+
+typedef std::list<GroupRelaunchModuleParams> GroupRelaunchModuleList;
+typedef GroupRelaunchModuleList::iterator GroupRelaunchModuleListIter;
+
+
+class CSystemManager {
+ public:
+ static std::string m_bootOpt; // BOOT OPTION
+
+ CSystemManager();
+ virtual ~CSystemManager();
+
+ static CSystemManager & GetInstance();
+ EFrameworkunifiedStatus Initialize(HANDLE hApp);
+ void Initialize_memory(HANDLE hApp, bool* l_isInitFail, EFrameworkunifiedStatus* l_eStatus, BOOL isIllReset);
+ void Initialize_callbacks(HANDLE hApp, bool *l_isInitFail, EFrameworkunifiedStatus *l_eStatus);
+ /// < Process Launcher Thread Callbacks
+ EFrameworkunifiedStatus OnModuleLaunchResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnTerminateModuleResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnReLaunchModuleResponse(HANDLE hApp);
+ EFrameworkunifiedStatus PerformModuleLaunchRespProcessing(HANDLE hApp,
+ GroupLaunchMapIter & f_GroupIter, // NOLINT
+ ModuleLaunchListIter & f_ModuleIter, // NOLINT
+ PCSTR p_sPPD_tag);
+ EFrameworkunifiedStatus OnModuleStatusResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnGroupLaunchTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnLaunchGroup(HANDLE hApp);
+ EFrameworkunifiedStatus OnLaunchGroupSelfTrigger(HANDLE hApp);
+ EFrameworkunifiedStatus OnProcessLaunchTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnHeartBeatMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnProcessLaunchMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnHeartBeatThreadHeartbeatResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnCheckAvailResponse(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnProcessLauncherThreadHeartbeatResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnClientStartMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnClientStopMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnNPPStatusCheckMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnPowerServiceAvailableNotify(HANDLE hApp);
+ EFrameworkunifiedStatus OnLVI1Notify(HANDLE hApp);
+ EFrameworkunifiedStatus OnLVI2Notify(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnModuleStartCompleteResponse(HANDLE hApp); /// Process start complete from client
+ EFrameworkunifiedStatus OnModuleStopCompleteResponse(HANDLE hApp); /// Process stop Complete from client
+ EFrameworkunifiedStatus OnGetStartExtInfo(HANDLE hApp);
+ EFrameworkunifiedStatus OnGetStopExtInfo(HANDLE hApp);
+ EFrameworkunifiedStatus OnModuleStopCompleteNotification(HANDLE hApp);
+ EFrameworkunifiedStatus ProcessModuleStopCompleteResponse(HANDLE hApp,
+ PCSTR f_moduleName);
+ EFrameworkunifiedStatus ModuleCompleteResponse(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleListIter,
+ SMModuleState f_moduleState,
+ FncCbType3 f_isGroupDoneFnc,
+ FncCbType2 f_groupDoneFnc,
+ PCSTR f_sCompleteTypeText);
+
+ EFrameworkunifiedStatus ProcessGroupOnModuleStopResponse(HANDLE hApp, UI_32 f_groupID);
+
+
+
+ EFrameworkunifiedStatus OnLaunchGroupTriggerProcessResponseTimerExpiry(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnNppStopComplete(HANDLE hApp); /// Process stop Complete from NPPService
+ EFrameworkunifiedStatus OnOpenSession(HANDLE hApp); /// Process open session request
+ EFrameworkunifiedStatus OnCloseSession(HANDLE hApp); /// Process close session acknowledgment
+
+ EFrameworkunifiedStatus CloseApplication(HANDLE hApp);
+ EFrameworkunifiedStatus OnGetAppInfo(HANDLE hApp);
+
+ /// < Heartbeat Thread Callbacks
+ EFrameworkunifiedStatus OnHeartBeatErrorReport(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnCurrentSMStateQuery(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnNPPReadyStatusCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnNPPReadyEventCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnWakeupCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnPowerRequestCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnBackupMgrAvailCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnShutdownModulesRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnSystemModeInfoRequest(HANDLE hApp);
+ EFrameworkunifiedStatus ClearDramBackupInfo(HANDLE hApp);
+ EFrameworkunifiedStatus OnInitCompReportCallback(HANDLE hApp);
+ EFrameworkunifiedStatus SetEnvVariableForVupMode(BOOL bIsVupMode);
+ static int CreateRtUsb();
+ EFrameworkunifiedStatus SecureChipOff();
+ EFrameworkunifiedStatus CallStopCompleteHandler(HANDLE hApp, BOOL bISDetectTimeout = FALSE);
+
+ EFrameworkunifiedStatus On_CWORD56_HeartBeatRequest(HANDLE hApp);
+ EFrameworkunifiedStatus On_CWORD56_HeartBeatResponseIntervalTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnGroupLaunchWaitTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus OnModuleConnectWaitTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus OnStartRespMonitorTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus OnShutdownCompleteMonitorTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus PerformCpuReset(HANDLE hApp, ESMCpuResetReason f_eSmCpuResetReason, std::string f_messageStr = ""); // NOLINT
+ EFrameworkunifiedStatus OnCpuResetRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnSetDataResetModeRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnSetProgUpdateStateRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnLaunchGroupTriggerProcessResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnSetNextWakeupTypeRequest(HANDLE hApp);
+
+ bool GetDramPowerStatusInfo(const HANDLE h_app);
+ bool GetDramStoreStatusInfo(const HANDLE h_app);
+ bool GetSyscomPowerStatusInfo(const HANDLE h_app);
+ //
+ // Start Confirmation, Get _CWORD56_ Version callback functions
+ EFrameworkunifiedStatus OnSetStartupConfirmationDataRequest(HANDLE hApp);
+
+ void SystemManagerDebugDump(HANDLE hApp);
+
+
+ private:
+ CThreadInfo m_hHeartbeatThread; // Handle to Heartbeat Thread
+ CThreadInfo m_hProcLauncherThread; // Handle to Process Launcher Thread
+ UI_32 m_SystemLaunchProgress; // Launch Progress of system
+ TimerCtrl * m_GroupLaunchTimer; // Launch Monitor Timer
+ UI_32 m_aTimerIDs[eSM_TIMERS_END]; // TimerIDs returned by create timer
+ PreLaunchModuleList m_PreLaunchModuleList; // List of modules that shuuld be launched preliminarily.
+ GroupRelaunchModuleList m_GroupRelaunchModuleList; // List of modules that need to relaunch
+ UI_32 m_GroupRelaunchCount; // Count for group relaunch
+ UI_32 m_GroupRelaunchLimit; // Limit for group relaunch
+ GroupLaunchMap m_MapProclaunchGrps; // Map of modules that should be launched.
+ ProcessNameMap m_MapProcNames; // Map of module binary names to queue names.
+ HANDLE m_hPowerServiceSession;
+ UI_32 m_ActiveGroupId; // Modules of Group to whom START/STOP has been sent
+ wakeInfo m_Wake; // WakeUp data from power
+ EPWR_WAKEUP_FACTOR_TYPE m_StartUpReason; // System Manager preserve start up reason
+ ESMDataResetModeInfo m_DataResetMode; // Data Reset Mode
+ SMProgUpdateState m_ProgUpdateState; // ProgUpdate State
+ ESMNextWakeupType m_NextWakeupType; // Next Progupdate State
+ ESMDramBackupStatus m_DramBackupStatus; // Dram Backup Status
+ BOOL m_isIlgReset; // Error Detected by SYS-ucon
+ ESMResetStatus m_ResetStatus; // Reset Status
+ UI_32 m_ResetCount; // Reset Count
+ T_SS_SM_INIT_HOOK_OUT_PARAM m_productCustomPrm; // Product customized parameters
+
+ SS_SMModuleState m_SMCurrentState; // Current state of System Manager
+ UI_32 m_MaxShutdownTime; // Calculate Max shutdown time based on info from xml
+ UI_32 m_NbrDebugDumpRspnRecv; // Total number of debug dump responses received.
+ BOOL m_isRcvModeInfo;
+ SystemModeInfo m_SystemModeInfo; // System Mode Info, SM to read data from persistent file at start
+ SS_String m_BinaryFilesPath; // Store binary files path
+ SS_String m_ConfigFilesPath; // Store config files path
+ ConfigurationData m_SMConfig; // Configuration Data of System Manager and its threads
+ HndlrCb m_pfStopCompleteHandler;
+ CVersionNumInfo m_VersionNumberStruct;
+ SS_String m_BuildInfoStr;
+
+ BOOL m_isRstPending;
+ TSystemManagerCpuResetInfo m_rstPendingInfo;
+
+ SM_POWER_EVENT_QUEUE m_dqDeferMsg;
+ BOOL m_UsingVMPlayer; // Running on a VMPlayer ?
+ UI_32 NVM_VALID_SIGNATURE;
+ StartupConfirmationMsgStrut m_startUpConfirmationMsg;
+ EPWR_USER_MODE_TYPE m_lastUserMode;
+ EPWR_SHUTDOWN_TRIGGER_TYPE m_shutdownTrigger; // Set from Shutdown_Request
+ // msg from _CWORD56_, sent to
+ // all modules as part of
+ // SS_SM_STOP msg.
+ BOOL m_isImmediateReset;
+ BOOL m_isImmResetReq;
+ BOOL m_needReNotifyStartPrm;
+ CHAR *m_pVarCodeStr;
+ GroupLaunchMapIter m_SSLGroupLaunchMapIterator;
+ ModuleLaunchListIter m_ModuleLaunchListIter;
+ BOOL m_bIsNPP_ServicesStarted;
+ BOOL m_bIsBackupAvail;
+ //
+ DynamicLauncher m_oSystemLauncher;
+ DynamicModuleStart m_SystemStarter;
+ //
+ BOOL m_NPPStopSent;
+ ePwrServiceUserModeChangeReasonType m_userModeChangeReason;
+
+ HBList m_HBList;
+
+ cmdHist m__CWORD56_CmdHist;
+ cmdHistIter m__CWORD56_HistIter;
+ cmdHist m_SMCmdHist;
+ cmdHistIter m_SMHistIter;
+ cmdHist m_TimerCmdHist;
+ cmdHistIter m_TimerHistIter;
+ cmdHist m_PubCmdHist;
+ cmdHistIter m_PubHistIter;
+ cmdHist m_ErrHist;
+ cmdHistIter m_ErrHistIter;
+
+ pthread_mutex_t sm_hist_mutex;
+
+ bool m_InitialBoot;
+
+ PsmFactorT m_ResetFactor; // reset(start-up) factor.
+
+ void SetCmdHist(std::string cmd, cmdHist &hist, cmdHistIter &it, std::string sender); // NOLINT
+
+ // ILGRST or ACCOFFON Logging
+ bool StoreDebugLogs(const HANDLE h_app, SS_STORELOGS_OPE_TYPE);
+
+ UI_32 InProgressStateToSendMsg() const;
+ SMModuleState InProgressStateToState() const;
+
+ //************************************************************************
+ // Error Event Logging *
+ //
+ int m_ClProcessSigFd;
+ CSysMemoryMonitor m_SysMemMonitor;
+
+ UI_32 m_FreeMemAvailable;
+ off_t m_coreFileSizeBytes;
+ THbReportData m_HBReport;
+ eSMBootMicroResetReason m_BootMicroResetReason;
+ BOOL m_errorEventQueueLocked;
+ ERROR_EVENT_QUEUE m_errorEventQueue;
+ Timer m_errorEventTimers[eSM_ERROR_EVENT_TIMER_END];
+ BOOL m_isPrevErrEventCompleted;
+ EFrameworkunifiedStatus m_errorEventResult;
+ EArtifactId m_requestedArtifactId;
+ ERROR_EVENT_QUEUE_ITER m_errorEventCurrentIter;
+ // *
+ // End of Error Event Logging *
+ //************************************************************************
+
+
+ ////******************************************************************////
+ //// enum<=>enum maps ////
+ //
+ //
+ // EPWR_POWER_STATE_TYPE <=> BOOL
+ std::map<EPWR_POWER_STATE_TYPE, BOOL> m_PowerType_to_SSBoolEnumMap;
+ std::map<EPWR_POWER_STATE_TYPE, EPWR_USER_MODE_TYPE>
+ m_PowerType_to_SSUserModeEnumMap;
+ std::map<BOOL, EPWR_POWER_STATE_TYPE> m_SSBool_to_PowerTypeEnumMap;
+ //
+ // User Mode
+ std::map<EPWR_USER_MODE_TYPE, BOOL> m_SSUserMode_to_SSBoolEnumMap;
+ std::map<BOOL, EPWR_USER_MODE_TYPE> m_SSBool_to_SSUserModeEnumMap;
+
+ //
+ //// End of enum<=>enum maps ////
+ ////******************************************************************////
+
+ EFrameworkunifiedStatus init_process_launcher(HANDLE hApp);
+ EFrameworkunifiedStatus start_process_launching(HANDLE hApp);
+ EFrameworkunifiedStatus init_Heartbeat(HANDLE hApp);
+ EFrameworkunifiedStatus init_crash_detector(HANDLE hApp);
+ EFrameworkunifiedStatus init_sysmem_monitor(HANDLE hApp);
+ EFrameworkunifiedStatus SendRequestToHeartBeat(HANDLE hAPP, EHBProtocolMessages, VOID *, UI_32);
+ EFrameworkunifiedStatus send_launch_status(HANDLE hApp, UI_32 u32LaunchState);
+
+ EFrameworkunifiedStatus register_all_notification_callbacks(HANDLE hApp);
+ VOID SMStateStartCompleteEntry(HANDLE hApp);
+ VOID SMStateEntry(HANDLE hApp, SS_SMModuleState l_SMState);
+ VOID SMStateExit(HANDLE hApp, SS_SMModuleState l_SMState);
+ VOID SMSetState(HANDLE hApp, SS_SMModuleState l_SMState);
+
+ // Wakeup from Power
+ EFrameworkunifiedStatus BeginStartup(HANDLE hApp);
+ EFrameworkunifiedStatus start_all_modules_of_group(HANDLE hApp, UI_32 f_ui32GroupNumber);
+ EFrameworkunifiedStatus send_power_request_complete_response(HANDLE hApp,
+ std::string pStr);
+ BOOL have_all_services_start_completed(const SMModuleState f_moduleState);
+
+ // Power Off from Power
+ EFrameworkunifiedStatus PublishPowerOnOffNotification(HANDLE hApp);
+
+ // Shutdown from Power
+ EFrameworkunifiedStatus stop_all_modules_of_group(HANDLE hApp);
+ UI_32 calculate_max_shutdown_time();
+ BOOL is_service_shutdown_ready(ModuleLaunchListIter &modIte); // NOLINT
+ BOOL have_critical_services_stopped();
+ VOID check_all_groups_have_stopped(HANDLE hApp);
+ EFrameworkunifiedStatus perform_force_reset(HANDLE hApp);
+ EFrameworkunifiedStatus send_shutdown_complete_response(HANDLE hApp);
+ EFrameworkunifiedStatus SendShutdownResponseMessage(HANDLE hApp);
+
+ PsmFactorT GetResetFactor(PCSTR f_module_name, BOOL f_user_reset);
+ PsmFactorT GetResetFactor(const ModuleLaunchListIter f_module_iter, BOOL f_user_reset);
+
+ EFrameworkunifiedStatus ValidateUserModeMessage(HANDLE hApp, EPWR_USER_MODE_TYPE &l_eUserModeState); // NOLINT
+
+ VOID SetStartGroup();
+
+ VOID ReadPathFromEnvironmentVariables();
+ SS_String ReadConfigDataFileNameFromEnvironmentVariable();
+ SS_String ReadLaunchConfigFileNameFromEnvironmentVariable();
+
+
+ VOID ReadUsingVMPlayerEnvironmentVariable();
+
+ VOID InitiateAllGroupsShutdown(HANDLE hApp);
+ VOID SendDeferMsg(HANDLE hApp);
+ EFrameworkunifiedStatus GetVersionNumber(SS_VersionNumberType &f_VersionNumber); // NOLINT
+ EFrameworkunifiedStatus GetBuildInfo(std::string &f_BuildInfoStr); // NOLINT
+ EFrameworkunifiedStatus RegisterCallbacksForRequester(HANDLE hApp, PCSTR pRequester);
+ EFrameworkunifiedStatus SetSystemModeInfoStruct();
+
+ EFrameworkunifiedStatus PerformLaunchProcedure(HANDLE hApp
+ , ModuleLaunchListIter f_ModuleIterator
+ , SS_String & f_stopCompName); // NOLINT
+
+ EFrameworkunifiedStatus PerformTerminateProcedure(HANDLE hApp
+ , ModuleLaunchListIter f_ModuleIterator
+ , SS_String & f_availabilityName
+ , SS_String & f_stopCompName); // NOLINT
+
+ EFrameworkunifiedStatus SendRequestToLauncher(HANDLE hApp
+ , ModuleLaunchListIter f_ModuleIterator
+ , ESMPLThreadCommandIds f_CommandId
+ , SS_String f_CommandIdStr);
+
+ EFrameworkunifiedStatus FindNameOfTerminatedProcess(SI_32 pid, SS_String &f_ModuleName); // NOLINT
+
+ EFrameworkunifiedStatus GetBinaryNameOfProcess(SS_String f_ModuleQueueName,
+ SS_String &f_ModuleBinaryName); // NOLINT
+
+ EFrameworkunifiedStatus RemoveModuleEntryFromHB(HANDLE hApp, const CHAR *f_ModuleName);
+
+ EFrameworkunifiedStatus PublishUserModeNotification(HANDLE hApp);
+ EFrameworkunifiedStatus PerformPowerOnOffUserModePublication(
+ HANDLE hApp,
+ const char * p_NotificationStr);
+ EFrameworkunifiedStatus SendSystemModeInfoResponse(
+ HANDLE hApp,
+ EPWR_STARTUP_STAGE_TYPE f_startupStage);
+
+ VOID SYSTEMMANAGERLOG_StartupConfirmationMsg(EPWR_SC_MSG_STRUCT & f_scMsg); // NOLINT
+ VOID LogGroupModulesState(UI_32 f_groupId, std::string pStr);
+ VOID LogAllGroupModulesState(std::string pStr);
+
+ EFrameworkunifiedStatus ProcessGroupAsStarted(HANDLE hApp
+ , GroupLaunchMapIter f_GroupIterator);
+ EFrameworkunifiedStatus ProcessGroupAsStarted(HANDLE hApp
+ , UI_32 f_groupId);
+ EFrameworkunifiedStatus GetModuleIterator(PCSTR f_moduleName, ModuleLaunchListIter & f_moduleIter); // NOLINT
+ BOOL IsGroupStarted(UI_32 f_groupId);
+ BOOL IsGroupStopped(UI_32 f_groupId);
+ EFrameworkunifiedStatus ResetModulesStateToConnected(HANDLE hApp);
+
+ EFrameworkunifiedStatus GetTimeStamp(std::string& TimeStamp); // NOLINT
+ std::string GetErrorEventInString(UI_32 &ErrorEventType); // NOLINT
+ EFrameworkunifiedStatus GetLastSourceInfo(SS_SOURCE &source_type); // NOLINT
+ //
+ // Return True when Module is in correct / appropriate state wrt SM state
+ // return false otherwise
+ BOOL GetModuleCondition(ModuleLaunchListIter & f_ModuleIter); // NOLINT
+
+ VOID LogESystemmanagerStatusEnums();
+ VOID LogProtocolIDs();
+
+ VOID SystemmanagerLogString(TFrameworkunifiedZone f_zone,
+ PCSTR f_func,
+ std::string &f_text); // NOLINT
+
+ inline BOOL is_current_state(SS_SMModuleState SMState) {
+ return (m_SMCurrentState == SMState);
+ }
+
+ //**************************************************************************
+ // Get results from TestClient *
+ // *
+ EFrameworkunifiedStatus add_state_information_to_response(CHAR *f_MessageResponse) const;
+ EFrameworkunifiedStatus construct_get_result_response(CHAR *f_MessageResponse); // *
+ EFrameworkunifiedStatus open_session_with_sm_test_client(HANDLE hApp, // *
+ PCSTR pRequester); // *
+ // *
+ // End of 'Get results from TestClient' *
+ //**************************************************************************
+
+ //************************************************************************
+ // Error Event Logging *
+ // *
+ EFrameworkunifiedStatus ErrorEventInit(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnHeartBeatErrorDetected(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnProcessTermDetected(HANDLE f_hApp);
+ BOOL isPreLaunchedProcess(int f_pid);
+ EFrameworkunifiedStatus OnPreLaunchedProcessTermDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo, // NOLINT
+ BOOL f_bIsExited);
+ EFrameworkunifiedStatus OnProcessCrashDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo); // NOLINT
+ EFrameworkunifiedStatus OnProcessExitDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo); // NOLINT
+
+ EFrameworkunifiedStatus OnUserInvokedLoggingRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnEelExportRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnSystemmanagerEmmcLogsRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnSystemmanagerClearLogsRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnDiagLoggingRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnCANLoggingRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnPropagateSystemError(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnCaptureAllLogsRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnCaptureScreenShotRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnCaptureSystemmanagerLogsRequest(HANDLE f_hApp);
+
+
+ EFrameworkunifiedStatus OnBootMicroResetNotification(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnObtainBootMicroLog(HANDLE f_hApp);
+ EFrameworkunifiedStatus RequestBootMicroLog(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnBootMicroLogResponse(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnErrorEventBootMicroLogResponseTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnLowSystemMemory(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainSystemmanagerSystemDataCsv(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainShowMemTxt(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnErrorEventCoreFilePollTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnObtainDebugDumpLog(HANDLE f_hApp);
+ EFrameworkunifiedStatus SendDebugDumpRequestToAllModules(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnDebugDumpResponseReceived(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnDebugDumpCompleteTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus ErrorEventEnqueue(HANDLE f_hApp,
+ EErrorEventType f_eventType,
+ std::string &f_moduleQueueName, // NOLINT
+ EErrorEventResetType f_resetType = eErrorEventResetTypeNone,
+ const SMLoggingInfo &f_loggingInfo = SMLoggingInfo());
+
+ EFrameworkunifiedStatus PerformResetAfterLogging(HANDLE f_hApp,
+ ESMCpuResetReason f_eCpuResetReason,
+ std::string f_messageStr = "");
+
+ EFrameworkunifiedStatus ErrorEventProcessNext(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnLoggingStartRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnErrorEventLoggerStartRequestTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnErrorEventArtifactRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus SendLogArtifactResponseToLogger(HANDLE f_hApp,
+ EArtifactId f_artifactId,
+ std::string f_artifactFilePathAndName);
+
+ EFrameworkunifiedStatus OnErrorEventLoggingComplete(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus ActOnModuleFailure(HANDLE f_hApp,
+ SS_String f_moduleName,
+ BOOL &f_refResetRequired); // NOLINT
+ std::string ErrorEventCreateHmiDisplayString(void);
+
+ // *
+ // End of Error Event Logging *
+ //************************************************************************
+
+ UI_32 m_SystemManagerPriority;
+};
+#define REC_HIST(pStrCmd, hist, it, pStrSender) \
+ SetCmdHist(pStrCmd, hist, it, pStrSender);
+
+#define REC_HIST_IF_SUCCESSFUL(pStr, hist, it, sender, l_eStatus) \
+ if (eFrameworkunifiedStatusOK == l_eStatus) { \
+ REC_HIST(pStr, hist, it, sender) \
+ }
+
+#define LOG_ERROR_REC_HIST(l_eStatus, pStr) { \
+ LOG_ERROR(pStr); \
+ REC_HIST(pStr, m_ErrHist, m_ErrHistIter, GetStr(l_eStatus).c_str()); \
+ }
+#define LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, pStr) \
+ if (eFrameworkunifiedStatusOK != l_eStatus) { \
+ LOG_ERROR(pStr); \
+ REC_HIST(pStr, m_ErrHist, m_ErrHistIter, GetStr(l_eStatus).c_str()); \
+ } else { \
+ LOG_SUCCESS(pStr); \
+ } // End of #define LOG_STATUS(l_eStatus,pStr)
+
+#define LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, pStr) \
+ if (eFrameworkunifiedStatusOK != l_eStatus) { \
+ LOG_ERROR(pStr); \
+ REC_HIST(pStr, m_ErrHist, m_ErrHistIter, GetStr(l_eStatus).c_str()); \
+ } // End of #define LOG_STATUS_IF_ERRORED(l_eStatus,pStr)
+
+#endif // __SS_SYSTEM_MANAGER_H__ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_system_manager_callbacks.h b/systemservice/system_manager/server/include/ss_system_manager_callbacks.h
new file mode 100755
index 0000000..e9d5938
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_system_manager_callbacks.h
@@ -0,0 +1,29 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager business logic.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_MANAGER_CALLBACKS_H_ // NOLINT
+#define SS_SYSTEM_MANAGER_CALLBACKS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#endif // SS_SYSTEM_MANAGER_CALLBACK_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_system_memory_monitor.h b/systemservice/system_manager/server/include/ss_system_memory_monitor.h
new file mode 100755
index 0000000..50cf857
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_system_memory_monitor.h
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager System Low Memory
+/// detection.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SYSTEM_MEMORY_MONITOR_H__ // NOLINT
+#define __SS_SYSTEM_MEMORY_MONITOR_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/resm.h>
+#include <system_service/ss_system_timer.h>
+#include <iostream>
+#include <string>
+#include "ss_sm_config.h"
+
+
+typedef enum _ESMSysMemThreadCommandIds {
+ eSysMemThrdCmd_SYS_LOW_MEMORY = 0x744, ///< SM.CrashDetector --> SM
+} ESMSysMemThreadCommandIds;
+
+struct SysMem {
+ UI_32 FreeMemoryBytes;
+ UI_32 TotalMemoryBytes;
+};
+
+const UI_32 SS_SLM_MEM_MONITOR_TIMER_ID = 3000;
+const UI_32 SS_SLM_SYSTEMMANAGERLOG_TIMER_ID = 3001;
+const UI_32 SS_MEMORY_TIMER_CONFIG_MS = 1000;
+const UI_32 SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS = 30000;
+
+class CSysMemoryMonitor {
+ public:
+ CSysMemoryMonitor(void);
+
+ virtual ~CSysMemoryMonitor(void);
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp);
+ EFrameworkunifiedStatus StopAndFreeObjects(HANDLE f_hApp);
+
+ const std::string GetThreadName(void);
+ void SetSLMConfigData(SLMConfigParameters &f_ConfigData); // NOLINT
+
+ private:
+ EFrameworkunifiedStatus CPUMemThreadStart(HANDLE f_hThread);
+ EFrameworkunifiedStatus CPUMemThreadStop(HANDLE f_hThread);
+ EFrameworkunifiedStatus StopTimers(void);
+ EFrameworkunifiedStatus OnMemoryTimerExpiry(HANDLE f_hThread);
+ EFrameworkunifiedStatus OnSystemmanagerlogTimerExpiry(HANDLE f_hThread);
+ EFrameworkunifiedStatus OnAvailability(HANDLE f_hThread);
+
+ UI_32 GetSystemRamSize(void);
+ UI_32 BitReverse32(UI_32 f_val);
+
+ HANDLE m_hThread;
+ HANDLE m_hParentApp;
+ Timer m_memMonitorTimer;
+ Timer m_systemmanagerlogTimer;
+ SLMConfigParameters m_SLMConfig;
+ SI_32 m_SLMCheckCounter;
+ SI_32 m_siPriority;
+ UI_32 m_NbrSamplesBeforeSystemmanagerlog;
+ SysMem m_sysMemInfoLast;
+ std::string m_memMonitorThreadName;
+ uint32_t m_resmSession;
+};
+
+#endif // __SS_SYSTEM_MEMORY_MONITOR_H__ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_system_thread_info.h b/systemservice/system_manager/server/include/ss_system_thread_info.h
new file mode 100755
index 0000000..f21ad5a
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_system_thread_info.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager thread management.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_THREAD_INFO_H_ // NOLINT
+#define SS_SYSTEM_THREAD_INFO_H_
+
+#include <native_service/frameworkunified_types.h>
+
+typedef enum {
+ eSM_ThreadNotExist
+ , eSM_ThreadCreated
+ , eSMThreadIsFine
+ , eSMWaitForHeartbeat
+ , eSM_ThreadError
+} ESMThreadInfo;
+
+class CThreadInfo {
+ public:
+ CThreadInfo() : m_ThreadHdl(INVALID_HANDLE), m_ThreadState(eSM_ThreadNotExist) {}
+ CThreadInfo(HANDLE hdl, ESMThreadInfo State) : m_ThreadHdl(hdl), m_ThreadState(State) {}
+ public:
+ HANDLE m_ThreadHdl;
+ ESMThreadInfo m_ThreadState;
+};
+
+#endif // SS_SYSTEM_THREAD_INFO_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/system_launcher_cfg_format.h b/systemservice/system_manager/server/include/system_launcher_cfg_format.h
new file mode 100755
index 0000000..b30b21f
--- /dev/null
+++ b/systemservice/system_manager/server/include/system_launcher_cfg_format.h
@@ -0,0 +1,66 @@
+
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_LAUNCH_CONFIG_H_ // NOLINT
+#define SS_SM_LAUNCH_CONFIG_H_
+
+#include <native_service/frameworkunified_types.h>
+
+typedef struct _tLaunchParams {
+ const PCHAR group_name;
+ UI_32 group_id;
+ UI_32 group_launch_wait;
+ const PCHAR name;
+ const PCHAR binary_name;
+ UI_32 priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ const PCHAR arguments;
+ const PCHAR logging_msk_str;
+ const PCHAR restart;
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+ UI_32 fast_shutdown_wait_time;
+
+ public:
+ BOOL IsAGLUnit(void) const { return is_agl_unit; }
+ BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; }
+ BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; }
+ void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; }
+ void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) {
+ disable_agl_resethistory = f_disable_agl_resethistory;
+ }
+ void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) {
+ disable_nonagl_resethistory = f_disable_nonagl_resethistory;
+ }
+
+ private:
+ BOOL is_agl_unit;
+ BOOL disable_agl_resethistory;
+ BOOL disable_nonagl_resethistory;
+} LaunchInfo;
+
+LaunchInfo g_arrLaunchTableCfg[] = {
+};
+#endif // SS_SM_LAUNCH_CONFIG_H_ // NOLINT
diff --git a/systemservice/system_manager/server/sm_launch__CWORD84_.xml b/systemservice/system_manager/server/sm_launch__CWORD84_.xml
new file mode 100755
index 0000000..1392bbb
--- /dev/null
+++ b/systemservice/system_manager/server/sm_launch__CWORD84_.xml
@@ -0,0 +1,116 @@
+<!-- group_id=1 -->
+<group name="CoreModules" wait_time="0" trigger="False" >
+ <launch
+ name=MN_NS_NPPSERVICE path="/usr/agl/bin/NS_NPPService" priority=PR_NS_NPPSERVICE_S
+ critical="True" retry_cnt="0" arguments="-a SS_SysManager -r output=0x2"
+ restart="NULL" is_start_required="False"
+ shutdown_critical="True" shutdown_wait_time="20" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+ <launch
+ name=MN_NS_BACKUPMGR path="/usr/agl/bin/NS_BackupMgr" priority=PR_NS_BACKUPMGR_S
+ critical="True" retry_cnt="0" arguments="-l console"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="True" shutdown_wait_time="15" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+<!-- group_id=2 -->
+<group name="SS_Logger" wait_time="0" trigger="False" >
+ <launch
+ name=MN_SS_LOGGERSRV path="/usr/agl/bin/SS_LoggerService" priority=PR_SS_LOGGERSRV_S
+ critical="True" retry_cnt="0" arguments="-l console -p thrd=pdg.LogQueReader:30,thrd=pdg.TransmitQueReader:30,thrd=pdg.DumpQueReader:11,thrd=pdg.PerformanceQueReader:11,thrd=pdg.LogQueWriter:30,thrd=pdg.TransmitQueWriter:30,thrd=pdg.EvntLogQue:8,thrd=pdg.UdpQueWriter:10"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="True" shutdown_wait_time="10" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+<!-- group_id=3 -->
+<group name="ShadowModules" wait_time="0" trigger="False" >
+ <!--
+ In order to excute the termination process promptly, the shutdown_wait_time of GROUP4~ sha be a;; set tp 0,
+ and FrameworkunifiedOnStop shall be issued to the servies of GROUP~ at almost the same time upon termination.
+ Setting shutdown_wait_time in the COMMUNICATION of GROUP3 makes GROUP3 wait for GROUP4~ to terminate service (wait for FrameworkunifiedOnStop responses) all at once.
+ The reason for batch wait by GROUP3 is to save the LOG of tge ternubatuib processing at the time of ACC-OFF of services
+ because the LOG save processing is performed by the GROUP2 termination processing of SS_LoggerService.
+ -->
+ <launch
+ name=MN_COMMUNICATION path="/usr/agl/bin/communication" priority=PR_COMMUNICATION_S
+ critical="True" retry_cnt="0" arguments="-l console"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="False" shutdown_wait_time="20" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+
+<!-- group_id=4 -->
+<group name="VehicleModules" wait_time="0" trigger="False" >
+ <launch
+ name=MN_POSITIONING path="/usr/agl/bin/Positioning" priority=PR_POSITIONING_S
+ critical="True" retry_cnt="0" arguments="NULL"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="False" shutdown_wait_time="0" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+
+<!-- group_id=5 -->
+<group name="SystemModules" wait_time="0" trigger="False" >
+ <launch
+ name=MN_SS_POWERSERVICE path="/usr/agl/bin/SS_PowerService" priority=PR_SS_POWERSERVICE_S
+ critical="True" retry_cnt="0" arguments="-l console"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="False" shutdown_wait_time="0" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+ <launch
+ name=MN_SS_TASKMANAGER path="/usr/agl/bin/tskmgr" priority=PR_SS_TASKMANAGER_S
+ critical="True" retry_cnt="0" arguments="-l console"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="True" shutdown_wait_time="0" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+ <launch
+ name=MN_SS_RESOURCEMGR path="/usr/agl/bin/resm" priority=PR_SS_RESOURCEMGR_S
+ critical="True" retry_cnt="0" arguments="-l console"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="False" shutdown_wait_time="0" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+<!-- group_id=6 -->
+<!-- group_id=7 -->
+<!-- group_id=8 -->
+<!-- group_id=9 -->
+<!-- group_id=10 -->
+<!-- group_id=11 -->
+<!-- group_id=12 -->
+<!-- group_id=13 -->
+<!-- group_id=14 -->
+<!-- group_id=15 -->
+<!-- group_id=16 -->
+<!-- group_id=17 -->
+<!-- group_id=18 -->
+<!-- group_id=19 -->
+<!-- group_id=20 -->
+<!-- group_id=21 -->
+<!-- group_id=22 -->
+<!-- group_id=23 -->
+<!-- group_id=24 -->
+<!-- group_id=25 -->
+<!-- group_id=26 -->
+<!-- group_id=28 -->
+<!-- group_id=29 -->
+<!-- group_id=30 -->
+<!-- group_id=31 -->
+<!-- group_id=32 -->
+<!-- group_id=33 -->
+<!-- group_id=34 -->
+<!-- group_id=35 -->
+<!-- group_id=36 -->
+<!-- group_id=37 -->
+<!-- group_id=38 -->
+<!-- group_id=39 -->
+<!-- group_id=40 -->
+<!-- group_id=41 -->
+<!-- group_id=42 -->
diff --git a/systemservice/system_manager/server/src/heartbeat/ss_hb_if.cpp b/systemservice/system_manager/server/src/heartbeat/ss_hb_if.cpp
new file mode 100755
index 0000000..a3c2777
--- /dev/null
+++ b/systemservice/system_manager/server/src/heartbeat/ss_hb_if.cpp
@@ -0,0 +1,201 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <ss_hb_thread.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_heartbeat_notifications.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_templates.h>
+#include <new>
+#include "ss_sm_systemmanagerlog.h"
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus HBThreadCallback(HANDLE hThread) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusNullPointer;
+ C * pObj = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hThread));
+ if (pObj) { // LCOV_EXCL_BR_LINE 4:pObj must not be NULL
+ eStatus = (pObj->*M)(hThread);
+ }
+ return eStatus;
+}
+
+static VOID DeletePObj(CHeartBeatThread * pObj) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete pObj;
+}
+// LCOV_EXCL_STOP
+
+static VOID DeleteHBTimer(CHeartBeatThread * pObj) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = pObj->HeartBeatTimersDelete();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "pObj->HeartBeatTimersDelete()");
+}
+// LCOV_EXCL_STOP
+
+#define DetachParentCbThreadProtocols(hThread, handler) \
+{ \
+ EFrameworkunifiedStatus l_eStatus = DetachParentCallbacksFromInterfaceunifiedDispatcher( \
+ hThread, \
+ handler, \
+ static_cast<UI_32>(_countof(handler))); \
+ LOG_STATUS_IF_ERRORED(l_eStatus, "DetachParentCallbacksFromInterfaceunifiedDispatcher()") \
+}
+
+#define DetachCbProtocols(hThread, f_pStr, f_protocolHandlers, hSession) \
+{ \
+ EFrameworkunifiedStatus l_eStatus = \
+ DetachCallbacksFromInterfaceunifiedDispatcher( \
+ hThread, \
+ f_pStr, \
+ f_protocolHandlers, \
+ static_cast<UI_32>(_countof(f_protocolHandlers)), \
+ hSession); \
+ LOG_STATUS_IF_ERRORED(l_eStatus, "DetachCallbacksFromInterfaceunifiedDispatcher()") \
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: SS_SystemManager
+ @brief: HBThreadStart: function would be called at the time of starting of the thread
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+ */
+/*****************************************************************************/
+EFrameworkunifiedStatus HBThreadStart(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ FrameworkunifiedProtocolCallbackHandler HBThreadCommonHandlers[] = {
+ // Command ID, Call back functions
+ { SS_HEARTBEAT_RESPONSE, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnClientResponse> },
+ { SS_HEARTBEAT_PRINT_CONNECTIONS, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnPrintConnections> },
+ { SS_HEARTBEAT_PRINT_STACK, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnPrintStack> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FrameworkunifiedProtocolCallbackHandler HBThreadProtocolHandlers[] = {
+ // Command ID, Call back functions
+ { SS_HEARTBEAT_START, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnStartThread> },
+ { SS_HEARTBEAT_STOP, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnStopThread> },
+ { SS_HEARTBEAT_DELETE_MODULE_ENTRY, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnRemoveModule> },
+ { SS_HEARTBEAT_APPEND_MODULE_ENTRY, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnAppendModule> },
+ { SS_HEARTBEAT_PERIODIC_STATUS_REQ, HBThreadCallback<CHeartBeatThread,
+ &CHeartBeatThread::HBOnPeriodicStatusRequest> },
+ { SS_HEARTBEAT_AVAIL_CHECK_REQ, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnAvailCheckRequest> }
+ }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ CHeartBeatThread * pObj = new (std::nothrow) CHeartBeatThread(hThread); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (NULL == pObj) { // LCOV_EXCL_BR_LINE 5: Standard lib
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 5: Standard lib
+ LOG_ERROR("new(std::nothrow) CHeartBeatThread(hThread)"); // LCOV_EXCL_LINE 5: Standard lib
+ // LCOV_EXCL_BR_START 6:always return eFrameworkunifiedStatusOK
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = pObj->HeartBeatTimerInit(hThread))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("pObj->HeartBeatTimerInit(hThread)"); // LCOV_EXCL_LINE 6:always return eFrameworkunifiedStatusOK
+ DeletePObj(pObj); // LCOV_EXCL_LINE 6:always return eFrameworkunifiedStatusOK
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachParentCallbacksToDispatcher(hThread,
+ HBThreadProtocolHandlers, static_cast<UI_32>(_countof(HBThreadProtocolHandlers))))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachParentCallbacksToDispatcher(HBThreadProtocolHandlers)");
+ DeleteHBTimer(pObj);
+ DeletePObj(pObj);
+ // LCOV_EXCL_STOP
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachParentCallbacksToDispatcher(hThread,
+ HBThreadCommonHandlers, static_cast<UI_32>(_countof(HBThreadCommonHandlers))))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachParentCallbacksToDispatcher(HBThreadCommonHandlers)");
+ DetachParentCbThreadProtocols(hThread, HBThreadProtocolHandlers);
+ DeleteHBTimer(pObj);
+ DeletePObj(pObj);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hThread, FRAMEWORKUNIFIED_ANY_SOURCE, HBThreadCommonHandlers, static_cast<UI_32>(_countof(HBThreadCommonHandlers)), NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher("
+ "FRAMEWORKUNIFIED_ANY_SOURCE, HBThreadCommonHandlers)");
+ DetachParentCbThreadProtocols(hThread, HBThreadCommonHandlers);
+ DetachParentCbThreadProtocols(hThread, HBThreadProtocolHandlers);
+ DeleteHBTimer(pObj);
+ DeletePObj(pObj);
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = FrameworkunifiedSetThreadSpecificData(hThread, pObj); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSetThreadSpecificData(hThread, pObj)");
+ DetachCbProtocols(hThread, FRAMEWORKUNIFIED_ANY_SOURCE, HBThreadCommonHandlers,
+ NULL);
+ DetachParentCbThreadProtocols(hThread, HBThreadCommonHandlers);
+ DetachParentCbThreadProtocols(hThread, HBThreadProtocolHandlers);
+ DeleteHBTimer(pObj);
+ DeletePObj(pObj);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Successful");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: SS_SystemManager
+ @brief: HBThreadStop: function would be called at the time of stopping of the thread
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+ */
+/*****************************************************************************/
+EFrameworkunifiedStatus HBThreadStop(HANDLE hThread) { // LCOV_EXCL_START 14: Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ CHeartBeatThread * pObj = static_cast<CHeartBeatThread *>(FrameworkunifiedGetThreadSpecificData(hThread));
+ if (NULL == pObj) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetThreadSpecificData(hThread)");
+ } else {
+ // delete timers
+ CALL_AND_LOG_STATUS_IF_ERRORED(pObj->HeartBeatTimersDelete());
+ CALL_AND_LOG_STATUS_IF_ERRORED(pObj->HBPublishAvailabilityStatus(hThread, FALSE));
+ DeletePObj(pObj);
+ }
+
+ FrameworkunifiedSetThreadSpecificData(hThread, NULL);
+ CALL_AND_LOG_STATUS_IF_ERRORED(FrameworkunifiedDetachServiceFromDispatcher(hThread, FrameworkunifiedGetAppName(hThread)));
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_eStatus;
+}// LCOV_EXCL_STOP
diff --git a/systemservice/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp b/systemservice/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp
new file mode 100755
index 0000000..5fb4e00
--- /dev/null
+++ b/systemservice/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp
@@ -0,0 +1,184 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+#include <stdlib.h>
+#include <string.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+
+#include "ss_hb_thread.h"
+#include "ss_sm_systemmanagerlog.h"
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnTimerExpiry
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnTimerExpiry(HANDLE f_hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ // check heart beat replies received from clients.
+ l_eStatus = HBCheckHeartBeatResponses(f_hThread);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "HBCheckHeartBeatResponses()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // send heart beat requests to clients
+ l_eStatus = HBSendRequest(f_hThread);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "HBSendRequest()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnClientResponse
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnClientResponse(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ l_eStatus = m_oSessionHandler.HBProcessClientResponse(f_hThread);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_oSessionHandler.HBProcessClientResponse(f_hThread)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnPeriodicStatusRequest
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnPeriodicStatusRequest(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendParent(f_hThread, SS_HEARTBEAT_PERIODIC_RESP, 0, NULL))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendParent(SS_HEARTBEAT_PERIODIC_RESP)"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "Successful");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnPeriodicStatusRequest
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnAvailCheckRequest(HANDLE f_hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ THbAvailCheck check;
+ l_eStatus = m_oSessionHandler.HBAvailableCheck(check);
+ SS_ASERT(l_eStatus == eFrameworkunifiedStatusOK); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendParent(f_hThread, SS_HEARTBEAT_AVAIL_CHECK_RESP, sizeof(check), &check))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendParent(SS_HEARTBEAT_AVAIL_CHECK_RESP)"); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnRemoveModule
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnRemoveModule(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ TSMRequestMessage tReqMsgData;
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg <TSMRequestMessage> (f_hThread, tReqMsgData))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s is required to be Deleted from HeartBeat Monitor List", tReqMsgData.pstModuleName);
+
+ // delete module entry from map
+ l_eStatus = m_oSessionHandler.HBDeleteRegisteredClientEntry(f_hThread, tReqMsgData.pstModuleName);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_oSessionHandler.HBDeleteRegisteredProcessEntry()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnAppendModule
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnAppendModule(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ TSMRequestMessage tReqMsgData;
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < TSMRequestMessage > (f_hThread, tReqMsgData))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s is required to be Appended from HeartBeat Monitor List", tReqMsgData.pstModuleName);
+
+ // append module entry from map
+ SubscriberName l_Subscriber = tReqMsgData.pstModuleName;
+ l_eStatus = m_oSessionHandler.HBEntrySubscriber(l_Subscriber); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_oSessionHandler.HBEntrySubscriber()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// EOF
diff --git a/systemservice/system_manager/server/src/heartbeat/ss_hb_session.cpp b/systemservice/system_manager/server/src/heartbeat/ss_hb_session.cpp
new file mode 100755
index 0000000..8178e46
--- /dev/null
+++ b/systemservice/system_manager/server/src/heartbeat/ss_hb_session.cpp
@@ -0,0 +1,415 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_sm_thread_names.h>
+#include <system_service/ss_templates.h>
+#include <iostream>
+#include <iomanip>
+#include <utility>
+#include <list>
+#include <string>
+
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_hb_thread.h"
+#include "ss_hb_session.h"
+#include "ss_system_manager.h"
+
+using namespace std; // NOLINT
+
+CHeartBeatSessionHandler::CHeartBeatSessionHandler() {
+}
+
+CHeartBeatSessionHandler::~CHeartBeatSessionHandler() { // LCOV_EXCL_START 14: Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HbSessionInfo
+ @note: HbSessionInfo constructor
+ @param
+ @return
+ *****************************************************************************/
+CHeartBeatSessionHandler::HbSessionInfo::HbSessionInfo(SubscriberName f_Subscriber) {
+ fRunning = FALSE;
+ fHeartBeatRequestSent = FALSE;
+ fHeartBeatResponseReceived = FALSE;
+ HeartBeatRetryCount = 0;
+ fHeartBeatTimedOut = FALSE;
+ hSession = NULL;
+ szName = f_Subscriber;
+ fisAvailability = FALSE;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBEntrySubscriber
+ @note:
+ @param
+ @return
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBEntrySubscriber(SubscriberName &f_Subscriber) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // check if the subscriber is already in map
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.find(f_Subscriber);
+
+ // the l_SessionInfoIterator is set to the end then the subscriber is not in the map
+ if (m_mapHbSessions.end() == l_SessionInfoIterator) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Entry Subscriber : %s", f_Subscriber.c_str());
+ HbSessionInfo l_NewHBClientSessionInfo(f_Subscriber.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ pair<HbSessionIter, bool> ret;
+ // insert new subscriber entry into the session map
+ ret = m_mapHbSessions.insert(std::make_pair(f_Subscriber, l_NewHBClientSessionInfo));
+ if (!ret.second) { // LCOV_EXCL_BR_LINE 6:l_NewHBClientSessionInfo must not be NULL.
+ // LCOV_EXCL_START 6:l_NewHBClientSessionInfo must not be NULL.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Subscriber '%s' is already in the map", f_Subscriber.c_str());
+ }
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: ProcessHBClientResponse
+ @note: Process the response received from client, update relevant structure data
+ @param HANDLE
+ @return EFrameworkunifiedStatus
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBProcessClientResponse(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "+");
+ BOOL l_availability = FALSE;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<BOOL>(f_hThread, l_availability))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ // find the subscriber...
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.find(FrameworkunifiedGetMsgSrc(f_hThread));
+
+ // the l_SessionInfoIterator is set to the end then the subscriber is not in the map
+ if (m_mapHbSessions.end() != l_SessionInfoIterator) {
+ l_SessionInfoIterator->second.HeartBeatRetryCount = 0;
+ l_SessionInfoIterator->second.fHeartBeatResponseReceived = TRUE;
+ l_SessionInfoIterator->second.fHeartBeatRequestSent = FALSE;
+ l_SessionInfoIterator->second.fisAvailability = l_availability;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__,
+ "HeartBeat received from module: %s ", l_SessionInfoIterator->first.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__,
+ "Ignoring Heart Beat Response, Client: %s not found in the map!", FrameworkunifiedGetMsgSrc(f_hThread));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBPrintConnection
+ @note: .Print registered client information
+ @param VOID
+ @return VOID
+ *****************************************************************************/
+VOID CHeartBeatSessionHandler::HBPrintConnection() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // find the subscriber...
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.begin();
+ for (; l_SessionInfoIterator != m_mapHbSessions.end(); l_SessionInfoIterator++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG_DUMP, __FUNCTION__,
+ "HeartBeat Service is Connected to: %s via a Session: Running: %s ",
+ l_SessionInfoIterator->second.szName.data(),
+ (l_SessionInfoIterator->second.fRunning ? "YES" : "NO"));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBPrintStack
+ @note: .Print registered client information
+ @param VOID
+ @return VOID
+ *****************************************************************************/
+VOID CHeartBeatSessionHandler::HBPrintStack(UI_32 f_MaxHeartBeatRetryCount) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // find the subscriber...
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.begin();
+ for (; l_SessionInfoIterator != m_mapHbSessions.end(); l_SessionInfoIterator++) {
+ if (FALSE == l_SessionInfoIterator->second.fHeartBeatResponseReceived) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG_DUMP, __FUNCTION__,
+ "HeartBeat Service is Connected to: %s via a Session: Running: %s ",
+ l_SessionInfoIterator->second.szName.data(),
+ (l_SessionInfoIterator->second.fRunning ? "YES" : "NO"));
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG_DUMP, __FUNCTION__,
+ "Retry count (%d) within limit (%d), HeartBeatTimedout = %s",
+ l_SessionInfoIterator->second.HeartBeatRetryCount,
+ f_MaxHeartBeatRetryCount,
+ (l_SessionInfoIterator->second.fHeartBeatTimedOut == TRUE ?
+ "TRUE" : "FALSE"));
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBCheckResponses
+ @note: Check if all clients have replied to heartbeat query and generate report
+ @param THbReportData Report structure to be filled
+ @param UI_32 Heartbeat max retry count
+ @return eFrameworkunifiedStatusFail if one or more modules have timed out, eFrameworkunifiedStatusOK otherwise.
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBCheckResponses(
+ THbReportData &f_tReportData, UI_32 f_MaxHeartBeatRetryCount,
+ SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.begin();
+ memset(&f_tReportData, 0, sizeof(THbReportData));
+
+ int index = 0;
+
+ while (l_SessionInfoIterator != m_mapHbSessions.end()) {
+ if (f_ChkIndex == (index % f_HeartBeatIntervalRepeat)) {
+ // check if report queue is full
+ // LCOV_EXCL_BR_START 6: f_tReportData.nNumOfModules can't more than SS_MAX_NUM_MODULES
+ if (SS_MAX_NUM_MODULES <= f_tReportData.nNumOfModules) {
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SS_MAX_NUM_MODULES '%d' <= f_tReportData.nNumOfModules '%d'. See ss_system_manager_if.h.",
+ SS_MAX_NUM_MODULES, f_tReportData.nNumOfModules);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+
+ strncpy(f_tReportData.tModuleList[f_tReportData.nNumOfModules].ProcQueueName,
+ l_SessionInfoIterator->first.c_str(),
+ sizeof(f_tReportData.tModuleList[f_tReportData.nNumOfModules].ProcQueueName) - 1);
+ f_tReportData.tModuleList[f_tReportData.nNumOfModules].HeartBeatRetryCount =
+ l_SessionInfoIterator->second.HeartBeatRetryCount;
+ f_tReportData.tModuleList[f_tReportData.nNumOfModules].ProcHBState = HB_STATUS_GOOD;
+
+ if (TRUE == l_SessionInfoIterator->second.fHeartBeatResponseReceived) {
+ l_SessionInfoIterator->second.fHeartBeatResponseReceived = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__,
+ "[%s] Heart Beat Response Received !",
+ l_SessionInfoIterator->second.szName.c_str());
+ } else if (TRUE == l_SessionInfoIterator->second.fHeartBeatTimedOut) {
+ f_tReportData.tModuleList[f_tReportData.nNumOfModules].ProcHBState = HB_STATUS_TIMEOUT;
+ } else if ((TRUE == l_SessionInfoIterator->second.fHeartBeatRequestSent)
+ && (FALSE == l_SessionInfoIterator->second.fHeartBeatTimedOut)) {
+ l_SessionInfoIterator->second.HeartBeatRetryCount++;
+
+ if (l_SessionInfoIterator->second.HeartBeatRetryCount > f_MaxHeartBeatRetryCount) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ l_SessionInfoIterator->second.fHeartBeatTimedOut = TRUE;
+ l_SessionInfoIterator->second.HeartBeatRetryCount = 0;
+
+ f_tReportData.tModuleList[f_tReportData.nNumOfModules].ProcHBState = HB_STATUS_TIMEOUT;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Heart Beat Retry count of [%s] has crossed max limit (%d)."
+ "Disabling sending HeartBeat query to it",
+ l_SessionInfoIterator->second.szName.c_str(),
+ f_MaxHeartBeatRetryCount);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: [%s] has missed a Heart Beat. Retry count (%d) is within max retry limit (%d)",
+ l_SessionInfoIterator->second.szName.c_str(),
+ l_SessionInfoIterator->second.HeartBeatRetryCount,
+ f_MaxHeartBeatRetryCount);
+ }
+ }
+ }
+
+ f_tReportData.nNumOfModules++;
+ ++l_SessionInfoIterator;
+ index++;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBSendRequest
+ @note: .Sent heart beat query to the registered clients
+ @param void
+ @return EFrameworkunifiedStatus
+******************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBSendRequest(HANDLE f_hThread,
+ SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+
+ // Get session iterator
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.begin();
+
+ if (l_SessionInfoIterator == m_mapHbSessions.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "No Client has opened session with HeartBeat");
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+
+ int index = 0;
+
+ while (l_SessionInfoIterator != m_mapHbSessions.end()) {
+ if (f_ChkIndex == (index % f_HeartBeatIntervalRepeat)) {
+ if (l_SessionInfoIterator->second.hSession == NULL) { // LCOV_EXCL_BR_LINE 200:hSession must not be NULL
+ l_SessionInfoIterator->second.hSession = FrameworkunifiedMcOpenSender(f_hThread, l_SessionInfoIterator->first.c_str());
+ if (NULL == l_SessionInfoIterator->second.hSession) { // LCOV_EXCL_BR_LINE 200:hSession must not be NULL
+ // LCOV_EXCL_START 200: hSession must not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedMcOpenSender(%s) returned NULL",
+ l_SessionInfoIterator->first.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ l_SessionInfoIterator->second.fRunning = TRUE;
+ }
+ }
+
+ if ((NULL != l_SessionInfoIterator->second.hSession)
+ && (FALSE == l_SessionInfoIterator->second.fHeartBeatTimedOut)) {
+ if (eFrameworkunifiedStatusOK == (l_eStatus = FrameworkunifiedSendMsg(l_SessionInfoIterator->second.hSession, SS_HEARTBEAT_REQUEST, 0, NULL))) { // LCOV_EXCL_BR_LINE 5:NSFW's error // NOLINT(whitespace/line_length)
+ /// TODO review if we are required to return failure if sending message to one process failed.
+ l_SessionInfoIterator->second.fHeartBeatResponseReceived = FALSE;
+ l_SessionInfoIterator->second.fHeartBeatRequestSent = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__,
+ "HeartBeat Request sent to : %s", l_SessionInfoIterator->first.c_str());
+ } else {
+ // LCOV_EXCL_START 5:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSendMsg(%s, SS_HEARTBEAT_REQUEST) errored: %d/'%s'",
+ l_SessionInfoIterator->first.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__,
+ " HeartBeat Request was not sent to '%s', timeout is '%s'",
+ l_SessionInfoIterator->first.c_str(),
+ (l_SessionInfoIterator->second.fHeartBeatTimedOut == TRUE ? "TRUE" : "FALSE"));
+ }
+ }
+ ++l_SessionInfoIterator;
+ index++;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBDeleteRegisteredClientEntry
+ @note: .
+ @param
+ @return EFrameworkunifiedStatus
+******************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBDeleteRegisteredClientEntry(HANDLE f_hThread, PSTR pQueueName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ SubscriberName tQueuename(pQueueName);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Looking for %s.", tQueuename.c_str());
+
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.find(tQueuename);
+
+ if (m_mapHbSessions.end() != l_SessionInfoIterator) {
+ // Close the session handle
+ if (NULL != l_SessionInfoIterator->second.hSession) { // LCOV_EXCL_BR_LINE 200:hSession must not be NULL when tQueuename exists. // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedMcClose(l_SessionInfoIterator->second.hSession))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedMcClose()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ l_SessionInfoIterator->second.hSession = NULL;
+ }
+ m_mapHbSessions.erase(tQueuename);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting '%s' Successful ", tQueuename.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "%s not found in Heart beat client list", tQueuename.c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBAvailableCheck
+ @note: .
+ @param
+ @return EFrameworkunifiedStatus
+******************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBAvailableCheck(THbAvailCheck &check) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL isOk = TRUE;
+
+ std::list<std::string> ngList;
+ for (HbSessionIter ite = m_mapHbSessions.begin(); ite != m_mapHbSessions.end(); ite++) {
+ if (ite->second.fisAvailability == FALSE) {
+ ngList.push_back(ite->first);
+ // Notify Last Service as Representative
+ snprintf(check.serviceName, SS_SM_HB_MAX_PROC_NAME_SIZE, "%s", ite->first.c_str());
+ isOk = FALSE;
+ }
+ }
+
+ if (isOk == FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "********* AVAILABILITY CHECK ERROR **********");
+ fprintf(stderr, "HBOnAvailCheckRequest/********* AVAILABILITY CHECK ERROR **********\n"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "********* AVAILABILITY CHECK OK **********");
+ fprintf(stderr, "HBOnAvailCheckRequest/********* AVAILABILITY CHECK OK **********\n"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ for (std::list<std::string>::iterator ite = ngList.begin(); ite != ngList.end(); ite++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " %s", ite->c_str());
+ fprintf(stderr, " %s\n", ite->c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ check.isOk = isOk;
+
+ return l_eStatus;
+}
diff --git a/systemservice/system_manager/server/src/heartbeat/ss_hb_thread.cpp b/systemservice/system_manager/server/src/heartbeat/ss_hb_thread.cpp
new file mode 100755
index 0000000..19d124a
--- /dev/null
+++ b/systemservice/system_manager/server/src/heartbeat/ss_hb_thread.cpp
@@ -0,0 +1,355 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <system_service/ss_heartbeat_notifications.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+
+#include "ss_hb_thread.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_system_manager.h"
+
+/// Total Timers used by Heart Beat Thread
+/// This value is used for creating timers
+#define HBMaxTimers 1
+#define HBTimerInterval 1
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus HBThreadCallback(HANDLE hThread) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ C * pObj = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hThread));
+ if (pObj) { // LCOV_EXCL_BR_LINE 4:pObj must not be NULL
+ eStatus = (pObj->*M)(hThread);
+ }
+ return eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: CHeartBeatThread
+ @note: Constructor
+*****************************************************************************/
+CHeartBeatThread::CHeartBeatThread(HANDLE f_hThread) :
+ m_oTimerCtrl(HBMaxTimers)
+ , m_HBTimerID(0)
+ , m_NextChkIndex(0)
+ , m_hThread(f_hThread) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::memset(&m_HBConfigParams, 0, sizeof(m_HBConfigParams));
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: ~CHeartBeatThread
+ @note: Destructor
+*****************************************************************************/
+CHeartBeatThread::~CHeartBeatThread() { // LCOV_EXCL_START 14: Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBPublishAvailabilityStatus
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @param BOOL - The Availability Status to be published
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBPublishAvailabilityStatus(HANDLE hThread, BOOL f_bAvailabiltyStatus) {// LCOV_EXCL_START 14: Resident process, not called by NSFW
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Send availability notification to users
+ l_eStatus = FrameworkunifiedPublishServiceAvailability(hThread, f_bAvailabiltyStatus);
+ char l_cBuf[100] = { 0 };
+ snprintf(l_cBuf,
+ sizeof(l_cBuf),
+ "FrameworkunifiedPublishServiceAvailability(%s)",
+ GetStr(f_bAvailabiltyStatus).c_str());
+ LOG_STATUS(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}// LCOV_EXCL_STOP
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnStartThread
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnStartThread(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ UI_32 l_DataLen = FrameworkunifiedGetMsgLength(hThread); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if ((sizeof(UI_32) + (SS_MAX_NUM_MODULES * SS_SM_HB_MAX_PROC_NAME_SIZE) + sizeof(m_HBConfigParams)) < l_DataLen) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: message buffer sizes invalid:received %d", l_DataLen);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ CHAR l_Data[l_DataLen]; // NOLINT
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hThread, (PVOID) & l_Data, static_cast<UI_32>(sizeof(l_Data)), eSMRRelease))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedGetMsgDataOfSize() errored: 0x%x", l_eStatus);
+ return l_eStatus;
+ }
+
+ CHAR* p_Data = &l_Data[0];
+ UI_32 list_num;
+ memcpy(&m_HBConfigParams, p_Data, sizeof(m_HBConfigParams));
+ p_Data = p_Data + sizeof(m_HBConfigParams);
+ memcpy(&list_num, p_Data, sizeof(list_num));
+ p_Data = p_Data + sizeof((list_num));
+
+ for (UI_32 i = 0; i < list_num; i++) {
+ SubscriberName l_Subscriber = p_Data; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != m_oSessionHandler.HBEntrySubscriber(l_Subscriber)) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: HBEntrySubscriber");
+ }
+ p_Data = p_Data + SS_SM_HB_MAX_PROC_NAME_SIZE;
+ }
+
+ if (0 == m_HBConfigParams.ApplicationHeartBeatIntervalInitial) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Heart beat disabled via configuration file interval "
+ "parameter set to 0.");
+ } else if (0 != m_HBTimerID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Heart Beat Timer ID '%d' already created, ignoring "
+ "repeated Heart Beat Start command.", m_HBTimerID);
+ } else {
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hThread, NTFY_HeartBeatAvailability))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedRegisterServiceAvailabilityNotification(" NTFY_HeartBeatAvailability ")");
+ // LCOV_EXCL_STOP
+ }
+ else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Service availability %s Registered SOURCE : %s",
+ NTFY_HeartBeatAvailability,
+ FrameworkunifiedGetAppName(hThread));
+
+ // Publish Heart Beat Availability
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != (l_eStatus = HBPublishAvailabilityStatus(hThread, TRUE))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("HBPublishAvailabilityStatus(TRUE)");
+ // LCOV_EXCL_STOP
+ }
+ }
+ // Create Heart Beat app monitor
+ m_HBTimerID = m_oTimerCtrl.CreateTimer(HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnTimerExpiry>); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (0 == m_HBTimerID) { // LCOV_EXCL_BR_LINE 8: m_HBTimerID can't be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Heart Beat Timer ID creation failed.");
+ // return eFrameworkunifiedStatusFail;
+ } else {
+ // Start Heart Beat app monitor
+ m_oTimerCtrl.StartTimer(m_HBTimerID,
+ m_HBConfigParams.ApplicationHeartBeatIntervalInitial,
+ 0,
+ HBTimerInterval,
+ 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Initial Heart Beat Timer created for %d seconds interval",
+ m_HBConfigParams.ApplicationHeartBeatIntervalInitial);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Repetitive Heart Beat Timer created for %d seconds interval",
+ m_HBConfigParams.ApplicationHeartBeatIntervalRepeat);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnStopThread
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnStopThread(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (0 != m_HBTimerID) {
+ // Stop HeartBeat timer
+ m_oTimerCtrl.StopTimer(m_HBTimerID);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Timer '%d' stopped", m_HBTimerID);
+ }
+ else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_HBTimerID' is '0'; unable to stop timer");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HeartBeatTimerInit
+ @note:
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HeartBeatTimerInit(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_oTimerCtrl.Initialize(hThread);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HeartBeatTimersDelete
+ @note:
+ @param void
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HeartBeatTimersDelete() {// LCOV_EXCL_START 14: Resident process, not called by NSFW
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (0 == m_HBTimerID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_HBTimerID' is '0'; unable to delete timer");
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ // Delete Heart Beat timer
+ UI_32 l_TimerID = m_oTimerCtrl.DeleteTimer(m_HBTimerID);
+ if (0 == l_TimerID) {
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ LOG_ERROR("m_oTimerCtrl.DeleteTimer(m_HBTimerID)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Successful");
+ }
+ m_HBTimerID = 0;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}// LCOV_EXCL_STOP
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBCheckHeartBeatResponses
+ @note: This function checks heartbeat responses and generates a summary
+ report for System Manager if one or more modules have failed to
+ reply within the configured maximum number of heartbeat retries.
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBCheckHeartBeatResponses(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ THbReportData f_tReportData;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = m_oSessionHandler.HBCheckResponses(f_tReportData,
+ m_HBConfigParams.MaxHeartBeatRetryCount,
+ m_HBConfigParams.ApplicationHeartBeatIntervalRepeat,
+ m_NextChkIndex);
+ if (l_eStatus == eFrameworkunifiedStatusFail) { // Send a heartbeat report ONLY if a heartbeat failure is detected.
+ // send report to system manager
+ l_eStatus = FrameworkunifiedSendParent(hThread,
+ SS_HEARTBEAT_ERROR_DETECTED,
+ sizeof(f_tReportData),
+ &f_tReportData);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendParent(SS_HEARTBEAT_ERROR_DETECTED)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG0(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBSendRequest
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBSendRequest(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+
+ CALL_AND_LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ m_oSessionHandler.HBSendRequest(hThread, m_HBConfigParams.ApplicationHeartBeatIntervalRepeat, m_NextChkIndex)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ m_NextChkIndex++;
+ if (m_HBConfigParams.ApplicationHeartBeatIntervalRepeat <= m_NextChkIndex) {
+ m_NextChkIndex = 0;
+ }
+
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnPrintConnections
+ @note: .Prints all active sessions connected to HeartBeat
+ @param HANDLE hThread
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnPrintConnections(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_oSessionHandler.HBPrintConnection();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnPrintStack
+ @note: . Prints all sessions connected to HeartBeat
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnPrintStack(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_oSessionHandler.HBPrintStack(m_HBConfigParams.MaxHeartBeatRetryCount);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/systemservice/system_manager/server/src/processlauncher/ProcessLauncher.cpp b/systemservice/system_manager/server/src/processlauncher/ProcessLauncher.cpp
new file mode 100755
index 0000000..6b709fe
--- /dev/null
+++ b/systemservice/system_manager/server/src/processlauncher/ProcessLauncher.cpp
@@ -0,0 +1,317 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_string_maps.h>
+#include <native_service/ns_plogger_if.h>
+#include <string>
+
+#include "ProcessLauncher.h"
+#include "ss_sm_process_launcher_protocol.h"
+#include "ss_sm_process_launcher.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_signals.h"
+
+CProcessLauncher::CProcessLauncher() { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+CProcessLauncher::CProcessLauncher(void *) {
+}
+
+CProcessLauncher::~CProcessLauncher() { // LCOV_EXCL_START 14: resident process end
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ m_mapOfProcesses.clear();
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CProcessLauncher::PLTerminateModule(
+ HANDLE hThread,
+ T_ProcessLauncherTerminationResp *f_pTerminateRespData) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ T_ProcessLauncherTerminationReq l_ModuleTerminateReq;
+
+ // LCOV_EXCL_BR_START 4:NSFW error case
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg < T_ProcessLauncherTerminationReq > (hThread, l_ModuleTerminateReq, eSMRRetain))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4:NSFW error case
+ } else {
+ // get pointer to the process object launched earlier
+ Process * l_pProcessPtr = m_mapOfProcesses[l_ModuleTerminateReq.path]; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // Confirm that the process pointer for the module exists in the map
+ if (NULL != l_pProcessPtr) { // LCOV_EXCL_BR_LINE 200: l_pProcessPtr must not be null
+ // check if process still exists
+ if (l_pProcessPtr->DoesProcessExist()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Terminating %s, PID: %d.", l_ModuleTerminateReq.path, l_pProcessPtr->GetProcessId());
+ // kill unresponsive process
+ l_pProcessPtr->KillProcess(SS_SM_ABORT_SIGNAL);
+
+ if (NULL != f_pTerminateRespData) { // LCOV_EXCL_BR_LINE 200: f_pTerminateRespData must not be null
+ std::strcpy(f_pTerminateRespData->name, // NOLINT
+ l_ModuleTerminateReq.name);
+ std::strcpy(f_pTerminateRespData->path, // NOLINT
+ l_ModuleTerminateReq.path);
+ std::strcpy(f_pTerminateRespData->args, // NOLINT
+ l_ModuleTerminateReq.args);
+ f_pTerminateRespData->moduleIterator =
+ l_ModuleTerminateReq.moduleIterator;
+ f_pTerminateRespData->groupIterator =
+ l_ModuleTerminateReq.groupIterator;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info: %s has already terminated.", l_ModuleTerminateReq.path);
+
+ l_eStatus = eFrameworkunifiedStatusServNotFound;
+ }
+ // remove process entry
+ m_mapOfProcesses.erase(l_ModuleTerminateReq.path);
+ // delete process object
+ delete l_pProcessPtr; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else { // LCOV_EXCL_BR_LINE 200: l_pProcessPtr will not be null
+ // LCOV_EXCL_START 200: l_pProcessPtr will not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s not in m_mapOfProcesses", l_ModuleTerminateReq.path);
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdTerminateModule(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ T_ProcessLauncherTerminationResp l_TerminateRespData;
+ if (eFrameworkunifiedStatusOK == (l_eStatus = PLTerminateModule(hThread, &l_TerminateRespData))) {
+ // reply to System Manager about successful module termination
+ l_eStatus = FrameworkunifiedSendParent(hThread,
+ ePLThrdCmd_TERMINATE_MODULE_RESP,
+ sizeof(l_TerminateRespData),
+ &l_TerminateRespData);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendParent(ePLThrdCmd_TERMINATE_MODULE_RESP"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (eFrameworkunifiedStatusServNotFound == l_eStatus) { // Already terminated
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. Module already terminated.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: PLTerminateModule(%s) errored: %d/'%s'",
+ l_TerminateRespData.name, l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdModuleStatus(HANDLE hThread) {
+ return eFrameworkunifiedStatusOK;
+}
+
+VOID buildArgList(StringList& arg_list, PSTR args) { // NOLINT
+ arg_list.clear();
+ char * pch = NULL;
+ pch = std::strtok(args, " ");
+ while (pch != NULL) {
+ arg_list.push_back(pch);
+ pch = std::strtok(NULL, " ");
+ }
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLLaunchModule(HANDLE hThread, T_ProcessLaunchResp &f_LaunchRespData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ Process *l_pProcessPtr = NULL;
+ T_ProcessLauncherLaunchReq l_ModuleLaunchReq;
+
+ // LCOV_EXCL_BR_START 4:NSFW error case
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg < T_ProcessLauncherLaunchReq > (hThread, l_ModuleLaunchReq))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4:NSFW error case
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Sending to Launcher name: %s, path: %s, args: %s, lmsk: %s, "
+ "prio: %d ", l_ModuleLaunchReq.name,
+ l_ModuleLaunchReq.path, l_ModuleLaunchReq.args,
+ l_ModuleLaunchReq.logging_mask, l_ModuleLaunchReq.priority);
+
+ StringList args;
+ buildArgList(args, l_ModuleLaunchReq.args); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ int log_mask_str_len = static_cast<int>(std::strlen(l_ModuleLaunchReq.logging_mask));
+ if (log_mask_str_len > 0) {
+ // Create mask argument to be passed to application.
+ // The argument must be of the form "-m 0x00000000,0x00000000,...", assuming n 32-bit mask values.
+ // The storage size of the argument must include one byte for the NULL termination character.
+ args.push_back("-m");
+ args.push_back(l_ModuleLaunchReq.logging_mask);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s args: logging_mask: %s",
+ l_ModuleLaunchReq.path, l_ModuleLaunchReq.logging_mask);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PROC_LAUNCH_INFO, __FUNCTION__,
+ " '%s' has no logging_mask specified. Using compile time defaults.",
+ l_ModuleLaunchReq.path);
+ }
+
+ std::strcpy(f_LaunchRespData.name, l_ModuleLaunchReq.name); // NOLINT Module queue name
+ std::strcpy(f_LaunchRespData.path, l_ModuleLaunchReq.path); // NOLINT Module path and file name
+ std::strcpy(f_LaunchRespData.args, l_ModuleLaunchReq.args); // NOLINT
+ f_LaunchRespData.moduleIterator = l_ModuleLaunchReq.moduleIterator;
+ f_LaunchRespData.groupIterator = l_ModuleLaunchReq.groupIterator;
+
+ // Process exists? If not, re-launch the process and create a new map entry.
+ l_pProcessPtr = m_mapOfProcesses[l_ModuleLaunchReq.path]; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (NULL == l_pProcessPtr) { // LCOV_EXCL_BR_LINE 200: l_pProcessPtr must not be null
+ FRAMEWORKUNIFIEDLOG(ZONE_PROC_LAUNCH_INFO, __FUNCTION__,
+ " '%s' is not in the module map. Creating new process.",
+ l_ModuleLaunchReq.name);
+
+ SS_String sPathAndFileName = l_ModuleLaunchReq.path; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_pProcessPtr = new (std::nothrow) Process(l_ModuleLaunchReq.cpu_assign); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (NULL == l_pProcessPtr) { // LCOV_EXCL_BR_LINE 11::new operation failed
+ // LCOV_EXCL_START 11::new operation failed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Process() returned NULL");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusThreadNotExist;
+ // LCOV_EXCL_STOP 11::new operation failed
+ }
+
+ const char* uname =
+ ('\0' == f_LaunchRespData.moduleIterator->unix_user_name[0]) ?
+ NULL : &f_LaunchRespData.moduleIterator->unix_user_name[0]; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_pProcessPtr->CreateProcess(sPathAndFileName, "", l_ModuleLaunchReq.priority, args, uname); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PROC_LAUNCH_INFO, __FUNCTION__,
+ " Process Name: %s Process File: %s Pid: %d Is Alive: %s\n",
+ l_pProcessPtr->GetProcessName().data(),
+ l_pProcessPtr->GetExecutableFileName(),
+ l_pProcessPtr->GetProcessId(),
+ (l_pProcessPtr->DoesProcessExist() == FALSE) ? "No" : "Yes");
+
+ // Add the process in the map
+ m_mapOfProcesses[l_ModuleLaunchReq.path] = l_pProcessPtr; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // launch response
+ f_LaunchRespData.pid = l_pProcessPtr->GetProcessId();
+ f_LaunchRespData.priority = l_pProcessPtr->GetPriority(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ // LCOV_EXCL_START 200: l_pProcessPtr must not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_PROC_LAUNCH_INFO, __FUNCTION__,
+ " %s already in Process Map", l_ModuleLaunchReq.name);
+ // the module is already in the list. Send the response to system manager with PID 0x7FFFFFFF
+ f_LaunchRespData.pid = 0x7FFFFFFF;
+ f_LaunchRespData.priority = l_ModuleLaunchReq.priority;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdLaunchModule(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = PLCmdLaunchModule(hThread, ePLThrdCmd_LAUNCH_MODULE_RESP, "ePLThrdCmd_LAUNCH_MODULE_RESP"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_IF_ERRORED(l_eStatus, " PLCmdLaunchModule(ePLThrdCmd_LAUNCH_MODULE_RESP)"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdRelaunchModule(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Terminate unresponsive module
+ CALL_AND_LOG_STATUS(PLTerminateModule(hThread)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = PLCmdLaunchModule(hThread, ePLThrdCmd_RELAUNCH_MODULE_RESP, "ePLThrdCmd_RELAUNCH_MODULE_RESP"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "PLCmdLaunchModule(ePLThrdCmd_RELAUNCH_MODULE_RESP)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLCmdLaunchModule(HANDLE hThread, UI_32 f_protocol_ID, std::string f_protocol_str) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ T_ProcessLaunchResp l_LaunchRespData;
+ l_LaunchRespData.pid = 0;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = PLLaunchModule(hThread, l_LaunchRespData))) { // LCOV_EXCL_BR_LINE 4:NSFW error case
+ // LCOV_EXCL_START 4:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: PLLaunchModule(%s, %s) errored: %d/'%s'",
+ l_LaunchRespData.name, f_protocol_str.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4:NSFW error case
+ } else {
+ l_eStatus = FrameworkunifiedSendParent(hThread, f_protocol_ID,
+ sizeof(T_ProcessLaunchResp), &l_LaunchRespData);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4:NSFW error case
+ // LCOV_EXCL_START 4:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSendParent( %s, %s ) errored: %d/'%s'",
+ l_LaunchRespData.name, f_protocol_str.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4:NSFW
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdStop(HANDLE hThread) { // LCOV_EXCL_START 14: resident process end
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdStart(HANDLE hThread) {
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdHeartbeatStatusReq(HANDLE hThread) {
+ FrameworkunifiedSendParent(hThread, ePLThrdCmd_THREAD_STATUS_RESP, 0, NULL);
+ return eFrameworkunifiedStatusOK;
+}
+
diff --git a/systemservice/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp b/systemservice/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp
new file mode 100755
index 0000000..3d9b2e9
--- /dev/null
+++ b/systemservice/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp
@@ -0,0 +1,126 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_framework_if.h>
+
+#include "ProcessLauncher.h"
+#include "ss_sm_process_launcher_protocol.h"
+#include "ss_sm_systemmanagerlog.h"
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus ProcessLauncherCallback(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ C * pObj = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hThread));
+
+ if (pObj) { // LCOV_EXCL_BR_LINE 5:pObj must not be NULL
+ l_eStatus = (pObj->*M)(hThread);
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus ProcessLauncherOnStart(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ CProcessLauncher * pObj = new (std::nothrow) CProcessLauncher(NULL); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (pObj) { // LCOV_EXCL_BR_LINE 5:new error
+ // LCOV_EXCL_BR_START 200:l_eStatus always return eFrameworkunifiedStatusOK
+ if (eFrameworkunifiedStatusOK != (l_eStatus = pObj->PLOnCmdStart(hThread))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 200:l_eStatus always return eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: pObj->PLOnCmdStart(hThread) errored: %d/'%s'",
+ l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ FrameworkunifiedSetThreadSpecificData(hThread, pObj);
+
+ FrameworkunifiedProtocolCallbackHandler aParentHandlers[] = { {
+ ePLThrdCmd_LAUNCH_MODULE_REQST, ProcessLauncherCallback<
+ CProcessLauncher,
+ &CProcessLauncher::PLOnCmdLaunchModule> }, {
+ ePLThrdCmd_TERMINATE_MODULE_REQST, ProcessLauncherCallback<
+ CProcessLauncher,
+ &CProcessLauncher::PLOnCmdTerminateModule> }, {
+ ePLThrdCmd_RELAUNCH_MODULE_REQST, ProcessLauncherCallback<
+ CProcessLauncher,
+ &CProcessLauncher::PLOnCmdRelaunchModule> }, {
+ ePLThrdCmd_MODULE_STATUS_REQST, ProcessLauncherCallback<
+ CProcessLauncher,
+ &CProcessLauncher::PLOnCmdModuleStatus> }, {
+ ePLThrdCmd_THREAD_STATUS_REQST, ProcessLauncherCallback<
+ CProcessLauncher,
+ &CProcessLauncher::PLOnCmdHeartbeatStatusReq> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // LCOV_EXCL_BR_START 4:NSFW error case
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedAttachParentCallbacksToDispatcher(hThread, aParentHandlers,
+ static_cast<UI_32>(_countof(aParentHandlers))))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedAttachParentCallbacksToDispatcher() errored: %d/'%s'",
+ l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ // Add other Attaches here!!!
+ }
+ }
+ } else { // LCOV_EXCL_BR_LINE 5::new operation failed
+ // LCOV_EXCL_START 5:new error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: new CProcessLauncher( NULL ) returned NULL");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+// LCOV_EXCL_START 200:Thread which registered in init_process_launcher() is never stoppped.
+EFrameworkunifiedStatus ProcessLauncherOnStop(HANDLE hThread) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ CProcessLauncher * pObj = static_cast<CProcessLauncher *>(FrameworkunifiedGetThreadSpecificData(hThread));
+
+ if (pObj) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = pObj->PLOnCmdStop(hThread))) {
+ LOG_ERROR("PLOnCmdStop()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ delete pObj;
+ pObj = NULL;
+ }
+
+ FrameworkunifiedSetThreadSpecificData(hThread, NULL);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedDetachServiceFromDispatcher(hThread, FrameworkunifiedGetAppName(hThread)))) {
+ LOG_ERROR("FrameworkunifiedDetachServiceFromDispatcher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
diff --git a/systemservice/system_manager/server/src/ss_sm_config.cpp b/systemservice/system_manager/server/src/ss_sm_config.cpp
new file mode 100755
index 0000000..2a8d11e
--- /dev/null
+++ b/systemservice/system_manager/server/src/ss_sm_config.cpp
@@ -0,0 +1,1528 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <boost/algorithm/string.hpp>
+
+
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <other_service/ultoa.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_templates.h>
+#include <native_service/ns_config_parser_if.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <cctype>
+#include <string>
+#include <iomanip>
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <algorithm>
+#include <functional>
+#include <list>
+#include <vector>
+#include <utility>
+
+#include "ss_sm_config.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_launch_configuration.h"
+#include "system_launcher_cfg_format.h"
+#include "ss_sm_default_paths.h"
+
+using namespace std; // NOLINT
+
+// Constants for Heart Beat configuration data
+const UI_32 HBApplicationHeartBeatIntervalInitial = 40u; // Units of seconds. 0 = HB Disabled.
+const UI_32 HBApplicationHeartBeatIntervalRepeat = 5u; // Units of seconds. 0 = HB Disabled.
+const UI_32 HBMaxHeartBeatRetryCount = 3u;
+
+// Constants for Crash Detector configuration data
+const BOOL CDEnabled = TRUE;
+
+// Constants for system low memory configuration data
+
+const UI_32 SLMTimerValue = 5000; // msec
+const UI_32 SLMThresholdValue = (1024 * 512); // bytes
+const UI_32 SLMRetryCount = 6;
+const UI_32 SLMSystemmanagerLogIntervalMs = 30000;
+
+// Constants for Module connect time and Stat Resp Time
+
+const UI_32 ModuleConnectionNumTimesToCheck = 5;
+const UI_32 ModuleConnectionTimeOutSec = 5; // sec
+const UI_32 ModuleStartRespTimeOutSec = 120; // sec
+
+// Constants for Critical Apps Max wait timeout
+
+const UI_32 CriticalAppsMaxShutdownTimeFastSleepSec = 2; // sec
+const UI_32 CriticalAppsMaxShutdownTimeNormalResetSec = 15; // sec
+
+// Constants for User Mode data structure type
+const BOOL isBoolean = TRUE;
+
+const CHAR SMConfigDataHeader[] = "SystemManager";
+const CHAR HBConfigDataHeader[] = "HeartBeat";
+const CHAR CDConfigDataHeader[] = "CrashDetector";
+const CHAR SLMConfigDataHeader[] = "SysLowMemory";
+const CHAR UserModeConfigDataHeader[] = "UserMode";
+
+struct CfgLaunchParams {
+ CfgLaunchParams() :
+ group_id(0),
+ group_launch_wait(0),
+ group_wait_for_trigger(0),
+ priority(0),
+ critical(0),
+ retry_cnt(0),
+ is_start_required(0),
+ shutdown_critical(0),
+ shutdown_wait_time(0),
+ fast_shutdown_wait_time(0),
+ cpu_assign(0x0),
+ is_agl_unit(TRUE),
+ disable_agl_resethistory(FALSE),
+ disable_nonagl_resethistory(FALSE) {
+ std::memset(&group_name[0], 0, sizeof(group_name));
+ std::memset(&name[0], 0, sizeof(name));
+ std::memset(&binary_name[0], 0, sizeof(binary_name));
+ std::memset(&arguments[0], 0, sizeof(arguments));
+ std::memset(&logging_msk_str[0], 0, sizeof(logging_msk_str));
+ std::memset(&restart[0], 0, sizeof(restart));
+ std::memset(&unix_user_name[0], 0, sizeof(unix_user_name));
+ std::memset(&env_value_condition[0], 0, sizeof(env_value_condition));
+ }
+
+ CHAR group_name[100];
+ UI_32 group_id;
+ UI_32 group_launch_wait;
+ BOOL group_wait_for_trigger;
+ CHAR name[100];
+ CHAR binary_name[MAX_PATH_LENGTH];
+ UI_32 priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ CHAR arguments[512];
+ CHAR logging_msk_str[50];
+ CHAR restart[32];
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+ UI_32 fast_shutdown_wait_time;
+ TUserNameBuffer unix_user_name; // TODO(username): Stuff.: Does Posix define a useful
+ // constant representing max length of user id?
+ CHAR env_value_condition[256];
+ int cpu_assign;
+
+ public:
+ BOOL IsAGLUnit(void) const { return is_agl_unit; }
+ BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; }
+ BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; }
+ void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; }
+ void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) {
+ disable_agl_resethistory = f_disable_agl_resethistory;
+ }
+ void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) {
+ disable_nonagl_resethistory = f_disable_nonagl_resethistory;
+ }
+
+ private:
+ BOOL is_agl_unit;
+ BOOL disable_agl_resethistory;
+ BOOL disable_nonagl_resethistory;
+};
+
+namespace ss_sm_cfg {
+class cfg_args {
+ public:
+ enum { // typedef enum _tokens
+ group_name,
+ group_id,
+ group_launch_wait,
+ group_wait_for_trigger,
+ name,
+ binary_name,
+ priority,
+ critical,
+ retry_cnt,
+ arguments,
+ logging_msk,
+ restart,
+ is_start_required,
+ shutdown_critical,
+ shutdown_wait_time,
+ fast_shutdown_wait_time,
+ unix_user_name,
+ is_agl_unit,
+ disable_agl_resethistory,
+ disable_nonagl_resethistory,
+ env_value_condition,
+ cpu_assign,
+ END
+ };
+};
+}; // namespace ss_sm_cfg
+
+static void set_grp_member_info(const LaunchInfo& launch_info, ModuleLaunchList& module_lst); // NOLINT
+static void load_parameters_order_cfg(
+ GroupLaunchMap& groups_map, LaunchOrderedVector& f_OrderList, SS_String& f_launchOrderName, SS_String& f_launchCfgFn); // NOLINT
+
+/*******************************************************************************
+ * CTimeSpan class *
+ * *
+ * Set Initial time, reset Final and Delta to zero, return time *
+ * */
+UI_64 CTimeSpan::Begin() {
+ initial = GetTimeMilliseconds();
+ final = 0;
+ delta = 0;
+ return initial;
+} // End of UI_64 CTimeSpan::Begin()
+
+/*
+ * Set Final time, calculate Delta time, return time
+ */
+UI_64 CTimeSpan::End() {
+ final = GetTimeMilliseconds();
+ delta = (final > initial) ? (final - initial) : 0; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ return final;
+} // End of UI_64 CTimeSpan::End()
+
+UI_64 CTimeSpan::GetInitial(void) {
+ return initial;
+}
+
+UI_64 CTimeSpan::GetFinal() {
+ return final;
+}
+
+UI_64 CTimeSpan::GetDelta() {
+ return delta;
+}
+
+UI_64 CTimeSpan::GetTimeMilliseconds() {
+ UI_64 l_totalmsec = 0;
+ struct timespec timeSpec;
+
+ if (0 != clock_gettime(CLOCK_MONOTONIC, &timeSpec)) {
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_totalmsec = (timeSpec.tv_sec * 1000ULL)
+ + (timeSpec.tv_nsec / 1000000);
+ }
+
+ return l_totalmsec;
+}
+
+/* *
+ * End of CTimeSpan class *
+ ******************************************************************************/
+
+ModuleLaunchParams::ModuleLaunchParams():
+ name("")
+ , path("")
+ , arguments("")
+ , restart("")
+ , configuration_priority(0)
+ , cpu_assign(0x0)
+ , previous_priority(0)
+ , current_priority(0)
+ , critical(FALSE)
+ , retry_cnt(0)
+ , logging_msk_str("")
+ , is_start_required(FALSE)
+ , shutdown_critical(FALSE)
+ , shutdown_wait_time(0)
+ , fast_shutdown_wait_time(0)
+ , pid(0)
+ , hsession(NULL)
+ , relaunch_count(0)
+ , relaunch_status(NotRelaunched)
+ , group_id(0xFFFF)
+ , m_serviceAvailability(FALSE)
+ , m_startReason()
+ , m_stopReason()
+ , m_ModuleDebugDumpState(MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED)
+ , is_agl_unit(TRUE)
+ , disable_agl_resethistory(FALSE)
+ , disable_nonagl_resethistory(FALSE) { // LCOV_EXCL_BR_START 11:Gcov constraints (because exception-handling routes are automatically generated)
+ SetModuleState(MODULE_STATE_INVALID, FALSE);
+ //
+ // Module State strings
+ m_ModuleStateStrMap[MODULE_STATE_INVALID] = "INVALID";
+ m_ModuleStateStrMap[MODULE_STATE_SKIPPED] = "SKIPPED";
+ m_ModuleStateStrMap[MODULE_STATE_LAUNCHING] = "LAUNCHING";
+ m_ModuleStateStrMap[MODULE_STATE_LAUNCHED] = "LAUNCHED";
+ m_ModuleStateStrMap[MODULE_STATE_LAUNCH_FAILED] = "LAUNCH_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_CONNECTED] = "CONNECTED";
+ m_ModuleStateStrMap[MODULE_STATE_START_SENT] = "START_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_START_FAILED] = "START_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STARTED] = "STARTED";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_FAILED] = "STOP_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_SENT] = "STOP_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_STOPPED] = "STOPPED";
+ m_ModuleStateStrMap[MODULE_STATE_START_PRE_SENT] = "PRE_START_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_START_PRE_FAILED] = "PRE_START_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STARTED_PRE] = "PRE_STARTED";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_PRE_SENT] = "PRE_STOP_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_PRE_FAILED] = "PRE_STOP_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STOPPED_PRE] = "PRE_STOPPED";
+ m_ModuleStateStrMap[MODULE_STATE_START_BACKGROUND_SENT] = "BACKGROUND_START_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_START_BACKGROUND_FAILED] = "BACKGROUND_START_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STARTED_BACKGROUND] = "BACKGROUND_STARTED";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_BACKGROUND_SENT] = "BACKGROUND_STOP_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_BACKGROUND_FAILED] = "BACKGROUND_STOP_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STOPPED_BACKGROUND] = "BACKGROUND_STOPPED";
+ // LCOV_EXCL_BR_STOP
+
+ m_startReason.SetReason(NotStarted);
+ m_stopReason.SetReason(NotStopped);
+
+ MAP_ENTRY(m_ModuleDebugDumpStateStrMap, MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ MAP_ENTRY(m_ModuleDebugDumpStateStrMap, MODULE_DEBUG_DUMP_STATE_REQUEST_SENT); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ MAP_ENTRY(m_ModuleDebugDumpStateStrMap, MODULE_DEBUG_DUMP_STATE_RESPONSE_RECEIVED); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ std::memset(&unix_user_name[0], 0, sizeof(unix_user_name));
+} // End of ModuleLaunchParams::ModuleLaunchParams() :
+
+ModuleLaunchParams::~ModuleLaunchParams() {
+} // End of ModuleLaunchParams::~ModuleLaunchParams() :
+
+SMModuleState ModuleLaunchParams::GetModuleState(void) {
+ return m_moduleState;
+} // End of SMModuleState ModuleLaunchParams::GetModuleState(void)
+
+BOOL ModuleLaunchParams::IsModuleState(SMModuleState f_moduleState) {
+ return m_moduleState == f_moduleState;
+} // End of BOOL ModuleLaunchParams::IsModuleState(SMModuleState f_moduleState )
+
+// IsModuleConnected
+// Determine if a module is in a state capable of receiving messages from System Manager.
+BOOL ModuleLaunchParams::IsModuleConnected() const {
+ BOOL l_isModuleConnected = FALSE;
+
+ switch (m_moduleState) {
+ case MODULE_STATE_CONNECTED:
+ case MODULE_STATE_START_SENT:
+ case MODULE_STATE_START_FAILED:
+ case MODULE_STATE_STARTED:
+ case MODULE_STATE_STOP_SENT:
+ case MODULE_STATE_STOP_FAILED:
+ case MODULE_STATE_STOPPED:
+ case MODULE_STATE_START_PRE_SENT:
+ case MODULE_STATE_START_PRE_FAILED:
+ case MODULE_STATE_STARTED_PRE:
+ case MODULE_STATE_STOP_PRE_SENT:
+ case MODULE_STATE_STOP_PRE_FAILED:
+ case MODULE_STATE_STOPPED_PRE:
+ case MODULE_STATE_START_BACKGROUND_SENT:
+ case MODULE_STATE_START_BACKGROUND_FAILED:
+ case MODULE_STATE_STARTED_BACKGROUND:
+ case MODULE_STATE_STOP_BACKGROUND_SENT:
+ case MODULE_STATE_STOP_BACKGROUND_FAILED:
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ l_isModuleConnected = TRUE;
+ break;
+
+ default:
+ l_isModuleConnected = FALSE;
+ break;
+ }
+
+ return (l_isModuleConnected);
+} // End of BOOL ModuleLaunchParams::IsModuleConnected(void)
+
+VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState, BOOL f_bLog) {
+ m_moduleState = f_moduleState;
+
+ switch (m_moduleState) { // Because the module status cannot be changed from the external API
+ case MODULE_STATE_INVALID:
+ case MODULE_STATE_SKIPPED:
+ case MODULE_STATE_LAUNCH_FAILED:
+ case MODULE_STATE_LAUNCHING:
+ case MODULE_STATE_LAUNCHED:
+ case MODULE_STATE_CONNECTED:
+ break;
+ case MODULE_STATE_START_SENT:
+ m_startReason.Begin();
+ break;
+ case MODULE_STATE_START_FAILED:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModuleStartFail);
+ break;
+ case MODULE_STATE_STARTED:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModuleStartComplete);
+ break;
+
+ case MODULE_STATE_STOP_SENT:
+ m_stopReason.Begin();
+ break;
+
+ case MODULE_STATE_STOP_FAILED:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModuleStopFail);
+ break;
+ case MODULE_STATE_STOPPED:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModuleStopComplete);
+ break;
+
+ case MODULE_STATE_START_PRE_SENT:
+ m_startReason.Begin();
+ break;
+ case MODULE_STATE_START_PRE_FAILED:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModulePreStartFail);
+ break;
+ case MODULE_STATE_STARTED_PRE:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModulePreStartComplete);
+ break;
+ case MODULE_STATE_STOP_PRE_SENT:
+ m_stopReason.Begin();
+ break;
+ case MODULE_STATE_STOP_PRE_FAILED:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModulePreStopFail);
+ break;
+ case MODULE_STATE_STOPPED_PRE:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModulePreStopComplete);
+ break;
+
+ case MODULE_STATE_START_BACKGROUND_SENT:
+ m_startReason.Begin();
+ break;
+ case MODULE_STATE_START_BACKGROUND_FAILED:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModuleBackgroundStartFail);
+ break;
+ case MODULE_STATE_STARTED_BACKGROUND:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModuleBackgroundStartComplete);
+ break;
+ case MODULE_STATE_STOP_BACKGROUND_SENT:
+ m_stopReason.Begin();
+ break;
+ case MODULE_STATE_STOP_BACKGROUND_FAILED:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModuleBackgroundStopFail);
+ break;
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModuleBackgroundStopComplete);
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ }
+
+ if (f_bLog) {
+ char buf[255];
+ char *p = buf;
+ strcpy(p, m_ModuleStateStrMap[m_moduleState].c_str()); // NOLINT
+ p += m_ModuleStateStrMap[m_moduleState].size();
+ strcpy(p, ":"); // NOLINT
+ p += sizeof(":") - 1;
+ strcpy(p, name.c_str()); // NOLINT
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, buf);
+ }
+} // End of VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState )
+
+std::string ModuleLaunchParams::ModuleStateStr(void) {
+ return m_ModuleStateStrMap[m_moduleState];
+} // End of std::string ModuleLaunchParams::ModuleStateStr(SMModuleState f_moduleState )
+
+SMModuleDebugDumpState ModuleLaunchParams::GetModuleDebugDumpState(void) { // LCOV_EXCL_START 6: Because the condition cannot be set // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_ModuleDebugDumpState;
+} // End of SMModuleDebugDumpState ModuleLaunchParams::GetModuleDebugDumpState(void)
+// LCOV_EXCL_STOP
+
+std::string ModuleLaunchParams::GetModuleDebugDumpStateStr(void) {
+ return m_ModuleDebugDumpStateStrMap[m_ModuleDebugDumpState];
+} // End of std::string ModuleLaunchParams::GetModuleDebugDumpStateStr()
+
+VOID ModuleLaunchParams::SetModuleDebugDumpState(
+ SMModuleDebugDumpState f_moduleDebugDumpState, BOOL f_bLog) {
+ m_ModuleDebugDumpState = f_moduleDebugDumpState;
+
+ if (f_bLog) { // LCOV_EXCL_BR_LINE 200:f_bLog must be TRUE
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s set for %s",
+ GetModuleDebugDumpStateStr().c_str(), name.c_str());
+ }
+} // End of VOID ModuleLaunchParams::SetModuleDebugDumpState(SMModuleDebugDumpState f_moduleDebugDumpState )
+
+EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(
+ const UI_32 f_iCmd, const T_SS_SM_START_DataStructType* const f_startData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ char l_cBuf[500] = " Error: char l_cBuf[] not built";
+ T_SS_SM_START_DataStructType l_startData;
+ SMModuleState l_SendSuccess = MODULE_STATE_START_SENT;
+ SMModuleState l_SendFailed = MODULE_STATE_START_FAILED;
+
+ memcpy(&l_startData, f_startData, sizeof(T_SS_SM_START_DataStructType));
+
+ switch (relaunch_status) { // LCOV_EXCL_BR_LINE 6: Because all conditions cannot be satisfied from the external API
+ case NotRelaunched:
+ // Setting startup information at the first startup
+ break;
+ case RelaunchSafe: // LCOV_EXCL_START 6: Because all conditions cannot be satisfied from the external API
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_startData.resetStatus = e_SS_SM_RESET_STATUS_NONE;
+ break;
+ case RelaunchErr:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_startData.resetStatus = e_SS_SM_RESET_STATUS_NG;
+ break;
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0);
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ switch (f_iCmd) {
+ case SS_SM_PRE_START:
+ l_SendSuccess = MODULE_STATE_START_PRE_SENT;
+ l_SendFailed = MODULE_STATE_START_PRE_FAILED;
+ break;
+ case SS_SM_PRE_STOP:
+ l_SendSuccess = MODULE_STATE_STOP_PRE_SENT;
+ l_SendFailed = MODULE_STATE_STOP_PRE_FAILED;
+ break;
+ case SS_SM_BACKGROUND_START:
+ l_SendSuccess = MODULE_STATE_START_BACKGROUND_SENT;
+ l_SendFailed = MODULE_STATE_START_BACKGROUND_FAILED;
+ break;
+ case SS_SM_BACKGROUND_STOP:
+ l_SendSuccess = MODULE_STATE_STOP_BACKGROUND_SENT;
+ l_SendFailed = MODULE_STATE_STOP_BACKGROUND_FAILED;
+ break;
+ case SS_SM_START:
+ default:
+ l_SendSuccess = MODULE_STATE_START_SENT;
+ l_SendFailed = MODULE_STATE_START_FAILED;
+ break;
+ }
+
+ const EFrameworkunifiedStatus l_eStatus = FrameworkunifiedSendMsg(hsession, f_iCmd,
+ sizeof(T_SS_SM_START_DataStructType),
+ static_cast<PCVOID>(&l_startData));
+
+ // LCOV_EXCL_START 6: As no TRUE is returned
+ if (IS_ZONE_SET(ZONE_ERR) || IS_ZONE_SET(ZONE_INFO)) {
+
+ snprintf(l_cBuf, sizeof(l_cBuf), "FrameworkunifiedSendMsg(%s, system_manager protocol message, %d/%s)",
+ name.c_str(), l_startData.startupReason,
+ GetStr(l_startData.startupReason).c_str());
+ }
+ // LCOV_EXCL_STOP 6:As no TRUE is returned
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4:NSFW's error
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ SetModuleState(l_SendFailed);
+ // LCOV_EXCL_STOP
+ } else {
+ LOG_SUCCESS(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ SetModuleState(l_SendSuccess);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// End of EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(T_SS_SM_START_DataStructType const * f_startData)
+
+EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(
+ T_SS_SM_STOP_DataStructType const* f_stopData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ char l_cBuf[500] = " Error: char l_cBuf[] not built";
+ EFrameworkunifiedStatus l_eStatus = FrameworkunifiedSendMsg(hsession, SS_SM_STOP,
+ sizeof(T_SS_SM_STOP_DataStructType),
+ static_cast<PCVOID>(f_stopData));
+
+ if (IS_ZONE_SET(ZONE_ERR) || IS_ZONE_SET(ZONE_INFO)) { // LCOV_EXCL_BR_LINE 200:alwasy true
+ snprintf(l_cBuf, sizeof(l_cBuf), "FrameworkunifiedSendMsg(%s, SS_SM_STOP, %d/%s, "
+ "Last User Mode: %s)", name.c_str(),
+ f_stopData->shutdownTrigger,
+ GetStr(f_stopData->shutdownTrigger).c_str(),
+ GetStr(f_stopData->lastUserMode).c_str());
+ }
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4:NSFW's error
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ SetModuleState(MODULE_STATE_STOP_FAILED);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s successful", l_cBuf);
+ SetModuleState(MODULE_STATE_STOP_SENT);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// End of EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(T_SS_SM_STOP_DataStructType const * f_stopData)
+
+EFrameworkunifiedStatus ModuleLaunchParams::GetPriority(UI_32& f_Priority) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ struct sched_param cur_sch_params;
+ errno = 0;
+ f_Priority = 0xDEAD;
+
+ if (0 == pid) { // LCOV_EXCL_BR_LINE 200: pid can not be 0
+ // LCOV_EXCL_START 200: pid can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("0 == pid"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (-1 >= sched_getparam(pid, &cur_sch_params)) { // LCOV_EXCL_BR_LINE 5: system function failed
+ // LCOV_EXCL_START 5: system function failed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFault;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: 'sched_getparam( pid %d, &cur_sch_params )' returned -1, "
+ "strerr() is '%s'", pid, strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ f_Priority = cur_sch_params.sched_priority;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus ModuleLaunchParams::GetPriority (UI_32 & f_Priority )
+
+EFrameworkunifiedStatus ModuleLaunchParams::SetPriority(UI_32 f_Priority) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ errno = 0;
+
+ if (99 < f_Priority) { // LCOV_EXCL_BR_LINE 200: priority can not greater than 99
+ // LCOV_EXCL_START 200: priority can not greater than 99
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Invalid 'f_Priority' %d/0x%X",
+ f_Priority, f_Priority);
+ // LCOV_EXCL_STOP
+ } else if (0 == pid) { // LCOV_EXCL_BR_LINE 200: pid can not be 0
+ // LCOV_EXCL_START 200: pid can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("0 == pid"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ int rc;
+ struct sched_param l_schedParam = { };
+ l_schedParam.sched_priority = f_Priority;
+
+ if (f_Priority == 0) { // LCOV_EXCL_BR_LINE 200: f_Priority can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rc = sched_setscheduler(pid, SCHED_OTHER, &l_schedParam); // LCOV_EXCL_LINE 200: f_Priority can not be 0
+ } else {
+ rc = sched_setscheduler(pid, SCHED_FIFO, &l_schedParam);
+ }
+ SS_ASERT_ERRNO(0 == rc); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ if (rc == 0) {
+ previous_priority = current_priority;
+ current_priority = f_Priority;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " setprio( %s, pid %d, 'previous_priority' %d -> %d ) successful",
+ name.c_str(), pid, previous_priority, f_Priority);
+ } else if (rc == -1) { // LCOV_EXCL_BR_LINE 5: system function failed
+ // LCOV_EXCL_START 5: system function failed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFault;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " setprio( %s, pid %d, 'current_priority' %d -> %d ) returned '-1', strerr() is '%s'",
+ name.c_str(), pid, current_priority, f_Priority,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ } else { // LCOV_EXCL_BR_LINE 5: can not be other value
+ // LCOV_EXCL_START 5: can not be other value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFault;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " setprio( %s, pid %d, 'current_priority' %d -> %d ) returned '%d'; "
+ "'rc' is neither original priority nor '-1': 'errno' is '%d', strerr() is '%s'",
+ name.c_str(), pid, current_priority, f_Priority, rc,
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus ModuleLaunchParams::SetPriority( UI_32 f_Priority )
+
+SysMgrConfiguration::SysMgrConfiguration():
+l_pReaderCfg(NULL) {
+}
+
+SysMgrConfiguration::~SysMgrConfiguration() {
+}
+
+static BOOL is_satisfy_env_launch_cond(CHAR *env_cond) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL l_isSatisfy = FALSE;
+ BOOL l_isReverse = FALSE;
+ CHAR *l_pString = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "env_cond [%s]", env_cond);
+
+ if (NULL != (l_pString = strstr(env_cond, "!="))) {
+ l_isReverse = TRUE;
+ } else if (NULL == (l_pString = strstr(env_cond, "=="))) {
+ SS_ASERT(0);
+ }
+
+ if (NULL != l_pString) {
+ CHAR *l_pEnv = env_cond;
+ CHAR *l_pValue = l_pString + 2;
+ *l_pString = '\0';
+
+ CHAR *l_pEnvVariable = NULL;
+
+ if (NULL != (l_pEnvVariable = std::getenv(l_pEnv))) {
+ l_isSatisfy = (0 == strcmp(l_pValue, l_pEnvVariable)) ? TRUE : FALSE;
+ if (l_isReverse) {
+ l_isSatisfy = !l_isSatisfy;
+ }
+ }
+ }
+
+ return l_isSatisfy;
+}
+
+static void set_grp_member_info(const LaunchInfo& launch_info, ModuleLaunchList& module_lst) { // NOLINT
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // Note: the
+ ModuleLaunchParams grp_member_info;
+ grp_member_info.name = launch_info.name;
+ grp_member_info.path = launch_info.binary_name;
+ grp_member_info.arguments = launch_info.arguments;
+ grp_member_info.restart = launch_info.restart;
+ grp_member_info.configuration_priority = launch_info.priority;
+ grp_member_info.retry_cnt = launch_info.retry_cnt;
+ grp_member_info.logging_msk_str = launch_info.logging_msk_str;
+ grp_member_info.critical = launch_info.critical;
+ grp_member_info.shutdown_critical = launch_info.shutdown_critical;
+ grp_member_info.shutdown_wait_time = launch_info.shutdown_wait_time;
+ grp_member_info.group_id = launch_info.group_id;
+ grp_member_info.is_start_required = launch_info.is_start_required;
+ grp_member_info.fast_shutdown_wait_time = launch_info.fast_shutdown_wait_time;
+ grp_member_info.SetAGLUnit(launch_info.IsAGLUnit());
+ grp_member_info.SetAGLResetHistoryDisable(launch_info.IsAGLResetHistoryDisable());
+ grp_member_info.SetNonAGLResetHisoryDisable(launch_info.IsNonAGLResetHistoryDisable());
+
+ module_lst.push_back(grp_member_info);
+}
+// LCOV_EXCL_STOP
+
+static ModuleLaunchListIter set_cfg_grp_member_info(
+ const CfgLaunchParams& launch_info, ModuleLaunchList& module_lst) { // NOLINT
+ ModuleLaunchParams grp_member_info;
+ ModuleLaunchListIter moduleLaunchListIter;
+
+ grp_member_info.name = launch_info.name;
+ grp_member_info.path = launch_info.binary_name;
+ grp_member_info.arguments = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::strcmp(launch_info.arguments, "NULL") == 0 ? "" : launch_info.arguments);
+ grp_member_info.restart = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::strcmp(launch_info.restart, "NULL") == 0 ? "" : launch_info.restart);
+ grp_member_info.configuration_priority = launch_info.priority;
+ grp_member_info.cpu_assign = launch_info.cpu_assign;
+ grp_member_info.retry_cnt = launch_info.retry_cnt;
+ grp_member_info.logging_msk_str = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::strcmp(launch_info.logging_msk_str, "NULL") == 0 ? "" : launch_info.logging_msk_str);
+
+ grp_member_info.critical = launch_info.critical;
+ grp_member_info.shutdown_critical = launch_info.shutdown_critical;
+ grp_member_info.shutdown_wait_time = launch_info.shutdown_wait_time;
+ grp_member_info.group_id = launch_info.group_id;
+ grp_member_info.is_start_required = launch_info.is_start_required;
+ grp_member_info.fast_shutdown_wait_time = launch_info.fast_shutdown_wait_time;
+ grp_member_info.SetAGLUnit(launch_info.IsAGLUnit());
+ grp_member_info.SetAGLResetHistoryDisable(launch_info.IsAGLResetHistoryDisable());
+ grp_member_info.SetNonAGLResetHisoryDisable(launch_info.IsNonAGLResetHistoryDisable());
+
+ strncpy(&grp_member_info.unix_user_name[0], &launch_info.unix_user_name[0],
+ sizeof(TUserNameBuffer));
+
+ moduleLaunchListIter = module_lst.insert(module_lst.end(), grp_member_info);
+ return (moduleLaunchListIter);
+}
+
+static void load_parameters_order_cfg(GroupLaunchMap& groups_map, // NOLINT
+ LaunchOrderedVector& f_OrderList, SS_String& f_launchOrderName, // NOLINT
+ SS_String& f_launchCfgFn) { // NOLINT
+ SS_String l_OrderCfgFn = f_launchCfgFn;
+ string::size_type pos = l_OrderCfgFn.find(".cfg");
+
+ if (pos == string::npos) { // LCOV_EXCL_BR_LINE 5:C error
+ // LCOV_EXCL_START 5:C error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "invalid file name:%s",
+ f_launchCfgFn.c_str());
+ return;
+ // LCOV_EXCL_STOP
+ }
+
+ l_OrderCfgFn.replace(pos, strlen(".order.cfg"), ".order.cfg");
+ CNSConfigReader *l_pReaderOrderCfg = new CNSConfigReader(l_OrderCfgFn);
+
+ if (l_pReaderOrderCfg != NULL) { // LCOV_EXCL_BR_LINE 5:new error
+ CHAR key[128];
+ std::sprintf(key, "%s.order", f_launchOrderName.c_str()); // NOLINT
+ SS_String value = l_pReaderOrderCfg->GetString(key);
+ std::vector<std::string> strList;
+ if (value.empty()) { // LCOV_EXCL_BR_LINE 200:cannot be empty
+ goto ERROR;
+ }
+// LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ boost::split(strList, value, boost::is_any_of("|"));
+ for (UI_32 i = 0; i < strList.size(); i++) {
+ char* endptr = NULL;
+ f_OrderList.push_back(
+ static_cast<UI_32>(strtoul(strList[i].c_str(), &endptr, 10)));
+ if (*endptr != '\0') {
+ // Discard boot order if invalid string is detected
+ f_OrderList.clear();
+ goto ERROR;
+ }
+ }
+ std::sprintf(key, "%s.owlist", f_launchOrderName.c_str()); // NOLINT
+ SS_String ow_list_value = l_pReaderOrderCfg->GetString(key);
+ std::vector<std::string> owList;
+
+ if (!ow_list_value.empty()) {
+ boost::split(owList, ow_list_value, boost::is_any_of("|"));
+ for (UI_32 i = 0; i < owList.size(); i++) {
+ std::sprintf(key, "%s.%s", f_launchOrderName.c_str(), // NOLINT
+ owList[i].c_str());
+ SS_String grop_ow_time = l_pReaderOrderCfg->GetString(key);
+ if (owList[i].compare(0, 4, "oww_") == 0) {
+ char* endptr = NULL;
+ SS_String group_name = owList[i].substr(strlen("oww_"));
+ UI_32 group_launch_wait = static_cast<UI_32>(strtoul(
+ grop_ow_time.c_str(), &endptr, 10));
+ if (*endptr != '\0') {
+ continue;
+ }
+ GroupLaunchMapIter grp_iter = groups_map.begin();
+ while (grp_iter != groups_map.end()) {
+ if (group_name == grp_iter->second.name) {
+ grp_iter->second.grp_launch_wait = group_launch_wait;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
+ "grp_launch_wait %s=%d", group_name.c_str(),
+ group_launch_wait);
+ break;
+ }
+ grp_iter++;
+ }
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "ConfigReader(%s) is NULL",
+ l_OrderCfgFn.c_str());
+ }
+// LCOV_EXCL_STOP
+ ERROR: if (l_pReaderOrderCfg != NULL) { // LCOV_EXCL_BR_LINE 200:cannot be null
+ delete l_pReaderOrderCfg; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ return;
+}
+
+// Given a string, splits it up on the seperator character
+// SubStringIterator( "a|b|| c |", '|' )
+// -> On each subsequent invocation of next() would return "a", "b", "", " c ", ""
+class SubStringIterator {
+ typedef std::string::const_iterator SCIter;
+
+ public:
+ SubStringIterator(const std::string& s, char c) :
+ m_position(s.begin()), m_end(s.end()), m_seperator(c), m_done(false) {
+ }
+
+ std::string next() {
+ SCIter begin = m_position;
+ while (m_position != m_end &&
+ *m_position != m_seperator) {
+ ++m_position;
+ }
+
+ const std::string ret(begin, m_position);
+ if (m_position == m_end) {
+ m_done = true;
+ } else {
+ ++m_position;
+ }
+
+ return ret;
+ }
+ bool done() const {
+ return m_done;
+ }
+
+ private:
+ SCIter m_position;
+ const SCIter m_end;
+ const char m_seperator;
+ bool m_done;
+};
+
+template<class Iter>
+static
+Iter skipPrecedingWS(Iter begin, Iter end) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return std::find_if(begin, end,
+ std::not1(std::ptr_fun((int (*)(int))std::isspace)));
+}
+
+// remove only preceding and trailing whitespace, but leave intermediate whitespace characters alone
+std::string strip(const std::string& str) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::string::const_iterator skipTo = skipPrecedingWS(str.begin(), str.end());
+ if (skipTo == str.end()) { // if string consists of ONLY whitespace
+ return std::string("");
+ } else {
+ return std::string(skipTo, skipPrecedingWS(str.rbegin(), str.rend()).base());
+ }
+}
+// LCOV_EXCL_STOP
+
+BOOL SysMgrConfiguration::LoadParametersCfg(GroupLaunchMap& groups_map,
+ ProcessNameMap& f_processNameMap, LaunchOrderedVector& f_OrderList,
+ SS_String& f_launchOrderName, SS_String& f_launchCfgFn) {
+ BOOL rtn_code = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_pReaderCfg = new (std::nothrow) CNSConfigReader(f_launchCfgFn); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (NULL != l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5:new error
+ UI_32 launch_idx = 1;
+ CHAR key[128];
+ std::sprintf(key, "ModulesLaunchConfig.Launch%d", launch_idx); // NOLINT
+ SS_String value = l_pReaderCfg->GetString(key);
+
+ if (value.empty()) { // LCOV_EXCL_BR_LINE 200:cannot be empty
+// LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: l_pReaderCfg->GetString(%s) returned empty-string; "
+ "is launch configuration file mis-configured ?",
+ key);
+ rtn_code = FALSE;
+// LCOV_EXCL_STOP
+ } else {
+ const char* nfsenv = getenv("AGL_NFS");
+ bool isNfs = (nfsenv && strcmp(nfsenv, "y") == 0) ? true : false; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ std::list<std::string> capFiles;
+ if (isNfs) {
+// LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const std::string capPath("/usr/debug/share/target/cap.lst");
+ std::ifstream fin(capPath.c_str());
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ std::list<std::string> strList;
+ boost::split(strList, line, boost::is_any_of("|"));
+ if (!strList.empty()) {
+ if (strList.front()[0] == '/') { // Only character strings beginning with '/' are considered PATH
+ capFiles.push_back(strList.front().c_str());
+ }
+ }
+ }
+ }
+// LCOV_EXCL_STOP
+ while (!value.empty()) {
+ CHAR critical[10] = { };
+ CHAR is_start_required[10] = { };
+ CHAR shutdown_critical[10] = { };
+ CHAR group_wait_for_trigger[10] = { };
+ CHAR is_agl_unit[10] = { };
+ CHAR disable_agl_resethistory[10] = { };
+ CHAR disable_nonagl_resethistory[10] = { };
+ CfgLaunchParams cfg_data;
+
+ int at = static_cast<int>(ss_sm_cfg::cfg_args::group_name);
+
+ SubStringIterator iter(value, '|');
+ while (!iter.done() && ss_sm_cfg::cfg_args::END != at) {
+ const std::string data_ = iter.next();
+ if (!data_.empty()) {
+ const char* data = data_.c_str();
+ switch (at) {
+ case ss_sm_cfg::cfg_args::group_name:
+ snprintf(cfg_data.group_name,
+ sizeof(cfg_data.group_name), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::group_id:
+ cfg_data.group_id = static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::group_launch_wait:
+ cfg_data.group_launch_wait =
+ static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::group_wait_for_trigger:
+ snprintf(group_wait_for_trigger,
+ sizeof(group_wait_for_trigger), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::name:
+ snprintf(cfg_data.name, sizeof(cfg_data.name), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::binary_name:
+ snprintf(cfg_data.binary_name,
+ sizeof(cfg_data.binary_name), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::priority:
+ cfg_data.priority = static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::critical:
+ snprintf(critical, sizeof(critical), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::retry_cnt:
+ cfg_data.retry_cnt = static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::arguments:
+ strncpy(cfg_data.arguments, data,
+ sizeof(cfg_data.arguments) - 1);
+ break;
+ case ss_sm_cfg::cfg_args::logging_msk:
+ snprintf(cfg_data.logging_msk_str,
+ sizeof(cfg_data.logging_msk_str), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::restart:
+ snprintf(cfg_data.restart, sizeof(cfg_data.restart), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::is_start_required:
+ snprintf(is_start_required,
+ sizeof(is_start_required), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::shutdown_critical:
+ snprintf(shutdown_critical,
+ sizeof(shutdown_critical), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::shutdown_wait_time:
+ cfg_data.shutdown_wait_time =
+ static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::fast_shutdown_wait_time:
+ cfg_data.fast_shutdown_wait_time =
+ static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::unix_user_name:
+ strncpy(&cfg_data.unix_user_name[0],
+ strip(data_).c_str(),
+ sizeof(cfg_data.unix_user_name) - 1);
+ break;
+ case ss_sm_cfg::cfg_args::is_agl_unit:
+ strncpy(is_agl_unit, data, sizeof(is_agl_unit));
+ break;
+ case ss_sm_cfg::cfg_args::disable_agl_resethistory:
+ strncpy(disable_agl_resethistory, data, sizeof(disable_agl_resethistory));
+ break;
+ case ss_sm_cfg::cfg_args::disable_nonagl_resethistory:
+ strncpy(disable_nonagl_resethistory, data, sizeof(disable_nonagl_resethistory));
+ break;
+ case ss_sm_cfg::cfg_args::env_value_condition: // LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ snprintf(cfg_data.env_value_condition,
+ sizeof(cfg_data.env_value_condition), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::cpu_assign:
+ cfg_data.cpu_assign =
+ static_cast<int>(strtoul(data, NULL, 16));
+ break;
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: unknown ss_sm_cfg::cfg_args::xxx/'at' "
+ "enum value '%d'", at);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+ ++at;
+ }
+ ////////////////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_BR_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ if (0 != std::strlen(cfg_data.env_value_condition)
+ && FALSE
+ == is_satisfy_env_launch_cond(
+// LCOV_EXCL_BR_STOP
+ cfg_data.env_value_condition)) { // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "exclude %s from wakeup service", cfg_data.name);
+ } else {
+ if (isNfs) { // LCOV_EXCL_BR_LINE 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ // Since the NFS environment is used by copying the executable file containing the CAP to /tmp, it is read out.
+// LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::string binPath(cfg_data.binary_name);
+ for (std::list<std::string>::iterator ite =
+ capFiles.begin(); ite != capFiles.end(); ite++) {
+ if (binPath == *ite) {
+ std::list<std::string> nodes;
+ boost::split(nodes, binPath, boost::is_any_of("/"));
+ std::string newPath("/tmp/");
+ newPath += nodes.back();
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "EXCHG %s", newPath.c_str());
+ snprintf(cfg_data.binary_name,
+ sizeof(cfg_data.binary_name), "%s", newPath.c_str());
+ break;
+ }
+ }
+ }
+// LCOV_EXCL_STOP
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "is_start_required: %s", is_start_required);
+ cfg_data.is_start_required = (std::strcmp("True",
+ is_start_required) == 0);
+
+ if (std::strcmp("True", group_wait_for_trigger) == 0) {
+ cfg_data.group_wait_for_trigger = TRUE;
+ } else {
+ cfg_data.group_wait_for_trigger = FALSE;
+ }
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "critical: %s", critical);
+ cfg_data.critical = (std::strcmp("True", critical) == 0);
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown_critical: %s", shutdown_critical);
+ cfg_data.shutdown_critical = (std::strcmp("True",
+ shutdown_critical) == 0);
+
+ cfg_data.SetAGLUnit(ParseBoolParameter(is_agl_unit, TRUE));
+ cfg_data.SetAGLResetHistoryDisable(ParseBoolParameter(disable_agl_resethistory));
+ cfg_data.SetNonAGLResetHisoryDisable(ParseBoolParameter(disable_nonagl_resethistory));
+
+ GroupLaunchInfo grp_info;
+ grp_info.start_complete = FALSE;
+ grp_info.stop_complete = FALSE;
+ grp_info.launch_complete = FALSE;
+ grp_info.name = cfg_data.group_name;
+ grp_info.id = cfg_data.group_id;
+ grp_info.grp_launch_wait = cfg_data.group_launch_wait;
+ grp_info.grp_wait_for_trigger =
+ cfg_data.group_wait_for_trigger;
+ ModuleLaunchListIter l_moduleLaunchListIter;
+
+ GroupLaunchMapIter grp_iter = groups_map.find(grp_info.id);
+ if (grp_iter != groups_map.end()) {
+ l_moduleLaunchListIter = set_cfg_grp_member_info(
+ cfg_data, grp_iter->second.modules);
+ } else {
+ l_moduleLaunchListIter = set_cfg_grp_member_info(
+ cfg_data, grp_info.modules);
+
+ // add this grp info object to the list of grps
+ groups_map.insert(make_pair(grp_info.id, grp_info));
+ }
+
+ std::string l_binaryNameStr = cfg_data.binary_name;
+ size_t l_binaryNamePos = l_binaryNameStr.find_last_of("/");
+ if (std::string::npos != l_binaryNamePos) {
+ l_binaryNameStr = l_binaryNameStr.substr(l_binaryNamePos + 1);
+ f_processNameMap.insert(
+ make_pair(l_binaryNameStr, l_moduleLaunchListIter));
+ }
+ }
+
+ std::sprintf(key, "ModulesLaunchConfig.Launch%d", ++launch_idx); // NOLINT
+ value = l_pReaderCfg->GetString(key);
+ } // end while
+ }
+ } else { // LCOV_EXCL_START 6: Because new doesn't pass the failure case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // defaults use from the header file ... this is much faster then reading from an xml file.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: \"new CNSConfigReader(%s)\" returned NULL; using "
+ "constants.", f_launchCfgFn.c_str());
+ UI_32 num_of_items = static_cast<UI_32>(_countof(g_arrLaunchTableCfg));
+ for (UI_32 arr_idx = 0; arr_idx < num_of_items; arr_idx++) {
+ GroupLaunchInfo grp_info;
+ grp_info.launch_complete = FALSE;
+ grp_info.name = g_arrLaunchTableCfg[arr_idx].group_name;
+ grp_info.id = g_arrLaunchTableCfg[arr_idx].group_id;
+ grp_info.grp_launch_wait =
+ g_arrLaunchTableCfg[arr_idx].group_launch_wait;
+
+ GroupLaunchMapIter grp_iter = groups_map.find(grp_info.id);
+
+ if (grp_iter != groups_map.end()) {
+ set_grp_member_info(g_arrLaunchTableCfg[arr_idx],
+ grp_iter->second.modules);
+ } else {
+ set_grp_member_info(g_arrLaunchTableCfg[arr_idx],
+ grp_info.modules);
+ // add this grp info object to the list of grps
+ groups_map.insert(make_pair(grp_info.id, grp_info));
+ }
+ }
+ }
+ // LCOV_EXCL_STOP
+ if (rtn_code == TRUE) {
+ load_parameters_order_cfg(groups_map, f_OrderList, f_launchOrderName, f_launchCfgFn);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return rtn_code;
+}
+
+VOID SysMgrConfiguration::PrintGroupInfo(GroupLaunchInfo& refGrpInfo) {
+ std::stringstream l_logMsg;
+
+ l_logMsg << endl << "Group: " << refGrpInfo.name.data() << endl
+ << " id: " << refGrpInfo.id << endl << " wait-time: "
+ << refGrpInfo.grp_launch_wait << endl << " launch complete: "
+ << (refGrpInfo.launch_complete == TRUE ? "YES" : "NO"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ std::string l_logStr = l_logMsg.str();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str());
+}
+
+VOID SysMgrConfiguration::PrintModuleInfo(ModuleLaunchParams& refMbrInfo) {
+ std::stringstream l_logMsg;
+
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_logMsg << endl << "Module: " << refMbrInfo.name.data() << endl
+ << " path: " << refMbrInfo.path.data() << endl << " args: "
+ << refMbrInfo.arguments.data() << endl << " restart: "
+ << refMbrInfo.restart.data() << endl
+ << " configuration_priority: "
+ << refMbrInfo.configuration_priority << endl
+ << " cpu_assign: "
+ << refMbrInfo.cpu_assign << endl
+ << " current_priority: " << refMbrInfo.current_priority << endl
+ << " previous_priority: " << refMbrInfo.previous_priority << endl
+ << " critical: " << (refMbrInfo.critical == TRUE ? "YES" : "NO")
+ << endl
+ << " retry count: " << refMbrInfo.retry_cnt << endl
+ << " logging mask: " << refMbrInfo.logging_msk_str << endl
+ << " is_start_required: "
+ << (refMbrInfo.is_start_required == TRUE ? "YES" : "NO")
+ << endl
+ << " shutdown_critical: "
+ << (refMbrInfo.shutdown_critical == TRUE ? "YES" : "NO") << endl
+ << " shutdown_wait_time: " << refMbrInfo.shutdown_wait_time
+ << endl << " fast_shutdown_wait_time: "
+ << refMbrInfo.fast_shutdown_wait_time << endl << " is_agl_unit: "
+ << refMbrInfo.IsAGLUnit() << endl << " disable_agl_resethistory: "
+ << refMbrInfo.IsAGLResetHistoryDisable() << endl << " disable_nonagl_resethistory: "
+ << refMbrInfo.IsNonAGLResetHistoryDisable() << endl << " state: "
+ << refMbrInfo.ModuleStateStr() << endl << " group ID: "
+ << refMbrInfo.group_id << endl << " debug dump state: "
+ << refMbrInfo.GetModuleDebugDumpStateStr();
+ // LCOV_EXCL_BR_STOP
+ std::string l_logStr = l_logMsg.str();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str());
+}
+
+VOID SysMgrConfiguration::PrintAllInfo(GroupLaunchMap& refGrpMap) {
+ // get first client from the map...
+ GroupLaunchMapIter grp_iter = refGrpMap.begin();
+
+ for (; grp_iter != refGrpMap.end(); grp_iter++) {
+ PrintGroupInfo(grp_iter->second);
+ ModuleLaunchListIter mbr_iter = grp_iter->second.modules.begin();
+ for (; mbr_iter != grp_iter->second.modules.end(); mbr_iter++) {
+ PrintModuleInfo(*mbr_iter);
+ }
+ }
+}
+
+BOOL SysMgrConfiguration::ParseBoolParameter(PCSTR f_value, BOOL f_default) const {
+ if (FALSE == f_default) {
+ const char TRUE_VALUE[] = "True";
+ if (0 == strcmp(TRUE_VALUE, f_value)) {
+ return TRUE;
+ }
+ } else {
+ const char FALSE_VALUE[] = "False";
+ if (0 == strcmp(FALSE_VALUE, f_value)) {
+ return FALSE;
+ }
+ }
+ return f_default;
+}
+
+/*
+ * SM Configuration data constructor
+ */
+SMConfigParams::SMConfigParams() {
+}
+
+/*
+ * SM Configuration data destructor
+ */
+SMConfigParams::~SMConfigParams() {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// PrintConfigInfo
+/// \brief Print the configuration data stored in config structure
+///
+/// \param [in] configata
+/// ConfigurationData & - Ref to structure that get populated.
+///
+/// \return VOID
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID SMConfigParams::PrintConfigInfo(ConfigurationData const & f_ConfigParams) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppHeartBeatInterval_Initial Info: %d",
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalInitial);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppHeartBeatInterval_Repeat Info: %d",
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalRepeat);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "HBMaxHeartBeatRetryCount Info: %d",
+ f_ConfigParams.HBConfig.MaxHeartBeatRetryCount);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CDEnabled: %d",
+ f_ConfigParams.CDConfig.CrashDetectorEnabled);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMTimerValue: %d",
+ f_ConfigParams.SLMConfig.SLMTimerValue);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMMaxRetryCount: %d",
+ f_ConfigParams.SLMConfig.SLMMaxRetryCount);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMThresholdValue: %d",
+ f_ConfigParams.SLMConfig.SLMThresholdValue);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMSystemmanagerLogIntervalMs: %d",
+ f_ConfigParams.SLMConfig.SLMSystemmanagerLogIntervalMs);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "UserModeStructIsBoolean: %s",
+ GetStr(f_ConfigParams.UMConfig.IsUserModeNotificationABOOL).c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ModuleConnectionNumTimesToCheck: %d",
+ f_ConfigParams.MCConfig.ModuleConnectionNumTimesToCheck);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ModuleConnectionTimeOutSec: %d",
+ f_ConfigParams.MCConfig.ModuleConnectionTimeOutSec);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ModuleStartRespTimeOutSec: %d",
+ f_ConfigParams.MCConfig.ModuleStartRespTimeOutSec);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CriticalAppsMaxShutdownTimeFastSleep: %d",
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeFastSleep);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "CriticalAppsMaxShutdownTimeNormalReset: %d",
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeNormalReset);
+ return;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSMConfigInformation
+/// \brief Read config data from cfg file and populate the configuration data structure
+///
+/// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
+/// \param [in] f_FileName - Configuration file name.
+///
+/// \return BOOL
+/// BOOL - TRUE or FALSE
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL SMConfigParams::GetSMConfigInformation(ConfigurationData& f_ConfigParams, SS_String f_FileName) {
+ EFrameworkunifiedStatus l_eStatus;
+ BOOL l_rtnCode = FALSE; // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ CNSConfigReader *l_pReaderCfg = new (std::nothrow) CNSConfigReader(); // LCOV_EXCL_BR_LINE 10: As new does not fail
+// LCOV_EXCL_BR_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ if (NULL == l_pReaderCfg) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. new CNSConfigReader() returned NULL pointer.");
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(f_FileName))) {
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->Open(%s) returned NULL pointer.",
+ f_FileName.c_str());
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Heartbeat.MaxHeartBeatRetryCount",
+ f_ConfigParams.HBConfig.MaxHeartBeatRetryCount))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Heartbeat.MaxHeartBeatRetryCount')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Heartbeat.AppHeartBeatIntervalInitial",
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalInitial))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Heartbeat.AppHeartBeatIntervalInitial')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Heartbeat.AppHeartBeatIntervalRepeat",
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalRepeat))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Heartbeat.AppHeartBeatIntervalRepeat')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetBool("CrashDetector.Enabled",
+ f_ConfigParams.CDConfig.CrashDetectorEnabled))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetBool('CrashDetector.Enabled')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt("SysLowMemory.TimerValue",
+ f_ConfigParams.SLMConfig.SLMTimerValue))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('SysLowMemory.TimerValue')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "SysLowMemory.MaxRetryCount",
+ f_ConfigParams.SLMConfig.SLMMaxRetryCount))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('SysLowMemory.MaxRetryCount')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "SysLowMemory.ThresholdValue",
+ f_ConfigParams.SLMConfig.SLMThresholdValue))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('SysLowMemory.ThresholdValue')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "SysLowMemory.InterfaceunifiedLogIntervalMs",
+ f_ConfigParams.SLMConfig.SLMSystemmanagerLogIntervalMs))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('SysLowMemory.InterfaceunifiedLogIntervalMs')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetBool(
+ "UserModeNotification.IsBoolean",
+ f_ConfigParams.UMConfig.IsUserModeNotificationABOOL))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetBool('UserModeNotification.IsBoolean')");
+ f_ConfigParams.UMConfig.IsUserModeNotificationABOOL = TRUE;
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Module.ModuleConnectionNumTimesToCheck",
+ f_ConfigParams.MCConfig.ModuleConnectionNumTimesToCheck))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Module.ModuleConnectionNumTimesToCheck')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Module.ModuleConnectionTimeOutSec",
+ f_ConfigParams.MCConfig.ModuleConnectionTimeOutSec))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Module.ModuleConnectionTimeOutSec')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Module.ModuleStartRespTimeOutSec",
+ f_ConfigParams.MCConfig.ModuleStartRespTimeOutSec))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Module.ModuleStartRespTimeOutSec')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "CriticalApps.CriticalAppsMaxShutdownTimeFastSleep",
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeFastSleep))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('CriticalApps.CriticalAppsMaxShutdownTimeFastSleep')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "CriticalApps.CriticalAppsMaxShutdownTimeNormalReset",
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeNormalReset))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('CriticalApps.CriticalAppsMaxShutdownTimeNormalReset')");
+ } else {
+ l_rtnCode = TRUE;
+ }
+
+ delete l_pReaderCfg; // LCOV_EXCL_BR_LINE 10: As the delete does not fail
+ }
+// LCOV_EXCL_BR_STOP
+
+ return (l_rtnCode);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// LoadSMConfigParameters
+/// \brief Read System Manager configuration parameters from cfg file or
+/// use defaults values in case cfg file is not available
+///
+/// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
+/// \param [in] f_FileName - Configuration file name.
+///
+/// \return BOOL
+/// BOOL - TRUE or FALSE
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL SMConfigParams::LoadSMConfigParameters(ConfigurationData& f_ConfigParams, SS_String f_FileName) {
+ BOOL rtn_code = TRUE;
+
+ rtn_code = GetSMConfigInformation(f_ConfigParams, f_FileName);
+
+ // cfg config file not found, use constants
+ if (FALSE == rtn_code) {
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: cfg config file not open, using constants");
+
+ // Heart Beat constants
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalInitial =
+ HBApplicationHeartBeatIntervalInitial;
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalRepeat =
+ HBApplicationHeartBeatIntervalRepeat;
+ f_ConfigParams.HBConfig.MaxHeartBeatRetryCount = HBMaxHeartBeatRetryCount;
+
+ // Crash Detector constants
+ f_ConfigParams.CDConfig.CrashDetectorEnabled = CDEnabled;
+
+ // System Low Memory
+ f_ConfigParams.SLMConfig.SLMTimerValue = SLMTimerValue;
+ f_ConfigParams.SLMConfig.SLMMaxRetryCount = SLMRetryCount;
+ f_ConfigParams.SLMConfig.SLMThresholdValue = SLMThresholdValue;
+ f_ConfigParams.SLMConfig.SLMSystemmanagerLogIntervalMs = SLMSystemmanagerLogIntervalMs;
+
+ // Module connect and start resp
+ f_ConfigParams.MCConfig.ModuleConnectionNumTimesToCheck =
+ ModuleConnectionNumTimesToCheck;
+ f_ConfigParams.MCConfig.ModuleConnectionTimeOutSec =
+ ModuleConnectionTimeOutSec;
+ f_ConfigParams.MCConfig.ModuleStartRespTimeOutSec = ModuleStartRespTimeOutSec;
+
+ // Critical Apps shutdown time
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeFastSleep =
+ CriticalAppsMaxShutdownTimeFastSleepSec;
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeNormalReset =
+ CriticalAppsMaxShutdownTimeNormalResetSec;
+
+ // USer Mode Data Structure Type
+ f_ConfigParams.UMConfig.IsUserModeNotificationABOOL = TRUE;
+ // LCOV_EXCL_STOP
+ }
+ PrintConfigInfo(f_ConfigParams);
+
+ return rtn_code;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/systemservice/system_manager/server/src/ss_sm_dynamic_launcher.cpp b/systemservice/system_manager/server/src/ss_sm_dynamic_launcher.cpp
new file mode 100755
index 0000000..6144fa4
--- /dev/null
+++ b/systemservice/system_manager/server/src/ss_sm_dynamic_launcher.cpp
@@ -0,0 +1,221 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <string>
+#include <sstream>
+#include <iomanip>
+
+#include "ss_sm_dynamic_launch_table.h"
+#include "ss_sm_systemmanagerlog.h"
+
+DynamicLaunchBase::DynamicLaunchBase():
+m_vOrderedGroup(),
+m_iterOrderedGroup() {
+}
+
+
+DynamicLaunchBase::~DynamicLaunchBase() {
+}
+
+UI_32 DynamicLaunchBase::get_id() const {
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DLB: Active Group ID is %d", *m_iterOrderedGroup);
+ return *m_iterOrderedGroup;
+}
+
+UI_32 DynamicLaunchBase::advance_id() {
+ if (!is_end()) {
+ m_iterOrderedGroup++;
+ }
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DLB: Active Group ID is %d", *m_iterOrderedGroup);
+ return *m_iterOrderedGroup;
+}
+
+UI_32 DynamicLaunchBase::decrement_id() {
+ if (!is_begin()) { // LCOV_EXCL_BR_LINE 5: stdlib error case.
+ m_iterOrderedGroup--;
+ }
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DLB: Active Group ID is %d", *m_iterOrderedGroup);
+ return *m_iterOrderedGroup;
+}
+
+BOOL DynamicLaunchBase::is_begin() {
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DLB: Active Group ID is %d", *m_iterOrderedGroup);
+ return (m_iterOrderedGroup == m_vOrderedGroup.begin());
+}
+
+BOOL DynamicLaunchBase::is_end() {
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DLB: Active Group ID is %d", *m_iterOrderedGroup);
+ DynamicOrderedIter l_it = m_iterOrderedGroup;
+ l_it++;
+ return (l_it == m_vOrderedGroup.end());
+}
+
+VOID DynamicLaunchBase::to_begin() {
+ m_iterOrderedGroup = m_vOrderedGroup.begin();
+ return;
+}
+
+VOID DynamicLaunchBase::to_end() {
+ m_iterOrderedGroup = m_vOrderedGroup.end();
+ m_iterOrderedGroup--;
+ return;
+}
+
+VOID DynamicLaunchBase::print_info() {
+ UI_32 idx = 1;
+ std::stringstream l_logMsg;
+ DynamicOrderedIter l_dyn_iter = m_vOrderedGroup.begin();
+ for (; l_dyn_iter != m_vOrderedGroup.end(); l_dyn_iter++) {
+ l_logMsg << std::endl << "Index: " << std::setw(2) << idx
+ << " Group Id: " << std::setw(2) << *l_dyn_iter;
+
+ idx++;
+ }
+
+ std::string l_logStr = l_logMsg.str();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str());
+}
+
+DynamicLauncher::DynamicLauncher() :DynamicLaunchBase(),
+m_nLaunchGroupId(0),
+m_nLaunchBeforeGroupId(0),
+m_nLaunchAfterGroupId(0),
+m_nAviageTriggerId(0),
+m_bDynamicLaunchEnabled(FALSE), // by default until set by some one will this be disabled.
+m_eSourceType(SS_SOURCE_NA) { // invalid
+}
+
+DynamicLauncher::~DynamicLauncher() {
+}
+
+BOOL DynamicLauncher::dynamic_launch_enabled() const { // LCOV_EXCL_START 8: Dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_bDynamicLaunchEnabled;
+}
+// LCOV_EXCL_STOP
+
+VOID DynamicLauncher::configure_dynamic_launch(const SS_SOURCE& source_type,
+ GroupLaunchMap& group_info, LaunchOrderedVector& order_info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_eSourceType = source_type;
+ // "Dynamic Launch" is not used due to high dependency on a service table
+ create_normal_launch_vector(group_info, order_info);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+BOOL DynamicLauncher::is_inGroupLaunchMap(UI_32& id,
+ GroupLaunchMap& group_info) { // LCOV_EXCL_START 8: Dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL Ret = FALSE;
+ GroupLaunchMapIter l_grp_iter = group_info.find(id);
+ if (l_grp_iter != group_info.end()) {
+ Ret = TRUE;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return Ret;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: Dead code
+DynamicLaunchInfo* DynamicLauncher::get_dynamic_source_info(
+ const SS_SOURCE& source_type, BOOL& source_trigger,
+ BOOL& is_aviage_required) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ UI_32 num_of_items = static_cast<UI_32>(_countof(g_arrDynamicLaunchTableCfg));
+ DynamicLaunchInfo * point_to_this = NULL;
+ for (UI_32 arr_idx = 0; arr_idx < num_of_items; arr_idx++) {
+ if (g_arrDynamicLaunchTableCfg[arr_idx].source == source_type) {
+ source_trigger = g_arrDynamicLaunchTableCfg[arr_idx].group_trigger;
+ point_to_this = &g_arrDynamicLaunchTableCfg[arr_idx];
+ if ((SS_SOURCE_FM == source_type) || (SS_SOURCE_AM == source_type)
+ || (SS_SOURCE_FM_DAB == source_type)
+ || (SS_SOURCE_SDARS == source_type)) {
+ is_aviage_required = FALSE;
+ }
+ break;
+ }
+ }
+
+ return point_to_this;
+}
+// LCOV_EXCL_STOP
+
+UI_32 DynamicLauncher::get_id_using_group_name(PCSTR group_name,
+ GroupLaunchMap& group_info) { // LCOV_EXCL_START 8: Dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ GroupLaunchMapIter l_grp_iter = group_info.begin();
+ UI_32 rtn_grp_id = 0;
+ for (; l_grp_iter != group_info.end(); l_grp_iter++) {
+ if (0 == strcmp(group_name, l_grp_iter->second.name.c_str())) {
+ rtn_grp_id = l_grp_iter->second.id;
+ break;
+ }
+ }
+
+ return rtn_grp_id;
+}
+// LCOV_EXCL_STOP
+
+VOID DynamicLauncher::create_normal_launch_vector(GroupLaunchMap& group_info,
+ LaunchOrderedVector& order_info) {
+ m_vOrderedGroup.clear();
+
+ if (order_info.size() != 0) { // LCOV_EXCL_BR_LINE 6: To initialize conditions for launching SystemManager
+ // LCOV_EXCL_START 6: To initialize conditions for launching SystemManager
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LaunchOrderedIter l_ord_iter = order_info.begin();
+ while (l_ord_iter != order_info.end()) {
+ if (is_inGroupLaunchMap(*l_ord_iter, group_info) == TRUE) {
+ m_vOrderedGroup.push_back(*l_ord_iter);
+ }
+ l_ord_iter++;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ GroupLaunchMapIter l_grp_iter = group_info.begin();
+ while (l_grp_iter != group_info.end()) {
+ m_vOrderedGroup.push_back(l_grp_iter->second.id);
+ l_grp_iter++;
+ }
+ }
+ m_iterOrderedGroup = m_vOrderedGroup.begin();
+ m_bDynamicLaunchEnabled = TRUE;
+ print_info();
+}
+
+VOID DynamicLauncher::copyDynOrderedVector(DynamicModuleStart& Start) {
+ Start.setGroupVector(this->m_vOrderedGroup);
+}
+
+// DynamicModuleStart
+
+DynamicModuleStart::DynamicModuleStart() :DynamicLaunchBase() {
+}
+
+DynamicModuleStart::~DynamicModuleStart() {
+}
+
+VOID DynamicModuleStart::setGroupVector(DynamicOrderedVector& Vector) {
+ m_vOrderedGroup.assign(Vector.begin(), Vector.end());
+ m_iterOrderedGroup = m_vOrderedGroup.begin();
+} // LCOV_EXCL_BR_LINE 10: Final line
diff --git a/systemservice/system_manager/server/src/ss_sm_version.cpp b/systemservice/system_manager/server/src/ss_sm_version.cpp
new file mode 100755
index 0000000..9df970f
--- /dev/null
+++ b/systemservice/system_manager/server/src/ss_sm_version.cpp
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for module version management.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <system_service/ss_package.h>
+#include <system_service/ss_ver.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <fstream>
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_version.h"
+
+using namespace std; // NOLINT
+
+CSMVersion::CSMVersion() {
+}
+
+CSMVersion::~CSMVersion() {
+}
+
+EFrameworkunifiedStatus CSMVersion::get_version(SS_VersionNumberType& f_VersionNumber) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CSSVer ver;
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ f_VersionNumber = 0;
+
+ SSVER_PkgInfo info;
+ l_eStatus = ver.getPkgInfo(SS_PKG_MAIN_EMMC, &info);
+ if (l_eStatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 6: To initialize conditions for launching SystemManager
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ f_VersionNumber = strtoull(info.version, NULL, 10); // LCOV_EXCL_LINE 6: To initialize conditions for launching SystemManager
+ } else {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSMVersion::get_version(SS_VersionNumberType &f_VersionNumber)
+
+EFrameworkunifiedStatus CSMVersion::get_build_info(std::string& f_buildInfoStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string build_info_str;
+ CSSVer ver;
+ SSVER_PkgInfo info;
+ l_eStatus = ver.getPkgInfo(SS_PKG_MAIN_PRODUCT_SI, &info);
+ if (l_eStatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 6: To initialize conditions for launching SystemManager
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ build_info_str += info.version; // LCOV_EXCL_LINE 6: To initialize conditions for launching SystemManager
+ } else {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ f_buildInfoStr = build_info_str;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // LCOV_EXCL_BR_LINE 10: Final line End of EFrameworkunifiedStatus CSMVersion::get_build_info(SS_String &f_buildInfoStr)
+// EOF /SS_SystemManager/src/ss_sm_version.cpp
diff --git a/systemservice/system_manager/server/src/ss_system_manager.cpp b/systemservice/system_manager/server/src/ss_system_manager.cpp
new file mode 100755
index 0000000..8e26f23
--- /dev/null
+++ b/systemservice/system_manager/server/src/ss_system_manager.cpp
@@ -0,0 +1,3655 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager business logic.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/cl_lock.h>
+#include <native_service/cl_process.h>
+#include <native_service/cl_monitor.h>
+
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_thread_priority.h>
+
+#include <native_service/ns_np_service_nor_persistence.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_backup.h>
+
+#include <heartbeat/ss_hb_if.h>
+
+#include <processlauncher/ProcessLauncher_if.h>
+#include <processlauncher/ss_sm_process_launcher.h>
+#include <processlauncher/ss_sm_process_launcher_protocol.h>
+
+#include <system_service/ss_system_manager_conf.h>
+#include <stub/ss_diag.h>
+
+#include <system_service/ss_client_names.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_power_service_if.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_sm_thread_names.h>
+#include <system_service/ss_sm_thread_names_local.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <system_service/ss_system_manager_notifications_local.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_sm_client_if_local.h>
+#include <system_service/ss_test_clients.h>
+#include <stub/Clock_API.h>
+#include <power_hal.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <sys/resource.h>
+#include <sys/procfs.h>
+#include <sys/timeb.h>
+#include <sys/wait.h>
+#include <inttypes.h>
+#include <libgen.h>
+#include <spawn.h>
+#include <pthread.h>
+#include <linux/oom.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sched.h>
+#include <other_service/itoa.h>
+#include <iomanip>
+#include <fstream>
+#include <string>
+#include <map>
+#include <vector>
+#include "ss_sm_signals.h"
+#include "ss_sm_default_paths.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_version.h"
+#include "ss_system_manager.h"
+using namespace std; // NOLINT
+
+static CSystemManager g_oSystemManger;
+
+#define SS_SM_TEMP_FILE_FOR_STORE_LOGS "/nv/BS/ss/system_manager/rwdata/sm_tempStoreLogs"
+#define TR_USB_PATH "/usr/agl/bin/realtimeUsbLog"
+
+// \brief: public structure that is used for logging by NSLogger.
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+std::string NumberToString(int Number) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::ostringstream ss;
+ ss << Number;
+ return ss.str();
+}
+// LCOV_EXCL_STOP
+
+/* Check if "Mount Point" exsists as Directory */
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: No Argument Constructor.
+ @note: .
+ @param void
+ @return void
+ */
+/*****************************************************************************/
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus SysMgrCallback(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ C * pObj = static_cast<C *>(&g_oSystemManger);
+ if (pObj) {
+ l_eStatus = (pObj->*M)(hApp);
+ }
+ return l_eStatus;
+}
+
+//**************************************************************************
+// System Manager State String Map *
+// *
+void Init_SS_SMModuleState_StrMap(std::map<SS_SMModuleState, SS_String> & m_strMap) { // NOLINT
+ MAP_ENTRY(m_strMap, SS_SM_READY_TO_LAUNCH_APP);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_LAUNCH_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_LAUNCHED_READY_TO_START);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_START_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_START_COMPLETE);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_STOPPING_AT__CWORD56__REQ);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_STOPPING_AT_INTERNAL_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ);
+ MAP_ENTRY(m_strMap, SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_PRE_START_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_PRE_STOP_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_PRE_RUN_COMPLETE);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_BACKGROUND_START_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_BACKGROUND_RUN_COMPLETE);
+} // End of void Init_SS_SMModuleState_StrMap(std::map<SS_SMModuleState,
+
+class EnumStringMap<SS_SMModuleState, Init_SS_SMModuleState_StrMap>
+ m_oSS_SMModuleStateStrMap;
+SS_String GetStr(SS_SMModuleState f_enum) {
+ return m_oSS_SMModuleStateStrMap.GetStr(f_enum); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+} // End of SS_String :GetStr(SS_SMModuleState f_enum)
+// *
+// End of System Manager State String Map *
+//**************************************************************************
+
+std::string CSystemManager::m_bootOpt; // NOLINT
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: No Argument Constructor.
+ @note: .
+ @param void
+ @return void
+ */
+/*****************************************************************************/
+CSystemManager & CSystemManager::GetInstance() {
+ return g_oSystemManger;
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: No Argument Constructor.
+ @note: .
+ @param void
+ @return void
+ */
+/*****************************************************************************/
+CSystemManager::CSystemManager() :
+ m_hHeartbeatThread(INVALID_HANDLE, eSM_ThreadNotExist),
+ m_hProcLauncherThread(INVALID_HANDLE, eSM_ThreadNotExist),
+ m_SystemLaunchProgress(SS_SM_INITIAL_GROUP),
+ m_GroupLaunchTimer(NULL),
+ m_GroupRelaunchCount(0),
+ m_GroupRelaunchLimit(0),
+ m_hPowerServiceSession(NULL),
+ m_ActiveGroupId(SS_SM_INITIAL_GROUP),
+ m_StartUpReason(epswfINVALID),
+ m_DataResetMode(e_SS_SM_DATA_RESET_MODE_NONE),
+ m_ProgUpdateState(SS_SM_PROG_UPDATE_STATE_NONE),
+ m_NextWakeupType(e_SS_SM_NEXT_WAKEUP_TYPE_NONE),
+ m_DramBackupStatus(e_SS_SM_DRAM_BACKUP_NG),
+ m_isIlgReset(FALSE),
+ m_ResetStatus(e_SS_SM_RESET_STATUS_NONE),
+ m_ResetCount(0),
+ m_SMCurrentState(SS_SM_READY_TO_LAUNCH_APP),
+
+ m_MaxShutdownTime(0),
+ m_NbrDebugDumpRspnRecv(0),
+ m_isRcvModeInfo(FALSE),
+ m_BinaryFilesPath(""),
+ m_ConfigFilesPath(""),
+ m_pfStopCompleteHandler(
+ SysMgrCallback<CSystemManager, &CSystemManager::send_shutdown_complete_response>),
+ m_VersionNumberStruct(0, eFrameworkunifiedStatusErrOther),
+ m_BuildInfoStr(""),
+ m_isRstPending(FALSE),
+ m_rstPendingInfo(),
+ m_UsingVMPlayer(FALSE),
+ NVM_VALID_SIGNATURE(0xBA5EBA11),
+ m_lastUserMode(epsumON),
+ m_shutdownTrigger(epssdmsdtINVALID),
+ m_isImmediateReset(FALSE),
+ m_isImmResetReq(FALSE),
+ m_needReNotifyStartPrm(FALSE),
+ m_pVarCodeStr(NULL),
+ m_SSLGroupLaunchMapIterator(NULL),
+ m_ModuleLaunchListIter(NULL),
+ m_bIsNPP_ServicesStarted(FALSE),
+ m_bIsBackupAvail(FALSE),
+ m_oSystemLauncher(),
+ m_SystemStarter(),
+ m_NPPStopSent(FALSE),
+ m_userModeChangeReason(epsumcrNOT_AVAILABLE),
+ m__CWORD56_CmdHist(SS_SM__CWORD56__CMD_HIST_SIZE),
+ m_SMCmdHist(SS_SM_CMD_HIST_SIZE),
+ m_TimerCmdHist(SS_SM_TIMER_CMD_HIST_SIZE),
+ m_PubCmdHist(SS_SM_PUB_CMD_HIST_SIZE),
+ m_ErrHist(SS_SM_ERR_HIST_SIZE),
+ m_ClProcessSigFd(-1),
+ m_SysMemMonitor(),
+ m_FreeMemAvailable(0),
+ m_coreFileSizeBytes(0),
+ m_BootMicroResetReason(SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET),
+ m_errorEventQueueLocked(FALSE),
+ m_isPrevErrEventCompleted(TRUE),
+ m_errorEventResult(eFrameworkunifiedStatusOK),
+ m_requestedArtifactId(eArtifactIdInterfaceunifiedDebugLog) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_InitialBoot = true;
+
+ m_ResetFactor = PSM_FACTOR_NONE;
+
+ m_Wake.powerupType = epswsPWRON;
+ m_Wake.up.level = epswlFULLRUN;
+
+ m_SystemModeInfo.lastUserMode = m_lastUserMode;
+ m_SystemModeInfo.limpHomeCutoff = epslhcINVALID;
+ m_SystemModeInfo.productionMode = epspmINVALID;
+ m_SystemModeInfo.transportMode = epstmINVALID;
+ m_SystemModeInfo.systemMode = epssinfINVALID;
+ m_SystemModeInfo.startupStage = epssusfINVALID;
+
+ bzero(&m_SMConfig, sizeof(m_SMConfig));
+ bzero(&m_startUpConfirmationMsg, sizeof(m_startUpConfirmationMsg));
+ bzero(&m_HBReport, sizeof(m_HBReport));
+
+ m__CWORD56_HistIter = m__CWORD56_CmdHist.begin();
+ m_TimerHistIter = m_TimerCmdHist.begin();
+ m_SMHistIter = m_SMCmdHist.begin();
+ m_PubHistIter = m_PubCmdHist.begin();
+ m_ErrHistIter = m_ErrHist.begin();
+
+ ////******************************************************************////
+ //// Initialization of enum<=>enum and enum=>string maps ////
+ //// ////
+
+ //
+ // **** Initialization of powerupType enum maps ****
+ // Map of System Services powerupType to BOOL enum values
+ m_PowerType_to_SSBoolEnumMap[epswsPWRON] = TRUE;
+ m_PowerType_to_SSBoolEnumMap[epswsPWROFF] = FALSE;
+ //
+ // Map of System Services powerupType to System Services User Mode enum values
+ m_PowerType_to_SSUserModeEnumMap[epswsPWRON] = epsumON;
+ m_PowerType_to_SSUserModeEnumMap[epswsPWROFF] = epsumOFF;
+ //
+ // Map of BOOL to System Services powerupType enum values
+ m_SSBool_to_PowerTypeEnumMap[TRUE] = epswsPWRON;
+ m_SSBool_to_PowerTypeEnumMap[FALSE] = epswsPWROFF;
+ //
+ // **** Initialization of User Mode ( aka Last User Mode ) maps ****
+ // Map of BOOL to System Services User Mode enum values
+ m_SSBool_to_SSUserModeEnumMap[FALSE] = epsumOFF;
+ m_SSBool_to_SSUserModeEnumMap[TRUE] = epsumON;
+ //
+ // Map of BOOL to System Services User Mode enum values
+ m_SSUserMode_to_SSBoolEnumMap[epsumOFF] = FALSE;
+ m_SSUserMode_to_SSBoolEnumMap[epsumON] = TRUE;
+
+ // LCOV_EXCL_BR_STOP
+ //// ////
+ //// End of Initialization of enum<=>enum and enum=>string maps ////
+ ////******************************************************************////
+
+ m_startUpConfirmationMsg.wakeupType = epsstINVALID;
+ m_startUpConfirmationMsg.coldStartRequest = epsscrtINVALID;
+ m_startUpConfirmationMsg.HWVersion = UINT32_MAX;
+ m_startUpConfirmationMsg.matchedHardwareType = UINT32_MAX;
+ m_startUpConfirmationMsg.softwareType = UINT32_MAX;
+ m_startUpConfirmationMsg.imageType = UINT32_MAX;
+ m_startUpConfirmationMsg.majorVersion = UINT32_MAX;
+ m_startUpConfirmationMsg.minorVersion = UINT32_MAX;
+
+ m_SystemManagerPriority = PR_SS_SYSMANAGER;
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: Destructor
+ @note: .
+ @param void
+ @return void
+ */
+/*****************************************************************************/
+CSystemManager::~CSystemManager() { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (NULL != m_pVarCodeStr) {
+ delete[] m_pVarCodeStr; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: Initialize_memory Memory initialization processing
+ @note: .
+ @param
+ @return void
+ */
+/*****************************************************************************/
+void CSystemManager::Initialize_memory(HANDLE hApp, bool* l_isInitFail, EFrameworkunifiedStatus* l_eStatus_work, BOOL isIllReset) {
+ int ret;
+ EFrameworkunifiedStatus l_eStatus;
+
+ /// Start Process for Realtime USB Logging
+ {
+ PreLaunchModuleParams l_rtuparam;
+ l_rtuparam.LaunchFunc = CreateRtUsb;
+ l_rtuparam.relaunchLimit = 1;
+ l_rtuparam.name = "realtimeUsbLog";
+ l_rtuparam.binaryFileName = TR_USB_PATH;
+/* l_rtuparam.pid = CreateRtUsb();
+ if (l_rtuparam.pid == 1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: CreateRtUsb()");
+ } */
+ m_PreLaunchModuleList.push_back(l_rtuparam);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ int fd = open("/dev/urandom", O_RDONLY); // LCOV_EXCL_BR_LINE 5: standard lib error
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 5: standard lib error
+ } else {
+ char buf[4];
+ ret = static_cast<int>(read(fd, buf, 4)); // LCOV_EXCL_BR_LINE 5: standard lib error
+ if (-1 == ret) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 5: standard lib error
+ } else if (4 != ret) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 5: standard lib error
+ } else {
+ fprintf(stderr, "WakeupID:%X%X%X%X\n", buf[0], buf[1], buf[2], buf[3]);
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "WakeupID:%X%X%X%X", buf[0], buf[1], buf[2], buf[3]);
+ }
+ close(fd);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "bootOpt:%s", m_bootOpt.c_str());
+
+ *l_eStatus_work = FrameworkunifiedAttachCallbackToDispatcherWithFd(hApp, m_ClProcessSigFd, // LCOV_EXCL_BR_LINE 4: nsfw error
+ SysMgrCallback<CSystemManager, &CSystemManager::OnProcessTermDetected>);
+
+ if (eFrameworkunifiedStatusOK != *l_eStatus_work) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbackToDispatcherWithFd()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ pthread_mutex_init(&sm_hist_mutex, NULL);
+
+ ReadPathFromEnvironmentVariables();
+ ReadUsingVMPlayerEnvironmentVariable();
+
+ // FIXME : Dump information from power_hal by using
+
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = SetSystemModeInfoStruct())) {
+ LOG_ERROR("SetSystemModeInfoStruct()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ *l_isInitFail = true;
+ }
+
+ // Select configuration file for wakeup services
+ BOOL bIsVupMode = (m_SystemModeInfo.systemMode == epssinfPROGRAMMING) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ T_SS_SM_INIT_HOOK_IN_PARAM inPrm;
+
+ std::memset(&inPrm, 0, sizeof(inPrm));
+ inPrm.bIsVupMode = bIsVupMode;
+
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = ss_sm_initHook(hApp, &inPrm, &m_productCustomPrm))) {
+ SS_ASERT_LOG(0, "ERROR: ss_sm_initHook()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ *l_isInitFail = true;
+ }
+
+ SetEnvVariableForVupMode(bIsVupMode);
+
+ // Get the Version Number
+ // GetVersionNumber() will report any errors
+ m_VersionNumberStruct.m_eSystemmanagerStatus = GetVersionNumber(m_VersionNumberStruct.m_VersionNumber);
+
+ *l_eStatus_work = GetBuildInfo(m_BuildInfoStr);
+ l_eStatus = *l_eStatus_work;
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "GetBuildInfo()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ INTERFACEUNIFIEDLOG_WHEN_COMPILED; // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s priority is %d", SERVICE_SYSMANAGER, m_SystemManagerPriority);
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, " %s was compiled at %s @ %s", __FILE__, __DATE__, __TIME__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, " Host Processor Software Version is '0x%016llX'",
+ m_VersionNumberStruct.m_VersionNumber);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, " Host Processor Build Version is '%s'", m_BuildInfoStr.c_str());
+
+ LogESystemmanagerStatusEnums();
+ LogProtocolIDs();
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: Initialize_callbacks Callback enrollment process
+ @note: .
+ @param
+ @return void
+ */
+/*****************************************************************************/
+void CSystemManager::Initialize_callbacks(HANDLE hApp, bool *l_isInitFail, EFrameworkunifiedStatus *l_eStatus_work) {
+ EFrameworkunifiedStatus l_eStatus;
+
+ m_GroupLaunchTimer = new (std::nothrow) TimerCtrl(eSM_TIMERS_END); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (NULL == m_GroupLaunchTimer) { // LCOV_EXCL_BR_LINE 5: Because new doesn't pass the failure case
+ // LCOV_EXCL_START 5: Because new doesn't pass the failure case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *l_eStatus_work = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("new(std::nothrow)TimerCtrl(eSM_TIMERS_END)");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_GroupLaunchTimer->Initialize(hApp);
+ m_aTimerIDs[eSM_TIMER_GROUP_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnGroupLaunchTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_PROCESS_LAUNCH_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnProcessLaunchTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_HEARTBEAT_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnHeartBeatMonitorTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_PROCESSLAUNCHER_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::OnProcessLaunchMonitorTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_CLIENT_START_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::OnClientStartMonitorTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_NPP_STATUS_CHECK_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::OnNPPStatusCheckMonitorTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER__CWORD56__HEARTBEAT_RESPONSE] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::On_CWORD56_HeartBeatResponseIntervalTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_LAUNCH_GROUP_TRIGGER_PROC_RESP_TIMER] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::OnLaunchGroupTriggerProcessResponseTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_GROUP_LAUNCH_WAIT_TIMER] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnGroupLaunchWaitTimeout>);
+ m_aTimerIDs[eSM_TIMER_MODULE_CONNECT_WAIT_TIMER] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnModuleConnectWaitTimeout>);
+ m_aTimerIDs[eSM_TIMER_START_RESP_MONITOR_WAIT_TIMER] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnStartRespMonitorTimeout>);
+ m_aTimerIDs[eSM_TIMER_SHUTDOWN_COMPLETE_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::OnShutdownCompleteMonitorTimeout>);
+ m_aTimerIDs[eSM_TIMER_CLIENT_STOP_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnClientStopMonitorTimerExpiry>);
+
+ FrameworkunifiedProtocolCallbackHandler l_cbArrayAnySource[] = {
+ // Command ID, Call back functions
+ { SS_SM_PROTOCOL_OPEN_SESSION_REQ, SysMgrCallback<CSystemManager, &CSystemManager::OnOpenSession> },
+ { SS_SM_CPU_RESET_REQ, SysMgrCallback<CSystemManager, &CSystemManager::OnCpuResetRequest> }
+ };
+
+ FrameworkunifiedProtocolCallbackHandler l_cbArrayGroupLaunchService[] = {
+ // Command ID, Call back functions
+ { SS_SM_GROUP_LAUNCH_TRIGGER, SysMgrCallback<CSystemManager, &CSystemManager::OnLaunchGroupTriggerProcessResponse> }
+ };
+
+ FrameworkunifiedProtocolCallbackHandler l_cbArrayNPPService[] = {
+ // Command ID, Call back functions
+ { NPS_NPP_READY_EVENT, SysMgrCallback<CSystemManager, &CSystemManager::OnNPPReadyEventCallback> },
+ { NPS_GET_READYSTATUS_ACK, SysMgrCallback<CSystemManager, &CSystemManager::OnNPPReadyStatusCallback> },
+ { NPS_NPP_STOP_ACK, SysMgrCallback<CSystemManager, &CSystemManager::OnNppStopComplete> }
+ };
+
+ FrameworkunifiedProtocolCallbackHandler l_cbArrayPowerService[] = {
+ // Command ID, Call back functions
+ { SS_SM_POWER_REQUEST_MSG, SysMgrCallback<CSystemManager, &CSystemManager::OnPowerRequestCallback> },
+ { SS_SM_WAKEUP_MODULES, SysMgrCallback<CSystemManager, &CSystemManager::OnWakeupCallback> },
+ { SS_SM_SYSTEM_MODE_INFO_REQ, SysMgrCallback<CSystemManager, &CSystemManager::OnSystemModeInfoRequest> },
+ { SS_SM_INITCOMP_REP, SysMgrCallback<CSystemManager, &CSystemManager::OnInitCompReportCallback> },
+ { SS_SM_SHUTDOWN_MODULES, SysMgrCallback<CSystemManager, &CSystemManager::OnShutdownModulesRequest> },
+ { SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnSetStartupConfirmationDataRequest> }
+ };
+
+ FrameworkunifiedProtocolCallbackHandler l_cbArraySystemManager[] = {
+ // Command ID, Call back functions
+ { SS_SM_SendTriggerToSelf, SysMgrCallback<CSystemManager, &CSystemManager::OnLaunchGroupSelfTrigger> },
+ { SS_SM_DEBUG_DUMP_RSPN, SysMgrCallback<CSystemManager, &CSystemManager::OnDebugDumpResponseReceived> }
+ };
+ // LCOV_EXCL_BR_STOP
+
+#define ATTACH_CBS_TO_DISPATCHER(L_ARRAY, CALLING_SERVICE_NAME) \
+ *l_eStatus_work = l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp, \
+ CALLING_SERVICE_NAME, \
+ L_ARRAY, \
+ static_cast<UI_32>_countof(L_ARRAY)); \
+ if (eFrameworkunifiedStatusOK != l_eStatus) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ " Error: FrameworkunifiedAttachCallbacksToDispatcher(%s) errored: %d/'%s'", \
+ #L_ARRAY, \
+ l_eStatus, \
+ GetStr(l_eStatus).c_str()); \
+ *l_isInitFail = true; \
+ }
+// End of #define ATTACH_CBS_TO_DISPATCHER( CALLING_SERVICE_NAME, L_ARRAY )
+
+ // LCOV_EXCL_BR_START 15: marco defined above
+ // Note: This macro will exit this function if the embedded fnc errors.
+ ATTACH_CBS_TO_DISPATCHER(l_cbArrayAnySource, FRAMEWORKUNIFIED_ANY_SOURCE);
+
+ // Note: This macro will exit this function if the embedded fnc errors.
+ ATTACH_CBS_TO_DISPATCHER(l_cbArrayGroupLaunchService, SS_GROUP_LAUNCH_TRIGGER);
+
+ // Note: This macro will exit this function if the embedded fnc errors.
+ ATTACH_CBS_TO_DISPATCHER(l_cbArrayNPPService, FRAMEWORKUNIFIED_NS_NPSERVICE);
+
+ // Note: This macro will exit this function if the embedded fnc errors.
+ ATTACH_CBS_TO_DISPATCHER(l_cbArrayPowerService, SERVICE_POWER);
+
+ // Note: This macro will exit this function if the embedded fnc errors.
+ ATTACH_CBS_TO_DISPATCHER(l_cbArraySystemManager, SERVICE_SYSMANAGER);
+ // LCOV_EXCL_BR_STOP
+
+ {
+ char pathBuf[128];
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ snprintf(pathBuf, sizeof(pathBuf), "/proc/%d/oom_score_adj", getpid());
+ std::ofstream fo(pathBuf);
+ fo << OOM_SCORE_ADJ_MIN << endl;
+ fo.close();
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "set OOM_SCORE_ADJ_MIN(SS_SysManager/%d)", getpid());
+ }
+
+#undef ATTACH_CBS_TO_DISPATCHER
+
+ // LCOV_EXCL_BR_START 4: nsfw error
+ *l_eStatus_work = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_BackupMgr_Availability,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnBackupMgrAvailCallback>);
+ // LCOV_EXCL_BR_STOP
+ if (eFrameworkunifiedStatusOK != *l_eStatus_work) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSubscribeNotificationWithCallback()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = ErrorEventInit(hApp))) { // LCOV_EXCL_BR_LINE 6: function do not return error
+ // LCOV_EXCL_START 6: function do not return error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ErrorEventInit()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+#ifndef SS_SM_SKIP_HEARTBEAT_INIT
+ // LCOV_EXCL_BR_START 6: function do not return error, expect nsfw error
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = init_Heartbeat(hApp))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: function do not return error, expect nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("init_HeartBeat()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+#else
+#warning Test code - NOT calling init_Heartbeat(hApp)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: NOT calling init_Heartbeat(hApp)");
+#endif
+#undef SS_SM_SKIP_HEARTBEAT_INIT
+
+ // LCOV_EXCL_BR_START 6: function do not return error, expect nsfw error
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = init_process_launcher(hApp))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: function do not return error, expect nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("init_process_launcher()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ // LCOV_EXCL_BR_START 6: function do not return error, expect init error
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = start_process_launching(hApp))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: function do not return error, expect init error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("start_process_launching()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ // LCOV_EXCL_BR_START 6: function do not return error, expect nsfw error
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = init_sysmem_monitor(hApp))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: function do not return error, expect nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("init_sysmem_monitor()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ /// Internal thread monitoring start
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_GroupLaunchTimer->StartTimer(m_aTimerIDs[eSM_TIMER_HEARTBEAT_MONITOR],
+ SS_HEARTBEAT_MONITOR_TIMER_CONFIG, 0,
+ SS_HEARTBEAT_MONITOR_TIMER_CONFIG, 0);
+
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_PROCESSLAUNCHER_MONITOR],
+ SS_PROCESSLAUNCHER_MONITOR_TIMER_CONFIG, 0,
+ SS_PROCESSLAUNCHER_MONITOR_TIMER_CONFIG, 0);
+
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_NPP_STATUS_CHECK_MONITOR],
+ SS_NPP_STATUS_CHECK_MONITOR_TIME_SEC, 0,
+ SS_NPP_STATUS_CHECK_MONITOR_TIME_SEC, 0);
+ // LCOV_EXCL_BR_STOP
+}
+
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: Initialization
+ @note: .
+ @param HANDLE hApp
+ @return void
+ */
+/*****************************************************************************/
+EFrameworkunifiedStatus CSystemManager::Initialize(HANDLE hApp) {
+ bool l_isInitFail = false;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int ret;
+ PsmFactorT l_startup_factor;
+
+ // Need to call Lock System Initialize API once in the system
+ ret = CL_LockSystemInit();
+ if (ret != 0) {
+ fprintf(stderr, "SS_SysManager/%s/Error: CL_LockSystemInit() errored: %d\n", __FUNCTION__, ret);
+ }
+
+ ret = CL_LockProcessInit();
+ if (ret != 0) {
+ fprintf(stderr, "SS_SysManager/%s/Error: CL_LockProcessInit() errored: %d\n", __FUNCTION__, ret);
+ l_isInitFail = true;
+ }
+
+ ret = PsmGetStartupFactor(hApp, &l_startup_factor);
+ if (ret == 0) {
+ if ((static_cast<UI_32>(l_startup_factor) & PSM_RESET_HISTORY) == PSM_RESET_HISTORY) {
+ DGCODE_RET_API l_ret = DGCODE_RET_ERROR;
+ uint64_t l_SystemResetRobCode = 0;
+ DGCODE_ROB_SSR_INFO l_info;
+ if (l_startup_factor == PSM_FACTOR_AGL_WITH_HISTORY) {
+ l_SystemResetRobCode = 0x2219; // AGL cause
+ } else if (l_startup_factor == PSM_FACTOR_TIER1_WITH_HISTORY) {
+ l_SystemResetRobCode = 0x221A; // Tier1 cause
+ } else if (l_startup_factor == PSM_FACTOR_USER_WITH_HISTORY) {
+ l_SystemResetRobCode = 0x8027; // USER cause
+ } else {
+ // No processing
+ }
+
+ if (l_SystemResetRobCode != 0) {
+ memset(&l_info, 0x00, sizeof(DGCODE_ROB_SSR_INFO));
+
+ l_ret = Diag_PutRoBInfo(hApp, l_SystemResetRobCode, &l_info);
+ if (l_ret == DGCODE_RET_ERROR) {
+ LOG_ERROR("Diag_PutRoBInfo()");
+ }
+ }
+ }
+ } else {
+ (void)fprintf(stderr, "SS_SysManager/%s/ERROR:start-up factor not get\n", __FUNCTION__);
+ }
+
+ m_isIlgReset = (false == GetSyscomPowerStatusInfo(hApp)) ? TRUE : FALSE;
+ if (m_isIlgReset || ("elog" == m_bootOpt)) {
+ fprintf(stderr, "SS_SysManager/%s/Error: ILGRST LOG SAVE\n", __func__);
+ StoreDebugLogs(hApp, SS_STORELOGS_ILLEGAL);
+ } else {
+ StoreDebugLogs(hApp, SS_STORELOGS_ACCOFFON);
+ }
+
+ if (m_isIlgReset == TRUE) {
+ // overwrite AGL_ILLRESET_FLAG.
+ uint32_t tmp = static_cast<uint32_t>(m_isIlgReset);
+ if (PowerHalSetResetInfo(AGL_ILLRESET_FLAG, tmp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not set AGL_ILLRESET_FLAG to power_hal");
+ }
+ } else {
+ // keep last value of AGL_ILLRESET_FLAG.
+ }
+
+ FRAMEWORKUNIFIED_SET_ZONES();
+ NsLogSetLogMethod(LPRINT | LMSGQ);
+ // FRAMEWORKUNIFIEDLOG can not be used until this line
+
+ m_ClProcessSigFd = CL_ProcessInit(); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (m_ClProcessSigFd == -1) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: CL_ProcessInit()");
+ l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = CL_MonitorInit(CL_MONITOR_INIT_SYSTEM);
+ if(ret != 0) {
+ fprintf(stderr, "SS_SysManager/%s/Error: CL_MonitorInit() errored: %d\n", __FUNCTION__, ret);
+ l_isInitFail = true;
+ }
+
+ // Threads MUST NOT be started until this line
+// ===== Initialization No.1
+ Initialize_memory(hApp, &l_isInitFail, &l_eStatus, m_isIlgReset);
+
+// ===== Initialization No.2
+ Initialize_callbacks(hApp, &l_isInitFail, &l_eStatus);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::SetEnvVariableForVupMode(BOOL bIsVupMode) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ const CHAR SmVupModeEnvVariable[] = "SM_VUP_MODE";
+ const CHAR *l_pValue = bIsVupMode ? "y" : "n"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (0 != setenv(SmVupModeEnvVariable, l_pValue, 1)) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT_ERRNO(0);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ return l_eStatus;
+}
+
+int CSystemManager::CreateRtUsb(void) {// LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int pid = -1;
+ int ret;
+
+ ret = mkdir("/var/run", 0775);
+ if ((ret < 0) && (errno != EEXIST)) {
+ return -1;
+ }
+ pid = fork();
+ switch (pid) {
+ case 0: /* child process */
+ {
+ struct sched_param param;
+ int policy;
+ const char *exec;
+ exec = const_cast<char *>(TR_USB_PATH);
+ param.sched_priority = 0;
+ policy = SCHED_OTHER;
+ if (sched_setscheduler(getpid(), policy, &param) < 0) {
+ SS_ASERT(0);
+ _exit(-1);
+ }
+ if (setpriority(PRIO_PROCESS, getpid(), 0) < 0) {
+ SS_ASERT(0);
+ _exit(-1);
+ }
+ // exec
+ if (execlp(exec, exec, NULL) < 0) {
+ SS_ASERT(0);
+ _exit(-1);
+ }
+ _exit(0);
+ }
+ break;
+
+ case -1: /* error */
+ SS_ASERT(0);
+ goto ERROR;
+
+ default: /* parent process */
+ break;
+ }
+
+ERROR:
+ return pid;
+}// LCOV_EXCL_STOP
+
+bool CSystemManager::StoreDebugLogs(const HANDLE h_app,
+ SS_STORELOGS_OPE_TYPE type) {
+ bool isMountRamd = false;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int pid;
+
+ if (!GetDramPowerStatusInfo(h_app)) {
+ goto ERROR;
+ } else if (access(SS_SM_TEMP_FILE_FOR_STORE_LOGS, F_OK) == 0) {
+ fprintf(stderr, "SS_SysManager/%s/Error: Skip StoreDebugLogs\n", __FUNCTION__);
+ goto ERROR;
+ }
+
+ isMountRamd = true;
+
+ if (type == SS_STORELOGS_ILLEGAL) {
+ UI_32 l_ErrLogCount = 0;
+ if (PowerHalGetResetInfo(AGL_ERRLOG_COUNTER, &l_ErrLogCount)) {
+ fprintf(stderr, "SS_SysManager/%s/Error: "
+ "Could not read AGL_ERRLOG_COUNTER from power_hal\n", __FUNCTION__);
+ goto ERROR;
+ }
+
+ if (l_ErrLogCount >= SS_SM_ERR_LOGGING_LIMIT) {
+ fprintf(stderr, "SS_SysManager/%s/Error: "
+ "Skip StoreDebugLogs by continuous error l_ErrLogCount=%lu\n",
+ __FUNCTION__, l_ErrLogCount);
+ goto ERROR;
+ }
+
+ l_ErrLogCount++;
+ if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, l_ErrLogCount)) {
+ // Just logging, don't go to ERROR.
+ fprintf(stderr, "SS_SysManager/%s/Error: "
+ "Could not write AGL_ERRLOG_COUNTER to power_hal\n", __FUNCTION__);
+ }
+ } else if (type == SS_STORELOGS_ACCOFFON) {
+ if (0 != unlink(SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG)) {
+ fprintf(stderr, "SS_SysManager/%s/Error: ACCOFFON LOG SAVE\n", __FUNCTION__);
+ } else {
+ goto ERROR;
+ }
+ }
+
+ pid = fork();
+ if (pid == 0) {
+ int fd = open(SS_SM_TEMP_FILE_FOR_STORE_LOGS,
+ O_CREAT | O_TRUNC | O_RDWR, 00664);
+ if (-1 == fd) { // LCOV_EXCL_BR_LINE 5:fd must not be -1
+ fprintf(stderr, "SS_SysManager/%s/Error: Failed open %s errno: %d\n",
+ __FUNCTION__, SS_SM_TEMP_FILE_FOR_STORE_LOGS, errno);
+ } else {
+ fsync(fd);
+ close(fd);
+ }
+ FRAMEWORKUNIFIED_SET_ZONES(); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ NsLogSetLogMethod(LPRINT | LMSGQ);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = SS_LoggerStoreLogs(type))) { // LCOV_EXCL_BR_LINE 200: always return OK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fprintf(stderr, "SS_SysManager/%s/Error: SS_LoggerStoreDebugLogs() errored: %d\n", __FUNCTION__, l_eStatus); // LCOV_EXCL_LINE 200: always return OK // NOLINT(whitespace/line_length)
+ }
+ // Close accessing the RAMD by FRAMEWORKUNIFIEDLOG for RAMD initialization
+ NsForceClose();
+
+ if (0 != unlink(SS_SM_TEMP_FILE_FOR_STORE_LOGS)) {
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ exit(0);
+ } else if (pid == -1) { // LCOV_EXCL_BR_LINE 5:fork error case
+ // LCOV_EXCL_START 5:fork error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fprintf(stderr, "SS_SysManager/%s/Error: ASSERT %d\n", __FUNCTION__, __LINE__);
+ // LCOV_EXCL_STOP
+ } else {
+ if (-1 == waitpid(pid, NULL, 0)) { // LCOV_EXCL_BR_LINE 5:waitpid error case
+ // LCOV_EXCL_START 5:waitpid error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fprintf(stderr, "SS_SysManager/%s/Error: ASSERT %d\n", __FUNCTION__, __LINE__);
+ // LCOV_EXCL_STOP
+ }
+ }
+ ERROR:
+ return isMountRamd;
+}
+
+#define SS_SM_SCAC_DEVICE_NODE "/dev/scac_driver"
+#define SS_SM_SCAC_CMD_SHUTDOWN 0x3000
+
+EFrameworkunifiedStatus CSystemManager::SecureChipOff() {
+ static bool isOffDone = false;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int32_t fd;
+ int32_t res;
+
+ if (!isOffDone) {
+ fd = open(SS_SM_SCAC_DEVICE_NODE, O_RDWR);
+ if (fd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) ERR", SS_SM_SCAC_DEVICE_NODE);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ res = ioctl(fd, SS_SM_SCAC_CMD_SHUTDOWN);
+ if (res < 0) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ioctl(SS_SM_SCAC_CMD_SHUTDOWN) ERR");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ close(fd);
+ }
+
+ isOffDone = true;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Skip Chip Off");
+ }
+
+ return l_eStatus;
+}
+
+UI_32 CSystemManager::InProgressStateToSendMsg() const {
+ UI_32 l_iCmd = SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX;
+ switch (m_SMCurrentState) {
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ l_iCmd = SS_SM_PRE_START;
+ break;
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ l_iCmd = SS_SM_PRE_STOP;
+ break;
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ l_iCmd = SS_SM_BACKGROUND_START;
+ break;
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ l_iCmd = SS_SM_BACKGROUND_STOP;
+ break;
+ case SS_SM_APPS_START_IN_PROGRESS:
+ l_iCmd = SS_SM_START;
+ break;
+ default:
+ break;
+ }
+ return l_iCmd;
+}
+
+SMModuleState CSystemManager::InProgressStateToState() const {
+ SMModuleState l_state = MODULE_STATE_INVALID;
+ switch (m_SMCurrentState) {
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ l_state = MODULE_STATE_STARTED_PRE;
+ break;
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ l_state = MODULE_STATE_STOPPED_PRE;
+ break;
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ l_state = MODULE_STATE_STARTED_BACKGROUND;
+ break;
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ l_state = MODULE_STATE_STOPPED_BACKGROUND;
+ break;
+ case SS_SM_APPS_START_IN_PROGRESS:
+ l_state = MODULE_STATE_STARTED;
+ break;
+ default:
+ break;
+ }
+ return l_state;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SetSystemModeInfoStruct
+/// Read ( or initialize ) NVM and set the SystemModeInfo structure
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::SetSystemModeInfoStruct() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (m_UsingVMPlayer) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " 'm_UsingVMPlayer' is True,"
+ " using default SystemModeInfo values");
+ m_SystemModeInfo.limpHomeCutoff = epslhcDISABLED;
+ m_SystemModeInfo.productionMode = epspmDISABLED;
+ m_SystemModeInfo.transportMode = epstmDISABLED;
+ m_SystemModeInfo.systemMode = epssinfNORMAL;
+ m_DataResetMode = e_SS_SM_DATA_RESET_MODE_NONE;
+ m_ResetCount = 0;
+ m_ProgUpdateState = SS_SM_PROG_UPDATE_STATE_NONE;
+ // Don't change the m_SystemModeInfo.startupStage.
+ // It is set dynamically as System Manager initializes the _CWORD102_.
+ } else {
+ uint32_t tmp = 0;
+ if (PowerHalGetResetInfo(AGL_RESET_COUNTER, &m_ResetCount)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not read AGLRESET_COUNTER from power_hal, assume to 0");
+ m_ResetCount = 0;
+ }
+
+ if (PowerHalGetResetInfo(AGL_PROGUPDATE_STATE, &m_ProgUpdateState)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not read AGL_PROGUPDATE_STATE from power_hal, "
+ "assume to SS_SM_PROG_UPDATE_STATE_NONE");
+ m_ProgUpdateState = SS_SM_PROG_UPDATE_STATE_NONE;
+ }
+
+ if (PowerHalGetResetInfo(AGL_DATARESET_STATE, &tmp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not read AGL_DATARESET_STATE from power_hal, "
+ "assume to e_SS_SM_DATA_REESET_MODE_NONE");
+ m_DataResetMode = e_SS_SM_DATA_RESET_MODE_NONE;
+ } else {
+ m_DataResetMode = static_cast<ESMDataResetModeInfo>(tmp);
+ }
+ m_SystemModeInfo.systemMode = epssinfNORMAL;
+ } // End else ! m_UsingVMPlayer
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::SetSystemModeInfoStruct()
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ClearDramBackupInfo
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ClearDramBackupInfo(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int ret;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "PsmClrRamJudgeFlgPower()");
+ ret = PsmClrRamJudgeFlgPower(hApp);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 11: Excluded due to gcov constraints (others)
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup CloseApplication
+/// Process request to close Application
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::CloseApplication(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE))) {
+ LOG_ERROR("FrameworkunifiedPublishServiceAvailability(hApp,FALSE)");
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus =
+ FrameworkunifiedUnRegisterServiceAvailabilityNotification(hApp))) {
+ LOG_ERROR("FrameworkunifiedUnRegisterServiceAvailabilityNotification(hApp)");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Successful");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::CloseApplication(HANDLE hApp)
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SMStateStartCompleteEntry
+/// entry for SM module state(SS_SM_APPS_START_COMPLETE)
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::SMStateStartCompleteEntry(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "All %d groups have been sent system_manager protocol message, sending Start Complete to _CWORD56_",
+ m_SystemStarter.get_id());
+ CALL_AND_LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ send_power_request_complete_response(hApp, "Startup")); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ CALL_AND_LOG_STATUS(PublishPowerOnOffNotification(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (m_InitialBoot == true) {
+ m_InitialBoot = false;
+
+ const ESMServiceWakeupStatus l_svcWupStatus = e_SS_SM_SVC_WAKEUP_STATUS_COMPLETE;
+
+ CALL_AND_LOG_STATUS( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FrameworkunifiedNPPublishNotification(hApp, NTFY_SSServiceWakeupStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ &l_svcWupStatus, sizeof(ESMServiceWakeupStatus))); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // If all modules are restarted, a passive warning will be issued
+ // indicating that Heartbeat is already running.
+
+ UI_32 l_list_num = static_cast<UI_32>(m_HBList.size());
+ if (SS_MAX_NUM_MODULES < l_list_num) {
+ l_list_num = SS_MAX_NUM_MODULES;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warn: SS_MAX_NUM_MODULES '%d' < m_HBList.size '%d'",
+ SS_MAX_NUM_MODULES, l_list_num);
+ }
+
+ CHAR send_data[sizeof(l_list_num)
+ + (l_list_num * SS_SM_HB_MAX_PROC_NAME_SIZE)
+ + sizeof(m_SMConfig.HBConfig)];
+ CHAR* p_prm = &send_data[0];
+
+ memcpy(p_prm, reinterpret_cast<char *>(&m_SMConfig.HBConfig), sizeof(m_SMConfig.HBConfig));
+ p_prm = p_prm + sizeof(m_SMConfig.HBConfig);
+ memcpy(p_prm, reinterpret_cast<char *>(&l_list_num), sizeof(l_list_num));
+ p_prm = p_prm + sizeof(l_list_num);
+
+ for (UI_32 i = 0; i < l_list_num; i++) {
+ snprintf(p_prm, SS_SM_HB_MAX_PROC_NAME_SIZE, "%s", m_HBList[i].c_str());
+ p_prm = p_prm + SS_SM_HB_MAX_PROC_NAME_SIZE;
+ }
+ l_eStatus = SendRequestToHeartBeat(hApp, SS_HEARTBEAT_START, &send_data, static_cast<UI_32>(sizeof(send_data))); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "SendRequestToHeartBeat()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ m_DataResetMode = e_SS_SM_DATA_RESET_MODE_NONE;
+ {
+ uint32_t tmp = static_cast<uint32_t>(m_DataResetMode);
+ if (PowerHalSetResetInfo(AGL_DATARESET_STATE, tmp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not set AGL_DATARESET_STATE to power_hal");
+ }
+ }
+
+ m_ProgUpdateState = SS_SM_PROG_UPDATE_STATE_NONE;
+ if (PowerHalSetResetInfo(AGL_PROGUPDATE_STATE, m_ProgUpdateState)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not set AGL_PROGUPDATE_STATE to power_hal");
+ }
+
+ m_isIlgReset = FALSE;
+ {
+ uint32_t tmp = static_cast<uint32_t>(m_isIlgReset);
+ if (PowerHalSetResetInfo(AGL_ILLRESET_FLAG, tmp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not set AGL_ILLRESET_FLAG to power_hal");
+ }
+ }
+
+ if (access(SS_SM_TEMP_FILE_FOR_STORE_LOGS, F_OK) == 0) {
+ SS_ASERT_ERRNO(0 == unlink(SS_SM_TEMP_FILE_FOR_STORE_LOGS)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ for (vector<std::string>::iterator protectedSvc =
+ m_productCustomPrm.protectedSvcs.begin();
+ protectedSvc != m_productCustomPrm.protectedSvcs.end();
+ protectedSvc++) {
+ ModuleLaunchListIter l_ModuleListIter;
+ l_eStatus = GetModuleIterator(protectedSvc->c_str(), l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if ((l_ModuleListIter->IsModuleState(MODULE_STATE_STARTED))
+ || (l_ModuleListIter->IsModuleState(MODULE_STATE_LAUNCHED)
+ && !l_ModuleListIter->is_start_required)) {
+ char pathBuf[128];
+
+ snprintf(pathBuf, 128, "/proc/%d/oom_score_adj", l_ModuleListIter->pid); // NOLINT
+ std::ofstream fo(pathBuf); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ fo << OOM_SCORE_ADJ_MIN << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ fo.close(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "set OOM_SCORE_ADJ_MIN(%s/%d)",
+ l_ModuleListIter->name.c_str(), l_ModuleListIter->pid);
+ } else {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ for (vector<std::string>::iterator groupRelaunchSvc =
+ m_productCustomPrm.groupRelaunchSvcs.begin();
+ groupRelaunchSvc != m_productCustomPrm.groupRelaunchSvcs.end();
+ groupRelaunchSvc++) {
+ ModuleLaunchListIter l_ModuleListIter;
+ l_eStatus = GetModuleIterator(groupRelaunchSvc->c_str(), l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if ((l_ModuleListIter->IsModuleState(MODULE_STATE_STARTED))
+ || (l_ModuleListIter->IsModuleState(MODULE_STATE_LAUNCHED)
+ && !l_ModuleListIter->is_start_required)) {
+ GroupRelaunchModuleParams l_param; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_param.name = l_ModuleListIter->name.c_str();
+ m_GroupRelaunchModuleList.push_back(l_param);
+
+ if (l_ModuleListIter->retry_cnt > m_GroupRelaunchLimit) {
+ m_GroupRelaunchLimit = l_ModuleListIter->retry_cnt;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "GroupRelaunchSvcs:%s(%d)",
+ l_ModuleListIter->name.c_str(), l_ModuleListIter->pid);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s is not Launched", groupRelaunchSvc->c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s is not exist", groupRelaunchSvc->c_str());
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "GroupRelaunchLimit:%d", m_GroupRelaunchLimit);
+
+ SendDeferMsg(hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+} // End of VOID CSystemManager::SMStateStartCompleteEntry()
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SMStateEntry
+/// entry for SM module state
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::SMStateEntry(HANDLE hApp, SS_SMModuleState l_SMState) {
+ switch (l_SMState) {
+ case SS_SM_APPS_START_COMPLETE:
+ case SS_SM_APPS_PRE_RUN_COMPLETE:
+ case SS_SM_APPS_BACKGROUND_RUN_COMPLETE:
+ SMStateStartCompleteEntry(hApp);
+ break;
+ default:
+ break;
+ }
+} // End of VOID CSystemManager::SMStateEntry(SS_SMModuleState l_SMState)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SMStateExit
+/// exit for SM module state
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::SMStateExit(HANDLE hApp, SS_SMModuleState l_SMState) {
+ switch (l_SMState) {
+ case SS_SM_APPS_START_COMPLETE:
+ break;
+ default:
+ break;
+ }
+} // End of VOID CSystemManager::SMStateExit(SS_SMModuleState l_SMState)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SMSetState
+/// set module state
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::SMSetState(HANDLE hApp, SS_SMModuleState l_SMNewState) {
+ // FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s -> %s",
+ GetStr(m_SMCurrentState).c_str(), GetStr(l_SMNewState).c_str());
+
+ if (l_SMNewState != m_SMCurrentState) {
+ SMStateExit(hApp, m_SMCurrentState);
+
+ m_SMCurrentState = l_SMNewState;
+
+ SMStateEntry(hApp, m_SMCurrentState);
+ }
+ // FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup register_all_notification_callbacks
+/// register all notifications and callbacks with NP_NPS
+/// this function gets called when NP_NPS reply launch complete
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::register_all_notification_callbacks(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FrameworkunifiedNotificationsList userModeNotificationsBOOL[] = { {
+ NTFY_SSSystemMgrPowerOnOff, sizeof(BOOL), eFrameworkunifiedStateVar }, {
+ NTFY_SSSystemMgrUserMode, sizeof(BOOL), eFrameworkunifiedStateVar } };
+
+ FrameworkunifiedNotificationsList userModeNotificationsStruct[] = { {
+ NTFY_SSSystemMgrPowerOnOff,
+ sizeof(T_SS_SM_UserModeOnOffNotification_Struct), eFrameworkunifiedStateVar }, {
+ NTFY_SSSystemMgrUserMode,
+ sizeof(T_SS_SM_UserModeOnOffNotification_Struct), eFrameworkunifiedStateVar } };
+
+ FrameworkunifiedNotificationsList sm_notifications[] = {
+ { NTFY_SSSystemMgrStartUpType, sizeof(EPWR_SC_WAKEUP_TYPE), eFrameworkunifiedStateVar },
+ { NTFY_SSSystemMgrDataReset, sizeof(ESMDataResetType), eFrameworkunifiedStateVar },
+ { NTFY_SSSystemMgrShutdownStarted, 0, eFrameworkunifiedStateVar },
+ { NTFY_SSServiceWakeupStatus, sizeof(ESMServiceWakeupStatus), eFrameworkunifiedStateVar },
+ { NTFY_SSNeedAplRestart, 0, eFrameworkunifiedStateVar } };
+
+ if (m_SMConfig.UMConfig.IsUserModeNotificationABOOL) {
+ l_eStatus = FrameworkunifiedNPRegisterNotifications(hApp, userModeNotificationsBOOL,
+ static_cast<UI_32>(_countof(userModeNotificationsBOOL)));
+ } else {
+ l_eStatus = FrameworkunifiedNPRegisterNotifications(hApp,
+ userModeNotificationsStruct,
+ static_cast<UI_32>(_countof(userModeNotificationsStruct)));
+ }
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("FrameworkunifiedNPRegisterNotifications(userModeNotifications)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedNPRegisterNotifications(hApp, sm_notifications, static_cast<UI_32>(_countof(sm_notifications))))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedNPRegisterNotifications(sm_notifications)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hApp, NTFY_SSSystemMgrAvailability))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedRegisterServiceAvailabilityNotification(" // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ NTFY_SSSystemMgrAvailability ")"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, TRUE))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedPublishServiceAvailability('NTFY_SSSystemMgrAvailability ', TRUE)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ LOG_SUCCESS("FrameworkunifiedPublishServiceAvailability('NTFY_SSSystemMgrAvailability ', TRUE)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ REC_HIST_IF_SUCCESSFUL(NTFY_SSSystemMgrAvailability, m_PubCmdHist, // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ m_PubHistIter, "", l_eStatus); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::init_Heartbeat(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FrameworkunifiedProtocolCallbackHandler hb_protocol_callbacks[] = { {
+ SS_HEARTBEAT_PERIODIC_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnHeartBeatThreadHeartbeatResponse> }, {
+ SS_HEARTBEAT_ERROR_DETECTED, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnHeartBeatErrorDetected> }, {
+ SS_HEARTBEAT_AVAIL_CHECK_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnCheckAvailResponse> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ // Subscribe to Notifications (All required notifications)
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp, SS_SMHeartbeat, hb_protocol_callbacks, static_cast<UI_32>(_countof(hb_protocol_callbacks))))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher(hb_notification_handlers)");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (m_hHeartbeatThread.m_ThreadHdl = FrameworkunifiedCreateChildThreadWithPriority(hApp, SS_SMHeartbeat, HBThreadStart, HBThreadStop, PR_SMHEARTBEAT))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusThreadNotExist;
+ m_hHeartbeatThread.m_ThreadState = eSM_ThreadNotExist;
+ LOG_ERROR("FrameworkunifiedCreateChildThreadWithPriority(hApp, SS_SMHeartbeat)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(hApp, m_hHeartbeatThread.m_ThreadHdl, 0, NULL))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ m_hHeartbeatThread.m_ThreadState = eSM_ThreadNotExist;
+ LOG_ERROR("FrameworkunifiedStartChildThread(SS_SMHeartbeat)");
+ // LCOV_EXCL_STOP
+ } else {
+ m_hHeartbeatThread.m_ThreadState = eSMThreadIsFine;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::init_sysmem_monitor(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FrameworkunifiedProtocolCallbackHandler sysmem_protocol_callbacks[] = { {
+ eSysMemThrdCmd_SYS_LOW_MEMORY, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnLowSystemMemory> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_BR_START 4: For setting the initialization conditions at SystemManager startup
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hApp,
+ m_SysMemMonitor.GetThreadName().c_str(), sysmem_protocol_callbacks,
+ static_cast<UI_32>(_countof(sysmem_protocol_callbacks))))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher()"); // LCOV_EXCL_LINE 4: For setting the initialization conditions at SystemManager startup
+ } else {
+ m_SysMemMonitor.SetSLMConfigData(m_SMConfig.SLMConfig); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_eStatus = m_SysMemMonitor.Initialize(hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_ERROR_REC_HIST_IF_ERRORED // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ (l_eStatus, "m_SysMemMonitor.Initialize(hApp);"); // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnGroupLaunchTimerExpiry(HANDLE hThread) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_launchID = m_oSystemLauncher.get_id();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, " Received from group %d", l_launchID);
+ REC_HIST_IF_SUCCESSFUL("SM_TIMER_GROUP_MONITOR", m_TimerCmdHist,
+ m_TimerHistIter, "TIMER", l_eStatus);
+
+ LogGroupModulesState(l_launchID,
+ " Group launch timer expired, processing next group.");
+
+ if (NULL == hThread) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("NULL == hThread");
+ } else {
+ // FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Timer expired for group id,%d",m_oSystemLauncher.get_id());
+ if (!m_oSystemLauncher.is_end()) {
+ l_launchID = m_oSystemLauncher.advance_id();
+ if (eFrameworkunifiedStatusOK != (l_eStatus = OnLaunchGroup(hThread))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: OnLaunchGroup(%d) errored: %d/'%s'", l_launchID,
+ l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnGroupLaunchTimerExpiry( HANDLE hThread )
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::FindNameOfTerminatedProcess(SI_32 f_pid, SS_String &f_ModuleName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ if (l_GroupIterator == m_MapProclaunchGrps.end()) { // LCOV_EXCL_BR_LINE 200: Group Map cannot be empty
+ // LCOV_EXCL_START 200: Group Map cannot be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : Group Map empty"); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ BOOL l_bModuleFound = FALSE;
+ for (; (FALSE == l_bModuleFound)
+ && (l_GroupIterator != m_MapProclaunchGrps.end());
+ l_GroupIterator++) {
+ ModuleLaunchListIter l_ModuleListIterator =
+ l_GroupIterator->second.modules.begin();
+ for (; (FALSE == l_bModuleFound)
+ && (l_ModuleListIterator
+ != l_GroupIterator->second.modules.end());
+ l_ModuleListIterator++) {
+ if (l_ModuleListIterator->pid == f_pid) {
+ l_bModuleFound = TRUE;
+ f_ModuleName = l_ModuleListIterator->name;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::GetBinaryNameOfProcess(SS_String f_ModuleQueueName,
+ SS_String &f_ModuleBinaryName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ ModuleLaunchListIter l_moduleIter;
+
+ f_ModuleBinaryName = "";
+ l_eStatus = GetModuleIterator(f_ModuleQueueName.c_str(), l_moduleIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("GetModuleIterator()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ size_t l_pos = l_moduleIter->path.find_last_of("\\/");
+ if (std::string::npos == l_pos) { // LCOV_EXCL_BR_LINE 5: stdlib error case.
+ // LCOV_EXCL_START 5: stdlib error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Unable to parse binary name from path %s.",
+ l_moduleIter->path.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ f_ModuleBinaryName = l_moduleIter->path.substr(l_pos + 1);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::init_process_launcher(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ UI_32 TODO = 0;
+
+ FrameworkunifiedProtocolCallbackHandler process_launcher_protocol_callbacks[] = {
+ // Command ID, Call back functions
+ { ePLThrdCmd_LAUNCH_MODULE_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnModuleLaunchResponse> },
+ { ePLThrdCmd_TERMINATE_MODULE_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnTerminateModuleResponse> },
+ { ePLThrdCmd_RELAUNCH_MODULE_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnReLaunchModuleResponse> },
+ { ePLThrdCmd_THREAD_STATUS_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnProcessLauncherThreadHeartbeatResponse> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // setup call backs for my children
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp, SS_SMLauncher, process_launcher_protocol_callbacks, static_cast<UI_32>(_countof(process_launcher_protocol_callbacks))))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher()"); // LCOV_EXCL_LINE 4: For setting the initialization conditions at SystemManager startup
+ //////// Create Writer Child Threads handles the writing of data
+ } else if (NULL == (m_hProcLauncherThread.m_ThreadHdl = FrameworkunifiedCreateChildThreadWithPriority(hApp, SS_SMLauncher, ProcessLauncherOnStart, ProcessLauncherOnStop, PR_SMPROCLAUNCH))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ m_hProcLauncherThread.m_ThreadState = eSM_ThreadNotExist;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedCreateChildThreadWithPriority(%s) errored: %d/'%s'",
+ SS_SMLauncher, l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(hApp, m_hProcLauncherThread.m_ThreadHdl, sizeof(UI_32), &TODO))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ m_hProcLauncherThread.m_ThreadState = // LCOV_EXCL_LINE 4: For setting the initialization conditions at SystemManager startup
+ eSM_ThreadNotExist; // LCOV_EXCL_LINE 4: For setting the initialization conditions at SystemManager startup
+ LOG_ERROR("FrameworkunifiedStartChildThread()"); // LCOV_EXCL_LINE 4: For setting the initialization conditions at SystemManager startup
+ } else {
+ m_hProcLauncherThread.m_ThreadState = eSMThreadIsFine;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnGroupLaunchWaitTimeout(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ SetCmdHist("SM_TIMER_GROUP_LAUNCH_WAIT_TIMER", m_TimerCmdHist, m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnModuleLaunchResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ GroupLaunchMapIter l_GroupIter;
+ ModuleLaunchListIter l_ModuleIter;
+ UI_32 l_launchID = m_oSystemLauncher.get_id();
+
+ l_eStatus = PerformModuleLaunchRespProcessing(hApp, l_GroupIter, l_ModuleIter, "ML");
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("PerformModuleLaunchRespProcessing()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (l_GroupIter->second.id == l_launchID) {
+ BOOL IsGroupLaunchComplete = TRUE;
+ // Search the group for any module that has not completed launching.
+ for (l_ModuleIter = l_GroupIter->second.modules.begin();
+ IsGroupLaunchComplete && (l_ModuleIter != l_GroupIter->second.modules.end());
+ l_ModuleIter++) {
+ IsGroupLaunchComplete = !l_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHING);
+ }
+
+ if (IsGroupLaunchComplete) {
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_GROUP_MONITOR]);
+ l_GroupIter->second.launch_complete = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Group%d LaunchComp", l_GroupIter->second.id);
+
+ if (!m_oSystemLauncher.is_end()) {
+ l_launchID = m_oSystemLauncher.advance_id();
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Next group:%d", l_launchID);
+ if (FALSE == l_GroupIter->second.grp_wait_for_trigger) {
+ UI_32 l_Sec = (l_GroupIter->second.grp_launch_wait) / (1000 * 1000);
+ UI_32 l_mSec = 0;
+ if (l_Sec > 0) {
+ l_mSec = ((l_GroupIter->second.grp_launch_wait) % (1000 * 1000)) / 1000;
+ } else {
+ l_mSec = (l_GroupIter->second.grp_launch_wait) / 1000;
+ }
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_GROUP_LAUNCH_WAIT_TIMER], l_Sec, l_mSec, 0, 0);
+ } else {
+ // Start the timer for group trigger... added for optimization
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_LAUNCH_GROUP_TRIGGER_PROC_RESP_TIMER],
+ SS_LAUNCH_GROUP_TRIGGER_TIMER_CONFIG, 0, 0, 0);
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Group %d/%s LaunchIncomp", l_launchID,
+ l_GroupIter->second.name.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " '%s' ( Group %d/%s ) Launch Response received late - "
+ "group id is now %d", l_ModuleIter->name.c_str(),
+ l_GroupIter->second.id, l_GroupIter->second.name.c_str()
+ , l_launchID);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnReLaunchModuleResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ GroupLaunchMapIter l_GroupIter;
+ ModuleLaunchListIter l_ModuleIter;
+
+ l_eStatus = PerformModuleLaunchRespProcessing(hApp, l_GroupIter, l_ModuleIter, "RL");
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "PerformModuleLaunchRespProcessing()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnReLaunchModuleResponse( HANDLE hApp )
+
+
+EFrameworkunifiedStatus CSystemManager::PerformModuleLaunchRespProcessing(HANDLE hApp,
+ GroupLaunchMapIter & f_GroupIter, ModuleLaunchListIter & f_ModuleIter,
+ PCSTR p_sPPD_tag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ T_ProcessLaunchResp l_LaunchRespData;
+
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < T_ProcessLaunchResp > (hApp, l_LaunchRespData))) { // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ BOOL b_DidModuleLaunch = FALSE;
+ f_GroupIter = l_LaunchRespData.groupIterator;
+ f_ModuleIter = l_LaunchRespData.moduleIterator;
+ SS_String l_ModulePath = l_LaunchRespData.path;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "%s(%d)", l_LaunchRespData.name, l_LaunchRespData.pid);
+
+ if (l_LaunchRespData.pid == -1) {
+ f_ModuleIter->pid = -1;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Process launch failed: %s, %s",
+ f_ModuleIter->name.c_str(), l_ModulePath.c_str());
+
+ /// TODO
+ /// If PID is -1, launch had failed. Add logic to do necessary action.
+
+ f_ModuleIter->SetModuleState(MODULE_STATE_LAUNCH_FAILED);
+ } else if (l_LaunchRespData.pid == 0x7FFFFFFF) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warning: '%s', '%s' already launched",
+ f_ModuleIter->name.c_str(), l_ModulePath.c_str());
+
+ b_DidModuleLaunch = TRUE;
+ } else {
+ f_ModuleIter->pid = l_LaunchRespData.pid;
+ b_DidModuleLaunch = TRUE;
+ }
+
+ if (b_DidModuleLaunch) {
+ //
+ // Module state could already be MODULE_STATE_CONNECTED if
+ // module process ran before process launcher thread completed;
+ // don't overwrite/reset the MODULE_STATE_CONNECTED state.
+ if (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHING)) {
+ f_ModuleIter->SetModuleState(MODULE_STATE_LAUNCHED);
+ }
+
+ l_eStatus = f_ModuleIter->GetPriority(f_ModuleIter->current_priority);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warning: f_ModuleIter->GetPriority( "
+ "f_ModuleIter->current_priority ) returned %d/'%s'. "
+ "Setting 'current_priority' = 'configuration_priority' %d.",
+ l_eStatus, GetStr(l_eStatus).c_str(),
+ f_ModuleIter->configuration_priority);
+ f_ModuleIter->current_priority = f_ModuleIter->configuration_priority;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::PerformModuleLaunchRespProcessing(
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnTerminateModuleResponse
+///
+/// \param HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnTerminateModuleResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ T_ProcessLauncherTerminationResp l_TerminateRespData;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < T_ProcessLauncherTerminationResp
+ > (hApp, l_TerminateRespData))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ ModuleLaunchListIter l_ModuleIter = l_TerminateRespData.moduleIterator;
+
+ SS_String l_ModulePath = m_BinaryFilesPath + l_ModuleIter->path;
+
+ if ((0 == strcmp(l_ModulePath.c_str(), l_TerminateRespData.path))
+ && (0 == strcmp(l_ModuleIter->arguments.c_str(),
+ l_TerminateRespData.args))) {
+ l_ModuleIter->pid = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s Termination successful",
+ l_ModuleIter->name.c_str());
+ } else {
+ if (0 != strcmp(l_ModulePath.c_str(), l_TerminateRespData.path)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: ModuleIter->path != l_TerminateRespData.path"
+ " \" '%s' != '%s' \"", l_ModuleIter->path.c_str(),
+ l_TerminateRespData.path);
+ }
+ if (0 != strcmp(l_ModuleIter->arguments.c_str(),
+ l_TerminateRespData.args)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: ModuleIter->arguments != "
+ "l_TerminateRespData.args, \" '%s' != '%s' \"",
+ l_ModuleIter->arguments.c_str(), l_TerminateRespData.args);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnTerminateModuleResponse( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////
+/// \ingroup ReadPathAndFileNameEnvironmentVariables
+///
+/// \param
+///
+/// \return VOID
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::ReadPathFromEnvironmentVariables() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ CHAR *l_pEnvVariable = NULL;
+
+ // read Path from environment variable
+ if (NULL == (l_pEnvVariable = std::getenv(BaseDirPathEnvVariable))) {
+ // Environment variable not set, set it to default path
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Using Default path for Binary Files : %s", DefaultBasePath);
+ m_BinaryFilesPath = DefaultBasePath;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Using Default path for Config Files : %s%s",
+ DefaultBasePath, DefaultConfigFilesPath);
+ m_ConfigFilesPath = DefaultBasePath;
+ } else {
+ // set path of binary files
+ m_BinaryFilesPath = l_pEnvVariable;
+
+ // set path of configuration files
+ m_ConfigFilesPath = l_pEnvVariable;
+ }
+ // set path of configuration files
+ m_ConfigFilesPath += DefaultConfigFilesPath;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// \ingroup GetConfigDataFileNameFromEnvironmentVariable
+///
+/// \param
+///
+/// \return SS_String
+///////////////////////////////////////////////////////////////////////////////
+SS_String CSystemManager::ReadLaunchConfigFileNameFromEnvironmentVariable() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR *l_pEnvVariable = NULL;
+ SS_String l_FileName;
+
+ // read Launch Config File Name from environment variable
+ // LCOV_EXCL_BR_START 5: standard lib error
+ if (NULL == (l_pEnvVariable = std::getenv(LaunchConfigFileNameEnvVariable))) {
+ // LCOV_EXCL_BR_STOP
+ // Environment variable not set, set it to default file name
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Using Default Launch Configuration file : %s",
+ DefaultLaunchConfigFileName);
+ l_FileName = DefaultLaunchConfigFileName;
+ // LCOV_EXCL_STOP
+ } else {
+ l_FileName = l_pEnvVariable;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Using Launch Configuration file: %s", l_FileName.c_str());
+
+ SS_String retStr = m_ConfigFilesPath + l_FileName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (access(retStr.c_str(), F_OK) != 0) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "no found %s", retStr.c_str());
+ SS_ASERT(0);
+ // LCOV_EXCL_STOP
+ }
+ return retStr;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// \ingroup GetConfigDataFileNameFromEnvironmentVariable
+///
+/// \param
+///
+/// \return SS_String
+///////////////////////////////////////////////////////////////////////////////
+SS_String CSystemManager::ReadConfigDataFileNameFromEnvironmentVariable() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR *l_pEnvVariable = NULL;
+ SS_String l_FileName = "";
+
+ // read SM Config Data File Name from environment variable
+ // LCOV_EXCL_BR_START 5: standard lib error
+ if (NULL == (l_pEnvVariable = std::getenv(SMConfigDataFileNameEnvVariable))) {
+ // LCOV_EXCL_BR_STOP 5: standard lib error
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // Environment variable not set, set it to default file name
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Using Default Configuration Data file : %s", DefaultSMConfigFileName);
+ l_FileName = DefaultSMConfigFileName;
+ // LCOV_EXCL_STOP
+ } else {
+ l_FileName = l_pEnvVariable;
+ }
+
+ SS_String retStr = m_ConfigFilesPath + l_FileName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (access(retStr.c_str(), F_OK) != 0) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "no found %s", retStr.c_str());
+ SS_ASERT(0);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return retStr;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// \ingroup ReadUsingVMPlayerEnvironmentVariable
+///
+/// \param
+///
+/// \return VOID
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::ReadUsingVMPlayerEnvironmentVariable() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR *l_pEnvVariable = std::getenv(UsingVMPlayerVariable);
+ m_UsingVMPlayer = (NULL != l_pEnvVariable);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %sunning on a VMPlayer",
+ m_UsingVMPlayer ? "R" : "Not r");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return;
+} // End of VOID CSystemManager::ReadUsingVMPlayerEnvironmentVariable()
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::start_process_launching(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_bIsGoodRc;
+ SS_String l_SMConfigFile(ReadConfigDataFileNameFromEnvironmentVariable());
+ SMConfigParams SMConfigData;
+ SS_String l_LaunchConfigFile(ReadLaunchConfigFileNameFromEnvironmentVariable()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SysMgrConfiguration l_launchConfig;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Reading %s Configuration Data from %s",
+ SERVICE_SYSMANAGER, l_SMConfigFile.c_str());
+
+ l_bIsGoodRc = SMConfigData.LoadSMConfigParameters(m_SMConfig, l_SMConfigFile);
+
+ if (!l_bIsGoodRc) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SMConfigData.LoadSMConfigParameters(m_SMConfig, "
+ " %s) returned FALSE", l_SMConfigFile.c_str());
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ // LCOV_EXCL_STOP
+ } else {
+ SMSetState(hApp, SS_SM_APPS_LAUNCH_IN_PROGRESS); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Reading Launch Configuration Data from %s",
+ l_LaunchConfigFile.c_str());
+
+ SS_String l_launchOrderName = "DEFAULT"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LaunchOrderedVector l_OrderList;
+
+ l_bIsGoodRc = l_launchConfig.LoadParametersCfg(m_MapProclaunchGrps,
+ m_MapProcNames, l_OrderList, l_launchOrderName, l_LaunchConfigFile);
+
+ if (l_OrderList.size() != 0) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "wakeup order:%s",
+ l_launchOrderName.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "wakeup order:DEFAULT");
+ }
+
+ if (!l_bIsGoodRc) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: l_launchConfig.LoadParametersCfg( "
+ "m_MapProclaunchGrps, m_MapProcNames, %s ) returned FALSE",
+ l_LaunchConfigFile.c_str());
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ // LCOV_EXCL_STOP
+ } else {
+ m_SystemLaunchProgress = SS_SM_INITIAL_GROUP;
+ // l_launchConfig.PrintAllInfo( m_MapProclaunchGrps );
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " System Launch Started");
+ // Don't use DynamicLaunch because its dependency on the services table is complex
+ SS_SOURCE source_type = SS_SOURCE_FM;
+
+ m_oSystemLauncher.configure_dynamic_launch(source_type, m_MapProclaunchGrps, l_OrderList);
+ m_oSystemLauncher.copyDynOrderedVector(m_SystemStarter);
+ // m_SystemStarter.print_info();
+
+ // start the timer upon successful launching of first process
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Starting Module Connection Timeout timer with %d sec period",
+ m_SMConfig.MCConfig.ModuleConnectionTimeOutSec);
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_MODULE_CONNECT_WAIT_TIMER],
+ m_SMConfig.MCConfig.ModuleConnectionTimeOutSec, 0,
+ m_SMConfig.MCConfig.ModuleConnectionTimeOutSec, 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp)); // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+
+EFrameworkunifiedStatus CSystemManager::GetLastSourceInfo(SS_SOURCE &source_type) { // LCOV_EXCL_START 8: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ CHAR LastSource[64 + 1] = { '\0' };
+ l_eStatus = NPSynchronousReadPersistentData(SERVICE_AS_MODE,
+ NTFY_SSLastSourceType, LastSource, static_cast<UI_32>(sizeof(LastSource) - 1));
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("NPSynchronousReadPersistentData("
+ SERVICE_AS_MODE "," NTFY_SSLastSourceType);
+ } else {
+ std::string tempstr(LastSource);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " String got from persistence %s", LastSource);
+ UI_32 pos = static_cast<UI_32>(tempstr.find("_"));
+ std::string tempstr2 = tempstr.substr(0, pos);
+ UI_64 value = strtoull(tempstr2.c_str(), 0, 10);
+ source_type = static_cast<SS_SOURCE>((UI_32)(value >> 32) & 0x0000FFFF);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnLaunchGroupTriggerProcessResponse(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp);
+ UI_32 l_groupID;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+ SetCmdHist("SS_SM_GROUP_LAUNCH_TRIGGER", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+ // stop group launch trigger process response timer
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_LAUNCH_GROUP_TRIGGER_PROC_RESP_TIMER]);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < UI_32 > (hApp, l_groupID))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ SS_SOURCE source_type = SS_SOURCE_NA;
+ l_eStatus = GetLastSourceInfo(source_type);
+
+ if ((SS_SOURCE_AM == source_type) || (SS_SOURCE_FM == source_type)
+ || (SS_SOURCE_FM_DAB == source_type) || (SS_SOURCE_SDARS == source_type)) {
+ if (l_groupID == m_oSystemLauncher.get_id()) {
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Received Group ID %d != Sys Mgr Group ID %d", l_groupID,
+ m_oSystemLauncher.get_id());
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else { // media is last source
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp));
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnLaunchGroupTriggerProcessResponseTimerExpiry(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp);
+ REC_HIST_IF_SUCCESSFUL("SM_TIMER_LAUNCH_GROUP_TRIGGER", m_TimerCmdHist,
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp), l_eStatus);
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnLaunchGroupSelfTrigger(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ REC_HIST_IF_SUCCESSFUL("SS_SM_SendTriggerToSelf", m_SMCmdHist, m_SMHistIter,
+ FrameworkunifiedGetMsgSrc(hApp), l_eStatus);
+
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnLaunchGroup(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ GroupLaunchMapIter l_GroupIter;
+ UI_32 l_launch_ID = m_oSystemLauncher.get_id();
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Launching group %d", l_launch_ID );
+
+ l_GroupIter = m_MapProclaunchGrps.find(l_launch_ID);
+
+ if (l_GroupIter->second.launch_complete == FALSE) { // LCOV_EXCL_BR_LINE 6: Because it is not called for a condition that results in "TRUE"
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__
+ // , " m_bIsNPP_ServicesStarted ? %s, group.id: %d, Launch_Group: %d"
+ // , m_bIsNPP_ServicesStarted ? "Yes" : "No"
+ // , l_GroupIter->second.id
+ // , m_SystemLaunchProgress );
+
+ if ((m_bIsNPP_ServicesStarted && m_bIsBackupAvail) || (l_GroupIter->second.id <= 2)) { // LCOV_EXCL_BR_LINE 6: Because it is not called for the condition that results in "FALSE" // NOLINT(whitespace/line_length)
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIter->second.modules.begin();
+ if (l_ModuleListIterator != l_GroupIter->second.modules.end()) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ // FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "GRPLCH,(start),%d,%s",
+ // l_GroupIter->second.id,l_GroupIter->second.name.c_str());
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Launching Group%d/%s",
+ l_GroupIter->second.id, l_GroupIter->second.name.c_str());
+ SS_String l_ModulePath;
+ for (; l_ModuleListIterator != l_GroupIter->second.modules.end(); l_ModuleListIterator++) {
+ if (l_ModuleListIterator->IsModuleState(MODULE_STATE_INVALID)) {
+ char l_cFormat[] = "SendRequestToLauncher(%s, "
+ "ePLThrdCmd_LAUNCH_MODULE_REQST)";
+ char l_cBuf[sizeof(l_cFormat) + MAX_NAME_SIZE_APP];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat,
+ l_ModuleListIterator->name.c_str());
+
+ l_eStatus = SendRequestToLauncher(hApp, l_ModuleListIterator, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ePLThrdCmd_LAUNCH_MODULE_REQST, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ "ePLThrdCmd_LAUNCH_MODULE_REQST"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ModuleListIterator->SetModuleState(
+ MODULE_STATE_LAUNCH_FAILED);
+ SetCmdHist(l_cBuf, m_ErrHist, m_ErrHistIter,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ l_ModuleListIterator->SetModuleState(MODULE_STATE_LAUNCHING);
+ }
+ } else {
+ l_ModulePath = (m_BinaryFilesPath + l_ModuleListIterator->path); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Not launching %s: module state is %s",
+ l_ModulePath.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str());
+ }
+ }
+
+ // LCOV_EXCL_BR_START 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ if (FALSE ==
+ l_GroupIter->second.grp_wait_for_trigger) {
+ // LCOV_EXCL_BR_STOP
+ m_GroupLaunchTimer->StartTimer(m_aTimerIDs[eSM_TIMER_GROUP_MONITOR],
+ SS_GROUP_LAUNCH_TIMER_CONFIG, 0, 0, 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ if (m_oSystemLauncher.is_end()) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "System Launch Completed");
+
+ if (epssusSYSTEM_SERVICES_STARTED == m_SystemModeInfo.startupStage) {
+ // If startupStage == SYSTEM_SERVICES_STARTED, a notification is requested because there are SVCs required for notification to the _CWORD56_.
+ l_eStatus = SendSystemModeInfoResponse(hApp, epssusALL_SERVICES_LAUNCHED);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "UpdateStartupStageState_SendSystemModeInfoResponse" // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "( epssusALL_SERVICES_LAUNCHED )"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ m_SystemModeInfo.startupStage = epssusALL_SERVICES_LAUNCHED;
+
+ if (is_current_state(SS_SM_APPS_LAUNCH_IN_PROGRESS)) {
+ SMSetState(hApp, SS_SM_APPS_LAUNCHED_READY_TO_START);
+ }
+ // SysMgrConfiguration config;
+ // config.PrintAllInfo( m_MapProclaunchGrps );
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnLaunchGroup(HANDLE hApp)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessLaunchTimerExpiry
+///
+/// \param HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessLaunchTimerExpiry(HANDLE hApp) { // LCOV_EXCL_START 8: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // ToDo 2013_05_17 Jay When used ? Dead code ? Don't see a StartTimer call.
+ REC_HIST_IF_SUCCESSFUL("SM_TIMER_PROCESS_LAUNCH_MONITOR", m_TimerCmdHist,
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp), l_eStatus);
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_PROCESS_LAUNCH_MONITOR]);
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnHeartBeatMonitorTimerExpiry
+///
+/// \param HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnHeartBeatMonitorTimerExpiry(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, " Received from %s", FrameworkunifiedGetMsgSrc(hApp));
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ REC_HIST_IF_SUCCESSFUL("SM_TIMER_HEARTBEAT_MONITOR", m_TimerCmdHist, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp), l_eStatus); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ // LCOV_EXCL_BR_START 4: nsfw error
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, m_hHeartbeatThread.m_ThreadHdl,
+ SS_HEARTBEAT_PERIODIC_STATUS_REQ, 0, NULL))) {
+ // LCOV_EXCL_BR_STOP 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild(m_hHeartbeatThread.m_ThreadHdl, " // LCOV_EXCL_LINE 4: nsfw error
+ "SS_HEARTBEAT_PERIODIC_STATUS_REQ)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ m_hHeartbeatThread.m_ThreadState = eSMWaitForHeartbeat;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SystemManagerDebugDump
+/// implement post mortem function
+///
+/// \param
+///
+/// \return void
+///////////////////////////////////////////////////////////////////////////////
+
+VOID CSystemManager::SystemManagerDebugDump(HANDLE hApp) {
+ std::stringstream l_debugDumpBuf;
+ cmdHistIter i;
+
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_debugDumpBuf << FrameworkunifiedGetAppName(hApp) << "/" << endl
+ << " <SYSTEM MANAGER DUMP DATA> " << endl << endl << " ***internals*** " << endl
+ << endl << " SM state: "
+ << GetStr(m_SMCurrentState).c_str() << endl << " SM startup reason: "
+ << GetStr(m_StartUpReason).c_str() << endl << " SM shutdown reason: "
+ << GetStr(m_shutdownTrigger).c_str() << endl << " LUM: "
+ << GetStr(m_lastUserMode).c_str() << endl << " TPM: "
+ << GetStr(m_SystemModeInfo.transportMode).c_str() << endl << " LPH: "
+ << GetStr(m_SystemModeInfo.limpHomeCutoff).c_str() << endl << " PMode: "
+ << GetStr(m_SystemModeInfo.productionMode).c_str() << endl << " ActiveGroup: "
+ << m_ActiveGroupId << endl << " m_MaxShutdownTime: " << m_MaxShutdownTime
+ << endl << " NPP: " << (m_bIsNPP_ServicesStarted ? "Started" : "notStarted")
+ << endl
+ << endl << " ***Error history***" << endl;
+ // LCOV_EXCL_BR_STOP
+
+ for (i = m_ErrHist.begin(); i != m_ErrHist.end(); ++i) {
+ l_debugDumpBuf << endl << " " << i->m_cmd.c_str() << " @ " << i->m_time // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << "ms EC:" << i->m_sender.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_debugDumpBuf << endl << " ***_CWORD56_ command history***" << endl;
+
+ for (i = m__CWORD56_CmdHist.begin(); i != m__CWORD56_CmdHist.end(); ++i) {
+ l_debugDumpBuf << endl << " " << i->m_cmd.c_str() << " @ " << i->m_time << "ms" << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_debugDumpBuf << endl << " ***Timer history***" << endl;
+
+ for (i = m_TimerCmdHist.begin(); i != m_TimerCmdHist.end(); ++i) {
+ l_debugDumpBuf << endl << " " << i->m_cmd.c_str() << " @ " << i->m_time << "ms" << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_debugDumpBuf << endl << " ***SM message history***" << endl;
+
+ for (i = m_SMCmdHist.begin(); i != m_SMCmdHist.end(); ++i) {
+ l_debugDumpBuf << endl << " " << i->m_cmd.c_str() << " @ " << i->m_time << "ms " // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << i->m_sender.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_debugDumpBuf << endl << " ***Publishshing history***" << endl;
+
+ for (i = m_PubCmdHist.begin(); i != m_PubCmdHist.end(); ++i) {
+ l_debugDumpBuf << endl << " " << i->m_cmd.c_str() << " @ " << i->m_time << "ms " // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << i->m_sender.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_debugDumpBuf << endl << " ***SM start table***" << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_debugDumpBuf << endl
+ << " index | name | start required? | isOKFlag | Module state | start sent "
+ "| start resposne received |start delta | stop sent | reply received | stop delta | PID"
+ << endl;
+ // LCOV_EXCL_BR_STOP
+
+ for (UI_32 k = 1u; (k <= m_MapProclaunchGrps.size()); k++) {
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(k);
+
+ if (l_GroupIterator != m_MapProclaunchGrps.end()) {
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+
+ for (int i = 1u; l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++, i++) {
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::string sIsOKFlag = GetModuleCondition(l_ModuleListIterator) ? " " : // 'blank' means OK
+ "X"; // 'X' means state mismatch
+
+ l_debugDumpBuf << " " << std::setw(2) << std::right << i << " | "
+ << std::setw(24) << std::left << l_ModuleListIterator->name.c_str()
+ << " | " << std::setw(5) << std::left
+ << (l_ModuleListIterator->is_start_required ? "TRUE" : "FALSE")
+
+ << " | " << sIsOKFlag.c_str() << " | " << std::setw(24) << std::left
+ << l_ModuleListIterator->ModuleStateStr().c_str() << " | "
+ << l_ModuleListIterator->m_startReason.GetInitial() << " | "
+ << l_ModuleListIterator->m_startReason.GetFinal() << " | "
+ << std::setw(3) << std::right
+ << static_cast<SI_16>(l_ModuleListIterator->m_startReason.GetDelta())
+ << "ms" << " | " << l_ModuleListIterator->m_stopReason.GetInitial()
+ << " | " << l_ModuleListIterator->m_stopReason.GetFinal() << " | "
+ << std::setw(3)
+ << static_cast<SI_16>(l_ModuleListIterator->m_stopReason.GetDelta())
+ << "ms" << " | " << l_ModuleListIterator->pid << endl;
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ }
+
+ l_debugDumpBuf << endl << " ***Heartbeat information***" << endl;
+
+ l_debugDumpBuf << endl << " Entire State:" << m_HBReport.eEntireState << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_debugDumpBuf << endl << " Number of Modules:" << m_HBReport.nNumOfModules << endl;
+
+ for (UI_32 j = 0; j < m_HBReport.nNumOfModules; j++) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (0 != m_HBReport.tModuleList[j].HeartBeatRetryCount) {
+ l_debugDumpBuf << endl << " " << m_HBReport.tModuleList[j].ProcQueueName << ","
+ << m_HBReport.tModuleList[j].ProcHBState << ", "
+ << m_HBReport.tModuleList[j].HeartBeatRetryCount << endl;
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ std::string l_debugDumpStr = l_debugDumpBuf.str();
+
+ SendDebugDumpResponseToSystemManager(l_debugDumpStr); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessLaunchMonitorTimerExpiry
+/// This sends request to launcher thread to confirm that it
+/// is still responsive.
+///
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessLaunchMonitorTimerExpiry(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from %s", FrameworkunifiedGetMsgSrc(hApp));
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ REC_HIST_IF_SUCCESSFUL("TIMER_PROCESSLAUNCHER_MONITOR", m_TimerCmdHist, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp), l_eStatus); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ // LCOV_EXCL_BR_START 4: nsfw error
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, m_hProcLauncherThread.m_ThreadHdl,
+ ePLThrdCmd_THREAD_STATUS_REQST, 0, NULL))) {
+ // LCOV_EXCL_BR_STOP 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild(m_hProcLauncherThread.m_ThreadHdl," // LCOV_EXCL_LINE 4: nsfw error
+ "ePLThrdCmd_THREAD_STATUS_REQST)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ m_hProcLauncherThread.m_ThreadState = eSMWaitForHeartbeat;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendRequestToLauncher
+/// This function is used for sending request to launcher thread from
+/// System Manager.
+///
+/// \param HANDLE hApp
+/// ModuleLaunchListIter f_ModuleListIterator => iterator node from map for the module
+/// ESMPLThreadCommandIds f_CommandId => command id to send
+/// SS_String f_ModulePath => Path of the Module
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::PerformLaunchProcedure(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleIterator, SS_String & f_stopCompName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ SS_String s_ModuleStatus2;
+
+ // Register for Stop Complete notification
+ if (!f_ModuleIterator->shutdown_critical) {
+ s_ModuleStatus2 = "is not shutdown_critical";
+ // LCOV_EXCL_BR_START 6: For setting the initialization conditions at SystemManager startup
+
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus =
+ FrameworkunifiedSubscribeNotificationWithCallback(
+ hApp,
+ f_stopCompName.c_str(),
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStopCompleteNotification>))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSubscribeNotificationWithCallback(hApp, %s) errored: %d/'%s'",
+ f_stopCompName.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+
+ s_ModuleStatus2 = "is shutdown_critical but errored";
+ // LCOV_EXCL_STOP
+ } else {
+ s_ModuleStatus2 = f_stopCompName + " is now registered"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", s_ModuleStatus2.c_str());
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup PerformTerminateProcedure
+/// Perform Procedure for Service Terminate.
+///
+/// \param HANDLE hApp
+/// ModuleLaunchListIter f_ModuleListIterator => iterator node from map for the module
+/// SS_String & f_availabilityName => Availability Name
+/// SS_String & f_stopCompName => Stop Complete Notification Name
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::PerformTerminateProcedure(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleIterator, SS_String & f_availabilityName,
+ SS_String & f_stopCompName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // close session
+ f_ModuleIterator->SetModuleState(MODULE_STATE_INVALID);
+ f_ModuleIterator->pid = 0;
+ if (NULL != f_ModuleIterator->hsession) { // LCOV_EXCL_BR_LINE 200:hsession must not be NULL.
+ l_eStatus = FrameworkunifiedMcClose(f_ModuleIterator->hsession); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: FrameworkunifiedMcClose(%s) errored: %d/'%s'",
+ f_ModuleIterator->name.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+ f_ModuleIterator->hsession = NULL;
+ }
+
+ // Availability
+ if (f_ModuleIterator->is_start_required) {
+ // Initialize Availability
+ HANDLE pPublishMq = McOpenSender(FRAMEWORKUNIFIED_NS_NPSERVICE); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (NULL == pPublishMq) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ ServiceAvailability tServiceAvailability;
+
+ snprintf(tServiceAvailability.cServiceName, MAX_NAME_SIZE_APP, "%s",
+ f_ModuleIterator->name.c_str());
+ tServiceAvailability.eServiceAvailability = eFrameworkunifiedServiceNotAvailable;
+
+ l_eStatus = NPPublishNotification(pPublishMq, f_ModuleIterator->name.c_str(), // LCOV_EXCL_BR_LINE 4: nsfw error
+ f_availabilityName.c_str(), &tServiceAvailability, // LCOV_EXCL_BR_LINE 4: nsfw error
+ sizeof(tServiceAvailability)); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: NPPublishNotification(%s)",
+ f_availabilityName.c_str());
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = McClose(pPublishMq); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+
+ if (f_ModuleIterator->shutdown_critical) {
+ // Unregister Stop Complete notification
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedUnsubscribeNotificationWithCallback(hApp, f_stopCompName.c_str()))) { // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedUnsubscribeNotificationWithCallback(hApp, %s) errored: %d/'%s'",
+ f_stopCompName.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ SS_String s_ModuleStatus2 = f_stopCompName + " is now unregistered ";
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", s_ModuleStatus2.c_str());
+ }
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendRequestToLauncher
+/// This function is used for sending request to launcher thread from
+/// System Manager.
+///
+/// \param HANDLE hApp
+/// ModuleLaunchListIter f_ModuleListIterator => iterator node from map for the module
+/// ESMPLThreadCommandIds f_CommandId => command id to send
+/// SS_String f_ModulePath => Path of the Module
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::SendRequestToLauncher(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleIterator, ESMPLThreadCommandIds f_CommandId,
+ SS_String f_CommandIdStr) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SS_String l_ModulePath = m_BinaryFilesPath + f_ModuleIterator->path;
+
+ T_ProcessLauncherLaunchReq l_ModuleLaunchReq = { };
+ strcpy(l_ModuleLaunchReq.name, f_ModuleIterator->name.c_str()); // NOLINT
+ strcpy(l_ModuleLaunchReq.path, l_ModulePath.c_str()); // NOLINT
+ strncpy(l_ModuleLaunchReq.args, f_ModuleIterator->arguments.c_str(), // NOLINT
+ sizeof(l_ModuleLaunchReq.args) - 1);
+ strcpy(l_ModuleLaunchReq.logging_mask, // NOLINT
+ f_ModuleIterator->logging_msk_str.c_str());
+ l_ModuleLaunchReq.priority = f_ModuleIterator->configuration_priority;
+ l_ModuleLaunchReq.cpu_assign = f_ModuleIterator->cpu_assign;
+ l_ModuleLaunchReq.groupIterator = m_MapProclaunchGrps.find(
+ f_ModuleIterator->group_id);
+ l_ModuleLaunchReq.moduleIterator = f_ModuleIterator;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Queue:%s, path:%s, args:%s, lmsk:%s, prio:%d, cmd:%s", l_ModuleLaunchReq.name,
+ l_ModuleLaunchReq.path, l_ModuleLaunchReq.args, l_ModuleLaunchReq.logging_mask,
+ l_ModuleLaunchReq.priority, f_CommandIdStr.c_str());
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, m_hProcLauncherThread.m_ThreadHdl, f_CommandId, sizeof(l_ModuleLaunchReq), reinterpret_cast<void *>(&l_ModuleLaunchReq)))) { // LCOV_EXCL_BR_LINE 4: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 4: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSendChild( %s, %s ) errored: %d/'%s'", l_ModulePath.c_str(),
+ f_CommandIdStr.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ SS_String l_availabilityName = f_ModuleIterator->name + "/Availability"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SS_String l_stopCompName = f_ModuleIterator->name + "/StopComp"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // Perform command-specific processing
+ switch (f_CommandId) { // LCOV_EXCL_BR_LINE 6: Because the case is fixed on the call from the SystemManager::Initialize
+ // LCOV_EXCL_START 6: Because the case is fixed on the call from the SystemManager::Initialize
+ case ePLThrdCmd_RELAUNCH_MODULE_REQST:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = PerformTerminateProcedure(hApp, f_ModuleIterator,
+ l_availabilityName, l_stopCompName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ SS_ASERT(0);
+ }
+
+ l_eStatus = PerformLaunchProcedure(hApp, f_ModuleIterator, l_stopCompName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ SS_ASERT(0);
+ }
+ break;
+ // LCOV_EXCL_STOP
+
+ case ePLThrdCmd_LAUNCH_MODULE_REQST:
+ l_eStatus = PerformLaunchProcedure(hApp, f_ModuleIterator, l_stopCompName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup
+ }
+ break;
+
+ case ePLThrdCmd_TERMINATE_MODULE_REQST:
+ l_eStatus = PerformTerminateProcedure(hApp, f_ModuleIterator,
+ l_availabilityName, l_stopCompName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ break;
+
+ // LCOV_EXCL_START 6: Because the case is fixed on the call from the SystemManager::Initialize
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ case ePLThrdCmd_LAUNCH_MODULE_RESP:
+ case ePLThrdCmd_MODULE_STATUS_REQST:
+ case ePLThrdCmd_RELAUNCH_MODULE_RESP:
+ case ePLThrdCmd_TERMINATE_MODULE_RESP:
+ case ePLThrdCmd_THREAD_STATUS_REQST:
+ case ePLThrdCmd_THREAD_STATUS_RESP:
+ case ePLThrdCmd_NONE:
+ break;
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::SendRequestToLauncher(
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup RemoveModuleEntryFromHB
+/// This function is called to send module information to heart beat thread
+/// which is to be removed from its list of services to be monitored.
+///
+/// \param HANDLE hApp,
+/// const CHAR *f_ModuleName => Module Name
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::RemoveModuleEntryFromHB(HANDLE hApp, const CHAR *f_ModuleName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ HBListIter l_HBIter = std::find(m_HBList.begin(), m_HBList.end(), f_ModuleName);
+ if (l_HBIter != m_HBList.end()) {
+ m_HBList.erase(l_HBIter);
+ }
+
+ TSMRequestMessage l_ModuleDetails;
+ strncpy(l_ModuleDetails.pstModuleName, f_ModuleName,
+ sizeof(l_ModuleDetails.pstModuleName) - 1);
+ l_ModuleDetails.pstModuleName[sizeof(l_ModuleDetails.pstModuleName) - 1] = '\0';
+ l_eStatus = SendRequestToHeartBeat(hApp, SS_HEARTBEAT_DELETE_MODULE_ENTRY,
+ &l_ModuleDetails, sizeof(TSMRequestMessage));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnHeartBeatThreadHeartbeatResponse
+/// This function gets called when heart beat thread replies the
+/// heart beat query sent by the System Manager.
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnHeartBeatThreadHeartbeatResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "HeartBeat HeartBeat Received");
+ m_hHeartbeatThread.m_ThreadState = eSMThreadIsFine;
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnCheckAvailResponse
+/// This function gets service's availability status from HBThread
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnCheckAvailResponse(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ THbAvailCheck result;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < THbAvailCheck > (hApp, result))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_tempaltes.h // NOLINT(whitespace/line_length)
+ } else if (result.isOk == FALSE) {
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessLauncherThreadHeartbeatResponse
+/// This function gets called when launcher thread replies the
+/// heart beat query sent by the System Manager.
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessLauncherThreadHeartbeatResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "ProcessLaunch HeartBeat Received");
+ m_hProcLauncherThread.m_ThreadState = eSMThreadIsFine;
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup RegisterCallbacksForRequester
+/// Register callbacks for External Protocol commands
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::RegisterCallbacksForRequester(HANDLE hApp, PCSTR f_pRequester) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Attach Session Protocol messages.
+ FrameworkunifiedProtocolCallbackHandler l_sm_protocol_handlers[] = {
+ // Command ID, Call back functions
+ { SS_SM_START_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStartCompleteResponse> },
+ { SS_SM_STOP_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStopCompleteResponse> },
+ { SS_SM_PRE_START_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStartCompleteResponse> },
+ { SS_SM_PRE_STOP_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStartCompleteResponse> },
+ { SS_SM_BACKGROUND_START_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStartCompleteResponse> },
+ { SS_SM_BACKGROUND_STOP_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStartCompleteResponse> },
+ { SS_SM_GET_START_EXT_INFO, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnGetStartExtInfo> },
+ { SS_SM_GET_STOP_EXT_INFO, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnGetStopExtInfo> },
+ { SS_SM_CRNT_STATE_QUERY, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnCurrentSMStateQuery> },
+ { SS_SM_DATA_RESET_MODE_SET_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnSetDataResetModeRequest> },
+ { SS_SM_PROG_UPDATE_STATE_SET_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnSetProgUpdateStateRequest> },
+
+ { SS_SM__CWORD56__HEARTBEAT_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::On_CWORD56_HeartBeatRequest> },
+ { SS_SM_NEXT_WAKEUP_TYPE_SET_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnSetNextWakeupTypeRequest> },
+ // Error Event Logging
+ { SS_SM_ERROR_EVENT_LOGGING_START_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnLoggingStartRequest> },
+ { SS_SM_ERROR_EVENT_ARTIFACT_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnErrorEventArtifactRequest> },
+ { SS_SM_ERROR_EVENT_LOGGING_COMPLETE, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnErrorEventLoggingComplete> },
+ { SS_SM_DEBUG_DUMP_RSPN, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnDebugDumpResponseReceived> },
+ { SS_SM_PROPAGATE_SYSTEM_ERROR, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnPropagateSystemError> },
+ { SS_SM_BOOT_MICRO_RESET_NTF, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnBootMicroResetNotification> },
+ { SS_SM_BOOT_MICRO_LOG_RSP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnBootMicroLogResponse> },
+ { SS_SM_USER_INVOKED_LOG_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnUserInvokedLoggingRequest> },
+ { SS_SM_ERROR_EVENT_EEL_EXPORT_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnEelExportRequest> },
+ { SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnSystemmanagerEmmcLogsRequest> },
+ { SS_SM_ERROR_EVENT_CLR_LOGS_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnSystemmanagerClearLogsRequest> },
+ { SS_SM_ERROR_EVENT_DIAG_LOG_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnDiagLoggingRequest> },
+ { SS_SM_ERROR_EVENT_CAN_LOG_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnCANLoggingRequest> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp, f_pRequester,
+ l_sm_protocol_handlers, static_cast<UI_32>(_countof(l_sm_protocol_handlers))); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedAttachCallbacksToDispatcher(%s) errored: %d/'%s'", f_pRequester,
+ l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::RegisterCallbacksForRequester( HANDLE hApp, PCSTR f_pRequester)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup open_session_with_sm_test_client
+/// Process request to open session with sm test client
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::open_session_with_sm_test_client(HANDLE hApp, PCSTR pRequester) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ UI_32 const l_ui32DefaultSessionID = 0;
+ OpenSessionAck tOpenAck = { };
+
+/*
+ * Here pRequester is SMTesteClient with whom session is opened and its handle is stored in m_hPowerServiceSession handle.
+ * This case comes only while testing SystemManager through SMTestClient (PowerService should not be running).
+ */
+ // Validate session handle
+ if (NULL == m_hPowerServiceSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Session Handle NULL, calling FrameworkunifiedMcOpenSender for %s", pRequester);
+
+ m_hPowerServiceSession = FrameworkunifiedMcOpenSender(hApp, pRequester);
+ //
+ // Set the Session Handle for Framework so FrameworkunifiedSendResponse won't error due to a null
+ // session handle.
+ //
+ // LCOV_EXCL_BR_START 4:NSFW's error
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSetSessionHandle(hApp,
+ pRequester, // [in] PCSTR - Name of the associated service name
+ m_hPowerServiceSession))) { // [in] HANDLE - Session handle
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSetSessionHandle(%s) errored: %d/'%s'", pRequester,
+ l_eStatus, GetStr(l_eStatus).c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (m_hPowerServiceSession == NULL) { // LCOV_EXCL_BR_LINE 200:m_hPowerServiceSession must not be NULL
+ // LCOV_EXCL_START 200:m_hPowerServiceSession must not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Invalid Session Handle to service (%s) ", pRequester);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Session opened with %s", pRequester);
+
+ // Copy session name to data structure
+ strncpy(tOpenAck.cSessionName, FrameworkunifiedGetAppName(hApp),
+ sizeof(tOpenAck.cSessionName) - 1);
+ tOpenAck.eStatus = eFrameworkunifiedStatusOK;
+ tOpenAck.sessionId = l_ui32DefaultSessionID;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "About to send Open Session ACK");
+ // send OpenSession ACK
+ // LCOV_EXCL_BR_START 4:NSFW's error
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession,
+ PROTOCOL_OPEN_SESSION_ACK, sizeof(OpenSessionAck),
+ (PVOID) & tOpenAck))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendMsg(PROTOCOL_OPEN_SESSION_ACK)");
+
+ // Close the message queue handle
+ if (NULL != m_hPowerServiceSession) {
+ CALL_AND_LOG_STATUS_IF_ERRORED(FrameworkunifiedMcClose(m_hPowerServiceSession));
+ m_hPowerServiceSession = NULL;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ CALL_AND_LOG_STATUS_IF_ERRORED(RegisterCallbacksForRequester(hApp, pRequester));
+ }
+ } // end of else block of if(l_ModuleListIterator->hsession == NULL)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnOpenSession
+/// Process request to open session
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnOpenSession(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 const l_ui32DefaultSessionID = 0;
+ UI_32 const l_ui32DefaultSessionType = 0;
+ OpenSessionAck tOpenAck = { };
+ PCSTR pRequester = FrameworkunifiedGetMsgSrc(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "%s", pRequester);
+
+ ModuleLaunchListIter l_ModuleListIter;
+
+ REC_HIST_IF_SUCCESSFUL("PROTOCOL_OPEN_SESSION_REQ", m_SMCmdHist, m_SMHistIter, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ FrameworkunifiedGetMsgSrc(hApp), l_eStatus); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = GetModuleIterator(pRequester, l_ModuleListIter);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ // Special handling for open session request from SMTestClient.
+ if ((0 == strcmp(TC_SysManager, pRequester))) {
+ open_session_with_sm_test_client(hApp, pRequester);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s not found in Group Launch Map",
+ pRequester);
+ }
+ } else {
+ /**********************************************************************/
+ if (0 != l_ModuleListIter->pid) {
+ UI_32 l_ClientPriority;
+ l_eStatus = l_ModuleListIter->GetPriority(l_ClientPriority);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("l_ModuleListIter->GetPriority( l_ClientPriority )"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (l_ClientPriority != l_ModuleListIter->configuration_priority) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Changing %s's priority from %d to %d",
+ pRequester, l_ClientPriority,
+ l_ModuleListIter->configuration_priority);
+ CALL_AND_LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_ModuleListIter->SetPriority( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_ModuleListIter->configuration_priority)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ /**********************************************************************/
+
+ // ToDo Jay 2013 Jan 09 REPLACE WITH CORRECT SERVICE / SESSION HANDLE
+ // LOGIC
+ // validate session handle
+ if (NULL == l_ModuleListIter->hsession) {
+ // LCOV_EXCL_BR_START 4: nsfw error
+ if (NULL == (l_ModuleListIter->hsession = FrameworkunifiedMcOpenSender(hApp, pRequester))) {
+ // LCOV_EXCL_BR_STOP 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedMcOpenSender(App %s, %s) returned NULL",
+ FrameworkunifiedGetAppName(hApp), pRequester);
+ return eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ /*
+ * Currently System Manager does not support multiple sessions from same client.
+ * When a client gets restarted after Crash or after missing HeartBeat, System Manager
+ * would receive OpenSession request from that client even when System Manager already
+ * has a open session with that client.
+ */
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Repeated Session Opening Request from %s", pRequester);
+ }
+ if (eFrameworkunifiedStatusOK != (l_eStatus = RegisterCallbacksForRequester(hApp, pRequester))) {
+ // Close the message queue handle
+ if (NULL != l_ModuleListIter->hsession) { // LCOV_EXCL_BR_LINE 6: Due to NULL checking
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedMcClose(l_ModuleListIter->hsession))) {
+ LOG_ERROR("FrameworkunifiedMcClose()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ l_ModuleListIter->hsession = NULL;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+
+ // Copy session name to data structure
+ strncpy(tOpenAck.cSessionName, FrameworkunifiedGetAppName(hApp), sizeof(tOpenAck.cSessionName) - 1);
+ tOpenAck.eStatus = eFrameworkunifiedStatusOK;
+ tOpenAck.sessionId = l_ui32DefaultSessionID;
+ tOpenAck.sessionType = l_ui32DefaultSessionType;
+
+ // send OpenSession ACK
+ // LCOV_EXCL_BR_START 4: nsfw error
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_ModuleListIter->hsession,
+ SS_SM_PROTOCOL_OPEN_SESSION_ACK, sizeof(OpenSessionAck),
+ (PVOID) & tOpenAck))) { // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSendMsg( %s, SS_SM_PROTOCOL_OPEN_SESSION_ACK)"
+ " errored: %d/'%s'", l_ModuleListIter->name.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+
+ if (NULL != l_ModuleListIter->hsession) {
+ // Close the message queue handle
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedMcClose(l_ModuleListIter->hsession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedMcClose(%s) errored: %d/'%s'",
+ l_ModuleListIter->name.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ }
+ l_ModuleListIter->hsession = NULL;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ // Store PowerService session handle in class so it can be accessed faster
+ // to use opened session while replying to PowerService.
+ if ((0 == strcmp(SERVICE_POWER, pRequester))) {
+ m_hPowerServiceSession = l_ModuleListIter->hsession;
+ }
+
+ l_ModuleListIter->SetModuleState(MODULE_STATE_CONNECTED);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " SM State: %s, %s.is_start_required: %s",
+ GetStr(m_SMCurrentState).c_str(), l_ModuleListIter->name.c_str(),
+ GetStr(l_ModuleListIter->is_start_required).c_str());
+
+ if (l_ModuleListIter->is_start_required
+ && ((SS_SM_APPS_START_IN_PROGRESS == m_SMCurrentState)
+ || (SS_SM_APPS_START_COMPLETE == m_SMCurrentState))) {
+ T_SS_SM_START_DataStructType f_startupData(m_StartUpReason,
+ m_PowerType_to_SSBoolEnumMap[m_Wake.powerupType], m_DataResetMode,
+ m_startUpConfirmationMsg.securityStatus,
+ m_startUpConfirmationMsg.wakeupType, m_DramBackupStatus,
+ m_ResetStatus, m_ResetCount);
+ const UI_32 l_iCmd = InProgressStateToSendMsg();
+ if (l_iCmd != SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX) {
+ CALL_AND_LOG_STATUS_IF_ERRORED(l_ModuleListIter->SendMsgAndUpdateState(l_iCmd, &f_startupData)); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ std::string l_Subscriber;
+ l_Subscriber = FrameworkunifiedGetMsgSrc(hApp);
+
+ // check if the heart beat subscriber is already in list
+ HBListIter l_HBIter = std::find(m_HBList.begin(), m_HBList.end(), l_Subscriber);
+ if (l_HBIter == m_HBList.end()) {
+ m_HBList.push_back(l_Subscriber);
+ }
+ if (m_SMCurrentState == SS_SM_APPS_START_COMPLETE) {
+ TSMRequestMessage l_ModuleDetails;
+ snprintf(l_ModuleDetails.pstModuleName, sizeof(l_ModuleDetails.pstModuleName),
+ "%s", l_Subscriber.c_str());
+ l_eStatus = SendRequestToHeartBeat(hApp, SS_HEARTBEAT_APPEND_MODULE_ENTRY,
+ &l_ModuleDetails, sizeof(TSMRequestMessage));
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "SendRequestToHeartBeat()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// ConstructGetResultResponse
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::add_state_information_to_response(CHAR *f_MessageResponse) const {
+ const CHAR ReadyToLaunchAppDescription[] = "_READY_TO_LAUNCH:";
+ const CHAR StartInProgressDescription[] = "_START_IN_PROGRESS:";
+ const CHAR LaunchInProgressDescription[] = "_LAUNCH_IN_PROGRESS:";
+ const CHAR LaunchedReadyToStartDescription[] = "_READY_TO_START:";
+ const CHAR StopInProgressDescription[] = "_STOP_IN_PROGRESS:";
+ const CHAR StartCompleteDescription[] = "_START_COMPLETED:";
+ const CHAR WaitingForCriticalAppsToStopDescription[] = "_WAITING_FOR_CRITICAL_APPS_TO_STOP:";
+ const CHAR PreStartInProgressDescription[] = "_PRE_START_IN_PROGRESS:";
+ const CHAR PreStopInProgressDescription[] = "_PRE_STOP_IN_PROGRESS:";
+ const CHAR PreRunCompleteDescription[] = "_PRE_RUN_COMPLETE:";
+ const CHAR BackgroundStartInProgressDescription[] = "_BACKGROUND_START_IN_PROGRESS:";
+ const CHAR BackgroundStopInProgressDescription[] = "_BACKGROUND_STOP_IN_PROGRESS:";
+ const CHAR BackgroundRunCompleteDescription[] = "_BACKGROUND_RUN_COMPLETE:";
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR l_Buffer[5];
+ UI_32 l_Index = 0;
+
+ std::map<SS_SMModuleState, std::string> StateMap; // State Map
+ StateMap[SS_SM_READY_TO_LAUNCH_APP] = ReadyToLaunchAppDescription;
+ StateMap[SS_SM_APPS_LAUNCH_IN_PROGRESS] = LaunchInProgressDescription;
+ StateMap[SS_SM_APPS_LAUNCHED_READY_TO_START] = LaunchedReadyToStartDescription;
+ StateMap[SS_SM_APPS_START_IN_PROGRESS] = StartInProgressDescription;
+ StateMap[SS_SM_APPS_START_COMPLETE] = StartCompleteDescription;
+ StateMap[SS_SM_APPS_STOPPING_AT__CWORD56__REQ] = StopInProgressDescription;
+ StateMap[SS_SM_APPS_STOPPING_AT_INTERNAL_REQ] = StopInProgressDescription;
+ StateMap[SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ] =
+ WaitingForCriticalAppsToStopDescription;
+ StateMap[SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ] =
+ WaitingForCriticalAppsToStopDescription;
+ StateMap[SS_SM_APPS_PRE_START_IN_PROGRESS] = PreStartInProgressDescription;
+ StateMap[SS_SM_APPS_PRE_STOP_IN_PROGRESS] = PreStopInProgressDescription;
+ StateMap[SS_SM_APPS_PRE_RUN_COMPLETE] = PreRunCompleteDescription;
+ StateMap[SS_SM_APPS_BACKGROUND_START_IN_PROGRESS] = BackgroundStartInProgressDescription;
+ StateMap[SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS] = BackgroundStopInProgressDescription;
+ StateMap[SS_SM_APPS_BACKGROUND_RUN_COMPLETE] = BackgroundRunCompleteDescription;
+
+ itoa(m_SMCurrentState, l_Buffer, 16);
+ while (l_Buffer[l_Index]) {
+ l_Buffer[l_Index] = toupper(l_Buffer[l_Index]);
+ l_Index++;
+ }
+
+ if (SS_SM_MAX_RESP_MSG_SIZE > (strlen(f_MessageResponse) + sizeof(l_Buffer)
+ + StateMap[m_SMCurrentState].length() + 1)) {
+ strncat(f_MessageResponse, l_Buffer, sizeof(l_Buffer));
+ strncat(f_MessageResponse, StateMap[m_SMCurrentState].c_str(),
+ StateMap[m_SMCurrentState].length());
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// ConstructGetResultResponse
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::construct_get_result_response(CHAR *f_MessageResponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ const EFrameworkunifiedStatus eStatus = add_state_information_to_response(f_MessageResponse);
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Response Constructed");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// REC_HIST_IF_SUCCESSFUL / SetCmdHist
+///
+///
+//////////////////////////////////////////////////////////////////////
+void CSystemManager::SetCmdHist(std::string cmd, cmdHist &hist, cmdHistIter &it, std::string sender) {
+ UI_64 l_time = 0XDEAD;
+ CTimeSpan* timerClass = new (std::nothrow) CTimeSpan(); // LCOV_EXCL_BR_LINE 5: Because new cannot fail
+ if (NULL == timerClass) { // LCOV_EXCL_BR_LINE 5: Because new cannot fail
+ // LCOV_EXCL_START 5: Because new cannot fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " 'new (std::nothrow) CTimeSpan()' returned NULL, "
+ "'it->m_time' being set to 0xDEAD");
+ // LCOV_EXCL_STOP
+ } else {
+ l_time = timerClass->GetTimeMilliseconds();
+ }
+
+ pthread_mutex_lock(&sm_hist_mutex);
+
+ it->m_time = l_time;
+ it->m_cmd = cmd;
+ it->m_sender = sender;
+ it++;
+
+ if (it != hist.end()) { // LCOV_EXCL_BR_LINE 5: std: because it is a member of a vector and it is difficult to create a failing condition
+ it = hist.begin();
+ }
+
+ pthread_mutex_unlock(&sm_hist_mutex);
+
+ delete timerClass; // LCOV_EXCL_BR_LINE 5: Because the delete cannot fail
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnCurrentPowerStateQuery
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnCurrentSMStateQuery(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Received from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SS_SMCurrentState l_CurrentState;
+
+ REC_HIST_IF_SUCCESSFUL("SS_SM_CRNT_STATE_QUERY", m_SMCmdHist, m_SMHistIter,
+ FrameworkunifiedGetMsgSrc(hApp), l_eStatus);
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < SS_SMCurrentState > (hApp, l_CurrentState))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else {
+ construct_get_result_response(l_CurrentState.respMsgString);
+
+ ModuleLaunchListIter l_ModuleListIter;
+ PCSTR l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ if (eFrameworkunifiedStatusOK != (l_eStatus = GetModuleIterator(l_moduleName, l_ModuleListIter))) { // LCOV_EXCL_BR_LINE 200: can not be other value // NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 200: can not be other value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map", l_moduleName);
+ // LCOV_EXCL_STOP
+ } else if (l_ModuleListIter->hsession != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL // NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(l_ModuleListIter->hsession, // LCOV_EXCL_BR_LINE 4: nsfw error
+ SS_SM_CRNT_STATE_QUERY_RSPN, sizeof(SS_SMCurrentState),
+ (PVOID) & l_CurrentState))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendMsg(SS_SM_CRNT_STATE_QUERY_RSPN)"); // LCOV_EXCL_LINE 4: nsfw error
+ }
+ } else {
+ // LCOV_EXCL_START 200: can not be NUL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " NULL == hsession; %s not connected yet",
+ l_ModuleListIter->name.c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::GetVersionNumber(SS_VersionNumberType & f_VersionNumber) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ CSMVersion cVersion;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = cVersion.get_version(f_VersionNumber))) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ LOG_ERROR("cVersion.get_version()"); // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::GetVersionNumber( SS_VersionNumberType
+
+EFrameworkunifiedStatus CSystemManager::GetBuildInfo(std::string &f_BuildInfoStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ CSMVersion cVersion;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = cVersion.get_build_info(f_BuildInfoStr))) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ LOG_ERROR("cVersion.get_build_info()"); // LCOV_EXCL_BR_LINE 6:For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::GetBuildInfo(std::string)
+
+bool CSystemManager::GetDramPowerStatusInfo(const HANDLE h_app) {
+ PsmDramStsT l_dram_sts = PSM_DRAM_STS_NORMAL;
+ bool ret = false;
+
+ // Checking dram power status.
+ if (PsmGetDramPowerSupplyAbnormalityCheckResultPower(h_app, &l_dram_sts))
+ return ret;
+
+ if (l_dram_sts == PSM_DRAM_STS_NORMAL)
+ ret = true;
+
+ return ret;
+}
+
+bool CSystemManager::GetDramStoreStatusInfo(const HANDLE h_app) {
+ PsmSysupDramT l_dram1 = PSM_SYSUP_DRAM_NORMAL;
+ PsmSysupDramT l_dram2 = PSM_SYSUP_DRAM_NORMAL;
+ PsmSysupDramT l_dram3 = PSM_SYSUP_DRAM_NORMAL;
+ PsmStartStatusT l_sts = PSM_START_STATUS_FACTRESET;
+
+ bool ret = false;
+
+ // Checking factory shipment status
+ if (PsmGetStartStatusPower(h_app, &l_sts))
+ return ret;
+
+ if (l_sts == PSM_START_STATUS_FACTRESET) {
+ ret = true;
+ goto finish;
+ }
+
+ // Checking dram power
+ if (!GetDramPowerStatusInfo(h_app))
+ goto finish;
+
+ // Checking dram status.
+ if (PsmGetDramBackupStatusPower(h_app, &l_dram1, &l_dram2, &l_dram3))
+ goto finish;
+
+ // l_dram2 and l_dram3 would be ignored.
+ if (l_dram1 == PSM_SYSUP_DRAM_NORMAL)
+ ret = true;
+
+ if (l_dram2 == PSM_SYSUP_DRAM_SFTERRSR)
+ ret = true;
+
+finish:
+ return ret;
+}
+
+bool CSystemManager::GetSyscomPowerStatusInfo(const HANDLE h_app) {
+ PsmComStsT l_syscom_sts = PSM_COM_STS_NORMAL;
+ bool ret = false;
+
+ if (PsmGetSyscomStatusPower(h_app, &l_syscom_sts))
+ return ret;
+
+ if (l_syscom_sts == PSM_COM_STS_NORMAL)
+ ret = true;
+
+ return ret;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnSetStartupConfirmationDataRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+ EFrameworkunifiedStatus l_eStatus;
+ Pwr_ServiceSetInterface tServiceSetIf;
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg < Pwr_ServiceSetInterface > (hApp, tServiceSetIf))) { // LCOV_EXCL_BR_LINE 4:NSFW's error
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ m_startUpConfirmationMsg = tServiceSetIf.data.startupConfirmationMsg;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s Startup Confirmation data:", FrameworkunifiedGetMsgSrc(hApp));
+ SYSTEMMANAGERLOG_StartupConfirmationMsg(m_startUpConfirmationMsg); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ DGCODE_RET_API l_ret = DGCODE_RET_ERROR;
+
+ l_ret = Diag_StartupAllStatusOfDTC();
+ if (l_ret == DGCODE_RET_ERROR) {
+ LOG_ERROR("Diag_StartupAllStatusOfDTC()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ if ((e_SS_SM_NEXT_WAKEUP_TYPE_COLD == m_NextWakeupType) && (epsstCOLDSTART != m_startUpConfirmationMsg.wakeupType)) { // LCOV_EXCL_BR_LINE 6: Because the above formula cannot be set to true // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "WakeupType Change to Cold by Svc Request");
+ m_startUpConfirmationMsg.wakeupType = epsstCOLDSTART;
+ // LCOV_EXCL_STOP
+ }
+
+ m_ResetStatus = ((m_isIlgReset == TRUE) ?
+ e_SS_SM_RESET_STATUS_NG :
+ ((m_isImmediateReset == TRUE) ?
+ e_SS_SM_RESET_STATUS_IMMEDIATE : e_SS_SM_RESET_STATUS_NONE));
+ if (e_SS_SM_RESET_STATUS_NG == m_ResetStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "ResetStatus NG illRst:%s lastErr:Not Support",
+ m_isIlgReset ? "TRUE" : "FALSE");
+ m_ResetCount++;
+ if (PowerHalSetResetInfo(AGL_RESET_COUNTER, m_ResetCount)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not back up m_ResetCount(%lu) to power_hal", m_ResetCount);
+ }
+ }
+
+ m_DramBackupStatus =
+ ((epsstWARMSTART != m_startUpConfirmationMsg.wakeupType)
+ || (e_SS_SM_DATA_RESET_MODE_FACTORY == m_DataResetMode)
+ || (GetDramStoreStatusInfo(hApp) == false)) ?
+ e_SS_SM_DRAM_BACKUP_NG : e_SS_SM_DRAM_BACKUP_OK;
+
+ if (e_SS_SM_DRAM_BACKUP_NG == m_DramBackupStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "DramBackup NG wakeupType:%s dataResetMode:%s",
+ (epsstWARMSTART == m_startUpConfirmationMsg.wakeupType) ?
+ "WARM" : "COLD",
+ (e_SS_SM_DATA_RESET_MODE_FACTORY == m_DataResetMode) ?
+ "FACTORY" : "NotFactory");
+ }
+
+ if (m_needReNotifyStartPrm) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be satisfied from the external API
+ // LCOV_EXCL_BR_START 6: Because both sides are not FALSE
+ if (e_SS_SM_DRAM_BACKUP_NG == m_DramBackupStatus) {
+ // LCOV_EXCL_BR_STOP
+ m_DramBackupStatus = e_SS_SM_DRAM_BACKUP_NG;
+ }
+ }
+
+ if (m_needReNotifyStartPrm) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be satisfied from the external API
+ if (e_SS_SM_RESET_STATUS_NG == m_ResetStatus) {
+ // do nothing, keep m_ResetStatus.
+ } else if (e_SS_SM_RESET_STATUS_IMMEDIATE == m_ResetStatus) {
+ // do nothing, keep m_ResetStatus.
+ } else {
+ m_ResetStatus = e_SS_SM_RESET_STATUS_NONE;
+ }
+
+ if (epsstWARMSTART != m_startUpConfirmationMsg.wakeupType) { // LCOV_EXCL_BR_LINE 6: Because the above condition cannot be satisfied // NOLINT(whitespace/line_length)
+ m_startUpConfirmationMsg.wakeupType = epsstCOLDSTART;
+ }
+ }
+
+ CALL_AND_LOG_STATUS(ClearDramBackupInfo(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "\n"
+ "start prm\n"
+ "dramBackupStatus = %s\n"
+ "wakeupType = %s\n"
+ "dataResetMode = %s\n"
+ "resetStatus = %s\n"
+ "resetCount = %d\n"
+ "progUpdateState = %d",
+ (m_DramBackupStatus == e_SS_SM_DRAM_BACKUP_OK) ? "OK" : "NG",
+ (m_startUpConfirmationMsg.wakeupType == epsstWARMSTART) ? "WARM" : "COLD",
+ (m_DataResetMode == e_SS_SM_DATA_RESET_MODE_FACTORY) ? "FACT" :
+ (m_DataResetMode == e_SS_SM_DATA_RESET_MODE_USER) ? "USER" :
+ (m_DataResetMode == e_SS_SM_DATA_RESET_MODE_PROGUPDATE) ? "PROG" : "NONE",
+ (m_ResetStatus == e_SS_SM_RESET_STATUS_IMMEDIATE) ? "IMM" :
+ (m_ResetStatus == e_SS_SM_RESET_STATUS_NONE) ? "NONE" : "NG", m_ResetCount,
+ m_ProgUpdateState);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedNPPublishNotification(hApp, NTFY_SSSystemMgrStartUpType, &m_startUpConfirmationMsg.wakeupType, sizeof(EPWR_SC_WAKEUP_TYPE)))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedNPPublishNotification(%s, %s) errored: %d/'%s'",
+ NTFY_SSSystemMgrStartUpType,
+ GetStr(m_startUpConfirmationMsg.wakeupType).c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " FrameworkunifiedNPPublishNotification(%s, %s) successful",
+ NTFY_SSSystemMgrStartUpType,
+ GetStr(m_startUpConfirmationMsg.wakeupType).c_str());
+
+ // LCOV_EXCL_BR_START 200: As there are no cases other than eFrameworkunifiedStatusOK
+ REC_HIST_IF_SUCCESSFUL("SM/StartUpType",
+ m_PubCmdHist, m_PubHistIter, "", l_eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+
+ EFrameworkunifiedStatus l_responseStatus = l_eStatus;
+
+ ModuleLaunchListIter l_ModuleListIter;
+ PCSTR l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ if (eFrameworkunifiedStatusOK != (l_eStatus = GetModuleIterator(l_moduleName, l_ModuleListIter))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map", l_moduleName);
+ } else if (l_ModuleListIter->hsession != NULL) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(l_ModuleListIter->hsession, // LCOV_EXCL_BR_LINE 4:NSFW's error
+ SS_SM_FWD_START_CONFIRMATION_MSG_RESP, sizeof(EFrameworkunifiedStatus),
+ (PVOID) & l_responseStatus))) {
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendMsg(SS_SM_FWD_START_CONFIRMATION_MSG_RESP)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " NULL == hsession; %s not connected yet", l_ModuleListIter->name.c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnSetStartupConfirmationDataRequest( HANDLE hApp )
+
+EFrameworkunifiedStatus CSystemManager::GetTimeStamp(std::string& TimeStamp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CHAR format[256] = { '\0' };
+ CHAR l_format[256] = { '\0' };
+ struct timeb timebuf;
+ uint32_t time;
+ uint8_t status;
+ struct tm theTime;
+ ftime(&timebuf);
+ Clock_getSystemTimeY2K38(&time, &status);
+ CLOCK_RETURN clock_ret = Clock_CnvSecToDateY2K38(&time, &theTime);
+
+ if (CLOCK_OK != clock_ret) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ sprintf(l_format, "GMT Time,%04d-%02d-%02d %02d:%02d:%02d.%hu\n", // NOLINT
+ theTime.tm_year + 1900, theTime.tm_mon + 1, theTime.tm_mday,
+ theTime.tm_hour, theTime.tm_min, theTime.tm_sec, timebuf.millitm);
+
+ struct timespec timeSpec;
+
+ if (0 != clock_gettime(CLOCK_MONOTONIC, &timeSpec)) {
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ time_t timeInSecs = timeSpec.tv_sec;
+ sprintf(format, "Elaps Time,%ld:%02ld:%02ld\n", (timeInSecs / 3600), // NOLINT
+ ((timeInSecs % 3600) / 60), (timeInSecs % 60));
+ }
+
+ TimeStamp.clear();
+ TimeStamp.assign(format);
+ TimeStamp.append(l_format);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+VOID CSystemManager::SYSTEMMANAGERLOG_StartupConfirmationMsg(EPWR_SC_MSG_STRUCT & f_scMsg) {
+ std::stringstream l_enumStr;
+ l_enumStr << endl;
+ l_enumStr << " HostProcSoftVer:" << hex << std::setw(16) << std::setfill('0')
+ << m_VersionNumberStruct.m_VersionNumber << endl;
+ l_enumStr << " _CWORD56_ Boot Mode:" << GetStr(f_scMsg._CWORD56_BootMode) << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_enumStr << " wakeupType :" << GetStr(f_scMsg.wakeupType); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s", l_enumStr.str().c_str());
+} // End of VOID CSystemManager::SYSTEMMANAGERLOG_StartupConfirmationMsg( EPWR_SC_MSG_STRUCT & f_scMsg )
+
+VOID CSystemManager::LogESystemmanagerStatusEnums() {
+ #define INITIAL_INDEX eFrameworkunifiedStatusEmptyMediaList
+ #define FINAL_INDEX eFrameworkunifiedStatusErrNoEINTR
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::stringstream l_enumStr;
+ for (int i = INITIAL_INDEX; i <= FINAL_INDEX; i++) {
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_enumStr << "\n" << "0x" << std::setfill('0') << std::setw(8) << hex << i
+ << "/" << std::setfill(' ') << std::setw(2) << dec << i << ": "
+ << GetStr(static_cast<EFrameworkunifiedStatus>(i));
+ // LCOV_EXCL_BR_STOP
+ }
+
+ std::string l_logMsg = l_enumStr.str();
+ SystemmanagerLogString(ZONE_INFO, __FUNCTION__, l_logMsg); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+#undef INITIAL_INDEX
+#undef FINAL_INDEX
+} // End of VOID CSystemManager::LogESystemmanagerStatusEnums()
+
+VOID CSystemManager::LogProtocolIDs() {
+#define INITIAL_INDEX SS_SYSTEM_MANAGER_PROTOCOL_BEGINNING_INDEX
+#define FINAL_INDEX SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::stringstream l_enumStr;
+ for (int i = INITIAL_INDEX; i <= FINAL_INDEX; i++) {
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_enumStr << "\n" << "0x" << std::setfill('0') << std::setw(8) << hex << i
+ << "/" << std::setfill(' ') << std::setw(2) << dec << i << ": "
+ << GetStr(static_cast<SS_SystemManagerProtocol>(i));
+ // LCOV_EXCL_BR_STOP
+ }
+
+ std::string l_logMsg = l_enumStr.str();
+ SystemmanagerLogString(ZONE_INFO, __FUNCTION__, l_logMsg); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+#undef INITIAL_INDEX
+#undef FINAL_INDEX
+} // End of VOID CSystemManager::LogProtocolIDs()
+
+VOID CSystemManager::SystemmanagerLogString(TFrameworkunifiedZone f_zone, PCSTR f_func, std::string &f_text) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_offset = 0;
+ UI_32 l_msgLenMax = MAX_QUEUE_MSG_SIZE - 512; // Leave space for the appending of
+ // the NSLog date/time/service/line string.
+
+ if (f_text.at(f_text.length() - 1) == '\n') { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ f_text.erase(f_text.length() - 1); // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup
+ }
+
+ while (l_offset < f_text.size()) {
+ UI_32 l_charsRem = static_cast<UI_32>(f_text.size() - l_offset);
+ UI_32 l_msgLen = (l_charsRem > l_msgLenMax) ? // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ l_msgLenMax : l_charsRem; // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ std::string l_msgStr = f_text.substr(l_offset, l_msgLen);
+ size_t l_newLinePos = l_msgStr.find_last_of("\n", l_msgLen);
+ if ((l_newLinePos != std::string::npos) && (l_charsRem > l_msgLenMax)) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_msgStr = f_text.substr(l_offset, l_newLinePos);
+ l_offset += static_cast<UI_32>(l_newLinePos);
+ // LCOV_EXCL_STOP
+ } else {
+ l_offset += l_msgLen;
+ }
+
+ FRAMEWORKUNIFIEDLOG(f_zone, f_func, l_msgStr.c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // LCOV_EXCL_BR_LINE 10: Final line
+
+// End of /SS_SystemManager/src/ss_system_manager.cpp
diff --git a/systemservice/system_manager/server/src/ss_system_manager_callbacks.cpp b/systemservice/system_manager/server/src/ss_system_manager_callbacks.cpp
new file mode 100755
index 0000000..2e597ce
--- /dev/null
+++ b/systemservice/system_manager/server/src/ss_system_manager_callbacks.cpp
@@ -0,0 +1,3411 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager business logic.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <sys/wait.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <system_service/ss_system_manager_notifications_local.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_power_service_if.h>
+#include <processlauncher/ProcessLauncher.h>
+#include <processlauncher/ss_sm_process_launcher_protocol.h>
+#include <processlauncher/ss_sm_process_launcher.h>
+#include <heartbeat/ss_hb_thread.h>
+
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service_protocol.h>
+
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_backup.h>
+
+#include <stub/ss_diag.h>
+
+#include <system_service/ss_error_message.h>
+#include <system_service/ss_test_clients.h>
+#include <system_service/ss_templates.h>
+#include <native_service/ns_plogger_if.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <iomanip>
+#include <vector>
+#include <algorithm>
+#include <string>
+
+#include "ss_system_manager_callbacks.h"
+#include "ss_system_manager.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_config.h"
+
+using namespace std; // NOLINT
+
+extern SS_String GetStr(SS_SMModuleState f_enum);
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus SysMgrCallback(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ C * pObj = static_cast<C *>(&CSystemManager::GetInstance());
+ if (pObj) { // LCOV_EXCL_BR_LINE 5 : new error
+ l_eStatus = (pObj->*M)(hApp);
+ }
+ return l_eStatus;
+}
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE, UI_32)>
+EFrameworkunifiedStatus SysMgrCbType2(HANDLE hApp, UI_32 f_UI_32) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ C * pObj = static_cast<C *>(&CSystemManager::GetInstance());
+ if (pObj) { // LCOV_EXCL_BR_LINE 5 : new error
+ l_eStatus = (pObj->*M)(hApp, f_UI_32);
+ }
+ return l_eStatus;
+}
+
+template<typename C, BOOL (C::*M)(UI_32)>
+BOOL SysMgrCbType3(UI_32 f_UI_32) {
+ BOOL l_bValue = FALSE;
+ C * pObj = static_cast<C *>(&CSystemManager::GetInstance());
+ if (pObj) { // LCOV_EXCL_BR_LINE 5 : new error
+ l_bValue = (pObj->*M)(f_UI_32);
+ }
+ return l_bValue;
+}
+
+enum {
+ POWERON = TRUE,
+ POWEROFF = FALSE
+};
+
+VOID CSystemManager::LogGroupModulesState(UI_32 f_groupId, std::string pStr) {
+ if (IS_ZONE_SET(ZONE_INFO)) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(f_groupId);
+ if (l_GroupIterator == m_MapProclaunchGrps.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Group %d not found; 'm_MapProclaunchGrps' is empty",
+ f_groupId);
+ } else {
+ std::string sIsOKFlag;
+ TEXT(__FUNCTION__, " Group %d/%s, %ld modules: %s, %s", f_groupId,
+ l_GroupIterator->second.name.c_str(),
+ l_GroupIterator->second.modules.size(), pStr.c_str(),
+ GetStr(m_SMCurrentState).c_str());
+
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+ for (int i = 1;
+ l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++, i++) {
+ sIsOKFlag = GetModuleCondition(l_ModuleListIterator) ? " " : // 'blank' means OK
+ "X"; // 'X' means state mismatch
+
+ TEXT(__FUNCTION__,
+ " %2d: %-24s Start Req'd: %-5s %s %-24s %3dms, %3dms, %d",
+ i, l_ModuleListIterator->name.c_str(),
+ l_ModuleListIterator->is_start_required ?
+ "TRUE" : "FALSE", sIsOKFlag.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str(),
+ static_cast<SI_16>(l_ModuleListIterator->m_startReason.GetDelta()),
+ static_cast<SI_16>(l_ModuleListIterator->m_stopReason.GetDelta()),
+ l_ModuleListIterator->pid);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ // LCOV_EXCL_STOP
+ }
+} // End of VOID CSystemManager::LogGroupModulesState( UI_32 f_groupId, std::string pStr)
+
+VOID CSystemManager::LogAllGroupModulesState(std::string pStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string l_sIsOKFlag;
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+
+ std::stringstream l_comStream;
+
+ l_comStream << pStr << "," << GetStr(m_SMCurrentState);
+
+ std::string l_comStr = l_comStream.str();
+ SystemmanagerLogString(ZONE_STATE, __FUNCTION__, l_comStr);
+
+ while (l_GroupIterator != m_MapProclaunchGrps.end()) {
+ std::stringstream l_tblStream;
+ l_tblStream << "G" << l_GroupIterator->second.id << "/" << l_GroupIterator->second.name;
+
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+
+ for (int i = 1;
+ l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++, i++) {
+ // Since NPPService exceptionally transitions to STARTED when StartReq'd = N, it is not checked
+ l_sIsOKFlag =
+ GetModuleCondition(l_ModuleListIterator)
+ | (FRAMEWORKUNIFIED_NS_NPSERVICE == l_ModuleListIterator->name) ?
+ " " : // 'blank' means OK
+ "X"; // 'X' means state mismatch
+
+ std::string l_isStartReqd = l_ModuleListIterator->is_start_required ? "T" : "F";
+
+ l_tblStream << endl << " " << std::setw(2) << std::right << i << ":"
+ << l_ModuleListIterator->pid << " "
+ << l_ModuleListIterator->name << " " << "StartReq:"
+ << l_isStartReqd << " " << l_sIsOKFlag
+ << l_ModuleListIterator->ModuleStateStr();
+
+ if (l_ModuleListIterator->is_start_required && (FRAMEWORKUNIFIED_NS_NPSERVICE != l_ModuleListIterator->name)) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set // NOLINT(whitespace/line_length)
+ l_tblStream << " "
+ << static_cast<SI_32>(l_ModuleListIterator->m_startReason.GetDelta())
+ << "ms "
+ << static_cast<SI_32>(l_ModuleListIterator->m_stopReason.GetDelta())
+ << "ms";
+ }
+ }
+
+ l_GroupIterator++;
+
+ // Outputs each GROUP so that buffers do not overflow.
+ std::string l_logMsgStr = l_tblStream.str();
+ SystemmanagerLogString(ZONE_STATE, __FUNCTION__, l_logMsgStr);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // End of VOID CSystemManager::LogAllGroupModulesState(std::string pStr)
+
+BOOL CSystemManager::GetModuleCondition(ModuleLaunchListIter & f_ModuleIter) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bIsModuleStateGood = TRUE;
+
+ switch (m_SMCurrentState) { // LCOV_EXCL_BR_LINE 6: As no values are passed into the default case
+ case SS_SM_READY_TO_LAUNCH_APP:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_INVALID);
+ break;
+
+ case SS_SM_APPS_LAUNCH_IN_PROGRESS:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHING)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED);
+ break;
+
+ case SS_SM_APPS_LAUNCHED_READY_TO_START:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED);
+ break;
+
+ case SS_SM_APPS_START_IN_PROGRESS:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED)
+ || (f_ModuleIter->is_start_required
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_START_SENT)
+ || f_ModuleIter->IsModuleState(
+ MODULE_STATE_STARTED)))
+ || (!f_ModuleIter->is_start_required
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED)
+ || f_ModuleIter->IsModuleState(
+ MODULE_STATE_CONNECTED)));
+ break;
+
+ case SS_SM_APPS_START_COMPLETE:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_STARTED) == TRUE))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_START_PRE_SENT) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STARTED_PRE) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_STOP_PRE_SENT) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STOPPED_PRE) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_PRE_RUN_COMPLETE:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_STARTED_PRE) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STOPPED_PRE) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_START_BACKGROUND_SENT) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STARTED_BACKGROUND) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_STOP_BACKGROUND_SENT) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STOPPED_BACKGROUND) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+ case SS_SM_APPS_BACKGROUND_RUN_COMPLETE:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_STARTED_BACKGROUND) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STOPPED_BACKGROUND) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_STOPPING_AT__CWORD56__REQ:
+ case SS_SM_APPS_STOPPING_AT_INTERNAL_REQ:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED)
+ || (f_ModuleIter->is_start_required
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_STOP_SENT)
+ || f_ModuleIter->IsModuleState(
+ MODULE_STATE_STOPPED)))
+ || (!f_ModuleIter->is_start_required
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED)
+ || f_ModuleIter->IsModuleState(
+ MODULE_STATE_CONNECTED)));
+ break;
+
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED)
+ || (f_ModuleIter->is_start_required
+ && f_ModuleIter->IsModuleState(MODULE_STATE_STOPPED))
+ || (!f_ModuleIter->is_start_required
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED)
+ || f_ModuleIter->IsModuleState(
+ MODULE_STATE_CONNECTED)));
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bIsModuleStateGood;
+} // End of BOOL CSystemManager::GetModuleCondition( ModuleLaunchListIter & f_ModuleIter )
+
+/*****************************************************************************
+ @ingroup: CSystemManager
+ @brief: Post Termination handler
+ @note: .
+ @param void
+ @return void
+*****************************************************************************/
+EFrameworkunifiedStatus CSystemManager::SendRequestToHeartBeat(HANDLE hApp,
+ EHBProtocolMessages tRequest, VOID *tReqMessageData,
+ UI_32 u32SizeofMessage) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL bValid = FALSE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ switch (tRequest) {
+ case SS_HEARTBEAT_START:
+ bValid = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SS_HEARTBEAT_START");
+ break;
+
+ case SS_HEARTBEAT_STOP:
+ bValid = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SS_HEARTBEAT_STOP");
+ tReqMessageData = NULL;
+ break;
+
+ case SS_HEARTBEAT_DELETE_MODULE_ENTRY:
+ bValid = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SS_HEARTBEAT_DELETE_MODULE_ENTRY");
+ break;
+
+ case SS_HEARTBEAT_APPEND_MODULE_ENTRY:
+ bValid = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SS_HEARTBEAT_APPEND_MODULE_ENTRY");
+ break;
+
+ default:
+ bValid = FALSE;
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error : Ignored Invalid message id 0x%X", tRequest);
+ break;
+ }
+
+ if (TRUE == bValid) { // LCOV_EXCL_BR_LINE 200:tRequest cannot be default, so bValid cannot be false
+ if (INVALID_HANDLE != m_hHeartbeatThread.m_ThreadHdl) { // LCOV_EXCL_BR_LINE 200:m_ThreadHdl cannot be null
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, m_hHeartbeatThread.m_ThreadHdl, tRequest, u32SizeofMessage, tReqMessageData))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: m_ThreadHdl cannot be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error : Invalid Heartbeat Thread Handle, cannot send message");
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnModuleConnectWaitTimeout
+/// SM maintains timer (40 sec) to check if all modules opened session with him whoever requires Start.
+/// This timer is common to all modules. After timeout it checks the status of every module in group map.
+/// If a module requires start and does not connect, SM will initiate error event logging followed by Soft Reset
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnModuleConnectWaitTimeout(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ static SI_32 l_NumTimesChecked = 0;
+ {
+ char l_cFormat[] = " Received from (Timer expiration %d)";
+ char l_cBuf[sizeof(l_cFormat) + 1];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, l_NumTimesChecked + 1);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, l_cBuf);
+ }
+
+ std::string l_ProcName;
+
+ SetCmdHist("SM_TIMER_MODULE_CONNECT_WAIT_TIMER", m_TimerCmdHist, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ BOOL l_bModuleConnMissed = false;
+
+ GroupLaunchMap::reverse_iterator l_grp_riter = m_MapProclaunchGrps.rbegin();
+
+ ModuleLaunchList::reverse_iterator l_mod_riter;
+
+ if (l_grp_riter == m_MapProclaunchGrps.rend()) { // LCOV_EXCL_BR_LINE 200: group cannot be empty
+ // LCOV_EXCL_START 200: group cannot be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Group Map is Empty"); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ // LCOV_EXCL_STOP
+ } else {
+ // scan the group map in reverse order
+ for (; l_grp_riter != m_MapProclaunchGrps.rend(); l_grp_riter++) {
+ l_mod_riter = l_grp_riter->second.modules.rbegin();
+ for (; l_mod_riter != l_grp_riter->second.modules.rend();
+ l_mod_riter++) {
+ SMModuleState l_ModuleState = l_mod_riter->GetModuleState();
+ // if the module is still in MODULE_STATE_LAUNCHED state at
+ // this point though it requires start something is wrong with
+ // the module. SM initiates error event logging followed by
+ // soft rest
+ if (l_mod_riter->is_start_required
+ && ((l_ModuleState == MODULE_STATE_INVALID)
+ || (l_ModuleState == MODULE_STATE_SKIPPED)
+ || (l_ModuleState == MODULE_STATE_LAUNCHING)
+ || (l_ModuleState == MODULE_STATE_LAUNCHED)
+ || (l_ModuleState == MODULE_STATE_LAUNCH_FAILED))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Module %s/%s is not connected",
+ l_mod_riter->name.c_str(),
+ l_mod_riter->ModuleStateStr().c_str());
+ l_bModuleConnMissed = true;
+ l_ProcName.assign(l_mod_riter->name);
+
+ if (l_ModuleState == MODULE_STATE_LAUNCHED) {
+ CALL_AND_LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_mod_riter->SetPriority( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ m_SystemManagerPriority - 1)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+ }
+ }
+
+ PreLaunchModuleListIter l_itr;
+ for (l_itr = m_PreLaunchModuleList.begin();
+ m_PreLaunchModuleList.end() != l_itr; l_itr++) {
+ if ((-1 == l_itr->pid) && (l_itr->critical)) { // LCOV_EXCL_BR_LINE 200: all prelaunch mode is not critical // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 200: all prelaunch mode is not critical
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Module %s is not launched", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_itr->name.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_bModuleConnMissed = true;
+ l_ProcName.assign(l_itr->name);
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ l_NumTimesChecked++;
+ if (true == l_bModuleConnMissed) {
+ if (l_NumTimesChecked < m_SMConfig.MCConfig.ModuleConnectionNumTimesToCheck) {
+ char l_cFormat[] =
+ " l_NumTimesChecked %d < ModuleConnectionNumTimesToCheck %d, "
+ "will re-check in %d seconds. ";
+ char l_cBuf[sizeof(l_cFormat) + 1 + 1 + 1];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, l_NumTimesChecked,
+ m_SMConfig.MCConfig.ModuleConnectionNumTimesToCheck,
+ m_SMConfig.MCConfig.ModuleConnectionTimeOutSec);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, l_cBuf);
+
+ } else {
+ l_eStatus = eFrameworkunifiedStatusBadConnection;
+ char l_cFormat[] =
+ " Module connection timeout for %s and "
+ "l_NumTimesChecked %d == ModuleConnectionNumTimesToCheck %d. "
+ " Stopping ModuleConnectTimeOut timer and resetting _CWORD102_.";
+ char l_cBuf[sizeof(l_cFormat) + MAX_NAME_SIZE_APP + 1 + 1];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, l_ProcName.c_str(),
+ l_NumTimesChecked,
+ m_SMConfig.MCConfig.ModuleConnectionNumTimesToCheck);
+ LOG_ERROR(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_MODULE_CONNECT_WAIT_TIMER]); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // initiate error event logging
+ l_eStatus = ErrorEventEnqueue(hApp, eErrorEventTypeModConnFailed,
+ l_ProcName, eErrorEventResetTypeHard, l_loggingInfo);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: ModConnFailed %s",
+ l_ProcName.c_str());
+ fprintf(stderr, "SS_SysManager/%s/Error: ModConnFailed %s\n", // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ __FUNCTION__, l_ProcName.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeModConnFailed)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ } else {
+ char l_cFormat[] =
+ " l_NumTimesChecked = %d, ModuleConnectionNumTimesToCheck = %d. "
+ "All modules connected. Stopping ModuleConnectTimeOut timer.";
+ char l_cBuf[sizeof(l_cFormat) + 1 + 1];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, l_NumTimesChecked,
+ m_SMConfig.MCConfig.ModuleConnectionNumTimesToCheck);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, l_cBuf);
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_MODULE_CONNECT_WAIT_TIMER]); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnModuleConnectWaitTimeout( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnClientStartMonitorTimerExpiry
+///
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnClientStartMonitorTimerExpiry(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from group %d"
+ //, m_ActiveGroupId);
+ , m_SystemStarter.get_id());
+
+ char cBuf[100];
+ SetCmdHist("SM_TIMER_CLIENT_START_MONITOR", m_TimerCmdHist, m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // sprintf( cBuf, "ProcessGroupAsStarted(%d)", m_ActiveGroupId);
+ sprintf(cBuf, "ProcessGroupAsStarted(%d)", m_SystemStarter.get_id()); // NOLINT
+ l_eStatus = ProcessGroupAsStarted(hApp, m_SystemStarter.get_id());
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup send_power_request_complete_response
+/// send power request completion response to power
+///
+/// \param [in]
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::send_power_request_complete_response(HANDLE hApp, std::string pStr) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // send Wake-up complete response to Power
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession,
+ SS_SM_WAKEUP_MODULES_CMPL_RSPN, sizeof(wakeInfo), (PVOID) & m_Wake);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg(SS_SM_WAKEUP_MODULES_CMPL_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ LogAllGroupModulesState(pStr);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::send_power_request_complete_response( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnNPPStatusCheckMonitorTimerExpiry
+///
+/// \brief Called when NPP fails to provide a ready status in the specified.
+/// amount of time. This function will periodically request a new status
+/// ACK from NPP service until one is received. See OnNPPReadyStatusCallback().
+///
+/// Note: NPP usually pushes a ready event to SM and the reversion to
+/// polling the NPP ready ACK is for additional robustness. Failure
+/// to receive an NPP ready ACK will prevent system startup.
+///
+/// \param [in] hApp - Handle to framework application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnNPPStatusCheckMonitorTimerExpiry(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ SetCmdHist("SM_TIMER_NPP_STATUS_CHECK_MONITOR", m_TimerCmdHist, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " m_bIsNPP_ServicesStarted is '%s'",
+ GetStr(m_bIsNPP_ServicesStarted).c_str());
+
+ if (FALSE == m_bIsNPP_ServicesStarted) {
+ l_eStatus = FrameworkunifiedNPGetReadyStatusOfNPP(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "FrameworkunifiedNPGetReadyStatusOfNPP()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnNPPReadyStatusCallback
+///
+/// \brief Called when NPP returns a status ACK indicating that the service is
+/// operational and ready to respond to subsequent requests.
+///
+/// \param [in] hApp - Handle to framework application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnNPPReadyStatusCallback(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("NPS_GET_READYSTATUS_ACK", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ l_eStatus = OnNPPReadyEventCallback(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnNPPReadyEventCallback()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CSystemManager::OnNPPReadyEventCallback(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ PCSTR l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", l_moduleName);
+
+ SetCmdHist("NPS_NPP_READY_EVENT", m_SMCmdHist, m_SMHistIter, l_moduleName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (TRUE == m_bIsNPP_ServicesStarted) {
+ l_eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ LOG_ERROR("TRUE == m_bIsNPP_ServicesStarted"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ ModuleLaunchListIter l_ModuleListIter;
+ m_bIsNPP_ServicesStarted = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " m_bIsNPP_ServicesStarted set 'TRUE'");
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_NPP_STATUS_CHECK_MONITOR]);
+
+ UI_32 l_cbCmdIdArrayNPPService[] = { NPS_NPP_READY_EVENT, NPS_GET_READYSTATUS_ACK };
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hApp, FRAMEWORKUNIFIED_NS_NPSERVICE, l_cbCmdIdArrayNPPService, static_cast<UI_32>(_countof(l_cbCmdIdArrayNPPService))))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedDetachCallbacksFromDispatcher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = register_all_notification_callbacks(hApp))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("register_all_notification_callbacks()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = GetModuleIterator(l_moduleName, l_ModuleListIter))) { // LCOV_EXCL_BR_LINE 200:NPP always in launch map //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 200 : NPP service always in launch map
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " Error: Module %s not found in Group Launch Map", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_moduleName); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ l_ModuleListIter->SetModuleState(MODULE_STATE_STARTED);
+
+ if (m_oSystemLauncher.get_id() == 1) {
+ m_oSystemLauncher.advance_id();
+ }
+
+ l_eStatus = OnLaunchGroup(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnLaunchGroup(hApp)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 200: OnLaunchGroup() return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " successful");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnNPPReadyEventCallback( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnBackupMgrAvailCallback
+/// BackupManager Availability Notification Callback
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnBackupMgrAvailCallback(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (sizeof(ServiceAvailability) != FrameworkunifiedGetMsgLength(hApp)) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else if (strcmp(FrameworkunifiedGetLastNotification(hApp), NTFY_BackupMgr_Availability) != 0) { // LCOV_EXCL_BR_LINE 200:cannot be false //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 200: cannot be false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ m_bIsBackupAvail = FrameworkunifiedIsServiceAvailable(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "BackupAvail:%s", m_bIsBackupAvail ? "T" : "F");
+
+ l_eStatus = OnLaunchGroup(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnLaunchGroup(hApp)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnBackupMgrAvailCallback(HANDLE hApp)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnPowerRequestCallback
+/// PowerRequest callback handler
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnPowerRequestCallback(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ Pwr_ServiceSetInterface tServiceIf;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ SetCmdHist("SS_SM_POWER_REQUEST_MSG", m__CWORD56_CmdHist, m__CWORD56_HistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ // OnSystemManagerDebugDump(hApp);
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < Pwr_ServiceSetInterface > (hApp, tServiceIf))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ // NOTE: interface_unified always set userMode as 0. so don't use m_lastUserMode.
+ m_lastUserMode = tServiceIf.data.powerRequestMsg.userMode;
+ //
+ // 2012 December 04 Temporary hack ( I hope ) to set m_Wake to nominal
+ // values. At present, the 'Power Request Message Response' is sent
+ // back to Power Services via the 'send_power_request_complete_response()'
+ // function, which uses m_Wake.
+ m_Wake.powerupType =
+ m_SSBool_to_PowerTypeEnumMap[m_SSUserMode_to_SSBoolEnumMap[m_lastUserMode]];
+
+ m_Wake.up.factor = tServiceIf.data.powerRequestMsg.startupReason;
+
+ if (epswfINVALID != m_Wake.up.factor) {
+ m_StartUpReason = m_Wake.up.factor;
+ }
+
+ m_userModeChangeReason = tServiceIf.data.powerRequestMsg.userModeChangeReason;
+ m_Wake.up.userModeChangeReason = m_userModeChangeReason;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "UserMode:%s, SM State:%s",
+ GetStr(m_lastUserMode).c_str(),
+ GetStr(m_SMCurrentState).c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "UserMode:%s, SM State:%s",
+ GetStr(m_lastUserMode).c_str(),
+ GetStr(m_SMCurrentState).c_str());
+ CALL_AND_LOG_STATUS(PublishPowerOnOffNotification(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ switch (m_SMCurrentState) { // LCOV_EXCL_BR_LINE 6: As not all cases can be passed through
+ case SS_SM_READY_TO_LAUNCH_APP:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Received a PowerRequest command while still in "
+ "the '%s' state !!!",
+ GetStr(m_SMCurrentState).c_str());
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+
+ case SS_SM_APPS_LAUNCH_IN_PROGRESS:
+ // When Start is received while processes are launching, we
+ // need to send the Start request later, once the 'Open
+ // Session Request' is received from the application.
+ //*****
+ // Deliberate commenting-out of case-break to allow this case to
+ // use following case's logic.
+ // break;
+ //*****
+
+ case SS_SM_APPS_LAUNCHED_READY_TO_START:
+ case SS_SM_APPS_START_COMPLETE:
+ case SS_SM_APPS_PRE_RUN_COMPLETE:
+ case SS_SM_APPS_BACKGROUND_RUN_COMPLETE:
+ case SS_SM_APPS_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "Startup Reason is '%s'", GetStr(m_StartUpReason).c_str());
+ if ((m_userModeChangeReason == epsumcrPARKING_B)
+ || ((m_userModeChangeReason == epsumcrPRE_BA) && (m_SMCurrentState == SS_SM_APPS_PRE_RUN_COMPLETE))
+ || ((m_userModeChangeReason == epsumcrNORMAL) && (m_SMCurrentState == SS_SM_APPS_START_COMPLETE))
+ || ((m_userModeChangeReason == epsumcrBACKGROUND_BA)
+ && (m_SMCurrentState == SS_SM_APPS_BACKGROUND_RUN_COMPLETE))) {
+ // send the Power Request complete response to PowerService
+ // LCOV_EXCL_BR_START 15: Excluded due to inlined functions
+ CALL_AND_LOG_STATUS_IF_ERRORED(send_power_request_complete_response(hApp, "Power Request"));
+ // LCOV_EXCL_BR_STOP 15: Excluded due to inlined functions
+ } else {
+ //
+ // Publish the UserMode 'Off' notification now for those
+ // applications that need immediate notification ( HMI )
+ if (m_lastUserMode == epsumOFF) {
+ CALL_AND_LOG_STATUS(PublishUserModeNotification(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ CALL_AND_LOG_STATUS(BeginStartup(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ break;
+
+ case SS_SM_APPS_STOPPING_AT__CWORD56__REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ:
+ // Abort the Stop.
+ // Reset System Manager to handle (re)starting as if this is a
+ // nominal start.
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_CLIENT_STOP_MONITOR]);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Aborted %s, resetting to %s,"
+ " restarting Application groups at group %d",
+ GetStr(m_SMCurrentState).c_str(),
+ GetStr(SS_SM_APPS_START_IN_PROGRESS).c_str()
+ , m_SystemStarter.get_id());
+
+ CALL_AND_LOG_STATUS(BeginStartup(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ break;
+
+ case SS_SM_APPS_STOPPING_AT_INTERNAL_REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ: // LCOV_EXCL_START 8: As no value is set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: System Manager state is %d/'%s', ignoring "
+ "PowerRequest command", m_SMCurrentState,
+ GetStr(m_SMCurrentState).c_str());
+ break;
+ } // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnPowerRequestCallback( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+/// Begin the Startup process
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::BeginStartup(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if ((m_userModeChangeReason != epsumcrPARKING_B) &&
+ (m_userModeChangeReason != epsumcrPRE_BA) &&
+ (m_userModeChangeReason != epsumcrNORMAL) &&
+ (m_userModeChangeReason != epsumcrBACKGROUND_BA)) {
+ // Not a power state transition request.
+ return eFrameworkunifiedStatusOK;
+ }
+
+ switch (m_userModeChangeReason) { // LCOV_EXCL_BR_LINE 6: Excluded because it has been guarded to prevent out-of-range values from entering immediately before.
+ case epsumcrPRE_BA:
+ // LCOV_EXCL_BR_START 6: This function is an internal function, and it is guarded so that the value outside the range is not entered by the caller, so it is excluded.
+ if ((m_SMCurrentState == SS_SM_APPS_START_COMPLETE) || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_RUN_COMPLETE)) {
+ // LCOV_EXCL_BR_STOP 6: This function is an internal function, and it is guarded so that the value outside the range is not entered by the caller, so it is excluded.
+ m_SystemStarter.to_end();
+ SMSetState(hApp, SS_SM_APPS_PRE_STOP_IN_PROGRESS);
+ } else {
+ m_SystemStarter.to_begin();
+ SMSetState(hApp, SS_SM_APPS_PRE_START_IN_PROGRESS);
+ }
+ break;
+ case epsumcrNORMAL:
+ m_SystemStarter.to_begin();
+ SMSetState(hApp, SS_SM_APPS_START_IN_PROGRESS);
+ break;
+ case epsumcrBACKGROUND_BA:
+ if (m_SMCurrentState == SS_SM_APPS_START_COMPLETE) {
+ m_SystemStarter.to_end();
+ SMSetState(hApp, SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS);
+ } else {
+ m_SystemStarter.to_begin();
+ SMSetState(hApp, SS_SM_APPS_BACKGROUND_START_IN_PROGRESS);
+ }
+ break;
+ default:
+ break;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Starting 'Start Resp Monitor' Timer with '%d' sec",
+ m_SMConfig.MCConfig.ModuleStartRespTimeOutSec);
+
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_START_RESP_MONITOR_WAIT_TIMER],
+ m_SMConfig.MCConfig.ModuleStartRespTimeOutSec, 0, 0, 0);
+
+ l_eStatus = start_all_modules_of_group(hApp, m_SystemStarter.get_id());
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: start_all_modules_of_group(%d) errored: %d/'%s'",
+ m_SystemStarter.get_id(), l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::BeginStartup( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnWakeupCallback
+/// WakeUp callback handler
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnWakeupCallback(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "Received from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnWakeupCallback( HANDLE hApp )
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnModuleStartCompleteResponse
+/// Start Response\Ack Handlers
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnModuleStartCompleteResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "%s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("system_manager protocol completion response", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ ModuleLaunchListIter l_ModuleListIter;
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ l_eStatus = GetModuleIterator(l_moduleName.c_str(), l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:always be eFrameworkunifiedStatusOK
+ // LCOV_EXCL_START 200: always be eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map",
+ l_moduleName.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ switch (m_SMCurrentState) { // LCOV_EXCL_BR_LINE 200: cannot be SS_SM_READY_TO_LAUNCH_APP
+ case SS_SM_READY_TO_LAUNCH_APP:
+ // LCOV_EXCL_START 200: cannot be SS_SM_READY_TO_LAUNCH_APP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Received while in the '%s' state !!!",
+ GetStr(m_SMCurrentState).c_str());
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+ // LCOV_EXCL_STOP
+
+ case SS_SM_APPS_LAUNCH_IN_PROGRESS:
+ case SS_SM_APPS_LAUNCHED_READY_TO_START:
+ case SS_SM_APPS_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ {
+ const SMModuleState l_state = InProgressStateToState(); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ if (l_state != MODULE_STATE_INVALID) {
+ const PCSTR l_loglist[] = {"start", "pre start", "pre stop", "background start", "background stop", ""};
+ PCSTR l_logtxt;
+ switch (l_state) { // LCOV_EXCL_BR_LINE 6: As no other value is returned
+ case MODULE_STATE_STARTED:
+ l_logtxt = l_loglist[0];
+ break;
+ case MODULE_STATE_STARTED_PRE:
+ l_logtxt = l_loglist[1];
+ break;
+ case MODULE_STATE_STOPPED_PRE:
+ l_logtxt = l_loglist[2];
+ break;
+ case MODULE_STATE_STARTED_BACKGROUND:
+ l_logtxt = l_loglist[3];
+ break;
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ l_logtxt = l_loglist[4];
+ break;
+ // LCOV_EXCL_START 6: As no other value is returned
+ default:
+ AGL_ASSERT_NOT_TESTED();
+ l_logtxt = l_loglist[5];
+ break;
+ // LCOV_EXCL_STOP 6: As no other value is returned
+ }
+ l_eStatus = ModuleCompleteResponse(hApp, l_ModuleListIter, l_state, // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ SysMgrCbType3<CSystemManager, &CSystemManager::IsGroupStarted>,
+ SysMgrCbType2<CSystemManager, &CSystemManager::ProcessGroupAsStarted>,
+ l_logtxt);
+ }
+ }
+ break;
+
+ case SS_SM_APPS_STOPPING_AT__CWORD56__REQ:
+ case SS_SM_APPS_STOPPING_AT_INTERNAL_REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ:
+ // SystemManager changed state while this module was starting;
+ // tell this module to stop.
+ if (!l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_SENT)
+ && !l_ModuleListIter->IsModuleState(MODULE_STATE_STOPPED)) {
+ T_SS_SM_STOP_DataStructType l_SM_STOP_Struct;
+ l_SM_STOP_Struct.shutdownTrigger = m_shutdownTrigger;
+ l_SM_STOP_Struct.lastUserMode = m_lastUserMode;
+
+ CALL_AND_LOG_STATUS( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_ModuleListIter->SendMsgAndUpdateState(
+ &l_SM_STOP_Struct));
+ }
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Received while in the '%s' state !!!", GetStr(m_SMCurrentState).c_str());
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+ } // End switch ( m_SMCurrentState )
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnModuleStartCompleteResponse( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ModuleCompleteResponse
+/// Start Response\Ack Handlers
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ModuleCompleteResponse(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleListIter, SMModuleState f_moduleState,
+ FncCbType3 f_isGroupDoneFnc, FncCbType2 f_groupDoneFnc,
+ PCSTR f_sCompleteTypeText) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Received from %s, m_SystemStarter.get_id() is %d",
+ l_moduleName.c_str()
+ , m_SystemStarter.get_id());
+
+ f_ModuleListIter->SetModuleState(f_moduleState);
+ if (f_ModuleListIter->group_id != m_SystemStarter.get_id()) {
+ // In PastModel002, it is assumed that there is no service that returns a FrameworkunifiedOnStop reply after the NPP service.
+ // However, since _CWORD71_ does not assume this, completion of waiting for termination of the CRITICAL service must be
+ // judged even when services other than the Group1 service terminate last.
+ // Initially, SS_SM_WAITING_FOR_CRITICAL_APPS_AT_XXXX should be handled separately by ProcessModuleStopCompleteResponse(),
+ // but this is limited to ModuleCompleteResponse in order to avoid code deviation from PastModel002 and limit the scope of effect.
+ // LCOV_EXCL_BR_START 200 : m_SMCurrentState can't be SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ and SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ // NOLINT(whitespace/line_length)
+ if ((MODULE_STATE_STOPPED == f_moduleState)
+ && ((m_SMCurrentState
+ == SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ)
+ || (m_SMCurrentState
+ == SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ))) {
+ // LCOV_EXCL_BR_STOP 200 : m_SMCurrentState can't be SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ and SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 200 : m_SMCurrentState can't be SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ and SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ check_all_groups_have_stopped(hApp);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s ( group %d ) received out-of-synch; m_SystemStarter.get_id() is %d",
+ l_moduleName.c_str(), f_ModuleListIter->group_id
+ , m_SystemStarter.get_id());
+ }
+ } else {
+ if ((*f_isGroupDoneFnc)(f_ModuleListIter->group_id)) { // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ l_eStatus = (*f_groupDoneFnc)(hApp, f_ModuleListIter->group_id); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else if (IS_ZONE_SET(ZONE_INFO)) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " Group %d %s incomplete, m_SystemStarter.get_id() is %d", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ f_ModuleListIter->group_id, f_sCompleteTypeText // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ , m_SystemStarter.get_id()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ char cBuf[100];
+ sprintf(cBuf, "%s incomplete", f_sCompleteTypeText); // NOLINT
+ LogGroupModulesState(f_ModuleListIter->group_id, cBuf); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ const SMModuleState l_transition_state = InProgressStateToState(); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ if (l_transition_state == f_moduleState) { // LCOV_EXCL_BR_LINE 6: As no other value is returned
+ if (have_all_services_start_completed(l_transition_state) == TRUE) {
+ if ((m_SMCurrentState == SS_SM_APPS_PRE_START_IN_PROGRESS)
+ || (m_SMCurrentState == SS_SM_APPS_PRE_STOP_IN_PROGRESS)) {
+ SMSetState(hApp, SS_SM_APPS_PRE_RUN_COMPLETE); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ } else if ((m_SMCurrentState == SS_SM_APPS_BACKGROUND_START_IN_PROGRESS)
+ || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS)) {
+ SMSetState(hApp, SS_SM_APPS_BACKGROUND_RUN_COMPLETE); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ } else {
+ SMSetState(hApp, SS_SM_APPS_START_COMPLETE); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ModuleCompleteResponse(
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnStartRespMonitorTimeout
+/// SM maintains timer to check if all modules sent start response to him whoever requires Start.
+/// This timer is common to all modules. After timeout it checks the status of every module in group map.
+/// If a module sent start and does not respond, SM will initiate error event logging followed by Soft Reset
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnStartRespMonitorTimeout(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ std::string l_ProcName;
+ BOOL l_isStartRespNotReceived = false;
+
+ SetCmdHist("SM_TIMER_START_RESP_MONITOR_WAIT_TIMER", m_TimerCmdHist,
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp));
+ GroupLaunchMap::reverse_iterator l_grp_riter = m_MapProclaunchGrps.rbegin();
+ ModuleLaunchList::reverse_iterator l_mod_riter;
+
+ if (l_grp_riter == m_MapProclaunchGrps.rend()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Group Map is Empty");
+ } else {
+ // scan the group map in reverse order
+ for (; l_grp_riter != m_MapProclaunchGrps.rend(); l_grp_riter++) {
+ l_mod_riter = l_grp_riter->second.modules.rbegin();
+ for (; l_mod_riter != l_grp_riter->second.modules.rend(); l_mod_riter++) {
+ // if a module sent start and not received response from module SM wait for "ModuleStartRespTimeout"
+ // and initiated error event
+ // logging followed by soft reset
+
+ if (l_mod_riter->is_start_required) {
+ if (l_mod_riter->IsModuleState(MODULE_STATE_START_SENT)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Module [%s] did not respond(%s) to SM in allocated time [%d] sec",
+ l_mod_riter->name.c_str(),
+ l_mod_riter->ModuleStateStr().c_str(),
+ m_SMConfig.MCConfig.ModuleStartRespTimeOutSec);
+ l_isStartRespNotReceived = true;
+ l_ProcName.assign(l_mod_riter->name);
+ }
+ }
+ }
+ }
+ }
+
+ if (true == l_isStartRespNotReceived) {
+ char l_cFormat[] = " Error. Module '%s' start response timeout.";
+ char l_cBuf[sizeof(l_cFormat) + MAX_NAME_SIZE_APP];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, l_ProcName.c_str());
+ TEXT(__FUNCTION__, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, l_cBuf);
+
+ SMLoggingInfo l_loggingInfo;
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+
+ // initate error event logging
+ l_eStatus = ErrorEventEnqueue(hApp, eErrorEventTypeStartRespFailed,
+ l_ProcName, eErrorEventResetTypeHard, l_loggingInfo);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: StartRespFailed %s", l_ProcName.c_str());
+ fprintf(stderr, "SS_SysManager/%s/Error: StartRespFailed %s\n",
+ __FUNCTION__, l_ProcName.c_str());
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeStartRespFailed)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__,
+ " All modules returned Start Response.");
+
+ l_eStatus = FrameworkunifiedSendChild(hApp, m_hHeartbeatThread.m_ThreadHdl,
+ SS_HEARTBEAT_AVAIL_CHECK_REQ, 0, NULL);
+ SS_ASERT(l_eStatus == eFrameworkunifiedStatusOK); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnStartRespMonitorTimeout(HANDLE hApp)
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnShutdownCompleteMonitorTimeout
+/// SM maintains timer to check if all modules sent start response to him whoever requires Start.
+/// This timer is common to all modules. After timeout it checks the status of every module in group map.
+/// If a module sent start and does not respond, SM will initiate error event logging followed by Soft Reset
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnShutdownCompleteMonitorTimeout(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Reset Timeout");
+
+ l_eStatus = SecureChipOff();
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: SecureChipOff Failed");
+ }
+
+ m_ResetFactor = PSM_FACTOR_AGL_WITH_HISTORY;
+
+ l_eStatus = perform_force_reset(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnShutdownCompleteMonitorTimeout(HANDLE hApp)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup start_all_modules_of_group
+/// Send START to all modules of the given group
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::start_all_modules_of_group(HANDLE hApp, UI_32 f_ui32GroupNumber) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(
+ f_ui32GroupNumber);
+ if (l_GroupIterator == m_MapProclaunchGrps.end()) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,
+ __FUNCTION__
+ , " Error: Group %d not found; 'm_MapProclaunchGrps' is empty",
+ f_ui32GroupNumber);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: Because the condition cannot be set
+ } else {
+ T_SS_SM_START_DataStructType f_startupData(m_StartUpReason,
+ m_PowerType_to_SSBoolEnumMap[m_Wake.powerupType],
+ m_DataResetMode, m_startUpConfirmationMsg.securityStatus,
+ m_startUpConfirmationMsg.wakeupType, m_DramBackupStatus,
+ m_ResetStatus, m_ResetCount);
+
+ UI_32 l_numModulesMessaged = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Attempting to send Start Requests to Group %d/'%s'",
+ f_ui32GroupNumber, l_GroupIterator->second.name.c_str());
+
+ for (ModuleLaunchListIter l_ModuleListIterator =
+ l_GroupIterator->second.modules.begin();
+ l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++) {
+ //
+ // Every branch below must ZONE_INFO log how it dispenses w/
+ // the module.
+ // Note: ModuleLaunchParams::SetModuleState() performs that
+ // ZONE_INFO logging internally.
+ if (!l_ModuleListIterator->is_start_required) {
+ if (FRAMEWORKUNIFIED_NS_NPSERVICE == l_ModuleListIterator->name) {
+ const SMModuleState l_transition_state = InProgressStateToState(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ l_ModuleListIterator->SetModuleState(l_transition_state); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ } else {
+ // Not an error
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s 'is_start_required' is False;"
+ " leaving state as '%s'",
+ l_ModuleListIterator->name.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str());
+ }
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (NULL == l_ModuleListIterator->hsession) { // LCOV_EXCL_BR_LINE 6: hsession can not be null.
+ l_eStatus = eFrameworkunifiedStatusOK; // Log a message. But its not a failure
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warning: NULL == hsession;"
+ " %s not connected yet",
+ l_ModuleListIterator->name.c_str());
+ } else {
+ switch (l_ModuleListIterator->GetModuleState()) { // LCOV_EXCL_BR_LINE 6: As not all cases can be passed through
+ case MODULE_STATE_INVALID:
+ case MODULE_STATE_SKIPPED:
+ case MODULE_STATE_LAUNCH_FAILED:
+ // LCOV_EXCL_START 6: Because the state of the corresponding variable cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusOK; // Log a message. But its not a failure
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s is %s, NOT sending system_manager protocol message",
+ l_ModuleListIterator->name.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str());
+ break;
+ // LCOV_EXCL_STOP
+
+ case MODULE_STATE_START_SENT:
+ case MODULE_STATE_START_PRE_SENT:
+ case MODULE_STATE_STOP_PRE_SENT:
+ case MODULE_STATE_START_BACKGROUND_SENT:
+ case MODULE_STATE_STOP_BACKGROUND_SENT:
+ l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s is %s, NOT sending system_manager protocol message",
+ l_ModuleListIterator->name.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str());
+ l_numModulesMessaged++;
+ break;
+
+ case MODULE_STATE_LAUNCHING:
+ case MODULE_STATE_LAUNCHED:
+ // LCOV_EXCL_START 6: Because the state of the corresponding variable cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusOK; // Log a message. But its not a failure
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " %s is %s, NOT sending system_manager protocol message",
+ l_ModuleListIterator->name.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str());
+ break;
+ // LCOV_EXCL_STOP
+
+ case MODULE_STATE_CONNECTED:
+ case MODULE_STATE_STARTED:
+ case MODULE_STATE_START_FAILED:
+ case MODULE_STATE_STOP_FAILED:
+ case MODULE_STATE_STOP_SENT:
+ case MODULE_STATE_STOPPED:
+ case MODULE_STATE_STARTED_PRE:
+ case MODULE_STATE_START_PRE_FAILED:
+ case MODULE_STATE_STOPPED_PRE:
+ case MODULE_STATE_STOP_PRE_FAILED:
+ case MODULE_STATE_STARTED_BACKGROUND:
+ case MODULE_STATE_START_BACKGROUND_FAILED:
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ case MODULE_STATE_STOP_BACKGROUND_FAILED:
+ {
+ const UI_32 l_iCmd = InProgressStateToSendMsg(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ if (l_iCmd != SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX) { // LCOV_EXCL_BR_LINE 6: Excluded due to value never returned at present
+ // LCOV_EXCL_BR_START 15: Excluded due to inlined functions
+ CALL_AND_LOG_STATUS_IF_ERRORED(l_ModuleListIterator->SendMsgAndUpdateState(l_iCmd, &f_startupData));
+ // LCOV_EXCL_BR_STOP 15: Excluded due to inlined functions
+ l_numModulesMessaged++;
+ }
+ }
+ break;
+ // default: Don't code a 'default' here - let the compiler
+ // detect when the set of module_state enumerations changes -
+ // then the System Service's System Manager maintainer will
+ // automagically know to update this switch statement.
+ }
+ }
+ }
+
+ if (0 == l_numModulesMessaged) {
+ LogGroupModulesState(f_ui32GroupNumber, " Warning: NO modules were sent system_manager protocol message"); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+
+ char l_cBuf[100];
+ snprintf(l_cBuf, sizeof(l_cBuf), "ProcessGroupAsStarted(%d)", l_GroupIterator->second.id);
+ l_eStatus = ProcessGroupAsStarted(hApp, l_GroupIterator);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ } else {
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_CLIENT_START_MONITOR],
+ SS_CLIENT_START_MONITOR_TIMER_CONFIG, 0, 0, 0);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::start_all_modules_of_group(HANDLE hApp, UI_32 f_ui32GroupNumber)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup start_all_modules_of_group
+/// mark the specified group as started. If there is another group to start,
+/// do so, else send Start Complete Response to the Start Requester.
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ProcessGroupAsStarted(HANDLE hApp, UI_32 f_groupId) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(f_groupId);
+ if (l_GroupIterator == m_MapProclaunchGrps.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Group %d not found; 'm_MapProclaunchGrps' is empty", f_groupId);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ l_eStatus = ProcessGroupAsStarted(hApp, l_GroupIterator);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ProcessGroupAsStarted( HANDLE hApp, UI_32 f_groupId )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup start_all_modules_of_group
+/// mark the specified group as started. If there is another group to start,
+/// do so, else send Start Complete Response to the Start Requester.
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ProcessGroupAsStarted(HANDLE hApp,
+ GroupLaunchMapIter f_GroupIterator) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_groupID = m_SystemStarter.get_id();
+
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_CLIENT_START_MONITOR]);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Group %d/%s start completed, m_SystemStarter.get_id() is %d",
+ f_GroupIterator->second.id, f_GroupIterator->second.name.c_str(),
+ l_groupID);
+
+ if (f_GroupIterator->second.id != l_groupID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO,
+ __FUNCTION__
+ , " The just-started group ( %d/%s ) is not the current Active "
+ " Group ( %d ); not starting next group's modules",
+ f_GroupIterator->second.id,
+ f_GroupIterator->second.name.c_str(), l_groupID);
+ } else {
+ if ((m_SMCurrentState == SS_SM_APPS_START_IN_PROGRESS)
+ || (m_SMCurrentState == SS_SM_APPS_PRE_START_IN_PROGRESS)
+ || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_START_IN_PROGRESS)) {
+ // check if WakeUp Level has been achieved
+ if (m_SystemStarter.is_end() == FALSE) {
+ // Start modules from next group
+ l_groupID = m_SystemStarter.advance_id(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ char l_cBuf[100] = {0};
+ snprintf(l_cBuf, sizeof(l_cBuf), "start_all_modules_of_group(%u)", l_groupID);
+ l_eStatus = start_all_modules_of_group(hApp, l_groupID); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ }
+ } else if ((m_SMCurrentState == SS_SM_APPS_PRE_STOP_IN_PROGRESS)
+ || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS)) {
+ if (m_SystemStarter.is_begin() == FALSE) {
+ // Stop modules from next group
+ l_groupID = m_SystemStarter.decrement_id(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ char l_cBuf[100] = {0};
+ snprintf(l_cBuf, sizeof(l_cBuf), "stop_all_modules_of_group(%u)", l_groupID);
+ l_eStatus = start_all_modules_of_group(hApp, l_groupID); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ }
+ } else {
+ // MISRA C++-2008 Rule 6-4-2
+ // NOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ProcessGroupAsStarted( GroupLaunchMapIter f_GroupIterator )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup calculate_max_shutdown_time
+/// Calculate maximum shutdown time of apps critical to shutdown
+/// from the launch group map
+///
+/// \param [in]
+///
+/// \return UI_32
+/// Max Value of critical shutdown apps shutdown time
+///////////////////////////////////////////////////////////////////////////////
+UI_32 CSystemManager::calculate_max_shutdown_time() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_MaxShutdownTimeValue = 0;
+ std::string moduleName;
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ for (; l_GroupIterator != m_MapProclaunchGrps.end(); l_GroupIterator++) {
+ ModuleLaunchListIter l_ModuleListIterator =
+ l_GroupIterator->second.modules.begin();
+ for (; l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++) {
+ if (l_ModuleListIterator->shutdown_critical) {
+ if (l_MaxShutdownTimeValue < l_ModuleListIterator->shutdown_wait_time) {
+ moduleName = l_ModuleListIterator->name;
+ l_MaxShutdownTimeValue = l_ModuleListIterator->shutdown_wait_time;
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Max time: Module %s, time %d s",
+ moduleName.c_str(), l_MaxShutdownTimeValue);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_MaxShutdownTimeValue;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnShutdownModulesRequest
+/// Send Shutdown to all modules in reverse order of group
+///
+/// \param [in]
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnShutdownModulesRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
+ " Received from %s, m_SystemStarter.get_id() is %d",
+ FrameworkunifiedGetMsgSrc(hApp)
+ , m_SystemStarter.get_id());
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "m_SystemStarter.get_id() is %d", m_SystemStarter.get_id());
+
+ SetCmdHist("SS_SM_SHUTDOWN_MODULES", m__CWORD56_CmdHist, m__CWORD56_HistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < Pwr_ServiceSetInterface > (hApp, l_tServiceSetIf))) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ BOOL isImmShutdown = FALSE;
+
+ // If the Shutdown is not completed after the Shutdown is requested, it is forcibly reset.
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_SHUTDOWN_COMPLETE_MONITOR],
+ SM_SHUTDOWN_COMPLETE_MONITOR_TIMEOUT, 0, 0, 0);
+
+ if (m_isImmResetReq) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " ImmReset");
+ isImmShutdown = TRUE;
+ }
+
+ switch (l_tServiceSetIf.data.shutdownRequestMsg.lastUserMode) {
+ case epsumINVALID:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: shutdownRequestMsg.lastUserMode == epsumINVALID");
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+
+ case epsumOFF:
+ case epsumON: {
+ switch (m_SMCurrentState) {
+ case SS_SM_READY_TO_LAUNCH_APP:
+ case SS_SM_APPS_LAUNCH_IN_PROGRESS:
+ case SS_SM_APPS_LAUNCHED_READY_TO_START:
+ isImmShutdown = TRUE;
+ case SS_SM_APPS_START_COMPLETE:
+ case SS_SM_APPS_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ case SS_SM_APPS_PRE_RUN_COMPLETE:
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_RUN_COMPLETE:
+
+ if (l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger ==
+ epssdmsdtIGN_OFF) {
+ m_ResetCount = 0;
+ if (PowerHalSetResetInfo(AGL_RESET_COUNTER, m_ResetCount)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not back up m_ResetCount(%lu) to power_hal", m_ResetCount);
+ }
+
+ if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, 0)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not reset AGL_ERRLOG_COUNTER");
+ }
+ }
+ if (!m_isPrevErrEventCompleted
+ || ((!((m_SMCurrentState == SS_SM_APPS_START_COMPLETE)
+ || (m_SMCurrentState == SS_SM_APPS_PRE_RUN_COMPLETE)
+ || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_RUN_COMPLETE)))
+ && (l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger
+ == epssdmsdtIGN_OFF
+ || l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger
+ == epssdmsdtNORMAL_RESET))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "shutdown pending");
+ if (!m_dqDeferMsg.empty()) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ SM_POWER_EVENT_INFO deferMsg(SS_SM_SHUTDOWN_MODULES, l_tServiceSetIf);
+ m_dqDeferMsg.push(deferMsg);
+ }
+ } else {
+ // The shutdownTrigger has already been validated by
+ // Power::OnShutdownRequestMsg()
+ m_shutdownTrigger = l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger;
+ m_lastUserMode = l_tServiceSetIf.data.shutdownRequestMsg.lastUserMode;
+
+ // Notify services ShutDownTrigger the FrameworkunifiedOnStop, if dataResetMode is configured
+ // When using FastSleep, be aware that it may be overwritten here
+ switch (m_DataResetMode) {
+ case e_SS_SM_DATA_RESET_MODE_FACTORY:
+ m_shutdownTrigger = epssdmsdtFACTORY_DATA_RESET;
+ break;
+ case e_SS_SM_DATA_RESET_MODE_USER:
+ m_shutdownTrigger = epssdmsdtUSER_DATA_RESET;
+ break;
+ default:
+ break;
+ }
+
+ if (isImmShutdown) {
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_GROUP_LAUNCH_WAIT_TIMER]);
+
+ // Do not use m_shutdownTrigger because it is updated on DataReset
+ switch (l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger) {
+ case epssdmsdtGENERIC_ERROR_RESET:
+ case epssdmsdtFATAL_ERROR_RESET:
+ CALL_AND_LOG_STATUS((*m_pfStopCompleteHandler)(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Received a Shutdown command while in "
+ "the '%s' state - returning Shutdown "
+ "Response msg now",
+ GetStr(m_SMCurrentState).c_str());
+
+ CALL_AND_LOG_STATUS(SendShutdownResponseMessage(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ break;
+ }
+
+ } else {
+ InitiateAllGroupsShutdown(hApp);
+ }
+ }
+ break;
+
+ case SS_SM_APPS_STOPPING_AT__CWORD56__REQ:
+ case SS_SM_APPS_STOPPING_AT_INTERNAL_REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ:
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Received a Shutdown command while already in "
+ "the '%s' state !!!",
+ GetStr(m_SMCurrentState).c_str());
+ break;
+ } // End switch ( m_SMCurrentState )
+ break;
+ } // End case epsumOFF | epsumON
+ } // End switch (m_lastUserMode )
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnShutdownModulesRequest( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendSystemModeInfoResponse
+/// send SystemModeInfo to
+/// _CWORD56_ ( via Power Service-> PSMShadow ) as an IPC 'Start Notification'
+/// message, informing _CWORD56_ of the startup state of the _CWORD102_.
+///
+/// \param [in] HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::SendSystemModeInfoResponse(HANDLE hApp, EPWR_STARTUP_STAGE_TYPE f_startupStage) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SystemModeInfo l_SystemModeInfo;
+
+ memcpy(&l_SystemModeInfo, &m_SystemModeInfo, sizeof(l_SystemModeInfo));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "stage:%d", f_startupStage);
+ l_SystemModeInfo.startupStage = f_startupStage;
+
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM_SYSTEM_MODE_INFO_RSPN,
+ sizeof(l_SystemModeInfo), (PVOID) & l_SystemModeInfo);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendSystemModeInfoResponse(%s) errored: 0x%X",
+ GetStr(l_SystemModeInfo.startupStage).c_str(), l_eStatus);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " SendSystemModeInfoResponse(%s) successful",
+ GetStr(l_SystemModeInfo.startupStage).c_str());
+ // LCOV_EXCL_STOP
+ }
+
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_SM_SYSTEM_MODE_INFO_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::SendSystemModeInfoResponse( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnSystemModeInfoRequest
+/// Handle System Mode Info request. Send System Mode Info read from NVM
+///
+/// \param [in] HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnSystemModeInfoRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+ m_isRcvModeInfo = TRUE;
+
+ SetCmdHist("SS_SM_SYSTEM_MODE_INFO_REQ", m__CWORD56_CmdHist, m__CWORD56_HistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ if (m_SystemModeInfo.startupStage == epssusfINVALID) {
+ // Transitioning to SYSTEM_SERVICES_STARTED if startupStage == INVALID
+ m_SystemModeInfo.startupStage = epssusSYSTEM_SERVICES_STARTED;
+ }
+
+ l_eStatus = SendSystemModeInfoResponse(hApp, epssusSYSTEM_SERVICES_STARTED);
+ LOG_STATUS(l_eStatus, "SendSystemModeInfoResponse()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (TRUE == m_isRstPending) {
+ ESMCpuResetReason l_resetReason = m_rstPendingInfo.resetReason;
+ std::string l_messageStr = m_rstPendingInfo.messageStr;
+
+ m_isRstPending = FALSE;
+ m_rstPendingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_INVALID;
+ memset(m_rstPendingInfo.messageStr, 0, sizeof(m_rstPendingInfo.messageStr));
+
+ l_eStatus = PerformCpuReset(hApp, l_resetReason, l_messageStr);
+ LOG_STATUS(l_eStatus, "PerformCpuReset()"); // LCOV_EXCL_BR_LINE 6: Because it is executed only once and cannot see all branches
+ }
+
+ if (m_SystemModeInfo.startupStage == epssusALL_SERVICES_LAUNCHED) {
+ // If startupStage == ALL_SERVICES_LAUNCHED
+ // Notify here because Launch of all SVCs is completed first.
+ l_eStatus = SendSystemModeInfoResponse(hApp, epssusALL_SERVICES_LAUNCHED);
+ LOG_STATUS(l_eStatus, "SendSystemModeInfoResponse()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnSystemModeInfoRequest( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnInitCompReportCallback
+/// Handle InitComp report.
+///
+/// \param [in] HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnInitCompReportCallback(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("SS_SM_INITCOMP_REP", m__CWORD56_CmdHist, m__CWORD56_HistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnInitCompReportCallback( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup have_all_services_start_completed
+/// check if state of all services is MODULE_STATE_STARTED
+///
+/// \param [in]
+///
+///
+/// \return BOOL
+/// Success ==> TRUE
+/// Failure ==> FALSE
+///////////////////////////////////////////////////////////////////////////////
+BOOL CSystemManager::have_all_services_start_completed(const SMModuleState f_moduleState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL bIsStartCompleted = TRUE;
+ SMModuleState l_failedState = MODULE_STATE_INVALID;
+
+ switch (f_moduleState) {
+ case MODULE_STATE_STARTED:
+ l_failedState = MODULE_STATE_START_FAILED;
+ break;
+ case MODULE_STATE_STARTED_PRE:
+ l_failedState = MODULE_STATE_START_PRE_FAILED;
+ break;
+ case MODULE_STATE_STOPPED_PRE:
+ l_failedState = MODULE_STATE_STOP_PRE_FAILED;
+ break;
+ case MODULE_STATE_STARTED_BACKGROUND:
+ l_failedState = MODULE_STATE_START_BACKGROUND_FAILED;
+ break;
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ l_failedState = MODULE_STATE_STOP_BACKGROUND_FAILED;
+ break;
+ default:
+ bIsStartCompleted = FALSE;
+ break;
+ }
+ if (l_failedState != MODULE_STATE_INVALID) {
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ for (; l_GroupIterator != m_MapProclaunchGrps.end(); l_GroupIterator++) {
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+ for (; l_ModuleListIterator != l_GroupIterator->second.modules.end(); l_ModuleListIterator++) {
+ if ((l_ModuleListIterator->is_start_required == TRUE)
+ && ((l_ModuleListIterator->IsModuleState(f_moduleState) == FALSE) // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ && (l_ModuleListIterator->IsModuleState(MODULE_STATE_SKIPPED) == FALSE) // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ && (l_ModuleListIterator->IsModuleState(l_failedState) == FALSE))) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ // Allow _SKIPPED/START_FAILED for StartRespMonitor conditions
+ bIsStartCompleted = FALSE;
+ break;
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return bIsStartCompleted;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup is_critical_service_stopped
+///
+///
+/// \param [in]
+///
+///
+/// \return BOOL
+/// Success ==> TRUE
+/// Failure ==> FALSE
+///////////////////////////////////////////////////////////////////////////////
+BOOL CSystemManager::is_service_shutdown_ready(ModuleLaunchListIter &modIte) {
+ if (((modIte->shutdown_critical && modIte->is_start_required)
+ || (modIte->name == FRAMEWORKUNIFIED_NS_NPSERVICE))
+ && modIte->IsModuleState(MODULE_STATE_STOPPED) == FALSE) {
+ // Not shutdown_ready if NPP or shutdown_critical services are not STOPPED.
+ return FALSE;
+ }
+ return TRUE;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup have_critical_services_stopped
+/// check if state of all critical services is MODULE_STATE_STOPPED
+///
+/// \param [in]
+///
+///
+/// \return BOOL
+/// Success ==> TRUE
+/// Failure ==> FALSE
+///////////////////////////////////////////////////////////////////////////////
+BOOL CSystemManager::have_critical_services_stopped() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ uint numStoppingModules = 0;
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ for (; l_GroupIterator != m_MapProclaunchGrps.end(); l_GroupIterator++) {
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+ for (; l_ModuleListIterator != l_GroupIterator->second.modules.end(); l_ModuleListIterator++) {
+ if (l_ModuleListIterator->IsModuleState(MODULE_STATE_STOP_SENT)
+ && l_ModuleListIterator->shutdown_critical) {
+ numStoppingModules++;
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (numStoppingModules == 0);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup perform_force_reset
+///
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::perform_force_reset(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "+");
+
+ // Since initialization must be performed by the PSMs during FactReset, do not NaviDet them as much as possible.
+ if (e_SS_SM_DATA_RESET_MODE_FACTORY == m_DataResetMode) {
+ fprintf(stderr,
+ "SS_SysManager/%s/NO NAVIDET!! but SendShutdownComp for FactReset\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "NO NAVIDET!! but SendShutdownComp for FactReset");
+ CALL_AND_LOG_STATUS(send_shutdown_complete_response(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ sleep(60);
+ } else if (access("/nv/BS/ss/system_manager/rwdata/ss_debug", F_OK) == 0) {
+ fprintf(stderr, "SS_SysManager/%s/NO NAVIDET!! but SendShutdownComp\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NO NAVIDET!! but SendShutdownComp");
+ CALL_AND_LOG_STATUS(send_shutdown_complete_response(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ sleep(60);
+ }
+
+ fflush(stderr);
+ usleep(100 * 1000);
+
+ if (0 == PsmNaviResetPower(hApp, m_ResetFactor)) { // LCOV_EXCL_BR_LINE 200: power_hal if, can not to be error.
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ usleep(300 * 1000);
+ fprintf(stderr, "SS_SysManager/%s/Error: Not Reset !!!\n", __FUNCTION__);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ send_shutdown_complete_response(hApp); // Try to NAVI_RESET even if ignored
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup send_shutdown_complete_response
+///
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::send_shutdown_complete_response(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CALL_AND_LOG_STATUS(ResetModulesStateToConnected(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ SMSetState(hApp, SS_SM_APPS_LAUNCHED_READY_TO_START);
+ // m_ActiveGroupId = SS_SM_INITIAL_GROUP;
+
+ // all the modules have stopped, send Shutdown Response to Power Service
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " All critical services have stopped, Active Group ID is now %d",
+ m_SystemStarter.get_id());
+#if 1
+ CALL_AND_LOG_STATUS(SendShutdownResponseMessage(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+#else
+ //
+ // Normal, production flow is to call SendShutdownResponseMessage(), which
+ // sends the Shutdown Response message to the _CWORD56_, causing the _CWORD56_ to
+ // remove power from the _CWORD102_ before queued-up FRAMEWORKUNIFIEDLOG messages can be // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ // processed by SS_LoggerService.
+ //
+ // Optional development flow is to NOT call SendShutdownResponseMessage(),
+ // thus giving the _CWORD102_ time to process its FRAMEWORKUNIFIEDLOG messages. Since this is an // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ // abnormal, 'bad' condition of NOT sending a Shutdown Response message to
+ // the _CWORD56_, be very obvious about this state by displaying both
+ // compile-time and run-time warning messages.
+ //
+#warning NOT calling SendShutdownResponseMessage(hApp) !
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " Warning: SendShutdownResponseMessage( hApp ) "
+ "#def'f out; ShutdownResponse NOT sent to _CWORD56_");
+#endif
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::SendShutdownResponseMessage(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ SS_SM_SHUTDOWN_MODULES_CMPL_RSPN, 0, (PVOID) NULL); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "FrameworkunifiedSendMsg(PowerService,SS_SM_SHUTDOWN_MODULES_CMPL_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::SendShutdownResponseMessage( HANDLE hApp )
+
+
+PsmFactorT CSystemManager::GetResetFactor(PCSTR f_module_name, BOOL f_user_reset) {
+ PsmFactorT l_reset_factor = PSM_FACTOR_NONE;
+ EFrameworkunifiedStatus l_eStatus;
+ ModuleLaunchListIter l_moduleIter;
+ l_eStatus = GetModuleIterator(f_module_name, l_moduleIter); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("GetModuleIterator()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_reset_factor = GetResetFactor(l_moduleIter, f_user_reset);
+ }
+ return l_reset_factor;
+} // End of PsmFactorT CSystemManager::GetResetFactor(PCSTR f_module_name)
+
+
+PsmFactorT CSystemManager::GetResetFactor(const ModuleLaunchListIter f_module_iter, BOOL f_user_reset) {
+ PsmFactorT l_reset_factor;
+ if (f_module_iter->IsAGLUnit() == TRUE) {
+ if (f_module_iter->IsAGLResetHistoryDisable() == TRUE) {
+ l_reset_factor = PSM_FACTOR_AGL;
+ } else {
+ l_reset_factor = PSM_FACTOR_AGL_WITH_HISTORY;
+ }
+ } else {
+ if (f_module_iter->IsNonAGLResetHistoryDisable() == TRUE) {
+ l_reset_factor = PSM_FACTOR_TIER1;
+ } else {
+ l_reset_factor = PSM_FACTOR_TIER1_WITH_HISTORY;
+ }
+ }
+
+ if (f_user_reset == TRUE) {
+ if ((l_reset_factor == PSM_FACTOR_AGL) || (l_reset_factor == PSM_FACTOR_TIER1)) {
+ l_reset_factor = PSM_FACTOR_USER;
+ } else {
+ l_reset_factor = PSM_FACTOR_USER_WITH_HISTORY;
+ }
+ }
+ return l_reset_factor;
+} // End of PsmFactorT GetResetFactor(ModuleLaunchListIter & f_module_iter)
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnClientStopMonitorTimerExpiry
+///
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnClientStopMonitorTimerExpiry(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from group %d", m_SystemStarter.get_id());
+
+ SetCmdHist("SM_TIMER_CLIENT_STOP_MONITOR", m_TimerCmdHist, m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if ((m_SMCurrentState == SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ)
+ || (m_SMCurrentState == SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ)
+ || m_SystemStarter.get_id() <= SS_SM_THIRD_GROUP) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: StopCompTimeout:gid:%d", m_SystemStarter.get_id());
+ fprintf(stderr, "SS_SysManager/%s/Error: StopCompTimeout:gid:%d\n", __FUNCTION__, m_SystemStarter.get_id());
+
+ for (GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ l_GroupIterator != m_MapProclaunchGrps.end();
+ l_GroupIterator++) {
+ for (ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+ l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++) {
+ if (l_ModuleListIterator->group_id >= m_SystemStarter.get_id()
+ && is_service_shutdown_ready(l_ModuleListIterator) == FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s", l_ModuleListIterator->name.c_str());
+ fprintf(stderr, "SS_SysManager/%s/Error: %s\n", __FUNCTION__, l_ModuleListIterator->name.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ if (!m_SystemStarter.is_begin()) {
+ // Continue termination processing to perform BackupManager termination processing.
+ m_SystemStarter.decrement_id();
+ check_all_groups_have_stopped(hApp);
+ } else {
+ // DEAD CODE
+ fprintf(stderr, "SS_SysManager/%s:SVC stop timeout\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " SVC stop timeout");
+ l_eStatus = CallStopCompleteHandler(hApp);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "CallStopCompleteHandler( hApp )"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ } else {
+ // The current m_ActiveGroupId group just timed out. If possible,
+ // decrement it, and then see if there are more groups to send
+ // stop requests to.
+ if (!m_SystemStarter.is_begin()) {
+ m_SystemStarter.decrement_id();
+ }
+ check_all_groups_have_stopped(hApp);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnClientStopMonitorTimerExpiry( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup check_all_groups_have_stopped
+/// check that all the groups has stopped
+///
+/// \param [in]
+///
+///
+/// \return VOID
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::check_all_groups_have_stopped(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_ActiveGroupId = m_SystemStarter.get_id();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " m_SystemStarter.get_id() is %d, 'm_NPPStopSent' is '%s'"
+ , m_SystemStarter.get_id(), GetStr(m_NPPStopSent).c_str());
+
+ // send stop to next group in reverse order
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " m_NPPStopSent is %s", GetStr(m_NPPStopSent).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ if (!m_NPPStopSent) {
+ l_eStatus = stop_all_modules_of_group(hApp);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: stop_all_modules_of_group(%d) errored: %d/'%s'",
+ l_ActiveGroupId, l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ } else { // (m_ActiveGroupId < SS_SM_INITIAL_GROUP)
+ BOOL l_bIsDetectTimeout;
+
+ if ((l_bIsDetectTimeout = !have_critical_services_stopped())) {
+ // If the Critical service is not terminated even when the final GROUP is completed, DUMP the applicable service and issue NAVI_DET.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FinalCriticalCheck");
+ fprintf(stderr, "SS_SysManager/%s:FinalCriticalCheck\n", __FUNCTION__); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ for (GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ l_GroupIterator != m_MapProclaunchGrps.end();
+ l_GroupIterator++) {
+ for (ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+ l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++) {
+ if (is_service_shutdown_ready(l_ModuleListIterator) == FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s",
+ l_ModuleListIterator->name.c_str());
+ fprintf(stderr, "SS_SysManager/%s/Error: %s\n", // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ __FUNCTION__,
+ l_ModuleListIterator->name.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+ fprintf(stderr, "SS_SysManager/%s:critical service no stop\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "critical service no stop");
+ }
+
+ CALL_AND_LOG_STATUS(CallStopCompleteHandler(hApp, l_bIsDetectTimeout)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // In PastModel002, there was a transition to WAITING_FOR_CRITICAL_APPS in the following processing, but in _CWORD71_,
+ // the transition to WAITING_FOR_CRITICAL_APPS was eliminated by revising the termination processing.
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return;
+} // End of VOID CSystemManager::check_all_groups_have_stopped( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup MarkModuleStateStopped
+/// Sets Module State to STOP COMPLETE
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnNppStopComplete
+/// Npp Stop Complete complete Response\Ack Handlers
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnNppStopComplete(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("NPS_NPP_STOP_ACK", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ char l_cBuf[100];
+ snprintf(l_cBuf, sizeof(l_cBuf), "ProcessModuleStopCompleteResponse(%s)", FRAMEWORKUNIFIED_NS_NPSERVICE);
+ l_eStatus = ProcessModuleStopCompleteResponse(hApp, FRAMEWORKUNIFIED_NS_NPSERVICE);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CSystemManager::GetModuleIterator(PCSTR f_moduleName, ModuleLaunchListIter &f_moduleIter) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ ModuleLaunchListIter l_moduleIter;
+// static int l_numTimesEntered = 0 ;
+// l_numTimesEntered++ ;
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__ // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+// , " NTE %d: Looking for %s"
+// , l_numTimesEntered
+// , f_moduleName);
+
+ BOOL l_bIsFound = FALSE;
+ for (GroupLaunchMapIter l_GroupIter = m_MapProclaunchGrps.begin();
+ !l_bIsFound && l_GroupIter != m_MapProclaunchGrps.end();
+ l_GroupIter++) {
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__ // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+// , " NTE %d: Checking group %d/%s"
+// , l_numTimesEntered
+// , l_GroupIter->second.id
+// , l_GroupIter->second.name.c_str());
+
+ for (l_moduleIter = l_GroupIter->second.modules.begin();
+ !l_bIsFound && (l_moduleIter != l_GroupIter->second.modules.end());
+ l_moduleIter++) {
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__ // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+// , " NTE %d: Checking PCSTR '%s' against std::string '%s': %d, %s"
+// , l_numTimesEntered
+// , f_moduleName
+// , l_moduleIter->name.c_str()
+// , strcmp(l_moduleIter->name.c_str(), f_moduleName)
+// , (0 == strcmp(l_moduleIter->name.c_str(), f_moduleName) ? "True" : "False"));
+
+ l_bIsFound =
+ (0 == strcmp(l_moduleIter->name.c_str(), f_moduleName));
+ if (l_bIsFound) {
+ f_moduleIter = l_moduleIter;
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+//// " NTE %d:"
+// " '%s' is in group %d/%s"
+//// , l_numTimesEntered
+// , f_moduleIter->name.c_str()
+// , l_GroupIter->second.id
+// , l_GroupIter->second.name.c_str());
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+
+ if (!l_bIsFound) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+// " NTE %d:"
+ " Error: '%s' is not in group map 'm_MapProclaunchGrps'"
+// , l_numTimesEntered
+ , f_moduleName);
+ if (0 != strcmp(f_moduleName, SERVICE_SYSMANAGER)) {
+ SysMgrConfiguration m_launchConfig;
+ m_launchConfig.PrintAllInfo(m_MapProclaunchGrps);
+ }
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::GetModuleIterator( PCSTR f_moduleName
+
+BOOL CSystemManager::IsGroupStarted(UI_32 f_groupID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bIsStarted = TRUE;
+
+ GroupLaunchMapIter l_GroupIter = m_MapProclaunchGrps.find(f_groupID);
+ if (l_GroupIter == m_MapProclaunchGrps.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Group Map Empty; was looking for group %d", f_groupID);
+ } else {
+ ModuleLaunchListIter l_ModuleListIter = l_GroupIter->second.modules.begin();
+ const SMModuleState l_dest_state = InProgressStateToState(); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ if (l_dest_state != MODULE_STATE_INVALID) {
+ for (; l_ModuleListIter != l_GroupIter->second.modules.end(); l_ModuleListIter++) {
+ if (((l_ModuleListIter->IsModuleState(l_dest_state) == FALSE) // LCOV_EXCL_BR_START 11:Gcov constraints (because exception-handling routes are automatically generated)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_START_FAILED) == FALSE)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_START_PRE_FAILED) == FALSE)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_PRE_FAILED) == FALSE)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_START_BACKGROUND_FAILED) == FALSE)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_BACKGROUND_FAILED) == FALSE)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_FAILED) == FALSE))
+ // LCOV_EXCL_BR_STOP 11:Gcov constraints (because exception-handling routes are automatically generated)
+ || ((l_ModuleListIter->is_start_required == TRUE)
+ // LCOV_EXCL_START 6: Because the value cannot be stored to make the condition true
+ && ((l_ModuleListIter->IsModuleState(MODULE_STATE_LAUNCHING) == TRUE)
+ || (l_ModuleListIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)
+ || (l_ModuleListIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)))) {
+ // LCOV_EXCL_STOP 6: Because the value cannot be stored to make the condition true
+ l_bIsStarted = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " No: '%s' in group %d/%s is '%s'", l_ModuleListIter->name.c_str(),
+ l_GroupIter->second.id, l_GroupIter->second.name.c_str(),
+ l_ModuleListIter->ModuleStateStr().c_str());
+ break;
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bIsStarted;
+} // End of BOOL CSystemManager::IsGroupStarted(UI_32 f_groupId)
+
+BOOL CSystemManager::IsGroupStopped(UI_32 f_groupID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bIsStopped = TRUE;
+ ModuleLaunchListIter l_ModuleListIter;
+
+ GroupLaunchMapIter l_GroupIter = m_MapProclaunchGrps.find(f_groupID);
+ if (l_GroupIter == m_MapProclaunchGrps.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Group Map Empty; was looking for group %d",
+ f_groupID);
+ } else {
+ for (l_ModuleListIter = l_GroupIter->second.modules.begin();
+ l_bIsStopped
+ && l_ModuleListIter != l_GroupIter->second.modules.end();
+ l_ModuleListIter++) {
+ if (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_SENT)) {
+ l_bIsStopped = FALSE;
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bIsStopped;
+} // End of BOOL CSystemManager::IsGroupStopped(UI_32 f_groupId)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnStopComplete
+/// Shutdown complete Response\Ack Handlers
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnModuleStopCompleteResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusErrOther;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ PCSTR l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", l_moduleName);
+ SetCmdHist("SS_SM_STOP_COMPL_RSPN", m_SMCmdHist, m_SMHistIter, l_moduleName);
+
+ char l_cBuf[100];
+ snprintf(l_cBuf, sizeof(l_cBuf), "ProcessModuleStopCompleteResponse(%s)", l_moduleName);
+ l_eStatus = ProcessModuleStopCompleteResponse(hApp, l_moduleName);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnModuleStopCompleteResponse( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnGetStartExtInfo
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnGetStartExtInfo(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ T_SS_SM_START_ExtDataStructType l_extInfo = { 0 };
+
+ SS_STATIC_ASERT(sizeof(T_SS_SM_START_ExtDataStructType) == SS_SM_START_EXT_INFO_SIZE); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+ ");
+
+ SetCmdHist("SS_SM_GET_START_EXT_INFO", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ l_extInfo.isProgUpdated =
+ (m_ProgUpdateState & SS_SM_PROG_UPDATE_STATE_UPDATED) ? TRUE : FALSE;
+ l_extInfo.isMapUpdated =
+ (m_ProgUpdateState & SS_SM_PROG_UPDATE_STATE_MAP_UPDATED) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_extInfo.isMapDiffUpdated =
+ (m_ProgUpdateState & SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ ModuleLaunchListIter l_ModuleListIter;
+
+ l_eStatus = GetModuleIterator(FrameworkunifiedGetMsgSrc(hApp), l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s not found", FrameworkunifiedGetMsgSrc(hApp));
+ } else {
+ switch (l_ModuleListIter->relaunch_status) {
+ case NotRelaunched:
+ l_extInfo.relaunchStatus = e_SS_SM_RELAUNCH_STATUS_NONE;
+ break;
+ case RelaunchSafe:
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_extInfo.relaunchStatus = e_SS_SM_RELAUNCH_STATUS_SAFE;
+ break;
+ case RelaunchErr:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_extInfo.relaunchStatus = e_SS_SM_RELAUNCH_STATUS_ERR;
+ break;
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_extInfo.relaunchStatus = e_SS_SM_RELAUNCH_STATUS_NONE;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData()
+ // because this request is sent by FrameworkunifiedInvokeSync()
+ l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_extInfo, sizeof(l_extInfo));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnGetStartExtInfo( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnGetStopExtInfo
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnGetStopExtInfo(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ T_SS_SM_STOP_ExtDataStructType l_extInfo = { 0 };
+
+ SS_STATIC_ASERT(sizeof(T_SS_SM_STOP_ExtDataStructType) == SS_SM_STOP_EXT_INFO_SIZE); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+ ");
+
+ SetCmdHist("SS_SM_GET_STOP_EXT_INFO", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ l_extInfo.isProgUpdated =
+ (m_ProgUpdateState & SS_SM_PROG_UPDATE_STATE_UPDATED) ? TRUE : FALSE;
+
+ // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData()
+ // because this request is sent by FrameworkunifiedInvokeSync()
+ l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_extInfo, sizeof(l_extInfo));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnGetStopExtInfo( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnModuleStopCompleteNotification
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnModuleStopCompleteNotification(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+ ");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ ShutdownComplete l_shutdownNotif; /// \file frameworkunified_framework_types.h
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < ShutdownComplete > (hApp, l_shutdownNotif))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ PCSTR l_moduleName = l_shutdownNotif.cServiceName;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " '%s' 'Shutdown Complete Status' is 0x%X", l_moduleName,
+ l_shutdownNotif.eShutdownCompleteStatus);
+
+ char l_cBuf[100];
+ snprintf(l_cBuf, sizeof(l_cBuf),
+ "ProcessModuleStopCompleteResponse(%s)", l_moduleName);
+ l_eStatus = ProcessModuleStopCompleteResponse(hApp, l_moduleName);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::onmodulestopcompletenotification( HANDLE hApp )
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CSystemManager::ProcessModuleStopCompleteResponse(HANDLE hApp, PCSTR f_moduleName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ ModuleLaunchListIter l_ModuleListIter;
+ l_eStatus = GetModuleIterator(f_moduleName, l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Module %s not found in Group Launch Map", f_moduleName);
+ } else {
+ switch (m_SMCurrentState) {
+ case SS_SM_READY_TO_LAUNCH_APP:
+ case SS_SM_APPS_LAUNCH_IN_PROGRESS:
+ case SS_SM_APPS_LAUNCHED_READY_TO_START:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Received from client while in "
+ "the '%s' state !!!",
+ GetStr(m_SMCurrentState).c_str());
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+
+ case SS_SM_APPS_STOPPING_AT__CWORD56__REQ:
+ case SS_SM_APPS_STOPPING_AT_INTERNAL_REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ:
+ if (m_SystemStarter.get_id() == SS_SM_THIRD_GROUP) {
+ // Execute shutdown_critical services termination synchronization prior to CoreModule(backupManager termination processing
+ l_ModuleListIter->SetModuleState(MODULE_STATE_STOPPED);
+ if (have_critical_services_stopped()) { // Transition after all critical services have ended
+ ProcessGroupOnModuleStopResponse(hApp, m_SystemStarter.get_id());
+ }
+ } else {
+ l_eStatus = ModuleCompleteResponse(hApp, l_ModuleListIter,
+ MODULE_STATE_STOPPED,
+ (SysMgrCbType3<CSystemManager,
+ &CSystemManager::IsGroupStopped>),
+ (SysMgrCbType2<CSystemManager,
+ &CSystemManager::ProcessGroupOnModuleStopResponse>),
+ "stop");
+ }
+ break;
+
+ case SS_SM_APPS_START_COMPLETE:
+ case SS_SM_APPS_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_RUN_COMPLETE:
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_RUN_COMPLETE:
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Received from client while in "
+ "the '%s' state !!!",
+ GetStr(m_SMCurrentState).c_str());
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+ } // End switch ( m_SMCurrentState )
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ProcessModuleStopCompleteResponse(
+
+EFrameworkunifiedStatus CSystemManager::ProcessGroupOnModuleStopResponse(HANDLE hApp, UI_32 f_groupID) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_ActiveGroupId = m_SystemStarter.get_id();
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_CLIENT_STOP_MONITOR]);
+
+ if (f_groupID != l_ActiveGroupId) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Group %d stop complete, but m_SystemStarter.get_id() is %d",
+ f_groupID
+ // , m_ActiveGroupId); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ , l_ActiveGroupId);
+ } else {
+ if (!m_SystemStarter.is_begin()) {
+ m_SystemStarter.decrement_id();
+ }
+ check_all_groups_have_stopped(hApp);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ProcessGroupOnModuleStopResponse( HANDLE hApp
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup stop_all_modules_of_group
+/// Send SS_SM_STOP to all modules of the given group
+///
+/// \param [in]
+///
+///
+/// \return VOID
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::stop_all_modules_of_group(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ModuleLaunchList::reverse_iterator l_revIter;
+
+ UI_32 l_uiMaxGroupWaitTime_sec = 0;
+ UI_32 l_uiMaxGroupWaitTime_msec = 0;
+ UI_32 l_uiModuleWaitTime = 0;
+
+ // GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(m_ActiveGroupId);
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(m_SystemStarter.get_id());
+ if (l_GroupIterator == m_MapProclaunchGrps.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Group %d not found; 'm_MapProclaunchGrps' is empty"
+ //, m_ActiveGroupId); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ , m_SystemStarter.get_id());
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ } else {
+ int l_numModulesMessaged = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "StopReq grp:%d", m_SystemStarter.get_id());
+
+ T_SS_SM_STOP_DataStructType l_SM_STOP_Struct;
+ l_SM_STOP_Struct.shutdownTrigger = m_shutdownTrigger;
+ l_SM_STOP_Struct.lastUserMode = m_lastUserMode;
+
+ for (l_revIter = l_GroupIterator->second.modules.rbegin();
+ l_revIter != l_GroupIterator->second.modules.rend();
+ l_revIter++) {
+ // LCOV_EXCL_BR_START 11: Excluded due to gcov constraints (others)
+ if ((l_revIter->IsModuleState(MODULE_STATE_START_SENT) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STARTED) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_START_PRE_SENT) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STARTED_PRE) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STOP_PRE_SENT) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STOPPED_PRE) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_START_BACKGROUND_SENT) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STARTED_BACKGROUND) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STOP_BACKGROUND_SENT) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STOPPED_BACKGROUND) == TRUE)) {
+ // LCOV_EXCL_BR_STOP 11: Excluded due to gcov constraints (others)
+ if (FRAMEWORKUNIFIED_NS_NPSERVICE == l_revIter->name) {
+ if (epssdmsdtFACTORY_DATA_RESET == m_shutdownTrigger) {
+ CALL_AND_LOG_STATUS(FrameworkunifiedSendStopToNSNPP(hApp, eFrameworkunifiedDataResetShutdown, eFrameworkunifiedUserData | eFrameworkunifiedFactoryData)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (epssdmsdtUSER_DATA_RESET == m_shutdownTrigger) {
+ CALL_AND_LOG_STATUS(FrameworkunifiedSendStopToNSNPP(hApp, eFrameworkunifiedDataResetShutdown, eFrameworkunifiedUserData)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (epssdmsdtFAST_SLEEP_MODE == m_shutdownTrigger) {
+ CALL_AND_LOG_STATUS(FrameworkunifiedSendStopToNSNPP(hApp, eFrameworkunifiedQuickShutdown)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ CALL_AND_LOG_STATUS(FrameworkunifiedSendStopToNSNPP(hApp, eFrameworkunifiedNormalShutdown)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ l_revIter->SetModuleState(MODULE_STATE_STOP_FAILED);
+ } else {
+ l_revIter->SetModuleState(MODULE_STATE_STOP_SENT);
+ l_numModulesMessaged++;
+ }
+
+ m_NPPStopSent = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " m_NPPStopSent is %s", GetStr(m_NPPStopSent).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ // End else if ( FRAMEWORKUNIFIED_NS_NPSERVICE == l_ModuleListIter->name )
+ } else {
+ l_eStatus = l_revIter->SendMsgAndUpdateState(&l_SM_STOP_Struct);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "l_revIter->SendMsgAndUpdateState(&l_SM_STOP_Struct)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (epssdmsdtFAST_SLEEP_MODE == m_shutdownTrigger) {
+ l_uiModuleWaitTime = l_revIter->fast_shutdown_wait_time;
+
+ } else {
+ l_uiModuleWaitTime = l_revIter->shutdown_wait_time;
+ }
+ if (l_uiModuleWaitTime > l_uiMaxGroupWaitTime_sec) {
+ l_uiMaxGroupWaitTime_sec = l_uiModuleWaitTime;
+ }
+ l_numModulesMessaged++;
+ }
+ } // End if MODULE_STATE_STARTED || MODULE_STATE_START_SENT
+ } else if (l_revIter->IsModuleState(MODULE_STATE_INVALID)
+ && FRAMEWORKUNIFIED_NS_NPSERVICE == l_revIter->name) {
+ m_NPPStopSent = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "StopNotSent:%s is INVALID", FRAMEWORKUNIFIED_NS_NPSERVICE);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "StopNotSent:%s is %s",
+ l_revIter->name.c_str(),
+ l_revIter->ModuleStateStr().c_str());
+ }
+ }
+
+ if (0 == l_numModulesMessaged) {
+ LogGroupModulesState(m_SystemStarter.get_id() // m_ActiveGroupId // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ , " Warning: NO modules were sent SS_SM_STOP");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "StopComp grp:%d", l_GroupIterator->second.id);
+
+ if (m_SystemStarter.get_id() > SS_SM_INITIAL_GROUP) {
+ m_SystemStarter.decrement_id();
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " m_ActiveGroupId is now %d", m_SystemStarter.get_id());
+
+ check_all_groups_have_stopped(hApp);
+ }
+ } else {
+ if (epssdmsdtFAST_SLEEP_MODE == m_shutdownTrigger) {
+ // fast shutdown wait time always comes in milli seconds
+ UI_32 l_uiTotalWaitTime = l_uiMaxGroupWaitTime_sec;
+ l_uiMaxGroupWaitTime_sec = l_uiTotalWaitTime / 1000;
+ l_uiMaxGroupWaitTime_msec = l_uiTotalWaitTime % 1000;
+ } else {
+ // Other types of shutdown except fast shutdown always comes in seconds.
+ l_uiMaxGroupWaitTime_msec = 0;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "StopTimer grp:%d time:%d.%d",
+ m_SystemStarter.get_id(), l_uiMaxGroupWaitTime_sec,
+ l_uiMaxGroupWaitTime_msec);
+ m_GroupLaunchTimer->StartTimerMulti(
+ m_aTimerIDs[eSM_TIMER_CLIENT_STOP_MONITOR],
+ l_uiMaxGroupWaitTime_sec, l_uiMaxGroupWaitTime_msec, 0, 0,
+ m_SystemStarter.get_id());
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of VOID CSystemManager::stop_all_modules_of_group(HANDLE hApp)
+
+EFrameworkunifiedStatus CSystemManager::ValidateUserModeMessage(HANDLE hApp, EPWR_USER_MODE_TYPE &l_eUserModeState) { // LCOV_EXCL_START 6: Because the condition cannot be set // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ Pwr_ServiceSetInterface tServiceSetIf;
+ EPWR_USER_MODE_TYPE l_my_eUserModeState;
+
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < Pwr_ServiceSetInterface > (hApp, tServiceSetIf))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_my_eUserModeState = tServiceSetIf.data.user_mode.mode;
+ switch (l_my_eUserModeState) {
+ case epsumINVALID:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: l_eUserModeState == epsumINVALID");
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+
+ case epsumOFF:
+ case epsumON:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Validated '%s'",
+ l_my_eUserModeState == epsumON ? "epsumON" : "epsumOFF");
+ l_eUserModeState = l_my_eUserModeState;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ } // End switch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ValidateUserModeMessage( HANDLE hApp, EPWR_USER_MODE_TYPE &l_eUserModeState )
+// LCOV_EXCL_STOP
+
+//*****************************************************************************
+// Next Wakeup Type Set Protocol functions *
+// *
+EFrameworkunifiedStatus CSystemManager::OnSetNextWakeupTypeRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ ESMNextWakeupType l_wakeupType;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+ SetCmdHist("SS_SM_NEXT_WAKEUP_TYPE_SET_REQ", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < ESMNextWakeupType > (hApp, l_wakeupType))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ switch (l_wakeupType) {
+ case e_SS_SM_NEXT_WAKEUP_TYPE_NONE:
+ case e_SS_SM_NEXT_WAKEUP_TYPE_COLD:
+ case e_SS_SM_NEXT_WAKEUP_TYPE_HOT:
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "unknown type(%d)", l_wakeupType);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ }
+ l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_eStatus, sizeof(l_eStatus));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnSetNextWakeupTypeRequest( HANDLE hApp )
+
+// *
+// End of Boot Mode Protocol functions *
+//*****************************************************************************
+
+
+//*****************************************************************************
+// Data Reset Mode Protocol functions *
+// *
+EFrameworkunifiedStatus CSystemManager::OnSetDataResetModeRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ ESMDataResetModeInfo l_dataResetMode;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("SS_SM_DATA_RESET_MODE_SET_REQ", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < ESMDataResetModeInfo > (hApp, l_dataResetMode))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ uint32_t tmp;
+ m_DataResetMode = l_dataResetMode;
+ tmp = static_cast<uint32_t>(m_DataResetMode);
+ if (PowerHalSetResetInfo(AGL_DATARESET_STATE, tmp)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not set AGL_DATARESET_STATE.");
+ // Return error to client of system_manager.
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ //
+ // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData()
+ // because this request is sent by FrameworkunifiedInvokeSync()
+ //
+ l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_eStatus, sizeof(l_eStatus));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnSetDataResetModeRequest( HANDLE hApp )
+
+EFrameworkunifiedStatus CSystemManager::OnSetProgUpdateStateRequest(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ SMProgUpdateState l_progUpdateState;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("SS_SM_PROG_UPDATE_STATE_SET_REQ", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < SMProgUpdateState > (hApp, l_progUpdateState))) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ m_ProgUpdateState |= l_progUpdateState;
+ if (PowerHalSetResetInfo(AGL_PROGUPDATE_STATE, m_ProgUpdateState)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not set AGL_PROGUPDATE_STATE.");
+ // return Error to client of system_manager.
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData()
+ // because this request is sent by FrameworkunifiedInvokeSync()
+ l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_eStatus, sizeof(l_eStatus));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnSetProgUpdateStateRequest( HANDLE hApp )
+
+EFrameworkunifiedStatus CSystemManager::CallStopCompleteHandler(HANDLE hApp, BOOL bIsDetectTimeout /* = FALSE */) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+
+ if (bIsDetectTimeout) {
+ fprintf(stderr, "SS_SysManager/%s/State StopComplete(timeout)\n", __FUNCTION__);
+ } else {
+ fprintf(stderr, "SS_SysManager/%s/State StopComplete\n", __FUNCTION__);
+ }
+
+ l_eStatus = SecureChipOff();
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: SecureChipOff Failed");
+ }
+
+ l_eStatus = (*m_pfStopCompleteHandler)(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::CallStopCompleteHandler( HANDLE hApp )
+
+
+//*****************************************************************************
+// Soft Reset Protocol functions *
+// *
+static char *get_line(const char *filepath) {
+ char line[LINE_MAX];
+ FILE *fp;
+
+ if ((fp = fopen(filepath, "rb")) == NULL)
+ return NULL;
+ if (fgets(line, LINE_MAX, fp) == NULL) { // LCOV_EXCL_BR_LINE 5:fgets error
+ // LCOV_EXCL_START 5: fgets error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fclose(fp);
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ fclose(fp);
+
+ return strdup(line);
+}
+
+EFrameworkunifiedStatus CSystemManager::PerformCpuReset(HANDLE hApp,
+ ESMCpuResetReason f_eSmCpuResetReason, std::string f_messageStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (FALSE == m_isRcvModeInfo) {
+ // If the condition for implementing the CpuReset request is not satisfied, keep the request.
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Cpu Reset Pending");
+ m_isRstPending = TRUE;
+ m_rstPendingInfo.resetReason = f_eSmCpuResetReason;
+ snprintf(m_rstPendingInfo.messageStr,
+ sizeof(m_rstPendingInfo.messageStr), "%s", f_messageStr.c_str());
+ } else {
+ switch (f_eSmCpuResetReason) {
+ case e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR:
+ case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR:
+ case e_SS_SM_CPU_RESET_REASON_DSP_ERR:
+ m_isImmResetReq = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " will reset immediately");
+ // The break is omitted because the same process as for a normal reboot is performed.
+ case e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET:
+ m_pfStopCompleteHandler = (SysMgrCallback<CSystemManager, &CSystemManager::perform_force_reset>);
+ case e_SS_SM_CPU_RESET_REASON_NORMAL: {
+ TSystemManagerCpuResetInfo l_resetInfo;
+
+ l_resetInfo.resetReason = f_eSmCpuResetReason;
+ snprintf(l_resetInfo.messageStr, SS_SM_RESET_MSG_STR_SIZE, "%s", f_messageStr.c_str());
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM_CPU_RESET_REQ,
+ sizeof(l_resetInfo), (PVOID) & l_resetInfo);
+ LOG_STATUS(l_eStatus, // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ "FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM_CPU_RESET_REQ)");
+ }
+ break;
+ case e_SS_SM_CPU_RESET_REASON_DATA_RESET: {
+ ESMDataResetType l_eSmDataResetType;
+
+ switch (m_DataResetMode) {
+ case e_SS_SM_DATA_RESET_MODE_FACTORY:
+ l_eSmDataResetType = e_SS_SM_DATA_RESET_TYPE_FACTORY;
+ break;
+ case e_SS_SM_DATA_RESET_MODE_USER:
+ l_eSmDataResetType = e_SS_SM_DATA_RESET_TYPE_USER;
+ l_eStatus = FrameworkunifiedBroadcastEvent(hApp, SS_SM_EVENT_USER_DATA_RESET, NULL, 0);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedBroadcastEvent(SS_SM_EVENT_USER_DATA_RESET)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ break;
+ default:
+ SS_ASERT_LOG(0, "unexpected data reset mode : %d", m_DataResetMode); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ }
+ if (l_eStatus == eFrameworkunifiedStatusOK) {
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession,
+ SS_SM_REMOTE_DATA_RESET_REQ, sizeof(l_eSmDataResetType),
+ (PVOID) & l_eSmDataResetType);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM_REMOTE_DATA_RESET_REQ)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ break;
+ case e_SS_SM_CPU_RESET_REASON_INVALID:
+ default:
+ SS_ASERT_LOG(0, " Error: Unknown CPU reset request type: 0x%X/%d", // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ f_eSmCpuResetReason, f_eSmCpuResetReason);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::PerformCpuReset( ESMCpuResetReason f_eSmCpuResetReason )
+
+//*****************************************************************************
+// CPU Reset Protocol functions *
+// *
+EFrameworkunifiedStatus CSystemManager::OnCpuResetRequest(HANDLE hApp) { // SS_SM_CPU_RESET_REQ
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", l_moduleName.c_str());
+
+ // If you implement FastSleep,
+ // ShutdownTrigger of FrameworkunifiedOnStop needs to be changed to FAST_SLEEP_MODE,
+ // and also MaxShutdownTime needs to be changed to CriticalAppsMaxShutdownTimeFastSleep
+
+ try {
+ TSystemManagerCpuResetInfo l_resetInfo;
+ SetCmdHist("SS_SM_CPU_RESET_REQ", m_SMCmdHist, m_SMHistIter, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < TSystemManagerCpuResetInfo > (hApp, l_resetInfo))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ char l_cBuf[100];
+ EErrorEventType l_errorEventType;
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_loggingInfo.messageStr = l_resetInfo.messageStr;
+ l_loggingInfo.suffixStr = l_resetInfo.suffixStr;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
+ " CPU Reset Reason: '%d'/'%s' from %s",
+ l_resetInfo.resetReason,
+ GetStr(l_resetInfo.resetReason).c_str(),
+ FrameworkunifiedGetMsgSrc(hApp));
+
+ if (e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL == l_resetInfo.resetReason) {
+ m_isImmResetReq = TRUE;
+ l_resetInfo.resetReason = e_SS_SM_CPU_RESET_REASON_NORMAL;
+ }
+ switch (l_resetInfo.resetReason) {
+ case e_SS_SM_CPU_RESET_REASON_DATA_RESET:
+ switch (m_DataResetMode) {
+ case e_SS_SM_DATA_RESET_MODE_FACTORY:
+ case e_SS_SM_DATA_RESET_MODE_USER:
+ break;
+ case e_SS_SM_DATA_RESET_MODE_NONE:
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "unexpected data reset mode : %d", m_DataResetMode);
+ throw eFrameworkunifiedStatusInvldParam;
+ }
+ case e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR:
+ case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR:
+ case e_SS_SM_CPU_RESET_REASON_DSP_ERR:
+ case e_SS_SM_CPU_RESET_REASON_NORMAL:
+ l_errorEventType = eErrorEventTypeModuleInvokedResetRequest;
+ l_loggingInfo.resetReason = l_resetInfo.resetReason;
+ break;
+ case e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET:
+ // Separate ErrorEventType only for USER_FORCE_RESET, because the logs to be saved differ.
+ l_errorEventType = eErrorEventTypeUserInvokedUserForceReset;
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET;
+ break;
+ case e_SS_SM_CPU_RESET_REASON_INVALID:
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Unknown CPU reset request type: 0x%X/%d",
+ l_resetInfo.resetReason, l_resetInfo.resetReason);
+ throw eFrameworkunifiedStatusInvldParam;
+ }
+
+ l_eStatus = ErrorEventEnqueue(hApp, l_errorEventType, l_moduleName,
+ eErrorEventResetTypeHard, l_loggingInfo);
+
+ snprintf(l_cBuf, sizeof(l_cBuf), "ErrorEventEnqueue(%s)",
+ GetStr(l_errorEventType).c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ } catch (EFrameworkunifiedStatus e) {
+ l_eStatus = e;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// *
+// End of CPU Reset Protocol functions *
+//*****************************************************************************
+
+VOID CSystemManager::InitiateAllGroupsShutdown(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ // Prioritize safe termination sequence and do not save logs during termination
+ m_errorEventQueueLocked = TRUE;
+
+ m_MaxShutdownTime = calculate_max_shutdown_time();
+
+ l_eStatus = FrameworkunifiedNPPublishNotification(hApp, NTFY_SSSystemMgrShutdownStarted, NULL, 0);
+
+ SetCmdHist(NTFY_SSSystemMgrShutdownStarted, m_PubCmdHist, m_PubHistIter, ""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "FrameworkunifiedNPPublishNotification(" NTFY_SSSystemMgrShutdownStarted ")");
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_START_RESP_MONITOR_WAIT_TIMER]);
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_CLIENT_START_MONITOR]);
+
+ // Stop Heartbeat thread activity
+ l_eStatus = SendRequestToHeartBeat(hApp, SS_HEARTBEAT_STOP, NULL, 0);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "SendRequestToHeartBeat(SS_HEARTBEAT_STOP)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ SMSetState(hApp, SS_SM_APPS_STOPPING_AT__CWORD56__REQ);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "shutdownTrigger:%s, lastUserMode:%s",
+ GetStr(m_shutdownTrigger).c_str(), GetStr(m_lastUserMode).c_str());
+
+ fprintf(stderr, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ "SS_SysManager/%s/State shutdownTrigger:%s, lastUserMode:%s\n", // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ __FUNCTION__, GetStr(m_shutdownTrigger).c_str(), // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ GetStr(m_lastUserMode).c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ /// Send SS_SM_STOP to all modules, starting with the m_ActiveGroupId group
+ m_NPPStopSent = FALSE;
+ check_all_groups_have_stopped(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return;
+} // End of EFrameworkunifiedStatus CSystemManager::InitiateAllGroupsShutdown(HANDLE hApp)
+
+VOID CSystemManager::SendDeferMsg(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!m_dqDeferMsg.empty()) {
+ EFrameworkunifiedStatus l_eStatus;
+ SM_POWER_EVENT_INFO deferMsg;
+
+ deferMsg = m_dqDeferMsg.front();
+ m_dqDeferMsg.pop();
+
+ HANDLE hSender = McOpenSender(SERVICE_SYSMANAGER);
+ if (hSender == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: McOpenSender(SERVICE_SYSMANAGER)");
+ // LCOV_EXCL_STOP
+ } else {
+ CALL_AND_LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ McSend(hSender, SERVICE_POWER, deferMsg.first,
+ sizeof(Pwr_ServiceSetInterface),
+ (PVOID) & deferMsg.second));
+ CALL_AND_LOG_STATUS_IF_ERRORED(McClose(hSender)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ return;
+} // End of VOID CSystemManager::SendDeferMsg(HANDLE hApp)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup PublishPowerOnOffNotification
+/// Power Off notification handler
+///
+/// \param [in]
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::PublishPowerOnOffNotification(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = PerformPowerOnOffUserModePublication(hApp, NTFY_SSSystemMgrPowerOnOff);
+
+ SetCmdHist(NTFY_SSSystemMgrPowerOnOff, m_PubCmdHist, m_PubHistIter, "");
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformPowerOnOffUserModePublication()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::PublishUserModeNotification(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = PerformPowerOnOffUserModePublication(hApp, NTFY_SSSystemMgrUserMode);
+
+ SetCmdHist(NTFY_SSSystemMgrUserMode, m_PubCmdHist, m_PubHistIter, "");
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformPowerOnOffUserModePublication()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::PublishUserModeNotification(
+
+EFrameworkunifiedStatus CSystemManager::PerformPowerOnOffUserModePublication(HANDLE hApp, const char * p_NotificationStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ char l_cBuf[500] = { 0 };
+
+ if (m_SMConfig.UMConfig.IsUserModeNotificationABOOL) {
+ BOOL l_bUuserMode(m_PowerType_to_SSBoolEnumMap[m_Wake.powerupType]);
+
+ snprintf(l_cBuf, sizeof(l_cBuf), "FrameworkunifiedNPPublishNotification(%s, %s)",
+ p_NotificationStr, GetStr(l_bUuserMode).c_str());
+ l_eStatus = FrameworkunifiedNPPublishNotification(hApp, p_NotificationStr,
+ &l_bUuserMode, sizeof(l_bUuserMode));
+ } else {
+ T_SS_SM_UserModeOnOffNotification_Struct l_UserModeOnOffStruct(
+ m_PowerType_to_SSBoolEnumMap[m_Wake.powerupType],
+ m_StartUpReason, m_userModeChangeReason);
+
+ snprintf(l_cBuf, sizeof(l_cBuf),
+ "FrameworkunifiedNPPublishNotification(%s, %s, %s, %s)", p_NotificationStr,
+ GetStr(l_UserModeOnOffStruct.isUserModeOn).c_str(),
+ GetStr(m_StartUpReason).c_str(),
+ GetStr(m_userModeChangeReason).c_str());
+ l_eStatus = FrameworkunifiedNPPublishNotification(hApp, p_NotificationStr,
+ &l_UserModeOnOffStruct, sizeof(l_UserModeOnOffStruct));
+ }
+
+ SetCmdHist(p_NotificationStr, m_PubCmdHist, m_PubHistIter, "");
+ LOG_STATUS(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::PerformPowerOnOffUserModePublication(
+
+EFrameworkunifiedStatus CSystemManager::ResetModulesStateToConnected(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ModuleLaunchListIter l_moduleIter;
+ for (GroupLaunchMapIter l_GroupIter = m_MapProclaunchGrps.begin();
+ l_GroupIter != m_MapProclaunchGrps.end(); l_GroupIter++) {
+ for (l_moduleIter = l_GroupIter->second.modules.begin();
+ l_moduleIter != l_GroupIter->second.modules.end();
+ l_moduleIter++) {
+ if (l_moduleIter->name == FRAMEWORKUNIFIED_NS_NPSERVICE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s ( Group %d/%s ) is %s",
+ l_moduleIter->name.c_str(), l_GroupIter->second.id,
+ l_GroupIter->second.name.c_str(),
+ l_moduleIter->ModuleStateStr().c_str());
+ l_moduleIter->SetModuleState(MODULE_STATE_STARTED); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ // End else if ( FRAMEWORKUNIFIED_NS_NPSERVICE == l_ModuleListIter->name )
+ } else {
+ switch (l_moduleIter->GetModuleState()) {
+ case MODULE_STATE_INVALID:
+ case MODULE_STATE_SKIPPED:
+ case MODULE_STATE_LAUNCHING:
+ case MODULE_STATE_LAUNCHED:
+ case MODULE_STATE_LAUNCH_FAILED:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s ( Group %d/%s ) is %s, NOT setting to "
+ "MODULE_STATE_CONNECTED",
+ l_moduleIter->name.c_str(), l_GroupIter->second.id,
+ l_GroupIter->second.name.c_str(),
+ l_moduleIter->ModuleStateStr().c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ break;
+
+ case MODULE_STATE_STARTED:
+ case MODULE_STATE_START_SENT:
+ case MODULE_STATE_CONNECTED:
+ case MODULE_STATE_START_FAILED:
+ case MODULE_STATE_STOP_FAILED:
+ case MODULE_STATE_STOP_SENT:
+ case MODULE_STATE_STOPPED:
+ case MODULE_STATE_START_PRE_SENT:
+ case MODULE_STATE_START_PRE_FAILED:
+ case MODULE_STATE_STARTED_PRE:
+ case MODULE_STATE_STOP_PRE_SENT:
+ case MODULE_STATE_STOP_PRE_FAILED:
+ case MODULE_STATE_STOPPED_PRE:
+ case MODULE_STATE_START_BACKGROUND_SENT:
+ case MODULE_STATE_START_BACKGROUND_FAILED:
+ case MODULE_STATE_STARTED_BACKGROUND:
+ case MODULE_STATE_STOP_BACKGROUND_SENT:
+ case MODULE_STATE_STOP_BACKGROUND_FAILED:
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s ( Group %d/%s ) is %s",
+ l_moduleIter->name.c_str(), l_GroupIter->second.id,
+ l_GroupIter->second.name.c_str(),
+ l_moduleIter->ModuleStateStr().c_str());
+ l_moduleIter->SetModuleState(MODULE_STATE_CONNECTED);
+ break;
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ResetModulesStateToConnected(HANDLE hApp)
+
+EFrameworkunifiedStatus CSystemManager::On_CWORD56_HeartBeatRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ PCSTR l_senderName = FrameworkunifiedGetMsgSrc(hApp);
+
+ SetCmdHist("SS_SM__CWORD56__HEARTBEAT_REQ", m_SMCmdHist, m_SMHistIter, l_senderName);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, " Received from %s", l_senderName);
+ EPWR_HB_REQ_MSG_STRUCT l_hbReq;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < EPWR_HB_REQ_MSG_STRUCT > (hApp, l_hbReq))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER__CWORD56__HEARTBEAT_RESPONSE]);
+
+ if (l_hbReq.IntervalSec > 0) {
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER__CWORD56__HEARTBEAT_RESPONSE], 0, 0,
+ l_hbReq.IntervalSec, 0);
+ } else if (l_hbReq.IntervalSec == 0) { // LCOV_EXCL_BR_LINE 8: As the condition is never false
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM__CWORD56__HEARTBEAT_RSPN, 0, NULL);
+
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM__CWORD56__HEARTBEAT_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSystemManager::On_CWORD56_HeartBeatResponseIntervalTimerExpiry(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ SetCmdHist("SM_TIMER__CWORD56__HEARTBEAT_RESPONSE", m_TimerCmdHist, m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM__CWORD56__HEARTBEAT_RSPN, 0, NULL);
+
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM__CWORD56__HEARTBEAT_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+// EOF of /SS_SystemManager/src/ss_system_manager_callbacks.cpp
+
diff --git a/systemservice/system_manager/server/src/ss_system_manager_error_event.cpp b/systemservice/system_manager/server/src/ss_system_manager_error_event.cpp
new file mode 100755
index 0000000..131b86a
--- /dev/null
+++ b/systemservice/system_manager/server/src/ss_system_manager_error_event.cpp
@@ -0,0 +1,945 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for IAT error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <sys/mman.h>
+#include <sys/procfs.h>
+#include <libgen.h>
+#include <spawn.h>
+#include <errno.h>
+#include <sys/timeb.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_client_names.h>
+#include <system_service/ss_power_service_if.h>
+#include <processlauncher/ProcessLauncher_if.h>
+#include <processlauncher/ss_sm_process_launcher_protocol.h>
+#include <processlauncher/ss_sm_process_launcher.h>
+#include <heartbeat/ss_hb_if.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <stub/ss_diag.h>
+#include <system_service/ss_test_clients.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/frameworkunified_application.h>
+
+#include <system_service/ss_sm_thread_names.h>
+#include <system_service/ss_templates.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <native_service/ns_np_service_nor_persistence.h>
+#include <boost/bind.hpp>
+#include <string>
+#include "ss_system_manager.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_default_paths.h"
+#include "ss_sm_version.h"
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)>
+ EFrameworkunifiedStatus SysMgrCallback(HANDLE hApp) { // LCOV_EXCL_START 6: Can not set condition
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ C * pObj = static_cast<C *>(&CSystemManager::GetInstance());
+ if (pObj) {
+ l_eStatus = (pObj->*M)(hApp);
+ }
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_EErrorEventReset_StrMap(std::map<EErrorEventResetType, SS_String> & m_strMap) { // NOLINT
+ MAP_ENTRY(m_strMap, eErrorEventResetTypeNone); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ MAP_ENTRY(m_strMap, eErrorEventResetTypeHard); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+}
+class EnumStringMap<EErrorEventResetType, Init_EErrorEventReset_StrMap> m_oEErrorEventResetTypeMap;
+SS_String GetStr(EErrorEventResetType f_enum) { // LCOV_EXCL_START 6: Can not set condition
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_oEErrorEventResetTypeMap.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ErrorEventInit
+/// This function initializes the error event handling subsystem.
+/// This function MUST be called by System Manager initialization.
+///
+/// \param HANDLE f_hApp AGL FW application handle.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ErrorEventInit(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ Timer *l_pTimer;
+
+ m_isPrevErrEventCompleted = TRUE;
+ m_errorEventResult = eFrameworkunifiedStatusOK;
+ m_errorEventQueueLocked = FALSE;
+ m_errorEventCurrentIter = m_errorEventQueue.end();
+
+ l_pTimer = &m_errorEventTimers[eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ];
+ l_pTimer->Initialize(f_hApp, SS_SM_ERROR_EVENT_TIMER_ID_LOGGER_START_REQ,
+ boost::bind(&CSystemManager::OnErrorEventLoggerStartRequestTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_pTimer = &m_errorEventTimers[eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN];
+ l_pTimer->Initialize(f_hApp, SS_SM_ERROR_EVENT_TIMER_ID_DEBUG_DUMP_RSPN,
+ boost::bind(&CSystemManager::OnDebugDumpCompleteTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_pTimer = &m_errorEventTimers[eSM_ERROR_EVENT_TIMER_BOOT_MICRO_LOG_RSPN];
+ l_pTimer->Initialize(f_hApp, SS_SM_ERROR_EVENT_TIMER_ID_BOOT_MICRO_LOG_RSPN,
+ boost::bind(&CSystemManager::OnErrorEventBootMicroLogResponseTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_pTimer = &m_errorEventTimers[eSM_ERROR_EVENT_TIMER_CORE_FILE_POLL];
+ l_pTimer->Initialize(f_hApp, SS_SM_ERROR_EVENT_TIMER_ID_CORE_FILE_POLL,
+ boost::bind(&CSystemManager::OnErrorEventCoreFilePollTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ErrorEventEnqueue
+/// Conditional queue error events for processing by the error event state
+/// machine.
+///
+/// \param f_hApp Handle to AGL application.
+///
+/// \param f_eventType Error event type.
+///
+/// \param f_moduleQueueName Error event trigger module queue name.
+///
+/// \param f_resetType Error event reset type (none, hard).
+///
+/// \param f_loggingInfo Logging information if applicable (optional).
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ErrorEventEnqueue(HANDLE f_hApp,
+ EErrorEventType f_eventType, std::string &f_moduleQueueName,
+ EErrorEventResetType f_resetType, const SMLoggingInfo &f_loggingInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ERROR_EVENT_INFO l_errorEventInfo;
+ ERROR_EVENT_QUEUE_ITER l_errorEventIter;
+ ERROR_EVENT_QUEUE_RET l_retVal;
+ BOOL isErrorReset = FALSE;
+
+ if (eErrorEventResetTypeHard == f_resetType) {
+ // Forced reset if shutdown process is not completed after Reboot requesting
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_SHUTDOWN_COMPLETE_MONITOR],
+ SM_SHUTDOWN_COMPLETE_MONITOR_TIMEOUT, 0, 0, 0);
+
+ switch (f_loggingInfo.resetReason) {
+ case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR:
+ case e_SS_SM_CPU_RESET_REASON_DSP_ERR:
+ isErrorReset = TRUE;
+ break;
+ default:
+ break;
+ }
+ // LCOV_EXCL_START 6:This variable cannot be modified by external API
+ if ((m_ResetCount > SS_SM_ERR_NAVI_RESET_LIMIT) && isErrorReset) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6:This variable cannot be modified by external API (evaluated only initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fprintf(stderr,
+ "SS_SysManager/%s:will NAVIDET as continuous error(%d) \n", __FUNCTION__, m_ResetCount);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "will NAVIDET as continuous error(%d)", m_ResetCount);
+ m_pfStopCompleteHandler = (SysMgrCallback<CSystemManager, &CSystemManager::perform_force_reset>);
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (TRUE == m_errorEventQueueLocked) {
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. The Error Event Queue has been locked. No further items may be enqueued. System reset pending."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ } else {
+ GetTimeStamp(l_errorEventInfo.m_eventEnqueueTimeStamp);
+
+ l_errorEventInfo.m_moduleQueueName = f_moduleQueueName;
+ l_errorEventInfo.m_eventType = f_eventType;
+ l_errorEventInfo.m_errorEventResetType = f_resetType;
+ l_errorEventInfo.m_loggingInfo = f_loggingInfo;
+ l_errorEventInfo.m_prio = eErrorEventPrioDefault; // Make Prios of all ErrorEvent first-win as default
+ // It needs to add eErrorEventPrioxxx properly if design modification about priority required
+
+ if (eErrorEventResetTypeNone != f_resetType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " System will reset after logging");
+ }
+
+ l_retVal = m_errorEventQueue.insert(l_errorEventInfo);
+ if (FALSE == l_retVal.second) {
+ std::string l_errorEventName = GetStr(l_errorEventInfo.m_eventType);
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: %s is already queued or is in progress. Event dropped.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_errorEventName.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ }
+
+ l_eStatus = ErrorEventProcessNext(f_hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "ErrorEventProcessNext()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup PerformResetAfterLogging
+/// perform CPU reset after logging complete
+///
+/// \param f_hApp Handle to AGL application.
+/// f_eCpuResetReason CPU reset reason
+/// f_messageStr Error message string
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::PerformResetAfterLogging(HANDLE f_hApp,
+ ESMCpuResetReason f_eCpuResetReason, std::string f_messageStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = PerformCpuReset(f_hApp, f_eCpuResetReason, f_messageStr);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformCpuReset()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_BR_START 200: Can not satisfy the condition for calling from caller
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 200: Can not satisfy the condition for calling from caller
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT_LOG(0, "PerformCpuReset() : %d", l_eStatus);
+ // Erasing ErrorEvent only if resetting process is failed
+ m_errorEventQueue.erase(m_errorEventCurrentIter); // Erase last processed event.
+ // LCOV_EXCL_STOP
+ } else {
+ m_errorEventQueueLocked = TRUE; // Permanent lock until post reset.
+ m_errorEventQueue.clear(); // Drop queued events.
+ SendDeferMsg(f_hApp);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ErrorEventProcessNext
+/// Process the next error event from error event queue.
+///
+/// \param f_hApp Handle to AGL application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///
+/// \Notes (1) Removal from the queue occurs AFTER the entry has been processed
+/// AND just before the NEXT entry is to be obtained. Therefore,
+/// the first item enqueued MUST not be removed since it has not
+/// been processed. This is ensured by setting the iterator to END
+/// during module initialization. After processing the first event,
+/// the iterator will no longer be END until all events have been
+/// processed.
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ErrorEventProcessNext(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ERROR_EVENT_QUEUE_ITER l_errorEventIter;
+ SMErrorEventNtfData l_errorEventNtfData;
+
+ if (TRUE == m_isPrevErrEventCompleted) { // Remove last completed item from front of queue.
+ // See Note #1.
+ if ((0 != m_errorEventQueue.size()) &&
+ (m_errorEventQueue.end() != m_errorEventCurrentIter)) {
+ // Completed logging by ErrorEvent
+ switch (m_errorEventCurrentIter->m_errorEventResetType) {
+ case eErrorEventResetTypeNone:
+ switch (m_errorEventCurrentIter->m_eventType) {
+ case eErrorEventTypeInterfaceunifiedEmmcLogs:
+ case eErrorEventTypeUserInvokedClearLogs:
+ if (eFrameworkunifiedStatusOK == m_errorEventResult) {
+ if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, 0)) {
+ // Logging only.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not reset AGL_ERRLOG_COUNTER");
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (eErrorEventTypeInterfaceunifiedEmmcLogs == m_errorEventCurrentIter->m_eventType) {
+ HANDLE hSession = FrameworkunifiedMcOpenSender(f_hApp,
+ m_errorEventCurrentIter->m_moduleQueueName.c_str());
+
+ if (hSession == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE 4: NSFW error case
+ != FrameworkunifiedSendMsg(hSession,
+ SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN,
+ sizeof(m_errorEventResult),
+ &m_errorEventResult)) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedMcClose(hSession)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ m_errorEventQueue.erase(m_errorEventCurrentIter); // Erase last processed event.
+ break;
+ case eErrorEventResetTypeHard:
+ TEXT(__FUNCTION__, "ERROR EVENT: Hard reset required for previously processed error event." // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ "Initiating reset and flushing logging queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != m_errorEventResult) {
+ // Logging at next launching by setting L to NaviDet if logging failed before rebooting
+ fprintf(stderr,
+ "SS_SysManager/%s:will NAVIDET as LOG save failed\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "will NAVIDET as LOG save failed");
+ m_pfStopCompleteHandler = (SysMgrCallback<CSystemManager,
+ &CSystemManager::perform_force_reset>);
+ }
+
+ if ((m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR) ||
+ (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_GENERIC_ERR) ||
+ (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_DSP_ERR) ||
+ (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET)) {
+ BOOL l_user_reset = FALSE;
+ if (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET) {
+ l_user_reset = TRUE;
+ }
+ m_ResetFactor = GetResetFactor(m_errorEventCurrentIter->m_moduleQueueName.c_str(), l_user_reset);
+ }
+
+ l_eStatus = PerformResetAfterLogging(f_hApp,
+ m_errorEventCurrentIter->m_loggingInfo.resetReason,
+ m_errorEventCurrentIter->m_loggingInfo.messageStr); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "PerformResetAfterLogging()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ break;
+ // LCOV_EXCL_START 6:Can not satisfy condition to branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Unknown reset type encountered: 0x%X/%d. No action taken.",
+ m_errorEventCurrentIter->m_errorEventResetType,
+ m_errorEventCurrentIter->m_errorEventResetType);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ // Check if a new work item exists.
+ if (0 != m_errorEventQueue.size()) {
+ // ErrorEvent startup process
+ m_errorEventCurrentIter = m_errorEventQueue.begin();
+
+ l_errorEventNtfData.EventType = m_errorEventCurrentIter->m_eventType;
+
+ if (eErrorEventResetTypeHard == m_errorEventCurrentIter->m_errorEventResetType) {
+ l_errorEventNtfData.isNeedReboot = TRUE;
+ } else {
+ l_errorEventNtfData.isNeedReboot = FALSE;
+ }
+
+ // Check BufferSize
+ size_t modl_len = sizeof(l_errorEventNtfData.ModuleName) - 1;
+
+ // SS Logger uses the l_errorEventNtfData.ModuleName as the LOGGERSERVICE_EMMC_LOGS and
+ // EEL_EXPORT destination path. eErrorEventTypeDiagEvent sends the destination path.
+ // For all other event types, the binary name is sent to logger.
+ // LCOV_EXCL_BR_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ if ((eErrorEventTypeInterfaceunifiedEmmcLogs
+ == m_errorEventCurrentIter->m_eventType) ||
+ (eErrorEventTypeEelExport
+ == m_errorEventCurrentIter->m_eventType) ||
+ (eErrorEventTypeDiagEvent
+ == m_errorEventCurrentIter->m_eventType)) {
+ // LCOV_EXCL_BR_STOP
+ strncpy(l_errorEventNtfData.ModuleName,
+ m_errorEventCurrentIter->m_loggingInfo.path.c_str(),
+ sizeof(l_errorEventNtfData.ModuleName) - 1);
+
+ size_t path_len = strlen(m_errorEventCurrentIter->m_loggingInfo.path.c_str());
+ if (path_len > modl_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Input buffer size over. input : %ld, enable : %ld",
+ path_len, modl_len);
+ }
+ l_errorEventNtfData.ModuleName[sizeof(l_errorEventNtfData.ModuleName) - 1] = 0;
+ } else {
+ strncpy(l_errorEventNtfData.ModuleName,
+ m_errorEventCurrentIter->m_loggingInfo.suffixStr.c_str(),
+ sizeof(l_errorEventNtfData.ModuleName) - 1);
+ }
+
+ // When the Reboot process is started during the execution of the LOG save sequence, an undefined value was set
+ // in m_errorEventCurrentIter. Therefore, the Reboot start timing due to an error in SS_Loger was changed from
+ // the time of ErrorEvent queuing to the time of dequeuing.
+
+ // LCOV_EXCL_BR_START 6: Because the following conditions cannot be satisfied when called from an external API
+ if ((SERVICE_LOGGER == m_errorEventCurrentIter->m_moduleQueueName)
+ && ((eErrorEventTypeProcessCrash
+ == m_errorEventCurrentIter->m_eventType)
+ || (eErrorEventTypeProcessExit
+ == m_errorEventCurrentIter->m_eventType)
+ || (eErrorEventTypeHeartBeatFailure
+ == m_errorEventCurrentIter->m_eventType)
+ || (eErrorEventTypeModConnFailed
+ == m_errorEventCurrentIter->m_eventType)
+ || (eErrorEventTypeStartRespFailed
+ == m_errorEventCurrentIter->m_eventType))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: Because the following conditions cannot be satisfied when called from an external API
+ // Note: If logger crashes, a core file will exist.
+ std::string l_hmiDispStr;
+ l_hmiDispStr = SERVICE_LOGGER;
+ if (eErrorEventResetTypeNone != m_errorEventCurrentIter->m_errorEventResetType) {
+ l_hmiDispStr += " - Shutting down, check for core file.";
+
+ // Since LOG save cannot be performed when an SSL error is detected, the LOG is saved at the next startup
+ // by rebooting with NaviDet = L after completion of the process.
+ fprintf(stderr, "SS_SysManager/%s:will NAVIDET as SSL dead\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "will NAVIDET as SSL dead");
+ m_pfStopCompleteHandler = (SysMgrCallback<CSystemManager,
+ &CSystemManager::perform_force_reset>);
+
+ m_ResetFactor = GetResetFactor(SERVICE_LOGGER, FALSE);
+
+ l_eStatus = PerformResetAfterLogging(f_hApp,
+ e_SS_SM_CPU_RESET_REASON_GENERIC_ERR);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformResetAfterLogging()");
+ } else {
+ l_hmiDispStr += " - Check for core file.";
+ }
+
+ SMErrorEventNtfData l_errorEventNtfData;
+ l_errorEventNtfData.EventType = m_errorEventCurrentIter->m_eventType;
+ l_errorEventNtfData.isNeedReboot = FALSE;
+ snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName), "%s",
+ l_hmiDispStr.c_str());
+
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, // Show indication on HMI.
+ SS_SM_EVENT_ERROR,
+ NULL, &l_errorEventNtfData, sizeof(l_errorEventNtfData));
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedPublishEvent(SS_SM_EVENT_ERROR)");
+ } else if (m_errorEventCurrentIter->m_eventType == eErrorEventTypeModuleInvokedResetRequest
+ && (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_NORMAL
+ || m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_DATA_RESET)) {
+ l_eStatus = PerformResetAfterLogging(f_hApp,
+ m_errorEventCurrentIter->m_loggingInfo.resetReason,
+ m_errorEventCurrentIter->m_loggingInfo.messageStr); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformResetAfterLogging()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ } else {
+ BOOL bIsNeedLogging = TRUE;
+
+ {
+ UI_32 l_ErrLogCount = 0;
+ if (PowerHalGetResetInfo(AGL_ERRLOG_COUNTER, &l_ErrLogCount)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not get AGL_ERRLOG_COUNTER form power_hal, assume to 0.");
+ l_ErrLogCount = 0;
+ }
+
+ {
+ if ((l_ErrLogCount >= SS_SM_ERR_LOGGING_LIMIT)
+ && (eErrorEventResetTypeHard == m_errorEventCurrentIter->m_errorEventResetType)) {
+ fprintf(stderr, "SS_SysManager/%s:Skip Logging by continuous error \n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Skip Logging by continuous error ");
+
+ m_ResetFactor = PSM_FACTOR_AGL_WITH_HISTORY;
+
+ l_eStatus =
+ PerformResetAfterLogging(f_hApp,
+ m_errorEventCurrentIter->m_loggingInfo.resetReason,
+ m_errorEventCurrentIter->m_loggingInfo.messageStr);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformResetAfterLogging()");
+ bIsNeedLogging = FALSE;
+ } else if (eErrorEventResetTypeHard
+ == m_errorEventCurrentIter->m_errorEventResetType) {
+ l_ErrLogCount++;
+ if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, l_ErrLogCount)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not set AGL_ERRLOG_COUNTER to power_hal.");
+ }
+ }
+ }
+ }
+
+ if (bIsNeedLogging) {
+ m_isPrevErrEventCompleted = FALSE;
+ m_errorEventResult = eFrameworkunifiedStatusOK;
+ BOOL result =
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ].Start(
+ SS_ERROR_EVENT_START_REQ_TO_SEC, 0, 0, 0);
+ if (FALSE == result) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Failed to start timer eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ.");
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp,
+ SS_SM_EVENT_ERROR_TO_SSL,
+ NULL, &l_errorEventNtfData,
+ sizeof(l_errorEventNtfData));
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " FrameworkunifiedPublishEvent(SS_SM_EVENT_ERROR_TO_SSL, "
+ "module name (optional): '%s', "
+ "event type: %d) returned '%d'/'%s'",
+ l_errorEventNtfData.ModuleName,
+ l_errorEventNtfData.EventType, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ }
+ }
+ }
+
+ // If Reboot has been started up to this point, m_errorEventQueue is cleared and checking is performed at the end because m_errorEventQueue is cleared.
+ if (0 == m_errorEventQueue.size()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Error Event queue empty. Error logging complete.");
+ m_errorEventCurrentIter = m_errorEventQueue.end(); // Invalidate iterator in case of spurious events.
+ SendDeferMsg(f_hApp);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnLoggingStartRequestFromSL
+/// This function gets called when System Logger initiates artifact
+/// collection for a trigger source that originates within System
+/// Logger or as a result of System Manager raising a logging
+/// event notification to System Logger.
+///
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnLoggingStartRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ModuleLaunchListIter l_ModuleListIter;
+ HANDLE l_hLoggerServiceSession;
+ EErrorEventType l_eventType;
+ SMErrorEventNtfData l_errorEventNtfData;
+
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ].Stop();
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp);
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg < EErrorEventType > (f_hApp, l_eventType))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (0 == m_errorEventQueue.size()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Logging start request received for event type: %d/'%s', "
+ "but the logging queue is empty.!", l_eventType,
+ GetStr(l_eventType).c_str());
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else if (m_errorEventCurrentIter == m_errorEventQueue.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Logging start request received for event type: %d/'%s', "
+ "but the current event iterator is invalid.",
+ l_eventType, GetStr(l_eventType).c_str());
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else if (m_errorEventCurrentIter->m_eventType != l_eventType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Logging start request received for event type: %d/'%s', "
+ "but current work item is for event type: %d/'%s'.",
+ l_eventType, GetStr(l_eventType).c_str(),
+ m_errorEventCurrentIter->m_eventType,
+ GetStr(m_errorEventCurrentIter->m_eventType).c_str());
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_errorEventNtfData.EventType = l_eventType;
+ l_errorEventNtfData.isNeedReboot = FALSE;
+
+ // For boot micro reset, customize the string as per the reset reason.
+ if (l_eventType == eErrorEventTypeBootMicroReset) {
+ switch (m_BootMicroResetReason) {
+ case SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET:
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName),
+ "Boot Micro Reset. Reason: %d, Self Reset",
+ m_BootMicroResetReason);
+ break;
+
+ case SS_SM_BOOT_MICRO_RESET_REASON_USER_FORCE_RESET: // User Force Reset timeout.
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName),
+ "Boot Micro Reset. Reason: %d, UFR Timeout",
+ m_BootMicroResetReason);
+ break;
+
+ case SS_SM_BOOT_MICRO_RESET_REASON_DSP_RESET:
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName),
+ "Boot Micro Reset. Reason: %d, DSP Reset",
+ m_BootMicroResetReason);
+ break;
+
+ case SS_SM_BOOT_MICRO_RESET_REASON_HB_TIMEOUT:
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName),
+ "Boot Micro Reset. Reason: %d, HB Timeout",
+ m_BootMicroResetReason);
+ break;
+
+ default:
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName),
+ "Boot Micro Reset. Reason: %d, Unknown",
+ m_BootMicroResetReason);
+ break;
+ }
+ } else {
+ // All other error event types format =
+ // Binary Name <circumstantial> PID: TID: Additional info: </circumstantial>
+ std::string l_hmiDispStr = ErrorEventCreateHmiDisplayString();
+
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName), "%s",
+ l_hmiDispStr.c_str());
+ }
+
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, SS_SM_EVENT_ERROR, // To HMI
+ NULL, &l_errorEventNtfData, sizeof(l_errorEventNtfData));
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedPublishEvent(SS_SM_EVENT_ERROR)");
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = GetModuleIterator(SERVICE_LOGGER, l_ModuleListIter))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: GetModuleIterator(%s) errored: %d/'%s'",
+ SERVICE_LOGGER, l_eStatus, GetStr(l_eStatus).c_str());
+ } else {
+ l_hLoggerServiceSession = l_ModuleListIter->hsession;
+
+ l_eStatus = FrameworkunifiedSendMsg(l_hLoggerServiceSession,
+ SS_SM_ERROR_EVENT_LOGGING_START_RSPN, 0, NULL);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedSendMsg(SS_SM_ERROR_EVENT_LOGGING_START_RSPN)");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnErrorEventLoggerStartRequestTimeout
+///
+/// \brief This function is called if System Logger fails to respond in a
+/// timely fashion to the published logger start request event
+/// SS_SM_EVENT_ERROR_TO_SSL. See OnLoggingStartRequest() which
+/// is the expected path should the timer period NOT expire.
+///
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnErrorEventLoggerStartRequestTimeout(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SMErrorEventNtfData l_errorEventNtfData;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Logger failed to respond to message SS_SM_EVENT_ERROR_TO_SSL in a timely fashion. Logging aborted.");
+
+ // Publish to HMI even if the error event will not be processed.
+ // In this way, developers can be made aware of the error condition
+ // and determine why logging did not proceed as expected.
+ if (m_errorEventCurrentIter != m_errorEventQueue.end()) {
+ l_errorEventNtfData.EventType = m_errorEventCurrentIter->m_eventType;
+ l_errorEventNtfData.isNeedReboot = FALSE;
+
+ std::string l_hmiDispStr = ErrorEventCreateHmiDisplayString();
+ snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName), "%s.", l_hmiDispStr.c_str());
+
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, SS_SM_EVENT_ERROR, // To HMI
+ NULL, &l_errorEventNtfData, sizeof(l_errorEventNtfData)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "FrameworkunifiedPublishEvent(SS_SM_EVENT_ERROR)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ m_isPrevErrEventCompleted = TRUE;
+ m_errorEventResult = eFrameworkunifiedStatusFail;
+ l_eStatus = ErrorEventProcessNext(f_hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "ErrorEventProcessNext()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSystemManager::OnErrorEventLoggingComplete(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ HANDLE l_hLoggerServiceSession;
+ ModuleLaunchListIter l_ModuleListIter;
+
+ // If logger does not send a logging start and instead immediately
+ // sends a logging complete response, then the start timer must be
+ // stopped to prevent a start response timeout from occuring.
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ].Stop();
+
+ m_errorEventResult = eFrameworkunifiedStatusFail;
+ if (sizeof(m_errorEventResult) != FrameworkunifiedGetMsgLength(f_hApp)) {
+ LOG_ERROR("DataSize mismatch");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &m_errorEventResult,
+ sizeof(m_errorEventResult), eSMRRelease))) {
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "m_errorEventResult = %d", m_errorEventResult);
+ }
+ m_isPrevErrEventCompleted = TRUE;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = GetModuleIterator(SERVICE_LOGGER, l_ModuleListIter))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: GetModuleIterator(%s) errored: %d/'%s'",
+ SERVICE_LOGGER, l_eStatus, GetStr(l_eStatus).c_str());
+ } else {
+ l_hLoggerServiceSession = l_ModuleListIter->hsession;
+
+ l_eStatus = FrameworkunifiedSendMsg(l_hLoggerServiceSession,
+ SS_SM_ERROR_EVENT_LOGGING_COMPLETE_RSPN, 0, NULL);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedSendMsg(SS_SM_ERROR_EVENT_LOGGING_START_RSPN)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " Info. Done processing error event %s.",
+ GetStr(m_errorEventCurrentIter->m_eventType).c_str());
+
+ l_eStatus = ErrorEventProcessNext(f_hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "ErrorEventProcessNext()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ActOnModuleFailure
+/// This function is called to take appropriate action of the failure
+/// reported by heart beat or crash detector. Attributes set in
+/// Launch configuration file are considered while taking action
+/// on the failed module.
+///
+/// \param f_hApp AGL FW application handle.
+/// f_moduleName Failed module name.
+/// f_refSoftResetRequired Return parameter indicating if a
+/// soft reset will be required.
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+const CHAR RestartModule[] = "me";
+
+EFrameworkunifiedStatus CSystemManager::ActOnModuleFailure(HANDLE f_hApp,
+ SS_String f_moduleName, BOOL &f_refResetRequired) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ ModuleLaunchListIter l_ModuleListIter;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ESMPLThreadCommandIds l_PLCmd = ePLThrdCmd_NONE;
+ SS_String l_PLCmdStr = "";
+
+ f_refResetRequired = FALSE;
+
+ l_eStatus = GetModuleIterator(f_moduleName.c_str(), l_ModuleListIter);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map", f_moduleName.c_str());
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (eFrameworkunifiedStatusDbRecNotFound);
+ }
+
+ // LCOV_EXCL_BR_START 6: Because the condition cannot be set
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = RemoveModuleEntryFromHB(f_hApp,
+ l_ModuleListIter->name.c_str()))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: RemoveModuleEntryFromHB(%s) errored: %d/'%s'",
+ l_ModuleListIter->name.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+
+ if (TRUE == l_ModuleListIter->critical
+ && (l_ModuleListIter->relaunch_count >= l_ModuleListIter->retry_cnt)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Critical module '%s' re-launch counter exceeded limit (%d).",
+ l_ModuleListIter->name.c_str(), l_ModuleListIter->retry_cnt);
+
+ l_ModuleListIter->SetModuleState(MODULE_STATE_SKIPPED);
+
+ // Module has crossed re-launched limit and is not going to be re-launched.
+ // It must however still be terminated.
+ l_PLCmd = ePLThrdCmd_TERMINATE_MODULE_REQST;
+ l_PLCmdStr = "ePLThrdCmd_TERMINATE_MODULE_REQST";
+
+ // Module is critical. Restart system.
+ f_refResetRequired = TRUE;
+ // Restart required?
+ } else if (0 == std::strcmp(l_ModuleListIter->restart.c_str(), RestartModule)) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Module: %s, relaunch_count: %d",
+ l_ModuleListIter->name.c_str(),
+ l_ModuleListIter->relaunch_count);
+
+ if (l_ModuleListIter->relaunch_count < l_ModuleListIter->retry_cnt) {
+ SS_String l_ModulePath = (m_BinaryFilesPath + l_ModuleListIter->path);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
+ " Requesting ReLaunch of '%s' '%s'",
+ l_ModuleListIter->name.c_str(), l_ModulePath.c_str());
+
+ l_PLCmd = ePLThrdCmd_RELAUNCH_MODULE_REQST;
+ l_PLCmdStr = "ePLThrdCmd_RELAUNCH_MODULE_REQST";
+ l_ModuleListIter->relaunch_count++;
+ l_ModuleListIter->relaunch_status = RelaunchErr;
+ } else if ((FALSE == l_ModuleListIter->critical)
+ && (l_ModuleListIter->relaunch_count
+ >= l_ModuleListIter->retry_cnt)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Skipping re-launch of non-critical %s module, "
+ "re-launch counter exceeded limit(%d). Terminating module.",
+ l_ModuleListIter->name.c_str(),
+ l_ModuleListIter->retry_cnt);
+
+ l_ModuleListIter->SetModuleState(MODULE_STATE_SKIPPED);
+
+ // non critical module has crossed re-launched limit and is not going to be re-launched.
+ // We must terminate the module in the event that it has become non responsive.
+ l_PLCmd = ePLThrdCmd_TERMINATE_MODULE_REQST;
+ l_PLCmdStr = "ePLThrdCmd_TERMINATE_MODULE_REQST";
+ }
+ // LCOV_EXCL_STOP
+ } else { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: %s is not required to be re-launched, "
+ "skipping re-launch and terminating module.",
+ l_ModuleListIter->name.c_str());
+
+ l_ModuleListIter->SetModuleState(MODULE_STATE_SKIPPED);
+
+ // Module restart not required.
+ // We must terminate the module in the event that it has become non responsive.
+ l_PLCmd = ePLThrdCmd_TERMINATE_MODULE_REQST;
+ l_PLCmdStr = "ePLThrdCmd_TERMINATE_MODULE_REQST";
+ // LCOV_EXCL_STOP
+ }
+
+
+ if (ePLThrdCmd_NONE != l_PLCmd) {
+ l_eStatus = SendRequestToLauncher(f_hApp, l_ModuleListIter, l_PLCmd, l_PLCmdStr); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "SendRequestToLauncher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ErrorEventCreateHmiDisplayString
+///
+/// \brief Create error event HMI colored square display string.
+///
+/// \return Error Display String.
+///////////////////////////////////////////////////////////////////////////////
+std::string CSystemManager::ErrorEventCreateHmiDisplayString(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::stringstream l_displayNamess; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::stringstream l_pidss; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::stringstream l_hmiDispStr; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (0 != strncmp("",
+ m_errorEventCurrentIter->m_loggingInfo.binaryFileName,
+ sizeof(m_errorEventCurrentIter->m_loggingInfo.binaryFileName))) {
+ l_displayNamess << m_errorEventCurrentIter->m_loggingInfo.binaryFileName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else {
+ l_displayNamess << m_errorEventCurrentIter->m_moduleQueueName;
+ }
+
+ if (m_errorEventCurrentIter->m_loggingInfo.pid != 0) {
+ l_pidss << " PID: " << m_errorEventCurrentIter->m_loggingInfo.pid;
+ }
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_hmiDispStr.str());
+} // LCOV_EXCL_BR_LINE 10:The final line
+
diff --git a/systemservice/system_manager/server/src/ss_system_manager_error_event_responses.cpp b/systemservice/system_manager/server/src/ss_system_manager_error_event_responses.cpp
new file mode 100755
index 0000000..28e8dbf
--- /dev/null
+++ b/systemservice/system_manager/server/src/ss_system_manager_error_event_responses.cpp
@@ -0,0 +1,1007 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SS_SM_Logging
+/// \brief This file supports SM logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_plogger_if.h>
+#include <stub/ss_diag.h>
+#include <system_service/ss_ver.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_client_names.h>
+#include <system_service/ss_sm_client_if.h>
+
+#include <stdint.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/statvfs.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <errno.h>
+#include <sys/wait.h>
+#include <boost/algorithm/string.hpp>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <list>
+
+#include "ss_system_manager.h"
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainLoggerserviceLogRequest
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+static int getExecedString(char* const argv[], std::stringstream &ss) {
+ int ret;
+ int pipeFd[2]; // 0:read, 1:write
+ pid_t pid;
+ ret = pipe(pipeFd);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5:pipe's error case
+ // LCOV_EXCL_START 5:pipe's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ goto error_exit;
+ // LCOV_EXCL_STOP
+ }
+
+ pid = fork();
+ if (pid == -1) { // LCOV_EXCL_BR_LINE 5:fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (pid == 0) {
+ close(pipeFd[0]); // unnecessary pile (closing read)
+ close(1); // closing stdout
+ dup2(pipeFd[1], 1); // take stdout to pipe
+ execve(argv[0], argv, environ);
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ exit(EXIT_FAILURE);
+ } else {
+ char readBuf[256];
+ ssize_t rs;
+ SS_ASERT_ERRNO(0 == close(pipeFd[1])); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ fd_set rfds;
+ FD_ZERO(&rfds); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FD_SET(pipeFd[0], &rfds); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ struct timeval timeout;
+ timeout.tv_sec = 2;
+ timeout.tv_usec = 0;
+
+ int selRet = select(pipeFd[0] + 1, &rfds, NULL, NULL, &timeout);
+ switch (selRet) {
+ case 1:
+ if (FD_ISSET(pipeFd[0], &rfds)) {
+ do {
+ rs = read(pipeFd[0], readBuf, sizeof(readBuf) - 1);
+ if (rs > 0) {
+ readBuf[rs] = '\0';
+ ss << readBuf;
+ } else if (rs == -1) { // LCOV_EXCL_BR_LINE 5:read's error case
+ // LCOV_EXCL_START 5:read's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ if (errno != EINTR) {
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ ret = -1;
+ break;
+ }
+ // LCOV_EXCL_STOP
+ }
+ } while (rs != 0);
+ } else {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ break;
+ case -1:
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ break;
+ default:
+ // LCOV_EXCL_START 5:never be this case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ if (0 == selRet) {
+ ss << "timeout" << std::endl;
+ } else {
+ ss << "ERR:rslt=" << selRet << std::endl;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ // SM leaves processing to OnProcessExitDetected when using child process
+ // SS_ASERT_ERRNO(-1 != waitpid(pid,&status,0));
+ }
+ SS_ASERT_ERRNO(0 == close(pipeFd[0])); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+error_exit:
+ return ret;
+}
+
+static int saveProcsMemInfo(std::ofstream &fo) {
+ DIR *dir = NULL;
+ int ret = 0;
+
+ try {
+ struct dirent dent, *next;
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ {
+ fo << "******** mem info **********" << std::endl;
+ std::ifstream fin("/proc/meminfo");
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ fo << line << endl;
+ }
+ }
+
+ {
+ fo << "******** slab info **********" << std::endl;
+ std::ifstream fin("/proc/slabinfo");
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ fo << line << endl;
+ }
+ }
+
+ {
+ fo << "******** zone info **********" << std::endl;
+ std::ifstream fin("/proc/zoneinfo");
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ fo << line << endl;
+ }
+ }
+ // LCOV_EXCL_BR_STOP
+
+ // Linux dependency codes
+ dir = opendir("/proc"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (dir == NULL) { // LCOV_EXCL_BR_LINE 5:opendir's error case
+ // LCOV_EXCL_START 11:opendir's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ throw eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ fo << "******** proc status **********" << std::endl;
+ while (0 == readdir_r(dir, &dent, &next) && next) {
+ if (DT_DIR == dent.d_type) {
+ struct stat statbuf;
+ std::string statPath("/proc/"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ statPath += dent.d_name;
+ statPath += "/status";
+
+ if (stat(statPath.c_str(), &statbuf) == 0) {
+ std::ifstream fin(statPath.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ if (strstr(line.c_str(), "Name") != NULL
+ || strstr(line.c_str(), "Pid") != NULL
+ || strstr(line.c_str(), "Vm") != NULL) {
+ fo << line << endl;
+ }
+ }
+ fo << "************************************" << std::endl;
+ }
+ }
+ }
+ SS_ASERT_ERRNO(0 == closedir(dir)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } catch (...) {
+ if (dir) { // LCOV_EXCL_BR_LINE 5:opendir's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT_ERRNO(0 == closedir(dir)); // LCOV_EXCL_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ ret = -1;
+ }
+ return ret;
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainLoggerserviceLogRequest
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::SendLogArtifactResponseToLogger(HANDLE f_hApp,
+ EArtifactId f_artifactId, std::string f_artifactFilePathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ HANDLE l_hLoggerServiceSession;
+ ModuleLaunchListIter l_ModuleListIter;
+ ARTIFACT_RESPONSE l_artifactResponse;
+
+ l_artifactResponse.ArtifactId = f_artifactId;
+
+ strncpy(l_artifactResponse.FilePathAndName,
+ f_artifactFilePathAndName.c_str(),
+ sizeof(l_artifactResponse.FilePathAndName) - 1);
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = GetModuleIterator(SERVICE_LOGGER, l_ModuleListIter))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: GetModuleIterator(%s) errored: %d/'%s'",
+ SERVICE_LOGGER, l_eStatus, GetStr(l_eStatus).c_str());
+ } else {
+ l_hLoggerServiceSession = l_ModuleListIter->hsession;
+
+ l_eStatus = FrameworkunifiedSendMsg(l_hLoggerServiceSession,
+ SS_SM_ERROR_EVENT_ARTIFACT_RSPN, sizeof(l_artifactResponse),
+ &l_artifactResponse);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "FrameworkunifiedSendMsg(SS_SM_ERROR_EVENT_ARTIFACT_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnErrorEventArtifactRequest
+/// Dispatch logging requests to the various handlers.
+///
+/// \param f_hApp Framework application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnErrorEventArtifactRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg < EArtifactId
+ > (hApp, m_requestedArtifactId))) { // LCOV_EXCL_BR_LINE 200:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ switch (m_requestedArtifactId) {
+ case eArtifactIdBootMicroLog:
+ l_eStatus = OnObtainBootMicroLog(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnObtainBootMicroLog()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ break;
+
+ case eArtifactIdSystemDataCsv:
+ l_eStatus = OnObtainSystemmanagerSystemDataCsv(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnObtainSystemmanagerSystemDataCsv()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ break;
+
+ case eArtifactIdShowMemTxt:
+ l_eStatus = OnObtainShowMemTxt(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnObtainShowMemTxt()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ break;
+
+ case eArtifactIdProcessCore:
+ SS_ASERT(0); // Never called in Linux PF // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ break;
+
+ case eArtifactIdDebugDumpLog:
+ l_eStatus = OnObtainDebugDumpLog(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnObtainDebugDumpLog()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Unsupported logging artifact requested: %d.",
+ m_requestedArtifactId);
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnObtainBootMicroLog
+/// Obtain the boot micro log content, write file to disk, and send filename to SL.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnObtainBootMicroLog(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(f_hApp));
+
+ l_eStatus = RequestBootMicroLog(f_hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "RequestBootMicroLog"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnBootMicroLogResponse
+/// Boot micro log response sent from the logging shadow.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnBootMicroLogResponse(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_len;
+ std::string l_artifactFilePathAndName;
+
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_BOOT_MICRO_LOG_RSPN].Stop(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(f_hApp));
+
+ if (0 == strcmp(TIMER_SERVICE_NAME, FrameworkunifiedGetMsgSrc(f_hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Timer expired while waiting for the boot micro log.");
+ } else if (0 == (l_len = FrameworkunifiedGetMsgLength(f_hApp))) { // LCOV_EXCL_BR_LINE 200:restricted by ss_sm_client
+ // LCOV_EXCL_START 200:restricted by ss_sm_client
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Invalid log response received. Length cannot be 0.");
+ // LCOV_EXCL_STOP
+ } else {
+ char l_buf[l_len]; // NOLINT
+ l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, l_buf, static_cast<UI_32>(sizeof(l_buf)), eSMRRelease); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_artifactFilePathAndName = "/tmp/bootmicro.log";
+ l_len = static_cast<UI_32>(strlen((const char *) l_buf));
+ std::ofstream l_stream(l_artifactFilePathAndName.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.write(l_buf, l_len); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.close(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, m_requestedArtifactId,
+ l_artifactFilePathAndName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d', '%s') "
+ "errored: %d/'%s'", m_requestedArtifactId,
+ l_artifactFilePathAndName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnErrorEventBootMicroLogResponseTimeout
+/// Called when the boot micro log request timer expires (e.g. no response).
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnErrorEventBootMicroLogResponseTimeout(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_artifactFilePathAndName = "";
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Boot micro log response timed out. Sending empty artifact response to SSL.");
+
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, m_requestedArtifactId,
+ l_artifactFilePathAndName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d', '%s') "
+ "errored: %d/'%s'", m_requestedArtifactId,
+ l_artifactFilePathAndName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnObtainSystemmanagerSystemDataCsv
+/// Obtain system content, write file to disk, and send filename to SL.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnObtainSystemmanagerSystemDataCsv(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // std::string l_artifactFilePathAndName = "/tmp/frameworkunified_systemdata.csv";
+ // std::ofstream l_stream(l_artifactFilePathAndName.c_str());
+ std::stringstream l_stream;
+ char *l_pSignalName;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // Output version info
+ {
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ CSSVer ver;
+ l_stream << "********** PACKAGE VERSIONS **********\n";
+ l_stream << left;
+ l_stream << setw(16) << "PACKAGE" << setw(24) << "VERSION" << setw(10)
+ << "DATE" << endl;
+ for (SSVerPkgListIter ite = ver.begin(); ite != ver.end(); ite++) {
+ l_stream << setw(16) << ite->first;
+ l_stream << setw(24) << ite->second.version;
+ l_stream << setw(10) << ite->second.date << std::endl;
+ }
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "********** Error Description Start ***********" << endl;
+ l_stream << "Error Event Type,"
+ << GetStr(m_errorEventCurrentIter->m_eventType) << endl;
+ l_stream << m_errorEventCurrentIter->m_eventEnqueueTimeStamp.c_str() << endl;
+ l_stream << "MessageStr,"
+ << m_errorEventCurrentIter->m_loggingInfo.messageStr.c_str() << endl;
+ // LCOV_EXCL_BR_STOP
+
+ {
+ UI_32 l_ErrLogCount = 0;
+ if (PowerHalGetResetInfo(AGL_ERRLOG_COUNTER, &l_ErrLogCount)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__,
+ "Could not get AGL_ERRLOG_COUNTER from power_hal.");
+ }
+
+ {
+ l_stream << "ErrLogCount," << l_ErrLogCount << "/"
+ << SS_SM_ERR_LOGGING_LIMIT << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+
+ switch (m_errorEventCurrentIter->m_eventType) {
+ case eErrorEventTypeProcessCrash:
+ l_stream << "Crash Failure Binary Name,"
+ << m_errorEventCurrentIter->m_loggingInfo.binaryFileName << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "Module PID," << m_errorEventCurrentIter->m_loggingInfo.pid << endl;
+ l_stream << "Exit Value,"
+ << m_errorEventCurrentIter->m_loggingInfo.exitValue << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_pSignalName = strsignal(
+ m_errorEventCurrentIter->m_loggingInfo.signalNumber);
+ if (NULL != l_pSignalName) {
+ l_stream << "Exit Signal,"
+ << m_errorEventCurrentIter->m_loggingInfo.signalNumber // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << "," << l_pSignalName << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ break;
+
+ case eErrorEventTypeProcessExit:
+ l_stream << "Exit Binary Name,"
+ << m_errorEventCurrentIter->m_loggingInfo.binaryFileName << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "Module PID," << m_errorEventCurrentIter->m_loggingInfo.pid << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "Exit Value,"
+ << m_errorEventCurrentIter->m_loggingInfo.exitValue << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ break;
+
+ case eErrorEventTypeHeartBeatFailure:
+ l_stream << "HB Failure Module Queue Name,"
+ << m_errorEventCurrentIter->m_moduleQueueName.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "***************** HB Information Start *******************" << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "Entire State," << m_HBReport.eEntireState << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "Module Name,HB State,Retry Count" << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ for (UI_32 i = 0; i < m_HBReport.nNumOfModules; i++) {
+ if (0 != m_HBReport.tModuleList[i].HeartBeatRetryCount) {
+ l_stream << m_HBReport.tModuleList[i].ProcQueueName << "," // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << m_HBReport.tModuleList[i].ProcHBState << "," // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << m_HBReport.tModuleList[i].HeartBeatRetryCount // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+ l_stream << "***************** HB Information End *******************" << endl;
+ break;
+
+ case eErrorEventTypeSystemLowMemory:
+ l_stream << "Free Memory Available (Byte)," << m_FreeMemAvailable << endl;
+ break;
+
+ case eErrorEventTypeBootMicroReset:
+ l_stream << "Boot Micro Reset Reason," << m_BootMicroResetReason << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ break;
+
+ case eErrorEventTypeModConnFailed:
+ l_stream << "Failed Module Queue Name,"
+ << m_errorEventCurrentIter->m_moduleQueueName.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ break;
+
+ case eErrorEventTypeStartRespFailed:
+ l_stream << "Failed Module Queue Name,"
+ << m_errorEventCurrentIter->m_moduleQueueName.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ break;
+
+ // No additional event specific log information to add.
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeUserInvokedUserForceReset:
+ case eErrorEventTypeUserInvokedCollectDevLogs:
+ default:
+ break;
+ }
+
+ {
+ std::ifstream finNum("/proc/sys/vm/nr_oom_kill_process");
+ std::string strNum;
+ if (finNum && std::getline(finNum, strNum)) { // LCOV_EXCL_BR_LINE 200:will not be this case
+ // LCOV_EXCL_START 200:will not be this case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ char *endptr = NULL;
+ long lNum = strtol(strNum.c_str(), &endptr, 10); // NOLINT
+ if (('\0' != *endptr) || (lNum < 0)) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_stream << "nr_oom_kill_process," << strNum.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (0 != lNum) {
+ std::ifstream finLast("/proc/sys/vm/last_oom_kill_victim"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::string strLast;
+ if (finLast && std::getline(finLast, strLast)) {
+ l_stream << "last_oom_kill_victim," << strLast.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ l_stream << "********** Error Description End ***********" << endl << endl;
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+
+ fprintf(stderr, "SS_SysManager/\n%s", l_stream.str().c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_stream << "********** Variant Code Start ***********" << endl;
+ if (NULL != m_pVarCodeStr) {
+ l_stream << m_pVarCodeStr << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else {
+ l_stream << "Variant coding not available." << endl;
+ }
+ l_stream << "********** Variant Code End ***********" << endl << endl;
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_stream << "********** File System Information Start ***********" << endl;
+ l_stream << "== mounts info start==" << endl;
+ {
+ std::ifstream fin("/proc/mounts"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ l_stream << line << endl;
+ }
+ }
+ l_stream << "== mounts info end ==" << endl;
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_stream << "== DF info start==" << endl;
+ {
+ char* const argv[] = { const_cast<char*>("/bin/df"), const_cast<char*>("-a"), static_cast<char*>(NULL), };
+ SS_ASERT(0 == getExecedString(argv, l_stream)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ l_stream << "== DF info end==" << endl;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+#if 0 // Need to install lsblk if requested so that it is not installed
+ l_stream << "== lsblk info start==" << endl;
+ {
+ char* const argv[] = {
+ const_cast<char*>("/usr/debug/bin/lsblk"),
+ const_cast<char*>("-o"),
+ const_cast<char*>("NAME,KNAME,MAJ:MIN,FSTYPE,PARTLABEL,MODEL,SERIAL,REV,VENDOR"),
+ const_cast<char*>(NULL),
+ };
+ SS_ASERT(0 == getExecedString(argv, l_stream));
+ }
+ l_stream << "== lsblk info end==" << endl;
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+ l_stream.str("");
+ l_stream.clear();
+#endif
+
+ l_stream << "== proc info start==" << endl;
+ {
+ char* const argv[] = { const_cast<char*>("/bin/ps"), const_cast<char*>("auxc"),
+ const_cast<char*>("-L"), static_cast<char*>(NULL), };
+ SS_ASERT(0 == getExecedString(argv, l_stream)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ l_stream << "== proc info end==" << endl;
+ {
+ // Output is splitted so that the FRAMEWORKUNIFIEDLOG can not write data over 4K Bytes at a time
+ std::list<std::string> strList;
+ boost::split(strList, static_cast<const std::string>(l_stream.str()),
+ boost::is_any_of("\n")); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ int ii = 0;
+ std::stringstream ss; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ for (std::list<std::string>::iterator ite = strList.begin();
+ ite != strList.end(); ite++) {
+ ss << *ite << endl;
+ ii++;
+ if (ii > 20) {
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", ss.str().c_str());
+ ss.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ss.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ii = 0;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", ss.str().c_str());
+ }
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, m_requestedArtifactId, ""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d') "
+ "errored: %d/'%s'", m_requestedArtifactId, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnObtainShowMemTxt
+/// Obtain showmem content, write file to disk, and send filename to SL.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnObtainShowMemTxt(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ std::string l_artifactFilePathAndName = "/tmp/showmem.txt";
+ {
+ std::ofstream fo(l_artifactFilePathAndName.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ saveProcsMemInfo(fo); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, m_requestedArtifactId,
+ l_artifactFilePathAndName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d', '%s') "
+ "errored: %d/'%s'", m_requestedArtifactId,
+ l_artifactFilePathAndName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnErrorEventCoreFilePollTimeout
+/// Called periodically to verify whether the process core file has completed
+/// being written to disk. When complete, this function sends an artifact
+/// response to SSL.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnErrorEventCoreFilePollTimeout(HANDLE f_hApp) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_sendResponse = FALSE;
+ std::string l_artifactFilePathAndName = "";
+ std::ostringstream l_coreFilePathAndName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+// struct stat l_fileInfo;
+ struct stat64 l_fileInfo;
+ int l_result;
+ off_t l_coreFileSize;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ l_coreFilePathAndName << "/debug/"
+ << m_errorEventCurrentIter->m_loggingInfo.binaryFileName << ".core.gz"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+
+// l_result = stat(l_coreFilePathAndName.str().c_str(), &l_fileInfo);
+ l_result = stat64(l_coreFilePathAndName.str().c_str(), &l_fileInfo);
+ if (l_result == 0) {
+ l_coreFileSize = l_fileInfo.st_size;
+ if ((l_coreFileSize > m_coreFileSizeBytes) || // Core file grew from last read.
+ (l_coreFileSize == 0)) { // Core file not yet updated externally.
+ m_coreFileSizeBytes = l_coreFileSize; // Wait until file stops growing.
+ bool result =
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_CORE_FILE_POLL].Start( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ 0, SS_ERROR_EVENT_CORE_FILE_POLL_TO_MS, 0, 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (FALSE == result) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Failed to start timer SS_ERROR_EVENT_CORE_FILE_POLL_TO_MS.");
+ l_sendResponse = TRUE;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Core file: %s, size: %ld still growing.",
+ l_coreFilePathAndName.str().c_str(),
+ m_coreFileSizeBytes);
+
+ l_sendResponse = FALSE;
+ }
+ } else { // File has stopped growing.
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Core file: %s, size: %ld write complete. Sending artifact response.",
+ l_coreFilePathAndName.str().c_str(), m_coreFileSizeBytes);
+
+ l_artifactFilePathAndName = l_coreFilePathAndName.str();
+ l_sendResponse = TRUE;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Info. Core file: %s, unable to determine size. Sending empty artifact response to SSL.",
+ l_coreFilePathAndName.str().c_str());
+
+ l_sendResponse = TRUE;
+ }
+
+ if (TRUE == l_sendResponse) {
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, // Error getting file size. Send empty path to SSL.
+ m_requestedArtifactId, l_artifactFilePathAndName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d', '%s') "
+ "errored: %d/'%s'", m_requestedArtifactId,
+ l_artifactFilePathAndName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnObtainDebugDumpLog
+/// Obtain debug dump content, write file to disk, and send filename to SL.
+/// See OnModuleDebugDumpResponse().
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnObtainDebugDumpLog(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ ModuleLaunchListIter l_moduleIter;
+
+ m_NbrDebugDumpRspnRecv = 0;
+
+ for (GroupLaunchMapIter l_GroupIter = m_MapProclaunchGrps.begin();
+ l_GroupIter != m_MapProclaunchGrps.end(); l_GroupIter++) {
+ for (l_moduleIter = l_GroupIter->second.modules.begin();
+ l_moduleIter != l_GroupIter->second.modules.end();
+ l_moduleIter++) {
+ const BOOL isModuleConnected = l_moduleIter->IsModuleConnected(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ if ((SERVICE_NS_NPP != l_moduleIter->name) && // NPP is a special case and does NOT session connect with SM.
+ (TRUE == isModuleConnected)) {
+ l_eStatus = FrameworkunifiedSendMsg(l_moduleIter->hsession, SS_SM_DEBUG_DUMP,
+ 0, NULL);
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 200:NSFW error case
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. FrameworkunifiedSendMsg(SS_SM_DEBUG_DUMP) to %s succeeded.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_moduleIter->name.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ } else {
+ // LCOV_EXCL_START 200:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSendMsg(%p, SS_SM_DEBUG_DUMP) to %s errored: %d/'%s'",
+ (void *) l_moduleIter->hsession,
+ l_moduleIter->name.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+
+ // Call debug dump handler for SM.
+ l_eStatus = OnSystemManagerDebugDump(f_hApp);
+ LOG_STATUS(l_eStatus, "OnSystemManagerDebugDump()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // Refresh debug dump timeout timer after each debug dump response received.
+ // Non AGL framework modules will have the remaining time after the last
+ // received response to complete their debug dump.
+ bool result =
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN].Start(
+ SS_ERROR_EVENT_DEBUG_DUMP_RSPN_TO_SEC, 0, 0, 0);
+ if (FALSE == result) { // LCOV_EXCL_BR_LINE 200:will not be this case
+ // LCOV_EXCL_START 200:will not be this case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Failed to start timer eSM_TIMER_DEBUG_DUMP_RSPN_MONITOR.");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnDebugDumpResponseReceived
+/// Debug Dump complete Response handler.
+/// See OnDebugDumpCompleteTimeout().
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnDebugDumpResponseReceived(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ModuleLaunchListIter l_ModuleListIter;
+ UI_32 l_len;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", l_moduleName.c_str());
+
+ SetCmdHist("SS_SM_DEBUG_DUMP_RSPN", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(f_hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // SM is not launched by SM and is therefore not in the process list.
+ // SM does however use the same debug dump mechanism as other processes.
+ if (l_moduleName != SERVICE_SYSMANAGER) {
+ l_eStatus = GetModuleIterator(l_moduleName.c_str(), l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map", l_moduleName.c_str());
+ } else {
+ l_ModuleListIter->SetModuleDebugDumpState(MODULE_DEBUG_DUMP_STATE_RESPONSE_RECEIVED);
+ }
+ }
+
+ if (0 == (l_len = FrameworkunifiedGetMsgLength(f_hApp))) { // LCOV_EXCL_BR_LINE 200:restricted by ss_sm_client
+ // LCOV_EXCL_START 200:restricted by ss_sm_client
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ l_eStatus = eFrameworkunifiedStatusInvldBufSize;
+ LOG_ERROR("0 == FrameworkunifiedGetMsgLength(f_hApp)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Received debug dump response from %s, size: %d bytes. "
+ "Total number of responses received: %d",
+ l_moduleName.c_str(), l_len, m_NbrDebugDumpRspnRecv);
+
+ UI_8 l_buf[l_len]; // NOLINT
+ l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, l_buf, static_cast<UI_32>(sizeof(l_buf)),
+ eSMRRelease);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ ios_base::openmode l_mode;
+ if (0 == m_NbrDebugDumpRspnRecv) {
+ // Create new file.
+ l_mode = std::ios_base::trunc;
+ } else {
+ // Append existing file.
+ l_mode = std::ios_base::app;
+ }
+
+ std::ofstream l_stream("/tmp/systemmanager_debugdump.log", l_mode); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << l_buf << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.close(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ m_NbrDebugDumpRspnRecv++;
+
+ // Refresh debug dump timeout timer after each debug dump response received.
+ // Non AGL framework modules will have the remaining time after the last
+ // received response to complete their debug dump.
+ bool result =
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN].Start( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SS_ERROR_EVENT_DEBUG_DUMP_RSPN_TO_SEC, 0, 0, 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (FALSE == result) { // LCOV_EXCL_BR_LINE 200:will not be this case
+ // LCOV_EXCL_START 200:will not be this case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Failed to start timer eSM_TIMER_DEBUG_DUMP_RSPN_MONITOR.");
+ l_eStatus = OnDebugDumpCompleteTimeout(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "OnDebugDumpCompleteTimeout()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnDebugDumpCompleteTimeout
+/// Called after the last debug dump message is received, or when the debug
+/// dump monitor timer expires.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnDebugDumpCompleteTimeout(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_artifactFilePathAndName = "/tmp/systemmanager_debugdump.log";
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN].Stop(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Received '%d' Debug Dump responses.",
+ m_NbrDebugDumpRspnRecv);
+
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, m_requestedArtifactId,
+ l_artifactFilePathAndName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d', '%s') "
+ "errored: %d/'%s'", m_requestedArtifactId,
+ l_artifactFilePathAndName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
diff --git a/systemservice/system_manager/server/src/ss_system_manager_error_event_triggers.cpp b/systemservice/system_manager/server/src/ss_system_manager_error_event_triggers.cpp
new file mode 100755
index 0000000..385a628
--- /dev/null
+++ b/systemservice/system_manager/server/src/ss_system_manager_error_event_triggers.cpp
@@ -0,0 +1,1093 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for IAT error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <system_service/ss_system_manager_notifications.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_client_names.h>
+#include <system_service/ss_power_service_if.h>
+#include <processlauncher/ProcessLauncher_if.h>
+#include <processlauncher/ss_sm_process_launcher_protocol.h>
+#include <processlauncher/ss_sm_process_launcher.h>
+#include <heartbeat/ss_hb_if.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <string.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <stub/ss_diag.h>
+#include <system_service/ss_test_clients.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/frameworkunified_application.h>
+#include <system_service/ss_sm_thread_names.h>
+#include <system_service/ss_templates.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <native_service/ns_np_service_nor_persistence.h>
+#include <native_service/cl_process.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <sys/mman.h>
+#include <sys/procfs.h>
+#include <libgen.h>
+#include <spawn.h>
+#include <errno.h>
+#include <sys/timeb.h>
+#include <string>
+#include "ss_system_manager.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_signals.h"
+#include "ss_sm_default_paths.h"
+#include "ss_sm_version.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnHeartBeatErrorDetected
+/// This function gets called when a heartbeat failure is detected.
+///
+/// \param [in] f_hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnHeartBeatErrorDetected(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_resetRequired;
+ EErrorEventResetType l_resetType;
+ SMLoggingInfo l_loggingInfo;
+ std::string l_moduleBinaryName;
+ UI_32 l_ix;
+ THbReportData l_HBReport;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < THbReportData > (f_hApp, l_HBReport))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Report contains : %d entries.", l_HBReport.nNumOfModules);
+
+ for (l_ix = 0; l_ix < l_HBReport.nNumOfModules; l_ix++) {
+ if (HB_STATUS_TIMEOUT == l_HBReport.tModuleList[l_ix].ProcHBState) {
+ std::string l_moduleQueueName = l_HBReport.tModuleList[l_ix].ProcQueueName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ m_HBReport.eEntireState = l_HBReport.eEntireState;
+ m_HBReport.nNumOfModules = l_HBReport.nNumOfModules;
+ memcpy(&m_HBReport.tModuleList[l_ix], &l_HBReport.tModuleList[l_ix], sizeof(TSmModuleInfo));
+
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: Heartbeat error detected from: %s.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_moduleQueueName.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. Unable to identify binary name for SM child process with queue name: %s."
+ " The process name will be missing from the .csv and the core file will not be archived.",
+ l_moduleQueueName.c_str());
+ } else {
+ strncpy(l_loggingInfo.binaryFileName,
+ l_moduleBinaryName.c_str(),
+ sizeof(l_loggingInfo.binaryFileName) - 1);
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ActOnModuleFailure(f_hApp, l_moduleQueueName, l_resetRequired))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. ActOnModuleFailure(%s,%d) errored: %d/'%s'",
+ l_moduleQueueName.c_str(), l_resetRequired,
+ l_eStatus, GetStr(l_eStatus).c_str());
+ }
+
+ l_resetType =
+ (FALSE == l_resetRequired) ?
+ eErrorEventResetTypeNone :
+ eErrorEventResetTypeHard;
+
+ if (eErrorEventResetTypeNone != l_resetType) {
+ l_loggingInfo.resetReason =
+ e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+ }
+
+ l_eStatus = ErrorEventEnqueue(f_hApp,
+ eErrorEventTypeHeartBeatFailure, l_moduleQueueName,
+ l_resetType, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeHeartBeatFailure)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessTermDetected
+///
+///
+///
+/// \param Handle to AGL application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessTermDetected(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int l_clRet;
+ int l_count = 0;
+
+ // When multiple child processes terminate, CL_ProcessCleanup() returns 1. If 1 is returned, it repeats.
+ do {
+ CL_ProcessCleanupInfo_t l_procInfo;
+
+ l_count++;
+
+ l_clRet = CL_ProcessCleanup(m_ClProcessSigFd, &l_procInfo);
+ if (l_clRet != 0 && l_clRet != 1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: CL_ProcessCleanup(%d):%s", l_clRet,
+ strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "PID:%d code:%d status:%d",
+ l_procInfo.pid, l_procInfo.code, l_procInfo.status);
+
+ // Terminate a process group to reclaim descendants of an anomaly terminated process
+ SS_ASERT_ERRNO(0 == CL_ProcessAbortGroup(l_procInfo.pid)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ BOOL bIsExited = (CLD_EXITED == l_procInfo.code) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SMProcessExitInfo l_procExitInfo;
+ memset(&l_procExitInfo, 0, sizeof(l_procExitInfo));
+ l_procExitInfo.pid = l_procInfo.pid;
+ // Process exit value when si_code == CLD_EXITED, else delivered signal number.
+ l_procExitInfo.exitValue = l_procInfo.status;
+ l_procExitInfo.signalNumber = SS_SM_ABORT_SIGNAL;
+
+ // If GroupRelaunch is required, kill the remaining services
+ SS_String l_moduleQueueName("");
+ if (eFrameworkunifiedStatusOK == FindNameOfTerminatedProcess(l_procExitInfo.pid, l_moduleQueueName)) {
+ for (GroupRelaunchModuleListIter l_itr =
+ m_GroupRelaunchModuleList.begin();
+ m_GroupRelaunchModuleList.end() != l_itr; l_itr++) {
+ if (l_itr->name == l_moduleQueueName) {
+ if (l_itr->bIsKilled) { // LCOV_EXCL_BR_LINE 200: relaunch module bIsKilled is always false
+ // LCOV_EXCL_START 200: relaunch module bIsKilled is always false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // Normal during forced Relaunch
+ l_procExitInfo.exitValue = SS_SM_EXIT_RELAUNCH;
+ bIsExited = TRUE;
+ l_itr->bIsKilled = FALSE;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "GroupRelaunch(%d/%d)",
+ m_GroupRelaunchCount, m_GroupRelaunchLimit);
+
+ if (m_GroupRelaunchCount < m_GroupRelaunchLimit) {
+ SS_ASERT( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FrameworkunifiedNPPublishNotification(f_hApp, // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ NTFY_SSNeedAplRestart, NULL, 0)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // Issue ErrorEvent
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SS_String l_moduleBinaryName(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_loggingInfo.pid = l_procExitInfo.pid;
+ l_loggingInfo.exitValue = l_procExitInfo.exitValue;
+ l_loggingInfo.signalNumber = SS_SM_ABORT_SIGNAL;
+ if (eFrameworkunifiedStatusOK != GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName)) { // LCOV_EXCL_BR_LINE 200: cannot be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 200: cannot be error
+ } else {
+ snprintf(l_loggingInfo.binaryFileName,
+ sizeof(l_loggingInfo.binaryFileName),
+ "%s", l_moduleBinaryName.c_str());
+ }
+
+ l_eStatus = ErrorEventEnqueue(f_hApp,
+ eErrorEventTypeGroupRelaunch, l_itr->name,
+ eErrorEventResetTypeNone, l_loggingInfo);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ // Relaunch normally and do not leave anomaly LOGs
+ l_procExitInfo.exitValue = SS_SM_EXIT_RELAUNCH;
+ bIsExited = TRUE;
+
+ for (GroupRelaunchModuleListIter l_itr =
+ m_GroupRelaunchModuleList.begin();
+ m_GroupRelaunchModuleList.end() != l_itr;
+ l_itr++) {
+ if (l_itr->name != l_moduleQueueName) { // LCOV_EXCL_BR_LINE 200: name always be equal because of outer if judge // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 200: name always be equal
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ModuleLaunchListIter l_ModuleListIter;
+ if (eFrameworkunifiedStatusOK
+ != GetModuleIterator(
+ l_itr->name.c_str(),
+ l_ModuleListIter)) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ killpg(l_ModuleListIter->pid,
+ SS_SM_TERMINATE_SIGNAL);
+ l_itr->bIsKilled = TRUE;
+ }
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ m_GroupRelaunchCount++;
+ } else {
+ // Reboot system
+ ModuleLaunchListIter l_ModuleListIter;
+ if (eFrameworkunifiedStatusOK == GetModuleIterator(l_moduleQueueName.c_str(), l_ModuleListIter)) { // LCOV_EXCL_BR_LINE 200:cannot be error // NOLINT(whitespace/line_length)
+ l_ModuleListIter->relaunch_count = l_ModuleListIter->retry_cnt;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 200: cannot be error
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ if (isPreLaunchedProcess(l_procExitInfo.pid)) { // LCOV_EXCL_BR_LINE 200:prelaunch mode is not valid at UT test //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 200 :prelaunch mode is not valid at UT test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = OnPreLaunchedProcessTermDetected(f_hApp, l_procExitInfo, bIsExited); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("OnPreLaunchedProcessTermDetected()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // If an error occurs here, the zombie process may be collected and continued.
+ }
+ // LCOV_EXCL_STOP
+ } else if (bIsExited) {
+ l_eStatus = OnProcessExitDetected(f_hApp, l_procExitInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("OnProcessExitDetected()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // If an error occurs here, the zombie process may be collected and continued.
+ }
+ } else {
+ l_eStatus = OnProcessCrashDetected(f_hApp, l_procExitInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("OnProcessCrashDetected()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // If an error occurs here, the zombie process may be collected and continued.
+ }
+ }
+ } while (l_clRet == 1 && l_count < 50);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+BOOL CSystemManager::isPreLaunchedProcess(int f_pid) {
+ BOOL l_bIsExist = FALSE;
+
+ PreLaunchModuleListIter l_itr;
+ for (l_itr = m_PreLaunchModuleList.begin();
+ m_PreLaunchModuleList.end() != l_itr; l_itr++) {
+ if (l_itr->pid == f_pid) { // LCOV_EXCL_BR_LINE 200:prelaunch mode is not valid at UT test //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 200 :prelaunch mode is not valid at UT test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_bIsExist = TRUE;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+ return l_bIsExist;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnPreLaunchedProcessTermDetected(HANDLE f_hApp, SMProcessExitInfo &f_procExitInfo, BOOL f_bIsExited) { // LCOV_EXCL_START 200 :prelaunch mode is not valid at UT test // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ PreLaunchModuleListIter l_itr;
+ for (l_itr = m_PreLaunchModuleList.begin();
+ m_PreLaunchModuleList.end() != l_itr; l_itr++) {
+ if (l_itr->pid == static_cast<int>(f_procExitInfo.pid)) {
+ break;
+ }
+ }
+
+ try {
+ if (m_PreLaunchModuleList.end() == l_itr) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ throw eFrameworkunifiedStatusFail;
+ }
+
+ BOOL l_bIsNeedRelaunched = FALSE;
+
+ if ((SS_SM_RELAUNCH_NO_LIMIT == l_itr->relaunchLimit)
+ || (l_itr->relaunchLimit > l_itr->relaunchCount)) {
+ l_itr->relaunchCount++;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Relaunch %s(%d/%d)",
+ l_itr->name.c_str(), l_itr->relaunchCount,
+ l_itr->relaunchLimit);
+ if (-1 == (l_itr->pid = l_itr->LaunchFunc())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Relaunch %s Failed",
+ l_itr->name.c_str());
+ } else {
+ l_bIsNeedRelaunched = TRUE;
+ }
+ }
+
+ if (!l_bIsNeedRelaunched) {
+ if (l_itr->critical) {
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ EErrorEventType l_ErrorType;
+
+ l_itr->pid = -1;
+
+ l_loggingInfo.pid = f_procExitInfo.pid;
+ l_loggingInfo.exitValue = f_procExitInfo.exitValue;
+ l_loggingInfo.signalNumber = f_procExitInfo.signalNumber;
+ l_loggingInfo.resetReason =
+ e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+ snprintf(l_loggingInfo.binaryFileName,
+ sizeof(l_loggingInfo.binaryFileName), "%s",
+ l_itr->binaryFileName.c_str());
+
+ if (f_bIsExited) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s exited",
+ l_itr->name.c_str());
+ l_ErrorType = eErrorEventTypeProcessExit;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s crashed",
+ l_itr->name.c_str());
+ l_ErrorType = eErrorEventTypeProcessCrash;
+ }
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, l_ErrorType, l_itr->name,
+ eErrorEventResetTypeHard, l_loggingInfo);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "ErrorEventEnqueue()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s removed",
+ l_itr->name.c_str());
+ l_itr->pid = -1;
+ }
+ }
+ } catch (EFrameworkunifiedStatus e) {
+ l_eStatus = e;
+ }
+
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessCrashDetected
+/// Initiate logging and recovery for an abnormal process termination.
+/// The terminated process may or may not be a child of system manager.
+/// If the process is a child of SM, then a validation check must ensue
+/// to ensure that the process crash is not the result of a failed heartbeat
+/// and subsequent termination signal sent from System Manager. This function
+/// is NOT called for processes that exit normally.
+///
+/// See OnProcessCrashDetected.
+///
+/// \param Handle to AGL application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessCrashDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ BOOL l_resetRequired = TRUE;
+ SS_String l_moduleQueueName("");
+ SS_String l_moduleBinaryName(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ EErrorEventResetType l_resetType;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ TEXT(__FUNCTION__, " PROCESS CRASH: Process PID: %d", f_procExitInfo.pid); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FindNameOfTerminatedProcess(f_procExitInfo.pid, l_moduleQueueName))) {
+ // Normally, logging COULD continue, but stopping logging also solves a PosixBasedOS001 errata
+ // where a process crashes and is removed from the SM process launch map and is ALSO
+ // detected by the exit detector as a 'normal' exit. The FindNameOfTerminatedProcess()
+ // will continue properly IF a crash and removal from the map has not occurred
+ // for the same process.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. FindNameOfTerminatedProcess() returned error: %d/'%s' for PID: %d."
+ " No recovery possible. Logging has been suspended for this event.",
+ l_eStatus, GetStr(l_eStatus).c_str(), f_procExitInfo.pid);
+ } else {
+ l_eStatus = GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200: cannot be error
+ // LCOV_EXCL_START 200: cannot be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. Unable to identify binary for SM child process PID: %d, Queue Name: %s."
+ " The process binary name will be missing from the .csv file.",
+ f_procExitInfo.pid, l_moduleQueueName.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ strncpy(f_procExitInfo.binaryFileName, l_moduleBinaryName.c_str(),
+ sizeof(f_procExitInfo.binaryFileName) - 1);
+
+ f_procExitInfo.binaryFileName[sizeof(f_procExitInfo.binaryFileName) - 1] = '\0';
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ActOnModuleFailure(f_hApp, l_moduleQueueName,
+ l_resetRequired))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. ActOnModuleFailure(%s,%d) errored: %d/'%s'",
+ l_moduleQueueName.c_str(), l_resetRequired, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
+ "Info. ActOnModuleFailure() returned reset status: %d/'%s'.",
+ l_resetRequired, GetStr(l_resetRequired).c_str());
+ }
+
+ l_resetType =
+ (FALSE == l_resetRequired) ?
+ eErrorEventResetTypeNone : eErrorEventResetTypeHard;
+
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_loggingInfo.pid = f_procExitInfo.pid;
+ l_loggingInfo.exitValue = f_procExitInfo.exitValue;
+ l_loggingInfo.signalNumber = f_procExitInfo.signalNumber;
+ snprintf(l_loggingInfo.binaryFileName,
+ sizeof(l_loggingInfo.binaryFileName), "%s",
+ f_procExitInfo.binaryFileName);
+ if (eErrorEventResetTypeNone != l_resetType) {
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+ }
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeProcessCrash,
+ l_moduleQueueName, l_resetType, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeProcessCrash)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessExitDetected
+/// Initiate logging and recovery for System Manager child processes that
+/// exit normally via the last brace of main(), exit(), or have their last
+/// thread exit. This function is NOT called for processes that terminate
+/// unexpectedly.
+///
+/// See OnProcessExitDetected.
+///
+/// \param Handle to AGL application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessExitDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ SS_String l_moduleQueueName("");
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ TEXT(__FUNCTION__, "PROCESS EXIT: PID:%d exitValue:%d", f_procExitInfo.pid, // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ f_procExitInfo.exitValue); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FindNameOfTerminatedProcess(f_procExitInfo.pid,
+ l_moduleQueueName))) {
+ // This happens when SMs to EXEC debugging commands, etc.
+ // Since this is not an error, set LOGs to WARN levels and set the return codes to OK.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s: pid:%d is unknown service",
+ GetStr(l_eStatus).c_str(), f_procExitInfo.pid);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ if (0 == f_procExitInfo.exitValue) {
+ ModuleLaunchListIter l_moduleListIter;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = RemoveModuleEntryFromHB(f_hApp, l_moduleQueueName.c_str()))) { // LCOV_EXCL_BR_LINE 4: NSFW // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 4: NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: RemoveModuleEntryFromHB(%s) errored: %d/'%s'",
+ l_moduleQueueName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = GetModuleIterator(l_moduleQueueName.c_str(),
+ l_moduleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:cannot be error
+ // LCOV_EXCL_START 200:cannot be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map",
+ l_moduleQueueName.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = SendRequestToLauncher(f_hApp, l_moduleListIter, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ePLThrdCmd_TERMINATE_MODULE_REQST, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ "ePLThrdCmd_TERMINATE_MODULE_REQST"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "SendRequestToLauncher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ // Do not add relaunch_count for normal termination.
+ l_moduleListIter->relaunch_status = RelaunchSafe;
+ }
+ } else if (SS_SM_EXIT_RELAUNCH == f_procExitInfo.exitValue) {
+ ModuleLaunchListIter l_moduleListIter;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = RemoveModuleEntryFromHB(f_hApp, l_moduleQueueName.c_str()))) { // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: RemoveModuleEntryFromHB(%s) errored: %d/'%s'",
+ l_moduleQueueName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = GetModuleIterator(l_moduleQueueName.c_str(),
+ l_moduleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:cannot be error
+ // LCOV_EXCL_START 200:cannot be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map",
+ l_moduleQueueName.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = SendRequestToLauncher(f_hApp, l_moduleListIter, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ePLThrdCmd_RELAUNCH_MODULE_REQST, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ "ePLThrdCmd_RELAUNCH_MODULE_REQST"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "SendRequestToLauncher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ // Do not add relaunch_count for normal Relaunch
+ l_moduleListIter->relaunch_status = RelaunchSafe;
+ }
+ } else {
+ SS_String l_moduleBinaryName(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ BOOL l_resetRequired = TRUE;
+ EErrorEventResetType l_resetType;
+
+ l_eStatus = GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200: cannot be error
+ // LCOV_EXCL_START 200: cannot be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. Unable to identify binary for SM child process PID: %d, Queue Name: %s."
+ " The process binary name will be missing from the .csv file.",
+ f_procExitInfo.pid, l_moduleQueueName.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ strncpy(f_procExitInfo.binaryFileName,
+ l_moduleBinaryName.c_str(),
+ sizeof(f_procExitInfo.binaryFileName) - 1);
+
+ f_procExitInfo.binaryFileName[sizeof(f_procExitInfo.binaryFileName)
+ - 1] = '\0';
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ActOnModuleFailure(f_hApp,
+ l_moduleQueueName, l_resetRequired))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. ActOnModuleFailure(%s,%d) errored: %d/'%s'",
+ l_moduleQueueName.c_str(), l_resetRequired, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ l_resetType =
+ (FALSE == l_resetRequired) ?
+ eErrorEventResetTypeNone : eErrorEventResetTypeHard;
+
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_loggingInfo.pid = f_procExitInfo.pid;
+ l_loggingInfo.exitValue = f_procExitInfo.exitValue;
+ l_loggingInfo.signalNumber = f_procExitInfo.signalNumber;
+ snprintf(l_loggingInfo.binaryFileName,
+ sizeof(l_loggingInfo.binaryFileName), "%s",
+ f_procExitInfo.binaryFileName);
+ if (eErrorEventResetTypeNone != l_resetType) {
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+ }
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeProcessExit,
+ l_moduleQueueName, l_resetType, l_loggingInfo);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeProcessExit)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnBootMicroResetNotification
+/// Called from the logging shadow when the boot micro notifies the shadow of
+/// an unexpected boot micro reset during the last power cycle.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnBootMicroResetNotification(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_moduleName;
+ EFrameworkunifiedStatus l_eStatus;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < eSMBootMicroResetReason > (hApp, m_BootMicroResetReason))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_moduleName = FrameworkunifiedGetMsgSrc(hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: A boot micro reset has occurred. Reset reason: %d/'%s'.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ m_BootMicroResetReason, GetStr(m_BootMicroResetReason).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = ErrorEventEnqueue(hApp, eErrorEventTypeBootMicroReset, l_moduleName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeBootMicroReset)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup RequestBootMicroLog
+/// Request boot micro log from the logging shadow.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::RequestBootMicroLog(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = FrameworkunifiedPublishEvent(hApp, // Event received by PS Logging Shadow
+ SS_SM_BOOT_MICRO_LOG_REQ,
+ NULL,
+ NULL, 0);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "FrameworkunifiedPublishEvent(SS_SM_BOOT_MICRO_LOG_REQ)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ bool result =
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_BOOT_MICRO_LOG_RSPN].Start(
+ SS_ERROR_EVENT_BOOT_MICRO_LOG_RESPONSE_TO_SEC, 0, 0, 0);
+ if (FALSE == result) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Failed to start timer eSM_TIMER_BOOT_MICRO_LOG_RESPONSE.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnLowSystemMemory
+/// Called when a low memory error has been detected.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnLowSystemMemory(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SysMem l_SysMem;
+ std::string l_moduleName;
+ EFrameworkunifiedStatus l_eStatus;
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < SysMem > (hApp, l_SysMem))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ m_FreeMemAvailable = l_SysMem.FreeMemoryBytes;
+
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: System Low Memory detected. Remaining memory: %d.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ m_FreeMemAvailable); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ l_moduleName = FrameworkunifiedGetMsgSrc(hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+ l_eStatus = ErrorEventEnqueue(hApp, eErrorEventTypeSystemLowMemory,
+ l_moduleName, eErrorEventResetTypeHard, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeSystemLowMemory)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnLowSystemMemory( HANDLE hApp )
+
+EFrameworkunifiedStatus CSystemManager::OnPropagateSystemError(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnUserInvokedLoggingRequest
+/// Called when the end user invokes a error event logging request by means
+/// of hard key or other direct input method.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnUserInvokedLoggingRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TSystemManagerLoggingRequestInfo l_logInfo;
+ EErrorEventType l_errorEventType;
+ std::string l_moduleName;
+ EFrameworkunifiedStatus l_eStatus;
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < TSystemManagerLoggingRequestInfo > (f_hApp, l_logInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case
+ } else {
+ l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_loggingInfo.messageStr = l_logInfo.messageStr;
+ l_loggingInfo.suffixStr = l_logInfo.suffixStr;
+
+ switch (l_logInfo.logType) {
+ case e_SS_SM_CAPTURE_ALL_LOGS:
+ l_errorEventType = eErrorEventTypeUserInvokedCollectAllLogs;
+ break;
+
+ case e_SS_SM_SCREEN_CAPTURE:
+ l_errorEventType = eErrorEventTypeUserInvokedCollectScreenShot;
+ break;
+
+ case e_SS_SM_CAPTURE_INTERFACEUNIFIED_LOGS:
+ l_errorEventType = eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs;
+ break;
+
+ case e_SS_SM_CAPTURE_DEV_LOGS:
+ l_errorEventType = eErrorEventTypeUserInvokedCollectDevLogs;
+ break;
+
+ case e_SS_SM_CAPTURE_MODULE_LOGS:
+ l_errorEventType = eErrorEventTypeModuleInvokedCollectDebugLogs;
+ break;
+
+ case e_SS_SM_CAPTURE_DTC_LOGS:
+ l_errorEventType = eErrorEventTypeDtcEvent;
+ break;
+
+ case e_SS_SM_CAPTURE_NAVI_LOGS:
+ l_errorEventType = eErrorEventTypeUserInvokedCollectNaviLog;
+ break;
+
+ case e_SS_SM_CAPTURE_GROUP_RELAUNCH:
+ l_errorEventType = eErrorEventTypeGroupRelaunch;
+ break;
+
+ default:
+ l_errorEventType = eErrorEventTypeMaxValue;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Received unknown user invoked log type: %d. Dropping request.",
+ l_logInfo.logType);
+ break;
+ }
+
+ if (eErrorEventTypeMaxValue != l_errorEventType) { // LCOV_EXCL_BR_LINE 200: will not be the else case
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: User invoked logging request %d/'%s' received. " // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "Adding the request to the event queue.", // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ l_logInfo.logType, GetStr(l_logInfo.logType).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, l_errorEventType,
+ l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(UserInvoked)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnEelExportRequest
+/// Called when a removable device is inserted and contains the EEL_Export
+/// trigger.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnEelExportRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_strlen = FrameworkunifiedGetMsgLength(f_hApp);
+ CHAR l_path[l_strlen]; // NOLINT
+
+ if (l_strlen == 0) { // LCOV_EXCL_BR_LINE 200: restricted by iterface_unified
+ // LCOV_EXCL_START 200: restricted by iterface_unified
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (sizeof(l_path) != FrameworkunifiedGetMsgLength(f_hApp)) { // LCOV_EXCL_BR_LINE 6: must be equal
+ // LCOV_EXCL_START 6: must be equal
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("DataSize mismatch"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE 4: NSFW error case
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_path[0],
+ static_cast<UI_32>(sizeof(l_path)), eSMRRelease))) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ TEXT(__FUNCTION__,
+ " ERROR EVENT: EelExport request received. Adding the request to the event queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_path[l_strlen - 1] = '\0';
+ l_loggingInfo.path = l_path;
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeEelExport,
+ l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeEelExport)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnSystemmanagerEmmcLogsRequest
+/// Called when a removable device is inserted and contains the LOGGERSERVICE_EMMC_LOGS
+/// trigger.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnSystemmanagerEmmcLogsRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_strlen = FrameworkunifiedGetMsgLength(f_hApp);
+ CHAR l_path[l_strlen]; // NOLINT
+
+ if (l_strlen == 0) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0);
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (sizeof(l_path) != FrameworkunifiedGetMsgLength(f_hApp)) { // LCOV_EXCL_BR_LINE 8: CHAR l_path[l_strlen]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("DataSize mismatch"); // LCOV_EXCL_LINE 8: CHAR l_path[l_strlen]
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_path[0], static_cast<UI_32>(sizeof(l_path)), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW error case // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_LINE 4:NSFW error case
+ } else {
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: LOGGERSERVICE_EMMC_LOGS request received. Adding the request to the event queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SMLoggingInfo l_loggingInfo;
+
+ l_path[l_strlen - 1u] = '\0';
+ l_loggingInfo.path = l_path;
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeInterfaceunifiedEmmcLogs,
+ l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeInterfaceunifiedEmmcLogs)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnSystemmanagerClearLogsRequest
+/// Called when a clear LOGGERSERVICE_EMMC_LOGS requested
+/// trigger.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnSystemmanagerClearLogsRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeUserInvokedClearLogs, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_moduleName, eErrorEventResetTypeNone); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeUserInvokedClearLogs)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnDiagLoggingRequest
+/// Called by logger to initiate log artifact collection and storage on behalf
+/// of diagnostic services.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnDiagLoggingRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_strlen = FrameworkunifiedGetMsgLength(f_hApp);
+ CHAR l_path[l_strlen]; // NOLINT
+
+ if (l_strlen == 0) { // LCOV_EXCL_BR_LINE 200: restricted by iterface_unified
+ // LCOV_EXCL_START 200: restricted by iterface_unified
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (sizeof(l_path) != FrameworkunifiedGetMsgLength(f_hApp)) { // LCOV_EXCL_BR_LINE 6: must be equal
+ // LCOV_EXCL_START 6: must be equal
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("DataSize mismatch"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE 4: NSFW error case
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_path[0],
+ static_cast<UI_32>(sizeof(l_path)), eSMRRelease))) { // NOLINT
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: SS_SM_ERROR_EVENT_DIAG_LOG_REQ request received. Adding the request to the event queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_path[l_strlen - 1u] = '\0';
+ l_loggingInfo.path = l_path;
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeDiagEvent,
+ l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeDiagEvent)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnCanLoggingRequest
+/// This function is called by logger to initiate log artifact collection
+/// and storage when signaled via CAN.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnCANLoggingRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ std::string l_moduleName;
+
+ l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: SS_SM_ERROR_EVENT_CAN_LOG_REQ received from %s.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_moduleName.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeCanEvent, l_moduleName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeCanEvent)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
diff --git a/systemservice/system_manager/server/src/ss_system_memory_monitor.cpp b/systemservice/system_manager/server/src/ss_system_memory_monitor.cpp
new file mode 100755
index 0000000..7ea9b71
--- /dev/null
+++ b/systemservice/system_manager/server/src/ss_system_memory_monitor.cpp
@@ -0,0 +1,362 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager System Low Memory
+/// detection.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <system_service/ss_sm_thread_names_local.h>
+#include <system_service/ss_templates.h>
+#include <stub/Clock_API.h>
+
+#include <sys/stat.h>
+#include <errno.h>
+#include <sys/resource.h>
+#include <boost/bind.hpp>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+#include "ss_system_memory_monitor.h"
+#include "ss_sm_systemmanagerlog.h"
+
+CSysMemoryMonitor::CSysMemoryMonitor() :
+ m_hThread(NULL),
+ m_hParentApp(NULL),
+ m_SLMCheckCounter(0),
+ m_siPriority(-1),
+ m_NbrSamplesBeforeSystemmanagerlog(0),
+ m_memMonitorThreadName(SS_SMLowMemMonitor),
+ m_resmSession(-1) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_SLMConfig.SLMTimerValue = 0;
+ m_SLMConfig.SLMMaxRetryCount = 0;
+ m_SLMConfig.SLMThresholdValue = 0;
+ m_SLMConfig.SLMSystemmanagerLogIntervalMs = 0;
+ bzero(&m_sysMemInfoLast, sizeof(m_sysMemInfoLast));
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+CSysMemoryMonitor::~CSysMemoryMonitor(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ StopAndFreeObjects(m_hParentApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::Initialize(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == f_hApp) { // LCOV_EXCL_BR_LINE 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 4:NSFW
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Argument f_hApp passed NULL pointer.");
+ } else if (NULL == (m_hThread = FrameworkunifiedCreateChildThreadWithPriority(f_hApp, SS_SMLowMemMonitor, boost::bind(&CSysMemoryMonitor::CPUMemThreadStart, this, _1), boost::bind(&CSysMemoryMonitor::CPUMemThreadStop, this, _1), PR_SMLOWMEMMON))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle; // LCOV_EXCL_LINE 4:NSFW
+ LOG_ERROR("FrameworkunifiedCreateChildThreadWithPriority()"); // LCOV_EXCL_LINE 4:NSFW
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(f_hApp, m_hThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedStartChildThread()"); // LCOV_EXCL_LINE 4:NSFW
+ } else {
+ m_hParentApp = f_hApp;
+ m_sysMemInfoLast.TotalMemoryBytes = GetSystemRamSize();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. SLM thread successfully initialized.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::StopAndFreeObjects(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ CALL_AND_LOG_STATUS(FrameworkunifiedStopChildThread(f_hApp, m_hThread, 0, NULL)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ CALL_AND_LOG_STATUS(FrameworkunifiedDestroyChildThread(f_hApp, m_hThread)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+const std::string CSysMemoryMonitor::GetThreadName(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (m_memMonitorThreadName);
+}
+
+void CSysMemoryMonitor::SetSLMConfigData(SLMConfigParameters & f_ConfigData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_SLMConfig.SLMTimerValue = f_ConfigData.SLMTimerValue;
+ m_SLMConfig.SLMMaxRetryCount = f_ConfigData.SLMMaxRetryCount;
+ m_SLMConfig.SLMThresholdValue = f_ConfigData.SLMThresholdValue;
+ m_SLMConfig.SLMSystemmanagerLogIntervalMs = f_ConfigData.SLMSystemmanagerLogIntervalMs;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Timer value '%d', Retry Count '%d', threshold '%d', log interval '%dms'",
+ m_SLMConfig.SLMTimerValue, m_SLMConfig.SLMMaxRetryCount,
+ m_SLMConfig.SLMThresholdValue, m_SLMConfig.SLMSystemmanagerLogIntervalMs);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::CPUMemThreadStart(HANDLE f_hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(f_hThread,
+ NTFY_ResourceMgr_Availability,
+ boost::bind(&CSysMemoryMonitor::OnAvailability, this, _1));
+ if (l_eStatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 4:NSFW
+ }
+
+ if (FALSE == (m_memMonitorTimer.Initialize(f_hThread, SS_SLM_MEM_MONITOR_TIMER_ID, boost::bind(&CSysMemoryMonitor::OnMemoryTimerExpiry, this, _1)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusBadConnection; // LCOV_EXCL_LINE 4:NSFW
+ LOG_ERROR("m_memMonitorTimer.Initialize() returned 'FALSE'"); // LCOV_EXCL_LINE 4:NSFW
+ } else if (FALSE == (m_systemmanagerlogTimer.Initialize(f_hThread, SS_SLM_SYSTEMMANAGERLOG_TIMER_ID, boost::bind(&CSysMemoryMonitor::OnSystemmanagerlogTimerExpiry, this, _1)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusBadConnection; // LCOV_EXCL_LINE 4:NSFW
+ LOG_ERROR("m_systemmanagerlogTimer.Initialize() returned 'FALSE'"); // LCOV_EXCL_LINE 4:NSFW
+ } else {
+ if (m_SLMConfig.SLMTimerValue > 0) {
+ m_memMonitorTimer.SetTime(m_SLMConfig.SLMTimerValue / 1000,
+ m_SLMConfig.SLMTimerValue % 1000,
+ m_SLMConfig.SLMTimerValue / 1000,
+ m_SLMConfig.SLMTimerValue % 1000);
+ } else {
+ // default timer settings
+ m_memMonitorTimer.SetTime(SS_MEMORY_TIMER_CONFIG_MS / 1000,
+ SS_MEMORY_TIMER_CONFIG_MS % 1000,
+ SS_MEMORY_TIMER_CONFIG_MS / 1000,
+ SS_MEMORY_TIMER_CONFIG_MS % 1000);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. SLM monitor timer configuration invalid. Using default values.");
+ }
+
+ if (m_SLMConfig.SLMSystemmanagerLogIntervalMs > 0) {
+ m_systemmanagerlogTimer.SetTime(m_SLMConfig.SLMSystemmanagerLogIntervalMs / 1000,
+ m_SLMConfig.SLMSystemmanagerLogIntervalMs % 1000,
+ m_SLMConfig.SLMSystemmanagerLogIntervalMs / 1000,
+ m_SLMConfig.SLMSystemmanagerLogIntervalMs % 1000);
+ } else {
+ // default timer settings
+ m_systemmanagerlogTimer.SetTime(SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS / 1000,
+ SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS % 1000,
+ SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS / 1000,
+ SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS % 1000);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. SLM FRAMEWORKUNIFIEDLOG timer configuration invalid. Using default values.");
+ }
+
+ if (FALSE == (m_memMonitorTimer.Start())) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFault;
+ LOG_ERROR("m_memMonitorTimer.Start() returned 'FALSE'");
+ // LCOV_EXCL_STOP 4:NSFW
+ } else if (FALSE == (m_systemmanagerlogTimer.Start())) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFault;
+ LOG_ERROR("m_systemmanagerlogTimer.Start() returned 'FALSE'");
+ // LCOV_EXCL_STOP 4:NSFW
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Success.");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::CPUMemThreadStop(HANDLE f_hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = StopTimers();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "StopTimers"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ if ((uint32_t) -1 != m_resmSession) {
+ if (RESM_E_OK != RESM_Close(m_resmSession)) {
+ l_eStatus = eFrameworkunifiedStatusFault;
+ LOG_ERROR("RESM_Close()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::StopTimers(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (FALSE == (m_memMonitorTimer.Stop())) { // LCOV_EXCL_BR_LINE 4:NSFW's error
+ l_eStatus = eFrameworkunifiedStatusFault;
+ LOG_ERROR("m_memMonitorTimer.Stop() returned 'FALSE'"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ if (FALSE == (m_systemmanagerlogTimer.Stop())) { // LCOV_EXCL_BR_LINE 4:NSFW's error
+ l_eStatus = eFrameworkunifiedStatusFault;
+ LOG_ERROR("m_systemmanagerlogTimer.Stop() returned 'FALSE'"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::OnMemoryTimerExpiry(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ RESM_STATUS_t l_resmStatus;
+
+ if ((uint32_t) -1 == m_resmSession) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ if (RESM_E_OK != RESM_GetStatus(m_resmSession, &l_resmStatus)) {
+ LOG_ERROR("RESM_GetStatus()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ m_sysMemInfoLast.FreeMemoryBytes = l_resmStatus.restMemSize;
+ if ((m_sysMemInfoLast.FreeMemoryBytes * 1024)
+ < (UI_32) m_SLMConfig.SLMThresholdValue) {
+ m_SLMCheckCounter++;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Low Memory detected(%d/%d).",
+ m_SLMCheckCounter, m_SLMConfig.SLMMaxRetryCount);
+
+ if (m_SLMCheckCounter >= m_SLMConfig.SLMMaxRetryCount) {
+ l_eStatus = FrameworkunifiedSendParent(hThread,
+ eSysMemThrdCmd_SYS_LOW_MEMORY, sizeof(m_sysMemInfoLast),
+ &m_sysMemInfoLast);
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ "FrameworkunifiedSendParent(eSysMemThrdCmd_SYS_LOW_MEMORY)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = StopTimers();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "StopTimers"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ } else {
+ m_SLMCheckCounter = 0;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::OnSystemmanagerlogTimerExpiry(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_freeMemoryObfuscated;
+ UI_32 l_totalMemoryObfuscated;
+
+ l_freeMemoryObfuscated = BitReverse32(m_sysMemInfoLast.FreeMemoryBytes);
+ l_totalMemoryObfuscated = BitReverse32(m_sysMemInfoLast.TotalMemoryBytes);
+
+ // Print to ZONE_WARN as per IAT requirement see WI 219056.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FM: [%d/%d].", l_freeMemoryObfuscated,
+ l_totalMemoryObfuscated);
+
+ static int count = 0;
+
+ if (!(count %= 2)) {
+ CHAR l_format[256];
+ uint32_t timebuf;
+ uint8_t status;
+ struct tm gmt;
+ struct tm local;
+ Clock_getSystemTimeY2K38(&timebuf, &status);
+ Clock_CnvSecToDateY2K38(&timebuf, &gmt);
+ Clock_getLocalTimeY2K38(&timebuf, &local);
+
+ sprintf(l_format, " G%02d %02d%02d%02d L%02d %02d%02d%02d", gmt.tm_mday, // NOLINT
+ gmt.tm_hour, gmt.tm_min, gmt.tm_sec, local.tm_mday,
+ local.tm_hour, local.tm_min, local.tm_sec);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s", l_format);
+ }
+
+ count++;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::OnAvailability(HANDLE hThread) {
+ if (FrameworkunifiedIsServiceAvailable(hThread)) {
+ if (m_resmSession == (uint32_t) -1) {
+ if (RESM_E_OK != RESM_Open(NULL, &m_resmSession)) {
+ m_resmSession = -1;
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+UI_32 CSysMemoryMonitor::GetSystemRamSize(void) {
+ UI_32 l_ramTotalBytes = 0;
+ std::ifstream l_sFile("/proc/meminfo");
+
+ if (l_sFile.fail()) { // LCOV_EXCL_BR_LINE 5: Standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Open /proc/meminfo");
+ } else {
+ ssize_t l_position;
+ std::string l_str;
+
+ while (getline(l_sFile, l_str)) {
+
+// if (std::string::npos
+// != (l_position = static_cast<unsigned int>(l_str.find("MemTotal:", 0)))) {
+ if (0 <= (l_position = l_str.find("MemTotal:", 0))) { // LCOV_EXCL_BR_LINE 200:linux system information
+
+ l_str.erase(l_position, l_position + strlen("MemTotal:")); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (std::string::npos != (l_position = static_cast<unsigned int>(l_str.find("kB", 0)))) { // LCOV_EXCL_BR_LINE 200:linux system information
+ l_str.erase(l_position, l_position + strlen("kB")); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ std::istringstream l_istr(l_str); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_istr >> l_ramTotalBytes;
+
+ break;
+ }
+ }
+ }
+
+ return (l_ramTotalBytes);
+}
+
+UI_32 CSysMemoryMonitor::BitReverse32(UI_32 f_val) {
+ // Don't print FRAMEWORKUNIFIEDLOG(ZONE_FUNC) to prevent obfuscation method from being revealed.
+ f_val = (((f_val & 0xaaaaaaaa) >> 1) | ((f_val & 0x55555555) << 1));
+ f_val = (((f_val & 0xcccccccc) >> 2) | ((f_val & 0x33333333) << 2));
+ f_val = (((f_val & 0xf0f0f0f0) >> 4) | ((f_val & 0x0f0f0f0f) << 4));
+ f_val = (((f_val & 0xff00ff00) >> 8) | ((f_val & 0x00ff00ff) << 8));
+ f_val = (f_val >> 16) | (f_val << 16);
+ return (f_val);
+}
diff --git a/systemservice/system_manager/server/src/systemmanager_application.cpp b/systemservice/system_manager/server/src/systemmanager_application.cpp
new file mode 100755
index 0000000..506bb2c
--- /dev/null
+++ b/systemservice/system_manager/server/src/systemmanager_application.cpp
@@ -0,0 +1,237 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file contains the standard set functions called by the NS
+// dispatcher on application initialization, cleanup and wakeup.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <system_service/ss_templates.h>
+
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_system_manager.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <errno.h>
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnInitialization
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ eStatus = CSystemManager::GetInstance().Initialize(hApp);
+ struct rlimit setrl = {RLIM_INFINITY, RLIM_INFINITY};
+ struct rlimit getrl = {};
+ int ret = prlimit(getpid(), RLIMIT_MSGQUEUE, &setrl, &getrl);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "prlimit ret%d", ret);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Previous limits: soft=%lld; hard=%lld", (long long) getrl.rlim_cur,
+ (long long) getrl.rlim_max);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnWakeup
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnWakeup(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnShutdown
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnDestroy
+/// \todo Add behavior to this function
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) { // LCOV_EXCL_START 14:Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEShutdown
+/// \todo Add behavior to this function
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp) { // LCOV_EXCL_START 7:Debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CSystemManager* l_instance = &CSystemManager::GetInstance();
+ if (l_instance !=NULL) {
+ l_instance->SystemManagerDebugDump(hApp);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_STATUS(l_eStatus, "Unable to acquire SM instance. Debug Dump handler not called."); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+*/
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+*/
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+*/
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SystemmanagerCloseApplication(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = CSystemManager::GetInstance().CloseApplication(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// EOF
+
diff --git a/systemservice/system_manager/server/src/systemmanager_main.cpp b/systemservice/system_manager/server/src/systemmanager_main.cpp
new file mode 100755
index 0000000..d12aecc
--- /dev/null
+++ b/systemservice/system_manager/server/src/systemmanager_main.cpp
@@ -0,0 +1,120 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief Application entry point.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <system_service/ss_system_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_version.h>
+#include <system_service/ss_system_types.h>
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <cstdlib>
+#include <fstream>
+
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_system_manager.h"
+
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+
+/// \brief: Name of the Queue that will be used to read data from.
+const CHAR AppName[] = SERVICE_SYSMANAGER;
+
+static EFrameworkunifiedStatus ArgumentParser(SI_32 cc, PCHAR str) {
+ switch (cc) {
+ case 'b':
+ CSystemManager::m_bootOpt += str;
+ break;
+ default:
+ break;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+//////////////////////////////////////////
+// Function : main
+//////////////////////////////////////////
+int main(int argc, char *argv[]) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cbFuncs); // LCOV_EXCL_BR_LINE 15: marco defined in ss-system_if.h // NOLINT(whitespace/line_length)
+ int fd;
+/*
+ if (geteuid() == 0) { // LCOV_EXCL_BR_LINE 200: process cannot be executed by root
+ // LCOV_EXCL_START 200: process cannot be executed by root
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("System cannot be started by root user!!\n"
+ "You can start system: \n"
+ " # sm > /dev/null &\n"
+ " or \n"
+ " # sm &\n");
+ // LCOV_EXCL_STOP
+ return -1;
+ }
+*/
+ fd = open("/dev/null", O_RDONLY); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (fd > 0) { // LCOV_EXCL_BR_LINE 5: open file error case.
+ int ret;
+ ret = dup2(fd, 0);
+ if (ret == -1) perror("dup2"); // LCOV_EXCL_BR_LINE 5: dup2 error case.
+ ret = close(fd); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (ret == -1) perror("close"); // LCOV_EXCL_BR_LINE 5: close error case.
+ } else {
+ // LCOV_EXCL_START 5: open file error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ perror("open"); // LCOV_EXCL_LINE 5: open file error case.
+ // LCOV_EXCL_STOP
+ }
+
+ // This allows overriding the already-passed-in System Manager's command
+ // line arguments by having a file exist named
+ // "/agl/rwdata/<this_file's_base_name>.args".
+ // For example, when this file is named 'SS_SystemManager', then
+ // if '/agl/rwdata/SS_SystemManager.args' is present, then the
+ // '/agl/rwdata/SS_SystemManager.args' strings are read as command line
+ // values and are passed to the FrameworkunifiedDispatcher() function.
+ // -m
+ // 0xFFFFFFFF,0xFFFFFFFF, where each bit represents a logging Zone.
+ // -c
+ // [configuration file..]
+
+ struct sched_param l_schedParam;
+
+ l_schedParam.sched_priority = PR_SS_SYSMANAGER;
+
+ if (0 != sched_setscheduler(getpid(), SCHED_FIFO, &l_schedParam)) { // LCOV_EXCL_BR_LINE 5: sched_setscheduler error case. // NOLINT(whitespace/line_length)
+ printf("ASSERT %d:%s\n", errno, strerror(errno)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ CustomCommandLineOptions l_tCmdLineOptions = { "b:", NULL, ArgumentParser }; // cShortOptions,rsv,callback
+ {
+ l_eStatus = FrameworkunifiedDispatcherWithArguments(AppName, argc, argv, &cbFuncs, &l_tCmdLineOptions); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ printf("SM: Line %d: FrameworkunifiedDispatcherWithArguments() returned l_eStatus: '%d'/'%s'\n", // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ __LINE__, l_eStatus, GetStr(l_eStatus).c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ return l_eStatus;
+} // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
diff --git a/systemservice/system_manager/server/version.txt b/systemservice/system_manager/server/version.txt
new file mode 100755
index 0000000..7fe8299
--- /dev/null
+++ b/systemservice/system_manager/server/version.txt
@@ -0,0 +1,2 @@
+AGL Sample
+20191026_release
diff --git a/systemservice/system_service.mk b/systemservice/system_service.mk
new file mode 100755
index 0000000..5444eb4
--- /dev/null
+++ b/systemservice/system_service.mk
@@ -0,0 +1,44 @@
+#############################################################
+#
+# Common Makefile for system_service
+# Copyright (C) 2017-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := system_service
+
+#############################################################
+
+
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/systemservice/task_manager/LICENSE b/systemservice/task_manager/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/systemservice/task_manager/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/systemservice/task_manager/Makefile.client b/systemservice/task_manager/Makefile.client
new file mode 100755
index 0000000..2c1628d
--- /dev/null
+++ b/systemservice/task_manager/Makefile.client
@@ -0,0 +1,21 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../system_service.mk
+
+
diff --git a/systemservice/task_manager/Makefile.server b/systemservice/task_manager/Makefile.server
new file mode 100755
index 0000000..245dcc5
--- /dev/null
+++ b/systemservice/task_manager/Makefile.server
@@ -0,0 +1,21 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := server
+
+include ../system_service.mk
+
+
diff --git a/systemservice/task_manager/client/Makefile b/systemservice/task_manager/client/Makefile
new file mode 100755
index 0000000..7d90745
--- /dev/null
+++ b/systemservice/task_manager/client/Makefile
@@ -0,0 +1,26 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS = libtskmcfg ss_data_init libtskm libprimary
+
+VPATH = ../server/include/$(COMPONENT_NAME)
+
+######### install headers(*.h) #############
+INST_HEADERS = INI_API.h INI_API.hpp Primary_common.h tskm.h tskm_type.h tskm_local_type.h
+INST_HEADERS += sysup_from.h sysup.h tskm_svc.h
+INST_HEADERS += task_manager.h
+
+include ../../system_service.mk
diff --git a/systemservice/task_manager/client/libprimary/Makefile b/systemservice/task_manager/client/libprimary/Makefile
new file mode 100755
index 0000000..f58737c
--- /dev/null
+++ b/systemservice/task_manager/client/libprimary/Makefile
@@ -0,0 +1,37 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+VPATH = ./src ./../../server/src
+#######################################
+INST_SHLIBS = libprimary
+
+libprimary_SRCS = pri_main.c pri_api.c tskm_port_pf.c tskm_comm.c tskm_debug.c
+LDFLAGS += -Wl,--no-as-needed
+######### linked library (dynamic) #############
+LDLIBS += -lpthread
+LDLIBS += -lstdc++
+LDLIBS += -lrt
+LDLIBS += -lSS_SystemIfUnified
+LDLIBS += -lNS_FrameworkUnified
+LDLIBS += -lcommon
+
+######### add library path #############
+
+
+CPPFLAGS = -I./include/ -I./../../include-share -I./../../server/include -I./../libtskmcfg/include
+
+CPPFLAGS += -fno-exceptions
+
+include ../../../system_service.mk
diff --git a/systemservice/task_manager/client/libprimary/include/pri_main.h b/systemservice/task_manager/client/libprimary/include/pri_main.h
new file mode 100755
index 0000000..c29a337
--- /dev/null
+++ b/systemservice/task_manager/client/libprimary/include/pri_main.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_CLIENT_LIBPRIMARY_INCLUDE_PRI_MAIN_H_
+#define TASK_MANAGER_CLIENT_LIBPRIMARY_INCLUDE_PRI_MAIN_H_
+
+#include <native_service/frameworkunified_types.h>
+
+#include "system_service/tskm_type.h"
+#include "system_service/Primary_common.h"
+#include "system_service/INI_API.hpp"
+
+int pri_main(T_PRIM_PRM* p_prm, int argc, char* argv[]);
+void pri_exitStart(void* rsv);
+void pri_exitDone(int status);
+void* pri_getPrivate();
+HANDLE pri_getHandle();
+int32_t pri_setMonitorTimeout(uint32_t timeout);
+
+int32_t pri_stepForkComp(uint64_t id);
+int32_t pri_accOffComp(uint64_t id);
+
+int32_t pri_getBootInfo(T_SS_SM_START_DataStructType *info);
+int32_t pri_getExtBootInfo(T_SS_SM_START_ExtDataStructType *info);
+void pri_sendDebugDumpRes(const char *buf);
+
+void pri_init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum,
+ int fdlist[INI_FD_MAX]);
+BOOL pri_handler(fd_set* p_fds);
+void pri_term(void);
+int pri_setMonitorState(BOOL bIsRun, uint32_t timeout);
+void pri_getAppHandle(void);
+
+#endif // TASK_MANAGER_CLIENT_LIBPRIMARY_INCLUDE_PRI_MAIN_H_
+
diff --git a/systemservice/task_manager/client/libprimary/libprimary.ver b/systemservice/task_manager/client/libprimary/libprimary.ver
new file mode 100755
index 0000000..bebdc98
--- /dev/null
+++ b/systemservice/task_manager/client/libprimary/libprimary.ver
@@ -0,0 +1,22 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ global:
+ INI_*;
+ _INI_DEBUGDUMP*;
+ local: *;
+};
diff --git a/systemservice/task_manager/client/libprimary/src/pri_api.cpp b/systemservice/task_manager/client/libprimary/src/pri_api.cpp
new file mode 100755
index 0000000..ca1b40e
--- /dev/null
+++ b/systemservice/task_manager/client/libprimary/src/pri_api.cpp
@@ -0,0 +1,224 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "system_service/tskm_local_type.h"
+#include "system_service/INI_API.hpp"
+#include "tskm_debug.h"
+#include "pri_main.h"
+
+BOOL __thread isMain = FALSE; // Check for accessibility from the main thread context
+
+TSKM_STATIC BOOL isInitPrmValid(const T_PRIM_PRM* p_prm) {
+ if (p_prm == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->shmTbl == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->wakeupExFuncTbl == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->downExFuncTbl == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->onInit == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->onDestory == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->onDebugDump == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->onTouch == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/******************************************************************************
+ * APIs for implementing the main thread on the service side
+ *******************************************************************************/
+/*********************************************************
+ * Primary library initialization
+ *********************************************************/
+int32_t INI_Init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum,
+ int fdlist[INI_FD_MAX]) {
+ isMain = TRUE;
+ if (isInitPrmValid(p_prm) == FALSE) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+ pri_init(p_prm, argc, argv, fdNum, fdlist);
+ return INI_SUCCESS;
+}
+
+/***********************************************************
+ * Primary library / Event handler
+ * ret:TRUE Running
+ * ret:FALSE Finished (Terminated a process with INI_Term())
+ ************************************************************/
+BOOL INI_Handler(fd_set* p_fds) {
+ if (!isMain || NULL == p_fds) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ }
+
+ return pri_handler(p_fds);
+}
+
+/***********************************************************
+ * Primary (Processing finished)
+ ************************************************************/
+void INI_Term(void) {
+ pri_term();
+}
+
+/***********************************************************
+ * Primary (State setting for watching Services)
+ ************************************************************/
+int32_t INI_SetMonitorState(T_PRIM_MONITOR_PRM *p_prm) {
+ if (!p_prm) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ return pri_setMonitorState(p_prm->bIsRun, p_prm->timeout);
+ ERROR: return INI_FALSE;
+}
+
+/******************************************************************************
+ * Hiding the Main Thread in the Primary Library
+ *******************************************************************************/
+/************************************
+ * Startup FW MainLoop
+ ************************************/
+int INI_Main(T_PRIM_PRM* p_prm, int argc, char* argv[]) {
+ if (isInitPrmValid(p_prm) == FALSE) { // LCOV_EXCL_BR_LINE 6: Checked by Init()
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+
+ isMain = TRUE;
+
+ return pri_main(p_prm, argc, argv);
+}
+
+/******************************************************************************
+ * Common API
+ *******************************************************************************/
+/************************************
+ * Process termination
+ ************************************/
+void INI_ExitStart(void * rsv) {
+ static int isCalled = 0;
+ if (isCalled) {
+ return;
+ }
+ isCalled = 1;
+ pri_exitStart(rsv);
+}
+
+void INI_ExitDone(int status) {
+ static int isCalled = 0;
+ if (isCalled) {
+ return;
+ }
+ isCalled = 1;
+ pri_exitDone(status);
+}
+
+/************************************
+ * Private Info Acquisition
+ ************************************/
+void* INI_GetPrivate() {
+ return pri_getPrivate();
+}
+
+/************************************
+ * Applicastion Handle Aquisition
+ ************************************/
+HANDLE INI_GetHandle() {
+ return pri_getHandle();
+}
+
+/************************************
+ * Timeout setting for service monitoring status setting
+ ************************************/
+int32_t INI_SetMonitorTimeout(uint32_t timeout) {
+ return pri_setMonitorTimeout(timeout);
+}
+
+/************************************
+ * Event completion notification at startup
+ ************************************/
+int32_t INI_StepForkComp(uint64_t compId) {
+ return pri_stepForkComp(compId);
+}
+
+/************************************
+ * Event completion notification at termination
+ ************************************/
+int32_t INI_AccOffComp(uint64_t compId) {
+ return pri_accOffComp(compId);
+}
+
+/************************************
+ * BOOT Info Acquisition
+ ************************************/
+int32_t INI_GetBootInfo(T_SS_SM_START_DataStructType *info) {
+ if (info == NULL) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+ return pri_getBootInfo(info);
+}
+
+/************************************
+ * Extended BOOT Info Acquisition
+ ************************************/
+int32_t INI_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *info) {
+ if (info == NULL) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+ return pri_getExtBootInfo(info);
+}
+
+/************************************
+ * DebugDump Responding
+ ************************************/
+void _INI_DEBUGDUMP(BOOL bIsNeedSvcName, PCSTR cFormat, ...) { // LCOV_EXCL_START 7: for debugging
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ va_list argList;
+ char buf[TSKM_EV_DEBUGDUMP_SIZE] = { 0 };
+
+ if (bIsNeedSvcName) {
+ snprintf(buf, TSKM_EV_DEBUGDUMP_SIZE, "%s/",
+ FrameworkunifiedGetAppName(pri_getHandle()));
+ }
+
+ va_start(argList, cFormat);
+ vsnprintf(&buf[strlen(buf)], TSKM_EV_DEBUGDUMP_SIZE - strlen(buf), cFormat,
+ argList);
+ va_end(argList);
+
+ return pri_sendDebugDumpRes(buf);
+}
+// LCOV_EXCL_STOP 7
+
diff --git a/systemservice/task_manager/client/libprimary/src/pri_main.cpp b/systemservice/task_manager/client/libprimary/src/pri_main.cpp
new file mode 100755
index 0000000..9c0dd95
--- /dev/null
+++ b/systemservice/task_manager/client/libprimary/src/pri_main.cpp
@@ -0,0 +1,873 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "pri_main.h"
+#include <sys/eventfd.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <system_service/ss_system_if.h>
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include "tskm_debug.h"
+#include "tskm_comm.h"
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+#include "tskm_util.h"
+
+
+#define PRI_PROC_NAME_MAX 32
+
+// Context
+typedef struct {
+ T_PRIM_PRM prm;
+
+ TSKM_SVCID_t svcId; // Set valid value by REQ_WAKEUP
+ char procName[PRI_PROC_NAME_MAX];
+ // State
+ TSKM_BOOL_t isExec;
+ T_SS_SM_START_DataStructType bootInfo;
+ T_SS_SM_START_ExtDataStructType extBootInfo; TSKM_BOOL_t isDynamic;
+ uint32_t wakeupStepDone; // Performed Local Step
+ TSKM_BOOL_t shmDone;
+ uint32_t downStepDone; // Performed Local Step
+ TSKM_BOOL_t isExitStart;
+
+#define PRI_MONITOR_DEFAULT_TIMEOUT 50
+ uint32_t timeout; // Service monitoring timeout period (valid only for the INI_Main type service)
+
+ // Resources
+ int connFd; // TSKM communication sockets
+ int nsFd; // NSFW sockets
+ int pipeFd[2]; // For exitDone
+ HANDLE hApp; // appHandle
+} PRI_CTX_t;
+
+static PRI_CTX_t g_pri;
+
+/*********************************************
+ * Create Shared Memory
+ *********************************************/
+TSKM_STATIC void shmMake(PRI_CTX_t* p_ctx) {
+ const PRIM_SHAREDATA_TBL* shmEntry;
+ for (shmEntry = p_ctx->prm.shmTbl; shmEntry->shmName[0] != '\0'; shmEntry++) {
+ int ret;
+ ret = tskm_pf_shmCreate(shmEntry->shmName, shmEntry->size, NULL);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+ p_ctx->shmDone = TSKM_TRUE;
+ return;
+
+ // LCOV_EXCL_START 6: Checked by Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************
+ * Call Backup Check CB
+ *********************************************/
+TSKM_STATIC uint32_t wakeupExFuncCallback(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ const PRIM_EXFUNC_TBL* funcEntry;
+ uint32_t maxStep = 0;
+
+ for (funcEntry = p_ctx->prm.wakeupExFuncTbl; funcEntry->localStep != 0;
+ funcEntry++) {
+ if (funcEntry->localStep == p_prm->localStep) {
+ funcEntry->func(funcEntry->prm);
+ }
+ maxStep = TSKM_MAX(maxStep, funcEntry->localStep);
+ }
+ return maxStep;
+}
+
+/*********************************************
+ * Gradual Start Request
+ *********************************************/
+TSKM_STATIC void wakeupRequest(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t prm = *p_prm;
+ uint32_t max = 0;
+
+ // Execute one step at a time
+ for (prm.localStep = p_ctx->wakeupStepDone + 1;
+ (prm.localStep <= p_prm->localStep && prm.localStep < PRIM_STEPFORK_MAX);
+ prm.localStep++) {
+ max = wakeupExFuncCallback(p_ctx, &prm);
+ }
+
+ if (max <= p_prm->localStep) {
+ // Gradual start completed
+ p_ctx->wakeupStepDone = PRIM_STEPFORK_MAX;
+ } else {
+ p_ctx->wakeupStepDone = p_prm->localStep;
+ }
+}
+
+/*********************************************
+ * All startup requests
+ *********************************************/
+TSKM_STATIC void allWakeup(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ if (!p_ctx->shmDone) {
+ shmMake(p_ctx);
+ }
+
+ if (p_ctx->wakeupStepDone < PRIM_STEPFORK_MAX) {
+ wakeupRequest(p_ctx, p_prm);
+ }
+}
+
+/*********************************************
+ * Startup request handle
+ *********************************************/
+TSKM_STATIC void wakeupRequestHandle(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+
+ bzero(&ev, sizeof(ev));
+
+ p_ctx->svcId = p_prm->svcId;
+ memcpy(&p_ctx->bootInfo, &p_prm->bootInfo, sizeof(p_ctx->bootInfo));
+ memcpy(&p_ctx->extBootInfo, &p_prm->extBootInfo, sizeof(p_ctx->extBootInfo));
+ p_ctx->isDynamic = p_prm->isDynamic;
+
+ if (p_prm->localStep == TSKM_LSTEP_ALL) {
+ allWakeup(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_LAST) {
+ wakeupRequest(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_SHM) {
+ shmMake(p_ctx);
+ } else {
+ wakeupRequest(p_ctx, p_prm);
+ }
+
+ ev.prm.resWakeup.isShmDone = p_ctx->shmDone;
+ ev.prm.resWakeup.isStepDone =
+ (p_ctx->wakeupStepDone >= PRIM_STEPFORK_MAX) ?
+ TSKM_TRUE : TSKM_FALSE;
+
+ // LCOV_EXCL_BR_START 6: Because it depends on the test order
+ if (ev.prm.resWakeup.isShmDone && ev.prm.resWakeup.isStepDone) {
+ // LCOV_EXCL_BR_STOP
+ ev.prm.resWakeup.isLast = TSKM_TRUE;
+ }
+
+ ev.event = TSKM_EV_PRI_RES_WAKEUP;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+ }
+}
+
+/*********************************************
+ * Gradual Termination CALLBACK
+ *********************************************/
+TSKM_STATIC uint32_t downExFuncCallback(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ const PRIM_EXFUNC_TBL* funcEntry;
+ uint32_t maxStep = 0;
+
+ for (funcEntry = p_ctx->prm.downExFuncTbl; funcEntry->localStep != 0;
+ funcEntry++) {
+ if (funcEntry->localStep == p_prm->localStep) {
+ funcEntry->func(funcEntry->prm);
+ }
+ maxStep = TSKM_MAX(maxStep, funcEntry->localStep);
+ }
+ return maxStep;
+}
+
+/*********************************************
+ * Gradual Termination Request
+ *********************************************/
+TSKM_STATIC void downRequest(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ TSKM_EV_PRI_REQ_DOWN_PRM_t prm = *p_prm;
+ uint32_t max = 0;
+
+ // Execute one step at a time
+ for (prm.localStep = p_ctx->downStepDone + 1;
+ (prm.localStep <= p_prm->localStep && prm.localStep < PRIM_ACCOFF_MAX);
+ prm.localStep++) {
+ max = downExFuncCallback(p_ctx, &prm);
+ }
+
+ if (max <= p_prm->localStep) {
+ p_ctx->downStepDone = PRIM_ACCOFF_MAX; // Completed all steps
+ } else {
+ p_ctx->downStepDone = p_prm->localStep;
+ }
+}
+
+TSKM_STATIC void downRequestHandle(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+
+ bzero(&ev, sizeof(ev));
+
+ if (p_prm->localStep == TSKM_LSTEP_ALL || p_prm->localStep == TSKM_LSTEP_LAST) {
+ downRequest(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_SHM) {
+ TSKM_ASSERT(0);
+ } else if (p_prm->localStep == TSKM_LSTEP_BUPCHK) {
+ TSKM_ASSERT(0);
+ } else {
+ downRequest(p_ctx, p_prm);
+ }
+
+ if (p_ctx->downStepDone >= PRIM_ACCOFF_MAX) {
+ /* It is not notified when the last function is executed, and it is left to the exitDone.
+ TSKM_PRINTF(TSKM_LOG_DEBUG,"ACCOFF DONE");
+ ev.prm.resDown.isLast = TSKM_TRUE;
+ p_ctx->isExec = TSKM_FALSE;
+ ret = tskm_sockSend(p_ctx->connFd,&ev);
+ if(ret <= 0){
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ }
+ */
+ } else {
+ ev.event = TSKM_EV_PRI_RES_DOWN;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+ }
+ }
+}
+
+/*********************************************
+ * Termination completion is notified to the TSKM
+ *********************************************/
+TSKM_STATIC void sendLastDoneRes(PRI_CTX_t* p_ctx) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_PRI_RES_DOWN;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.resDown.isLast = TSKM_TRUE;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Termination completion is notified to the TSKM.
+ // LCOV_EXCL_START 5: Termination completion is notified to the TSKM.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+ }
+}
+
+/*********************************************
+ * Invocation of Touch CB
+ *********************************************/
+TSKM_STATIC void touchService(PRI_CTX_t* p_ctx) {
+ char touchName[32];
+
+ if (p_ctx->isExitStart) {
+ // If termination processing has already begun, the system does not respond Touch but TIMEOUT the processing for retrying.
+ return;
+ }
+
+ p_ctx->prm.onTouch(p_ctx->hApp);
+
+ tskm_pf_mkTouchFileName(getpid(), touchName);
+
+ if ((access(touchName, F_OK) == 0)) {
+ // Synchronize by deleting files.
+ TSKM_PRINTF(TSKM_LOG_STATE, "del:%s", touchName);
+ unlink(touchName);
+ } else {
+ TSKM_ASSERT_PRINT(0, "%s", touchName);
+ }
+}
+
+/*********************************************
+ * Invocation of Debugdump CB
+ *********************************************/
+TSKM_STATIC void callDebugDump(PRI_CTX_t* p_ctx) {
+ if (!p_ctx->prm.onDebugDump) { // LCOV_EXCL_BR_LINE 6: As NULL checked by INI_Init
+ // LCOV_EXCL_START 6: As NULL checked by INI_Init
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ } else {
+ p_ctx->prm.onDebugDump(p_ctx->hApp);
+ }
+}
+
+/*********************************************
+ * Invocation of LowMemory detection CB
+ *********************************************/
+TSKM_STATIC void callLowMem(PRI_CTX_t* p_ctx) {
+ if (!p_ctx->prm.onLowMem) {
+ TSKM_ASSERT(0);
+ } else if (!p_ctx->isExitStart) {
+ // Notify LowMemory only when the process is finished
+ p_ctx->prm.onLowMem(p_ctx->hApp);
+ }
+}
+
+/*********************************************
+ * Event Handle
+ *********************************************/
+TSKM_STATIC void eventHandle(PRI_CTX_t* p_ctx, TSKM_EVENT_INFO_t* p_ev) {
+ // Processing according to the request
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REQ_WAKEUP:
+ wakeupRequestHandle(p_ctx, &p_ev->prm.reqWakeup);
+ break;
+ case TSKM_EV_PRI_REQ_DOWN:
+ downRequestHandle(p_ctx, &p_ev->prm.reqDown);
+ break;
+ case TSKM_EV_PRI_REQ_TOUCH:
+ touchService(p_ctx);
+ break;
+ case TSKM_EV_PRI_REQ_DEBUGDUMP:
+ callDebugDump(p_ctx);
+ break;
+ case TSKM_EV_PRI_REP_LOWMEM:
+ callLowMem(p_ctx);
+ break;
+ default:
+ TSKM_ASSERT(0);
+ break;
+ }
+}
+
+/*********************************************
+ * Initialize Context
+ *********************************************/
+TSKM_STATIC void initCtx(T_PRIM_PRM* p_prm, PRI_CTX_t* p_ctx, int argc,
+ char* argv[]) {
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+
+ p_ctx->prm = *p_prm;
+
+ cbFuncs.onInitilization = p_ctx->prm.onInit;
+ cbFuncs.onDestroy = p_ctx->prm.onDestory;
+ cbFuncs.onDebugDump = p_ctx->prm.onDebugDump;
+ cbFuncs.onStart = FrameworkunifiedOnStart;
+ cbFuncs.onStop = FrameworkunifiedOnStop;
+ cbFuncs.onPreStart = FrameworkunifiedOnPreStart;
+ cbFuncs.onPreStop = FrameworkunifiedOnPreStop;
+ cbFuncs.onBackgroundStart = FrameworkunifiedOnBackgroundStart;
+ cbFuncs.onBackgroundStop = FrameworkunifiedOnBackgroundStop;
+ cbFuncs.createStateMachine = FrameworkunifiedCreateStateMachine;
+ cbFuncs.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface;
+
+ EFrameworkunifiedStatus taskmanagerRet;
+ taskmanagerRet = FrameworkunifiedCreateDispatcherWithoutLoop(p_ctx->prm.name, p_ctx->hApp, argc,
+ argv, &cbFuncs, FALSE);
+ if (eFrameworkunifiedStatusOK != taskmanagerRet) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ taskmanagerRet = FrameworkunifiedGetDispatcherFD(p_ctx->hApp, &p_ctx->nsFd);
+ if (taskmanagerRet != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ exit(EXIT_FAILURE);
+ }
+
+ p_ctx->connFd = tskm_cliSockConnect(TSKM_SOCKET_NAME);
+ if (p_ctx->connFd < 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ if (pipe(p_ctx->pipeFd) != 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ return;
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************
+ * Destroy Context
+ *********************************************/
+TSKM_STATIC void termCtx(PRI_CTX_t* p_ctx) {
+ if (p_ctx->shmDone) { // LCOV_EXCL_BR_LINE 6: Since it has been set to True by INI_Handler and cannot be changed
+ const PRIM_SHAREDATA_TBL* shmEntry = p_ctx->prm.shmTbl;
+ for (shmEntry = p_ctx->prm.shmTbl; shmEntry->shmName[0] != '\0';
+ shmEntry++) {
+ TSKM_ASSERT(0 == tskm_pf_shmDelete(shmEntry->shmName)); // LCOV_EXCL_BR_LINE 8: For processing in which only return value 0 is set
+ }
+ }
+
+ if (p_ctx->connFd > 0) { // LCOV_EXCL_BR_LINE 6: As it is already set by INI_Init and cannot be changed
+ tskm_sockDestory(p_ctx->connFd);
+ }
+
+ EFrameworkunifiedStatus taskmanagerRet;
+ taskmanagerRet = FrameworkunifiedDestroyDispatcherWithoutLoop(p_ctx->hApp);
+ TSKM_ASSERT(taskmanagerRet == eFrameworkunifiedStatusOK);
+
+ if (p_ctx->isDynamic) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "EXIT %s", p_ctx->procName);
+ } else {
+ // Hung up running services to prevent adversely affecting to system termination processing during process termination processing
+ sleep(TSKM_CFG_WAIT_SHUTDOWN);
+ }
+}
+
+/*******************************************************************
+ * PRI Context Initialization
+ *******************************************************************/
+void pri_init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum,
+ int fdlist[INI_FD_MAX]) {
+ int ret = 0;
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ strncpy(p_ctx->procName, basename(argv[0]), sizeof(p_ctx->procName) - 1);
+
+ ret = tskm_pf_procInit();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: Return value of 0 only
+ // LCOV_EXCL_START 6: Return value of 0 only
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = tskm_comm_procInit();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ initCtx(p_prm, p_ctx, argc, argv);
+
+ *fdNum = 3;
+ fdlist[0] = p_ctx->connFd;
+ fdlist[1] = p_ctx->pipeFd[0];
+ fdlist[2] = p_ctx->nsFd;
+
+ p_ctx->svcId = TSKM_SVCID_NONE;
+ p_ctx->isExec = TSKM_TRUE;
+
+ p_ctx->bootInfo.startupReason = epswfINVALID;
+ p_ctx->bootInfo.isUserModeOn = FALSE;
+ p_ctx->bootInfo.dataResetMode = e_SS_SM_DATA_RESET_MODE_NONE;
+ p_ctx->bootInfo.securityStatus = epsssINVALID;
+ p_ctx->bootInfo.wakeupType = epsstINVALID;
+ p_ctx->bootInfo.dramBackupStatus = e_SS_SM_DRAM_BACKUP_UNSET;
+ p_ctx->bootInfo.resetStatus = e_SS_SM_RESET_STATUS_UNSET;
+
+ memset(&p_ctx->extBootInfo, 0, sizeof(p_ctx->extBootInfo));
+
+ p_ctx->timeout = PRI_MONITOR_DEFAULT_TIMEOUT;
+
+ return;
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort(); // ABORT
+ // LCOV_EXCL_STOP
+}
+
+/*******************************************************************
+ * Primary Library Handler
+ *******************************************************************/
+BOOL pri_handler(fd_set* p_fds) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (FD_ISSET(p_ctx->connFd, p_fds)) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+ ret = tskm_sockRcv(p_ctx->connFd, &ev);
+ // LCOV_EXCL_BR_START 5: Condition is true. False condition is checked in Death tests, but not reflected in coverage and excluded
+ if (ret > 0) {
+ // LCOV_EXCL_BR_STOP
+ eventHandle(p_ctx, &ev);
+ } else { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (FD_ISSET(p_ctx->pipeFd[0], p_fds)) {
+ // only use exitDone
+ uint32_t tmp;
+ TSKM_ASSERT(sizeof(tmp) == read(p_ctx->pipeFd[0], &tmp, sizeof(tmp)));
+ TSKM_ASSERT(p_ctx->downStepDone == PRIM_ACCOFF_MAX); // Check if all exit functions are complete
+ if (p_ctx->isDynamic) {
+ // A nonresident service completes its termination processing by terminating the process.
+ // (because the SIGNAL will overtake the sockets)
+ } else {
+ // The resident service is a termination notice and completes termination processing.
+ // (Do not terminate processes to reduce the impact on system termination)
+ sendLastDoneRes(p_ctx);
+ }
+ p_ctx->isExec = TSKM_FALSE;
+ }
+
+ if (FD_ISSET(p_ctx->nsFd, p_fds)) {
+ FrameworkunifiedDispatchProcessWithoutLoop(p_ctx->hApp);
+ }
+ return p_ctx->isExec;
+
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort(); // ABORT
+ return 0;
+ // LCOV_EXCL_STOP
+}
+
+/*******************************************************************
+ * Process termination
+ *******************************************************************/
+void pri_term(void) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ termCtx(p_ctx);
+}
+
+/*******************************************************************
+ * Service Monitoring Status Setting
+ *******************************************************************/
+int pri_setMonitorState(BOOL bIsRun, uint32_t timeout) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ int ret = INI_SUCCESS;
+
+ if (TSKM_SVCID_NONE == p_ctx->svcId) {
+ // Ignore requests until svcId is acquired.
+ } else if ((TRUE == bIsRun) && (0 == timeout)) {
+ // When RUN is specified with timeout = 0, monitoring is disabled.
+ } else {
+ ret = tskm_comm_setSvcWatchState(p_ctx->svcId, bIsRun, timeout);
+ if (INI_SUCCESS != ret) {
+ TSKM_ASSERT(0);
+ }
+ }
+
+ return ret;
+}
+
+/*******************************************************************
+ * MAIN Function
+ *******************************************************************/
+int pri_main(T_PRIM_PRM* p_prm, int argc, char* argv[]) {
+ int mainRet = -1;
+ int fdlist[INI_FD_MAX];
+ int fdNum;
+ int ii;
+ BOOL isExec = TRUE;
+
+ pri_init(p_prm, argc, argv, &fdNum, fdlist);
+
+ while (isExec) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ int maxFd = 0;
+ fd_set fds;
+ int ret;
+
+ FD_ZERO(&fds);
+
+ for (ii = 0; ii < fdNum; ii++) {
+ FD_SET(fdlist[ii], &fds);
+ maxFd = TSKM_MAX(fdlist[ii], maxFd);
+ }
+
+ TSKM_ASSERT(INI_SUCCESS == pri_setMonitorState(FALSE, 0));
+ ret = select(maxFd + 1, &fds, NULL, NULL, NULL);
+ TSKM_ASSERT(INI_SUCCESS == pri_setMonitorState(TRUE, p_ctx->timeout));
+ if (ret < 1) {
+ // LCOV_EXCL_START 5: Select's Error-Handling Process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ TSKM_ASSERT(0);
+ }
+ continue;
+ // LCOV_EXCL_STOP
+ }
+
+ isExec = pri_handler(&fds);
+ }
+
+ mainRet = 0;
+
+ pri_term();
+ return mainRet;
+}
+
+/*******************************************************************
+ * Termination Request
+ *******************************************************************/
+void pri_exitStart(void *rsv) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+ p_ctx->isExitStart = TRUE;
+ ev.event = TSKM_EV_PRI_REQ_EXIT;
+ ev.errCode = TSKM_E_OK;
+
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: The caller's external API does not execute the second or subsequent processing and cannot be checked.
+ // LCOV_EXCL_START 5: The caller's external API does not execute the second or subsequent processing and cannot be checked.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ return;
+ // LCOV_EXCL_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked.
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+void pri_exitDone(int status) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ uint32_t l_status = (uint32_t) status;
+
+ if (p_ctx->pipeFd[1] > 0) { // LCOV_EXCL_BR_LINE 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ // LCOV_EXCL_BR_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ TSKM_ASSERT_ERRNO(
+ write(p_ctx->pipeFd[1], &l_status, sizeof(l_status))
+ == sizeof(l_status));
+ // LCOV_EXCL_BR_STOP
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: The caller's external API does not execute the second or subsequent processing and cannot be checked.
+ }
+}
+
+/*******************************************************************
+ * Event completion notification at startup
+ *******************************************************************/
+int32_t pri_stepForkComp(uint64_t id) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+ ev.event = TSKM_EV_PRI_REP_WAKEUP_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repWakeupComp.compId = id;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ return INI_SUCCESS;
+ ERROR: return INI_FALSE;
+}
+
+/*******************************************************************
+ * Event completion notification at termination
+ *******************************************************************/
+int32_t pri_accOffComp(uint64_t id) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_PRI_REP_DOWN_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repDownComp.compId = id;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ return INI_SUCCESS;
+ ERROR: return INI_FALSE;
+}
+
+/*******************************************************************
+ * Private Information Acquisition
+ *******************************************************************/
+void*
+pri_getPrivate() {
+ PRI_CTX_t* p_ctx = &g_pri;
+ return p_ctx->prm.priv;
+}
+
+/*******************************************************************
+ * App Handle Acquisition
+ *******************************************************************/
+HANDLE pri_getHandle() {
+ PRI_CTX_t* p_ctx = &g_pri;
+ return p_ctx->hApp;
+}
+
+/*******************************************************************
+ * Timeout setting for Service monitoring status setting
+ *******************************************************************/
+int32_t pri_setMonitorTimeout(uint32_t timeout) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ p_ctx->timeout = timeout;
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * BOOT Info Acquisition
+ *******************************************************************/
+int32_t pri_getBootInfo(T_SS_SM_START_DataStructType *info) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (p_ctx->bootInfo.startupReason == epswfINVALID) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+
+ *info = p_ctx->bootInfo;
+
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * Extended BOOT Info Acquisition
+ *******************************************************************/
+int32_t pri_getExtBootInfo(T_SS_SM_START_ExtDataStructType *info) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (p_ctx->bootInfo.startupReason == epswfINVALID) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+
+ *info = p_ctx->extBootInfo;
+
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * DebugDump Responding
+ *******************************************************************/
+void pri_sendDebugDumpRes(const char *buf) { // LCOV_EXCL_START 7: for debugging
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+ TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *p_prm;
+
+ ev.event = TSKM_EV_PRI_RES_DEBUGDUMP;
+ ev.errCode = TSKM_E_OK;
+ ev.hasExtend = TSKM_TRUE;
+
+ ev.extendPrm = malloc(sizeof(TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t));
+ if (!ev.extendPrm) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ ev.extendSize = sizeof(TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t);
+
+ p_prm = (TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *) ev.extendPrm; // NOLINT ( )
+ snprintf(p_prm->dumpMsg, TSKM_EV_DEBUGDUMP_SIZE, "%s", buf);
+
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ }
+
+ ERROR: return;
+}
+// LCOV_EXCL_STOP
+/*************************************************
+ * Empty functions implemented for building software
+ **************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
diff --git a/systemservice/task_manager/client/libtskm/Makefile b/systemservice/task_manager/client/libtskm/Makefile
new file mode 100755
index 0000000..b0f7e2f
--- /dev/null
+++ b/systemservice/task_manager/client/libtskm/Makefile
@@ -0,0 +1,35 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+VPATH = ./ ./src
+
+INST_SHLIBS = libtskm
+
+RPC_API := TSKM
+
+libtskm_SRCS = tskm_api_stub.c
+libtskm_SRCS += tskm_api_lib.cpp
+
+CPPFLAGS += -I. -I../../include-share -I./ -I../../server/include -I./../libtskmcfg/include
+
+######## add compile option ########
+CPPFLAGS += -fno-exceptions
+LDFLAGS += -Wl,--no-as-needed
+######### linked library (dynamic) #############
+LDLIBS += -lrpc
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+include ../../../system_service.mk
diff --git a/systemservice/task_manager/client/libtskm/TSKM.api b/systemservice/task_manager/client/libtskm/TSKM.api
new file mode 100755
index 0000000..023f53b
--- /dev/null
+++ b/systemservice/task_manager/client/libtskm/TSKM.api
@@ -0,0 +1,9 @@
+INCLUDE <system_service/tskm.h>
+
+RPC_Result _TSKM_SvcCtl(TSKM_SVCID_t svcId,const TSKM_SVC_CTL_t* ctl);
+RPC_Result TSKM_SvcGetInfo(TSKM_SVCID_t svcId,TSKM_SVC_INFO_t* svcInfo);
+RPC_Result _TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info);
+RPC_Result TSKM_Reboot(const TSKM_RSV_t * p_rsv);
+RPC_Result TSKM_Logging(const TSKM_LOGGING_INFO_t* p_info);
+RPC_Result TSKM_SetWakeupOrder(const TSKM_WAKEUP_ORDER_t* p_order);
+
diff --git a/systemservice/task_manager/client/libtskm/libtskm.ver b/systemservice/task_manager/client/libtskm/libtskm.ver
new file mode 100755
index 0000000..4d68cee
--- /dev/null
+++ b/systemservice/task_manager/client/libtskm/libtskm.ver
@@ -0,0 +1,21 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ global:
+ TSKM_*;
+ local: *;
+};
diff --git a/systemservice/task_manager/client/libtskm/src/tskm_api_lib.cpp b/systemservice/task_manager/client/libtskm/src/tskm_api_lib.cpp
new file mode 100755
index 0000000..625b639
--- /dev/null
+++ b/systemservice/task_manager/client/libtskm/src/tskm_api_lib.cpp
@@ -0,0 +1,90 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <unistd.h>
+#include <signal.h>
+
+#include <native_service/frameworkunified_framework_if.h>
+
+#include "tskm_debug.h"
+#include "tskm_api.h"
+
+TSKM_ERR_t TSKM_SvcCtl(TSKM_SVCID_t svcId, const TSKM_SVC_CTL_t* ctl) {
+ TSKM_ERR_t tskmRet;
+ int ii;
+
+ for (ii = 0; ii < 3; ii++) {
+ // Retry three times
+ tskmRet = _TSKM_SvcCtl(svcId, ctl);
+ if (tskmRet == TSKM_E_RETRY) {
+ usleep(300 * 1000); // 300ms wait
+ } else {
+ break;
+ }
+ }
+
+ return tskmRet;
+}
+
+TSKM_ERR_t TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+ RPC_Result rpcRet;
+
+ rpcRet = _TSKM_ErrorReboot(p_info);
+ if (RPC_OK != rpcRet) {
+ tskmRet = TSKM_E_PAR;
+ }
+
+ return tskmRet;
+}
+
+TSKM_ERR_t TSKM_DataInit(HANDLE hApp, const TSKM_DATAINIT_t *p_info) {
+ TSKM_ERR_t tskmRet = TSKM_E_NG;
+ TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__)
+
+ if (!p_info || !hApp || (p_info->type != TSKM_DATAINIT_TYPE_USER)
+ || !(p_info->onCompInit)) {
+ TSKM_ASSERT(0);
+ return TSKM_E_PAR;
+ }
+
+ // LCOV_EXCL_BR_START 10: Due to compiler dependency
+ EFrameworkunifiedStatus l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp,
+ SS_TASK_MANAGER,
+ TSKM_DATAINIT_RESP,
+ p_info->onCompInit);
+ // LCOV_EXCL_BR_STOP
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ } else {
+ HANDLE hSvc = FrameworkunifiedOpenService(hApp, SS_TASK_MANAGER);
+ if (hSvc == NULL) {
+ TSKM_ASSERT(0);
+ tskmRet = TSKM_E_STATE;
+ } else {
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSvc, TSKM_DATAINIT_REQ, 0, NULL)) {
+ TSKM_ASSERT(0);
+ } else {
+ tskmRet = TSKM_E_OK;
+ }
+ }
+
+ TSKM_ASSERT(eFrameworkunifiedStatusOK == FrameworkunifiedCloseService(hApp, hSvc));
+ }
+
+ return tskmRet;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/systemservice/task_manager/client/libtskmcfg/Makefile b/systemservice/task_manager/client/libtskmcfg/Makefile
new file mode 100755
index 0000000..9fe2ed3
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/Makefile
@@ -0,0 +1,93 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+WAKESHUTCONF_DIR=./conf
+
+VPATH = ./src ./include/$(COMPONENT_NAME)
+
+INST_SHLIBS = libtskmcfg
+INST_HEADERS = tskm_xml_data.h tskm_svcid.h task_manager_libtskmcfg.h
+libtskmcfg_SRCS = tskm_xml_data.cpp
+
+
+CPPFLAGS = -I./ -I./include -I./../../include-share -I./../../server/include
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+
+#============ XML PARSE ============
+XMLOUTFILE= tskm_auto_build.h
+
+CLEAN_FILES+=$(XMLOUTFILE) $(PARSEXMLCMD) $(CONFIG_FILES) top.xml
+
+#TOOLS
+HOST_CPP=cpp
+XMLCHECKER=xmllint
+XMLCHECKEROPT=--noout --valid
+PARSEXMLCMD=parsexml
+HOSTCC=gcc
+XMLFILETOP=tskm_cfg.xml
+
+install:install-pre install-pre-header
+build-lib:install-pre install-pre-header
+install-lib:install-pre install-pre-header
+install-pre:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ss/task_manager/rodata;\
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ss/task_manager/rodata $(WAKESHUTCONF_DIR)/tskm_launch.xml;\
+
+CONFIG_FILES:=tskm_wakeup.xml tskm_shutdown.xml tskm_wakeup_vup.xml tskm_shutdown_vup.xml tskm_launch.xml tskm_svcid.h agl_thread.h
+
+#install-header:$(XMLOUTFILE)
+install-pre-header:$(XMLOUTFILE)
+
+#TOPFILE
+top.xml:$(XMLFILETOP)
+ ln -fs $< $@
+
+#CONFIG RULES
+tskm_wakeup.xml:$(WAKESHUTCONF_DIR)/tskm_wakeup.xml
+ ln -fs $< $@
+
+tskm_shutdown.xml:$(WAKESHUTCONF_DIR)/tskm_shutdown.xml
+ ln -fs $< $@
+
+tskm_wakeup_vup.xml:$(WAKESHUTCONF_DIR)/tskm_wakeup_vup.xml
+ ln -fs $< $@
+
+tskm_shutdown_vup.xml:$(WAKESHUTCONF_DIR)/tskm_shutdown_vup.xml
+ ln -fs $< $@
+
+#tskm_svcid.h:$(SVCONF_DIR)/tskm_svcid.h
+# ln -fs $< $@
+
+agl_thread.h:$(WAKESHUTCONF_DIR)/agl_thread.h
+ ln -fs $< $@
+
+
+tskm_launch.xml:$(WAKESHUTCONF_DIR)/tskm_launch.xml agl_thread.h
+ $(HOST_CPP) -P -include agl_thread.h $< > $@
+#tskm_launch.xml:$(SVCONF_DIR)/tskm_launch.xml $(SDKTARGETSYSROOT)/usr/agl/include/agl_thread.h
+# $(HOST_CPP) -P -include agl_thread.h $< > $@
+
+$(XMLOUTFILE):top.xml $(PARSEXMLCMD) $(CONFIG_FILES)
+ $(XMLCHECKER) $(XMLCHECKEROPT) $<
+ ./$(PARSEXMLCMD) $<
+
+$(PARSEXMLCMD):$(PARSEXMLCMD).c
+ $(HOSTCC) -o $@ $< -lexpat
+
+include ../../../system_service.mk
+
diff --git a/systemservice/task_manager/client/libtskmcfg/conf/agl_thread.h b/systemservice/task_manager/client/libtskmcfg/conf/agl_thread.h
new file mode 100755
index 0000000..83ac087
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/conf/agl_thread.h
@@ -0,0 +1,1377 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ */
+
+#ifndef __AGL_THREAD_H__
+#define __AGL_THREAD_H__
+
+//MACRO
+#define PR_TSS_S "0"
+#define PR_TSS 0
+
+/*
+ Main thread name. It need to be same as service name in sm_launch.xml or tskm_launch.xml
+ Max name length is 15
+ #define MN_XXXXX "MainName"
+
+ Thread name
+ Max name length is 15
+ #define TN_XXXXX "ThreadName"
+
+ Thread priority 0:TSS 1-99:FIFO
+ #define PR_XXXXX_S "(0-99)" //for xml
+ #define PR_XXXXX 0-99 //for program
+*/
+
+#define MN_SS_SYSMANAGER "SS_SysManager"
+#define PR_SS_SYSMANAGER_S "20"
+#define PR_SS_SYSMANAGER (20)
+
+ #define TN_SMHEARTBEAT "SM.Heartbeat"
+ #define PR_SMHEARTBEAT_S "20"
+ #define PR_SMHEARTBEAT (20)
+
+ #define TN_SMPROCLAUNCH "SM.ProcLaunch"
+ #define PR_SMPROCLAUNCH_S "20"
+ #define PR_SMPROCLAUNCH (20)
+
+ #define TN_SMLOWMEMMON "SM.LowMemMon"
+ #define PR_SMLOWMEMMON_S "20"
+ #define PR_SMLOWMEMMON (20)
+
+ #define TN_LOGGERRTIME "LoggerRtime"
+ #define PR_LOGGERRTIME_S PR_TSS_S
+ #define PR_LOGGERRTIME PR_TSS
+
+
+//======= exec from system manager =============
+#define MN_NS_SHAREDMEM "NS_SharedMem"
+#define PR_NS_SHAREDMEM_S "25"
+#define PR_NS_SHAREDMEM (25)
+
+
+#define MN_NS_NPPSERVICE "NS_NPPService"
+#define PR_NS_NPPSERVICE_S "25"
+#define PR_NS_NPPSERVICE (25)
+
+ #define TN_NS_NPPREADWKR "NS_NPPReadWkr"
+ #define PR_NS_NPPREADWKR_S "25"
+ #define PR_NS_NPPREADWKR (25)
+
+ #define TN_NS_NPPWRITEWKR "NS_NPPWriteWkr"
+ #define PR_NS_NPPWRITEWKR_S "25"
+ #define PR_NS_NPPWRITEWKR (25)
+
+ #define TN_NS_NPPIPWKR "NS_NPPIPWkr"
+ #define PR_NS_NPPIPWKR_S "25"
+ #define PR_NS_NPPIPWKR (25)
+
+#define MN_NS_BACKUPMGR "NS_BackupMgr"
+#define PR_NS_BACKUPMGR_S "25"
+#define PR_NS_BACKUPMGR (25)
+
+ #define TN_NS_BKUPNAND "NS_BkupNAND"
+ #define PR_NS_BKUPNAND_S "25"
+ #define PR_NS_BKUPNAND (25)
+
+ #define TN_NS_BKUPDELAY "NS_BkupDelay"
+ #define PR_NS_BKUPDELAY_S "25"
+ #define PR_NS_BKUPDELAY (25)
+
+#define MN_SS_DEVDETECTSRV "SS_DevDetectSrv"
+#define PR_SS_DEVDETECTSRV_S "20"
+#define PR_SS_DEVDETECTSRV (20)
+
+ #define TN_SS_DETECT_USB "SS_Detect_USB"
+ #define PR_SS_DETECT_USB_S "20"
+ #define PR_SS_DETECT_USB (20)
+
+ #define TN_SS_DETECT_SD "SS_Detect_SD"
+ #define PR_SS_DETECT_SD_S "20"
+ #define PR_SS_DETECT_SD (20)
+
+ #define TN_SS_MONITOR_OVC "SS_Monitor_OVC"
+ #define PR_SS_MONITOR_OVC_S "20"
+ #define PR_SS_MONITOR_OVC (20)
+
+#define MN_SS_LOGGERSRV "SS_LoggerSrv"
+#define PR_SS_LOGGERSRV_S PR_TSS_S
+#define PR_SS_LOGGERSRV PR_TSS
+
+ #define TN_PDGLOGQUER "pdg.LogQueR"
+ #define PR_PDGLOGQUER_S PR_TSS_S
+ #define PR_PDGLOGQUER PR_TSS
+
+ #define TN_PDGTRANSQUER "pdg.TransQueR"
+ #define PR_PDGTRANSQUER_S PR_TSS_S
+ #define PR_PDGTRANSQUER PR_TSS
+
+ #define TN_PDGEVNTLOGQUE "pdg.EvntLogQue"
+ #define PR_PDGEVNTLOGQUE_S PR_TSS_S
+ #define PR_PDGEVNTLOGQUE PR_TSS
+
+ #define TN_SSLOGGERSTRAGE "SSLoggerStrage"
+ #define PR_SSLOGGERSTRAGE_S PR_TSS_S
+ #define PR_SSLOGGERSTRAGE PR_TSS
+
+ #define TN_PFDRECTHREAD "PFDRECThread"
+ #define PR_PFDRECTHREAD_S PR_TSS_S
+ #define PR_PFDRECTHREAD PR_TSS
+
+#define MN_PS_LOGGERSHADOW "PS_LoggerShadow"
+ #define PR_PSLOGGERSHADOW_S PR_TSS_S
+ #define PR_PSLOGGERSHADOW PR_TSS
+
+#define MN_UDEVD "udevd"
+#define PR_UDEVD_S "1"
+#define PR_UDEVD (1)
+
+#define MN_COMMUNICATION "Communication"
+#define PR_COMMUNICATION_S "30"
+#define PR_COMMUNICATION (30)
+
+ #define TN_DEV_SYSCOM_TMR "DEV_SYSCOM_TMR"
+ #define PR_DEV_SYSCOM_TMR_S "30"
+ #define PR_DEV_SYSCOM_TMR (30)
+
+ #define TN_DEV_SYSCOM_RCV "DEV_SYSCOM_RCV"
+ #define PR_DEV_SYSCOM_RCV_S "30"
+ #define PR_DEV_SYSCOM_RCV (30)
+
+ #define TN_DEV_SYSCOM_MAIN "DEV_SYSCOM_MAIN"
+ #define PR_DEV_SYSCOM_MAIN_S "30"
+ #define PR_DEV_SYSCOM_MAIN (30)
+
+ #define TN_TGWCOM "TGWCOM"
+ #define PR_TGWCOM_S "30"
+ #define PR_TGWCOM (30)
+
+ #define TN_ICM "ICM"
+ #define PR_ICM_S "30"
+ #define PR_ICM (30)
+
+ #define TN_CAN_COM_PROT "CAN_COM_PROT"
+ #define PR_CAN_COM_PROT_S "30"
+ #define PR_CAN_COM_PROT (30)
+
+#define MN_PS_PSMSHADOW "PS_PSMShadow"
+#define PR_PS_PSMSHADOW_S "30"
+#define PR_PS_PSMSHADOW (30)
+
+#define MN_COMMSH4A "CommSH4A"
+#define PR_COMMSH4A_S "30"
+#define PR_COMMSH4A (30)
+
+ #define TN_DEV_SH4A_SND "DEV_SH4ACOM_SND"
+ #define PR_DEV_SH4A_SND_S "30"
+ #define PR_DEV_SH4A_SND (30)
+
+ #define TN_DEV_SH4A_RCV "DEV_SH4ACOM_RCV"
+ #define PR_DEV_SH4A_RCV_S "30"
+ #define PR_DEV_SH4A_RCV (30)
+
+ #define TN_DEV_SH4A_MON "DEV_SH4ACOM_MON"
+ #define PR_DEV_SH4A_MON_S "30"
+ #define PR_DEV_SH4A_MON (30)
+
+#define MN_PS_COMMUSB "PS_CommUSB"
+#define PR_PS_COMMUSB_S "30"
+#define PR_PS_COMMUSB (30)
+
+ #define TN_COMMUSB_RCV "COMMUSB_RCV"
+ #define PR_COMMUSB_RCV_S "30"
+ #define PR_COMMUSB_RCV (30)
+
+ #define TN_COMMUSB_DIAG "COMMUSB_DIAG"
+ #define PR_COMMUSB_DIAG_S "30"
+ #define PR_COMMUSB_DIAG (30)
+
+#define MN_PS_CANGW_M "CANGW_M"
+#define PR_PS_CANGW_M_S PR_TSS_S
+#define PR_PS_CANGW_M PR_TSS
+
+ #define TN_CANGW_M_RCV "CANGW_M_RCV"
+ #define PR_CANGW_M_RCV_S PR_TSS_S
+ #define PR_CANGW_M_RCV PR_TSS
+
+ #define TN_CANGW_M_DIAG "CANGW_M_DIAG"
+ #define PR_CANGW_M_DIAG_S PR_TSS_S
+ #define PR_CANGW_M_DIAG PR_TSS
+
+#define MN_PS_CANGW_S "CANGW_S"
+#define PR_PS_CANGW_S_S PR_TSS_S
+#define PR_PS_CANGW_S PR_TSS
+
+ #define TN_CANGW_S_SND "CANGW_S_SND"
+ #define PR_CANGW_S_SND_S PR_TSS_S
+ #define PR_CANGW_S_SND PR_TSS
+
+ #define TN_CANGW_S_DIAG "CANGW_S_DIAG"
+ #define PR_CANGW_S_DIAG_S PR_TSS_S
+ #define PR_CANGW_S_DIAG PR_TSS
+
+#define MN_LANSERVER "LanServer"
+#define PR_LANSERVER_S "20"
+#define PR_LANSERVER (20)
+
+#define MN_PS_CDR "ps_cdr"
+#define PR_PS_CDR_S PR_TSS_S
+#define PR_PS_CDR PR_TSS
+
+ #define TN_PS_CDR_NBD "ps_cdr_nbd"
+ #define PR_PS_CDR_NBD_S PR_TSS_S
+ #define PR_PS_CDR_NBD PR_TSS
+
+ #define TN_PS_CDR_DOIT "ps_cdr_doit"
+ #define PR_PS_CDR_DOIT_S PR_TSS_S
+ #define PR_PS_CDR_DOIT PR_TSS
+
+ #define TN_PS_CDR_READ "ps_cdr_read"
+ #define PR_PS_CDR_READ_S PR_TSS_S
+ #define PR_PS_CDR_READ PR_TSS
+
+#define MN_POSITIONING "Positioning"
+#define PR_POSITIONING_S PR_TSS_S
+#define PR_POSITIONING PR_TSS
+
+ #define TN_POSITIONING_GPS_MAIN "POS_Main"
+ #define PR_POSITIONING_GPS_MAIN_S PR_TSS_S
+ #define PR_POSITIONING_GPS_MAIN PR_TSS
+
+ #define TN_POSITIONING_GPS_RECV "POS_Gps_Recv"
+ #define PR_POSITIONING_GPS_RECV_S PR_TSS_S
+ #define PR_POSITIONING_GPS_RECV PR_TSS
+
+ #define TN_POSITIONING_GPS "POS_Gps"
+ #define PR_POSITIONING_GPS_S PR_TSS_S
+ #define PR_POSITIONING_GPS PR_TSS
+
+ #define TN_POSITIONING_SENS "POS_Sens"
+ #define PR_POSITIONING_SENS_S PR_TSS_S
+ #define PR_POSITIONING_SENS PR_TSS
+
+ #define TN_POSITIONING_GPS_ROLOVR "POS_Gps_Rolovr"
+ #define PR_POSITIONING_GPS_ROLOVR_S PR_TSS_S
+ #define PR_POSITIONING_GPS_ROLOVR PR_TSS
+
+#define MN_CLOCK "clock"
+#define PR_CLOCK_S "20"
+#define PR_CLOCK (20)
+
+ #define TN_CLOCK_MNG "ClockMng"
+ #define PR_CLOCK_MNG_S "20"
+ #define PR_CLOCK_MNG (20)
+
+#define MN_VEHICLE "vehicle"
+#define PR_VEHICLE_S "20"
+#define PR_VEHICLE (20)
+
+ #define TN_VEHICLE_SENS "VehicleSens"
+ #define PR_VEHICLE_SENS_S "20"
+ #define PR_VEHICLE_SENS (20)
+
+ #define TN_LINE_SENS_DRV "LineSensDrv"
+ #define PR_LINE_SENS_DRV_S "20"
+ #define PR_LINE_SENS_DRV (20)
+
+#define MN_SS_POWERSERVICE "SS_PowerService"
+#define PR_SS_POWERSERVICE_S "30"
+#define PR_SS_POWERSERVICE (30)
+
+#define MN_SS_TASKMANAGER "SS_TaskManager"
+#define PR_SS_TASKMANAGER_S "20"
+#define PR_SS_TASKMANAGER (20)
+
+ #define TN_SS_TSKMTIMER "SS_TskmTimer"
+ #define PR_SS_TSKMTIMER_S "20"
+ #define PR_SS_TSKMTIMER (20)
+
+#define MN_SOUND "Sound"
+#define PR_SOUND_S "45"
+#define PR_SOUND (45)
+
+ #define TN_VG_SNDSRCMGR "VG_SNDSRCMGR"
+ #define PR_VG_SNDSRCMGR_S "40"
+ #define PR_VG_SNDSRCMGR (40)
+
+ #define TN_SND_INPUTCTRL "SND_INPUTCTRL"
+ #define PR_SND_INPUTCTRL_S "40"
+ #define PR_SND_INPUTCTRL (40)
+
+ #define TN_SND_DEVCTRL "SND_DEVCTRL"
+ #define PR_SND_DEVCTRL_S "40"
+ #define PR_SND_DEVCTRL (40)
+
+ #define TN_SND_VCETRFCTRL "SND_VCETRFCTRL"
+ #define PR_SND_VCETRFCTRL_S "45"
+ #define PR_SND_VCETRFCTRL (45)
+
+ #define TN_SND_VCETRFWRT1 "SND_VCETRFWRT1"
+ #define PR_SND_VCETRFWRT1_S "45"
+ #define PR_SND_VCETRFWRT1 (45)
+
+ #define TN_SND_VCETRFWRT2 "SND_VCETRFWRT2"
+ #define PR_SND_VCETRFWRT2_S "45"
+ #define PR_SND_VCETRFWRT2 (45)
+
+ #define TN_VG_SNDCTRL_BSCF "VG_SNDCTRL_BSCF"
+ #define PR_VG_SNDCTRL_BSCF_S "25"
+ #define PR_VG_SNDCTRL_BSCF (25)
+
+ #define TN_VG_SNDCTRL_BSCR "VG_SNDCTRL_BSCR"
+ #define PR_VG_SNDCTRL_BSCR_S "25"
+ #define PR_VG_SNDCTRL_BSCR (25)
+
+ #define TN_VG_SNDCTRL_ITRT "VG_SNDCTRL_ITRT"
+ #define PR_VG_SNDCTRL_ITRT_S "25"
+ #define PR_VG_SNDCTRL_ITRT (25)
+
+ #define TN_CVRS_OPRT_OUT_1 "CVRS_OPRT_OUT_1"
+ #define PR_CVRS_OPRT_OUT_1_S "45"
+ #define PR_CVRS_OPRT_OUT_1 (45)
+
+ #define TN_CVRS_OPRT_OUT_2 "CVRS_OPRT_OUT_2"
+ #define PR_CVRS_OPRT_OUT_2_S "45"
+ #define PR_CVRS_OPRT_OUT_2 (45)
+
+ #define TN_CVRS_OPRT_OUT_3 "CVRS_OPRT_OUT_3"
+ #define PR_CVRS_OPRT_OUT_3_S "45"
+ #define PR_CVRS_OPRT_OUT_3 (45)
+
+ #define TN_CVRS_OPRT_OUT_4 "CVRS_OPRT_OUT_4"
+ #define PR_CVRS_OPRT_OUT_4_S "45"
+ #define PR_CVRS_OPRT_OUT_4 (45)
+
+ #define TN_CVRS_OPRT_IN_1 "CVRS_OPRT_IN_1"
+ #define PR_CVRS_OPRT_IN_1_S "45"
+ #define PR_CVRS_OPRT_IN_1 (45)
+
+ #define TN_CVRS_OPRT_IN_2 "CVRS_OPRT_IN_2"
+ #define PR_CVRS_OPRT_IN_2_S "45"
+ #define PR_CVRS_OPRT_IN_2 (45)
+
+ #define TN_CVRS_OPRT_IN_3 "CVRS_OPRT_IN_3"
+ #define PR_CVRS_OPRT_IN_3_S "45"
+ #define PR_CVRS_OPRT_IN_3 (45)
+
+ #define TN_CVRS_OPRT_IN_4 "CVRS_OPRT_IN_4"
+ #define PR_CVRS_OPRT_IN_4_S "45"
+ #define PR_CVRS_OPRT_IN_4 (45)
+
+ #define TN_CVRS_OPRT_IN_5 "CVRS_OPRT_IN_5"
+ #define PR_CVRS_OPRT_IN_5_S "45"
+ #define PR_CVRS_OPRT_IN_5 (45)
+
+ #define TN_CVRS_OPRT_IN_6 "CVRS_OPRT_IN_6"
+ #define PR_CVRS_OPRT_IN_6_S "45"
+ #define PR_CVRS_OPRT_IN_6 (45)
+
+ #define TN_CVRS_OPRT_IN_7 "CVRS_OPRT_IN_7"
+ #define PR_CVRS_OPRT_IN_7_S "45"
+ #define PR_CVRS_OPRT_IN_7 (45)
+
+ #define TN_CVRS_OPRT_IN_8 "CVRS_OPRT_IN_8"
+ #define PR_CVRS_OPRT_IN_8_S "45"
+ #define PR_CVRS_OPRT_IN_8 (45)
+
+ #define TN_CVRS_OPRT_BS_I "CVRS_OPRT_BS_I"
+ #define PR_CVRS_OPRT_BS_I_S "45"
+ #define PR_CVRS_OPRT_BS_I (45)
+
+ #define TN_VR_NVR_RECO "VR_NVR_RECO"
+ #define PR_VR_NVR_RECO_S "20"
+ #define PR_VR_NVR_RECO (20)
+
+ #define TN_SND_ECNR "SND_ECNR"
+ #define PR_SND_ECNR_S "40"
+ #define PR_SND_ECNR (40)
+
+ #define TN_SNDAGENT_000 "SNDAGENT_000"
+ #define PR_SNDAGENT_000_S "45"
+ #define PR_SNDAGENT_000 (45)
+
+ #define TN_SNDAGENT_001 "SNDAGENT_001"
+ #define PR_SNDAGENT_001_S "45"
+ #define PR_SNDAGENT_001 (45)
+
+ #define TN_SNDAGENT_002 "SNDAGENT_002"
+ #define PR_SNDAGENT_002_S "45"
+ #define PR_SNDAGENT_002 (45)
+
+ #define TN_SNDAGENT_003 "SNDAGENT_003"
+ #define PR_SNDAGENT_003_S "45"
+ #define PR_SNDAGENT_003 (45)
+
+ #define TN_SNDAGENT_004 "SNDAGENT_004"
+ #define PR_SNDAGENT_004_S "45"
+ #define PR_SNDAGENT_004 (45)
+
+ #define TN_SNDAGENT_005 "SNDAGENT_005"
+ #define PR_SNDAGENT_005_S "45"
+ #define PR_SNDAGENT_005 (45)
+
+ #define TN_SNDAGENT_006 "SNDAGENT_006"
+ #define PR_SNDAGENT_006_S "45"
+ #define PR_SNDAGENT_006 (45)
+
+ #define TN_SNDAGENT_007 "SNDAGENT_007"
+ #define PR_SNDAGENT_007_S "45"
+ #define PR_SNDAGENT_007 (45)
+
+ #define TN_SNDAGENT_008 "SNDAGENT_008"
+ #define PR_SNDAGENT_008_S "45"
+ #define PR_SNDAGENT_008 (45)
+
+ #define TN_SNDAGENT_009 "SNDAGENT_009"
+ #define PR_SNDAGENT_009_S "45"
+ #define PR_SNDAGENT_009 (45)
+
+ #define TN_SNDAGENT_010 "SNDAGENT_010"
+ #define PR_SNDAGENT_010_S "45"
+ #define PR_SNDAGENT_010 (45)
+
+ #define TN_SNDAGENT_011 "SNDAGENT_011"
+ #define PR_SNDAGENT_011_S "45"
+ #define PR_SNDAGENT_011 (45)
+
+ #define TN_SNDAGENT_012 "SNDAGENT_012"
+ #define PR_SNDAGENT_012_S "45"
+ #define PR_SNDAGENT_012 (45)
+
+ #define TN_SNDAGENT_013 "SNDAGENT_013"
+ #define PR_SNDAGENT_013_S "45"
+ #define PR_SNDAGENT_013 (45)
+
+ #define TN_SNDAGENT_014 "SNDAGENT_014"
+ #define PR_SNDAGENT_014_S "45"
+ #define PR_SNDAGENT_014 (45)
+
+ #define TN_SNDAGENT_015 "SNDAGENT_015"
+ #define PR_SNDAGENT_015_S "45"
+ #define PR_SNDAGENT_015 (45)
+
+ #define TN_SNDAGENT_016 "SNDAGENT_016"
+ #define PR_SNDAGENT_016_S "45"
+ #define PR_SNDAGENT_016 (45)
+
+ #define TN_SNDAGENT_017 "SNDAGENT_017"
+ #define PR_SNDAGENT_017_S "45"
+ #define PR_SNDAGENT_017 (45)
+
+ #define TN_SNDAGENT_018 "SNDAGENT_018"
+ #define PR_SNDAGENT_018_S "45"
+ #define PR_SNDAGENT_018 (45)
+
+ #define TN_SNDAGENT_019 "SNDAGENT_019"
+ #define PR_SNDAGENT_019_S "45"
+ #define PR_SNDAGENT_019 (45)
+
+ #define TN_SNDAGENT_020 "SNDAGENT_020"
+ #define PR_SNDAGENT_020_S "45"
+ #define PR_SNDAGENT_020 (45)
+
+ #define TN_SNDAGENT_021 "SNDAGENT_021"
+ #define PR_SNDAGENT_021_S "45"
+ #define PR_SNDAGENT_021 (45)
+
+ #define TN_SNDAGENT_022 "SNDAGENT_022"
+ #define PR_SNDAGENT_022_S "45"
+ #define PR_SNDAGENT_022 (45)
+
+ #define TN_SNDAGENT_023 "SNDAGENT_023"
+ #define PR_SNDAGENT_023_S "45"
+ #define PR_SNDAGENT_023 (45)
+
+ #define TN_SNDAGENT_024 "SNDAGENT_024"
+ #define PR_SNDAGENT_024_S "45"
+ #define PR_SNDAGENT_024 (45)
+
+ #define TN_SNDAGENT_025 "SNDAGENT_025"
+ #define PR_SNDAGENT_025_S "45"
+ #define PR_SNDAGENT_025 (45)
+
+#define MN_SS_RESOURCEMGR "SS_ResourceMgr"
+#define PR_SS_RESOURCEMGR_S "49"
+#define PR_SS_RESOURCEMGR (49)
+
+ #define TN_RESOURCEHWDT "ResourceHWDT"
+ #define PR_RESOURCEHWDT_S "1"
+ #define PR_RESOURCEHWDT (1)
+
+#define MN_AS_AUDIOMANAGER "AS_AudioManager"
+#define PR_AS_AUDIOMANAGER_S PR_TSS_S
+#define PR_AS_AUDIOMANAGER PR_TSS
+
+ #define TN_AS_SOUNDBEEP "AS_SoundBeep"
+ #define PR_AS_SOUNDBEEP_S PR_TSS_S
+ #define PR_AS_SOUNDBEEP PR_TSS
+
+#define MN_GRAPHICS "Graphics"
+#define PR_GRAPHICS_S "4"
+#define PR_GRAPHICS (4)
+
+ #define TN_GR_MAIN_CTRL "Graphics_main"
+ #define PR_GR_MAIN_CTRL_S PR_TSS_S
+ #define PR_GR_MAIN_CTRL PR_TSS
+
+ #define TN_GR_SEQ_CTRL "Graphics_seq"
+ #define PR_GR_SEQ_CTRL_S PR_TSS_S
+ #define PR_GR_SEQ_CTRL PR_TSS
+
+ #define TN_GR_DEV_RCV_CTRL "Graphics_rcv"
+ #define PR_GR_DEV_RCV_CTRL_S PR_TSS_S
+ #define PR_GR_DEV_RCV_CTRL PR_TSS
+
+ #define TN_GR_VCAP1_CTRL "Graphics_cap1"
+ #define PR_GR_VCAP1_CTRL_S "4"
+ #define PR_GR_VCAP1_CTRL (4)
+
+ #define TN_GR_VCAP2_CTRL "Graphics_cap2"
+ #define PR_GR_VCAP2_CTRL_S "4"
+ #define PR_GR_VCAP2_CTRL (4)
+
+#define MN_VUPSERVICE "vupservice"
+#define PR_VUPSERVICE_S PR_TSS_S
+#define PR_VUPSERVICE PR_TSS
+
+#define MN_SS_UPDATESERVICE "UpdateService"
+#define PR_SS_UPDATESERVICE_S PR_TSS_S
+#define PR_SS_UPDATESERVICE PR_TSS
+
+ #define TN_UPSERVICE_VERI "t_update_veri"
+ #define PR_UPSERVICE_VERI_S PR_TSS_S
+ #define PR_UPSERVICE_VERI PR_TSS
+
+#define MN_NW_MICSERVICE "NW_MicService"
+#define PR_NW_MICSERVICE_S PR_TSS_S
+#define PR_NW_MICSERVICE PR_TSS
+
+#define MN_NS_LOCKMGR "LockMgr"
+#define PR_NS_LOCKMGR_S PR_TSS_S
+#define PR_NS_LOCKMGR PR_TSS
+
+#define MN_PS_SWITCHHANDLER "SwitchHandler"
+#define PR_PS_SWITCHHANDLER_S "30"
+#define PR_PS_SWITCHHANDLER (30)
+
+#define MN_SS_WINSYS "SS_WinSys"
+#define PR_SS_WINSYS_S "5"
+#define PR_SS_WINSYS 5
+
+#define MN_MODEMANAGER "modemanager"
+#define PR_MODEMANAGER_S PR_TSS_S
+#define PR_MODEMANAGER PR_TSS
+
+#define MN_BTSTACKMAIN "btstackmain"
+#define PR_BTSTACKMAIN_S PR_TSS_S
+#define PR_BTSTACKMAIN PR_TSS
+
+#define MN_MEDIASERVICE "MediaService"
+#define PR_MEDIASERVICE_S PR_TSS_S
+#define PR_MEDIASERVICE PR_TSS
+
+// REPRO START
+#define MN_REPROSERVICE "ReproService"
+#define PR_REPROSERVICE_S PR_TSS_S
+#define PR_REPROSERVICE PR_TSS
+
+ #define TN_REPROSEQUENCER "RPRS_Sequencer"
+ #define PR_REPROSEQUENCER_S PR_TSS_S
+ #define PR_REPROSEQUENCER PR_TSS
+
+ #define TN_REPROCTRL "RPRS_Control"
+ #define PR_REPROCTRL_S PR_TSS_S
+ #define PR_REPROCTRL PR_TSS
+
+ #define TN_REPROCENTERCOMM "RPRS_CenterComm"
+ #define PR_REPROCENTERCOMM_S PR_TSS_S
+ #define PR_REPROCENTERCOMM PR_TSS
+
+ #define TN_REPROUNITCOMM "RPRS_UnitComm"
+ #define PR_REPROUNITCOMM_S PR_TSS_S
+ #define PR_REPROUNITCOMM PR_TSS
+
+ #define TN_REPROWEBDAVMGR "RPRS_WebDAVMgr"
+ #define PR_REPROWEBDAVMGR_S PR_TSS_S
+ #define PR_REPROWEBDAVMGR PR_TSS
+
+#define MN_REPROAENDTEST "Repro_Testpro_Sender"
+#define PR_REPROAENDTEST_S PR_TSS_S
+#define PR_REPROAENDTEST PR_TSS
+
+ #define TN_REPROAENDTESTTN "Repro_TestproT"
+ #define PR_REPROAENDTESTTN_S PR_TSS_S
+ #define PR_REPROAENDTESTTN PR_TSS
+
+#define MN_REPROBACKVUP "BackVupCtrl"
+#define PR_REPROBACKVUP_S PR_TSS_S
+#define PR_REPROBACKVUP PR_TSS
+
+#define MN_REPRODEVELOP "DevReproService"
+#define PR_REPRODEVELOP_S PR_TSS_S
+#define PR_REPRODEVELOP PR_TSS
+// REPRO END
+
+ #define TN_MED_MMCOM_PLAY "mmcom_play"
+ #define PR_MED_MMCOM_PLAY_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAY PR_TSS
+
+ #define TN_MED_MMCOM_MEDIA "mmcom_media"
+ #define PR_MED_MMCOM_MEDIA_S PR_TSS_S
+ #define PR_MED_MMCOM_MEDIA PR_TSS
+
+ #define TN_MED_MMCOM_DB "mmcom_db"
+ #define PR_MED_MMCOM_DB_S PR_TSS_S
+ #define PR_MED_MMCOM_DB PR_TSS
+
+ #define TN_MED_MMCOM_LIST "mmcom_list"
+ #define PR_MED_MMCOM_LIST_S PR_TSS_S
+ #define PR_MED_MMCOM_LIST PR_TSS
+
+ #define TN_MED_MMCOM_DBUSB "mmcom_dbusb"
+ #define PR_MED_MMCOM_DBUSB_S PR_TSS_S
+ #define PR_MED_MMCOM_DBUSB PR_TSS
+
+ #define TN_MED_MMCOM_DBSD "mmcom_dbsd"
+ #define PR_MED_MMCOM_DBSD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBSD PR_TSS
+
+ #define TN_MED_MMCOM_DBCD "mmcom_dbcd"
+ #define PR_MED_MMCOM_DBCD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBCD PR_TSS
+
+ #define TN_MED_MMCOM_PLAYRCV "mmcom_playrcv"
+ #define PR_MED_MMCOM_PLAYRCV_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAYRCV PR_TSS
+
+ #define TN_MED_RIPCOM_MNG "MngRipComm"
+ #define PR_MED_RIPCOM_MNG_S PR_TSS_S
+ #define PR_MED_RIPCOM_MNG PR_TSS
+
+ #define TN_MED_RIPCOM_EXE01 "ExeRipComm01"
+ #define PR_MED_RIPCOM_EXE01_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE01 PR_TSS
+
+ #define TN_MED_RIPCOM_EXE02 "ExeRipComm02"
+ #define PR_MED_RIPCOM_EXE02_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE02 PR_TSS
+
+ #define TN_MED_DISCCOM_MAIN "disccom_main"
+ #define PR_MED_DISCCOM_MAIN_S PR_TSS_S
+ #define PR_MED_DISCCOM_MAIN PR_TSS
+
+ #define TN_MED_DISCCOM_DB "disccom_db"
+ #define PR_MED_DISCCOM_DB_S PR_TSS_S
+ #define PR_MED_DISCCOM_DB PR_TSS
+
+#define MN_PLAYBACKSERVICE "PlaybackService"
+#define PR_PLAYBACKSERVICE_S PR_TSS_S
+#define PR_PLAYBACKSERVICE PR_TSS
+
+ #define TN_PLAYSRV_AUDIO "playsrv_audio"
+ #define PR_PLAYSRV_AUDIO_S PR_TSS_S
+ #define PR_PLAYSRV_AUDIO PR_TSS
+
+ #define TN_PLAYSRV_RIP "playsrv_rip"
+ #define PR_PLAYSRV_RIP_S PR_TSS_S
+ #define PR_PLAYSRV_RIP PR_TSS
+
+ #define TN_PLAYSRV_PLAY "playsrv_play"
+ #define PR_PLAYSRV_PLAY_S PR_TSS_S
+ #define PR_PLAYSRV_PLAY PR_TSS
+
+ #define TN_PLAYSRV_DISC "playsrv_disc"
+ #define PR_PLAYSRV_DISC_S PR_TSS_S
+ #define PR_PLAYSRV_DISC PR_TSS
+
+ #define TN_PLAYSRV_ARTWORK "playsrv_artwork"
+ #define PR_PLAYSRV_ARTWORK_S PR_TSS_S
+ #define PR_PLAYSRV_ARTWORK PR_TSS
+
+#define MN_DISCSERVICE "DiscService"
+#define PR_DISCSERVICE_S PR_TSS_S
+#define PR_DISCSERVICE PR_TSS
+
+#define MN_RADIOSERVICE "RadioService"
+#define PR_RADIOSERVICE_S PR_TSS_S
+#define PR_RADIOSERVICE PR_TSS
+
+#define MN_RADIOHDARBITER "RadioHDArbiter"
+#define PR_RADIOHDARBITER_S "20"
+#define PR_RADIOHDARBITER (20)
+
+#define MN_HRDS_MANAGER "hrds_manager"
+#define PR_HRDS_MANAGER_S PR_TSS_S
+#define PR_HRDS_MANAGER PR_TSS
+
+ #define TN_HRDS_HDMNG "hrds_hdmng"
+ #define PR_HRDS_HDMNG_S PR_TSS_S
+ #define PR_HRDS_HDMNG PR_TSS
+
+ #define TN_HRDS_HDDEC "hrds_hddec"
+ #define PR_HRDS_HDDEC_S PR_TSS_S
+ #define PR_HRDS_HDDEC PR_TSS
+
+ #define TN_HRDS_WEBMNG "hrds_webmng"
+ #define PR_HRDS_WEBMNG_S PR_TSS_S
+ #define PR_HRDS_WEBMNG PR_TSS
+
+ #define TN_HRDS_WEBCOM "hrds_webcom"
+ #define PR_HRDS_WEBCOM_S PR_TSS_S
+ #define PR_HRDS_WEBCOM PR_TSS
+
+#define MN_BT_CONNECTIONSERVICE "BT_CnctSrv"
+#define PR_BT_CONNECTIONSERVICE_S PR_TSS_S
+#define PR_BT_CONNECTIONSERVICE PR_TSS
+
+#define MN_BT_PHONESERVICE "BT_PhoneSrv"
+#define PR_BT_PHONESERVICE_S PR_TSS_S
+#define PR_BT_PHONESERVICE PR_TSS
+
+#define MN_BT_PHONEBOOKSERVICE "BT_PbkSrv"
+#define PR_BT_PHONEBOOKSERVICE_S PR_TSS_S
+#define PR_BT_PHONEBOOKSERVICE PR_TSS
+
+#define MN_BT_MESSAGINGSERVICE "BT_MsgSrv"
+#define PR_BT_MESSAGINGSERVICE_S PR_TSS_S
+#define PR_BT_MESSAGINGSERVICE PR_TSS
+
+#define MN_BT_BLLSERVICE "TEL_BLLSrv"
+#define PR_BT_BLLSERVICE_S PR_TSS_S
+#define PR_BT_BLLSERVICE PR_TSS
+
+#define MN_BT_DCMPHONESERVICE "DCM_PhoneSrv"
+#define PR_BT_DCMPHONESERVICE_S PR_TSS_S
+#define PR_BT_DCMPHONESERVICE PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ1 "HFPMultiQ1"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1 PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ2 "HFPMultiQ2"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2 PR_TSS
+
+ #define TN_BT_PBKSRV_DATABASE "BTPB_Database"
+ #define PR_TN_BT_PBKSRV_DATABASE_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_DATABASE PR_TSS
+
+ #define TN_BT_PBKSRV_LOCALPBINST "LocalPBINST"
+ #define PR_TN_BT_PBKSRV_LOCALPBINST_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_LOCALPBINST PR_TSS
+
+ #define TN_BT_PBKSRV_RESOLVENAME "ResolveName"
+ #define PR_TN_BT_PBKSRV_RESOLVENAME_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_RESOLVENAME PR_TSS
+
+ #define TN_BT_PBKSRV_PBAPMULTIQ1 "PBAPMultiQ1"
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1 PR_TSS
+
+ #define TN_BT_PBKSRV_OPPMULTI "OPPMulti"
+ #define PR_TN_BT_PBKSRV_OPPMULTI_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_OPPMULTI PR_TSS
+
+ #define TN_BT_PBKSRV_VCARDPARSER "VCardParser"
+ #define PR_TN_BT_PBKSRV_VCARDPARSER_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_VCARDPARSER PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD0 "MsgCntrlThread0"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0 PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD1 "MsgCntrlThread1"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1 PR_TSS
+
+ #define TN_BT_MSGSRV_MAPMULTI "MapMulti"
+ #define PR_TN_BT_MSGSRV_MAPMULTI_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MAPMULTI PR_TSS
+
+#define MN_DTVSERVICE "DtvService"
+#define PR_DTVSERVICE_S PR_TSS_S
+#define PR_DTVSERVICE PR_TSS
+
+ #define TN_DTVTNC_TX "dtvtnc_tx"
+ #define PR_DTVTNC_TX_S PR_TSS_S
+ #define PR_DTVTNC_TX PR_TSS
+
+ #define TN_DTVTNC_RCV "dtvtnc_rcv"
+ #define PR_DTVTNC_RCV_S PR_TSS_S
+ #define PR_DTVTNC_RCV PR_TSS
+
+ #define TN_DTVTNC_TIMER "dtvtnc_timer"
+ #define PR_DTVTNC_TIMER_S PR_TSS_S
+ #define PR_DTVTNC_TIMER PR_TSS
+
+ #define TN_DTVTNC_CTL "dtvtnc_ctl"
+ #define PR_DTVTNC_CTL_S PR_TSS_S
+ #define PR_DTVTNC_CTL PR_TSS
+
+#define MN_DTVVUPSERVICE "DtvVupService"
+#define PR_DTVVUPSERVICE_S PR_TSS_S
+#define PR_DTVVUPSERVICE PR_TSS
+
+#define MN_SETTINGSERVICE "SettingService"
+#define PR_SETTINGSERVICE_S PR_TSS_S
+#define PR_SETTINGSERVICE PR_TSS
+
+#define MN_INFOSETTINGSRV "InfoSettingSrv"
+#define PR_INFOSETTINGSRV_S PR_TSS_S
+#define PR_INFOSETTINGSRV PR_TSS
+
+ #define TN_INFS_UIC "infs_uic"
+ #define PR_INFS_UIC_S PR_TSS_S
+ #define PR_INFS_UIC PR_TSS
+
+#define MN_DELPERSONALSRV "DelPersonalSrv"
+#define PR_DELPERSONALSRV_S PR_TSS_S
+#define PR_DELPERSONALSRV PR_TSS
+
+#define MN_MENUSERVICE "MenuService"
+#define PR_MENUSERVICE_S PR_TSS_S
+#define PR_MENUSERVICE PR_TSS
+
+#define MN_NAVIPROXY "NaviProxy"
+#define PR_NAVIPROXY_S PR_TSS_S
+#define PR_NAVIPROXY PR_TSS
+
+#define MN_AWBPROXY "AwbProxy"
+#define PR_AWBPROXY_S PR_TSS_S
+#define PR_AWBPROXY PR_TSS
+
+#define MN_TFFPROXY "TFFProxy"
+#define PR_TFFPROXY_S PR_TSS_S
+#define PR_TFFPROXY PR_TSS
+
+#define MN_TFFPROXYSLAVE "TFFProxySlave"
+#define PR_TFFPROXYSLAVE_S PR_TSS_S
+#define PR_TFFPROXYSLAVE PR_TSS
+
+#define MN_AWNPRIMARY "AwnPrimary"
+#define PR_AWNPRIMARY_S PR_TSS_S
+#define PR_AWNPRIMARY PR_TSS
+
+#define MN_AWBPRIMARY "AwbPrimary"
+#define PR_AWBPRIMARY_S PR_TSS_S
+#define PR_AWBPRIMARY PR_TSS
+
+#define MN_AWMPRIMARY "AwmPrimary"
+#define PR_AWMPRIMARY_S PR_TSS_S
+#define PR_AWMPRIMARY PR_TSS
+
+#define MN_AWTPRIMARY "AwtPrimary"
+#define PR_AWTPRIMARY_S PR_TSS_S
+#define PR_AWTPRIMARY PR_TSS
+
+#define MN_MISINKSERVICE "MisinkService"
+#define PR_MISINKSERVICE_S PR_TSS_S
+#define PR_MISINKSERVICE PR_TSS
+
+#define MN_TEXTCONVERTER "TextConverter"
+#define PR_TEXTCONVERTER_S PR_TSS_S
+#define PR_TEXTCONVERTER PR_TSS
+
+#define MN_HANDWRITING "HandWriting"
+#define PR_HANDWRITING_S PR_TSS_S
+#define PR_HANDWRITING PR_TSS
+
+#define MN_EXTUNITAUTH_D "EXTUNITAUTH_D"
+#define PR_EXTUNITAUTH_D_S "29"
+#define PR_EXTUNITAUTH_D 29
+
+ #define TN_VPSVC__CWORD84_ "VPSVC_D"
+ #define PR_VPSVC__CWORD84__S PR_TSS_S
+ #define PR_VPSVC__CWORD84_ PR_TSS
+
+#define MN_PROXYSERVICE "ProxyService"
+#define PR_PROXYSERVICE_S PR_TSS_S
+#define PR_PROXYSERVICE PR_TSS
+
+#define MN_FUELSERVICE "VS_FUCSrv"
+#define PR_FUELSERVICE_S PR_TSS_S
+#define PR_FUELSERVICE PR_TSS
+
+#define MN_ENERGYSERVICE "VS_ENMSrv"
+#define PR_ENERGYSERVICE_S PR_TSS_S
+#define PR_ENERGYSERVICE PR_TSS
+
+#define MN_CUSTOMIZESERVICE "VS_VSDSrv"
+#define PR_CUSTOMIZESERVICE_S PR_TSS_S
+#define PR_CUSTOMIZESERVICE PR_TSS
+
+#define MN_DMSSERVICE "VS_DMSSrv"
+#define PR_DMSSERVICE_S PR_TSS_S
+#define PR_DMSSERVICE PR_TSS
+
+#define MN_AIRCONSERVICE "VS_ACNSrv"
+#define PR_AIRCONSERVICE_S PR_TSS_S
+#define PR_AIRCONSERVICE PR_TSS
+
+#define MN_SEATSERVICE "VS_NMSSrv"
+#define PR_SEATSERVICE_S PR_TSS_S
+#define PR_SEATSERVICE PR_TSS
+
+#define MN_CAMERASERVICE "VS_CMRSrv"
+#define PR_CAMERASERVICE_S PR_TSS_S
+#define PR_CAMERASERVICE PR_TSS
+
+ #define TN_CAMERAQUICKRVC "QuickRVCThread"
+ #define PR_CAMERAQUICKRVC_S PR_TSS_S
+ #define PR_CAMERAQUICKRVC PR_TSS
+
+#define MN_METSERVICE "VS_METSrv"
+#define PR_METSERVICE_S PR_TSS_S
+#define PR_METSERVICE PR_TSS
+
+#define MN_TMCSERVICE "VS_TMCSrv"
+#define PR_TMCSERVICE_S PR_TSS_S
+#define PR_TMCSERVICE PR_TSS
+
+#define MN_DASSERVICE "VS_DASSrv"
+#define PR_DASSERVICE_S PR_TSS_S
+#define PR_DASSERVICE PR_TSS
+
+#define MN_EXTUNITAUTH_M "EXTUNITAUTH_M"
+#define PR_EXTUNITAUTH_M_S "29"
+#define PR_EXTUNITAUTH_M 29
+
+#define MN_DUMMYREAD "DummyRead"
+#define PR_DUMMYREAD_S PR_TSS_S
+#define PR_DUMMYREAD PR_TSS
+
+#define MN_SSTSERVICE "storage_access"
+#define PR_SSTSERVICE_S PR_TSS_S
+#define PR_SSTSERVICE PR_TSS
+
+#define MN_CCSAUDITD "ccs-auditd"
+#define PR_CCSAUDITD_S PR_TSS_S
+#define PR_CCSAUDITD PR_TSS
+
+//exec from task manager
+#define MN_ACTIVITYMANAGER "ActivityManager"
+#define PR_ACTIVITYMANAGER_S PR_TSS_S
+#define PR_ACTIVITYMANAGER PR_TSS
+
+#define MN_RESIDENT_SVC "RESIDENT_SVC"
+#define PR_RESIDENT_SVC_S PR_TSS_S
+#define PR_RESIDENT_SVC PR_TSS
+
+#define MN_TRANSIENT_SVC "TRANSIENT_SVC"
+#define PR_TRANSIENT_SVC_S PR_TSS_S
+#define PR_TRANSIENT_SVC PR_TSS
+
+#define MN_WLANSERVICE "wlan_ctrl_0700"
+#define PR_WLANSERVICE_S PR_TSS_S
+#define PR_WLANSERVICE PR_TSS
+
+#define MN_WLANEVTTHR "WlanEvtThr"
+#define PR_WLANEVTTHR_S PR_TSS_S
+#define PR_WLANEVTTHR PR_TSS
+
+#define MN_WLANMIDDLESERVICE "WlanMiddle"
+#define PR_WLANMIDDLESERVICE_S PR_TSS_S
+#define PR_WLANMIDDLESERVICE PR_TSS
+
+ #define TN_WLANMIDDLESERVICE0 "WM_MsgCtrlTh0"
+ #define PR_WLANMIDDLESERVICE0_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE0 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE1 "WM_MsgCtrlTh1"
+ #define PR_WLANMIDDLESERVICE1_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE1 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE2 "WM_MsgCtrlTh2"
+ #define PR_WLANMIDDLESERVICE2_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE2 PR_TSS
+
+#define MN_WLANSERVICE2 "wlan_ctrl_0701"
+#define PR_WLANSERVICE2_S PR_TSS_S
+#define PR_WLANSERVICE2 PR_TSS
+
+#define MN_WLANEVTTHR2 "WlanEvtThr2"
+#define PR_WLANEVTTHR2_S PR_TSS_S
+#define PR_WLANEVTTHR2 PR_TSS
+
+//exec from task manager, Test for vup
+#define MN_PS__CWORD52_VUP "_CWORD52_vup"
+#define PR_PS__CWORD52_VUP_S PR_TSS_S
+#define PR_PS__CWORD52_VUP PR_TSS
+
+#define MN_PS_SYSVUP "sysvup"
+#define PR_PS_SYSVUP_S PR_TSS_S
+#define PR_PS_SYSVUP PR_TSS
+
+#define MN_SS_ROOTFSVUP "rootfsvup"
+#define PR_SS_ROOTFSVUP_S PR_TSS_S
+#define PR_SS_ROOTFSVUP PR_TSS
+
+#define MN_SS_VUPPROGUI "vupprogressui"
+#define PR_SS_VUPPROGUI_S PR_TSS_S
+#define PR_SS_VUPPROGUI PR_TSS
+
+#define MN_SS_NORVUP "norvup"
+#define PR_SS_NORVUP_S PR_TSS_S
+#define PR_SS_NORVUP PR_TSS
+
+// OUTER_UPDATE START
+#define MN_XMVUPSERVICE "radio_xm_update"
+#define PR_XMVUPSERVICE_S PR_TSS_S
+#define PR_XMVUPSERVICE PR_TSS
+// OUTER_UPDATE END
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+// NON-resident, exec from task manager, Repro update
+#define MN_PS_SYSUPDATE "sysupdate"
+#define PR_PS_SYSUPDATE_S PR_TSS_S
+#define PR_PS_SYSUPDATE PR_TSS
+
+#define MN_SS_NANDUPDATE "nandupdate"
+#define PR_SS_NANDUPDATE_S PR_TSS_S
+#define PR_SS_NANDUPDATE PR_TSS
+
+ #define TN_NANDUPDATE_CLD "t_nandcld"
+ #define PR_NANDUPDATE_CLD_S PR_TSS_S
+ #define PR_NANDUPDATE_CLD PR_TSS
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+//exec from diag
+#define MN_DIAGSERVICE "DiagService"
+#define PR_DIAGSERVICE_S PR_TSS_S
+#define PR_DIAGSERVICE PR_TSS
+
+#define MN_DIAGWORKERTSK "diagworker_tsk"
+#define PR_DIAGWORKERTSK_S PR_TSS_S
+#define PR_DIAGWORKERTSK PR_TSS
+
+#define MN_DIAGTSK "diag_tsk"
+#define PR_DIAGTSK_S PR_TSS_S
+#define PR_DIAGTSK PR_TSS
+
+#define MN_DIAGMCTSK "diagmc_tsk"
+#define PR_DIAGMCTSK_S PR_TSS_S
+#define PR_DIAGMCTSK PR_TSS
+
+#define MN_DIAGUTCOL "diagutCol_tsk"
+#define PR_DIAGUTCOL_S PR_TSS_S
+#define PR_DIAGUTCOL PR_TSS
+
+#define MN_DIAGUTUPD "diagutUpd_tsk"
+#define PR_DIAGUTUPD_S PR_TSS_S
+#define PR_DIAGUTUPD PR_TSS
+
+//exec from Connectivity for _CWORD57_
+#define MN__CWORD57_UTILSERVICE "_CWORD57_UtilService"
+#define PR__CWORD57_UTILSERVICE_S PR_TSS_S
+#define PR__CWORD57_UTILSERVICE PR_TSS
+
+ #define TN_CON_IPUT_DETECT "iputsrv_detect"
+ #define PR_CON_IPUT_DETECT_S PR_TSS_S
+ #define PR_CON_IPUT_DETECT PR_TSS
+
+ #define TN_CON_IPUT_AUTH "iputsrv_auth"
+ #define PR_CON_IPUT_AUTH_S PR_TSS_S
+ #define PR_CON_IPUT_AUTH PR_TSS
+
+ #define TN_CON_IPUT_SERIAL "iputsrv_serial"
+ #define PR_CON_IPUT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPUT_SERIAL PR_TSS
+
+ #define TN_CON_IPUT_USB_1 "iputsrv_usb1"
+ #define PR_CON_IPUT_USB_1_S PR_TSS_S
+ #define PR_CON_IPUT_USB_1 PR_TSS
+
+ #define TN_CON_IPUT_USB_2 "iputsrv_usb2"
+ #define PR_CON_IPUT_USB_2_S PR_TSS_S
+ #define PR_CON_IPUT_USB_2 PR_TSS
+
+ #define TN_CON_IPUT_SPP "iputsrv_spp"
+ #define PR_CON_IPUT_SPP_S PR_TSS_S
+ #define PR_CON_IPUT_SPP PR_TSS
+
+#define MN__CWORD57_DTSERVICE "_CWORD57_DTService"
+#define PR__CWORD57_DTSERVICE_S PR_TSS_S
+#define PR__CWORD57_DTSERVICE PR_TSS
+
+ #define TN_CON_IPDT_SERIAL "ipdtsrv_serial"
+ #define PR_CON_IPDT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPDT_SERIAL PR_TSS
+
+ #define TN_CON_IPDT_USB_1 "ipdtsrv_usb1"
+ #define PR_CON_IPDT_USB_1_S PR_TSS_S
+ #define PR_CON_IPDT_USB_1 PR_TSS
+
+ #define TN_CON_IPDT_USB_2 "ipdtsrv_usb2"
+ #define PR_CON_IPDT_USB_2_S PR_TSS_S
+ #define PR_CON_IPDT_USB_2 PR_TSS
+
+ #define TN_CON_IPDT_SPP "ipdtsrv_spp"
+ #define PR_CON_IPDT_SPP_S PR_TSS_S
+ #define PR_CON_IPDT_SPP PR_TSS
+
+#define MN_WEBDAVMGR "webdavmgr"
+#define PR_WEBDAVMGR_S PR_TSS_S
+#define PR_WEBDAVMGR PR_TSS
+
+#define MN_DISPLAYSERVICE "DisplayService"
+#define PR_DISPLAYSERVICE_S PR_TSS_S
+#define PR_DISPLAYSERVICE PR_TSS
+
+#define MN_ENFORMSERVICE "EnformService"
+#define PR_ENFORMSERVICE_S PR_TSS_S
+#define PR_ENFORMSERVICE PR_TSS
+
+#define MN_CONNUTIL "ConnUtil"
+#define PR_CONNUTIL_S PR_TSS_S
+#define PR_CONNUTIL PR_TSS
+
+#define MN_CONNUTILSLAVE "ConnUtilSlave"
+#define PR_CONNUTILSLAVE_S PR_TSS_S
+#define PR_CONNUTILSLAVE PR_TSS
+
+#define MN_CONNMGR "ConnMgr"
+#define PR_CONNMGR_S PR_TSS_S
+#define PR_CONNMGR PR_TSS
+
+#define MN_SERVICEFLAGMGR "ServiceFlagMgr"
+#define PR_SERVICEFLAGMGR_S PR_TSS_S
+#define PR_SERVICEFLAGMGR PR_TSS
+
+//exec from VR
+#define MN_VRMANAGER "vrmanager"
+#define PR_VRMANAGER_S PR_TSS_S
+#define PR_VRMANAGER PR_TSS
+
+ #define TN_VR_WORKER "VrWorkerThread"
+ #define PR_VR_WORKER_S PR_TSS_S
+ #define PR_VR_WORKER PR_TSS
+
+ #define TN_VBT_PROPDISPATCH "PropDispatchThread"
+ #define PR_VBT_PROPDISPATCH_S PR_TSS_S
+ #define PR_VBT_PROPDISPATCH PR_TSS
+
+ #define TN_VBT_PROPRESPONSE "PropResponseThread"
+ #define PR_VBT_PROPRESPONSE_S PR_TSS_S
+ #define PR_VBT_PROPRESPONSE PR_TSS
+
+ #define TN_VBT_PROPAUDIOPLAY "PropAudioPlayThread"
+ #define PR_VBT_PROPAUDIOPLAY_S PR_TSS_S
+ #define PR_VBT_PROPAUDIOPLAY PR_TSS
+
+ #define TN_VBT_PROPAUDIORECORD "PropAudioRecordThread"
+ #define PR_VBT_PROPAUDIORECORD_S PR_TSS_S
+ #define PR_VBT_PROPAUDIORECORD PR_TSS
+
+ #define TN_VBT_MAINTHREADPRIO "MainThreadPriority"
+ #define PR_VBT_MAINTHREADPRIO_S PR_TSS_S
+ #define PR_VBT_MAINTHREADPRIO PR_TSS
+
+ #define TN_VBT_ASRMANAGERGRAMMAR "AsrManagerGrammarGenerationThread"
+ #define PR_VBT_ASRMANAGERGRAMMAR_S PR_TSS_S
+ #define PR_VBT_ASRMANAGERGRAMMAR PR_TSS
+
+ #define TN_VBT_ASRVOCONRECO "AsrVoconRecoProcessThread"
+ #define PR_VBT_ASRVOCONRECO_S PR_TSS_S
+ #define PR_VBT_ASRVOCONRECO PR_TSS
+
+ #define TN_VBT_BROADCASTREAD "BroadCastReadThread"
+ #define PR_VBT_BROADCASTREAD_S PR_TSS_S
+ #define PR_VBT_BROADCASTREAD PR_TSS
+
+ #define TN_VBT_FILEAGGREGATOR "FileAggregatorDecompressThread"
+ #define PR_VBT_FILEAGGREGATOR_S PR_TSS_S
+ #define PR_VBT_FILEAGGREGATOR PR_TSS
+
+ #define TN_VBT_HTTPCURLREQUEST "HttpCurlRequestThread"
+ #define PR_VBT_HTTPCURLREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPCURLREQUEST PR_TSS
+
+ #define TN_VBT_HTTPDRIVERREQUEST "HttpDriverRequestThread"
+ #define PR_VBT_HTTPDRIVERREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPDRIVERREQUEST PR_TSS
+
+ #define TN_VBT_HTTPREQUESTSESSION "HttpRequestSessionStateThread"
+ #define PR_VBT_HTTPREQUESTSESSION_S PR_TSS_S
+ #define PR_VBT_HTTPREQUESTSESSION PR_TSS
+
+ #define TN_VBT_PLAYMGRSTOPASYNC "PlayMgrStopAsyncStreamThread"
+ #define PR_VBT_PLAYMGRSTOPASYNC_S PR_TSS_S
+ #define PR_VBT_PLAYMGRSTOPASYNC PR_TSS
+
+ #define TN_VBT_RESOURCEMGRQUEUE "ResourceMgrQueueHandlerThread"
+ #define PR_VBT_RESOURCEMGRQUEUE_S PR_TSS_S
+ #define PR_VBT_RESOURCEMGRQUEUE PR_TSS
+
+ #define TN_VBT_SMURFDRIVERTIMEOUT "SmurfDriverTimeoutThread"
+ #define PR_VBT_SMURFDRIVERTIMEOUT_S PR_TSS_S
+ #define PR_VBT_SMURFDRIVERTIMEOUT PR_TSS
+
+ #define TN_NVR_NVRMAIN "NvrMainThread"
+ #define PR_NVR_NVRMAIN_S PR_TSS_S
+ #define PR_NVR_NVRMAIN PR_TSS
+
+ #define TN_NVR_NVRRECO "NvrRecoThread"
+ #define PR_NVR_NVRRECO_S PR_TSS_S
+ #define PR_NVR_NVRRECO PR_TSS
+
+ #define TN_NVR_NVRDICT "NvrDictThread"
+ #define PR_NVR_NVRDICT_S PR_TSS_S
+ #define PR_NVR_NVRDICT PR_TSS
+
+ #define TN_NVR_NVRENC "NvrEncThread"
+ #define PR_NVR_NVRENC_S PR_TSS_S
+ #define PR_NVR_NVRENC PR_TSS
+
+//exec from VehicleInfo
+#define MN_VEHICLEINFOSERVICE "VehicleInfoSrv"
+#define PR_VEHICLEINFOSERVICE_S PR_TSS_S
+#define PR_VEHICLEINFOSERVICE PR_TSS
+
+//exec from _CWORD76_
+#define MN__CWORD76_SERVICE "_CWORD76_Service"
+#define PR__CWORD76_SERVICE_S PR_TSS_S
+#define PR__CWORD76_SERVICE PR_TSS
+
+ #define TN_APPDOWNLOADER "AppDownloader"
+ #define PR_APPDOWNLOADER_S PR_TSS_S
+ #define PR_APPDOWNLOADER PR_TSS
+
+//exec from _CWORD76_(_CWORD58_)
+#define MN__CWORD58_SERVICE "_CWORD58_Service"
+#define PR__CWORD58_SERVICE_S PR_TSS_S
+#define PR__CWORD58_SERVICE PR_TSS
+
+#define MN__CWORD8_SRV "_CWORD8_Srv"
+#define PR__CWORD8_SRV_S PR_TSS_S
+#define PR__CWORD8_SRV PR_TSS
+
+#define MN_SPCSERVICE "SPCService"
+#define PR_SPCSERVICE_S PR_TSS_S
+#define PR_SPCSERVICE PR_TSS
+
+#define MN_LOCALSERVERPROXY "LSP"
+#define PR_LOCALSERVERPROXY_S PR_TSS_S
+#define PR_LOCALSERVERPROXY PR_TSS
+
+#define MN_EOMSERVICE "eOMService"
+#define PR_EOMSERVICE_S PR_TSS_S
+#define PR_EOMSERVICE PR_TSS
+
+//exec from NetworkManager
+#define MN_NETWORKMANAGER "NetworkManager"
+#define PR_NETWORKMANAGER_S PR_TSS_S
+#define PR_NETWORKMANAGER PR_TSS
+
+ #define TN_NWM_TH_CMDRCV "NWM_Th_CmdRcv"
+ #define PR_NWM_TH_CMDRCV_S PR_TSS_S
+ #define PR_NWM_TH_CMDRCV PR_TSS
+
+ #define TN_NWM_TH_PROCMGR "NWM_Th_ProcMgr"
+ #define PR_NWM_TH_PROCMGR_S PR_TSS_S
+ #define PR_NWM_TH_PROCMGR PR_TSS
+
+ #define TN_NWM_TH_CMDPROC "NWM_Th_CmdProc"
+ #define PR_NWM_TH_CMDPROC_S PR_TSS_S
+ #define PR_NWM_TH_CMDPROC PR_TSS
+
+ #define TN_NWM_TH_DNSMGR "NWM_Th_DnsMgr"
+ #define PR_NWM_TH_DNSMGR_S PR_TSS_S
+ #define PR_NWM_TH_DNSMGR PR_TSS
+
+ #define TN_NWM_TH_DHCPD "NWM_Th_Dhcpd"
+ #define PR_NWM_TH_DHCPD_S PR_TSS_S
+ #define PR_NWM_TH_DHCPD PR_TSS
+
+// DCM Service
+#define MN_DCMSERVICE "DCMService"
+#define PR_DCMSERVICE_S PR_TSS_S
+#define PR_DCMSERVICE PR_TSS
+
+ #define TN_DCM_TH_CMDRCV "DCM_Th_CmdRcv"
+ #define PR_DCM_TH_CMDRCV_S PR_TSS_S
+ #define PR_DCM_TH_CMDRCV PR_TSS
+
+ #define TN_DCM_TH_MSGRCV "DCM_Th_MsgRcv"
+ #define PR_DCM_TH_MSGRCV_S PR_TSS_S
+ #define PR_DCM_TH_MSGRCV PR_TSS
+
+ #define TN_DCM_TH_TIMER "DCM_Th_Timer"
+ #define PR_DCM_TH_TIMER_S PR_TSS_S
+ #define PR_DCM_TH_TIMER PR_TSS
+
+// HELP Service
+#define MN_HELPSERVICE "HELPService"
+#define PR_HELPSERVICE_S PR_TSS_S
+#define PR_HELPSERVICE PR_TSS
+
+//exec from RemoteService
+#define MN_REMOTESERVICE "RemoteService"
+#define PR_REMOTESERVICE_S PR_TSS_S
+#define PR_REMOTESERVICE PR_TSS
+
+ #define TN_RS_TH_CANCTRL "RS_Th_CANCtrl"
+ #define PR_RS_TH_CANCTRL_S PR_TSS_S
+ #define PR_RS_TH_CANCTRL PR_TSS
+
+ #define TN_RS_TH_DISPCTRL "RS_Th_DispCtrl"
+ #define PR_RS_TH_DISPCTRL_S PR_TSS_S
+ #define PR_RS_TH_DISPCTRL PR_TSS
+
+ #define TN_RS_TH_PARTSCTRL "RS_Th_PartsCtrl"
+ #define PR_RS_TH_PARTSCTRL_S PR_TSS_S
+ #define PR_RS_TH_PARTSCTRL PR_TSS
+
+ #define TN_RS_TH_HTTPPROC "RS_Th_HttpProc"
+ #define PR_RS_TH_HTTPPROC_S PR_TSS_S
+ #define PR_RS_TH_HTTPPROC PR_TSS
+
+//exec from VR
+#define MN_CONTENTSMGR "contentsmgr"
+#define PR_CONTENTSMGR_S PR_TSS_S
+#define PR_CONTENTSMGR PR_TSS
+
+ #define TN_CDB_CONTENDB "contendbThread"
+ #define PR_CDB_CONTENDB_S PR_TSS_S
+ #define PR_CDB_CONTENDB PR_TSS
+
+/* COMARB Service */
+#define MN_NW_COMARB "ComArbService"
+#define PR_NW_COMARB_S PR_TSS_S
+#define PR_NW_COMARB PR_TSS
+
+/* ASND_FRthread */
+#define MN_ASND_FRTH "ASND_FRthread"
+#define PR_ASND_FRTH_S PR_SND_VCETRFCTRL_S
+#define PR_ASND_FRTH PR_SND_VCETRFCTRL
+
+/* MLINK Service */
+#define MN_MLINKSERVICE "MlinkService"
+#define PR_MLINKSERVICE_S PR_TSS_S
+#define PR_MLINKSERVICE PR_TSS
+
+#define MN__CWORD74_SERVICE "_CWORD74_Service"
+#define PR__CWORD74_SERVICE_S PR_TSS_S
+#define PR__CWORD74_SERVICE PR_TSS
+#endif //__AGL_THREAD_H__
diff --git a/systemservice/task_manager/client/libtskmcfg/conf/tskm_launch.xml b/systemservice/task_manager/client/libtskmcfg/conf/tskm_launch.xml
new file mode 100755
index 0000000..d4ab06c
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/conf/tskm_launch.xml
@@ -0,0 +1,106 @@
+<service_list>
+ <service
+ svcid="TSKM_SVCID_ACTIVITYMGR"
+ name=MN_ACTIVITYMANAGER
+ path="/usr/agl/bin/acmsrv"
+ prio=PR_ACTIVITYMANAGER_S
+ policy="tss"
+ life_cycle="always"
+ user=""
+ shutdown_wait="yes" />
+
+ <service
+ svcid="TSKM_SVCID_TE_RESIDENT"
+ name=MN_RESIDENT_SVC
+ path="/usr/agl/bin/resident"
+ prio=PR_RESIDENT_SVC_S
+ policy="tss"
+ life_cycle="always"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_TE_TRANSIENT"
+ name =MN_TRANSIENT_SVC
+ path="/usr/agl/bin/transient"
+ prio=PR_TRANSIENT_SVC_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+
+ <service
+ svcid="TSKM_SVCID__CWORD58_"
+ name =MN__CWORD58_SERVICE
+ path="/usr/agl/bin/_CWORD58_Service"
+ prio=PR__CWORD58_SERVICE_S
+ policy="tss"
+ retry_cnt="-1"
+ user=""
+ shutdown_wait="yes" />
+
+ <service
+ svcid="TSKM_SVCID_SYSUPDATE"
+ name =MN_PS_SYSUPDATE
+ path="/usr/bin/sysupdate"
+ prio=PR_PS_SYSUPDATE_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_NANDUPDATE"
+ name =MN_SS_NANDUPDATE
+ path="/usr/bin/nandupdate"
+ prio=PR_SS_NANDUPDATE_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_XMVUPSRV"
+ name =MN_XMVUPSERVICE
+ path="/usr/agl/bin/radio_xm_update"
+ prio=PR_XMVUPSERVICE_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_BTPHONESRV"
+ name =MN_BTPHONESRV
+ path="/usr/agl/bin/BT_PhoneSrv"
+ prio=PR_BTPHONESRV_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_BTPBKSRV"
+ name =MN_BTPBKSRV
+ path="/usr/agl/bin/BT_PbkSrv"
+ prio=PR_BTPBKSRV_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_BTMSGSRV"
+ name =MN_BTMSGSRV
+ path="/usr/agl/bin/BT_MsgSrv"
+ prio=PR_BTMSGSRV_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_DTVVUPSRV"
+ name =MN_DTVVUPSERVICE
+ path="/usr/agl/bin/DtvVupService"
+ prio=PR_DTVVUPSERVICE_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+</service_list>
+
diff --git a/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml b/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml
new file mode 100755
index 0000000..4f724f7
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml
@@ -0,0 +1,11 @@
+<normal_shutdown>
+ <global_step>
+ <request_list>
+ <request svcid="TSKM_SVCID_TE_RESIDENT" local_step="last" />
+ <!-- <request svcid="TSKM_SVCID_ACTIVITYMGR" local_step="last" /> -->
+ </request_list>
+
+ <next_trans_condition cond="INI_TERMCOMP_TRANSIENT" />
+ </global_step>
+</normal_shutdown>
+
diff --git a/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml b/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml
new file mode 100755
index 0000000..71a30c8
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml
@@ -0,0 +1,6 @@
+<vup_shutdown>
+ <global_step>
+ <next_trans_condition cond="INI_TERMCOMP_TRANSIENT" />
+ </global_step>
+</vup_shutdown>
+
diff --git a/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml b/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml
new file mode 100755
index 0000000..aeb3548
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml
@@ -0,0 +1,8 @@
+<normal_wakeup>
+ <global_step>
+ <next_trans_condition cond="INI_INITCOMP_ON_START" />
+ </global_step>
+ <global_step>
+ <next_trans_condition cond="INI_INITCOMP_NVM_ACCESS" />
+ </global_step>
+</normal_wakeup>
diff --git a/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml b/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml
new file mode 100755
index 0000000..7162fdf
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml
@@ -0,0 +1,5 @@
+<vup_wakeup>
+ <global_step>
+ <next_trans_condition cond="INI_INITCOMP_NVM_ACCESS" />
+ </global_step>
+</vup_wakeup>
diff --git a/systemservice/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h b/systemservice/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h
new file mode 100755
index 0000000..c042fc8
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file task_manager_libtskmcfg.h
+ * @brief \~english This file include tskm_svcid.h file and tskm_xml_data.h file
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SYSTEMSERVICE_TASKMNAGERLIBTASKMCFG_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_TASKMNAGERLIBTASKMCFG_H_
+
+#include "system_service/tskm_svcid.h"
+#include "system_service/tskm_xml_data.h"
+
+#endif // SYSTEMSERVICE_TASKMNAGERLIBTASKMCFG_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.h b/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.h
new file mode 100755
index 0000000..d8f3e3d
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.h
@@ -0,0 +1,59 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_svcid.h
+ * @brief \~english This file contains declaration of TSKM_SVC ID
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+/*
+ * Service ID
+ */
+#ifndef TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_SVCID_H_
+#define TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_SVCID_H_
+
+
+#define TSKM_SVCID_NONE 0x00000000U
+#define TSKM_SVCID_TE_RESIDENT 0x00000001U // for test
+#define TSKM_SVCID_TE_TRANSIENT 0x00000002U // for test
+#define TSKM_SVCID_ACTIVITYMGR 0x00000003U
+#define TSKM_SVCID_SYSVUP 0x00000004U // for vup
+#define TSKM_SVCID__CWORD52_VUP 0x00000005U // for vup
+#define TSKM_SVCID_ROOTFSVUP 0x00000006U // for vup
+#define TSKM_SVCID_VUPPROGUI 0x00000007U // for vup
+#define TSKM_SVCID_NORVUP 0x00000008U // for vup
+#define TSKM_SVCID__CWORD58_ 0x00000009U // for _CWORD76_
+#define TSKM_SVCID_SYSUPDATE 0x0000000AU // for repro vup
+#define TSKM_SVCID_NANDUPDATE 0x0000000BU // for repro vup
+#define TSKM_SVCID_BTPHONESRV 0x0000000CU
+#define TSKM_SVCID_BTPBKSRV 0x0000000DU
+#define TSKM_SVCID_BTMSGSRV 0x0000000EU
+#define TSKM_SVCID_DTVVUPSRV 0x0000000FU // fot peaks vup
+#define TSKM_SVCID_XMVUPSRV 0x00000020U // fot XM_outer_update vup
+
+#endif // TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_SVCID_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h b/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h
new file mode 100755
index 0000000..0c8b75b
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h
@@ -0,0 +1,173 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_xml_data.h
+ * @brief \~english This file provide api to operating task manager with XML data
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_XML_DATA_H_
+#define TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_XML_DATA_H_
+
+#include "system_service/tskm_type.h"
+#include "system_service/tskm_svc.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_initServiceList
+ /// \~english @par Summary
+ /// init started services list
+ /// \~english @param [out] p_svcs
+ /// p_svcs - pointer of service list
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] iFd
+ /// iFd - the file descriptor return by inotify_init1().
+ /// \~english @par
+ /// p_svcs int
+ /// \~english @retval 0 Success
+ /// \~english @retval -1 Failed
+ /// \~english @par Preconditions
+ /// - called in the ctxCreate()
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - if srvId in serviceList greater than TSKM_SVC_ID_MAX_SIZE. [-1]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// Init started services list\n
+ /// Get the started services list from static variable serviceList and init by input parameter iFd\n
+ /// If envirment is NFS, change the path after /tmp to CAP path.\n
+ ///
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+int tskm_initServiceList(TSKM_SVCS_CTX_t* p_svcs, int iFd);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_initWakeupCtx
+ /// \~english @par Summary
+ /// Get state of started step.
+ /// \~english @param [out] p_wakeup
+ /// p_wakeup - pointer of TSKM_GSTEP_CTX_t
+ /// \~english @par
+ /// p_wakeup TSKM_GSTEP_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t gstepIdx; // step Index
+ /// uint32_t gstepNum; // number of step
+ /// TSKM_GSTEP_t* gstep; // step start/stop info
+ /// uint64_t compState;
+ /// } TSKM_GSTEP_CTX_t;
+ /// @endcode
+ /// \~english @param [in] isVupMode
+ /// isVupMode - version up flag
+ /// \~english @par
+ /// isVupMode BOOL
+ /// TRUE version up mode
+ /// FALSE not versoin up mode
+ /// \~english @retval void
+ ///
+ /// \~english @par Preconditions
+ /// - called in ctxCreate()
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// Get state of started step.\n
+ /// if version up mode is TRUE, retrun the wakeupGstepVup.\n
+ /// if version up mode is FALSE, return the wakeupGstep.\n
+ ///
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+void tskm_initWakeupCtx(TSKM_GSTEP_CTX_t* p_wakeup, BOOL isVupMode);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_initDownCtx
+ /// \~english @par Summary
+ /// Get state of down step.
+ /// \~english @param [out] p_down
+ /// p_down - pointer of TSKM_GSTEP_CTX_t
+ /// \~english @par
+ /// p_wakeup TSKM_GSTEP_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t gstepIdx; // step Index
+ /// uint32_t gstepNum; // number of step
+ /// TSKM_GSTEP_t* gstep; // step start/stop info
+ /// uint64_t compState;
+ /// } TSKM_GSTEP_CTX_t;
+ /// @endcode
+ /// \~english @param [in] isVupMode
+ /// isVupMode - version up mode flag
+ /// \~english @par
+ /// isVupMode BOOL
+ /// TRUE version up mode
+ /// FALSE not versoin up mode
+ /// \~english @retval
+ /// \~english @par Preconditions
+ /// - called in ctxCreate().
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// Get state of down step.\n
+ /// if version up mode is TRUE, retrun the downGstepVup.\n
+ /// if version up mode is FALSE, return the downGstep.\n
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+void tskm_initDownCtx(TSKM_GSTEP_CTX_t* p_down, BOOL isVupMode);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_XML_DATA_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/client/libtskmcfg/libtskmcfg.ver b/systemservice/task_manager/client/libtskmcfg/libtskmcfg.ver
new file mode 100755
index 0000000..c7bb97b
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/libtskmcfg.ver
@@ -0,0 +1,21 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ global:
+ tskm_init*;
+ local: *;
+};
diff --git a/systemservice/task_manager/client/libtskmcfg/src/parsexml.c b/systemservice/task_manager/client/libtskmcfg/src/parsexml.c
new file mode 100755
index 0000000..7cb3929
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/src/parsexml.c
@@ -0,0 +1,879 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <libgen.h>
+
+#include <expat.h>
+
+#define BUFSIZE 4096
+#define OUTFILE "tskm_auto_build.h"
+#define TMPFILE "parsexml.tmp"
+
+typedef uint32_t ELE_STATE_t;
+#define ELE_NONE 0x00000000U
+#define ELE_TSKM_CFG 0x10000000U
+#define ELE_SERVICE_LIST 0x11000000U
+#define ELE_SERVICE 0x11100000U
+#define ELE_SUBGID_LIST 0x11110000U
+
+#define ELE_COMMON_GSTEP 0x00100000U
+#define ELE_COMMON_EXEC 0x00010000U
+#define ELE_COMMON_REQ 0x00020000U
+
+#define ELE_NORMAL_WAKEUP 0x12000000U
+#define ELE_NORMAL_W_GSTEP (ELE_NORMAL_WAKEUP|ELE_COMMON_GSTEP)
+#define ELE_NORMAL_W_EXEC (ELE_NORMAL_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_EXEC)
+#define ELE_NORMAL_W_REQ (ELE_NORMAL_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_REQ)
+
+#define ELE_NORMAL_SHUTDOWN 0x13000000U
+#define ELE_NORMAL_D_GSTEP (ELE_NORMAL_SHUTDOWN|ELE_COMMON_GSTEP)
+#define ELE_NORMAL_D_REQ (ELE_NORMAL_SHUTDOWN|ELE_COMMON_GSTEP|ELE_COMMON_REQ)
+
+#define ELE_VUP_WAKEUP 0x14000000U
+#define ELE_VUP_W_GSTEP (ELE_VUP_WAKEUP|ELE_COMMON_GSTEP)
+#define ELE_VUP_W_EXEC (ELE_VUP_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_EXEC)
+#define ELE_VUP_W_REQ (ELE_VUP_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_REQ)
+
+#define ELE_VUP_SHUTDOWN 0x15000000U
+#define ELE_VUP_D_GSTEP (ELE_VUP_SHUTDOWN|ELE_COMMON_GSTEP)
+#define ELE_VUP_D_REQ (ELE_VUP_SHUTDOWN|ELE_COMMON_GSTEP|ELE_COMMON_REQ)
+
+
+#define ELE_MASK0 0xF0000000U
+#define ELE_MASK1 0x0F000000U
+#define ELE_MASK2 0x00F00000U
+#define ELE_MASK3 0x000F0000U
+
+#define PARSE_ASSERT_EXIT(x) \
+ if(!(x)){ \
+ printf("ASSERT %s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__); \
+ exit(-1); \
+ }
+
+#define VALUE_NAME_MAX 255
+typedef struct {
+ int step;
+ char gstepIdStr[VALUE_NAME_MAX];
+ int execSvcNum;
+ int reqNum;
+ char nextStepCondStr[VALUE_NAME_MAX];
+ char execSvcName[VALUE_NAME_MAX];
+ char reqTableName[VALUE_NAME_MAX];
+} PARSE_GSTEP_t;
+
+
+typedef struct {
+ char svcid[VALUE_NAME_MAX];
+ char name[VALUE_NAME_MAX];
+ char path[VALUE_NAME_MAX];
+ char type[VALUE_NAME_MAX];
+ char life_cycle[VALUE_NAME_MAX];
+ char retry_cnt[VALUE_NAME_MAX];
+ char cpu_assign[VALUE_NAME_MAX];
+ char prio[VALUE_NAME_MAX];
+ char policy[VALUE_NAME_MAX];
+ char user[VALUE_NAME_MAX];
+ char runtime_limit[VALUE_NAME_MAX];
+ char cpu_limit[VALUE_NAME_MAX];
+ char mem_limit[VALUE_NAME_MAX];
+ int subgidNum;
+ char args[VALUE_NAME_MAX];
+ char shutdown_wait[VALUE_NAME_MAX];
+} PARSE_SVC_t;
+
+/***************************************
+ * Context
+ **************************************/
+typedef struct {
+ FILE* fp; // Output file pointer
+ FILE* tmpFp; // Temporary file
+ ELE_STATE_t state;
+
+ PARSE_SVC_t svc;
+
+ int svcNum; // Number of services
+ PARSE_GSTEP_t gstep;
+} PARSE_CTX_t;
+
+
+/***************************************
+ * entryTskmCfg
+ **************************************/
+void
+entryTskmCfg(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+/***************************************
+ * exitTskmCfg
+ **************************************/
+void
+exitTskmCfg(PARSE_CTX_t* p_ctx) {
+ p_ctx->state = ELE_NONE;
+}
+
+
+/***************************************
+ * entryServiceList
+ **************************************/
+void
+entryServiceList(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_SERVICE_LIST;
+
+ p_ctx->tmpFp = fopen(TMPFILE,"w");
+
+ fprintf(p_ctx->tmpFp,
+ "static TSKM_SVC_ATTR_t serviceAttr[]={"
+ "\n");
+}
+
+/***************************************
+ * exitServiceList
+ **************************************/
+void
+exitServiceList(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->tmpFp,
+ "};"
+ "\n\n");
+
+ fprintf(p_ctx->tmpFp, "#define TSKM_SVC_NUM (%d) \n\n",p_ctx->svcNum);
+
+ fprintf(p_ctx->tmpFp, "static TSKM_SVC_CTX_t serviceList[TSKM_SVC_NUM]; \n\n");
+
+ fclose(p_ctx->tmpFp);
+
+ fprintf(p_ctx->fp,"\n\n");
+
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+/***************************************
+ * handleServiceList
+ **************************************/
+void
+entryService(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) {
+ PARSE_ASSERT_EXIT(strcmp(name,"service") == 0);
+ int ii;
+ char* tp;
+ p_ctx->state = ELE_SERVICE;
+
+ memset(&p_ctx->svc,0,sizeof(p_ctx->svc));
+
+ for(ii=0; atts[ii]; ii+=2) {
+ const char* attr = atts[ii];
+ const char* value = atts[ii+1];
+ if(strcmp(attr,"svcid")==0) {
+ strcpy(p_ctx->svc.svcid,value);
+ } else if(strcmp(attr,"name")==0) {
+ strcpy(p_ctx->svc.name,value);
+ } else if(strcmp(attr,"path")==0) {
+ strcpy(p_ctx->svc.path,value);
+ } else if(strcmp(attr,"type")==0) {
+ const char* typeName = (strcmp(value,"native")==0) ? "TSKM_SVC_TYPE_NATIVE" : "TSKM_SVC_TYPE_UNKNONW";
+ strcpy(p_ctx->svc.type,typeName);
+ } else if(strcmp(attr,"prio")==0) {
+ strcpy(p_ctx->svc.prio,value);
+ } else if(strcmp(attr,"policy")==0) {
+ const char* polName = (strcmp(value,"fifo")==0) ? "TSKM_SVC_POLICY_FIFO" :
+ (strcmp(value,"tss")==0) ? "TSKM_SVC_POLICY_TSS" :
+ (strcmp(value,"rr")==0) ? "TSKM_SVC_POLICY_RR" : "ERROR";
+ strcpy(p_ctx->svc.policy,polName);
+ } else if(strcmp(attr,"life_cycle")==0) {
+ const char* lcName = (strcmp(value,"always")==0) ? "TSKM_SVC_LC_ALWAYS" :
+ (strcmp(value,"always_recoverable")==0) ? "TSKM_SVC_LC_ALWAYS_RECOVERABLE" :
+ (strcmp(value,"dynamic")==0) ? "TSKM_SVC_LC_DYNAMIC" : "ERROR";
+ strcpy(p_ctx->svc.life_cycle,lcName);
+ } else if(strcmp(attr,"retry_cnt")==0) {
+ strcpy(p_ctx->svc.retry_cnt,value);
+ } else if(strcmp(attr,"cpu_assign")==0) {
+ const char* caName = (strcmp(value,"cpu0")==0) ? "TSKM_SVC_ASSIGN_CPU_0" :
+ (strcmp(value,"cpu1")==0) ? "TSKM_SVC_ASSIGN_CPU_1" :
+ (strcmp(value,"auto")==0) ? "TSKM_SVC_ASSIGN_CPU_AUTO" : "ERROR";
+ strcpy(p_ctx->svc.cpu_assign,caName);
+ } else if(strcmp(attr,"user")==0) {
+ strcpy(p_ctx->svc.user,value);
+ } else if(strcmp(attr,"runtime_limit")==0) {
+ strcpy(p_ctx->svc.runtime_limit,value);
+ } else if(strcmp(attr,"cpu_limit")==0) {
+ strcpy(p_ctx->svc.cpu_limit,value);
+ } else if(strcmp(attr,"mem_limit")==0) {
+ strcpy(p_ctx->svc.mem_limit,value);
+ } else if(strcmp(attr,"args")==0) {
+ strcpy(p_ctx->svc.args,value);
+ } else if(strcmp(attr,"shutdown_wait")==0) {
+ const char* swStr = (strcmp(value,"yes")==0) ? "TSKM_TRUE" :
+ (strcmp(value,"no")==0) ? "TSKM_FALSE" : "ERROR";
+ strcpy(p_ctx->svc.shutdown_wait,swStr);
+ }
+ }
+
+ fprintf(p_ctx->fp,"char const *svcArgs%d[] = {",p_ctx->svcNum);
+ fprintf(p_ctx->fp,"\"%s\",",p_ctx->svc.path);
+
+ // Output arguments
+ tp = strtok(p_ctx->svc.args," ");
+ while(tp != NULL) {
+ fprintf(p_ctx->fp,"\"%s\",",tp);
+ tp = strtok(NULL," ");
+ }
+
+ fprintf(p_ctx->fp,"NULL");
+ fprintf(p_ctx->fp,"};\n");
+}
+
+/***************************************
+ * exitService
+ **************************************/
+void
+exitService(PARSE_CTX_t* p_ctx) {
+ uint32_t ii;
+ fprintf(p_ctx->tmpFp,"{" );
+
+ fprintf(p_ctx->tmpFp,"%s",p_ctx->svc.svcid);
+ fprintf(p_ctx->tmpFp,", (const char *)\"%s\"",p_ctx->svc.name);
+ fprintf(p_ctx->tmpFp,", (const char *)\"%s\"",p_ctx->svc.path);
+ fprintf(p_ctx->tmpFp,", (char**)svcArgs%d",p_ctx->svcNum);
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.type);
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.prio);
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.policy);
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.life_cycle);
+ fprintf(p_ctx->tmpFp,", (uint32_t)%s",p_ctx->svc.retry_cnt);
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.cpu_assign);
+ fprintf(p_ctx->tmpFp,", (const char *)\"%s\"",p_ctx->svc.user);
+ fprintf(p_ctx->tmpFp,", %s",(p_ctx->svc.runtime_limit[0] != '\0') ? p_ctx->svc.runtime_limit : "0");
+ fprintf(p_ctx->tmpFp,", %s",(p_ctx->svc.cpu_limit[0] != '\0') ? p_ctx->svc.cpu_limit : "0");
+ fprintf(p_ctx->tmpFp,", %s",(p_ctx->svc.mem_limit[0] != '\0') ? p_ctx->svc.mem_limit : "0");
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.shutdown_wait);
+ fprintf(p_ctx->tmpFp,", %d",p_ctx->svc.subgidNum);
+ if(p_ctx->svc.subgidNum) {
+ fprintf(p_ctx->tmpFp,", subgidList%d",p_ctx->svcNum);
+ } else {
+ fprintf(p_ctx->tmpFp,", NULL");
+ }
+
+ fprintf(p_ctx->tmpFp,"},\n");
+
+ p_ctx->svcNum++;
+
+ p_ctx->state = ELE_SERVICE_LIST;
+}
+
+/***************************************
+ * entrySubgidList
+ **************************************/
+void
+entrySubgidList(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_SUBGID_LIST;
+
+ fprintf(p_ctx->fp,"static gid_t subgidList%d[] = {",p_ctx->svcNum);
+
+
+}
+
+/***************************************
+ * handleSubgidList
+ **************************************/
+void
+handleSubgidList(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) {
+ PARSE_ASSERT_EXIT(strcmp(name,"subgid") == 0);
+ int32_t ii;
+
+ if(p_ctx->svc.subgidNum > 0) {
+ fprintf(p_ctx->fp,",");
+ }
+ for(ii=0; atts[ii]; ii+=2) {
+ const char* attr = atts[ii];
+ const char* value = atts[ii+1];
+ if(strcmp(attr,"gid")==0) {
+ fprintf(p_ctx->fp,"%s",value);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+ }
+ p_ctx->svc.subgidNum++;
+}
+
+/***************************************
+ * exitSubgidList
+ **************************************/
+void
+exitSubgidList(PARSE_CTX_t* p_ctx) {
+
+ fprintf(p_ctx->fp,"};\n");
+
+ p_ctx->state = ELE_SERVICE;
+}
+
+
+/***************************************
+ * entryNormalWakeup
+ **************************************/
+void
+entryNormalWakeup(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_NORMAL_WAKEUP;
+ memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep));
+
+ sprintf(p_ctx->gstep.reqTableName,"wakeupReqList");
+ sprintf(p_ctx->gstep.execSvcName,"wakeupExecSvcId");
+ p_ctx->tmpFp = fopen(TMPFILE,"a");
+ PARSE_ASSERT_EXIT(p_ctx->tmpFp);
+
+ fprintf(p_ctx->tmpFp,"TSKM_GSTEP_t wakeupGstep[]={\n");
+}
+
+/***************************************
+ * exitNormalWakeup
+ **************************************/
+void
+exitNormalWakeup(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->tmpFp,"};\n\n");
+ fclose(p_ctx->tmpFp);
+
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+/***************************************
+ * entryVupWakeup
+ **************************************/
+void
+entryVupWakeup(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_VUP_WAKEUP;
+ memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep));
+
+ sprintf(p_ctx->gstep.reqTableName,"wakeupReqListVup");
+ sprintf(p_ctx->gstep.execSvcName,"wakeupExecSvcIdVup");
+ p_ctx->tmpFp = fopen(TMPFILE,"a");
+ PARSE_ASSERT_EXIT(p_ctx->tmpFp);
+
+ fprintf(p_ctx->tmpFp,"TSKM_GSTEP_t wakeupGstepVup[]={\n");
+}
+
+/***************************************
+ * exitVupWakeup
+ **************************************/
+void
+exitVupWakeup(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->tmpFp,"};\n\n");
+ fclose(p_ctx->tmpFp);
+
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+void
+entryGstep(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+
+ p_ctx->state &= ~ELE_MASK2;
+ p_ctx->state |= ELE_COMMON_GSTEP;
+
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+
+ if(atts[0] && strcmp(atts[0],"stepid") == 0) {
+ sprintf(p_gstep->gstepIdStr,"%s",atts[1]);
+ } else {
+ sprintf(p_gstep->gstepIdStr,"TSKM_GSTEP_NONE");
+ }
+ p_gstep->execSvcNum = 0;
+ p_gstep->reqNum = 0;
+ sprintf(p_gstep->nextStepCondStr,"INI_INITCOMP_NONE");
+}
+
+void
+handleGstep(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) {
+ PARSE_ASSERT_EXIT(strcmp(name,"next_trans_condition") == 0);
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+
+ if(atts[0] && strcmp(atts[0],"cond") == 0) {
+ sprintf(p_gstep->nextStepCondStr,"%s",atts[1]);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+}
+
+void
+exitGstep(PARSE_CTX_t* p_ctx) {
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+
+ fprintf(p_ctx->tmpFp,"{");
+ fprintf(p_ctx->tmpFp,"%s,",p_gstep->gstepIdStr);
+ fprintf(p_ctx->tmpFp,"%d,",p_gstep->execSvcNum);
+ if(p_gstep->execSvcNum) {
+ fprintf(p_ctx->tmpFp,"%s%d,",p_gstep->execSvcName,p_gstep->step);
+ } else {
+ fprintf(p_ctx->tmpFp,"NULL,");
+ }
+ fprintf(p_ctx->tmpFp,"%d,",p_gstep->reqNum);
+ if(p_gstep->reqNum) {
+ fprintf(p_ctx->tmpFp,"%s%d,",p_gstep->reqTableName,p_gstep->step);
+ } else {
+ fprintf(p_ctx->tmpFp,"NULL,");
+ }
+ fprintf(p_ctx->tmpFp,"%s",p_gstep->nextStepCondStr);
+ fprintf(p_ctx->tmpFp,"},\n");
+
+ p_gstep->step++;
+
+ p_ctx->state &= ~ELE_MASK2;
+}
+
+void
+entryExec(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state &= ~ELE_MASK3;
+ p_ctx->state |= ELE_COMMON_EXEC;
+
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+ fprintf(p_ctx->fp,
+ "static TSKM_SVCID_t %s%d[] = {",p_gstep->execSvcName,p_gstep->step);
+}
+void
+handleExec(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) {
+ PARSE_ASSERT_EXIT(strcmp(name,"exec_svc") == 0);
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+ int ii;
+
+ if(p_gstep->execSvcNum > 0) {
+ fprintf(p_ctx->fp,",");
+ }
+
+ for(ii=0; atts[ii]; ii+=2) {
+ const char* attr = atts[ii];
+ const char* value = atts[ii+1];
+ PARSE_ASSERT_EXIT(strcmp(attr,"svcid") == 0);
+ fprintf(p_ctx->fp,"%s",value);
+ }
+ p_gstep->execSvcNum++;
+}
+void
+exitExec(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->fp,"};\n\n");
+ p_ctx->state &= ~ELE_MASK3;
+}
+
+void
+entryReq(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state &= ~ELE_MASK3;
+ p_ctx->state |= ELE_COMMON_REQ;
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+
+ fprintf(p_ctx->fp,"static TSKM_GSTEP_REQ_INFO_t %s%d[] ={",p_gstep->reqTableName,p_gstep->step);
+}
+void
+handleReq(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) {
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+ PARSE_ASSERT_EXIT(strcmp(name,"request") == 0);
+ int ii;
+
+ fprintf(p_ctx->fp," {");
+
+ for(ii=0; atts[ii]; ii+=2) {
+ const char* attr = atts[ii];
+ const char* value = atts[ii+1];
+ if(strcmp(attr,"local_step") == 0) {
+ if(strcmp(value,"shm") == 0) {
+ fprintf(p_ctx->fp,"TSKM_LSTEP_SHM");
+ } else if(strcmp(value,"bupchk") == 0) {
+ fprintf(p_ctx->fp,"TSKM_LSTEP_BUPCHK");
+ } else if(strcmp(value,"last") == 0) {
+ fprintf(p_ctx->fp,"TSKM_LSTEP_LAST");
+ } else if(strcmp(value,"all") == 0) {
+ fprintf(p_ctx->fp,"TSKM_LSTEP_ALL");
+ } else {
+ fprintf(p_ctx->fp,"%s",value);
+ }
+ } else {
+ fprintf(p_ctx->fp,"%s",value); // Output of ","
+ }
+ fprintf(p_ctx->fp,"%s",(atts[ii+2])?",":""); // Outoput of ","
+ }
+ fprintf(p_ctx->fp,"},");
+ p_gstep->reqNum++;
+}
+void
+exitReq(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->fp,"};\n\n");
+ p_ctx->state &= ~ELE_MASK3;
+}
+
+/***************************************
+ * entryNormalShutdown
+ **************************************/
+void
+entryNormalShutdown(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_NORMAL_SHUTDOWN;
+
+ memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep));
+ sprintf(p_ctx->gstep.reqTableName,"downReqList");
+ p_ctx->tmpFp = fopen(TMPFILE,"a");
+ PARSE_ASSERT_EXIT(p_ctx->tmpFp);
+
+ fprintf(p_ctx->tmpFp,"static TSKM_GSTEP_t downGstep[]={\n");
+}
+
+/***************************************
+ * exitNormalShutdown
+ **************************************/
+void
+exitNormalShutdown(PARSE_CTX_t* p_ctx) {
+
+ fprintf(p_ctx->tmpFp,"};\n\n");
+ fclose(p_ctx->tmpFp);
+
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+/***************************************
+ * entryVupShutdown
+ **************************************/
+void
+entryVupShutdown(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_VUP_SHUTDOWN;
+ memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep));
+
+ sprintf(p_ctx->gstep.reqTableName,"downReqListVup");
+ p_ctx->tmpFp = fopen(TMPFILE,"a");
+ PARSE_ASSERT_EXIT(p_ctx->tmpFp);
+
+ fprintf(p_ctx->tmpFp,"static TSKM_GSTEP_t downGstepVup[]={\n");
+}
+
+/***************************************
+ * exitVupShutdown
+ **************************************/
+void
+exitVupShutdown(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->tmpFp,"};\n\n");
+ fclose(p_ctx->tmpFp);
+
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+/***************************************
+ * elementStart
+ **************************************/
+void
+elementStart(void *userData, const XML_Char *name, const XML_Char *atts[]) {
+ PARSE_CTX_t *p_ctx = (PARSE_CTX_t*)userData;
+#if 0
+ int ii;
+ printf("[ELEMENT] %s Start!\n", name);
+ for(ii=0; atts[ii]; ii+=2) {
+ printf(" %s:%s \n", atts[ii],atts[ii+1]);
+ }
+#endif
+ switch(p_ctx->state) {
+ case ELE_NONE:
+ if(strcmp(name,"tskm_cfg") == 0) {
+ entryTskmCfg(p_ctx,atts);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+ break;
+ case ELE_TSKM_CFG:
+ if(strcmp(name,"service_list") == 0) {
+ entryServiceList(p_ctx,atts);
+ } else if(strcmp(name,"normal_wakeup") == 0) {
+ entryNormalWakeup(p_ctx,atts);
+ } else if(strcmp(name,"normal_shutdown") == 0) {
+ entryNormalShutdown(p_ctx,atts);
+ } else if(strcmp(name,"vup_wakeup") == 0) {
+ entryVupWakeup(p_ctx,atts);
+ } else if(strcmp(name,"vup_shutdown") == 0) {
+ entryVupShutdown(p_ctx,atts);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+ break;
+ case ELE_SERVICE_LIST:
+ if(strcmp(name,"service") == 0) {
+ entryService(p_ctx,name,atts);
+ }
+ break;
+ case ELE_SERVICE:
+ if(strcmp(name,"subgid_list") == 0) {
+ entrySubgidList(p_ctx,atts);
+ }
+ break;
+ case ELE_SUBGID_LIST:
+ handleSubgidList(p_ctx,name,atts);
+ break;
+ case ELE_NORMAL_WAKEUP:
+ case ELE_NORMAL_SHUTDOWN:
+ case ELE_VUP_WAKEUP:
+ case ELE_VUP_SHUTDOWN:
+ if(strcmp(name,"global_step") == 0) {
+ entryGstep(p_ctx,atts);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+ break;
+ case ELE_NORMAL_W_GSTEP:
+ case ELE_NORMAL_D_GSTEP:
+ case ELE_VUP_W_GSTEP:
+ case ELE_VUP_D_GSTEP:
+ if(strcmp(name,"exec_list") == 0) {
+ entryExec(p_ctx,atts);
+ } else if(strcmp(name,"request_list") == 0) {
+ entryReq(p_ctx,atts);
+ } else {
+ handleGstep(p_ctx,name,atts);
+ }
+ break;
+ case ELE_NORMAL_W_EXEC:
+ case ELE_VUP_W_EXEC:
+ handleExec(p_ctx,name,atts);
+ break;
+ case ELE_NORMAL_W_REQ:
+ case ELE_NORMAL_D_REQ:
+ case ELE_VUP_W_REQ:
+ case ELE_VUP_D_REQ:
+ handleReq(p_ctx,name,atts);
+ break;
+ }
+}
+
+
+/***************************************
+ * elementEnd
+ **************************************/
+void
+elementEnd(void *userData, const XML_Char *name) {
+ PARSE_CTX_t *p_ctx = (PARSE_CTX_t*)userData;
+ switch(p_ctx->state) {
+ case ELE_NONE:
+ PARSE_ASSERT_EXIT(0);
+ break;
+ case ELE_TSKM_CFG:
+ if(strcmp(name,"tskm_cfg") == 0) {
+ exitTskmCfg(p_ctx);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+ break;
+ case ELE_SERVICE_LIST:
+ if(strcmp(name,"service_list") == 0) {
+ exitServiceList(p_ctx);
+ }
+ break;
+ case ELE_SERVICE:
+ if(strcmp(name,"service") == 0) {
+ exitService(p_ctx);
+ }
+ break;
+ case ELE_SUBGID_LIST:
+ if(strcmp(name,"subgid_list") == 0) {
+ exitSubgidList(p_ctx);
+ }
+ break;
+ case ELE_NORMAL_WAKEUP:
+ if(strcmp(name,"normal_wakeup") == 0) {
+ exitNormalWakeup(p_ctx);
+ }
+ break;
+ case ELE_NORMAL_SHUTDOWN:
+ if(strcmp(name,"normal_shutdown") == 0) {
+ exitNormalShutdown(p_ctx);
+ }
+ break;
+ case ELE_VUP_WAKEUP:
+ if(strcmp(name,"vup_wakeup") == 0) {
+ exitVupWakeup(p_ctx);
+ }
+ break;
+ case ELE_VUP_SHUTDOWN:
+ if(strcmp(name,"vup_shutdown") == 0) {
+ exitVupShutdown(p_ctx);
+ }
+ break;
+ case ELE_NORMAL_D_GSTEP:
+ case ELE_NORMAL_W_GSTEP:
+ case ELE_VUP_D_GSTEP:
+ case ELE_VUP_W_GSTEP:
+ if(strcmp(name,"global_step") == 0) {
+ exitGstep(p_ctx);
+ }
+ break;
+ case ELE_NORMAL_W_EXEC:
+ case ELE_VUP_W_EXEC:
+ if(strcmp(name,"exec_list") == 0) {
+ exitExec(p_ctx);
+ }
+ break;
+ case ELE_NORMAL_D_REQ:
+ case ELE_NORMAL_W_REQ:
+ case ELE_VUP_D_REQ:
+ case ELE_VUP_W_REQ:
+ if(strcmp(name,"request_list") == 0) {
+ exitReq(p_ctx);
+ }
+ break;
+ }
+}
+/***************************************
+ * parseXmlFile
+ **************************************/
+int
+parseXmlFile(const char* file,XML_Parser parser) {
+ int ret = -1;
+ FILE* fp = fopen(file, "r");
+ if (fp == NULL) {
+ goto ERROR;
+ }
+
+ while(1) {
+ char *buf = (char*) XML_GetBuffer(parser, BUFSIZE);
+ if (!buf) {
+ goto ERROR;
+ }
+
+ size_t nread = fread(buf, sizeof(char), BUFSIZE, fp);
+ if (ferror(fp)) {
+ goto ERROR;
+ }
+
+ if (!XML_ParseBuffer(parser, nread, feof(fp))) {
+ goto ERROR;
+ }
+
+ if (feof(fp)) {
+ break;
+ }
+ }
+ ret = 0;
+ERROR:
+ if(fp) {
+ fclose(fp);
+ }
+ return ret;
+}
+
+/***************************************
+ * externalHandler
+ **************************************/
+int
+externalHandler(XML_Parser parser,
+ const XML_Char* content, const XML_Char* base,
+ const XML_Char* systemId, const XML_Char* publicId) {
+ printf("parse %s \n",systemId);
+
+ int ret = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
+ XML_Parser extparser = NULL;
+
+ extparser = XML_ExternalEntityParserCreate(parser, content, NULL);
+ if(extparser ==NULL) {
+ goto ERROR;
+ }
+
+ if(parseXmlFile(systemId,extparser) != 0) {
+ goto ERROR;
+ }
+ ret = XML_STATUS_OK;
+ERROR:
+ if(extparser) {
+ XML_ParserFree(extparser);
+ }
+ return ret;
+}
+
+/***************************************
+ * usage
+ **************************************/
+void
+usage(const char* cmd) {
+ printf("usage:%s xmlfile\n",cmd);
+}
+
+/***************************************
+ * main
+ **************************************/
+int
+main (int argc, char *argv[]) {
+ struct stat statinfo;
+ int ret=-1;
+ int xmlRet;
+ const char* inpath;
+ char tmpstr1[255];
+ char tmpstr2[255];
+ const char* workdir;
+ const char* infile;
+ XML_Parser parser;
+ PARSE_CTX_t ctx;
+
+ if(argc < 2) {
+ usage(argv[0]);
+ goto ERROR;
+ }
+
+ inpath = argv[1];
+ if(0 != stat(inpath,&statinfo)) {
+ fprintf(stderr, "%s:%s",strerror(errno),inpath);
+ goto ERROR;
+ }
+ memset(&ctx,0,sizeof(ctx));
+
+ strcpy(tmpstr1,inpath);
+ strcpy(tmpstr2,inpath);
+ workdir=dirname(tmpstr1);
+ infile=basename(tmpstr2);
+
+ if(0 != chdir(workdir)) {
+ fprintf(stderr, "%s:%s",strerror(errno),workdir);
+ goto ERROR;
+ }
+
+ ctx.fp = fopen(OUTFILE, "w");
+ if (ctx.fp == NULL) {
+ goto ERROR;
+ }
+ fprintf(ctx.fp,"//This file is created automatically from %s.\n",inpath);
+ fprintf(ctx.fp,"//So you shall not modify this file immediately.\n");
+
+ /* create XML parser */
+ if ((parser = XML_ParserCreate(NULL)) == NULL) {
+ fprintf(stderr, "parser creation error\n");
+ goto ERROR;
+ }
+ XML_SetUserData(parser,&ctx);
+ XML_SetParamEntityParsing(parser,XML_PARAM_ENTITY_PARSING_ALWAYS); // Allow External Entities
+ XML_SetExternalEntityRefHandler(parser,externalHandler);
+ XML_SetElementHandler(parser, elementStart, elementEnd);
+
+ if(parseXmlFile(infile,parser) != 0) {
+ goto ERROR;
+ }
+ ret = 0;
+
+ERROR:
+ if(parser) {
+ XML_ParserFree(parser);
+ }
+ if(ctx.fp) {
+ fclose(ctx.fp);
+ }
+ char buf[255];
+ sprintf(buf,"cat %s >> %s",TMPFILE,OUTFILE);
+ printf("%s\n",buf);
+ system(buf);
+ unlink(TMPFILE);
+ return ret;
+}
+
diff --git a/systemservice/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp b/systemservice/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp
new file mode 100755
index 0000000..531b701
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp
@@ -0,0 +1,138 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "system_service/tskm_xml_data.h"
+
+#include <boost/algorithm/string.hpp>
+#include <fstream>
+#include <iostream>
+#include <string>
+#include <list>
+
+#include "system_service/tskm_svc.h"
+
+#include "system_service/tskm_svcid.h"
+#include "tskm_debug.h"
+#include "tskm_comm.h"
+#include "tskm_auto_build.h" // Generated data from XML
+
+// This size depends on the size of the TM area of CL_Monitor
+#define TSKM_SVC_ID_MAX_SIZE 1024
+
+/***********************************************************************
+ * tskm_initServiceList
+ ***********************************************************************/
+int tskm_initServiceList(TSKM_SVCS_CTX_t* p_svcs, int iFd) {
+ uint32_t ii;
+
+ p_svcs->svcNum = sizeof(serviceList) / sizeof(TSKM_SVC_CTX_t);
+ p_svcs->svcList = serviceList;
+
+ // It is initialized with the Inotify floppy disk.
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ serviceList[ii].attr = &serviceAttr[ii];
+ serviceList[ii].iFd = iFd;
+ if (serviceList[ii].attr->svcId >= TSKM_SVC_ID_MAX_SIZE) {
+ TSKM_ASSERT(0);
+ return -1;
+ }
+ }
+
+ const char* nfsenv = getenv("AGL_NFS");
+ bool isNfs = (nfsenv && strcmp(nfsenv, "y") == 0) ? true : false;
+
+ // For NFS environments, replace the PATH with CAP with /tmp
+ if (isNfs) {
+ std::list<std::string> capFiles;
+ const std::string capPath("/usr/debug/share/target/cap.lst");
+ std::ifstream fin(capPath.c_str());
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ std::list<std::string> strList;
+ try { // throw exception by boost::split
+ boost::split(strList, line, boost::is_any_of("|"));
+ if (!strList.empty()) {
+ if (strList.front()[0] == '/') { // Only character strings beginning with '/' are considered PATH
+ capFiles.push_back(strList.front().c_str());
+ }
+ }
+ } catch (...) {
+ TSKM_ASSERT(0);
+ }
+ }
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ std::string binPath(serviceList[ii].attr->path);
+
+ for (std::list<std::string>::iterator ite = capFiles.begin();
+ ite != capFiles.end(); ite++) {
+ if (binPath == *ite) {
+ std::list<std::string> nodes;
+ try { // throw exception by boost::split
+ boost::split(nodes, binPath, boost::is_any_of("/"));
+ std::string *p_newPath = new std::string("/tmp/"); // Intent not to free up memory
+ *p_newPath += nodes.back();
+ TSKM_PRINTF(TSKM_LOG_STATE, "EXCHG %s", p_newPath->c_str());
+ serviceList[ii].attr->path = p_newPath->c_str();
+ break;
+ } catch (...) {
+ TSKM_ASSERT(0);
+ }
+ }
+ }
+ }
+ }
+
+ // If there is no socket resource equal to the number of services + 1 (internal control connection), a compilation error occurs
+ TSKM_STATIC_ASSERT(TSKM_COMM_CONNECT_MAX >= (TSKM_SVC_NUM+1));
+
+ return 0;
+}
+
+/***********************************************************************
+ * tskm_initWakeupCtx
+ ***********************************************************************/
+void tskm_initWakeupCtx(TSKM_GSTEP_CTX_t* p_wakeup, BOOL isVupMode) {
+ memset(p_wakeup, 0, sizeof(*p_wakeup));
+
+ if (isVupMode) {
+ p_wakeup->gstepNum = sizeof(wakeupGstepVup) / sizeof(TSKM_GSTEP_t);
+ p_wakeup->gstep = wakeupGstepVup;
+ } else {
+ p_wakeup->gstepNum = sizeof(wakeupGstep) / sizeof(TSKM_GSTEP_t);
+ p_wakeup->gstep = wakeupGstep;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "gstep(wakeup):%d", p_wakeup->gstepNum);
+}
+
+/***********************************************************************
+ * tskm_initDownCtx
+ ***********************************************************************/
+void tskm_initDownCtx(TSKM_GSTEP_CTX_t* p_down, BOOL isVupMode) {
+ memset(p_down, 0, sizeof(*p_down));
+
+ if (isVupMode) {
+ p_down->gstepNum = sizeof(downGstepVup) / sizeof(TSKM_GSTEP_t);
+ p_down->gstep = downGstepVup;
+ } else {
+ p_down->gstepNum = sizeof(downGstep) / sizeof(TSKM_GSTEP_t);
+ p_down->gstep = downGstep;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "gstep(down):%d", p_down->gstepNum);
+}
+
diff --git a/systemservice/task_manager/client/libtskmcfg/tskm_cfg.xml b/systemservice/task_manager/client/libtskmcfg/tskm_cfg.xml
new file mode 100755
index 0000000..2898f44
--- /dev/null
+++ b/systemservice/task_manager/client/libtskmcfg/tskm_cfg.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" ?>
+
+<!DOCTYPE tskm_cfg [
+ <!ELEMENT tskm_cfg (service_list,normal_wakeup,normal_shutdown,vup_wakeup,vup_shutdown) >
+
+ <!-- service list -->
+ <!ELEMENT service_list (service+) >
+ <!ELEMENT service (subgid_list*) >
+ <!ATTLIST service
+ svcid ID #REQUIRED
+ name CDATA #REQUIRED
+ path CDATA #REQUIRED
+ type (native|unknown) "native"
+ prio CDATA #REQUIRED
+ policy (fifo|tss|rr) #REQUIRED
+ life_cycle (always|always_recoverable|dynamic) "dynamic"
+ retry_cnt CDATA "1"
+ cpu_assign (cpu0|cpu1|auto) "auto"
+ user CDATA #REQUIRED
+ runtime_limit CDATA #IMPLIED
+ cpu_limit CDATA #IMPLIED
+ mem_limit CDATA #IMPLIED
+ args CDATA #IMPLIED
+ shutdown_wait (yes|no) #REQUIRED
+ >
+
+ <!ELEMENT subgid_list (subgid+) >
+ <!ELEMENT subgid EMPTY >
+ <!ATTLIST subgid
+ gid CDATA #REQUIRED
+ >
+
+
+ <!-- Starting/terminating of services -->
+ <!ELEMENT normal_wakeup (global_step+) >
+ <!ELEMENT normal_shutdown (global_step+) >
+ <!ELEMENT vup_wakeup (global_step+) >
+ <!ELEMENT vup_shutdown (global_step+) >
+
+ <!ELEMENT global_step (exec_list?,request_list?,next_trans_condition?) >
+ <!ATTLIST global_step
+ stepid ID #IMPLIED
+ >
+
+ <!ELEMENT exec_list (exec_svc+) >
+ <!ELEMENT exec_svc EMPTY >
+
+ <!ATTLIST exec_svc
+ svcid IDREF #REQUIRED
+ >
+
+ <!ELEMENT request_list (request+) >
+ <!ELEMENT request EMPTY >
+ <!ATTLIST request
+ svcid IDREF #REQUIRED
+ local_step (shm|bupchk|1|2|3|4|5|6|7|8|9|last|all) #REQUIRED
+ >
+
+ <!ELEMENT next_trans_condition EMPTY>
+ <!ATTLIST next_trans_condition
+ cond CDATA #REQUIRED
+ >
+
+ <!ENTITY service_list_xml SYSTEM "tskm_launch.xml">
+ <!ENTITY normal_wakeup_xml SYSTEM "tskm_wakeup.xml">
+ <!ENTITY normal_shutdown_xml SYSTEM "tskm_shutdown.xml">
+ <!ENTITY vup_wakeup_xml SYSTEM "tskm_wakeup_vup.xml">
+ <!ENTITY vup_shutdown_xml SYSTEM "tskm_shutdown_vup.xml">
+]>
+
+
+<tskm_cfg>
+ &service_list_xml;
+
+ &normal_wakeup_xml;
+
+ &normal_shutdown_xml;
+
+ &vup_wakeup_xml;
+
+ &vup_shutdown_xml;
+
+</tskm_cfg>
diff --git a/systemservice/task_manager/client/ss_data_init/Makefile b/systemservice/task_manager/client/ss_data_init/Makefile
new file mode 100755
index 0000000..920fbea
--- /dev/null
+++ b/systemservice/task_manager/client/ss_data_init/Makefile
@@ -0,0 +1,43 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#######################################
+#######################################
+INST_SHLIBS := libss_data_init
+
+MKDATAINIT=mkdatainit.sh
+
+INST_HEADERS = tskm_data_init.h task_manager_libss_data_init.h
+
+VPATH = ./include/$(COMPONENT_NAME)
+CPPFLAGS += -I./include/ -I./../../server/include -I./../libtskmcfg/include
+
+libss_data_init_SRCS := tskm_data_init.cpp
+libss_data_init_PCOS := $(shell ls ./obj/*.os)
+
+$(libss_data_init_SRCS): $(libss_data_init_PCOS)
+ set -e ; \
+ sh $(MKDATAINIT)
+
+######## add compile option ########
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -fno-exceptions
+
+CLEAN_FILES=$(libss_data_init_SRCS)
+
+LDLIBS = -Wl,-Bdynamic -lNS_FrameworkUnified
+
+include ../../../system_service.mk
diff --git a/systemservice/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h b/systemservice/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h
new file mode 100755
index 0000000..39422e9
--- /dev/null
+++ b/systemservice/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_LIBSS_DATA_INIT_TASKMANAGERLOG_H_
+#define TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_LIBSS_DATA_INIT_TASKMANAGERLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10) // library common def
+#define ZONE_FUNC ZONEMASK(11) // library common def
+#define ZONE_MEM ZONEMASK(12) // library common def
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29) // library common def
+#define ZONE_WARN ZONEMASK(30) // library common def
+#define ZONE_ERR ZONEMASK(31) // library common def
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INFO
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams;
+
+#endif // TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_LIBSS_DATA_INIT_TASKMANAGERLOG_H_
diff --git a/systemservice/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h b/systemservice/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h
new file mode 100755
index 0000000..e3bdfc5
--- /dev/null
+++ b/systemservice/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english This file include tskm_data_init.h
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SYSTEMSERVICE_TASKMNAGERLIBSSDATAINIT_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_TASKMNAGERLIBSSDATAINIT_H_
+
+#include "system_service/tskm_data_init.h"
+
+#endif // SYSTEMSERVICE_TASKMNAGERLIBSSDATAINIT_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h b/systemservice/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h
new file mode 100755
index 0000000..8cb49d6
--- /dev/null
+++ b/systemservice/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * @file tskm_data_init.h
+ * @brief \~english This file contains API of initial task manager data
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_SYSTEM_SERVICE_TSKM_DATA_INIT_H_
+#define TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_SYSTEM_SERVICE_TSKM_DATA_INIT_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_if.h>
+#include "system_service/tskm_type.h"
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_GetExtBootInfo
+/// \~english @par Summary
+/// Gets boot extended information.
+/// \~english @param [in] p_info
+/// T_SS_SM_START_ExtDataStructType * - Boot extended information
+/// \~english @code
+/// typedef struct {
+/// BOOL isProgUpdated;
+/// EMRelaunchStatus relaunchStatus;
+/// BOOL isMapUpdated;
+/// BOOL isMapDiffUpdated;
+/// uint8_t reserved[];
+/// }T_SS_SM_START_ExtDataStructType;
+/// @endcode
+/// \~english @retval TSKM_E_OK Normal end
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions
+/// - None
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_info is NULL. [TSKM_E_PAR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail
+/// Is available only at the functions defined by using TSKM_DATA_INIT_FUNC.
+/// \~english @see TSKM_DATA_INIT_FUNC
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_DATA_INIT_FUNC
+/// \~english @par Summary
+/// Defines callback functions to initialize data.
+/// \~english @param [in] serviceName
+/// const char* - Service name
+/// \~english @param [in] argName
+/// const T_SS_SM_START_DataStructType* - Argument name
+/// \~english @code
+/// typedef struct T_SS_SM_START_DataStruct{
+/// EPWR_WAKEUP_FACTOR_TYPE startupReason;
+/// BOOL isUserModeOn;
+/// ESMDataResetModeInfo dataResetMode;
+/// EPWR_SC_SECURITY_STATUS securityStatus;
+/// EPWR_SC_WAKEUP_TYPE wakeupType;
+/// ESMDramBackupStatus dramBackupStatus;
+/// ESMResetStatus resetStatus;
+/// UI_32 resetCount;
+/// } T_SS_SM_START_DataStructType;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Normal
+/// \~english @retval eFrameworkunifiedStatusFail Check error
+/// \~english @par Preconditions
+/// - None
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - Return values depend on the mount of callback functions. [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Detail
+/// Defines the callback functions to initialize data. \n
+/// The callback functions defined by this macro are executed at a timing
+/// when boot factor is fixed after booting the system. \n
+/// (Task_Manager executes Callback prior to the boot of ActivityManager.)\n
+/// If each service mounts and installs initialization functions, Task_Manager boots it
+/// at a timing when data initialization is necessary. \n
+/// Each service can install the object file of initialization functions by setting them
+/// to MAKE variables INST_DATAINITOBJ of Makefile.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+#define TSKM_DATA_INIT_FUNC(ServiceName, ArgName) \
+ EFrameworkunifiedStatus tskm_ ## ServiceName ## _data_init(T_SS_SM_START_DataStructType* ArgName)
+
+#endif // TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_SYSTEM_SERVICE_TSKM_DATA_INIT_H_
+/** @}*/ // end of Task_Manager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/task_manager/client/ss_data_init/include/tskm_data_init_local.h b/systemservice/task_manager/client/ss_data_init/include/tskm_data_init_local.h
new file mode 100755
index 0000000..9d77d19
--- /dev/null
+++ b/systemservice/task_manager/client/ss_data_init/include/tskm_data_init_local.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_TSKM_DATA_INIT_LOCAL_H_
+#define TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_TSKM_DATA_INIT_LOCAL_H_
+
+#include "system_service/tskm_data_init.h"
+
+extern void tskm_dataInitAll(T_SS_SM_START_DataStructType *arg,
+ T_SS_SM_START_ExtDataStructType *extArg);
+
+#endif // TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_TSKM_DATA_INIT_LOCAL_H_
diff --git a/systemservice/task_manager/client/ss_data_init/mkdatainit.sh b/systemservice/task_manager/client/ss_data_init/mkdatainit.sh
new file mode 100755
index 0000000..802fbd9
--- /dev/null
+++ b/systemservice/task_manager/client/ss_data_init/mkdatainit.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+#
+# Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+cp tskm_data_init.cpp.in tskm_data_init.cpp.tmp
+
+LF=$(printf '\\\012_')
+LF=${LF%_}
+
+for files in `ls obj/*.os`
+do
+ serviceName=`nm -C $files | grep " T " | grep -o "tskm_[0-9a-zA-Z_]\+_data_init" | sed -e "s/^tskm_//" | sed -e "s/_data_init\$//"`
+
+ funcname="tskm_"$serviceName"_data_init"
+
+ echo $serviceName $funcname
+ sed -i "s/@DATA_INIT_PROT@/EFrameworkunifiedStatus $funcname(T_SS_SM_START_DataStructType* );$LF@DATA_INIT_PROT@/g" tskm_data_init.cpp.tmp
+ sed -i "s/@DATA_INIT_TABLE@/{\"$serviceName\", $funcname},$LF @DATA_INIT_TABLE@/g" tskm_data_init.cpp.tmp
+
+done
+
+sed -i "s/@DATA_INIT_PROT@//g" tskm_data_init.cpp.tmp
+sed "s/@DATA_INIT_TABLE@/{NULL , NULL},/g" tskm_data_init.cpp.tmp > tskm_data_init.cpp
+
+rm tskm_data_init.cpp.tmp
+
+
+
+
+
+
diff --git a/systemservice/task_manager/client/ss_data_init/tskm_data_init.cpp.in b/systemservice/task_manager/client/ss_data_init/tskm_data_init.cpp.in
new file mode 100755
index 0000000..072a486
--- /dev/null
+++ b/systemservice/task_manager/client/ss_data_init/tskm_data_init.cpp.in
@@ -0,0 +1,66 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <system_service/tskm_data_init.h>
+#include "stdio.h"
+#include "libss_data_init_taskmanagerlog.h"
+
+
+#define ZONE_INFO ZONEMASK(29)
+
+typedef struct{
+ const char *serviceName;
+ EFrameworkunifiedStatus (*dataInitFunc)(T_SS_SM_START_DataStructType *arg);
+} FUNC_INFO_t;
+
+@DATA_INIT_PROT@
+
+const FUNC_INFO_t g_funcTbl[] = {
+ @DATA_INIT_TABLE@
+};
+
+static T_SS_SM_START_ExtDataStructType extBootInfo;
+
+TSKM_ERR_t TSKM_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info){
+ TSKM_ERR_t ret = TSKM_E_OK;
+
+ if(NULL == p_info){
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__,"p_info = NULL");
+ ret = TSKM_E_PAR;
+ }else{
+ memcpy(p_info, &extBootInfo, sizeof(*p_info));
+ }
+
+ return ret;
+}
+
+void tskm_dataInitAll(T_SS_SM_START_DataStructType *arg, T_SS_SM_START_ExtDataStructType *extArg){
+ int i;
+ int itemNum = sizeof(g_funcTbl)/sizeof(FUNC_INFO_t) - 1;
+
+ memcpy(&extBootInfo, extArg, sizeof(extBootInfo));
+
+ // LCOV_EXCL_START 10: Depends on reference information when building software
+ for(i=0;i<itemNum;i++){
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO,__FUNCTION__,"call datainit for %s",g_funcTbl[i].serviceName);
+ g_funcTbl[i].dataInitFunc(arg);
+ }
+ // LCOV_EXCL_STOP
+
+ return;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
+
diff --git a/systemservice/task_manager/include-share/tskm_gstep.h b/systemservice/task_manager/include-share/tskm_gstep.h
new file mode 100755
index 0000000..e2af96d
--- /dev/null
+++ b/systemservice/task_manager/include-share/tskm_gstep.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_INCLUDE_SHARE_TSKM_GSTEP_H_
+#define TASK_MANAGER_INCLUDE_SHARE_TSKM_GSTEP_H_
+
+#include "system_service/tskm_local_type.h"
+#include "tskm_debug.h"
+
+/*********************************************************
+ * Get gradual startup current info
+ *********************************************************/
+inline TSKM_STATIC TSKM_BOOL_t gstepIsLast(TSKM_GSTEP_CTX_t* p_gstep) {
+ if (p_gstep->gstepNum == p_gstep->gstepIdx + 1) {
+ return TSKM_TRUE;
+ }
+ return TSKM_FALSE;
+}
+
+/*********************************************************
+ * Get gradual startup current info
+ *********************************************************/
+inline TSKM_STATIC TSKM_GSTEP_t*
+gstepGetCurrent(TSKM_GSTEP_CTX_t* p_gstep) {
+ if (p_gstep->gstepNum > p_gstep->gstepIdx) {
+ return &p_gstep->gstep[p_gstep->gstepIdx];
+ }
+ return NULL;
+}
+
+/*********************************************************
+ * Issue requests waiting for exec completion
+ *********************************************************/
+inline TSKM_STATIC TSKM_GSTEP_t*
+changeNextStep(TSKM_GSTEP_CTX_t* p_gstep) {
+ p_gstep->gstepIdx++;
+ return gstepGetCurrent(p_gstep);
+}
+
+#endif // TASK_MANAGER_INCLUDE_SHARE_TSKM_GSTEP_H_
+
diff --git a/systemservice/task_manager/include-share/tskm_type_local.h b/systemservice/task_manager/include-share/tskm_type_local.h
new file mode 100755
index 0000000..8ead34e
--- /dev/null
+++ b/systemservice/task_manager/include-share/tskm_type_local.h
@@ -0,0 +1,52 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_INCLUDE_SHARE_TSKM_TYPE_LOCAL_H_
+#define TASK_MANAGER_INCLUDE_SHARE_TSKM_TYPE_LOCAL_H_
+
+#define NTFY_SS_TaskManager_Availability SS_TASK_MANAGER"/Availability"
+
+//*******************************************************
+// Legacy types:
+// Definition is retained because it is referenced by another module
+//******************************************************
+
+// Shared LOG with version upgrade
+#define STATEMGR__CWORD69_LOG_SIZE 176 /* STATEMGR__CWORD69_LOG */
+typedef struct {
+ uint8_t old_Ver[8];
+ uint8_t new_Ver[8];
+} STATEMGR__CWORD69_LOG_VERSION_T;
+
+typedef struct {
+ STATEMGR__CWORD69_LOG_VERSION_T ver;
+ uint8_t status;
+ uint8_t dummy[3];
+} STATEMGR__CWORD69_LOG_VUPINFO_T;
+
+typedef struct {
+ uint32_t seqnum; /* Set value (for chequence check) */
+ uint32_t normalnum; /* Set value (for route check) */
+ uint32_t errornum; /* Set value (for NG check) */
+} STATEMGR__CWORD69_LOG_PROC;
+
+typedef struct {
+ STATEMGR__CWORD69_LOG_VUPINFO_T VerInfo[7]; /* Store version info */
+ STATEMGR__CWORD69_LOG_PROC proc[3]; /* Store logs for analysis */
+} STATEMGR__CWORD69_LOG;
+
+#endif // TASK_MANAGER_INCLUDE_SHARE_TSKM_TYPE_LOCAL_H_
+
diff --git a/systemservice/task_manager/include-share/tskm_util.h b/systemservice/task_manager/include-share/tskm_util.h
new file mode 100755
index 0000000..83665aa
--- /dev/null
+++ b/systemservice/task_manager/include-share/tskm_util.h
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_INCLUDE_SHARE_TSKM_UTIL_H_
+#define TASK_MANAGER_INCLUDE_SHARE_TSKM_UTIL_H_
+
+#include "system_service/tskm_local_type.h"
+#include "tskm_main.h"
+
+// inline MACRO
+#define TSKM_ERR_CHK(ret, expect, lavel) \
+ if (ret != expect) {TSKM_ASSERT(0); goto lavel;}
+
+#define TSKM_ERR_CHK_DFT TSKM_ERR_CHK(tskmRet, TSKM_E_OK, ERROR)
+
+#define TSKM_MAX(a, b) ((a) > (b) ? (a) : (b))
+
+#endif // TASK_MANAGER_INCLUDE_SHARE_TSKM_UTIL_H_
+
diff --git a/systemservice/task_manager/server/Makefile b/systemservice/task_manager/server/Makefile
new file mode 100755
index 0000000..7e7bfbd
--- /dev/null
+++ b/systemservice/task_manager/server/Makefile
@@ -0,0 +1,67 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+#######################################
+INST_PROGS = tskmgr
+
+######### add source path #############
+######### add local value #############
+VPATH = ./src ./../client/libtskm ./../client/libtskmcfg/include/$(COMPONENT_NAME)
+
+tskmgr_SRCS += tskm_main.cpp
+
+######### compiled sources #############
+tskmgr_SRCS += tskm_api.cpp \
+ tskm_state.cpp \
+ tskm_wakeup.cpp \
+ tskm_shutdown.cpp \
+ tskm_svc.cpp \
+ tskm_watch.cpp \
+ tskm_debug.cpp \
+ tskm_comm.cpp \
+ tskm_port_pf.cpp \
+ tskm_port_subsys.cpp \
+ tskm_srvr_stub.cpp
+
+
+
+######### add include path #############
+CPPFLAGS = -I./include/ -I./../include-share/ -I./../client/ss_data_init/include/ -I./../client/libtskmcfg/include/ -I./../client/libtskm/
+######### add compile option ###########
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+######### add library path #############
+LDFLAGS += -L./../client/ss_data_init -L./../client/libtskmcfg
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lrt # for mq_xxx
+LDLIBS += -Wl,-Bdynamic -lss_data_init
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lresm
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lvp
+LDLIBS += -Wl,-Bdynamic -lrpc -lev
+
+#LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI
+LDLIBS += -Wl,-Bdynamic -ltskmcfg
+
+
+LINK_CXX=Y
+
+include ../../system_service.mk
diff --git a/systemservice/task_manager/server/include/system_service/INI_API.h b/systemservice/task_manager/server/include/system_service/INI_API.h
new file mode 100755
index 0000000..871be5e
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/INI_API.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file INI_API.h
+ * @brief \~english This file include INI_API.hpp
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_INI_API_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_INI_API_H_
+
+#include "system_service/INI_API.hpp"
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_INI_API_H_
diff --git a/systemservice/task_manager/server/include/system_service/INI_API.hpp b/systemservice/task_manager/server/include/system_service/INI_API.hpp
new file mode 100755
index 0000000..00fe733
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/INI_API.hpp
@@ -0,0 +1,738 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file INI_API.hpp
+ * @brief \~english This file provide api to operating INI
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef _INI_API_HPP_
+#define _INI_API_HPP_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_if.h>
+#include "system_service/Primary_common.h"
+
+#define INI_SUCCESS 0 /* Normal */
+#define INI_FALSE -1 /* Failed */
+
+#define INI_FD_MAX 3
+
+// Only the information required for event completion notification is left
+// Gradual startup
+#define INI_INITCOMP_NONE 0x0000000000000000LLU
+#define INI_INITCOMP_ON_START 0x0000000000000001LLU /* ON_START */
+#define INI_INITCOMP_NVM_ACCESS 0x0000000000000002LLU /* NVM ACCESS */
+
+#define INI_INITCOMP_TEST0 0x1000000000000000LLU /* for test */
+#define INI_INITCOMP_TEST1 0x2000000000000000LLU /* for test */
+#define INI_INITCOMP_TEST2 0x4000000000000000LLU /* for test */
+#define INI_INITCOMP_TEST3 0x8000000000000000LLU /* for test */
+
+// Gradual termination
+#define INI_TERMCOMP_NONE 0x0000000000000000LLU
+#define INI_TERMCOMP_ACTIVITYMGR 0x0000000000000001LLU /* Terminate ActivityManager */
+#define INI_TERMCOMP_RESIDENT 0x0000000000000002LLU /* Terminate regident SVC */
+#define INI_TERMCOMP_TRANSIENT 0x0000000000000004LLU /* Terminate non-regident SVC */
+
+#define INI_TERMCOMP_TEST0 0x1000000000000000LLU /* for test */
+#define INI_TERMCOMP_TEST1 0x2000000000000000LLU /* for test */
+#define INI_TERMCOMP_TEST2 0x4000000000000000LLU /* for test */
+#define INI_TERMCOMP_TEST3 0x8000000000000000LLU /* for test */
+
+
+
+typedef struct _T_PRIM_PRM{
+ PCSTR name;
+ const PRIM_SHAREDATA_TBL* shmTbl;
+ const PRIM_EXFUNC_TBL* wakeupExFuncTbl;
+ const PRIM_EXFUNC_TBL* downExFuncTbl;
+ EFrameworkunifiedStatus (*onInit)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onDestory)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onDebugDump)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onTouch)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onLowMem)(HANDLE hApp);
+ void* priv;
+ _T_PRIM_PRM(){
+ name = NULL;
+ shmTbl = NULL;
+ wakeupExFuncTbl = NULL;
+ downExFuncTbl = NULL;
+ onInit = NULL;
+ onDestory = NULL;
+ onDebugDump = NULL;
+ onTouch = NULL;
+ onLowMem = NULL;
+ priv = NULL;
+ }
+}T_PRIM_PRM;
+
+
+typedef struct {
+ BOOL bIsRun;
+ uint32_t timeout;
+}T_PRIM_MONITOR_PRM;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Main
+/// \~english @par Summary:
+/// Runs the main thread of primary library.
+/// \~english @param [in] p_prm
+/// T_PRIM_PRM - The pointer to the parameter table of primary library
+/// \~english @param [in] argc
+/// int - The number of command parameters (The parameters passed to main functions must be set without processing.)
+/// \~english @param [in] argv
+/// char* - Command parameters (The parameters passed to main functions must be set without processing.)
+/// \~english @par
+/// - Shared memory creation table \n
+/// In process running, register the shared memory to create.\n
+/// This creates the shared memory to be registered in process running and releases it in process end.\n
+/// This must terminate by adding {"\0"} into member shmName of table termination.\n
+/// It is able to access to the shared memory to have been created by shm_open.\n
+/// \~english @code
+/// typedef struct {
+/// char shmName[32]; /* Shared memory name */
+/// uint32_t size; /* Shared memory size (BYTE) */
+/// }PRIM_SHAREDATA_TBL;
+/// @endcode
+/// \~english @par
+/// - Running extended function table / End extended function table \n
+/// Registers callback functions to be called in process start and exit.\n
+/// This must terminate by adding NULL into member func of table termination.\n
+/// Parameters prm of callback functions are User private information and the pointer designated by prm is passed as input parameters [in].\n
+/// Local phase numbers callback func by the designated phase numbers.\n
+/// \~english @code
+/// typedef struct {
+/// void (* func)( void* prm); /* Callback functions for function extension */
+/// void* prm; /* The pointer to the parameters of Callback function func */
+/// uint8_t localStep; /* Local phase numbers */
+/// uint8_t rsv[3]; /* Reserve for alignment */
+/// }PRIM_EXFUNC_TBL;
+/// @endcode
+/// \~english @par
+/// - %Parameter table of primary library\n
+/// For FrameworkunifiedOnInitialization/FrameworkunifiedOnDestroy/FrameworkunifiedOnDebugDump/TaskmanagerOnTouch/FrameworkunifiedOnLowMemory, check the corresponding API specification.\n
+/// It is able to get User private data by INI_GetPrivate().\n
+/// \~english @code
+/// typedef struct _T_PRIM_PRM{
+/// PCSTR name; /* Application name */
+/// const PRIM_SHAREDATA_TBL* shmTbl; /* The pointer to shared memory creation table */
+/// const PRIM_EXFUNC_TBL* wakeupExFuncTbl; /* The pointer to running extended function table */
+/// const PRIM_EXFUNC_TBL* downExFuncTbl; /* The pointer to end extended function table */
+/// EFrameworkunifiedStatus (*onInit)(HANDLE hApp); /* FrameworkunifiedOnInitialization callback function setting */
+/// EFrameworkunifiedStatus (*onDestory)(HANDLE hApp); /* FrameworkunifiedOnDestroy callback function setting */
+/// EFrameworkunifiedStatus (*onDebugDump)(HANDLE hApp); /* FrameworkunifiedOnDebugDump Callback function setting */
+/// EFrameworkunifiedStatus (*onTouch)(HANDLE hApp); /* TaskmanagerOnTouch callback function setting */
+/// EFrameworkunifiedStatus (*onLowMem)(HANDLE hApp); /* FrameworkunifiedOnLowMemory callback function setting */
+/// void* priv; /* User private data */
+/// }T_PRIM_PRM;
+/// @endcode
+/// \~english @retval INI_SUCCESS Normal end
+/// \~english @retval INI_FALSE Abnormal end
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the shared memory creation table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the running extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the end extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnInitialization callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDestroy callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDebugDump callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of TaskmanagerOnTouch callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail:
+/// This executes the main processing of primary library. Functions do not return until all of end processing of process is completed. \n
+/// Normal end returns INI_SUCCESS and abnormal end does INI_FALSE. \n
+/// User process must return this function's returned values as the returned values of main function and end main function. \n
+/// \~english @see INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int INI_Main(T_PRIM_PRM* p_prm,int argc,char* argv[]);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_ExitStart
+/// \~english @par Summary:
+/// Starts the end processing of process.
+/// \~english @param [in] rsv
+/// void* - The pointer to reservation parameters (NULL must be appointed)
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Collects the resource which primary library got, does the end processing equal to local_step=all and end process. \n
+/// (At the end processing in abnormality, process must be ended by not this function but exit(),_exit() function immediately) \n
+/// When this API is called after this API is already called, do nothing to process.
+/// \~english @par Supplemtent:
+/// local_step is the information defined in default_wakeup.xml/default_shutdown.xml as the definition of running order / end order. \n
+/// local_step defined in default_shutdown.xml has the following types.
+/// - 1-9 : Designates local phase numbers (the phase numbers of end processing)
+/// - last : This designates local phase numbers to be last. When there is the local phase processing not to be executed, this executes all.
+/// - all : The same as last.
+/// \~english @see INI_Main, INI_Init, INI_ExitDone
+////////////////////////////////////////////////////////////////////////////////////
+void INI_ExitStart(void* rsv); // Termination process start
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_ExitDone
+/// \~english @par Summary:
+/// Notifies the completion of process end processing.
+/// \~english @param [in] status
+/// int - Unused (This is for future extension. 0 must be designated.)
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Notifies the completion of service end processing to TaskManager. \n
+/// TaskManager ends the corresponding service by this notification. At the time, this callbacks FrameworkunifiedOnDestroy(). \n
+/// \~english @see INI_Main, INI_Init, INI_ExitStart
+////////////////////////////////////////////////////////////////////////////////////
+void INI_ExitDone(int status); // Termination process completed
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetPrivate
+/// \~english @par Summary:
+/// Gets private data.
+/// \~english @param None
+/// \~english @retval void* The pointer to user private data
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called and user private data must be set.
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets the private data designated at INI_Main/INI_Init from the inside of the context management information of the process inside primary library and returns it.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+void* INI_GetPrivate();
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetHandle
+/// \~english @par Summary:
+/// Gets the application handle of NSFW.
+/// \~english @param None
+/// \~english @retval void*(HANDLE) The application handle of NSFW
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called and the application handle of NSFW must be generated.
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets the application handle of NSFW from the inside of the context management information of the process inside primary library and returns it.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+void* INI_GetHandle();
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_SetMonitorTimeout
+/// \~english @par Summary:
+/// Requests the change for abnormality monitoring timeout time to Task Manager. \n
+/// (This is used when main thread is not implemented at service side)
+/// \~english @param [in] timeout
+/// uint32_t - Abnormality monitoring timeout time (sec)(When 0 is designated, the service must be out of abnormality monitoring object.)
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_Main()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sets the abnormality monitoring timeout time designated by parameters inside the context management information of the process inside primary library and returns returned values and INI_SUCCESS. \n
+/// Set timeout time becomes valid after the event waiting at the loop of main thread and this requests the change for service abnormality monitoring timeout time to TaskManager. In other words, this API can be used after running extended function Callback. \n
+/// When process does not return to main thread past the timeout time designated by this function, TaskManager ends the service forcibly. When this function is not called, TaskManager treats the timeout of monitoring time as 50 seconds.
+/// \~english @see INI_Main
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_SetMonitorTimeout(uint32_t timeout);
+
+// Event completion notification
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_StepForkComp
+/// \~english @par Summary:
+/// Notifies the completion of running event to TaskManager.
+/// \~english @param [in] compId
+/// uint64_t - The comparison ID for phase running (Designates INI_INITCOMP_[a-zA-Z_]+ to define at INI_API.hpp)
+/// \~english @par
+/// The ID descripted at INI_API.hpp
+/// \~english @code
+/// - INI_INITCOMP_NONE: None
+/// - INI_INITCOMP_ON_START: For ON Start
+/// - INI_INITCOMP_NVM_ACCESS: For NVM access
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called.
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The sending of the completion notification of running event to TaskManager failed [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sends the comparison ID for phase running as the completion notification of running event to TaskManager. If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE. \n
+/// TaskManager holds which completion notification of running event is notified and can add it to the transition conditions to next phase at phase running. \n
+/// The way to add at TaskManager side depends on the definition of next_trans_condition element described in default_wakeup.xml as the definition of running order.
+/// \~english @par Supplement:
+/// next_trans_condition is the element to designate transition conditions to next phase. The transition to next phase is done when the following two conditions are met. \n
+/// When the description of next_trans_condition element is omitted, transition is done only by condition 1. \n
+/// 1. All of the phase running request processing set by request element is completed. (The phase running request processing is executed by primary library asynchronously) \n
+/// 2. The completion notification of the event designated by next_trans_condition element is completed. \n
+/// Waiting conditions for event completion notification INI_INITCOMP_[A-Z]+ stipulated at INI_API.hpp is set in cond property designated at next_trans_condition element. \n
+/// AND condition can be set by being INI_INITCOMP_AAAA| INI_INITCOMP_BBBB when conditions are some. \n
+/// Event completion notification can be issued by using INI_StepForkComp.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_StepForkComp(uint64_t compId);
+
+// Event completion notification
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_AccOffComp
+/// \~english @par Summary:
+/// Notifies end event completion notification to TaskManager.
+/// \~english @param [in] compId
+/// uint64_t - The comparison ID for phase running (Designates INI_TERMCOMP_[a-zA-Z_]+ defined at INI_API.hpp)
+/// \~english @par
+/// The ID described at INI_API.hpp
+/// \~english @code
+/// - INI_TERMCOMP_NONE : None
+/// - INI_TERMCOMP_ACTIVITYMGR : For ActivityManager end
+/// - INI_TERMCOMP_RESIDENT : For resident service end
+/// - INI_TERMCOMP_TRANSIENT : For non-resident service end
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The sending of the completion notification of end event to TaskManager failed [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sends the comparison ID for phase running as the completion notification of end event to TaskManager. If it succeeded, returns INI_SUCCESS and if it failed, return INI_FALSE. \n
+/// TaskManager holds which completion notification of end event is notified and can add it to the transition conditions to next phase at phase end. \n
+/// The way to add at TaskManager side depends on the definition of next_trans_condition element described in default_shutdown.xml as the definition of end order.
+/// \~english @par Supplement:
+/// next_trans_condition is the element to designate transition conditions to next phase. The transition to next phase is done when the following two conditions are met. \n
+/// When the description of next_trans_condition element is omitted, transition is done only by condition 1. \n
+/// 1. All of the phase end request processing set by request element is completed. (The phase end request processing is executed by primary library asynchronously) \n
+/// 2. The completion notification of the event designated by next_trans_condition element is completed. Waiting conditions for event completion notification INI_INITCOMP_[A-Z]+ stipulated at INI_API.hpp is set in cond property designated at next_trans_condition element. \n
+/// AND condition can be set by being INI_INITCOMP_AAAA| INI_INITCOMP_BBBB when conditions are some. \n
+/// Event completion notification can be issued by using INI_ AccOffComp.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_AccOffComp(uint64_t compId);
+
+// Get boot info
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetBootInfo
+// \~english @par Summary:
+/// Gets boot information.
+/// \~english @param [in] info
+/// T_SS_SM_START_DataStructType * - The pointer to boot information structure
+/// \~english @par
+/// T_SS_SM_START_DataStructType structure
+/// \~english @code
+/// typedef struct T_SS_SM_START_DataStruct{
+/// EPWR_WAKEUP_FACTOR_TYPE startupReason; /* Startup reason */
+/// BOOL isUserModeOn; /* User mode ON/OFF */
+/// ESMDataResetModeInfo dataResetMode; /* Data reset mode */
+/// EPWR_SC_SECURITY_STATUS securityStatus; /* Security state */
+/// EPWR_SC_WAKEUP_TYPE wakeupType; /* Battery disconnection state */
+/// ESMDramBackupStatus dramBackupStatus; /* Backup memory area state */
+/// ESMResetStatus resetStatus; /* Reset state */
+/// UI_32 resetCount; /* Abnormal reboot number */
+/// } T_SS_SM_START_DataStructType;
+///
+/// Startup reason type:
+/// - epswfIGN_ACC : Ignition ACC (Currently, Fixed)
+/// User mode ON/OFF:
+/// - TRUE : User mode ON (Currently, Fixed)
+/// Data reset mode:
+/// - e_SS_SM_DATA_RESET_NONE: Not-initialized
+/// - e_SS_SM_DATA_RESET_USER: User data initialization
+/// - e_SS_SM_DATA_RESET_FACTORY: Factory initialization
+/// Security state:
+/// - epsssUNLOCK : Unlock state
+/// - epsssLOCK : Lock state
+/// Battery disconnection state:
+/// - epsstWARMSTART : Battery disconnection does not occur
+/// - epsstCOLDSTART : Battery disconnection occurs
+/// Backup memory area state:
+/// - e_SS_SM_DRAM_BACKUP_OK: Backup OK of Backup memory area
+/// - e_SS_SM_DRAM_BACKUP_NG: Backup NG of Backup memory area
+/// Reset state:
+/// - e_SS_SM_RESET_STATUS_UNSET: Information unsetting(Not decided yet)
+/// - e_SS_SM_RESET_STATUS_NONE : Normal
+/// - e_SS_SM_RESET_STATUS_NG : Abnormality occurred (Abnormal RESET or booting after service abnormal end)
+/// - e_SS_SM_RESET_STATUS_IMMEDIATE : Immediate RESET occurred
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called. (%Process running must be completed)
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to boot information structure designated at parameters is NULL [INI_FALSE]
+/// - Startup reason type inside the context management information of the process inside primary library is wrong (%Process running is not completed) [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets boot information which is managed inside the context management information of the process inside primary library.
+/// If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE. \n
+/// This sets valid values as info values in FrameworkunifiedOnStart of TaskManager. In other words, this sets valid values after running ActivityManager.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_GetBootInfo(T_SS_SM_START_DataStructType *info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetExtBootInfo
+/// \~english @par Summary:
+/// Gets boot extended information.
+/// \~english @param [in] info
+/// T_SS_SM_START_ExtDataStructType * - The pointer to boot extended information structure
+/// \~english @par
+/// T_SS_SM_START_ExtDataStructType structure
+/// \~english @code
+/// #define SS_SM_START_EXT_INFO_SIZE 64
+/// #define SS_SM_START_EXT_BODY_SIZE ( sizeof(BOOL)
+/// + sizeof(EMRelaunchStatus)
+/// + sizeof(BOOL)
+/// + sizeof(BOOL)
+/// )
+/// define SS_SM_START_EXT_RSV_SIZE SS_SM_START_EXT_INFO_SIZE
+/// - SS_SM_START_EXT_BODY_SIZE
+/// typedef struct {
+/// BOOL isProgUpdated; /* Program update information */
+/// EMRelaunchStatus relaunchStatus; /* Own-service Relaunch state */
+/// BOOL isMapUpdated; /* Map update information */
+/// BOOL isMapDiffUpdated; /* Map difference update information */
+/// uint8_t reserved[SS_SM_START_EXT_RSV_SIZE]; /* Reserve area */
+/// } T_SS_SM_START_ExtDataStructType;
+///
+/// Program update information
+/// - TRUE : Program update
+/// - FALSE : No Program update
+/// Own-service Relaunch state:
+/// - e_SS_SM_RELAUNCH_STATUS_NONE : Relaunch does not occur (Initial boot)
+/// - e_SS_SM_RELAUNCH_STATUS_SAFE : Normal Relaunch
+/// - e_SS_SM_RELAUNCH_STATUS_ERR : Abnormal Relaunch
+/// Map update information:
+/// - TRUE : Map update
+/// - FALSE : No Map update
+/// Map difference update information
+/// - TRUE : Map difference update
+/// - FALSE : No Map difference update
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called. (%Process running must be completed.)
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to boot information structure designated at parameters is NULL [INI_FALSE]
+/// - Startup reason type inside the context management information of the process inside primary library is wrong (%Process running is not completed) [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets boot extended information which is managed inside the context management information of the process inside primary library.
+/// If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE \n
+/// This sets valid values as info values in FrameworkunifiedOnStart of TaskManager. In other words, this sets valid values after running ActivityManager.
+/// Because TaskManager does not have Relaunch function, always sets e_SS_SM_RELAUNCH_STATUS_NONE in relaunchStatus.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *info);
+
+//withoutMainLoop
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Init
+/// \~english @par Summary:
+/// Initializes primary library. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param [in] p_prm
+/// T_PRIM_PRM - The pointer to parameter table of primary library
+/// \~english @param [in] argc
+/// int - The number of command parameters (The parameters passed to main functions must be set without processing)
+/// \~english @param [in] argv
+/// char* - Command parameters (The parameters passed to main functions must be set without processing)
+/// \~english @param [out] fdNum
+/// int * - The number of element stored in fdlist (INI_FD_MAX:3)
+/// \~english @param [out] fdlist[INI_FD_MAX]
+/// int - The array of FD (File Descriptor) for event reception which primary library waits
+/// \~english @par
+/// - Shared memory creation table \n
+/// In process running, register the shared memory to create. \n
+/// This creates the shared memory to be registered in process running and releases it in process end. \n
+/// This must terminate by adding {"\0"} into member shmName of table termination. \n
+/// It is able to access to the shared memory to have been created by shm_open. \n
+/// \~english @code
+/// typedef struct {
+/// char shmName[32]; /* Shared memory name */
+/// uint32_t size; /* Shared memory size (BYTE) */
+/// }PRIM_SHAREDATA_TBL;
+/// @endcode
+/// \~english @par
+/// - Running extended function table / End extended function table \n
+/// Registers callback functions to be called in process start and exit. \n
+/// This must terminate by adding NULL into member func of table termination. \n
+/// Parameters prm of callback functions are User private information and the pointer designated by prm is passed as input parameters [in]. \n
+/// Local phase numbers callback func by the designated phase numbers. \n
+/// \~english @code
+/// typedef struct {
+/// void (* func)( void* prm); /* Callback functions for function extension */
+/// void* prm; /* The pointer to the parameters of Callback function func */
+/// uint8_t localStep; /* Local phase numbers */
+/// uint8_t rsv[3]; /* Reserve for alignment */
+/// }PRIM_EXFUNC_TBL;
+/// @endcode
+/// \~english @par
+/// - %Parameter table of primary library \n
+/// For FrameworkunifiedOnInitialization/FrameworkunifiedOnDestroy/FrameworkunifiedOnDebugDump/TaskmanagerOnTouch/FrameworkunifiedOnLowMemory, check the corresponding API specification. \n
+/// It is able to get User private data by INI_GetPrivate(). \n
+/// \~english @code
+/// typedef struct _T_PRIM_PRM{
+/// PCSTR name; /* Application name */
+/// const PRIM_SHAREDATA_TBL* shmTbl; /* The pointer to shared memory creation table */
+/// const PRIM_EXFUNC_TBL* wakeupExFuncTbl; /* The pointer to running extended function table */
+/// const PRIM_EXFUNC_TBL* downExFuncTbl; /* The pointer to end extended function table */
+/// EFrameworkunifiedStatus (*onInit)(HANDLE hApp); /* FrameworkunifiedOnInitialization callback function setting */
+/// EFrameworkunifiedStatus (*onDestory)(HANDLE hApp); /* FrameworkunifiedOnDestroy callback function setting */
+/// EFrameworkunifiedStatus (*onDebugDump)(HANDLE hApp); /* FrameworkunifiedOnDebugDump Callback function setting */
+/// EFrameworkunifiedStatus (*onTouch)(HANDLE hApp); /* TaskmanagerOnTouch callback function setting */
+/// EFrameworkunifiedStatus (*onLowMem)(HANDLE hApp); /* FrameworkunifiedOnLowMemory callback function setting */
+/// void* priv; /* User private data */
+/// }T_PRIM_PRM;
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the shared memory creation table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the running extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the end extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnInitialization callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDestroy callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDebugDump callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of TaskmanagerOnTouch callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Initializes primary thread. If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE. \n
+/// When implementing main thread at service, this function must be called in running main thread. \n
+/// Waits fd of fdlist gotten by functions by select and when there is change in fd, service must execute event handler of primary by calling INI_Handler().
+/// \~english @see INI_Main
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_Init(T_PRIM_PRM* p_prm,int argc ,char* argv[],int *fdNum,int fdlist[INI_FD_MAX]);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Handler
+/// \~english @par Summary:
+/// Processes the reception event of primary library. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param [in] p_fds
+/// fd_set* - fd set varied and detected by select()
+/// \~english @retval TRUE Service running (Continuing)
+/// \~english @retval FALSE The process end processing of primary library is completed
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_Init()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Access is not from main thread context [FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// When FD which primary library should process in fd set designated by p_fds is included, processes event processing of primary library. \n
+/// When implementing main thread by service, it is necessary to execute the event reception processing of primary library by this function. \n
+/// Returns TRUE during service running and does FALSE when the process end processing of primary library was completed. When FALSE is returned, service must call
+/// INI_Term() and end itself.
+/// \~english @see INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+BOOL INI_Handler(fd_set* p_fds);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Term
+/// \~english @par Summary:
+/// Releases the resource of primary library. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param None
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_Init()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Releases the resource of primary library. \n
+/// When implementing main thread at service, this function must release the resource of primary library in service end.
+/// \~english @see INI_Init, INI_Handler
+////////////////////////////////////////////////////////////////////////////////////
+void INI_Term(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_SetMonitorState
+/// \~english @par Summary:
+/// Sets abnormality monitoring state. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param [in] p_prm
+/// T_PRIM_MONITOR_PRM - The pointer to the parameters structure for monitoring
+/// \~english @par
+/// T_PRIM_MONITOR_PRM structure
+/// \~english @code
+/// typedef struct {
+/// BOOL bIsRun; /* Monitoring state (TRUE:RUN FALSE:SLEEP) */
+/// uint32_t timeout; /* Monitoring timeout time (sec) */
+/// }PRIM_SHAREDATA_TBL;
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_ Init ()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer(p_prm) to the parameters structure for monitoring designated by parameters is NULL [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sets abnormality monitoring for TaskManager. If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE \n
+/// When bIsRun=FALSE is not set until time designated by timeout passes after setting bIsRun=TRUE, TaskManager decides that the service falls into abnormal state and ends forcibly. \n
+/// When 0 is designated at monitoring timeout time(timeout), the service must be out of abnormality monitoring object.
+/// When monitoring state (bIsRun) is FALSE, monitoring state becomes invalid. \n
+/// This API can be used after running extended function CALLBACK.
+/// \~english @see INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_SetMonitorState(T_PRIM_MONITOR_PRM *p_prm);
+
+
+void _INI_DEBUGDUMP(BOOL bIsNeedSvcName, PCSTR f_cFormat, ...);
+
+#define INI_DEBUGDUMP(args...) _INI_DEBUGDUMP(TRUE, ## args)
+#define INI_DEBUGDUMP_RAW(args...) _INI_DEBUGDUMP(FALSE, ## args)
+
+// Callback functions
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TaskmanagerOnTouch
+/// \~english @par Summary:
+/// Callback to notify process use
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @retval eFrameworkunifiedStatusOK Succeeded
+/// \~english @retval Other-than-eFrameworkunifiedStatusOK Failed (Error type depends on the implementation at user side)
+/// \~english @par Preconditions:
+/// - Must set inside running information structure in calling INI_Main or INI_Init
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Implementation specification of callback depends on the implementation (design) of an application. For this, error type on failure conditions must be considered at an application side.
+/// \~english @par Detail:
+/// Service is call backed just before using. \n
+/// INI_ExitStart must not be issued for 30 seconds after service called this function. \n
+/// Timeout must be implemented such as counting up by using interval timer so that INI_ExitStart is not issued by timeout after this API was called. \n
+/// This function cannot call the API (TSKM_Xxxx) of TaskManager. (If this calls, deadlock occurs)
+/// \~english @par Classification:
+/// Public
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus TaskmanagerOnTouch(HANDLE hApp);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //_INI_API_HPP_
+
+/** @}*/ // end of TaskManager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/task_manager/server/include/system_service/Primary_common.h b/systemservice/task_manager/server/include/system_service/Primary_common.h
new file mode 100755
index 0000000..e0624bb
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/Primary_common.h
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file Primary_common.h
+ * @brief \~english This file contains declaration of common enum and structures
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
+
+#include <stdint.h>
+#include <pthread.h>
+
+typedef unsigned int PRI_DWORD; // To eliminate the DWORD
+
+/* SRAM process type */
+#define SRAM_INIT (int)0 /* Initialization processing specification */
+#define SRAM_CHK (int)1 /* Range check processing specification */
+#define SRAM_MAPVER (int)2 /* Map Version change support designation */
+#define SRAM_MAPVER_CHK (int)3 /* Map Version change support + range checking specification */
+#define SRAM_SYSTEM_INIT (int)4 /* System initialization processing specification */
+#define SRAM_CONFIG_INIT (int)5 /* Reset setting */
+
+/* Processing result */
+#define SRAM_CHK_OK (int)0 /* SRAM checking completed normally (no change) */
+#define SRAM_CHK_CHG (int)1 /* SRAM checking Successful completion value is changed (Including during initialization) */
+#define SRAM_CHK_NG (int)-1 /* SRAM checking error */
+
+/*
+ Constant definition
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define PRIM_SHM_NAME_MAX 32 /* Maximum name size */
+
+// Local stage number of the stage start request/end request from the TSKM
+// In XML, it is set with a direct value of 1-9, but it is left because the legacy service refers to this definition
+enum _PRIM_FORK_STEP {
+ PRIM_STEPFORK_FIRST = 1, /* First startup step */
+ PRIM_STEPFORK_SECOND, /* 2nd startup step */
+ PRIM_STEPFORK_THIRD, /* 3rd startup step */
+ PRIM_STEPFORK_FOURTH, /* 4th startup step */
+ PRIM_STEPFORK_FIFTH, /* 5th startup step */
+ PRIM_STEPFORK_SIXTH, /* 6th startup step */
+ PRIM_STEPFORK_SEVENTH, /* 7th startup step */
+ PRIM_STEPFORK_EIGHTH, /* 8th startup step */ /* #GPF_10_018 */
+ PRIM_STEPFORK_NINTH, /* 9th startup step */ /* #GPF_10_018 */
+ PRIM_STEPFORK_TENTH, /* 10th startup step */ /* #GPF_10_018 */
+ PRIM_STEPFORK_MAX /* Maximum number of Gradual startup steps */ /* Used for judgment when receiving gradual startup */
+};
+
+enum _PRIM_ACCOFF_STEP {
+ PRIM_ACCOFF_FIRST = 1, /* First step */
+ PRIM_ACCOFF_SECOND, /* 2nd step */
+ PRIM_ACCOFF_THIRD, /* 3rd step */
+ PRIM_ACCOFF_FOURTH, /* 4th step */
+ PRIM_ACCOFF_FIFTH, /* 5th step */
+ PRIM_ACCOFF_MAX /* Total number of ACC-OFF steps */ /* Used for judgment when receiving ACC-OFF instruction */
+};
+
+/******************************************************************************
+ * TAG : PRIM_SHAREDATA_TBL
+ * ABSTRACT : Shared data table
+ * NOTE :
+ ******************************************************************************/
+/* Structure of shared data table */
+typedef struct {
+ char shmName[PRIM_SHM_NAME_MAX]; /* Shared data name */
+ int32_t size; /* Shared data size */
+} PRIM_SHAREDATA_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_FORK_TBL
+ * ABSTRACT : Startup process table
+ * NOTE :
+ ******************************************************************************/
+typedef struct {
+ PRI_DWORD (*threadFunc)(void* prm); /* Thread function */
+ void* prm; /* Thread startup parameters */
+ uint32_t priority; /* Thread priority */
+ uint16_t pno; /* Thuread number */
+ uint8_t rsv; /* Reserved field */
+ uint8_t wakeLocalStep; /* Startup step */
+ // The following is valid only when useLegacy = FALSE
+ char threadName[16]; /* Thread name */
+ char downLocalStep; /* When the termination step is 0, termination notification is not issued */
+ void* primaryLocal; /* Local area for libPrimary (cannot be changed) */
+} PRIM_FORK_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_EXFUNC_TBL
+ * ABSTRACT : Feature extension table
+ ******************************************************************************/
+typedef struct {
+ void (*func)(void* prm); /* Feature extension function */
+ void* prm; /* parameters */
+ uint8_t localStep; /* Startup step */
+ uint8_t rsv[3]; /* Reserved */
+} PRIM_EXFUNC_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_BACKUPCHK_TBL
+ * ABSTRACT : Function table for check backup data
+ ******************************************************************************/
+typedef struct {
+ int32_t (*func)(int32_t kind); /* Feature Extension Functions */
+} PRIM_BACKUPCHK_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_ACCOFF_TBL
+ * ABSTRACT : ACC-OFF process table
+ ******************************************************************************/
+typedef struct {
+ uint32_t localStep; /* ACC-OFF process step */
+ uint16_t pno; /* PNO of Notification destination */
+ uint8_t rsv[2];
+} PRIM_ACCOFF_TBL;
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
+/*
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : Primary_common.h
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ */
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/server/include/system_service/sysup.h b/systemservice/task_manager/server/include/system_service/sysup.h
new file mode 100755
index 0000000..ef930a4
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/sysup.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file sysup.h
+ * @brief \~english This file contains declaration of system status(SYS_RESET, SYS_ONLY_RESET)
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_H_
+
+#define SYS_RESET (int32)1 /* Resetting */
+#define SYS_ONLY_RESET (int)2 /* Reset only */
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_H_
+/** @}*/
+/** @}*/
+/** @}*/
+
diff --git a/systemservice/task_manager/server/include/system_service/sysup_from.h b/systemservice/task_manager/server/include/system_service/sysup_from.h
new file mode 100755
index 0000000..be7e0fe
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/sysup_from.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_FROM_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_FROM_H_
+
+/**
+ * @file sysup_from.h
+ * @brief \~english empty file
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+// Deleted the definitions in the file because they are not used.
+// Left them for legacy sources that you include.
+/** @}*/
+/** @}*/
+/** @}*/
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_FROM_H_
diff --git a/systemservice/task_manager/server/include/system_service/task_manager.h b/systemservice/task_manager/server/include/system_service/task_manager.h
new file mode 100755
index 0000000..82d23fb
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/task_manager.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file task_manager.h
+ * @brief \~english include all task_manager_library head files
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TASK_MANAGER_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TASK_MANAGER_H_
+
+#include "system_service/INI_API.h"
+#include "system_service/INI_API.hpp"
+#include "system_service/Primary_common.h"
+#include "system_service/sysup_from.h"
+#include "system_service/sysup.h"
+#include "system_service/tskm_svc.h"
+#include "system_service/tskm_type.h"
+#include "system_service/tskm.h"
+#include "system_service/tskm_local_type.h"
+#include "system_service/tskm_xml_data.h"
+#include "system_service/tskm_svcid.h"
+#include "system_service/task_manager_libtskmcfg.h"
+#include "system_service/tskm_data_init.h"
+#include "system_service/task_manager_libss_data_init.h"
+
+
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TASK_MANAGER_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/server/include/system_service/tskm.h b/systemservice/task_manager/server/include/system_service/tskm.h
new file mode 100755
index 0000000..1a2f962
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/tskm.h
@@ -0,0 +1,413 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file tskm.h
+ * @brief \~english This file contains primary API of task manager
+ */
+
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_H_
+
+
+#include <other_service/rpc.h>
+#include "system_service/tskm_type.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TSKM_ID RPC_ID
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_Init
+/// \~english @par Summary:
+/// Creates the resource to communicate with Task_Manager.
+/// \~english @param [out] *pID
+/// UINT32 - Unique ID of the automatically allocated program
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Creates the resource to communicate with Task_Manager. \n
+/// It is necessary to call this before using the APIs of TSKM_xxxx defined after this. \n
+/// It is necessary to call this by the thread. \n
+/// \~english @see TSKM_End
+////////////////////////////////////////////////////////////////////////////////////
+#define TSKM_Init(p_tskmId) RPC_START_CLIENT(p_tskmId)
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_End
+/// \~english @par Summary:
+/// Releases the resource created at TSKM_Init.
+/// \~english @param [in] ID
+/// UINT32 - ID gotten at TSKM_Init()
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal stat:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Releases the resource created at TSKM_Init.
+/// \~english @see TSKM_Init
+////////////////////////////////////////////////////////////////////////////////////
+#define TSKM_End(tskmId) RPC_end(tskmId)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_SvcCtl
+// \~english @par Summary:
+/// Run the control for service.
+/// \~english @param [in] svcid
+/// TSKM_SVCID_t - Service ID
+/// \~english @param [in] ctl
+/// TSKM_SVC_CTL_t* - Command
+/// \~english @code
+/// typedef struct{
+/// TSKM_SVC_CMD_t cmd;
+/// } TSKM_SVC_CTL_t;
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @retval TSKM_E_STATE State error
+/// \~english @retval TSKM_E_NG Error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters ctl is NULL [TSKM_E_PAR]
+/// - Service context is not found [TSKM_E_PAR]
+/// - Before FrameworkunifiedOnStart of Task_Manager is called [TSKM_E_STATE]
+/// - It is prohibited to run designated service [TSKM_E_STATE]
+/// - Message sending failed [TSKM_E_RETRY]
+/// - When the specified service executes the start prohibition except during
+/// the stop or start prohibition status. [TSKM_E_STATE]
+/// - Maximum numbers to register running reservation service are exceeded [TSKM_E_STATE]
+/// - Anything except for the commands specified as parameters is designated [TSKM_E_PAR]
+/// - Writing in files of running reservation information failed [TSKM_E_NG]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// - TSKM_SVC_CMD_EXEC\n
+/// Designated service runs. \n
+/// When designated service already runs, this returns TSKM_E_OK without processing service running. \n
+/// Running equal to local_step=all of request element is done. \n
+/// When designated service designates the service that running is prohibited by
+/// TSKM_SVC_CMD_DISABLE, this returns TSKM_E_STATE. \n
+/// This guarantees that service running finished in API succeeding. \n
+/// - TSKM_SVC_CMD_DISABLE\n
+/// This prohibits to run the designated service. \n
+/// At the prohibited service to run already, this returns TSKM_E_OK without doing anything. \n
+/// When this API uses the service to be run already, this returns TSKM_E_STATE. \n
+/// By this, at resident service, it is necessary to call this before running corresponding service. \n
+/// About the prohibited service, this doesn't decide the wait condition of event completion notice
+/// which service running, phase startup, phase end request, corresponding service control. \n
+/// This command is prepared in consideration of changing the service to run in response to
+/// with or without extended BOX and device configuration. \n
+/// Initial values are running permission. \n
+/// - TSKM_SVC_CMD_ENABLE\n
+/// This permits to run the service to be set as running prohibition. \n
+/// At running permission service, this returns TSKM_E_OK without doing anything. \n
+/// - TSKM_SVC_RESERVE\n
+/// This does the running reservation of non-resident service. \n
+/// In next running, designated service runs automatically after finishing in running resident service. \n
+/// Once this runs automatically, this forgets reservation information. \n
+/// Maximum numbers of service able to do running reservation is the values of TSKM_SVC_RESERVE_MAX. \n
+/// When this reserves over maximum numbers, this returns TSKM_E_STATE. \n
+/// When backup RAM is invalid in running, this does not run automatically and
+/// discards reservation information. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_SvcCtl(TSKM_SVCID_t svcId, const TSKM_SVC_CTL_t* ctl);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_SvcGetInfo
+// \~english @par Summary:
+/// Gets the information of designated service.
+/// \~english @param [in] svcid
+/// TSKM_SVCID_t - Service ID
+/// \~english @param [out] svcInfo
+/// TSKM_SVC_INFO_t* - Service information
+/// \~english @code
+/// typedef struct {
+/// TSKM_SVCID_t svcId;
+/// TSKM_BOOL_t isExecDisable;
+/// } TSKM_SVC_INFO_t;
+/// svcId : Service ID
+/// isExecDisable : Service running prohibition state
+/// TSKM_TRUE : Running prohibition
+/// TSKM_FALSE : Running permission
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Service context is not found [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets the information of designated service.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_SvcGetInfo(TSKM_SVCID_t svcId, TSKM_SVC_INFO_t* svcInfo);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_ErrorReboot
+/// \~english @par Summary:
+/// Let system do abnormal reboot.
+/// \~english @param [in] p_info
+/// TSKM_ERROR_REBOOT_t* - REBOOT information
+/// \~english @code
+/// typedef struct {
+/// TSKM_ERROR_REBOOT_TYPE_t type;
+/// TSKM_LOGGING_ INFO_t log;
+/// } TSKM_ERROR_REBOOT_t;
+/// type
+/// TSKM_ERROR_REBOOT_NORMAL : Abnormal detection
+/// log : Log saving information
+/// typedef struct {
+/// char messageStr[TSKM_LOGGING_MSG_STR_SIZE];
+/// } TSKM_LOGGING_INFO_ t;
+/// messageStr : Abnormal message character string
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_info is NULL [TSKM_E_PAR]
+/// - Reboot factors are except for TSKM_ERROR_REBOOT_NORMAL [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Does REBOOT. \n
+/// It is assumed to issue when system is damaged if processing continues any more
+/// such as device trouble and non-volatile data trouble. \n
+/// Access limitation is done to this API by gid and uid. \n
+/// When an application with no authorization calls this, this force-quits the application to have called API. \n
+/// This stores the string designated to messageStr as factors in system information LOG. \n
+/// To link with PSMShadow about trouble factors, this designates abnormal message character string defined
+/// inside ss_error_message.h to messageStr.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_Reboot
+/// \~english @par Summary:
+/// Let system do reboot.
+/// \~english @param [in] rsv
+/// TSKM_RSV_t* - Reservation ( This must designate NULL)
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_rsv is except for NULL [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync x Method
+/// \~english @par Detail:
+/// Let system do normal reboot.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_Reboot(const TSKM_RSV_t * p_rsv);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_Logging
+/// \~english @par Summary:
+/// Stores LOG in internal non-volatile area.
+/// \~english @param [in] p_info
+/// TSKM_LOGGING_INFO_t * - Log storing information
+/// \~english @code
+/// typedef struct{
+/// TSKM_LOGGING_TYPE_NORMAL_t type;
+/// char messageStr[TSKM_LOGGING_MSG_STR_SIZE];
+/// }TSKM_LOGGING_INFO_t;
+/// type : Log storing type
+/// TSKM_LOGGING_TYPE_MODULE_LOGS: General LOG storing request from service
+/// TSKM_LOGGING_TYPE_GRP_RELAUNCH: Log collection by Group Relaunch
+/// messageStr : Trouble factors
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_info is NULL [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Collects LOG information and stores it in internal non-volatile area \n
+/// This stores the string designated to messageStr as factors in system information LOG.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_Logging(const TSKM_LOGGING_INFO_t* p_info);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_DataInit
+/// \~english @par Summary:
+/// Does the initialization process of service data.
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @param [in] p_info
+/// TSKM_DATAINIT_t * - Data initialization information
+/// \~english @code
+/// typedef struct {
+/// TSKM_DATAINIT_TYPE_t type;
+/// EFrameworkunifiedStatus (*onCompInit)(HANDLE hApp);
+/// } TSKM_DATAINIT_t;
+/// type : Data initialization type
+/// TSKM_DATAINIT_TYPE_USER : User data initialization
+/// onCompInit : Initialization complete Callback
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @retval TSKM_E_NG Error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters hAPP is NULL [TSKM_E_PAR]
+/// - Parameters p_info is NULL [TSKM_E_PAR]
+/// - Member type of parameters p_info is except for TSKM_DATAINIT_TYPE_USER [TSKM_E_PAR]
+/// - Member onCompInit of parameters p_info is NULL [TSKM_E_PAR]
+/// - The process of FrameworkunifiedAttachCallbackToDispatcher failed [TSKM_E_NG]
+/// - The process of FrameworkunifiedOpenService failed [TSKM_E_STATE]
+/// - The process of FrameworkunifiedSendMsg failed [TSKM_E_NG]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail:
+/// - How to report \n
+/// Reports by Callback of onCompInit. \n
+/// This can get message data by calling GetMsgData inside onCompInit. \n
+/// - Structure of message data \n
+/// TSKM_ERR_t:Processing result \n
+/// TSKM_E_OK :Normal end \n
+/// TSKM_E_STATE :State error \n
+/// TSKM_E_NG :Error
+/// - Summary of action \n
+/// Calls initialization functions which each service implemented. \n
+/// When this API was called before Availability of Task_Manager becomes TRUE, this
+/// does not call initialization functions and returns TSKM_E_STATE by onCompInit. \n
+/// It is permitted for same application to call this API several times, at this case,
+/// it is necessary to designate the pointer to same functions to onCompInit. \n
+/// When this API was called by designating TSKM_DATAINIT_TYPE_USER to type, this calls
+/// the initialization functions of each service by designating the following parameters. \n
+/// <table>
+/// <tr><th>Member</th><th>Values</th></tr>
+/// <tr><td>startupReason</td><td>epswfIGN_ACC</td></tr>
+/// <tr><td>isUserModeOn</td><td>TRUE</td></tr>
+/// <tr><td>dataResetMode</td><td>e_SS_SM_DATA_RESET_MODE_USER</td></tr>
+/// <tr><td>wakeupType</td><td>epsstWARMSTART</td></tr>
+/// <tr><td>dramBackupStatus</td><td>e_SS_SM_DRAM_BACKUP_OK</td></tr>
+/// <tr><td>resetStatus</td><td>e_SS_SM_RESET_STATUS_NONE</td></tr>
+/// <tr><td>resetCount</td><td>0</td></tr>
+/// </table>
+/// Because Task_Manager calls the initialization functions of each service and implements
+/// the recovery processing according to running factors at the timing of fixing running factor,
+/// this designates the above parameters not to do duplicate recover processing.
+/// \~english @see TSKM_DATA_INIT_FUNC
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_DataInit(HANDLE hApp, const TSKM_DATAINIT_t *p_info);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_SetWakeupOrder
+/// \~english @par Summary:
+/// Holds running order.
+/// \~english @param [in] p_order
+/// TSKM_WAKEUP_ORDER_t * - Running order information
+/// \~english @code
+/// typedef struct {
+/// char orderName[TSKM_ORDER_NAME_MAX];
+/// } TSKM_WAKEUP_ORDER_t;
+/// orderName: Order name (MAX:31 characters)
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @retval TSKM_E_NG Error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_order is NULL [TSKM_E_PAR]
+/// - The string length of the member orderName of Parameters p_order exceeds 32 [TSKM_E_PAR]
+/// - The process of SetWakeupOrderToSystemManager failed [TSKM_E_NG]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync x Sync
+/// \~english @par Detail:
+/// This function is Wrapper function to provide SetWakeupOrderToSystemManager
+/// by sessionless which SystemManger provides.
+/// This designates NULL to p_order and returns TSKM_E_PAR.
+/// For the detail of action, refer to SystemManager (SetWakeupOrderToSystemManager).
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_SetWakeupOrder(const TSKM_WAKEUP_ORDER_t* p_order);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_H_
+
+/** @}*/ // end of Task_Manager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
+
+
diff --git a/systemservice/task_manager/server/include/system_service/tskm_local_type.h b/systemservice/task_manager/server/include/system_service/tskm_local_type.h
new file mode 100755
index 0000000..79831aa
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/tskm_local_type.h
@@ -0,0 +1,287 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_local_type.h
+ * @brief \~english localtype of tskm
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_LOCAL_TYPE_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_LOCAL_TYPE_H_
+
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <native_service/frameworkunified_types.h>
+#include "system_service/INI_API.hpp"
+#include "system_service/tskm_type.h"
+
+//==================================================
+// Configuration
+//==================================================
+
+#if 1
+#define TSKM_CFG_WAIT_SHUTDOWN 10000
+#else
+#define TSKM_CFG_WAIT_SHUTDOWN 1 // Handy for test
+#warning TSKM_CFG_WAIT_SHUTDOWN is temorary
+#endif
+
+#define TSKM_CFG_TOUCH_TIMEOUT 2 // TOUCH time-out
+
+//==================================================
+// Task manager internal
+//==================================================
+// State
+#define TSKM_ST_ACCOFF 0x01000000U // ACC-OFF (Default) No transition here
+#define TSKM_ST_ACCON 0x02000000U // ACC-ON
+#define TSKM_ST_WAKEUP 0x02010000U // Gradual startup
+#define TSKM_ST_RUNNING 0x02020000U // Running (Startup completed)
+#define TSKM_ST_DOWN 0x02040000U // Gradual Terminating
+
+typedef uint32_t TSKM_STATE_t;
+#define TSKM_STATE_MASK0 0xFF000000U
+#define TSKM_STATE_MASK1 0xFFFF0000U
+#define TSKM_STATE_MASK2 0xFFFFFF00U
+#define TSKM_STATE_MASK3 0xFFFFFFFFU
+
+// Global step IDs for gradual starting
+typedef uint32_t TSKM_GLOBAL_STEP_t;
+#define TSKM_GSTEP_NONE 0x00000000U //
+#define TSKM_GSTEP_BUPCHK 0x00000001U
+
+// Local step
+typedef uint32_t TSKM_LOCAL_STEP_t;
+#define TSKM_LSTEP_LAST 0xFFFFFFF0U // Executing to end of local steps
+#define TSKM_LSTEP_SHM 0xFFFFFFF1U // Creating shared memory
+#define TSKM_LSTEP_BUPCHK 0xFFFFFFF2U // Checking backup memory
+#define TSKM_LSTEP_ALL 0xFFFFFFF3U // Executing all user definitions
+
+/************************************************************
+ * Structure of gradual startup/termination structure
+ (When this structure is modified, structure of parsexml is also changed)
+ *************************************************************/
+// Structure of request for services
+typedef struct {
+ TSKM_SVCID_t svcId; // Service ID
+ TSKM_LOCAL_STEP_t localStep; // Local step number
+} TSKM_GSTEP_REQ_INFO_t;
+
+// Structure of gradual startup/termination
+typedef struct {
+ uint32_t gstepId;
+
+ // List of executing services
+ uint32_t execSvcNum;
+ TSKM_SVCID_t* execSvcIdList;
+
+ // List of request
+ uint32_t reqNum;
+ TSKM_GSTEP_REQ_INFO_t* reqList;
+
+ // Event completion wait conditions
+ uint64_t nextTransCond;
+} TSKM_GSTEP_t;
+
+typedef struct {
+ uint32_t gstepIdx; // Step index
+ uint32_t gstepNum; // Step number
+ TSKM_GSTEP_t* gstep; // Gradual startup/termination info
+ uint64_t compState; // Status of receiving for Event completion notification
+} TSKM_GSTEP_CTX_t;
+
+//********* Non-volatile management information ****************
+
+#define TSKM_NV_STRUCT_VERSION "v000" // Compatible version of non-volatile management structure
+#define TSKM_SVC_RESERVE_MAX (8) // Maximum number of reserved services to startup
+
+#define TSKM_NV_SIZE_ALL (512)
+#define TSKM_NV_SIZE_HEADER (32)
+#define TSKM_NV_SIZE_FOOTER (32)
+#define TSKM_NV_SIZE_BODY (TSKM_NV_SIZE_ALL - TSKM_NV_SIZE_HEADER - TSKM_NV_SIZE_FOOTER)
+
+// Header
+typedef struct {
+ char version[5];
+} TSKM_NV_HEADER_t;
+
+// Footer
+typedef struct {
+ uint32_t checkSum;
+} TSKM_NV_FOOTER_t;
+
+// Body
+typedef struct {
+ uint8_t rsvSvcNum; // Number of reserved services
+ TSKM_SVCID_t rsvSvcs[TSKM_SVC_RESERVE_MAX]; // List of services
+} TSKM_NV_BODY_t;
+
+// Non-volatile storage info
+typedef struct {
+ TSKM_NV_HEADER_t header;
+ uint8_t rsvHeader[TSKM_NV_SIZE_HEADER - sizeof(TSKM_NV_HEADER_t)];
+ TSKM_NV_BODY_t body;
+ uint8_t rsvBody[TSKM_NV_SIZE_BODY - sizeof(TSKM_NV_BODY_t)];
+ uint8_t rsvFooter[TSKM_NV_SIZE_FOOTER - sizeof(TSKM_NV_FOOTER_t)];
+ TSKM_NV_FOOTER_t footer;
+} TSKM_NV_INFO_t;
+
+// Internal event
+typedef enum {
+ TSKM_EV_NOP, // Do nothing
+ // TSKM->PRI
+ TSKM_EV_PRI_REQ_WAKEUP, // Startup request
+ TSKM_EV_PRI_REQ_DOWN, // Termination request
+ TSKM_EV_PRI_REQ_TOUCH,
+ TSKM_EV_PRI_REQ_DEBUGDUMP, // DebugDump request
+ TSKM_EV_PRI_REP_LOWMEM, // LowMemory detection request
+
+ // PRI->TSKM(SVC)
+ TSKM_EV_PRI_REP_WAKEUP_COMP, // Notification of event completion at startup
+ TSKM_EV_PRI_REP_DOWN_COMP, // Notification of event completion at termination
+ TSKM_EV_PRI_REP_CONNECT, // Connecting
+ TSKM_EV_PRI_REP_DISCONNECT, // Disconnecting
+ TSKM_EV_PRI_RES_WAKEUP, // Response to startup request
+ TSKM_EV_PRI_RES_DOWN, // Response to termination request
+ TSKM_EV_PRI_RES_DEBUGDUMP, // Response to DebugDump request
+ TSKM_EV_PRI_REQ_EXIT, // Response to terminating request
+
+ // SVC->TSKM
+ TSKM_EV_SVC_REP_TERM, // Termination of service
+
+ // APL->TSKM
+ TSKM_EV_API_REQ_REBOOT, // Reboot system
+ TSKM_EV_API_REQ_SVC_CTL, // Startup service
+ TSKM_EV_API_REQ_SVC_DISABLE, // Prohibit starting service
+
+ // Internal message
+ TSKM_EV_LCL_REQ_STOP, // Termination request
+ TSKM_EV_LCL_CHG_SVC_STATE, // State Change of service
+ TSKM_EV_LCL_REQ_SDUMP, // Dump of service list
+ TSKM_EV_LCL_REP_TIMEOUT, // Occured Timeout
+ TSKM_EV_LCL_REP_POLLING, // Polling request
+ TSKM_EV_LCL_REP_LOWMEM, // Notification of LowMemory detection
+ TSKM_EV_LCL_REQ_TRANS_STEP, // Gradual transitioning request
+} TSKM_EVENT_t;
+
+#define TSKM_EV_BOOTINFO_SIZE sizeof(T_SS_SM_START_DataStructType)
+#define TSKM_EV_EXTBOOTINFO_SIZE sizeof(T_SS_SM_START_ExtDataStructType)
+
+typedef struct {
+ TSKM_SVCID_t svcId;
+ TSKM_LOCAL_STEP_t localStep;
+ char bootInfo[TSKM_EV_BOOTINFO_SIZE];
+ char extBootInfo[TSKM_EV_EXTBOOTINFO_SIZE];
+ TSKM_BOOL_t isDynamic; // Nonresident task?
+} TSKM_EV_PRI_REQ_WAKEUP_PRM_t;
+
+typedef struct {
+ TSKM_LOCAL_STEP_t localStep;
+} TSKM_EV_PRI_REQ_DOWN_PRM_t;
+
+// PRI->TSKM
+typedef struct {
+ uint64_t compId;
+} TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t;
+
+typedef struct {
+ uint64_t compId;
+} TSKM_EV_PRI_REP_DOWN_COMP_PRM_t;
+
+typedef struct {
+ int connFd;
+} TSKM_EV_PRI_REP_CONNECT_PRM_t;
+
+typedef struct {
+ TSKM_BOOL_t isLast;
+ TSKM_BOOL_t isShmDone;
+ TSKM_BOOL_t isStepDone;
+} TSKM_EV_PRI_RES_WAKEUP_PRM_t;
+
+typedef struct {
+ TSKM_BOOL_t isLast;
+} TSKM_EV_PRI_RES_DOWN_PRM_t;
+
+#define TSKM_EV_DEBUGDUMP_SIZE 4096
+
+typedef struct {
+ char dumpMsg[TSKM_EV_DEBUGDUMP_SIZE];
+} TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t;
+
+// APL->TSKM
+
+// Internal message
+typedef struct {
+ TSKM_SVCID_t svcId;
+} TSKM_EV_LCL_CHG_SVC_STATE_PRM_t;
+
+// The structure must be on a stack
+typedef struct _TSKM_EVENT_INFO_t {
+ TSKM_EVENT_t event;
+ TSKM_ERR_t errCode;
+ pid_t fromPid;
+ TSKM_BOOL_t hasExtend;
+ uint32_t extendSize;
+ void *extendPrm;
+ union {
+ // TSKM->PRI
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
+ TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
+
+ // PRI->TSKM
+ TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
+ TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
+ TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
+ TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
+ TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
+
+ // Internal message
+ TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
+ } prm;
+ _TSKM_EVENT_INFO_t() {
+ event = TSKM_EV_NOP;
+ errCode = TSKM_E_OK;
+ fromPid = 0;
+ hasExtend = TSKM_FALSE;
+ extendSize = 0;
+ extendPrm = NULL;
+ }
+ ~_TSKM_EVENT_INFO_t() {
+ if (hasExtend && !extendPrm) {
+ free(extendPrm);
+ }
+ }
+} TSKM_EVENT_INFO_t;
+
+typedef enum {
+ TSKM_DATAINIT_REQ = 800,
+ TSKM_DATAINIT_RESP,
+ TSKM_TRANS_STEP_REQ
+} TSKM_PROTCOL_t;
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_LOCAL_TYPE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/server/include/system_service/tskm_svc.h b/systemservice/task_manager/server/include/system_service/tskm_svc.h
new file mode 100755
index 0000000..8b25581
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/tskm_svc.h
@@ -0,0 +1,904 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_svc.h
+ * @brief \~english define of tskm
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
+
+
+#include <unistd.h>
+#include <sys/types.h>
+#include "system_service/tskm_local_type.h"
+
+
+#define TSKM_SVC_WAIT_REQ_MAX (8) // Number of queued requests
+
+// Service type
+typedef enum {
+ TSKM_SVC_TYPE_NATIVE, //
+ TSKM_SVC_TYPE_UNKNONW, //
+} TSKM_SVC_TYPE_t;
+
+// Scheduling policy
+typedef enum {
+ TSKM_SVC_POLICY_TSS, //
+ TSKM_SVC_POLICY_RR, //
+ TSKM_SVC_POLICY_FIFO, //
+} TSKM_SVC_POLICY_t;
+
+// Life cycle
+typedef enum {
+ TSKM_SVC_LC_ALWAYS, // Resident
+ TSKM_SVC_LC_ALWAYS_RECOVERABLE, // Resident(Recoverable)
+ TSKM_SVC_LC_DYNAMIC // Non-resident
+} TSKM_SVC_LC_t;
+
+// CPU allocation: This defined value should match the specification of the second argument of CL_ProcessCreateAttrSetCpuAssign
+
+typedef enum {
+ TSKM_SVC_ASSIGN_CPU_AUTO = 0, // Automatic allocation
+ TSKM_SVC_ASSIGN_CPU_0 = 1, // Fixed to CPU0
+ TSKM_SVC_ASSIGN_CPU_1 = 2, // Fixed to CPU1
+} TSKM_SVC_ASSIGN_CPU_t;
+
+// Service attributes (given by XML)
+typedef struct {
+ TSKM_SVCID_t svcId; //
+ const char* name; //
+ const char* path; //
+ char** args; //
+ TSKM_SVC_TYPE_t type; //
+ uint32_t prio; //
+ TSKM_SVC_POLICY_t policy; //
+ TSKM_SVC_LC_t lifeCycle; //
+ uint32_t retryCnt; //
+ TSKM_SVC_ASSIGN_CPU_t cpuAssign; //
+ const char* user; //
+ uint32_t runtimeLimit; //
+ uint32_t cpuLimit; //
+ uint32_t memLimit; //
+ TSKM_BOOL_t shotdownWait; //
+ uint32_t subgidNum; //
+ gid_t *subgidList; //
+} TSKM_SVC_ATTR_t;
+
+// Service status
+typedef enum {
+ TSKM_SVC_DORMANT, // During dormant (Not exec)
+ TSKM_SVC_WAITCONNECT, // Wait for connection
+ TSKM_SVC_WAKEUP, // Start in progress
+ TSKM_SVC_RUNNING, // Running (Startup completed)
+ TSKM_SVC_DOWN, // Termination in progress
+ TSKM_SVC_FINDOWN, // Termination completed
+ TSKM_SVC_DISABLE, // Prohibitting startup (exec prohibited)
+} TSKM_SVC_STATE_t;
+
+// Service
+typedef struct { // Life cycle
+ TSKM_SVC_ATTR_t *attr; // Service Attributes ALL
+ TSKM_SVC_STATE_t state; // Service State ALL
+ int iFd; // inotifyFd for touch ALL
+ pid_t pid; // PID of service REQ_WAKEUP - FIN_DOWN
+ int connFd; // service communication socket DO_WAKEUP - FIN_DOWN
+ T_SS_SM_START_DataStructType bootInfo; // Boot info REQ_WAKEUP - FIN_DOWN
+ T_SS_SM_START_ExtDataStructType extBootInfo; // Extended boot info REQ_WAKEUP - FIN_DOWN
+
+ TSKM_BOOL_t isShmDone; // Shared memory initialization completed
+ TSKM_BOOL_t isStepDone; // Gradual startup completed
+ TSKM_BOOL_t isAvailable; // Availability reception completed
+
+ uint32_t watchCnt; // Service monitoring counter
+ uint32_t waitResCnt; // Wait for response to request DO_WAKEUP - WAIT_WAKEUP
+ uint32_t waitReqCnt; // Wait for request issuance REQ_WAKEUP - DO_WAKEUP
+ TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX]; // REQ_WAKEUP - DO_WAKEUP
+
+ uint32_t errTermCnt; // Number of abnormal terminations ALL
+} TSKM_SVC_CTX_t;
+
+// Service list
+typedef struct {
+ uint32_t svcNum;
+ TSKM_SVC_CTX_t *svcList;
+} TSKM_SVCS_CTX_t;
+
+// State of waiting for service termination
+typedef enum {
+ TSKM_SVC_WAIT_NONE, // No wait
+ TSKM_SVC_WAIT_TRANSIENT, // Waiting for termination of nonresident service
+ TSKM_SVC_WAIT_BOTH, // Waiting for termination of resident/nonresident service
+} TSKM_SVC_WAIT_STATE_t;
+
+// Service list
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsEventHandle
+ /// \~english @par Summary
+ ///
+ /// \~english @param
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_inEv
+ /// p_inEv - pointer of input event info
+ /// \~english @par
+ /// p_inEv TSKM_EVENT_INFO_t*
+ /// \~english @code
+ /// typedef struct _TSKM_EVENT_INFO_t {
+ /// TSKM_EVENT_t event;
+ /// TSKM_ERR_t errCode;
+ /// pid_t fromPid;
+ /// TSKM_BOOL_t hasExtend;
+ /// uint32_t extendSize;
+ /// void *extendPrm;
+ /// union {
+ /// // TSKM->PRI
+ /// TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
+ /// TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
+ /// // PRI->TSKM
+ /// TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
+ /// TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
+ /// TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
+ /// TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
+ /// TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
+ /// TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
+ /// } prm;
+ /// } TSKM_EVENT_INFO_t;
+ /// @endcode
+ /// \~english @param [out] p_outEv
+ /// p_outEv - pointer of output event info
+ /// \~english @par
+ /// p_outEv TSKM_EVENT_INFO_t*
+ /// \~english @retval
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// -
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ ///
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsEventHandle(TSKM_SVCS_CTX_t* p_svcs,
+ const TSKM_EVENT_INFO_t* p_inEv,
+ TSKM_EVENT_INFO_t* p_outEv);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsGetSvcBySvcId
+ /// \~english @par Summary
+ /// find service in inputed service list by service id.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services object
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] svcId
+ /// svcId - service Id
+ /// \~english @par
+ /// svcId uint32_t
+ /// \~english @retval TSKM_SVC_CTX_t* service pointer
+ /// \~english @retval TSKM_SVC_CTX_t* NULL
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If not find svcId in services list. [NULL]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// find service in inputed service list by service id.. If do not find then return NULL pointer.
+ /// \~english @see getSvcCtxBySvcId
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_SVC_CTX_t* tskm_svcsGetSvcBySvcId(TSKM_SVCS_CTX_t* p_svcs,
+ TSKM_SVCID_t svcId);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsGetSvcByPid
+ /// \~english @par Summary
+ /// find service in inputed service list by process id.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] pid
+ /// pid - process id
+ /// \~english @par
+ /// pid pid_t
+ /// \~english @retval TSKM_SVC_CTX_t* service pointer
+ /// \~english @retval TSKM_SVC_CTX_t* NULL
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If not find process id in services list. [NULL]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// find service in inputed service list by process id. If do not find then return NULL pointer.
+ /// \~english @see getSvcCtxByPid
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_SVC_CTX_t* tskm_svcsGetSvcByPid(TSKM_SVCS_CTX_t* p_svcs, pid_t pid);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsIsWaiting
+ /// \~english @par Summary
+ /// Is the service state waiting.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_BOOL_t
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If service state is TSKM_SVC_WAITCONNECT and wait response num is 0. [TSKM_FALSE]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Is the service state waiting. \n
+ /// There are not service's state equal TSKM_SVC_WAITCONNECT or wait respose number > 0 return TSKM_TRUE.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_BOOL_t tskm_svcsIsWaiting(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsGetSvcTermWaitState
+ /// \~english @par Summary
+ /// Get the service which state equanl not equal terminal.
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_SVC_WAIT_STATE_t
+ /// \~english @par
+ /// TSKM_SVC_WAIT_STATE_t enum
+ /// \~english @code
+ /// typedef enum {
+ /// TSKM_SVC_WAIT_NONE, // not waiting state
+ /// TSKM_SVC_WAIT_TRANSIENT, // dynamic service terminal waiting state
+ /// TSKM_SVC_WAIT_BOTH, // no dynamic/ dyanmic service terminal waiting state
+ /// } TSKM_SVC_WAIT_STATE_t;
+ /// @endcode
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// If all services state equal TSKM_SVC_DORMANT. [TSKM_SVC_WAIT_NONE]
+ /// If dynamic service. [TSKM_SVC_WAIT_TRANSIENT]
+ /// If not dynamic service and state not TSKM_SVC_FINDOWN. [TSKM_SVC_WAIT_BOTH]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Get the service which state equanl not equal terminal. \n
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_SVC_WAIT_STATE_t tskm_svcsGetSvcTermWaitState(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsSetBootInfo
+ /// \~english @par Summary
+ /// initialize all services boot info.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_info
+ /// p_info - SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message pointer
+ /// \~english @par
+ /// p_info T_SS_SM_START_DataStructType*
+ /// \~english @code
+ /// Data passed as part of SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message
+ /// typedef struct T_SS_SM_START_DataStruct {
+ /// EPWR_WAKEUP_FACTOR_TYPE startupReason;
+ /// BOOL isUserModeOn;
+ /// ESMDataResetModeInfo dataResetMode;
+ /// EPWR_SC_SECURITY_STATUS securityStatus;
+ /// EPWR_SC_WAKEUP_TYPE wakeupType;
+ /// ESMDramBackupStatus dramBackupStatus;
+ /// ESMResetStatus resetStatus;
+ /// UI_32 errResetCount;
+ /// T_SS_SM_START_DataStruct
+ /// } T_SS_SM_START_DataStructType;
+ /// @endcode
+ /// \~english @param [in] p_exInfo
+ /// p_exInfo - FrameworkunifiedOnStart extend info pointer
+ /// \~english @par
+ /// p_exInfo T_SS_SM_START_ExtDataStructType*
+ /// \~english @code
+ /// /// Extended Parameter for FrameworkunifiedOnStart
+ /// typedef struct {
+ /// BOOL isProgUpdated;
+ /// EMRelaunchStatus relaunchStatus;
+ /// BOOL isMapUpdated;
+ /// BOOL isMapDiffUpdated;
+ /// uint8_t reserved[SS_SM_START_EXT_RSV_SIZE];
+ /// } T_SS_SM_START_ExtDataStructType;
+ /// @endcode
+ /// \~english @retval TSKM_E_OK
+ /// \~english @par
+ /// TSKM_SVC_WAIT_STATE_t enum
+ /// \~english @par Preconditions
+ /// - call tskm_dataInitAll() to get boot info
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - pulbic
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// - initialize all services boot info.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsSetBootInfo(TSKM_SVCS_CTX_t* p_svcs,
+ T_SS_SM_START_DataStructType* p_info,
+ T_SS_SM_START_ExtDataStructType *p_exInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsAvtiveSvcTerm
+ /// \~english @par Summary
+ /// Terminal the dynamic services.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - tskm_svcDownRequest return failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - pulbic
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Terminal all the dynamic services which state equal TSKM_SVC_RUNNING and response num equal 0. \n
+ /// \~english @see tskm_svcDownRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsAvtiveSvcTerm(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsCallDebugDump
+ /// \~english @par Summary
+ /// Send DebugDump message to services.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - tskm_sockSend send DebugDump message failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Send DebugDump message to services which state equal TSKM_SVC_RUNNING. \n
+ /// \~english @see tskm_sockSend
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsCallDebugDump(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsCallLowMem
+ /// \~english @par Summary
+ /// Send checking low memory message to services.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - tskm_sockSend send LowMemory message failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Send checking LowMemory message to services which state equal TSKM_SVC_RUNNING. \n
+ /// \~english @see tskm_sockSend
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsCallLowMem(TSKM_SVCS_CTX_t* p_svcs);
+
+// Service
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcEventHandle
+ /// \~english @par Summary
+ /// process event.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in][out] p_ev
+ /// p_ev - event info pointer
+ /// \~english @par
+ /// p_ev TSKM_EVENT_INFO_t*
+ /// \~english @code
+ /// typedef struct _TSKM_EVENT_INFO_t {
+ /// TSKM_EVENT_t event;
+ /// TSKM_ERR_t errCode;
+ /// pid_t fromPid;
+ /// TSKM_BOOL_t hasExtend;
+ /// uint32_t extendSize;
+ /// void *extendPrm;
+ /// union {
+ /// // TSKM->PRI
+ /// TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
+ /// TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
+ ///
+ /// // PRI->TSKM
+ /// TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
+ /// TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
+ /// TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
+ /// TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
+ /// TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
+ /// TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
+ /// } prm;
+ /// } TSKM_EVENT_INFO_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// process event.\n
+ /// process connect response.\n
+ /// process disconnect response. \n
+ /// process service wakeup request. \n
+ /// process service down request. \n
+ /// process service debugdump request. \n
+ /// process service exit request. \n
+ /// process service terminal response. \n
+ /// \~english @see isSvcEvent,connectHandle,disConnectHandle,resWakeupHandle, \n
+ /// resDownHandle,resDebugDumpHandle,reqExit,repTermHandle \n
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcEventHandle(TSKM_SVC_CTX_t* p_svc, TSKM_EVENT_INFO_t* p_ev); // p_ev: [IN/OUT]
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcExec
+ /// \~english @par Summary
+ /// start service.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer of services
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// TSKM_E_STATE
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - input parameter p_svc is NULL. [TSKM_E_NG]
+ /// - service state is TSKM_SVC_DISABLE [TSKM_E_STATE]
+ /// - reqTouch return failed [TSKM_E_NG]
+ /// - tskm_pf_createProc return failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// start service which state is TSKM_SVC_DORMANT.\n
+ /// \~english @see svcExec, reqTouch, tskm_pf_createProc
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcExec(TSKM_SVC_CTX_t* p_svc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcWakeupRequest
+ /// \~english @par Summary
+ /// Send started request to service.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer of service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_req
+ /// p_req - pointer of request
+ /// \~english @par
+ /// p_req TSKM_GSTEP_REQ_INFO_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVCID_t svcId; // service ID
+ /// TSKM_LOCAL_STEP_t localStep; // local step id
+ /// } TSKM_GSTEP_REQ_INFO_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// TSKM_E_STATE
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Input parameter p_svc is NULL. [TSKM_E_STATE]
+ /// - Service state is TSKM_SVC_DISABLE [TSKM_E_STATE]
+ /// - wakeupRequest return failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Send started request to service. If service do not connect, save the request.\n
+ /// Send request again when service connect. \n
+ /// \~english @see svcWakeupRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcWakeupRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcDownRequest
+ /// \~english @par Summary
+ /// Send service down request to service.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_req
+ /// p_req - request pointer
+ /// \~english @par
+ /// p_req TSKM_GSTEP_REQ_INFO_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVCID_t svcId; // service ID
+ /// TSKM_LOCAL_STEP_t localStep; // local step id
+ /// } TSKM_GSTEP_REQ_INFO_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Send service down request failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// If service state is commounicated(TSKM_SVC_WAKEUP, TSKM_SVC_RUNNING), \n
+ /// send service down request and set state as TSKM_SVC_DOWN.\n
+ /// \~english @see tskm_svcIsCommunicatable,tskm_sockSend
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcDownRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcDisableRequest
+ /// \~english @par Summary
+ ///
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer of service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_STATE
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If service state is not TSKM_SVC_DORMANT and TSKM_SVC_DISABLE. [TSKM_E_STATE]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Set service state as TSKM_SVC_DISABLE if state is TSKM_SVC_DORMANT.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcDisableRequest(TSKM_SVC_CTX_t* p_svc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcDisableRequest
+ /// \~english @par Summary
+ /// Set service state as start available.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - Pointer to service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Set service state as start available which state is disable(TSKM_SVC_DISABLE).
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcEnableRequest(TSKM_SVC_CTX_t* p_svc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcIsCommunicatable
+ /// \~english @par Summary
+ /// Whether service is Communicatable.
+ /// \~english @param [in] p_svc
+ /// p_svc - pointer of service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_BOOL_t
+ /// \~english @par
+ /// TSKM_FALSE
+ /// TSKM_TRUE
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If input parameter p_svc is NULL. [TSKM_FALSE]
+ /// - If input parameter p_svc->attr->type is TSKM_SVC_TYPE_UNKNONW. [TSKM_FALSE]
+ /// - If service state is TSKM_SVC_DORMANT or TSKM_SVC_WAITCONNECT or
+ /// TSKM_SVC_FINDOWN orTSKM_SVC_DISABLE. [TSKM_FALSE]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Whether service is Communicatable. \n
+ /// If service state is TSKM_SVC_WAKEUP or TSKM_SVC_RUNNING or TSKM_SVC_DOWN, return TSKM_TRUE. \n
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_BOOL_t tskm_svcIsCommunicatable(TSKM_SVC_CTX_t* p_svc);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/server/include/system_service/tskm_type.h b/systemservice/task_manager/server/include/system_service/tskm_type.h
new file mode 100755
index 0000000..7d1f818
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/tskm_type.h
@@ -0,0 +1,123 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_type.h
+ * @brief \~english type of tskm
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_TYPE_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_TYPE_H_
+
+
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_services.h>
+#include "system_service/tskm_svcid.h"
+
+
+#define TSKM_ERR_t int32_t
+#define TSKM_E_OK 0
+#define TSKM_E_PAR 1
+#define TSKM_E_STATE 2
+#define TSKM_E_PERMIT 3
+#define TSKM_E_ALREADY 4
+#define TSKM_E_RETRY 5
+#define TSKM_E_NG 6
+
+#define TSKM_BOOL_t int32_t
+#define TSKM_TRUE 1
+#define TSKM_FALSE 0
+
+#define TSKM_RSV_t int
+
+typedef uint32_t TSKM_SVCID_t;
+// Values are defined in tskm_svcid.h
+
+typedef enum {
+ TSKM_SVC_CMD_NOP, // Do nothing
+ TSKM_SVC_CMD_EXEC, // Startup service
+ TSKM_SVC_CMD_ENABLE, // Allow service startup
+ TSKM_SVC_CMD_DISABLE, // Prohibit service startup
+ TSKM_SVC_CMD_RESERVE, // Reserve service startup
+} TSKM_SVC_CMD_t;
+
+typedef struct {
+ TSKM_SVC_CMD_t cmd;
+} TSKM_SVC_CTL_t;
+
+typedef struct {
+ TSKM_SVCID_t svcId;
+ TSKM_BOOL_t isExecDisable;
+} TSKM_SVC_INFO_t;
+
+typedef enum {
+ TSKM_BOOT_NORMAL, // Normal start
+ TSKM_BOOT_FACTRESET, // start with factory default start
+ TSKM_BOOT_USERRESET, // start with resetting user info
+ TSKM_BOOT_VERSIONUP, // start with version up
+} TSKM_BOOT_t;
+
+typedef enum {
+ TSKM_LOGGING_TYPE_MODULE_LOGS, // logging request from the service
+ TSKM_LOGGING_TYPE_GRP_RELAUNCH, // logging by Group Relaunch
+} TSKM_LOGGING_TYPE_NORMAL_t;
+
+typedef enum {
+ TSKM_ERROR_REBOOT_NORMAL, // Anomaly detection
+} TSKM_ERROR_REBOOT_TYPE_t;
+
+#define TSKM_LOGGING_MSG_STR_SIZE 64
+
+typedef struct {
+ TSKM_LOGGING_TYPE_NORMAL_t type; // Log type
+ char messageStr[TSKM_LOGGING_MSG_STR_SIZE]; // Error message
+} TSKM_LOGGING_INFO_t;
+
+typedef struct {
+ TSKM_ERROR_REBOOT_TYPE_t type; // Reboot type
+ TSKM_LOGGING_INFO_t log; // Log info
+} TSKM_ERROR_REBOOT_t;
+
+typedef enum {
+ TSKM_DATAINIT_TYPE_USER, // Reset user info
+} TSKM_DATAINIT_TYPE_t;
+
+typedef struct {
+ TSKM_DATAINIT_TYPE_t type;
+ EFrameworkunifiedStatus (*onCompInit)(HANDLE hApp);
+} TSKM_DATAINIT_t;
+
+#define TSKM_ORDER_NAME_MAX 32
+
+typedef struct {
+ char orderName[TSKM_ORDER_NAME_MAX];
+} TSKM_WAKEUP_ORDER_t;
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_TYPE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/server/include/tskm_comm.h b/systemservice/task_manager/server/include/tskm_comm.h
new file mode 100755
index 0000000..c884be9
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_comm.h
@@ -0,0 +1,59 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Communication module header file
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_COMM_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_COMM_H_
+
+#include <sys/types.h>
+#include "system_service/tskm_local_type.h"
+
+#define TSKM_SOCKET_NAME "/tmp/tskm_sock" // Sockets for Primary Library
+
+#define TSKM_COMM_CONNECT_MAX (32)
+
+typedef struct {
+ pid_t pid;
+ int connFd;
+} TSKM_SRV_CONNENT_t;
+
+typedef struct {
+ uint32_t num;
+ TSKM_SRV_CONNENT_t conn[TSKM_COMM_CONNECT_MAX];
+} TSKM_SRV_CONNENT_LIST_t;
+
+typedef struct {
+ int sockFd;
+ const char *sockName;
+ TSKM_SRV_CONNENT_LIST_t connList;
+} TSKM_SRV_SOCK_CTX_t;
+
+TSKM_ERR_t tskm_srvSockCreate(const char* sockName,
+ TSKM_SRV_SOCK_CTX_t* p_sock);
+TSKM_SRV_CONNENT_t* tskm_srvSockConnect(TSKM_SRV_SOCK_CTX_t* p_sock);
+void tskm_srvSockDisconnect(TSKM_SRV_SOCK_CTX_t* p_sock,
+ TSKM_SRV_CONNENT_t *p_conn);
+void tskm_srvSockDestory(TSKM_SRV_SOCK_CTX_t* p_sock);
+int tskm_cliSockConnect(const char* sockName);
+int tskm_sockRcv(int fd, TSKM_EVENT_INFO_t* p_ev);
+int tskm_sockSend(int fd, TSKM_EVENT_INFO_t* p_ev);
+void tskm_sockDestory(int fd);
+
+int tskm_comm_procInit(void);
+int tskm_comm_setSvcWatchState(uint32_t id, BOOL bIsRun, uint32_t timeout);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_COMM_H_
+
diff --git a/systemservice/task_manager/server/include/tskm_debug.h b/systemservice/task_manager/server/include/tskm_debug.h
new file mode 100755
index 0000000..ae963a8
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_debug.h
@@ -0,0 +1,208 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_DEBUG_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_DEBUG_H_
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <native_service/ns_logger_if.h>
+#include "system_service/tskm_svc.h"
+
+#include "system_service/tskm_local_type.h"
+
+#define TSKM_STATIC static
+
+// for frameworkunifiedlog
+#define ZONE_INIT ZONEMASK(10) // Reserved for lib
+#define ZONE_FUNC ZONEMASK(11) // Reserved for lib
+#define ZONE_MEM ZONEMASK(12) // Reserved for lib
+#define ZONE_OUT ZONEMASK(13)
+#define ZONE_STATE ZONEMASK(14) // Basic state change
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29) // Reserved for lib
+#define ZONE_WARN ZONEMASK(30) // Reserved for lib
+#define ZONE_ERR ZONEMASK(31) // Reserved for lib
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT|LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_OUT, ZONE_WARN, ZONE_ERR, ZONE_STATE, ZONE_PERFORMANCE, ZONE_SYSTEMDATA
+/*
+ ZONE_NS_FUNC,\
+ ZONE_NS_DIS,\
+ ZONE_NS__CWORD77_,\
+ ZONE_NS_IMP_INFO,\
+ ZONE_NS_SM_DEV_INFO,\
+ ZONE_NS_SM_USR_INFO,\
+ ZONE_NS_INFO,\
+ ZONE_NS_DEBUG_DUMP,\
+ ZONE_NS_WAR ,\
+ ZONE_NS_ERR ,\
+ ZONE_DEBUG_DUMP
+ */
+#endif
+
+#define TSKM_LOG_ERROR 0x00000001U
+#define TSKM_LOG_STATE 0x00000002U
+#define TSKM_LOG_DEBUG 0x00000004U
+#define TSKM_LOG_API 0x00000008U
+#define TSKM_LOG_PORTPF 0x00000010U
+#define TSKM_LOG_FUNC 0x00000020U
+#define TSKM_LOG_MSG 0x00000040U
+#define TSKM_LOG_WARN 0x00000080U
+#define TSKM_LOG_SVCSTATE 0x00000100U
+#define TSKM_LOG_SYSTEMDATA 0x00000200U
+
+// For debugging
+#define TSKM_LOG_CUSTUM (0 \
+ )
+/*
+ |TSKM_LOG_MSG \
+ |TSKM_LOG_DEBUG \
+ |TSKM_LOG_FUNC \
+ |TSKM_LOG_PORTPF \
+ */
+
+typedef enum {
+ TSKM_LOG_TYPE_TEXT,
+ TSKM_LOG_TYPE_PLACE,
+} TSKM_LOG_TYPE_t;
+
+#define TSKM_DEFAULT_PRINTF(flag, fmt, ...) { \
+ switch (flag) { \
+ case TSKM_LOG_SYSTEMDATA: \
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSTEMDATA, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_API: \
+ case TSKM_LOG_STATE: \
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_ERROR: \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_WARN: \
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_DEBUG: \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_MSG: \
+ case TSKM_LOG_FUNC: \
+ case TSKM_LOG_PORTPF: \
+ default: \
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ } \
+ }
+
+#define TSKM_PRINTF(flag, fmt, ...) { \
+ if (TSKM_LOG_SVCSTATE == flag) { \
+ /* Logs at startup and termination */ \
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, fmt, ## __VA_ARGS__); \
+ } else if (TSKM_LOG_CUSTUM & flag) { \
+ /* Logging by STATE when CUSTUM is specified */ \
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, fmt, ## __VA_ARGS__); \
+ } else { \
+ TSKM_DEFAULT_PRINTF(flag, fmt, ## __VA_ARGS__); \
+ } \
+ }
+
+#define TSKM_ASSERT(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TSKM_ASSERT"); \
+ }
+
+#define TSKM_ASSERT_ERRNO(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TSKM_ASSERT %d:%s", errno, strerror(errno)); \
+ }
+
+#define TSKM_ASSERT_PRINT(x, fmt, ...) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TSKM_ASSERT:" fmt, ## __VA_ARGS__); \
+ }
+
+#define TSKM_STATIC_ASSERT(expr) \
+ { \
+ char STATIC_ASSERTION_FAILED[(expr) ? 1 : -1]; \
+ (void)STATIC_ASSERTION_FAILED; \
+ }
+
+#define TSKM_DUMP(addr, size) { \
+ char* buf = (char*)addr; /* NOLINT (readability/casting) */ \
+ int ii; \
+ printf("[DUMP] %s:%d addr:%p size:%d", __FUNCTION__, __LINE__, addr, size); \
+ for (ii=0 ; ii < size ; ii++) { \
+ if (ii%16 == 0) printf(" "); \
+ if (ii%32 == 0) printf("\n"); \
+ printf("%02x", buf[ii]); \
+ } \
+ printf("\n"); \
+ }
+
+#define TSKM_FUNC_IN() TSKM_PRINTF(TSKM_LOG_FUNC, "%s:IN", __FUNCTION__)
+
+#define TSKM_FUNC_OUT() TSKM_PRINTF(TSKM_LOG_FUNC, "%s:OUT", __FUNCTION__)
+
+const char* tskm_convState2Str(TSKM_STATE_t state);
+const char* tskm_convLocalStep2Str(TSKM_LOCAL_STEP_t localStep);
+const char* tskm_convEvent2Str(TSKM_EVENT_t event);
+const char* tskm_convInitCompId2Str(uint64_t compId);
+const char* tskm_convTermCompId2Str(uint64_t compId);
+const char* tskm_convSvcState2Str(TSKM_SVC_STATE_t state);
+void tskm_svcsDump(TSKM_SVCS_CTX_t* p_svcs);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_DEBUG_H_
diff --git a/systemservice/task_manager/server/include/tskm_main.h b/systemservice/task_manager/server/include/tskm_main.h
new file mode 100755
index 0000000..24ba5f1
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_main.h
@@ -0,0 +1,71 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_
+
+#include <system_service/ss_boot_map.h>
+
+#include "system_service/tskm_svc.h"
+#include "system_service/tskm_local_type.h"
+#include "tskm_comm.h"
+#include "tskm_type_local.h"
+
+typedef struct {
+ // State
+ TSKM_BOOL_t isExec; // Executing flag
+ TSKM_STATE_t state; // TSKM state
+
+ // API
+ TSKM_BOOL_t inApi; // API running
+ TSKM_ERR_t apiRet; // API return
+ TSKM_BOOL_t isReboot; // REBOOT request
+
+ TSKM_BOOL_t isOnStartDone; // System start process completion flag
+ TSKM_BOOL_t isOnStopDone; // System stop process completion flag
+
+ // Communication
+ TSKM_SRV_SOCK_CTX_t sock; // priLib socket
+ int sigFd; // signalFd(process-termination-detection)
+ HANDLE hApp; // DispatcherHandle
+ int nsFd; // For receiving from the NSFW
+ int iFd; // inotify FDs
+ int resmFd; // EV FDs of RESM
+
+ // Non-volatile info
+ TSKM_NV_INFO_t nvInfo; // Non-volatile information
+
+ // Startup info
+ T_SS_SM_START_DataStructType bootInfo; // for Pri notification
+ T_SS_SM_START_ExtDataStructType extBootInfo; // for Pri notification
+
+ // Analysis support
+ STATEMGR__CWORD69_LOG* p__CWORD69_Log; // BUGBUG: Required or not
+
+ // Services management
+ TSKM_SVCS_CTX_t svcs;
+
+ // Gradual starting state management
+ TSKM_GSTEP_CTX_t wakeup;
+
+ // Gradual terminating state management
+ TSKM_GSTEP_CTX_t down;
+} TSKM_MAIN_CTX_t;
+
+EFrameworkunifiedStatus OnStart(const HANDLE hApp); // System start process
+TSKM_MAIN_CTX_t* tskm_getMainCtx(void);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_
diff --git a/systemservice/task_manager/server/include/tskm_port_pf.h b/systemservice/task_manager/server/include/tskm_port_pf.h
new file mode 100755
index 0000000..31da5ab
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_port_pf.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_PF_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_PF_H_
+
+#include <native_service/cl_process.h>
+
+#include "system_service/tskm_svc.h"
+#include "system_service/tskm_local_type.h"
+#include "tskm_main.h"
+
+int tskm_pf_sysInit();
+int tskm_pf_procInit();
+pid_t tskm_pf_createProc(TSKM_SVC_ATTR_t* p_svcAttr);
+int tskm_pf_cleanupProc(int sigFd, pid_t* p_pid, TSKM_ERR_t* p_err);
+int tskm_pf_terminateProcGroup(uint16_t pid);
+int tskm_pf_shmCreate(const char* name, int32_t size, void** p_addr);
+int tskm_pf_shmDelete(const char* name);
+int tskm_pf_createThread(void* (*threadFunc)(void*), void* prm,
+ uint32_t priority, const char* threadName,
+ pthread_t* p_thId);
+int tskm_pf_sendStopCompResp();
+int tskm_pf_abort();
+int tskm_pf_exit(int status);
+int tskm_pf_touch(char* path);
+int tskm_pf_mkTouchFileName(pid_t pid, char name[32]);
+int tskm_pf_nvFileInit(HANDLE hApp);
+int tskm_pf_nvFileRead(HANDLE hApp, TSKM_NV_INFO_t* p_nvInfo);
+int tskm_pf_nvFileWrite(const TSKM_NV_INFO_t* p_nvInfo);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_PF_H_
+
diff --git a/systemservice/task_manager/server/include/tskm_port_subsys.h b/systemservice/task_manager/server/include/tskm_port_subsys.h
new file mode 100755
index 0000000..3dc3565
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_port_subsys.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_SUBSYS_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_SUBSYS_H_
+
+#include "system_service/tskm_local_type.h"
+#include "tskm_main.h"
+
+typedef struct {
+ pid_t pid;
+ uint8_t type; // CL_MonitorType_t
+} TSKM_HUNG_INFO_t;
+
+int tskm_sub_init(void);
+int tskm_sub_term(void);
+void tskm_sub_reboot(const TSKM_ERROR_REBOOT_t* p_info);
+void tskm_sub_reboot_normal(void);
+void tskm_sub_logging(const TSKM_LOGGING_INFO_t* p_info);
+void tskm_sub_debugDumpRes(BOOL bIsNeedSvcName, const char *p_dumpMsg);
+int tskm_sub_getExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info);
+
+TSKM_HUNG_INFO_t *tskm_sub_searchHungSvcs();
+int tskm_sub_resmInit();
+int tskm_sub_resmRcv(TSKM_EVENT_INFO_t* p_ev);
+int tskm_sub_setWakeupOrder(const char* p_order);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_SUBSYS_H_
+
diff --git a/systemservice/task_manager/server/include/tskm_shutdown.h b/systemservice/task_manager/server/include/tskm_shutdown.h
new file mode 100755
index 0000000..bb76d3c
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_shutdown.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_SHUTDOWN_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_SHUTDOWN_H_
+
+#include "tskm_main.h"
+
+TSKM_ERR_t tskm_entryDown(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitDown(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_handleDown(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_SHUTDOWN_H_
+
diff --git a/systemservice/task_manager/server/include/tskm_state.h b/systemservice/task_manager/server/include/tskm_state.h
new file mode 100755
index 0000000..748d25e
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_state.h
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_STATE_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_STATE_H_
+
+#include "system_service/tskm_local_type.h"
+#include "system_service/tskm_type.h"
+#include "tskm_main.h"
+
+#define TSKM_SUB_STATE_IS(p_main, subState) \
+ (((p_main)->state & subState) == subState) // NOLINT (runtime/references)
+
+// Public functions
+TSKM_ERR_t tskm_entryState(TSKM_MAIN_CTX_t* p_rec, TSKM_STATE_t state);
+TSKM_ERR_t tskm_exitState(TSKM_MAIN_CTX_t* p_rec, TSKM_STATE_t state);
+TSKM_ERR_t tskm_stateTransit(TSKM_MAIN_CTX_t* p_main, TSKM_STATE_t srcState,
+ TSKM_STATE_t dstState);
+void tskm_handleEvent(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+TSKM_ERR_t tskm_handleAccon(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_STATE_H_
diff --git a/systemservice/task_manager/server/include/tskm_wakeup.h b/systemservice/task_manager/server/include/tskm_wakeup.h
new file mode 100755
index 0000000..d4a1193
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_wakeup.h
@@ -0,0 +1,26 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_WAKEUP_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_WAKEUP_H_
+
+#include "tskm_main.h"
+
+TSKM_ERR_t tskm_entryWakeup(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitWakeup(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_handleWakeup(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_WAKEUP_H_
diff --git a/systemservice/task_manager/server/include/tskm_watch.h b/systemservice/task_manager/server/include/tskm_watch.h
new file mode 100755
index 0000000..d1aced5
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_watch.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_WATCH_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_WATCH_H_
+
+#include "tskm_main.h"
+
+int tskm_watch_startTimer();
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_WATCH_H_
+
diff --git a/systemservice/task_manager/server/src/pri_main.cpp b/systemservice/task_manager/server/src/pri_main.cpp
new file mode 100755
index 0000000..2c87623
--- /dev/null
+++ b/systemservice/task_manager/server/src/pri_main.cpp
@@ -0,0 +1,840 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "pri_main.h"
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+#include <sys/eventfd.h>
+#include <stdlib.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <system_service/ss_system_if.h>
+
+#include "tskm_debug.h"
+#include "tskm_comm.h"
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+#include "tskm_util.h"
+
+
+
+#define PRI_PROC_NAME_MAX 32
+
+// Context
+typedef struct {
+ T_PRIM_PRM prm;
+
+ TSKM_SVCID_t svcId; // Set valid value by REQ_WAKEUP
+ char procName[PRI_PROC_NAME_MAX];
+ // State
+ TSKM_BOOL_t isExec;
+ T_SS_SM_START_DataStructType bootInfo;
+ T_SS_SM_START_ExtDataStructType extBootInfo; TSKM_BOOL_t isDynamic;
+ uint32_t wakeupStepDone; // Executed local step
+ TSKM_BOOL_t shmDone;
+ uint32_t downStepDone; // Executed local step
+ TSKM_BOOL_t isExitStart;
+
+#define PRI_MONITOR_DEFAULT_TIMEOUT 50
+ uint32_t timeout; // Service monitoring timeout period (valid only for the INI_Main type service)
+
+ // Resources
+ int connFd; // TSKM communication socket
+ int nsFd; // NSFW socket
+ int pipeFd[2]; // for exitDone
+ HANDLE hApp; // appHandle
+} PRI_CTX_t;
+
+static PRI_CTX_t g_pri;
+
+/*********************************************
+ * Create shared memory
+ *********************************************/
+TSKM_STATIC void shmMake(PRI_CTX_t* p_ctx) {
+ const PRIM_SHAREDATA_TBL* shmEntry;
+ for (shmEntry = p_ctx->prm.shmTbl; shmEntry->shmName[0] != '\0'; shmEntry++) {
+ int ret;
+ ret = tskm_pf_shmCreate(shmEntry->shmName, shmEntry->size, NULL);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+ }
+ p_ctx->shmDone = TSKM_TRUE;
+ return;
+
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************
+ * Call backup check CB
+ *********************************************/
+TSKM_STATIC uint32_t wakeupExFuncCallback(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ const PRIM_EXFUNC_TBL* funcEntry;
+ uint32_t maxStep = 0;
+
+ for (funcEntry = p_ctx->prm.wakeupExFuncTbl; funcEntry->localStep != 0;
+ funcEntry++) {
+ if (funcEntry->localStep == p_prm->localStep) {
+ funcEntry->func(funcEntry->prm);
+ }
+ maxStep = TSKM_MAX(maxStep, funcEntry->localStep);
+ }
+ return maxStep;
+}
+
+/*********************************************
+ * Gradual startup request
+ *********************************************/
+TSKM_STATIC void wakeupRequest(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t prm = *p_prm;
+ uint32_t max = 0;
+
+ // Execute step by step
+ for (prm.localStep = p_ctx->wakeupStepDone + 1;
+ (prm.localStep <= p_prm->localStep && prm.localStep < PRIM_STEPFORK_MAX);
+ prm.localStep++) {
+ max = wakeupExFuncCallback(p_ctx, &prm);
+ }
+
+ if (max <= p_prm->localStep) {
+ // Completed gradual startup
+ p_ctx->wakeupStepDone = PRIM_STEPFORK_MAX;
+ } else {
+ p_ctx->wakeupStepDone = p_prm->localStep;
+ }
+}
+
+/*********************************************
+ * All startup requests
+ *********************************************/
+TSKM_STATIC void allWakeup(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ if (!p_ctx->shmDone) {
+ shmMake(p_ctx);
+ }
+
+ if (p_ctx->wakeupStepDone < PRIM_STEPFORK_MAX) {
+ wakeupRequest(p_ctx, p_prm);
+ }
+}
+
+/*********************************************
+ * Startup request handles
+ *********************************************/
+TSKM_STATIC void wakeupRequestHandle(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+
+ bzero(&ev, sizeof(ev));
+
+ p_ctx->svcId = p_prm->svcId;
+ memcpy(&p_ctx->bootInfo, &p_prm->bootInfo, sizeof(p_ctx->bootInfo));
+ memcpy(&p_ctx->extBootInfo, &p_prm->extBootInfo, sizeof(p_ctx->extBootInfo));
+ p_ctx->isDynamic = p_prm->isDynamic;
+
+ if (p_prm->localStep == TSKM_LSTEP_ALL) {
+ allWakeup(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_LAST) {
+ wakeupRequest(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_SHM) {
+ shmMake(p_ctx);
+ } else {
+ wakeupRequest(p_ctx, p_prm);
+ }
+
+ ev.prm.resWakeup.isShmDone = p_ctx->shmDone;
+ ev.prm.resWakeup.isStepDone =
+ (p_ctx->wakeupStepDone >= PRIM_STEPFORK_MAX) ?
+ TSKM_TRUE :
+ TSKM_FALSE;
+
+ // LCOV_EXCL_BR_START 6: Because it depends on the test order
+ if (ev.prm.resWakeup.isShmDone && ev.prm.resWakeup.isStepDone) {
+ // LCOV_EXCL_BR_STOP
+ ev.prm.resWakeup.isLast = TSKM_TRUE;
+ }
+
+ ev.event = TSKM_EV_PRI_RES_WAKEUP;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+}
+
+/*********************************************
+ * Gradual termination callback
+ *********************************************/
+TSKM_STATIC uint32_t downExFuncCallback(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ const PRIM_EXFUNC_TBL* funcEntry;
+ uint32_t maxStep = 0;
+
+ for (funcEntry = p_ctx->prm.downExFuncTbl; funcEntry->localStep != 0;
+ funcEntry++) {
+ if (funcEntry->localStep == p_prm->localStep) {
+ funcEntry->func(funcEntry->prm);
+ }
+ maxStep = TSKM_MAX(maxStep, funcEntry->localStep);
+ }
+ return maxStep;
+}
+
+/*********************************************
+ * Gradual termination requests
+ *********************************************/
+TSKM_STATIC void downRequest(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ TSKM_EV_PRI_REQ_DOWN_PRM_t prm = *p_prm;
+ uint32_t max = 0;
+
+ // Execute step by step
+ for (prm.localStep = p_ctx->downStepDone + 1;
+ (prm.localStep <= p_prm->localStep && prm.localStep < PRIM_ACCOFF_MAX);
+ prm.localStep++) {
+ max = downExFuncCallback(p_ctx, &prm);
+ }
+
+ if (max <= p_prm->localStep) {
+ p_ctx->downStepDone = PRIM_ACCOFF_MAX; // Completed all steps
+ } else {
+ p_ctx->downStepDone = p_prm->localStep;
+ }
+}
+
+TSKM_STATIC void downRequestHandle(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+
+ bzero(&ev, sizeof(ev));
+
+ if (p_prm->localStep == TSKM_LSTEP_ALL || p_prm->localStep == TSKM_LSTEP_LAST) {
+ downRequest(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_SHM) {
+ TSKM_ASSERT(0);
+ } else if (p_prm->localStep == TSKM_LSTEP_BUPCHK) {
+ TSKM_ASSERT(0);
+ } else {
+ downRequest(p_ctx, p_prm);
+ }
+
+ if (p_ctx->downStepDone >= PRIM_ACCOFF_MAX) {
+ /* It is not notified when the last function is executed, and it is left to the exitDone.
+ TSKM_PRINTF(TSKM_LOG_DEBUG,"ACCOFF DONE");
+ ev.prm.resDown.isLast = TSKM_TRUE;
+ p_ctx->isExec = TSKM_FALSE;
+ ret = tskm_sockSend(p_ctx->connFd,&ev);
+ if(ret <= 0){
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ }
+ */
+ } else {
+ ev.event = TSKM_EV_PRI_RES_DOWN;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+ }
+}
+
+/*********************************************
+ * Termination completion notification to the TSKM
+ *********************************************/
+TSKM_STATIC void sendLastDoneRes(PRI_CTX_t* p_ctx) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_PRI_RES_DOWN;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.resDown.isLast = TSKM_TRUE;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+}
+
+/*********************************************
+ * Call Touch CB
+ *********************************************/
+TSKM_STATIC void touchService(PRI_CTX_t* p_ctx) {
+ char touchName[32];
+
+ if (p_ctx->isExitStart) {
+ // If termination has already begun, the system just processes as timeout for retrying not respond Touch
+ return;
+ }
+
+ p_ctx->prm.onTouch(p_ctx->hApp);
+
+ tskm_pf_mkTouchFileName(getpid(), touchName);
+
+ if ((access(touchName, F_OK) == 0)) {
+ // Synchronize by deleting files.
+ TSKM_PRINTF(TSKM_LOG_STATE, "del:%s", touchName);
+ unlink(touchName);
+ } else {
+ TSKM_ASSERT_PRINT(0, "%s", touchName);
+ }
+}
+
+/*********************************************
+ * Call Debugdump CB
+ *********************************************/
+TSKM_STATIC void callDebugDump(PRI_CTX_t* p_ctx) {
+ if (!p_ctx->prm.onDebugDump) { // LCOV_EXCL_BR_LINE 6: As NULL checked by INI_Init
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: As NULL checked by INI_Init
+ } else {
+ p_ctx->prm.onDebugDump(p_ctx->hApp);
+ }
+}
+
+/*********************************************
+ * Call LowMemory detection
+ *********************************************/
+TSKM_STATIC void callLowMem(PRI_CTX_t* p_ctx) {
+ if (!p_ctx->prm.onLowMem) {
+ TSKM_ASSERT(0);
+ } else if (!p_ctx->isExitStart) {
+ // Notify LowMemory only before starting terminating process
+ p_ctx->prm.onLowMem(p_ctx->hApp);
+ }
+}
+
+/*********************************************
+ * Event handles
+ *********************************************/
+TSKM_STATIC void eventHandle(PRI_CTX_t* p_ctx, TSKM_EVENT_INFO_t* p_ev) {
+ //Processing according to the request
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REQ_WAKEUP:
+ wakeupRequestHandle(p_ctx, &p_ev->prm.reqWakeup);
+ break;
+ case TSKM_EV_PRI_REQ_DOWN:
+ downRequestHandle(p_ctx, &p_ev->prm.reqDown);
+ break;
+ case TSKM_EV_PRI_REQ_TOUCH:
+ touchService(p_ctx);
+ break;
+ case TSKM_EV_PRI_REQ_DEBUGDUMP:
+ callDebugDump(p_ctx);
+ break;
+ case TSKM_EV_PRI_REP_LOWMEM:
+ callLowMem(p_ctx);
+ break;
+ default:
+ TSKM_ASSERT(0);
+ break;
+ }
+}
+
+/*********************************************
+ * Initialize Context
+ *********************************************/
+TSKM_STATIC void initCtx(T_PRIM_PRM* p_prm, PRI_CTX_t* p_ctx, int argc,
+ char* argv[]) {
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+
+ p_ctx->prm = *p_prm;
+
+ cbFuncs.onInitilization = p_ctx->prm.onInit;
+ cbFuncs.onDestroy = p_ctx->prm.onDestory;
+ cbFuncs.onDebugDump = p_ctx->prm.onDebugDump;
+ cbFuncs.onStart = FrameworkunifiedOnStart;
+ cbFuncs.onStop = FrameworkunifiedOnStop;
+ cbFuncs.createStateMachine = FrameworkunifiedCreateStateMachine;
+ cbFuncs.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface;
+
+ EFrameworkunifiedStatus taskmanagerRet;
+ taskmanagerRet = FrameworkunifiedCreateDispatcherWithoutLoop(p_ctx->prm.name, p_ctx->hApp, argc,
+ argv, &cbFuncs, FALSE);
+ if (eFrameworkunifiedStatusOK != taskmanagerRet) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+
+ taskmanagerRet = FrameworkunifiedGetDispatcherFD(p_ctx->hApp, &p_ctx->nsFd);
+ if (taskmanagerRet != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ exit(EXIT_FAILURE);
+ }
+ p_ctx->connFd = tskm_cliSockConnect(TSKM_SOCKET_NAME);
+ if (p_ctx->connFd < 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+ if (pipe(p_ctx->pipeFd) != 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+
+ return;
+
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************
+ * Destroy context
+ *********************************************/
+TSKM_STATIC void termCtx(PRI_CTX_t* p_ctx) {
+ if (p_ctx->shmDone) { // LCOV_EXCL_BR_LINE 6: Since it has been set to True by INI_Handler and cannot be changed
+ const PRIM_SHAREDATA_TBL* shmEntry = p_ctx->prm.shmTbl;
+ for (shmEntry = p_ctx->prm.shmTbl; shmEntry->shmName[0] != '\0';
+ shmEntry++) {
+ TSKM_ASSERT(0 == tskm_pf_shmDelete(shmEntry->shmName)); // LCOV_EXCL_BR_LINE 8: For processing in which only return value 0 is set
+ }
+ }
+
+ if (p_ctx->connFd > 0) { // LCOV_EXCL_BR_LINE 6: For processing in which only return value 0 is set
+ tskm_sockDestory(p_ctx->connFd);
+ }
+
+ EFrameworkunifiedStatus taskmanagerRet;
+ taskmanagerRet = FrameworkunifiedDestroyDispatcherWithoutLoop(p_ctx->hApp);
+ TSKM_ASSERT(taskmanagerRet == eFrameworkunifiedStatusOK);
+
+ if (p_ctx->isDynamic) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "EXIT %s", p_ctx->procName);
+ } else {
+ // Hung up running services to prevent adversely affecting to system termination processing during process termination processing
+ sleep(TSKM_CFG_WAIT_SHUTDOWN);
+ }
+}
+
+/*******************************************************************
+ * Initialize PRI context
+ *******************************************************************/
+void pri_init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum,
+ int fdlist[INI_FD_MAX]) {
+ int ret = 0;
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ strncpy(p_ctx->procName, basename(argv[0]), sizeof(p_ctx->procName) - 1);
+
+ ret = tskm_pf_procInit();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: Return value of 0 only
+ // LCOV_EXCL_START 6: Return value of 0 only
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 6: Return value of 0 only
+ }
+
+ ret = tskm_comm_procInit();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+
+ initCtx(p_prm, p_ctx, argc, argv);
+
+ *fdNum = 3;
+ fdlist[0] = p_ctx->connFd;
+ fdlist[1] = p_ctx->pipeFd[0];
+ fdlist[2] = p_ctx->nsFd;
+
+ p_ctx->svcId = TSKM_SVCID_NONE;
+ p_ctx->isExec = TSKM_TRUE;
+
+ p_ctx->bootInfo.startupReason = epswfINVALID;
+ p_ctx->bootInfo.isUserModeOn = FALSE;
+ p_ctx->bootInfo.dataResetMode = e_SS_SM_DATA_RESET_MODE_NONE;
+ p_ctx->bootInfo.securityStatus = epsssINVALID;
+ p_ctx->bootInfo.wakeupType = epsstINVALID;
+ p_ctx->bootInfo.dramBackupStatus = e_SS_SM_DRAM_BACKUP_UNSET;
+ p_ctx->bootInfo.resetStatus = e_SS_SM_RESET_STATUS_UNSET;
+
+ memset(&p_ctx->extBootInfo, 0, sizeof(p_ctx->extBootInfo));
+
+ p_ctx->timeout = PRI_MONITOR_DEFAULT_TIMEOUT;
+
+ return;
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort(); // ABORT
+// LCOV_EXCL_STOP
+}
+
+/*******************************************************************
+ * Primary library handler
+ *******************************************************************/
+BOOL pri_handler(fd_set* p_fds) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (FD_ISSET(p_ctx->connFd, p_fds)) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+ ret = tskm_sockRcv(p_ctx->connFd, &ev);
+ // LCOV_EXCL_BR_START 5: True condition is checked in Death tests, but not reflected in coverage and excluded
+ if (ret > 0) {
+ // LCOV_EXCL_BR_STOP
+ eventHandle(p_ctx, &ev);
+ } else { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (FD_ISSET(p_ctx->pipeFd[0], p_fds)) {
+ // only use exitDone
+ uint32_t tmp;
+ TSKM_ASSERT(sizeof(tmp) == read(p_ctx->pipeFd[0], &tmp, sizeof(tmp)));
+ TSKM_ASSERT(p_ctx->downStepDone == PRIM_ACCOFF_MAX); // Check if all exit functions are complete
+ if (p_ctx->isDynamic) {
+ // A nonresident service completes its termination processing by terminating the process (because the SIGNAL will overtake the sockets)
+ } else {
+ // The resident service completes termination processing with a termination notice (Do not terminate processes to reduce the impact on system termination)
+ sendLastDoneRes(p_ctx);
+ }
+ p_ctx->isExec = TSKM_FALSE;
+ }
+
+ if (FD_ISSET(p_ctx->nsFd, p_fds)) {
+ FrameworkunifiedDispatchProcessWithoutLoop(p_ctx->hApp);
+ }
+ return p_ctx->isExec;
+
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort(); // ABORT
+ return 0;
+// LCOV_EXCL_STOP
+}
+
+/*******************************************************************
+ * Process termination
+ *******************************************************************/
+void pri_term(void) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ termCtx(p_ctx);
+}
+
+/*******************************************************************
+ * Service Monitoring Status Setting
+ *******************************************************************/
+int pri_setMonitorState(BOOL bIsRun, uint32_t timeout) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ int ret = INI_SUCCESS;
+
+ if (TSKM_SVCID_NONE == p_ctx->svcId) {
+ // Ignore requests until svcId is acquired
+ } else if ((TRUE == bIsRun) && (0 == timeout)) {
+ // When RUN is specified with timeout = 0, monitoring is disabled
+ } else {
+ ret = tskm_comm_setSvcWatchState(p_ctx->svcId, bIsRun, timeout);
+ if (INI_SUCCESS != ret) {
+ TSKM_ASSERT(0);
+ }
+ }
+
+ return ret;
+}
+
+/*******************************************************************
+ * MAIN function
+ *******************************************************************/
+int pri_main(T_PRIM_PRM* p_prm, int argc, char* argv[]) {
+ int mainRet = -1;
+ int fdlist[INI_FD_MAX];
+ int fdNum;
+ int ii;
+ BOOL isExec = TRUE;
+
+ pri_init(p_prm, argc, argv, &fdNum, fdlist);
+
+ while (isExec) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ int maxFd = 0;
+ fd_set fds;
+ int ret;
+
+ FD_ZERO(&fds);
+
+ for (ii = 0; ii < fdNum; ii++) {
+ FD_SET(fdlist[ii], &fds);
+ maxFd = TSKM_MAX(fdlist[ii], maxFd);
+ }
+
+ TSKM_ASSERT(INI_SUCCESS == pri_setMonitorState(FALSE, 0));
+ ret = select(maxFd + 1, &fds, NULL, NULL, NULL);
+ TSKM_ASSERT(INI_SUCCESS == pri_setMonitorState(TRUE, p_ctx->timeout));
+ if (ret < 1) {
+ if (errno != EINTR) {
+ TSKM_ASSERT(0);
+ }
+ continue;
+ }
+
+ isExec = pri_handler(&fds);
+ }
+
+ mainRet = 0;
+
+ pri_term();
+ return mainRet;
+}
+
+/*******************************************************************
+ * Termination request
+ *******************************************************************/
+void pri_exitStart(void *rsv) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+ p_ctx->isExitStart = TRUE;
+ ev.event = TSKM_EV_PRI_REQ_EXIT;
+ ev.errCode = TSKM_E_OK;
+
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ return;
+ // LCOV_EXCL_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+void pri_exitDone(int status) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ uint32_t l_status = (uint32_t) status;
+
+ // LCOV_EXCL_BR_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ if (p_ctx->pipeFd[1] > 0) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(
+ write(p_ctx->pipeFd[1], &l_status, sizeof(l_status))
+ == sizeof(l_status));
+ // LCOV_EXCL_STOP
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ }
+}
+
+/*******************************************************************
+ * Event completion notification at startup
+ *******************************************************************/
+int32_t pri_stepForkComp(uint64_t id) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+ ev.event = TSKM_EV_PRI_REP_WAKEUP_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repWakeupComp.compId = id;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ return INI_SUCCESS;
+ ERROR: return INI_FALSE;
+}
+
+/*******************************************************************
+ * Event completion notification at termination
+ *******************************************************************/
+int32_t pri_accOffComp(uint64_t id) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_PRI_REP_DOWN_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repDownComp.compId = id;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ return INI_SUCCESS;
+ ERROR: return INI_FALSE;
+}
+
+/*******************************************************************
+ * Get private info
+ *******************************************************************/
+void*
+pri_getPrivate() {
+ PRI_CTX_t* p_ctx = &g_pri;
+ return p_ctx->prm.priv;
+}
+
+/*******************************************************************
+ * Get app-handle
+ *******************************************************************/
+HANDLE pri_getHandle() {
+ PRI_CTX_t* p_ctx = &g_pri;
+ return p_ctx->hApp;
+}
+
+/*******************************************************************
+ * Service monitoring status setting timeout setting
+ *******************************************************************/
+int32_t pri_setMonitorTimeout(uint32_t timeout) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ p_ctx->timeout = timeout;
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * Get boot info
+ *******************************************************************/
+int32_t pri_getBootInfo(T_SS_SM_START_DataStructType *info) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (p_ctx->bootInfo.startupReason == epswfINVALID) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+
+ *info = p_ctx->bootInfo;
+
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * Get extended boot info
+ *******************************************************************/
+int32_t pri_getExtBootInfo(T_SS_SM_START_ExtDataStructType *info) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (p_ctx->bootInfo.startupReason == epswfINVALID) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+
+ *info = p_ctx->extBootInfo;
+
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * DebugDump response
+ *******************************************************************/
+void pri_sendDebugDumpRes(const char *buf) { // LCOV_EXCL_START 7: Debugging code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+ TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *p_prm;
+
+ ev.event = TSKM_EV_PRI_RES_DEBUGDUMP;
+ ev.errCode = TSKM_E_OK;
+ ev.hasExtend = TSKM_TRUE;
+
+ ev.extendPrm = malloc(sizeof(TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t));
+ if (!ev.extendPrm) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ ev.extendSize = sizeof(TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t);
+
+ p_prm = (TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *) ev.extendPrm; // NOLINT (readability/casting)
+ snprintf(p_prm->dumpMsg, TSKM_EV_DEBUGDUMP_SIZE, "%s", buf);
+
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ }
+
+ ERROR: return;
+}
+// LCOV_EXCL_STOP
+/*************************************************
+ * Empty functions implemented for building software
+ **************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
diff --git a/systemservice/task_manager/server/src/tskm_api.cpp b/systemservice/task_manager/server/src/tskm_api.cpp
new file mode 100755
index 0000000..94c8226
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_api.cpp
@@ -0,0 +1,268 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_debug.h"
+#include "tskm_main.h"
+#include "tskm_state.h"
+#include "tskm_util.h"
+
+#include "tskm_srvr.h"
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+
+/**
+ * _TSKM_SvcCtl Sub-func Task-startup-process
+ * @param svcId service id
+ * @param p_main TSKM_MAIN_CTX_t*
+ * @param p_svc TSKM_SVC_CTX_t*
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+
+TSKM_ERR_t tskm_svcExecRequest(TSKM_SVCID_t svcId, TSKM_MAIN_CTX_t* p_main, TSKM_SVC_CTX_t* p_svc) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ // Startup tasks
+ TSKM_GSTEP_REQ_INFO_t req = { 0 };
+
+ if (p_main->isOnStartDone == TSKM_FALSE) {
+ TSKM_PRINTF(TSKM_LOG_WARN, "Transient SVC cannot exec before get BootInfo");
+ return TSKM_E_STATE;
+ } else if (p_main->isOnStopDone == TSKM_TRUE) {
+ TSKM_PRINTF(TSKM_LOG_WARN, "Transient SVC cannot exec after FrameworkunifiedOnStop");
+ return TSKM_E_STATE;
+ }
+
+ tskmRet = tskm_svcExec(p_svc);
+ TSKM_ERR_CHK_DFT;
+ if (p_svc->state == TSKM_SVC_WAITCONNECT) {
+ // In the state of waiting to execute
+ req.svcId = svcId;
+ req.localStep = TSKM_LSTEP_ALL;
+ tskmRet = tskm_svcWakeupRequest(p_svc, &req);
+ TSKM_ERR_CHK_DFT; // LCOV_EXCL_BR_LINE 6: Because TSKM_ERR_CHK_DFT does not specify a condition for goto to ERROR
+ }
+ ERROR: return tskmRet;
+}
+
+/**
+ * _TSKM_SvcCtl Sub-func Task-startup-process
+ * @param p_main TSKM_MAIN_CTX_t*
+ * @param svcId TSKM_SVCID_t
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+
+TSKM_ERR_t tskm_svcReserveRequest(TSKM_MAIN_CTX_t* p_main, TSKM_SVCID_t svcId) {
+ uint8_t rsvSvcNum = p_main->nvInfo.body.rsvSvcNum;
+ TSKM_SVCID_t* p_rsvSvcs = p_main->nvInfo.body.rsvSvcs;
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ if (rsvSvcNum >= TSKM_SVC_RESERVE_MAX) {
+ tskmRet = TSKM_E_STATE;
+ } else {
+ int ii;
+ int ret;
+
+ for (ii = 0; ii < rsvSvcNum; ii++) {
+ if (p_rsvSvcs[ii] == svcId) {
+ TSKM_ASSERT_PRINT(0, "Rsv Req already registered(%d)", svcId);
+ // Return OK as continuable
+ return tskmRet;
+ }
+ }
+
+ p_rsvSvcs[rsvSvcNum] = svcId;
+ p_main->nvInfo.body.rsvSvcNum++;
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "Rsv Svc registered(%#x)", svcId);
+
+ ret = tskm_pf_nvFileWrite(&p_main->nvInfo); // LCOV_EXCL_BR_LINE 6: Return value of 0 only
+ if (ret == -1) {
+ TSKM_ASSERT(0);
+ tskmRet = TSKM_E_NG;
+ return tskmRet;
+ }
+ }
+ return tskmRet;
+}
+
+/**
+ * Service control
+ * @param svcId service id
+ * @param ctl control command
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+TSKM_ERR_t _TSKM_SvcCtl(TSKM_SVCID_t svcId, const TSKM_SVC_CTL_t* ctl) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+
+ TSKM_SVC_CTX_t* p_svc;
+
+ if (ctl == NULL) {
+ TSKM_ASSERT(0);
+ return TSKM_E_PAR;
+ }
+
+ p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs, svcId);
+ if (p_svc == NULL) {
+ TSKM_ASSERT(0);
+ TSKM_PRINTF(TSKM_LOG_ERROR, "unknown svcId:%#x", svcId);
+ return TSKM_E_PAR;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_API, "%s(%#x,%d)", __FUNCTION__, svcId, ctl->cmd);
+
+ if (ctl->cmd == TSKM_SVC_CMD_EXEC) {
+ tskmRet = tskm_svcExecRequest(svcId, p_main, p_svc);
+ } else if (ctl->cmd == TSKM_SVC_CMD_ENABLE) {
+ tskmRet = tskm_svcEnableRequest(p_svc);
+ TSKM_ERR_CHK_DFT; // LCOV_EXCL_BR_LINE 8: Because TSKM_ERR_CHK_DFT does not specify a condition for goto to ERROR
+
+ } else if (ctl->cmd == TSKM_SVC_CMD_DISABLE) {
+ tskmRet = tskm_svcDisableRequest(p_svc);
+ TSKM_ERR_CHK_DFT;
+
+ } else if (ctl->cmd == TSKM_SVC_CMD_RESERVE) {
+ tskmRet = tskm_svcReserveRequest(p_main, svcId);
+
+ } else {
+ return TSKM_E_PAR;
+ }
+
+ ERROR: return tskmRet;
+}
+
+/**
+ * Get service info
+ * @param svcId service id
+ * @param svcInfo[O] service info
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+TSKM_ERR_t TSKM_SvcGetInfo(TSKM_SVCID_t svcId, TSKM_SVC_INFO_t* svcInfo) {
+// Do not LOG acquisition APIs TSKM_PRINTF(TSKM_LOG_API,"%s()",__FUNCTION__)
+
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+ TSKM_SVC_CTX_t* p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs, svcId);
+
+ if (p_svc == NULL || svcInfo == NULL) {
+ return TSKM_E_PAR;
+ }
+
+ svcInfo->svcId = p_svc->attr->svcId;
+ svcInfo->isExecDisable =
+ (p_svc->state == TSKM_SVC_DISABLE) ? TSKM_TRUE : TSKM_FALSE;
+
+ return TSKM_E_OK;
+}
+
+RPC_Result _TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info) {
+ RPC_Result rpcRet = RPC_OK;
+ TSKM_ERROR_REBOOT_t rebootInfo;
+
+ if (!p_info || (p_info->type != TSKM_ERROR_REBOOT_NORMAL)) {
+ TSKM_ASSERT(0);
+ return RPC_ERR_Fatal;
+ }
+
+ memset(&rebootInfo, 0, sizeof(TSKM_ERROR_REBOOT_t));
+ rebootInfo.type = p_info->type;
+ snprintf(rebootInfo.log.messageStr, TSKM_LOGGING_MSG_STR_SIZE, "%s",
+ p_info->log.messageStr);
+
+ TSKM_PRINTF(TSKM_LOG_API, "%s(%d)", __FUNCTION__, p_info->type);
+
+ tskm_sub_reboot(&rebootInfo);
+
+ return rpcRet;
+}
+
+/**
+ * Reboot service
+ * @param p_rsv Reserved
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+TSKM_ERR_t TSKM_Reboot(const TSKM_RSV_t * p_rsv) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__)
+ if (p_rsv != NULL) {
+ TSKM_ASSERT(0);
+ return TSKM_E_PAR;
+ }
+
+ tskm_sub_reboot_normal();
+
+ return tskmRet;
+}
+
+/**
+ * Save LOGs
+ * @param p_info LOG storage info
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+TSKM_ERR_t TSKM_Logging(const TSKM_LOGGING_INFO_t* p_info) {
+ TSKM_LOGGING_INFO_t logInfo;
+ TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__)
+
+ if (!p_info) {
+ TSKM_ASSERT(0);
+ return TSKM_E_PAR;
+ } else {
+ switch (p_info->type) {
+ case TSKM_LOGGING_TYPE_MODULE_LOGS:
+ case TSKM_LOGGING_TYPE_GRP_RELAUNCH:
+ break;
+ default:
+ TSKM_ASSERT(0);
+ return TSKM_E_PAR;
+ }
+ }
+
+ logInfo.type = p_info->type;
+ snprintf(logInfo.messageStr, TSKM_LOGGING_MSG_STR_SIZE, "%s",
+ p_info->messageStr);
+
+ tskm_sub_logging(&logInfo);
+
+ return TSKM_E_OK;
+}
+
+TSKM_ERR_t TSKM_SetWakeupOrder(const TSKM_WAKEUP_ORDER_t* p_order) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__)
+
+ if (p_order == NULL) {
+ return TSKM_E_PAR;
+ }
+
+ if (strnlen(p_order->orderName, TSKM_ORDER_NAME_MAX) >= TSKM_ORDER_NAME_MAX) {
+ return TSKM_E_PAR;
+ }
+
+ if (tskm_sub_setWakeupOrder(p_order->orderName) != 0) {
+ TSKM_ASSERT(0);
+ tskmRet = TSKM_E_NG;
+ }
+
+ return tskmRet;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/systemservice/task_manager/server/src/tskm_comm.cpp b/systemservice/task_manager/server/src/tskm_comm.cpp
new file mode 100755
index 0000000..b177b9b
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_comm.cpp
@@ -0,0 +1,402 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _GNU_SOURCE
+#warning "_GNU_SOURCE not defined, so define here"
+#define _GNU_SOURCE
+#endif
+#include "tskm_comm.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <native_service/cl_monitor.h>
+
+#include "tskm_debug.h"
+#include "tskm_util.h"
+
+
+/**********************************************************
+ * Internal functions
+ **********************************************************/
+TSKM_STATIC TSKM_SRV_CONNENT_t*
+addConnFd(TSKM_SRV_CONNENT_LIST_t* list, TSKM_SRV_CONNENT_t* conn) {
+ TSKM_SRV_CONNENT_t* retConn;
+ if (list->num >= TSKM_COMM_CONNECT_MAX) {
+ TSKM_ASSERT(0)
+ return NULL;
+ }
+
+ retConn = &list->conn[list->num];
+ list->conn[list->num] = *conn;
+ list->num++;
+ return retConn;
+}
+
+TSKM_STATIC void delConnFd(TSKM_SRV_CONNENT_LIST_t* list,
+ TSKM_SRV_CONNENT_t* conn) {
+ uint32_t ii;
+ TSKM_BOOL_t isFind = TSKM_FALSE;
+ for (ii = 0; ii < list->num; ii++) {
+ if (!isFind && list->conn[ii].connFd == conn->connFd) {
+ isFind = TSKM_TRUE;
+ list->num--;
+ }
+
+ if (isFind && (ii < list->num)) {
+ list->conn[ii] = list->conn[ii + 1];
+ }
+ }
+ TSKM_ASSERT(isFind);
+}
+
+/**********************************************************
+ * Public functions
+ **********************************************************/
+TSKM_ERR_t tskm_srvSockCreate(const char *sockName,
+ TSKM_SRV_SOCK_CTX_t* p_sock) {
+ int fd = -1;
+ int ret;
+ int sockRet;
+ int enable = 1;
+ int listenNum = TSKM_COMM_CONNECT_MAX;
+
+ struct sockaddr_un unix_addr = { };
+
+ fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 5: For processing initializing process
+ // LCOV_EXCL_START 5: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 == access(sockName, F_OK)) { // LCOV_EXCL_BR_LINE 5: For processing initializing process
+ TSKM_ASSERT(0);
+ unlink(sockName);
+ }
+
+ unix_addr.sun_family = AF_UNIX;
+ strncpy(unix_addr.sun_path, sockName, sizeof(unix_addr.sun_path) - 1);
+
+ sockRet = bind(fd, (struct sockaddr *) &unix_addr, sizeof(unix_addr));
+ if (sockRet != 0) { // LCOV_EXCL_BR_LINE 5: For processing initializing process
+ // LCOV_EXCL_START 5: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = chmod(sockName, S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: For processing initializing process
+ // LCOV_EXCL_START 5: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ sockRet = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable));
+ if (sockRet != 0) { // LCOV_EXCL_BR_LINE 5:For processing initializing process
+ // LCOV_EXCL_START 5: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ sockRet = listen(fd, listenNum);
+ if (sockRet != 0) { // LCOV_EXCL_BR_LINE 5: For process initialization processing
+ // LCOV_EXCL_START 5: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ memset(p_sock, 0, sizeof(*p_sock));
+ p_sock->sockFd = fd;
+ p_sock->sockName = sockName;
+
+ return TSKM_E_OK;
+ // LCOV_EXCL_START 5: For process initialization processing
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (fd != -1) {
+ close(fd);
+ }
+ return TSKM_E_NG;
+ // LCOV_EXCL_STOP
+}
+
+TSKM_SRV_CONNENT_t*
+tskm_srvSockConnect(TSKM_SRV_SOCK_CTX_t* p_sock) {
+ int fd = -1;
+ socklen_t len;
+ int sockRet;
+ TSKM_SRV_CONNENT_t conn;
+ TSKM_SRV_CONNENT_t *retConn;
+ struct ucred credent;
+ struct sockaddr_un unix_addr;
+
+ memset(&conn, 0, sizeof(conn));
+ conn.connFd = -1;
+
+ len = sizeof(unix_addr);
+ fd = accept(p_sock->sockFd, (struct sockaddr*) &unix_addr,
+ (socklen_t *) &len); // NOLINT (readability/casting)
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 5: Accept's Error-Handling Process
+ // LCOV_EXCL_START 5: Accept's Error-Handling Process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ conn.connFd = fd;
+
+ len = sizeof(credent);
+ sockRet = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &credent, &len);
+ if (sockRet != 0) { // LCOV_EXCL_BR_LINE 5: Getsockopt's Error-Handling Process
+ // LCOV_EXCL_START 5: Getsockopt's Error-Handling Process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ conn.pid = credent.pid;
+
+ retConn = addConnFd(&p_sock->connList, &conn);
+ if (retConn == NULL) { // LCOV_EXCL_BR_LINE 5: Connect's Error-Handling Process
+ // LCOV_EXCL_START 5: Connect's Error-Handling Process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ return retConn;
+ // LCOV_EXCL_START 5: Error-Handling Process
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (conn.connFd != -1) {
+ tskm_sockDestory(conn.connFd);
+ }
+ return NULL;
+ // LCOV_EXCL_STOP
+}
+
+void tskm_srvSockDisconnect(TSKM_SRV_SOCK_CTX_t* p_sock,
+ TSKM_SRV_CONNENT_t *p_conn) {
+ int fd = p_conn->connFd;
+ delConnFd(&p_sock->connList, p_conn);
+ tskm_sockDestory(fd);
+}
+
+void tskm_srvSockDestory(TSKM_SRV_SOCK_CTX_t* p_sock) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (p_sock->sockFd) {
+ tskm_sockDestory(p_sock->sockFd);
+ p_sock->sockFd = 0;
+
+ TSKM_ASSERT_ERRNO(0 == unlink(p_sock->sockName));
+ }
+}
+// LCOV_EXCL_STOP
+int tskm_cliSockConnect(const char* sockName) {
+ int fd = -1;
+ int sockRet;
+ struct sockaddr_un unix_addr = { };
+
+ /* Create socket */
+ fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ unix_addr.sun_family = AF_UNIX;
+ strncpy(unix_addr.sun_path, sockName, sizeof(unix_addr.sun_path) - 1);
+ sockRet = connect(fd, (struct sockaddr*) &unix_addr, sizeof(unix_addr));
+ if (sockRet < 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ return fd;
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (fd != -1) {
+ TSKM_ASSERT_ERRNO(0 == close(fd));
+ }
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
+int tskm_sockRcv(int fd, TSKM_EVENT_INFO_t* p_ev) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+ ret = static_cast<int>(recv(fd, &ev, sizeof(ev), 0));
+
+ // LCOV_EXCL_BR_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ if (ret > (int) sizeof(ev)) { // NOLINT (readability/casting)
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ if (ret > 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ TSKM_PRINTF(TSKM_LOG_MSG, "recv:%s from:%d ret:%d",
+ tskm_convEvent2Str(ev.event), ev.fromPid, ret);
+ }
+
+ *p_ev = ev;
+
+ if (p_ev->hasExtend && (0 != p_ev->extendSize)) {
+ TSKM_PRINTF(TSKM_LOG_MSG, "rcv:ex(%d) ", p_ev->extendSize);
+
+ p_ev->extendPrm = malloc(p_ev->extendSize);
+ if (!p_ev->extendPrm) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = static_cast<int>(recv(fd, p_ev->extendPrm, p_ev->extendSize, 0));
+
+ // LCOV_EXCL_BR_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ if (ret > (int) p_ev->extendSize) { // NOLINT (readability/casting)
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ return ret;
+
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
+int tskm_sockSend(int fd, TSKM_EVENT_INFO_t* p_ev) {
+ int ret;
+ p_ev->fromPid = getpid();
+ TSKM_PRINTF(TSKM_LOG_MSG, "send:%s ", tskm_convEvent2Str(p_ev->event));
+ ret = static_cast<int>(send(fd, p_ev, sizeof(*p_ev), MSG_NOSIGNAL));
+ if (ret != sizeof(*p_ev)) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ // Because it is entered only when called from a debugging function (pri_sendDebugDumpRes)
+ if (p_ev->hasExtend && p_ev->extendPrm && (0 != p_ev->extendSize)) {
+ TSKM_PRINTF(TSKM_LOG_MSG, "send:ex(%d) ", p_ev->extendSize);
+
+ ret = static_cast<int>(send(fd, p_ev->extendPrm, p_ev->extendSize, MSG_NOSIGNAL));
+ if (ret != (int)p_ev->extendSize) { // NOLINT (readability/casting)
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ }
+
+ return ret;
+
+ ERROR: return -1;
+}
+
+void tskm_sockDestory(int fd) {
+ TSKM_ASSERT_ERRNO(0 == shutdown(fd, SHUT_RDWR));
+ TSKM_ASSERT_ERRNO(0 == close(fd));
+}
+
+/******************************************************************
+ * Initializing (Process)
+ ******************************************************************/
+int tskm_comm_procInit(void) {
+ int ret;
+
+ ret = CL_MonitorInit(CL_MONITOR_INIT_USER);
+
+ if (ret != 0) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ return 0;
+
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************************
+ * Service Error Monitoring Status Setting
+ *********************************************************/
+int tskm_comm_setSvcWatchState(uint32_t id, BOOL bIsRun, uint32_t timeout) {
+ int ret = 0;
+
+ CL_MonitorState_t state = CL_MONITOR_STATE_SLEEP;
+
+ if (bIsRun) {
+ state = CL_MONITOR_STATE_RUN;
+ }
+
+ ret = CL_MonitorSetEntry(CL_MONITOR_TYPE_GENERIC, id, state, timeout, 0);
+ if (0 != ret) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ return 0;
+ ERROR: return -1;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/systemservice/task_manager/server/src/tskm_debug.cpp b/systemservice/task_manager/server/src/tskm_debug.cpp
new file mode 100755
index 0000000..5881f9a
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_debug.cpp
@@ -0,0 +1,286 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_debug.h"
+
+const char*
+tskm_convState2Str(TSKM_STATE_t state) {
+ const char* ret = "UNKNONW";
+ switch (state) { // LCOV_EXCL_BR_LINE 7:debug code
+ case TSKM_ST_ACCOFF:
+ ret = "ACCOFF";
+ break;
+ case TSKM_ST_ACCON:
+ ret = "ACCON";
+ break;
+ case TSKM_ST_WAKEUP:
+ ret = "WAKEUP";
+ break;
+ case TSKM_ST_RUNNING:
+ ret = "RUNNING";
+ break;
+ case TSKM_ST_DOWN:
+ ret = "DOWN";
+ break;
+ }
+ return ret;
+}
+
+const char*
+tskm_convEvent2Str(TSKM_EVENT_t event) {
+ switch (event) { // LCOV_EXCL_BR_LINE 7:debug code
+ case TSKM_EV_NOP:
+ return "NOP";
+ case TSKM_EV_PRI_REQ_WAKEUP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REQ_WAKEUP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REQ_DOWN:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REQ_DOWN";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REQ_TOUCH:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REQ_TOUCH";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REQ_DEBUGDUMP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REQ_DEBUGDUMP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REP_LOWMEM:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REP_LOWMEM";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REP_WAKEUP_COMP:
+ return "PRI_REP_WAKEUP_COMP";
+ case TSKM_EV_PRI_REP_DOWN_COMP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REP_DOWN_COMP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REP_CONNECT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REP_CONNECT";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REP_DISCONNECT:
+ return "PRI_REP_DISCONNECT";
+ case TSKM_EV_PRI_RES_WAKEUP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_RES_WAKEUP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_RES_DOWN:
+ return "PRI_RES_DOWN";
+ case TSKM_EV_PRI_RES_DEBUGDUMP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_RES_DEBUGDUMP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REQ_EXIT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REQ_EXIT";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_SVC_REP_TERM:
+ return "SVC_REP_TERM";
+ case TSKM_EV_API_REQ_REBOOT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "API_REQ_REBOOT";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_API_REQ_SVC_CTL:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "API_REQ_SVC_CTL";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_API_REQ_SVC_DISABLE:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "API_REQ_SVC_DISABLE";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REQ_STOP:
+ return "API_REQ_STOP";
+ case TSKM_EV_LCL_CHG_SVC_STATE:
+ return "LCL_CHG_SVC_STATE";
+ case TSKM_EV_LCL_REQ_SDUMP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "LCL_REQ_SDUMP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REP_TIMEOUT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "LCL_REP_TIMEOUT";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REP_POLLING:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "LCL_REP_POLLING";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REP_LOWMEM:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "LCL_REP_LOWMEM";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REQ_TRANS_STEP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "LCL_REQ_TRANS_STEP";
+ // LCOV_EXCL_STOP
+ default:
+ break;
+ }
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "UNKNOWN";
+ // LCOV_EXCL_STOP
+}
+
+const char*
+tskm_convInitCompId2Str(uint64_t compId) {
+ switch (compId) { // LCOV_EXCL_BR_LINE 7:debug code
+ case INI_INITCOMP_NONE:
+ return "NONE";
+ case INI_INITCOMP_ON_START:
+ return "ONSTART";
+ case INI_INITCOMP_NVM_ACCESS:
+ return "NVM_ACCESS";
+ case INI_INITCOMP_TEST0:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST0";
+ // LCOV_EXCL_STOP
+ case INI_INITCOMP_TEST1:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST1";
+ // LCOV_EXCL_STOP
+ case INI_INITCOMP_TEST2:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST2";
+ // LCOV_EXCL_STOP
+ case INI_INITCOMP_TEST3:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST3";
+ // LCOV_EXCL_STOP
+ }
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "UNKNONW";
+ // LCOV_EXCL_STOP
+}
+
+const char*
+tskm_convTermCompId2Str(uint64_t compId) {
+ switch (compId) { // LCOV_EXCL_BR_LINE 7:debug code
+ case INI_TERMCOMP_NONE:
+ return "NONE";
+ case INI_TERMCOMP_ACTIVITYMGR:
+ return "ACTIVITYMGR";
+ case INI_TERMCOMP_RESIDENT:
+ return "RESIDENT";
+ case INI_TERMCOMP_TRANSIENT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TRANSIENT";
+ // LCOV_EXCL_STOP
+ case INI_TERMCOMP_TEST0:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST0";
+ // LCOV_EXCL_STOP
+ case INI_TERMCOMP_TEST1:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST1";
+ // LCOV_EXCL_STOP
+ case INI_TERMCOMP_TEST2:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST2";
+ // LCOV_EXCL_STOP
+ case INI_TERMCOMP_TEST3:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST3";
+ // LCOV_EXCL_STOP
+ }
+ return "UNKNONW";
+}
+
+const char*
+tskm_convSvcState2Str(TSKM_SVC_STATE_t state) {
+ switch (state) { // LCOV_EXCL_BR_LINE 7:debug code
+ case TSKM_SVC_DORMANT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "DORMANT";
+ // LCOV_EXCL_STOP
+ case TSKM_SVC_WAITCONNECT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "WAITCONNECT";
+ // LCOV_EXCL_STOP
+ case TSKM_SVC_WAKEUP:
+ return "WAKEUP";
+ case TSKM_SVC_RUNNING:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "RUNNING";
+ // LCOV_EXCL_STOP
+ case TSKM_SVC_DOWN:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "DOWN";
+ // LCOV_EXCL_STOP
+ case TSKM_SVC_FINDOWN:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "FINDOWN";
+ // LCOV_EXCL_STOP
+ case TSKM_SVC_DISABLE:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "DISABLE";
+ // LCOV_EXCL_STOP
+ default:
+ break;
+ }
+ return "UNKNONW";
+}
+
+TSKM_STATIC void svcDump(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "<%s>", p_svc->attr->name);
+ TSKM_PRINTF(TSKM_LOG_STATE, " pid:%d svcId:%#x state:%s waitResCnt:%d",
+ p_svc->pid, p_svc->attr->svcId,
+ tskm_convSvcState2Str(p_svc->state), p_svc->waitResCnt);
+}
+
+void tskm_svcsDump(TSKM_SVCS_CTX_t* p_svcs) {
+ uint32_t ii;
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ svcDump(&p_svcs->svcList[ii]);
+ }
+}
+
diff --git a/systemservice/task_manager/server/src/tskm_main.cpp b/systemservice/task_manager/server/src/tskm_main.cpp
new file mode 100755
index 0000000..33c10fa
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_main.cpp
@@ -0,0 +1,727 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_main.h"
+#include <stdio.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/inotify.h>
+#include <getopt.h>
+#include <system_service/ss_services.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <system_service/ss_system_if.h>
+#include <system_service/ss_version.h>
+#include <system_service/ss_templates.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <other_service/rpc.h>
+#include <system_service/resm.h>
+
+#include "tskm_data_init_local.h"
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+#include "tskm_debug.h"
+#include "tskm_util.h"
+#include "tskm_srvr.h"
+#include "tskm_comm.h"
+#include "tskm_watch.h"
+#include "system_service/tskm_local_type.h"
+#include "system_service/tskm_xml_data.h"
+#include "tskm_state.h"
+
+#define TSKM_DATA_KEY "TSKM_KEY"
+
+TSKM_STATIC TSKM_MAIN_CTX_t g_mainCtx; // Main context
+
+TSKM_STATIC BOOL s_isVupMode = FALSE;
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+
+// For NsLog
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+FRAMEWORKUNIFIEDLOGOPTIONS, {
+ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ZONE_TEXT_31 }, FRAMEWORKUNIFIEDLOGZONES };
+
+EFrameworkunifiedStatus OnFinishLoadFile(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ int ret;
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+ TSKM_EVENT_INFO_t ev;
+
+ ret = tskm_pf_nvFileRead(hApp, &p_main->nvInfo);
+ if (ret != 0) {
+ TSKM_ASSERT(0);
+ }
+
+ // issure INI_INITCOMP_NVM_ACCESS
+ bzero(&ev, sizeof(ev));
+ ev.event = TSKM_EV_PRI_REP_WAKEUP_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repWakeupComp.compId = INI_INITCOMP_NVM_ACCESS;
+ tskm_handleEvent(p_main, &ev);
+
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus onDataInitRequest(HANDLE hApp) {
+ TSKM_ERR_t l_tskmRet = TSKM_E_OK;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+
+ TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__)
+
+ if (p_main->bootInfo.startupReason == epswfINVALID) {
+ // Before issuing FrameworkunifiedOnStart = Requests before TaskManager became Availabile are not accepted
+ TSKM_ASSERT(0);
+ l_tskmRet = TSKM_E_STATE;
+ } else {
+ T_SS_SM_START_DataStructType bootInfo(epswfIGN_ACC, TRUE,
+ e_SS_SM_DATA_RESET_MODE_USER,
+ epsssUNLOCK, epsstWARMSTART,
+ e_SS_SM_DRAM_BACKUP_OK,
+ e_SS_SM_RESET_STATUS_NONE, 0);
+
+ T_SS_SM_START_ExtDataStructType extBootInfo;
+
+ memcpy(&extBootInfo, &p_main->extBootInfo, sizeof(extBootInfo));
+
+ // After updating the program,
+ // FALSE is notified here because it is notified when data initialization I/F is called at startup
+ extBootInfo.isProgUpdated = FALSE;
+
+ tskm_dataInitAll(&bootInfo, &extBootInfo);
+ }
+
+ PCSTR l_senderName = FrameworkunifiedGetMsgSrc(hApp);
+ if (NULL != l_senderName) {
+ HANDLE hSession = FrameworkunifiedMcOpenSender(hApp, l_senderName);
+ if (hSession == NULL) {
+ TSKM_ASSERT(0);
+ } else {
+ TSKM_ASSERT(
+ eFrameworkunifiedStatusOK
+ == FrameworkunifiedSendMsg(hSession, TSKM_DATAINIT_RESP, sizeof(l_tskmRet),
+ &l_tskmRet));
+ TSKM_ASSERT(eFrameworkunifiedStatusOK == FrameworkunifiedMcClose(hSession));
+ }
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus onTransStepRequest(HANDLE hApp) { // LCOV_EXCL_START 6:Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ TSKM_EVENT_INFO_t ev;
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_LCL_REQ_TRANS_STEP;
+ ev.errCode = TSKM_E_OK;
+ tskm_handleEvent(p_main, &ev);
+
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus OnResmAvailability(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+
+ if (0 != strcmp(NTFY_ResourceMgr_Availability, FrameworkunifiedGetLastNotification(hApp))) {
+ TSKM_ASSERT(0);
+ } else if (FrameworkunifiedIsServiceAvailable(hApp)) {
+ // Availability = TRUE
+
+ p_main->resmFd = tskm_sub_resmInit();
+ if (-1 == p_main->resmFd) {
+ TSKM_ASSERT(0);
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+//************ NS Framework Callback : must implemet ******************
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSKM_PRINTF(TSKM_LOG_STATE, "+");
+
+ l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hApp, NTFY_SS_TaskManager_Availability);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_NS_NPSERVICE,
+ NPS_GET_PERS_FILE_ACK,
+ OnFinishLoadFile);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE,
+ TSKM_DATAINIT_REQ,
+ onDataInitRequest);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, FrameworkunifiedGetAppName(hApp),
+ TSKM_TRANS_STEP_REQ,
+ onTransStepRequest);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_ResourceMgr_Availability, OnResmAvailability);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "-");
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSKM_PRINTF(TSKM_LOG_STATE, "+");
+ l_eStatus = OnStart(hApp);
+ TSKM_PRINTF(TSKM_LOG_STATE, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSKM_PRINTF(TSKM_LOG_STATE, "+");
+ l_eStatus = OnStart(hApp);
+ TSKM_PRINTF(TSKM_LOG_STATE, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSKM_PRINTF(TSKM_LOG_STATE, "+");
+ l_eStatus = OnStart(hApp);
+ TSKM_PRINTF(TSKM_LOG_STATE, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+ // Returns Fail to send asynchronous STOP reply to SM
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ TSKM_EVENT_INFO_t ev;
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_LCL_REQ_STOP;
+ ev.errCode = TSKM_E_OK;
+ tskm_handleEvent(p_main, &ev);
+
+ p_main->isOnStopDone = TSKM_TRUE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+ TSKM_ERR_t l_tskmRet;
+
+ // Call DebugDump of all running SVCs
+ l_tskmRet = tskm_svcsCallDebugDump(&p_main->svcs);
+ if (TSKM_E_OK != l_tskmRet) {
+ TSKM_ASSERT(0);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+/*********************************************************
+ * System start process
+ *********************************************************/
+EFrameworkunifiedStatus OnStart(const HANDLE hApp) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "+");
+ TSKM_MAIN_CTX_t* const p_main = &g_mainCtx;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (p_main->isOnStartDone == TSKM_FALSE) {
+ T_SS_SM_START_DataStructType startupInfo;
+ TSKM_EVENT_INFO_t ev;
+ l_eStatus = ReadMsg<T_SS_SM_START_DataStructType>(hApp, startupInfo);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT(0);
+ } else {
+ memcpy(&p_main->bootInfo, &startupInfo, sizeof(T_SS_SM_START_DataStructType));
+ }
+
+ if (0 != tskm_sub_getExtBootInfo(&p_main->extBootInfo)) {
+ TSKM_ASSERT(0);
+ }
+
+ tskm_dataInitAll(&p_main->bootInfo, &p_main->extBootInfo);
+
+ tskm_svcsSetBootInfo(&p_main->svcs, &p_main->bootInfo, &p_main->extBootInfo);
+ p_main->isOnStartDone = TSKM_TRUE;
+
+ l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, TRUE);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT(0);
+ } else {
+ TSKM_PRINTF(TSKM_LOG_STATE, "Availability TRUE");
+ }
+
+ // Issure INI_INITCOMP_ON_START
+ bzero(&ev, sizeof(ev));
+ ev.event = TSKM_EV_PRI_REP_WAKEUP_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repWakeupComp.compId = INI_INITCOMP_ON_START;
+ tskm_handleEvent(p_main, &ev);
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "-");
+ return l_eStatus;
+}
+
+/*********************************************************
+ * Argument analysis process
+ *********************************************************/
+TSKM_STATIC EFrameworkunifiedStatus argParser(SI_32 argument, PCHAR argumentValue) { // LCOV_EXCL_START 6: for process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if ('v' == argument) {
+ s_isVupMode = TRUE;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+/*********************************************************
+ * Creating process for TSKM internal context
+ *********************************************************/
+TSKM_STATIC void ctxCreate(TSKM_MAIN_CTX_t* p_main, int argc, char* argv[]) {
+ int ret;
+ EFrameworkunifiedStatus taskmanagerRet;
+ TSKM_ERR_t tskmRet;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cbFuncs);
+ CustomCommandLineOptions cmdLineOpt = { "v", NULL, argParser };
+
+ p_main->state = TSKM_ST_ACCOFF;
+ p_main->isOnStartDone = TSKM_FALSE;
+
+ // Create dispatcher
+ taskmanagerRet = FrameworkunifiedCreateDispatcherWithoutLoop(SS_TASK_MANAGER, p_main->hApp, argc,
+ argv, &cbFuncs, TRUE, &cmdLineOpt);
+ if (eFrameworkunifiedStatusOK != taskmanagerRet) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "s_isVupMode :%s", s_isVupMode ? "TRUE" : "FALSE");
+
+ taskmanagerRet = FrameworkunifiedGetDispatcherFD(p_main->hApp, &p_main->nsFd);
+ if (taskmanagerRet != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP
+ }
+
+ p_main->sigFd = tskm_pf_sysInit(); // Platform initialization
+ if (p_main->sigFd == -1) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_LINE 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ p_main->iFd = inotify_init1(IN_CLOEXEC);
+ if (p_main->sigFd == -1) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_LINE 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ // Obtain RESM FDs after waiting for Availability
+ p_main->resmFd = -1;
+
+ tskmRet = tskm_srvSockCreate(TSKM_SOCKET_NAME, &p_main->sock);
+ TSKM_ERR_CHK(tskmRet, TSKM_E_OK, ERROR); // LCOV_EXCL_BR_LINE 6: For process initialization processing
+
+ ret = tskm_pf_nvFileInit(p_main->hApp);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = tskm_initServiceList(&p_main->svcs, p_main->iFd); // Service to be started
+ if (0 != ret) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For For process initialization process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ tskm_initWakeupCtx(&p_main->wakeup, s_isVupMode); // Gradual startup info
+ tskm_initDownCtx(&p_main->down, s_isVupMode); // Gradual termination info
+ return;
+
+ // LCOV_EXCL_START 6: For process initialization processing
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_exit(EXIT_FAILURE);
+ return;
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************************
+ * Get main context
+ *********************************************************/
+TSKM_MAIN_CTX_t*
+tskm_getMainCtx(void) {
+ return &g_mainCtx;
+}
+
+/*********************************************************
+ * Process initialization process (MAIN function sub)
+ *********************************************************/
+int Init_Process(int* rpcFd, int* sockFd, int* maxFd, fd_set* fds, TSKM_MAIN_CTX_t* p_main) {
+ int ret;
+ uint32_t ii;
+
+ TSKM_SRV_CONNENT_LIST_t* p_connList = &p_main->sock.connList;
+
+ FD_ZERO(fds);
+
+ FD_SET(*rpcFd, fds);
+ *maxFd = TSKM_MAX(*rpcFd, *maxFd); // LCOV_EXCL_BR_LINE 6: For process initialization processing
+
+ FD_SET(*sockFd, fds);
+ *maxFd = TSKM_MAX(*sockFd, *maxFd); // LCOV_EXCL_BR_LINE 6: For process initialization processing
+
+ FD_SET(p_main->nsFd, fds);
+ *maxFd = TSKM_MAX(p_main->nsFd, *maxFd); // LCOV_EXCL_BR_LINE 6: For process initialization processing
+
+ FD_SET(p_main->sigFd, fds);
+ *maxFd = TSKM_MAX(p_main->sigFd, *maxFd); // LCOV_EXCL_BR_LINE 6: For process initialization processing
+
+ if (-1 != p_main->resmFd) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FD_SET(p_main->resmFd, fds);
+ *maxFd = TSKM_MAX(p_main->resmFd, *maxFd);
+ // LCOV_EXCL_STOP
+ }
+
+ for (ii = 0; ii < p_connList->num; ii++) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_SRV_CONNENT_t* p_conn = &p_connList->conn[ii];
+ FD_SET(p_conn->connFd, fds);
+ *maxFd = TSKM_MAX(p_conn->connFd, *maxFd);
+ // LCOV_EXCL_STOP
+ }
+
+ TSKM_PRINTF(TSKM_LOG_FUNC, "SELECT IN");
+ ret = select(*maxFd + 1, fds, NULL, NULL, NULL);
+ if (ret < 1) {
+ if (errno != EINTR) {
+ TSKM_ASSERT(0);
+ }
+ return ret;
+ }
+ TSKM_PRINTF(TSKM_LOG_FUNC, "SELECT OUT");
+ return 0;
+}
+
+/*********************************************************
+ * Receiving Messages from CONNECT Clients (MAIN Functions Sub)
+ *********************************************************/
+void Recv_Msg_FromConnectClient(fd_set* fds, TSKM_MAIN_CTX_t* p_main) {
+ uint32_t ii;
+ TSKM_SRV_CONNENT_LIST_t* p_connList = &p_main->sock.connList;
+
+ // Messages from CONNECT clients
+ for (ii = 0; ii < p_connList->num; ii++) {
+ TSKM_SRV_CONNENT_t* p_conn = &p_connList->conn[ii];
+ if (FD_ISSET(p_conn->connFd, fds)) {
+ TSKM_PRINTF(TSKM_LOG_FUNC, "connFd IN");
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+ ret = tskm_sockRcv(p_conn->connFd, &ev);
+
+ if (ret < 0) {
+ TSKM_ASSERT(0);
+ } else {
+ TSKM_SVC_CTX_t* p_svc;
+
+ if (ret == 0) {
+ // Closed Connection
+ TSKM_PRINTF(TSKM_LOG_STATE, "DISSCON pid:%d", p_conn->pid);
+ ev.event = TSKM_EV_PRI_REP_DISCONNECT;
+ ev.errCode = TSKM_E_OK;
+ ev.fromPid = p_conn->pid;
+ tskm_srvSockDisconnect(&p_main->sock, p_conn);
+ p_conn = NULL; // If the connection is lost, it cannot be referenced.
+ }
+
+ p_svc = tskm_svcsGetSvcByPid(&p_main->svcs, ev.fromPid);
+ if (p_svc) { // Events from service
+ TSKM_ERR_t tskmRet;
+ tskmRet = tskm_svcEventHandle(p_svc, &ev); // Service handler
+ if (tskmRet != TSKM_E_OK) {
+ TSKM_ASSERT(0);
+ }
+ }
+ if (ev.event != TSKM_EV_NOP) {
+ tskm_handleEvent(p_main, &ev); // Main handler
+ }
+ }
+ TSKM_PRINTF(TSKM_LOG_FUNC, "connFd OUT");
+ }
+ }
+}
+
+/*********************************************************
+ * CONNECT Requests (MAIN Functions Sub)
+ *********************************************************/
+void Recv_Req_Connect(fd_set* fds, TSKM_MAIN_CTX_t* p_main, int sockFd) {
+ // CONNECT requests
+ if (FD_ISSET(sockFd, fds)) {
+ TSKM_PRINTF(TSKM_LOG_FUNC, "sockFd IN");
+
+ TSKM_SRV_CONNENT_t* conn;
+ conn = tskm_srvSockConnect(&p_main->sock);
+ if (conn == NULL) {
+ TSKM_ASSERT(0);
+ } else {
+ TSKM_SVC_CTX_t* p_svc;
+ TSKM_PRINTF(TSKM_LOG_STATE, "CONNECT pid:%d", conn->pid);
+
+ p_svc = tskm_svcsGetSvcByPid(&p_main->svcs, conn->pid);
+ if (p_svc) {
+ TSKM_ERR_t tskmRet;
+ TSKM_EVENT_INFO_t ev;
+
+ ev.event = TSKM_EV_PRI_REP_CONNECT;
+ ev.errCode = TSKM_E_OK;
+ ev.fromPid = conn->pid;
+ ev.prm.repConnect.connFd = conn->connFd;
+
+ tskmRet = tskm_svcEventHandle(p_svc, &ev); // Service handler
+ if (tskmRet != TSKM_E_OK) {
+ TSKM_ASSERT(0);
+ } else if (ev.event != TSKM_EV_NOP) {
+ tskm_handleEvent(p_main, &ev); // Main hander
+ }
+ }
+ }
+ TSKM_PRINTF(TSKM_LOG_FUNC, "sockFd OUT");
+ }
+}
+
+/*********************************************************
+ * MAIN Function
+ *********************************************************/
+int main(int argc, char* argv[]) {
+ RPC_ID rpcId = TSKM_RPC_ID;
+ int rpcFd = 0;
+ int maxFd = 0;
+ int ret;
+ fd_set fds;
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+
+ // Logging setting
+ FRAMEWORKUNIFIED_SET_ZONES();
+
+ ctxCreate(p_main, argc, argv); // Initialize context
+
+ tskm_sub_init(); // Initialize sub systems
+
+ RPC_START_SECURE_SERVER(rpcId);
+ RPC_get_fd(rpcId, &rpcFd);
+
+ uid_t uid[2];
+ gid_t gid[2];
+
+ uid[0] = 0;
+ gid[0] = 0;
+ uid[1] = getuid();
+ gid[1] = getgid();
+
+ if (RPC_OK != RPC_regist_credential(2, uid, 2, gid)) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: For process initialization processing
+ }
+
+ // Start periodic timer thread
+ ret = tskm_watch_startTimer();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: For process initialization processing
+ }
+
+ tskm_stateTransit(p_main, TSKM_ST_ACCOFF, TSKM_ST_ACCON);
+
+ p_main->isExec = TSKM_TRUE;
+ while (p_main->isExec) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ int sockFd = p_main->sock.sockFd;
+
+ // Initialization processing
+ if (Init_Process(&rpcFd, &sockFd, &maxFd, &fds, p_main) != 0) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue; // LCOV_EXCL_LINE 6: For process initialization processing
+ }
+
+ // RPC API
+ if (FD_ISSET(rpcFd, &fds)) {
+ RPC_process_API_request(rpcId);
+ }
+
+ // Process termination signal
+ if (FD_ISSET(p_main->sigFd, &fds)) {
+ int count = 0;
+
+ do {
+ TSKM_EVENT_INFO_t ev;
+ ev.event = TSKM_EV_SVC_REP_TERM;
+
+ count++;
+
+ ret = tskm_pf_cleanupProc(p_main->sigFd, &ev.fromPid, &ev.errCode);
+ if (ret == -1) {
+ TSKM_ASSERT(0);
+ break;
+ }
+
+ TSKM_SVC_CTX_t* p_svc;
+
+ p_svc = tskm_svcsGetSvcByPid(&p_main->svcs, ev.fromPid);
+ if (p_svc) {
+ TSKM_ERR_t tskmRet;
+
+ tskmRet = tskm_svcEventHandle(p_svc, &ev); // Service handler
+ if (tskmRet != TSKM_E_OK) {
+ TSKM_ASSERT(0);
+ }
+ if (ev.event != TSKM_EV_NOP) {
+ tskm_handleEvent(p_main, &ev); // Main handler
+ }
+ }
+ } while (ret == 1 && count < 50);
+ }
+
+ if (FD_ISSET(p_main->nsFd, &fds)) {
+ FrameworkunifiedDispatchProcessWithoutLoop(p_main->hApp);
+ }
+
+ // EV from RESM
+ if (-1 != p_main->resmFd) {
+ if (FD_ISSET(p_main->resmFd, &fds)) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+ ret = tskm_sub_resmRcv(&ev);
+
+ if (-1 == ret) {
+ TSKM_ASSERT(0);
+ } else {
+ tskm_handleEvent(p_main, &ev);
+ }
+ }
+ }
+
+ // Messages from connected clients
+ Recv_Msg_FromConnectClient(&fds, p_main);
+
+ // CONNECT request
+ Recv_Req_Connect(&fds, p_main, sockFd);
+ }
+
+ tskm_srvSockDestory(&p_main->sock);
+
+ RPC_end(rpcId);
+
+ FrameworkunifiedDestroyDispatcherWithoutLoop(p_main->hApp);
+ TSKM_PRINTF(TSKM_LOG_STATE, "tskm end");
+
+ sleep(TSKM_CFG_WAIT_SHUTDOWN);
+ return 0;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/systemservice/task_manager/server/src/tskm_port_pf.cpp b/systemservice/task_manager/server/src/tskm_port_pf.cpp
new file mode 100755
index 0000000..f427255
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_port_pf.cpp
@@ -0,0 +1,884 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_port_pf.h"
+#include <pthread.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <pwd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <native_service/cl_process.h>
+#include <native_service/cl_monitor.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_sm_client_if.h>
+
+#include "system_service/tskm_svc.h"
+#include "tskm_debug.h"
+
+#define TSKM_PORTPF_IN() TSKM_PRINTF(TSKM_LOG_PORTPF, "%s:IN", __FUNCTION__)
+#define TSKM_PORTPF_IN_ARG(format, ...) TSKM_PRINTF(TSKM_LOG_PORTPF, "%s:IN:" format, __FUNCTION__, __VA_ARGS__)
+#define TSKM_PORTPF_OUT() TSKM_PRINTF(TSKM_LOG_PORTPF, "%s:OUT", __FUNCTION__)
+
+#define TSKM_PRIO_MIN 1
+#define TSKM_PRIO_MAX 99
+#define TSKM_PRIO_MIN_TSS -20
+#define TSKM_PRIO_MAX_TSS 19
+
+#define TSKM_TMP_DIRECTORY "/tmp"
+#define TSKM_TMP_TSKM_DIRECTORY TSKM_TMP_DIRECTORY "/tskm"
+#define TSKM_TMP_NV_INFO_FILEPATH TSKM_TMP_TSKM_DIRECTORY "/nvInfo"
+
+#define TSKM_NPP_NV_FILE_TAG SS_TASK_MANAGER "/nvInfo"
+
+/*********************************************************
+ * user->uid/gid conversion
+ *********************************************************/
+TSKM_STATIC int cnvUserName2UidGid(const char *user, uid_t *uid, gid_t *gid) {
+ int ret = -1;
+
+ if (0 == strcmp(user, "")) {
+ *uid = geteuid();
+ *gid = getegid();
+ } else {
+ static __thread size_t bufSize = 0;
+ static __thread char *buf = NULL;
+ struct passwd pwd;
+ struct passwd *result;
+
+ if (0 == bufSize) {
+ struct stat statInfo;
+
+ bufSize = -1;
+
+ if (0 != stat("/etc/passwd", &statInfo) || 0 >= statInfo.st_size) { // LCOV_EXCL_START 8: Because buf is a static variable and cannot be passed test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ // LCOV_EXCL_STOP
+
+ bufSize = statInfo.st_size * 2;
+
+ // Since TaskManager is a resident service, the area allocated here is expected to be released at process termination and is not explicitly released by free()
+ buf = (char *) malloc(sizeof(char) * bufSize); // NOLINT (runtime/printf)
+ if (NULL == buf) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 5: Error branching of the standard-function malloc
+ goto ERROR; // LCOV_EXCL_LINE 5: Error branching of the standard-function malloc
+ }
+ }
+
+ if (NULL == buf) { // LCOV_EXCL_BR_LINE 8: Because buf is a static variable and cannot be passed test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 8: Because buf is a static variable and cannot be passed test
+ goto ERROR; // LCOV_EXCL_LINE 8: Because buf is a static variable and cannot be passed test
+ }
+
+ ret = getpwnam_r(user, &pwd, buf, bufSize, &result);
+ if (ret != 0 || result == NULL) {
+ TSKM_ASSERT_PRINT(0, "ret = %d[%s]", ret, user);
+ goto ERROR;
+ }
+
+ *uid = pwd.pw_uid;
+ *gid = pwd.pw_gid;
+ }
+
+ ret = 0;
+
+ ERROR:
+
+ return ret;
+}
+
+/*********************************************************
+ * Convert Scheduling Policy Definitions Values (TSKM -> CL)
+ *********************************************************/
+TSKM_STATIC CL_ProcessSchedPolicy_t cnvTskmPolicy2ClPolicy(
+ TSKM_SVC_POLICY_t policy) {
+ switch (policy) {
+ case TSKM_SVC_POLICY_FIFO:
+ return CL_PROCESS_SCHED_POLICY_FIFO;
+ case TSKM_SVC_POLICY_TSS:
+ return CL_PROCESS_SCHED_POLICY_OTHER;
+ case TSKM_SVC_POLICY_RR:
+ return CL_PROCESS_SCHED_POLICY_RR;
+ default:
+ TSKM_ASSERT(0);
+ break;
+ }
+ return CL_PROCESS_SCHED_POLICY_OTHER;
+}
+
+/*********************************************************
+ * Process priority valid value determination
+ *********************************************************/
+TSKM_STATIC int chkPrioValue(TSKM_SVC_POLICY_t policy, int prio) {
+ switch (policy) {
+ case TSKM_SVC_POLICY_FIFO:
+ case TSKM_SVC_POLICY_RR:
+ if ((TSKM_PRIO_MIN > prio) || (prio > TSKM_PRIO_MAX)) {
+ TSKM_ASSERT(0);
+ }
+ break;
+ case TSKM_SVC_POLICY_TSS:
+ default:
+ if ((TSKM_PRIO_MIN_TSS > prio) || (prio > TSKM_PRIO_MAX_TSS)) {
+ TSKM_ASSERT(0);
+ }
+ break;
+ }
+
+ return prio;
+}
+
+/*********************************************************
+ * COMMONLIB initialization (at system startup)
+ *********************************************************/
+int tskm_pf_sysInit() {
+ int fd = 0;
+ int ret = 0;
+
+ TSKM_PORTPF_IN();
+
+ fd = CL_ProcessInit();
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 6: Error branching during process initialization
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 6: Error branching during process initialization
+ goto ERROR; // LCOV_EXCL_LINE 6: Error branching during process initialization
+ }
+
+ ret = CL_MonitorInit(CL_MONITOR_INIT_USER);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ TSKM_ASSERT_ERRNO(0);
+ }
+
+ TSKM_PORTPF_OUT();
+ return fd;
+ // LCOV_EXCL_START 6: Error branching during process initialization
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************************
+ * COMMONLIB initialization (at process startup)
+ *********************************************************/
+int tskm_pf_procInit() {
+ TSKM_PORTPF_IN();
+ // Originally called the _sys_Setup_CWORD64_API (NULL), but changed to empty function along to derete "_sys"
+
+ TSKM_PORTPF_OUT();
+ return 0;
+}
+
+/*********************************************************
+ * Process startup
+ *********************************************************/
+pid_t tskm_pf_createProc(TSKM_SVC_ATTR_t* p_svcAttr) {
+ TSKM_PORTPF_IN();
+ pid_t retPid = -1;
+ pid_t pid = -1;
+
+ CL_ProcessAttr_t attr;
+ char procPath[255];
+ char* procName;
+ uid_t setUid = 0;
+ gid_t setGid = 0;
+
+ if (0 != CL_ProcessCreateAttrInit(&attr)) { // LCOV_EXCL_BR_LINE 6: Error branching during process initialization
+ // LCOV_EXCL_START 6: Error branching during process initialization
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ // Process name setting(from basename)
+ if (strlen(p_svcAttr->path) < sizeof(procPath)) {
+ strcpy(procPath, p_svcAttr->path); // NOLINT (runtime/printf)
+ } else {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ procName = basename(procPath);
+ if (strlen(procName) >= 16) {
+ TSKM_ASSERT(0);
+ procName[16] = '\0';
+ }
+
+ if (0 != CL_ProcessCreateAttrSetName(&attr, procName)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 != cnvUserName2UidGid(p_svcAttr->user, &setUid, &setGid)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ setUid = geteuid();
+ setGid = getegid();
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 != CL_ProcessCreateAttrSetUid(&attr, setUid)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 != CL_ProcessCreateAttrSetGid(&attr, setGid)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ // All are group leaders in order to recover to the child processes of the service
+ if (0 != CL_ProcessCreateAttrSetGroup(&attr, 1)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ if (0 != CL_ProcessCreateAttrSetCpuAssign(&attr, p_svcAttr->cpuAssign)) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ if (0
+ != CL_ProcessCreateAttrSetSchedule(
+ &attr, cnvTskmPolicy2ClPolicy(p_svcAttr->policy),
+ chkPrioValue(p_svcAttr->policy, p_svcAttr->prio))) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ pid = CL_ProcessCreate(p_svcAttr->path, p_svcAttr->args, NULL, &attr);
+ if (pid == -1) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ retPid = pid;
+ ERROR:
+
+ TSKM_PORTPF_OUT();
+ return retPid;
+}
+
+/*********************************************************
+ * Recover termination processes
+ *********************************************************/
+int tskm_pf_cleanupProc(int sigFd, pid_t* p_pid, TSKM_ERR_t* p_err) {
+ int ret;
+ CL_ProcessCleanupInfo_t info;
+
+ ret = CL_ProcessCleanup(sigFd, &info);
+ if (ret != 0 && ret != 1) {
+ TSKM_ASSERT_PRINT(0, "ret = %d", ret);
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "SVC TERM:pid:%d code:%d status:%d", info.pid,
+ info.code, info.status);
+
+ switch (info.code) {
+ case CLD_STOPPED:
+ // Not comes here usually
+ TSKM_PRINTF(TSKM_LOG_STATE, "svc stoped\n");
+ goto ERROR;
+ case CLD_TRAPPED:
+ // Comes here only during debugging
+ TSKM_PRINTF(TSKM_LOG_STATE, "svc traped\n");
+ goto ERROR;
+ case CLD_CONTINUED:
+ // Not comes here usually
+ TSKM_PRINTF(TSKM_LOG_STATE, "svc continue\n");
+ goto ERROR;
+ default:
+ break;
+ }
+
+ *p_pid = info.pid;
+ *p_err =
+ (info.code != CLD_EXITED) ? TSKM_E_NG :
+ (info.code == CLD_EXITED && info.status != EXIT_SUCCESS) ?
+ TSKM_E_NG : TSKM_E_OK;
+
+ if (TSKM_E_OK != *p_err) {
+ TSKM_PRINTF(TSKM_LOG_SYSTEMDATA, "SVC ERR TERM:pid:%d code:%d status:%d",
+ info.pid, info.code, info.status);
+ }
+
+ return ret;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Force Terminating a Process Group
+ *********************************************************/
+int tskm_pf_terminateProcGroup(uint16_t pid) {
+ int ret;
+ pid_t pgid;
+
+ pgid = getpgid(pid);
+ if (pgid < 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "TERM SVC GROUP:pid:%dpgid:%d", pid, pgid);
+
+ ret = CL_ProcessEuthanizeGroup(pgid);
+ if (ret != 0) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ return 0;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Opening shared memory and trancating
+ *********************************************************/
+int tskm_pf_shmCreate_Open_Ftrn(const char* name, int32_t size, void** p_addr) {
+ int ret = 0;
+ int fd = 0;
+
+ fd = shm_open(name, O_CREAT | O_RDWR | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ ret = -1; // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ if (fd > 0) { // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ TSKM_ASSERT_ERRNO(close(fd) == 0); // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ } // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ return ret; // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ }
+
+ ret = ftruncate(fd, size);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ if (fd > 0) { // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ TSKM_ASSERT_ERRNO(close(fd) == 0); // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ } // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ return ret; // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ }
+
+ if (p_addr) { // LCOV_EXCL_BR_LINE 8: Because p_addr is set to NULL only
+ // LCOV_EXCL_START 8: Because p_addr is set to NULL only
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // Not supported
+ TSKM_ASSERT_ERRNO(0);
+ ret = -1;
+ if (fd > 0) {
+ TSKM_ASSERT_ERRNO(close(fd) == 0);
+ }
+ return ret;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = 0;
+ if (fd > 0) {
+ TSKM_ASSERT_ERRNO(close(fd) == 0);
+ }
+ return ret;
+}
+
+/*********************************************************
+ * Creating shared memory
+ *********************************************************/
+int tskm_pf_shmCreate(const char* name, int32_t size, void** p_addr) {
+ TSKM_PORTPF_IN_ARG("%s,%d", name, size);
+ struct stat statInfo;
+ int ret = -1;
+
+ if (stat(name, &statInfo) == 0) {
+ TSKM_ASSERT_PRINT(0, "Already Exist %s", name);
+ ret = 0; // To be Succeeded
+ TSKM_PORTPF_OUT();
+ return ret;
+ }
+
+ ret = tskm_pf_shmCreate_Open_Ftrn(name, size, p_addr);
+
+ TSKM_PORTPF_OUT();
+ return ret;
+}
+
+/*********************************************************
+ * Deleting shared memory
+ *********************************************************/
+int tskm_pf_shmDelete(const char* name) {
+ TSKM_PORTPF_IN_ARG("%s", name);
+ int ret = 0;
+
+ if (0 != shm_unlink(name)) {
+ TSKM_ASSERT_ERRNO(0);
+ }
+
+ TSKM_PORTPF_OUT();
+ return ret;
+}
+
+/*********************************************************
+ * Starting thread
+ *********************************************************/
+int tskm_pf_createThread(void* (*threadFunc)(void*), void* prm,
+ uint32_t priority, const char* threadName,
+ pthread_t* p_thId) {
+ TSKM_PORTPF_IN();
+
+ int ret;
+ CL_ThreadAttr_t cl_attr;
+
+ ret = CL_ThreadCreateAttrInit(&cl_attr);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 6: For processing initializing process
+ goto ERROR; // LCOV_EXCL_LINE 6: For processing initializing process
+ }
+
+ if (threadName) {
+ ret = CL_ThreadCreateAttrSetName(&cl_attr, threadName);
+ TSKM_ASSERT_ERRNO(ret == 0);
+ }
+
+ ret = CL_ThreadCreate(p_thId, NULL, &cl_attr, threadFunc, prm);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 6: For processing initializing process
+ goto ERROR; // LCOV_EXCL_LINE 6: For processing initializing process
+ }
+ int sched_policy;
+ struct sched_param sparam;
+
+ pthread_getschedparam(*p_thId, &sched_policy, &sparam);
+
+ sparam.sched_priority = priority;
+ if ((priority != 0) && (sched_policy == SCHED_OTHER)) {
+ sched_policy = SCHED_FIFO;
+ } else if ((priority == 0) && (sched_policy != SCHED_OTHER)) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ sched_policy = SCHED_OTHER; // LCOV_EXCL_LINE 6: For processing initializing process
+ }
+
+ ret = pthread_setschedparam(*p_thId, sched_policy, &sparam);
+ TSKM_ASSERT(ret == 0);
+ TSKM_PORTPF_OUT();
+ return 0;
+ ERROR: return -1;
+}
+/*********************************************************
+ * Send Stop Complete Response
+ *********************************************************/
+int tskm_pf_sendStopCompResp() {
+ EFrameworkunifiedStatus l_eStatus;
+ TSKM_PORTPF_IN();
+
+ l_eStatus = SendInterfaceunifiedOnStopResponseToSystemManager(eFrameworkunifiedStatusOK);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT(0);
+ }
+
+ TSKM_PORTPF_OUT();
+ return 0;
+}
+
+/*********************************************************
+ * ABORT
+ *********************************************************/
+int tskm_pf_abort() {
+ TSKM_PORTPF_IN();
+
+ TSKM_ASSERT(0);
+ sleep(1); // Sleep a little so that the logging at the time of abnormality may be interrupted
+
+ // Issure SIGSEG
+ printf("%d\n", *(int *) 0); // NOLINT (readability/casting)
+
+ TSKM_PORTPF_OUT();
+ return 0;
+}
+
+/*********************************************************
+ * EXIT
+ *********************************************************/
+int tskm_pf_exit(int status) { //LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_PORTPF_IN();
+
+ exit(status);
+
+ TSKM_PORTPF_OUT();
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/*********************************************************
+ * TOUCH
+ *********************************************************/
+int tskm_pf_touch(char* path) {
+ TSKM_PORTPF_IN();
+ int fd;
+ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ if (fd < 0) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ TSKM_ASSERT_ERRNO(close(fd) == 0);
+ TSKM_PORTPF_OUT();
+ return 0;
+ ERROR:
+ return -1;
+}
+
+/*********************************************************
+ * Touch
+ *********************************************************/
+int tskm_pf_mkTouchFileName(pid_t pid, char name[32]) {
+ TSKM_PORTPF_IN();
+
+ sprintf(name, "/tmp/tskm_touch%d", pid); // NOLINT (runtime/printf)
+
+ TSKM_PORTPF_OUT();
+ return 0;
+}
+
+/*********************************************************
+ * Read file
+ *********************************************************/
+static ssize_t readFile(const char* filePath, void* l_buf, ssize_t bufSize) {
+ int fd = -1;
+ ssize_t readSize, totalReadSize = 0;
+ char *p_buf = (char*) l_buf; // NOLINT (readability/casting)
+ fd = open(filePath, O_RDONLY);
+ if (fd == -1) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ do {
+ readSize = read(fd, p_buf, bufSize);
+ if (readSize == -1) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ } else if (readSize == 0) {
+ break;
+ }
+
+ p_buf += readSize;
+ bufSize -= readSize;
+ totalReadSize += readSize;
+ } while (bufSize > 0);
+
+ ERROR: if (fd != -1) {
+ close(fd);
+ }
+
+ return totalReadSize;
+}
+
+/*********************************************************
+ * Write to file
+ *********************************************************/
+static ssize_t writeFile(const char *filePath, const void* l_buf,
+ ssize_t bufSize) {
+ int ret = -1;
+ int fd = -1;
+
+ const char *p_buf = (const char*) l_buf;
+
+ ssize_t writeSize, totalWriteSize = 0;
+
+ fd = open(filePath, O_RDWR | O_TRUNC | O_CREAT, S_IRWXU);
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function open()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 5: Error branching of the standard-function open()
+ goto ERROR; // LCOV_EXCL_LINE 5: Error branching of the standard-function open()
+ }
+
+ do {
+ writeSize = write(fd, p_buf, bufSize);
+ if (writeSize == -1) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function write()
+ // LCOV_EXCL_START 5: Error branching of the standard-function write()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == EINTR) {
+ continue;
+ } else {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ // LCOV_EXCL_STOP
+ } else if (writeSize == 0) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function write()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 5: Error branching of the standard-function write()
+ }
+ p_buf += writeSize;
+ bufSize -= writeSize;
+ totalWriteSize += writeSize;
+ } while (bufSize > 0); // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function write()
+
+ ret = fsync(fd);
+ if (ret == -1) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function fsync()
+ // LCOV_EXCL_START 5: Error branching of the standard-function fsync()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ ERROR: if (fd != -1) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function open()
+ close(fd);
+ }
+
+ return totalWriteSize;
+}
+
+/*********************************************************
+ * Checksum calculation
+ *********************************************************/
+static uint32_t calcCheckSum(const void* p_buf, size_t bufSize) {
+ int ii;
+ int blockNum;
+ uint32_t sum = 0;
+ uint32_t *p_calcBuf = (uint32_t*) p_buf; // NOLINT (readability/casting)
+
+ blockNum = static_cast<int>(bufSize) / static_cast<int>(sizeof(uint32_t));
+
+ for (ii = 0; ii < blockNum; ii++) {
+ sum += p_calcBuf[ii];
+ }
+
+ return sum;
+}
+
+/*********************************************************
+ * Checking files
+ *********************************************************/
+static TSKM_BOOL_t checkFile(const char *filePath) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uint32_t checkSum;
+ struct stat st;
+ ssize_t readSize;
+ TSKM_NV_INFO_t nvInfo;
+ TSKM_BOOL_t isFileOk = TSKM_FALSE;
+
+ if (stat(filePath, &st) != 0) {
+ goto ERROR;
+ }
+
+ readSize = readFile(filePath, &nvInfo, sizeof(TSKM_NV_INFO_t));
+ if (readSize != sizeof(TSKM_NV_INFO_t)) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ checkSum = calcCheckSum(&nvInfo, offsetof(TSKM_NV_INFO_t, footer.checkSum));
+
+ if (checkSum != nvInfo.footer.checkSum) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ if (strncmp(nvInfo.header.version, TSKM_NV_STRUCT_VERSION,
+ sizeof(TSKM_NV_STRUCT_VERSION)) != 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ isFileOk = TSKM_TRUE;
+ ERROR: return isFileOk;
+}
+// LCOV_EXCL_STOP
+/*********************************************************
+ * Non-volatile file initialization (Including checksum write)
+ *********************************************************/
+static int initNvFile() {
+ int ii;
+ ssize_t writeSize;
+ TSKM_NV_INFO_t nvInfo;
+
+ TSKM_STATIC_ASSERT(sizeof(TSKM_NV_INFO_t) == TSKM_NV_SIZE_ALL);
+ TSKM_STATIC_ASSERT(
+ offsetof(TSKM_NV_INFO_t, footer.checkSum) % sizeof(uint32_t) == 0);
+
+ memset(&nvInfo, 0, sizeof(TSKM_NV_INFO_t));
+ sprintf(nvInfo.header.version, TSKM_NV_STRUCT_VERSION); // NOLINT (readability/casting)
+ nvInfo.body.rsvSvcNum = 0;
+ for (ii = 0; ii < TSKM_SVC_RESERVE_MAX; ii++) {
+ nvInfo.body.rsvSvcs[ii] = TSKM_SVCID_NONE;
+ }
+ nvInfo.footer.checkSum = calcCheckSum(
+ &nvInfo, offsetof(TSKM_NV_INFO_t, footer.checkSum));
+
+ writeSize = writeFile(TSKM_TMP_NV_INFO_FILEPATH, &nvInfo,
+ sizeof(TSKM_NV_INFO_t));
+ if (writeSize != sizeof(TSKM_NV_INFO_t)) { // LCOV_EXCL_BR_LINE 6: writeSize must be the size of TSKM_NV_INFO_t
+ // LCOV_EXCL_START 6: writeSize must be the size of TSKM_NV_INFO_t
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ return 0;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Non-volatile file initialization
+ *********************************************************/
+int tskm_pf_nvFileInit(HANDLE hApp) {
+ int ret = -1;
+ struct stat st;
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (stat(TSKM_TMP_TSKM_DIRECTORY, &st) != 0) { // LCOV_EXCL_BR_LINE 5:Standard C function return value
+ // LCOV_EXCL_START 5:Standard C function return value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = mkdir(TSKM_TMP_TSKM_DIRECTORY, S_IRWXU);
+ if (ret == -1) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = FrameworkunifiedNPRegisterPersistentFile(hApp, TSKM_NPP_NV_FILE_TAG);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: For processing initializing process
+ goto ERROR; // LCOV_EXCL_LINE 6: For processing initializing process
+ }
+
+ l_eStatus = FrameworkunifiedNPLoadPersistentFile(hApp, TSKM_TMP_NV_INFO_FILEPATH, TSKM_NPP_NV_FILE_TAG);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: For processing initializing process
+ goto ERROR; // LCOV_EXCL_LINE 6: For processing initializing process
+ }
+
+ return 0;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Non-volatile file read
+ *********************************************************/
+int tskm_pf_nvFileRead(HANDLE hApp, TSKM_NV_INFO_t* p_nvInfo) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ NC_LoadPersistedAck l_tMsgAck;
+ ssize_t readSize;
+ TSKM_BOOL_t isTmpFileOk = TSKM_FALSE;
+
+ if (sizeof(l_tMsgAck) != FrameworkunifiedGetMsgLength(hApp)) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_tMsgAck, sizeof(l_tMsgAck)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if ((strncmp(l_tMsgAck.cTag, TSKM_NPP_NV_FILE_TAG, sizeof(TSKM_NPP_NV_FILE_TAG)) == 0)
+ && (eFrameworkunifiedStatusOK == l_tMsgAck.eStatus)) {
+ if (checkFile(TSKM_TMP_NV_INFO_FILEPATH) == TSKM_TRUE) {
+ isTmpFileOk = TSKM_TRUE;
+ }
+ }
+
+ if (isTmpFileOk == TSKM_FALSE) {
+ int ret;
+
+ ret = initNvFile();
+ if (ret == -1) { // LCOV_EXCL_BR_LINE 6: must return ok
+ // LCOV_EXCL_START 6: must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ readSize = readFile(TSKM_TMP_NV_INFO_FILEPATH, p_nvInfo,
+ sizeof(TSKM_NV_INFO_t));
+ if (readSize != sizeof(TSKM_NV_INFO_t)) { // LCOV_EXCL_BR_LINE 6: readSize must be the size of TSKM_NV_INFO_t
+ // LCOV_EXCL_START 6: readSize must be the size of TSKM_NV_INFO_t
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = FrameworkunifiedNPReleasePersistentFile(hApp, eFrameworkunifiedPersistOnShutdown, TSKM_NPP_NV_FILE_TAG, TSKM_TMP_NV_INFO_FILEPATH);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ return 0;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Write non-volatile file (Including checksum)
+ *********************************************************/
+int tskm_pf_nvFileWrite(const TSKM_NV_INFO_t* p_nvInfo) {
+ ssize_t writeSize;
+ TSKM_NV_INFO_t nvInfo;
+
+ memcpy(&nvInfo, p_nvInfo, sizeof(TSKM_NV_INFO_t));
+
+ nvInfo.footer.checkSum = calcCheckSum(
+ &nvInfo, offsetof(TSKM_NV_INFO_t, footer.checkSum));
+
+ writeSize = writeFile(TSKM_TMP_NV_INFO_FILEPATH, &nvInfo,
+ sizeof(TSKM_NV_INFO_t));
+ if (writeSize != sizeof(TSKM_NV_INFO_t)) { // LCOV_EXCL_BR_LINE 6: writeSize must be the size of TSKM_NV_INFO_t
+ // LCOV_EXCL_START 6: writeSize must be the size of TSKM_NV_INFO_t
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+ return 0;
+} // LCOV_EXCL_BR_LINE 10: Final line
diff --git a/systemservice/task_manager/server/src/tskm_port_subsys.cpp b/systemservice/task_manager/server/src/tskm_port_subsys.cpp
new file mode 100755
index 0000000..cfdec49
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_port_subsys.cpp
@@ -0,0 +1,297 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_port_subsys.h"
+#include <pthread.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <native_service/cl_monitor.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/resm.h>
+//#include <stub/ss_diag.h>
+#include <string>
+
+#include "agl_thread.h"
+
+#include "tskm_main.h"
+#include "tskm_debug.h"
+#include "tskm_util.h"
+#include "tskm_port_pf.h"
+
+
+#ifndef oops_name2pid
+ #define oops_name2pid(processname) syscall(OOPSTRACE_SYSCALL, 17, processname)
+#endif
+
+
+typedef struct {
+ CL_MonitorSearch_t clMonSearch;
+ uint32_t resmId; // Session ID of RESM
+} SUB_SYS_CTX_t;
+
+static SUB_SYS_CTX_t g_sub;
+
+/******************************************************************
+ * Subsystem initialization
+ ******************************************************************/
+int tskm_sub_init(void) {
+ int clRet;
+ SUB_SYS_CTX_t* p_ctx = &g_sub;
+
+ clRet = CL_MonitorSearchInit(&p_ctx->clMonSearch);
+ if (clRet != 0) { // LCOV_EXCL_BR_LINE 6: For processing intializing process
+ // LCOV_EXCL_START 6:For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 6: For processing initializing process
+ }
+
+ return 0;
+ // LCOV_EXCL_START 6:For processing initializing process
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 1;
+ // LCOV_EXCL_STOP
+}
+
+/******************************************************************
+ * Subsystem termination
+ ******************************************************************/
+int tskm_sub_term(void) {
+ int ret;
+ SUB_SYS_CTX_t* p_ctx = &g_sub;
+
+ ret = CL_MonitorSearchDestroy(&p_ctx->clMonSearch);
+ if (ret != 0) {
+ TSKM_ASSERT_ERRNO(0);
+ }
+
+ return 0;
+}
+/*********************************************************
+ * REBOOT
+ *********************************************************/
+void tskm_sub_reboot(const TSKM_ERROR_REBOOT_t* p_info) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ TSKM_ASSERT(0);
+
+ l_eStatus = SendCpuResetRequestToSystemManager(
+ e_SS_SM_CPU_RESET_REASON_GENERIC_ERR, p_info->log.messageStr);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+}
+
+/*********************************************************
+ * REBOOT NORMAL
+ *********************************************************/
+void tskm_sub_reboot_normal(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = SendCpuResetRequestToSystemManager(
+ e_SS_SM_CPU_RESET_REASON_NORMAL);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT(0);
+ }
+}
+
+/*********************************************************
+ * LOGGING
+ *********************************************************/
+void tskm_sub_logging(const TSKM_LOGGING_INFO_t* p_info) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ eSMUserLogType l_eType;
+
+ switch (p_info->type) {
+ case TSKM_LOGGING_TYPE_GRP_RELAUNCH:
+ l_eType = e_SS_SM_CAPTURE_GROUP_RELAUNCH;
+ break;
+ case TSKM_LOGGING_TYPE_MODULE_LOGS:
+ default:
+ l_eType = e_SS_SM_CAPTURE_MODULE_LOGS;
+ break;
+ }
+
+ l_eStatus = SendUserInvokedLoggingRequestToSystemManager(l_eType,
+ p_info->messageStr);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+}
+
+/*********************************************************
+ * DEBUG DUMP
+ *********************************************************/
+void tskm_sub_debugDumpRes(BOOL bIsNeedSvcName, const char *p_dumpMsg) {
+ if (bIsNeedSvcName) { // LCOV_EXCL_BR_LINE 8: As the bIsNeedSvcName is set to FALSE only
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SSDEBUGDUMP("%s", p_dumpMsg); // LCOV_EXCL_LINE 8: As the bIsNeedSvcName is set to FALSE only
+ } else {
+ SSDEBUGDUMP_RAW("%s", p_dumpMsg);
+ }
+}
+
+/*********************************************************
+ * EXT BOOT INFO
+ *********************************************************/
+int tskm_sub_getExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info) {
+ EFrameworkunifiedStatus l_eStatus;
+ T_SS_SM_START_ExtDataStructType extStartupInfo;
+
+ l_eStatus = GetInterfaceunifiedOnStartExtInfo(extStartupInfo);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ memcpy(p_info, &extStartupInfo, sizeof(extStartupInfo));
+
+ return 0;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Service Error Monitoring Check
+ *********************************************************/
+TSKM_HUNG_INFO_t*
+tskm_sub_searchHungSvcs() {
+ int ret;
+ TSKM_HUNG_INFO_t *p_hungList = NULL;
+ SUB_SYS_CTX_t* p_ctx = &g_sub;
+
+ ret = CL_MonitorSearchTimeout(&p_ctx->clMonSearch);
+ if (ret == -1) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ if (0 < p_ctx->clMonSearch.entry_num) {
+ int ii;
+
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "TimeoutSvcNum = %d",
+ p_ctx->clMonSearch.entry_num);
+
+ if (NULL == p_ctx->clMonSearch.entry_list) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ p_hungList = (TSKM_HUNG_INFO_t *) malloc( // NOLINT (readability/casting)
+ sizeof(TSKM_HUNG_INFO_t) * (p_ctx->clMonSearch.entry_num + 1));
+ if (p_hungList == NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case.
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ for (ii = 0; ii < p_ctx->clMonSearch.entry_num; ii++) {
+ p_hungList[ii].pid = p_ctx->clMonSearch.entry_list[ii].pid;
+ p_hungList[ii].type = p_ctx->clMonSearch.entry_list[ii].type;
+ }
+ // set "-1" to pid at the end of list.
+ p_hungList[p_ctx->clMonSearch.entry_num].pid = -1;
+ }
+
+ ERROR: return p_hungList;
+}
+
+/*********************************************************
+ * RESM Initialization
+ *********************************************************/
+int tskm_sub_resmInit(void) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int redmFd;
+ SUB_SYS_CTX_t* p_ctx = &g_sub;
+ RESM_ERR_t resmRet = RESM_E_OK;
+ RESM_REQ_EVENT_t ev;
+
+ int pid;
+
+ resmRet = RESM_Open(NULL, &(p_ctx->resmId));
+ if (RESM_E_OK != resmRet) {
+ TSKM_ASSERT(0);
+
+#warning RESM backtrace disabled, because 'print_backtrace_pid' not support.
+#if 0
+ // Backtrace outoutput of the RESM
+ pid = oops_name2pid(MN_SS_RESOURCEMGR);
+ if(pid > 0){
+ TSKM_ASSERT(-1 != print_backtrace_pid(pid));
+ }else{
+ TSKM_PRINTF(TSKM_LOG_ERROR, "ERR : oops_name2pid %d , err:%d, msg:%s",
+ pid, errno, strerror(errno));
+ }
+#endif
+
+ goto ERROR;
+ }
+
+ resmRet = RESM_GetEventFd(p_ctx->resmId, &redmFd);
+ if (RESM_E_OK != resmRet) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ ev.reqEvent = RESM_EV_MEM;
+ ev.prm.restMemThresh = 512; // Threshold(BYTE)
+
+ resmRet = RESM_ReqEvent(p_ctx->resmId, &ev);
+ if (RESM_E_OK != resmRet) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ return redmFd;
+ ERROR: return -1;
+}
+// LCOV_EXCL_STOP
+/*********************************************************
+ * Get EV of RESM
+ *********************************************************/
+int tskm_sub_resmRcv(TSKM_EVENT_INFO_t* p_ev) {
+ SUB_SYS_CTX_t* p_ctx = &g_sub;
+ RESM_ERR_t resmRet = RESM_E_OK;
+ RESM_EV_t evFlag;
+
+ resmRet = RESM_GetEvent(p_ctx->resmId, &evFlag);
+ if (RESM_E_OK != resmRet) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ if (RESM_EV_MEM != evFlag) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_ERROR, "Detect LowMem");
+
+ p_ev->event = TSKM_EV_LCL_REP_LOWMEM;
+
+ return 0;
+ ERROR: return -1;
+}
+
+int tskm_sub_setWakeupOrder(const char* p_order) {
+ // Under consideration
+ return 0;
+} // LCOV_EXCL_BR_LINE 10: Gcov constraints (last row)
diff --git a/systemservice/task_manager/server/src/tskm_shutdown.cpp b/systemservice/task_manager/server/src/tskm_shutdown.cpp
new file mode 100755
index 0000000..1699f90
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_shutdown.cpp
@@ -0,0 +1,242 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_shutdown.h"
+#include "tskm_util.h"
+#include "tskm_debug.h"
+#include "tskm_state.h"
+
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+#include "tskm_gstep.h"
+
+
+/*********************************************************
+ * Get context of gradual startup
+ *********************************************************/
+TSKM_STATIC TSKM_GSTEP_CTX_t*
+gstepGetDownCtx(TSKM_MAIN_CTX_t* p_main) {
+ return &p_main->down;
+}
+
+/*********************************************************
+ * System shutdown completed
+ *********************************************************/
+TSKM_STATIC void downFinish(TSKM_MAIN_CTX_t* p_main) {
+ int ret;
+
+ // Send FrameworkunifiedOnStop response
+ ret = tskm_pf_sendStopCompResp();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 8: As ret never becomes non-zero
+ // LCOV_EXCL_START 8: As ret never becomes non-zero
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ }
+
+ // Terminate subsystems
+ tskm_sub_term();
+}
+/*********************************************************
+ * Challenge for a transition to the next state
+ *********************************************************/
+TSKM_STATIC void tryTransNextState(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_GSTEP_CTX_t* p_down;
+ TSKM_GSTEP_t* p_current;
+
+ p_down = gstepGetDownCtx(p_main);
+ p_current = gstepGetCurrent(p_down);
+
+ if (gstepIsLast(p_down)) {
+ TSKM_SVC_WAIT_STATE_t waitState;
+
+ // Checking the ShutdownWaitSVC termination status
+ waitState = tskm_svcsGetSvcTermWaitState(&p_main->svcs);
+ switch (waitState) {
+ case TSKM_SVC_WAIT_BOTH:
+ break;
+ case TSKM_SVC_WAIT_TRANSIENT:
+ if ((p_down->compState & INI_TERMCOMP_RESIDENT) != INI_TERMCOMP_RESIDENT) {
+ // Nonresident service termination processing
+ if (TSKM_E_OK != tskm_svcsAvtiveSvcTerm(&p_main->svcs)) { // LCOV_EXCL_BR_LINE 5: tskm_svcsAvtiveSvcTerm is always return TSKM_E_OK
+ // LCOV_EXCL_START 5: tskm_svcsAvtiveSvcTerm is always return TSKM_E_OK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ }
+ // Nonresident SVC terminated and started
+ p_down->compState |= INI_TERMCOMP_RESIDENT;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "TERM COMP :%s(%#llx)",
+ tskm_convTermCompId2Str(INI_TERMCOMP_RESIDENT),
+ INI_TERMCOMP_RESIDENT);
+ }
+ break;
+ case TSKM_SVC_WAIT_NONE:
+ // Complete ShutdownWaitSVC
+ // Nonresident SVC terminated and started
+ p_down->compState |= INI_TERMCOMP_TRANSIENT;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "TERM COMP :%s(%#llx)",
+ tskm_convTermCompId2Str(INI_TERMCOMP_TRANSIENT),
+ INI_TERMCOMP_TRANSIENT);
+ break;
+ default:
+ // LCOV_EXCL_START 8: As it does not meet the default requirements
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (tskm_svcsIsWaiting(&p_main->svcs) == TSKM_FALSE && // No waiting services
+ ((p_down->compState & p_current->nextTransCond)
+ == p_current->nextTransCond)) { // Event completion condition
+ if (gstepIsLast(p_down)) {
+ tskm_stateTransit(p_main, TSKM_ST_ACCON, TSKM_ST_ACCOFF);
+ } else {
+ tskm_stateTransit(p_main, TSKM_ST_DOWN, TSKM_ST_DOWN);
+ }
+ }
+}
+
+/*********************************************************
+ * Check and process gradual termination request
+ *********************************************************/
+TSKM_ERR_t tskm_entryDown_Check_Req(TSKM_MAIN_CTX_t* p_main,
+ TSKM_GSTEP_t* p_current) {
+ uint32_t ii;
+
+ if (0 == p_current->reqNum) {
+ EFrameworkunifiedStatus l_eStatus;
+
+ // If there is no gradual termination request, check the transition to the next step.
+ l_eStatus = FrameworkunifiedSendSelf(p_main->hApp, TSKM_TRANS_STEP_REQ, 0, NULL);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 5: Checked in death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ return TSKM_E_NG;
+ // LCOV_EXCL_STOP
+ }
+
+ } else {
+ // Gradual termination request
+ for (ii = 0; ii < p_current->reqNum; ii++) {
+ TSKM_ERR_t tskmRet;
+ TSKM_GSTEP_REQ_INFO_t* p_req = &p_current->reqList[ii];
+ TSKM_SVC_CTX_t* p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs,
+ p_req->svcId);
+
+ tskmRet = tskm_svcDownRequest(p_svc, p_req);
+ if (tskmRet != TSKM_E_OK) {
+ TSKM_ASSERT(0);
+ }
+ }
+ }
+ return TSKM_E_OK;
+}
+
+/*********************************************************
+ * Gradual termination entry process
+ *********************************************************/
+TSKM_ERR_t tskm_entryDown(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+
+ TSKM_GSTEP_CTX_t* p_down;
+ TSKM_GSTEP_t* p_current;
+
+ p_main->state = TSKM_ST_DOWN;
+ p_down = gstepGetDownCtx(p_main);
+ p_current = gstepGetCurrent(p_down);
+ if (p_current == NULL) { // LCOV_EXCL_BR_LINE 200:p_current can not be null
+ // LCOV_EXCL_START 200:p_current can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "DOWN GSTEP:%d", p_down->gstepIdx);
+
+ if (tskm_entryDown_Check_Req(p_main, p_current) == TSKM_E_NG) { // LCOV_EXCL_BR_LINE 200:the function of tskm_entryDown_Check_Req can not be TSKM_E_NG at this case // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 200:tskm_entryDown_Check_Req can not be TSKM_E_NG at this case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (p_current->nextTransCond) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "WAIT COMP:%s(%llx)",
+ tskm_convTermCompId2Str(p_current->nextTransCond),
+ p_current->nextTransCond);
+ }
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+
+ ERROR: tskm_pf_abort();
+ return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Gradual termination exit process
+ *********************************************************/
+TSKM_ERR_t tskm_exitDown(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+ TSKM_GSTEP_CTX_t* p_down;
+
+ p_down = gstepGetDownCtx(p_main);
+
+ if (gstepIsLast(p_down)) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "DOWN FINISH");
+ downFinish(p_main); // Final process of termination
+ }
+
+ changeNextStep(p_down); // Proceed to the next step
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+/*********************************************************
+ * Hander during gradual termination
+ *********************************************************/
+TSKM_ERR_t tskm_handleDown(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_FUNC_IN();
+
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REP_DOWN_COMP: // Notificaton for event completion in termination
+ {
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "TERM COMP :%s(%#llx) from:%d",
+ tskm_convTermCompId2Str(p_ev->prm.repDownComp.compId),
+ p_ev->prm.repDownComp.compId, p_ev->fromPid);
+ TSKM_GSTEP_CTX_t* p_down = gstepGetDownCtx(p_main);
+ p_down->compState |= p_ev->prm.repDownComp.compId;
+ tryTransNextState(p_main);
+ }
+ break;
+ case TSKM_EV_LCL_CHG_SVC_STATE: // Service state change
+ tryTransNextState(p_main);
+ break;
+ case TSKM_EV_LCL_REQ_TRANS_STEP: //Step transition request
+ tryTransNextState(p_main);
+ break;
+ default:
+ tskm_handleAccon(p_main, p_ev);
+ break;
+ }
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/systemservice/task_manager/server/src/tskm_state.cpp b/systemservice/task_manager/server/src/tskm_state.cpp
new file mode 100755
index 0000000..b777090
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_state.cpp
@@ -0,0 +1,452 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_state.h"
+#include <stdlib.h>
+#include "tskm_util.h"
+#include "tskm_debug.h"
+#include "tskm_wakeup.h"
+#include "tskm_shutdown.h"
+#include "tskm_port_subsys.h"
+#include "tskm_port_pf.h"
+
+
+
+// Prototype declarations
+TSKM_ERR_t tskm_entryAccoff(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitAccoff(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_handleAccoff(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+TSKM_ERR_t tskm_entryAccon(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitAccon(TSKM_MAIN_CTX_t* p_main);
+
+TSKM_ERR_t tskm_entryRunning(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitRunning(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_handleRunning(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+// Structures of state transitioning callback functions
+typedef TSKM_ERR_t (*entry_state_t)(TSKM_MAIN_CTX_t* p_main);
+typedef TSKM_ERR_t (*exit_state_t)(TSKM_MAIN_CTX_t* p_main);
+typedef TSKM_ERR_t (*event_handler_t)(TSKM_MAIN_CTX_t* p_main,
+ TSKM_EVENT_INFO_t* p_ev);
+
+typedef struct {
+ TSKM_STATE_t state;
+ entry_state_t entry_func;
+ exit_state_t exit_func;
+ event_handler_t event_handler;
+} state_func_table_t;
+
+// State specific function table
+static const state_func_table_t state_func_table[] = { { TSKM_ST_ACCOFF,
+ tskm_entryAccoff, tskm_exitAccoff, tskm_handleAccoff }, { TSKM_ST_ACCON,
+ tskm_entryAccon, tskm_exitAccon, tskm_handleAccon }, { TSKM_ST_WAKEUP,
+ tskm_entryWakeup, tskm_exitWakeup, tskm_handleWakeup }, { TSKM_ST_RUNNING,
+ tskm_entryRunning, tskm_exitRunning, tskm_handleRunning }, { TSKM_ST_DOWN,
+ tskm_entryDown, tskm_exitDown, tskm_handleDown }, { 0, 0, 0, 0 } };
+
+/****************************************************
+ * ACC OFF ENTRY
+ ****************************************************/
+TSKM_ERR_t tskm_entryAccoff(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+ p_main->state = TSKM_ST_ACCOFF;
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * ACC OFF EXIT
+ *************************************************************************/
+TSKM_ERR_t tskm_exitAccoff(TSKM_MAIN_CTX_t* p_main) {
+ // Do nothing
+ // Called only once at startup
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * ACC OFF HANDLE
+ *************************************************************************/
+TSKM_ERR_t tskm_handleAccoff(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_ASSERT(0); // Do nothing
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * ACC ON ENTRY
+ *************************************************************************/
+TSKM_ERR_t tskm_entryAccon(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+ p_main->state = TSKM_ST_ACCON;
+
+ tskm_entryState(p_main, TSKM_ST_WAKEUP);
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * ACC ON HANDLE
+ *************************************************************************/
+TSKM_ERR_t tskm_exitAccon(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ if (TSKM_SUB_STATE_IS(p_main, TSKM_ST_WAKEUP)) { // LCOV_EXCL_BR_LINE 8:Because the condition is never true
+ // LCOV_EXCL_START 8: Because the condition is never true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskmRet = tskm_exitState(p_main, TSKM_ST_WAKEUP);
+ // LCOV_EXCL_STOP
+ } else if (TSKM_SUB_STATE_IS(p_main, TSKM_ST_RUNNING)) { // LCOV_EXCL_BR_LINE 8: Because the condition is never true
+ // LCOV_EXCL_START 8: Because the condition is never true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskmRet = tskm_exitState(p_main, TSKM_ST_RUNNING);
+ // LCOV_EXCL_STOP
+ } else if (TSKM_SUB_STATE_IS(p_main, TSKM_ST_DOWN)) { // LCOV_EXCL_BR_LINE 8:Because the condition is never false
+ tskmRet = tskm_exitState(p_main, TSKM_ST_DOWN);
+ }
+
+ TSKM_ERR_CHK(tskmRet, TSKM_E_OK, ERROR); // LCOV_EXCL_BR_LINE 8: Because the tskmRet does not change to NG
+ p_main->isExec = TSKM_FALSE;
+ ERROR:
+ TSKM_FUNC_OUT();
+ return tskmRet;
+}
+
+/*************************************************************************
+ * POLL EVENT HANDLE
+ *************************************************************************/
+TSKM_STATIC void checkHungSvcs(TSKM_MAIN_CTX_t* p_main) {
+ int ret;
+ TSKM_HUNG_INFO_t *p_hungSvcList = NULL;
+
+ p_hungSvcList = tskm_sub_searchHungSvcs();
+ if (p_hungSvcList != NULL) {
+ int hungSvcNum = 0;
+
+ while (p_hungSvcList[hungSvcNum].pid != -1) {
+ pid_t pid = p_hungSvcList[hungSvcNum].pid;
+
+ TSKM_SVC_CTX_t* p_svc = tskm_svcsGetSvcByPid(&p_main->svcs, pid);
+
+ if (p_svc) {
+ TSKM_PRINTF(TSKM_LOG_SYSTEMDATA, "HUNG SVC(%s:%d), TYPE(%d)",
+ p_svc->attr->name, pid, p_hungSvcList[hungSvcNum].type);
+
+ ret = tskm_pf_terminateProcGroup(static_cast<uint16_t>(pid));
+ if (ret != 0) {
+ TSKM_ASSERT(0);
+ }
+
+ } else {
+ TSKM_PRINTF(TSKM_LOG_WARN, "UNKNOWN HUNG SVC(%d), TYPE(%d)", pid,
+ p_hungSvcList[hungSvcNum].type);
+ }
+
+ hungSvcNum++;
+ }
+
+ free(p_hungSvcList);
+ }
+
+ return;
+}
+
+#define AVAILABILITY_CHECK_RETRY_COUNT 24
+
+/*************************************************************************
+ * CHECK SVC AVAILABILITY
+ *************************************************************************/
+TSKM_STATIC void checkSvcAvailability(TSKM_MAIN_CTX_t* p_main) {
+ for (uint32_t ii = 0; ii < p_main->svcs.svcNum; ii++) {
+ if (p_main->svcs.svcList[ii].state == TSKM_SVC_RUNNING
+ && !p_main->svcs.svcList[ii].isAvailable) {
+ p_main->svcs.svcList[ii].watchCnt++;
+ TSKM_ASSERT_PRINT(0, "WAIT AVAILABILITY FOR %s(%d) (%d/%d)",
+ p_main->svcs.svcList[ii].attr->name,
+ p_main->svcs.svcList[ii].pid,
+ p_main->svcs.svcList[ii].watchCnt,
+ AVAILABILITY_CHECK_RETRY_COUNT);
+
+ if (p_main->svcs.svcList[ii].watchCnt > AVAILABILITY_CHECK_RETRY_COUNT) {
+ int ret;
+
+ ret = tskm_pf_terminateProcGroup(static_cast<uint16_t>(p_main->svcs.svcList[ii].pid));
+ if (ret != 0) {
+ TSKM_ASSERT(0);
+ }
+ }
+ }
+ }
+
+ return;
+}
+
+/*************************************************************************
+ * POLL EVENT HANDLE
+ *************************************************************************/
+TSKM_STATIC void handlePolling(TSKM_MAIN_CTX_t* p_main) {
+ checkHungSvcs(p_main);
+
+ checkSvcAvailability(p_main);
+
+ return;
+}
+
+/*************************************************************************
+ * LOW MEMORY EVENT HANDLE
+ *************************************************************************/
+TSKM_STATIC void handleLowMem(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ tskmRet = tskm_svcsCallLowMem(&p_main->svcs);
+ if (TSKM_E_OK != tskmRet) {
+ TSKM_ASSERT(0);
+ }
+
+ return;
+}
+/*************************************************************************
+ * ACC ON HANDLE
+ *************************************************************************/
+TSKM_ERR_t tskm_handleAccon(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_FUNC_IN();
+
+ switch (p_ev->event) {
+ case TSKM_EV_LCL_REQ_SDUMP:
+ tskm_svcsDump(&p_main->svcs);
+ break;
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REP_POLLING:
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "watch timer polling event.");
+ handlePolling(p_main);
+ break;
+ default:
+ TSKM_PRINTF(TSKM_LOG_STATE, "IGNORE:%s(%d)",
+ tskm_convEvent2Str(p_ev->event), p_ev->event);
+ break;
+ }
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * BOOT RESERVED SERVICES
+ *************************************************************************/
+static int bootRsvSvcs(TSKM_MAIN_CTX_t* p_main) {
+ uint32_t ii;
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+ uint8_t rsvSvcNum = p_main->nvInfo.body.rsvSvcNum;
+ TSKM_SVCID_t* p_rsvSvcs = p_main->nvInfo.body.rsvSvcs;
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "RSV SVC NUM = %d", rsvSvcNum);
+
+ for (ii = 0; ii < rsvSvcNum; ii++) {
+ TSKM_GSTEP_REQ_INFO_t req = { 0 };
+ TSKM_SVC_CTX_t* p_svc;
+
+ p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs, p_rsvSvcs[ii]);
+ if (p_svc == NULL) {
+ TSKM_ASSERT(0);
+ continue;
+ }
+
+ tskmRet = tskm_svcExec(p_svc);
+ if (TSKM_E_OK != tskmRet) {
+ TSKM_ASSERT(0);
+ continue;
+ }
+ if (p_svc->state == TSKM_SVC_WAITCONNECT) {
+ // In the state waiting for execution
+ req.svcId = p_rsvSvcs[ii];
+ req.localStep = TSKM_LSTEP_ALL;
+ tskmRet = tskm_svcWakeupRequest(p_svc, &req);
+ if (TSKM_E_OK != tskmRet) { // LCOV_EXCL_BR_LINE 8: Because the condition is never true
+ // LCOV_EXCL_START 8: Because the condition is never true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_PRINT(0, "tskmRet = %d", tskmRet);
+ continue;
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+
+ if (rsvSvcNum != 0) {
+ int ret;
+
+ for (ii = 0; ii < TSKM_SVC_RESERVE_MAX; ii++) {
+ p_rsvSvcs[ii] = TSKM_SVCID_NONE;
+ }
+
+ p_main->nvInfo.body.rsvSvcNum = 0;
+
+ ret = tskm_pf_nvFileWrite(&p_main->nvInfo);
+ if (ret == -1) { // LCOV_EXCL_BR_LINE 8: Because the tskm_pf_nvFileWrite() only returns a return value of 0
+ // LCOV_EXCL_START 8:Because the condition is never true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ return 0;
+ // LCOV_EXCL_START 8: Because the tskm_pf_nvFileWrite() only returns a return value of 0
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
+/*************************************************************************
+ * RUN ENTRY
+ *************************************************************************/
+TSKM_ERR_t tskm_entryRunning(TSKM_MAIN_CTX_t* p_main) {
+ int ret;
+
+ TSKM_FUNC_IN();
+ p_main->state = TSKM_ST_RUNNING;
+
+ ret = bootRsvSvcs(p_main);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 8: Because bootRsvSvcs returns only a return value of 0
+ // LCOV_EXCL_START 8: Because bootRsvSvcs returns only a return value of 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ }
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * RUN EXIT
+ *************************************************************************/
+TSKM_ERR_t tskm_exitRunning(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * RUN HANDLE
+ *************************************************************************/
+TSKM_ERR_t tskm_handleRunning(TSKM_MAIN_CTX_t* p_main,
+ TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_FUNC_IN();
+
+ switch (p_ev->event) {
+ case TSKM_EV_LCL_REQ_STOP:
+ tskm_stateTransit(p_main, TSKM_ST_RUNNING, TSKM_ST_DOWN);
+ break;
+ case TSKM_EV_LCL_REP_LOWMEM:
+ handleLowMem(p_main);
+ break;
+ default:
+ tskm_handleAccon(p_main, p_ev);
+ break;
+ }
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * Get transition table
+ *************************************************************************/
+static const state_func_table_t*
+tskm_getFuncTable(TSKM_STATE_t state) {
+ int i;
+ for (i = 0; state_func_table[i].state != 0; i++) {
+ if (state == state_func_table[i].state) {
+ return &state_func_table[i];
+ }
+ }
+ TSKM_ASSERT(0);
+ return &state_func_table[0];
+}
+
+/*************************************************************************
+ * State transition instructions
+ *************************************************************************/
+TSKM_ERR_t tskm_stateTransit(TSKM_MAIN_CTX_t* p_main, TSKM_STATE_t srcState,
+ TSKM_STATE_t dstState) {
+ TSKM_ERR_t tskmRet;
+ TSKM_PRINTF(TSKM_LOG_STATE, "STATE:%s(%s) -> %s",
+ tskm_convState2Str(srcState), tskm_convState2Str(p_main->state),
+ tskm_convState2Str(dstState));
+
+ tskmRet = tskm_exitState(p_main, srcState);
+ TSKM_ERR_CHK(tskmRet, TSKM_E_OK, ERROR); // LCOV_EXCL_BR_LINE 8: Because TSKM_ERR_CHK does not specify a goto ERROR condition
+ tskmRet = tskm_entryState(p_main, dstState);
+ TSKM_ERR_CHK(tskmRet, TSKM_E_OK, ERROR); // LCOV_EXCL_BR_LINE 8: Because TSKM_ERR_CHK does not specify a goto ERROR condition
+ return TSKM_E_OK;
+
+ // LCOV_EXCL_START 8: Because TSKM_ERR_CHK does not specify a goto ERROR condition
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return TSKM_E_NG;
+ // LCOV_EXCL_STOP
+}
+
+/*************************************************************************
+ * Event handler
+ *************************************************************************/
+void tskm_handleEvent(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev) {
+ event_handler_t handlerFunc;
+ handlerFunc = tskm_getFuncTable(p_main->state)->event_handler;
+ handlerFunc(p_main, p_ev);
+}
+
+/****************************************************
+ * State transitioning entry process
+ ****************************************************/
+TSKM_ERR_t tskm_entryState(TSKM_MAIN_CTX_t* p_rec, TSKM_STATE_t state) {
+ TSKM_ERR_t ret = TSKM_E_NG;
+ const state_func_table_t* p_table = tskm_getFuncTable(state);
+
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "entry :%s", tskm_convState2Str(state));
+ if (p_table->entry_func) { // LCOV_EXCL_BR_LINE 8: Because p_table->entry_func never becomes 0
+ ret = ((*p_table->entry_func)(p_rec));
+ } else {
+ // LCOV_EXCL_START 8: Because p_table->entry_func never becomes 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ }
+ return ret;
+}
+
+/****************************************************
+ * State transitioning exit process
+ ****************************************************/
+TSKM_ERR_t tskm_exitState(TSKM_MAIN_CTX_t* p_rec, TSKM_STATE_t state) {
+ TSKM_ERR_t ret = TSKM_E_NG;
+ const state_func_table_t* p_table = tskm_getFuncTable(state);
+
+ if (p_table->exit_func) { // LCOV_EXCL_BR_LINE 8: Because p_table->exit_func never becomes 0
+ ret = (*p_table->exit_func)(p_rec);
+ } else {
+ // LCOV_EXCL_START 8: Because p_table->exit_func never becomes 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ }
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "exit :%s", tskm_convState2Str(state));
+ return ret;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/systemservice/task_manager/server/src/tskm_svc.cpp b/systemservice/task_manager/server/src/tskm_svc.cpp
new file mode 100755
index 0000000..2f9abc1
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_svc.cpp
@@ -0,0 +1,970 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "system_service/tskm_svc.h"
+#include <string.h>
+#include <stdlib.h>
+#include <sys/inotify.h>
+#include <errno.h>
+
+#include <native_service/ns_np_service_if.h>
+#include <string>
+
+#include "tskm_debug.h"
+#include "tskm_util.h"
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+#include "tskm_comm.h"
+
+
+/*********************************************************
+ * Is the target event of the service handler?
+
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t isSvcEvent(const TSKM_EVENT_INFO_t* p_ev) {
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REP_CONNECT:
+ case TSKM_EV_PRI_REP_DISCONNECT:
+ case TSKM_EV_PRI_RES_WAKEUP:
+ case TSKM_EV_PRI_RES_DOWN:
+ case TSKM_EV_PRI_RES_DEBUGDUMP:
+ case TSKM_EV_PRI_REQ_EXIT:
+ case TSKM_EV_SVC_REP_TERM:
+ return TSKM_TRUE;
+ break;
+ default:
+ break;
+ }
+ return TSKM_FALSE;
+}
+
+/*********************************************************
+ * Get service context
+ *********************************************************/
+TSKM_STATIC TSKM_SVC_CTX_t*
+getSvcCtxBySvcId(TSKM_SVCS_CTX_t* p_svcs, TSKM_SVCID_t svcId) {
+ uint32_t ii;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ if (p_svcs->svcList[ii].attr->svcId == svcId) {
+ return &p_svcs->svcList[ii];
+ }
+ }
+ TSKM_ASSERT(0);
+ return NULL;
+}
+
+/*********************************************************
+ * Get service context
+ *********************************************************/
+TSKM_STATIC TSKM_SVC_CTX_t*
+getSvcCtxByPid(TSKM_SVCS_CTX_t* p_svcs, pid_t pid) {
+ uint32_t ii;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ if (p_svcs->svcList[ii].pid == pid) {
+ return &p_svcs->svcList[ii];
+ }
+ }
+ return NULL;
+}
+
+/*********************************************************
+ * Get service context
+ *********************************************************/
+TSKM_STATIC TSKM_SVC_CTX_t*
+getSvcCtxByName(TSKM_SVCS_CTX_t* p_svcs, const char *p_name) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uint32_t ii;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ if (0
+ == strncmp(p_svcs->svcList[ii].attr->name, p_name,
+ strlen(p_svcs->svcList[ii].attr->name))) {
+ return &p_svcs->svcList[ii];
+ }
+ }
+ return NULL;
+}
+// LCOV_EXCL_STOP
+/*********************************************************
+ * Issuing a start request to the service
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t wakeupRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_PRI_REQ_WAKEUP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.reqWakeup.svcId = p_svc->attr->svcId;
+ ev.prm.reqWakeup.localStep = p_req->localStep;
+ ev.prm.reqWakeup.isDynamic =
+ (p_svc->attr->lifeCycle == TSKM_SVC_LC_DYNAMIC) ? TSKM_TRUE : TSKM_FALSE;
+ // Since there is no startup in the P_CWORD72_ but only communication in the ALL/LAST,
+ // the startup information is optimized including the startup information in the communication of the WakeupRequest.
+ memcpy(&ev.prm.reqWakeup.bootInfo, &p_svc->bootInfo,
+ sizeof(ev.prm.reqWakeup.bootInfo));
+ memcpy(&ev.prm.reqWakeup.extBootInfo, &p_svc->extBootInfo,
+ sizeof(ev.prm.reqWakeup.extBootInfo));
+
+ ret = tskm_sockSend(p_svc->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ p_svc->waitResCnt++;
+ p_svc->state = TSKM_SVC_WAKEUP;
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Touch services and extend EXIT timeouts
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t reqTouch(TSKM_SVC_CTX_t* p_svc) {
+#define TSKM_BUF_LEN ( 4 * ( sizeof(struct inotify_event) ) ) /* read size */
+ TSKM_ERR_t funcRet = TSKM_E_NG;
+ char touchFileName[32];
+ BOOL isNeedRetry = FALSE;
+
+ int iFd = p_svc->iFd;
+ int wd = 0;
+
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+ bzero(&ev, sizeof(ev));
+
+ // Create monitoring files
+ tskm_pf_mkTouchFileName(p_svc->pid, touchFileName);
+ if (0 != tskm_pf_touch(touchFileName)) {
+ goto ERROR;
+ }
+
+ // Synchronize by iNortify
+ wd = inotify_add_watch(iFd, touchFileName, IN_DELETE_SELF);
+ if (wd == -1) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ // Send Touch request
+ ev.event = TSKM_EV_PRI_REQ_TOUCH;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(p_svc->connFd, &ev);
+ if (ret <= 0) {
+ // Immediately after the nonresident service process terminates, since the TaskManager service status is other than DORMANT
+ // (mainly DOWN), the socket may be discarded and communication may fail, so retry
+ funcRet = TSKM_E_RETRY;
+ TSKM_PRINTF(TSKM_LOG_WARN, "ret = %d", ret);
+ goto ERROR;
+ }
+
+ // Wait for Touch completion
+ while (1) {
+ int maxFd = 0;
+ int ret;
+ fd_set fds;
+ FD_ZERO(&fds);
+ struct timeval timeout = { 0 };
+ timeout.tv_sec = TSKM_CFG_TOUCH_TIMEOUT;
+
+ FD_SET(iFd, &fds);
+ maxFd = iFd;
+
+ ret = select(maxFd + 1, &fds, NULL, NULL, &timeout);
+ if (ret == 0) {
+ TSKM_ASSERT_PRINT(0, "TIMEOUT:%s", touchFileName); // Timeout occurs
+ isNeedRetry = TRUE;
+ break;
+ } else if (ret < 1) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ }
+
+ if (FD_ISSET(iFd, &fds)) {
+ int length;
+ uint8_t buf[TSKM_BUF_LEN];
+
+ length = static_cast<int>(read(iFd, buf, TSKM_BUF_LEN));
+ if (length < 0) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ struct inotify_event *event = (struct inotify_event *) buf;
+ if (event->mask & IN_DELETE_SELF) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "TouchOK");
+ wd = 0;
+ // When a file is deleted, the association with the monitoring target is automatically released and inotify_rm_watch is no longer needed.
+ break;
+ } else {
+ TSKM_ASSERT_PRINT(0, "%x", event->mask);
+ }
+ }
+ }
+
+ if (isNeedRetry) {
+ funcRet = TSKM_E_RETRY;
+ } else {
+ funcRet = TSKM_E_OK;
+ }
+
+ ERROR: if (wd > 0) {
+ TSKM_ASSERT_ERRNO(0 == inotify_rm_watch(iFd, wd))
+ }
+
+ if (access(touchFileName, F_OK) == 0) {
+ // Timeout care
+ unlink(touchFileName);
+ }
+
+ return funcRet;
+}
+
+/*********************************************************
+ * Availability Monitoring Callbacks for Services
+ *********************************************************/
+EFrameworkunifiedStatus OnSvcAvailability(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PCSTR availabilityName;
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+ TSKM_SVC_CTX_t* p_svc;
+
+ availabilityName = FrameworkunifiedGetLastNotification(hApp);
+
+ std::string str = availabilityName;
+
+// unsigned int position;
+// if (std::string::npos != (position = static_cast<unsigned int>(str.find("/Availability", 0)))) {
+ ssize_t position;
+ if (0 <= (position = str.find("/Availability", 0))) {
+ str.erase(position, position + strlen("/Availability"));
+ }
+
+ p_svc = getSvcCtxByName(&p_main->svcs, str.c_str());
+ if (p_svc) {
+ p_svc->isAvailable = FrameworkunifiedIsServiceAvailable(hApp) ? TSKM_TRUE : TSKM_FALSE;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "%s Availability %s", p_svc->attr->name,
+ (p_svc->isAvailable == TSKM_TRUE) ? "TRUE" : "FALSE");
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+/*********************************************************
+ * Starting Availability Monitoring of Services
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t startWatchAvailability(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_ERR_t funcRet = TSKM_E_OK;
+
+ // LCOV_EXCL_BR_START 8: Since the condition is checked by the caller, it is not true.
+ if (p_svc->attr->type == TSKM_SVC_TYPE_UNKNONW) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ p_svc->isAvailable = TSKM_TRUE; // LCOV_EXCL_LINE 8: Since the condition is checked by the caller, it is not true.
+ } else {
+ EFrameworkunifiedStatus taskmanagerStatus;
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+ SS_String availabilityName = p_svc->attr->name;
+
+ availabilityName.append("/Availability");
+
+ taskmanagerStatus = FrameworkunifiedSubscribeNotificationWithCallback(p_main->hApp,
+ availabilityName.c_str(),
+ OnSvcAvailability);
+ if (eFrameworkunifiedStatusOK != taskmanagerStatus) {
+ TSKM_ASSERT(0);
+ funcRet = TSKM_E_NG;
+ }
+ }
+
+ return funcRet;
+}
+
+/*********************************************************
+ * Service startup sub
+ *********************************************************/
+void svcExec_Process(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_ERR_t funcRet;
+
+ if (p_svc->attr->type == TSKM_SVC_TYPE_NATIVE) {
+ p_svc->state = TSKM_SVC_WAITCONNECT;
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "[ST:%d] WAIT_EXEC", p_svc->pid);
+ funcRet = startWatchAvailability(p_svc);
+ if (TSKM_E_OK != funcRet) {
+ TSKM_ASSERT(0);
+ p_svc->isAvailable = TSKM_TRUE;
+ }
+ } else {
+ p_svc->state = TSKM_SVC_RUNNING;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "[ST:%d] RUN", p_svc->pid);
+ p_svc->isAvailable = TSKM_TRUE;
+ }
+ return;
+}
+
+/*********************************************************
+ * Service startup main
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t svcExec(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_ERR_t funcRet = TSKM_E_NG;
+ pid_t pid;
+
+ if (p_svc == NULL) { // LCOV_EXCL_BR_LINE 6:double check
+ // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (p_svc->state == TSKM_SVC_DISABLE) {
+ // Prohibited startup
+ TSKM_ASSERT(0);
+ return TSKM_E_STATE;
+ } else if (p_svc->state == TSKM_SVC_WAITCONNECT) {
+ return TSKM_E_OK;
+ } else if (p_svc->state != TSKM_SVC_DORMANT) {
+ // Already started
+ funcRet = reqTouch(p_svc);
+ if (TSKM_E_OK != funcRet) {
+ TSKM_PRINTF(TSKM_LOG_WARN, "funcRet = %d", funcRet);
+ goto ERROR;
+ }
+ return TSKM_E_OK;
+ }
+
+ pid = tskm_pf_createProc(p_svc->attr);
+ if (pid <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ TSKM_PRINTF(TSKM_LOG_STATE, "EXEC %s:%d", p_svc->attr->name, pid);
+
+ p_svc->pid = pid;
+ p_svc->waitReqCnt = 0;
+
+ // Startup service
+ svcExec_Process(p_svc);
+
+ funcRet = TSKM_E_OK;
+ ERROR: return funcRet;
+}
+
+/*********************************************************
+ * Issuing a start request to the service
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t svcWakeupRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req) {
+ if (p_svc == NULL || p_svc->state == TSKM_SVC_DISABLE) { // LCOV_EXCL_BR_LINE 6: Since this function has always been called after checking // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return TSKM_E_STATE; // LCOV_EXCL_LINE 6: Since this function has always been called after checking
+ } else if (p_svc->state == TSKM_SVC_WAITCONNECT) {
+ // Remember it once and issue a request when the CONNECT completes.
+ p_svc->request[p_svc->waitReqCnt] = *p_req;
+ p_svc->waitReqCnt++;
+ } else {
+ TSKM_ERR_t tskmRet;
+ tskmRet = wakeupRequest(p_svc, p_req);
+ TSKM_ERR_CHK_DFT;
+ }
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Service reboot processing
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t svcErrTermPost(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+
+ TSKM_PRINTF(TSKM_LOG_SYSTEMDATA, "ERR TERM SVC(%s:%d)", p_svc->attr->name,
+ p_svc->pid);
+
+ if (p_svc->attr->lifeCycle == TSKM_SVC_LC_ALWAYS || (p_svc->errTermCnt > p_svc->attr->retryCnt && (uint32_t) -1 != p_svc->attr->retryCnt)) { // NOLINT(whitespace/line_length)
+ TSKM_ERROR_REBOOT_t rebootInfo;
+
+ TSKM_ASSERT(0);
+ memset(&rebootInfo, 0, sizeof(TSKM_ERROR_REBOOT_t));
+ rebootInfo.type = TSKM_ERROR_REBOOT_NORMAL;
+ snprintf(rebootInfo.log.messageStr, TSKM_LOGGING_MSG_STR_SIZE,
+ "TaskManager:SVC ErrTerm");
+ tskm_sub_reboot(&rebootInfo);
+ } else {
+ TSKM_LOGGING_INFO_t logInfo;
+ logInfo.type = TSKM_LOGGING_TYPE_MODULE_LOGS;
+
+ snprintf(logInfo.messageStr, TSKM_LOGGING_MSG_STR_SIZE,
+ "TaskManager:SVC ErrTerm");
+ tskm_sub_logging(&logInfo);
+
+ if (p_svc->attr->lifeCycle == TSKM_SVC_LC_ALWAYS_RECOVERABLE) {
+ TSKM_ERR_t ret;
+ TSKM_GSTEP_REQ_INFO_t req = { 0 };
+
+ ret = svcExec(p_svc);
+
+ if (TSKM_E_OK != ret) {
+ TSKM_ASSERT_PRINT(0, "ret = %d", ret);
+ goto ERROR;
+ } else if (p_svc->state == TSKM_SVC_WAITCONNECT) {
+ // In the state waiting for execution
+ req.svcId = p_svc->attr->svcId;
+ req.localStep = TSKM_LSTEP_ALL;
+ ret = svcWakeupRequest(p_svc, &req);
+ if (TSKM_E_OK != ret) {
+ TSKM_ASSERT_PRINT(0, "ret = %d", ret);
+ goto ERROR;
+ }
+ }
+ }
+ }
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Connection handler
+ * ret:TRUE SVC status changed
+ * ret:FALSE SVC status not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t connectHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ uint32_t ii;
+
+ TSKM_ASSERT(p_svc->state == TSKM_SVC_WAITCONNECT);
+
+ p_svc->connFd = p_inEv->prm.repConnect.connFd;
+ p_svc->state = TSKM_SVC_WAKEUP;
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "[ST:%d] WAKEUP", p_svc->pid);
+
+ p_svc->waitResCnt = 0;
+
+ if (p_svc->waitReqCnt) {
+ for (ii = 0; ii < p_svc->waitReqCnt; ii++) {
+ TSKM_ASSERT(TSKM_E_OK == wakeupRequest(p_svc, &p_svc->request[ii]));
+ }
+ p_svc->waitReqCnt = 0;
+ }
+
+ return TSKM_TRUE;
+}
+
+/*********************************************************
+ * Disconnection handler
+ * ret:TRUE SVC status changed
+ * ret:FALSE SVC status not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t disConnectHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ // No status change
+
+ return TSKM_TRUE;
+}
+
+/*********************************************************
+ * Response handler for the activation request
+ * ret:TRUE SVC status changed
+ * ret:FALSE SVC status not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t resWakeupHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ TSKM_ASSERT(p_svc->state == TSKM_SVC_WAKEUP);
+ TSKM_ASSERT(p_svc->waitResCnt > 0);
+ TSKM_BOOL_t isStateChg = TSKM_FALSE;
+
+ if (p_svc->isShmDone == TSKM_FALSE && p_inEv->prm.resWakeup.isShmDone) {
+ p_svc->isShmDone = TSKM_TRUE;
+ isStateChg = TSKM_TRUE;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "%s:SHM DONE", p_svc->attr->name);
+ }
+ if (p_svc->isStepDone == TSKM_FALSE && p_inEv->prm.resWakeup.isStepDone) {
+ p_svc->isStepDone = TSKM_TRUE;
+ isStateChg = TSKM_TRUE;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "%s:STEP DONE", p_svc->attr->name);
+ }
+
+ if (p_svc->waitResCnt > 0) {
+ p_svc->waitResCnt--;
+ if (p_svc->waitResCnt == 0) { // Transition when the wait runs out
+ if (p_inEv->prm.resWakeup.isLast) {
+ p_svc->state = TSKM_SVC_RUNNING; // Startup completed
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "[ST:%d] RUN", p_svc->pid);
+ }
+ isStateChg = TSKM_TRUE;
+ }
+ }
+ return isStateChg;
+}
+
+/*********************************************************
+ * Response handler for the termination request
+ * ret:TRUE SVC state changed
+ * ret:FALSE SVC state not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t resDownHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ TSKM_ASSERT(p_svc->state == TSKM_SVC_DOWN);
+ TSKM_ASSERT(p_svc->waitResCnt > 0);
+ TSKM_BOOL_t isStateChg = TSKM_FALSE;
+
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "pid:%d waitCnt:%d", p_svc->pid,
+ p_svc->waitResCnt);
+ if (p_svc->waitResCnt > 0) {
+ p_svc->waitResCnt--;
+ if (p_svc->waitResCnt == 0) { // Transition when the wait runs out
+ if (p_inEv->prm.resWakeup.isLast) {
+ p_svc->state = TSKM_SVC_FINDOWN; // Termination complete
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "[ST:%d] FIN_DOWN", p_svc->pid);
+ }
+ isStateChg = TSKM_TRUE;
+ }
+ }
+ return isStateChg;
+}
+
+/*********************************************************
+ * Response Handlers for DebugDump Requests
+ * ret:TRUE SVC state changed
+ * ret:FALSE SVC state not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t resDebugDumpHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ TSKM_BOOL_t isStateChg = TSKM_FALSE;
+ TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *p_prm;
+
+ if (!p_inEv->hasExtend || !p_inEv->extendPrm) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ p_prm = (TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *) p_inEv->extendPrm; // NOLINT (readability/casting)
+
+ // FALSE is specified here because the required service names have been added in the PrimaryLib.
+ tskm_sub_debugDumpRes(FALSE, p_prm->dumpMsg);
+
+ ERROR: return isStateChg;
+}
+
+/*********************************************************
+ * Service termination request
+ * ret:TRUE SVC state changed
+ * ret:FALSE SVC state not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t reqExit(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ int ret;
+ TSKM_ERR_t tskmRet;
+ TSKM_ASSERT(p_svc->state == TSKM_SVC_RUNNING);
+ TSKM_ASSERT(p_svc->waitResCnt == 0);
+ TSKM_GSTEP_REQ_INFO_t req = { 0 };
+
+ req.svcId = p_svc->attr->svcId;
+ req.localStep = TSKM_LSTEP_ALL;
+ tskmRet = tskm_svcDownRequest(p_svc, &req);
+ TSKM_ERR_CHK_DFT;
+
+ return TSKM_TRUE;
+
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ERROR: ret = tskm_pf_terminateProcGroup(static_cast<uint16_t>(p_svc->pid));
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 8: dead code
+ TSKM_PRINTF(TSKM_LOG_WARN, "ret = %d", ret);
+ }
+
+ return TSKM_TRUE;
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************************
+ * Service termination handler
+ * ret:TRUE SVC state changed
+ * ret:FALSE SVC state not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t repTermHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ int ret;
+
+ // Check error
+ if (p_svc->attr->lifeCycle == TSKM_SVC_LC_DYNAMIC) {
+ if (p_svc->state != TSKM_SVC_DOWN) {
+ // A STATE other than DOWN does not terminate.
+ TSKM_PRINTF(TSKM_LOG_ERROR, "ERR TERM %s(%d) waitCnt:%d",
+ p_svc->attr->name, p_svc->pid, p_svc->waitResCnt);
+ TSKM_ASSERT(0);
+ }
+ } else {
+ // The resident service terminated.
+ TSKM_PRINTF(TSKM_LOG_ERROR, "ERR TERM %s(%d) waitCnt:%d", p_svc->attr->name,
+ p_svc->pid, p_svc->waitResCnt);
+ TSKM_ASSERT(0);
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "[ST:%d] DORMANT", p_svc->pid);
+
+ p_svc->state = TSKM_SVC_DORMANT;
+ p_svc->waitResCnt = 0;
+ p_svc->pid = 0;
+
+ if (p_svc->attr->type == TSKM_SVC_TYPE_NATIVE) {
+ EFrameworkunifiedStatus taskmanagerStatus;
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+ SS_String availabilityName = p_svc->attr->name;
+ availabilityName.append("/Availability");
+
+ taskmanagerStatus = FrameworkunifiedUnsubscribeNotificationWithCallback(
+ p_main->hApp, availabilityName.c_str());
+ if (eFrameworkunifiedStatusOK != taskmanagerStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ p_svc->isAvailable = TSKM_FALSE;
+ p_svc->watchCnt = 0;
+
+ HANDLE hMq = McOpenSender(FRAMEWORKUNIFIED_NS_NPSERVICE);
+ if (NULL == hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ ServiceAvailability availInfo = { };
+
+ snprintf(availInfo.cServiceName, MAX_NAME_SIZE_APP, "%s",
+ p_svc->attr->name);
+ availInfo.eServiceAvailability = eFrameworkunifiedServiceNotAvailable;
+
+ taskmanagerStatus = NPPublishNotification(hMq, p_svc->attr->name,
+ availabilityName.c_str(), &availInfo,
+ sizeof(availInfo));
+ if (eFrameworkunifiedStatusOK != taskmanagerStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ taskmanagerStatus = McClose(hMq);
+ if (eFrameworkunifiedStatusOK != taskmanagerStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+ }
+
+ if (p_inEv->errCode != TSKM_E_OK) {
+ p_svc->errTermCnt++;
+ // Notify 'NG' at Relaunch after abnormal termination
+ p_svc->bootInfo.resetStatus = e_SS_SM_RESET_STATUS_NG;
+
+ ret = svcErrTermPost(p_svc);
+ if (ret != TSKM_E_OK) {
+ TSKM_ASSERT(0);
+ }
+ } else {
+ // NONE is notified at Relaunch after normal completion.
+ p_svc->bootInfo.resetStatus = e_SS_SM_RESET_STATUS_NONE;
+ }
+
+ return TSKM_TRUE;
+}
+
+/*********************************************************
+ * Get service context
+ *********************************************************/
+TSKM_SVC_CTX_t*
+tskm_svcsGetSvcBySvcId(TSKM_SVCS_CTX_t* p_svcs, TSKM_SVCID_t svcId) {
+ return getSvcCtxBySvcId(p_svcs, svcId);
+}
+
+/*********************************************************
+ * Get service context
+ *********************************************************/
+TSKM_SVC_CTX_t*
+tskm_svcsGetSvcByPid(TSKM_SVCS_CTX_t* p_svcs, pid_t pid) {
+ return getSvcCtxByPid(p_svcs, pid);
+}
+
+/*********************************************************
+ * Check for waiting services
+ *********************************************************/
+TSKM_BOOL_t tskm_svcsIsWaiting(TSKM_SVCS_CTX_t* p_svcs) {
+ uint32_t ii;
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ if (p_svcs->svcList[ii].waitResCnt > 0
+ || p_svcs->svcList[ii].state == TSKM_SVC_WAITCONNECT) {
+ return TSKM_TRUE;
+ }
+ }
+ return TSKM_FALSE;
+}
+
+/*********************************************************
+ * Check if ShutdownWait services are terminated
+ *********************************************************/
+TSKM_SVC_WAIT_STATE_t tskm_svcsGetSvcTermWaitState(TSKM_SVCS_CTX_t* p_svcs) {
+ uint32_t ii;
+ TSKM_SVC_WAIT_STATE_t waitState = TSKM_SVC_WAIT_NONE;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ if (p_svcs->svcList[ii].attr->shotdownWait) {
+ // Check shutdownWait SVC Only
+ if (p_svcs->svcList[ii].state != TSKM_SVC_DORMANT) {
+ // DORMANT is terminated or not started, so no checking is required
+ if (TSKM_SVC_LC_DYNAMIC != p_svcs->svcList[ii].attr->lifeCycle
+ && p_svcs->svcList[ii].state != TSKM_SVC_FINDOWN) { // Check of termination of resident SVCs
+ waitState = TSKM_SVC_WAIT_BOTH;
+ break;
+ } else if (TSKM_SVC_LC_DYNAMIC == p_svcs->svcList[ii].attr->lifeCycle) { // Check of termination of non-resident SVCs
+ waitState = TSKM_SVC_WAIT_TRANSIENT;
+ }
+ }
+ }
+ }
+ return waitState;
+}
+
+/*********************************************************
+ * Update boot info of all services
+ *********************************************************/
+TSKM_ERR_t tskm_svcsSetBootInfo(TSKM_SVCS_CTX_t* p_svcs,
+ T_SS_SM_START_DataStructType* p_info,
+ T_SS_SM_START_ExtDataStructType *p_exInfo) {
+ uint32_t ii = 0;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ p_svcs->svcList[ii].bootInfo = *p_info;
+ p_svcs->svcList[ii].extBootInfo = *p_exInfo;
+ }
+ return TSKM_E_OK;
+}
+
+/*********************************************************
+ * Terminates a running non-resident services
+ *********************************************************/
+TSKM_ERR_t tskm_svcsAvtiveSvcTerm(TSKM_SVCS_CTX_t* p_svcs) {
+ uint32_t ii;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ TSKM_SVC_CTX_t* p_svc = &p_svcs->svcList[ii];
+
+ if (TSKM_SVC_LC_DYNAMIC == p_svc->attr->lifeCycle && // Non-resident SVC
+ TSKM_SVC_RUNNING == p_svc->state && p_svc->waitResCnt == 0) { // Running
+ TSKM_ERR_t tskmRet;
+ TSKM_GSTEP_REQ_INFO_t req = { 0 };
+
+ req.svcId = p_svc->attr->svcId;
+ req.localStep = TSKM_LSTEP_ALL;
+ tskmRet = tskm_svcDownRequest(p_svc, &req);
+ TSKM_ERR_CHK_DFT;
+ }
+ }
+
+ return TSKM_E_OK;
+
+ ERROR:
+ return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Calls back the DebugDump of the running services
+ *********************************************************/
+TSKM_ERR_t tskm_svcsCallDebugDump(TSKM_SVCS_CTX_t* p_svcs) {
+ for (uint32_t ii = 0; ii < p_svcs->svcNum; ii++) {
+ TSKM_SVC_CTX_t* p_svc = &p_svcs->svcList[ii];
+
+ if (TSKM_SVC_RUNNING == p_svc->state) { // Running
+ TSKM_EVENT_INFO_t ev;
+ bzero(&ev, sizeof(ev));
+
+ // Send DebugDump request
+ ev.event = TSKM_EV_PRI_REQ_DEBUGDUMP;
+ ev.errCode = TSKM_E_OK;
+ if (0 >= tskm_sockSend(p_svc->connFd, &ev)) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ }
+ }
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Calls back the LowMemory of the running services
+ *********************************************************/
+TSKM_ERR_t tskm_svcsCallLowMem(TSKM_SVCS_CTX_t* p_svcs) {
+ for (uint32_t ii = 0; ii < p_svcs->svcNum; ii++) {
+ TSKM_SVC_CTX_t* p_svc = &p_svcs->svcList[ii];
+ if (TSKM_SVC_RUNNING == p_svc->state) { // Running
+ TSKM_EVENT_INFO_t ev;
+ bzero(&ev, sizeof(ev));
+
+ // Send LowMemory detection notification
+ ev.event = TSKM_EV_PRI_REP_LOWMEM;
+ ev.errCode = TSKM_E_OK;
+ if (0 >= tskm_sockSend(p_svc->connFd, &ev)) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ }
+ }
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Event handler
+ *********************************************************/
+TSKM_ERR_t tskm_svcEventHandle(TSKM_SVC_CTX_t* p_svc, TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_FUNC_IN();
+ TSKM_BOOL_t isStateChg = TSKM_FALSE;
+
+ if (isSvcEvent(p_ev) == TSKM_FALSE) {
+ // If it is not an event for the service, it will be sent as follows.
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+ }
+
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REP_CONNECT: // Connection Registration from Service
+ isStateChg = connectHandle(p_svc, p_ev);
+ break;
+ case TSKM_EV_PRI_REP_DISCONNECT: // Disconnection Registration from Service
+ isStateChg = disConnectHandle(p_svc, p_ev);
+ break;
+ case TSKM_EV_PRI_RES_WAKEUP: // Response to a startup request from a service
+ isStateChg = resWakeupHandle(p_svc, p_ev);
+ break;
+ case TSKM_EV_PRI_RES_DOWN:
+ isStateChg = resDownHandle(p_svc, p_ev);
+ break;
+ case TSKM_EV_PRI_RES_DEBUGDUMP:
+ isStateChg = resDebugDumpHandle(p_svc, p_ev);
+ break;
+ case TSKM_EV_PRI_REQ_EXIT:
+ isStateChg = reqExit(p_svc, p_ev);
+ break;
+ case TSKM_EV_SVC_REP_TERM: // Service termination
+ isStateChg = repTermHandle(p_svc, p_ev);
+ break;
+ default:
+ break;
+ }
+
+ // Overwrite service state change
+ if (isStateChg) {
+ p_ev->event = TSKM_EV_LCL_CHG_SVC_STATE;
+ p_ev->prm.chgSvc.svcId = p_svc->attr->svcId;
+ } else {
+ p_ev->event = TSKM_EV_NOP;
+ }
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+/*********************************************************
+ * Startup service
+ *********************************************************/
+TSKM_ERR_t tskm_svcExec(TSKM_SVC_CTX_t* p_svc) {
+ return svcExec(p_svc);
+}
+
+/*********************************************************
+ * Issue a startup request to the service
+ *********************************************************/
+TSKM_ERR_t tskm_svcWakeupRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req) {
+ return svcWakeupRequest(p_svc, p_req);
+}
+
+/*********************************************************
+ * Issue a termination request to the service
+ *********************************************************/
+TSKM_ERR_t tskm_svcDownRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+
+ if (tskm_svcIsCommunicatable(p_svc) == TSKM_FALSE) {
+ return TSKM_E_OK;
+ }
+
+ ev.event = TSKM_EV_PRI_REQ_DOWN;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.reqDown.localStep = p_req->localStep;
+
+ ret = tskm_sockSend(p_svc->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ p_svc->waitResCnt++;
+ p_svc->state = TSKM_SVC_DOWN;
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Prohibit starting service
+ *********************************************************/
+TSKM_ERR_t tskm_svcDisableRequest(TSKM_SVC_CTX_t* p_svc) {
+ if (p_svc->state == TSKM_SVC_DORMANT || p_svc->state == TSKM_SVC_DISABLE) {
+ p_svc->state = TSKM_SVC_DISABLE;
+ return TSKM_E_OK;
+ }
+ return TSKM_E_STATE;
+}
+
+/*********************************************************
+ * Allow starting service
+ *********************************************************/
+TSKM_ERR_t tskm_svcEnableRequest(TSKM_SVC_CTX_t* p_svc) {
+ if (p_svc->state == TSKM_SVC_DISABLE) {
+ p_svc->state = TSKM_SVC_DORMANT;
+ }
+ return TSKM_E_OK;
+}
+
+/*********************************************************
+ * Queriy whether the service is ready for communication
+ *********************************************************/
+TSKM_BOOL_t tskm_svcIsCommunicatable(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_BOOL_t ret = TSKM_FALSE;
+ if (p_svc == NULL || p_svc->attr->type == TSKM_SVC_TYPE_UNKNONW) {
+ } else {
+ switch (p_svc->state) {
+ case TSKM_SVC_WAKEUP:
+ case TSKM_SVC_RUNNING:
+ case TSKM_SVC_DOWN:
+ ret = TSKM_TRUE;
+ break;
+ default:
+ break;
+ }
+ }
+ return ret;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/systemservice/task_manager/server/src/tskm_wakeup.cpp b/systemservice/task_manager/server/src/tskm_wakeup.cpp
new file mode 100755
index 0000000..b5c6e89
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_wakeup.cpp
@@ -0,0 +1,201 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_wakeup.h"
+#include "tskm_debug.h"
+#include "tskm_util.h"
+#include "tskm_state.h"
+#include "tskm_port_subsys.h"
+#include "tskm_port_pf.h"
+
+#include "tskm_gstep.h"
+
+
+/*********************************************************
+ * Get gradual startup context
+ *********************************************************/
+TSKM_STATIC TSKM_GSTEP_CTX_t*
+gstepGetWakeupCtx(TSKM_MAIN_CTX_t* p_main) {
+ return &p_main->wakeup;
+}
+
+/***********************************************************************
+ * Startup completion process
+ ***********************************************************************/
+TSKM_STATIC void wakeupFinish(TSKM_MAIN_CTX_t* p_main) {
+ return;
+}
+
+/*********************************************************
+ * Challenge for a transition to the next state
+ *********************************************************/
+TSKM_STATIC void tryTransNextState(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_GSTEP_CTX_t* p_wakeup;
+ TSKM_GSTEP_t* p_current;
+
+ p_wakeup = gstepGetWakeupCtx(p_main);
+ p_current = gstepGetCurrent(p_wakeup);
+
+ if (!p_current) {
+ return;
+ }
+
+ // LCOV_EXCL_BR_START 8: Because the second condition in the if statement is never false
+ if (tskm_svcsIsWaiting(&p_main->svcs) == TSKM_FALSE && // No waiting services
+ ((p_wakeup->compState & p_current->nextTransCond)
+ == p_current->nextTransCond)) { // Event completion condition
+ // LCOV_EXCL_BR_STOP
+ if (gstepIsLast(p_wakeup)) {
+ tskm_stateTransit(p_main, TSKM_ST_WAKEUP, TSKM_ST_RUNNING);
+ } else {
+ tskm_stateTransit(p_main, TSKM_ST_WAKEUP, TSKM_ST_WAKEUP);
+ }
+ }
+}
+
+/*********************************************************
+ * Gradual startup request issuance process
+ *********************************************************/
+TSKM_ERR_t tskm_entryWakeup_Req(TSKM_MAIN_CTX_t* p_main,
+ TSKM_GSTEP_t* p_current) {
+ uint32_t ii;
+
+ // Refer to the stepId and perform preprocessing if needed.
+ if (p_current->gstepId == TSKM_GSTEP_BUPCHK) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "BUPCHK EXE");
+ // When TaskManager is used as a system Launcher, system data is initialized here.
+ }
+
+ // Start process
+ for (ii = 0; ii < p_current->execSvcNum; ii++) {
+ TSKM_ERR_t tskmRet;
+ TSKM_SVCID_t svcId = p_current->execSvcIdList[ii];
+ TSKM_SVC_CTX_t* p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs, svcId);
+
+ tskmRet = tskm_svcExec(p_svc);
+ TSKM_ERR_CHK_DFT;
+ }
+
+ // Issue gradual startup request
+ for (ii = 0; ii < p_current->reqNum; ii++) {
+ TSKM_ERR_t tskmRet;
+ TSKM_GSTEP_REQ_INFO_t* p_req = &p_current->reqList[ii];
+ TSKM_SVC_CTX_t* p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs, p_req->svcId);
+
+ // Queuing in the SVC layer even for services that are not started.
+ tskmRet = tskm_svcWakeupRequest(p_svc, p_req);
+ TSKM_ERR_CHK_DFT; // LCOV_EXCL_BR_LINE 6: Because TSKM_ERR_CHK_DFT does not specify a condition for goto to ERROR
+ }
+
+ if (p_current->nextTransCond) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "WAIT COMP:%s(%llx)",
+ tskm_convInitCompId2Str(p_current->nextTransCond),
+ p_current->nextTransCond);
+ }
+
+ return TSKM_E_OK;
+
+ // LCOV_EXCL_START 6: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return TSKM_E_NG;
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************************
+ * Gradual startup entry process
+ *********************************************************/
+TSKM_ERR_t tskm_entryWakeup(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+
+ TSKM_GSTEP_CTX_t* p_wakeup;
+ TSKM_GSTEP_t* p_current;
+
+ p_main->state = TSKM_ST_WAKEUP;
+ p_wakeup = gstepGetWakeupCtx(p_main);
+ p_current = gstepGetCurrent(p_wakeup);
+
+ if (p_current == NULL) { // LCOV_EXCL_BR_LINE 8: Because condition false setting is not possible
+ // LCOV_EXCL_START 8: Because condition false setting is not possible
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP
+ }
+
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "WAKEUP GSTEP:%d", p_wakeup->gstepIdx);
+
+ if (tskm_entryWakeup_Req(p_main, p_current) == TSKM_E_NG) { // LCOV_EXCL_BR_LINE 200:the function of tskm_entryWakeup_Req can not be TSKM_E_NG at this case // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 200:the function of tskm_entryWakeup_Req can not be TSKM_E_NG at this case // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP
+ }
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*********************************************************
+ * Gradual startup exit process
+ *********************************************************/
+TSKM_ERR_t tskm_exitWakeup(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_GSTEP_CTX_t* p_wakeup;
+
+ TSKM_FUNC_IN();
+ p_wakeup = gstepGetWakeupCtx(p_main);
+
+ // Exit process at the end of the gradual startup
+ if (gstepIsLast(p_wakeup)) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "WAKEUP FIN");
+ wakeupFinish(p_main);
+ }
+
+ changeNextStep(p_wakeup); // Transition to next step
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*********************************************************
+ * Gradual startup handler
+ *********************************************************/
+TSKM_ERR_t tskm_handleWakeup(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_FUNC_IN();
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REP_WAKEUP_COMP: // Event completion notification at startup
+ {
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "INIT COMP :%s(%#llx) from:%d",
+ tskm_convInitCompId2Str(p_ev->prm.repWakeupComp.compId),
+ p_ev->prm.repWakeupComp.compId, p_ev->fromPid);
+ TSKM_GSTEP_CTX_t* p_wakeup = gstepGetWakeupCtx(p_main);
+ p_wakeup->compState |= p_ev->prm.repWakeupComp.compId;
+ tryTransNextState(p_main);
+ }
+ break;
+ case TSKM_EV_LCL_CHG_SVC_STATE: // Service state change
+ tryTransNextState(p_main);
+ break;
+ default:
+ tskmRet = tskm_handleAccon(p_main, p_ev);
+ break;
+ }
+ TSKM_FUNC_OUT();
+ return tskmRet;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/systemservice/task_manager/server/src/tskm_watch.cpp b/systemservice/task_manager/server/src/tskm_watch.cpp
new file mode 100755
index 0000000..455de0b
--- /dev/null
+++ b/systemservice/task_manager/server/src/tskm_watch.cpp
@@ -0,0 +1,101 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_watch.h"
+#include <agl_thread.h>
+
+#include "tskm_debug.h"
+#include "tskm_port_pf.h"
+#include "tskm_comm.h"
+
+
+#define WATCH_CYCLE 5
+
+#define TIMER_THREAD_NAME "SS_TskmTimer"
+
+/*******************************************************************
+ * Periodic Timer-Thread MAIN Function
+ *******************************************************************/
+void *
+watchMain(void *arg) {
+ int connFd = -1;
+
+ connFd = tskm_cliSockConnect(TSKM_SOCKET_NAME);
+ if (connFd < 0) { // LCOV_EXCL_BR_LINE 5: system function(uinx) "socket" fail process
+ // LCOV_EXCL_START 5: system function(uinx) "socket" fail process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5
+ }
+
+ while (1) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+
+ sleep(WATCH_CYCLE);
+
+ ev.event = TSKM_EV_LCL_REP_POLLING;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: system function(uinx) "send" fail process
+ // LCOV_EXCL_START 5: system function(uinx) "send" fail process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5
+ }
+ }
+
+ // LCOV_EXCL_START 6: system function(uinx) call fail process
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (connFd != -1) {
+ tskm_sockDestory(connFd);
+ }
+
+ return 0;
+ // LCOV_EXCL_STOP
+}
+
+/*******************************************************************
+ * Periodic Timer thread start
+ *******************************************************************/
+int tskm_watch_startTimer() {
+ int ret;
+ pthread_t thId = { 0 };
+
+ ret = tskm_pf_createThread(watchMain, NULL, PR_SS_TSKMTIMER,
+ TIMER_THREAD_NAME, &thId);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: system function(uinx) "pthread_*" fail process
+ // LCOV_EXCL_START 5: system function(uinx) "pthread_*" fail process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5
+ } else {
+ TSKM_PRINTF(TSKM_LOG_STATE, "watch thread created.");
+ }
+
+ return 0;
+
+ // LCOV_EXCL_LINE 6: system function(uinx) "pthread_*" fail process
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
diff --git a/systemservice/version_library/LICENSE b/systemservice/version_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/systemservice/version_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/systemservice/version_library/Makefile.client b/systemservice/version_library/Makefile.client
new file mode 100755
index 0000000..38d4f60
--- /dev/null
+++ b/systemservice/version_library/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := library
+
+include ../system_service.mk
diff --git a/systemservice/version_library/library/Makefile b/systemservice/version_library/library/Makefile
new file mode 100755
index 0000000..79654a2
--- /dev/null
+++ b/systemservice/version_library/library/Makefile
@@ -0,0 +1,37 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# installed shared library(.so)
+INST_SHLIBS := libssver
+
+# compiled source
+libssver_SRCS := ss_ver.cc
+
+# installed header
+INST_HEADERS := version_library.h ss_ver.h
+
+# additional source path
+VPATH += ./src \
+ ./include/$(COMPONENT_NAME)
+
+# additional include path
+CPPFLAGS += -I./include
+
+# linked library
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic,--no-as-needed -lNS_FrameworkUnified
+
+include ../../system_service.mk
diff --git a/systemservice/version_library/library/include/system_service/ss_ver.h b/systemservice/version_library/library/include/system_service/ss_ver.h
new file mode 100755
index 0000000..a78c5ff
--- /dev/null
+++ b/systemservice/version_library/library/include/system_service/ss_ver.h
@@ -0,0 +1,338 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VERSION_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_VER_H_
+#define VERSION_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_VER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <algorithm>
+#include <map>
+
+/**
+ * @file ss_ver.h
+ * @brief \~english This file supports CSSVer class, This class is a generic CSSVer abstraction
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup version_library
+ * @ingroup system_service
+ * @{
+ */
+
+using namespace std; // NOLINT (readability/nolint)
+
+#define SSVER_VERCHAR_MAX (64)
+#define SSVER_DATE_MAX (16)
+
+/**
+* @struct SSVER_PkgInfo
+* @brief \~english The structure of version package information
+*/
+typedef struct {
+ char version[SSVER_VERCHAR_MAX]; /*!< \~english Version information (String):*/
+ /*!< \~english The termination of string must be "\0"*/
+ char date[SSVER_DATE_MAX]; /*!< \~english Date (String):The termination of string must be "\0" */
+ /*!< \~english Date (String):Store "\0" when date information does not exist.*/
+} SSVER_PkgInfo;
+
+typedef std::map<std::string, SSVER_PkgInfo> SSVerPkgList;
+typedef SSVerPkgList::const_iterator SSVerPkgListIter;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// \ingroup SS_SystemManager
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// \brief This class is a generic CSSVer abstraction
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @class CSSVer
+ * \~english @brief Version information set-up/acquisition
+ * \~english @par Brief Introduction
+ * Class to provide the function of the version information set-up/acquisition
+ *
+ */
+class CSSVer {
+ private:
+ SSVerPkgList m_verList;
+ void dump(void) const;
+
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Constructor for CSSVer class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Creates the instance of CSSVer class. \n
+ /// This API reads the version information registered in VersionDB and creates the package
+ /// lists inside a instance. \n
+ /// This can create some instances at the same time. \n
+ /// Meanwhile, this does not guarantee the action when some threads
+ /// inside same process access to same instances. \n
+ /// It is possible that version information is overwritten from other process but the information overwritten
+ /// at other process is not reflected into the version information held inside self-instance.
+ /// By this, it is necessary to recreate an instance to get the latest information. \n
+ /// \~english @see ~CSSVer
+ ////////////////////////////////////////////////////////////////////////////////////
+ CSSVer();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Destructor for CSSVer class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classfication
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Releases the instance of CSSVer class.
+ /// \~english @see CSSVer
+ ////////////////////////////////////////////////////////////////////////////////////
+ ~CSSVer();
+
+ // Wrapper
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Returns the first iterator of package list.
+ /// \~english @param None
+ /// \~english @retval SSVerPkgListIter The first iterator of package list
+ /// \~english @par
+ /// The structure of version package information
+ /// \~english @code
+ /// #define SSVER_VERCHAR_MAX (64)
+ /// #define SSVER_DATE_MAX (16)
+ /// typedef struct{
+ /// char version[SSVER_VERCHAR_MAX]; /* Version information (String): The termination of
+ /// string must be "\0" */
+ /// char date[SSVER_DATE_MAX]; /* Date (String): The termination of string must be "\0"*/
+ /// /* Store "\0" when date information does not exist. */
+ /// }SSVER_PkgInfo;
+ ///
+ /// typedef std::map<std::string, SSVER_PkgInfo> SSVerPkgList; /* Package list definition */
+ /// typedef SSVerPkgList::const_iterator SSVerPkgListIter; /* Iterator definition of package list */
+ /// @endcode
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Gets and returns the first iterator of package list from the package list inside an instance.
+ /// \~english @see end
+ ////////////////////////////////////////////////////////////////////////////////////
+ SSVerPkgListIter begin() {
+ return m_verList.begin();
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Returns the end iterator of package list.
+ /// \~english @param None
+ /// \~english @retval SSVerPkgListIter The end iterator of package list
+ /// \~english @par
+ /// The structure of version package information
+ /// \~english @code
+ /// #define SSVER_VERCHAR_MAX (64)
+ /// #define SSVER_DATE_MAX (16)
+ /// typedef struct{
+ /// char version[SSVER_VERCHAR_MAX]; /* Version information (String): The termination of
+ /// string must be "\0" */
+ /// char date[SSVER_DATE_MAX]; /* Date (String): The termination of string must be "\0" */
+ /// /* Store "\0" when date information does not exist. */
+ /// }SSVER_PkgInfo;
+ ///
+ /// typedef std::map<std::string, SSVER_PkgInfo> SSVerPkgList; /* Package list definition */
+ /// typedef SSVerPkgList::const_iterator SSVerPkgListIter; /* Iterator definition of package list */
+ /// @endcode
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Gets and returns the last iterator of package list from the package list inside a instance.
+ /// \~english @see begin
+ ////////////////////////////////////////////////////////////////////////////////////
+ SSVerPkgListIter end() {
+ return m_verList.end();
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Checks whether data exists in package list or not.
+ /// \~english @param None
+ /// \~english @retval bool The possibility of data existence of package list
+ /// \~english @par
+ /// - true : Data does not exist
+ /// - false : Data exists
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Returns true when package list is null and return false when data exists.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ bool empty() {
+ return m_verList.empty();
+ }
+
+ // Setter,getter
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Gets the package information of specified package.
+ /// \~english @param [in] name
+ /// std::string & - Package name
+ /// \~english @param [out] p_info
+ /// SSVER_PkgInfo* - Pointer to the storage area of package information
+ /// \~english @par
+ /// The structure of version package information
+ /// \~english @code
+ /// #define SSVER_VERCHAR_MAX (64)
+ /// #define SSVER_DATE_MAX (16)
+ /// typedef struct{
+ /// char version[SSVER_VERCHAR_MAX]; /* Version information (String): The termination of
+ /// string must be "\0" */
+ /// char date[SSVER_DATE_MAX]; /* Date (String): The termination of string must be "\0" */
+ /// /* Store "\0" when date information does not exist. */
+ /// }SSVER_PkgInfo;
+ ///
+ /// typedef std::map<std::string, SSVER_PkgInfo> SSVerPkgList; /* Package list definition */
+ /// typedef SSVerPkgList::const_iterator SSVerPkgListIter; /* Iterator definition of package list */
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Succeeded in getting package information
+ /// \~english @retval eFrameworkunifiedStatusFileLoadError Loading error for file
+ /// \~english @retval eFrameworkunifiedStatusFail Failed at some process
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Pointer(p_info) to the storage area for package information specified
+ /// by parameters is NULL. [eFrameworkunifiedStatusFail]
+ /// - Package information does not exist. [eFrameworkunifiedStatusFileLoadError]
+ /// - Unexpected error occurs. [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Returns this package information if the package name specified by parameters exists
+ /// in the package information list inside an instance.
+ /// This API reads and returns the package information from package
+ /// information storing files if it does not exist. \n
+ /// This adds the package information read from files to the package information list
+ /// inside an instance. \n
+ /// When other CSSVer instance (B) adds package from setPkgInfo during creating instance (A),
+ /// after that, this API can get the package information added by instance (A).
+ /// \~english @see setPkgInfo
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus getPkgInfo(const std::string &name, SSVER_PkgInfo* p_info);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Sets the package information of specified package.
+ /// \~english @param [in] name
+ /// std::string & - Package name
+ /// \~english @param [in] info
+ /// SSVER_PkgInfo* - Package information
+ /// \~english @par
+ /// The structure of version package information
+ /// \~english @code
+ /// #define SSVER_VERCHAR_MAX (64)
+ /// #define SSVER_DATE_MAX (16)
+ /// typedef struct{
+ /// char version[SSVER_VERCHAR_MAX]; /* Version information (String): The termination of
+ /// string must be "\0" */
+ /// char date[SSVER_DATE_MAX]; /* Date (String): The termination of string must be \ */
+ /// /* Store "\0" when date information does not exist. */
+ /// }SSVER_PkgInfo;
+ ///
+ /// typedef std::map<std::string, SSVER_PkgInfo> SSVerPkgList; /* Package list definition */
+ /// typedef SSVerPkgList::const_iterator SSVerPkgListIter; /* Iterator definition of package list */
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Succeeded in setting package information
+ /// \~english @retval eFrameworkunifiedStatusFail Faild at some process
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Unexpected error occurs [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Sets the package information specified by parameters and update VersionDB. \n
+ /// When some package information exists in the package information list inside an instance,
+ /// this API adds the package information specified by parameters to the package
+ /// information list inside an instance,
+ /// and writes the package information specified by parameters in package information storing files. \n
+ /// When package information does not exist in the package information list inside an instance,
+ /// this sets the package information specified by parameters to the package information list inside an instance
+ /// and writes the package information specified by parameters in package information storing files.
+ /// \~english @see getPkgInfo
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus setPkgInfo(const std::string &name, SSVER_PkgInfo &info); // NOLINT (readability/nolint)
+};
+
+#endif // VERSION_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_VER_H_
diff --git a/systemservice/version_library/library/include/system_service/version_library.h b/systemservice/version_library/library/include/system_service/version_library.h
new file mode 100755
index 0000000..f56a259
--- /dev/null
+++ b/systemservice/version_library/library/include/system_service/version_library.h
@@ -0,0 +1,40 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file version_library.h
+ * @brief \~english This file include ss_ver.h
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup version_library
+ * @ingroup system_service
+ * @{
+ */
+// Include guard
+#ifndef SYSTEMSERVICE_VERSIONLIBRARY_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_VERSIONLIBRARY_H_
+
+#include "system_service/ss_ver.h"
+
+#endif // SYSTEMSERVICE_VERSIONLIBRARY_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/version_library/library/src/ss_ver.cc b/systemservice/version_library/library/src/ss_ver.cc
new file mode 100755
index 0000000..70f120c
--- /dev/null
+++ b/systemservice/version_library/library/src/ss_ver.cc
@@ -0,0 +1,309 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <native_service/ns_logger_if.h>
+#include <system_service/ss_templates.h>
+
+#include <system_service/ss_ver.h>
+
+// For DEBUG
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_DEFAULT ZONE_FUNC
+
+#define SSVER_TMPDIR "/tmp/ssver"
+
+// FILE IO
+class CPkgInfoIo {
+ private:
+ int m_fd;
+ std::string m_path;
+ static std::map<std::string, int> m_dbgCnt; // Debug information for exclusive leakage check
+
+ void openFD(const int32_t mode) {
+ m_fd = open(m_path.c_str(), mode, 0664); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (m_fd == -1) {
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ throw eFrameworkunifiedStatusFail;
+ }
+
+ // File lock to protect file accesses
+ SS_ASERT_ERRNO(0 == flock(m_fd, LOCK_EX)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ // LCOV_EXCL_BR_START 11:Unexpected branch
+ m_dbgCnt[m_path]++;
+ SS_ASERT_LOG(m_dbgCnt[m_path] == 1, "%s:%d", m_path.c_str(), // LCOV_EXCL_BR_LINE 15: marco define @ss_templates.h
+ m_dbgCnt[m_path]);
+ // LCOV_EXCL_BR_STOP
+ }
+
+public:
+ CPkgInfoIo(const std::string& pkgName)
+ : m_fd(-1),
+ m_path(SSVER_TMPDIR) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT,__FUNCTION__,"+:%s",pkgName.c_str());
+ m_path += "/";
+ m_path += pkgName;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT,__FUNCTION__,"-");
+ }
+
+ ~CPkgInfoIo() {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:Unexpected branch
+ m_dbgCnt[m_path]--;
+ SS_ASERT_LOG(m_dbgCnt[m_path] == 0, "%s:%d", m_path.c_str(), // LCOV_EXCL_BR_LINE 15: marco define @ss_templates.h
+ m_dbgCnt[m_path]);
+ SS_ASERT_ERRNO(0 == flock(m_fd, LOCK_UN)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+
+ if (m_fd != -1) {
+ SS_ASERT_ERRNO(0 == close(m_fd)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ }
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+ }
+
+ void putData(SSVER_PkgInfo &info) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ openFD(O_RDWR|O_CREAT|O_CLOEXEC);
+ ssize_t wsz;
+ wsz = write(m_fd, &info, sizeof(info));
+ if (wsz != sizeof(info)) { // LCOV_EXCL_BR_LINE 5:std c lib error process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed write(). wsz=%d size=%d errno=%d", // LCOV_EXCL_LINE 5: glibc fail safe
+ wsz, sizeof(info), errno); // LCOV_EXCL_LINE 5:std c lib error process
+ throw eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 5:std c lib error process
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+ }
+
+ void getData(SSVER_PkgInfo* p_info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ openFD(O_RDONLY|O_CLOEXEC);
+
+ ssize_t rsz;
+ rsz = my_read(m_fd, p_info, sizeof(*p_info));
+ if (rsz != sizeof(*p_info)) { // LCOV_EXCL_BR_LINE 5:std c lib error process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed read(). rsz=%d size=%d", rsz, // LCOV_EXCL_LINE 5:std c lib error process
+ sizeof(*p_info)); // LCOV_EXCL_LINE 5:std c lib error process
+ p_info->version[0] = '\0'; // LCOV_EXCL_LINE 5:std c lib error process
+ p_info->date[0] = '\0'; // LCOV_EXCL_LINE 5:std c lib error process
+ throw eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 5:std c lib error process
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+ }
+
+ int my_read(int fd, void* buf, int size) {
+ int done = 0;
+ char *buffer = reinterpret_cast<char*>(buf);
+ int sz = done;
+
+ while (size > 0) {
+ done = read(fd, buffer + done, size);
+ if (done < 0) { // LCOV_EXCL_BR_LINE 5:std c lib error process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 5:std c lib error process
+ if (errno == EINTR) { // LCOV_EXCL_LINE 5:std c lib error process
+ continue;
+ } else {
+ return done;
+ }
+ } else if (done == 0) { // LCOV_EXCL_BR_LINE 5:std c lib error process
+ return sz;
+ }
+ size -= done;
+ sz += done;
+ }
+ return sz;
+ }
+};
+
+std::map<std::string, int> CPkgInfoIo::m_dbgCnt; // Actual status
+
+//==================================================================
+// private
+//==================================================================
+void CSSVer::dump(void) const { // LCOV_EXCL_START 7:debugging process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ std::string dumpStr;
+ dumpStr = "VERINFO DUMP\n";
+
+ for (SSVerPkgList::const_iterator ite = m_verList.begin();
+ ite != m_verList.end(); ite++) {
+ dumpStr += ite->first;
+ dumpStr += "\n";
+ dumpStr += ite->second.version;
+ dumpStr += "\n";
+ dumpStr += ite->second.date;
+ dumpStr += "\n";
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "%s", dumpStr.c_str());
+}
+// LCOV_EXCL_STOP
+
+//==================================================================
+// PUBLIC
+//==================================================================
+CSSVer::CSSVer() {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ DIR *dir = NULL;
+ struct dirent dent, *next;
+ struct stat statbuf;
+
+ try {
+ if (stat(SSVER_TMPDIR, &statbuf) != 0) {
+ mkdir(SSVER_TMPDIR, 0775);
+ // Because this process is not locked, if multiple processes process at the same time,
+ // although it may have been created and fail, do not ASSERT it because it is harmless.
+ }
+
+ // Linux dependency codes
+ if ((dir = opendir(SSVER_TMPDIR)) == NULL) { // LCOV_EXCL_BR_LINE 5:std c lib error process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 5:std c lib error process
+ throw eFrameworkunifiedStatusFail;
+ }
+
+ // LCOV_EXCL_BR_START 11:Unexpected branch
+ while (0 == readdir_r(dir, &dent, &next) && next) {
+ if (DT_REG == dent.d_type) {
+ SSVER_PkgInfo info;
+ std::string name(dent.d_name);
+ std::string verInfo;
+
+ CPkgInfoIo pkgIo(name);
+ pkgIo.getData(&info);
+
+ verInfo += "\nPACKAGE :";
+ verInfo += name;
+ verInfo += "\n";
+ verInfo += " VERSION:";
+ verInfo += info.version;
+ verInfo += "\n";
+ verInfo += " DATE :";
+ verInfo += info.date;
+ verInfo += "\n";
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "%s", verInfo.c_str());
+
+ m_verList.insert(std::make_pair(name, info));
+ }
+ }
+ SS_ASERT_ERRNO(0 == closedir(dir)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ // LCOV_EXCL_BR_STOP
+ } catch (...) { // LCOV_EXCL_START 6:unable to reach
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ if (dir) {
+ SS_ASERT_ERRNO(0 == closedir(dir));
+ }
+ } // LCOV_EXCL_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+}
+
+CSSVer::~CSSVer() {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus CSSVer::getPkgInfo(const std::string &name, SSVER_PkgInfo* p_info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ EFrameworkunifiedStatus versionlibraryRet = eFrameworkunifiedStatusOK;
+ try {
+ if (p_info == NULL) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ throw eFrameworkunifiedStatusFail;
+ }
+
+ SSVerPkgList::iterator ite = m_verList.find(name);
+
+ if (ite != m_verList.end()) {
+ // cache hit
+ *p_info = ite->second;
+ } else {
+ // cache miss
+ std::string path(SSVER_TMPDIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ path += "/";
+ path += name;
+
+ if (access(path.c_str(), F_OK) == 0) {
+ // cache refresh
+ CPkgInfoIo pkgIo(name); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ pkgIo.getData(p_info); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ m_verList.insert(std::make_pair(name, *p_info)); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ } else {
+ throw eFrameworkunifiedStatusFileLoadError;
+ }
+ }
+ } catch (EFrameworkunifiedStatus ee) {
+ versionlibraryRet = ee;
+ } catch (...) { // LCOV_EXCL_START 6:unable to reach
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ versionlibraryRet = eFrameworkunifiedStatusFail;
+ } // LCOV_EXCL_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+ return versionlibraryRet;
+}
+
+EFrameworkunifiedStatus CSSVer::setPkgInfo(const std::string &name, SSVER_PkgInfo &info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ EFrameworkunifiedStatus versionlibraryRet = eFrameworkunifiedStatusOK;
+ try {
+ // LCOV_EXCL_BR_START 11:Unexpected branch
+ SSVerPkgList::iterator ite = m_verList.find(name);
+
+ if (ite == m_verList.end()) {
+ m_verList.insert(std::make_pair(name, info));
+ CPkgInfoIo pkgIo(name);
+ pkgIo.putData(info);
+ } else {
+ ite->second = info;
+ CPkgInfoIo pkgIo(name);
+ pkgIo.putData(info);
+ }
+ // LCOV_EXCL_BR_STOP
+ } catch (EFrameworkunifiedStatus ee) {
+ versionlibraryRet = ee;
+ } catch (...) { // LCOV_EXCL_START 6:unable to reach
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ versionlibraryRet = eFrameworkunifiedStatusFail;
+ } // LCOV_EXCL_STOP
+
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+ return versionlibraryRet;
+} // LCOV_EXCL_BR_LINE 10:for the last line
+
diff --git a/update_hal/LICENSE b/update_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/update_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/update_hal/Makefile b/update_hal/Makefile
new file mode 100755
index 0000000..8accb94
--- /dev/null
+++ b/update_hal/Makefile
@@ -0,0 +1,34 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+HEADER = hal_api/update_hal.h
+
+.PHONY:all
+
+######### make targets ##########################
+all:
+ @echo $@ done.
+
+######### make cleans ###########################
+clean:
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/include
+ install -m 0644 $(HEADER) $(DESTDIR)/usr/include
+ @echo $@ done.
diff --git a/update_hal/hal_api/update_hal.h b/update_hal/hal_api/update_hal.h
new file mode 100755
index 0000000..92da9d7
--- /dev/null
+++ b/update_hal/hal_api/update_hal.h
@@ -0,0 +1,165 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief This file provides support for Software Download.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file update_hal.h
+ */
+
+/** @addtogroup update_service
+ * @{
+ */
+/** @addtogroup update_hal
+ * @ingroup update_service
+ * @{
+ */
+
+#ifndef INCLUDE_UPDATE_HAL_H_
+#define INCLUDE_UPDATE_HAL_H_
+#include <stdint.h>
+
+/* status of VUP_COMPLETE */
+#define VUP_SUCCESS 0 //!< \~english Success
+#define VUP_FAIL 1 //!< \~english Failed
+
+/* Inter process command codes */
+
+/**
+* \~english Start all updates\n
+* Command ID that the user specifies when requesting update_hal to start all updates \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_VUPSTART 205
+
+/**
+* \~english Start differential update\n
+* Command ID that the user specifies when requesting incremental update start from update_hal \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_DIFFVUPSTART 209
+
+/**
+* \~english Copy of the updated side\n
+* Command ID that the user specifies when requesting update_hal to copy the update plane \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_COPY 216
+
+/**
+* \~english Cancel update\n
+* Command ID that the user specifies when requesting update_hal to cancel the update \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* At this time, specify updater as the destination.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_CANCEL 207
+
+/**
+* \~english Update cancellation completion notice\n
+* Command ID that notifies the user that update cancellation processing has been completed from update_hal \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_RES_CANCEL 208
+
+/**
+* \~english Progress status notification\n
+* Command ID that notifies the update progress status from update_hal to the user \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_PROGRESS 203
+
+/**
+* \~english Update completion notice\n
+* Command ID that notifies the end of update from update_hal to the user \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_COMPLETE 204
+
+#define UPDATE_START_TYPE_UPDATE 1 //!< \~english Type of Update
+#define UPDATE_START_TYPE_VERIFY 2 //!< \~english Type of Verification
+
+/* Data format of request to updater to exec update(UpdateService -> updater) */
+// Formate is:
+// num_of_fileset x 1 : UI_32
+// fileset x N : UpdateDataInfo(struct) x N
+#define KWI_MAX_MOD_FPATH 128 //!< \~english Max file path of module in Detailed info
+#define VUP_MAX_KWI_FNAME (KWI_MAX_MOD_FPATH+1) //!< \~english 129 Max size of the string which to save the file path
+#define KWI_SIZE_HASH 32 //!< \~english HashSize length
+#define VUP_MAX_KWI_DETAIL 15 //!< \~english Max file path of Data infos
+
+/**
+* \~english Structure for starts update external update
+*/
+typedef struct _UpdateDataInfo {
+ UI_32 ID; /*!< \~english ID originated by 0(ROOTFS:0, BOOT:1)*/
+ char filename[VUP_MAX_KWI_FNAME]; /*!< \~english source file(device) name(fullpath)*/
+ char srcname[VUP_MAX_KWI_FNAME]; /*!< \~english source file(device) name in diff update(fullpath)*/
+ char destname[VUP_MAX_KWI_FNAME]; /*!< \~english destinamtion file(device) name(fullpath)*/
+ UI_64 offset; /*!< \~english offset of source file*/
+ UI_64 seek; /*!< \~english seek of destination file*/
+ UI_32 size; /*!< \~english size of data*/
+ char src_hash[KWI_SIZE_HASH]; /*!< \~english Original Data Hash(for diff update only)*/
+ char dst_hash[KWI_SIZE_HASH]; /*!< \~english Restored Data Hash*/
+ UI_32 num_of_div; /*!< \~english Num of Detail files*/
+ UI_64 mod_offset; /*!< \~english offset of module in KWI file*/
+ UI_64 div_offset; /*!< \~english offset of divide header in KWI file*/
+} UpdateDataInfo;
+
+/**
+* \~english List of structure for starts update external update
+*/
+typedef struct _UpdateDataInfos {
+ UI_32 units; /*!< \~english Num of Data Info*/
+ UpdateDataInfo info[VUP_MAX_KWI_DETAIL]; /*!< \~english Data Infos*/
+} UpdateDataInfos;
+
+/**
+* \~english Structure for notify update complete
+*/
+typedef union _ResUpdCompletion {
+ // for Normal/SYS Updater
+ struct {
+ UI_32 type; /*!< \~english type*/
+ UI_32 status; /*!< \~english result*/
+ } inner;
+ // for Outer Updater
+ struct {
+ UI_32 status; /*!< \~english result*/
+ UI_32 need_reboot; /*!< \~english Whether it is necessary to reboot system.*/
+ } outer;
+} ResUpdCompletion;
+
+
+/** @}*/ // end of update_hal
+/** @}*/ // end of update_service
+
+#endif // INCLUDE_UPDATE_HAL_H_
diff --git a/update_hal/include/update_hal.h b/update_hal/include/update_hal.h
new file mode 100755
index 0000000..92da9d7
--- /dev/null
+++ b/update_hal/include/update_hal.h
@@ -0,0 +1,165 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief This file provides support for Software Download.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file update_hal.h
+ */
+
+/** @addtogroup update_service
+ * @{
+ */
+/** @addtogroup update_hal
+ * @ingroup update_service
+ * @{
+ */
+
+#ifndef INCLUDE_UPDATE_HAL_H_
+#define INCLUDE_UPDATE_HAL_H_
+#include <stdint.h>
+
+/* status of VUP_COMPLETE */
+#define VUP_SUCCESS 0 //!< \~english Success
+#define VUP_FAIL 1 //!< \~english Failed
+
+/* Inter process command codes */
+
+/**
+* \~english Start all updates\n
+* Command ID that the user specifies when requesting update_hal to start all updates \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_VUPSTART 205
+
+/**
+* \~english Start differential update\n
+* Command ID that the user specifies when requesting incremental update start from update_hal \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_DIFFVUPSTART 209
+
+/**
+* \~english Copy of the updated side\n
+* Command ID that the user specifies when requesting update_hal to copy the update plane \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_COPY 216
+
+/**
+* \~english Cancel update\n
+* Command ID that the user specifies when requesting update_hal to cancel the update \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* At this time, specify updater as the destination.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_CANCEL 207
+
+/**
+* \~english Update cancellation completion notice\n
+* Command ID that notifies the user that update cancellation processing has been completed from update_hal \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_RES_CANCEL 208
+
+/**
+* \~english Progress status notification\n
+* Command ID that notifies the update progress status from update_hal to the user \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_PROGRESS 203
+
+/**
+* \~english Update completion notice\n
+* Command ID that notifies the end of update from update_hal to the user \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_COMPLETE 204
+
+#define UPDATE_START_TYPE_UPDATE 1 //!< \~english Type of Update
+#define UPDATE_START_TYPE_VERIFY 2 //!< \~english Type of Verification
+
+/* Data format of request to updater to exec update(UpdateService -> updater) */
+// Formate is:
+// num_of_fileset x 1 : UI_32
+// fileset x N : UpdateDataInfo(struct) x N
+#define KWI_MAX_MOD_FPATH 128 //!< \~english Max file path of module in Detailed info
+#define VUP_MAX_KWI_FNAME (KWI_MAX_MOD_FPATH+1) //!< \~english 129 Max size of the string which to save the file path
+#define KWI_SIZE_HASH 32 //!< \~english HashSize length
+#define VUP_MAX_KWI_DETAIL 15 //!< \~english Max file path of Data infos
+
+/**
+* \~english Structure for starts update external update
+*/
+typedef struct _UpdateDataInfo {
+ UI_32 ID; /*!< \~english ID originated by 0(ROOTFS:0, BOOT:1)*/
+ char filename[VUP_MAX_KWI_FNAME]; /*!< \~english source file(device) name(fullpath)*/
+ char srcname[VUP_MAX_KWI_FNAME]; /*!< \~english source file(device) name in diff update(fullpath)*/
+ char destname[VUP_MAX_KWI_FNAME]; /*!< \~english destinamtion file(device) name(fullpath)*/
+ UI_64 offset; /*!< \~english offset of source file*/
+ UI_64 seek; /*!< \~english seek of destination file*/
+ UI_32 size; /*!< \~english size of data*/
+ char src_hash[KWI_SIZE_HASH]; /*!< \~english Original Data Hash(for diff update only)*/
+ char dst_hash[KWI_SIZE_HASH]; /*!< \~english Restored Data Hash*/
+ UI_32 num_of_div; /*!< \~english Num of Detail files*/
+ UI_64 mod_offset; /*!< \~english offset of module in KWI file*/
+ UI_64 div_offset; /*!< \~english offset of divide header in KWI file*/
+} UpdateDataInfo;
+
+/**
+* \~english List of structure for starts update external update
+*/
+typedef struct _UpdateDataInfos {
+ UI_32 units; /*!< \~english Num of Data Info*/
+ UpdateDataInfo info[VUP_MAX_KWI_DETAIL]; /*!< \~english Data Infos*/
+} UpdateDataInfos;
+
+/**
+* \~english Structure for notify update complete
+*/
+typedef union _ResUpdCompletion {
+ // for Normal/SYS Updater
+ struct {
+ UI_32 type; /*!< \~english type*/
+ UI_32 status; /*!< \~english result*/
+ } inner;
+ // for Outer Updater
+ struct {
+ UI_32 status; /*!< \~english result*/
+ UI_32 need_reboot; /*!< \~english Whether it is necessary to reboot system.*/
+ } outer;
+} ResUpdCompletion;
+
+
+/** @}*/ // end of update_hal
+/** @}*/ // end of update_service
+
+#endif // INCLUDE_UPDATE_HAL_H_
diff --git a/usb_hal/LICENSE b/usb_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/usb_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/usb_hal/Makefile b/usb_hal/Makefile
new file mode 100755
index 0000000..1a107ce
--- /dev/null
+++ b/usb_hal/Makefile
@@ -0,0 +1,66 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libusb_hal.so
+
+HEADER := ./hal_api/usb_hal.h
+
+######### include paths/files ###################
+CXXFLAGS += -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := usb_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/usb_hal/hal_api/usb_hal.h b/usb_hal/hal_api/usb_hal.h
new file mode 100755
index 0000000..9f93d9b
--- /dev/null
+++ b/usb_hal/hal_api/usb_hal.h
@@ -0,0 +1,379 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file usb_hal.h
+ * @brief usb_hal API
+ */
+
+#ifndef HAL_API_USB_HAL_H_
+#define HAL_API_USB_HAL_H_
+
+#include "native_service/frameworkunified_types.h"
+
+/** @addtogroup device_detection_service
+ * @{
+ */
+/** @addtogroup usb_hal
+ * @ingroup device_detection_service
+ * @{
+ */
+
+/**
+ * \~english Definition of Host/Function mode of USB OTG port.
+ */
+enum UsbRoleType {
+ /**
+ * \~english Host mode
+ */
+ USB_ROLE_HOST = 0,
+ /**
+ * \~english Function mode
+ */
+ USB_ROLE_FUNCTION,
+};
+
+/**
+ * \ingroup GetUsbRoleSwitch
+ * \~english @par Brief
+ * Get USB role
+ * \~english @param [out] usb_role
+ * UsbRoleType* - USB role
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - When State value is "status faile", Can not get host/funtcion mode of USB OTG port.
+ * \~english @par Change of internal state
+ * - None.
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusNullPointer
+ * - Internal process error(open/read)
+ * - eFrameworkunifiedStatusFail
+ * - Internal process error(State value is "status faile")
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Get Host/Funtcion mode of USB OTG port.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see SetUsbRoleSwitch
+ */
+EFrameworkunifiedStatus GetUsbRoleSwitch(UsbRoleType* usb_role);
+
+/**
+ * \ingroup SetUsbRoleSwitch
+ * \~english @par Brief
+ * Set USB role.
+ * \~english @param [in] usb_role
+ * UsbRoleType - USB role
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - When State value is "status faile", Can not set host/funtcion mode of USB OTG port.
+ * \~english @par Change of internal state
+ * - Change "USB role is host mode"or"USB role is host mode"
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - Internal process error(open/read/write)
+ * - eFrameworkunifiedStatusFail
+ * - Internal process error(State value is "status faile")
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Set Host/Funtcion mode of USB OTG port.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see GetUsbRoleSwitch
+ */
+EFrameworkunifiedStatus SetUsbRoleSwitch(UsbRoleType usb_role);
+
+/**
+ * \~english USB authentication error information
+ */
+enum UsbAuthenticationError {
+ /**
+ * \~english USB authentication no error
+ */
+ USB_AUTHENTICATION_ERROR_NONE = 0,
+ /**
+ * \~english The connected device has no response
+ */
+ USB_AUTHENTICATION_ERROR_ENUMERATE,
+ /**
+ * \~english The device connected to bus-powered HUB is overcurrent
+ */
+ USB_AUTHENTICATION_ERROR_HUB_OVERCURRENT,
+ /**
+ * \~english HUB tier levels
+ */
+ USB_AUTHENTICATION_ERROR_HUB_TIER_LEVELS,
+ /**
+ * \~english The number of connected devices is more than supported
+ */
+ USB_AUTHENTICATION_ERROR_CONNECTION_EXCESS
+};
+
+/**
+ * \ingroup CheckUsbAuthenticationError
+ * \~english @par Brief
+ * Check USB authentication error
+ * \~english @param [out] usb_auth_error
+ * UsbAuthenticationError* - USB authentication error
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - When State value is "status faile", Can not check USB authentication error .
+ * \~english @par Change of internal state
+ * - None.
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusNullPointer
+ * - Internal process error(open/read)
+ * - eFrameworkunifiedStatusFail
+ * - Internal process error(State value is "status faile")
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Check USB authentication error information.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see None.
+ */
+EFrameworkunifiedStatus CheckUsbAuthenticationError(UsbAuthenticationError* usb_auth_error);
+
+/**
+ * \~english Definition of USB port number.
+ * - The USB port number is defined according to the RefHW,
+ * modification will be necessary if there's any change about USB port.
+ */
+enum UsbPortNumber {
+ /**
+ * \~english USB0(IF-BOX)
+ */
+ USB_PORT_NUMBER_0 = 0,
+ /**
+ * \~english USB1(DCM)
+ */
+ USB_PORT_NUMBER_1,
+ /**
+ * \~english USB2(DSRC/ETC)
+ */
+ USB_PORT_NUMBER_2,
+ /**
+ * \~english USB3(External deck)
+ */
+ USB_PORT_NUMBER_3,
+ /**
+ * \~english USB4(Drive recorder)
+ */
+ USB_PORT_NUMBER_4,
+ /**
+ * \~english Maximum of USB port number.
+ */
+ USB_PORT_NUMBER_MAX
+};
+
+/**
+ * \ingroup ResetUsbVbus
+ * \~english @par Brief
+ * USB VBus Reset.
+ * \~english @param [in] usb_port_no
+ * UsbPortNumber - USB port number
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - When State value is "status faile", Can not USB VBus reset .
+ * \~english @par Change of internal state
+ * - "USB power ON" from the "USB power OFF".
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - Internal process error(open/read/write)
+ * - eFrameworkunifiedStatusFail
+ * - Internal process error(State value is "status faile")
+ * - eFrameworkunifiedStatusFail
+ * - Not change internal state.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - USB VBus Reset.
+ * - The API is a block I/F which costs a while due to the sleep time between power off and power on.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see IsUsbPortPowered, PowerOnUsbPort, PowerOffUsbPort
+ */
+EFrameworkunifiedStatus ResetUsbVbus(UsbPortNumber usb_port_no);
+
+/**
+ * \ingroup IsUsbPortPowered
+ * \~english @par Brief
+ * Check the power state of USB port.
+ * \~english @param [in] usb_port_no
+ * UsbPortNumber - USB port number
+ * \~english @param [out] is_powered
+ * bool*\n
+ * - true : Power is on
+ * - false : Power is off
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - None.
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - eFrameworkunifiedStatusNullPointer
+ * - Internal process error(open/read)
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Check the power state of USB port.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see ResetUsbVbus, PowerOnUsbPort, PowerOffUsbPort
+ */
+EFrameworkunifiedStatus IsUsbPortPowered(UsbPortNumber usb_port_no, bool* is_powered);
+
+/**
+ * \ingroup PowerOnUsbPort
+ * \~english @par Brief
+ * Power on USB port.
+ * \~english @param [in] usb_port_no
+ * UsbPortNumber - USB port number
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - When State value is "status faile", Can not power on USB port.
+ * \~english @par Change of internal state
+ * - Change state "USB power on"
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - Internal process error(open/read/write)
+ * - eFrameworkunifiedStatusFail
+ * - Internal process error(State value is "status faile")
+ * - eFrameworkunifiedStatusFail
+ * - Not change internal state.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Power on USB port.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see ResetUsbVbus, IsUsbPortPowered, PowerOffUsbPort
+ */
+EFrameworkunifiedStatus PowerOnUsbPort(UsbPortNumber usb_port_no);
+
+/**
+ * \ingroup PowerOffUsbPort
+ * \~english @par Brief
+ * Power off USB port.
+ * \~english @param [in] usb_port_no
+ * UsbPortNumber - USB port number
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change state "USB power off"
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - Internal process error(open/read/write)
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Power off USB port.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see ResetUsbVbus, IsUsbPortPowered, PowerOnUsbPort
+ */
+EFrameworkunifiedStatus PowerOffUsbPort(UsbPortNumber usb_port_no);
+
+/**
+ * \~english USB abnormal status
+ */
+enum UsbAbnormalStatus {
+ /**
+ * \~english USB is not abnormal
+ */
+ USB_ABNORMAL_STATUS_NONE = 0,
+ /**
+ * \~english USB is overcurrent
+ */
+ USB_ABNORMAL_STATUS_OVERCURRENT
+};
+
+/**
+ * \ingroup CheckUsbAbnormalStatus
+ * \~english @par Brief
+ * Check the abnormal status of USB port
+ * \~english @param [in] usb_port_no
+ * UsbPortNumber - USB port number
+ * \~english @param [out] usb_abnormal_status
+ * UsbAbnormalStatus* - USB abnormal status
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - change state "usb port status faile" or "usb port status ok".
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - eFrameworkunifiedStatusNullPointer
+ * - Internal process error(open/read)
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Check the abnormal status of USB port, including overcurrent and so on.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see None.
+ */
+EFrameworkunifiedStatus CheckUsbAbnormalStatus(UsbPortNumber usb_port_no, UsbAbnormalStatus* usb_abnormal_status);
+
+/** @}*/ // end of usb_hal
+/** @}*/ // end of device_detection_service
+
+#endif // HAL_API_USB_HAL_H_
diff --git a/usb_hal/inc/usb_hal_debug.h b/usb_hal/inc/usb_hal_debug.h
new file mode 100755
index 0000000..15b307a
--- /dev/null
+++ b/usb_hal/inc/usb_hal_debug.h
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_USB_HAL_DEBUG_H_
+#define INC_USB_HAL_DEBUG_H_
+
+#include "usb_hal_usbhallog.h"
+
+/* Log output control flag */
+#define USB_LOG_ENABLE_ERROR /* Error log */
+
+#ifdef USB_LOG_ENABLE_ERROR
+#define USB_ERROR_LOG(fmt, ...) FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, fmt, ##__VA_ARGS__)
+#else
+#define USB_ERROR_LOG(fmt, ...)
+#endif
+
+#endif // INC_USB_HAL_DEBUG_H_
diff --git a/usb_hal/inc/usb_hal_internal.h b/usb_hal/inc/usb_hal_internal.h
new file mode 100755
index 0000000..86c3905
--- /dev/null
+++ b/usb_hal/inc/usb_hal_internal.h
@@ -0,0 +1,165 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_USB_HAL_INTERNAL_H_
+#define INC_USB_HAL_INTERNAL_H_
+
+#define FILE_CONTENT_LENGTH (32)
+#define FILE_PATH_LENGTH (128)
+
+/**
+ * USB role file
+ */
+#define USB_ROLE_FILE "/sys/devices/platform/soc/ee080200.usb-phy/role"
+
+/**
+ * USB host value
+ */
+#define USB_HOST_STRING "host\n"
+
+/**
+ * USB function value
+ */
+#define USB_FUNCTION_STRING "peripheral\n"
+
+/**
+ * gpio high value
+ */
+const char kUsbGpioHighValue = '1';
+
+/**
+ * gpio low value
+ */
+const char kUsbGpioLowValue = '0';
+
+/**
+ * gpio export file
+ */
+const char kUsbGpioExportFile[] = "/sys/class/gpio/export";
+
+/**
+ * gpio file prefix
+ */
+const char kUsbGpioFilePrefix[] = "/sys/class/gpio/gpio";
+
+/**
+ * gpio direction file
+ */
+const char kUsbGpioDirectionFile[] = "/direction";
+
+/**
+ * gpio direction in
+ */
+const char kUsbGpioDirectionIn[] = "in";
+
+/**
+ * gpio direction out high
+ */
+const char kUsbGpioDirectionHigh[] = "high";
+
+/**
+ * gpio direction out low
+ */
+const char kUsbGpioDirectionLow[] = "low";
+
+/**
+ * gpio value file
+ */
+const char kUsbGpioValueFile[] = "/value";
+
+/**
+ * structure of USB role switch information
+ */
+struct UsbRoleSwitchInfo {
+ const char* file_path; //!< USB role switch file path
+ const char* usb_host_value; //!< USB host value
+ const char* usb_function_value; //!< USB function value
+};
+
+/**
+ * USB gpio port definition
+ */
+enum UsbGpioPort {
+ USB_GPIO_PORT_USB0_PWEN = 0, //!< USB0 power enable
+ USB_GPIO_PORT_USB1_PWEN, //!< USB1 power enable
+ USB_GPIO_PORT_USB2_PWEN, //!< USB2 power enable
+ USB_GPIO_PORT_USB0_OVC, //!< USB0 overcurrent
+ USB_GPIO_PORT_USB1_OVC, //!< USB1 overcurrent
+ USB_GPIO_PORT_USB2_OVC, //!< USB2 overcurrent
+ USB_GPIO_PORT_MAX
+};
+
+/**
+ * USB gpio port value definition
+ */
+enum GpioPortValue {
+ GPIO_PORT_OFF = 0, //!< gpio port on
+ GPIO_PORT_ON //!< gpio port off
+};
+
+/**
+ * Length for USB gpio port name
+ */
+#define USB_PORT_NAME_LENGTH (8)
+
+/**
+ * USB gpio port information
+ */
+struct UsbGpioPortInfo {
+ bool active_low; //!< active low or high
+ bool is_output; //!< direction output or input
+ const char* port_name; //!< gpio port name
+ char default_value; //!< output port default value (high or low)
+};
+
+/**
+ * USB gpio port config table
+ */
+const char kUsbGpioPortNameUsb0Pwen[] = "375";
+const char kUsbGpioPortNameUsb1Pwen[] = "387";
+const char kUsbGpioPortNameUsb2Pwen[] = "389";
+const char kUsbGpioPortNameUsb0Ovc[] = "376";
+const char kUsbGpioPortNameUsb1Ovc[] = "388";
+const char kUsbGpioPortNameUsb2Ovc[] = "390";
+
+const UsbGpioPortInfo kUsbGpioInfo[] = {
+ { false, true, kUsbGpioPortNameUsb0Pwen, kUsbGpioHighValue },
+ { false, true, kUsbGpioPortNameUsb1Pwen, kUsbGpioHighValue },
+ { false, true, kUsbGpioPortNameUsb2Pwen, kUsbGpioHighValue },
+ { false, false, kUsbGpioPortNameUsb0Ovc, kUsbGpioLowValue },
+ { false, false, kUsbGpioPortNameUsb1Ovc, kUsbGpioLowValue },
+ { false, false, kUsbGpioPortNameUsb2Ovc, kUsbGpioLowValue }
+};
+
+/**
+ * gpio port list of USB power enable
+ */
+const UsbGpioPort kUsbPowerEnableGpio[] = {
+ USB_GPIO_PORT_USB0_PWEN,
+ USB_GPIO_PORT_USB1_PWEN,
+ USB_GPIO_PORT_USB2_PWEN
+};
+
+/**
+ * gpio port list of USB overcurrent
+ */
+const UsbGpioPort kUsbOvercurrentGpio[] = {
+ USB_GPIO_PORT_USB0_OVC,
+ USB_GPIO_PORT_USB1_OVC,
+ USB_GPIO_PORT_USB2_OVC
+};
+
+#endif // INC_USB_HAL_INTERNAL_H_
diff --git a/usb_hal/inc/usb_hal_usbhallog.h b/usb_hal/inc/usb_hal_usbhallog.h
new file mode 100755
index 0000000..53c0a6b
--- /dev/null
+++ b/usb_hal/inc/usb_hal_usbhallog.h
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_USB_HAL_USBHALLOG_H_
+#define INC_USB_HAL_USBHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_USB_HAL_USBHALLOG_H_
diff --git a/usb_hal/src/usb_hal.cpp b/usb_hal/src/usb_hal.cpp
new file mode 100755
index 0000000..7e09ad4
--- /dev/null
+++ b/usb_hal/src/usb_hal.cpp
@@ -0,0 +1,500 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "usb_hal.h"
+#include "usb_hal_internal.h"
+#include "usb_hal_debug.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
+
+/**
+ * USB role switch information table
+ */
+const UsbRoleSwitchInfo kUsbRoleSwitchTable = {USB_ROLE_FILE, USB_HOST_STRING, USB_FUNCTION_STRING};
+
+/**
+ * Read content of USB role switch file, then determine HOST/FUNCTION role
+ * according to the specified HOST/FUNCTION value.
+ */
+static EFrameworkunifiedStatus GetUsbRoleType(const char* file_path, const char* usb_host_value, const char* usb_function_value,
+ UsbRoleType* usb_role) {
+ if (!file_path || !usb_host_value || !usb_function_value || !usb_role) {
+ USB_ERROR_LOG("parameter is NULL.");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // 1. open role switch file
+ int fd = open(file_path, O_RDONLY);
+ if (-1 == fd) {
+ USB_ERROR_LOG("open [%s] failed.(%d, %s)", file_path, errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // 2. read file content
+ char file_content[FILE_CONTENT_LENGTH];
+ memset(file_content, 0, sizeof(file_content));
+ ssize_t ret = read(fd, file_content, sizeof(file_content) - 1);
+ int read_error = errno;
+
+ // 3. close file
+ close(fd);
+
+ if (-1 == ret) {
+ USB_ERROR_LOG("read failed.(%d, %s)", read_error, strerror(read_error));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // 4. compare file content to HOST/FUNCTION value
+ if (!strcmp(usb_host_value, file_content)) {
+ *usb_role = USB_ROLE_HOST;
+ } else if (!strcmp(usb_function_value, file_content)) {
+ *usb_role = USB_ROLE_FUNCTION;
+ } else {
+ USB_ERROR_LOG("content error.[%s]", file_content);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Write the specified role value to USB role switch file.
+ */
+static EFrameworkunifiedStatus SetUsbRoleValue(const char* file_path, const char* role_value) {
+ if (!file_path || !role_value) {
+ USB_ERROR_LOG("parameter is NULL.");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // 1. open role switch file
+ int fd = open(file_path, O_WRONLY | O_TRUNC);
+ if (-1 == fd) {
+ USB_ERROR_LOG("open [%s] failed.(%d, %s)", file_path, errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // 2. write role file
+ ssize_t ret = write(fd, role_value, strlen(role_value));
+ int write_error = errno;
+
+ // 3. close file
+ close(fd);
+
+ // 4. check write result
+ if (static_cast<ssize_t>(strlen(role_value)) != ret) {
+ USB_ERROR_LOG("write [%s] failed, ret=%zd.(%d, %s)", role_value, ret, write_error, strerror(write_error));
+ return eFrameworkunifiedStatusFail;
+ } else {
+ return eFrameworkunifiedStatusOK;
+ }
+}
+
+/**
+ * Check whether the specified USB port supports power control.
+ */
+static bool CheckSupportPowerControl(UsbPortNumber usb_port_no) {
+ if (USB_PORT_NUMBER_MAX <= usb_port_no) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Check whether the specified gpio port is available.
+ */
+static bool CheckGpioPortAvailable(UsbGpioPort gpio_port) {
+ if (USB_GPIO_PORT_MAX <= gpio_port) {
+ USB_ERROR_LOG("port %d is invalid.", gpio_port);
+ return false;
+ }
+
+ if (!kUsbGpioInfo[gpio_port].port_name || (0 == strlen(kUsbGpioInfo[gpio_port].port_name))) {
+ USB_ERROR_LOG("port %d is not available.", gpio_port);
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Open gpio export file.
+ */
+static int OpenExportFile() {
+ return open(kUsbGpioExportFile, O_WRONLY);
+}
+
+/**
+ * Open the direction file of the specified gpio port.
+ */
+static int OpenDirectionFile(const char* port_name) {
+ if (!port_name || (0 == strlen(port_name))) {
+ USB_ERROR_LOG("port name is invalid.");
+ return -1;
+ }
+
+ char dir_file[FILE_PATH_LENGTH];
+ // /sys/class/gpio/gpio123/direction
+ snprintf(dir_file, sizeof(dir_file), "%s%s%s", kUsbGpioFilePrefix, port_name, kUsbGpioDirectionFile);
+ return open(dir_file, O_RDWR);
+}
+
+/**
+ * Open the value file of the specified gpio port.
+ */
+static int OpenValueFile(const char* port_name, bool ro) {
+ if (!port_name || (0 == strlen(port_name))) {
+ USB_ERROR_LOG("port name is invalid.");
+ return -1;
+ }
+
+ char value_file[FILE_PATH_LENGTH];
+ // /sys/class/gpio/gpio123/value
+ snprintf(value_file, sizeof(value_file), "%s%s%s", kUsbGpioFilePrefix, port_name, kUsbGpioValueFile);
+ return open(value_file, ro ? O_RDONLY : O_RDWR);
+}
+
+/**
+ * Initialize gpio port value.
+ */
+static EFrameworkunifiedStatus InitializeGpioPort(UsbGpioPort gpio_port) {
+ if (!CheckGpioPortAvailable(gpio_port)) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ char port_file[FILE_PATH_LENGTH];
+ snprintf(port_file, sizeof(port_file), "%s%s", kUsbGpioFilePrefix, kUsbGpioInfo[gpio_port].port_name);
+
+ // check if port is exported already
+ if (0 == access(port_file, F_OK)) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ // open the export file
+ int export_fd = OpenExportFile();
+ if (-1 == export_fd) {
+ USB_ERROR_LOG("open [%s] failed.(%d, %s)", "export", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // do export by writing the export file
+ ssize_t ret = write(export_fd, kUsbGpioInfo[gpio_port].port_name, strlen(kUsbGpioInfo[gpio_port].port_name));
+ int write_error = errno;
+
+ // close the export file
+ close(export_fd);
+
+ // check write result
+ if (static_cast<ssize_t>(strlen(kUsbGpioInfo[gpio_port].port_name)) != ret) {
+ USB_ERROR_LOG("write [%s] failed, ret=%zd.(%d, %s)", kUsbGpioInfo[gpio_port].port_name, ret, write_error,
+ strerror(write_error));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // open the direction file
+ int direction_fd = OpenDirectionFile(kUsbGpioInfo[gpio_port].port_name);
+ if (-1 == direction_fd) {
+ USB_ERROR_LOG("open direction file failed.(%d, %s)", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // set direction
+ const char* direction_value;
+ if (!kUsbGpioInfo[gpio_port].is_output) {
+ // for input port, set direction as "in"
+ direction_value = kUsbGpioDirectionIn;
+ } else {
+ if (kUsbGpioHighValue == kUsbGpioInfo[gpio_port].default_value) {
+ // for output port, if default value is high, set direction as "high"
+ direction_value = kUsbGpioDirectionHigh;
+ } else if (kUsbGpioLowValue == kUsbGpioInfo[gpio_port].default_value) {
+ // for output port, if default value is low, set direction as "low"
+ direction_value = kUsbGpioDirectionLow;
+ } else {
+ USB_ERROR_LOG("unknown default value[%c]", kUsbGpioInfo[gpio_port].default_value);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+
+ ret = write(direction_fd, direction_value, strlen(direction_value));
+ write_error = errno;
+ close(direction_fd);
+ if (static_cast<ssize_t>(strlen(direction_value)) != ret) {
+ USB_ERROR_LOG("write direction %s failed, ret=%zd.(%d, %s)", direction_value, ret, write_error,
+ strerror(write_error));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Get gpio port value.
+ */
+static EFrameworkunifiedStatus GetGpioPortValue(UsbGpioPort port_name, bool* port_value) {
+ if ((USB_GPIO_PORT_MAX <= port_name) || !port_value) {
+ USB_ERROR_LOG("parameter is invalid.");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // initialize gpio port
+ EFrameworkunifiedStatus result = InitializeGpioPort(port_name);
+ if (eFrameworkunifiedStatusOK != result) {
+ return result;
+ }
+
+ // open port value file
+ int fd = OpenValueFile(kUsbGpioInfo[port_name].port_name, true);
+ if (-1 == fd) {
+ USB_ERROR_LOG("open value file failed.(%d, %s)", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // read file content
+ char file_content = '\0';
+ ssize_t ret = read(fd, &file_content, sizeof(file_content));
+ int read_error = errno;
+
+ // close file
+ close(fd);
+
+ if (sizeof(file_content) != ret) {
+ USB_ERROR_LOG("read failed.(%d, %s)", read_error, strerror(read_error));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // compare file content to high/low value
+ if (kUsbGpioHighValue == file_content) {
+ *port_value = (kUsbGpioInfo[port_name].active_low ? false : true);
+ } else if (kUsbGpioLowValue == file_content) {
+ *port_value = (kUsbGpioInfo[port_name].active_low ? true : false);
+ } else {
+ USB_ERROR_LOG("content error.[%c]", file_content);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Set gpio port value.
+ */
+static EFrameworkunifiedStatus SetGpioPortValue(UsbGpioPort port_name, GpioPortValue port_value) {
+ if (USB_GPIO_PORT_MAX <= port_name) {
+ USB_ERROR_LOG("parameter is invalid.");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // initialize gpio port
+ EFrameworkunifiedStatus result = InitializeGpioPort(port_name);
+ if (eFrameworkunifiedStatusOK != result) {
+ return result;
+ }
+
+ // check direction is output
+ if (!kUsbGpioInfo[port_name].is_output) {
+ USB_ERROR_LOG("%d not an output port.", port_name);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // open port value file
+ int fd = OpenValueFile(kUsbGpioInfo[port_name].port_name, false);
+ if (-1 == fd) {
+ USB_ERROR_LOG("open value file failed.(%d, %s)", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // write value
+ bool port_active = (GPIO_PORT_ON == port_value ? true : false);
+ bool write_low = (kUsbGpioInfo[port_name].active_low ? port_active : !port_active);
+ char write_value = (write_low ? kUsbGpioLowValue : kUsbGpioHighValue);
+ ssize_t ret = write(fd, &write_value, sizeof(write_value));
+ int write_error = errno;
+
+ // close file
+ close(fd);
+
+ // check write result
+ if (sizeof(write_value) != ret) {
+ USB_ERROR_LOG("write [%c] failed, ret=%zd.(%d, %s)", write_value, ret, write_error, strerror(write_error));
+ return eFrameworkunifiedStatusFail;
+ } else {
+ return eFrameworkunifiedStatusOK;
+ }
+}
+
+/**
+ * Check overcurrent.
+ */
+static EFrameworkunifiedStatus CheckUsbOvercurrent(UsbPortNumber usb_port_no, bool* is_ovc) {
+ if ((USB_PORT_NUMBER_MAX <= usb_port_no) || !is_ovc) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return GetGpioPortValue(kUsbOvercurrentGpio[usb_port_no], is_ovc);
+}
+
+EFrameworkunifiedStatus GetUsbRoleSwitch(UsbRoleType* usb_role) {
+ // check NULL pointer
+ if (!usb_role) {
+ USB_ERROR_LOG("parameter is NULL.");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ return GetUsbRoleType(kUsbRoleSwitchTable.file_path, kUsbRoleSwitchTable.usb_host_value,
+ kUsbRoleSwitchTable.usb_function_value, usb_role);
+}
+
+EFrameworkunifiedStatus SetUsbRoleSwitch(UsbRoleType usb_role) {
+ if ((USB_ROLE_HOST != usb_role) && (USB_ROLE_FUNCTION != usb_role)) {
+ USB_ERROR_LOG("parameter error.[%d]", usb_role);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ // check current usb role:
+ // allow to switch only when usb_role is different from current usb role.
+ UsbRoleType current_role;
+ if (eFrameworkunifiedStatusOK != GetUsbRoleSwitch(&current_role)) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (current_role == usb_role) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ // check usb role type
+ // - HOST: write HOST value to role file
+ // - FUNCTION: write FUNCTION value to role file
+ return SetUsbRoleValue(kUsbRoleSwitchTable.file_path, (USB_ROLE_HOST == usb_role)
+ ? kUsbRoleSwitchTable.usb_host_value
+ : kUsbRoleSwitchTable.usb_function_value);
+}
+
+EFrameworkunifiedStatus CheckUsbAuthenticationError(UsbAuthenticationError* usb_auth_error) {
+ // check NULL pointer
+ if (!usb_auth_error) {
+ USB_ERROR_LOG("parameter is NULL.");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ // Empty Stub implementations
+ *usb_auth_error = USB_AUTHENTICATION_ERROR_NONE;
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus ResetUsbVbus(UsbPortNumber usb_port_no) {
+ // check support power control
+ if (!CheckSupportPowerControl(usb_port_no)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ // step 1: power off USB port
+ EFrameworkunifiedStatus result = SetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], GPIO_PORT_OFF);
+ if (eFrameworkunifiedStatusOK != result) {
+ USB_ERROR_LOG("power off USB%d failed.", usb_port_no);
+ return result;
+ }
+
+ // step 2: sleep 1.1 sec
+ usleep(1100 * 1000);
+
+ // step 3: power on USB port
+ result = SetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], GPIO_PORT_ON);
+ if (eFrameworkunifiedStatusOK != result) {
+ USB_ERROR_LOG("power on USB%d failed.", usb_port_no);
+ }
+ return result;
+}
+
+EFrameworkunifiedStatus IsUsbPortPowered(UsbPortNumber usb_port_no, bool* is_powered) {
+ if (!is_powered) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ // check support power control
+ if (!CheckSupportPowerControl(usb_port_no)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ return GetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], is_powered);
+}
+
+EFrameworkunifiedStatus PowerOnUsbPort(UsbPortNumber usb_port_no) {
+ // check support power control
+ if (!CheckSupportPowerControl(usb_port_no)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ bool current_power = false;
+ if (eFrameworkunifiedStatusOK != GetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], &current_power)) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (current_power) {
+ return eFrameworkunifiedStatusOK;
+ }
+ return SetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], GPIO_PORT_ON);
+}
+
+EFrameworkunifiedStatus PowerOffUsbPort(UsbPortNumber usb_port_no) {
+ // check support power control
+ if (!CheckSupportPowerControl(usb_port_no)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ bool current_power = false;
+ if (eFrameworkunifiedStatusOK != GetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], &current_power)) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (!current_power) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ return SetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], GPIO_PORT_OFF);
+}
+
+EFrameworkunifiedStatus CheckUsbAbnormalStatus(UsbPortNumber usb_port_no, UsbAbnormalStatus* usb_abnormal_status) {
+ if (USB_PORT_NUMBER_MAX <= usb_port_no) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ // check NULL pointer
+ if (!usb_abnormal_status) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ // check overcurrent
+ bool is_ovc = false;
+ EFrameworkunifiedStatus result = CheckUsbOvercurrent(usb_port_no, &is_ovc);
+ if (eFrameworkunifiedStatusOK == result) {
+ if (is_ovc) {
+ *usb_abnormal_status = USB_ABNORMAL_STATUS_OVERCURRENT;
+ } else {
+ *usb_abnormal_status = USB_ABNORMAL_STATUS_NONE;
+ }
+ }
+ return result;
+}
diff --git a/vehicle_hal/LICENSE b/vehicle_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/vehicle_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/vehicle_hal/Makefile b/vehicle_hal/Makefile
new file mode 100755
index 0000000..d009b13
--- /dev/null
+++ b/vehicle_hal/Makefile
@@ -0,0 +1,69 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libvehicle_hal.so
+
+HEADER := hal_api/vehicle_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH := /usr/lib
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lpthread
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+#LIBS += -Wl,-Bdynamic -lcarsignal_mng
+
+######### source files ##########################
+VPATH := src
+OBJS := vehicle_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=:$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
+
diff --git a/vehicle_hal/README.md b/vehicle_hal/README.md
new file mode 100755
index 0000000..6636a4f
--- /dev/null
+++ b/vehicle_hal/README.md
@@ -0,0 +1,3 @@
+vehicle_hal library
+==================
+Vehicle HAL implementation library for AGL Reference Board.
diff --git a/vehicle_hal/hal_api/vehicle_hal.h b/vehicle_hal/hal_api/vehicle_hal.h
new file mode 100755
index 0000000..4e6cc89
--- /dev/null
+++ b/vehicle_hal/hal_api/vehicle_hal.h
@@ -0,0 +1,210 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_VEHICLE_HAL_H_
+#define HAL_API_VEHICLE_HAL_H_
+/**
+ * @file vehicle_hal.h
+ */
+
+/** @addtogroup vehicle
+ * @{
+ */
+/** @addtogroup vehicle_hal
+ * @ingroup vehicle
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * \~english Name of the send thread
+ */
+#define TN_LINE_SENS_READ "Vehicle Hal"
+
+/**
+ * @enum LineSensReadInternalServiceProtocol
+ * \~english Command ID used by Vehicle_hal to send the vehicle signal input from the jicage line to the user \n
+ To receive events with this command ID, use the interface defined in framework_unified as follows
+ * @code
+ * ret_status = FrameworkunifiedAttachCallbackToDispatcher(h_app, TN_LINE_SENS_READ, CID_VEHICLEHAL_LINESENS, CbCallbackFunc);
+ * @endcode
+ */
+enum LineSensReadInternalServiceProtocol {
+ CID_VEHICLEHAL_LINESENS = 0x00000101, //!< \~english LineSens Message Command ID
+ CID_VEHICLEHAL_SPDPULSE = 0x00000102, //!< \~english SpeedPulse Message Command ID
+ CID_VEHICLEHAL_SPD = 0x00000103, //!< \~english Speed Message Command ID
+ CID_VEHICLEHAL_LINESENS_POL = 0x00000104,
+ //!< \~english voltage and RHEOSTAT Message Command ID
+};
+
+/**
+ * @enum VehiclehalLinesenskindMicBit
+ * \~english MIC BIT
+ */
+enum VehiclehalLinesenskindMicBit {
+ VEHICLEHAL_LINESENSKIND_MIC_BIT_MIC = 0x01, //!< \~english MIC
+ VEHICLEHAL_LINESENSKIND_MIC_BIT_ANALOGMIC1 = 0x02, //!< \~english ANALOGMIC1
+ VEHICLEHAL_LINESENSKIND_MIC_BIT_ANALOGMIC2 = 0x04, //!< \~english ANALOGMIC2
+};
+
+/**
+ * @enum VehiclehalLinesenskindMic2Bit
+ * \~english MIC2 BIT
+ */
+enum VehiclehalLinesenskindMic2Bit {
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_A2BHUB = 0x01, //!< \~english A2BHUB
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC1 = 0x02, //!< \~english MULTIMIC1
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC2 = 0x04, //!< \~english MULTIMIC2
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC3 = 0x08, //!< \~english MULTIMIC3
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC4 = 0x10, //!< \~english MULTIMIC4
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC5 = 0x20, //!< \~english MULTIMIC5
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC6 = 0x40, //!< \~english MULTIMIC6
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_ANC = 0x80, //!< \~english ANC
+};
+
+/**
+ * @enum VehicleHalLineSensKind
+ * \~english Line Sensor kind
+ */
+enum VehicleHalLineSensKind {
+ VEHICLEHAL_LINESENSKIND_IG = 0, //!< \~english IG
+ VEHICLEHAL_LINESENSKIND_PKB, //!< \~english PKB
+ VEHICLEHAL_LINESENSKIND_REV, //!< \~english REV
+ VEHICLEHAL_LINESENSKIND_ILL, //!< \~english ILL
+ VEHICLEHAL_LINESENSKIND_LOWVOLTAGE, //!< \~english LOWVOLTAGE
+ VEHICLEHAL_LINESENSKIND_ADIM, //!< \~english ADIM
+ VEHICLEHAL_LINESENSKIND_MIC, //!< \~english MIC,ANALOGMIC1,ANALOGMIC2
+ VEHICLEHAL_LINESENSKIND_USBPOWERSUPPLY, //!< \~english USB Power Supply[10mA]
+ VEHICLEHAL_LINESENSKIND_MIC2, //!< \~english A2BHUB,MULTIMIC1 to 6,ANC
+ VEHICLEHAL_LINESENSKIND_NUM, //!< \~english MAX Number
+};
+
+/**
+ * @enum VEHICLEHAL_RET_TYPE
+ * \~english The return value of vehicle_hal API
+ */
+typedef enum {
+ /**
+ * \~english Success
+ */
+ VEHICLEHAL_RET_SUCCESS = 0,
+ /**
+ * \~english Car Signal Ctrl Api Initialize failed
+ */
+ VEHICLEHAL_RET_ERR_HARDINIT,
+ /**
+ * \~english McSend Open failed
+ */
+ VEHICLEHAL_RET_ERR_MCOPEN,
+ /**
+ * \~english Create Thread failed
+ */
+ VEHICLEHAL_RET_ERR_THREADSTART,
+ /**
+ * \~english Invalid paramter
+ */
+ VEHICLEHAL_RET_ERR_PARAM,
+}VEHICLEHAL_RET_TYPE;
+
+/**
+ * @struct VehicleHalSpeedPulse
+ * \~english Struct of SpeedPulse
+ */
+struct VehicleHalSpeedPulse {
+ float pulse; //!< \~english speed pulse[Hz]
+ float period; //!< \~english pulse period[ms]
+};
+
+/**
+ * @struct VehicleHalLineSensMsg
+ * \~english Struct of Meassage
+ */
+struct VehicleHalLineSensMsg {
+ uint8_t stdata[VEHICLEHAL_LINESENSKIND_NUM]; //!< \~english line data
+};
+
+/**
+ * @struct VehicleHalPol
+ * \~english Struct of VehicleHalPolling
+ */
+struct VehicleHalPol {
+ uint8_t vb; //!< \~english voltage [10 * v]
+ uint8_t rheostat; //!< \~english RHEOSTAT [10 * v]
+};
+
+/**
+ * \ingroup VehicleHalStart
+ * \~english @par Brief
+ * API to start the vehicle_hal
+ * \~english @param [in] happ
+ * HANDLE - Handle for Application
+ * \~english @retval VEHICLEHAL_RET_SUCCESS : Success
+ * \~english @retval VEHICLEHAL_RET_ERR_HARDINIT : Car Signal Ctrl Api Initialize failed
+ * \~english @retval VEHICLEHAL_RET_ERR_MCOPEN : McSend Open failed
+ * \~english @retval VEHICLEHAL_RET_ERR_THREADSTART : Create Thread failed
+ * \~english @retval VEHICLEHAL_RET_ERR_PARAM : Invalid paramter
+ * \~english @par Prerequisite
+ * None
+ * \~english @par Change of internal state
+ * - If start successfully, vehicle_hal changes from stop to start.
+ * - If start failed, the state of the vehicle_hal remains no change.
+ * \~english @par Conditions of processing failure
+ * - Car Signal Ctrl Api Initialize failed.
+ * - McSend Open failed.
+ * - Create Thread failed.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Start the vehicle_hal service.
+ * - The API can only be used by 1 process.
+ * \~english @see
+ * None
+ */
+VEHICLEHAL_RET_TYPE VehicleHalStart(HANDLE happ);
+
+/**
+ * \ingroup VehicleHalStop
+ * \~english @par Brief
+ * API to stop the vehicle_hal
+ * \~english @param [in] happ
+ * HANDLE - Handle for Application
+ * \~english @retval VEHICLEHAL_RET_SUCCESS : Success
+ * \~english @retval VEHICLEHAL_RET_ERR_PARAM : Invalid paramter
+ * \~english @par Prerequisite
+ * vehicle_hal start successfully.
+ * \~english @par Change of internal state
+ * - If start successfully, vehicle_hal changes from start to stop.
+ * - If start failed, the state of the vehicle_hal remains no change.
+ * \~english @par Conditions of processing failure
+ * None.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Stop the vehicle_hal service.
+ * - The API can only be used by 1 process.
+ * \~english @see
+ * None
+ */
+VEHICLEHAL_RET_TYPE VehicleHalStop(HANDLE happ);
+
+/** @}*/ //!< end of vehicle_hal
+/** @}*/ //!< end of vehicle
+#endif // HAL_API_VEHICLE_HAL_H_
diff --git a/vehicle_hal/inc/vehicle_hal_frameworkunifiedlog.h b/vehicle_hal/inc/vehicle_hal_frameworkunifiedlog.h
new file mode 100755
index 0000000..2cee8eb
--- /dev/null
+++ b/vehicle_hal/inc/vehicle_hal_frameworkunifiedlog.h
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_VEHICLE_HAL_FRAMEWORKUNIFIEDLOG_H_
+#define INC_VEHICLE_HAL_FRAMEWORKUNIFIEDLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_VEHICLE_HAL_FRAMEWORKUNIFIEDLOG_H_
+
diff --git a/vehicle_hal/src/vehicle_hal.cpp b/vehicle_hal/src/vehicle_hal.cpp
new file mode 100755
index 0000000..258c51a
--- /dev/null
+++ b/vehicle_hal/src/vehicle_hal.cpp
@@ -0,0 +1,398 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <agl_thread.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include "vehicle_hal_frameworkunifiedlog.h"
+
+extern "C" {
+// #include "carsignal_mng_api.h"
+}
+
+#include "vehicle_hal.h"
+
+/**
+* \~english environment variable define
+*/
+#define VEHICLEHAL_LINESENSKIND_ADIM_DATA "VEHICLEHAL_LINESENSKIND_ADIM"
+/**
+* \~english environment variable define
+*/
+#define VEHICLEHAL_LINESENSKIND_MIC_DATA "VEHICLEHAL_LINESENSKIND_MIC"
+/**
+* \~english environment variable define
+*/
+#define VEHICLEHAL_LINESENSKIND_VB_DATA "VEHICLEHAL_LINESENSKIND_VB"
+/**
+* \~english environment variable define
+*/
+#define VEHICLEHAL_LINESENSKIND_RHEOSTAT_DATA "VEHICLEHAL_LINESENSKIND_RHEOSTAT"
+
+#define VEHICLEHAL_LOWVB_VALUE 75
+
+// send message flag
+static HANDLE g_sendmsg_handle = NULL;
+
+// work thread exit flag
+static BOOL g_loopendflag = FALSE;
+
+// polling thread exit flag
+static BOOL g_polloopendflag = FALSE;
+
+// isOpen flag
+static BOOL g_isopenflag = FALSE;
+
+// thread id
+static pthread_t g_threadid = 0;
+
+// hard object struct
+//static VclCtlApiObj g_sclientobj;
+
+// app name
+static CHAR g_appname[MAX_NAME_SIZE_APP];
+
+// line sense list
+const UINT8 kLineSensList[VEHICLEHAL_LINESENSKIND_NUM] = {
+// CARSIGNAL_IG,
+// CARSIGNAL_PKB,
+// CARSIGNAL_REV,
+// CARSIGNAL_ILL,
+};
+
+static void *VehicleHalProcess(void *arg);
+
+HANDLE g_vehiclehalext_thread;
+HANDLE g_vehiclehalpol_thread;
+EFrameworkunifiedStatus VehicleHalProcessExtStart(HANDLE happ);
+EFrameworkunifiedStatus VehicleHalProcessExtStop(HANDLE happ);
+EFrameworkunifiedStatus VehicleHalProcessRecvSpeed(HANDLE happ);
+
+EFrameworkunifiedStatus VehicleHalProcessPolStart(HANDLE happ);
+EFrameworkunifiedStatus VehicleHalProcessPolStop(HANDLE happ);
+
+static const FrameworkunifiedProtocolCallbackHandler kVehicleHalSpd[] = { {
+ CID_VEHICLEHAL_SPD, VehicleHalProcessRecvSpeed } };
+
+#define VEHICLEHAL_SPEED "VehicleHalSpd"
+#define VEHICLEHAL_EXT "VehicleHalExt"
+#define VEHICLEHAL_POL "VehicleHalPol"
+
+VEHICLEHAL_RET_TYPE VehicleHalStart(HANDLE happ) {
+ if (NULL == happ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Handle is NULL");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+
+ // check open flag
+ if (TRUE == g_isopenflag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Already Opened");
+ return VEHICLEHAL_RET_SUCCESS;
+ }
+
+// memset(&g_sclientobj, 0, sizeof(g_sclientobj));
+
+ // enter loop
+ g_loopendflag = FALSE;
+
+ g_polloopendflag = FALSE;
+
+ // get app name
+ PCSTR app_name = FrameworkunifiedGetAppName(happ);
+ if (NULL == app_name) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Get App Name Failed");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+
+ memset(g_appname, 0, sizeof(g_appname));
+ memcpy(g_appname, app_name, sizeof(g_appname));
+ g_appname[MAX_NAME_SIZE_APP] = '\0';
+
+// // Start VLC data input control API
+// UINT32 ret = VclCtlApiOpen(&g_sclientobj);
+// if ( CARSIGNAL_CTL_RET_SUCCESS != ret ) {
+// FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Ten Api Open Failed");
+// return VEHICLEHAL_RET_ERR_HARDINIT;
+// }
+
+ // Open message queue for sending
+ g_sendmsg_handle = McOpenSender(g_appname);
+ if (NULL == g_sendmsg_handle) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Open Mc Sender Failed");
+// VclCtlApiClose(&g_sclientobj);
+ return VEHICLEHAL_RET_ERR_MCOPEN;
+ }
+
+ // create thread
+ int iret = pthread_create(&g_threadid,
+ NULL,
+ VehicleHalProcess,
+ NULL);
+ if ( 0 != iret ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Create Thread Failed");
+ McClose(g_sendmsg_handle);
+// VclCtlApiClose(&g_sclientobj);
+ return VEHICLEHAL_RET_ERR_THREADSTART;
+ }
+
+ g_vehiclehalext_thread = FrameworkunifiedCreateChildThread(happ, VEHICLEHAL_EXT,
+ VehicleHalProcessExtStart,
+ VehicleHalProcessExtStop);
+
+ EFrameworkunifiedStatus estatus = FrameworkunifiedStartChildThread(happ, g_vehiclehalext_thread, 0, NULL);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedStartChildThread Failed");
+ McClose(g_sendmsg_handle);
+ return VEHICLEHAL_RET_ERR_THREADSTART;
+ }
+
+ g_vehiclehalpol_thread = FrameworkunifiedCreateChildThread(happ, VEHICLEHAL_POL,
+ VehicleHalProcessPolStart,
+ VehicleHalProcessPolStop);
+
+ EFrameworkunifiedStatus estatus_pol = FrameworkunifiedStartChildThread(happ, g_vehiclehalpol_thread, 0, NULL);
+ if (eFrameworkunifiedStatusOK != estatus_pol) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedStartChildThread polling Failed");
+ McClose(g_sendmsg_handle);
+ return VEHICLEHAL_RET_ERR_THREADSTART;
+ }
+
+
+ // set open flag true
+ g_isopenflag = TRUE;
+
+ return VEHICLEHAL_RET_SUCCESS;
+}
+
+VEHICLEHAL_RET_TYPE VehicleHalStop(HANDLE happ) {
+ if (NULL == happ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Handle is NULL");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+
+ if (NULL != g_vehiclehalext_thread) {
+ EFrameworkunifiedStatus estatus = FrameworkunifiedDestroyChildThread(happ, g_vehiclehalext_thread);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedDestroyChildThread Failed");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+ g_vehiclehalext_thread = NULL;
+ }
+
+ // set open flag of polling to fasle
+ g_polloopendflag = TRUE;
+
+ if (NULL != g_vehiclehalpol_thread) {
+ EFrameworkunifiedStatus estatus = FrameworkunifiedStopChildThread(happ, g_vehiclehalpol_thread, 0, NULL);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedDestroyChildThread polling Failed");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+ estatus = FrameworkunifiedDestroyChildThread(happ, g_vehiclehalpol_thread);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedDestroyChildThread polling Failed");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+ g_vehiclehalpol_thread = NULL;
+ }
+
+ // set open flag fasle
+ g_isopenflag = FALSE;
+
+ // exit loop
+ g_loopendflag = TRUE;
+
+ // destroy thead
+ pthread_join(g_threadid, NULL);
+
+ // Close message queue
+ McClose(g_sendmsg_handle);
+
+// // End VLC data input control API
+// VclCtlApiClose(&g_sclientobj);
+
+ return VEHICLEHAL_RET_SUCCESS;
+}
+
+void *VehicleHalProcess(void *arg) {
+ // Line Sense Message
+ VehicleHalLineSensMsg s_linesensmsg;
+ memset( &s_linesensmsg, 0xFF, sizeof(s_linesensmsg) );
+
+ // main loop
+ while (TRUE != g_loopendflag) {
+ char* p_env_vb = NULL;
+ p_env_vb = getenv(VEHICLEHAL_LINESENSKIND_VB_DATA);
+ if (NULL != p_env_vb) {
+ // low voltage
+ if (VEHICLEHAL_LOWVB_VALUE >= atoi(p_env_vb)) {
+ s_linesensmsg.stdata[VEHICLEHAL_LINESENSKIND_LOWVOLTAGE] = 1;
+ } else {
+ s_linesensmsg.stdata[VEHICLEHAL_LINESENSKIND_LOWVOLTAGE] = 0;
+ }
+ }
+
+ // loop to get line sense status
+ for (UI_32 iloopnum = 0; iloopnum <= VEHICLEHAL_LINESENSKIND_ILL; ++iloopnum) {
+ // line sense status
+ UINT8 signalret = 0;
+
+// // get line sense status
+// UINT32 ret = VclCtlApiRcvVclData(&g_sclientobj, kLineSensList[iloopnum], &signalret);
+// if ( CARSIGNAL_CTL_RET_SUCCESS != ret ) {
+// FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Get LineSens [%d] status faild [%d]", kLineSensList[iloopnum], ret);
+// continue;
+// }
+
+ // convert 0 to 1 or 1 to 0 for IG,REV according car signal api reference
+ switch (kLineSensList[iloopnum]) {
+// case CARSIGNAL_IG:
+// case CARSIGNAL_REV:
+// signalret = 1 - signalret;
+// break;
+
+ default:
+ break;
+ }
+
+ // check status
+ if (signalret != s_linesensmsg.stdata[iloopnum]) {
+ s_linesensmsg.stdata[iloopnum] = signalret;
+ }
+ }
+
+ char* p_env_adim = NULL;
+ p_env_adim = getenv(VEHICLEHAL_LINESENSKIND_ADIM_DATA);
+ if (NULL != p_env_adim) {
+ s_linesensmsg.stdata[VEHICLEHAL_LINESENSKIND_ADIM] = atoi(p_env_adim);
+ }
+
+ char* p_env_mic = NULL;
+ p_env_mic = getenv(VEHICLEHAL_LINESENSKIND_MIC_DATA);
+ if (NULL != p_env_mic) {
+ s_linesensmsg.stdata[VEHICLEHAL_LINESENSKIND_MIC] = atoi(p_env_mic);
+ }
+
+ // send line sens
+ EFrameworkunifiedStatus eretval = McSend(g_sendmsg_handle, TN_LINE_SENS_READ, CID_VEHICLEHAL_LINESENS,
+ sizeof(s_linesensmsg), (PVOID)&s_linesensmsg);
+ if (eFrameworkunifiedStatusOK != eretval) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McSend LineSens failed");
+ }
+
+ // wait 10ms
+ usleep(10000);
+ }
+ return NULL;
+}
+
+EFrameworkunifiedStatus VehicleHalProcessExtStart(HANDLE happ) {
+ EFrameworkunifiedStatus estatus = FrameworkunifiedAttachCallbacksToDispatcher(happ, VEHICLEHAL_SPEED,
+ kVehicleHalSpd,
+ static_cast<UI_32>(_countof(kVehicleHalSpd)));
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__,
+ "Error FrameworkunifiedAttachCallbacksToDispatcher Vehicle_Hal_Speed:%d", estatus);
+ return estatus;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus VehicleHalProcessExtStop(HANDLE happ) {
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus VehicleHalProcessRecvSpeed(HANDLE happ) {
+ // Speed Pusle Message
+ VehicleHalSpeedPulse speedpulsemsg;
+ memset( &speedpulsemsg, 0xFF, sizeof(speedpulsemsg) );
+
+ // get vehicle speed
+ UINT16 speed = 0;
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusOK;
+
+ estatus = FrameworkunifiedGetMsgDataOfSize(happ, &speed, sizeof(speed), eSMRRelease);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "failed FrameworkunifiedGetMsgDataOfSize() Status=[%d]", estatus);
+ return estatus;
+ }
+
+ // calculate speed to speed pulse
+ float speedpulse = static_cast<float>(speed * (4.0*637.0) / (60.0 * 60.0));
+ if ( speedpulse != speedpulsemsg.pulse ) {
+ speedpulsemsg.pulse = speedpulse;
+ if (0.0 != speedpulse) {
+ speedpulsemsg.period = static_cast<float>((1 / speedpulse) * 1000);
+ } else {
+ speedpulsemsg.period = 0;
+ }
+ }
+
+ // send line sens
+ EFrameworkunifiedStatus eretval = McSend(g_sendmsg_handle, TN_LINE_SENS_READ, CID_VEHICLEHAL_SPDPULSE,
+ sizeof(speedpulsemsg), (PVOID)&speedpulsemsg);
+ if (eFrameworkunifiedStatusOK != eretval) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McSend Speed Pulse failed");
+ }
+
+ eretval = McSend(g_sendmsg_handle, TN_LINE_SENS_READ, CID_VEHICLEHAL_SPD,
+ sizeof(UINT16), (PVOID)&speed);
+ if (eFrameworkunifiedStatusOK != eretval) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McSend Speed failed");
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus VehicleHalProcessPolStart(HANDLE happ) {
+ VehicleHalPol s_pol;
+ memset( &s_pol, 0xFF, sizeof(s_pol) );
+
+ while (!g_polloopendflag) {
+ char* p_env_vb = NULL;
+ char* p_env_rheostat = NULL;
+ p_env_vb = getenv(VEHICLEHAL_LINESENSKIND_VB_DATA);
+ p_env_rheostat = getenv(VEHICLEHAL_LINESENSKIND_RHEOSTAT_DATA);
+ if (NULL != p_env_vb) {
+ // covert voltage value
+ s_pol.vb = atoi(p_env_vb);
+ }
+
+ if (NULL != p_env_rheostat) {
+ // covert RHEOSTAT value
+ s_pol.rheostat = atoi(p_env_rheostat);
+ }
+ // send vb and rheostat
+ EFrameworkunifiedStatus eretval = McSend(g_sendmsg_handle, TN_LINE_SENS_READ, CID_VEHICLEHAL_LINESENS_POL,
+ sizeof(s_pol), (PVOID)&s_pol);
+ if (eFrameworkunifiedStatusOK != eretval) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McSend Vb and RHEOSTAT failed");
+ }
+ // sleep 700ms
+ usleep(700000);
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus VehicleHalProcessPolStop(HANDLE happ) {
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/vehicleservice/.gitattributes b/vehicleservice/.gitattributes
new file mode 100755
index 0000000..445b3c2
--- /dev/null
+++ b/vehicleservice/.gitattributes
@@ -0,0 +1,128 @@
+*.doc filter=lfs diff=lfs merge=lfs -text
+*.docx filter=lfs diff=lfs merge=lfs -text
+*.pdf filter=lfs diff=lfs merge=lfs -text
+*.ppt filter=lfs diff=lfs merge=lfs -text
+*.pptx filter=lfs diff=lfs merge=lfs -text
+*.vsd filter=lfs diff=lfs merge=lfs -text
+*.xls filter=lfs diff=lfs merge=lfs -text
+*.xlsm filter=lfs diff=lfs merge=lfs -text
+*.xlsx filter=lfs diff=lfs merge=lfs -text
+*.doC filter=lfs diff=lfs merge=lfs -text
+*.dOc filter=lfs diff=lfs merge=lfs -text
+*.dOC filter=lfs diff=lfs merge=lfs -text
+*.Doc filter=lfs diff=lfs merge=lfs -text
+*.DoC filter=lfs diff=lfs merge=lfs -text
+*.DOc filter=lfs diff=lfs merge=lfs -text
+*.DOC filter=lfs diff=lfs merge=lfs -text
+*.docX filter=lfs diff=lfs merge=lfs -text
+*.doCx filter=lfs diff=lfs merge=lfs -text
+*.doCX filter=lfs diff=lfs merge=lfs -text
+*.dOcx filter=lfs diff=lfs merge=lfs -text
+*.dOcX filter=lfs diff=lfs merge=lfs -text
+*.dOCx filter=lfs diff=lfs merge=lfs -text
+*.dOCX filter=lfs diff=lfs merge=lfs -text
+*.Docx filter=lfs diff=lfs merge=lfs -text
+*.DocX filter=lfs diff=lfs merge=lfs -text
+*.DoCx filter=lfs diff=lfs merge=lfs -text
+*.DoCX filter=lfs diff=lfs merge=lfs -text
+*.DOcx filter=lfs diff=lfs merge=lfs -text
+*.DOcX filter=lfs diff=lfs merge=lfs -text
+*.DOCx filter=lfs diff=lfs merge=lfs -text
+*.DOCX filter=lfs diff=lfs merge=lfs -text
+*.pdF filter=lfs diff=lfs merge=lfs -text
+*.pDf filter=lfs diff=lfs merge=lfs -text
+*.pDF filter=lfs diff=lfs merge=lfs -text
+*.Pdf filter=lfs diff=lfs merge=lfs -text
+*.PdF filter=lfs diff=lfs merge=lfs -text
+*.PDf filter=lfs diff=lfs merge=lfs -text
+*.PDF filter=lfs diff=lfs merge=lfs -text
+*.ppT filter=lfs diff=lfs merge=lfs -text
+*.pPt filter=lfs diff=lfs merge=lfs -text
+*.pPT filter=lfs diff=lfs merge=lfs -text
+*.Ppt filter=lfs diff=lfs merge=lfs -text
+*.PpT filter=lfs diff=lfs merge=lfs -text
+*.PPt filter=lfs diff=lfs merge=lfs -text
+*.PPT filter=lfs diff=lfs merge=lfs -text
+*.pptX filter=lfs diff=lfs merge=lfs -text
+*.ppTx filter=lfs diff=lfs merge=lfs -text
+*.ppTX filter=lfs diff=lfs merge=lfs -text
+*.pPtx filter=lfs diff=lfs merge=lfs -text
+*.pPtX filter=lfs diff=lfs merge=lfs -text
+*.pPTx filter=lfs diff=lfs merge=lfs -text
+*.pPTX filter=lfs diff=lfs merge=lfs -text
+*.Pptx filter=lfs diff=lfs merge=lfs -text
+*.PptX filter=lfs diff=lfs merge=lfs -text
+*.PpTx filter=lfs diff=lfs merge=lfs -text
+*.PpTX filter=lfs diff=lfs merge=lfs -text
+*.PPtx filter=lfs diff=lfs merge=lfs -text
+*.PPtX filter=lfs diff=lfs merge=lfs -text
+*.PPTx filter=lfs diff=lfs merge=lfs -text
+*.PPTX filter=lfs diff=lfs merge=lfs -text
+*.vsD filter=lfs diff=lfs merge=lfs -text
+*.vSd filter=lfs diff=lfs merge=lfs -text
+*.vSD filter=lfs diff=lfs merge=lfs -text
+*.Vsd filter=lfs diff=lfs merge=lfs -text
+*.VsD filter=lfs diff=lfs merge=lfs -text
+*.VSd filter=lfs diff=lfs merge=lfs -text
+*.VSD filter=lfs diff=lfs merge=lfs -text
+*.xlS filter=lfs diff=lfs merge=lfs -text
+*.xLs filter=lfs diff=lfs merge=lfs -text
+*.xLS filter=lfs diff=lfs merge=lfs -text
+*.Xls filter=lfs diff=lfs merge=lfs -text
+*.XlS filter=lfs diff=lfs merge=lfs -text
+*.XLs filter=lfs diff=lfs merge=lfs -text
+*.XLS filter=lfs diff=lfs merge=lfs -text
+*.xlsM filter=lfs diff=lfs merge=lfs -text
+*.xlSm filter=lfs diff=lfs merge=lfs -text
+*.xlSM filter=lfs diff=lfs merge=lfs -text
+*.xLsm filter=lfs diff=lfs merge=lfs -text
+*.xLsM filter=lfs diff=lfs merge=lfs -text
+*.xLSm filter=lfs diff=lfs merge=lfs -text
+*.xLSM filter=lfs diff=lfs merge=lfs -text
+*.Xlsm filter=lfs diff=lfs merge=lfs -text
+*.XlsM filter=lfs diff=lfs merge=lfs -text
+*.XlSm filter=lfs diff=lfs merge=lfs -text
+*.XlSM filter=lfs diff=lfs merge=lfs -text
+*.XLsm filter=lfs diff=lfs merge=lfs -text
+*.XLsM filter=lfs diff=lfs merge=lfs -text
+*.XLSm filter=lfs diff=lfs merge=lfs -text
+*.XLSM filter=lfs diff=lfs merge=lfs -text
+*.xlsX filter=lfs diff=lfs merge=lfs -text
+*.xlSx filter=lfs diff=lfs merge=lfs -text
+*.xlSX filter=lfs diff=lfs merge=lfs -text
+*.xLsx filter=lfs diff=lfs merge=lfs -text
+*.xLsX filter=lfs diff=lfs merge=lfs -text
+*.xLSx filter=lfs diff=lfs merge=lfs -text
+*.xLSX filter=lfs diff=lfs merge=lfs -text
+*.Xlsx filter=lfs diff=lfs merge=lfs -text
+*.XlsX filter=lfs diff=lfs merge=lfs -text
+*.XlSx filter=lfs diff=lfs merge=lfs -text
+*.XlSX filter=lfs diff=lfs merge=lfs -text
+*.XLsx filter=lfs diff=lfs merge=lfs -text
+*.XLsX filter=lfs diff=lfs merge=lfs -text
+*.XLSx filter=lfs diff=lfs merge=lfs -text
+*.XLSX filter=lfs diff=lfs merge=lfs -text
+*.json filter=lfs diff=lfs merge=lfs -text
+*.jsoN filter=lfs diff=lfs merge=lfs -text
+*.jsOn filter=lfs diff=lfs merge=lfs -text
+*.jsON filter=lfs diff=lfs merge=lfs -text
+*.jSon filter=lfs diff=lfs merge=lfs -text
+*.jSoN filter=lfs diff=lfs merge=lfs -text
+*.jSOn filter=lfs diff=lfs merge=lfs -text
+*.jSON filter=lfs diff=lfs merge=lfs -text
+*.Json filter=lfs diff=lfs merge=lfs -text
+*.JsoN filter=lfs diff=lfs merge=lfs -text
+*.JsOn filter=lfs diff=lfs merge=lfs -text
+*.JsON filter=lfs diff=lfs merge=lfs -text
+*.JSon filter=lfs diff=lfs merge=lfs -text
+*.JSoN filter=lfs diff=lfs merge=lfs -text
+*.JSOn filter=lfs diff=lfs merge=lfs -text
+*.JSON filter=lfs diff=lfs merge=lfs -text
+*.ods filter=lfs diff=lfs merge=lfs -text
+*.odS filter=lfs diff=lfs merge=lfs -text
+*.oDs filter=lfs diff=lfs merge=lfs -text
+*.oDS filter=lfs diff=lfs merge=lfs -text
+*.Ods filter=lfs diff=lfs merge=lfs -text
+*.OdS filter=lfs diff=lfs merge=lfs -text
+*.ODs filter=lfs diff=lfs merge=lfs -text
+*.ODS filter=lfs diff=lfs merge=lfs -text
diff --git a/vehicleservice/positioning/LICENSE b/vehicleservice/positioning/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/vehicleservice/positioning/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/vehicleservice/positioning/Makefile.client b/vehicleservice/positioning/Makefile.client
new file mode 100755
index 0000000..7236c74
--- /dev/null
+++ b/vehicleservice/positioning/Makefile.client
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### subdirectories #########
+SUBDIRS += client
+
+include ../vehicle_service.mk
diff --git a/vehicleservice/positioning/Makefile.server b/vehicleservice/positioning/Makefile.server
new file mode 100755
index 0000000..d0fda9c
--- /dev/null
+++ b/vehicleservice/positioning/Makefile.server
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### subdirectories #########
+SUBDIRS += server
+
+include ../vehicle_service.mk
diff --git a/vehicleservice/positioning/client/Makefile b/vehicleservice/positioning/client/Makefile
new file mode 100755
index 0000000..d7fce28
--- /dev/null
+++ b/vehicleservice/positioning/client/Makefile
@@ -0,0 +1,31 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed header #########
+VPATH = ./include/$(COMPONENT_NAME)
+
+INST_HEADERS += POS_define.h
+INST_HEADERS += POS_sensor_API.h
+INST_HEADERS += POS_gps_API.h
+INST_HEADERS += POS_common_API.h
+INST_HEADERS += positioning.h
+
+######### subdirectories #########
+SUBDIRS += src/POS_common_API
+SUBDIRS += src/POS_gps_API
+SUBDIRS += src/POS_sensor_API
+
+include ../../vehicle_service.mk
diff --git a/vehicleservice/positioning/client/include/CanInput_API.h b/vehicleservice/positioning/client/include/CanInput_API.h
new file mode 100755
index 0000000..1449b25
--- /dev/null
+++ b/vehicleservice/positioning/client/include/CanInput_API.h
@@ -0,0 +1,98 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+ * File name : CanInput_API.h
+ * System name : PastModel002
+ * Sub System name : CanInput_API library
+ ******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_CANINPUT_API_H_
+#define POSITIONING_CLIENT_INCLUDE_CANINPUT_API_H_
+
+/************************************************************************
+ * Include *
+ ***********************************************************************/
+#include <vehicle_service/positioning_base_library.h> /* for type definitions */
+
+/************************************************************************
+* Definition *
+************************************************************************/
+/*----------------------------------------------------------------------*
+ * CAN_INPUT_RET_API Definition *
+ *----------------------------------------------------------------------*/
+/* Normal */
+#define CAN_INPUT_RET_NORMAL 0 /* Successful completion */
+
+/* Abnormal */
+#define CAN_INPUT_RET_ERROR (-1) /* An error has occurred */
+#define CAN_INPUT_RET_ERROR_PARAM (-2) /* Parameter error */
+
+/*----------------------------------------------------------------------*
+ * Message Definition *
+ *----------------------------------------------------------------------*/
+/* Command ID */
+#define CANINPUT_CID_LOCALTIME_NOTIFICATION 0x0220
+
+/*----------------------------------------------------------------------*
+ * Localtime status Definition *
+ *----------------------------------------------------------------------*/
+#define CANINPUT_LOCALTIME_STATUS_INVALID 0U
+#define CANINPUT_LOCALTIME_STATUS_INIT 1U
+#define CANINPUT_LOCALTIME_STATUS_PLAUSIBLE 2U
+#define CANINPUT_LOCALTIME_STATUS_NEW 3U
+#define CANINPUT_LOCALTIME_STATUS_DIAG 4U
+#define CANINPUT_LOCALTIME_STATUS_INCOMPLETE 5U
+
+/************************************************************************
+* type Definition *
+************************************************************************/
+typedef RET_API CAN_INPUT_RET_API; /* API return value */
+
+/************************************************************************
+* struct Definition *
+************************************************************************/
+/************************************************************************
+ * TAG : CANINPUT_MSG_LOCALTIMEINFO_DAT
+ * ABSTRACT : Localtime data structure
+ * NOTE :
+ ************************************************************************/
+typedef struct {
+ u_int8 status; /* status : Refer to Localtime status Definition */
+ u_int8 year; /* year : 0..99 (FFh:invalid) */
+ u_int8 month; /* month : 1..12 (FFh:invalid) */
+ u_int8 date; /* date : 1..31 (FFh:invalid) */
+ u_int8 hour; /* hour : 0..23 (FFh:invalid) */
+ u_int8 minute; /* minute : 0..59 (FFh:invalid) */
+ u_int8 second; /* second : 0..59 (FFh:invalid) */
+ u_int8 reserve; /* reserve */
+} CANINPUT_MSG_LOCALTIMEINFO_DAT;
+
+/************************************************************************
+ * Function prototypes *
+ ************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*[CanInput_API Public API]*/
+CAN_INPUT_RET_API CanInputInitialize(void);
+CAN_INPUT_RET_API CanInputSndMsg(PNO pno, CID cid, u_int16 msg_len, const void *msg_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_CANINPUT_API_H_
diff --git a/vehicleservice/positioning/client/include/CanInput_API_private.h b/vehicleservice/positioning/client/include/CanInput_API_private.h
new file mode 100755
index 0000000..d7c8e8e
--- /dev/null
+++ b/vehicleservice/positioning/client/include/CanInput_API_private.h
@@ -0,0 +1,68 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+ * File name : CanInput_API_private.h
+ * System name : PastModel002
+ * Sub System name : CanInput_API library
+ ******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_CANINPUT_API_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_CANINPUT_API_PRIVATE_H_
+
+/************************************************************************
+ * Include *
+ ***********************************************************************/
+
+/************************************************************************
+* Definition *
+************************************************************************/
+/*----------------------------------------------------------------------*
+ * Message Definition *
+ *----------------------------------------------------------------------*/
+/* Message body size (byte) */
+#define CANINPUT_MSGBUF_DSIZE 8 /* Maximum message body size */
+
+/************************************************************************
+* type Definition *
+************************************************************************/
+
+/************************************************************************
+* struct Definition *
+************************************************************************/
+/*****************************************************************************
+ * TAG : CANINPUT_MSG_INFO
+ * ABSTRACT : CanInput_API message structure
+ * NOTE : Message structure
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ uint8_t data[CANINPUT_MSGBUF_DSIZE]; /* Message data (Localtime) */
+} CANINPUT_MSG_INFO;
+
+/************************************************************************
+ * Function prototypes *
+ ************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*[CanInput_API Private API]*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_CANINPUT_API_PRIVATE_H_
diff --git a/vehicleservice/positioning/client/include/Clock_API.h b/vehicleservice/positioning/client/include/Clock_API.h
new file mode 100755
index 0000000..1987999
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Clock_API.h
@@ -0,0 +1,258 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+* $Header:: $
+* $Revision:: $
+*******************************************************************************/
+
+/******************************************************************************
+* File name :Clock_API.h
+* System name :_CWORD107__PND-A
+* Subsystem name :System common functions header file
+* Program name :
+* Publishing department
+****************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_CLOCK_API_H_
+#define POSITIONING_CLIENT_INCLUDE_CLOCK_API_H_
+
+#include <vehicle_service/positioning_base_library.h>
+#include "CommonDefine.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ Macro definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* For time calculation */
+#define CLOCK_TIMESTAMP_GETTIME(x) ((x) & (0x00FFFFFFU)) /* Macros that Get Time Counter Values */
+#define CLOCK_TIMESTAMP_GETFLAG(x) (((x) & (0xE0000000U)) >> (29U)) /* Macros that Get Your Own Count Values */
+#define CLOCK_TIMESTAMP_NORMAL (0U) /* Normal count */
+#define CLOCK_TIMESTAMP_INDIPENDENT (1U) /* Own count */
+
+#define CLOCK_TIMESTAMP_UNION(x, y) (((x) << (29U)) | (y)) /* Macro that combines the unique count value (x) and the time counter value (y) */
+
+ /* Timestamp Shared Memory Related */
+#define TIMESTAMP_RETRY_COUNTE (10U) /* Number of time stamp retries */
+#define TIMESTAMP_RETRY_INTERVAL (10U) /* Time stamp retry interval(100[msec]) */
+
+ /* Time Management Shared Memory Related */
+#define CLKMNG_RETRY_COUNTE (10U) /* Time management retries */
+#define CLKMNG_RETRY_INTERVAL (10U) /* Time Management Retry Interval(100[msec]) */
+
+ /* Day of the week definition */
+#define CLKMNG_SUN (0U) /* Sunday */
+#define CLKMNG_MON (1U) /* Mondays */
+#define CLKMNG_TUE (2U) /* Tuesdays */
+#define CLKMNG_WED (3U) /* Wednesdays */
+#define CLKMNG_THU (4U) /* Thursdays */
+#define CLKMNG_FRI (5U) /* Fridays */
+#define CLKMNG_SAT (6U)
+
+ /* Related to the accuracy of time */
+#define CLOCK_CORRECTED_TIME (0U) /* GPS corrected time completed */
+#define CLOCK_NOT_CORRECTED_TIME (1U) /* GPS uncorrected time */
+#define CLOCK_RTC_TIME (2U) /* GPS RTC time */
+#define CLOCK_INVALID_TIME (3U) /* GPS error time */
+
+ /* Time Stamp Status Storage Data Module Related Definition */
+#define TIMESTAMPDM_NAME "TIMESTAMP_DATA" /* Name of time stamp status storage data module */
+#define TIMESTAMPDM_SEM_NAME "TIMESTAMP_SEM" /* Timestamp status storage data module semaphore name */
+
+ /* Time Management Status Storage Data Module Related Definition */
+#define CLKMNG_DM_NAME "CLOCK_GPS_DATA" /* Name of time management status storage data module */
+#define CLKMNG_DM_SEM_NAME "CLOCK_GPS_SEM" /* Time management status storage data module semaphore name */
+
+ /* Messaging communication */
+#define CLKMNG_MSG_BUF_SIZE (128U) /* Message communication buffer size */
+#define CLKMNG_SETTIME_MSGBODYSIZE (4U) /* Date/Time Setting Response Notification Data Size */
+#define CLKMNG_NOTIOBSERVERS_MSGSZ (4U) /* Time change notification data body size */
+#define CLKMNG_NOTIACCURACY_MSGSZ (4U) /* Change notification data body size from time accuracy */
+#define CLKMNG_NOTIOBSERVERS_ENTRY_MSGSZ (4U) /* Time change notification registration data body size */
+#define CLKMNG_NOTIACCURACY_ENTRY_MSGSZ (0U) /* Change Notification Stored Data Size from Time Accuracy */
+
+ /* Semaphore Related Extensions */
+#define CLOCK_SEM_RETRY_INTERVAL (10) /* Retry interval for semaphore acquisition/release processing 10ms */
+
+/*
+ Data typing
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Time-stamped data */
+typedef struct TagTimestampData {
+ u_int16 trip; /* Trip counters */
+ u_int16 reserve; /* Reservation(Always 0) */
+ u_int32 time; /* Time counter */
+ u_int8 day; /* Number of days */
+ u_int8 hour; /* Time */
+ u_int8 min; /* Minutes */
+ u_int8 sec; /* Second */
+} TimestampData;
+
+/* TIMESTAMP INTERNAL COUNTER MODULE STRUCTURE DEFINITION */
+typedef struct {
+ u_int16 trip; /* Trip counters */
+ u_int32 time; /* Time counter */
+} TIMESTAMP_CNT;
+
+/* Time management status storage area */
+typedef struct TagClockStatus {
+ u_int8 status; /* GPS status */
+ u_int8 hour; /* Time of final correction */
+ u_int8 min; /* Minutes */
+ u_int8 sec; /* Second */
+} ClockStatus;
+
+/* Status storage area for writing time management shared memory */
+typedef struct TagClkMngTimerSetTime {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int8 reserve1[1]; /* (Not used) */
+ u_int8 gps_timer_state; /* GPS time status */
+ u_int16 year; /* Year */
+ u_int8 month; /* Month */
+ u_int8 day; /* Day */
+ u_int8 hour; /* Hour */
+ u_int8 min; /* Minutes */
+ u_int8 sec; /* Second */
+ u_int8 reserve2[3]; /* (Not used) */
+} CLKMNG_TIMER_SET_TIME;
+
+/* Existing sys_timerapi.h data */
+
+/* User time status */
+#define TIMEDATA_INVALID 0 /* Time invalid */
+#define TIMEDATA_VALID 1 /* Time valid */
+
+/* Time Definition AM/PM */
+#define CLOCK_AM 0
+#define CLOCK_PM 1
+/* Change to Enumeration */
+/* Time notification unit */
+typedef enum TagNotifyUnit {
+ CLOCK_NOTIFY_SECOND = (1U), /* Second notifications */
+ CLOCK_NOTIFY_MINUTE, /* Minute Notification */
+ CLOCK_NOTIFY_HOUR /* Hourly notification */
+} NOTIFYUNIT;
+
+/* Return value definition */
+typedef enum TagClockReturn {
+ CLOCK_OK, /* Normal completion */
+ CLOCK_ERROR, /* ABENDs */
+ CLOCK_ERROR_ARGUMENTS /* Invalid argument */
+} CLOCK_RETURN;
+
+/* Time Type Definition */
+typedef struct TagTimeData {
+ u_int16 year; /* Year */
+ u_int8 month; /* Month */
+ u_int8 day; /* Day */
+ u_int8 hour; /* Hour */
+ u_int8 minute; /* Minutes */
+ u_int8 second; /* Second */
+} TimeData;
+
+/* Offset time type definition */
+typedef struct TagOffsetData {
+ BOOL sign; /* Operator */
+ TimeData time; /* Date and time */
+} OffsetData;
+
+/* Data Definition for System Time Delivery Registration */
+typedef struct TagSystemTimeRegistData {
+ NOTIFYUNIT unit; /* Notification unit(Hour,Minutes,One of the seconds) */
+} SYSTEMTIME_REGISTDATA;
+
+/* Data Definition for Setting User Time */
+typedef struct TagUserTimSetData {
+ TimeData time; /* Time */
+ u_int8 day_of_week; /* Day-of-week */
+} USERTIME_SETDATA;
+
+/* Data Definition for User Time Delivery Registration */
+typedef struct TagUserTimeRegistData {
+ NOTIFYUNIT unit; /* Notification unit(Hour,Minutes,One of the seconds) */
+} USERTIME_REGISTDATA;
+
+
+/*
+ Time Management Thread -> External Message Definition
+- - - - - - - - - - - - - - - - - - - - - - */
+/* Message data type */
+typedef struct TagClkMngRecMsg {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int8 data[CLKMNG_MSG_BUF_SIZE];
+} CLKMNG_RCV_MSG;
+
+/* For time management Time Set Response Message */
+typedef struct TagClkMngRetTimeMsg { /* Time Set Response Message */
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ int8 result; /* Processing result */
+ int8 dummy[3];
+} CLKMNG_RETTIME_MSG;
+
+/* Change Notification Message from Time for Time Management */
+typedef struct TagClkMngNotiAccuracyMsg {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ u_int8 gps_status; /* GPS time status(Likelihood) */
+ int8 dummy[3];
+} CLKMNG_NOTIACCURACY_MSG;
+
+/* Time change notification message for time management */
+typedef struct TagClkMngNotiObserversMsg {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ u_int8 hour; /* Hour */
+ u_int8 min; /* Minutes */
+ u_int8 sec; /* Second */
+ int8 dummy[1];
+} CLKMNG_NOTIOBSERVERS_MSG;
+
+/*
+ Time Management API -> Time Management Thread Message Definition
+- - - - - - - - - - - - - - - - - - - - - - */
+/* Change Notification Registration Message from the Accuracy of Time for Time Management */
+typedef struct TagClkMngNotAccuracyEntryMsg {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+} CLKMNG_NOTIACCURACY_ENTRY_MSG;
+
+/* Time change notification registration message for time management */
+typedef struct TagClkMngNotiObserversEntryMsg {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ u_int8 notify_time; /* Notification unit (Hour,Minutes,One of the seconds) */
+ int8 dummy[3];
+} CLKMNG_NOTIOBSERVERS_ENTRY_MSG;
+
+/*
+ API Function Prototype Declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API ClockInitApi(void); /* API initialization processing */
+RET_API ClockGetLocalTime(RealTimeData *real_time, TimestampData *timestamp); /* Current time reference processing */
+RET_API ClockGetLocalTimeBcd(RealTimeDataBcd *real_time_bcd, TimestampData *timestamp); /* Current time reference processing(BCD) */
+RET_API ClockGetUtcTime(RealTimeData* real_time, TimestampData *timestamp); /* Current UTC time reference processing */
+RET_API ClockCnvDateToSec(const LPSYSTEMTIME sys_time, u_int32* sec); /* Date and time,Total seconds conversion */
+RET_API ClockCnvSecToDate(const u_int32* sec, LPSYSTEMTIME sys_time); /* Total seconds,Date and time conversion */
+RET_API ClockGetAddOpeTime(u_int32 *ope_time); /* Accumulated operating time reference processing */
+RET_API ClockSetSystemTime(PNO snd_pno, const SysTimeData* sys_time, u_int8 gps_status); /* System time setting process */
+
+RET_API ClockNotifyObserversClock(PNO snd_pno, u_int8 rsc_id, u_int8 notify_time); /* Fixed period time change notification registration */
+RET_API ClockNotifyObserversAccuracy(PNO snd_pno, u_int8 rsc_id); /* Register change notification based on the time probability */
+RET_API ClockNotifyObserversAdjustClock(PNO snd_pno, u_int8 rsc_id); /* System time setting change notification registration */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_CLOCK_API_H_
diff --git a/vehicleservice/positioning/client/include/CommonDefine.h b/vehicleservice/positioning/client/include/CommonDefine.h
new file mode 100755
index 0000000..2e9e3e6
--- /dev/null
+++ b/vehicleservice/positioning/client/include/CommonDefine.h
@@ -0,0 +1,72 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_COMMONDEFINE_H_
+#define POSITIONING_CLIENT_INCLUDE_COMMONDEFINE_H_
+
+/**
+ * @file CommonDefine.h
+ */
+
+/** @addtogroup vehicle_service
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/pos_message_header.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* Date and Time Status Definition */
+#define NAVIINFO_NAVI_GPS_TD_STS_NOTFIX (0)
+//!< \~english time has not been adjusted after GPS receiver reset
+#define NAVIINFO_NAVI_GPS_TD_STS_RTCBACKUP (1) // !<\~english time output from RTC Backup(have time adjustment)
+#define NAVIINFO_NAVI_GPS_TD_STS_FIX (2) //!< \~english time adjustment completed
+
+/* Vehicle sensor data information */
+#define POS_SNS_CONNECTION (0x01U) //!< \~english connected
+#define POS_SNS_UNCONNECTION (0x00U) //!< \~english not connected
+#define POS_SNS_SHORT (0x02U) //!< \~english short
+#define POS_SNS_UNSPECIFIED (0x03U) //!< \~english not specified
+
+/* NMEA Receive Flag(_CWORD82_) */
+#define POS_SNS__CWORD82__DRMC (0x01U) //!< \~english DRMC sentence
+#define POS_SNS__CWORD82__GSA (0x02U) //!< \~english GSA sentence
+#define POS_SNS__CWORD82__GSV_1 (0x04U) //!< \~english GSV_1 sentence
+#define POS_SNS__CWORD82__GSV_2 (0x08U) //!< \~english GSV_2 sentence
+#define POS_SNS__CWORD82__GSV_3 (0x10U) //!< \~english GSV_3 sentence
+#define POS_SNS__CWORD82__PJRDC_GP_3 (0x20U) //!< \~english PJRDC_GP_3 sentence
+
+/* NMEA Receive Flag */
+#define POS_SNS_GPS_NMEA_PASCD (0x01000000U) //!< \~english pascd sentence
+
+typedef u_int16 PNO; //!< \~english PNo.
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+#endif // POSITIONING_CLIENT_INCLUDE_COMMONDEFINE_H_
diff --git a/vehicleservice/positioning/client/include/DR_API.h b/vehicleservice/positioning/client/include/DR_API.h
new file mode 100755
index 0000000..6362f8c
--- /dev/null
+++ b/vehicleservice/positioning/client/include/DR_API.h
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+@file DR_API.h
+@detail DR_API external header file<BR>
+ DR_API External public header
+******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_DR_API_H_
+#define POSITIONING_CLIENT_INCLUDE_DR_API_H_
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Define *
+ *****************************************************************************/
+/* Command ID */
+#define CID_DR_MAP_MATCHING_DATA (0x0209)
+#define CID_DR_CLEAR_BACKUP_DATA (0x020F)
+
+/* DR_EXT_RET_API definition */
+#define DR_EXT_RET_NORMAL (0) /* Successful completion */
+#define DR_EXT_RET_ERROR (-1) /* Setup failure */
+
+/*****************************************************************************
+ * Typedef *
+ *****************************************************************************/
+typedef int32 DR_EXT_RET_API;
+
+/*****************************************************************************
+ * Enumeration *
+ *****************************************************************************/
+typedef enum {
+ NAVI_DATA_STATUS_2D_FIX = 0x00,
+ NAVI_DATA_STATUS_3D_FIX,
+ NAVI_DATA_STATUS_DR_COMBINED,
+ NAVI_DATA_STATUS_DR_ONLY,
+ NAVI_DATA_STATUS_MAP_2D_GPS_FIX,
+ NAVI_DATA_STATUS_MAP_3D_GPS_FIX,
+ NAVI_DATA_STATUS_MAP_DR_COMBINED,
+ NAVI_DATA_STATUS_MAP_DR_ONLY,
+ NAVI_DATA_STATUS_MAP_NO_FIX,
+ NAVI_DATA_STATUS_AWAITING_FIRST_FIX,
+ NAVI_DATA_STATUS_DATA_INVALID,
+ NAVI_DATA_STATUS_NO_FIX,
+ NAVI_DATA_STATUS_TIME_ONLY_FIX
+} NAVI_DATA_STATUS;
+
+typedef enum {
+ NAVI_DATA_INVALID = 0x00,
+ NAVI_DATA_VALID
+} NAVI_DATA_AVAILABLE;
+
+/*****************************************************************************
+ * Struct *
+ *****************************************************************************/
+/*****************************************************************************
+ * TAG : POSITION_INFO
+ * ABSTRACT : Position information structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ int32 latitude; /* 10^-7deg North : plus, South : minus */
+ int32 longitude; /* 10^-7deg East : plus, West : minus */
+ NAVI_DATA_AVAILABLE status; /* Status of data */
+} POSITION_INFO;
+
+/*****************************************************************************
+ * TAG : RATE_INFO
+ * ABSTRACT : Rate information structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 rate; /* 10^-2m/sec */
+ u_int8 reserve[2]; /* reserve */
+ NAVI_DATA_AVAILABLE status; /* Status of data */
+} RATE_INFO;
+
+/*****************************************************************************
+ * TAG : ORIENT_INFO
+ * ABSTRACT : Orient information structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 orient; /* 10^-2deg N : 0, E : 90, S : 180, W : 270 */
+ u_int8 reserve[2]; /* reserve */
+ NAVI_DATA_AVAILABLE status; /* Status of data */
+} ORIENT_INFO;
+
+/*****************************************************************************
+ * TAG : MAP_MATCHING_DATA
+ * ABSTRACT : Map-Matching information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ POSITION_INFO position_info; /* Position information */
+ RATE_INFO rate_info; /* Rate information */
+ ORIENT_INFO orient_info; /* Orient information */
+ NAVI_DATA_STATUS status; /* Status */
+} MAP_MATCHING_DATA;
+
+/*****************************************************************************
+ * TAG : DR_MSG_MAP_MATCHING_DATA
+ * ABSTRACT : Map-Matching information data message buffer structure
+ * NOTE : Message structure(User -> VehicleSens)
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ MAP_MATCHING_DATA data; /* Message data (Map-Matching information) */
+} DR_MSG_MAP_MATCHING_DATA;
+
+/*****************************************************************************
+ * TAG : DR_MSG_CLEAR_BACKUP_DATA
+ * ABSTRACT : Clear backup data message buffer structure
+ * NOTE : Message structure(User -> VehicleSens)
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+} DR_MSG_CLEAR_BACKUP_DATA;
+
+/*****************************************************************************
+* Function prototypes *
+*****************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern DR_EXT_RET_API DrSetMapMatchingData(PNO pno, MAP_MATCHING_DATA* map_matching_data);
+extern DR_EXT_RET_API DrClearBackupData(PNO pno);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_DR_API_H_
diff --git a/vehicleservice/positioning/client/include/DeadReckoning_DbgLogSim.h b/vehicleservice/positioning/client/include/DeadReckoning_DbgLogSim.h
new file mode 100755
index 0000000..bd57de7
--- /dev/null
+++ b/vehicleservice/positioning/client/include/DeadReckoning_DbgLogSim.h
@@ -0,0 +1,50 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_DEADRECKONING_DBGLOGSIM_H_
+#define POSITIONING_CLIENT_INCLUDE_DEADRECKONING_DBGLOGSIM_H_
+
+/*******************************************************************************
+ FILE : DeadReckoning_DbgLogSim.h
+ SYSTEM : _CWORD64_ platform development
+ SUBSYSTEM : Log Simulator for Debugging
+ PROGRAM : PastModel002*1 log read
+ FUNC LIST :
+--------------------------------------------------------------------------------
+
+*******************************************************************************/
+
+#include "Dead_Reckoning_API.h"
+
+#define DR_DBG_LOG_PACKET_HEAD_SIZE (4) /* DR_LOG_PACKET_HEAD_SIZE */
+#define DR_DBG_LOG_SIM_BUFF_SIZE (0x200)
+
+#define DR_DBG_LOG_SIM_DATA_NONE (-1)
+#define DR_DBG_LOG_SIM_DATA_GPS (1)
+#define DR_DBG_LOG_SIM_DATA_SENSOR (2)
+
+/*
+ * prototype
+ * public functions
+ */
+
+void DeadReckoningDbgLogSimInit(void);
+void DeadReckoningDbgLogSimDispose(void);
+
+BOOL DeadReckoningDbgLogSimIsDbgLogSimMode(void);
+int DeadReckoningDbgLogSimReadPacket(u_int8 *, size_t, int16 *);
+
+#endif // POSITIONING_CLIENT_INCLUDE_DEADRECKONING_DBGLOGSIM_H_
diff --git a/vehicleservice/positioning/client/include/Dead_Reckoning_API.h b/vehicleservice/positioning/client/include/Dead_Reckoning_API.h
new file mode 100755
index 0000000..bd2e031
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Dead_Reckoning_API.h
@@ -0,0 +1,229 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_API_H_
+#define POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_API_H_
+/****************************************************************************
+ * File name :Dead_Reckoning_API.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "Sensor_Common_API.h"
+#include <native_service/frameworkunified_types.h>
+
+/*****************************************************************************
+ * Define *
+ *****************************************************************************/
+#define NUM_OF_100msData (10) /* Number of gyro data items delivered every 100 ms */
+
+/*****************************************************************************
+ * Typedef *
+ *****************************************************************************/
+typedef RET_API DR_RET_API;
+
+/*****************************************************************************
+ * Enumeration *
+ *****************************************************************************/
+/*******************************************************************************
+ TAG : NAVI_MATCHING_STATUS
+ ABSTRACT : Map matching data(Status)
+ NOTE :
+*******************************************************************************/
+typedef enum NaviMatchingStatus {
+ NAVI_MATCHING_STS_2D_FIX = 0x00,
+ NAVI_MATCHING_STS_3D_FIX,
+ NAVI_MATCHING_STS_DR_COMBINED,
+ NAVI_MATCHING_STS_DR_ONLY,
+ NAVI_MATCHING_STS_MAP_2D_GPS_FIX,
+ NAVI_MATCHING_STS_MAP_3D_GPS_FIX,
+ NAVI_MATCHING_STS_MAP_DR_COMBINED,
+ NAVI_MATCHING_STS_MAP_DR_ONLY,
+ NAVI_MATCHING_STS_MAP_NO_FIX,
+ NAVI_MATCHING_STS_AWAITING_FIRST_FIX,
+ NAVI_MATCHING_STS_DATA_INVALID,
+ NAVI_MATCHING_STS_NO_FIX,
+ NAVI_MATCHING_STS_TIME_ONLY_FIX
+} NAVI_MATCHING_STATUS;
+
+/*******************************************************************************
+ TAG : NAVI_MATCHING_DATA_AVAILABLE
+ ABSTRACT : Map matching data(Availability)
+ NOTE :
+*******************************************************************************/
+typedef enum {
+ NAVI_MATCHING_DATA_INVALID = 0x00,
+ NAVI_MATCHING_DATA_VALID
+} NAVI_MATCHING_DATA_AVAILABLE;
+
+/*****************************************************************************
+ * Struct *
+ *****************************************************************************/
+/* Sensor data */
+/*******************************************************************************
+ TAG : Struct_PulseRevTbl
+ ABSTRACT : Vehicle speed/REV data table structure
+ NOTE : 4byte
+*******************************************************************************/
+typedef struct {
+ u_int8 reverse_flag; /* 0:Forward march 1:Backward 3:Disabled Reverse signal status */
+ u_int8 pulse_flag; /* Vehicle speed pulse flag */
+ /* 0:Enabled 1:Receive invalid value from CAN 2:Unable to receive at download timing */
+ u_int16 pulse_sum_cyclic; /* Vehicle speed pulse counter value */
+} Struct_PulseRevTbl;
+/*******************************************************************************
+ TAG : Struct_GyroTbl
+ ABSTRACT : Gyro Data Table Structure
+ NOTE : 20byte
+*******************************************************************************/
+typedef struct {
+ u_int16 gyro_data[NUM_OF_100msData]; /* A/D-converted gyro data */
+} Struct_GyroTbl;
+/*******************************************************************************
+ TAG : Struct_SensData
+ ABSTRACT : Sensor data structure
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ u_int8 sens_cnt_flag; /* Sensor data transmission counter flag */
+ /* 0:Disabled(->Initial Sensor) 1:Enabled(->100 ms periodic transmission) */
+ /* Set "0" for initial sensor transmission and "1" for periodic transmission. */
+ u_int8 sens_cnt; /* Sensor data transmission counter value Set "0" at initial transmission of sensor */
+ Struct_PulseRevTbl pulse_rev_tbl; /* Vehicle speed/REV Data table */
+ Struct_GyroTbl gyro_x_tbl; /* Gyro(X axis) data table */
+ Struct_GyroTbl gyro_y_tbl; /* Gyro(Y axis) data table */
+ Struct_GyroTbl gyro_z_tbl; /* Gyro(Z axis) data table */
+} Struct_SensData;
+
+/* GPS data */
+/*******************************************************************************
+ TAG : Struct_GpsData
+ ABSTRACT : GPS data structure
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ u_int8 sens_cnt; /* Sensor data transmission counter value */
+ u_int8 sens_cnt_flag; /* Sensor data transmission counter flag */
+ /* 0:Disabled(Incorrect GPS sensor counter) */
+ /* 1:Enabled */
+ u_int16 gps_data_size; /* GPS data storage area size */
+ DID did; /* Data ID */
+ const void* gps_data; /* GPS data storage area */
+} Struct_GpsData;
+
+/* Estimated Navigation Calculation Result */
+/*******************************************************************************
+ TAG : Struct_DR_DATA
+ ABSTRACT : Estimated Navigation Calculation Result
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ int64_t latitude; /* Latitude(WGS-84) 10^-7deg */
+ int64_t longitude; /* Longitude(WGS-84) 10^-7deg */
+ int64_t altitude; /* Altitude 10^-2m */
+ u_int16 rate; /* Speeds 10^-2m/sec */
+ u_int16 heading; /* Orientation North-reference clockwise 10^-2deg */
+ u_int16 reserve; /* RESERVE */
+ u_int8 dr_status; /* DR calculation status */
+ u_int8 positioning_time; /* Sensor Counter */
+} Struct_DR_DATA;
+
+/*******************************************************************************
+ TAG : DR_CALC_INFO
+ ABSTRACT : Estimated navigation information
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ u_int16 gyro_offset; /* Correction coefficient:Gyro offset */
+ u_int8 gyro_scale_factor; /* Correction coefficient:Gyro Sensitivity */
+ u_int8 gyro_scale_factor_level; /* Learning Level(Gyro Sensitivity) */
+ u_int16 speed_pulse_scale_factor; /* Correction coefficient:Vehicle speed factor */
+ u_int8 speed_pulse_scale_factor_level; /* Learning Level(Vehicle speed factor) */
+ u_int8 reserve; /* Reserve(1Byte) */
+} DR_CALC_INFO;
+
+/*******************************************************************************
+ TAG : DR_POSITION_INFO
+ ABSTRACT : Location information
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ int64_t latitude;
+ int64_t longitude;
+ NAVI_MATCHING_DATA_AVAILABLE status;
+} DR_POSITION_INFO;
+
+/*******************************************************************************
+ TAG : DR_RATE_INFO
+ ABSTRACT : Location information
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ u_int16 rate;
+ u_int8 reserve[2];
+ NAVI_MATCHING_DATA_AVAILABLE status;
+} DR_RATE_INFO;
+
+/*******************************************************************************
+ TAG : DR_ORIENT_INFO
+ ABSTRACT : Location information
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ u_int16 orient;
+ u_int8 reserve[2];
+ NAVI_MATCHING_DATA_AVAILABLE status;
+} DR_ORIENT_INFO;
+
+/*******************************************************************************
+ TAG : NAVI_MATCHING_DATA
+ ABSTRACT : Map matching data
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ DR_POSITION_INFO position_info;
+ DR_RATE_INFO rate_info;
+ DR_ORIENT_INFO orient_info;
+ NAVI_MATCHING_STATUS status;
+} NAVI_MATCHING_DATA;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+DR_RET_API DeadReckoningLibraryInit(void);
+DR_RET_API SetGpsData(Struct_GpsData *st_gps_data);
+DR_RET_API CalculateDeadReckoningData(Struct_SensData *st_sensor_data,
+ Struct_DR_DATA *st_dr_data, DR_CALC_INFO *dr_calc_data);
+DR_RET_API SetMatchingData(NAVI_MATCHING_DATA *st_matching_data);
+
+DR_RET_API ClearBackupData(void); /* Clear DR backup data */
+/* BOOL Problem Avoidance */
+DR_RET_API GetLocationLogSetting(int *log_sw, unsigned char *severity); /* Location log output ON/OFF acquisition */
+DR_RET_API SetLocationLogStatus(int log_sw, unsigned char severity); /* Location log output ON/OFF setting */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_API_H_
diff --git a/vehicleservice/positioning/client/include/Dead_Reckoning_Local_Api.h b/vehicleservice/positioning/client/include/Dead_Reckoning_Local_Api.h
new file mode 100755
index 0000000..c513e9b
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Dead_Reckoning_Local_Api.h
@@ -0,0 +1,147 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_LOCAL_API_H_
+#define POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_LOCAL_API_H_
+/****************************************************************************
+ * File name :Dead_Reckoning_Local_Api.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "Sensor_Common_API.h"
+#include "SensorLocation_API.h"
+#include "SensorMotion_API.h"
+#include "DR_API.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+
+/*----------------------------------------------------------------------*
+ * DEADRECKONING_RET_API define *
+ *----------------------------------------------------------------------*/
+/* Normal system */
+#define DEAD_RECKONING_RET_NORMAL 0 /* Normal completion */
+/* Abnormal system */
+#define DEADRECKONING_RET_ERROR_PID (-1) /* Thread ID error */
+#define DEADRECKONING_RET_ERROR_DID (-2) /* Unregistered DID */
+#define DEADRECKONING_RET_ERROR_PARAM (-4) /* Parameter error */
+#define DEADRECKONING_RET_ERROR_BUFFULL (-5) /* FULL of registered numbers */
+#define DEADRECKONING_RET_ERROR_CREATE_EVENT (-6) /* Event generation failure */
+#define DEADRECKONING_RET_ERROR_OUTOF_MEMORY (-8) /* Shared memory allocation failed */
+#define DEADRECKONING_RET_ERROR_SIZE (-9) /* Storage destination size error */
+#define DEADRECKONING_RET_ERROR_MIN (-10)
+
+/*----------------------------------------------------------------------*
+ * DEADRECKONING delivery registry APIs *
+ *----------------------------------------------------------------------*/
+/* Delivery control */
+#define DEADRECKONING_DELIVERY_REGIST 0x01 /* Delivery registration */
+
+/* Delivery timing */
+#define DEADRECKONING_DELIVERY_TIMING_UPDATE 0x01 /* Updating */
+
+/*----------------------------------------------------------------------*
+ * Command ID *
+ *----------------------------------------------------------------------*/
+/* Vehicle Sensor -> Vehicle Sensor(DR) */
+#define CID_DEAD_RECKONING_DELIVERY_ENTRY 0x0310 /* DR Transmission Registration Signal Notification */
+
+/* Vehicle Sensor -> Vehicle Sensor(DR) */
+#define CID_DEAD_RECKONING_SENS_DATA 0x0311 /* DR data signal notification */
+#define CID_DEAD_RECKONING_GPS_DATA 0x0312 /* DR data signal notification */
+#define CID_DEAD_RECKONING_SENS_FST_DATA 0x0313 /* DR data signal notification */
+
+/* Message Data Size(byte) */
+#define DEADRECKONING_MSGBUF_DSIZE 512 /* Message body MAX */
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+/* Semaphore name(MAX 32Byte) Synchronize with VehicleDebug_API_private.h */
+#define SENSOR_LOG_SETTING_SEMAPHO_NAME ("SEBSIR_GET_LOG_SETTING_SEMAPHO")
+
+/* Shared memory name(MAX 32Byte) Synchronize with VehicleDebug_API_private */
+#define LOG_SETTING_SHARE_MEMORY_NAME ("LOG_SETTING_SHARE_MEMORY")
+
+/************************************************************************
+* typedef Definition *
+************************************************************************/
+typedef RET_API DEAD_RECKONING_RET_API; /* API return value */
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/************************************************************************
+* TAG : DEADRECKONING_MSG_BUF
+* ABSTRACT : message buffer
+************************************************************************/
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int8 data[DEADRECKONING_MSGBUF_DSIZE]; /* Message data */
+} DEADRECKONING_MSG_BUF;
+
+/************************************************************************
+* TAG : DEADRECKONING_MSG_DELIVERY_ENTRY
+* ABSTRACT : Registration message delivery vehicle sensor information(->Vehicle sensor)
+************************************************************************/
+typedef struct {
+ DID did; /* ID data corresponding to the vehicle sensor information */
+ PNO pno; /* Shipping addressPNO */
+ u_int8 delivery_timing; /* Delivery opportunity */
+ u_int8 ctrl_flg; /* Delivery control */
+ EventID event_id; /* Event ID */
+} DEADRECKONING_MSG_DELIVERY_ENTRY_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ DEADRECKONING_MSG_DELIVERY_ENTRY_DAT data; /* Message data */
+} DEADRECKONING_MSG_DELIVERY_ENTRY;
+
+/************************************************************************
+* TAG : DEADRECKONING_MSG_GET_DR_DATA
+* ABSTRACT : Vehicle sensor information acquisition message(->Vehicle sensor)
+************************************************************************/
+typedef struct {
+ DID did; /* Data ID corresponding to vehicle sensor information */
+ PNO pno; /* Destination PNO */
+ u_int16 offset; /* Offset to shared memory storage area */
+ u_int16 size; /* Size of shared memory storage area */
+ u_int8 reserve[2];
+ EventID event_id; /* Event ID */
+} DEADRECKONING_MSG_GET_DR_DATA_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ DEADRECKONING_MSG_GET_DR_DATA_DAT data; /* Message data */
+} DEADRECKONING_MSG_GET_DR_DATA;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_LOCAL_API_H_
diff --git a/vehicleservice/positioning/client/include/Gps_API_private.h b/vehicleservice/positioning/client/include/Gps_API_private.h
new file mode 100755
index 0000000..7026ce9
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Gps_API_private.h
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * Gps_API_private.h
+ * @brief
+ * Definition for GPS Internal I/F Liblary
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_GPS_API_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_GPS_API_PRIVATE_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/*--- for message ---*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief message delivery GPS reset information
+ */
+typedef struct {
+ uint8_t mode; /**< Reset mode */
+ uint8_t reserve[3]; /**< reserve */
+ PNO snd_pno; /**< Caller PNO */
+ PNO res_pno; /**< Destination PNO */
+} POS_RESETINFO;
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_GPS_API_PRIVATE_H_
diff --git a/vehicleservice/positioning/client/include/INI_API.h b/vehicleservice/positioning/client/include/INI_API.h
new file mode 100755
index 0000000..f16a4c6
--- /dev/null
+++ b/vehicleservice/positioning/client/include/INI_API.h
@@ -0,0 +1,259 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+* File name : INI_API.h
+* System name : _CWORD107_
+* Subsystem name : Staged Start and Termination Framework
+* Title : Staged Start and End Framework API Header Files
+************************************************************************/
+
+#ifndef POSITIONING_CLIENT_INCLUDE_INI_API_H_
+#define POSITIONING_CLIENT_INCLUDE_INI_API_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*
+***** DEFINE *****
+*/
+
+#define INI_EXTMEM_DUM 0 /* Message buffer header extension member */
+
+/* Return value */
+#define INI_SUCCESS 0 /* Normal */
+#define INI_FALSE (-1) /* Fail */
+#define INI_ERRNOTRDY (-2) /* No destination process(Not wakeup) */
+
+/* Stage start completion notification ID related Note: ACC-OFF process completion notification is also used. */
+#define GINI_COMPID_INI 0x00000000 /* Initial value of completion notification ID */
+#define GINI_COMPID_MASK 0x80000000 /* Completion notification ID mask value(Startup completion or for event completion determination) */
+
+/* ID for Phase Start Event Completion Notification */
+
+#define INI_INITCOMP_BTCOM_PRT 0x80000001 /* BT Communication Protocol Thread Startup Complete */
+#define INI_INITCOMP_BTCOM_MNG 0x80000002 /* BT Communication Protocol Thread Startup Complete */
+#define INI_INITCOMP_BTCOM_RCV 0x80000004 /* BT Communication Protocol Thread Startup Complete */
+#define INI_INITCOMP_MC_UPCHK 0x80000008 /* To receive the confirmation notice of connection between microcomputers */
+
+/************************************************************************
+ ID for Phase Start Event Completion Notification (For VUP)
+ ************************************************************************/
+#define INI_FWRDCOMP__CWORD24_ 0x80000008 /* _CWORD24_ transmission completed */
+#define INI_FWRDCOMP_VUP 0x80000010 /* VUPLoader transmission completed */
+#define INI_INITCOMP_MFT 0x80000020 /* Module transfer thread start completion */
+#define INI_INITCOMP_UPCHK 0x80000040 /* Receive Start Type Confirmation Notification */
+
+/* ID for Phase ACC-OFF Event Completion Notification ID */
+
+/* Boot phase */
+/*************************************************************************
+ Note: Maintenance Precautions*
+ Initial only affects the addition and deletion of startup parameters.
+ For addition or deletion of shared memory creation,The primary of each process is also affected
+*************************************************************************/
+/* --->CHG */
+enum IniStep {
+ GINI_STEPFORK_INI = 0, /* Initial state */
+ GINI_STEPFORK_COMMEM, /* Shared Memory Generation */
+ GINI_STEPFORK_FIRST, /* First start */
+ GINI_STEPFORK_SECOND, /* 2nd start */
+ GINI_STEPFORK_THIRD, /* 3rd start */
+ GINI_STEPFORK_FOURTH, /* 4th start */
+ GINI_STEPFORK_BUPCHK, /* Backup Data Check/Initialization */
+ GINI_STEPFORK_FIFTH, /* 5th start */
+ GINI_STEPFORK_SIXTH, /* 6th start */
+ GINI_STEPFORK_SEVENTH, /* 7th start */
+ GINI_STEPFORK_EIGHTH, /* 8th start */
+ GINI_STEPFORK_NINTH, /* 9th start */
+ GINI_STEPFORK_TENTH, /* 10th start */
+ GINI_STEPFORK_ELEVENTH, /* 11th start */
+ GINI_STEPFORK_TWELFTH, /* 12th start */
+ GINI_STEPFORK_THIRTEENTH, /* 13th start */
+ GINI_STEPFORK_FOURTEENTH, /* 14th start */
+ GINI_STEPFORK_FIFTEENTH, /* 15th Start */
+ GINI_STEPFORK_SIXTEENTH, /* 16th start */
+ GINI_STEPFORK_SEVENTEENTH, /* 17th Start */
+ GINI_STEPFORK_EIGHTEENTH, /* 18th Start */
+ GINI_STEPFORK_MAX /* Total number of startup phases */
+};
+/* <--- CHG */
+
+/* ACC-OFF phase */
+enum AccOffStep {
+ GINI_ACCOFF_INI = 0, /* Early stage(Normal state) */
+ GINI_ACCOFF_FIRST, /* Stage 1 */
+ GINI_ACCOFF_SECOND, /* Step 2 */
+ GINI_ACCOFF_THIRD, /* Step 3 */
+ GINI_ACCOFF_FOURTH, /* Step 4 */
+ GINI_ACCOFF_FIFTH, /* Step 5 */
+ GINI_ACCOFF_MAX /* Total number of ACC-OFF steps */
+};
+
+/* Backup data check process type */
+enum IniDramBkup {
+ INI_BUPCHK_SRAM_INIT = 0, /* Initialization of SRAM */
+ INI_BUPCHK_SRAM_CHK, /* SRAM range-checking process */
+ INI_BUPCHK_USER_INIT, /* Initialization of personal information */
+ INI_BUPCHK_DRAM_INIT /* Initializing DRAM backups */
+};
+
+/* ---> */
+/*************************************************
+ Startup identification
+*************************************************/
+enum {
+ INI_CND_UNSET = 0, /* Startup identification value not set */
+ INI_CND_UNKNOWN, /* Startup identification unknown */
+ INI_CND_CLSTART, /* COLD START */
+ INI_CND_HTSTART, /* HOT START */
+ INI_CND_ERRRESET, /* Error Reset */
+ INI_CND_USERCL /* User-specified COLD */
+};
+
+/*************************************************
+ Startup Security State
+*************************************************/
+enum {
+ INI_ANTITHEFT_UNSET = 0, /* Not set condition */
+ INI_ANTITHEFT_UNLOCK, /* Unlocked status */
+ INI_ANTITHEFT_LOCK, /* Lock state */
+ INI_ANTITHEFT_INITIAL /* Initial state(Not used) */
+};
+
+/*************************************************
+ Version upgrade completion information
+*************************************************/
+enum {
+ INI_VUP_INFO_UNSET = 0, /* VUP information not set */
+ INI_VUP_INFO_NORMAL, /* VUP Information Normal(VUP not executed) */
+ INI_VUP_INFO_ERROR, /* VUP information error(VUP incomplete) */
+ INI_VUP_INFO_VUPFIN /* Completion of VUP information */
+};
+
+/*************************************************
+ +B Disconnect Information
+*************************************************/
+enum {
+ INI_BATTERY_INFO_UNSET = 0, /* +B Information not set */
+ INI_BATTERY_INFO_NORMAL, /* +B Information Normal(no disconnected) */
+ INI_BATTERY_INFO_DISCON /* +B Information with disconnected */
+};
+
+/*************************************************
+ User information initialization information
+*************************************************/
+enum {
+ INI_INITUSERDAT_UNSET = 0, /* User information not set */
+ INI_INITUSERDAT_ON, /* Personal Information Initialization Status Setting ON */
+ INI_INITUSERDAT_OFF /* Personal information initialization status setting OFF */
+};
+
+/*************************************************
+ DRAM back-up status at startup
+*************************************************/
+enum {
+ INI_DRAMBKUP_UNSET = 0, /* DRAM back-up status not set */
+ INI_DRAMBKUP_OK, /* DRAM back-up status OK */
+ INI_DRAMBKUP_NG /* DRAM backup status NG */
+};
+
+/****** STRUCT ******/
+/*************************************************
+ Startup system information
+*************************************************/
+typedef struct {
+ u_int8 boot_type; /* Startup identification */
+ u_int8 security_sts; /* Startup Security State */
+ u_int8 vup_info; /* Version upgrade completion information */
+ u_int8 battery_off_info; /* +B Disconnect Information */
+ u_int8 usrdat_init_info; /* User data initialization information */
+ u_int8 dram_bup_sts; /* DRAM back-up status */
+ u_int8 reserve[2]; /* Reserved */
+ u_int32 boot_time; /* Passed Time */
+} T_INI_BOOTINFO;
+
+/* <--- */
+
+/*
+***** STRUCTURE *****
+*/
+/******************************************************************************
+* TAG : T_PRIM_FORKCOMP
+* ABSTRACT : Stage-up completion notification structure
+* NOTE : Body portion of messages generated from API (Staged Start Completion Notification)
+******************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER head; /* Message buffer header */
+ u_int32 id; /* ID for start phase completion notification */
+} T_PRIM_FORKCOMP;
+
+/******************************************************************************
+* TAG : T_PRIM_ACCOFFSTART
+* ABSTRACT : Structures for ACC-OFF Process Instructions
+* NOTE : Body of messages generated from API(ACC-OFF process instructions)
+******************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER head; /* Message buffer header */
+ u_int32 id; /* ID for start phase completion notification */
+} T_PRIM_ACCOFFSTART;
+
+/******************************************************************************
+* TAG : T_PRIM_ACCOFFCOMP
+* ABSTRACT : Structures for notifying completion of ACC-OFF process
+* NOTE : Main body of messages generated from API(ACC-OFF process completion notification)
+******************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER head; /* Message buffer header */
+ u_int32 id; /* Identifier for notifying completion of ACC-OFF process */
+} T_PRIM_ACCOFFCOMP;
+
+/******************************************************************************
+* TAG : T_PRIM_INTERNAL_ACCOFFSTART
+* ABSTRACT : Structures for in-function ACC-OFF indication
+* NOTE : Body portion of messages generated from API (notification of completion of ACC-OFF process in function)
+******************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER head; /* Message buffer header */
+ u_int32 id; /* Identifier for notifying completion of ACC-OFF process */
+} T_PRIM_INTERNAL_ACCOFFSTART;
+
+/******************************************************************************
+* TAG : T_PRIM_INTERNAL_ACCOFFCOMP
+* ABSTRACT : Structures for notifying completion of ACC-OFF in functions
+* NOTE : Body portion of messages generated from NOTEAPI (notification of completion of ACC-OFF process in function)
+******************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER head; /* Message buffer header */
+ u_int32 id; /* Identifier for notifying completion of ACC-OFF process */
+} T_PRIM_INTERNAL_ACCOFFCOMP;
+
+/*
+***** PROTOTYPE *****
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int32 IniInternalAccOffComp(PNO pno , u_int32 id);
+void IniNotifyInit_CWORD69_Comp(void);
+void IniWaitInit_CWORD69_Comp(void);
+BOOL IniIsInit_CWORD69_Comp(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_INI_API_H_
diff --git a/vehicleservice/positioning/client/include/Naviinfo_API.h b/vehicleservice/positioning/client/include/Naviinfo_API.h
new file mode 100755
index 0000000..12caa84
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Naviinfo_API.h
@@ -0,0 +1,110 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+@file Naviinfo_API.h
+@detail Naviinfo_API external header file<BR>
+ Naviinfo_API External Public Header
+******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_NAVIINFO_API_H_
+#define POSITIONING_CLIENT_INCLUDE_NAVIINFO_API_H_
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "Sensor_Common_API.h"
+#include "Vehicle_API.h"
+#include "Sensor_API.h"
+#include <vehicle_service/POS_gps_API.h>
+
+/*****************************************************************************
+ * Define *
+ *****************************************************************************/
+/* Command ID Definition */
+#define CID_NAVIINFO_DELIVER (0x0205) /* Navigation information setting CID */
+#define CID_NAVIINFO_SPEED_DELIVER (0x0206) /* Vehicle speed setting CID */
+#define CID_NAVIINFO_SETGPSTIME (0x0207) /* GPS time delivery CID */
+
+/* Positioning Level/GPS Information Positioning Status Information Definition */
+#define NAVIINFO_DIAG_GPS_FIX_STS_NON (0) /* Not fix */
+#define NAVIINFO_DIAG_GPS_FIX_STS_2D (1) /* 2D positioning */
+#define NAVIINFO_DIAG_GPS_FIX_STS_3D (2) /* 3D positioning */
+
+/* Reception status definition */
+#define NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE (0) /* Not used */
+#define NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING (1) /* Searching */
+#define NAVIINFO_DIAG_GPS_RCV_STS_TRACHING (2) /* Tracking in progress */
+#define NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX (3) /* Positioning not used */
+#define NAVIINFO_DIAG_GPS_RCV_STS_USEFIX (4) /* Positioning use */
+
+/* Date and Time Status Definition */
+#define NAVIINFO_NAVI_GPS_TD_STS_NOTFIX (0)
+/* Time not calibrated after receiver reset */
+#define NAVIINFO_NAVI_GPS_TD_STS_RTCBACKUP (1)
+/* Time output by RTC backup(Time Calibration Result)*/
+#define NAVIINFO_NAVI_GPS_TD_STS_FIX (2) /* Time calibration completed */
+
+/* ++ Porting from PastModel002 enabled APIs */
+#define CID_VEHICLEIF_GET_VEHICLE_DATA 0x0102 /* Vehicle sensor information acquisition CID */
+#define CID_VEHICLEIF_COMM_WATCH 0x0103 /* Vehicle Sensor Information Disruption Monitoring CID */
+#define CID_SENSORIF__CWORD82__REQUEST 0x0800 /* Vehicle sensor information setting CID */
+
+#define VEHICLE_RET_ERROR_OUTOF_MEMORY (-8) /* Shared memory allocation failure */
+#define VEHICLE_RET_ERROR_INVALID (-10) /* CANID undetermined */
+
+/* -- Porting from PastModel002 enabled APIs */
+
+/*****************************************************************************
+ * Typedef *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Struct *
+ *****************************************************************************/
+/*****************************************************************************
+ * TAG : NAVIINFO_DELIVER_MSG
+ * ABSTRACT : Navigation information delivery message structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ NAVIINFO_ALL dat; /* Message data section */
+} NAVIINFO_DELIVER_MSG;
+
+/*****************************************************************************
+ * TAG : NAVIINFO_SPEED_DELIVER_MSG
+ * ABSTRACT : Navigation Information (Vehicle Speed) Delivery Message Structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int16 navi_speed; /* Vehicle speed information */
+ u_int8 reserve[2]; /* reserve */
+} NAVIINFO_SPEED_DELIVER_MSG;
+
+/*****************************************************************************
+* Function prototype *
+*****************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int32 VehicleSetVehicleData(PNO pid, VEHICLE_MSG_SEND_DAT *p_data);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_NAVIINFO_API_H_
diff --git a/vehicleservice/positioning/client/include/POS_common_private.h b/vehicleservice/positioning/client/include/POS_common_private.h
new file mode 100755
index 0000000..4dd98a2
--- /dev/null
+++ b/vehicleservice/positioning/client/include/POS_common_private.h
@@ -0,0 +1,62 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * POS_common_private.h
+ * @brief
+ * Definition for Common Internal I/F Liblary
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_POS_COMMON_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_POS_COMMON_PRIVATE_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/*--- for message ---*/
+/*
+ * Maximum receive message size
+ * - Set the value based on the message receiving buffer size of the local thread
+ */
+#define MAX_MSG_BUF_SIZE (4096)
+
+/* command ID */
+#define CID_POSIF_SET_DATA 0x0790 /* set data command ID */
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_POS_COMMON_PRIVATE_H_
diff --git a/vehicleservice/positioning/client/include/POS_private.h b/vehicleservice/positioning/client/include/POS_private.h
new file mode 100755
index 0000000..9f02202
--- /dev/null
+++ b/vehicleservice/positioning/client/include/POS_private.h
@@ -0,0 +1,981 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * POS_private.h
+ * @brief
+ * Inner functions of Positoning API
+ *
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_POS_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_POS_PRIVATE_H_
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_define.h>
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+#include "Naviinfo_API.h"
+#include "POS_common_private.h"
+#include <asm/unistd.h>
+#include <other_service/VP_GetEnv.h>
+#include <other_service/env_vehicleparameterlibrary.h>
+#include "CommonDefine.h"
+/*---------------------------------------------------------------------------------*
+ * Function Prototype *
+ *---------------------------------------------------------------------------------*/
+/* Shared Library Value Area Check Function */
+inline UNIT_TYPE GetEnvSupportInfo(void);
+inline BOOL ChkUnitType(UNIT_TYPE type);
+inline RET_API MunMapDeviceIo(HANDLE dev, uint32_t map_size);
+inline RET_API MilliSecSleep(uint32_t mill_time);
+inline POS_RET_API PosChkParam8(int8_t data, int8_t min, int8_t max, const char* fn, int32_t line);
+inline POS_RET_API PosChkParam16(int16_t data, int16_t min, int16_t max, const char* fn, int32_t line);
+inline POS_RET_API PosChkParam32(int32_t data, int32_t min, int32_t max, const char* fn, int32_t line);
+inline POS_RET_API PosChkParamU8(uint8_t data, uint8_t min, uint8_t max, const char* fn, int32_t line);
+inline POS_RET_API PosChkParamU16(uint16_t data, uint16_t min, uint16_t max, const char* fn, int32_t line);
+inline POS_RET_API PosChkParamU32(uint32_t data, uint32_t min, uint32_t max, const char* fn, int32_t line);
+
+/* Shared Intra-Library Core Functions */
+inline POS_RET_API PosSetProc(DID did, void *p_data, uint16_t size, uint8_t is_event);
+inline POS_RET_API PosGetProc(DID did, void *p_data, uint16_t dest_size);
+inline SENSOR_RET_API PosRegisterListenerProc(PCSTR notify_name,
+ DID did, u_int8 ctrl_flg, u_int8 delivery_timing);
+
+/* General Functions in Shared Libraries */
+inline EventID VehicleCreateEvent(PNO pno);
+inline RET_API VehicleDeleteEvent(EventID event_id);
+inline RET_API VehicleLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset);
+inline RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, uint16_t offset);
+inline RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data);
+inline BOOL VehicleGetResource(void);
+inline void VehicleReleaseResource(void);
+inline uint32_t GetTid(void);
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+#define POS_CHKPARAM8(data, min, max) PosChkParam8(data, min, max, __func__, __LINE__)
+#define POS_CHKPARAM16(data, min, max) PosChkParam16(data, min, max, __func__, __LINE__)
+#define POS_CHKPARAM32(data, min, max) PosChkParam32(data, min, max, __func__, __LINE__)
+#define POS_CHKPARAMU8(data, min, max) PosChkParamU8(data, min, max, __func__, __LINE__)
+#define POS_CHKPARAMU16(data, min, max) PosChkParamU16(data, min, max, __func__, __LINE__)
+#define POS_CHKPARAMU32(data, min, max) PosChkParamU32(data, min, max, __func__, __LINE__)
+#define POS_API_TIME_OUT_MS 5000 /* Timeout period(ms) */
+
+/*---------------------------------------------------------------------------------*
+ * Inline Functions *
+ *---------------------------------------------------------------------------------*/
+UNIT_TYPE GetEnvSupportInfo(void) {
+ UNIT_TYPE ret_type = UNIT_TYPE_GRADE1;
+
+ char env_area[VP_MAX_LENGTH];
+ char env_grade[VP_MAX_LENGTH];
+ char* p_env_grade = env_grade;
+ char* p_env_area = env_area;
+
+ /*
+ * Note.
+ * This feature branches processing depending on the area and grade type.
+ */
+
+ VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_AREA, p_env_area);
+
+ if (0 == strcmp(p_env_area, "AREA1")) {
+ ret_type = UNIT_TYPE_GRADE2;
+ } else if (0 == strcmp(p_env_area, "AREA2")) {
+ memset(&env_grade, 0x00, sizeof(env_grade));
+ VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_GRADE, p_env_grade);
+ if (0 == strcmp(p_env_grade, "_CWORD95_") ||
+ 0 == strcmp(p_env_grade, "_CWORD101_") ||
+ 0 == strcmp(p_env_grade, "_CWORD61_")) {
+ ret_type = UNIT_TYPE_GRADE2;
+ }
+ } else {
+ // NOP
+ }
+
+ return ret_type;
+}
+
+BOOL ChkUnitType(UNIT_TYPE type) {
+ UNIT_TYPE type_temp;
+ BOOL ret;
+
+ type_temp = GetEnvSupportInfo();
+ if ((type_temp & type) != 0) {
+ ret = TRUE;
+ } else {
+ ret = FALSE;
+ }
+
+ return ret;
+}
+
+RET_API MunMapDeviceIo(HANDLE dev, uint32_t map_size) {
+ return RET_NORMAL;
+}
+
+RET_API MilliSecSleep(uint32_t mill_time) {
+ switch (mill_time) {
+ case 0:
+ {
+ /* Discard the time slice */
+ sched_yield();
+ break;
+ }
+ case INFINITE:
+ {
+ /* Abort processing indefinitely */
+ while (1) {
+ sleep(INFINITE);
+ }
+ }
+ default:
+ /* Sleep for Specified Time */
+ usleep(mill_time * 1000);
+ break;
+ }
+
+ return RET_NORMAL;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(int8)
+ *
+ * @param[in] date int8_t Object data
+ * @param[in] min int8_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max int8_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParam8(int8_t data, int8_t min, int8_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%d[%d, %d]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(int16)
+ *
+ * @param[in] date int16_t Object data
+ * @param[in] min int16_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max int16_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParam16(int16_t data, int16_t min, int16_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%d[%d, %d]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(int32)
+ *
+ * @param[in] date int32_t Object data
+ * @param[in] min int32_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max int32_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParam32(int32_t data, int32_t min, int32_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%d[%d, %d]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(unsigned int8)
+ *
+ * @param[in] date uint8_t Object data
+ * @param[in] min uint8_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max uint8_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParamU8(uint8_t data, uint8_t min, uint8_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%u[%u, %u]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(unsigned int16)
+ *
+ * @param[in] date uint16_t Object data
+ * @param[in] min uint16_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max uint16_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParamU16(uint16_t data, uint16_t min, uint16_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%u[%u, %u]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(unsigned int32)
+ *
+ * @param[in] date uint32_t Object data
+ * @param[in] min uint32_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max uint32_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParamU32(uint32_t data, uint32_t min, uint32_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%u[%u, %u]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data setting process(Internal processing)
+ *
+ * Set the specified information
+ *
+ * @param[in] did DID - Data ID
+ * @param[in] p_data void* - Configuration data
+ * @param[in] size uint16_t - Setting data size
+ * @param[in] is_event uint8_t - Event wait status(TRUE/FALSE)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_INNER Internal error
+ */
+inline POS_RET_API PosSetProc(DID did, void *p_data, uint16_t size, uint8_t is_event) {
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ RET_API ret_api = RET_NORMAL; /* API return value */
+ POS_MSGINFO snd_msg; /* Message */
+ EventID event_id; /* Event ID */
+ int32_t event_val; /* Event value */
+ PNO pno; /* Calling thread PNO */
+ uint32_t pid; /* Process ID */
+ uint32_t tid; /* Thread ID */
+ char name[128];
+
+ /* Data size check */
+ if (POS_MSG_INFO_DSIZE < size) {
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+ /* Message data */
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Initialization of areas that do not contain values */
+ snd_msg.pno = 0;
+ snd_msg.rcv_flag = 0;
+ snd_msg.reserve = 0;
+
+ snd_msg.did = did;
+ snd_msg.size = size;
+ memcpy(snd_msg.data, p_data, size);
+
+ if (TRUE == is_event) {
+ /* After requesting data setting,Wait for the setting completion(Event Wait) */
+
+ /* Event Generation */
+ pid = static_cast<uint32_t>(getpid());
+ tid = GetTid();
+
+ snprintf(name, sizeof(name), "PS_p%u_t%u", pid, tid);
+ pno = _pb_CnvName2Pno(name);
+ event_id = VehicleCreateEvent(pno);
+
+ /* Set the source Pno of message data */
+ snd_msg.pno = pno;
+
+ if (0 != event_id) {
+ /* Successful event generation */
+
+ /* Send NAVI Sensor Data Setting to Vehicle Sensor */
+ ret_api = VehicleSndMsg(pno,
+ PNO_VEHICLE_SENSOR,
+ CID_POSIF_SET_DATA,
+
+ (uint16_t)sizeof(POS_MSGINFO) - POS_MSG_INFO_DSIZE + snd_msg.size, /* variable length */
+ (const void *)&snd_msg);
+
+ if (RET_NORMAL == ret_api) {
+ /* If the data setup process is successful,Wait for a completion event */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN,
+ VEHICLE_RET_NORMAL, &event_val, POS_API_TIME_OUT_MS);
+ if (RET_NORMAL != ret_api) {
+ /* Return an internal error */
+ ret = POS_RET_ERROR_INNER;
+ } else {
+ /* Return from Event Wait */
+ /* Set event value (processing result) as return value */
+ ret = (POS_RET_API)event_val;
+ }
+ } else {
+ /* Message transmission processing failed */
+ ret = POS_RET_ERROR_INNER;
+ }
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ ret = POS_RET_ERROR_INNER;
+ }
+ } else {
+ /* After setting data,Immediate termination */
+
+ /* Send NAVI Sensor Data Setting to Vehicle Sensor */
+ ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_POSIF_SET_DATA,
+ sizeof(POS_MSGINFO), reinterpret_cast<void*>(&snd_msg), 0);
+ if (ret_api != RET_NORMAL) {
+ /* Message transmission failure */
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+ } else {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Sensor information acquisition(Internal processing)
+ *
+ * @param[in] did DID - Data ID for vehicle information
+ * @param[in] p_data void* - Pointer representing the storage destination of vehicle sensor information
+ * @param[in] dest_size uint16_t - Storage destination size of vehicle sensor information(byte)
+ *
+ * @return 0 or more Stored data size(Include illegal)<br>
+ * POS_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * POS_RET_ERROR_OUTOF_MEMORY Shared memory allocation failed<br>
+ * POS_RET_ERROR_SIZE Storage destination size error<br>
+ * POS_RET_ERROR_DID Unregistered ID<br>
+ */
+inline POS_RET_API PosGetProc(DID did, void *p_data, uint16_t dest_size) {
+ POS_RET_API ret; /* Return value */
+ RET_API ret_api; /* System API return value */
+ EventID event_id; /* Event ID */
+ int32_t event_val; /* Event value */
+ void *share_top; /* Start address of shared memory */
+ uint32_t share_size; /* Size of shared memory area */
+ uint16_t offset; /* Offset to free shared memory area */
+ VEHICLE_SHARE_BLOCK_DAT *share_dat; /* Address of free shared memory area */
+ VEHICLE_MSG_GET_VEHICLE_DATA_DAT data; /* Message data */
+ PNO pno; /* Calling thread PNO */
+ uint32_t pid; /* Process ID */
+ uint32_t tid; /* Thread ID */
+ char name[128];
+
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+ /* Initialization */
+ event_id = 0;
+ event_val = 0;
+ memset(reinterpret_cast<void *>(&data), 0, sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT));
+
+ /* Event Generation */
+ pid = static_cast<uint32_t>(getpid());
+ tid = GetTid();
+
+ snprintf(name, sizeof(name), "PG_p%u_t%u", pid, tid);
+ pno = _pb_CnvName2Pno(name);
+ event_id = VehicleCreateEvent(pno);
+
+ if (0 != event_id) {
+ /* Successful event generation */
+
+ /* Allocate shared memory */
+ ret_api = VehicleLinkShareData(reinterpret_cast<void **>(&share_top), &share_size, &offset);
+ if (RET_NORMAL != ret_api) {
+ /* Failed to allocate shared memory */
+ ret = POS_RET_ERROR_OUTOF_MEMORY;
+ } else { /* When the shared memory is allocated successfully */
+ /* Calculate start address of free shared memory area */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top)
+ + offset);
+
+ /* Send vehicle sensor information acquisition message */
+ data.did = did;
+ data.pno = pno;
+ data.offset = offset;
+ data.size = VEHICLE_SHARE_BLOCK_DSIZE;
+
+ /* Messaging */
+ ret_api = VehicleSndMsg(pno,
+ PNO_VEHICLE_SENSOR,
+ CID_VEHICLEIF_GET_VEHICLE_DATA,
+ sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT), (const void *)&data);
+
+ /* Message transmission processing is successful */
+ if (RET_NORMAL == ret_api) {
+ /* Wait for completion event from vehicle sensor thread */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN,
+ VEHICLE_RET_NORMAL, &event_val, POS_API_TIME_OUT_MS);
+
+ if (RET_NORMAL != ret_api) {
+ /* Return an internal error */
+ ret = POS_RET_ERROR_INNER;
+ } else { /* Return from Event Wait */
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME),
+ &share_top, &share_size);
+
+ /* Calculate the address of the shared memory storage area. */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top)
+ + offset);
+
+ if (event_val < 0) {
+ /* Vehicle sensor information acquisition failure */
+ ret = (VEHICLE_RET_API)event_val;
+ } else if (RET_NORMAL != ret_api) {
+ /* Shared memory error */
+ ret = POS_RET_ERROR_OUTOF_MEMORY;
+ } else if (dest_size < share_dat->size) {
+ /* Storage destination size error */
+ ret = POS_RET_ERROR_SIZE;
+ } else { /* Vehicle sensor information acquisition success */
+ /* Copy from shared memory to user memory */
+ memcpy(p_data, share_dat->data, (size_t)share_dat->size);
+
+ /* Set Write Size to Return Value */
+ ret = static_cast<int32>(share_dat->size);
+ }
+ }
+ } else { /* Message transmission processing failed */
+ /* Return an event generation failure */
+ ret = POS_RET_ERROR_CREATE_EVENT;
+ }
+ /* Free shared memory */
+ (void)VehicleUnLinkShareData(reinterpret_cast<VEHICLE_SHARE*>(share_top), offset);
+ }
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ ret = POS_RET_ERROR_CREATE_EVENT;
+ }
+ } else {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Delivery registration process(Internal processing)
+ *
+ * @param[in] notify_name Destination thread name
+ * @param[in] did Pointer to an array of data IDs for vehicle information
+ * @param[in] ctrl_flg Delivery control<br>
+ * Delivery registration: SENSOR_DELIVERY_REGIST<br>
+ * Delivery stop: SENSOR_DELIVERY_STOP (Note: Not mounted)<br>
+ * Resume delivery: SENSOR_DELIVERY_RESTART (Note: Not mounted)
+ * @param[in] delivery_timing Delivery timing<br>
+ * Updating : SENSOR_DELIVERY_TIMING_UPDATE<br>
+ * Changing : SENSOR_DELIVERY_TIMING_CHANGE
+ *
+ * @return SENSOR_RET_NORMAL Successful registration<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_DID Unregistered ID<br>
+ * SENSOR_RET_ERROR_BUFFULL FULL of delivery registers<br>
+ * SENSOR_RET_ERROR_INNER Internal abnormality<br>
+ */
+inline SENSOR_RET_API PosRegisterListenerProc(PCSTR notify_name, DID did, u_int8 ctrl_flg, u_int8 delivery_timing) {
+ SENSOR_RET_API ret; /* Return value */
+ RET_API ret_api; /* System API return value */
+ EventID event_id; /* Event ID */
+ int32 event_val; /* Event value */
+ VEHICLE_MSG_DELIVERY_ENTRY_DAT data; /* Message data */
+ PNO pno; /* Converted internal PNO */
+
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+ /* Initialization */
+ event_id = 0;
+ event_val = 0;
+
+ /* Get PNO from Thread Name */
+ pno = _pb_CnvName2Pno(notify_name);
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(pno);
+
+ if (0 != event_id) {
+ /* Successful event generation */
+
+ /*--------------------------------------------------------------*
+ * Send Vehicle Sensor Information Delivery Registration Message *
+ *--------------------------------------------------------------*/
+ /* Create Message Data */
+ data.did = did;
+ data.pno = pno;
+ data.delivery_timing = delivery_timing;
+ data.ctrl_flg = ctrl_flg;
+ data.event_id = event_id;
+
+ /* Messaging */
+ ret_api = VehicleSndMsg(pno,
+ PNO_VEHICLE_SENSOR,
+ CID_VEHICLEIF_DELIVERY_ENTRY,
+ (uint16_t)sizeof(VEHICLE_MSG_DELIVERY_ENTRY_DAT), (const void *)&data);
+
+ if (RET_NORMAL == ret_api) {
+ /* Message transmission processing is successful */
+ /* Wait for completion event from vehicle sensor thread */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN,
+ VEHICLE_RET_NORMAL, &event_val, POS_API_TIME_OUT_MS);
+ if (RET_NORMAL != ret_api) {
+ /* Return an internal error */
+ ret = SENSOR_RET_ERROR_INNER;
+ } else {
+ /* Return from Event Wait */
+ /* Set event value (processing result) as return value */
+ ret = (SENSOR_RET_API)event_val;
+ }
+ } else {
+ /* Message transmission processing failed */
+ /* Return an internal error */
+ ret = SENSOR_RET_ERROR_INNER;
+ }
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ ret = SENSOR_RET_ERROR_CREATE_EVENT;
+ }
+ } else {
+ /* Insufficient resource */
+ ret = SENSOR_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : VehicleCreateEvent
+ * ABSTRACT : Event creation process
+ * FUNCTION : Generate an event
+ * ARGUMENT : pno : Thread ID
+ * NOTE :
+ * RETURN : Non-zero : Event ID
+ * : Zero : Event generation failure
+ ******************************************************************************/
+inline EventID VehicleCreateEvent(PNO pno) {
+ EventID event_id; /* Event ID */
+ char event_name[32]; /* Event name character string buffer */
+ RET_API ret_api; /* System API return value */
+
+
+ /* Initialization of event name character string buffer */
+ memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name));
+ /* Event name creation */
+ snprintf(event_name, sizeof(event_name), "VEHICLE_%X", pno);
+
+ /* Event Generation */
+ event_id = _pb_CreateEvent(FALSE, 0, event_name);
+
+ if (0 != event_id) {
+ /* For successful event generation */
+
+ /* Initialize the event */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, VEHICLE_EVENT_VAL_INIT);
+ if (RET_NORMAL != ret_api) {
+ /* Event initialization failed */
+ /* Delete Event and Return Event Generation Failed */
+ ret_api = VehicleDeleteEvent(event_id);
+ event_id = 0;
+ }
+ }
+
+ return(event_id);
+}
+
+/*******************************************************************************
+ * MODULE : VehicleDeleteEvent
+ * ABSTRACT : Event deletion processing
+ * FUNCTION : Delete events
+ * ARGUMENT : event_id : Event ID of the event to delete
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_EV_NONE : Specified event does not exist
+ ******************************************************************************/
+inline RET_API VehicleDeleteEvent(EventID event_id) {
+ return(_pb_DeleteEvent(event_id));
+}
+
+/*******************************************************************************
+ * MODULE : VehicleLinkShareData
+ * ABSTRACT : Link to shared memory
+ * FUNCTION : Link to shared memory
+ * ARGUMENT : **share_top : Storage destination of shared memory top address
+ * : *share_size : Storage destination of shared memory area size
+ * : *offset : Offset storage destination to free shared memory area
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERROR : There is no shared memory area.
+ ******************************************************************************/
+inline RET_API VehicleLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset) {
+ RET_API ret_api; /* System API return value */
+ SemID sem_id; /* Semaphore ID */
+ VEHICLE_SHARE *share_top_tmp;
+ int32 i;
+
+ /* Initialization */
+ ret_api = RET_ERROR;
+
+ /* Create Semaphore */
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(VEHICLE_SEMAPHO_NAME));
+ if (0 != sem_id) {
+ /* Semaphore Lock */
+ ret_api = _pb_SemLock(sem_id);
+ if (RET_NORMAL == ret_api) {
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME), share_top, share_size);
+ if (RET_NORMAL == ret_api) {
+ /* By searching the free shared memory area,Offset is calculated if there is free space. */
+ share_top_tmp = reinterpret_cast<VEHICLE_SHARE *>(*share_top);
+
+ /* Because the first block of the shared memory area is the control area,Loop from i = 1 */
+ for (i = 1; i < VEHICLE_SHARE_BLOCK_NUM; i++) {
+ if (VEHICLE_SHARE_UNLOCK == share_top_tmp->mng.lock_info[i]) {
+ break;
+ }
+ }
+ if (i < VEHICLE_SHARE_BLOCK_NUM) {
+ /* Empty space */
+ /* Lock the block */
+ share_top_tmp->mng.lock_info[i] = VEHICLE_SHARE_LOCK;
+
+ /* Calculate the offset to the block */
+ *offset = static_cast<u_int16>(i * VEHICLE_SHARE_BLOCK_SIZE);
+
+ /* Normal completion */
+ ret_api = RET_NORMAL;
+ } else {
+ /* No free space */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Failed link to shared memory */
+ ret_api = RET_ERROR;
+ }
+ /* Semaphore unlock */
+ _pb_SemUnlock(sem_id);
+ } else {
+ /* Semaphore lock failed */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Semaphore creation failed */
+ ret_api = RET_ERROR;
+ }
+
+ return(ret_api);
+}
+
+/*******************************************************************************
+ * MODULE : VehicleUnLinkShareData
+ * ABSTRACT : Unlinking shared memory
+ * FUNCTION : Unlink shared memory
+ * ARGUMENT : *share_top : Start address of shared memory
+ * : offset : Offset to shared memory free area
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERROR : There is no shared memory area./semaphore error
+ ******************************************************************************/
+inline RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, uint16_t offset) {
+ RET_API ret_api; /* System API return value */
+ SemID sem_id; /* Semaphore ID */
+ int32 i;
+
+ /* Initialization */
+ ret_api = RET_ERROR;
+
+ /* Create Semaphore */
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(VEHICLE_SEMAPHO_NAME));
+ if (0 != sem_id) {
+ /* Semaphore Lock */
+ ret_api = _pb_SemLock(sem_id);
+ if (RET_NORMAL == ret_api) {
+ /* Unlock the block */
+ i = static_cast<int32>(offset) / VEHICLE_SHARE_BLOCK_SIZE;
+ share_top->mng.lock_info[i] = VEHICLE_SHARE_UNLOCK;
+
+ /* Semaphore unlock */
+ _pb_SemUnlock(sem_id);
+
+ /* Normal completion */
+ ret_api = RET_NORMAL;
+ } else {
+ /* Semaphore lock failed */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Semaphore creation failed */
+ ret_api = RET_ERROR;
+ }
+
+ return(ret_api);
+}
+
+/*******************************************************************************
+ * MODULE : VehicleSndMsg
+ * ABSTRACT : Message transmission processing
+ * FUNCTION : Send a message to the specified PNO
+ * ARGUMENT : pno_src : Source PNO
+ * : pno_dest : Destination PNO
+ * : cid : Command ID
+ * : msg_len : Message data body length
+ * : *msg_data : Pointer to message data
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERRNOTRDY : Destination process is not wakeup
+ * : RET_ERRMSGFULL : Message queue overflows
+ * : RET_ERRPARAM : Buffer size error
+ ******************************************************************************/
+inline RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data) {
+ VEHICLE_MSG_BUF msg_buf; /* message buffer */
+ T_APIMSG_MSGBUF_HEADER *msg_hdr; /* Pointer to the message header */
+ RET_API ret_api; /* Return value */
+ PCSTR thread_name; /* Destination thread name */
+
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "+ [pno_src = 0x%x, pno_dest = 0x%x]", pno_src, pno_dest);
+
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Initializing the header of the message buffer */
+ memset(reinterpret_cast<void *>(&msg_buf.hdr), 0, sizeof(T_APIMSG_MSGBUF_HEADER));
+
+ /* Get pointer to send buffer */
+ msg_hdr = reinterpret_cast<T_APIMSG_MSGBUF_HEADER *>(reinterpret_cast<void *>(&msg_buf));
+
+ /*--------------------------------------------------------------*
+ * Create message headers *
+ *--------------------------------------------------------------*/
+ msg_hdr->hdr.sndpno = pno_src; /* Source PNO */
+ msg_hdr->hdr.cid = cid; /* Command ID */
+ msg_hdr->hdr.msgbodysize = msg_len; /* Message data body length */
+
+ /*--------------------------------------------------------------*
+ * Create message data *
+ *--------------------------------------------------------------*/
+ if ((0 != msg_data) && (0 != msg_len)) {
+ /* Set the message data */
+ memcpy(reinterpret_cast<void *>(msg_buf.data), msg_data, (size_t)msg_len);
+ }
+ /*--------------------------------------------------------------*
+ * Send messages *
+ *--------------------------------------------------------------*/
+ /* Get Thread Name from PNO */
+ if (pno_dest <= SYS_PNO_MAX) {
+ thread_name = POS_THREAD_NAME;
+ } else {
+ thread_name = _pb_CnvPno2Name(pno_dest);
+ }
+
+ if ((pno_dest <= SYS_PNO_MAX) && (pno_src <= SYS_PNO_MAX)) {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "[LOG pno_dest = 0x%x]", pno_dest);
+
+ /* Internal Process Transmission and Reception Messages */
+ ret_api = _pb_SndMsg(pno_dest,
+ (uint16_t)(sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len),
+ reinterpret_cast<void *>(&msg_buf), 0);
+ } else {
+ /* External Process Transmission and Reception Messages */
+ ret_api = _pb_SndMsg_Ext(thread_name,
+ cid,
+ (uint16_t)(msg_len), /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ reinterpret_cast<void *>(&(msg_buf.data)), 0);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+
+ return(ret_api);
+}
+
+/**
+ * @brief
+ * Resource Acquisition Decision
+ *
+ * @param[in] none
+ *
+ * @return TRUE Normal<br>
+ * FALSE Abnormality(Insufficient resource)
+ */
+inline BOOL VehicleGetResource(void) {
+ BOOL ret[4] = {TRUE, TRUE, TRUE, TRUE};
+ uint8_t idx;
+
+ ret[1] = _pb_GetMsgResource();
+ ret[2] = _pb_GetMutexResource();
+ ret[3] = _pb_GetOtherResource();
+
+ for (idx = 1; idx < 4; idx++) {
+ if (ret[idx] == FALSE) {
+ ret[0] = FALSE;
+ }
+ }
+
+ return ret[0];
+}
+
+/**
+ * @brief
+ * Resource release
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+inline void VehicleReleaseResource(void) {
+ _pb_ReleaseMsgResource();
+ _pb_ReleaseMutexResource();
+ _pb_ReleaseOtherResource();
+
+ return;
+}
+
+inline uint32_t GetTid(void) {
+ return (uint32_t)syscall(__NR_gettid);
+}
+
+
+#endif // POSITIONING_CLIENT_INCLUDE_POS_PRIVATE_H_
diff --git a/vehicleservice/positioning/client/include/POS_sensor_private.h b/vehicleservice/positioning/client/include/POS_sensor_private.h
new file mode 100755
index 0000000..1e1497f
--- /dev/null
+++ b/vehicleservice/positioning/client/include/POS_sensor_private.h
@@ -0,0 +1,163 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_POS_SENSOR_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_POS_SENSOR_PRIVATE_H_
+/******************************************************************************
+ * file name :POS_sensor_private.h
+ * system name :Positioning
+ * sub system name :Positioning internal interface library
+ ******************************************************************************/
+
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/pos_message_header.h>
+#include <native_service/frameworkunified_types.h>
+/************************************************************************
+* definition *
+************************************************************************/
+/*----------------------------------------------------------------------*
+ * for message *
+ *----------------------------------------------------------------------*/
+/* command ID */
+#define CID_SENSOR_PKG_INFO 0x0700 /* vehicle sensor package notification ID */
+
+/*----------------------------------------------------------------------*
+ * definition for GPS response *
+ *----------------------------------------------------------------------*/
+#define GPS_BUFFERFUL 2 /* transmit buffer full(rejection) */
+#define GPS_INITIAL 3 /* initialization state(rejection) */
+#define GPS_CONNECTNG 4 /* connection error(rejection) */
+
+/*----------------------------------------------------------------------*
+ * definition clock status *
+ *----------------------------------------------------------------------*/
+#define CLOCK_VALID (1U)
+#define CLOCK_INVALID (0U)
+
+/*----------------------------------------------------------------------*
+ * Message Related Extensions *
+ *----------------------------------------------------------------------*/
+#define CID_SENSORIF_SET_GPSTIME 0x0701 /* GPS time information setting CID */
+
+/*----------------------------------------------------------------------*
+ * GPS version-related definitions *
+ *----------------------------------------------------------------------*/
+#define GPS__CWORD82__VERSION_LEN (7U) /* _CWORD82_ version data length */
+
+/************************************************************************
+* struct declaration *
+************************************************************************/
+/************************************************************************
+* TAG : SENSOR_MSG_DELIVERY_ENTRY
+* ABSTRACT : vehicle sensor delivery message (to vehicle sensor)
+************************************************************************/
+typedef struct {
+ PNO pno; /* destination process number */
+ u_int8 pkg_num; /* number of package data (1 - 16) */
+ u_int8 delivery_timing; /* delivery timing */
+ u_int8 ctrl_flg; /* delivery control flag */
+ u_int8 reserve[3];
+ EventID event_id; /* event ID */
+ DID did[SENSOR_PKG_DELIVERY_MAX]; /* data ID array */
+} SENSOR_MSG_DELIVERY_ENTRY_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* message header */
+ SENSOR_MSG_DELIVERY_ENTRY_DAT data; /* message body */
+} SENSOR_MSG_DELIVERY_ENTRY;
+
+/************************************************************************
+* TAG : SENSOR_MSG_GET_SENSOR_DATA
+* ABSTRACT : vehicle sensor getter message (to vehicle sensor)
+************************************************************************/
+typedef struct {
+ PNO pno; /* destination process number */
+ u_int8 pkg_num; /* number of package data (1 - 16) */
+ u_int8 reserve;
+ u_int16 offset; /* share memory offset */
+ u_int16 size; /* share memory allocation size */
+ EventID event_id; /* event ID */
+ DID did[SENSOR_PKG_DELIVERY_MAX]; /* data ID about vehicle sensor */
+} SENSOR_MSG_GET_SENSOR_DATA_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* message header */
+ SENSOR_MSG_GET_SENSOR_DATA_DAT data; /* message body */
+} SENSOR_MSG_GET_SENSOR_DATA;
+
+/************************************************************************
+* TAG : SENSOR_INTERNAL_MSG_BUF
+* ABSTRACT : message buffer
+************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* message header */
+ u_int8 data[SENSOR_MSGBUF_DSIZE]; /* message body */
+} SENSOR_INTERNAL_MSG_BUF;
+
+/********************************************************************************
+ * TAG :TG_GPSTIME
+ * ABSTRACT :GPS Absolute Time Structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct {
+ u_int16 year; /* Year information(4-digit year) */
+ u_int8 month; /* Month information */
+ u_int8 day; /* Day information */
+ u_int8 hour; /* Hour information */
+ u_int8 minute; /* Minute information */
+ u_int8 second; /* Second information */
+ u_int8 reserve; /* reserve */
+} TG_GPSTIME;
+
+/********************************************************************************
+ * TAG :TG_GPS_RTCBKUP_DATA
+ * ABSTRACT :RTC backup-related data structures
+ * NOTE :RTC-backup-related data stored in the SRAM alternate DRAM
+ ********************************************************************************/
+typedef struct {
+ u_int8 time_status; /* Time Status */
+ u_int8 reserve1[3]; /* Reserve 1 */
+ TG_GPSTIME gps_time; /* GPS Absolute Time */
+} TG_GPS_RTCBKUP_DATA; /* */
+
+/************************************************************************
+ * TAG : GPS_INTERRUPT
+ * ABSTRACT : GPS interrupt status
+ * NOTE :
+************************************************************************/
+typedef struct {
+ u_int8 _CWORD102__interrupt; /* from GPS to _CWORD102_ interrupt status */
+ u_int8 _CWORD56__interrupt; /* from GPS to _CWORD56_ interrupt status */
+} GPS_INTERRUPT;
+
+/********************************************************************************
+ * TAG :LOCALTIME
+ * ABSTRACT :LocalTime data structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct {
+ u_int8 status; /* status : valid or invalid */
+ u_int8 reserve[3]; /* reserve */
+ u_int16 year; /* year : 2000..2099 (FFFFh:invalid) */
+ u_int8 month; /* month : 1..12 (FFh:invalid) */
+ u_int8 day; /* date : 1..31 (FFh:invalid) */
+ u_int8 hour; /* hour : 0..23 (FFh:invalid) */
+ u_int8 min; /* minute : 0..59 (FFh:invalid) */
+ u_int8 sec; /* second : 0..59 (FFh:invalid) */
+ u_int8 reserve2; /* reserve */
+} LOCALTIME;
+
+#endif // POSITIONING_CLIENT_INCLUDE_POS_SENSOR_PRIVATE_H_
diff --git a/vehicleservice/positioning/client/include/SensorLocation_API.h b/vehicleservice/positioning/client/include/SensorLocation_API.h
new file mode 100755
index 0000000..ae7f20a
--- /dev/null
+++ b/vehicleservice/positioning/client/include/SensorLocation_API.h
@@ -0,0 +1,124 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+@file SensorLocation_API.h
+@detail SensorLocation_API external header file<BR>
+ SensorLocation_API External public header
+******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_H_
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Define *
+ *****************************************************************************/
+/* Command ID */
+#define CID_VEHICLE_SENSORLOCATION_LONLAT (0x0201)
+/* Vehicle sensor information notification CID (Latitude and longitude information)*/
+#define CID_VEHICLE_SENSORLOCATION_ALTITUDE (0x0202)
+/* Vehicle sensor information notification CID (Altitude Information) */
+
+/* SENSORLOCATION_RET_API definition */
+#define SENSORLOCATION_RET_NORMAL (0) /* Successful completion */
+#define SENSORLOCATION_RET_ERROR_PARAM (-1) /* Parameter error */
+#define SENSORLOCATION_RET_ERROR_BUFFULL (-2) /* Number of registered FULL */
+#define SENSORLOCATION_RET_ERROR_INNER (-3) /* Internal error */
+
+/* Delivery opportunity definition */
+#define SENSORLOCATION_DELIVERY_TIMING_CHANGE (0) /* Change */
+#define SENSORLOCATION_DELIVERY_TIMING_UPDATE (1) /* UpDate */
+
+/* Presence information definitions DR */
+#define SENSORLOCATION_EXISTDR_NODR (0) /* Without DR */
+#define SENSORLOCATION_EXISTDR_DR (1) /* There DR */
+
+/* DR state definition */
+#define SENSORLOCATION_DRSTATUS_INVALID (0) /* Invalid */
+#define SENSORLOCATION_DRSTATUS_GPS_NODR (1) /* Information use GPS, not yet implemented DR */
+#define SENSORLOCATION_DRSTATUS_NOGPS_DR (2) /* No information available GPS, DR implementation */
+#define SENSORLOCATION_DRSTATUS_GPS_DR (3) /* Information use GPS, DR implementation */
+
+/* LONLAT initial value definition */
+#define SENSORLOCATION_LATITUDE_INIT_VALUE 0x7FFFFFFFL /* initial value */
+#define SENSORLOCATION_LONGITUDE_INIT_VALUE 0x7FFFFFFFL /* initial value */
+
+/*****************************************************************************
+ * Typedef *
+ *****************************************************************************/
+typedef int32 SENSORLOCATION_RET_API;
+
+/*****************************************************************************
+ * Struct *
+ *****************************************************************************/
+/*****************************************************************************
+ * TAG : SENSORLOCATION_LONLATINFO_DAT
+ * ABSTRACT : Latitude and longitude information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int8 sensor_cnt; /* Sensor counter value */
+ u_int8 is_exist_dr; /* Presence or absence information DR */
+ u_int8 dr_status; /* DR state */
+ u_int8 reserve[3]; /* Reserve */
+ int32 longitude; /* Longitude */
+ int32 latitude; /* Latitude */
+} SENSORLOCATION_MSG_LONLATINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORLOCATION_ALTITUDEINFO_DAT
+ * ABSTRACT : Altitude information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int8 sensor_cnt; /* Sensor counter value */
+ u_int8 is_exist_dr; /* Presence or absence information DR */
+ u_int8 dr_status; /* DR state */
+ u_int8 reserve[3]; /* Reserve */
+ int32 altitude; /* Altitude(0.01m) */
+} SENSORLOCATION_MSG_ALTITUDEINFO_DAT;
+
+/*****************************************************************************
+ * TAG : LONLAT
+ * ABSTRACT : Latitude and Longitude data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ int32 latitude; /* Latitude */
+ int32 longitude; /* Longitude */
+} LONLAT;
+
+/*****************************************************************************
+* Function prototypes *
+*****************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern SENSORLOCATION_RET_API SensorLocationRegisterListenerLonLat(PNO pno, u_int8 delivery_timing);
+extern SENSORLOCATION_RET_API SensorLocationRegisterListenerAltitude(PNO pno, u_int8 delivery_timing);
+extern SENSORLOCATION_RET_API SensorLocationGetLonLat(SENSORLOCATION_MSG_LONLATINFO_DAT *dat);
+extern SENSORLOCATION_RET_API SensorLocationGetAltitude(SENSORLOCATION_MSG_ALTITUDEINFO_DAT *dat);
+extern SENSORLOCATION_RET_API SensorLocationGetLonLatOnShutdown(LONLAT *lonlat);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_H_
diff --git a/vehicleservice/positioning/client/include/SensorLocation_API_private.h b/vehicleservice/positioning/client/include/SensorLocation_API_private.h
new file mode 100755
index 0000000..d37d9eb
--- /dev/null
+++ b/vehicleservice/positioning/client/include/SensorLocation_API_private.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_PRIVATE_H_
+/******************************************************************************
+ * File name :SensorLocation_API_private.h
+ * System name :PastModel002
+ * Subsystem name :Vehicle I/F library
+ ******************************************************************************/
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define LONLAT_SEMAPHO_NAME ("LONLAT_SHARE_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define LONLAT_SHARE_NAME ("LONLAT_SHARE_MEMORY") /* Shared memory name(MAX 32Byte) */
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_PRIVATE_H_ */
diff --git a/vehicleservice/positioning/client/include/SensorMotion_API.h b/vehicleservice/positioning/client/include/SensorMotion_API.h
new file mode 100755
index 0000000..2db5511
--- /dev/null
+++ b/vehicleservice/positioning/client/include/SensorMotion_API.h
@@ -0,0 +1,178 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+@file SensorMotion_API.h
+@detail SensorMotion_API external header file<BR>
+ SensorMotion_API External public header
+******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSORMOTION_API_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSORMOTION_API_H_
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Define *
+ *****************************************************************************/
+/* Command ID */
+/* Vehicle sensor information notification CID (Rate information) */
+#define CID_VEHICLE_SENSORMOTION_SPEED (0x0203)
+/* Vehicle sensor information notification CID (Orientation information) */
+#define CID_VEHICLE_SENSORMOTION_HEADING (0x0204)
+
+/* Vehicle sensor information notification CID (GyroTrouble information) */
+#define CID_VEHICLE_SENSORMOTION_GYROTROUBLE (0x020A)
+/* Vehicle sensor information notification CID (GyroParameter information) */
+#define CID_VEHICLE_SENSORMOTION_GYROPARAMETER (0x020B)
+/* Vehicle sensor information notification CID (SpeedParameter information) */
+#define CID_VEHICLE_SENSORMOTION_SPEEDPULSEPARAMETER (0x020C)
+
+/* SENSORMOTION_RET_API definition */
+#define SENSORMOTION_RET_NORMAL (0) /* Successful completion */
+#define SENSORMOTION_RET_ERROR_PARAM (-1) /* Parameter error */
+#define SENSORMOTION_RET_ERROR_BUFFULL (-2) /* Number of registered FULL */
+#define SENSORMOTION_RET_ERROR_INNER (-3) /* Internal error */
+
+/* Delivery opportunity definition */
+#define SENSORMOTION_DELIVERY_TIMING_CHANGE (0) /* Change */
+#define SENSORMOTION_DELIVERY_TIMING_UPDATE (1) /* UpDate */
+
+/* Presence information definitions DR */
+#define SENSORMOTION_EXISTDR_NODR (0) /* Without DR */
+#define SENSORMOTION_EXISTDR_DR (1) /* There DR */
+
+/* DR state definition */
+#define SENSORMOTION_DRSTATUS_INVALID (0) /* Invalid */
+#define SENSORMOTION_DRSTATUS_GPS_NODR (1) /* Information use GPS, not yet implemented DR */
+#define SENSORMOTION_DRSTATUS_NOGPS_DR (2) /* No information available GPS, DR implementation */
+#define SENSORMOTION_DRSTATUS_GPS_DR (3) /* Information use GPS, DR implementation */
+
+/*----------------------------------------------------------------------*
+ * General Purpose Definition
+ *----------------------------------------------------------------------*/
+#define SENSORMOTION_NORMAL (0U)
+#define SENSORMOTION_ERROR (1U)
+#define SENSORMOTION_UNFIXED (2U)
+
+/*****************************************************************************
+ * Typedef *
+ *****************************************************************************/
+typedef int32 SENSORMOTION_RET_API;
+
+/*****************************************************************************
+ * Struct *
+ *****************************************************************************/
+/*****************************************************************************
+ * TAG : SENSORMOTION_SPEEDINFO_DAT
+ * ABSTRACT : Vehicle speed information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int8 sensor_cnt; /* Sensor counter value */
+ u_int8 is_exist_dr; /* Presence or absence information DR */
+ u_int8 dr_status; /* DR state */
+ u_int8 reserve; /* Reserve */
+ u_int16 speed; /* Speed(0.01m/sec) */
+} SENSORMOTION_MSG_SPEEDINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_HEADINGINFO_DAT
+ * ABSTRACT : Orientation information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int8 sensor_cnt; /* Sensor counter value */
+ u_int8 is_exist_dr; /* Presence or absence information DR */
+ u_int8 dr_status; /* DR state */
+ u_int8 reserve; /* Reserve */
+ u_int16 heading; /* Heading */
+} SENSORMOTION_MSG_HEADINGINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_GYROTROUBLEINFO_DAT
+ * ABSTRACT : GyroTrouble information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int8 gyro_trouble; /* Gyro Trouble Status */
+ u_int8 reserve; /* Reserve */
+} SENSORMOTION_MSG_GYROTROUBLEINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_GYROTROUBLEINFO
+ * ABSTRACT : Delivery of the message GyroTrouble information
+ * NOTE : Message structure(VehicleSens -> User)
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ SENSORMOTION_MSG_GYROTROUBLEINFO_DAT data; /* Delivery data (GyroTrouble) */
+} SENSORMOTION_MSG_GYROTROUBLEINFO;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_GYROPARAMETERINFO_DAT
+ * ABSTRACT : GyroParameter information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int16 gyro_offset; /* Gyro Offset */
+ u_int8 gyro_scale_factor; /* Gyro Scale Factor */
+ u_int8 gyro_scale_factor_level; /* Gyro Scale Factor Level */
+ u_int8 reserve[2]; /* Reserve */
+} SENSORMOTION_MSG_GYROPARAMETERINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_GYROPARAMETERINFO
+ * ABSTRACT : Delivery of the message GyroParameter information
+ * NOTE : Message structure(VehicleSens -> User)
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ SENSORMOTION_MSG_GYROPARAMETERINFO_DAT data; /* Delivery data (GyroParameter) */
+} SENSORMOTION_MSG_GYROPARAMETERINFO;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT
+ * ABSTRACT : SpeedPulseParameter information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int16 speed_pulse_scale_factor; /* Speed Pulse Scale Factor */
+ u_int8 speed_pulse_scale_factor_level; /* Speed Pulse Scale Factor Level */
+ u_int8 reserve[3]; /* Reserve */
+} SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO
+ * ABSTRACT : Delivery of the message SpeedPulseParameter information
+ * NOTE : Message structure(VehicleSens -> User)
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT data; /* Delivery data (SpeedPulseParameter) */
+} SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO;
+
+/*****************************************************************************
+ * Function prototypes *
+ *****************************************************************************/
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSORMOTION_API_H_
diff --git a/vehicleservice/positioning/client/include/Sensor_API.h b/vehicleservice/positioning/client/include/Sensor_API.h
new file mode 100755
index 0000000..b49b4ac
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Sensor_API.h
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSOR_API_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSOR_API_H_
+/******************************************************************************
+ * file name :Sensor_API.h
+ * system name :GPF
+ * sub system name :sensor interface library
+ ******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "Sensor_Common_API.h"
+#include <vehicle_service/POS_sensor_API.h>
+#include "POS_sensor_private.h"
+
+/*!
+ @brief GPS Rollover Based Week Number Structure
+*/
+typedef struct {
+ uint16_t wkn; /**< GPS rollover base week number */
+} SENSOR_WKNROLLOVER;
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSOR_API_H_
diff --git a/vehicleservice/positioning/client/include/Sensor_API_private.h b/vehicleservice/positioning/client/include/Sensor_API_private.h
new file mode 100755
index 0000000..c3b5f54
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Sensor_API_private.h
@@ -0,0 +1,174 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSOR_API_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSOR_API_PRIVATE_H_
+/******************************************************************************
+ * File name :Sensor_API_private.h
+ * System name :GPF
+ * Subsystem name Vehicle I/F library
+ ******************************************************************************/
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define SENSOR_PUBLIC_DID_NUM 31
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define SENSOR_SHARE_LOCK 0xFF /* Locking */
+#define SENSOR_SHARE_UNLOCK 0x00 /* Unlocking */
+
+#define SENSOR_SHARE_BLOCK_MNUM 1 /* Number of shared memory control blocks */
+#define SENSOR_SHARE_BLOCK_DNUM 10 /* Number of shared memory data blocks */
+/* Number of shared memory blocks */
+#define SENSOR_SHARE_BLOCK_NUM (SENSOR_SHARE_BLOCK_MNUM+SENSOR_SHARE_BLOCK_DNUM)
+
+#define SENSOR_SHARE_BLOCK_SIZE 512 /* Shared Memory Block Size(byte) */
+#define SENSOR_SHARE_HEAD_SIZE 40 /* Vehicle Sensor Information Header( (4)+1+3+16*2) */
+/* Shared Memory Data Size */
+#define SENSOR_SHARE_BLOCK_DSIZE (SENSOR_SHARE_BLOCK_SIZE - SENSOR_SHARE_HEAD_SIZE)
+/* Size of shared memory allocation area */
+#define SENSOR_SHARE_SIZE (SENSOR_SHARE_BLOCK_SIZE * SENSOR_SHARE_BLOCK_NUM)
+
+#define SENSOR_SEMAPHO_NAME ("SENSOR_SHARE_SEMAPHO") /* Semaphore name */
+#define GPS_INTERRUPT_SIGNAL_SEMAPHO_NAME ("GPS_INT_SIGNAL_SHARE_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+#define GYRO_CONNECT_STATUS_SEMAPHO_NAME ("GYRO_CONNECT_STTS_SHARE_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+#define EPHEMERIS_NUM_SEMAPHO_NAME ("EPHEMERIS_NUM_SHARE_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+#define LOCALTIME_SEMAPHO_NAME ("LOCALTIME_SHARE_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+
+/*----------------------------------------------------------------------*
+ * Event Related Extensions *
+ *----------------------------------------------------------------------*/
+#define SENSOR_EVENT_VAL_INIT (SENSOR_RET_ERROR_MIN - 1) /* Event initial value */
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define SENSOR_SHARE_NAME ("SENSOR_SHARE_MEMORY") /* Shared memory name */
+#define GPS_INTERRUPT_SIGNAL_SHARE_NAME ("GPS_INT_SIGNAL_SHARE_MEMORY") /* Shared memory name(MAX 32Byte) */
+#define GYRO_CONNECT_STATUS_SHARE_NAME ("GYRO_CONNECT_STTS_SHARE_MEMORY") /* Shared memory name(MAX 32Byte) */
+#define EPHEMERIS_NUM_SHARE_NAME ("EPHEMERIS_NUM_SHARE_MEMORY") /* Shared memory name(MAX 32Byte) */
+#define LOCALTIME_SHARE_NAME ("LOCALTIME_SHARE_MEMORY") /* Shared memory name(MAX 32Byte) */
+
+/*-----------------------------------------------------------------------------
+ * GPS local CID define
+ *----------------------------------------------------------------------------*/
+#define CID_DEV_REQGPS MAKECID(CID_DEVHIGH, 0x00) /* GPS request */
+#define CID_DEV_REQRST MAKECID(CID_DEVHIGH, 0x01) /* GPS reset request */
+
+#define CID_GPS_SERIAL0 (CID)0x0100 /* GPS reset request function definition */
+/* GPS reset request CID */
+
+/*---------------------------------------------------------------------------
+ * GPS error log output
+ ---------------------------------------------------------------------------*/
+#define GPS_DBGMSG 0 /* Product Shipping Log Output(WPF_DEBUGMSG) */
+#define GPS_RTLMSG 1 /* Development test log output(WPF_RETAILMSG) */
+
+/*----------------------------------------------------------------------*
+ * for message *
+ *----------------------------------------------------------------------*/
+#define CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT 0x0602 /* sensor extra package register command ID */
+
+/*----------------------------------------------------------------------*
+ * for JudgeDid *
+ *----------------------------------------------------------------------*/
+#define MODE_REGISTER_LISTENER_PKG_SENS_DATA 0 /* POS_RegisterListenerPkgSensData */
+#define MODE_REGISTER_LISTENER_SENSDATA 1 /* POS_RegisterListenerSensData */
+#define MODE_GET_SENSDATA 2 /* POS_GetSensData */
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/************************************************************************
+* TAG : SENSOR_SHARE_MNG
+* ABSTRACT : Shared memory management area
+************************************************************************/
+typedef struct {
+ uint8_t lock_info[SENSOR_SHARE_BLOCK_NUM]; /* Usages */
+ uint8_t reserve[501]; /* 512-11 */
+} SENSOR_SHARE_MNG;
+
+/************************************************************************
+* TAG : SENSOR_SHARE_BLOCK_DAT_DAT
+* ABSTRACT : Shared memory data area(Data section details)
+************************************************************************/
+typedef struct {
+ uint8_t pkg_num; /* Number of packages */
+ uint8_t reserve[3];
+ uint16_t offset[SENSOR_PKG_DELIVERY_MAX]; /* Offset value */
+ uint8_t data[SENSOR_SHARE_BLOCK_DSIZE]; /* Data portion */
+} SENSOR_SHARE_BLOCK_DAT_DAT;
+
+/************************************************************************
+* TAG : SENSOR_SHARE_BLOCK_DAT
+* ABSTRACT : Shared memory data area(One block)
+************************************************************************/
+typedef struct {
+ uint16_t size; /* Size of the data */
+ uint8_t reserve[2];
+ SENSOR_SHARE_BLOCK_DAT_DAT data; /* Data portion */
+} SENSOR_SHARE_BLOCK_DAT;
+
+/************************************************************************
+* TAG : SENSOR_SHARE_BLOCK_MNG
+* ABSTRACT : Areas of memory that are shared
+************************************************************************/
+typedef struct {
+ SENSOR_SHARE_MNG mng; /* Shared memory management information */
+ SENSOR_SHARE_BLOCK_DAT data[SENSOR_SHARE_BLOCK_DNUM]; /* Shared memory data portion */
+} SENSOR_SHARE;
+
+/**
+ * @brief Return code list structure
+ */
+typedef struct {
+/*
+ * Note.
+ * This feature needs to be defined according to the unit type.
+ */
+ BOOL GRADE2_ret; /**< Return code in GRADE2 */
+ BOOL GRADE1_ret; /**< Return code in GARDE1 */
+ DID did; /**< DID */
+} SENSOR_RET_PKG;
+
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+RET_API PosDeleteEvent(EventID event_id);
+RET_API SensorLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset);
+RET_API SensorUnLinkShareData(SENSOR_SHARE *share_top, uint16_t offset);
+
+EventID PosCreateEvent(PNO pno);
+void SensorSetShareData(void *share_top, uint16_t offset, const void *data_src, uint16_t size_src);
+RET_API PosSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data);
+
+BOOL SensorJudgeDid(DID did, uint8_t mode);
+
+/* Function macro */
+#define SENSOR_DID_JUDGE_REGLIS_PKG(did) SensorJudgeDid(did, MODE_REGISTER_LISTENER_PKG_SENS_DATA)
+#define SENSOR_DID_JUDGE_REGLIS(did) SensorJudgeDid(did, MODE_REGISTER_LISTENER_SENSDATA)
+#define SENSOR_DID_JUDGE_GET(did) SensorJudgeDid(did, MODE_GET_SENSDATA)
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSOR_API_PRIVATE_H_ */
diff --git a/vehicleservice/positioning/client/include/Sensor_Common_API.h b/vehicleservice/positioning/client/include/Sensor_Common_API.h
new file mode 100755
index 0000000..5631e83
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Sensor_Common_API.h
@@ -0,0 +1,193 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSOR_COMMON_API_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSOR_COMMON_API_H_
+/******************************************************************************
+ * File name :Sensor_Common_API.h
+ * System name :PastModel002
+ * Sub System name :Vehicle I/F Liblary,Sensor I/F Liblary
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include "CommonDefine.h"
+
+/************************************************************************
+ * Definition *
+ ************************************************************************/
+/*----------------------------------------------------------------------*
+ * ID data corresponding to the vehicle sensor information *
+ *----------------------------------------------------------------------*/
+
+/*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+
+/* VEHICLE__DID */
+
+/* ++ PastModel002 Support_UBX_Protocol_DID */
+#define VEHICLE_DID_GPS_UBLOX_NAV_POSLLH 0x80000060
+#define VEHICLE_DID_GPS_UBLOX_NAV_STATUS 0x80000061
+#define VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC 0x80000062
+#define VEHICLE_DID_GPS_UBLOX_NAV_VELNED 0x80000063
+#define VEHICLE_DID_GPS_UBLOX_NAV_DOP 0x80000064
+#define VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS 0x80000065
+#define VEHICLE_DID_GPS_UBLOX_NAV_SVINFO 0x80000066
+#define VEHICLE_DID_GPS_UBLOX_NAV_CLOCK 0x80000067
+#define VEHICLE_DID_GPS_UBLOX_MON_HW 0x80000068
+#define VEHICLE_DID_GPS_UBLOX_ACK_ACK 0x80000069
+#define VEHICLE_DID_GPS_UBLOX_ACK_NAK 0x8000006A
+#define VEHICLE_DID_GPS_UBLOX_CFG_RST 0x8000006B
+#define VEHICLE_DID_GPS_UBLOX_AID_INI 0x8000006C
+#define VEHICLE_DID_GPS_UBLOX_AID_EPH 0x8000006D
+#define VEHICLE_DID_GPS_UBLOX_CFG_MSG 0x8000006E
+#define VEHICLE_DID_GPS_UBLOX_CFG_NAVX5 0x8000006F
+/* -- PastModel002 Support_UBX_Protocol_DID */
+
+/* ++ used internally by the DR */
+#define VEHICLE_DID_GPS_COUNTER 0x8000001B
+#define VEHICLE_DID_GYRO_EXT 0x80000027
+
+#define VEHICLE_DID_DR_LONGITUDE 0x80000070
+#define VEHICLE_DID_DR_LATITUDE 0x80000071
+#define VEHICLE_DID_DR_ALTITUDE 0x80000072
+#define VEHICLE_DID_DR_SPEED 0x80000073
+#define VEHICLE_DID_DR_HEADING 0x80000074
+#define VEHICLE_DID_DR_SNS_COUNTER 0x80000075
+#define VEHICLE_DID_DR_GYRO_OFFSET 0x80000078
+#define VEHICLE_DID_DR_GYRO_SCALE_FACTOR 0x80000079
+#define VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL 0x8000007A
+#define VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR 0x8000007B
+#define VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL 0x8000007C
+
+/* -- used internally by the DR */
+
+/* ++ PastModel002 Support_DID */
+#define VEHICLE_DID_GYRO_TROUBLE 0x80000080
+#define VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL 0x80000081
+#define VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL 0x80000082
+#define VEHICLE_DID_GYRO_CONNECT_STATUS 0x80000083
+#define VEHICLE_DID_VALID_EPH_NUM 0x80000084
+/* -- PastModel002 Support_DID */
+
+/* ++ Not supported by UBX_Protocol */
+#define VEHICLE_DID_LOCATION 0x80000020
+#define VEHICLE_DID_GPS__CWORD82__NMEA POS_DID_GPS__CWORD82__NMEA
+#define VEHICLE_DID_GPS__CWORD82__SETINITIAL POS_DID_GPS__CWORD82__SETINITIAL
+#define VEHICLE_DID_GPS__CWORD82__SETRMODE 0x80000034
+#define VEHICLE_DID_GPS__CWORD82__SETRMODEEX POS_DID_GPS__CWORD82__SETRMODEEX
+#define VEHICLE_DID_GPS__CWORD82__SELSENT POS_DID_GPS__CWORD82__SELSENT
+#define VEHICLE_DID_GPS__CWORD82__SETSBAS 0x80000037
+#define VEHICLE_DID_GPS__CWORD82__SETCONF1 0x80000038
+#define VEHICLE_DID_GPS__CWORD82__SETCONF2 0x80000039
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GGA_INTERNAL 0xA050
+#define VEHICLE_DID_GPS__CWORD82__NMEA_DGGA_INTERNAL 0xA051
+#define VEHICLE_DID_GPS__CWORD82__NMEA_VTG_INTERNAL 0xA052
+#define VEHICLE_DID_GPS__CWORD82__NMEA_RMC_INTERNAL 0xA053
+#define VEHICLE_DID_GPS__CWORD82__NMEA_DRMC_INTERNAL 0xA054
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GLL_INTERNAL 0xA055
+#define VEHICLE_DID_GPS__CWORD82__NMEA_DGLL_INTERNAL 0xA056
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GSA_INTERNAL 0xA057
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV1_INTERNAL 0xA058
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV2_INTERNAL 0xA059
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV3_INTERNAL 0xA060
+#define VEHICLE_DID_GPS__CWORD82__NMEA_PJRDC_GP_3_INTERNAL 0xA061
+#define VEHICLE_DID_LOCATION_LONLAT 0x80000095
+#define VEHICLE_DID_LOCATION_ALTITUDE 0x80000096
+#define VEHICLE_DID_MOTION_SPEED 0x80000062
+#define VEHICLE_DID_MOTION_HEADING 0x80000097
+#define VEHICLE_DID_GPS_TIME 0x80000098
+#define VEHICLE_DID_NAVIINFO_DIAG_GPS 0x80000099
+#define VEHICLE_DID_GPSWEEKCOR_CNT 0x8000009A
+
+#define VEHICLE_DID_GPS_CUSTOMDATA_NAVI 0x800000A0
+#define VEHICLE_DID_LOCATION_LONLAT_NAVI 0x800000A1
+#define VEHICLE_DID_LOCATION_ALTITUDE_NAVI 0x800000A2
+#define VEHICLE_DID_MOTION_SPEED_NAVI 0x800000A3
+#define VEHICLE_DID_MOTION_HEADING_NAVI 0x800000A4
+#define VEHICLE_DID_SETTINGTIME 0x800000A5
+
+#define VEHICLE_DID_LOCATIONINFO_NMEA_NAVI 0x800000A6
+
+#define VEHICLE_DID_MOTION_SPEED_INTERNAL 0x800000B0
+
+#define VEHICLE_DID_GPS_TIME_RAW 0x800000B1U /* QAC 1281 */
+#define VEHICLE_DID_GPS_WKNROLLOVER 0x800000B2U /* QAC 1281 */
+
+#define VEHICLE_DID_SPEED_PULSE_VEHICLE (0x80000044UL)
+
+/* -- Not supported by UBX_Protocol */
+
+/*----------------------------------------------------------------------*
+ * Vehicle sensor data information *
+ *----------------------------------------------------------------------*/
+#define VEHICLE_SNS_BATTERY_SHORT 0x02 /* BATTERY SHORT */
+#define VEHICLE_SNS_THERMAL_SHUT_DOWN 0x04 /* THERMAL SHUT DOWN */
+#define VEHICLE_SNS_UNKNOWN 0x05 /* UNKNOWN */
+
+/* Missing information data */
+#define VEHICLE_SNS_BREAK 0x01 /* Data without continuity */
+#define VEHICLE_SNS_NORMAL 0x00 /* Continuity of data */
+
+/*-------------------------------------------------------------------------------
+ * Time Status Return Values
+ -------------------------------------------------------------------------------*/
+#define GPS_TIMESTS_OK (0x00U) /* Exact values from the satellites */
+/* Ignore->MISRA-C++ Rule 16-2-2 */
+#define GPS_TIMESTS_NOTUTC (0x01U) /* Time from satellite but UTC uncorrected */
+/* Ignore->MISRA-C++ Rule 16-2-2 */
+#define GPS_TIMESTS_RTC (0x02U) /* RTC time */
+/* Ignore->MISRA-C++ Rule 16-2-2 */
+#define GPS_TIMESTS_NG (0x03U) /* Anomaly Time */
+/* Ignore->MISRA-C++ Rule 16-2-2 */
+
+/*-------------------------------------------------------------------------------
+ * NMEA Receive Flag
+ -------------------------------------------------------------------------------*/
+#define VEHICLE_SNS__CWORD82__DRMC POS_SNS__CWORD82__DRMC
+#define VEHICLE_SNS__CWORD82__GSA POS_SNS__CWORD82__GSA
+#define VEHICLE_SNS__CWORD82__GSV_1 POS_SNS__CWORD82__GSV_1
+#define VEHICLE_SNS__CWORD82__GSV_2 POS_SNS__CWORD82__GSV_2
+#define VEHICLE_SNS__CWORD82__GSV_3 POS_SNS__CWORD82__GSV_3
+#define VEHICLE_SNS__CWORD82__PJRDC_GP_3 POS_SNS__CWORD82__PJRDC_GP_3
+#define VEHICLE_SNS__CWORD82__PJRDC_GP_4 (0x40U) /* Ignore->MISRA-C++ Rule 16-2-2 */
+
+/************************************************************************
+* enum Definition *
+*************************************************************************/
+
+/*-------------------------------------------------------------------------------
+ * _CWORD71_ UNIT type
+ -------------------------------------------------------------------------------*/
+typedef enum {
+ POS_TYPE_NONE = (0U), /* Undefined */
+ POS_TYPE_GRADE1, /* GRADE1 (Integrated) */
+ POS_TYPE_GRADE2 /* GRADE2 (Binary type) */
+} POS_TYPE;
+
+/************************************************************************
+* typedef Definition *
+*************************************************************************/
+
+typedef u_int32 DID; /* DataID */
+
+/************************************************************************
+* struct Definition *
+*************************************************************************/
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSOR_COMMON_API_H_
diff --git a/vehicleservice/positioning/client/include/VehicleDebug_API.h b/vehicleservice/positioning/client/include/VehicleDebug_API.h
new file mode 100755
index 0000000..e0c9ef2
--- /dev/null
+++ b/vehicleservice/positioning/client/include/VehicleDebug_API.h
@@ -0,0 +1,110 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+ * File name : VehicleDebug_API.h
+ * System name : PastModel002
+ * Sub System name : VehicleDebug_API library
+ ******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLEDEBUG_API_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLEDEBUG_API_H_
+
+/************************************************************************
+ * Include *
+ ***********************************************************************/
+
+/************************************************************************
+* Definition *
+************************************************************************/
+/*----------------------------------------------------------------------*
+ * VEHICLEDEBUG_RET_API Definition *
+ *----------------------------------------------------------------------*/
+/* Normal */
+#define VEHICLEDEBUG_RET_NORMAL 0 /* Successful completion */
+
+/* Abnormal */
+#define VEHICLEDEBUG_RET_ERROR (-1) /* An error has occurred */
+#define VEHICLEDEBUG_RET_ERROR_PARAM (-2) /* Parameter error */
+
+/*----------------------------------------------------------------------*
+ * Message Definition *
+ *----------------------------------------------------------------------*/
+/* Command ID */
+#define CID_VEHICLEDEBUG_LOG_SET 0x020D
+#define CID_VEHICLEDEBUG_LOG_GET 0x020E
+
+/* Message Length */
+#define VEHICLEDEBUG_MSGBUF_DSIZE 36U
+
+/*----------------------------------------------------------------------*
+ * Log Kind Definition *
+ *----------------------------------------------------------------------*/
+#define LOG_KIND_NUM 32U
+
+/*----------------------------------------------------------------------*
+ * Log Mask Definition *
+ *----------------------------------------------------------------------*/
+#define LOG_MASK_LOCATION_LOG 0x00000001UL
+
+/*----------------------------------------------------------------------*
+ * Log Severity Definition *
+ *----------------------------------------------------------------------*/
+/* Unused */
+
+/************************************************************************
+* type Definition *
+************************************************************************/
+typedef RET_API VEHICLEDEBUG_RET_API; /* API return value */
+
+/************************************************************************
+* struct Definition *
+************************************************************************/
+/************************************************************************
+ * TAG : VEHICLEDEBUG_MSG_LOGINFO_DAT
+ * ABSTRACT : Log data structure
+ * NOTE :
+ ************************************************************************/
+typedef struct {
+ u_int32 log_sw; /* Kind of log */
+ u_int8 severity[LOG_KIND_NUM]; /* Output level(unused) */
+} VEHICLEDEBUG_MSG_LOGINFO_DAT;
+
+/*****************************************************************************
+ * TAG : VEHICLEDEBUG_MSG_BUF
+ * ABSTRACT : VehicleDebug_API message buffer structure
+ * NOTE : Message structure
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int8 data[VEHICLEDEBUG_MSGBUF_DSIZE]; /* Message data */
+} VEHICLEDEBUG_MSG_BUF;
+
+/************************************************************************
+ * Function prototypes *
+ ************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*[VehicleDebug_API Public API]*/
+VEHICLEDEBUG_RET_API SensorGetLogSetting(PNO pno, u_int32 *log_sw, u_int8 *severity);
+VEHICLEDEBUG_RET_API SensorSetLogStatus(PNO pno, u_int32 log_sw, u_int8 *severity);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLEDEBUG_API_H_
diff --git a/vehicleservice/positioning/client/include/Vehicle_API.h b/vehicleservice/positioning/client/include/Vehicle_API.h
new file mode 100755
index 0000000..78450c5
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Vehicle_API.h
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_API_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_API_H_
+/******************************************************************************
+ * File name :Vehicle_API.h
+ * System name :GPF
+ * Sub System name :Vehicle I/F Liblary
+ ******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_define.h>
+#include "Sensor_Common_API.h"
+
+/****************************************************************************
+* Definition *
+*****************************************************************************/
+/*--------------------------------------------------------------------------*
+ * VECHILE_RET_API Definition *
+ *--------------------------------------------------------------------------*/
+/* Normal system */
+#define VEHICLE_RET_NORMAL 0 /* Successful completion */
+
+/* Abnormal system */
+#define VEHICLE_RET_ERROR_DID (-2) /* NoneDID */
+#define VEHICLE_RET_ERROR_PARAM (-4) /* Parameter error */
+#define VEHICLE_RET_ERROR_BUFFULL (-5) /* registration number FULL */
+#define VEHICLE_RET_ERROR_CREATE_EVENT (-6) /* Failure event generation */
+#define VEHICLE_RET_ERROR_MIN POS_RET_ERROR_MIN
+
+/*----------------------------------------------------------------------*
+ * API-related registration information delivery vehicle sensor *
+ *----------------------------------------------------------------------*/
+/* Delivery control */
+#define VEHICLE_DELIVERY_REGIST 0x01 /* Shipping register */
+
+/* Delivery opportunity */
+#define VEHICLE_DELIVERY_TIMING_UPDATE 0x01 /* Update */
+#define VEHICLE_DELIVERY_TIMING_CHANGE 0x02 /* Change */
+
+/*----------------------------------------------------------------------*
+ * Message Definition *
+ *----------------------------------------------------------------------*/
+/* Command ID */
+
+/* Registration information delivery vehicle sensor CID */
+#define CID_VEHICLEIF_DELIVERY_ENTRY 0x0101
+
+/* Vehicle sensor information notification CID */
+#define CID_VEHICLESENS_VEHICLE_INFO 0x0200
+
+/* GPS time notification CID */
+#define CID_VEHICLESENS_VEHICLE_INFO_GPS_TIME 0x0201
+
+/************************************************************************
+* typedef Definition *
+************************************************************************/
+typedef RET_API VEHICLE_RET_API; /* API return value */
+
+/************************************************************************
+* struct Definition *
+************************************************************************/
+
+/************************************************************************
+* TAG : VEHICLE_MSG_VSINFO_DAT
+* ABSTRACT : message delivery vehicle sensor information
+************************************************************************/
+typedef struct {
+ DID did;
+ u_int16 size;
+ u_int8 rcv_flag;
+ u_int8 sensor_cnt;
+ u_int8 data[256];
+} VEHICLE_MSG_VSINFO_DAT;
+
+/* ++ GPS _CWORD82_ support */
+
+/************************************************************************
+* TAG : VEHICLE_MSG_SEND_DAT
+* ABSTRACT : Vehicle sensor information setting message(-> Vehicle sensor)
+************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ VEHICLE_MSG_SEND_DAT data; /* Message data */
+} VEHICLE_MSG_SEND;
+
+/* -- GPS _CWORD82_ support */
+
+/************************************************************************
+* Function prototypes *
+************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*[VEHICLE_API Public API]*/
+VEHICLE_RET_API VehicleInitialize(u_int32(*sighand)(void)); /* QAC 3001 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_API_H_
diff --git a/vehicleservice/positioning/client/include/Vehicle_API_Dummy.h b/vehicleservice/positioning/client/include/Vehicle_API_Dummy.h
new file mode 100755
index 0000000..b242ac6
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Vehicle_API_Dummy.h
@@ -0,0 +1,142 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_API_DUMMY_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_API_DUMMY_H_
+/******************************************************************************
+ * File name : Vehicle_API_Dummy.h
+ * System name : GPF
+ * Sub System name : Vehicle I/F Liblary
+ ******************************************************************************/
+
+#include "Sensor_Common_API.h"
+
+/****************************************************************************
+* Definition *
+*****************************************************************************/
+/*--------------------------------------------------------------------------*
+ * VECHILE_RET_API Definition *
+ *--------------------------------------------------------------------------*/
+/* Normal system */
+#define VEHICLE_RET_NORMAL 0 /* Successful completion */
+
+/* Abnormal system */
+#define VEHICLE_RET_ERROR_PID (-1) /* Abnormal thread ID */
+#define VEHICLE_RET_ERROR_DID (-2) /* NoneDID */
+#define VEHICLE_RET_ERROR_DID_DIS (-3) /* Non-ID data CANID */
+#define VEHICLE_RET_ERROR_PARAM (-4) /* Parameter error */
+#define VEHICLE_RET_ERROR_BUFFULL (-5) /* registration number FULL */
+#define VEHICLE_RET_ERROR_CREATE_EVENT (-6) /* Failure event generation */
+#define VEHICLE_RET_ERROR_TIMER (-7) /* Generation failure timer */
+#define VEHICLE_RET_ERROR_OUTOF_MEMORY (-8) /* Shared memory allocation failure */
+#define VEHICLE_RET_ERROR_SIZE (-9) /* Size error destination */
+#define VEHICLE_RET_ERROR_INVALID (-10) /* CANID undetermined */
+#define VEHICLE_RET_ERROR_MIN POS_RET_ERROR_MIN
+
+/*----------------------------------------------------------------------*
+ * API-related registration information delivery vehicle sensor *
+ *----------------------------------------------------------------------*/
+/* Delivery control */
+#define VEHICLE_DELIVERY_REGIST 0x01 /* Shipping register */
+
+/* Delivery opportunity */
+#define VEHICLE_DELIVERY_TIMING_UPDATE 0x01 /* Update */
+#define VEHICLE_DELIVERY_TIMING_CHANGE 0x02 /* Change */
+
+/*----------------------------------------------------------------------*
+ * Message Definition *
+ *----------------------------------------------------------------------*/
+/* Command ID */
+
+/* Registration information delivery vehicle sensor CID */
+#define CID_VEHICLEIF_DELIVERY_ENTRY 0x0101
+
+/* Vehicle sensor information notification CID */
+#define CID_VEHICLESENS_VEHICLE_INFO 0x0200
+
+#define CID_VEHICLEIF_GET_DR_DATA 0x0205
+
+/* The message body size data(byte) */
+#define VEHICLE_MSGBUF_DSIZE (SENSOR_MSG_VSINFO_DSIZE + 12)
+/* Header size of SENSOR_MSG_VSINFO_DSIZE + SENSOR_MSG_GPSDATA_DAT (12) */
+
+/************************************************************************
+* typedef Definition *
+************************************************************************/
+
+/************************************************************************
+* struct Definition *
+************************************************************************/
+
+/************************************************************************
+* TAG : VEHICLE_MSG_BUF
+* ABSTRACT : Message buffer
+************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int8 data[VEHICLE_MSGBUF_DSIZE]; /* Message data */
+} VEHICLE_MSG_BUF;
+
+/************************************************************************
+* TAG : VEHICLE_MSG_GET_VEHICLE_DATA
+* ABSTRACT : Vehicle sensor information acquisition message(-> Vehicle sensor)
+************************************************************************/
+typedef struct {
+ DID did; /* Data ID corresponding to vehicle sensor information */
+ PNO pno; /* Destination PNO */
+ u_int16 offset; /* Offset to shared memory storage area */
+ u_int16 size; /* Size of shared memory storage area */
+ u_int8 reserve[2];
+ EventID event_id; /* Event ID */
+} VEHICLE_MSG_GET_VEHICLE_DATA_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ VEHICLE_MSG_GET_VEHICLE_DATA_DAT data; /* Message data */
+} VEHICLE_MSG_GET_VEHICLE_DATA;
+
+/************************************************************************
+* TAG : VEHICLE_MSG_DELIVERY_ENTRY
+* ABSTRACT : Registration message delivery vehicle sensor information(->Vehicle sensor)
+************************************************************************/
+typedef struct {
+ DID did; /* ID data corresponding to the vehicle sensor information */
+ PNO pno; /* Shipping addressPNO */
+ u_int8 delivery_timing; /* Delivery opportunity */
+ u_int8 ctrl_flg; /* Delivery control */
+ EventID event_id; /* Event ID */
+} VEHICLE_MSG_DELIVERY_ENTRY_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ VEHICLE_MSG_DELIVERY_ENTRY_DAT data; /* Message data */
+} VEHICLE_MSG_DELIVERY_ENTRY;
+
+/************************************************************************
+* Function prototypes *
+************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*[VEHICLE_API Public API]*/
+
+int32 VehicleGetDrData(PNO pno, DID did, void *dest_data, u_int16 dest_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_API_DUMMY_H_
diff --git a/vehicleservice/positioning/client/include/Vehicle_API_private.h b/vehicleservice/positioning/client/include/Vehicle_API_private.h
new file mode 100755
index 0000000..ad92ddb
--- /dev/null
+++ b/vehicleservice/positioning/client/include/Vehicle_API_private.h
@@ -0,0 +1,129 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_
+/******************************************************************************
+ * File name :Vehicle_API_private.h
+ * System name :GPF
+ * Subsystem name :Vehicle I/F library
+ ******************************************************************************/
+#include <vehicle_service/POS_sensor_API.h>
+#include "Vehicle_API.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define VEHICLE_SHARE_LOCK 0xFF /* Locking */
+#define VEHICLE_SHARE_UNLOCK 0x00 /* Unlocking */
+
+#define VEHICLE_SHARE_BLOCK_MNUM 1 /* Number of shared memory control blocks */
+#define VEHICLE_SHARE_BLOCK_DNUM 10 /* Number of shared memory data blocks */
+/* Number of shared memory blocks */
+#define VEHICLE_SHARE_BLOCK_NUM (VEHICLE_SHARE_BLOCK_MNUM+VEHICLE_SHARE_BLOCK_DNUM)
+
+#define VEHICLE_SHARE_BLOCK_SIZE 512 /* Shared Memory Block Size(byte) */
+#define VEHICLE_SHARE_BLOCK_DSIZE SENSOR_MSG_VSINFO_DSIZE /* Shared Memory Data Size */
+/* Size of shared memory allocation area */
+#define VEHICLE_SHARE_SIZE (VEHICLE_SHARE_BLOCK_SIZE * VEHICLE_SHARE_BLOCK_NUM)
+
+#define VEHICLE_SEMAPHO_NAME ("VEHICLE_SHARE_SEMAPHO") /* Semaphore name */
+
+#define VEHICLE_INVALID 0 /* Disabled */
+#define VEHICLE_EFFECTIVE 1 /* Enabled */
+#define VEHICLE_BIT31 0x80000000
+
+/* ++ PastModel002 compliant_error compliant */
+/* Message Data Size(byte) */
+#define VEHICLE_VSINFO_DSIZE 504 /* Vehicle sensor information */
+/* -- PastModel002 compliant_error compliant */
+
+/*----------------------------------------------------------------------*
+ * Event Related Extensions *
+ *----------------------------------------------------------------------*/
+#define VEHICLE_EVENT_VAL_INIT (VEHICLE_RET_ERROR_MIN-1) /* Event initial value */
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define VEHICLE_SHARE_NAME ("POS_VEHICLE_SHARE_MEMORY") /* Shared memory name */
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/* ++ PastModel002 compliant_error compliant */
+
+/************************************************************************
+* TAG : VEHICLE_MSG_VSINFO_DAT
+* ABSTRACT : Vehicle sensor information notification message(-> User)
+************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ VEHICLE_MSG_VSINFO_DAT data; /* Message data */
+} VEHICLE_MSG_VSINFO;
+
+/* -- PastModel002 compliant_error compliant */
+
+/************************************************************************
+* TAG : VEHICLE_SHARE_MNG
+* ABSTRACT : Shared memory management area
+************************************************************************/
+typedef struct {
+ u_int8 lock_info[VEHICLE_SHARE_BLOCK_NUM]; /* Usages */
+ u_int8 reserve[501];
+} VEHICLE_SHARE_MNG;
+
+/************************************************************************
+* TAG : VEHICLE_SHARE_BLOCK_DAT
+* ABSTRACT : Shared memory data area(One block)
+************************************************************************/
+typedef struct {
+ u_int16 size; /* Size of the data */
+ u_int8 reserve[2];
+ u_int8 data[VEHICLE_SHARE_BLOCK_DSIZE]; /* Data */
+} VEHICLE_SHARE_BLOCK_DAT;
+
+/************************************************************************
+* TAG : VEHICLE_SHARE_BLOCK_MNG
+* ABSTRACT : Areas of memory that are shared
+************************************************************************/
+typedef struct {
+ VEHICLE_SHARE_MNG mng; /* Shared memory management information */
+ VEHICLE_SHARE_BLOCK_DAT data[VEHICLE_SHARE_BLOCK_DNUM]; /* Shared memory data portion */
+} VEHICLE_SHARE;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+RET_API VehicleDeleteEvent(EventID event_id);
+RET_API VehicleLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset);
+RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, u_int16 offset);
+EventID VehicleCreateEvent(PNO pno);
+void PosSetShareData(void *share_top, u_int16 offset, const void *data_src, u_int16 size_src);
+RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data);
+
+SENSOR_RET_API PosRegisterListenerProc(PCSTR notify_name, DID did, u_int8 ctrl_flg, u_int8 delivery_timing);
+
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_ */
diff --git a/vehicleservice/positioning/client/include/vehicle_service/POS_common_API.h b/vehicleservice/positioning/client/include/vehicle_service/POS_common_API.h
new file mode 100755
index 0000000..5ee3005
--- /dev/null
+++ b/vehicleservice/positioning/client/include/vehicle_service/POS_common_API.h
@@ -0,0 +1,1663 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_COMMON_API_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_COMMON_API_H_
+
+/**
+ * @file POS_common_API.h
+ * @brief API definition file for common function
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/POS_define.h>
+#include <gps_hal.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* State definitions can be used */
+#define SENSORLOCATION_STATUS_DISABLE (0) //!< \~english Not available
+#define SENSORLOCATION_STATUS_ENABLE (1) //!< \~english Available
+
+/* State definitions can be used */
+#define SENSORMOTION_STATUS_DISABLE (0) //!< \~english Not available
+#define SENSORMOTION_STATUS_ENABLE (1) //!< \~english Available
+/* Acquisition method */
+#define SENSOR_GET_METHOD_AUTO (0) //!< \~english Not specified
+#define SENSOR_GET_METHOD_GPS (1) //!< \~english GPS
+#define SENSOR_GET_METHOD_NAVI (2) //!< \~english Navigation
+#define SENSOR_GET_METHOD_DR (3) //!< \~english Dead Reckoning
+#define SENSOR_GET_METHOD_POS (4) //!< \~english positioning (Internal)
+
+
+#define LOCATIONINFO_NMEA_MAX (1020)
+//!< \~english Max length of 'Location Information'
+
+/* Command ID */
+/* Vehicle sensor information notification CID (Rate information) */
+
+/**
+ * \~english @brief Delivery speed command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_SPEED, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_SPEED (0x0203)
+
+/**
+ * \~english @brief Delivery longitude and latitude command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_LONLAT, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_LONLAT 0x0781
+
+/**
+ * \~english @brief Delivery altitude command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_ALTITUDE, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_ALTITUDE 0x0782
+
+/**
+ * \~english @brief Delivery heading command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_HEADING, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_HEADING 0x0783
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @struct POS_POSDATA
+ * \~english position information
+ */
+typedef struct {
+ int8_t status; //!< \~english data status
+ uint8_t posSts; //!< \~english position status
+ uint16_t posAcc; //!< \~english position accuracy
+ int32_t longitude; //!< \~english current longitude
+ int32_t latitude; //!< \~english current latitude
+ int32_t altitude; //!< \~english current altitude
+ int16_t heading; //!< \~english current heading
+ uint8_t reserved[2]; //!< \~english reserve
+} POS_POSDATA;
+
+/**
+ * @struct SENSORLOCATION_MSG_LONLATINFO
+ * \~english longitude and latitude information data delivery message
+ */
+typedef struct {
+ SENSORLOCATION_LONLATINFO_DAT data;
+ //!< \~english longitude and latitude information data
+} SENSORLOCATION_MSG_LONLATINFO;
+
+/**
+ * @struct SENSORLOCATION_MSG_ALTITUDEINFO
+ * \~english altitude information data delivery message
+ */
+typedef struct {
+ SENSORLOCATION_ALTITUDEINFO_DAT data; //!< \~english altitude information data
+} SENSORLOCATION_MSG_ALTITUDEINFO;
+
+/**
+ * @struct SENSORMOTION_MSG_HEADINGINFO
+ * \~english heading information data delivery message
+ */
+typedef struct {
+ SENSORMOTION_HEADINGINFO_DAT data; //!< \~english heading information data
+} SENSORMOTION_MSG_HEADINGINFO;
+
+/**
+ * @struct SENSORMOTION_MSG_SPEEDINFO
+ * \~english speed information data delivery message
+ */
+typedef struct {
+ SENSORMOTION_SPEEDINFO_DAT data; //!< \~english speed information data
+} SENSORMOTION_MSG_SPEEDINFO;
+
+
+/**
+ * @struct POS_LOCATIONINFO_NMEA
+ * \~english Structure of Location Information (NMEA)
+ */
+typedef struct {
+ uint32_t length; //!< \~english length
+ uint8_t data[LOCATIONINFO_NMEA_MAX]; //!< \~english data
+} POS_LOCATIONINFO_NMEA;
+
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+/* SENSOR_API public API */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register for longitude and lattitude delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Navigation/Not specified)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register for specified logtitude and latitude delivery
+/// - Please note if call this function for multiple times, the data will be deliveried for multiple times.
+/// - The specified longitude and latitude will be deliveried during the registration(first delivery)
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change. Specified longitude and latitude will be deliveried \n
+/// only when it has been changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update. Specified longitude and latitude will be deliveried \n
+/// every time that has been updated by the vehicle sensors.
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS. The longitude and latitude from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - Navi. The longitude and latitude from Navigation will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified. The specified longitude and latitude will be deliveried \n
+/// according to the current environment.
+/// - Avaliable method is descriped as following:\n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.\n
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUFFULL the register count is full
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) nor change \n
+/// (SENSOR_DELIVERY_TIMING_CHANGE) [POS_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to the max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to the max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to the max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference to the event \n
+/// is reach to the max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference to the event \n
+/// is reach to the max [POS_RET_ERROR_INNER]
+/// - Memory allocate failed during the event table creation for the event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been registered. \n
+/// [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between process. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer failed between process. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during waiting event. \n
+/// [POS_RET_ERROR_INNER]
+/// - The count of thread beyond max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during getting event. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - Getting event timeout. [POS_RET_ERROR_INNER]
+/// - Error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The result of positioning service returned is SENSOR_RET_ERROR_PARAM. [POS_RET_ERROR_PARAM]
+/// - The result of positioning service returned is SENSOR_RET_ERROR_BUFFULL. [POS_RET_ERROR_BUFFULL]
+/// - The result of positioning service returned is SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of positioning service returned is not SENSOR_RET_ERROR_PARAM and SENSOR_RET_ERROR_BUFFULL \n
+/// and SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register longitude and latitude information delivery.\n
+/// This API return the result of registered.
+/// \n
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same time.
+/// - After call this API, if the delivery destination thread name has been changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor information will been sent as system API \n
+/// message with following format.\n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_LONLAT \n
+/// message structure
+/// \~english @code
+/// typedef struct {
+/// SENSORLOCATION_LONLATINFO_DAT data; /* message data */
+/// } SENSORLOCATION_MSG_LONLATINFO;
+/// @endcode
+/// message data structure \n
+///
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* Synchrony count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t posSts; /* position status */
+/// uint16_t posAcc; /* Position accuracy */
+/// int32_t Longitude; /* Longitude */
+/// int32_t Latitude; /* Latitude */
+/// } SENSORLOCATION_LONLATINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - longitude and latitude from GPS
+/// - SENSOR_GET_METHOD_NAVI - longitude and latitude from Navigation
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous \n
+/// When delivery altitude and heading data, position data can be synchronized by SyncCnt.\n
+/// But the data of different method can not be synchronized by SyncCnt.\n
+/// Example 1: [LonLat from GPS] and [Heading from GPS] can be synchronized by SyncCnt.\n
+/// Example 2: [LonLat from GPS] and [LonLat from Navi] can not be synchronized by SyncCnt.\n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable) \n
+/// To describe this delivery message is whether can be used or not
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - when GPS data is specified,longitude and latitude is invalid at following condition:\n
+/// so [not avaliable] provieded
+/// - After system start, GPS unit has not received current location data and GPS unit \n
+/// status is not positioning fixed.
+/// - If it is not initialized status, certainly provide [avaliable] when Navigation data specified
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Position status(posSts)
+/// - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+/// - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+/// - Bit2 : DR data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DR)
+/// - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
+/// maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+/// - Position accuracy(posAcc)
+/// - Detected accruray of current position:1LSB=1m \n
+/// - Longitude : (WGS-84)(10^-7degree as 1) \n
+/// East longitude is positive value and west longitude is negative value.
+/// - Latitude : (WGS-84)(10^-7degree as 1) \n
+/// North latitude positive value and south latitude is negative value.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - POS_GetLonLat
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming,
+ uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register altitude delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Not specified)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified altitude delivery
+/// - Please note that if the same data delivery has been registered for multiple times, the data will \n
+/// also be deliveried for registered multiple times.
+/// - The specified altitude will be deliveried at registered time (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change. Specified altitude will be deliveried only when it is changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update. Specified altitude will be deliveried when it is updated by \n
+/// vehicle sensor.
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS. The altitude from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified. The altitude will be deliveried according to \n
+/// the current environment
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUFFULL the register count is full
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the dispatcher \n
+/// for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) nor change \n
+/// (SENSOR_DELIVERY_TIMING_CHANGE) [POS_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not registered(SENSOR_DELIVERY_REGIST) [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reached to the max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reached to the max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reached to the max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference to the event \n
+/// is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference to the event \n
+/// is reach to the max [POS_RET_ERROR_INNER]
+/// - Memory allocate failed during the event table creation for that event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been registered. \n
+/// [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event waiting. \n
+/// [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting.[POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - Getting event timeout. [POS_RET_ERROR_INNER]
+/// - Error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The result of positioning service is SENSOR_RET_ERROR_PARAM. [POS_RET_ERROR_PARAM]
+/// - The result of positioning service is SENSOR_RET_ERROR_BUFFULL. [POS_RET_ERROR_BUFFULL]
+/// - The result of positioning service is SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of positioning service is not SENSOR_RET_ERROR_PARAM and SENSOR_RET_ERROR_BUFFULL and \n
+/// SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register altitude delivery. \n
+/// This API will finish when get the return value.
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name is changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor will send system API message with following format. \n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_ALTITUDE \n
+/// message structure
+/// \~english @code
+/// typedef struct {
+/// SENSORLOCATION_ALTITUDEINFO_DAT data; /* message data */
+/// } SENSORLOCATION_MSG_ALTITUDEINFO;
+/// @endcode
+/// message data structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* synchrony count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t Reserve[3]; /* Reserve */
+/// int32_t Altitude; /* Altitude(unit:0.01m) */
+/// } SENSORLOCATION_ALTITUDEINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - altitude from GPS
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous \n
+/// When delivery altitude and heading data, position data can be synchronized by SyncCnt. \n
+/// But the data of different method can not be synchronized by SyncCnt.\n
+/// example: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by SyncCnt.\n
+/// synchronized by SyncCnt. \n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable) \n
+/// To describe this delivery message is whether can be used or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - when GPS data specified, Altitude is invalid at following condition(so [not avaliable] provieded):
+/// - Immediately after system start, GPS unit has not received current location data and GPS unit status \n
+/// is not positioning fix
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Altitude
+/// - altitude data(unit 0.01m)
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see delivery
+/// - POS_GetAltitude
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_RegisterListenerAltitude(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming,
+ uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register speed delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(POS/Navi/Not specified)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified speed delivery
+/// - Please note that if the same data delivery has been registered for multiple times, the data will \n
+/// also be deliveried for registered mutiple times.
+/// - The specified speed will be deliveried at registered time (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change. Specified speed will be deliveried only when it is changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update. Specified speed will be deliveried when it is updated by \n
+/// vehicle sensor.
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - Navi The speed from Navi will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified The speed will be deliveried according to the current environment
+/// deliveried.
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+///
+/// \~english @retval POS_RET_NORMAL normal end
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUFFULL the register count is full
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher for App \n
+/// are completed.
+/// - Availability of service positioning is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) \n
+/// nor change(SENSOR_DELIVERY_TIMING_CHANGE) [POS_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate failed during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been registered. \n
+/// [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event waiting. \n
+/// [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - Getting event timeout. [POS_RET_ERROR_INNER]
+/// - Error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The result of positioning service is SENSOR_RET_ERROR_PARAM. [POS_RET_ERROR_PARAM]
+/// - The result of positioning service is SENSOR_RET_ERROR_BUFFULL. [POS_RET_ERROR_BUFFULL]
+/// - The result of positioning service is SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of positioning service is not SENSOR_RET_ERROR_PARAM and SENSOR_RET_ERROR_BUFFULL \n
+/// and SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register speed delivery. \n
+/// This API will finish when get the return value.
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name is changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor will send system API message with following format. \n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_SPEED \n
+/// message structure
+/// \~english @code
+/// typedef struct {
+/// SENSORMOTION_SPEEDINFO_DAT data; /* message data */
+/// } SENSORMOTION_MSG_SPEEDINFO;
+/// @endcode
+/// message data structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* synchrony count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t Reserve1[3]; /* Reserve */
+/// uint16_t Speed; /* speed(unit:0.01m/sec) */
+/// uint8_t Reserve2[2]; /* Reserve */
+/// } SENSORMOTION_SPEEDINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - speed from Navi
+/// - Synchrony count(SyncCnt)
+/// - 0 (not change).
+/// - Enable or not(isEnable) \n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - Speed is invalid at following condition when speed pulse specified, so [not avaliable] provieded
+/// - Immediately after system start, the sensor data have not been received from SYS micon
+/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Speed
+/// - speed data(unit 0.01m/sec)
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - POS_GetSpeed
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_RegisterListenerSpeed(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming,
+ uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register heading delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Navi/Not specified)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified heading delivery
+/// - Please note that if the same data delivery has been registered for mutiple times, the data will \n
+/// also be deliveried for registered mutiple times.
+/// - The specified heading will be deliveried at registered time (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change. Specified heading will be deliveried only when it is changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update. Specified heading will be deliveried when it is updated by \n
+/// vehicle sensor.
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS. The heading from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified. The heading will be deliveried \n
+/// according to the current environment
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUFFULL the register count is full
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher \n
+/// for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) nor change \n
+/// (SENSOR_DELIVERY_TIMING_CHANGE) [POS_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate failed during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already \n
+/// been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer between \n
+/// processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event waiting. \n
+/// [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - Getting event timeout. [POS_RET_ERROR_INNER]
+/// - Error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The result of positioning service is SENSOR_RET_ERROR_PARAM. [POS_RET_ERROR_PARAM]
+/// - The result of positioning service is SENSOR_RET_ERROR_BUFFULL. [POS_RET_ERROR_BUFFULL]
+/// - The result of positioning service is SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of positioning service is not SENSOR_RET_ERROR_PARAM and SENSOR_RET_ERROR_BUFFULL \n
+/// and SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register heading delivery.
+/// This API will finish when get the return value.
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name is changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor will send system API message with following format. \n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_HEADING \n
+/// message structure
+/// \~english @code
+/// typedef struct {
+/// SENSORMOTION_HEADINGINFO_DAT data; /* message data */
+/// } SENSORMOTION_MSG_HEADINGINFO;
+/// @endcode
+/// message data structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* sync count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t posSts; /* position status */
+/// uint8_t Reserve1[2]; /* Reserve */
+/// uint16_t Heading; /* heading(unit:0.01degree) */
+/// uint8_t Reserve2[2]; /* Reserve */
+/// } SENSORMOTION_HEADINGINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - Heading from GPS
+/// - SENSOR_GET_METHOD_NAVI - Heading from Navi
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous \n
+/// When delivery altitude and heading data, position data can be synchronized by this count. \n
+/// But the data of different method can not be synchronized by this count.\n
+/// example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n
+/// example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be \n
+/// synchronized by the count. \n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable) \n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - Heading is invalid at following condition when GPS data specified, so [not avaliable] provieded \n
+/// - Immediately after system start, GPS unit has not received current location data and GPS unit status \n
+/// is not positioning fix
+/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Position status(posSts)
+/// - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+/// - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+/// - Bit2 : DR data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DR)
+/// - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
+/// maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+/// - Heading
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - POS_GetHeading
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming,
+ uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get longitude and latitude information
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] dat
+/// - SENSORLOCATION_LONLATINFO_DAT* - output pointer to longitude and latitude informaiton
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Navi/Not specified)
+///
+/// \~english @par
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS The longitude and latitude from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - Navi The longitude and latitude from Navi will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified The longitude and latitude will be deliveried \n
+/// according to the current environment.
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+/// \~english @par
+/// - SENSORLOCATION_LONLATINFO_DAT structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* sync count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t posSts; /* position status */
+/// uint16_t posAcc; /* Position accuracy */
+/// int32_t Longitude; /* Longitude */
+/// int32_t Latitude; /* Latitude */
+/// } SENSORLOCATION_LONLATINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - longitude and latitude from GPS
+/// - SENSOR_GET_METHOD_NAVI - longitude and latitude from Navi
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous\n
+/// When delivery altitude and heading data, position data can be synchronized by this count. \n
+/// But the data of different method can not be synchronized by this count. \n
+/// example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by this count. \n
+/// example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be \n
+/// synchronized by this count. \n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable) \n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - longitude and latitude is invalid at following condition when GPS data specified, \n
+/// so [not avaliable] provieded
+/// - Immediately after system start, GPS unit has not received current location data and \n
+/// GPS unit status is not positioning fix
+/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified\n
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Position status(posSts)
+/// - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+/// - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+/// - Bit2 : DR data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DR)
+/// - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
+/// maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+/// - Position accuracy(posAcc)
+/// - Detected accruray of current position:1LSB=1m
+/// - Longitude : (WGS-84)(10^-7degree as 1) \n
+/// East longitude is positive value and west longitude is minus value.
+/// - Latitude : (WGS-84)(10^-7degree as 1)\n
+/// North latitudeis positive value and south latitude is minus value.
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher \n
+/// for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter dat is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate failed during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been registered. \n
+/// [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when lock semaphore. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when lock mutex. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when lock mutex. [POS_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when lock mutex. [POS_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_INNER]
+/// - Can not open share memory. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [POS_RET_ERROR_INNER]
+/// - No empty field in share memory. [POS_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer failed between process. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event waiting. \n
+/// [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing received data. \n
+/// [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_INNER]
+/// - The result of getting sensor data get is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of getting sensor data get is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get longitude and latitude from vehicle sensor
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_RegisterListenerLonLat
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_GetLonLat(HANDLE hApp, SENSORLOCATION_LONLATINFO_DAT *dat, uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get altitude data
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] dat
+/// - SENSORLOCATION_ALTITUDEINFO_DAT* - output pointer to altitude data
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Not specified)
+///
+/// \~english @par
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS The altitude from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified The altitude will be deliveried \n
+/// according to the current environment
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+/// \~english @par
+/// - SENSORLOCATION_ALTITUDEINFO_DAT structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* sync count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t Reserve[3]; /* Reserve */
+/// int32_t Altitude; /* Altitude(unit:0.01m) */
+/// } SENSORLOCATION_ALTITUDEINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - altitude from GPS
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous \n
+/// When delivery altitude and heading data, position data can be synchronized by this count. \n
+/// But the data of different method can not be synchronized by this count. \n
+/// example: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n
+/// synchronized by the count. \n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable)\n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - Altitude is invalid at following condition when GPS data specified, so [not avaliable] provieded
+/// - Immediately after system start, GPS unit has not received current location data and GPS unit \n
+/// status is not positioning fix
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Altitude
+/// - altitude data(unit 0.01m)
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of \n
+/// the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter dat is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when lock semaphore. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when lock mutex. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when lock mutex. [POS_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when lock mutex. [POS_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_INNER]
+/// - Can not open share memory. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [POS_RET_ERROR_INNER]
+/// - No empty field in share memory. [POS_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing
+/// received data. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_INNER]
+/// - The result of getting sensor data is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of getting sensor data is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get altitude from vehicle sensor
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_RegisterListenerAltitude
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_GetAltitude(HANDLE hApp, SENSORLOCATION_ALTITUDEINFO_DAT *dat, uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get speed data
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] dat
+/// - SENSORMOTION_SPEEDINFO_DAT* - output buffer pointer to store speed data
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(POS/Navi/Not specified)
+///
+/// \~english @par
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - Navi The speed from Navi will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified The speed will be deliveried according to current \n
+/// environment.
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+///
+/// \~english @par
+/// - SENSORMOTION_SPEEDINFO_DAT structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* sync count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t Reserve1[3]; /* Reserve */
+/// uint16_t Speed; /* speed(unit:0.01m/sec) */
+/// uint8_t Reserve2[2]; /* Reserve */
+/// } SENSORMOTION_SPEEDINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
+/// - Sync count(SyncCnt)
+/// - 0.
+/// - Enable or not(isEnable) \n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - Speed is invalid at following condition when speed pulse specified, so [not avaliable] provieded
+/// - Immediately after system start, the sensor data have not been received from SYS micon
+/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Speed
+/// - speed data(unit 0.01m/sec)
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter dat is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied when the event table creation that for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table when the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full when event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed when event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when semaphore lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when mutex lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when mutex lock. [POS_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when mutex lock. [POS_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_INNER]
+/// - Can not open share memory. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [POS_RET_ERROR_INNER]
+/// - No empty field in share memory. [POS_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer \n
+/// between processes [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between \n
+/// processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event \n
+/// waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing \n
+/// received data. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_INNER]
+/// - The result of getting sensor data is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of getting sensor data is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get speed from vehicle sensor.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_RegisterListenerSpeed
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_GetSpeed(HANDLE hApp, SENSORMOTION_SPEEDINFO_DAT *dat, uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get heading data
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] dat
+/// - SENSORMOTION_HEADINGINFO_DAT* - output buffer pointer to store heading data
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Navi/Not specified)
+///
+/// \~english @par
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS The heading from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - Navi The heading from Navi will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified The heading which most suitable in current environment \n
+/// - Avaliable method is descriped as following in each environment. \n
+/// In corresponding environment, the SENSOR_GET_METHOD_AUTO is set as default. \n
+/// In corresponding environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+/// \~english @par
+/// - SENSORMOTION_HEADINGINFO_DAT structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* sync count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t posSts; /* position status */
+/// uint8_t Reserve1[2]; /* Reserve */
+/// uint16_t Heading; /* heading(unit:0.01degree) */
+/// uint8_t Reserve2[2]; /* Reserve */
+/// } SENSORMOTION_HEADINGINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - Heading from GPS
+/// - SENSOR_GET_METHOD_NAVI - Heading from Navi
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous \n
+/// When delivery altitude and heading data, position data can be synchronized by this count. \n
+/// But the data of different method can not be synchronized by this count. \n
+/// example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n
+/// example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be \n
+/// synchronized by the count. \n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable) \n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - Heading is invalid at following condition when GPS data specified, so [not avaliable] provieded
+/// - Immediately after system start, GPS unit has not received current location data and GPS unit \n
+/// status is not positioning fix
+/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Position status(posSts)
+/// - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+/// - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+/// - Bit2 : DR data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DR)
+/// - Bit3 : MapMatching data use result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+/// - Heading
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher
+/// - for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter dat is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when semaphore lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when mutex lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when mutex lock. [POS_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when mutex lock. [POS_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_INNER]
+/// - Can not open share memory. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [POS_RET_ERROR_INNER]
+/// - No empty field in share memory. [POS_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between \n
+/// processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table \n
+/// during event waiting[POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing received \n
+/// data. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_INNER]
+/// - The result of getting sensor data is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of getting sensor data is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get heading from vehicle sensor.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_RegisterListenerHeading
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_GetHeading(HANDLE hApp, SENSORMOTION_HEADINGINFO_DAT *dat, uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Set speed information
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] navispeed
+/// - uint16_t - speed data[unit: 1.0km/h]
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of \n
+/// the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The data size is larger than specified value(POS_MSG_INFO_DSIZE) [POS_RET_ERROR_RESOURCE]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The message queue name has not been registered in control table. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table. [POS_RET_ERROR_INNER]
+/// - Speed data setting message transfer failed. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to set speed to vehicle sensor. \n
+/// This API will finish when get the return value. \n
+/// The speed set by this API is saved in positioning as the speed calculated by Navi.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - This API is only called by Navi proxy.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+/// \~english @see
+/// - None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_SetSpeedInfo(HANDLE hApp, uint16_t navispeed);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Set location information
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] pstPosData
+/// - POS_POSDATA * - pointer to location information
+///
+/// \~english @par
+/// - POS_POSDATA structure
+/// \~english @code
+/// typedef struct
+/// {
+/// int8_t status; /* data status */
+/// uint8_t posSts; /* position status */
+/// uint16_t posAcc; /* Position accuracy 1LSB=1m */
+/// int32_t Longitude; /* Longitude(unit:1/128sec) */
+/// int32_t Latitude; /* Latitude(unit:1/128sec) */
+/// int32_t altitude; /* altitude (unit:0.01m) */
+/// int16_t heading; /* heading (unit:1degree) */
+/// uint8_t reserved[2]; /* reserve */
+/// } POS_POSDATA;
+/// @endcode
+///
+/// \~english @par
+/// - data status(status) \n
+/// Do not set the invalid data(do not update data).
+/// - data valid/invalid status
+/// - Bit0 : latitude(1:valid, 0:invalid, definition of maskbit:POS_LOC_INFO_LAT)
+/// - Bit1 : longitude(1:valid, 0:invalid, definition of maskbit:POS_LOC_INFO_LON)
+/// - Bit2 : altitude (1:valid, 0:invalid, definition of maskbit:POS_LOC_INFO_ALT)
+/// - Bit3 : heading (1:valid, 0:invalid, definition of maskbit:POS_LOC_INFO_HEAD)
+/// - Bit4~7 : reserve
+/// - Position status(posSts)
+/// - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+/// - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+/// - Bit2 : DR data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DR)
+/// - Bit3 : MapMatching data use result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+/// - Bit4~7 : reserve
+/// - Position accuracy(posAcc)
+/// - Detected accruray of current position:1LSB=1m
+/// - longitude
+/// - data range: -180deg ~ +180deg
+/// - +: east longitude -: west longitude
+/// - latitude
+/// - data range:-90deg ~ +90deg
+/// - +: north latitude -: south latitude
+/// - heading
+/// - data range:-179deg ~ +180deg
+/// - Based on north, west(counter-clockwise) is +, east(clockwise) is -
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher \n
+/// for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter pstPosData is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The data status in parameter pstPosData is invalid value(0). [POS_RET_ERROR_PARAM]
+/// - The data status in parameter pstPosData is abnormal value(<15). [POS_RET_ERROR_PARAM]
+/// - The data size is larger than specified value(POS_MSG_INFO_DSIZE) [POS_RET_ERROR_RESOURCE]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The message queue name has not been registered in control table. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table. [POS_RET_ERROR_INNER]
+/// - Location data setting message transfer failed. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to set location to vehicle sensor. \n
+/// This API will finish when get the return value. \n
+/// The location set by this API is saved in positioning as the location calculated by Navi. \n
+/// If one of longitude and latitude is valid, the another data will be used as valid data no \n
+/// matter what status it is. \n
+/// If one of longitude and latitude is valid, the position accuracy data will be used as valid data.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - This API is only called by Navi proxy.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+/// \~english @see
+/// - None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_SetLocationInfo(HANDLE hApp, POS_POSDATA* pstPosData);
+
+#ifdef __cplusplus
+}
+#endif
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_COMMON_API_H_
diff --git a/vehicleservice/positioning/client/include/vehicle_service/POS_define.h b/vehicleservice/positioning/client/include/vehicle_service/POS_define.h
new file mode 100755
index 0000000..2ea918d
--- /dev/null
+++ b/vehicleservice/positioning/client/include/vehicle_service/POS_define.h
@@ -0,0 +1,134 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_DEFINE_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_DEFINE_H_
+
+/**
+ * @file POS_define.h
+ * @brief Header file to define the constants and structure
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+#include <gps_hal.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+#define POS_AVAILABILITY "Positioning/Availability" //!< \~english Availability
+
+/* message sender thread */
+#define POS_NTFY_SEND_THREAD "POS_Main" //!< \~english POS_Main thread
+#define POS_NTFY_SEND_THREAD_GPS "POS_Gps" //!< \~english POS_Gps thread
+
+/* SENSOR_RET_API */
+#define SENSOR_RET_NORMAL 0 //!< \~english normal finish
+#define SENSOR_RET_ERROR_PID (-1) //!< \~english thread ID error
+#define SENSOR_RET_ERROR_DID (-2) //!< \~english unregistered data ID error
+#define SENSOR_RET_ERROR_DID_DIS (-3) //!< \~english data ID not CAN ID
+#define SENSOR_RET_ERROR_PARAM (-4) //!< \~english parameter error
+#define SENSOR_RET_ERROR_BUFFULL (-5) //!< \~english buffer full error
+#define SENSOR_RET_ERROR_CREATE_EVENT (-6) //!< \~english create event error
+#define SENSOR_RET_ERROR_TIMER (-7) //!< \~english create timer error
+#define SENSOR_RET_ERROR_OUTOF_MEMORY (-8)
+//!< \~english share memory allocation size error
+
+#define SENSOR_RET_ERROR_SIZE (-9) //!< \~english memory size error
+#define SENSOR_RET_ERROR (-10) //!< \~english error occured
+#define SENSOR_RET_ERROR_NOSUPPORT (-11) //!< \~english no support
+#define SENSOR_RET_ERROR_INNER (-12) //!< \~english Internal error
+#define SENSOR_RET_ERROR_RESOURCE (-13) //!< \~english lack of resources
+#define SENSOR_RET_ERROR_MIN POS_RET_ERROR_MIN //!< \~english min value of error
+
+/* Data Status Definition */
+#define POS_LOC_INFO_LAT 0x01
+//!< \~english current position latitude(bit0) 1:valid 0:invalid
+
+#define POS_LOC_INFO_LON 0x02
+//!< \~english current position longitude(bit1) 1:valid 0:invalid
+
+#define POS_LOC_INFO_ALT 0x04
+//!< \~english current position altitude(bit2) 1:valid 0:invalid
+
+#define POS_LOC_INFO_HEAD 0x08
+//!< \~english current position heading(bit3) 1:valid 0:invalid
+
+/* Definition of positioning system */
+#define POS_LOC_INFO_USE_GSP 0x01
+//!< \~english GPS data used result(bit0) 1:valid 0:invalid
+
+#define POS_LOC_INFO_USE_DGPS 0x02
+//!< \~english DGPS data used result(bit1) 1:valid 0:invalid
+
+#define POS_LOC_INFO_USE_DR 0x04
+//!< \~english Dead Reckoning used result(bit2) 1:valid 0:invalid
+
+#define POS_LOC_INFO_USE_MAPMATCHING 0x08
+//!< \~english MapMatching result(bit3) 1:valid 0:invalid
+
+/*--- for message ---*/
+/* message body size (byte) */
+/* move to gps_hal.h */
+
+/*--- for register listener API ---*/
+/* control delivery */
+#define SENSOR_DELIVERY_REGIST 0x01 //!< \~english register delivery
+
+/* delivery timing control */
+#define SENSOR_DELIVERY_TIMING_UPDATE 0x01 //!< \~english delivery update timing
+#define SENSOR_DELIVERY_TIMING_CHANGE 0x02 //!< \~english delivery change timing
+
+/* POS_RET_API */
+#define POS_RET_NORMAL 0 //!< \~english normal finish
+#define POS_RET_ERROR (-1) //!< \~english error occured
+#define POS_RET_ERROR_DID (-2) //!< \~english data ID error
+#define POS_RET_ERROR_INNER (-3) //!< \~english internal error
+#define POS_RET_ERROR_PARAM (-4) //!< \~english parameter error
+#define POS_RET_ERROR_BUFFULL (-5) //!< \~english buffer full error
+#define POS_RET_ERROR_CREATE_EVENT (-6) //!< \~english create event error
+#define POS_RET_ERROR_OUTOF_MEMORY (-8)
+//!< \~english share memory allocation size error
+
+#define POS_RET_ERROR_SIZE (-9) //!< \~english memory size error
+#define POS_RET_ERROR_TIMEOUT (-10) //!< \~english timeout error
+#define POS_RET_ERROR_NOSUPPORT (-11) //!< \~english no support
+#define POS_RET_ERROR_BUSY (-12) //!< \~english busy
+#define POS_RET_ERROR_RESOURCE (-13) //!< \~english lack of resources
+#define POS_RET_ERROR_MIN (-13) //!< \~english min value of error
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+typedef int32_t SENSOR_RET_API; //!< \~english API return value
+typedef int32_t POS_RET_API; //!< \~english API return value
+typedef uint32_t DID; //!< \~english data ID
+typedef int32_t RET_API; //!< \~english _CWORD64_ API return value
+
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_DEFINE_H_
diff --git a/vehicleservice/positioning/client/include/vehicle_service/POS_gps_API.h b/vehicleservice/positioning/client/include/vehicle_service/POS_gps_API.h
new file mode 100755
index 0000000..41e8e01
--- /dev/null
+++ b/vehicleservice/positioning/client/include/vehicle_service/POS_gps_API.h
@@ -0,0 +1,1135 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_GPS_API_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_GPS_API_H_
+/**
+ * @file POS_gps_API.h
+ * @brief API definition file for GPS function
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/POS_define.h>
+#include <gps_hal.h>
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+typedef int32_t NAVIINFO_RET_API;
+//!< \~english define return value of Get/Set GPS information API
+
+/*---------------------------------------------------------------------------------*
+ * Event declaration *
+ *---------------------------------------------------------------------------------*/
+
+
+/**
+ * \~english @brief GPS time setting result delivery command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(h_app,POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ 0x0780
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @struct SENSOR_MSG_SEND_DAT
+ * \~english message for setting vehicle sensor data(to vehicle sensor)
+ */
+typedef struct {
+ DID did; //!< \~english data ID
+ uint16_t usSize; //!< \~english data size
+ uint8_t data[502]; //!< \~english data body
+} SENSOR_MSG_SEND_DAT;
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+/* GPS_API public API */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - GPS setting request
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] p_data
+/// - SENSOR_MSG_SEND_DAT * - pointer of GPS setting data
+///
+/// \~english @par
+/// - SENSOR_MSG_SEND_DAT structure
+/// \~english @code
+/// typedef struct
+/// {
+/// DID did; /* Data ID */
+/// uint16_t usSize; /* Data size */
+/// uint8_t data[502]; /* Data body */
+/// } SENSOR_MSG_SEND_DAT;
+/// @endcode
+///
+/// \~english @par
+/// - Data ID(did)
+/// - POS_DID_GPS__CWORD82__SETINITIAL - setting initial location and time data to GPS \n
+/// (reference to initial location, time setting(_CWORD82_))
+/// - POS_DID_GPS__CWORD82__SETRMODEEX - setting GPS receiver mode(pull extension sentence) \n
+/// (reference to GPS receiver mode setting(_CWORD82_))
+/// - POS_DID_GPS__CWORD82__SELSENT - setting command to GPS that output any sentence \n
+/// (reference to output any sentence setting(_CWORD82_))
+///
+///
+/// \~english @retval SENSOR_RET_NORMAL normal finish
+/// \~english @retval SENSOR_RET_ERROR_CREATE_EVENT event create error
+/// \~english @retval SENSOR_RET_ERROR_PARAM parameter error
+/// \~english @retval SENSOR_RET_ERROR_DID data ID not registered
+/// \~english @retval SENSOR_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval SENSOR_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter p_data is NULL [SENSOR_RET_ERROR_PARAM]
+/// - Data ID(p_data->did) is not supported [SENSOR_RET_ERROR_DID]
+/// - GPS setting data size(p_data->usSize) is not same with the data \n
+/// that related to data ID [SENSOR_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The message queue name has not been registered in control table when GPS \n
+/// setting message transfer between processes. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Message transfer HANDLE create failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Message transfer HANDLE get failed from internal table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - GPS setting message transfer failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+///
+/// \~english @par Detail
+/// - Call this API to set GPS data. \n
+/// The GPS data specified by the parameter p_data will be set in positioning.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - This API is only called by Navigation proxy.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+/// \~english @see
+/// - None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+int32_t POS_ReqGPSSetting(HANDLE hApp, SENSOR_MSG_SEND_DAT *p_data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Set GPS information
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] navilocinfo
+/// - NAVIINFO_ALL * - pointer of GPS information
+///
+/// \~english @par
+/// - NAVIINFO_ALL structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint8_t ucSensorCnt; /* sensor count */
+/// uint8_t reserve[3]; /* reserve */
+/// NAVIINFO_DIAG_GPS stDiagGps; /* position fix related information */
+/// NAVIINFO_NAVI_GPS stNaviGps; /* other GPS related information */
+/// } NAVIINFO_ALL;
+/// @endcode
+/// - sensor count \n
+/// sensor count value when GPS data received
+///
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS structure
+/// \~english @code
+/// typedef struct
+/// {
+/// NAVIINFO_DIAG_GPS_FIX stFix; /* position fix information */
+/// NAVIINFO_DIAG_GPS_SAT stSat; /* all satellite information */
+/// } NAVIINFO_DIAG_GPS;
+/// @endcode
+/// \n
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint8_t ucFixSts; /* position fix status */
+/// uint8_t ucReserve[3]; /* reserve */
+/// NAVIINFO_DIAG_GPS_FIX_CNT stCnt; /* position fix count data */
+/// NAVIINFO_DIAG_GPS_FIX_XYZ stWgs84; /* lonlat data(WGS84 geodetic) */
+/// } NAVIINFO_DIAG_GPS_FIX;
+/// @endcode
+/// - position fix status(ucFixSts)
+/// - NAVIINFO_DIAG_GPS_FIX_STS_NON:not fixed
+/// - NAVIINFO_DIAG_GPS_FIX_STS_2D :2D fix
+/// - NAVIINFO_DIAG_GPS_FIX_STS_3D :3D fix
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX_CNT structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint32_t ulCnt3d; /* position fix ratio:3D(unit:sec) */
+/// uint32_t ulCnt2d; /* position fix ratio:2D(unit:sec) */
+/// uint32_t ulCntElse; /* position fix ratio:not fix(unit:sec) */
+/// } NAVIINFO_DIAG_GPS_FIX_CNT;
+/// @endcode
+///
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX_XYZ structure
+/// \~english @code
+/// typedef struct
+/// {
+/// int32_t lLat; /* GPS latitude(unit:1/256sec) (+: north latitude,-: south latitude) */
+/// int32_t lLon; /* GPS longitude(unit:1/256sec) (+: east longitude, -: west longitude) */
+/// } NAVIINFO_DIAG_GPS_FIX_XYZ;
+/// @endcode
+///
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_SAT structure
+/// \~english @code
+/// typedef struct
+/// {
+/// NAVIINFO_DIAG_GPS_PRN stPrn[12]; /* all satellite information */
+/// } NAVIINFO_DIAG_GPS_SAT;
+/// @endcode
+///
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_PRN structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint8_t ucRcvSts; /* reception status */
+/// uint8_t ucPrn; /* satellite No. */
+/// uint8_t ucelv; /* satellite angle(unit:1.0deg) */
+/// uint8_t ucLv; /* satellite level */
+/// uint16_t usAzm; /* satellite azimuth(unit:1.0deg) (clockwise from north) */
+/// uint8_t ucReserve[2]; /* reserve */
+/// } NAVIINFO_DIAG_GPS_PRN;
+/// @endcode
+/// - reception status(ucRcvSts)
+/// - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE :not used
+/// - NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING :searching
+/// - NAVIINFO_DIAG_GPS_RCV_STS_TRACHING :tracking
+/// - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX :not used for position fix
+/// - NAVIINFO_DIAG_GPS_RCV_STS_USEFIX :used for position fix
+/// \~english @par
+/// - NAVIINFO_NAVI_GPS structure
+/// \~english @code
+/// typedef struct
+/// {
+/// int32_t altitude; /* altitude(unit:1m) */
+/// uint16_t speed; /* speed(unit:1.00km/h) */
+/// uint16_t heading; /* heading(unit:0.1deg) (clockwise from north) */
+/// NAVIINFO_UTCTIME utc; /* UTC time */
+/// uint8_t tdsts; /* date and time status */
+/// uint8_t reserve[3]; /* reserve */
+/// } NAVIINFO_NAVI_GPS;
+/// @endcode
+/// - altitude(altitude) \n
+/// As the altitude is used as unit [0.01m] in internal, \n
+/// the altitude data range is (-21,474,839~21,474,839).
+/// - UTC(utc)
+/// - The time set after rollover.
+/// - date and time status(tdsts)
+/// - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+/// - 1= time output from RTC Backup(have time adjustment result)
+/// - 2= time adjustment completed
+/// \~english @par
+/// - NAVIINFO_UTCTIME structure
+/// \~english @code
+/// typedef struct {
+/// uint16_t year; /* A.D. (1~) */
+/// uint8_t month; /* month(1~12) */
+/// uint8_t date; /* date(1~31) */
+/// uint8_t hour; /* hour(0~23) */
+/// uint8_t minute; /* minute(0~59) */
+/// uint8_t second; /* second(0~59) */
+/// uint8_t reserved; /* not used */
+/// } NAVIINFO_UTCTIME;
+/// @endcode
+///
+/// \~english @retval NAVIINFO_RET_NORMAL normal finish
+/// \~english @retval NAVIINFO_RET_ERROR_PARAM parameter error
+/// \~english @retval NAVIINFO_RET_ERROR_INNER internal error
+/// \~english @retval NAVIINFO_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval NAVIINFO_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter navilocinfo is NULL [NAVIINFO_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [NAVIINFO_RET_ERROR_PARAM]
+/// - GPS setting data size(p_data->usSize) is not same as the data that \n
+/// related to data ID [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The count of message in message queue is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The message queue name has not been registered in control table. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table. [NAVIINFO_RET_ERROR_INNER]
+/// - GPS setting message transfer failed between processes. [NAVIINFO_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to set GPS information to vehicle sensor.\n
+/// - This API will finish when get the return value.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - This API is only called by Navigation proxy.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget and Method and Fire and Forget and Fire and Forget
+///
+/// \~english @see
+/// - POS_GetGPSInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+NAVIINFO_RET_API POS_SetGPSInfo(HANDLE hApp, NAVIINFO_ALL *navilocinfo);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get GPS data
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] navidiaginfo
+/// - NAVIINFO_DIAG_GPS* - pointer to get GPS data
+///
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS structure
+/// \~english @code
+/// typedef struct
+/// {
+/// NAVIINFO_DIAG_GPS_FIX stFix; /* position fix information */
+/// NAVIINFO_DIAG_GPS_SAT stSat; /* all satellite information */
+/// } NAVIINFO_DIAG_GPS;
+/// @endcode
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint8_t ucFixSts; /* position fix status */
+/// uint8_t ucReserve[3]; /* reserve */
+/// NAVIINFO_DIAG_GPS_FIX_CNT stCnt; /* position fix count data */
+/// NAVIINFO_DIAG_GPS_FIX_XYZ stWgs84; /* lonlat data(WGS84 geodetic) */
+/// } NAVIINFO_DIAG_GPS_FIX;
+/// @endcode
+/// - position fix status(ucFixSts)
+/// - NAVIINFO_DIAG_GPS_FIX_STS_NON:not fixed
+/// - NAVIINFO_DIAG_GPS_FIX_STS_2D :2D fix
+/// - NAVIINFO_DIAG_GPS_FIX_STS_3D :3D fix
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX_CNT structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint32_t ulCnt3d; /* position fix count:3D(unit:sec) */
+/// uint32_t ulCnt2d; /* position fix count:2D(unit:sec) */
+/// uint32_t ulCntElse; /* position fix count:not fix(unit:sec) */
+/// } NAVIINFO_DIAG_GPS_FIX_CNT;
+/// @endcode
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX_XYZ structure
+/// \~english @code
+/// typedef struct
+/// {
+/// int32_t lLat; /* GPS latitude(unit:1/256sec) (+: north latitude, -: south latitude) */
+/// int32_t lLon; /* GPS longitude(unit:1/256sec) (+: east longitude, -: west longitude) */
+/// } NAVIINFO_DIAG_GPS_FIX_XYZ;
+/// @endcode
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_SAT structure
+/// \~english @code
+/// typedef struct
+/// {
+/// NAVIINFO_DIAG_GPS_PRN stPrn[12]; /* all satellite information */
+/// } NAVIINFO_DIAG_GPS_SAT;
+/// @endcode
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_PRN structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint8_t ucRcvSts; /* reception status */
+/// uint8_t ucPrn; /* satellite No. */
+/// uint8_t ucelv; /* satellite angle(unit:1.0deg) */
+/// uint8_t ucLv; /* satellite level */
+/// uint16_t usAzm; /* satellite azimuth(unit:1.0deg) (clockwise from north) */
+/// uint8_t ucReserve[2]; /* reserve */
+/// } NAVIINFO_DIAG_GPS_PRN;
+/// @endcode
+/// - reception status(ucRcvSts)
+/// - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE : not used
+/// - NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING : searching
+/// - NAVIINFO_DIAG_GPS_RCV_STS_TRACHING : tracking
+/// - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX : not used for position fix
+/// - NAVIINFO_DIAG_GPS_RCV_STS_USEFIX : used for position fix
+///
+/// \~english @retval NAVIINFO_RET_NORMAL normal finish
+/// \~english @retval NAVIINFO_RET_ERROR_PARAM parameter error
+/// \~english @retval NAVIINFO_RET_ERROR_INNER internal error
+/// \~english @retval NAVIINFO_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval NAVIINFO_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter navidiaginfo is NULL [NAVIINFO_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [NAVIINFO_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [NAVIINFO_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [NAVIINFO_RET_ERROR_INNER]
+/// - Memory allocate falied during the event table creation for event \n
+/// registering. [NAVIINFO_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [NAVIINFO_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [NAVIINFO_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already \n
+/// been registered. [NAVIINFO_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [NAVIINFO_RET_ERROR_INNER]
+/// - The event table is full during event creation. [NAVIINFO_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [NAVIINFO_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [NAVIINFO_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but \n
+/// failed. [NAVIINFO_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been \n
+/// registered. [NAVIINFO_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [NAVIINFO_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [NAVIINFO_RET_ERROR_INNER]
+/// - Initialize event object failed. [NAVIINFO_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [NAVIINFO_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when semaphore lock. [NAVIINFO_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when mutex lock. [NAVIINFO_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when mutex lock. [NAVIINFO_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when mutex lock. [NAVIINFO_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [NAVIINFO_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [NAVIINFO_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [NAVIINFO_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [NAVIINFO_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [NAVIINFO_RET_ERROR_INNER]
+/// - Can not open share memory. [NAVIINFO_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [NAVIINFO_RET_ERROR_INNER]
+/// - No empty field in share memory. [NAVIINFO_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [NAVIINFO_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message \n
+/// transfer between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [NAVIINFO_RET_ERROR_INNER]
+/// - The count of thread arrived max in event management table during event waiting. [NAVIINFO_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [NAVIINFO_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [NAVIINFO_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [NAVIINFO_RET_ERROR_INNER]
+/// - The interruption happened during event getting [NAVIINFO_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [NAVIINFO_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing \n
+/// received data. [NAVIINFO_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [NAVIINFO_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [NAVIINFO_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [NAVIINFO_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [NAVIINFO_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [NAVIINFO_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of \n
+/// received data. [NAVIINFO_RET_ERROR_INNER]
+/// - The result of sensor data get processing is POS_RET_ERROR_RESOURCE. [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The result of sensor data get processing is not POS_RET_ERROR_RESOURCE. [NAVIINFO_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get GPS data for diag. \n
+/// This API will finish when get the return value.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_SetGPSInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+NAVIINFO_RET_API POS_GetGPSInfo(HANDLE hApp, NAVIINFO_DIAG_GPS *navidiaginfo);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - GPS reset request
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] ResName
+/// - PCSTR - response thread name
+/// \~english @param [in] mode
+/// - uint8_t - reset mode
+///
+/// \~english @par
+/// - reset mode(mode) \n
+/// If the mode is not one of the following, return POS_RET_ERROR_PARAM
+/// - GPS_RST_COLDSTART - GPS reset request(cold start) \n
+/// Automatic search, track satellite and position fix after RAM initialized(all config \n
+/// items be initialized to default value).\n
+/// Initialize data objects:almanac/ ephemeris data, current position, GPS receiver mode and etc.\n
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUSY GPS device is still in setting
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter ResName is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter mode is not GPS_RST_COLDSTART [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied when the event table creation that for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table when the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full when event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed when event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when GPS reset \n
+/// message transfer between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when GPS reset message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when GPS reset message \n
+/// transfered between processes. [POS_RET_ERROR_INNER]
+/// - GPS reset message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event waiting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event waiting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event waiting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event waiting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event waiting. [POS_RET_ERROR_INNER]
+/// - The result of sensor data get processing is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of sensor data get processing is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to reset GPS device.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - This API is only called by Navigation proxy.
+///
+/// \~english @par
+/// Notification of message
+/// - The result of communication with GPS device will be sent by system API message with following format. \n
+/// Command ID : CID_POSIF_REQ_GPS_RESET \n
+/// message structure
+/// \~english @code
+/// typedef struct
+/// {
+/// TG_GPS_RET_RESET data; /* GPS reset status data */
+/// } TG_GPS_RET_RESET_MSG;
+/// @endcode
+/// - message data body structure
+/// \~english @code
+/// typedef struct {
+/// unsigned long ret_rst_status; /* response GPS reset status */
+/// } TG_GPS_RET_RESET;
+/// @endcode
+/// - response GPS reset status(ret_rst_status)
+/// - GPS_SENDOK:acknowledge
+/// - GPS_SENDNG:connection error
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+/// \~english @see
+/// - None
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_ReqGPSReset(HANDLE hApp, PCSTR ResName, uint8_t mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register GPS time setting request delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUFFULL the register count is full
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of \n
+/// the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed in process. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread arrived max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The result from positioning service is SENSOR_RET_ERROR_PARAM. [POS_RET_ERROR_PARAM]
+/// - The result from positioning service is SENSOR_RET_ERROR_BUFFULL. [POS_RET_ERROR_BUFFULL]
+/// - The result from positioning service is SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result from positioning service is not SENSOR_RET_ERROR_PARAM or \n
+/// SENSOR_RET_ERROR_BUFFULL or SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register GPS time setting request delivery. \n
+/// This API will finish when get the return value.
+///
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name has been changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor information will be sent by system \n
+/// API message with following format. \n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ \n
+/// time info structure \n
+/// The year, month, date, hour, minute and second should be the format set to GPS
+/// \~english @code
+/// typedef struct {
+/// uint16_t year; /* A.D.(1~) */
+/// uint8_t month; /* month(1~12) */
+/// uint8_t date; /* date(1~31) */
+/// uint8_t hour; /* hour(0~23) */
+/// uint8_t minute; /* minute(0~59) */
+/// uint8_t second; /* second(0~59) */
+/// uint8_t reserved; /* not used */
+/// } POS_DATETIME;
+/// @endcode
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - None
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_RegisterListenerGPSTimeSetReq(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Temporarily set GPS time from Diag function
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] pstDateTime
+/// - POS_DATETIME * - pointer of GPS time
+///
+/// \~english @par
+/// - POS_DATETIME structure
+/// \~english @code
+/// typedef struct {
+/// uint16_t year; /* A.D.(1~) */
+/// uint8_t month; /* month(1~12) */
+/// uint8_t date; /* date(1~31) */
+/// uint8_t hour; /* hour(0~23) */
+/// uint8_t minute; /* minute(0~59) */
+/// uint8_t second; /* second(0~59) */
+/// uint8_t reserved; /* not used */
+/// } POS_DATETIME;
+/// @endcode
+///
+/// \~english @retval NAVIINFO_RET_NORMAL normal finish
+/// \~english @retval NAVIINFO_RET_ERROR_PARAM parameter error
+/// \~english @retval NAVIINFO_RET_ERROR_INNER internal error
+/// \~english @retval NAVIINFO_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval NAVIINFO_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter pstDateTime is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - GPS time Data size is larger than 144 [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The message queue name has not been registered in control table. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table. [POS_RET_ERROR_INNER]
+/// - GPS time setting message transfer failed. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to set GPS time data to vehicle sensor. \n
+/// This API will finish when get the return value.
+///
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - This API will not notify the result of setting time to GPS device. \n
+/// Return normal only there is no error such as parameter error.
+/// - If want to get the result of setting time to GPS device, use \n
+/// POS_RegisterListnerGpsTime to get GPS time and judge it.
+/// - This API is only called by Diag service.
+/// - While GPS data is receiving from GPS device, the GPS time set by this API is ignored \n
+/// and it is set actual GPS time notified by positioning_hal.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+/// \~english @see
+/// - POS_GetGPStime
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_SetGPStime(HANDLE hApp, POS_DATETIME* pstDateTime);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register GPS time delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified data delivery
+/// - Please note that if the same data delivery has been registered for multiple \n
+/// times, the data will also be deliveried for registered multiple times.
+/// - The specified GPS time information will be deliveried at registered time (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change Specified data will be deliveried only when it changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update Specified data will be deliveried as \n
+/// long as it updated by vehicle sensor.
+///
+/// \~english @retval SENSOR_RET_NORMAL normal finish
+/// \~english @retval SENSOR_RET_ERROR_CREATE_EVENT event creation error
+/// \~english @retval SENSOR_RET_ERROR_PARAM parameter error
+/// \~english @retval SENSOR_RET_ERROR_INNER internal error
+/// \~english @retval SENSOR_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval SENSOR_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of \n
+/// the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) \n
+/// nor change(SENSOR_DELIVERY_TIMING_CHANGE) [SENSOR_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to \n
+/// max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event is created in system, but the count of reference is reach to max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Memory allocate falied during the event table creation for event \n
+/// registering. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The thread can not register in the event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Memory allocate failed in event table during the thread table creation. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - After register the thread table in event table, the event flag register \n
+/// failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event table is full during event creation. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The memory for event HANDLE allocate failed during event table creation. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The thread can not be registered in event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - In event table, try to allocate the memory of the thread table creation, but \n
+/// failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - After register the thread in event table, the event flag has already been \n
+/// registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - After register the thread in event table, the event flag register failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Specified event ID has not been registered in table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Initialize event object failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [SENSOR_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message \n
+/// transfer between processes. [SENSOR_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [SENSOR_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [SENSOR_RET_ERROR_INNER]
+/// - The count of thread arrived max in event management table during event waiting. [SENSOR_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event get. [SENSOR_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event get. [SENSOR_RET_ERROR_INNER]
+/// - The flagID has not been registered during event get. [SENSOR_RET_ERROR_INNER]
+/// - The interruption happened during event get [SENSOR_RET_ERROR_INNER]
+/// - Whatever error happened during event get. [SENSOR_RET_ERROR_INNER]
+/// - Get event timeout. [SENSOR_RET_ERROR_INNER]
+/// - Error happened during event get. [SENSOR_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register GPS time delivery. \n
+/// This API will finish when get the return value.
+///
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name has changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor will send GPS time data \n
+/// as system API message with following format.
+/// - If the register successed, certainly delivery first data. And then \n
+/// delivery data according to the delivery timing.
+/// - Command ID : CID_VEHICLESENS_VEHICLE_INFO_GPS_TIME\n
+/// - SENSOR_MSG_GPSTIME structure
+/// \~english @code
+/// typedef struct {
+/// NAVIINFO_UTCTIME utc; /* UTC time */
+/// uint8_t tdsts; /* time status */
+/// uint8_t reserve[3]; /* reserve */
+/// } SENSOR_MSG_GPSTIME;
+/// @endcode
+/// - time status(tdsts)
+/// - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+/// - 1= time output from RTC Backup(have time adjustment result)
+/// - 2= time adjustment completed
+///
+/// \~english @par
+/// - NAVIINFO_UTCTIME structure
+/// \~english @code
+/// typedef struct {
+/// uint16_t year; /* A.D.(1~) */
+/// uint8_t month; /* month(1~12) */
+/// uint8_t date; /* date(1~31) */
+/// uint8_t hour; /* hour(0~23) */
+/// uint8_t minute; /* minute(0~59) */
+/// uint8_t second; /* second(0~59) */
+/// uint8_t reserved; /* not used */
+/// } POS_DATETIME;
+/// @endcode
+///
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - None
+////////////////////////////////////////////////////////////////////////////////////////////
+SENSOR_RET_API POS_RegisterListenerGPStime(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get GPS time
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] dat
+/// - SENSOR_GPSTIME* - output buffer pointer to store GPS time
+///
+/// \~english @par
+/// - SENSOR_GPSTIME structure
+/// \~english @code
+/// typedef struct {
+/// NAVIINFO_UTCTIME utc; /* UTC time */
+/// uint8_t tdsts; /* date amd time status */
+/// uint8_t reserve[3]; /* reserve */
+/// } SENSOR_GPSTIME;
+/// @endcode
+/// - date amd time status(tdsts)
+/// - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+/// - 1= time output from RTC Backup(have time adjustment result)
+/// - 2= time adjustment completed
+///
+/// \~english @par
+/// - NAVIINFO_UTCTIME structure
+/// \~english @code
+/// typedef struct {
+/// uint16_t year; /* A.D.(1~) */
+/// uint8_t month; /* month(1~12) */
+/// uint8_t date; /* date(1~31) */
+/// uint8_t hour; /* hour(0~23) */
+/// uint8_t minute; /* minute(0~59) */
+/// uint8_t second; /* second(0~59) */
+/// uint8_t reserved; /* not used */
+/// } NAVIINFO_UTCTIME;
+/// @endcode
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter dat is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already \n
+/// been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when semaphore lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when mutex lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when mutex lock. [POS_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when mutex lock. [POS_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_INNER]
+/// - Can not open share memory. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [POS_RET_ERROR_INNER]
+/// - No empty field in share memory. [POS_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message \n
+/// transfer between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread arrived max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing \n
+/// received data. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_INNER]
+/// - The result of sensor data getting process is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of sensor data getting process is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get GPS time from vehicle sensor.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+///
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_SetGPStime
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_GetGPStime(HANDLE hApp, SENSOR_GPSTIME* dat);
+
+#ifdef __cplusplus
+}
+#endif
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_GPS_API_H_
diff --git a/vehicleservice/positioning/client/include/vehicle_service/POS_sensor_API.h b/vehicleservice/positioning/client/include/vehicle_service/POS_sensor_API.h
new file mode 100755
index 0000000..a7a35c4
--- /dev/null
+++ b/vehicleservice/positioning/client/include/vehicle_service/POS_sensor_API.h
@@ -0,0 +1,716 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_SENSOR_API_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_SENSOR_API_H_
+/**
+ * @file POS_sensor_API.h
+ * @brief API definition file for Sensor function
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/POS_define.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* POSITIONING_DID */
+#define POS_DID_SPEED_PULSE 0x80000012 //!< \~english Data ID of speed pulse
+#define POS_DID_SPEED_KMPH 0x80000013 //!< \~english Data ID of KMPH speed
+#define POS_DID_SNS_COUNTER 0x8000001A
+//!< \~english Data ID of sensor counter
+#define POS_DID_GYRO_X 0x80000014 //!< \~english Data ID of X axis gyro
+#define POS_DID_GYRO_Y 0x80000085 //!< \~english Data ID of Y axis gyro
+#define POS_DID_GYRO_Z 0x80000086 //!< \~english Data ID of Z axis gyro
+#define POS_DID_GYRO POS_DID_GYRO_X
+//!< \~english Data ID of POS_DID_GYRO is same as POS_DID_GYRO_X
+#define POS_DID_GSNS_X 0x80000015 //!< \~english Data ID of x axis gsensor
+#define POS_DID_GSNS_Y 0x80000016 //!< \~english Data ID of Y axis gsensor
+#define POS_DID_GSNS_Z 0x80000026 //!< \~english Data ID of Z axis gsensor
+#define POS_DID_REV 0x80000017 //!< \~english Data ID of reverse signal
+#define POS_DID_GPS_ANTENNA 0x80000019
+//!< \~english Data ID of GPS antenna status
+#define POS_DID_SPEED_PULSE_FST 0x80000028
+//!< \~english Data ID of first time speed pulse
+#define POS_DID_GYRO_X_FST 0x80000029 //!< \~english Data ID of first time X axis gyro
+#define POS_DID_GYRO_Y_FST 0x80000043 //!< \~english Data ID of first time Y axis gyro
+#define POS_DID_GYRO_Z_FST 0x80000023 //!< \~english Data ID of first time Z axis gyro
+#define POS_DID_GYRO_FST POS_DID_GYRO_X_FST
+//!< \~~english Data ID of POS_DID_GYRO_FST is same as POS_DID_GYRO_X_FST
+#define POS_DID_REV_FST 0x8000007E
+//!< \~english Data ID of first time reverse signal
+#define POS_DID_GYRO_TEMP 0x80000090 //!< \~english Data ID of gyro temperature
+#define POS_DID_GYRO_TEMP_FST 0x80000091
+//!< \~english Data ID of first time gyro temperature
+#define POS_DID_GSNS_X_FST 0x80000087
+//!< \~english Data ID of first time x axis gsensor
+#define POS_DID_GSNS_Y_FST 0x80000088
+//!< \~english Data ID of first time Y axis gsensor
+#define POS_DID_GSNS_Z_FST 0x80000089
+//!< \~english Data ID of first time Z axis gsensor
+#define POS_DID_PULSE_TIME 0x8000003A //!< \~english Data ID of pulse time
+
+#define POS_DID_GPS__CWORD82__NMEA 0x80000030U
+//!< \~english Data ID of _CWORD82_ GPS NMEA sentence
+#define POS_DID_GPS__CWORD82___CWORD44_GP4 0x80000031U
+//!< \~english Data ID of _CWORD82_ GPS _CWORD44_GP4 data
+#define POS_DID_GPS__CWORD82__FULLBINARY 0x80000032U
+//!< \~english Data ID of _CWORD82_ GPS full binary data
+#define POS_DID_GPS_NMEA 0x8000009AU
+//!< \~english Data ID of GPS NMEA sentence
+#define POS_DID_GPS_CLOCK_DRIFT 0x800000B3U
+//!< \~english Data ID of GPS time drift data
+#define POS_DID_GPS_CLOCK_FREQ 0x800000B4U
+//!< \~english Data ID of GPS time frequency data
+
+/**
+ * \~english @brief Delivery sensor extra package command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_PKG_SENSOR_DATA, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_PKG_SENSOR_DATA 0x0700
+
+/**
+ * \~english @brief Delivery sensor information command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_SENSOR_DATA, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_SENSOR_DATA 0x0200
+
+#define SENSOR_MSGBUF_DSIZE 4096
+//!< \~english message body maximum size
+
+#define SENSOR_VSHEAD_DSIZE 36
+//!< \~english vehicle sensor header size(1+3+16*2)
+
+#define SENSOR_VSINFO_DSIZE (SENSOR_MSGBUF_DSIZE - SENSOR_VSHEAD_DSIZE)
+//!< \~english vehicle sensor data size
+
+// Same name/value is defined, but client doesn't include HAL header.
+// It defines SENSOR_MSG_VSINFO_DSIZE if not included HAL.
+#ifndef HAL_API_POSITIONING_HAL_H_
+#define SENSOR_MSG_VSINFO_DSIZE 1904u
+//!< \~english vehicle sensor message body maximum size
+#endif
+
+#define SENSOR_PKG_DELIVERY_MAX 16
+//!< \~english number of data ID per a package
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @struct SENSOR_PKG_MSG_VSINFO
+ * \~english positioning sensor notification message (to User)
+ */
+typedef struct {
+ uint8_t ucDNum; //!< \~english number of data
+ uint8_t ucDataBreak; //!< \~english data lack infomation
+ uint8_t ucDivideCnt; //!< \~english total partition
+ uint8_t ucDivideSendCnt; //!< \~english partition transmit count
+ uint16_t usOffset[SENSOR_PKG_DELIVERY_MAX]; //!< \~english offset
+ uint8_t ucData[SENSOR_VSINFO_DSIZE]; //!< \~english data body
+} SENSOR_PKG_MSG_VSINFO;
+
+/**
+ * @struct SENSOR_MSG_VSINFO
+ * \~english message delivery positioning sensor information
+ */
+typedef struct {
+ DID did; //!< \~english data ID
+ uint16_t size; //!< \~english data size
+ uint8_t rcvFlag; //!< \~english reception flag
+ uint8_t reserve; //!< \~english reserve
+ uint8_t data[SENSOR_MSG_VSINFO_DSIZE]; //!< \~english data body
+} SENSOR_MSG_VSINFO;
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+/* SENSOR_API public API */
+#ifdef __cplusplus
+extern "C" {
+#endif
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Send the extra package when first delivery.
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucPkgNum
+/// - uint8_t - data number in package(1 to 16)
+/// \~english @param [in] pulDid
+/// - DID * - buffer pointer of the data ID array in package
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+///
+/// \~english @par
+/// - data number in package(ucPkgNum) \n
+/// The following 8 data ID can be registered. And the register data number range is 1~16.
+/// - buffer pointer of the data ID array in package(pulDid) \n
+/// The data ID set to the first in pulDid is the delivery key. \n
+/// If the data ID not one of the following be set, return SENSOR_RET_ERROR_PARAM.
+/// - POS_DID_SNS_COUNTER - sensor counter
+/// - POS_DID_GYRO_X - gyro output (X axis)
+/// - POS_DID_GYRO_Y - gyro output (Y axis)
+/// - POS_DID_GYRO_Z - gyro output (Z axis)
+/// - POS_DID_SPEED_PULSE - speed pulse
+/// - POS_DID_REV - REV signal(0:forward 1:backward)
+/// - POS_DID_GSNS_X - Gsensor output X axis
+/// - POS_DID_GSNS_Y - Gsensor output Y axis
+/// - POS_DID_GSNS_Z - Gsensor output Z axis
+/// - POS_DID_GYRO_TEMP - gyro temperature
+/// - POS_DID_PULSE_TIME - pulse time\n
+/// \~english @par
+/// - Because positioning is G/W between Navi and HAL, value depends on the design of HAL.
+/// \~english @par
+/// - Note:The Gsensor output is 0 in the environment without Gsensor hardware.\n
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified LonLat delivery
+/// - Please note that if the same data delivery has been registered for multiple times, \n
+/// the data will also be deliveried for registered multiple times.
+/// - The specified LonLat will be deliveried at register time no matter what delivery \n
+/// timing has been registered (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change Specified LonLat be deliveried only when it is changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update Specified Lonlat be deliveried as long as \n
+/// it is updated by vehicle sensor.
+///
+///
+/// \~english @retval SENSOR_RET_NORMAL normal end
+/// \~english @retval SENSOR_RET_ERROR_CREATE_EVENT event create failed
+/// \~english @retval SENSOR_RET_ERROR_PARAM parameter error
+/// \~english @retval SENSOR_RET_ERROR_INNER internal error
+/// \~english @retval SENSOR_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval SENSOR_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization \n
+/// (FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher for App are completed.
+/// - Availability of service positioning is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) \n
+/// nor change(SENSOR_DELIVERY_TIMING_CHANGE) [SENSOR_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucPkgNum is 0 or it is larger than 16 [SENSOR_RET_ERROR_PARAM]
+/// - The parameter pulDid is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The data ID in paramter buffer pulDid is not avaliable value [SENSOR_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The event has been registered in event table and created in same process, \n
+/// but the count of reference is reach to max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table and created in system, but the \n
+/// count of reference is reach to max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but memory for the thread event table \n
+/// creation allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but the thread can not be registered in \n
+/// event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but memory for thread table creation \n
+/// allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, and the event flag has already been \n
+/// registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, and the event flag register failed. \n
+/// [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - No empty field for registering the event HANDLE into event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Memory for event HANDLE get failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table and not finished registering \n
+/// [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and memory for thread table \n
+/// creation allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and the event flag has already been \n
+/// registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and the event flag register failed. \n
+/// [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - ProcessNo has not been registered in message control table when message transfered \n
+/// between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered in process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed in process. [SENSOR_RET_ERROR_INNER]
+/// - The destination process name is NULL. [SENSOR_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [SENSOR_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [SENSOR_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event \n
+/// waiting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The count of thread is reach to max in event management table during event \n
+/// waiting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The ID of message event queue has not been created during event getting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The flagID has not been registered during event getting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The interruption happened during event getting [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Whatever error happened during event getting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Got event is SENSOR_RET_ERROR_INNER. [SENSOR_RET_ERROR_INNER]
+///
+/// \~english @par Detial
+/// - Call this API to register vehicle sensor data delivery. \n
+/// This API return the result of registering. \n
+/// The data from sensor data received to registering will be deliveried. \n
+/// The first delivery data is the sensor data(max 64 number of sensor counter, \n
+/// reverse signal,gyro temperature, max 640 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis), \n
+/// speed pulse,Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis), max 2048 number of pulse time) in 6.4 second. \n
+/// If the data number is more than max number, delivery the data in newest 6.4 second. \n
+/// If the sensor data accumulated more than max number, set VEHICLE_SNS_BREAK to data missing information. \n
+/// If sensor data number is more than the data number send in one time(10 number of \n
+/// sensor counter,reverse signal,gyro temperature, 100 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis), \n
+/// speed pulse, Gsensor output(X axis),Gsensor output(Y axis), Gsensor output(Z axis), 320 number of pulse time), \n
+/// the old data is divided into partitions(every partition with 10 number of sensor counter, \n
+/// reverse signal,gyro temperature, 100 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis), \n
+/// speed pulse,Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis), 320 number of pulse time) to delivery. \n
+/// The last message for first delivery is the message that the partition count equal to partition No. \n
+/// After first delivery, the message data(1 number of sensor counter,reverse signal, \n
+/// gyro temperature, 10 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis),speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis), 32 number of pulse time) deliveried. \n
+/// And because the data missing information, divided partition count, \n
+/// diveided partition No is not used, they will be set to 0 in message.\n
+/// (sample)The sensor data in 6.4 second divided to delivery
+/// - 1st message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7, divided partition No=1)
+/// - 2nd message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7, divided partition No=2)
+/// - 3rd message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7,divided partition No=3)
+/// - 4th message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7,divided partition No=4)
+/// - 5th message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7,divided partition No=5)
+/// - 6th message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7,divided partition No=6)
+/// - 7th message(sensor counter, reverse signal, gyro temperature=4 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=40 number, pulse time=128 number), divided \n
+/// partition count=7,divided partition No=7)
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After delivery the sensor data accumulated in 6.4 second(first delivery), the sensor data \n
+/// will not be accumulated any more. So the same data will be deliveried as first \n
+/// delivery when registered again.
+/// - This API is only called by Navi proxy.
+/// - After call this API, if the delivery destination thread name is changed, please call this API again.
+///
+/// \~english @par
+/// message structure
+/// - After success to register, vehicle sensor will send message as system API message with following format.
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_PKG_SENSOR_DATA \n
+/// Definition of structure
+/// \~english @code
+/// #define SENSOR_MSGBUF_DSIZE 4096 /* max size of message body */
+/// #define SENSOR_VSHEAD_DSIZE 36 /* vehicle sensor header size(1+3+16*2) */
+/// #define SENSOR_PKG_DELIVERY_MAX 16 /* max number of Data ID in package */
+/// #define SENSOR_VSINFO_DSIZE (SENSOR_MSGBUF_DSIZE - SENSOR_VSHEAD_DSIZE)
+/// typedef struct {
+/// uint8_t ucDNum; /* number of data */
+/// uint8_t ucDataBreak; /* data missing information */
+/// uint8_t ucDivideCnt; /* divided partition count */
+/// uint8_t ucDivideSendCnt; /* divided partition No. */
+/// uint16_t usOffset[SENSOR_PKG_DELIVERY_MAX]; /* offset */
+/// uint8_t ucData[SENSOR_VSINFO_DSIZE]; /* vehicle sensor data */
+/// } SENSOR_PKG_MSG_VSINFO;
+/// @endcode
+/// - number of data \n
+/// Data number in package
+/// - data missing information \n
+/// VEHICLE_SNS_BREAK:not continuous data \n
+/// VEHICLE_SNS_NORMAL:continuous data
+/// - divided partition count \n
+/// All divided partition count \n
+/// If it is more than 1, data divided to delivery
+/// - divided partition No. \n
+/// The No. of the divided partition. If it equal to the divided partition count, \n
+/// that meanings this message is the last divided partition of the package.
+/// - offset \n
+/// The array of the offset from the head of vehicle sensor data
+/// - vehicle sensor data
+/// - Data ID(4Byte)
+/// - Data size(2Byte)
+/// - reception flag(1Byte)
+/// - If the data get from CAN, direct line, GPS, set to 0x01
+/// - If data has not been received, set to 0x00
+/// - reserve(1Byte)\n
+/// - Data body is cycle fit with the packaged data.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - POS_RegisterListenerSensData, POS_GetSensData
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+SENSOR_RET_API POS_RegisterListenerPkgSensData(HANDLE hApp, PCSTR notifyName, uint8_t ucPkgNum, DID *pulDid,
+ uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register sensor data delivery.
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ulDid
+/// - DID - Data ID of vehicle info
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+///
+/// \~english @par
+/// - Data ID of vehicle info(ulDid) \n
+///
+/// \~english @par
+/// - Note:The Gsensor output is 0 in the environment without Gsensor hardware.
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified LonLat delivery
+/// - Please note that if the same data delivery has been registered for multiple times, \n
+/// the data will also be deliveried for registered multiple times.
+/// - The specified LonLat will be deliveried at register time no matter what delivery \n
+/// timing has been registered (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change Specified LonLat be deliveried only when it is changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update Specified Lonlat be deliveried \n
+/// as long as it is updated by vehicle sensor.
+///
+/// \~english @retval SENSOR_RET_NORMAL normal end
+/// \~english @retval SENSOR_RET_ERROR_CREATE_EVENT event create failed
+/// \~english @retval SENSOR_RET_ERROR_PARAM parameter error
+/// \~english @retval SENSOR_RET_ERROR_INNER internal error
+/// \~english @retval SENSOR_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval SENSOR_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of service positioning is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter ucDeliveryTiming is neither update \n
+/// (SENSOR_DELIVERY_TIMING_UPDATE) nor change(SENSOR_DELIVERY_TIMING_CHANGE) [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [SENSOR_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ulDID is not avaliable value [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ulDID is a value can not specified [SENSOR_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to \n
+/// max [SENSOR_RET_ERROR_RESOURCE]
+/// - The event has been registered in event table and created in same process, \n
+/// but the count of reference is reach to max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table and created in system, but the count \n
+/// of reference is reach to max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but memory for the thread event table \n
+/// creation allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but the thread can not be registered \n
+/// in event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but memory for thread table creation \n
+/// allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, and the event flag has already been \n
+/// registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, and the event flag register failed. \n
+/// [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - No empty field for registering the event HANDLE into event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Memory for event HANDLE get failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table and not finished registering \n
+/// [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and memory for thread table \n
+/// creation allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and the event flag has already \n
+/// been registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and the event flag register \n
+/// failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - ProcessNo has not been registered in message control table when message transfered \n
+/// in process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered in process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed in process. [SENSOR_RET_ERROR_INNER]
+/// - The destination process name is NULL. [SENSOR_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message \n
+/// transfer between process. [SENSOR_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed between process. [SENSOR_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during waiting \n
+/// event. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The count of thread is reach to max in event management table during waiting \n
+/// event. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The EV_FLAG_BIT is not set in flagID during getting event. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The ID of message event queue has not been created during getting event. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The flagID has not been registered during getting event. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The interruption happened during getting event [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Whatever error happened during getting event. [SENSOR_RET_ERROR_CREATE_EVENT]
+///
+/// \~english @par Detial
+/// - Call this API to register vehicle sensor data delivery. \n
+/// This API return the result of registering.
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name is changed, please call this API again.
+///
+/// \~english @par
+/// message structure
+/// - After success to register, vehicle sensor will send message as system API message with following format.
+/// - If the register successed, certainly delivery first data. And then delivery data according to
+/// the delivery timing. \n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_SENSOR_DATA \n
+///
+/// \~english @code
+/// #define SENSOR_MSG_VSINFO_DSIZE 1904 /* max size of message body */
+/// typedef struct
+/// {
+/// DID did; /* data ID */
+/// uint16_t size; /* data size of vehicle sensor data */
+/// uint8_t rcvFlag; /* reception flag */
+/// uint8_t reserve; /* reserve */
+/// uint8_t data[SENSOR_MSG_VSINFO_DSIZE]; /* vehicle sensor data */
+/// } SENSOR_MSG_VSINFO;
+/// @endcode
+/// - reception flag(1Byte)
+/// - If the data get from CAN or direct line, set to 0x01
+/// - If data has not been received, set to 0x00
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - POS_RegisterListenerPkgSensData, POS_GetSensData
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+SENSOR_RET_API POS_RegisterListenerSensData(HANDLE hApp, PCSTR notifyName, DID ulDid, uint8_t ucCtrlFlg,
+ uint8_t ucDeliveryTiming);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get vehicle sensor data.
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] ulDid
+/// - DID - Data ID of vehicle info
+/// \~english @param [out] pDestData
+/// - void* - pointer of buffer for storing vehicle sensor data
+/// \~english @param [in] usDestSize
+/// - uint16_t - vehicle sensor data buffer size
+///
+/// \~english @par
+/// - Data ID of vehicle info(ulDid)
+/// - POS_DID_SPEED_PULSE - speed pulse(count of pulse)
+/// - POS_DID_GYRO_X - gyro output (X axis)
+/// - POS_DID_GYRO_Y - gyro output (Y axis)
+/// - POS_DID_GYRO_Z - gyro output (Z axis)
+/// - POS_DID_GSNS_X - Gsensor output (X axis)
+/// - POS_DID_GSNS_Y - Gsensor output (Y axis)
+/// - POS_DID_GSNS_Z - Gsensor output (Z axis)
+/// - POS_DID_GPS_ANTENNA - GPS antenna connection status
+/// - POS_DID_GPS__CWORD82__NMEA - GPS NMEA(_CWORD82_)
+/// - POS_DID_GPS__CWORD82__FULLBINARY - GPS _CWORD82_ full binary(_CWORD82_)
+/// - POS_DID_GPS_NMEA - GPS NMEA
+/// - POS_DID_GYRO_TEMP - gyro temperature
+/// - POS_DID_GPS_CLOCK_DRIFT - GPS clock drift
+/// - POS_DID_GPS_CLOCK_FREQ - GPS clock frequency
+/// - The avaliable data ID of each hardware type is as following.
+/// \~english @par
+/// - Because positioning is G/W between Navi and HAL, value depends on the design of HAL.
+/// \~english @par
+/// - Note:The Gsensor output is 0 in the environment without Gsensor hardware.
+/// - vehicle sensor data buffer size(usDestSize) \n
+/// Please note it is the size of output buffer, not the size of data.
+///
+/// \~english @retval more than 0 data size
+/// \~english @retval POS_RET_ERROR_CREATE_EVENT event create failed
+/// \~english @retval POS_RET_ERROR_OUTOF_MEMORY share memory guarantee failed
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_SIZE buffer size error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of service positioning is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter pDestData is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter ulDid is not avaliable value in current hardware environment [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max \n
+/// [POS_RET_ERROR_CREATE_EVENT]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_CREATE_EVENT]
+/// - Memory allocate falied during the event table creation for \n
+/// event registering. [POS_RET_ERROR_CREATE_EVENT]
+/// - The thread can not register in the event table. [POS_RET_ERROR_CREATE_EVENT]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_CREATE_EVENT]
+/// - After register the thread table in event table, the event flag has already \n
+/// been registered. [POS_RET_ERROR_CREATE_EVENT]
+/// - After register the thread table in event table, the event flag register \n
+/// failed. [POS_RET_ERROR_CREATE_EVENT]
+/// - The event table is full during event creation. [POS_RET_ERROR_CREATE_EVENT]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_CREATE_EVENT]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_CREATE_EVENT]
+/// - In event table, to allocate the memory of the thread table creation, \n
+/// but failed. [POS_RET_ERROR_CREATE_EVENT]
+/// - After register the thread in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_CREATE_EVENT]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_CREATE_EVENT]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_CREATE_EVENT]
+/// - Initialize event object failed. [POS_RET_ERROR_CREATE_EVENT]
+/// - There is no empty field in semaphore table for semaphore creation [POS_RET_ERROR_OUTOF_MEMORY]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Specified semaphore ID has not been registered when semaphore lock. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Internal mutex HANDLE is NULL when mutex lock. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Internal mutex HANDLE has not been registered in mutex table when mutex lock. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - The owner of specified mutex is not itself when mutex lock. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Mutex has been multiple locked [POS_RET_ERROR_OUTOF_MEMORY]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Can not get usable share memory address. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Can not open share memory. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Failed to mapping share memory. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - No empty field in share memory. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - Message transfer failed between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - The destination process name size is larger than 20 characters when message \n
+/// transfer between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - Message transfer HANDLE create failed when message transfered between processes. \n
+/// [POS_RET_ERROR_CREATE_EVENT]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - Message transfer failed between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event waiting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event waiting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event waiting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event waiting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during getting event. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during getting event. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during getting event. [POS_RET_ERROR_INNER]
+/// - The interruption happened during getting event [POS_RET_ERROR_INNER]
+/// - Whatever error happened during getting event. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing \n
+/// received data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Memory for share memory management allocate failed for accessing received \n
+/// data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Can not get share memory normally [POS_RET_ERROR_OUTOF_MEMORY]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_SIZE]
+///
+/// \~english @par Detial
+/// - Call this API to get vehicle sensor data. \n
+/// This vehicle sensor data stored in the output buffer of the parameter, this API return.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_RegisterListenerPkgSensData, POS_RegisterListenerSensData
+///
+
+POS_RET_API POS_GetSensData(HANDLE hApp, DID ulDid, void *pDestData, uint16_t usDestSize);
+
+#ifdef __cplusplus
+}
+#endif
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_SENSOR_API_H_
diff --git a/vehicleservice/positioning/client/include/vehicle_service/positioning.h b/vehicleservice/positioning/client/include/vehicle_service/positioning.h
new file mode 100755
index 0000000..a5a1e56
--- /dev/null
+++ b/vehicleservice/positioning/client/include/vehicle_service/positioning.h
@@ -0,0 +1,46 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+
+#ifndef VEHICLESERVICE_POSITIONING_H_ // NOLINT(build/header_guard)
+#define VEHICLESERVICE_POSITIONING_H_ // NOLINT(build/header_guard)
+
+/**
+ * @file positioning.h
+ * @brief Common header of positioning
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/POS_gps_API.h>
+#include <vehicle_service/POS_common_API.h>
+
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // VEHICLESERVICE_POSITIONING_H_
diff --git a/vehicleservice/positioning/client/src/POS_common_API/Common_API.cpp b/vehicleservice/positioning/client/src/POS_common_API/Common_API.cpp
new file mode 100755
index 0000000..f266dec
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_common_API/Common_API.cpp
@@ -0,0 +1,889 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * Common_API.cpp
+ * @brief
+ * Module : POSITIONING
+ * Common I/F service functionality
+ */
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/POS_common_API.h>
+#include "POS_common_private.h"
+#include "Vehicle_API_private.h"
+#include "POS_private.h"
+
+/**
+ * @brief
+ * Latitude and longitude informationDelivery registration
+ *
+ * Registering Latitude and Longitude Information Delivery
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] notifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating)
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_BUFFULL Buffer-full<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg, // NOLINT(readability/nolint)
+ uint8_t ucDeliveryTiming, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ SENSOR_RET_API ret_sens = SENSOR_RET_NORMAL; /* API return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_LOCATION_LONLAT; /* Data ID */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ucCtrlFlg != SENSOR_DELIVERY_REGIST) {
+ /* Parameters other than delivery registration are terminated abnormally when delivery control is terminated. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* If the thread name is NULL, it terminates with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ if (ucGetMethod == SENSOR_GET_METHOD_GPS) {
+ did = VEHICLE_DID_LOCATION_LONLAT;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_LOCATION_LONLAT_NAVI;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Delivery registration */
+ if (ret == POS_RET_NORMAL) {
+ /* Delivery registry SensorAPI calls */
+ ret_sens = PosRegisterListenerProc(notifyName, /* Destination thread name */
+ did, /* Data ID */
+ ucCtrlFlg, /* Delivery control */
+ ucDeliveryTiming); /* Delivery timing */
+
+ /* Decision of delivery registration result */
+ if (ret_sens == SENSOR_RET_NORMAL) {
+ ret = POS_RET_NORMAL;
+ } else if (ret_sens == SENSOR_RET_ERROR_PARAM) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ret_sens == SENSOR_RET_ERROR_BUFFULL) {
+ ret = POS_RET_ERROR_BUFFULL;
+ } else if (ret_sens == SENSOR_RET_ERROR_RESOURCE) {
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Altitude information delivery registration
+ *
+ * Register for the delivery of altitude information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] notifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating)
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_RegisterListenerAltitude(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg, // NOLINT(readability/nolint)
+ uint8_t ucDeliveryTiming, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ SENSOR_RET_API ret_sens = SENSOR_RET_NORMAL; /* API return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_LOCATION_ALTITUDE; /* Data ID */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ucCtrlFlg != SENSOR_DELIVERY_REGIST) {
+ /* Parameters other than delivery registration are terminated abnormally when delivery control is terminated. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* If the thread name is NULL, it terminates with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ if ((ucGetMethod == SENSOR_GET_METHOD_GPS) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_LOCATION_ALTITUDE;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Delivery registration */
+ if (ret == POS_RET_NORMAL) {
+ /* Delivery registry SensorAPI calls */
+ ret_sens = PosRegisterListenerProc(notifyName, /* Destination thread name */
+ did, /* Data ID */
+ ucCtrlFlg, /* Delivery control */
+ ucDeliveryTiming); /* Delivery timing */
+
+ /* Decision of delivery registration result */
+ if (ret_sens == SENSOR_RET_NORMAL) {
+ ret = POS_RET_NORMAL;
+ } else if (ret_sens == SENSOR_RET_ERROR_PARAM) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ret_sens == SENSOR_RET_ERROR_BUFFULL) {
+ ret = POS_RET_ERROR_BUFFULL;
+ } else if (ret_sens == SENSOR_RET_ERROR_RESOURCE) {
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Vehicle Speed Information Transmission Registration
+ *
+ * Register delivery of vehicle speed information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] notifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating)
+ * @param[in] ucGetMethod uint8_t - Acquisition method(POS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_BUFFULL Buffer-full<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_RegisterListenerSpeed(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg, // NOLINT(readability/nolint)
+ uint8_t ucDeliveryTiming, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ SENSOR_RET_API ret_sens = SENSOR_RET_NORMAL; /* API return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did; /* Data ID */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ucCtrlFlg != SENSOR_DELIVERY_REGIST) {
+ /* Parameters other than delivery registration are terminated abnormally when delivery control is terminated. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* If the thread name is NULL, it terminates with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ if (ucGetMethod == SENSOR_GET_METHOD_POS) {
+ did = VEHICLE_DID_MOTION_SPEED_INTERNAL;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_MOTION_SPEED_NAVI;
+ } else {
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Delivery registration */
+ if (ret == POS_RET_NORMAL) {
+ /* Delivery registry SensorAPI calls */
+ ret_sens = PosRegisterListenerProc(notifyName, /* Destination thread name */
+ did, /* Data ID */
+ ucCtrlFlg, /* Delivery control */
+ ucDeliveryTiming); /* Delivery timing */
+
+ /* Decision of delivery registration result */
+ if (ret_sens == SENSOR_RET_NORMAL) {
+ ret = POS_RET_NORMAL;
+ } else if (ret_sens == SENSOR_RET_ERROR_PARAM) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ret_sens == SENSOR_RET_ERROR_BUFFULL) {
+ ret = POS_RET_ERROR_BUFFULL;
+ } else if (ret_sens == SENSOR_RET_ERROR_RESOURCE) {
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Compass Information Transmission Register
+ *
+ * Register the delivery of the vehicle orientation information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] notifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating)
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg, // NOLINT(readability/nolint)
+ uint8_t ucDeliveryTiming, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ SENSOR_RET_API ret_sens = SENSOR_RET_NORMAL; /* API return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_MOTION_HEADING; /* TODO VEHICLE_DID_LOCATION_HEADING Missing */
+ /* Data ID */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ucCtrlFlg != SENSOR_DELIVERY_REGIST) {
+ /* Parameters other than delivery registration are terminated abnormally when delivery control is terminated. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* If the thread name is NULL, it terminates with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ if (ucGetMethod == SENSOR_GET_METHOD_GPS) {
+ did = VEHICLE_DID_MOTION_HEADING;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_MOTION_HEADING_NAVI;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Delivery registration */
+ if (ret == POS_RET_NORMAL) {
+ /* Delivery registry SensorAPI calls */
+ ret_sens = PosRegisterListenerProc(notifyName, /* Destination thread name */
+ did, /* Data ID */
+ ucCtrlFlg, /* Delivery control */
+ ucDeliveryTiming); /* Delivery timing */
+
+ /* Decision of delivery registration result */
+ if (ret_sens == SENSOR_RET_NORMAL) {
+ ret = POS_RET_NORMAL;
+ } else if (ret_sens == SENSOR_RET_ERROR_PARAM) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ret_sens == SENSOR_RET_ERROR_BUFFULL) {
+ ret = POS_RET_ERROR_BUFFULL;
+ } else if (ret_sens == SENSOR_RET_ERROR_RESOURCE) {
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Get Lltitude and longitude information
+ *
+ * Get Lltitude and longitude information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] dat SENSORLOCATION_LONLATINFO_DAT* - Pointer to the acquired latitude/longitude information storage destination
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment<br>
+ * POS_RET_ERROR_INNER Internal error
+ *
+ */
+POS_RET_API POS_GetLonLat(HANDLE hApp, // NOLINT(readability/nolint)
+ SENSORLOCATION_LONLATINFO_DAT *dat, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_LOCATION_LONLAT; /* DID */
+ int32_t ret_get_proc; /* POS_GetProc Return Values */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (dat == NULL) {
+ /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ if (ucGetMethod == SENSOR_GET_METHOD_GPS) {
+ did = VEHICLE_DID_LOCATION_LONLAT;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_LOCATION_LONLAT_NAVI;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Sensor information acquisition */
+ if (ret == POS_RET_NORMAL) {
+ /* Data acquisition process */
+ ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORLOCATION_LONLATINFO_DAT));
+ if (static_cast<int32_t>(sizeof(SENSORLOCATION_LONLATINFO_DAT)) > ret_get_proc) {
+ /* Failed to acquire */
+ if (ret_get_proc == POS_RET_ERROR_RESOURCE) {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Altitude information acquisition
+ *
+ * Obtain altitude information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] dat SENSORLOCATION_ALTITUDEINFO_DAT* - Pointer to the acquired altitude information storage destination
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment<br>
+ * POS_RET_ERROR_INNER Internal error
+ *
+ */
+POS_RET_API POS_GetAltitude(HANDLE hApp, // NOLINT(readability/nolint)
+ SENSORLOCATION_ALTITUDEINFO_DAT *dat, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_LOCATION_ALTITUDE; /* DID */
+ int32_t ret_get_proc; /* POS_GetProc Return Values */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (dat == NULL) {
+ /* If the altitude data is NULL, it terminates with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ if ((ucGetMethod == SENSOR_GET_METHOD_GPS) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_LOCATION_ALTITUDE;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+ /* Sensor information acquisition */
+ if (ret == POS_RET_NORMAL) {
+ /* Data acquisition process */
+ ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+ if (static_cast<int32_t>(sizeof(SENSORLOCATION_ALTITUDEINFO_DAT)) > ret_get_proc) {
+ /* Failed to acquire */
+ if (ret_get_proc == POS_RET_ERROR_RESOURCE) {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Vehicle Speed Information Acquisition
+ *
+ * Obtain vehicle speed information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] dat SENSORMOTION_SPEEDINFO_DAT* - Pointer to the acquired car speed information storage destination
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment<br>
+ * POS_RET_ERROR_INNER Internal error
+ *
+ */
+POS_RET_API POS_GetSpeed(HANDLE hApp, // NOLINT(readability/nolint)
+ SENSORMOTION_SPEEDINFO_DAT *dat, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did; /* Data ID */
+ int32_t ret_get_proc; /* POS_GetProc Return Values */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+ if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [hApp = %p]", hApp);
+ } else if (dat == NULL) {
+ /* When the pointer to the vehicle speed data storage destination is NULL, the pointer terminates with an error in the parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [dat = %p]", dat);
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ if (ucGetMethod == SENSOR_GET_METHOD_POS) {
+ did = VEHICLE_DID_MOTION_SPEED_INTERNAL;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_MOTION_SPEED_NAVI;
+ } else {
+ /* End as a parameter error abnormality except for POS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Argument ERROR [type = %d, ucGetMethod = %d]",
+ type, ucGetMethod);
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "GetEnvSupportInfo ERROR [type = %d]", type);
+ }
+ }
+
+ if (ret == POS_RET_NORMAL) {
+ /* Data acquisition process */
+ ret_get_proc = PosGetProc(did, dat, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+ if (static_cast<int32_t>(sizeof(SENSORMOTION_SPEEDINFO_DAT)) > ret_get_proc) {
+ /* Failed to acquire */
+ if (ret_get_proc == POS_RET_ERROR_RESOURCE) {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Compass information acquisition
+ *
+ * Get Bill Direction Information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] dat SENSORMOTION_HEADINGINFO_DAT* - Pointer to the acquired altitude information storage destination
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment<br>
+ * POS_RET_ERROR_INNER Internal error
+ *
+ */
+POS_RET_API POS_GetHeading(HANDLE hApp, // NOLINT(readability/nolint)
+ SENSORMOTION_HEADINGINFO_DAT *dat, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_MOTION_HEADING; /* Data ID */
+ int32_t ret_get_proc; /* POS_GetProc Return Values */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (dat == NULL) {
+ /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ if (ucGetMethod == SENSOR_GET_METHOD_GPS) {
+ did = VEHICLE_DID_MOTION_HEADING;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_MOTION_HEADING_NAVI;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+ /* Sensor information acquisition */
+ if (ret == POS_RET_NORMAL) {
+ /* Data acquisition process */
+ ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORMOTION_HEADINGINFO_DAT));
+ if (static_cast<int32_t>(sizeof(SENSORMOTION_HEADINGINFO_DAT)) > ret_get_proc) {
+ /** Failed to acquire */
+ if (ret_get_proc == POS_RET_ERROR_RESOURCE) {
+ /** Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Vehicle speed information setting
+ *
+ * Setting Vehicle Speed Information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] navispped uint16_t - Vehicle speed information[Unit:1.0km/h]
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_SetSpeedInfo(HANDLE hApp, uint16_t navispeed) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ uint16_t speed; /* Vehicle speed */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if (hApp == NULL) {
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == POS_RET_NORMAL) {
+ /* Adjustment by unit [1.0km/h]->[0.01m/sec] */
+ speed = static_cast<uint16_t>(navispeed * 10000 / 360);
+ /* Data setting(After setting,Immediate termination) */
+ ret = PosSetProc(VEHICLE_DID_MOTION_SPEED_NAVI,
+ reinterpret_cast<void *>(&speed), sizeof(uint16_t), FALSE);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Location information setting
+ *
+ * Set location information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] posData POS_POSDATA - Pointer to location information
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_SetLocationInfo(HANDLE hApp, POS_POSDATA* pstPosData) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((pstPosData == NULL) || (hApp == NULL)) {
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == POS_RET_NORMAL) {
+ /* Data status check */
+ if ((0x01 > pstPosData->status) || (0x0F < pstPosData->status)) {
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Parameter range check */
+ /* Latitude */
+ if ((pstPosData->status & POS_LOC_INFO_LAT) == POS_LOC_INFO_LAT) {
+ (void)POS_CHKPARAM32(pstPosData->latitude, -41472000, 41472000);
+ }
+ /* Longitude */
+ if ((pstPosData->status & POS_LOC_INFO_LON) == POS_LOC_INFO_LON) {
+ (void)POS_CHKPARAM32(pstPosData->longitude, -82944000, 82944000);
+ }
+ /* Orientation */
+ if ((pstPosData->status & POS_LOC_INFO_HEAD) == POS_LOC_INFO_HEAD) {
+ (void)POS_CHKPARAM16(pstPosData->heading, -179, 180);
+ }
+
+ /* Data setting(After setting,Immediate termination) */
+ ret = PosSetProc(VEHICLE_DID_GPS_CUSTOMDATA_NAVI, // == POSHAL_DID_GPS_CUSTOMDATA_NAVI
+ reinterpret_cast<void *>(pstPosData), sizeof(POS_POSDATA), FALSE);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
diff --git a/vehicleservice/positioning/client/src/POS_common_API/Makefile b/vehicleservice/positioning/client/src/POS_common_API/Makefile
new file mode 100755
index 0000000..4d7a90f
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_common_API/Makefile
@@ -0,0 +1,47 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+######### installed shared library(*.so) #############
+INST_SHLIBS = libPOS_common_API
+
+######### compiled sources #############
+libPOS_common_API_SRCS += Common_API.cpp
+
+######### add include path #############
+CPPFLAGS += -I../../../server/include/common
+CPPFLAGS += -I../../include
+CPPFLAGS += -I../../../server/include/nsfw
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lPOS_base_API
+LDLIBS += -Wl,-Bdynamic -lvp
+
+######### add library path #############
+LDFLAGS += -shared
+
+include ../../../../vehicle_service.mk
diff --git a/vehicleservice/positioning/client/src/POS_common_API/libPOS_common_API.ver b/vehicleservice/positioning/client/src/POS_common_API/libPOS_common_API.ver
new file mode 100755
index 0000000..afc7f3a
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_common_API/libPOS_common_API.ver
@@ -0,0 +1,37 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libPOS_common_API version script
+#
+{
+ global:
+ POS_GetAltitude;
+ POS_GetHeading;
+ POS_GetLonLat;
+ POS_GetSpeed;
+ POS_RegisterListenerAltitude;
+ POS_RegisterListenerHeading;
+ POS_RegisterListenerLonLat;
+ POS_RegisterListenerSpeed;
+ POS_SetLocationInfo;
+ POS_SetSpeedInfo;
+
+ POS_SetLocationInfoNmea;
+ local:
+ *;
+};
+
diff --git a/vehicleservice/positioning/client/src/POS_gps_API/Gps_API.cpp b/vehicleservice/positioning/client/src/POS_gps_API/Gps_API.cpp
new file mode 100755
index 0000000..7395f9d
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_gps_API/Gps_API.cpp
@@ -0,0 +1,456 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * Gps_API.cpp
+ * @brief
+ * Module : POSITIONING
+ * GPS I/F service functionality
+ */
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/POS_gps_API.h>
+#include <vehicle_service/POS_common_API.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include "POS_common_private.h"
+#include "POS_private.h"
+#include "Vehicle_API_private.h"
+#include "Gps_API_private.h"
+
+
+/**
+ * @brief
+ * GPS reset request
+ *
+ * Request a GPS reset
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] ResName PCSTR - Destination thread name
+ * @param[in] mode uint8_t - Reset mode
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_INNER Internal processing error<br>
+ * POS_RET_ERROR_BUSY Busy occurrence<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_ReqGPSReset(HANDLE hApp, PCSTR ResName, uint8_t mode) { // NOLINT(readability/nolint)
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ RET_API ret_api = RET_NORMAL; /* API return value */
+ POS_RESETINFO snd_msg; /* Reset information */
+ EventID event_id; /* Event ID */
+ int32_t event_val; /* Event value */
+ PNO my_pno; /* Caller PNO */
+ PNO rs_pno; /* Destination PNO */
+ uint32_t pid; /* Process ID */
+ uint32_t tid; /* Thread ID */
+ char name[128]; /* Name buffer */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((hApp == NULL) || (ResName == NULL)) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (GPS_RST_COLDSTART != mode) {
+ /* Parameter error except */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+
+ if (ret == POS_RET_NORMAL) {
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+ /* Event Generation */
+ rs_pno = _pb_CnvName2Pno(ResName);
+ pid = (uint32_t)getpid();
+ tid = GetTid();
+
+ snprintf(name, sizeof(name), "PR_p%u_t%u", pid, tid);
+ my_pno = _pb_CnvName2Pno(name);
+ event_id = VehicleCreateEvent(my_pno);
+ if (0 != event_id) {
+ /* Successful event generation */
+ memset(&snd_msg, 0x00, sizeof(POS_RESETINFO));
+
+ /* Message creation */
+ snd_msg.mode = mode; /* Reset mode */
+ snd_msg.snd_pno = my_pno; /* Caller PNo. */
+ snd_msg.res_pno = rs_pno; /* Destination PNo. */
+
+ /* Message transmission request */
+ ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_GPS_REQRESET,
+ sizeof(POS_RESETINFO),
+ reinterpret_cast<void*>(&snd_msg), 0);
+
+ if (RET_NORMAL == ret_api) {
+ /* If the data setup process is successful,Wait for a completion event */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN, VEHICLE_RET_NORMAL, &event_val, INFINITE);
+ if (RET_NORMAL != ret_api) {
+ /* When not put in event wait state */
+ /* Event generation failure */
+ ret = POS_RET_ERROR_INNER;
+ } else {
+ /* Return from Event Wait */
+ /* Set event value (processing result) as return value */
+ ret = (POS_RET_API)event_val;
+ }
+ } else {
+ /* Message transmission processing failed */
+ ret = POS_RET_ERROR_INNER;
+ }
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ ret = POS_RET_ERROR_INNER;
+ }
+ } else {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS time setting request delivery registration
+ *
+ * Register delivery of GPS time setting request
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] notifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_BUFFULL Buffer-full<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_RegisterListenerGPSTimeSetReq(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ SENSOR_RET_API ret_sens = SENSOR_RET_NORMAL; /* API return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((hApp == NULL) || (notifyName == NULL)) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (SENSOR_DELIVERY_REGIST != ucCtrlFlg) {
+ /* Parameter error other than delivery registration */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Delivery registration */
+ if (POS_RET_NORMAL == ret) {
+ /* Delivery registry SensorAPI calls */
+ ret_sens = PosRegisterListenerProc(notifyName, /* Destination thread name */
+ VEHICLE_DID_SETTINGTIME, /* Data ID */
+ ucCtrlFlg, /* Delivery control */
+ VEHICLE_DELIVERY_TIMING_UPDATE); /* Delivery timing */
+
+ /* Decision of delivery registration result */
+ if (ret_sens == SENSOR_RET_NORMAL) {
+ ret = POS_RET_NORMAL;
+ } else if (ret_sens == SENSOR_RET_ERROR_PARAM) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ret_sens == SENSOR_RET_ERROR_BUFFULL) {
+ ret = POS_RET_ERROR_BUFFULL;
+ } else if (ret_sens == SENSOR_RET_ERROR_RESOURCE) {
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS time setting
+ *
+ * Set the GPS time
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] pstDateTime POS_DATETIME - Pointer to GPS time information
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_TIMEOUT Timeout error<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_SetGPStime(HANDLE hApp, POS_DATETIME* pstDateTime) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((pstDateTime == NULL) || (hApp == NULL)) {
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == POS_RET_NORMAL) {
+ /* Parameter range check */
+ /* Month */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->month, 1, 12)) {
+ return POS_RET_ERROR_PARAM;
+ }
+ /* Day */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->date, 1, 31)) {
+ return POS_RET_ERROR_PARAM;
+ }
+ /* Hour */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->hour, 0, 23)) {
+ return POS_RET_ERROR_PARAM;
+ }
+ /* Minutes */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->minute, 0, 59)) {
+ return POS_RET_ERROR_PARAM;
+ }
+ /* Second */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->second, 0, 59)) {
+ return POS_RET_ERROR_PARAM;
+ }
+
+ /* Data setting(Immediate recovery)*/
+ ret = PosSetProc(VEHICLE_DID_SETTINGTIME,
+ reinterpret_cast<void*>(pstDateTime), sizeof(POS_DATETIME), FALSE);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS Time Delivery Registration
+ *
+ * Registering GPS time delivery
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] nofifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating)
+ *
+ * @return SENSOR_RET_NORMAL Successful registration<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_BUFFULL FULL of delivery registers<br>
+ * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+SENSOR_RET_API POS_RegisterListenerGPStime(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg, // NOLINT(readability/nolint)
+ uint8_t ucDeliveryTiming) { // NOLINT(readability/nolint)
+ SENSOR_RET_API ret = SENSOR_RET_NORMAL;
+ UNIT_TYPE type = UNIT_TYPE_NONE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ if (hApp == NULL) {
+ /* Parameter error */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = SENSOR_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* fail */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (SENSOR_RET_NORMAL == ret) {
+ if (notifyName == NULL) {
+ /* Parameter error */
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+ if (ucCtrlFlg != SENSOR_DELIVERY_REGIST) {
+ /* Parameter error */
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Parameter error */
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+ }
+
+ if (SENSOR_RET_NORMAL == ret) {
+ /* Delivery registration process */
+ ret = PosRegisterListenerProc(notifyName, VEHICLE_DID_GPS_TIME, ucCtrlFlg, ucDeliveryTiming);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Get GPS time
+ *
+ * Get the GPS time
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] *dat SENSOR_GPSTIME - Pointer to GPS time information
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_GetGPStime(HANDLE hApp, SENSOR_GPSTIME* dat) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_GPS_TIME; /* DID */
+ int32_t ret_get_proc; /* POS_GetProc Return Values */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (dat == NULL) {
+ /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ ret = POS_RET_NORMAL;
+ } else {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Sensor information acquisition */
+ if (ret == POS_RET_NORMAL) {
+ /* Data acquisition process */
+ ret_get_proc = PosGetProc(did, reinterpret_cast<void*>(dat), sizeof(SENSOR_GPSTIME));
+ if (static_cast<int32_t>(sizeof(SENSOR_GPSTIME)) > ret_get_proc) {
+ /* Failed to acquire */
+ if (ret_get_proc == POS_RET_ERROR_RESOURCE) {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+
+ return ret;
+}
diff --git a/vehicleservice/positioning/client/src/POS_gps_API/Makefile b/vehicleservice/positioning/client/src/POS_gps_API/Makefile
new file mode 100755
index 0000000..c6391a9
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_gps_API/Makefile
@@ -0,0 +1,51 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+######### installed shared library(*.so) #############
+INST_SHLIBS = libPOS_gps_API
+
+######### compiled sources #############
+libPOS_gps_API_SRCS += Gps_API.cpp
+libPOS_gps_API_SRCS += Naviinfo_API.cpp
+
+######### add include path #############
+CPPFLAGS += -I../../../server/include/common
+CPPFLAGS += -I../../include
+CPPFLAGS += -I../../../server/include/nsfw
+
+CPPFLAGS += -I../Vehicle_API
+CPPFLAGS += -I../Vehicle_API/common
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lPOS_base_API
+LDLIBS += -Wl,-Bdynamic -lvp
+
+######### add library path #############
+LDFLAGS += -shared
+
+include ../../../../vehicle_service.mk
diff --git a/vehicleservice/positioning/client/src/POS_gps_API/Naviinfo_API.cpp b/vehicleservice/positioning/client/src/POS_gps_API/Naviinfo_API.cpp
new file mode 100755
index 0000000..cfe04ff
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_gps_API/Naviinfo_API.cpp
@@ -0,0 +1,404 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+@file Naviinfo_API.cpp
+@detail Naviinfo_API Functions
+@lib libNaviinfo_API.so
+******************************************************************************/
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+#include "Naviinfo_API.h"
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/POS_gps_API.h>
+#include "Vehicle_API_Dummy.h"
+#include "POS_private.h"
+#include <native_service/frameworkunified_types.h> // NOLINT(build/include_order)
+
+void PosCnvGpsInfo(NAVIINFO_ALL *navi_loc_info);
+
+
+/**
+ * @brief
+ * GPS information setting
+ *
+ * Set GPS information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] navilocinfo NAVIINFO_ALL* - Pointer to GPS information storage area
+ *
+ * @return NAVIINFO_RET_NORMAL Normal completion<br>
+ * NAVIINFO_RET_ERROR_PARAM Parameter error<br>
+ * NAVIINFO_RET_ERROR_INNER Internal error<br>
+ * NAVIINFO_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+NAVIINFO_RET_API POS_SetGPSInfo(HANDLE hApp, NAVIINFO_ALL *navilocinfo)
+{
+ NAVIINFO_RET_API ret = NAVIINFO_RET_NORMAL; /* Return value of this function */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ NAVIINFO_ALL navi_loc_info_tmp; /* Conversion quantity area */
+ RET_API ret_api;
+
+ /** NULL checking */
+ if (navilocinfo == NULL) {
+ /** Parameter error */
+ ret = NAVIINFO_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /** Parameter error */
+ ret = NAVIINFO_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = NAVIINFO_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = NAVIINFO_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = NAVIINFO_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == NAVIINFO_RET_NORMAL) {
+ /* Parameter range check */
+ if (navilocinfo->stNaviGps.tdsts != 0) { /* Other than ""Time not calibrated after receiver reset"" */
+ /* Positioning status information */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stDiagGps.stFix.ucFixSts, 0, 2)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* Latitude */
+ if (POS_RET_ERROR == POS_CHKPARAM32(navilocinfo->stDiagGps.stFix.stWgs84.lLat, -82944000, 82944000)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* Longitude */
+ if (POS_RET_ERROR == POS_CHKPARAM32(navilocinfo->stDiagGps.stFix.stWgs84.lLon, -165888000, 165888000)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* Measurement Azimuth */
+ if (POS_RET_ERROR == POS_CHKPARAMU16(navilocinfo->stNaviGps.heading, 0, 3599)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* UTC(Month) */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.month, 1, 12)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* UTC(Day) */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.date, 1, 31)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* UTC(Hour) */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.hour, 0, 23)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* UTC(Minutes) */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.minute, 0, 59)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* UTC(Second) */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.second, 0, 59)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ }
+ /* Date and Time Status */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.tdsts, 0, 2)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+
+ /* Copy to conversion area */
+ memcpy(&navi_loc_info_tmp, navilocinfo, sizeof(NAVIINFO_ALL));
+ /** Data unit conversion */
+ PosCnvGpsInfo(&navi_loc_info_tmp);
+
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+
+ /** Send navigation information to vehicle sensor */
+ ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_NAVIINFO_DELIVER,
+ sizeof(NAVIINFO_ALL),
+ reinterpret_cast<void*>(&navi_loc_info_tmp), 0);
+ if (ret_api != RET_NORMAL) {
+ /** Message transmission failure */
+ ret = NAVIINFO_RET_ERROR_INNER;
+ }
+ } else {
+ /* When resource shortage occurs, the system terminates with an insufficient resource error. */
+ ret = NAVIINFO_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS information acquisition
+ *
+ * Access GPS information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] navidiaginfo NAVIINFO_DIAG_GPS* - Pointer to GPS information storage area
+ *
+ * @return NAVIINFO_RET_NORMAL Normal completion<br>
+ * NAVIINFO_RET_ERROR_PARAM Parameter error<br>
+ * NAVIINFO_RET_ERROR_INNER Internal error<br>
+ * NAVIINFO_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+NAVIINFO_RET_API POS_GetGPSInfo(HANDLE hApp, NAVIINFO_DIAG_GPS *navidiaginfo)
+{
+ NAVIINFO_RET_API ret = NAVIINFO_RET_NORMAL; /* Return value of this function */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ int32_t ret_veh; /* VehicleAPI Return Values */
+ NAVIINFO_DIAG_GPS dest_data; /* Data acquisition area */
+
+ /** NULL checking */
+ if (navidiaginfo == NULL) {
+ /** Parameter error */
+ ret = NAVIINFO_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /** Parameter error */
+ ret = NAVIINFO_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = NAVIINFO_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = NAVIINFO_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = NAVIINFO_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == NAVIINFO_RET_NORMAL) {
+ /** Acquisition of navigation data for Diag provide */
+ ret_veh = PosGetProc(
+ (DID)VEHICLE_DID_NAVIINFO_DIAG_GPS,
+ reinterpret_cast<void*>(&dest_data),
+ (u_int16)sizeof(dest_data));
+
+ if (static_cast<int32_t>(sizeof(NAVIINFO_DIAG_GPS)) > ret_veh) {
+ /** Failed to acquire */
+ if (ret_veh == POS_RET_ERROR_RESOURCE) {
+ ret = NAVIINFO_RET_ERROR_RESOURCE;
+ } else {
+ ret = NAVIINFO_RET_ERROR_INNER;
+ }
+ } else {
+ /** Successful acquisition */
+ memcpy( navidiaginfo, &dest_data, sizeof(NAVIINFO_DIAG_GPS));
+ }
+ }
+
+ return ret;
+}
+
+/* ++ GPS _CWORD82_ support */
+/**
+ * @brief
+ * GPS setting transmission request
+ *
+ * Requesting GPS Settings with Complete Return
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] p_data SENSOR_MSG_SEND_DAT* - GPS setting information to be sent
+ *
+ * @return SENSOR_RET_NORMAL Normal completion<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_DID Unregistered DID<br>
+ * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+int32 POS_ReqGPSSetting(HANDLE hApp, SENSOR_MSG_SEND_DAT *p_data) { /* Ignore->MISRA-C++:2008 Rule 7-1-2 */
+ SENSOR_RET_API ret = SENSOR_RET_NORMAL; /* Return value */
+ RET_API ret_api; /* System API return value */
+ uint16_t expected_size; /* Message size for the specified DID */
+
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+
+ if (hApp == NULL) {
+ /* Parameter error */
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+
+ if (ret == SENSOR_RET_NORMAL) {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Argument check (DID) + Size calculation */
+ if (p_data != reinterpret_cast<SENSOR_MSG_SEND_DAT*>(NULL)) {
+ switch (p_data->did) {
+ case VEHICLE_DID_GPS__CWORD82__SETINITIAL:
+ {
+ expected_size = 71;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SETRMODE:
+ {
+ expected_size = 50;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SETRMODEEX:
+ {
+ expected_size = 63;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SELSENT:
+ {
+ expected_size = 21;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SETSBAS:
+ {
+ expected_size = 34;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SETCONF1:
+ {
+ expected_size = 37;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SETCONF2:
+ {
+ expected_size = 45;
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ ret = SENSOR_RET_ERROR_DID;
+ break;
+ }
+ } else {
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+ }
+
+ /* Supported HW Configuration Check */
+ if (ret == SENSOR_RET_NORMAL) {
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = SENSOR_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == SENSOR_RET_NORMAL) {
+ /* Argument check (Size)*/
+ if (expected_size != p_data->usSize) {
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Message buffer initialization */
+
+ /* Create message data */
+
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+ /* External Process Transmission and Reception Messages */
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "POSITIONING: POS_ReqGPSSetting() --> cid = %d",
+ CID_SENSORIF__CWORD82__REQUEST);
+ ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_SENSORIF__CWORD82__REQUEST,
+ sizeof(SENSOR_MSG_SEND_DAT),
+ reinterpret_cast<void *>(p_data), 0);
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__, "POSITIONING: POS_ReqGPSSetting() <--");
+
+ if (ret_api != RET_NORMAL) {
+ ret = SENSOR_RET_ERROR_CREATE_EVENT;
+ }
+ } else {
+ /* When resource shortage occurs, the system terminates with an insufficient resource error. */
+ ret = SENSOR_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+ }
+ }
+
+ return ret;
+}
+/* -- GPS _CWORD82_ support */
+
+/**
+ * @brief
+ * GPS information conversion process
+ *
+ * Convert GPS information to a format to be provided to the vehicle sensor
+ *
+ * @param[in] none
+ * @param[in] navi_loc_info NAVIINFO_ALL* - GPS information pointer
+ *
+ * @return none
+ */
+void PosCnvGpsInfo(NAVIINFO_ALL *navi_loc_info) {
+ int32_t altitude;
+ int64_t tmp;
+ uint16_t heading;
+
+ /* Unit conversion of fix altitude[1m]->[0.01m] */
+ tmp = (int64_t)((int64_t)(navi_loc_info->stNaviGps.altitude) * 100);
+ if (tmp > static_cast<int32_t>(0x7FFFFFFF)) {
+ /* +Overflow of digits */
+ altitude = static_cast<int32_t>(0x7FFFFFFF);
+ } else if (tmp < static_cast<int32_t>(0x80000000)) { /* Ignore->MISRA-C:2004 Rule 3.1 */
+ /* -Overflow of digits */
+ altitude = static_cast<int32_t>(0x80000000); /* Ignore->MISRA-C:2004 Rule 3.1 */
+ } else {
+ altitude = static_cast<int32_t>(tmp);
+ }
+ navi_loc_info->stNaviGps.altitude = altitude;
+
+ /* Measurement Azimuth Conversion[0.Once]->[0.01 degree] */
+ heading = navi_loc_info->stNaviGps.heading;
+ heading = static_cast<uint16_t>(heading - ((heading / 3600) * 3600));
+ heading = static_cast<uint16_t>(heading * 10);
+ navi_loc_info->stNaviGps.heading = heading;
+
+ return;
+}
diff --git a/vehicleservice/positioning/client/src/POS_gps_API/libPOS_gps_API.ver b/vehicleservice/positioning/client/src/POS_gps_API/libPOS_gps_API.ver
new file mode 100755
index 0000000..038c99e
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_gps_API/libPOS_gps_API.ver
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libPOS_gps_API version script
+#
+{
+ global:
+ POS_GetGPSInfo;
+ POS_GetGPSVersion;
+ POS_RegisterListenerGPSTimeSetReq;
+ POS_RegisterListenerGPStime;
+ POS_ReqGPSReset;
+ POS_ReqGPSSetting;
+ POS_SetGPSInfo;
+ POS_SetGPStime;
+ POS_GetGPStime;
+ local:
+ *;
+};
+
diff --git a/vehicleservice/positioning/client/src/POS_sensor_API/Makefile b/vehicleservice/positioning/client/src/POS_sensor_API/Makefile
new file mode 100755
index 0000000..a4f627f
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_sensor_API/Makefile
@@ -0,0 +1,48 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+######### installed shared library(*.so) #############
+INST_SHLIBS = libPOS_sensor_API
+
+######### compiled sources #############
+libPOS_sensor_API_SRCS += Sensor_API.cpp
+libPOS_sensor_API_SRCS += Vehicle_API.cpp
+
+######### add include path #############
+CPPFLAGS += -I../../../server/include/common
+CPPFLAGS += -I../../include
+CPPFLAGS += -I../../../server/include/nsfw
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lPOS_base_API
+LDLIBS += -Wl,-Bdynamic -lvp
+######### add library path #############
+LDFLAGS += -shared
+
+
+include ../../../../vehicle_service.mk
diff --git a/vehicleservice/positioning/client/src/POS_sensor_API/Sensor_API.cpp b/vehicleservice/positioning/client/src/POS_sensor_API/Sensor_API.cpp
new file mode 100755
index 0000000..179eb92
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_sensor_API/Sensor_API.cpp
@@ -0,0 +1,784 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :Sensor_API.cpp
+ * System name :GPF
+ * Subsystem name :Sensor I/F library
+ * Program name :SensorI/F API
+ ******************************************************************************/
+
+#include <stdio.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "POS_sensor_private.h"
+#include "Sensor_Common_API.h"
+#include "Sensor_API_private.h"
+#include "Sensor_Common_API.h"
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+#include "Naviinfo_API.h"
+#include "POS_private.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+/********************************************************************************
+ * TAG :TG_GPS_REQ_RESET
+ * ABSTRACT :GPS reset request
+ * NOTE :I/F information between host applications(Reset mode)
+ ********************************************************************************/
+/**
+ * @brief POS_RegisterListenerPkgSensData Return code list
+ */
+static const SENSOR_RET_PKG g_ret_list_reg_lis_pkg_sens_data[SENSOR_PUBLIC_DID_NUM] = {
+ /* GRADE2 GRADE1 DID (Key) */
+ {TRUE, TRUE, POS_DID_SPEED_PULSE },
+ {FALSE, TRUE, POS_DID_SPEED_KMPH },
+ {TRUE, TRUE, POS_DID_GYRO_X },
+ {TRUE, TRUE, POS_DID_GYRO_Y },
+ {TRUE, TRUE, POS_DID_GYRO_Z },
+ {TRUE, TRUE, POS_DID_GSNS_X },
+ {TRUE, TRUE, POS_DID_GSNS_Y },
+ {TRUE, TRUE, POS_DID_GSNS_Z },
+ {FALSE, TRUE, POS_DID_GPS_ANTENNA },
+ {TRUE, TRUE, POS_DID_SNS_COUNTER },
+ {FALSE, TRUE, POS_DID_SPEED_PULSE_FST },
+ {FALSE, TRUE, POS_DID_GYRO_X_FST },
+ {FALSE, TRUE, POS_DID_GYRO_Y_FST },
+ {FALSE, TRUE, POS_DID_GYRO_Z_FST },
+ {FALSE, TRUE, POS_DID_GPS__CWORD82__NMEA },
+ {FALSE, TRUE, POS_DID_GPS__CWORD82___CWORD44_GP4 },
+ {FALSE, TRUE, POS_DID_GPS__CWORD82__FULLBINARY },
+ {FALSE, TRUE, POS_DID_GPS_NMEA },
+ {TRUE, TRUE, POS_DID_REV },
+ {FALSE, TRUE, POS_DID_REV_FST },
+ {TRUE, TRUE, POS_DID_GYRO_TEMP },
+ {FALSE, TRUE, POS_DID_GYRO_TEMP_FST },
+ {FALSE, TRUE, POS_DID_GSNS_X_FST },
+ {FALSE, TRUE, POS_DID_GSNS_Y_FST },
+ {FALSE, TRUE, POS_DID_GSNS_Z_FST },
+ {TRUE, TRUE, POS_DID_PULSE_TIME },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_DRIFT },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_FREQ },
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME_RAW }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_WKNROLLOVER} /* For local use */
+};
+
+/**
+ * @brief POS_RegisterListenerSensData Return code list
+ */
+static const SENSOR_RET_PKG g_ret_list_reg_lis_sens_data[SENSOR_PUBLIC_DID_NUM] = {
+ /* GRADE2 GRADE1 DID (Key) */
+ {TRUE, TRUE, POS_DID_SPEED_PULSE },
+ {FALSE, TRUE, POS_DID_SPEED_KMPH },
+ {TRUE, TRUE, POS_DID_GYRO_X },
+ {TRUE, TRUE, POS_DID_GYRO_Y },
+ {TRUE, TRUE, POS_DID_GYRO_Z },
+ {TRUE, TRUE, POS_DID_GSNS_X },
+ {TRUE, TRUE, POS_DID_GSNS_Y },
+ {TRUE, TRUE, POS_DID_GSNS_Z },
+ {TRUE, TRUE, POS_DID_GPS_ANTENNA },
+ {FALSE, TRUE, POS_DID_SNS_COUNTER },
+ {TRUE, TRUE, POS_DID_SPEED_PULSE_FST },
+ {TRUE, TRUE, POS_DID_GYRO_X_FST },
+ {TRUE, TRUE, POS_DID_GYRO_Y_FST },
+ {TRUE, TRUE, POS_DID_GYRO_Z_FST },
+ {TRUE, TRUE, POS_DID_GPS__CWORD82__NMEA },
+ {FALSE, TRUE, POS_DID_GPS__CWORD82___CWORD44_GP4 },
+ {TRUE, TRUE, POS_DID_GPS__CWORD82__FULLBINARY },
+ {FALSE, TRUE, POS_DID_GPS_NMEA },
+ {FALSE, TRUE, POS_DID_REV },
+ {TRUE, TRUE, POS_DID_REV_FST },
+ {TRUE, TRUE, POS_DID_GYRO_TEMP },
+ {TRUE, TRUE, POS_DID_GYRO_TEMP_FST },
+ {TRUE, TRUE, POS_DID_GSNS_X_FST },
+ {TRUE, TRUE, POS_DID_GSNS_Y_FST },
+ {TRUE, TRUE, POS_DID_GSNS_Z_FST },
+ {FALSE, TRUE, POS_DID_PULSE_TIME },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_DRIFT },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_FREQ },
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME_RAW }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_WKNROLLOVER } /* For local use */
+};
+
+/**
+ * @brief POS_GetSensData Return code list
+ */
+static const SENSOR_RET_PKG g_ret_list_get_sens_data[SENSOR_PUBLIC_DID_NUM] = {
+ /* GRADE2 GRADE1 DID (Key) */
+ {TRUE, TRUE, POS_DID_SPEED_PULSE },
+ {FALSE, TRUE, POS_DID_SPEED_KMPH },
+ {TRUE, TRUE, POS_DID_GYRO_X },
+ {TRUE, TRUE, POS_DID_GYRO_Y },
+ {TRUE, TRUE, POS_DID_GYRO_Z },
+ {TRUE, TRUE, POS_DID_GSNS_X },
+ {TRUE, TRUE, POS_DID_GSNS_Y },
+ {TRUE, TRUE, POS_DID_GSNS_Z },
+ {TRUE, TRUE, POS_DID_GPS_ANTENNA },
+ {FALSE, TRUE, POS_DID_SNS_COUNTER },
+ {FALSE, TRUE, POS_DID_SPEED_PULSE_FST },
+ {FALSE, TRUE, POS_DID_GYRO_X_FST },
+ {FALSE, TRUE, POS_DID_GYRO_Y_FST },
+ {FALSE, TRUE, POS_DID_GYRO_Z_FST },
+ {TRUE, TRUE, POS_DID_GPS__CWORD82__NMEA },
+ {FALSE, TRUE, POS_DID_GPS__CWORD82___CWORD44_GP4 },
+ {TRUE, TRUE, POS_DID_GPS__CWORD82__FULLBINARY },
+ {FALSE, TRUE, POS_DID_GPS_NMEA },
+ {FALSE, TRUE, POS_DID_REV },
+ {FALSE, TRUE, POS_DID_REV_FST },
+ {TRUE, TRUE, POS_DID_GYRO_TEMP },
+ {FALSE, TRUE, POS_DID_GYRO_TEMP_FST },
+ {FALSE, TRUE, POS_DID_GSNS_X_FST },
+ {FALSE, TRUE, POS_DID_GSNS_Y_FST },
+ {FALSE, TRUE, POS_DID_GSNS_Z_FST },
+ {FALSE, TRUE, POS_DID_PULSE_TIME },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_DRIFT },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_FREQ },
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME_RAW }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_WKNROLLOVER } /* For local use */
+};
+
+/**
+ * @brief
+ * DID-decision functions for Sensor API
+ *
+ * Determines whether or not the DID specified by the public API corresponds to the DID.
+ *
+ * @param[in] did Data ID
+ * @param[in] mode Operation mode 1:For Package Delivery Registration API<br>
+ * 2:For Sensor Data Delivery Registration API<br>
+ * 3:For Sensor Data Acquisition API
+ *
+ * @return TRUE Be supported
+ * FALSE Not supported
+ */
+BOOL SensorJudgeDid(DID did, uint8_t mode) {
+ BOOL ret = FALSE;
+ UNIT_TYPE type;
+ const SENSOR_RET_PKG *pkg_list = NULL;
+ int32_t i;
+
+ /* Set Return pakage list */
+ switch (mode) {
+ case MODE_REGISTER_LISTENER_PKG_SENS_DATA: /* POS_RegisterListenerPkgSensData */
+ {
+ pkg_list = g_ret_list_reg_lis_pkg_sens_data;
+ break;
+ }
+ case MODE_REGISTER_LISTENER_SENSDATA: /* POS_RegisterListenerSensData */
+ {
+ pkg_list = g_ret_list_reg_lis_sens_data;
+ break;
+ }
+ case MODE_GET_SENSDATA: /* POS_GetSensData */
+ {
+ pkg_list = g_ret_list_get_sens_data;
+ break;
+ }
+ default:
+ /* Error log */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [mode = %d]", mode);
+ break;
+ }
+
+ if (pkg_list != NULL) {
+ /* Search Return code list for DID */
+ for (i = 0; i < SENSOR_PUBLIC_DID_NUM; i++) {
+ if (did == pkg_list[i].did) {
+ break;
+ }
+ }
+
+ if (i != SENSOR_PUBLIC_DID_NUM) {
+ /* Get Unit type */
+ type = GetEnvSupportInfo();
+ switch (type) {
+ case UNIT_TYPE_GRADE1:
+ {
+ ret = pkg_list[i].GRADE1_ret;
+ break;
+ }
+ case UNIT_TYPE_GRADE2:
+ {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = pkg_list[i].GRADE2_ret;
+ break;
+ }
+ default:
+ /* Error log */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "GetEnvSupportInfo ERROR [type = %d]", type);
+ break;
+ }
+ } else {
+ /* Error log */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [did = %d]", did);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Information Extended Package Delivery Registration
+ * Sensor information is delivered for the first time.,Extension Packaging and Registering for Delivery.
+ *
+ * @param[in] hApp Application handle
+ * @param[in] notifyName Destination thread name
+ * @param[in] ucPkgNum Number of package data(1 to 16)
+ * @param[in] *pulDid Pointer to an array of data IDs for vehicle information
+ * @param[in] ucCtrlFlg Delivery control<br>
+ * Delivery registration: SENSOR_DELIVERY_REGIST<br>
+ * Delivery stop: SENSOR_DELIVERY_STOP (Note: Not mounted)<br>
+ * Resume delivery: SENSOR_DELIVERY_RESTART (Note: Not mounted)
+ * @param[in] ucDeliveryTiming Delivery timing<br>
+ * Updating : SENSOR_DELIVERY_TIMING_UPDATE<br>
+ * Changing : SENSOR_DELIVERY_TIMING_CHANGE
+ *
+ * @return SENSOR_RET_NORMAL Successful registration<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_DID Unregistered ID<br>
+ * SENSOR_RET_ERROR_BUFFULL FULL of delivery registers<br>
+ * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment<br>
+ * SENSOR_RET_ERROR_INNER Internal abnormality
+ *
+ */
+SENSOR_RET_API POS_RegisterListenerPkgSensData(HANDLE hApp,
+ PCSTR notifyName,
+ uint8_t ucPkgNum,
+ DID *pulDid, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming) {
+ SENSOR_RET_API ret; /* Return value */
+ BOOL ret_b;
+ RET_API ret_api; /* System API return value */
+ EventID event_id; /* Event ID */
+ int32_t event_val; /* Event value */
+ SENSOR_MSG_DELIVERY_ENTRY_DAT data; /* Message data */
+ int32_t i; /* Generic counters */
+ PNO ch_pno; /* Converted internal PNO */
+ UNIT_TYPE type; /* Supported HW Configuration Type */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ ret = SENSOR_RET_NORMAL;
+ /* Check Handle */
+ if (hApp == NULL) {
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+
+ if (ret == SENSOR_RET_NORMAL) {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = SENSOR_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == SENSOR_RET_NORMAL) {
+ /* Check Delivery Control Designation */
+ if (SENSOR_DELIVERY_REGIST != ucCtrlFlg) {
+ /* Parameters other than delivery registration terminated abnormally. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Check delivery timing */
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* Check Thread Name */
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if ((0 == ucPkgNum) || (SENSOR_PKG_DELIVERY_MAX < ucPkgNum)) {
+ /* Check Package Data Count */
+ /* Out-of-range is terminated as a parameter error. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (pulDid == NULL) {
+ /* Check Data ID */
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Check if data ID is acceptable */
+ for (i = 0; i < ucPkgNum; i++) {
+ /* Judge DID */
+ ret_b = SENSOR_DID_JUDGE_REGLIS_PKG(pulDid[i]);
+ if (ret_b == FALSE) {
+ /* An unacceptable ID terminates with an abnormal parameter. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ break;
+ } else {
+ ret = SENSOR_RET_NORMAL;
+ }
+ }
+ }
+ }
+
+ if (ret == SENSOR_RET_NORMAL) {
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+
+ /* Initialization */
+ event_id = 0;
+ event_val = 0;
+ memset(reinterpret_cast<void *>(&data), 0, sizeof(SENSOR_MSG_DELIVERY_ENTRY_DAT));
+
+ /* Get PNO from Thread Name */
+ ch_pno = _pb_CnvName2Pno(notifyName);
+
+ /* Event Generation */
+ event_id = PosCreateEvent(ch_pno);
+
+ if (0 != event_id) {
+ /* Successful event generation */
+
+ /*--------------------------------------------------------------*
+ * Send Vehicle Sensor Information Delivery Registration Message *
+ *--------------------------------------------------------------*/
+ /* Create Message Data */
+ data.pno = ch_pno;
+ data.pkg_num = ucPkgNum;
+ data.delivery_timing = ucDeliveryTiming;
+ data.ctrl_flg = ucCtrlFlg;
+ data.event_id = event_id;
+ for (i = 0; i < ucPkgNum; i++) {
+ data.did[i] = pulDid[i];
+ }
+
+ /* Messaging */
+ ret_api = PosSndMsg(ch_pno,
+ PNO_VEHICLE_SENSOR,
+ CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT,
+ (uint16_t)sizeof(SENSOR_MSG_DELIVERY_ENTRY_DAT),
+ (const void *)&data);
+
+ if (RET_NORMAL == ret_api) {
+ /* Message transmission processing is successful */
+ /* Wait for completion event from vehicle sensor thread */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ SENSOR_RET_ERROR_MIN,
+ SENSOR_RET_NORMAL,
+ &event_val,
+ POS_API_TIME_OUT_MS);
+ if (RET_NORMAL != ret_api) {
+ /* Return an internal error */
+ ret = SENSOR_RET_ERROR_INNER;
+ } else {
+ /* Return from Event Wait */
+ /* Set event value (processing result) as return value */
+ ret = (SENSOR_RET_API)event_val;
+ }
+ } else {
+ /* Message transmission processing failed */
+ /* Return an internal error */
+ ret = SENSOR_RET_ERROR_INNER;
+ }
+
+ /* Event deletion */
+ ret_api = PosDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ ret = SENSOR_RET_ERROR_CREATE_EVENT;
+ }
+ } else {
+ /* When resource shortage occurs, the system terminates with an insufficient resource error. */
+ ret = SENSOR_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : PosCreateEvent
+ * ABSTRACT : Event creation process
+ * FUNCTION : Generate an event
+ * ARGUMENT : pno : Thread ID
+ * NOTE :
+ * RETURN : Non-zero : Event ID
+ * : Zero : Event generation failure
+ ******************************************************************************/
+EventID PosCreateEvent(PNO pno) {
+ EventID event_id; /* Event ID */
+ char event_name[32]; /* Event name character string buffer */
+ RET_API ret_api; /* System API return value */
+
+ /* Initialization of event name character string buffer */
+ (void)memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name));
+
+ /* Event name creation */
+ snprintf(event_name, sizeof(event_name), "SENSOR_%X", pno); /* Ignore->MISRA-C++:2008 Rule 5-2-12 */
+
+ /* Event Generation */
+ event_id = _pb_CreateEvent(FALSE , 0, event_name); /* Ignore->MISRA-C++:2008 Rule 5-2-12 */
+
+ if (0 != event_id) {
+ /* For successful event generation */
+
+ /* Initialize the event */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, SENSOR_EVENT_VAL_INIT);
+ if (RET_NORMAL != ret_api) {
+ /* Event initialization failed */
+
+ /* Delete Event and Return Event Generation Failed */
+ ret_api = PosDeleteEvent(event_id);
+ event_id = 0;
+ }
+ }
+
+ return event_id;
+}
+
+/*******************************************************************************
+ * MODULE : PosDeleteEvent
+ * ABSTRACT : Event deletion processing
+ * FUNCTION : Delete events
+ * ARGUMENT : event_id : Event ID of the event to delete
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_EV_NONE : Specified event does not exist
+ ******************************************************************************/
+RET_API PosDeleteEvent(EventID event_id) {
+ return(_pb_DeleteEvent(event_id));
+}
+
+/*******************************************************************************
+ * MODULE : SensorLinkShareData
+ * ABSTRACT : Link to shared memory
+ * FUNCTION : Link to shared memory
+ * ARGUMENT : **share_top : Storage destination of shared memory top address
+ * : *share_size : Storage destination of shared memory area size
+ * : *offset : Offset storage destination to free shared memory area
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERROR : There is no shared memory area.
+ ******************************************************************************/
+RET_API SensorLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api; /* System API return value */
+ SemID sem_id; /* Semaphore ID */
+ SENSOR_SHARE *share_top_tmp;
+ int32_t i;
+
+ /* Initialization */
+ ret_api = RET_ERROR;
+
+ /* Create Semaphore */
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(SENSOR_SEMAPHO_NAME));
+ if (0 != sem_id) {
+ /* Semaphore Lock */
+ ret_api = _pb_SemLock(sem_id);
+ if (RET_NORMAL == ret_api) {
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(SENSOR_SHARE_NAME), share_top, share_size);
+ if (RET_NORMAL == ret_api) {
+ /* By searching the free shared memory area,Offset is calculated if there is free space. */
+ share_top_tmp = reinterpret_cast<SENSOR_SHARE *>(*share_top);
+
+ /* Because the first block of the shared memory area is the control area,Loop from i = 1 */
+ for (i = 1; i < SENSOR_SHARE_BLOCK_NUM; i++) {
+ if (SENSOR_SHARE_UNLOCK == share_top_tmp->mng.lock_info[i]) {
+ break;
+ }
+ }
+ if (i < SENSOR_SHARE_BLOCK_NUM) {
+ /* Empty space */
+ /* Lock the block */
+ share_top_tmp->mng.lock_info[i] = SENSOR_SHARE_LOCK;
+
+ /* Calculate the offset to the block */
+ *offset = static_cast<uint16_t>(i * SENSOR_SHARE_BLOCK_SIZE);
+
+ /* Normal completion */
+ ret_api = RET_NORMAL;
+ } else {
+ /* No free space */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Failed link to shared memory */
+ ret_api = RET_ERROR;
+ }
+ /* Semaphore unlock */
+ _pb_SemUnlock(sem_id);
+ } else {
+ /* Semaphore lock failed */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Semaphore creation failed */
+ ret_api = RET_ERROR;
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : SensorUnLinkShareData
+ * ABSTRACT : Unlinking shared memory
+ * FUNCTION : Unlink shared memory
+ * ARGUMENT : *share_top : Start address of shared memory
+ * : offset : Offset to shared memory free area
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERROR : There is no shared memory area./semaphore error
+ ******************************************************************************/
+RET_API SensorUnLinkShareData(SENSOR_SHARE *share_top, uint16_t offset) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api; /* System API return value */
+ SemID sem_id; /* Semaphore ID */
+ int32_t i;
+
+ /* Initialization */
+ ret_api = RET_ERROR;
+
+ /* Create Semaphore */
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(SENSOR_SEMAPHO_NAME));
+ if (0 != sem_id) {
+ /* Semaphore Lock */
+ ret_api = _pb_SemLock(sem_id);
+ if (RET_NORMAL == ret_api) {
+ /* Unlock the block */
+ i = static_cast<int32>(offset) / SENSOR_SHARE_BLOCK_SIZE;
+ share_top->mng.lock_info[i] = SENSOR_SHARE_UNLOCK;
+
+ /* Semaphore unlock */
+ _pb_SemUnlock(sem_id);
+
+ /* Normal completion */
+ ret_api = RET_NORMAL;
+ } else {
+ /* Semaphore lock failed */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Semaphore creation failed */
+ ret_api = RET_ERROR;
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : SensorSetShareData
+ * ABSTRACT : Write processing to shared memory
+ * FUNCTION : Write shared memory
+ * ARGUMENT : *share_top : Start address of shared memory
+ * : offset : Offsets to shared memory write destination
+ * : *data_src :
+ : size_src :
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void SensorSetShareData(void *share_top, uint16_t offset, const void *data_src, uint16_t size_src) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SENSOR_SHARE_BLOCK_DAT *share_dat;
+
+ /* Calculate Shared Memory Write Address */
+ share_dat = reinterpret_cast<SENSOR_SHARE_BLOCK_DAT *>(reinterpret_cast<uint8_t *>(share_top) + offset);
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+
+ /* Clear Shared Memory */
+ memset(reinterpret_cast<void *>(share_dat), 0, sizeof(SENSOR_SHARE_BLOCK_DAT));
+
+ /* Set write size to shared memory */
+ share_dat->size = size_src;
+
+ /* Set specified data in shared memory */
+ memcpy(reinterpret_cast<void *>(&share_dat->data), data_src, (size_t)size_src);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : PosSndMsg
+ * ABSTRACT : Message transmission processing
+ * FUNCTION : Send a message to the specified PNO
+ * ARGUMENT : pno_src : Source PNO
+ * : pno_dest : Destination PNO
+ * : cid : Command ID
+ * : msg_len : Message data body length
+ * : *msg_len : Pointer to message data
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERRNOTRDY : Destination process is not wakeup
+ * : RET_ERRMSGFULL : Message queue overflows
+ * : RET_ERRPARAM : Buffer size error
+ ******************************************************************************/
+RET_API PosSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data) {
+ SENSOR_INTERNAL_MSG_BUF msg_buf; /* message buffer */
+ T_APIMSG_MSGBUF_HEADER *msg_hdr; /* Pointer to the message header */
+ RET_API ret_api; /* Return value */
+ PCSTR thread_name; /* Destination thread name */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Initializing the header of the message buffer */
+ memset(reinterpret_cast<void *>(&msg_buf.hdr), 0, sizeof(T_APIMSG_MSGBUF_HEADER));
+
+ /* Get pointer to send buffer */
+ msg_hdr = reinterpret_cast<T_APIMSG_MSGBUF_HEADER *>(reinterpret_cast<void *>(&msg_buf));
+
+ /*--------------------------------------------------------------*
+ * Create message headers *
+ *--------------------------------------------------------------*/
+ msg_hdr->hdr.sndpno = pno_src; /* Source PNO */
+ msg_hdr->hdr.cid = cid; /* Command ID */
+ msg_hdr->hdr.msgbodysize = msg_len; /* Message data body length */
+
+ /*--------------------------------------------------------------*
+ * Create message data *
+ *--------------------------------------------------------------*/
+ if ((0 != msg_data) && (0 != msg_len)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Set the message data */
+ memcpy(reinterpret_cast<void *>(msg_buf.data), msg_data, (size_t)msg_len);
+ }
+ /*--------------------------------------------------------------*
+ * Send messages *
+ *--------------------------------------------------------------*/
+ /* Get Thread Name from PNO */
+ if (pno_dest <= SYS_PNO_MAX) {
+ thread_name = POS_THREAD_NAME;
+ } else {
+ thread_name = _pb_CnvPno2Name(pno_dest);
+ }
+
+ if ((pno_dest <= SYS_PNO_MAX) && (pno_src <= SYS_PNO_MAX)) {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "[LOG pno_dest = 0x%x]", pno_dest);
+
+ /* Internal Process Transmission and Reception Messages */
+ ret_api = _pb_SndMsg(pno_dest,
+ (uint16_t)(sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len),/* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ reinterpret_cast<void *>(&msg_buf), 0);
+ } else {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[LOG thread_name = %s, cid = 0x%x]", thread_name, cid);
+
+ /* External Process Transmission and Reception Messages */
+ ret_api = _pb_SndMsg_Ext(thread_name,
+ cid,
+ (uint16_t)(msg_len), /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ reinterpret_cast<void *>(&(msg_buf.data)), 0);
+ }
+ /* If RET_ERROR,Register a dialog if called from a Vehicle related thread */ /* Task_30332 */
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "[ERROR]");
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret_api);
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Sensor information acquisition
+ *
+ * Obtain sensor information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] did DID - Data ID for vehicle information
+ * @param[in] dest_data void* - Pointer representing the storage destination of vehicle sensor information
+ * @param[in] dest_size uint16_t - Storage destination size of vehicle sensor information(byte)
+ *
+ * @return 0 or more Stored data size(Include illegal)<br>
+ * POS_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * POS_RET_ERROR_OUTOF_MEMORY Shared memory allocation failed<br>
+ * POS_RET_ERROR_SIZE Storage destination size error<br>
+ * POS_RET_ERROR_DID Unregistered ID<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_GetSensData(HANDLE hApp, DID did, void *dest_data, uint16_t dest_size)
+{
+ POS_RET_API ret; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ BOOL ret_b;
+
+ /** NULL checking */
+ if ((hApp == NULL) || (dest_data == NULL)) {
+ /** Parameter error */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == NAVIINFO_RET_NORMAL) {
+ /* Judge DID*/
+ ret_b = SENSOR_DID_JUDGE_GET(did);
+ if (ret_b == FALSE) {
+ /* An unacceptable ID is regarded as a parameter error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Data acquisition process */
+ ret = PosGetProc(did, dest_data, dest_size);
+ }
+ }
+
+ return ret;
+}
diff --git a/vehicleservice/positioning/client/src/POS_sensor_API/Vehicle_API.cpp b/vehicleservice/positioning/client/src/POS_sensor_API/Vehicle_API.cpp
new file mode 100755
index 0000000..3cd97f8
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_sensor_API/Vehicle_API.cpp
@@ -0,0 +1,292 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :Vehicle_API.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle I/F library
+ * Program name :Vehicle I/F API
+ * Module configuration :POS_RegisterListenerSensData() Vehicle sensor information delivery registration
+ ******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include <stdio.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include "Sensor_API_private.h"
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+#include "POS_private.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+ * initialize
+******************************************************************************/
+VEHICLE_RET_API VehicleInitialize(u_int32 (*sighand)()) { // LCOV_EXCL_START 8:dead code // NOLINT(readability/nolint)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API _CWORD64_api_ret;
+ VEHICLE_RET_API ret;
+
+ _CWORD64_api_ret = _pb_Setup_CWORD64_API(NULL);
+
+ if (_CWORD64_api_ret == RET_NORMAL) {
+ ret = RET_NORMAL;
+ } else {
+ ret = RET_ERROR;
+ }
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Vehicle sensor information delivery registration
+ * Register delivery of vehicle sensor information
+ *
+ * @param[in] hApp Application handle
+ * @param[in] notifyName Destination thread name
+ * @param[in] ulDid Pointer to an array of data IDs for vehicle information
+ * @param[in] ucCtrlFlg Delivery control<br>
+ * Delivery registration: SENSOR_DELIVERY_REGIST<br>
+ * Delivery stop: SENSOR_DELIVERY_STOP (Note: Not mounted)<br>
+ * Resume delivery: SENSOR_DELIVERY_RESTART (Note: Not mounted)
+ * @param[in] ucDeliveryTiming Delivery timing<br>
+ * Updating : SENSOR_DELIVERY_TIMING_UPDATE<br>
+ * Changing : SENSOR_DELIVERY_TIMING_CHANGE
+ *
+ * @return SENSOR_RET_NORMAL Successful registration<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_DID Unregistered ID<br>
+ * SENSOR_RET_ERROR_BUFFULL FULL of delivery registers<br>
+ * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+SENSOR_RET_API POS_RegisterListenerSensData(HANDLE hApp,
+ PCSTR notifyName, DID ulDid, u_int8 ucCtrlFlg, u_int8 ucDeliveryTiming) {
+ SENSOR_RET_API ret; /* Return value */
+ UNIT_TYPE type; /* Supported HW Configuration Type */
+ BOOL ret_b;
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Check Delivery Control Designation */
+ ret = SENSOR_RET_NORMAL;
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (SENSOR_DELIVERY_REGIST != ucCtrlFlg) {
+ /* Parameters other than delivery registration terminated abnormally. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* Check Handle */
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* Check Thread Name */
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = SENSOR_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (SENSOR_RET_NORMAL == ret) {
+ /* Judge DID */
+ ret_b = SENSOR_DID_JUDGE_REGLIS(ulDid);
+ if (ret_b == FALSE) {
+ /* An unacceptable ID is regarded as a parameter error. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Delivery registration process */
+ ret = PosRegisterListenerProc(notifyName, ulDid, ucCtrlFlg, ucDeliveryTiming);
+ }
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : PosSetShareData
+ * ABSTRACT : Write processing to shared memory
+ * FUNCTION : Write shared memory
+ * ARGUMENT : *share_top : Start address of shared memory
+ * : offset : Offsets to shared memory write destination
+ * : *data_src : Data
+ * : size_src : Size
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void PosSetShareData(void *share_top, u_int16 offset, const void *data_src, u_int16 size_src) {
+ VEHICLE_SHARE_BLOCK_DAT *share_dat;
+ /* Calculate Shared Memory Write Address */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top) + offset);
+
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Clear Shared Memory(Unused area) */
+ share_dat->reserve[0] = 0;
+ share_dat->reserve[1] = 0;
+
+ /* Set write size to shared memory */
+ share_dat->size = size_src;
+
+ /* Set specified data in shared memory */
+ memcpy(reinterpret_cast<void *>(share_dat->data), data_src, (size_t)size_src);
+}
+
+/*******************************************************************************
+* MODULE : VehicleGetDrData
+* ABSTRACT : DR information acquisition
+* FUNCTION : Retrieves DR information (optional data) by returning to completion.
+* ARGUMENT : pno : Thread ID
+* : did : Data ID for DR information
+* : *dest_data : Pointer to the storage destination of DR information
+* : dest_size : Storage destination size of DR information(byte)
+* NOTE :
+* RETURN : Zero or more : Stored data size
+* : VEHICLE_RET_ERROR_CREATE_EVENT : Event generation failure
+* : VEHICLE_RET_ERROR_OUTOF_MEMORY : Shared memory allocation failed
+* : VEHICLE_RET_ERROR_SIZE : Storage destination size error
+* : VEHICLE_RET_ERROR_DID : Unregistered ID
+******************************************************************************/
+int32 VehicleGetDrData(PNO pno, DID did, void *dest_data, u_int16 dest_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLE_RET_API ret; /* Return value */
+ RET_API ret_api; /* System API return value */
+ EventID event_id; /* Event ID */
+ int32 event_val; /* Event value */
+ void *share_top; /* Start address of shared memory */
+ u_int32 share_size; /* Size of shared memory area */
+ u_int16 offset; /* Offset to free shared memory area */
+ VEHICLE_SHARE_BLOCK_DAT *share_dat; /* Address of free shared memory area */
+ VEHICLE_MSG_GET_VEHICLE_DATA_DAT data; /* Message data */
+
+ /* Initialization */
+ event_id = 0;
+ event_val = 0;
+ memset(reinterpret_cast<void *>(&data), 0, sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT));
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(pno);
+
+ if (0 != event_id) {
+ /* Successful event generation */
+ /* Allocate shared memory */
+ ret_api = VehicleLinkShareData(reinterpret_cast<void **>(&share_top), &share_size, &offset);
+ if (RET_NORMAL != ret_api) {
+ /* Failed to allocate shared memory */
+ ret = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ } else {
+ /* When the shared memory is allocated successfully */
+
+ /* Calculate start address of free shared memory area */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top) + offset);
+
+ /* Send vehicle sensor information acquisition message */
+ data.did = did;
+ data.pno = pno;
+ data.offset = offset;
+ data.size = VEHICLE_SHARE_BLOCK_DSIZE;
+ data.event_id = event_id;
+ /* Messaging */
+
+ ret_api = VehicleSndMsg(pno,
+ PNO_VEHICLE_SENSOR,
+ CID_VEHICLEIF_GET_DR_DATA,
+ sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT),
+ (const void *)&data);
+
+ if (RET_NORMAL == ret_api) {
+ /* Message transmission processing is successful */
+ /* Wait for completion event from vehicle sensor thread */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN, VEHICLE_RET_NORMAL, &event_val, INFINITE);
+ if (RET_NORMAL != ret_api) {
+ /* When not put in event wait state */
+ /* Return an event generation failure */
+ ret = VEHICLE_RET_ERROR_CREATE_EVENT;
+ } else {
+ /* Return from Event Wait */
+
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME), &share_top, &share_size);
+
+ /* Calculate the address of the shared memory storage area. */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top)
+ + offset);
+
+ if (event_val < 0) {
+ /* Vehicle sensor information acquisition failure */
+ ret = (VEHICLE_RET_API)event_val;
+ } else if (RET_NORMAL != ret_api) {
+ /* Shared memory error */
+ ret = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ } else if (dest_size < share_dat->size) {
+ /* Storage destination size error */
+ ret = VEHICLE_RET_ERROR_SIZE;
+ } else {
+ /* Vehicle sensor information acquisition success */
+
+ /* Copy from shared memory to user memory */
+ memcpy(dest_data, share_dat->data, (size_t)share_dat->size);
+
+ /* Set Write Size to Return Value */
+ ret = static_cast<int32>(share_dat->size);
+ }
+ }
+ } else {
+ /* Message transmission processing failed */
+ /* Return an event generation failure */
+ ret = VEHICLE_RET_ERROR_CREATE_EVENT;
+ }
+ /* Free shared memory */
+ (void)VehicleUnLinkShareData(reinterpret_cast<VEHICLE_SHARE*>(share_top), offset);
+ }
+
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+
+ } else {
+ /* Event generation failure */
+ ret = VEHICLE_RET_ERROR_CREATE_EVENT;
+ }
+ return ret;
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver b/vehicleservice/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver
new file mode 100755
index 0000000..10fd95b
--- /dev/null
+++ b/vehicleservice/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libPOS_sensor_API version script
+#
+{
+ global:
+ POS_GetSensData;
+ POS_RegisterListenerPkgSensData;
+ POS_RegisterListenerSensData;
+ *PosSndMsg*;
+ *PosCreateEvent*;
+ *PosDeleteEvent*;
+ *PosSetShareData*;
+ local:
+ *;
+};
+
diff --git a/vehicleservice/positioning/server/Makefile b/vehicleservice/positioning/server/Makefile
new file mode 100755
index 0000000..6ef1082
--- /dev/null
+++ b/vehicleservice/positioning/server/Makefile
@@ -0,0 +1,22 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### subdirectories #########
+SUBDIRS += src/Sensor
+SUBDIRS += src/ServiceInterface
+SUBDIRS += src/nsfw
+
+include ../../vehicle_service.mk
diff --git a/vehicleservice/positioning/server/include/Sensor/ClockDataMng.h b/vehicleservice/positioning/server/include/Sensor/ClockDataMng.h
new file mode 100755
index 0000000..69a96c2
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/ClockDataMng.h
@@ -0,0 +1,100 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+ * File name : ClockDataMng.h
+ * System name : PastModel002
+ * Subsystem name : Time-related processing
+ ******************************************************************************/
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKDATAMNG_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKDATAMNG_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+
+#include "positioning_hal.h"
+#include "CanInput_API.h"
+#include "Sensor_API.h"
+
+/********************************************************************************
+* Macro definitions *
+*********************************************************************************/
+#define CLOCKDATAMNG_SECONDS_PAR_WEEK (7 * 24 * 60 * 60)
+#define CLOCKDATAMNG_CNV_WEEK2SEC(WEEK) ((WEEK)* CLOCKDATAMNG_SECONDS_PAR_WEEK)
+
+/* [PastModel002 Specifications]Time difference tolerance(plus or minus 512 week or less,GPS TIME range from 0 to 1023 week) */
+#define CLOCKDATAMNG_TIME_DIFF_LIMIT_UPPER (512 * CLOCKDATAMNG_SECONDS_PAR_WEEK)
+#define CLOCKDATAMNG_TIME_DIFF_LIMIT_LOWER (-512 * CLOCKDATAMNG_SECONDS_PAR_WEEK)
+
+/* [PastModel002 Specifications]Time difference addition value(+1024week,GPS TIME range from 0 to 1023 week) */
+#define CLOCKDATAMNG_TIME_DIFF_ADD_VALUE (CLOCKDATAMNG_TIME_DIFF_LIMIT_UPPER * 2)
+
+/* [PastModel002 Specifications]GPS TIME weekNo scope */
+#define CLOCKDATAMNG_GPS_TIME_WEEKNO_LIMIT 1024
+
+/* [PastModel002 Specifications]Initial value of time difference information at the previous shutdown */
+#define CLOCKDATAMNG_TIME_DIFF_INIT_VALUE 0x7FFFFFFFL
+
+/* [PastModel002 Specifications]AID-INI lifetime(+4Time) */
+#define CLOCKDATAMNG_AID_INI_EFFECTIVE_TIME (4 * 60 * 60)
+
+/* [PastModel002 Specifications]AID-EPH lifetime(plus or minus 2 hours) */
+#define CLOCKDATAMNG_AID_EPH_EFFECTIVE_TIME (2 * 60 * 60)
+
+#define MUTEX_CLOCKDATAMNG __TEXT("MUTEX_VEHICLE_CLOCKDATAMNG")
+
+/********************************************************************************
+* Struct definitions *
+*********************************************************************************/
+/********************************************************************************
+ * TAG :CLOCKDATAMNG_GPS_TIME
+ * ABSTRACT :GPS time structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct {
+ u_int32 tow; /* Time of week (msec) */
+ int16 week_no; /* GPS Week No. */
+ u_int8 reserve[2]; /* reserve */
+ BOOL validity_flag; /* Enabled/DisabledFlagging */
+} CLOCKDATAMNG_GPS_TIME;
+
+/********************************************************************************
+* Function prototype *
+*********************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ BOOL ClockDataMngInitialize(void);
+ void ClockDataMngSetLastTimeDiff(int32 time_diff);
+
+ void ClockDataMngSetGpsTime(const SENSOR_MSG_GPSDATA_DAT *gps_time_data);
+ void ClockDataMngGetGpsTime(CLOCKDATAMNG_GPS_TIME *gps_time_data);
+
+ BOOL ClockDataMngGetLocalTime(const CANINPUT_MSG_LOCALTIMEINFO_DAT *can_local_time, LOCALTIME *vehicle_local_time);
+ BOOL ClockDataMngGetTimeDiff(LOCALTIME *local_time, int32 *time_diff);
+
+ void ClockDataMngGetStartupTime(CLOCKDATAMNG_GPS_TIME *start_up_time);
+ int32 ClockDataMngCalculateTimeDiff(int32 munuend, int32 subtrahend);
+
+ BOOL ClockDataMngCheckLocalTime(LOCALTIME *local_time);
+ int32 ClockDataMngConversionLocalTime2GpsTime(LOCALTIME *local_time, BOOL calc_second_available);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKDATAMNG_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/ClockGPS_Process_Proto.h b/vehicleservice/positioning/server/include/Sensor/ClockGPS_Process_Proto.h
new file mode 100755
index 0000000..5f20c33
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/ClockGPS_Process_Proto.h
@@ -0,0 +1,37 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * FILE : ClockGPS_Process_Proto.h
+ * SYSTEM : _CWORD107_
+ * SUBSYSTEM: ClockGPS thread
+ * TITLE : Header for publication in a process (EXL)
+ ******************************************************************************/
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKGPS_PROCESS_PROTO_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKGPS_PROCESS_PROTO_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+EFrameworkunifiedStatus ClockGPSThread(HANDLE h_app);
+int TimerSramInit(int); /* Baackup data check/initialization function */ /* Ignore->MISRA-C++:2008 Rule 3-9-2 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKGPS_PROCESS_PROTO_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/ClockUtility.h b/vehicleservice/positioning/server/include/Sensor/ClockUtility.h
new file mode 100755
index 0000000..8924975
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/ClockUtility.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file ClockUtility.h
+@detail Common processing function header file concerning clock
+*****************************************************************************/
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_H_
+
+#include <vehicle_service/positioning_base_library.h>
+#include "Clock_API.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ Function prototype declaration
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+ RET_API ClockUtilityConvertDateToSecond(const LPSYSTEMTIME lp_st, u_int32* uli_sec);
+ RET_API ClockUtilityConvertSecondToDate(const u_int32* uli_sec, LPSYSTEMTIME lp_st);
+
+ /* Converting TimeData Types to SYSTEMTIME Types Functions */
+ CLOCK_RETURN ClockApiConvertTimeDataToSYSTEMTIME(const TimeData* base_time,
+ SYSTEMTIME* result_time);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/ClockUtility_private.h b/vehicleservice/positioning/server/include/Sensor/ClockUtility_private.h
new file mode 100755
index 0000000..8c322ae
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/ClockUtility_private.h
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file ClockUtility_private.h
+@detail Common processing function private header file concerning clock
+*****************************************************************************/
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_PRIVATE_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_PRIVATE_H_
+
+#include "CommonDefine.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ Macro definitions
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define MONTH_MAX (12U) /* Maximum value of month */
+
+ /*
+ Data typing
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ /* Time parameter */
+ typedef struct ClockDayCnvTblTag {
+ YearCntTbl st_tbl[CNV_YEAR_MAX + 1 ]; /* Have +1 data for end determination */
+ } ClockDayCntTbl;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_PRIVATE_H_
+
diff --git a/vehicleservice/positioning/server/include/Sensor/DeadReckoning_Common.h b/vehicleservice/positioning/server/include/Sensor/DeadReckoning_Common.h
new file mode 100755
index 0000000..1c6e060
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/DeadReckoning_Common.h
@@ -0,0 +1,84 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_COMMON_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_COMMON_H_
+/****************************************************************************
+ * File name :DeadReckoning_Common.h
+ * System name :PastModel002
+ * Subsystem name :
+ ****************************************************************************/
+
+#include "Dead_Reckoning_Local_Api.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define DEADRECKONING_ZERO 0
+#define DEADRECKONING_BIT0 0x00000001
+#define DEADRECKONING_BIT1 0x00000002
+#define DEADRECKONING_BIT2 0x00000004
+#define DEADRECKONING_BIT3 0x00000008
+#define DEADRECKONING_BIT4 0x00000010
+#define DEADRECKONING_BIT5 0x00000020
+#define DEADRECKONING_BIT6 0x00000040
+#define DEADRECKONING_BIT7 0x00000080
+#define DEADRECKONING_BIT29 0x20000000
+#define DEADRECKONING_BIT30 0x40000000
+#define DEADRECKONING_BIT31 0x80000000
+#define DEADRECKONING_NEQ 1
+#define DEADRECKONING_EQ 0
+#define DEADRECKONING_INVALID 0
+#define DEADRECKONING_EFFECTIVE 1
+#define DEADRECKONING_CHGTYPE_NCHG DEADRECKONING_EQ
+#define DEADRECKONING_CHGTYPE_CHG DEADRECKONING_NEQ
+#define DEADRECKONING_GETMETHOD_DR 4 /* Data collection way: DR */
+
+/* Offset value of normal data of vehicle sensor */
+#define DEADRECKONING_OFFSET_NORMAL 4
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+
+/* Data Master Set Notification Function */
+typedef void (*PFUNC_DR_DMASTER_SET_N) (DID, u_int8, u_int8);
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+/*********************************************************************
+* TAG : DEADRECKONING_DID_OFFSET_TBL
+* ABSTRACT : Vehicle sensor data ID,Structure of each data in the offset table
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_offset; /* Offset value */
+ u_int8 uc_reserve[2]; /* Reserved */
+} DEADRECKONING_DID_OFFSET_TBL;
+
+/*********************************************************************
+* TAG :
+* ABSTRACT :
+***********************************************************************/
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+u_int8 DeadReckoningMemcmp(const void *, const void *, size_t);
+int32 DeadReckoningCheckDid(DID);
+u_int16 DeadReckoningGetDataMasterOffset(DID);
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_COMMON_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DataMaster.h b/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DataMaster.h
new file mode 100755
index 0000000..00c056a
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DataMaster.h
@@ -0,0 +1,127 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DATAMASTER_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DATAMASTER_H_
+/****************************************************************************
+ * File name :DeadReckoning_DataMaster.h
+ * System name :PastModel002
+ * Subsystem name :DeadReckoning processes
+ ****************************************************************************/
+
+#include "DeadReckoning_Common.h"
+#include "Dead_Reckoning_Local_Api.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/* Initial value */
+#define VEHICLE_DINIT_LONGITUDE 0x00
+#define VEHICLE_DINIT_LATITUDE 0x00
+#define VEHICLE_DINIT_ALTITUDE 0x00
+#define VEHICLE_DINIT_SPEED 0x00
+#define VEHICLE_DINIT_HEADING 0x00
+#define VEHICLE_DINIT_DR_SNS_COUNTER 0x00
+#define VEHICLE_DINIT_GYRO_OFFSET 0x0000
+#define VEHICLE_DINIT_GYRO_SCALE_FACTOR 0x00
+#define VEHICLE_DINIT_GYRO_SCALE_FACTOR_LEVEL 0x00
+#define VEHICLE_DINIT_SPEED_PULSE_SCALE_FACTOR 0x0000
+#define VEHICLE_DINIT_SPEED_PULSE_SCALE_FACTOR_LEVEL 0x00
+
+#define VEHICLE_DSIZE_LONGITUDE 0x04
+#define VEHICLE_DSIZE_LATITUDE 0x04
+#define VEHICLE_DSIZE_ALTITUDE 0x04
+#define VEHICLE_DSIZE_SPEED 0x02
+#define VEHICLE_DSIZE_HEADING 0x02
+#define VEHICLE_DSIZE_DR_SNS_COUNTER 0x01
+#define VEHICLE_DSIZE_GYRO_OFFSET 0x02
+#define VEHICLE_DSIZE_GYRO_SCALE_FACTOR 0x01
+#define VEHICLE_DSIZE_GYRO_SCALE_FACTOR_LEVEL 0x01
+#define VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR 0x02
+#define VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR_LEVEL 0x01
+
+/* Data received*/
+#define DEADRECKONING_RCVFLAG_ON 0x01
+#define DEADRECKONING_RCVFLAG_OFF 0x00
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/*********************************************************************
+* TAG : DEADRECKONING_DATA_MASTER
+* ABSTRACT : Vehicle SW Data Master Structure
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcv_flag; /* Receive flag */
+ u_int8 dr_status; /* DR status */
+ u_int8 uc_data[4]; /* Vehicle DR data */
+} DEADRECKONING_DATA_MASTER;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void DeadReckoningInitDataMaster(void);
+void DeadReckoningSetDataMaster(const DEADRECKONING_DATA_MASTER *, PFUNC_DR_DMASTER_SET_N);
+void DeadReckoningGetDataMaster(DID ul_did, DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitLongitudeDr(void);
+u_int8 DeadReckoningSetLongitudeDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetLongitudeDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitLatitudeDr(void);
+u_int8 DeadReckoningSetLatitudeDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetLatitudeDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitAltitudeDr(void);
+u_int8 DeadReckoningSetAltitudeDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetAltitudeDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitSpeedDr(void);
+u_int8 DeadReckoningSetSpeedDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetSpeedDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitHeadingDr(void);
+u_int8 DeadReckoningSetHeadingDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetHeadingDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitSnsCounterDr(void);
+u_int8 DeadReckoningSetSnsCounterDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetSnsCounterDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitGyroOffsetDr(void);
+u_int8 DeadReckoningSetGyroOffsetDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetGyroOffsetDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitGyroScaleFactorDr(void);
+u_int8 DeadReckoningSetGyroScaleFactorDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetGyroScaleFactorDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitGyroScaleFactorLevelDr(void);
+u_int8 DeadReckoningSetGyroScaleFactorLevelDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetGyroScaleFactorLevelDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitSpeedPulseScaleFactorDr(void);
+u_int8 DeadReckoningSetSpeedPulseScaleFactorDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetSpeedPulseScaleFactorDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitSpeedPulseScaleFactorLevelDr(void);
+u_int8 DeadReckoningSetSpeedPulseScaleFactorLevelDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetSpeedPulseScaleFactorLevelDr(DEADRECKONING_DATA_MASTER *);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DATAMASTER_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DeliveryCtrl.h b/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DeliveryCtrl.h
new file mode 100755
index 0000000..a555a47
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DeliveryCtrl.h
@@ -0,0 +1,137 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DELIVERYCTRL_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DELIVERYCTRL_H_
+/******************************************************************************
+ * File name :DeadReckoning_DeliveryCtrl.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+#include "DeadReckoning_DataMaster.h"
+#include "Dead_Reckoning_Local_Api.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define DEADRECKONING_SIGNAL 6 /* Number of vehicle signals */
+#define DEADRECKONING_DELIVERY 10 /* Number of delivery destinations */
+/* Vehicle sensor information */
+#define DEADRECKONING_DELIVERY_INFO (DEADRECKONING_SIGNAL)
+/* Maximum number of vehicle sensor information */
+#define DEADRECKONING_DELIVERY_INFO_MAX (DEADRECKONING_DELIVERY_INFO * DEADRECKONING_DELIVERY)
+/* Vehicle Sensor Information Valid Number */
+#define DEADRECKONING_DID_EFFECTIVE (DEADRECKONING_SIGNAL)
+#define DEADRECKONING_ACTION_TYPE_ADD 0 /* Vehicle sensor addition processing */
+#define DEADRECKONING_ACTION_TYPE_UPDATE 1 /* Vehicle sensor update processing */
+
+#define DEADRECKONING_LINK_INDEX_END 0xFFFF /* End of the link index */
+
+#define DEADRECKONING_DELIVERY_METHOD_NORMAL 0 /* Delivery system normal delivery */
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/*********************************************************************
+* TAG :DEADRECKONING_DELIVERY_CTRL_TBL_DATA
+* ABSTRACT : Structure of each data of the vehicle sensor delivery destination management table
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ PNO us_pno; /* Shipping PID */
+ u_int8 uc_chg_type; /* Delivery timing */
+ u_int8 uc_ctrl_flg; /* Delivery operation */
+ u_int16 us_link_idx; /* Link index */
+ u_int8 uc_method; /* Delivery system */
+ u_int8 uc_reserve; /* reserve */
+} DEADRECKONING_DELIVERY_CTRL_TBL_DATA;
+
+/*********************************************************************
+* TAG : DEADRECKONING_DELIVERY_CTRL_TBL
+* ABSTRACT : Vehicle Sensor Delivery Destination Management Table Structure
+***********************************************************************/
+typedef struct {
+ u_int16 us_num; /* Number of delivery destination management data items */
+ u_int8 uc_reserve[2]; /* Reserved */
+ /* Array of each data */
+ DEADRECKONING_DELIVERY_CTRL_TBL_DATA st_ctrl_data[DEADRECKONING_DELIVERY_INFO_MAX];
+} DEADRECKONING_DELIVERY_CTRL_TBL;
+
+/*********************************************************************
+* TAG : DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA
+* ABSTRACT : Structure of each data of Vehicle Sensor Destination Management Table Management
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_start_idx; /* Start index */
+ u_int16 us_end_idx; /* End index */
+ u_int16 us_dlvry_entry_num; /* Number of registered shipping addresses */
+ u_int8 uc_reserve[2]; /* Reserved */
+} DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA;
+
+/*********************************************************************
+* TAG : DEADRECKONING_DELIVERY_CTRL_TBL_MNG
+* ABSTRACT : Structure of Vehicle Sensor Delivery Destination Management Table Management
+***********************************************************************/
+typedef struct {
+ u_int16 us_num; /* Number of data items */
+ u_int8 uc_reserve[2]; /* Reserved */
+ /* Array of each data */
+ DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA st_ctrl_tbl_mng_data[DEADRECKONING_DELIVERY_INFO];
+} DEADRECKONING_DELIVERY_CTRL_TBL_MNG;
+
+/*********************************************************************
+* TAG : DEADRECKONING_DELIVERY_PNO_TBL
+* ABSTRACT : Vehicle Sensor Destination PNO Table
+***********************************************************************/
+typedef struct {
+ PNO us_pno; /* Thread ID */
+ u_int16 us_index; /* Appropriate INDEX in the delivery control table */
+ u_int8 uc_method; /* Delivery system */
+ u_int8 uc_reserve[3]; /* reserve */
+} DEADRECKONING_DELIVERY_PNO_TBL_DAT;
+
+typedef struct {
+ u_int16 us_num; /* Number of data items */
+ u_int8 uc_reserve[2]; /* reserve */
+ DEADRECKONING_DELIVERY_PNO_TBL_DAT st_pno_data[DEADRECKONING_DELIVERY_INFO_MAX];
+} DEADRECKONING_DELIVERY_PNO_TBL;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+
+DEADRECKONING_DELIVERY_PNO_TBL* DeadReckoningMakeDeliveryPnoTbl(DID ul_did, u_int8 change_type);
+
+DEAD_RECKONING_RET_API DeadReckoningEntryDeliveryCtrl(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+
+void DeadReckoningInitDeliveryCtrlTbl(void);
+void DeadReckoningInitDeliveryCtrlTblMng(void);
+
+void DeadReckoningAddDeliveryCtrlTbl(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+void DeadReckoningUpdateDeliveryCtrlTbl(DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *);
+void DeadReckoningAddDeliveryCtrlTblMng(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+void DeadReckoningUpdateDeliveryCtrlTblMng(DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *);
+
+void DeadReckoningAddPnoTbl(u_int16);
+void DeadReckoningDeliveryProc(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method);
+void DeadReckoningFirstDelivery(PNO us_pno, DID ul_did);
+
+RET_API DRManagerSndMsg(PNO us_pno_src, PNO us_pno_dest, CID us_cid, u_int16 us_msg_len, const void *p_msg_data);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DELIVERYCTRL_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/DeadReckoning_main.h b/vehicleservice/positioning/server/include/Sensor/DeadReckoning_main.h
new file mode 100755
index 0000000..3e2e9d4
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/DeadReckoning_main.h
@@ -0,0 +1,146 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_MAIN_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_MAIN_H_
+/****************************************************************************
+ * File name :DeadReckoning_main.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+
+#include "Sensor_Common_API.h"
+
+#include "Dead_Reckoning_API.h"
+#include "Dead_Reckoning_Local_Api.h"
+#include "DeadReckoning_Common.h"
+#include "DeadReckoning_DataMaster.h"
+#include "DeadReckoning_DeliveryCtrl.h"
+
+#include "Sensor_API.h"
+#include "VehicleSens_DeliveryCtrl.h"
+#include "VehicleDebug_API.h"
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/* Return value */
+#define RET_SWMNG_SUCCESS RET_NORMAL /* Success of API processing */
+#define RET_SWMNG_ERROR RET_ERROR /* API processing failed */
+
+/*** Rcv Message Relationships ***************************************************/
+/* Size of data section */
+#define DEAD_RECKONING_RCVMSG_MSGBUF 512 /* RcvMSG Byte count in data section */
+#define DEAD_RECKONING_RCVDATA_SENSOR_MSGBUF 40 /* RcvMSG Byte count of Sensor data section */
+#define DEAD_RECKONING_RCVDATA_SENSOR_FIRST_MSGBUF 1000 /* RcvMSG Initial Byte count of sensor data section */
+#define DEAD_RECKONING_SENSOR_FIRST_NUM 175 /* Initial number of saved sensor data */
+
+/* Event initial value */
+/* DR_API_private. Synchronize with DR_EVENT_VAL_INIT in h */
+#define DR_EVENT_VAL_INIT (-101)
+
+/* Event initial value */
+/* DeadReckoning_main. Synchronize with h's VEHICELEDEBUG_EVENT_VAL_INIT */
+#define VEHICLEDEBUG_EVENT_VAL_INIT (-101)
+
+/* PastModel002 sleep time[ms] for CPU load balancing in the first sensor data processing */
+#define DR_FST_SENS_CALC_SLEEP_TIME 15
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/*********************************************************************
+* TAG : DEAD_RECKONING_RCVDATA
+* ABSTRACT : Message receive buffer structure
+***********************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr;
+ u_int8 data[DEAD_RECKONING_RCVMSG_MSGBUF]; /* Data portion */
+} DEAD_RECKONING_RCVDATA;
+
+/*********************************************************************
+* TAG : DEAD_RECKONING_RCVDATA_SENSOR
+* ABSTRACT : LineSensor Vehicle Signal Notification Message Structure
+***********************************************************************/
+typedef struct {
+ u_int32 did; /* Data ID */
+ u_int8 size; /* Size of the data */
+ u_int8 reserve[3]; /* Reserved */
+ u_int8 data[DEAD_RECKONING_RCVDATA_SENSOR_MSGBUF]; /* Data content */
+} DEAD_RECKONING_RCVDATA_SENSOR;
+
+/*********************************************************************
+* TAG : DEAD_RECKONING_RCVDATA_SENSOR_FIRST
+* ABSTRACT : LineSensor Vehicle Signal Notification Message Structure
+***********************************************************************/
+typedef struct {
+ u_int32 did; /* Data ID */
+ u_int16 size; /* Size of the data */
+ u_int8 reserve[1]; /* Reserved */
+ u_int8 num; /* Number of data */
+ u_int8 data[DEAD_RECKONING_RCVDATA_SENSOR_FIRST_MSGBUF]; /* Data content */
+} DEAD_RECKONING_RCVDATA_SENSOR_FIRST;
+
+/*********************************************************************
+* TAG : DEAD_RECKONING_SAVEDATA_SENSOR_FIRST
+* ABSTRACT : LineSensor Vehicle Signal-Storage Message Structures
+***********************************************************************/
+typedef struct {
+ u_int16 gyro_x_data[DEAD_RECKONING_SENSOR_FIRST_NUM * NUM_OF_100msData]; /* Data content */
+ u_int16 gyro_y_data[DEAD_RECKONING_SENSOR_FIRST_NUM * NUM_OF_100msData]; /* Data content */
+ u_int16 gyro_z_data[DEAD_RECKONING_SENSOR_FIRST_NUM * NUM_OF_100msData]; /* Data content */
+ u_int16 spd_pulse_data[DEAD_RECKONING_SENSOR_FIRST_NUM]; /* Data content */
+ u_int8 spd_pulse_check_data[DEAD_RECKONING_SENSOR_FIRST_NUM]; /* Data content */
+ u_int8 rev_data[DEAD_RECKONING_SENSOR_FIRST_NUM]; /* Data content */
+ u_int8 data_num; /* Number of data */
+ u_int8 reserve[3]; /* reserve */
+ u_int16 gyro_x_rcv_size; /* Receiving Size */
+ u_int16 gyro_y_rcv_size; /* Receiving Size */
+ u_int16 gyro_z_rcv_size; /* Receiving Size */
+ u_int16 spd_pulse_rcv_size; /* Receiving Size */
+ u_int16 spd_pulse_check_rcv_size; /* Receiving Size */
+ u_int16 rev_rcv_size; /* Receiving Size */
+} DEAD_RECKONING_SAVEDATA_SENSOR_FIRST;
+
+/*********************************************************************
+* TAG : DEAD_RECKONING_LONLAT_INFO
+* ABSTRACT : Get Position Information Structure
+***********************************************************************/
+typedef struct {
+ u_int8 calc_called; /* Whether Calculate_DeadReckoningData was called */
+ u_int8 available;
+ u_int8 reserve[2];
+ LONLAT lonlat;
+} DEAD_RECKONING_LONLAT_INFO;
+
+/************************************************************************
+* DeadReckoning_main function prototype *
+************************************************************************/
+
+void DeadReckoningRcvMsg(const DEAD_RECKONING_RCVDATA *msg, DEAD_RECKONING_LONLAT_INFO *location_info);
+void DeadReckoningRcvMsgFstSens(const DEAD_RECKONING_RCVDATA *msg, DEAD_RECKONING_LONLAT_INFO *location_info,
+ const SENSOR_MSG_GPSDATA_DAT *rcv_gps_msg, Struct_GpsData* send_gps_msg,
+ Struct_SensData* send_sensor_msg);
+int32 DeadReckoningInit(void);
+void DeadReckoningGetDRData(const DEADRECKONING_MSG_GET_DR_DATA *msg);
+void DeadReckoningSetMapMatchingData(const DR_MSG_MAP_MATCHING_DATA *msg);
+void DeadReckoningClearBackupData(const DR_MSG_CLEAR_BACKUP_DATA *msg);
+void DeadReckoningGetLocationLogStatus(PNO pno);
+void DeadReckoningSetLocationLogStatus(BOOL log_sw, u_int8 severity);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_MAIN_H_ */
diff --git a/vehicleservice/positioning/server/include/Sensor/GpsInt.h b/vehicleservice/positioning/server/include/Sensor/GpsInt.h
new file mode 100755
index 0000000..fbb69de
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/GpsInt.h
@@ -0,0 +1,68 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*****************************************************************************************
+* File name :GpsInt.h
+* System name :PastModel002
+* Process name :Vehicle
+* Overview :GPS interrupt thread header
+******************************************************************************************/
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_GPSINT_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_GPSINT_H_
+
+/*******************************************************************************
+* Include File
+*******************************************************************************/
+
+/*******************************************************************************
+* Define
+*******************************************************************************/
+#define GPS_IRQ_ADR 0x00000306UL /* GPS IRQ addresses */
+#define GPS_MASK_6BIT 0x00000040UL /* GPS IRQ bit-mask position */
+
+#define GPS_GPIO0_IRQSTATUS_0_OFFSET 0x0000002CUL /* IRQSTATUS_0 offset */
+#define GPS_GPIO0_IRQSTATUS_SET_0_OFFSET 0x00000034UL /* IRQSTATUS_SET_0 offset */
+#define GPS_GPIO0_RISINGDETECT_OFFSET 0x00000148UL /* RISINGDETECT offsets */
+
+/* IRQSTATUS_0 address */
+#define GPS_GPIO0_IRQSTATUS_0_ADDR (DM816X_GPIO0_BASE + GPS_GPIO0_IRQSTATUS_0_OFFSET)
+
+/* IRQSTATUS_SET_0 address */
+#define GPS_GPIO0_IRQSTATUS_SET_0_ADDR (DM816X_GPIO0_BASE + GPS_GPIO0_IRQSTATUS_SET_0_OFFSET)
+
+/* RISINGDETECT addresses */
+#define GPS_GPIO0_RISINGDETECT_ADDR (DM816X_GPIO0_BASE + GPS_GPIO0_RISINGDETECT_OFFSET)
+
+/*******************************************************************************
+* Struct
+*******************************************************************************/
+typedef struct {
+ DWORD irq_status_reg; /* Interrupt Source Clear Register */
+ DWORD irq_status_set_reg; /* Interrupt enable register */
+ DWORD rising_detect_reg; /* Rising edge detection setting register */
+} GPS_INT_DATA;
+
+/***************************
+* Function prototype declaration
+***************************/
+RET_API DEVGpsIntInitial(void);
+BOOL DEVGpsIntMapDevice(void);
+void DEVGpsIntUnMapDevice(void);
+void DEVGpsIntSetInterupt(void);
+void DEVGpsIntIntRegClear(void);
+RET_API DEVGpsIntSndMsg(void);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_GPSINT_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/SensorLog.h b/vehicleservice/positioning/server/include/Sensor/SensorLog.h
new file mode 100755
index 0000000..9b6a49a
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/SensorLog.h
@@ -0,0 +1,114 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * SensorLog.h
+ * @brief
+ * Definition for Sensor Logging I/F Liblary
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_SENSORLOG_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_SENSORLOG_H_
+
+#include <stdint.h>
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_define.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* NAV-SVINFO sizes(chnum=20) */
+#define SENSLOG_GPS_SIZE_NAVSVINFO 248
+
+/* Sensor log data type */
+typedef enum {
+ SENSLOG_DATA_I_UNSPECIFIED = 0, /* Input:Not specified */
+
+ SENSLOG_DATA_I_SYS, /* Input:Sensor */
+ SENSLOG_DATA_I_SYS_STS, /* Input:External terminal status */
+ SENSLOG_DATA_I_GPS, /* Input:GPS(_CWORD82_/u-blox) */
+ SENSLOG_DATA_I_LOC, /* Input:Location information */
+ SENSLOG_DATA_I_SPEED, /* Input:Vehicle speed */
+ SENSLOG_DATA_I_TIME, /* Input:Request to set GPS time */
+ SENSLOG_DATA_I_GPSINF, /* Input:GPS information setting request */
+ SENSLOG_DATA_I_GPSRST, /* Input:GPS reset request */
+ SENSLOG_DATA_I_GPSSET, /* Input:GPS setting request */
+ SENSLOG_DATA_I_NAVSVINFO, /* Input:NAV-SVINFO(u-blox)*/
+ SENSLOG_DATA_I_SYS_ABNORMAL, /* Input:Sensor(When an error occurs) */
+ SENSLOG_DATA_I_COUNT /* Classified number */
+} SENSLOG_DATA_I;
+
+typedef enum {
+ SENSLOG_DATA_O_UNSPECIFIED = 0, /* Output:Not specified */
+
+ SENSLOG_DATA_O_SYS, /* Output:Sensor */
+ SENSLOG_DATA_O_SYS_PKG, /* Output:Sensor(PKG) */
+ SENSLOG_DATA_O_GPS, /* Output:GPS(_CWORD82_/u-blox) */
+ SENSLOG_DATA_O_LONLAT_N, /* Output:Latitude and longitude(NAVI) */
+ SENSLOG_DATA_O_LONLAT_G, /* Output:Latitude and longitude(GPS) */
+ SENSLOG_DATA_O_ALT, /* Output:Altitude */
+ SENSLOG_DATA_O_SPEED_N, /* Output:Vehicle speed(NAVI) */
+ SENSLOG_DATA_O_SPEED_P, /* Output:Vehicle speed(POS) */
+ SENSLOG_DATA_O_HEAD_N, /* Output:Orientation(NAVI) */
+ SENSLOG_DATA_O_HEAD_G, /* Output:Orientation(GPS) */
+ SENSLOG_DATA_O_TIME_SETREQ, /* Output:GPS time delivery request */
+ SENSLOG_DATA_O_TIME, /* Output:GPS time */
+ SENSLOG_DATA_O_GPSINF, /* Output:GPS information */
+ SENSLOG_DATA_O_TIME_CS, /* Output:GPS time(For the ClockService) */
+ SENSLOG_DATA_O_GPSRST, /* Output:GPS reset response */
+
+ SENSLOG_DATA_O_COUNT /* Classified number */
+} SENSLOG_DATA_O;
+
+/* Send/Receive result */
+#define SENSLOG_RES_SUCCESS 0 /* Send/Receive Success */
+#define SENSLOG_RES_FAIL 1 /* Send/Receive Abnormality */
+
+/* Destination name(Internal use) */
+#define SENSLOG_PNAME_CLOCK "*Clock" /* Clock Service */
+#define SENSLOG_PNAME_COMMUSB "*CommUSB" /* CommUSB */
+
+#define SENSLOG_ON 1
+#define SENSLOG_OFF 0
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+/* SensorLog public API */
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void SensLogInitialize(uint8_t *p_mount_path);
+ uint8_t SensLogGetNavSvinfoFlag(void);
+ void SensLogWriteInputData(uint16_t us_data_type, DID ul_did, PNO us_pno, uint8_t *p_data, \
+ uint16_t us_size, uint8_t uc_result, uint8_t u_write_flag, uint8_t u_write_abnormal_flag);
+ void SensLogWriteOutputData(uint16_t us_data_type, DID ul_did, PNO us_pno, uint8_t *p_data, \
+ uint16_t us_size, uint8_t uc_result);
+ void SensLogTerminate(void);
+ void SensLogStore(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_SENSORLOG_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/VehicleSens_Common.h b/vehicleservice/positioning/server/include/Sensor/VehicleSens_Common.h
new file mode 100755
index 0000000..7b47268
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/VehicleSens_Common.h
@@ -0,0 +1,131 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_COMMON_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_COMMON_H_
+/****************************************************************************
+ * File name :VehicleSens_Common.h
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ ****************************************************************************/
+
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+
+#include "positioning_hal.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define VEHICLESENS_ZERO 0
+#define VEHICLESENS_BIT0 0x00000001
+#define VEHICLESENS_BIT1 0x00000002
+#define VEHICLESENS_BIT2 0x00000004
+#define VEHICLESENS_BIT3 0x00000008
+#define VEHICLESENS_BIT4 0x00000010
+#define VEHICLESENS_BIT5 0x00000020
+#define VEHICLESENS_BIT6 0x00000040
+#define VEHICLESENS_BIT7 0x00000080
+#define VEHICLESENS_BIT29 0x20000000
+#define VEHICLESENS_BIT30 0x40000000
+#define VEHICLESENS_BIT31 0x80000000
+#define VEHICLESENS_NEQ 1
+#define VEHICLESENS_EQ 0
+#define VEHICLESENS_INVALID 0
+#define VEHICLESENS_EFFECTIVE 1
+#define VEHICLESENS_CHGTYPE_NCHG VEHICLESENS_EQ
+#define VEHICLESENS_CHGTYPE_CHG VEHICLESENS_NEQ
+#define VEHICLESENS_GETMETHOD_CAN 0 /* Data collection way: CAN communication */
+#define VEHICLESENS_GETMETHOD_LINE 1 /* Data collection way: LineSensor drivers */
+#define VEHICLESENS_GETMETHOD_NO_DETECTION 2 /* Data collection way: Not downloaded */
+#define VEHICLESENS_GETMETHOD_GPS 3 /* Data collection way: GPS */
+#define VEHICLESENS_GETMETHOD_NAVI 4 /* Data collection way: NAVI */
+#define VEHICLESENS_GETMETHOD_CLOCK 5 /* Data collection way: Clock Information */
+#define VEHICLESENS_GETMETHOD_INTERNAL 6 /* Data collection way: Internal calculation */
+#define VEHICLESENS_GETMETHOD_OTHER 7 /* Data collection way: Others */
+
+/* Offset value of normal data of vehicle sensor */
+#define VEHICLESENS_OFFSET_NORMAL 32
+/* Offset value of normal data of vehicle sensor */
+#define VEHICLESENS_OFFSET_GPS_FORMAT 268 /* 8 + 260 */
+/* Offset value of normal data of vehicle sensor */
+#define VEHICLESENS_OFFSET_GPS_BINARY 368 /* 8 + 360 */
+/* ++ GPS _CWORD82_ support */
+#define VEHICLESENS_OFFSET_GPS_NMEA 460 /* 8 + 452 Packaged delivery offset */
+/* -- GPS _CWORD82_ support */
+
+/* ++ PastModel002 support */
+/* U-Blox GPS offsets */
+#define VEHICLESENS_OFFSET_GPS_UBLOX 220 /* 220 */
+/* -- PastModel002 support */
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+#define VEHICLESENS_OFFSET_10WORD_PKG_EXT 208 /* Offset value of 10 initial deliveries(WORD) 8 + (20 * 10) */
+#define VEHICLESENS_OFFSET_WORD_PKG_EXT 28 /* Offset value of 10 initial deliveries(WORD) 8 + 20 */
+#define VEHICLESENS_OFFSET_BYTE_PKG_EXT 18 /* Offset value of 10 initial deliveries(BYTE) 8 + 10 */
+#define VEHICLESENS_OFFSET_32LONG_PKG_EXT 1328 /* Offset value of 10 initial deliveries(LONG) 8 + (132 * 10) */
+#define VEHICLESENS_OFFSET_20WORD 48 /* Offset value of 20 sensor data(WORD) 8 + 40 */
+#define VEHICLESENS_OFFSET_20WORD_FST 408 /* Offset value of 20 initial sensor data(WORD) 8 + 400 */
+#define VEHICLESENS_DNUM_4 4 /* Number of sensor data */
+#define VEHICLESENS_DNUM_5 5 /* Number of sensor data */
+#define VEHICLESENS_DNUM_7 7 /* Number of sensor data */
+#endif
+#define VEHICLESENS_EXT_OFF 0 /* Normal delivery */
+#define VEHICLESENS_EXT_ON 1 /* Extended delivery */
+
+#if CONFIG_HW_PORTSET_TYPE_C
+#define VEHICLESENS_OFFSET_GPS_NMEA 248 /* 8 + 240 */
+#endif
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+/* typedef u_int32 DID; */ /* Data ID */
+
+/* Data Master Set Notification Function */
+typedef void (*PFUNC_DMASTER_SET_N) (DID, u_int8, u_int8);
+typedef void (*PFUNC_DMASTER_SET_SHARED_MEMORY) (DID, u_int8);
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+/*********************************************************************
+* TAG : VEHICLESENS_DID_OFFSET_TBL
+* ABSTRACT : Vehicle sensor data ID,Structure of each data in the offset table
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_offset; /* Offset value */
+ u_int8 uc_reserve[2]; /* Reserved */
+} VEHICLESENS_DID_OFFSET_TBL;
+
+/*********************************************************************
+* TAG :
+* ABSTRACT :
+***********************************************************************/
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+u_int8 VehicleSensmemcmp(const void *, const void *, size_t);
+int32 VehicleSensCheckDid(DID);
+u_int16 VehicleSensGetDataMasterOffset(DID);
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+u_int16 VehicleSensGetDataMasterExtOffset(DID);
+#endif
+void VehicleSensSetGpsVersion(const SENSOR_MSG_GPSDATA_DAT *pstData);
+void VehicleSensGetDebugPosDate(void* pBuf, u_int8 uc_get_method);
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_COMMON_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/VehicleSens_DataMaster.h b/vehicleservice/positioning/server/include/Sensor/VehicleSens_DataMaster.h
new file mode 100755
index 0000000..a180764
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/VehicleSens_DataMaster.h
@@ -0,0 +1,1091 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DATAMASTER_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DATAMASTER_H_
+/****************************************************************************
+ * File name :VehicleSens_DataMaster.h
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ ****************************************************************************/
+
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+
+#include "positioning_hal.h"
+#include "VehicleSens_Common.h"
+#include "VehicleSens_SelectionItemList.h"
+#include "CommonDefine.h"
+#include <vehicle_service/POS_common_API.h>
+#include <vehicle_service/POS_gps_API.h>
+#include "Naviinfo_API.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/* Initial value */
+#define VEHICLE_DINIT_SP1P 0x0000
+#define VEHICLE_DINIT_SP1S 0x00
+#define VEHICLE_DINIT_SP1 0x0000
+#define VEHICLE_DINIT_ECOMODE 0x00
+#define VEHICLE_DINIT_NE1 0x0000
+#define VEHICLE_DINIT_R_ACCALL 0x00
+#define VEHICLE_DINIT_R_AC_WNG 0x00
+#define VEHICLE_DINIT_R_SW_CON 0x00
+#define VEHICLE_DINIT_R_BEEP 0x00
+#define VEHICLE_DINIT_I_RA_AUT 0x00
+#define VEHICLE_DINIT_I_RA_AC 0x00
+#define VEHICLE_DINIT_I_RA_LO 0x00
+#define VEHICLE_DINIT_I_RA_HI 0x00
+#define VEHICLE_DINIT_I_AUTO_D 0x00
+#define VEHICLE_DINIT_I_AUTO_P 0x00
+#define VEHICLE_DINIT_I_DEF 0x00
+#define VEHICLE_DINIT_I_RRDEF 0x00
+#define VEHICLE_DINIT_I_RFAUT 0x00
+#define VEHICLE_DINIT_I_REC 0x00
+#define VEHICLE_DINIT_I_FRS 0x00
+#define VEHICLE_DINIT_I_AC 0x00
+#define VEHICLE_DINIT_I_MHTR 0x00
+#define VEHICLE_DINIT_I_WIPD 0x00
+#define VEHICLE_DINIT_I_DUSY 0x00
+#define VEHICLE_DINIT_I_SWNG 0x00
+#define VEHICLE_DINIT_I_BLW_F 0x00
+#define VEHICLE_DINIT_I_OAUT_D 0x00
+#define VEHICLE_DINIT_I_OLET_D 0x00
+#define VEHICLE_DINIT_I_OAUT_P 0x00
+#define VEHICLE_DINIT_I_OLET_P 0x00
+#define VEHICLE_DINIT_ST_BMN_F 0x00
+#define VEHICLE_DINIT_I_AIRPR 0x00
+#define VEHICLE_DINIT_I_O2 0x00
+#define VEHICLE_DINIT_I_PLSM 0x00
+#define VEHICLE_DINIT_I_KAFUN 0x00
+#define VEHICLE_DINIT_I_SAFS 0x00
+#define VEHICLE_DINIT_R_ONSCRN 0x00
+#define VEHICLE_DINIT_I_HUM 0x00
+#define VEHICLE_DINIT_I_TMP_D 0x00
+#define VEHICLE_DINIT_I_TMP_P 0x00
+#define VEHICLE_DINIT_SL_ACDSP 0x00
+#define VEHICLE_DINIT_SL_DUSY 0x00
+#define VEHICLE_DINIT_SL_CIF 0x00
+#define VEHICLE_DINIT_SL_BLW_F 0x00
+#define VEHICLE_DINIT_SL_SRLVL 0x00
+#define VEHICLE_DINIT_SL_RR_IH 0x00
+#define VEHICLE_DINIT_SL_RAUTO 0x00
+#define VEHICLE_DINIT_SL_BLW_R 0x00
+#define VEHICLE_DINIT_SL_DST 0x00
+#define VEHICLE_DINIT_SL_WIPD 0x00
+#define VEHICLE_DINIT_SL_MRHT 0x00
+#define VEHICLE_DINIT_SL_AIRP 0x00
+#define VEHICLE_DINIT_SL_O2 0x00
+#define VEHICLE_DINIT_SL_PLSM 0x00
+#define VEHICLE_DINIT_SL_KAFUN 0x00
+#define VEHICLE_DINIT_SL_SWNG 0x00
+#define VEHICLE_DINIT_ST_CN_OK 0x00
+#define VEHICLE_DINIT_SL_RBLW 0x00
+#define VEHICLE_DINIT_SL_HUM 0x00
+#define VEHICLE_DINIT_R_INLVL 0x00
+#define VEHICLE_DINIT_I_INLVL 0x00
+#define VEHICLE_DINIT_I_AUT_RR 0x00
+#define VEHICLE_DINIT_I_AUT_RL 0x00
+#define VEHICLE_DINIT_I_CNT_IH 0x00
+#define VEHICLE_DINIT_I_RAUTO 0x00
+#define VEHICLE_DINIT_ST_BMN_R 0x00
+#define VEHICLE_DINIT_I_BLW_R 0x00
+#define VEHICLE_DINIT_R_RONSCR 0x00
+#define VEHICLE_DINIT_I_OLT_RR 0x00
+#define VEHICLE_DINIT_I_OLT_RL 0x00
+#define VEHICLE_DINIT_I_TMP_RR 0x00
+#define VEHICLE_DINIT_I_TMP_RL 0x00
+#define VEHICLE_DINIT_ACN_AMB 0x00
+#define VEHICLE_DINIT_AC_AMB05 0x00
+#define VEHICLE_DINIT_SOC_MON 0x00
+#define VEHICLE_DINIT_RDYIND 0x00
+#define VEHICLE_DINIT_HV_M2B 0x00
+#define VEHICLE_DINIT_HV_EP 0x00
+#define VEHICLE_DINIT_HV_EM 0x00
+#define VEHICLE_DINIT_RNRG 0x00
+#define VEHICLE_DINIT_HV_MP 0x00
+#define VEHICLE_DINIT_HV_MB 0x00
+#define VEHICLE_DINIT_HV_RG 0x00
+#define VEHICLE_DINIT_B_P 0x00
+#define VEHICLE_DINIT_B_R 0x00
+#define VEHICLE_DINIT_B_N 0x00
+#define VEHICLE_DINIT_B_D 0x00
+#define VEHICLE_DINIT_B_FC 0x0000
+#define VEHICLE_DINIT_R_DISP 0x00
+#define VEHICLE_DINIT_HVFLAG 0x00
+#define VEHICLE_DINIT_DVINF 0x00
+#define VEHICLE_DINIT_IN_FC 0x0000
+#define VEHICLE_DINIT_UNIT_0 0x00
+#define VEHICLE_DINIT_AS_SP 0x0000
+#define VEHICLE_DINIT_UNIT_1 0x00
+#define VEHICLE_DINIT_FC_SCL 0x00
+#define VEHICLE_DINIT_RANGE 0x0000
+#define VEHICLE_DINIT_UNIT_4 0x00
+#define VEHICLE_DINIT_TO_FC 0x0000
+#define VEHICLE_DINIT_UNIT_6 0x00
+#define VEHICLE_DINIT_AS_TM 0x0000
+#define VEHICLE_DINIT_ADIM_C 0x00
+#define VEHICLE_DINIT_LGCY 0x00
+#define VEHICLE_DINIT_BCTY 0x00
+#define VEHICLE_DINIT_RTRRQ 0x00
+#define VEHICLE_DINIT_DEST_BDB 0x00
+#define VEHICLE_DINIT_DS_PACK1 0x00
+#define VEHICLE_DINIT_DS_PACK2 0x00
+#define VEHICLE_DINIT_STRG_WHL 0x00
+#define VEHICLE_DINIT_TRIP_CNT 0x0000
+#define VEHICLE_DINIT_TIME_CNT 0x00000000
+#define VEHICLE_DINIT_TPM_VAR 0x00
+#define VEHICLE_DINIT_TPM_WA1 0x00
+#define VEHICLE_DINIT_TPM_TNUM 0x00
+#define VEHICLE_DINIT_TPM_REQ0 0x00
+#define VEHICLE_DINIT_TPM_TAN0 0x00
+#define VEHICLE_DINIT_TPM_FLPR 0x00
+#define VEHICLE_DINIT_TPM_FL0 0x00
+#define VEHICLE_DINIT_TPM_FRPR 0x00
+#define VEHICLE_DINIT_TPM_FR0 0x00
+#define VEHICLE_DINIT_TPM_RLPR 0x00
+#define VEHICLE_DINIT_TPM_RL0 0x00
+#define VEHICLE_DINIT_TPM_RRPR 0x00
+#define VEHICLE_DINIT_TPM_RR0 0x00
+#define VEHICLE_DINIT_TPM_SPPR 0x00
+#define VEHICLE_DINIT_TPM_SP0 0x00
+#define VEHICLE_DINIT_B_R2 0x00
+#define VEHICLE_DINIT_VSP0B 0x00
+#define VEHICLE_DINIT_EPBLOCK 0x00
+
+#define VEHICLE_DINIT_DESTINATION_DEST_BDB 0x00
+#define VEHICLE_DINIT_DESTINATION_DS_PACK1 0x00
+#define VEHICLE_DINIT_DESTINATION_DS_PACK2 0x00
+#define VEHICLE_DINIT_HV 0x00
+#define VEHICLE_DINIT_2WD4WD 0x00
+#define VEHICLE_DINIT_STEERING_WHEEL 0x00
+#define VEHICLE_DINIT_VB 0x00
+#define VEHICLE_DINIT_IG 0x00
+#define VEHICLE_DINIT_MIC 0x00
+#define VEHICLE_DINIT_TEST 0x00
+#define VEHICLE_DINIT_VTRADAPTER 0x00
+#define VEHICLE_DINIT_AUXADAPTER 0x00
+#define VEHICLE_DINIT_BACKDOOR 0x00
+#define VEHICLE_DINIT_PKB 0x00
+#define VEHICLE_DINIT_PKB_CAN 0x00
+#define VEHICLE_DINIT_ADIM 0x00
+#define VEHICLE_DINIT_ILL 0x00
+#define VEHICLE_DINIT_RHEOSTAT 0x00
+#define VEHICLE_DINIT_PANELTEMP 0x00
+#define VEHICLE_DINIT_SYSTEMP 0x0000
+#define VEHICLE_DINIT_SPEED_PULSE 0x0000
+#define VEHICLE_DINIT_SPEED_KMPH 0x0000
+#define VEHICLE_DINIT_GYRO_X 0x0000
+#define VEHICLE_DINIT_GYRO_Y 0x0000
+#define VEHICLE_DINIT_GYRO_Z 0x0000
+#define VEHICLE_DINIT_GYRO VEHICLE_DINIT_GYRO_X
+#define VEHICLE_DINIT_GSNS_X 0x0000
+#define VEHICLE_DINIT_GSNS_Y 0x0000
+#define VEHICLE_DINIT_GSNS_Z 0x0000
+#define VEHICLE_DINIT_REV 0x00
+#define VEHICLE_DINIT_VSC1S03_4 0x00
+#define VEHICLE_DINIT_VSC1S03_5 0x00
+#define VEHICLE_DINIT_VSC1S03_6 0x00
+#define VEHICLE_DINIT_VSC1S03_7 0x00
+#define VEHICLE_DINIT_ECO1S01_2 0x00
+#define VEHICLE_DINIT_ENG1F07_0 0x00
+#define VEHICLE_DINIT_ENG1F07_1 0x00
+#define VEHICLE_DINIT_ENG1S03_0 0x00
+#define VEHICLE_DINIT_ENG1S03_1 0x00
+#define VEHICLE_DINIT_ACN1S04_0 0x00
+#define VEHICLE_DINIT_ACN1S04_1 0x00
+#define VEHICLE_DINIT_ACN1S04_2 0x00
+#define VEHICLE_DINIT_ACN1S04_3 0x00
+#define VEHICLE_DINIT_ACN1S04_4 0x00
+#define VEHICLE_DINIT_ACN1S04_5 0x00
+#define VEHICLE_DINIT_ACN1S04_7 0x00
+#define VEHICLE_DINIT_ACN1S05_0 0x00
+#define VEHICLE_DINIT_ACN1S05_1 0x00
+#define VEHICLE_DINIT_ACN1S06_0 0x00
+#define VEHICLE_DINIT_ACN1S06_1 0x00
+#define VEHICLE_DINIT_ACN1S06_2 0x00
+#define VEHICLE_DINIT_ACN1S06_4 0x00
+#define VEHICLE_DINIT_ACN1S06_7 0x00
+#define VEHICLE_DINIT_ACN1S08_0 0x00
+#define VEHICLE_DINIT_ACN1S08_1 0x00
+#define VEHICLE_DINIT_ACN1S08_2 0x00
+#define VEHICLE_DINIT_ACN1S08_6 0x00
+#define VEHICLE_DINIT_ACN1S08_7 0x00
+#define VEHICLE_DINIT_ACN1S07_3 0x00
+#define VEHICLE_DINIT_ACN1S07_5 0x00
+#define VEHICLE_DINIT_EHV1S90_2 0x00
+#define VEHICLE_DINIT_EHV1S90_3 0x00
+#define VEHICLE_DINIT_EHV1S90_4 0x00
+#define VEHICLE_DINIT_EHV1S90_5 0x00
+#define VEHICLE_DINIT_EHV1S90_6 0x00
+#define VEHICLE_DINIT_EHV1S90_7 0x00
+#define VEHICLE_DINIT_ECT1S92_1 0x00
+#define VEHICLE_DINIT_ECT1S92_5 0x00
+#define VEHICLE_DINIT_ENG1S28_0 0x00
+#define VEHICLE_DINIT_ENG1S28_1 0x00
+#define VEHICLE_DINIT_BGM1S01_0 0x00
+#define VEHICLE_DINIT_ENG1F03_1 0x00
+#define VEHICLE_DINIT_ENG1F03_3 0x00
+#define VEHICLE_DINIT_MET1S01_5 0x00
+#define VEHICLE_DINIT_MET1S01_6 0x00
+#define VEHICLE_DINIT_MET1S01_7 0x00
+#define VEHICLE_DINIT_MET1S03_2 0x00
+#define VEHICLE_DINIT_MET1S03_3 0x00
+#define VEHICLE_DINIT_MET1S03_4 0x00
+#define VEHICLE_DINIT_MET1S04_4 0x00
+#define VEHICLE_DINIT_MET1S04_5 0x00
+#define VEHICLE_DINIT_MET1S04_6 0x00
+#define VEHICLE_DINIT_MET1S04_7 0x00
+#define VEHICLE_DINIT_MET1S05_5 0x00
+#define VEHICLE_DINIT_MET1S05_6 0x00
+#define VEHICLE_DINIT_MET1S05_7 0x00
+#define VEHICLE_DINIT_MET1S07_6 0x00
+#define VEHICLE_DINIT_MET1S07_7 0x00
+#define VEHICLE_DINIT_BDB1S01_4 0x00
+#define VEHICLE_DINIT_BDB1S01_5 0x00
+#define VEHICLE_DINIT_BDB1S03_4 0x00
+#define VEHICLE_DINIT_BDB1S08_2 0x00
+#define VEHICLE_DINIT_BDB1S08_3 0x00
+#define VEHICLE_DINIT_BDB1S08_4 0x00
+#define VEHICLE_DINIT_BDB1S08_5 0x00
+#define VEHICLE_DINIT_BDB1F03_2 0x00
+#define VEHICLE_DINIT_BDB1F03_3 0x00
+#define VEHICLE_DINIT_BDB1F03_4 0x00
+#define VEHICLE_DINIT_BDB1F03_5 0x00
+#define VEHICLE_DINIT_BDB1F03_6 0x00
+#define VEHICLE_DINIT_BDB1F03_7 0x00
+#define VEHICLE_DINIT_TPM1S02_2 0x00
+#define VEHICLE_DINIT_TPM1S02_5 0x00
+#define VEHICLE_DINIT_TPM1S03_2 0x00
+#define VEHICLE_DINIT_TPM1S03_3 0x00
+#define VEHICLE_DINIT_TPM1S03_4 0x00
+#define VEHICLE_DINIT_TPM1S03_5 0x00
+#define VEHICLE_DINIT_TPM1S03_6 0x00
+#define VEHICLE_DINIT_TPM1S03_7 0x00
+#define VEHICLE_DINIT_ENG1S92_3 0x00
+#define VEHICLE_DINIT_MMT1S52_0 0x00
+#define VEHICLE_DINIT_EPB1S01_0 0x00
+#define VEHICLE_DINIT_MINIJACK 0x00
+#define VEHICLE_DINIT_GPS_ANTENNA 0x00
+#define VEHICLE_DINIT_SNS_COUNTER 0x00
+#define VEHICLE_DINIT_GPS_COUNTER 0x00
+
+/* ++ PastModel002 support */
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_POSLLH 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_STATUS 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_TIMEUTC 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_VELNED 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_DOP 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_TIMEGPS 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_SVINFO 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_CLOCK 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_MON_HW 0x00
+
+#define VEHICLE_DINIT_SPEED_PULSE_FLAG 0x00
+#define VEHICLE_DINIT_GPS_INTERRUPT_FLAG 0x00
+
+#define VEHICLE_DINIT_GYRO_TROUBLE 0x00 /* Gyro failure status undefined(GYRO_UNFIXED) */
+#define VEHICLE_DINIT_MAIN_GPS_INTERRUPT_SIGNAL 0x00
+#define VEHICLE_DINIT_SYS_GPS_INTERRUPT_SIGNAL 0x00
+#define VEHICLE_DINIT_GYRO_CONNECT_STATUS 0x00
+/* -- PastModel002 support */
+
+/* Size of the data(byte) */
+#define VEHICLE_DSIZE_DESTINATION 0x03
+#define VEHICLE_DSIZE_HV 0x01
+#define VEHICLE_DSIZE_2WD4WD 0x01
+#define VEHICLE_DSIZE_STEERING_WHEEL 0x01
+#define VEHICLE_DSIZE_VB 0x01
+#define VEHICLE_DSIZE_IG 0x01
+#define VEHICLE_DSIZE_MIC 0x01
+#define VEHICLE_DSIZE_TEST 0x01
+#define VEHICLE_DSIZE_VTRADAPTER 0x01
+#define VEHICLE_DSIZE_AUXADAPTER 0x01
+#define VEHICLE_DSIZE_BACKDOOR 0x01
+#define VEHICLE_DSIZE_PKB 0x01
+#define VEHICLE_DSIZE_ADIM 0x01
+#define VEHICLE_DSIZE_ILL 0x01
+#define VEHICLE_DSIZE_RHEOSTAT 0x01
+#define VEHICLE_DSIZE_PANELTEMP 0x01
+#define VEHICLE_DSIZE_SYSTEMP 0x02
+#define VEHICLE_DSIZE_SPEED_PULSE 0x14
+#define VEHICLE_DSIZE_SPEED_KMPH 0x02
+#define VEHICLE_DSIZE_GYRO_X 0x14
+#define VEHICLE_DSIZE_GYRO_Y 0x14
+#define VEHICLE_DSIZE_GYRO_Z 0x14
+#define VEHICLE_DSIZE_GYRO VEHICLE_DSIZE_GYRO_X
+#define VEHICLE_DSIZE_GYRO_TEMP 0x02
+#define VEHICLE_DSIZE_PULSE_TIME 0x84
+#define VEHICLE_DSIZE_GSNS_X 0x06
+#define VEHICLE_DSIZE_GSNS_Y 0x06
+#define VEHICLE_DSIZE_GSNS_Z 0x06
+#define VEHICLE_DSIZE_REV 0x01
+#define VEHICLE_DSIZE_VSC1S03 0x09 /* Internal extensions */
+#define VEHICLE_DSIZE_ECO1S01 0x05
+#define VEHICLE_DSIZE_ENG1F07 0x08
+#define VEHICLE_DSIZE_ENG1S03 0x08
+#define VEHICLE_DSIZE_ACN1S04 0x08
+#define VEHICLE_DSIZE_ACN1S05 0x02
+#define VEHICLE_DSIZE_ACN1S06 0x08
+#define VEHICLE_DSIZE_ACN1S08 0x08
+#define VEHICLE_DSIZE_ACN1S07 0x06
+#define VEHICLE_DSIZE_EHV1S90 0x08
+#define VEHICLE_DSIZE_ECT1S92 0x08
+#define VEHICLE_DSIZE_ENG1S28 0x02
+#define VEHICLE_DSIZE_BGM1S01 0x01
+#define VEHICLE_DSIZE_ENG1F03 0x08
+#define VEHICLE_DSIZE_CAA1N01 0x08
+#define VEHICLE_DSIZE_MET1S01 0x08
+#define VEHICLE_DSIZE_MET1S03 0x08
+#define VEHICLE_DSIZE_MET1S04 0x08
+#define VEHICLE_DSIZE_MET1S05 0x08
+#define VEHICLE_DSIZE_MET1S07 0x08
+#define VEHICLE_DSIZE_BDB1S01 0x08
+#define VEHICLE_DSIZE_BDB1S03 0x08
+#define VEHICLE_DSIZE_BDB1S08 0x08
+#define VEHICLE_DSIZE_BDB1F03 0x08
+#define VEHICLE_DSIZE_TPM1S02 0x08
+#define VEHICLE_DSIZE_TPM1S03 0x08
+#define VEHICLE_DSIZE_ENG1S92 0x08
+#define VEHICLE_DSIZE_MMT1S52 0x08
+#define VEHICLE_DSIZE_EPB1S01 0x03
+#define VEHICLE_DSIZE_MINIJACK 0x01
+#define VEHICLE_DSIZE_GPS_ANTENNA 0x01
+#define VEHICLE_DSIZE_SNS_COUNTER 0x01
+#define VEHICLE_DSIZE_GPS_COUNTER 0x01
+#define VEHICLE_DSIZE_SIRF_BINARY 360
+#define VEHICLE_DSIZE_RTC VEHICLE_DSIZE_GPS_FORMAT
+#define VEHICLE_DSIZE_GPS_VERSION VEHICLE_DSIZE_GPS_FORMAT
+#define VEHICLE_DSIZE_SATELLITE_STATUS VEHICLE_DSIZE_GPS_FORMAT
+#define VEHICLE_DSIZE_LOCATION VEHICLE_DSIZE_GPS_FORMAT
+/* ++ GPS _CWORD82_ support */
+#define VEHICLE_DSIZE_GPS__CWORD82___CWORD44_GP4 VEHICLE_DSIZE_GPS_FORMAT
+#define VEHICLE_DSIZE_GPS__CWORD82__NMEA 424
+#define VEHICLE_DSIZE_GPS__CWORD82__FULLBINARY VEHICLE_DSIZE_GPS_FORMAT
+/* -- GPS _CWORD82_ support */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+#define VEHICLE_DSIZE_DATA_MASTER_FST 0x1200
+
+#define VEHICLE_DSIZE_GYRO_X_FST LSDRV_FSTSNS_DSIZE_GYRO_X
+#define VEHICLE_DSIZE_GYRO_Y_FST LSDRV_FSTSNS_DSIZE_GYRO_Y
+#define VEHICLE_DSIZE_GYRO_Z_FST LSDRV_FSTSNS_DSIZE_GYRO_Z
+#define VEHICLE_DSIZE_SPEED_PULSE_FST LSDRV_FSTSNS_DSIZE_SPEED
+#define VEHICLE_DSIZE_GSNSX_FST LSDRV_FSTSNS_DSIZE_GSENSOR_X
+#define VEHICLE_DSIZE_GSNSY_FST LSDRV_FSTSNS_DSIZE_GSENSOR_Y
+#define VEHICLE_DSIZE_GSNSZ_FST LSDRV_FSTSNS_DSIZE_GSENSOR_Z
+#define VEHICLE_DSIZE_GYROTEMP_FST LSDRV_FSTSNS_DSIZE_GYRO_TEMP
+#define VEHICLE_DSIZE_SPEED_PULSE_FLAG_FST LSDRV_FSTSNS_DSIZE_SPEED_FLG
+#define VEHICLE_DSIZE_REV_FST LSDRV_FSTSNS_DSIZE_REV
+
+#define VEHICLE_DSIZE_GYRO_EXT 0x500
+#define VEHICLE_DSIZE_SPEED_PULSE_EXT 0x500
+#define VEHICLE_DSIZE_GSNS_X_EXT 0x500
+#define VEHICLE_DSIZE_GSNS_Y_EXT 0x500
+#define VEHICLE_DSIZE_GSNS_Z_EXT 0x500
+#define VEHICLE_DSIZE_SNS_COUNTER_EXT 0x40
+#define VEHICLE_DSIZE_GYRO_TEMP_EXT 0x80
+#define VEHICLE_DSIZE_REV_EXT 0x40
+#define VEHICLE_DSIZE_PULSE_TIME_EXT 0x2100
+
+#define VEHICLE_DSIZE_GYRO_EXT_INIT 0x00 /* Gyro output extended data master registration number initial value */
+#define VEHICLE_DSIZE_SPEED_PULSE_EXT_INIT 0x00 /* Vehicle speed expansion data master registration number initial value */
+#define VEHICLE_DSIZE_GSNS_X_EXT_INIT 0x00 /* Initial value of G sensor (X-axis) extended data master registration number */
+#define VEHICLE_DSIZE_GSNS_Y_EXT_INIT 0x00 /* Initial value of G sensor (Y-axis) expansion data master registration number */
+#define VEHICLE_DSIZE_GSNS_Z_EXT_INIT 0x00 /* Initial value of G sensor (Z-axis) expansion data master registration number */
+#define VEHICLE_DSIZE_SNS_COUNTER_EXT_INIT 0x00 /* Initial value of register number of sensor counter extended data master */
+#define VEHICLE_DSIZE_REV_EXT_INIT 0x00 /* REV extended data master registration number initial value */
+#define VEHICLE_DSIZE_GYRO_TEMP_EXT_INIT 0x00 /* Gyro Temperature Extended Data Master Registration Number Initial Value */
+#define VEHICLE_DSIZE_PULSE_TIME_EXT_INIT 0x00 /* Extended data master registration number initial value between pulse time */
+
+#define VEHICLE_DSIZE_GYRO_TROUBLE 0x01
+#define VEHICLE_DSIZE_MAIN_GPS_INTERRUPT_SIGNAL 0x01
+#define VEHICLE_DSIZE_SYS_GPS_INTERRUPT_SIGNAL 0x01
+#define VEHICLE_DSIZE_GYRO_CONNECT_STATUS 0x01
+
+#define VEHICLE_DKEEP_MAX 64 /* Internal data retention count */
+
+/* Data storage location */
+#define VEHICLE_DATA_POS_00 0x00 /* Data storage position 0 */
+#define VEHICLE_DATA_POS_01 0x01 /* Data storage position 1 */
+#endif
+
+#define VEHICLE_DSIZE_GPS_FORMAT 1904
+
+/* ++ PastModel002 support */
+/* GPS_u-blox data size(Up to 208 bytes + 1 byte of sensor counter) */
+#define VEHICLE_DSIZE_GPS_UBLOX_FORMAT 212
+/* ++ PastModel002 support */
+
+/* NMEA data size */
+#define VEHICLE_DSIZE_GPS_NMEA_GGA 71 /* Positioning information(Fixed-length sentence 71 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_DGGA 75 /* Double precision GGA - Positioning information(Fixed-length sentence 75 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_VTG 37 /* Progress Direction,Velocity information(Fixed-length sentence 37 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_RMC 61 /* RMC - Minimal information(Fixed-length sentence 61 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_DRMC 67 /* Double RMC - Minimal information(Fixed-length sentence 67 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_GLL 44 /* GLL - Geographical locality information(Fixed-length sentence 44 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_DGLL 50 /* Double-precision GLL - Geographical locality information(Fixed-length sentence 50 Byte) */
+/* GSA - DOP information and positioning satellite information(Fixed-length sentence 66 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_GSA 66
+#define VEHICLE_DSIZE_GPS_NMEA_GSV_1 70 /* GSV - Visual satellite information(Fixed-length sentence 70 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_GSV_2 70 /* GSV - Visual satellite information(Fixed-length sentence 70 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_GSV_3 70 /* GSV - Visual satellite information(Fixed-length sentence 70 Byte) */
+/* _CWORD44_,GP,3 - Visual satellite reception information */
+#define VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_3 78
+/* _CWORD44_,GP,4 - Receiver-specific information */
+#define VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4 25
+
+/* FULLBINARY data size */
+/* Fully customized output */
+#define VEHICLE_DSIZE_GPS_FULLBINARY GPS_CMD_FULLBIN_SZ
+
+#if CONFIG_HW_PORTSET_TYPE_C
+#define VEHICLE_DSIZE_NMEA 0
+#define VEHICLE_DSIZE_GGA 0x00
+#define VEHICLE_DSIZE_GLL 0x00
+#define VEHICLE_DSIZE_GSA 0x00
+#define VEHICLE_DSIZE_GSV 0x00
+#define VEHICLE_DSIZE_RMC 0x00
+#define VEHICLE_DSIZE_VTG 0x00
+#endif
+
+/* ++ PastModel002 support */
+#define VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE 0 /* UBX common header size */
+
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_CLOCK 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_DOP 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_POSLLH 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_STATUS 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO 0 /* 8 + 12*numCh(For variable,Define only the fixed part) */
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_TIMEGPS 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_TIMEUTC 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_VELNED 0
+#define VEHICLE_DSIZE_GPS_UBLOX_MON_HW 0
+
+#define VEHICLE_DSIZE_SPEED_PULSE_FLAG 0x00
+#define VEHICLE_DSIZE_GPS_INTERRUPT_FLAG 0x00
+
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO_CH_MAX 0 /* Maximum number of NAV_SVINFO channels */
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO_ALONE_MAX 0 /* NAV_SVINFO channel:Maximum Single Data Size */
+/* -- PastModel002 support */
+
+/* Data received*/
+#define VEHICLE_RCVFLAG_ON 0x00
+#define VEHICLE_RCVFLAG_OFF 0x00
+
+/* Upper limit of number of data items stored between pulses */
+#define VEHICLE_SNS_INFO_PULSE_NUM 0
+
+/*------------------------------------------------------------------------------*
+ * NMEA reception flag *
+ -------------------------------------------------------------------------------*/
+/* Not supported by UBX_Protocol */
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/*********************************************************************
+* TAG : VEHICLESENS_DATA_MASTER
+* ABSTRACT : Vehicle sensor data master structure
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_snscnt; /* Sensor Counter */
+ u_int8 uc_data[132]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER;
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data[8448]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_EXT;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 partition_flg; /* Fragmented Transmission Flag */
+ u_int8 uc_data[VEHICLE_DSIZE_DATA_MASTER_FST]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_FST;
+
+#endif
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data[VEHICLE_DSIZE_GPS_FORMAT]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_FORMAT;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data[VEHICLE_DSIZE_SIRF_BINARY]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_BINARY;
+
+/* ++ GPS _CWORD82_ support */
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data[VEHICLE_DSIZE_GPS__CWORD82__NMEA]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_NMEA_FORMAT;
+
+/* -- GPS _CWORD82_ support */
+#if CONFIG_HW_PORTSET_TYPE_C
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data[VEHICLE_DSIZE_NMEA]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_NMEA;
+#endif
+
+/* ++ PastModel002 support */
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_sensor_cnt; /* Sensor Counter */
+ u_int8 uc_gpscnt_flag; /* GPS counter flag */
+ u_int8 reserve[3]; /* reserve */
+ u_int8 uc_data[VEHICLE_DSIZE_GPS_UBLOX_FORMAT]; /* UBLOX_GPS data */
+} VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GYRO_TROUBLE;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_sensor_cnt; /* Sensor Counter */
+ u_int8 uc_data; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS;
+
+/* ++ PastModel002 support */
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*********************************************************************
+* TAG : VEHICLESENS_PKG_DELIVERY_TEMP_EXT
+* ABSTRACT : Structure of Vehicle Sensor Initial Delivery Management Table
+***********************************************************************/
+typedef struct {
+ u_int16 us_gyro[10]; /* Gyro output */
+ u_int16 us_sp_pls[10]; /* Vehicle speed pulse */
+ u_int8 uc_sens_cnt; /* Sensor Counter */
+ u_int8 uc_reserve[3]; /* reserve */
+} VEHICLESENS_PKG_DELIVERY_TEMP_TBL;
+
+// for VEHICLESENS_PKG_DELIVERY_TEMP_EXT.start_point index
+enum VEHICLESENS_PKG_INDEX {
+ SNSCounter = 0,
+ SpeedPulse,
+ GyroExt,
+ GsnsX,
+ GsnsY,
+ Rev,
+ GyroTemp,
+ PulseTime,
+ GyroY,
+ GyroZ,
+ GsnsZ,
+ MAX
+};
+
+typedef struct {
+ uint16_t start_point[8]; /* Sequence reference start position */
+ uint16_t end_point; /* Array registration completion position */
+ uint16_t data_break; /* All data undelivered flag */
+} VEHICLESENS_PKG_DELIVERY_TEMP_EXT;
+
+/************************************************************************
+* External variable *
+************************************************************************/
+extern VEHICLESENS_PKG_DELIVERY_TEMP_EXT gstPkgTempExt; // NOLINT(readability/nolint)
+#endif
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void VehicleSensInitDataMaster(void);
+void VehicleSensSetDataMasterLineSens(const LSDRV_LSDATA *, PFUNC_DMASTER_SET_N func, BOOL);
+void VehicleSensSetDataMasterLineSensG(const LSDRV_LSDATA_G *, PFUNC_DMASTER_SET_N func, BOOL);
+void VehicleSensSetDataMasterGps(SENSOR_MSG_GPSDATA_DAT *, PFUNC_DMASTER_SET_N func);
+void VehicleSensGetDataMaster(DID ul_did, u_int8, VEHICLESENS_DATA_MASTER *);
+void VehicleSensGetGpsDataMaster(DID ul_did, u_int8, SENSOR_MSG_GPSDATA_DAT *);
+void VehicleSensSetDataMasterData(const POS_MSGINFO *, PFUNC_DMASTER_SET_N func);
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+void VehicleSensSetDataMasterLineSensFst(const LSDRV_LSDATA_FST *pst_data, PFUNC_DMASTER_SET_N p_data_master_set_n);
+void VehicleSensSetDataMasterLineSensFstG(const LSDRV_MSG_LSDATA_DAT_FST *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n);
+void VehicleSensGetDataMasterFst(DID ul_did, u_int8, VEHICLESENS_DATA_MASTER_FST *);
+void VehicleSensGetDataMasterExt(DID ul_did, u_int8, VEHICLESENS_DATA_MASTER_EXT *);
+#endif
+
+void VehicleSensSetDataMasterGyroTrouble(const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n);
+void VehicleSensSetDataMasterSysGpsInterruptSignal(const LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL *pst_data,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory);
+void VehicleSensSetDataMasterMainGpsInterruptSignal(const SENSOR_MSG_GPSDATA_DAT *pst_data,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory);
+void VehicleSensSetDataMasterGyroConnectStatus(const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *pst_data,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory);
+void VehicleSensSetDataMasterGpsAntennaStatus(const LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n);
+
+void VehicleSensGetDataMasterGyroTrouble(DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_data);
+void VehicleSensGetDataMasterSysGpsInterruptSignal(DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data);
+void VehicleSensGetDataMasterMainGpsInterruptSignal(DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data);
+void VehicleSensGetDataMasterGyroConnectStatus(DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_data);
+void VehicleSensGetDataMasterGpsAntennaStatus(DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_data);
+
+void VehicleSensGetGsnsX(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGsnsXl(void);
+u_int8 VehicleSensSetGsnsXl(const LSDRV_LSDATA *);
+void VehicleSensGetGsnsXl(VEHICLESENS_DATA_MASTER *);
+u_int8 VehicleSensSetGsnsXlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsXFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGsnsXFstl(void);
+u_int8 VehicleSensSetGsnsXFstG(const LSDRV_LSDATA_FST_GSENSOR_X *pst_data);
+void VehicleSensGetGsnsXFstl(VEHICLESENS_DATA_MASTER_FST *pst_data);
+
+void VehicleSensGetGsnsY(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGsnsYl(void);
+u_int8 VehicleSensSetGsnsYl(const LSDRV_LSDATA *);
+void VehicleSensGetGsnsYl(VEHICLESENS_DATA_MASTER *);
+u_int8 VehicleSensSetGsnsYlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsYFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGsnsYFstl(void);
+u_int8 VehicleSensSetGsnsYFstG(const LSDRV_LSDATA_FST_GSENSOR_Y *pst_data);
+void VehicleSensGetGsnsYFstl(VEHICLESENS_DATA_MASTER_FST *pst_data);
+
+void VehicleSensGetGsnsZ(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGsnsZl(void);
+u_int8 VehicleSensSetGsnsZl(const LSDRV_LSDATA *);
+void VehicleSensGetGsnsZl(VEHICLESENS_DATA_MASTER *);
+u_int8 VehicleSensSetGsnsZlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsZFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGsnsZFstl(void);
+u_int8 VehicleSensSetGsnsZFstG(const LSDRV_LSDATA_FST_GSENSOR_Z *pst_data);
+void VehicleSensGetGsnsZFstl(VEHICLESENS_DATA_MASTER_FST *pst_data);
+
+void VehicleSensGetGyroX(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGyroXl(void);
+u_int8 VehicleSensSetGyroXl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetGyroXlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroXl(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetGyroY(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGyroYl(void);
+u_int8 VehicleSensSetGyroYl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetGyroYlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroYl(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetGyroZ(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGyroZl(void);
+u_int8 VehicleSensSetGyroZl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetGyroZlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroZl(VEHICLESENS_DATA_MASTER *);
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+void VehicleSensGetSpeedPulseFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitSpeedPulseFstl(void);
+u_int8 VehicleSensSetSpeedPulseFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetSpeedPulseFstG(const LSDRV_LSDATA_FST_SPEED *);
+void VehicleSensGetSpeedPulseFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetGyroXFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGyroXFstl(void);
+u_int8 VehicleSensSetGyroXFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetGyroXFstG(const LSDRV_LSDATA_FST_GYRO_X *);
+void VehicleSensGetGyroXFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetGyroYFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGyroYFstl(void);
+u_int8 VehicleSensSetGyroYFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetGyroYFstG(const LSDRV_LSDATA_FST_GYRO_Y *);
+void VehicleSensGetGyroYFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetGyroYExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGyroYExtl(void);
+void VehicleSensSetGyroYExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroYExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetGyroZFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGyroZFstl(void);
+u_int8 VehicleSensSetGyroZFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetGyroZFstG(const LSDRV_LSDATA_FST_GYRO_Z *);
+void VehicleSensGetGyroZFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetGyroZExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGyroZExtl(void);
+void VehicleSensSetGyroZExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroZExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetSpeedPulseFlagFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitSpeedPulseFlagFstl(void);
+u_int8 VehicleSensSetSpeedPulseFlagFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetSpeedPulseFlagFstG(const LSDRV_LSDATA_FST_SPEED_PULSE_FLAG *);
+void VehicleSensGetSpeedPulseFlagFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetRevFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitRevFstl(void);
+u_int8 VehicleSensSetRevFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetRevFstG(const LSDRV_LSDATA_FST_REV *);
+void VehicleSensGetRevFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetGsnsXExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGsnsXExtl(void);
+void VehicleSensSetGsnsXExtl(const LSDRV_LSDATA *);
+void VehicleSensSetGsnsXExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsXExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetGsnsYExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGsnsYExtl(void);
+void VehicleSensSetGsnsYExtl(const LSDRV_LSDATA *);
+void VehicleSensSetGsnsYExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsYExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetGsnsZExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGsnsZExtl(void);
+void VehicleSensSetGsnsZExtl(const LSDRV_LSDATA *);
+void VehicleSensSetGsnsZExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsZExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetGyroExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGyroExtl(void);
+void VehicleSensSetGyroExtl(const LSDRV_LSDATA *);
+void VehicleSensSetGyroExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetGyroRev(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGyroRevl(void);
+u_int8 VehicleSensSetGyroRevl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetGyroRevlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroRevl(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetSpeedPulseExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitSpeedPulseExtl(void);
+void VehicleSensSetSpeedPulseExtl(const LSDRV_LSDATA *);
+void VehicleSensSetSpeedPulseExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetSpeedPulseExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetSnsCounterExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitSnsCounterExtl(void);
+void VehicleSensSetSnsCounterExtl(const LSDRV_LSDATA *);
+void VehicleSensSetSnsCounterExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetSnsCounterExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetRevExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method);
+void VehicleSensGetRevExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data);
+void VehicleSensInitRevExtl(void);
+void VehicleSensSetRevExtlG(const LSDRV_LSDATA_G *pst_data);
+
+#endif
+
+void VehicleSensGetSpeedKmph(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitSpeedKmphl(void);
+u_int8 VehicleSensSetSpeedKmphl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetSpeedKmphlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetSpeedKmphl(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetGyroTemp(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method);
+void VehicleSensInitGyroTempl(void);
+u_int8 VehicleSensSetGyroTemplG(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetGyroTempl(VEHICLESENS_DATA_MASTER *pst_data);
+
+void VehicleSensGetGyroTempFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method);
+void VehicleSensInitGyroTempFstl(void);
+u_int8 VehicleSensSetGyroTempFstG(const LSDRV_LSDATA_FST_GYRO_TEMP *pst_data);
+void VehicleSensGetGyroTempFstl(VEHICLESENS_DATA_MASTER_FST *pst_data);
+
+void VehicleSensGetGyroTempExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method);
+void VehicleSensInitGyroTempExtl(void);
+void VehicleSensSetGyroTempExtlG(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetGyroTempExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data);
+
+void VehicleSensGetPulseTime(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method);
+void VehicleSensInitPulseTimel(void);
+u_int8 VehicleSensSetPulseTimelG(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetPulseTimel(VEHICLESENS_DATA_MASTER *pst_data);
+
+void VehicleSensGetPulseTimeExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method);
+void VehicleSensInitPulseTimeExtl(void);
+void VehicleSensSetPulseTimeExtlG(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetPulseTimeExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data);
+
+void VehicleSensGetRev(VEHICLESENS_DATA_MASTER *, u_int8);
+
+void VehicleSensInitRevl(void);
+u_int8 VehicleSensSetRevl(const LSDRV_LSDATA *);
+void VehicleSensGetRevl(VEHICLESENS_DATA_MASTER *);
+u_int8 VehicleSensSetRevlG(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetRevline(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetSpeedPulse(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitSpeedPulsel(void);
+u_int8 VehicleSensSetSpeedPulsel(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetSpeedPulselG(const LSDRV_LSDATA_G *);
+void VehicleSensGetSpeedPulsel(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetGpsAntenna(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGpsAntennal(void);
+u_int8 VehicleSensSetGpsAntennal(const LSDRV_LSDATA *);
+void VehicleSensGetGpsAntennal(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetSnsCounter(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitSnsCounterl(void);
+u_int8 VehicleSensSetSnsCounterl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetSnsCounterlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetSnsCounterl(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensInitGpsCounterg(void);
+u_int8 VehicleSensSetGpsCounterg(const SENSOR_MSG_GPSDATA_DAT *);
+void VehicleSensGetGpsCounterg(SENSOR_MSG_GPSDATA_DAT *);
+
+/* ++ PastModel002 support */
+/* U-BLOX_GPS MON-HW */
+void VehicleSensInitMonHwG(void);
+u_int8 VehicleSensSetMonHwG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetMonHwG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-CLOCK */
+void VehicleSensInitNavClockG(void);
+u_int8 VehicleSensSetNavClockG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavClockG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-DOP */
+void VehicleSensInitNavDopG(void);
+u_int8 VehicleSensSetNavDopG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavDopG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-POSLLH */
+void VehicleSensInitNavPosllhG(void);
+u_int8 VehicleSensSetNavPosllhG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavPosllhG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-STATUS */
+void VehicleSensInitNavStatusG(void);
+u_int8 VehicleSensSetNavStatusG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavStatusG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-SVINFO */
+void VehicleSensInitNavSvInfoG(void);
+u_int8 VehicleSensSetNavSvInfoG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavSvInfoG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-TIMEGPS */
+void VehicleSensInitNavTimeGpsG(void);
+u_int8 VehicleSensSetNavTimeGpsG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavTimeGpsG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-TIMEUTC */
+void VehicleSensInitNavTimeUtcG(void);
+u_int8 VehicleSensSetNavTimeUtcG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavTimeUtcG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-VELNED */
+void VehicleSensInitNavVelnedG(void);
+u_int8 VehicleSensSetNavVelnedG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavVelnedG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* DR SPEED_PULSE_FLAG */
+void VehicleSensInitSpeedPulseFlag(void);
+u_int8 VehicleSensSetSpeedPulseFlag(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetSpeedPulseFlag(VEHICLESENS_DATA_MASTER *);
+
+/* DR GPS_INTERRUPT_FLAG */
+void VehicleSensInitGpsInterruptFlag(void);
+u_int8 VehicleSensSetGpsInterruptFlag(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetGpsInterruptFlag(VEHICLESENS_DATA_MASTER *);
+
+/* GYRO_TROUBLE */
+void VehicleSensInitGyroTrouble(void);
+u_int8 VehicleSensSetGyroTrouble(const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *pst_data);
+void VehicleSensGetGyroTrouble(VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_data);
+
+/* MAIN_GPS_INTERRUPT_SIGNAL */
+void VehicleSensInitMainGpsInterruptSignal(void);
+u_int8 VehicleSensSetMainGpsInterruptSignal(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetMainGpsInterruptSignal(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data);
+
+/* SYS_GPS_INTERRUPT_SIGNAL */
+void VehicleSensInitSysGpsInterruptSignal(void);
+u_int8 VehicleSensSetSysGpsInterruptSignal(const LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL *pst_data);
+void VehicleSensGetSysGpsInterruptSignal(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data);
+
+/* GYRO_CONNECT_STATUS */
+void VehicleSensInitGyroConnectStatus(void);
+u_int8 VehicleSensSetGyroConnectStatus(const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *pst_data);
+void VehicleSensGetGyroConnectStatus(VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_data);
+
+/* GPS_ANTENNA_STATUS */
+void VehicleSensInitGpsAntennaStatus(void);
+u_int8 VehicleSensSetGpsAntennaStatus(const LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS *pst_data);
+void VehicleSensGetGpsAntennaStatus(VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_data);
+
+/* -- PastModel002 support */
+
+/* GPS__CWORD82__FULLBINARY */
+void VehicleSensInitGps_CWORD82_FullBinaryG(void);
+u_int8 VehicleSensSetGps_CWORD82_FullBinaryG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetGps_CWORD82_FullBinaryG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* GPS__CWORD82__FULLBINARY */
+void VehicleSensInitGps_CWORD82__CWORD44_Gp4G(void);
+u_int8 VehicleSensSetGps_CWORD82__CWORD44_Gp4G(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetGps_CWORD82__CWORD44_Gp4G(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* GPS__CWORD82__NMEA */
+void VehicleSensInitGps_CWORD82_NmeaG(void);
+u_int8 VehicleSensSetGps_CWORD82_NmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetGps_CWORD82_NmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* GPS_NMEA */
+void VehicleSensInitGpsNmeaG(void);
+u_int8 VehicleSensSetGpsNmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetGpsNmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* LOCATION_LONLAT */
+void VehicleSensGetLocationLonLat(VEHICLESENS_DATA_MASTER *pst_data, u_int8);
+void VehicleSensInitLocationLonLatG(void);
+u_int8 VehicleSensSetLocationLonLatG(const SENSORLOCATION_LONLATINFO_DAT*);
+void VehicleSensGetLocationLonLatG(VEHICLESENS_DATA_MASTER*);
+void VehicleSensInitLocationLonLatN(void);
+u_int8 VehicleSensSetLocationLonLatN(const SENSORLOCATION_LONLATINFO_DAT*);
+void VehicleSensGetLocationLonLatN(VEHICLESENS_DATA_MASTER*);
+void VehicleSensGetLocationLonLatnUnitCnv(VEHICLESENS_DATA_MASTER*);
+
+/* LOCATION_ALTITUDE */
+void VehicleSensGetLocationAltitude(VEHICLESENS_DATA_MASTER *pst_data, u_int8);
+void VehicleSensInitLocationAltitudeG(void);
+u_int8 VehicleSensSetLocationAltitudeG(const SENSORLOCATION_ALTITUDEINFO_DAT*);
+void VehicleSensGetLocationAltitudeG(VEHICLESENS_DATA_MASTER*);
+void VehicleSensInitLocationAltitudeN(void);
+u_int8 VehicleSensSetLocationAltitudeN(const SENSORLOCATION_ALTITUDEINFO_DAT*);
+void VehicleSensGetLocationAltitudeN(VEHICLESENS_DATA_MASTER*);
+
+/* MOTION_SPEED */
+void VehicleSensGetMotionSpeed(VEHICLESENS_DATA_MASTER *pst_data, u_int8);
+void VehicleSensInitMotionSpeedG(void);
+u_int8 VehicleSensSetMotionSpeedG(const SENSORMOTION_SPEEDINFO_DAT*);
+void VehicleSensGetMotionSpeedG(VEHICLESENS_DATA_MASTER*);
+void VehicleSensInitMotionSpeedN(void);
+u_int8 VehicleSensSetMotionSpeedN(const SENSORMOTION_SPEEDINFO_DAT*);
+void VehicleSensGetMotionSpeedN(VEHICLESENS_DATA_MASTER*);
+void VehicleSensInitMotionSpeedI(void);
+u_int8 VehicleSensSetMotionSpeedI(const SENSORMOTION_SPEEDINFO_DAT*);
+void VehicleSensGetMotionSpeedI(VEHICLESENS_DATA_MASTER*);
+
+/* MOTION_HEADING */
+void VehicleSensGetMotionHeading(VEHICLESENS_DATA_MASTER *pst_data, u_int8);
+void VehicleSensInitMotionHeadingG(void);
+u_int8 VehicleSensSetMotionHeadingG(const SENSORMOTION_HEADINGINFO_DAT*);
+void VehicleSensGetMotionHeadingG(VEHICLESENS_DATA_MASTER*);
+void VehicleSensInitMotionHeadingN(void);
+u_int8 VehicleSensSetMotionHeadingN(const SENSORMOTION_HEADINGINFO_DAT*);
+void VehicleSensGetMotionHeadingN(VEHICLESENS_DATA_MASTER*);
+void VehicleSensGetMotionHeadingnCnvData(VEHICLESENS_DATA_MASTER*);
+
+/* GPS_TIME */
+void VehicleSensGetGpsTime(SENSOR_MSG_GPSDATA_DAT*, u_int8);
+void VehicleSensInitGpsTimeG(void);
+u_int8 VehicleSensSetGpsTimeG(const SENSOR_MSG_GPSTIME*);
+void VehicleSensGetGpsTimeG(SENSOR_MSG_GPSDATA_DAT*);
+
+/* GPS_TIME_RAW */
+void VehicleSensGetGpsTimeRaw(SENSOR_MSG_GPSDATA_DAT*, u_int8);
+void VehicleSensInitGpsTimeRawG(void);
+u_int8 VehicleSensSetGpsTimeRawG(const SENSOR_GPSTIME_RAW*);
+void VehicleSensGetGpsTimeRawG(SENSOR_MSG_GPSDATA_DAT*);
+
+/* GPS_WKNROLLOVER */
+void VehicleSensGetWknRollover(VEHICLESENS_DATA_MASTER*, u_int8);
+void VehicleSensInitWknRolloverG(void);
+u_int8 VehicleSensSetWknRolloverG(const SENSOR_WKNROLLOVER*);
+void VehicleSensGetWknRolloverG(SENSOR_MSG_GPSDATA_DAT*);
+
+/* DIAG_GPS */
+void VehicleSensInitNaviinfoDiagGPSg(void);
+u_int8 VehicleSensSetNaviinfoDiagGPSg(const NAVIINFO_DIAG_GPS*);
+void VehicleSensGetNaviinfoDiagGPSg(SENSOR_MSG_GPSDATA_DAT*);
+
+/* SETTINGTIME */
+void VehicleSensGetSettingTime(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitSettingTimeclock(void);
+u_int8 VehicleSensSetSettingTimeclock(const POS_DATETIME*);
+void VehicleSensGetSettingTimeclock(VEHICLESENS_DATA_MASTER*);
+
+/* GPS_CLOCK_DRIFT */
+void VehicleSensGetGpsClockDrift(SENSOR_MSG_GPSDATA_DAT *, u_int8);
+void VehicleSensInitGpsClockDriftG(void);
+u_int8 VehicleSensSetGpsClockDriftG(const int32_t*);
+void VehicleSensGetGpsClockDriftG(SENSOR_MSG_GPSDATA_DAT*);
+
+/* GPS_CLOCK_FREQ */
+void VehicleSensGetGpsClockFreq(SENSOR_MSG_GPSDATA_DAT *, u_int8);
+void VehicleSensInitGpsClockFreqG(void);
+u_int8 VehicleSensSetGpsClockFreqG(const uint32_t*);
+void VehicleSensGetGpsClockFreqG(SENSOR_MSG_GPSDATA_DAT*);
+
+/* LOCATION INFORMATION (NMEA) */
+void VehicleSens_GetLocationInfoNmea(VEHICLESENS_DATA_MASTER_GPS_FORMAT *, u_int8 );
+void VehicleSens_InitLocationInfoNmea_n(void);
+u_int8 VehicleSens_SetLocationInfoNmea_n( const POS_LOCATIONINFO_NMEA * );
+void VehicleSens_GetLocationInfoNmea_n(VEHICLESENS_DATA_MASTER_GPS_FORMAT * );
+
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DATAMASTER_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/VehicleSens_DeliveryCtrl.h b/vehicleservice/positioning/server/include/Sensor/VehicleSens_DeliveryCtrl.h
new file mode 100755
index 0000000..3fb7056
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/VehicleSens_DeliveryCtrl.h
@@ -0,0 +1,253 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DELIVERYCTRL_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DELIVERYCTRL_H_
+/******************************************************************************
+ * File name :VehicleSens_DeliveryCtrl.h
+ * System name :_CWORD107_
+ * Subsystem name :
+ ******************************************************************************/
+
+#include "Vehicle_API_Dummy.h"
+#include "Sensor_API.h"
+#include "Vehicle_API_private.h"
+#include "Sensor_API_private.h"
+#include "VehicleSens_SelectionItemList.h"
+#include "VehicleSens_DataMaster.h"
+#include "Dead_Reckoning_Local_Api.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define VEHICLESENS_CANID_EFFECTIVE 29 /* CAN ID Effective number */
+#define VEHICLESENS_CANID_RESERVE 11 /* CAN ID Reserved number */
+#define VEHICLESENS_SIGNAL VEHICLESENS_SELECTION_ITEM_LIST_LEN /* Number of vehicle signals */
+#define VEHICLESENS_DELIVERY 10 /* Number of delivery destinations */
+/* CAN ID Maximum number */
+#define VEHICLESENS_CANID_MAX (VEHICLESENS_CANID_EFFECTIVE + VEHICLESENS_CANID_RESERVE)
+/* Vehicle sensor information */
+#define VEHICLESENS_DELIVERY_INFO (VEHICLESENS_CANID_MAX + VEHICLESENS_SIGNAL)
+/* Maximum number of vehicle sensor information */
+#define VEHICLESENS_DELIVERY_INFO_MAX (VEHICLESENS_DELIVERY_INFO * VEHICLESENS_DELIVERY)
+/* Vehicle Sensor Information Valid Number */
+#define VEHICLESENS_DID_EFFECTIVE (VEHICLESENS_CANID_EFFECTIVE + VEHICLESENS_SIGNAL)
+#define VEHICLESENS_ACTION_TYPE_ADD 0 /* Vehicle sensor addition processing */
+#define VEHICLESENS_ACTION_TYPE_UPDATE 1 /* Vehicle sensor update processing */
+#define VEHICLESENS_LINK_INDEX_END 0xFFFF /* End of the link index */
+
+
+#define VEHICLESENS_PKG_DELIVERY_INFO_MAX 2560 /* Maximum number of vehicle sensor information */
+#define VEHICLESENS_DELIVERY_METHOD_NORMAL 0 /* Delivery system normal delivery */
+#define VEHICLESENS_DELIVERY_METHOD_PACKAGE 1 /* Delivery system package delivery */
+#define VEHICLESENS_PKG_EXT_SEND_MAX 10 /* Number of data master transmissions/onece */
+#define VEHICLESENS_PKG_EXT_SEND_MAX_10DATA 100 /* Number of data masters transmitted (GYRO),SPEED)/once */
+
+#define VEHICLESENS_DELIVERY_MAX_SIZE SENSOR_MSG_VSINFO_DSIZE /* Maximum Size of Delivery */
+#define VEHICLESENS_DELIVERY_FSTSNS_HDR_SIZE 8 /* Initial Sensor Data Delivery Data Header Size */
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_LIST_CANID
+* ABSTRACT : CAN data delivery registration request information
+***********************************************************************/
+typedef struct {
+ u_int8 uc_can_num; /* CANID delivery registrations */
+ u_int8 uc_reserve[3];
+ u_int32 ul_can_id[VEHICLESENS_CANID_MAX]; /* Delivery registrationCANID */ /* CANIF_API deletion */
+} VEHICLESENS_DELIVERY_LIST_CANID;
+
+/*********************************************************************
+* TAG :VEHICLESENS_DELIVERY_CTRL_TBL_DATA
+* ABSTRACT : Structure of each data of the vehicle sensor delivery destination management table
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ PNO us_pno; /* Shipping PID */
+ u_int8 uc_chg_type; /* Delivery timing */
+ u_int8 uc_ctrl_flg; /* Delivery operation */
+ u_int16 us_link_idx; /* Link index */
+ u_int16 us_pkg_start_idx; /* Package Delivery Start Index */
+ u_int16 us_pkg_end_idx; /* Package delivery end index */
+ u_int8 uc_method; /* Delivery system */
+ u_int8 uc_reserve; /* reserve */
+ /* Modify to store the destination service name TODO */
+ /* Add handles as needed TODO */
+} VEHICLESENS_DELIVERY_CTRL_TBL_DATA;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_CTRL_TBL
+* ABSTRACT : Vehicle Sensor Delivery Destination Management Table Structure
+***********************************************************************/
+typedef struct {
+ u_int16 us_dnum; /* Number of delivery destination management data items */
+ u_int8 uc_reserve[2]; /* Reserved */
+ /* Array of each data */
+ VEHICLESENS_DELIVERY_CTRL_TBL_DATA st_ctrl_data[VEHICLESENS_DELIVERY_INFO_MAX];
+} VEHICLESENS_DELIVERY_CTRL_TBL;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA
+* ABSTRACT : Structure of each data of Vehicle Sensor Destination Management Table Management
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_start_idx; /* Start index */
+ u_int16 us_end_idx; /* End index */
+ u_int16 usdlvry_entry_num; /* Number of registered shipping addresses */
+ u_int8 uc_reserve[2]; /* Reserved */
+} VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_CTRL_TBL_MNG
+* ABSTRACT : Structure of Vehicle Sensor Delivery Destination Management Table Management
+***********************************************************************/
+typedef struct {
+ u_int16 us_dnum; /* Number of data items */
+ u_int8 uc_reserve[2]; /* Reserved */
+ /* Array of each data */
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA st_ctrl_tbl_mng_data[VEHICLESENS_DELIVERY_INFO];
+} VEHICLESENS_DELIVERY_CTRL_TBL_MNG;
+
+/*********************************************************************
+* TAG : VEHICLESENS_PKG_DELIVERY_TBL_MNG_DATA
+* ABSTRACT : Structure of each data of the vehicle sensor package delivery management table
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 usdlvry_idx; /* Delivery data index */
+ u_int8 uc_reserve[2]; /* Reserved */
+} VEHICLESENS_PKG_DELIVERY_TBL_MNG_DATA;
+
+
+/*********************************************************************
+* TAG : VEHICLESENS_PKG_DELIVERY_TBL_MNG
+* ABSTRACT : Structure of Vehicle Sensor Package Delivery Management Table
+***********************************************************************/
+typedef struct {
+ u_int16 us_dnum; /* Number of data items */
+ u_int8 uc_reserve[2]; /* Reserved */
+ /* Array of each data */
+ VEHICLESENS_PKG_DELIVERY_TBL_MNG_DATA st_pkg_data[VEHICLESENS_PKG_DELIVERY_INFO_MAX];
+} VEHICLESENS_PKG_DELIVERY_TBL_MNG;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_PNO_TBL
+* ABSTRACT : Vehicle Sensor Destination PNO Table
+***********************************************************************/
+typedef struct {
+ PNO us_pno; /* Thread ID */
+ u_int16 us_pkg_start_idx; /* Package Delivery Start Index */
+ u_int16 us_pkg_end_idx; /* Package delivery end index */
+ u_int8 uc_method; /* Delivery system */
+ u_int8 uc_reserve; /* reserve */
+} VEHICLESENS_DELIVERY_PNO_TBL_DAT;
+
+typedef struct {
+ u_int16 us_dnum; /* Number of data items */
+ u_int8 uc_reserve[2]; /* reserve */
+ VEHICLESENS_DELIVERY_PNO_TBL_DAT st_pno_data[VEHICLESENS_DELIVERY_INFO_MAX];
+} VEHICLESENS_DELIVERY_PNO_TBL;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_HEADER
+* ABSTRACT : Delivery data header
+***********************************************************************/
+typedef struct {
+ DID did; /* Data ID */
+ u_int16 size; /* Size of the data */
+ u_int8 rcv_flag; /* Receive flag */
+ u_int8 sensor_cnt; /* Sensor Counter */
+} VEHICLESENS_DELIVERY_HEADER;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_FORMAT
+* ABSTRACT : Delivery data format
+***********************************************************************/
+typedef struct {
+ VEHICLESENS_DELIVERY_HEADER header; /* Header */
+ u_int8 data[VEHICLESENS_DELIVERY_MAX_SIZE]; /* Data */
+} VEHICLESENS_DELIVERY_FORMAT;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void VehicleSensInitDeliveryCtrlTbl(void);
+void VehicleSensInitDeliveryCtrlTblMng(void);
+void VehicleSensInitPkgDeliveryTblMng(void);
+VEHICLE_RET_API VehicleSensEntryDeliveryCtrl(const VEHICLE_MSG_DELIVERY_ENTRY *);
+void VehicleSensAddDeliveryCtrlTbl(const VEHICLE_MSG_DELIVERY_ENTRY *);
+void VehicleSensUpdateDeliveryCtrlTbl(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *);
+void VehicleSensUpdatePkgDeliveryCtrlTbl(u_int16, u_int16);
+void VehicleSensAddDeliveryCtrlTblMng(const VEHICLE_MSG_DELIVERY_ENTRY *);
+void VehicleSensUpdateDeliveryCtrlTblMng(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *);
+void VehicleSensAddPkgDeliveryTblMng(const SENSOR_MSG_DELIVERY_ENTRY *);
+VEHICLE_RET_API VehicleSensEntryPkgDeliveryCtrl(const SENSOR_MSG_DELIVERY_ENTRY *, u_int8 uc_ext_chk);
+VEHICLESENS_DELIVERY_PNO_TBL* VehicleSensMakeDeliveryPnoTbl(DID ul_did, u_int8 change_type);
+void VehicleSensAddPnoTbl(u_int16);
+u_int8 VehicleSensDeliveryGPS(DID ul_did, u_int8 uc_get_method, u_int8 uc_current_get_method, int32 pno_index,
+ u_int32* cid, VEHICLESENS_DATA_MASTER* stmaster,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl);
+u_int8 VehicleSensDeliveryFst(DID ul_did, u_int8 uc_get_method, int32 pno_index,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl);
+u_int8 VehicleSensDeliveryGyro(DID ul_did, u_int8 uc_current_get_method, int32 pno_index,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl);
+void VehicleSensDeliveryAntenna(DID ul_did, u_int8 uc_current_get_method, int32 pno_index,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl);
+u_int8 VehicleSensDeliveryOther(DID ul_did, u_int8 uc_current_get_method, int32 pno_index,
+ u_int32* cid,
+ VEHICLESENS_DATA_MASTER* stmaster,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl);
+void VehicleSensDeliveryProc(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method);
+u_int8 VehicleSensFirstDeliverySens(PNO us_pno, DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_FST* stmaster_fst,
+ VEHICLESENS_DATA_MASTER_FST* stmaster_fst_temp);
+u_int8 VehicleSensFirstDeliveryOther(PNO us_pno, DID ul_did, u_int8 uc_get_method,
+ u_int32* cid,
+ VEHICLESENS_DATA_MASTER* stmaster);
+void VehicleSensFirstDelivery(PNO us_pno, DID ul_did);
+void VehicleSensFirstPkgDelivery(const SENSOR_MSG_DELIVERY_ENTRY_DAT *);
+RET_API VehicleSensCanDeliveryEntry(void);
+void VehicleSensFirstPkgDelivery(const SENSOR_MSG_DELIVERY_ENTRY_DAT *);
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+void VehicleSensFirstPkgDeliveryExt(const SENSOR_MSG_DELIVERY_ENTRY_DAT *pst_data);
+#endif
+
+#if CONFIG_HW_PORTSET_TYPE_C
+void VehicleSensInitSeqNum(void);
+void VehicleSensDivideDeliveryProc(PNO, const void *);
+#endif
+
+/* ++ PastModel002 support DR */
+void VehicleSensInitDeliveryCtrlTblDR(void);
+void VehicleSensInitDeliveryCtrlTblMngDR(void);
+VEHICLE_RET_API VehicleSensEntryDeliveryCtrlDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+void VehicleSensAddDeliveryCtrlTblDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+void VehicleSensAddDeliveryCtrlTblMngDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+void VehicleSensUpdateDeliveryCtrlTblDR(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *);
+void VehicleSensUpdateDeliveryCtrlTblMngDR(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *);
+void VehicleSensDeliveryProcDR(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method);
+VEHICLESENS_DELIVERY_PNO_TBL* VehicleSensMakeDeliveryPnoTblDR(DID ul_did, u_int8 change_type);
+void VehicleSensAddPnoTblDR(u_int16 us_index);
+void VehicleSensGetDebugDeliveryCtrlTbl(void* pbuf);
+void VehicleSensGetDebugDeliveryCtrlTblMng(void* pbuf);
+void VehicleSensGetDebugPkgDeliveryTblMng(void* pbuf);
+void VehicleSensGetDebugDeliveryPnoTbl(void* pbuf);
+/* -- PastModel002 supprt DR */
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DELIVERYCTRL_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/VehicleSens_FromAccess.h b/vehicleservice/positioning/server/include/Sensor/VehicleSens_FromAccess.h
new file mode 100755
index 0000000..e58b059
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/VehicleSens_FromAccess.h
@@ -0,0 +1,69 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_FROMACCESS_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_FROMACCESS_H_
+/******************************************************************************
+ * File name :VehicleSens_FromAccess.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+#include <stdio.h>
+#include <stdint.h>
+#include "Sensor_API.h"
+#include "SensorLocation_API.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define NV_FILE_VEHICLESENS "/fs/tmpfs/VehicleSens_nv_data.bin"
+#define NV_FILE_VEHICLESENS_TEMP "/fs/tmpfs/VehicleSens_nv_data_temp.bin"
+#define NV_FILE_VEHICLESENS2 "/fs/tmpfs/VehicleSens_nv_data_2nd.bin"
+#define NV_FILE_VEHICLESENS2_TEMP "/fs/tmpfs/VehicleSens_nv_data_2nd_temp.bin"
+#define NV_LOAD_WAIT_TIME_VEHICLESENS 100U
+#define NV_UPDATE_CYCLE_LONLAT 100U
+#define NV_UPDATE_CYCLE_LOCALTIME 10U
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+typedef struct {
+ LOCALTIME localtime;
+ LONLAT lonlat;
+ int32 timediff;
+ u_int32 update_counter;
+ u_int8 reserve[2];
+ u_int8 cka;
+ u_int8 ckb;
+} NV_DATA_VEHICLESENS;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void VehicleSensFromAccessInitialize(void);
+RET_API VehicleSensRegistNvTag(void);
+RET_API VehicleSensReadNVLocalTime(LOCALTIME * local_time);
+RET_API VehicleSensReadNVLonLat(LONLAT * lonlat);
+RET_API VehicleSensReadNVTimeDiff(int32 * time_diff);
+void VehicleSensStoreLonlat(LONLAT * plonlat);
+RET_API VehicleSensWriteNVLocaltime(LOCALTIME * local_time, int32 * time_diff);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_FROMACCESS_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/VehicleSens_SelectionItemList.h b/vehicleservice/positioning/server/include/Sensor/VehicleSens_SelectionItemList.h
new file mode 100755
index 0000000..15004e8
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/VehicleSens_SelectionItemList.h
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SELECTIONITEMLIST_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SELECTIONITEMLIST_H_
+/****************************************************************************
+ * File name :VehicleSens_SelectionItemList.h
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ ****************************************************************************/
+
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+#include "VehicleSens_Common.h"
+#include "VehicleIf.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/* ++ Addition of DID9 related to PastModel002 supported_UBX commands */
+/* ++ GPS _CWORD82_ support (To add the target DID 3) */
+#define VEHICLESENS_SELECTION_ITEM_LIST_LEN (87) /* Number of data in Vehicle Sensor Selection Item List */
+/* -- GPS _CWORD82_ support */
+#else
+#define VEHICLESENS_SELECTION_ITEM_LIST_LEN (63) /* Number of data in Vehicle Sensor Selection Item List */
+/* -- PastModel002 support */
+#endif
+/* Sum of bits 29 through 31*/
+#define VEHICLESENS_BIT31_29 (VEHICLESENS_BIT31 | VEHICLESENS_BIT30 | VEHICLESENS_BIT29)
+
+#define VEHICLESENS_ITEMLIST_APPLICATION 0x00 /* Application of electronic PF */
+#define VEHICLESENS_ITEMLIST_NON_APPLICATION 0x01 /* Electronic PF not applicable */
+#define VEHICLESENS_ITEMLIST_INVALID 0x02 /* Disabled */
+
+#define VEHICLE_COMM_WATCHTBL_DAT_NUM 64 /* Number of data held for communication discontinuation registration */
+#define VEHICLE_COMM_WATCHTBL_DID_NUM 2 /* Number of Disruption Monitoring Data Management */
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/*********************************************************************
+* TAG : VEHICLESENS_SELECTION_ITEM_LIST
+* ABSTRACT : Managing a list of vehicle information choices
+***********************************************************************/
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int32 ul_canid; /* CAN ID */ /* CANIF_API deletion */
+ u_int8 uc_get_method; /* Data acquisition source category */
+ u_int8 reserve[3]; /* reserve */
+} VEHICLESENS_SELECTION_ITEM_LIST;
+
+/************************************************************************
+* TAG : VEHICLE_COMM_WATCH_TBL
+* ABSTRACT : Managing Vehicle Sensor Disruption Monitoring Data
+************************************************************************/
+typedef struct {
+ PNO us_pno; /* Destination PNO */
+ u_int16 us_watch_time; /* Interruption monitoring time(Units of 100 ms) */
+} VEHICLE_COMM_WATCH_DAT;
+
+typedef struct {
+ DID ul_did; /* Data ID corresponding to vehicle sensor information */
+ u_int8 uc_effective_flg; /* CANID Valid Flag */
+ u_int8 uc_vehicle_comm_watch_cnt; /* Vehicle Sensor Information Disruption Monitoring Request Count */
+ VEHICLE_COMM_WATCH_DAT st_comm_watch_dat[VEHICLE_COMM_WATCHTBL_DAT_NUM]; /* Communication disruption registration data */
+} VEHICLE_COMM_WATCH_TBL;
+
+/* ++ PastModel002 support */
+/************************************************************************
+* TAG : VEHICLE_MSG_WATCH_STOPPAGE
+* ABSTRACT : Vehicle Sensor Disruption Monitoring Message(-> Vehicle sensor)
+************************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID corresponding to vehicle sensor information */
+ PNO us_pno; /* Destination PNO */
+ u_int16 us_watch_time; /* Interruption monitoring time(Units of 100 ms) */
+ u_int16 us_offset; /* Offset to shared memory storage area */
+ u_int16 us_size; /* Size of shared memory storage area */
+ EventID ul_eventid; /* Event ID */
+} VEHICLE_MSG_WATCH_STOPPAGE_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER st_hdr; /* Message header */
+ VEHICLE_MSG_WATCH_STOPPAGE_DAT st_data; /* Message data */
+} VEHICLE_MSG_WATCH_STOPPAGE;
+
+/* -- PastModel002 support */
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void VehicleSensInitSelectionItemList(void);
+u_int8 VehicleSensGetSelectionItemList(DID);
+u_int32 VehicleSensGetSelectionItemListCanId(DID);
+BOOL VehicleSensSetSelectionItemListCanId(DID did, u_int32); /* CANIF_API deletion */
+void VehicleSensCommWatchTblInit(void);
+BOOL VehicleSensCommWatchTblSave(const VEHICLE_MSG_WATCH_STOPPAGE*);
+BOOL VehicleSensCommWatchTblRun(DID);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SELECTIONITEMLIST_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/VehicleSens_SharedMemory.h b/vehicleservice/positioning/server/include/Sensor/VehicleSens_SharedMemory.h
new file mode 100755
index 0000000..54878ec
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/VehicleSens_SharedMemory.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SHAREDMEMORY_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SHAREDMEMORY_H_
+/******************************************************************************
+ * File name :VehicleSens_SharedMemory.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+#include "Vehicle_API.h"
+#include "Sensor_Common_API.h"
+#include "VehicleSens_FromAccess.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+RET_API VehicleSensInitSharedMemory(void);
+void VehicleSensWriteSharedMemory(DID ul_did);
+RET_API VehicleSensWriteDataValidEphemerisNum(u_int8 valid_ephemer_isnum);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SHAREDMEMORY_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/VehicleSens_Thread.h b/vehicleservice/positioning/server/include/Sensor/VehicleSens_Thread.h
new file mode 100755
index 0000000..17a342d
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/VehicleSens_Thread.h
@@ -0,0 +1,185 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_THREAD_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_THREAD_H_
+/******************************************************************************
+ * File name :VehicleSens_Thread.h
+ * System name :_CWORD107_
+ * Subsystem name :
+ ******************************************************************************/
+
+#include "Vehicle_API_Dummy.h"
+#include "Sensor_API.h"
+#include "Vehicle_API_private.h"
+#include "Sensor_API_private.h"
+#include "VehicleSens_Common.h"
+#include "VehicleSens_SelectionItemList.h"
+#include "VehicleSens_DataMaster.h"
+#include "VehicleSens_DeliveryCtrl.h"
+#include "VehicleSens_SharedMemory.h"
+#include "CanInput_API.h"
+#include "CanInput_API_private.h"
+#include "VehicleDebug_API.h"
+#include "VehicleSens_FromAccess.h"
+#include "ClockDataMng.h"
+#include "gps_hal.h"
+#include "positioning_hal.h"
+#include "CommonDefine.h"
+
+/* ++ DR support */
+#include "DeadReckoning_main.h"
+#include "Dead_Reckoning_Local_Api.h"
+/* -- DR support */
+
+#include "POS_common_private.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+
+/* ++ Porting from PastModel002 enabled APIs */
+#define CID_VEHICLEIF_GET_VEHICLE_DATA 0x0102 /* Vehicle sensor information acquisition CID */
+#define CID_VEHICLEIF_COMM_WATCH 0x0103 /* Vehicle Sensor Information Disruption Monitoring CID */
+#define CID_SENSORIF__CWORD82__REQUEST 0x0800 /* Vehicle sensor information setting CID */
+
+#define VEHICLE_RET_ERROR_OUTOF_MEMORY (-8) /* Shared memory allocation failure */
+#define VEHICLE_RET_ERROR_INVALID (-10) /* CANID undetermined */
+
+/* -- Porting from PastModel002 enabled APIs */
+
+
+/* NMEA */
+#define VEHICLESENS_NMEA_LF "\n"
+#define VEHICLESENS_NMEA_CR "\r"
+#define VEHICLESENS_NMEA_FIELDDELIMITER ","
+#define VEHICLESENS_NMEA_DECIMALPOINT "."
+#define VEHICLESENS_NMEA_ASTARISK "*"
+
+#define VEHICLESENS_NMEA_PASCD_LEN_MAX 256
+
+#define VEHICLESENS_NMEA_PASCD_ID "$PASCD"
+
+#define VEHICLESENS_NMEA_PASCD_TS_MAX 86400
+#define VEHICLESENS_NMEA_PASCD_TS_INT_LEN_MAX 6 /* max length of integer part of timestamp */
+#define VEHICLESENS_NMEA_PASCD_TS_FRA_LEN_MAX 3 /* max length of fractional part of timestamp */
+
+#define VEHICLESENS_NMEA_PASCD_SENSORTYPE_C "C" /* Combined left and right wheel speed sensors */
+
+#define VEHICLESENS_NMEA_PASCD_TMS_U "U" /* Unkonwn */
+#define VEHICLESENS_NMEA_PASCD_TMS_P "P" /* Park */
+#define VEHICLESENS_NMEA_PASCD_TMS_R "R" /* Reverse */
+#define VEHICLESENS_NMEA_PASCD_TMS_D "D" /* Driving forword */
+#define VEHICLESENS_NMEA_PASCD_TMS_N "N" /* Neutral */
+
+#define VEHICLESNES_NMEA_PASCD_SLIP "1" /* 1 = a wheel speed slippage was detected */
+#define VEHICLESNES_NMEA_PASCD_NOSLIP "0" /* 0 = no slip was detected */
+
+#define VEHICLESENS_NMEA_PASCD_TO_FRA_LEN_MAX 2 /* max length of fractional part of timeoffset */
+
+#define VEHICLESENS_NMEA_PASCD_SPD_FRA_LEN_MAX 3 /* max length of fractional part of speed */
+
+#define VEHICLESENS_NMEA_PASCD_SAMPLECOUNT_MAX 50
+
+/************************************************************************
+ * Struct definitions *
+ ************************************************************************/
+
+/*!
+ @brief Structure of Vehicle Speed and TimeSpec
+ */
+typedef struct {
+ timespec ts;
+ uint16_t speed; /* [0.01m/s] */
+} VEHICLESENS_VEHICLE_SPEED_DAT;
+
+/*!
+ @brief Structure of Vehilce Speeds and TimeSpecs
+ */
+typedef struct {
+ VEHICLESENS_VEHICLE_SPEED_DAT listSpd[VEHICLESENS_NMEA_PASCD_SAMPLECOUNT_MAX];
+ uint8_t sampleCount;
+} VEHICLESENS_VEHICLE_SPEED_INFO;
+
+/*!
+ @brief Structure for LUT to Derive Transmission State
+ */
+typedef struct {
+ uint8_t type; /* Transmission Type */
+ uint8_t shift; /* Shift Position from Vehicle */
+
+ uint8_t pkb; /* Parking Brake from Vehicle */
+ char state[8]; /* Transmission State for _CWORD27_ */
+} VEHICLESENS_TRANSMISSION_PKG;
+
+/************************************************************************
+ * TAG : VEHICLE_MSG_SEND_DAT
+ * ABSTRACT : Vehicle sensor information setting message(-> Vehicle sensor)
+ ************************************************************************/
+
+
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+EFrameworkunifiedStatus VehicleSensThread(HANDLE h_app);
+RET_API VehicleSensThreadInit(void);
+void VehicleSensDeliveryEntry(const VEHICLE_MSG_DELIVERY_ENTRY *);
+void VehicleSensGetVehicleData(const VEHICLE_MSG_GET_VEHICLE_DATA *);
+void VehicleSensWatchStopPage(const VEHICLE_MSG_WATCH_STOPPAGE *);
+void VehicleSensPkgDeliveryEntry(const SENSOR_MSG_DELIVERY_ENTRY *);
+void VehicleSensGetVehiclePkgData(const SENSOR_MSG_GET_SENSOR_DATA *);
+void VehicleSensLineSensDataDelivery(const LSDRV_MSG_LSDATA *, PFUNC_DMASTER_SET_N);
+void VehicleSensLineSensDataDeliveryG(const LSDRV_MSG_LSDATA_G *, PFUNC_DMASTER_SET_N);
+void VehicleSensLineSensDataDeliveryGyroTrouble(const LSDRV_MSG_LSDATA_GYRO_TROUBLE *msg,
+ PFUNC_DMASTER_SET_N p_datamaster_set_n);
+void VehicleSensLineSensDataDeliverySysGpsInterruptSignal(const LSDRV_MSG_LSDATA_GPS_INTERRUPT_SIGNAL *msg,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory);
+void VehicleSensLineSensDataDeliveryGyroConnectStatus(const LSDRV_MSG_LSDATA_GYRO_CONNECT_STATUS *msg,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory);
+void VehicleSensLineSensDataDeliveryGpsAntennaStatus(const LSDRV_MSG_LSDATA_GPS_ANTENNA_STATUS *msg,
+ PFUNC_DMASTER_SET_N p_datamaster_set_n);
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+void VehicleSensPkgDeliveryEntryExt(const SENSOR_MSG_DELIVERY_ENTRY *msg);
+void VehicleSensLineSensDataDeliveryFst(const LSDRV_MSG_LSDATA_FST *, PFUNC_DMASTER_SET_N);
+void VehicleSensLineSensDataDeliveryFstG(const LSDRV_MSG_LSDATA_FST *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n);
+#else
+void VehicleSensPkgDeliveryEntryError(const SENSOR_MSG_DELIVERY_ENTRY *msg);
+#endif
+void VehicleSensGpsDataDelivery(SENSOR_MSG_GPSDATA *msg,
+ PFUNC_DMASTER_SET_N p_datamaster_set_n,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory);
+
+void VehicleSensDataMasterSetN(DID did, u_int8 chg_type, u_int8 get_method);
+void VehicleSensDataMasterSetSharedMemory(DID did, u_int8 chg_type);
+/* ++ GPS _CWORD82_ support */
+void VehicleSensSetVehicleData(const VEHICLE_MSG_SEND *);
+/* -- GPS _CWORD82_ support */
+
+void VehicleSensDrDeliveryEntry(const VEHICLE_MSG_DELIVERY_ENTRY *);
+void VehicleSensGetLog(const VEHICLEDEBUG_MSG_BUF* msg);
+void VehicleSensSetLog(const VEHICLEDEBUG_MSG_BUF* msg);
+void VehicleSensWriteLocalTime(const CANINPUT_MSG_INFO *msg);
+void VehicleSensSetEphNumSharedMemory(const SENSOR_MSG_GPSDATA *msg);
+void VehicleSensDrRcvMsg(const DEAD_RECKONING_RCVDATA *msg);
+
+void VehicleSensCommonDataDelivery(const VEHICLE_MSG_BUF *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n);
+void VehicleSensGpsTimeSndMsg(const POS_MSGINFO *pos_msg);
+void VehicleSensGpsTimeDelivery(const VEHICLE_MSG_BUF *msg);
+RET_API VehicleSensSendEvent(uint16_t snd_pno, int32_t event_val);
+void VehicleSensThreadStopProcess(void);
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_THREAD_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/VehicleSensor_Thread.h b/vehicleservice/positioning/server/include/Sensor/VehicleSensor_Thread.h
new file mode 100755
index 0000000..f40f2a7
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/VehicleSensor_Thread.h
@@ -0,0 +1,33 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+ * File name :vehiclesensor_thread.h
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Title :Prototype Declaration of Thread Entry Function of Vehicle Sensor Process
+ ****************************************************************************/
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENSOR_THREAD_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENSOR_THREAD_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+/***********************************************************************
+* Thread entry function prototype *
+************************************************************************/
+EFrameworkunifiedStatus VehicleSensThread(HANDLE h_app);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENSOR_THREAD_H_
diff --git a/vehicleservice/positioning/server/include/Sensor/VehicleUtility.h b/vehicleservice/positioning/server/include/Sensor/VehicleUtility.h
new file mode 100755
index 0000000..e7ebef0
--- /dev/null
+++ b/vehicleservice/positioning/server/include/Sensor/VehicleUtility.h
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleUtility.h
+@detail Common processing function header file of Vehicle<BR>
+ Vehicle Common Functions Header Files
+*****************************************************************************/
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLEUTILITY_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLEUTILITY_H_
+
+#include <stdint.h>
+#include <vehicle_service/positioning_base_library.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*------------------------------------------------------------------------------*
+ * Definition *
+ *------------------------------------------------------------------------------*/
+/* GPS-related timer value */
+#define TIMVAL_GPS_STARTUP 500 /* 5Sec Start confirmation monitoring timer */
+#define TIMVAL_GPS_RCVCYCLDAT 500 /* 5Sec Periodic reception data monitoring timer */
+#define TIMVAL_GPS_RCVACK 500 /* 5Sec ACK reception monitoring timer */
+#define TIMVAL_GPS_RCVDAT 500 /* 5Sec Data reception monitoring timer(Not used) */
+#define TIMVAL_GPS_NAVIFST 3000 /* 30sec Initial Navigation Monitoring Timer */
+#define TIMVAL_GPS_NAVICYCLE 300 /* 3sec Navi monitoring timer */
+#define TIMVAL_GPS_NAVIDISRPT 1000 /* 10Sec Navigation Monitoring Disruption Log Output Timer */
+#define TIMVAL_GPS_DIAGCLKGUARD 1000 /* 10sec Diag provision time guard monitoring timer */
+#define TIMVAL_GPS_NMEADATAGUARD 1000 /* 10sec NMEA data-providing guard monitoring timer */
+#define TIMVAL_GPS_RECOVERY 60000 /* 600sec GPS recovery timer */
+#define TIMVAL_GPS_RECEIVERERR 60000 /* 600sec GPS receiver anomaly detection timer */
+
+/* Sensor-related timer value */
+#define TIMVAL_SNS_RCVFSTDAT 3000 /* 30Sec Initial sensor data reception monitoring timer */
+#define TIMVAL_SNS_RCVCYCLDAT 300 /* 3Sec Cyclic sensor data reception monitoring timer */
+#define TIMVAL_SNS_RCVDISRPT 1000 /* 10Sec Cyclic sensor data interruption log output timer */
+
+/* Timer management table */
+#define TIM_NON 0x00 /* Timer counter initial value */
+#define TIM_CNTMIN 0x01 /* Timer counter minimum value */
+#define TIM_CNTMAX 0xff /* Maximum value of timer counter */
+#define TIMER_OFF 0 /* Timer enable flag OFF */
+#define TIMER_ON 1 /* Timer enable flag ON */
+
+/*------------------------------------------------------------------------------*
+ * Structure *
+ *------------------------------------------------------------------------------*/
+/*!
+ @brief Timer type
+ */
+typedef enum _VEHICLEUTILITY_TIM_KIND {
+ GPS_STARTUP_TIMER = 0, /* 0 Start confirmation monitoring timer */
+ GPS_CYCL_TIMER, /* 1 Cyclic GPS data reception monitoring timer */
+ GPS_RECV_ACK_TIMER, /* 2 ACK reception monitoring timer */
+ GPS_NAVIFST_TIMER, /* 3 Initial Navigation Monitoring Timer */
+ GPS_NAVICYCLE_TIMER, /* 4 Navi monitoring timer */
+ GPS_NAVIDISRPT_TIMER, /* 5 Navigation Monitoring Disruption Log Output Timer */
+ GPS_DIAGCLK_GUARDTIMER, /* 6 Diag provision time guard monitoring timer */
+ GPS_NMEADATA_GUARDTIMER, /* 7 NMEA data-providing guard monitoring timer */
+ GPS_RECOVERY_TIMER, /* 8 GPS recovery timer */
+ GPS_RECEIVERERR_TIMER, /* 9 GPS receiver anomaly detection timer */
+ SNS_FST_TIMER, /* 10 Initial sensor data reception monitoring timer */
+ SNS_CYCLE_TIMER, /* 11 Cyclic sensor data reception monitoring timer */
+ SNS_DISRPT_TIMER, /* 12 Cyclic sensor data interruption log output timer */
+ TIM_NUM /* 13 Number of timer types */
+} VEHICLEUTILITY_TIM_KIND;
+
+/*!
+ @brief Master status
+*/
+typedef struct {
+ u_int8 flag; /**< Timer flag OFF:Stop,ON:Start */
+ u_int8 cnt; /**< Start counter */
+ int8 rsv[2]; /**< Reserved */
+} VEHICLEUTILITY_TIM_STS;
+
+/*!
+ @brief Master status management table
+ */
+typedef struct {
+ VEHICLEUTILITY_TIM_STS sts[TIM_NUM]; /**< Master status */
+} VEHICLEUTILITY_TIM_MNG;
+
+/*!
+ @brief Timer setting information table
+*/
+typedef struct {
+ uint32_t timer_val; /**< Timer value */
+ PNO pno; /**< Event notification destination process number */
+} VEHICLEUTILITY_TIM_INFO;
+
+/*
+ Function prototype declaration
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API VehicleUtilitySndMsg(PNO pno, u_int16 size, void *msgbuf, u_int16 mode);
+RET_API VehicleUtilityRcvMsg(PNO pno, u_int16 size, void **msgbuf, u_int16 mode);
+void VehicleUtilityDiagCodePut(u_int32 err_id, u_int16 positioning_code);
+void VehicleUtilityInitTimer(void);
+BOOL VehicleUtilitySetTimer(VEHICLEUTILITY_TIM_KIND tim_kind);
+BOOL VehicleUtilityStopTimer(VEHICLEUTILITY_TIM_KIND tim_kind);
+BOOL VehicleUtilityTimeJdgKnd(uint16_t seqno);
+
+void LineSensDrvExtTermStsReq(void);
+RET_API DEVGpsSndBackupDataLoadReq(void);
+void DEVGpsGetDebugGpsFormatFailCnt(void* p_buf);
+u_int8 LineSensDrvGetSysRecvFlag(void);
+uint16_t DEVGpsGetWknRollover(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLEUTILITY_H_ */
diff --git a/vehicleservice/positioning/server/include/ServiceInterface/BackupMgrIf.h b/vehicleservice/positioning/server/include/ServiceInterface/BackupMgrIf.h
new file mode 100755
index 0000000..3e2e5e5
--- /dev/null
+++ b/vehicleservice/positioning/server/include/ServiceInterface/BackupMgrIf.h
@@ -0,0 +1,65 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * BackupMgrIf.h
+ * @brief
+ * BackupMgr service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_BACKUPMGRIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_BACKUPMGRIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_backup.h>
+#include <native_service/ns_backup_id.h>
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+EFrameworkunifiedStatus BackupMgrIfNotifyOnBackupMgrAvailability(CbFuncPtr fp_on_cmd);
+void BackupMgrIfSetAvailability(BOOL b_is_available);
+BOOL BackupMgrIf_GetAvailability(void);
+EFrameworkunifiedStatus BackupMgrIfBackupDataRd(PCSTR tag_id, uint32_t ui_offset, \
+ void *pv_buf, uint32_t ui_size, BOOL* pb_is_available);
+EFrameworkunifiedStatus BackupMgrIfBackupDataWt(PCSTR tag_id, void *pv_buf, \
+ uint32_t ui_offset, uint32_t ui_size, BOOL* pb_is_available);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_BACKUPMGRIF_H_
diff --git a/vehicleservice/positioning/server/include/ServiceInterface/ClockIf.h b/vehicleservice/positioning/server/include/ServiceInterface/ClockIf.h
new file mode 100755
index 0000000..5a2e976
--- /dev/null
+++ b/vehicleservice/positioning/server/include/ServiceInterface/ClockIf.h
@@ -0,0 +1,61 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * ClockIf.h
+ * @brief
+ * Clock service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_CLOCKIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_CLOCKIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <stub/DTime_Api.h>
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_gps_API.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+EFrameworkunifiedStatus ClockIfNotifyOnClockAvailability(CbFuncPtr fp_on_cmd);
+void ClockIfSetAvailability(BOOL b_is_available);
+EFrameworkunifiedStatus ClockIfDtimeSetGpsTime(const SENSOR_MSG_GPSTIME *pst_gps_time, BOOL* pb_is_available);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_CLOCKIF_H_
diff --git a/vehicleservice/positioning/server/include/ServiceInterface/CommUsbIf.h b/vehicleservice/positioning/server/include/ServiceInterface/CommUsbIf.h
new file mode 100755
index 0000000..cbc947c
--- /dev/null
+++ b/vehicleservice/positioning/server/include/ServiceInterface/CommUsbIf.h
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * CommUsbIf.h
+ * @brief
+ * CommUSB service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_COMMUSBIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_COMMUSBIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <stub/commusb_api.h>
+#include <stub/commusb_notifications.h>
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+EFrameworkunifiedStatus CommUsbIfAttachCallbacksToDispatcher( // NOLINT(readability/nolint)
+ _FrameworkunifiedProtocolCallbackHandler const* p_msg_handler,
+ unsigned int ui_handler_count);
+EFrameworkunifiedStatus CommUsbIfDetachCallbacksFromDispatcher(const PUI_32 pui_cmd_array, UI_32 ui_command_count);
+EFrameworkunifiedStatus CommUsbIfNotifyOnCommUSBAvailability(CbFuncPtr fp_on_cmd);
+void CommUsbIfSetAvailability(BOOL b_is_available);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_COMMUSBIF_H_
diff --git a/vehicleservice/positioning/server/include/ServiceInterface/DevDetectSrvIf.h b/vehicleservice/positioning/server/include/ServiceInterface/DevDetectSrvIf.h
new file mode 100755
index 0000000..8829123
--- /dev/null
+++ b/vehicleservice/positioning/server/include/ServiceInterface/DevDetectSrvIf.h
@@ -0,0 +1,69 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * DevDetectSrvIf.h
+ * @brief
+ * DevDetectSrv service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DEVDETECTSRVIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DEVDETECTSRVIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <system_service/ss_devicedetection_service_protocol.h>
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+void DevDetectSrvIfSetAvailability(BOOL b_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfInitialize(void);
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnDeviceDetectionAvailability(CbFuncPtr fp_call_back_fn);
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnOpenSessionAck(CbFuncPtr fp_call_back_fn, BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnCloseSessionAck(CbFuncPtr fp_call_back_fn, BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfOpenSessionRequest(BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfDecodeOpenSessionResponse(BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfRegisterForDeviceDetectionEvent(SS_DeviceDetectionServerEvents fe_dev_detect_event, \
+ CbFuncPtr fp_call_back_fn, PCSTR p_file_path, BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfUnRegisterForDeviceDetectionEvent(SS_DeviceDetectionServerEvents fe_dev_detect_event, \
+ BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfCloseSessionRequest(BOOL* pb_is_available);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DEVDETECTSRVIF_H_
diff --git a/vehicleservice/positioning/server/include/ServiceInterface/DiagSrvIf.h b/vehicleservice/positioning/server/include/ServiceInterface/DiagSrvIf.h
new file mode 100755
index 0000000..a6bcd77
--- /dev/null
+++ b/vehicleservice/positioning/server/include/ServiceInterface/DiagSrvIf.h
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * DiagSrvIf.h
+ * @brief
+ * DiagSrv service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DIAGSRVIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DIAGSRVIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <vehicle_service/positioning_base_library.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+void DiagSrvIfSetRegistrationPermission(BOOL b_is_true);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DIAGSRVIF_H_
diff --git a/vehicleservice/positioning/server/include/ServiceInterface/PSMShadowIf.h b/vehicleservice/positioning/server/include/ServiceInterface/PSMShadowIf.h
new file mode 100755
index 0000000..8cdb1f8
--- /dev/null
+++ b/vehicleservice/positioning/server/include/ServiceInterface/PSMShadowIf.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * PSMShadow.h
+ * @brief
+ * PSMShadow service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_PSMSHADOWIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_PSMSHADOWIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "ps_psmshadow_notifications.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+EFrameworkunifiedStatus PSMShadowIfNotifyOnPSMShadowAvailability(CbFuncPtr fp_on_cmd);
+EFrameworkunifiedStatus PSMShadowIfNotifyOnPSMShadowInitComp(CbFuncPtr fp_on_cmd);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_PSMSHADOWIF_H_
diff --git a/vehicleservice/positioning/server/include/ServiceInterface/VehicleIf.h b/vehicleservice/positioning/server/include/ServiceInterface/VehicleIf.h
new file mode 100755
index 0000000..28c05fb
--- /dev/null
+++ b/vehicleservice/positioning/server/include/ServiceInterface/VehicleIf.h
@@ -0,0 +1,82 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_VEHICLEIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_VEHICLEIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <vehicle_service/positioning_base_library.h>
+#include <stub/vehicle_notifications.h>
+#include <stub/Vehicle_Sensor_Common_API.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* Transmission Type */
+#define VEHICLEIF_TRANSMISSION_TYPE_MT 0
+#define VEHICLEIF_TRANSMISSION_TYPE_AT 1
+#define VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN 2
+#define VEHICLEIF_TRANSMISSION_TYPE_NUM 3 /* Number of Transmission Types */
+
+/* Shift Position (CAUTION: These values depend on Vehicle I/F) */
+#define VEHICLEIF_SHIFT_POSITION_U 0
+#define VEHICLEIF_SHIFT_POSITION_R 1
+#define VEHICLEIF_SHIFT_POSITION_P 2
+#define VEHICLEIF_SHIFT_POSITION_N 4
+#define VEHICLEIF_SHIFT_POSITION_D 8
+#define VEHICLEIF_SHIFT_POSITION_NUM 5 /* Number of Shift Position Types */
+
+/* Parking Brake (CAUTION: These values depend on Vehicle I/F) */
+#define VEHICLEIF_PKB_OFF 0
+#define VEHICLEIF_PKB_ON 1
+#define VEHICLEIF_PKB_UNKNOWN 2
+#define VEHICLEIF_PKB_NUM 3
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+void VehicleIf_SetAvailability(BOOL bIsAvailable);
+
+//EFrameworkunifiedStatus VehicleIf_GetTypeOfTransmission(uint8_t* pType, BOOL* pbIsAvailable);
+EFrameworkunifiedStatus VehicleIf_GetTypeOfTransmission(uint8_t* pType, uint8_t* pPkb, BOOL* pbIsAvailable);
+EFrameworkunifiedStatus VehicleIf_GetShiftPosition(uint8_t* pShift, BOOL* pbIsAvailable);
+EFrameworkunifiedStatus VehicleIfAttachCallbacksToDispatcher( // NOLINT(readability/nolint)
+ _FrameworkunifiedProtocolCallbackHandler const* p_msg_handler,
+ unsigned int ui_handlercount);
+EFrameworkunifiedStatus VehicleIfDetachCallbacksFromDispatcher(const PUI_32 pui_cmd_array, UI_32 ui_command_count);
+EFrameworkunifiedStatus VehicleIfNotifyOnVehicleAvailability(CbFuncPtr fp_on_cmd);
+EFrameworkunifiedStatus VehicleIfDeliveryEntry(uint32_t ul_did);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_VEHICLEIF_H_
diff --git a/vehicleservice/positioning/server/include/ServiceInterface/ps_psmshadow_notifications.h b/vehicleservice/positioning/server/include/ServiceInterface/ps_psmshadow_notifications.h
new file mode 100755
index 0000000..24a513a
--- /dev/null
+++ b/vehicleservice/positioning/server/include/ServiceInterface/ps_psmshadow_notifications.h
@@ -0,0 +1,62 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ps_psmshadow_notifications.h
+ */
+
+#ifndef PS_PSM_SHADOW_NOTIFICATIONS_H_ // NOLINT(build/header_guard)
+
+#include "agl_thread.h"
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheralservice
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup PS_PSMShadow
+ * @ingroup peripheralservice
+ * @{
+ */
+
+/**
+ * \~english PS_PSMShadow service availability notify.
+ */
+#define NTFY_PSMShadowService_Availability MN_PS_PSMSHADOW"/Availability"
+
+/**
+ * \~english init complete notify.
+ */
+#define NTFY_PSM_INITCOMP MN_PS_PSMSHADOW"/InitComp"
+
+/**
+ * \~english init complete2 notify.
+ */
+#define NTFY_PSM_INITCOMP2 MN_PS_PSMSHADOW"/InitComp2"
+
+// to be delete code.
+// Voltage, temperature and fan data to DIAG / HMI.
+#define NTFY_PSM_VTG_TEMP_FAN_DATA MN_PS_PSMSHADOW"/VolTempFanInfo"
+// Audio High Temp notification to Audio service.
+#define NTFY_PSM_AUDIO_HIGH_TEMP MN_PS_PSMSHADOW"/AudioHighTemp"
+
+/** @}*/ // end of PS_PSMShadow
+/** @}*/ // end of peripheralservice
+/** @}*/ // end of BaseSystem
+
+#endif // PS_PSM_SHADOW_NOTIFICATIONS_H_
diff --git a/vehicleservice/positioning/server/include/ServiceInterface/ps_version.h b/vehicleservice/positioning/server/include/ServiceInterface/ps_version.h
new file mode 100755
index 0000000..f28982f
--- /dev/null
+++ b/vehicleservice/positioning/server/include/ServiceInterface/ps_version.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// \session
+/// \internal
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file ps_services.h
+/// \ingroup tag_PeripheralServices
+/// \brief Peripheral Services Version Information Support.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+// File name : ps_version.h
+// Module : PeripheralServices
+// Description : Peripheral Services Version Information Support.
+// Scope : PeripheralServices
+// Platform : Global Platform Framework (GPF)
+//
+// Customer : General
+// System : PosixBasedOS001
+// Reference : PeripheralServices
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef PS_VERSION_H_ // NOLINT(build/header_guard)
+
+#define PS_VERSION_MAJOR (1u)
+#define PS_VERSION_MINOR (0u)
+#define PS_VERSION_REV (0u)
+
+#endif /* PS_VERSION_H_ */
+
diff --git a/vehicleservice/positioning/server/include/nsfw/positioning_common.h b/vehicleservice/positioning/server/include/nsfw/positioning_common.h
new file mode 100755
index 0000000..538630d
--- /dev/null
+++ b/vehicleservice/positioning/server/include/nsfw/positioning_common.h
@@ -0,0 +1,90 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * positioning_common.h
+ * @brief
+ * Positioing NSFW Dependency Section Common Headers
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_NSFW_POSITIONING_COMMON_H_
+#define POSITIONING_SERVER_INCLUDE_NSFW_POSITIONING_COMMON_H_
+
+#include <positioning_hal.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* Thread control command ID */
+#define CID_EXTTERM_REQ (0x0011) /* External pin status request */
+
+/* Internal thread activation status determination */
+#define THREAD_STS_MSK_POS_MAIN (0x01)
+#define THREAD_STS_MSK_POS_SENS (0x02)
+#define THREAD_STS_MSK_POS_GPS (0x04)
+#define THREAD_STS_MSK_POS_GPS_RECV (0x08)
+#define THREAD_STS_MSK_POS_GPS_ROLLOVER (0x10)
+
+
+/*---------------------------------------------------------------------------------*
+ * ENUMERATION *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Positioning operating status definitions
+*/
+typedef enum {
+ EPOS_EXE_STS_STOP = 0, /* Stopped */
+ EPOS_EXE_STS_RUNNING, /* Running (From FrameworkunifiedOnStart to FrameworkunifiedOnStop) */
+ EPOS_EXE_STS_RUNNING_COLDSTART /* Running after cold start */
+} EnumExeSts_POS;
+
+/*!
+ @brief Positioning Thread Startup Modes
+*/
+typedef enum {
+ EPOS_SETUP_MODE_NORMAL = 0, /* Normal start */
+ EPOS_SETUP_MODE_DATA_RESET /* Data reset start */ /* QAC 930 */
+} EnumSetupMode_POS;
+
+/*---------------------------------------------------------------------------------*
+ * STRUCTURE *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Thread activation information
+*/
+typedef struct {
+ EnumSetupMode_POS e_mode; /* Thread activation mode */
+} ST_THREAD_SETUP_INFO;
+
+/*---------------------------------------------------------------------------------*
+ * Prototype *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+ EnumSetupMode_POS PosSetupThread(HANDLE h_app, EnumTID_POS e_tid);
+ void PosTeardownThread(EnumTID_POS e_tid);
+#ifdef __cplusplus
+}
+#endif
+
+/*---------------------------------------------------------------------------------*
+ * Extern *
+ *---------------------------------------------------------------------------------*/
+extern BOOL g_thread_stop_req; /* Pos_Gps_Recv Thread Stop Flag */
+
+
+#endif // POSITIONING_SERVER_INCLUDE_NSFW_POSITIONING_COMMON_H_
diff --git a/vehicleservice/positioning/server/include/nsfw/vehicle_version.h b/vehicleservice/positioning/server/include/nsfw/vehicle_version.h
new file mode 100755
index 0000000..b397b68
--- /dev/null
+++ b/vehicleservice/positioning/server/include/nsfw/vehicle_version.h
@@ -0,0 +1,29 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_NSFW_VEHICLE_VERSION_H_
+#define POSITIONING_SERVER_INCLUDE_NSFW_VEHICLE_VERSION_H_
+
+#define MAJORNO 0x01
+#define MINORNO 0x00
+#define REVISION 0x00
+
+/*
+ * ChangeLog : This section describes all the changes done to the project.
+ *
+ * - Initial
+ */
+
+#endif // POSITIONING_SERVER_INCLUDE_NSFW_VEHICLE_VERSION_H_
diff --git a/vehicleservice/positioning/server/src/Sensor/ClockUtility.cpp b/vehicleservice/positioning/server/src/Sensor/ClockUtility.cpp
new file mode 100755
index 0000000..2e9639a
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/ClockUtility.cpp
@@ -0,0 +1,414 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file ClockUtility.cpp
+@detail Common processing function concerning clock
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "ClockUtility.h"
+#include "ClockUtility_private.h"
+
+/*
+ Global Constant Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static const u_int16 kUsMonth[3][12] = { /* Mnumonic For Remembering The Months With Fewer Than 31 Days Table(Leap year version) Task_31499 */
+ {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, /* Number of days per month(If it is not a leap year) */
+ {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, /* Number of days per month(For leap years) */
+ {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334} /* Cumulative number of days per month(If it is not a leap year) */
+};
+
+static const ClockDayCntTbl kUlDayCntTbl = {
+ /* 1970 Year */ {{0x000007B2U, 0x00000000U, {0x00000000U, 0x0028DE80U, 0x004DC880U, 0x0076A700U, 0x009E3400U, 0x00C71280U, 0x00EE9F80U, 0x01177E00U, 0x01405C80U, 0x0167E980U, 0x0190C800U, 0x01B85500U}}, // NOLINT(whitespace/line_length)
+ /* 1971 Year */ {0x000007B3U, 0x01E13380U, {0x01E13380U, 0x020A1200U, 0x022EFC00U, 0x0257DA80U, 0x027F6780U, 0x02A84600U, 0x02CFD300U, 0x02F8B180U, 0x03219000U, 0x03491D00U, 0x0371FB80U, 0x03998880U}}, // NOLINT(whitespace/line_length)
+ /* 1972 Year */ {0x000007B4U, 0x03C26700U, {0x03C26700U, 0x03EB4580U, 0x04118100U, 0x043A5F80U, 0x0461EC80U, 0x048ACB00U, 0x04B25800U, 0x04DB3680U, 0x05041500U, 0x052BA200U, 0x05548080U, 0x057C0D80U}}, // NOLINT(whitespace/line_length)
+ /* 1973 Year */ {0x000007B5U, 0x05A4EC00U, {0x05A4EC00U, 0x05CDCA80U, 0x05F2B480U, 0x061B9300U, 0x06432000U, 0x066BFE80U, 0x06938B80U, 0x06BC6A00U, 0x06E54880U, 0x070CD580U, 0x0735B400U, 0x075D4100U}}, // NOLINT(whitespace/line_length)
+ /* 1974 Year */ {0x000007B6U, 0x07861F80U, {0x07861F80U, 0x07AEFE00U, 0x07D3E800U, 0x07FCC680U, 0x08245380U, 0x084D3200U, 0x0874BF00U, 0x089D9D80U, 0x08C67C00U, 0x08EE0900U, 0x0916E780U, 0x093E7480U}}, // NOLINT(whitespace/line_length)
+ /* 1975 Year */ {0x000007B7U, 0x09675300U, {0x09675300U, 0x09903180U, 0x09B51B80U, 0x09DDFA00U, 0x0A058700U, 0x0A2E6580U, 0x0A55F280U, 0x0A7ED100U, 0x0AA7AF80U, 0x0ACF3C80U, 0x0AF81B00U, 0x0B1FA800U}}, // NOLINT(whitespace/line_length)
+ /* 1976 Year */ {0x000007B8U, 0x0B488680U, {0x0B488680U, 0x0B716500U, 0x0B97A080U, 0x0BC07F00U, 0x0BE80C00U, 0x0C10EA80U, 0x0C387780U, 0x0C615600U, 0x0C8A3480U, 0x0CB1C180U, 0x0CDAA000U, 0x0D022D00U}}, // NOLINT(whitespace/line_length)
+ /* 1977 Year */ {0x000007B9U, 0x0D2B0B80U, {0x0D2B0B80U, 0x0D53EA00U, 0x0D78D400U, 0x0DA1B280U, 0x0DC93F80U, 0x0DF21E00U, 0x0E19AB00U, 0x0E428980U, 0x0E6B6800U, 0x0E92F500U, 0x0EBBD380U, 0x0EE36080U}}, // NOLINT(whitespace/line_length)
+ /* 1978 Year */ {0x000007BAU, 0x0F0C3F00U, {0x0F0C3F00U, 0x0F351D80U, 0x0F5A0780U, 0x0F82E600U, 0x0FAA7300U, 0x0FD35180U, 0x0FFADE80U, 0x1023BD00U, 0x104C9B80U, 0x10742880U, 0x109D0700U, 0x10C49400U}}, // NOLINT(whitespace/line_length)
+ /* 1979 Year */ {0x000007BBU, 0x10ED7280U, {0x10ED7280U, 0x11165100U, 0x113B3B00U, 0x11641980U, 0x118BA680U, 0x11B48500U, 0x11DC1200U, 0x1204F080U, 0x122DCF00U, 0x12555C00U, 0x127E3A80U, 0x12A5C780U}}, // NOLINT(whitespace/line_length)
+ /* 1980 Year */ {0x000007BCU, 0x12CEA600U, {0x12CEA600U, 0x12F78480U, 0x131DC000U, 0x13469E80U, 0x136E2B80U, 0x13970A00U, 0x13BE9700U, 0x13E77580U, 0x14105400U, 0x1437E100U, 0x1460BF80U, 0x14884C80U}}, // NOLINT(whitespace/line_length)
+ /* 1981 Year */ {0x000007BDU, 0x14B12B00U, {0x14B12B00U, 0x14DA0980U, 0x14FEF380U, 0x1527D200U, 0x154F5F00U, 0x15783D80U, 0x159FCA80U, 0x15C8A900U, 0x15F18780U, 0x16191480U, 0x1641F300U, 0x16698000U}}, // NOLINT(whitespace/line_length)
+ /* 1982 Year */ {0x000007BEU, 0x16925E80U, {0x16925E80U, 0x16BB3D00U, 0x16E02700U, 0x17090580U, 0x17309280U, 0x17597100U, 0x1780FE00U, 0x17A9DC80U, 0x17D2BB00U, 0x17FA4800U, 0x18232680U, 0x184AB380U}}, // NOLINT(whitespace/line_length)
+ /* 1983 Year */ {0x000007BFU, 0x18739200U, {0x18739200U, 0x189C7080U, 0x18C15A80U, 0x18EA3900U, 0x1911C600U, 0x193AA480U, 0x19623180U, 0x198B1000U, 0x19B3EE80U, 0x19DB7B80U, 0x1A045A00U, 0x1A2BE700U}}, // NOLINT(whitespace/line_length)
+ /* 1984 Year */ {0x000007C0U, 0x1A54C580U, {0x1A54C580U, 0x1A7DA400U, 0x1AA3DF80U, 0x1ACCBE00U, 0x1AF44B00U, 0x1B1D2980U, 0x1B44B680U, 0x1B6D9500U, 0x1B967380U, 0x1BBE0080U, 0x1BE6DF00U, 0x1C0E6C00U}}, // NOLINT(whitespace/line_length)
+ /* 1985 Year */ {0x000007C1U, 0x1C374A80U, {0x1C374A80U, 0x1C602900U, 0x1C851300U, 0x1CADF180U, 0x1CD57E80U, 0x1CFE5D00U, 0x1D25EA00U, 0x1D4EC880U, 0x1D77A700U, 0x1D9F3400U, 0x1DC81280U, 0x1DEF9F80U}}, // NOLINT(whitespace/line_length)
+ /* 1986 Year */ {0x000007C2U, 0x1E187E00U, {0x1E187E00U, 0x1E415C80U, 0x1E664680U, 0x1E8F2500U, 0x1EB6B200U, 0x1EDF9080U, 0x1F071D80U, 0x1F2FFC00U, 0x1F58DA80U, 0x1F806780U, 0x1FA94600U, 0x1FD0D300U}}, // NOLINT(whitespace/line_length)
+ /* 1987 Year */ {0x000007C3U, 0x1FF9B180U, {0x1FF9B180U, 0x20229000U, 0x20477A00U, 0x20705880U, 0x2097E580U, 0x20C0C400U, 0x20E85100U, 0x21112F80U, 0x213A0E00U, 0x21619B00U, 0x218A7980U, 0x21B20680U}}, // NOLINT(whitespace/line_length)
+ /* 1988 Year */ {0x000007C4U, 0x21DAE500U, {0x21DAE500U, 0x2203C380U, 0x2229FF00U, 0x2252DD80U, 0x227A6A80U, 0x22A34900U, 0x22CAD600U, 0x22F3B480U, 0x231C9300U, 0x23442000U, 0x236CFE80U, 0x23948B80U}}, // NOLINT(whitespace/line_length)
+ /* 1989 Year */ {0x000007C5U, 0x23BD6A00U, {0x23BD6A00U, 0x23E64880U, 0x240B3280U, 0x24341100U, 0x245B9E00U, 0x24847C80U, 0x24AC0980U, 0x24D4E800U, 0x24FDC680U, 0x25255380U, 0x254E3200U, 0x2575BF00U}}, // NOLINT(whitespace/line_length)
+ /* 1990 Year */ {0x000007C6U, 0x259E9D80U, {0x259E9D80U, 0x25C77C00U, 0x25EC6600U, 0x26154480U, 0x263CD180U, 0x2665B000U, 0x268D3D00U, 0x26B61B80U, 0x26DEFA00U, 0x27068700U, 0x272F6580U, 0x2756F280U}}, // NOLINT(whitespace/line_length)
+ /* 1991 Year */ {0x000007C7U, 0x277FD100U, {0x277FD100U, 0x27A8AF80U, 0x27CD9980U, 0x27F67800U, 0x281E0500U, 0x2846E380U, 0x286E7080U, 0x28974F00U, 0x28C02D80U, 0x28E7BA80U, 0x29109900U, 0x29382600U}}, // NOLINT(whitespace/line_length)
+ /* 1992 Year */ {0x000007C8U, 0x29610480U, {0x29610480U, 0x2989E300U, 0x29B01E80U, 0x29D8FD00U, 0x2A008A00U, 0x2A296880U, 0x2A50F580U, 0x2A79D400U, 0x2AA2B280U, 0x2ACA3F80U, 0x2AF31E00U, 0x2B1AAB00U}}, // NOLINT(whitespace/line_length)
+ /* 1993 Year */ {0x000007C9U, 0x2B438980U, {0x2B438980U, 0x2B6C6800U, 0x2B915200U, 0x2BBA3080U, 0x2BE1BD80U, 0x2C0A9C00U, 0x2C322900U, 0x2C5B0780U, 0x2C83E600U, 0x2CAB7300U, 0x2CD45180U, 0x2CFBDE80U}}, // NOLINT(whitespace/line_length)
+ /* 1994 Year */ {0x000007CAU, 0x2D24BD00U, {0x2D24BD00U, 0x2D4D9B80U, 0x2D728580U, 0x2D9B6400U, 0x2DC2F100U, 0x2DEBCF80U, 0x2E135C80U, 0x2E3C3B00U, 0x2E651980U, 0x2E8CA680U, 0x2EB58500U, 0x2EDD1200U}}, // NOLINT(whitespace/line_length)
+ /* 1995 Year */ {0x000007CBU, 0x2F05F080U, {0x2F05F080U, 0x2F2ECF00U, 0x2F53B900U, 0x2F7C9780U, 0x2FA42480U, 0x2FCD0300U, 0x2FF49000U, 0x301D6E80U, 0x30464D00U, 0x306DDA00U, 0x3096B880U, 0x30BE4580U}}, // NOLINT(whitespace/line_length)
+ /* 1996 Year */ {0x000007CCU, 0x30E72400U, {0x30E72400U, 0x31100280U, 0x31363E00U, 0x315F1C80U, 0x3186A980U, 0x31AF8800U, 0x31D71500U, 0x31FFF380U, 0x3228D200U, 0x32505F00U, 0x32793D80U, 0x32A0CA80U}}, // NOLINT(whitespace/line_length)
+ /* 1997 Year */ {0x000007CDU, 0x32C9A900U, {0x32C9A900U, 0x32F28780U, 0x33177180U, 0x33405000U, 0x3367DD00U, 0x3390BB80U, 0x33B84880U, 0x33E12700U, 0x340A0580U, 0x34319280U, 0x345A7100U, 0x3481FE00U}}, // NOLINT(whitespace/line_length)
+ /* 1998 Year */ {0x000007CEU, 0x34AADC80U, {0x34AADC80U, 0x34D3BB00U, 0x34F8A500U, 0x35218380U, 0x35491080U, 0x3571EF00U, 0x35997C00U, 0x35C25A80U, 0x35EB3900U, 0x3612C600U, 0x363BA480U, 0x36633180U}}, // NOLINT(whitespace/line_length)
+ /* 1999 Year */ {0x000007CFU, 0x368C1000U, {0x368C1000U, 0x36B4EE80U, 0x36D9D880U, 0x3702B700U, 0x372A4400U, 0x37532280U, 0x377AAF80U, 0x37A38E00U, 0x37CC6C80U, 0x37F3F980U, 0x381CD800U, 0x38446500U}}, // NOLINT(whitespace/line_length)
+ /* 2000 Year */ {0x000007D0U, 0x386D4380U, {0x386D4380U, 0x38962200U, 0x38BC5D80U, 0x38E53C00U, 0x390CC900U, 0x3935A780U, 0x395D3480U, 0x39861300U, 0x39AEF180U, 0x39D67E80U, 0x39FF5D00U, 0x3A26EA00U}}, // NOLINT(whitespace/line_length)
+ /* 2001 Year */ {0x000007D1U, 0x3A4FC880U, {0x3A4FC880U, 0x3A78A700U, 0x3A9D9100U, 0x3AC66F80U, 0x3AEDFC80U, 0x3B16DB00U, 0x3B3E6800U, 0x3B674680U, 0x3B902500U, 0x3BB7B200U, 0x3BE09080U, 0x3C081D80U}}, // NOLINT(whitespace/line_length)
+ /* 2002 Year */ {0x000007D2U, 0x3C30FC00U, {0x3C30FC00U, 0x3C59DA80U, 0x3C7EC480U, 0x3CA7A300U, 0x3CCF3000U, 0x3CF80E80U, 0x3D1F9B80U, 0x3D487A00U, 0x3D715880U, 0x3D98E580U, 0x3DC1C400U, 0x3DE95100U}}, // NOLINT(whitespace/line_length)
+ /* 2003 Year */ {0x000007D3U, 0x3E122F80U, {0x3E122F80U, 0x3E3B0E00U, 0x3E5FF800U, 0x3E88D680U, 0x3EB06380U, 0x3ED94200U, 0x3F00CF00U, 0x3F29AD80U, 0x3F528C00U, 0x3F7A1900U, 0x3FA2F780U, 0x3FCA8480U}}, // NOLINT(whitespace/line_length)
+ /* 2004 Year */ {0x000007D4U, 0x3FF36300U, {0x3FF36300U, 0x401C4180U, 0x40427D00U, 0x406B5B80U, 0x4092E880U, 0x40BBC700U, 0x40E35400U, 0x410C3280U, 0x41351100U, 0x415C9E00U, 0x41857C80U, 0x41AD0980U}}, // NOLINT(whitespace/line_length)
+ /* 2005 Year */ {0x000007D5U, 0x41D5E800U, {0x41D5E800U, 0x41FEC680U, 0x4223B080U, 0x424C8F00U, 0x42741C00U, 0x429CFA80U, 0x42C48780U, 0x42ED6600U, 0x43164480U, 0x433DD180U, 0x4366B000U, 0x438E3D00U}}, // NOLINT(whitespace/line_length)
+ /* 2006 Year */ {0x000007D6U, 0x43B71B80U, {0x43B71B80U, 0x43DFFA00U, 0x4404E400U, 0x442DC280U, 0x44554F80U, 0x447E2E00U, 0x44A5BB00U, 0x44CE9980U, 0x44F77800U, 0x451F0500U, 0x4547E380U, 0x456F7080U}}, // NOLINT(whitespace/line_length)
+ /* 2007 Year */ {0x000007D7U, 0x45984F00U, {0x45984F00U, 0x45C12D80U, 0x45E61780U, 0x460EF600U, 0x46368300U, 0x465F6180U, 0x4686EE80U, 0x46AFCD00U, 0x46D8AB80U, 0x47003880U, 0x47291700U, 0x4750A400U}}, // NOLINT(whitespace/line_length)
+ /* 2008 Year */ {0x000007D8U, 0x47798280U, {0x47798280U, 0x47A26100U, 0x47C89C80U, 0x47F17B00U, 0x48190800U, 0x4841E680U, 0x48697380U, 0x48925200U, 0x48BB3080U, 0x48E2BD80U, 0x490B9C00U, 0x49332900U}}, // NOLINT(whitespace/line_length)
+ /* 2009 Year */ {0x000007D9U, 0x495C0780U, {0x495C0780U, 0x4984E600U, 0x49A9D000U, 0x49D2AE80U, 0x49FA3B80U, 0x4A231A00U, 0x4A4AA700U, 0x4A738580U, 0x4A9C6400U, 0x4AC3F100U, 0x4AECCF80U, 0x4B145C80U}}, // NOLINT(whitespace/line_length)
+ /* 2010 Year */ {0x000007DAU, 0x4B3D3B00U, {0x4B3D3B00U, 0x4B661980U, 0x4B8B0380U, 0x4BB3E200U, 0x4BDB6F00U, 0x4C044D80U, 0x4C2BDA80U, 0x4C54B900U, 0x4C7D9780U, 0x4CA52480U, 0x4CCE0300U, 0x4CF59000U}}, // NOLINT(whitespace/line_length)
+ /* 2011 Year */ {0x000007DBU, 0x4D1E6E80U, {0x4D1E6E80U, 0x4D474D00U, 0x4D6C3700U, 0x4D951580U, 0x4DBCA280U, 0x4DE58100U, 0x4E0D0E00U, 0x4E35EC80U, 0x4E5ECB00U, 0x4E865800U, 0x4EAF3680U, 0x4ED6C380U}}, // NOLINT(whitespace/line_length)
+ /* 2012 Year */ {0x000007DCU, 0x4EFFA200U, {0x4EFFA200U, 0x4F288080U, 0x4F4EBC00U, 0x4F779A80U, 0x4F9F2780U, 0x4FC80600U, 0x4FEF9300U, 0x50187180U, 0x50415000U, 0x5068DD00U, 0x5091BB80U, 0x50B94880U}}, // NOLINT(whitespace/line_length)
+ /* 2013 Year */ {0x000007DDU, 0x50E22700U, {0x50E22700U, 0x510B0580U, 0x512FEF80U, 0x5158CE00U, 0x51805B00U, 0x51A93980U, 0x51D0C680U, 0x51F9A500U, 0x52228380U, 0x524A1080U, 0x5272EF00U, 0x529A7C00U}}, // NOLINT(whitespace/line_length)
+ /* 2014 Year */ {0x000007DEU, 0x52C35A80U, {0x52C35A80U, 0x52EC3900U, 0x53112300U, 0x533A0180U, 0x53618E80U, 0x538A6D00U, 0x53B1FA00U, 0x53DAD880U, 0x5403B700U, 0x542B4400U, 0x54542280U, 0x547BAF80U}}, // NOLINT(whitespace/line_length)
+ /* 2015 Year */ {0x000007DFU, 0x54A48E00U, {0x54A48E00U, 0x54CD6C80U, 0x54F25680U, 0x551B3500U, 0x5542C200U, 0x556BA080U, 0x55932D80U, 0x55BC0C00U, 0x55E4EA80U, 0x560C7780U, 0x56355600U, 0x565CE300U}}, // NOLINT(whitespace/line_length)
+ /* 2016 Year */ {0x000007E0U, 0x5685C180U, {0x5685C180U, 0x56AEA000U, 0x56D4DB80U, 0x56FDBA00U, 0x57254700U, 0x574E2580U, 0x5775B280U, 0x579E9100U, 0x57C76F80U, 0x57EEFC80U, 0x5817DB00U, 0x583F6800U}}, // NOLINT(whitespace/line_length)
+ /* 2017 Year */ {0x000007E1U, 0x58684680U, {0x58684680U, 0x58912500U, 0x58B60F00U, 0x58DEED80U, 0x59067A80U, 0x592F5900U, 0x5956E600U, 0x597FC480U, 0x59A8A300U, 0x59D03000U, 0x59F90E80U, 0x5A209B80U}}, // NOLINT(whitespace/line_length)
+ /* 2018 Year */ {0x000007E2U, 0x5A497A00U, {0x5A497A00U, 0x5A725880U, 0x5A974280U, 0x5AC02100U, 0x5AE7AE00U, 0x5B108C80U, 0x5B381980U, 0x5B60F800U, 0x5B89D680U, 0x5BB16380U, 0x5BDA4200U, 0x5C01CF00U}}, // NOLINT(whitespace/line_length)
+ /* 2019 Year */ {0x000007E3U, 0x5C2AAD80U, {0x5C2AAD80U, 0x5C538C00U, 0x5C787600U, 0x5CA15480U, 0x5CC8E180U, 0x5CF1C000U, 0x5D194D00U, 0x5D422B80U, 0x5D6B0A00U, 0x5D929700U, 0x5DBB7580U, 0x5DE30280U}}, // NOLINT(whitespace/line_length)
+ /* 2020 Year */ {0x000007E4U, 0x5E0BE100U, {0x5E0BE100U, 0x5E34BF80U, 0x5E5AFB00U, 0x5E83D980U, 0x5EAB6680U, 0x5ED44500U, 0x5EFBD200U, 0x5F24B080U, 0x5F4D8F00U, 0x5F751C00U, 0x5F9DFA80U, 0x5FC58780U}}, // NOLINT(whitespace/line_length)
+ /* 2021 Year */ {0x000007E5U, 0x5FEE6600U, {0x5FEE6600U, 0x60174480U, 0x603C2E80U, 0x60650D00U, 0x608C9A00U, 0x60B57880U, 0x60DD0580U, 0x6105E400U, 0x612EC280U, 0x61564F80U, 0x617F2E00U, 0x61A6BB00U}}, // NOLINT(whitespace/line_length)
+ /* 2022 Year */ {0x000007E6U, 0x61CF9980U, {0x61CF9980U, 0x61F87800U, 0x621D6200U, 0x62464080U, 0x626DCD80U, 0x6296AC00U, 0x62BE3900U, 0x62E71780U, 0x630FF600U, 0x63378300U, 0x63606180U, 0x6387EE80U}}, // NOLINT(whitespace/line_length)
+ /* 2023 Year */ {0x000007E7U, 0x63B0CD00U, {0x63B0CD00U, 0x63D9AB80U, 0x63FE9580U, 0x64277400U, 0x644F0100U, 0x6477DF80U, 0x649F6C80U, 0x64C84B00U, 0x64F12980U, 0x6518B680U, 0x65419500U, 0x65692200U}}, // NOLINT(whitespace/line_length)
+ /* 2024 Year */ {0x000007E8U, 0x65920080U, {0x65920080U, 0x65BADF00U, 0x65E11A80U, 0x6609F900U, 0x66318600U, 0x665A6480U, 0x6681F180U, 0x66AAD000U, 0x66D3AE80U, 0x66FB3B80U, 0x67241A00U, 0x674BA700U}}, // NOLINT(whitespace/line_length)
+ /* 2025 Year */ {0x000007E9U, 0x67748580U, {0x67748580U, 0x679D6400U, 0x67C24E00U, 0x67EB2C80U, 0x6812B980U, 0x683B9800U, 0x68632500U, 0x688C0380U, 0x68B4E200U, 0x68DC6F00U, 0x69054D80U, 0x692CDA80U}}, // NOLINT(whitespace/line_length)
+ /* 2026 Year */ {0x000007EAU, 0x6955B900U, {0x6955B900U, 0x697E9780U, 0x69A38180U, 0x69CC6000U, 0x69F3ED00U, 0x6A1CCB80U, 0x6A445880U, 0x6A6D3700U, 0x6A961580U, 0x6ABDA280U, 0x6AE68100U, 0x6B0E0E00U}}, // NOLINT(whitespace/line_length)
+ /* 2027 Year */ {0x000007EBU, 0x6B36EC80U, {0x6B36EC80U, 0x6B5FCB00U, 0x6B84B500U, 0x6BAD9380U, 0x6BD52080U, 0x6BFDFF00U, 0x6C258C00U, 0x6C4E6A80U, 0x6C774900U, 0x6C9ED600U, 0x6CC7B480U, 0x6CEF4180U}}, // NOLINT(whitespace/line_length)
+ /* 2028 Year */ {0x000007ECU, 0x6D182000U, {0x6D182000U, 0x6D40FE80U, 0x6D673A00U, 0x6D901880U, 0x6DB7A580U, 0x6DE08400U, 0x6E081100U, 0x6E30EF80U, 0x6E59CE00U, 0x6E815B00U, 0x6EAA3980U, 0x6ED1C680U}}, // NOLINT(whitespace/line_length)
+ /* 2029 Year */ {0x000007EDU, 0x6EFAA500U, {0x6EFAA500U, 0x6F238380U, 0x6F486D80U, 0x6F714C00U, 0x6F98D900U, 0x6FC1B780U, 0x6FE94480U, 0x70122300U, 0x703B0180U, 0x70628E80U, 0x708B6D00U, 0x70B2FA00U}}, // NOLINT(whitespace/line_length)
+ /* 2030 Year */ {0x000007EEU, 0x70DBD880U, {0x70DBD880U, 0x7104B700U, 0x7129A100U, 0x71527F80U, 0x717A0C80U, 0x71A2EB00U, 0x71CA7800U, 0x71F35680U, 0x721C3500U, 0x7243C200U, 0x726CA080U, 0x72942D80U}}, // NOLINT(whitespace/line_length)
+ /* 2031 Year */ {0x000007EFU, 0x72BD0C00U, {0x72BD0C00U, 0x72E5EA80U, 0x730AD480U, 0x7333B300U, 0x735B4000U, 0x73841E80U, 0x73ABAB80U, 0x73D48A00U, 0x73FD6880U, 0x7424F580U, 0x744DD400U, 0x74756100U}}, // NOLINT(whitespace/line_length)
+ /* 2032 Year */ {0x000007F0U, 0x749E3F80U, {0x749E3F80U, 0x74C71E00U, 0x74ED5980U, 0x75163800U, 0x753DC500U, 0x7566A380U, 0x758E3080U, 0x75B70F00U, 0x75DFED80U, 0x76077A80U, 0x76305900U, 0x7657E600U}}, // NOLINT(whitespace/line_length)
+ /* 2033 Year */ {0x000007F1U, 0x7680C480U, {0x7680C480U, 0x76A9A300U, 0x76CE8D00U, 0x76F76B80U, 0x771EF880U, 0x7747D700U, 0x776F6400U, 0x77984280U, 0x77C12100U, 0x77E8AE00U, 0x78118C80U, 0x78391980U}}, // NOLINT(whitespace/line_length)
+ /* 2034 Year */ {0x000007F2U, 0x7861F800U, {0x7861F800U, 0x788AD680U, 0x78AFC080U, 0x78D89F00U, 0x79002C00U, 0x79290A80U, 0x79509780U, 0x79797600U, 0x79A25480U, 0x79C9E180U, 0x79F2C000U, 0x7A1A4D00U}}, // NOLINT(whitespace/line_length)
+ /* 2035 Year */ {0x000007F3U, 0x7A432B80U, {0x7A432B80U, 0x7A6C0A00U, 0x7A90F400U, 0x7AB9D280U, 0x7AE15F80U, 0x7B0A3E00U, 0x7B31CB00U, 0x7B5AA980U, 0x7B838800U, 0x7BAB1500U, 0x7BD3F380U, 0x7BFB8080U}}, // NOLINT(whitespace/line_length)
+ /* 2036 Year */ {0x000007F4U, 0x7C245F00U, {0x7C245F00U, 0x7C4D3D80U, 0x7C737900U, 0x7C9C5780U, 0x7CC3E480U, 0x7CECC300U, 0x7D145000U, 0x7D3D2E80U, 0x7D660D00U, 0x7D8D9A00U, 0x7DB67880U, 0x7DDE0580U}}, // NOLINT(whitespace/line_length)
+ /* 2037 Year */ {0x000007F5U, 0x7E06E400U, {0x7E06E400U, 0x7E2FC280U, 0x7E54AC80U, 0x7E7D8B00U, 0x7EA51800U, 0x7ECDF680U, 0x7EF58380U, 0x7F1E6200U, 0x7F474080U, 0x7F6ECD80U, 0x7F97AC00U, 0x7FBF3900U}}, // NOLINT(whitespace/line_length)
+ /* 2038 Year */ {0x000007F6U, 0x7FE81780U, {0x7FE81780U, 0x8010F600U, 0x8035E000U, 0x805EBE80U, 0x80864B80U, 0x80AF2A00U, 0x80D6B700U, 0x80FF9580U, 0x81287400U, 0x81500100U, 0x8178DF80U, 0x81A06C80U}}, // NOLINT(whitespace/line_length)
+ /* 2039 Year */ {0x000007F7U, 0x81C94B00U, {0x81C94B00U, 0x81F22980U, 0x82171380U, 0x823FF200U, 0x82677F00U, 0x82905D80U, 0x82B7EA80U, 0x82E0C900U, 0x8309A780U, 0x83313480U, 0x835A1300U, 0x8381A000U}}, // NOLINT(whitespace/line_length)
+ /* 2040 Year */ {0x000007F8U, 0x83AA7E80U, {0x83AA7E80U, 0x83D35D00U, 0x83F99880U, 0x84227700U, 0x844A0400U, 0x8472E280U, 0x849A6F80U, 0x84C34E00U, 0x84EC2C80U, 0x8513B980U, 0x853C9800U, 0x85642500U}}, // NOLINT(whitespace/line_length)
+ /* 2041 Year */ {0x000007F9U, 0x858D0380U, {0x858D0380U, 0x85B5E200U, 0x85DACC00U, 0x8603AA80U, 0x862B3780U, 0x86541600U, 0x867BA300U, 0x86A48180U, 0x86CD6000U, 0x86F4ED00U, 0x871DCB80U, 0x87455880U}}, // NOLINT(whitespace/line_length)
+ /* 2042 Year */ {0x000007FAU, 0x876E3700U, {0x876E3700U, 0x87971580U, 0x87BBFF80U, 0x87E4DE00U, 0x880C6B00U, 0x88354980U, 0x885CD680U, 0x8885B500U, 0x88AE9380U, 0x88D62080U, 0x88FEFF00U, 0x89268C00U}}, // NOLINT(whitespace/line_length)
+ /* 2043 Year */ {0x000007FBU, 0x894F6A80U, {0x894F6A80U, 0x89784900U, 0x899D3300U, 0x89C61180U, 0x89ED9E80U, 0x8A167D00U, 0x8A3E0A00U, 0x8A66E880U, 0x8A8FC700U, 0x8AB75400U, 0x8AE03280U, 0x8B07BF80U}}, // NOLINT(whitespace/line_length)
+ /* 2044 Year */ {0x000007FCU, 0x8B309E00U, {0x8B309E00U, 0x8B597C80U, 0x8B7FB800U, 0x8BA89680U, 0x8BD02380U, 0x8BF90200U, 0x8C208F00U, 0x8C496D80U, 0x8C724C00U, 0x8C99D900U, 0x8CC2B780U, 0x8CEA4480U}}, // NOLINT(whitespace/line_length)
+ /* 2045 Year */ {0x000007FDU, 0x8D132300U, {0x8D132300U, 0x8D3C0180U, 0x8D60EB80U, 0x8D89CA00U, 0x8DB15700U, 0x8DDA3580U, 0x8E01C280U, 0x8E2AA100U, 0x8E537F80U, 0x8E7B0C80U, 0x8EA3EB00U, 0x8ECB7800U}}, // NOLINT(whitespace/line_length)
+ /* 2046 Year */ {0x000007FEU, 0x8EF45680U, {0x8EF45680U, 0x8F1D3500U, 0x8F421F00U, 0x8F6AFD80U, 0x8F928A80U, 0x8FBB6900U, 0x8FE2F600U, 0x900BD480U, 0x9034B300U, 0x905C4000U, 0x90851E80U, 0x90ACAB80U}}, // NOLINT(whitespace/line_length)
+ /* 2047 Year */ {0x000007FFU, 0x90D58A00U, {0x90D58A00U, 0x90FE6880U, 0x91235280U, 0x914C3100U, 0x9173BE00U, 0x919C9C80U, 0x91C42980U, 0x91ED0800U, 0x9215E680U, 0x923D7380U, 0x92665200U, 0x928DDF00U}}, // NOLINT(whitespace/line_length)
+ /* 2048 Year */ {0x00000800U, 0x92B6BD80U, {0x92B6BD80U, 0x92DF9C00U, 0x9305D780U, 0x932EB600U, 0x93564300U, 0x937F2180U, 0x93A6AE80U, 0x93CF8D00U, 0x93F86B80U, 0x941FF880U, 0x9448D700U, 0x94706400U}}, // NOLINT(whitespace/line_length)
+ /* 2049 Year */ {0x00000801U, 0x94994280U, {0x94994280U, 0x94C22100U, 0x94E70B00U, 0x950FE980U, 0x95377680U, 0x95605500U, 0x9587E200U, 0x95B0C080U, 0x95D99F00U, 0x96012C00U, 0x962A0A80U, 0x96519780U}}, // NOLINT(whitespace/line_length)
+ /* 2050 Year */ {0x00000802U, 0x967A7600U, {0x967A7600U, 0x96A35480U, 0x96C83E80U, 0x96F11D00U, 0x9718AA00U, 0x97418880U, 0x97691580U, 0x9791F400U, 0x97BAD280U, 0x97E25F80U, 0x980B3E00U, 0x9832CB00U}}, // NOLINT(whitespace/line_length)
+ /* 2051 Year */ {0x00000803U, 0x985BA980U, {0x985BA980U, 0x98848800U, 0x98A97200U, 0x98D25080U, 0x98F9DD80U, 0x9922BC00U, 0x994A4900U, 0x99732780U, 0x999C0600U, 0x99C39300U, 0x99EC7180U, 0x9A13FE80U}}, // NOLINT(whitespace/line_length)
+ /* 2052 Year */ {0x00000804U, 0x9A3CDD00U, {0x9A3CDD00U, 0x9A65BB80U, 0x9A8BF700U, 0x9AB4D580U, 0x9ADC6280U, 0x9B054100U, 0x9B2CCE00U, 0x9B55AC80U, 0x9B7E8B00U, 0x9BA61800U, 0x9BCEF680U, 0x9BF68380U}}, // NOLINT(whitespace/line_length)
+ /* 2053 Year */ {0x00000805U, 0x9C1F6200U, {0x9C1F6200U, 0x9C484080U, 0x9C6D2A80U, 0x9C960900U, 0x9CBD9600U, 0x9CE67480U, 0x9D0E0180U, 0x9D36E000U, 0x9D5FBE80U, 0x9D874B80U, 0x9DB02A00U, 0x9DD7B700U}}, // NOLINT(whitespace/line_length)
+ /* 2054 Year */ {0x00000806U, 0x9E009580U, {0x9E009580U, 0x9E297400U, 0x9E4E5E00U, 0x9E773C80U, 0x9E9EC980U, 0x9EC7A800U, 0x9EEF3500U, 0x9F181380U, 0x9F40F200U, 0x9F687F00U, 0x9F915D80U, 0x9FB8EA80U}}, // NOLINT(whitespace/line_length)
+ /* 2055 Year */ {0x00000807U, 0x9FE1C900U, {0x9FE1C900U, 0xA00AA780U, 0xA02F9180U, 0xA0587000U, 0xA07FFD00U, 0xA0A8DB80U, 0xA0D06880U, 0xA0F94700U, 0xA1222580U, 0xA149B280U, 0xA1729100U, 0xA19A1E00U}}, // NOLINT(whitespace/line_length)
+ /* 2056 Year */ {0x00000808U, 0xA1C2FC80U, {0xA1C2FC80U, 0xA1EBDB00U, 0xA2121680U, 0xA23AF500U, 0xA2628200U, 0xA28B6080U, 0xA2B2ED80U, 0xA2DBCC00U, 0xA304AA80U, 0xA32C3780U, 0xA3551600U, 0xA37CA300U}}, // NOLINT(whitespace/line_length)
+ /* 2057 Year */ {0x00000809U, 0xA3A58180U, {0xA3A58180U, 0xA3CE6000U, 0xA3F34A00U, 0xA41C2880U, 0xA443B580U, 0xA46C9400U, 0xA4942100U, 0xA4BCFF80U, 0xA4E5DE00U, 0xA50D6B00U, 0xA5364980U, 0xA55DD680U}}, // NOLINT(whitespace/line_length)
+ /* 2058 Year */ {0x0000080AU, 0xA586B500U, {0xA586B500U, 0xA5AF9380U, 0xA5D47D80U, 0xA5FD5C00U, 0xA624E900U, 0xA64DC780U, 0xA6755480U, 0xA69E3300U, 0xA6C71180U, 0xA6EE9E80U, 0xA7177D00U, 0xA73F0A00U}}, // NOLINT(whitespace/line_length)
+ /* 2059 Year */ {0x0000080BU, 0xA767E880U, {0xA767E880U, 0xA790C700U, 0xA7B5B100U, 0xA7DE8F80U, 0xA8061C80U, 0xA82EFB00U, 0xA8568800U, 0xA87F6680U, 0xA8A84500U, 0xA8CFD200U, 0xA8F8B080U, 0xA9203D80U}}, // NOLINT(whitespace/line_length)
+ /* 2060 Year */ {0x0000080CU, 0xA9491C00U, {0xA9491C00U, 0xA971FA80U, 0xA9983600U, 0xA9C11480U, 0xA9E8A180U, 0xAA118000U, 0xAA390D00U, 0xAA61EB80U, 0xAA8ACA00U, 0xAAB25700U, 0xAADB3580U, 0xAB02C280U}}, // NOLINT(whitespace/line_length)
+ /* 2061 Year */ {0x0000080DU, 0xAB2BA100U, {0xAB2BA100U, 0xAB547F80U, 0xAB796980U, 0xABA24800U, 0xABC9D500U, 0xABF2B380U, 0xAC1A4080U, 0xAC431F00U, 0xAC6BFD80U, 0xAC938A80U, 0xACBC6900U, 0xACE3F600U}}, // NOLINT(whitespace/line_length)
+ /* 2062 Year */ {0x0000080EU, 0xAD0CD480U, {0xAD0CD480U, 0xAD35B300U, 0xAD5A9D00U, 0xAD837B80U, 0xADAB0880U, 0xADD3E700U, 0xADFB7400U, 0xAE245280U, 0xAE4D3100U, 0xAE74BE00U, 0xAE9D9C80U, 0xAEC52980U}}, // NOLINT(whitespace/line_length)
+ /* 2063 Year */ {0x0000080FU, 0xAEEE0800U, {0xAEEE0800U, 0xAF16E680U, 0xAF3BD080U, 0xAF64AF00U, 0xAF8C3C00U, 0xAFB51A80U, 0xAFDCA780U, 0xB0058600U, 0xB02E6480U, 0xB055F180U, 0xB07ED000U, 0xB0A65D00U}}, // NOLINT(whitespace/line_length)
+ /* 2064 Year */ {0x00000810U, 0xB0CF3B80U, {0xB0CF3B80U, 0xB0F81A00U, 0xB11E5580U, 0xB1473400U, 0xB16EC100U, 0xB1979F80U, 0xB1BF2C80U, 0xB1E80B00U, 0xB210E980U, 0xB2387680U, 0xB2615500U, 0xB288E200U}}, // NOLINT(whitespace/line_length)
+ /* 2065 Year */ {0x00000811U, 0xB2B1C080U, {0xB2B1C080U, 0xB2DA9F00U, 0xB2FF8900U, 0xB3286780U, 0xB34FF480U, 0xB378D300U, 0xB3A06000U, 0xB3C93E80U, 0xB3F21D00U, 0xB419AA00U, 0xB4428880U, 0xB46A1580U}}, // NOLINT(whitespace/line_length)
+ /* 2066 Year */ {0x00000812U, 0xB492F400U, {0xB492F400U, 0xB4BBD280U, 0xB4E0BC80U, 0xB5099B00U, 0xB5312800U, 0xB55A0680U, 0xB5819380U, 0xB5AA7200U, 0xB5D35080U, 0xB5FADD80U, 0xB623BC00U, 0xB64B4900U}}, // NOLINT(whitespace/line_length)
+ /* 2067 Year */ {0x00000813U, 0xB6742780U, {0xB6742780U, 0xB69D0600U, 0xB6C1F000U, 0xB6EACE80U, 0xB7125B80U, 0xB73B3A00U, 0xB762C700U, 0xB78BA580U, 0xB7B48400U, 0xB7DC1100U, 0xB804EF80U, 0xB82C7C80U}}, // NOLINT(whitespace/line_length)
+ /* 2068 Year */ {0x00000814U, 0xB8555B00U, {0xB8555B00U, 0xB87E3980U, 0xB8A47500U, 0xB8CD5380U, 0xB8F4E080U, 0xB91DBF00U, 0xB9454C00U, 0xB96E2A80U, 0xB9970900U, 0xB9BE9600U, 0xB9E77480U, 0xBA0F0180U}}, // NOLINT(whitespace/line_length)
+ /* 2069 Year */ {0x00000815U, 0xBA37E000U, {0xBA37E000U, 0xBA60BE80U, 0xBA85A880U, 0xBAAE8700U, 0xBAD61400U, 0xBAFEF280U, 0xBB267F80U, 0xBB4F5E00U, 0xBB783C80U, 0xBB9FC980U, 0xBBC8A800U, 0xBBF03500U}}, // NOLINT(whitespace/line_length)
+ /* 2070 Year */ {0x00000816U, 0xBC191380U, {0xBC191380U, 0xBC41F200U, 0xBC66DC00U, 0xBC8FBA80U, 0xBCB74780U, 0xBCE02600U, 0xBD07B300U, 0xBD309180U, 0xBD597000U, 0xBD80FD00U, 0xBDA9DB80U, 0xBDD16880U}}, // NOLINT(whitespace/line_length)
+ /* 2071 Year */ {0x00000817U, 0xBDFA4700U, {0xBDFA4700U, 0xBE232580U, 0xBE480F80U, 0xBE70EE00U, 0xBE987B00U, 0xBEC15980U, 0xBEE8E680U, 0xBF11C500U, 0xBF3AA380U, 0xBF623080U, 0xBF8B0F00U, 0xBFB29C00U}}, // NOLINT(whitespace/line_length)
+ /* 2072 Year */ {0x00000818U, 0xBFDB7A80U, {0xBFDB7A80U, 0xC0045900U, 0xC02A9480U, 0xC0537300U, 0xC07B0000U, 0xC0A3DE80U, 0xC0CB6B80U, 0xC0F44A00U, 0xC11D2880U, 0xC144B580U, 0xC16D9400U, 0xC1952100U}}, // NOLINT(whitespace/line_length)
+ /* 2073 Year */ {0x00000819U, 0xC1BDFF80U, {0xC1BDFF80U, 0xC1E6DE00U, 0xC20BC800U, 0xC234A680U, 0xC25C3380U, 0xC2851200U, 0xC2AC9F00U, 0xC2D57D80U, 0xC2FE5C00U, 0xC325E900U, 0xC34EC780U, 0xC3765480U}}, // NOLINT(whitespace/line_length)
+ /* 2074 Year */ {0x0000081AU, 0xC39F3300U, {0xC39F3300U, 0xC3C81180U, 0xC3ECFB80U, 0xC415DA00U, 0xC43D6700U, 0xC4664580U, 0xC48DD280U, 0xC4B6B100U, 0xC4DF8F80U, 0xC5071C80U, 0xC52FFB00U, 0xC5578800U}}, // NOLINT(whitespace/line_length)
+ /* 2075 Year */ {0x0000081BU, 0xC5806680U, {0xC5806680U, 0xC5A94500U, 0xC5CE2F00U, 0xC5F70D80U, 0xC61E9A80U, 0xC6477900U, 0xC66F0600U, 0xC697E480U, 0xC6C0C300U, 0xC6E85000U, 0xC7112E80U, 0xC738BB80U}}, // NOLINT(whitespace/line_length)
+ /* 2076 Year */ {0x0000081CU, 0xC7619A00U, {0xC7619A00U, 0xC78A7880U, 0xC7B0B400U, 0xC7D99280U, 0xC8011F80U, 0xC829FE00U, 0xC8518B00U, 0xC87A6980U, 0xC8A34800U, 0xC8CAD500U, 0xC8F3B380U, 0xC91B4080U}}, // NOLINT(whitespace/line_length)
+ /* 2077 Year */ {0x0000081DU, 0xC9441F00U, {0xC9441F00U, 0xC96CFD80U, 0xC991E780U, 0xC9BAC600U, 0xC9E25300U, 0xCA0B3180U, 0xCA32BE80U, 0xCA5B9D00U, 0xCA847B80U, 0xCAAC0880U, 0xCAD4E700U, 0xCAFC7400U}}, // NOLINT(whitespace/line_length)
+ /* 2078 Year */ {0x0000081EU, 0xCB255280U, {0xCB255280U, 0xCB4E3100U, 0xCB731B00U, 0xCB9BF980U, 0xCBC38680U, 0xCBEC6500U, 0xCC13F200U, 0xCC3CD080U, 0xCC65AF00U, 0xCC8D3C00U, 0xCCB61A80U, 0xCCDDA780U}}, // NOLINT(whitespace/line_length)
+ /* 2079 Year */ {0x0000081FU, 0xCD068600U, {0xCD068600U, 0xCD2F6480U, 0xCD544E80U, 0xCD7D2D00U, 0xCDA4BA00U, 0xCDCD9880U, 0xCDF52580U, 0xCE1E0400U, 0xCE46E280U, 0xCE6E6F80U, 0xCE974E00U, 0xCEBEDB00U}}, // NOLINT(whitespace/line_length)
+ /* 2080 Year */ {0x00000820U, 0xCEE7B980U, {0xCEE7B980U, 0xCF109800U, 0xCF36D380U, 0xCF5FB200U, 0xCF873F00U, 0xCFB01D80U, 0xCFD7AA80U, 0xD0008900U, 0xD0296780U, 0xD050F480U, 0xD079D300U, 0xD0A16000U}}, // NOLINT(whitespace/line_length)
+ /* 2081 Year */ {0x00000821U, 0xD0CA3E80U, {0xD0CA3E80U, 0xD0F31D00U, 0xD1180700U, 0xD140E580U, 0xD1687280U, 0xD1915100U, 0xD1B8DE00U, 0xD1E1BC80U, 0xD20A9B00U, 0xD2322800U, 0xD25B0680U, 0xD2829380U}}, // NOLINT(whitespace/line_length)
+ /* 2082 Year */ {0x00000822U, 0xD2AB7200U, {0xD2AB7200U, 0xD2D45080U, 0xD2F93A80U, 0xD3221900U, 0xD349A600U, 0xD3728480U, 0xD39A1180U, 0xD3C2F000U, 0xD3EBCE80U, 0xD4135B80U, 0xD43C3A00U, 0xD463C700U}}, // NOLINT(whitespace/line_length)
+ /* 2083 Year */ {0x00000823U, 0xD48CA580U, {0xD48CA580U, 0xD4B58400U, 0xD4DA6E00U, 0xD5034C80U, 0xD52AD980U, 0xD553B800U, 0xD57B4500U, 0xD5A42380U, 0xD5CD0200U, 0xD5F48F00U, 0xD61D6D80U, 0xD644FA80U}}, // NOLINT(whitespace/line_length)
+ /* 2084 Year */ {0x00000824U, 0xD66DD900U, {0xD66DD900U, 0xD696B780U, 0xD6BCF300U, 0xD6E5D180U, 0xD70D5E80U, 0xD7363D00U, 0xD75DCA00U, 0xD786A880U, 0xD7AF8700U, 0xD7D71400U, 0xD7FFF280U, 0xD8277F80U}}, // NOLINT(whitespace/line_length)
+ /* 2085 Year */ {0x00000825U, 0xD8505E00U, {0xD8505E00U, 0xD8793C80U, 0xD89E2680U, 0xD8C70500U, 0xD8EE9200U, 0xD9177080U, 0xD93EFD80U, 0xD967DC00U, 0xD990BA80U, 0xD9B84780U, 0xD9E12600U, 0xDA08B300U}}, // NOLINT(whitespace/line_length)
+ /* 2086 Year */ {0x00000826U, 0xDA319180U, {0xDA319180U, 0xDA5A7000U, 0xDA7F5A00U, 0xDAA83880U, 0xDACFC580U, 0xDAF8A400U, 0xDB203100U, 0xDB490F80U, 0xDB71EE00U, 0xDB997B00U, 0xDBC25980U, 0xDBE9E680U}}, // NOLINT(whitespace/line_length)
+ /* 2087 Year */ {0x00000827U, 0xDC12C500U, {0xDC12C500U, 0xDC3BA380U, 0xDC608D80U, 0xDC896C00U, 0xDCB0F900U, 0xDCD9D780U, 0xDD016480U, 0xDD2A4300U, 0xDD532180U, 0xDD7AAE80U, 0xDDA38D00U, 0xDDCB1A00U}}, // NOLINT(whitespace/line_length)
+ /* 2088 Year */ {0x00000828U, 0xDDF3F880U, {0xDDF3F880U, 0xDE1CD700U, 0xDE431280U, 0xDE6BF100U, 0xDE937E00U, 0xDEBC5C80U, 0xDEE3E980U, 0xDF0CC800U, 0xDF35A680U, 0xDF5D3380U, 0xDF861200U, 0xDFAD9F00U}}, // NOLINT(whitespace/line_length)
+ /* 2089 Year */ {0x00000829U, 0xDFD67D80U, {0xDFD67D80U, 0xDFFF5C00U, 0xE0244600U, 0xE04D2480U, 0xE074B180U, 0xE09D9000U, 0xE0C51D00U, 0xE0EDFB80U, 0xE116DA00U, 0xE13E6700U, 0xE1674580U, 0xE18ED280U}}, // NOLINT(whitespace/line_length)
+ /* 2090 Year */ {0x0000082AU, 0xE1B7B100U, {0xE1B7B100U, 0xE1E08F80U, 0xE2057980U, 0xE22E5800U, 0xE255E500U, 0xE27EC380U, 0xE2A65080U, 0xE2CF2F00U, 0xE2F80D80U, 0xE31F9A80U, 0xE3487900U, 0xE3700600U}}, // NOLINT(whitespace/line_length)
+ /* 2091 Year */ {0x0000082BU, 0xE398E480U, {0xE398E480U, 0xE3C1C300U, 0xE3E6AD00U, 0xE40F8B80U, 0xE4371880U, 0xE45FF700U, 0xE4878400U, 0xE4B06280U, 0xE4D94100U, 0xE500CE00U, 0xE529AC80U, 0xE5513980U}}, // NOLINT(whitespace/line_length)
+ /* 2092 Year */ {0x0000082CU, 0xE57A1800U, {0xE57A1800U, 0xE5A2F680U, 0xE5C93200U, 0xE5F21080U, 0xE6199D80U, 0xE6427C00U, 0xE66A0900U, 0xE692E780U, 0xE6BBC600U, 0xE6E35300U, 0xE70C3180U, 0xE733BE80U}}, // NOLINT(whitespace/line_length)
+ /* 2093 Year */ {0x0000082DU, 0xE75C9D00U, {0xE75C9D00U, 0xE7857B80U, 0xE7AA6580U, 0xE7D34400U, 0xE7FAD100U, 0xE823AF80U, 0xE84B3C80U, 0xE8741B00U, 0xE89CF980U, 0xE8C48680U, 0xE8ED6500U, 0xE914F200U}}, // NOLINT(whitespace/line_length)
+ /* 2094 Year */ {0x0000082EU, 0xE93DD080U, {0xE93DD080U, 0xE966AF00U, 0xE98B9900U, 0xE9B47780U, 0xE9DC0480U, 0xEA04E300U, 0xEA2C7000U, 0xEA554E80U, 0xEA7E2D00U, 0xEAA5BA00U, 0xEACE9880U, 0xEAF62580U}}, // NOLINT(whitespace/line_length)
+ /* 2095 Year */ {0x0000082FU, 0xEB1F0400U, {0xEB1F0400U, 0xEB47E280U, 0xEB6CCC80U, 0xEB95AB00U, 0xEBBD3800U, 0xEBE61680U, 0xEC0DA380U, 0xEC368200U, 0xEC5F6080U, 0xEC86ED80U, 0xECAFCC00U, 0xECD75900U}}, // NOLINT(whitespace/line_length)
+ /* 2096 Year */ {0x00000830U, 0xED003780U, {0xED003780U, 0xED291600U, 0xED4F5180U, 0xED783000U, 0xED9FBD00U, 0xEDC89B80U, 0xEDF02880U, 0xEE190700U, 0xEE41E580U, 0xEE697280U, 0xEE925100U, 0xEEB9DE00U}}, // NOLINT(whitespace/line_length)
+ /* 2097 Year */ {0x00000831U, 0xEEE2BC80U, {0xEEE2BC80U, 0xEF0B9B00U, 0xEF308500U, 0xEF596380U, 0xEF80F080U, 0xEFA9CF00U, 0xEFD15C00U, 0xEFFA3A80U, 0xF0231900U, 0xF04AA600U, 0xF0738480U, 0xF09B1180U}}, // NOLINT(whitespace/line_length)
+ /* 2098 Year */ {0x00000832U, 0xF0C3F000U, {0xF0C3F000U, 0xF0ECCE80U, 0xF111B880U, 0xF13A9700U, 0xF1622400U, 0xF18B0280U, 0xF1B28F80U, 0xF1DB6E00U, 0xF2044C80U, 0xF22BD980U, 0xF254B800U, 0xF27C4500U}}, // NOLINT(whitespace/line_length)
+ /* 2099 Year */ {0x00000833U, 0xF2A52380U, {0xF2A52380U, 0xF2CE0200U, 0xF2F2EC00U, 0xF31BCA80U, 0xF3435780U, 0xF36C3600U, 0xF393C300U, 0xF3BCA180U, 0xF3E58000U, 0xF40D0D00U, 0xF435EB80U, 0xF45D7880U}}, // NOLINT(whitespace/line_length)
+ /* 2100 Year */ {0x00000834U, 0xF4865700U, {0xF4865700U, 0xF4AF3580U, 0xF4D41F80U, 0xF4FCFE00U, 0xF5248B00U, 0xF54D6980U, 0xF574F680U, 0xF59DD500U, 0xF5C6B380U, 0xF5EE4080U, 0xF6171F00U, 0xF63EAC00U}}, // NOLINT(whitespace/line_length)
+ /* 2101 Year */ {0x00000835U, 0xF6678A80U, {0xF6678A80U, 0xF6906900U, 0xF6B55300U, 0xF6DE3180U, 0xF705BE80U, 0xF72E9D00U, 0xF7562A00U, 0xF77F0880U, 0xF7A7E700U, 0xF7CF7400U, 0xF7F85280U, 0xF81FDF80U}}, // NOLINT(whitespace/line_length)
+ /* 2102 Year */ {0x00000836U, 0xF848BE00U, {0xF848BE00U, 0xF8719C80U, 0xF8968680U, 0xF8BF6500U, 0xF8E6F200U, 0xF90FD080U, 0xF9375D80U, 0xF9603C00U, 0xF9891A80U, 0xF9B0A780U, 0xF9D98600U, 0xFA011300U}}, // NOLINT(whitespace/line_length)
+ /* 2103 Year */ {0x00000837U, 0xFA29F180U, {0xFA29F180U, 0xFA52D000U, 0xFA77BA00U, 0xFAA09880U, 0xFAC82580U, 0xFAF10400U, 0xFB189100U, 0xFB416F80U, 0xFB6A4E00U, 0xFB91DB00U, 0xFBBAB980U, 0xFBE24680U}}, // NOLINT(whitespace/line_length)
+ /* 2104 Year */ {0x00000838U, 0xFC0B2500U, {0xFC0B2500U, 0xFC340380U, 0xFC5A3F00U, 0xFC831D80U, 0xFCAAAA80U, 0xFCD38900U, 0xFCFB1600U, 0xFD23F480U, 0xFD4CD300U, 0xFD746000U, 0xFD9D3E80U, 0xFDC4CB80U}}, // NOLINT(whitespace/line_length)
+ /* 2105 Year */ {0x00000839U, 0xFDEDAA00U, {0xFDEDAA00U, 0xFE168880U, 0xFE3B7280U, 0xFE645100U, 0xFE8BDE00U, 0xFEB4BC80U, 0xFEDC4980U, 0xFF052800U, 0xFF2E0680U, 0xFF559380U, 0xFF7E7200U, 0xFFA5FF00U}}, // NOLINT(whitespace/line_length)
+ /* 2106 Year */ {0x0000083AU, 0xFFCEDD80U, {0xFFCEDD80U, 0xFFF7BC00U, 0x001CA600U, 0x00458480U, 0x006D1180U, 0x0095F000U, 0x00BD7D00U, 0x00E65B80U, 0x010F3A00U, 0x0136C700U, 0x015FA580U, 0x01873280U}} // NOLINT(whitespace/line_length)
+ }
+};
+
+/*************************************************************************
+@brief The date is converted at the multiplication second.
+@outline The specified time and date is converted at the multiplication second
+ from epoch time(0:0:0 January 1, 1970. )
+@type Completion return type<BR>
+@param[in] const LPSYSTEMTIME lp_st : Converted time and date
+@param[out] u_int32* uli_sec : Multiplication second from epoch time
+@threshold lp_st != NULL, uli_sec != NULL <BR>
+ 1970 <= lp_st.wYear <= 2105 <BR>
+ 1 <= lp_st.wMonth <= 12 <BR>
+ 1 <= lp_st.wDay <= 31 <BR>
+ 0 <= lp_st.wHour <= 23 <BR>
+ 0 <= lp_st.wMinute <= 59 <BR>
+ 0 <= lp_st.wSecond <= 59 <BR>
+@return RET_API
+@retval RET_NORMAL : Normal end
+@retval RET_ERROR : Abnormal end
+*****************************************************************************/
+RET_API ClockUtilityConvertDateToSecond(const LPSYSTEMTIME lp_st, u_int32* uli_sec) {
+ u_int8 imflg; /* Leap year determination flag 0:Not a leap year 1:Leap year */
+ u_int32 ui_day;
+ int32 century;
+ RET_API ret = RET_NORMAL;
+
+ /* Checking the NULL of Pointer Arguments */
+ if ((lp_st == NULL) || (uli_sec == NULL)) {
+ ret = RET_ERROR;
+ } else {
+ *uli_sec = 0; /* Reset accumulated seconds to 0 */
+
+ /* Parameter check */
+ if (((lp_st->wYear < 1970) || (2105 < lp_st->wYear)) || /* Check Year to Convert */
+ ((lp_st->wMonth < 1) || (12 < lp_st->wMonth))) { /* Check month to convert */
+ ret = RET_ERROR;
+ } else {
+ /* Determine the leap year and select the "Mnumonic For Remembering The Months With Fewer Than 31 Days" table. */
+ imflg = 0; /* Set the default to a non-leap year */
+ if ((lp_st->wYear % 4) == 0) { /* If the year is divisible by 4, */
+ imflg = 1; /* Be a leap year */
+ }
+ if ((lp_st->wYear % 100) == 0) { /* However,If the year is divisible by 100 */
+ imflg = 0; /* Not leap years */
+ }
+ if ((lp_st->wYear % 400) == 0) { /* However,If the year is divisible by 400 */
+ imflg = 1; /* Be a leap year */
+ }
+
+ /* Parameter check again */
+ if (((lp_st->wDay < 1) || (kUsMonth[imflg][lp_st->wMonth - 1] < lp_st->wDay)) || /* Check date to convert */
+ (23 < lp_st->wHour) || /* Check when converting */
+ (59 < lp_st->wMinute) || /* Check the minutes to convert */
+ (59 < lp_st->wSecond) ) { /* Check the seconds to convert */
+ ret = RET_ERROR;
+ } else {
+ /* Converting Hours, Minutes, and Seconds to Seconds */
+ *uli_sec = lp_st->wSecond; /* The specified seconds are stored as is. */
+ *uli_sec += lp_st->wMinute * SEC_PER_MIN; /* Convert specified minutes to seconds and add */
+ *uli_sec += lp_st->wHour * SEC_PER_HOUR; /* Convert specified hour to second and add */
+
+ /* Convert a date to the number of days since January 1, 1970 */ /* Task_31499 */
+ ui_day = 0;
+ ui_day += (lp_st->wYear - 1970) * 365;
+
+ /* Because years divisible by 100 are not counted as leap years,Calculate the number of times */
+ century = lp_st->wYear / 100;
+ /* Add the number of days added for the leap year up to the previous year */
+ /* Shift year to right by 2 bits until last year(Divide by 4) -
+ Exclude years divisible by 100(century) + Shift century right by 2 bits(Divide by 4
+ -> If it is divisible by 4, it is counted as a leap year */
+ ui_day += ((lp_st->wYear - 1) >> 2) - century + (century >> 2) - 477; /* 477 -> Number of leap years up to 1970 */
+ /* Add the number of days up to the previous month of the current year */
+ ui_day += kUsMonth[2][lp_st->wMonth - 1] + ((lp_st->wMonth > 2) ? imflg : 0);
+
+ ui_day += (lp_st->wDay - 1); /* Add the number of elapsed days */
+
+ *uli_sec += (ui_day * SEC_PER_DAY); /* Convert the number of days to seconds and add */
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*************************************************************************
+@brief The multiplication second is converted at the date.
+@outline The specified multiplication second is converted as a multiplication second from epoch time(0:0:0 January 1, 1970.) at time and date.
+@type Completion return type
+@param[in] const u_int32*uli_sec : Converted multiplication second from epoch time
+@param[out] LPSYSTEMTIME lp_st : Time after it converts it of date
+@threshold lp_st != NULL, uli_sec != NULL <BR>
+ uli_sec < 0xFFCEDD80
+@return RET_API
+@retval RET_NORMAL : Normal end
+@retval RET_ERROR : Abnormal end
+*****************************************************************************/
+
+RET_API ClockUtilityConvertSecondToDate(const u_int32* uli_sec, LPSYSTEMTIME lp_st) {
+ u_int32 i; /* Loop control */
+ u_int32 j; /* Loop control */
+ u_int32 uli_sec_wk; /* Total value save */
+ RET_API ret = RET_NORMAL; /* return value */
+ u_int8 complete_cnv = FALSE; /* Conversion completion flag */
+ u_int8 valid_date; /* Date Valid Value Flag */
+
+ /* Checking the NULL of Pointer Arguments */
+ if ((uli_sec == NULL) || (lp_st == NULL)) {
+ ret = RET_ERROR;
+ } else {
+ /* Back up the accumulated seconds to the work. */
+ uli_sec_wk = static_cast<u_int32>(*uli_sec);
+
+ /* Parameter check processing */
+ if (uli_sec_wk >= kUlDayCntTbl.st_tbl[CNV_YEAR_MAX].ulCount) {
+ ret = RET_ERROR;
+ } else {
+ /* Initialize */
+ lp_st->wYear = (WORD)(kUlDayCntTbl.st_tbl[0].ulYear);
+ lp_st->wMonth = (WORD)(1); /* Month Settings */
+ lp_st->wDay = (WORD)(1); /* Day Settings */
+ lp_st->wDayOfWeek = (WORD)(4); /* Setting the day of the week(Note : Corrected in cases other than 1970) */
+ lp_st->wHour = (WORD)(0); /* Time setting */
+ lp_st->wMinute = (WORD)(0); /* Minute setting */
+ lp_st->wSecond = (WORD)(0); /* Set Seconds */
+ lp_st->wMilliseconds = (WORD)(0); /* Set msec. */
+
+ /* Search time accumulated seconds conversion table */
+ for (i = 0; i < CNV_YEAR_MAX; i++) {
+ /* Set the year(Maximum value) */
+ if ((kUlDayCntTbl.st_tbl[i + 1].ulCount > uli_sec_wk) || (i == (CNV_YEAR_MAX - 1))) {
+ lp_st->wYear = (WORD)kUlDayCntTbl.st_tbl[i].ulYear;
+
+ /* Set the month(Maximum value) */
+ j = 0;
+ while ((j < 12) && (complete_cnv == FALSE)) {
+ /* Prevent 12Month(j=11)ulMonth[12] access */
+ valid_date = FALSE;
+ if (j == (MONTH_MAX - 1)) {
+ valid_date = TRUE;
+ } else {
+ if (kUlDayCntTbl.st_tbl[i].ulMonth[j + 1] > uli_sec_wk) {
+ valid_date = TRUE;
+ }
+ }
+
+ if (valid_date == TRUE) {
+ lp_st->wMonth = (WORD)(j + 1);
+
+ /* Day-of-week,Set Date Hour Minute Second */
+ lp_st->wDayOfWeek = (WORD)((lp_st->wDayOfWeek +
+ (WORD)((uli_sec_wk / SEC_PER_DAY) % 7)) % 7); /* Setting the day of the week */
+ uli_sec_wk = uli_sec_wk - (u_int32)(kUlDayCntTbl.st_tbl[i].ulMonth[j]);
+ lp_st->wDay = (WORD)((uli_sec_wk / SEC_PER_DAY) + 1); /* Day Settings */
+ lp_st->wSecond = (WORD)(uli_sec_wk % SEC_PER_MIN); /* Set Seconds */
+ lp_st->wMinute = (WORD)((uli_sec_wk % SEC_PER_HOUR) / SEC_PER_MIN); /* Minute setting */
+ lp_st->wHour = (WORD)((uli_sec_wk % SEC_PER_DAY) / SEC_PER_HOUR); /* Time setting */
+
+ complete_cnv = TRUE; /* Completion */
+ }
+ j++;
+ }
+ }
+
+ if (complete_cnv != FALSE) {
+ break;
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*************************************************************************
+@brief Type conversion is done.
+@outline It converts it from the TimeData type to the SYSTEMTIME type.
+@type Completion return type
+@param[in] const TimeData* base_time : Time of conversion origin
+@param[out] const SYSTEMTIME* result_time : Time after it converts it
+@threshold base_time != NULL<BR>
+@threshold result_time != NULL
+@return CLOCK_RETURN
+@retval CLOCK_OK : Normal end
+@retval CLOCK_ERROR : Abnormal end
+@retval CLOCK_ERROR_ARGUMENTS : The argument is wrong
+@trace
+*****************************************************************************/
+CLOCK_RETURN ClockApiConvertTimeDataToSYSTEMTIME(const TimeData* base_time, SYSTEMTIME* result_time) {
+ CLOCK_RETURN ret = CLOCK_ERROR;
+ RET_API ret_cnv = RET_ERROR;
+ u_int32 total_sec = 0;
+
+ if ((base_time != NULL) && (result_time != NULL)) {
+ /* Converting TimeData Types to SYSTEMTIME Types */
+ result_time->wYear = static_cast<WORD>(base_time->year);
+ result_time->wMonth = static_cast<WORD>(base_time->month);
+ result_time->wDay = static_cast<WORD>(base_time->day);
+ result_time->wHour = static_cast<WORD>(base_time->hour);
+ result_time->wMinute = static_cast<WORD>(base_time->minute);
+ result_time->wSecond = static_cast<WORD>(base_time->second);
+ result_time->wMilliseconds = 0; /* 0 because there is no corresponding parameter */
+ result_time->wDayOfWeek = CLKMNG_SUN; /* 0 because there is no corresponding parameter */
+
+ ret_cnv = ClockUtilityConvertDateToSecond(result_time, &total_sec);
+ if (ret_cnv == RET_NORMAL) {
+ /* Calculate the day of the week from the cumulative second. */
+ ret_cnv = ClockUtilityConvertSecondToDate(&total_sec, result_time);
+ if (ret_cnv == RET_NORMAL) {
+ ret = CLOCK_OK;
+ } else {
+ ret = CLOCK_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ClockUtility.lib:%s:LINE:%d\r\nClockApiConvertTimeDataToSYSTEMTIME"\
+ "ClockUtilityConvertSecondToDate ERROR!![%d]\r\n",
+ LTEXT(__FILE__),
+ __LINE__,
+ ret);
+ }
+ } else {
+ ret = CLOCK_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ClockUtility.lib:%s:LINE:%d\r\nClockApiConvertTimeDataToSYSTEMTIME"\
+ "ClockUtilityConvertDateToSecond ERROR!![%d]\r\n",
+ LTEXT(__FILE__),
+ __LINE__,
+ ret);
+ }
+
+ } else {
+ /* Invalid argument */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ClockUtility.lib:%s:LINE:%d\r\nClockApiConvertTimeDataToSYSTEMTIME"\
+ "Arguments ERROR!![%d]\r\n",
+ LTEXT(__FILE__),
+ __LINE__,
+ ret);
+ ret = CLOCK_ERROR_ARGUMENTS;
+ }
+ return ret;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Common.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Common.cpp
new file mode 100755
index 0000000..9503b34
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Common.cpp
@@ -0,0 +1,127 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :DeadReckoning_Common.cpp
+ * System name :PastModel002
+ * Subsystem name :DeadReckoning processes
+ * Program name :DeadReckoning shared process(DEADRECKONING_COMMON)
+ * Module configuration DeadReckoningMemcmp() Functions for Common Processing Memory Block Comparisons
+ * DeadReckoningCheckDid() Common Processing Data ID Check Function
+ * DeadReckoningGetDataMasterOffset() Get function for common processing data master offset value
+ ******************************************************************************/
+#include "DeadReckoning_Common.h"
+#include <vehicle_service/positioning_base_library.h>
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static const DEADRECKONING_DID_OFFSET_TBL kGstDidListS[] = {
+ /* Data ID Offset size Reserved */
+ { VEHICLE_DID_DR_LONGITUDE, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_LATITUDE, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_ALTITUDE, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_SPEED, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_HEADING, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_GYRO_OFFSET, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_GYRO_SCALE_FACTOR, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { 0, 0, {0, 0} } /* Termination code */
+};
+
+/*******************************************************************************
+* MODULE : DeadReckoningMemcmp
+* ABSTRACT : Functions for Common Processing Memory Block Comparisons
+* FUNCTION : Memory block comparison processing
+* ARGUMENT : *vp_data1 : Comparison target address 1
+* : *vp_data2 : Comparison target address 2
+* : uc_size : Comparison Size
+* NOTE :
+* RETURN : DEADRECKONING_EQ : No data change
+* : DEADRECKONING_NEQ : Data change
+******************************************************************************/
+u_int8 DeadReckoningMemcmp(const void *vp_data1, const void *vp_data2, size_t uc_size) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 l_ret = DEADRECKONING_EQ;
+ const u_int8 *p_data1 = (const u_int8 *)vp_data1;
+ const u_int8 *p_data2 = (const u_int8 *)vp_data1;
+
+ /* Loop by data size */
+ while (uc_size > 0) {
+ if (*p_data1 != *p_data2) {
+ /* Data mismatch */
+ l_ret = DEADRECKONING_NEQ;
+ break;
+ }
+ p_data1++;
+ p_data2++;
+ uc_size--;
+ }
+ return(l_ret);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningCheckDid
+* ABSTRACT : Common Processing Data ID Check Function
+* FUNCTION : Check if the specified DID corresponds to the vehicle sensor information
+* ARGUMENT : ul_did : Data ID
+* NOTE :
+* RETURN : DEADRECKONING_INVALID :Disabled
+* : DEADRECKONING_EFFECTIVE :Enabled
+******************************************************************************/
+int32 DeadReckoningCheckDid(DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i = 0;
+ int32 l_ret = DEADRECKONING_INVALID;
+
+ while (0 != kGstDidListS[i].ul_did) {
+ if (kGstDidListS[i].ul_did == ul_did) {
+ /* DID enabled */
+ l_ret = DEADRECKONING_EFFECTIVE;
+ break;
+ }
+ i++;
+ }
+ return(l_ret);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningGetDataMasterOffset
+* ABSTRACT : Get function for common processing data master offset value
+* FUNCTION : Get the fixed offset value for a given DID
+* ARGUMENT : ul_did : Data ID
+* NOTE :
+* RETURN : Offset value(Returns 0 if DID is invalid)
+* :
+******************************************************************************/
+u_int16 DeadReckoningGetDataMasterOffset(DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i = 0; /* Generic counters */
+ u_int16 us_ret = 0; /* Return value of this function */
+
+ while (0 != kGstDidListS[i].ul_did) {
+ if (kGstDidListS[i].ul_did == ul_did) {
+ /* DID enabled */
+ us_ret = kGstDidListS[i].us_offset;
+ break;
+ }
+ i++;
+ }
+ return(us_ret);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DataMasterMain.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DataMasterMain.cpp
new file mode 100755
index 0000000..93adda0
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DataMasterMain.cpp
@@ -0,0 +1,298 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :DeadReckoning_DataMasterMain.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle SW Data Master
+ * Module configuration :DeadReckoningInitDataMaster() Guess Navigation Data Master Initialization Function
+ * :DeadReckoningSetDataMaster() Estimated Navigational Data Master SW Data Set Processing
+ * :DeadReckoningGetDataMaster() Estimated Navigational Data Master Get Processing
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+#define DR_DEBUG 0
+
+/*******************************************************************************
+* MODULE : DeadReckoningInitDataMaster
+* ABSTRACT : Initialization of Guess Navigation Data Master
+* FUNCTION : Initialize the estimated navigation data master
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningInitDataMaster(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Vehicle sensor data master initialization */
+ DeadReckoningInitLongitudeDr();
+ DeadReckoningInitLatitudeDr();
+ DeadReckoningInitAltitudeDr();
+ DeadReckoningInitSpeedDr();
+ DeadReckoningInitHeadingDr();
+ DeadReckoningInitSnsCounterDr();
+ DeadReckoningInitGyroOffsetDr();
+ DeadReckoningInitGyroScaleFactorDr();
+ DeadReckoningInitGyroScaleFactorLevelDr();
+ DeadReckoningInitSpeedPulseScaleFactorDr();
+ DeadReckoningInitSpeedPulseScaleFactorLevelDr();
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoning_SetDataMaster_Sub
+* ABSTRACT : Estimated Navigational Data Master SW Data Set Processing
+* FUNCTION : Set estimated navigation data
+* ARGUMENT : *p_data : SW vehicle signal notification data
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningSetDataMaster(const DEADRECKONING_DATA_MASTER *p_data,
+ PFUNC_DR_DMASTER_SET_N p_datamaster_set_n) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 chg_type;
+
+ static u_int8 gyro_parameter_chg_type = 0;
+ static u_int8 speedpulse_parameter_chg_type = 0;
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (p_data->ul_did) {
+ case VEHICLE_DID_DR_LONGITUDE:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetLongitudeDr(p_data);
+ /* Implementation of delivery process at LATITUDE updating timings */
+ /* Since the order of transmission (updating) at the main receiver is fixed, there is no problem. */
+ break;
+ }
+ case VEHICLE_DID_DR_LATITUDE:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetLatitudeDr(p_data);
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_ALTITUDE:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetAltitudeDr(p_data);
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetSpeedDr(p_data);
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_HEADING:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetHeadingDr(p_data);
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_SNS_COUNTER:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetSnsCounterDr(p_data);
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_OFFSET:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetGyroOffsetDr(p_data);
+ /* Distribution processing not performed in this DID */
+ /* Delivery processing is executed when VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL is updated. */
+ /* The GyroParameter order is defined by DeadReckoning_RcvMsg(). */
+ if (chg_type == DEADRECKONING_NEQ) {
+ gyro_parameter_chg_type = DEADRECKONING_NEQ;
+ }
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetGyroScaleFactorDr(p_data);
+ /* Distribution processing not performed in this DID */
+ /* Delivery processing is executed when VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL is updated. */
+ /* The GyroParameter order is defined by DeadReckoning_RcvMsg(). */
+ if (chg_type == DEADRECKONING_NEQ) {
+ gyro_parameter_chg_type = DEADRECKONING_NEQ;
+ }
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetGyroScaleFactorLevelDr(p_data);
+ if (gyro_parameter_chg_type == DEADRECKONING_NEQ) {
+ chg_type = DEADRECKONING_NEQ;
+ gyro_parameter_chg_type = DEADRECKONING_EQ;
+ }
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetSpeedPulseScaleFactorDr(p_data);
+ /* Distribution processing not performed in this DID */
+ /* Delivery processing is executed when VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL is updated. */
+ /* The SpeedPulseParameter order is defined by DeadReckoning_RcvMsg(). */
+ if (chg_type == DEADRECKONING_NEQ) {
+ speedpulse_parameter_chg_type = DEADRECKONING_NEQ;
+ }
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetSpeedPulseScaleFactorLevelDr(p_data);
+ if (speedpulse_parameter_chg_type == DEADRECKONING_NEQ) {
+ chg_type = DEADRECKONING_NEQ;
+ speedpulse_parameter_chg_type = DEADRECKONING_EQ;
+ }
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningGetDataMaster
+* ABSTRACT : Estimated Navigational Data Master Get Processing
+* FUNCTION : Provide an estimated navigation data master
+* ARGUMENT : ul_did : Data ID corresponding to the vehicle information
+* : *p_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningGetDataMaster(DID ul_did, DEADRECKONING_DATA_MASTER *p_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /*------------------------------------------------------*/
+ /* Call the data Get processing associated with the DID */
+ /*------------------------------------------------------*/
+ switch (ul_did) {
+ /*------------------------------------------------------*/
+ /* Vehicle sensor data group */
+ /*------------------------------------------------------*/
+ case VEHICLE_DID_DR_LONGITUDE:
+ {
+ DeadReckoningGetLongitudeDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_LATITUDE:
+ {
+ DeadReckoningGetLatitudeDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_ALTITUDE:
+ {
+ DeadReckoningGetAltitudeDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED:
+ {
+ DeadReckoningGetSpeedDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_HEADING:
+ {
+ DeadReckoningGetHeadingDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_SNS_COUNTER:
+ {
+ DeadReckoningGetSnsCounterDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_OFFSET:
+ {
+ DeadReckoningGetGyroOffsetDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR:
+ {
+ DeadReckoningGetGyroScaleFactorDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL:
+ {
+ DeadReckoningGetGyroScaleFactorLevelDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR:
+ {
+ DeadReckoningGetSpeedPulseScaleFactorDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL:
+ {
+ DeadReckoningGetSpeedPulseScaleFactorLevelDr(p_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DeliveryCtrl.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DeliveryCtrl.cpp
new file mode 100755
index 0000000..0a08f5f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DeliveryCtrl.cpp
@@ -0,0 +1,835 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :DeadReckoning_DeliveryCtrl.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle Sensor Destination Management(
+ * Module configuration DeadReckoningInitDeliveryCtrlTbl() Vehicle sensor delivery destination management table initialization function
+ * DeadReckoningInitDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management area initialization function
+ * DeadReckoningEntryDeliveryCtrl() Vehicle sensor delivery destination management registration function
+ * :DeadReckoningAddDeliveryCtrlTbl() Vehicle sensor delivery destination management table addition function
+ * :DeadReckoningUpdateDeliveryCtrlTbl() Vehicle sensor delivery destination management table update function
+ * :DeadReckoning_DeliveryEntry_Delete() Vehicle sensor delivery destination management table deletion function
+ * :DeadReckoningAddDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management addition function
+ * :DeadReckoningUpdateDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management update function
+ * :DeadReckoning_DeleteDeliveryCtrlTblMng_Touch() Vehicle sensor delivery destination management table management deletion (touch panel) function
+ * DeadReckoningMakeDeliveryPnoTbl() Vehicle Sensor Destination PNO Table Creation Function
+ * :DeadReckoningAddPnoTbl() Vehicle Sensor Destination PNO Table Addition Function
+ * :DeadReckoningDeliveryProc() Vehicle Sensor Data Delivery Process
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DeliveryCtrl.h"
+#include "Vehicle_API.h"
+#include "Vehicle_API_Dummy.h"
+#include "Dead_Reckoning_Local_Api.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DELIVERY_CTRL_TBL g_delivery_dr_ctrltbl;
+static DEADRECKONING_DELIVERY_CTRL_TBL_MNG g_delivery_dr_ctrltbl_mng;
+static DEADRECKONING_DELIVERY_PNO_TBL g_delivery_dr_pnotbl;
+
+/* Stored data count */
+int32 g_delivery_dr_ctrl_num = 0;
+
+/* PastModel002 support DR */
+/*******************************************************************************
+* MODULE : DeadReckoningInitDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table initialization function
+* FUNCTION : Delivery destination management table initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningInitDeliveryCtrlTbl(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&g_delivery_dr_ctrltbl, 0x00, sizeof(DEADRECKONING_DELIVERY_CTRL_TBL));
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningInitDeliveryCtrlTblMng
+* ABSTRACT : Vehicle sensor delivery destination management table management area initialization function
+* FUNCTION : Delivery destination management table management area initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningInitDeliveryCtrlTblMng(void) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&g_delivery_dr_ctrltbl_mng, 0x00, sizeof(DEADRECKONING_DELIVERY_CTRL_TBL_MNG));
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningEntryDeliveryCtrl
+* ABSTRACT : Vehicle sensor delivery destination management registration function
+* FUNCTION : Shipping management table,Update the shipping management table management.
+* ARGUMENT : p_st_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : VEHICLE_RET_NORMAL :Successful registration
+******************************************************************************/
+DEAD_RECKONING_RET_API DeadReckoningEntryDeliveryCtrl(const DEADRECKONING_MSG_DELIVERY_ENTRY *p_st_delivery_entry) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i;
+ u_int8 uc_action_type = DEADRECKONING_ACTION_TYPE_ADD;
+ int32 uc_did_flag;
+ DID ul_entry_did = p_st_delivery_entry->data.did;
+ DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *p_st_existing_mng_data = NULL;
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ DEAD_RECKONING_RET_API ret = DEAD_RECKONING_RET_NORMAL;
+
+ /* Check if the data ID exists. */
+ uc_did_flag = DeadReckoningCheckDid(ul_entry_did);
+ if (uc_did_flag == 0) {
+ ret = DEADRECKONING_RET_ERROR_DID; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Check the number of registered shipments. */
+ if ((ret == DEAD_RECKONING_RET_NORMAL) &&/* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (g_delivery_dr_ctrltbl.us_num >= DEADRECKONING_DELIVERY_INFO_MAX)) {
+ /* Return the FULL of delivery registrations*/
+ ret = DEADRECKONING_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ if (ret == DEAD_RECKONING_RET_NORMAL) {
+ /* By searching for the delivery registration of the relevant DID,Hold the address. */
+ for (i = 0; i < g_delivery_dr_ctrltbl_mng.us_num; i++) {
+ if (g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[i].ul_did == ul_entry_did) {
+ uc_action_type = DEADRECKONING_ACTION_TYPE_UPDATE;
+ p_st_existing_mng_data = &g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[i];
+ }
+ }
+
+ /* Add to the shipping management table.*/
+ DeadReckoningAddDeliveryCtrlTbl(p_st_delivery_entry);
+
+ /* Processing when updating existing data*/
+ if (uc_action_type == DEADRECKONING_ACTION_TYPE_UPDATE) {
+ /* Update the shipping management table.*/
+ DeadReckoningUpdateDeliveryCtrlTbl(p_st_existing_mng_data);
+
+ /* Update the shipping destination management table management information.*/
+ DeadReckoningUpdateDeliveryCtrlTblMng(p_st_existing_mng_data);
+ } else { /* Newly added processing*/
+ /* Add to the shipping management table management information.*/
+ DeadReckoningAddDeliveryCtrlTblMng(p_st_delivery_entry);
+ }
+ }
+ return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningAddDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table addition function
+* FUNCTION : Add to the shipping management table.
+* ARGUMENT : *p_st_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningAddDeliveryCtrlTbl(const DEADRECKONING_MSG_DELIVERY_ENTRY *p_st_delivery_entry) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEADRECKONING_DELIVERY_CTRL_TBL_DATA *p_st_ctrl_data;
+
+ p_st_ctrl_data = &g_delivery_dr_ctrltbl.st_ctrl_data[g_delivery_dr_ctrltbl.us_num];
+ p_st_ctrl_data->ul_did = p_st_delivery_entry->data.did;
+ p_st_ctrl_data->us_pno = p_st_delivery_entry->data.pno;
+ p_st_ctrl_data->uc_chg_type = p_st_delivery_entry->data.delivery_timing;
+ p_st_ctrl_data->uc_ctrl_flg = p_st_delivery_entry->data.ctrl_flg;
+ p_st_ctrl_data->us_link_idx = DEADRECKONING_LINK_INDEX_END;
+ p_st_ctrl_data->uc_method = DEADRECKONING_DELIVERY_METHOD_NORMAL;
+
+ g_delivery_dr_ctrltbl.us_num = static_cast<u_int16>(g_delivery_dr_ctrltbl.us_num + 1);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningUpdateDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table update function
+* FUNCTION : Update the shipping management table.
+* ARGUMENT : *p_st_existing_mng_data : Pointer to the previous data information with the same data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningUpdateDeliveryCtrlTbl(DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *p_st_existing_mng_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Update Link Index Only.
+ For the index of the value of us_end_idx that matches the data ID of the distribution target management table management information
+ Make us_link_idx a registered index */
+ g_delivery_dr_ctrltbl.st_ctrl_data[p_st_existing_mng_data->us_end_idx].us_link_idx =
+ static_cast<u_int16>(g_delivery_dr_ctrltbl.us_num - 1);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningAddDeliveryCtrlTblMng
+* ABSTRACT : Vehicle sensor delivery destination management table management addition function
+* FUNCTION : Add to the shipping management table management.
+* ARGUMENT : *p_st_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningAddDeliveryCtrlTblMng(const DEADRECKONING_MSG_DELIVERY_ENTRY *p_st_delivery_entry) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *p_st_ctr_mng_data;
+
+ p_st_ctr_mng_data = &g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[g_delivery_dr_ctrltbl_mng.us_num];
+ p_st_ctr_mng_data->ul_did = p_st_delivery_entry->data.did;
+ p_st_ctr_mng_data->us_start_idx = static_cast<u_int16>(g_delivery_dr_ctrltbl.us_num - 1);
+ p_st_ctr_mng_data->us_end_idx = static_cast<u_int16>(g_delivery_dr_ctrltbl.us_num - 1);
+ p_st_ctr_mng_data->us_dlvry_entry_num++;
+ g_delivery_dr_ctrltbl_mng.us_num++;
+ g_delivery_dr_ctrl_num++;
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningUpdateDeliveryCtrlTblMng
+* ABSTRACT : Vehicle sensor delivery destination management table management update function
+* FUNCTION : Update the shipping management table management.
+* ARGUMENT : *p_st_existing_mng_data : Pointer to the previous data information with the same data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningUpdateDeliveryCtrlTblMng(DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *p_st_existing_mng_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Update only the end index and the number of registered shipping destinations. */
+ p_st_existing_mng_data->us_end_idx = static_cast<u_int16>(g_delivery_dr_ctrltbl.us_num - 1);
+ p_st_existing_mng_data->us_dlvry_entry_num++;
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningMakeDeliveryPnoTbl
+* ABSTRACT : Vehicle sensor delivery destination PNO table creation function
+* FUNCTION : Create the shipping destination PNO table
+* ARGUMENT : ul_did Data ID
+* Change_type Delivery Trigger
+* NOTE :
+* RETURN : DEADRECKONING_DELIVERY_PNO_TBL* Pointer to the shipping PNO table
+******************************************************************************/
+DEADRECKONING_DELIVERY_PNO_TBL* DeadReckoningMakeDeliveryPnoTbl(DID ul_did, u_int8 change_type) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i;
+ u_int16 us_index = 0;
+ u_int16 us_num = 0;
+
+ /* Get the start index and count of the corresponding data ID. */
+ for (i = 0; i < g_delivery_dr_ctrl_num; i++) {
+ /* Stores the information of the corresponding DID.. */
+ if (g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[i].ul_did == ul_did) {
+ us_index = g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[i].us_start_idx;
+ us_num = g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[i].us_dlvry_entry_num;
+ break;
+ }
+ }
+
+ /* Create a PNO list */
+ g_delivery_dr_pnotbl.us_num = 0;
+ if (change_type == DEADRECKONING_CHGTYPE_CHG) {
+ /* Processing when delivery timing is changed*/
+ for (i = 0; i < us_num; i++) {
+ /* Functionalization by Increasing Structure Members */
+ DeadReckoningAddPnoTbl(us_index);
+
+ us_index = g_delivery_dr_ctrltbl.st_ctrl_data[us_index].us_link_idx;
+ }
+ } else {
+ /* Processing when delivery timing is update */
+ for (i = 0; i < us_num; i++) {
+ if (DEADRECKONING_DELIVERY_TIMING_UPDATE == g_delivery_dr_ctrltbl.st_ctrl_data[us_index].uc_chg_type) {
+ /* Functionalization by Increasing Structure Members */
+ DeadReckoningAddPnoTbl(us_index);
+ }
+ us_index = g_delivery_dr_ctrltbl.st_ctrl_data[us_index].us_link_idx;
+ }
+ }
+ return (&g_delivery_dr_pnotbl);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningAddPnoTbl
+* ABSTRACT : Vehicle Sensor Destination PNO Table Addition Function
+* FUNCTION : Add to the shipping PNO table.
+* ARGUMENT : us_index : Index of the referenced destination management table
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningAddPnoTbl(u_int16 us_index) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int16 us_pno_tbl_idx;
+
+ us_pno_tbl_idx = g_delivery_dr_pnotbl.us_num;
+ g_delivery_dr_pnotbl.st_pno_data[us_pno_tbl_idx].us_pno = g_delivery_dr_ctrltbl.st_ctrl_data[us_index].us_pno;
+ /* Save the relevant INDEX in the delivery control table */
+ g_delivery_dr_pnotbl.st_pno_data[us_pno_tbl_idx].us_index = us_index;
+ g_delivery_dr_pnotbl.st_pno_data[us_pno_tbl_idx].uc_method =
+ g_delivery_dr_ctrltbl.st_ctrl_data[us_index].uc_method;
+ g_delivery_dr_pnotbl.us_num++;
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningDeliveryProc
+* ABSTRACT : Vehicle Sensor Data Delivery Process
+* FUNCTION : Deliver data to a destination.
+* ARGUMENT : ul_did :Data ID
+* uc_chg_type :Delivery timing
+* uc_get_method :Acquisition method
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningDeliveryProc(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i; /* Generic counters */
+ DEADRECKONING_DATA_MASTER st_master; /* Data master of normal data */
+
+
+ /* Defines the data master for each API. */
+ SENSORLOCATION_MSG_LONLATINFO_DAT st_msg_lonlat_info;
+ SENSORLOCATION_MSG_ALTITUDEINFO_DAT st_msg_altitude_info;
+ SENSORMOTION_MSG_SPEEDINFO_DAT st_msg_speed_info;
+ SENSORMOTION_MSG_HEADINGINFO_DAT st_msg_heading_info;
+
+
+ const DEADRECKONING_DELIVERY_PNO_TBL *p_st_pno_tbl; /* Vehicle Sensor Destination PNO Table Pointer */
+
+ /* Initialization */
+ st_msg_lonlat_info.reserve[0] = 0;
+ st_msg_lonlat_info.reserve[1] = 0;
+ st_msg_lonlat_info.reserve[2] = 0;
+ st_msg_altitude_info.reserve[0] = 0;
+ st_msg_altitude_info.reserve[1] = 0;
+ st_msg_altitude_info.reserve[2] = 0;
+ st_msg_speed_info.reserve = 0;
+ st_msg_heading_info.reserve = 0;
+
+ /* Obtain the shipping destination PNO */
+ p_st_pno_tbl =
+ reinterpret_cast<DEADRECKONING_DELIVERY_PNO_TBL*>(DeadReckoningMakeDeliveryPnoTbl(ul_did, uc_chg_type));
+
+ if ((p_st_pno_tbl->us_num) > 0) {
+ /* When there is a shipping destination PNO registration */
+ /* Vehicle sensor information notification transmission process */
+ for (i = 0; i < (p_st_pno_tbl->us_num); i++) {
+ /* Acquire the applicable data information from the data master..*/
+ DeadReckoningGetDataMaster(ul_did, &st_master);
+
+ /* Align data from the data master for API I/F */
+ switch (ul_did) {
+ /* Describes the process for each DID. */
+ case VEHICLE_DID_DR_LATITUDE:
+ {
+ /* Size storage(LONLAT) */
+ st_msg_lonlat_info.size = (u_int16)sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT);
+
+ /* DR status setting */
+ st_msg_lonlat_info.dr_status = st_master.dr_status;
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_lonlat_info.is_exist_dr = SENSORLOCATION_EXISTDR_DR;
+
+ /* Set the Latitude */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_lonlat_info.latitude)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Obtain the data master Longitude */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_LONGITUDE, &st_master);
+
+ /* Set the Longitude */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_lonlat_info.longitude)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+
+ /* Set the SensorCnt */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_lonlat_info.sensor_cnt)),
+ (const void *)(&( st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORLOCATION_LONLAT,
+ sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT),
+ (const void *)&st_msg_lonlat_info);
+ break;
+ }
+ case VEHICLE_DID_DR_ALTITUDE:
+ {
+ /* Size storage(ALTITUDE) */
+ st_msg_altitude_info.size = (u_int16)sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_altitude_info.is_exist_dr = SENSORLOCATION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_altitude_info.dr_status = st_master.dr_status;
+
+
+ /* Set the Altitude */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_altitude_info.altitude)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+
+ /* Set the SensorCnt */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_altitude_info.sensor_cnt)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORLOCATION_ALTITUDE,
+ sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT),
+ (const void *)&st_msg_altitude_info);
+
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED:
+ {
+ /* Size storage(SPEED) */
+ st_msg_speed_info.size = (u_int16)sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_speed_info.is_exist_dr = SENSORMOTION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_speed_info.dr_status = st_master.dr_status;
+
+
+ /* Set the Speed */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_speed_info.speed)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+ /* Set the SensorCnt */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_speed_info.sensor_cnt)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORMOTION_SPEED,
+ sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT),
+ (const void *)&st_msg_speed_info);
+ break;
+ }
+ case VEHICLE_DID_DR_HEADING:
+ {
+ /* Size storage(HEADING) */
+ st_msg_heading_info.size = (u_int16)sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_heading_info.is_exist_dr = SENSORMOTION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_heading_info.dr_status = st_master.dr_status;
+
+ /* Set the Heading */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_heading_info.heading)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+ /* Set the SensorCnt */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_heading_info.sensor_cnt)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORMOTION_HEADING,
+ sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT),
+ (const void *)&st_msg_heading_info);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL:
+ {
+ SENSORMOTION_MSG_GYROPARAMETERINFO_DAT stMsgGyroParameterInfo;
+ /* Initialization */
+ stMsgGyroParameterInfo.reserve[0] = 0;
+ stMsgGyroParameterInfo.reserve[1] = 0;
+
+ /* GyroOffset/GyroScaleFactor/GyroScaleFactorLevel data master */
+ /* setup must be completed before data delivery of this DID */
+ /* The order of processing is defined by DeadReckoning_RcvMsg().,Be careful when changing */
+
+ /* Size storage(GYROPARAMETER) */
+ stMsgGyroParameterInfo.size = (u_int16)sizeof(stMsgGyroParameterInfo);
+
+ /* GyroOffset acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_OFFSET, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_offset)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgGyroParameterInfo.gyro_offset));
+
+ /* GyroScaleFactor acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_SCALE_FACTOR, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_scale_factor)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgGyroParameterInfo.gyro_scale_factor));
+
+ /* GyroScaleFactorLevel acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_scale_factor_level)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgGyroParameterInfo.gyro_scale_factor_level));
+
+ /* Data transmission */
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORMOTION_GYROPARAMETER,
+ sizeof(stMsgGyroParameterInfo),
+ (const void *)&stMsgGyroParameterInfo);
+ }
+ break;
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL:
+ {
+ SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT stMsgSpeedPulseParameterInfo;
+
+ /* Initialization */
+ stMsgSpeedPulseParameterInfo.reserve[0] = 0;
+ stMsgSpeedPulseParameterInfo.reserve[1] = 0;
+ stMsgSpeedPulseParameterInfo.reserve[2] = 0;
+
+ /* GyroOffset/GyroScaleFactor/GyroScaleFactorLevel data master */
+ /* setup must be completed before data delivery of this DID */
+ /* The order of processing is defined by DeadReckoning_RcvMsg().,Be careful when changing */
+
+ /* Size storage(SPEEDPULSEPARAMETER) */
+ stMsgSpeedPulseParameterInfo.size = (u_int16)sizeof(stMsgSpeedPulseParameterInfo);
+
+ /* SpeedPulseScaleFactor acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor));
+
+ /* SpeedPulseScaleFactorLevel acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor_level)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor_level));
+
+ /* Data transmission */
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORMOTION_SPEEDPULSEPARAMETER,
+ sizeof(stMsgSpeedPulseParameterInfo),
+ (const void *)&stMsgSpeedPulseParameterInfo);
+ }
+ break;
+ /* Other than the above */
+ default:
+ /* Do not edit. */
+ break;
+ }
+ }
+ }
+}
+
+/*******************************************************************************
+ * MODULE : DRManagerSndMsg
+ * ABSTRACT : Message transmission processing
+ * FUNCTION : Send a message to the specified PNO
+ * ARGUMENT : us_pno_src : Source PNO
+ * : us_pno_dest : Destination PNO
+ * : us_cid : Command ID
+ * : us_msg_len : Message data body length
+ * : *p_msg_data : Pointer to message data
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERRNOTRDY : Destination process is not wakeup
+ * : RET_ERRMSGFULL : Message queue overflows
+ * : RET_ERRPARAM : Buffer size error
+ ******************************************************************************/
+RET_API DRManagerSndMsg(PNO us_pno_src, PNO us_pno_dest, CID us_cid, u_int16 us_msg_len, const void *p_msg_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEADRECKONING_MSG_BUF st_msg_buf; /* message buffer */
+ T_APIMSG_MSGBUF_HEADER *p_st_msg_hdr; /* Pointer to the message header */
+ RET_API l_ret_api; /* Return value */
+
+ /* Message buffer initialization */
+ memset(reinterpret_cast<void *>(&st_msg_buf), 0, sizeof(DEADRECKONING_MSG_BUF));
+
+ /* Get pointer to send buffer */
+ p_st_msg_hdr = reinterpret_cast<T_APIMSG_MSGBUF_HEADER *>(reinterpret_cast<void *>(&st_msg_buf));
+
+ /*--------------------------------------------------------------*
+ * Create message headers *
+ *--------------------------------------------------------------*/
+ p_st_msg_hdr->hdr.sndpno = us_pno_src; /* Source PNO */
+ p_st_msg_hdr->hdr.cid = us_cid; /* Command ID */
+ p_st_msg_hdr->hdr.msgbodysize = us_msg_len; /* Message data body length */
+
+ /*--------------------------------------------------------------*
+ * Create message data *
+ *--------------------------------------------------------------*/
+ if ((0 != p_msg_data) && (0 != us_msg_len)) {
+ /* Set the message data */
+ memcpy(reinterpret_cast<void *>(st_msg_buf.data), p_msg_data, (size_t)us_msg_len);
+ }
+ /*--------------------------------------------------------------*
+ * Send messages *
+ *--------------------------------------------------------------*/
+ l_ret_api = _pb_SndMsg(us_pno_dest,
+ (u_int16)(sizeof(T_APIMSG_MSGBUF_HEADER) + us_msg_len),
+ reinterpret_cast<void *>(&st_msg_buf),
+ 0);
+ return (l_ret_api);
+}
+
+
+/*******************************************************************************
+* MODULE : DeadReckoningFirstDelivery
+* ABSTRACT : Vehicle Sensor Initial Data Delivery Process
+* FUNCTION : Deliver the initial data to the destination.
+* ARGUMENT : us_pno :Addresses for delivery NO
+* ul_did :Data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningFirstDelivery(PNO us_pno, DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEADRECKONING_DATA_MASTER st_master; /* Data master of normal data */
+
+ /* Defines the data master for each API. */
+ SENSORLOCATION_MSG_LONLATINFO_DAT st_msg_lonlat_info;
+ SENSORLOCATION_MSG_ALTITUDEINFO_DAT st_msg_altitude_info;
+ SENSORMOTION_MSG_SPEEDINFO_DAT st_msg_speed_info;
+ SENSORMOTION_MSG_HEADINGINFO_DAT st_msg_heading_info;
+
+ /* Initialization */
+ st_msg_lonlat_info.reserve[0] = 0;
+ st_msg_lonlat_info.reserve[1] = 0;
+ st_msg_lonlat_info.reserve[2] = 0;
+ st_msg_altitude_info.reserve[0] = 0;
+ st_msg_altitude_info.reserve[1] = 0;
+ st_msg_altitude_info.reserve[2] = 0;
+ st_msg_speed_info.reserve = 0;
+ st_msg_heading_info.reserve = 0;
+
+ /* Align data from the data master for API I/F */
+ switch (ul_did) {
+ /* Describes the process for each DID. */
+ case VEHICLE_DID_DR_LATITUDE:
+ {
+ DeadReckoningGetDataMaster(ul_did, &st_master);
+
+ /* Size storage(LONLAT) */
+ st_msg_lonlat_info.size = (u_int16)sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT);
+
+ /* DR status setting */
+ st_msg_lonlat_info.dr_status = st_master.dr_status;
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_lonlat_info.is_exist_dr = SENSORLOCATION_EXISTDR_DR;
+
+ /* Set the Latitude */
+ memcpy(&(st_msg_lonlat_info.latitude), &(st_master.uc_data[0]), st_master.us_size);
+
+ /* Obtain the data master Longitude */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_LONGITUDE, &st_master);
+
+ /* Set the Longitude */
+ memcpy(&(st_msg_lonlat_info.longitude), &(st_master.uc_data[0]), st_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+
+ /* Set the SensorCnt */
+ memcpy(&(st_msg_lonlat_info.sensor_cnt), &(st_master.uc_data[0]), st_master.us_size);
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORLOCATION_LONLAT,
+ sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT),
+ (const void *)&st_msg_lonlat_info);
+ break;
+ }
+ case VEHICLE_DID_DR_ALTITUDE:
+ {
+ DeadReckoningGetDataMaster(ul_did, &st_master);
+
+ /* Size storage(ALTITUDE) */
+ st_msg_altitude_info.size = (u_int16)sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_altitude_info.is_exist_dr = SENSORLOCATION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_altitude_info.dr_status = st_master.dr_status;
+
+
+ /* Set the Altitude */
+ memcpy(&(st_msg_altitude_info.altitude), &(st_master.uc_data[0]), st_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+
+ /* Set the SensorCnt */
+ memcpy(&(st_msg_altitude_info.sensor_cnt), &(st_master.uc_data[0]), st_master.us_size);
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORLOCATION_ALTITUDE,
+ sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT),
+ (const void *)&st_msg_altitude_info);
+
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED:
+ {
+ DeadReckoningGetDataMaster(ul_did, &st_master);
+
+ /* Size storage(SPEED) */
+ st_msg_speed_info.size = (u_int16)sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_speed_info.is_exist_dr = SENSORMOTION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_speed_info.dr_status = st_master.dr_status;
+
+
+ /* Set the Speed */
+ memcpy(&(st_msg_speed_info.speed), &(st_master.uc_data[0]), st_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+ /* Set the SensorCnt */
+ memcpy(&(st_msg_speed_info.sensor_cnt), &(st_master.uc_data[0]), st_master.us_size);
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORMOTION_SPEED,
+ sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT),
+ (const void *)&st_msg_speed_info);
+ break;
+ }
+ case VEHICLE_DID_DR_HEADING:
+ {
+ DeadReckoningGetDataMaster(ul_did, &st_master);
+
+ /* Size storage(HEADING) */
+ st_msg_heading_info.size = (u_int16)sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_heading_info.is_exist_dr = SENSORMOTION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_heading_info.dr_status = st_master.dr_status;
+
+
+ /* Set the Heading */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_heading_info.heading)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+ /* Set the SensorCnt */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_heading_info.sensor_cnt)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORMOTION_HEADING,
+ sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT),
+ (const void *)&st_msg_heading_info);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL:
+ {
+ SENSORMOTION_MSG_GYROPARAMETERINFO_DAT stMsgGyroParameterInfo;
+
+ /* Initialization */
+ stMsgGyroParameterInfo.reserve[0] = 0;
+ stMsgGyroParameterInfo.reserve[1] = 0;
+
+ /* Size storage(GYROPARAMETER) */
+ stMsgGyroParameterInfo.size = (u_int16)sizeof(stMsgGyroParameterInfo);
+
+ /* GyroOffset acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_OFFSET, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_offset)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof( stMsgGyroParameterInfo.gyro_offset));
+
+ /* GyroScaleFactor acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_SCALE_FACTOR, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_scale_factor)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgGyroParameterInfo.gyro_scale_factor));
+
+ /* GyroScaleFactorLevel acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_scale_factor_level)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgGyroParameterInfo.gyro_scale_factor_level));
+
+ /* Data transmission */
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORMOTION_GYROPARAMETER,
+ sizeof(stMsgGyroParameterInfo),
+ (const void *)&stMsgGyroParameterInfo);
+ }
+ break;
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL:
+ {
+ SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT stMsgSpeedPulseParameterInfo;
+
+ /* Initialization */
+ stMsgSpeedPulseParameterInfo.reserve[0] = 0;
+ stMsgSpeedPulseParameterInfo.reserve[1] = 0;
+ stMsgSpeedPulseParameterInfo.reserve[2] = 0;
+
+ /* Size storage(SPEEDPULSEPARAMETER) */
+ stMsgSpeedPulseParameterInfo.size = (u_int16)sizeof(stMsgSpeedPulseParameterInfo);
+
+ /* SpeedPulseScaleFactor acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor));
+
+ /* SpeedPulseScaleFactorLevel acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor_level)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor_level));
+
+ /* Data transmission */
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORMOTION_SPEEDPULSEPARAMETER,
+ sizeof(stMsgSpeedPulseParameterInfo),
+ (const void *)&stMsgSpeedPulseParameterInfo);
+ }
+ break;
+ /* Other than the above */
+ default:
+ /* Do not edit. */
+ break;
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Altitude_dr.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Altitude_dr.cpp
new file mode 100755
index 0000000..acd5f6d
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Altitude_dr.cpp
@@ -0,0 +1,106 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file DeadReckoning_Did_Altitude.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_ALTITUDE)<BR>
+ DeadReckoning data master(VEHICLE_DID_DR_ALTITUDE)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_altitude; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief Altitude Dead Reckoning initialization function
+@outline Altitude initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitAltitudeDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_altitude), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_altitude.ul_did = VEHICLE_DID_DR_ALTITUDE;
+ gst_altitude.us_size = VEHICLE_DSIZE_ALTITUDE;
+ gst_altitude.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_altitude.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
+ gst_altitude.uc_data[0] = VEHICLE_DINIT_ALTITUDE;
+}
+
+/***********************************************************************
+@brief Altitude Dead Reckoning SET function
+@outline To update the master data Altitude.
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetAltitudeDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_altitude;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief Altitude Dead Reckoning GET function
+@outline Master Data provides the Altitude
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetAltitudeDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_altitude;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroOffset_dr.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroOffset_dr.cpp
new file mode 100755
index 0000000..f295f8d
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroOffset_dr.cpp
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file DeadReckoning_Did_GyroScaleFactor_dr.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_GYRO_OFFSET)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_gyrooffset; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief GyroOffset initialization function
+@outline GyroOffset initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitGyroOffsetDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void)memset(reinterpret_cast<void *>(&gst_gyrooffset), 0x00, sizeof(gst_gyrooffset));
+ gst_gyrooffset.ul_did = VEHICLE_DID_DR_GYRO_OFFSET;
+ gst_gyrooffset.us_size = VEHICLE_DSIZE_GYRO_OFFSET;
+ gst_gyrooffset.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_gyrooffset.dr_status = 0U; /* Not used */
+}
+
+/************************************************************************
+@brief GyroOffset SET function
+@outline To update the master data GyroOffset
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetGyroOffsetDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = DEADRECKONING_EQ;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyrooffset;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), (size_t)(p_st_data->us_size));
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = 0U; /* Not used */
+
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data) ), sizeof(p_st_master->uc_data));
+ }
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief GyroOffset GET function
+@outline Master Data provides the GyroOffset
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetGyroOffsetDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyrooffset;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
+ (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp
new file mode 100755
index 0000000..dff0913
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_gyroscalefactor_level; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief GyroScaleFactorLevel initialization function
+@outline GyroScaleFactorLevel initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitGyroScaleFactorLevelDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void)memset(reinterpret_cast<void *>(&gst_gyroscalefactor_level), 0x00, sizeof(gst_gyroscalefactor_level));
+ gst_gyroscalefactor_level.ul_did = VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL;
+ gst_gyroscalefactor_level.us_size = VEHICLE_DSIZE_GYRO_SCALE_FACTOR_LEVEL;
+ gst_gyroscalefactor_level.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_gyroscalefactor_level.dr_status = 0U; /* Not used */
+}
+
+/*************************************************************************
+@brief GyroScaleFactorLevel SET function
+@outline To update the master data GyroScaleFactorLevel
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes<BR>
+@retval DEADRECKONING_NEQ : With data changes<BR>
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetGyroScaleFactorLevelDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = DEADRECKONING_EQ;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyroscalefactor_level;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)( &(p_st_data->uc_data)), (size_t)(p_st_data->us_size));
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = 0U; /* Not used */
+
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), sizeof(p_st_master->uc_data));
+ }
+
+ return (uc_ret);
+}
+
+/*************************************************************************
+@brief GyroScaleFactorLevel GET function
+@outline Master Data provides the GyroScaleFactorLevel
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetGyroScaleFactorLevelDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyroscalefactor_level;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
+ (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactor_dr.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactor_dr.cpp
new file mode 100755
index 0000000..d05ef5c
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactor_dr.cpp
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+@file DeadReckoning_Did_GyroScaleFactor_dr.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_GYRO_SCALE_FACTOR)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_gyroscalefactor; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief GyroScaleFactor initialization function
+@outline GyroScaleFactor initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitGyroScaleFactorDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void)memset(reinterpret_cast<void *>(&gst_gyroscalefactor), 0x00, sizeof(gst_gyroscalefactor));
+ gst_gyroscalefactor.ul_did = VEHICLE_DID_DR_GYRO_SCALE_FACTOR;
+ gst_gyroscalefactor.us_size = VEHICLE_DSIZE_GYRO_SCALE_FACTOR;
+ gst_gyroscalefactor.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_gyroscalefactor.dr_status = 0U; /* Not used */
+}
+
+/************************************************************************
+@brief GyroScaleFactor SET function
+@outline To update the master data GyroScaleFactor
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetGyroScaleFactorDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = DEADRECKONING_EQ;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyroscalefactor;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), (size_t)(p_st_data->us_size));
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = 0U; /* Not used */
+
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data) ), sizeof(p_st_master->uc_data));
+ }
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief GyroScaleFactor GET function
+@outline Master Data provides the GyroScaleFactor
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetGyroScaleFactorDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyroscalefactor;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
+ (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Heading_dr.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Heading_dr.cpp
new file mode 100755
index 0000000..451b133
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Heading_dr.cpp
@@ -0,0 +1,106 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+@file DeadReckoning_Did_Heading.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_HEADING)<BR>
+ DeadReckoning data master(VEHICLE_DID_DR_HEADING)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_heading; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief Heading Dead Reckoning initialization function
+@outline Heading initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitHeadingDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_heading), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_heading.ul_did = VEHICLE_DID_DR_HEADING;
+ gst_heading.us_size = VEHICLE_DSIZE_HEADING;
+ gst_heading.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_heading.dr_status = SENSORMOTION_DRSTATUS_INVALID;
+ gst_heading.uc_data[0] = VEHICLE_DINIT_HEADING;
+}
+
+/*************************************************************************
+@brief Heading Dead Reckoning SET function
+@outline To update the master data Heading.
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetHeadingDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_heading;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief Heading Dead Reckoning GET function
+@outline Master Data provides the Heading
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetHeadingDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_heading;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Latitude_dr.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Latitude_dr.cpp
new file mode 100755
index 0000000..9d06e7a
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Latitude_dr.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+@file DeadReckoning_Did_Latitude.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_LATITUDE)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_latitude; // NOLINT(readability/nolint)
+
+/***********************************************************************
+@brief Latitude Dead Reckoning initialization function
+@outline Latitude initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitLatitudeDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_latitude), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_latitude.ul_did = VEHICLE_DID_DR_LATITUDE;
+ gst_latitude.us_size = VEHICLE_DSIZE_LATITUDE;
+ gst_latitude.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_latitude.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
+ gst_latitude.uc_data[0] = VEHICLE_DINIT_LATITUDE;
+}
+
+/************************************************************************
+@brief Latitude Dead Reckoning SET function
+@outline To update the master data Latitude.
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetLatitudeDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_latitude;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief Latitude Dead Reckoning GET function
+@outline Master Data provides the Latitude
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetLatitudeDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_latitude;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Longitude_dr.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Longitude_dr.cpp
new file mode 100755
index 0000000..38a6351
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Longitude_dr.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+@file DeadReckoning_Did_Longitude.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_LONGITUDE)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_longitude; // NOLINT(readability/nolint)
+
+/***********************************************************************
+@brief Longitude Dead Reckoning initialization function
+@outline Longitude initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitLongitudeDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_longitude), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_longitude.ul_did = VEHICLE_DID_DR_LONGITUDE;
+ gst_longitude.us_size = VEHICLE_DSIZE_LONGITUDE;
+ gst_longitude.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_longitude.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
+ gst_longitude.uc_data[0] = VEHICLE_DINIT_LONGITUDE;
+}
+
+/************************************************************************
+@brief Longitude Dead Reckoning SET function
+@outline To update the master data Longitude.
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetLongitudeDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_longitude;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief Longitude Dead Reckoning GET function
+@outline Master Data provides the Longitude
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetLongitudeDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_longitude;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SnsCounter.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SnsCounter.cpp
new file mode 100755
index 0000000..6bf3ed7
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SnsCounter.cpp
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :DeadReckoning_Did_SnsCounter.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_SNS_COUNTER)
+ * Module configuration :DeadReckoningInitSnsCounterDr() Vehicle sensor SNS_COUNTER initialization function
+ * :DeadReckoningSetSnsCounterDr() Vehicle sensor SNS_COUNTER SET function
+ * :DeadReckoningGetSnsCounterDr() Vehicle sensor SNS_COUNTER GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_snscounter_dr; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : DeadReckoningInitSnsCounterDr
+* ABSTRACT : Vehicle sensor SNS_COUNTER initialization function
+* FUNCTION : SNS_COUNTER data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningInitSnsCounterDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_snscounter_dr), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_snscounter_dr.ul_did = VEHICLE_DID_DR_SNS_COUNTER;
+ gst_snscounter_dr.us_size = VEHICLE_DSIZE_DR_SNS_COUNTER;
+ gst_snscounter_dr.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_snscounter_dr.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
+ gst_snscounter_dr.uc_data[0] = VEHICLE_DINIT_DR_SNS_COUNTER;
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningSetSnsCounterDr
+* ABSTRACT : Vehicle sensor SNS_COUNTER SET function
+* FUNCTION : Update the SNS_COUNTER data master
+* ARGUMENT : *p_st_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 DeadReckoningSetSnsCounterDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_snscounter_dr;
+
+ /* Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /* Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningGetSnsCounterDr
+* ABSTRACT : Vehicle sensor SNS_COUNTER GET function
+* FUNCTION : Provide the SNS_COUNTER data master
+* ARGUMENT : *p_st_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningGetSnsCounterDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_snscounter_dr;
+
+ /* Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp
new file mode 100755
index 0000000..dc7022f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+@file DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_speedpulsescalefactor_level; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief SpeedPulseScaleFactorLevel initialization function
+@outline SpeedPulseScaleFactorLevel initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitSpeedPulseScaleFactorLevelDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void)memset(reinterpret_cast<void *>(&gst_speedpulsescalefactor_level), 0x00,
+ sizeof(gst_speedpulsescalefactor_level));
+ gst_speedpulsescalefactor_level.ul_did = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL;
+ gst_speedpulsescalefactor_level.us_size = VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR_LEVEL;
+ gst_speedpulsescalefactor_level.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_speedpulsescalefactor_level.dr_status = 0U; /* Not used */
+}
+
+/************************************************************************
+@brief SpeedPulseScaleFactorLevel SET function
+@outline To update the master data SpeedPulseScaleFactorLevel
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetSpeedPulseScaleFactorLevelDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = DEADRECKONING_EQ;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_speedpulsescalefactor_level;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), (size_t)(p_st_data->us_size));
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = 0U; /* Not used */
+
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), sizeof(p_st_master->uc_data));
+ }
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief SpeedPulseScaleFactorLevel GET function
+@outline Master Data provides the SpeedPulseScaleFactorLevel
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetSpeedPulseScaleFactorLevelDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_speedpulsescalefactor_level;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
+ (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp
new file mode 100755
index 0000000..cd27141
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_speedpulsescalefactor; // NOLINT(readability/nolint)
+
+/***********************************************************************
+@brief SpeedPulseScaleFactor initialization function
+@outline SpeedPulseScaleFactor initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitSpeedPulseScaleFactorDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void)memset(reinterpret_cast<void *>(&gst_speedpulsescalefactor), 0x00, sizeof(gst_speedpulsescalefactor));
+ gst_speedpulsescalefactor.ul_did = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR;
+ gst_speedpulsescalefactor.us_size = VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR;
+ gst_speedpulsescalefactor.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_speedpulsescalefactor.dr_status = 0U; /* Not used */
+}
+
+/*************************************************************************
+@brief SpeedPulseScaleFactor SET function
+@outline To update the master data SpeedPulseScaleFactor
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetSpeedPulseScaleFactorDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = DEADRECKONING_EQ;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_speedpulsescalefactor;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data) ), (size_t)(p_st_data->us_size));
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = 0U; /* Not used */
+
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), sizeof(p_st_master->uc_data));
+ }
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief SpeedPulseScaleFactor GET function
+@outline Master Data provides the SpeedPulseScaleFactor
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetSpeedPulseScaleFactorDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_speedpulsescalefactor;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
+ (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Speed_dr.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Speed_dr.cpp
new file mode 100755
index 0000000..b2b1f88
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Speed_dr.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file DeadReckoning_Did_Speed.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_SPEED)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_speed; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief Speed Dead Reckoning initialization function
+@outline Speed initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitSpeedDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_speed), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_speed.ul_did = VEHICLE_DID_DR_SPEED;
+ gst_speed.us_size = VEHICLE_DSIZE_SPEED;
+ gst_speed.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_speed.dr_status = SENSORMOTION_DRSTATUS_INVALID;
+ gst_speed.uc_data[0] = VEHICLE_DINIT_SPEED;
+}
+
+/************************************************************************
+@brief Speed Dead Reckoning SET function
+@outline To update the master data Speed.
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetSpeedDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_speed;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/*************************************************************************
+@brief Speed Dead Reckoning GET function
+@outline Master Data provides the Speed
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetSpeedDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_speed;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/DeadReckoning_main.cpp b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_main.cpp
new file mode 100755
index 0000000..1d956b7
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/DeadReckoning_main.cpp
@@ -0,0 +1,1086 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :DeadReckoning_Main.cpp
+ * System name :_CWORD107_
+ * Subsystem name :DeadReckoning Mains
+ * Program name :DeadReckoning Mains
+ * Module configuration :DeadReckoningInit() Guessed navigation initialization processing
+ * :DeadReckoningRcvMsg() DR Component MSG Receive Processing
+ ******************************************************************************/
+
+#include <positioning_hal.h>
+
+#include "DeadReckoning_main.h"
+
+#include "Sensor_Common_API.h"
+#include "DeadReckoning_DataMaster.h"
+#include "Dead_Reckoning_Local_Api.h"
+
+#include "DeadReckoning_DbgLogSim.h"
+
+#include "POS_private.h"
+
+static RET_API DeadReckoningWriteSharedMemory(VEHICLEDEBUG_MSG_LOGINFO_DAT* loginfo);
+static void DeadReckoningSetEvent(PNO pno, RET_API ret);
+static void DeadReckoningLinkSharedMemory(char *shared_memory_name, void **share_addr);
+
+#define DEAD_RECKONING_MAIN_DEBUG 0
+#define DR_DEBUG 0
+#define DR_DEBUG_ENG_MODE 0
+
+/*************************************************/
+/* Constant */
+/*************************************************/
+
+#define DEAD_RECKONING_BUF_SIZE 7
+#define DR_MASK_WORD_L 0x00FF
+#define DR_MASK_WORD_U 0xFF00
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/* Data receive confirmation flag */
+BOOL g_gps_data_get_flg = FALSE;
+BOOL g_sens_data_get_flg = FALSE;
+BOOL g_fst_sens_data_get_flg = FALSE;
+
+/* Reception flag for each data */
+BOOL g_sens_data_get_sns_cnt_flg = FALSE;
+BOOL g_sens_data_get_gyro_x_flg = FALSE;
+BOOL g_sens_data_get_gyro_y_flg = FALSE;
+BOOL g_sens_data_get_gyro_z_flg = FALSE;
+BOOL g_sens_data_get_rev_flg = FALSE;
+BOOL g_sens_data_get_spdpulse_flg = FALSE;
+BOOL g_sens_data_get_spdpulse_chk_flg = FALSE;
+
+BOOL g_sens_data_get_gyro_x_fst_flg = FALSE;
+BOOL g_sens_data_get_gyro_y_fst_flg = FALSE;
+BOOL g_sens_data_get_gyro_z_fst_flg = FALSE;
+BOOL g_sens_data_get_rev_fst_flg = FALSE;
+BOOL g_sens_data_get_spdpulse_fst_flg = FALSE;
+BOOL g_sens_data_get_spdpulse_chk_fst_flg = FALSE;
+
+/* Receive data storage buffer */
+/* [0]:SNS_COUNTER [1]:REV [2]:SPEED_PULSE_FLAG [3]:SPEED_PULSE [4]:GYRO_X [5]:GYRO_Y [6]:GYRO_Z */
+DEAD_RECKONING_RCVDATA_SENSOR g_sns_buf[DEAD_RECKONING_BUF_SIZE];
+DEAD_RECKONING_SAVEDATA_SENSOR_FIRST g_fst_sns_buf;
+
+/*******************************************************************************
+ * MODULE : DeadReckoningInit
+ * ABSTRACT : Guessed navigation initialization processing
+ * FUNCTION : Initialize inferred navigation processing
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : RET_NORMAL :Success in initialization
+ * RET_ERROR :Master Clear failed
+ ******************************************************************************/
+int32 DeadReckoningInit(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL;
+}
+
+/*******************************************************************************
+ * MODULE : DeadReckoningRcvMsg
+ * ABSTRACT : DR Component MSG Receive Processing
+ * FUNCTION : Receive the DR component MSG
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void DeadReckoningRcvMsg(const DEAD_RECKONING_RCVDATA *msg, DEAD_RECKONING_LONLAT_INFO *location_info) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if ((msg == NULL) || (location_info == NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "msg == NULL\r\n");
+ } else {
+ const SENSOR_MSG_GPSDATA_DAT *rcv_gps_msg = NULL;
+ const VEHICLESENS_DATA_MASTER *rcv_sensor_msg = NULL;
+ const VEHICLESENS_DATA_MASTER_FST *rcv_sensor_msg_fst = NULL;
+
+ Struct_GpsData send_gps_msg;
+ Struct_SensData send_sensor_msg;
+
+ /* Initialization */
+ (void)memset(reinterpret_cast<void *>(&send_gps_msg), 0, sizeof(Struct_GpsData));
+ (void)memset(reinterpret_cast<void *>(&send_sensor_msg), 0, sizeof(Struct_SensData));
+
+ /* Flag is set to FALSE */
+ location_info->calc_called = static_cast<u_int8>(FALSE);
+ location_info->available = static_cast<u_int8>(FALSE);
+
+ if (CID_DEAD_RECKONING_GPS_DATA == msg->hdr.hdr.cid) {
+ rcv_gps_msg = (const SENSOR_MSG_GPSDATA_DAT *)(&(msg->data[0]));
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+
+ /* Receiving GPS Data for DR */
+ switch (rcv_gps_msg->ul_did) {
+ case VEHICLE_DID_GPS_UBLOX_NAV_POSLLH :
+ case VEHICLE_DID_GPS_UBLOX_NAV_STATUS :
+ case VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC :
+ case VEHICLE_DID_GPS_UBLOX_NAV_VELNED :
+ case VEHICLE_DID_GPS_UBLOX_NAV_DOP :
+ case VEHICLE_DID_GPS_UBLOX_NAV_SVINFO :
+ case VEHICLE_DID_GPS_UBLOX_NAV_CLOCK :
+ {
+ g_gps_data_get_flg = TRUE;
+ break;
+ }
+ default:
+ break;
+ }
+ } else if (CID_DEAD_RECKONING_SENS_DATA == msg->hdr.hdr.cid) {
+ rcv_sensor_msg = (const VEHICLESENS_DATA_MASTER *)(&(msg->data[0]));
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+
+ /* Sensor data reception for DR */
+ switch (rcv_sensor_msg->ul_did) {
+ case POSHAL_DID_SNS_COUNTER :
+ {
+ g_sns_buf[0].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[0].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ g_sns_buf[0].data[0] = rcv_sensor_msg->uc_data[0];
+ g_sens_data_get_sns_cnt_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_REV :
+ {
+ g_sns_buf[1].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[1].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[1].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_rev_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FLAG :
+ {
+ g_sns_buf[2].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[2].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[2].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_spdpulse_chk_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE :
+ {
+ g_sns_buf[3].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[3].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[3].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_spdpulse_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_GYRO_X :
+ {
+ g_sns_buf[4].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[4].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[4].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_gyro_x_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_GYRO_Y :
+ {
+ g_sns_buf[5].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[5].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[5].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_gyro_y_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_GYRO_Z :
+ {
+ g_sns_buf[6].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[6].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[6].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_gyro_z_flg = TRUE;
+ break;
+ }
+ default:
+ break;
+ }
+ } else if (CID_DEAD_RECKONING_SENS_FST_DATA == msg->hdr.hdr.cid) {
+ u_int16 rev_data_size;
+
+ rcv_sensor_msg_fst = (const VEHICLESENS_DATA_MASTER_FST *)(&(msg->data[0]));
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ rev_data_size = static_cast<u_int16>(msg->hdr.hdr.msgbodysize - VEHICLESENS_DELIVERY_FSTSNS_HDR_SIZE);
+
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DID = %08X, rev_data_size = %d ",
+ rcv_sensor_msg_fst->ul_did, rev_data_size);
+#endif
+
+ /* Sensor data reception for DR */
+ switch (rcv_sensor_msg_fst->ul_did) {
+ case POSHAL_DID_REV_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.rev_data[g_fst_sns_buf.rev_rcv_size
+ / sizeof(g_fst_sns_buf.rev_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.rev_rcv_size = static_cast<u_int16>(
+ g_fst_sns_buf.rev_rcv_size + rev_data_size);
+
+ if (g_fst_sns_buf.rev_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_rev_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " REV receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FLAG_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.spd_pulse_check_data[g_fst_sns_buf.spd_pulse_check_rcv_size
+ / sizeof(g_fst_sns_buf.spd_pulse_check_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.spd_pulse_check_rcv_size = static_cast<u_int16>(
+ g_fst_sns_buf.spd_pulse_check_rcv_size + rev_data_size);
+
+ if (g_fst_sns_buf.spd_pulse_check_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_spdpulse_chk_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " SPF receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.spd_pulse_data[g_fst_sns_buf.spd_pulse_rcv_size
+ / sizeof(g_fst_sns_buf.spd_pulse_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.spd_pulse_rcv_size = static_cast<u_int16>(g_fst_sns_buf.spd_pulse_rcv_size + \
+ rev_data_size);
+
+ if (g_fst_sns_buf.spd_pulse_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_spdpulse_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " SP receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ case POSHAL_DID_GYRO_X_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.gyro_x_data[g_fst_sns_buf.gyro_x_rcv_size
+ / sizeof(g_fst_sns_buf.gyro_x_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.gyro_x_rcv_size = static_cast<u_int16>(g_fst_sns_buf.gyro_x_rcv_size + rev_data_size);
+
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " g_fst_sns_buf.gyro_x_rcv_size = %d, rcv_sensor_msg_fst->us_size = %d ",
+ g_fst_sns_buf.gyro_x_rcv_size, rcv_sensor_msg_fst->us_size);
+#endif
+ if (g_fst_sns_buf.gyro_x_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_gyro_x_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " GYRO_X receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ case POSHAL_DID_GYRO_Y_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.gyro_y_data[g_fst_sns_buf.gyro_y_rcv_size
+ / sizeof(g_fst_sns_buf.gyro_y_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.gyro_y_rcv_size = static_cast<u_int16>(g_fst_sns_buf.gyro_y_rcv_size + rev_data_size);
+
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " g_fst_sns_buf.gyro_y_rcv_size = %d, rcv_sensor_msg_fst->us_size = %d ",
+ g_fst_sns_buf.gyro_y_rcv_size, rcv_sensor_msg_fst->us_size);
+#endif
+ if (g_fst_sns_buf.gyro_y_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_gyro_y_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " GYRO_Y receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ case POSHAL_DID_GYRO_Z_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.gyro_z_data[g_fst_sns_buf.gyro_z_rcv_size
+ / sizeof(g_fst_sns_buf.gyro_z_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.gyro_z_rcv_size = static_cast<u_int16>(g_fst_sns_buf.gyro_z_rcv_size + rev_data_size);
+
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " g_fst_sns_buf.gyro_z_rcv_size = %d, rcv_sensor_msg_fst->us_size = %d ",
+ g_fst_sns_buf.gyro_z_rcv_size, rcv_sensor_msg_fst->us_size);
+#endif
+ if (g_fst_sns_buf.gyro_z_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_gyro_z_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " GYRO_Z receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ } else {
+ /* nop */
+ }
+
+ /* 4 data received? */
+ if ((g_sens_data_get_sns_cnt_flg == TRUE) &&
+ (g_sens_data_get_rev_flg == TRUE) &&
+ (g_sens_data_get_gyro_x_flg == TRUE) &&
+ (g_sens_data_get_gyro_y_flg == TRUE) &&
+ (g_sens_data_get_gyro_z_flg == TRUE) &&
+ (g_sens_data_get_spdpulse_flg == TRUE) &&
+ (g_sens_data_get_spdpulse_chk_flg == TRUE)) {
+ /* Sensor data acquisition flag ON */
+ g_sens_data_get_flg = TRUE;
+
+ /* Set all flags to FALSE */
+ g_sens_data_get_sns_cnt_flg = FALSE;
+ g_sens_data_get_gyro_x_flg = FALSE;
+ g_sens_data_get_gyro_y_flg = FALSE;
+ g_sens_data_get_gyro_z_flg = FALSE;
+ g_sens_data_get_rev_flg = FALSE;
+ g_sens_data_get_spdpulse_flg = FALSE;
+ g_sens_data_get_spdpulse_chk_flg = FALSE;
+ }
+
+ /* 4 data received? */
+ if ((g_sens_data_get_rev_fst_flg == TRUE) &&
+ (g_sens_data_get_gyro_x_fst_flg == TRUE) &&
+ (g_sens_data_get_gyro_y_fst_flg == TRUE) &&
+ (g_sens_data_get_gyro_z_fst_flg == TRUE) &&
+ (g_sens_data_get_spdpulse_fst_flg == TRUE) &&
+ (g_sens_data_get_spdpulse_chk_fst_flg == TRUE)) {
+ /* Initial sensor data acquisition flag ON */
+ g_fst_sens_data_get_flg = TRUE;
+
+ /* Set all flags to FALSE */
+ g_sens_data_get_gyro_x_fst_flg = FALSE;
+ g_sens_data_get_gyro_y_fst_flg = FALSE;
+ g_sens_data_get_gyro_z_fst_flg = FALSE;
+ g_sens_data_get_rev_fst_flg = FALSE;
+ g_sens_data_get_spdpulse_fst_flg = FALSE;
+ g_sens_data_get_spdpulse_chk_fst_flg = FALSE;
+ }
+
+ DeadReckoningRcvMsgFstSens(msg, location_info, rcv_gps_msg, &send_gps_msg, &send_sensor_msg);
+ }
+}
+
+void DeadReckoningRcvMsgFstSens(const DEAD_RECKONING_RCVDATA *msg, DEAD_RECKONING_LONLAT_INFO *location_info,
+ const SENSOR_MSG_GPSDATA_DAT *rcv_gps_msg, Struct_GpsData* send_gps_msg,
+ Struct_SensData* send_sensor_msg) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Verifying Debug Log Simulator Mode
+ Perform packet reading here to match some timing.
+ However,,Differ between GPS and SENSOR.
+ */
+ u_int8 fst_sens_send_num = 0U;
+ /* For GPS data */
+ if (g_gps_data_get_flg == TRUE) {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "DeadReckoningRcvMsg SEND GPS_DATA: DID[0x%08X] DSIZE[%d] MSG_SIZE[%d] SNS_CNT[%d] \r\n",
+ rcv_gps_msg.ulDid, rcv_gps_msg.ucData[4], msg->hdr.hdr.msgbodysize, rcv_gps_msg.ucSnsCnt);
+#endif
+
+ if (1) {
+ rcv_gps_msg = (const SENSOR_MSG_GPSDATA_DAT *)(&(msg->data[0]));
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+
+ /* Set and pass the data part except header/footer */
+ send_gps_msg->sens_cnt = rcv_gps_msg->uc_sns_cnt;
+ send_gps_msg->sens_cnt_flag = rcv_gps_msg->uc_gps_cnt_flag;
+ send_gps_msg->gps_data_size = rcv_gps_msg->us_size;
+ send_gps_msg->did = rcv_gps_msg->ul_did;
+ send_gps_msg->gps_data = (const void *)(&rcv_gps_msg->uc_data[0]);
+ }
+
+ /* Providing GPS data to DR_Lib */
+
+ g_gps_data_get_flg = FALSE;
+
+ } else if (g_sens_data_get_flg == TRUE) {
+ Struct_DR_DATA rcv_dr_data;
+ DR_CALC_INFO rcv_dr_calc_info;
+ DEADRECKONING_DATA_MASTER send_data_master;
+
+ if (1) {
+ /* Each data is stored in the data format for transmission. */
+ send_sensor_msg->sens_cnt_flag = 1U;
+ send_sensor_msg->sens_cnt = g_sns_buf[0].data[0];
+ send_sensor_msg->pulse_rev_tbl.reverse_flag = g_sns_buf[1].data[0];
+ send_sensor_msg->pulse_rev_tbl.pulse_flag = g_sns_buf[2].data[0];
+ send_sensor_msg->pulse_rev_tbl.pulse_sum_cyclic = static_cast<u_int16>(
+ ((((u_int16)g_sns_buf[3].data[0] << 0) & DR_MASK_WORD_L) |
+ (((u_int16)g_sns_buf[3].data[1] << 8) & DR_MASK_WORD_U)));
+ /* ToDo */
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_x_tbl.gyro_data[0])),
+ (const void *)(&(g_sns_buf[4].data[0])), sizeof(u_int16) * NUM_OF_100msData);
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_y_tbl.gyro_data[0])),
+ (const void *)(&(g_sns_buf[5].data[0])), sizeof(u_int16) * NUM_OF_100msData);
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_z_tbl.gyro_data[0])),
+ (const void *)(&(g_sns_buf[6].data[0])), sizeof(u_int16) * NUM_OF_100msData);
+ }
+
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningRcvMsg SEND SENSOR_COUNTER %d \r\n",
+ send_sensor_msg->sens_cnt);
+#endif
+
+ /* When the sensor data are ready, Call the DR-calculation process. */
+ memset(&rcv_dr_data, 0x00, sizeof(rcv_dr_data)); /* Coverity CID:18805 compliant */
+ memset(&rcv_dr_calc_info, 0x00, sizeof(rcv_dr_calc_info)); /* Coverity CID:18806 compliant */
+
+ location_info->calc_called = static_cast<u_int8>(TRUE);
+ location_info->lonlat.latitude = static_cast<int32>(rcv_dr_data.latitude);
+ location_info->lonlat.longitude = static_cast<int32>(rcv_dr_data.longitude);
+
+ if (rcv_dr_data.dr_status != static_cast<u_int8>(SENSORLOCATION_DRSTATUS_INVALID)) {
+ location_info->available = static_cast<u_int8>(TRUE);
+ } else {
+ location_info->available = static_cast<u_int8>(FALSE);
+ }
+
+ /* Changing the order of registration and delivery of the out structure to the data master for DR */
+
+ send_data_master.ul_did = VEHICLE_DID_DR_SNS_COUNTER;
+ send_data_master.us_size = VEHICLE_DSIZE_DR_SNS_COUNTER;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.positioning_time)), (size_t)VEHICLE_DSIZE_DR_SNS_COUNTER);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_LONGITUDE;
+ send_data_master.us_size = VEHICLE_DSIZE_LONGITUDE;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.longitude)), (size_t)VEHICLE_DSIZE_LONGITUDE);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_LATITUDE;
+ send_data_master.us_size = VEHICLE_DSIZE_LATITUDE;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.latitude)), (size_t)VEHICLE_DSIZE_LATITUDE);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_ALTITUDE;
+ send_data_master.us_size = VEHICLE_DSIZE_ALTITUDE;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.altitude)), (size_t)VEHICLE_DSIZE_ALTITUDE);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_SPEED;
+ send_data_master.us_size = VEHICLE_DSIZE_SPEED;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.rate)), (size_t)VEHICLE_DSIZE_SPEED);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_HEADING;
+ send_data_master.us_size = VEHICLE_DSIZE_HEADING;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.heading)), (size_t)VEHICLE_DSIZE_HEADING);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ /* Data master setting,Data delivery(GyroParameter) */
+ /* As it is registered for delivery with DID = VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL */
+ /* Process in GyroOffset-> GyroScaleFactor-> GyroScelFactorLevel order(Processing order cannot be changed.) */
+ send_data_master.ul_did = VEHICLE_DID_DR_GYRO_OFFSET;
+ send_data_master.us_size = VEHICLE_DSIZE_GYRO_OFFSET;
+ send_data_master.uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ send_data_master.dr_status = 0U; /* Not used */
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ reinterpret_cast<void *>(&(rcv_dr_calc_info.gyro_offset)), (size_t)send_data_master.us_size);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_GYRO_SCALE_FACTOR;
+ send_data_master.us_size = VEHICLE_DSIZE_GYRO_SCALE_FACTOR;
+ send_data_master.uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ send_data_master.dr_status = 0U; /* Not used */
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ reinterpret_cast<void *>(&(rcv_dr_calc_info.gyro_scale_factor)),
+ (size_t)send_data_master.us_size);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL;
+ send_data_master.us_size = VEHICLE_DSIZE_GYRO_SCALE_FACTOR_LEVEL;
+ send_data_master.uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ send_data_master.dr_status = 0U; /* Not used */
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ reinterpret_cast<void *>(&(rcv_dr_calc_info.gyro_scale_factor_level)),
+ (size_t)(send_data_master.us_size));
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ /* Data master setting,Data delivery(SpeedPulseParameter) */
+ /* As it is registered for delivery with DID = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL */
+ /* Process in SpeedPulseScaleFactor-> SpeedPulseScaleFactorLevel order(Processing order cannot be changed.) */
+ send_data_master.ul_did = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR;
+ send_data_master.us_size = VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR;
+ send_data_master.uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ send_data_master.dr_status = 0U; /* Not used */
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ reinterpret_cast<void *>(&(rcv_dr_calc_info.speed_pulse_scale_factor)),
+ (size_t)(send_data_master.us_size));
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL;
+ send_data_master.us_size = VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR_LEVEL;
+ send_data_master.uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ send_data_master.dr_status = 0U; /* Not used */
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ reinterpret_cast<void *>(&(rcv_dr_calc_info.speed_pulse_scale_factor_level)),
+ (size_t)(send_data_master.us_size));
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ g_sens_data_get_flg = FALSE;
+ } else if (g_fst_sens_data_get_flg == TRUE) {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningRcvMsg FstSnsData -> DeadReckoningLibrary. \r\n");
+#endif
+ for (fst_sens_send_num = 0; fst_sens_send_num < g_fst_sns_buf.data_num; fst_sens_send_num++) {
+ /* Each data is stored in the data format for transmission. */
+ send_sensor_msg->sens_cnt_flag = 0U;
+ send_sensor_msg->sens_cnt = 0U;
+ send_sensor_msg->pulse_rev_tbl.reverse_flag = g_fst_sns_buf.rev_data[fst_sens_send_num];
+ send_sensor_msg->pulse_rev_tbl.pulse_flag = g_fst_sns_buf.spd_pulse_check_data[fst_sens_send_num];
+ send_sensor_msg->pulse_rev_tbl.pulse_sum_cyclic = g_fst_sns_buf.spd_pulse_data[fst_sens_send_num];
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_x_tbl.gyro_data[0])),
+ (const void *)(&(g_fst_sns_buf.gyro_x_data[fst_sens_send_num * NUM_OF_100msData])),
+ (size_t)((sizeof(g_fst_sns_buf.gyro_x_data[fst_sens_send_num])) * NUM_OF_100msData));
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_y_tbl.gyro_data[0])),
+ (const void *)(&(g_fst_sns_buf.gyro_y_data[fst_sens_send_num * NUM_OF_100msData])),
+ (size_t)((sizeof(g_fst_sns_buf.gyro_y_data[fst_sens_send_num])) * NUM_OF_100msData));
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_z_tbl.gyro_data[0])),
+ (const void *)(&(g_fst_sns_buf.gyro_z_data[fst_sens_send_num * NUM_OF_100msData])),
+ (size_t)((sizeof(g_fst_sns_buf.gyro_z_data[fst_sens_send_num])) * NUM_OF_100msData));
+
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningRcvMsg send_sensor_msg.sens_cnt_flag %d \r\n",
+ send_sensor_msg->sens_cnt_flag);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningRcvMsg SEND SENSOR_COUNTER %d \r\n",
+ send_sensor_msg->sens_cnt);
+#endif
+
+ /* Sleep to reduce CPU load */
+ MilliSecSleep(DR_FST_SENS_CALC_SLEEP_TIME);
+
+ /* When the sensor data are ready, Call the DR-calculation process. */
+ }
+
+ g_sens_data_get_flg = FALSE;
+
+ g_fst_sens_data_get_flg = FALSE;
+
+ } else {
+ /* nop */
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningGetDRData
+* ABSTRACT : Vehicle sensor information acquisition
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningGetDRData(const DEADRECKONING_MSG_GET_DR_DATA *msg) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ void *share_top; /* Start address of shared memory */
+ u_int32 share_size; /* Size of shared memory area */
+ RET_API ret_api;
+ int32 ret;
+ int32 event_val = VEHICLE_RET_NORMAL;
+ EventID event_id;
+ DEADRECKONING_DATA_MASTER dr_master; /* GPS Data Master */
+
+ DEADRECKONING_MSG_GET_DR_DATA msg_buf;
+
+ /* Defines the data master for each API. */
+ SENSORLOCATION_MSG_LONLATINFO_DAT msg_lonlat_info;
+ SENSORLOCATION_MSG_ALTITUDEINFO_DAT msg_altitude_info;
+ SENSORMOTION_MSG_SPEEDINFO_DAT msg_speed_info;
+ SENSORMOTION_MSG_HEADINGINFO_DAT msg_heading_info;
+
+ (void)memset(reinterpret_cast<void *>(&msg_buf), 0, sizeof(DEADRECKONING_MSG_GET_DR_DATA));
+ memcpy(&(msg_buf), msg, sizeof(DEADRECKONING_MSG_GET_DR_DATA));
+
+ /* Check the DID */
+ ret = DeadReckoningCheckDid(msg_buf.data.did);
+
+ if (VEHICLESENS_INVALID != ret) {
+ /* DID normal */
+
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME), &share_top, &share_size);
+ if (RET_NORMAL == ret_api) {
+ /* Acquire the specified data from the data master. */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(msg_buf.data.did, &dr_master);
+
+ /* Align data from the data master for API I/F */
+ switch ((u_int32)(msg_buf.data.did)) {
+ /* Describes the process for each DID. */
+ case VEHICLE_DID_DR_LATITUDE:
+ {
+ (void)memset(reinterpret_cast<void *>(&msg_lonlat_info),
+ 0, sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT));
+
+ /* Size storage(LATITUDE) */
+ msg_lonlat_info.size = static_cast<u_int16>(sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT));
+
+ /* DR status setting */
+ msg_lonlat_info.dr_status = dr_master.dr_status;
+
+ /* The DR enable flag is set to DR status. */
+ msg_lonlat_info.is_exist_dr = dr_master.dr_status;
+
+ /* Set the Latitude */
+ memcpy(&(msg_lonlat_info.latitude), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Obtain the data master Longitude */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_LONGITUDE, &dr_master);
+
+ /* Set the Longitude */
+ memcpy(&(msg_lonlat_info.longitude), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &dr_master);
+
+ /* Set the SensorCnt */
+ memcpy(&(msg_lonlat_info.sensor_cnt), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg_buf.data.offset,
+ (const void *)&msg_lonlat_info,
+ sizeof(msg_lonlat_info));
+
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+
+ break;
+ }
+ case VEHICLE_DID_DR_ALTITUDE:
+ {
+ (void)memset(reinterpret_cast<void *>(&msg_altitude_info),
+ 0, sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT));
+
+ msg_altitude_info.size = static_cast<u_int16>(sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT));
+ /* The DR enable flag is set to DR status. */
+ msg_altitude_info.is_exist_dr = dr_master.dr_status;
+ msg_altitude_info.dr_status = dr_master.dr_status;
+
+ /* Set the Speed */
+ memcpy(&(msg_altitude_info.altitude), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &dr_master);
+
+ /* Set the SensorCnt */
+ memcpy(&(msg_altitude_info.sensor_cnt), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg_buf.data.offset,
+ (const void *)&msg_altitude_info,
+ sizeof(msg_altitude_info));
+
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED:
+ {
+ (void)memset(reinterpret_cast<void *>(&msg_speed_info),
+ 0, sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT));
+
+ msg_speed_info.size = static_cast<u_int16>(sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT));
+ /* The DR enable flag is set to DR status. */
+ msg_speed_info.is_exist_dr = dr_master.dr_status;
+ msg_speed_info.dr_status = dr_master.dr_status;
+
+ /* Set the Speed */
+ memcpy(&(msg_speed_info.speed), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &dr_master);
+ /* Set the SensorCnt */
+ memcpy(&(msg_speed_info.sensor_cnt), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg_buf.data.offset,
+ (const void *)&msg_speed_info,
+ sizeof(msg_speed_info));
+
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+
+ break;
+ }
+ case VEHICLE_DID_DR_HEADING:
+ {
+ (void)memset(reinterpret_cast<void *>(&msg_heading_info),
+ 0, sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT));
+
+ msg_heading_info.size = static_cast<u_int16>(sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT));
+ /* The DR enable flag is set to DR status. */
+ msg_heading_info.is_exist_dr = dr_master.dr_status;
+ msg_heading_info.dr_status = dr_master.dr_status;
+
+ /* Set the Heading */
+ memcpy(&(msg_heading_info.heading), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &dr_master);
+ /* Set the SensorCnt */
+ memcpy(&(msg_heading_info.sensor_cnt), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg_buf.data.offset,
+ (const void *)&msg_heading_info,
+ sizeof(msg_heading_info));
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+
+ break;
+ }
+ /* Other than the above */
+ default:
+ /* Do not edit. */
+ break;
+ }
+
+ /* Check the data size */
+ if (msg_buf.data.size < dr_master.us_size) {
+ /* Shared memory error(Insufficient storage size) */
+ event_val = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ }
+ } else {
+ /* Shared memory error */
+ event_val = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ }
+ } else {
+ /* DID error */
+ event_val = VEHICLE_RET_ERROR_DID;
+ }
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(msg_buf.data.pno);
+
+ /* Publish Events */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningSetMapMatchingData
+* ABSTRACT : Map-Matching information setting
+* FUNCTION : Setting Map-Matching Information
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningSetMapMatchingData(const DR_MSG_MAP_MATCHING_DATA *msg) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningClearBackupData
+* ABSTRACT : Backup data clear function CALL
+* FUNCTION : Call the backup data clear function.
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void DeadReckoningClearBackupData(const DR_MSG_CLEAR_BACKUP_DATA *msg) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ char event_name[32]; /* Event name character string buffer */
+ EventID event_id; /* Event ID */
+ int32 event_val; /* Event value to set*/
+ RET_API ret_api; /* System API return value */
+
+ if (msg != NULL) {
+ /* DR backup data initialization function call */
+ event_val = RET_NORMAL;
+
+ /* Initialization of event name character string buffer */
+ (void)memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name));
+
+ /* Event name creation */
+ snprintf(event_name, sizeof(event_name), "DR_API_%X", msg->hdr.hdr.sndpno);
+ /* Match DR_API.cpp side with name */
+
+ /* Event Generation */
+ event_id = _pb_CreateEvent(_CWORD64_EVENT_MANUALRESET_OFF, DR_EVENT_VAL_INIT, event_name);
+
+ if (event_id != 0) {
+ /* For successful event generation */
+ /* Set the event */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+
+ if (ret_api == RET_NORMAL) {
+ /* Successful event set */
+ } else {
+ /* Event set failed */
+ /* Delete Event and Return Event Generation Failed */
+ ret_api = _pb_DeleteEvent(event_id);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SetEvent Failed\r\n");
+ }
+ }
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningSetEvent
+* ABSTRACT : Set of events
+* FUNCTION : Set event to return successful or unsuccessful log configuration retrieval
+* ARGUMENT : PNO pno : Caller Pno
+* : RET_API ret : Log setting acquisition Success/Fail
+* : RET_NORMAL: Log setting acquisition success
+* : RET_ERROR: Log setting acquisition failure
+* NOTE :
+* RETURN : None
+******************************************************************************/
+static void DeadReckoningSetEvent(PNO pno, RET_API ret) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ char event_name[32]; /* Event name character string buffer */
+ EventID event_id; /* Event ID */
+ RET_API ret_api; /* System API return value */
+
+ /* Initialization of event name character string buffer */
+ (void)memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name));
+
+ /* Event name creation */
+ snprintf(event_name, sizeof(event_name), "VehicleDebug_%X", pno);
+ /* Event name should match VehicleDebug_API.cpp */
+
+ /* Event Generation */
+ event_id = _pb_CreateEvent(_CWORD64_EVENT_MANUALRESET_OFF, VEHICLEDEBUG_EVENT_VAL_INIT, event_name);
+
+ if (event_id != 0) {
+ /* For successful event generation */
+ /* Set the event */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, ret);
+
+ if (ret_api == RET_NORMAL) {
+ /* Successful event set */
+ } else {
+ /* Event set failed */
+ /* Delete Event */
+ ret_api = _pb_DeleteEvent(event_id);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SetEvent Failed\r\n");
+ }
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningLinkSharedMemory
+* ABSTRACT : Shared memory link
+* FUNCTION : Link to shared memory
+* ARGUMENT : char *shared_memory_name : Name of shared memory to link
+* : void **share_addr : Pointer to a variable that stores the address of the linked shared memory.
+* NOTE :
+* RETURN : None
+******************************************************************************/
+static void DeadReckoningLinkSharedMemory(char *shared_memory_name, void **share_addr) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api;
+ void *pv_share_mem; /* Store Shared Memory Address */
+ u_int32 share_mem_size; /* Size of the linked shared memory */
+
+ if ((shared_memory_name != NULL) && (share_addr != NULL)) {
+ /* Link to the handle storage area */
+ ret_api = _pb_LinkShareData(shared_memory_name, &pv_share_mem, &share_mem_size);
+
+ if (ret_api == RET_NORMAL) {
+ /* If the link is successful */
+ if (share_mem_size == VEHICLEDEBUG_MSGBUF_DSIZE) {
+ /* When the size of the linked shared memory is correct */
+ *share_addr = pv_share_mem; /* Set the address */
+ } else {
+ /* The size of the linked shared memory is incorrect. */
+ *share_addr = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Bad shared memory size\r\n");
+ }
+ } else {
+ /* If the link fails */
+ *share_addr = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't link shared memory\r\n");
+ }
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningWriteSharedMemory
+* ABSTRACT : Write Shared Memory
+* FUNCTION : Write Shared Memory
+* ARGUMENT : VEHICLEDEBUG_MSG_LOGINFO_DAT* loginfo : Logging information
+* RETURN : RET_API : Whether writing to shared memory was successful
+* : : RET_NORMAL Success
+* : : RET_ERROR Failed
+* NOTE :
+******************************************************************************/
+static RET_API DeadReckoningWriteSharedMemory(VEHICLEDEBUG_MSG_LOGINFO_DAT* loginfo) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static VEHICLEDEBUG_MSG_LOGINFO_DAT *share_addr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ RET_API ret = RET_NORMAL; /* Return of the functions */
+ RET_API ret_api; /* Return of the functions */
+
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Call %s\r\n", __func__);
+#endif
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(SENSOR_LOG_SETTING_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (share_addr == NULL) {
+ /* Link to shared memory */
+ DeadReckoningLinkSharedMemory(const_cast<char *>(LOG_SETTING_SHARE_MEMORY_NAME),
+ reinterpret_cast<void **>(&share_addr));
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ }
+
+ if (share_addr != NULL) {
+ /* The link to shared memory is successful. */
+ /* Writing Data to Shared Memory */
+ share_addr->log_sw = loginfo->log_sw;
+ (void)memcpy(reinterpret_cast<void *>(share_addr->severity),
+ (const void *)(loginfo->severity), sizeof(share_addr->severity));
+ } else {
+ /* Failed to link to shared memory */
+ ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "DeadReckoningLinkSharedMemory Failed");
+ }
+ /* Semaphore unlock */
+ (void)_pb_SemUnlock(sem_id);
+ } else {
+ /* Semaphore lock failed */
+ ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock Failed");
+ }
+ } else {
+ ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return ret;
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningGetLocationLogStatus
+* ABSTRACT : CALL of functions for acquiring logging settings
+* FUNCTION : Call the log setting acquisition function.
+* ARGUMENT : None
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningGetLocationLogStatus(PNO pno) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api; /* System API return value */
+ RET_API ret;
+ VEHICLEDEBUG_MSG_LOGINFO_DAT loginfo; /* Logging information */
+ BOOL log_sw = FALSE;
+
+ /* CALL of functions for acquiring logging settings */
+ ret_api = RET_NORMAL;
+
+ if (ret_api == RET_NORMAL) {
+ /* Log setting acquisition function succeeded */
+ loginfo.log_sw = (u_int32)(log_sw);
+
+ /* Write to shared memory */
+ ret = DeadReckoningWriteSharedMemory(&loginfo);
+
+ /* Event publishing */
+ DeadReckoningSetEvent(pno, ret);
+ } else {
+ /* Log setting acquisition function failed */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "GetLocationLogSetting Failed");
+
+ /* Event publishing */
+ DeadReckoningSetEvent(pno, RET_ERROR);
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningSetLocationLogStatus
+* ABSTRACT : CALL of log-setting-request-function
+* FUNCTION : Call the log setting request function.
+* ARGUMENT : u_int32 log_sw : Log type
+* : u_int8 severity : Output level
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningSetLocationLogStatus(BOOL log_sw, u_int8 severity) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/GpsInt.cpp b/vehicleservice/positioning/server/src/Sensor/GpsInt.cpp
new file mode 100755
index 0000000..75fb890
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/GpsInt.cpp
@@ -0,0 +1,171 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :GpsInt.cpp
+ * System name :PastModel002
+ * Subsystem name :GPS interrupt thread
+ ******************************************************************************/
+
+/*******************************************************************************
+* Include File
+*******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "POS_private.h"
+#include "GpsInt.h"
+
+#define RD_REG32(reg) \
+ (*(volatile ULONG * const)(reg))
+
+#define COMREGMSK_OR 1
+#define ALLINTMASK 0x0f
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void com_regmsk_dword(ULONG *, ULONG, UCHAR, UCHAR); // NOLINT(readability/nolint)
+#ifdef __cplusplus
+}
+#endif
+
+/*******************************************************************************
+* Define
+*******************************************************************************/
+#define GPS_INT_THREAD_DEBUG_SWITCH 0 /* 0:OFF 1:ON */
+
+/*******************************************************************************
+* Global Parameter
+*******************************************************************************/
+GPS_INT_DATA g_gps_int_data;
+
+/*******************************************************************************
+* Module
+*******************************************************************************/
+/*******************************************************************************
+ * MODULE : DEVGpsIntUnMapDevice
+ * ABSTRACT : Register mapping release processing
+ * FUNCTION : Release the register mapping
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void DEVGpsIntUnMapDevice(void) {
+ /* Release GPIO Register Mapping */
+ if ((g_gps_int_data.irq_status_reg != 0)
+ || (g_gps_int_data.irq_status_set_reg != 0)
+ || (g_gps_int_data.rising_detect_reg != 0)) {
+ /* When GPIO registers are mapped */
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ MunMapDeviceIo((HANDLE)g_gps_int_data.irq_status_reg, sizeof(g_gps_int_data.irq_status_reg));
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ MunMapDeviceIo((HANDLE)g_gps_int_data.irq_status_set_reg, sizeof(g_gps_int_data.irq_status_set_reg));
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ MunMapDeviceIo((HANDLE)g_gps_int_data.rising_detect_reg, sizeof(g_gps_int_data.rising_detect_reg));
+
+ g_gps_int_data.irq_status_reg = 0;
+ g_gps_int_data.irq_status_set_reg = 0;
+ g_gps_int_data.rising_detect_reg = 0;
+ }
+}
+
+/*******************************************************************************
+ * MODULE : DEVGpsIntSetInterupt
+ * ABSTRACT : GPS interrupt setting
+ * FUNCTION : Setting GPS Interrupt
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : TRUE : Interrupt setting success
+ * : FALSE : Interrupt setting failure
+ ******************************************************************************/
+void DEVGpsIntSetInterupt(void) {
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ /* Dummy read */
+ itr_ret = RD_REG32(g_gps_int_data.irq_status_set_reg);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, IRQSTATUS_SET reg value(before) = 0x%08X ", itr_ret);
+#endif
+
+ /* GPS interrupt Enable setting */
+ /* Dummy read */
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ (void)RD_REG32(g_gps_int_data.irq_status_set_reg);
+
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, IRQSTATUS_SET reg value(after) = 0x%08X ", itr_ret);
+#endif
+
+
+
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ /* Dummy read */
+ itr_ret = RD_REG32(g_gps_int_data.rising_detect_reg);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, RISINGDETECT reg value(before) = 0x%08X ", itr_ret);
+#endif
+
+ /* GPS Interrupt Detection Method Setting */
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ com_regmsk_dword(reinterpret_cast<ULONG *>(g_gps_int_data.rising_detect_reg), \
+ GPS_MASK_6BIT, COMREGMSK_OR, ALLINTMASK);
+
+ /* Dummy read */
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ (void)RD_REG32(g_gps_int_data.rising_detect_reg);
+
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, RISINGDETECT reg value(after) = 0x%08X ", itr_ret);
+#endif
+}
+
+/*******************************************************************************
+ * MODULE : DEVGpsIntIntRegClear
+ * ABSTRACT : Interrupt cause register clear processing
+ * FUNCTION : Clear the interrupt cause register
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void DEVGpsIntIntRegClear(void) {
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ /* Dummy read */
+ itr_ret = RD_REG32(g_gps_int_data.irq_status_reg);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, IRQSTATUS reg value(before) = 0x%08X ", itr_ret);
+#endif
+
+ /* Clear Interrupt Source Register */
+ /* Dummy read */
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ (void)RD_REG32(g_gps_int_data.irq_status_reg);
+
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, IRQSTATUS reg value(after) = 0x%08X ", itr_ret);
+#endif
+}
+
+/*******************************************************************************
+ * MODULE : DEVGpsIntSndMsg
+ * ABSTRACT : Send GPS interrupt occurrence notification
+ * FUNCTION : Notify GPS communication management that an interrupt has occurred.
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : Other than the above : Processing error
+ ******************************************************************************/
+RET_API DEVGpsIntSndMsg(void) {
+ return RET_NORMAL;
+}
+
diff --git a/vehicleservice/positioning/server/src/Sensor/Makefile b/vehicleservice/positioning/server/src/Sensor/Makefile
new file mode 100755
index 0000000..bb70229
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/Makefile
@@ -0,0 +1,181 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed library(*.a) #############
+INST_LIBS = libPOS_Sensor
+
+######### compiled sources #############
+libPOS_Sensor_SRCS += DeadReckoning_main.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Common.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_Heading_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_GyroOffset_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_Speed_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_Longitude_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_SnsCounter.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_Altitude_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_GyroScaleFactor_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_DataMasterMain.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_Latitude_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_DeliveryCtrl.cpp
+libPOS_Sensor_SRCS += ClockUtility.cpp
+libPOS_Sensor_SRCS += VehicleUtility.cpp
+libPOS_Sensor_SRCS += GpsInt.cpp
+libPOS_Sensor_SRCS += VehicleSens_Thread.cpp
+libPOS_Sensor_SRCS += VehicleSens_FromAccess.cpp
+libPOS_Sensor_SRCS += VehicleSens_Common.cpp
+libPOS_Sensor_SRCS += VehicleSens_SelectionItemList.cpp
+libPOS_Sensor_SRCS += VehicleSens_SharedMemory.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MainGpsInterruptSignal.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsAntennaStatus.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Rev.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsCounter_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulse_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Rev_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulseExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Mon_Hw_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_Clock_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SysGpsInterruptSignal.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SnsCounter_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroYExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroZExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroX.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroY.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroZ.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_Dop_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroTrouble.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SnsCounterExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Gps_CWORD82__CWORD44_Gp4_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroX_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroY_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroZ_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroConnectStatus.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_RevFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_RevExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_SvInfo_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GPSInterruptFlag.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulseFlag.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_TimeGps_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_TimeUtc_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulseFlagFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SnsCounter.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulseFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroXFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroYFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroZFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_Status_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulse.cpp
+libPOS_Sensor_SRCS += VehicleSens_DataMasterMain.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_Velned_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_Posllh_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsAntenna.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsAntenna_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedKmph.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedKmph_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationLonLat.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationLonLat_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationAltitude.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationAltitude_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionSpeed.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionSpeed_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionSpeed_n.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionSpeed_i.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionHeading.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionHeading_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsTime.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsTime_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsTimeRaw.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsTimeRaw_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_NaviinfoDiagGPS_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsX.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsX_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsXExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsXFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsY.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsY_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsYExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsYFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsZ.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsZ_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsZExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsZFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroTemp.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroTemp_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroTempExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroTempFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsNmea_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationLonLat_n.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationAltitude_n.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionSpeed_n.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionHeading_n.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SettingTime.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SettingTime_clock.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_PulseTime.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_PulseTime_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_PulseTimeExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_WknRollover.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_WknRollover_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsClockDrift.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsClockDrift_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsClockFreq.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsClockFreq_g.cpp
+
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationInfoNmea.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationInfoNmea_n.cpp
+
+libPOS_Sensor_SRCS += VehicleSens_CanDeliveryEntry.cpp
+libPOS_Sensor_SRCS += VehicleSens_DeliveryCtrl.cpp
+libPOS_Sensor_SRCS += SensorLog.cpp
+
+######### add include path #############
+CPPFLAGS += -I../../include/Sensor
+CPPFLAGS += -I../../include/nsfw
+CPPFLAGS += -I../../include/ServiceInterface
+CPPFLAGS += -I../../../client/include
+
+CPPFLAGS += -I../ServiceInterface/VehicleIf
+CPPFLAGS += -I../nsfw/include
+#CPPFLAGS += -I../../../../diag_code/library/include
+
+CPPFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include/vehicle_service
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### add library path #############
+LDFLAGS +=
+
+INSTALL = install
+CREATE_DIR = $(DESTDIR)/nv/BS/vs/positioning/rwdata
+install-data:
+ $(INSTALL) -d -m 775 $(CREATE_DIR)
+
+include ../../../../vehicle_service.mk
+
diff --git a/vehicleservice/positioning/server/src/Sensor/SensorLog.cpp b/vehicleservice/positioning/server/src/Sensor/SensorLog.cpp
new file mode 100755
index 0000000..eed514f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/SensorLog.cpp
@@ -0,0 +1,1307 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * SensorLog.cpp
+ * @brief
+ * Sensor Logging service functionality
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <positioning_hal.h>
+#include <unistd.h>
+#include "SensorLog.h"
+#include "Sensor_Common_API.h"
+#include <zlib.h>
+#include "POS_private.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* Sensor Log Type */
+typedef enum {
+ SENSLOG_TYPE_SYS_INPUT = 0, /* Sensor Log Type-SYS (INPUT) */
+ SENSLOG_TYPE_SYS_OUTPUT, /* Sensor Log Type-SYS (OUTPUT) */
+ SENSLOG_TYPE_GPS_INPUT, /* Sensor Log Type-GPS (INPUT) */
+ SENSLOG_TYPE_GPS_OUTPUT, /* Sensor Log Type-GPS (OUTPUT) */
+ SENSLOG_TYPE_NAVI_INPUT, /* Sensor Log Type-NAVI(INPUT) */
+ SENSLOG_TYPE_NAVI_OUTPUT, /* Sensor Log Type-NAVI(OUTPUT) */
+ SENSLOG_TYPE_POS_OUTPUT, /* Sensor Log Type-POS (OUTPUT) */
+ SENSLOG_TYPE_CMD_INPUT, /* Sensor Log Type-CMD (INPUT) */
+ SENSLOG_TYPE_CMD_OUTPUT, /* Sensor Log Type-CMD (OUTPUT) */
+
+ SENSLOG_TYPE_COUNT /* Sensor Log Type-Counting */
+} SENSLOG_TYPE;
+
+#define SENSLOG_VALIDFLAG_ON (1) /* Effective specific flag ON */
+#define SENSLOG_VALIDFLAG_OFF (0) /* Enable flag OFF */
+#define SENSLOG_FILEPATH_SIZE (128) /* Output path size */
+#define SENSLOG_FILENAME_SIZE (64) /* Output file name size */
+#define SENSLOG_CONFIG_TEXT_SIZE (128) /* config file size/line */
+#define SENSLOG_LEN_MIN (1) /* Record Length-Minimum */
+#define SENSLOG_LEN_MAX (900) /* Record Length-Maximum */
+#define SENSLOG_LEN_DEFAULT (300) /* Record length-default value */
+#define SENSLOG_GEN_MIN (1) /* Number of generations-minimum value */
+#define SENSLOG_GEN_MAX (999) /* Number of generations-maximum value */
+#define SENSLOG_GEN_DEFAULT (100) /* Number of generations-default value */
+#define SENSLOG_BUF_MIN (2272) /* Buffer Size-Minimum */
+#define SENSLOG_BUF_MAX (11360) /* Buffer size-maximum value */
+#define SENSLOG_BUF_DEFAULT (4544) /* Buffer size-default value */
+#define SENSLOG_OUTPUTFLAG_NEW (0) /* Output Flag-New */
+#define SENSLOG_OUTPUTFLAG_ADD (1) /* Output Flag-Add */
+#define SENSLOG_PNAME_MAX (16) /* Maximum number of characters of process name */
+
+#define SENSLOG_SEMAPHO_NAME ("SENSLOG_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+
+#define SENSLOG_CONFIG_FILE_PATH_1 "/nv/BS/vs/positioning/rwdata/" /* Sensor log-Config filepath-1 */
+#define SENSLOG_CONFIG_FILE_PATH_2 "/mnt/sda1/" /* Sensor log-Config filepath-2 */
+#define SENSLOG_CONFIG_FILE_NAME_SYS "POS_sys_log.cfg" /* Sensor log-Config filename-SYS */
+#define SENSLOG_CONFIG_FILE_NAME_GPS "POS_gps_log.cfg" /* Sensor log-Config filename-GPS */
+#define SENSLOG_CONFIG_FILE_NAME_NAVI "POS_nav_log.cfg" /* Sensor log-Config filename-NAVI */
+#define SENSLOG_CONFIG_FILE_NAME_POS "POS_pos_log.cfg" /* Sensor log-Config filename-POS */
+#define SENSLOG_CONFIG_FILE_NAME_CMD "POS_cmd_log.cfg" /* Sensor log-Config filename-CMD */
+#define SENSLOG_CONFIG_KEY_LEN "POS_log_len" /* Sensor log-config file-Record length */
+#define SENSLOG_CONFIG_KEY_GEN "POS_log_gen" /* Sensor log-config file-Number of generations */
+#define SENSLOG_CONFIG_KEY_BUF "POS_log_buf" /* Sensor log-config file-Buffer size */
+#define SENSLOG_NAV_SVINFO_FILE_NAME "POS_NAV_SVINFO" /* Sensor log-NAV-SVINFOFile name(Log output when file exists)*/
+#define SENSLOG_SEQ_START ">>>>" /* Sensor log sequence(Start) */
+#define SENSLOG_SEQ_END "<<<<" /* Sensor log sequence(End) */
+#define SENSLOG_SEQ_SIZE (4) /* Sensor Log Sequence Size */
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Structure to create SensorLog data
+*/
+typedef struct {
+ uint16_t us_len; /* Number of records */
+ uint16_t uc_gen; /* Number of generations */
+} SENSLOG_GEN;
+
+/*!
+ @brief Structure to create SensorLog data
+*/
+typedef struct {
+ uint8_t uc_valid_flag; /* Output enable flag */
+ SENSLOG_GEN st_gen; /* Generation information */
+ uint16_t us_file_rec_count; /* Number of file output records */
+ uint16_t us_rec_count; /* Number of output records */
+ uint16_t us_gen_count; /* Number of generations */
+ uint8_t uc_file_path[SENSLOG_FILEPATH_SIZE]; /* Output path */
+ uint8_t uc_file_name[SENSLOG_FILENAME_SIZE]; /* Output file name */
+ uint8_t uc_gen_fname[SENSLOG_FILENAME_SIZE]; /* Generation information output file name */
+ uint8_t uc_text_buf[SENSLOG_BUF_MAX]; /* Buffering area(Static) */
+ uint32_t ul_text_buf_size; /* Buffering area size */
+ uint32_t ul_text_buf_len; /* Data size in the buffer */
+ uint8_t uc_output_flag; /* Output flag */
+ uint8_t uc_temp_buf[SENSLOG_BUF_MAX]; /* Output data temporary area */
+ uint8_t uc_positioninglog_buf[SENSLOG_BUF_MAX]; /* FRAMEWORKUNIFIEDLOG outputs */
+} SENSLOG_INFO;
+
+/*!
+ @brief Structure to get System time
+*/
+typedef struct {
+ uint16_t us_year;
+ uint16_t us_month;
+ uint16_t us_day_of_week;
+ uint16_t us_day;
+ uint16_t us_hour;
+ uint16_t us_minute;
+ uint16_t us_second;
+ uint16_t us_milli_seconds;
+} SENSLOG_SYSTEMTIME;
+
+/*!
+ @brief Structure to create SensorLog data
+*/
+typedef struct {
+ uint16_t us_data_type; /* Data type */
+ SENSLOG_SYSTEMTIME st_sys_time; /* Current time */
+ DID ul_did; /* Data ID */
+ int8_t c_pname[SENSLOG_PNAME_MAX]; /* Destination information */
+ uint8_t uc_unit_type; /* Hardware configuration type(GRADE1 / GRADE2) */
+ uint8_t uc_result; /* Send/Receive result(Success:0 / Fail:1) */
+ uint16_t us_data_size; /* Size of the data */
+} SENSLOG_DATA_HEADER;
+
+
+/*!
+ @brief Structure to create SensorLog ID table
+*/
+typedef struct {
+ uint16_t us_data_type; /* Data type */
+ DID ul_did; /* Data ID */
+ uint16_t us_file_type; /* Sensor Log Type */
+ uint16_t us_write_type; /* FRAMEWORKUNIFIEDLOG Output Type */
+} SENSLOG_ID_TBL;
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+static void SensLogGetConfig(const uint8_t*, SENSLOG_INFO*);
+static void SensLogGetConfigVal(uint8_t*, uint8_t*);
+static void SensLogCheckNAVSVINFOFile(void);
+static void SensLogWrite(uint16_t, uint16_t, uint16_t, DID did, PNO pno, uint8_t*, uint16_t, uint8_t, uint8_t, uint8_t);
+static uint16_t SensLogGetFileType(const SENSLOG_ID_TBL*, uint16_t*, uint16_t*, DID did);
+static void SensLogOutputFile(uint8_t);
+static void SensLogOutputGenFile(uint8_t);
+static void SensLogGetSystemTime(SENSLOG_SYSTEMTIME*);
+static void Num2String2Digit(uint8_t* buf, uint32_t num);
+static void Num2String3Digit(uint8_t* buf, uint32_t num);
+static void Num2String4Digit(uint8_t* buf, uint32_t num);
+static void Num2HexString(uint8_t* buf, uint8_t digits, uint32_t num);
+static void SensLogmakeHeader(uint8_t* buf, SENSLOG_DATA_HEADER data_header);
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/* Sensor log information */
+static SENSLOG_INFO g_sens_log_info[SENSLOG_TYPE_COUNT]; // NOLINT(readability/nolint)
+static uint8_t g_navsv_info_flag = FALSE;
+uint8_t g_mount_path[SENSLOG_FILEPATH_SIZE]; /* Mount path */
+UNIT_TYPE g_unit_type = UNIT_TYPE_NONE; /* HW configuration type */
+SemID g_sem_id = 0; /* Lock semaphore ID */
+
+/* Sensor log type definition table */
+const SENSLOG_ID_TBL kSensLogInputTbl[] = {
+ /* Data type DID Sensor Log Type FRAMEWORKUNIFIEDLOG Output Type */
+ {SENSLOG_DATA_I_SYS, 0, SENSLOG_TYPE_SYS_INPUT, POS_SENSLOG_TYPE_SYS },
+ {SENSLOG_DATA_I_SYS_STS, 0, SENSLOG_TYPE_SYS_INPUT, POS_SENSLOG_TYPE_SYS },
+ {SENSLOG_DATA_I_GPS, 0, SENSLOG_TYPE_GPS_INPUT, POS_SENSLOG_TYPE_GPS },
+ {SENSLOG_DATA_I_LOC, POSHAL_DID_GPS_CUSTOMDATA_NAVI, SENSLOG_TYPE_NAVI_INPUT, POS_SENSLOG_TYPE_NAV },
+ {SENSLOG_DATA_I_SPEED, VEHICLE_DID_MOTION_SPEED_NAVI, SENSLOG_TYPE_NAVI_INPUT, POS_SENSLOG_TYPE_NAV },
+ {SENSLOG_DATA_I_TIME, VEHICLE_DID_SETTINGTIME, SENSLOG_TYPE_NAVI_INPUT, POS_SENSLOG_TYPE_NAV },
+ {SENSLOG_DATA_I_TIME, POSHAL_DID_GPS_TIME, SENSLOG_TYPE_GPS_INPUT, POS_SENSLOG_TYPE_GPS },
+ {SENSLOG_DATA_I_GPSINF, 0, SENSLOG_TYPE_NAVI_INPUT, POS_SENSLOG_TYPE_NAV },
+ {SENSLOG_DATA_I_GPSRST, 0, SENSLOG_TYPE_CMD_INPUT, POS_SENSLOG_TYPE_CMD },
+ {SENSLOG_DATA_I_GPSSET, 0, SENSLOG_TYPE_CMD_INPUT, POS_SENSLOG_TYPE_CMD },
+ {SENSLOG_DATA_I_NAVSVINFO, 0, SENSLOG_TYPE_GPS_INPUT, POS_SENSLOG_TYPE_GPS },
+ {SENSLOG_DATA_I_SYS_ABNORMAL, 0, SENSLOG_TYPE_SYS_INPUT, POS_SENSLOG_TYPE_SYS },
+ {SENSLOG_DATA_I_UNSPECIFIED, 0, SENSLOG_TYPE_COUNT, POS_SENSLOG_TYPE_NONE }
+};
+
+const SENSLOG_ID_TBL kSensLogOutputTbl[] = {
+ /* Data type DID Sensor Log Type FRAMEWORKUNIFIEDLOG Output Type */
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_SPEED_PULSE, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_SPEED_KMPH, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_X, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_Y, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_Z, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_X, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_Y, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_Z, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS_ANTENNA, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_SNS_COUNTER, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_SPEED_PULSE_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_X_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_Y_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_Z_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, VEHICLE_DID_GPS__CWORD82__NMEA, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS__CWORD82___CWORD44_GP4, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS__CWORD82__FULLBINARY, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS_NMEA, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_REV, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_REV_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_TEMP, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_TEMP_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_X_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_Y_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_Z_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_PULSE_TIME, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS_CLOCK_DRIFT, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS_CLOCK_FREQ, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS_PKG, 0, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_GPS, 0, SENSLOG_TYPE_CMD_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_LONLAT_N, VEHICLE_DID_LOCATION_LONLAT_NAVI, SENSLOG_TYPE_NAVI_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_LONLAT_G, VEHICLE_DID_LOCATION_LONLAT, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_ALT, VEHICLE_DID_LOCATION_ALTITUDE, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SPEED_N, VEHICLE_DID_MOTION_SPEED_NAVI, SENSLOG_TYPE_NAVI_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SPEED_P, VEHICLE_DID_MOTION_SPEED_INTERNAL, SENSLOG_TYPE_POS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_HEAD_N, VEHICLE_DID_MOTION_HEADING_NAVI, SENSLOG_TYPE_NAVI_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_HEAD_G, VEHICLE_DID_MOTION_HEADING, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_TIME_SETREQ, VEHICLE_DID_SETTINGTIME, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_TIME, POSHAL_DID_GPS_TIME, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_GPSINF, VEHICLE_DID_NAVIINFO_DIAG_GPS, SENSLOG_TYPE_NAVI_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_TIME_CS, 0, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_GPSRST, 0, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+
+ {SENSLOG_DATA_O_UNSPECIFIED, 0, SENSLOG_TYPE_COUNT, POS_SENSLOG_TYPE_NONE }
+};
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Sensor Log Initial Processing
+ *
+ * @param[in] p_mount_path Mount path
+ */
+void SensLogInitialize(uint8_t *p_mount_path) {
+ static SENSLOG_INFO st_sens_log_info; /* Coverity CID:23609 compliant */
+ uint8_t uc_hw[16]; /* HW name */
+ uint8_t ret = 0;
+ uint8_t i;
+ static uint8_t tzset_flag = 0; /* Not initialized */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ /* Not initialized */
+ if (tzset_flag == 0) {
+ tzset();
+ tzset_flag = 1; /* Initialization complete */
+ }
+
+ /* Initialization of sensor log information structure */
+ memset(&g_sens_log_info, 0, sizeof(g_sens_log_info));
+
+ /* Get mount path */
+ memset(&g_mount_path[0], 0, sizeof(g_mount_path));
+ if (NULL == p_mount_path) {
+ snprintf(reinterpret_cast<char*>(&g_mount_path[0]), sizeof(g_mount_path), SENSLOG_CONFIG_FILE_PATH_2);
+ } else {
+ snprintf(reinterpret_cast<char*>(&g_mount_path[0]), sizeof(g_mount_path), "%s/", p_mount_path);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "mount path[%s]", g_mount_path);
+
+ /* HW judgment */
+ memset(&uc_hw[0], 0, sizeof(uc_hw));
+ g_unit_type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == g_unit_type) {
+ /* GRADE1 */
+ snprintf(reinterpret_cast<char*>(&uc_hw[0]), sizeof(uc_hw), "GRADE1");
+ } else if (UNIT_TYPE_GRADE2 == g_unit_type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ } else {
+ /* Environment error */
+ /* Do not output sensor log */
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Environment Error.");
+ ret = 1;
+ }
+
+ /* Get Semaphore ID */
+ g_sem_id = _pb_CreateSemaphore(const_cast<char *>(SENSLOG_SEMAPHO_NAME));
+ if (g_sem_id == 0) { // LCOV_EXCL_BR_LINE 200: can not return zero
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Semaphore create Error.(ID = 0)");
+ ret = 1;
+ // LCOV_EXCL_STOP
+ }
+
+ if (ret == 0) {
+ /* Read config files */
+ /* SYS */
+ memset(&st_sens_log_info, 0, sizeof(SENSLOG_INFO));
+ SensLogGetConfig((const uint8_t*)SENSLOG_CONFIG_FILE_NAME_SYS, &st_sens_log_info);
+ if (st_sens_log_info.uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ st_sens_log_info.us_gen_count = 1;
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_SYS_INPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_SYS_OUTPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_SYS_INPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_SYS_INPUT].uc_file_name), "POS_%s_sys_i_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_SYS_OUTPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_SYS_OUTPUT].uc_file_name), "POS_%s_sys_o_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_SYS_INPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_SYS_INPUT].uc_gen_fname), "POS_%s_sys_i_gen.dat", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_SYS_OUTPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_SYS_OUTPUT].uc_gen_fname), "POS_%s_sys_o_gen.dat", uc_hw);
+ SensLogOutputGenFile(SENSLOG_TYPE_SYS_INPUT);
+ SensLogOutputGenFile(SENSLOG_TYPE_SYS_OUTPUT);
+ }
+
+ /* GPS */
+ memset(&st_sens_log_info, 0, sizeof(SENSLOG_INFO));
+ SensLogGetConfig((const uint8_t*)SENSLOG_CONFIG_FILE_NAME_GPS, &st_sens_log_info);
+ if (st_sens_log_info.uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ st_sens_log_info.us_gen_count = 1;
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_GPS_INPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_GPS_OUTPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_GPS_INPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_GPS_INPUT].uc_file_name), "POS_%s_gps_i_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_GPS_OUTPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_GPS_OUTPUT].uc_file_name), "POS_%s_gps_o_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_GPS_INPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_GPS_INPUT].uc_gen_fname), "POS_%s_gps_i_gen.dat", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_GPS_OUTPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_GPS_OUTPUT].uc_gen_fname), "POS_%s_gps_o_gen.dat", uc_hw);
+ SensLogOutputGenFile(SENSLOG_TYPE_GPS_INPUT);
+ SensLogOutputGenFile(SENSLOG_TYPE_GPS_OUTPUT);
+ }
+
+ /* NAVI */
+ memset(&st_sens_log_info, 0, sizeof(SENSLOG_INFO));
+ SensLogGetConfig((const uint8_t*)SENSLOG_CONFIG_FILE_NAME_NAVI, &st_sens_log_info);
+ if (st_sens_log_info.uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ st_sens_log_info.us_gen_count = 1;
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_NAVI_INPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_NAVI_OUTPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_NAVI_INPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_NAVI_INPUT].uc_file_name), "POS_%s_nav_i_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_NAVI_OUTPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_NAVI_OUTPUT].uc_file_name), "POS_%s_nav_o_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_NAVI_INPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_NAVI_INPUT].uc_gen_fname), "POS_%s_nav_i_gen.dat", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_NAVI_OUTPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_NAVI_OUTPUT].uc_gen_fname), "POS_%s_nav_o_gen.dat", uc_hw);
+ SensLogOutputGenFile(SENSLOG_TYPE_NAVI_INPUT);
+ SensLogOutputGenFile(SENSLOG_TYPE_NAVI_OUTPUT);
+ }
+
+ /* POS */
+ memset(&st_sens_log_info, 0, sizeof(SENSLOG_INFO));
+ SensLogGetConfig((const uint8_t*)SENSLOG_CONFIG_FILE_NAME_POS, &st_sens_log_info);
+ if (st_sens_log_info.uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ st_sens_log_info.us_gen_count = 1;
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_POS_OUTPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_POS_OUTPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_POS_OUTPUT].uc_file_name), "POS_%s_pos_o_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_POS_OUTPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_POS_OUTPUT].uc_gen_fname), "POS_%s_pos_o_gen.dat", uc_hw);
+ SensLogOutputGenFile(SENSLOG_TYPE_POS_OUTPUT);
+ }
+
+ /* CMD */
+ memset(&st_sens_log_info, 0, sizeof(SENSLOG_INFO));
+ SensLogGetConfig((const uint8_t*)SENSLOG_CONFIG_FILE_NAME_CMD, &st_sens_log_info);
+ if (st_sens_log_info.uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ st_sens_log_info.us_gen_count = 1;
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_CMD_INPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_CMD_OUTPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_CMD_INPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_CMD_INPUT].uc_file_name), "POS_%s_cmd_i_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_CMD_OUTPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_CMD_OUTPUT].uc_file_name), "POS_%s_cmd_o_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_CMD_INPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_CMD_INPUT].uc_gen_fname), "POS_%s_cmd_i_gen.dat", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_CMD_OUTPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_CMD_OUTPUT].uc_gen_fname), "POS_%s_cmd_o_gen.dat", uc_hw);
+ SensLogOutputGenFile(SENSLOG_TYPE_CMD_INPUT);
+ SensLogOutputGenFile(SENSLOG_TYPE_CMD_OUTPUT);
+ }
+
+ /* NAV-SVINFO */
+ SensLogCheckNAVSVINFOFile();
+ }
+
+ for (i = 0; i < SENSLOG_TYPE_COUNT; i++) {
+ if (g_sens_log_info[i].uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].uc_valid_flag:%d", i, g_sens_log_info[i].uc_valid_flag);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].st_gen.us_len:%d", i, g_sens_log_info[i].st_gen.us_len);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].st_gen.uc_gen:%d", i, g_sens_log_info[i].st_gen.uc_gen);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].us_file_rec_count:%d", i, g_sens_log_info[i].us_file_rec_count);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].us_rec_count:%d", i, g_sens_log_info[i].us_rec_count);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].us_gen_count:%d", i, g_sens_log_info[i].us_gen_count);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].uc_file_path:%s", i, g_sens_log_info[i].uc_file_path);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].uc_file_name:%s", i, g_sens_log_info[i].uc_file_name);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].uc_gen_fname:%s", i, g_sens_log_info[i].uc_gen_fname);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].ul_text_buf_size:%d", i, g_sens_log_info[i].ul_text_buf_size);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log stop processing
+ */
+void SensLogTerminate(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Initialization of sensor log information structure */
+ memset(&g_sens_log_info, 0, sizeof(g_sens_log_info));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log saving process
+ */
+void SensLogStore(void) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uint8_t i;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ for (i = 0; i < SENSLOG_TYPE_COUNT; i++) {
+ /* Output buffering log */
+ if ((g_sens_log_info[i].uc_valid_flag == SENSLOG_VALIDFLAG_ON) &&
+ (g_sens_log_info[i].ul_text_buf_len > 0)) {
+ SensLogOutputFile(i);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Sensor log config file information acquisition
+ *
+ * @param[in] uc_config_file Config filename
+ * @param[out] st_sens_log_info Sensor log information
+ */
+static void SensLogGetConfig(const uint8_t* uc_config_file, SENSLOG_INFO* st_sens_log_info) {
+ FILE* fp;
+ uint8_t uc_file_path[SENSLOG_FILEPATH_SIZE];
+ uint8_t uc_file_name[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+ uint8_t ucBuf[SENSLOG_CONFIG_TEXT_SIZE];
+ uint8_t uc_val[SENSLOG_CONFIG_TEXT_SIZE];
+ uint8_t flag = 0;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ if ((uc_config_file == NULL) || (st_sens_log_info == NULL)) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Unprocessed if the argument is invalid. */
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Parameter Error.");
+ // LCOV_EXCL_STOP
+ } else {
+ memset(&uc_file_path, 0, sizeof(uc_file_path));
+ memset(&uc_file_name, 0, sizeof(uc_file_name));
+
+ /* Refer to the config files in the built-in memory. */
+ snprintf(reinterpret_cast<char*>(&uc_file_path[0]), sizeof(uc_file_path), \
+ SENSLOG_CONFIG_FILE_PATH_1);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name), \
+ "%s%s", uc_file_path, uc_config_file);
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "r");
+ if (NULL == fp) {
+ /* If there are no config files in the built-in memory, refer to the USB memory. */
+ snprintf(reinterpret_cast<char*>(&uc_file_path[0]), sizeof(uc_file_path), \
+ "%s", (const char*)&g_mount_path[0]);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name), \
+ "%s%s", uc_file_path, uc_config_file);
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "r");
+ }
+
+ if (NULL == fp) {
+ /* Do not print when there are no config files.(Console log output)*/
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "Not SensorLog config file. [%s]", uc_file_name);
+ } else {
+ /* Read config files */
+ for (;;) {
+ if (fgets(reinterpret_cast<char*>(&ucBuf), SENSLOG_CONFIG_TEXT_SIZE, fp) == NULL) {
+ /* EOF detection(Fail-safe:Normally it does not pass because it is break at the flag judgment place.)*/
+ break;
+ }
+ memset(&uc_val, 0, sizeof(uc_val));
+ if ((strncmp(reinterpret_cast<char*>(&ucBuf), SENSLOG_CONFIG_KEY_LEN, \
+ strlen(SENSLOG_CONFIG_KEY_LEN)) == 0) && ((flag & 0x01) != 0x01)) {
+ /* Get record length */
+ SensLogGetConfigVal(ucBuf, uc_val);
+ st_sens_log_info->st_gen.us_len = static_cast<uint16_t>(atoi((const char *)uc_val));
+ flag ^= 0x01;
+ } else if ((strncmp(reinterpret_cast<char*>(&ucBuf), SENSLOG_CONFIG_KEY_GEN, \
+ strlen(SENSLOG_CONFIG_KEY_GEN)) == 0) && ((flag & 0x02) != 0x02)) {
+ /* Get number of generations */
+ SensLogGetConfigVal(ucBuf, uc_val);
+ st_sens_log_info->st_gen.uc_gen = static_cast<uint16_t>(atoi((const char *)uc_val));
+ flag ^= 0x02;
+ } else {
+ /* nop */
+ }
+
+ if (flag == 0x03) {
+ break;
+ }
+ }
+ fclose(fp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "SensorLog read : file[%s] : config[0x%02x]", uc_file_name, flag);
+
+ if ((st_sens_log_info->st_gen.us_len < SENSLOG_LEN_MIN) \
+ || (st_sens_log_info->st_gen.us_len > SENSLOG_LEN_MAX)) {
+ /* The default value is applied if it is outside the valid range. */
+ st_sens_log_info->st_gen.us_len = SENSLOG_LEN_DEFAULT;
+ }
+ if ((st_sens_log_info->st_gen.uc_gen < SENSLOG_GEN_MIN) \
+ || (st_sens_log_info->st_gen.uc_gen > SENSLOG_GEN_MAX)) {
+ /* The default value is applied if it is outside the valid range. */
+ st_sens_log_info->st_gen.uc_gen = SENSLOG_GEN_DEFAULT;
+ }
+ st_sens_log_info->ul_text_buf_size = SENSLOG_BUF_MAX; /* Static area(Maximum security) */
+
+ st_sens_log_info->uc_valid_flag = SENSLOG_VALIDFLAG_ON;
+ st_sens_log_info->uc_output_flag = SENSLOG_OUTPUTFLAG_NEW;
+ /* The log output path should be the same path as the config file. */
+ memcpy(st_sens_log_info->uc_file_path, uc_file_path, SENSLOG_FILEPATH_SIZE);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log config file setting value acquisition
+ *
+ * @param[in] uc_text Config setting information
+ * @param[out] uc_val Config setting
+ */
+static void SensLogGetConfigVal(uint8_t* uc_text, uint8_t* uc_val) {
+ uint8_t ucBuf[SENSLOG_CONFIG_TEXT_SIZE];
+ uint16_t i = 0;
+ uint16_t j = 0;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ if ((uc_text == NULL) || (uc_val == NULL)) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Unprocessed if the argument is invalid. */
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Parameter Error.");
+ // LCOV_EXCL_STOP
+ } else {
+ memset(ucBuf, 0, sizeof(ucBuf));
+ while ((*uc_text != ':') && (*uc_text != '\0')) {
+ uc_text++;
+ i++;
+ if (i >= (SENSLOG_CONFIG_TEXT_SIZE - 1)) {
+ break;
+ }
+ }
+ while ((*uc_text != '\r') && (*uc_text != '\n') && (*uc_text != '\0')) {
+ uc_text++;
+ i++;
+ ucBuf[j++] = *uc_text;
+ if (i >= SENSLOG_CONFIG_TEXT_SIZE) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&ucBuf, 0, sizeof(ucBuf));
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+ memcpy(uc_val, ucBuf, sizeof(ucBuf));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Acquisition of sensor log NAV-SVINFO file information
+ *
+ * @param[in] none
+ */
+static void SensLogCheckNAVSVINFOFile(void) {
+ FILE* fp;
+ const uint8_t* uc_config_file;
+ uint8_t uc_file_path[SENSLOG_FILEPATH_SIZE];
+ uint8_t uc_file_name[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ uc_config_file = (const uint8_t*)SENSLOG_NAV_SVINFO_FILE_NAME;
+
+ memset(&uc_file_path, 0, sizeof(uc_file_path));
+ memset(&uc_file_name, 0, sizeof(uc_file_name));
+
+ /* Refer to the config files in the built-in memory. */
+ snprintf(reinterpret_cast<char*>(&uc_file_path[0]), sizeof(uc_file_path), SENSLOG_CONFIG_FILE_PATH_1);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name), "%s%s", uc_file_path, uc_config_file);
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "r");
+ if (NULL == fp) {
+ /* If there are no config files in the built-in memory, refer to the USB memory. */
+ snprintf(reinterpret_cast<char*>(&uc_file_path[0]), sizeof(uc_file_path), \
+ "%s", (const char*)&g_mount_path[0]);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name), \
+ "%s%s", uc_file_path, uc_config_file);
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "r");
+ }
+
+ if (NULL == fp) {
+ /* Do not print when there are no config files.(Console log output)*/
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "Not SensorLog config file. [%s]", uc_file_name);
+ g_navsv_info_flag = FALSE;
+ } else {
+ fclose(fp);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "SensorLog read : file[%s]", uc_file_name);
+ g_navsv_info_flag = TRUE;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Acquisition of sensor log NAV-SVINFO file information
+ *
+ * @param[in] none
+ *
+ * @return Destination sensor log file type
+ */
+uint8_t SensLogGetNavSvinfoFlag(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return g_navsv_info_flag;
+}
+// LCOV_EXCL_STOP
+/**
+ * @brief
+ * Sensor log output(Input information)
+ *
+ * Writes the specified log (input information) to the buffer area
+ *
+ * @param[in] us_data_type Data type
+ * @param[in] ul_did Data ID
+ * @param[in] us_pno Destination PNO
+ * @param[in] p_data Write data pointer
+ * @param[in] us_size Write data size
+ * @param[in] uc_result Reception result
+ * @param[in] u_write_flag ability to write sensor log
+ * @param[in] u_write_abnormal_flag When an error occurs ability to write sensor log
+ */
+void SensLogWriteInputData(uint16_t us_data_type, DID ul_did, PNO us_pno, uint8_t *p_data, \
+ uint16_t us_size, uint8_t uc_result, uint8_t u_write_flag, uint8_t u_write_abnormal_flag) {
+ uint16_t file_type = 0;
+ uint16_t data_type = us_data_type;
+ uint16_t write_type = POS_SENSLOG_TYPE_NONE;
+ RET_API lret_sem = RET_ERROR;
+
+ /* Sensor log file type determination */
+ file_type = SensLogGetFileType(kSensLogInputTbl, &data_type, &write_type, ul_did);
+
+ /* For the target type,Perform exclusive control */
+ /* Currently, only GPS input can be written from multiple threads. */
+ if (file_type == SENSLOG_TYPE_GPS_INPUT) {
+ /* Semaphore ID determination */
+ if (g_sem_id != 0) { // LCOV_EXCL_BR_LINE 200: can not zero
+ lret_sem = _pb_SemLock(g_sem_id); /* Semaphore Lock */
+ if (lret_sem != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not return error
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "SemLock Error.");
+ // LCOV_EXCL_STOP
+ } else {
+ /* Sensor log output */
+ SensLogWrite(file_type, data_type, write_type, ul_did, us_pno, p_data, \
+ us_size, uc_result, u_write_flag, u_write_abnormal_flag);
+ (void)_pb_SemUnlock(g_sem_id); /* Semaphore unlock */
+ }
+ }
+ } else {
+ /* Sensor log output */
+ SensLogWrite(file_type, data_type, write_type, ul_did, us_pno, p_data, us_size, \
+ uc_result, u_write_flag, u_write_abnormal_flag);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log output(Outputs the information)
+ *
+ * Writes the specified log (output information) to the buffer area
+ *
+ * @param[in] us_data_type Data type
+ * @param[in] ul_did Data ID
+ * @param[in] us_pno Destination PNO
+ * @param[in] p_data Write data pointer
+ * @param[in] us_size Write data size
+ * @param[in] uc_result Reception result
+ */
+void SensLogWriteOutputData(uint16_t us_data_type, DID ul_did, PNO us_pno, uint8_t *p_data, \
+ uint16_t us_size, uint8_t uc_result) {
+ uint16_t file_type = 0;
+ uint16_t data_type = us_data_type;
+ uint16_t write_type = POS_SENSLOG_TYPE_NONE;
+ RET_API lret_sem = RET_ERROR;
+
+ /* Sensor log file type determination */
+ file_type = SensLogGetFileType(kSensLogOutputTbl, &data_type, &write_type, ul_did);
+
+ /* For the target type,Perform exclusive control */
+ /* Currently, only GPS output can be written from multiple threads. */
+ if (file_type == SENSLOG_TYPE_GPS_OUTPUT) {
+ /* Semaphore ID determination */
+ if (g_sem_id != 0) { // LCOV_EXCL_BR_LINE 200: can not zero
+ lret_sem = _pb_SemLock(g_sem_id); /* Semaphore Lock */
+ if (lret_sem != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not return error
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "SemLock Error.");
+ // LCOV_EXCL_STOP
+ } else {
+ /* Sensor log output */
+ SensLogWrite(file_type, data_type, write_type, ul_did, us_pno, p_data, \
+ us_size, uc_result, SENSLOG_ON, SENSLOG_OFF);
+ (void)_pb_SemUnlock(g_sem_id); /* Semaphore unlock */
+ }
+ }
+ } else {
+ /* Sensor log output */
+ SensLogWrite(file_type, data_type, write_type, ul_did, us_pno, p_data, us_size, \
+ uc_result, SENSLOG_ON, SENSLOG_OFF);
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Convert number to ASCII code(For two digits,Fill up to zero)
+ *
+ * @param[out] buf Data saving
+ * @param[in] num Numbers to be converted
+ */
+static void Num2String2Digit(uint8_t* buf, uint32_t num) {
+ int8_t c;
+ if (num >= 100) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *buf++ = '0';
+ *buf = '0';
+ // LCOV_EXCL_STOP
+ } else {
+ c = static_cast<int8_t>(num / 10);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ *buf = static_cast<uint8_t>(num - (c * 10) + '0');
+ }
+}
+
+/**
+ * @brief
+ * Convert number to ASCII code(For 3 digits,Fill up to zero)
+ *
+ * @param[out] buf Data saving
+ * @param[in] num Numbers to be converted
+ */
+static void Num2String3Digit(uint8_t* buf, uint32_t num) {
+ int8_t c;
+ if (num >= 1000) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *buf++ = '0';
+ *buf++ = '0';
+ *buf = '0';
+ // LCOV_EXCL_STOP
+ } else {
+ c = static_cast<int8_t>(num / 100);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ num = num - (c * 100);
+ c = static_cast<int8_t>(num / 10);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ *buf = static_cast<uint8_t>(num - (c * 10) + '0');
+ }
+}
+
+/**
+ * @brief
+ * Convert number to ASCII code(For 4 digits,Fill up to zero)
+ *
+ * @param[out] buf Data saving
+ * @param[in] num Numbers to be converted
+ */
+static void Num2String4Digit(uint8_t* buf, uint32_t num) {
+ int8_t c;
+ if (num >= 10000) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *buf++ = '0';
+ *buf++ = '0';
+ *buf++ = '0';
+ *buf = '0';
+ // LCOV_EXCL_STOP
+ } else {
+ c = static_cast<int8_t>(num / 1000);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ num = num - (c * 1000);
+ c = static_cast<int8_t>(num / 100);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ num = num - (c * 100);
+ c = static_cast<int8_t>(num / 10);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ *buf = static_cast<uint8_t>(num - (c * 10) + '0');
+ }
+}
+
+/**
+ * @brief
+ * Convert digits to hexadecimal ASCII code(Fill up to zero)
+ *
+ * @param[out] buf Data saving
+ * @param[in] Number of digits to be converted to digits
+ * @param[in] num Numbers to be converted
+ */
+static void Num2HexString(uint8_t* buf, uint8_t digits, uint32_t num) {
+ uint8_t* p = buf + digits;
+ uint8_t calc;
+ int32_t i;
+
+ /* Only within the displayable range,Convert */
+ if ((digits == 8) || (num < (uint32_t)(1 << (4 *digits)))) {
+ while (num) {
+ calc = num % 16;
+ if (10 > calc) {
+ calc = static_cast<uint8_t>(calc + 0x30); // 0x30 is 0 character
+ } else {
+ calc = static_cast<uint8_t>(calc + (0x61 - 0x0A)); // 0x41 is the letter of a
+ }
+ *(--p) = calc;
+ num /= 16;
+ digits--;
+ }
+ }
+
+ /* Insert 0 in the remaining significant digits. */
+ for (i = 0; i < digits; i++) {
+ *(--p) = '0';
+ }
+}
+
+/**
+ * @brief
+ * Sensor Log Header Creation
+ *
+ * @param[out] buf Data saving
+ * @param[in] DataHeader data headers
+ * @note For buf, Up to 62 bytes are used. As 64 bytes are allocated in the upper digit, Without current problems, dataHeader.c_pname size increase,
+ * Need to be reviewed when changing the format.
+ */
+static void SensLogmakeHeader(uint8_t* buf, SENSLOG_DATA_HEADER dataHeader) {
+ /* "%02d %04d/%02d/%02d %02d:%02d:%02d.%03d %08x %s %01x %01x %04d " */
+ int8_t *p;
+ uint16_t i = 0;
+ Num2String2Digit(buf, dataHeader.us_data_type);
+ buf += 2;
+ *(buf++) = ' ';
+ Num2String4Digit(buf, dataHeader.st_sys_time.us_year);
+ buf += 4;
+ *(buf++) = '/';
+ Num2String2Digit(buf, dataHeader.st_sys_time.us_month);
+ buf += 2;
+ *(buf++) = '/';
+ Num2String2Digit(buf, dataHeader.st_sys_time.us_day);
+ buf += 2;
+ *(buf++) = ' ';
+ Num2String2Digit(buf, dataHeader.st_sys_time.us_hour);
+ buf += 2;
+ *(buf++) = ':';
+ Num2String2Digit(buf, dataHeader.st_sys_time.us_minute);
+ buf += 2;
+ *(buf++) = ':';
+ Num2String2Digit(buf, dataHeader.st_sys_time.us_second);
+ buf += 2;
+ *(buf++) = '.';
+ Num2String3Digit(buf, dataHeader.st_sys_time.us_milli_seconds);
+ buf += 3;
+ *(buf++) = ' ';
+ Num2HexString(buf, 8, dataHeader.ul_did);
+ buf += 8;
+ *(buf++) = ' ';
+ p = dataHeader.c_pname;
+ for (i = 0; i < sizeof(dataHeader.c_pname); i++) {
+ if (*p == 0) {
+ break;
+ }
+ *(buf++) = *(p++);
+ }
+ *(buf++) = ' ';
+ Num2HexString((buf++), 1, dataHeader.uc_unit_type);
+ *(buf++) = ' ';
+ Num2HexString((buf++), 1, dataHeader.uc_result);
+ *(buf++) = ' ';
+ Num2String4Digit(buf, dataHeader.us_data_size);
+ buf += 4;
+ *(buf++) = ' ';
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log output
+ *
+ * Write specified log to buffer area(Common process)
+ *
+ * @param[in] us_file_type File type
+ * @param[in] us_data_type Data type
+ * @param[in] us_write_type FRAMEWORKUNIFIEDLOG Output Type
+ * @param[in] ul_did Data ID
+ * @param[in] us_pno Destination PNO
+ * @param[in] p_data Write data pointer
+ * @param[in] us_size Write data size
+ * @param[in] uc_result Reception result
+ * @param[in] uWriteFlag ability to write sensor log
+ * @param[in] u_write_abnormal_flag When an error occursability to write sensor log
+ */
+static void SensLogWrite(uint16_t us_file_type, uint16_t us_data_type, uint16_t us_write_type, \
+ DID ul_did, PNO us_pno, uint8_t *p_data, uint16_t us_size, uint8_t uc_result, uint8_t uWriteFlag, \
+ uint8_t u_write_abnormal_flag) {
+ uint32_t len = 0;
+ SENSLOG_DATA_HEADER dataHeader;
+ uint16_t headSize = sizeof(SENSLOG_DATA_HEADER);
+ uint16_t i = 0;
+ uint8_t workBuf[64];
+ uint16_t workBufLen = 0;
+ PCSTR pPname = NULL;
+ uint32_t ulTempBufLen;
+ uint32_t ulPositioninglogBufLen = SENSLOG_BUF_MAX;
+ uint32_t retComp;
+
+ if ((p_data == NULL) || (us_size == 0) || (us_size > SENSLOG_BUF_MIN)) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ /* Unprocessed if write specified log data is invalid */
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Parameter Error. File[%d] Data[%d] DID[%d] Size[%d]",
+ us_file_type, us_data_type, ul_did, us_size);
+ } else {
+ /* Sensor log file type determination */
+ if (us_file_type < SENSLOG_TYPE_COUNT) {
+ if ((g_sens_log_info[us_file_type].uc_valid_flag == SENSLOG_VALIDFLAG_ON) ||
+ (us_write_type != POS_SENSLOG_TYPE_NONE)) {
+ /* Setting of header information */
+ memset(&dataHeader, 0x00, sizeof(dataHeader));
+ dataHeader.us_data_type = us_data_type;
+ SensLogGetSystemTime(&dataHeader.st_sys_time);
+ dataHeader.ul_did = ul_did;
+ pPname = _pb_CnvPno2Name(us_pno);
+ if (pPname == NULL) {
+ dataHeader.c_pname[0] = '-';
+ } else {
+ snprintf(reinterpret_cast<char *>(&(dataHeader.c_pname[0])), \
+ sizeof(dataHeader.c_pname), "%s", pPname);
+ }
+ dataHeader.uc_unit_type = (uint8_t)g_unit_type;
+ dataHeader.uc_result = uc_result;
+ dataHeader.us_data_size = us_size;
+
+ /* Buffer storage(Header)*/
+ memset(&workBuf[0], 0x00, sizeof(workBuf));
+ SensLogmakeHeader(workBuf, dataHeader);
+ workBufLen = static_cast<uint16_t>(strlen(reinterpret_cast<char *>(&(workBuf[0]))));
+ memcpy(reinterpret_cast<char *>(&(g_sens_log_info[us_file_type].uc_temp_buf[0])), \
+ &workBuf[0], workBufLen);
+
+ /* Buffer storage(Data portion)*/
+ for (i = 0; i < us_size; i++) {
+ Num2HexString(&(g_sens_log_info[us_file_type].uc_temp_buf[workBufLen + i * 3]), 2, *p_data);
+ g_sens_log_info[us_file_type].uc_temp_buf[workBufLen + i * 3 + 2] = ' ';
+ g_sens_log_info[us_file_type].uc_temp_buf[workBufLen + i * 3 + 3] = 0; /* NULL */
+ p_data++;
+ }
+ g_sens_log_info[us_file_type].uc_temp_buf[workBufLen + (us_size * 3)] = '\r';
+ g_sens_log_info[us_file_type].uc_temp_buf[workBufLen + (us_size * 3) + 1] = '\n';
+ ulTempBufLen = workBufLen + (us_size * 3) + 2;
+
+ /* FRAMEWORKUNIFIEDLOG out */
+ if ((us_file_type == SENSLOG_TYPE_NAVI_INPUT) || (us_file_type == SENSLOG_TYPE_NAVI_OUTPUT)) {
+ if (g_unit_type != UNIT_TYPE_GRADE1) {
+ /* Sensor log is not output when an error occurs except for _CWORD80_ in NAV. */
+ u_write_abnormal_flag = 0;
+ }
+ }
+ if ((us_write_type != POS_SENSLOG_TYPE_NONE) && (u_write_abnormal_flag == SENSLOG_ON)) {
+ /* Data compression */
+ retComp = compress2(reinterpret_cast<Bytef*>(&(g_sens_log_info[us_file_type]. \
+ uc_positioninglog_buf[SENSLOG_SEQ_SIZE + sizeof(ulPositioninglogBufLen)])), \
+ reinterpret_cast<uLongf*>(&ulPositioninglogBufLen), \
+ reinterpret_cast<Bytef*>(&(g_sens_log_info[us_file_type].uc_temp_buf[0])), \
+ ulTempBufLen, Z_DEFAULT_COMPRESSION);
+
+ if (retComp == Z_OK) {
+ memcpy(&(g_sens_log_info[us_file_type].uc_positioninglog_buf[0]), \
+ SENSLOG_SEQ_START, SENSLOG_SEQ_SIZE);
+ memcpy(&(g_sens_log_info[us_file_type].uc_positioninglog_buf[SENSLOG_SEQ_SIZE]), \
+ &ulPositioninglogBufLen, sizeof(ulPositioninglogBufLen));
+ memcpy(&(g_sens_log_info[us_file_type].uc_positioninglog_buf[SENSLOG_SEQ_SIZE \
+ + sizeof(ulPositioninglogBufLen) + ulPositioninglogBufLen]), SENSLOG_SEQ_END, SENSLOG_SEQ_SIZE);
+ g_sens_log_info[us_file_type].uc_positioninglog_buf[SENSLOG_SEQ_SIZE + sizeof(ulPositioninglogBufLen) \
+ + ulPositioninglogBufLen + SENSLOG_SEQ_SIZE] = '\n';
+ ulPositioninglogBufLen = static_cast<uint32_t>(SENSLOG_SEQ_SIZE + sizeof(ulPositioninglogBufLen) \
+ + ulPositioninglogBufLen + SENSLOG_SEQ_SIZE + 1);
+ POS_SENSLOG(us_write_type, (PCSTR)&(g_sens_log_info[us_file_type].uc_positioninglog_buf[0]), \
+ ulPositioninglogBufLen);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, \
+ "compress error[retComp = %d]", retComp);
+ }
+ }
+
+ if ((g_sens_log_info[us_file_type].uc_valid_flag == SENSLOG_VALIDFLAG_ON) \
+ && (uWriteFlag == SENSLOG_ON)) {
+ /* For executing file output */
+ /* Buffer size determination */
+ len = g_sens_log_info[us_file_type].ul_text_buf_len;
+ if (g_sens_log_info[us_file_type].ul_text_buf_size <= (len + ((headSize + us_size) * 3))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[%d]:DataSize[%d]/BufLen[%d]",
+ us_data_type, us_size, len);
+
+ /* In case of buffer upper limit,Write File */
+ SensLogOutputFile(static_cast<uint8_t>(us_file_type));
+
+ /* Buffer clear */
+ memset(&(g_sens_log_info[us_file_type].uc_text_buf[0]), 0x00,
+ g_sens_log_info[us_file_type].ul_text_buf_size);
+ len = 0;
+ }
+
+ /* Buffer storage */
+ memcpy(reinterpret_cast<char*>(&(g_sens_log_info[us_file_type].uc_text_buf[len])), \
+ &g_sens_log_info[us_file_type].uc_temp_buf[0], ulTempBufLen);
+ g_sens_log_info[us_file_type].ul_text_buf_len = len + ulTempBufLen;
+ g_sens_log_info[us_file_type].us_rec_count++;
+
+ /* Determining whether the number of file write records is the upper limit (the number of records per file) */
+ if (g_sens_log_info[us_file_type].st_gen.us_len <= g_sens_log_info[us_file_type].us_rec_count) {
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "[%d]:RecCnt[%d/%d]",
+ us_data_type, g_sens_log_info[us_file_type].us_rec_count, \
+ g_sens_log_info[us_file_type].st_gen.us_len);
+
+ /* In case of buffer upper limit,Write File */
+ SensLogOutputFile(static_cast<uint8_t>(us_file_type));
+
+ /* Buffer clear */
+ memset(&(g_sens_log_info[us_file_type].uc_text_buf[0]), 0x00, \
+ g_sens_log_info[us_file_type].ul_text_buf_size);
+ g_sens_log_info[us_file_type].ul_text_buf_len = 0;
+ g_sens_log_info[us_file_type].us_rec_count = 0;
+ /* Update the number of generations */
+ g_sens_log_info[us_file_type].us_gen_count++;
+ if (g_sens_log_info[us_file_type].st_gen.uc_gen < g_sens_log_info[us_file_type].us_gen_count) {
+ g_sens_log_info[us_file_type].us_gen_count = 1;
+ }
+ g_sens_log_info[us_file_type].uc_output_flag = SENSLOG_OUTPUTFLAG_NEW;
+ }
+ }
+ }
+ }
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log file type determination
+ *
+ * Determine the type of the output destination sensor log file
+ *
+ * @param[in] pstTbl Sensor log type definition table
+ * @param[in] Pus_data_type Data type
+ * @param[out] pus_write_type FRAMEWORKUNIFIEDLOG Output Type
+ * @param[in] ul_did Data ID
+ *
+ * @return Destination sensor log file type
+ */
+static uint16_t SensLogGetFileType(const SENSLOG_ID_TBL *pstTbl, uint16_t *pus_data_type, \
+ uint16_t *pus_write_type, DID ul_did) {
+ uint16_t file_type = SENSLOG_TYPE_COUNT;
+ uint16_t cnt = 0;
+
+ /* Determination of output log file type */
+ /* DID,Prioritize the beginning of the table for both data types. */
+ /* If DID is specified, it is judged by DID.*/
+ if (ul_did != 0) {
+ for (cnt = 0; pstTbl[cnt].us_file_type != SENSLOG_TYPE_COUNT; cnt++) {
+ if (pstTbl[cnt].ul_did == ul_did) {
+ *pus_data_type = pstTbl[cnt].us_data_type;
+ file_type = pstTbl[cnt].us_file_type;
+ *pus_write_type = pstTbl[cnt].us_write_type;
+ break;
+ }
+ }
+ }
+ /* If no DID is specified or cannot be found, judge according to the data type. */
+ if (file_type == SENSLOG_TYPE_COUNT) {
+ for (cnt = 0; pstTbl[cnt].us_file_type != SENSLOG_TYPE_COUNT; cnt++) {
+ if (pstTbl[cnt].us_data_type == *pus_data_type) {
+ file_type = pstTbl[cnt].us_file_type;
+ *pus_write_type = pstTbl[cnt].us_write_type;
+ break;
+ }
+ }
+ }
+ return file_type;
+}
+
+/**
+ * @brief
+ * Sensor log file output
+ *
+ * Write the log data in the buffer area to a file
+ *
+ * @param[in] ucFileType File type
+ */
+static void SensLogOutputFile(uint8_t ucFileType) {
+ FILE *fp;
+ int fd;
+ uint8_t uc_file_name_base[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+ uint8_t uc_file_name[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+
+ if (ucFileType < SENSLOG_TYPE_COUNT) { // LCOV_EXCL_BR_LINE 200: can not exceed type
+ /* File path generation */
+ snprintf(reinterpret_cast<char*>(&uc_file_name_base[0]), sizeof(uc_file_name_base),
+ "%s%s",
+ g_sens_log_info[ucFileType].uc_file_path, g_sens_log_info[ucFileType].uc_file_name);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name),
+ reinterpret_cast<char*>(&uc_file_name_base[0]),
+ g_sens_log_info[ucFileType].us_gen_count);
+
+ /* Writing to a File */
+ if (g_sens_log_info[ucFileType].uc_output_flag == SENSLOG_OUTPUTFLAG_NEW) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, \
+ "SensLog create file. : file[%s] : uc_output_flag[%d]", \
+ uc_file_name, g_sens_log_info[ucFileType].uc_output_flag);
+
+ /* Export New File(Write From Beginning)*/
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "w+");
+ g_sens_log_info[ucFileType].uc_output_flag = SENSLOG_OUTPUTFLAG_ADD;
+
+ /* Update generation information file */
+ SensLogOutputGenFile(ucFileType);
+ } else {
+ /* Append export */
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "a+");
+ }
+
+ if (NULL != fp) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ /* Log file output(ASCII)*/
+ fd = fileno(fp);
+ fwrite(&(g_sens_log_info[ucFileType].uc_text_buf[0]), g_sens_log_info[ucFileType].ul_text_buf_len, 1, fp);
+ fflush(fp); /* Flush the userspace buffers provided by the C library */
+ fdatasync(fd); /* Flush cache of files referenced by fd to disk */
+ fclose(fp); /* Coverity CID:23371 compliant */
+ } else {
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "SensLog fopen fail. : file[%s] : uc_output_flag[%d]", \
+ uc_file_name, g_sens_log_info[ucFileType].uc_output_flag);
+ // LCOV_EXCL_STOP
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Generation information file output
+ *
+ * Holds the number of generations being output in the generation information file.
+ *
+ * @param[in] ucFileType File type
+ */
+static void SensLogOutputGenFile(uint8_t ucFileType) {
+ FILE *fp;
+ int fd;
+ uint8_t uc_file_name_base[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+ uint8_t uc_file_name[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+
+ if (ucFileType < SENSLOG_TYPE_COUNT) { // LCOV_EXCL_BR_LINE 200: can not exceed type
+ /* File path generation */
+ snprintf(reinterpret_cast<char*>(&uc_file_name_base[0]), sizeof(uc_file_name_base),
+ "%s%s",
+ g_sens_log_info[ucFileType].uc_file_path, g_sens_log_info[ucFileType].uc_gen_fname);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name),
+ reinterpret_cast<char*>(&uc_file_name_base[0]),
+ g_sens_log_info[ucFileType].us_gen_count);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SensLog create file. : file[%s] : us_gen_count[%d]",
+ uc_file_name, g_sens_log_info[ucFileType].us_gen_count);
+
+ /* Export New File(Write From Beginning)*/
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "w+");
+ if (NULL != fp) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ /* Generation control number output */
+ fd = fileno(fp);
+ fprintf(fp, "%03d", g_sens_log_info[ucFileType].us_gen_count);
+ fflush(fp); /* Flush the userspace buffers provided by the C library */
+ fdatasync(fd); /* Flush cache of files referenced by fd to disk */
+ fclose(fp); /* Coverity CID:23372 compliant */
+ } else {
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "SensLog fopen fail. : file[%s] : us_gen_count[%d]", \
+ uc_file_name, g_sens_log_info[ucFileType].us_gen_count);
+ // LCOV_EXCL_STOP
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Get system time
+ *
+ * Get the system time(Millisecond)
+ *
+ * @param[out] st_sys_time System time
+ */
+void SensLogGetSystemTime(SENSLOG_SYSTEMTIME *st_sys_time) {
+ time_t time_sec = 0;
+ struct timespec tp = {0};
+ struct tm time_cal= {0};
+
+ if (NULL != st_sys_time) { // LCOV_EXCL_BR_LINE 200: not NULL
+ if (0 == clock_gettime(CLOCK_REALTIME, &tp)) {
+ time_sec = tp.tv_sec;
+ localtime_r(&time_sec, &time_cal);
+ st_sys_time->us_year = static_cast<uint16_t>((WORD)time_cal.tm_year + 1900);
+ st_sys_time->us_month = static_cast<uint16_t>((WORD)time_cal.tm_mon + 1);
+ st_sys_time->us_day_of_week = (WORD)time_cal.tm_wday;
+ st_sys_time->us_day = (WORD)time_cal.tm_mday;
+ st_sys_time->us_hour = (WORD)time_cal.tm_hour;
+ st_sys_time->us_minute = (WORD)time_cal.tm_min;
+ st_sys_time->us_second = (WORD)time_cal.tm_sec;
+ st_sys_time->us_milli_seconds = (WORD)(static_cast<double>(tp.tv_nsec) * 1e-6); /* Calculating milliseconds */
+ }
+ }
+ return;
+}
+
+/* end of file */
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_CanDeliveryEntry.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_CanDeliveryEntry.cpp
new file mode 100755
index 0000000..f1cd695
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_CanDeliveryEntry.cpp
@@ -0,0 +1,47 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSensCanDeliveryEntry.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :CAN data delivery registration
+ * Module configuration :VehicleSensCanDeliveryEntry() CAN data delivery registration
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DeliveryCtrl.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensCanDeliveryEntry
+* ABSTRACT : CAN data delivery registration
+* FUNCTION : Register delivery of CAN data required as vehicle sensor middleware
+* ARGUMENT : void
+* NOTE :
+* RETURN : CANIF_RET_NORMAL :Normal completion
+* CANIF_RET_ERROR_CREATE_EVENT :Event generation failure
+* CANIF_RET_ERROR_PARAM :Parameter error
+* CANIF_RET_ERROR_BUFFULL :FULL of delivery registers
+* CANIF_RET_ERROR_CANIDFULL :FULL of delivery CAN ID numbers
+******************************************************************************/
+RET_API VehicleSensCanDeliveryEntry(void) {
+ return RET_NORMAL;
+}
+
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Common.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Common.cpp
new file mode 100755
index 0000000..aeb180e
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Common.cpp
@@ -0,0 +1,429 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Common.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor common processing(VEHICLE_COMMON)
+ * Module configuration :VehicleSensmemcmp() Functions for Common Processing Memory Block Comparisons
+ * VehicleSensCheckDid() Common Processing Data ID Check Function
+ * VehicleSensGetDataMasterOffset() Get function for common processing data master offset value
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_Common.h"
+#include "POS_private.h"
+#include <system_service/ss_ver.h>
+#include <system_service/ss_package.h>
+#include "gps_hal.h"
+#include "VehicleSens_DataMaster.h"
+
+
+#define _pb_strcat(pdest, psrc, size) (strncat(pdest, psrc, size) , (0))
+
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static const VEHICLESENS_DID_OFFSET_TBL kGstDidList[] = {
+ /* Data ID Offset size Reserved */
+ { VEHICLE_DID_DESTINATION, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_HV, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_STEERING_WHEEL, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_VB, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_IG, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MIC, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_BACKDOOR, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_PKB, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_ADIM, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_ILL, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_RHEOSTAT, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_SYSTEMP, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_SPEED_PULSE, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_SPEED_PULSE_FLAG, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_SPEED_KMPH, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_X, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_GYRO_Y, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_GYRO_Z, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_GSNS_X, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GSNS_Y, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GSNS_Z, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_REV, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_ANTENNA, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_SNS_COUNTER, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_GPS_COUNTER, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_VERSION, VEHICLESENS_OFFSET_GPS_FORMAT, {0, 0} },
+ { VEHICLE_DID_LOCATION, VEHICLESENS_OFFSET_GPS_FORMAT, {0, 0} },
+ /* ++GPS _CWORD82_ support */
+ { POSHAL_DID_GPS__CWORD82___CWORD44_GP4, VEHICLESENS_OFFSET_GPS_FORMAT, {0, 0} },
+ { VEHICLE_DID_GPS__CWORD82__NMEA, VEHICLESENS_OFFSET_GPS_NMEA, {0, 0} },
+ { POSHAL_DID_GPS_NMEA, VEHICLESENS_OFFSET_GPS_NMEA, {0, 0} },
+ { POSHAL_DID_GPS__CWORD82__FULLBINARY, VEHICLESENS_OFFSET_GPS_FORMAT, {0, 0} },
+ /* --GPS _CWORD82_ support */
+ { VEHICLE_DID_REV_LINE, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_REV_CAN, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ { POSHAL_DID_GYRO_EXT, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_SPEED_PULSE_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_X_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_Y_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_Z_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_SPEED_PULSE_FLAG_FST, VEHICLESENS_OFFSET_20WORD_FST, {0, 0} },
+ { POSHAL_DID_REV_FST, VEHICLESENS_OFFSET_20WORD_FST, {0, 0} },
+#endif
+ /* ++ PastModel002 support */
+ { VEHICLE_DID_GPS_UBLOX_NAV_POSLLH, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_STATUS, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_VELNED, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_DOP, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_SVINFO, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_CLOCK, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_MON_HW, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GYRO_TROUBLE, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_GYRO_CONNECT_STATUS, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ /* -- PastModel002 support */
+ { POSHAL_DID_GPS_TIME, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_TIME_RAW, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_WKNROLLOVER, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_NAVIINFO_DIAG_GPS, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_TEMP, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_TEMP_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GSNS_X_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GSNS_Y_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GSNS_Z_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_PULSE_TIME, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_LOCATION_LONLAT, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_LOCATION_ALTITUDE, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MOTION_SPEED, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MOTION_HEADING, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_LOCATION_LONLAT_NAVI, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_LOCATION_ALTITUDE_NAVI, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MOTION_SPEED_NAVI, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MOTION_HEADING_NAVI, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_SETTINGTIME, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MOTION_SPEED_INTERNAL, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_CLOCK_DRIFT, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_CLOCK_FREQ, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { 0, 0, {0, 0} } /* Termination code */
+};
+
+/*******************************************************************************
+* MODULE : VehicleSensmemcmp
+* ABSTRACT : Functions for Common Processing Memory Block Comparisons
+* FUNCTION : Memory block comparison processing
+* ARGUMENT : *vp_data1 : Comparison target address 1
+* : *vp_data2 : Comparison target address 2
+* : uc_size : Comparison Size
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* : VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensmemcmp(const void *vp_data1, const void *vp_data2, size_t uc_size) {
+ u_int8 ret = VEHICLESENS_EQ;
+ const u_int8 *ucp_data1 = (const u_int8 *)vp_data1;
+ const u_int8 *ucp_data2 = (const u_int8 *)vp_data2;
+
+ /* Loop by data size */
+ while (uc_size > 0) {
+ if (*ucp_data1 != *ucp_data2) {
+ /* Data mismatch */
+ ret = VEHICLESENS_NEQ;
+ break;
+ }
+ ucp_data1++;
+ ucp_data2++;
+ uc_size--;
+ }
+ return( ret );
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensCheckDid
+* ABSTRACT : Common Processing Data ID Check Function
+* FUNCTION : Check if the specified DID corresponds to the vehicle sensor information
+* ARGUMENT : ul_did : Data ID
+* NOTE :
+* RETURN : VEHICLESENS_INVALID :Disabled
+* : VEHICLESENS_EFFECTIVE :Enabled
+******************************************************************************/
+int32 VehicleSensCheckDid(DID ul_did) {
+ int32 i = 0;
+ int32 ret = VEHICLESENS_INVALID;
+
+ while (0 != kGstDidList[i].ul_did) { // LCOV_EXCL_BR_LINE 200: did always valid
+ if (kGstDidList[i].ul_did == ul_did) {
+ /* DID enabled */
+ ret = VEHICLESENS_EFFECTIVE;
+ break;
+ }
+ i++;
+ }
+ return( ret );
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterOffset
+* ABSTRACT : Get function for common processing data master offset value
+* FUNCTION : Get the fixed offset value for a given DID
+* ARGUMENT : ul_did : Data ID
+* NOTE :
+* RETURN : Offset value(Returns 0 if DID is invalid)
+******************************************************************************/
+u_int16 VehicleSensGetDataMasterOffset(DID ul_did) {
+ int32 i = 0; /* Generic counters */
+ u_int16 ret = 0; /* Return value of this function */
+
+ while (0 != kGstDidList[i].ul_did) { // LCOV_EXCL_BR_LINE 200: did always valid
+ if (kGstDidList[i].ul_did == ul_did) {
+ /* DID enabled */
+ ret = kGstDidList[i].us_offset;
+ break;
+ }
+ i++;
+ }
+ return( ret );
+}
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterExtOffset
+* ABSTRACT : Get function for common processing data master offset value
+* FUNCTION : Get the fixed offset value for the first package delivery of the specified DID
+* ARGUMENT : ul_did : Data ID
+* NOTE :
+* RETURN : Offset value(Returns 0 for unspecified DID)
+******************************************************************************/
+u_int16 VehicleSensGetDataMasterExtOffset(DID ul_did) {
+ u_int16 usRet = 0; /* Return value of this function */
+
+ switch (ul_did) {
+ case POSHAL_DID_GYRO_EXT:
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_Y:
+ case POSHAL_DID_GYRO_Z:
+ case POSHAL_DID_GSNS_X: /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+ case POSHAL_DID_GSNS_Y: /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+ case POSHAL_DID_GSNS_Z:
+ case POSHAL_DID_SPEED_PULSE:
+ {
+ /* Returns the extended package size (one data 2byte) at the time of initial delivery */
+ usRet = VEHICLESENS_OFFSET_10WORD_PKG_EXT;
+ break;
+ }
+ case POSHAL_DID_SNS_COUNTER:
+ case POSHAL_DID_REV:
+ {
+ /* Returns the extended package size (one data 1byte) at the time of initial delivery */
+ usRet = VEHICLESENS_OFFSET_BYTE_PKG_EXT;
+ break;
+ }
+ case POSHAL_DID_GYRO_TEMP:
+ {
+ /* Returns the extended package size (one data 2byte) at the time of initial delivery */
+ usRet = VEHICLESENS_OFFSET_WORD_PKG_EXT;
+ break;
+ }
+ case POSHAL_DID_PULSE_TIME:
+ {
+ /* Returns the expansion package size (132 bytes per data) at the time of initial delivery */
+ usRet = VEHICLESENS_OFFSET_32LONG_PKG_EXT;
+ break;
+ }
+ default: /* Other than the above */ /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+ return( usRet );
+}
+#endif
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+
+/**
+ * @brief
+ * GPS version information setting request
+ *
+ * Request to set GPS version information to SS
+ *
+ * @param[in] pstData Pointer to received message data
+ */
+void VehicleSensSetGpsVersion(const SENSOR_MSG_GPSDATA_DAT *pstData) {
+ static BOOL isExistGpsVersion = FALSE;
+ SSVER_PkgInfo info;
+ CSSVer cssVer;
+ UNIT_TYPE eType = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ EFrameworkunifiedStatus ret;
+
+ if (isExistGpsVersion == FALSE) {
+ memset(&info, 0x00, sizeof(info));
+ /* Supported HW Configuration Check */
+ eType = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == eType) { // LCOV_EXCL_BR_LINE 6:cannot be this env
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* GRADE1 */
+ memcpy(info.version, pstData->uc_data, sizeof(info.version));
+
+ /* Calling setPkgInfo() */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "--- VehicleUtility_SetGpsVersion setPkgInfo -->");
+ ret = cssVer.setPkgInfo(SS_PKG_NAVI_GPS, info);
+ if (ret == eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "--- VehicleUtility_SetGpsVersion setPkgInfo <-- GPSVersion = %s", info.version);
+ isExistGpsVersion = TRUE; /* Update Flag */
+ } else {
+ /* Error log */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set PkgInfo EpositioningStatus = %d", ret);
+ }
+ // LCOV_EXCL_STOP
+ } else if ( UNIT_TYPE_GRADE2 == eType ) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ } else {
+ /* nop */
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+* Acquisition of location and time information (dump)
+ *
+ * @param[out] pBuf Dump information
+ * @param[in] Uc_get_method Retrieval method
+ */
+void VehicleSensGetDebugPosDate(void* pBuf, u_int8 uc_get_method) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[256];
+ VEHICLESENS_DATA_MASTER stSnsData;
+ SENSORLOCATION_LONLATINFO_DAT *pstLonLat;
+ SENSORLOCATION_ALTITUDEINFO_DAT *pstAltitude;
+ SENSORMOTION_HEADINGINFO_DAT *pstHeading;
+ SENSOR_MSG_GPSDATA_DAT stGpsData;
+ SENSOR_MSG_GPSTIME *pstDateTimeGps;
+ NAVIINFO_DIAG_GPS *pstDiagGps;
+ uint8_t i;
+
+ memset(&buf, 0x00, sizeof(buf));
+ /* Title */
+ switch ( uc_get_method ) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ snprintf(reinterpret_cast<char *>(&buf), sizeof(buf), "GPS Info");
+ break;
+ case VEHICLESENS_GETMETHOD_NAVI:
+ snprintf(reinterpret_cast<char *>(&buf), sizeof(buf), "Navi Info");
+ break;
+ default:
+ /* nop */
+ break;
+ }
+
+ /* Latitude,Longitude */
+ VehicleSensGetLocationLonLat(&stSnsData, uc_get_method);
+ pstLonLat = reinterpret_cast<SENSORLOCATION_LONLATINFO_DAT*>(stSnsData.uc_data);
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf( reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [LonLat] sync:%3d, Enable:%01d, Lon:%10d, Lat:%10d, PosSts:0x%02x, PosAcc:0x%04x",
+ pstLonLat->SyncCnt,
+ pstLonLat->isEnable,
+ pstLonLat->Longitude,
+ pstLonLat->Latitude,
+ pstLonLat->posSts,
+ pstLonLat->posAcc);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+
+ /* Altitude */
+ VehicleSensGetLocationAltitude(&stSnsData, uc_get_method);
+ pstAltitude = reinterpret_cast<SENSORLOCATION_ALTITUDEINFO_DAT*>(stSnsData.uc_data);
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [Alt] sync:%3d, Enable:%01d, Alt:%10d",
+ pstAltitude->SyncCnt,
+ pstAltitude->isEnable,
+ pstAltitude->Altitude);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+
+ /* Orientation */
+ VehicleSensGetMotionHeading(&stSnsData, uc_get_method);
+ pstHeading = reinterpret_cast<SENSORMOTION_HEADINGINFO_DAT*>(stSnsData.uc_data);
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [Head] sync:%3d, Enable:%01d, Head:%5d, PosSts:0x%02x",
+ pstHeading->SyncCnt,
+ pstHeading->isEnable,
+ pstHeading->Heading,
+ pstHeading->posSts);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+
+ switch ( uc_get_method ) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ /* Satellite information */
+ VehicleSensGetNaviinfoDiagGPSg(&stGpsData);
+ pstDiagGps = reinterpret_cast<NAVIINFO_DIAG_GPS*>(stGpsData.uc_data);
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [Diag]\n FixSts:0x%02x",
+ pstDiagGps->stFix.ucFixSts);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ for (i = 0; i < 12; i++) {
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] RcvSts:0x%02x, prn:0x%02x, elv:0x%02x, Lv:0x%02x, azm:0x%04x",
+ i,
+ pstDiagGps->stSat.stPrn[i].ucRcvSts,
+ pstDiagGps->stSat.stPrn[i].ucPrn,
+ pstDiagGps->stSat.stPrn[i].ucelv,
+ pstDiagGps->stSat.stPrn[i].ucLv,
+ pstDiagGps->stSat.stPrn[i].usAzm);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ }
+
+ /* Time */
+ VehicleSensGetGpsTime(&stGpsData, VEHICLESENS_GETMETHOD_GPS);
+ pstDateTimeGps = reinterpret_cast<SENSOR_MSG_GPSTIME*>(stGpsData.uc_data);
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [Time] %04d/%02d/%02d %02d:%02d:%02d, sts:%d",
+ pstDateTimeGps->utc.year,
+ pstDateTimeGps->utc.month,
+ pstDateTimeGps->utc.date,
+ pstDateTimeGps->utc.hour,
+ pstDateTimeGps->utc.minute,
+ pstDateTimeGps->utc.second,
+ pstDateTimeGps->tdsts);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ break;
+ case VEHICLESENS_GETMETHOD_NAVI:
+ /* nop */
+ break;
+ default:
+ /* nop */
+ break;
+ }
+ memcpy(pBuf, &buf[0], sizeof(buf));
+ return;
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_DataMasterMain.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_DataMasterMain.cpp
new file mode 100755
index 0000000..7bf40d1
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_DataMasterMain.cpp
@@ -0,0 +1,1880 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_DataMasterMain.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master
+ * Module configuration :VehicleSensInitDataMaster() Vehicle data master initialization function
+ * :VehicleSensSetDataMasterCan() Vehicle sensor data master CAN data set processing
+ * :VehicleSensSetDataMasterLineSens() Vehicle sensor data master LineSensor data set process
+ * :VehicleSensSetDataMasterGps() Vehicle Sensor Data Master GPS Data Set Processing
+ * :VehicleSensGetDataMaster() Vehicle Sensor Data Master Get Processing
+ * :VehicleSensGetGpsDataMaster() Vehicle Sensor Data Master GPS Data Get Processing
+ * :VehicleSensGetGps_CWORD82_NmeaSensorCnt() Vehicle sensor GPS_sensor counter GET function
+ * :VehicleSensSetDataMaster_CWORD82_() Vehicle sensor data master GPS data (_CWORD82_) set processing
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "gps_hal.h"
+#include "POS_private.h"
+#include "DeadReckoning_main.h"
+#include "VehicleSens_DeliveryCtrl.h"
+#include "Vehicle_API.h"
+#include "CommonDefine.h"
+#include <vehicle_service/POS_common_API.h>
+#include "SensorMotion_API.h"
+#include "SensorLog.h"
+#include "ClockIf.h"
+#include "DiagSrvIf.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+VEHICLESENS_PKG_DELIVERY_TEMP_EXT gstPkgTempExt; // NOLINT(readability/nolint)
+#endif
+
+#define DR_DEBUG 0
+#define GPS_DEBUG 0
+
+/*************************************************/
+/* Function prototype */
+/*************************************************/
+static uint8_t VehicleSensGetSensorCnt(void);
+
+
+/*******************************************************************************
+* MODULE : VehicleSensInitDataMaster
+* ABSTRACT : Vehicle sensor data master initialization
+* FUNCTION : Initializing Vehicle Sensor Data Master
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitDataMaster(void) {
+ /* Vehicle sensor data master initialization */
+
+ VehicleSensInitSpeedPulsel();
+ VehicleSensInitSpeedKmphl();
+ VehicleSensInitGyroXl();
+ VehicleSensInitGyroYl();
+ VehicleSensInitGyroZl();
+ VehicleSensInitGsnsXl();
+ VehicleSensInitGsnsYl();
+ VehicleSensInitGsnsZl();
+ VehicleSensInitRevl();
+ VehicleSensInitGpsAntennal();
+ VehicleSensInitSnsCounterl();
+ VehicleSensInitGpsCounterg();
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ VehicleSensInitGyroRevl();
+ VehicleSensInitSnsCounterExtl();
+ VehicleSensInitGyroExtl();
+ VehicleSensInitGyroYExtl();
+ VehicleSensInitGyroZExtl();
+ VehicleSensInitSpeedPulseExtl();
+ VehicleSensInitRevExtl();
+ VehicleSensInitGsnsXExtl();
+ VehicleSensInitGsnsYExtl();
+ VehicleSensInitGsnsZExtl();
+ VehicleSensInitGsnsXFstl();
+ VehicleSensInitGsnsYFstl();
+ VehicleSensInitGsnsZFstl();
+ VehicleSensInitGyroXFstl();
+ VehicleSensInitGyroYFstl();
+ VehicleSensInitGyroZFstl();
+ VehicleSensInitSpeedPulseFstl();
+ VehicleSensInitSpeedPulseFlagFstl();
+ VehicleSensInitRevFstl();
+#endif
+ /* ++ GPS _CWORD82_ support */
+ VehicleSensInitGps_CWORD82_FullBinaryG();
+ VehicleSensInitGps_CWORD82_NmeaG();
+ VehicleSensInitGps_CWORD82__CWORD44_Gp4G();
+ VehicleSensInitGpsNmeaG();
+ /* -- GPS _CWORD82_ support */
+
+ /* ++ PastModel002 support */
+ VehicleSensInitNavVelnedG();
+ VehicleSensInitNavTimeUtcG();
+ VehicleSensInitNavTimeGpsG();
+ VehicleSensInitNavSvInfoG();
+ VehicleSensInitNavStatusG();
+ VehicleSensInitNavPosllhG();
+ VehicleSensInitNavClockG();
+ VehicleSensInitNavDopG();
+ VehicleSensInitMonHwG();
+
+ VehicleSensInitSpeedPulseFlag();
+ VehicleSensInitGpsInterruptFlag();
+
+ VehicleSensInitGyroTrouble();
+ VehicleSensInitMainGpsInterruptSignal();
+ VehicleSensInitSysGpsInterruptSignal();
+ VehicleSensInitGyroConnectStatus();
+ VehicleSensInitGpsAntennaStatus();
+ /* -- PastModel002 support */
+
+ VehicleSensInitGyroTempFstl();
+ VehicleSensInitGyroTempExtl();
+ VehicleSensInitGyroTempl();
+ VehicleSensInitPulseTimeExtl();
+ VehicleSensInitPulseTimel();
+
+ VehicleSensInitLocationLonLatG();
+ VehicleSensInitLocationAltitudeG();
+ VehicleSensInitMotionSpeedG();
+ VehicleSensInitMotionHeadingG();
+ VehicleSensInitNaviinfoDiagGPSg();
+ VehicleSensInitGpsTimeG();
+ VehicleSensInitGpsTimeRawG();
+ VehicleSensInitWknRolloverG();
+ VehicleSensInitLocationLonLatN();
+ VehicleSensInitLocationAltitudeN();
+ VehicleSensInitMotionSpeedN();
+ VehicleSensInitMotionHeadingN();
+ VehicleSensInitSettingTimeclock();
+ VehicleSensInitMotionSpeedI();
+ VehicleSensInitGpsClockDriftG();
+ VehicleSensInitGpsClockFreqG();
+
+ VehicleSens_InitLocationInfoNmea_n();
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterLineSens
+* ABSTRACT : Vehicle sensor data master LineSensor data set process
+* FUNCTION : Set LineSensor data
+* ARGUMENT : *pst_data : LineSensor Vehicle Signal Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterLineSens(const LSDRV_LSDATA *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n,
+ BOOL b_sens_ext) {
+ u_int8 uc_chg_type;
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pst_data->ul_did) {
+ case POSHAL_DID_SPEED_PULSE:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulsel(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+
+ break;
+ }
+// case POSHAL_DID_GYRO_X:
+// {
+// uc_chg_type = VehicleSensSetGyroXl(pst_data);
+// (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+// break;
+// }
+ case POSHAL_DID_GYRO_Y:
+ {
+ uc_chg_type = VehicleSensSetGyroYl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z:
+ {
+ uc_chg_type = VehicleSensSetGyroZl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_REV:
+ {
+ uc_chg_type = VehicleSensSetRevl(pst_data);
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_REV \r\n");
+#endif
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* -- PastModel002 support DR */
+ break;
+ }
+ case POSHAL_DID_GPS_ANTENNA:
+ {
+ uc_chg_type = VehicleSensSetGpsAntennal(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_EXT: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ uc_chg_type = VehicleSensSetGyroRevl(pst_data);
+// if (b_sens_ext == TRUE) {
+// VehicleSensSetGyroExtl(pst_data);
+// }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterLineSensG
+* ABSTRACT : Vehicle sensor data master LineSensor data set process
+* FUNCTION : Set LineSensor data
+* ARGUMENT : *pst_data : LineSensor Vehicle Signal Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterLineSensG(const LSDRV_LSDATA_G *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n,
+ BOOL b_sens_ext) {
+ u_int8 uc_chg_type;
+ SENSORMOTION_SPEEDINFO_DAT stSpeed;
+ const VEHICLESENS_DATA_MASTER* pst_master;
+ u_int16 usSP_KMPH = 0; /* Vehicle speed(km/h) */
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pst_data->ul_did) {
+ case POSHAL_DID_SPEED_PULSE:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulselG(pst_data);
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_SPEED_PULSE \r\n");
+#endif
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetSpeedPulseExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* -- PastModel002 support DR */
+ break;
+ }
+ case POSHAL_DID_SPEED_KMPH:
+ {
+ uc_chg_type = VehicleSensSetSpeedKmphlG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+
+ /* Set the data master of Motion Seepd (Internal) */
+ pst_master = (const VEHICLESENS_DATA_MASTER*)pst_data;
+ memset(&stSpeed, 0x00, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+ /* When the notified size is ""0"",The vehicle speed cannot be calculated with the line sensor. */
+ if (pst_master->us_size == 0) {
+ stSpeed.isEnable = FALSE;
+ } else {
+ stSpeed.isEnable = TRUE;
+ memcpy(&usSP_KMPH, pst_master->uc_data, sizeof(u_int16));
+ }
+ stSpeed.getMethod = SENSOR_GET_METHOD_POS;
+ /* Unit conversion [0.01km/h] -> [0.01m/s] */
+ stSpeed.Speed = static_cast<uint16_t>((1000 * usSP_KMPH) / 3600);
+
+ uc_chg_type = VehicleSensSetMotionSpeedI(&stSpeed);
+ (*p_data_master_set_n)(VEHICLE_DID_MOTION_SPEED_INTERNAL, uc_chg_type, VEHICLESENS_GETMETHOD_INTERNAL);
+ break;
+ }
+// case POSHAL_DID_GYRO_X:
+// {
+// uc_chg_type = VehicleSensSetGyroXlG(pst_data);
+//#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_GYRO_X \r\n");
+//#endif
+// (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+// /* ++ PastModel002 support DR */
+// VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+// /* -- PastModel002 support DR */
+// break;
+// }
+ case POSHAL_DID_GYRO_Y:
+ {
+ uc_chg_type = VehicleSensSetGyroYlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGyroYExtlG(pst_data);
+ }
+#if (DR_DEBUG == 1)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_GYRO_Y \r\n");
+#endif
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z:
+ {
+ uc_chg_type = VehicleSensSetGyroZlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGyroZExtlG(pst_data);
+ }
+#if (DR_DEBUG == 1)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_GYRO_Z \r\n");
+#endif
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_SNS_COUNTER:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_SNS_COUNTER \r\n");
+#endif
+ uc_chg_type = VehicleSensSetSnsCounterlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetSnsCounterExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* -- PastModel002 support DR */
+ break;
+ }
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_EXT: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ uc_chg_type = VehicleSensSetGyroRevlG(pst_data);
+
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGyroExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+
+ break;
+ }
+
+ case POSHAL_DID_SPEED_PULSE_FLAG:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulseFlag((const LSDRV_LSDATA_G *)pst_data);
+
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* -- PastModel002 support DR */
+
+ break;
+ }
+ case POSHAL_DID_GPS_INTERRUPT_FLAG:
+ {
+ uc_chg_type = VehicleSensSetGpsInterruptFlag((const LSDRV_LSDATA_G *)pst_data);
+
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+
+ break;
+ }
+ case POSHAL_DID_REV:
+ {
+ uc_chg_type = VehicleSensSetRevlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetRevExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_TEMP:
+ {
+ uc_chg_type = VehicleSensSetGyroTemplG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGyroTempExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GSNS_X:
+ {
+ uc_chg_type = VehicleSensSetGsnsXlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGsnsXExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GSNS_Y:
+ {
+ uc_chg_type = VehicleSensSetGsnsYlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGsnsYExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GSNS_Z:
+ {
+ uc_chg_type = VehicleSensSetGsnsZlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGsnsZExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_PULSE_TIME:
+ {
+ uc_chg_type = VehicleSensSetPulseTimelG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetPulseTimeExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterLineSensFst
+* ABSTRACT : Vehicle sensor data master LineSensor data set process
+* FUNCTION : Set LineSensor data
+* ARGUMENT : *pst_data : LineSensor Vehicle Signal Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterLineSensFst(const LSDRV_LSDATA_FST *pst_data, PFUNC_DMASTER_SET_N p_data_master_set_n) { // LCOV_EXCL_START 8: dead code // // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pst_data->ul_did) {
+ case POSHAL_DID_GYRO_X_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ uc_chg_type = VehicleSensSetGyroXFstl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_Y_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ uc_chg_type = VehicleSensSetGyroYFstl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ uc_chg_type = VehicleSensSetGyroZFstl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FST:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulseFstl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ default:
+ break;
+ }
+}
+// LCOV_EXCL_STOP
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterLineSensFstG
+* ABSTRACT : Vehicle sensor data master LineSensor data set process
+* FUNCTION : Set LineSensor data
+* ARGUMENT : *pst_data : LineSensor Vehicle Signal Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterLineSensFstG(const LSDRV_MSG_LSDATA_DAT_FST *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n) {
+ u_int8 uc_chg_type;
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pst_data->st_gyro_x.ul_did) {
+ case POSHAL_DID_GYRO_X_FST:
+ {
+ uc_chg_type = VehicleSensSetGyroXFstG(&(pst_data->st_gyro_x));
+ if (pst_data->st_gyro_x.uc_partition_max == pst_data->st_gyro_x.uc_partition_num)
+ {
+ (*p_data_master_set_n)(pst_data->st_gyro_x.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gyro_y.ul_did) {
+ case POSHAL_DID_GYRO_Y_FST:
+ {
+ uc_chg_type = VehicleSensSetGyroYFstG(&(pst_data->st_gyro_y));
+ if (pst_data->st_gyro_y.uc_partition_max == pst_data->st_gyro_y.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gyro_y.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gyro_z.ul_did) {
+ case POSHAL_DID_GYRO_Z_FST:
+ {
+ uc_chg_type = VehicleSensSetGyroZFstG(&(pst_data->st_gyro_z));
+ if (pst_data->st_gyro_z.uc_partition_max == pst_data->st_gyro_z.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gyro_z.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_speed.ul_did) {
+ case POSHAL_DID_SPEED_PULSE_FST:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulseFstG(&(pst_data->st_speed));
+ if (pst_data->st_speed.uc_partition_max == pst_data->st_speed.uc_partition_num)
+ {
+ (*p_data_master_set_n)(pst_data->st_speed.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_spd_pulse_flg.ul_did) {
+ case POSHAL_DID_SPEED_PULSE_FLAG_FST:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulseFlagFstG(&(pst_data->st_spd_pulse_flg));
+ if (pst_data->st_spd_pulse_flg.uc_partition_max == pst_data->st_spd_pulse_flg.uc_partition_num)
+ {
+ (*p_data_master_set_n)(pst_data->st_spd_pulse_flg.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_rev.ul_did) {
+ case POSHAL_DID_REV_FST:
+ {
+ uc_chg_type = VehicleSensSetRevFstG(&(pst_data->st_rev));
+ if (pst_data->st_rev.uc_partition_max == pst_data->st_rev.uc_partition_num)
+ {
+ (*p_data_master_set_n)(pst_data->st_rev.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gyro_temp.ul_did) {
+ case POSHAL_DID_GYRO_TEMP_FST:
+ {
+ uc_chg_type = VehicleSensSetGyroTempFstG(&(pst_data->st_gyro_temp));
+
+ if (pst_data->st_gyro_temp.uc_partition_max == pst_data->st_gyro_temp.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gyro_temp.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gsns_x.ul_did) {
+ case POSHAL_DID_GSNS_X_FST:
+ {
+ uc_chg_type = VehicleSensSetGsnsXFstG(&(pst_data->st_gsns_x));
+
+ if (pst_data->st_gsns_x.uc_partition_max == pst_data->st_gsns_x.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gsns_x.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gsns_y.ul_did) {
+ case POSHAL_DID_GSNS_Y_FST:
+ {
+ uc_chg_type = VehicleSensSetGsnsYFstG(&(pst_data->st_gsns_y));
+
+ if (pst_data->st_gsns_y.uc_partition_max == pst_data->st_gsns_y.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gsns_y.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gsns_z.ul_did) {
+ case POSHAL_DID_GSNS_Z_FST:
+ {
+ uc_chg_type = VehicleSensSetGsnsZFstG(&(pst_data->st_gsns_z));
+
+ if (pst_data->st_gsns_z.uc_partition_max == pst_data->st_gsns_z.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gsns_z.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterGps
+* ABSTRACT : Vehicle Sensor Data Master GPS Data Set Processing
+* FUNCTION : Set GPS data
+* ARGUMENT : *pst_data : GPS received message data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterGps(SENSOR_MSG_GPSDATA_DAT *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n) {
+ u_int8 uc_chg_type;
+ SENSORLOCATION_LONLATINFO_DAT lstLonLat;
+ SENSORLOCATION_ALTITUDEINFO_DAT lstAltitude;
+ SENSORMOTION_HEADINGINFO_DAT lstHeading;
+ MDEV_GPS_CUSTOMDATA *pstCustomData;
+
+ VEHICLESENS_DATA_MASTER st_data;
+ u_int8 antennaState = 0;
+ u_int8 sensCount = 0;
+ u_int8 ucResult = SENSLOG_RES_SUCCESS;
+
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ BOOL bIsAvailable;
+ PNO us_pno;
+
+ /* Antenna Connection Information */
+ (void)memset(reinterpret_cast<void *>(&st_data), 0, sizeof(st_data));
+ VehicleSensGetGpsAntennal(&st_data);
+ antennaState = st_data.uc_data[0];
+
+ /* Sensor Counter */
+ (void)memset(reinterpret_cast<void *>(&st_data), 0, sizeof(st_data));
+ VehicleSensGetSnsCounterl(&st_data);
+ /** Sensor Counter Value Calculation */
+ /** Subtract sensor counter according to data amount from sensor counter.(Rounded off) */
+ /** Communication speed9600bps = 1200byte/s,Sensor counter is 1 count at 100ms. */
+ sensCount = st_data.uc_data[0];
+
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "antennaState = %d, sensCount = %d", antennaState, sensCount);
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pst_data->ul_did) { // LCOV_EXCL_BR_LINE 6:some DID is not used
+ case VEHICLE_DID_GPS_UBLOX_NAV_VELNED:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_VELNED \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavVelnedG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavTimeUtcG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavTimeGpsG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_SVINFO:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_SVINFO \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavSvInfoG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_STATUS:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_STATUS \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavStatusG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_POSLLH:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_POSLLH \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavPosllhG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_CLOCK:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_CLOCK \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavClockG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_DOP:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_DOP \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavDopG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_MON_HW:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_MON_HW \r\n");
+#endif
+ uc_chg_type = VehicleSensSetMonHwG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_COUNTER:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uc_chg_type = VehicleSensSetGpsCounterg(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ /* GPS raw data(_CWORD82_ NMEA) */
+ case VEHICLE_DID_GPS__CWORD82__NMEA:
+ {
+ /* NMEA data */
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSens_GpsDataDelivery VEHICLE_DID_GPS__CWORD82__NMEA -->");
+
+ /* Insert Antenna Connection Status and Sensor Counter */
+ pst_data->uc_data[1] = antennaState; /* Insert Antennas into 2byte Eyes */
+ /* Place counters at 3byte */
+ pst_data->uc_data[2] = static_cast<u_int8>(sensCount - (u_int8)(((GPS_NMEA_SZ * 10) / 1200) + 1));
+
+ uc_chg_type = VehicleSensSetGps_CWORD82_NmeaG(pst_data); /* Ignore->MISRA-C++:2008 Rule 5-2-5 */
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSens_GpsDataDelivery VEHICLE_DID_GPS__CWORD82__NMEA <--");
+ break;
+ }
+ /* GPS raw data(FullBinary) */
+ case POSHAL_DID_GPS__CWORD82__FULLBINARY:
+ {
+ /* FullBin data */
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSens_GpsDataDelivery POSHAL_DID_GPS__CWORD82__FULLBINARY -->");
+
+ /* Insert Antenna Connection Status and Sensor Counter */
+ pst_data->uc_data[0] = antennaState; /* Insert Antennas into 1byte Eyes */
+ /* Place counters at 2byte */
+ pst_data->uc_data[1] = static_cast<u_int8>(sensCount - (u_int8)(((GPS_CMD_FULLBIN_SZ * 10) / 1200) + 1));
+
+ uc_chg_type = VehicleSensSetGps_CWORD82_FullBinaryG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSens_GpsDataDelivery POSHAL_DID_GPS__CWORD82__FULLBINARY <--");
+ break;
+ }
+ /* GPS raw data(Specific information) */
+ case POSHAL_DID_GPS__CWORD82___CWORD44_GP4:
+ {
+ /* GPS-specific information */
+ uc_chg_type = VehicleSensSetGps_CWORD82__CWORD44_Gp4G(pst_data); /* Ignore->MISRA-C++:2008 Rule 5-2-5 */
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+ case POSHAL_DID_GPS_CUSTOMDATA:
+ {
+ pstCustomData = reinterpret_cast<MDEV_GPS_CUSTOMDATA*>(pst_data->uc_data);
+ /* Latitude/LongitudeInformation */
+ (void)memcpy(&lstLonLat, &(pstCustomData->st_lonlat), sizeof(SENSORLOCATION_LONLATINFO_DAT));
+ lstLonLat.SyncCnt = VehicleSensGetSensorCnt(); /* Synchronization counter setting */
+ uc_chg_type = VehicleSensSetLocationLonLatG(&lstLonLat);
+ (*p_data_master_set_n)(VEHICLE_DID_LOCATION_LONLAT, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+
+ /* Altitude information */
+ (void)memcpy(&lstAltitude, &(pstCustomData->st_altitude), sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+ lstAltitude.SyncCnt = VehicleSensGetSensorCnt(); /* Synchronization counter setting */
+ uc_chg_type = VehicleSensSetLocationAltitudeG(&lstAltitude);
+ (*p_data_master_set_n)(VEHICLE_DID_LOCATION_ALTITUDE, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+
+ /* Bearing information */
+ (void)memcpy(&lstHeading, &(pstCustomData->st_heading), sizeof(SENSORMOTION_HEADINGINFO_DAT));
+ lstHeading.SyncCnt = VehicleSensGetSensorCnt(); /* Synchronization counter setting */
+ uc_chg_type = VehicleSensSetMotionHeadingG(&lstHeading);
+ (*p_data_master_set_n)(VEHICLE_DID_MOTION_HEADING, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+
+ /* GPS time information */
+ uc_chg_type = VehicleSensSetGpsTimeG(&(pstCustomData->st_gps_time));
+ (*p_data_master_set_n)(POSHAL_DID_GPS_TIME, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+
+ /* Set GPS time to CLOCK */
+ eStatus = ClockIfDtimeSetGpsTime(&(pstCustomData->st_gps_time), &bIsAvailable);
+ if ((bIsAvailable == TRUE) && (eStatus != eFrameworkunifiedStatusOK)) {
+ ucResult = SENSLOG_RES_FAIL;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ClockIfDtimeSetGpsTime ERROR!! [ret=%d, y=%d, m=%d, d=%d, h=%d, n=%d, s=%d, sts=%d]",
+ eStatus, pstCustomData->st_gps_time.utc.year, pstCustomData->st_gps_time.utc.month,
+ pstCustomData->st_gps_time.utc.date,
+ pstCustomData->st_gps_time.utc.hour, pstCustomData->st_gps_time.utc.minute,
+ pstCustomData->st_gps_time.utc.second, pstCustomData->st_gps_time.tdsts);
+ }
+ us_pno = _pb_CnvName2Pno(SENSLOG_PNAME_CLOCK);
+ SensLogWriteOutputData(SENSLOG_DATA_O_TIME_CS, 0, us_pno,
+ reinterpret_cast<uint8_t *>(&(pstCustomData->st_gps_time)),
+ sizeof(pstCustomData->st_gps_time), ucResult);
+
+ /* Diag Info */
+ uc_chg_type = VehicleSensSetNaviinfoDiagGPSg(&(pstCustomData->st_diag_gps));
+ (*p_data_master_set_n)(VEHICLE_DID_NAVIINFO_DIAG_GPS, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+ /* GPS raw data(NMEA except _CWORD82_) */
+ case POSHAL_DID_GPS_NMEA:
+ {
+ /* NMEA data */
+ uc_chg_type = VehicleSensSetGpsNmeaG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+ /* GPS version(except _CWORD82_) */
+ case POSHAL_DID_GPS_VERSION:
+ {
+ VehicleSensSetGpsVersion(pst_data);
+ break;
+ }
+ /* Raw GPS time data */
+ case POSHAL_DID_GPS_TIME_RAW:
+ {
+ (void)VehicleSensSetGpsTimeRawG(reinterpret_cast<SENSOR_GPSTIME_RAW*>(pst_data->uc_data));
+ break;
+ }
+ case POSHAL_DID_GPS_TIME:
+ {
+ uc_chg_type = VehicleSensSetGpsTimeG(reinterpret_cast<SENSOR_MSG_GPSTIME*>(pst_data->uc_data));
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+ case POSHAL_DID_GPS_WKNROLLOVER:
+ {
+ (void)VehicleSensSetWknRolloverG(reinterpret_cast<SENSOR_WKNROLLOVER*>(pst_data->uc_data));
+ break;
+ }
+ /* GPS clock drift */
+ case POSHAL_DID_GPS_CLOCK_DRIFT:
+ {
+ uc_chg_type = VehicleSensSetGpsClockDriftG(reinterpret_cast<int32_t*>(pst_data->uc_data));
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+ /* GPS clock frequency */
+ case POSHAL_DID_GPS_CLOCK_FREQ:
+ {
+ uc_chg_type = VehicleSensSetGpsClockFreqG(reinterpret_cast<uint32_t*>(pst_data->uc_data));
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+ * MODULE : VehicleSensSetDataMasterData
+ * ABSTRACT : Vehicle sensor data master common data set processing
+ * FUNCTION : Set vehicle data
+ * ARGUMENT : *pstMsg : Received message data
+ * : p_data_master_set_n : Data Master Set Notification(Callback function)
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensSetDataMasterData(const POS_MSGINFO *pstMsg,
+ PFUNC_DMASTER_SET_N p_data_master_set_n) {
+ u_int8 uc_chg_type = 0;
+ const POS_POSDATA *pstPosData = NULL;
+ const u_int16 *pucSpeed = 0;
+ SENSORLOCATION_LONLATINFO_DAT stLonLat;
+ SENSORLOCATION_ALTITUDEINFO_DAT stAltitude;
+ SENSORMOTION_SPEEDINFO_DAT stSpeed;
+ SENSORMOTION_HEADINGINFO_DAT stHeading;
+ const SENSOR_MSG_GPSTIME *pstGpsTime;
+
+// RET_API ret;
+
+// char* pEnvPositioning_CWORD86_ = NULL;
+// BOOL sndFlg;
+
+
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ BOOL bIsAvailable;
+ u_int8 ucResult = SENSLOG_RES_SUCCESS;
+ PNO us_pno;
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pstMsg->did) {
+ case POSHAL_DID_GPS_CUSTOMDATA_NAVI:
+ {
+ pstPosData = (const POS_POSDATA *) & (pstMsg->data);
+
+ /* Latitude/LongitudeInformation */
+ if (((pstPosData->status & POS_LOC_INFO_LAT) == POS_LOC_INFO_LAT) ||
+ ((pstPosData->status & POS_LOC_INFO_LON) == POS_LOC_INFO_LON)) {
+ memset(&stLonLat, 0x00, sizeof(stLonLat));
+ stLonLat.getMethod = SENSOR_GET_METHOD_NAVI;
+ stLonLat.SyncCnt = VehicleSensGetSensorCnt();
+ stLonLat.isEnable = SENSORLOCATION_STATUS_ENABLE;
+ stLonLat.posSts = pstPosData->posSts;
+ stLonLat.posAcc = pstPosData->posAcc;
+ stLonLat.Longitude = pstPosData->longitude;
+ stLonLat.Latitude = pstPosData->latitude;
+ uc_chg_type = VehicleSensSetLocationLonLatN((const SENSORLOCATION_LONLATINFO_DAT *)&stLonLat);
+ (*p_data_master_set_n)(VEHICLE_DID_LOCATION_LONLAT_NAVI, uc_chg_type, VEHICLESENS_GETMETHOD_NAVI);
+ }
+
+ /* Altitude information */
+ if ((pstPosData->status & POS_LOC_INFO_ALT) == POS_LOC_INFO_ALT) {
+ memset(&stAltitude, 0x00, sizeof(stAltitude));
+ stAltitude.getMethod = SENSOR_GET_METHOD_NAVI;
+ stAltitude.SyncCnt = VehicleSensGetSensorCnt();
+ stAltitude.isEnable = SENSORLOCATION_STATUS_ENABLE;
+ stAltitude.Altitude = pstPosData->altitude;
+ uc_chg_type = VehicleSensSetLocationAltitudeN((const SENSORLOCATION_ALTITUDEINFO_DAT *)&stAltitude);
+ (*p_data_master_set_n)(VEHICLE_DID_LOCATION_ALTITUDE_NAVI, uc_chg_type, VEHICLESENS_GETMETHOD_NAVI);
+ }
+
+ /* Bearing information */
+ if ((pstPosData->status & POS_LOC_INFO_HEAD) == POS_LOC_INFO_HEAD) {
+ memset(&stHeading, 0x00, sizeof(stHeading));
+ stHeading.getMethod = SENSOR_GET_METHOD_NAVI;
+ stHeading.SyncCnt = VehicleSensGetSensorCnt();
+ stHeading.isEnable = SENSORMOTION_STATUS_ENABLE;
+ stHeading.posSts = pstPosData->posSts;
+ stHeading.Heading = pstPosData->heading;
+ uc_chg_type = VehicleSensSetMotionHeadingN((const SENSORMOTION_HEADINGINFO_DAT *)&stHeading);
+ (*p_data_master_set_n)(VEHICLE_DID_MOTION_HEADING_NAVI, uc_chg_type, VEHICLESENS_GETMETHOD_NAVI);
+ }
+
+ ( *p_data_master_set_n )( POSHAL_DID_GPS_CUSTOMDATA_NAVI, VEHICLESENS_NEQ, VEHICLESENS_GETMETHOD_NAVI );
+
+ break;
+ }
+ case VEHICLE_DID_MOTION_SPEED_NAVI:
+ {
+ pucSpeed = (const u_int16 *) & (pstMsg->data);
+
+ /* Vehicle speed information */
+ memset(&stSpeed, 0x00, sizeof(stSpeed));
+ stSpeed.getMethod = SENSOR_GET_METHOD_NAVI;
+ stSpeed.SyncCnt = VehicleSensGetSensorCnt();
+ stSpeed.isEnable = SENSORMOTION_STATUS_ENABLE;
+ stSpeed.Speed = *pucSpeed;
+ uc_chg_type = VehicleSensSetMotionSpeedN((const SENSORMOTION_SPEEDINFO_DAT *)&stSpeed);
+ (*p_data_master_set_n)(VEHICLE_DID_MOTION_SPEED_NAVI, uc_chg_type, VEHICLESENS_GETMETHOD_NAVI);
+ break;
+ }
+ case POSHAL_DID_GPS_TIME:
+ {
+ pstGpsTime = (const SENSOR_MSG_GPSTIME*)(pstMsg->data);
+ uc_chg_type = VehicleSensSetGpsTimeG((const SENSOR_MSG_GPSTIME *)pstGpsTime);
+ (*p_data_master_set_n)(POSHAL_DID_GPS_TIME, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+
+ /* Set GPS time to CLOCK */
+ eStatus = ClockIfDtimeSetGpsTime(pstGpsTime, &bIsAvailable);
+ if ((bIsAvailable == TRUE) && (eStatus != eFrameworkunifiedStatusOK)) {
+ ucResult = SENSLOG_RES_FAIL;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ClockIfDtimeSetGpsTime ERROR!! [ret=%d, y=%d, m=%d, d=%d, h=%d, n=%d, s=%d, sts=%d]",
+ eStatus, pstGpsTime->utc.year, pstGpsTime->utc.month, pstGpsTime->utc.date,
+ pstGpsTime->utc.hour, pstGpsTime->utc.minute, pstGpsTime->utc.second, pstGpsTime->tdsts);
+ }
+ us_pno = _pb_CnvName2Pno(SENSLOG_PNAME_CLOCK);
+ SensLogWriteOutputData(SENSLOG_DATA_O_TIME_CS, 0, us_pno,
+ (uint8_t *)(pstGpsTime), // NOLINT(readability/casting)
+ sizeof(SENSOR_MSG_GPSTIME), ucResult);
+ break;
+ }
+ case VEHICLE_DID_SETTINGTIME:
+ {
+ /* GPS time information */
+ uc_chg_type = VehicleSensSetSettingTimeclock((const POS_DATETIME *) & (pstMsg->data));
+ (*p_data_master_set_n)(VEHICLE_DID_SETTINGTIME, uc_chg_type, VEHICLESENS_GETMETHOD_OTHER);
+ break;
+ }
+
+ case VEHICLE_DID_LOCATIONINFO_NMEA_NAVI:
+ {
+ uc_chg_type = VehicleSens_SetLocationInfoNmea_n((const POS_LOCATIONINFO_NMEA*)&(pstMsg->data));
+ (*p_data_master_set_n)(VEHICLE_DID_LOCATIONINFO_NMEA_NAVI, uc_chg_type, VEHICLESENS_GETMETHOD_NAVI );
+ break;
+ }
+
+ default:
+ break;
+ }
+ return;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterGyroTrouble
+* ABSTRACT : Vehicle Sensor Data Master Gyro Failure Status Setting Process
+* FUNCTION : Set a gyro fault condition
+* ARGUMENT : *pst_data : Gyro Failure Status Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterGyroTrouble(const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *pst_data, PFUNC_DMASTER_SET_N p_data_master_set_n) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+
+ if ((pst_data != NULL) && (p_data_master_set_n != NULL)) {
+ if (pst_data->ul_did == VEHICLE_DID_GYRO_TROUBLE) {
+ uc_chg_type = VehicleSensSetGyroTrouble(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", pst_data->ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT is NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterSysGpsInterruptSignal
+* ABSTRACT : Vehicle Sensor Data Master SYS GPS Interrupt Signal Setting
+* FUNCTION : Setting SYS GPS Interrupt Signals
+* ARGUMENT : *pst_data : SYS GPS interrupt notification
+* : p_data_master_set_shared_memory : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterSysGpsInterruptSignal(const LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL *pst_data, PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+ if ((pst_data != NULL) && (p_data_master_set_shared_memory != NULL)) {
+ if (pst_data->ul_did == VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL) {
+ uc_chg_type = VehicleSensSetSysGpsInterruptSignal(pst_data);
+ /* As SYS GPS interrupt signals are not registered for delivery, */
+ /* Disposal quantity,To avoid risks,DeliveryProc shall not be called. */
+ (*p_data_master_set_shared_memory)(pst_data->ul_did, uc_chg_type);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", pst_data->ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT is NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterMainGpsInterruptSignal
+* ABSTRACT : Vehicle Sensor Data Master MAIN GPS Interrupt Signal Setting
+* FUNCTION : Setting MAIN GPS Interrupt Signals
+* ARGUMENT : *pst_data : MAIN GPS interrupt notification
+* : p_data_master_set_shared_memory : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterMainGpsInterruptSignal(const SENSOR_MSG_GPSDATA_DAT *pst_data, PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+
+ if ((pst_data != NULL) &&
+ (p_data_master_set_shared_memory != NULL)) {
+ if (pst_data->ul_did == VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL) {
+ uc_chg_type = VehicleSensSetMainGpsInterruptSignal(pst_data);
+ /* As MAIN GPS interrupt signals are not registered for delivery, */
+ /* Disposal quantity,To avoid risks,DeliveryProc shall not be called. */
+ (*p_data_master_set_shared_memory)(pst_data->ul_did, uc_chg_type);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", pst_data->ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT is NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterGyroConnectStatus
+* ABSTRACT : Vehicle Sensor Data Master Gyro Connection Status Setting Processing
+* FUNCTION : Set the state of the gyro connection
+* ARGUMENT : *pst_data : Gyro Connect Status Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterGyroConnectStatus(const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *pst_data, PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+
+ if ((pst_data != NULL) &&
+ (p_data_master_set_shared_memory != NULL)) {
+ if (pst_data->ul_did == VEHICLE_DID_GYRO_CONNECT_STATUS) {
+ uc_chg_type = VehicleSensSetGyroConnectStatus(pst_data);
+ /* As MAIN GPS interrupt signals are not registered for delivery, */
+ /* Disposal quantity,To avoid risks,DeliveryProc shall not be called. */
+ (*p_data_master_set_shared_memory)(pst_data->ul_did, uc_chg_type);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", pst_data->ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT is NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterGpsAntennaStatus
+* ABSTRACT : Vehicle Sensor Data Master GPS Antenna Connection Status Setting Processing
+* FUNCTION : Setting the GPS Antenna Connection Status
+* ARGUMENT : *pst_data : GPS antenna connection status notification data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterGpsAntennaStatus(const LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS *pst_data, PFUNC_DMASTER_SET_N p_data_master_set_n) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+
+ if ((pst_data != NULL) && (p_data_master_set_n != NULL)) {
+ if (pst_data->ul_did == POSHAL_DID_GPS_ANTENNA) {
+ uc_chg_type = VehicleSensSetGpsAntennaStatus(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", pst_data->ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT is NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMaster
+* ABSTRACT : Vehicle Sensor Data Master Get Processing
+* FUNCTION : Provide vehicle sensor data master
+* ARGUMENT : ul_did : Data ID corresponding to the vehicle information
+* : uc_get_method : Data collection way
+* : VEHICLESENS_GETMETHOD_CAN: CAN communication
+* : VEHICLESENS_GETMETHOD_LINE: LineSensor drivers
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMaster(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER *pst_data) {
+ /*------------------------------------------------------*/
+ /* Call the data Get processing associated with the DID */
+ /*------------------------------------------------------*/
+ switch (ul_did) { // LCOV_EXCL_BR_LINE 6:some DID is not used
+ /*------------------------------------------------------*/
+ /* Vehicle sensor data group */
+ /*------------------------------------------------------*/
+ case POSHAL_DID_SPEED_PULSE:
+ {
+ VehicleSensGetSpeedPulse(pst_data, uc_get_method);
+ break;
+ }
+// case POSHAL_DID_GYRO_X:
+// {
+// VehicleSensGetGyroX(pst_data, uc_get_method);
+// break;
+// }
+ case POSHAL_DID_GYRO_Y:
+ {
+ VehicleSensGetGyroY(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z:
+ {
+ VehicleSensGetGyroZ(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_EXT: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ VehicleSensGetGyroRev(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_X:
+ {
+ VehicleSensGetGsnsX(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Y:
+ {
+ VehicleSensGetGsnsY(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Z:
+ {
+ VehicleSensGetGsnsZ(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_REV:
+ {
+ VehicleSensGetRev(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FLAG:
+ {
+ /* Data acquisition not selected */
+ VehicleSensGetSpeedPulseFlag(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_ANTENNA:
+ {
+ VehicleSensGetGpsAntenna(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_SNS_COUNTER:
+ {
+ VehicleSensGetSnsCounter(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GPS_INTERRUPT_FLAG:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Data acquisition not selected */
+ VehicleSensGetGpsInterruptFlag(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case POSHAL_DID_SPEED_KMPH:
+ {
+ VehicleSensGetSpeedKmph(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_TEMP:
+ {
+ VehicleSensGetGyroTemp(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_PULSE_TIME:
+ {
+ VehicleSensGetPulseTime(pst_data, uc_get_method);
+ break;
+ }
+ case VEHICLE_DID_LOCATION_LONLAT:
+ case VEHICLE_DID_LOCATION_LONLAT_NAVI:
+ {
+ VehicleSensGetLocationLonLat(pst_data, uc_get_method);
+ break;
+ }
+ case VEHICLE_DID_LOCATION_ALTITUDE:
+ case VEHICLE_DID_LOCATION_ALTITUDE_NAVI:
+ {
+ VehicleSensGetLocationAltitude(pst_data, uc_get_method);
+ break;
+ }
+ case VEHICLE_DID_MOTION_SPEED_NAVI:
+ case VEHICLE_DID_MOTION_SPEED_INTERNAL:
+ {
+ VehicleSensGetMotionSpeed(pst_data, uc_get_method);
+ break;
+ }
+ case VEHICLE_DID_MOTION_HEADING:
+ case VEHICLE_DID_MOTION_HEADING_NAVI:
+ {
+ VehicleSensGetMotionHeading(pst_data, uc_get_method);
+ break;
+ }
+ case VEHICLE_DID_SETTINGTIME:
+ {
+ VehicleSensGetSettingTime(pst_data, uc_get_method);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterExt
+* ABSTRACT : Vehicle Sensor Data Master Get Processing(Initial delivery)
+* FUNCTION : Provide vehicle sensor data master
+* ARGUMENT : ul_did : Data ID corresponding to the vehicle information
+* : uc_get_method : Data collection way
+* : VEHICLESENS_GETMETHOD_CAN: CAN communication
+* : VEHICLESENS_GETMETHOD_LINE: LineSensor drivers
+* : VEHICLESENS_GETMETHOD_NAVI: Navi
+* : VEHICLESENS_GETMETHOD_CLOCK:Clock
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterExt(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ /*------------------------------------------------------*/
+ /* Call the data Get processing associated with the DID */
+ /*------------------------------------------------------*/
+ switch (ul_did) {
+ /*------------------------------------------------------*/
+ /* Vehicle sensor data group */
+ /*------------------------------------------------------*/
+ case POSHAL_DID_SPEED_PULSE:
+ {
+ VehicleSensGetSpeedPulseExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_X:
+ {
+ VehicleSensGetGsnsXExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Y:
+ {
+ VehicleSensGetGsnsYExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Z:
+ {
+ VehicleSensGetGsnsZExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_SNS_COUNTER:
+ {
+ VehicleSensGetSnsCounterExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_EXT: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ VehicleSensGetGyroExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_Y:
+ {
+ VehicleSensGetGyroYExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z:
+ {
+ VehicleSensGetGyroZExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_REV:
+ {
+ VehicleSensGetRevExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_TEMP:
+ {
+ VehicleSensGetGyroTempExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_PULSE_TIME:
+ {
+ VehicleSensGetPulseTimeExt(pst_data, uc_get_method);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterFst
+* ABSTRACT : Vehicle Sensor Data Master Get Processing(Initial transmission data)
+* FUNCTION : Provide vehicle sensor data master
+* ARGUMENT : ul_did : Data ID corresponding to the vehicle information
+* : uc_get_method : Data collection way
+* : VEHICLESENS_GETMETHOD_CAN: CAN communication
+* : VEHICLESENS_GETMETHOD_LINE: LineSensor drivers
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterFst(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ /*------------------------------------------------------*/
+ /* Call the data Get processing associated with the DID */
+ /*------------------------------------------------------*/
+ switch (ul_did) {
+ /*------------------------------------------------------*/
+ /* Vehicle sensor data group */
+ /*------------------------------------------------------*/
+ case POSHAL_DID_GYRO_X_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ VehicleSensGetGyroXFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_Y_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ VehicleSensGetGyroYFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ VehicleSensGetGyroZFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FST:
+ {
+ VehicleSensGetSpeedPulseFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FLAG_FST:
+ {
+ VehicleSensGetSpeedPulseFlagFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_REV_FST:
+ {
+ VehicleSensGetRevFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_TEMP_FST:
+ {
+ VehicleSensGetGyroTempFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_X_FST:
+ {
+ VehicleSensGetGsnsXFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Y_FST:
+ {
+ VehicleSensGetGsnsYFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Z_FST:
+ {
+ VehicleSensGetGsnsZFst(pst_data, uc_get_method);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGpsDataMaster
+* ABSTRACT : Vehicle Sensor Data Master GPS Data Get Processing
+* FUNCTION : Provide vehicle sensor data master GPS data
+* ARGUMENT : ul_did : Data ID corresponding to the vehicle information
+* : uc_get_method : Data collection way
+* : VEHICLESENS_GETMETHOD_GPS: GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGpsDataMaster(DID ul_did,
+ u_int8 uc_get_method,
+ SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ /*------------------------------------------------------*/
+ /* Call the data Get processing associated with the DID */
+ /*------------------------------------------------------*/
+ switch (ul_did) { // LCOV_EXCL_BR_LINE 6:some DID is not used
+ /*------------------------------------------------------*/
+ /* GPS data group */
+ /*------------------------------------------------------*/
+
+ case VEHICLE_DID_GPS_UBLOX_NAV_VELNED:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavVelnedG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavTimeUtcG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavTimeGpsG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_SVINFO:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavSvInfoG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_STATUS:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavStatusG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_POSLLH:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavPosllhG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_CLOCK:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavClockG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_DOP:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED();
+ VehicleSensGetNavDopG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_MON_HW:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED();
+ VehicleSensGetMonHwG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_COUNTER:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetGpsCounterg(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS__CWORD82__NMEA:
+ {
+ VehicleSensGetGps_CWORD82_NmeaG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS__CWORD82__FULLBINARY:
+ {
+ VehicleSensGetGps_CWORD82_FullBinaryG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS__CWORD82___CWORD44_GP4:
+ {
+ VehicleSensGetGps_CWORD82__CWORD44_Gp4G(pst_data);
+ break;
+ }
+ case VEHICLE_DID_NAVIINFO_DIAG_GPS:
+ {
+ VehicleSensGetNaviinfoDiagGPSg(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_TIME:
+ {
+ VehicleSensGetGpsTimeG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_TIME_RAW:
+ {
+ VehicleSensGetGpsTimeRawG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_NMEA:
+ {
+ VehicleSensGetGpsNmeaG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_WKNROLLOVER:
+ {
+ VehicleSensGetWknRolloverG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_CLOCK_DRIFT:
+ {
+ VehicleSensGetGpsClockDriftG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_CLOCK_FREQ:
+ {
+ VehicleSensGetGpsClockFreqG(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterGyroTrouble
+* ABSTRACT : Vehicle Sensor Data Master Gyro Failure Status Get Processing
+* FUNCTION : Provide a gyro fault condition
+* ARGUMENT : ul_did : Data ID
+* : uc_get_method : Data collection way(Not used)
+* : VEHICLESENS_GETMETHOD_CAN : CAN communication
+* : VEHICLESENS_GETMETHOD_LINE : LineSensor drivers
+* : VEHICLESENS_GETMETHOD_GPS : GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterGyroTrouble(DID ul_did, u_int8 uc_get_method, VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_data) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (pst_data != NULL) {
+ if (ul_did == VEHICLE_DID_GYRO_TROUBLE) {
+ VehicleSensGetGyroTrouble(pst_data);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pst_data == NULL\r\n");
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterSysGpsInterruptSignal
+* ABSTRACT : Vehicle Sensor Data Master SYS GPS Interrupt Signal Get Processing
+* FUNCTION : Provide SYS GPS interrupt signals
+* ARGUMENT : ul_did : Data ID
+* : uc_get_method : Data collection way(Not used)
+* : VEHICLESENS_GETMETHOD_CAN : CAN communication
+* : VEHICLESENS_GETMETHOD_LINE : LineSensor drivers
+* : VEHICLESENS_GETMETHOD_GPS : GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterSysGpsInterruptSignal(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (pst_data != NULL) {
+ if (ul_did == VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL) {
+ VehicleSensGetSysGpsInterruptSignal(pst_data);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pst_data == NULL\r\n");
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterMainGpsInterruptSignal
+* ABSTRACT : Vehicle Sensor Data Master MAIN GPS Interrupt Signal Get Processing
+* FUNCTION : Provide MAIN GPS interrupt signals
+* ARGUMENT : ul_did : Data ID
+* : uc_get_method : Data collection way(Not used)
+* : VEHICLESENS_GETMETHOD_CAN : CAN communication
+* : VEHICLESENS_GETMETHOD_LINE : LineSensor drivers
+* : VEHICLESENS_GETMETHOD_GPS : GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterMainGpsInterruptSignal(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (pst_data != NULL) {
+ if (ul_did == VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL) {
+ VehicleSensGetMainGpsInterruptSignal(pst_data);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pst_data == NULL\r\n");
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterGyroConnectStatus
+* ABSTRACT : Vehicle Sensor Data Master Gyro Connection Status Get Processing
+* FUNCTION : Provide the status of the gyro connection
+* ARGUMENT : ul_did : Data ID
+* : uc_get_method : Data collection way(Not used)
+* : VEHICLESENS_GETMETHOD_CAN : CAN communication
+* : VEHICLESENS_GETMETHOD_LINE : LineSensor drivers
+* : VEHICLESENS_GETMETHOD_GPS : GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterGyroConnectStatus(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (pst_data != NULL) {
+ if (ul_did == VEHICLE_DID_GYRO_CONNECT_STATUS) {
+ VehicleSensGetGyroConnectStatus(pst_data);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x)\r\n", ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pst_data == NULL\r\n");
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterGpsAntennaStatus
+* ABSTRACT : Vehicle Sensor Data Master GPS Antenna Connection Status Get Processing
+* FUNCTION : Provide GPS antenna connection status
+* ARGUMENT : ul_did : Data ID
+* : uc_get_method : Data collection way(Not used)
+* : VEHICLESENS_GETMETHOD_CAN : CAN communication
+* : VEHICLESENS_GETMETHOD_LINE : LineSensor drivers
+* : VEHICLESENS_GETMETHOD_GPS : GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterGpsAntennaStatus(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (pst_data != NULL) {
+ if (ul_did == POSHAL_DID_GPS_ANTENNA) {
+ VehicleSensGetGpsAntennaStatus(pst_data);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pst_data == NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Sensor counter acquisition
+ *
+ * @return Sensor Counter
+ *
+ */
+static uint8_t VehicleSensGetSensorCnt(void) {
+ VEHICLESENS_DATA_MASTER st_data;
+ uint8_t sensCnt;
+
+ /* Synchronous counter acquisition */
+ VehicleSensGetSnsCounterl(&st_data);
+
+ sensCnt = st_data.uc_data[0];
+
+ return sensCnt;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_DeliveryCtrl.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_DeliveryCtrl.cpp
new file mode 100755
index 0000000..15aabff
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_DeliveryCtrl.cpp
@@ -0,0 +1,2243 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_DeliveryCtrl.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle Sensor Destination Management
+ * Module configuration VehicleSensInitDeliveryCtrlTbl() Vehicle sensor delivery destination management table initialization function
+ * VehicleSensInitDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management area initialization function
+ * VehicleSensInitPkgDeliveryTblMng() Vehicle Sensor Package Delivery Management Table Initialization Function
+ * VehicleSensEntryDeliveryCtrl() Vehicle sensor delivery destination management registration function
+ * VehicleSensAddDeliveryCtrlTbl() Vehicle sensor delivery destination management table addition function
+ * VehicleSensUpdateDeliveryCtrlTbl() Vehicle sensor delivery destination management table update function
+ * VehicleSensUpdatePkgDeliveryCtrlTbl() Vehicle Sensor Delivery Destination Management Table Package Delivery Data Update Function
+ * VehicleSensAddDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management addition function
+ * VehicleSensUpdateDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management update function
+ * VehicleSensAddPkgDeliveryTblMng() Vehicle Sensor Package Delivery Management Table Additional Function
+ * VehicleSensEntryPkgDeliveryCtrl() Vehicle sensor package delivery management registration function
+ * VehicleSensMakeDeliveryPnoTbl() Vehicle Sensor Destination PNO Table Creation Function
+ * VehicleSensAddPnoTbl() Vehicle Sensor Destination PNO Table Addition Function
+ * VehicleSensDeliveryProc() Vehicle Sensor Data Delivery Process
+ * VehicleSensFirstDelivery() Vehicle Sensor Initial Data Delivery Process
+ * VehicleSensFirstPkgDelivery() Vehicle Sensor Initial Package Data Delivery Process
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_common_API.h>
+#include <vehicle_service/POS_gps_API.h>
+#include "VehicleSens_DeliveryCtrl.h"
+#include "Dead_Reckoning_Local_Api.h"
+#include "SensorLog.h"
+#include "POS_private.h"
+
+#define VEHICLE_SENS_DELIVERY_CTRL_DEBUG 0
+#define VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG 0
+
+#define GYRO_NORMAL (0U)
+#define GYRO_ERROR (1U)
+#define GYRO_UNFIXED (2U)
+
+#define _pb_strcat(pdest, psrc, size) (strncat(pdest, psrc, size) , (0))
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DELIVERY_CTRL_TBL g_stdelivery_ctrl_tbl;
+static VEHICLESENS_DELIVERY_CTRL_TBL_MNG g_stdelivery_ctrl_tbl_mng;
+static VEHICLESENS_PKG_DELIVERY_TBL_MNG g_stpkgdelivery_tbl_mng;
+static VEHICLESENS_DELIVERY_PNO_TBL g_stdelivery_pno_tbl;
+
+/* ++ PastModel002 response DR */
+static VEHICLESENS_DELIVERY_CTRL_TBL g_stdelivery_ctrl_tbl_dr;
+static VEHICLESENS_DELIVERY_CTRL_TBL_MNG g_stdelivery_ctrl_tbl_mng_dr;
+static VEHICLESENS_DELIVERY_PNO_TBL g_stdelivery_pno_tbl_dr;
+
+/* -- PastModel002 response DR */
+
+#if CONFIG_HW_PORTSET_TYPE_C
+u_int16 gusSeqNum; /* Sequence number for split transmission */
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensInitDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table initialization function
+* FUNCTION : Delivery destination management table initialization processing
+* ARGUMENT : void
+* NOTE :
+******************************************************************************/
+void VehicleSensInitDeliveryCtrlTbl(void) {
+ memset(&g_stdelivery_ctrl_tbl, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL));
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensInitDeliveryCtrlTblMng
+* ABSTRACT : Vehicle Sensor DR Internal Delivery Destination Management Table Management Area Initialization Function
+* FUNCTION : Delivery destination management table management area initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitDeliveryCtrlTblMng(void) {
+ memset(&g_stdelivery_ctrl_tbl_mng, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL_MNG));
+}
+
+/* ++ PastModel002 response DR */
+/*******************************************************************************
+* MODULE : VehicleSensInitDeliveryCtrlTblDR
+* ABSTRACT : Vehicle sensor delivery destination management table initialization function
+* FUNCTION : DR distribution target management table initialization processing
+* ARGUMENT : void
+* NOTE :
+******************************************************************************/
+void VehicleSensInitDeliveryCtrlTblDR(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&g_stdelivery_ctrl_tbl_dr, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL));
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensInitDeliveryCtrlTblMngDR
+* ABSTRACT : Vehicle sensor delivery destination management table management area initialization function
+* FUNCTION : Initialization processing for the management table area of the delivery destination management table for DR
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitDeliveryCtrlTblMngDR(void) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&g_stdelivery_ctrl_tbl_mng_dr, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL_MNG));
+}
+// LCOV_EXCL_STOP
+
+/* -- PastModel002 response DR */
+
+/*******************************************************************************
+* MODULE : VehicleSensInitPkgDeliveryTblMng
+* ABSTRACT : Vehicle Sensor Package Delivery Management Table Initialization Function
+* FUNCTION : Delivery Package Management Table Initialization Processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitPkgDeliveryTblMng(void) {
+ memset(&g_stpkgdelivery_tbl_mng, 0x00, sizeof(VEHICLESENS_PKG_DELIVERY_TBL_MNG));
+}
+
+#if CONFIG_HW_PORTSET_TYPE_C
+/*******************************************************************************
+* MODULE : VehicleSensInitSeqNum
+* ABSTRACT : Sequence number initialization function for split transmission
+* FUNCTION : Sequence number initialization processing for split transmission
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSeqNum(void) {
+ gusSeqNum = 0;
+}
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensEntryDeliveryCtrl
+* ABSTRACT : Vehicle sensor delivery destination management registration function
+* FUNCTION : Shipping management table,Update the shipping management table management.
+* ARGUMENT : pst_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : VEHICLE_RET_NORMAL :Successful registration
+******************************************************************************/
+VEHICLE_RET_API VehicleSensEntryDeliveryCtrl(const VEHICLE_MSG_DELIVERY_ENTRY *pst_delivery_entry) {
+ int32 i;
+ u_int8 uc_action_type = VEHICLESENS_ACTION_TYPE_ADD;
+ int32 uc_did_flag;
+ DID ulentry_did = pst_delivery_entry->data.did;
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data = NULL;
+ VEHICLE_RET_API ret = VEHICLE_RET_NORMAL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ BOOL bexist_flag = FALSE;
+
+ /* Check if the data ID exists. */
+ uc_did_flag = VehicleSensCheckDid(ulentry_did);
+ if (uc_did_flag == 0) { // LCOV_EXCL_BR_LINE 6:alway be 1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ ret = VEHICLE_RET_ERROR_DID; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ // LCOV_EXCL_LINE 8: dead code // NOLINT(whitespace/line_length)
+ }
+
+ /* Check the number of registered shipments. */
+ if ((ret == VEHICLE_RET_NORMAL) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (g_stdelivery_ctrl_tbl.us_dnum >= VEHICLESENS_DELIVERY_INFO_MAX)) {
+ /* Return the FULL of delivery registrations*/
+ ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* Duplicate delivery registration check*/
+ for (i = 0; i < g_stdelivery_ctrl_tbl.us_dnum; i++) {
+ if ((g_stdelivery_ctrl_tbl.st_ctrl_data[i].ul_did == ulentry_did) &&
+ (g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pno == pst_delivery_entry->data.pno) &&
+ (g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_method == VEHICLESENS_DELIVERY_METHOD_NORMAL)) {
+ /* When the same shipping address (PNO) and shipping DID are already registered,Update registration information and exit */
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_chg_type = pst_delivery_entry->data.delivery_timing;
+ bexist_flag = TRUE;
+ break;
+ }
+ }
+
+ if (bexist_flag == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Duplicate DID=0x%x PNO=0x%x ChgType=%d",
+ ulentry_did,
+ pst_delivery_entry->data.pno,
+ pst_delivery_entry->data.delivery_timing);
+ } else {
+ /* By searching for the delivery registration of the relevant DID,Hold the address. */
+ for (i = 0; i < g_stdelivery_ctrl_tbl_mng.us_dnum; i++) {
+ if (g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did == ulentry_did) {
+ uc_action_type = VEHICLESENS_ACTION_TYPE_UPDATE;
+ pst_existing_mng_data = &g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i];
+ }
+ }
+ /* Add to the shipping management table.*/
+ VehicleSensAddDeliveryCtrlTbl(pst_delivery_entry);
+
+ /* Processing when updating existing data*/
+ if (uc_action_type == VEHICLESENS_ACTION_TYPE_UPDATE) {
+ /* Update the shipping management table.*/
+ VehicleSensUpdateDeliveryCtrlTbl(pst_existing_mng_data);
+
+ /* Update the shipping destination management table management information.*/
+ VehicleSensUpdateDeliveryCtrlTblMng(pst_existing_mng_data);
+ } else { /* Newly added processing*/
+ /* Add to the shipping management table management information.*/
+ VehicleSensAddDeliveryCtrlTblMng(pst_delivery_entry);
+ }
+ }
+ }
+ return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensAddDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table addition function
+* FUNCTION : Add to the shipping management table.
+* ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddDeliveryCtrlTbl(const VEHICLE_MSG_DELIVERY_ENTRY *pst_delivery_entry) {
+ VEHICLESENS_DELIVERY_CTRL_TBL_DATA *pst_ctrl_data;
+
+ pst_ctrl_data = &g_stdelivery_ctrl_tbl.st_ctrl_data[g_stdelivery_ctrl_tbl.us_dnum];
+ pst_ctrl_data->ul_did = pst_delivery_entry->data.did;
+ pst_ctrl_data->us_pno = pst_delivery_entry->data.pno;
+ pst_ctrl_data->uc_chg_type = pst_delivery_entry->data.delivery_timing;
+ pst_ctrl_data->uc_ctrl_flg = pst_delivery_entry->data.ctrl_flg;
+ pst_ctrl_data->us_link_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->us_pkg_start_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->us_pkg_end_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->uc_method = VEHICLESENS_DELIVERY_METHOD_NORMAL;
+ g_stdelivery_ctrl_tbl.us_dnum = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum + 1);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensUpdateDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table update function
+* FUNCTION : Update the shipping management table.
+* ARGUMENT : *pstExistingMngData : Pointer to the previous data information with the same data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensUpdateDeliveryCtrlTbl(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) {
+ /* Ignore->MISRA-C++:2008 Rule 7-1-2 */
+ /* Update Link Index Only.
+ For indexes of usEndIdx values matching the data IDs in the target management table
+ Making usLinkIdx an Index-Registered Index */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ g_stdelivery_ctrl_tbl.st_ctrl_data[pst_existing_mng_data->us_end_idx].us_link_idx =
+ static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensUpdatePkgDeliveryCtrlTbl
+* ABSTRACT : Vehicle Sensor Delivery Destination Management Table Package Delivery Data Update Function
+* FUNCTION : Updating Package Delivery Data in the Destination Management Table.
+* ARGUMENT : us_dnum : Number of data items in the package delivery management table
+* : us_pkg_num : Number of packages to create
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensUpdatePkgDeliveryCtrlTbl(u_int16 us_dnum, u_int16 us_pkg_num) {
+ VEHICLESENS_DELIVERY_CTRL_TBL_DATA *pst_ctrl_data;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_ctrl_data = &g_stdelivery_ctrl_tbl.st_ctrl_data[g_stdelivery_ctrl_tbl.us_dnum - 1];
+ pst_ctrl_data->us_pkg_start_idx = us_dnum;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_ctrl_data->us_pkg_end_idx = static_cast<u_int16>(us_dnum + us_pkg_num - 1);
+ pst_ctrl_data->uc_method = VEHICLESENS_DELIVERY_METHOD_PACKAGE;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensAddDeliveryCtrlTblMng
+* ABSTRACT : Vehicle sensor delivery destination management table management addition function
+* FUNCTION : Add to the shipping management table management.
+* ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddDeliveryCtrlTblMng(const VEHICLE_MSG_DELIVERY_ENTRY *pst_delivery_entry) {
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_ctrl_mng_data;
+
+ pst_ctrl_mng_data = &g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[g_stdelivery_ctrl_tbl_mng.us_dnum];
+ pst_ctrl_mng_data->ul_did = pst_delivery_entry->data.did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_ctrl_mng_data->us_start_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_ctrl_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1);
+ pst_ctrl_mng_data->usdlvry_entry_num++;
+ g_stdelivery_ctrl_tbl_mng.us_dnum++;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensUpdateDeliveryCtrlTblMng
+* ABSTRACT : Vehicle sensor delivery destination management table management update function
+* FUNCTION : Update the shipping management table management.
+* ARGUMENT : *pst_existing_mng_data : Pointer to the previous data information with the same data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensUpdateDeliveryCtrlTblMng(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) {
+ /* Update only the end index and the number of registered shipping destinations. */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_existing_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1);
+ pst_existing_mng_data->usdlvry_entry_num++;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensAddPkgDeliveryTblMng
+* ABSTRACT : Vehicle Sensor Package Delivery Management Table Additional Function
+* FUNCTION : Add to the shipping management table management.
+* ARGUMENT : *pst_pkg : Pointer to package delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddPkgDeliveryTblMng(const SENSOR_MSG_DELIVERY_ENTRY *pst_pkg) {
+ int32 i; /* Generic counters */
+
+ /* Data ID registration */
+ /* Registration of delivery data index */
+ for (i = 0; i < (pst_pkg->data.pkg_num); i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ g_stpkgdelivery_tbl_mng.st_pkg_data[g_stpkgdelivery_tbl_mng.us_dnum].ul_did = pst_pkg->data.did[i];
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ g_stpkgdelivery_tbl_mng.st_pkg_data[g_stpkgdelivery_tbl_mng.us_dnum].usdlvry_idx = \
+ static_cast<u_int16>(g_stpkgdelivery_tbl_mng.us_dnum + 1);
+ g_stpkgdelivery_tbl_mng.us_dnum++;
+ }
+ /* The final delivery data index overwrites the terminating code */
+ g_stpkgdelivery_tbl_mng.st_pkg_data[g_stpkgdelivery_tbl_mng.us_dnum - 1].usdlvry_idx = VEHICLESENS_LINK_INDEX_END;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensEntryPkgDeliveryCtrl
+* ABSTRACT : Vehicle sensor package delivery management registration function
+* FUNCTION : Shipping management table,Destination management table management,Update the package delivery management table.
+* ARGUMENT : *pst_pkg : Pointer to package delivery registration information
+* NOTE :
+* RETURN : VEHICLE_RET_NORMAL : Successful registration
+******************************************************************************/
+VEHICLE_RET_API VehicleSensEntryPkgDeliveryCtrl(const SENSOR_MSG_DELIVERY_ENTRY *pst_pkg ,
+ u_int8 uc_ext_chk) { /* Ignore->MISRA-C++:2008 Rule 6-6-5 */
+ int32 i;
+ u_int16 us_size = 0;
+ u_int8 uc_action_type = VEHICLESENS_ACTION_TYPE_ADD;
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data = NULL;
+ VEHICLE_MSG_DELIVERY_ENTRY st_delivery_entry;
+ u_int16 us_boundary_adj; /* For boundary adjustment */
+ u_int16 us_next_offset; /* For size calculation */
+ VEHICLE_RET_API ret = VEHICLE_RET_NORMAL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ BOOL bexist_flag = FALSE;
+
+ /* Check if the data ID exists. */
+ for (i = 0; i < (pst_pkg->data.pkg_num); i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (VEHICLESENS_INVALID == VehicleSensCheckDid(pst_pkg->data.did[i])) { // LCOV_EXCL_BR_LINE 200: always Valid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = VEHICLE_RET_ERROR_DID; // // LCOV_EXCL_LINE 8 :dead code
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+ }
+
+ /* Check the number of registered shipments. */
+ if ((ret == VEHICLE_RET_NORMAL) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (VEHICLESENS_DELIVERY_INFO_MAX <= g_stdelivery_ctrl_tbl.us_dnum)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Return the FULL of delivery registrations*/
+ ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Check the number of registered package shipments. */
+ if ((ret == VEHICLE_RET_NORMAL) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (VEHICLESENS_PKG_DELIVERY_INFO_MAX < (g_stpkgdelivery_tbl_mng.us_dnum + pst_pkg->data.pkg_num))) {
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Return the FULL of delivery registrations*/
+ ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* Check that the size of the buffer to be delivered does not exceed the maximum size. */
+ /* For boundary adjustment */
+ us_boundary_adj = (u_int16)VEHICLESENS_BIT1 | (u_int16)VEHICLESENS_BIT0;
+ for (i = 0; i < pst_pkg->data.pkg_num; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ if (uc_ext_chk == VEHICLESENS_EXT_OFF) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */ // LCOV_EXCL_BR_LINE 200: VEHICLESENS_EXT_OFF passed in function is dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ us_next_offset = VehicleSensGetDataMasterOffset(pst_pkg->data.did[i]); // LCOV_EXCL_LINE 8: dead code
+ } else {
+ us_next_offset = VehicleSensGetDataMasterExtOffset(pst_pkg->data.did[i]);
+ }
+#else
+ us_next_offset = VehicleSensGetDataMasterOffset(pst_pkg->data.did[i]);
+#endif
+ /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
+ if ((us_next_offset & us_boundary_adj) != 0) {
+ /* If you need to adjust */
+ /* Mask Lower Bit Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
+ us_next_offset = static_cast<u_int16>(us_next_offset & ~us_boundary_adj);
+ us_next_offset = static_cast<u_int16>(us_next_offset + (u_int16)VEHICLESENS_BIT2); /* Add numbers */
+ }
+ us_size = static_cast<u_int16>(us_size + us_next_offset); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+ if (SENSOR_VSINFO_DSIZE < us_size) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Return the FULL of delivery registrations(Exceed the size of the buffer to be delivered due to the combination of packages)*/
+ ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+ }
+
+ if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ for (i = 0; i < g_stdelivery_ctrl_tbl.us_dnum; i++) {
+ if ((g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pno == pst_pkg->data.pno) &&
+ (g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_method == VEHICLESENS_DELIVERY_METHOD_PACKAGE)) {
+ /* When the same shipping address (PNO) is already registered,Update registration information and exit */
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_chg_type = pst_pkg->data.delivery_timing;
+ bexist_flag = TRUE;
+ break;
+ }
+ }
+
+ if (bexist_flag == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Duplicate PNO=0x%x ChgType=%d",
+ pst_pkg->data.pno, pst_pkg->data.delivery_timing);
+ } else {
+ /* By searching for the delivery registration of the relevant DID,Hold the address. */
+ for (i = 0; i < g_stdelivery_ctrl_tbl_mng.us_dnum; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did == pst_pkg->data.did[0]) {
+ uc_action_type = VEHICLESENS_ACTION_TYPE_UPDATE;
+ pst_existing_mng_data = &g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i];
+ }
+ }
+ /* Type conversion,And copies of the data section(Because the header is unused,Not involved) */
+ memset(reinterpret_cast<void *>(&st_delivery_entry),
+ static_cast<int32>(0),
+ (size_t)sizeof(VEHICLE_MSG_DELIVERY_ENTRY));
+ st_delivery_entry.data.did = pst_pkg->data.did[0];
+ st_delivery_entry.data.pno = pst_pkg->data.pno;
+ st_delivery_entry.data.delivery_timing = pst_pkg->data.delivery_timing;
+ st_delivery_entry.data.ctrl_flg = pst_pkg->data.ctrl_flg;
+ st_delivery_entry.data.event_id = pst_pkg->data.event_id;
+ /* Add to the shipping management table.*/
+ VehicleSensAddDeliveryCtrlTbl(&st_delivery_entry);
+
+ /* Processing when updating existing data*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
+ if (uc_action_type == VEHICLESENS_ACTION_TYPE_UPDATE) {
+ /* Update the shipping management table.*/
+ VehicleSensUpdateDeliveryCtrlTbl(pst_existing_mng_data);
+
+ /* Update the shipping destination management table management information.*/
+ VehicleSensUpdateDeliveryCtrlTblMng(pst_existing_mng_data);
+ } else { /* Newly added processing*/
+ /* Add to the shipping management table management information.*/
+ VehicleSensAddDeliveryCtrlTblMng(&st_delivery_entry);
+ }
+
+ /* Updating Package Relationship Data in the Destination Management Table.*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ VehicleSensUpdatePkgDeliveryCtrlTbl(g_stpkgdelivery_tbl_mng.us_dnum, pst_pkg->data.pkg_num);
+ /* Add to the package delivery management table.*/
+ VehicleSensAddPkgDeliveryTblMng(pst_pkg);
+ }
+ }
+
+ return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensMakeDeliveryPnoTbl
+* ABSTRACT : Vehicle sensor delivery destination PNO table creation function
+* FUNCTION : Create the shipping destination PNO table
+* ARGUMENT : ul_did Data ID
+* Change_type Delivery Trigger
+* NOTE :
+* RETURN : VEHICLESENS_DELIVERY_PNO_TBL* Pointer to the shipping PNO table
+******************************************************************************/
+VEHICLESENS_DELIVERY_PNO_TBL* VehicleSensMakeDeliveryPnoTbl(DID ul_did, u_int8 change_type) {
+ int32 i;
+ u_int8 uc_ctrl_tbl_mng_data_list;
+ u_int16 us_index = 0;
+ u_int16 us_dnum = 0;
+
+ /* Get the start index and count of the corresponding data ID. */
+ uc_ctrl_tbl_mng_data_list = static_cast<u_int8>(
+ (sizeof(g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data)) /
+ (sizeof(g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[0])));
+ for (i = 0; i < uc_ctrl_tbl_mng_data_list; i++) {
+ /* Stores the information of the corresponding DID.. */
+ if (g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did == ul_did) {
+ us_index = g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].us_start_idx;
+ us_dnum = g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].usdlvry_entry_num;
+ break;
+ }
+ }
+
+ /* Create a PNO list */
+ g_stdelivery_pno_tbl.us_dnum = 0;
+ if (change_type == VEHICLESENS_CHGTYPE_CHG) {
+ /* Processing when delivery timing is changed*/
+ for (i = 0; i < us_dnum; i++) {
+ /* Functionalization by Increasing Structure Members */
+ VehicleSensAddPnoTbl(us_index);
+ us_index = g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_link_idx;
+ }
+ } else {
+ /* Processing when delivery timing is update */
+ for (i = 0; i < us_dnum; i++) {
+ if (VEHICLE_DELIVERY_TIMING_UPDATE == g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].uc_chg_type) {
+ /* Functionalization by Increasing Structure Members */
+ VehicleSensAddPnoTbl(us_index);
+ }
+ us_index = g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_link_idx;
+ }
+ }
+ return(&g_stdelivery_pno_tbl);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensAddPnoTbl
+* ABSTRACT : Vehicle Sensor Destination PNO Table Addition Function
+* FUNCTION : Add to the shipping PNO table.
+* ARGUMENT : us_index : Index of the referenced destination management table
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddPnoTbl(u_int16 us_index) {
+ u_int16 us_pno_tbl_idx;
+
+ us_pno_tbl_idx = g_stdelivery_pno_tbl.us_dnum;
+ g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].us_pno = \
+ g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_pno;
+ g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].us_pkg_start_idx = \
+ g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_pkg_start_idx;
+ g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].us_pkg_end_idx = \
+ g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_pkg_end_idx;
+ g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].uc_method = \
+ g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].uc_method;
+ g_stdelivery_pno_tbl.us_dnum++;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensDeliveryGPS
+* ABSTRACT : Vehicle Sensor Data Delivery Process
+* FUNCTION : Deliver data to a destination.
+* ARGUMENT : ul_did :Data ID
+* uc_chg_type :Delivery timing
+* uc_get_method :Acquisition method
+* NOTE :
+* RETURN : void
+******************************************************************************/
+u_int8 VehicleSensDeliveryGPS(DID ul_did, u_int8 uc_get_method, u_int8 uc_current_get_method, int32 pno_index,
+ u_int32* cid,
+ VEHICLESENS_DATA_MASTER* stmaster,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) {
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ SENSORLOCATION_MSG_LONLATINFO *plonlat_msg;
+ SENSORLOCATION_MSG_ALTITUDEINFO *paltitude_msg;
+ SENSORMOTION_MSG_HEADINGINFO *pheading_msg;
+#endif
+
+ SENSOR_MSG_GPSDATA_DAT gps_master;
+ VEHICLESENS_DELIVERY_FORMAT delivery_data;
+ u_int16 length;
+ u_int16 senslog_len;
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+
+ VehicleSensGetGpsDataMaster(ul_did, uc_current_get_method, &gps_master);
+
+ if (ul_did == POSHAL_DID_GPS_TIME) {
+ /* GPS time,Because there is no header in the message to be delivered,
+ Padding deliveryData headers */
+ (void)memcpy(reinterpret_cast<void*>(&delivery_data),
+ reinterpret_cast<void*>(&gps_master.uc_data[0]), gps_master.us_size);
+ length = gps_master.us_size;
+ senslog_len = length;
+ *cid = CID_VEHICLESENS_VEHICLE_INFO_GPS_TIME;
+ } else if (ul_did == VEHICLE_DID_LOCATION_LONLAT) {
+ plonlat_msg = reinterpret_cast<SENSORLOCATION_MSG_LONLATINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_current_get_method, stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(plonlat_msg->data)),
+ reinterpret_cast<void*>(&(stmaster->uc_data[0])), stmaster->us_size);
+ length = (u_int16)(stmaster->us_size);
+ senslog_len = length;
+ *cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
+ } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE) {
+ paltitude_msg = reinterpret_cast<SENSORLOCATION_MSG_ALTITUDEINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(paltitude_msg->data)),
+ reinterpret_cast<void*>(&stmaster->uc_data[0]), stmaster->us_size);
+ length = (u_int16)(stmaster->us_size);
+ senslog_len = length;
+ *cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE;
+ } else if (ul_did == VEHICLE_DID_MOTION_HEADING) {
+ pheading_msg = reinterpret_cast<SENSORMOTION_MSG_HEADINGINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(pheading_msg->data)),
+ reinterpret_cast<void*>(&stmaster->uc_data[0]), stmaster->us_size);
+ length = (u_int16)(stmaster->us_size);
+ senslog_len = length;
+ *cid = CID_POSIF_REGISTER_LISTENER_HEADING;
+ } else {
+ delivery_data.header.did = gps_master.ul_did;
+ delivery_data.header.size = gps_master.us_size;
+ delivery_data.header.rcv_flag = gps_master.uc_rcv_flag;
+ delivery_data.header.sensor_cnt = gps_master.uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(&delivery_data.data[0]),
+ reinterpret_cast<void *>(&gps_master.uc_data[0]),
+ (size_t)delivery_data.header.size);
+
+ length = static_cast<u_int16>((u_int16)sizeof(delivery_data.header) + \
+ delivery_data.header.size);
+ senslog_len = delivery_data.header.size;
+ *cid = CID_VEHICLESENS_VEHICLE_INFO;
+ }
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ static_cast<CID>(*cid),
+ length,
+ (const void *)&delivery_data);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ if (*cid != CID_VEHICLESENS_VEHICLE_INFO) {
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&delivery_data),
+ senslog_len, uc_result);
+ } else {
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(delivery_data.data[0])),
+ senslog_len, uc_result);
+ }
+ return uc_result;
+}
+
+u_int8 VehicleSensDeliveryFst(DID ul_did, u_int8 uc_get_method, int32 pno_index,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) {
+ VEHICLESENS_DATA_MASTER_FST st_master_fst; /* Master of initial sensor data */
+ VEHICLESENS_DATA_MASTER_FST st_master_fst_temp; /* For temporary storage */
+
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+ (void)memset(reinterpret_cast<void *>(&st_master_fst),
+ 0,
+ sizeof(VEHICLESENS_DATA_MASTER_FST));
+ (void)memset(reinterpret_cast<void *>(&st_master_fst_temp),
+ 0,
+ sizeof(VEHICLESENS_DATA_MASTER_FST));
+ VehicleSensGetDataMasterFst(ul_did, uc_get_method, &st_master_fst);
+ if (st_master_fst.partition_flg == 1) {
+ /* When the partitioning flag is enabled,Or exceeds the size that can be sent,Perform split transmission */
+ memcpy(&st_master_fst_temp, &st_master_fst, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ if ((ul_did == POSHAL_DID_GYRO_X_FST) || /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ (ul_did == POSHAL_DID_GYRO_Y_FST) ||
+ (ul_did == POSHAL_DID_GYRO_Z_FST) ||
+ (ul_did == POSHAL_DID_GSNS_X_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Y_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Z_FST)) {
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ /* Size of data that can be transmitted in one division(Same size definition used)*/
+ st_master_fst_temp.us_size = LSDRV_FSTSNS_DSIZE_GYRO_X;
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&st_master_fst_temp.uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size(Same size definition used)Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ st_master_fst_temp.us_size = static_cast<u_int16>(st_master_fst.us_size - \
+ LSDRV_FSTSNS_DSIZE_GYRO_X);
+ memcpy(&st_master_fst_temp.uc_data[0],
+ &st_master_fst.uc_data[LSDRV_FSTSNS_DSIZE_GYRO_X],
+ st_master_fst_temp.us_size);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 #Coverity_19347 */
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+ } else if (ul_did == POSHAL_DID_REV_FST) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ /* Size of data that can be transmitted in one division */
+ st_master_fst_temp.us_size = LSDRV_FSTSNS_DSIZE_REV;
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&st_master_fst_temp.uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ st_master_fst_temp.us_size = static_cast<u_int16>(st_master_fst.us_size - \
+ LSDRV_FSTSNS_DSIZE_REV);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 #Coverity_19347 */
+ memcpy(&st_master_fst_temp.uc_data[0],
+ &st_master_fst.uc_data[LSDRV_FSTSNS_DSIZE_REV],
+ st_master_fst_temp.us_size);
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+ } else {
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ /* Size of data that can be transmitted in one division(Same size definition used)*/
+ st_master_fst_temp.us_size = LSDRV_FSTSNS_DSIZE_GYRO_TEMP;
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&st_master_fst_temp.uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size(Same size definition used)Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ st_master_fst_temp.us_size = static_cast<u_int16>(st_master_fst.us_size - \
+ LSDRV_FSTSNS_DSIZE_GYRO_TEMP);
+ memcpy(&st_master_fst_temp.uc_data[0],
+ &st_master_fst.uc_data[LSDRV_FSTSNS_DSIZE_GYRO_TEMP],
+ st_master_fst_temp.us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 #Coverity_19347*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+ }
+ } else {
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst.us_size + 8),
+ (const void *)&st_master_fst);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst.uc_data[0])),
+ st_master_fst.us_size,
+ uc_result);
+ }
+
+ return uc_result;
+}
+
+u_int8 VehicleSensDeliveryGyro(DID ul_did, u_int8 uc_current_get_method, int32 pno_index, const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+
+ VEHICLESENS_DATA_MASTER_GYRO_TROUBLE st_master_gyro_trouble;
+ SENSORMOTION_MSG_GYROTROUBLEINFO_DAT st_msg_gyro_trouble_info;
+
+ /* Initialization */
+ st_msg_gyro_trouble_info.reserve = 0;
+
+ VehicleSensGetDataMasterGyroTrouble(ul_did, uc_current_get_method, &st_master_gyro_trouble);
+
+ /* Size storage(GYROTROUBLE) */
+ st_msg_gyro_trouble_info.size = st_master_gyro_trouble.us_size;
+
+ /* Set the GyroTrouble */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_gyro_trouble_info.gyro_trouble)),
+ reinterpret_cast<void *>(&(st_master_gyro_trouble.uc_data)),
+ sizeof(st_msg_gyro_trouble_info.gyro_trouble));
+
+#if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[DIAG] ul_did = VEHICLE_DID_GYRO_TROUBLE");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[DIAG] st_msg_gyro_trouble_info.size = %d", st_msg_gyro_trouble_info.size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[DIAG] st_msg_gyro_trouble_info.gyro_trouble = 0x%08X \r\n",
+ st_msg_gyro_trouble_info.gyro_trouble);
+#endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
+ /* Since the undefined state is not a device specification,Do not deliver to the app side */
+ if (st_msg_gyro_trouble_info.gyro_trouble != GYRO_UNFIXED) {
+
+ /* Send GyroTrouble to API-caller */
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLE_SENSORMOTION_GYROTROUBLE,
+ sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
+ (const void *)&st_msg_gyro_trouble_info);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&st_msg_gyro_trouble_info),
+ sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
+ uc_result);
+#if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] GyroTrouble Delivery");
+#endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
+ }
+ return uc_result;
+}
+// LCOV_EXCL_STOP
+
+void VehicleSensDeliveryAntenna(DID ul_did, u_int8 uc_current_get_method, int32 pno_index, const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS gps_antenna_status;
+ VEHICLESENS_DELIVERY_FORMAT delivery_data;
+ u_int16 length;
+
+ VehicleSensGetDataMasterGpsAntennaStatus(ul_did, uc_current_get_method, &gps_antenna_status);
+
+ delivery_data.header.did = gps_antenna_status.ul_did;
+ delivery_data.header.size = gps_antenna_status.us_size;
+ delivery_data.header.rcv_flag = gps_antenna_status.uc_rcvflag;
+ delivery_data.header.sensor_cnt = gps_antenna_status.uc_sensor_cnt;
+ (void)memcpy(reinterpret_cast<void *>(&delivery_data.data[0]),
+ reinterpret_cast<void *>(&gps_antenna_status.uc_data),
+ (size_t)delivery_data.header.size);
+
+ length = static_cast<u_int16>(static_cast<u_int32>(sizeof(delivery_data.header)) + delivery_data.header.size);
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ length,
+ (const void *)&delivery_data);
+}
+// LCOV_EXCL_STOP
+
+u_int8 VehicleSensDeliveryOther(DID ul_did, u_int8 uc_current_get_method, int32 pno_index,
+ u_int32* cid, // NOLINT(readability/nolint)
+ VEHICLESENS_DATA_MASTER* stmaster, // NOLINT(readability/nolint)
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) {
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+/* Determine CID */
+ if (ul_did == VEHICLE_DID_LOCATION_LONLAT_NAVI) {
+ *cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
+ } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE_NAVI) { // LCOV_EXCL_BR_LINE 6:VEHICLE_DID_LOCATION_ALTITUDE_NAVI no API to pass in // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE; // LCOV_EXCL_LINE 8: dead code
+ } else if ((ul_did == VEHICLE_DID_MOTION_SPEED_NAVI) ||
+ (ul_did == VEHICLE_DID_MOTION_SPEED_INTERNAL)) {
+ *cid = CID_VEHICLE_SENSORMOTION_SPEED;
+ } else if (ul_did == VEHICLE_DID_MOTION_HEADING_NAVI) {
+ *cid = CID_POSIF_REGISTER_LISTENER_HEADING;
+ } else if (ul_did == VEHICLE_DID_SETTINGTIME) {
+ *cid = CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ;
+ } else { // LCOV_EXCL_BR_LINE 6: cannot be this one
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *cid = 0xFFFF; /* DID error */ // LCOV_EXCL_LINE 8: dead code
+ }
+
+ /* Send vehicle sensor information notification */
+ if (*cid == 0xFFFF) { // LCOV_EXCL_BR_LINE 6: cannot be this one
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Error log */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unknown DID [%d]", ul_did);
+ } else {
+ /* Acquire the applicable data information from the data master..*/
+ (void)memset(reinterpret_cast<void *>(stmaster), 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ VehicleSensGetDataMaster(ul_did, uc_current_get_method, stmaster);
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ static_cast<CID>(*cid),
+ (u_int16)(stmaster->us_size),
+ (const void *)&(stmaster->uc_data[0]));
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster->uc_data[0])),
+ stmaster->us_size,
+ uc_result);
+ }
+
+ return uc_result;
+}
+
+void VehicleSensDeliveryProc(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method) {
+ VEHICLESENS_DATA_MASTER stmaster; /* Data master of normal data */
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl; /* Vehicle Sensor Destination PNO Table Pointer */
+ SENSOR_PKG_MSG_VSINFO st_pkg_master; /* Data master for package delivery */
+ uint32_t cid;
+ uint8_t uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+
+ /* Obtain the data acquisition method from the Vehicle Selection Item List */
+ uint8_t uc_current_get_method = VehicleSensGetSelectionItemList(ul_did);
+
+ if (uc_current_get_method == uc_get_method) {
+ /* When the data acquisition methods match (= delivery target) */
+
+ /* Obtain the shipping destination PNO */
+ pst_pno_tbl = (const VEHICLESENS_DELIVERY_PNO_TBL *) VehicleSensMakeDeliveryPnoTbl(ul_did, uc_chg_type);
+
+ if ((pst_pno_tbl->us_dnum) > 0) {
+ /* When there is a shipping destination PNO registration */
+ /* For boundary adjustment */
+ uint16_t us_boundary_adj = (u_int16) VEHICLESENS_BIT1 | (u_int16) VEHICLESENS_BIT0; /* #012 */
+ /* Vehicle sensor information notification transmission process */
+ for (uint32_t i = 0; i < (pst_pno_tbl->us_dnum); i++) {
+ if (VEHICLESENS_DELIVERY_METHOD_PACKAGE == pst_pno_tbl->st_pno_data[i].uc_method) {
+ /* When the delivery method is the package method */
+ (void) memset(reinterpret_cast<void *>(&st_pkg_master), 0, sizeof(SENSOR_PKG_MSG_VSINFO));
+
+ uint16_t us_index = pst_pno_tbl->st_pno_data[i].us_pkg_start_idx;
+ uint8_t uc_data_cnt = 0U;
+ uint16_t us_offset = 0U;
+ for (uint32_t j = 0; j < SENSOR_PKG_DELIVERY_MAX; j++) {
+ DID ul_pkg_did = g_stpkgdelivery_tbl_mng.st_pkg_data[us_index].ul_did; /* Get DID */
+ st_pkg_master.usOffset[uc_data_cnt] = us_offset; /* Offset setting */
+ uc_current_get_method = VehicleSensGetSelectionItemList(ul_pkg_did); /* Data collection way */
+ if (VEHICLESENS_GETMETHOD_GPS == uc_current_get_method) {
+ VehicleSensGetGpsDataMaster(ul_pkg_did, uc_current_get_method,
+ reinterpret_cast<SENSOR_MSG_GPSDATA_DAT *>(&st_pkg_master.ucData[us_offset]));
+ }
+ else {
+ VehicleSensGetDataMaster(ul_pkg_did, uc_current_get_method,
+ reinterpret_cast<VEHICLESENS_DATA_MASTER *>(&st_pkg_master.ucData[us_offset]));
+ }
+ uc_data_cnt++; /* Data count increment */
+ if ((us_index == pst_pno_tbl->st_pno_data[i].us_pkg_end_idx)
+ || (VEHICLESENS_LINK_INDEX_END == g_stpkgdelivery_tbl_mng.st_pkg_data[us_index].usdlvry_idx)) {
+ st_pkg_master.ucDNum = uc_data_cnt; /* To save the number of data */
+ break;
+ }
+ else {
+ /* By creating the following processing contents,Need to obtain an offset value */
+ uint16_t us_next_offset = VehicleSensGetDataMasterOffset(ul_pkg_did); /* Next offset calculation */
+ /* Boundary adjustment of data size */
+ if ((us_next_offset & us_boundary_adj) != 0) {
+ /* If you need to adjust */
+ /* Mask Lower Bit */
+ us_next_offset = static_cast<u_int16>(us_next_offset & ~us_boundary_adj);
+ /* Add numbers */
+ us_next_offset = static_cast<u_int16>(us_next_offset + (u_int16) VEHICLESENS_BIT2);
+ }
+ us_offset = static_cast<u_int16>(us_offset + us_next_offset);
+ /* Get next index */
+ us_index = g_stpkgdelivery_tbl_mng.st_pkg_data[us_index].usdlvry_idx;
+ }
+ }
+ RET_API ret = PosSndMsg(PNO_VEHICLE_SENSOR, pst_pno_tbl->st_pno_data[i].us_pno,
+ CID_SENSOR_PKG_INFO, (u_int16) sizeof(SENSOR_PKG_MSG_VSINFO), (const void *) &st_pkg_master);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS_PKG, 0, pst_pno_tbl->st_pno_data[i].us_pno,
+ reinterpret_cast<uint8_t *>(&st_pkg_master), sizeof(SENSOR_PKG_MSG_VSINFO), uc_result);
+ }
+ else {
+ /* When the delivery system is normal */
+ /* Acquire the applicable data information from the data master..*/
+ if (VEHICLESENS_GETMETHOD_GPS == uc_current_get_method) {
+ uc_result = VehicleSensDeliveryGPS(ul_did, uc_get_method, uc_current_get_method, i, &cid, &stmaster,
+ pst_pno_tbl);
+ }
+ else if ((VEHICLESENS_GETMETHOD_NAVI == uc_get_method) || // NOLINT(readability/braces)
+ (VEHICLESENS_GETMETHOD_OTHER == uc_get_method) || (VEHICLESENS_GETMETHOD_INTERNAL == uc_get_method)) {
+ uc_result = VehicleSensDeliveryOther(ul_did, uc_current_get_method, i, &cid, &stmaster, pst_pno_tbl);
+ }
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ else if ((ul_did == POSHAL_DID_GYRO_X_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_GYRO_Y_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_GYRO_Z_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_REV_FST) ||
+ (ul_did == POSHAL_DID_GYRO_TEMP_FST) ||
+ (ul_did == POSHAL_DID_GSNS_X_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Y_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Z_FST) ||
+ (ul_did == POSHAL_DID_SPEED_PULSE_FST)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Acquire the applicable data information from the data master for the initial sensor..*/
+ uc_result = VehicleSensDeliveryFst(ul_did, uc_get_method, i, pst_pno_tbl);
+ }
+#endif
+ else if (ul_did == VEHICLE_DID_GYRO_TROUBLE) { // LCOV_EXCL_BR_LINE 6:DID is not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uc_result = VehicleSensDeliveryGyro(ul_did, uc_current_get_method, i, pst_pno_tbl); // LCOV_EXCL_LINE 8: dead code // NOLINT(whitespace/line_length)
+ }
+ else { // NOLINT(readability/braces)
+ (void) memset(reinterpret_cast<void *>(&stmaster), 0x00, sizeof(stmaster));
+ VehicleSensGetDataMaster(ul_did, uc_current_get_method, &stmaster);
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ RET_API ret = VehicleSndMsg(PNO_VEHICLE_SENSOR, pst_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO, (u_int16) sizeof(VEHICLESENS_DATA_MASTER), (const void *) &stmaster);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, pst_pno_tbl->st_pno_data[i].us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster.uc_data[0])), stmaster.us_size, uc_result);
+ }
+ }
+ }
+ }
+ }
+}
+
+u_int8 VehicleSensFirstDeliverySens(PNO us_pno, DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_FST* stmaster_fst,
+ VEHICLESENS_DATA_MASTER_FST* stmaster_fst_temp) {
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+ /* Acquire the applicable data information from the data master for the initial sensor..*/
+ (void)memset(reinterpret_cast<void *>(stmaster_fst), 0, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ (void)memset(reinterpret_cast<void *>(stmaster_fst_temp), 0, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ VehicleSensGetDataMasterFst(ul_did, uc_get_method, stmaster_fst);
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[LOG:POSHAL_DID_GYRO_FST,POSHAL_DID_SPEED_PULSE_FST]");
+
+ if (stmaster_fst->partition_flg == 1) {
+ /* When the partitioning flag is enabled,Or exceeds the size that can be sent,Perform split transmission */
+ memcpy(stmaster_fst_temp, stmaster_fst, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ if ((ul_did == POSHAL_DID_GYRO_X_FST) || /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ (ul_did == POSHAL_DID_GYRO_Y_FST) ||
+ (ul_did == POSHAL_DID_GYRO_Z_FST) ||
+ (ul_did == POSHAL_DID_GSNS_X_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Y_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Z_FST)) {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[CALL:VehicleSndMsg:INPOSHAL_DID_GYRO_FST Partition]");
+
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ /* Size of data that can be transmitted in one division(Same size definition used) */
+ stmaster_fst_temp->us_size = LSDRV_FSTSNS_DSIZE_GYRO_X;
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size,
+ uc_result);
+
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&stmaster_fst_temp->uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size(Same size definition used) Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stmaster_fst_temp->us_size = static_cast<u_int16>(stmaster_fst->us_size - LSDRV_FSTSNS_DSIZE_GYRO_X);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ memcpy(&stmaster_fst_temp->uc_data[0],
+ &stmaster_fst->uc_data[LSDRV_FSTSNS_DSIZE_GYRO_X],
+ stmaster_fst_temp->us_size);
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size, uc_result);
+ } else if (ul_did == POSHAL_DID_REV_FST) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[CALL:VehicleSndMsg:INPOSHAL_DID_REV_FST Partition]");
+
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ stmaster_fst_temp->us_size = LSDRV_FSTSNS_DSIZE_REV; /* Size of data that can be transmitted in one division */
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size, uc_result);
+
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&stmaster_fst_temp->uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stmaster_fst_temp->us_size = static_cast<u_int16>(stmaster_fst->us_size - LSDRV_FSTSNS_DSIZE_REV);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ memcpy(&stmaster_fst_temp->uc_data[0],
+ &stmaster_fst->uc_data[LSDRV_FSTSNS_DSIZE_REV],
+ stmaster_fst_temp->us_size);
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size, uc_result);
+ } else {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[CALL:Vehicle_SndMsg:POSHAL_DID_SPEED_PULSE_FST Partition]");
+
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ /* Size of data that can be transmitted in one division(Same size definition used) */
+ stmaster_fst_temp->us_size = LSDRV_FSTSNS_DSIZE_GYRO_TEMP;
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size, uc_result);
+
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&stmaster_fst_temp->uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size(Same size definition used) Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stmaster_fst_temp->us_size = static_cast<u_int16>(stmaster_fst->us_size - LSDRV_FSTSNS_DSIZE_GYRO_TEMP);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ memcpy(&stmaster_fst_temp->uc_data[0],
+ &stmaster_fst->uc_data[LSDRV_FSTSNS_DSIZE_GYRO_TEMP],
+ stmaster_fst_temp->us_size);
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size, uc_result);
+ }
+ } else {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "[CALL:VehicleSndMsg]");
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst->us_size + 8),
+ (const void *)stmaster_fst);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst->uc_data[0])),
+ stmaster_fst->us_size, uc_result);
+ }
+
+ return uc_result;
+}
+
+u_int8 VehicleSensFirstDeliveryOther(PNO us_pno, DID ul_did, u_int8 uc_get_method,
+ u_int32* cid,
+ VEHICLESENS_DATA_MASTER* stmaster) {
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+ /* Determine CID */
+ if (ul_did == VEHICLE_DID_LOCATION_LONLAT_NAVI) {
+ *cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
+ } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE_NAVI) { // LCOV_EXCL_BR_LINE 6:VEHICLE_DID_LOCATION_ALTITUDE_NAVI no API to pass in // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE; // LCOV_EXCL_LINE 8: dead code
+ } else if ((ul_did == VEHICLE_DID_MOTION_SPEED_NAVI) ||
+ (ul_did == VEHICLE_DID_MOTION_SPEED_INTERNAL)) {
+ *cid = CID_VEHICLE_SENSORMOTION_SPEED;
+ } else if (ul_did == VEHICLE_DID_MOTION_HEADING_NAVI) {
+ *cid = CID_POSIF_REGISTER_LISTENER_HEADING;
+ } else if (ul_did == VEHICLE_DID_SETTINGTIME) {
+ *cid = CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ;
+ } else { // LCOV_EXCL_BR_LINE 6: cannot be this one
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *cid = 0xFFFF; /* DID error */ // LCOV_EXCL_LINE 8: dead code
+ }
+
+ /* Vehicle sensor information notification transmission */
+ if (*cid == 0xFFFF) { // LCOV_EXCL_BR_LINE 6: cannot be this one
+ /* Error log */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unknown DID [%d]", ul_did); // LCOV_EXCL_LINE 8: dead code // NOLINT(whitespace/line_length)
+ } else {
+ /* Acquire the applicable data information from the data master..*/
+ (void)memset(reinterpret_cast<void *>(stmaster), 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ VehicleSensGetDataMaster(ul_did, uc_get_method, stmaster);
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ static_cast<CID>(*cid),
+ (u_int16)stmaster->us_size,
+ (const void *)&(stmaster->uc_data[0]));
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED,
+ ul_did,
+ us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster->uc_data[0])),
+ stmaster->us_size,
+ uc_result);
+ }
+
+ return uc_result;
+}
+/*******************************************************************************
+* MODULE : VehicleSensFirstDelivery
+* ABSTRACT : Vehicle Sensor Initial Data Delivery Process
+* FUNCTION : Deliver the initial data to the destination.
+* ARGUMENT : us_pno :Addresses for delivery NO
+* ul_did :Data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensFirstDelivery(PNO us_pno, DID ul_did) {
+ u_int8 uc_get_method;
+ VEHICLESENS_DATA_MASTER stmaster;
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ VEHICLESENS_DATA_MASTER_FST stMasterFst; /* Master of initial sensor data */
+ VEHICLESENS_DATA_MASTER_FST stMasterFst_temp; /* For temporary storage */
+ u_int32 cid;
+ SENSORLOCATION_MSG_LONLATINFO *pLonLatMsg;
+ SENSORLOCATION_MSG_ALTITUDEINFO *pAltitudeMsg;
+ SENSORMOTION_MSG_HEADINGINFO *pHeadingMsg;
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+#endif
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+ [ul_did = 0x%x us_pno:0x%x]", ul_did, us_pno);
+
+ /* Obtain the data acquisition method.*/
+ uc_get_method = VehicleSensGetSelectionItemList(ul_did);
+
+ if (VEHICLESENS_GETMETHOD_GPS == uc_get_method) {
+ SENSOR_MSG_GPSDATA_DAT gps_master;
+ VEHICLESENS_DELIVERY_FORMAT delivery_data;
+ u_int16 length;
+ u_int16 senslog_len;
+
+ VehicleSensGetGpsDataMaster(ul_did, uc_get_method, &gps_master);
+
+ if (ul_did == POSHAL_DID_GPS_TIME) {
+ /* GPS time,Because there is no header in the message to be delivered,Padding deliveryData headers */
+ (void)memcpy(reinterpret_cast<void*>(&delivery_data),
+ reinterpret_cast<void*>(&gps_master.uc_data[0]), gps_master.us_size);
+ length = gps_master.us_size;
+ senslog_len = length;
+ cid = CID_VEHICLESENS_VEHICLE_INFO_GPS_TIME;
+ } else if (ul_did == VEHICLE_DID_LOCATION_LONLAT) {
+ pLonLatMsg = reinterpret_cast<SENSORLOCATION_MSG_LONLATINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(pLonLatMsg->data)),
+ reinterpret_cast<void*>(&(stmaster.uc_data[0])), stmaster.us_size);
+ length = (u_int16)stmaster.us_size;
+ senslog_len = length;
+ cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
+ } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE) {
+ pAltitudeMsg = reinterpret_cast<SENSORLOCATION_MSG_ALTITUDEINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(pAltitudeMsg->data)),
+ reinterpret_cast<void*>(&stmaster.uc_data[0]), stmaster.us_size);
+ length = (u_int16)stmaster.us_size;
+ senslog_len = length;
+ cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE;
+ } else if (ul_did == VEHICLE_DID_MOTION_HEADING) {
+ pHeadingMsg = reinterpret_cast<SENSORMOTION_MSG_HEADINGINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(pHeadingMsg->data)),
+ reinterpret_cast<void*>(&stmaster.uc_data[0]), stmaster.us_size);
+ length = (u_int16)stmaster.us_size;
+ senslog_len = length;
+ cid = CID_POSIF_REGISTER_LISTENER_HEADING;
+ } else {
+
+ delivery_data.header.did = gps_master.ul_did;
+ delivery_data.header.size = gps_master.us_size;
+ delivery_data.header.rcv_flag = gps_master.uc_rcv_flag;
+ delivery_data.header.sensor_cnt = gps_master.uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(&delivery_data.data[0]),
+ reinterpret_cast<void *>(&gps_master.uc_data[0]),
+ (size_t)delivery_data.header.size);
+
+ length = static_cast<u_int16>((u_int16)sizeof(delivery_data.header) + delivery_data.header.size);
+ senslog_len = delivery_data.header.size;
+ cid = CID_VEHICLESENS_VEHICLE_INFO;
+ }
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ static_cast<CID>(cid),
+ length,
+ (const void *)&delivery_data);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ if (cid != CID_VEHICLESENS_VEHICLE_INFO) {
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&delivery_data), senslog_len, uc_result);
+ } else {
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(delivery_data.data[0])), senslog_len, uc_result);
+ }
+ }
+ else if ((VEHICLESENS_GETMETHOD_NAVI == uc_get_method) || // NOLINT(readability/braces)
+ (VEHICLESENS_GETMETHOD_OTHER == uc_get_method) ||
+ (VEHICLESENS_GETMETHOD_INTERNAL == uc_get_method)) {
+ uc_result = VehicleSensFirstDeliveryOther(us_pno, ul_did, uc_get_method, &cid, &stmaster);
+ }
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ else if ((ul_did == POSHAL_DID_GYRO_X_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_GYRO_Y_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_GYRO_Z_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_REV_FST) ||
+ (ul_did == POSHAL_DID_GYRO_TEMP_FST) ||
+ (ul_did == POSHAL_DID_GSNS_X_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Y_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Z_FST) ||
+ (ul_did == POSHAL_DID_SPEED_PULSE_FST)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Acquire the applicable data information from the data master for the initial sensor..*/
+ uc_result = VehicleSensFirstDeliverySens(us_pno, ul_did, uc_get_method, &stMasterFst, &stMasterFst_temp);
+ }
+#endif
+ else if (ul_did == VEHICLE_DID_GYRO_TROUBLE) { // LCOV_EXCL_BR_LINE 8 : DID in not used
+ // LCOV_EXCL_START 8: DID is not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLESENS_DATA_MASTER_GYRO_TROUBLE st_master_gyro_trouble;
+ SENSORMOTION_MSG_GYROTROUBLEINFO_DAT st_msg_gyro_trouble_info;
+
+ /* Initialization */
+ st_master_gyro_trouble.uc_reserve = 0;
+ st_msg_gyro_trouble_info.reserve = 0;
+
+ VehicleSensGetDataMasterGyroTrouble(ul_did, uc_get_method, &st_master_gyro_trouble);
+
+ /* Size storage(GYROTROUBLE) */
+ st_msg_gyro_trouble_info.size = st_master_gyro_trouble.us_size;
+
+ /* Set the GyroTrouble */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_gyro_trouble_info.gyro_trouble)),
+ reinterpret_cast<void *>(&(st_master_gyro_trouble.uc_data)),
+ sizeof(st_msg_gyro_trouble_info.gyro_trouble));
+
+#if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] ul_did = VEHICLE_DID_GYRO_TROUBLE");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[DIAG] st_msg_gyro_trouble_info.size = %d",
+ st_msg_gyro_trouble_info.size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[DIAG] st_msg_gyro_trouble_info.gyro_trouble = 0x%08X \r\n",
+ st_msg_gyro_trouble_info.gyro_trouble);
+#endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
+ /* Since the undefined state is not a device specification,Do not deliver to the app for the first time */
+ if (st_msg_gyro_trouble_info.gyro_trouble != GYRO_UNFIXED) {
+
+ /* Send GyroTrouble to API-caller */
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORMOTION_GYROTROUBLE,
+ sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
+ (const void *)&st_msg_gyro_trouble_info);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&st_msg_gyro_trouble_info),
+ sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
+ uc_result);
+#if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] GyroTrouble FirstDelivery");
+#endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
+ }
+ // LCOV_EXCL_STOP
+ }
+ else { // NOLINT(readability/braces)
+ (void)memset(reinterpret_cast<void *>(&stmaster), 0x00, sizeof(stmaster));
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ (u_int16)sizeof(VEHICLESENS_DATA_MASTER),
+ (const void *)&stmaster);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster.uc_data[0])),
+ stmaster.us_size, uc_result);
+ }
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensFirstPkgDelivery
+* ABSTRACT : Vehicle Sensor Initial Package Data Delivery Process
+* FUNCTION : Deliver the initial package data to the destination.
+* ARGUMENT : *pst_data :Data portion pointer of the message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensFirstPkgDelivery(const SENSOR_MSG_DELIVERY_ENTRY_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_get_method; /* Data collection way */
+ int32 i; /* Generic counters */
+ SENSOR_PKG_MSG_VSINFO st_pkg_master; /* Data master for package delivery */
+ DID ul_pkg_did; /* DID for package data acquisition */
+ u_int16 us_offset = 0; /* For offset calculation */
+ u_int16 us_next_offset; /* Next offset value */
+ u_int16 us_boundary_adj; /* For boundary adjustment */
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = 0; /* Send/Receive result */
+
+ (void)memset(reinterpret_cast<void *>(&st_pkg_master), 0, sizeof(SENSOR_PKG_MSG_VSINFO));
+ /* For boundary adjustment */
+ us_boundary_adj = (u_int16)VEHICLESENS_BIT1 | (u_int16)VEHICLESENS_BIT0;
+ for (i = 0; i < pst_data->pkg_num; i++) {
+ ul_pkg_did = pst_data->did[i]; /* Get DID */
+ st_pkg_master.usOffset[i] = us_offset; /* Offset setting */
+ /* Data collection way */
+ uc_get_method = VehicleSensGetSelectionItemList(ul_pkg_did);
+ if (VEHICLESENS_GETMETHOD_GPS == uc_get_method) {
+ VehicleSensGetGpsDataMaster(ul_pkg_did,
+ uc_get_method,
+ reinterpret_cast<SENSOR_MSG_GPSDATA_DAT *>(&st_pkg_master.ucData[us_offset]));
+ } else {
+ VehicleSensGetDataMaster(ul_pkg_did,
+ uc_get_method,
+ reinterpret_cast<VEHICLESENS_DATA_MASTER *>(&st_pkg_master.ucData[us_offset]));
+ }
+ /* Next offset calculation */
+ /* Boundary adjustment of data size */
+ us_next_offset = VehicleSensGetDataMasterOffset(ul_pkg_did);
+ if ((us_next_offset & us_boundary_adj) != 0) {
+ /* If you need to adjust */
+ us_next_offset = static_cast<u_int16>(us_next_offset & ~us_boundary_adj); /* Mask Lower Bit */
+ us_next_offset = static_cast<u_int16>(us_next_offset + (u_int16)VEHICLESENS_BIT2); /* Add numbers */
+ }
+ us_offset = static_cast<u_int16>(us_offset + us_next_offset);
+ }
+
+ st_pkg_master.ucDNum = pst_data->pkg_num; /* To save the number of data */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR,
+ pst_data->pno,
+ CID_SENSOR_PKG_INFO,
+ (u_int16)sizeof(SENSOR_PKG_MSG_VSINFO),
+ (const void *)&st_pkg_master);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS_PKG, 0, pst_data->pno,
+ reinterpret_cast<uint8_t *>(&st_pkg_master),
+ sizeof(SENSOR_PKG_MSG_VSINFO),
+ uc_result);
+}
+// LCOV_EXCL_STOP
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensFirstPkgDeliveryExt
+* ABSTRACT : Vehicle Sensor Initial Expansion Package Data Delivery Process
+* FUNCTION : Deliver the initial expansion package data to the destination.
+* ARGUMENT : *pst_data :Data portion pointer of the message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensFirstPkgDeliveryExt(const SENSOR_MSG_DELIVERY_ENTRY_DAT *pst_data) {
+ u_int8 ucGetMethod; /* Data collection way */
+ int32 i; /* Generic counters */
+ static SENSOR_PKG_MSG_VSINFO stPkgMaster; /* Data master for package delivery */
+ DID ulPkgDid; /* DID for package data acquisition */
+ u_int16 usOffset = 0; /* For offset calculation */
+ u_int16 usNextOffset; /* Next offset value */
+ u_int16 usBoundaryAdj; /* For boundary adjustment */
+ static VEHICLESENS_DATA_MASTER_EXT stExtDataTemp[11];/* Extended data master temporary storage area */
+ u_int16 usDataCnt[11] = {0}; /* For storing the number of data items */
+ u_int8 ucDivideCnt; /* Total number of partitions */
+ u_int8 ucDivide100Cnt = 0; /* Total number of 100 partitions */
+ u_int8 ucDivideSendCnt; /* Number of divided transmissions */
+ u_int16 usDivideSendSize[11] = {0}; /* Split Send Size */
+ u_int16 ucDivideSendPoint; /* Split transmission data acquisition position */
+ u_int8 ucDataBreak; /* Storage area of all data undelivered flag */
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = 0; /* Send/Receive result */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* For boundary adjustment */
+ usBoundaryAdj = (u_int16)VEHICLESENS_BIT1 | (u_int16)VEHICLESENS_BIT0;
+ /* #Polaris_004 START */ /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+ (void)memset(reinterpret_cast<void *>(&stExtDataTemp), 0, sizeof(stExtDataTemp));
+ for (i = 0; i < pst_data->pkg_num; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ulPkgDid = pst_data->did[i]; /* Get DID */
+ ucGetMethod = VehicleSensGetSelectionItemList(ulPkgDid); /* Data collection way */
+ if (VEHICLESENS_GETMETHOD_GPS < ucGetMethod) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "VEHICLESENS_DELIVERYCTRL: VehicleSensGetSelectionItemList error :%d\r\n", ucGetMethod);
+ }
+
+ if ((ulPkgDid == POSHAL_DID_GYRO_EXT) ||
+ (ulPkgDid == POSHAL_DID_GYRO_X) ||
+ (ulPkgDid == POSHAL_DID_GYRO_Y) ||
+ (ulPkgDid == POSHAL_DID_GYRO_Z) ||
+ (ulPkgDid == POSHAL_DID_GSNS_X) ||
+ (ulPkgDid == POSHAL_DID_GSNS_Y) ||
+ (ulPkgDid == POSHAL_DID_GSNS_Z) ||
+ (ulPkgDid == POSHAL_DID_SPEED_PULSE) ||
+ (ulPkgDid == POSHAL_DID_REV) ||
+ (ulPkgDid == POSHAL_DID_GYRO_TEMP) ||
+ (ulPkgDid == POSHAL_DID_PULSE_TIME) ||
+ (ulPkgDid == POSHAL_DID_SNS_COUNTER)) {
+ /* Store in the extended data master information buffer */
+ VehicleSensGetDataMasterExt(ulPkgDid, ucGetMethod, &stExtDataTemp[i]);
+ /* Obtain the number of data items */
+ if ((ulPkgDid == POSHAL_DID_SNS_COUNTER) ||
+ (ulPkgDid == POSHAL_DID_REV)) {
+ usDataCnt[i] = stExtDataTemp[i].us_size; /* 1data 1byte */
+ /* Store the transmission size for 10 items */
+ usDivideSendSize[i] = 10;
+ } else if (ulPkgDid == POSHAL_DID_GYRO_TEMP) {
+ usDataCnt[i] = stExtDataTemp[i].us_size / 2; /* 1data 2byte */
+ /* Store the transmission size for 10 items */
+ usDivideSendSize[i] = 20;
+ }
+ else if (ulPkgDid == POSHAL_DID_PULSE_TIME) { // NOLINT(readability/braces)
+ usDataCnt[i] = stExtDataTemp[i].us_size / 132; /* 1data 132byte */
+ /* Store the transmission size for 10 items */
+ usDivideSendSize[i] = 1320;
+ }
+ else { // NOLINT(readability/braces)
+ usDataCnt[i] = stExtDataTemp[i].us_size / 2; /* 1data 2byte Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Store the transmission size for 100 items */
+ usDivideSendSize[i] = 200;
+
+ // divide cnt is 100
+ if (((usDataCnt[i] % VEHICLESENS_PKG_EXT_SEND_MAX_10DATA) > 0) || (usDataCnt[i] == 0)) {
+ ucDivide100Cnt = static_cast<u_int8>((usDataCnt[i] / VEHICLESENS_PKG_EXT_SEND_MAX_10DATA) + 1);
+ } else {
+ ucDivide100Cnt = static_cast<u_int8>(usDataCnt[i] / VEHICLESENS_PKG_EXT_SEND_MAX_10DATA);
+ }
+ }
+ }
+ }
+ /* All-data undelivered flag holding Ignore->MISRA-C ++: 2008 Rule 5-0-5 */
+ ucDataBreak = static_cast<u_int8>(gstPkgTempExt.data_break);
+
+ /* From the number of data items in the acquired buffer,Calculate the number of transmissions */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (((usDataCnt[0] % VEHICLESENS_PKG_EXT_SEND_MAX) > 0) || (usDataCnt[0] == 0)) {
+ /* If there is a remainder,,Division result + 1 */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideCnt = static_cast<u_int8>((usDataCnt[0] / VEHICLESENS_PKG_EXT_SEND_MAX) + 1);
+ } else {
+ /* If there is no remainder,,The result of division is the total number of transmissions. */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideCnt = static_cast<u_int8>(usDataCnt[0] / VEHICLESENS_PKG_EXT_SEND_MAX);
+ }
+
+ // if ucDivide100cnt is valid (greater than 0)
+ ucDivideCnt = (ucDivide100Cnt > 0) ? ucDivide100Cnt : ucDivideCnt;
+
+ ucDivideSendCnt = 0; /* Number of divided transmissions */
+ while (ucDivideSendCnt < ucDivideCnt) {
+ /* Clear send message buffer */
+ (void)memset(reinterpret_cast<void *>(&stPkgMaster), 0, sizeof(SENSOR_PKG_MSG_VSINFO));
+ usOffset = 0;
+ for (i = 0; i < pst_data->pkg_num; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ulPkgDid = pst_data->did[i]; /* Get DID */
+ stPkgMaster.usOffset[i] = usOffset; /* Offset setting */
+ /* copy Data ID of extended data master structure,Size of the data,Receive flag,Reserved */
+ memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset]),
+ reinterpret_cast<void *>(&stExtDataTemp[i]), 11);
+ if ((ulPkgDid == POSHAL_DID_SNS_COUNTER) ||
+ (ulPkgDid == POSHAL_DID_REV) ||
+ (ulPkgDid == POSHAL_DID_PULSE_TIME) ||
+ (ulPkgDid == POSHAL_DID_GYRO_TEMP)) {
+ if (usDataCnt[i] > VEHICLESENS_PKG_EXT_SEND_MAX) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Calculate the data acquisition position */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
+ /* Update the data size*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 4] = (u_int8)usDivideSendSize[i];
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 5] = (u_int8)(usDivideSendSize[i] >> 8);
+ /* Create 10 divided transmission data of sensor counters of extended data master structure */
+ memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
+ reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
+ usDivideSendSize[i]); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Subtract the number of created transmission data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ usDataCnt[i] = static_cast<u_int16>(usDataCnt[i] - VEHICLESENS_PKG_EXT_SEND_MAX);
+ } else {
+ /* Calculate the data acquisition position */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
+ /* Update the data size*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 4] = (u_int8)(stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
+ stPkgMaster.ucData[usOffset + 5] = \
+ (u_int8)((stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint) >> 8);
+ /* Create the remaining divided send data of sensor counter of extended data master structure */
+ memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
+ reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
+ stExtDataTemp[i].us_size - ucDivideSendPoint); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Since all buffers have been created, the number of data is set to 0. */
+ usDataCnt[i] = 0;
+ }
+ } else {
+ if (usDataCnt[i] > VEHICLESENS_PKG_EXT_SEND_MAX_10DATA) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Calculate the data acquisition position */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
+ /* Update the data size*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 4] = (u_int8)usDivideSendSize[i];
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 5] = (u_int8)(usDivideSendSize[i] >> 8);
+ /* Create 100 divided transmission data of vehicle sensor data of extended data master structure */
+ memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
+ reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
+ usDivideSendSize[i]); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Subtract the number of created transmission data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ usDataCnt[i] = static_cast<u_int16>(usDataCnt[i] - VEHICLESENS_PKG_EXT_SEND_MAX_10DATA);
+ } else {
+ /* Calculate the data acquisition position */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
+ /* Update the data size*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 4] = \
+ (u_int8)(stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
+ stPkgMaster.ucData[usOffset + 5] = \
+ (u_int8)((stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint) >> 8);
+ /* Create the remaining divided transmission data of the vehicle sensor data of the extended data master structure. */
+ memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
+ reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
+ stExtDataTemp[i].us_size - ucDivideSendPoint); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Since all buffers have been created, the number of data is set to 0. */
+ usDataCnt[i] = 0;
+ }
+ }
+ /* Next offset calculation */
+ /* Boundary adjustment of data size */
+ usNextOffset = VehicleSensGetDataMasterExtOffset(ulPkgDid);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
+ if ((usNextOffset & usBoundaryAdj) != 0) {
+ /* If you need to adjust */
+ /* Mask Lower Bit Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
+ usNextOffset = static_cast<u_int16>(usNextOffset & ~usBoundaryAdj);
+ usNextOffset = static_cast<u_int16>(usNextOffset + (u_int16)VEHICLESENS_BIT2); /* Add numbers */
+ }
+ usOffset = static_cast<u_int16>(usOffset + usNextOffset); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+ stPkgMaster.ucDNum = pst_data->pkg_num; /* To save the number of data */
+ stPkgMaster.ucDataBreak = ucDataBreak; /* Set all data undelivered flag */
+ stPkgMaster.ucDivideCnt = ucDivideCnt; /* Set total number of partitions */
+ /* Division number setting Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucDivideSendCnt = static_cast<uint8_t>(ucDivideSendCnt + 1);
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR,
+ pst_data->pno,
+ CID_SENSOR_PKG_INFO,
+ (u_int16)sizeof(SENSOR_PKG_MSG_VSINFO),
+ (const void *)&stPkgMaster);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS_PKG, 0, pst_data->pno,
+ reinterpret_cast<uint8_t *>(&stPkgMaster),
+ sizeof(SENSOR_PKG_MSG_VSINFO), uc_result);
+
+ ucDivideSendCnt++;
+
+ /* Package delivery (split) confirmation debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
+ "### SENS RECV # FST PKG DELIVERY : cnt[%d/7]", ucDivideSendCnt);
+ if (7 <= ucDivideSendCnt) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
+ "### SENS RECV # FST PKG DELIVERY : last sns_cnt[%d][%d][%d][%d]",
+ stPkgMaster.ucData[8], stPkgMaster.ucData[9], stPkgMaster.ucData[10], stPkgMaster.ucData[11]);
+ }
+ }
+ /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+#endif
+
+/* ++ PastModel002 response DR */
+
+/*******************************************************************************
+ * MODULE : VehicleSensEntryDeliveryCtrlDR
+ * ABSTRACT : Internal delivery destination management registration function for vehicle sensor DR
+ * FUNCTION : Internal distribution destination management table for DR,Update the shipping management table management.
+ * ARGUMENT : pst_delivery_entry : Pointer to the delivery registration information
+ * NOTE :
+ * RETURN : VEHICLE_RET_NORMAL :Successful registration
+ ******************************************************************************/
+VEHICLE_RET_API VehicleSensEntryDeliveryCtrlDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *pst_delivery_entry) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i;
+ u_int8 uc_action_type = VEHICLESENS_ACTION_TYPE_ADD;
+ int32 uc_did_flag;
+ DID ulentry_did = pst_delivery_entry->data.did;
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data = NULL;
+ VEHICLE_RET_API ret = VEHICLE_RET_NORMAL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+
+ /* Check if the data ID exists. */
+ uc_did_flag = VehicleSensCheckDid(ulentry_did);
+ if (uc_did_flag == 0) {
+ ret = VEHICLE_RET_ERROR_DID; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Check the number of registered shipments. */
+ if ((ret == VEHICLE_RET_NORMAL) &&/* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (g_stdelivery_ctrl_tbl_dr.us_dnum >= VEHICLESENS_DELIVERY_INFO_MAX)) {
+ /* Return the FULL of delivery registrations*/
+ ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* By searching for the delivery registration of the relevant DID,Hold the address. */
+ for (i = 0; i < g_stdelivery_ctrl_tbl_mng_dr.us_dnum; i++) {
+ if (g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].ul_did == ulentry_did) {
+ uc_action_type = VEHICLESENS_ACTION_TYPE_UPDATE;
+ pst_existing_mng_data = &g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i];
+ }
+ }
+
+ /* Add to the shipping management table.*/
+ VehicleSensAddDeliveryCtrlTblDR(pst_delivery_entry);
+ /* Processing when updating existing data*/
+ if (uc_action_type == VEHICLESENS_ACTION_TYPE_UPDATE) {
+ /* Update the shipping management table.*/
+ VehicleSensUpdateDeliveryCtrlTblDR(pst_existing_mng_data);
+
+ /* Update the shipping destination management table management information.*/
+ VehicleSensUpdateDeliveryCtrlTblMngDR(pst_existing_mng_data);
+ } else { /* Newly added processing*/
+ /* Add to the shipping management table management information.*/
+ VehicleSensAddDeliveryCtrlTblMngDR(pst_delivery_entry);
+ }
+ }
+ return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensMakeDeliveryPnoTblDR
+* ABSTRACT : Vehicle sensor internal delivery destination PNO table creation function for DR
+* FUNCTION : Create an internal delivery destination PNO table for DR
+* ARGUMENT : ul_did Data ID
+* Change_type Delivery Trigger
+* NOTE :
+* RETURN : VEHICLESENS_DELIVERY_PNO_TBL* Pointer to the shipping PNO table
+******************************************************************************/
+VEHICLESENS_DELIVERY_PNO_TBL* VehicleSensMakeDeliveryPnoTblDR(DID ul_did, u_int8 change_type) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i;
+ u_int8 uc_ctrl_tbl_mng_data_list;
+ u_int16 us_index = 0;
+ u_int16 us_dnum = 0;
+
+ /* Get the start index and count of the corresponding data ID. */
+ uc_ctrl_tbl_mng_data_list = static_cast<u_int8>(
+ (sizeof(g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data)) /
+ (sizeof(g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[0])));
+
+ for (i = 0; i < uc_ctrl_tbl_mng_data_list; i++) {
+ /* Stores the information of the corresponding DID.. */
+ if (g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].ul_did == ul_did) {
+ us_index = g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].us_start_idx;
+ us_dnum = g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].usdlvry_entry_num;
+ break;
+ }
+ }
+
+ /* Create a PNO list */
+ (void)memset(reinterpret_cast<void *>(&g_stdelivery_pno_tbl_dr),
+ static_cast<int32>(0),
+ (size_t)sizeof(g_stdelivery_pno_tbl_dr));
+ if (change_type == VEHICLESENS_CHGTYPE_CHG) {
+ /* Processing when delivery timing is changed*/
+ for (i = 0; i < us_dnum; i++) {
+ /* Functionalization by Increasing Structure Members */
+ VehicleSensAddPnoTblDR(us_index);
+ us_index = g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_link_idx;
+ }
+ } else {
+ /* Processing when delivery timing is update */
+ for (i = 0; i < us_dnum; i++) {
+ if (VEHICLE_DELIVERY_TIMING_UPDATE == g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].uc_chg_type) {
+ /* Functionalization by Increasing Structure Members */
+ VehicleSensAddPnoTblDR(us_index);
+ }
+ us_index = g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_link_idx;
+ }
+ }
+
+ return(&g_stdelivery_pno_tbl_dr);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensAddPnoTblDR
+* ABSTRACT : Vehicle sensor DR internal delivery destination PNO table addition function
+* FUNCTION : Add to the internal DR shipping destination PNO table.
+* ARGUMENT : us_index : Index of the referenced destination management table
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddPnoTblDR(u_int16 us_index) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int16 us_pno_tbl_idx;
+
+ us_pno_tbl_idx = g_stdelivery_pno_tbl_dr.us_dnum;
+ g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].us_pno = \
+ g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_pno;
+ g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].us_pkg_start_idx = \
+ g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_pkg_start_idx;
+ g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].us_pkg_end_idx = \
+ g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_pkg_end_idx;
+ g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].uc_method = \
+ g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].uc_method;
+ g_stdelivery_pno_tbl_dr.us_dnum++;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensAddDeliveryCtrlTblDR
+* ABSTRACT : Vehicle sensor DR internal delivery destination management table addition function
+* FUNCTION : Add to the DR internal shipping management table.
+* ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddDeliveryCtrlTblDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *pst_delivery_entry) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLESENS_DELIVERY_CTRL_TBL_DATA *pst_ctrl_data;
+
+ pst_ctrl_data = &g_stdelivery_ctrl_tbl_dr.st_ctrl_data[g_stdelivery_ctrl_tbl_dr.us_dnum];
+ pst_ctrl_data->ul_did = pst_delivery_entry->data.did;
+ pst_ctrl_data->us_pno = pst_delivery_entry->data.pno;
+ pst_ctrl_data->uc_chg_type = pst_delivery_entry->data.delivery_timing;
+ pst_ctrl_data->uc_ctrl_flg = pst_delivery_entry->data.ctrl_flg;
+ pst_ctrl_data->us_link_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->us_pkg_start_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->us_pkg_end_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->uc_method = VEHICLESENS_DELIVERY_METHOD_NORMAL;
+ g_stdelivery_ctrl_tbl_dr.us_dnum = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum + 1);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensAddDeliveryCtrlTblMngDR
+* ABSTRACT : Internal delivery destination management table management addition function for vehicle sensor DR
+* FUNCTION : Add to the DR internal shipping management table management.
+* ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddDeliveryCtrlTblMngDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *pst_delivery_entry) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_ctrl_mng_data;
+
+ pst_ctrl_mng_data = &g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[g_stdelivery_ctrl_tbl_mng_dr.us_dnum];
+ pst_ctrl_mng_data->ul_did = pst_delivery_entry->data.did;
+ pst_ctrl_mng_data->us_start_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
+ pst_ctrl_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
+ pst_ctrl_mng_data->usdlvry_entry_num++;
+ g_stdelivery_ctrl_tbl_mng_dr.us_dnum++;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : VehicleSensUpdateDeliveryCtrlTblMngDR
+ * ABSTRACT : Internal delivery destination management table management update function for vehicle sensor DR
+ * FUNCTION : Update the internal delivery destination management table management for DR.
+ * ARGUMENT : *pst_existing_mng_data : Pointer to the previous data information with the same data ID
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensUpdateDeliveryCtrlTblMngDR(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Update only the end index and the number of registered shipping destinations. */
+ pst_existing_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
+ pst_existing_mng_data->usdlvry_entry_num++;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensUpdateDeliveryCtrlTblDR
+* ABSTRACT : Vehicle sensor DR internal delivery destination management table update function
+* FUNCTION : Update the internal distribution destination management table for DR.
+* ARGUMENT : *pst_existing_mng_data : Pointer to the previous data information with the same data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensUpdateDeliveryCtrlTblDR(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Update Link Index Only.
+ For indexes of usEndIdx values matching the data IDs in the target management table
+ Making usLinkIdx an Index-Registered Index */
+ g_stdelivery_ctrl_tbl_dr.st_ctrl_data[pst_existing_mng_data->us_end_idx].us_link_idx =
+ static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : VehicleSensDeliveryProcDR
+ * ABSTRACT : Internal Data Delivery Process for Vehicle Sensor DR
+ * FUNCTION : Deliver data to internal DR destinations.
+ * ARGUMENT : ul_did :Data ID
+ * uc_chg_type :Delivery timing
+ * uc_get_method :Acquisition method
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensDeliveryProcDR(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method) {
+ return;
+}
+
+/**
+ * @brief
+ * Obtain dump info(g_stdelivery_ctrl_tbl)
+ *
+ * @param[out] pbuf Dump information
+ */
+void VehicleSensGetDebugDeliveryCtrlTbl(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[256];
+ u_int16 i;
+
+ memset(&buf, 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&(buf)),
+ 32,
+ "Delivery-Tbl\n DNum:%d", g_stdelivery_ctrl_tbl.us_dnum);
+ for (i = 0; i < g_stdelivery_ctrl_tbl.us_dnum; i++) {
+ if (i >= 30) {
+ break;
+ }
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] did:0x%08x, pno:0x%04x, chgT:0x%02x, ctrlFg:0x%02x, "\
+ "lnkidx:0x%04x, pkgSidx:0x%04x, pkgEidx:0x%04x, Mth:0x%02x",
+ i,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].ul_did,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pno,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_chg_type,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_ctrl_flg,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_link_idx,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pkg_start_idx,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pkg_end_idx,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_method);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ }
+ memcpy(pbuf, &buf[0], sizeof(buf));
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Obtain dump info(g_stdelivery_ctrl_tbl_mng)
+ *
+ * @param[out] pbuf Dump information
+ */
+void VehicleSensGetDebugDeliveryCtrlTblMng(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[256];
+ u_int16 i;
+
+ memset(&buf, 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&(buf)),
+ 32,
+ "Delivery-TblMng\n DNum:%d",
+ g_stdelivery_ctrl_tbl_mng.us_dnum);
+ for (i = 0; i < g_stdelivery_ctrl_tbl_mng.us_dnum; i++) {
+ if (i >= 60) {
+ break;
+ }
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] did:0x%08x, Sidx:0x%04x, Eidx:0x%04x, EntNum:0x%04x",
+ i,
+ g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did,
+ g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].us_start_idx,
+ g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].us_end_idx,
+ g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].usdlvry_entry_num);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ }
+ memcpy(pbuf, &buf[0], sizeof(buf));
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Obtain dump info(g_stpkgdelivery_tbl_mng)
+ *
+ * @param[out] pbuf Dump information
+ */
+void VehicleSensGetDebugPkgDeliveryTblMng(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[256];
+ u_int16 i;
+
+ memset(&buf, 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&(buf)),
+ 32,
+ "Delivery-PkgTblMng\n DNum:%d",
+ g_stpkgdelivery_tbl_mng.us_dnum);
+ for (i = 0; i < g_stpkgdelivery_tbl_mng.us_dnum; i++) {
+ if (i >= 100) {
+ break;
+ }
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] did:0x%08x, Didx:0x%04x",
+ i,
+ g_stpkgdelivery_tbl_mng.st_pkg_data[i].ul_did,
+ g_stpkgdelivery_tbl_mng.st_pkg_data[i].usdlvry_idx);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ }
+ memcpy(pbuf, &buf[0], sizeof(buf));
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Obtain dump info(g_stdelivery_pno_tbl)
+ *
+ * @param[out] pbuf Dump information
+ */
+void VehicleSensGetDebugDeliveryPnoTbl(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[256];
+ u_int16 i;
+
+ memset(&buf, 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&(buf)),
+ 32,
+ "Delivery-PnoTbl\n DNum:%d",
+ g_stdelivery_pno_tbl.us_dnum);
+ for (i = 0; i < g_stdelivery_pno_tbl.us_dnum; i++) {
+ if (i >= 60) {
+ break;
+ }
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] pno:0x%04x, pkgSidx:0x%04x, pkgEidx:0x%04x, Mth:0x%02x",
+ i,
+ g_stdelivery_pno_tbl.st_pno_data[i].us_pno,
+ g_stdelivery_pno_tbl.st_pno_data[i].us_pkg_start_idx,
+ g_stdelivery_pno_tbl.st_pno_data[i].us_pkg_end_idx,
+ g_stdelivery_pno_tbl.st_pno_data[i].uc_method);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ }
+ memcpy(pbuf, &buf[0], sizeof(buf));
+ return;
+}
+// LCOV_EXCL_STOP
+/* -- PastModel002 support DR */
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GPSInterruptFlag.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GPSInterruptFlag.cpp
new file mode 100755
index 0000000..eefbc51
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GPSInterruptFlag.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_GPSInterruptFlag.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_INTERRUPT_FLAG)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGpsInterruptFlag; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief VehicleSensInitGpsInterruptFlag<BR>
+ Vehicle sensor SPEED_PULSE initialization function
+@outline SPEED_PULSE_FLAG initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitGpsInterruptFlag(void) {
+ memset(&gstGpsInterruptFlag, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGpsInterruptFlag.ul_did = POSHAL_DID_GPS_INTERRUPT_FLAG;
+ gstGpsInterruptFlag.us_size = VEHICLE_DSIZE_GPS_INTERRUPT_FLAG;
+
+ gstGpsInterruptFlag.uc_data[0] = VEHICLE_DINIT_GPS_INTERRUPT_FLAG;
+}
+
+/***************************************************************************
+@brief NAV-CLOCK SET vehicle sensor function
+@outline To update the master data NAV-CLOCK.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetGpsInterruptFlag(const LSDRV_LSDATA_G *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsInterruptFlag;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-CLOCK GET
+@outline Master Data provides the NAV-CLOCK
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetGpsInterruptFlag(VEHICLESENS_DATA_MASTER *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_masterdata;
+
+ pst_masterdata = &gstGpsInterruptFlag;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_masterdata->ul_did;
+ pst_data->us_size = pst_masterdata->us_size;
+ pst_data->uc_rcvflag = pst_masterdata->uc_rcvflag;
+ pst_data->uc_snscnt = pst_masterdata->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_masterdata->uc_data), (size_t)(pst_masterdata->us_size));
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna.cpp
new file mode 100755
index 0000000..bbf4965
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna.cpp
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GpsAntenna.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS_ANTENNA)
+ * Module configuration :VehicleSensGetGpsAntenna() Vehicle Sensor GPS_ANTENNA GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGpsAntenna
+* ABSTRACT : Vehicle sensor GPS_ANTENNA GET function
+* FUNCTION : Provide the GPS_ANTENNA data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGpsAntenna(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGpsAntennal(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntennaStatus.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntennaStatus.cpp
new file mode 100755
index 0000000..dc950cc
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntennaStatus.cpp
@@ -0,0 +1,112 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GpsAntennaStatus.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS_ANTENNA)
+ * Module configuration :VehicleSensInitGpsAntennaStatus() Vehicle sensor GPS_ANTENNA_STATUS initialization function
+ * :VehicleSensSetGpsAntennaStatus() Vehicle sensor GPS_ANTENNA_STATUS SET function
+ * :VehicleSensGetGpsAntennaStatus() Vehicle sensor GPS_ANTENNA_STATUS GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS gstGpsAntennaStatus; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGpsAntennaStatus
+* ABSTRACT : Vehicle sensor GPS_ANTENNA_STATUS initialization function
+* FUNCTION : GPS_ANTENNA_STATUS data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGpsAntennaStatus(void) {
+ (void)memset(reinterpret_cast<void *>(&gstGpsAntennaStatus), 0, sizeof(gstGpsAntennaStatus));
+ gstGpsAntennaStatus.ul_did = POSHAL_DID_GPS_ANTENNA;
+ gstGpsAntennaStatus.us_size = VEHICLE_DSIZE_GPS_ANTENNA;
+ gstGpsAntennaStatus.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ gstGpsAntennaStatus.uc_sensor_cnt = 0U;
+ gstGpsAntennaStatus.uc_data = VEHICLE_DINIT_GPS_ANTENNA;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGpsAntennaStatus
+* ABSTRACT : Vehicle sensor GPS_ANTENNA_STATUS SET function
+* FUNCTION : Update the GPS_ANTENNA_STATUS data master
+* ARGUMENT : *pst_data : Pointer to received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* : VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGpsAntennaStatus(const LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS *pst_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGpsAntennaStatus;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), (size_t)(pst_data->uc_size));
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int16)pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
+ }
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGpsAntennaStatus
+* ABSTRACT : Vehicle sensor GPS_ANTENNA_STATUS GET function
+* FUNCTION : Provide the GPS_ANTENNA_STATUS data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGpsAntennaStatus(VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_master;
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGpsAntennaStatus;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_sensor_cnt = pst_master->uc_sensor_cnt;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
+ (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna_l.cpp
new file mode 100755
index 0000000..00db159
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna_l.cpp
@@ -0,0 +1,97 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GpsAntenna_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS_ANTENNA)
+ * Module configuration :VehicleSensInitGpsAntennal() Vehicle sensor GPS_ANTENNA initialization function
+ * :VehicleSensSetGpsAntennal() Vehicle Sensor GPS_ANTENNA SET Function
+ * :VehicleSensGetGpsAntennal() Vehicle Sensor GPS_ANTENNA GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGpsAntenna_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGpsAntennal
+* ABSTRACT : Vehicle sensor GPS_ANTENNA initialization function
+* FUNCTION : GPS_ANTENNA data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGpsAntennal(void) {
+ memset(&gstGpsAntenna_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGpsAntenna_l.ul_did = POSHAL_DID_GPS_ANTENNA;
+ gstGpsAntenna_l.us_size = VEHICLE_DSIZE_GPS_ANTENNA;
+ gstGpsAntenna_l.uc_data[0] = VEHICLE_DINIT_GPS_ANTENNA;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGpsAntennal
+* ABSTRACT : Vehicle Sensor GPS_ANTENNA SET Function
+* FUNCTION : Update the GPS_ANTENNA data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGpsAntennal(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsAntenna_l;
+
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGpsAntennal
+* ABSTRACT : Vehicle Sensor GPS_ANTENNA GET Function
+* FUNCTION : Provide the GPS_ANTENNA data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGpsAntennal(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsAntenna_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift.cpp
new file mode 100755
index 0000000..955e161
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift.cpp
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsClockDrift.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS clock drift data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ * @param[in] u_int8
+ */
+void VehicleSensGetGpsClockDrift(SENSOR_MSG_GPSDATA_DAT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetGpsClockDriftG(pst_data);
+ break;
+ }
+
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift_g.cpp
new file mode 100755
index 0000000..ecfbb4f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift_g.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsClockDrift_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gGpsClockDrift_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS clock drift data master initialization process
+ */
+void VehicleSensInitGpsClockDriftG(void) {
+ int32_t l_gps_clock_drift;
+
+ memset(&gGpsClockDrift_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gGpsClockDrift_g.ul_did = POSHAL_DID_GPS_CLOCK_DRIFT;
+ /** Data size setting */
+ gGpsClockDrift_g.us_size = sizeof(int32_t);
+ /** Data content setting */
+ l_gps_clock_drift = 0xFFFFFFFF;
+ memcpy(&gGpsClockDrift_g.uc_data[0], &l_gps_clock_drift, sizeof(l_gps_clock_drift));
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS clock drift data master SET process
+ *
+ * @param[in] int32_t*
+ *
+ * @return u_int8
+ */
+u_int8 VehicleSensSetGpsClockDriftG(const int32_t *p_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gGpsClockDrift_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, p_data, sizeof(int32_t));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GPS_CLOCK_DRIFT;
+ pst_master->us_size = sizeof(int32_t);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, p_data, sizeof(int32_t));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * GPS clock drift data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ */
+void VehicleSensGetGpsClockDriftG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gGpsClockDrift_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq.cpp
new file mode 100755
index 0000000..39fac42
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq.cpp
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsClockFreq.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS clock frequency data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ * @param[in] u_int8
+ */
+void VehicleSensGetGpsClockFreq(SENSOR_MSG_GPSDATA_DAT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetGpsClockFreqG(pst_data);
+ break;
+ }
+
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq_g.cpp
new file mode 100755
index 0000000..85cbdd6
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq_g.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsClockFreq_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gGpsClockFreq_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Initialization of GPS clock frequency data master
+ */
+void VehicleSensInitGpsClockFreqG(void) {
+ uint32_t ul_gps_clock_freq;
+
+ memset(&gGpsClockFreq_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gGpsClockFreq_g.ul_did = POSHAL_DID_GPS_CLOCK_FREQ;
+ /** Data size setting */
+ gGpsClockFreq_g.us_size = sizeof(uint32_t);
+ /** Data content setting */
+ ul_gps_clock_freq = 0xFFFFFFFF;
+ memcpy(&gGpsClockFreq_g.uc_data[0], &ul_gps_clock_freq, sizeof(ul_gps_clock_freq));
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS clock frequency data master SET process
+ *
+ * @param[in] uint32_t*
+ *
+ * @return u_int8
+ */
+u_int8 VehicleSensSetGpsClockFreqG(const uint32_t *p_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gGpsClockFreq_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, p_data, sizeof(uint32_t));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GPS_CLOCK_FREQ;
+ pst_master->us_size = sizeof(uint32_t);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, p_data, sizeof(uint32_t));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * GPS clock frequency data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ */
+void VehicleSensGetGpsClockFreqG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gGpsClockFreq_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsCounter_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsCounter_g.cpp
new file mode 100755
index 0000000..d4aba14
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsCounter_g.cpp
@@ -0,0 +1,98 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GpsCounter_g.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS_COUNTER)
+ * Module configuration :VehicleSensInitGpsCounterg() Vehicle sensor GPS_COUNTER initialization function
+ * :VehicleSensSetGpsCounterg() Vehicle Sensor GPS_COUNTER SET Function
+ * :VehicleSensGetGpsCounterg() Vehicle Sensor GPS_COUNTER GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGpsCounter_g; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGpsCounterg
+* ABSTRACT : Vehicle sensor GPS_COUNTER initialization function
+* FUNCTION : GPS_COUNTER data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGpsCounterg(void) {
+ memset(&gstGpsCounter_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGpsCounter_g.ul_did = VEHICLE_DID_GPS_COUNTER;
+ gstGpsCounter_g.us_size = VEHICLE_DSIZE_GPS_COUNTER;
+ gstGpsCounter_g.uc_data[0] = VEHICLE_DINIT_GPS_COUNTER;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGpsCounterg
+* ABSTRACT : Vehicle Sensor GPS_COUNTER SET Function
+* FUNCTION : Update the GPS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to CAN received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGpsCounterg(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsCounter_g;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int8)pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGpsCounterg
+* ABSTRACT : Vehicle Sensor GPS_COUNTER GET Function
+* FUNCTION : Provide the GPS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGpsCounterg(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsCounter_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsNmea_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsNmea_g.cpp
new file mode 100755
index 0000000..a7b733e
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsNmea_g.cpp
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsNmea_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files
+ *---------------------------------------------------------------------------------*/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "gps_hal.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGpsNmea_g; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor GPS_NMEA initialization processing
+ */
+void VehicleSensInitGpsNmeaG(void) {
+ memset(&gstGpsNmea_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+ gstGpsNmea_g.ul_did = POSHAL_DID_GPS_NMEA;
+ gstGpsNmea_g.us_size = VEHICLE_DSIZE_GPS_FORMAT;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GPS_NMEA SET processing
+ *
+ * @param[in] Pointer to received message data
+ *
+ * @return VEHICLESENS_EQ No data change<BR>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGpsNmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGpsNmea_g;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle sensor GPS_NMEA GET processing
+ *
+ * @param[out] pst_data Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGpsNmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGpsNmea_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime.cpp
new file mode 100755
index 0000000..8c23e3e
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime.cpp
@@ -0,0 +1,53 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsTime.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS time information data master GET processing
+ *
+ * @param[out] VEHICLESENS_DATA_MASTER*
+ * @param[in] u_int8
+ */
+void VehicleSensGetGpsTime(SENSOR_MSG_GPSDATA_DAT *pst_data, u_int8 uc_get_method) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPSorNAVI */
+ VehicleSensGetGpsTimeG(pst_data);
+ break;
+ }
+
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw.cpp
new file mode 100755
index 0000000..9637b72
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw.cpp
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsTimeRaw.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Raw GPS time information data master GET processing
+ *
+ * @param[out] VEHICLESENS_DATA_MASTER*
+ * @param[in] u_int8
+ */
+void VehicleSensGetGpsTimeRaw(SENSOR_MSG_GPSDATA_DAT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetGpsTimeRawG(pst_data);
+ break;
+ }
+
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw_g.cpp
new file mode 100755
index 0000000..52cda83
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw_g.cpp
@@ -0,0 +1,107 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsTimeRaw_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstGpsTimeRaw_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS time information data master initialization processing
+ */
+void VehicleSensInitGpsTimeRawG(void) {
+ SENSOR_GPSTIME_RAW st_gps_time_raw;
+
+ memset(&gstGpsTimeRaw_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstGpsTimeRaw_g.ul_did = POSHAL_DID_GPS_TIME_RAW;
+ /** Data size setting */
+ gstGpsTimeRaw_g.us_size = sizeof(SENSOR_GPSTIME_RAW);
+ /** Data content setting */
+ memset(&st_gps_time_raw, 0x00, sizeof(st_gps_time_raw));
+ memcpy(&gstGpsTimeRaw_g.uc_data[0], &st_gps_time_raw, sizeof(st_gps_time_raw));
+
+ return;
+}
+
+/**
+ * @brief
+ * Raw GPS Time Data Master SET Processing
+ *
+ * @param[in] SENSOR_GPSTIME_RAW*
+ *
+ * @return u_int8
+ */
+u_int8 VehicleSensSetGpsTimeRawG(const SENSOR_GPSTIME_RAW *pst_gps_time_raw) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsTimeRaw_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_gps_time_raw, sizeof(SENSOR_GPSTIME_RAW));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GPS_TIME_RAW;
+ pst_master->us_size = sizeof(SENSOR_GPSTIME_RAW);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_gps_time_raw, sizeof(SENSOR_GPSTIME_RAW));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "year=%04d, month=%02d, date=%02d, hour=%02d, minute=%02d, second=%02d, tdsts=%d",
+ pst_gps_time_raw->utc.year, pst_gps_time_raw->utc.month, pst_gps_time_raw->utc.date,
+ pst_gps_time_raw->utc.hour, pst_gps_time_raw->utc.minute,
+ pst_gps_time_raw->utc.second, pst_gps_time_raw->tdsts);
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Raw GPS time information data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ */
+void VehicleSensGetGpsTimeRawG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsTimeRaw_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime_g.cpp
new file mode 100755
index 0000000..404e60e
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime_g.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsTime_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstGpsTime_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS time information data master initialization processing
+ */
+void VehicleSensInitGpsTimeG(void) {
+ SENSOR_MSG_GPSTIME st_gps_time;
+
+ memset(&gstGpsTime_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstGpsTime_g.ul_did = POSHAL_DID_GPS_TIME;
+ /** Data size setting */
+ gstGpsTime_g.us_size = sizeof(SENSOR_MSG_GPSTIME);
+ /** Data content setting */
+ memset(&st_gps_time, 0x00, sizeof(st_gps_time));
+ memcpy(&gstGpsTime_g.uc_data[0], &st_gps_time, sizeof(st_gps_time));
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS time information data master SET process
+ *
+ * @param[in] SENSOR_MSG_GPS*
+ *
+ * @return u_int8
+ */
+u_int8 VehicleSensSetGpsTimeG(const SENSOR_MSG_GPSTIME *pst_gps_time) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsTime_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_gps_time, sizeof(SENSOR_MSG_GPSTIME));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GPS_TIME;
+ pst_master->us_size = sizeof(SENSOR_MSG_GPSTIME);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_gps_time, sizeof(SENSOR_MSG_GPSTIME));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * GPS time information data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPS*
+ */
+void VehicleSensGetGpsTimeG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsTime_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp
new file mode 100755
index 0000000..8f84200
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp
@@ -0,0 +1,99 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp
+ * System name :_CWORD72_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS__CWORD82__FULLBINARY)
+ * Module configuration :VehicleSensInitGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY initialization function
+ * :VehicleSensSetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY SET function
+ * :VehicleSensGetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "VehicleSens_Common.h"
+#include "gps_hal.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGps_CWORD82_FullBinary_g; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGps_CWORD82_FullBinaryG
+* ABSTRACT : Vehicle sensor GPS_VERSION initialization function
+* FUNCTION : GPS__CWORD82__FULLBINARY data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGps_CWORD82_FullBinaryG(void) {
+ memset(&gstGps_CWORD82_FullBinary_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+ gstGps_CWORD82_FullBinary_g.ul_did = POSHAL_DID_GPS__CWORD82__FULLBINARY;
+ /* _CWORD82_-only format with a fixed magic number */
+ /* GPS antenna connection information(1byte) + Sensor Counter(1byte) + 191 */
+ gstGps_CWORD82_FullBinary_g.us_size = (VEHICLE_DSIZE_GPS_ANTENNA + VEHICLE_DSIZE_SNS_COUNTER + GPS_CMD_FULLBIN_SZ);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGps_CWORD82_FullBinaryG
+* ABSTRACT : Vehicle sensor GPS_VERSION SET function
+* FUNCTION : Update the GPS__CWORD82__FULLBINARY data master
+* ARGUMENT : *pst_data : Pointer to CAN received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGps_CWORD82_FullBinaryG(const SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+ VehicleSensSetGpsVersion(pst_data); /* Pass the _CWORD82_ binary */
+
+ pst_master = &gstGps_CWORD82_FullBinary_g;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGps_CWORD82_FullBinaryG
+* ABSTRACT : Vehicle sensor GPS_VERSION GET function
+* FUNCTION : Provide the GPS__CWORD82__FULLBINARY data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGps_CWORD82_FullBinaryG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGps_CWORD82_FullBinary_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
new file mode 100755
index 0000000..9f69054
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
+ * System name :_CWORD72_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS__CWORD82__FULLBINARY)
+ * Module configuration :VehicleSensInitGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY initialization function
+ * :VehicleSensSetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY SET function
+ * :VehicleSensGetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "gps_hal.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGps_CWORD82_Nmea_g; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGps_CWORD82_NmeaG
+* ABSTRACT : Vehicle sensor GPS__CWORD82__NMEA initialization function
+* FUNCTION : GPS__CWORD82__NMEA data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGps_CWORD82_NmeaG(void) {
+ memset(&gstGps_CWORD82_Nmea_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+ gstGps_CWORD82_Nmea_g.ul_did = VEHICLE_DID_GPS__CWORD82__NMEA;
+ /* _CWORD82_-only format with a fixed magic number */
+ gstGps_CWORD82_Nmea_g.us_size = 3 /* NMEA reception flag + GPS antenna connection information + sensor counter */
+ + VEHICLE_DSIZE_GPS_NMEA_DRMC
+ + VEHICLE_DSIZE_GPS_NMEA_GSA
+ + VEHICLE_DSIZE_GPS_NMEA_GSV_1
+ + VEHICLE_DSIZE_GPS_NMEA_GSV_2
+ + VEHICLE_DSIZE_GPS_NMEA_GSV_3
+ + VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_3;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGps_CWORD82_NmeaG
+* ABSTRACT : Vehicle sensor GPS_NMEA SET function
+* FUNCTION : Update the GPS__CWORD82___CWORD44__GP4 data master
+* ARGUMENT : *pst_data : Pointer to CAN received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetGps_CWORD82_NmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGps_CWORD82_Nmea_g;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGps_CWORD82_NmeaG
+* ABSTRACT : Vehicle sensor GPS__CWORD82__NMEA GET function
+* FUNCTION : GPS__CWORD82__NMEA Provides a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGps_CWORD82_NmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGps_CWORD82_Nmea_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82__CWORD44_Gp4_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82__CWORD44_Gp4_g.cpp
new file mode 100755
index 0000000..4ce8678
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82__CWORD44_Gp4_g.cpp
@@ -0,0 +1,101 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
+ * System name :_CWORD72_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS__CWORD82__FULLBINARY)
+ * Module configuration :VehicleSensInitGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY initialization function
+ * :VehicleSensSetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY SET function
+ * :VehicleSensGetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "gps_hal.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGps_CWORD82__CWORD44_Gp4_g; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGps_CWORD82__CWORD44_Gp4G
+* ABSTRACT : Vehicle sensor GPS__CWORD44__GP4 initialization function
+* FUNCTION : GPS__CWORD82___CWORD44__GP4 data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGps_CWORD82__CWORD44_Gp4G(void) {
+ memset(&gstGps_CWORD82__CWORD44_Gp4_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+ gstGps_CWORD82__CWORD44_Gp4_g.ul_did = POSHAL_DID_GPS__CWORD82___CWORD44_GP4;
+ /* Initialize with _CWORD82_ only and size fixed VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4 */
+ /* GPS antenna connection information(1byte) + Sensor Counter(1byte) + VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4 */
+ gstGps_CWORD82__CWORD44_Gp4_g.us_size = (VEHICLE_DSIZE_GPS_ANTENNA + VEHICLE_DSIZE_SNS_COUNTER) \
+ + (VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGps_CWORD82__CWORD44_Gp4G
+* ABSTRACT : Vehicle sensor GPS_NMEA SET function
+* FUNCTION : Update the GPS__CWORD82___CWORD44__GP4 data master
+* ARGUMENT : *pst_data : Pointer to CAN received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetGps_CWORD82__CWORD44_Gp4G(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGps_CWORD82__CWORD44_Gp4_g;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int8)pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGps_CWORD82__CWORD44_Gp4G
+* ABSTRACT : Vehicle sensor GPS__CWORD44__GP4 GET function
+* FUNCTION : Provide the GPS__CWORD82___CWORD44__GP4 data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGps_CWORD82__CWORD44_Gp4G(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGps_CWORD82__CWORD44_Gp4_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX.cpp
new file mode 100755
index 0000000..e68edc6
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX.cpp
@@ -0,0 +1,119 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsX.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GSNS_X)
+ * Module configuration :VehicleSensGetGsnsX() Vehicle sensor GSNS_X GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsX
+* ABSTRACT : Vehicle sensor GSNS_X GET function
+* FUNCTION : Provide the GSNS_X data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsX(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsXl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsXExt
+* ABSTRACT : Vehicle sensor GSNS_X GET function
+* FUNCTION : Provide the GSNS_X data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsXExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsXExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+#endif
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X GET function
+ *
+ * Provide the GSNS_X data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGsnsXFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsXFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXExt_l.cpp
new file mode 100755
index 0000000..4a481bb
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXExt_l.cpp
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsXExt_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_X)
+ * Module configuration :VehicleSensInitGsnsXExtl() Vehicle sensor GSNS_X initialization function
+ * :VehicleSensSetGsnsXExtlG() Vehicle sensor GSNS_X SET function
+ * :VehicleSensGetGsnsXExtl() Vehicle sensor GSNS_X GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGsnsXExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsXExtl
+* ABSTRACT : Vehicle sensor GSNS_X initialization function
+* FUNCTION : GSNS_X data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsXExtl(void) {
+ memset(&gstGsnsXExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstGsnsXExt_l.ul_did = POSHAL_DID_GSNS_X;
+ gstGsnsXExt_l.us_size = VEHICLE_DSIZE_GSNS_X_EXT_INIT;
+ gstGsnsXExt_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X SET function
+ *
+ * Update the GSNS_X data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ */
+void VehicleSensSetGsnsXExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGsnsXExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Store the latest one in the internal data structure */
+ us_start = gstPkgTempExt.start_point[GsnsX]; /* Location to store one received message */
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GsnsX] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GSNS_X_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsXExtl
+* ABSTRACT : Vehicle sensor GSNS_X GET function
+* FUNCTION : Provide the GSNS_X data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsXExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGsnsXExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GsnsX];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GsnsX] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GsnsX] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXFst_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXFst_l.cpp
new file mode 100755
index 0000000..61ee990
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXFst_l.cpp
@@ -0,0 +1,127 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GsnsXFst_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GSNS_X_FST)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST g_st_gsnsx_fst_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X initialization function
+ *
+ * GSNS_X data master initialization processing
+ */
+void VehicleSensInitGsnsXFstl(void) {
+ memset(&g_st_gsnsx_fst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ g_st_gsnsx_fst_l.ul_did = POSHAL_DID_GSNS_X_FST;
+ g_st_gsnsx_fst_l.us_size = VEHICLE_DSIZE_GSNS_X_EXT_INIT;
+ g_st_gsnsx_fst_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ g_st_gsnsx_fst_l.partition_flg = 0;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X SET function
+ *
+ * Update the GSNS_X data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGsnsXFstG(const LSDRV_LSDATA_FST_GSENSOR_X *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ pst_master = &g_st_gsnsx_fst_l;
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GSNSX_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GSNSX_FST], pst_data->uc_data, pst_data->uc_size);
+ } else { }
+ } else { }
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X GET function
+ *
+ * Provide the GSNS_X data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGsnsXFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &g_st_gsnsx_fst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX_l.cpp
new file mode 100755
index 0000000..90d16ce
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX_l.cpp
@@ -0,0 +1,98 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsX_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_X)
+ * Module configuration :VehicleSensInitGsnsXl() Vehicle sensor GSNS_X initialization function
+ * :VehicleSensSetGsnsXlG() Vehicle sensor GSNS_X SET function
+ * :VehicleSensGetGsnsXl() Vehicle sensor GSNS_X GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGsnsX_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsXl
+* ABSTRACT : Vehicle sensor GSNS_X initialization function
+* FUNCTION : GSNS_X data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsXl(void) {
+ memset(&gstGsnsX_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGsnsX_l.ul_did = POSHAL_DID_GSNS_X;
+ gstGsnsX_l.us_size = VEHICLE_DSIZE_GSNS_X;
+ gstGsnsX_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X SET function
+ *
+ * Update the GSNS_X data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGsnsXlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsX_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsXl
+* ABSTRACT : Vehicle sensor GSNS_X GET function
+* FUNCTION : Provide the GSNS_X data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsXl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsX_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY.cpp
new file mode 100755
index 0000000..0ab4b67
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY.cpp
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsY.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GSNS_Y)
+ * Module configuration :VehicleSensGetGsnsY() Vehicle sensor GSNS_Y GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsY
+* ABSTRACT : Vehicle sensor GSNS_Y GET function
+* FUNCTION : Provide the GSNS_Y data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsY(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsYl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsYExt
+* ABSTRACT : Vehicle sensor GSNS_Y GET function
+* FUNCTION : Provide the GSNS_Y data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsYExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsYExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+#endif
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y GET function
+ *
+ * Provide the GSNS_Y data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGsnsYFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsYFstl(pst_data);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYExt_l.cpp
new file mode 100755
index 0000000..947da7f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYExt_l.cpp
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsYExt_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_Y)
+ * Module configuration :VehicleSensInitGsnsYExtl() Vehicle sensor GSNS_Y initialization function
+ * :VehicleSensSetGsnsYExtlG() Vehicle sensor GSNS_Y SET function
+ * :VehicleSensGetGsnsYExtl() Vehicle sensor GSNS_Y GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGsnsYExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsYExtl
+* ABSTRACT : Vehicle sensor GSNS_Y initialization function
+* FUNCTION : GSNS_Y data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsYExtl(void) {
+ memset(&gstGsnsYExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstGsnsYExt_l.ul_did = POSHAL_DID_GSNS_Y;
+ gstGsnsYExt_l.us_size = VEHICLE_DSIZE_GSNS_Y_EXT_INIT;
+ gstGsnsYExt_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y SET function
+ *
+ * Update the GSNS_Y data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ */
+void VehicleSensSetGsnsYExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGsnsYExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Store the latest one in the internal data structure */
+ us_start = gstPkgTempExt.start_point[GsnsY]; /* Location to store one received message */
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GsnsY] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GSNS_Y_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsYExtl
+* ABSTRACT : Vehicle sensor GSNS_Y GET function
+* FUNCTION : Provide the GSNS_Y data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsYExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGsnsYExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GsnsY];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GsnsY] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GsnsY] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYFst_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYFst_l.cpp
new file mode 100755
index 0000000..1fc1b92
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYFst_l.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GsnsYFst_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GSNS_Y_FST)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST g_st_gsnsy_fst_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y initialization function
+ *
+ * GSNS_Y data master initialization processing
+ */
+void VehicleSensInitGsnsYFstl(void) {
+ memset(&g_st_gsnsy_fst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ g_st_gsnsy_fst_l.ul_did = POSHAL_DID_GSNS_Y_FST;
+ g_st_gsnsy_fst_l.us_size = VEHICLE_DSIZE_GSNS_Y_EXT_INIT;
+ g_st_gsnsy_fst_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ g_st_gsnsy_fst_l.partition_flg = 0;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y SET function
+ *
+ * Update the GSNS_Y data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGsnsYFstG(const LSDRV_LSDATA_FST_GSENSOR_Y *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ pst_master = &g_st_gsnsy_fst_l;
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GSNSY_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GSNSY_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y GET function
+ *
+ * Provide the GSNS_Y data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGsnsYFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &g_st_gsnsy_fst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY_l.cpp
new file mode 100755
index 0000000..1bf2e30
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY_l.cpp
@@ -0,0 +1,99 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsY_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_Y)
+ * Module configuration :VehicleSensInitGsnsYl() Vehicle sensor GSNS_Y initialization function
+ * :VehicleSensSetGsnsYlG() Vehicle sensor GSNS_Y SET function
+ * :VehicleSensGetGsnsYl() Vehicle sensor GSNS_Y GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGsnsY_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsYl
+* ABSTRACT : Vehicle sensor GSNS_Y initialization function
+* FUNCTION : GSNS_Y data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsYl(void) {
+ memset(&gstGsnsY_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGsnsY_l.ul_did = POSHAL_DID_GSNS_Y;
+ gstGsnsY_l.us_size = VEHICLE_DSIZE_GSNS_Y;
+ gstGsnsY_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y SET function
+ *
+ * Update the GSNS_Y data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ *
+ */
+u_int8 VehicleSensSetGsnsYlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsY_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsYl
+* ABSTRACT : Vehicle sensor GSNS_Y GET function
+* FUNCTION : Provide the GSNS_Y data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsYl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsY_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ.cpp
new file mode 100755
index 0000000..ec865c3
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ.cpp
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsY.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GSNS_Z)
+ * Module configuration :VehicleSensGetGsnsZ() Vehicle sensor GSNS_Z GET function
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsZ
+* ABSTRACT : Vehicle sensor GSNS_Z GET function
+* FUNCTION : Provide the GSNS_Z data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsZ(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsZl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsZExt
+* ABSTRACT : Vehicle sensor GSNS_Z GET function
+* FUNCTION : Provide the GSNS_Z data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsZExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsZExtl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z GET function
+ *
+ * Provide the GSNS_Z data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGsnsZFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsZFstl(pst_data);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZExt_l.cpp
new file mode 100755
index 0000000..9dc1e39
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZExt_l.cpp
@@ -0,0 +1,142 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsZExt_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_Z)
+ * Module configuration :VehicleSensInitGsnsZExtl() Vehicle sensor GSNS_Z initialization function
+ * :VehicleSensSetGsnsZExtlG() Vehicle sensor GSNS_Z SET function
+ * :VehicleSensGetGsnsZExtl() Vehicle sensor GSNS_Z GET function
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGsnsZExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsZExtl
+* ABSTRACT : Vehicle sensor GSNS_Z initialization function
+* FUNCTION : GSNS_Z data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsZExtl(void) {
+ memset(&gstGsnsZExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstGsnsZExt_l.ul_did = POSHAL_DID_GSNS_Z;
+ gstGsnsZExt_l.us_size = VEHICLE_DSIZE_GSNS_Z_EXT_INIT;
+ gstGsnsZExt_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z SET function
+ *
+ * Update the GSNS_Z data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ */
+void VehicleSensSetGsnsZExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGsnsZExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Store the latest one in the internal data structure */
+ us_start = gstPkgTempExt.start_point[GsnsZ]; /* Location to store one received message */
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GsnsZ] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GSNS_Z_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsZExtl
+* ABSTRACT : Vehicle sensor GSNS_Z GET function
+* FUNCTION : Provide the GSNS_Z data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsZExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGsnsZExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GsnsZ];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GsnsZ] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GsnsZ] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZFst_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZFst_l.cpp
new file mode 100755
index 0000000..a69bb87
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZFst_l.cpp
@@ -0,0 +1,127 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GsnsZFst_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GSNS_Z_FST)
+ */
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST g_st_gsnsz_fst_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z initialization function
+ *
+ * GSNS_Z data master initialization processing
+ */
+void VehicleSensInitGsnsZFstl(void) {
+ memset(&g_st_gsnsz_fst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ g_st_gsnsz_fst_l.ul_did = POSHAL_DID_GSNS_Z_FST;
+ g_st_gsnsz_fst_l.us_size = VEHICLE_DSIZE_GSNS_Z_EXT_INIT;
+ g_st_gsnsz_fst_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ g_st_gsnsz_fst_l.partition_flg = 0;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z SET function
+ *
+ * Update the GSNS_Z data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGsnsZFstG(const LSDRV_LSDATA_FST_GSENSOR_Z *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ pst_master = &g_st_gsnsz_fst_l;
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GSNSZ_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GSNSZ_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z GET function
+ *
+ * Provide the GSNS_Z data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGsnsZFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &g_st_gsnsz_fst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ_l.cpp
new file mode 100755
index 0000000..8614535
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ_l.cpp
@@ -0,0 +1,97 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsZ_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_Z)
+ * Module configuration :VehicleSensInitGsnsZl() Vehicle sensor GSNS_Z initialization function
+ * :VehicleSensSetGsnsZlG() Vehicle sensor GSNS_Z SET function
+ * :VehicleSensGetGsnsZl() Vehicle sensor GSNS_Z GET function
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGsnsZ_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsZl
+* ABSTRACT : Vehicle sensor GSNS_Z initialization function
+* FUNCTION : GSNS_Z data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsZl(void) {
+ memset(&gstGsnsZ_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGsnsZ_l.ul_did = POSHAL_DID_GSNS_Z;
+ gstGsnsZ_l.us_size = VEHICLE_DSIZE_GSNS_Z;
+ gstGsnsZ_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z SET function
+ *
+ * Update the GSNS_Z data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ *
+ */
+u_int8 VehicleSensSetGsnsZlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsZ_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsZl
+* ABSTRACT : Vehicle sensor GSNS_Z GET function
+* FUNCTION : Provide the GSNS_Z data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsZl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsZ_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroConnectStatus.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroConnectStatus.cpp
new file mode 100755
index 0000000..d6fee30
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroConnectStatus.cpp
@@ -0,0 +1,110 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroConnectStatus.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_CONNECT_STATUS)
+ * Module configuration :VehicleSensInitGyroConnectStatus() Vehicle Sensor GYRO CONNECT STATUS Initialization Functions
+ * :VehicleSensSetGyroConnectStatus() Vehicle Sensor GYRO CONNECT STATUS SET Functions
+ * :VehicleSensGetGyroConnectStatus() Vehicle Sensor GYRO CONNECT STATUS GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS gstGyroConnectStatus; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroConnectStatus
+* ABSTRACT : Vehicle sensor GYRO_CONNECT_STATUS initialization function
+* FUNCTION : GYRO_CONNECT_STATUS data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroConnectStatus(void) {
+ (void)memset(reinterpret_cast<void *>(&(gstGyroConnectStatus)), static_cast<int>(0x00),
+ sizeof(VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS));
+ gstGyroConnectStatus.ul_did = VEHICLE_DID_GYRO_CONNECT_STATUS;
+ gstGyroConnectStatus.us_size = VEHICLE_DSIZE_GYRO_CONNECT_STATUS;
+ gstGyroConnectStatus.uc_data = VEHICLE_DINIT_GYRO_CONNECT_STATUS;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroConnectStatus
+* ABSTRACT : Vehicle sensor GYRO_CONNECT_STATUS SET function
+* FUNCTION : Update the GYRO_CONNECT_STATUS data master
+* ARGUMENT : *pst_data : Pointer to received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroConnectStatus(const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *pst_data) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGyroConnectStatus;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), (size_t)(pst_data->uc_size));
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int16)pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
+ }
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroConnectStatus
+* ABSTRACT : Vehicle Sensor GYRO TROUBLE GET Functions
+* FUNCTION : Provide a GYRO TROUBLE data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroConnectStatus(VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGyroConnectStatus;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
+ (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroExt_l.cpp
new file mode 100755
index 0000000..0470c9f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroExt_l.cpp
@@ -0,0 +1,257 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroExt_l.cpp
+ * System name :Polaris
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_EXT)
+ * Module configuration :VehicleSensInitGyroExtl() Vehicle Sensor GYRO (Initial Delivery) Initialization Functions
+ * :VehicleSensSetGyroExtlG() Vehicle Sensor GYRO (Initial Delivery) Set Functions
+ * :VehicleSensGetGyroExtl() Vehicle Sensor GYRO (Initial Delivery) Get Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGyroExt_l; // NOLINT(readability/nolint)
+static VEHICLESENS_DATA_MASTER gstGyroRev_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroRevl
+* ABSTRACT : Vehicle Sensor GYRO Initialization Functions(Extensions data)
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroRevl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroRev_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ /* POSHAL_DID_GYRO initialized by POSHAL_DID_GYRO_X because POSHAL_DID_GYRO is internally replaced by POSHAL_DID_GYRO_EXT */
+ gstGyroRev_l.ul_did = POSHAL_DID_GYRO_X;
+ gstGyroRev_l.us_size = VEHICLE_DSIZE_GYRO;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroRev_l.uc_data);
+ pus[0] = VEHICLE_DINIT_GYRO; /* Ignore->MISRA-C++:2008 Rule 5-0-15 */
+ pus[1] = VEHICLE_DINIT_GYRO; /* Ignore->MISRA-C++:2008 Rule 5-0-15 */
+ pus[2] = VEHICLE_DINIT_GYRO; /* Ignore->MISRA-C++:2008 Rule 5-0-15 */
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroExtl
+* ABSTRACT : Vehicle Sensor GYRO Initialization Functions(Initial delivery)
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroExtl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ /* POSHAL_DID_GYRO initialized by POSHAL_DID_GYRO_X because POSHAL_DID_GYRO is internally replaced by POSHAL_DID_GYRO_EXT */
+ gstGyroExt_l.ul_did = POSHAL_DID_GYRO_X;
+ gstGyroExt_l.us_size = VEHICLE_DSIZE_GYRO_EXT_INIT;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroExt_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO, VEHICLE_DSIZE_GYRO_EXT);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroRevl
+* ABSTRACT : Vehicle Sensor GYRO SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroRevl(const LSDRV_LSDATA *pst_data) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroRev_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GYRO_X;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroRevlG
+* ABSTRACT : Vehicle Sensor GYRO SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroRevlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroRev_l;
+
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GYRO_X;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroExtlG
+* ABSTRACT : Vehicle Sensor GYRO SET Functions(Initial delivery)
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+void VehicleSensSetGyroExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGyroExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[GyroExt];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = POSHAL_DID_GYRO_X;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GyroExt] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GYRO_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroExtl
+* ABSTRACT : Vehicle Sensor GYRO GET Functions(Initial delivery)
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGyroExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GyroExt];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GyroExt] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GyroExt] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroRevl
+* ABSTRACT : Vehicle Sensor GYRO GET Functions(Initial delivery)
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroRevl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroRev_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp.cpp
new file mode 100755
index 0000000..d6debe6
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp.cpp
@@ -0,0 +1,114 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GyroTemp.cpp
+ * @brief
+ * Vehicle sensor data master(VEHICLE_DID_GYRO_TEMP_)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature GET Function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGyroTemp(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroTempl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature (Initial Delivery) GET Function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGyroTempExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroTempExtl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/**
+ * @brief
+ * Vehicle sensor gyro temperature (initial sensor) GET function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGyroTempFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroTempFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempExt_l.cpp
new file mode 100755
index 0000000..aee750d
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempExt_l.cpp
@@ -0,0 +1,140 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GyroTempExt_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GYRO_TEMP)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT g_stgyro_temp_ext_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor gyro temperature initialization function
+ *
+ * Gyro Temperature Data Master Initialization Processing
+ */
+void VehicleSensInitGyroTempExtl(void) {
+ (void)memset(reinterpret_cast<void *>(&g_stgyro_temp_ext_l), 0, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ g_stgyro_temp_ext_l.ul_did = POSHAL_DID_GYRO_TEMP;
+ g_stgyro_temp_ext_l.us_size = VEHICLE_DSIZE_GYRO_TEMP_EXT_INIT;
+ g_stgyro_temp_ext_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature SET Function
+ *
+ * Update the gyro temperature data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+void VehicleSensSetGyroTempExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &g_stgyro_temp_ext_l;
+ us_size = sizeof(u_int16); /* Size of one data item: 2byte */
+
+ /* Store the latest one in the internal data structure */
+ us_start = gstPkgTempExt.start_point[GyroTemp]; /* Location to store one received message */
+ /* Stored in data master(Order of reception)*/
+ if (us_start == VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position. */
+ us_start++;
+ gstPkgTempExt.start_point[GyroTemp] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GYRO_TEMP_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature GET Function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGyroTempExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &g_stgyro_temp_ext_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = sizeof(u_int16); /* Size of one data item: 2byte */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GyroTemp];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GyroTemp] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GyroTemp] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempFst_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempFst_l.cpp
new file mode 100755
index 0000000..3c2906d
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempFst_l.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GyroTempFst_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GYRO_TEMP_FST)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST g_st_gyro_tempfst_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor gyro temperature initialization function
+ *
+ * Gyro Temperature Data Master Initialization Processing
+ */
+void VehicleSensInitGyroTempFstl(void) {
+ memset(&g_st_gyro_tempfst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ g_st_gyro_tempfst_l.ul_did = POSHAL_DID_GYRO_TEMP_FST;
+ g_st_gyro_tempfst_l.us_size = VEHICLE_DSIZE_GYRO_TEMP_EXT_INIT;
+ g_st_gyro_tempfst_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ g_st_gyro_tempfst_l.partition_flg = 0;
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature SET Function
+ *
+ * Update the gyro temperature data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGyroTempFstG(const LSDRV_LSDATA_FST_GYRO_TEMP *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ pst_master = &g_st_gyro_tempfst_l;
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GYROTEMP_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GYROTEMP_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature GET Function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGyroTempFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &g_st_gyro_tempfst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp_l.cpp
new file mode 100755
index 0000000..002cf02
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp_l.cpp
@@ -0,0 +1,95 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GyroTemp_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GYRO_TEMP)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGyroTemp_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor gyro temperature initialization function
+ *
+ * Gyro Temperature Data Master Initialization Processing
+ */
+void VehicleSensInitGyroTempl(void) {
+ (void)memset(reinterpret_cast<void *>(&gstGyroTemp_l), 0, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGyroTemp_l.ul_did = POSHAL_DID_GYRO_TEMP;
+ gstGyroTemp_l.us_size = VEHICLE_DSIZE_GYRO_TEMP;
+ gstGyroTemp_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature SET Function
+ *
+ * Update the gyro temperature data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGyroTemplG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroTemp_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature GET Function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGyroTempl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroTemp_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTrouble.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTrouble.cpp
new file mode 100755
index 0000000..e588c39
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTrouble.cpp
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroTrouble.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_TROUBLE)
+ * Module configuration :VehicleSensInitGyroTrouble() Vehicle Sensor GYRO TROUBLE Initialization Functions
+ * :VehicleSensSetGyroTrouble() Vehicle Sensor GYRO TROUBLE SET Functions
+ * :VehicleSensGetGyroTrouble() Vehicle Sensor GYRO TROUBLE GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#define VEHICLE_SENS_DID_GYRO_TROUBLE_DEBUG_FACTORY 0
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GYRO_TROUBLE gstGyroTrouble; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroTrouble
+* ABSTRACT : Vehicle sensor GYRO_TROUBLE initialization function
+* FUNCTION : GYRO_TROUBLE data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroTrouble(void) {
+ (void)memset(reinterpret_cast<void *>(&(gstGyroTrouble)),
+ static_cast<int>(0x00), sizeof(VEHICLESENS_DATA_MASTER_GYRO_TROUBLE));
+ gstGyroTrouble.ul_did = VEHICLE_DID_GYRO_TROUBLE;
+ gstGyroTrouble.us_size = VEHICLE_DSIZE_GYRO_TROUBLE;
+ gstGyroTrouble.uc_data = VEHICLE_DINIT_GYRO_TROUBLE;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroTrouble
+* ABSTRACT : Vehicle Sensor GYRO_TROUBLE SET Function
+* FUNCTION : Update the GYRO_TROUBLE data master
+* ARGUMENT : *pst_data : Pointer to received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroTrouble(const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGyroTrouble;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(&(pst_master->uc_data), &(pst_data->uc_data), pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int16)pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_data = pst_data->uc_data;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
+ }
+
+#if VEHICLE_SENS_DID_GYRO_TROUBLE_DEBUG_FACTORY
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] pst_data->ul_did == 0x%x", pst_data->ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] gstGyroTrouble.ul_did == 0x%x\r\n", gstGyroTrouble.ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] (u_int8)pst_data->ucSize == 0x%x", (u_int8)pst_data->uc_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] gstGyroTrouble.us_size == 0x%x\r\n", gstGyroTrouble.us_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] pst_data->uc_data == 0x%x", pst_data->uc_data);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] gstGyroTrouble.uc_data == 0x%x\r\n", gstGyroTrouble.uc_data);
+#endif
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroTrouble
+* ABSTRACT : Vehicle Sensor GYRO TROUBLE GET Functions
+* FUNCTION : Provide a GYRO TROUBLE data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroTrouble(VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGyroTrouble;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
+ (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX.cpp
new file mode 100755
index 0000000..3cda53a
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX.cpp
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroX.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_X)
+ * Module configuration :VehicleSensGetGyroX() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroX
+* ABSTRACT : Vehicle Sensor GYRO_X GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroX(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroXl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroRev
+* ABSTRACT : Vehicle Sensor GYRO GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroRev(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroRevl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroExt
+* ABSTRACT : Vehicle Sensor GYRO GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroXFst
+* ABSTRACT : Vehicle Sensor GYRO_X GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroXFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroXFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroXFst_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroXFst_l.cpp
new file mode 100755
index 0000000..e9997ac
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroXFst_l.cpp
@@ -0,0 +1,176 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroXFst_l.cpp
+ * System name :Polaris
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_X_FST)
+ * Module configuration :VehicleSensInitGyroXFstl() Vehicle sensor GYRO (initial sensor) initialization functions
+ * :VehicleSensSetGyroXFstl() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensSetGyroXFstG() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensGetGyroXFstl() Vehicle sensor GYRO (initial sensor) GET-function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST gstGyroXFst_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroXFstl
+* ABSTRACT : Vehicle Sensor GYRO_X Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroXFstl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroXFst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ gstGyroXFst_l.ul_did = POSHAL_DID_GYRO_X_FST;
+ gstGyroXFst_l.us_size = 0;
+ gstGyroXFst_l.partition_flg = 0;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroXFst_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO_X, VEHICLE_DSIZE_GYRO_X_FST);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroXFstl
+* ABSTRACT : Vehicle Sensor GYRO_X SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroXFstl(const LSDRV_LSDATA_FST *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroXFst_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->partition_flg = 0;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroXFstG
+* ABSTRACT : Vehicle Sensor GYRO SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroXFstG(const LSDRV_LSDATA_FST_GYRO_X *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ pst_master = &gstGyroXFst_l;
+
+ if (partition_max == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_max == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (partition_num == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_num == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_X_FST],
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_X_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroXFstl
+* ABSTRACT : Vehicle Sensor GYRO GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroXFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroXFst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
+
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX_l.cpp
new file mode 100755
index 0000000..af90e25
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX_l.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroX_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_X)
+ * Module configuration :VehicleSensInitGyroXl() Vehicle Sensor GYRO Initialization Functions
+ * :VehicleSensSetGyroXl() Vehicle Sensor GYRO SET Functions
+ * :VehicleSensGetGyroXl() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGyroX_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroXl
+* ABSTRACT : Vehicle Sensor GYRO_X Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroXl(void) {
+ memset(&gstGyroX_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGyroX_l.ul_did = POSHAL_DID_GYRO_X;
+ gstGyroX_l.us_size = VEHICLE_DSIZE_GYRO_X;
+ gstGyroX_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroXl
+* ABSTRACT : Vehicle Sensor GYRO_X SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroXl(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroX_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)pst_data->uc_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroXlG
+* ABSTRACT : Vehicle Sensor GYRO_X SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroXlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroX_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroXl
+* ABSTRACT : Vehicle Sensor GYRO_X GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroXl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroX_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY.cpp
new file mode 100755
index 0000000..b7d0e5a
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY.cpp
@@ -0,0 +1,113 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroY.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_Y)
+ * Module configuration :VehicleSensGetGyroY() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroY
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroY(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroYl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroYExt
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroYExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroYExtl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroYFst
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroYFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroYFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYExt_l.cpp
new file mode 100755
index 0000000..898dafb
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYExt_l.cpp
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroYExt_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_EXT)
+ * Module configuration :VehicleSensInitGyroYExtl() Vehicle Sensor GYRO (Initial Delivery) Initialization Functions
+ * :VehicleSensSetGyroYExtlG() Vehicle Sensor GYRO (Initial Delivery) Set Functions
+ * :VehicleSensGetGyroYExtl() Vehicle Sensor GYRO (Initial Delivery) Get Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGyroYExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroYExtl
+* ABSTRACT : Vehicle Sensor GYRO_Y Initialization Functions(Initial delivery)
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroYExtl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroYExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstGyroYExt_l.ul_did = POSHAL_DID_GYRO_Y;
+ gstGyroYExt_l.us_size = VEHICLE_DSIZE_GYRO_EXT_INIT;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroYExt_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO, VEHICLE_DSIZE_GYRO_EXT);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroYExtlG
+* ABSTRACT : Vehicle Sensor GYRO_Y SET Functions(Initial delivery)
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+void VehicleSensSetGyroYExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGyroYExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[GyroY];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GyroY] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GYRO_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroYExtl
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions(Initial delivery)
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroYExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGyroYExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GyroY];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GyroY] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GyroY] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif // CONFIG_SENSOR_EXT_VALID
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYFst_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYFst_l.cpp
new file mode 100755
index 0000000..164cf4d
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYFst_l.cpp
@@ -0,0 +1,169 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroYFst_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_Y_FST)
+ * Module configuration :VehicleSensInitGyroYFstl() Vehicle sensor GYRO (initial sensor) initialization functions
+ * :VehicleSensSetGyroYFstl() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensSetGyroYFstG() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensGetGyroYFstl() Vehicle sensor GYRO (initial sensor) GET-function
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST gstGyroYFst_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroYFstl
+* ABSTRACT : Vehicle Sensor GYRO_Y Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroYFstl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroYFst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ gstGyroYFst_l.ul_did = POSHAL_DID_GYRO_Y_FST;
+ gstGyroYFst_l.us_size = 0;
+ gstGyroYFst_l.partition_flg = 0;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroYFst_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO_Y, VEHICLE_DSIZE_GYRO_Y_FST);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroYFstl
+* ABSTRACT : Vehicle Sensor GYRO_Y SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroYFstl(const LSDRV_LSDATA_FST *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroYFst_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->partition_flg = 0;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroYFstG
+* ABSTRACT : Vehicle Sensor GYRO_Y SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroYFstG(const LSDRV_LSDATA_FST_GYRO_Y *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ pst_master = &gstGyroYFst_l;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_Y_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_Y_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroYFstl
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroYFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroYFst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY_l.cpp
new file mode 100755
index 0000000..9799b29
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY_l.cpp
@@ -0,0 +1,126 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroY_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_Y)
+ * Module configuration :VehicleSensInitGyroYl() Vehicle Sensor GYRO Initialization Functions
+ * :VehicleSensSetGyroYl() Vehicle Sensor GYRO SET Functions
+ * :VehicleSensGetGyroYl() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGyroY_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroYl
+* ABSTRACT : Vehicle Sensor GYRO_Y Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroYl(void) {
+ memset(&gstGyroY_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGyroY_l.ul_did = POSHAL_DID_GYRO_Y;
+ gstGyroY_l.us_size = VEHICLE_DSIZE_GYRO_Y;
+ gstGyroY_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroYl
+* ABSTRACT : Vehicle Sensor GYRO_Y SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroYl(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroY_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)pst_data->uc_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroYlG
+* ABSTRACT : Vehicle Sensor GYRO_Y SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroYlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroY_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroYl
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroYl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroY_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ.cpp
new file mode 100755
index 0000000..1b84af7
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ.cpp
@@ -0,0 +1,113 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroZ.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_Z)
+ * Module configuration :VehicleSensGetGyroZ() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZ
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZ(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroZl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZExt
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroZExtl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZFst
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroZFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZExt_l.cpp
new file mode 100755
index 0000000..9ef9996
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZExt_l.cpp
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroZExt_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_EXT)
+ * Module configuration :VehicleSensInitGyroxiZYExtl() Vehicle Sensor GYRO (Initial Delivery) Initialization Functions
+ * :VehicleSensSetGyroZExtlG() Vehicle Sensor GYRO (Initial Delivery) Set Functions
+ * :VehicleSensGetGyroZExtl() Vehicle Sensor GYRO (Initial Delivery) Get Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGyroZExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroZExtl
+* ABSTRACT : Vehicle Sensor GYRO_Z Initialization Functions(Initial delivery)
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroZExtl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroZExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstGyroZExt_l.ul_did = POSHAL_DID_GYRO_Z;
+ gstGyroZExt_l.us_size = VEHICLE_DSIZE_GYRO_EXT_INIT;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroZExt_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO, VEHICLE_DSIZE_GYRO_EXT);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroZExtlG
+* ABSTRACT : Vehicle Sensor GYRO_Z SET Functions(Initial delivery)
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+void VehicleSensSetGyroZExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGyroZExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[GyroZ];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GyroZ] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GYRO_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZExtl
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions(Initial delivery)
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGyroZExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GyroZ];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GyroZ] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GyroZ] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif // CONFIG_SENSOR_EXT_VALID
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZFst_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZFst_l.cpp
new file mode 100755
index 0000000..587f565
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZFst_l.cpp
@@ -0,0 +1,169 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroZFst_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_Z_FST)
+ * Module configuration :VehicleSensInitGyroZFstl() Vehicle sensor GYRO (initial sensor) initialization functions
+ * :VehicleSensSetGyroZFstl() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensSetGyroZFstG() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensGetGyroZFstl() Vehicle sensor GYRO (initial sensor) GET-function
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST gstGyroZFst_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroZFstl
+* ABSTRACT : Vehicle Sensor GYRO_Z Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroZFstl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroZFst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ gstGyroZFst_l.ul_did = POSHAL_DID_GYRO_Z_FST;
+ gstGyroZFst_l.us_size = 0;
+ gstGyroZFst_l.partition_flg = 0;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroZFst_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO_Z, VEHICLE_DSIZE_GYRO_Z_FST);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroZFstl
+* ABSTRACT : Vehicle Sensor GYRO_Z SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroZFstl(const LSDRV_LSDATA_FST *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroZFst_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->partition_flg = 0;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroZFstG
+* ABSTRACT : Vehicle Sensor GYRO_Z SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroZFstG(const LSDRV_LSDATA_FST_GYRO_Z *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ pst_master = &gstGyroZFst_l;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_Z_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_Z_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZFstl
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroZFst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ_l.cpp
new file mode 100755
index 0000000..8296dab
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ_l.cpp
@@ -0,0 +1,126 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroZ_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_Z)
+ * Module configuration :VehicleSensInitGyroZl() Vehicle Sensor GYRO Initialization Functions
+ * :VehicleSensSetGyroZl() Vehicle Sensor GYRO SET Functions
+ * :VehicleSensGetGyroZl() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGyroZ_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroZl
+* ABSTRACT : Vehicle Sensor GYRO_Z Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroZl(void) {
+ memset(&gstGyroZ_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGyroZ_l.ul_did = POSHAL_DID_GYRO_Z;
+ gstGyroZ_l.us_size = VEHICLE_DSIZE_GYRO_Z;
+ gstGyroZ_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroZl
+* ABSTRACT : Vehicle Sensor GYRO_Z SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroZl(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroZ_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)pst_data->uc_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroZlG
+* ABSTRACT : Vehicle Sensor GYRO_Z SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroZlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroZ_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZl
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroZ_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude.cpp
new file mode 100755
index 0000000..167fa0a
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude.cpp
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_LocationAltitude.cpp
+@detail Altitude information data master management
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+
+/****************************************************************************
+@brief VehicleSensGetLocationAltitude<BR>
+ Altitude Information Data Master GET Processing
+@outline Provide an altitude information data master
+@param[in] u_int8 uc_get_method : Acquisition method(GPS or Navi)
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetLocationAltitude(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:no other parameter pass in
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetLocationAltitudeG(pst_data);
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_NAVI:
+ {
+ /** To acquire from NAVI */
+ VehicleSensGetLocationAltitudeN(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_g.cpp
new file mode 100755
index 0000000..cae429c
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_g.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_LocationAltitude_g.cpp
+@detail Altitude information data master management(NMEA information)
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+static VEHICLESENS_DATA_MASTER gstLocationAltitude_g; // NOLINT(readability/nolint)
+
+/****************************************************************************
+@brief VehicleSensInitLocationAltitudeG<BR>
+ Altitude information data master initialization processing(NMEA information)
+@outline Initialize the altitude information data master
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensInitLocationAltitudeG(void) {
+ SENSORLOCATION_ALTITUDEINFO_DAT st_altitude;
+
+ memset(&gstLocationAltitude_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstLocationAltitude_g.ul_did = VEHICLE_DID_LOCATION_ALTITUDE;
+ /** Data size setting */
+ gstLocationAltitude_g.us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
+ /** Data content setting */
+ memset(&st_altitude, 0x00, sizeof(st_altitude));
+ st_altitude.getMethod = SENSOR_GET_METHOD_GPS;
+ st_altitude.SyncCnt = 0x00;
+ st_altitude.isEnable = SENSORLOCATION_STATUS_DISABLE;
+ memcpy(&gstLocationAltitude_g.uc_data[0], &st_altitude, sizeof(st_altitude));
+}
+
+/****************************************************************************
+@brief VehicleSensSetLocationAltitudeG<BR>
+ Altitude information data master SET processing(NMEA information)
+@outline Update the altitude information data master
+@param[in] u_int8 ucSensCnt : Sensor counter value
+@param[in] u_int8* pucDGGA : Double precision GGAInformation(_CWORD82_ NMEA)
+@param[out] none
+@return u_int8
+@retval VEHICLESENS_EQ : No data change
+@retval VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetLocationAltitudeG(const SENSORLOCATION_ALTITUDEINFO_DAT *pst_altitude) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationAltitude_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_LOCATION_ALTITUDE;
+ pst_master->us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+
+ return(uc_ret);
+}
+
+/****************************************************************************
+@brief VehicleSensGetLocationAltitudeG<BR>
+ Altitude Information Data Master GET Processing(NMEA information)
+@outline Provide an altitude information data master
+@param[in] none
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetLocationAltitudeG(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationAltitude_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_n.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_n.cpp
new file mode 100755
index 0000000..1d6064f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_n.cpp
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_LocationAltitude_n.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "SensorLocation_API.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstLocationAltitude_n; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Altitude information data master initialization processing(NAVI information)
+ *
+ * Initialize the altitude information data master
+ *
+ * @param[in] none
+ * @param[out] none
+ * @return none
+ * @retval none
+ */
+void VehicleSensInitLocationAltitudeN(void) {
+ SENSORLOCATION_ALTITUDEINFO_DAT st_altitude;
+
+ memset(&gstLocationAltitude_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstLocationAltitude_n.ul_did = VEHICLE_DID_LOCATION_ALTITUDE_NAVI;
+
+ /** Data size setting */
+ gstLocationAltitude_n.us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
+
+ /** Data content setting */
+ memset(&st_altitude, 0x00, sizeof(st_altitude));
+ st_altitude.getMethod = SENSOR_GET_METHOD_NAVI;
+ st_altitude.SyncCnt = 0x00;
+ st_altitude.isEnable = SENSORLOCATION_STATUS_DISABLE;
+ st_altitude.Altitude = 0x00;
+ memcpy(&gstLocationAltitude_n.uc_data[0], &st_altitude, sizeof(st_altitude));
+
+ return;
+}
+
+/**
+ * @brief
+ * Altitude information data master SET processing(NAVI information)
+ *
+ * Update the altitude information data master
+ *
+ * @param[in] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @param[out] none
+ * @return u_int8
+ * @retval VEHICLESENS_EQ : No data change
+ * @retval VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetLocationAltitudeN(const SENSORLOCATION_ALTITUDEINFO_DAT *pst_altitude) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationAltitude_n;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_LOCATION_ALTITUDE_NAVI;
+ pst_master->us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Altitude Information Data Master GET Processing(NAVI information)
+ *
+ * Provide an altitude information data master
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetLocationAltitudeN(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationAltitude_n;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea.cpp
new file mode 100755
index 0000000..496e5ac
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea.cpp
@@ -0,0 +1,50 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**************************************************************************//**
+@file VehicleSens_Did_LocationInfoNmea.cpp
+@detail Location Information (NMEA) Management of information data master
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+
+/**************************************************************************//**
+@brief VehicleSens_GetLocationInfoNmea<BR>
+ Location Information (NMEA) Information Data Master GET Processing
+@outline Location Information (NMEA) Provide an information data master
+@param[in] u_int8 ucGetMethod : Acquisition method(GPS or Navi)
+@param[out] VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstData : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSens_GetLocationInfoNmea(VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstData, u_int8 ucGetMethod)
+{
+ switch(ucGetMethod)
+ {
+ case VEHICLESENS_GETMETHOD_NAVI:
+ {
+ VehicleSens_GetLocationInfoNmea_n(pstData);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea_n.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea_n.cpp
new file mode 100755
index 0000000..048e522
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea_n.cpp
@@ -0,0 +1,118 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_LocationInfoNmea_n.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "SensorLocation_API.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstLocationInfoNmea_n;
+
+/**
+ * @brief
+ * Location Information (NMEA) Initialization of information data master(NAVI information)
+ *
+ * Location Information (NMEA) Initialize the information data master
+ *
+ * @param[in] none
+ * @param[out] none
+ * @return none
+ */
+void VehicleSens_InitLocationInfoNmea_n(void)
+{
+ POS_LOCATIONINFO_NMEA stLocInfoNmea;
+
+ _pb_memset(&gstLocationInfoNmea_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+
+ /* Set Data ID */
+ gstLocationInfoNmea_n.ul_did = VEHICLE_DID_LOCATIONINFO_NMEA_NAVI;
+
+ /* Set Data Size */
+ gstLocationInfoNmea_n.us_size = sizeof(POS_LOCATIONINFO_NMEA);
+
+ /** Set Data itself */
+ _pb_memset(&stLocInfoNmea, 0x00, sizeof(stLocInfoNmea));
+ _pb_memcpy(&gstLocationInfoNmea_n.uc_data[0], &stLocInfoNmea, sizeof(stLocInfoNmea));
+
+ return;
+}
+
+/**
+ * @brief
+ * Location Information (NMEA) Information data master SET process(NAVI information)
+ *
+ * Location Information (NMEA) Update the information data master
+ *
+ * @param[in] VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstData : Pointer to the data master acquisition destination
+ * @param[out] none
+ * @return u_int8
+ * @retval VEHICLESENS_EQ : No data change
+ * @retval VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSens_SetLocationInfoNmea_n( const POS_LOCATIONINFO_NMEA *pstLocInfoNmea )
+{
+ u_int8 ucRet;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstMaster;
+
+ pstMaster = &gstLocationInfoNmea_n;
+
+ /* Compare Received Data with Master Data */
+ ucRet = VehicleSensmemcmp( pstMaster->uc_data, pstLocInfoNmea, sizeof(POS_LOCATIONINFO_NMEA) );
+
+ /* Set Received Data as Master Data */
+ pstMaster->ul_did = VEHICLE_DID_LOCATIONINFO_NMEA_NAVI;
+ pstMaster->us_size = sizeof(POS_LOCATIONINFO_NMEA);
+ pstMaster->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ _pb_memcpy(pstMaster->uc_data, pstLocInfoNmea, sizeof(POS_LOCATIONINFO_NMEA));
+
+ return ucRet;
+}
+
+/**
+ * @brief
+ * Location Information (NMEA) Information Data Master GET Processing(NAVI information)
+ *
+ * Location Information (NMEA) Provide an information data master
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstData : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSens_GetLocationInfoNmea_n(VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstData)
+{
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstMaster;
+
+ pstMaster = &gstLocationInfoNmea_n;
+
+ /* Set Master Data to Indicated Region */
+ pstData->ul_did = pstMaster->ul_did;
+ pstData->us_size = pstMaster->us_size;
+ pstData->uc_rcvflag = pstMaster->uc_rcvflag;
+ _pb_memcpy(pstData->uc_data, pstMaster->uc_data, pstMaster->us_size);
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat.cpp
new file mode 100755
index 0000000..1ae1b59
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat.cpp
@@ -0,0 +1,56 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_LocationLonLat.cpp
+@detail Latitude and longitudeManagement of information data master
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+
+/****************************************************************************
+@brief VehicleSensGetLocationLonLat<BR>
+ Latitude and longitudeInformation Data Master GET Processing
+@outline Latitude and longitudeProvide an information data master
+@param[in] u_int8 uc_get_method : Acquisition method(GPS or Navi)
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetLocationLonLat(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:other parameters cannot pass in
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetLocationLonLatG(pst_data);
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_NAVI:
+ {
+ /** To acquire from NAVI */
+ VehicleSensGetLocationLonLatnUnitCnv(pst_data);
+ break;
+ }
+
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_g.cpp
new file mode 100755
index 0000000..07075c0
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_LocationLonLat_g.cpp
+@detail Latitude and longitudeManagement of information data master(NMEA information)
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+static VEHICLESENS_DATA_MASTER gstLocationLonLat_g; // NOLINT(readability/nolint)
+
+/****************************************************************************
+@brief VehicleSensInitLocationLonLatG<BR>
+ Latitude and longitudeInitialization of information data master(NMEA information)
+@outline Latitude and longitudeInitialize the information data master
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensInitLocationLonLatG(void) {
+ SENSORLOCATION_LONLATINFO_DAT st_lonlat;
+
+ memset(&gstLocationLonLat_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstLocationLonLat_g.ul_did = VEHICLE_DID_LOCATION_LONLAT;
+ /** Data size setting */
+ gstLocationLonLat_g.us_size = sizeof(SENSORLOCATION_LONLATINFO_DAT);
+ /** Data content setting */
+ memset(&st_lonlat, 0x00, sizeof(st_lonlat));
+ st_lonlat.getMethod = SENSOR_GET_METHOD_GPS;
+ st_lonlat.SyncCnt = 0x00;
+ st_lonlat.isEnable = SENSORLOCATION_STATUS_DISABLE;
+ memcpy(&gstLocationLonLat_g.uc_data[0], &st_lonlat, sizeof(st_lonlat));
+}
+
+/****************************************************************************
+@brief VehicleSensSetLocationLonLatG<BR>
+ Latitude and longitudeInformation data master SET process(NMEA information)
+@outline Latitude and longitudeUpdate the information data master
+@param[in] SENSORLOCATION_LONLATINFO_DAT * pst_lonlat : Latitude and longitude information
+@param[out] none
+@return u_int8
+@retval VEHICLESENS_EQ : No data change
+@retval VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetLocationLonLatG(const SENSORLOCATION_LONLATINFO_DAT *pst_lonlat) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationLonLat_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_lonlat, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_LOCATION_LONLAT;
+ pst_master->us_size = sizeof(SENSORLOCATION_LONLATINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_lonlat, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+
+ return(uc_ret);
+}
+
+/****************************************************************************
+@brief VehicleSensGetLocationLonLatG<BR>
+ Latitude and longitudeInformation Data Master GET Processing(NMEA information)
+@outline Latitude and longitudeProvide an information data master
+@param[in] none
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetLocationLonLatG(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationLonLat_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_n.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_n.cpp
new file mode 100755
index 0000000..dcaecff
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_n.cpp
@@ -0,0 +1,163 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_LocationLonLat_n.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "SensorLocation_API.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstLocationLonLat_n; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Latitude and longitudeInitialization of information data master(NAVI information)
+ *
+ * Latitude and longitudeInitialize the information data master
+ *
+ * @param[in] none
+ * @param[out] none
+ * @return none
+ * @retval none
+ */
+void VehicleSensInitLocationLonLatN(void) {
+ SENSORLOCATION_LONLATINFO_DAT st_lonlat;
+
+ memset(&gstLocationLonLat_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstLocationLonLat_n.ul_did = VEHICLE_DID_LOCATION_LONLAT_NAVI;
+
+ /** Data size setting */
+ gstLocationLonLat_n.us_size = sizeof(SENSORLOCATION_LONLATINFO_DAT);
+
+ /** Data content setting */
+ memset(&st_lonlat, 0x00, sizeof(st_lonlat));
+ st_lonlat.getMethod = SENSOR_GET_METHOD_NAVI;
+ st_lonlat.SyncCnt = 0x00;
+ st_lonlat.isEnable = SENSORLOCATION_STATUS_DISABLE;
+ st_lonlat.posSts = 0x00;
+ st_lonlat.posAcc = 0x00;
+ st_lonlat.Longitude = 0x00;
+ st_lonlat.Latitude = 0x00;
+ memcpy(&gstLocationLonLat_n.uc_data[0], &st_lonlat, sizeof(st_lonlat));
+
+ return;
+}
+
+/**
+ * @brief
+ * Latitude and longitudeInformation data master SET process(NAVI information)
+ *
+ * Latitude and longitudeUpdate the information data master
+ *
+ * @param[in] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @param[out] none
+ * @return u_int8
+ * @retval VEHICLESENS_EQ : No data change
+ * @retval VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetLocationLonLatN(const SENSORLOCATION_LONLATINFO_DAT *pst_lonlat) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationLonLat_n;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_lonlat, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_LOCATION_LONLAT_NAVI;
+ pst_master->us_size = sizeof(SENSORLOCATION_LONLATINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_lonlat, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Latitude and longitudeInformation Data Master GET Processing(NAVI information)
+ *
+ * Latitude and longitudeProvide an information data master
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetLocationLonLatN(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationLonLat_n;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
+
+/**
+ * @brief
+ * Latitude and longitudeInformation Data Master GET Processing(NAVI information)
+ *
+ * Latitude and longitudeProvide an information data master(Unit:10^-7th degree)
+ *
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ */
+void VehicleSensGetLocationLonLatnUnitCnv(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+ SENSORLOCATION_LONLATINFO_DAT st_lonlat;
+ int32_t l_lon;
+ int32_t l_lat;
+ int64_t ll_tmp;
+
+ pst_master = &gstLocationLonLat_n;
+
+ /* Perform unit conversion[1/128Second] -> [10^-7 degree] */
+ memcpy(&st_lonlat, pst_master->uc_data, sizeof(st_lonlat));
+
+ /* Longitude */
+ l_lon = st_lonlat.Longitude;
+ ll_tmp = (int64_t)l_lon * 10000000;
+ st_lonlat.Longitude = (int32_t)(ll_tmp / (128 * 60 * 60));
+
+ /* Latitude */
+ l_lat = st_lonlat.Latitude;
+ ll_tmp = (int64_t)l_lat * 10000000;
+ st_lonlat.Latitude = (int32_t)(ll_tmp / (128 * 60 * 60));
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, &st_lonlat, sizeof(st_lonlat));
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MainGpsInterruptSignal.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MainGpsInterruptSignal.cpp
new file mode 100755
index 0000000..7066324
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MainGpsInterruptSignal.cpp
@@ -0,0 +1,132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_MainGpsInterruptSignal.cpp
+ * System name :PastModel002
+ * Subsystem name :GPS process
+ * Program name :MAIN GPS interrupt data master(VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL)
+ * Module configuration :VehicleSensInitMainGpsInterruptSignal() Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL initialization function
+ * :VehicleSensSetMainGpsInterruptSignal() Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL SET function
+ * :VehicleSensGetMainGpsInterruptSignal() Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#define VEHICLE_SENS_DID_MAIN_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY 0
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL gstMainGpsInterruptSignal; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitMainGpsInterruptSignal
+* ABSTRACT : Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL initialization function
+* FUNCTION : MAIN_GPS_INTERRUPT_SIGNAL data master initialization processing
+* ARGUMENT : None
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensInitMainGpsInterruptSignal(void) {
+ (void)memset(reinterpret_cast<void *>(&(gstMainGpsInterruptSignal)),
+ static_cast<int>(0x00), sizeof(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL));
+ gstMainGpsInterruptSignal.ul_did = VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL;
+ gstMainGpsInterruptSignal.us_size = VEHICLE_DSIZE_MAIN_GPS_INTERRUPT_SIGNAL;
+ gstMainGpsInterruptSignal.uc_data = VEHICLE_DINIT_MAIN_GPS_INTERRUPT_SIGNAL;
+
+#if VEHICLE_SENS_DID_MAIN_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstMainGpsInterruptSignal.uc_data.uc_data == 0x%x\r\n", gstMainGpsInterruptSignal.uc_data);
+#endif
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetMainGpsInterruptSignal
+* ABSTRACT : Vehicle sensor MAIN_GPS_INTERRUPT_SIGNALE SET function
+* FUNCTION : Update the Main_GPS_INTERRUPT_SIGNAL data master
+* ARGUMENT : *pst_data : Pointer to received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetMainGpsInterruptSignal(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstMainGpsInterruptSignal;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), (size_t)(pst_data->us_size));
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
+
+#if VEHICLE_SENS_DID_MAIN_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] pst_data->ul_did == 0x%x", pst_data->ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstMainGpsInterruptSignal.ul_did == 0x%x\r\n", gstMainGpsInterruptSignal.ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] (u_int8)pst_data->us_size == 0x%x", (u_int8)pst_data->us_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstMainGpsInterruptSignal.us_size == 0x%x\r\n", gstMainGpsInterruptSignal.us_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] pst_data->uc_data == 0x%x", pst_data->uc_data[0]);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstMainGpsInterruptSignal.uc_data == 0x%x\r\n", gstMainGpsInterruptSignal.uc_data);
+#endif
+ }
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetMainGpsInterruptSignal
+* ABSTRACT : Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL GET function
+* FUNCTION : Provide the MAIN_GPS_INTERRUPT_SIGNAL data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensGetMainGpsInterruptSignal(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstMainGpsInterruptSignal;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
+ (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Mon_Hw_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Mon_Hw_g.cpp
new file mode 100755
index 0000000..1859f76
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Mon_Hw_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Mon_Hw_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_MON_HW)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstMonHw_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief MON-HW vehicle sensor initialization function
+@outline MON-HW initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitMonHwG(void) {
+ memset(&gstMonHw_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstMonHw_g.ul_did = VEHICLE_DID_GPS_UBLOX_MON_HW;
+ gstMonHw_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_MON_HW + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstMonHw_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_MON_HW;
+}
+
+/***************************************************************************
+@brief MON-HW SET vehicle sensor function
+@outline To update the master data MON-HW.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetMonHwG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstMonHw_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function MON-HW GET
+@outline Master Data provides the MON-HW
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetMonHwG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstMonHw_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading.cpp
new file mode 100755
index 0000000..67a218e
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading.cpp
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_MotionHeading.cpp
+@detail Orientation Information Data Master Management
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+
+/****************************************************************************
+@brief VehicleSensGetMotionHeading<BR>
+ Compass Data Master GET Processing
+@outline Provide an orientation information data master
+@param[in] u_int8 uc_get_method : Acquisition method(GPS or Navi)
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetMotionHeading(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:other parameters cannot pass in
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetMotionHeadingG(pst_data);
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_NAVI:
+ {
+ /** To acquire from NAVI */
+ VehicleSensGetMotionHeadingnCnvData(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_g.cpp
new file mode 100755
index 0000000..751b199
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_g.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_MotionHeading_g.cpp
+@detail Orientation Information Data Master Management(NMEA information)
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+static VEHICLESENS_DATA_MASTER gstMotionHeading_g; // NOLINT(readability/nolint)
+
+/****************************************************************************
+@brief VehicleSensInitMotionHeadingG<BR>
+ Orientation information data master initialization process(NMEA information)
+@outline Initialize the orientation information data master
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensInitMotionHeadingG(void) {
+ SENSORMOTION_HEADINGINFO_DAT st_heading;
+
+ memset(&gstMotionHeading_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstMotionHeading_g.ul_did = VEHICLE_DID_MOTION_HEADING;
+ /** Data size setting */
+ gstMotionHeading_g.us_size = sizeof(SENSORMOTION_HEADINGINFO_DAT);
+ /** Data content setting */
+ memset(&st_heading, 0x00, sizeof(st_heading));
+ st_heading.getMethod = SENSOR_GET_METHOD_GPS;
+ st_heading.SyncCnt = 0x00;
+ st_heading.isEnable = SENSORMOTION_STATUS_DISABLE;
+ memcpy(&gstMotionHeading_g.uc_data[0], &st_heading, sizeof(st_heading));
+}
+
+/****************************************************************************
+@brief VehicleSensSetMotionHeadingG<BR>
+ Compass Data Master SET Processing(NMEA information)
+@outline Update the orientation information data master
+@param[in] SENSORMOTION_HEADINGINFO_DAT* pst_heading : Bearing information
+@param[out] none
+@return u_int8
+@retval VEHICLESENS_EQ : No data change
+@retval VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetMotionHeadingG(const SENSORMOTION_HEADINGINFO_DAT *pst_heading) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionHeading_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_heading,
+ sizeof(SENSORMOTION_HEADINGINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_MOTION_HEADING;
+ pst_master->us_size = sizeof(SENSORMOTION_HEADINGINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_heading, sizeof(SENSORMOTION_HEADINGINFO_DAT));
+
+ return(uc_ret);
+}
+
+/****************************************************************************
+@brief VehicleSensGetMotionHeadingG<BR>
+ Compass Data Master GET Processing(NMEA information)
+@outline Provide an orientation information data master
+@param[in] none
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetMotionHeadingG(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionHeading_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_n.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_n.cpp
new file mode 100755
index 0000000..4475b24
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_n.cpp
@@ -0,0 +1,162 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_MotionHeading_n.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "SensorMotion_API.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstMotionHeading_n; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Orientation information data master initialization process(NAVI information)
+ *
+ * Initialize the orientation information data master
+ *
+ * @param[in] none
+ * @param[out] none
+ * @return none
+ * @retval none
+ */
+void VehicleSensInitMotionHeadingN(void) {
+ SENSORMOTION_HEADINGINFO_DAT st_heading;
+
+ memset(&gstMotionHeading_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstMotionHeading_n.ul_did = VEHICLE_DID_MOTION_HEADING_NAVI;
+
+ /** Data size setting */
+ gstMotionHeading_n.us_size = sizeof(SENSORMOTION_HEADINGINFO_DAT);
+
+ /** Data content setting */
+ memset(&st_heading, 0x00, sizeof(st_heading));
+ st_heading.getMethod = SENSOR_GET_METHOD_NAVI;
+ st_heading.SyncCnt = 0x00;
+ st_heading.isEnable = SENSORMOTION_STATUS_DISABLE;
+ st_heading.posSts = 0x00;
+ st_heading.Heading = 0x00;
+ memcpy(&gstMotionHeading_n.uc_data[0], &st_heading, sizeof(st_heading));
+
+ return;
+}
+
+/**
+ * @brief
+ * Compass Data Master SET Processing(NAVI information)
+ *
+ * Update the orientation information data master
+ *
+ * @param[in] VEHICLESENS_DATA_MASTER *pst_heading : Pointer to the data master acquisition destination
+ * @param[out] none
+ * @return u_int8
+ * @retval VEHICLESENS_EQ : No data change
+ * @retval VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetMotionHeadingN(const SENSORMOTION_HEADINGINFO_DAT *pst_heading) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionHeading_n;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_heading, sizeof(SENSORMOTION_HEADINGINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_MOTION_HEADING_NAVI;
+ pst_master->us_size = sizeof(SENSORMOTION_HEADINGINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_heading, sizeof(SENSORMOTION_HEADINGINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Compass Data Master GET Processing(NAVI information)
+ *
+ * Provide an orientation information data master
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetMotionHeadingN(VEHICLESENS_DATA_MASTER *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionHeading_n;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Compass Data Master GET Processing(NAVI information)
+ *
+ * Providing orientation information data master with orientation and unit conversion
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetMotionHeadingnCnvData(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+ SENSORMOTION_HEADINGINFO_DAT st_heading;
+ int16 i_heading;
+
+ pst_master = &gstMotionHeading_n;
+
+ /* Perform the orientation conversion[-179 to +180] -> [0 to 359] */
+ memcpy(&st_heading, pst_master->uc_data, sizeof(st_heading));
+ i_heading = static_cast<int16>(st_heading.Heading);
+ if (i_heading > 0) {
+ i_heading = static_cast<int16>(360 - i_heading);
+ } else {
+ i_heading = static_cast<int16>(i_heading * -1);
+ }
+ /* Perform unit conversion[Once] -> [0.01 degree] */
+ st_heading.Heading = (u_int16)(i_heading * 100);
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, &st_heading, sizeof(st_heading));
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed.cpp
new file mode 100755
index 0000000..0f7abe3
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed.cpp
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_MotionSpeed.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Speed information data master GET processing
+ *
+ * @param[out] *pst_data - VEHICLESENS_DATA_MASTER Pointer to the data master acquisition destination
+ * @param[in] uc_get_method - u_int8 acquisition method
+ */
+void VehicleSensGetMotionSpeed(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:other parameters cannot pass in
+ case VEHICLESENS_GETMETHOD_INTERNAL:
+ {
+ /** When acquiring internal calculation data */
+ VehicleSensGetMotionSpeedI(pst_data);
+ }
+ break;
+ case VEHICLESENS_GETMETHOD_NAVI:
+ {
+ /** To acquire NAVI data */
+ VehicleSensGetMotionSpeedN(pst_data);
+ break;
+ }
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_g.cpp
new file mode 100755
index 0000000..9b8ae6c
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_g.cpp
@@ -0,0 +1,107 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_MotionSpeed_g.cpp
+ * @brief
+ * Vehicle Speed Information Data Master Management(NMEA information)
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstMotionSpeed_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Speed information data master initialization process(NMEA information)
+ */
+void VehicleSensInitMotionSpeedG(void) {
+ SENSORMOTION_SPEEDINFO_DAT st_speed;
+
+ memset(&gstMotionSpeed_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstMotionSpeed_g.ul_did = VEHICLE_DID_MOTION_SPEED;
+ /** Data size setting */
+ gstMotionSpeed_g.us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ /** Data content setting */
+ memset(&st_speed, 0x00, sizeof(st_speed));
+ st_speed.getMethod = SENSOR_GET_METHOD_GPS;
+ st_speed.SyncCnt = 0x00;
+ st_speed.isEnable = SENSORMOTION_STATUS_DISABLE;
+ memcpy(&gstMotionSpeed_g.uc_data[0], &st_speed, sizeof(st_speed));
+}
+
+/**
+ * @brief
+ * Rate information data master SET process(NMEA information)
+ *
+ * @param[in] *pst_speed - SENSORMOTION_SPEEDINFO_DAT Pointer to vehicle speed information
+ *
+ * @return VEHICLESENS_EQ : No data change<br>
+ * VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetMotionSpeedG(const SENSORMOTION_SPEEDINFO_DAT *pst_speed) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_MOTION_SPEED;
+ pst_master->us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Speed information data master GET processing(NMEA information)
+ *
+ * @param[out] *pst_speed - VEHICLESENS_DATA_MASTER Pointer to the data master acquisition destination
+ */
+void VehicleSensGetMotionSpeedG(VEHICLESENS_DATA_MASTER *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_i.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_i.cpp
new file mode 100755
index 0000000..7f01e2f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_i.cpp
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_MotionSpeed_i.cpp
+ * @brief
+ * Vehicle Speed Information Data Master Management(Internal calculation information)
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstMotionSpeed_i; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Speed information data master initialization process(Internal calculation information)
+ */
+void VehicleSensInitMotionSpeedI(void) {
+ SENSORMOTION_SPEEDINFO_DAT st_speed;
+
+ memset(&gstMotionSpeed_i, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstMotionSpeed_i.ul_did = VEHICLE_DID_MOTION_SPEED_INTERNAL;
+ /** Data size setting */
+ gstMotionSpeed_i.us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ /** Data content setting */
+ memset(&st_speed, 0x00, sizeof(st_speed));
+ st_speed.getMethod = SENSOR_GET_METHOD_POS;
+ st_speed.SyncCnt = 0x00;
+ st_speed.isEnable = SENSORMOTION_STATUS_DISABLE;
+ memcpy(&gstMotionSpeed_i.uc_data[0], &st_speed, sizeof(st_speed));
+}
+
+/**
+ * @brief
+ * Rate information data master SET process(Internal calculation information)
+ *
+ * @param[in] *pst_speed - SENSORMOTION_SPEEDINFO_DAT Pointer to vehicle speed information
+ *
+ * @return VEHICLESENS_EQ : No data change<br>
+ * VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetMotionSpeedI(const SENSORMOTION_SPEEDINFO_DAT *pst_speed) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_i;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_MOTION_SPEED_INTERNAL;
+ pst_master->us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Speed information data master GET processing(Internal calculation information)
+ *
+ * @param[out] *pst_speed - VEHICLESENS_DATA_MASTER Pointer to the data master acquisition destination
+ */
+void VehicleSensGetMotionSpeedI(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_i;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_n.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_n.cpp
new file mode 100755
index 0000000..9c8f5bc
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_n.cpp
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_MotionSpeed_n.cpp
+ * @brief
+ * Vehicle Speed Information Data Master Management(Navi information)
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstMotionSpeed_n; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Speed information data master initialization process(Navi information)
+ */
+void VehicleSensInitMotionSpeedN(void) {
+ SENSORMOTION_SPEEDINFO_DAT st_speed;
+
+ memset(&gstMotionSpeed_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstMotionSpeed_n.ul_did = VEHICLE_DID_MOTION_SPEED_NAVI;
+ /** Data size setting */
+ gstMotionSpeed_n.us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ /** Data content setting */
+ memset(&st_speed, 0x00, sizeof(st_speed));
+ st_speed.getMethod = SENSOR_GET_METHOD_NAVI;
+ st_speed.SyncCnt = 0x00;
+ st_speed.isEnable = SENSORMOTION_STATUS_DISABLE;
+ memcpy(&gstMotionSpeed_n.uc_data[0], &st_speed, sizeof(st_speed));
+}
+
+/**
+ * @brief
+ * Rate information data master SET process(Navi information)
+ *
+ * @param[in] *pst_speed - SENSORMOTION_SPEEDINFO_DAT Pointer to vehicle speed information
+ *
+ * @return VEHICLESENS_EQ : No data change<br>
+ * VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetMotionSpeedN(const SENSORMOTION_SPEEDINFO_DAT *pst_speed) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_n;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_MOTION_SPEED_NAVI;
+ pst_master->us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Speed information data master GET processing(Navi information)
+ *
+ * @param[out] *pst_speed - VEHICLESENS_DATA_MASTER Pointer to the data master acquisition destination
+ */
+void VehicleSensGetMotionSpeedN(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_n;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Clock_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Clock_g.cpp
new file mode 100755
index 0000000..a9bc0c9
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Clock_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Clock_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_CLOCK)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavClock_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-CLOCK vehicle sensor initialization function
+@outline NAV-CLOCK initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavClockG(void) {
+ memset(&gstNavClock_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavClock_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_CLOCK;
+ gstNavClock_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_CLOCK + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavClock_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_CLOCK;
+}
+
+/***************************************************************************
+@brief NAV-CLOCK SET vehicle sensor function
+@outline To update the master data NAV-CLOCK.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavClockG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavClock_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-CLOCK GET
+@outline Master Data provides the NAV-CLOCK
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavClockG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavClock_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Dop_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Dop_g.cpp
new file mode 100755
index 0000000..211e940
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Dop_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Dop_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_DOP)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavDop_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-DOP vehicle sensor initialization function
+@outline NAV-DOP initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavDopG(void) {
+ memset(&gstNavDop_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavDop_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_DOP;
+ gstNavDop_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_DOP + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavDop_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_DOP;
+}
+
+/***************************************************************************
+@brief NAV-DOP SET vehicle sensor function
+@outline To update the master data NAV-DOP.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavDopG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavDop_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-DOP GET
+@outline Master Data provides the NAV-DOP
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavDopG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavDop_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Posllh_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Posllh_g.cpp
new file mode 100755
index 0000000..17ebc04
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Posllh_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Posllh_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_POSLLH)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavPosllh_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-POSLLH vehicle sensor initialization function
+@outline NAV-POSLLH initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavPosllhG(void) {
+ memset(&gstNavPosllh_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavPosllh_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_POSLLH;
+ gstNavPosllh_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_POSLLH + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavPosllh_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_POSLLH;
+}
+
+/***************************************************************************
+@brief NAV-POSLLH SET vehicle sensor function
+@outline To update the master data NAV-POSLLH.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavPosllhG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavPosllh_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-POSLLH GET
+@outline Master Data provides the NAV-POSLLH
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavPosllhG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavPosllh_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Status_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Status_g.cpp
new file mode 100755
index 0000000..f03d48f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Status_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Status_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_STATUS)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavStatus_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-STATUS vehicle sensor initialization function
+@outline NAV-STATUS initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavStatusG(void) {
+ memset(&gstNavStatus_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavStatus_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_STATUS;
+ gstNavStatus_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_STATUS + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavStatus_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_STATUS;
+}
+
+/***************************************************************************
+@brief NAV-STATUS SET vehicle sensor function
+@outline To update the master data NAV-STATUS.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavStatusG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavStatus_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-STATUS GET
+@outline Master Data provides the NAV-STATUS
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavStatusG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavStatus_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_SvInfo_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_SvInfo_g.cpp
new file mode 100755
index 0000000..7211ce8
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_SvInfo_g.cpp
@@ -0,0 +1,108 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_SvInfo_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_SVINFO)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavSvInfo_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-SVINFO vehicle sensor initialization function
+@outline NAV-SVINFO initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavSvInfoG(void) {
+ memset(&gstNavSvInfo_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavSvInfo_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_SVINFO;
+ /* Initially, the maximum storage size is set.(Common header size(8) + NAV-SVINFO fixed-data-size(8) +
+ *(Maximum number of channels(16) + Size of single channel data(12))) */
+ gstNavSvInfo_g.us_size = (VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE + VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO) +
+ (VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO_CH_MAX * \
+ VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO_ALONE_MAX);
+ gstNavSvInfo_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_SVINFO;
+}
+
+/***************************************************************************
+@brief NAV-SVINFO SET vehicle sensor function
+@outline To update the master data NAV-SVINFO.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavSvInfoG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavSvInfo_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-SVINFO GET
+@outline Master Data provides the NAV-SVINFO
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavSvInfoG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavSvInfo_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeGps_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeGps_g.cpp
new file mode 100755
index 0000000..1d959cd
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeGps_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_TimeGps_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavTimeGps_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-TIMEGPS vehicle sensor initialization function
+@outline NAV-TIMEGPS initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavTimeGpsG(void) {
+ memset(&gstNavTimeGps_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavTimeGps_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS;
+ gstNavTimeGps_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_TIMEGPS + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavTimeGps_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_TIMEGPS;
+}
+
+/***************************************************************************
+@brief NAV-TIMEGPS SET vehicle sensor function
+@outline To update the master data NAV-TIMEGPS.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavTimeGpsG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavTimeGps_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-TIMEGPS GET
+@outline Master Data provides the NAV-TIMEGPS
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavTimeGpsG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavTimeGps_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeUtc_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeUtc_g.cpp
new file mode 100755
index 0000000..8368257
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeUtc_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_TimeUtc_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavTimeUtc_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-TIMEUTC vehicle sensor initialization function
+@outline NAV-TIMEUTC initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavTimeUtcG(void) {
+ memset(&gstNavTimeUtc_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavTimeUtc_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC;
+ gstNavTimeUtc_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_TIMEUTC + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavTimeUtc_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_TIMEUTC;
+}
+
+/***************************************************************************
+@brief NAV-TIMEUTC SET vehicle sensor function
+@outline To update the master data NAV-TIMEUTC.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavTimeUtcG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavTimeUtc_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-TIMEUTC GET
+@outline Master Data provides the NAV-TIMEUTC
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavTimeUtcG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavTimeUtc_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Velned_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Velned_g.cpp
new file mode 100755
index 0000000..ad757aa
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Velned_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Velned_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_VELNED)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavVelned_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-VELNED vehicle sensor initialization function
+@outline NAV-VELNED initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavVelnedG(void) {
+ memset(&gstNavVelned_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavVelned_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_VELNED;
+ gstNavVelned_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_VELNED + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavVelned_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_VELNED;
+}
+
+/***************************************************************************
+@brief NAV-VELNED SET vehicle sensor function
+@outline To update the master data NAV-VELNED.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : A pointer to the received data message or the direct line
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavVelnedG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavVelned_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-VELNED GET
+@outline Master Data provides the NAV-VELNED
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavVelnedG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavVelned_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_NaviinfoDiagGPS_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_NaviinfoDiagGPS_g.cpp
new file mode 100755
index 0000000..7335ce1
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_NaviinfoDiagGPS_g.cpp
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_NaviinfoDiagGPS_g.cpp
+@detail Management of GPS Information Master for Diag
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstNaviinfoDiagGPS_g; // NOLINT(readability/nolint)
+
+/****************************************************************************
+@brief VehicleSensInitNaviinfoDiagGPSg<BR>
+ Initialization of GPS Data Master for Diag
+@outline Initializing GPS Data Master for Diag
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensInitNaviinfoDiagGPSg(void) {
+ memset(&gstNaviinfoDiagGPS_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+
+ /** Data ID setting */
+ gstNaviinfoDiagGPS_g.ul_did = VEHICLE_DID_NAVIINFO_DIAG_GPS;
+ /** Data size setting */
+ gstNaviinfoDiagGPS_g.us_size = sizeof(NAVIINFO_DIAG_GPS);
+}
+
+/****************************************************************************
+@brief VehicleSensSetNaviinfoDiagGPSg<BR>
+ GPS Information Master SET Processing for Diag
+@outline Update the GPS Data Master for Diag
+@param[in] NAVIINFO_DIAG_GPS* pst_diag_data : GPS information for Diag
+@param[out] none
+@return u_int8
+@retval VEHICLESENS_EQ : No data change
+@retval VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetNaviinfoDiagGPSg(const NAVIINFO_DIAG_GPS *pst_diag_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstNaviinfoDiagGPS_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_diag_data, sizeof(NAVIINFO_DIAG_GPS));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_NAVIINFO_DIAG_GPS;
+ pst_master->us_size = sizeof(NAVIINFO_DIAG_GPS);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_diag_data, sizeof(NAVIINFO_DIAG_GPS));
+
+ return(uc_ret);
+}
+
+/****************************************************************************
+@brief VehicleSensGetNaviinfoDiagGPSg<BR>
+ GPS Information Master GET Processing for Diag
+@outline Provide a master GPS information for Diag
+@param[in] none
+@param[out] SENSOR_MSG_GPSDATA_DAT *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetNaviinfoDiagGPSg(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = reinterpret_cast<VEHICLESENS_DATA_MASTER_GPS_FORMAT*>(&gstNaviinfoDiagGPS_g);
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime.cpp
new file mode 100755
index 0000000..cb80e6f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime.cpp
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_PulseTime.cpp
+ * @brief
+ * Vehicle sensor data master(VEHICLE_DID_PULSE_TIME)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/**
+ * @brief
+ * Vehicle sensor pulse time GET function
+ *
+ * Provide interpulse time data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetPulseTime(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetPulseTimel(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/**
+ * @brief
+ * Vehicle sensor inter-pulse time (initial delivery) GET function
+ *
+ * Provide interpulse time data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetPulseTimeExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetPulseTimeExtl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/**
+ * @brief
+ * Vehicle sensor pulse time (initial sensor) GET function
+ *
+ * Provide interpulse time data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+
+void VehicleSensGetPulseTimeFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ break;
+ }
+ default:
+ break;
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTimeExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTimeExt_l.cpp
new file mode 100755
index 0000000..04e66b5
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTimeExt_l.cpp
@@ -0,0 +1,143 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_PulseTimeExt_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_PULSE_TIME)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER_EXT g_st_pulsetime_ext_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor inter-pulse time initialization function
+ *
+ * Inter-pulse time data master initialization processing
+ */
+void VehicleSensInitPulseTimeExtl(void) {
+ (void)memset(reinterpret_cast<void *>(&g_st_pulsetime_ext_l), 0, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ g_st_pulsetime_ext_l.ul_did = POSHAL_DID_PULSE_TIME;
+ g_st_pulsetime_ext_l.us_size = VEHICLE_DSIZE_PULSE_TIME_EXT_INIT;
+ g_st_pulsetime_ext_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor pulse time SET function
+ *
+ * Update the interpulse time data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+void VehicleSensSetPulseTimeExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_size = 0;
+ u_int16 us_start = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &g_st_pulsetime_ext_l;
+ /* 4byte * (Number of data items + 32 data items) */
+ us_size = static_cast<u_int16>(sizeof(u_int32) * (1 + VEHICLE_SNS_INFO_PULSE_NUM));
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[PulseTime];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[PulseTime] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_PULSE_TIME_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/**
+ * @brief
+ * Vehicle sensor pulse time GET function
+ *
+ * Provide interpulse time data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetPulseTimeExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &g_st_pulsetime_ext_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ /* Size of one data item: 4byte * (Number of data items + 32 data items) */
+ us_size = static_cast<u_int16>(sizeof(u_int32) * (1 + VEHICLE_SNS_INFO_PULSE_NUM));
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[PulseTime];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[PulseTime] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[PulseTime] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime_l.cpp
new file mode 100755
index 0000000..527bb72
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime_l.cpp
@@ -0,0 +1,93 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_PulseTime_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_PULSE_TIME)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstPulseTime_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor inter-pulse time initialization function
+ *
+ * Inter-pulse time data master initialization processing
+ */
+void VehicleSensInitPulseTimel(void) {
+ memset(&gstPulseTime_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstPulseTime_l.ul_did = POSHAL_DID_PULSE_TIME;
+ gstPulseTime_l.us_size = VEHICLE_DSIZE_PULSE_TIME;
+ gstPulseTime_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor inter-pulse time initialization function
+ *
+ * Update the interpulse time data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetPulseTimelG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstPulseTime_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle sensor pulse time GET function
+ *
+ * Provide interpulse time data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetPulseTimel(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstPulseTime_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev.cpp
new file mode 100755
index 0000000..08c5ec7
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev.cpp
@@ -0,0 +1,118 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_Rev.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_REV)
+ * Module configuration :VehicleSensGetRev() Vehicle Sensor REV GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetRev
+* ABSTRACT : Vehicle Sensor REV GET Functions
+* FUNCTION : Provide a REV data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetRev(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetRevl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetRevFst
+* ABSTRACT : Vehicle sensor GET function
+* FUNCTION : Provide a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetRevFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetRevFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+
+/**
+ * @brief
+ * Vehicle Sensor REV GET Functions
+ *
+ * Provide a REV data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ *
+ * @return none
+ */
+void VehicleSensGetRevExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetRevExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevExt_l.cpp
new file mode 100755
index 0000000..0f4e5e6
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevExt_l.cpp
@@ -0,0 +1,134 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_RevExt_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_REV)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT g_st_revext_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle Sensor REV Initialization Functions
+ *
+ * REV data master initialization processing
+ *
+ * @param[in] none
+ */
+void VehicleSensInitRevExtl(void) {
+ u_int16 *pus;
+
+ memset(&g_st_revext_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ g_st_revext_l.ul_did = POSHAL_DID_REV;
+ g_st_revext_l.us_size = VEHICLE_DSIZE_REV_EXT_INIT;
+ g_st_revext_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ pus = reinterpret_cast<u_int16 *>(g_st_revext_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_SNS_COUNTER, VEHICLE_DSIZE_REV_EXT);
+}
+
+/**
+ * @brief
+ * Vehicle Sensor REV SET Functions
+ *
+ * Update the REV data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ */
+void VehicleSensSetRevExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+
+ pst_master = &g_st_revext_l;
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[Rev];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_data[us_start] = pst_data->uc_data[0];
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[Rev] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_REV_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + sizeof(u_int8));
+ }
+}
+
+/**
+ * @brief
+ * Vehicle Sensor REV GET Functions
+ *
+ * Provide a REV data master
+ *
+ * @param[in] *pst_data : Pointer to the data master acquisition destination
+ */
+void VehicleSensGetRevExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &g_st_revext_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[Rev];
+ }
+
+ /* Acquire data from the newest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[Rev] + us_cnt < VEHICLE_DKEEP_MAX) {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[(gstPkgTempExt.start_point[Rev] + us_cnt)];
+ } else {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[us_loop_cnt];
+ us_loop_cnt++;
+ }
+ } else {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[us_cnt];
+ }
+ }
+}
+
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevFst_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevFst_l.cpp
new file mode 100755
index 0000000..49d4654
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevFst_l.cpp
@@ -0,0 +1,171 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_RevFst_l.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_REV_FST)
+ * Module configuration :VehicleSensInitRevFstl() Vehicle Sensor REV Initialization Functions
+ * :VehicleSensSetRevFstl() Vehicle Sensor REV SET Functions
+ * :VehicleSensSetRevFstG() Vehicle Sensor REV SET Functions
+ * :VehicleSensGetRevFstl() Vehicle Sensor REV GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST gstRevFst_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitRevFstl
+* ABSTRACT : Vehicle Sensor REV Initialization Functions
+* FUNCTION : REV data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitRevFstl(void) {
+ (void)memset(reinterpret_cast<void *>(&gstRevFst_l), 0, sizeof (VEHICLESENS_DATA_MASTER_FST));
+ gstRevFst_l.ul_did = POSHAL_DID_REV_FST;
+ gstRevFst_l.us_size = 0U;
+ gstRevFst_l.uc_rcvflag = 0U;
+ gstRevFst_l.partition_flg = 0;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetRevFstl
+* ABSTRACT : Vehicle Sensor REV SET Functions
+* FUNCTION : Update the REV data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetRevFstl(const LSDRV_LSDATA_FST *pst_data) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstRevFst_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetRevFstG
+* ABSTRACT : Vehicle Sensor REV SET Functions
+* FUNCTION : Update the REV data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetRevFstG(const LSDRV_LSDATA_FST_REV *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstRevFst_l;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_max == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (partition_num == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_num == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_REV_FST],
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_REV_FST],
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetRevFstl
+* ABSTRACT : Vehicle Sensor REV GET Functions
+* FUNCTION : Provide a REV data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetRevFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstRevFst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
+
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev_l.cpp
new file mode 100755
index 0000000..8a8178a
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev_l.cpp
@@ -0,0 +1,157 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_Rev_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_REV)
+ * Module configuration :VehicleSensInitRevl() Vehicle Sensor REV Initialization Functions
+ * :VehicleSensSetRevl() Vehicle Sensor REV SET Functions
+ * :VehicleSensGetRevl() Vehicle Sensor REV GET Functions
+ * :VehicleSensGetRevline() Vehicle Sensor REV GET Functions(_LINE)
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstRev_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitRevl
+* ABSTRACT : Vehicle Sensor REV Initialization Functions
+* FUNCTION : REV data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitRevl(void) {
+ memset(&gstRev_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstRev_l.ul_did = VEHICLE_DID_REV;
+ gstRev_l.us_size = VEHICLE_DSIZE_REV;
+ gstRev_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetRevl
+* ABSTRACT : Vehicle Sensor REV SET Functions
+* FUNCTION : Update the REV data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetRevl(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstRev_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle Sensor REV SET Functions
+ *
+ * Update the REV data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetRevlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstRev_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetRevl
+* ABSTRACT : Vehicle Sensor REV GET Functions
+* FUNCTION : Provide a REV data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetRevl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstRev_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetRevline
+* ABSTRACT : Vehicle Sensor REV GET Functions(For direct lines)
+* FUNCTION : Provide a REV data master(For direct lines)
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetRevline(VEHICLESENS_DATA_MASTER *pst_data) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstRev_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = VEHICLE_DID_REV_LINE;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
+// LCOV_EXCL_STOP
+
+
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime.cpp
new file mode 100755
index 0000000..b8db26c
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime.cpp
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_SettingTime.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+
+/**
+ * @brief
+ * GPS setting time information data master GET process
+ *
+ * Provide the GPS setting time information data master
+ *
+ * @param[in] u_int8 uc_get_method : Acquisition method(NAVI)
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ *
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetSettingTime(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:other parameters cannot pass in
+ case VEHICLESENS_GETMETHOD_OTHER:
+ {
+ /** Acquiring from Clock */
+ VehicleSensGetSettingTimeclock(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime_clock.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime_clock.cpp
new file mode 100755
index 0000000..a415a84
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime_clock.cpp
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_SettingTime_clock.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstSettingTime_clock; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * GPS setting time information data master initialization process(NAVI information)
+ *
+ * Initialize the GPS setting time information data master
+ *
+ * @param[in] none
+ * @param[out] none
+ * @return none
+ * @retval none
+ */
+void VehicleSensInitSettingTimeclock(void) {
+ POS_DATETIME st_time;
+
+ memset(&gstSettingTime_clock, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstSettingTime_clock.ul_did = VEHICLE_DID_SETTINGTIME;
+
+ /** Data size setting */
+ gstSettingTime_clock.us_size = sizeof(POS_DATETIME);
+
+ /** Data content setting */
+ memset(&st_time, 0x00, sizeof(st_time));
+ memcpy(&gstSettingTime_clock.uc_data[0], &st_time, sizeof(st_time));
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS setting time information data master SET process(NAVI information)
+ *
+ * Update the GPS setting time information data master
+ *
+ * @param[in] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @param[out] none
+ * @return u_int8
+ * @retval VEHICLESENS_EQ : No data change
+ * @retval VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetSettingTimeclock(const POS_DATETIME *pst_rcv_time) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSettingTime_clock;
+
+ /** Compare the data master and generated data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_rcv_time, sizeof(POS_DATETIME));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_SETTINGTIME;
+ pst_master->us_size = sizeof(POS_DATETIME);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_rcv_time, sizeof(POS_DATETIME));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * GPS setting time information data master GET process(NAVI information)
+ *
+ * Provide the GPS setting time information data master
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetSettingTimeclock(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSettingTime_clock;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return;
+}
+
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter.cpp
new file mode 100755
index 0000000..6456125
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter.cpp
@@ -0,0 +1,90 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SnsCounter.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_SNS_COUNTER)
+ * Module configuration :VehicleSensGetSnsCounter() Vehicle sensor SNS_COUNTER GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSnsCounter
+* ABSTRACT : Vehicle sensor SNS_COUNTER GET function
+* FUNCTION : Provide the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSnsCounter(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSnsCounterl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetSnsCounterExt
+* ABSTRACT : Vehicle sensor SNS_COUNTER GET function
+* FUNCTION : Provide the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSnsCounterExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSnsCounterExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+#endif
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounterExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounterExt_l.cpp
new file mode 100755
index 0000000..61b7a42
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounterExt_l.cpp
@@ -0,0 +1,155 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SnsCounterExt_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SNS_COUNTER)
+ * Module configuration :VehicleSensInitSnsCounterl() Vehicle sensor SNS_COUNTER initialization function
+ * :VehicleSensSetSnsCounterl() Vehicle sensor SNS_COUNTER SET function
+ * :VehicleSensGetSnsCounterl() Vehicle sensor SNS_COUNTER GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Response */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstSnsCounterExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSnsCounterExtl
+* ABSTRACT : Vehicle sensor SNS_COUNTER initialization function
+* FUNCTION : SNS_COUNTER data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSnsCounterExtl(void) {
+ u_int16 *pus;
+
+ memset(&gstSnsCounterExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstSnsCounterExt_l.ul_did = POSHAL_DID_SNS_COUNTER;
+ gstSnsCounterExt_l.us_size = VEHICLE_DSIZE_SNS_COUNTER_EXT_INIT;
+ pus = reinterpret_cast<u_int16 *>(gstSnsCounterExt_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_SNS_COUNTER, VEHICLE_DSIZE_SNS_COUNTER_EXT);
+
+ /* Initializing Initial Delivery Internal Information */
+ memset(&gstPkgTempExt, 0x00, sizeof(VEHICLESENS_PKG_DELIVERY_TEMP_EXT));
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSnsCounterExtl
+* ABSTRACT : Vehicle sensor SNS_COUNTER SET function
+* FUNCTION : Update the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetSnsCounterExtl(const LSDRV_LSDATA *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSnsCounterExtlG
+* ABSTRACT : Vehicle sensor SNS_COUNTER SET function
+* FUNCTION : Update the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetSnsCounterExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+
+ pst_master = &gstSnsCounterExt_l;
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[SNSCounter];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_data[us_start] = pst_data->uc_data[0];
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[SNSCounter] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_SNS_COUNTER_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + sizeof(u_int8));
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSnsCounterExtl
+* ABSTRACT : Vehicle sensor SNS_COUNTER GET function
+* FUNCTION : Provide the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSnsCounterExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstSnsCounterExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[SNSCounter];
+ }
+
+ /* Acquire data from the newest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[SNSCounter] + us_cnt < VEHICLE_DKEEP_MAX) {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[(gstPkgTempExt.start_point[SNSCounter] + us_cnt)];
+ } else {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[us_loop_cnt];
+ us_loop_cnt++;
+ }
+ } else {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[us_cnt];
+ }
+ }
+}
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter_l.cpp
new file mode 100755
index 0000000..b81b4b3
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter_l.cpp
@@ -0,0 +1,124 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SnsCounter_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SNS_COUNTER)
+ * Module configuration :VehicleSensInitSnsCounterl() Vehicle sensor SNS_COUNTER initialization function
+ * :VehicleSensSetSnsCounterl() Vehicle sensor SNS_COUNTER SET function
+ * :VehicleSensGetSnsCounterl() Vehicle sensor SNS_COUNTER GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstSnsCounter_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSnsCounterl
+* ABSTRACT : Vehicle sensor SNS_COUNTER initialization function
+* FUNCTION : SNS_COUNTER data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSnsCounterl(void) {
+ memset(&gstSnsCounter_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstSnsCounter_l.ul_did = POSHAL_DID_SNS_COUNTER;
+ gstSnsCounter_l.us_size = VEHICLE_DSIZE_SNS_COUNTER;
+ gstSnsCounter_l.uc_data[0] = VEHICLE_DINIT_SNS_COUNTER;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSnsCounterl
+* ABSTRACT : Vehicle sensor SNS_COUNTER SET function
+* FUNCTION : Update the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSnsCounterl(const LSDRV_LSDATA *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSnsCounter_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSnsCounterlG
+* ABSTRACT : Vehicle sensor SNS_COUNTER SET function
+* FUNCTION : Update the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSnsCounterlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSnsCounter_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSnsCounterl
+* ABSTRACT : Vehicle sensor SNS_COUNTER GET function
+* FUNCTION : Provide the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSnsCounterl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSnsCounter_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph.cpp
new file mode 100755
index 0000000..4705774
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph.cpp
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedKmph.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_KMPH)
+ * Module configuration :VehicleSensGetSpeedKmph() Vehicle Sensor SPEED_KMPH GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedKmph
+* ABSTRACT : Vehicle Sensor SPEED_KMPH GET Function
+* FUNCTION : Provide the SPEED_KMPH data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(DIRECT or CAN or NAVI)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedKmph(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSpeedKmphl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph_l.cpp
new file mode 100755
index 0000000..abbb27a
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph_l.cpp
@@ -0,0 +1,156 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedKmph_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_KMPH)
+ * Module configuration :VehicleSensInitSpeedKmphl() Vehicle sensor SPEED_KMPH initialization function
+ * :VehicleSensSetSpeedKmphl() Vehicle sensor SPEED_KMPH SET function
+ * :VehicleSensGetSpeedKmphl() Vehicle Sensor SPEED_KMPH GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstSpeedKmph_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSpeedKmphl
+* ABSTRACT : Vehicle sensor SPEED_KMPH initialization function
+* FUNCTION : SPEED_KMPH data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSpeedKmphl(void) {
+ u_int16 *pus;
+
+ memset(&gstSpeedKmph_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstSpeedKmph_l.ul_did = POSHAL_DID_SPEED_KMPH;
+ gstSpeedKmph_l.us_size = VEHICLE_DSIZE_SPEED_KMPH;
+
+ pus = reinterpret_cast<u_int16 *>(gstSpeedKmph_l.uc_data);
+ *pus = VEHICLE_DINIT_SPEED_KMPH;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedKmphl
+* ABSTRACT : Vehicle sensor SPEED_KMPH SET function
+* FUNCTION : Update the SPEED_KMPH data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedKmphl(const LSDRV_LSDATA *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedKmph_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedKmphlG
+* ABSTRACT : Vehicle sensor SPEED_KMPH SET function
+* FUNCTION : Update the SPEED_KMPH data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedKmphlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ static u_int16 pre_speed[2] = {0, 0};
+ u_int16 cur_speed = 0;
+ memcpy(&cur_speed, &pst_data->uc_data[0], sizeof(u_int16));
+
+ BOOL under2 = TRUE;
+ BOOL eq_speed = TRUE;
+
+ pst_master = &gstSpeedKmph_l;
+
+ /* Transition of 0->1km/h and 1->0km/h requires 3 consecutive matches. Compliance with driving regulations */
+ under2 = ((pre_speed[1] < 2) && (pre_speed[0] < 2) && (cur_speed < 2));
+ eq_speed = ((pre_speed[1] == pre_speed[0]) && (pre_speed[0] == cur_speed));
+
+ if ((under2 == TRUE) && (eq_speed != TRUE) && (pst_master->uc_rcvflag == VEHICLE_RCVFLAG_ON)) {
+ uc_ret = VEHICLESENS_EQ; /* Return without data change */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+
+ } else {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* For the next comparison,Update Speed */
+ pre_speed[1] = pre_speed[0];
+ pre_speed[0] = cur_speed;
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedKmphl
+* ABSTRACT : Vehicle Sensor SPEED_KMPH GET Function
+* FUNCTION : Provide the SPEED_KMPH data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedKmphl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedKmph_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse.cpp
new file mode 100755
index 0000000..3f4ec8a
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse.cpp
@@ -0,0 +1,117 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedPulse.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_)
+ * Module configuration :VehicleSensGetSpeedPulse() Vehicle sensor GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulse
+* ABSTRACT : Vehicle sensor GET function
+* FUNCTION : Provide a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulse(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSpeedPulsel(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseExt
+* ABSTRACT : Vehicle sensor GET function
+* FUNCTION : Provide a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSpeedPulseExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseFst
+* ABSTRACT : Vehicle sensor GET function
+* FUNCTION : Provide a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSpeedPulseFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseExt_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseExt_l.cpp
new file mode 100755
index 0000000..86c8f49
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseExt_l.cpp
@@ -0,0 +1,150 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedPulseExt_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_PULSE)
+ * Module configuration :VehicleSensInitSpeedPulseExtl() Vehicle sensor SPEED_PULSE initialization function
+ * :VehicleSensSetSpeedPulseExtlG() Vehicle Sensor SPEED_PULSE SET Function
+ * :VehicleSensGetSpeedPulseExtl() Vehicle Sensor SPEED_PULSE GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstSpeedPulseExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSpeedPulseExtl
+* ABSTRACT : Vehicle sensor SPEED_PULSE initialization function
+* FUNCTION : SPEED_PULSE data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSpeedPulseExtl(void) {
+ u_int16 *pus;
+
+ memset(&gstSpeedPulseExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstSpeedPulseExt_l.ul_did = POSHAL_DID_SPEED_PULSE;
+ gstSpeedPulseExt_l.us_size = VEHICLE_DSIZE_SPEED_PULSE_EXT_INIT;
+
+ pus = reinterpret_cast<u_int16 *>(gstSpeedPulseExt_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_SPEED_PULSE, VEHICLE_DSIZE_SPEED_PULSE_EXT);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulseExtlG
+* ABSTRACT : Vehicle Sensor SPEED_PULSE SET Function
+* FUNCTION : Update the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+void VehicleSensSetSpeedPulseExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstSpeedPulseExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[SpeedPulse];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[SpeedPulse] = us_start;
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_SPEED_PULSE_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseExtl
+* ABSTRACT : Vehicle Sensor SPEED_PULSE GET Function
+* FUNCTION : Provide the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstSpeedPulseExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[SpeedPulse];
+ }
+
+ /* Acquire data from the newest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[SpeedPulse] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[SpeedPulse] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlag.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlag.cpp
new file mode 100755
index 0000000..f6ab8df
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlag.cpp
@@ -0,0 +1,133 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Clock_g.cpp
+@detail Master vehicle sensor data(POSHAL_DID_SPEED_PULSE_FLAG)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstSpeedPulseFlag; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief VehicleSensInitSpeedPulseFlag
+@outline SPEED_PULSE_FLAG initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitSpeedPulseFlag(void) {
+ (void)memset(reinterpret_cast<void *>(&gstSpeedPulseFlag), 0, sizeof(VEHICLESENS_DATA_MASTER));
+ gstSpeedPulseFlag.ul_did = POSHAL_DID_SPEED_PULSE_FLAG;
+ gstSpeedPulseFlag.us_size = VEHICLE_DSIZE_SPEED_PULSE_FLAG;
+ gstSpeedPulseFlag.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/***************************************************************************
+@brief NAV-CLOCK SET vehicle sensor function
+@outline To update the master data NAV-CLOCK.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetSpeedPulseFlag(const LSDRV_LSDATA_G *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedPulseFlag;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-CLOCK GET
+@outline Master Data provides the NAV-CLOCK
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetSpeedPulseFlag(VEHICLESENS_DATA_MASTER *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedPulseFlag;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseFlagFst
+* ABSTRACT : Vehicle sensor GET function
+* FUNCTION : Provide a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseFlagFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSpeedPulseFlagFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlagFst_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlagFst_l.cpp
new file mode 100755
index 0000000..051c6bb
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlagFst_l.cpp
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedPulseFlagFst_l.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_PULSE_FLAG_FST)
+ * Module configuration :VehicleSensInitSpeedPulseFlagFstl() Vehicle sensor SPEED_PULSE_FLAG initialization function
+ * :VehicleSensSetSpeedPulseFlagFstl() Vehicle Sensor SPEED_PULSE_FLAG SET Function
+ * :VehicleSensSetSpeedPulseFlagFstG() Vehicle Sensor SPEED_PULSE_FLAG SET Function
+ * :VehicleSensGetSpeedPulseFlagFstl() Vehicle Sensor SPEED_PULSE_FLAG GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* #Polaris_003 START */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Response */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSpeedPulseFlagFstl
+* ABSTRACT : Vehicle sensor SPEED_PULSE_FLAG initialization function
+* FUNCTION : SPEED_PULSE_FLAG data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSpeedPulseFlagFstl(void) {
+ return;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulseFlagFstl
+* ABSTRACT : Vehicle Sensor SPEED_PULSE_FLAG SET Function
+* FUNCTION : Update the SPEED_PULSE_FLAG data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulseFlagFstl(const LSDRV_LSDATA_FST *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(VEHICLESENS_EQ);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulseFlagFstG
+* ABSTRACT : Vehicle Sensor SPEED_PULSE_FLAG SET Function
+* FUNCTION : Update the SPEED_PULSE_FLAG data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulseFlagFstG(const LSDRV_LSDATA_FST_SPEED_PULSE_FLAG *pst_data) {
+ return VEHICLESENS_EQ;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseFlagFstl
+* ABSTRACT : Vehicle Sensor SPEED_PULSE_FLAG GET Function
+* FUNCTION : Provide the SPEED_PULSE_FLAG data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseFlagFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return;
+}
+
+#endif
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFst_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFst_l.cpp
new file mode 100755
index 0000000..26952b3
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFst_l.cpp
@@ -0,0 +1,172 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedPulseFst_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_PULSE_FST)
+ * Module configuration :VehicleSensInitSpeedPulseFstl() Vehicle sensor SPEED_PULSE initialization function
+ * :VehicleSensSetSpeedPulseFstl() Vehicle Sensor SPEED_PULSE SET Function
+ * :VehicleSensSetSpeedPulseFstG() Vehicle Sensor SPEED_PULSE SET Function
+ * :VehicleSensGetSpeedPulseFstl() Vehicle Sensor SPEED_PULSE GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST gstSpeedPulseFst_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSpeedPulseFstl
+* ABSTRACT : Vehicle sensor SPEED_PULSE initialization function
+* FUNCTION : SPEED_PULSE data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSpeedPulseFstl(void) {
+ u_int16 *pus;
+
+ memset(&gstSpeedPulseFst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ gstSpeedPulseFst_l.ul_did = POSHAL_DID_SPEED_PULSE_FST;
+ gstSpeedPulseFst_l.us_size = 0;
+ gstSpeedPulseFst_l.partition_flg = 0;
+ pus = reinterpret_cast<u_int16 *>(gstSpeedPulseFst_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_SPEED_PULSE, VEHICLE_DSIZE_SPEED_PULSE_FST);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulseFstl
+* ABSTRACT : Vehicle Sensor SPEED_PULSE SET Function
+* FUNCTION : Update the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulseFstl(const LSDRV_LSDATA_FST *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstSpeedPulseFst_l;
+
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulseFstG
+* ABSTRACT : Vehicle Sensor SPEED_PULSE SET Function
+* FUNCTION : Update the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulseFstG(const LSDRV_LSDATA_FST_SPEED *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ pst_master = &gstSpeedPulseFst_l;
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_max == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (partition_num == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_num == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_SPEED_PULSE_FST],
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_SPEED_PULSE_FST],
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseFstl
+* ABSTRACT : Vehicle Sensor SPEED_PULSE GET Function
+* FUNCTION : Provide the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstSpeedPulseFst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
+
+#endif
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse_l.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse_l.cpp
new file mode 100755
index 0000000..a3ebc01
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse_l.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedPulse_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_PULSE)
+ * Module configuration :VehicleSensInitSpeedPulsel() Vehicle sensor SPEED_PULSE initialization function
+ * :VehicleSensSetSpeedPulsel() Vehicle Sensor SPEED_PULSE SET Function
+ * :VehicleSensGetSpeedPulsel() Vehicle Sensor SPEED_PULSE GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstSpeedPulse_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSpeedPulsel
+* ABSTRACT : Vehicle sensor SPEED_PULSE initialization function
+* FUNCTION : SPEED_PULSE data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSpeedPulsel(void) {
+ (void)memset(reinterpret_cast<void *>(&gstSpeedPulse_l), 0, sizeof(VEHICLESENS_DATA_MASTER));
+ gstSpeedPulse_l.ul_did = POSHAL_DID_SPEED_PULSE;
+ gstSpeedPulse_l.us_size = VEHICLE_DSIZE_SPEED_PULSE;
+ gstSpeedPulse_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulsel
+* ABSTRACT : Vehicle Sensor SPEED_PULSE SET Function
+* FUNCTION : Update the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulsel(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedPulse_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulselG
+* ABSTRACT : Vehicle Sensor SPEED_PULSE SET Function
+* FUNCTION : Update the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulselG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedPulse_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulsel
+* ABSTRACT : Vehicle Sensor SPEED_PULSE GET Function
+* FUNCTION : Provide the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulsel(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedPulse_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SysGpsInterruptSignal.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SysGpsInterruptSignal.cpp
new file mode 100755
index 0000000..e1400f2
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SysGpsInterruptSignal.cpp
@@ -0,0 +1,132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SysGpsInterruptSignal.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL)
+ * Module configuration :VehicleSensInitSysGpsInterruptSignal() Vehicle sensor Sys_GPS_INTERRUPT_SIGNAL initialization function
+ * :VehicleSensSetSysGpsInterruptSignal() Vehicle Sensor Sys_GPS_INTERRUPT_SIGNAL SET Function
+ * :VehicleSensGetSysGpsInterruptSignal() Vehicle sensor Sys_GPS_INTERRUPT_SIGNAL GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#define VEHICLE_SENS_DID_SYS_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY 0
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL gstSysGpsInterruptSignal; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSysGpsInterruptSignal
+* ABSTRACT : Vehicle sensor Sys_GPS_INTERRUPT_SIGNAL initialization function
+* FUNCTION : Sys_GPS_INTERRUPT_SIGNAL data master initialization processing
+* ARGUMENT : None
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensInitSysGpsInterruptSignal(void) {
+ (void)memset(reinterpret_cast<void *>(&(gstSysGpsInterruptSignal)), static_cast<int>(0x00),
+ sizeof(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL));
+ gstSysGpsInterruptSignal.ul_did = VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL;
+ gstSysGpsInterruptSignal.us_size = VEHICLE_DSIZE_SYS_GPS_INTERRUPT_SIGNAL;
+ gstSysGpsInterruptSignal.uc_data = VEHICLE_DINIT_SYS_GPS_INTERRUPT_SIGNAL;
+
+#if VEHICLE_SENS_DID_SYS_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstSysGpsInterruptSignal.uc_data == 0x%x\r\n", gstSysGpsInterruptSignal.uc_data);
+#endif
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSysGpsInterruptSignal
+* ABSTRACT : Vehicle sensor SYS_GPS_INTERRUPT_SIGNAL SET function
+* FUNCTION : Update the Sys_GPS_INTERRUPT_SIGNAL data master
+* ARGUMENT : *pst_data : Pointer to received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSysGpsInterruptSignal(const LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL *pst_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstSysGpsInterruptSignal;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), (size_t)(pst_data->uc_size));
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int16)pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
+
+#if VEHICLE_SENS_DID_SYS_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] pst_data->ul_did == 0x%x", pst_data->ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstSysGpsInterruptSignal.ul_did == 0x%x\r\n", gstSysGpsInterruptSignal.ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] (u_int8)pst_data->ucSize == 0x%x", (u_int8)pst_data->uc_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstSysGpsInterruptSignal.us_size == 0x%x\r\n", gstSysGpsInterruptSignal.us_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] pst_data->uc_data == 0x%x", pst_data->uc_data);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstSysGpsInterruptSignal.uc_data == 0x%x\r\n", gstSysGpsInterruptSignal.uc_data);
+#endif
+ }
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSysGpsInterruptSignal
+* ABSTRACT : Vehicle sensor SYS_GPS_INTERRUPT_SIGNAL GET function
+* FUNCTION : Provide the SYS_GPS_INTERRUPT_SIGNAL data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensGetSysGpsInterruptSignal(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstSysGpsInterruptSignal;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
+ (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover.cpp
new file mode 100755
index 0000000..e98d364
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover.cpp
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_WknRollover.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS Rollover Standard Week Number Data Master GET Processing
+ *
+ * @param[out] VEHICLESENS_DATA_MASTER*
+ * @param[in] u_int8
+ */
+void VehicleSensGetWknRollover(SENSOR_MSG_GPSDATA_DAT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetWknRolloverG(pst_data);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover_g.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover_g.cpp
new file mode 100755
index 0000000..4a5defe
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover_g.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_WknRollover_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstWknRollover_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS rollover standard week number data master initialization processing
+ */
+void VehicleSensInitWknRolloverG(void) {
+ SENSOR_WKNROLLOVER st_wkn_rollover;
+
+ memset(&gstWknRollover_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstWknRollover_g.ul_did = POSHAL_DID_GPS_WKNROLLOVER;
+ /** Data size setting */
+ gstWknRollover_g.us_size = sizeof(SENSOR_WKNROLLOVER);
+ /** Data content setting */
+ memset(&st_wkn_rollover, 0x00, sizeof(st_wkn_rollover));
+ memcpy(&gstWknRollover_g.uc_data[0], &st_wkn_rollover, sizeof(st_wkn_rollover));
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS Rollover Standard Week Number Data Master SET Process
+ *
+ * @param[in] SENSOR_WKNROLLOVER*
+ *
+ * @return u_int8
+ */
+u_int8 VehicleSensSetWknRolloverG(const SENSOR_WKNROLLOVER *pst_wkn_rollover) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstWknRollover_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_wkn_rollover, sizeof(SENSOR_WKNROLLOVER));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GPS_WKNROLLOVER;
+ pst_master->us_size = sizeof(SENSOR_WKNROLLOVER);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_wkn_rollover, sizeof(SENSOR_WKNROLLOVER));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * GPS Rollover Standard Week Number Data Master GET Processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ */
+void VehicleSensGetWknRolloverG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstWknRollover_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_FromAccess.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_FromAccess.cpp
new file mode 100755
index 0000000..99f2dc3
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_FromAccess.cpp
@@ -0,0 +1,319 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_FromAccess.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Functions for accessing vehicle sensor FROM
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_FromAccess.h"
+#include "ClockDataMng.h"
+
+/********************************************************************************
+ * Global variable *
+ ********************************************************************************/
+
+/********************************************************************************
+ * prototype declalation *
+ ********************************************************************************/
+static RET_API VehicleSensReadNV(NV_DATA_VEHICLESENS *p_nv_data);
+
+/********************************************************************************
+ * Definition *
+ ********************************************************************************/
+#define VEHICLESENS_FROM_ACCESS_DEBUG 0
+
+/*******************************************************************************
+* MODULE : VehicleSensFromAccessInitialize
+* ABSTRACT : Initializing process
+* FUNCTION :
+* ARGUMENT : None
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensFromAccessInitialize(void) {
+ /* The result of tag registration for non-volatile memory access is stored in g_nv_access_available, so no confirmation is required. */
+ (void)VehicleSensRegistNvTag();
+
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensRegistNvTag
+* ABSTRACT : Tag registration process
+* FUNCTION : Registering Tag Name to Identify Data Storage Destination
+* ARGUMENT : None
+* NOTE :
+* RETURN : RET_NORMAL :Successful registration
+* : RET_ERROR :Registration failure
+******************************************************************************/
+RET_API VehicleSensRegistNvTag(void) {
+ RET_API lret = RET_NORMAL;
+ return lret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensReadNV
+* ABSTRACT : Get local time Lonlat
+* FUNCTION : Reading local time Lonlat from non-volatile memory
+* ARGUMENT : NV_DATA_VEHICLESENS * p_nv_data : Pointer to data acquired from non-volatile memory
+* NOTE : None
+* RETURN : RET_NORMAL :Read success
+* : RET_ERROR :Failed to read
+******************************************************************************/
+static RET_API VehicleSensReadNV(NV_DATA_VEHICLESENS * p_nv_data) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API lret = RET_NORMAL;
+ FILE *fp;
+ NV_DATA_VEHICLESENS nv_data_tmp;
+ BOOL ret_read = FALSE;
+ BOOL ret_read2 = FALSE;
+
+ u_int32 loop;
+ u_int8 CK_A = 0;
+ u_int8 CK_B = 0;
+ u_int8 *ptr;
+
+ fp = fopen(NV_FILE_VEHICLESENS_TEMP, "rb");
+
+ /* Read File1 */
+ if (fp != NULL) {
+ if ((fread(reinterpret_cast<void *>(p_nv_data), sizeof(u_int8), sizeof(NV_DATA_VEHICLESENS), fp)) == \
+ sizeof(NV_DATA_VEHICLESENS)) {
+ /* Checksum processing */
+ ptr = reinterpret_cast<u_int8 *>(p_nv_data); /* #QAC confirmation Rule11.4 1Byte accesses for checksums */
+ CK_A = 0;
+ CK_B = 0;
+
+ /* The 2Byte portion from the end of the checksum data is excluded because the checksum storage area. */
+ for (loop = 0; loop < (sizeof(NV_DATA_VEHICLESENS) - 2); loop++) {
+ CK_A = static_cast<u_int8>(CK_A + ptr[loop]);
+ CK_B = static_cast<u_int8>(CK_B + CK_A);
+ }
+
+
+ if ((p_nv_data->cka == CK_A) && (p_nv_data->ckb == CK_B)) {
+ ret_read = TRUE;
+
+#if VEHICLESENS_FROM_ACCESS_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NV read, status, year, month, day, hour, min, sec, lat, lon, "\
+ "timediff, update_counter, cka, ckb ");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NV read, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d ",
+ p_nv_data->localtime.status,
+ p_nv_data->localtime.year,
+ p_nv_data->localtime.month,
+ p_nv_data->localtime.day,
+ p_nv_data->localtime.hour,
+ p_nv_data->localtime.min,
+ p_nv_data->localtime.sec,
+ p_nv_data->lonlat.latitude,
+ p_nv_data->lonlat.longitude,
+ p_nv_data->timediff,
+ p_nv_data->update_counter,
+ p_nv_data->cka,
+ p_nv_data->ckb);
+#endif /* VEHICLESENS_FROM_ACCESS_DEBUG */
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Checksum1 failed.");
+ ret_read = FALSE;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fread1 failed.");
+ }
+ fclose(fp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fopen1 failed.");
+ }
+
+ /* Read File2 */
+ fp = fopen(NV_FILE_VEHICLESENS2_TEMP, "rb");
+
+ if (fp != NULL) {
+ if ((fread(reinterpret_cast<void *>(&nv_data_tmp), sizeof(u_int8), sizeof(NV_DATA_VEHICLESENS), fp)) == \
+ sizeof(NV_DATA_VEHICLESENS)) {
+ /* Checksum processing */
+ ptr = reinterpret_cast<u_int8 *>(&nv_data_tmp); /* #QAC confirmation Rule11.4 1Byte accesses for checksums */
+ CK_A = 0;
+ CK_B = 0;
+
+ /* The 2Byte portion from the end of the checksum data is excluded because the checksum storage area. */
+ for (loop = 0; loop < (sizeof(NV_DATA_VEHICLESENS) - 2); loop++) {
+ CK_A = static_cast<u_int8>(CK_A + ptr[loop]);
+ CK_B = static_cast<u_int8>(CK_B + CK_A);
+ }
+
+
+ if ((nv_data_tmp.cka == CK_A) && (nv_data_tmp.ckb == CK_B)) {
+ ret_read2 = TRUE;
+
+#if VEHICLESENS_FROM_ACCESS_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NV read2, status, year, month, day, hour, min, sec, lat, lon, "\
+ "timediff, update_counter, cka, ckb ");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NV read2, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d ",
+ nv_data_tmp.localtime.status,
+ nv_data_tmp.localtime.year,
+ nv_data_tmp.localtime.month,
+ nv_data_tmp.localtime.day,
+ nv_data_tmp.localtime.hour,
+ nv_data_tmp.localtime.min,
+ nv_data_tmp.localtime.sec,
+ nv_data_tmp.lonlat.latitude,
+ nv_data_tmp.lonlat.longitude,
+ nv_data_tmp.timediff,
+ nv_data_tmp.update_counter,
+ nv_data_tmp.cka,
+ nv_data_tmp.ckb);
+#endif /* VEHICLESENS_FROM_ACCESS_DEBUG */
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Checksum2 failed.");
+ ret_read2 = FALSE;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fread2 failed.");
+ }
+ fclose(fp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fopen2 failed.");
+ }
+
+
+ /* Check the read results of File 1 and File 2. */
+ if ((ret_read == TRUE) && (ret_read2 == TRUE)) {
+ /* Whether File 1 or File 2 is the most recent file,Check with the update count counter */
+ if (p_nv_data->update_counter < nv_data_tmp.update_counter) {
+ (void)memcpy(reinterpret_cast<void *>(p_nv_data), reinterpret_cast<void *>(&nv_data_tmp), \
+ sizeof(NV_DATA_VEHICLESENS));
+ }
+ lret = RET_NORMAL;
+ } else if (ret_read == TRUE) {
+ /* Use file 1 */
+ lret = RET_NORMAL;
+ } else if (ret_read2 == TRUE) {
+ /* Use file 2 */
+ (void)memcpy(reinterpret_cast<void *>(p_nv_data), reinterpret_cast<void *>(&nv_data_tmp), \
+ sizeof(NV_DATA_VEHICLESENS));
+ lret = RET_NORMAL;
+ } else {
+ /* Read failed for both file 1 and file 2 */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fread failed.");
+ lret = RET_ERROR;
+ }
+
+ return lret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensReadNVLocalTime
+* ABSTRACT : Local time acquisition at shutdown
+* FUNCTION : Read local time at shutdown from non-volatile memory
+* ARGUMENT : LOCALTIME * local_time : Local time at shutdown
+* NOTE : None
+* RETURN : RET_NORMAL :Successful acquisition
+* : RET_ERROR :Failed to acquire
+******************************************************************************/
+RET_API VehicleSensReadNVLocalTime(LOCALTIME * local_time) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API lret;
+ NV_DATA_VEHICLESENS nv_data;
+
+ lret = VehicleSensReadNV(&nv_data);
+
+ if (lret == RET_NORMAL) {
+ (void)memcpy(reinterpret_cast<void *>(local_time), (const void *)(&nv_data.localtime), sizeof(LOCALTIME));
+ }
+
+ return lret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensReadNVLonLat
+* ABSTRACT : Obtain position at shutdown
+* FUNCTION : Read the shutdown position from the non-volatile memory
+* ARGUMENT : LONLAT * lonlat : Shutdown position
+* NOTE : None
+* RETURN : RET_NORMAL :Successful acquisition
+* : RET_ERROR :Failed to acquire
+******************************************************************************/
+RET_API VehicleSensReadNVLonLat(LONLAT * lonlat) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API lret;
+ NV_DATA_VEHICLESENS nv_data;
+
+ lret = VehicleSensReadNV(&nv_data);
+
+ if (lret == RET_NORMAL) {
+ (void)memcpy(reinterpret_cast<void *>(lonlat), (const void *)(&nv_data.lonlat), sizeof(LONLAT));
+ }
+
+ return lret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensReadNVTimeDiff
+* ABSTRACT : Shutdown time difference acquisition
+* FUNCTION : Reading the shutdown time difference from the non-volatile memory
+* ARGUMENT : int32 * time_diff : Shutdown position
+* NOTE : None
+* RETURN : RET_NORMAL :Successful acquisition
+* : RET_ERROR :Failed to acquire
+******************************************************************************/
+RET_API VehicleSensReadNVTimeDiff(int32 * time_diff) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API lret;
+ NV_DATA_VEHICLESENS nv_data;
+
+ lret = VehicleSensReadNV(&nv_data);
+
+ if (lret == RET_NORMAL) {
+ *time_diff = nv_data.timediff;
+ }
+
+ return lret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensStoreLonlat
+* ABSTRACT : Store location data in non-volatile memory
+* FUNCTION :
+* ARGUMENT : LONLAT * plonlat : Position data
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensStoreLonlat(LONLAT * plonlat) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteNVLocaltime
+* ABSTRACT : Local Time Write
+* FUNCTION : Write local time
+* ARGUMENT : LOCALTIME * local_time : Local time
+* NOTE :
+* RETURN : RET_NORMAL :Successful write
+* : RET_ERROR :Writing failure
+******************************************************************************/
+RET_API VehicleSensWriteNVLocaltime(LOCALTIME * local_time, int32 * time_diff) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API lret = RET_NORMAL;
+
+ return lret;
+}
+
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_SelectionItemList.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_SelectionItemList.cpp
new file mode 100755
index 0000000..4172b1e
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_SelectionItemList.cpp
@@ -0,0 +1,466 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_SelectionItemList.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle Sensor Selection Item List
+ * Module configuration :VehicleSensInitSelectionItemList() Vehicle sensor selection item list initialization function
+ * :VehicleSensGetSelectionItemList() Vehicle sensor selection item list acquisition method GET function
+ * :VehicleSensGetSelectionItemListCanId() Vehicle Sensor Selection Items List CANID GET Functions
+ * :VehicleSensSetSelectionItemListCanId() Vehicle Sensor Selection Items List CANID SET Functions
+ * :VehicleSensCommWatchTblInit() Disruption monitoring data management table initialization function
+ * :VehicleSensCommWatchTblSave() Disruption monitoring data management table storage function
+ * :VehicleSensCommWatchTblRun() Disruption monitoring data management table execution function
+ ******************************************************************************/
+
+#include <positioning_hal.h>
+#include <vehicle_service/positioning_base_library.h>
+
+#include "VehicleSens_SelectionItemList.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_SELECTION_ITEM_LIST g_st_selection_itemlist[VEHICLESENS_SELECTION_ITEM_LIST_LEN];
+static VEHICLE_COMM_WATCH_TBL g_st_comm_watchtbl[VEHICLE_COMM_WATCHTBL_DID_NUM];
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSelectionItemList
+* ABSTRACT : Vehicle sensor selection item list initialization function
+* FUNCTION : Vehicle Sensor Selection Item List Initialization Process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSelectionItemList(void) {
+ u_int8 uc_get_method;
+
+ VehicleSensCommWatchTblInit();
+
+ /* Setting Acquisition Method (CAN/ Direct Line) for DataID in Vehicle Sensor Selection Item List.
+ BackDoor, Adim, Rev sets the CAN/ direct line obtained from the FROM
+ */
+ memset(&g_st_selection_itemlist, 0x00, sizeof(g_st_selection_itemlist));
+
+ g_st_selection_itemlist[0].ul_did = VEHICLE_DID_HV;
+ g_st_selection_itemlist[0].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[0].uc_get_method = VEHICLESENS_GETMETHOD_CAN;
+ g_st_selection_itemlist[1].ul_did = VEHICLE_DID_VB;
+ g_st_selection_itemlist[1].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[2].ul_did = VEHICLE_DID_IG;
+ g_st_selection_itemlist[2].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[3].ul_did = VEHICLE_DID_MIC;
+ g_st_selection_itemlist[3].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[4].ul_did = VEHICLE_DID_ILL;
+ g_st_selection_itemlist[4].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[5].ul_did = VEHICLE_DID_RHEOSTAT;
+ g_st_selection_itemlist[5].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[6].ul_did = VEHICLE_DID_SYSTEMP;
+ g_st_selection_itemlist[6].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[7].ul_did = POSHAL_DID_SPEED_PULSE;
+ g_st_selection_itemlist[7].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[8].ul_did = POSHAL_DID_SPEED_KMPH;
+ g_st_selection_itemlist[8].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[9].ul_did = POSHAL_DID_GYRO_X;
+ g_st_selection_itemlist[9].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[10].ul_did = POSHAL_DID_GYRO_Y;
+ g_st_selection_itemlist[10].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[11].ul_did = POSHAL_DID_GYRO_Z;
+ g_st_selection_itemlist[11].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[12].ul_did = POSHAL_DID_GSNS_X;
+ g_st_selection_itemlist[12].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[13].ul_did = POSHAL_DID_GSNS_Y;
+ g_st_selection_itemlist[13].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[14].ul_did = POSHAL_DID_GSNS_Z;
+ g_st_selection_itemlist[14].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[15].ul_did = VEHICLE_DID_REV;
+ g_st_selection_itemlist[15].ul_canid = VEHICLESENS_INVALID;
+ uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[15].uc_get_method = uc_get_method;
+ g_st_selection_itemlist[16].ul_did = POSHAL_DID_GPS_ANTENNA;
+ g_st_selection_itemlist[16].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[17].ul_did = POSHAL_DID_SNS_COUNTER;
+ g_st_selection_itemlist[17].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[18].ul_did = VEHICLE_DID_GPS_COUNTER;
+ g_st_selection_itemlist[18].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[19].ul_did = POSHAL_DID_GPS_VERSION;
+ g_st_selection_itemlist[19].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[20].ul_did = VEHICLE_DID_LOCATION;
+ g_st_selection_itemlist[20].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[21].ul_did = VEHICLE_DID_REV_LINE;
+ g_st_selection_itemlist[21].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[22].ul_did = VEHICLE_DID_REV_CAN;
+ g_st_selection_itemlist[22].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[22].uc_get_method = VEHICLESENS_GETMETHOD_CAN;
+ /* ++ GPS _CWORD82_ support */
+ g_st_selection_itemlist[23].ul_did = POSHAL_DID_GPS__CWORD82___CWORD44_GP4;
+ g_st_selection_itemlist[23].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[24].ul_did = VEHICLE_DID_GPS__CWORD82__NMEA;
+ g_st_selection_itemlist[24].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[25].ul_did = POSHAL_DID_GPS__CWORD82__FULLBINARY;
+ g_st_selection_itemlist[25].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ /* -- GPS _CWORD82_ support */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Response */
+ g_st_selection_itemlist[26].ul_did = POSHAL_DID_GYRO_EXT;
+ g_st_selection_itemlist[26].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[27].ul_did = POSHAL_DID_SPEED_PULSE_FST;
+ g_st_selection_itemlist[27].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[28].ul_did = POSHAL_DID_GYRO_X_FST;
+ g_st_selection_itemlist[28].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[29].ul_did = POSHAL_DID_GYRO_Y_FST;
+ g_st_selection_itemlist[29].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[30].ul_did = POSHAL_DID_GYRO_Z_FST;
+ g_st_selection_itemlist[30].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[31].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_POSLLH;
+ g_st_selection_itemlist[31].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[32].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_STATUS;
+ g_st_selection_itemlist[32].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[33].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC;
+ g_st_selection_itemlist[33].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[34].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_VELNED;
+ g_st_selection_itemlist[34].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[35].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_DOP;
+ g_st_selection_itemlist[35].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[36].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS;
+ g_st_selection_itemlist[36].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[37].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_SVINFO;
+ g_st_selection_itemlist[37].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[38].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_CLOCK;
+ g_st_selection_itemlist[38].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[39].ul_did = VEHICLE_DID_GPS_UBLOX_MON_HW;
+ g_st_selection_itemlist[39].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[40].ul_did = POSHAL_DID_SPEED_PULSE_FLAG;
+ g_st_selection_itemlist[40].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[41].ul_did = VEHICLE_DID_GYRO_TROUBLE;
+ g_st_selection_itemlist[41].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[41].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[42].ul_did = VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL;
+ g_st_selection_itemlist[42].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[42].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[43].ul_did = VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL;
+ g_st_selection_itemlist[43].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[43].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[44].ul_did = VEHICLE_DID_GYRO_CONNECT_STATUS;
+ g_st_selection_itemlist[44].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[44].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[45].ul_did = POSHAL_DID_SPEED_PULSE_FLAG_FST;
+ g_st_selection_itemlist[45].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[46].ul_did = POSHAL_DID_REV_FST;
+ g_st_selection_itemlist[46].ul_canid = VEHICLESENS_INVALID;
+ uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[46].uc_get_method = uc_get_method;
+ g_st_selection_itemlist[47].ul_did = POSHAL_DID_GPS_NMEA;
+ g_st_selection_itemlist[47].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[48].ul_did = POSHAL_DID_GPS_TIME;
+ g_st_selection_itemlist[48].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[48].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[49].ul_did = VEHICLE_DID_NAVIINFO_DIAG_GPS;
+ g_st_selection_itemlist[49].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[49].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[50].ul_did = POSHAL_DID_GYRO_TEMP;
+ g_st_selection_itemlist[50].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[50].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[51].ul_did = POSHAL_DID_GYRO_TEMP_FST;
+ g_st_selection_itemlist[51].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[51].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[52].ul_did = POSHAL_DID_GSNS_X_FST;
+ g_st_selection_itemlist[52].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[52].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[53].ul_did = POSHAL_DID_GSNS_Y_FST;
+ g_st_selection_itemlist[53].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[53].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[54].ul_did = POSHAL_DID_GSNS_Z_FST;
+ g_st_selection_itemlist[54].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[54].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[55].ul_did = VEHICLE_DID_LOCATION_LONLAT;
+ g_st_selection_itemlist[55].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[55].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[56].ul_did = VEHICLE_DID_LOCATION_ALTITUDE;
+ g_st_selection_itemlist[56].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[56].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[57].ul_did = VEHICLE_DID_MOTION_HEADING;
+ g_st_selection_itemlist[57].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[57].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[58].ul_did = VEHICLE_DID_LOCATION_LONLAT_NAVI;
+ g_st_selection_itemlist[58].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[58].uc_get_method = VEHICLESENS_GETMETHOD_NAVI;
+ g_st_selection_itemlist[59].ul_did = VEHICLE_DID_LOCATION_ALTITUDE_NAVI;
+ g_st_selection_itemlist[59].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[59].uc_get_method = VEHICLESENS_GETMETHOD_NAVI;
+ g_st_selection_itemlist[60].ul_did = VEHICLE_DID_MOTION_HEADING_NAVI;
+ g_st_selection_itemlist[60].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[60].uc_get_method = VEHICLESENS_GETMETHOD_NAVI;
+ g_st_selection_itemlist[61].ul_did = VEHICLE_DID_SETTINGTIME;
+ g_st_selection_itemlist[61].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[61].uc_get_method = VEHICLESENS_GETMETHOD_OTHER;
+ g_st_selection_itemlist[62].ul_did = VEHICLE_DID_MOTION_SPEED;
+ g_st_selection_itemlist[62].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[62].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[63].ul_did = VEHICLE_DID_MOTION_SPEED_NAVI;
+ g_st_selection_itemlist[63].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[63].uc_get_method = VEHICLESENS_GETMETHOD_NAVI;
+ g_st_selection_itemlist[64].ul_did = VEHICLE_DID_MOTION_SPEED_INTERNAL;
+ g_st_selection_itemlist[64].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[64].uc_get_method = VEHICLESENS_GETMETHOD_INTERNAL;
+ g_st_selection_itemlist[65].ul_did = POSHAL_DID_PULSE_TIME;
+ g_st_selection_itemlist[65].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[65].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[66].ul_did = POSHAL_DID_GPS_TIME_RAW;
+ g_st_selection_itemlist[66].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[66].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[67].ul_did = POSHAL_DID_GPS_WKNROLLOVER;
+ g_st_selection_itemlist[67].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[67].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[68].ul_did = POSHAL_DID_GPS_CLOCK_DRIFT;
+ g_st_selection_itemlist[68].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[68].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[69].ul_did = POSHAL_DID_GPS_CLOCK_FREQ;
+ g_st_selection_itemlist[69].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[69].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+#else
+ g_st_selection_itemlist[26].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_POSLLH;
+ g_st_selection_itemlist[26].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[27].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_STATUS;
+ g_st_selection_itemlist[27].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[28].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC;
+ g_st_selection_itemlist[28].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[29].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_VELNED;
+ g_st_selection_itemlist[29].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[30].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_DOP;
+ g_st_selection_itemlist[30].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[31].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS;
+ g_st_selection_itemlist[31].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[32].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_SVINFO;
+ g_st_selection_itemlist[32].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[33].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_CLOCK;
+ g_st_selection_itemlist[33].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[34].ul_did = VEHICLE_DID_GPS_UBLOX_MON_HW;
+ g_st_selection_itemlist[34].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[35].ul_did = POSHAL_DID_SPEED_PULSE_FLAG;
+ g_st_selection_itemlist[35].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[36].ul_did = VEHICLE_DID_GYRO_TROUBLE;
+ g_st_selection_itemlist[36].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[36].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[37].ul_did = VEHICLE_DID__CWORD56__GPS_INTERRUPT_SIGNAL;
+ g_st_selection_itemlist[37].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[37].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[38].ul_did = VEHICLE_DID__CWORD102__GPS_INTERRUPT_SIGNAL;
+ g_st_selection_itemlist[38].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[38].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[39].ul_did = VEHICLE_DID_GYRO_CONNECT_STATUS;
+ g_st_selection_itemlist[39].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[39].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+#endif
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSelectionItemList
+* ABSTRACT : Vehicle sensor_data acquisition method GET function
+* FUNCTION : Provide data acquisition methods
+* ARGUMENT : ul_did Data ID
+* NOTE :
+* RETURN : VEHICLESENS_GETMETHOD_CAN :CAN line
+* VEHICLESENS_GETMETHOD_LINE :Direct Line
+* VEHICLESENS_GETMETHOD_NO_DETECTION :Not downloaded
+* VEHICLESENS_GETMETHOD_GPS :GPS
+* VEHICLESENS_GETMETHOD_NAVI :Navi
+* VEHICLESENS_GETMETHOD_CLOCK :Clock
+* VEHICLESENS_GETMETHOD_OTHER :Others
+******************************************************************************/
+u_int8 VehicleSensGetSelectionItemList(DID ul_did) {
+ int32 i;
+ u_int8 uc_get_method = VEHICLESENS_GETMETHOD_NO_DETECTION;
+ /* Ignore->MISRA-C++:2008 Rule 2-13-3 */ /* Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
+ if ( (ul_did & VEHICLESENS_BIT31_29) != 0 ) {
+ /* For other than CAN frame data */
+ for (i = 0; i < VEHICLESENS_SELECTION_ITEM_LIST_LEN; i++) {
+ if (g_st_selection_itemlist[i].ul_did == ul_did) {
+ uc_get_method = g_st_selection_itemlist[i].uc_get_method;
+ break;
+ }
+ }
+ } else {
+ /* CAN frame data */
+ uc_get_method = VEHICLESENS_GETMETHOD_CAN;
+ }
+ return uc_get_method;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSelectionItemListCanId
+* ABSTRACT : Vehicle Sensor Selection Item List_CANID GET Function
+* FUNCTION : Provide CANID
+* ARGUMENT :
+* NOTE :
+* RETURN : ul_canid CANID
+******************************************************************************/
+u_int32 VehicleSensGetSelectionItemListCanId(DID ul_did) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i;
+ u_int32 ul_canid = VEHICLESENS_INVALID;
+
+ for (i = 0; i < VEHICLESENS_SELECTION_ITEM_LIST_LEN; i++) {
+ if (g_st_selection_itemlist[i].ul_did == ul_did) {
+ if (VEHICLESENS_GETMETHOD_CAN == g_st_selection_itemlist[i].uc_get_method) {
+ /* When the data source type is CAN communication */
+ ul_canid = g_st_selection_itemlist[i].ul_canid;
+ }
+ break;
+ }
+ }
+ return ul_canid;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSelectionItemListCanId
+* ABSTRACT : Vehicle Sensor Selection Item List_CANID SET Function
+* FUNCTION : Sets when the CANID associated with the specified DID is unconfirmed.
+* ARGUMENT : ul_canid u-int32(CANID)
+* NOTE :
+* RETURN : TRUE :Successful registration(Including when the CANID is fixed)
+* : FALSE :Registration failure
+******************************************************************************/
+BOOL VehicleSensSetSelectionItemListCanId(DID ul_did, u_int32 ul_canid) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL b_ret = TRUE;
+ u_int8 uc_cnt = 0;
+ int32 uc_last_cnt = 0;
+
+ u_int8 uc_effective_flg = VEHICLESENS_EFFECTIVE;
+
+ for (uc_cnt = 0; uc_cnt < VEHICLE_COMM_WATCHTBL_DID_NUM; uc_cnt++) {
+ if (g_st_comm_watchtbl[uc_cnt].ul_did == ul_did) {
+ /* Obtain CANID determination flg */
+ uc_effective_flg = g_st_comm_watchtbl[uc_cnt].uc_effective_flg;
+ break;
+ }
+ }
+
+ if (uc_cnt >= VEHICLE_COMM_WATCHTBL_DID_NUM) {
+ return FALSE;
+ }
+
+ if (VEHICLESENS_EFFECTIVE != uc_effective_flg) {
+ /* When the CANID is undetermined */
+ b_ret = FALSE;
+ for (uc_last_cnt = 0; uc_last_cnt < VEHICLESENS_SELECTION_ITEM_LIST_LEN; uc_last_cnt++) {
+ if (g_st_selection_itemlist[uc_last_cnt].ul_did == ul_did) {
+ /* Updating the CANID of the Vehicle Sensor Selection Items List */
+ g_st_selection_itemlist[uc_last_cnt].ul_canid = ul_canid;
+ /* To fix the CANID */
+ g_st_comm_watchtbl[uc_cnt].uc_effective_flg = VEHICLESENS_EFFECTIVE;
+
+ /* During CANID indoubt,When Vehicle API ""Vehicle Sensor Information Disruption Monitoring"" is called */
+ /* Register for disruption monitoring of pending CAN threads */
+ if (0x00 < g_st_comm_watchtbl[uc_cnt].uc_vehicle_comm_watch_cnt) {
+ VehicleSensCommWatchTblRun(ul_did);
+ }
+ b_ret = TRUE;
+ break;
+ }
+ }
+ }
+ return b_ret;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensCommWatchTblInit
+* ABSTRACT : Disruption monitoring data management table initialization function
+* FUNCTION : Disruption monitoring data management table initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensCommWatchTblInit(void) {
+ memset(&g_st_comm_watchtbl, 0x00, sizeof(g_st_comm_watchtbl));
+
+ /* DID initialization */
+ g_st_comm_watchtbl[0].ul_did = VEHICLE_DID_REV;
+ g_st_comm_watchtbl[1].ul_did = VEHICLE_DID_REV_CAN;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensCommWatchTblSave
+* ABSTRACT : Disruption monitoring data management table storage function
+* FUNCTION : When the target CANID is undetermined, save the discontinuation monitoring data...
+* ARGUMENT :
+* NOTE :
+* RETURN : TRUE : To fix the CANID
+* : FALSE : CANID undetermined
+******************************************************************************/
+BOOL VehicleSensCommWatchTblSave(const VEHICLE_MSG_WATCH_STOPPAGE *pst_msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL b_ret = TRUE; /* Function return value */
+ u_int8 uc_cnt = 0; /* Generic counters */
+ u_int8 uc_last_cnt = 0; /* Vehicle Sensor Information Disruption Monitoring Request Count */
+ u_int8 uc_get_method = VEHICLESENS_GETMETHOD_CAN; /* Acquisition method */
+ u_int8 uc_effective_flg = VEHICLESENS_EFFECTIVE; /* CANID determination flg */
+
+
+ uc_get_method = VehicleSensGetSelectionItemList(pst_msg->st_data.ul_did);
+
+ /* If the retrieval method is CAN: Check if the CANID is fixed */
+ if (VEHICLESENS_GETMETHOD_CAN == uc_get_method) {
+ for ( uc_cnt = 0; uc_cnt < VEHICLE_COMM_WATCHTBL_DID_NUM; uc_cnt++ ) {
+ if ( g_st_comm_watchtbl[uc_cnt].ul_did == pst_msg->st_data.ul_did ) {
+ /* Obtain CANID determination flg */
+ uc_effective_flg = g_st_comm_watchtbl[uc_cnt].uc_effective_flg;
+ break;
+ }
+ }
+ }
+
+ if ( VEHICLESENS_EFFECTIVE != uc_effective_flg ) {
+ /* Due to being asked for disruption monitoring of CANID indoubt data,Keep parameters required for disruption monitoring */
+ /* Returns success to the API user,No Disruption Monitoring Registration at this time */
+ /* Ask the CAN thread to monitor for disruption when the CANID is fixed. */
+
+ uc_last_cnt = g_st_comm_watchtbl[uc_cnt].uc_vehicle_comm_watch_cnt;
+ if ( VEHICLE_COMM_WATCHTBL_DAT_NUM > uc_last_cnt ) {
+ /* Destination PNO,Keep Disrupted Monitoring Time */
+ g_st_comm_watchtbl[uc_cnt].st_comm_watch_dat[uc_last_cnt].us_pno = pst_msg->st_data.us_pno;
+ g_st_comm_watchtbl[uc_cnt].st_comm_watch_dat[uc_last_cnt].us_watch_time = pst_msg->st_data.us_watch_time;
+
+ /* Vehicle sensor information disruption monitoring request count is incremented. */
+ uc_last_cnt++;
+ g_st_comm_watchtbl[uc_cnt].uc_vehicle_comm_watch_cnt = uc_last_cnt;
+ }
+ b_ret = FALSE;
+ }
+ return b_ret;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensCommWatchTblRun
+* ABSTRACT : Disruption monitoring data management table execution function
+* FUNCTION : Execute requested disruption monitoring when CANID is unconfirmed
+* ARGUMENT : ul_did DID
+* NOTE :
+* RETURN : TRUE : Normal completion
+* : FALSE : ABENDs
+******************************************************************************/
+BOOL VehicleSensCommWatchTblRun(DID ul_did) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL b_ret = TRUE;
+
+ return b_ret;
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_SharedMemory.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_SharedMemory.cpp
new file mode 100755
index 0000000..1fc9954
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_SharedMemory.cpp
@@ -0,0 +1,521 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_SharedMemory.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor shared memory management
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_SharedMemory.h"
+#include "Sensor_API.h"
+#include "VehicleSens_DataMaster.h"
+#include "Sensor_API_private.h"
+#include "SensorLocation_API.h"
+#include "SensorLocation_API_private.h"
+
+/********************************************************************************
+ * prototype declalation *
+ ********************************************************************************/
+static void VehicleSensLinkSharedMemory(char *shared_memory_name, void **p_share_addr);
+static RET_API VehicleSensWriteDataGpsInterruptSignal(DID ul_did);
+static RET_API VehicleSensWriteDataGyroConnectStatus(DID ul_did);
+static RET_API VehicleSensWriteDataLocalTime(void);
+static RET_API VehicleSensWriteDataLonLat(void);
+
+/********************************************************************************
+ * Definition *
+ ********************************************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSharedMemory
+* ABSTRACT : Shared Memory Initialization
+* FUNCTION : Initialize shared memory
+* ARGUMENT : None
+* NOTE :
+* RETURN : RET_NORMAL :Normal
+* : RET_ERROR :Abnormality
+******************************************************************************/
+RET_API VehicleSensInitSharedMemory(void) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API l_ret; /* Return of the functions */
+
+ /* All shared memory initialization */
+ l_ret = VehicleSensWriteDataGpsInterruptSignal(VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL);
+ if (l_ret == RET_NORMAL) {
+ l_ret = VehicleSensWriteDataGpsInterruptSignal(VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL);
+ }
+ if (l_ret == RET_NORMAL) {
+ l_ret = VehicleSensWriteDataGyroConnectStatus(VEHICLE_DID_GYRO_CONNECT_STATUS);
+ }
+
+ /* Initializes the effective ephemeris count when the shared memory is shut down. */
+ if (l_ret == RET_NORMAL) {
+ l_ret = VehicleSensWriteDataValidEphemerisNum(0); /* Initialized with effective ephemeris number 0 */
+ }
+
+ /* Writes the value read from the non-volatile memory to the shared memory. */
+ /* This process is executed only at startup.,After that, the shared memory will not be overwritten. */
+ if (l_ret == RET_NORMAL) {
+ l_ret = VehicleSensWriteDataLocalTime();
+ }
+
+ if (l_ret == RET_NORMAL) {
+ l_ret = VehicleSensWriteDataLonLat();
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensLinkSharedMemory
+* ABSTRACT : Shared memory link
+* FUNCTION : Link to shared memory
+* ARGUMENT :
+* NOTE :
+* RETURN : None
+******************************************************************************/
+static void VehicleSensLinkSharedMemory(char *shared_memory_name, void **p_share_addr) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api;
+ void *pv_share_mem; /* Store Shared Memory Address */
+ u_int32 ul_share_mem_size; /* Size of the linked shared memory */
+
+ /* Link to the handle storage area */
+ ret_api = _pb_LinkShareData(shared_memory_name, &pv_share_mem, &ul_share_mem_size);
+
+ if (ret_api == RET_NORMAL) {
+ /* If the link is successful */
+ *p_share_addr = pv_share_mem; /* Set the address */
+ } else {
+ /* If the link fails */
+ *p_share_addr = NULL;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteDataGpsInterruptSignal
+* ABSTRACT : Writing of data
+* FUNCTION : Writing Data to Shared Memory
+* ARGUMENT : DID : Data ID
+* NOTE :
+* RETURN : RET_NORMAL :Normal
+* : RET_ERROR :Abnormality
+******************************************************************************/
+static RET_API VehicleSensWriteDataGpsInterruptSignal(DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static GPS_INTERRUPT *gpsInterruptSharedAddr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL pst_data;
+
+ RET_API l_ret = RET_NORMAL; /* Return of the functions */
+ RET_API l_ret_api; /* Return of the functions */
+
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(GPS_INTERRUPT_SIGNAL_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ l_ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (l_ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (gpsInterruptSharedAddr == NULL) {
+ /* Link to shared memory */
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ VehicleSensLinkSharedMemory(const_cast<char *>(GPS_INTERRUPT_SIGNAL_SHARE_NAME),
+ reinterpret_cast<void **>(&gpsInterruptSharedAddr));
+ }
+
+ if (gpsInterruptSharedAddr != NULL) {
+ /* The link to shared memory is successful. */
+ switch (ul_did) {
+ case VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL:
+ {
+ /* Get data from data master */
+ VehicleSensGetDataMasterMainGpsInterruptSignal(ul_did, 0, &pst_data);
+
+ /* Writing Data to Shared Memory */
+ gpsInterruptSharedAddr->_CWORD102__interrupt = pst_data.uc_data;
+ break;
+ }
+ case VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL:
+ {
+ /* Get data from data master */
+ VehicleSensGetDataMasterSysGpsInterruptSignal(ul_did, 0, &pst_data);
+
+ /* Writing Data to Shared Memory */
+ gpsInterruptSharedAddr->_CWORD56__interrupt = pst_data.uc_data;
+ break;
+ }
+ default:
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "DID is unknown. \r\n");
+ break;
+ }
+
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "gpsInterruptSharedAddr == NULL \r\n");
+ }
+
+ /* Semaphore unlock */
+ (void)_pb_SemUnlock(sem_id);
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteDataGyroConnectStatus
+* ABSTRACT : Writing of data
+* FUNCTION : Writing Data to Shared Memory
+* ARGUMENT : DID : Data ID
+* NOTE :
+* RETURN : RET_NORMAL :Normal
+* : RET_ERROR :Abnormality
+******************************************************************************/
+static RET_API VehicleSensWriteDataGyroConnectStatus(DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static u_int8 *gyroConnectSharedAddr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS pst_data;
+
+ RET_API l_ret = RET_NORMAL; /* Return of the functions */
+ RET_API l_ret_api; /* Return of the functions */
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(GYRO_CONNECT_STATUS_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ l_ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (l_ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (gyroConnectSharedAddr == NULL) {
+ /* Link to shared memory */
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ VehicleSensLinkSharedMemory(const_cast<char *>(GYRO_CONNECT_STATUS_SHARE_NAME),
+ reinterpret_cast<void **>(&gyroConnectSharedAddr));
+ }
+
+ if (gyroConnectSharedAddr != NULL) {
+ /* The link to shared memory is successful. */
+
+ /* Get data from data master */
+ VehicleSensGetDataMasterGyroConnectStatus(ul_did, 0, &pst_data);
+
+ /* Writing Data to Shared Memory */
+ *gyroConnectSharedAddr = pst_data.uc_data;
+
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "gyroConnectSharedAddr == NULL \r\n");
+ }
+
+ /* Semaphore unlock */
+ (void)_pb_SemUnlock(sem_id);
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteDataValidEphemerisNum
+* ABSTRACT : Write effective ephemeris number at shutdown
+* FUNCTION : Write effective ephemeris number at shutdown to shared memory
+* ARGUMENT : u_int8 valid_ephemer_isnum : Number of effective ephemeris written to shared memory during shutdown
+* NOTE :
+* RETURN : RET_NORMAL :Normal
+* : RET_ERROR :Abnormality
+******************************************************************************/
+RET_API VehicleSensWriteDataValidEphemerisNum(u_int8 valid_ephemer_isnum) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static u_int8 *shared_addr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ RET_API l_ret; /* Return of the functions */
+ RET_API l_ret_api; /* Return of the functions */
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(EPHEMERIS_NUM_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ l_ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (l_ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (shared_addr == NULL) {
+ /* Link to shared memory */
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ VehicleSensLinkSharedMemory(const_cast<char *>(EPHEMERIS_NUM_SHARE_NAME),
+ reinterpret_cast<void **>(&shared_addr));
+ }
+
+ if (shared_addr != NULL) {
+ *shared_addr = valid_ephemer_isnum;
+ l_ret = RET_NORMAL;
+
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "shared_addr == NULL \r\n");
+ }
+
+ /* Semaphore unlock */
+ l_ret_api = _pb_SemUnlock(sem_id);
+ if (l_ret_api != RET_NORMAL) {
+ /* Semaphore unlock failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemUnlock failed");
+ }
+ } else {
+ /* Semaphore ID acquisition failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteDataLocalTime
+* ABSTRACT : Writing Local Time at Shutdown
+* FUNCTION : Write local time on shutdown to shared memory
+* ARGUMENT : None
+* NOTE :
+* RETURN : RET_NORMAL :Acquisition normal
+* : RET_ERROR :Acquisition anomaly
+******************************************************************************/
+static RET_API VehicleSensWriteDataLocalTime(void) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static LOCALTIME *shared_addr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ RET_API l_ret; /* Return of the functions */
+ RET_API l_ret_api; /* Return of the functions */
+
+ LOCALTIME LocalTime;
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(LOCALTIME_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ l_ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (l_ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (shared_addr == NULL) {
+ /* Link to shared memory */
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ VehicleSensLinkSharedMemory(const_cast<char *>(LOCALTIME_SHARE_NAME),
+ reinterpret_cast<void **>(&shared_addr));
+ }
+
+ if (shared_addr != NULL) {
+ /* The link to shared memory is successful. */
+
+ /* Acquires data from the non-volatile memory and writes it to the shared memory. */
+ l_ret_api = VehicleSensReadNVLocalTime(&LocalTime);
+ if (l_ret_api == RET_NORMAL) {
+ *shared_addr = LocalTime;
+ l_ret = RET_NORMAL;
+ } else {
+ /* When data acquisition from non-volatile memory fails,Set an invalid value */
+ (*shared_addr).status = CLOCK_INVALID;
+ (*shared_addr).year = 0xFFFFU; /* invalid */
+ (*shared_addr).month = 255U; /* invalid */
+ (*shared_addr).day = 255U; /* invalid */
+ (*shared_addr).hour = 255U; /* invalid */
+ (*shared_addr).min = 255U; /* invalid */
+ (*shared_addr).sec = 255U; /* invalid */
+ l_ret = RET_NORMAL;
+ }
+
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "shared_addr == NULL \r\n");
+ }
+
+ /* Semaphore unlock */
+ l_ret_api = _pb_SemUnlock(sem_id);
+ if (l_ret_api != RET_NORMAL) {
+ /* Semaphore unlock failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemUnlock failed");
+ }
+ } else {
+ /* Semaphore ID acquisition failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteDataLonLat
+* ABSTRACT : Write position at shutdown
+* FUNCTION : Write shutdown position to shared memory
+* ARGUMENT : None
+* NOTE :
+* RETURN : RET_NORMAL :Successful acquisition
+* : RET_ERROR :Failed to acquire
+******************************************************************************/
+static RET_API VehicleSensWriteDataLonLat(void) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static LONLAT *shared_addr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ RET_API l_ret; /* Return of the functions */
+ RET_API l_ret_api; /* Return of the functions */
+
+ LONLAT lonlat; /* Position */
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(LONLAT_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ l_ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (l_ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (shared_addr == NULL) {
+ /* Link to shared memory */
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ VehicleSensLinkSharedMemory(const_cast<char *>(LONLAT_SHARE_NAME),
+ reinterpret_cast<void **>(&shared_addr));
+ }
+
+ if (shared_addr != NULL) {
+ /* The link to shared memory is successful. */
+
+ /* Acquires data from the non-volatile memory and writes it to the shared memory. */
+ l_ret_api = VehicleSensReadNVLonLat(&lonlat);
+ if (l_ret_api == RET_NORMAL) {
+ *shared_addr = lonlat;
+ l_ret = RET_NORMAL;
+ } else {
+ /* When data acquisition from non-volatile memory fails */
+ (*shared_addr).latitude = SENSORLOCATION_LATITUDE_INIT_VALUE;
+ (*shared_addr).longitude = SENSORLOCATION_LONGITUDE_INIT_VALUE;
+ l_ret = RET_NORMAL;
+ }
+
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "shared_addr == NULL \r\n");
+ }
+
+ /* Semaphore unlock */
+ l_ret_api = _pb_SemUnlock(sem_id);
+ if (l_ret_api != RET_NORMAL) {
+ /* Semaphore unlock failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemUnlock failed");
+ }
+ } else {
+ /* Semaphore ID acquisition failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteSharedMemory
+* ABSTRACT : Write Shared Memory
+* FUNCTION : Write Shared Memory
+* ARGUMENT : DID : Data ID
+* RETURN : None
+* NOTE :
+******************************************************************************/
+void VehicleSensWriteSharedMemory(DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (ul_did) {
+ case VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL:
+ case VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL:
+ {
+ (void)VehicleSensWriteDataGpsInterruptSignal(ul_did);
+ break;
+ }
+ case VEHICLE_DID_GYRO_CONNECT_STATUS:
+ {
+ (void)VehicleSensWriteDataGyroConnectStatus(ul_did);
+ break;
+ }
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DID is unknown. \r\n");
+ break;
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleSens_Thread.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Thread.cpp
new file mode 100755
index 0000000..8dc3922
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleSens_Thread.cpp
@@ -0,0 +1,2144 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Thread.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor thread
+ * Module configuration :VehicleSensThread() Vehicle Sensor Thread Domain Functions
+ * :VehicleSensThreadInit() Vehicle sensor thread initials
+ * :VehicleSensDeliveryEntry() Vehicle sensor information delivery registration
+ * :VehicleSensGetVehicleData() Vehicle sensor information acquisition
+ * :VehicleSensWatchStopPage() Vehicle sensor interruption monitoring
+ * :VehicleSensPkgDeliveryEntry() Vehicle sensor information package delivery registration
+ * :VehicleSensGetVehiclePkgData() Vehicle sensor information package data acquisition
+ * :VehicleSensLineSensDataDelivery() LineSensor Vehicle Signal Notification
+ * :VehicleSensGpsDataDelivery() GPS data notification
+ * :VehicleSens_CanDataDelivery() CAN data delivery notice
+ * :VehicleSensDataMasterSetN() Data master set notification process(Callback function)
+ * :VehicleSensSetVehicleData() GPS command request processing
+ ******************************************************************************/
+#include "VehicleSens_Thread.h"
+#include <vehicle_service/positioning_base_library.h>
+#include <other_service/VP_GetEnv.h>
+#include "POS_private.h"
+#include "positioning_common.h"
+#include "SensorLog.h"
+#include "VehicleUtility.h"
+#include "VehicleSensor_Thread.h"
+
+#include "VehicleIf.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLE_MSG_BUF g_wait_for_resp_msg; /* Message waiting to receive a response */
+static PFUNC_DMASTER_SET_N g_wait_for_resp_set_n; /* Response waiting data master set */
+static BOOL g_sent_fst_pkg_delivery_ext; /* Initial expansion package data delivery status */
+
+static VEHICLESENS_VEHICLE_SPEED_INFO g_vehicle_speed_info;
+
+uint32_t gPseudoSecClockCounter = 0u;
+
+/*************************************************/
+/* Function prototype */
+/*************************************************/
+static void VehicleSensInitDataDisrptMonitor(void);
+static void VehicleSensDataDisrptMonitorProc(DID did);
+static void VehicleSensRcvMsgTout(TimerToutMsg* rcv_msg);
+
+static void VehilceSens_InitVehicleSpeed(void);
+static void VehicleSens_StoreVehicleSpeed(VEHICLESENS_VEHICLE_SPEED_DAT* pVehicleSpeed);
+static void VehicleSens_LoadVehicleSpeed(VEHICLESENS_VEHICLE_SPEED_INFO* pVehicleSpeedInfo);
+static RET_API VehicleSens_CatNmeaSentenceFieldWithDelimiter(char* str1, const size_t size, const char* str2, const size_t n);
+static RET_API VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(char* str1, const size_t size, const char* str2, const size_t n);
+static inline RET_API VehicleSens_GeneratePASCDFieldId(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldTimestamp(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldSensorType(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldTransmissionState(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldSlipDetect(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldSampleCount(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldTimeOffsetNSpeed(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldChecksum(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldCRLF(char* pascd, size_t size);
+static RET_API VehicleSens_DeriveTransmissionStateFor_CWORD27_(VEHICLESENS_TRANSMISSION_PKG* pPkg);
+
+
+/*******************************************************************************
+* MODULE : VehicleSensThread
+* ABSTRACT : Vehicle Sensor Thread Domain Functions
+* FUNCTION : Main processing
+* ARGUMENT : lpv_para :
+* NOTE :
+* RETURN :
+******************************************************************************/
+EFrameworkunifiedStatus VehicleSensThread(HANDLE h_app) {
+ RET_API ret_api = RET_NORMAL; /* Return Values of System API Functions */
+ T_APIMSG_MSGBUF_HEADER *p; /* Message header */
+ RET_API ret_val; /* Return value of initialization processing */
+ VEHICLE_MSG_DELIVERY_ENTRY delivery_entry;
+
+ static u_int8 msg_buf[MAX_MSG_BUF_SIZE]; /* message buffer */
+
+ void* p_msg_buf = &msg_buf;
+ LSDRV_MSG_LSDATA_G** p_lsdrv_msg;
+ VEHICLE_MSG_BUF** p_vehicle_msg;
+ POS_MSGINFO *p_pos_msg;
+
+
+
+ p_lsdrv_msg = reinterpret_cast<LSDRV_MSG_LSDATA_G**>(&p_msg_buf);
+ p_vehicle_msg = reinterpret_cast<VEHICLE_MSG_BUF**>(&p_msg_buf);
+
+ VehicleUtilityInitTimer();
+ (void)PosSetupThread(h_app, ETID_POS_MAIN);
+
+ memset(&(delivery_entry), 0, sizeof(VEHICLE_MSG_DELIVERY_ENTRY));
+
+ /* Thread initialization process */
+ ret_val = VehicleSensThreadInit();
+
+ gPseudoSecClockCounter = 0u;
+
+ if (RET_NORMAL == ret_val) { // LCOV_EXCL_BR_LINE 6: always be RET_NORMAL
+ while (1) {
+ /* Message reception processing */
+ p_msg_buf = &msg_buf;
+ ret_api = _pb_RcvMsg(PNO_VEHICLE_SENSOR, sizeof(msg_buf), &p_msg_buf, RM_WAIT);
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[ret_api = 0x%x]",
+ ret_api);
+
+ /* When the message is received successfully */
+ if (ret_api == RET_RCVMSG) {
+ p = reinterpret_cast<T_APIMSG_MSGBUF_HEADER *>(p_msg_buf);
+
+ switch (p->hdr.cid) { // LCOV_EXCL_BR_LINE 200: some DID is not used
+ case CID_VEHICLEIF_DELIVERY_ENTRY:
+ {
+ memcpy(&(delivery_entry), &(p_msg_buf), sizeof(VEHICLE_MSG_DELIVERY_ENTRY));
+
+ /* Sort by received DID */
+ switch (delivery_entry.data.did) { // LCOV_EXCL_BR_LINE 200: DR DID is not used
+ case VEHICLE_DID_DR_ALTITUDE :
+ case VEHICLE_DID_DR_LATITUDE :
+ case VEHICLE_DID_DR_SPEED :
+ case VEHICLE_DID_DR_HEADING :
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL :
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL :
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensDrDeliveryEntry((const VEHICLE_MSG_DELIVERY_ENTRY *)p_msg_buf);
+ // LCOV_EXCL_STOP
+ }
+ break;
+ default:
+ /* Vehicle sensor information delivery registration */
+ VehicleSensDeliveryEntry((const VEHICLE_MSG_DELIVERY_ENTRY *)p_msg_buf);
+ break;
+ }
+ break;
+ }
+ case CID_VEHICLEIF_GET_VEHICLE_DATA:
+ {
+ /* Vehicle sensor information acquisition */
+ VehicleSensGetVehicleData((const VEHICLE_MSG_GET_VEHICLE_DATA *)p_msg_buf);
+ break;
+ }
+ case CID_LINESENS_VEHICLE_DATA:
+ {
+ /* LineSensor Vehicle Signal Notification */
+ VehicleSensLineSensDataDelivery((const LSDRV_MSG_LSDATA *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ }
+ case CID_LINESENS_VEHICLE_DATA_G:
+ {
+ /* Data disruption monitoring process */
+ VehicleSensDataDisrptMonitorProc(
+ (reinterpret_cast<LSDRV_MSG_LSDATA_G*>(*p_lsdrv_msg))->st_para.st_data[0].ul_did);
+ VehicleSensLineSensDataDeliveryG((const LSDRV_MSG_LSDATA_G *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ }
+ case CID_LINESENS_VEHICLE_DATA_GYRO_TROUBLE:
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Gyro Failure Status Notification */
+ VehicleSensLineSensDataDeliveryGyroTrouble((const LSDRV_MSG_LSDATA_GYRO_TROUBLE *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_LINESENS_VEHICLE_DATA_SYS_GPS_INTERRUPT_SIGNAL:
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* SYS GPS interrupt notification */
+ VehicleSensLineSensDataDeliverySysGpsInterruptSignal(
+ (const LSDRV_MSG_LSDATA_GPS_INTERRUPT_SIGNAL *)p_msg_buf,
+ (PFUNC_DMASTER_SET_SHARED_MEMORY)VehicleSensDataMasterSetSharedMemory);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_LINESENS_VEHICLE_DATA_GYRO_CONNECT_STATUS:
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Gyro Failure Status Notification */
+ VehicleSensLineSensDataDeliveryGyroConnectStatus(
+ (const LSDRV_MSG_LSDATA_GYRO_CONNECT_STATUS *)p_msg_buf,
+ (PFUNC_DMASTER_SET_SHARED_MEMORY)VehicleSensDataMasterSetSharedMemory);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_LINESENS_VEHICLE_DATA_GPS_ANTENNA_STATUS:
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* GPS antenna failure status notification */
+ VehicleSensLineSensDataDeliveryGpsAntennaStatus(
+ (const LSDRV_MSG_LSDATA_GPS_ANTENNA_STATUS *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT:
+ {
+ /* Vehicle Sensor Information Extended Package Delivery Registration */
+ VehicleSensPkgDeliveryEntryExt((const SENSOR_MSG_DELIVERY_ENTRY *)p_msg_buf);
+ break;
+ }
+ case CID_LINESENS_VEHICLE_DATA_FST:
+ {
+ /* LineSensor Vehicle Initial Sensor Signal Notification */
+ VehicleSensLineSensDataDeliveryFstG((const LSDRV_MSG_LSDATA_FST *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ }
+ case CID_GPS_DATA:
+ {
+ /* GPS information notification */
+ VehicleSensGpsDataDelivery(reinterpret_cast<SENSOR_MSG_GPSDATA *>(p_msg_buf),
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN,
+ (PFUNC_DMASTER_SET_SHARED_MEMORY)VehicleSensDataMasterSetSharedMemory);
+ break;
+ }
+ case CID_POSIF_SET_DATA:
+ {
+ p_pos_msg =
+ reinterpret_cast<POS_MSGINFO*>((reinterpret_cast<VEHICLE_MSG_BUF*>(*p_vehicle_msg))->data);
+ /* Data disruption monitoring process */
+ VehicleSensDataDisrptMonitorProc(p_pos_msg->did);
+
+ /* Data Setting Notification */
+ VehicleSensCommonDataDelivery((const VEHICLE_MSG_BUF *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ }
+ case CID_GPS_RETTIMESETTING:
+ {
+ /* GPS time setting result notification */
+ VehicleSensGpsTimeDelivery((const VEHICLE_MSG_BUF *)p_msg_buf);
+ break;
+ }
+ case CID_DEAD_RECKONING_GPS_DATA : /* GPS data distribution for DR */
+ case CID_DEAD_RECKONING_SENS_DATA : /* Sensor Data Delivery for DR */
+ case CID_DEAD_RECKONING_SENS_FST_DATA : /* Initial Sensor Data Delivery for DR */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensDrRcvMsg((const DEAD_RECKONING_RCVDATA *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_VEHICLEIF_GET_DR_DATA :
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Vehicle sensor information acquisition */
+ DeadReckoningGetDRData((const DEADRECKONING_MSG_GET_DR_DATA *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_DR_MAP_MATCHING_DATA : /* Map matching information */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DeadReckoningSetMapMatchingData((const DR_MSG_MAP_MATCHING_DATA *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_DR_CLEAR_BACKUP_DATA : /* Clear backup data */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DeadReckoningClearBackupData((const DR_MSG_CLEAR_BACKUP_DATA*)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_VEHICLEDEBUG_LOG_GET : /* Log acquisition request */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetLog((const VEHICLEDEBUG_MSG_BUF *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_VEHICLEDEBUG_LOG_SET : /* Log Setting Request */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensSetLog((const VEHICLEDEBUG_MSG_BUF *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CANINPUT_CID_LOCALTIME_NOTIFICATION : /* CAN information acquisition */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensWriteLocalTime((const CANINPUT_MSG_INFO*)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_EPH_NUM_NOTIFICATION : /* Set effective ephemeris count at shutdown */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensSetEphNumSharedMemory((const SENSOR_MSG_GPSDATA *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_SENSORIF__CWORD82__REQUEST:
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Requests to send GPS _CWORD82_ commands */
+ VehicleSensSetVehicleData((const VEHICLE_MSG_SEND *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_THREAD_STOP_REQ:
+ {
+ /* Thread stop processing */
+ VehicleSensThreadStopProcess();
+ break;
+ }
+ case CID_TIMER_TOUT:
+ {
+ /* Timeout notification reception processing */
+ VehicleSensRcvMsgTout(reinterpret_cast<TimerToutMsg*>(p_msg_buf));
+ break;
+ }
+ default:
+ break;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ret_api != RET_RCVMSG\r\n");
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleSens: VehicleSens_MainThread Initial Error!! :%d", ret_val);
+ _pb_Exit();
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensThreadInit
+* ABSTRACT : Vehicle sensor thread initials
+* FUNCTION : Initial process
+* ARGUMENT : void
+* NOTE :
+* RETURN : CAN data delivery registration result
+******************************************************************************/
+RET_API VehicleSensThreadInit(void) {
+ RET_API ret_val = RET_NORMAL;
+
+ /* Initialization of Vehicle Selection Item List Table */
+ VehicleSensInitSelectionItemList();
+
+ /* Vehicle sensor data master initialization */
+ VehicleSensInitDataMaster();
+
+ /* Initialization of shipping destination management table */
+ VehicleSensInitDeliveryCtrlTbl();
+
+ /* Initialization of shipping destination management table management information */
+ VehicleSensInitDeliveryCtrlTblMng();
+
+ /* Initialization of package delivery management table */
+ VehicleSensInitPkgDeliveryTblMng();
+
+ /* Initialization of non-volatile access function block */
+ VehicleSensFromAccessInitialize();
+
+ /* Clear message information waiting to receive a response */
+ (void)memset(&g_wait_for_resp_msg, 0x00, sizeof(VEHICLE_MSG_BUF));
+ g_wait_for_resp_set_n = NULL;
+ g_sent_fst_pkg_delivery_ext = FALSE; /* Initial expansion package data undelivered */
+
+ VehilceSens_InitVehicleSpeed(); /* for PASCD */
+
+ /* Start of data interruption monitoring */
+ VehicleSensInitDataDisrptMonitor();
+ return ret_val;
+}
+
+/*******************************************************************************
+ * MODULE : VehicleSensDeliveryEntry
+ * ABSTRACT : Vehicle sensor information delivery registration
+ * FUNCTION :
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensDeliveryEntry(const VEHICLE_MSG_DELIVERY_ENTRY *msg) {
+ int32 event_val;
+ EventID event_id;
+
+ /* Call the process of creating the delivery destination management table */
+ event_val = static_cast<int32>(VehicleSensEntryDeliveryCtrl(msg));
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(msg->data.pno);
+
+ /* Publish Events */
+ (void)_pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+
+ if (VEHICLE_RET_NORMAL == event_val) {
+ /* Successful delivery registration */
+ /* Deliver data for the first time */
+ VehicleSensFirstDelivery((PNO)(msg->data.pno), (DID)(msg->data.did));
+ }
+
+ /* Event deletion */
+ (void)VehicleDeleteEvent(event_id);
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetVehicleData
+* ABSTRACT : Vehicle sensor information acquisition
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetVehicleData(const VEHICLE_MSG_GET_VEHICLE_DATA *msg) {
+ void *share_top; /* Start address of shared memory */
+ u_int32 share_size; /* Size of shared memory area */
+ u_int8 get_method; /* Data collection way */
+ VEHICLESENS_DATA_MASTER master; /* Data master */
+ RET_API ret_api;
+ int32 ret_val;
+ int32 event_val;
+ EventID event_id;
+ SENSOR_MSG_GPSDATA_DAT gps_master; /* GPS Data Master */
+
+ /* Check the DID */
+ ret_val = VehicleSensCheckDid(msg->data.did);
+ if (VEHICLESENS_INVALID != ret_val) { // LCOV_EXCL_BR_LINE 6:did always valid
+ /* DID normal */
+
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME), &share_top, &share_size);
+ if (RET_NORMAL == ret_api) {
+ /* Acquire the specified data from the data master. */
+ get_method = VehicleSensGetSelectionItemList(msg->data.did);
+ if ((VEHICLESENS_GETMETHOD_GPS == get_method) &&
+ ((msg->data.did != VEHICLE_DID_LOCATION_LONLAT) &&
+ (msg->data.did != VEHICLE_DID_LOCATION_ALTITUDE) &&
+ (msg->data.did != VEHICLE_DID_MOTION_HEADING))) {
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Retrieval of the data master fails.,Initialize size to 0 to prevent unauthorized writes */
+ gps_master.us_size = 0;
+ VehicleSensGetGpsDataMaster(msg->data.did, get_method, &gps_master);
+ /* Check the data size */
+ if (msg->data.size < gps_master.us_size) {
+ /* Shared memory error(Insufficient storage size) */
+ event_val = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ } else {
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg->data.offset, (const void *)&gps_master.uc_data, gps_master.us_size);
+
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED,
+ msg->data.did, msg->data.pno,
+ reinterpret_cast<uint8_t *>(&(gps_master.uc_data[0])),
+ gps_master.us_size, SENSLOG_RES_SUCCESS);
+ }
+ } else {
+ (void)memset(reinterpret_cast<void *>(&master), 0, sizeof(VEHICLESENS_DATA_MASTER));
+ VehicleSensGetDataMaster(msg->data.did, get_method, &master);
+
+ /* Check the data size */
+ if (msg->data.size < master.us_size) {
+ /* Shared memory error(Insufficient storage size) */
+ event_val = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ } else {
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg->data.offset, (const void *)master.uc_data, master.us_size);
+
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED,
+ msg->data.did, msg->data.pno,
+ reinterpret_cast<uint8_t *>(&(master.uc_data[0])),
+ master.us_size, SENSLOG_RES_SUCCESS);
+ }
+ }
+ } else {
+ /* Shared memory error */
+ event_val = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ }
+ } else {
+ /* DID error */
+ event_val = VEHICLE_RET_ERROR_DID;
+ }
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(msg->data.pno);
+
+ /* Publish Events */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+ if (RET_NORMAL != ret_api) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SetEvent ERROR!! [ret_api = %d]", ret_api);
+ }
+
+ /* Event deletion */
+ (void)VehicleDeleteEvent(event_id);
+
+ return;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWatchStopPage
+* ABSTRACT : Vehicle sensor interruption monitoring
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensWatchStopPage(const VEHICLE_MSG_WATCH_STOPPAGE *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Not used(Delete Used Functions After Investigation) */
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensPkgDeliveryEntry
+* ABSTRACT : Vehicle sensor information package delivery registration
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensPkgDeliveryEntry(const SENSOR_MSG_DELIVERY_ENTRY *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 event_val;
+ EventID event_id;
+
+ /* Call the process of creating the delivery destination management table */
+ event_val = static_cast<int32>(VehicleSensEntryPkgDeliveryCtrl(msg , VEHICLESENS_EXT_OFF));
+ /* #Polaris_003 */
+
+ /* Event Generation */
+ event_id = PosCreateEvent(msg->data.pno);
+
+ /* Publish Events */
+ (void)_pb_SetEvent(msg->data.event_id, SAPI_EVSET_ABSOLUTE, event_val);
+
+ if (VEHICLE_RET_NORMAL == event_val) {
+ /* Successful delivery registration */
+ /* Deliver package data for the first time */
+ VehicleSensFirstPkgDelivery(&msg->data);
+ }
+
+ /* Event deletion */
+ (void)PosDeleteEvent(event_id);
+}
+// LCOV_EXCL_STOP
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensPkgDeliveryEntryExt
+* ABSTRACT : Vehicle Sensor Information Extended Package Delivery Registration
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensPkgDeliveryEntryExt(const SENSOR_MSG_DELIVERY_ENTRY *msg) {
+ int32 event_val;
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Call the process of creating the delivery destination management table */
+ event_val = static_cast<int32>(VehicleSensEntryPkgDeliveryCtrl(msg , VEHICLESENS_EXT_ON));
+
+ /* Event Generation */
+ (void)PosCreateEvent(msg->data.pno);
+
+ /* Publish Events */
+ (void)_pb_SetEvent(msg->data.event_id, SAPI_EVSET_ABSOLUTE, event_val);
+
+ if (VEHICLE_RET_NORMAL == event_val) {
+ /* Successful delivery registration */
+ /* Provide initial expansion package data delivery */
+ VehicleSensFirstPkgDeliveryExt(&msg->data);
+
+ /* Initial expansion package data delivered */
+ g_sent_fst_pkg_delivery_ext = TRUE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "FirstPkgDeliveryExt call.[%d]",
+ g_sent_fst_pkg_delivery_ext); /* TODO */
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+
+#else
+/*******************************************************************************
+* MODULE : VehicleSensPkgDeliveryEntryError
+* ABSTRACT : Vehicle Sensor Information Extended Package Delivery Registration
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensPkgDeliveryEntryError(const SENSOR_MSG_DELIVERY_ENTRY *msg) {
+ RET_API ret_api;
+ EventID event_id;
+
+ /* Event Generation */
+ event_id = PosCreateEvent(msg->data.pno);
+
+ /* Publish Event Set DID Error */
+ ret_api = _pb_SetEvent(msg->data.event_id, SAPI_EVSET_ABSOLUTE, VEHICLE_RET_ERROR_DID);
+}
+
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensGetVehiclePkgData
+* ABSTRACT : Vehicle sensor information package data acquisition
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetVehiclePkgData(const SENSOR_MSG_GET_SENSOR_DATA *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDelivery
+* ABSTRACT : LineSensor Vehicle Signal Notification
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDelivery(const LSDRV_MSG_LSDATA *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) {
+ int32 i;
+ BOOL sens_ext;
+
+ sens_ext = TRUE;
+
+ for (i = 0; i < msg->st_para.uc_data_num; i++) {
+ /* Setting Vehicle Signal Data from LineSensor as Data Master */
+ VehicleSensSetDataMasterLineSens((const LSDRV_LSDATA *) & (msg->st_para.st_data[i]),
+ p_datamaster_set_n, sens_ext);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryG
+* ABSTRACT : LineSensor Vehicle Signal Notification
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryG(const LSDRV_MSG_LSDATA_G *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) {
+ int32 i;
+ BOOL sens_ext;
+
+ sens_ext = TRUE;
+ if (g_sent_fst_pkg_delivery_ext == TRUE) {
+ /* Initial Expansion Package Data Delivery,Without storing extended data */
+ sens_ext = FALSE;
+ }
+
+ for (i = 0; i < msg->st_para.uc_data_num; i++) {
+ /* Setting Vehicle Signal Data from LineSensor as Data Master */
+ VehicleSensSetDataMasterLineSensG((const LSDRV_LSDATA_G *) & (msg->st_para.st_data[i]),
+ p_datamaster_set_n, sens_ext);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryGyroTrouble
+* ABSTRACT : Gyro Failure Status Notification
+* FUNCTION : Notify of a gyro failure condition
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryGyroTrouble(const LSDRV_MSG_LSDATA_GYRO_TROUBLE *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Setting Gyro Failure Status Data from LineSensor to Data Master */
+ VehicleSensSetDataMasterGyroTrouble((const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *)&(msg->st_para),
+ p_datamaster_set_n);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliverySysGpsInterruptSignal
+* ABSTRACT : SYS GPS interrupt notification
+* FUNCTION : Notify SYS GPS interrupt signals
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_sharedmemory : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliverySysGpsInterruptSignal(const LSDRV_MSG_LSDATA_GPS_INTERRUPT_SIGNAL *msg, PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory) { // LCOV_EXCL_START 8 :dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Sets the SYS GPS interrupt data from the LineSensor to the data master. */
+ VehicleSensSetDataMasterSysGpsInterruptSignal((const LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL *)&(msg->st_para),
+ p_datamaster_set_sharedmemory);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryGyroConnectStatus
+* ABSTRACT : Gyro Connection Status Notification
+* FUNCTION : Notify the state of the gyro connection
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_sharedmemory : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryGyroConnectStatus(const LSDRV_MSG_LSDATA_GYRO_CONNECT_STATUS *msg, PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Setting Gyro Connection Status Data from LineSensor to Data Master */
+ VehicleSensSetDataMasterGyroConnectStatus((const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *)&(msg->st_para),
+ p_datamaster_set_sharedmemory);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryGpsAntennaStatus
+* ABSTRACT : GPS Antenna Connection Status Notification
+* FUNCTION : Notify the GPS antenna connection status
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryGpsAntennaStatus(const LSDRV_MSG_LSDATA_GPS_ANTENNA_STATUS *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Setting GPS Antenna Connection Status Data from LineSensor as Data Master */
+ VehicleSensSetDataMasterGpsAntennaStatus((const LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS *)&(msg->st_para),
+ p_datamaster_set_n);
+}
+// LCOV_EXCL_STOP
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryFst
+* ABSTRACT : LineSensor Vehicle Signal Notification(Initial Sensor)
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryFst(const LSDRV_MSG_LSDATA_FST *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+#endif
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryFstG
+* ABSTRACT : LineSensor Vehicle Signal Notification(Initial Sensor)
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryFstG(const LSDRV_MSG_LSDATA_FST *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ if (msg == NULL) { // LCOV_EXCL_BR_LINE 6:msg cannot be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "msg == NULL\r\n"); // LCOV_EXCL_LINE 8: dead code
+ } else {
+ /* Set Vehicle Signal Data from LineSensor (Initial Sensor) as Data Master */
+ VehicleSensSetDataMasterLineSensFstG((const LSDRV_MSG_LSDATA_DAT_FST *) & (msg->st_para),
+ p_datamaster_set_n);
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensGpsDataDelivery
+* ABSTRACT : GPS data notification
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : For Data Master Set Notification(Callback function) delivery
+* : p_datamaster_set_sharedmemory : Data Master Set Notification (Callback Function) Shared Memory Write
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGpsDataDelivery(SENSOR_MSG_GPSDATA *msg,
+ PFUNC_DMASTER_SET_N p_datamaster_set_n,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory) {
+ /* Setting GPS Data as Data Master */
+ if (msg->st_para.ul_did == VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL) { // LCOV_EXCL_BR_LINE 6:DID is not used
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* [PastModel002 Specifications] GPS->_CWORD102_ interrupt or not is obtained from GPS */
+ VehicleSensSetDataMasterMainGpsInterruptSignal((const SENSOR_MSG_GPSDATA_DAT *)&(msg->st_para),
+ p_datamaster_set_sharedmemory);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSensGpsDataDelivery VehicleSensSetDataMasterGps() -->");
+ VehicleSensSetDataMasterGps(reinterpret_cast<SENSOR_MSG_GPSDATA_DAT *>(&(msg->st_para)),
+ p_datamaster_set_n);
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSensGpsDataDelivery VehicleSensSetDataMasterGps() <--");
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensDataMasterSetN
+* ABSTRACT : Data master set notification process(Callback function)
+* FUNCTION : Call the data delivery process
+* ARGUMENT : did : Data ID
+* : chg_type : Change type(no change/with change)
+* : get_method : Acquisition method(Direct Line/CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensDataMasterSetN(DID did, u_int8 chg_type, u_int8 get_method) {
+
+ u_int8 chgType;
+
+ chgType = chg_type;
+
+ switch (did) {
+ case POSHAL_DID_SPEED_KMPH:
+ {
+ if (ChkUnitType(UNIT_TYPE_GRADE1) == TRUE) {
+ /* For creating PASCD Sentence of NMEA */
+
+ int ret;
+ VEHICLESENS_VEHICLE_SPEED_DAT stVehicleSpeed;
+
+ ret = clock_gettime(CLOCK_MONOTONIC, &(stVehicleSpeed.ts));
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "clock_gettime error:%m");
+ } else {
+ VEHICLESENS_DATA_MASTER stData;
+ SENSORMOTION_SPEEDINFO_DAT* pSpdInfo;
+
+ VehicleSensGetMotionSpeed(&stData, VEHICLESENS_GETMETHOD_INTERNAL); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ pSpdInfo = (SENSORMOTION_SPEEDINFO_DAT*)(stData.uc_data);
+
+ stVehicleSpeed.speed = pSpdInfo->Speed;
+
+ VehicleSens_StoreVehicleSpeed(&stVehicleSpeed); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ }
+ }
+
+ break;
+ }
+ case POSHAL_DID_GPS_NMEA:
+ {
+ VehilceSens_InitVehicleSpeed();
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ /* Call the data delivery process */
+ VehicleSensDeliveryProc( did, chgType, get_method );
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensDataMasterSetSharedMemory
+* ABSTRACT : Data master set notification process(Callback function)
+* FUNCTION : Call Write Shared Memory
+* ARGUMENT : did : Data ID
+* : chg_type : Whether or not data is updated
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensDataMasterSetSharedMemory(DID did, u_int8 chg_type) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When there is no change, the shared memory write process is not called. */
+ if (chg_type == VEHICLESENS_NEQ) {
+ VehicleSensWriteSharedMemory(did);
+ }
+}
+// LCOV_EXCL_STOP
+
+/* ++ GPS _CWORD82_ support */
+/*******************************************************************************
+* MODULE : VehicleSensSetVehicleData
+* ABSTRACT : GPS command request processing
+* FUNCTION : Transfer a GPS command request
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetVehicleData(const VEHICLE_MSG_SEND *msg) {
+ u_int16 size; /* Data length setting */
+ u_int16 all_len; /* Sent message length */
+ u_int16 mode; /* Mode information */
+ RID req_id = 0; /* Resources ID */
+
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ TG_GPS_SND_DATA data; /* Message body */
+ u_int8 snd_buf[(sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(TG_GPS_SND_DATA))];
+
+ /* Message header generation */
+ size = sizeof(data);
+ header.signo = 0; /* Signal information */
+ header.hdr.sndpno = PNO_VEHICLE_SENSOR; /* Source thread number */
+ header.hdr.respno = 0; /* Destination process No. */
+ header.hdr.cid = CID_GPS__CWORD82__REQUEST; /* Command ID */
+ header.hdr.msgbodysize = size; /* Message data length setting */
+ header.hdr.rid = req_id; /* Resource ID Setting */
+ header.hdr.reserve = 0; /* Reserved Area Clear */
+
+ /* Message body generating */
+ data.us_size = msg->data.size;
+ memcpy(&(data.ub_data[0]), &(msg->data.data[0]), msg->data.size);
+
+ /* Reserved Area Clear */
+ data.reserve[0] = 0;
+ data.reserve[1] = 0;
+ data.reserve[2] = 0;
+ data.reserve[3] = 0;
+
+ /* Message generation */
+ (void)memcpy(&snd_buf[0], &header, sizeof(header));
+ (void)memcpy(&snd_buf[sizeof(header)], &data, sizeof(data));
+ all_len = static_cast<u_int16>(size + sizeof(header));
+ mode = 0;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__, "VehicleSensSetVehicleData NMEA = %s", data.ub_data);
+ (void)_pb_SndMsg(PNO_NAVI_GPS_MAIN, all_len, reinterpret_cast<void *>(&snd_buf[0]), mode);
+}
+
+/*******************************************************************************
+ * MODULE : VehicleSensDrDeliveryEntry
+ * ABSTRACT : Sensor Internal Information Delivery Registration for DR
+ * FUNCTION :
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensDrDeliveryEntry(const VEHICLE_MSG_DELIVERY_ENTRY *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 event_val;
+ EventID event_id;
+
+ /* Call the process of creating the delivery destination management table */
+ event_val = static_cast<int32>(DeadReckoningEntryDeliveryCtrl((const DEADRECKONING_MSG_DELIVERY_ENTRY*)msg));
+ /* #QAC confirmation Rule11.4 Member reference to suppress address reference error in data R/W */
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(msg->data.pno);
+
+ /* Publish Events */
+ (void)_pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+
+ if (VEHICLE_RET_NORMAL == event_val) {
+ /* Successful delivery registration */
+ /* Deliver data for the first time */
+ DeadReckoningFirstDelivery((PNO)(msg->data.pno), (DID)(msg->data.did));
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : VehicleSensGetLog
+ * ABSTRACT : Log acquisition request
+ * FUNCTION :
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensGetLog(const VEHICLEDEBUG_MSG_BUF *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DeadReckoningGetLocationLogStatus(msg->hdr.hdr.sndpno);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : VehicleSensSetLog
+ * ABSTRACT : Log Setting Request
+ * FUNCTION :
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensSetLog(const VEHICLEDEBUG_MSG_BUF* msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : VehicleSensWriteLocalTime
+ * ABSTRACT : Set LOCALTIME to non-volatile
+ * FUNCTION :
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensWriteLocalTime(const CANINPUT_MSG_INFO *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOCALTIME localtime = {0};
+ int32 time_diff;
+ RET_API ret_write_api;
+ static u_int8 cnt = 0U; /* For update cycle count */
+ if (msg != NULL) {
+ memset(&time_diff, 0x00, sizeof(time_diff)); /* Coverity CID:18813 compliant */
+
+ /* Determine that the 1s cycle (cnt == 1) has elapsed for 1 second. */
+ cnt++;
+
+ /* When 5 seconds or more have elapsed since the last update */
+ /* Saving Time Information in Non-volatile Memory */
+ if (cnt >= NV_UPDATE_CYCLE_LOCALTIME) {
+ /* Non-volatile write */
+ ret_write_api = VehicleSensWriteNVLocaltime(&localtime, &time_diff);
+ if (ret_write_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NV write error.");
+ }
+ cnt = 0U;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT NULL");
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetEphNumSharedMemory
+* ABSTRACT : Write effective ephemeris number to shared memory
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetEphNumSharedMemory(const SENSOR_MSG_GPSDATA *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api;
+ u_int8 ephemeris_num;
+
+ if (msg != NULL) {
+ ephemeris_num = msg->st_para.uc_data[0];
+
+ ret_api = VehicleSensWriteDataValidEphemerisNum(ephemeris_num);
+
+ if (ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Share Memory write error.");
+ }
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensDrRcvMsg
+* ABSTRACT : Data delivery for DR,Write location information to shared memory
+* FUNCTION :
+* ARGUMENT : const EPHEMERIS_NUM_DATA_DAT * : Incoming message
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensDrRcvMsg(const DEAD_RECKONING_RCVDATA * msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEAD_RECKONING_LONLAT_INFO lonlat_info;
+
+ if (msg != NULL) {
+ DeadReckoningRcvMsg(msg, &lonlat_info);
+
+ /* Process for storing location information in non-volatile memory during shutdown */
+ /* With a refresh interval of 1 second,Save only when location information is valid data */
+ if (lonlat_info.calc_called == TRUE) {
+ static u_int8 cnt = 0U; /* For update cycle count */
+
+ /* Sensor data is 100ms cycle,Determine that (cnt == 10) has elapsed for 1 second */
+ /* Cnt increments to 10 */
+ if (cnt < NV_UPDATE_CYCLE_LONLAT) {
+ cnt++;
+ }
+
+ /* When 1 second or more has elapsed since the last update and the location information is valid, */
+ /* Saving Location Information in Non-Volatile Memory */
+ if ((cnt >= NV_UPDATE_CYCLE_LONLAT) && (lonlat_info.available == static_cast<u_int8>(TRUE))) {
+ VehicleSensStoreLonlat(&(lonlat_info.lonlat));
+ cnt = 0U;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT NULL");
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Data setting process
+ *
+ * Setting Specified Data to Data Master
+ *
+ * @param[in] const VEHICLE_MSG_BUF *msg : message buffer
+ * @param[out] PFUNC_DMASTER_SET_N p_datamaster_set_n : Data Master Set Notification(Callback function)
+ * @return none
+ * @retval none
+ */
+void VehicleSensCommonDataDelivery(const VEHICLE_MSG_BUF *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) {
+ const POS_MSGINFO *pstPosMsg = (const POS_MSGINFO *) & (msg->data[0]);
+
+ /* Individual processing for each data ID */
+ switch (pstPosMsg->did) {
+ case VEHICLE_DID_SETTINGTIME:
+ {
+ /* By checking the evacuation message information,Determine whether the GPS time has already been set and requested */
+ if (NULL == g_wait_for_resp_set_n) {
+ /* GPS time settable */
+ /* GPS time setting data transmission */
+ VehicleSensGpsTimeSndMsg(pstPosMsg);
+
+ /* Save message information(Used when a response is received.)*/
+ (void)memcpy(&g_wait_for_resp_msg, msg, sizeof(VEHICLE_MSG_BUF));
+ g_wait_for_resp_set_n = p_datamaster_set_n;
+ } else {
+ /* GPS time setting process is already in progress:Reply BUSY to requesting processes */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SetGpsTime already.");
+ }
+ break;
+ }
+ default:
+ /* Set the specified data in the data master */
+ VehicleSensSetDataMasterData((const POS_MSGINFO *)msg->data, p_datamaster_set_n);
+ break;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS time setting data transmission process
+ *
+ * Send the specified data to the GPS thread
+ *
+ * @param[in] const POS_MSGINFO *pos_msg : message buffer
+ * @return none
+ * @retval none
+ */
+void VehicleSensGpsTimeSndMsg(const POS_MSGINFO *pos_msg) {
+ RET_API ret_api = RET_NORMAL; /* System API return value */
+ u_int16 size = 0; /* Data length setting */
+ u_int16 all_len = 0; /* Sent message length */
+ u_int16 mode = 0; /* Mode information */
+ RID req_id = 0; /* Resources ID */
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ TG_GPS_SND_DATA data; /* Message body */
+ u_int8 snd_buf[(sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(TG_GPS_SND_DATA))];
+
+ memset(&header, 0x00, sizeof(T_APIMSG_MSGBUF_HEADER));
+ memset(&data, 0x00, sizeof(TG_GPS_SND_DATA));
+
+ /* Message header generation */
+ size = sizeof(data);
+ header.signo = 0; /* Signal information */
+ header.hdr.sndpno = PNO_VEHICLE_SENSOR; /* Source thread number */
+ header.hdr.respno = 0; /* Destination process No. */
+ header.hdr.cid = CID_GPS_TIMESETTING; /* Command ID */
+ header.hdr.msgbodysize = size; /* Message data length setting */
+ header.hdr.rid = req_id; /* Resource ID Setting */
+
+ /* Message body generating */
+ data.us_size = pos_msg->size;
+ memcpy(&(data.ub_data[0]), &(pos_msg->data[0]), pos_msg->size);
+
+ /* Messaging */
+ (void)memcpy(&snd_buf[0], &header, sizeof(header));
+ (void)memcpy(&snd_buf[sizeof(header)], &data, sizeof(data));
+ all_len = static_cast<u_int16>(size + sizeof(header));
+ mode = 0;
+ ret_api = _pb_SndMsg(PNO_NAVI_GPS_MAIN, all_len, reinterpret_cast<void *>(&snd_buf[0]), mode);
+ if (RET_NORMAL != ret_api) {
+ /* Message transmission processing failed */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "send Message failed.");
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS time setting result notification process
+ *
+ * Setting Specified Data to Data Master
+ *
+ * @param[in] const VEHICLE_MSG_BUF *msg : message buffer
+ * @return none
+ * @retval none
+ */
+void VehicleSensGpsTimeDelivery(const VEHICLE_MSG_BUF *msg) {
+ int32 event_val = POS_RET_ERROR_INNER; /* Event value */
+ const TG_GPS_RET_TIMESET_MSG *gps_ret_time; /* GPS time setting response message */
+
+ /* Determine the GPS time setting result */
+ gps_ret_time = (const TG_GPS_RET_TIMESET_MSG *)msg;
+
+ if (GPS_SENDOK == gps_ret_time->status) {
+ event_val = POS_RET_NORMAL;
+ } else {
+ event_val = POS_RET_ERROR_TIMEOUT;
+ }
+
+ /* Set the specified data in the data master */
+ if (POS_RET_NORMAL == event_val) {
+ VehicleSensSetDataMasterData((const POS_MSGINFO *)&g_wait_for_resp_msg.data, g_wait_for_resp_set_n);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "SetGpsTime Result[%d] EventVal[%d]",
+ static_cast<uint32_t>(gps_ret_time->status), static_cast<uint32_t>(event_val));
+
+ /* Clear saved message information */
+ (void)memset(&g_wait_for_resp_msg, 0x00, sizeof(VEHICLE_MSG_BUF));
+ g_wait_for_resp_set_n = NULL;
+
+ return;
+}
+
+/**
+ * @brief
+ * Specified process No. event transmission processing
+ *
+ * Send an event to the specified process No.
+ *
+ * @param[in] uint16_t snd_pno : Destination process number
+ * @param[in] int32_t event_val : Sent event value
+ * @return RET_API
+ * @retval RET_NORMAL Normal completion<br>
+ * RET_ERROR Event generation failure<br>
+ * RET_ERRPARAM Configuration mode error<br>
+ * RET_EV_NONE Specified event does not exist<br>
+ * RET_EV_MAX The set event value exceeds the maximum value<br>
+ * RET_EV_MIN The set event value is below the minimum value.
+ */
+RET_API VehicleSensSendEvent(uint16_t snd_pno, int32_t event_val) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_val = RET_ERROR; /* Return value */
+ EventID event_id = 0; /* Event ID */
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(snd_pno);
+ if (0 != event_id) {
+ /* Event publishing(Release Event Wait) */
+ ret_val = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+ if (RET_NORMAL != ret_val) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "set Event failed.");
+ }
+
+ /* Event deletion */
+ (void)VehicleDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "create Event failed.");
+ }
+
+ return ret_val;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Pos_Main thread stop processing
+ */
+void VehicleSensThreadStopProcess(void) {
+ /* Exit Process Implementation Point >>> */
+
+
+ /* <<< Exit Process Implementation Point */
+
+ /* Thread stop processing */
+ PosTeardownThread(ETID_POS_MAIN);
+
+ /* don't arrive here */
+ return;
+}
+
+/**
+ * @brief
+ * Initialization of data interruption monitoring process<br>
+ * 1.Initial data reception monitoring timer issuance
+ */
+static void VehicleSensInitDataDisrptMonitor(void) {
+
+ /* Initial sensor data reception monitoring timer */
+ VehicleUtilitySetTimer(SNS_FST_TIMER);
+
+ return;
+}
+
+/**
+ * @brief
+ * Data disruption monitoring process<br>
+ * 1.Stop timer for monitoring initial data reception<br>
+ * 2.Stop timer for periodic data reception monitoring<br>
+ * 3.Periodic data reception monitoring timer issuance
+ *
+ * @param[in] did Data type
+ */
+static void VehicleSensDataDisrptMonitorProc(DID did) {
+ static BOOL is_rcv_sns_data = FALSE;
+
+ switch (did) {
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_Y:
+ case POSHAL_DID_GYRO_Z:
+ case POSHAL_DID_GSNS_X:
+ case POSHAL_DID_GSNS_Y:
+ case POSHAL_DID_GSNS_Z:
+ case POSHAL_DID_SPEED_PULSE:
+ case POSHAL_DID_REV:
+ case POSHAL_DID_GPS_ANTENNA:
+ case POSHAL_DID_GYRO_EXT:
+ case POSHAL_DID_GYRO_TEMP:
+ case POSHAL_DID_PULSE_TIME:
+ case POSHAL_DID_SNS_COUNTER:
+ {
+ if (is_rcv_sns_data == FALSE) {
+ /* Initial sensor data reception monitoring timer */
+ VehicleUtilityStopTimer(SNS_FST_TIMER);
+ is_rcv_sns_data = TRUE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "is_rcv_sns_data=TRUE");
+ }
+
+ /* Cyclic sensor data reception monitoring timer stopped */
+ VehicleUtilityStopTimer(SNS_CYCLE_TIMER);
+ /* Cyclic sensor data reception monitoring timer setting */
+ VehicleUtilitySetTimer(SNS_CYCLE_TIMER);
+ /* Sensor data interruption log output timer */
+ VehicleUtilityStopTimer(SNS_DISRPT_TIMER);
+
+ break;
+ }
+ default:
+ {
+ /* nop */
+ }
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timeout message reception processing
+ *
+ * @param[in] rcv_msg Incoming message
+ */
+static void VehicleSensRcvMsgTout(TimerToutMsg* rcv_msg) {
+ uint8_t tim_kind = static_cast<uint8_t>(rcv_msg->TimerSeq >> 8);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+ ### TIMEOUT ### Seq=0x%04x", rcv_msg->TimerSeq);
+ switch (tim_kind) {
+ case SNS_FST_TIMER:
+ case SNS_CYCLE_TIMER:
+ case SNS_DISRPT_TIMER:
+ {
+ /* Sensor data interruption log output timer setting */
+ VehicleUtilityStopTimer(SNS_DISRPT_TIMER);
+ VehicleUtilitySetTimer(SNS_DISRPT_TIMER);
+ break;
+ }
+ default:
+ {
+ /* nop */
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return;
+}
+
+
+/**
+ * @brief
+ * Initialize Vehilce Speed Information
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can initialize the buffer of Vehicle Speed Information.
+ */
+static void VehilceSens_InitVehicleSpeed(void) {
+ (void)memset(&g_vehicle_speed_info, 0x00, sizeof(g_vehicle_speed_info));
+ return;
+}
+
+/**
+ * @brief
+ * Store Vehilce Speed Data
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can store Vehicle Speed Information for a cycle.
+ *
+ * @param[in] VEHICLESENS_VEHICLE_SPEED_DAT* pVehicleSpeed : Speed [m/s] and TimeSpec
+ */
+static void VehicleSens_StoreVehicleSpeed(VEHICLESENS_VEHICLE_SPEED_DAT* pVehicleSpeed) {
+ VEHICLESENS_VEHICLE_SPEED_INFO* pInfo = &g_vehicle_speed_info;
+
+
+// if (pInfo->sampleCount < VEHICLESENS_NMEA_PASCD_SAMPLECOUNT_MAX) {
+ if (pInfo->sampleCount == 0) {
+ (void)memcpy((pInfo->listSpd) + (pInfo->sampleCount), pVehicleSpeed, sizeof(VEHICLESENS_VEHICLE_SPEED_DAT));
+ pInfo->sampleCount++;
+
+ } else if (pInfo->sampleCount < VEHICLESENS_NMEA_PASCD_SAMPLECOUNT_MAX) {
+ (void)_pb_memcpy((pInfo->listSpd) + (pInfo->sampleCount), pVehicleSpeed, sizeof(VEHICLESENS_VEHICLE_SPEED_DAT));
+
+ VEHICLESENS_VEHICLE_SPEED_DAT* pS0 = &(pInfo->listSpd[0]);
+ VEHICLESENS_VEHICLE_SPEED_DAT* pS = &(pInfo->listSpd[pInfo->sampleCount]);
+ uint32_t ts_i; /* Interger Part of timestamp [s] */
+ if (pS->ts.tv_nsec - pS0->ts.tv_nsec >= 0) { // LCOV_EXCL_BR_LINE 200: can not less than zero
+ ts_i = (pS->ts.tv_sec - pS0->ts.tv_sec) % VEHICLESENS_NMEA_PASCD_TS_MAX;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ts_i = (pS->ts.tv_sec - pS0->ts.tv_sec - 1) % VEHICLESENS_NMEA_PASCD_TS_MAX; // LCOV_EXCL_LINE 8: invalid
+ }
+ if (ts_i == 0) { /* Offset is 0 to 1 second */
+ pInfo->sampleCount++;
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "WARNING: Num of stored datas is over 50. (%ld.%ld spd = %d)",
+ pVehicleSpeed->ts.tv_sec, pVehicleSpeed->ts.tv_nsec, pVehicleSpeed->speed );
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Load Vehicle Speed Information (Vehicle Speed Data x 50(max))
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can load Vehicle Speed Informations from the last initialization.
+ *
+ * @param[in] VEHICLESENS_VEHICLE_SPEED_INFO* pVehicleSpeedInfo : Speeds [m/s] and TimeSpecs
+ */
+static void VehicleSens_LoadVehicleSpeed(VEHICLESENS_VEHICLE_SPEED_INFO* pVehicleSpeedInfo) {
+ (void)memcpy(pVehicleSpeedInfo, &g_vehicle_speed_info, sizeof(g_vehicle_speed_info));
+ return;
+}
+
+/**
+ * @brief
+ * Concatenate NMEA Sentence Fields with Delimiter
+ *
+ * @details This is for creating NMEA Sentence. <br>
+ * You can concatenate the two strings given as arguments 'str1' and 'str2'. <br>
+ * And at the time, it puts the delimiter between 'str1' and 'str2' automaticaly.
+ *
+ * @param[in] char* str1 : destination
+ * @param[in] const size_t size : buffer size of destination
+ * @param[in] const char* str2 : source
+ * @param[in] const size_t n : copy size of source
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static RET_API VehicleSens_CatNmeaSentenceFieldWithDelimiter(char* str1, const size_t size,
+ const char* str2, const size_t n) {
+ RET_API ret_api = RET_NORMAL;
+
+ size_t len1 = strlen(str1);
+ size_t len2 = strlen(str2);
+ size_t len3 = strlen(VEHICLESENS_NMEA_FIELDDELIMITER);
+ size_t sn = n;
+
+ if (sn > len2) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ sn = len2;
+ }
+
+ if (len1 + len3 + sn <= size - 1) {
+ (void)strncat(str1, VEHICLESENS_NMEA_FIELDDELIMITER, len3); /* Add Delimiter (,) */
+ (void)strncat(str1, str2, sn);
+ } else {
+ ret_api = RET_ERROR;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: Buffer size is too small to connatenate. len1:%d len2:%d len3:%d n:%d", len1, len2, len3, n);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Concatenate NMEA Sentence Fields without Delimiter
+ *
+ * @details This is for creating NMEA Sentence. <br>
+ * You can concatenate the two strings given as arguments 'str1' and 'str2'.
+ *
+ * @param[in] char* str1 : destination
+ * @param[in] const size_t size : buffer size of destination
+ * @param[in] const char* str2 : source
+ * @param[in] const size_t n : copy size of source
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static RET_API VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(char* str1, const size_t size,
+ const char* str2, const size_t n) {
+ RET_API ret_api = RET_NORMAL;
+
+ size_t len1 = strlen(str1);
+ size_t len2 = strlen(str2);
+ size_t sn = n;
+
+ if (sn > len2) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ sn = len2;
+ }
+
+ if (len1 + sn <= size - 1) {
+ (void)strncat(str1, str2, sn);
+ } else {
+ ret_api = RET_ERROR;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: Buffer size is too small to connatenate. len1:%d len2:%d n:%d", len1, len2, n);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate ID Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate ID Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldId(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_PASCD_ID, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate Timestamp Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate Timestamp Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldTimestamp(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ VEHICLESENS_VEHICLE_SPEED_INFO stVehicleSpeedInfo;
+
+ uint32_t ts_i; /* Interger Part of timestamp [s] */
+ uint32_t ts_f; /* Fractional Part of timestamp [ms] */
+ char ts_ci[32]; /* ts_i in charactor */
+ char ts_cf[32]; /* ts_f in charactor */
+
+ VehicleSens_LoadVehicleSpeed(&stVehicleSpeedInfo);
+
+
+#if 1 /* PASCD *//* Suppose that GPS NMEA data are updated 1 sec interval */
+ ts_i = gPseudoSecClockCounter; /* Synchronize: GPS NMEA */
+ ts_f = 0u;
+ gPseudoSecClockCounter += 1u; /* PASCD *//* Suppose that GPS NMEA data are updated 1 sec interval */
+ if (gPseudoSecClockCounter >= VEHICLESENS_NMEA_PASCD_TS_MAX) {
+ gPseudoSecClockCounter = 0u;
+ }
+#else /* PASCD *//* Suppose that GPS NMEA data are updated 1 sec interval */
+
+ ts_i = stVehicleSpeedInfo.listSpd[0].ts.tv_sec % VEHICLESENS_NMEA_PASCD_TS_MAX;
+ ts_f = stVehicleSpeedInfo.listSpd[0].ts.tv_nsec;
+
+#endif /* PASCD *//* Suppose that GPS NMEA data are updated 1 sec interval */
+
+ (void)snprintf(ts_ci, sizeof(ts_ci), "%d", ts_i);
+ (void)snprintf(ts_cf, sizeof(ts_cf), "%06d", ts_f);
+
+ /* Integer Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, ts_ci, VEHICLESENS_NMEA_PASCD_TS_INT_LEN_MAX);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ }
+
+ /* Decimal Point */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_DECIMALPOINT, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ }
+
+ /* Fractional Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size,
+ ts_cf, VEHICLESENS_NMEA_PASCD_TS_FRA_LEN_MAX);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate SensorType Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate SensorType Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldSensorType(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, VEHICLESENS_NMEA_PASCD_SENSORTYPE_C, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate TransmissionState Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate TransmissionState Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldTransmissionState(char* pascd, size_t size) {
+ RET_API ret_api = RET_NORMAL;
+ EFrameworkunifiedStatus eStatus;
+
+ uint8_t ucType; /* type of transmission */
+ uint8_t ucShift;
+
+#if 1 /* For Plus _CWORD27_ Gear Data Support 180115 */
+ uint8_t ucPkb; /* state of parking brake */
+#endif /* For Plus _CWORD27_ Gear Data Support 180115 */
+
+ BOOL bIsAvailable;
+
+ /* Get Type of Transmission */
+
+// eStatus = VehicleIf_GetTypeOfTransmission(&ucType, &bIsAvailable);
+ eStatus = VehicleIf_GetTypeOfTransmission(&ucType, &ucPkb, &bIsAvailable);
+ if ((bIsAvailable != true) || (eStatus != eFrameworkunifiedStatusOK)) {
+ if (bIsAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleIf_GetTypeOfTransmission:%d", eStatus);
+ }
+ ret_api = RET_ERROR;
+ }
+
+ if (ret_api != RET_ERROR) {
+ /* Get Shift Position */
+ eStatus = VehicleIf_GetShiftPosition(&ucShift, &bIsAvailable);
+ if ((bIsAvailable != true) || (eStatus != eFrameworkunifiedStatusOK)) {
+ if (bIsAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleIf_GetShiftPosition:%d", eStatus);
+ }
+ ret_api = RET_ERROR;
+ }
+ }
+
+ if (ret_api != RET_ERROR) {
+ VEHICLESENS_TRANSMISSION_PKG tsmPkg;
+
+ tsmPkg.type = ucType;
+ tsmPkg.shift = ucShift;
+
+#if 1 /* For Plus _CWORD27_ Gear Data Support 180115 */
+ tsmPkg.pkb = ucPkb;
+#endif /* For Plus _CWORD27_ Gear Data Support 180115 */
+
+
+ ret_api = VehicleSens_DeriveTransmissionStateFor_CWORD27_(&tsmPkg);
+ if (ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSensDeriveTransmissionStateFor_CWORD27_:%d", ret_api);
+ } else {
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, tsmPkg.state, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate SlipDetect Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate SlipDetect Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldSlipDetect(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, VEHICLESNES_NMEA_PASCD_NOSLIP, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate SampleCount Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate SampleCount Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldSampleCount(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ VEHICLESENS_VEHICLE_SPEED_INFO stVehicleSpeedInfo;
+ char cSampleCount[32];
+
+ VehicleSens_LoadVehicleSpeed(&stVehicleSpeedInfo);
+ (void)snprintf(cSampleCount, sizeof(cSampleCount), "%d", stVehicleSpeedInfo.sampleCount);
+
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, cSampleCount, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate TimeOffset and Speed Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate TimeOffset and Speed Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldTimeOffsetNSpeed(char* pascd, size_t size) {
+ RET_API ret_api = RET_ERROR;
+
+ VEHICLESENS_VEHICLE_SPEED_INFO stVehicleSpeedInfo;
+ VEHICLESENS_VEHICLE_SPEED_DAT *pS0 = &(stVehicleSpeedInfo.listSpd[0]);
+
+ int32_t i;
+
+ VehicleSens_LoadVehicleSpeed(&stVehicleSpeedInfo);
+
+ for (i = 0; i < stVehicleSpeedInfo.sampleCount; i++) {
+ VEHICLESENS_VEHICLE_SPEED_DAT *pS = &(stVehicleSpeedInfo.listSpd[i]);
+
+ /* timeoffset */
+ uint32_t ts_i; /* Interger Part of timestamp [s] */
+ uint32_t ts_f; /* Fractional Part of timestamp [us] */
+ char ts_ci[32]; /* ts_i in charactor */
+ char ts_cf[32]; /* ts_f in charactor */
+
+ if (pS->ts.tv_nsec - pS0->ts.tv_nsec >= 0) { // LCOV_EXCL_BR_LINE 200: can not less than zero
+ ts_i = (pS->ts.tv_sec - pS0->ts.tv_sec) % VEHICLESENS_NMEA_PASCD_TS_MAX;
+ ts_f = (pS->ts.tv_nsec - pS0->ts.tv_nsec) / 1000; /* [ns] -> [us] */
+ } else {
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ts_i = (pS->ts.tv_sec - pS0->ts.tv_sec - 1) % VEHICLESENS_NMEA_PASCD_TS_MAX;
+ ts_f = (1000000000 + pS->ts.tv_nsec - pS0->ts.tv_nsec) / 1000; /* [ns] -> [us] */
+ // LCOV_EXCL_STOP
+ }
+
+ (void)snprintf(ts_ci, sizeof(ts_ci), "%d", ts_i);
+ (void)snprintf(ts_cf, sizeof(ts_cf), "%06d", ts_f);
+
+ /* Integer Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, ts_ci, size);
+ if (ret_api == RET_ERROR) { // LCOV_EXCL_BR_LINE 200: can not exceed buffer size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Decimal Point */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_DECIMALPOINT, size);
+ if (ret_api == RET_ERROR) { // LCOV_EXCL_BR_LINE 200: can not exceed buffer size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Fractional Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size,
+ ts_cf, VEHICLESENS_NMEA_PASCD_TO_FRA_LEN_MAX);
+ if (ret_api == RET_ERROR) { // LCOV_EXCL_BR_LINE 200: can not exceed buffer size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ /* speed */
+ uint16_t spd_i; /* Interger Part of speed [m/s] */
+ uint16_t spd_f; /* Fractional Part of speed [mm/s] */
+ char spd_ci[32]; /* spd_i in charactor */
+ char spd_cf[32]; /* spd_f in charactor */
+
+ spd_i = pS->speed / 100; /* [0.01m/s] -> [m/s] */
+ spd_f = (pS->speed % 100) * 10; /* [0.01m/s] -> [mm/s] */
+
+ (void)snprintf(spd_ci, sizeof(spd_ci), "%d", spd_i);
+ (void)snprintf(spd_cf, sizeof(spd_cf), "%03d", spd_f);
+
+ /* Integer Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, spd_ci, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ break;
+ }
+
+ /* Decimal Point */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_DECIMALPOINT, size);
+ if (ret_api == RET_ERROR) { // LCOV_EXCL_BR_LINE 200: can not exceed buffer size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Fractional Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size,
+ spd_cf, VEHICLESENS_NMEA_PASCD_SPD_FRA_LEN_MAX);
+ if (ret_api == RET_ERROR) { // LCOV_EXCL_BR_LINE 200: can not exceed buffer size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate Checksum Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate Checksum Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldChecksum(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ size_t length;
+ uint8_t chk = 0;
+ char cChk[3];
+ uint16_t i = 0;
+
+ length = strnlen(pascd, size);
+
+ /* Calculate Checksum (start with the 2th Bype except '$') */
+ for (i = 1; i < length; i++) {
+ chk ^= pascd[i];
+ }
+ (void)snprintf(cChk, sizeof(cChk), "%02X", chk);
+
+ /* Set Astarisk before Checksum */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_ASTARISK, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ }
+
+ /* Set Checksum */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, cChk, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate CR & LF Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate CRLF Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldCRLF(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ /* Set Carriage Return */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_CR, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ /* Set Line Feed */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_LF, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Derive Transmission State For _CWORD27_
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can derive transmissionState from the transmission type and <br>
+ * the shift positiong from Vehicle Service.
+ *
+ * @param[in/out] VEHICLESENS_TRANSMISSION_PKG* pPkg : source data set for Transmission State
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static RET_API VehicleSens_DeriveTransmissionStateFor_CWORD27_(VEHICLESENS_TRANSMISSION_PKG* pPkg) {
+ RET_API ret_api = RET_NORMAL;
+ uint32_t i;
+
+ static const VEHICLESENS_TRANSMISSION_PKG TmsLut[VEHICLEIF_TRANSMISSION_TYPE_NUM * VEHICLEIF_SHIFT_POSITION_NUM] = {
+
+// /* Transmission Type : MT */
+// { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_U, VEHICLESENS_NMEA_PASCD_TMS_D },
+// { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_R, VEHICLESENS_NMEA_PASCD_TMS_R },
+// { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_P, VEHICLESENS_NMEA_PASCD_TMS_D },
+// { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_N, VEHICLESENS_NMEA_PASCD_TMS_D },
+// { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_D, VEHICLESENS_NMEA_PASCD_TMS_D },
+// /* Tranmission Type : AT */
+// { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_U, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_R, VEHICLESENS_NMEA_PASCD_TMS_R },
+// { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_P, VEHICLESENS_NMEA_PASCD_TMS_P },
+// { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_N, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_D, VEHICLESENS_NMEA_PASCD_TMS_D },
+// /* Transmission Type : UNKNOWN */
+// { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_U, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_R, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_P, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_N, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_D, VEHICLESENS_NMEA_PASCD_TMS_U },
+ /* Transmission Type : MT */
+ { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_U, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_R, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_R },
+ { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_P, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_N, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_D, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ /* Tranmission Type : AT */
+#if 1 /* For Plus _CWORD27_ Gear Data Support 180115 */
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_U, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+#else /* For Plus _CWORD27_ Gear Data Support 180115 */
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_U, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+#endif /* For Plus _CWORD27_ Gear Data Support 180115 */
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_R, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_R },
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_P, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_P },
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_N, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_N }, /* However, the Vehicle does not notify you by Phase3. */
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_D, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ /* Transmission Type : UNKNOWN */
+#if 1 /* For Plus _CWORD27_ Gear Data Support 180115 */
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_U, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_R, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_P, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_N, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_D, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+#else /* For Plus _CWORD27_ Gear Data Support 180115 */
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_U, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_R, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_P, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_N, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_D, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+#endif /* For Plus _CWORD27_ Gear Data Support 180115 */
+
+ };
+
+ for (i = 0; i < VEHICLEIF_TRANSMISSION_TYPE_NUM * VEHICLEIF_SHIFT_POSITION_NUM; i++) {
+ if ((pPkg->type == TmsLut[i].type) && (pPkg->shift == TmsLut[i].shift)) {
+ strncpy(pPkg->state, TmsLut[i].state, sizeof(pPkg->state));
+ break;
+ }
+ }
+
+
+#if 1 /* For Plus _CWORD27_ Gear Data Support 180115 */
+ if ((pPkg->type == VEHICLEIF_TRANSMISSION_TYPE_MT) && (pPkg->pkb == VEHICLEIF_PKB_ON)) {
+ strncpy(pPkg->state, VEHICLESENS_NMEA_PASCD_TMS_P, sizeof(VEHICLESENS_NMEA_PASCD_TMS_P));
+ }
+#endif /* For Plus _CWORD27_ Gear Data Support 180115 */
+
+
+ if (i == VEHICLEIF_TRANSMISSION_TYPE_NUM * VEHICLEIF_SHIFT_POSITION_NUM) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FORBIDDEN ERROR: Can't find Transmission State. type:%d shift:%d", pPkg->type, pPkg->shift);
+ ret_api = RET_ERROR;
+ }
+
+ return ret_api;
+}
diff --git a/vehicleservice/positioning/server/src/Sensor/VehicleUtility.cpp b/vehicleservice/positioning/server/src/Sensor/VehicleUtility.cpp
new file mode 100755
index 0000000..0201326
--- /dev/null
+++ b/vehicleservice/positioning/server/src/Sensor/VehicleUtility.cpp
@@ -0,0 +1,455 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleUtility.cpp
+@detail Common processing function of Vehicle
+*****************************************************************************/
+
+#include "VehicleUtility.h"
+#include <vehicle_service/positioning_base_library.h>
+
+#include "gps_hal.h"
+#include "positioning_common.h"
+
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/** Timer management table */
+static VEHICLEUTILITY_TIM_MNG g_st_tim_mng;
+
+/** Timer setting information table */
+static const VEHICLEUTILITY_TIM_INFO g_tim_info[TIM_NUM] = {
+ /* GSP-related */
+ {TIMVAL_GPS_STARTUP, PNO_NAVI_GPS_MAIN}, /* Start confirmation monitoring timer */
+ {TIMVAL_GPS_RCVCYCLDAT, PNO_NAVI_GPS_MAIN}, /* Periodic reception data monitoring timer */
+ {TIMVAL_GPS_RCVACK, PNO_NAVI_GPS_MAIN}, /* ACK reception monitoring timer */
+ {TIMVAL_GPS_NAVIFST, PNO_NAVI_GPS_MAIN}, /* Initial Navigation Monitoring Timer */
+ {TIMVAL_GPS_NAVICYCLE, PNO_NAVI_GPS_MAIN}, /* Navi monitoring timer */
+ {TIMVAL_GPS_NAVIDISRPT, PNO_NAVI_GPS_MAIN}, /* Navigation Monitoring Disruption Log Output Timer */
+ {TIMVAL_GPS_DIAGCLKGUARD, PNO_NAVI_GPS_MAIN}, /* Diag provision time guard monitoring timer */
+ {TIMVAL_GPS_NMEADATAGUARD, PNO_NAVI_GPS_MAIN}, /* NMEA data-providing guard monitoring timer */
+ {TIMVAL_GPS_RECOVERY, PNO_NAVI_GPS_MAIN}, /* GPS recovery timer */
+ {TIMVAL_GPS_RECEIVERERR, PNO_NAVI_GPS_MAIN}, /* GPS receiver anomaly detection timer */
+ /* Sensor Related Extensions */
+ {TIMVAL_SNS_RCVFSTDAT, PNO_VEHICLE_SENSOR}, /* Initial cyclic sensor data reception monitoring timer */
+ {TIMVAL_SNS_RCVCYCLDAT, PNO_VEHICLE_SENSOR}, /* Cyclic sensor data reception monitoring timer */
+ {TIMVAL_SNS_RCVDISRPT, PNO_VEHICLE_SENSOR}, /* Cyclic sensor data interruption log output timer */
+};
+
+/*---------------------------------------------------------------------------------*
+ * Prototype *
+ *---------------------------------------------------------------------------------*/
+static uint16_t VehicleUtilityTimeMakSeqNo(VEHICLEUTILITY_TIM_KIND tim_kind);
+
+/***************************************************************************
+@brief send message function for Vehicle domain.
+@outline send message function with put error diag function if error occurred.
+@type Completion return type
+@param[in] PNO pno : PNO
+@param[in] u_int16 size : size of message data
+@param[in] void* msgbuf : message data
+@param[in] u_int16 mode : mode
+@threshold
+@return RET_API
+@retval RET_NORMAL : Normal end
+@retval RET_ERROR : Abnormal end
+*****************************************************************************/
+RET_API VehicleUtilitySndMsg(PNO pno, u_int16 size, void *msgbuf, u_int16 mode) {
+ RET_API ret_api;
+ if (msgbuf != NULL) { // LCOV_EXCL_BR_LINE 6: msgbuf cannot be null
+ ret_api = _pb_SndMsg(pno, size, msgbuf, mode);
+ /* RET_ERROR: Execute _pb_Exit() after dialog registration */
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg ERROR [ret_api:%d]", ret_api);
+ }
+ } else {
+ ret_api = RET_ERRPARAM;
+ }
+
+ return ret_api;
+}
+
+/***************************************************************************
+@brief send message function for Vehicle domain.
+@outline receive message function with put error diag function if error occurred.
+@type Completion return type
+@param[in] PNO pno : PNO
+@param[in] u_int16 size : size of message data
+@param[in] void* msgbuf : message data
+@param[in] u_int16 mode : mode
+@threshold
+@return RET_API
+@retval RET_NORMAL : Normal end
+@retval RET_ERROR : Abnormal end
+*****************************************************************************/
+RET_API VehicleUtilityRcvMsg(PNO pno, u_int16 size, void **msgbuf, u_int16 mode)
+{
+ RET_API ret_api;
+
+ if (msgbuf != NULL) { // LCOV_EXCL_BR_LINE 6: msgbuf cannot be null
+ ret_api = _pb_RcvMsg(pno, size, msgbuf, mode);
+ /* For RET_ERROR Sys_Exit() after dialog registration */
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_RcvMsg ERROR [ret_api:%d]", ret_api);
+ }
+ } else {
+ ret_api = RET_ERRPARAM;
+ }
+
+ return ret_api;
+}
+
+/***************************************************************************
+@brief Diagcode submit for Vehicle domain.
+@outline submit the DiagCode for Vehicle domain.
+@type Completion return type
+@param[in] u_int32 err_id : Diag Code
+@param[in] u_int16 positioning_code : Positioning Code
+@param[in] void* msgbuf : message data
+@return void
+*****************************************************************************/
+void VehicleUtilityDiagCodePut(u_int32 err_id, u_int16 positioning_code) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Timer function initialization processing
+ *
+ */
+void VehicleUtilityInitTimer(void) {
+ VEHICLEUTILITY_TIM_MNG *pst_tim_mng;
+ u_int32 i;
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ /* Initialize timer management table */
+ memset(pst_tim_mng, 0x00, sizeof(VEHICLEUTILITY_TIM_MNG));
+
+ for (i = 0; i < TIM_NUM; i++) {
+ pst_tim_mng->sts[i].flag = TIMER_OFF;
+ pst_tim_mng->sts[i].cnt = 0;
+ }
+}
+
+/**
+ * @brief
+ * Timer start processing<br>
+ *
+ * Starts a timer of the specified type<br>
+ * 1.Increment total number of timer start<br>
+ * 2.Timer Sequence Number Creation<br>
+ * 3.Get timeout value<br>
+ * 4.Timer start<br>
+ *
+ * @param[in] Tim_kind Timer type
+ *
+ * @return TRUE Normal completion<br>
+ * FALSE abend<br>
+ */
+BOOL VehicleUtilitySetTimer(VEHICLEUTILITY_TIM_KIND tim_kind) {
+ VEHICLEUTILITY_TIM_MNG *pst_tim_mng;
+ const uint32_t *p_time_val;
+ const PNO *p_pno;
+ RET_API api_ret; /* Timer API return value */
+ u_int16 seq_no;
+ BOOL ret = TRUE;
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ p_time_val = &(g_tim_info[tim_kind].timer_val); /* Timer set value */
+ p_pno = &(g_tim_info[tim_kind].pno); /* Notify party PNO */
+
+ if (pst_tim_mng->sts[tim_kind].flag == TIMER_ON) {
+ /*-----------------------------------------------------------------------*/
+ /* When the same timer has already started */
+ /* Terminate without starting the timer because the timer is set multiple times. */
+ /*-----------------------------------------------------------------------*/
+ ret = FALSE;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* Count up the timer counter of the corresponding timer by 1. */
+ /*-----------------------------------------------------------------------*/
+ if (pst_tim_mng->sts[tim_kind].cnt >= TIM_CNTMAX) {
+ /*-----------------------------------------------------------------------*/
+ /* When the count reaches the maximum number,Count again from 1 */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].cnt = TIM_CNTMIN;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* If the count has not reached the maximum,Count up */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].cnt++;
+ }
+
+ /*-----------------------------------------------------------------------*/
+ /* Creating Timer Sequence Numbers */
+ /*-----------------------------------------------------------------------*/
+ seq_no = VehicleUtilityTimeMakSeqNo(tim_kind);
+
+ /*-----------------------------------------------------------------------*/
+ /* Start the timer */
+ /*-----------------------------------------------------------------------*/
+ api_ret = _pb_ReqTimerStart(*p_pno, seq_no, TIMER_TYPE_USN, (u_int32)*p_time_val);
+ if (api_ret != RET_NORMAL) {
+ ret = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "_pb_ReqTimerStart ERROR!! [api_ret=%d]", api_ret);
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* Successful timer start */
+ /* Set the start/stop flag of the corresponding timer to start (MCSUB_ON) */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].flag = TIMER_ON;
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Timer stop processing<br>
+ *
+ * Stops a timer of the specified type<br>
+ * 1.Get the sequence number of the specified type<br>
+ * 2.Timer stop<br>
+ *
+ * @param[in] Tim_kind Timer type
+ * @param[in] pno Process number
+ *
+ * @return TRUE Normal completion<br>
+ * FALSE abend<br>
+ */
+BOOL VehicleUtilityStopTimer(VEHICLEUTILITY_TIM_KIND tim_kind) {
+ VEHICLEUTILITY_TIM_MNG *pst_tim_mng;
+ const PNO *p_pno;
+ BOOL ret = TRUE;
+ RET_API api_ret;
+ u_int16 seq_no;
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ p_pno = &(g_tim_info[tim_kind].pno); /* Notify party PNO */
+
+ /* Check timer start/stop flag */
+ if (pst_tim_mng->sts[tim_kind].flag == TIMER_OFF) {
+ /* If it is already stopped, do nothing. */
+ ret = FALSE;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* Creating Timer Sequence Numbers */
+ /*-----------------------------------------------------------------------*/
+ seq_no = VehicleUtilityTimeMakSeqNo(tim_kind);
+
+ /*-----------------------------------------------------------------------*/
+ /* Set the corresponding timer to stop */
+ /*-----------------------------------------------------------------------*/
+ api_ret = _pb_TimerStop(*p_pno, seq_no, TIMER_TYPE_USN);
+ if (api_ret != RET_NORMAL) {
+ ret = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_TimerStop ERROR!! [api_ret=%d]", api_ret);
+ }
+
+ /*-----------------------------------------------------------------------*/
+ /* Set the start/stop flag of the corresponding timer to stop (MCSUB_OFF) */
+ /* Set the ID of the corresponding timer to invalid (DEV_TED_INVALID) */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].flag = TIMER_OFF;
+ }
+ return ret;
+}
+
+/**
+ * @brief
+ * Timer Sequence Number Determination<br>
+ *
+ * Determine whether the timer sequence number corresponds to the one being managed
+ *
+ * @param[in] seqno Timer Sequence Number
+ *
+ * @return TRUE Normal completion(No problem)<br>
+ * FALSE abend(Unusual number)<br>
+ */
+BOOL VehicleUtilityTimeJdgKnd(uint16_t seqno) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLEUTILITY_TIM_MNG *pst_tim_mng;
+ BOOL ret;
+ u_int8 timekind;
+ u_int8 count;
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ timekind = (u_int8)((seqno & 0xff00) >> 8);
+ count = (u_int8)(seqno & 0x00ff);
+
+ /* Timer type is unexpected */
+ if (timekind >= TIM_NUM) {
+ ret = FALSE;
+ } else {
+ if ((pst_tim_mng->sts[timekind].cnt == count) &&
+ (pst_tim_mng->sts[timekind].flag == TIMER_ON)) {
+ /* The counter matches and the counter start/stop flag is "Start". */
+ ret = TRUE;
+ } else {
+ /* Not applicable due to differences */
+ ret = FALSE;
+ }
+ }
+
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Timer Sequence Number Creation<br>
+ *
+ * Creating a Sequence Number for a Timer<br>
+ * 1. The upper 1 byte is the timer type.,So that the lower 1 times is the total number of timer starts
+ * Create a sequence number.
+ *
+ * @param[in] Tim_kind Timer type
+ *
+ * @return Timer Sequence Number
+ */
+static uint16_t VehicleUtilityTimeMakSeqNo(VEHICLEUTILITY_TIM_KIND tim_kind) {
+ VEHICLEUTILITY_TIM_MNG *pst_tim_mng;
+ u_int16 seq_no; /* Timer Sequence Number */
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ /*------------------------------------------------------------------------*/
+ /* Definition of Sequence Number */
+ /* |------------------- Sequence number(2Byte) -----------------------| */
+ /* 15 8 7 0 */
+ /* +-------------------------------+-----------------------------------+ */
+ /* | Timer type(1Byte) | Counter(1Byte)(0x01 ? 0xFF) | */
+ /* +-------------------------------+-----------------------------------+ */
+ /* For the timer type,0x00 ? (Number of timers-1) */
+ /* For counters,0x01 ? 0xFF(Do not use 0x00.) */
+ /* (Counters are counted up each time a timer is started. */
+ /* Count up when counter is 0xFF, */
+ /* Be counted up from the 0x01) */
+ /*------------------------------------------------------------------------*/
+ seq_no = static_cast<u_int16>(((u_int16)tim_kind << 8) | (pst_tim_mng->sts[tim_kind].cnt));
+
+ return seq_no;
+}
+
+/**
+ * @brief
+ * External pin status request
+ */
+void LineSensDrvExtTermStsReq(void) {
+ T_APIMSG_MSGBUF_HEADER st_snd_msg;
+ RET_API lret;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ memset(&st_snd_msg, 0x00, sizeof(st_snd_msg));
+
+ st_snd_msg.hdr.sndpno = PNO_LINE_SENS_DRV;
+ st_snd_msg.hdr.respno = 0x0000;
+ st_snd_msg.hdr.cid = CID_EXTTERM_REQ;
+ st_snd_msg.hdr.msgbodysize = 0x00; /* No data */
+ st_snd_msg.hdr.rid = 0x00;
+
+ /* Messaging */
+ lret = _pb_SndMsg(PNO_LINE_SENS_DRV, sizeof(T_APIMSG_MSGBUF_HEADER), &st_snd_msg, 0);
+ if (lret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg ERROR!! lret=%d", lret);
+ lret = RET_ERROR;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return;
+}
+
+
+/**
+ * @brief
+ * Backup data read request send processing<BR>
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABENDs
+ */
+RET_API DEVGpsSndBackupDataLoadReq(void) {
+ RET_API lret;
+ T_APIMSG_MSGBUF_HEADER st_snd_msg;
+
+ /** Create GPS Data Notification Message */
+ (void)memset(&st_snd_msg, 0x00, sizeof(st_snd_msg)); /* QAC 3200 */
+ /** Message header */
+ st_snd_msg.hdr.sndpno = 0x0000;
+ st_snd_msg.hdr.respno = 0x0000;
+ st_snd_msg.hdr.cid = CID_GPS_BACKUPDATA_LOAD;
+ st_snd_msg.hdr.msgbodysize = 0x00;
+ st_snd_msg.hdr.rid = 0x00;
+
+ /* Messaging */
+ lret = _pb_SndMsg(PNO_NAVI_GPS_MAIN, sizeof(st_snd_msg), &st_snd_msg, 0);
+ if (lret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg ERROR!! [lret=%d]", lret);
+ lret = RET_ERROR;
+ }
+
+ return(lret);
+}
+
+/**
+ * @brief
+ * Acquisition of GPS-format error count information (dump)
+ *
+ * @param[out] p_buf Dump information
+ */
+void DEVGpsGetDebugGpsFormatFailCnt(void* p_buf) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (p_buf != NULL) {
+ snprintf(reinterpret_cast<char *>(p_buf), \
+ 512, "GPS Format Fail Count is not supported.\n"); // NOLINT(readability/nolint)
+ }
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Initial sensor data reception flag acquisition
+ */
+u_int8 LineSensDrvGetSysRecvFlag(void) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get GPS Rollover Standard Week Number
+ *
+ * @return GPS rollover base week number
+ */
+uint16_t DEVGpsGetWknRollover(void) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/* end of file */
diff --git a/vehicleservice/positioning/server/src/ServiceInterface/BackupMgrIf.cpp b/vehicleservice/positioning/server/src/ServiceInterface/BackupMgrIf.cpp
new file mode 100755
index 0000000..da5dba2
--- /dev/null
+++ b/vehicleservice/positioning/server/src/ServiceInterface/BackupMgrIf.cpp
@@ -0,0 +1,211 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * BackupMgrIf.cpp
+ * @brief
+ * BackupMgr service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "BackupMgrIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+
+// static BOOL g_backup_mgr_availability = FALSE;
+BOOL g_backup_mgr_availability = FALSE;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+
+/**
+ * @brief
+ * BackupMgr Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus BackupMgrIfNotifyOnBackupMgrAvailability(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ /* NS_BackupMgr/Availability Changing notification registration */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_BackupMgr_Availability, (CbFuncPtr)fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * BackupMgr Services IF-Availability Settings
+ *
+ * @param[in] b_is_available Available state
+ * @return none
+ */
+void BackupMgrIfSetAvailability(BOOL b_is_available) {
+ g_backup_mgr_availability = b_is_available;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, \
+ "g_backup_mgr_availability=%d", g_backup_mgr_availability);
+
+ return;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @brief
+ * BackupMgr Services IF-Availability Acquisition
+ *
+ * @param[in] none
+ * @return gb_BackupMgrAvailability
+ */
+
+BOOL BackupMgrIf_GetAvailability(void)
+{
+ return g_backup_mgr_availability;
+}
+#ifdef __cplusplus
+}
+#endif
+
+/**
+ * @brief
+ * Import BackupMgr Services IFs
+ *
+ * @param[in] tag_id
+ * @param[in] ui_offset
+ * @param[in] *pv_buf
+ * @param[in] ui_size
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus BackupMgrIfBackupDataRd(PCSTR tag_id, uint32_t ui_offset, void *pv_buf, \
+ uint32_t ui_size, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ int32_t lret;
+
+ if (BackupMgrIf_GetAvailability() == TRUE) {
+ lret = Backup_DataRd(tag_id, ui_offset, pv_buf, ui_size);
+ if (lret == BKUP_RET_NORMAL) {
+ /* 8Byte fixed outputs */
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, \
+ "Backup_DataRd Done [tag_id=%s, pv_buf(Hex):%02x %02x %02x %02x %02x %02x %02x %02x, offset=%d, size=%d]",
+ tag_id,
+ *(reinterpret_cast<int8_t*>(pv_buf)),
+ *((reinterpret_cast<int8_t*>(pv_buf))+1),
+ *((reinterpret_cast<int8_t*>(pv_buf))+2),
+ *((reinterpret_cast<int8_t*>(pv_buf))+3),
+ *((reinterpret_cast<int8_t*>(pv_buf))+4),
+ *((reinterpret_cast<int8_t*>(pv_buf))+5),
+ *((reinterpret_cast<int8_t*>(pv_buf))+6),
+ *((reinterpret_cast<int8_t*>(pv_buf))+7),
+ ui_offset, ui_size);
+
+ estatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "Backup_DataRd ERROR!! [lret=%d, tag_id=%s, ui_offset=%d, pv_buf=%p, ui_size=%d]", \
+ lret, tag_id, ui_offset, pv_buf, ui_size);
+ }
+ } else {
+ /* nop */
+ }
+
+ *pb_is_available = BackupMgrIf_GetAvailability();
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * BackupMgr Services IF Write
+ *
+ * @param[in] tag_id
+ * @param[in] *pv_buf
+ * @param[in] ui_offset
+ * @param[in] ui_size
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus BackupMgrIfBackupDataWt(PCSTR tag_id, void *pv_buf, uint32_t ui_offset, \
+ uint32_t ui_size, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ int32_t lret;
+
+ if (BackupMgrIf_GetAvailability() == TRUE) {
+ lret = Backup_DataWt(tag_id, pv_buf, ui_offset, ui_size);
+ if (lret == BKUP_RET_NORMAL) {
+ /* 8Byte fixed outputs */
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__,
+ "Backup_DataWt Done [tag_id=%s, pv_buf(Hex):%02x %02x %02x %02x %02x %02x %02x %02x, offset=%d, size=%d]",
+ tag_id,
+ *(reinterpret_cast<int8_t*>(pv_buf)),
+ *((reinterpret_cast<int8_t*>(pv_buf))+1),
+ *((reinterpret_cast<int8_t*>(pv_buf))+2),
+ *((reinterpret_cast<int8_t*>(pv_buf))+3),
+ *((reinterpret_cast<int8_t*>(pv_buf))+4),
+ *((reinterpret_cast<int8_t*>(pv_buf))+5),
+ *((reinterpret_cast<int8_t*>(pv_buf))+6),
+ *((reinterpret_cast<int8_t*>(pv_buf))+7),
+ ui_offset, ui_size);
+
+ estatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "Backup_DataWt ERROR!! [lret=%d, tag_id=%s, pv_buf=%p, ui_offset=%d, ui_size=%d]", \
+ lret, tag_id, pv_buf, ui_offset, ui_size);
+ }
+ } else {
+ /* nop */
+ }
+
+ *pb_is_available = BackupMgrIf_GetAvailability();
+
+ return estatus;
+}
diff --git a/vehicleservice/positioning/server/src/ServiceInterface/ClockIf.cpp b/vehicleservice/positioning/server/src/ServiceInterface/ClockIf.cpp
new file mode 100755
index 0000000..52fd4cf
--- /dev/null
+++ b/vehicleservice/positioning/server/src/ServiceInterface/ClockIf.cpp
@@ -0,0 +1,138 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * ClockIf.cpp
+ * @brief
+ * Clock service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "ClockIf.h"
+#include <stub/clock_notifications.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static BOOL g_clock_availability = FALSE;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Clock Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus ClockIfNotifyOnClockAvailability(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ /* Clock/Availability Changing notification registration */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_Clock_Availability, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Clock Services IF-Availability Settings
+ *
+ * @param[in] b_is_available Available state
+ * @return none
+ */
+void ClockIfSetAvailability(BOOL b_is_available) {
+ g_clock_availability = b_is_available;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "g_clock_availability=%d", g_clock_availability);
+
+ return;
+}
+
+/**
+ * @brief
+ * Clock Services IF GPS Time
+ *
+ * @param[in] *gps_time GPS time
+ * @param[out] *b_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus ClockIfDtimeSetGpsTime(const SENSOR_MSG_GPSTIME *pst_gps_time, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+ T_DTIME_MSG_GPSTIME st_dtime_gpstime;
+
+ if (g_clock_availability == TRUE) {
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ st_dtime_gpstime.utc.year = pst_gps_time->utc.year;
+ st_dtime_gpstime.utc.month = pst_gps_time->utc.month;
+ st_dtime_gpstime.utc.date = pst_gps_time->utc.date;
+ st_dtime_gpstime.utc.hour = pst_gps_time->utc.hour;
+ st_dtime_gpstime.utc.minute = pst_gps_time->utc.minute;
+ st_dtime_gpstime.utc.second = pst_gps_time->utc.second;
+ st_dtime_gpstime.tdsts = pst_gps_time->tdsts;
+
+ /* Set GPS time for Clock services */
+ estatus = DTime_setGpsTime(happ, &st_dtime_gpstime);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "DTime_setGpsTime ERROR!! [ret=%d, y=%d, m=%d, d=%d, h=%d, n=%d, s=%d, sts=%d]", \
+ estatus, st_dtime_gpstime.utc.year, st_dtime_gpstime.utc.month, st_dtime_gpstime.utc.date, \
+ st_dtime_gpstime.utc.hour, st_dtime_gpstime.utc.minute, st_dtime_gpstime.utc.second, \
+ st_dtime_gpstime.tdsts);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+ } else {
+ /* nop */
+ }
+
+ *pb_is_available = g_clock_availability;
+
+ return estatus;
+}
+
diff --git a/vehicleservice/positioning/server/src/ServiceInterface/CommUsbIf.cpp b/vehicleservice/positioning/server/src/ServiceInterface/CommUsbIf.cpp
new file mode 100755
index 0000000..b776ff0
--- /dev/null
+++ b/vehicleservice/positioning/server/src/ServiceInterface/CommUsbIf.cpp
@@ -0,0 +1,147 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * CommUsbIf.cpp
+ * @brief
+ * CommUSB service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "CommUsbIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static BOOL g_comm_usb_availability = FALSE;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Registering CommUSB Services IF Callback Functions
+ *
+ * @param[in] *p_msg_handler Callback function table
+ * @param[in] Ui_handler_count Number of callback functions
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus CommUsbIfAttachCallbacksToDispatcher( // NOLINT(readability/nolint)
+ _FrameworkunifiedProtocolCallbackHandler const* p_msg_handler,
+ unsigned int ui_handler_count) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ estatus = FrameworkunifiedAttachCallbacksToDispatcher(happ, "NS_ANY_SRC", p_msg_handler, ui_handler_count);
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Remove CommUSB Services IF Callback Functions
+ *
+ * @param[in] *p_msg_handler CID table
+ * @param[in] ui_handler_count Number of CIDs
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus CommUsbIfDetachCallbacksFromDispatcher(const PUI_32 pui_cmd_array, UI_32 ui_command_count) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ estatus = FrameworkunifiedDetachCallbacksFromDispatcher(happ, "NS_ANY_SRC", pui_cmd_array, ui_command_count, NULL);
+ /* In the event of failure */
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "PositioningDetachCallbacksToDispatcher Failed in FrameworkunifiedOnStop [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * CommUSB Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus CommUsbIfNotifyOnCommUSBAvailability(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* PS_CommUSB/Availability Changing notification registration */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_CommUSB_Availability, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * CommUSB Services IF-Availability Settings
+ *
+ * @param[in] pb_is_available
+ * @return none
+ */
+void CommUsbIfSetAvailability(BOOL b_is_available) {
+ g_comm_usb_availability = b_is_available;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "g_comm_usb_availability=%d", g_comm_usb_availability);
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/ServiceInterface/DevDetectSrvIf.cpp b/vehicleservice/positioning/server/src/ServiceInterface/DevDetectSrvIf.cpp
new file mode 100755
index 0000000..800429f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/ServiceInterface/DevDetectSrvIf.cpp
@@ -0,0 +1,279 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * DevDetectSrvIf.cpp
+ * @brief
+ * DevDetectSrv service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "DevDetectSrvIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static BOOL g_dev_detect_srv_availability = FALSE;
+
+/** Device insertion detection */
+DeviceDetectionServiceIf g_if_ss_dev;
+
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * DevDetectSrv Services IF-Availability Settings
+ *
+ * @param[in] b_is_available Available state
+ * @return none
+ */
+void DevDetectSrvIfSetAvailability(BOOL b_is_available) {
+ g_dev_detect_srv_availability = b_is_available;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, \
+ "g_dev_detect_srv_availability=%d", g_dev_detect_srv_availability);
+
+ return;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF-Initialization
+ *
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfInitialize(void) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ BOOL bret;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ bret = g_if_ss_dev.Initialize(happ);
+ if (bret == TRUE) {
+ estatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "g_if_ss_dev::Initialize ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_call_back_fn Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnDeviceDetectionAvailability(CbFuncPtr fp_call_back_fn) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ estatus = g_if_ss_dev.NotifyOnDeviceDetectionAvailability(fp_call_back_fn);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf Availability ERROR!! [estatus = %d]", estatus);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF OpenSessionRequest Complete Answer Receive Callback Registration
+ *
+ * @param[in] fp_call_back_fn Callback function
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnOpenSessionAck(CbFuncPtr fp_call_back_fn, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.NotifyOnOpenSessionAck(fp_call_back_fn);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF CloseSessionRequest Complete Answer Receive Callback Registration
+ *
+ * @param[in] fp_call_back_fn Callback function
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnCloseSessionAck(CbFuncPtr fp_call_back_fn, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.NotifyOnCloseSessionAck(fp_call_back_fn);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Service IF Service and Session Generation
+ *
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfOpenSessionRequest(BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.OpenSessionRequest();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF-Session Id Retention
+ *
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfDecodeOpenSessionResponse(BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.DecodeOpenSessionResponse();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF-Device Event Receive Callback Registration
+ *
+ * @param[in] fe_dev_detect_event
+ * @param[in] fp_call_back_fn
+ * @param[in] p_file_path
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfRegisterForDeviceDetectionEvent(SS_DeviceDetectionServerEvents fe_dev_detect_event, \
+ CbFuncPtr fp_call_back_fn, PCSTR p_file_path, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.RegisterForDeviceDetectionEvent(fe_dev_detect_event, fp_call_back_fn, p_file_path);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF DeviceDetectionServiceIf Callback Release
+ *
+ * @param[in] fe_dev_detect_event
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfUnRegisterForDeviceDetectionEvent(SS_DeviceDetectionServerEvents fe_dev_detect_event, \
+ BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.UnRegisterForDeviceDetectionEvent(fe_dev_detect_event);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Service IF Service and Destroy Sessions
+ *
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfCloseSessionRequest(BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.CloseSessionRequest();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
diff --git a/vehicleservice/positioning/server/src/ServiceInterface/DiagSrvIf.cpp b/vehicleservice/positioning/server/src/ServiceInterface/DiagSrvIf.cpp
new file mode 100755
index 0000000..195555e
--- /dev/null
+++ b/vehicleservice/positioning/server/src/ServiceInterface/DiagSrvIf.cpp
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * DiagSrvIf.cpp
+ * @brief
+ * DiagSrv service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "DiagSrvIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static BOOL g_registration_permission = FALSE; /* Whether or not the dialog code can be registered */
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * DiagSrv Services IF Registration Enable Status Setting
+ *
+ * @param[in] b_is_true
+ * @return none
+ */
+void DiagSrvIfSetRegistrationPermission(BOOL b_is_true) {
+ g_registration_permission = b_is_true;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, \
+ "g_registration_permission=%d", g_registration_permission);
+
+ return;
+}
diff --git a/vehicleservice/positioning/server/src/ServiceInterface/Makefile b/vehicleservice/positioning/server/src/ServiceInterface/Makefile
new file mode 100755
index 0000000..fba98e8
--- /dev/null
+++ b/vehicleservice/positioning/server/src/ServiceInterface/Makefile
@@ -0,0 +1,54 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed library(*.a) #############
+INST_LIBS = libPOS_ServiceInterface
+
+######### compiled sources #############
+libPOS_ServiceInterface_SRCS += BackupMgrIf.cpp
+libPOS_ServiceInterface_SRCS += ClockIf.cpp
+libPOS_ServiceInterface_SRCS += CommUsbIf.cpp
+libPOS_ServiceInterface_SRCS += DevDetectSrvIf.cpp
+libPOS_ServiceInterface_SRCS += DiagSrvIf.cpp
+libPOS_ServiceInterface_SRCS += PSMShadowIf.cpp
+libPOS_ServiceInterface_SRCS += VehicleIf.cpp
+
+######### add include path #############
+CPPFLAGS += -I../../include/common/
+CPPFLAGS += -I../../include/nsfw/
+CPPFLAGS += -I../../include/ServiceInterface
+
+CPPFLAGS += -I../../../client/include
+
+#CPPFLAGS += -I../../../../diag_code/library/include
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### add library path #############
+LDFLAGS +=
+
+include ../../../../vehicle_service.mk
+
diff --git a/vehicleservice/positioning/server/src/ServiceInterface/PSMShadowIf.cpp b/vehicleservice/positioning/server/src/ServiceInterface/PSMShadowIf.cpp
new file mode 100755
index 0000000..99d9a52
--- /dev/null
+++ b/vehicleservice/positioning/server/src/ServiceInterface/PSMShadowIf.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * PSMShadowIf.cpp
+ * @brief
+ * PSMShadow service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "PSMShadowIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * PSMShadow Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus PSMShadowIfNotifyOnPSMShadowAvailability(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ /* PS_PSMShadow/Availability Changing notification registration */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_PSMShadowService_Availability, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Register PSMShadow services IF start completion notification
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus PSMShadowIfNotifyOnPSMShadowInitComp(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ /* PS_PSMShadow startup completion notice */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_PSM_INITCOMP, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
diff --git a/vehicleservice/positioning/server/src/ServiceInterface/VehicleIf.cpp b/vehicleservice/positioning/server/src/ServiceInterface/VehicleIf.cpp
new file mode 100755
index 0000000..0ef5e15
--- /dev/null
+++ b/vehicleservice/positioning/server/src/ServiceInterface/VehicleIf.cpp
@@ -0,0 +1,364 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehilceIf.cpp
+ * @brief
+ * Vehicle Service Interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include <stub/Vehicle_Sensor_Common_API.h>
+#include <stub/Vehicle_API.h>
+#include <stub/vehicle_notifications.h>
+
+#include "VehicleIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static BOOL gb_vehicleAvailability = FALSE;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Registering Vehicle Services IF Callback Functions
+ *
+ * @param[in] *p_msg_handler Callback function table
+ * @param[in] Ui_handler_count Number of callback functions
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus VehicleIfAttachCallbacksToDispatcher( // NOLINT(readability/nolint)
+ _FrameworkunifiedProtocolCallbackHandler const* p_msg_handler,
+ unsigned int ui_handler_count) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (NULL != happ) {
+ estatus = FrameworkunifiedAttachCallbacksToDispatcher(happ, "NS_ANY_SRC", p_msg_handler, ui_handler_count);
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Vehicle IF: Set Availability Status
+ *
+ * @details This function sets status of Vehicle/Availablity stored in local. <br>
+ * Only when the status is true, Vehicle I/F is called by wrappers.
+ *
+ * @param[in] BOOL bIsAvailable : Availability Status
+ */
+void VehicleIf_SetAvailability(BOOL bIsAvailable)
+{
+ gb_vehicleAvailability = bIsAvailable;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "gb_vehicleAvailability=%d", gb_vehicleAvailability);
+
+ return;
+}
+
+/**
+ * @brief
+ * Remove Vehicle Services IF Callback Functions
+ *
+ * @param[in] *p_msg_handler CID table
+ * @param[in] ui_handler_count Number of CIDs
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus VehicleIfDetachCallbacksFromDispatcher(const PUI_32 pui_cmd_array, UI_32 ui_command_count) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (NULL != happ) {
+ estatus = FrameworkunifiedDetachCallbacksFromDispatcher(happ, "NS_ANY_SRC", pui_cmd_array, ui_command_count, NULL);
+ /* In the event of failure */
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningDetachCallbacksToDispatcher Failed in FrameworkunifiedOnStop [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Vehicle IF: Get Type of Transmission
+ *
+ * @details This function is wrapper function of Vehicle I/F. <br>
+ * You can get the type of transmission of the vehicle.
+ *
+ * @param[out] uint8_t* pType : Type of Transmission
+ * @param[out] BOOL* bIsAvailable : Availability Status
+ *
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+
+//EFrameworkunifiedStatus VehicleIf_GetTypeOfTransmission(uint8_t* pType, BOOL* pbIsAvailable)
+EFrameworkunifiedStatus VehicleIf_GetTypeOfTransmission(uint8_t* pType, uint8_t* pPkb, BOOL* pbIsAvailable)
+{
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ VEHICLE_RET_API ret;
+ HANDLE hApp;
+ uint8_t ucVartrm;
+
+#if 1 /* Plus _CWORD27_ Gear Data Support 180115 */
+ uint8_t ucPkb;
+#endif /* Plus _CWORD27_ Gear Data Support 180115 */
+
+
+ if (gb_vehicleAvailability == TRUE)
+ {
+ hApp = _pb_GetAppHandle();
+ if (hApp != NULL)
+ {
+ ret = Vehicle_GetVehicleData(hApp, VEHICLE_DID_VARTRM1, &ucVartrm, sizeof(ucVartrm));
+ if (ret < VEHICLE_RET_NORMAL)
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR: Vehicle_GetVehicleData:%d", ret);
+ }
+ else
+ {
+ eStatus = eFrameworkunifiedStatusOK;
+
+ switch (ucVartrm)
+ {
+ case VEHICLE_SNS_VARTRM1_AT:
+ case VEHICLE_SNS_VARTRM1_CVT:
+ case VEHICLE_SNS_VARTRM1_HV_AT:
+ {
+ *pType = VEHICLEIF_TRANSMISSION_TYPE_AT;
+ break;
+ }
+ case VEHICLE_SNS_VARTRM1_MT:
+ case VEHICLE_SNS_VARTRM1_MMT:
+ case VEHICLE_SNS_VARTRM1_SMT:
+ {
+ *pType = VEHICLEIF_TRANSMISSION_TYPE_MT;
+ break;
+ }
+ case VEHICLE_SNS_VARTRM1_UNCERTAINTY:
+ {
+ *pType = VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN;
+ break;
+ }
+ default:
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: Type of transmission is unknown. (%d)", ucVartrm);
+
+ *pType = VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN;
+ break;
+ }
+ }
+ }
+
+#if 1 /* Plus _CWORD27_ Gear Data Support 180115 */
+ ret = Vehicle_GetVehicleData(hApp, VEHICLE_DID_PKB, &ucPkb, sizeof(ucPkb));
+ if (ret < VEHICLE_RET_NORMAL)
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR: Vehicle_GetVehicleData:%d", ret);
+ }
+ else
+ {
+ eStatus = eFrameworkunifiedStatusOK;
+
+ switch (ucPkb)
+ {
+ case VEHICLE_SNS_OFF: // R-state
+ //case VEHICLE_SNS_ANTI: // Antilock(Vehicle undefined)
+ {
+ *pPkb = VEHICLEIF_PKB_OFF;
+ break;
+ }
+ case VEHICLE_SNS_ON: // Lock state
+ {
+ *pPkb = VEHICLEIF_PKB_ON;
+ break;
+ }
+ default:
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: State of parking brake is unknown. (%d)", ucPkb);
+
+ *pPkb = VEHICLEIF_PKB_OFF;
+ break;
+ }
+ }
+ }
+#endif /* Plus _CWORD27_ Gear Data Support 180115 */
+
+ }
+ else
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR: _pb_GetAppHandle hApp:%p", hApp);
+ }
+ }
+ else
+ {
+ /* nop */
+ }
+
+ *pbIsAvailable = gb_vehicleAvailability;
+
+ return eStatus;
+}
+
+/**
+ * @brief
+ * Vehicle Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus VehicleIfNotifyOnVehicleAvailability(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (NULL != happ) {
+ /* Vehicle/Availability Changing notification registration */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_Vehicle_Availability, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Vehicle IF: Get Shift Position
+ *
+ * @details This function is wrapper function of Vehicle I/F. <br>
+ * You can get the shift position of the vehicle.
+ *
+ * @param[out] uint8_t* pShift : Shift Position
+ * @param[out] BOOL* bIsAvailable : Availability Status
+ *
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus VehicleIf_GetShiftPosition(uint8_t* pShift, BOOL* pbIsAvailable)
+{
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ VEHICLE_RET_API ret;
+ HANDLE hApp;
+
+ if (gb_vehicleAvailability == TRUE)
+ {
+ hApp = _pb_GetAppHandle();
+ if (hApp != NULL)
+ {
+ ret = Vehicle_GetVehicleData(hApp, VEHICLE_DID_SHIFT, pShift, sizeof(*pShift));
+ if (ret < VEHICLE_RET_NORMAL)
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR: Vehicle_GetVehicleData:%d", ret);
+ }
+ else
+ {
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ else
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR: _pb_GetAppHandle hApp:%p", hApp);
+ }
+ }
+ else
+ {
+ /* nop */
+ }
+
+ *pbIsAvailable = gb_vehicleAvailability;
+
+ return eStatus;
+}
+
+
+/**
+ * @brief
+ * Vehicle services IF Info data-delivery registry
+ *
+ * @param[in] ul_did
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+
+EFrameworkunifiedStatus VehicleIfDeliveryEntry(uint32_t ul_did) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+ VEHICLE_RET_API iret;
+
+ if (TRUE == gb_vehicleAvailability) {
+ happ = _pb_GetAppHandle();
+ if (NULL != happ) {
+ /* Sensor data delivery registration */
+ iret = Vehicle_DeliveryEntry(happ, (PCSTR)POS_THREAD_NAME, ul_did,
+ VEHICLE_DELIVERY_REGIST, VEHICLE_DELIVERY_TIMING_UPDATE);
+ if (VEHICLE_RET_NORMAL != iret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Vehicle_DeliveryEntry ERROR!! [iret=%d]", iret);
+ } else {
+ estatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+ } else {
+ /* nop */
+ }
+ return estatus;
+}
+
diff --git a/vehicleservice/positioning/server/src/nsfw/Makefile b/vehicleservice/positioning/server/src/nsfw/Makefile
new file mode 100755
index 0000000..403e29f
--- /dev/null
+++ b/vehicleservice/positioning/server/src/nsfw/Makefile
@@ -0,0 +1,89 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = Positioning
+
+######### compiled sources #############
+Positioning_SRCS += ps_main.cpp
+Positioning_SRCS += positioning_application.cpp
+
+ifeq ($(ARCH),arm64)
+LDLIBS += -Wl,-Bdynamic -lpositioning_hal
+else
+LDLIBS += -Wl,-Bdynamic -lpositioning_hal
+endif #($(ARCH),arm64)
+
+######### add include path #############
+CPPFLAGS += -I../../../client/include
+CPPFLAGS += -I../../include/common/
+CPPFLAGS += -I../../include/Sensor/
+CPPFLAGS += -I../../include/ServiceInterface/
+CPPFLAGS += -I../../include/nsfw/
+#CPPFLAGS += -I../../../../diag_code/library/include
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library(static) #############
+LDLIBS += -Wl,-Bstatic -lPOS_Sensor
+LDLIBS += -Wl,-Bstatic -lPOS_ServiceInterface
+
+# LDLIBS += -Wl,-Bstatic -lVehicle_API
+
+######### linked library (dynamic) #############
+ifeq (arm64, $(ARCH))
+LDLIBS += -Wl,-Bdynamic -lpositioning_hal
+LDLIBS += -Wl,-Bdynamic -lVehicle_API
+endif
+LDLIBS += -Wl,-Bdynamic -lClock_API
+#LDLIBS += -Wl,-Bdynamic -lMM_DREC_API
+#LDLIBS += -Wl,-Bdynamic -lextension
+LDLIBS += -Wl,-Bdynamic -lPOS_base_API
+LDLIBS += -Wl,-Bdynamic -lPOS_common_API
+LDLIBS += -Wl,-Bdynamic -lPOS_gps_API
+LDLIBS += -Wl,-Bdynamic -lPOS_sensor_API
+LDLIBS += -Wl,-Bdynamic -lz
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lns_backup
+LDLIBS += -Wl,-Bdynamic -lssver
+LDLIBS += -Wl,-Bdynamic -lstdc++
+#LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI
+LDLIBS += -Wl,-Bdynamic -lDTime_Api
+LDLIBS += -Wl,-Bdynamic -lVehicle_API
+LDLIBS += -Wl,-Bdynamic -lvp
+LDLIBS += -Wl,-Bdynamic -lev
+LDLIBS += -Wl,-Bdynamic -lCommUSB
+
+######### add library path #############
+LDFLAGS += -L../../positioning_hal
+LDFLAGS += -L../Sensor
+LDFLAGS += -L../ServiceInterface
+LDFLAGS += -L../../../client/src/POS_common_API
+LDFLAGS += -L../../../client/src/POS_gps_API
+LDFLAGS += -L../../../client/src/POS_sensor_API
+
+include ../../../../vehicle_service.mk
diff --git a/vehicleservice/positioning/server/src/nsfw/positioning_application.cpp b/vehicleservice/positioning/server/src/nsfw/positioning_application.cpp
new file mode 100755
index 0000000..d23daad
--- /dev/null
+++ b/vehicleservice/positioning/server/src/nsfw/positioning_application.cpp
@@ -0,0 +1,2593 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * positioning_application.cpp
+ * @brief
+ * Module : POSITIONING
+ * Implements Vehicle service functionality
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_message_center_if.h>
+#include <peripheral_service/ps_services.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/POS_gps_API.h>
+#include <system_service/ss_sm_client_if.h>
+#include <vehicle_service/positioning_base_library.h>
+#include <stub/vehicle_notifications.h>
+#include <peripheral_service/communication_notifications.h>
+#include <other_service/VP_GetEnv.h>
+#include <cstdlib>
+#include <iostream>
+
+#include "SensorLog.h"
+#include "positioning_common.h"
+#include "POS_private.h"
+#include "Gps_API_private.h"
+#include "POS_common_private.h"
+#include "Vehicle_API.h"
+#include "Vehicle_API_private.h"
+#include "Sensor_API_private.h"
+#include "Naviinfo_API.h"
+#include "VehicleSensor_Thread.h"
+#include "ClockGPS_Process_Proto.h"
+#include "VehicleSens_Common.h"
+#include "VehicleSens_DataMaster.h"
+#include "VehicleSens_DeliveryCtrl.h"
+#include "VehicleUtility.h"
+#include "BackupMgrIf.h"
+#include "ClockIf.h"
+#include "CommUsbIf.h"
+#include "DevDetectSrvIf.h"
+#include "DiagSrvIf.h"
+#include "PSMShadowIf.h"
+#include "VehicleIf.h"
+#include "positioning_hal.h"
+#include "gps_hal.h"
+#include "CommonDefine.h"
+
+#include "VehicleIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+#define DATMOD_RETRY (3) /* Number of shared memory generation retries */
+#define DATMOD_PREINIT (0) /* Shared Memory State Before Initialization */
+#define PRIM_NAME_MAX (32) /* Maximum Name Size */
+
+/* Mask for managing various notification reception conditions */
+#define NTFY_MSK_NONE (0x00)
+/* Service availability notification */
+#define NTFY_MSK_COMMUNICATION_AVAILABILITY (0x01)
+#define NTFY_MSK_PS_COMMUSB_AVAILABILITY (0x02)
+#define NTFY_MSK_PS_PSMSHADOW_AVAILABILITY (0x04)
+#define NTFY_MSK_CLOCK_AVAILABILITY (0x08)
+#define NTFY_MSK_NS_BACKUPMGR_AVAILABILITY (0x10)
+#define NTFY_MSK_SS_DEVDETSRV_AVAILABILITY (0x20)
+#define NTFY_MSK_VS_VEHICLE_AVAILABILITY (0x40)
+/* Other Notices */
+#define NTFY_MSK_PS_PSMSHADOW_INIT_COMP (0x01) /* PSMShadow startup completion notice */
+
+/* Thread state */
+#define THREAD_STS_NOEXIST (0x00)
+#define THREAD_STS_CREATING (0x01)
+#define THREAD_STS_CREATED (0x02)
+
+#define POS_SNDMSG_DTSIZE_1 1 /* SndMSG data size 1Byte */
+#define POS_SNDMSG_DTSIZE_2 2 /* SndMSG data size 2Byte */
+#define POS_SNDMSG_DTSIZE_20 20 /* SndMSG data size of 20 bytes */
+#define POS_SNDMSG_DTSIZE_132 132 /* SndMSG data size: 132 bytes */
+
+/* PositioningLogFlag */
+#define POSITIONINGLOG_FLAG_NAVI 9
+
+/* Definition for thinning out sensor log at anomaly */
+#define POSITIONINGLOG_SYS_1_ABNORMAL_DATA_NUM 3
+#define POSITIONINGLOG_SYS_2_ABNORMAL_DATA_NUM 4
+#define POSITIONINGLOG_SYS_3_ABNORMAL_DATA_NUM 4
+#define POSITIONINGLOG_SYS_4_ABNORMAL_DATA_NUM 129
+#define POSITIONINGLOG_SYS_ABNORMAL_DATA_NUM (POSITIONINGLOG_SYS_1_ABNORMAL_DATA_NUM + \
+ POSITIONINGLOG_SYS_2_ABNORMAL_DATA_NUM + \
+ POSITIONINGLOG_SYS_3_ABNORMAL_DATA_NUM + \
+ POSITIONINGLOG_SYS_4_ABNORMAL_DATA_NUM)
+#define POSITIONINGLOG_SYS_1_ABNORMAL_DATA_OFFSET 11
+#define POSITIONINGLOG_SYS_2_ABNORMAL_DATA_OFFSET 32
+#define POSITIONINGLOG_SYS_3_ABNORMAL_DATA_OFFSET 54
+#define POSITIONINGLOG_SYS_4_ABNORMAL_DATA_OFFSET 114
+#define POSITIONINGLOG_SYS_1_ABNORMAL_SET_DATA_OFFSET 0
+#define POSITIONINGLOG_SYS_2_ABNORMAL_SET_DATA_OFFSET POSITIONINGLOG_SYS_1_ABNORMAL_DATA_NUM
+#define POSITIONINGLOG_SYS_3_ABNORMAL_SET_DATA_OFFSET (POSITIONINGLOG_SYS_1_ABNORMAL_DATA_NUM + POSITIONINGLOG_SYS_2_ABNORMAL_DATA_NUM)
+#define POSITIONINGLOG_SYS_4_ABNORMAL_SET_DATA_OFFSET (POSITIONINGLOG_SYS_1_ABNORMAL_DATA_NUM + \
+ POSITIONINGLOG_SYS_2_ABNORMAL_DATA_NUM + \
+ POSITIONINGLOG_SYS_3_ABNORMAL_DATA_NUM)
+#define POSITIONINGLOG_SYS_OPC_OFFSET 9
+#define POSITIONINGLOG_SYS_PULSE_TIME_NUM_OFFSET 114
+#define POSITIONINGLOG_SYS_NORMAL_DATA 0xC1
+#define POSITIONINGLOG_SYS_FST_DATA 0xF4
+#define _pb_strcat(pdest, psrc, size) (strncat(pdest, psrc, size) , (0))
+
+// Vehicle sensor information notification message
+typedef struct {
+ uint32_t did; // Data ID corresponding to vehicle sensor information
+ uint16_t size; // Data size of vehicle sensor information
+ uint8_t rcv_flag; // Vehicle sensor information reception flag
+ uint8_t reserve; // Reserved
+ uint8_t data[VEHICLE_VSINFO_DSIZE]; // Vehicle sensor information
+} VEHICLE_UNIT_MSG_VSINFO_DAT;
+
+// Vehicle sensor information notification message
+typedef struct {
+ VEHICLE_UNIT_MSG_VSINFO_DAT data; // Message data
+} VEHICLE_UNIT_MSG_VSINFO;
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Structure to create shared data
+*/
+typedef struct {
+ char share_data_name[PRIM_NAME_MAX]; /**< Shared data name */
+ u_int32 data_size; /**< Shared data size */
+} ST_SHAREDATA;
+
+/*!
+ @brief Thread management information
+*/
+typedef struct {
+ EnumTID_POS id; /**< Thread ID */
+ const int8_t* p_name; /**< Thread name */
+ PNO pno; /**< Process number */
+ CbFuncPtr routine; /**< Start Routine */
+ uint8_t msk_available; /**< Dependent services Availability */
+ uint8_t msk_ntfy; /**< Dependency notification */
+ uint8_t msk_thread; /**< Dependent threads */
+ BOOL is_depended; /**< Positioning/Availability->TRUE change dependency */
+ uint8_t status; /**< Thread activation state */
+ uint8_t order; /**< Boot Sequence(Performance) */
+ uint8_t reserve[2];
+} ST_THREAD_CREATE_INFO;
+
+
+/* GPS fix count information */
+typedef struct {
+ uint32_t ul3d; /* 3D */
+ uint32_t ul2d; /* 2D */
+ uint32_t ul_else; /* Not fix */
+ uint8_t dummy[4]; /* Dummy */
+} ST_GPS_FIX_CNT;
+
+/*!
+ @brief Structure that stores the time set by the time setting or the time updated(For GRADE1)
+*/
+typedef struct {
+ u_int16 year; /* Year */
+ u_int8 month; /* Month */
+ u_int8 date; /* Day */
+ u_int8 hour; /* Hour */
+ u_int8 minute;/* Minutes */
+ u_int8 second;/* Minutes */
+ u_int8 flag; /* Whether or not the time is set */
+} ST_GPS_SET_TIME;
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+static EFrameworkunifiedStatus PositioningOnStartImpl(const HANDLE hApp, const EPWR_SC_WAKEUP_TYPE wakeupType,
+ const ESMDataResetModeInfo dataResetMode);
+static EFrameworkunifiedStatus PosNotifyCommunicationAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyCommUSBAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyPSMShadowAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyPSMShadowInitComp(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyClockAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyNSBackupMgrAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyDevDetectSrvAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyVehicleAvailability(HANDLE h_app);
+
+static EFrameworkunifiedStatus PosStopThreadDummy(HANDLE h_app);
+static void PosCreateSharedMemory(void);
+static void PosCreateThread(HANDLE h_app);
+static void PosStopThread(void);
+static void PosBackupDataInit(void);
+
+/* Message Dispatching Functions */
+static EFrameworkunifiedStatus PosThreadCreateComp(HANDLE h_app);
+static EFrameworkunifiedStatus PosThreadStopComp(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifRegisterListenerPkgSensorData(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifRegisterListenerSensorData(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifReqGpsSetting(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifSetGpsInfo(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifGetGpsInfo(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifSetData(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifReqGpsReset(HANDLE h_app);
+static EFrameworkunifiedStatus PosVehicleInfoRcv(HANDLE h_app);
+static uint32_t PosGetMsg(HANDLE h_app, void** p_buf, uint32_t size);
+static RET_API PosSndMsg(PNO pno, CID cid, void* p_msg_body, uint32_t size);
+static void PosOutputDebugDumpLog(uint8_t* p_buf);
+
+/* Function scan for device insertion detection */
+static EFrameworkunifiedStatus PosOnDevDetectOpenSessionAck(HANDLE h_app);
+static EFrameworkunifiedStatus PosOnDevDetectCloseSessionAck(HANDLE h_app);
+static EFrameworkunifiedStatus PosOnDevDetectEvent(HANDLE h_app);
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/* Thread name */
+static const int8_t kThreadNamePosMain[15] = "POS_Main";
+static const int8_t kThreadNamePosSens[15] = "POS_Sens";
+static const int8_t kThreadNamePosGps[15] = "POS_Gps";
+static const int8_t kThreadNamePosGpsRecv[15] = "POS_Gps_Recv";
+static const int8_t kThreadNamePosGpsRollover[15] = "POS_Gps_Rolovr";
+
+/** Shared memory generation table */
+static ST_SHAREDATA g_sharedata_tbl[] = {
+ /* Shared data name to be generated, Shared data size */
+ { {VEHICLE_SHARE_NAME}, 512 * 11 }, /* Vehicle sensor information acquisition */
+#if 0 /* Less than 0.1 SBU,Not used in _CWORD71_ */
+ { {"SENSOR_SHARE_MEMORY"}, 512 * 11 }, /* Vehicle sensor information Pkg acquisition */
+ { {"GPS_INT_SIGNAL_SHARE_MEMORY"}, 4 }, /* GPS Interrupt Signal Acquisition */
+ { {"LOG_SETTING_SHARE_MEMORY"}, 36 }, /* DR feature log acquisition */
+ { {"GYRO_CONNECT_STTS_SHARE_MEMORY"}, 4 }, /* Get Gyro Connection Status */
+ { {"EPHEMERIS_NUM_SHARE_MEMORY"}, 4 }, /* For acquiring effective ephemeris count at shutdown */
+ { {"LOCALTIME_SHARE_MEMORY"}, 12 }, /* Local time acquisition at shutdown */
+ { {"LONLAT_SHARE_MEMORY"}, 8 }, /* Location acquisition at shutdown */
+#endif
+ { {'\0'}, 0 } /* Termination */
+};
+
+/** Sub-thread creation table
+ (1) Thread ID (Locally defined Enumeration)
+ (2) Thread name
+ (3) Process number
+ (4) Start Routine
+ (5) Dependent Availability
+ (6) Dependency notification
+ (7) Dependent threads * If there are dependent threads, do not create them until those threads are created.
+ (8) Positioning/Availability->TRUE depending on change
+ (9) Thread activation state (THREAD_STS_NOEXIST:Not started,THREAD_STS_CREATING:Starting,THREAD_STS_CREATED:Completion of the activation)
+ (10) Boot Sequence(Performance) (0,1,2, ... Note : 0 = Initial value(Not started)) Time of termination,Be destroyed in the reverse order of startup
+ */
+static ST_THREAD_CREATE_INFO g_pos_thread_create_info_Grade1[] = { // LCOV_EXCL_BR_LINE 11: unexpected branch
+ { /* Pos_main */
+ ETID_POS_MAIN, /* (1) */
+ kThreadNamePosMain, /* (2) */
+ PNO_VEHICLE_SENSOR, /* (3) */
+ &VehicleSensThread, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ 0, /* (7) */
+ TRUE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Pos_sens */
+ ETID_POS_SENS, /* (1) */
+ kThreadNamePosSens, /* (2) */
+ PNO_LINE_SENS_DRV, /* (3) */
+ &StartLineSensorThreadPositioning, /* (4) */
+ (NTFY_MSK_PS_PSMSHADOW_AVAILABILITY), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ THREAD_STS_MSK_POS_MAIN, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Pos_gps */
+ ETID_POS_GPS, /* (1) */
+ kThreadNamePosGps, /* (2) */
+ PNO_NAVI_GPS_MAIN, /* (3) */
+ &StartGpsMainThreadPositioning, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ THREAD_STS_MSK_POS_MAIN, /* (7) */
+ TRUE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Pos_gps_recv */
+ ETID_POS_GPS_RECV, /* (1) */
+ kThreadNamePosGpsRecv, /* (2) */
+ PNO_NAVI_GPS_RCV, /* (3) */
+ &StartGpsRecvThreadPositioning, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ THREAD_STS_MSK_POS_GPS, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Pos_gps_rollover */
+ ETID_POS_GPS_ROLLOVER, /* (1) */
+ kThreadNamePosGpsRollover, /* (2) */
+ PNO_CLK_GPS, /* (3) */
+ &StartGpsRolloverThreadPositioning, /* (4) */
+ (NTFY_MSK_NS_BACKUPMGR_AVAILABILITY), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ THREAD_STS_MSK_POS_GPS, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Termination */
+ ETID_POS_MAX, NULL, 0, NULL, NTFY_MSK_NONE, NTFY_MSK_NONE, 0, FALSE, THREAD_STS_NOEXIST, 0
+ },
+};
+
+/* State Management Variables */
+static bool g_start_flg = false; /** Start Processed Flag */
+static EnumExeSts_POS g_exe_sts; /** Positioning running status */
+static EnumSetupMode_POS g_setup_mode; /** Thread activation mode */
+static uint8_t g_last_thread_sts; /** Latest internal thread activation state */
+static uint8_t g_last_srv_sts; /** Latest service availability */
+static uint8_t g_last_ntfy_sts; /** Receive state of latest notification */
+static uint8_t g_last_num_of_thread; /** Number of Current Startup Threads */
+
+/** Sub-thread creation table */
+static ST_THREAD_CREATE_INFO* g_pos_thread_create_info;
+
+/** Interprocess message receive buffer */
+static uint8_t g_rcv_msg_buf[MAX_MSG_BUF_SIZE];
+
+/** Dispatcher Registration Callback Table */
+static const FrameworkunifiedProtocolCallbackHandler kPositioningPcbhs[] = { // LCOV_EXCL_BR_LINE 11: unexpected branch
+ {CID_THREAD_CREATE_COMP, &PosThreadCreateComp }, /* Thread start completion notification */
+ {CID_THREAD_STOP_COMP, &PosThreadStopComp }, /* Thread stop completion notice */
+ {CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT, &PosPosifRegisterListenerPkgSensorData},
+ {CID_VEHICLEIF_DELIVERY_ENTRY, &PosPosifRegisterListenerSensorData },
+ {CID_SENSORIF__CWORD82__REQUEST, &PosPosifReqGpsSetting },
+ {CID_NAVIINFO_DELIVER, &PosPosifSetGpsInfo },
+ {CID_VEHICLEIF_GET_VEHICLE_DATA, &PosPosifGetGpsInfo },
+ {CID_POSIF_SET_DATA, &PosPosifSetData },
+ {CID_GPS_REQRESET, &PosPosifReqGpsReset },
+};
+
+static const FrameworkunifiedProtocolCallbackHandler kPositioningPcbhsVehicle[] = { // LCOV_EXCL_BR_LINE 11: unexpected branch
+ {CID_VEHICLESENS_VEHICLE_INFO, &PosVehicleInfoRcv},
+};
+
+/** Dispatcher unregister command ID table */
+static uint32_t g_positioning_cids[] = {
+ CID_THREAD_CREATE_COMP,
+ CID_THREAD_STOP_COMP,
+ CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT,
+ CID_VEHICLEIF_DELIVERY_ENTRY,
+ CID_SENSORIF__CWORD82__REQUEST,
+ CID_NAVIINFO_DELIVER,
+ CID_VEHICLEIF_GET_VEHICLE_DATA,
+ CID_POSIF_SET_DATA,
+ CID_GPS_REQRESET,
+};
+
+static uint32_t g_positioning_cids_vehicle[] = {
+ CID_VEHICLESENS_VEHICLE_INFO,
+};
+
+
+
+/** Stop request flag for GPS reception thread */
+BOOL g_thread_stop_req;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * FrameworkunifiedOnInitialization<br>
+ * Sends message to Notification Service
+ *
+ * Mm 21 API perform initialization.<br>
+ * Generatings shared memories used by Vehicle function block..<br>
+ * Creates a sub-thread of the Vehicle feature block..
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ * eFrameworkunifiedStatusFail ABENDs
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) {
+ RET_API ret_api;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ uint8_t* p_last_srv_sts = &g_last_srv_sts;
+ uint8_t* p_last_thread_sts = &g_last_thread_sts;
+ uint8_t* p_last_ntfy_sts = &g_last_ntfy_sts;
+ ST_THREAD_CREATE_INFO** pp_thr_cre_info = &g_pos_thread_create_info;
+ uint8_t* p_last_num_thr = &g_last_num_of_thread;
+ BOOL* p_thr_stop_req = &g_thread_stop_req;
+ EnumExeSts_POS* p_exe_sts = &g_exe_sts;
+ EnumSetupMode_POS* pe_mode = &g_setup_mode;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ /* Global variable initialization */
+ *p_last_srv_sts = 0;
+ *p_last_thread_sts = 0;
+ *p_last_ntfy_sts = 0;
+ *pp_thr_cre_info = g_pos_thread_create_info_Grade1;
+ *p_last_num_thr = 0;
+ *p_thr_stop_req = FALSE;
+ *p_exe_sts = EPOS_EXE_STS_STOP;
+ *pe_mode = EPOS_SETUP_MODE_NORMAL;
+
+ /* null check */
+ if (h_app == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "h_app is NULL");
+ e_status = eFrameworkunifiedStatusFail;
+ } else {
+ /* Positioning Base API initialization */
+ ret_api = _pb_Setup_CWORD64_API(h_app);
+ if (ret_api != RET_NORMAL) { // LCOV_EXCL_BR_LINE 4: can not return error
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_Setup_CWORD64_API ERROR!! [ret_api = %d]",
+ ret_api);
+
+ e_status = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ /* Availability at Positioning startup,Set internal thread activation state */
+ if (ChkUnitType(UNIT_TYPE_GRADE1) == true) { /* GRADE1 environment */
+ *pp_thr_cre_info = g_pos_thread_create_info_Grade1;
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
+ "*pp_thr_cre_info = g_pos_thread_create_info_Grade1");
+ } else if (ChkUnitType(UNIT_TYPE_GRADE2) == true) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "_pb_ChkUnitType UNKNOWN!!");
+ }
+
+ /* Shared Memory Creation */
+ PosCreateSharedMemory();
+
+ if (e_status == eFrameworkunifiedStatusOK) {
+ /* Register callback functions for Positioning internals */
+ e_status = FrameworkunifiedAttachCallbacksToDispatcher(h_app,
+ "NS_ANY_SRC",
+ kPositioningPcbhs,
+ _countof(kPositioningPcbhs)); // LCOV_EXCL_BR_LINE 4:nsfw error
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher ERROR!! [e_status = %d]", e_status);
+ }
+
+ (void)VehicleIfAttachCallbacksToDispatcher(kPositioningPcbhsVehicle,
+ _countof(kPositioningPcbhsVehicle));
+ }
+
+ if (e_status == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Positioning/Availability registration */
+ e_status = FrameworkunifiedRegisterServiceAvailabilityNotification(h_app, POS_AVAILABILITY);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedRegisterServiceAvailabilityNotification ERROR!! [e_status = %d]", e_status);
+ }
+ }
+
+ if (e_status == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Positioning/Availability -> FALSE */
+ e_status = FrameworkunifiedPublishServiceAvailability(h_app, FALSE);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedPublishServiceAvailability ERROR!! [e_status = %d]", e_status);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "Positioning/Availability -> FALSE");
+ }
+ }
+
+ /* Communication/Availability Changing notification registration */
+ FrameworkunifiedSubscribeNotificationWithCallback(h_app, NTFY_Communication_Availability, &PosNotifyCommunicationAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* PS_CommUSB/Availability Changing notification registration */
+ (void)CommUsbIfNotifyOnCommUSBAvailability(&PosNotifyCommUSBAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* PS_PSMShadow/Availability Changing notification registration */
+ (void)PSMShadowIfNotifyOnPSMShadowAvailability(&PosNotifyPSMShadowAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+ /* PS_PSMShadow Startup completion notification registration */
+ (void)PSMShadowIfNotifyOnPSMShadowInitComp(&PosNotifyPSMShadowInitComp); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* Clock/Availability Changing notification registration */
+ (void)ClockIfNotifyOnClockAvailability(&PosNotifyClockAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* NS_BackupMgr/Availability Changing notification registration */
+ (void)BackupMgrIfNotifyOnBackupMgrAvailability(&PosNotifyNSBackupMgrAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* Regist Vehilce Availability Notification */
+ (void)VehicleIfNotifyOnVehicleAvailability(&PosNotifyVehicleAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* DeviceDetectionServiceIf initialization */
+ if (DevDetectSrvIfInitialize() == eFrameworkunifiedStatusOK) {
+ /* SS_DevDetectSrv/Availability Changing notification registration */
+ (void)DevDetectSrvIfNotifyOnDeviceDetectionAvailability(&PosNotifyDevDetectSrvAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return e_status;
+}
+
+/**
+ * @brief
+ * PositioningOnStartImpl
+ */
+static EFrameworkunifiedStatus PositioningOnStartImpl(const HANDLE hApp, const EPWR_SC_WAKEUP_TYPE wakeupType,
+ const ESMDataResetModeInfo dataResetMode) {
+ EnumExeSts_POS* p_exe_sts = &g_exe_sts;
+ EnumSetupMode_POS* pe_mode = &g_setup_mode;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ if (g_start_flg == false) {
+ g_start_flg = true;
+
+ /* Running */
+ *p_exe_sts = EPOS_EXE_STS_RUNNING;
+
+ /* Cold start */
+ if (wakeupType == epsstCOLDSTART) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "wakeupType:COLDSTART");
+
+ *p_exe_sts = EPOS_EXE_STS_RUNNING_COLDSTART;
+
+ /* Initialize GPS time setting information */
+ PosBackupDataInit();
+ } else { /* Time of warm start */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "wakeupType:WARMSTART");
+ }
+
+ /* Time of factory initialization */
+ if (dataResetMode == e_SS_SM_DATA_RESET_MODE_FACTORY) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "dataResetMode:FACTORYRESET");
+
+ /* Set thread start mode to ""data reset start"" */
+ *pe_mode = EPOS_SETUP_MODE_DATA_RESET;
+
+ /* Initialize GPS time setting information */
+ PosBackupDataInit();
+ }
+
+ PosCreateThread(hApp);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnStart
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ EFrameworkunifiedStatus ret = eFrameworkunifiedStatusFail;
+ uint32_t size;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ size = PosGetMsg(hApp, reinterpret_cast<void**>(&g_rcv_msg_buf), MAX_MSG_BUF_SIZE);
+ if (size != 0) {
+ T_SS_SM_START_DataStructType* p_start_data;
+ p_start_data = reinterpret_cast<T_SS_SM_START_DataStructType*>(g_rcv_msg_buf);
+
+ ret = PositioningOnStartImpl(hApp, p_start_data->wakeupType, p_start_data->dataResetMode);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return ret;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnStop
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ * eFrameworkunifiedStatusFail ABENDs
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status;
+ EnumExeSts_POS* p_exe_sts = &g_exe_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ /* null check */
+ if (h_app == NULL) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "h_app is NULL");
+ // LCOV_EXCL_STOP
+ } else {
+ *p_exe_sts = EPOS_EXE_STS_STOP;
+
+ e_status = FrameworkunifiedPublishServiceAvailability(h_app, FALSE);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedPublishServiceAvailability ERROR!! [e_status = %d]",
+ e_status);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "Positioning/Availability -> FALSE");
+ }
+
+ PosStopThread();
+
+ g_start_flg = false;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ /* Return end response to SM at timing after completion of internal thread stop */
+ return eFrameworkunifiedStatusFail;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnPreStart
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ EFrameworkunifiedStatus ret = eFrameworkunifiedStatusFail;
+ uint32_t size;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ size = PosGetMsg(hApp, reinterpret_cast<void**>(&g_rcv_msg_buf), MAX_MSG_BUF_SIZE);
+ if (size != 0) {
+ T_SS_SM_START_DataStructType* p_start_data;
+ p_start_data = reinterpret_cast<T_SS_SM_START_DataStructType*>(g_rcv_msg_buf);
+
+ ret = PositioningOnStartImpl(hApp, p_start_data->wakeupType, p_start_data->dataResetMode);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return ret;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnPreStop
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnBackgroundStart
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ EFrameworkunifiedStatus ret = eFrameworkunifiedStatusFail;
+ uint32_t size;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ size = PosGetMsg(hApp, reinterpret_cast<void**>(&g_rcv_msg_buf), MAX_MSG_BUF_SIZE);
+ if (size != 0) {
+ T_SS_SM_START_DataStructType* p_start_data;
+ p_start_data = reinterpret_cast<T_SS_SM_START_DataStructType*>(g_rcv_msg_buf);
+
+ ret = PositioningOnStartImpl(hApp, p_start_data->wakeupType, p_start_data->dataResetMode);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return ret;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnBackgroundStop
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnDestroy (Not mounted)
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ * eFrameworkunifiedStatusFail ABENDs
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app) { // LCOV_EXCL_START 14 Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * FrameworkunifiedOnDebugDump
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ * eFrameworkunifiedStatusFail ABENDs
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app) { // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf_tmp[256];
+ static uint8_t buf_proc[128];
+ static uint8_t buf_thread[512];
+ static uint8_t buf_message[4][DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_mutex[3][DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_timer[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_event[9][DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_memory[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_other[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_nand[256];
+ static uint8_t buf_ram[256];
+ static uint8_t buf_gps_format_fail[512];
+ static uint8_t buf_antenna[256];
+ static uint8_t buf_gps_info[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_navi_info[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_deli_ctrl_tbl[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_deli_ctrl_tbl_mng[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_pkg_deli_tbl_mng[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_deli_pno_tbl[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_sys[128];
+ int32_t i;
+ ST_THREAD_CREATE_INFO* p_thr_cre_info = g_pos_thread_create_info;
+ ST_GPS_FIX_CNT st_gps_fix_cnt;
+ ST_GPS_SET_TIME st_gps_set_time;
+ uint8_t len_msg = 4;
+ uint8_t len_mtx = 3;
+ uint8_t len_evt = 9;
+ EFrameworkunifiedStatus e_status;
+ BOOL b_is_available;
+ UNIT_TYPE e_type = UNIT_TYPE_NONE;
+ u_int8 sys_recv_flg;
+ uint16_t wkn_rollover;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ memset(&buf_proc[0], 0x00, sizeof(buf_proc));
+ memset(&buf_thread[0], 0x00, sizeof(buf_thread));
+ memset(&buf_nand[0], 0x00, sizeof(buf_nand));
+ memset(&buf_ram[0], 0x00, sizeof(buf_ram));
+ memset(&buf_gps_format_fail[0], 0x00, sizeof(buf_gps_format_fail));
+ memset(&buf_antenna[0], 0x00, sizeof(buf_antenna));
+ memset(&buf_gps_info[0], 0x00, sizeof(buf_gps_info));
+ memset(&buf_navi_info[0], 0x00, sizeof(buf_navi_info));
+ memset(&buf_deli_ctrl_tbl[0], 0x00, sizeof(buf_deli_ctrl_tbl));
+ memset(&buf_deli_ctrl_tbl_mng[0], 0x00, sizeof(buf_deli_ctrl_tbl_mng));
+ memset(&buf_pkg_deli_tbl_mng[0], 0x00, sizeof(buf_pkg_deli_tbl_mng));
+ memset(&buf_deli_pno_tbl[0], 0x00, sizeof(buf_deli_pno_tbl));
+ memset(&buf_sys[0], 0x00, sizeof(buf_sys));
+
+ for (i = 0; i < len_msg; i++) {
+ memset(&buf_message[i][0], 0x00, sizeof(buf_message[i]));
+ }
+ for (i = 0; i < len_mtx; i++) {
+ memset(&buf_mutex[i][0], 0x00, sizeof(buf_mutex[i]));
+ }
+ memset(&buf_timer[0], 0x00, sizeof(buf_timer));
+ for (i = 0; i < len_evt; i++) {
+ memset(&buf_event[i][0], 0x00, sizeof(buf_event[i]));
+ }
+ memset(&buf_memory[0], 0x00, sizeof(buf_memory));
+ memset(&buf_other[0], 0x00, sizeof(buf_other));
+ e_type = GetEnvSupportInfo();
+
+ /* Availability status of related processes */
+ snprintf(reinterpret_cast<char *>(&buf_proc[0]), sizeof(buf_proc),
+ "Availability\n thread:0x%02x, srv:0x%02x, ntfy:0x%02x",
+ g_last_thread_sts, /* Latest internal thread activation state */
+ g_last_srv_sts, /* Latest service availability */
+ g_last_ntfy_sts); /* Receive state of latest notification */
+
+ /* Internal thread activation state */
+ snprintf(reinterpret_cast<char *>(&buf_thread[0]), sizeof(buf_thread), "Thread");
+ for (i = 0; i < ETID_POS_MAX; i++) {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%d]id:%d, pno:0x%04x, name:%16s, sts:0x%02x, order:%d",
+ i,
+ p_thr_cre_info->id, /* Thread ID */
+ p_thr_cre_info->pno, /* Process number */
+ p_thr_cre_info->p_name, /* Thread name */
+ p_thr_cre_info->status, /* Thread activation state */
+ p_thr_cre_info->order); /* Boot Sequence */
+ _pb_strcat(reinterpret_cast<char *>(&buf_thread[0]), reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp));
+ p_thr_cre_info++;
+ }
+
+ /* BASE API control data */
+ /* Message */
+ (void)_pb_GetDebugMsgMngTbl(&buf_message[0][0], &len_msg);
+ /* Mutex */
+ (void)_pb_GetDebugMutexMngTbl(&buf_mutex[0][0], &len_mtx);
+ /* Timer */
+ (void)_pb_GetDebugTimerMngTbl(&buf_timer[0]);
+ /* Event */
+ (void)_pb_GetDebugEventMngTbl(&buf_event[0][0], &len_evt);
+ /* Shared Memory */
+ (void)_pb_GetDebugMemoryMngTbl(&buf_memory[0]);
+ /* Other */
+ (void)_pb_GetDebugOtherMngTbl(&buf_other[0]);
+
+ /* NAND data */
+ snprintf(reinterpret_cast<char *>(&buf_nand[0]), sizeof(buf_nand), "NAND");
+ /* GPS fix count */
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ memset(&st_gps_fix_cnt, 0x00, sizeof(st_gps_fix_cnt));
+
+ e_status = BackupMgrIfBackupDataRd(D_BK_ID_POS_GPS_FIX_CNT,
+ 0,
+ &st_gps_fix_cnt,
+ sizeof(st_gps_fix_cnt), &b_is_available);
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n %20s rd:0x%08x av:%d, 3d:%d, 2d:%d, else:%d, dmy:0x%02x%02x%02x%02x",
+ "GPS_FIX_CNT",
+ e_status,
+ b_is_available,
+ st_gps_fix_cnt.ul3d,
+ st_gps_fix_cnt.ul2d,
+ st_gps_fix_cnt.ul_else,
+ st_gps_fix_cnt.dummy[0], st_gps_fix_cnt.dummy[1], st_gps_fix_cnt.dummy[2], st_gps_fix_cnt.dummy[3]);
+ _pb_strcat(reinterpret_cast<char *>(&buf_nand[0]), reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp));
+
+ /* Data of the backup RAM */
+ snprintf(reinterpret_cast<char *>(&buf_ram[0]), sizeof(buf_ram), "BackupRAM");
+ /* Set GPS date and time(Information) */
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ (void)memset( reinterpret_cast<void *>(&st_gps_set_time), 0, (size_t)sizeof(st_gps_set_time) );
+
+ e_status = BackupMgrIfBackupDataRd(D_BK_ID_POS_GPS_TIME_SET_INFO,
+ 0,
+ &st_gps_set_time,
+ sizeof(st_gps_set_time),
+ &b_is_available);
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n %20s rd:0x%08x av:%d, %d/%d/%d %d:%d:%d flag:0x%02x",
+ "GPS_TIME_SET_INFO",
+ e_status,
+ b_is_available,
+ st_gps_set_time.year,
+ st_gps_set_time.month,
+ st_gps_set_time.date,
+ st_gps_set_time.hour,
+ st_gps_set_time.minute,
+ st_gps_set_time.second,
+ st_gps_set_time.flag);
+ _pb_strcat(reinterpret_cast<char *>(&buf_ram[0]), reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp));
+
+ if (e_type == UNIT_TYPE_GRADE1) {
+ /* GPS format anomaly counter */ /* There is no lock control. */
+ (void)DEVGpsGetDebugGpsFormatFailCnt(&buf_gps_format_fail[0]);
+
+ /* GPS antenna connection status */ /* There is no lock control. */
+ VEHICLESENS_DATA_MASTER st_sns_data = {0};
+ (void)VehicleSensGetGpsAntenna(&st_sns_data, VEHICLESENS_GETMETHOD_LINE);
+ snprintf(reinterpret_cast<char *>(&buf_antenna[0]), sizeof(buf_antenna),
+ "Antenna\n sts:0x%02x",
+ st_sns_data.uc_data[0]);
+
+ /* GPS position time */ /* There is no lock control. */
+ (void)VehicleSensGetDebugPosDate(&buf_gps_info[0], VEHICLESENS_GETMETHOD_GPS);
+ }
+
+ if (e_type == UNIT_TYPE_GRADE1) {
+ /* Navigation position time */ /* There is no lock control. */
+ (void)VehicleSensGetDebugPosDate(&buf_navi_info[0], VEHICLESENS_GETMETHOD_NAVI);
+ }
+
+ /* Delivery table */ /* There is no lock control. */
+ (void)VehicleSensGetDebugDeliveryCtrlTbl(&buf_deli_ctrl_tbl[0]);
+ (void)VehicleSensGetDebugDeliveryCtrlTblMng(&buf_deli_ctrl_tbl_mng[0]);
+ (void)VehicleSensGetDebugPkgDeliveryTblMng(&buf_pkg_deli_tbl_mng[0]);
+ (void)VehicleSensGetDebugDeliveryPnoTbl(&buf_deli_pno_tbl[0]);
+
+ /* Initial Sensor Data Status from Sys */
+ sys_recv_flg = LineSensDrvGetSysRecvFlag();
+ snprintf(reinterpret_cast<char *>(&buf_sys[0]), sizeof(buf_sys),
+ "Rx 1st Sensor Data %d\n", sys_recv_flg);
+
+ /* Dump Information Out */
+ PosOutputDebugDumpLog(&buf_proc[0]);
+ PosOutputDebugDumpLog(&buf_thread[0]);
+ for (i = 0; i < len_msg; i++) {
+ PosOutputDebugDumpLog(&buf_message[i][0]);
+ }
+ for (i = 0; i < len_mtx; i++) {
+ PosOutputDebugDumpLog(&buf_mutex[i][0]);
+ }
+ PosOutputDebugDumpLog(&buf_timer[0]);
+ for (i = 0; i < len_evt; i++) {
+ PosOutputDebugDumpLog(&buf_event[i][0]);
+ }
+ PosOutputDebugDumpLog(&buf_memory[0]);
+ PosOutputDebugDumpLog(&buf_other[0]);
+ PosOutputDebugDumpLog(&buf_nand[0]);
+ PosOutputDebugDumpLog(&buf_ram[0]);
+ if (e_type == UNIT_TYPE_GRADE1) {
+ PosOutputDebugDumpLog(&buf_gps_format_fail[0]);
+ PosOutputDebugDumpLog(&buf_antenna[0]);
+ PosOutputDebugDumpLog(&buf_gps_info[0]);
+ }
+ if (e_type == UNIT_TYPE_GRADE1) {
+ PosOutputDebugDumpLog(&buf_navi_info[0]);
+ }
+ PosOutputDebugDumpLog(&buf_deli_ctrl_tbl[0]);
+ PosOutputDebugDumpLog(&buf_deli_ctrl_tbl_mng[0]);
+ PosOutputDebugDumpLog(&buf_pkg_deli_tbl_mng[0]);
+ PosOutputDebugDumpLog(&buf_deli_pno_tbl[0]);
+ PosOutputDebugDumpLog(&buf_sys[0]);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * FrameworkunifiedCreateStateMachine (Not mounted)
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ * eFrameworkunifiedStatusFail ABENDs
+ */
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @brief
+ * Common processing after thread startup
+ *
+ * Thread naming,Create Message Queue,Thread activation response
+ *
+ * @param[in] h_app Application handle
+ * @param[in] e_tid Thread ID
+ *
+ * @return Thread activation mode
+ */
+EnumSetupMode_POS PosSetupThread(HANDLE h_app, EnumTID_POS e_tid) {
+ RET_API ret;
+ ST_THREAD_CREATE_INFO* p_thr_cre_info = g_pos_thread_create_info;
+ ST_THREAD_CREATE_INFO* p_info;
+ ST_THREAD_SETUP_INFO st_setup_info;
+ ST_THREAD_SETUP_INFO* pst_setup_info = &st_setup_info;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ p_info = p_thr_cre_info + e_tid;
+
+ /* Application handle setting */
+ _pb_SetAppHandle(h_app);
+
+ /* Create Message Queue */
+ _pb_CreateMsg(p_info->pno);
+
+ /* Get Thread Startup Information */
+ pst_setup_info->e_mode = EPOS_SETUP_MODE_NORMAL;
+ (void)PosGetMsg(h_app, reinterpret_cast<void**>(&pst_setup_info), sizeof(ST_THREAD_SETUP_INFO));
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "[e_mode = %d]", pst_setup_info->e_mode);
+
+ /* Issue thread creation completion notice */
+ ret = _pb_SndMsg_Ext(POS_THREAD_NAME, CID_THREAD_CREATE_COMP, sizeof(EnumTID_POS), (const void*)&e_tid, 0);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg_Ext ERROR!! [ret = %d]", ret);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return pst_setup_info->e_mode;
+}
+
+/**
+ * @brief
+ * Common Processing at Thread Stop
+ *
+ * Thread stop response,Thread destruction
+ *
+ * @param[in] e_tid Thread ID
+ */
+void PosTeardownThread(EnumTID_POS e_tid) {
+ RET_API ret;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ /* Issue thread stop completion notice */
+ ret = _pb_SndMsg_Ext(POS_THREAD_NAME, CID_THREAD_STOP_COMP, sizeof(EnumTID_POS), (const void*)&e_tid, 0);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg_Ext ERROR!! [ret = %d]", ret);
+ }
+
+ /* Thread destruction */
+ _pb_ExitThread((DWORD)0);
+
+ /* don't arrive here */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return; // LCOV_EXCL_LINE 8 : cannot reach here
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/**
+ * @brief
+ * FrameworkunifiedCreateChildThread dummy functions
+ *
+ * @param[in] Application handle
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosStopThreadDummy(HANDLE h_app) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+/*---------------------------------------------------------------------------------*
+ * Local Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Communication services Availability notification callback functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosNotifyCommunicationAvailability(HANDLE h_app) {
+ BOOL isAvailable;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+ if (isAvailable == TRUE) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Communication/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_COMMUNICATION_AVAILABILITY;
+
+ PosCreateThread(h_app);
+
+ /* Sensor Log Initial Processing(First)*/
+ SensLogInitialize(NULL);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Communication/Availability -> FALSE");
+
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_COMMUNICATION_AVAILABILITY);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * CommUSB services Availability notification callback functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosNotifyCommUSBAvailability(HANDLE h_app) {
+ BOOL isAvailable;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+ if (isAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PS_CommUSB/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_PS_COMMUSB_AVAILABILITY;
+
+ PosCreateThread(h_app);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PS_CommUSB/Availability -> FALSE");
+
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_PS_COMMUSB_AVAILABILITY);
+ }
+
+ /* Update CommUSB I/F availability */
+ CommUsbIfSetAvailability(isAvailable);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * PSMShadow services Availability notification callback functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosNotifyPSMShadowAvailability(HANDLE h_app) {
+ BOOL isAvailable;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+ if (isAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PS_PSMShadow/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_PS_PSMSHADOW_AVAILABILITY;
+
+ PosCreateThread(h_app);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PS_PSMShadow/Availability -> FALSE");
+
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_PS_PSMSHADOW_AVAILABILITY);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * PSMShadow services Callback function for notifying completion of startup
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosNotifyPSMShadowInitComp(HANDLE h_app) {
+ uint8_t* pLastNtfySts = &g_last_ntfy_sts;
+ ST_THREAD_CREATE_INFO* pThrCreInfo = g_pos_thread_create_info;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ *pLastNtfySts |= NTFY_MSK_PS_PSMSHADOW_INIT_COMP;
+
+ /* When the Pos_Sens thread is started */
+ if (((pThrCreInfo + ETID_POS_SENS)->status) == THREAD_STS_CREATED) {
+ /* External pin status request */
+ LineSensDrvExtTermStsReq();
+ }
+
+ PosCreateThread(h_app);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Clock Services Availability Notification Callback Functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosNotifyClockAvailability(HANDLE h_app) {
+ BOOL isAvailable;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+ if (isAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Clock/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_CLOCK_AVAILABILITY;
+
+ PosCreateThread(h_app);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Clock/Availability -> FALSE");
+
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_CLOCK_AVAILABILITY);
+ }
+
+ /* Update Clock I/F availability */
+ ClockIfSetAvailability(isAvailable);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * NS_BackupMgr service Availability notification callback function
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosNotifyNSBackupMgrAvailability(HANDLE h_app) {
+ EnumExeSts_POS* pExeSts = &g_exe_sts;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+ ST_THREAD_CREATE_INFO* pThrCreInfo = g_pos_thread_create_info;
+ EnumSetupMode_POS* peMode = &g_setup_mode;
+ BOOL bIsAvailable;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ bIsAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+
+ /* Update BackupMgr I/F availability */
+ BackupMgrIfSetAvailability(bIsAvailable);
+
+ if (bIsAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NS_BackupMgr/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_NS_BACKUPMGR_AVAILABILITY;
+
+ /* Executing after cold start or during factory initialization*/
+ if ((*pExeSts == EPOS_EXE_STS_RUNNING_COLDSTART) ||
+ (*peMode == EPOS_SETUP_MODE_DATA_RESET)) {
+ /* Backup RAM initialization */
+ PosBackupDataInit();
+ }
+
+ /* When the GPS management thread is started */
+ if (((pThrCreInfo + ETID_POS_GPS)->status) == THREAD_STS_CREATED) {
+ if ((*pExeSts == EPOS_EXE_STS_RUNNING_COLDSTART) ||
+ (*peMode == EPOS_SETUP_MODE_DATA_RESET)) {
+ // GPS reset request.
+ SENSOR_INTERNAL_MSG_BUF msg_buf = {};
+ T_APIMSG_MSGBUF_HEADER *msg_hdr = &msg_buf.hdr;
+ msg_hdr->hdr.cid = CID_GPS_REQRESET;
+ msg_hdr->hdr.msgbodysize = sizeof(POS_RESETINFO);
+ POS_RESETINFO *msg_data = reinterpret_cast<POS_RESETINFO *>(&msg_buf.data);
+ msg_data->mode = GPS_RST_COLDSTART;
+
+ RET_API ret = _pb_SndMsg(PNO_NAVI_GPS_MAIN, sizeof(msg_buf), &msg_buf, 0);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_pb_SndMsg ERROR!! [ret=%d]", ret);
+ }
+ }
+
+ /* Backup data read request to GSP management thread */
+ (void)DEVGpsSndBackupDataLoadReq();
+ }
+ /* Enable Diag Code Writing */
+ DiagSrvIfSetRegistrationPermission(TRUE);
+
+ PosCreateThread(h_app);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NS_BackupMgr/Availability -> FALSE");
+
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_NS_BACKUPMGR_AVAILABILITY);
+ /* Write prohibited dialog code */
+ DiagSrvIfSetRegistrationPermission(FALSE);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * SS_DevDetectSrv service Availability Callback Functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosNotifyDevDetectSrvAvailability(HANDLE h_app) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ BOOL isAvailable;
+ BOOL bDummy;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+
+ /* Update DevDetectSrv I/F availability */
+ DevDetectSrvIfSetAvailability(isAvailable);
+
+ if (isAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "SS_DevDetectSrv/Availability -> TRUE");
+ *pLastSrvSts |= NTFY_MSK_SS_DEVDETSRV_AVAILABILITY;
+
+ eStatus = DevDetectSrvIfOpenSessionRequest(&bDummy);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf OpenSession ERROR!! [eStatus = %d]", eStatus);
+ } else {
+ eStatus = DevDetectSrvIfNotifyOnOpenSessionAck(&PosOnDevDetectOpenSessionAck, &bDummy);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf NotifyOnOpenSessionAck ERROR!! [eStatus = %d]", eStatus);
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "SS_DevDetectSrv/Availability -> FALSE");
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_SS_DEVDETSRV_AVAILABILITY);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+
+/**
+ * @brief
+ * Vehicle Availability notification callback functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ *
+ */
+static EFrameworkunifiedStatus PosNotifyVehicleAvailability(HANDLE h_app) {
+ BOOL isAvailable;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+
+ /* Update Vechile I/F Abailability */
+ VehicleIf_SetAvailability(isAvailable);
+
+ if (isAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Vehicle/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_VS_VEHICLE_AVAILABILITY;
+
+ if (eFrameworkunifiedStatusFail == VehicleIfDeliveryEntry(VEHICLE_DID_SPEED)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleIfDeliveryEntry SPEED ERROR");
+ }
+
+ if (eFrameworkunifiedStatusFail == VehicleIfDeliveryEntry(VEHICLE_DID_REV)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleIfDeliveryEntry REV ERROR");
+ }
+
+ if (eFrameworkunifiedStatusFail == VehicleIfDeliveryEntry(VEHICLE_DID_SPEED_PULSE_VEHICLE)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleIfDeliveryEntry SPEED PULSE ERROR");
+ }
+
+ PosCreateThread(h_app);
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Vehicle/Availability -> FALSE");
+
+ *pLastSrvSts &= ~NTFY_MSK_VS_VEHICLE_AVAILABILITY;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Shared Memory Creation for Positioning Function
+ *
+ * @return RET_NORMAL Normal completion
+ * RET_ERROR ABENDs
+ */
+static void PosCreateSharedMemory(void) {
+ RET_API ret_api = RET_NORMAL;
+ void *mod_exec_dmy; /* Module data pointer(dummy) */
+ int retry; /* Retry counter */
+ ST_SHAREDATA *p_shm_tbl;
+
+ /* Configure Shared Data Generating Tables */
+ p_shm_tbl = g_sharedata_tbl;
+
+ while ( *(p_shm_tbl->share_data_name) != '\0' ) {
+ for ( retry = 0; retry < DATMOD_RETRY; retry++ ) {
+ /* Shared Memory Generation */
+ ret_api = _pb_CreateShareData(p_shm_tbl->share_data_name, p_shm_tbl->data_size, &mod_exec_dmy);
+ if (ret_api == RET_NORMAL) { /* If successful */
+ /* Set the shared memory status flag to ""Before initialization (0)"" */
+ *reinterpret_cast<u_int32 *>(mod_exec_dmy) = DATMOD_PREINIT;
+
+ break;
+ } else { /* In the event of failure */
+ /* Error Handling */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_CreateShareData ERROR [ret_api:%d]",
+ ret_api);
+ }
+ }
+
+ if (retry >= DATMOD_RETRY) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateShareData failed more %d times.",
+ DATMOD_RETRY);
+
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ /* Next shared memory generation */
+ p_shm_tbl++;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Positioning in-process thread creation
+ *
+ * @param[in] hApp application handles
+ */
+static void PosCreateThread(HANDLE h_app) {
+ HANDLE threadHandle;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ EnumSetupMode_POS* peMode = &g_setup_mode;
+ int32_t i;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+ uint8_t* pLastThreadSts = &g_last_thread_sts;
+ uint8_t* pLastNtfySts = &g_last_ntfy_sts;
+ EnumExeSts_POS* pExeSts = &g_exe_sts;
+ ST_THREAD_CREATE_INFO* pThrCreInfo = g_pos_thread_create_info;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ for (i = 0; i < ETID_POS_MAX; i++) {
+ if ((pThrCreInfo->status == THREAD_STS_NOEXIST) && (pThrCreInfo->routine != NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__,
+ "i=%d, mskThread=0x%02x, *pLastThreadSts=0x%02x,"\
+ "mskAvailable=0x%02x, *pLastSrvSts=0x%02x, mskNtfy=0x%02x, *pLastNtfySts=0x%02x",
+ i,
+ pThrCreInfo->msk_thread,
+ *pLastThreadSts,
+ pThrCreInfo->msk_available,
+ *pLastSrvSts,
+ pThrCreInfo->msk_ntfy,
+ *pLastNtfySts);
+
+ if ((*pExeSts != EPOS_EXE_STS_STOP)
+ && ((((pThrCreInfo->msk_thread) & (*pLastThreadSts)) == pThrCreInfo->msk_thread)
+ || (pThrCreInfo->msk_thread == 0))
+ && ((((pThrCreInfo->msk_available) & (*pLastSrvSts)) == pThrCreInfo->msk_available)
+ || (pThrCreInfo->msk_available == NTFY_MSK_NONE))
+ && ((((pThrCreInfo->msk_ntfy) & (*pLastNtfySts)) == pThrCreInfo->msk_ntfy)
+ || (pThrCreInfo->msk_ntfy == NTFY_MSK_NONE))) {
+ if (pThrCreInfo->pno == PNO_LINE_SENS_DRV || \
+ pThrCreInfo->pno == PNO_NAVI_GPS_MAIN || \
+ pThrCreInfo->pno == PNO_NAVI_GPS_RCV ||
+ pThrCreInfo->pno == PNO_CLK_GPS) {
+ (pThrCreInfo->routine)(h_app);
+ } else {
+ /* Thread creation */
+ threadHandle = FrameworkunifiedCreateChildThread(h_app,
+ (PCSTR)(pThrCreInfo->p_name),
+ pThrCreInfo->routine,
+ &PosStopThreadDummy);
+ if (threadHandle == NULL) { /* If the thread creation fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedCreateChildThread ERROR!! [tHandle=%p]",
+ threadHandle);
+ _pb_Exit();
+ /* don't arrive here. */
+ } else {
+ /* Thread activation (Notify the startup mode) */
+ eStatus = FrameworkunifiedStartChildThread(h_app,
+ threadHandle,
+ sizeof(EnumSetupMode_POS),
+ reinterpret_cast<void*>(peMode));
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedStartChildThread ERROR!! [eStatus=%d, name=%s]",
+ eStatus,
+ pThrCreInfo->p_name);
+ } else {
+ pThrCreInfo->status = THREAD_STS_CREATING;
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "name=%s", pThrCreInfo->p_name);
+ }
+ }
+ }
+ }
+ }
+
+ pThrCreInfo++;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return;
+}
+
+
+/**
+ * @brief
+ * Termination of Positioning in-process threads
+ */
+static void PosStopThread(void) {
+ RET_API ret;
+ ST_THREAD_CREATE_INFO* p_thr_cre_info = g_pos_thread_create_info;
+ BOOL *p_thr_stop_req = &g_thread_stop_req;
+ uint8_t uc_msg = 0;
+ uint8_t uc_order = 0;
+ PNO us_pno = 0;
+ int32_t i;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ for (i = 0; i < ETID_POS_MAX; i++) {
+ if (uc_order < p_thr_cre_info->order) {
+ uc_order = p_thr_cre_info->order;
+ us_pno = p_thr_cre_info->pno;
+ }
+ p_thr_cre_info++;
+ }
+
+ if (uc_order != 0) {
+ /* Send Thread Termination Request */
+ if (us_pno == PNO_NAVI_GPS_RCV) {
+ /* Pos_gps_recv Only thread flag control */
+ *p_thr_stop_req = TRUE;
+ } else {
+ ret = PosSndMsg(us_pno, CID_THREAD_STOP_REQ, &uc_msg, sizeof(uc_msg));
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PosSndMsg ERROR!! [ret = %d]",
+ ret);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Backup RAM initialization
+ */
+static void PosBackupDataInit(void) {
+ UNIT_TYPE e_type = UNIT_TYPE_NONE;
+ EFrameworkunifiedStatus e_status;
+ BOOL b_is_available;
+ ST_GPS_SET_TIME st_gps_set_time;
+
+ (void)memset( reinterpret_cast<void *>(&st_gps_set_time), 0, (size_t)sizeof(st_gps_set_time) );
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ e_type = GetEnvSupportInfo();
+ if (e_type == UNIT_TYPE_GRADE1) {
+ /* Set GPS date and time */
+ e_status = BackupMgrIfBackupDataWt(D_BK_ID_POS_GPS_TIME_SET_INFO,
+ &st_gps_set_time,
+ 0,
+ sizeof(st_gps_set_time),
+ &b_is_available);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "D_BK_ID_POS_GPS_TIME_SET_INFO:W:Clear");
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "BackupMgrIfBackupDataWt ERROR!! [e_status=%d, b_is_available=%d]",
+ e_status,
+ b_is_available);
+ }
+ } else if (e_type == UNIT_TYPE_GRADE2) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ } else {
+ /* No processing */
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher()
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosThreadCreateComp(HANDLE h_app) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ uint8_t* pLastThreadSts = &g_last_thread_sts;
+ ST_THREAD_CREATE_INFO* pThrCreInfo = g_pos_thread_create_info;
+ uint8_t* pLastNumThr = &g_last_num_of_thread;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+ uint8_t* pLastNtfySts = &g_last_ntfy_sts;
+ EnumTID_POS eTid;
+ int32_t i;
+ static BOOL isSetAvailable = FALSE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ (*pLastNumThr)++;
+
+ eTid = *(reinterpret_cast<EnumTID_POS*>(pRcvMsg));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X]",
+ (pThrCreInfo + eTid)->p_name,
+ CID_THREAD_CREATE_COMP);
+
+ /* Thread Management Variable Updates */
+ *pLastThreadSts = static_cast<uint8_t>(*pLastThreadSts | (0x1u << eTid));
+ (pThrCreInfo + eTid)->status = THREAD_STS_CREATED;
+ (pThrCreInfo + eTid)->order = *pLastNumThr;
+
+ /* Individual processing of started threads */
+ switch (eTid) {
+ case ETID_POS_SENS: /* When sensor driver thread startup is completed */
+ {
+ /* When PSMShadow startup completion notice has been received */
+ if (((NTFY_MSK_PS_PSMSHADOW_INIT_COMP) & (*pLastNtfySts)) == NTFY_MSK_PS_PSMSHADOW_INIT_COMP) {
+ /* External pin status request */
+ LineSensDrvExtTermStsReq();
+ }
+ break;
+ }
+ case ETID_POS_GPS: /* When the GPS management thread has started */
+ {
+ /* NSBackupMgr/Availability=When TRUE notification has been received */
+ if (((NTFY_MSK_NS_BACKUPMGR_AVAILABILITY) & (*pLastSrvSts)) == NTFY_MSK_NS_BACKUPMGR_AVAILABILITY) {
+ /* Backup data read request to GSP management thread */
+ (void)DEVGpsSndBackupDataLoadReq();
+ }
+ break;
+ }
+ default: /* Other thread startup completion time */
+ break;
+ }
+
+ PosCreateThread(h_app);
+
+ for (i = 0; i < ETID_POS_MAX; i++) {
+ if ((pThrCreInfo->is_depended == TRUE) && (pThrCreInfo->status != THREAD_STS_CREATED)) {
+ break; /* Positioning/Availability->TRUE condition does not meet */
+ }
+ pThrCreInfo++;
+ }
+
+ if ((i == ETID_POS_MAX) && (isSetAvailable == FALSE)) {
+ /* Positionig/Availability -> TRUE */
+ eStatus = FrameworkunifiedPublishServiceAvailability(h_app, TRUE);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedPublishServiceAvailability ERROR!! [eStatus = %d]",
+ eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "Positioning/Availability -> TRUE");
+ isSetAvailable = TRUE;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher()
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosThreadStopComp(HANDLE h_app) {
+ EFrameworkunifiedStatus eStatus;
+ BOOL bIsAvailable;
+
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ uint8_t* pLastThreadSts = &g_last_thread_sts;
+ ST_THREAD_CREATE_INFO* pThrCreInfo = g_pos_thread_create_info;
+ uint8_t* pLastNumThr = &g_last_num_of_thread;
+ BOOL *pThrStopReq = &g_thread_stop_req;
+ EnumTID_POS eTid;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ (*pLastNumThr)--;
+
+ eTid = *(reinterpret_cast<EnumTID_POS*>(pRcvMsg));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X]",
+ (pThrCreInfo + eTid)->p_name,
+ CID_THREAD_STOP_COMP);
+
+ *pLastThreadSts = static_cast<uint8_t>(*pLastThreadSts & ~(0x1u << eTid));
+
+ (pThrCreInfo + eTid)->status = THREAD_STS_NOEXIST;
+ (pThrCreInfo + eTid)->order = 0;
+
+ if ((pThrCreInfo + eTid)->pno == PNO_NAVI_GPS_RCV) {
+ *pThrStopReq = FALSE;
+ }
+ }
+
+ PosStopThread();
+
+ /* When all threads have stopped */
+ if (*pLastThreadSts == 0) {
+ /* Unregister callback function */
+ eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(h_app,
+ "NS_ANY_SRC",
+ (const PUI_32)g_positioning_cids,
+ _countof(g_positioning_cids), NULL);
+ if (eStatus != eFrameworkunifiedStatusOK) { /* In the event of failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningDetachCallbacksToDispatcher Failed in FrameworkunifiedOnStop [eStatus:%d]",
+ eStatus);
+ }
+
+ /* Sensor log stop processing */
+ SensLogTerminate();
+
+ /* DeviceDetectionServiceIf termination process */
+ eStatus = DevDetectSrvIfUnRegisterForDeviceDetectionEvent(SS_DEV_DETECT_ANY_USB_EV, &bIsAvailable);
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf UnRegisterEvent ERROR!! [sts:%d, ava:%d]",
+ eStatus,
+ bIsAvailable);
+ } else {
+ eStatus = DevDetectSrvIfCloseSessionRequest(&bIsAvailable);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf CloseSession ERROR!! [sts=%d, ava:%d]",
+ eStatus,
+ bIsAvailable);
+ }
+ }
+
+ (void)VehicleIfDetachCallbacksFromDispatcher((const PUI_32)g_positioning_cids_vehicle,
+ _countof(g_positioning_cids_vehicle));
+
+ /* Releasing Base API Resources */
+ _pb_Teardown_CWORD64_API();
+
+ /* Stop processing completion response */
+ SendInterfaceunifiedOnStopResponseToSystemManager(eFrameworkunifiedStatusOK);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(POS_RegisterListenerPkgSensData)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifRegisterListenerPkgSensorData(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ EventID ulEventId;
+ PCSTR pName;
+ static const PCSTR pNone = "-";
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ pName = _pb_CnvPno2Name((reinterpret_cast<SENSOR_MSG_DELIVERY_ENTRY_DAT*>(pRcvMsg))->pno);
+ if (pName == NULL) {
+ pName = pNone;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X",
+ pName,
+ CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT);
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ /* Event Generation */
+ ulEventId = PosCreateEvent((reinterpret_cast<SENSOR_MSG_DELIVERY_ENTRY_DAT*>(pRcvMsg))->pno);
+ if (ulEventId != 0) {
+ /* Event publishing */
+ ret = _pb_SetEvent(ulEventId, SAPI_EVSET_ABSOLUTE, SENSOR_RET_ERROR_INNER);
+ if (ret != RET_NORMAL) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SetEvent ERROR!! [ret = %d]", ret);
+ }
+ /* Event deletion */
+ (void)PosDeleteEvent(ulEventId);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosCreateEvent ERROR!!");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(POS_RegisterListenerSensData)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifRegisterListenerSensorData(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ EventID ulEventId;
+ PCSTR pName;
+ static const PCSTR pNone = "-";
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ pName = _pb_CnvPno2Name((reinterpret_cast<VEHICLE_MSG_DELIVERY_ENTRY_DAT*>(pRcvMsg))->pno);
+ if (pName == NULL) {
+ pName = pNone;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X]",
+ pName,
+ CID_VEHICLEIF_DELIVERY_ENTRY);
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_VEHICLEIF_DELIVERY_ENTRY, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ /* Event Generation */
+ ulEventId = VehicleCreateEvent((reinterpret_cast<VEHICLE_MSG_DELIVERY_ENTRY_DAT*>(pRcvMsg))->pno);
+ if (ulEventId != 0) {
+ /* Event publishing */
+ ret = _pb_SetEvent(ulEventId, SAPI_EVSET_ABSOLUTE, SENSOR_RET_ERROR_INNER);
+ if (ret != RET_NORMAL) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SetEvent ERROR!! [ret = %d]", ret);
+ }
+ /* Event deletion */
+ (void)VehicleDeleteEvent(ulEventId);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleCreateEvent ERROR!!");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(POS_ReqGPSSetting)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifReqGpsSetting(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ uint8_t ucResult = SENSLOG_RES_FAIL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:-][CID:0x%X]",
+ CID_SENSORIF__CWORD82__REQUEST);
+ ucResult = SENSLOG_RES_SUCCESS;
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_SENSORIF__CWORD82__REQUEST, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ }
+ }
+
+ SensLogWriteInputData(SENSLOG_DATA_I_GPSSET, 0, 0, pRcvMsg, static_cast<uint16_t>(size),
+ ucResult, SENSLOG_ON, SENSLOG_ON);
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(POS_SetGPSInfo)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifSetGpsInfo(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ uint8_t ucResult = SENSLOG_RES_FAIL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:-][CID:0x%X]",
+ CID_NAVIINFO_DELIVER);
+ ucResult = SENSLOG_RES_SUCCESS;
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_NAVI_GPS_MAIN, CID_NAVIINFO_DELIVER, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ }
+ }
+ SensLogWriteInputData(SENSLOG_DATA_I_GPSINF, 0, 0, pRcvMsg, static_cast<uint16_t>(size),
+ ucResult, SENSLOG_ON, SENSLOG_ON);
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(POS_GetGPSInfo)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifGetGpsInfo(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ EventID ulEventId;
+ PCSTR pName;
+ static const PCSTR pNone = "-";
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ pName = _pb_CnvPno2Name((reinterpret_cast<VEHICLE_MSG_GET_VEHICLE_DATA_DAT*>(pRcvMsg))->pno);
+ if (pName == NULL) {
+ pName = pNone;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X]",
+ pName,
+ CID_VEHICLEIF_GET_VEHICLE_DATA);
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_VEHICLEIF_GET_VEHICLE_DATA, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ /* Event Generation */
+ ulEventId = VehicleCreateEvent((reinterpret_cast<VEHICLE_MSG_GET_VEHICLE_DATA_DAT*>(pRcvMsg))->pno);
+ if (ulEventId != 0) {
+ /* Event publishing */
+ ret = _pb_SetEvent(ulEventId, SAPI_EVSET_ABSOLUTE, POS_RET_ERROR_INNER);
+ if (ret != RET_NORMAL) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_SetEvent ERROR!! [ret = %d]",
+ ret);
+ }
+ /* Event deletion */
+ (void)VehicleDeleteEvent(ulEventId);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleCreateEvent ERROR!!");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(CID_POSIF_SET_DATA)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifSetData(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ EventID ulEventId;
+ PCSTR pName;
+ static const PCSTR pNone = "-";
+ uint8_t ucResult = SENSLOG_RES_FAIL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ ucResult = SENSLOG_RES_SUCCESS;
+
+ pName = _pb_CnvPno2Name((reinterpret_cast<POS_MSGINFO*>(pRcvMsg))->pno);
+ if (pName == NULL) {
+ pName = pNone;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X][DID:0x%X]",
+ pName,
+ CID_POSIF_SET_DATA,
+ (reinterpret_cast<POS_MSGINFO*>(pRcvMsg))->did);
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_POSIF_SET_DATA, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ if ((reinterpret_cast<POS_MSGINFO*>(pRcvMsg))->did == VEHICLE_DID_SETTINGTIME) {
+ /* GPS time setting(When waiting for completion of an event, an event is issued. */
+ /* Event Generation */
+ ulEventId = VehicleCreateEvent((reinterpret_cast<POS_MSGINFO*>(pRcvMsg))->pno);
+ if (ulEventId != 0) {
+ /* Event publishing */
+ ret = _pb_SetEvent(ulEventId, SAPI_EVSET_ABSOLUTE, POS_RET_ERROR_INNER);
+ if (ret != RET_NORMAL) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_SetEvent ERROR!! [ret = %d]",
+ ret);
+ }
+ /* Event deletion */
+ (void)VehicleDeleteEvent(ulEventId);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleCreateEvent ERROR!!");
+ }
+ }
+ }
+ }
+ SensLogWriteInputData(SENSLOG_DATA_I_UNSPECIFIED,
+ (reinterpret_cast<POS_MSGINFO*>(pRcvMsg))->did,
+ 0,
+ pRcvMsg,
+ static_cast<uint16_t>(size),
+ ucResult,
+ SENSLOG_ON,
+ SENSLOG_ON);
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(CID_GPS_REQRESET)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifReqGpsReset(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ EventID ulEventId;
+ PCSTR pName;
+ static const PCSTR pNone = "-";
+ uint8_t ucResult = SENSLOG_RES_FAIL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ ucResult = SENSLOG_RES_SUCCESS;
+
+ pName = _pb_CnvPno2Name((reinterpret_cast<POS_RESETINFO*>(pRcvMsg))->snd_pno);
+ if (pName == NULL) {
+ pName = pNone;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X]",
+ pName,
+ CID_GPS_REQRESET);
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_NAVI_GPS_MAIN, CID_GPS_REQRESET, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+
+ /* Event Generation */
+ ulEventId = VehicleCreateEvent((reinterpret_cast<POS_RESETINFO*>(pRcvMsg))->snd_pno);
+ if (0 != ulEventId) {
+ /* Event publishing */
+ ret = _pb_SetEvent(ulEventId, SAPI_EVSET_ABSOLUTE, POS_RET_ERROR_INNER);
+ if (ret != RET_NORMAL) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_SetEvent ERROR!! [ret = %d]",
+ ret);
+ }
+ /* Event deletion */
+ (void)VehicleDeleteEvent(ulEventId);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleCreateEvent ERROR!!");
+ }
+ }
+ }
+
+ SensLogWriteInputData(SENSLOG_DATA_I_GPSRST, 0, 0, pRcvMsg, static_cast<uint16_t>(size),
+ ucResult, SENSLOG_ON, SENSLOG_ON);
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(CID_VEHICLESENS_VEHICLE_INFO)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosVehicleInfoRcv(HANDLE h_app) {
+ LSDRV_MSG_LSDATA_DAT_G line_sns_data;
+ RET_API ret = RET_NORMAL;
+
+ memset(&line_sns_data, 0, sizeof(line_sns_data));
+ LSDRV_MSG_LSDATA_DAT_G *p_line_sns_data = &line_sns_data;
+ VEHICLE_UNIT_MSG_VSINFO *p_vehicle_msg = NULL;
+ uint32_t size = 0;
+ uint16_t us_speed = 0;
+
+ uint8_t* pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ memset(p_line_sns_data, 0x00, sizeof(line_sns_data));
+ p_vehicle_msg = (reinterpret_cast<VEHICLE_UNIT_MSG_VSINFO*>(pRcvMsg));
+ switch (p_vehicle_msg->data.did) {
+ // SPEED info
+ case VEHICLE_DID_SPEED:
+ {
+ p_line_sns_data->uc_data_num = LSDRV_KINDS_MAX;
+ p_line_sns_data->st_data[LSDRV_SPEED_KMPH].ul_did = POSHAL_DID_SPEED_KMPH;
+ p_line_sns_data->st_data[LSDRV_SPEED_KMPH].uc_size = POS_SNDMSG_DTSIZE_2;
+ p_line_sns_data->st_data[LSDRV_SPEED_KMPH].uc_sns_cnt = 0;
+
+ char p_env_variable[VP_MAX_LENGTH];
+
+ VP_GetEnv("VP__CWORD31__SPEED", p_env_variable);
+ if (0 == strcmp(p_env_variable, "direct")) {
+ int16_t speed = 0;
+ // To obtain the vehicle speed from Direct lanes,1 to 2 bytes of received data
+ memcpy(&speed, &p_vehicle_msg->data.data[0], sizeof(speed));
+ us_speed = static_cast<uint16_t>(abs(speed));
+ // Unit conversion [km/h] -> [0.01km/h]
+ us_speed = static_cast<uint16_t>(us_speed * 100);
+ } else if (0 == strcmp(p_env_variable, "CAN")) {
+ UINT16 speed = 0;
+ // To obtain the vehicle speed from CAN,2 to 3 bytes of received data
+ memcpy(&speed, &p_vehicle_msg->data.data[1], sizeof(speed));
+ us_speed = static_cast<uint16_t>(abs(speed));
+ // Unit conversion [km/h] -> [0.01km/h]
+ us_speed = static_cast<uint16_t>(us_speed * 100);
+ } else {
+ // In case of invalid value, the vehicle speed is acquired by CAN.
+ UINT16 speed = 0;
+ memcpy(&speed, &p_vehicle_msg->data.data[1], sizeof(speed));
+ us_speed = static_cast<uint16_t>(abs(speed));
+ // Unit conversion [km/h] -> [0.01km/h]
+ us_speed = static_cast<uint16_t>(us_speed * 100);
+ }
+
+ memcpy(&p_line_sns_data->st_data[LSDRV_SPEED_KMPH].uc_data[0], &us_speed, sizeof(us_speed));
+
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_LINESENS_VEHICLE_DATA_G,
+ reinterpret_cast<void*>(p_line_sns_data), sizeof(line_sns_data));
+
+ break;
+ }
+ // REV information
+ case VEHICLE_DID_REV:
+ {
+ p_line_sns_data->uc_data_num = LSDRV_KINDS_MAX;
+ p_line_sns_data->st_data[LSDRV_REV].ul_did = VEHICLE_DID_REV;
+ p_line_sns_data->st_data[LSDRV_REV].uc_size = POS_SNDMSG_DTSIZE_1;
+ p_line_sns_data->st_data[LSDRV_REV].uc_sns_cnt = 0;
+ p_line_sns_data->st_data[LSDRV_REV].uc_data[0] = p_vehicle_msg->data.data[0];
+
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_LINESENS_VEHICLE_DATA_G,
+ reinterpret_cast<void*>(p_line_sns_data), sizeof(line_sns_data));
+ break;
+ }
+
+ // Speed Pulse information
+ case VEHICLE_DID_SPEED_PULSE_VEHICLE:
+ {
+ p_line_sns_data->uc_data_num = LSDRV_KINDS_MAX;
+ p_line_sns_data->st_data[LSDRV_SPEED_PULSE].ul_did = POSHAL_DID_SPEED_PULSE;
+ p_line_sns_data->st_data[LSDRV_SPEED_PULSE].uc_size = sizeof(float);
+ p_line_sns_data->st_data[LSDRV_SPEED_PULSE].uc_sns_cnt = 0;
+
+ memcpy(&p_line_sns_data->st_data[LSDRV_SPEED_PULSE].uc_data[0],
+ &p_vehicle_msg->data.data[0], sizeof(float));
+
+ p_line_sns_data->st_data[LSDRV_PULSE_TIME].ul_did = POSHAL_DID_PULSE_TIME;
+ p_line_sns_data->st_data[LSDRV_PULSE_TIME].uc_size = sizeof(float);
+ p_line_sns_data->st_data[LSDRV_PULSE_TIME].uc_sns_cnt = 0;
+
+ memcpy(&p_line_sns_data->st_data[LSDRV_PULSE_TIME].uc_data[0],
+ &p_vehicle_msg->data.data[sizeof(float)], sizeof(float));
+
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_LINESENS_VEHICLE_DATA_G,
+ reinterpret_cast<void*>(p_line_sns_data), sizeof(line_sns_data));
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Get Message
+ *
+ * Get messages received by the dispatcher
+ *
+ * @param[in] h_app Application handle
+ * @param[out] p_buf Pointer to receive data storage buffer
+ * @param[in] Sizes of size receive data storage buffers
+ *
+ * @return Received data size(0:Receiving error)
+ */
+static uint32_t PosGetMsg(HANDLE h_app, void** p_buf, uint32_t size) {
+ EFrameworkunifiedStatus eStatus;
+ uint32_t ulSize = 0;
+ void* pRcvBuf;
+
+ /* null check */
+ if ((h_app == NULL) || (p_buf == NULL)) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Argument ERROR!! [h_app = %p, p_buf = %p]",
+ h_app,
+ p_buf);
+ // LCOV_EXCL_STOP
+ } else {
+ /* Check the size of received data */
+ ulSize = FrameworkunifiedGetMsgLength(h_app);
+ if (ulSize > size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Message size ERROR!! [ulSize = %d, maxsize = %d]",
+ ulSize,
+ size);
+ ulSize = 0;
+ } else {
+ /* Obtain data */
+ eStatus = FrameworkunifiedGetDataPointer(h_app, &pRcvBuf);
+ if (eStatus == eFrameworkunifiedStatusOK) {
+ *p_buf = pRcvBuf;
+ } else if (eStatus == eFrameworkunifiedStatusInvldBufSize) {
+ eStatus = FrameworkunifiedGetMsgDataOfSize(h_app, *p_buf, ulSize);
+ /* When acquisition fails */
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetMsgDataOfSize ERROR [eStatus:%d]",
+ eStatus);
+ ulSize = 0;
+ }
+ } else {
+ /* When acquisition fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetDataPointer ERROR [eStatus:%d]",
+ eStatus);
+ ulSize = 0;
+ }
+ }
+ }
+
+ return ulSize;
+}
+
+/**
+ * @brief
+ * Sending Messages for Internal Threads
+ *
+ * Adds a header to the message received by the dispatcher and sends it to the internal thread..
+ *
+ * @param[in] pno PNO
+ * @param[in] cid Command ID
+ * @param[in] p_msg_body Sent message body
+ * @param[in] size Send message size
+ *
+ * @return RET_NORAML Normal completion
+ * RET_ERROR ABENDs
+ */
+static RET_API PosSndMsg(PNO pno, CID cid, void* p_msg_body, uint32_t size) {
+ RET_API ret = RET_NORMAL;
+ T_APIMSG_MSGBUF_HEADER* p;
+ static u_int8 sndMsgBuf[MAX_MSG_BUF_SIZE + sizeof(T_APIMSG_MSGBUF_HEADER)];
+
+ if ((p_msg_body == NULL) || (size > MAX_MSG_BUF_SIZE)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! [p_msg_body = %p, size = %d]", p_msg_body, size);
+ ret = RET_ERROR;
+ } else {
+ p = reinterpret_cast<T_APIMSG_MSGBUF_HEADER*>(sndMsgBuf);
+
+ /* Message header addition */
+ p->hdr.cid = cid;
+ p->hdr.msgbodysize = static_cast<uint16_t>(size);
+
+ /* Copy of the data section */
+ memcpy((p + 1), p_msg_body, size);
+
+ /* Send a message to an internal thread */
+ ret = _pb_SndMsg(pno, static_cast<uint16_t>(size + sizeof(T_APIMSG_MSGBUF_HEADER)), p, 0);
+ /* When transmission fails */
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg ERROR [ret = %d]", ret);
+ ret = RET_ERROR;
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * SS_DevDetectSrv service OpenSessionAck Callback Functions
+ *
+ * @param none
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosOnDevDetectOpenSessionAck(HANDLE h_app) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ BOOL bIsAvailable;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ eStatus = DevDetectSrvIfDecodeOpenSessionResponse(&bIsAvailable);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf OpenSession ERROR!! [sts=%d, ava=%d]", eStatus, bIsAvailable);
+ } else {
+ eStatus = DevDetectSrvIfRegisterForDeviceDetectionEvent(SS_DEV_DETECT_ANY_USB_EV,
+ &PosOnDevDetectEvent,
+ NULL,
+ &bIsAvailable);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf RegisterEvent ERROR!! [sts=%d, ava=%d]", eStatus, bIsAvailable);
+ } else {
+ eStatus = DevDetectSrvIfNotifyOnCloseSessionAck(&PosOnDevDetectCloseSessionAck, &bIsAvailable);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf CloseSessionAck ERROR!! [sts=%d, ava=%d]",
+ eStatus,
+ bIsAvailable);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * SS_DevDetectSrv service CloseSessionAck Callback Functions
+ *
+ * @param none
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosOnDevDetectCloseSessionAck(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Sensor log stop processing */
+ SensLogTerminate();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * SS_DevDetectSrv service Event Callback Functions
+ *
+ * @param none
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosOnDevDetectEvent(HANDLE h_app) {
+ SS_MediaDetectInfo stMedia;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ uint32_t ulSize = 0;
+ uint8_t mode;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ /* Check the size of received data */
+ ulSize = FrameworkunifiedGetMsgLength(h_app);
+ if (ulSize > sizeof(SS_MediaDetectInfo)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Message size ERROR!! [ulSize = %d, maxsize = %ld]",
+ ulSize, sizeof(SS_MediaDetectInfo));
+ ulSize = 0;
+ } else {
+ /* Obtain data */
+ eStatus = FrameworkunifiedGetMsgDataOfSize(h_app, &stMedia, ulSize);
+ /* When acquisition fails */
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetMsgDataOfSize ERROR [eStatus:%d]", eStatus);
+ ulSize = 0;
+ } else {
+ if (eUSB == stMedia.dev_type) {
+ if (TRUE == stMedia.bIsDeviceAvailable) {
+ /* Mount detection */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
+ "USB mounted sts=[%d] path=[%s] fusedav=[%d]",
+ stMedia.bIsDeviceAvailable, stMedia.deviceMountpath, stMedia.bIsFuseDav);
+
+ /* NOTE: bIsFuseDav -> From the _CWORD80_'s point of view, */
+ /* TRUE(With a USB flash drive inserted into the _CWORD84_,Be synchronized on the FuseDav)*/
+ /* FALSE(USB memory is inserted into the _CWORD80_.) */
+
+ if (stMedia.bIsFuseDav == FALSE) {
+ /* Inserted into your USB port */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "SensLog Initialize start.");
+ /* Get Debug/Release setting */
+ eStatus = NsLogGetFrameworkunifiedLogFlag(POSITIONINGLOG_FLAG_NAVI, &mode);
+ /* When acquisition fails */
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "NsLogGetFrameworkunifiedLogFlag ERROR [eStatus:%d]", eStatus);
+ } else {
+ if (mode == FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG) {
+ /* Sensor Log Initial Processing(Normal)*/
+ SensLogInitialize(reinterpret_cast<uint8_t *>(stMedia.deviceMountpath));
+ }
+ }
+ } else {
+ /* TODO: Mounts (FuseDav synchronized) that are not inserted into your device's USB port are not supported. */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "Don't output SensLog.");
+ }
+ } else {
+ /* Unmount detection */
+ if (stMedia.bIsFuseDav == FALSE) {
+ /* When it is unmounted to its own USB */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
+ "USB umounted sts=[%d] fusedav=[%d]",
+ stMedia.bIsDeviceAvailable, stMedia.bIsFuseDav);
+
+ /* Sensor log stop processing */
+ SensLogTerminate();
+ }
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return eStatus;
+}
+
+/**
+ * @brief Debug dump log output function
+ *
+ * @param[in] *p_buf Pointer to the output string
+ */
+static void PosOutputDebugDumpLog(uint8_t* p_buf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SSDEBUGDUMP("%s\n", p_buf);
+ MilliSecSleep(1);
+ return;
+}
+// LCOV_EXCL_STOP
+
diff --git a/vehicleservice/positioning/server/src/nsfw/ps_main.cpp b/vehicleservice/positioning/server/src/nsfw/ps_main.cpp
new file mode 100755
index 0000000..de2732a
--- /dev/null
+++ b/vehicleservice/positioning/server/src/nsfw/ps_main.cpp
@@ -0,0 +1,59 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_application.h>
+#include <peripheral_service/ps_services.h>
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_system_if.h>
+#include <vehicle_service/positioning_base_library.h>
+#include <cstdlib>
+#include <iostream>
+#include "vehicle_version.h"
+
+const CHAR kAppName[PS_APPNAME_MAX] = "Positioning";
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, // NOLINT(readability/nolint)
+ MINORNO, // NOLINT(readability/nolint)
+ REVISION);
+
+/* FRAMEWORKUNIFIEDLOGPARAM : g_FrameworkunifiedLogParams : definition for LOG */
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { // NOLINT(readability/nolint)
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31,
+ ZONE_POS_SYS_IN, ZONE_POS_GPS_IN, ZONE_POS_CMD_IN, ZONE_POS_NAV_IN
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+/* Function : main */
+int main(int argc, char *argv[]) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FrameworkunifiedDefaultCallbackHandler cb_funcs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cb_funcs);
+
+ FRAMEWORKUNIFIED_SET_ZONES();
+ e_status = FrameworkunifiedDispatcher(kAppName, &cb_funcs);
+
+ return e_status;
+} // LCOV_EXCL_BR_LINE 10:The final line
diff --git a/vehicleservice/positioning_base_library/LICENSE b/vehicleservice/positioning_base_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/vehicleservice/positioning_base_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/vehicleservice/positioning_base_library/Makefile.client b/vehicleservice/positioning_base_library/Makefile.client
new file mode 100755
index 0000000..c3aaab5
--- /dev/null
+++ b/vehicleservice/positioning_base_library/Makefile.client
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### subdirectories #########
+SUBDIRS += library
+
+include ../vehicle_service.mk
diff --git a/vehicleservice/positioning_base_library/library/Makefile b/vehicleservice/positioning_base_library/library/Makefile
new file mode 100755
index 0000000..c0aec5b
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/Makefile
@@ -0,0 +1,87 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libPOS_base_API
+
+######### install headers(*.h) #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += std_types.h
+INST_HEADERS += sys_timerapi.h
+INST_HEADERS += WPF_STD.h
+INST_HEADERS += pos_message_header.h
+INST_HEADERS += positioning_base_library.h
+INST_HEADERS += positioning_positioningbaselibrarylog.h
+
+######### compiled sources #############
+VPATH += src
+libPOS_base_API_SRCS += _pbTimer.cpp
+libPOS_base_API_SRCS += _pbCSection.cpp
+libPOS_base_API_SRCS += _pbMutex.cpp
+libPOS_base_API_SRCS += _pbSem.cpp
+libPOS_base_API_SRCS += _pbDram.cpp
+libPOS_base_API_SRCS += _pbFsys.cpp
+libPOS_base_API_SRCS += _pbMem.cpp
+libPOS_base_API_SRCS += _pbSram.cpp
+libPOS_base_API_SRCS += _pbOSCtrl.cpp
+libPOS_base_API_SRCS += _pbSerial.cpp
+libPOS_base_API_SRCS += _pbWaitforsingleobject.cpp
+libPOS_base_API_SRCS += _pbOther.cpp
+libPOS_base_API_SRCS += _pbProcMng.cpp
+libPOS_base_API_SRCS += _pbCommon.cpp
+libPOS_base_API_SRCS += _CWORD64_api.cpp
+libPOS_base_API_SRCS += _pbMisc.cpp
+libPOS_base_API_SRCS += _pbEvent.cpp
+libPOS_base_API_SRCS += _pbMsg.cpp
+libPOS_base_API_SRCS += _pbSum.cpp
+libPOS_base_API_SRCS += MsgBapi.cpp
+libPOS_base_API_SRCS += memcpy_64p_sync.cpp
+libPOS_base_API_SRCS += memset_64p_sync.cpp
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC
+CPPFLAGS += -D_CWORD64_API_DOES_NOT_USE_UNICODE
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lvp
+LDLIBS += -Wl,-Bdynamic -lrt
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lev
+
+######### add library path #############
+LDFLAGS += -shared
+
+INSTALL = install
+CREATE_DIR = $(DESTDIR)/nv/BS/vs/positioning_base_library/rwdata
+install-data:
+ $(INSTALL) -d -m 775 $(CREATE_DIR)
+
+include ../../vehicle_service.mk
diff --git a/vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h b/vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h
new file mode 100755
index 0000000..141c8d8
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+ * File name : DEV_TimerEntryDrv_if.h
+ * System name : Integrated PF
+ * Subsystem name : Timer registry drivers
+ * Title : APIs for Timer registry drivers
+ ****************************************************************************/
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_DEV_TIMERENTRYDRV_IF_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_DEV_TIMERENTRYDRV_IF_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*-----------------------------------------------------------------------------
+ * Constant definition
+ *----------------------------------------------------------------------------*/
+/* Return value */
+#define DEV_TED_INVALID (u_int32)0 /* Timer start failure */
+#define DEV_TED_STOP_NG (u_int32)0 /* Timer stop failure */
+#define DEV_TED_STOP_OK (u_int32)1 /* Timer stop success */
+
+/* Definitions for event Handle names */
+#define DEV_TED_EVTNAME_MAX (u_int32)32 /* _CWORD64_ Events HANDLE Name */
+
+/*-----------------------------------------------------------------------------
+ * Structure Definition
+ *----------------------------------------------------------------------------*/
+/* Structures for timer setting instructions (_CWORD64_ messages) */
+typedef struct {
+ int32 set_time; /* Count time */
+ PNO pno; /* _CWORD64_ Messages Destination PNOs */
+ u_int32 ext_data; /* Extended Info for _CWORD64_ Messages */
+} stTED_SetTime__CWORD64_msg;
+
+/* Structures for timer setting directives (Windows events) */
+typedef struct {
+ int32 set_time; /* Count time */
+ char evob_name[DEV_TED_EVTNAME_MAX]; /* _CWORD64_ Events HANDLE Name */
+ int32 ext_data; /* _CWORD64_ Events Extended Info */
+} stTED_SetTime__CWORD64_evt;
+
+/* Structures for sending _CWORD64_ messages */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER header; /* _CWORD64_ Message header */
+ u_int32 timer_id; /* Timer IDs for _CWORD64_ messages */
+ u_int32 us_data; /* Extended Info for _CWORD64_ Messages */
+} stTimer_CWORD64_msg;
+
+/* Structures for timer setting directives (Windows events) */
+typedef struct {
+ int32 set_time; /* Count time */
+ wchar_t evob_name[DEV_TED_EVTNAME_MAX]; /* _CWORD64_ Events HANDLE Name */
+} stTED_SetTime_winevt;
+/*
+ API Function Prototype
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+u_int32 DEVSetTimer_CWORD64_msg(stTED_SetTime__CWORD64_msg *p_set_data);
+u_int32 DEVSetTimer_CWORD64_event(stTED_SetTime__CWORD64_evt *p_set_data);
+u_int32 DEVStopTimer(u_int32 time_id);
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_DEV_TIMERENTRYDRV_IF_H_
+
diff --git a/vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h b/vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h
new file mode 100755
index 0000000..d20d6f0
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * File name : TimerDrv_If.h
+ * System name : Integrated PF
+ * Process name : Timer registry driversI/F
+ * Overview : Timer registry drivers I/F Header file
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TIMERENTRYDRV_IF_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TIMERENTRYDRV_IF_H_
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DEV_TimerEntryDrv_if.h"
+
+/*
+ Constant definition
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#define TED_DRV_NAME "TED" /* Channel names of drivers registered in the Timer */
+/* The channel name cannot be a leading slash. Location is under /dev/name/local */
+
+/*-----------------------------------------------------------------------------
+ * CTRL CODE definitions
+ *----------------------------------------------------------------------------*/
+/* IOCTRL internal-processing sort codes */
+#define TED_IOCTRL_TIMREQ __DIOTF(_DCMD_MISC, 1, stTedApidt) /* Timer start */
+#define TED_IOCTRL_STPREQ __DIOT(_DCMD_MISC, 2, stTedApidt) /* Timer stop */
+
+#define TED_IF_SETTIME_MIN (int32)1 /* Minimum count time(1ms) */
+
+#define TED_IF_SETPNO_NG (PNO)0 /* PNO invalid value for _CWORD64_ messages */
+#define TED_IF_MMEVENT_INVALID_ID 0 /* Invalid _CWORD64_ EventID */
+
+#define TED_IF_RET__CWORD64_MSG (u_int16)1 /* How Users Are Notified on Timeouts: _CWORD64_ Messages */
+#define TED_IF_RET_WINEVT (u_int16)2 /* How Users Are Notified on Timeouts: Windows Events */
+
+/* Timer type */
+#define TED_IF_TIMERTYPE_CYCLE 1 /* Fixed period Timer Specified in [10ms] */
+#define TED_IF_TIMERTYPE_SINGLE 2 /* Single occurrence Timer Specified in [10ms] */
+
+/* API type(Distinguishing between API Functions Used at Timer Startup) */
+#define TED_IF_APITYPE_SYS 1 /* Timer start by _pb_ReqTimerStart() */
+#define TED_IF_APITYPE_DEV 2 /* Timer start by DEV_SetTimer_XXX() */
+
+/*
+ Data type definition
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Timer registration data by user(Timer register driver IF -> timer register driver) */
+typedef struct {
+ int32 time_rem; /* User's remaining timer count time(count value in 10 [msec] units) */
+ u_int32 timer_id; /* User's timer ID */
+ u_int32 ret_data; /* User's extended information */
+ PNO ret_pno; /* User's _CWORD64_ message-destination process number */
+ u_int16 fin_mode; /* User Timeout Notification Method */
+ char wev_ob_name[DEV_TED_EVTNAME_MAX]; /* Event name(32 characters) */
+ u_int32 timer_seq; /* Timer Sequence Number */
+ u_int8 time_type; /* Timer type(Fixed period/single occurrence) */
+ u_int8 api_type; /* API type(_pb_ReqTimerStart/DEV_SetTimer) */
+ u_int8 reserve[2];
+} stTedApidt;
+typedef stTedApidt *PTED_IFDT;
+
+/* Timer Start/Stop Messages Structures, */
+typedef struct {
+ int32 time_rem; /* User's remaining timer count time(count value in 10 [msec] units) */
+ u_int32 timer_id; /* User's timer ID */
+ u_int32 ret_data; /* User's extended information */
+ PNO ret_pno; /* User's _CWORD64_ message-destination process number */
+ u_int16 fin_mode; /* User Timeout Notification Method */
+ char wev_ob_name[DEV_TED_EVTNAME_MAX]; /* Event name(32 characters) */
+ u_int32 timer_seq; /* Timer Sequence Number */
+ u_int8 time_type; /* Timer type(Fixed period/single occurrence) */
+ u_int8 api_type; /* API type(_pb_ReqTimerStart/DEV_SetTimer) */
+ u_int8 reserve[2];
+} TIMERUSERDATA;
+
+/* Structures for sending _CWORD64_ message timer START */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER header; /* _CWORD64_ Message header */
+ /* Extended Info for _CWORD64_ Messages */
+ TIMERUSERDATA st_us_data;
+} stTimerStart_CWORD64_msg;
+
+/* Structures for sending _CWORD64_ message timer STOP */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER header; /* _CWORD64_ Message header */
+ /* Extended Info for _CWORD64_ Messages */
+ TIMERUSERDATA st_us_data;
+} stTimerStop_CWORD64_msg;
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TIMERENTRYDRV_IF_H_
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : TimerEntryDrv_If.h
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
diff --git a/vehicleservice/positioning_base_library/library/include/WPF_STD_private.h b/vehicleservice/positioning_base_library/library/include/WPF_STD_private.h
new file mode 100755
index 0000000..87f57cd
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/WPF_STD_private.h
@@ -0,0 +1,295 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file WPF_STD_private.h
+ * @brief Header file for system standard definitions
+ */
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+
+/* _CWORD64_ non-OS managed areas */
+#define SDRAM__CWORD64__NOTOS_AREA 0x00000000
+#define SDRAM__CWORD64__NOTOS_AREA_SIZE 0x0
+
+#define BLVER_SIZE 0x00000008 /* BootLoader version information area size */
+#define FROM_FIX_VER_SIZE BLVER_SIZE /* Mask(BootLoder)Version size */
+
+/* Start address of the _CWORD64_ non-OS management area */
+#define TOP_ADDR_NOTOS SDRAM__CWORD64__NOTOS_AREA
+/* Size of the non-OS management area */
+#define NOTOS_SISE SDRAM__CWORD64__NOTOS_AREA_SIZE
+
+/* Reserved(32KB)Unavailable */
+#define SRAMDRAM_RESERVE2_SIZE 0x00008000
+
+#define WINAPI
+
+#define STATUS_WAIT_0 ((DWORD)0x00000000L)
+#define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080L)
+#define STATUS_TIMEOUT ((DWORD)0x00000102L)
+#define WAIT_TIMEOUT STATUS_TIMEOUT
+#define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0)
+#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0) + 0)
+#define WAIT_FAILED ((DWORD)0xFFFFFFFF)
+
+#define SHARED_MEMORY_DIRECTORY ("/tmp/shm/navigation/")
+
+#define _pb_strcmp(pleft, pright)((strcmp(pleft, pright) == 0) ?(0) :(-1))
+
+/* For heap allocation method control */
+#define HEAP_ZERO_MEMORY (0x00000008)
+
+#define EV_RXCHAR 0x0001
+#define EV_ERROR 0x0080
+
+#define EV_DSR 0x0010
+
+/* Systems API External Public Functions Prototype Definitions */
+#define VUP_DISC_PATHNAME _T("/Z01") /* VUP DISC paths */
+#define VUP_USB_PATHNAME _T("/U") /* VUP USB paths */
+#define VUP_PATHNAME_SYSTEM _T("/agl/system") /* Storage path name */
+#define VUP_FNAME_TOP _T("/NA_D0_") /* VUPFile name(front) */
+#define VUP_FNAME_BTM _T(".bin") /* VUPFile name(rear) */
+#define VUP_FNAME_FORCEVUP _T("/forcevup.dat") /* Forced VUP file name */
+
+#define FROM_VARI_VER_SIZE 8
+#define WRITE_FLAG_ON 0x01 /* Write permission status for the file */
+#define FSNOACCESS 0x00 /* File system access disabled state */
+#define VUP_GETNAME_MEDIA_DISC 0x01 /* VUP media:disc */
+
+/* Function Code(Normal completion) */
+#define RET_RCVMSG 1 /* Receive only message */
+#define RET_RCVSIG 2 /* Receive only signal */
+#define RET_RCVBOTH 3 /* Receive both messages and signals */
+#define RET_NOMSG 4 /* No received message */
+/* User-side signal handling return values */
+#define RET_QUE 5 /* Queue a signal */
+#define RET_NOTQUE 6 /* Do not queue signals */
+#define RET_PROCDOWN 7 /* Detect DOWN of children */
+#define RET_SLEEP 100
+
+/* Error code system */
+#define RET_OSERROR (-127) /* OS System call error */
+/* Actual error in _sys_GetOSErrorCode() */
+/* Code can be retrieved */
+#define RET_ERRNOTRDY (-3) /* Specified port ID and semaphore ID are not created.*/
+#define RET_ERRPROC (-4) /* Error in API processing */
+#define RET_ERRTIMEOUT (-5) /* Timeout with Processing Not Complete */
+/* (D type API only) */
+#define RET_ERRMSGFULL (-6) /* Message table full */
+#define RET_ERROVERFLW (-7) /* Receive message is larger than the receive buffer size */
+#define RET_ERRINIT (-8)
+#define RET_ERRREGQUE (-9)
+
+#define RET_EV_NONE (-20) /* No specified event */
+#define RET_EV_MAX (-21) /* Event value exceeds the specified maximum value */
+#define RET_EV_MIN (-22) /* The event value is less than the specified minimum value. */
+
+#define SAPI_EVSET_RELATE 2
+
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+typedef struct FileTime {
+ DWORD dw_low_date_time;
+ DWORD dw_high_date_time;
+} FILETIME;
+typedef FILETIME *PFILETIME;
+typedef FILETIME *LPFILETIME;
+
+typedef struct Overlapped {
+ ULONG_PTR internal;
+ ULONG_PTR internal_high;
+ union {
+ struct {
+ DWORD offset;
+ DWORD offset_high;
+ };
+
+ PVOID pointer;
+ };
+
+ HANDLE h_event;
+} OVERLAPPED;
+typedef OVERLAPPED *LPOVERLAPPED;
+
+typedef struct ComStat {
+ DWORD f_cts_hold : 1;
+ DWORD f_dsr_hold : 1;
+ DWORD f_rlsd_hold : 1;
+ DWORD f_x_off_hold : 1;
+ DWORD f_x_off_sent : 1;
+ DWORD f_eof : 1;
+ DWORD f_txim : 1;
+ DWORD f_reserved : 25;
+ DWORD cb_in_que;
+ DWORD cb_out_que;
+} COMSTAT;
+typedef COMSTAT *LPCOMSTAT;
+
+typedef struct Dcb {
+ DWORD dcb_length; /* sizeof(DCB) */
+ DWORD baud_rate; /* Baudrate at which running */
+ DWORD f_binary: 1; /* Binary Mode (skip EOF check) */
+ DWORD f_parity: 1; /* Enable parity checking */
+ DWORD f_out_x_cts_flow: 1; /* CTS handshaking on output */
+ DWORD f_out_x_dsr_flow: 1; /* DSR handshaking on output */
+ DWORD f_dtr_control: 2; /* DTR Flow control */
+ DWORD f_dsr_sensitivity: 1; /* DSR Sensitivity */
+ DWORD f_tx_continue_on_x_off: 1; /* Continue TX when Xoff sent */
+ DWORD f_out_x: 1; /* Enable output X-ON/X-OFF */
+ DWORD f_in_x: 1; /* Enable input X-ON/X-OFF */
+ DWORD f_error_char: 1; /* Enable Err Replacement */
+ DWORD f_null: 1; /* Enable Null stripping */
+ DWORD f_rts_control: 2; /* Rts Flow control */
+ DWORD f_abort_on_error: 1; /* Abort all reads and writes on Error */
+ DWORD f_dummy2: 17; /* Reserved */
+ WORD w_reserved; /* Not currently used */
+ WORD x_on_lim; /* Transmit X-ON threshold */
+ WORD x_off_lim; /* Transmit X-OFF threshold */
+ BYTE byte_size; /* Number of bits/byte, 4-8 */
+ BYTE parity; /* 0-4=None,Odd,Even,Mark,Space */
+ BYTE stop_bits; /* 0,1,2 = 1, 1.5, 2 */
+ char x_on_char; /* Tx and Rx X-ON character */
+ char x_off_char; /* Tx and Rx X-OFF character */
+ char error_char; /* Error replacement char */
+ char eof_char; /* End of Input character */
+ char evt_char; /* Received Event character */
+ WORD w_reserved1; /* Fill for now. */
+} DCB;
+typedef DCB *LPDCB;
+
+typedef struct CommTimeouts {
+ DWORD read_interval_timeout; /* Maximum time between read chars. */
+ DWORD read_total_timeout_multiplier; /* Multiplier of characters. */
+ DWORD read_total_timeout_constant; /* Constant in milliseconds. */
+ DWORD write_total_timeout_multiplier; /* Multiplier of characters. */
+ DWORD write_total_timeout_constant; /* Constant in milliseconds. */
+} COMMTIMEOUTS;
+typedef COMMTIMEOUTS *LPCOMMTIMEOUTS;
+
+typedef struct {
+ DWORD size; /* Allocated shared memory size */
+ DWORD phy_addr; /* Physical address */
+ HANDLE h_map; /* +8: Handle of file mapping object. */
+ void* p_memory; /* Shared Memory Mapped Address */
+ DWORD owner; /* +16: Owner flag. */
+ HANDLE h_heap; /* +20: Handle of heap for oneself. */
+} SHARED_MEMORY;
+
+typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)(
+ LPVOID lpThreadParameter
+);
+typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
+
+/* Program version storage */
+typedef struct {
+ u_int8 mask_ver[ FROM_FIX_VER_SIZE ]; /* BootLoader programming versions */
+ u_int8 flash_ver1[ FROM_VARI_VER_SIZE ]; /* NK1 programming versions */
+ u_int8 flash_ver2[ FROM_VARI_VER_SIZE ]; /* NK2 programming versions */
+ u_int8 flash_ver3[ FROM_VARI_VER_SIZE ]; /* NK3 programming versions */
+} T_SYS_PRGVER;
+
+/* Device information storage */
+typedef struct {
+ u_int8 _CWORD31__no[ _CWORD31__NO_SIZE ]; /* _CWORD31_ product number */
+ u_int8 reserve1[ RESERVE1_SIZE ]; /* RESERVE1 */
+ u_int8 helpnet_id[ HELPNET_ID_SIZE ]; /* HELPNET ID */
+ u_int8 reserve2[ RESERVE2_SIZE ]; /* RESERVE2 */
+ u_int8 date[ DATE_SIZE ]; /* Manufacturing date and time */
+} T_SYS_DEVINFO;
+
+/* Structure for storing display information */
+typedef struct {
+ int i_width_size; /* Width */
+ int i_height_size; /* Height */
+} DISPLAY_INFO;
+
+/* System error notification message structure */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER bhead; /* Message buffer header */
+ PNO pno; /* Process No. */
+ u_int8 dummy[2]; /* Dummy */
+ int32 errcode; /* Error code */
+} T_SYS_SYSTEMERROR;
+
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+/* Configuration Functions (_pbCommon.cpp) */
+void PbReset(void); /* Soft reset process */
+
+/* Message Sending/Receiving Functions (_pbMsg.cpp) */
+RET_API PbDeleteMsg(PNO pno);
+
+/* SRAM Control Functions (_pbSram.cpp) */
+RET_API PbSramFil32(u_int8 id, u_int32 off, u_int8 pat, u_int32 size);
+RET_API PbSramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size);
+RET_API PbSramSz32(u_int8 id, u_int32 *psize);
+
+/* DRAM Control Functions (_pbDram.cpp) */
+RET_API PbDramWt32(u_int8 id, void *pbuf, u_int32 off, u_int32 size);
+
+/* Semaphore(_pbSem.cpp) */
+RET_API PbDeleteSemaphore(SemID sem_id);
+DWORD PbDeleteMutex(HANDLE h_mutex);
+DWORD PbMutexLock(HANDLE h_mutex, DWORD timeout);
+BOOL PbMutexUnlock(HANDLE h_mutex);
+
+/* Shared Memory Access Functions(_pbMem.cpp) */
+RET_API PbDeleteShareData(char* area_name);
+/* Accessing Physical Memory Area Allocation Data */
+RET_API PbAccessPhysicalMem(u_int32 addr, void **mem_ptr, u_int32 size, u_int32 mode);
+/* Releases access to the physical memory area allocation data. */
+RET_API PbFreePhysicalMem(u_int32 addr, void *mem_ptr, u_int32 size);
+
+LPVOID PbProcessHeapAlloc(DWORD dw_flags, SIZE_T dw_bytes); /* Allocating Memory from the Process Heap */
+BOOL PbProcessHeapFree(DWORD dw_flags, LPVOID lp_mem); /* Free Memory Allocated from Process Heap */
+
+/* Functions Related to Analysis Support Functions(_pbOther.cpp) */
+uint32_t PbGetTid(void);
+uint32_t PbGetLocalTid(void);
+
+/* Other Functions(_pbMisc.cpp) */
+RET_API PbMilliSecSleep(u_int32 ul_mill_time); /* Sleeping of the calling process */
+
+/* TODO As defined in _pbCSection--> */
+VOID PbDeleteCriticalSection(LPCRITICAL_SECTION lp_critical_section);
+VOID PbEnterCriticalSection(LPCRITICAL_SECTION lp_critical_section);
+VOID PbInitializeCriticalSection(LPCRITICAL_SECTION lp_critical_section);
+VOID PbLeaveCriticalSection(LPCRITICAL_SECTION lp_critical_section);
+
+BOOL PbSystemTimeToFileTime(CONST SYSTEMTIME *lp_system_time, LPFILETIME lp_file_time);
+
+
+/* Memory copy Bus release support */
+void* Memset64pSync(void* dest, int c, size_t count);
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_
+
diff --git a/vehicleservice/positioning_base_library/library/include/_pbCommon.h b/vehicleservice/positioning_base_library/library/include/_pbCommon.h
new file mode 100755
index 0000000..8cd1591
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/_pbCommon.h
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+ * File name : _sysCommon.h
+ * System name : System API
+ * Subsystem name : Common system
+ * Title : Internal header for system API infrastructure management
+ ****************************************************************************/
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBCOMMON_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBCOMMON_H_
+
+#define PBCOM_CONFIGFILE "config" /* Configuration file */
+#define PBCOM_CONFIGSIZE_MAX (1024) /* Configuration file maximum size */
+#define PBCOM_API_NORMAL (0) /* API processing result normal */
+#define PBCOM_API_ERROR (-1) /* API processing result error */
+#define PBCOM_UNICODE_NUL (0x00) /* NULL character codes */
+#define PBCOM_UNICODE_LF (0x0A) /* Line feed character code */
+#define PBCOM_UTOIMAX_NUM (8) /* Maximum font size */
+#define PBCOM_CONFIG_INDEX_SCRWIDTH "[ScreenWidth]" /* Data information "Screen width" */
+#define PBCOM_CONFIG_INDEX_SCRHEIGHT "[ScreenHeight]" /* Data information "Screen Height" */
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBCOMMON_H_
diff --git a/vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h b/vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h
new file mode 100755
index 0000000..d0b6d44
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+* $Header:: $
+* $Revision:: $
+*******************************************************************************/
+
+/****************************************************************************
+ * File name : _pbEvent_Internal.h
+ * System name : GPF
+ * Subsystem name : _CWORD64_API Events Feature
+ * Title : Internal definition file for event function
+ ****************************************************************************/
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_
+
+#include <other_service/ev_lib.h>
+
+/*
+ Constant definition
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define MAX_PB_EVENTS 16
+#define MAX_EVENT_NAME_LEN 32
+#define MIN_EVENT_VAL 0x80000000 /* Minimum event value(-2147483648) */
+#define MAX_EVENT_VAL 0x7FFFFFFF /* Maximum event value( 2147483647) */
+#define EVENT_BIT_ZERO 0x00000000 /* Event value All Bit Zero Definition */
+#define MAX_PB_EVENT_WAIT_THREADS 1 /* Values other than 1 are not designed while the EV library is being used. */
+#define EVSET_ABSOLUTE 1 /* Absolute setting */
+#define EVSET_RELATE 2 /* Relative value setting */
+#define EVSET_AND 3 /* AND value setting */
+#define EVSET_OR 4 /* OR setting */
+#define EVWAIT_VAL 1 /* Waiting mode for an event by specifying a range */
+#define EVWAIT_ALLCLR 2 /* Mode to wait for an event when the specified bit is cleared */
+#define EVWAIT_ANYSET 3 /* Mode to wait for an event with a specified set of bits */
+
+#define _CWORD64_EVENT_MAXOPEN_IN_PROCESS 0x7FFFFFFF /* Maximum number of open events in the same process */
+#define _CWORD64_EVENT_MAXOPEN_IN_SYSTEM 0x7FFFFFFF /* Maximum number of the same event open in the system */
+
+#define MAX_EVENT_PROC_NUM (32) /* EVENT Max Processes Used */
+
+/*
+ Structure Definition
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*****************************************************************************
+ * TAG : WAITING_CONDITION
+ * ABSTRACT : Event Status Settings
+******************************************************************************/
+typedef struct {
+ u_int8 uc_use_flag; /* Table Usage Flags(TRUE:Use FALSE:Not used) */
+ u_int8 uc_waiting; /* Event Waiting Flag */
+ /* TRUE Waiting for event */
+ /* FALSE Release Event Wait */
+ u_int16 us_mode; /* Waiting mode */
+ /* EVWAIT_VAL Wait for Value Range */
+ /* EVWAIT_ALLCLR Wait for specified bit to be cleared */
+ /* EVWAIT_ANYSET Waiting for setting the specified bit */
+ u_int32 ul_mask; /* Mask value when waiting for specified bit */
+ int32 l_min_val; /* Minimum value of condition when waiting for value range */
+ int32 l_max_val; /* Maximum value of condition when waiting for value range */
+ int32 l_last_val; /* Events at WaitEvent Return */
+ EV_ID flag_id[MAX_EVENT_PROC_NUM]; /* Event flags(CLS event library) */
+} WAITING_CONDITION; /* Total 28 Bytes. */
+
+/*****************************************************************************
+ * TAG : WAITING_CONDITION
+ * ABSTRACT : Event information storage area
+******************************************************************************/
+typedef struct {
+ TCHAR event_name[MAX_EVENT_NAME_LEN]; /* Maximum number of characters + NULL area */
+ int32 l_event_val;
+ WAITING_CONDITION st_condition[MAX_PB_EVENT_WAIT_THREADS];
+ int32 l_process_ref;
+ int32 l_reset_data;
+ u_int8 uc_manual_reset;
+ u_int8 uc_reserve[3];
+ char name_of_mutex[NAME_MAX];
+ /* TODO: Members for the following EV library use:Structurely strange, but borrowed shared space.Correction is required. */
+ u_int8 proc_cnt;
+} PB_EVENT;
+
+/*****************************************************************************
+ * TAG : PB_EVENT_OPEN_HANDLE
+ * ABSTRACT : Generated event management information
+******************************************************************************/
+typedef struct {
+ HANDLE h_heap;
+ PB_EVENT* p_sys_event;
+ DWORD index;
+ int32 l_thread_ref;
+} PB_EVENT_OPEN_HANDLE;
+
+/*****************************************************************************
+ * TAG : PB_EVENT_INSTANCE
+ * ABSTRACT : Event management table
+******************************************************************************/
+typedef struct {
+ PB_EVENT_OPEN_HANDLE* p_handle_table[MAX_PB_EVENTS];
+ HANDLE h_shared_memory;
+ SemID id_event_table_sem;
+ PB_EVENT* p_event_table;
+} PB_EVENT_INSTANCE;
+
+/*
+ Prototype declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_
diff --git a/vehicleservice/positioning_base_library/library/include/_pbInternalProc.h b/vehicleservice/positioning_base_library/library/include/_pbInternalProc.h
new file mode 100755
index 0000000..03bcd03
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/_pbInternalProc.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBINTERNALPROC_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBINTERNALPROC_H_
+
+#define POSITIONINGBASELIBRARY_NON_FD (-1) //!< \~english invalid fd
+#define POSITIONINGBASELIBRARY_MAP_NON_INIT (0) //!< \~english init flag for mmap
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ int32 InitMutexObject(pthread_mutex_t *p_st_mutex);
+
+ HANDLE CreateSharedMemory(TCHAR* name, DWORD size);
+ HANDLE OpenSharedMemory(TCHAR* name, DWORD size);
+ void DeleteAllSharedMemory(void);
+ void* GetSharedMemoryPtr(HANDLE h_shm);
+ void CloseSharedMemory(HANDLE h_shm);
+ void DeleteSharedMemory(TCHAR* name);
+ HANDLE OpenSharedMemoryAtPhysical(DWORD physical_address, DWORD size, DWORD protect);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBINTERNALPROC_H_
diff --git a/vehicleservice/positioning_base_library/library/include/_pbSerial.h b/vehicleservice/positioning_base_library/library/include/_pbSerial.h
new file mode 100755
index 0000000..1bedfe8
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/_pbSerial.h
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBSERIAL_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBSERIAL_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+/* Prototype */
+BOOL SerialTableInit(void); /* Initialization process for each process */
+BOOL SerialTableTerm(void); /* Termination process for each process */
+BOOL SerialObjectTimeoutAdd(HANDLE h_obj, DWORD dw_read_timeout, DWORD dw_write_timeout); /* Timeout registration process */
+BOOL SerialObjectTimeoutGet(HANDLE h_obj, DWORD*, DWORD*); /* Timeout acquisition processing */
+BOOL SerialObjectWaitmaskAdd(HANDLE h_obj, DWORD dw_mask); /* Mask registration process */
+BOOL SerialObjectWaitmaskGet(HANDLE h_obj, DWORD*); /* Mask acquisition processing */
+BOOL SerialObjectDel(HANDLE h_obj); /* Deletion process */
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBSERIAL_H_
diff --git a/vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h b/vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h
new file mode 100755
index 0000000..e4f8eb1
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBWAITFORSINGLEOBJECT_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBWAITFORSINGLEOBJECT_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+typedef enum {
+ PB_HANDLE_INVAL = 0,
+ PB_HANDLE_MUTEX,
+ PB_HANDLE_PROC_SEMAPHORE,
+ PB_HANDLE_EVENT,
+ PB_HANDLE_THREAD,
+ PB_HANDLE_PROCESS,
+
+ PB_HANDLE_KIND_MAX /* Maximum value range check */
+} HANDLE_KIND;
+
+/* Prototype */
+BOOL WaitObjectInit(void); /* Initialization process for each process */
+BOOL WaitObjectTerm(void); /* Termination process for each process */
+BOOL WaitObjectAdd(HANDLE h_obj, HANDLE_KIND l_kind); /* Registration process */
+BOOL WaitObjectDel(HANDLE h_obj); /* Deletion process */
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBWAITFORSINGLEOBJECT_H_
diff --git a/vehicleservice/positioning_base_library/library/include/sysup.h b/vehicleservice/positioning_base_library/library/include/sysup.h
new file mode 100755
index 0000000..eafca8e
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/sysup.h
@@ -0,0 +1,24 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_H_
+
+#define SYS_RESET (int32)1 /* Make reset */
+#define SYS_ONLY_RESET (int)2 /* Reset only */
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_H_
+
diff --git a/vehicleservice/positioning_base_library/library/include/sysup_addr.h b/vehicleservice/positioning_base_library/library/include/sysup_addr.h
new file mode 100755
index 0000000..9e73bf0
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/sysup_addr.h
@@ -0,0 +1,227 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+* File name : sysup_addr.h
+* System name : Integrated PF
+* Subsystem name : Common system
+* Title : Boot-Related Address Definition Header Files
+************************************************************************/
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_ADDR_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_ADDR_H_
+
+/*****************************************************
+ *
+ * Initial management area address space definition
+ * A: Address, S: Size
+ ****************************************************/
+/* Note : Don't forget to change sysup_addr.inc at the same time! */
+
+/* SDRAM startup identification table (1) A Offset from the beginning 0x0 */
+#define ADDR_SYSUP_DRAM1 ((SDRAM_INITIAL_AREA & ADDR_MASK) | ADDR_P2) // NOLINT(runtime/references)
+/* SDRAM startup identification table (1) S */
+#define SIZE_SYSUP_DRAM1 0x00000004
+
+/* SDRAM Start Identification Table A Offset from the beginning 0x4 */
+#define ADDR_SYSUP_DRAM_FIX (ADDR_SYSUP_DRAM1 + SIZE_SYSUP_DRAM1)
+/* SDRAM Start Identification Table S */
+#define SIZE_SYSUP_DRAM_FIX 0x00000004
+
+/* Startup Status Table A Offset from the beginning 0x8 */
+#define ADDR_SYSUP_STS (ADDR_SYSUP_DRAM_FIX + SIZE_SYSUP_DRAM_FIX)
+/* Startup Status Table S */
+#define SIZE_SYSUP_STS 0x00000002
+
+#define ADDR_SYS_DUMMY1 (ADDR_SYSUP_STS + SIZE_SYSUP_STS) /* Dummy1 A Offset from the beginning 0xa */
+#define SIZE_SYS_DUMMY1 0x00000002 /* Dummy1 S */
+
+#define ADDR_UPMODE (ADDR_SYS_DUMMY1 + SIZE_SYS_DUMMY1) /* Boot Mode Save Table A Offset from the beginning 0xc */
+#define SIZE_UPMODE 0x00000004 /* Boot Mode Save Table S */
+
+#define ADDR_SYSUP_STS_GINI (ADDR_UPMODE + SIZE_UPMODE) /* System startup status table A Offset from the beginning 0x10 */
+#define SIZE_SYSUP_STS_GINI 0x00000002 /* System startup status table S */
+
+/* Fork Failures Recording Table A Offset from the beginning 0x12 */
+#define ADDR_SYSUP_RST_CNT (ADDR_SYSUP_STS_GINI + SIZE_SYSUP_STS_GINI)
+/* Fork Failures Recording Table S */
+#define SIZE_SYSUP_RST_CNT 0x00000002
+
+/* System anomaly process No. table A Offset from the beginning 0x14 */
+#define ADDR_SYS_ERR_PNO (ADDR_SYSUP_RST_CNT + SIZE_SYSUP_RST_CNT)
+/* System anomaly process No. table S */
+#define SIZE_SYS_ERR_PNO 0x00000004
+
+/* System error reset cause table A Offset from the beginning 0x18 */
+#define ADDR_SYS_ERR_RST (ADDR_SYS_ERR_PNO + SIZE_SYS_ERR_PNO)
+/* System error reset cause table S */
+#define SIZE_SYS_ERR_RST 0x00000004
+
+/* System startup failure table A Offset from the beginning 0x1c */
+#define ADDR_SYSUP_ERR_STS (ADDR_SYS_ERR_RST + SIZE_SYS_ERR_RST)
+/* System startup failure table S */
+#define SIZE_SYSUP_ERR_STS 0x00000004
+
+/* Navigation activation state table A Offset from the beginning 0x20 */
+#define ADDR_NAVIUP_STS (ADDR_SYSUP_ERR_STS + SIZE_SYSUP_ERR_STS)
+/* Navigation activation state table S */
+#define SIZE_NAVIUP_STS 0x00000002
+
+/* Navigation fork Failed Count Recording Table A Offset from the beginning 0x22*/
+#define ADDR_NAVIUP_RST_CNT (ADDR_NAVIUP_STS + SIZE_NAVIUP_STS)
+/* Navigation fork Failed Count Recording Table S */
+#define SIZE_NAVIUP_RST_CNT 0x00000002
+
+/* Navigation error process No. table A Offset from the beginning 0x24 */
+#define ADDR_NAVI_ERR_PNO (ADDR_NAVIUP_RST_CNT + SIZE_NAVIUP_RST_CNT)
+/* Navigation error process No. table S */
+#define SIZE_NAVI_ERR_PNO 0x00000004
+
+/* Navigation Error Cause Table A Offset from the beginning 0x28 */
+#define ADDR_NAVI_ERR (ADDR_NAVI_ERR_PNO + SIZE_NAVI_ERR_PNO)
+/* Navigation Error Cause Table S */
+#define SIZE_NAVI_ERR 0x00000004
+
+#define ADDR_NAVIUP_ERR_STS (ADDR_NAVI_ERR + SIZE_NAVI_ERR) /* Navigation start failure table A Offset from the beginning 0x2c */
+#define SIZE_NAVIUP_ERR_STS 0x00000004 /* Navigation start failure table S */
+
+/* SDRAM startup identification table (2) A Offset from the beginning 0x30 */
+#define ADDR_SYSUP_DRAM2 (ADDR_NAVIUP_ERR_STS + SIZE_NAVIUP_ERR_STS)
+/* SDRAM startup identification table (2) S */
+#define SIZE_SYSUP_DRAM2 0x00000004
+
+/* SDRAM Backup Status Table A Offset from the beginning 0x34 */
+#define ADDR_SYS_BUP_STS (ADDR_SYSUP_DRAM2 + SIZE_SYSUP_DRAM2)
+/* SDRAM Backup Status Table S */
+#define SIZE_SYS_BUP_STS 0x00000004
+
+/* NAVI-SYS communication error recording table A Offset from the beginning 0x38 */
+#define ADDR_SYSCOM_STS (ADDR_SYS_BUP_STS + SIZE_SYS_BUP_STS)
+/* NAVI-SYS communication error recording table S */
+#define SIZE_SYSCOM_STS 0x00000004
+
+/* SDRAM Power Supply Fault Detection Table A Offset from the beginning 0x3c */
+#define ADDR_SYS_PW_STS (ADDR_SYSCOM_STS + SIZE_SYSCOM_STS)
+/* SDRAM Power Supply Fault Detection Table S */
+#define SIZE_SYS_PW_STS 0x00000004
+
+/* Hard WDT generation table A Offset from the beginning 0x40 */
+#define ADDR_HWDT_STS (ADDR_SYS_PW_STS + SIZE_SYS_PW_STS)
+/* Hard WDT generation table S */
+#define SIZE_HWDT_STS 0x00000004
+
+/* SDRAM Labels Destruct Status Detection Table A Offset from the beginning 0x44 */
+#define ADDR_DRAMLABEL_STS (ADDR_HWDT_STS + SIZE_HWDT_STS)
+/* SDRAM Labels Destruct Status Detection Table S */
+#define SIZE_DRAMLABEL_STS 0x00000004
+
+#define ADDR_SSB_MNG (ADDR_DRAMLABEL_STS + SIZE_DRAMLABEL_STS) /* SSB management table A Offset from the beginning 0x48 */
+#define SIZE_SSB_MNG 0x00000004 /* SSB management table S */
+
+#define ADDR_NMI_END (ADDR_SSB_MNG + SIZE_SSB_MNG) /* NMI completion flag A Offset from the beginning 0x4c */
+#define SIZE_NMI_END 0x00000004 /* NMI completion flag S */
+
+/* Opening indication determination table A Offset from the beginning 0x50 */
+#define ADDR_OPDSP_CHK (ADDR_NMI_END + SIZE_NMI_END)
+/* Opening indication determination table S */
+#define SIZE_OPDSP_CHK 0x00000004
+
+#define ADDR_SYS_FROM_STS (ADDR_OPDSP_CHK + SIZE_OPDSP_CHK) /* FROM destruction status table A Offset from the beginning 0x54 */
+#define SIZE_SYS_FROM_STS 0x00000004 /* FROM destruction status table S */
+
+/* BootLoader status A Offset from the beginning 0x58 */
+#define ADDR_BOOT_STS (ADDR_SYS_FROM_STS + SIZE_SYS_FROM_STS)
+/* BootLoader status S */
+#define SIZE_BOOT_STS 0x00000004
+
+/* BootLoader Exceptions Recording Table A Offset from the beginning 0x5c */
+#define ADDR_BOOTEXP_LOG (ADDR_BOOT_STS + SIZE_BOOT_STS)
+/* BootLoader Exceptions Recording Table S */
+#define SIZE_BOOTEXP_LOG 0x00000004
+
+/* SDRAM startup identification table (3) A Offset from the beginning0x60 */
+#define ADDR_SYSUP_DRAM3 (ADDR_BOOTEXP_LOG + SIZE_BOOTEXP_LOG)
+/* SDRAM startup identification table (3) S */
+#define SIZE_SYSUP_DRAM3 0x00000004
+
+/* Error Logging Table in BootLoader Drivers A Offset from the beginning 0x64 */
+#define ADDR_BOOTERR_LOG (ADDR_SYSUP_DRAM3 + SIZE_SYSUP_DRAM3)
+/* Error Logging Table in BootLoader Drivers S */
+#define SIZE_BOOTERR_LOG 0x00000004
+
+/* EPC register values at the time of exceptions in the BootLoader A Offset from the beginning 0x68 */
+#define ADDR_BOOT_EPC (ADDR_BOOTERR_LOG + SIZE_BOOTERR_LOG)
+/* EPC register values at the time of exceptions in the BootLoader S */
+#define SIZE_BOOT_EPC 0x00000004
+
+/* Status register when exceptions occur in the BootLoader A Offset from the beginning 0x6c */
+#define ADDR_BOOT_SR (ADDR_BOOT_EPC + SIZE_BOOT_EPC)
+/* Status register when exceptions occur in the BootLoader S */
+#define SIZE_BOOT_SR 0x00000004
+
+/* Cause Register Values When Internal BootLoader Exceptions Occur A Offset from the beginning 0x70 */
+#define ADDR_BOOT_CAUSE (ADDR_BOOT_SR + SIZE_BOOT_SR)
+/* Cause Register Values When Internal BootLoader Exceptions Occur S */
+#define SIZE_BOOT_CAUSE 0x00000004
+
+/* NMI completion flag(Copying) A Offset from the beginning 0x74 */
+#define ADDR_NMI_END_CPY (ADDR_BOOT_CAUSE + SIZE_BOOT_CAUSE)
+/* NMI completion flag(Copying) S */
+#define SIZE_NMI_END_CPY 0x00000004
+
+/* Target Type A Offset from the beginning 0x78 */
+#define ADDR_TARGET (ADDR_NMI_END_CPY + SIZE_NMI_END_CPY)
+/* Target Type S */
+#define SIZE_TARGET 0x00000004
+
+#define ADDR_SYS_NR_RST (ADDR_TARGET + SIZE_TARGET) /* Normal reset factor table A 0x7c */
+#define SIZE_SYS_NR_RST 0x00000004 /* Normal reset factor table S */
+
+#define ADDR_NK_LOAD_STS (ADDR_SYS_NR_RST + SIZE_SYS_NR_RST) /* NK Load Status Table A 0x80 */
+#define SIZE_NK_LOAD_STS 0x00000004 /* NK Load Status Table S */
+
+#define ADDR_CRC_RETRY (ADDR_NK_LOAD_STS + SIZE_NK_LOAD_STS) /* CRC retry count table A 0x84 */
+#define SIZE_CRC_RETRY 0x00000004 /* CRC retry count table S */
+
+#define ADDR_BOOT_VBR (ADDR_CRC_RETRY + SIZE_CRC_RETRY) /* VBR-saved table in BootLoaderr A 0x88 */
+#define SIZE_BOOT_VBR 0x00000004 /* VBR-saved table in BootLoaderr S */
+
+#define ADDR_MONI_TYPE (ADDR_BOOT_VBR + SIZE_BOOT_VBR) /* Monitor Type Table A 0x8C */
+#define SIZE_MONI_TYPE 0x00000004 /* Monitor Type Table S */
+
+#define ADDR_B_FLAG (ADDR_MONI_TYPE + SIZE_MONI_TYPE) /* B genuine flag A 0x90 */
+#define SIZE_B_FLAG 0x00000010 /* B genuine flag S */
+
+#define ADDR_RGBCABLE_TYPE (ADDR_B_FLAG + SIZE_B_FLAG) /* Connection RGB Cable Type Table A 0xA0 */
+#define SIZE_RGBCABLE_TYPE 0x0000004 /* Connection RGB Cable Type Table S */
+
+#define ADDR_RESET_LABEL (ADDR_RGBCABLE_TYPE + SIZE_RGBCABLE_TYPE) /* Normal reset label area A 0xA4 */
+#define SIZE_RESET_LABEL 0x00000010 /* Normal reset label area S */
+
+#define ADDR_NK_VUP_FLAG (ADDR_RESET_LABEL + SIZE_RESET_LABEL) /* NK version upgrade flag A 0xB4 */
+#define SIZE_NK_VUP_FLAG 0x00000004 /* NK version upgrade flag S */
+
+#define ADDR_TRANS_VUP (ADDR_NK_VUP_FLAG + SIZE_NK_VUP_FLAG) /* VUP migration flag A */
+#define SIZE_TRANS_VUP 0x00000004 /* VUP migration flag S */
+
+#define ADDR_PRG_SPAR_BOOT (ADDR_TRANS_VUP + SIZE_TRANS_VUP) /* Preliminary program start occurrence flag A */
+#define SIZE_ADDR_PRG_SPAR_BOOT 0x00000004 /* Preliminary program start occurrence flag S */
+
+#define ADDR_BOOT_ERR (ADDR_PRG_SPAR_BOOT + SIZE_ADDR_PRG_SPAR_BOOT) /* OS Pre-boot Error Information Storage Table A */
+#define SIZE_BOOT_ERR 0x00000004 /* OS Pre-boot Error Information Storage Table S */
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_ADDR_H_
+
diff --git a/vehicleservice/positioning_base_library/library/include/tchar.h b/vehicleservice/positioning_base_library/library/include/tchar.h
new file mode 100755
index 0000000..ee45e4d
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/tchar.h
@@ -0,0 +1,256 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TCHAR_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TCHAR_H_
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _T(x) __TEXT(x)
+
+#ifdef UNICODE
+ /* ++++++++++++++++++++ UNICODE ++++++++++++++++++++ */
+
+#define _TEOF WEOF
+
+#define _tmain wmain
+
+#ifdef UNDER_CE
+# define _tWinMain WinMain
+#else
+# define _tWinMain wWinMain
+#endif
+
+ /* Formatted i/o */
+#define _tprintf wprintf
+#define _ftprintf fwprintf
+#define _stprintf swprintf
+#define _sntprintf _snwprintf
+#define _vtprintf vwprintf
+#define _vftprintf vfwprintf
+#define _vstprintf vswprintf
+#define _vsntprintf _vsnwprintf
+#define _tscanf wscanf
+#define _ftscanf fwscanf
+#define _stscanf swscanf
+
+ /* Unformatted i/o */
+#define _fgettc fgetwc
+#define _fgetts fgetws
+#define _fputtc fputwc
+#define _fputts fputws
+#define _gettc getwc
+#define _gettchar getwchar
+#define _getts _getws
+#define _puttc putwc
+#define _puttchar putwchar
+#define _putts _putws
+#define _ungettc ungetwc
+
+#define _tfopen _wfopen
+#define _tfreopen _wfreopen
+
+ /* String conversion functions */
+#define _tcstod wcstod
+#define _tcstol wcstol
+#define _tcstoul wcstoul
+
+#define _itot _itow
+#define _ltot _ltow
+#define _ultot _ultow
+#define _ttoi _wtoi
+#define _ttol _wtol
+#define _ttoi64 _wtoi64
+
+ /* String functions */
+#define _tcscat wcscat
+#define _tcschr wcschr
+#define _tcscmp wcscmp
+#define _tcscpy wcscpy
+#define _tcscspn wcscspn
+#define _tcslen wcslen
+#define _tcsclen wcslen
+
+#define _tcsncat wcsncat
+#define _tcsnccat wcsncat
+#define _tcsnccmp wcsncmp
+#define _tcsncmp wcsncmp
+#define _tcsncpy wcsncpy
+#define _tcsnccpy wcsncpy
+#define _tcspbrk wcspbrk
+#define _tcsrchr wcsrchr
+#define _tcsspn wcsspn
+#define _tcsstr wcsstr
+#define _tcstok wcstok
+#define _tcsdup _wcsdup
+#define _tcsicmp _wcsicmp
+#define _tcsncicmp _wcsnicmp
+#define _tcsnicmp _wcsnicmp
+#define _tcsnset _wcsnset
+#define _tcsncset _wcsnset
+#define _tcsrev _wcsrev
+#define _tcsset _wcsset
+
+#define _tcslwr _wcslwr
+#define _tcsupr _wcsupr
+
+#define _istalpha iswalpha
+#define _istupper iswupper
+#define _istlower iswlower
+#define _istdigit iswdigit
+#define _istxdigit iswxdigit
+#define _istspace iswspace
+#define _istpunct iswpunct
+#define _istalnum iswalnum
+#define _istprint iswprint
+#define _istgraph iswgraph
+#define _istcntrl iswcntrl
+#define _istascii iswascii
+
+#define _totupper towupper
+#define _totlower towlower
+
+#define _istlegal(_c) (1)
+#define _istlead(_c) (0)
+#define _istleadbyte(_c) (0)
+
+#else /* ndef UNICODE */
+
+ /* ++++++++++++++++++++ SBCS (MBCS in Not supported) ++++++++++++++++++++ */
+
+#define _TEOF EOF
+
+ /* Program */
+#define _tmain main
+#define _tWinMain WinMain
+
+ /* Formatted i/o */
+#define _tprintf printf
+#define _ftprintf fprintf
+#define _stprintf sprintf
+#define _sntprintf _snprintf
+#define _vtprintf vprintf
+#define _vftprintf vfprintf
+#define _vstprintf vsprintf
+#define _vsntprintf _vsnprintf
+#define _tscanf scanf
+#define _ftscanf fscanf
+#define _stscanf sscanf
+
+ /* Unformatted i/o */
+#define _fgettc fgetc
+#define _fgetts fgets
+#define _fputtc fputc
+#define _fputts fputs
+#define _gettc getc
+#define _gettchar getchar
+#define _getts gets
+#define _puttc putc
+#define _puttchar putchar
+#define _putts puts
+#define _ungettc ungetc
+
+#define _tfopen _wfopen
+#define _tfreopen _wfreopen
+
+#ifndef UNDER_CE
+
+#define _tcstod strtod
+#define _tcstol strtol
+#define _tcstoul strtoul
+#endif
+
+#define _itot _itoa
+#define _ltot _ltoa
+#define _ultot _ultoa
+#define _ttoi atoi
+#define _ttol atol
+
+#ifndef UNDER_CE
+#define _ttoi64 atoi64
+#endif
+
+ /* String functions */
+#define _tcscat strcat
+#define _tcschr strchr
+#define _tcscmp strcmp
+#define _tcscpy strcpy
+#define _tcscspn strcspn
+#define _tcslen strlen
+#define _tcsclen strlen
+
+#define _tcsncat strncat
+#define _tcsnccat strncat
+#define _tcsnccmp strncmp
+#define _tcsncmp strncmp
+#define _tcsncpy strncpy
+#define _tcsnccpy strncpy
+
+#ifndef UNDER_CE
+
+#define _tcspbrk strpbrk
+#define _tcsrchr strrchr
+#define _tcsspn strspn
+#endif
+
+#define _tcsstr strstr
+#define _tcstok strtok
+
+#ifndef UNDER_CE
+
+#define _tcsdup _strdup
+#define _tcsicmp _stricmp
+#define _tcsncicmp _strnicmp
+#define _tcsnicmp _strnicmp
+#define _tcsnset _strnset
+#define _tcsncset _strnset
+#define _tcsrev _strrev
+#define _tcsset _strset
+#define _tcslwr _strlwr
+#define _tcsupr _strupr
+#endif
+
+#ifndef UNDER_CE
+
+#define _istalpha isalpha
+#define _istupper isupper
+#define _istlower islower
+#define _istdigit isdigit
+#define _istxdigit isxdigit
+#define _istspace isspace
+#define _istpunct ispunct
+#define _istalnum isalnum
+#define _istprint isprint
+#define _istgraph isgraph
+#define _istcntrl iscntrl
+#define _istascii isascii
+#define _totupper toupper
+#define _totlower tolower
+#endif
+
+#endif /* UNICODE */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TCHAR_H_
diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h
new file mode 100755
index 0000000..085640a
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h
@@ -0,0 +1,1653 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_
+
+/**
+ * @file WPF_STD.h
+ * @brief Header file for system standard definitions
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning_base_library
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <wchar.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <native_service/wpf_legacy.h>
+#include <vehicle_service/std_types.h>
+#include <vehicle_service/pos_message_header.h>
+#include <vehicle_service/sys_timerapi.h>
+#include <vehicle_service/positioning_positioningbaselibrarylog.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+#define POS_THREAD_NAME "Positioning" //!< \~english Positioning thread name
+
+#ifdef UNICODE
+#define __TEXT(quote) L##quote
+#else /* UNICODE */
+#define __TEXT(quote) (quote) /* r_winnt */
+#endif /* UNICODE */
+
+#define D_LTEXT(x) __TEXT(x)
+#define LTEXT(x) D_LTEXT(x)
+
+#define DEBUG_DUMP_MAX_SIZE 4096
+//!< \~english FrameworkunifiedOnDebugDump max size
+
+/* Sensor Log Type */
+#define POS_SENSLOG_TYPE_NONE 0 //!< \~english sensor log type NONE
+#define POS_SENSLOG_TYPE_SYS 1 //!< \~english sensor log type SYS
+#define POS_SENSLOG_TYPE_GPS 2 //!< \~english sensor log type GPS
+#define POS_SENSLOG_TYPE_NAV 3 //!< \~english sensor log type NAV
+#define POS_SENSLOG_TYPE_CMD 4 //!< \~english sensor log type CMD
+
+#define POS_SENSLOG_GET_ZONE(typ) \
+ (((typ) == (POS_SENSLOG_TYPE_SYS))?(ZONE_POS_SYS_IN):\
+ ((typ) == (POS_SENSLOG_TYPE_GPS))?(ZONE_POS_GPS_IN):\
+ ((typ) == (POS_SENSLOG_TYPE_NAV))?(ZONE_POS_NAV_IN):\
+ ((typ) == (POS_SENSLOG_TYPE_CMD))?(ZONE_POS_CMD_IN):\
+ (0))
+//!< \~english get sensor log zone code
+
+#define POS_WRITE_SENSLOG(zone, data, len) (((zone) != (0))?((void)((FRAMEWORKUNIFIEDLOG_DATA(zone, data, len)))):((void)(0)))
+//!< \~english write sensor log output
+#define POS_SENSLOG(typ, data, len) (POS_WRITE_SENSLOG(POS_SENSLOG_GET_ZONE(typ), data, len))
+
+/* HW configuration type */
+/*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+#define UNIT_TYPE_NONE 0x00000000UL //!< \~english type none
+#define UNIT_TYPE_UNKNOWN 0x00000001UL //!< \~english type unknown
+#define UNIT_TYPE_GRADE1 0x00000002UL //!< \~english type Grade1
+#define UNIT_TYPE_GRADE2 0x00000004UL //!< \~english type Grade2
+
+#define MAX_NAME_LEN 32 //!< \~english name max length
+#define _CWORD31__NO_SIZE 16 //!< \~english _CWORD31_ No size
+#define RESERVE1_SIZE 16 //!< \~english reserve 1
+#define HELPNET_ID_SIZE 21 //!< \~english helpnet ID size
+#define RESERVE2_SIZE 11 //!< \~english reserve 2
+#define DATE_SIZE 32 //!< \~english make time size
+#define SERIAL_NO_SIZE 3 //!< \~english serial No size
+#define PRODUCT_NAME_SIZE 1 //!< \~english product name size
+
+#define _pb_memcpy memcpy
+#define _pb_memset memset
+
+/* RET_API define */
+#define RET_NORMAL 0 //!< \~english normal return
+#define RET_ERROR (-1) //!< \~english error return
+#define RET_ERRPARAM (-2) //!< \~english parameter error
+
+#define SAPI_EVSET_ABSOLUTE 1 //!< \~english absolute vale set
+#define SAPI_EVWAIT_VAL 1 //!< \~english event wait value set
+
+/* sys common commandID definition */
+#define CID_GPS_BASE (CID)0xF030
+//!< \~english GPS
+
+#define CID_TIMER_BASE (CID)0xF040
+//!< \~english timer management
+
+#define CID_INITIAL_BASE (CID)0xF100
+//!< \~english initial
+
+/* ResourceManager/CID definition */
+#define CID_GPS_SERIAL0 (CID)0x0100
+//!< \~english GPS reset request func definition
+
+#define CID_GPS_REQRESET (CID)(CID_GPS_BASE | CID_GPS_SERIAL0)
+//!< \~english GPS reset request CID
+
+
+/* sys common commandID detail definition */
+#define CID_COM_SERIAL4 (CID)0x0004
+//!< \~english serial command ID 4
+
+#define CID_COM_SERIAL6 (CID)0x0006
+//!< \~english serial command ID 6
+
+#define CID_COM_SERIAL7 (CID)0x0007
+//!< \~english serial command ID 7
+
+/* initial CID definition */
+#define CID_INI_SYSTEMERR (CID)(CID_INITIAL_BASE | CID_COM_SERIAL6)
+//!< \~english system abnormality notify
+
+#define CID_INI_INTERNAL_ACCOFF_START (CID)(CID_INITIAL_BASE | CID_COM_SERIAL7)
+//!< \~english internal ACC-OFF start Indication
+
+/* timer control CID definition */
+#define CID_TIMER_TOUT (CID)(CID_TIMER_BASE | CID_COM_SERIAL4)
+//!< \~english timeout notify
+
+
+/* PNO definition */
+#define PNO_NONE 0x0000 //!< \~english initial value
+
+#define PNO__CWORD88___CWORD23_ 0x0100
+//!< \~english _CWORD23_ primary thread
+#define PNO_GINI_MAIN 0x0300
+//!< \~english G initial
+#define PNO_CLK_GPS 0x0316
+//!< \~english clock GPS thread
+#define PNO_VEHICLE_SENSOR 0x0363
+//!< \~english vehicle sensor thread
+#define PNO_LINE_SENS_DRV 0x0364
+//!< \~english line sensor driver thread
+#define PNO_NAVI_GPS_MAIN 0x0440
+//!< \~english GPS communication manager thread
+#define PNO_NAVI_GPS_RCV 0x0441
+//!< \~english GPS receive thread
+#define PNO__CWORD83_ 0x0900
+//!< \~english _CWORD83_(Intersystem Communication Message)thread
+
+#define SYS_PNO_MIN PNO__CWORD88___CWORD23_
+//!< \~english minimum PNO.(normal process)
+#define SYS_PNO_MAX PNO__CWORD83_
+//!< \~english maximum PNO.(normal process)
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+typedef u_int32 EventID;
+typedef int32 RET_API; //!< \~english _CWORD64_API return code
+typedef u_int32 event_id;
+typedef event_id SemID; //!< \~english semaphore ID
+typedef u_int16 CID; //!< \~english command ID
+
+typedef uint32_t UNIT_TYPE; //!< \~english unit type data type define
+typedef int32 ANA_RET_API;
+
+typedef char TCHAR;
+
+/**
+ * @enum _RcvMsgMode
+ * \~english mode of receive message
+ */
+typedef enum {
+ RM_WAIT, //!< \~english wait until received message
+ RM_CHECKRCV //!< \~english do not wait message, return
+} _RcvMsgMode;
+
+/**
+ * @enum
+ * \~english definition of event reset mode
+ */
+enum {
+ _CWORD64_EVENT_MANUALRESET_OFF = 0, //!< \~english manual reset off
+ _CWORD64_EVENT_MANUALRESET_ON, //!< \~english manual reset on
+ _CWORD64_EVENT_MANUALRESET_MAX //!< \~english manual reset max value
+};
+
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @struct _SECURITY_ATTRIBUTES
+ * \~english security attribute
+ */
+typedef struct _SECURITY_ATTRIBUTES {
+ DWORD nLength; //!< \~english length
+ LPVOID lpSecurityDescriptor; //!< \~english data pointer
+ BOOL bInheritHandle; //!< \~english inherited handle
+} SECURITY_ATTRIBUTES;
+typedef SECURITY_ATTRIBUTES *PSECURITY_ATTRIBUTES; //!< \~english security attribute
+typedef SECURITY_ATTRIBUTES *LPSECURITY_ATTRIBUTES; //!< \~english security attribute
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Create event by specified name
+///
+/// \~english @param [in] ucManualReset
+/// - u_int8 manual reset mode
+/// \~english @param [in] lInitData
+/// - int32 event value
+/// \~english @param [in] cpEventName
+/// - char* event name
+///
+/// \~english @par
+/// - manual reset mode(ucManualReset)
+/// - _CWORD64_EVENT_MANUALRESET_OFF manual reset OFF
+/// - _CWORD64_EVENT_MANUALRESET_ON manual reset ON
+///
+/// \~english @retval 0 event create failed
+/// \~english @retval not 0 created event ID
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter cpEventName is NULL
+/// - The parameter ucManualReset is more than or equal _CWORD64_EVENT_MANUALRESET_MAX
+/// - The string of parameter cpEventName has no text
+/// - The string length of parameter cpEventName is longer than MAX_EVENT_NAME_LEN
+/// - The event is created in same process, but the count of thread reference to the event is reach to the max
+/// - The event is created in system, but the count of process reference to the event is reach to the max
+/// - Memory allocate failed for creating event table
+/// - During create the event table, the event flag register failed
+/// - The event table is full
+///
+/// \~english @par Detail
+/// - Call this API to create event and return the created event ID.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EventID _pb_CreateEvent(u_int8 ucManualReset, int32 lInitData, char *cpEventName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Wait for the event specified by ID
+///
+/// \~english @param [in] eventID
+/// - EventID event ID
+/// \~english @param [in] lWaitMode
+/// - int32 event wait mode
+/// \~english @param [in] lMinVal
+/// - int32 event wait min value
+/// \~english @param [in] lMaxVal
+/// - int32 event wait max value
+/// \~english @param [out] plEventVal
+/// - int32* event wait value output pointer
+/// \~english @param [in] ulMillSecTime
+/// - u_int32 timeout time(ms)
+///
+/// \~english @par
+/// - event wait mode(lWaitMode)
+/// - SAPI_EVWAIT_VAL
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_EV_NONE parameter error or specified event not exist
+/// \~english @retval RET_ERRTIMEOUT timeout
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter plEventVal is NULL
+/// - The parameter eventID is more than MAX_PB_EVENTS
+/// - The specified event has not been registered in event table
+/// - The count of threads which is waiting this event is reach max
+/// - The parameter ulMillSecTime is 0
+/// - The parameter ulMillSecTime is INFINITE, and wait event flag failed
+/// - The parameter ulMillSecTime is not INFINITE, and timeout
+/// - The parameter ulMillSecTime is not INFINITE, and get event flag failed
+///
+/// \~english @par Detail
+/// - Call this API to wait event.
+/// - This API will return after timeout or this event been set.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_WaitEvent(EventID eventID, int32 lWaitMode, int32 lMinVal,
+ int32 lMaxVal, int32* plEventVal, u_int32 ulMillSecTime);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Set the value of event specified by ID
+///
+/// \~english @param [in] eventID
+/// - EventID event ID
+/// \~english @param [in] lSetMode
+/// - int32 event value set mode
+/// \~english @param [in] iVal
+/// - int32 event value
+///
+/// \~english @par
+/// - event value set mode(lSetMode)
+/// - SAPI_EVSET_ABSOLUTE absolute value set(set parameter value)
+/// - SAPI_EVSET_RELATE offset set(offset of current value set)
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_EV_NONE specified event not exist
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter eventID is more than MAX_PB_EVENTS
+/// - The specified event has not been registered in event table
+/// - The parameter lSetMode is neither SAPI_EVSET_ABSOLUTE nor SAPI_EVSET_RELATE
+///
+/// \~english @par Detail
+/// - Call this API to set event value.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_SetEvent(EventID eventID, int32 lSetMode, int32 lval);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Destroy the event specified by ID
+///
+/// \~english @param [in] eventID
+/// - EventID event ID
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERROR event flag destroy failed
+/// \~english @retval RET_EV_NONE specified event not exist
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter eventID is more than MAX_PB_EVENTS
+/// - The specified event has not been registered in event table
+/// - Event flag destroy failed
+///
+/// \~english @par Detail
+/// - Call this API to destroy specified event.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_DeleteEvent(EventID eventID);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Initialization before call Base API(every process used Base API should call this API firstly).
+///
+/// \~english @param [in] hApp
+/// - HANDLE app Handle
+///
+/// \~english @retval RET_NORMAL normal return
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the dispatcher for App are completed.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to initialize Base API.
+/// - Every process used Base API should call this API firstly.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_Setup_CWORD64_API(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Terminate current thread.
+///
+/// \~english @param [in] dwExitCode
+/// - DWORD exit code(not used)
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - None
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to terminate current thread.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID _pb_ExitThread(DWORD dwExitCode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Create the message queue
+///
+/// \~english @param [in] eventID
+/// - EventID process No
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter pno is 0
+/// - The name length of thread called this API is longer than MAX_QUEUE_NAME_SIZE
+///
+/// \~english @par Detail
+/// - Call this API to create the message queue.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_CreateMsg(PNO pno);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Send message in process
+///
+/// \~english @param [in] pno
+/// - PNO process No
+/// \~english @param [in] size
+/// - u_int16 message size
+/// \~english @param [in] msgbuf
+/// - void* message buffer
+/// \~english @param [in] mode
+/// - u_int16 not used
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter msgbuf is NULL
+/// - The parameter pno is 0
+/// - The message queue specified by parameter pno has not been created
+/// - Get sender Handle failed
+/// - Send message failed
+///
+/// \~english @par Detail
+/// - Call this API to send message in process.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_SndMsg(PNO pno, u_int16 size, void* msgbuf, u_int16 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Send message between process
+///
+/// \~english @param [in] name
+/// - PCSTR destination process name
+/// \~english @param [in] cid
+/// - CID command ID
+/// \~english @param [in] size
+/// - u_int16 message size
+/// \~english @param [in] msgbuf
+/// - const void* message buffer
+/// \~english @param [in] mode
+/// - u_int16 not used
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter name is NULL
+/// - The parameter msgbuf is NULL
+/// - The length of parameter name is longer than MAX_QUEUE_NAME_SIZE
+/// - Get sender Handle failed
+/// - Send message failed
+///
+/// \~english @par Detail
+/// - Call this API to send message between process.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_SndMsg_Ext(PCSTR name, CID cid, u_int16 size, const void* msgbuf, u_int16 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Create semaphore by specified name
+///
+/// \~english @param [in] semName
+/// - char* semaphore name
+///
+/// \~english @retval 0 semaphore create failed
+/// \~english @retval not 0 created semaphore ID
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter semName is NULL
+/// - The string of parameter semName has no text
+/// - The string length of parameter semName is longer than MAX_SEMAPHORE_NAME_LEN
+/// - Memory allocate failed for creating semaphore table
+/// - The semaphore table is full
+///
+/// \~english @par Detail
+/// - Call this API to create semaphore and return the created semaphore ID.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+SemID _pb_CreateSemaphore(char* semName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Semaphore lock
+///
+/// \~english @param [in] semID
+/// - SemID semaphore ID
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_OSERROR error return
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter semName is 0
+/// - The parameter semName is more than MAX_PB_SEMAPHORES
+/// - The specified semaphore has not been registered in semaphore table
+/// - The specified semaphore's mutex has not been created
+/// - The specified semaphore's mutex lock failed
+///
+/// \~english @par Detail
+/// - Call this API to get semaphore.
+/// - This API will return after got semaphore.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_SemLock(SemID semID);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Semaphore unlock
+///
+/// \~english @param [in] semID
+/// - SemID semaphore ID
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_OSERROR error return
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter semName is 0
+/// - The parameter semName is more than MAX_PB_SEMAPHORES
+/// - The specified semaphore has not been registered in semaphore table
+/// - The specified semaphore's mutex has not been created
+/// - The specified semaphore's mutex release failed
+///
+/// \~english @par Detail
+/// - Call this API to relesae semaphore.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_SemUnlock(SemID semID);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Create Share Data
+///
+/// \~english @param [in] area_name
+/// - char* share data name
+/// \~english @param [in] size
+/// - u_int32 data size
+/// \~english @param [out] mem_ptr
+/// - void** share memory pointer
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERROR error return
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter area_name is NULL
+/// - The parameter mem_ptr is NULL
+/// - The string of parameter area_name has no text
+/// - The string length of parameter area_name is longer than MAX_AREA_NAME_LEN
+/// - The parameter size is 0
+/// - The specified share data has already been created
+/// - Memory allocate failed for creating share data
+/// - The specified share data file create failed
+///
+/// \~english @par Detail
+/// - Call this API to create share data.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_CreateShareData(char* area_name, u_int32 size, void** mem_ptr);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Link Share Data
+///
+/// \~english @param [in] area_name
+/// - char* share data name
+/// \~english @param [out] mem_ptr
+/// - void** share memory pointer
+/// \~english @param [in] size
+/// - u_int32* data size
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERROR error return
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter area_name is NULL
+/// - The parameter mem_ptr is NULL
+/// - The string of parameter area_name has no text
+/// - The string length of parameter area_name is longer than MAX_AREA_NAME_LEN
+/// - The parameter size is NULL
+/// - Memory allocate failed for linking share data
+/// - The specified share data file open failed
+///
+/// \~english @par Detail
+/// - Call this API to link share data.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_LinkShareData(char* area_name, void** mem_ptr, u_int32* size);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Start timer
+///
+/// \~english @param [in] SndPno
+/// - PNO source process No
+/// \~english @param [in] TimerSeq
+/// - u_int16 timer sequence No
+/// \~english @param [in] TimerType
+/// - u_int8 timer type
+/// \~english @param [in] TimeOut
+/// - u_int32 timeout time
+///
+/// \~english @par
+/// - timer type(TimerType)
+/// - TIMER_TYPE_SYN fixed term timer
+/// - TIMER_TYPE_USN asynchronous timer
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - Initialization of positioning_base_library has not been done in current process
+/// - The parameter TimerType is neither TIMER_TYPE_SYN nor TIMER_TYPE_USN
+/// - The parameter TimeOut is 0
+/// - The same timer has already been started
+/// - Timer start failed
+///
+/// \~english @par Detail
+/// - Call this API to start timer.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_ReqTimerStart(PNO SndPno, u_int16 TimerSeq, u_int8 TimeType, u_int32 TimeOut);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Stop timer
+///
+/// \~english @param [in] SndPno
+/// - PNO source process No
+/// \~english @param [in] TimerSeq
+/// - u_int16 timer sequence No
+/// \~english @param [in] TimerType
+/// - u_int8 timer type
+///
+/// \~english @par
+/// - timer type(TimerType)
+/// - TIMER_TYPE_SYN fixed term timer
+/// - TIMER_TYPE_USN asynchronous timer
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERROR error return
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - Initialization of positioning_base_library has not been done in current process
+/// - Timer stop failed
+///
+/// \~english @par Detail
+/// - Call this API to stop timer.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_TimerStop(PNO SndPno, u_int16 TimerSeq, u_int8 TimeType);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Create mutex
+///
+/// \~english @param [in] lpMutexAttributes
+/// - LPSECURITY_ATTRIBUTES not used
+/// \~english @param [in] bInitialOwner
+/// - BOOL not used
+/// \~english @param [in] lpName
+/// - LPCTSTR mutex name
+///
+/// \~english @retval NULL error return
+/// \~english @retval Except NULL created mutex Handle
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter lpName is NULL
+/// - The string length of pamareter lpName is longer than NAME_MAX
+/// - Mutex lock map failed
+///
+/// \~english @par Detail
+/// - Call this API to create mutex.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE _pb_CreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCTSTR lpName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get message management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+/// \~english @param [in/out] pLen
+/// - uint8_t* output buffer size
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get message management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugMsgMngTbl(void* pBuf, uint8_t* pLen);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get mutex management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+/// \~english @param [in/out] pLen
+/// - uint8_t* output buffer size
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get mutex management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugMutexMngTbl(void* pBuf, uint8_t* pLen);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get timer management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get timer management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugTimerMngTbl(void* pBuf);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get event management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+/// \~english @param [in/out] pLen
+/// - uint8_t* output buffer size
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get event management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugEventMngTbl(void* pBuf, uint8_t* pLen);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get memory management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get memory management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugMemoryMngTbl(void* pBuf);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get common info management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get common info management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugOtherMngTbl(void* pBuf);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get current app Handle.
+///
+/// \~english @param None
+///
+/// \~english @retval 0 get Handle failed
+/// \~english @retval not 0 Handle
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - Current app Handle has not been registered
+///
+/// \~english @par Detail
+/// - Call this API to get current app Handle.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE _pb_GetAppHandle(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Set current app Handle.
+///
+/// \~english @param [in] hApp
+/// - HANDLE app Handle
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get common info management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_SetAppHandle(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Base API stop process(every process used Base API should call this API before stop).
+///
+/// \~english @param None
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to stop Base API.
+/// - Every process used Base API should call this API before stop.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_Teardown_CWORD64_API(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Terminate current process.
+///
+/// \~english @param [in] pFunc
+/// - char* source function
+/// \~english @param [in] line
+/// - int source line
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - None
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to terminate current process.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_Exit_d(const char* pFunc, int line);
+#define _pb_Exit() _pb_Exit_d(__func__, __LINE__)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Receive message.
+///
+/// \~english @param [in] pno
+/// - PNO process No
+/// \~english @param [in] size
+/// - u_int16 message size
+/// \~english @param [out] msgbuf
+/// - void* message buffer
+/// \~english @param [in] mode
+/// - u_int16 not used
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter msgbuf is NULL
+/// - The parameter pno is 0
+/// - The message queue specified by parameter pno has not been created
+/// - Receive message failed
+/// - Receive message successrully, but the received message size is longer than parameter size
+/// - Get received message data failed
+///
+/// \~english @par Detail
+/// - Call this API to receive message of specified pno.
+/// - This API will return after received message.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_RcvMsg(PNO pno, u_int16 size, void** msgbuf, u_int16 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get send buffer for message transferring in process
+///
+/// \~english @param [in] pno
+/// - PNO process No
+/// \~english @param [out] pSndBuf
+/// - void** send buffer
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter pno is 0
+/// - The message queue specified by parameter pno has not been created
+/// - Get sender Handle failed
+/// - Get send buffer failed
+///
+/// \~english @par Detail
+/// - Call this API to get send buffer for message transferring in process.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_GetZcSndBuf(PNO pno, void** pSndBuf);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Send message in process
+///
+/// \~english @param [in] pno
+/// - PNO process No
+/// \~english @param [in] size
+/// - u_int16 message size
+/// \~english @param [in] mode
+/// - u_int16 not used
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter pno is 0
+/// - The message queue specified by parameter pno has not been created
+/// - Get sender Handle failed
+/// - Get send buffer failed
+/// - Set send buffer failed
+/// - Send message failed
+///
+/// \~english @par Detail
+/// - Call this API to send message in process.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_ZcSndMsg(PNO pno, u_int16 size, u_int16 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Convert process name to pno
+///
+/// \~english @param [in] name
+/// - PCSTR process name
+///
+/// \~english @retval 0 convert failed
+/// \~english @retval not 0 converted PNO
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter name is NULL
+/// - The size of parameter name is longer than THREAD_NAME_LEN_MAX
+///
+/// \~english @par Detail
+/// - Call this API to convert process name to pno.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+PNO _pb_CnvName2Pno(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Convert pno to process name
+///
+/// \~english @param [in] pno
+/// - PNO process No
+///
+/// \~english @retval NULL convert failed
+/// \~english @retval not NULL converted process name
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter pno has not been registered(not the return pno of _pb_CnvName2Pno).
+///
+/// \~english @par Detail
+/// - Call this API to convert pno to process name.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR _pb_CnvPno2Name(PNO pno);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get message resource
+///
+/// \~english @param None
+///
+/// \~english @retval TRUE normal return
+/// \~english @retval FALSE error(lack of resource)
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get message resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL _pb_GetMsgResource(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get mutex resource
+///
+/// \~english @param None
+///
+/// \~english @retval TRUE normal return
+/// \~english @retval FALSE error(lack of resource)
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get mutex resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL _pb_GetMutexResource(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get common resource
+///
+/// \~english @param None
+///
+/// \~english @retval TRUE normal return
+/// \~english @retval FALSE error(lack of resource)
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get common resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL _pb_GetOtherResource(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Release message resource
+///
+/// \~english @param None
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to release message resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_ReleaseMsgResource(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Release mutex resource
+///
+/// \~english @param None
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to release mutex resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_ReleaseMutexResource(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Release common resource
+///
+/// \~english @param None
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to release common resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_ReleaseOtherResource(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of positioning_base_library
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_
diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h
new file mode 100755
index 0000000..b6af335
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _POS_MESSAGE_HEADER_ // NOLINT(build/header_guard)
+#define _POS_MESSAGE_HEADER_
+
+/**
+ * @file pos_message_header.h
+ * @brief Header file for message data definitions
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning_base_library
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <sys/types.h>
+
+/**
+ * @struct T_APIMSG_HEADER
+ * \~english _CWORD64_API message header structure
+ */
+typedef struct {
+ uint16_t replyid; //!< \~english message send result notify dest ID
+ uint16_t sndpno; //!< \~english message send source process No
+ uint16_t respno; //!< \~english message response process No
+ uint16_t cid; //!< \~english message command ID
+ uint16_t msgbodysize; //!< \~english message body size
+ uint8_t rid; //!< \~english message resource ID */
+ uint8_t reserve; //!< \~english reserve
+ uint8_t filler[2]; //!< \~english filter
+} T_APIMSG_HEADER;
+
+/**
+ * @struct T_APIMSG_MSGBUF_HEADER
+ * \~english _CWORD64_API message buffer header structure
+ */
+typedef struct {
+ uint32_t signo; //!< \~english signal No, _pb_SndMsg to set 0
+ T_APIMSG_HEADER hdr; //!< \~english message header
+} T_APIMSG_MSGBUF_HEADER;
+
+/**
+ * @struct _CWORD64_MSG_LOG_HDR
+ * \~english _CWORD64_API message log header structure
+ */
+typedef struct {
+ uint32_t kickTime; //!< \~english kick time
+ uint32_t srCid; //!< \~english message command ID
+ uint32_t pno; //!< \~english process No
+ uint32_t dataBytes; //!< \~english data size
+} _CWORD64_MSG_LOG_HDR;
+
+/** @}*/ // end of positioning_base_library
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // _POS_MESSAGE_HEADER_
diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h
new file mode 100755
index 0000000..c6ce3ce
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h
@@ -0,0 +1,46 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+
+#ifndef VEHICLESERVICE_POSITIONINGBASELIBRARY_H_ // NOLINT(build/header_guard)
+#define VEHICLESERVICE_POSITIONINGBASELIBRARY_H_ // NOLINT(build/header_guard)
+
+/**
+ * @file positioning_base_library.h
+ * @brief Common header of positioning_base_library
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning_base_library
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <vehicle_service/WPF_STD.h>
+#include <vehicle_service/sys_timerapi.h>
+#include <vehicle_service/std_types.h>
+#include <vehicle_service/pos_message_header.h>
+
+/** @}*/ // end of positioning_base_library
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // VEHICLESERVICE_POSITIONINGBASELIBRARY_H_
diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h
new file mode 100755
index 0000000..b0fd4e1
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file has been generated automatically.
+ * User hand written code entry is not allowed. Do not modify the file content.
+ *
+ */
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_POSITIONING_POSITIONINGBASELIBRARYLOG_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_POSITIONING_POSITIONINGBASELIBRARYLOG_H_
+
+/* Include Files */
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_APP ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_POS_SYS_IN ZONE_SP_ZONE_99
+#define ZONE_POS_GPS_IN ZONE_SP_ZONE_100
+#define ZONE_POS_CMD_IN ZONE_SP_ZONE_101
+#define ZONE_POS_NAV_IN ZONE_SP_ZONE_102
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "StateMachine Example"
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) /* LPRINT, LMSGQ, LSLOGGER */
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INIT, ZONE_ERR, ZONE_14, ZONE_INFO, ZONE_POS_SYS_IN, ZONE_POS_GPS_IN, ZONE_POS_CMD_IN, \
+ ZONE_POS_NAV_IN
+#endif
+
+#define PS_APPNAME_MAX 12
+extern const CHAR kAppName[PS_APPNAME_MAX];
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_POSITIONING_POSITIONINGBASELIBRARYLOG_H_
diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h
new file mode 100755
index 0000000..41ebbc8
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_STD_TYPES_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_STD_TYPES_H_
+
+/**
+ * @file std_types.h
+ * @brief Header file for base type definitions
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning_base_library
+ * @ingroup vehicle_service
+ * @{
+ */
+
+typedef signed char int8;
+typedef unsigned char u_int8;
+typedef signed short int int16;
+typedef unsigned short int u_int16;
+typedef signed int int32;
+typedef unsigned int u_int32;
+typedef float float_t;
+typedef double double_t;
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+/** @}*/ // end of positioning_base_library
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_STD_TYPES_H_
diff --git a/vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h b/vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h
new file mode 100755
index 0000000..03a24ff
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h
@@ -0,0 +1,359 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_SYS_TIMERAPI_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_SYS_TIMERAPI_H_
+
+/**
+ * @file sys_timerapi.h
+ * @brief Header file for timer management
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning_base_library
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+#define WTM_DUPTIME_MAX 5 //!< \~english duplication timer max count
+
+#define TIMER_TYPE_SYN 1
+//!< \~english fixing cycle timer(unit: 100ms)
+#define TIMER_TYPE_USN 2
+//!< \~english asynchronous timer(unit: 100ms)
+#define TIMER_TYPE_ALM 5 //!< \~english specific time timer
+
+#define SUN 0 //!< \~english sunday
+#define MON 1 //!< \~english monday
+#define TUE 2 //!< \~english tuesday
+#define WED 3 //!< \~english wednesday
+#define THU 4 //!< \~english thursday
+#define FRI 5 //!< \~english friday
+#define SAT 6 //!< \~english saturday
+#define DEFAULT_DIFFTIME 0x00 //!< \~english time difference value of japan
+
+#define GPS_SAT 0x00 //!< \~english corrected GPS time
+#define GPS_IST 0x01 //!< \~english not corrected GPS time
+#define GPS_RTC 0x02 //!< \~english RTC time
+#define GPS_IRG 0x03 //!< \~english initial time
+#define GPS_NON 0x7E //!< \~english GPS unused
+#define GPS_IGN 0x7F //!< \~english time not received
+
+#define END_TIMER_RPT_OFF 0 //!< \~english No continuation
+#define END_TIMER_RPT_ON 1 //!< \~english With continuation
+
+#define CID_TIMER_SETGPS 0x4040
+//!< \~english command ID of GPS setting timer
+#define CID_TIMER_DIFSET 0x4045
+//!< \~english command ID of time difference setting timer
+#define CID_TIMER_CYCLE (CID)(CID_TIMER_BASE | CID_COM_SERIAL5)
+//!< \~english command ID of cycle data receive timer
+
+#define CNV_YEAR_MAX 136
+//!< \~english max value of conversion year(number of years + 1)
+#define SEC_PER_MIN 60 //!< \~english 60[sec]
+#define SEC_PER_HOUR 3600 //!< \~english 60[min] * 60[sec]
+#define SEC_PER_DAY 86400 //!< \~english 24[h] * 60[min] * 60[sec]
+
+#define TIM_ROLOVR_DISABLE 0 //!< \~english GPS week rollover correct prohibition
+#define TIM_ROLOVR_ENABLE 1 //!< \~english GPS week rollover correct permission
+
+/*
+ * Definition
+ * \~english timer manager error definition
+ */
+#define RET_ERR_NONEINIT (-30) //!< \~english initialization untreated error
+#define RET_ERR_SEMLOCK (-31) //!< \~english get semaphore error
+#define RET_ERR_SEMUNLOCK (-32) //!< \~english open semaphore error
+#define RET_ERR_SRAMREAD (-33) //!< \~english read SRAM error
+
+/*
+ * Definition
+ * \~english command notify information definition(almanac abnormality notify, and time enable notify)
+ */
+#define TIM_NUM_SNDCMD 4 //!< \~english command send number
+
+#define NON_TIMEUNIT_INVALID_TIME 0
+//!< \~english No time manager unit - system time not set
+#define NON_TIMEUNIT_VALID_TIME 1
+//!< \~english No time manager unit - system time set complete
+#define GPS_INVALID_TIME 2
+//!< \~english With GPS unit - system time not set
+#define GPS_VALID_TIME 3
+//!< \~english With GPS unit - system time set complete
+
+#define TMT_RETRY 3 //!< \~english retry count
+#define TMT_RETRY_INTERVAL 500 //!< \~english retry interval(500[msec])
+
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/**
+ * \~english define data type
+ */
+typedef struct {
+ u_int32 TimeOut[WTM_DUPTIME_MAX]; //!< \~english timeout value
+ u_int8 ContFlg; //!< \~english continue flag
+ u_int8 Dummy1; //!< \~english dummy data
+ u_int16 Dummy2; //!< \~english dummy data
+} TimerDupData;
+
+/**
+ * @struct RealTimeData
+ * \~english current time data
+ */
+typedef struct {
+ u_int16 Yyear; //!< \~english current time(year:A.D.)
+ u_int8 Mmonth; //!< \~english (month)
+ u_int8 Dday; //!< \~english (day)
+ u_int8 Hhour; //!< \~english (hour)
+ u_int8 Mmin; //!< \~english (min)
+ u_int8 Ssec; //!< \~english (sec)
+ u_int8 Wweek; //!< \~english (week)
+ u_int8 CrtFlg; //!< \~english GPS time not corrected/corrected flag
+ u_int8 CrtHou; //!< \~english the last correction(hour)
+ u_int8 CrtMin; //!< \~english min
+ u_int8 CrtSec; //!< \~english sec
+} RealTimeData;
+
+/**
+ * @struct RealTimeDataBcd
+ * \~english current time data(BCD format)
+ */
+typedef struct {
+ u_int16 Yyear; //!< \~english current time(year:A.D.BCD ex.0x1998)
+ u_int8 Mmonth; //!< \~english (month BCD 0x01 to 0x12)
+ u_int8 Dday; //!< \~english (day BCD 0x01 to 0x31)
+ u_int8 Hhour; //!< \~english (hour BCD 0x00 to 0x23)
+ u_int8 Mmin; //!< \~english (min BCD 0x00 to 0x59)
+ u_int8 Ssec; //!< \~english (sec BCD 0x00 to 0x59)
+ u_int8 Wweek; //!< \~english (week BIN 0x00 to 0x06)
+ u_int8 CrtFlg;
+ //!< \~english GPS time not corrected or corrected flag(BIN 0x00 to 0x03)
+ u_int8 CrtHou; //!< \~english the last correction(hour BCD 0x00 to 0x23)
+ u_int8 CrtMin; //!< \~english (min BCD 0x00 to 0x59)
+ u_int8 CrtSec; //!< \~english (sec BCD 0x00 to 0x59)
+} RealTimeDataBcd;
+
+/**
+ * @struct GpsSetData
+ * \~english GPS time setting data
+ */
+typedef struct {
+ u_int16 Yyear; //!< \~english current time(year:A.D.)
+ u_int8 Mmonth; //!< \~english (month)
+ u_int8 Dday; //!< \~english (day)
+ u_int8 Hhour; //!< \~english (hour)
+ u_int8 Mmin; //!< \~english (min)
+ u_int8 Ssec; //!< \~english (sec)
+ u_int8 Dummy; //!< \~english dummy data
+} GpsSetData;
+
+/**
+ * @struct TimerToutMsg
+ * \~english timeout message
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific)
+ u_int16 Dummy; //!< \~english dummy
+} TimerToutMsg;
+
+/**
+ * @struct TimerTimeReq
+ * \~english timer start request
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ PNO SndPno; //!< \~english process No.(claimant specific)
+ u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific)
+ u_int8 TimeType; //!< \~english timer type
+ u_int8 Dummy[3]; //!< \~english dummy data
+ TimerDupData DupData; //!< \~english timeout value
+} TimerTimeReq;
+
+/**
+ * @struct TimerAlrmReq
+ * \~english time specified timer start request
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ PNO SndPno; //!< \~english process No.(claimant specific)
+ u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific)
+ u_int8 TimeHou; //!< \~english specific timeout hour
+ u_int8 TimeMin; //!< \~english min
+ u_int8 TimeSec; //!< \~english sec
+ u_int8 Dummy; //!< \~english dummy
+} TimerAlrmReq;
+
+/**
+ * @struct TimerStopReq
+ * \~english timer stop request
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ PNO SndPno; //!< \~english process No.(claimant specific)
+ u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific)
+ u_int8 TimeType; //!< \~english timer type
+ u_int8 Dummy[3]; //!< \~english dummy data
+} TimerStopReq;
+
+/**
+ * @struct GpsSetTimeReq
+ * \~english GPS RTC time set request
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ PNO SndPno; //!< \~english process No.(claimant specific)
+ u_int8 Dummy1; //!< \~english dummy data
+ u_int8 Dummy2; //!< \~english dummy data
+ GpsSetData SetData; //!< \~english GPS setting data
+} GpsSetTimeReq;
+
+/**
+ * @struct GpsSetTimeReq
+ * \~english time difference set request
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ int8 DiffTime; //!< \~english time difference value
+ int8 Dummy1; //!< \~english dummy data
+ int16 Dummy2; //!< \~english dummy data
+} SetDiffTimeReq;
+
+
+/**
+ * @struct T_TIM_RCV_DATA
+ * \~english command notify information structure
+ */
+typedef struct {
+ PNO SndPno; //!< \~english command delivery PNO
+ u_int8 ucAlmanc_Flg;
+ //!< \~english almanac abnormal judgement notify complete flag
+ u_int8 ucInvalid_Flg;
+ //!< \~english time acquisition notify complete flag
+} T_TIM_RCV_DATA;
+
+/**
+ * @struct TimerSramData
+ * \~english timer SRAM data structure
+ */
+typedef struct {
+ u_int32 navitime; //!< \~english Navi operation addition time
+ int8 _difftime; //!< \~english time difference value of current time
+ int8 timeUnit; //!< \~english specific time manager unit
+ int8 dummy[2]; //!< \~english dummy data
+ T_TIM_RCV_DATA timCmdData[TIM_NUM_SNDCMD];
+ //!< \~english command receive information
+} TimerSramData;
+
+/**
+ * @struct SysTimeData
+ * \~english system time data
+ */
+typedef struct {
+ u_int16 Yyear; //!< \~english current time(year:A.D.BCD ex. 0x1998)
+ u_int8 Mmonth; //!< \~english (month BCD 0x01 to 0x12)
+ u_int8 Dday; //!< \~english (day BCD 0x01 to 0x31)
+ u_int8 Hhour; //!< \~english (hour BCD 0x00 to 0x23)
+ u_int8 Mmin; //!< \~english (min BCD 0x00 to 0x59)
+ u_int8 Ssec; //!< \~english (sec BCD 0x00 to 0x59)
+ u_int8 Wweek; //!< \~english (week BIN 0x00 to 0x06)
+} SysTimeData;
+
+/**
+ * @struct YearCntTbl
+ * \~english year convert table
+ */
+typedef struct TimeCnvTbl_tag {
+ uint32_t ulYear; //!< \~english year
+ uint32_t ulCount; //!< \~english count
+ uint32_t ulMonth[12]; //!< \~english month
+} YearCntTbl;
+
+/**
+ * @struct DayCntTbl
+ * \~english day convert table
+ */
+typedef struct DayCnvTbl_tag {
+ YearCntTbl stTbl[CNV_YEAR_MAX]; //!< \~english year convert table
+} DayCntTbl;
+
+/**
+ * @struct TG_TIM_ROLOVR_GPSWEEKCORDATA
+ * \~english GPS week correction data
+ */
+typedef struct {
+ u_int8 gpsweekcorcnt; //!< \~english GPS week rollover correct count
+ u_int8 permission; //!< \~english GPS week rollover correct permission
+ u_int8 dummy[2]; //!< \~english dummy data
+} TG_TIM_ROLOVR_GPSWEEKCORDATA;
+
+/**
+ * @struct TIMECHGIND_MSG
+ * \~english time change information message structure
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ RealTimeData RealTime; //!< \~english data body(current time data)
+} TIMECHGIND_MSG;
+
+/**
+ * @struct T_TIM_CMDMSG
+ * \~english time available notification/almanac abnormality notification structure
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+} T_TIM_CMDMSG;
+
+/**
+ * @struct T_TIM_RETTIMEMSG
+ * \~english time setting response message
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ int8 cResult; //!< \~english process result
+ int8 dummy[2]; //!< \~english dummy data
+} T_TIM_RETTIMEMSG;
+
+/**
+ * @struct TimerModDat
+ * \~english current time data module structure
+ */
+typedef struct {
+ u_int32 InitFlg; //!< \~english initialization complete flag
+ u_int8 CrtFlg; //!< \~english corrected/not corrected flag
+ u_int8 CrtHou; //!< \~english the last correction: hour
+ u_int8 CrtMin; //!< \~english min
+ u_int8 CrtSec; //!< \~english sec
+} TimerModDat;
+
+/** @}*/ // end of positioning_base_library
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_SYS_TIMERAPI_H_
+
diff --git a/vehicleservice/positioning_base_library/library/libPOS_base_API.ver b/vehicleservice/positioning_base_library/library/libPOS_base_API.ver
new file mode 100755
index 0000000..019a271
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/libPOS_base_API.ver
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libPOS_base_API version script
+#
+{
+ global:
+ _pb_*;
+ *MemoryTerm*;
+ *ErrTrapTerm*;
+ *MsgTerm*;
+ *EventTerm*;
+ *MutexTerm*;
+ *SemaphoreTerm*;
+ *ErrTrapInit*;
+ *MsgInit*;
+ *EventInit*;
+ *MemoryInit*;
+ *SemaphoreInit*;
+ *MutexInit*;
+ local:
+ *;
+};
+
+
diff --git a/vehicleservice/positioning_base_library/library/src/MsgBapi.cpp b/vehicleservice/positioning_base_library/library/src/MsgBapi.cpp
new file mode 100755
index 0000000..66e78ae
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/MsgBapi.cpp
@@ -0,0 +1,347 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * MsgBapi.cpp
+ * @brief system common functions
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <dirent.h>
+#include "_pbInternalProc.h"
+#include "WPF_STD_private.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Create Shared Memory
+ *
+ * Create a file mapping object with the specified shared memory name and size, then <br>
+ * maps it to the invoking process space. If the shared memory that has already been <br>
+ * created is specified, an error is returned.<br>
+ * The shared memory management information allocates a heap area each time it is <br>
+ * created, and return this address as a shared memory handle.
+ *
+ * @param[in] TCHAR* name
+ * @param[in] DWORD size
+ *
+ * @return HANDLE<br>
+ * Except NULL Handle of the created shared memory(Management information pointer)<br>
+ * NULL ABEND
+ */
+HANDLE CreateSharedMemory(TCHAR* name, DWORD size) {
+ int32 lret = EOK;
+ RET_API ret_api = RET_ERROR;
+ int32 fd = POSITIONINGBASELIBRARY_NON_FD;
+ SHARED_MEMORY* p_shm = NULL;
+ char c_file_path[PATH_MAX + 1] = SHARED_MEMORY_DIRECTORY;
+
+ if ((name != NULL) && (size != 0)) { // LCOV_EXCL_BR_LINE 6:name can not be NULL, size can not be 0
+ /* Allocate the shared memory management information area in the heap. */
+ p_shm = reinterpret_cast<SHARED_MEMORY *>(malloc(sizeof(SHARED_MEMORY)));
+ if (p_shm == NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+ } else {
+ p_shm->h_heap = NULL;
+ p_shm->phy_addr = 0;
+ p_shm->h_map = NULL;
+ p_shm->size = size;
+
+ /* Create directory */
+ (void)mkdir(SHARED_MEMORY_DIRECTORY, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+
+ /* Create shared memory with the specified size and name.(Error if it already exists) */
+ (void)strncat(c_file_path, (const char*)name, 128);
+ fd = open(c_file_path, O_RDWR | O_CREAT | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); // LCOV_EXCL_BR_LINE 5: standard lib error // NOLINT(whitespace/line_length)
+ if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18775 compliant */ { // LCOV_EXCL_BR_LINE 5: standard lib error // NOLINT(whitespace/line_length)
+ /* Set size */
+ lret = ftruncate(fd, size);
+ if (lret == EOK) { // LCOV_EXCL_BR_LINE 5: ftruncate's error case
+ /* Map the created shared memory to the invoking process space. */
+ p_shm->p_memory = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (p_shm->p_memory != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ ret_api = RET_NORMAL;
+ }
+ }
+ }
+ }
+ }
+
+ if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18775 compliant */ {
+ close(fd);
+ }
+
+ if (ret_api == RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ /* Indicate that it is the creator of the shared memory */
+ p_shm->owner = TRUE;
+ } else {
+ // LCOV_EXCL_START 200: can not be not normal
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* In case of an error */
+ if (fd != POSITIONINGBASELIBRARY_NON_FD) {
+ /* Delete shared memory object if created */
+ shm_unlink(name);
+ }
+
+ if (p_shm != NULL) {
+ free(p_shm);
+ }
+
+ p_shm = NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ return (HANDLE)p_shm;
+}
+
+/**
+ * @brief
+ * Open Shared Memory
+ *
+ * Create a file mapping object with the specified shared memory name and size, <br>
+ * then map it to the invoking process space. Since this is not shared memory <br>
+ * creation processing, an error is returned if it is not a file mapping object.<br>
+ * The shared memory management information allocates a heap area each time <br>
+ * it is created, and return this address as a shared memory handle.
+ *
+ * @param[in] TCHAR* name
+ * @param[in] DWORD size
+ *
+ * @return HANDLE<br>
+ * Except NULL Handle of the acquired shared memory(Management information pointer)<br>
+ * NULL ABEND
+ */
+HANDLE OpenSharedMemory(TCHAR* name, DWORD size) {
+ RET_API ret_api = RET_ERROR;
+ int32 fd = POSITIONINGBASELIBRARY_NON_FD;
+ SHARED_MEMORY* p_shm = NULL;
+ char c_file_path[PATH_MAX + 1] = SHARED_MEMORY_DIRECTORY;
+
+ if ((name != NULL) && (size != 0)) { // LCOV_EXCL_BR_LINE 6:name can not be NULL, size can not be 0
+ /* Allocate the shared memory management information area in the heap. */
+ p_shm = reinterpret_cast<SHARED_MEMORY *>(malloc(sizeof(SHARED_MEMORY)));
+ if (p_shm == NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+ } else {
+ p_shm->h_heap = NULL;
+ p_shm->phy_addr = 0;
+ p_shm->h_map = NULL;
+ p_shm->size = size;
+
+ /* Open shared memory with the specified size and name(Error if not exists) */
+ (void)strncat(c_file_path, (const char*)name, 128);
+ fd = open(c_file_path, O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); // LCOV_EXCL_BR_LINE 5: standard lib error
+ if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18774 compliant */ {
+ /* Map open shared memory to invoking process space. */
+ p_shm->p_memory = reinterpret_cast<SHARED_MEMORY *>(mmap(0, size, PROT_READ | PROT_WRITE, \
+ MAP_SHARED | POSITIONINGBASELIBRARY_MAP_NON_INIT, fd, 0));
+ if (p_shm->p_memory != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ ret_api = RET_NORMAL;
+ }
+ }
+ }
+ }
+
+ if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18774 compliant */ {
+ close(fd);
+ }
+
+ if (ret_api == RET_NORMAL) {
+ /* Indicate that the opener of the shared memory not the creator of it. */
+ p_shm->owner = FALSE;
+ } else {
+ /* In case of an error */
+ if (p_shm != NULL) {
+ free(p_shm);
+ }
+
+ p_shm = NULL;
+ }
+
+ return (HANDLE)p_shm;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DeleteAllSharedMemory()
+ * ABSTRACT : Delete all shared memory objects
+ * NOTE : Delete all shared memory objects
+ * : However, the heap area allocated at the time of shared memory creation or open is not released.
+ * ARGUMENT : None
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+DeleteAllSharedMemory(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+ char* cwd = NULL;
+ char sz_cwd[PATH_MAX + 1] = {0};
+ DIR* p_dir = NULL;
+ struct dirent* p_dir_ent = NULL;
+
+ /* Get path of current directory */
+ cwd = getcwd(sz_cwd, PATH_MAX + 1);
+
+ if (cwd != NULL) {
+ /* Move to shared memory directory */
+ lret = chdir(SHARED_MEMORY_DIRECTORY);
+
+ if (lret == EOK) {
+ /* Open shared memory directory */
+ p_dir = opendir(SHARED_MEMORY_DIRECTORY);
+ if (p_dir != NULL) {
+ for (;;) {
+ /* Get directory entry */
+ p_dir_ent = readdir(p_dir);
+ if (p_dir_ent == NULL) {
+ break;
+ }
+
+ if ((_pb_strcmp(p_dir_ent->d_name, ".") != 0) &&
+ (_pb_strcmp(p_dir_ent->d_name, "..") != 0)) {
+ /* Delete shared memory objects */
+ shm_unlink(p_dir_ent->d_name);
+ }
+ }
+
+ /* Close shared memory directory */
+ closedir(p_dir);
+ }
+
+ /* Go to original directory */
+ lret = chdir(cwd);
+ if (lret != EOK) /* Coverity CID: 18816 compliant */ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "chdir ERROR [lret:%d]", lret);
+ }
+ }
+ }
+
+ /* Delete shared memory directory */
+ lret = rmdir(SHARED_MEMORY_DIRECTORY);
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetSharedMemoryPtr()
+ * ABSTRACT : Shared memory start address acquisition processing
+ * NOTE : Return the start address of the shared memory that is allocated/mapped at the
+ * : time of shared memory creation or open
+ * ARGUMENT : HANDLE h_shm Shared memory handle(Management information pointer)
+ * RETURN : void* Except NULL Pointer to the acquired shared memory
+ * : NULL ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void*
+GetSharedMemoryPtr(HANDLE h_shm) {
+ void *p_vret = NULL;
+ SHARED_MEMORY *p_shm = reinterpret_cast<SHARED_MEMORY *>(h_shm);
+
+ if (p_shm == NULL) /* If the shared memory handle that is not created or not opened is specified, */ { // LCOV_EXCL_BR_LINE 200: p_shm can not be NULL // NOLINT(whitespace/line_length)
+ } else {
+ p_vret = p_shm->p_memory;
+ }
+
+ return p_vret;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : CloseSharedMemory()
+ * ABSTRACT : Shared memory close processing
+ * NOTE : Close the shared memory that is allocated/mapped at the time of its creation or open
+ * ARGUMENT : HANDLE h_shm Shared memory handle(Management information pointer)
+ * RETURN : NONE
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+CloseSharedMemory(HANDLE h_shm) {
+ SHARED_MEMORY* p_shm = reinterpret_cast<SHARED_MEMORY *>(h_shm);
+ int32 lret = EOK;
+
+ if (p_shm == NULL) /* If the shared memory handle that is not created or not opened is specified, */ {
+ } else if (p_shm->phy_addr != 0) /* If the physical memory area address is specified,(Currently never comes here) */ {
+ if (p_shm->p_memory != NULL) {
+ /* Release physical memory area */
+ if (lret != EOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "_CWORD64_api.dll:%s:LINE %d\r\n munmap_device_memory ERROR In PbFreePhysicalMem\r\n", \
+ LTEXT(__FILE__), __LINE__);
+ _pb_Exit(); /* System recovery processing(Exception execution) */
+ }
+ }
+ } else {
+ /* Release the shared memory object mapped to invoking process space */
+ if (p_shm->p_memory != NULL) {
+ lret = munmap(p_shm->p_memory, p_shm->size);
+ p_shm->p_memory = NULL;
+ }
+
+ /* Release the shared memory management information allocated in the heap */
+ free(p_shm);
+ }
+
+ return;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DeleteSharedMemory()
+ * ABSTRACT : Shared memory object delete processing
+ * NOTE : Delete the shared memory object that is specified name
+ * ARGUMENT : TCHAR* name Pointer to the name of the shared memory to be deleted
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+DeleteSharedMemory(TCHAR* name) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+ char* cwd = NULL;
+ char sz_cwd[PATH_MAX + 1] = {0};
+
+ if (name != NULL) {
+ /* Get path of current directory */
+ cwd = getcwd(sz_cwd, PATH_MAX + 1);
+
+ if (cwd != NULL) {
+ /* Move to shared memory directory */
+ lret = chdir(SHARED_MEMORY_DIRECTORY);
+
+ if (lret == EOK) {
+ /* Delete shared memory object */
+ lret = shm_unlink(name);
+
+ /* Go to original directory */
+ lret = chdir(cwd);
+ }
+ }
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+
+HANDLE
+OpenSharedMemoryAtPhysical(DWORD physical_address, DWORD size, DWORD protect) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;
+}
+// LCOV_EXCL_STOP
+
diff --git a/vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp b/vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp
new file mode 100755
index 0000000..ed833fd
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp
@@ -0,0 +1,254 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _CWORD64_api.cpp
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+#include "tchar.h"
+#include "WPF_STD_private.h"
+
+
+
+/*---------------------------------------------------------------------------------*
+ * Function Prototype *
+ *---------------------------------------------------------------------------------*/
+extern RET_API MutexInit(void);
+extern RET_API SemaphoreInit(void);
+extern RET_API MemoryInit(void);
+extern RET_API EventInit(void);
+extern RET_API MsgInit(void);
+extern RET_API ErrTrapInit(void);
+extern RET_API TimerInit(HANDLE h_app);
+extern void MsgTerm(void);
+
+static void BaseCreateMutex(void);
+static void BaseLockMutex(void);
+static void BaseUnlockMutex(void);
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/** Handle for locking Base API setups */
+static HANDLE g_h_mtx = NULL;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Setup Base API
+ *
+ * Perform the processing required to use the Base API.(Call per process)
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return RET_NORMAL Normal completion
+ */
+RET_API _pb_Setup_CWORD64_API(HANDLE h_app) { // NOLINT(readability/nolint) API
+ RET_API result;
+ static int8 i = 0;
+ int32 ret;
+
+ if (i != 0) {
+ /* If the process has already initialized */
+ /* nop */
+ } else {
+ /* Interprocess lock initialization(CLS) */
+ ret = CL_LockProcessInit(); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockProcessInit ERROR!! [ret=%d]", ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ BaseCreateMutex(); /* Create Mutex */
+ BaseLockMutex(); /* Get Mutex */
+
+ /* Recheck during getting Mutex */
+ if (i == 0) { // LCOV_EXCL_BR_LINE 6: i can not be other value
+ /* Not initialized */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_pb_Setup_CWORD64_API Entered.");
+
+ /* Mutex function initialization */
+ result = MutexInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MutexInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: function can not be not normal
+ }
+
+ /* Semaphore function initialization */
+ result = SemaphoreInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SemaphoreInit ERROR!! [result=%d]", \
+ result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: function can not be not normal
+ }
+
+ /* Memory function initialization */
+ result = MemoryInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MemoryInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal
+ }
+
+ /* Event function initialization */
+ result = EventInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "EventInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: function can not be not normal
+ }
+
+ /* Message function initialization */
+ result = MsgInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal
+ }
+
+ result = ErrTrapInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ErrTrapInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal
+ }
+
+ /* For Positioning processes */
+ if (_tcscmp("Positioning", FrameworkunifiedGetAppName(h_app)) == 0) { // LCOV_EXCL_BR_LINE 200: can not be other value
+ /* Timer function initialization */
+ result = TimerInit(h_app);
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "TimerInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal
+ }
+ }
+
+ i = 1;
+ }
+
+ BaseUnlockMutex(); /* Release Mutex */
+ }
+
+ /* Set application handle */
+ _pb_SetAppHandle(h_app);
+
+ return RET_NORMAL;
+}
+
+/**
+ * @brief
+ * Teardown Base API
+ *
+ * Base API termination processing (Call per process)
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+void _pb_Teardown_CWORD64_API(void) { // NOLINT(readability/nolint) API // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Interprocess Lock Control(CLS) */
+
+
+ /*
+ Resources cannot be released unless it is guaranteed that other processes do not call the Positioning API.
+ Even if the resource is not released at the time of termination, it will not lead to illegal operation such as memory leak.
+ Comment out release processing.
+ */
+
+ /* Mutex */
+ /* Semaphore */
+ /* Memory */
+ /* Event */
+ /* Message */
+
+ /* Timer */
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+
+/**
+ * @brief
+ * Create Mutex for Base API setups
+ */
+static void BaseCreateMutex(void) {
+ g_h_mtx = (HANDLE)CL_LockMap(LOCK_POS_MTX_1); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockMap ERROR [g_h_mtx:%p]", g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get Mutex for Base API setups
+ */
+static void BaseLockMutex(void) {
+ int32 ret;
+
+ ret = CL_LockGet(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockGet ERROR [g_h_mtx:%p, ret:%d]", \
+ g_h_mtx, ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Release Mutex for Base API Setup
+ */
+static void BaseUnlockMutex(void) {
+ int32 ret;
+
+ ret = CL_LockRelease(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockRelease ERROR [g_h_mtx:%p, ret:%d]", \
+ g_h_mtx, ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
diff --git a/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp b/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp
new file mode 100755
index 0000000..e144d6f
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp
@@ -0,0 +1,131 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+* $Header:: $
+* $Revision:: $
+*******************************************************************************/
+
+/****************************************************************************
+ * File name :_pbCSection.cpp
+ * System name :GPF
+ * Subsystem name :_CWORD64_API Critical Section Function
+ * Title :Critical Section Function Definition File
+ ****************************************************************************/
+
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : PbDeleteCriticalSection()
+* ABSTRACT : Specify a critical section object that is not owned and free all resources used by that object.
+* NOTE :
+* ARGUMENT : LPCRITICAL_SECTION lp_critical_section
+* RETURN : VOID defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID PbDeleteCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+
+ if (lp_critical_section == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbDeleteCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__);
+ } else {
+ lret = pthread_mutex_destroy(lp_critical_section);
+ if (lret != EOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbDeleteCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__, lret);
+ }
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : PbEnterCriticalSection()
+* ABSTRACT : Wait to take ownership of the specified critical section object
+* NOTE :
+* ARGUMENT : LPCRITICAL_SECTION lp_critical_section
+* RETURN : VOID defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID PbEnterCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+
+ if (lp_critical_section == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbEnterCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__);
+ } else {
+ lret = pthread_mutex_lock(lp_critical_section);
+ if (lret != EOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbEnterCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__, lret);
+ }
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : PbInitializeCriticalSection
+* ABSTRACT : Initialize the specified critical section object.
+* NOTE :
+* ARGUMENT : LPCRITICAL_SECTION lp_critical_section
+* RETURN : VOID defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID PbInitializeCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : PbLeaveCriticalSection
+* ABSTRACT : Discard ownership of the specified critical section object.
+* NOTE :
+* ARGUMENT : LPCRITICAL_SECTION lp_critical_section
+* RETURN : VOID defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID PbLeaveCriticalSection(LPCRITICAL_SECTION lp_critical_section ) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+
+ if (lp_critical_section == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbLeaveCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__);
+ } else {
+ lret = pthread_mutex_unlock(lp_critical_section);
+ if (lret != EOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbLeaveCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__, lret);
+ }
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
diff --git a/vehicleservice/positioning_base_library/library/src/_pbCommon.cpp b/vehicleservice/positioning_base_library/library/src/_pbCommon.cpp
new file mode 100755
index 0000000..6bb4fb9
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbCommon.cpp
@@ -0,0 +1,928 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbCommon.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System wide functions
+ Title : System API _CWORD64_ configuration processes
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <vehicle_service/positioning_base_library.h>
+
+#include "_pbCommon.h"
+#include "WPF_STD_private.h"
+#include "sysup_addr.h"
+#include "tchar.h"
+#include "sysup.h"
+
+/*
+ Constants and data type definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define BLOCK_SIZE (1*1024*1024)
+#define WDTC_REG_ADDR (0x13500000 | ADDR_P2) /* WDT clear register address */
+#define SUM_ZERO 0
+#define ALLOC_SIZE 0x00200000
+#define EXIST_CLEAR 0x434c4f4b /* Flag to indicate cleared Non-OS management area */
+
+#define PRCM_BASE 0x48180000
+#define PRM_RSTCTRL 0xA0
+
+#define RST_GLOBAL_COLD_SW (0x01 << 1)
+#define RST_GLOBAL_WARM_SW (0x01 << 0)
+
+/*
+ Internal function prototype declarations
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+u_int32 RomCheck(u_int32 *start_addr, u_int32 check_size);
+u_int32 RomCheckEx(u_int32 *start_addr, u_int32 check_size);
+uint64_t AtoxLong(char* str, unsigned int ascii_size);
+void XtoaLong(uint64_t x, char* str);
+#ifdef PBCOM_CONFIGREAD
+static RET_API SysGetConfigSize(FILE*, u_int32*);
+static RET_API SysReadConfigInfo(FILE*, TCHAR*, TCHAR*, u_int32);
+static int SysUniToInt(TCHAR*, u_int32);
+#endif /* PBCOM_CONFIGREAD */
+
+/*
+ External function prototype declarations
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ Global Variable Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef PSL_USED
+extern int g_n_api_set_id; /* ID variable for PSL registration */
+#endif // PSL_USED
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _CWORD64_NotOSAreaInit
+ * ABSTRACT : Initialization non-OS managed areas of _CWORD64_
+ * NOTE : This function initializes the non-OS control areas of _CWORD64_.
+ * ARGUMENT : None
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_CWORD64_NotOSAreaInit(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#ifndef CEPC_EM /* If not emulated in CEPC */
+ RET_API ret;
+ char *cp_addr = NULL;
+ u_int32 size;
+ u_int32 *p_clear_flag; /* Pointer for storing non-OS management area clear flag */
+ LPVOID notos_topaddr;
+
+ /* Link of shared memory area to store the non-OS management area clear flag */
+ ret = _pb_LinkShareData(const_cast<char*>("NOTOS_DATA"), reinterpret_cast<void**>(&cp_addr), &size);
+ if (ret != RET_NORMAL) {
+ /* Create a shared memory area to store the non-OS management area clear flag */
+ Memset64pSync(cp_addr, 0, sizeof(p_clear_flag)); /* NULL initialization process of acquisition area */
+ }
+
+ p_clear_flag = reinterpret_cast<u_int32*>(cp_addr);
+
+ /* Non-OS management area clear processing */
+ /* Because an exception occurs when garbage data remains in the message pool at startup,
+ Clear the entire non-OS management area as 0 Only for the first time after startup. */
+ if (*p_clear_flag != EXIST_CLEAR) {
+ /* Execute mapping to non-OS management area */
+ ret = PbAccessPhysicalMem(TOP_ADDR_NOTOS, /* Start address non-OS management area for of the _CWORD64_ */
+ &notos_topaddr, /* Start address of the mapping */
+ NOTOS_SISE, /* Area-size */
+ 0);
+
+ /* failed mapping */
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_msg.lib:%s:LINE %d\r\n PbAccessPhysicalMem ERROR In " \
+ "_CWORD64_NotOSAreaInit ... ret[%d] \r\n",
+ LTEXT(__FILE__), __LINE__, ret);
+ _pb_Exit();
+ }
+
+ /* Non-OS management area clear processing */
+ Memset64pSync(notos_topaddr, 0, NOTOS_SISE);
+
+ /* Shared area release processing */
+ ret = PbFreePhysicalMem(TOP_ADDR_NOTOS, /* Start address of the _CWORD64_ non-OS management area */
+ notos_topaddr, /* Start address of the mapped area */
+ NOTOS_SISE); /* Size */
+
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_msg.lib:%s:LINE %d\r\n PbFreePhysicalMem ERROR " \
+ "In_CWORD64_NotOSAreaInit ... ret[%d] \r\n",
+ LTEXT(__FILE__), __LINE__, ret);
+ _pb_Exit();
+ }
+
+ *p_clear_flag = EXIST_CLEAR; /* Set non-OS management area clear flag */
+ }
+#endif
+
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _CWORD64_APIInit
+ * ABSTRACT : System initialization of _CWORD64_API
+ * NOTE : This function is called once from the initialization process
+ * : at system startup to perform the _CWORD64_API initialization process.
+ * ARGUMENT : u_int32 (*sighand)() Completion of signal handling within APIs if NULL
+ * : Otherwise calls this first when a signal is raised
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_CWORD64_APIInit(u_int32 (*sighand)()) { // NOLINT(readability/nolint) API // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API RetSts = RET_ERROR;
+
+ if (sighand == NULL) {
+ /* Parameter is set to an error other than NULL */
+ RetSts = _pb_Setup_CWORD64_API(NULL); /* Execute initialization processing for normal processing */
+ }
+
+ return(RetSts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_GetPrgVer
+ * ABSTRACT : Get the program version
+ * NOTE : Get the program version of the mask ROM (BootLoader) and flash
+ * : ROM (NK-image) into specified buffers.
+ * : In hardware-independent CEPC emulation environment, return the following version,
+ * : otherwise always return RET_NORMAL as the return value.
+ * : mask_ver=0x0102 0304 0506 0708
+ * : flash_ver1=0x0102 0304 0506 0708
+ * : flash_ver2=0x0102 0304 0506 0708
+ * : flash_ver3=0x0102 0304 0506 0708
+ * ARGUMENT : T_SYS_PRGVER *pbuf Destination buffer address
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_GetPrgVer(T_SYS_PRGVER *pbuf) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_UpManage
+ * ABSTRACT : Boot management process
+ * NOTE : Set the startup identifier in the SDRAM startup identification table (SDRAM)
+ * : or TinyFugue area (FLASH) at the next startup.
+ * : Which one to set depends on the table type of the argument.
+ * : Soft reset is performed when reset is instructed by the parameter.
+ * : In hardware-independent CEPC emulation environment, return the RET_NORMAL as the return value without recording the startup identifier.
+ * ARGUMENT : u_int16 up_sts :Startup Identifier Value
+ * : int reset :Reset instruction
+ * : u_int8 table :Table Type
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_UpManage(u_int32 up_sts, int reset, u_int8 table) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Is reset instructed? */
+ if ((reset == SYS_RESET) || (reset == SYS_ONLY_RESET)) {
+ PbReset(); /* Soft reset */
+ }
+
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_RomcheckMask
+ * ABSTRACT : Check the sum value of masked part
+ * NOTE : Check the sum value of the mask ROM (BOOTROM)
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL :Sum value normal
+ * REL_ERROR :Sum value error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_RomcheckMask(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_RomcheckApl
+ * ABSTRACT : Check sum value of APL part (NK image)
+ * NOTE : In hardware-independent CEPC emulations do nothing and return RET_NORMAL.
+ * ARGUMENT :
+ * RETURN : RET_API RET_NORMAL :Sum Value Normal
+ * REL_ERROR :Sum value error
+ * RET_OSERROR :AccessPhysicalMem error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_RomcheckApl(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbReset
+ * ABSTRACT : Hard reset processing
+ * NOTE : Manipulate the WDT control register to generate a hard reset
+ * : Hardware-independent CEPC emulations do nothing and return RET_NORMAL.
+ * ARGUMENT : void
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+PbReset(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ /* Message log output processing */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " PbReset:%s:LINE %d\r\n #### HARD RESET !! ####\r\n",
+ LTEXT(__FILE__), __LINE__);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_GetDeviceInfo
+ * ABSTRACT : Getting device information
+ * NOTE : Gets device information into the specified buffer.
+ * : In hardware-independent CEPC emulations, the following device
+ * : information is returned permanently. The return value is always RET_NORMAL.
+ * : _CWORD31__no="8611052060010001" mci_no="CNCS0200A" date="200301011200"
+ * ARGUMENT : T_SYS_PRGVER *pbuf Destination buffer address
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_GetDeviceInfo(T_SYS_DEVINFO *pbuf) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_WriteDeviceInfo
+ * ABSTRACT : Write device key information
+ * NOTE : Write device key information to flash memory
+ * ARGUMENT : u_char *ucpData Start address of write data (256 bytes)
+ * RETURN : int32 VUP_SUCCESS Flash write complete
+ * : VUP_FAILED Flash write abend
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+int32
+_pb_WriteDeviceInfo(u_char *ucpData) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_GetSramVer
+ * ABSTRACT : SRAM versioning process
+ * NOTE : Getting SRAM version
+ * : In hardware-independent CEPC emulations, return the following SRAM Version statically.
+ * : The return value is always RET_NORMAL.
+ * : SRAM Version=0x1112 1314
+ * ARGUMENT : char *pbuf Destination buffer address
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_GetSramVer(char *pbuf) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_GetDisplayInfo
+ * ABSTRACT : Getting display information
+ * NOTE : Get the screen size (width and height) into the buffer of the DISPLAY_INFO structure
+ * ARGUMENT : DISPLAY_INFO *pSystemInfo Screen size acquisition destination buffer address
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define DISPLAYINFO_SUBKEY_SIZE 56
+#define DISPLAYINFO_VALNAME_SIZE 16
+#define DISPLAYINFO_VAL_SIZE 8
+
+RET_API
+_pb_GetDisplayInfo(DISPLAY_INFO *pSystemInfo) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#ifdef PBCOM_CONFIGREAD
+ FILE* fpConfigFile = NULL; /* Configuration file handle */
+ TCHAR tcData[DISPLAYINFO_VAL_SIZE] = {0}; /* Data section read buffer */
+ TCHAR tcDataName[DISPLAYINFO_VALNAME_SIZE] = {0}; /* Data information storage buffer */
+ int iRet = PBCOM_API_NORMAL; /* API return value */
+#endif
+ int iHeight = 0; /* Screen height information */
+ int iWidth = 0; /* Screen width information */
+ RET_API Retapi = RET_NORMAL; /* Results of this Module process */
+
+ /************************************************************
+ * Parameter check
+ ************************************************************/
+ if (NULL == pSystemInfo) {
+ /* Parameter is set to error */
+ Retapi = RET_ERRPARAM;
+ }
+
+ /************************************************************
+ * Set the information in the configuration file
+ ************************************************************/
+#ifdef PBCOM_CONFIGREAD
+ /************************************************************
+ * Open configuration file
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ fpConfigFile = fopen(PBCOM_CONFIGFILE, "r");
+ if (NULL == fpConfigFile) {
+ /* Set error in as a result */
+ Retapi = RET_ERROR;
+ }
+ }
+
+ /************************************************************
+ * Get screen width information from configuration file
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Buffer clear */
+ memset(tcData, 0x00, sizeof(tcData));
+ memset(tcDataName, 0x00, sizeof(tcDataName));
+
+ /* Data information setting */
+ memcpy(tcDataName, PBCOM_CONFIG_INDEX_SCRWIDTH, strlen(PBCOM_CONFIG_INDEX_SCRWIDTH));
+
+ /************************************************************
+ * Setting file information reading process
+ ************************************************************/
+ Retapi = SysReadConfigInfo(fpConfigFile, tcDataName, tcData, (u_int32)sizeof(tcData));
+
+ /************************************************************
+ * Conversion process from character string (UNICODE) to numeric
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Conversion from string to numeric */
+ iHeight = SysUniToInt(tcData, strlen(tcData));
+ }
+ }
+
+ /************************************************************
+ * Get screen height information from setting file
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Buffer clear */
+ memset(tcData, 0x00, sizeof(tcData));
+ memset(tcDataName, 0x00, sizeof(tcDataName));
+
+ /* Data information setting */
+ memcpy(tcDataName, PBCOM_CONFIG_INDEX_SCRHEIGHT, strlen(PBCOM_CONFIG_INDEX_SCRHEIGHT));
+
+ /************************************************************
+ * Setting file information reading process
+ ************************************************************/
+ Retapi = SysReadConfigInfo(fpConfigFile, tcDataName, tcData, (u_int32)sizeof(tcData));
+
+ /************************************************************
+ * Conversion process from character string (UNICODE) to numeric
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Conversion from string to numeric */
+ iWidth = SysUniToInt(tcData, strlen(tcData));
+ }
+ }
+
+ /************************************************************
+ * Configuration file close
+ ************************************************************/
+ /* Executed only when the open is successful. */
+ if (NULL != fpConfigFile) {
+ iRet = fclose(fpConfigFile);
+ if (PBCOM_API_NORMAL != iRet) {
+ Retapi = RET_ERROR;
+ }
+ }
+
+ /************************************************************
+ * Direct value setting
+ ************************************************************/
+#else
+ iHeight = 480;
+ iWidth = 800;
+#endif
+ /************************************************************
+ * Display information setting
+ ************************************************************/
+
+ if (RET_NORMAL == Retapi) {
+ /* Coverity CID: 18756 compliant */
+ pSystemInfo->i_height_size = iHeight;
+ pSystemInfo->i_width_size = iWidth;
+ } /* Coverity CID: 18756 compliant */
+
+ return Retapi;
+}
+// LCOV_EXCL_STOP
+
+/******************************************************************************
+* MODULE : RomCheck
+* ABSTRACT : Calculate sum value within range of address specified by argument
+* FUNCTION : u_int32 RomCheck()
+* ARGUMENT : u_int32 *addr Start address for which sum value is to be calculated
+* u_int32 check_size Size for which the sum is to be calculated
+* NOTE :
+* RETURN : u_int32 sum Sum value
+******************************************************************************/
+u_int32
+RomCheck(u_int32 *start_addr, u_int32 check_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int32 *addr_tmp;
+ u_int32 *end_addr;
+ u_int32 sum;
+
+ end_addr = start_addr + check_size / sizeof(u_int32);
+ addr_tmp = start_addr;
+
+ for (sum = 0; addr_tmp < end_addr;) {
+ sum += *(addr_tmp++);
+ }
+ return(sum);
+}
+// LCOV_EXCL_STOP
+
+/******************************************************************************
+* MODULE : RomCheckEx
+* ABSTRACT : Calculate sum value in range of address on ROM specified by argument
+* FUNCTION : u_int32 RomCheckEx()
+* ARGUMENT : u_int32 *addr Start address for which sum value is to be calculated
+* u_int32 check_size Size for which the sum is to be calculated
+* NOTE : For single operation(For a one-bank configuration). APIs provided by FROM management
+* are used because FROM management must be exclusively controled.
+* The sum calculation unit is assumed to be the sector size of FlashROM.
+* RETURN : u_int32 sum Sum value
+* When this function terminates with an error, "RET_ERROR" is returned.
+******************************************************************************/
+u_int32
+RomCheckEx(u_int32 *start_addr, u_int32 check_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(0);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : AtoxLong
+ * ABSTRACT : Convert ASCII to hex
+ * FUNCTION : Convert a ASCII string (up to 8 characters) to a uint64_t hexadecimal string
+ * NOTE :
+ * RETURN : uint64_t :Converted hexadecimal number (up to 8 digits)
+ * INPUT : char *str -------------------- Pointer to a source ASCII string
+ * unsigned int ascii_size ------ Number of characters in source ASCII string
+ * OUTPUT :
+ ******************************************************************************/
+uint64_t AtoxLong(char* str, unsigned int ascii_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uint64_t x = 0; /* Return value */
+ unsigned int i; /* For work */
+ unsigned int tmp; /* For work */
+
+ /* Check that the specified ASCII number of characters does not exceed the number of digits represented by int64_t (8 hexadecimal digits). */
+ if (ascii_size > (sizeof(x)) * 2) {
+ ascii_size = static_cast<unsigned int>(sizeof(x) * 2);
+ }
+ /* Convert one character at a time to hexadecimal */
+ for (i = 0; i < ascii_size; i++) {
+ /* Is a number? */
+ tmp = *str - '0';
+ if (tmp > 9) {
+ /* Coverity CID: 18790 compliant */
+ /* a-f? */
+ tmp = *str - 'a' + 10;
+ if ((tmp < 0x0a) || (tmp > 0x0f)) {
+ /* A to F ? */
+ tmp = *str - 'A' + 10;
+ if ((tmp < 0x0a) || (tmp > 0x0f)) {
+ /* Stop when a non-hexadecimal value is found */
+ break;
+ }
+ }
+ }
+
+ /* Increase the digit */
+ x <<= 4;
+ /* Add to the bottom digit */
+ x |= tmp;
+ str++;
+ }
+
+ return x;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : XtoaLong
+ * ABSTRACT : Convert HEX to ASCII
+ * FUNCTION : This function converts the 8-digit hexadecimal number from str[0] to the ASCII code and stores the code.
+ * NOTE : The string to be passed as *str must be at least 8 characters in length. * RETURN :
+ * INPUT : uint64_t x ------------ Source hexadecimal number
+ * OUTPUT : char* str ------------------ Converted ASCII Strings (8 Characters)
+ ******************************************************************************/
+void XtoaLong(uint64_t x, char* str) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int i; /* For looping */
+ int size; /* For looping */
+ char tmp; /* Conversion temporary buffer */
+
+ /* Maximum number of loops (for character string) */
+ size = static_cast<int>(sizeof(int64_t) * 2);
+ /* Convert eight digits */
+ for (i = 0; i < size; i++) {
+ tmp = static_cast<char>((x >> ((size - i - 1) * 4)) & 0x0F);
+
+ /* For 0xA to 0xF */
+ if (tmp > 0x09) {
+ str[i] = static_cast<char>('A' + tmp - 0x0A);
+ } else {
+ str[i] = static_cast<char>('0' + tmp);
+ }
+ }
+}
+// LCOV_EXCL_STOP
+
+/******************************************************************************
+* MODULE : _pb_SendSystemError
+* ABSTRACT : System error notification
+* FUNCTION : Notify the system error and reset the software.
+* ARGUMENT : PNO pno Error process No.
+* int32 errcode Error code
+* NOTE : _pb_SndMsg : Send message (System API)
+* _sys_GetPno : PNO to be gotten
+* RETURN : RET_API defined
+******************************************************************************/
+RET_API _pb_SendSystemError(PNO pno, int32 errcode) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ T_SYS_SYSTEMERROR msg; /* Message */
+ register T_APIMSG_HEADER *hdr; /* Message header */
+ RET_API api_ret;
+
+ /* Message Header Settings */
+ hdr = &(msg.bhead.hdr);
+
+ msg.bhead.signo = 0; /* Extension member */
+ hdr->sndpno = 0; /* Source Process No. */
+ hdr->respno = 0; /* Response destination process No.(None) */
+ hdr->cid = CID_INI_SYSTEMERR; /* Command ID */
+ hdr->msgbodysize = static_cast<uint16_t>(sizeof(T_SYS_SYSTEMERROR) - sizeof(T_APIMSG_MSGBUF_HEADER));
+ /* Main unit size */
+ hdr->rid = 0; /* Resources ID (Dummy) */
+ hdr->reserve = 0;
+ msg.pno = pno; /* Error process No. */
+ msg.errcode = errcode; /* Error code */
+
+ /* Send Message */
+ api_ret = _pb_SndMsg(PNO_GINI_MAIN, sizeof(msg), &msg, 0);
+
+ return(api_ret);
+}
+// LCOV_EXCL_STOP
+
+/******************************************************************************
+* MODULE : _pb_GetVupFileName
+* ABSTRACT : Getting the version upgrade file name
+* FUNCTION : Get the path name and file name of the version upgrade.
+* ARGUMENT : LPTSTR filename File name storage
+* u_char media Container media
+* NOTE :
+* RETURN : RET_API defined
+******************************************************************************/
+RET_API _pb_GetVupFileName(LPTSTR filename , u_char media) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API api_ret = RET_NORMAL; /* API return value */
+ T_SYS_PRGVER ver; /* Version Information */
+ RET_API ret; /* Internal function return value */
+ u_char kisyu; /* Storage of model code */
+
+ /* Get version */
+ ret = _pb_GetPrgVer(&ver);
+
+ if (ret == RET_NORMAL) {
+ /* Extract model code from version */
+ kisyu = ver.mask_ver[3];
+
+ /* If the media is a disk */
+ if (media == VUP_GETNAME_MEDIA_DISC) {
+ _stprintf(filename, _T("%s%s%s%02x%s"),
+ VUP_DISC_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_TOP, kisyu, VUP_FNAME_BTM);
+ } else {
+ /* Media is USB */
+ _stprintf(filename, _T("%s%s%s%02x%s"),
+ VUP_USB_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_TOP, kisyu, VUP_FNAME_BTM);
+ }
+ } else {
+ api_ret = RET_ERROR;
+ }
+
+ return(api_ret);
+}
+// LCOV_EXCL_STOP
+
+/******************************************************************************
+* MODULE : _pb_GetForceVupFileName
+* ABSTRACT : Getting the version upgrade file name
+* FUNCTION : Get the path name and file name of the version upgrade.
+* ARGUMENT : LPTSTR filename File name storage
+* u_char media Container media
+* NOTE :
+* RETURN : RET_API defined
+******************************************************************************/
+RET_API _pb_GetForceVupFileName(LPTSTR filename , u_char media) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API api_ret = RET_NORMAL; /* API return value */
+
+ /* If the media is a disk */
+ if (media == VUP_GETNAME_MEDIA_DISC) {
+ _stprintf(filename, _T("%s%s%s"),
+ VUP_DISC_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_FORCEVUP);
+ } else {
+ /* Media is USB */
+ _stprintf(filename, _T("%s%s%s"),
+ VUP_USB_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_FORCEVUP);
+ }
+
+ return(api_ret);
+}
+// LCOV_EXCL_STOP
+
+#ifdef PBCOM_CONFIGREAD
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SysGetConfigSize
+ * ABSTRACT : Setting file size acquisition processing
+ * NOTE : Get file size.
+ * : When this Module is called, an area must be allocated at a higher level.
+ * : Parameter checking is not performed in this Module.
+ * ARGUMENT : FILE* fpFile(File handle)
+ * : int* piSize(File size storage area)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static RET_API
+SysGetConfigSize(FILE* fpFile, u_int32* puiSize) {
+ int64_t lCurrentPos = 0; /* File current position */
+ int64_t lEndPos = 0; /* End position of the file */
+ int iRet = PBCOM_API_NORMAL; /* API processing result */
+ RET_API Retapi = RET_NORMAL; /* Result of this Module process */
+
+ /************************************************************
+ * Get current offset
+ ************************************************************/
+ lCurrentPos = ftell(fpFile);
+
+ /* If the return value is abnormal, the processing result is set to abnormal. */
+ if (PBCOM_API_ERROR == lCurrentPos) {
+ Retapi = RET_ERROR;
+ }
+
+ /************************************************************
+ * Get end offset (size)
+ * -Set offset to end-of-file
+ * -Get end-of-file offset
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Set offset to end-of-file */
+ iRet = fseek(fpFile, 0L, SEEK_END);
+
+ /* If the return value is abnormal, the processing result is set to abnormal. */
+ if (PBCOM_API_NORMAL != iRet) {
+ Retapi = RET_ERROR;
+ }
+ }
+
+ if (RET_NORMAL == Retapi) {
+ /* Get end-of-file offset */
+ lEndPos = ftell(fpFile);
+
+ /* Set file size if the return value is normal */
+ if (PBCOM_API_ERROR != lEndPos) {
+ *puiSize = (u_int32)lEndPos;
+ } else {
+ /* If the return value is abnormal, the processing result is set to abnormal. */
+ Retapi = RET_ERROR;
+ }
+ }
+
+ /************************************************************
+ * Revert current offset
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Revert offset and complete processing */
+ iRet = fseek(fpFile, lCurrentPos, SEEK_SET);
+
+ /* If the return value is abnormal, the processing result is set to abnormal. */
+ if (PBCOM_API_NORMAL != iRet) {
+ Retapi = RET_ERROR;
+ }
+ }
+
+ return Retapi;
+}
+#endif /* PBCOM_CONFIGREAD */
+
+#ifdef PBCOM_CONFIGREAD
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SysReadConfigInfo
+ * ABSTRACT : Setting file information reading process
+ * NOTE : Read the data associated with the specified data information from the configuration file.
+ * : When this module is called, an area must be allocated at a higher level.
+ * : Parameter checking is not performed in this module.
+ * ARGUMENT : FILE* fpConfig(File handle)
+ * : TCHAR* tcDataIndex(Data information)
+ * : TCHAR* tcDataBuf(Data read buffer)
+ * : int tcDataSize(Data read size)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static RET_API
+SysReadConfigInfo(FILE* fpConfig, TCHAR* tcDataIndex, TCHAR* tcDataValue, u_int32 tcDataSize) {
+ TCHAR tcReadBuf[PBCOM_CONFIGSIZE_MAX] = {0}; /* Read buffer */
+ u_int32 uiDataPos = 0; /* Data position */
+ u_int32 uiCpyPos = 0; /* Copy position */
+ u_int32 uiFileSize = 0; /* File size */
+ u_int32 uiReadSize = 0; /* Data read size */
+ u_int32 uiDataNum = 0; /* Number of read data */
+ int iRet = 0; /* API processing result */
+ RET_API Retapi = RET_NORMAL; /* Result of this Module process */
+
+ /************************************************************
+ * Get setting file size
+ ************************************************************/
+ /* Get setting file size */
+ Retapi = SysGetConfigSize(fpConfig, &uiFileSize);
+
+ /* When the setting file size is gotten successfully */
+ if (RET_NORMAL == Retapi) {
+ /* The maximum size of the configuration file is greater than or equal to the maximum size of the configuration file. */
+ if (uiFileSize > PBCOM_CONFIGSIZE_MAX) {
+ /* Set the maximum value of the configuration file as the size */
+ uiFileSize = PBCOM_CONFIGSIZE_MAX;
+ }
+ }
+
+ /************************************************************
+ * Read setting file
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Read data count */
+ uiDataNum = uiFileSize / sizeof(TCHAR);
+
+ /* Set file pointer to the beginning of file */
+ rewind(fpConfig);
+
+ /* Read the data */
+ uiReadSize = fread(tcReadBuf, sizeof(TCHAR), uiDataNum, fpConfig);
+
+ /* When the data corresponding to the file size cannot be read */
+ if (uiReadSize != uiFileSize) {
+ /* Set error in processing result */
+ Retapi = RET_ERROR;
+ }
+ }
+
+ /************************************************************
+ * Data information search & retrieval
+ * -Find data information from the configuration file you read
+ * -Read associated data if data information can be found
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Set error to processing result (Set normal when search is normal) */
+ Retapi = RET_ERROR;
+
+ for (uiDataPos = 0; uiDataPos < uiDataNum; uiDataPos++) {
+ /* Determine file information */
+ iRet = memcmp(&tcReadBuf[uiDataPos], tcDataIndex, strlen(tcDataIndex));
+
+ /************************************************************
+ * If the applicable data information(Data information matched)
+ ************************************************************/
+ if (0 == iRet) {
+ /* Move to data position (Move file information)*/
+ uiDataPos += strlen(tcDataIndex) / sizeof(TCHAR);
+
+ /* Set normal to processing result for data discovery */
+ Retapi = RET_NORMAL;
+
+ /************************************************************
+ * Data read processing
+ * -Read data from the read data size
+ * -Assume that he end of the data has been reached when the following conditions are met
+ * NULL character code
+ * Line feed character code
+ * The data end of the configuration file is exceeded.
+ ************************************************************/
+ for (uiCpyPos = 0; uiCpyPos < tcDataSize; uiCpyPos++) {
+ if (uiDataNum > uiDataPos) {
+ /* Coverity CID: 18781 compliant */
+ /* If it is valid data */
+ if ((PBCOM_UNICODE_NUL != tcReadBuf[uiDataPos]) &&
+ (PBCOM_UNICODE_LF != tcReadBuf[uiDataPos])) {
+ /* Data setting*/
+ tcDataValue[uiCpyPos] = tcReadBuf[uiDataPos];
+ } else {
+ /* Exit from this loop */
+ break;
+ }
+ } else {
+ /* When the end of data is reached */
+ /* Exit from this loop */
+ break;
+ }
+ /* Move the data position by the set amount */
+ uiDataPos++;
+ }
+ /************************************************************
+ * Completion of data information search
+ ************************************************************/
+ break;
+ } else {
+ /************************************************************
+ * Not applicable data information(Data information mismatch)
+ ************************************************************/
+ /************************************************************
+ * Move to next data information
+ * -Determine supine data if following condition is met
+ * Line feed character code
+ * -End processing when the end of file is reached
+ ************************************************************/
+ while (uiDataPos < uiDataNum) {
+ /* Data determination */
+ if (PBCOM_UNICODE_LF == tcReadBuf[uiDataPos]) {
+ /*Next Data Detection */
+ break;
+ }
+ /* Move the data by the determined amount */
+ uiDataPos++;
+ }
+ }
+ }
+ }
+ return Retapi;
+}
+#endif /* PBCOM_CONFIGREAD */
+
+#ifdef PBCOM_CONFIGREAD
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SysUniToInt
+ * ABSTRACT : Converting from Unicode(string) to Int(number)
+ * NOTE : Convert from Unicode(string) to Int(number).
+ * : The number of characters that can be converted is defined in PBCOM_UTOIMAX_NUM.
+ * : When this module is called, an area must be allocated at a higher level.
+ * : Parameter checking is not performed in this module.
+ * ARGUMENT : TCHAR* tcData(Character string storage area)
+ * : int iDataSize(Character array size)
+ * RETURN : Number converted from character string
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static int SysUniToInt(TCHAR* tcData, u_int32 iDataSize) {
+ int iValue = 0; /* Converted value */
+ u_int8 ucCount = 0; /* Character string data position */
+
+ /************************************************************
+ * Parameter check
+ ************************************************************/
+ if (PBCOM_UTOIMAX_NUM < iDataSize) {
+ iDataSize = PBCOM_UTOIMAX_NUM;
+ }
+
+ /************************************************************
+ * Conversion from string to number
+ ************************************************************/
+ for (ucCount = 0; ucCount < iDataSize; ucCount++) {
+ /*If it is a number */
+ if ((tcData[ucCount] >= '0') &&
+ (tcData[ucCount] <= '9')) {
+ iValue = (iValue * 10) + (tcData[ucCount] - '0');
+ } else {
+ /* If it is not a digit */
+ /* End of data */
+ break;
+ }
+ }
+ return iValue;
+}
+#endif /* PBCOM_CONFIGREAD */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : _sysCommon.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
diff --git a/vehicleservice/positioning_base_library/library/src/_pbDram.cpp b/vehicleservice/positioning_base_library/library/src/_pbDram.cpp
new file mode 100755
index 0000000..eb70131
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbDram.cpp
@@ -0,0 +1,284 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbDram.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System common functions
+ Title : System API
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+
+/*
+ Constants and structure definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define END 0xFFFFFFFF /* DRAM R/W check address table end flag */
+/* Definitions for CRC calculations */
+#define DIV_BYTE_DATA 0x000000FF
+#define CRC_INIT 0x00000000
+#define DATA_L_SHIFTNUM 8
+#define DATA_R_SHIFTNUM 24
+
+/*
+ Global Variable Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+extern int g_n_api_set_id; /* ID variable for PSL registration */
+
+/*
+External function prototype declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef __cplusplus
+extern "C" {
+#endif
+ BOOL VirtualCopy(LPVOID lpv_dest, LPVOID lpv_src, DWORD cb_size, DWORD fdw_protect);
+#ifdef __cplusplus
+};
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramWt
+ * ABSTRACT : DRAM self-refresh area write process
+ * NOTE : Write the content of the buffer to the offset-position of the area of the specified DRAM ID.
+ * Perform CRC calculation and add it to the end of the area
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * void *pbuf Source buffer pointer
+ * u_int32 off Destination DRAM offsets(bytes)
+ * u_int16 size Transfer data size(bytes)
+ * RETURN : RET_API defineed
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret = PbDramWt32(id, pbuf, off, (u_int32)size);
+ return(ret);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbDramWt32
+ * ABSTRACT : DRAM self-refresh area write process
+ * NOTE : Write the content of the buffer to the offset-position of the area of the specified DRAM ID.
+ * Perform CRC calculation and add it to the end of the area
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * void *pbuf Source buffer pointer
+ * u_int32 off Destination DRAM offsets(bytes)
+ * u_int32 size Transfer data size(bytes)
+ * RETURN : RET_API defined
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbDramWt32(u_int8 id, void *pbuf, u_int32 off, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramRd
+ * ABSTRACT : DRAM self-refresh area read process
+ * NOTE : Write the offsets of the area of the specified DRAM ID to buffer.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int32 off Source DRAM Offsets(bytes)
+ * void *pbuf Destination buffer pointer
+ * u_int16 size Transfer data size(bytes)
+ * RETURN : RET_API definef
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramRd32
+ * ABSTRACT : DRAM self-refresh area read process
+ * NOTE : Write the offsets of the area of the specified DRAM ID to buffer.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int32 off Source DRAM Offset(bytes)
+ * void *pbuf Destination buffer pointer
+ * u_int32 size Transfer data size(bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramSz
+ * ABSTRACT : DRAM ID size acquisition processing
+ * NOTE : Get the effective area size of the specified DRAM ID.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int16 *psize Size(bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramSz(u_int8 id, u_int16 *psize) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramSz32
+ * ABSTRACT : DRAM ID size acquisition processing
+ * NOTE : Get the effective area size of the specified DRAM ID.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int32 *psize Size(bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramSz32(u_int8 id, u_int32 *psize) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramFilCrc
+ * ABSTRACT : DRAM memory-fill process (add CRC-value)
+ * NOTE : Fill with the specified patterns from the offset position of the area of the specified DRAM ID.
+ * After filling, add result of the CRC calculation to the end of the region.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int32 off Fill destination DRAM offset(bytes)
+ * u_int8 pat Fill pattern
+ * u_int16 size Fill size(bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramFilCrc(u_int8 id, u_int32 off, u_int8 pat, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramFil32Crc
+ * ABSTRACT : DRAM memory-fill process (CRC-value addition)
+ * NOTE : Fill with the specified patterns from the offset position of the area of the specified DRAM ID.
+ * After filling, perform CRC calculation and add it to the end of the region
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int32 off Fill destination DRAM offset(bytes)
+ * u_int8 pat Fill pattern
+ * u_int32 size Fill size(bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramFil32Crc(u_int8 id, u_int32 off, u_int8 pat, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramCrcChk
+ * ABSTRACT : DRAM self-refresh area CRC-check
+ * NOTE : Perform CRC calculation for the specified area and check whether the CRC value is normal.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramCrcChk(u_int8 id) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramRWChk
+ * ABSTRACT : DRAM read/write checking
+ * NOTE : Check whether DRAM can be read/written correctly
+ * ARGUMENT : None
+ * RETURN : RET_API define RET_NORMAL : Normal status
+ * RET_ERROR : In case of read/write error
+ * RET_OSERRER : Virtual area mapping error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramRWChk(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : Crc
+ * ABSTRACT : Calculate sum of a given range
+ * FUNCTION : RET_API Crc(u_int32 start_addr,u_int32 size, u_int32 *sum);
+ * ARGUMENT : u_int32 start_addr Top address
+ * u_int32 size Size
+ * u_int32* sum Sum value storage
+ * NOTE : Calculate the 4 bytes sum of the size portion from start_addr and stores the result in sum.
+ * If start_addr and size are not 4-bytes boundaries, errors are returned.
+ * On error, -1 is stored in sum and returned.
+ * RETURN : RET_NORMAL Sum value calculation success
+ * RET_ERROR Sum value calculation failed
+ ******************************************************************************/
+RET_API
+Crc(u_int32 start_addr, u_int32 size, u_int32 *sum) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramDestroy
+ * ABSTRACT : SRAM alternative DRAM self-refresh area destruction process
+ * NOTE : The SRAM replacement DRAM self-refresh area is destroyed by adding 1
+ * to the CRC value held by the area ID and destroying the CRC value.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramDestroy(u_int8 id) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : CrcEx
+ * ABSTRACT : Calculate the sum of the CRC values in the given range and the CRC values passed in the arguments
+ * FUNCTION : RET_API CrcEx(u_int32 start_addr, u_int32 size, u_int32 *sum, u_int32 addcrc);
+ * ARGUMENT : u_int32 start_addr Top address
+ * u_int32 size Size
+ * u_int32* sum CRC value storage
+ * u_int32 addcrc CRC value to add
+ * NOTE : When the 4-bytes-CRC value for the size is calculated from start_addr,
+ * Add the CRC value passed in the fourth argument to sum, and store it in sum.
+ * Note:Because the address align is undefined, 1-byte calculation shall be performed.
+ * RETURN : RET_NORMAL Sum value calculation success
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+CrcEx(u_int32 start_addr, u_int32 size, u_int32 *sum, u_int32 addcrc) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : _pbDram.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
diff --git a/vehicleservice/positioning_base_library/library/src/_pbEvent.cpp b/vehicleservice/positioning_base_library/library/src/_pbEvent.cpp
new file mode 100755
index 0000000..0912a13
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbEvent.cpp
@@ -0,0 +1,1695 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbEvent.cpp
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "_pbEvent_Internal.h"
+#include "_pbInternalProc.h"
+#include "WPF_STD_private.h"
+#include "tchar.h"
+
+/*---------------------------------------------------------------------------------*
+ * Internal Function Prototype *
+ *---------------------------------------------------------------------------------*/
+static BOOL FindEventTable(PB_EVENT*, TCHAR*, u_int32*);
+static BOOL AllocNewEventTable(PB_EVENT*, u_int32*);
+
+static void FreeEventTable(PB_EVENT* p_event_table, int index);
+static RET_API SetProc(PB_EVENT_OPEN_HANDLE* p_event_open, int32 i_mode, int32 l_val, int32* lp_val);
+static RET_API WaitProc(PB_EVENT_OPEN_HANDLE*, WAITING_CONDITION*, u_int32);
+static BOOL CheckCondition(PB_EVENT* p_sys_event, DWORD wcn, int32 l_event_data);
+
+static EventID EventCreateNewEventInSystem(u_int8, int32, TCHAR*);
+static EventID EventCreateNewEventInProcess(u_int32);
+
+static RET_API EventSendSignal(PB_EVENT_OPEN_HANDLE*, u_int32);
+static RET_API EventWaitForSignal(PB_EVENT_OPEN_HANDLE*, u_int32, u_int32);
+
+static BOOL EventCreateMutex(PB_EVENT_OPEN_HANDLE*);
+static void EventLockMutex(PB_EVENT_OPEN_HANDLE*);
+static void EventUnlockMutex(PB_EVENT_OPEN_HANDLE*);
+static void EventDeleteMutex(PB_EVENT_OPEN_HANDLE*);
+
+void GetDebugEventMngTblSysEvent(void* p_buf, PB_EVENT* p_evt, uint8_t* p_indent);
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static PB_EVENT_INSTANCE g_instance; // NOLINT(readability/nolint)
+
+static uint8_t g_my_proc_cnt; /* Invoking process counter value */
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Initializing Event-Related Processing
+ *
+ * Instantiate and initialize system API event related processing.
+ * Creates a flags in the CLS event library.
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRINIT Initialization error
+ */
+RET_API EventInit(void) {
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ PB_EVENT* p_event_table = NULL;
+ u_int32 ul_share_mem_size = 0;
+ RET_API ret_api = RET_ERROR;
+ char c_share_mem_name[32] = {0};
+ char c_sem_name[32] = {0};
+ void *pv_share_mem_addr = NULL;
+ int32 n;
+ RET_API l_ret_api;
+
+ /* Create Mutex */
+ _tcscpy(c_sem_name, "POS_BASE_EVENT_MUTEX");
+ p_inst->id_event_table_sem = _pb_CreateSemaphore(c_sem_name); // LCOV_EXCL_BR_LINE 200: can not be 0
+ if (p_inst->id_event_table_sem == 0) /* When mutex creation fails */ { // LCOV_EXCL_BR_LINE 200: can not be 0
+ // LCOV_EXCL_START 200: can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "_pb_CreateSemaphore ERROR [name:%s]", c_sem_name);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+ }
+
+ l_ret_api = _pb_SemLock(p_inst->id_event_table_sem); /* Get event-control-table-locking Mutex */
+ if (l_ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+
+ /* Initialize table of handles. */
+ for (n = 0; n < MAX_PB_EVENTS; n++) {
+ p_inst->p_handle_table[n] = NULL;
+ }
+
+ /* Generate shared memory name */
+ _tcscpy(c_share_mem_name, "POS_BASE_EVENT_TABLE");
+
+ /* Link to event information storage area */
+ ret_api = _pb_LinkShareData(c_share_mem_name, &pv_share_mem_addr, &ul_share_mem_size);
+ if (ret_api != RET_NORMAL) /* When the link fails */ {
+ /* Generate shared memory */
+ ret_api = _pb_CreateShareData(c_share_mem_name,
+ static_cast<u_int32>((sizeof(PB_EVENT) * MAX_PB_EVENTS)), &pv_share_mem_addr);
+
+ /* Terminate processing when generating fails */
+ if (ret_api != RET_NORMAL) {
+ ret_api = RET_ERRINIT; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* Event information storage area initialization processing */
+ p_event_table = reinterpret_cast<PB_EVENT*>(pv_share_mem_addr);
+ for (n = 0; n < MAX_PB_EVENTS; n++) {
+ memset(reinterpret_cast<void *>(p_event_table[n].event_name), 0, \
+ sizeof(p_event_table[n].event_name));
+ p_event_table[n].l_event_val = 0;
+ for (int wcn = 0; wcn < MAX_PB_EVENT_WAIT_THREADS; wcn++) {
+ p_event_table[n].st_condition[wcn].uc_use_flag = FALSE; /* Initialize to unused */
+ p_event_table[n].st_condition[wcn].uc_waiting = FALSE;
+ p_event_table[n].st_condition[wcn].us_mode = 0;
+ p_event_table[n].st_condition[wcn].ul_mask = 0; /* Initialize Mask Value */
+ p_event_table[n].st_condition[wcn].l_min_val = 0;
+ p_event_table[n].st_condition[wcn].l_max_val = 0;
+ /* Initialize event values at WaitEvent Returns */
+ p_event_table[n].st_condition[wcn].l_last_val = 0;
+ p_event_table[n].st_condition[wcn].flag_id[p_event_table->proc_cnt] = 0;
+ }
+
+ p_event_table[n].l_process_ref = 0;
+ p_event_table[n].l_reset_data = 0;
+ p_event_table[n].uc_manual_reset = _CWORD64_EVENT_MANUALRESET_OFF;
+ }
+ }
+ } else {
+ /* When the link is successful */
+ p_event_table = reinterpret_cast<PB_EVENT*>(pv_share_mem_addr);
+ p_event_table->proc_cnt++;
+ }
+
+ if (ret_api == RET_NORMAL) /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ {
+ g_my_proc_cnt = p_event_table->proc_cnt;
+ /* Get the address of the acquired event information storage area. */
+ p_inst->h_shared_memory = (HANDLE)pv_share_mem_addr;
+ p_inst->p_event_table = reinterpret_cast<PB_EVENT*>(pv_share_mem_addr);
+ }
+
+ _pb_SemUnlock(p_inst->id_event_table_sem); // LCOV_EXCL_BR_LINE 200: no branch
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Event-related instance destruction processing
+ *
+ * Delete a Flag from the CLS Event Library (Not implemented)
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR ABEND
+ */
+RET_API EventTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ char c_share_mem_name[32] = {0};
+
+ RET_API ret_api = RET_NORMAL;
+
+ /* TODO:Implement processing to delete event flags */
+
+ /* Generate shared memory name */
+ _tcscpy(c_share_mem_name, "POS_BASE_EVENT_TABLE");
+
+ /* Discard the semaphore if it has already been created */
+ if (p_inst->id_event_table_sem != 0) {
+ PbDeleteSemaphore(p_inst->id_event_table_sem);
+ p_inst->id_event_table_sem = 0;
+ }
+
+ /* Discard the shared memory if it has already been created */
+ if (p_inst->h_shared_memory != NULL) {
+ /* Release shared memory */
+ PbDeleteShareData(c_share_mem_name);
+ p_inst->h_shared_memory = NULL;
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create the event
+ *
+ * Create an event with the specified name and returns the event ID.<br>
+ * If it has already been generated, the event ID is searched and returned.
+ *
+ * @param[in] uc_manual_reset
+ * @param[in] l_init_data
+ * @param[in] *cp_event_name Pointer to the names of the event to be generated (NULL termination string)
+ *
+ * @return Non-zero Generated event ID<br>
+ * 0 Event generation error
+ */
+EventID _pb_CreateEvent(u_int8 uc_manual_reset, int32 l_init_data, // NOLINT(readability/nolint)
+ char *cp_event_name) { // NOLINT(readability/nolint)
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ EventID ret_event_id = 0;
+ TCHAR *p_event_name = NULL;
+ u_int32 index = 0;
+ BOOL bret = FALSE;
+ BOOL check_status = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ RET_API l_ret_api;
+
+ /* Parameter check */
+ if ((cp_event_name == NULL) ||
+ (uc_manual_reset >= _CWORD64_EVENT_MANUALRESET_MAX)) {
+ check_status = FALSE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+#ifdef UNICODE
+ /* Event name character limit processing */
+ if (strlen(cp_event_name) > MAX_EVENT_NAME_LEN) {
+ _pb_Exit(); /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ TCHAR unicodeEventName[MAX_EVENT_NAME_LEN + 1]; /* Maxmum nunber of characters + NULL area */
+ mbstowcs(unicodeEventName, cp_event_name, MAX_EVENT_NAME_LEN);
+ p_event_name = unicodeEventName;
+#else
+ p_event_name = cp_event_name;
+#endif // UNICODE
+
+ if ((check_status == TRUE) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (p_event_name[0] == __TEXT('\0'))) {
+ check_status = FALSE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Event name character limit processing */
+ if ((check_status == TRUE) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (_tcslen(p_event_name) < MAX_EVENT_NAME_LEN)) {
+ l_ret_api = _pb_SemLock(p_inst->id_event_table_sem); /* Mutex from here */
+ if (l_ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+
+ /* Search the event table by the specified event name */
+ bret = FindEventTable(p_inst->p_event_table, p_event_name, &index);
+ /* If the same event already exists on the system */
+ if (bret != FALSE) {
+ ret_event_id = EventCreateNewEventInProcess(index); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ /* When creating a new file */
+ ret_event_id = EventCreateNewEventInSystem(uc_manual_reset, l_init_data, p_event_name); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+ }
+
+ _pb_SemUnlock(p_inst->id_event_table_sem); // LCOV_EXCL_BR_LINE 200: no branch
+ }
+
+ return ret_event_id;
+}
+
+/**
+ * @brief
+ * Set the event
+ *
+ * Set the event value by specifying the event ID acquired when the event was created.<br>
+ * The event value setting modes are as follows.<br>
+ * SAPI_EVSET_ABSOLUTE : Absolute value setting(Specify the value to be set.)<br>
+ * SAPI_EVSET_RELATE : Relative value setting(Specifies the value relative to the current value.)
+ *
+ * @param[in] event_id Specify the event ID for which the event value is to be set.
+ * @param[in] l_set_mode Specify the event value setting mode
+ * @param[in] l_Val Specify the event value to be set
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Configuration mode error<br>
+ * RET_EV_NONE Specified event does not exist<br>
+ * RET_EV_MAX The set event value exceeds the maximum value<br>
+ * RET_EV_MIN The set event value is below the minimum value.
+ */
+RET_API _pb_SetEvent(EventID event_id, int32 l_set_mode, int32 l_val) { // NOLINT(readability/nolint)
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ RET_API ret_sts = RET_EV_NONE;
+ int32 l_work_val = 0;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if (ul_index < MAX_PB_EVENTS) {
+ /* If the specified event ID value is within range */
+ p_event_open = p_inst->p_handle_table[ul_index];
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ /* Determine the event setting mode and call the event value setting function. */
+ if (l_set_mode == SAPI_EVSET_ABSOLUTE) {
+ ret_sts = SetProc(p_event_open, EVSET_ABSOLUTE, l_val, &l_work_val); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+ } else if (l_set_mode == SAPI_EVSET_RELATE) {
+ ret_sts = SetProc(p_event_open, EVSET_RELATE, l_val, &l_work_val); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ ret_sts = RET_ERRPARAM;
+ }
+ }
+ }
+
+ return ret_sts;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SetandEvent()
+ * ABSTRACT : Event value AND setting process
+ * NOTE : Set the logical AND result of the specified mask value to the event value of the specified event ID.
+ * ARGUMENT : EventID event_id Specify the event ID to wait for an event
+ * : u_int32 ul_mask Mask value to be logically ANDed with the event value
+ * : int32* pl_val Pointer to the area to store the pre-event value
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE Specified event does not exist
+ * : RET_ERROR
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SetandEvent(EventID event_id, u_int32 ul_mask, int32* pl_val) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if ((ul_index < MAX_PB_EVENTS) &&
+ (pl_val != NULL)) {
+ /* If the specified event ID value is within range */
+ p_event_open = p_inst->p_handle_table[ul_index];
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ ret_sts = SetProc(p_event_open, EVSET_AND, static_cast<int32>(ul_mask), pl_val);
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SetorEvent()
+ * ABSTRACT : Event value OR setting process
+ * NOTE : Set the logical OR result of the specified mask value and the event value of the specified event ID.
+ * ARGUMENT : EventID event_id Specify the event ID to wait for an event.
+ * : u_int32 ul_mask Mask value to be logically ANDed with the event value
+ * : int32* pl_val Pointer to the area to store the pre-event value
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE Specified event does not exist
+ * : RET_ERROR
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SetorEvent(EventID event_id, u_int32 ul_mask, int32* pl_val) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if ((ul_index < MAX_PB_EVENTS) &&
+ (pl_val != NULL)) {
+ /* If the specified event ID value is within range */
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ ret_sts = SetProc(p_event_open, EVSET_OR, static_cast<int32>(ul_mask), pl_val);
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Wait for the event
+ *
+ * Wait until the event value of the specified event ID reaches the specified range.
+ *
+ * @param[in] event_id Specify the event ID for which the event value is to be set.
+ * @param[in] l_wait_mode Monitoring mode of event * Current only SAPI_EVWAIT_VAL is allowed
+ * @param[in] l_min_val Minimum Event Wait
+ * @param[in] l_max_val Maximum value waiting for an event
+ * @param[in] *pl_event_val Pointer to the event value storage area after waiting for an event
+ * @param[in] ul_mill_sec_time Timeout period(ms)
+ *
+_ * @return RET_NORMAL Normal completion<br>
+ * RET_EV_NONE Specified event does not exist<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_WaitEvent(EventID event_id, int32 l_wait_mode, int32 l_min_val, // NOLINT(readability/nolint)
+ int32 l_max_val, int32* pl_event_val, u_int32 ul_mill_sec_time) { // NOLINT(readability/nolint)
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ WAITING_CONDITION st_condition = {0};
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if ((pl_event_val != NULL) &&
+ (ul_index < MAX_PB_EVENTS)) {
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ /* Set Wait Mode and Mask Value to Parameter Blk */
+ st_condition.us_mode = EVWAIT_VAL;
+ st_condition.l_min_val = l_min_val;
+ st_condition.l_max_val = l_max_val;
+
+ /* Call the event wait processing */
+ ret_sts = WaitProc(p_event_open, &st_condition, ul_mill_sec_time); // LCOV_EXCL_BR_LINE 200: no branch
+ if (ret_sts == RET_NORMAL) {
+ *pl_event_val = st_condition.l_last_val;
+ }
+ }
+ }
+
+ return ret_sts;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : WaitallclrEvent()
+ * ABSTRACT : Event Bit Clear Wait
+ * NOTE : Wait until all the bits specified by the mask value are cleared
+ * : for the event value of the specified event ID.
+ * ARGUMENT : EventID event_id Specifies the event ID to wait for an event.
+ * : u_int32 ul_mask Mask value waiting for an event (Bit pattern)
+ * : int32* pl_val Pointer to the event value storage area after waiting for an event
+ * : u_itn32 ul_mill_sec_time Timeout period(ms)
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE Specified event does not exist
+ * : RET_ERROR Maximum number of waiting threads exceeded
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+WaitallclrEvent(EventID event_id, u_int32 ul_mask, int32* pl_val, u_int32 ul_mill_sec_time) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ WAITING_CONDITION st_condition = {0};
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = static_cast<u_int32>(event_id) - 1;
+
+ /* Parameter check */
+ if ((pl_val != NULL) &&
+ (ul_index < MAX_PB_EVENTS)) {
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ /* Set Wait Mode and Mask Value to Parameter Blk */
+ st_condition.us_mode = EVWAIT_ALLCLR;
+ st_condition.ul_mask = ul_mask;
+
+ /* Call the event wait processing */
+ ret_sts = WaitProc(p_event_open, &st_condition, ul_mill_sec_time);
+ if (ret_sts == RET_NORMAL) {
+ *pl_val = st_condition.l_last_val;
+ }
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : WaitanysetEvent()
+ * ABSTRACT : Event Bit Set Waiting Process
+ * NOTE : Wait until one of the bits specified by the mask value is set
+ * : for the event value of the specified event ID.
+ * ARGUMENT : EventID event_id Specify the event ID to wait for an event.
+ * : u_int32 ul_mask Mask value waiting for an event
+ * : int32* ipVal Pointer to the event value storage area after waiting for an event
+ * : u_itn32 ul_mill_sec_time Timeout period(ms)
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE Specified event does not exist
+ * : RET_ERROR When the maximum number of waiting events is exceeded
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+WaitanysetEvent(EventID event_id, u_int32 ul_mask, int32* pl_val, u_int32 ul_mill_sec_time) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ WAITING_CONDITION st_condition = {0};
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if ((pl_val != NULL) &&
+ (ul_index < MAX_PB_EVENTS)) {
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ /* Set Wait Mode and Mask Value to Parameter Blk */
+ st_condition.us_mode = EVWAIT_ANYSET;
+ st_condition.ul_mask = ul_mask;
+
+ /* Call the event wait processing */
+ ret_sts = WaitProc(p_event_open, &st_condition, ul_mill_sec_time);
+ if (ret_sts == RET_NORMAL) {
+ *pl_val = st_condition.l_last_val;
+ }
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : LookupEvent()
+ * ABSTRACT : Event value reading process
+ * NOTE : Read the event value of the specified event ID.
+ * ARGUMENT : EventID event_id Specify the event ID to read the event value from.
+ * : int32 *iEventVal Pointer to the read event value storage area
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE Specified event does not exist
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+LookupEvent(EventID event_id, int32* pl_event_val) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ u_int32 ul_index = (u_int32)event_id - 1;
+ RET_API ret_sts = RET_EV_NONE;
+
+ /* Parameter check */
+ if ((pl_event_val != NULL) &&
+ (ul_index < MAX_PB_EVENTS)) {
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* When the specified event ID is already registered in the table */
+ if (p_event_open != NULL) {
+ EventLockMutex(p_event_open);
+ /* Store the current event value. */
+ *pl_event_val = static_cast<int32>(p_event_open->p_sys_event->l_event_val);
+ EventUnlockMutex(p_event_open);
+ ret_sts = RET_NORMAL;
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Delete the event
+ *
+ * Delete the event with the specified event ID.
+ *
+ * @param[in] event_id Specify the event ID for which the event value is to be set.
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_EV_NONE Specified event does not exist
+ */
+RET_API _pb_DeleteEvent(EventID event_id) { // NOLINT(readability/nolint)
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ RET_API ret_api = RET_EV_NONE;
+ u_int32 index = static_cast<u_int32>(event_id) - 1;
+ EV_ERR ev_err;
+ RET_API l_ret_api;
+
+ /* Parameter check */
+ if (index < MAX_PB_EVENTS) {
+ p_event_open = p_inst->p_handle_table[index];
+ /* When the specified event ID is registered in the table */
+ if (p_event_open != NULL) {
+ ret_api = RET_NORMAL;
+ }
+ }
+
+ /* Parameter normal */
+ if (ret_api == RET_NORMAL) {
+ l_ret_api = _pb_SemLock(p_inst->id_event_table_sem);
+ if (l_ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+
+ /* When no one references in the same process */
+ if ((p_event_open->l_thread_ref - 1) <= 0) {
+ /* Delete event flag */
+ ev_err = EV_destroy_flag(p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]);
+ /* When initialization fails */
+ if (ev_err == EV_OK) {
+ p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt] = 0;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "EV_destroy_flag ERROR!! [ev_err=%d, flag_id=0x%x]", \
+ ev_err, p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]);
+
+ ret_api = RET_ERROR;
+ }
+ }
+
+ /* When the event flag is deleted successfully */
+ if (ret_api == RET_NORMAL) {
+ /* Reduce the number of event references in the same process */
+ p_event_open->l_thread_ref--;
+
+ /* When no one references in the same process */
+ if (p_event_open->l_thread_ref <= 0) {
+ /* Reduce the number of event references in the system */
+ p_event_open->p_sys_event->l_process_ref--;
+ }
+
+ /* When no one references in the system */
+ if (p_event_open->p_sys_event->l_process_ref <= 0) {
+ /* Initialization of the target area */
+ FreeEventTable(p_inst->p_event_table, index);
+ }
+
+ /* If no one references in the same process, release the resource here */
+ if (p_event_open->l_thread_ref <= 0) {
+ /* Exclusive deletion for the target event */
+ EventDeleteMutex(p_event_open);
+
+ /* Open the heap area storing the target event. */
+ /* */
+ PbProcessHeapFree(0, p_inst->p_handle_table[index]);
+ p_inst->p_handle_table[index] = NULL;
+ }
+ }
+
+ _pb_SemUnlock(p_inst->id_event_table_sem);
+ }
+
+ return ret_api;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : ResetEvent()
+ * ABSTRACT : Event Clear
+ * NOTE : Specified event clear processing
+ * ARGUMENT : EventID event_id Event ID to reset
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+ResetEvent(EventID event_id) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if (ul_index < MAX_PB_EVENTS) {
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* When the specified event ID is already registered in the table */
+ if (p_event_open != NULL) {
+ EventLockMutex(p_event_open);
+
+ /* Clear the event value */
+ p_event_open->p_sys_event->l_event_val = p_event_open->p_sys_event->l_reset_data;
+
+ EventUnlockMutex(p_event_open);
+ ret_sts = RET_NORMAL;
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* Private functions. */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SetProc()
+ * ABSTRACT : General Event Configuration Processing
+ * NOTE : Sets the event according to the specified event setting method.
+ * ARGUMENT : PB_EVENT_OPEN_HANDLE* p_event_open Pointer to manage event waiting for the event TBL
+ * : int32 i_mode Event setting method
+ * : int32 iVal Event setting value
+ * : int32* ipVal Pointer to the area to store the pre-event value
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_ERROR
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static RET_API
+SetProc(PB_EVENT_OPEN_HANDLE* p_event_open, int32 i_mode, int32 l_val, int32* lpVal) {
+ RET_API ret_sts = RET_NORMAL;
+ int32 lTempEventData = 0;
+ int32 lTestValue = 0;
+ BOOL bCastCondFlag = FALSE;
+
+ EventLockMutex(p_event_open);
+
+ /* Get current event value */
+ lTempEventData = p_event_open->p_sys_event->l_event_val;
+ *lpVal = p_event_open->p_sys_event->l_event_val; /* Set the value before the event operation */
+
+ /* Switch Processing by event configuration mode */
+ switch (i_mode) { // LCOV_EXCL_BR_LINE 200:only the first two cases will be called
+ case EVSET_ABSOLUTE: /* In absolute mode */ {
+ /* Updating event values with specified values */
+ lTempEventData = l_val;
+ break;
+ }
+ case EVSET_RELATE: /* In relative setting mode */ {
+ lTestValue = lTempEventData + l_val;
+ /* Exceeding representable event value */
+ if ((l_val > 0) && (lTempEventData > lTestValue)) {
+ ret_sts = RET_EV_MAX;
+ }
+ /* Below representable event value */
+ if ((l_val < 0) && (lTempEventData < lTestValue)) {
+ ret_sts = RET_EV_MIN;
+ }
+ /* Normal range */
+ if (ret_sts == RET_NORMAL) {
+ /* Add specified value to event value */
+ lTempEventData += l_val;
+ }
+ break;
+ }
+ case EVSET_AND: { // LCOV_EXCL_BR_LINE 200: i_mode cannot be this value
+ // LCOV_EXCL_START 200: i_mode cannot be this value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lTempEventData &= ((u_int32)l_val); /* Logical AND of the event value and the specified value */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case EVSET_OR: { // LCOV_EXCL_BR_LINE 200: i_mode cannot be this value
+ // LCOV_EXCL_START 200: i_mode cannot be this value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lTempEventData |= ((u_int32)l_val); /* Logical AND of the event value and the specified value */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ default: /* Event setting mode error */ // LCOV_EXCL_BR_LINE 200: i_mode cannot be this value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_sts = RET_ERRPARAM; // LCOV_EXCL_LINE 200: i_mode cannot be this value
+ }
+
+ /* When the manual reset function is enabled */
+
+ if (ret_sts == RET_NORMAL) {
+ /* When the manual reset function is enabled */
+ if (p_event_open->p_sys_event->uc_manual_reset == _CWORD64_EVENT_MANUALRESET_ON) {
+ /* Set event value */
+ p_event_open->p_sys_event->l_event_val = lTempEventData;
+ }
+
+ /* Loop for the maximum number of waiting threads per event and check the condition of event wait processing of the state TBL. */
+ for (DWORD wcn = 0; wcn < MAX_PB_EVENT_WAIT_THREADS; wcn++) {
+ /* If the event wait flag is waiting, */
+ if (p_event_open->p_sys_event->st_condition[wcn].uc_waiting == TRUE) {
+ /* Check if event wait conditions are met */
+ BOOL bret = CheckCondition(p_event_open->p_sys_event, wcn, lTempEventData);
+ /* If the event wait conditions are met, */
+ if (bret == TRUE) {
+ bCastCondFlag = TRUE;
+ /* Save the event value at the time of SetEvent issuance (at the time of WaitEvent return). */
+ p_event_open->p_sys_event->st_condition[wcn].l_last_val = lTempEventData;
+
+ /* Processing to prevent concurrent SetEvent from more than one threads for a single event which is in WAIT state */
+ /* Set WAIT status to wait-canceled */
+ p_event_open->p_sys_event->st_condition[wcn].uc_waiting = FALSE;
+ /* Setting the default min value for event */
+ p_event_open->p_sys_event->st_condition[wcn].l_min_val = MIN_EVENT_VAL;
+ /* Setting the default max event */
+ p_event_open->p_sys_event->st_condition[wcn].l_max_val = MAX_EVENT_VAL;
+
+ /* Signal issuance */
+ (void)EventSendSignal(p_event_open, static_cast<int>(wcn));
+ }
+ }
+ }
+
+ /* When the manual reset function is disabled */
+ if (p_event_open->p_sys_event->uc_manual_reset != _CWORD64_EVENT_MANUALRESET_ON) {
+ /* If no one has issued the event */
+ if (bCastCondFlag == FALSE) {
+ /* Set event value */
+ p_event_open->p_sys_event->l_event_val = lTempEventData;
+ } else {
+ /* If issued event */
+ /* Reset event value */
+ p_event_open->p_sys_event->l_event_val = p_event_open->p_sys_event->l_reset_data;
+ }
+ }
+ }
+
+ EventUnlockMutex(p_event_open);
+
+ return ret_sts;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : WaitProc()
+ * ABSTRACT : Generic Event Wait Processing
+ * NOTE : Wait for an event according to the wait queue of the specified event.
+ * ARGUMENT : PB_EVENT_OPEN_HANDLE* p_event_open Pointer to TBL which is managed waiting for events
+ * : WAITING_CONDITION* st_condition Pointer to the event wait condition setting parameter
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_ERROR The maximum number of waits has been exceeded, or a parameter error has occurred.
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static RET_API
+WaitProc(PB_EVENT_OPEN_HANDLE* p_event_open, WAITING_CONDITION* st_condition, u_int32 ul_mill_sec_time) {
+ RET_API ret_sts = RET_ERROR;
+ u_int32 ul_wcn = 0;
+
+ /* Get semaphore for event table */
+ EventLockMutex(p_event_open);
+
+ /* Loop for the maximum number of waiting threads per event and retrieve free area of state TBL */
+ for (ul_wcn = 0; ul_wcn < MAX_PB_EVENT_WAIT_THREADS; ul_wcn++) {
+ if ((p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag == FALSE) && \
+ (p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting == FALSE)) {
+ /* For the unused state TBL */
+ /* If the event wait flag is released, */
+ /* finish searching when free area is found */
+ ret_sts = RET_NORMAL;
+ break;
+ }
+ }
+
+ /* If there is free space in the state TBL */
+ if (ret_sts == RET_NORMAL) {
+ /* Set wait rule for free space of state TBL */
+ /* Determine the wait rule */
+ switch (st_condition->us_mode) { // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ALLCLR and EVWAIT_ANYSET
+ case EVWAIT_VAL: /* For range waiting */
+ {
+ /* Set event monitoring mode */
+ p_event_open->p_sys_event->st_condition[ul_wcn].us_mode = st_condition->us_mode;
+ /* Set the minimum value for establishing an event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_min_val = st_condition->l_min_val;
+ /* Set the maximum value for establishing an event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_max_val = st_condition->l_max_val;
+ break;
+ }
+ case EVWAIT_ALLCLR: /* If waiting for the specified bit to be cleared */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ALLCLR
+ case EVWAIT_ANYSET: /* If waiting for the specified bit to be set */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ANYSET
+ {
+ // LCOV_EXCL_START 200: can not be EVWAIT_ANYSET and EVWAIT_ALLCLR
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Set event monitoring mode */
+ p_event_open->p_sys_event->st_condition[ul_wcn].us_mode = st_condition->us_mode;
+ /* Set event wait mask value */
+ p_event_open->p_sys_event->st_condition[ul_wcn].ul_mask = st_condition->ul_mask;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ default:
+ ret_sts = RET_ERROR;
+ }
+ }
+
+ /* When the specified mode is normal */
+ if (ret_sts == RET_NORMAL) {
+ /* Check if event wait conditions are met */
+ BOOL bret = CheckCondition(p_event_open->p_sys_event, ul_wcn, p_event_open->p_sys_event->l_event_val);
+
+ /* Target event received */
+ if (bret == TRUE) {
+ /* Set the received event value */
+ st_condition->l_last_val = p_event_open->p_sys_event->l_event_val;
+ /* Since it does not wait for an event, set the initial value to the state TBL. */
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting = FALSE;
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag = FALSE;
+ /* Set the default minimum value for the event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_min_val = MIN_EVENT_VAL;
+ /* Set the default maximum value for the event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_max_val = MAX_EVENT_VAL;
+
+ /* When the manual reset function is disabled */
+ if (p_event_open->p_sys_event->uc_manual_reset != _CWORD64_EVENT_MANUALRESET_ON) {
+ /* Initialize event values */
+ p_event_open->p_sys_event->l_event_val = p_event_open->p_sys_event->l_reset_data;
+ }
+ } else {
+ /* When no event is received */
+ /* Set event wait state in free area of state TBL */
+ /* Set event wait flag to waiting */
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting = TRUE;
+ /* Set table usage flag in use */
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag = TRUE;
+
+ /* Perform event wait */
+ ret_sts = EventWaitForSignal(p_event_open, ul_wcn, ul_mill_sec_time);
+ /* Set event wait flag to unused */
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting = FALSE;
+ /* Set table usage flag to unused */
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag = FALSE;
+ /* Set the default minimum value for the event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_min_val = MIN_EVENT_VAL;
+ /* Setting the default maximum value for the event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_max_val = MAX_EVENT_VAL;
+ /* Set event return value */
+ st_condition->l_last_val = p_event_open->p_sys_event->st_condition[ul_wcn].l_last_val;
+ }
+ }
+
+ /* Release semaphore for event table */
+ EventUnlockMutex(p_event_open);
+
+ return ret_sts;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FindEventTable()
+ * ABSTRACT : Event Table Search Processing
+ * NOTE : Search the event table for the specified event name and return the index number
+ * : of the event if it has been already registerd.
+ * ARGUMENT : PB_EVENT *p_event_table Pointer to the start of event table array in the shared memory
+ * : TCHAR *ptcEventName Event name to search
+ * : u_int32* puc_index storage area for the index number of the specified event table
+ * RETURN : BOOL FALSE No specified event
+ * : TRUE Specified Event Yes
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static BOOL
+FindEventTable(PB_EVENT* p_event_table, TCHAR* ptcEventName, u_int32* puc_index) {
+ u_int32 ul_index = 0;
+ BOOL bret = FALSE;
+
+ for (ul_index = 0; ul_index < MAX_PB_EVENTS; ul_index++) {
+ if (_tcscmp(p_event_table[ul_index].event_name, ptcEventName) == 0) {
+ /* Save target index */
+ *puc_index = ul_index;
+ bret = TRUE;
+ break;
+ }
+ }
+
+ return bret;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : AllocNewEventTable()
+ * ABSTRACT : Event table allocation processing
+ * NOTE : Search the event table pointed to from the beginning for an area in
+ * : which the event name is not registered, and returns its index number.
+ * : The event table structure is allocated as an array in shared memory.
+ * : One element of the array is the event table structure, and its index
+ * : plus one is used as the event ID.
+ * : Whether the event table structure is in use or unused is determined
+ * : by whether the event name is set or not.
+ * : Note: Since the Mutex part inside this function was deleted to
+ * : fix a bug caused by Mutex leak, use Mutex around this function from the
+ * : outside before using this function.
+ * ARGUMENT : PB_EVENT *p_event_table Start pointer of the event table array in shared memory
+ * : TCHAR *name Event name to reserve table Note: Currently unused.
+ * : HANDLE hMutex Mutex handle for event table Note: Currently unused.
+ * RETURN : DWORD other than -1 Index number of the allocted event table
+ * : -1 There is no free space in the event table.
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static BOOL
+AllocNewEventTable(PB_EVENT* p_event_table, u_int32* puc_index) {
+ u_int32 ul_index = 0;
+ BOOL bret = FALSE;
+
+ for (ul_index = 0; ul_index < MAX_PB_EVENTS; ul_index++) {
+ if (p_event_table[ul_index].event_name[0] == __TEXT('\0')) {
+ *puc_index = ul_index;
+ bret = TRUE;
+ break;
+ }
+ }
+
+ return bret;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FreeEventTable()
+ * ABSTRACT : Event table release processing
+ * NOTE : Initialize the event name and event value of the index number
+ * : of the specified event table to make them free.
+ * ARGUMENT : PB_EVENT *p_event_table Start pointer of the event table array in shared memory
+ * : int index Index number of the event table to release
+ * : HANDLE hMutex Mutex handle for event table
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void
+FreeEventTable(PB_EVENT* p_event_table, int index) {
+ p_event_table[index].event_name[0] = __TEXT('\0');
+ p_event_table[index].l_event_val = 0;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : CheckCondition()
+ * ABSTRACT : Event condition determination processing
+ * NOTE : Check whether the event value of the specified event table is
+ * : satisfied as an event wait condition.
+ * ARGUMENT : PB_EVENT *p_event_table Start pointer of the event table array in shared memory
+ * : DWORD wcn Index number of the event table to be checked
+ * RETURN : BOOL TRUE Condition satisfied
+ * : FALSE Condition not met
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static BOOL CheckCondition(PB_EVENT* p_sys_event, DWORD wcn, int32 l_event_data) {
+ BOOL bret = FALSE;
+
+ if (p_sys_event != NULL) { // LCOV_EXCL_BR_LINE 6: p_sys_event can not be NULL
+ /* Determine the wait mode of the event state TBL. */
+ switch (p_sys_event->st_condition[wcn].us_mode) { // LCOV_EXCL_BR_LINE 200: EVWAIT_ALLCLR and EVWAIT_ANYSET will not be called // NOLINT(whitespace/line_length)
+ case EVWAIT_VAL: /* For value range wait */
+ {
+ /* Check whether the event value is within the condition satisfied range */
+ if ((l_event_data >= p_sys_event->st_condition[wcn].l_min_val) &&
+ (l_event_data <= p_sys_event->st_condition[wcn].l_max_val)) {
+ bret = TRUE;
+ }
+ break;
+ }
+ case EVWAIT_ALLCLR: /* When waiting for all specified bits to be cleared */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ALLCLR // NOLINT(whitespace/line_length)
+ {
+ // LCOV_EXCL_START 200: can not be EVWAIT_ALLCLR
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if ((((u_int32)l_event_data) & p_sys_event->st_condition[wcn].ul_mask) == EVENT_BIT_ZERO) {
+ bret = TRUE;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case EVWAIT_ANYSET: /* If the specified bit is waiting to set any bits */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ANYSET // NOLINT(whitespace/line_length)
+ {
+ // LCOV_EXCL_START 200: can not be EVWAIT_ALLCLR
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if ((((u_int32)l_event_data) & p_sys_event->st_condition[wcn].ul_mask) != EVENT_BIT_ZERO) {
+ bret = TRUE;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ default: /* If the wait mode is out of range, */
+ break; /* return with error */
+ }
+ }
+
+ return bret;
+}
+
+/**
+ * @brief
+ * Event generation processing
+ *
+ * @param[in] u_int8 uc_manual_reset
+ * @param[in] int32 l_init_data
+ * @param[in] char *cp_event_name Pointer to the names of event to be generated (NULL termination string)
+ * @return EventID Non-zero Event ID created<br>
+ * 0 Event generation error
+ */
+static EventID EventCreateNewEventInSystem(u_int8 uc_manual_reset, int32 l_init_data, TCHAR* p_event_name) {
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ PB_EVENT *p_sys_event = NULL;
+ EventID ret_event_id = 0;
+ u_int32 ul_index = 0;
+ BOOL bret = FALSE;
+ EV_ERR ev_err;
+
+ /* Parameter check */
+ if (p_event_name != NULL) { // LCOV_EXCL_BR_LINE 6: p_event_name can not be NULL
+ /* Parameter normal */
+ /* Get the index number of the newly created event table */
+ bret = AllocNewEventTable(p_inst->p_event_table, &ul_index);
+
+ /* When there is no free space */
+ if (bret == FALSE) {
+ /* Error log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:_pb_CreateEvent : AllocNewEventTable Full... \r\n");
+ }
+ }
+
+ /* When there is free space */
+ if (bret != FALSE) {
+ /* allocate event table to generate from heap */
+ /* */
+ p_event_open = reinterpret_cast<PB_EVENT_OPEN_HANDLE*>(PbProcessHeapAlloc(0, sizeof(PB_EVENT_OPEN_HANDLE))); // LCOV_EXCL_BR_LINE 200: can not be NULL // NOLINT(whitespace/line_length)
+
+ /* Failure in allocating heap area */
+ if (p_event_open == NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ // LCOV_EXCL_START 200: can not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ bret = FALSE;
+ /* Error log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:_pb_CreateEvent : CreateHeap ... GetAddr[0x%08x], size[%ld] \r\n",
+ p_event_open, sizeof(PB_EVENT_OPEN_HANDLE));
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ /* When the heap area can be allocated */
+ if (bret != FALSE) {
+ /* Initialization of generated event management information */
+ p_event_open->index = ul_index;
+ p_event_open->p_sys_event = &p_inst->p_event_table[ul_index];
+ p_event_open->l_thread_ref = 1;
+
+ /* Initialization processing of event information storage area */
+ p_sys_event = p_event_open->p_sys_event;
+ _tcscpy(p_sys_event->event_name, p_event_name); /* Event name registration */
+ p_sys_event->l_event_val = l_init_data; /* Default setting */
+ for (u_int32 ul_wcn = 0; ul_wcn < MAX_PB_EVENT_WAIT_THREADS; ul_wcn++) {
+ p_sys_event->st_condition[ul_wcn].uc_use_flag = FALSE;
+ p_sys_event->st_condition[ul_wcn].uc_waiting = FALSE;
+ p_sys_event->st_condition[ul_wcn].us_mode = 0;
+ p_sys_event->st_condition[ul_wcn].l_min_val = MIN_EVENT_VAL;
+ p_sys_event->st_condition[ul_wcn].l_max_val = MAX_EVENT_VAL;
+
+ /* Create Event Flag */
+ ev_err = EV_create_flag_auto_id(&(p_sys_event->st_condition[0].flag_id[g_my_proc_cnt])); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+ if (ev_err != EV_OK) /* When initialization fails */ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "EV_create_flag_auto_id ERROR!! [ev_err=%d, flag_id=0x%x", \
+ ev_err, p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]);
+
+ /* Release heap space */
+ PbProcessHeapFree(0, p_event_open); // LCOV_EXCL_BR_LINE 200: no branch
+
+ ret_event_id = 0;
+ bret = FALSE;
+ }
+ }
+
+ if (bret != FALSE) {
+ p_sys_event->l_process_ref = 1; /* Set the number of references to this event. */
+ p_sys_event->l_reset_data = l_init_data; /* Default setting */
+ p_sys_event->uc_manual_reset = uc_manual_reset; /* Setting for a manual reset */
+
+ /* Create an event table Mutex and set it in the event table. */
+ bret = EventCreateMutex(p_event_open);
+ /* If generating fails, reset is executed. */
+ if (bret == FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n", LTEXT(__FILE__), __LINE__); \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CreateMutex Err ... Event Name[%s]\r\n", p_event_name);
+ _pb_Exit();
+ }
+
+ /* Register event table with event instance */
+ p_inst->p_handle_table[ul_index] = p_event_open;
+ ret_event_id = ul_index + 1;
+ }
+ }
+
+ return ret_event_id;
+}
+
+/**
+ * @brief
+ * Event generation processing
+ *
+ * @param[in] char *cpEventName Pointer to name of the event to be generated (NULL termination string)
+ * @return EventID Non-zero Event ID created<br>
+ * 0 Event generation error
+ */
+static EventID EventCreateNewEventInProcess(u_int32 index) {
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ EventID ret_event_id = 0;
+ EV_ERR ev_err;
+
+ /* Already created in the same process */
+ if (p_inst->p_handle_table[index] != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ /* When the number of event references in the same process is less than the upper limit */
+ if (p_inst->p_handle_table[index]->l_thread_ref < _CWORD64_EVENT_MAXOPEN_IN_PROCESS) {
+ /* Increase the number of thread references */
+ (p_inst->p_handle_table[index]->l_thread_ref)++;
+ ret_event_id = index + 1;
+ } else {
+ /* When the number of event references in the same process is the upper limit */
+ /* Error log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_CreateEvent Err ... Event Max In Process : EventName[%s]\r\n",
+ p_inst->p_handle_table[index]->p_sys_event->event_name);
+ }
+ } else {
+ /* Creating for the first time in the process */
+ /* Checking the upper limit of the reference count of the same event in the system */
+ if (p_inst->p_event_table[index].l_process_ref < _CWORD64_EVENT_MAXOPEN_IN_SYSTEM) {
+ /* Allocate event table to generate from heap */
+ /* */
+ p_event_open = reinterpret_cast<PB_EVENT_OPEN_HANDLE*>(PbProcessHeapAlloc(0, \
+ sizeof(PB_EVENT_OPEN_HANDLE)));
+
+ /* Failure in allocating heap area */
+ if (p_event_open == NULL) {
+ /* Error log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "_CWORD64_api.dll:_pb_CreateEvent : CreateHeap ... GetAddr[0x%08x], size[%ld] \r\n", \
+ p_event_open, sizeof(PB_EVENT_OPEN_HANDLE));
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_CreateEvent Err ... Event Max In sYSTEM : EventName[%s]\r\n",
+ p_inst->p_handle_table[index]->p_sys_event->event_name);
+ }
+
+ /* When heap allocation is successful */
+ if (p_event_open != NULL) {
+ /* When it is not created in the same process, set each data. */
+ /* Set the index to which the event name is registered */
+ p_event_open->index = index;
+ /* Initialize the reference count of the threads referencing this event in the same process. */
+ p_event_open->l_thread_ref = 1;
+ /* Set event instance start address */
+ p_event_open->p_sys_event = &p_inst->p_event_table[index];
+ /* Add the reference count of the process referencing this event in the system. */
+ p_event_open->p_sys_event->l_process_ref++;
+
+ /* Create an event flag */
+ ev_err = EV_create_flag_auto_id(&(p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]));
+ if (ev_err != EV_OK) /* When initialization fails */ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "EV_create_flag_auto_id ERROR!! [ev_err=%d, flag_id=0x%x]",
+ ev_err, p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]);
+
+ /* Release heap space */
+ PbProcessHeapFree(0, p_event_open);
+
+ ret_event_id = 0;
+ } else {
+ /* Even if event information already exists in the system, the Mutex is created for each process. */
+ (void)_pb_CreateMutex(NULL, FALSE, p_event_open->p_sys_event->name_of_mutex);
+
+ p_inst->p_handle_table[index] = p_event_open; /* Register event tables with event instance */
+ ret_event_id = index + 1;
+ }
+ }
+ }
+
+ return ret_event_id;
+}
+
+/**
+ * @brief
+ * Send the signal
+ *
+ * Sends the specified event signal.
+ *
+ * - Sending signals in the CLS event library
+ *
+ * @param[in] PB_EVENT_OPEN_HANDLE *p_evet_open_handle
+ * @param[in] u_int32 ul_index
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR Other errors
+ */
+static RET_API EventSendSignal(PB_EVENT_OPEN_HANDLE *p_evet_open_handle, u_int32 ul_index) {
+ RET_API ret_api = RET_NORMAL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ EV_ERR ev_err;
+ int32 i;
+ BOOL errFlag = TRUE;
+
+ if ((p_evet_open_handle != NULL) &&
+ (ul_index < MAX_PB_EVENT_WAIT_THREADS)) {
+ for (i = 0; i <= p_inst->p_event_table->proc_cnt; i++) {
+ /* Signal issuance */
+ if (p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[i] != 0) {
+ ev_err = EV_set_flag(p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[i], 1);
+ if (ev_err == EV_OK) {
+ errFlag = FALSE;
+ }
+ }
+ }
+ }
+
+ if (errFlag == TRUE) /* Event issuance NG */ {
+ ret_api = RET_ERROR;
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Wait for the signal
+ *
+ * Wait until the specified signal is received. Timeout can be specified (ms).
+ * When this API is called, the semaphore for the event element must be acquired.
+ *
+ * Receive a signal in the CLS event library.
+ *
+ * @param[in] *p_evet_open_handle
+ * @param[in] ul_index
+ * @param[in] ul_mill_sec_time
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRTIMEOUT Timeout End<br>
+ * RET_ERROR Other errors
+ */
+static RET_API EventWaitForSignal(PB_EVENT_OPEN_HANDLE *p_evet_open_handle, u_int32 ul_index, \
+ u_int32 ul_mill_sec_time) {
+ RET_API ret_api = RET_ERRTIMEOUT;
+ EV_ERR ev_err;
+ EV_Flag ev_flag;
+ u_int32 timeOutCnt = 0;
+
+ /* Parameter check */
+ if ((p_evet_open_handle != NULL) && (ul_index < MAX_PB_EVENT_WAIT_THREADS)) { // LCOV_EXCL_BR_LINE 6: param can not be invalid // NOLINT(whitespace/line_length)
+ /* Release semaphore for event table */
+ EventUnlockMutex(p_evet_open_handle); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Distribute processing by timeout period */
+ /* To check the event occurrence status */
+ if (ul_mill_sec_time == 0) {
+ /* Untreated */
+ } else if (ul_mill_sec_time == INFINITE) {
+ /* Without timeout */
+ ret_api = RET_NORMAL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "EV_wait_flag CALL [flag_id=0x%x]",
+ p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt]);
+
+ /* Wait for event flag */
+ ev_err = EV_wait_flag(p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt], \
+ &ev_flag); // LCOV_EXCL_BR_LINE 200: no branch
+ if (ev_err != EV_OK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "EV_wait_flag ERROR!! [ev_err=%d]", ev_err);
+ ret_api = RET_ERROR;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \
+ "EV_wait_flag RETURN [ev_err=%d]", ev_err);
+ }
+ } else {
+ /* When the timeout period is specified */
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "EV_get_flag CALL [flag_id=0x%x]",
+ p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt]);
+
+ while (1) {
+ /* Get elag event */
+ ev_err = EV_get_flag(p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt], \
+ &ev_flag); // LCOV_EXCL_BR_LINE 200: no branch
+ if (ev_err == EV_OK) {
+ if (ev_flag.flagID == EV_NO_ID) {
+ timeOutCnt++;
+ if (timeOutCnt <= ul_mill_sec_time) {
+ usleep(1000); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ break; /* Timeout error */
+ }
+ } else {
+ ret_api = RET_NORMAL;
+ break;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "EV_get_flag ERROR!! [ev_err=%d]", ev_err);
+ ret_api = RET_ERROR;
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "EV_get_flag BREAK [ret_api=%d]", ret_api);
+ }
+
+ /* Get event table semaphore */
+ EventLockMutex(p_evet_open_handle); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ /* Parameter error */
+ ret_api = RET_ERROR;
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Create the mutex for event
+ *
+ * @param[in] *p_evet_open_handle
+ *
+ * @return TRUE Normal completion<br>
+ * FALSE ABENDs
+ */
+static BOOL EventCreateMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) {
+ static u_int8 idx = 0;
+ uint32_t ulPid; /* Process ID */
+ BOOL bret = FALSE;
+ TCHAR name[NAME_MAX];
+ HANDLE handle;
+
+ /* Parameter check */
+ if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL
+ ulPid = (uint32_t)getpid();
+
+ wsprintf(name, __TEXT("POS_BASE_EVENT_MUTEX%05d_p%d"), idx, ulPid);
+
+ /****************************************/
+ /* Create Mutex */
+ /****************************************/
+ handle = _pb_CreateMutex(NULL, FALSE, name);
+ if (handle != NULL) {
+ _tcscpy(p_evet_open_handle->p_sys_event->name_of_mutex, name);
+ idx++;
+ bret = TRUE;
+ }
+ }
+
+ /* When mutex processing fails */
+ if (bret != TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "bret ERROR [bret:%d]", bret);
+ }
+
+ return bret;
+}
+
+/**
+ * @brief
+ * Lock the mutex for event
+ *
+ * @param[in] *p_evet_open_handle
+ */
+static void EventLockMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) {
+ DWORD lret = WAIT_FAILED;
+ HANDLE handle;
+
+ if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL
+ /* Get handle from Mutex name */
+ handle = _pb_CreateMutex(NULL, FALSE, p_evet_open_handle->p_sys_event->name_of_mutex);
+
+ /****************************************/
+ /* Get Mutex */
+ /****************************************/
+ lret = PbMutexLock(handle, INFINITE);
+
+ /* Cancel by deleting the generated portion when a handle was acquired */
+ (void)PbDeleteMutex(handle);
+ }
+
+ /* When mutex processing fails */
+ if (lret != WAIT_OBJECT_0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lret ERROR [lret:%lu]", lret);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Unlock the mutex for event
+ *
+ * @param[in] *p_evet_open_handle
+ */
+static void EventUnlockMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) {
+ BOOL bret = FALSE;
+ HANDLE handle;
+
+ if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL
+ /* Get handle from Mutex name */
+ handle = _pb_CreateMutex(NULL, FALSE, p_evet_open_handle->p_sys_event->name_of_mutex);
+
+ /****************************************/
+ /* Release Mutex */
+ /****************************************/
+ bret = PbMutexUnlock(handle);
+
+ /* Cancel by deleting the generated portion when a handle was acquired */
+ (void)PbDeleteMutex(handle);
+ }
+
+ /* When mutex processing fails */
+ if (bret != TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "bret ERROR [bret:%d]", bret);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * delete the mutex for event
+ *
+ * @param[in] *p_evet_open_handle
+ */
+static void EventDeleteMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) {
+ RET_API ret_api = RET_ERROR;
+ HANDLE handle;
+
+ if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL
+ /* Get handle from Mutex name */
+ handle = _pb_CreateMutex(NULL, FALSE, p_evet_open_handle->p_sys_event->name_of_mutex);
+
+ /****************************************/
+ /* Delete Mutex */
+ /****************************************/
+ ret_api = static_cast<RET_API>(PbDeleteMutex(handle)); /* Coverity CID:18817 Comment Managed */
+
+ /* Cancel by deleting the generated portion when a handle was acquired */
+ (void)PbDeleteMutex(handle);
+ }
+
+ /* When mutex processing fails */
+ if (ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ret_api ERROR [ret_api:%d]", ret_api);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get dump information
+ *
+ * @param[out] p_buf Dump info
+ * @param[in/out] p_len Buffer size
+ */
+void _pb_GetDebugEventMngTbl(void* p_buf, uint8_t* p_len) {
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufHdlTbl[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufSysEvt[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_tmp[DEBUG_DUMP_MAX_SIZE];
+ uint8_t buf_indent[16];
+ uint32_t i;
+ PB_EVENT_OPEN_HANDLE* p_hdl_tbl;
+ uint8_t cnt = 0;
+
+ if ((p_buf != NULL) && (p_len != NULL)) {
+ memset(&buf[0], 0x00, sizeof(buf));
+ memset(&bufSysEvt, 0x00, sizeof(bufSysEvt));
+ snprintf(reinterpret_cast<char *>(&buf_indent[0]), sizeof(buf_indent), " ");
+ GetDebugEventMngTblSysEvent(&bufSysEvt[0], p_inst->p_event_table, &buf_indent[0]); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Event-1\n ShrMem:%p\n idEvt:%d\n Evt:\n%s",
+ p_inst->h_shared_memory,
+ p_inst->id_event_table_sem,
+ &bufSysEvt[0]);
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ p_buf = reinterpret_cast<void *>((reinterpret_cast<uint8_t *>(p_buf)) + sizeof(buf));
+ cnt++;
+ if (cnt < *p_len) {
+ memset(&bufHdlTbl[0], 0x00, sizeof(bufHdlTbl));
+ for (i = 0; i < MAX_PB_EVENTS; i++) {
+ // p_handle_table
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ p_hdl_tbl = p_inst->p_handle_table[i];
+ if (p_hdl_tbl == NULL) {
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%d] NULL",
+ i);
+ } else {
+ memset(&bufSysEvt[0], 0x00, sizeof(bufSysEvt));
+ snprintf(reinterpret_cast<char *>(&buf_indent[0]), sizeof(buf_indent), " ");
+ GetDebugEventMngTblSysEvent(&bufSysEvt[0], p_hdl_tbl->p_sys_event, &buf_indent[0]);
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%d]\n h_heap:%p, index:%lu, l_thread_ref:%d\n p_sys_event:\n%s",
+ i,
+ p_hdl_tbl->h_heap,
+ p_hdl_tbl->index,
+ p_hdl_tbl->l_thread_ref,
+ &bufSysEvt[0]);
+ }
+ strncat(reinterpret_cast<char *>(&bufHdlTbl[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ if (((i + 1) % 4) == 0) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Event-%d\n Handle:%s",
+ cnt,
+ &bufHdlTbl[0]);
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ p_buf = reinterpret_cast<void *>((reinterpret_cast<uint8_t *>(p_buf)) + sizeof(buf));
+ memset(&bufHdlTbl[0], 0x00, sizeof(bufHdlTbl));
+ if (cnt >= *p_len) {
+ break;
+ }
+ }
+ }
+ }
+ if (cnt < *p_len) {
+ if (bufHdlTbl[0] != 0x00) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Event-%d\n Handle:%s",
+ cnt,
+ &bufHdlTbl[0]);
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ }
+ *p_len = cnt;
+ }
+ }
+}
+
+/**
+ * @brief
+ * Get dump information(PB_EVENT)
+ *
+ * @param[out] p_buf Dump info
+ * @param[in] pEvt PB_EVENT
+ * @param[in] pIndent Indenting
+ */
+void GetDebugEventMngTblSysEvent(void* p_buf, PB_EVENT* pEvt, uint8_t* pIndent) {
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_condition[1024];
+ static uint8_t buf_flag_id[512];
+ static uint8_t buf_tmp[DEBUG_DUMP_MAX_SIZE];
+ uint32_t i;
+ uint32_t e;
+
+ if ((p_buf != NULL) && (pEvt != NULL)) { // LCOV_EXCL_BR_LINE 6: p_buf and pEvt can not be NULL
+ memset(&buf, 0x00, sizeof(buf));
+ memset(&buf_condition, 0x00, sizeof(buf_condition));
+ snprintf(reinterpret_cast<char *>(&(buf_condition)), sizeof(buf_condition), "stCnd:");
+ for (i = 0; i < MAX_PB_EVENT_WAIT_THREADS; i++) {
+ memset(&buf_flag_id, 0x00, sizeof(buf_flag_id));
+ for (e = 0; e < MAX_EVENT_PROC_NUM; e++) {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "[%d]0x%08x ", e, pEvt->st_condition[i].flag_id[e]);
+ strncat(reinterpret_cast<char *>(&buf_flag_id[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ }
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s [%d] UseFlg:%d, Wait:%d, Mode:%d, Mask:%d, Min:%d, Max:%d, Last:%d, flag:%s",
+ pIndent,
+ i,
+ pEvt->st_condition[i].uc_use_flag,
+ pEvt->st_condition[i].uc_waiting,
+ pEvt->st_condition[i].us_mode,
+ pEvt->st_condition[i].ul_mask,
+ pEvt->st_condition[i].l_min_val,
+ pEvt->st_condition[i].l_max_val,
+ pEvt->st_condition[i].l_last_val,
+ &buf_flag_id[0]);
+ strncat(reinterpret_cast<char *>(&buf_condition[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ }
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "%s EvtName:%s",
+ pIndent,
+ pEvt->event_name);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s EvtVal:%d",
+ pIndent,
+ pEvt->l_event_val);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s %s",
+ pIndent,
+ &buf_condition[0]);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s ProcRef:%d",
+ pIndent,
+ pEvt->l_process_ref);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s ResetData:%d",
+ pIndent,
+ pEvt->l_reset_data);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s ManualReset:%d",
+ pIndent,
+ pEvt->uc_manual_reset);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s name_of_mutex:%s",
+ pIndent,
+ pEvt->name_of_mutex);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ }
+}
diff --git a/vehicleservice/positioning_base_library/library/src/_pbFsys.cpp b/vehicleservice/positioning_base_library/library/src/_pbFsys.cpp
new file mode 100755
index 0000000..ee132b0
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbFsys.cpp
@@ -0,0 +1,171 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbFsys.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System common functions
+ Title : System API file access control related processes
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+
+/*
+ Constants and structure definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define ALLOC_SIZE 0x00200000
+#define MAX_MUTEX_NAME_LEN 32
+
+/* Flag structure for file system protection */
+typedef struct {
+ u_int8 file_write_flag;
+ u_int8 dummy1;
+ u_int8 recover_flag;
+ u_int8 dummy2;
+} FSYS_FLAG_STRUCT;
+
+/* File system protection flag area control table */
+typedef struct {
+ TCHAR mtx_name[MAX_MUTEX_NAME_LEN]; /* Mutex name */
+ HANDLE h_mutex; /* Mutex handles */
+} FSYS_GLOBAL;
+
+/*
+ Global Variable Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+FSYS_FLAG_STRUCT *g_fsys_flag_top_addr;
+
+/*
+ External function prototype declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef __cplusplus
+extern "C" {
+#endif
+ BOOL VirtualCopy(LPVOID lpv_dest, LPVOID lpv_src, DWORD cb_size, DWORD fdw_protect);
+#ifdef __cplusplus
+}
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FileSystemCheckInit
+ * ABSTRACT : File system protection flag area and setting value initialization processing
+ * NOTE : Allocate a flag area for protecting the file system, create a Mutex
+ * : for locking the area, and initialize the flags as follows.
+ * : File access flag :File Access Permission State
+ * : FlashFS recovery status flag :FlashFS access-prohibited status
+ * ARGUMENT : None
+ * RETURN : RET_API define
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+FileSystemCheckInit(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FileSystemCheckTerm
+ * ABSTRACT : File system protection flag area release processing
+ * NOTE :
+ * ARGUMENT : None
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+FileSystemCheckTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SetFileAccessFlag
+ * ABSTRACT : File access flag setting process
+ * NOTE : Sets the write access state in the file access flag.Parameter
+ * : Set "Write prohibited state" at the time of parameter error.
+ * ARGUMENT : u_int8 status : File access flag setting value
+ * WRITE_FLAG_OFF : Write prohibited state to file
+ * WRITE_FLAG_ON : Write permission status for the file
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+SetFileAccessFlag(u_int8 status) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetFileAccessFlag
+ * ABSTRACT : File access flag acquisition processing
+ * NOTE : Gets the write access status to a file from the file access flag
+ * ARGUMENT : u_int8 *status Pointer for storing access status
+ * RETURN : RET_NORMAL Normal completion Note : Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+GetFileAccessFlag(u_int8 *status) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *status = WRITE_FLAG_ON;
+ return (RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SetFFSRecoverFlag
+ * ABSTRACT : FLASH file system recovery processing status setting processing
+ * NOTE : Sets the status of FLASH file system recovery
+ * ARGUMENT : u_int8 status : FLASH file system recovery process status setting
+ * RECOVER_OFF : Access authorization state
+ * RECOVER_ON : Access prohibited status during recovery processing
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+SetFFSRecoverFlag(u_int8 status) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetFFSRecoverFlag
+ * ABSTRACT : FLASH file system recovery processing status acquisition processing
+ * NOTE : Gets the status of FLASH file system recovery
+ * ARGUMENT : u_int8 *status Pointer for storing recovery processing status
+ * RETURN : RET_API define
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+GetFFSRecoverFlag(u_int8 *status) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetFSAccessSts
+ * ABSTRACT : File system access status acquisition processing
+ * NOTE : Gets the access status to the file system
+ * ARGUMENT : u_int8 *status Pointer for storing the file system access status
+ * RETURN : RET_API define
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+GetFSAccessSts(u_int8 *status) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *status = FSNOACCESS;
+
+ return (RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* End _pbFsys.cpp */
diff --git a/vehicleservice/positioning_base_library/library/src/_pbMem.cpp b/vehicleservice/positioning_base_library/library/src/_pbMem.cpp
new file mode 100755
index 0000000..4028ae3
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbMem.cpp
@@ -0,0 +1,989 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbMem.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System common functions
+ Title : System API
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "tchar.h"
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+
+/*
+ Constants and data type definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define MAX_AREA_NAME_LEN 32
+#define MAX_FILENAME_LEN 32
+#define _CWORD64__MEM_MUTEX_NAME __TEXT("POS_BASE_MEM_MUTEX")
+#define MAX_ROMFILENAME_LEN (32-4) /* To the name appended with "_rom" at the time of registration */
+#define PHYADDR_MAX 0x9FFFFFFF /* Physical address of the boundary divided by 256 */
+#define ROM_DATA_SIZE 0x00400000 /* Size of the virtual ROM data area(4MB) */
+#define ALLOC_SIZE 0x00200000 /* 2MB (Minimum VirtualAlloc allocation of shared memory, */
+/* which is less than 2MB, is not mapped to shared memory) */
+#define OFFSET_SIZE 0x00001000 /* 4KB (VirtualCopy Addressing Units) */
+
+ /* Memory map information */
+typedef struct TagMemMapItem {
+ HANDLE h_heap; /* Handle of heap. */
+ struct TagMemMapItem* p_next; /* Pointers to the next Chain memory map table */
+ struct TagMemMapItem* p_prev; /* Pointers to the previous Chain memory map table */
+ DWORD address;
+ TCHAR name[MAX_AREA_NAME_LEN]; /* Name of shared data area(Not used when permit is processed) */
+ HANDLE h_shared_mem; /* Shared memory handle */
+} MEMMAP_ITEM;
+
+/* Memory map information management table */
+typedef struct {
+ HANDLE h_heap; /* Heap handle of the invoking table */
+ MEMMAP_ITEM* p_head; /* Pointer to the first memory map information */
+ MEMMAP_ITEM* p_tail; /* Pointer to the terminating memory map information */
+ DWORD num_of_items; /* Chain memory map data */
+ HANDLE h_mutex; /* _CWORD64__MEM_MUTEX Exclusive Mutex handles */
+} MEMMAP_LIST;
+
+typedef struct {
+ DWORD mem_size;
+ DWORD reserv[3];
+} _CWORD64_SHMHDR;
+
+/* LINK ROM data top address/size storage ROM data */
+typedef struct {
+ u_int32 *link_rom_addr; /* ROM data start address */
+ u_int32 link_size; /* ROM data size */
+} LINK_ROM;
+
+/*
+ Internal function prototype declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void UnlinkFromMemMapList(MEMMAP_ITEM* p_item);
+static void LinkToMemMapList(MEMMAP_ITEM* p_item);
+static MEMMAP_ITEM* FindMemMapItemByName(TCHAR* name);
+
+/*
+ Global variable
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+MEMMAP_LIST* g_p_mem_map_list;
+
+/**
+ * @brief
+ * Memory API initialization
+ *
+ * @param[in] none
+ *
+ * @return RET_API RET_NORMAL Normal completion<br>
+ * RET_ERROR ABENDs
+ */
+
+RET_API MemoryInit(void) {
+ RET_API ret_api = RET_NORMAL;
+ TCHAR name[] = _CWORD64__MEM_MUTEX_NAME;
+
+ // LCOV_EXCL_BR_START 5: standard lib error
+ g_p_mem_map_list = reinterpret_cast<MEMMAP_LIST *>(PbProcessHeapAlloc(0, sizeof(MEMMAP_ITEM)));
+ // LCOV_EXCL_BR_STOP
+ if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 5: standard lib error
+ } else {
+ /* Initialization of memory map information management table */
+ g_p_mem_map_list->h_heap = NULL;
+ g_p_mem_map_list->p_head = NULL;
+ g_p_mem_map_list->p_tail = NULL;
+ g_p_mem_map_list->num_of_items = 0;
+
+ /* Create Mutex */
+ g_p_mem_map_list->h_mutex = _pb_CreateMutex(NULL, TRUE, name); // LCOV_EXCL_BR_LINE 200: no branch
+ if (g_p_mem_map_list->h_mutex == NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ // LCOV_EXCL_START 200:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR [name:%s]", name);
+ _pb_Exit(); /* System recovery processing(Exception execution) */
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ return ret_api;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : MemoryTerm
+ * ABSTRACT : Memory API termination processing
+ * NOTE : This function frees each allocated object.
+ * : This function must be called only once by DllMain() at process termination.
+ * ARGUMENT : None
+ * RETURN : Return RET_NORMAL
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+MemoryTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+
+ if (g_p_mem_map_list == NULL) {
+ ret_api = RET_ERROR;
+ } else {
+ /* Lock Mutex */
+ PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE);
+
+ while (g_p_mem_map_list->num_of_items > 0) {
+ MEMMAP_ITEM* p_item = g_p_mem_map_list->p_head;
+ if (g_p_mem_map_list->num_of_items == 1) {
+ /* Delete last one of memory map list */
+ g_p_mem_map_list->p_head = NULL;
+ g_p_mem_map_list->p_tail = NULL;
+ g_p_mem_map_list->num_of_items = 0;
+ } else {
+ /* Deletes the beginning of the memory map list, with the next at the beginning. */
+ g_p_mem_map_list->p_head = g_p_mem_map_list->p_head->p_next;
+ g_p_mem_map_list->p_head->p_prev = NULL;
+ g_p_mem_map_list->num_of_items--;
+ }
+
+ /* Releases the real memory specified in the memory map list. */
+ if (p_item != NULL) {
+ PbProcessHeapFree(0, p_item);
+ p_item = NULL;
+ }
+ }
+
+ /* Release Mutex */
+ PbMutexUnlock(g_p_mem_map_list->h_mutex);
+
+ /* Delete Mutex */
+ PbDeleteMutex(g_p_mem_map_list->h_mutex);
+
+ /* Free MEMMAP_LIST structure */
+ PbProcessHeapFree(0, g_p_mem_map_list);
+ g_p_mem_map_list = NULL;
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Allocate Process Heap
+ *
+ * Allocates a memory block from the process heap
+ *
+ * @param[in] DWORD dw_flags Heap allocation scheme
+ * @param[in] SIZE_T dw_bytes Number of bytes to allocate
+ *
+ * @return LPVOID Except NULL Pointer to the allocated memory block
+ * NULL Assignment Failed
+ */
+LPVOID PbProcessHeapAlloc(DWORD dw_flags, SIZE_T dw_bytes) {
+ LPVOID pv_ret = NULL;
+
+ if ((dw_flags & HEAP_ZERO_MEMORY) == 0) { // LCOV_EXCL_BR_LINE 200: dw_flags cannot have bit HEAP_ZERO_MEMORY
+ /* Zero initialization not specified */
+ pv_ret = malloc(dw_bytes);
+ } else {
+ /* Zero initialization specified */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ pv_ret = calloc(dw_bytes, sizeof(char)); // LCOV_EXCL_LINE 200: dw_flags cannot have bit HEAP_ZERO_MEMORY
+ }
+
+ return pv_ret;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PrivateHeapAlloc
+ * ABSTRACT : Allocate a block of memory from the private heap
+ * NOTE : Because there is no private-heap notion in PosixBasedOS001,
+ * Allocate from the process-heap using ProcessHeapAlloc
+ * ARGUMENT : DWORD dw_flags Controlling Heap Allocation Methods
+ * : SIZE_T dw_bytes Number of bytes to allocate
+ * RETURN : LPVOID Except NULL Pointer to the allocated memory block
+ * : NULL Assignment Failed
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+LPVOID
+PrivateHeapAlloc(DWORD dw_flags, SIZE_T dw_bytes) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return PbProcessHeapAlloc(dw_flags, dw_bytes);
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Free Process Heap
+ *
+ * Frees memory blocks allocated from the process heap
+ *
+ * @param[in] DWORD dw_flags Heap free method(Unused)
+ * @param[in] LPVOID lp_mem Pointer to the memory to be freed
+ *
+ * @return BOOL Non-zero Normal completion
+ * 0 ABENDs
+ */
+BOOL PbProcessHeapFree(DWORD dw_flags, LPVOID lp_mem) {
+ free(lp_mem);
+
+ return TRUE;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PrivateHeapFree
+ * ABSTRACT : Free memory blocks allocated from private heap
+ * NOTE : Because there is no private-heap notion in PosixBasedOS001,
+ * Open using ProcessHeapFree
+ * ARGUMENT : DWORD dw_flags Heap release option(Not used by PosixBasedOS001)
+ * : LPVOID lp_mem Pointer to the memory to be freed
+ * RETURN : BOOL Non-zero Normal
+ * : 0 Abnormality
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BOOL
+PrivateHeapFree(DWORD dw_flags, LPVOID lp_mem) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return PbProcessHeapFree(dw_flags, lp_mem);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : MemPermit
+ * ABSTRACT : Acquire access privilege to non-managed memory block of invoking process
+ * NOTE : To the data of the unmanaged memory block of invoking process
+ * : Allocate to accessible area of invoking process
+ * ARGUMENT : u_int32 mem_adr Start address of the data area to which access privileges are granted
+ * : u_int32 size Size of the data area to be granted access privileges
+ * : int32 perm PERM_NONCACHE(Cache invalidation), PERM_CACHE(Cache enabled)
+ * : void** ptr Returns the start address of the actual data area that can be accessed
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_ERROR ABENDs
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API MemPermit(u_int32 mem_adr, u_int32 size, int32 perm, void** ptr) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : MemProtect
+ * ABSTRACT : Revoking access privileges to invoking process unmanaged memory blocks
+ * NOTE : Free unmanaged memory block allocated to invoking process area
+ * ARGUMENT : u_int32 mem_adr Start address of the data area from which the access privilege is to be revoked
+ * : u_int32 size Size of the data area for which access privileges are to be revoked
+ * RETURN : RET_API RET_NORMAL Access privilege revocation successful
+ * : RET_ERROR Failed to revoke access privilege
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API MemProtect(u_int32 mem_adr, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create Share Data
+ *
+ * @param[in] char* area_name Pointer to shared data area name string
+ * @param[in] u_int32 size Size of the data portion
+ * @param[out] void** mem_ptr Pointer to the start address of the shared data area
+ *
+ * @return RET_API
+ * RET_NORMAL Normal
+ * RET_ERROR Abnormality
+ */
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+RET_API _pb_CreateShareData(char* area_name, u_int32 size, void** mem_ptr) // NOLINT(readability/nolint) WPF_SYSAPI.h
+#else
+RET_API _pb_CreateShareData(TCHAR* area_name, u_int32 size, void** mem_ptr) // NOLINT(readability/nolint) WPF_SYSAPI.h
+#endif // _CWORD64_API_DOES_NOT_USE_UNICODE
+{
+ RET_API ret_api = RET_NORMAL;
+ TCHAR *p_area_name = NULL;
+ TCHAR name[MAX_AREA_NAME_LEN] = {0};
+ HANDLE h_shm = NULL;
+ _CWORD64_SHMHDR *p_hdr = reinterpret_cast<_CWORD64_SHMHDR *>(MAP_FAILED);
+ MEMMAP_ITEM *p_item = NULL;
+#ifdef UNDER_CE
+ TCHAR unicode_area_name[MAX_AREA_NAME_LEN] = {0};
+#endif // UNDER_CE
+
+ if (mem_ptr == NULL) {
+ ret_api = RET_ERROR; /* Parameter error */
+ } else if (area_name == NULL) {
+ ret_api = RET_ERROR; /* Parameter error */
+ } else {
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+#ifdef UNDER_CE
+ if (area_name[0] == '\0') {
+ ret_api = RET_ERROR;
+ } else {
+ /* Shared memory name character limit processing */
+ if (strlen(area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ } else {
+ mbstowcs(unicode_area_name, area_name, MAX_AREA_NAME_LEN);
+ p_area_name = unicode_area_name;
+ }
+ }
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+ }
+
+ if (ret_api == RET_NORMAL) {
+ if ((p_area_name[0] == __TEXT('\0')) || (size == 0)) {
+ ret_api = RET_ERROR; /* Parameter error */
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ _tcscpy(name, p_area_name);
+
+ /* Lock Mutex */
+ PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE); // LCOV_EXCL_BR_LINE 200: no branch
+
+ p_item = FindMemMapItemByName(name); /* Search memory map object by area name */
+ if (p_item != NULL) /* When there is already a generated name */ {
+ *mem_ptr = NULL;
+ ret_api = RET_ERROR; /* Return in error because it has been generated */
+ } else {
+ /* Allocate MEMMAP_ITEM structure from heap */
+ // LCOV_EXCL_BR_START 5: standard lib error
+ p_item = reinterpret_cast<MEMMAP_ITEM *>(PbProcessHeapAlloc(0, sizeof(MEMMAP_ITEM)));
+ // LCOV_EXCL_BR_STOP
+ if (p_item == NULL) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *mem_ptr = NULL; // LCOV_EXCL_LINE 5: standard lib error
+ ret_api = RET_ERROR; /* Failed to allocate */ // LCOV_EXCL_LINE 5: standard lib error
+ } else {
+ p_item->h_heap = NULL;
+ p_item->p_next = NULL;
+ p_item->p_prev = NULL;
+ p_item->address = 0;
+ p_item->h_shared_mem = NULL;
+ LinkToMemMapList(p_item); /* Add to end of memory map list */ // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Allocate shared memory */
+ h_shm = CreateSharedMemory(name, size + sizeof(_CWORD64_SHMHDR)); // LCOV_EXCL_BR_LINE 200: can not be null
+ if (h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Remove the target memory-mapped object from the memory-mapped list */
+ UnlinkFromMemMapList(p_item);
+ PbProcessHeapFree(0, p_item);
+ p_item = NULL;
+ *mem_ptr = NULL;
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ p_item->h_shared_mem = h_shm;
+ /* Get Accessible Address */
+ // LCOV_EXCL_BR_START 200: can not be null
+ p_hdr = reinterpret_cast<_CWORD64_SHMHDR *>(GetSharedMemoryPtr(p_item->h_shared_mem));
+ // LCOV_EXCL_BR_STOP
+ if (p_hdr == NULL) { // LCOV_EXCL_BR_LINE 200: can not be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Delete allocated shared memory */
+ CloseSharedMemory(h_shm);
+ DeleteSharedMemory(name);
+ /* Remove the target memory-mapped object from the memory-mapped list */
+ UnlinkFromMemMapList(p_item);
+ PbProcessHeapFree(0, p_item);
+ p_item = NULL;
+ *mem_ptr = NULL;
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ p_hdr->mem_size = size;
+ *mem_ptr = reinterpret_cast<void*>(p_hdr + 1); /* Start at the address following the header */
+ _tcscpy(p_item->name, name); /* Name registration in the table */
+ }
+ }
+ }
+ }
+
+ /* Release Mutex */
+ PbMutexUnlock(g_p_mem_map_list->h_mutex); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ /* When an error occurs during parameter check */
+ if (mem_ptr != NULL) {
+ *mem_ptr = NULL;
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Link Share Data
+ *
+ * @param[in] char* area_name Pointer to shared data area name string
+ * @param[out] void** mem_ptr Pointer to the start address of the shared data area
+ * @param[out] u_int32* size Size of the data portion
+ *
+ * @return RET_API
+ * RET_NORMAL Normal
+ * RET_ERROR Abnormality
+ */
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+RET_API _pb_LinkShareData(char* area_name, void** mem_ptr, u_int32* size) // NOLINT(readability/nolint) WPF_SYSAPI.h
+#else
+RET_API _pb_LinkShareData(TCHAR* area_name, void** mem_ptr, u_int32* size) // NOLINT(readability/nolint) WPF_SYSAPI.h
+#endif // _CWORD64_API_DOES_NOT_USE_UNICODE
+{
+ RET_API ret_api = RET_NORMAL;
+ TCHAR *p_area_name = NULL;
+ TCHAR name[MAX_AREA_NAME_LEN] = {0};
+ _CWORD64_SHMHDR *p_hdr = reinterpret_cast<_CWORD64_SHMHDR *>(MAP_FAILED);
+ MEMMAP_ITEM *p_item = NULL;
+ HANDLE h_shm = NULL;
+ HANDLE h_shm_temp = NULL;
+ DWORD mem_size = 0;
+#ifdef UNDER_CE
+ TCHAR unicode_area_name[MAX_AREA_NAME_LEN] = {0};
+#endif
+
+ if (mem_ptr == NULL) {
+ ret_api = RET_ERROR; /* Parameter error */
+ } else if ((area_name == NULL) || (size == NULL)) {
+ ret_api = RET_ERROR; /* Parameter error */
+ } else {
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+#ifdef UNDER_CE
+ if (area_name[0] == '\0') {
+ ret_api = RET_ERROR;
+ } else {
+ /* Shared memory name character limit processing */
+ if (strlen(area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ } else {
+ mbstowcs(unicode_area_name, area_name, MAX_AREA_NAME_LEN);
+ p_area_name = unicode_area_name;
+ }
+ }
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+ }
+
+ if (ret_api == RET_NORMAL) {
+ if (p_area_name[0] == __TEXT('\0')) {
+ ret_api = RET_ERROR; /* Parameter error */
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ *size = 0;
+ _tcscpy(name, p_area_name);
+ mem_size = (u_int32) * size;
+
+ /* Lock Mutex */
+ PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE); // LCOV_EXCL_BR_LINE 200: no branch
+
+ p_item = FindMemMapItemByName(name); /* Search memory map object by area name */
+ if (p_item != NULL) {
+ /* When there is already a generated name */
+ h_shm = p_item->h_shared_mem;
+ // LCOV_EXCL_BR_START 200: can not be null
+ p_hdr = reinterpret_cast<_CWORD64_SHMHDR*>(GetSharedMemoryPtr(h_shm)); /* Get Accessible Address */
+ // LCOV_EXCL_BR_STOP
+ if (p_hdr == NULL) { // LCOV_EXCL_BR_LINE 200: can not be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *mem_ptr = NULL;
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ /* Start at the address following the header */
+ *mem_ptr = reinterpret_cast<void *>(p_hdr + 1);
+ *size = static_cast<u_int32>(p_hdr->mem_size);
+ }
+ } else {
+ /* When no memory map object has been created */
+ /* Allocate MEMMAP_ITEM structure from heap */
+ // LCOV_EXCL_BR_START 5: standard lib error
+ p_item = reinterpret_cast<MEMMAP_ITEM*>(PbProcessHeapAlloc(0, sizeof(MEMMAP_ITEM)));
+ // LCOV_EXCL_BR_STOP
+ if (p_item == NULL) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *mem_ptr = NULL; // LCOV_EXCL_LINE 5: standard lib error
+ ret_api = RET_ERROR; /* Failed to allocate */ // LCOV_EXCL_LINE 5: standard lib error
+ } else {
+ p_item->h_heap = NULL;
+ p_item->p_next = NULL;
+ p_item->p_prev = NULL;
+ p_item->address = 0;
+ _tcscpy(p_item->name, name);
+ p_item->h_shared_mem = NULL;
+ LinkToMemMapList(p_item); /* Add to end of memory map list */ // LCOV_EXCL_BR_LINE 200: no branch
+
+ ret_api = RET_ERROR; /* Process result initialization */
+ /* Maps the shared data area to physical memory and returns its information pointer
+ * (Check if not found by table lookup, but other processes are already reserved) */
+ h_shm_temp = OpenSharedMemory(p_item->name, sizeof(_CWORD64_SHMHDR)); // LCOV_EXCL_BR_LINE 200: no branch
+ if (h_shm_temp != NULL) {
+ /* Get Accessible Address */
+ p_hdr = reinterpret_cast<_CWORD64_SHMHDR*>(GetSharedMemoryPtr(h_shm_temp)); // LCOV_EXCL_BR_LINE 200: can not be NULL // NOLINT(whitespace/line_length)
+ if (p_hdr != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ mem_size = p_hdr->mem_size;
+ ret_api = RET_NORMAL;
+ }
+ CloseSharedMemory(h_shm_temp); // LCOV_EXCL_BR_LINE 200: no branch
+ }
+
+ if (ret_api == RET_NORMAL) {
+ ret_api = RET_ERROR; /* Process result initialization */
+ /* Maps the shared data area to physical memory and returns its information pointer */
+ h_shm = OpenSharedMemory(p_item->name, mem_size); // LCOV_EXCL_BR_LINE 200: no branch
+ if (h_shm != NULL) {
+ p_item->h_shared_mem = h_shm;
+ /* Get Accessible Address */
+ p_hdr = reinterpret_cast<_CWORD64_SHMHDR*>(GetSharedMemoryPtr(p_item->h_shared_mem));
+ if (p_hdr != NULL) {
+ *mem_ptr = reinterpret_cast<void*>(p_hdr + 1); /* Start at the address following the header */
+ *size = static_cast<u_int32>(mem_size);
+ ret_api = RET_NORMAL;
+ }
+ }
+ }
+
+ if (ret_api != RET_NORMAL) {
+ UnlinkFromMemMapList(p_item); /* Remove the target memory-mapped object from the memory-mapped list */
+
+ PbProcessHeapFree(0, p_item); // LCOV_EXCL_BR_LINE 200: no branch
+ p_item = NULL;
+ *mem_ptr = NULL;
+ *size = 0;
+ }
+ }
+ }
+
+ /* Release Mutex */
+ PbMutexUnlock(g_p_mem_map_list->h_mutex); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ /* When an error occurs during parameter check */
+ if (mem_ptr != NULL) {
+ *mem_ptr = NULL;
+ }
+ }
+
+ return ret_api;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbDeleteShareData
+ * ABSTRACT : Shared data area deletion processing
+ * NOTE : Deletes (releases) the shared memory area allocated under the name of the shared data area.
+ * ARGUMENT : char* area_name Pointer to shared data area name string
+ * RETURN : RET_API RET_NORMAL Normal
+ * : RET_ERROR The specified shared data does not exist
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+PbDeleteShareData(char* area_name) // LCOV_EXCL_START 8:dead code
+#else
+PbDeleteShareData(TCHAR* area_name)
+#endif // _CWORD64_API_DOES_NOT_USE_UNICODE
+{
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+ TCHAR *p_area_name = NULL;
+ TCHAR name[MAX_AREA_NAME_LEN] = {0};
+ MEMMAP_ITEM *p_item = NULL;
+#ifdef UNDER_CE
+ TCHAR unicode_area_name[MAX_AREA_NAME_LEN] = {0};
+#endif
+
+ /* Parameter check */
+ if (area_name == NULL) /* If the name of the shared area is NULL */ {
+ ret_api = RET_ERROR;
+ } else {
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+#ifdef UNDER_CE
+ if (strlen(area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ } else {
+ mbstowcs(unicode_area_name, area_name, MAX_AREA_NAME_LEN);
+ p_area_name = unicode_area_name;
+ }
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+ if (ret_api == RET_NORMAL) {
+ if (p_area_name[0] == __TEXT('\0')) {
+ ret_api = RET_ERROR;
+ }
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ /* Shared memory is allocated with the name of the shared area, or the memory map information management table is searched. */
+ _tcscpy(name, p_area_name);
+
+ /* Lock Mutex */
+ PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE);
+
+ p_item = FindMemMapItemByName(name); /* Search memory map object by area name */
+ if (p_item == NULL) /* If the area name is not in the memory-map information management TBL */ {
+ /* If the area name is not in the memory map information management TBL, it has not been created or deleted. */
+ /* Release Mutex */
+ PbMutexUnlock(g_p_mem_map_list->h_mutex);
+ ret_api = RET_ERROR;
+ } else {
+ /* If the area name is in the memory map information management TBL */
+ /* Removes the memory map information from the Chain of the memory map information management table. */
+ UnlinkFromMemMapList(p_item);
+
+ /* Releases the Mutex of the memory map information management table and releases the shared memory. */
+ /* Release Mutex */
+ PbMutexUnlock(g_p_mem_map_list->h_mutex);
+
+ if (p_item->h_shared_mem != NULL) {
+ CloseSharedMemory(p_item->h_shared_mem);
+ p_item->h_shared_mem = NULL;
+ }
+
+ /* Frees memory-map information from the heap */
+ PbProcessHeapFree(0, p_item);
+
+ /* Deleting Shared Memory Objects */
+ /*************************************************************/
+ /* Note: Be sure to delete it, so Do not use DeleteShareData */
+ /* if you want to link elsewhere. */
+ /*************************************************************/
+ DeleteSharedMemory(name);
+ }
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : LinkRomData
+ * ABSTRACT : ROM data link
+ * NOTE : Links data located in ROM.
+ * : Specifies the name of the file in which the data is to be stored, and points to the start address of the data.
+ * : Get pointer and data size.
+ * ARGUMENT : char *filename Pointer to the string of the name of the ROM data storage file
+ * : void **mem_ptr Pointer to the start address of the ROM data storage file
+ * : u_int32 *size Pointer to the size of the data portion
+ * RETURN : RET_API RET_NORMAL Normal status
+ * : RET_ERROR Specified ROM data storage file does not exist
+ * : File name character string width error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+RET_API LinkRomData(char* filename, void** mem_ptr, u_int32* size) // LCOV_EXCL_START 8:dead code
+#else
+RET_API LinkRomData(TCHAR* filename, void** mem_ptr, u_int32* size)
+#endif // _CWORD64_API_DOES_NOT_USE_UNICODE
+{
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL; /* Coverity CID: 18772 compliant */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbAccessPhysicalMem
+ * ABSTRACT : Access to Physical Memory Area Allocation Data
+ * NOTE : Access data allocated in the physical memory area.
+ * : The physical memory area is mapped to the shared memory area and mapped.
+ * : The start address is returned.
+ * ARGUMENT : u_int32 addr Start address of the physical memory area
+ * : void **mem_ptr Pointer to the start address of the mapped shared area
+ * : u_int32 size Size of the data
+ * : u_int32 mode Access mode
+ * : ACCESS_MODE_READONLY :Read Only
+ * : ACCESS_MODE_READWRITE:Reading and Writing
+ * RETURN : RET_API RET_NORMAL Normal status
+ * : RET_ERRPARAM Parameter error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbAccessPhysicalMem(u_int32 addr, void **mem_ptr, u_int32 size, u_int32 mode) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL; /* Coverity CID: 18767 compliant */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbFreePhysicalMem
+ * ABSTRACT : Access release processing to the physical memory area allocation data
+ * NOTE : Releases access to data allocated in a physical memory area
+ * : Releases the shared memory area Allocate by AccessPhysicalMem.
+ * ARGUMENT : u_int32 addr Start address of the physical memory area to be released
+ * : void *mem_ptr Pointer to the start address of the mapped shared area
+ * : u_int32 size Data size to be released
+ * RETURN : RET_API RET_NORMAL Normal status
+ * : RET_ERRPARAM Parameter error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbFreePhysicalMem(u_int32 addr, void *mem_ptr, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL; /* Coverity CID: 18766 compliant */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FindMemMapItemByName
+ * ABSTRACT : Memory map information retrieval processing
+ * NOTE : Retrieves the memory map information by the specified shared data area name.
+ * ARGUMENT : TCHAR* name Pointer to shared data area name character string
+ * RETURN : MEMMAP_ITEM* !NULL Pointer to memory map information
+ * : NULL Memory map information does not exist
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static MEMMAP_ITEM*
+FindMemMapItemByName(TCHAR* name) {
+ MEMMAP_ITEM* ret = NULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL
+ /* If the memory map information management table is not allocated, */
+ /* nop */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else if (g_p_mem_map_list->num_of_items == 0) {
+ /* If no memory map information is allocated, */
+ /* nop */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ MEMMAP_ITEM* p_item = g_p_mem_map_list->p_head;
+ /* Gets the pointer of the memory map Chain at the beginning of the file. */
+ /* Loops until there is no memory map Chain */
+ while (p_item != NULL) {
+ if (_tcscmp(p_item->name, name) == 0) {
+ /* If the name of the memory map information matches the name of the argument */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* Returns a pointer to the memory map information */
+ ret = p_item;
+ break; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+ p_item = p_item->p_next; /* Retrieves the pointers of the memory map data Chain next time. */
+ }
+ }
+
+ return(ret); /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : LinkToMemMapList
+ * NOTE : Adding a Memory Map Object to the Memory Map List
+ * ARGUMENT : MEMMAP_ITEM* p_item Specify a memory-mapped object
+ * RETURN : Without
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void
+LinkToMemMapList(MEMMAP_ITEM* p_item) {
+ BOOL processing_complete = FALSE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL
+ // LCOV_EXCL_START 200: g_p_mem_map_list can not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ // LCOV_EXCL_STOP
+ }
+
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ if ((processing_complete == FALSE) && (g_p_mem_map_list->num_of_items == 0)) {
+ g_p_mem_map_list->p_head = p_item;
+ g_p_mem_map_list->p_tail = p_item;
+ g_p_mem_map_list->num_of_items = 1;
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ if (processing_complete == FALSE) {
+ g_p_mem_map_list->p_tail->p_next = p_item;
+ p_item->p_prev = g_p_mem_map_list->p_tail;
+ p_item->p_next = NULL;
+ g_p_mem_map_list->p_tail = p_item;
+ g_p_mem_map_list->num_of_items++;
+ }
+ return;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : UnlinkFromMemMapList
+ * ABSTRACT : Memory map information deletion processing
+ * NOTE : Memory map information specified by the pointer is stored in the memory map information management table.
+ * : From the Chain structures.The memory map information is not released.
+ * ARGUMENT : MEMMAP_ITEM* p_item Pointer to the memory map information to be deleted
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void
+UnlinkFromMemMapList(MEMMAP_ITEM* p_item) {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ BOOL processing_complete = FALSE;
+ /* Parameter check */
+ if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL
+ /* If the memory map information management table is not allocated, */
+ /* nop */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else if (p_item == NULL) { // LCOV_EXCL_BR_LINE 200: p_item can not be NULL
+ /* If a pointer to memory-mapped information is not specified, */
+ /* nop */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else if (g_p_mem_map_list->num_of_items == 0) { // LCOV_EXCL_BR_LINE 200: num_of_items can not be 0
+ /* If no memory map information is allocated, */
+ /* nop */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* Chain detachment process when there is only one memory map data item */
+ if (g_p_mem_map_list->num_of_items == 1) {
+ if (g_p_mem_map_list->p_head == p_item) {
+ /* If only one memory map is reserved */
+ /* For the top memory map information of the memo map information management table */
+ g_p_mem_map_list->p_head = NULL; /* Initializes the top memory map to NULL. */
+ g_p_mem_map_list->p_tail = NULL; /* NULL initialization of the termination memory map data */
+ g_p_mem_map_list->num_of_items = 0; /* Initializes the control memory map information count to zero. */
+ }
+ /* Specified memory map information pointer does not exist */
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Memory-map-information-removal process at the top of the Chain */
+ if ((processing_complete == FALSE) && (p_item == g_p_mem_map_list->p_head)) {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* If the specified memory map information is the first memory map information, */
+ /* The leading memory map information pointer is changed to the next Chain pointer. */
+ g_p_mem_map_list->p_head = g_p_mem_map_list->p_head->p_next;
+ /* Change the previous Chain source of the first memory map to NULL */
+ g_p_mem_map_list->p_head->p_prev = NULL;
+ g_p_mem_map_list->num_of_items--; /* Decrement the number of management memory map information */
+ p_item->p_next = NULL; /* Initialize the Chain destination of the removed memory map NULL. */
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Memory-map data detachment process at the end of the Chain */
+ if ((processing_complete == FALSE) && (p_item == g_p_mem_map_list->p_tail)) {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* If the pointed-to memory-map information is terminated, */
+ /* Change the terminating memory-map info pointer to the previous Chain source */
+ g_p_mem_map_list->p_tail = g_p_mem_map_list->p_tail->p_prev;
+ /* Change the Chain destination of the terminated memory map to NULL. */
+ g_p_mem_map_list->p_tail->p_next = NULL;
+ /* Decrement the number of management memory map information */
+ g_p_mem_map_list->num_of_items--;
+ /* The previous Chain source of the removed memory map data is NULL initialized. */
+ p_item->p_prev = NULL;
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Checking the memory map info Chain for errors */
+ if ((processing_complete == FALSE) &&
+ (g_p_mem_map_list->num_of_items <= 2)) {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* No more than two memory maps are possible except at the beginning and end. */
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Departure process other than the start and end of the memory map data Chain */
+ if (processing_complete == FALSE) {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ p_item->p_prev->p_next = p_item->p_next; /* Set the next Chain destination of the previous memory map to the next one */
+ p_item->p_next->p_prev = p_item->p_prev; /* Previous Chain of one memory map before previous */
+ g_p_mem_map_list->num_of_items--; /* Decrement the number of management memory map information */
+ p_item->p_prev = NULL; /* The previous Chain source of the removed memory map data is NULL initialized. */
+ p_item->p_next = NULL; /* Initialize the Chain destination of the removed memory map NULL. */
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Obtain dump information
+ *
+ * @param[out] p_buf Dump info
+ */
+void _pb_GetDebugMemoryMngTbl(void* p_buf) { // NOLINT(readability/nolint) WPF_SYSAPI.h
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_tmp[256];
+ uint32_t i = 0;
+
+ if (p_buf != NULL) {
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf), "Memory");
+
+ if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL
+ // LCOV_EXCL_START 200: g_p_mem_map_list can not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ strncat(reinterpret_cast<char *>(&buf[0]), "\n NULL", strlen("\n NULL"));
+ // LCOV_EXCL_STOP
+ } else if (g_p_mem_map_list->num_of_items == 0) { // LCOV_EXCL_BR_LINE 200: num_of_items can not be 0
+ // LCOV_EXCL_START 200: num_of_items can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ strncat(reinterpret_cast<char *>(&buf[0]), "\n num_of_items:0", strlen("\n num_of_items:0"));
+ // LCOV_EXCL_STOP
+ } else {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp), // LCOV_EXCL_BR_LINE 5: c lib error case
+ "\n h_heap:%p, p_head:%s, p_tail:%s, num_of_items:%lu, h_mutex:%p",
+ g_p_mem_map_list->h_heap,
+ ((g_p_mem_map_list->p_head == NULL)?"NULL":"NOT NULL"),
+ ((g_p_mem_map_list->p_tail == NULL)?"NULL":"NOT NULL"),
+ g_p_mem_map_list->num_of_items,
+ g_p_mem_map_list->h_mutex);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ MEMMAP_ITEM* p_item = g_p_mem_map_list->p_head;
+ while (p_item != NULL) {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%02d]h_heap:%10p, p_next:%s, p_prev:%s, name:%40s, hShrMem:%10p, adr:%lu",
+ i,
+ p_item->h_heap,
+ ((p_item->p_next == NULL)?"NULL ":"NOT NULL"),
+ ((p_item->p_prev == NULL)?"NULL ":"NOT NULL"),
+ p_item->name,
+ p_item->h_shared_mem,
+ p_item->address);
+ i++;
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ p_item = p_item->p_next;
+ }
+ }
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ }
+}
diff --git a/vehicleservice/positioning_base_library/library/src/_pbMisc.cpp b/vehicleservice/positioning_base_library/library/src/_pbMisc.cpp
new file mode 100755
index 0000000..c52b7c6
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbMisc.cpp
@@ -0,0 +1,226 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbMisc.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System common functions
+ Title : System API Time-of-day operations related processing group
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+
+/*
+ Declaration of constant data type
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+typedef struct {
+ DWORD time_on_january1_1970; /* Time on January 1, 1970 when it expressed */
+ /* with the total second number from January 1, 1601 */
+} BTIME_INSTANCE;
+
+/*
+ Internal function prototype declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static DWORD FileTimeToSeonds(FILETIME* p_ft);
+
+/*
+ Global Variable Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BTIME_INSTANCE g_instance; // NOLINT(readability/nolint) global class instance
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : MiscInit()
+ * ABSTRACT : Time-related processing instance initialization processing
+ * NOTE : Assign and hold 1/1/1970 to FILETIME variables
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Normal completion Note: Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+MiscInit(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BTIME_INSTANCE *p_inst = &g_instance;
+ SYSTEMTIME st;
+ FILETIME ft;
+ BOOL bret;
+
+ /* Set the system time to the default value (January 1, 1970, 00:00:00). */
+ st.wYear = 1970;
+ st.wMonth = 1;
+ st.wDayOfWeek = 0;
+ st.wDay = 1;
+ st.wHour = 0;
+ st.wMinute = 0;
+ st.wSecond = 0;
+ st.wMilliseconds = 0;
+
+ /* Converting System Time to File Time */
+ bret = PbSystemTimeToFileTime(&st, &ft);
+ if (bret != TRUE) {
+ /* If the conversion fails, */
+ p_inst->time_on_january1_1970 = 0; /* Save to instance with zero elapsed seconds */
+ } else {
+ /* If the conversion is successful, */
+ p_inst->time_on_january1_1970 = FileTimeToSeonds(&ft); /* Save File Time Elapsed Seconds to Instance */
+ }
+
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FileTimeToSeonds()
+ * ABSTRACT : File Time -> Time Conversion Processing
+ * NOTE : Convert the file time to seconds
+ * ARGUMENT : FILETIME *p_ft Pointer to the file time structure
+ * RETURN : DWORD Elapsing time(In seconds)
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static DWORD
+FileTimeToSeonds(FILETIME* p_ft) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : MiscTerm()
+ * ABSTRACT : Time-related processing instance release processing
+ * NOTE :
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Normal completion Note: Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+MiscTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : Sleep()
+ * ABSTRACT : Sleep Processing
+ * NOTE : Cause the caller to sleep at the number of ticks specified by the argument
+ * ARGUMENT : u_int32 ticks Sleep time(Specify in ticks)
+ * : 0 Sleep permanently
+ * : 1 Discard the time slice
+ * RETURN : RET_API Normal completion Note: Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+Sleep(u_int32 ticks) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DWORD milliseconds;
+
+ switch (ticks) {
+ case 0: /* infinite delay. */
+ {
+ milliseconds = INFINITE;
+ break;
+ }
+ case 1: /* the thread to relinquish the remainder of its time slice */
+ /* to any other thread of equal priority that is ready to run. */
+ /* If there are no other threads of equal priority ready to run, */
+ /* the function returns immediately, and the thread continues execution. */
+ {
+ milliseconds = 0;
+ break;
+ }
+ default: /* Time tranrate from per 10ms tick count to per milli second. */
+ milliseconds = (DWORD)ticks * 10;
+ break;
+ }
+ PbMilliSecSleep(static_cast<u_int32>(milliseconds));
+
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbMilliSecSleep()
+ * ABSTRACT : Sleep Processing(Units of ms)
+ * NOTE : Cause the caller to sleep at the number of ticks specified by the argument
+ * ARGUMENT : u_int32 ul_mill_time Sleep time(Specified in millimeters)
+ * : 0 Discard the time slice
+ * : INFINITE Sleep permanently
+ * RETURN : RET_API Normal completion Note: Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API PbMilliSecSleep(u_int32 ul_mill_time) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (ul_mill_time) {
+ case 0:
+ {
+ /* Discard the time slice */
+ sched_yield();
+ break;
+ }
+ case INFINITE:
+ {
+ /* Abort processing indefinitely */
+ while (1) {
+ sleep(INFINITE);
+ }
+ }
+ default:
+ /* Sleep for Specified Time */
+ usleep(ul_mill_time * 1000);
+ break;
+ }
+
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SecSleep()
+ * ABSTRACT : Sleep Processing(s unit)
+ * NOTE : Cause the caller to sleep at the number of ticks specified by the argument
+ * ARGUMENT : u_int32 ul_time Sleep time(Specify in seconds)
+ * : 0 Discard the time slice
+ * : INFINITE Sleep permanently
+ * RETURN : RET_API Normal completion Note: Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API SecSleep(u_int32 ul_time) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (ul_time) {
+ case 0:
+ {
+ /* Discard the time slice */
+ sched_yield();
+ break;
+ }
+ case INFINITE:
+ {
+ /* Abort processing indefinitely */
+ while (1) {
+ sleep(INFINITE);
+ }
+ }
+ default:
+ /* Sleep for Specified Time */
+ sleep(ul_time);
+ break;
+ }
+
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : _sysMisc.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
diff --git a/vehicleservice/positioning_base_library/library/src/_pbMsg.cpp b/vehicleservice/positioning_base_library/library/src/_pbMsg.cpp
new file mode 100755
index 0000000..3919239
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbMsg.cpp
@@ -0,0 +1,1572 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbMsg.cpp
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <vehicle_service/positioning_base_library.h>
+#include <native_service/ns_message_center_if.h>
+#include "_pbEvent_Internal.h"
+#include "_pbInternalProc.h"
+
+#include <native_service/frameworkunified_framework_if.h>
+#include "WPF_STD_private.h"
+#include "tchar.h"
+
+/*---------------------------------------------------------------------------------*
+ * Define *
+ *---------------------------------------------------------------------------------*/
+#define MSG_MAX_NUM_CTRL_MSGQUE (32) /* Maximum number of message queues */
+#define MSG_MAX_NUM_CTRL_THREAD (16) /* Maximum number of threads/process */
+
+#define FULL_MSG_NUM_CTRL_MSGQUE (MSG_MAX_NUM_CTRL_MSGQUE - 4) /* Message control table threshold (no free) */
+#define WARN_MSG_NUM_CTRL_MSGQUE (MSG_MAX_NUM_CTRL_MSGQUE - 10) /* Message control table threshold (warning) */
+
+/*---------------------------------------------------------------------------------*
+ * Structure *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Control table for message queues
+*/
+typedef struct {
+ PNO pno; /**< Process No. */
+ char name[MAX_QUEUE_NAME_SIZE]; /**< Message Que Name */
+ HANDLE h_positioningbaselibrary_sender[MSG_MAX_NUM_CTRL_THREAD]; /**< handle to the Sender */
+ HANDLE h_sender; /**< handle to the Sender */
+ HANDLE h_receiver; /**< handle to the Receiver */
+ HANDLE h_zc_sender; /**< handle to the ZcSender */
+ uint8_t msg_rcv_buf[MAX_QUEUE_MSG_SIZE]; /**< Message buffer */
+} MSG_CTRL_DETAIL_INFO;
+
+/*!
+ @brief Control table for message queues
+*/
+typedef struct {
+ MSG_CTRL_DETAIL_INFO info[MSG_MAX_NUM_CTRL_MSGQUE]; /**< message infomation */
+ uint32_t use_cnt; /**< Use Counter */
+ uint32_t rsv_cnt; /**< Reserve Counter */
+} MSG_CTRL_INFO;
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/**
+ Message control table
+ Note: Access to this instance shall be made through the operation module.
+*/
+static MSG_CTRL_INFO g_msg_ctrl_tbl; // NOLINT(readability/nolint) global Class instance
+
+/** Message-control-table-locking Mutex handles */
+static HANDLE g_h_mtx;
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+/* Message Control Table Operation Functions */
+static void MsgSetPnoOfCtrlTbl(u_int32 idx, PNO pno); /* PNO setting */
+static PNO MsgGetPnoOfCtrlTbl(u_int32 idx); /* PNO acquisition */
+static void MsgSetNameOfCtrlTbl(u_int32 idx, LPCTSTR name); /* Message queue name setting */
+static char* MsgGetNameOfCtrlTbl(u_int32 idx); /* Get Message Queue Name */
+static void MsgSetReceiverHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Message queue handle setting */
+static HANDLE MsgGetReceiverHandleOfCtrlTbl(u_int32 idx); /* Get message queue handle */
+static void MsgSetSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Message send handle setting */
+static HANDLE MsgGetSenderHandleOfCtrlTbl(u_int32 idx); /* Get message send handle */
+/* Message send handle setting*/
+static void MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle, uint32_t offset);
+static HANDLE MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, uint32_t offset); /* Get message send handle */
+static void MsgSetZcSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Message send handle setting */
+static HANDLE MsgGetZcSenderHandleOfCtrlTbl(u_int32 idx); /* Get message send handle */
+static uint8_t* MsgGetMsgRcvBufOfCtrlTbl(uint32_t idx); /* Get message receive buffer */
+static u_int32 MsgSearchEmptyOfCtrlTbl(void); /* Retrieval of free space in control table */
+static u_int32 MsgSearchPnoOfCtrlTbl(PNO pno); /* Retrieval of control table PNO */
+static u_int32 MsgSearchNameOfCtrlTbl(LPCTSTR name); /* Retrieve control table queue name */
+static void MsgIncUseCntOfCtrlTbl(void); /* Control table usage counter increment */
+static void MsgDecUseCntOfCtrlTbl(void); /* Control table usage counter increment */
+static void MsgIncRsvCntOfCtrlTbl(void); /* Control table reservation counter increment */
+static void MsgDecRsvCntOfCtrlTbl(void); /* Control table reservation counter increment */
+
+/* Mutex handling Functions for Accessing Message Control Tables */
+static void MsgCreateMutex(void); /* Mutex generating */
+/* Message send handle setting */
+/* static void MsgDeleteMutex(void); */ // Todo:Uncomment out after completion of implementation of termination processing
+static void MsgLockMutex(void); /* Mutex retrieval */
+static void MsgUnlockMutex(void); /* Mutex release */
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Initialize the message function
+ *
+ * Message control table initialization
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error
+ */
+RET_API MsgInit(void) {
+ RET_API ret_api = RET_NORMAL;
+ u_int32 i;
+
+ MsgCreateMutex();
+
+ /* Control table initialization */
+ memset(g_msg_ctrl_tbl.info, 0x00, sizeof(g_msg_ctrl_tbl.info));
+
+ for (i = 0; i < MSG_MAX_NUM_CTRL_MSGQUE; i++) {
+ /* Empty character is set for the message queue name. */
+ _tcscpy(g_msg_ctrl_tbl.info[i].name, "");
+ }
+ g_msg_ctrl_tbl.use_cnt = 0;
+ g_msg_ctrl_tbl.rsv_cnt = 0;
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Term
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR ABENDs
+ */
+RET_API MsgTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_ERROR;
+ RET_API ret;
+ EFrameworkunifiedStatus estatus;
+ HANDLE handle;
+ u_int32 idx;
+ PNO pno;
+
+ MsgLockMutex();
+
+ /* Release Message Transmission/Reception Handle */
+ for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) {
+ /* Receive handle acquisition */
+ pno = MsgGetPnoOfCtrlTbl(idx);
+ if (pno != 0) {
+ /* For queue information for internal threads */
+ /* Delete Message Queue */
+ ret = PbDeleteMsg(pno);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McClose ERROR " \
+ "[ret:%d, pno:%d]", ret, pno);
+ /* The module returns OK even if it fails. */
+ }
+ } else {
+ /* Other than the above(Send handle to external process) */
+ /* Get send handle */
+ handle = MsgGetSenderHandleOfCtrlTbl(idx);
+ if (handle != NULL) {
+ estatus = FrameworkunifiedMcClose(handle);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedMcClose ERROR " \
+ "[estatus:%d, handle:%p]", estatus, handle);
+ /* The module returns OK even if it fails. */
+ } else {
+ /* Message control table update */
+ MsgSetSenderHandleOfCtrlTbl(idx, NULL); /* Send handle */
+
+ MsgSetNameOfCtrlTbl(idx, ""); /* Name */
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(--) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s",
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \
+ PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+ }
+ }
+
+ MsgUnlockMutex();
+
+ /* MsgDeleteMutex(); */ // Todo:Uncomment out after completion of implementation of termination processing
+
+ /* TODO:Delete the shared memory for the message management table */
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create the message queue
+ *
+ * Creates a message queue.
+ * This function is implemented on the assumption that a thread name is assigned by prctl() and then called from that thread.
+ * The generated message queue name is the same as the thread name.
+ *
+ * @param[in] pno Process number
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_CreateMsg(PNO pno) { // NOLINT(readability/nolint) interface
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ u_int32 idx;
+ HANDLE handle = NULL;
+ char name[MAX_QUEUE_NAME_SIZE];
+ size_t len;
+
+ /* If PNO is invalid (0), the parameter is abnormal and processing is not performed. */
+ if (pno == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* Get Thread Name */
+ (void)prctl(PR_GET_NAME, name);
+
+ len = _tcslen(name);
+ if (len >= MAX_QUEUE_NAME_SIZE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Length of thread name is too long(>=%d). " \
+ "[len:%zu]", MAX_QUEUE_NAME_SIZE, len);
+ ret_api = RET_ERRPARAM;
+ } else {
+ MsgLockMutex(); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Check if the specified PNO is already registered */
+ idx = MsgSearchPnoOfCtrlTbl(pno); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* When the entry is already stored */
+ if (idx != MSG_MAX_NUM_CTRL_MSGQUE) {
+ /* No processing */
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \
+ PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ } else {
+ /* Not registered */
+ /* Search for free space */
+ idx = MsgSearchEmptyOfCtrlTbl();
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE
+ /* Be impossible by design */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchEmptyOfCtrlTbl ERROR " \
+ "[idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE
+
+ /* don't arrive here. */
+ } else {
+ /* Create Message Queue */
+ handle = McOpenReceiver(name); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (handle == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* In the event of failure */
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenReceiver ERROR " \
+ "[handle:%p, name:%s]", handle, name);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+ /* don't arrive here. */
+ } else {
+ /* If successful */
+ /* Message control table update */
+ MsgSetPnoOfCtrlTbl(idx, pno); /* PNO */ // LCOV_EXCL_BR_LINE 200: no branch
+
+ MsgSetReceiverHandleOfCtrlTbl(idx, handle); /* Receive handle */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+
+ MsgSetNameOfCtrlTbl(idx, name); /* Name */ // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Increment Message Control Table Usage Counter */
+ MsgIncUseCntOfCtrlTbl();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \
+ "### MESSAGE TABLE INFORMATION # (++) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, " \
+ "h_sender=%p, h_receiver=%p, name=%s", idx, MsgGetPnoOfCtrlTbl(idx), \
+ PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, PbGetLocalTid()), \
+ MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+ }
+ }
+
+ MsgUnlockMutex(); // LCOV_EXCL_BR_LINE 200: no branch
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Delete the message queue
+ *
+ * Delete a message queue.
+ * Deleted from the message control table even if closing of the send/receive handle fails
+ *
+ * @param[in] pno
+ *
+ * @return RET_NORMAL Normal completion
+ */
+RET_API PbDeleteMsg(PNO pno) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ uint32_t idx;
+ uint32_t i;
+ HANDLE handle;
+ EFrameworkunifiedStatus estatus;
+
+ idx = MsgSearchPnoOfCtrlTbl(pno);
+ if (idx != MSG_MAX_NUM_CTRL_MSGQUE) {
+ /* Receive handle acquisition */
+ handle = MsgGetReceiverHandleOfCtrlTbl(idx);
+ if (handle != NULL) {
+ estatus = McClose(handle);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McClose ERROR " \
+ "[estatus:%d, handle:%p]", estatus, handle);
+ /* The module returns OK even if the Close fails. */
+ }
+ }
+
+ /* Get send handle */
+ handle = MsgGetSenderHandleOfCtrlTbl(idx);
+ if (handle != NULL) {
+ estatus = McClose(handle);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McClose ERROR " \
+ "[estatus:%d, handle:%p]", estatus, handle);
+ /* The module returns OK even if the Close fails. */
+ }
+ }
+
+ /* Get send handle */
+ handle = MsgGetZcSenderHandleOfCtrlTbl(idx);
+ if (handle != NULL) {
+ estatus = McZcClose(handle);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McZcClose ERROR " \
+ "[estatus:%d, handle:%p]", estatus, handle);
+ /* The module returns OK even if the Close fails. */
+ }
+ }
+
+ /* Message control table update */
+ MsgSetPnoOfCtrlTbl(idx, 0); /* PNO */
+
+ for (i = 0; i < MSG_MAX_NUM_CTRL_THREAD; i++) {
+ MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, NULL, i); /* Send handle */
+ }
+
+ MsgSetSenderHandleOfCtrlTbl(idx, NULL); /* Send handle */
+
+ MsgSetReceiverHandleOfCtrlTbl(idx, NULL); /* Receive handle */
+
+ MsgSetNameOfCtrlTbl(idx, ""); /* Name */
+
+ /* Decrement Message Control Table Usage Counter */
+ MsgDecUseCntOfCtrlTbl();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(--) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \
+ PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Receive the message
+ *
+ * Receive a message for the specified PNO.If the specified PNO is invalid, an error is returned.
+ * If the size of the received data exceeds the size specified in the parameter, an error is returned.
+ *
+ * @param[in] pno Process number
+ * @param[in] size Message size
+ * @param[out] msgbuf Pointer to message area
+ * @param[in] mode Not used
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_RcvMsg(PNO pno, u_int16 size, void** msgbuf, u_int16 mode) { // NOLINT(readability/nolint) interface
+ RET_API ret_api = RET_RCVMSG; /* Results of this Module process */
+ u_int32 idx;
+ HANDLE h_msg_que = NULL;
+ char source[MAX_QUEUE_NAME_SIZE];
+ u_int32 cmd_id;
+ EFrameworkunifiedStatus rcv_sts;
+ u_int8* p_msg_rcv_buf;
+ u_int32 msg_len = 0;
+ void* p_rcv_data;
+
+ /* Null Check */
+ if (msgbuf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [msgbuf:%p]", msgbuf);
+ ret_api = RET_ERRPARAM;
+ } else if (pno == 0) {
+ /* PNO-invalid Check */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* Search if the specified PNO is registered in the control table */
+ idx = MsgSearchPnoOfCtrlTbl(pno); // LCOV_EXCL_BR_LINE 200: no branch
+ /* Not stored */
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR " \
+ "[idx:%d, pno:0x%x]", idx, pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* If it is registered */
+ /* Handle acquisition */
+ h_msg_que = MsgGetReceiverHandleOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: recv handle created in _pb_CreateMsg //NOLINT(whitespace/line_length)
+ if (h_msg_que == NULL) { // LCOV_EXCL_BR_LINE 200: recv handle created in _pb_CreateMsg
+ /* Be impossible by design */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Msg_getMsgQueHandleOfCtrlTbl ERROR " \
+ "[h_msg_que:%p, idx:%d]", h_msg_que, idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: recv handle created in _pb_CreateMsg
+
+ /* don't arrive here. */
+ }
+
+ /* Get Message Buffer */
+ p_msg_rcv_buf = MsgGetMsgRcvBufOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Receive message */
+ // LCOV_EXCL_BR_START 4: nsfw error
+ rcv_sts = McReceive(h_msg_que,
+ source, /* app that sent this message */
+ &cmd_id, /* Command ID */
+ MAX_QUEUE_MSG_SIZE,
+ (PVOID)p_msg_rcv_buf);
+ // LCOV_EXCL_BR_STOP
+
+ if (rcv_sts != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* In the event of failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McReceive ERROR " \
+ "[rcv_sts:%d, h_msg_que:%p, source:%s, cmd_id:0x%x]", rcv_sts, h_msg_que, source, cmd_id);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ /* If successful */
+ /* Size check */
+ msg_len = McGetLength(p_msg_rcv_buf); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if ((msg_len <= size) && (msg_len > 0)) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* OK */
+ /* Get Message */
+ p_rcv_data = McGetDataPointer(p_msg_rcv_buf); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (p_rcv_data == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rcv_sts = McGetDataOfSize(p_msg_rcv_buf, *msgbuf, msg_len);
+ if (rcv_sts != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Message acquisition failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "McGetDataOfSize ERROR [rcv_sts:%d]", rcv_sts);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \
+ "McReceive/McGetDataOfSize SUCCESS [rcv_sts:%d, h_msg_que:%p, source:%s, " \
+ "cmd_id:0x%x, msg_len:%d]", rcv_sts, h_msg_que, source, cmd_id, msg_len);
+ }
+ } else {
+ *msgbuf = p_rcv_data;
+ }
+ } else {
+ /* NG */
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McGetLength ERROR " \
+ "[size:%d < msg_len:%d]", size, msg_len);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Send the message
+ *
+ * For in-process communication
+ * Sends a message to the specified PNO.If the specified PNO is invalid, an error is returned.
+ *
+ * @param[in] pno Process number
+ * @param[in] size Message size
+ * @param[in] msgbuf Pointer to message storage area
+ * @param[in] mode Not used
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_SndMsg(PNO pno, u_int16 size, void* msgbuf, u_int16 mode) { // NOLINT(readability/nolint) interface
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ u_int32 idx;
+ PCSTR msg_que_name;
+ HANDLE handle; /* handle to the send message queue */
+ EFrameworkunifiedStatus estatus;
+ T_APIMSG_MSGBUF_HEADER *p_msg_header;
+ CID cid;
+
+ /* Null Check */
+ if (msgbuf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [msgbuf:%p]", msgbuf);
+ ret_api = RET_ERRPARAM;
+ } else if (pno == 0) {
+ /* PNO-invalid Check */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ MsgLockMutex();
+
+ /* Check if the specified PNO is registered in the message control table */
+ idx = MsgSearchPnoOfCtrlTbl(pno);
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) {
+ /* Not stored */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR!! " \
+ "[pno=%d]", pno);
+
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* If it is registered */
+ /* Acquire transmission handle from management table */
+ handle = MsgGetSenderHandleOfCtrlTbl(idx);
+ if (handle == NULL) {
+ /* Get message queue name */
+ msg_que_name = MsgGetNameOfCtrlTbl(idx);
+
+ /* Get send handle */
+ handle = McOpenSender(msg_que_name); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When handle acquisition fails */
+ if (handle == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender ERROR " \
+ "[handle:%p, msg_que_name:%s]", handle, msg_que_name);
+
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Message control table update */
+ MsgSetSenderHandleOfCtrlTbl(idx, handle); /* Send handle */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \
+ PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+ /* When handle acquisition is successful */
+ if (handle != NULL) {
+ p_msg_header = reinterpret_cast<T_APIMSG_MSGBUF_HEADER*>(msgbuf);
+ cid = p_msg_header->hdr.cid;
+
+ /* Messaging */
+ estatus = McSend(handle,
+ "", /* Sender name */
+ cid, /* Command ID */
+ size,
+ msgbuf); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When transmission fails */
+ if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend ERROR " \
+ "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, idx, handle, cid, size);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "McSend SUCCESS " \
+ "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, idx, handle, cid, size);
+ }
+
+ /* Close all handles at the time of termination */
+ }
+ }
+
+ MsgUnlockMutex();
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Acquire transmission buffer for in-process communication (for non-copy API)
+ * Gets the buffer for sending messages to the specified PNO.If the specified PNO is invalid, an error is returned.
+ * Set the send data in the acquired buffer and send it with _pb_ZcSndMsg().
+ *
+ * @param[in] pno Process number
+ * @param[out] p_snd_buf Transmitting buffer
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_GetZcSndBuf(PNO pno, void** p_snd_buf) { // NOLINT(readability/nolint) interface
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ u_int32 idx;
+ PCSTR msg_que_name;
+ HANDLE handle; /* handle to the send message queue */
+
+ /* PNO-invalid Check */
+ if (pno == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ MsgLockMutex();
+
+ /* Check if the specified PNO is registered in the message control table */
+ idx = MsgSearchPnoOfCtrlTbl(pno);
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) {
+ /* Not stored */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR!! [pno=%d]", pno);
+
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* If it is registered */
+ /* Acquire transmission handle from management table */
+ handle = MsgGetZcSenderHandleOfCtrlTbl(idx);
+ if (handle == NULL) {
+ /* Get message queue name */
+ msg_que_name = MsgGetNameOfCtrlTbl(idx);
+
+ /* Get send handle */
+ handle = McZcOpenSender(msg_que_name); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (handle == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When handle acquisition fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender ERROR " \
+ "[handle:%p, msg_que_name:%s]", handle, msg_que_name);
+
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Message control table update */
+ MsgSetZcSenderHandleOfCtrlTbl(idx, handle); /* Send handle */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s",
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \
+ PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+
+ if (handle != NULL) {
+ /* When handle acquisition is successful */
+ /* Get message send buffer */
+ *p_snd_buf = McZcGetBuf(handle); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (*p_snd_buf == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When buffer acquisition fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcSetParam ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Close all handles at the time of termination */
+ }
+ }
+
+ MsgUnlockMutex();
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Send the message
+ *
+ * For in-process communication(for non-copy API)
+ * Sends a message to the specified PNO.If the specified PNO is invalid, an error is returned.
+ * Before calling this function, send data must be set in the area acquired by _pb_GetZcSndBuf().
+ *
+ * @param[in] pno Process number
+ * @param[in] size Message size
+ * @param[in] mode Not used
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_ZcSndMsg(PNO pno, u_int16 size, u_int16 mode) { // NOLINT(readability/nolint) interface
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ u_int32 idx;
+ HANDLE handle; /* handle to the send message queue */
+ EFrameworkunifiedStatus estatus;
+ T_APIMSG_MSGBUF_HEADER *p_msg_header;
+ CID cid;
+ void* p_send_data;
+
+ /* PNO-invalid Check */
+ if (pno == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ MsgLockMutex();
+
+ /* Check if the specified PNO is registered in the message control table */
+ idx = MsgSearchPnoOfCtrlTbl(pno);
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) {
+ /* Not stored */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR!! [pno=%d]", pno);
+
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* If it is registered */
+ /* Acquire transmission handle from management table */
+ handle = MsgGetZcSenderHandleOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: sender handle set in _pb_GetZcSndBuf
+ if (handle == NULL) { // LCOV_EXCL_BR_LINE 200: sender handle set in _pb_GetZcSndBuf
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "handle ERROR " \
+ "[pno=%d, idx=%d]", pno, idx);
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 200: sender handle set in _pb_GetZcSndBuf
+ }
+ /* When handle acquisition is successful */
+ if (handle != NULL) {
+ /* Messaging */
+ /* Set the transmission data in advance. */
+ p_send_data = McZcGetBuf(handle);
+ if (p_send_data != NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ p_msg_header = reinterpret_cast<T_APIMSG_MSGBUF_HEADER*>(p_send_data);
+ cid = p_msg_header->hdr.cid;
+ estatus = McZcSetParam(handle, cid, size);
+ if (estatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ estatus = McZcSend(handle); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When transmission fails */
+ if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcSend ERROR " \
+ "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, \
+ idx, handle, cid, size);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "McZcSend SUCCESS " \
+ "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, \
+ idx, handle, cid, size);
+ }
+ } else {
+ /* When parameter setting fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcSetParam ERROR " \
+ "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, idx, handle, cid, size);
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* When parameter buffer acquisition fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcGetBuf ERROR " \
+ "[idx:%d, handle:%p, size:%d]", idx, handle, size);
+ ret_api = RET_ERROR;
+ }
+
+ /* Close all handles at the time of termination */
+ }
+ }
+
+ MsgUnlockMutex();
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Send the message
+ *
+ * For interprocess communication
+ * Sends a message to the specified process.If the specified process is invalid, an error is returned.
+ *
+ * Note: Since the data sent by this function is to be received by the dispatcher, the message header
+ * must not be included in the send data specified by the argument.
+ *
+ * @param[in] name Destination Process Name
+ * @param[in] cid Command ID
+ * @param[in] size Message size
+ * @param[in] msgbuf Pointer to message storage area
+ * @param[in] mode Not used
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_SndMsg_Ext(PCSTR name, CID cid, u_int16 size, const void* msgbuf, // NOLINT(readability/nolint) interface
+ u_int16 mode) {
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ uint32_t thread_offset;
+ u_int32 idx;
+ HANDLE h_positioningbaselibrary_service = NULL;
+ EFrameworkunifiedStatus estatus;
+ size_t len;
+ HANDLE h_app;
+
+ /* Null Check */
+ if ((name == NULL) || (msgbuf == NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \
+ "[name:%p, msgbuf:%p]", name, msgbuf);
+ ret_api = RET_ERRPARAM;
+ } else {
+ h_app = _pb_GetAppHandle();
+
+ len = _tcslen(name);
+ if (len >= MAX_QUEUE_NAME_SIZE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! " \
+ "Length of thread name is too long(>=%d). [len:%zu]", MAX_QUEUE_NAME_SIZE, len);
+ ret_api = RET_ERRPARAM;
+ } else {
+ thread_offset = PbGetLocalTid();
+
+ MsgLockMutex();
+
+ idx = MsgSearchNameOfCtrlTbl(name);
+
+ if (idx != MSG_MAX_NUM_CTRL_MSGQUE) {
+ h_positioningbaselibrary_service = MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, thread_offset);
+ if (h_positioningbaselibrary_service == NULL) {
+ h_positioningbaselibrary_service = FrameworkunifiedMcOpenSender(h_app, name); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When handle acquisition fails */
+ if (h_positioningbaselibrary_service == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedMcOpenSender ERROR!! " \
+ "[h_positioningbaselibrary_service=%p, h_app=%p, name=%s]", h_positioningbaselibrary_service, h_app, name);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ /* Message control table update */
+ MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, h_positioningbaselibrary_service, thread_offset); /* Send handle */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), \
+ MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), \
+ MsgGetReceiverHandleOfCtrlTbl(idx), MsgGetNameOfCtrlTbl(idx));
+ }
+ }
+ } else {
+ /* Search for free space */
+ idx = MsgSearchEmptyOfCtrlTbl();
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE
+ /* Be impossible by design */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchEmptyOfCtrlTbl ERROR!! " \
+ "[idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE
+
+ /* don't arrive here. */
+ } else {
+ /* Get send handle */
+ h_positioningbaselibrary_service = FrameworkunifiedMcOpenSender(h_app, name); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When handle acquisition fails */
+ if (h_positioningbaselibrary_service == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedMcOpenSender ERROR!! " \
+ "[h_positioningbaselibrary_service=%p, h_app=%p, name=%s]", h_positioningbaselibrary_service, h_app, name);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ /* Message control table update */
+ MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, h_positioningbaselibrary_service, thread_offset); /* Send handle */
+
+ MsgSetNameOfCtrlTbl(idx, name); /* Name */
+
+ /* Increment Message Control Table Usage Counter */
+ MsgIncUseCntOfCtrlTbl();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \
+ "### MESSAGE TABLE INFORMATION # (++) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, " \
+ "h_sender=%p, h_receiver=%p, name=%s", idx, MsgGetPnoOfCtrlTbl(idx), \
+ PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, PbGetLocalTid()), \
+ MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+ }
+ }
+
+ MsgUnlockMutex();
+ /* When handle acquisition is successful */
+ if (h_positioningbaselibrary_service != NULL) {
+ /* Messaging */
+ estatus = FrameworkunifiedSendMsg(h_positioningbaselibrary_service, cid, size, msgbuf); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When transmission fails */
+ if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg ERROR!! " \
+ "[name=%s, estatus=%d, h_positioningbaselibrary_service=%p, cid=%d, size=%d]", \
+ name, estatus, h_positioningbaselibrary_service, cid, size);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__, "Send message = " \
+ "[Destination:%s][CID:0x%X]", name, cid);
+ }
+ /* Close all handles at the time of termination */
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+/*---------------------------------------------------------------------------------*
+ * Local Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * PNO setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] pno Process number
+ */
+static void MsgSetPnoOfCtrlTbl(u_int32 idx, PNO pno) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d, pno:%d]", idx, pno);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ } else {
+ g_msg_ctrl_tbl.info[idx].pno = pno;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * PNO acquisition(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] pno Process number
+ */
+static PNO MsgGetPnoOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].pno;
+}
+
+/**
+ * @brief
+ * Message queue name setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] name Message queue name
+ */
+static void MsgSetNameOfCtrlTbl(u_int32 idx, LPCTSTR name) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d, name:%s]", idx, name);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ _tcscpy(g_msg_ctrl_tbl.info[idx].name, name);
+
+ return;
+}
+
+/**
+ * @brief
+ * Get Message Queue Name(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ *
+ * @return Message queue name
+ */
+static char* MsgGetNameOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].name;
+}
+
+/**
+ * @brief
+ * Message reception handle setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] handle Message queue handle
+ */
+static void MsgSetReceiverHandleOfCtrlTbl(u_int32 idx, HANDLE handle) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ } else {
+ g_msg_ctrl_tbl.info[idx].h_receiver = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get message reception handle(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ *
+ * @return Message queue handle
+ */
+static HANDLE MsgGetReceiverHandleOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].h_receiver;
+}
+
+/**
+ * @brief
+ * Message send handle setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] handle Message queue handle
+ */
+static void MsgSetSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ } else {
+ g_msg_ctrl_tbl.info[idx].h_sender = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get message send handle(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ *
+ * @return Message queue handle
+ */
+static HANDLE MsgGetSenderHandleOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].h_sender;
+}
+
+
+/**
+ * @brief
+ * Positioningbaselibrary message send handle setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] handle Message queue handle
+ * @param[in] offset Local thread ID
+ */
+static void MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle, uint32_t offset) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ } else {
+ g_msg_ctrl_tbl.info[idx].h_positioningbaselibrary_sender[offset] = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Positioningbaselibrary message send handle acquisition(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] offset Local thread ID
+ *
+ * @return Message queue handle
+ */
+static HANDLE MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, uint32_t offset) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].h_positioningbaselibrary_sender[offset];
+}
+
+/**
+ * @brief
+ * Message send handle setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] handle Message queue handle
+ */
+static void MsgSetZcSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ } else {
+ g_msg_ctrl_tbl.info[idx].h_zc_sender = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get message send handle(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ *
+ * @return Message queue handle
+ */
+static HANDLE MsgGetZcSenderHandleOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].h_zc_sender;
+}
+
+/**
+ * @brief
+ * Get message receive buffer(Message control table)
+ *
+ * @param[in] idx Control Table Element Number
+ *
+ * @return Pointer to message receive buffer
+ */
+static uint8_t* MsgGetMsgRcvBufOfCtrlTbl(uint32_t idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].msg_rcv_buf;
+}
+
+/**
+ * @brief
+ * Search unused area(Message control table)
+ *
+ * Returns the index (minimum value) for accessing the unused area in the message control table.<br>
+ * Returns the maximum message queue management value (MSG_MAX_NUM_CTRL_MSGQUE) <br>
+ * when no unused area exists
+ *
+ * @return Index for access(Unused area exists.)<br>
+ * Maximum mutex management value(No unused area)
+ */
+static u_int32 MsgSearchEmptyOfCtrlTbl(void) {
+ int32 ret;
+ u_int32 idx;
+
+ for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) {
+ ret = _tcscmp(g_msg_ctrl_tbl.info[idx].name, "");
+
+ /* For unused space */
+ if (ret == 0) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * PNO search(Message control table)
+ *
+ * Retrieves whether the specified PNO is already registered in the message control table.<br>
+ * If it is registered, the access index is returned.If it is not stored,<br>
+ * Returns the maximum message queue management value (MSG_MAX_NUM_CTRL_MSGQUE).
+ *
+ * @param[in] pno Process number
+ *
+ * @return Index for access(If it is registered)<br>
+ * Maximum value of message queue management(Not stored)
+ */
+static u_int32 MsgSearchPnoOfCtrlTbl(PNO pno) {
+ u_int32 idx;
+ PNO lPno;
+
+ for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) {
+ lPno = MsgGetPnoOfCtrlTbl(idx);
+
+ /* If there is a match */
+ if (lPno == pno) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+
+/**
+ * @brief
+ * Queue name search(Message control table)
+ *
+ * Retrieves whether the specified queue name is already registered in the message control table.<br>
+ * If it is registered, the access index is returned.If it is not stored,<br>
+ * Returns the maximum message queue management value (MSG_MAX_NUM_CTRL_MSGQUE).
+ *
+ * @param[in] Name queue-name
+ *
+ * @return Index for access(If it is registered)<br>
+ * Maximum value of message queue management(Not stored)
+ */
+static u_int32 MsgSearchNameOfCtrlTbl(LPCTSTR name) {
+ int32 ret;
+ u_int32 idx;
+
+ for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) {
+ ret = _tcscmp(g_msg_ctrl_tbl.info[idx].name, name);
+
+ /* If there is a match */
+ if (ret == 0) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+
+/**
+ * @brief
+ * Creation of Mutex for accessing the message control table
+ */
+static void MsgCreateMutex(void) {
+ g_h_mtx = _pb_CreateMutex(NULL, 0, "Msg_Mutex");
+ if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 200: can not be not NULL
+ // LCOV_EXCL_START 200: can not be not NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR [g_h_mtx:%p]", g_h_mtx);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Acquire Mutex for accessing the message control table
+ */
+static void MsgLockMutex(void) {
+ DWORD ret;
+ ret = PbMutexLock(g_h_mtx, INFINITE); // LCOV_EXCL_BR_LINE 200: mutex lock can not failed
+ if (ret != WAIT_OBJECT_0) { // LCOV_EXCL_BR_LINE 200: mutex lock can not failed
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexLock ERROR " \
+ "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: mutex lock can not failed
+
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Releasing the Mutex for accessing the message control table
+ */
+static void MsgUnlockMutex(void) {
+ BOOL ret;
+ ret = PbMutexUnlock(g_h_mtx); // LCOV_EXCL_BR_LINE 200: mutex lock can not failed
+ if (ret != TRUE) { // LCOV_EXCL_BR_LINE 200: mutex lock can not failed
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexUnlock ERROR " \
+ "[ret:%d, g_h_mtx:%p]", ret, g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: mutex lock can not failed
+
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Obtain dump information
+ *
+ * @param[out] pBuf Dump info
+ * @param[in/out] pLen Buffer size
+ */
+void _pb_GetDebugMsgMngTbl(void* pBuf, uint8_t* pLen) {
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufPositioningbaselibrarySender[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufMsg[DEBUG_DUMP_MAX_SIZE];
+ uint32_t i;
+ uint32_t e;
+ uint8_t cnt = 0;
+
+ if ((pBuf != NULL) && (pLen != NULL)) {
+ memset(&buf[0], 0x00, sizeof(buf));
+ memset(&bufMsg[0], 0x00, sizeof(bufMsg));
+ for (i = 0; i < MSG_MAX_NUM_CTRL_MSGQUE; i++) {
+ memset(&bufPositioningbaselibrarySender[0], 0x00, sizeof(bufPositioningbaselibrarySender));
+ for (e = 0; e < MSG_MAX_NUM_CTRL_THREAD; e++) {
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "[%02d]%10p ", e, g_msg_ctrl_tbl.info[i].h_positioningbaselibrary_sender[e]);
+ strncat(reinterpret_cast<char *>(&bufPositioningbaselibrarySender[0]), reinterpret_cast<char *>(&bufTmp[0]), \
+ strlen(reinterpret_cast<char *>(&bufTmp[0])));
+ }
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] pno:0x%04x, name:%16s, hSnd:%10p, hRcv:%10p, hPSnd:%s",
+ i,
+ g_msg_ctrl_tbl.info[i].pno,
+ g_msg_ctrl_tbl.info[i].name,
+ g_msg_ctrl_tbl.info[i].h_sender,
+ g_msg_ctrl_tbl.info[i].h_receiver,
+ &bufPositioningbaselibrarySender[0]);
+ strncat(reinterpret_cast<char *>(&bufMsg[0]), reinterpret_cast<char *>(&bufTmp[0]), \
+ strlen(reinterpret_cast<char *>(&bufTmp[0])));
+ if (((i+1) % 8) == 0) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Message-%d%s",
+ cnt,
+ &bufMsg[0]);
+ memcpy(pBuf, &buf[0], sizeof(buf));
+ pBuf = reinterpret_cast<void *>((reinterpret_cast<uint8_t *>(pBuf)) + sizeof(buf));
+ memset(&bufMsg[0], 0x00, sizeof(bufMsg));
+ if (cnt >= *pLen) {
+ break;
+ }
+ }
+ }
+ if (cnt < *pLen) {
+ if (bufMsg[0] != 0x00) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Message-%d%s",
+ cnt,
+ &bufMsg[0]);
+ memcpy(pBuf, &buf[0], sizeof(buf));
+ }
+ *pLen = cnt;
+ }
+ }
+}
+
+/**
+ * @brief
+ * Message Control Table Usage Counter Increment
+ *
+ * @param[in] none
+ */
+static void MsgIncUseCntOfCtrlTbl(void) {
+ g_msg_ctrl_tbl.use_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Message control table usage counter decrement
+ *
+ * @param[in] none
+ */
+static void MsgDecUseCntOfCtrlTbl(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ g_msg_ctrl_tbl.use_cnt--;
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Message Control Table Reserved Counter Increment
+ *
+ * @param[in] none
+ */
+static void MsgIncRsvCntOfCtrlTbl(void) {
+ g_msg_ctrl_tbl.rsv_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Message Control Table Reserved Counter Decrement
+ *
+ * @param[in] none
+ */
+static void MsgDecRsvCntOfCtrlTbl(void) {
+ g_msg_ctrl_tbl.rsv_cnt--;
+ return;
+}
+
+/**
+ * @brief
+ * Resource Acquisition Decision(Message control table)
+ *
+ * @param[in] none
+ *
+ * @return BOOL
+ * @retval TRUE : Normal
+ * @retval FALSE : Anomaly (Resource shortage)
+ */
+BOOL _pb_GetMsgResource(void) {
+ BOOL ret = TRUE;
+ uint32_t cnt;
+
+ MsgLockMutex();
+
+ /* Increment Message Control Table Reservation Counter */
+ MsgIncRsvCntOfCtrlTbl();
+
+ cnt = g_msg_ctrl_tbl.use_cnt + g_msg_ctrl_tbl.rsv_cnt;
+ if (cnt >= FULL_MSG_NUM_CTRL_MSGQUE) {
+ ret = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \
+ "[FATAL][use_cnt:%d rsv_cnt:%d]", g_msg_ctrl_tbl.use_cnt, g_msg_ctrl_tbl.rsv_cnt);
+ } else if (cnt >= WARN_MSG_NUM_CTRL_MSGQUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \
+ "[WARN][use_cnt:%d rsv_cnt:%d]", g_msg_ctrl_tbl.use_cnt, g_msg_ctrl_tbl.rsv_cnt);
+ }
+
+ MsgUnlockMutex();
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Resource release(Message control table)
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+void _pb_ReleaseMsgResource(void) {
+ MsgLockMutex();
+
+ /* Decrement Message Control Table Reservation Counter */
+ MsgDecRsvCntOfCtrlTbl();
+
+ MsgUnlockMutex();
+
+ return;
+}
diff --git a/vehicleservice/positioning_base_library/library/src/_pbMutex.cpp b/vehicleservice/positioning_base_library/library/src/_pbMutex.cpp
new file mode 100755
index 0000000..06254ab
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbMutex.cpp
@@ -0,0 +1,1423 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbMutex.cpp
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+
+#ifndef PT_PB_MUTEX_STUB__CWORD71_
+
+#include <vehicle_service/positioning_base_library.h>
+#include "_pbInternalProc.h"
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+#include "WPF_STD_private.h"
+#include "tchar.h"
+
+/*---------------------------------------------------------------------------------*
+ * Define *
+ *---------------------------------------------------------------------------------*/
+/* Mutex control table name (Shared Memory) */
+#define MUTEX_CTRL_TBL_NAME __TEXT("POS_BASE_MUTEX_TABLE")
+
+/*
+ Max. available Lock ID
+ Note : Lock ID application is 1 (for BaseAPI initialization) + 1 (for Mutex function control) + 30 (for provision) = 32
+*/
+#define MAX_CTRL_MUTEX_NUM (30)
+
+#define FULL_CTRL_MUTEX_NUM (MAX_CTRL_MUTEX_NUM - 4) /** Mutex control data threshold (no free) */
+#define WARN_CTRL_MUTEX_NUM (MAX_CTRL_MUTEX_NUM - 10) /** Mutex control data threshold (warning) */
+
+/*
+ ID needs to be aplicated
+
+ If you increase or decrease the IDs, define maximum number of managed LOCK IDs and
+ the default setting of "Lock ID Resource List" must also be changed.
+*/
+#define MUTEX_LOCK_ID_0 LOCK_POS_MTX_2 /* Mutex management-information-exclusive control */
+#define MUTEX_LOCK_ID_1 LOCK_POS_MTX_3
+#define MUTEX_LOCK_ID_2 LOCK_POS_MTX_4
+#define MUTEX_LOCK_ID_3 LOCK_POS_MTX_5
+#define MUTEX_LOCK_ID_4 LOCK_POS_MTX_6
+#define MUTEX_LOCK_ID_5 LOCK_POS_MTX_7
+#define MUTEX_LOCK_ID_6 LOCK_POS_MTX_8
+#define MUTEX_LOCK_ID_7 LOCK_POS_MTX_9
+#define MUTEX_LOCK_ID_8 LOCK_POS_MTX_10
+#define MUTEX_LOCK_ID_9 LOCK_POS_MTX_11
+#define MUTEX_LOCK_ID_10 LOCK_POS_MTX_12
+#define MUTEX_LOCK_ID_11 LOCK_POS_MTX_13
+#define MUTEX_LOCK_ID_12 LOCK_POS_MTX_14
+#define MUTEX_LOCK_ID_13 LOCK_POS_MTX_15
+#define MUTEX_LOCK_ID_14 LOCK_POS_MTX_16
+#define MUTEX_LOCK_ID_15 LOCK_POS_MTX_17
+#define MUTEX_LOCK_ID_16 LOCK_POS_MTX_18
+#define MUTEX_LOCK_ID_17 LOCK_POS_MTX_19
+#define MUTEX_LOCK_ID_18 LOCK_POS_MTX_20
+#define MUTEX_LOCK_ID_19 LOCK_POS_MTX_21
+#define MUTEX_LOCK_ID_20 LOCK_POS_MTX_22
+#define MUTEX_LOCK_ID_21 LOCK_POS_MTX_23
+#define MUTEX_LOCK_ID_22 LOCK_POS_MTX_24
+#define MUTEX_LOCK_ID_23 LOCK_POS_MTX_25
+#define MUTEX_LOCK_ID_24 LOCK_POS_MTX_26
+#define MUTEX_LOCK_ID_25 LOCK_POS_MTX_27
+#define MUTEX_LOCK_ID_26 LOCK_POS_MTX_28
+#define MUTEX_LOCK_ID_27 LOCK_POS_MTX_29
+#define MUTEX_LOCK_ID_28 LOCK_POS_MTX_30
+#define MUTEX_LOCK_ID_29 LOCK_POS_MTX_31
+#define MUTEX_LOCK_ID_30 LOCK_POS_MTX_32
+
+typedef int32 LOCK_ID;
+
+/*---------------------------------------------------------------------------------*
+ * Structure *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Mutex control information(Interprocess common-details)
+ */
+typedef struct {
+ LOCK_ID lock_id; /**< Lock ID */
+ TCHAR name[NAME_MAX]; /**< Mutex Name */
+ int32 ref_cnt; /**< Reference Counter */
+ uint32_t thread_id; /**< Thread IDs while Lock is being acquired (Initial value:0) Note: For debugging */
+ BOOL is_rel_fail; /**< Release failure information (Failed:TRUE) Note: For debugging */
+ BOOL is_forbid_access; /**< Deletion occurred during Lock acquisition (Deletion occurred:TRUE) Note: For debugging */
+} MUTEX_CTRL_SHARED_DETAIL;
+
+/*!
+ @brief Mutex control information (Interprocess common)
+ */
+typedef struct {
+ MUTEX_CTRL_SHARED_DETAIL detail[MAX_CTRL_MUTEX_NUM]; /**< Common Infomation */
+ uint32_t use_cnt; /**< Use Counter */
+ uint32_t rsv_cnt; /**< Reserve Counter */
+} MUTEX_CTRL_SHARED_INFO;
+
+/*!
+ @brief Mutex control information
+*/
+typedef struct {
+ HANDLE handle[MAX_CTRL_MUTEX_NUM]; /**< Mutex Handle */
+ int32 ref_cnt[MAX_CTRL_MUTEX_NUM]; /**< Reference Counter */
+ MUTEX_CTRL_SHARED_INFO* info; /**< Common Infomation */
+} MUTEX_CTRL_INFO;
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/**
+ Mutex control table pointer (Partial shared memory)
+ Note: Access to this instance shall be made through the operation module.
+ */
+static MUTEX_CTRL_INFO g_mutex_ctrl_tbl; // NOLINT(readability/nolint) global class instance
+
+static HANDLE g_h_mtx; /** Mutex control-information-locking Mutex handle */
+static HANDLE g_h_shm; /** Shared memory handle */ // Coverity CID: 18788 compliant
+
+
+/** Lock ID Resource List */
+static const LOCK_ID kLockIdList[MAX_CTRL_MUTEX_NUM] = {
+ MUTEX_LOCK_ID_1,
+ MUTEX_LOCK_ID_2,
+ MUTEX_LOCK_ID_3,
+ MUTEX_LOCK_ID_4,
+ MUTEX_LOCK_ID_5,
+ MUTEX_LOCK_ID_6,
+ MUTEX_LOCK_ID_7,
+ MUTEX_LOCK_ID_8,
+ MUTEX_LOCK_ID_9,
+ MUTEX_LOCK_ID_10,
+ MUTEX_LOCK_ID_11,
+ MUTEX_LOCK_ID_12,
+ MUTEX_LOCK_ID_13,
+ MUTEX_LOCK_ID_14,
+ MUTEX_LOCK_ID_15,
+ MUTEX_LOCK_ID_16,
+ MUTEX_LOCK_ID_17,
+ MUTEX_LOCK_ID_18,
+ MUTEX_LOCK_ID_19,
+ MUTEX_LOCK_ID_20,
+ MUTEX_LOCK_ID_21,
+ MUTEX_LOCK_ID_22,
+ MUTEX_LOCK_ID_23,
+ MUTEX_LOCK_ID_24,
+ MUTEX_LOCK_ID_25,
+ MUTEX_LOCK_ID_26,
+ MUTEX_LOCK_ID_27,
+ MUTEX_LOCK_ID_28,
+ MUTEX_LOCK_ID_29,
+ MUTEX_LOCK_ID_30,
+};
+
+/*
+ Mutex property information (Information for each process)
+ _pb_CreateMutex calls -> 1
+ DeleteMutex calls -> 0
+ Only "1" can be used in the process.
+ */
+BOOL g_is_mutex_owner_tbl[MAX_CTRL_MUTEX_NUM];
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+/* Mutex Control Table Manipulation Functions */
+static void MutexSetLockIdOfCtrlTbl(u_int32 idx, LOCK_ID l_id); /* Set Lock ID */
+static LOCK_ID MutexGetLockIdOfCtrlTbl(u_int32 idx); /* Get Lock ID */
+static void MutexSetMutexNameOfCtrlTbl(u_int32 idx, LPCTSTR name); /* Set Mutex name */
+static void MutexSetMutexHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Set Mutex handle */
+static HANDLE MutexGetMutexHandleOfCtrlTbl(u_int32 idx); /* Get Mutex Handle */
+static void MutexSetTidOfCtrlTbl(uint32_t idx, uint32_t tid); /* Set thread ID while Lock is being acquired */
+static uint32_t MutexGetTidOfCtrlTbl(uint32_t idx); /* Get thread ID while Lock is being acquired */
+static void MutexSetIsRelFailOfCtrlTbl(uint32_t idx, BOOL flag); /* Set release failure information */
+static void MutexSetIsForbidAccessOfCtrlTbl(uint32_t idx, BOOL flag); /* Set deletion occurrence while Lock is being acquired */
+static u_int32 MutexGetIdxOfCtrlTbl(HANDLE h_mutex); /* Get index for access */
+static void MutexIncRefCntOfCtrlTbl(u_int32 idx); /* Increment Mutex reference counter */
+static void MutexDecRefCntOfCtrlTbl(u_int32 idx); /* Decrement Mutex reference counter */
+static int32 MutexGetRefCntOfCtrlTbl(u_int32 idx); /* Get Mutex reference counter */
+static int32 MutexGetRefCntLocalOfCtrlTbl(u_int32 idx); /* Get mutex reference counter (in-process) */
+static u_int32 MutexSearchNameOfCtrlTbl(LPCTSTR name); /* Search mutex name */
+static u_int32 MutexSearchEmptyOfCtrlTbl(void); /* Search unused area */
+static void MutexIncUseCntOfCtrlInfo(void); /* Increment Mutex using counter */
+static void MutexDecUseCntOfCtrlInfo(void); /* Decrement Mutex using counter */
+static void MutexIncRsvCntOfCtrlInfo(void); /* Increment Mutex reserved counter */
+static void MutexDecRsvCntOfCtrlInfo(void); /* Decrement Mutex reserved counter */
+
+/* Mutex ownership-information manipulation functions */
+static void MutexSetFlagOfOwnerTbl(u_int32 idx, BOOL flag); /* Set ownership-information */
+static BOOL MutexGetFlagOfOwnerTbl(u_int32 idx); /* Get ownership-information */
+
+/* Mutex manipulation functions for accessing Mutex control tables */
+static void MutexCreateMutex(void); /* Create Mutex */
+static void MutexLockMutex(void); /* Get Mutex */
+static void MutexUnlockMutex(void); /* Release Mutex */
+static void MutexDeleteMutex(void); /* Delete Mutex */
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Initialize the mutex function
+ *
+ * Call the in-process initialization API for locking between processes that provide CLS.<br>
+ * Create shared memory for a Mutex control table.<br>
+ * Create a mutex for accessing Mutex control info.<br>
+ * If an error occurs during internal processing of this API, subsequent normal operations cannot be performed, so call _pb_Exit().
+ *
+ * @return RET_NORMAL
+ */
+RET_API MutexInit(void) {
+ RET_API ret_api = RET_NORMAL;
+ MUTEX_CTRL_SHARED_INFO **pp_tbl;
+ u_int32 idx;
+
+ memset(g_mutex_ctrl_tbl.handle, 0, sizeof(g_mutex_ctrl_tbl.handle));
+ memset(g_mutex_ctrl_tbl.ref_cnt, 0, sizeof(g_mutex_ctrl_tbl.ref_cnt));
+
+ /* Set pointer to Mutex control table */
+ pp_tbl = &(g_mutex_ctrl_tbl.info);
+
+ MutexCreateMutex(); /* Create Mutex for accessing Mutex control info */
+
+ MutexLockMutex(); /* Get Mutex for accessing Mutex control info */
+
+ /* Open the Mutex control table shared memory */
+ g_h_shm = OpenSharedMemory((TCHAR*)(MUTEX_CTRL_TBL_NAME), // NOLINT(readability/casting)
+ sizeof(MUTEX_CTRL_SHARED_INFO));
+
+ /* If called for the first time within all processes, an error occurs and the following processing is performed. */
+ if (g_h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be other val
+ /* Create shared memory for Mutex control table */
+ // LCOV_EXCL_BR_LINE 200: can not return NULL
+ g_h_shm = CreateSharedMemory((TCHAR*)MUTEX_CTRL_TBL_NAME, // NOLINT(readability/casting)
+ sizeof(MUTEX_CTRL_SHARED_INFO));
+ if (g_h_shm == NULL) /* In case of an error */ { // LCOV_EXCL_BR_LINE 200: can not return NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateShareData ERROR [hShm:%p]", g_h_shm);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: cannot return NULL
+ /* don't arrive here. */
+ }
+ }
+
+ MutexUnlockMutex(); /* Release of Mutex for accessing Mutex control info */
+
+ /* Set addresses of the acquired shared memory as a pointer of the Mutex control table. */
+ *pp_tbl = reinterpret_cast<MUTEX_CTRL_SHARED_INFO*>(GetSharedMemoryPtr(g_h_shm));
+
+ /* Initialize various information of control table */
+ for (idx = 0; idx < MAX_CTRL_MUTEX_NUM; idx++) {
+ /* Set Lock ID in Mutex control table(Overwrite from the second process onwards) */
+ MutexSetLockIdOfCtrlTbl(idx, kLockIdList[idx]);
+
+ MutexSetFlagOfOwnerTbl(idx, FALSE);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Terminate
+ */
+RET_API MutexTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+
+ CloseSharedMemory(g_h_shm);
+
+ MutexDeleteMutex();
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create Mutex
+ *
+ * Create a named mutex that can be locked between processes.
+ *
+ * @param[in] lp_mutex_attributes Security descriptor(Unused)
+ * @param[in] b_initial_owner Initial owner flag(Unused)
+ * @param[in] lp_name Mutex name
+ *
+ * @return Except NULL Handle of the created mutex (Management information pointer)<br>
+ * NULL ABEND
+ */
+HANDLE _pb_CreateMutex(LPSECURITY_ATTRIBUTES lp_mutex_attributes, // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ BOOL b_initial_owner, LPCTSTR lp_name) {
+ int32 idx; /* For accessing Mutex control table */
+ HANDLE h_mutex = NULL; /* Mutex handle */
+ void *p_addr;
+ int32 errno;
+ LOCK_ID lock_id;
+ size_t len;
+
+ /* Null check */
+ if (lp_name == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!!");
+ } else {
+ len = _tcslen(lp_name);
+ if (len >= NAME_MAX) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! " \
+ "Length of mutex name is too long(>=%d). [len:%zu]", NAME_MAX, len);
+ } else {
+ MutexLockMutex(); /* Get Mutex for accessing Mutex control info */
+
+ /* Retrieve whether the specified mutex name exists in the Mutex control table */
+ idx = MutexSearchNameOfCtrlTbl(lp_name);
+
+ /* Already assigned */
+ if (idx != MAX_CTRL_MUTEX_NUM) {
+ /* Get mutex handle from Mutex control table */
+ h_mutex = MutexGetMutexHandleOfCtrlTbl(idx);
+
+ /* First-time creation within a process */
+ if (h_mutex == NULL) {
+ /* Get Lock ID */
+ lock_id = MutexGetLockIdOfCtrlTbl(idx);
+
+ /* Lock information mapping (CLS) */
+ p_addr = CL_LockMap(lock_id); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* In case of an error */
+ if (p_addr == MAP_FAILED) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Output an error log and return an error value */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockMap ERROR!! [p_addr:%p, errno:%d]", p_addr, errno);
+ } else {
+ /* Successful allocation */
+ /* Set Mutex handle in the mutex management table */
+ MutexSetMutexHandleOfCtrlTbl(idx, (HANDLE)p_addr);
+
+ h_mutex = (HANDLE)p_addr;
+ }
+ }
+
+ if (h_mutex != NULL) { // LCOV_EXCL_BR_LINE 200: h_mutex can not be NULL
+ /* Increment Mutex reference counter */
+ MutexIncRefCntOfCtrlTbl(idx);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__,
+ "### MUTEX TABLE INFORMATION # (+) idx:%d HANDLE:%p, " \
+ "ref_cnt:%d, LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d",
+ idx,
+ g_mutex_ctrl_tbl.handle[idx],
+ g_mutex_ctrl_tbl.ref_cnt[idx],
+ g_mutex_ctrl_tbl.info->detail[idx].lock_id,
+ g_mutex_ctrl_tbl.info->detail[idx].name,
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt,
+ g_mutex_ctrl_tbl.info->detail[idx].thread_id,
+ g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail,
+ g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access);
+ }
+ } else {
+ /* For a new assignment */
+ /* Get the free space in the mutex management table. */
+ idx = MutexSearchEmptyOfCtrlTbl();
+
+ /* Get Lock ID */
+ lock_id = MutexGetLockIdOfCtrlTbl(idx);
+
+ /* Lock information mapping (CLS) */
+ p_addr = CL_LockMap(lock_id);
+
+ /* In case of an error */
+ if (p_addr == MAP_FAILED) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Output an error log and return an error value. */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockMap ERROR!! " \
+ "[p_addr:%p, errno:%d] In _pb_CreateMutex", p_addr, errno);
+ } else {
+ /* Successful allocation */
+ /* Set Mutex Hanlde in the mutex management table */
+ MutexSetMutexHandleOfCtrlTbl(idx, (HANDLE)p_addr);
+
+ /* Set the mutex name in the mutex management table */
+ MutexSetMutexNameOfCtrlTbl(idx, lp_name);
+
+ /* Increment Mutex reference counter */
+ MutexIncRefCntOfCtrlTbl(idx);
+
+ /* Increment mutex using counter */
+ MutexIncUseCntOfCtrlInfo();
+
+ h_mutex = (HANDLE)p_addr;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__,
+ "### MUTEX TABLE INFORMATION # (++) idx:%d HANDLE:%p, ref_cnt:%d, " \
+ "LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d",
+ idx,
+ g_mutex_ctrl_tbl.handle[idx],
+ g_mutex_ctrl_tbl.ref_cnt[idx],
+ g_mutex_ctrl_tbl.info->detail[idx].lock_id,
+ g_mutex_ctrl_tbl.info->detail[idx].name,
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt,
+ g_mutex_ctrl_tbl.info->detail[idx].thread_id,
+ g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail,
+ g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access);
+ }
+ }
+
+ if (h_mutex != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ /* Update Mutex ownership */
+ MutexSetFlagOfOwnerTbl(idx, TRUE);
+ }
+
+ /* Release the Mutex for accessing Mutex control info */
+ MutexUnlockMutex();
+ }
+ }
+
+ return h_mutex;
+}
+
+/**
+ * @brief
+ * Delete the mutex
+ *
+ * Decrement the Mutex reference counter and delete it when it reaches zero.
+ *
+ * @param[in] h_mutex Mutex handle (CreateMutex return value)
+ *
+ * @return WAIT_OBJECT_0 Normal completion<br>
+ * WAIT_FAILED ABEND
+ */
+DWORD PbDeleteMutex(HANDLE h_mutex) {
+ DWORD lret = WAIT_OBJECT_0;
+ u_int32 idx;
+ int32 ref_cnt;
+ int32 ret;
+ BOOL is_owner;
+ uint32_t tid;
+
+ /* Null check */
+ if (h_mutex == NULL) { // LCOV_EXCL_BR_LINE 6: h_mutex cannot be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 6: h_mutex cannot be NULL
+ } else {
+ MutexLockMutex(); /* Get Mutex for accessing Mutex control info */
+
+ /* Retrieve the index of the management table containing the Mutex handles */
+ idx = MutexGetIdxOfCtrlTbl(h_mutex);
+ /* When the specified Mutex handle is not registered */
+ if (idx == MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 200: idx can no be MAX_CTRL_MUTEX_NUM
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "Argment ERROR [h_mutex:%p]", h_mutex);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 200: idx can no be MAX_CTRL_MUTEX_NUM
+ } else {
+ /* If it is registered */
+ /* Determinate its ownership */
+ is_owner = MutexGetFlagOfOwnerTbl(idx);
+ if (is_owner == TRUE) {
+ /* Get Mutex reference counter */
+ ref_cnt = MutexGetRefCntOfCtrlTbl(idx);
+
+ /* No clients are using the specified Mutex. */
+ if ((ref_cnt - 1) <= 0) {
+ /* Lock information unmapping (CLS) */
+ ret = CL_LockUnmap(reinterpret_cast<void*>(h_mutex)); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When an error occurs */
+ if (ret == -1) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockUnmap ERROR");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ /* If successful */
+ /* Remove Mutex hanlde from Mutex control table */
+ MutexSetMutexHandleOfCtrlTbl(idx, NULL);
+
+ /* Delete the mutex name from the Mutex control table */
+ MutexSetMutexNameOfCtrlTbl(idx, "");
+
+ /* Update Mutex ownership */
+ MutexSetFlagOfOwnerTbl(idx, FALSE);
+
+ /* Decrement Mutex reference counter */
+ MutexDecRefCntOfCtrlTbl(idx);
+
+ /* Decrement mutex using counter */
+ MutexDecUseCntOfCtrlInfo();
+
+ tid = MutexGetTidOfCtrlTbl(idx);
+ if (tid != 0) { // LCOV_EXCL_BR_LINE 200: tid can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ MutexSetIsForbidAccessOfCtrlTbl(idx, TRUE); // LCOV_EXCL_LINE 200: tid can not be 0
+ }
+
+ /* Initialize debug information */
+ MutexSetTidOfCtrlTbl(idx, 0);
+ MutexSetIsRelFailOfCtrlTbl(idx, FALSE);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__,
+ "### MUTEX TABLE INFORMATION # (--) idx:%d HANDLE:%p, ref_cnt(local):%d, " \
+ "LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d",
+ idx,
+ g_mutex_ctrl_tbl.handle[idx],
+ g_mutex_ctrl_tbl.ref_cnt[idx],
+ g_mutex_ctrl_tbl.info->detail[idx].lock_id,
+ g_mutex_ctrl_tbl.info->detail[idx].name,
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt,
+ g_mutex_ctrl_tbl.info->detail[idx].thread_id,
+ g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail,
+ g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access);
+ }
+ } else {
+ /* If exists */
+ /* Determine if any clients are referencing in the process */
+ ref_cnt = MutexGetRefCntLocalOfCtrlTbl(idx);
+ if ((ref_cnt - 1) <= 0) { // LCOV_EXCL_BR_LINE 200: ref_cnt can not bigger than 1
+ // LCOV_EXCL_START 200: ref_cnt can not bigger than 1
+ //AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Lock information unmapping (CLS) */
+ ret = CL_LockUnmap(reinterpret_cast<void*>(h_mutex));
+ /* When an error occurs */
+ if (ret == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockUnmap ERROR");
+ lret = WAIT_FAILED; /* ABEND */
+ } else {
+ /* If successful */
+ /* Remove Mutex Hanlde from the Mutex control table */
+ MutexSetMutexHandleOfCtrlTbl(idx, NULL);
+
+ /* Update Mutex ownership */
+ MutexSetFlagOfOwnerTbl(idx, FALSE);
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ if (lret == WAIT_OBJECT_0) {
+ /* Decrement Mutex refernce counter */
+ MutexDecRefCntOfCtrlTbl(idx);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__,
+ "### MUTEX TABLE INFORMATION # (-) idx:%d HANDLE:%p, ref_cnt(local):%d, " \
+ "LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d",
+ idx,
+ g_mutex_ctrl_tbl.handle[idx],
+ g_mutex_ctrl_tbl.ref_cnt[idx],
+ g_mutex_ctrl_tbl.info->detail[idx].lock_id,
+ g_mutex_ctrl_tbl.info->detail[idx].name,
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt,
+ g_mutex_ctrl_tbl.info->detail[idx].thread_id,
+ g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail,
+ g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access);
+ }
+ }
+
+ } else { // LCOV_EXCL_BR_LINE 200: is_owner can not be FALSE
+ /* If it is not the owner */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; // LCOV_EXCL_LINE 200: is_owner can not be FALSE
+ }
+ }
+
+ MutexUnlockMutex(); /* Release of Mutex for accessing Mutex control info */
+ }
+
+ return lret;
+}
+
+/**
+ * @brief
+ * Mutex Lock
+ *
+ * Take ownership of the mutex and start locking.
+ *
+ * @param[in] h_mutex Mutex handle(CreateMutex return value)
+ * @param[in] timeout Timeout (Millisecond)
+ *
+ * @return WAIT_OBJECT_0 Succeeded to get ownership<br>
+ * WAIT_TIMEOUT Failed to get ownership (Timeout)<br>
+ * WAIT_FAILED Failed to get ownership (Error)
+ */
+DWORD PbMutexLock(HANDLE h_mutex, DWORD timeout) {
+ DWORD lret = WAIT_OBJECT_0;
+ int32 ret;
+ DWORD time_out_cnt = 0;
+ u_int32 idx;
+ BOOL is_owner;
+ uint32_t tid;
+
+ /* Null check */
+ if (h_mutex == NULL) { // LCOV_EXCL_BR_LINE 6: h_mutex cannot be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 6: h_mutex cannot be NULL
+ } else {
+ /* Retrieve the index of the management table containing the Mutex handles */
+ idx = MutexGetIdxOfCtrlTbl(h_mutex);
+ /* When the specified Mutex handle is not registered */
+ if (idx == MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot be MAX_CTRL_MUTEX_NUM
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [h_mutex:%p, idx:%d]", \
+ h_mutex, idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 6: idx cannot be MAX_CTRL_MUTEX_NUM
+ } else {
+ /* If it is registered */
+ /* Determinate ownership */
+ is_owner = MutexGetFlagOfOwnerTbl(idx);
+ if (is_owner == TRUE) {
+ tid = PbGetTid();
+
+ /* No timeout specified */
+ if (timeout == INFINITE) { // LCOV_EXCL_BR_LINE 6: timeout will not be other case
+ /* Get Lock (CLS) */
+ ret = CL_LockGet(reinterpret_cast<void*>(h_mutex)); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) /* In case of ABEND */ { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockGet ERROR [h_mutex:%p, ret:%d]", h_mutex, ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ /* Set thread ID during lock */
+ MutexSetTidOfCtrlTbl(idx, tid);
+ }
+ } else {
+ // LCOV_EXCL_START 6: timeout will not be other case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Timeout specified */
+ while (1) {
+ /* Get Lock (CLS) */
+ ret = CL_LockNowait(reinterpret_cast<void*>(h_mutex));
+ if (ret != 0) /* In case of ABEND */ {
+ /* Invalid parameter */
+ if (ret != EBUSY) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockGet ERROR [h_mutex:%p, ret:%d]", h_mutex, ret);
+ lret = WAIT_FAILED; /* ABEND */
+ break;
+ }
+
+ time_out_cnt++;
+ if (time_out_cnt <= timeout) {
+ usleep(1000);
+ } else {
+ /* Timeout error */
+ lret = WAIT_TIMEOUT;
+ break;
+ }
+ } else {
+ /* Successful acquisition */
+ /* Set thread ID during lock */
+ MutexSetTidOfCtrlTbl(idx, tid);
+
+ break;
+ }
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else { // LCOV_EXCL_BR_LINE 200: is_owner can not be FALSE
+ /* If it is not the owner */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; // LCOV_EXCL_LINE 200: is_owner can not be FALSE
+ }
+ }
+ }
+
+ return lret;
+}
+
+/**
+ * @brief
+ * Mutex Unlock
+ *
+ * Release the mutex ownership and terminate the lock.
+ *
+ * @param[in] h_mutex Mutex handle(CreateMutex return value)
+ *
+ * @return TURE Normal<br>
+ * FALSE Error
+ */
+BOOL PbMutexUnlock(HANDLE h_mutex) {
+ BOOL bret = FALSE;
+ int32 ret;
+ u_int32 idx;
+ BOOL is_owner;
+ uint32_t tid;
+
+ /* Null check */
+ if (h_mutex == NULL) { // LCOV_EXCL_BR_LINE 6: h_mutex can not be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR");
+ } else {
+ /* Retrieve the index of the management table containing the Mutex handle */
+ idx = MutexGetIdxOfCtrlTbl(h_mutex);
+ /* When the specified Mutex handle is not registered */
+ if (idx == MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 200: idx can not be MAX_CTRL_MUTEX_NUM
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "MutexGetIdxOfCtrlTbl ERROR [h_mutex:%p, idx:%d]", h_mutex, idx);
+ } else {
+ /* If it is registered */
+ /* Determinate ownership */
+ is_owner = MutexGetFlagOfOwnerTbl(idx);
+ if (is_owner == TRUE) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Release thread ID setting during lock */
+ MutexSetTidOfCtrlTbl(idx, 0);
+
+ /* Release the Lock */
+ ret = CL_LockRelease(reinterpret_cast<void*>(h_mutex));
+ if (ret == 0) /* If successful */ { // LCOV_EXCL_BR_LINE 4: nsfw error
+ bret = TRUE;
+
+ } else { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Failed */
+ tid = PbGetTid();
+
+ /* Retry to set the thread ID during lock */
+ MutexSetTidOfCtrlTbl(idx, tid);
+
+ /* Add the release failure information */
+ MutexSetIsRelFailOfCtrlTbl(idx, TRUE);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockRelease ERROR [h_mutex:%p, ret:%d]", h_mutex, ret);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+
+ return bret;
+}
+
+/*---------------------------------------------------------------------------------*
+ * Local Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Set the Lock ID (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] l_id Lock ID
+ */
+static void MutexSetLockIdOfCtrlTbl(u_int32 idx, LOCK_ID l_id) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, l_id:%d]", idx, l_id);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_mutex_ctrl_tbl.info->detail[idx].lock_id = l_id;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get the Lock ID (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ */
+static LOCK_ID MutexGetLockIdOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_mutex_ctrl_tbl.info->detail[idx].lock_id;
+}
+
+/**
+ * @brief
+ * Set the Mutex name (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] name Mutex name
+ */
+static void MutexSetMutexNameOfCtrlTbl(u_int32 idx, LPCTSTR name) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, name:%s]", idx, name);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ _tcscpy(g_mutex_ctrl_tbl.info->detail[idx].name, name);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Set the Mutex handle (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] handle Mutex handle
+ */
+static void MutexSetMutexHandleOfCtrlTbl(u_int32 idx, HANDLE handle) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_mutex_ctrl_tbl.handle[idx] = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get the Mutex handle (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ *
+ * @return Mutex handle
+ */
+static HANDLE MutexGetMutexHandleOfCtrlTbl(u_int32 idx) {
+ HANDLE handle = NULL;
+
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ handle = g_mutex_ctrl_tbl.handle[idx];
+ }
+
+ return handle;
+}
+
+/**
+ * @brief
+ * Set the thread ID during lock acquisition (Mutex control table)
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] tid Thread ID
+ * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ */
+static void MutexSetTidOfCtrlTbl(uint32_t idx, uint32_t tid) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_mutex_ctrl_tbl.info->detail[idx].thread_id = tid;
+ }
+
+ return;
+}
+
+
+/**
+ * @brief
+ * Get the thread ID during lock acquisition (Mutex control table)
+ *
+ * @param[in] idx Control table accessor
+ *
+ * @return Thread ID
+ *
+ * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ */
+static uint32_t MutexGetTidOfCtrlTbl(uint32_t idx) {
+ uint32_t tid = 0;
+
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ tid = g_mutex_ctrl_tbl.info->detail[idx].thread_id;
+ }
+
+ return tid;
+}
+
+
+/**
+ * @brief
+ * Set the release failure information (Mutex control table)
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] flag Failed to release:TURE
+ * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ */
+static void MutexSetIsRelFailOfCtrlTbl(uint32_t idx, BOOL flag) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail = flag;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Set deletion-occurrence information during Lock acquisition (Mutex control table)
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] flag When deletion occurs while Lock is being acquired:TRUE
+ * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ */
+static void MutexSetIsForbidAccessOfCtrlTbl(uint32_t idx, BOOL flag) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access = flag;
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get index for access (Mutex control table)
+ *
+ * Return the index for accessing the area of the Mutex control table in which <br>
+ * the specified mutex handle is registered. If the specified handle is not <br>
+ * registered, the maximum number of mutex management (MAX_MUTEX_CTRL_NUM) is returned.
+ *
+ * @param[in] h_mutex Mutex handle
+ *
+ * @return Index for access (Specified handle is already registered)<br>
+ * Maximum mutex management value (Specified handle is not registered)
+ */
+static u_int32 MutexGetIdxOfCtrlTbl(HANDLE h_mutex) {
+ u_int32 idx;
+ HANDLE handle;
+
+ for (idx = 0; idx < MAX_CTRL_MUTEX_NUM; idx++) {
+ /* Get handle from Mutex control table */
+ handle = MutexGetMutexHandleOfCtrlTbl(idx);
+
+ if (handle == h_mutex) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Increment the Mutex reference counter (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ */
+static void MutexIncRefCntOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt++;
+ g_mutex_ctrl_tbl.ref_cnt[idx]++;
+
+ return;
+}
+
+/**
+ * @brief
+ * Decrement the Mutex reference counter (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ */
+static void MutexDecRefCntOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt--;
+ g_mutex_ctrl_tbl.ref_cnt[idx]--;
+
+ return;
+}
+
+/**
+ * @brief
+ * Get the Mutex Reference Counter (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ *
+ * @return Reference counter value
+ */
+static int32 MutexGetRefCntOfCtrlTbl(u_int32 idx) {
+ int32 ret = 0;
+
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ ret = g_mutex_ctrl_tbl.info->detail[idx].ref_cnt;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Get mutex reference counter (in-process)(Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ *
+ * @return Reference counter value
+ */
+static int32 MutexGetRefCntLocalOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_mutex_ctrl_tbl.ref_cnt[idx];
+}
+
+/**
+ * @brief
+ * Search mutex name (Mutex control table)
+ *
+ * Retrieve whether the specified mutex is already registered in the Mutex control table.<br>
+ * If it is registered, the access index is returned.If it is not registered,<br>
+ * return the maximum mutex management value(MAX_CTRL_MUTEX_NUM).
+ *
+ * @param[in] name Mutex name
+ *
+ * @return Index for access(If it is registered)<br>
+ * Maximum mutex management value (Not registered)
+ */
+static u_int32 MutexSearchNameOfCtrlTbl(LPCTSTR name) {
+ int32 ret;
+ u_int32 idx;
+
+ for (idx = 0; idx < MAX_CTRL_MUTEX_NUM; idx++) {
+ ret = _tcscmp(g_mutex_ctrl_tbl.info->detail[idx].name, name);
+
+ /* If there is a match */
+ if (ret == 0) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Search unused area (Mutex control table)
+ *
+ * Return the lowest-numbered index for accessing unused space in the Mutex control table.<br>
+ * Return the maximum value((MAX_CTRL_MUTEX_NUM)) of message queue management <br>
+ * when no unused area exists.
+ *
+ * @return Index for access (Unused area exists)<br>
+ * Maximum mutex management value (No unused area)
+ */
+static u_int32 MutexSearchEmptyOfCtrlTbl(void) {
+ u_int32 idx;
+
+ idx = MutexSearchNameOfCtrlTbl("");
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Set the Mutex ownership flag (Ownership-information table)
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] flag ownership-information
+ */
+static void MutexSetFlagOfOwnerTbl(u_int32 idx, BOOL flag) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, flag:%d]", idx, flag);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_is_mutex_owner_tbl[idx] = flag;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get the Mutex ownership flag (Ownership-information table)
+ *
+ * @param[in] idx Control table accessor
+ *
+ * @return TRUE Owned
+ * FALSE Not owned
+ */
+static BOOL MutexGetFlagOfOwnerTbl(u_int32 idx) {
+ BOOL bret = FALSE;
+
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ bret = g_is_mutex_owner_tbl[idx];
+ }
+
+ return bret;
+}
+
+/**
+ * @brief
+ * Create Mutex for accessing the Mutex control table
+ */
+static void MutexCreateMutex(void) {
+ g_h_mtx = (HANDLE)CL_LockMap(MUTEX_LOCK_ID_0); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockMap ERROR [g_h_mtx:%p]", g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Delete Mutex for accessing Mutex control table
+ */
+static void MutexDeleteMutex(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 ret;
+
+ ret = CL_LockUnmap(g_h_mtx);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockUnmap ERROR [g_h_mtx:%p, ret:%d]", g_h_mtx, ret);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get Mutex for accessing Mutex control table
+ */
+static void MutexLockMutex(void) {
+ int32 ret;
+
+ ret = CL_LockGet(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockGet ERROR [g_h_mtx:%p, ret:%d]", g_h_mtx, ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Release Mutex for accessing Mutex control table
+ */
+static void MutexUnlockMutex(void) {
+ int32 ret;
+
+ ret = CL_LockRelease(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockRelease ERROR [g_h_mtx:%p, ret:%d]", g_h_mtx, ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get dump information
+ *
+ * @param[out] p_buf Dump info
+ * @param[in/out] p_len Buffer size
+ */
+void _pb_GetDebugMutexMngTbl(void* p_buf, uint8_t* p_len) {
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_tmp[512];
+ static uint8_t buf_info[DEBUG_DUMP_MAX_SIZE];
+ uint32_t i;
+ uint8_t cnt = 0;
+
+ if ((p_buf != NULL) && (p_len != NULL)) {
+ memset(&buf[0], 0x00, sizeof(buf));
+ memset(&buf_info[0], 0x00, sizeof(buf_info));
+ for (i = 0; i < MAX_CTRL_MUTEX_NUM; i++) {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%02d]id:%10d, nm:%40s, ref_cnt:%10d, tid:%03d, fail:%01d, " \
+ "forbid:%01d, handle:%10p, ref_cnt(local):%10d",
+ i,
+ g_mutex_ctrl_tbl.info->detail[i].lock_id,
+ g_mutex_ctrl_tbl.info->detail[i].name,
+ g_mutex_ctrl_tbl.info->detail[i].ref_cnt,
+ g_mutex_ctrl_tbl.info->detail[i].thread_id,
+ g_mutex_ctrl_tbl.info->detail[i].is_rel_fail,
+ g_mutex_ctrl_tbl.info->detail[i].is_forbid_access,
+ g_mutex_ctrl_tbl.handle[i],
+ g_mutex_ctrl_tbl.ref_cnt[i]);
+ strncat(reinterpret_cast<char *>(&buf_info[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ if (((i + 1) % 10) == 0) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Mutex-%d%s",
+ cnt,
+ &buf_info[0]);
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ p_buf = reinterpret_cast<void *>((reinterpret_cast<uint8_t *>(p_buf)) + sizeof(buf));
+ memset(&buf_info[0], 0x00, sizeof(buf_info));
+ if (cnt >= *p_len) {
+ break;
+ }
+ }
+ }
+ if (cnt < *p_len) {
+ if (buf_info[0] != 0x00) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Mutex-%d%s",
+ cnt,
+ &buf_info[0]);
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ }
+ *p_len = cnt;
+ }
+ }
+}
+
+/**
+ * @brief
+ * Increment the Mutex using counter
+ *
+ * @param[in] none
+ */
+static void MutexIncUseCntOfCtrlInfo(void) {
+ g_mutex_ctrl_tbl.info->use_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Decrement Mutex using counter
+ *
+ * @param[in] none
+ */
+static void MutexDecUseCntOfCtrlInfo(void) {
+ g_mutex_ctrl_tbl.info->use_cnt--;
+ return;
+}
+
+/**
+ * @brief
+ * Increment Mutex reserved counter
+ *
+ * @param[in] none
+ */
+static void MutexIncRsvCntOfCtrlInfo(void) {
+ g_mutex_ctrl_tbl.info->rsv_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Decrement Mutex reserved counter
+ *
+ * @param[in] none
+ */
+static void MutexDecRsvCntOfCtrlInfo(void) {
+ g_mutex_ctrl_tbl.info->rsv_cnt--;
+ return;
+}
+
+/**
+ * @brief
+ * Determine resources ready (Mutex control data)
+ *
+ * @param[in] none
+ *
+ * @return BOOL
+ * @retval TRUE : Normal
+ * @retval FALSE : Error (Resource shortage)
+ */
+BOOL _pb_GetMutexResource(void) {
+ BOOL ret = TRUE;
+ uint32_t cnt;
+
+ MutexLockMutex();
+
+ /* Increment Mutex reserved counter */
+ MutexIncRsvCntOfCtrlInfo();
+
+ cnt = g_mutex_ctrl_tbl.info->use_cnt + g_mutex_ctrl_tbl.info->rsv_cnt;
+ if (cnt >= FULL_CTRL_MUTEX_NUM) {
+ ret = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "Lack of resources [FATAL][use_cnt:%d rsv_cnt:%d]", g_mutex_ctrl_tbl.info->use_cnt, \
+ g_mutex_ctrl_tbl.info->rsv_cnt);
+ } else if (cnt >= WARN_CTRL_MUTEX_NUM) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "Lack of resources [WARN][use_cnt:%d rsv_cnt:%d]", g_mutex_ctrl_tbl.info->use_cnt, \
+ g_mutex_ctrl_tbl.info->rsv_cnt);
+ }
+
+ MutexUnlockMutex();
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Release resources (Mutex control data)
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+void _pb_ReleaseMutexResource(void) {
+ MutexLockMutex();
+
+ /* Decrement Mutex reserved counter */
+ MutexDecRsvCntOfCtrlInfo();
+
+ MutexUnlockMutex();
+
+ return;
+}
+#endif /* PT_PB_MUTEX_STUB__CWORD71_ */
diff --git a/vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp b/vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp
new file mode 100755
index 0000000..c38016a
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp
@@ -0,0 +1,541 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbOSCtrl.cpp
+ System name :
+ Subsystem name :
+ Title :
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <unistd.h>
+#include <stdint.h>
+#include <sys/mman.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+#include "_pbSerial.h"
+/* For CreateFile--> */
+#include <sys/select.h>
+#include <fcntl.h>
+#include <strings.h>
+#include <termios.h>
+/* For CreateFile <-- */
+
+#define GPS_FUNC_DEBUG_MSG__CWORD71__FILE 0
+
+#if GPS_FUNC_DEBUG_MSG__CWORD71__FILE
+#define FILE_OUT_LINE 50
+static u_int8 file_buf[FILE_OUT_LINE][1024];
+static u_int16 line_size_buf[FILE_OUT_LINE];
+
+/* Log destination selection (Activate the one you want to output.) */
+#define POS_GPS_R_LOGFILE_PATH "/nv/BS/vs/positioning_base_library/rwdata/Test_Pos_gps_read_data.txt"
+#define POS_GPS_W_LOGFILE_PATH "/nv/BS/vs/positioning_base_library/rwdata/Test_Pos_gps_write_data.txt"
+
+#endif /* GPS_FUNC_DEBUG_MSG__CWORD71__FILE */
+
+/* For CreateFile--> */
+#define BAUDRATE B9600
+#define MODEMDEVICE "/dev/tty.gps"
+/* For CreateFile <-- */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : ClearCommError
+* ABSTRACT : Get the communication error information and report the current status of the communication device.
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Wait for replacement */
+BOOL ClearCommError(HANDLE h_file, LPDWORD lp_errors, LPCOMSTAT lp_stat) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+// LCOV_EXCL_STOP
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : GetCommState
+* ABSTRACT : Store the current control settings of the specified communication device in the device control block (DCB struct).
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Wait for replacement */ /* TODO IHFLOW OHFLOW declarations are missing */
+BOOL GetCommState(HANDLE h_file, LPDCB lp_dcb) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 1;
+// LCOV_EXCL_STOP
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : GetCommTimeouts
+* ABSTRACT : Get the timeout parameters for all read and write operations performed on the specified communication device.
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+BOOL GetCommTimeouts(HANDLE h_file, LPCOMMTIMEOUTS lp_comm_timeouts) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if 1 /* GPF */
+ BOOL bret = FALSE;
+ DWORD dw_read = 0;
+ DWORD dw_write = 0;
+
+ if ((INVALID_HANDLE_VALUE != h_file) && (NULL != lp_comm_timeouts)) {
+ /* Initialization */
+ memset(lp_comm_timeouts, 0, sizeof(COMMTIMEOUTS));
+ bret = SerialObjectTimeoutGet(h_file, &dw_read, &dw_write);
+ if (TRUE == bret) {
+ lp_comm_timeouts->write_total_timeout_constant = dw_write;
+ if (0 == dw_read) {
+ /* Return as 0? or return this setting? */
+ lp_comm_timeouts->read_interval_timeout = INFINITE;
+ lp_comm_timeouts->read_total_timeout_constant = 0;
+ lp_comm_timeouts->read_total_timeout_multiplier = 0;
+ } else {
+ lp_comm_timeouts->read_total_timeout_constant = dw_read;
+ }
+ } else {
+ /* not exist in the list */
+ lp_comm_timeouts->write_total_timeout_constant = INFINITE;
+ lp_comm_timeouts->read_total_timeout_constant = INFINITE;
+ bret = TRUE;
+ }
+ }
+
+ return bret;
+
+#endif /* GPF */
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Clear Communication Buffer
+ *
+ * Discard all characters in the output buffer or input buffer of the specified resource
+ *
+ *
+ * @param[in] h_file Handle of the communication resource
+ * @param[in] dw_flags Operation to perform
+ *
+ * @return Processing result
+ * @retval TRUE processing succeeded
+ * @retval FALSE Processing failed
+ */
+BOOL PurgeComm(HANDLE h_file, DWORD dw_flags) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL ret = 0;
+ int res = -1;
+ /* h_file is FD, and less than INT_MAX(0x7fffffff) */
+ /* Flush received but unreceived data */
+ res = tcflush(static_cast<int>((long)h_file), TCIFLUSH); // NOLINT(runtime/int)
+ if (res != -1) {
+ ret = 1;
+ }
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : SetCommMask
+* ABSTRACT : Specify a set of events to monitor for a specific communication device.
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+BOOL SetCommMask(HANDLE h_file, DWORD dw_evt_mask) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if 1 /* GPF */
+ BOOL bret = FALSE;
+
+ bret = SerialObjectWaitmaskAdd(h_file, dw_evt_mask);
+ return bret;
+#endif /* GPF */
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ *
+ * Communication setting
+ *
+ * Set the serial communication according to the setting information.
+ *
+ * @param[in] h_file Communication handle
+ * @param[in] lp_dcb Serial port setting information
+ *
+ * @return Processing result
+ * @retval TRUE processing succeeded
+ * @retval FALSE Processing failed
+ */
+BOOL SetCommState(HANDLE h_file, LPDCB lp_dcb) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ struct termios newtio;
+#if 1
+ bzero(&newtio, sizeof(newtio));
+ cfmakeraw(&newtio); /* RAW mode */
+ newtio.c_cflag |= (BAUDRATE | CS8 | CLOCAL | CREAD);/*Baud:9600*/
+ newtio.c_lflag &= ~ECHO;
+#endif
+ /* h_file is FD, and less than INT_MAX(0x7fffffff) */
+ tcflush(static_cast<int>((long)h_file), TCIFLUSH); // NOLINT(runtime/int)
+ tcsetattr(static_cast<int>((long)h_file), TCSANOW, &newtio); // NOLINT(runtime/int)
+
+ return 1;
+}
+// LCOV_EXCL_STOP
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : SetCommTimeouts
+* ABSTRACT : Set the timeout parameter for all read and write operations performed on the specified communication device.
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+BOOL SetCommTimeouts(HANDLE h_file, LPCOMMTIMEOUTS lp_comm_timeouts) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if 1 /* GPF */
+ BOOL bret = FALSE;
+ DWORD dw_read_timeout = INFINITE;
+ DWORD dw_write_timeout = INFINITE;
+
+ /* Calculate timeout time */
+ if ((INFINITE == lp_comm_timeouts->read_interval_timeout)
+ && (0 == lp_comm_timeouts->read_total_timeout_constant)
+ && (0 == lp_comm_timeouts->read_total_timeout_multiplier)) {
+ /* Set without waiting */
+ dw_read_timeout = 0;
+ } else {
+ dw_read_timeout = lp_comm_timeouts->read_total_timeout_constant;
+ }
+
+
+ dw_write_timeout = lp_comm_timeouts->write_total_timeout_constant;
+
+ bret = SerialObjectTimeoutAdd(h_file, dw_read_timeout, dw_write_timeout);
+
+ return bret;
+#endif /* GPF */
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ *
+ * Waiting for communication event
+ *
+ * Wait for an event to be generated for a specified handle
+ * Note : Continue to wait indefinitely until data reception/error occurs
+ *
+ * @param[in] h_file Communication handle
+ * @param[out] lp_evt_mask Pointer to the variable to receive the event
+ * @param[in] lp_overlapped OVERLAPPED Pointer to a struct[Note:Not used]
+ *
+ * @return Processing result
+ * @retval TRUE Processing succeeded
+ * @retval FALSE Processing failed
+ */
+BOOL WaitCommEvent(HANDLE h_file, LPDWORD lp_evt_mask, LPOVERLAPPED lp_overlapped) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL ret = 0;
+ int res = -1;
+ int fd;
+ fd_set fds_set_err;
+ fd_set fds_set; // Set of file descriptor
+
+ struct timeval tv;
+
+ /* Monitor for 0.5 seconds */
+ tv.tv_sec = 1;
+ tv.tv_usec = 0;
+ /* h_file is FD, and less than INT_MAX(0x7fffffff) */
+ fd = static_cast<int>((long)h_file); // NOLINT(runtime/int)
+
+ /* Initialization */
+ FD_ZERO(&fds_set);
+ FD_ZERO(&fds_set_err);
+
+ FD_SET(fd, &fds_set);
+ FD_SET(fd, &fds_set_err);
+
+ res = select(fd + 1, &fds_set, NULL, &fds_set_err, &tv);
+
+ if (res > 0) {
+ if (FD_ISSET(fd, &fds_set)) {
+ *lp_evt_mask = EV_RXCHAR;
+ ret = 1;
+
+ } else {
+ *lp_evt_mask = EV_ERROR;
+ ret = 0;
+ }
+ } else {
+ ret = 0;
+ }
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ *
+ * Create file
+ *
+ * Create or open an object and return a handle which can be used to access the object
+ *
+ * @param lp_file_name Not used
+ * @param dw_desired_access Not used
+ * @param dw_share_mode Not used
+ * @param lp_security_attributes Not used
+ * @param dw_creation_disposition Not used
+ * @param dw_flags_and_attributes Not used
+ * @param h_template_file Not used
+ *
+ * @return Handle
+ */
+HANDLE CreateFile(LPCTSTR lp_file_name, DWORD dw_desired_access, DWORD dw_share_mode, LPSECURITY_ATTRIBUTES lp_security_attributes, DWORD dw_creation_disposition, DWORD dw_flags_and_attributes, HANDLE h_template_file) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int fd;
+ int loop = 1;
+
+ while (loop == 1) {
+ fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY);
+ if (fd != -1) {
+ break;
+ }
+ sleep(1);
+ }
+ /* fd is FD, and less than INT_MAX(0x7fffffff) and the return data type is HANDLE. */
+ return (HANDLE)((long)(fd)); // NOLINT(runtime/int)
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ *
+ * Close file
+ *
+ * Close an open file
+ *
+ * @param[in] h_object Handle
+ *
+ * @return Processing result
+ * @retval TRUE Processing succeeded
+ * @retval FALSE Processing failed
+ */
+BOOL CloseFile(HANDLE h_object) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (h_object != reinterpret_cast<void*>(-1)) {
+ /* h_object is FD, and less than INT_MAX(0x7fffffff) */
+ close(static_cast<int>((long)h_object)); // NOLINT(runtime/int)
+ } else {
+ /* nop */
+ }
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ *
+ * Write File
+ *
+ * Writing Data to a File
+ *
+ * @param[in] h_file Handle
+ * @param[in] lp_buffer buffer to write
+ * @param[out] n_number_of_bytes_to_write Maximum writing size
+ * @param[out] lpNumberOfBytesWrite Writing size
+ * @param lp_overlapped Not used
+ *
+ * @return Processing result
+ * @retval TRUE Processing succeeded
+ * @retval FALSE Processing failed
+ */
+BOOL WriteFile(HANDLE h_file, LPCVOID lp_buffer, DWORD n_number_of_bytes_to_write, LPDWORD lp_number_of_bytes_written, LPOVERLAPPED lp_overlapped) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int res = -1;
+ BOOL ret = 0;
+ int fd;
+ fd_set fds_set; /* Set of file descriptors */
+ fd_set fds_set_err;
+
+ struct timeval tv;
+
+#if GPS_FUNC_DEBUG_MSG__CWORD71__FILE
+ static FILE* fp = NULL; /* For debugging */
+ int i;
+#endif /* GPS_FUNC_DEBUG_MSG__CWORD71__FILE */
+
+ /* monitor for 2 seconds.*/
+ tv.tv_sec = 2;
+ tv.tv_usec = 0;
+ /* h_file is FD, and less than INT_MAX(0x7fffffff) */
+ fd = static_cast<int>((long)h_file); // NOLINT(runtime/int)
+
+ /* Initialization */
+ FD_ZERO(&fds_set);
+ FD_ZERO(&fds_set_err);
+
+ FD_SET(fd, &fds_set);
+ FD_SET(fd, &fds_set_err);
+
+ res = select(fd + 1, &fds_set, NULL, &fds_set_err, &tv);
+ if (res > 0) {
+ if (FD_ISSET(fd, &fds_set)) {
+ /* h_file is FD, and less than INT_MAX(0x7fffffff) */
+ res = static_cast<int>(write(static_cast<int>((long)h_file), lp_buffer, // NOLINT(runtime/int)
+ n_number_of_bytes_to_write));
+ *lp_number_of_bytes_written = res;
+
+#if GPS_FUNC_DEBUG_MSG__CWORD71__FILE
+ if (fp == NULL) {
+ /* File initialization */
+ fp = fopen(POS_GPS_W_LOGFILE_PATH, "w+");
+ } else {
+ fp = fopen(POS_GPS_W_LOGFILE_PATH, "a+");
+ }
+ for (i = 0; i < n_number_of_bytes_to_write; i++) {
+ fprintf(fp, "%02x ", *(reinterpret_cast<char *>(lp_buffer) + i));
+ }
+ fprintf(fp, "\n");
+ fclose(fp);
+#endif /* GPS_FUNC_DEBUG_MSG__CWORD71__FILE */
+ }
+ } else {
+ }
+
+ if (res != -1) {
+ ret = 1;
+ }
+
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : Wsprintf
+* ABSTRACT : Format a string and store the value in a buffer. If any of the arguments are passed,
+* Format according to the corresponding format specifier in the format control string and copies it to the output buffer.
+* NOTE :
+* ARGUMENT :
+* RETURN : int defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+int Wsprintf(LPTSTR lp_out, LPCTSTR lp_fmt, ...) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if 1 /* GPF */
+ int rtn;
+ va_list args;
+
+ va_start(args, lp_fmt);
+ /* Seems to be occured problems because the buffer size is not known. */
+ rtn = vswprintf(reinterpret_cast<wchar_t*>(lp_out), 256, reinterpret_cast<const wchar_t*>(lp_fmt), args);
+ va_end(args);
+
+ return rtn;
+#endif /* GPF */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : PbSystemTimeToFileTime
+* ABSTRACT : Convert the system date and time to 64-bit format file time.
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BOOL PbSystemTimeToFileTime(const SYSTEMTIME* lp_system_time, LPFILETIME lp_file_time) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return FALSE;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * Function name : MunmapDeviceIo<br>
+ * Register unmapping<br>
+ *
+ * Overview : Remove the mapping of a register to memory.<br>
+ *
+ * -# Release the mapping of the specified register to memory.
+ *
+ * @param h_dev [I]Handle to the device object
+ * @param map_size [I]Size of mapped device I/O memory
+ *
+ * @return RET_API Processing result
+ * @retval RET_NORMAL Processing succeeded
+ * @retval RET_ERROR Processing failed
+ */
+/* Wait for replacement */
+RET_API MunmapDeviceIo(HANDLE h_dev, u_int32 map_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL;
+// LCOV_EXCL_STOP
+}
+
+/**
+ * Function name : MmapDeviceIo<br>
+ * Register mapping<br>
+ *
+ * Overview : Map registers to memory.<br>
+ *
+ * -# Map the specified register to memory.
+ *
+ * @param map_size [I]Size of mapped device I/O memory
+ * @param map_addr [I]Mapped physical address
+ *
+ * @return HANDLE Processing result
+ * @retval Except NULL Handle
+ * @retval NULL Processing failed
+ */
+/* Wait for replacement */
+HANDLE MmapDeviceIo(u_int32 map_size, u_int32 map_addr) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL;
+// LCOV_EXCL_STOP
+}
+
+/**
+ * @brief
+ *
+ * Kill
+ *
+ * Exit program
+ *
+ * @param[in] p_func Calling function
+ * @param[in] line Number of caller rows
+ */
+void _pb_Exit_d(const char* p_func, int line) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int ret = -1;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FORBIDDEN ERROR [Called by:%s, Line:%d]", p_func, line);
+ exit(ret);
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+
+/* GPF001_sample_ttaka add end */
+
diff --git a/vehicleservice/positioning_base_library/library/src/_pbOther.cpp b/vehicleservice/positioning_base_library/library/src/_pbOther.cpp
new file mode 100755
index 0000000..73ff300
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbOther.cpp
@@ -0,0 +1,799 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbOther.cpp
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <asm/unistd.h>
+#include <native_service/frameworkunified_types.h>
+
+#include <vehicle_service/positioning_base_library.h>
+#include "_pbInternalProc.h"
+#include <other_service/VP_GetEnv.h>
+#include "WPF_STD_private.h"
+#include "tchar.h"
+
+
+
+/*---------------------------------------------------------------------------------*
+ * Define *
+ *---------------------------------------------------------------------------------*/
+/* Shared memory */
+#define POS_BASE_OTHER_PROC_ID "POS_BASE_OTHER_PROC_ID"
+
+#define MAX_OTHER_PROC_NUM (32) /** Maximum number of the management information to translate the process name to PNO */
+#define MAX_NUM_CTRL_TID (16) /** Maximum number of tje TID management for thread in Process */
+
+#define OTHER_PNO_BASE (0x9000) /** Base number of local process */
+
+#define THREAD_NAME_LEN_MAX (32)
+
+#define FULL_OTHER_PROC_NUM (MAX_OTHER_PROC_NUM - 4) /** Threshold of the management information to translate the process name to PNO (no free) */
+#define WARN_OTHER_PROC_NUM (MAX_OTHER_PROC_NUM - 10) /** Threshold of the management information to translate the process name to PNO (warning) */
+
+typedef void* (*_CWORD64_PROCMNG_START_ROUTINE)(void*);
+
+/*---------------------------------------------------------------------------------*
+ * Structure *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Process identification information
+ */
+typedef struct {
+ PNO pno; /**< Process number */
+ char name[THREAD_NAME_LEN_MAX]; /**< Process name */
+} PROC_ID;
+
+/*!
+ @brief Process information
+ */
+typedef struct {
+ PROC_ID id[MAX_OTHER_PROC_NUM]; /**< Process identification information */
+ uint32_t use_cnt; /**< Used number */
+ uint32_t rsv_cnt; /**< Reserved number */
+} PROC_INFO;
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static HANDLE g_h_app[MAX_NUM_CTRL_TID]; /** Application handle */
+static HANDLE g_h_mtx; /** Shared-information-locking Mutex handle */
+static HANDLE g_h_shm; /** Shared memory handle */ // Coverity CID: 18787 compliant
+
+static PROC_INFO* g_p_proc_id_tbl; /** Process Name-PNO Translation Table */
+
+/*---------------------------------------------------------------------------------*
+ * Internal Function Prototype *
+ *---------------------------------------------------------------------------------*/
+/* Process number to PNO translation table manipulation functions */
+static void OtherSetPnoOfCnvTbl(u_int32 idx, PNO pno);
+static void OtherSetNameOfCnvTbl(u_int32 idx, PCSTR name);
+static PNO OtherGetPnoOfCnvTbl(u_int32 idx);
+static PCSTR OtherGetNameOfCnvTbl(u_int32 idx);
+static u_int32 OtherSearchPnoOfCnvTbl(PNO pno);
+static u_int32 OtherSearchNameOfCnvTbl(PCSTR name);
+static void OtherIncUseCntOfCnvTbl(void);
+static void OtherIncRsvCntOfCnvTbl(void);
+static void OtherDecRsvCntOfCnvTbl(void);
+
+static void OtherCreateMutex(void);
+static void OtherDeleteMutex(void);
+static void OtherLockMutex(void);
+static void OtherUnlockMutex(void);
+
+/**
+ * @brief
+ * Initialize other funtion
+ *
+ * @return RET_NORMAL Normal completion
+ */
+RET_API ErrTrapInit(void) {
+ RET_API ret_api = RET_NORMAL;
+ PROC_INFO **pp_tbl;
+ u_int16 idx;
+
+ pp_tbl = &g_p_proc_id_tbl; /* Set a pointer to a table to translate the process name to PNO */
+
+ OtherCreateMutex(); /* Create Mutex for accessing shared info */
+ OtherLockMutex(); /* Acquire Mutex for accessing shared info */
+
+ /* Open shared memory for a table to translate the process name to PNO */
+ g_h_shm = OpenSharedMemory(const_cast<char*>(POS_BASE_OTHER_PROC_ID), sizeof(PROC_INFO));
+
+ /* If called for the first time within all processes, an error occurs and the following processing is performed. */
+ if (g_h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be not NULL
+ /* Create shared memory for a table to translate the name to PNO */
+ g_h_shm = CreateSharedMemory(const_cast<char*>(POS_BASE_OTHER_PROC_ID), sizeof(PROC_INFO));
+ /* In case of an error */
+ if (g_h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateShareData ERROR " \
+ "[g_h_shm:%p]", g_h_shm);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // // LCOV_EXCL_LINE 200: can not be NULL
+ /* don't arrive here. */
+ }
+ }
+
+ OtherUnlockMutex(); /* Release Mutex for accessing shared info */
+
+ /* Set the acquired shared memory address as a pointer for a table to translate the process name to PNO */
+ *pp_tbl = reinterpret_cast<PROC_INFO*>(GetSharedMemoryPtr(g_h_shm));
+
+ /* Table initialization */
+ for (idx = 0; idx < MAX_OTHER_PROC_NUM; idx++) {
+ /* Set PNO into the table to translate the process name to PNO (Overwrite from the second process onwards) */
+ OtherSetPnoOfCnvTbl(idx, static_cast<PNO>(OTHER_PNO_BASE + idx));
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Terminate other function
+ */
+void ErrTrapTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CloseSharedMemory(g_h_shm);
+
+ OtherDeleteMutex();
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create Thread
+ *
+ * @param[in] lp_thread_attributes Not used
+ * @param[in] dw_stack_size Initial stack size
+ * @param[in] lp_start_address Address of the effective function of the thread
+ * @param[in] lp_parameter Thread arguments
+ * @param[in] dw_creation_flags Not used
+ * @param[in] lp_thread_id Thread identifier
+ * @param[in] pno PNO
+ * @param[in] priority Thread priority
+ *
+ * @return Non-zero:Normal status, 0:When an error occurs
+ */
+HANDLE _pb_CreateThread(LPSECURITY_ATTRIBUTES lp_thread_attributes, DWORD dw_stack_size, LPTHREAD_START_ROUTINE lp_start_address, LPVOID lp_parameter, DWORD dw_creation_flags, LPDWORD lp_thread_id, PNO pno, int32 priority) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ pthread_attr_t st_thread_attr;
+ pthread_t ul_thread_id = 0;
+ sched_param st_thread_param = {0};
+ HANDLE handle = NULL;
+ int32 lret = EOK;
+ BOOL bret = FALSE;
+
+ /* null check */
+ if (lp_thread_id == NULL) {
+ // no op
+ } else {
+ /* Initializing Attributes */
+ lret = pthread_attr_init(&st_thread_attr);
+
+ /* When the attribute initialization is successful */
+ if (lret == EOK) {
+ /* Do not inherit parent scheduling policies */
+ lret = pthread_attr_setinheritsched(&st_thread_attr, PTHREAD_EXPLICIT_SCHED);
+ }
+
+ /* If you successfully configure policy inheritance */
+ if (lret == EOK) {
+ /* Scheduling settings */
+ lret = pthread_attr_setschedpolicy(&st_thread_attr, SCHED_RR);
+ }
+
+ /* Successful Scheduling settings */
+ if (lret == EOK) {
+ /* Create a thread with the lowest priority so that the spawned thread */
+ /* do not run until they are ready for processing */
+ st_thread_param.sched_priority = 1;
+ lret = pthread_attr_setschedparam(&st_thread_attr, &st_thread_param);
+ }
+
+ /* If the priority setting is successful */
+ if (lret == EOK) {
+ lret = pthread_create(&ul_thread_id,
+ NULL,
+ (_CWORD64_PROCMNG_START_ROUTINE)lp_start_address,
+ lp_parameter);
+ }
+
+ /* Successful pthread_create */
+ if (lret == EOK) {
+ bret = TRUE;
+ }
+ }
+
+ /* When priority setting is successful */
+ if (bret != FALSE) {
+ /* Return value setting */
+ handle = (HANDLE)ul_thread_id;
+ *lp_thread_id = ul_thread_id;
+ } else {
+ /* Error log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lret ERROR [lret:%d]", lret);
+ }
+
+ return handle;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get the thread ID
+ *
+ * @return Thread ID
+ */
+uint32_t PbGetTid(void) {
+ uint32_t ul_tid;
+
+ ul_tid = (uint32_t)syscall(__NR_gettid);
+
+ return ul_tid;
+}
+
+/**
+ * @brief
+ * Get the local thread ID
+ *
+ * Local thread ID = [0, 1, 2, ...]<br>
+ * The local thread ID is unique in the process, and dynamically assigned in the order in which <br>
+ * this API was called during the process execution. <br>
+ *
+ * @return Local thread ID
+ */
+uint32_t PbGetLocalTid(void) {
+ static uint32_t g_tid[MAX_NUM_CTRL_TID] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
+ }; /** In-process thread ID management table */
+
+ uint32_t ul_tid;
+ uint32_t ul_idx;
+ uint32_t ul_local_tid = 0xFFFFFFFF;
+
+ ul_tid = PbGetTid();
+
+ OtherLockMutex(); /* Get Mutex for accessing shared info */
+
+ for (ul_idx = 0; ul_idx < MAX_NUM_CTRL_TID; ul_idx++) {
+ if (g_tid[ul_idx] == ul_tid) {
+ ul_local_tid = ul_idx;
+ }
+ }
+
+ if (ul_local_tid == 0xFFFFFFFF) {
+ for (ul_idx = 0; ul_idx < MAX_NUM_CTRL_TID; ul_idx++) {
+ if (g_tid[ul_idx] == 0xFFFFFFFF) {
+ g_tid[ul_idx] = ul_tid;
+ ul_local_tid = ul_idx;
+
+ break;
+ }
+ }
+
+ if (ul_local_tid == 0xFFFFFFFF) {
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Local Tid buffer is overfull!!");
+ _pb_Exit();
+
+ /* don't arrive here. */
+ }
+ }
+
+ OtherUnlockMutex(); /* Release Mutex for accessing shared info */
+
+ return ul_local_tid;
+}
+
+
+/**
+ * @brief
+ * Get Application Handle
+ *
+ * Get the application handle of the invoking thread.
+ *
+ * @return Non-zero:Normal status, 0:When an error occurs
+ */
+HANDLE _pb_GetAppHandle(void) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ const uint32_t offset = PbGetLocalTid();
+
+ return g_h_app[offset];
+}
+
+
+/**
+ * @brief
+ * Set Application Handle
+ *
+ * Set the application handle of the invoking thread.
+ *
+ * @param[in] name Process name
+ */
+void _pb_SetAppHandle(HANDLE h_app) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ const uint32_t offset = PbGetLocalTid();
+
+ OtherLockMutex(); /* Get Mutex for accessing shared info */
+
+ g_h_app[offset] = h_app;
+
+ OtherUnlockMutex(); /* Release Mutex for accessing shared info */
+
+ return;
+}
+
+
+/**
+ * @brief
+ * Convert process name to pno
+ *
+ * Translate process name to PNO.<br>
+ * If the process name specified in the argument is the first name to <br>
+ * be translated by this API, a new PNO is assigned and returned. <br>
+ * If NULL is specified, 0 is returned.
+ *
+ * @param[in] name Process name
+ *
+ * @return Process number
+ */
+PNO _pb_CnvName2Pno(PCSTR name) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ u_int32 idx;
+ PNO pno = 0;
+ size_t len;
+
+ /* null check */
+ if (name == NULL) {
+ pno = 0;
+ } else {
+ len = _tcslen(name);
+ if (len >= THREAD_NAME_LEN_MAX) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! " \
+ "Length of thread name is too long(>=%d). [len:%zu]", THREAD_NAME_LEN_MAX, len);
+ } else {
+ OtherLockMutex();
+
+ idx = OtherSearchNameOfCnvTbl(name);
+
+ if (idx != MAX_OTHER_PROC_NUM) {
+ pno = OtherGetPnoOfCnvTbl(idx);
+ } else {
+ idx = OtherSearchNameOfCnvTbl("");
+ OtherSetNameOfCnvTbl(idx, name);
+ /* Increment using-counter */
+ OtherIncUseCntOfCnvTbl();
+ pno = OtherGetPnoOfCnvTbl(idx);
+ }
+
+ OtherUnlockMutex();
+ }
+ }
+
+ return pno;
+}
+
+/**
+ * @brief
+ * Convert pno to process name
+ *
+ * Translate PNO to the process name.
+ * Return the process name set by _pb_CnvName2Pno to the PNO argument.
+ * If a non-PNO value is given by _pb_CnvName2Pno is specified,
+ * NULL is returned.
+ *
+ * @param[in] pno Process number
+ *
+ * @return Process name
+ */
+PCSTR _pb_CnvPno2Name(PNO pno) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ u_int32 idx;
+ PCSTR name = NULL;
+
+ OtherLockMutex();
+
+ idx = OtherSearchPnoOfCnvTbl(pno);
+
+ if (idx != MAX_OTHER_PROC_NUM) {
+ name = OtherGetNameOfCnvTbl(idx);
+ }
+
+ OtherUnlockMutex();
+
+ return name;
+}
+
+
+/**
+ * @brief
+ * Get environment variables
+ *
+ * @param[in] Environment variable name
+ * @param[in] Pointer to environment variable value
+ */
+void GetEnv(const char* p_env_str, char* p_env_buff) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VP_GetEnv(p_env_str, p_env_buff);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VP_GetEnv:%s=%s", p_env_str, p_env_buff);
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/*---------------------------------------------------------------------------------*
+ * Local Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * PNO setting(The table to translate the process name to PNO)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] u_int32 idx Table accessor
+ * @param[in] PNO pno Process number
+ *
+ * @return none
+ */
+static void OtherSetPnoOfCnvTbl(u_int32 idx, PNO pno) {
+ /* check index */
+ if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, pno:%d]", idx, pno);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ g_p_proc_id_tbl->id[idx].pno = pno;
+
+ return;
+}
+
+/**
+ * @brief
+ * Set process name (The table to translate the process name to PNO)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] u_int32 idx Table accessor
+ * @param[in] PCSTR name Process name
+ *
+ * @return none
+ */
+static void OtherSetNameOfCnvTbl(u_int32 idx, PCSTR name) {
+ /* check index */
+ if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, name:%s]", idx, name);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ _tcscpy(g_p_proc_id_tbl->id[idx].name, name);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get PNO (The table to translate the process name to PNO)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] u_int32 idx Table accessor
+ *
+ * @return PNO
+ */
+static PNO OtherGetPnoOfCnvTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_p_proc_id_tbl->id[idx].pno;
+}
+
+/**
+ * @brief
+ * Get process name (The table to translate the process name to PNO)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] u_int32 idx Table accessor
+ *
+ * @return PCSTR
+ */
+static PCSTR OtherGetNameOfCnvTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_p_proc_id_tbl->id[idx].name;
+}
+
+/**
+ * @brief
+ * Retrieve PNO (The table to translate the process name to PNO)
+ *
+ * If the PNO specified in the argument exists in the table, return the index for access.
+ * If not exists, return the maximum number of local PNO controls (MAX_OTHER_PROC_NUM).
+ *
+ * @param[in] PNO pno Process number
+ *
+ * @return u_int32 Table accessor
+ */
+static u_int32 OtherSearchPnoOfCnvTbl(PNO pno) {
+ u_int32 idx;
+ PNO lPno;
+
+ for (idx = 0; idx < MAX_OTHER_PROC_NUM; idx++) {
+ lPno = OtherGetPnoOfCnvTbl(idx);
+
+ if (lPno == pno) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Retrieve process name (The table to translate the process name to PNO)
+ *
+ * If the process specified by the argument exists in the table, return the index for access.
+ * If not exists, return the maximum number of local PNO controls (MAX_OTHER_PROC_NUM).
+ *
+ * @param[in] PCSTR name Process name
+ *
+ * @return u_int32 Table accessor
+ */
+static u_int32 OtherSearchNameOfCnvTbl(PCSTR name) {
+ int32 ret;
+ u_int32 idx;
+
+ for (idx = 0; idx < MAX_OTHER_PROC_NUM; idx++) {
+ ret = _tcscmp(g_p_proc_id_tbl->id[idx].name, name);
+
+ /* If there is a match */
+ if (ret == 0) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+
+/**
+ * @brief
+ * Create Mutex for accessing shared info
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+static void OtherCreateMutex(void) {
+ g_h_mtx = _pb_CreateMutex(NULL, 0, "Other_Mutex");
+ if (g_h_mtx == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR [g_h_mtx:%p]", g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Delete Mutex for accessing shared info
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+static void OtherDeleteMutex(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DWORD ret;
+ ret = PbDeleteMutex(g_h_mtx);
+ if (ret != WAIT_OBJECT_0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbDeleteMutex ERROR " \
+ "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get Mutex for accessing shared info
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+static void OtherLockMutex(void) {
+ DWORD ret;
+ ret = PbMutexLock(g_h_mtx, INFINITE);
+ if (ret != WAIT_OBJECT_0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexLock ERROR " \
+ "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Open Mutex for Accessing Shared Info
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+static void OtherUnlockMutex(void) {
+ BOOL ret;
+ ret = PbMutexUnlock(g_h_mtx);
+ if (ret != TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexUnlock ERROR " \
+ "[ret:%d, g_h_mtx:%p]", ret, g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get dump information
+ *
+ * @param[out] pBuf Dump info
+ */
+void _pb_GetDebugOtherMngTbl(void* pBuf) {
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[64];
+ uint32_t i;
+
+ if (pBuf != NULL) {
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf), "Other");
+ if (g_p_proc_id_tbl == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_proc_id_tbl can not be NULL
+ // LCOV_EXCL_START 200: g_p_proc_id_tbl can not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ strncat(reinterpret_cast<char *>(&buf[0]), "\n NULL", strlen("\n NULL"));
+ // LCOV_EXCL_STOP
+ } else {
+ for (i = 0; i < MAX_OTHER_PROC_NUM; i++) {
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] pno:0x%04x, name:%s",
+ i,
+ g_p_proc_id_tbl->id[i].pno,
+ g_p_proc_id_tbl->id[i].name);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), \
+ strlen(reinterpret_cast<char *>(&bufTmp[0])));
+ }
+ }
+ memcpy(pBuf, &buf[0], sizeof(buf));
+ }
+}
+
+/**
+ * @brief
+ * Increment the usage counter of the table to translate process name to PNO
+ *
+ * @param[in] none
+ */
+static void OtherIncUseCntOfCnvTbl(void) {
+ g_p_proc_id_tbl->use_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Increment the counter to reserve the table to translate the process name to PNO
+ *
+ * @param[in] none
+ */
+static void OtherIncRsvCntOfCnvTbl(void) {
+ g_p_proc_id_tbl->rsv_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Decrement the counter to reserve the table to translate the process name to PNO
+ *
+ * @param[in] none
+ */
+static void OtherDecRsvCntOfCnvTbl(void) {
+ g_p_proc_id_tbl->rsv_cnt--;
+ return;
+}
+
+/**
+ * @brief
+ * Determine resources ready (The table to translate the process name to PNO)
+ *
+ * @param[in] none
+ *
+ * @return BOOL
+ * @retval TRUE : Normal
+ * @retval FALSE : Error (Resource shortage)
+ */
+BOOL _pb_GetOtherResource(void) {
+ BOOL ret = TRUE;
+ uint32_t cnt;
+
+ OtherLockMutex();
+
+ /* Increment reserved counter */
+ OtherIncRsvCntOfCnvTbl();
+
+ cnt = g_p_proc_id_tbl->use_cnt + g_p_proc_id_tbl->rsv_cnt;
+ if (cnt >= FULL_OTHER_PROC_NUM) {
+ ret = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \
+ "[FATAL][use_cnt:%d rsv_cnt:%d]", g_p_proc_id_tbl->use_cnt, g_p_proc_id_tbl->rsv_cnt);
+ } else if (cnt >= WARN_OTHER_PROC_NUM) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \
+ "[WARN][use_cnt:%d rsv_cnt:%d]", g_p_proc_id_tbl->use_cnt, g_p_proc_id_tbl->rsv_cnt);
+ }
+
+ OtherUnlockMutex();
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Release resources (The table to translate process name to PNO)
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+void _pb_ReleaseOtherResource(void) {
+ OtherLockMutex();
+
+ /* Decrement reserved counter */
+ OtherDecRsvCntOfCnvTbl();
+
+ OtherUnlockMutex();
+
+ return;
+}
diff --git a/vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp b/vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp
new file mode 100755
index 0000000..e8d9601
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp
@@ -0,0 +1,207 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbProcMng.cpp
+ System name :
+ Subsystem name :
+ Title :
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <fcntl.h>
+#include <sys/procfs.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+#include "_pbWaitforsingleobject.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : ExitProcess
+ * ABSTRACT : Terminate one process and all threads belonging to that process.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : VOID defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID ExitProcess(UINT u_exit_code) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ exit(u_exit_code);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetCurrentProcess
+ * ABSTRACT : Get a pseudo handle for the current process.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : HANDLE defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* QAC 3460 */
+HANDLE GetCurrentProcess(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return reinterpret_cast<HANDLE>(getpid());
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetCurrentProcessId
+ * ABSTRACT : Get the process identifier of the calling process.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : DWORD defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* QAC 3460 */
+DWORD GetCurrentProcessId(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (DWORD)getpid();
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_ExitThread
+ * ABSTRACT : Terminate a thread
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : VOID defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID _pb_ExitThread(DWORD dw_exit_code) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Delete handle type */
+ WaitObjectDel(reinterpret_cast<HANDLE*>(pthread_self()));
+
+ return pthread_exit (reinterpret_cast<void*>(dw_exit_code));
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : TerminateThread
+ * ABSTRACT : Terminate a thread
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : BOOL defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BOOL TerminateThread(HANDLE h_thread, DWORD dw_exit_code) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+ BOOL bret = TRUE;
+
+ /* Delete handle type */
+ WaitObjectDel(h_thread);
+
+ /* When an error occurs */
+ if (lret == EOK) {
+ bret = FALSE;
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetExitCodeThread
+ * ABSTRACT : Get the exit status of the specified thread.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : BOOL defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BOOL GetExitCodeThread(HANDLE h_thread, LPDWORD lp_exit_code) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return TRUE;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : WaitExitThread
+ * ABSTRACT : Wait for the thread to terminate.
+ * NOTE : It can only be used for a thread in the same process according to PosixBasedOS001.
+ * ARGUMENT :
+ * RETURN : BOOL defined
+ * RET_NORMAL : Normal completion
+ * RET_ERROR : ABEND
+ * RET_ERRTIMEOUT : Timeout occurred
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API WaitExitThread(HANDLE h_handle, u_int32 ul_mill_seconds, u_int32* pul_exit_code) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL; /* Coverity CID: 18759 compliant */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetCurrentThread
+ * ABSTRACT : Get a pseudo handle for the current thread.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : HANDLE defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* QAC 3460 */
+HANDLE GetCurrentThread(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (HANDLE)pthread_self();
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetCurrentThreadId
+ * ABSTRACT : Get the thread identifier of the calling thread.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : DWORD defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* QAC 3460 */
+DWORD GetCurrentThreadId(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (DWORD)pthread_self();
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetThreadTimes
+ * ABSTRACT : Get time information about the specified thread.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : BOOL defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BOOL GetThreadTimes(HANDLE h_process, HANDLE h_thread, LPFILETIME lp_creation_time, LPFILETIME lp_exit_time, LPFILETIME lp_kernel_time, LPFILETIME lp_user_time) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return TRUE; /* Coverity CID: 18765 compliant */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : ResumeThread
+ * ABSTRACT : Decrease the thread suspend count by 1.
+ * NOTE : Always return 0 because no suspend operation is supported according to PosixBasedOS001.
+ * ARGUMENT :
+ * RETURN : DWORD defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+DWORD ResumeThread(HANDLE h_thread) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SuspendThread
+ * ABSTRACT : Suspend execution of the specified thread.
+ * NOTE : Always return 0 because no suspend operation is supported according to PosixBasedOS001.
+ * ARGUMENT :
+ * RETURN : DWORD defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+DWORD SuspendThread(HANDLE h_thread) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+}
+// LCOV_EXCL_STOP
+
diff --git a/vehicleservice/positioning_base_library/library/src/_pbSem.cpp b/vehicleservice/positioning_base_library/library/src/_pbSem.cpp
new file mode 100755
index 0000000..1264d79
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbSem.cpp
@@ -0,0 +1,780 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbSem.cpp
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "_pbInternalProc.h"
+#include "WPF_STD_private.h"
+#include "tchar.h"
+
+/*
+ Constants and structure definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define MAX_PB_SEMAPHORES 256
+#define MAX_SEMAPHORE_NAME_LEN 32
+#define MAX_PB_SEMAPHORES_INPROC 16
+
+/* Name storage table */
+typedef struct {
+ TCHAR semaphore_name[MAX_SEMAPHORE_NAME_LEN + 1]; /* Semaphore name(Specified name of the user APP) */
+ DWORD ref_counter; /* Reference Counter (Currently unused, always 1) */
+} PB_SEMAPHORE;
+
+/* Control information storage table */
+typedef struct {
+ HANDLE h_heap; /* Handle of the heap area allocated for expanding the self TBL (control-information-storage TBL) */
+ PB_SEMAPHORE* p_sys_semaphore; /* Address where the self name in the name storage table is stored (Top address of self name) */
+ DWORD index; /* Semaphore ID that is equal to the index of self TBL (control information strage TBL:p_handle_table) + 1 */
+ HANDLE h_semaphore; /* Semaphore handle (Semaphore or Mutex according to the above DEBUG defines) */
+ HANDLE h_mutex; /* Mutex handle for locking when updating the self TBL (control information storage TBL) */
+} PB_SEMAPHORE_OPEN_HANDLE;
+
+/* Semaphore information management table */
+typedef struct {
+ PB_SEMAPHORE_OPEN_HANDLE* p_handle_table[MAX_PB_SEMAPHORES]; /* Pointer to control information storage table */
+ HANDLE h_shared_memory; /* Handle of shared memory allocated for name storage table to expand */
+ HANDLE h_mutex; /* Mutex handle to lock when updating the name storage table */
+ PB_SEMAPHORE* p_semaphore_table; /* Pointer to the name storage table (Allocate as many areas as the maximum number of registrations in shared memory)*/
+} PB_SEMAPHORE_INSTANCE;
+
+typedef struct /* In-process semaphore management table */ {
+ char semaphore_name[MAX_SEMAPHORE_NAME_LEN]; /* Semaphore name (Specified name of the user APP) */
+ HANDLE h_heap; /* Heap handle of critical section structure area */
+ CRITICAL_SECTION *p_cs; /* Critical section pointer(Semaphore ID) */
+} PB_SEM_INPROC;
+
+/*
+ Internal function prototype declarations
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static DWORD FindSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex);
+static DWORD AllocNewSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex);
+static void FreeSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, int index, HANDLE h_mutex);
+
+/*
+ Global variable definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static PB_SEMAPHORE_INSTANCE g_instance; // NOLINT(readability/nolint) global class instance
+/* CS for exclusive control of in-process semaphore management table */
+CRITICAL_SECTION g_sem_in_proc_tbl_mng_cs;
+/* Pointer to the in-process semaphore management table */
+PB_SEM_INPROC *g_p_sem_in_proc_mng = NULL;
+
+/*
+ * Inline functions.
+ */
+inline void
+MakeSemaphoreName(TCHAR* name, DWORD index) {
+ wsprintf(name, __TEXT("POS_BASE_SEMAPHORE_SEM%05d"), static_cast<int32>(index));
+}
+inline void
+MakeMutexName(TCHAR* name, DWORD index) {
+ wsprintf(name, __TEXT("POS_BASE_SEMAPHORE_MUTEX%05d"), static_cast<int32>(index));
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SemaphoreInit
+ * ABSTRACT : Semaphore initialization processing
+ * NOTE : This function is called when _CWORD64_api.dll is ATTACH from processes
+ * : and initializes the process.
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * RET_ERRINIT ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SemaphoreInit(void) {
+ RET_API ret_api = RET_NORMAL;
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+ TCHAR name[32] = {0};
+ DWORD semaphore_table_size = 0;
+ int32 n = 0;
+ PB_SEMAPHORE *p_semaphore_table = NULL;
+ BOOL b_create = FALSE;
+
+ /* Initialize the semaphore information management table */
+ for (n = 0; n < MAX_PB_SEMAPHORES; n++) {
+ p_inst->p_handle_table[n] = NULL; /* NULL initialize the control data storage table */
+ }
+
+ /* Initialize the semaphore name storage table */
+ _tcscpy(name, __TEXT("POS_BASE_SEMAPHORE_TABLE"));
+ semaphore_table_size = sizeof(PB_SEMAPHORE) * MAX_PB_SEMAPHORES;
+ /* Open shared memory with the name _CWORD64__SEMAPHORE_TABLE */
+ p_inst->h_shared_memory = OpenSharedMemory(name, semaphore_table_size);
+ if (p_inst->h_shared_memory == NULL) /* If shared memory does not exist */ {
+ /* Create a shared memory with the name _CWORD64__SEMAPHORE_TABLE */
+ p_inst->h_shared_memory = CreateSharedMemory(name, semaphore_table_size);
+ if (p_inst->h_shared_memory == NULL) /* If shared memory creation fails */ {
+ ret_api = RET_ERRINIT; /* Ends in error */
+ } else {
+ b_create = TRUE; /* Create shared memory */
+
+ /* Allocate the created shared memory to the semaphore name storage table and initialize it. */
+ // LCOV_EXCL_BR_START 200: cannot be null
+ p_semaphore_table = reinterpret_cast<PB_SEMAPHORE*>(GetSharedMemoryPtr(p_inst->h_shared_memory));
+ // LCOV_EXCL_BR_STOP
+ if (p_semaphore_table == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null
+ // LCOV_EXCL_START 200: cannot be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CloseSharedMemory(p_inst->h_shared_memory);
+ DeleteSharedMemory(name);
+ ret_api = RET_ERRINIT; /* Ends in error */
+ // LCOV_EXCL_STOP
+ } else {
+ for (n = 0; n < MAX_PB_SEMAPHORES; n++) {
+ p_semaphore_table[n].semaphore_name[0] = __TEXT('\0'); /* Initialize name */
+ p_semaphore_table[n].ref_counter = 0; /* Initialize reference counter */
+ }
+ }
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ /* Save the address of the shared memory to the name storage table pointer of the semaphore information management table. */
+ // LCOV_EXCL_BR_START 200: cannot be null
+ p_inst->p_semaphore_table = reinterpret_cast<PB_SEMAPHORE*>(GetSharedMemoryPtr(p_inst->h_shared_memory));
+ // LCOV_EXCL_BR_STOP
+ if (p_inst->p_semaphore_table == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null
+ // LCOV_EXCL_START 200: cannot be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CloseSharedMemory(p_inst->h_shared_memory);
+ if (b_create != FALSE) {
+ DeleteSharedMemory(name);
+ }
+ ret_api = RET_ERRINIT; /* Ends in error */
+ // LCOV_EXCL_STOP
+ } else {
+ /* Mutex creation process for semaphore-information-management table */
+ _tcscpy(name, __TEXT("POS_BASE_SEMAPHORE_MUTEX"));
+ /* Save the handle of the created Mutex in the Mutex handles for semaphore-information-management-table */
+ p_inst->h_mutex = _pb_CreateMutex(NULL, FALSE, name); // LCOV_EXCL_BR_LINE 200: can not be null
+ if (p_inst->h_mutex == NULL) { /* Failed to create a Mutex. */ // LCOV_EXCL_BR_LINE 200: can not be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \
+ "In SemaphoreInit\r\n", LTEXT(__FILE__), __LINE__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SemaphoreTerm
+ * ABSTRACT : Semaphore function termination processing
+ * NOTE : Called when the process ATTACH to _CWORD64_api.dll terminates, and then terminated.
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SemaphoreTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+
+ if (p_inst->h_mutex != NULL) {
+ PbDeleteMutex(p_inst->h_mutex);
+ p_inst->h_mutex = NULL;
+ }
+
+ if (p_inst->h_shared_memory != NULL) {
+ CloseSharedMemory(p_inst->h_shared_memory);
+ p_inst->h_shared_memory = NULL;
+ }
+
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create Semaphore
+ *
+ * Create a semaphore and return a semaphore ID.<br>
+ * For a semaphore that has already been created, return the same value of the semaphore ID when it has been created.
+ *
+ * @param[in] *sem_name Pointer to the semaphore name string to be created (NULL termination)
+ *
+ * @return Semaphore ID created other than 0<br>
+ * 0 ABEND to create semaphore
+ */
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+SemID _pb_CreateSemaphore(char* sem_name) // NOLINT(readability/nolint) WPF_SYSAPI.h API
+#else
+SemID _pb_CreateSemaphore(TCHAR* sem_name) // NOLINT(readability/nolint) WPF_SYSAPI.h API
+#endif // _CWORD64_API_DOES_NOT_USE_UNICODE
+{
+ SemID ret_sem_id = 0;
+ TCHAR *p_semaphore_name = NULL;
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+ TCHAR name[MAX_SEMAPHORE_NAME_LEN + 1] = {0};
+ PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL;
+ DWORD index = 0;
+
+ /* Check if the semaphore name is NULL */
+ if (sem_name == NULL) {
+ } else {
+ p_semaphore_name = sem_name;
+
+ /* Check if the semaphore name is specified */
+ if (p_semaphore_name[0] == __TEXT('\0')) {
+ } else if (_tcslen(p_semaphore_name) > MAX_SEMAPHORE_NAME_LEN) {
+ /* Check whether the semaphore name is less than or equal to the maximum number of characters */
+ } else {
+ /* Allocate Heap control information storage table area to create a semaphore */
+ p_semaphore_open = reinterpret_cast<PB_SEMAPHORE_OPEN_HANDLE *>(PbProcessHeapAlloc(0, \
+ sizeof(PB_SEMAPHORE_OPEN_HANDLE))); // LCOV_EXCL_BR_LINE 200: no branch
+ }
+
+ if (p_semaphore_open != NULL) {
+ PbMutexLock(p_inst->h_mutex, INFINITE); /* Mutex Lock from here */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+
+ /* Retrieve the name storage table expanded in the shared memory with the user-specified name. */
+ index = FindSemaphoreTable(p_inst->p_semaphore_table, p_semaphore_name, p_inst->h_mutex);
+ if (index != ((DWORD) - 1)) {
+ /* The semaphore name specified for the user already exists. */
+ /* Check if the control information storage table exists */
+ if (p_inst->p_handle_table[index] != NULL) {
+ /* If the control information storage TBL exists,(If it has already been created by this process) */
+ /* release the previously allocated Heap because it is not needed. */
+ PbProcessHeapFree(0, p_semaphore_open); // LCOV_EXCL_BR_LINE 200: no branch
+ /* Retrieve the pointer to the TBL storing the existing control information. */
+ p_semaphore_open = p_inst->p_handle_table[index];
+ PbMutexUnlock(p_inst->h_mutex); /* Mutex release */ // LCOV_EXCL_BR_LINE 200: no branch
+ /* Convert from an index of array to a semaphore ID and return (If it has already been created in this process) */
+ ret_sem_id = static_cast<SemID>(index + 1);
+ } else {
+ // LCOV_EXCL_START 200: p_handle_table can not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* If a semaphore with the established name exists but the control information table does not exist, link to it or create it in the following processing. */
+ /* (A semaphore was created by another process or the created process was terminated.) */
+ /* Store the assigned semaphore ID in the control information storage table. */
+ p_semaphore_open->index = index;
+ /* Store the start address of the name storage table */
+ p_semaphore_open->p_sys_semaphore = &p_inst->p_semaphore_table[index];
+ /* Store the address of the control information TBL (Heap) into the semaphore information management TBL. */
+ p_inst->p_handle_table[index] = p_semaphore_open;
+
+ /* Create the object name of the semaphore from the position (index of array) of the control information storage TBL. */
+ /* "_CWORD64__SEMAPHORE_SEMAPHORExxxxx" : xxxxx is expanded with five-digit array index */
+ MakeSemaphoreName(name, index);
+
+ /* Create a semaphore object using Mutex and store its handle into the control information storage TBL. */
+ p_semaphore_open->h_semaphore = _pb_CreateMutex(NULL, FALSE, name);
+ if (p_semaphore_open->h_semaphore == NULL) {
+ /* If the semaphore object creation failed, */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \
+ "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name);
+ _pb_Exit(); /* Make reset */
+ }
+
+ /* Create a Mutex name for locking the control information storage TBL from the position (index of array) of the control information storage TBL */
+ /* "_CWORD64__SEMAPHORE_MUTEXxxxxx" : xxxxx is expanded with five-digit array index */
+ MakeMutexName(name, index);
+ /* Create a Mutex for locking the control information storage TBL and store its handle into the control information storage TBL */
+ p_semaphore_open->h_mutex = _pb_CreateMutex(NULL, FALSE, name);
+ if (p_semaphore_open->h_mutex == NULL) {
+ /* If the creation of a Mutex for locking the control data storage TBL fails, */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \
+ "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name);
+ _pb_Exit();
+ }
+ /* Semaphore Lock for updating semaphore information control TBL */
+ PbMutexLock(p_semaphore_open->h_mutex, INFINITE);
+ p_semaphore_open->p_sys_semaphore->ref_counter = 1;
+ /* Semaphore UnLock upon completion of updating semaphore-information-management-TBL */
+ PbMutexUnlock(p_semaphore_open->h_mutex);
+ /* Semaphore UnLock upon completion of updating semaphore-information-management-TBL */
+ PbMutexUnlock(p_inst->h_mutex);
+
+ ret_sem_id = static_cast<SemID>(index + 1); /* Convert from an index of array to a semaphore ID and return */
+ /* (A semaphore was created by another process or the created process was terminated.) */
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ /* If the semaphore name specified by the user does not exist, it is newly created in the following processing. */
+ /* Free-space retrieval processing for the name storage table */
+ index = AllocNewSemaphoreTable(p_inst->p_semaphore_table, p_semaphore_name, p_inst->h_mutex);
+ if (index == ((DWORD) - 1)) { // LCOV_EXCL_BR_LINE 200: table buffer is enough, can not failed
+ /* If there is no free space in the name storage table */
+ /* Initialize the name storage TBL pointer of the control information storage TBL. (it may be No meaning due to release heap area in the following processing?) */
+ // LCOV_EXCL_START 200: table buffer is enough, can not failed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ p_semaphore_open->p_sys_semaphore = NULL;
+ /* Free the Heap area allocated for control information storage TBL */
+ PbProcessHeapFree(0, p_semaphore_open);
+ /* Semaphore UnLock to recover from errors */
+ PbMutexUnlock(p_inst->h_mutex);
+ // LCOV_EXCL_STOP
+ } else {
+ /* Store the assigned semaphore ID in the control information storage table. */
+ p_semaphore_open->index = index;
+ /* Store this start address of the name storage table */
+ p_semaphore_open->p_sys_semaphore = &p_inst->p_semaphore_table[index];
+ p_semaphore_open->p_sys_semaphore->ref_counter = 1; /* Reset reference counter. */
+ /* Store the control information TBL (Heap) address in the semaphore information management TBL. */
+ p_inst->p_handle_table[index] = p_semaphore_open;
+
+ /* Create the object name of the semaphore from the position (array index) of the control information storage TBL. */
+ /* "_CWORD64__SEMAPHORE_SEMAPHORExxxxx" : xxxxx is expanded with five-digit array index */
+ MakeSemaphoreName(name, index);
+ p_semaphore_open->h_semaphore = _pb_CreateMutex(NULL, FALSE, name); // LCOV_EXCL_BR_LINE 200: cannot be null // NOLINT(whitespace/line_length)
+ if (p_semaphore_open->h_semaphore == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \
+ "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+ }
+
+ MakeMutexName(name, index);
+ p_semaphore_open->h_mutex = _pb_CreateMutex(NULL, FALSE, name); // LCOV_EXCL_BR_LINE 200: cannot be null // NOLINT(whitespace/line_length)
+ if (p_semaphore_open->h_mutex == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \
+ "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+ }
+ /* Semaphore name registration */
+ _tcscpy(p_semaphore_open->p_sys_semaphore->semaphore_name, p_semaphore_name);
+
+ PbMutexUnlock(p_inst->h_mutex); /* Mutex lock to new create semaphore ends here */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+
+ ret_sem_id = static_cast<SemID>(index + 1); /* Convert from an array index to a semaphore ID and return */
+ }
+ }
+ }
+ }
+
+ return ret_sem_id; /* Return the allocated semaphore ID. */
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbDeleteSemaphore
+ * ABSTRACT : Semaphore deletion processing
+ * NOTE : Delete the semaphore specified by semaphore ID
+ * ARGUMENT : SemID sem_id Semaphore ID to be deleted
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_OSERROR ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbDeleteSemaphore(SemID sem_id) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+ int index = 0;
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+ PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL;
+ DWORD dw_ret_sts = 0;
+ DWORD ref_counter = 0;
+
+ /* Parameter check */
+ if (sem_id == 0) {
+ /* Error if specified semaphore ID is zero */
+ ret_api = RET_OSERROR;
+ }
+
+ if (ret_api == RET_NORMAL) {
+ index = static_cast<int>(sem_id) - 1; /* Calculate the index number of the semaphore table from the specified semaphore ID. */
+ if (index >= MAX_PB_SEMAPHORES) {
+ /* If the specified semaphore ID is out of range */
+ ret_api = RET_OSERROR;
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ PbMutexLock(p_inst->h_mutex, INFINITE); /* Need this exclusion? Seems to not be used exclusion at Locking/Unlocking... */
+ p_semaphore_open = p_inst->p_handle_table[index];
+ PbMutexUnlock(p_inst->h_mutex); /* Need this exclusion? Seems to not be used exclusion at Locking/Unlocking... */
+ if (p_semaphore_open == NULL) /* If the specified semaphore ID is not registered in the table */ {
+ ret_api = RET_OSERROR;
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ /* Return an error if the semaphore is locked */
+ dw_ret_sts = PbMutexLock(p_semaphore_open->h_semaphore, 0);
+ if (dw_ret_sts == WAIT_TIMEOUT) {
+ ret_api = RET_OSERROR;
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ PbMutexUnlock(p_semaphore_open->h_semaphore);
+
+ PbMutexLock(p_semaphore_open->h_mutex, INFINITE);
+ if (p_semaphore_open->p_sys_semaphore->ref_counter > 0) {
+ p_semaphore_open->p_sys_semaphore->ref_counter--;
+ }
+
+ ref_counter = p_semaphore_open->p_sys_semaphore->ref_counter;
+ PbMutexUnlock(p_semaphore_open->h_mutex);
+
+ if (ref_counter == 0) {
+ PbMutexLock(p_inst->h_mutex, INFINITE); /* Get Mutex */
+
+ FreeSemaphoreTable(p_inst->p_semaphore_table, index, p_inst->h_mutex);
+ p_semaphore_open->p_sys_semaphore = NULL;
+ if (p_semaphore_open->h_semaphore != NULL) {
+ PbDeleteMutex(p_semaphore_open->h_semaphore);
+ p_semaphore_open->h_semaphore = NULL;
+ }
+
+ if (p_semaphore_open->h_mutex != NULL) {
+ PbDeleteMutex(p_semaphore_open->h_mutex);
+ p_semaphore_open->h_mutex = NULL;
+ }
+
+ PbProcessHeapFree(0, p_semaphore_open);
+
+ p_inst->p_handle_table[index] = NULL;
+ PbMutexUnlock(p_inst->h_mutex); /* Release Mutex */
+ }
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Semaphore Lock
+ *
+ * Get the semaphore with the specified semaphore ID. Do not return from this function until it is acquired.
+ *
+ * @param[in] sem_id Semaphore ID of the semaphore to be acquired
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_OSERROR ABEND
+ */
+RET_API _pb_SemLock(SemID sem_id) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ RET_API ret_api = RET_OSERROR;
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+ PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL;
+ int index = 0;
+ DWORD result = 0;
+
+ /* Parameter check */
+ if (sem_id != 0) {
+ /* The specified semaphore ID is non-zero */
+ index = static_cast<int>(sem_id) - 1; /* Calculate the index number of the semaphore table from the specified semaphore ID. */
+ if (index >= MAX_PB_SEMAPHORES) {
+ /* If the specified semaphore ID is out of range */
+ } else {
+ p_semaphore_open = p_inst->p_handle_table[index];
+ if (p_semaphore_open != NULL) {
+ /* If the specified semaphore ID is already registered in the table, */
+ ret_api = RET_NORMAL;
+ }
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ /* Wait forever until a semaphore is acquired */
+ result = PbMutexLock(p_semaphore_open->h_semaphore, INFINITE);
+
+ switch (result) {
+ case WAIT_OBJECT_0: {
+ ret_api = RET_NORMAL;
+ break;
+ }
+ case WAIT_ABANDONED: { // LCOV_EXCL_BR_LINE 200: function do not return this
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_OSERROR; // LCOV_EXCL_LINE 200: function do not return this
+ break; // LCOV_EXCL_LINE 200: function do not return this
+ }
+ case WAIT_TIMEOUT: { // LCOV_EXCL_BR_LINE 200: parameter INFINITE not return this
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_OSERROR; // LCOV_EXCL_LINE 200: parameter INFINITE not return this
+ break; // LCOV_EXCL_LINE 200: parameter INFINITE not return this
+ }
+ default:
+ ret_api = RET_OSERROR;
+ break;
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Semaphore Unlock
+ *
+ * Release the semaphore specified by semaphore ID.
+ *
+ * @param[in] sem_id Semaphore ID of the semaphore to be released
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_OSERROR ABEND
+ */
+RET_API _pb_SemUnlock(SemID sem_id) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ RET_API ret_api = RET_OSERROR;
+ int index = 0;
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+ PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL;
+ BOOL ok = FALSE;
+
+ /* Parameter check */
+ if (sem_id != 0) {
+ /* The specified semaphore ID is non-zero */
+ index = static_cast<int>(sem_id) - 1; /* Calculate the index number of the semaphore table from the specified semaphore ID. */
+ if (index >= MAX_PB_SEMAPHORES) {
+ /* If the specified semaphore ID is out of range */
+ } else {
+ p_semaphore_open = p_inst->p_handle_table[index];
+ if (p_semaphore_open != NULL) {
+ /* If the specified semaphore ID is already registered in the table, */
+ ret_api = RET_NORMAL;
+ }
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ ok = PbMutexUnlock(p_semaphore_open->h_semaphore); // LCOV_EXCL_BR_LINE 200: unlock can not failed
+ if (ok == FALSE) { // LCOV_EXCL_BR_LINE 200: unlock can not failed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_OSERROR; // LCOV_EXCL_LINE 200: unlock can not failed
+ }
+ }
+
+ return ret_api;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : InitSemaphoreInProcess
+ * ABSTRACT : Semaphore initialization processing
+ * NOTE : Initialize to use semaphore that is valid only within a process
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_OSERROR ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+InitSemaphoreInProcess(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+ DWORD pid; /* Process ID */
+ TCHAR wcs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */
+ char mbs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */
+ char *cp_addr = NULL; /* For returning the start address of the shared data area */
+ u_int32 dummy_size; /* For returning the size of shared data area */
+
+ pid = getpid(); /* Get process ID */
+
+ memset(&wcs_share_data_name[0], 0, sizeof(wcs_share_data_name));
+ memset(&mbs_share_data_name[0], 0, sizeof(mbs_share_data_name));
+#ifdef UNDER_CE
+ /* Create the name of shared data area for in-process semaphore management table */
+ wsprintf(&wcs_share_data_name[0], __TEXT("SemInProc_%08x"), pid);
+ wcstombs(&mbs_share_data_name[0], &wcs_share_data_name[0], sizeof(mbs_share_data_name));
+#else
+ /* Create the name of shared data area for in-process semaphore management table */
+ wsprintf(&mbs_share_data_name[0], __TEXT("SemInProc_%08x"), static_cast<int32>(pid));
+#endif
+
+ /* Link to shared data area for semaphore management table in process */
+ ret_api = _pb_LinkShareData(&mbs_share_data_name[0], reinterpret_cast<void**>(&cp_addr), &dummy_size);
+ if (ret_api == RET_NORMAL) {
+ /* Successful completion because _pb_InitSemaphoreInProcess has already been executed. */
+ } else {
+ /* Create shared data area for in-process semaphore management table */
+ ret_api = _pb_CreateShareData(&mbs_share_data_name[0],
+ static_cast<u_int32>(sizeof(PB_SEM_INPROC) * MAX_PB_SEMAPHORES_INPROC), \
+ reinterpret_cast<void**>(&cp_addr));
+ if (ret_api == RET_NORMAL) {
+ /* Save top address of in-process semaphore management table */
+ g_p_sem_in_proc_mng = reinterpret_cast<PB_SEM_INPROC *>(cp_addr);
+
+ /* Initialization processing of the critical section object for in-process semaphore management table lock */
+ PbInitializeCriticalSection(&g_sem_in_proc_tbl_mng_cs);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " _CWORD64_api.dll:%s:LINE %d\r\n ## " \
+ "ERROR:InitSemaphoreInProcess --> _pb_CreateShareData ##\r\n", LTEXT(__FILE__), __LINE__);
+ ret_api = RET_OSERROR;
+ }
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DeinitSemaphoreInProcess
+ * ABSTRACT : Semaphore function termination processing
+ * NOTE : Terminate semaphore function that is valid only within a process
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_OSERROR ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DeinitSemaphoreInProcess(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+ PB_SEM_INPROC *p_sem_in_proc; /* Pointer to the in-process semaphore management table */
+ DWORD pid; /* Process ID */
+ TCHAR wcs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */
+ char mbs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */
+ char *cp_addr = NULL; /* For returning the start address of the shared data area */
+ u_int32 dummy_size; /* For returning the size of the shared data area */
+ int i;
+
+ pid = getpid(); /* Get process ID */
+
+ memset(&wcs_share_data_name[0], 0, sizeof(wcs_share_data_name));
+ memset(&mbs_share_data_name[0], 0, sizeof(mbs_share_data_name));
+#ifdef UNDER_CE
+ /* Create the name of shared data area for in-process semaphore management table */
+ wsprintf(&wcs_share_data_name[0], __TEXT("SemInProc_%08x"), pid);
+ wcstombs(&mbs_share_data_name[0], &wcs_share_data_name[0], sizeof(mbs_share_data_name));
+#else/* Create the name of shared data area for in-process semaphore management table */
+ wsprintf(&mbs_share_data_name[0], __TEXT("SemInProc_%08x"), static_cast<int32>(pid));
+#endif
+
+ /* Link to shared data area for in-process semaphore management table */
+ ret_api = _pb_LinkShareData(&mbs_share_data_name[0], reinterpret_cast<void**>(&cp_addr), &dummy_size);
+ if (ret_api != RET_NORMAL) {
+ ret_api = RET_NORMAL; /* If the link fails, it is assumed to have been deleted and it completes normally. */
+ } else {
+ /* Get CS for exclusive control of in-process semaphore management table */
+ PbEnterCriticalSection(&g_sem_in_proc_tbl_mng_cs);
+
+ p_sem_in_proc = g_p_sem_in_proc_mng; /* Get start address of in-process semaphore management table */
+ if (p_sem_in_proc == NULL) {
+ ret_api = RET_OSERROR;
+ } else {
+ /* Search in-process semaphore management table (delete all semaphores) */
+ for (i = 0; i < MAX_PB_SEMAPHORES_INPROC; i++, p_sem_in_proc++) {
+ if (p_sem_in_proc->p_cs != 0) {
+ PbDeleteCriticalSection(p_sem_in_proc->p_cs); /* Delete critical section */
+ /* Release the Heap area allocated as the critical section structured area */
+ PbProcessHeapFree(0, p_sem_in_proc->p_cs);
+ }
+ }
+
+ ret_api = PbDeleteShareData(&mbs_share_data_name[0]); /* Delete shared data area */
+ if (ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " _CWORD64_api.dll:%s:LINE %d\r\n ## " \
+ "ERROR:DeinitSemaphoreInProcess --> PbDeleteShareData ##\r\n", LTEXT(__FILE__), __LINE__);
+ ret_api = RET_OSERROR;
+ } else {
+ g_p_sem_in_proc_mng = NULL;
+ }
+ }
+
+ PbLeaveCriticalSection(&g_sem_in_proc_tbl_mng_cs); /* Release CS for exclusive control of in-process semaphore management table */
+
+ if (ret_api == RET_NORMAL) {
+ /* When the process is completed normally up to this point */
+ PbDeleteCriticalSection(&g_sem_in_proc_tbl_mng_cs); /* Delete critical section */
+ }
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/***** Internal functions *****/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FindSemaphoreTable
+ * ABSTRACT : Name storage table retrieval processing
+ * NOTE : Retrieve the specified name storage table with the specified name,
+ * : and return its array index if the specified name exists in the table.
+ * : The specified Mutex is locked during this table retrieval processing.
+ * ARGUMENT : PB_SEMAPHORE* p_semaphore_table Pointer to the name storage TBL
+ * TCHAR* name Pointer to the name to be retrieved
+ * HANDLE h_mutex Handle of the name storage TBL-locking Mutex
+ * RETURN : DWORD othe than -1 Array index of containing the name string to be retrieved
+ * : -1 Specified name does not exist
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static DWORD
+FindSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex) {
+ DWORD ret = (DWORD) - 1;
+ /* Loop up to the maximum number of entries and search the name storage table. */
+ for (int n = 0; n < MAX_PB_SEMAPHORES; n++) {
+ /* If there is a matching name, */
+ if (_tcscmp(p_semaphore_table[n].semaphore_name, name) == 0) {
+ ret = n; /* Return the index of the array in which the given name existed */
+ break;
+ }
+ }
+ /* UnLock the lock Mutex because the search for the name storage table has been completed. */
+ /* PbMutexUnlock(h_mutex); */
+
+ return ret; /* Since no search name exists, an error value of-1 is returned. */
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : AllocNewSemaphoreTable
+ * ABSTRACT : Name storage table free space retrieval processing
+ * NOTE : Retrieve the specified name storage table from the beginning,
+ * : return the array index of any free space.
+ * : [Note] Because the Mutex part inside this function has been deleted
+ * : to fix a bug caused by Mutex leaks, the whole function must be
+ * : locked by Mutex from the outside when this function is used.
+ * ARGUMENT : PB_SEMAPHORE *p_semaphore_table
+ * TCHAR *name
+ * HANDLE h_mutex
+ * RETURN : DWORD
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static DWORD
+AllocNewSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex) {
+ DWORD ret = (DWORD) - 1;
+ /* Loop up to the maximum number of entries and search the name storage table. */
+ for (int n = 0; n < MAX_PB_SEMAPHORES; n++) {
+ /* If there is free space */
+ if (p_semaphore_table[n].semaphore_name[0] == __TEXT('\0')) {
+ ret = n;
+ break;
+ }
+ }
+
+ return ret;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FreeSemaphoreTable
+ * ABSTRACT :
+ * NOTE :
+ * ARGUMENT : PB_SEMAPHORE* p_semaphore_table
+ * int index
+ * HANDLE h_mutex
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void
+FreeSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, int index, HANDLE h_mutex) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ p_semaphore_table[index].semaphore_name[0] = __TEXT('\0');
+}
+// LCOV_EXCL_STOP
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : _sysSem.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
diff --git a/vehicleservice/positioning_base_library/library/src/_pbSerial.cpp b/vehicleservice/positioning_base_library/library/src/_pbSerial.cpp
new file mode 100755
index 0000000..c6044af
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbSerial.cpp
@@ -0,0 +1,525 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "_pbSerial.h"
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+
+typedef struct SerialTable {
+ HANDLE h_handle; /* Registration handle */
+ DWORD dw_wait_mask; /* SetMask */
+ DWORD dw_read_timeout; /* milisec */
+ DWORD dw_write_timeout; /* milisec */
+ struct SerialTable *next;
+} SERIAL_TABLE;
+
+static SERIAL_TABLE *g_pst_serial_table = NULL;
+static pthread_mutex_t g_func_lock_mutex = PTHREAD_MUTEX_INITIALIZER; /* Consider replacing it later */
+
+/* Prototype declarations */
+static BOOL FindList(SERIAL_TABLE **p_list, HANDLE h_obj);
+static BOOL AddList(SERIAL_TABLE *p_add_list);
+static BOOL DelList(SERIAL_TABLE *h_del_obj);
+static BOOL FunctionLock(void);
+static BOOL FunctionUnlock(void);
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* _sys internal public APIs
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+@brief SerialTableInit<BR>
+ Initialize each process
+@outline SerialTableInit<BR>
+ Initialize each process
+@type Completion return type
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialTableInit(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* do nothing at this time */
+ return TRUE;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialTableTerm<BR>
+ termination processing for each process
+@outline SerialTableTerm<BR>
+ termination processing for each process
+@type Completion return type
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialTableTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (NULL != g_pst_serial_table) {
+ /* delete the list? */
+ }
+ return TRUE;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialObjectTimeoutAdd<BR>
+ Set read/write timeout
+@outline SerialObjectTimeoutAdd<BR>
+ Set read/write timeout
+@type Completion return type
+
+@param[in] HANDLE h_obj : Handle to set the timeout
+@param[in] DWORD dw_read_timeout : Timeout to read (Millisecond)
+@param[in] DWORD dw_write_timeout : Timeout to write (Millisecond)
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialObjectTimeoutAdd(HANDLE h_obj, DWORD dw_read_timeout, DWORD dw_write_timeout) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *p_list = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != h_obj) {
+ FunctionLock();
+ bret = FindList(&p_list, h_obj);
+ if (TRUE == bret) {
+ /* Already exists in the list */
+ if (NULL != p_list) {
+ p_list->dw_read_timeout = dw_read_timeout;
+ p_list->dw_write_timeout = dw_write_timeout;
+ bret = TRUE;
+ } else {
+ /* The list pointer is expected to be in the list but cannot be retrieved. */
+ bret = FALSE;
+ }
+ } else {
+ /* Not exist in the list */
+ p_list = reinterpret_cast<SERIAL_TABLE*>(malloc(sizeof(SERIAL_TABLE)));
+ if (NULL != p_list) {
+ p_list->next = NULL;
+ p_list->dw_wait_mask = 0;
+ p_list->h_handle = h_obj;
+ p_list->dw_read_timeout = dw_read_timeout;
+ p_list->dw_write_timeout = dw_write_timeout;
+ bret = AddList(p_list);
+ if (FALSE == bret) {
+ /* Registration failure */
+ free(p_list);
+ bret = FALSE;
+ } else {
+ /* Registration success */
+ bret = TRUE;
+ }
+ } else {
+ /* Falied to get memory */
+ bret = FALSE;
+ }
+ }
+ FunctionUnlock();
+ } else {
+ /* Parameter error */
+ bret = FALSE;
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialObjectTimeoutGet<BR>
+ Get read/write timeout
+@outline SerialObjectTimeoutGet<BR>
+ Get read/write timeout
+@type Completion return type
+
+@param[in] HANDLE h_obj : Handle for getting the timeout
+@param[out] DWORD* dw_read_timeout : Timeout to read (Millisecond)
+@param[out] DWORD* dw_write_timeout : Timeout to write (Millisecond)
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialObjectTimeoutGet(HANDLE h_obj, DWORD *dw_read_timeout, DWORD *dw_write_timeout) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *p_list = NULL;
+ BOOL bret = FALSE;
+
+ if ((NULL != h_obj) && (NULL != dw_read_timeout) && (NULL != dw_write_timeout)) {
+ FunctionLock();
+ bret = FindList(&p_list, h_obj);
+ if (TRUE == bret) {
+ /* Exists in the list */
+ if (NULL != p_list) {
+ *dw_read_timeout = p_list->dw_read_timeout;
+ *dw_write_timeout = p_list->dw_write_timeout;
+ bret = TRUE;
+ } else {
+ /* The list pointer is expected to be in the list but cannot be retrieved. */
+ bret = FALSE;
+ }
+ } else {
+ /* Not exist in the list */
+ bret = FALSE;
+ }
+ FunctionUnlock();
+ } else {
+ /* Parameter error */
+ bret = FALSE;
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialObjectWaitmaskAdd<BR>
+ Set the mask of event wait factor
+@outline SerialObjectWaitmaskAdd<BR>
+ Set the mask of event wait factor
+@type Completion return type
+
+@param[in] HANDLE h_obj : Handle to set the mask
+@param[in] DWORD dw_mask : Value of mask
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialObjectWaitmaskAdd(HANDLE h_obj, DWORD dw_mask) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *p_list = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != h_obj) {
+ FunctionLock();
+ bret = FindList(&p_list, h_obj);
+ if (TRUE == bret) {
+ /* already exists in the list */
+ if (NULL != p_list) {
+ /* Clear unused flags */
+ p_list->dw_wait_mask = (DWORD)((dw_mask) & (EV_RXCHAR | EV_ERROR | EV_DSR));
+ bret = TRUE;
+ } else {
+ /* The list pointer is expected to be in the list but cannot be retrieved. */
+ bret = FALSE;
+ }
+ } else {
+ /* Not exist in the list */
+ p_list = reinterpret_cast<SERIAL_TABLE*>(malloc(sizeof(SERIAL_TABLE)));
+ if (NULL != p_list) {
+ p_list->next = NULL;
+ p_list->h_handle = h_obj;
+ p_list->dw_read_timeout = INFINITE; /* Infinity wait as initial value */
+ p_list->dw_write_timeout = INFINITE; /* Infinity wait as initial value */
+ /* Clear unused flags */
+ p_list->dw_wait_mask = (DWORD)((dw_mask) & (EV_RXCHAR | EV_ERROR | EV_DSR));
+ bret = AddList(p_list);
+ if (FALSE == bret) {
+ /* Registration failure */
+ free(p_list);
+ bret = FALSE;
+ } else {
+ /* registration success */
+ bret = TRUE;
+ }
+ } else {
+ /* Failed to get memory */
+ bret = FALSE;
+ }
+ }
+ FunctionUnlock();
+ } else {
+ /* Parameter error */
+ bret = FALSE;
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialObjectWaitmaskGet<BR>
+ Get the set mask value from a handle
+@outline SerialObjectWaitmaskGet<BR>
+ Get the set mask value from a handle
+@type Completion return type
+
+@param[in] HANDLE h_obj : Handle from which the mask is to be acquired
+@param[out] DWORD* dw_mask : mask value
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialObjectWaitmaskGet(HANDLE h_obj, DWORD *dw_mask) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *p_list = NULL;
+ BOOL bret = FALSE;
+
+ if ((NULL != h_obj) && (NULL != dw_mask)) {
+ *dw_mask = 0;
+ FunctionLock();
+ bret = FindList(&p_list, h_obj);
+ if (TRUE == bret) {
+ /* Exists in the list */
+ if (NULL != p_list) {
+ *dw_mask = p_list->dw_wait_mask;
+ bret = TRUE;
+ } else {
+ /* The list pointer is expected to be in the list but cannot be retrieved. */
+ bret = FALSE;
+ }
+ } else {
+ /* Not exist in the list */
+ bret = FALSE;
+ }
+ FunctionUnlock();
+ } else {
+ /* Parameter error */
+ bret = FALSE;
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialObjectDel<BR>
+ Delete Timeout and Mask Setting
+@outline SerialObjectDel<BR>
+ Delete Timeout and Mask Setting
+@type Completion return type
+
+@param[in] HANDLE h_obj : Handle from which the setting is to be deleted
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialObjectDel(HANDLE h_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *p_list = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != h_obj) {
+ FunctionLock();
+ bret = FindList(&p_list, h_obj);
+ if (TRUE == bret) {
+ /* Already exists in the list */
+ if (NULL != p_list) {
+ bret = DelList(p_list);
+ if (TRUE == bret) {
+ free(p_list);
+ } else {
+ /* Failed to delete */
+ }
+ } else {
+ /* The list pointer is expected to be in the list but cannot be retrieved. */
+ bret = FALSE;
+ }
+ } else {
+ /* Not exist in the list */
+ }
+ FunctionUnlock();
+ } else {
+ /* Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* Private APIs
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+@brief FindList<BR>
+ Searching for a Handle in the List
+@outline FindList<BR>
+ Searching for a Handle in the List
+@type Completion return type
+
+@param[out] SERIAL_TABLE** p_list : Found list pointer
+@param[in] HANDLE h_obj : Handle to look for
+
+@return BOOL
+@retval TRUE : Normal (p_list != NULL)
+@retval FALSE : Error (p_list == NULL)
+*****************************************************************************/
+static BOOL FindList(SERIAL_TABLE **p_list, HANDLE h_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *pNow = NULL;
+ BOOL bret = FALSE;
+
+ if ((NULL != h_obj) && (NULL != p_list)) {
+ /* Search list */
+ pNow = g_pst_serial_table;
+ while (NULL != pNow) {
+ /* h_obj and pNow->h_handle are pointer type.*/
+ if ((int64_t)h_obj == (int64_t)pNow->h_handle) {
+ *p_list = pNow;
+ bret = TRUE;
+ break;
+ }
+ pNow = pNow->next;
+ }
+ } else {
+ bret = FALSE; /* Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief AddList<BR>
+ Append data to the end of the list
+@outline AddList<BR>
+ Append data to the end of the list
+@type Completion return type
+
+@param[in] SERIAL_TABLE* p_list : Data to add
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL AddList(SERIAL_TABLE *p_add_list) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *pNow = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != p_add_list) {
+ /* Add unregistered data */
+ if (NULL == g_pst_serial_table) {
+ g_pst_serial_table = p_add_list;
+ bret = TRUE;
+ } else {
+ /* Add to end of list */
+ pNow = g_pst_serial_table;
+ while (NULL != pNow) {
+ if (NULL == pNow->next) {
+ pNow->next = p_add_list;
+ bret = TRUE;
+ break;
+ }
+ pNow = pNow->next;
+ }
+ }
+ } else {
+ bret = FALSE; /* Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief DelList<BR>
+ Remove Specified Data from a List
+@outline DelList<BR>
+ Remove Specified Data from a List
+@type Completion return type
+
+@param[in,out] SERIAL_TABLE* h_del_obj :
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL DelList(SERIAL_TABLE *h_del_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *pNow = NULL;
+ SERIAL_TABLE *pBef = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != h_del_obj) {
+ /* Add to end of list */
+ pNow = g_pst_serial_table;
+ while (NULL != pNow) {
+ if (h_del_obj == pNow) {
+ if (NULL == pBef) {
+ /* Delete first data */
+ g_pst_serial_table = pNow->next;
+ } else {
+ /* Others */
+ pBef->next = h_del_obj->next;
+ }
+ bret = TRUE;
+ break;
+ }
+ pBef = pNow;
+ pNow = pNow->next;
+ }
+ } else {
+ bret = FALSE; /* Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief FunctionLock<BR>
+ Start locking g_pst_serial_table
+@outline FunctionLock<BR>
+ Start locking g_pst_serial_table
+@type Completion return type
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL FunctionLock(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ if (EOK == pthread_mutex_lock(&g_func_lock_mutex)) {
+ bret = TRUE;
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/***************************************************************************
+@brief FunctionUnlock<BR>
+ Terminate locking of g_pst_serial_table
+@outline FunctionUnlock<BR>
+ Terminate locking of g_pst_serial_table
+@type Completion return type
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL FunctionUnlock(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ if (EOK == pthread_mutex_unlock(&g_func_lock_mutex)) {
+ bret = TRUE;
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
diff --git a/vehicleservice/positioning_base_library/library/src/_pbSram.cpp b/vehicleservice/positioning_base_library/library/src/_pbSram.cpp
new file mode 100755
index 0000000..f31e16f
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbSram.cpp
@@ -0,0 +1,316 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbSram.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System common functions
+ Title : System APIs
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /*
+ Function prototype declarations
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ RET_API SramDMWt(u_int32 mode);
+ RET_API SramDMWrkWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size);
+ RET_API SramDMWrkRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size);
+
+#ifdef __cplusplus
+}
+#endif
+
+/*
+ External function prototype declarations
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+extern RET_API CreateAsyncWtThread(void);
+
+/*
+ Global Variable Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+extern int g_n_api_set_id; /* ID variable for PSL registration */
+extern void *g_adr_diagmem_wrktop; /* Diag memory temporary work area top address */
+
+#ifdef CEPC_EM /* Physical area (pseudo area) setting for CEPC and EM */
+
+/* Allocation size of temporary work for diagnosis memory */
+#define SIZE_DIAGMEM_WRK 0x00001000
+
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramSetup
+ * ABSTRACT : SRAM Access-Initialization Process
+ * NOTE : When called by _sys_SramInit when _CWORD64_api.dll is attached, the SRAM physical area
+ * is mapped to the shared area so that the SRAM physical area can be accessed.
+ * The first call after system startup checks the result of the previous SRAM write processing.
+ * If the power is off during system startup, the system performs continuous write processing.
+ * (Before the _CWORD100_ modularization of SRAM access functions,
+ * they were used to open ports, but now they do not need to be opened.)
+ * ARGUMENT : u_int32 mount_flg HDD mount status flag
+ * u_int32 *mount_sts HDD mount status return pointer
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramSetup(u_int32 mount_flg, u_int32 *mount_sts) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramWt
+ * ABSTRACT : SRAM write process
+ * NOTE : Write the content of the buffer to the offset-position of the area of the specified SRAM ID.
+ * Temporary buffer is used for SRAM writing, and recovery from writing is considered.
+ * Therefore, the transfer data size must be less than or equal to the temporary buffer size.
+ * ARGUMENT : u_int8 id SRAM area id
+ * void *pbuf Source buffer pointer
+ * u_int32 off Destination SRAM offsets (bytes)
+ * u_int16 size Transfer data size (bytes)
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramFil
+ * ABSTRACT : SRAM memory-fill process
+ * NOTE : Fill with the specified patterns from the offset position of
+ * the area of the specified SRAM ID.
+ * Temporary buffer is used for SRAM writing, and recovery from writing is considered.
+ * Therefore, it is effective that the fill size is less than or equal to the temporary buffer size.
+ * ARGUMENT : u_int8 id SRAM area id
+ * u_int32 off Fill destination SRAM offset (bytes)
+ * u_int8 pat Fill pattern
+ * u_int16 size Fill size (bytes)
+ *
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramFil(u_int8 id, u_int32 off, u_int8 pat, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+
+ ret_sts = PbSramFil32(id, off, pat, (u_int32)size);
+
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbSramFil32
+ * ABSTRACT : SRAM memory-fill process
+ * NOTE : Fill with the specified patterns from the offset position of
+ * the area of the specified SRAM ID.
+ * Temporary buffer is used for SRAM writing, and recovery from writing is considered.
+ * Therefore, it is effective that the fill size is less than or equal to the temporary buffer size.
+ * ARGUMENT : u_int8 id SRAM area id
+ * u_int32 off Fill destination SRAM offset (bytes)
+ * u_int8 pat Fill pattern
+ * u_int32 size Fill size (bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbSramFil32(u_int8 id, u_int32 off, u_int8 pat, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramRd
+ * ABSTRACT : SRAM read process
+ * NOTE : Write content in the area specified SRAM ID and offset position to buffer.
+ * ARGUMENT : u_int8 id SRAM area ID
+ * u_int32 off Source SRAM Offset (bytes)
+ * void *pbuf Destination buffer pointer
+ * u_int16 size Transfer data size (bytes)
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+
+ ret_sts = PbSramRd32(id, off, pbuf, (u_int32)size);
+
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbSramRd32
+ * ABSTRACT : SRAM read process
+ * NOTE : Write content in the area specified SRAM ID and offset position to buffer.
+ * ARGUMENT : u_int8 id SRAM area ID
+ * u_int32 off Source SRAM Offset (bytes)
+ * void *pbuf Destination buffer pointer
+ * u_int32 size Transfer data size(bytes)
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbSramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramSz
+ * ABSTRACT : Acquisition of SRAM ID size
+ * NOTE : Get the effective area size of the specified SRAM ID.
+ * ARGUMENT : u_int8 id SRAM area ID
+ * u_int16 *psize Size (bytes)
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramSz(u_int8 id, u_int16 *psize) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ u_int32 size32 = 0;
+
+ ret_sts = PbSramSz32(id, &size32);
+ if (ret_sts == RET_NORMAL) {
+ if (size32 <= 0x0000FFFF) {
+ *psize = (u_int16)size32;
+ } else {
+ /* When the size of the specified ID is u_int16 or greater */
+ ret_sts = RET_ERRPARAM;
+ }
+ }
+
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbSramSz32
+ * ABSTRACT : Acquisition of SRAM ID size
+ * NOTE : Get the effective area size of the specified SRAM ID.
+ * ARGUMENT : u_int8 id SRAM area ID
+ * u_int32 *psize Size (bytes)
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbSramSz32(u_int8 id, u_int32 *psize) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramRWChk
+ * ABSTRACT : SRAM read/write check processing
+ * NOTE : Checking whether SRAM can be read/written correctly
+ * ARGUMENT : None
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramRWChk(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_NORMAL; /* Result */
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : AsyncFWt
+ * ABSTRACT : Asynchronous Data HDD Backup Processing
+ * NOTE :
+ * ARGUMENT : void
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API AsyncFWt(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ /* _CWORD121_ compliant ret_sts = Backup_AsyncForcibleWrite(); */
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramWtAccOff
+ * ABSTRACT : Asynchronous Data HDD Backup Process at ACC-OFF
+ * NOTE : Saving Asynchronous Data to Hard Drives at ACC-OFF
+ * ARGUMENT : void
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API SramWtAccOff(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ /* _CWORD121_ compliant ret_sts = Backup_AccOffNotify(); */
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DataWtWaitHDDSpinup
+ * ABSTRACT : HDD spin-up completion wait data save processing
+ * NOTE : Save to the HDD
+ * ARGUMENT : u_int16 para Startup Identification Value
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DataWtWaitHDDSpinup(u_int16 para) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_NORMAL; /* Result */
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramLoadFromExtDev
+ * ABSTRACT : SRAM recovery processing
+ * NOTE : Restore Static data stored as a file on an externally attached device
+ * and the registry data to the HDD.
+ * ARGUMENT : u_int32 device Device where the file to be restored resides
+ * SD card:EXTDEV_STRAGECARD
+ * PC card:EXTDEV_PCCARD
+ * RET_API *err Error code
+ * RETURN : Return only RET_ERROR (Just perform reset without returning of this function when normal end)
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramLoadFromExtDev(ANA_RET_API *err) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : _pbSram.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
diff --git a/vehicleservice/positioning_base_library/library/src/_pbSum.cpp b/vehicleservice/positioning_base_library/library/src/_pbSum.cpp
new file mode 100755
index 0000000..2964db7
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbSum.cpp
@@ -0,0 +1,95 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbSum.cpp
+ System name :
+ Subsystem name : System common functions
+ Title : System APIs Asynchronous Data HDD Backup Processing
+ --------------------------------------------------------------------------------------
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*
+ Function prototype declarations
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : Sum()
+ * ABSTRACT : SUM calculation process
+ * NOTE : Calculate the SUM value for the specified size from the SUM calculation start address.
+ * ARGUMENT : void *p SUM calculation start address
+ * int32 size Size (bytes)
+ * u_int8 type Calculation width Byte :sizeof(u_char)
+ * Word :sizeof(u_int16)
+ * Long-word:sizeof(u_int32)
+ * NOTE : Calculate the SUM value from the SUM calculation start address by the size specified by the calculation width.
+ * RETURN : u_int32 SUM value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+u_int32 Sum(void *p, int32 size, u_int8 type) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int32 sum = 0; /* SUM value */
+ u_int32 loop_cnt; /* Loop counter */
+ u_int32 loop_num; /* Number of loops */
+
+ /* Pointer size check */
+ if ((p == NULL) || (size == 0)) {
+ /* nop */
+ } else {
+ /* When the calculation width is "Long word" */
+ if (type == sizeof(int32)) {
+ u_int32 * ptr32 = reinterpret_cast<u_int32 *>(p); /* Long word pointer */
+
+ /* Calculate the number of processes and loop for the number of Times to compute the Sum value. */
+ loop_num = static_cast<u_int32>(size / sizeof(u_int32));
+ for (loop_cnt = 0; loop_cnt < loop_num; loop_cnt++) {
+ sum += *ptr32;
+ ptr32++;
+ }
+ } else if (type == sizeof(int16)) {
+ /* For "Word" */
+ u_int16 * ptr16 = reinterpret_cast<u_int16 *>(p); /* Word pointer */
+
+ loop_num = static_cast<u_int32>(size / sizeof(u_int16));
+ for (loop_cnt = 0; loop_cnt < loop_num; loop_cnt++) {
+ sum += *ptr16;
+ ptr16++;
+ }
+ } else if (type == sizeof(char)) {
+ /* For "Byte" */
+ u_char * ptr8 = reinterpret_cast<u_char *>(p); /* Byte pointer */
+
+ loop_num = static_cast<u_int32>(size / sizeof(u_char));
+ for (loop_cnt = 0; loop_cnt < loop_num; loop_cnt++) {
+ sum += *ptr8;
+ ptr8++;
+ }
+ } else {
+ /* For other than above */
+ /* No processing */
+ }
+ }
+ return sum;
+}
+// LCOV_EXCL_STOP
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : Sum.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
diff --git a/vehicleservice/positioning_base_library/library/src/_pbTimer.cpp b/vehicleservice/positioning_base_library/library/src/_pbTimer.cpp
new file mode 100755
index 0000000..f36711f
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbTimer.cpp
@@ -0,0 +1,1115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbTimer.cpp
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <native_service/ns_message_center_if.h>
+
+#include <vehicle_service/positioning_base_library.h>
+#include "TimerEntryDrv_If.h"
+#include "DEV_TimerEntryDrv_if.h"
+
+#include <native_service/ns_timer_if.h>
+#include "WPF_STD_private.h"
+
+
+/*---------------------------------------------------------------------------------*
+ * Define *
+ *---------------------------------------------------------------------------------*/
+#define MAX_CTRL_TIMER_NUM (8)
+
+#define CID_TIMER_1 (0x1000)
+#define CID_TIMER_2 (0x1001)
+#define CID_TIMER_3 (0x1002)
+#define CID_TIMER_4 (0x1003)
+#define CID_TIMER_5 (0x1004)
+#define CID_TIMER_6 (0x1005)
+#define CID_TIMER_7 (0x1006)
+#define CID_TIMER_8 (0x1007)
+
+#define TIMER_MAKE_DEFAULT_MESSAGE(x) \
+ (x)->Header.signo = 0; \
+ (x)->Header.hdr.sndpno = 0; \
+ (x)->Header.hdr.respno = 0; \
+ (x)->Header.hdr.cid = CID_TIMER_TOUT; \
+ (x)->Header.hdr.msgbodysize = \
+ static_cast<uint16_t>(sizeof(TimerToutMsg) - sizeof(T_APIMSG_MSGBUF_HEADER)); \
+ (x)->Header.hdr.rid = 0; \
+ (x)->Header.hdr.reserve = 0; \
+ (x)->TimerSeq = 0;
+
+/*---------------------------------------------------------------------------------*
+ * Structure *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Timer control information
+*/
+typedef struct {
+ CID cid; /**< Command ID */
+ HANDLE h_timer; /**< Timer handle */
+ TimerToutMsg msg_buf; /**< Message buffer */
+ uint16_t size; /**< Message size */
+ PNO pno; /**< Process number */
+ uint16_t seq_no; /**< Timer Sequence Number */
+ uint8_t type; /**< Timer type */
+ uint32_t time_out; /**< Timeout */
+} TIMER_CTRL_INFO;
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+/* Timer control table manipulation functions */
+static void TimerSetCidOfCtrlTbl(u_int32 idx, CID cid); /* Set timer CID */
+static CID TimerGetCidOfCtrlTbl(u_int32 idx); /* Get timer CID */
+static void TimerSetPnoOfCtrlTbl(u_int32 idx, PNO pno); /* Set PNO */
+static PNO TimerGetPnoOfCtrlTbl(u_int32 idx); /* Get PNO */
+static void TimerSetSizeOfCtrlTbl(u_int32 idx, u_int16 size); /* Set message size */
+static TimerToutMsg* TimerGetMsgBufOfCtrlTbl(u_int32 idx); /* Get message buffer */
+static void TimerSetTimerHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Set timer handle */
+static HANDLE TimerGetTimerHandleOfCtrlTbl(u_int32 idx); /* Get timer handle */
+static void TimerSetTypeOfCtrlTbl(u_int32 idx, u_int8 type); /* Set timer type */
+static u_int8 TimerGetTypeOfCtrlTbl(u_int32 idx); /* Get timer type */
+static void TimerSetSeqNoOfCtrlTbl(u_int32 idx, u_int16 seq_no); /* Set timer Sequence Number */
+static u_int16 TimerGetSeqNoOfCtrlTbl(u_int32 idx); /* Get timer sequence number */
+static void TimerSetTimeOutOfCtrlTbl(u_int32 idx, u_int32 time_out); /* Set timeout */
+static u_int32 TimerGetTimeOutOfCtrlTbl(u_int32 idx); /* Get timeout */
+static u_int32 TimerSearchEmptyOfCtrlTbl(void); /* Search unused area */
+static u_int32 TimerSearchTimerOfCtrlTbl(PNO snd_pno, u_int16 timer_seq, u_int8 time_type); /* Search specified timer */
+static void TimerClearSettingOfCtrlTbl(u_int32 idx); /* Clear timer information */
+
+/* Mutex handling Functions for accessing Timer Control Table */
+static void TimerCreateMutex(void); /* Create Mutex */
+static void TimerDeleteMutex(void); /* Delete Mutex */
+static void TimerLockMutex(void); /* Get Mutex */
+static void TimerUnlockMutex(void); /* Release Mutex */
+
+/* Callback function resources */
+static EFrameworkunifiedStatus TimerCallback1(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback2(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback3(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback4(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback5(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback6(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback7(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback8(HANDLE h_app);
+
+static void TimerCallbackComProc(const uint8_t id);
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Values *
+ *---------------------------------------------------------------------------------*/
+/**
+ Timer control table
+ Note : Access to this instance shall be made through the operation module.
+*/
+static TIMER_CTRL_INFO g_timer_ctrl_tbl[MAX_CTRL_TIMER_NUM]; // NOLINT(readability/nolint) global class instance
+
+/** Timer control table lock Mutex handle */
+static HANDLE g_h_mtx = NULL;
+
+/** Timer event destination handle */
+static HANDLE g_h_service;
+
+
+/** Dispatcher Registration Callback Table */
+static const FrameworkunifiedProtocolCallbackHandler kTimerPcbhs[] = {
+ {CID_TIMER_1, &TimerCallback1 },
+ {CID_TIMER_2, &TimerCallback2 },
+ {CID_TIMER_3, &TimerCallback3 },
+ {CID_TIMER_4, &TimerCallback4 },
+ {CID_TIMER_5, &TimerCallback5 },
+ {CID_TIMER_6, &TimerCallback6 },
+ {CID_TIMER_7, &TimerCallback7 },
+ {CID_TIMER_8, &TimerCallback8 },
+}; // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Timer function initialization
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABEND
+ */
+RET_API TimerInit(HANDLE h_app) {
+ RET_API ret_api = RET_NORMAL;
+ u_int32 idx;
+ HANDLE h_timer;
+ EFrameworkunifiedStatus estatus;
+ NSTimerInfo timer_info;
+ HANDLE* p_h_service = &g_h_service;
+
+ if (h_app == NULL) { // LCOV_EXCL_BR_LINE 6: h_app cannot be Null
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! [h_app=%p]", h_app);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 6: h_app cannot be Null
+ } else {
+ memset(&timer_info, 0x00, sizeof(timer_info));
+
+ /* Create Mutex */
+ TimerCreateMutex(); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Register callback function for timer control */
+ // LCOV_EXCL_BR_LINE 4: nsfw error
+ estatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, "NS_ANY_SRC", kTimerPcbhs, _countof(kTimerPcbhs)); // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+ if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When registration fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "FrameworkunifiedAttachCallbacksToDispatcher ERROR [status:%d]", estatus);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ }
+
+ /* Initialization of timer control table */
+ for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) {
+ TimerSetCidOfCtrlTbl(idx, static_cast<CID>(kTimerPcbhs[idx].iCmd)); /* Set timer control CID */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+
+ /* Initialize timeout */
+ TimerSetTimeOutOfCtrlTbl(idx, 0); // LCOV_EXCL_BR_LINE 200: no branch
+
+ *p_h_service = McOpenSender("Positioning"); /* Be intended for use only in Positioning */ // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+
+ /* Create Timer Resource */
+ timer_info.iCmd = TimerGetCidOfCtrlTbl(idx); /* Only CID needs to be set. */ // LCOV_EXCL_BR_LINE 200: no branch
+ h_timer = NS_TimerCreate(timer_info, CALLBACK_MESSAGE, (HANDLE)*p_h_service); // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+ if (h_timer == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When an error occurs */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "NS_TimerCreate ERROR [h_timer:%p, hService:%p]", h_timer, *p_h_service);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ /* If successful */
+ /* Set Handle information */
+ TimerSetTimerHandleOfCtrlTbl(idx, h_timer); // LCOV_EXCL_BR_LINE 200: no branch
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Terminate timer function
+ *
+ * @return Normal completion
+ */
+RET_API TimerTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+ u_int32 idx;
+ HANDLE h_timer;
+ EFrameworkunifiedStatus estatus;
+ HANDLE* p_h_service = &g_h_service;
+
+ /* If a control Mutex has not been created, it is determined that the Timer function has not been initialized (non Positioning processes) and the process terminates with an error. */
+ if (g_h_mtx == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_h_mtx is NULL!!");
+ ret_api = RET_ERROR;
+ } else {
+ /* Delete timer control information */
+ for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) {
+ h_timer = TimerGetTimerHandleOfCtrlTbl(idx);
+ if (h_timer != NULL) {
+ /* Delete timer */
+ estatus = NS_TimerDelete(h_timer);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ /* When an error occurs */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "NS_TimerDelete ERROR [estatus:%d, h_timer:%p]", estatus, h_timer);
+ }
+ TimerSetTimerHandleOfCtrlTbl(idx, NULL);
+ }
+
+ TimerClearSettingOfCtrlTbl(idx);
+ }
+
+ /* Mutex deletion */
+ TimerDeleteMutex();
+ }
+
+ /* Delete transmission handle */
+ estatus = McClose(*p_h_service);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McClose ERROR [estatus:%d, hService:%p]", \
+ estatus, *p_h_service);
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Fixed period/asynchronous timer start instruction
+ *
+ * @param[in] snd_pno Requesting process number
+ * @param[in] timer_seq Timer sequence number
+ * @param[in] TimerType Timer type
+ * @param[in] time_out Timeout value [10ms]
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR Message transmission error<br>
+ * RET_ERRPARAM Parameter error
+ */
+RET_API _pb_ReqTimerStart(PNO snd_pno, u_int16 timer_seq, // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ u_int8 time_type, u_int32 time_out) {
+ RET_API ret_api = RET_NORMAL; /* Return value of this module */
+ u_int32 idx;
+ TimerToutMsg *p_msg;
+ EFrameworkunifiedStatus estatus;
+ HANDLE h_timer;
+ NSTimerInfo timer_info;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ /* If a control Mutex has not been created, it is determined that the Timer function has not been initialized (non Positioning processes) and the process terminates with an error. */
+ if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 6: g_h_mtx cannot be null
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_h_mtx is NULL!!");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 6: g_h_mtx cannot be null
+ } else {
+ /* Parameter study */
+ if ((time_type != TIMER_TYPE_SYN) && (time_type != TIMER_TYPE_USN)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [time_type:%d]", time_type);
+ ret_api = RET_ERRPARAM; /* Timer type error */
+ }
+
+ if (time_out == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [time_out:%d]", time_out);
+ ret_api = RET_ERRPARAM; /* Timer setting value error */
+ }
+
+ /* When a timer of the same process number, sequence number, or type is already registered, creation of the timer is not allowed. */
+ idx = TimerSearchTimerOfCtrlTbl(snd_pno, timer_seq, time_type);
+ if (idx != MAX_CTRL_TIMER_NUM) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TimerSearchTimerOfCtrlTbl ERROR!! " \
+ "[snd_pno:%d, timer_seq:%d, TimeType:%d]", snd_pno, timer_seq, time_type);
+ ret_api = RET_ERRPARAM; /* Invalid timer value */
+ }
+
+ /* Parameter normal */
+ if (ret_api == RET_NORMAL) {
+ TimerLockMutex(); /* Get Mutex */
+
+ /* Get free space in timer control table */
+ idx = TimerSearchEmptyOfCtrlTbl(); // LCOV_EXCL_BR_LINE 200: no branch
+ if (idx == MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 200: idx can not be MAX_CTRL_TIMER_NUM
+ // LCOV_EXCL_START 200: idx can not be MAX_CTRL_TIMER_NUM
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When there is no free space */
+ /* Be impossible by design */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TimerSearchEmptyCtrlTbl ERROR!! " \
+ "[idx = %d]", idx);
+ _pb_Exit();
+ /* don't arrive here. */
+ // LCOV_EXCL_STOP
+ }
+
+ /* Get message buffer address */
+ p_msg = TimerGetMsgBufOfCtrlTbl(idx);
+
+ TIMER_MAKE_DEFAULT_MESSAGE(p_msg); /* Set message data to be send */
+ p_msg->TimerSeq = timer_seq; /* Timer sequence number */
+
+ /* Set callback function information in timer control table */
+ TimerSetPnoOfCtrlTbl(idx, snd_pno); // LCOV_EXCL_BR_LINE 200: no branch
+ TimerSetSizeOfCtrlTbl(idx, sizeof(TimerToutMsg)); // LCOV_EXCL_BR_LINE 200: no branch
+ TimerSetTypeOfCtrlTbl(idx, time_type); // LCOV_EXCL_BR_LINE 200: no branch
+ TimerSetSeqNoOfCtrlTbl(idx, timer_seq); // LCOV_EXCL_BR_LINE 200: no branch
+ TimerSetTimeOutOfCtrlTbl(idx, time_out); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Set timer value */
+ timer_info.t_sec = (uint32_t)((10 * time_out) / 1000);
+ /* Coverity CID: 21979 compliant */
+ timer_info.t_nsec = ((10 * (uint64_t)time_out) - ((uint64_t)(timer_info.t_sec) * 1000)) * 1000 * 1000;
+ timer_info.iCmd = TimerGetCidOfCtrlTbl(idx);
+ timer_info.rpt_sec = 0;
+ timer_info.rpt_nsec = 0;
+ if (time_type == TIMER_TYPE_SYN) {
+ timer_info.rpt_sec = timer_info.t_sec;
+ timer_info.rpt_nsec = timer_info.t_nsec;
+ }
+
+ h_timer = TimerGetTimerHandleOfCtrlTbl(idx);
+
+ /* Start timer */
+ estatus = NS_TimerSetTime(h_timer, timer_info); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if ((h_timer == NULL) || (estatus != eFrameworkunifiedStatusOK)) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When an error occurs */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NS_TimerSetTime ERROR " \
+ "[estatus:%d, h_timer:%p]", estatus, h_timer);
+
+ TimerClearSettingOfCtrlTbl(idx); /* Clear timer information */
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ /* If successful */
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### TIMER TABLE INFORMATION # " \
+ "(++) idx:%d cid:%d h_timer:%p pno:%d seq_no:%d type:%d time_out:%d", \
+ idx, g_timer_ctrl_tbl[idx].cid, g_timer_ctrl_tbl[idx].h_timer, g_timer_ctrl_tbl[idx].pno, \
+ g_timer_ctrl_tbl[idx].seq_no, g_timer_ctrl_tbl[idx].type, g_timer_ctrl_tbl[idx].time_out);
+ }
+
+ TimerUnlockMutex(); /* Release Mutex */ // LCOV_EXCL_BR_LINE 200: no branch
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Timer stop instruction
+ *
+ * @param[in] snd_pno Requesting process number
+ * @param[in] timer_seq Timer sequence number
+ * @param[in] time_r_type Timer type<br>
+ * TIMER_TYPE_SYN Fixed-period timer<br>
+ * TIMER_TYPE_USN Asynchronous timer<br>
+ * TIMER_TYPE_ALM Alerm with specified time <br>
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR Message transmission error<br>
+ * RET_ERRPARAM Parameter error
+ */
+RET_API _pb_TimerStop(PNO snd_pno, u_int16 timer_seq, // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ u_int8 time_type) {
+ RET_API ret_api = RET_NORMAL; /* Return value of this module */
+ u_int32 idx;
+ EFrameworkunifiedStatus estatus;
+ HANDLE h_timer;
+ const NSTimerInfo timer_info = {0};
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ /* If a control Mutex has not been created, it is determined that the Timer function has not been initialized (non Positioning processes) and the process terminates with an error. */
+ if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 6: g_h_mtx cannot be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_h_mtx is NULL!!");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 6: g_h_mtx cannot be NULL
+ } else {
+ TimerLockMutex(); /* Get Mutex */ // LCOV_EXCL_BR_LINE 200: no branch
+
+ idx = TimerSearchTimerOfCtrlTbl(snd_pno, timer_seq, time_type);
+ if (idx == MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 200: idx can not be MAX_CTRL_TIMER_NUM
+ /* When the specified timer is not set */
+ /* nop */
+ } else {
+ h_timer = TimerGetTimerHandleOfCtrlTbl(idx);
+
+ /* Stop timer */
+ estatus = NS_TimerSetTime(h_timer, timer_info); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When deletion fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NS_TimerSetTime ERROR " \
+ "[estatus:%d, h_timer:%p]", estatus, h_timer);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ /* If successful */
+ /* Clear timer information */
+ TimerClearSettingOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: no branch
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### TIMER TABLE INFORMATION # " \
+ "(--) idx:%d cid:%d h_timer:%p pno:%d seq_no:%d type:%d time_out:%d", \
+ idx, g_timer_ctrl_tbl[idx].cid, g_timer_ctrl_tbl[idx].h_timer, g_timer_ctrl_tbl[idx].pno, \
+ g_timer_ctrl_tbl[idx].seq_no, g_timer_ctrl_tbl[idx].type, g_timer_ctrl_tbl[idx].time_out);
+ }
+ }
+
+ TimerUnlockMutex(); /* Release Mutex */ // LCOV_EXCL_BR_LINE 200: no branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return ret_api;
+}
+
+/*---------------------------------------------------------------------------------*
+ * Local Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Timer CID setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] cid Command ID
+ */
+static void TimerSetCidOfCtrlTbl(u_int32 idx, CID cid) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].cid = cid;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timer CID acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ *
+ * @return Command ID
+ */
+static CID TimerGetCidOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].cid;
+}
+
+/**
+ * @brief
+ * PNO setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ * @param[in] pno Process number
+ */
+static void TimerSetPnoOfCtrlTbl(u_int32 idx, PNO pno) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \
+ "[idx:%d, pno:%d]", idx, pno);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].pno = pno;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * PNO acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ *
+ * @return Process number
+ */
+static PNO TimerGetPnoOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].pno;
+}
+
+/**
+ * @brief
+ * Message size setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ * @param[in] size Message size
+ */
+static void TimerSetSizeOfCtrlTbl(u_int32 idx, u_int16 size) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \
+ "[idx:%d, size:%d]", idx, size);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].size = size;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Message buffer acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ *
+ * @return Pointer to message storage area
+ */
+static TimerToutMsg* TimerGetMsgBufOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return &(g_timer_ctrl_tbl[idx].msg_buf);
+}
+
+/**
+ * @brief
+ * Timer handle setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ * @param[in] handle Timer handle
+ */
+static void TimerSetTimerHandleOfCtrlTbl(u_int32 idx, HANDLE handle) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].h_timer = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timer handle acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ *
+ * @return Timer handle
+ */
+static HANDLE TimerGetTimerHandleOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].h_timer;
+}
+
+/**
+ * @brief
+ * Timer type setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ * @param[in] type Timer type
+ */
+static void TimerSetTypeOfCtrlTbl(u_int32 idx, u_int8 type) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \
+ "[idx:%d, type:%d]", idx, type);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].type = type;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timer type acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ *
+ * @return Timer handle
+ */
+static u_int8 TimerGetTypeOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].type;
+}
+
+/**
+ * @brief
+ * Timer sequence number setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ * @param[in] seq_no Timer Sequence Number
+ */
+static void TimerSetSeqNoOfCtrlTbl(u_int32 idx, u_int16 seq_no) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \
+ "[idx:%d, seq_no:%d]", idx, seq_no);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].seq_no = seq_no;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timer sequence number acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ */
+static u_int16 TimerGetSeqNoOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].seq_no;
+}
+
+/**
+ * @brief
+ * Timeout setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table access Index
+ * @param[in] time_out Timeout
+ */
+static void TimerSetTimeOutOfCtrlTbl(u_int32 idx, u_int32 time_out) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, " \
+ "time_out:%d]", idx, time_out);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].time_out = time_out;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timeout acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table access Index
+ *
+ * @return Timeout value
+ */
+static u_int32 TimerGetTimeOutOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6:idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].time_out;
+}
+
+/**
+ * @brief
+ * Retreaval of unused area in the timer control table (Timer control table)
+ *
+ * Return the lowest-numbered index for accessing unused space in the Timer control table.
+ * If the mutex is not registered, the maximum timer management value (MAX_CTRL_MUTEX_NUM)
+ * is returned.
+ *
+ * @return Table accessor
+ */
+static u_int32 TimerSearchEmptyOfCtrlTbl(void) {
+ u_int32 idx;
+ u_int32 time_out;
+
+ for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) {
+ time_out = TimerGetTimeOutOfCtrlTbl(idx);
+
+ /* For unused space */
+ if (time_out == 0) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Retrieval of specified timer for in the timer control table (Timer control table)
+ *
+ * Retrieve whether the specified timer is already registered in the timer control table.
+ * If it is registered, the access index is returned. If it is not registered,
+ * Return the maximum value of timer management (MAX_CTRL_TIMER_NUM).
+ *
+ * @param[in] snd_pno Process number
+ * @param[in] TimerSeq Timer sequence number
+ * @param[in] TimeType Timer type
+ *
+ * @return Index for access(If it is registered)<br>
+ * Maximum mutex management value (Not registered)
+ */
+static u_int32 TimerSearchTimerOfCtrlTbl(PNO snd_pno, u_int16 TimerSeq, u_int8 TimeType) {
+ u_int32 idx;
+ PNO pno;
+ u_int16 seq_no;
+ u_int8 type;
+
+ for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) {
+ pno = TimerGetPnoOfCtrlTbl(idx);
+ seq_no = TimerGetSeqNoOfCtrlTbl(idx);
+ type = TimerGetTypeOfCtrlTbl(idx);
+
+ /* If there is a match */
+ if ((pno == snd_pno) && (seq_no == TimerSeq) && (type == TimeType)) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Clear timer setting information
+ *
+ * @param[in] idx Timer control table accessor
+ */
+static void TimerClearSettingOfCtrlTbl(u_int32 idx) {
+ void *p_msg;
+
+ /* Delete timer information */
+ TimerSetPnoOfCtrlTbl(idx, 0);
+ TimerSetSizeOfCtrlTbl(idx, 0);
+ TimerSetTypeOfCtrlTbl(idx, 0);
+ TimerSetSeqNoOfCtrlTbl(idx, 0);
+ TimerSetTimeOutOfCtrlTbl(idx, 0);
+ p_msg = TimerGetMsgBufOfCtrlTbl(idx);
+ memset(p_msg, 0x00, sizeof(TimerToutMsg));
+
+ return;
+}
+
+/**
+ * @brief
+ * Create Mutex for accessing the timer control table
+ */
+static void TimerCreateMutex(void) {
+ g_h_mtx = _pb_CreateMutex(NULL, 0, "Timer_Mutex");
+ if (g_h_mtx == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR " \
+ "[g_h_mtx:%p]", g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Delete Mutex for accessing timer control table
+ */
+static void TimerDeleteMutex(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DWORD ret;
+
+ ret = PbDeleteMutex(g_h_mtx);
+ if (ret != WAIT_OBJECT_0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbDeleteMutex ERROR " \
+ "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get Mutex for accessing timer control table
+ */
+static void TimerLockMutex(void) {
+ DWORD ret;
+
+ ret = PbMutexLock(g_h_mtx, INFINITE); // LCOV_EXCL_BR_LINE 200: lock will not failed
+ if (ret != WAIT_OBJECT_0) { // LCOV_EXCL_BR_LINE 200: lock will not failed
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexLock ERROR " \
+ "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: lock will not failed
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Release Mutex for accessing timer control table
+ */
+static void TimerUnlockMutex(void) {
+ BOOL ret;
+
+ ret = PbMutexUnlock(g_h_mtx); // LCOV_EXCL_BR_LINE 200: unlock will not failed
+ if (ret != TRUE) { // LCOV_EXCL_BR_LINE 200: unlock will not failed
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexUnlock ERROR " \
+ "[ret:%d, g_h_mtx:%p]", ret, g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: unlock will not failed
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timer Expiration Callback Functions
+ *
+ * For setting the timer creation function (NS_TimerCreate)<br>
+ * TimerCallback1 ... TimerCallback8
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus TimerCallback1(HANDLE h_app) {
+ static const u_int8 ID = 0;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback2(HANDLE h_app) {
+ static const u_int8 ID = 1;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback3(HANDLE h_app) {
+ static const u_int8 ID = 2;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback4(HANDLE h_app) {
+ static const u_int8 ID = 3;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback5(HANDLE h_app) {
+ static const u_int8 ID = 4;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback6(HANDLE h_app) {
+ static const u_int8 ID = 5;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback7(HANDLE h_app) {
+ static const u_int8 ID = 6;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback8(HANDLE h_app) {
+ static const u_int8 ID = 7;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static void TimerCallbackComProc(const uint8_t id) {
+ uint8_t type;
+
+ TimerLockMutex(); /* Get Mutex */
+
+ /* Message is sent to the thread specified when the timer is created. */
+ (void)_pb_SndMsg(g_timer_ctrl_tbl[id].pno, g_timer_ctrl_tbl[id].size, &(g_timer_ctrl_tbl[id].msg_buf), 0);
+
+ type = TimerGetTypeOfCtrlTbl(id);
+ if (type == TIMER_TYPE_USN) {
+ /* One-shot timer */
+ /* Clear timer information */
+ TimerClearSettingOfCtrlTbl(id);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### TIMER TABLE INFORMATION # " \
+ "(--) idx:%d cid:%d h_timer:%p pno:%d seq_no:%d type:%d time_out:%d", \
+ id, g_timer_ctrl_tbl[id].cid, g_timer_ctrl_tbl[id].h_timer, g_timer_ctrl_tbl[id].pno, \
+ g_timer_ctrl_tbl[id].seq_no, g_timer_ctrl_tbl[id].type, g_timer_ctrl_tbl[id].time_out);
+ }
+
+ TimerUnlockMutex(); /* Release Mutex */
+
+ return;
+}
+
+/**
+ * @brief
+ * Get dump information
+ *
+ * @param[out] p_buf Dump info
+ */
+void _pb_GetDebugTimerMngTbl(void* p_buf) {
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_tmp[256];
+ uint32_t i;
+
+ if (p_buf != NULL) {
+ memset(&buf, 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&(buf)), sizeof(buf), "Timer");
+ for (i = 0; i < MAX_CTRL_TIMER_NUM; i++) {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%d] cid:%05d, hTim:%10p, sz:%05d, pno:0x%04x, seq:0x%04x, typ:%03d, tOut:%10d",
+ i,
+ g_timer_ctrl_tbl[i].cid,
+ g_timer_ctrl_tbl[i].h_timer,
+ g_timer_ctrl_tbl[i].size,
+ g_timer_ctrl_tbl[i].pno,
+ g_timer_ctrl_tbl[i].seq_no,
+ g_timer_ctrl_tbl[i].type,
+ g_timer_ctrl_tbl[i].time_out);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ }
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ }
+} // LCOV_EXCL_BR_LINE 10:The final line
diff --git a/vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp b/vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp
new file mode 100755
index 0000000..2111b3a
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp
@@ -0,0 +1,358 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file waitforsingleobject.cpp
+@detail Functions that implement waitforsingleobject in PosixBasedOS001<BR>
+ Functions to register/delete a table to determine the handle and its type
+*****************************************************************************/
+
+#include "_pbWaitforsingleobject.h"
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+
+typedef struct HandleTypeTable {
+ HANDLE h_handle; /* Registration handle */
+ HANDLE_KIND l_kind; /* Type of Mutex/Semaphre/Event... */
+ struct HandleTypeTable *next;
+} HANDLE_TYPE;
+
+static HANDLE_TYPE *g_pst_handle_kind_table = NULL;
+static pthread_mutex_t g_func_lock_mutex = PTHREAD_MUTEX_INITIALIZER; /* Consider replacing it later */
+
+/* Prototype declarations */
+static BOOL FindList(HANDLE_TYPE **p_list, HANDLE h_obj);
+static BOOL AddList(HANDLE_TYPE *p_add_list);
+static BOOL DelList(HANDLE_TYPE *h_del_obj);
+static BOOL FunctionLock(void);
+static BOOL FunctionUnlock(void);
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* Public APIs
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* _sys Internally Used APIs
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+@brief WaitObjectInit<BR>
+ Initialization processing for each process
+@outline WaitObjectInit<BR>
+ Initialization processing for each process
+@type Completion return type
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL WaitObjectInit(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ g_pst_handle_kind_table = NULL;
+ return TRUE;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief WaitObjectTerm<BR>
+ Termination processing for each process
+@outline WaitObjectTerm<BR>
+ Termination processing for each process
+@type Completion return type
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL WaitObjectTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (NULL != g_pst_handle_kind_table) {
+ /* Should be Deleted a List? */
+ }
+ return TRUE;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief WaitObjectAdd<BR>
+ Register a handle and a handle-type in a list
+@outline WaitObjectAdd<BR>
+ Register a handle and a handle-type in a list
+@type Completion return type
+@param[in] HANDLE h_obj : Handle to register
+@param[in] HANDLE_KIND l_kind : Handle type
+
+@return BOOL
+@retval TRUE : Normal
+ FALSE : Error
+*****************************************************************************/
+BOOL WaitObjectAdd(HANDLE h_obj, HANDLE_KIND l_kind) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ HANDLE_TYPE *p_add_list = NULL;
+
+ if ((NULL != h_obj)
+ && (PB_HANDLE_INVAL < l_kind)
+ && (PB_HANDLE_KIND_MAX > l_kind)) {
+ FunctionLock();
+ bret = FindList(&p_add_list, h_obj);
+ if (TRUE == bret) {
+ /* Handle already registered */
+ if (l_kind == p_add_list->l_kind) {
+ /* re-register the same item */
+ bret = TRUE;
+ } else {
+ /* An attempt was made to re-register the same handle with different type */
+ bret = FALSE; /** Consider whether to win or not later */
+ }
+ } else {
+ p_add_list = reinterpret_cast<HANDLE_TYPE*>(malloc(sizeof(HANDLE_TYPE)));
+ if (NULL == p_add_list) {
+ /* Memory acquisition failed */
+ bret = FALSE;
+ } else {
+ memset(p_add_list, 0, sizeof(HANDLE_TYPE));
+ p_add_list->h_handle = h_obj;
+ p_add_list->l_kind = l_kind;
+ p_add_list->next = NULL;
+ bret = AddList(p_add_list);
+ if (FALSE == bret) {
+ /* Registration failure */
+ free(p_add_list);
+ bret = FALSE;
+ } else {
+ bret = TRUE;
+ }
+ }
+ }
+
+ FunctionUnlock();
+
+ } else {
+ bret = FALSE; /** Parameter error */
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief WaitObjectDel<BR>
+ Remove handle and handle-type from the list
+@outline WaitObjectDel<BR>
+ Remove handle and handle-type from the list
+@type Completion return type
+@param[in] HANDLE h_obj : Handle to delete
+
+@return BOOL
+@retval TRUE : Normal
+ FALSE : Error
+*****************************************************************************/
+BOOL WaitObjectDel(HANDLE h_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ HANDLE_TYPE *p_del_list = NULL;
+
+ if (NULL != h_obj) {
+ FunctionLock();
+ bret = FindList(&p_del_list, h_obj);
+ if (TRUE == bret) {
+ /* handle already registered */
+ if (TRUE == DelList(p_del_list)) {
+ free(p_del_list);
+ bret = TRUE;
+ } else {
+ bret = FALSE;
+ }
+ } else {
+ bret = FALSE; /* no handles */
+ }
+
+ FunctionUnlock();
+
+ } else {
+ bret = FALSE; /* Parameter error */
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* Private API
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+@brief FindList<BR>
+ Searching for a Handle in the List
+@outline FindList<BR>
+ Searching for a Handle in the List
+@type Completion return type
+@param[out] HANDLE_TYPE** p_list : Found list pointer
+@param[in] HANDLE h_obj : Handle to look for
+
+@return BOOL
+@retval TRUE : Normal (p_list != NULL)
+ FALSE : Error (p_list == NULL)
+*****************************************************************************/
+static BOOL FindList(HANDLE_TYPE **p_list, HANDLE h_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ HANDLE_TYPE *p_now = NULL;
+ BOOL bret = FALSE;
+
+ if ((NULL != h_obj) && (NULL != p_list)) {
+ /* Search list */
+ p_now = g_pst_handle_kind_table;
+ while (NULL != p_now) {
+ /* h_obj and p_now->h_handle are pointer type.*/
+ if ((int64_t)h_obj == (int64_t)p_now->h_handle) {
+ *p_list = p_now;
+ bret = TRUE;
+ break;
+ }
+ p_now = p_now->next;
+ }
+ } else {
+ bret = FALSE; /** Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief AddList<BR>
+ Append data to the end of the list
+@outline AddList<BR>
+ Append data to the end of the list
+@type Completion return type
+@param[in] HANDLE_TYPE* p_list : Data to add
+
+@return BOOL
+@retval TRUE : Normal
+ FALSE : Error
+*****************************************************************************/
+static BOOL AddList(HANDLE_TYPE *p_add_list) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ HANDLE_TYPE *p_now = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != p_add_list) {
+ /* Add unregistered data */
+ if (NULL == g_pst_handle_kind_table) {
+ g_pst_handle_kind_table = p_add_list;
+ bret = TRUE;
+ } else {
+ /* Add to end of list */
+ p_now = g_pst_handle_kind_table;
+ while (NULL != p_now) {
+ if (NULL == p_now->next) {
+ p_now->next = p_add_list;
+ bret = TRUE;
+ break;
+ }
+ p_now = p_now->next;
+ }
+ }
+ } else {
+ bret = FALSE; /** Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief DelList<BR>
+ Remove specified data from a List
+@outline DelList<BR>
+ Remove specified data from a List
+@type Completion return type
+@param[in,out] HANDLE_TYPE* h_del_obj :
+
+@return BOOL
+@retval TRUE : Normal
+ FALSE : End
+*****************************************************************************/
+static BOOL DelList(HANDLE_TYPE *h_del_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ HANDLE_TYPE *p_now = NULL;
+ HANDLE_TYPE *pBef = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != h_del_obj) {
+ /* Add to end of list */
+ p_now = g_pst_handle_kind_table;
+ while (NULL != p_now) {
+ if (h_del_obj == p_now) {
+ if (NULL == pBef) {
+ /* Delete first */
+ g_pst_handle_kind_table = p_now->next;
+ } else {
+ /* Others */
+ pBef->next = h_del_obj->next;
+ }
+ bret = TRUE;
+ break;
+ }
+ pBef = p_now;
+ p_now = p_now->next;
+ }
+ } else {
+ bret = FALSE; /** Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief FunctionLock<BR>
+ Start locking of g_pst_handle_kind_table
+@outline FunctionLock<BR>
+ Start locking of g_pst_handle_kind_table
+@type Completion return type
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL FunctionLock(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ if (EOK == pthread_mutex_lock(&g_func_lock_mutex)) {
+ bret = TRUE;
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief FunctionUnlock<BR>
+ Terminate locking of g_pst_handle_kind_table
+@outline FunctionUnlock<BR>
+ Terminate locking of g_pst_handle_kind_table
+@type Completion return type
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL FunctionUnlock(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ if (EOK == pthread_mutex_unlock(&g_func_lock_mutex)) {
+ bret = TRUE;
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
diff --git a/vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp b/vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp
new file mode 100755
index 0000000..204c516
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+
+
+#include "WPF_STD_private.h"
+void* Memcpy64pSync(void* dest, const void* src, size_t count) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return _pb_memcpy(dest, src, count);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp b/vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp
new file mode 100755
index 0000000..ad6c11e
--- /dev/null
+++ b/vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+
+void* Memset64pSync(void* dest, int c, size_t count) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return _pb_memset(dest, c, count);
+}
+// LCOV_EXCL_STOP
diff --git a/vehicleservice/vehicle_service.mk b/vehicleservice/vehicle_service.mk
new file mode 100755
index 0000000..40d337f
--- /dev/null
+++ b/vehicleservice/vehicle_service.mk
@@ -0,0 +1,42 @@
+#############################################################
+#
+# Common Makefile for vehicle_service
+# Copyright (C) 2017-2019 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := vehicle_service
+
+#############################################################
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/video_in_hal/LICENSE b/video_in_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/Makefile b/video_in_hal/Makefile
new file mode 100755
index 0000000..25ebaab
--- /dev/null
+++ b/video_in_hal/Makefile
@@ -0,0 +1,61 @@
+#
+# @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET = libvideo_in_hal.so
+
+HEADER = hal_api/video_in_hal.h
+
+######### include paths/files ###################
+CFLAGS += -I./hal_api/
+CFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--warn-unresolved-symbols
+
+######### linked library ########################
+
+######### source files ##########################
+VPATH := ./src/
+
+OBJS := video_in_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/video_in_hal/README.md b/video_in_hal/README.md
new file mode 100755
index 0000000..bb50e72
--- /dev/null
+++ b/video_in_hal/README.md
@@ -0,0 +1,3 @@
+video_in_hal library
+==================
+video_in HAL implementation library for AGL Reference Board.
diff --git a/video_in_hal/agl-basefiles/BS/ns/npp/rwdata/version.txt b/video_in_hal/agl-basefiles/BS/ns/npp/rwdata/version.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/video_in_hal/agl-basefiles/BS/ns/npp/rwdata/version.txt
@@ -0,0 +1 @@
+1
diff --git a/video_in_hal/agl-basefiles/LICENSE b/video_in_hal/agl-basefiles/LICENSE
new file mode 100644
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/agl-basefiles/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/agl-basefiles/agldd/ev_common.h b/video_in_hal/agl-basefiles/agldd/ev_common.h
new file mode 100644
index 0000000..1a68fea
--- /dev/null
+++ b/video_in_hal/agl-basefiles/agldd/ev_common.h
@@ -0,0 +1,135 @@
+/**
+ * @file ev_common.h
+ * @brief Event library -- User kernel common data structure
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ev_common_h_
+#define _ev_common_h_
+
+#include <agldd/ev_id.h>
+
+/** @addtogroup EV
+ * @{ */
+/** @brief Maximum number of bytes for message event */
+#define EV_MAX_MESSAGE_LENGTH 2048
+
+/** @brief -Maximum number of flag queue that can be created within a thread */
+#define EV_MAX_IDS_IN_THREAD 24
+
+/** @brief -Muximum number of threads that can be registered to the EV in a process */
+#define EV_MAX_THREADS_IN_PROCESS 16
+
+/** @brief -Maximum number of flag queue that can be creat within a process
+ */
+#define EV_MAX_IDS_IN_PROCESS \
+ (EV_MAX_IDS_IN_THREAD * EV_MAX_THREADS_IN_PROCESS)
+
+/** @brief Return values for even library function
+ *
+ * @see EV_ERR
+ */
+enum ev_err
+{
+ EV_OK = 0, /**< Normal completion */
+ EV_ERR_Exist, /**< The specified flag message queue does exist */
+ EV_ERR_Invalid_ID, /**< The specified flag message queue does not exist */
+ EV_ERR_Busy, /**< Message queue full failed to send */
+ EV_ERR_Interrupted, /**< Waiting function was interrupted by an interrupt */
+ EV_ERR_Thread_Over, /**< Exceeding the number of threads in the process */
+ EV_ERR_Invalid_Thread, /**< Invalid thread ID */
+ EV_ERR_Fatal, /**< Fatal error */
+};
+/** @brief Return values type for even library function
+ *
+ * @see ev_err
+ */
+typedef INT32 EV_ERR;
+
+/** @brief Event type
+ *
+ * Use in the type of EV_Event structs
+ * @see ev_type
+ */
+typedef UINT32 EV_Type;
+
+/** @brief Bit value representing the type of event */
+enum ev_type {
+ EV_EVENT_None = 0x00000000,
+
+ /** Flag event: Judged by EV_EVENT_IS_FLAG() */
+ EV_EVENT_Flag = 0x0001,
+#define EV_EVENT_IS_FLAG(tp) (((tp) & EV_EVENT_Flag) != 0)
+
+ /** Message event: Judged by EV_EVENT_IS_MESSAGE() */
+ EV_EVENT_Message = 0x0002,
+#define EV_EVENT_IS_MESSAGE(tp) (((tp) & EV_EVENT_Message) != 0)
+
+ /** 64bit flag event: Judged by EV_EVENT_IS_FLAG64() */
+ EV_EVENT_Flag64 = 0x0003,
+#define EV_EVENT_IS_FLAG64(tp) (((tp) & EV_EVENT_Flag64) != 0)
+
+};
+
+/** @brief Flag event structure */
+typedef struct {
+ EV_ID flagID;/**< Flag ID */
+ UINT32 bits;/**< Bit pattern */
+} EV_Flag;
+
+/** @brief 64bit flag event structure */
+typedef struct {
+ EV_ID flagID;/**< Flag ID */
+ UINT64 bits;/**< Bit pattern */
+} EV_Flag64;
+
+/** @brief Message event structure */
+typedef struct {
+ EV_ID queueID;/**< queue ID */
+ UINT32 senderInfo;/**< Source information */
+ UINT32 length;/**< Number of bytes in the message */
+ UINT32 dummy;/** dummy for pading */
+ UINT8 message[EV_MAX_MESSAGE_LENGTH];/**< Message */
+} EV_Message;
+
+/** @brief Event structure */
+typedef struct {
+ EV_Type type; /**< Event type */
+ union {
+ EV_Flag flag; /**< Flag event structure */
+ EV_Flag64 flag64; /**< Flag event structure */
+ EV_Message message; /**< Message event structure */
+ } u; /**< Union of structures per event type */
+} EV_Event;
+
+/** @brief Message event queue type
+ *
+ * Specify the action to be taken when the queue overflows (more events are received when the queue is full).
+ */
+enum ev_message_queue_type {
+ EV_MESSAGE_QUEUE_TYPE_BUSY,/**< Return a BUSY to the source */
+ EV_MESSAGE_QUEUE_TYPE_FIFO,/**< Delete the oldest event */
+ EV_MESSAGE_QUEUE_TYPE_REPLACE,/**< Replace the most recent event */
+};
+
+/** @brief Messge event queue type
+ *
+ * @see ev_message_queue_type
+ */
+typedef UINT8 EV_Message_Queue_Type;
+
+/** @} */
+
+#endif /* !_ev_common_h_ */
diff --git a/video_in_hal/agl-basefiles/agldd/ev_id.h b/video_in_hal/agl-basefiles/agldd/ev_id.h
new file mode 100644
index 0000000..2026ef7
--- /dev/null
+++ b/video_in_hal/agl-basefiles/agldd/ev_id.h
@@ -0,0 +1,104 @@
+/**
+ * @file ev_id.h
+ * @brief Event library(kernel) -- Defining flag queue ID
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ev_id_h_
+#define _ev_id_h_
+
+/** @addtogroup EV_ID_spec
+ * @{ */
+
+/** @brief Flag ID and queue ID types used when sending and receiving events
+ *
+ * Assign a 32-bit value as follows
+ *
+ * - Most significant 8 bits: Reserved
+ * - Next 16 bits: Modue ID
+ * - Lower 8 bits: Define in module
+ *
+ * Where module is the modules that creates the queue.
+ * The modules define ID according to the above assignments using EV_Flag_ID_Base and EV_Queue_ID_Base macros.
+ * @see EV_Flag_ID_Base
+ * @see EV_Queue_ID_Base
+ */
+typedef UINT32 EV_ID;
+
+#define EV_ID_BIT 0x80000000UL
+#define EV_FLAG64_BIT 0x40000000UL
+#define EV_FLAG_BIT 0x20000000UL
+#define EV_QUEUE_BIT 0x10000000UL
+#define EV_AUTO_ID_BIT 0x08000000UL
+#define EV_RESERVED_BIT 0xff000000UL
+#define EV_INVALID_ID EV_ID_BIT
+#define EV_NO_ID EV_INVALID_ID
+
+#define EV_ID_IS_FLAG(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_FLAG_BIT)) == (EV_ID_BIT|EV_FLAG_BIT))
+#define EV_ID_IS_FLAG64(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_FLAG64_BIT)) == (EV_ID_BIT|EV_FLAG64_BIT))
+#define EV_ID_IS_QUEUE(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_QUEUE_BIT)) == (EV_ID_BIT|EV_QUEUE_BIT))
+#define EV_ID_IS_AUTO_ID(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_AUTO_ID_BIT)) == (EV_ID_BIT|EV_AUTO_ID_BIT))
+#define EV_ID_IS_VALID(queueID) \
+ (EV_ID_IS_FLAG(queueID) || EV_ID_IS_FLAG64(queueID) || EV_ID_IS_QUEUE(queueID))
+
+/** @brief Macros for defining flag ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Flag_ID_Base EV_Flag_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Flag_foo (XXX_Flag_ID_Base + 1)
+ * - #define XXX_Flag_bar (XXX_Flag_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Flag_ID_Base(mod) (EV_ID_BIT|EV_FLAG_BIT|((mod)<<8))
+
+/** @brief Macros for defining 64 bits flag ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Flag64_ID_Base EV_Flag64_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Flag64_foo (XXX_Flag64_ID_Base + 1)
+ * - #define XXX_Flag64_bar (XXX_Flag64_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Flag64_ID_Base(mod) (EV_ID_BIT|EV_FLAG64_BIT|((mod)<<8))
+
+/** @brief Macros for defining mesage queue ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Queue_ID_Base EV_Queue_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Queue_foo (XXX_Queue_ID_Base + 1)
+ * - #define XXX_Queue_bar (XXX_Queue_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Queue_ID_Base(mod) (EV_ID_BIT|EV_QUEUE_BIT|((mod)<<8))
+
+/** @} */
+
+#endif /* ! _ev_id_h_ */
diff --git a/video_in_hal/agl-basefiles/agldd/evk_lib.h b/video_in_hal/agl-basefiles/agldd/evk_lib.h
new file mode 100644
index 0000000..378df13
--- /dev/null
+++ b/video_in_hal/agl-basefiles/agldd/evk_lib.h
@@ -0,0 +1,116 @@
+/**
+ * @file evk_lib.h
+ * @brief Event library -- API specifications for kernel modules
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _evk_lib_h_
+#define _evk_lib_h_
+
+#include <agldd/ev_common.h>
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+/* API definition */
+
+/** @addtogroup EV
+ * @{ */
+#ifdef __KERNEL__
+/* Flag message queue create/delete */
+EV_ERR EVK_create_flag(EV_ID flagID);
+EV_ERR EVK_create_flag64(EV_ID flagID);
+EV_ERR EVK_create_queue(EV_ID queueID,
+ UINT8 length,
+ UINT16 max_bytes,
+ EV_Message_Queue_Type type);
+
+EV_ERR EVK_create_flag_auto_id(/* OUT */EV_ID *flagID);
+EV_ERR EVK_create_flag64_auto_id(/* OUT */EV_ID *flagID);
+EV_ERR EVK_create_queue_auto_id(/* OUT */EV_ID *queueID,
+ UINT8 length,
+ UINT16 max_bytes,
+ EV_Message_Queue_Type type);
+
+EV_ERR EVK_destroy_flag(EV_ID flagID);
+EV_ERR EVK_destroy_queue(EV_ID queueID);
+
+/* Send events */
+EV_ERR EVK_set_flag(EV_ID flagID, UINT32 bits);
+EV_ERR EVK_set_flag64(EV_ID flagID, UINT64 bits);
+EV_ERR EVK_send_message(EV_ID queueID, UINT16 bytes, const void *message,
+ UINT32 senderInfo);
+
+/* Get event(with search conditions) */
+EV_ERR EVK_get_flag(EV_ID flagID, /* OUT */EV_Flag *flag);
+EV_ERR EVK_wait_flag(EV_ID flagID, /* OUT */EV_Flag *flag);/* block */
+EV_ERR EVK_peek_flag(EV_ID flagID, /* OUT */EV_Flag *flag);
+EV_ERR EVK_get_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);
+EV_ERR EVK_wait_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);/* block */
+EV_ERR EVK_peek_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);
+
+EV_ERR EVK_get_message(EV_ID queueID, /* OUT */EV_Message *message);
+EV_ERR EVK_wait_message(EV_ID queueID, /* OUT */EV_Message *message);/* block */
+EV_ERR EVK_peek_message(EV_ID queueID, /* OUT */EV_Message *message);
+
+EV_ERR EVK_find_message_by_sender(EV_ID queueID, UINT32 senderInfo,
+ /* OUT */EV_Message *message);
+EV_ERR EVK_find_message_by_content(EV_ID queueID, UINT16 length,
+ const void *compare_bytes,
+ /* OUT */EV_Message *message);
+#endif
+
+/** @} */
+
+/** @addtogroup EVK_in
+ * @{ */
+#define EVK_NAME "evk"
+#define EVK_DEV_NAME "/dev/agl/"EVK_NAME
+#define EVK_DEV_MAJOR 1033
+#define EVK_IOC_MAGIC 0xE7
+
+#define EVK_IOC_CREATE_FLAG _IO(EVK_IOC_MAGIC, 0x00)
+#define EVK_IOC_CREATE_FLAG64 _IO(EVK_IOC_MAGIC, 0x01)
+#define EVK_IOC_CREATE_MESSAGE_QUEUE _IO(EVK_IOC_MAGIC, 0x02)
+#define EVK_IOC_ALLOC_FLAG_ID _IO(EVK_IOC_MAGIC, 0x03)
+#define EVK_IOC_ALLOC_FLAG64_ID _IO(EVK_IOC_MAGIC, 0x04)
+#define EVK_IOC_ALLOC_QUEUE_ID _IO(EVK_IOC_MAGIC, 0x05)
+#define EVK_IOC_DESTROY_QUEUE _IO(EVK_IOC_MAGIC, 0x06)
+#define EVK_IOC_STORE_FLAG _IO(EVK_IOC_MAGIC, 0x07)
+#define EVK_IOC_STORE_FLAG64 _IO(EVK_IOC_MAGIC, 0x08)
+#define EVK_IOC_STORE_MESSAGE _IO(EVK_IOC_MAGIC, 0x09)
+#define EVK_IOC_SET_POLL _IO(EVK_IOC_MAGIC, 0x0a)
+#define EVK_IOC_GET_EVENT _IO(EVK_IOC_MAGIC, 0x0b)
+#define EVK_IOC_PEEK_EVENT _IO(EVK_IOC_MAGIC, 0x0c)
+#define EVK_IOC_WAIT_EVENT _IO(EVK_IOC_MAGIC, 0x0d)
+#define EVK_IOC_GET_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0e)
+#define EVK_IOC_PEEK_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0f)
+#define EVK_IOC_DEBUG_LIST _IO(EVK_IOC_MAGIC, 0x10)
+
+typedef struct {
+ EV_ID queueID;/**< Queue ID */
+ UINT32 max_bytes;/**< Maximum number of bytes for an event */
+ UINT8 length;/**< Queue length */
+ EV_Message_Queue_Type type;/**< Type */
+} EVK_Message_Queue_Request;
+
+typedef struct {
+ INT32 num; /**< Number of queue ID of search */
+ EV_ID ids[EV_MAX_IDS_IN_PROCESS]; /**< Queue ID of search */
+ EV_Event ev; /**< [OUT] First event that occured */
+} EVK_Next_Event_Query;
+
+/** @} */
+
+#endif /* !_evk_lib_h */
diff --git a/video_in_hal/agl-basefiles/agldd/moduleid.h b/video_in_hal/agl-basefiles/agldd/moduleid.h
new file mode 100644
index 0000000..b18c1a1
--- /dev/null
+++ b/video_in_hal/agl-basefiles/agldd/moduleid.h
@@ -0,0 +1,69 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <linux/autoconf.h>
+#ifndef _AGLDD_MODULEID_H_
+#define _AGLDD_MODULEID_H_
+
+/*
+ * Define module ID to be used by programs in moduleid_id.h .
+ * Define in the format of "#define XXX_MID ID number" (XXX is the module name).
+ *
+ * MID allocation policy shall be as follows.
+ * - UI Application : 0xxxh
+ * - Application Service : 1xxxh to 2xxxh
+ * + HMI : 10xxh
+ * + AV : 12xxh
+ * + Radio : 14xxh
+ * + Connectivity : 16xxh
+ * + Navigation/Location: 18xxh
+ * + Vehicle : 1Axxh
+ * + Communication : 1Cxxh
+ * + BasePF : 1Exxh
+ * + System : 20xxh
+ * + Other : 22xxh
+ * - Common Service : 3xxxh
+ * - Extension Service : 4xxxh
+ * - System/Device Driver : 5xxxh
+ */
+
+/* UI Application : 0xxxh */
+
+/* Application Service : 1xxxh to 2xxxh */
+#define MODEMANAGER_MID 0x1000
+#define ACTIVITYMANAGER_MID 0x1001
+
+/* Common Service : 3xxxh */
+#define IPMANAGER_MID 0x3000
+#define DEVICEMANAGER_MID 0x3001
+#define MSGBRK_MID 0x3002
+#define TIMERENTRYDRV_MID 0x3003
+#define SOUNDAGENT_MID 0x3004
+#define CAN_MID 0x3006
+#define _CWORD83__MID 0x3007
+#define SENSOR_MID 0x3008
+#define GPS_MID 0x3009
+#define RESMGR_MID 0x300A
+#define GRAPHICS_MID 0x300B
+
+/* Extension Service : 4xxxh */
+
+/* System/Device Driver : 5xxxh */
+#define EV_MID 0x5001
+#define RPC_MID 0x5002
+#define EVK_MID 0x5801
+
+#endif /* !_AGLDD_MODULEID_H_ */
diff --git a/video_in_hal/agl-basefiles/bin/launch_xml2cfg.sh b/video_in_hal/agl-basefiles/bin/launch_xml2cfg.sh
new file mode 100644
index 0000000..dfa1fa9
--- /dev/null
+++ b/video_in_hal/agl-basefiles/bin/launch_xml2cfg.sh
@@ -0,0 +1,138 @@
+#!/bin/bash
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#Since xpath is slow, use sed as much as possible.
+
+infile=$1
+main_file=system_launcher_main.xml
+body_file=system_launcher_body.xml
+
+
+#check xmllint is exist
+if ! which xmllint > /dev/null ; then
+ echo "It need xmllint. Please install it."
+ exit 1;
+fi
+
+#check xpath is exist
+if ! which xpath > /dev/null ; then
+ echo "It need xpath Please install it."
+ exit 1;
+fi
+
+#arg check
+if ! [[ "$infile" =~ .+\.xml ]] ;then
+ echo "$infile is not *.xml"
+ exit 1
+elif ! [ -e $infile ];then
+ echo "$infile not found"
+ exit 1
+fi
+
+cp -f `dirname $0`/$main_file `dirname $1`
+cp -f $infile $body_file
+
+#check xml vaild
+if ! xmllint --noout --valid $main_file ;then
+ echo "XML is Invalid. "
+ exit 1;
+fi
+
+#Format into xpath and read into memory
+xmem=`xpath -q -e /system_launcher $main_file`
+
+echo "# This file is created from $infile."
+echo "# created date : `LANG=en date`"
+echo "[ModulesLaunchConfig]"
+
+#GROUP LOOP
+group_num=`echo $xmem | xpath -e /system_launcher/group 2>&1 | grep Found | cut -d ' ' -f2`
+
+l_idx=1
+cur_group=1
+until [ $cur_group -gt $group_num ];
+do
+ #LAUNCH LOOP
+ group_text=`echo $xmem | xpath -q -e /system_launcher/group[$cur_group]` #ALL XML text for group
+ group_attr=`echo $group_text | sed 's/\(<group[^>]\+>\)\(.*\)/\1/g'`
+
+ g_name=`echo $group_attr | sed 's/\(.* name="\)\([^"]*\)\(.*\)/\2/g'`
+ g_wait_time=`echo $group_attr | sed 's/\(.* wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ g_trigger=`echo $group_attr | sed 's/\(.* trigger="\)\([^"]*\)\(.*\)/\2/g'`
+
+# echo $g_name $g_wait_time $g_trigger
+ l_launch_num=`echo $xmem | xpath -e /system_launcher/group[$cur_group]/launch 2>&1 | grep Found | cut -d ' ' -f2`
+
+ cur_launch=1;
+ until [ $cur_launch -gt $l_launch_num ]; do
+ launch_text=`echo $xmem | xpath -q -e /system_launcher/group[$cur_group]/launch[$cur_launch]`
+
+ l_attr="Launch${l_idx}=$g_name|$cur_group|$g_wait_time|$g_trigger"
+ l_attr+="|"`echo $launch_text | sed 's/\(.* name="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* path="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* priority="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* critical="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* retry_cnt="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* arguments="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* logging_mask="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* restart="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* is_start_required="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* shutdown_critical="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* shutdown_wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* fast_shutdown_wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* user_name="\)\([^"]*\)\(.*\)/\2/g'`
+ if echo "$launch_text" | grep -sq 'is_agl_unit=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* is_agl_unit="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|"
+ fi
+ if echo "$launch_text" | grep -sq 'disable_agl_resethistory=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* disable_agl_resethistory="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|"
+ fi
+ if echo "$launch_text" | grep -sq 'disable_nonagl_resethistory=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* disable_nonagl_resethistory="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|"
+ fi
+ if echo "$launch_text" | grep -sq 'env_cond=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* env_cond="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|"
+ fi
+
+ if echo "$launch_text" | grep -sq 'cpu_assign=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* cpu_assign="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|0x0"
+ fi
+
+ echo $l_attr
+
+ cur_launch=$(($cur_launch+1))
+ l_idx=$(($l_idx+1))
+ done
+
+ cur_group=$(($cur_group+1))
+done
+
+
+rm $body_file
+rm $main_file
+
+
diff --git a/video_in_hal/agl-basefiles/include/agl_thread.h b/video_in_hal/agl-basefiles/include/agl_thread.h
new file mode 100644
index 0000000..3be3595
--- /dev/null
+++ b/video_in_hal/agl-basefiles/include/agl_thread.h
@@ -0,0 +1,1385 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AGL_THREAD_H__
+#define __AGL_THREAD_H__
+
+//MACRO
+#define PR_TSS_S "0"
+#define PR_TSS 0
+
+/*
+ Main thread name. It need to be same as service name in sm_launch.xml or tskm_launch.xml
+ Max name length is 15
+ #define MN_XXXXX "MainName"
+
+ Thread name
+ Max name length is 15
+ #define TN_XXXXX "ThreadName"
+
+ Thread priority 0:TSS 1-99:FIFO
+ #define PR_XXXXX_S "(0-99)" //for xml
+ #define PR_XXXXX 0-99 //for program
+*/
+
+#define MN_SS_SYSMANAGER "SS_SysManager"
+#define PR_SS_SYSMANAGER_S "20"
+#define PR_SS_SYSMANAGER (20)
+
+ #define TN_SMHEARTBEAT "SM.Heartbeat"
+ #define PR_SMHEARTBEAT_S "20"
+ #define PR_SMHEARTBEAT (20)
+
+ #define TN_SMPROCLAUNCH "SM.ProcLaunch"
+ #define PR_SMPROCLAUNCH_S "20"
+ #define PR_SMPROCLAUNCH (20)
+
+ #define TN_SMLOWMEMMON "SM.LowMemMon"
+ #define PR_SMLOWMEMMON_S "20"
+ #define PR_SMLOWMEMMON (20)
+
+ #define TN_LOGGERRTIME "LoggerRtime"
+ #define PR_LOGGERRTIME_S PR_TSS_S
+ #define PR_LOGGERRTIME PR_TSS
+
+
+//======= exec from system manager =============
+#define MN_NS_SHAREDMEM "NS_SharedMem"
+#define PR_NS_SHAREDMEM_S "0"
+#define PR_NS_SHAREDMEM (0)
+
+
+#define MN_NS_NPPSERVICE "NS_NPPService"
+#define PR_NS_NPPSERVICE_S "0"
+#define PR_NS_NPPSERVICE (0)
+
+ #define TN_NS_NPPREADWKR "NS_NPPReadWkr"
+ #define PR_NS_NPPREADWKR_S "0"
+ #define PR_NS_NPPREADWKR (0)
+
+ #define TN_NS_NPPWRITEWKR "NS_NPPWriteWkr"
+ #define PR_NS_NPPWRITEWKR_S "0"
+ #define PR_NS_NPPWRITEWKR (0)
+
+ #define TN_NS_NPPIPWKR "NS_NPPIPWkr"
+ #define PR_NS_NPPIPWKR_S "0"
+ #define PR_NS_NPPIPWKR (0)
+
+#define MN_NS_BACKUPMGR "NS_BackupMgr"
+#define PR_NS_BACKUPMGR_S "0"
+#define PR_NS_BACKUPMGR (0)
+
+ #define TN_NS_BKUPNAND "NS_BkupNAND"
+ #define PR_NS_BKUPNAND_S "0"
+ #define PR_NS_BKUPNAND (0)
+
+ #define TN_NS_BKUPDELAY "NS_BkupDelay"
+ #define PR_NS_BKUPDELAY_S "0"
+ #define PR_NS_BKUPDELAY (0)
+
+#define MN_SS_DEVDETECTSRV "SS_DevDetectSrv"
+#define PR_SS_DEVDETECTSRV_S "0"
+#define PR_SS_DEVDETECTSRV (0)
+
+ #define TN_SS_DETECT_USB "SS_Detect_USB"
+ #define PR_SS_DETECT_USB_S "0"
+ #define PR_SS_DETECT_USB (0)
+
+ #define TN_SS_DETECT_SD "SS_Detect_SD"
+ #define PR_SS_DETECT_SD_S "0"
+ #define PR_SS_DETECT_SD (0)
+
+ #define TN_SS_MONITOR_OVC "SS_Monitor_OVC"
+ #define PR_SS_MONITOR_OVC_S "0"
+ #define PR_SS_MONITOR_OVC (0)
+
+#define MN_SS_LOGGERSRV "SS_LoggerSrv"
+#define PR_SS_LOGGERSRV_S PR_TSS_S
+#define PR_SS_LOGGERSRV PR_TSS
+
+ #define TN_PDGLOGQUER "pdg.LogQueR"
+ #define PR_PDGLOGQUER_S PR_TSS_S
+ #define PR_PDGLOGQUER PR_TSS
+
+ #define TN_PDGTRANSQUER "pdg.TransQueR"
+ #define PR_PDGTRANSQUER_S PR_TSS_S
+ #define PR_PDGTRANSQUER PR_TSS
+
+ #define TN_PDGEVNTLOGQUE "pdg.EvntLogQue"
+ #define PR_PDGEVNTLOGQUE_S PR_TSS_S
+ #define PR_PDGEVNTLOGQUE PR_TSS
+
+ #define TN_SSLOGGERSTRAGE "SSLoggerStrage"
+ #define PR_SSLOGGERSTRAGE_S PR_TSS_S
+ #define PR_SSLOGGERSTRAGE PR_TSS
+
+ #define TN_PFDRECTHREAD "PFDRECThread"
+ #define PR_PFDRECTHREAD_S PR_TSS_S
+ #define PR_PFDRECTHREAD PR_TSS
+
+#define MN_PS_LOGGERSHADOW "PS_LoggerShadow"
+ #define PR_PSLOGGERSHADOW_S PR_TSS_S
+ #define PR_PSLOGGERSHADOW PR_TSS
+
+#define MN_UDEVD "udevd"
+#define PR_UDEVD_S "1"
+#define PR_UDEVD (1)
+
+#define MN_COMMUNICATION "Communication"
+#define PR_COMMUNICATION_S "0"
+#define PR_COMMUNICATION (0)
+
+ #define TN_DEV_SYSCOM_TMR "DEV_SYSCOM_TMR"
+ #define PR_DEV_SYSCOM_TMR_S "0"
+ #define PR_DEV_SYSCOM_TMR (0)
+
+ #define TN_DEV_SYSCOM_RCV "DEV_SYSCOM_RCV"
+ #define PR_DEV_SYSCOM_RCV_S "0"
+ #define PR_DEV_SYSCOM_RCV (0)
+
+ #define TN_DEV_SYSCOM_MAIN "DEV_SYSCOM_MAIN"
+ #define PR_DEV_SYSCOM_MAIN_S "0"
+ #define PR_DEV_SYSCOM_MAIN (0)
+
+ #define TN_TGWCOM "TGWCOM"
+ #define PR_TGWCOM_S "0"
+ #define PR_TGWCOM (0)
+
+ #define TN__CWORD83_ "_CWORD83_"
+ #define PR__CWORD83__S "0"
+ #define PR__CWORD83_ (0)
+
+ #define TN_CAN_COM_PROT "CAN_COM_PROT"
+ #define PR_CAN_COM_PROT_S "0"
+ #define PR_CAN_COM_PROT (0)
+
+#define MN_PS_PSMSHADOW "PS_PSMShadow"
+#define PR_PS_PSMSHADOW_S "0"
+#define PR_PS_PSMSHADOW (0)
+
+#define MN_COMMSH4A "CommSH4A"
+#define PR_COMMSH4A_S "0"
+#define PR_COMMSH4A (0)
+
+ #define TN_DEV_SH4A_SND "DEV_SH4ACOM_SND"
+ #define PR_DEV_SH4A_SND_S "0"
+ #define PR_DEV_SH4A_SND (0)
+
+ #define TN_DEV_SH4A_RCV "DEV_SH4ACOM_RCV"
+ #define PR_DEV_SH4A_RCV_S "0"
+ #define PR_DEV_SH4A_RCV (0)
+
+ #define TN_DEV_SH4A_MON "DEV_SH4ACOM_MON"
+ #define PR_DEV_SH4A_MON_S "0"
+ #define PR_DEV_SH4A_MON (0)
+
+#define MN_PS_COMMUSB "PS_CommUSB"
+#define PR_PS_COMMUSB_S "0"
+#define PR_PS_COMMUSB (0)
+
+ #define TN_COMMUSB_RCV "COMMUSB_RCV"
+ #define PR_COMMUSB_RCV_S "0"
+ #define PR_COMMUSB_RCV (0)
+
+ #define TN_COMMUSB_DIAG "COMMUSB_DIAG"
+ #define PR_COMMUSB_DIAG_S "0"
+ #define PR_COMMUSB_DIAG (0)
+
+#define MN_PS_CANGW_M "CANGW_M"
+#define PR_PS_CANGW_M_S PR_TSS_S
+#define PR_PS_CANGW_M PR_TSS
+
+ #define TN_CANGW_M_RCV "CANGW_M_RCV"
+ #define PR_CANGW_M_RCV_S PR_TSS_S
+ #define PR_CANGW_M_RCV PR_TSS
+
+ #define TN_CANGW_M_DIAG "CANGW_M_DIAG"
+ #define PR_CANGW_M_DIAG_S PR_TSS_S
+ #define PR_CANGW_M_DIAG PR_TSS
+
+#define MN_PS_CANGW_S "CANGW_S"
+#define PR_PS_CANGW_S_S PR_TSS_S
+#define PR_PS_CANGW_S PR_TSS
+
+ #define TN_CANGW_S_SND "CANGW_S_SND"
+ #define PR_CANGW_S_SND_S PR_TSS_S
+ #define PR_CANGW_S_SND PR_TSS
+
+ #define TN_CANGW_S_DIAG "CANGW_S_DIAG"
+ #define PR_CANGW_S_DIAG_S PR_TSS_S
+ #define PR_CANGW_S_DIAG PR_TSS
+
+#define MN_LANSERVER "LanServer"
+#define PR_LANSERVER_S "0"
+#define PR_LANSERVER (0)
+
+#define MN_PS_CDR "ps_cdr"
+#define PR_PS_CDR_S PR_TSS_S
+#define PR_PS_CDR PR_TSS
+
+ #define TN_PS_CDR_NBD "ps_cdr_nbd"
+ #define PR_PS_CDR_NBD_S PR_TSS_S
+ #define PR_PS_CDR_NBD PR_TSS
+
+ #define TN_PS_CDR_DOIT "ps_cdr_doit"
+ #define PR_PS_CDR_DOIT_S PR_TSS_S
+ #define PR_PS_CDR_DOIT PR_TSS
+
+ #define TN_PS_CDR_READ "ps_cdr_read"
+ #define PR_PS_CDR_READ_S PR_TSS_S
+ #define PR_PS_CDR_READ PR_TSS
+
+#define MN_POSITIONING "Positioning"
+#define PR_POSITIONING_S PR_TSS_S
+#define PR_POSITIONING PR_TSS
+
+ #define TN_POSITIONING_GPS_MAIN "POS_Main"
+ #define PR_POSITIONING_GPS_MAIN_S PR_TSS_S
+ #define PR_POSITIONING_GPS_MAIN PR_TSS
+
+ #define TN_POSITIONING_GPS_RECV "POS_Gps_Recv"
+ #define PR_POSITIONING_GPS_RECV_S PR_TSS_S
+ #define PR_POSITIONING_GPS_RECV PR_TSS
+
+ #define TN_POSITIONING_GPS "POS_Gps"
+ #define PR_POSITIONING_GPS_S PR_TSS_S
+ #define PR_POSITIONING_GPS PR_TSS
+
+ #define TN_POSITIONING_SENS "POS_Sens"
+ #define PR_POSITIONING_SENS_S PR_TSS_S
+ #define PR_POSITIONING_SENS PR_TSS
+
+ #define TN_POSITIONING_GPS_ROLOVR "POS_Gps_Rolovr"
+ #define PR_POSITIONING_GPS_ROLOVR_S PR_TSS_S
+ #define PR_POSITIONING_GPS_ROLOVR PR_TSS
+
+#define MN_CLOCK "clock"
+#define PR_CLOCK_S "0"
+#define PR_CLOCK (0)
+
+ #define TN_CLOCK_MNG "ClockMng"
+ #define PR_CLOCK_MNG_S "0"
+ #define PR_CLOCK_MNG (0)
+
+#define MN_VEHICLE "vehicle"
+#define PR_VEHICLE_S "0"
+#define PR_VEHICLE (0)
+
+ #define TN_VEHICLE_SENS "VehicleSens"
+ #define PR_VEHICLE_SENS_S "0"
+ #define PR_VEHICLE_SENS (0)
+
+ #define TN_LINE_SENS_DRV "LineSensDrv"
+ #define PR_LINE_SENS_DRV_S "0"
+ #define PR_LINE_SENS_DRV (0)
+
+#define MN_SS_POWERSERVICE "SS_PowerService"
+#define PR_SS_POWERSERVICE_S "0"
+#define PR_SS_POWERSERVICE (0)
+
+#define MN_SS_TASKMANAGER "SS_TaskManager"
+#define PR_SS_TASKMANAGER_S "0"
+#define PR_SS_TASKMANAGER (0)
+
+ #define TN_SS_TSKMTIMER "SS_TskmTimer"
+ #define PR_SS_TSKMTIMER_S "0"
+ #define PR_SS_TSKMTIMER (0)
+
+#define MN_SOUND "Sound"
+#define PR_SOUND_S "0"
+#define PR_SOUND (0)
+
+ #define TN_VG_SNDSRCMGR "VG_SNDSRCMGR"
+ #define PR_VG_SNDSRCMGR_S "0"
+ #define PR_VG_SNDSRCMGR (0)
+
+ #define TN_SND_INPUTCTRL "SND_INPUTCTRL"
+ #define PR_SND_INPUTCTRL_S "0"
+ #define PR_SND_INPUTCTRL (0)
+
+ #define TN_SND_DEVCTRL "SND_DEVCTRL"
+ #define PR_SND_DEVCTRL_S "0"
+ #define PR_SND_DEVCTRL (0)
+
+ #define TN_SND_VCETRFCTRL "SND_VCETRFCTRL"
+ #define PR_SND_VCETRFCTRL_S "0"
+ #define PR_SND_VCETRFCTRL (0)
+
+ #define TN_SND_VCETRFWRT1 "SND_VCETRFWRT1"
+ #define PR_SND_VCETRFWRT1_S "0"
+ #define PR_SND_VCETRFWRT1 (0)
+
+ #define TN_SND_VCETRFWRT2 "SND_VCETRFWRT2"
+ #define PR_SND_VCETRFWRT2_S "0"
+ #define PR_SND_VCETRFWRT2 (0)
+
+ #define TN_VG_SNDCTRL_BSCF "VG_SNDCTRL_BSCF"
+ #define PR_VG_SNDCTRL_BSCF_S "0"
+ #define PR_VG_SNDCTRL_BSCF (0)
+
+ #define TN_VG_SNDCTRL_BSCR "VG_SNDCTRL_BSCR"
+ #define PR_VG_SNDCTRL_BSCR_S "0"
+ #define PR_VG_SNDCTRL_BSCR (0)
+
+ #define TN_VG_SNDCTRL_ITRT "VG_SNDCTRL_ITRT"
+ #define PR_VG_SNDCTRL_ITRT_S "0"
+ #define PR_VG_SNDCTRL_ITRT (0)
+
+ #define TN_CVRS_OPRT_OUT_1 "CVRS_OPRT_OUT_1"
+ #define PR_CVRS_OPRT_OUT_1_S "0"
+ #define PR_CVRS_OPRT_OUT_1 (0)
+
+ #define TN_CVRS_OPRT_OUT_2 "CVRS_OPRT_OUT_2"
+ #define PR_CVRS_OPRT_OUT_2_S "0"
+ #define PR_CVRS_OPRT_OUT_2 (0)
+
+ #define TN_CVRS_OPRT_OUT_3 "CVRS_OPRT_OUT_3"
+ #define PR_CVRS_OPRT_OUT_3_S "0"
+ #define PR_CVRS_OPRT_OUT_3 (0)
+
+ #define TN_CVRS_OPRT_OUT_4 "CVRS_OPRT_OUT_4"
+ #define PR_CVRS_OPRT_OUT_4_S "0"
+ #define PR_CVRS_OPRT_OUT_4 (0)
+
+ #define TN_CVRS_OPRT_IN_1 "CVRS_OPRT_IN_1"
+ #define PR_CVRS_OPRT_IN_1_S "0"
+ #define PR_CVRS_OPRT_IN_1 (0)
+
+ #define TN_CVRS_OPRT_IN_2 "CVRS_OPRT_IN_2"
+ #define PR_CVRS_OPRT_IN_2_S "0"
+ #define PR_CVRS_OPRT_IN_2 (0)
+
+ #define TN_CVRS_OPRT_IN_3 "CVRS_OPRT_IN_3"
+ #define PR_CVRS_OPRT_IN_3_S "0"
+ #define PR_CVRS_OPRT_IN_3 (0)
+
+ #define TN_CVRS_OPRT_IN_4 "CVRS_OPRT_IN_4"
+ #define PR_CVRS_OPRT_IN_4_S "0"
+ #define PR_CVRS_OPRT_IN_4 (0)
+
+ #define TN_CVRS_OPRT_IN_5 "CVRS_OPRT_IN_5"
+ #define PR_CVRS_OPRT_IN_5_S "0"
+ #define PR_CVRS_OPRT_IN_5 (0)
+
+ #define TN_CVRS_OPRT_IN_6 "CVRS_OPRT_IN_6"
+ #define PR_CVRS_OPRT_IN_6_S "0"
+ #define PR_CVRS_OPRT_IN_6 (0)
+
+ #define TN_CVRS_OPRT_IN_7 "CVRS_OPRT_IN_7"
+ #define PR_CVRS_OPRT_IN_7_S "0"
+ #define PR_CVRS_OPRT_IN_7 (0)
+
+ #define TN_CVRS_OPRT_IN_8 "CVRS_OPRT_IN_8"
+ #define PR_CVRS_OPRT_IN_8_S "0"
+ #define PR_CVRS_OPRT_IN_8 (0)
+
+ #define TN_CVRS_OPRT_BS_I "CVRS_OPRT_BS_I"
+ #define PR_CVRS_OPRT_BS_I_S "0"
+ #define PR_CVRS_OPRT_BS_I (0)
+
+ #define TN_VR_NVR_RECO "VR_NVR_RECO"
+ #define PR_VR_NVR_RECO_S "0"
+ #define PR_VR_NVR_RECO (0)
+
+ #define TN_SND_ECNR "SND_ECNR"
+ #define PR_SND_ECNR_S "0"
+ #define PR_SND_ECNR (0)
+
+ #define TN_SNDAGENT_000 "SNDAGENT_000"
+ #define PR_SNDAGENT_000_S "0"
+ #define PR_SNDAGENT_000 (0)
+
+ #define TN_SNDAGENT_001 "SNDAGENT_001"
+ #define PR_SNDAGENT_001_S "0"
+ #define PR_SNDAGENT_001 (0)
+
+ #define TN_SNDAGENT_002 "SNDAGENT_002"
+ #define PR_SNDAGENT_002_S "0"
+ #define PR_SNDAGENT_002 (0)
+
+ #define TN_SNDAGENT_003 "SNDAGENT_003"
+ #define PR_SNDAGENT_003_S "0"
+ #define PR_SNDAGENT_003 (0)
+
+ #define TN_SNDAGENT_004 "SNDAGENT_004"
+ #define PR_SNDAGENT_004_S "0"
+ #define PR_SNDAGENT_004 (0)
+
+ #define TN_SNDAGENT_005 "SNDAGENT_005"
+ #define PR_SNDAGENT_005_S "0"
+ #define PR_SNDAGENT_005 (0)
+
+ #define TN_SNDAGENT_006 "SNDAGENT_006"
+ #define PR_SNDAGENT_006_S "0"
+ #define PR_SNDAGENT_006 (0)
+
+ #define TN_SNDAGENT_007 "SNDAGENT_007"
+ #define PR_SNDAGENT_007_S "0"
+ #define PR_SNDAGENT_007 (0)
+
+ #define TN_SNDAGENT_008 "SNDAGENT_008"
+ #define PR_SNDAGENT_008_S "0"
+ #define PR_SNDAGENT_008 (0)
+
+ #define TN_SNDAGENT_009 "SNDAGENT_009"
+ #define PR_SNDAGENT_009_S "0"
+ #define PR_SNDAGENT_009 (0)
+
+ #define TN_SNDAGENT_010 "SNDAGENT_010"
+ #define PR_SNDAGENT_010_S "0"
+ #define PR_SNDAGENT_010 (0)
+
+ #define TN_SNDAGENT_011 "SNDAGENT_011"
+ #define PR_SNDAGENT_011_S "0"
+ #define PR_SNDAGENT_011 (0)
+
+ #define TN_SNDAGENT_012 "SNDAGENT_012"
+ #define PR_SNDAGENT_012_S "0"
+ #define PR_SNDAGENT_012 (0)
+
+ #define TN_SNDAGENT_013 "SNDAGENT_013"
+ #define PR_SNDAGENT_013_S "0"
+ #define PR_SNDAGENT_013 (0)
+
+ #define TN_SNDAGENT_014 "SNDAGENT_014"
+ #define PR_SNDAGENT_014_S "0"
+ #define PR_SNDAGENT_014 (0)
+
+ #define TN_SNDAGENT_015 "SNDAGENT_015"
+ #define PR_SNDAGENT_015_S "0"
+ #define PR_SNDAGENT_015 (0)
+
+ #define TN_SNDAGENT_016 "SNDAGENT_016"
+ #define PR_SNDAGENT_016_S "0"
+ #define PR_SNDAGENT_016 (0)
+
+ #define TN_SNDAGENT_017 "SNDAGENT_017"
+ #define PR_SNDAGENT_017_S "0"
+ #define PR_SNDAGENT_017 (0)
+
+ #define TN_SNDAGENT_018 "SNDAGENT_018"
+ #define PR_SNDAGENT_018_S "0"
+ #define PR_SNDAGENT_018 (0)
+
+ #define TN_SNDAGENT_019 "SNDAGENT_019"
+ #define PR_SNDAGENT_019_S "0"
+ #define PR_SNDAGENT_019 (0)
+
+ #define TN_SNDAGENT_020 "SNDAGENT_020"
+ #define PR_SNDAGENT_020_S "0"
+ #define PR_SNDAGENT_020 (0)
+
+ #define TN_SNDAGENT_021 "SNDAGENT_021"
+ #define PR_SNDAGENT_021_S "0"
+ #define PR_SNDAGENT_021 (0)
+
+ #define TN_SNDAGENT_022 "SNDAGENT_022"
+ #define PR_SNDAGENT_022_S "0"
+ #define PR_SNDAGENT_022 (0)
+
+ #define TN_SNDAGENT_023 "SNDAGENT_023"
+ #define PR_SNDAGENT_023_S "0"
+ #define PR_SNDAGENT_023 (0)
+
+ #define TN_SNDAGENT_024 "SNDAGENT_024"
+ #define PR_SNDAGENT_024_S "0"
+ #define PR_SNDAGENT_024 (0)
+
+ #define TN_SNDAGENT_025 "SNDAGENT_025"
+ #define PR_SNDAGENT_025_S "0"
+ #define PR_SNDAGENT_025 (0)
+
+#define MN_SS_RESOURCEMGR "SS_ResourceMgr"
+#define PR_SS_RESOURCEMGR_S "0"
+#define PR_SS_RESOURCEMGR (0)
+
+ #define TN_RESOURCEHWDT "ResourceHWDT"
+ #define PR_RESOURCEHWDT_S "0"
+ #define PR_RESOURCEHWDT (0)
+
+#define MN_AS_AUDIOMANAGER "AS_AudioManager"
+#define PR_AS_AUDIOMANAGER_S PR_TSS_S
+#define PR_AS_AUDIOMANAGER PR_TSS
+
+ #define TN_AS_SOUNDBEEP "AS_SoundBeep"
+ #define PR_AS_SOUNDBEEP_S PR_TSS_S
+ #define PR_AS_SOUNDBEEP PR_TSS
+
+#define MN_GRAPHICS "Graphics"
+#define PR_GRAPHICS_S "0"
+#define PR_GRAPHICS (0)
+
+ #define TN_GR_MAIN_CTRL "Graphics_main"
+ #define PR_GR_MAIN_CTRL_S PR_TSS_S
+ #define PR_GR_MAIN_CTRL PR_TSS
+
+ #define TN_GR_SEQ_CTRL "Graphics_seq"
+ #define PR_GR_SEQ_CTRL_S PR_TSS_S
+ #define PR_GR_SEQ_CTRL PR_TSS
+
+ #define TN_GR_DEV_RCV_CTRL "Graphics_rcv"
+ #define PR_GR_DEV_RCV_CTRL_S PR_TSS_S
+ #define PR_GR_DEV_RCV_CTRL PR_TSS
+
+ #define TN_GR_VCAP1_CTRL "Graphics_cap1"
+ #define PR_GR_VCAP1_CTRL_S "0"
+ #define PR_GR_VCAP1_CTRL (0)
+
+ #define TN_GR_VCAP2_CTRL "Graphics_cap2"
+ #define PR_GR_VCAP2_CTRL_S "0"
+ #define PR_GR_VCAP2_CTRL (0)
+
+#define MN_VUPSERVICE "vupservice"
+#define PR_VUPSERVICE_S PR_TSS_S
+#define PR_VUPSERVICE PR_TSS
+
+#define MN_SS_UPDATESERVICE "UpdateService"
+#define PR_SS_UPDATESERVICE_S PR_TSS_S
+#define PR_SS_UPDATESERVICE PR_TSS
+
+ #define TN_UPSERVICE_VERI "t_update_veri"
+ #define PR_UPSERVICE_VERI_S PR_TSS_S
+ #define PR_UPSERVICE_VERI PR_TSS
+
+#define MN_NW_MICSERVICE "NW_MicService"
+#define PR_NW_MICSERVICE_S PR_TSS_S
+#define PR_NW_MICSERVICE PR_TSS
+
+#define MN_NS_LOCKMGR "LockMgr"
+#define PR_NS_LOCKMGR_S PR_TSS_S
+#define PR_NS_LOCKMGR PR_TSS
+
+#define MN_PS_SWITCHHANDLER "SwitchHandler"
+#define PR_PS_SWITCHHANDLER_S "0"
+#define PR_PS_SWITCHHANDLER (0)
+
+#define MN_SS_WINSYS "SS_WinSys"
+#define PR_SS_WINSYS_S "5"
+#define PR_SS_WINSYS 5
+
+#define MN_MODEMANAGER "modemanager"
+#define PR_MODEMANAGER_S PR_TSS_S
+#define PR_MODEMANAGER PR_TSS
+
+#define MN_BTSTACKMAIN "btstackmain"
+#define PR_BTSTACKMAIN_S PR_TSS_S
+#define PR_BTSTACKMAIN PR_TSS
+
+#define MN_MEDIASERVICE "MediaService"
+#define PR_MEDIASERVICE_S PR_TSS_S
+#define PR_MEDIASERVICE PR_TSS
+
+// REPRO START
+#define MN_REPROSERVICE "ReproService"
+#define PR_REPROSERVICE_S PR_TSS_S
+#define PR_REPROSERVICE PR_TSS
+
+ #define TN_REPROSEQUENCER "RPRS_Sequencer"
+ #define PR_REPROSEQUENCER_S PR_TSS_S
+ #define PR_REPROSEQUENCER PR_TSS
+
+ #define TN_REPROCTRL "RPRS_Control"
+ #define PR_REPROCTRL_S PR_TSS_S
+ #define PR_REPROCTRL PR_TSS
+
+ #define TN_REPROCENTERCOMM "RPRS_CenterComm"
+ #define PR_REPROCENTERCOMM_S PR_TSS_S
+ #define PR_REPROCENTERCOMM PR_TSS
+
+ #define TN_REPROUNITCOMM "RPRS_UnitComm"
+ #define PR_REPROUNITCOMM_S PR_TSS_S
+ #define PR_REPROUNITCOMM PR_TSS
+
+ #define TN_REPROWEBDAVMGR "RPRS_WebDAVMgr"
+ #define PR_REPROWEBDAVMGR_S PR_TSS_S
+ #define PR_REPROWEBDAVMGR PR_TSS
+
+#define MN_REPROAENDTEST "Repro_Testpro_Sender"
+#define PR_REPROAENDTEST_S PR_TSS_S
+#define PR_REPROAENDTEST PR_TSS
+
+ #define TN_REPROAENDTESTTN "Repro_TestproT"
+ #define PR_REPROAENDTESTTN_S PR_TSS_S
+ #define PR_REPROAENDTESTTN PR_TSS
+
+#define MN_REPROBACKVUP "BackVupCtrl"
+#define PR_REPROBACKVUP_S PR_TSS_S
+#define PR_REPROBACKVUP PR_TSS
+
+#define MN_REPRODEVELOP "DevReproService"
+#define PR_REPRODEVELOP_S PR_TSS_S
+#define PR_REPRODEVELOP PR_TSS
+// REPRO END
+
+ #define TN_MED_MMCOM_PLAY "mmcom_play"
+ #define PR_MED_MMCOM_PLAY_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAY PR_TSS
+
+ #define TN_MED_MMCOM_MEDIA "mmcom_media"
+ #define PR_MED_MMCOM_MEDIA_S PR_TSS_S
+ #define PR_MED_MMCOM_MEDIA PR_TSS
+
+ #define TN_MED_MMCOM_DB "mmcom_db"
+ #define PR_MED_MMCOM_DB_S PR_TSS_S
+ #define PR_MED_MMCOM_DB PR_TSS
+
+ #define TN_MED_MMCOM_LIST "mmcom_list"
+ #define PR_MED_MMCOM_LIST_S PR_TSS_S
+ #define PR_MED_MMCOM_LIST PR_TSS
+
+ #define TN_MED_MMCOM_DBUSB "mmcom_dbusb"
+ #define PR_MED_MMCOM_DBUSB_S PR_TSS_S
+ #define PR_MED_MMCOM_DBUSB PR_TSS
+
+ #define TN_MED_MMCOM_DBSD "mmcom_dbsd"
+ #define PR_MED_MMCOM_DBSD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBSD PR_TSS
+
+ #define TN_MED_MMCOM_DBCD "mmcom_dbcd"
+ #define PR_MED_MMCOM_DBCD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBCD PR_TSS
+
+ #define TN_MED_MMCOM_PLAYRCV "mmcom_playrcv"
+ #define PR_MED_MMCOM_PLAYRCV_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAYRCV PR_TSS
+
+ #define TN_MED_RIPCOM_MNG "MngRipComm"
+ #define PR_MED_RIPCOM_MNG_S PR_TSS_S
+ #define PR_MED_RIPCOM_MNG PR_TSS
+
+ #define TN_MED_RIPCOM_EXE01 "ExeRipComm01"
+ #define PR_MED_RIPCOM_EXE01_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE01 PR_TSS
+
+ #define TN_MED_RIPCOM_EXE02 "ExeRipComm02"
+ #define PR_MED_RIPCOM_EXE02_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE02 PR_TSS
+
+ #define TN_MED_DISCCOM_MAIN "disccom_main"
+ #define PR_MED_DISCCOM_MAIN_S PR_TSS_S
+ #define PR_MED_DISCCOM_MAIN PR_TSS
+
+ #define TN_MED_DISCCOM_DB "disccom_db"
+ #define PR_MED_DISCCOM_DB_S PR_TSS_S
+ #define PR_MED_DISCCOM_DB PR_TSS
+
+#define MN_PLAYBACKSERVICE "PlaybackService"
+#define PR_PLAYBACKSERVICE_S PR_TSS_S
+#define PR_PLAYBACKSERVICE PR_TSS
+
+ #define TN_PLAYSRV_AUDIO "playsrv_audio"
+ #define PR_PLAYSRV_AUDIO_S PR_TSS_S
+ #define PR_PLAYSRV_AUDIO PR_TSS
+
+ #define TN_PLAYSRV_RIP "playsrv_rip"
+ #define PR_PLAYSRV_RIP_S PR_TSS_S
+ #define PR_PLAYSRV_RIP PR_TSS
+
+ #define TN_PLAYSRV_PLAY "playsrv_play"
+ #define PR_PLAYSRV_PLAY_S PR_TSS_S
+ #define PR_PLAYSRV_PLAY PR_TSS
+
+ #define TN_PLAYSRV_DISC "playsrv_disc"
+ #define PR_PLAYSRV_DISC_S PR_TSS_S
+ #define PR_PLAYSRV_DISC PR_TSS
+
+ #define TN_PLAYSRV_ARTWORK "playsrv_artwork"
+ #define PR_PLAYSRV_ARTWORK_S PR_TSS_S
+ #define PR_PLAYSRV_ARTWORK PR_TSS
+
+#define MN_DISCSERVICE "DiscService"
+#define PR_DISCSERVICE_S PR_TSS_S
+#define PR_DISCSERVICE PR_TSS
+
+#define MN_RADIOSERVICE "RadioService"
+#define PR_RADIOSERVICE_S PR_TSS_S
+#define PR_RADIOSERVICE PR_TSS
+
+#define MN_RADIOHDARBITER "RadioHDArbiter"
+#define PR_RADIOHDARBITER_S "0"
+#define PR_RADIOHDARBITER (0)
+
+#define MN_HRDS_MANAGER "hrds_manager"
+#define PR_HRDS_MANAGER_S PR_TSS_S
+#define PR_HRDS_MANAGER PR_TSS
+
+ #define TN_HRDS_HDMNG "hrds_hdmng"
+ #define PR_HRDS_HDMNG_S PR_TSS_S
+ #define PR_HRDS_HDMNG PR_TSS
+
+ #define TN_HRDS_HDDEC "hrds_hddec"
+ #define PR_HRDS_HDDEC_S PR_TSS_S
+ #define PR_HRDS_HDDEC PR_TSS
+
+ #define TN_HRDS_WEBMNG "hrds_webmng"
+ #define PR_HRDS_WEBMNG_S PR_TSS_S
+ #define PR_HRDS_WEBMNG PR_TSS
+
+ #define TN_HRDS_WEBCOM "hrds_webcom"
+ #define PR_HRDS_WEBCOM_S PR_TSS_S
+ #define PR_HRDS_WEBCOM PR_TSS
+
+#define MN_BT_CONNECTIONSERVICE "BT_CnctSrv"
+#define PR_BT_CONNECTIONSERVICE_S PR_TSS_S
+#define PR_BT_CONNECTIONSERVICE PR_TSS
+
+#define MN_BT_PHONESERVICE "BT_PhoneSrv"
+#define PR_BT_PHONESERVICE_S PR_TSS_S
+#define PR_BT_PHONESERVICE PR_TSS
+
+#define MN_BT_PHONEBOOKSERVICE "BT_PbkSrv"
+#define PR_BT_PHONEBOOKSERVICE_S PR_TSS_S
+#define PR_BT_PHONEBOOKSERVICE PR_TSS
+
+#define MN_BT_MESSAGINGSERVICE "BT_MsgSrv"
+#define PR_BT_MESSAGINGSERVICE_S PR_TSS_S
+#define PR_BT_MESSAGINGSERVICE PR_TSS
+
+#define MN_BT_BLLSERVICE "TEL_BLLSrv"
+#define PR_BT_BLLSERVICE_S PR_TSS_S
+#define PR_BT_BLLSERVICE PR_TSS
+
+#define MN_BT_DCMPHONESERVICE "DCM_PhoneSrv"
+#define PR_BT_DCMPHONESERVICE_S PR_TSS_S
+#define PR_BT_DCMPHONESERVICE PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ1 "HFPMultiQ1"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1 PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ2 "HFPMultiQ2"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2 PR_TSS
+
+ #define TN_BT_PBKSRV_DATABASE "BTPB_Database"
+ #define PR_TN_BT_PBKSRV_DATABASE_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_DATABASE PR_TSS
+
+ #define TN_BT_PBKSRV_LOCALPBINST "LocalPBINST"
+ #define PR_TN_BT_PBKSRV_LOCALPBINST_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_LOCALPBINST PR_TSS
+
+ #define TN_BT_PBKSRV_RESOLVENAME "ResolveName"
+ #define PR_TN_BT_PBKSRV_RESOLVENAME_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_RESOLVENAME PR_TSS
+
+ #define TN_BT_PBKSRV_PBAPMULTIQ1 "PBAPMultiQ1"
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1 PR_TSS
+
+ #define TN_BT_PBKSRV_OPPMULTI "OPPMulti"
+ #define PR_TN_BT_PBKSRV_OPPMULTI_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_OPPMULTI PR_TSS
+
+ #define TN_BT_PBKSRV_VCARDPARSER "VCardParser"
+ #define PR_TN_BT_PBKSRV_VCARDPARSER_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_VCARDPARSER PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD0 "MsgCntrlThread0"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0 PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD1 "MsgCntrlThread1"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1 PR_TSS
+
+ #define TN_BT_MSGSRV_MAPMULTI "MapMulti"
+ #define PR_TN_BT_MSGSRV_MAPMULTI_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MAPMULTI PR_TSS
+
+#define MN_DTVSERVICE "DtvService"
+#define PR_DTVSERVICE_S PR_TSS_S
+#define PR_DTVSERVICE PR_TSS
+
+ #define TN_DTVTNC_TX "dtvtnc_tx"
+ #define PR_DTVTNC_TX_S PR_TSS_S
+ #define PR_DTVTNC_TX PR_TSS
+
+ #define TN_DTVTNC_RCV "dtvtnc_rcv"
+ #define PR_DTVTNC_RCV_S PR_TSS_S
+ #define PR_DTVTNC_RCV PR_TSS
+
+ #define TN_DTVTNC_TIMER "dtvtnc_timer"
+ #define PR_DTVTNC_TIMER_S PR_TSS_S
+ #define PR_DTVTNC_TIMER PR_TSS
+
+ #define TN_DTVTNC_CTL "dtvtnc_ctl"
+ #define PR_DTVTNC_CTL_S PR_TSS_S
+ #define PR_DTVTNC_CTL PR_TSS
+
+#define MN_DTVVUPSERVICE "DtvVupService"
+#define PR_DTVVUPSERVICE_S PR_TSS_S
+#define PR_DTVVUPSERVICE PR_TSS
+
+#define MN_SETTINGSERVICE "SettingService"
+#define PR_SETTINGSERVICE_S PR_TSS_S
+#define PR_SETTINGSERVICE PR_TSS
+
+#define MN_INFOSETTINGSRV "InfoSettingSrv"
+#define PR_INFOSETTINGSRV_S PR_TSS_S
+#define PR_INFOSETTINGSRV PR_TSS
+
+ #define TN_INFS_UIC "infs_uic"
+ #define PR_INFS_UIC_S PR_TSS_S
+ #define PR_INFS_UIC PR_TSS
+
+#define MN_DELPERSONALSRV "DelPersonalSrv"
+#define PR_DELPERSONALSRV_S PR_TSS_S
+#define PR_DELPERSONALSRV PR_TSS
+
+#define MN_MENUSERVICE "MenuService"
+#define PR_MENUSERVICE_S PR_TSS_S
+#define PR_MENUSERVICE PR_TSS
+
+#define MN_NAVIPROXY "NaviProxy"
+#define PR_NAVIPROXY_S PR_TSS_S
+#define PR_NAVIPROXY PR_TSS
+
+#define MN_AWBPROXY "AwbProxy"
+#define PR_AWBPROXY_S PR_TSS_S
+#define PR_AWBPROXY PR_TSS
+
+#define MN_TFFPROXY "TFFProxy"
+#define PR_TFFPROXY_S PR_TSS_S
+#define PR_TFFPROXY PR_TSS
+
+#define MN_TFFPROXYSLAVE "TFFProxySlave"
+#define PR_TFFPROXYSLAVE_S PR_TSS_S
+#define PR_TFFPROXYSLAVE PR_TSS
+
+#define MN_AWNPRIMARY "AwnPrimary"
+#define PR_AWNPRIMARY_S PR_TSS_S
+#define PR_AWNPRIMARY PR_TSS
+
+#define MN_AWBPRIMARY "AwbPrimary"
+#define PR_AWBPRIMARY_S PR_TSS_S
+#define PR_AWBPRIMARY PR_TSS
+
+#define MN_AWMPRIMARY "AwmPrimary"
+#define PR_AWMPRIMARY_S PR_TSS_S
+#define PR_AWMPRIMARY PR_TSS
+
+#define MN_AWTPRIMARY "AwtPrimary"
+#define PR_AWTPRIMARY_S PR_TSS_S
+#define PR_AWTPRIMARY PR_TSS
+
+#define MN_MISINKSERVICE "MisinkService"
+#define PR_MISINKSERVICE_S PR_TSS_S
+#define PR_MISINKSERVICE PR_TSS
+
+#define MN_TEXTCONVERTER "TextConverter"
+#define PR_TEXTCONVERTER_S PR_TSS_S
+#define PR_TEXTCONVERTER PR_TSS
+
+#define MN_HANDWRITING "HandWriting"
+#define PR_HANDWRITING_S PR_TSS_S
+#define PR_HANDWRITING PR_TSS
+
+#define MN_EXTUNITAUTH_D "EXTUNITAUTH_D"
+#define PR_EXTUNITAUTH_D_S "0"
+#define PR_EXTUNITAUTH_D 0
+
+ #define TN_VPSVC__CWORD84_ "VPSVC_D"
+ #define PR_VPSVC__CWORD84__S PR_TSS_S
+ #define PR_VPSVC__CWORD84_ PR_TSS
+
+#define MN_PROXYSERVICE "ProxyService"
+#define PR_PROXYSERVICE_S PR_TSS_S
+#define PR_PROXYSERVICE PR_TSS
+
+#define MN_FUELSERVICE "VS_FUCSrv"
+#define PR_FUELSERVICE_S PR_TSS_S
+#define PR_FUELSERVICE PR_TSS
+
+#define MN_ENERGYSERVICE "VS_ENMSrv"
+#define PR_ENERGYSERVICE_S PR_TSS_S
+#define PR_ENERGYSERVICE PR_TSS
+
+#define MN_CUSTOMIZESERVICE "VS_VSDSrv"
+#define PR_CUSTOMIZESERVICE_S PR_TSS_S
+#define PR_CUSTOMIZESERVICE PR_TSS
+
+#define MN_DMSSERVICE "VS_DMSSrv"
+#define PR_DMSSERVICE_S PR_TSS_S
+#define PR_DMSSERVICE PR_TSS
+
+#define MN_AIRCONSERVICE "VS_ACNSrv"
+#define PR_AIRCONSERVICE_S PR_TSS_S
+#define PR_AIRCONSERVICE PR_TSS
+
+#define MN_SEATSERVICE "VS_NMSSrv"
+#define PR_SEATSERVICE_S PR_TSS_S
+#define PR_SEATSERVICE PR_TSS
+
+#define MN_CAMERASERVICE "VS_CMRSrv"
+#define PR_CAMERASERVICE_S PR_TSS_S
+#define PR_CAMERASERVICE PR_TSS
+
+ #define TN_CAMERAQUICKRVC "QuickRVCThread"
+ #define PR_CAMERAQUICKRVC_S PR_TSS_S
+ #define PR_CAMERAQUICKRVC PR_TSS
+
+#define MN_METSERVICE "VS_METSrv"
+#define PR_METSERVICE_S PR_TSS_S
+#define PR_METSERVICE PR_TSS
+
+#define MN_TMCSERVICE "VS_TMCSrv"
+#define PR_TMCSERVICE_S PR_TSS_S
+#define PR_TMCSERVICE PR_TSS
+
+#define MN_DASSERVICE "VS_DASSrv"
+#define PR_DASSERVICE_S PR_TSS_S
+#define PR_DASSERVICE PR_TSS
+
+#define MN_EXTUNITAUTH_M "EXTUNITAUTH_M"
+#define PR_EXTUNITAUTH_M_S "0"
+#define PR_EXTUNITAUTH_M 0
+
+#define MN_DUMMYREAD "DummyRead"
+#define PR_DUMMYREAD_S PR_TSS_S
+#define PR_DUMMYREAD PR_TSS
+
+#define MN_SSTSERVICE "storage_access"
+#define PR_SSTSERVICE_S PR_TSS_S
+#define PR_SSTSERVICE PR_TSS
+
+#define MN_CCSAUDITD "ccs-auditd"
+#define PR_CCSAUDITD_S PR_TSS_S
+#define PR_CCSAUDITD PR_TSS
+
+//exec from task manager
+#define MN_ACTIVITYMANAGER "ActivityManager"
+#define PR_ACTIVITYMANAGER_S PR_TSS_S
+#define PR_ACTIVITYMANAGER PR_TSS
+
+#define MN_RESIDENT_SVC "RESIDENT_SVC"
+#define PR_RESIDENT_SVC_S PR_TSS_S
+#define PR_RESIDENT_SVC PR_TSS
+
+#define MN_TRANSIENT_SVC "TRANSIENT_SVC"
+#define PR_TRANSIENT_SVC_S PR_TSS_S
+#define PR_TRANSIENT_SVC PR_TSS
+
+#define MN_WLANSERVICE "wlan_ctrl_0700"
+#define PR_WLANSERVICE_S PR_TSS_S
+#define PR_WLANSERVICE PR_TSS
+
+#define MN_WLANEVTTHR "WlanEvtThr"
+#define PR_WLANEVTTHR_S PR_TSS_S
+#define PR_WLANEVTTHR PR_TSS
+
+#define MN_WLANMIDDLESERVICE "WlanMiddle"
+#define PR_WLANMIDDLESERVICE_S PR_TSS_S
+#define PR_WLANMIDDLESERVICE PR_TSS
+
+ #define TN_WLANMIDDLESERVICE0 "WM_MsgCtrlTh0"
+ #define PR_WLANMIDDLESERVICE0_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE0 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE1 "WM_MsgCtrlTh1"
+ #define PR_WLANMIDDLESERVICE1_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE1 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE2 "WM_MsgCtrlTh2"
+ #define PR_WLANMIDDLESERVICE2_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE2 PR_TSS
+
+#define MN_WLANSERVICE2 "wlan_ctrl_0701"
+#define PR_WLANSERVICE2_S PR_TSS_S
+#define PR_WLANSERVICE2 PR_TSS
+
+#define MN_WLANEVTTHR2 "WlanEvtThr2"
+#define PR_WLANEVTTHR2_S PR_TSS_S
+#define PR_WLANEVTTHR2 PR_TSS
+
+//exec from task manager, Test for vup
+#define MN_PS__CWORD52_VUP "_CWORD52_vup"
+#define PR_PS__CWORD52_VUP_S PR_TSS_S
+#define PR_PS__CWORD52_VUP PR_TSS
+
+#define MN_PS_SYSVUP "sysvup"
+#define PR_PS_SYSVUP_S PR_TSS_S
+#define PR_PS_SYSVUP PR_TSS
+
+#define MN_SS_ROOTFSVUP "rootfsvup"
+#define PR_SS_ROOTFSVUP_S PR_TSS_S
+#define PR_SS_ROOTFSVUP PR_TSS
+
+#define MN_SS_VUPPROGUI "vupprogressui"
+#define PR_SS_VUPPROGUI_S PR_TSS_S
+#define PR_SS_VUPPROGUI PR_TSS
+
+#define MN_SS_NORVUP "norvup"
+#define PR_SS_NORVUP_S PR_TSS_S
+#define PR_SS_NORVUP PR_TSS
+
+// OUTER_UPDATE START
+#define MN_XMVUPSERVICE "radio_xm_update"
+#define PR_XMVUPSERVICE_S PR_TSS_S
+#define PR_XMVUPSERVICE PR_TSS
+// OUTER_UPDATE END
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+// NON-resident, exec from task manager, Repro update
+#define MN_PS_SYSUPDATE "sysupdate"
+#define PR_PS_SYSUPDATE_S PR_TSS_S
+#define PR_PS_SYSUPDATE PR_TSS
+
+#define MN_SS_NANDUPDATE "nandupdate"
+#define PR_SS_NANDUPDATE_S PR_TSS_S
+#define PR_SS_NANDUPDATE PR_TSS
+
+ #define TN_NANDUPDATE_CLD "t_nandcld"
+ #define PR_NANDUPDATE_CLD_S PR_TSS_S
+ #define PR_NANDUPDATE_CLD PR_TSS
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+//exec from diag
+#define MN_DIAGSERVICE "DiagService"
+#define PR_DIAGSERVICE_S PR_TSS_S
+#define PR_DIAGSERVICE PR_TSS
+
+#define MN_DIAGWORKERTSK "diagworker_tsk"
+#define PR_DIAGWORKERTSK_S PR_TSS_S
+#define PR_DIAGWORKERTSK PR_TSS
+
+#define MN_DIAGTSK "diag_tsk"
+#define PR_DIAGTSK_S PR_TSS_S
+#define PR_DIAGTSK PR_TSS
+
+#define MN_DIAGMCTSK "diagmc_tsk"
+#define PR_DIAGMCTSK_S PR_TSS_S
+#define PR_DIAGMCTSK PR_TSS
+
+#define MN_DIAGUTCOL "diagutCol_tsk"
+#define PR_DIAGUTCOL_S PR_TSS_S
+#define PR_DIAGUTCOL PR_TSS
+
+#define MN_DIAGUTUPD "diagutUpd_tsk"
+#define PR_DIAGUTUPD_S PR_TSS_S
+#define PR_DIAGUTUPD PR_TSS
+
+//exec from Connectivity for _CWORD57_
+#define MN__CWORD57_UTILSERVICE "_CWORD57_UtilService"
+#define PR__CWORD57_UTILSERVICE_S PR_TSS_S
+#define PR__CWORD57_UTILSERVICE PR_TSS
+
+ #define TN_CON_IPUT_DETECT "iputsrv_detect"
+ #define PR_CON_IPUT_DETECT_S PR_TSS_S
+ #define PR_CON_IPUT_DETECT PR_TSS
+
+ #define TN_CON_IPUT_AUTH "iputsrv_auth"
+ #define PR_CON_IPUT_AUTH_S PR_TSS_S
+ #define PR_CON_IPUT_AUTH PR_TSS
+
+ #define TN_CON_IPUT_SERIAL "iputsrv_serial"
+ #define PR_CON_IPUT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPUT_SERIAL PR_TSS
+
+ #define TN_CON_IPUT_USB_1 "iputsrv_usb1"
+ #define PR_CON_IPUT_USB_1_S PR_TSS_S
+ #define PR_CON_IPUT_USB_1 PR_TSS
+
+ #define TN_CON_IPUT_USB_2 "iputsrv_usb2"
+ #define PR_CON_IPUT_USB_2_S PR_TSS_S
+ #define PR_CON_IPUT_USB_2 PR_TSS
+
+ #define TN_CON_IPUT_SPP "iputsrv_spp"
+ #define PR_CON_IPUT_SPP_S PR_TSS_S
+ #define PR_CON_IPUT_SPP PR_TSS
+
+#define MN__CWORD57_DTSERVICE "_CWORD57_DTService"
+#define PR__CWORD57_DTSERVICE_S PR_TSS_S
+#define PR__CWORD57_DTSERVICE PR_TSS
+
+ #define TN_CON_IPDT_SERIAL "ipdtsrv_serial"
+ #define PR_CON_IPDT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPDT_SERIAL PR_TSS
+
+ #define TN_CON_IPDT_USB_1 "ipdtsrv_usb1"
+ #define PR_CON_IPDT_USB_1_S PR_TSS_S
+ #define PR_CON_IPDT_USB_1 PR_TSS
+
+ #define TN_CON_IPDT_USB_2 "ipdtsrv_usb2"
+ #define PR_CON_IPDT_USB_2_S PR_TSS_S
+ #define PR_CON_IPDT_USB_2 PR_TSS
+
+ #define TN_CON_IPDT_SPP "ipdtsrv_spp"
+ #define PR_CON_IPDT_SPP_S PR_TSS_S
+ #define PR_CON_IPDT_SPP PR_TSS
+
+#define MN_WEBDAVMGR "webdavmgr"
+#define PR_WEBDAVMGR_S PR_TSS_S
+#define PR_WEBDAVMGR PR_TSS
+
+#define MN_DISPLAYSERVICE "DisplayService"
+#define PR_DISPLAYSERVICE_S PR_TSS_S
+#define PR_DISPLAYSERVICE PR_TSS
+
+#define MN_ENFORMSERVICE "EnformService"
+#define PR_ENFORMSERVICE_S PR_TSS_S
+#define PR_ENFORMSERVICE PR_TSS
+
+#define MN_CONNUTIL "ConnUtil"
+#define PR_CONNUTIL_S PR_TSS_S
+#define PR_CONNUTIL PR_TSS
+
+#define MN_CONNUTILSLAVE "ConnUtilSlave"
+#define PR_CONNUTILSLAVE_S PR_TSS_S
+#define PR_CONNUTILSLAVE PR_TSS
+
+#define MN_CONNMGR "ConnMgr"
+#define PR_CONNMGR_S PR_TSS_S
+#define PR_CONNMGR PR_TSS
+
+#define MN_SERVICEFLAGMGR "ServiceFlagMgr"
+#define PR_SERVICEFLAGMGR_S PR_TSS_S
+#define PR_SERVICEFLAGMGR PR_TSS
+
+//exec from VR
+#define MN_VRMANAGER "vrmanager"
+#define PR_VRMANAGER_S PR_TSS_S
+#define PR_VRMANAGER PR_TSS
+
+ #define TN_VR_WORKER "VrWorkerThread"
+ #define PR_VR_WORKER_S PR_TSS_S
+ #define PR_VR_WORKER PR_TSS
+
+ #define TN_VBT_PROPDISPATCH "PropDispatchThread"
+ #define PR_VBT_PROPDISPATCH_S PR_TSS_S
+ #define PR_VBT_PROPDISPATCH PR_TSS
+
+ #define TN_VBT_PROPRESPONSE "PropResponseThread"
+ #define PR_VBT_PROPRESPONSE_S PR_TSS_S
+ #define PR_VBT_PROPRESPONSE PR_TSS
+
+ #define TN_VBT_PROPAUDIOPLAY "PropAudioPlayThread"
+ #define PR_VBT_PROPAUDIOPLAY_S PR_TSS_S
+ #define PR_VBT_PROPAUDIOPLAY PR_TSS
+
+ #define TN_VBT_PROPAUDIORECORD "PropAudioRecordThread"
+ #define PR_VBT_PROPAUDIORECORD_S PR_TSS_S
+ #define PR_VBT_PROPAUDIORECORD PR_TSS
+
+ #define TN_VBT_MAINTHREADPRIO "MainThreadPriority"
+ #define PR_VBT_MAINTHREADPRIO_S PR_TSS_S
+ #define PR_VBT_MAINTHREADPRIO PR_TSS
+
+ #define TN_VBT_ASRMANAGERGRAMMAR "AsrManagerGrammarGenerationThread"
+ #define PR_VBT_ASRMANAGERGRAMMAR_S PR_TSS_S
+ #define PR_VBT_ASRMANAGERGRAMMAR PR_TSS
+
+ #define TN_VBT_ASRVOCONRECO "AsrVoconRecoProcessThread"
+ #define PR_VBT_ASRVOCONRECO_S PR_TSS_S
+ #define PR_VBT_ASRVOCONRECO PR_TSS
+
+ #define TN_VBT_BROADCASTREAD "BroadCastReadThread"
+ #define PR_VBT_BROADCASTREAD_S PR_TSS_S
+ #define PR_VBT_BROADCASTREAD PR_TSS
+
+ #define TN_VBT_FILEAGGREGATOR "FileAggregatorDecompressThread"
+ #define PR_VBT_FILEAGGREGATOR_S PR_TSS_S
+ #define PR_VBT_FILEAGGREGATOR PR_TSS
+
+ #define TN_VBT_HTTPCURLREQUEST "HttpCurlRequestThread"
+ #define PR_VBT_HTTPCURLREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPCURLREQUEST PR_TSS
+
+ #define TN_VBT_HTTPDRIVERREQUEST "HttpDriverRequestThread"
+ #define PR_VBT_HTTPDRIVERREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPDRIVERREQUEST PR_TSS
+
+ #define TN_VBT_HTTPREQUESTSESSION "HttpRequestSessionStateThread"
+ #define PR_VBT_HTTPREQUESTSESSION_S PR_TSS_S
+ #define PR_VBT_HTTPREQUESTSESSION PR_TSS
+
+ #define TN_VBT_PLAYMGRSTOPASYNC "PlayMgrStopAsyncStreamThread"
+ #define PR_VBT_PLAYMGRSTOPASYNC_S PR_TSS_S
+ #define PR_VBT_PLAYMGRSTOPASYNC PR_TSS
+
+ #define TN_VBT_RESOURCEMGRQUEUE "ResourceMgrQueueHandlerThread"
+ #define PR_VBT_RESOURCEMGRQUEUE_S PR_TSS_S
+ #define PR_VBT_RESOURCEMGRQUEUE PR_TSS
+
+ #define TN_VBT_SMURFDRIVERTIMEOUT "SmurfDriverTimeoutThread"
+ #define PR_VBT_SMURFDRIVERTIMEOUT_S PR_TSS_S
+ #define PR_VBT_SMURFDRIVERTIMEOUT PR_TSS
+
+ #define TN_NVR_NVRMAIN "NvrMainThread"
+ #define PR_NVR_NVRMAIN_S PR_TSS_S
+ #define PR_NVR_NVRMAIN PR_TSS
+
+ #define TN_NVR_NVRRECO "NvrRecoThread"
+ #define PR_NVR_NVRRECO_S PR_TSS_S
+ #define PR_NVR_NVRRECO PR_TSS
+
+ #define TN_NVR_NVRDICT "NvrDictThread"
+ #define PR_NVR_NVRDICT_S PR_TSS_S
+ #define PR_NVR_NVRDICT PR_TSS
+
+ #define TN_NVR_NVRENC "NvrEncThread"
+ #define PR_NVR_NVRENC_S PR_TSS_S
+ #define PR_NVR_NVRENC PR_TSS
+
+//exec from VehicleInfo
+#define MN_VEHICLEINFOSERVICE "VehicleInfoSrv"
+#define PR_VEHICLEINFOSERVICE_S PR_TSS_S
+#define PR_VEHICLEINFOSERVICE PR_TSS
+
+//exec from _CWORD58_
+#define MN__CWORD58_SERVICE "_CWORD58_Service"
+#define PR__CWORD58_SERVICE_S PR_TSS_S
+#define PR__CWORD58_SERVICE PR_TSS
+
+#define MN__CWORD8_SRV "_CWORD8_Srv"
+#define PR__CWORD8_SRV_S PR_TSS_S
+#define PR__CWORD8_SRV PR_TSS
+
+#define MN_SPCSERVICE "SPCService"
+#define PR_SPCSERVICE_S PR_TSS_S
+#define PR_SPCSERVICE PR_TSS
+
+#define MN_LOCALSERVERPROXY "LSP"
+#define PR_LOCALSERVERPROXY_S PR_TSS_S
+#define PR_LOCALSERVERPROXY PR_TSS
+
+#define MN_EOMSERVICE "eOMService"
+#define PR_EOMSERVICE_S PR_TSS_S
+#define PR_EOMSERVICE PR_TSS
+
+//exec from _CWORD89_
+#define MN__CWORD89_SERVICE "_CWORD89_Service"
+#define PR__CWORD89_SERVICE_S PR_TSS_S
+#define PR__CWORD89_SERVICE PR_TSS
+
+//exec from NetworkManager
+#define MN_NETWORKMANAGER "NetworkManager"
+#define PR_NETWORKMANAGER_S PR_TSS_S
+#define PR_NETWORKMANAGER PR_TSS
+
+ #define TN_NWM_TH_CMDRCV "NWM_Th_CmdRcv"
+ #define PR_NWM_TH_CMDRCV_S PR_TSS_S
+ #define PR_NWM_TH_CMDRCV PR_TSS
+
+ #define TN_NWM_TH_PROCMGR "NWM_Th_ProcMgr"
+ #define PR_NWM_TH_PROCMGR_S PR_TSS_S
+ #define PR_NWM_TH_PROCMGR PR_TSS
+
+ #define TN_NWM_TH_CMDPROC "NWM_Th_CmdProc"
+ #define PR_NWM_TH_CMDPROC_S PR_TSS_S
+ #define PR_NWM_TH_CMDPROC PR_TSS
+
+ #define TN_NWM_TH_DNSMGR "NWM_Th_DnsMgr"
+ #define PR_NWM_TH_DNSMGR_S PR_TSS_S
+ #define PR_NWM_TH_DNSMGR PR_TSS
+
+ #define TN_NWM_TH_DHCPD "NWM_Th_Dhcpd"
+ #define PR_NWM_TH_DHCPD_S PR_TSS_S
+ #define PR_NWM_TH_DHCPD PR_TSS
+
+// DCM Service
+#define MN_DCMSERVICE "DCMService"
+#define PR_DCMSERVICE_S PR_TSS_S
+#define PR_DCMSERVICE PR_TSS
+
+ #define TN_DCM_TH_CMDRCV "DCM_Th_CmdRcv"
+ #define PR_DCM_TH_CMDRCV_S PR_TSS_S
+ #define PR_DCM_TH_CMDRCV PR_TSS
+
+ #define TN_DCM_TH_MSGRCV "DCM_Th_MsgRcv"
+ #define PR_DCM_TH_MSGRCV_S PR_TSS_S
+ #define PR_DCM_TH_MSGRCV PR_TSS
+
+ #define TN_DCM_TH_TIMER "DCM_Th_Timer"
+ #define PR_DCM_TH_TIMER_S PR_TSS_S
+ #define PR_DCM_TH_TIMER PR_TSS
+
+// HELP Service
+#define MN_HELPSERVICE "HELPService"
+#define PR_HELPSERVICE_S PR_TSS_S
+#define PR_HELPSERVICE PR_TSS
+
+//exec from RemoteService
+#define MN_REMOTESERVICE "RemoteService"
+#define PR_REMOTESERVICE_S PR_TSS_S
+#define PR_REMOTESERVICE PR_TSS
+
+ #define TN_RS_TH_CANCTRL "RS_Th_CANCtrl"
+ #define PR_RS_TH_CANCTRL_S PR_TSS_S
+ #define PR_RS_TH_CANCTRL PR_TSS
+
+ #define TN_RS_TH_DISPCTRL "RS_Th_DispCtrl"
+ #define PR_RS_TH_DISPCTRL_S PR_TSS_S
+ #define PR_RS_TH_DISPCTRL PR_TSS
+
+ #define TN_RS_TH_PARTSCTRL "RS_Th_PartsCtrl"
+ #define PR_RS_TH_PARTSCTRL_S PR_TSS_S
+ #define PR_RS_TH_PARTSCTRL PR_TSS
+
+ #define TN_RS_TH_HTTPPROC "RS_Th_HttpProc"
+ #define PR_RS_TH_HTTPPROC_S PR_TSS_S
+ #define PR_RS_TH_HTTPPROC PR_TSS
+
+//exec from VR
+#define MN_CONTENTSMGR "contentsmgr"
+#define PR_CONTENTSMGR_S PR_TSS_S
+#define PR_CONTENTSMGR PR_TSS
+
+ #define TN_CDB_CONTENDB "contendbThread"
+ #define PR_CDB_CONTENDB_S PR_TSS_S
+ #define PR_CDB_CONTENDB PR_TSS
+
+/* COMARB Service */
+#define MN_NW_COMARB "ComArbService"
+#define PR_NW_COMARB_S PR_TSS_S
+#define PR_NW_COMARB PR_TSS
+
+/* ASND_FRthread */
+#define MN_ASND_FRTH "ASND_FRthread"
+#define PR_ASND_FRTH_S PR_SND_VCETRFCTRL_S
+#define PR_ASND_FRTH PR_SND_VCETRFCTRL
+
+/* MLINK Service */
+#define MN_MLINKSERVICE "MlinkService"
+#define PR_MLINKSERVICE_S PR_TSS_S
+#define PR_MLINKSERVICE PR_TSS
+
+#define MN__CWORD74_SERVICE "_CWORD74_Service"
+#define PR__CWORD74_SERVICE_S PR_TSS_S
+#define PR__CWORD74_SERVICE PR_TSS
+#endif //__AGL_THREAD_H__
diff --git a/video_in_hal/agl-basefiles/include/agl_types_obsoluted.h b/video_in_hal/agl-basefiles/include/agl_types_obsoluted.h
new file mode 100644
index 0000000..0f7e86d
--- /dev/null
+++ b/video_in_hal/agl-basefiles/include/agl_types_obsoluted.h
@@ -0,0 +1,136 @@
+/*
+ * @copyright Copyright (c) 2017-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _AGL_TYPES_OBSOLUTED_H_
+#define _AGL_TYPES_OBSOLUTED_H_
+
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <linux/types.h>
+#include <stdio.h>
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <errno.h>
+
+typedef u_int64_t _Uint64t;
+typedef int64_t _Int64t;
+typedef u_int32_t _Uint32t;
+typedef int32_t _Int32t;
+typedef u_int16_t _Uint16t;
+typedef int16_t _Int16t;
+typedef u_int8_t _Uint8t;
+typedef int8_t _Int8t;
+
+typedef _Int8t _int8;
+typedef _Uint8t _uint8;
+typedef _Int16t _int16;
+typedef _Uint16t _uint16;
+typedef _Int32t _int32;
+typedef _Uint32t _uint32;
+typedef _Int64t _int64;
+typedef _Uint64t _uint64;
+
+
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+#define AGL_PROTECTION_NO_CACHE 0x00000800
+#define AGL_MAP_NON_INIT 0x00004000
+#define AGL_MAP_PHYSICAL 0x00010000
+#define AGL_NON_FD (-1)
+#define AGL_MAP_DEV_FAILED ((unsigned long)MAP_FAILED)
+#endif /*AGL_PosixBasedOS001LEGACY_USED*/
+
+#define EOK 0
+
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+#define agl_io_in32(_x) *(volatile unsigned long *)(_x)
+#define agl_io_out32(_x, _y) {*(volatile unsigned long *)((void*)(_x)) = (_y);}
+#endif /*AGL_PosixBasedOS001LEGACY_USED*/
+
+
+
+#define __AGLDD_TYPEDEF_I64
+typedef int64_t i64; /* 8-byte signed integer */
+
+#define __AGLDD_TYPEDEF_U64
+typedef uint64_t u64; /* 8-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_U32
+typedef uint32_t u32; /* 4-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_U16
+typedef uint16_t u16; /* 2-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_I16
+typedef int16_t i16; /* 2-byte signed integer */
+
+#define __AGLDD_TYPEDEF_U8
+typedef uint8_t u8; /* 1-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_I8
+typedef int8_t i8; /* 1-byte signed integer */
+
+#define __AGLDD_TYPEDEF_INT8
+typedef int8_t INT8;
+
+#define __AGLDD_TYPEDEF_INT16
+typedef int16_t INT16;
+
+#define __AGLDD_TYPEDEF_INT32
+typedef int32_t INT32;
+
+#define __AGLDD_TYPEDEF_INT64
+typedef int64_t INT64;
+
+#define __AGLDD_TYPEDEF_UINT8
+typedef uint8_t UINT8;
+
+#define __AGLDD_TYPEDEF_UINT16
+typedef uint16_t UINT16;
+
+#define __AGLDD_TYPEDEF_UINT32
+typedef uint32_t UINT32;
+
+#define __AGLDD_TYPEDEF_UINT64
+typedef uint64_t UINT64;
+
+#ifndef __KERNEL__
+#if !defined __WIN_TYPEDEF_BOOL
+#define __AGLDD_TYPEDEF_BOOL
+typedef uint32_t BOOL;
+#endif
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+// AGL ASSERT MACRO
+#ifdef AGL_ASSERT_ON
+#define AGL_ASSERT_NOT_TESTED() \
+do {fprintf(stderr, "[%s][%s][%s:%d]AGL_ASSERT_NOT_TESTED.\n", \
+ program_invocation_short_name, __func__, __FILE__, __LINE__);} while(0)
+#else
+#define AGL_ASSERT_NOT_TESTED() \
+do {} while(0)
+#endif
+#endif /* _AGL_TYPES_OBSOLUTED_H_ */
diff --git a/video_in_hal/agl-basefiles/include/agl_wakeup_order.h b/video_in_hal/agl-basefiles/include/agl_wakeup_order.h
new file mode 100644
index 0000000..006f1bc
--- /dev/null
+++ b/video_in_hal/agl-basefiles/include/agl_wakeup_order.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _AGL_WAKEUP_ORDER_H_
+#define _AGL_WAKEUP_ORDER_H_
+
+//This header define Wakeup Order Name
+//The max string length is 31
+
+#define WON_DEFAULT "DEFAULT"
+
+#endif
+
+
diff --git a/video_in_hal/agl-basefiles/include/aglpath.h b/video_in_hal/agl-basefiles/include/aglpath.h
new file mode 100644
index 0000000..e278fbf
--- /dev/null
+++ b/video_in_hal/agl-basefiles/include/aglpath.h
@@ -0,0 +1,200 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * common path
+ */
+
+/* This definitions are matched as following document.
+ * eMMC Partition Specification V1.28
+ */
+
+#ifndef _AGL_PATH_H_
+#define _AGL_PATH_H_
+
+/* Common path */
+
+#define PF_ROOT "/"
+#define PF_NV PF_ROOT"nv/"
+#define PF_VAR PF_ROOT"var/"
+#define PF_TMP PF_ROOT"tmp/"
+#define PF_USR PF_ROOT"usr/"
+#define PF_MNT PF_ROOT"mnt/"
+#define PF_RAMD PF_ROOT"ramd/"
+#define PF_ENVPARAM PF_ROOT"env_param/"
+#define PF_NVSYSTEM PF_ROOT"nv_system/"
+
+#define PF_SHM PF_TMP"shm/"
+#define PF_SHARE PF_USR"share/"
+#define PF_P_SHARE PF_USR"agl/share/"
+
+#define PF_SYS_BS PF_NVSYSTEM"sys_bs/"
+
+#define PF_SYS_BACKUP PF_NV"backup/"
+#define PF_SYS_NPP PF_NV"npp/"
+
+#define PF_NV_REPRO PF_NV"repro/"
+#define PF_NV_LOG PF_NV"log/"
+#define PF_NV_VUI PF_NV"vui/"
+#define PF_NV_NAVI PF_NV"navi/"
+#define PF_NV_TFF PF_NV"tff/"
+#define PF_NV_FULLBROWSER PF_NV"fullbrowser/"
+#define PF_NV__CWORD8_ PF_NV"_CWORD8_/"
+#define PF_NV_MANUAL PF_NV"manual/"
+#define PF_NV_LOG2 PF_NV"log2/"
+#define PF_NV_PTDATA PF_NV"ptdata/"
+
+#define PF_NV_NORACCESS PF_NV_PTDATA"noraccess/"
+#define PF_NV_SEC PF_NV_PTDATA"sec/"
+#define PF_NVPT_GRAPHICS PF_NV_PTDATA"graphics/"
+#define PF_NVPT_HMI PF_NV_PTDATA"hmi/"
+#define PF_NVPT_VEHICLE PF_NV_PTDATA"vehicle/"
+#define PF_NVPT_CONNECTIVITY PF_NV_PTDATA"connectivity/"
+#define PF_NVPT_WLAN PF_NV_PTDATA"wlan/"
+#define PF_NVPT_SI PF_NV_PTDATA"si/"
+
+#define PF_NVLOG_AGLLOG PF_NV_LOG"agllog/"
+#define PF_NVLOG_WORK PF_NV_LOG"work/"
+#define PF_NVLOG_AWLOG PF_NV_LOG2"awlog/"
+#define PF_NVLOG_CORE PF_NV_LOG2"core/"
+
+
+/* Component domain */
+
+#define DOM_GRAPHICS "graphics"
+#define DOM_SOUND "sound"
+#define DOM_NS_STORAGE "ns_storage"
+#define DOM_NS_IMAGESTORAGE "ns_imagestorage"
+#define DOM_BS "bs"
+#define DOM__CWORD24_ "_CWORD24_"
+#define DOM_HMI "hmi"
+#define DOM_WLAN "wlan"
+#define DOM_BT "bt"
+#define DOM_CINEMO "cinemo"
+#define DOM_MEDIASRV "mediasrv"
+#define DOM_CONTENTMGR "contentmgr"
+#define DOM_USBAUDIO "usbaudio"
+#define DOM_CDDVD "cddvd"
+#define DOM_AV "av"
+#define DOM_DATASRV "datasrv"
+#define DOM_RADIO "radio"
+#define DOM_BTOOTH "Bluetooth"
+#define DOM__CWORD57_ "_CWORD57_"
+#define DOM_REMOTESERVICE "remoteservice"
+#define DOM_CONNECTIVITY "connectivity"
+#define DOM_NAVIGATION "navigation"
+#define DOM_VEHICLE "vehicle"
+#define DOM_ROMACCESS "romaccess"
+#define DOM_AUDIOMGR "audiomgr"
+#define DOM_BACKUP "backup"
+#define DOM_NPP "npp"
+
+#define DOM_DCMSERVICE "dcmservice"
+#define DOM_NETWORKMANAGER "NetworkManager"
+
+/* Others */
+#define DOM_AGLLOG "agllog"
+#define DOM_AWLOG "awlog"
+#define DOM_WORK "work"
+#define DOM_CORE "core"
+
+#define DOM_NORACCESS "noraccess"
+#define DOM_SEC "sec"
+#define DOM_DIAG "diag"
+
+
+/* For WebDAV */
+
+#define PF_EXP_INTR PF_NV"export/Internal/"
+#define PF_EXPINT_AUDIO PF_EXP_INTR"Audio/"
+#define PF_EXPINT_DATASERV PF_EXP_INTR"DataService/"
+#define PF_EXPINT_SCREENCAP PF_EXP_INTR"ScreenCapture/"
+#define PF_EXPINT_REPRO PF_EXP_INTR"Repro/"
+#define PF_EXPINT_VEHICLEINFO PF_EXP_INTR"VehicleInfoDraw/"
+#define PF_EXPINT_VEHICLEPARA PF_EXP_INTR"VehicleParameter/"
+#define PF_EXPINT_VR PF_EXP_INTR"VR/"
+#define PF_EXPINT_NAVI PF_EXP_INTR"Navi/"
+#define PF_EXPINT_TFF PF_EXP_INTR"TFF/"
+#define PF_EXPINT_OSS PF_EXP_INTR"OSS/"
+#define PF_EXPINT_SMARTPHONE PF_EXP_INTR"Smartphone/"
+
+/* For RAMD */
+#define PF_RAMD_LOG PF_RAMD"log/"
+#define PF_RAMD_BKUP PF_RAMD"bkup/"
+
+#define PF_RAMD_AWLOG PF_RAMD_LOG"awlog/"
+#define PF_RAMD_AGLLOG PF_RAMD_LOG"agllog/"
+
+#define PF_RAMD_COMMUNICATION PF_RAMD_AGLLOG"communication/"
+#define PF_RAMD_RADIO PF_RAMD_AGLLOG"radio/"
+#define PF_RAMD_CONNECTIVITY PF_RAMD_AGLLOG"connectivity/"
+#define PF_RAMD_DIAG PF_RAMD_AGLLOG"diag/"
+#define PF_RAMD_SYSLOG PF_RAMD_AGLLOG"syslog/"
+#define PF_RAMD_APPFW PF_RAMD_AGLLOG"appfw/"
+
+
+
+/* For Loopback */
+#define PF_MNTLOOP PF_ROOT"mnt_loop/"
+
+#define PF_MNTLOOP_AW0 PF_MNTLOOP"loopaw0/"
+#define PF_MNTLOOP_AW1 PF_MNTLOOP"loopaw1/"
+#define PF_MNTLOOP_AW2 PF_MNTLOOP"loopaw2/"
+#define PF_MNTLOOP_AW3 PF_MNTLOOP"loopaw3/"
+#define PF_MNTLOOP_AW4 PF_MNTLOOP"loopaw4/"
+#define PF_MNTLOOP_AW5 PF_MNTLOOP"loopaw5/"
+#define PF_MNTLOOP_AW6 PF_MNTLOOP"loopaw6/"
+#define PF_MNTLOOP_AW7 PF_MNTLOOP"loopaw7/"
+#define PF_MNTLOOP_AW8 PF_MNTLOOP"loopaw8/"
+#define PF_MNTLOOP_AW9 PF_MNTLOOP"loopaw9/"
+#define PF_MNTLOOP_AW10 PF_MNTLOOP"loopaw10/"
+#define PF_MNTLOOP_AW11 PF_MNTLOOP"loopaw11/"
+#define PF_MNTLOOP_AW12 PF_MNTLOOP"loopaw12/"
+#define PF_MNTLOOP_AW13 PF_MNTLOOP"loopaw13/"
+#define PF_MNTLOOP_AW14 PF_MNTLOOP"loopaw14/"
+#define PF_MNTLOOP_AW15 PF_MNTLOOP"loopaw15/"
+#define PF_MNTLOOP_AW16 PF_MNTLOOP"loopaw16/"
+#define PF_MNTLOOP_AW17 PF_MNTLOOP"loopaw17/"
+#define PF_MNTLOOP_AW18 PF_MNTLOOP"loopaw18/"
+#define PF_MNTLOOP_AW19 PF_MNTLOOP"loopaw19/"
+#define PF_MNTLOOP_AW20 PF_MNTLOOP"loopaw20/"
+
+/* For Tmpfs mount */
+#define PF_MNTTMPFS PF_ROOT"mnt_tmpfs/"
+#define PF_MNTTMPFS_AW0 PF_MNTTMPFS"tmpfsaw0/"
+
+
+/* DONT USE FOLLOWING DEFINITION !! */
+/* These will be deleted in the future */
+
+#define PF_NV_P3 PF_NV"p3/"
+#define PF_NV_P4 PF_NV"p4/"
+#define PF_NV_P5 PF_NV"p5/"
+#define PF_NV_P6 PF_NV"p6/"
+
+#define PF_NPP PF_NV_P3"npp/"
+#define PF_BS PF_NV_P3"bs/"
+
+#define DOM__CWORD8_ "_CWORD8_"
+#define DOM_BLUETOOTH "bluetooth"
+#define DOM_VR "vr"
+#define DOM_ENTUNE "entune"
+
+#define PF_RAMD_GRAPHICS PF_RAMD_BKUP"graphics/"
+
+#define PF_EXPINT_TRAFFIC PF_EXP_INTR"Traffic/"
+
+#endif/* _AGL_PATH_H_ */
diff --git a/video_in_hal/agl-basefiles/include/sm_launch_conf.h b/video_in_hal/agl-basefiles/include/sm_launch_conf.h
new file mode 100644
index 0000000..d444eb0
--- /dev/null
+++ b/video_in_hal/agl-basefiles/include/sm_launch_conf.h
@@ -0,0 +1,1385 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AGL_THREAD_H__
+#define __AGL_THREAD_H__
+
+//MACRO
+#define PR_TSS_S "0"
+#define PR_TSS 0
+
+/*
+ Main thread name. It need to be same as service name in sm_launch.xml or tskm_launch.xml
+ Max name length is 15
+ #define MN_XXXXX "MainName"
+
+ Thread name
+ Max name length is 15
+ #define TN_XXXXX "ThreadName"
+
+ Thread priority 0:TSS 1-99:FIFO
+ #define PR_XXXXX_S "(0-99)" //for xml
+ #define PR_XXXXX 0-99 //for program
+*/
+
+#define MN_SS_SYSMANAGER "SS_SysManager"
+#define PR_SS_SYSMANAGER_S "0"
+#define PR_SS_SYSMANAGER (0)
+
+ #define TN_SMHEARTBEAT "SM.Heartbeat"
+ #define PR_SMHEARTBEAT_S "0"
+ #define PR_SMHEARTBEAT (0)
+
+ #define TN_SMPROCLAUNCH "SM.ProcLaunch"
+ #define PR_SMPROCLAUNCH_S "0"
+ #define PR_SMPROCLAUNCH (0)
+
+ #define TN_SMLOWMEMMON "SM.LowMemMon"
+ #define PR_SMLOWMEMMON_S "0"
+ #define PR_SMLOWMEMMON (0)
+
+ #define TN_LOGGERRTIME "LoggerRtime"
+ #define PR_LOGGERRTIME_S PR_TSS_S
+ #define PR_LOGGERRTIME PR_TSS
+
+
+//======= exec from system manager =============
+#define MN_NS_SHAREDMEM "NS_SharedMem"
+#define PR_NS_SHAREDMEM_S "0"
+#define PR_NS_SHAREDMEM (0)
+
+
+#define MN_NS_NPPSERVICE "NS_NPPService"
+#define PR_NS_NPPSERVICE_S "0"
+#define PR_NS_NPPSERVICE (0)
+
+ #define TN_NS_NPPREADWKR "NS_NPPReadWkr"
+ #define PR_NS_NPPREADWKR_S "0"
+ #define PR_NS_NPPREADWKR (0)
+
+ #define TN_NS_NPPWRITEWKR "NS_NPPWriteWkr"
+ #define PR_NS_NPPWRITEWKR_S "0"
+ #define PR_NS_NPPWRITEWKR (0)
+
+ #define TN_NS_NPPIPWKR "NS_NPPIPWkr"
+ #define PR_NS_NPPIPWKR_S "0"
+ #define PR_NS_NPPIPWKR (0)
+
+#define MN_NS_BACKUPMGR "NS_BackupMgr"
+#define PR_NS_BACKUPMGR_S "0"
+#define PR_NS_BACKUPMGR (0)
+
+ #define TN_NS_BKUPNAND "NS_BkupNAND"
+ #define PR_NS_BKUPNAND_S "0"
+ #define PR_NS_BKUPNAND (0)
+
+ #define TN_NS_BKUPDELAY "NS_BkupDelay"
+ #define PR_NS_BKUPDELAY_S "0"
+ #define PR_NS_BKUPDELAY (0)
+
+#define MN_SS_DEVDETECTSRV "SS_DevDetectSrv"
+#define PR_SS_DEVDETECTSRV_S "0"
+#define PR_SS_DEVDETECTSRV (0)
+
+ #define TN_SS_DETECT_USB "SS_Detect_USB"
+ #define PR_SS_DETECT_USB_S "0"
+ #define PR_SS_DETECT_USB (0)
+
+ #define TN_SS_DETECT_SD "SS_Detect_SD"
+ #define PR_SS_DETECT_SD_S "0"
+ #define PR_SS_DETECT_SD (0)
+
+ #define TN_SS_MONITOR_OVC "SS_Monitor_OVC"
+ #define PR_SS_MONITOR_OVC_S "0"
+ #define PR_SS_MONITOR_OVC (0)
+
+#define MN_SS_LOGGERSRV "SS_LoggerSrv"
+#define PR_SS_LOGGERSRV_S PR_TSS_S
+#define PR_SS_LOGGERSRV PR_TSS
+
+ #define TN_PDGLOGQUER "pdg.LogQueR"
+ #define PR_PDGLOGQUER_S PR_TSS_S
+ #define PR_PDGLOGQUER PR_TSS
+
+ #define TN_PDGTRANSQUER "pdg.TransQueR"
+ #define PR_PDGTRANSQUER_S PR_TSS_S
+ #define PR_PDGTRANSQUER PR_TSS
+
+ #define TN_PDGEVNTLOGQUE "pdg.EvntLogQue"
+ #define PR_PDGEVNTLOGQUE_S PR_TSS_S
+ #define PR_PDGEVNTLOGQUE PR_TSS
+
+ #define TN_SSLOGGERSTRAGE "SSLoggerStrage"
+ #define PR_SSLOGGERSTRAGE_S PR_TSS_S
+ #define PR_SSLOGGERSTRAGE PR_TSS
+
+ #define TN_PFDRECTHREAD "PFDRECThread"
+ #define PR_PFDRECTHREAD_S PR_TSS_S
+ #define PR_PFDRECTHREAD PR_TSS
+
+#define MN_PS_LOGGERSHADOW "PS_LoggerShadow"
+ #define PR_PSLOGGERSHADOW_S PR_TSS_S
+ #define PR_PSLOGGERSHADOW PR_TSS
+
+#define MN_UDEVD "udevd"
+#define PR_UDEVD_S "1"
+#define PR_UDEVD (1)
+
+#define MN_COMMUNICATION "Communication"
+#define PR_COMMUNICATION_S "0"
+#define PR_COMMUNICATION (0)
+
+ #define TN_DEV_SYSCOM_TMR "DEV_SYSCOM_TMR"
+ #define PR_DEV_SYSCOM_TMR_S "0"
+ #define PR_DEV_SYSCOM_TMR (0)
+
+ #define TN_DEV_SYSCOM_RCV "DEV_SYSCOM_RCV"
+ #define PR_DEV_SYSCOM_RCV_S "0"
+ #define PR_DEV_SYSCOM_RCV (0)
+
+ #define TN_DEV_SYSCOM_MAIN "DEV_SYSCOM_MAIN"
+ #define PR_DEV_SYSCOM_MAIN_S "0"
+ #define PR_DEV_SYSCOM_MAIN (0)
+
+ #define TN_TGWCOM "TGWCOM"
+ #define PR_TGWCOM_S "0"
+ #define PR_TGWCOM (0)
+
+ #define TN__CWORD83_ "_CWORD83_"
+ #define PR__CWORD83__S "0"
+ #define PR__CWORD83_ (0)
+
+ #define TN_CAN_COM_PROT "CAN_COM_PROT"
+ #define PR_CAN_COM_PROT_S "0"
+ #define PR_CAN_COM_PROT (0)
+
+#define MN_PS_PSMSHADOW "PS_PSMShadow"
+#define PR_PS_PSMSHADOW_S "0"
+#define PR_PS_PSMSHADOW (0)
+
+#define MN_COMMSH4A "CommSH4A"
+#define PR_COMMSH4A_S "0"
+#define PR_COMMSH4A (0)
+
+ #define TN_DEV_SH4A_SND "DEV_SH4ACOM_SND"
+ #define PR_DEV_SH4A_SND_S "0"
+ #define PR_DEV_SH4A_SND (0)
+
+ #define TN_DEV_SH4A_RCV "DEV_SH4ACOM_RCV"
+ #define PR_DEV_SH4A_RCV_S "0"
+ #define PR_DEV_SH4A_RCV (0)
+
+ #define TN_DEV_SH4A_MON "DEV_SH4ACOM_MON"
+ #define PR_DEV_SH4A_MON_S "0"
+ #define PR_DEV_SH4A_MON (0)
+
+#define MN_PS_COMMUSB "PS_CommUSB"
+#define PR_PS_COMMUSB_S "0"
+#define PR_PS_COMMUSB (0)
+
+ #define TN_COMMUSB_RCV "COMMUSB_RCV"
+ #define PR_COMMUSB_RCV_S "0"
+ #define PR_COMMUSB_RCV (0)
+
+ #define TN_COMMUSB_DIAG "COMMUSB_DIAG"
+ #define PR_COMMUSB_DIAG_S "0"
+ #define PR_COMMUSB_DIAG (0)
+
+#define MN_PS_CANGW_M "CANGW_M"
+#define PR_PS_CANGW_M_S PR_TSS_S
+#define PR_PS_CANGW_M PR_TSS
+
+ #define TN_CANGW_M_RCV "CANGW_M_RCV"
+ #define PR_CANGW_M_RCV_S PR_TSS_S
+ #define PR_CANGW_M_RCV PR_TSS
+
+ #define TN_CANGW_M_DIAG "CANGW_M_DIAG"
+ #define PR_CANGW_M_DIAG_S PR_TSS_S
+ #define PR_CANGW_M_DIAG PR_TSS
+
+#define MN_PS_CANGW_S "CANGW_S"
+#define PR_PS_CANGW_S_S PR_TSS_S
+#define PR_PS_CANGW_S PR_TSS
+
+ #define TN_CANGW_S_SND "CANGW_S_SND"
+ #define PR_CANGW_S_SND_S PR_TSS_S
+ #define PR_CANGW_S_SND PR_TSS
+
+ #define TN_CANGW_S_DIAG "CANGW_S_DIAG"
+ #define PR_CANGW_S_DIAG_S PR_TSS_S
+ #define PR_CANGW_S_DIAG PR_TSS
+
+#define MN_LANSERVER "LanServer"
+#define PR_LANSERVER_S "0"
+#define PR_LANSERVER (0)
+
+#define MN_PS_CDR "ps_cdr"
+#define PR_PS_CDR_S PR_TSS_S
+#define PR_PS_CDR PR_TSS
+
+ #define TN_PS_CDR_NBD "ps_cdr_nbd"
+ #define PR_PS_CDR_NBD_S PR_TSS_S
+ #define PR_PS_CDR_NBD PR_TSS
+
+ #define TN_PS_CDR_DOIT "ps_cdr_doit"
+ #define PR_PS_CDR_DOIT_S PR_TSS_S
+ #define PR_PS_CDR_DOIT PR_TSS
+
+ #define TN_PS_CDR_READ "ps_cdr_read"
+ #define PR_PS_CDR_READ_S PR_TSS_S
+ #define PR_PS_CDR_READ PR_TSS
+
+#define MN_POSITIONING "Positioning"
+#define PR_POSITIONING_S PR_TSS_S
+#define PR_POSITIONING PR_TSS
+
+ #define TN_POSITIONING_GPS_MAIN "POS_Main"
+ #define PR_POSITIONING_GPS_MAIN_S PR_TSS_S
+ #define PR_POSITIONING_GPS_MAIN PR_TSS
+
+ #define TN_POSITIONING_GPS_RECV "POS_Gps_Recv"
+ #define PR_POSITIONING_GPS_RECV_S PR_TSS_S
+ #define PR_POSITIONING_GPS_RECV PR_TSS
+
+ #define TN_POSITIONING_GPS "POS_Gps"
+ #define PR_POSITIONING_GPS_S PR_TSS_S
+ #define PR_POSITIONING_GPS PR_TSS
+
+ #define TN_POSITIONING_SENS "POS_Sens"
+ #define PR_POSITIONING_SENS_S PR_TSS_S
+ #define PR_POSITIONING_SENS PR_TSS
+
+ #define TN_POSITIONING_GPS_ROLOVR "POS_Gps_Rolovr"
+ #define PR_POSITIONING_GPS_ROLOVR_S PR_TSS_S
+ #define PR_POSITIONING_GPS_ROLOVR PR_TSS
+
+#define MN_CLOCK "clock"
+#define PR_CLOCK_S "0"
+#define PR_CLOCK (0)
+
+ #define TN_CLOCK_MNG "ClockMng"
+ #define PR_CLOCK_MNG_S "0"
+ #define PR_CLOCK_MNG (0)
+
+#define MN_VEHICLE "vehicle"
+#define PR_VEHICLE_S "0"
+#define PR_VEHICLE (0)
+
+ #define TN_VEHICLE_SENS "VehicleSens"
+ #define PR_VEHICLE_SENS_S "0"
+ #define PR_VEHICLE_SENS (0)
+
+ #define TN_LINE_SENS_DRV "LineSensDrv"
+ #define PR_LINE_SENS_DRV_S "0"
+ #define PR_LINE_SENS_DRV (0)
+
+#define MN_SS_POWERSERVICE "SS_PowerService"
+#define PR_SS_POWERSERVICE_S "0"
+#define PR_SS_POWERSERVICE (0)
+
+#define MN_SS_TASKMANAGER "SS_TaskManager"
+#define PR_SS_TASKMANAGER_S "0"
+#define PR_SS_TASKMANAGER (0)
+
+ #define TN_SS_TSKMTIMER "SS_TskmTimer"
+ #define PR_SS_TSKMTIMER_S "0"
+ #define PR_SS_TSKMTIMER (0)
+
+#define MN_SOUND "Sound"
+#define PR_SOUND_S "0"
+#define PR_SOUND (0)
+
+ #define TN_VG_SNDSRCMGR "VG_SNDSRCMGR"
+ #define PR_VG_SNDSRCMGR_S "0"
+ #define PR_VG_SNDSRCMGR (0)
+
+ #define TN_SND_INPUTCTRL "SND_INPUTCTRL"
+ #define PR_SND_INPUTCTRL_S "0"
+ #define PR_SND_INPUTCTRL (0)
+
+ #define TN_SND_DEVCTRL "SND_DEVCTRL"
+ #define PR_SND_DEVCTRL_S "0"
+ #define PR_SND_DEVCTRL (0)
+
+ #define TN_SND_VCETRFCTRL "SND_VCETRFCTRL"
+ #define PR_SND_VCETRFCTRL_S "0"
+ #define PR_SND_VCETRFCTRL (0)
+
+ #define TN_SND_VCETRFWRT1 "SND_VCETRFWRT1"
+ #define PR_SND_VCETRFWRT1_S "0"
+ #define PR_SND_VCETRFWRT1 (0)
+
+ #define TN_SND_VCETRFWRT2 "SND_VCETRFWRT2"
+ #define PR_SND_VCETRFWRT2_S "0"
+ #define PR_SND_VCETRFWRT2 (0)
+
+ #define TN_VG_SNDCTRL_BSCF "VG_SNDCTRL_BSCF"
+ #define PR_VG_SNDCTRL_BSCF_S "0"
+ #define PR_VG_SNDCTRL_BSCF (0)
+
+ #define TN_VG_SNDCTRL_BSCR "VG_SNDCTRL_BSCR"
+ #define PR_VG_SNDCTRL_BSCR_S "0"
+ #define PR_VG_SNDCTRL_BSCR (0)
+
+ #define TN_VG_SNDCTRL_ITRT "VG_SNDCTRL_ITRT"
+ #define PR_VG_SNDCTRL_ITRT_S "0"
+ #define PR_VG_SNDCTRL_ITRT (0)
+
+ #define TN_CVRS_OPRT_OUT_1 "CVRS_OPRT_OUT_1"
+ #define PR_CVRS_OPRT_OUT_1_S "0"
+ #define PR_CVRS_OPRT_OUT_1 (0)
+
+ #define TN_CVRS_OPRT_OUT_2 "CVRS_OPRT_OUT_2"
+ #define PR_CVRS_OPRT_OUT_2_S "0"
+ #define PR_CVRS_OPRT_OUT_2 (0)
+
+ #define TN_CVRS_OPRT_OUT_3 "CVRS_OPRT_OUT_3"
+ #define PR_CVRS_OPRT_OUT_3_S "0"
+ #define PR_CVRS_OPRT_OUT_3 (0)
+
+ #define TN_CVRS_OPRT_OUT_4 "CVRS_OPRT_OUT_4"
+ #define PR_CVRS_OPRT_OUT_4_S "0"
+ #define PR_CVRS_OPRT_OUT_4 (0)
+
+ #define TN_CVRS_OPRT_IN_1 "CVRS_OPRT_IN_1"
+ #define PR_CVRS_OPRT_IN_1_S "0"
+ #define PR_CVRS_OPRT_IN_1 (0)
+
+ #define TN_CVRS_OPRT_IN_2 "CVRS_OPRT_IN_2"
+ #define PR_CVRS_OPRT_IN_2_S "0"
+ #define PR_CVRS_OPRT_IN_2 (0)
+
+ #define TN_CVRS_OPRT_IN_3 "CVRS_OPRT_IN_3"
+ #define PR_CVRS_OPRT_IN_3_S "0"
+ #define PR_CVRS_OPRT_IN_3 (0)
+
+ #define TN_CVRS_OPRT_IN_4 "CVRS_OPRT_IN_4"
+ #define PR_CVRS_OPRT_IN_4_S "0"
+ #define PR_CVRS_OPRT_IN_4 (0)
+
+ #define TN_CVRS_OPRT_IN_5 "CVRS_OPRT_IN_5"
+ #define PR_CVRS_OPRT_IN_5_S "0"
+ #define PR_CVRS_OPRT_IN_5 (0)
+
+ #define TN_CVRS_OPRT_IN_6 "CVRS_OPRT_IN_6"
+ #define PR_CVRS_OPRT_IN_6_S "0"
+ #define PR_CVRS_OPRT_IN_6 (0)
+
+ #define TN_CVRS_OPRT_IN_7 "CVRS_OPRT_IN_7"
+ #define PR_CVRS_OPRT_IN_7_S "0"
+ #define PR_CVRS_OPRT_IN_7 (0)
+
+ #define TN_CVRS_OPRT_IN_8 "CVRS_OPRT_IN_8"
+ #define PR_CVRS_OPRT_IN_8_S "0"
+ #define PR_CVRS_OPRT_IN_8 (0)
+
+ #define TN_CVRS_OPRT_BS_I "CVRS_OPRT_BS_I"
+ #define PR_CVRS_OPRT_BS_I_S "0"
+ #define PR_CVRS_OPRT_BS_I (0)
+
+ #define TN_VR_NVR_RECO "VR_NVR_RECO"
+ #define PR_VR_NVR_RECO_S "0"
+ #define PR_VR_NVR_RECO (0)
+
+ #define TN_SND_ECNR "SND_ECNR"
+ #define PR_SND_ECNR_S "0"
+ #define PR_SND_ECNR (0)
+
+ #define TN_SNDAGENT_000 "SNDAGENT_000"
+ #define PR_SNDAGENT_000_S "0"
+ #define PR_SNDAGENT_000 (0)
+
+ #define TN_SNDAGENT_001 "SNDAGENT_001"
+ #define PR_SNDAGENT_001_S "0"
+ #define PR_SNDAGENT_001 (0)
+
+ #define TN_SNDAGENT_002 "SNDAGENT_002"
+ #define PR_SNDAGENT_002_S "0"
+ #define PR_SNDAGENT_002 (0)
+
+ #define TN_SNDAGENT_003 "SNDAGENT_003"
+ #define PR_SNDAGENT_003_S "0"
+ #define PR_SNDAGENT_003 (0)
+
+ #define TN_SNDAGENT_004 "SNDAGENT_004"
+ #define PR_SNDAGENT_004_S "0"
+ #define PR_SNDAGENT_004 (0)
+
+ #define TN_SNDAGENT_005 "SNDAGENT_005"
+ #define PR_SNDAGENT_005_S "0"
+ #define PR_SNDAGENT_005 (0)
+
+ #define TN_SNDAGENT_006 "SNDAGENT_006"
+ #define PR_SNDAGENT_006_S "0"
+ #define PR_SNDAGENT_006 (0)
+
+ #define TN_SNDAGENT_007 "SNDAGENT_007"
+ #define PR_SNDAGENT_007_S "0"
+ #define PR_SNDAGENT_007 (0)
+
+ #define TN_SNDAGENT_008 "SNDAGENT_008"
+ #define PR_SNDAGENT_008_S "0"
+ #define PR_SNDAGENT_008 (0)
+
+ #define TN_SNDAGENT_009 "SNDAGENT_009"
+ #define PR_SNDAGENT_009_S "0"
+ #define PR_SNDAGENT_009 (0)
+
+ #define TN_SNDAGENT_010 "SNDAGENT_010"
+ #define PR_SNDAGENT_010_S "0"
+ #define PR_SNDAGENT_010 (0)
+
+ #define TN_SNDAGENT_011 "SNDAGENT_011"
+ #define PR_SNDAGENT_011_S "0"
+ #define PR_SNDAGENT_011 (0)
+
+ #define TN_SNDAGENT_012 "SNDAGENT_012"
+ #define PR_SNDAGENT_012_S "0"
+ #define PR_SNDAGENT_012 (0)
+
+ #define TN_SNDAGENT_013 "SNDAGENT_013"
+ #define PR_SNDAGENT_013_S "0"
+ #define PR_SNDAGENT_013 (0)
+
+ #define TN_SNDAGENT_014 "SNDAGENT_014"
+ #define PR_SNDAGENT_014_S "0"
+ #define PR_SNDAGENT_014 (0)
+
+ #define TN_SNDAGENT_015 "SNDAGENT_015"
+ #define PR_SNDAGENT_015_S "0"
+ #define PR_SNDAGENT_015 (0)
+
+ #define TN_SNDAGENT_016 "SNDAGENT_016"
+ #define PR_SNDAGENT_016_S "0"
+ #define PR_SNDAGENT_016 (0)
+
+ #define TN_SNDAGENT_017 "SNDAGENT_017"
+ #define PR_SNDAGENT_017_S "0"
+ #define PR_SNDAGENT_017 (0)
+
+ #define TN_SNDAGENT_018 "SNDAGENT_018"
+ #define PR_SNDAGENT_018_S "0"
+ #define PR_SNDAGENT_018 (0)
+
+ #define TN_SNDAGENT_019 "SNDAGENT_019"
+ #define PR_SNDAGENT_019_S "0"
+ #define PR_SNDAGENT_019 (0)
+
+ #define TN_SNDAGENT_020 "SNDAGENT_020"
+ #define PR_SNDAGENT_020_S "0"
+ #define PR_SNDAGENT_020 (0)
+
+ #define TN_SNDAGENT_021 "SNDAGENT_021"
+ #define PR_SNDAGENT_021_S "0"
+ #define PR_SNDAGENT_021 (0)
+
+ #define TN_SNDAGENT_022 "SNDAGENT_022"
+ #define PR_SNDAGENT_022_S "0"
+ #define PR_SNDAGENT_022 (0)
+
+ #define TN_SNDAGENT_023 "SNDAGENT_023"
+ #define PR_SNDAGENT_023_S "0"
+ #define PR_SNDAGENT_023 (0)
+
+ #define TN_SNDAGENT_024 "SNDAGENT_024"
+ #define PR_SNDAGENT_024_S "0"
+ #define PR_SNDAGENT_024 (0)
+
+ #define TN_SNDAGENT_025 "SNDAGENT_025"
+ #define PR_SNDAGENT_025_S "0"
+ #define PR_SNDAGENT_025 (0)
+
+#define MN_SS_RESOURCEMGR "SS_ResourceMgr"
+#define PR_SS_RESOURCEMGR_S "0"
+#define PR_SS_RESOURCEMGR (0)
+
+ #define TN_RESOURCEHWDT "ResourceHWDT"
+ #define PR_RESOURCEHWDT_S "0"
+ #define PR_RESOURCEHWDT (0)
+
+#define MN_AS_AUDIOMANAGER "AS_AudioManager"
+#define PR_AS_AUDIOMANAGER_S PR_TSS_S
+#define PR_AS_AUDIOMANAGER PR_TSS
+
+ #define TN_AS_SOUNDBEEP "AS_SoundBeep"
+ #define PR_AS_SOUNDBEEP_S PR_TSS_S
+ #define PR_AS_SOUNDBEEP PR_TSS
+
+#define MN_GRAPHICS "Graphics"
+#define PR_GRAPHICS_S "0"
+#define PR_GRAPHICS (0)
+
+ #define TN_GR_MAIN_CTRL "Graphics_main"
+ #define PR_GR_MAIN_CTRL_S PR_TSS_S
+ #define PR_GR_MAIN_CTRL PR_TSS
+
+ #define TN_GR_SEQ_CTRL "Graphics_seq"
+ #define PR_GR_SEQ_CTRL_S PR_TSS_S
+ #define PR_GR_SEQ_CTRL PR_TSS
+
+ #define TN_GR_DEV_RCV_CTRL "Graphics_rcv"
+ #define PR_GR_DEV_RCV_CTRL_S PR_TSS_S
+ #define PR_GR_DEV_RCV_CTRL PR_TSS
+
+ #define TN_GR_VCAP1_CTRL "Graphics_cap1"
+ #define PR_GR_VCAP1_CTRL_S "0"
+ #define PR_GR_VCAP1_CTRL (0)
+
+ #define TN_GR_VCAP2_CTRL "Graphics_cap2"
+ #define PR_GR_VCAP2_CTRL_S "0"
+ #define PR_GR_VCAP2_CTRL (0)
+
+#define MN_VUPSERVICE "vupservice"
+#define PR_VUPSERVICE_S PR_TSS_S
+#define PR_VUPSERVICE PR_TSS
+
+#define MN_SS_UPDATESERVICE "UpdateService"
+#define PR_SS_UPDATESERVICE_S PR_TSS_S
+#define PR_SS_UPDATESERVICE PR_TSS
+
+ #define TN_UPSERVICE_VERI "t_update_veri"
+ #define PR_UPSERVICE_VERI_S PR_TSS_S
+ #define PR_UPSERVICE_VERI PR_TSS
+
+#define MN_NW_MICSERVICE "NW_MicService"
+#define PR_NW_MICSERVICE_S PR_TSS_S
+#define PR_NW_MICSERVICE PR_TSS
+
+#define MN_NS_LOCKMGR "LockMgr"
+#define PR_NS_LOCKMGR_S PR_TSS_S
+#define PR_NS_LOCKMGR PR_TSS
+
+#define MN_PS_SWITCHHANDLER "SwitchHandler"
+#define PR_PS_SWITCHHANDLER_S "0"
+#define PR_PS_SWITCHHANDLER (0)
+
+#define MN_SS_WINSYS "SS_WinSys"
+#define PR_SS_WINSYS_S "0"
+#define PR_SS_WINSYS 0
+
+#define MN_MODEMANAGER "modemanager"
+#define PR_MODEMANAGER_S PR_TSS_S
+#define PR_MODEMANAGER PR_TSS
+
+#define MN_BTSTACKMAIN "btstackmain"
+#define PR_BTSTACKMAIN_S PR_TSS_S
+#define PR_BTSTACKMAIN PR_TSS
+
+#define MN_MEDIASERVICE "MediaService"
+#define PR_MEDIASERVICE_S PR_TSS_S
+#define PR_MEDIASERVICE PR_TSS
+
+// REPRO START
+#define MN_REPROSERVICE "ReproService"
+#define PR_REPROSERVICE_S PR_TSS_S
+#define PR_REPROSERVICE PR_TSS
+
+ #define TN_REPROSEQUENCER "RPRS_Sequencer"
+ #define PR_REPROSEQUENCER_S PR_TSS_S
+ #define PR_REPROSEQUENCER PR_TSS
+
+ #define TN_REPROCTRL "RPRS_Control"
+ #define PR_REPROCTRL_S PR_TSS_S
+ #define PR_REPROCTRL PR_TSS
+
+ #define TN_REPROCENTERCOMM "RPRS_CenterComm"
+ #define PR_REPROCENTERCOMM_S PR_TSS_S
+ #define PR_REPROCENTERCOMM PR_TSS
+
+ #define TN_REPROUNITCOMM "RPRS_UnitComm"
+ #define PR_REPROUNITCOMM_S PR_TSS_S
+ #define PR_REPROUNITCOMM PR_TSS
+
+ #define TN_REPROWEBDAVMGR "RPRS_WebDAVMgr"
+ #define PR_REPROWEBDAVMGR_S PR_TSS_S
+ #define PR_REPROWEBDAVMGR PR_TSS
+
+#define MN_REPROAENDTEST "Repro_Testpro_Sender"
+#define PR_REPROAENDTEST_S PR_TSS_S
+#define PR_REPROAENDTEST PR_TSS
+
+ #define TN_REPROAENDTESTTN "Repro_TestproT"
+ #define PR_REPROAENDTESTTN_S PR_TSS_S
+ #define PR_REPROAENDTESTTN PR_TSS
+
+#define MN_REPROBACKVUP "BackVupCtrl"
+#define PR_REPROBACKVUP_S PR_TSS_S
+#define PR_REPROBACKVUP PR_TSS
+
+#define MN_REPRODEVELOP "DevReproService"
+#define PR_REPRODEVELOP_S PR_TSS_S
+#define PR_REPRODEVELOP PR_TSS
+// REPRO END
+
+ #define TN_MED_MMCOM_PLAY "mmcom_play"
+ #define PR_MED_MMCOM_PLAY_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAY PR_TSS
+
+ #define TN_MED_MMCOM_MEDIA "mmcom_media"
+ #define PR_MED_MMCOM_MEDIA_S PR_TSS_S
+ #define PR_MED_MMCOM_MEDIA PR_TSS
+
+ #define TN_MED_MMCOM_DB "mmcom_db"
+ #define PR_MED_MMCOM_DB_S PR_TSS_S
+ #define PR_MED_MMCOM_DB PR_TSS
+
+ #define TN_MED_MMCOM_LIST "mmcom_list"
+ #define PR_MED_MMCOM_LIST_S PR_TSS_S
+ #define PR_MED_MMCOM_LIST PR_TSS
+
+ #define TN_MED_MMCOM_DBUSB "mmcom_dbusb"
+ #define PR_MED_MMCOM_DBUSB_S PR_TSS_S
+ #define PR_MED_MMCOM_DBUSB PR_TSS
+
+ #define TN_MED_MMCOM_DBSD "mmcom_dbsd"
+ #define PR_MED_MMCOM_DBSD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBSD PR_TSS
+
+ #define TN_MED_MMCOM_DBCD "mmcom_dbcd"
+ #define PR_MED_MMCOM_DBCD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBCD PR_TSS
+
+ #define TN_MED_MMCOM_PLAYRCV "mmcom_playrcv"
+ #define PR_MED_MMCOM_PLAYRCV_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAYRCV PR_TSS
+
+ #define TN_MED_RIPCOM_MNG "MngRipComm"
+ #define PR_MED_RIPCOM_MNG_S PR_TSS_S
+ #define PR_MED_RIPCOM_MNG PR_TSS
+
+ #define TN_MED_RIPCOM_EXE01 "ExeRipComm01"
+ #define PR_MED_RIPCOM_EXE01_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE01 PR_TSS
+
+ #define TN_MED_RIPCOM_EXE02 "ExeRipComm02"
+ #define PR_MED_RIPCOM_EXE02_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE02 PR_TSS
+
+ #define TN_MED_DISCCOM_MAIN "disccom_main"
+ #define PR_MED_DISCCOM_MAIN_S PR_TSS_S
+ #define PR_MED_DISCCOM_MAIN PR_TSS
+
+ #define TN_MED_DISCCOM_DB "disccom_db"
+ #define PR_MED_DISCCOM_DB_S PR_TSS_S
+ #define PR_MED_DISCCOM_DB PR_TSS
+
+#define MN_PLAYBACKSERVICE "PlaybackService"
+#define PR_PLAYBACKSERVICE_S PR_TSS_S
+#define PR_PLAYBACKSERVICE PR_TSS
+
+ #define TN_PLAYSRV_AUDIO "playsrv_audio"
+ #define PR_PLAYSRV_AUDIO_S PR_TSS_S
+ #define PR_PLAYSRV_AUDIO PR_TSS
+
+ #define TN_PLAYSRV_RIP "playsrv_rip"
+ #define PR_PLAYSRV_RIP_S PR_TSS_S
+ #define PR_PLAYSRV_RIP PR_TSS
+
+ #define TN_PLAYSRV_PLAY "playsrv_play"
+ #define PR_PLAYSRV_PLAY_S PR_TSS_S
+ #define PR_PLAYSRV_PLAY PR_TSS
+
+ #define TN_PLAYSRV_DISC "playsrv_disc"
+ #define PR_PLAYSRV_DISC_S PR_TSS_S
+ #define PR_PLAYSRV_DISC PR_TSS
+
+ #define TN_PLAYSRV_ARTWORK "playsrv_artwork"
+ #define PR_PLAYSRV_ARTWORK_S PR_TSS_S
+ #define PR_PLAYSRV_ARTWORK PR_TSS
+
+#define MN_DISCSERVICE "DiscService"
+#define PR_DISCSERVICE_S PR_TSS_S
+#define PR_DISCSERVICE PR_TSS
+
+#define MN_RADIOSERVICE "RadioService"
+#define PR_RADIOSERVICE_S PR_TSS_S
+#define PR_RADIOSERVICE PR_TSS
+
+#define MN_RADIOHDARBITER "RadioHDArbiter"
+#define PR_RADIOHDARBITER_S "0"
+#define PR_RADIOHDARBITER (0)
+
+#define MN_HRDS_MANAGER "hrds_manager"
+#define PR_HRDS_MANAGER_S PR_TSS_S
+#define PR_HRDS_MANAGER PR_TSS
+
+ #define TN_HRDS_HDMNG "hrds_hdmng"
+ #define PR_HRDS_HDMNG_S PR_TSS_S
+ #define PR_HRDS_HDMNG PR_TSS
+
+ #define TN_HRDS_HDDEC "hrds_hddec"
+ #define PR_HRDS_HDDEC_S PR_TSS_S
+ #define PR_HRDS_HDDEC PR_TSS
+
+ #define TN_HRDS_WEBMNG "hrds_webmng"
+ #define PR_HRDS_WEBMNG_S PR_TSS_S
+ #define PR_HRDS_WEBMNG PR_TSS
+
+ #define TN_HRDS_WEBCOM "hrds_webcom"
+ #define PR_HRDS_WEBCOM_S PR_TSS_S
+ #define PR_HRDS_WEBCOM PR_TSS
+
+#define MN_BT_CONNECTIONSERVICE "BT_CnctSrv"
+#define PR_BT_CONNECTIONSERVICE_S PR_TSS_S
+#define PR_BT_CONNECTIONSERVICE PR_TSS
+
+#define MN_BT_PHONESERVICE "BT_PhoneSrv"
+#define PR_BT_PHONESERVICE_S PR_TSS_S
+#define PR_BT_PHONESERVICE PR_TSS
+
+#define MN_BT_PHONEBOOKSERVICE "BT_PbkSrv"
+#define PR_BT_PHONEBOOKSERVICE_S PR_TSS_S
+#define PR_BT_PHONEBOOKSERVICE PR_TSS
+
+#define MN_BT_MESSAGINGSERVICE "BT_MsgSrv"
+#define PR_BT_MESSAGINGSERVICE_S PR_TSS_S
+#define PR_BT_MESSAGINGSERVICE PR_TSS
+
+#define MN_BT_BLLSERVICE "TEL_BLLSrv"
+#define PR_BT_BLLSERVICE_S PR_TSS_S
+#define PR_BT_BLLSERVICE PR_TSS
+
+#define MN_BT_DCMPHONESERVICE "DCM_PhoneSrv"
+#define PR_BT_DCMPHONESERVICE_S PR_TSS_S
+#define PR_BT_DCMPHONESERVICE PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ1 "HFPMultiQ1"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1 PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ2 "HFPMultiQ2"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2 PR_TSS
+
+ #define TN_BT_PBKSRV_DATABASE "BTPB_Database"
+ #define PR_TN_BT_PBKSRV_DATABASE_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_DATABASE PR_TSS
+
+ #define TN_BT_PBKSRV_LOCALPBINST "LocalPBINST"
+ #define PR_TN_BT_PBKSRV_LOCALPBINST_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_LOCALPBINST PR_TSS
+
+ #define TN_BT_PBKSRV_RESOLVENAME "ResolveName"
+ #define PR_TN_BT_PBKSRV_RESOLVENAME_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_RESOLVENAME PR_TSS
+
+ #define TN_BT_PBKSRV_PBAPMULTIQ1 "PBAPMultiQ1"
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1 PR_TSS
+
+ #define TN_BT_PBKSRV_OPPMULTI "OPPMulti"
+ #define PR_TN_BT_PBKSRV_OPPMULTI_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_OPPMULTI PR_TSS
+
+ #define TN_BT_PBKSRV_VCARDPARSER "VCardParser"
+ #define PR_TN_BT_PBKSRV_VCARDPARSER_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_VCARDPARSER PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD0 "MsgCntrlThread0"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0 PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD1 "MsgCntrlThread1"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1 PR_TSS
+
+ #define TN_BT_MSGSRV_MAPMULTI "MapMulti"
+ #define PR_TN_BT_MSGSRV_MAPMULTI_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MAPMULTI PR_TSS
+
+#define MN_DTVSERVICE "DtvService"
+#define PR_DTVSERVICE_S PR_TSS_S
+#define PR_DTVSERVICE PR_TSS
+
+ #define TN_DTVTNC_TX "dtvtnc_tx"
+ #define PR_DTVTNC_TX_S PR_TSS_S
+ #define PR_DTVTNC_TX PR_TSS
+
+ #define TN_DTVTNC_RCV "dtvtnc_rcv"
+ #define PR_DTVTNC_RCV_S PR_TSS_S
+ #define PR_DTVTNC_RCV PR_TSS
+
+ #define TN_DTVTNC_TIMER "dtvtnc_timer"
+ #define PR_DTVTNC_TIMER_S PR_TSS_S
+ #define PR_DTVTNC_TIMER PR_TSS
+
+ #define TN_DTVTNC_CTL "dtvtnc_ctl"
+ #define PR_DTVTNC_CTL_S PR_TSS_S
+ #define PR_DTVTNC_CTL PR_TSS
+
+#define MN_DTVVUPSERVICE "DtvVupService"
+#define PR_DTVVUPSERVICE_S PR_TSS_S
+#define PR_DTVVUPSERVICE PR_TSS
+
+#define MN_SETTINGSERVICE "SettingService"
+#define PR_SETTINGSERVICE_S PR_TSS_S
+#define PR_SETTINGSERVICE PR_TSS
+
+#define MN_INFOSETTINGSRV "InfoSettingSrv"
+#define PR_INFOSETTINGSRV_S PR_TSS_S
+#define PR_INFOSETTINGSRV PR_TSS
+
+ #define TN_INFS_UIC "infs_uic"
+ #define PR_INFS_UIC_S PR_TSS_S
+ #define PR_INFS_UIC PR_TSS
+
+#define MN_DELPERSONALSRV "DelPersonalSrv"
+#define PR_DELPERSONALSRV_S PR_TSS_S
+#define PR_DELPERSONALSRV PR_TSS
+
+#define MN_MENUSERVICE "MenuService"
+#define PR_MENUSERVICE_S PR_TSS_S
+#define PR_MENUSERVICE PR_TSS
+
+#define MN_NAVIPROXY "NaviProxy"
+#define PR_NAVIPROXY_S PR_TSS_S
+#define PR_NAVIPROXY PR_TSS
+
+#define MN_AWBPROXY "AwbProxy"
+#define PR_AWBPROXY_S PR_TSS_S
+#define PR_AWBPROXY PR_TSS
+
+#define MN_TFFPROXY "TFFProxy"
+#define PR_TFFPROXY_S PR_TSS_S
+#define PR_TFFPROXY PR_TSS
+
+#define MN_TFFPROXYSLAVE "TFFProxySlave"
+#define PR_TFFPROXYSLAVE_S PR_TSS_S
+#define PR_TFFPROXYSLAVE PR_TSS
+
+#define MN_AWNPRIMARY "AwnPrimary"
+#define PR_AWNPRIMARY_S PR_TSS_S
+#define PR_AWNPRIMARY PR_TSS
+
+#define MN_AWBPRIMARY "AwbPrimary"
+#define PR_AWBPRIMARY_S PR_TSS_S
+#define PR_AWBPRIMARY PR_TSS
+
+#define MN_AWMPRIMARY "AwmPrimary"
+#define PR_AWMPRIMARY_S PR_TSS_S
+#define PR_AWMPRIMARY PR_TSS
+
+#define MN_AWTPRIMARY "AwtPrimary"
+#define PR_AWTPRIMARY_S PR_TSS_S
+#define PR_AWTPRIMARY PR_TSS
+
+#define MN_MISINKSERVICE "MisinkService"
+#define PR_MISINKSERVICE_S PR_TSS_S
+#define PR_MISINKSERVICE PR_TSS
+
+#define MN_TEXTCONVERTER "TextConverter"
+#define PR_TEXTCONVERTER_S PR_TSS_S
+#define PR_TEXTCONVERTER PR_TSS
+
+#define MN_HANDWRITING "HandWriting"
+#define PR_HANDWRITING_S PR_TSS_S
+#define PR_HANDWRITING PR_TSS
+
+#define MN_EXTUNITAUTH_D "EXTUNITAUTH_D"
+#define PR_EXTUNITAUTH_D_S "0"
+#define PR_EXTUNITAUTH_D 0
+
+ #define TN_VPSVC__CWORD84_ "VPSVC_D"
+ #define PR_VPSVC__CWORD84__S PR_TSS_S
+ #define PR_VPSVC__CWORD84_ PR_TSS
+
+#define MN_PROXYSERVICE "ProxyService"
+#define PR_PROXYSERVICE_S PR_TSS_S
+#define PR_PROXYSERVICE PR_TSS
+
+#define MN_FUELSERVICE "VS_FUCSrv"
+#define PR_FUELSERVICE_S PR_TSS_S
+#define PR_FUELSERVICE PR_TSS
+
+#define MN_ENERGYSERVICE "VS_ENMSrv"
+#define PR_ENERGYSERVICE_S PR_TSS_S
+#define PR_ENERGYSERVICE PR_TSS
+
+#define MN_CUSTOMIZESERVICE "VS_VSDSrv"
+#define PR_CUSTOMIZESERVICE_S PR_TSS_S
+#define PR_CUSTOMIZESERVICE PR_TSS
+
+#define MN_DMSSERVICE "VS_DMSSrv"
+#define PR_DMSSERVICE_S PR_TSS_S
+#define PR_DMSSERVICE PR_TSS
+
+#define MN_AIRCONSERVICE "VS_ACNSrv"
+#define PR_AIRCONSERVICE_S PR_TSS_S
+#define PR_AIRCONSERVICE PR_TSS
+
+#define MN_SEATSERVICE "VS_NMSSrv"
+#define PR_SEATSERVICE_S PR_TSS_S
+#define PR_SEATSERVICE PR_TSS
+
+#define MN_CAMERASERVICE "VS_CMRSrv"
+#define PR_CAMERASERVICE_S PR_TSS_S
+#define PR_CAMERASERVICE PR_TSS
+
+ #define TN_CAMERAQUICKRVC "QuickRVCThread"
+ #define PR_CAMERAQUICKRVC_S PR_TSS_S
+ #define PR_CAMERAQUICKRVC PR_TSS
+
+#define MN_METSERVICE "VS_METSrv"
+#define PR_METSERVICE_S PR_TSS_S
+#define PR_METSERVICE PR_TSS
+
+#define MN_TMCSERVICE "VS_TMCSrv"
+#define PR_TMCSERVICE_S PR_TSS_S
+#define PR_TMCSERVICE PR_TSS
+
+#define MN_DASSERVICE "VS_DASSrv"
+#define PR_DASSERVICE_S PR_TSS_S
+#define PR_DASSERVICE PR_TSS
+
+#define MN_EXTUNITAUTH_M "EXTUNITAUTH_M"
+#define PR_EXTUNITAUTH_M_S "0"
+#define PR_EXTUNITAUTH_M 0
+
+#define MN_DUMMYREAD "DummyRead"
+#define PR_DUMMYREAD_S PR_TSS_S
+#define PR_DUMMYREAD PR_TSS
+
+#define MN_SSTSERVICE "storage_access"
+#define PR_SSTSERVICE_S PR_TSS_S
+#define PR_SSTSERVICE PR_TSS
+
+#define MN_CCSAUDITD "ccs-auditd"
+#define PR_CCSAUDITD_S PR_TSS_S
+#define PR_CCSAUDITD PR_TSS
+
+//exec from task manager
+#define MN_ACTIVITYMANAGER "ActivityManager"
+#define PR_ACTIVITYMANAGER_S PR_TSS_S
+#define PR_ACTIVITYMANAGER PR_TSS
+
+#define MN_RESIDENT_SVC "RESIDENT_SVC"
+#define PR_RESIDENT_SVC_S PR_TSS_S
+#define PR_RESIDENT_SVC PR_TSS
+
+#define MN_TRANSIENT_SVC "TRANSIENT_SVC"
+#define PR_TRANSIENT_SVC_S PR_TSS_S
+#define PR_TRANSIENT_SVC PR_TSS
+
+#define MN_WLANSERVICE "wlan_ctrl_0700"
+#define PR_WLANSERVICE_S PR_TSS_S
+#define PR_WLANSERVICE PR_TSS
+
+#define MN_WLANEVTTHR "WlanEvtThr"
+#define PR_WLANEVTTHR_S PR_TSS_S
+#define PR_WLANEVTTHR PR_TSS
+
+#define MN_WLANMIDDLESERVICE "WlanMiddle"
+#define PR_WLANMIDDLESERVICE_S PR_TSS_S
+#define PR_WLANMIDDLESERVICE PR_TSS
+
+ #define TN_WLANMIDDLESERVICE0 "WM_MsgCtrlTh0"
+ #define PR_WLANMIDDLESERVICE0_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE0 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE1 "WM_MsgCtrlTh1"
+ #define PR_WLANMIDDLESERVICE1_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE1 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE2 "WM_MsgCtrlTh2"
+ #define PR_WLANMIDDLESERVICE2_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE2 PR_TSS
+
+#define MN_WLANSERVICE2 "wlan_ctrl_0701"
+#define PR_WLANSERVICE2_S PR_TSS_S
+#define PR_WLANSERVICE2 PR_TSS
+
+#define MN_WLANEVTTHR2 "WlanEvtThr2"
+#define PR_WLANEVTTHR2_S PR_TSS_S
+#define PR_WLANEVTTHR2 PR_TSS
+
+//exec from task manager, Test for vup
+#define MN_PS__CWORD52_VUP "_CWORD52_vup"
+#define PR_PS__CWORD52_VUP_S PR_TSS_S
+#define PR_PS__CWORD52_VUP PR_TSS
+
+#define MN_PS_SYSVUP "sysvup"
+#define PR_PS_SYSVUP_S PR_TSS_S
+#define PR_PS_SYSVUP PR_TSS
+
+#define MN_SS_ROOTFSVUP "rootfsvup"
+#define PR_SS_ROOTFSVUP_S PR_TSS_S
+#define PR_SS_ROOTFSVUP PR_TSS
+
+#define MN_SS_VUPPROGUI "vupprogressui"
+#define PR_SS_VUPPROGUI_S PR_TSS_S
+#define PR_SS_VUPPROGUI PR_TSS
+
+#define MN_SS_NORVUP "norvup"
+#define PR_SS_NORVUP_S PR_TSS_S
+#define PR_SS_NORVUP PR_TSS
+
+// OUTER_UPDATE START
+#define MN_XMVUPSERVICE "radio_xm_update"
+#define PR_XMVUPSERVICE_S PR_TSS_S
+#define PR_XMVUPSERVICE PR_TSS
+// OUTER_UPDATE END
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+// NON-resident, exec from task manager, Repro update
+#define MN_PS_SYSUPDATE "sysupdate"
+#define PR_PS_SYSUPDATE_S PR_TSS_S
+#define PR_PS_SYSUPDATE PR_TSS
+
+#define MN_SS_NANDUPDATE "nandupdate"
+#define PR_SS_NANDUPDATE_S PR_TSS_S
+#define PR_SS_NANDUPDATE PR_TSS
+
+ #define TN_NANDUPDATE_CLD "t_nandcld"
+ #define PR_NANDUPDATE_CLD_S PR_TSS_S
+ #define PR_NANDUPDATE_CLD PR_TSS
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+//exec from diag
+#define MN_DIAGSERVICE "DiagService"
+#define PR_DIAGSERVICE_S PR_TSS_S
+#define PR_DIAGSERVICE PR_TSS
+
+#define MN_DIAGWORKERTSK "diagworker_tsk"
+#define PR_DIAGWORKERTSK_S PR_TSS_S
+#define PR_DIAGWORKERTSK PR_TSS
+
+#define MN_DIAGTSK "diag_tsk"
+#define PR_DIAGTSK_S PR_TSS_S
+#define PR_DIAGTSK PR_TSS
+
+#define MN_DIAGMCTSK "diagmc_tsk"
+#define PR_DIAGMCTSK_S PR_TSS_S
+#define PR_DIAGMCTSK PR_TSS
+
+#define MN_DIAGUTCOL "diagutCol_tsk"
+#define PR_DIAGUTCOL_S PR_TSS_S
+#define PR_DIAGUTCOL PR_TSS
+
+#define MN_DIAGUTUPD "diagutUpd_tsk"
+#define PR_DIAGUTUPD_S PR_TSS_S
+#define PR_DIAGUTUPD PR_TSS
+
+//exec from Connectivity for _CWORD57_
+#define MN__CWORD57_UTILSERVICE "_CWORD57_UtilService"
+#define PR__CWORD57_UTILSERVICE_S PR_TSS_S
+#define PR__CWORD57_UTILSERVICE PR_TSS
+
+ #define TN_CON_IPUT_DETECT "iputsrv_detect"
+ #define PR_CON_IPUT_DETECT_S PR_TSS_S
+ #define PR_CON_IPUT_DETECT PR_TSS
+
+ #define TN_CON_IPUT_AUTH "iputsrv_auth"
+ #define PR_CON_IPUT_AUTH_S PR_TSS_S
+ #define PR_CON_IPUT_AUTH PR_TSS
+
+ #define TN_CON_IPUT_SERIAL "iputsrv_serial"
+ #define PR_CON_IPUT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPUT_SERIAL PR_TSS
+
+ #define TN_CON_IPUT_USB_1 "iputsrv_usb1"
+ #define PR_CON_IPUT_USB_1_S PR_TSS_S
+ #define PR_CON_IPUT_USB_1 PR_TSS
+
+ #define TN_CON_IPUT_USB_2 "iputsrv_usb2"
+ #define PR_CON_IPUT_USB_2_S PR_TSS_S
+ #define PR_CON_IPUT_USB_2 PR_TSS
+
+ #define TN_CON_IPUT_SPP "iputsrv_spp"
+ #define PR_CON_IPUT_SPP_S PR_TSS_S
+ #define PR_CON_IPUT_SPP PR_TSS
+
+#define MN__CWORD57_DTSERVICE "_CWORD57_DTService"
+#define PR__CWORD57_DTSERVICE_S PR_TSS_S
+#define PR__CWORD57_DTSERVICE PR_TSS
+
+ #define TN_CON_IPDT_SERIAL "ipdtsrv_serial"
+ #define PR_CON_IPDT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPDT_SERIAL PR_TSS
+
+ #define TN_CON_IPDT_USB_1 "ipdtsrv_usb1"
+ #define PR_CON_IPDT_USB_1_S PR_TSS_S
+ #define PR_CON_IPDT_USB_1 PR_TSS
+
+ #define TN_CON_IPDT_USB_2 "ipdtsrv_usb2"
+ #define PR_CON_IPDT_USB_2_S PR_TSS_S
+ #define PR_CON_IPDT_USB_2 PR_TSS
+
+ #define TN_CON_IPDT_SPP "ipdtsrv_spp"
+ #define PR_CON_IPDT_SPP_S PR_TSS_S
+ #define PR_CON_IPDT_SPP PR_TSS
+
+#define MN_WEBDAVMGR "webdavmgr"
+#define PR_WEBDAVMGR_S PR_TSS_S
+#define PR_WEBDAVMGR PR_TSS
+
+#define MN_DISPLAYSERVICE "DisplayService"
+#define PR_DISPLAYSERVICE_S PR_TSS_S
+#define PR_DISPLAYSERVICE PR_TSS
+
+#define MN_ENFORMSERVICE "EnformService"
+#define PR_ENFORMSERVICE_S PR_TSS_S
+#define PR_ENFORMSERVICE PR_TSS
+
+#define MN_CONNUTIL "ConnUtil"
+#define PR_CONNUTIL_S PR_TSS_S
+#define PR_CONNUTIL PR_TSS
+
+#define MN_CONNUTILSLAVE "ConnUtilSlave"
+#define PR_CONNUTILSLAVE_S PR_TSS_S
+#define PR_CONNUTILSLAVE PR_TSS
+
+#define MN_CONNMGR "ConnMgr"
+#define PR_CONNMGR_S PR_TSS_S
+#define PR_CONNMGR PR_TSS
+
+#define MN_SERVICEFLAGMGR "ServiceFlagMgr"
+#define PR_SERVICEFLAGMGR_S PR_TSS_S
+#define PR_SERVICEFLAGMGR PR_TSS
+
+//exec from VR
+#define MN_VRMANAGER "vrmanager"
+#define PR_VRMANAGER_S PR_TSS_S
+#define PR_VRMANAGER PR_TSS
+
+ #define TN_VR_WORKER "VrWorkerThread"
+ #define PR_VR_WORKER_S PR_TSS_S
+ #define PR_VR_WORKER PR_TSS
+
+ #define TN_VBT_PROPDISPATCH "PropDispatchThread"
+ #define PR_VBT_PROPDISPATCH_S PR_TSS_S
+ #define PR_VBT_PROPDISPATCH PR_TSS
+
+ #define TN_VBT_PROPRESPONSE "PropResponseThread"
+ #define PR_VBT_PROPRESPONSE_S PR_TSS_S
+ #define PR_VBT_PROPRESPONSE PR_TSS
+
+ #define TN_VBT_PROPAUDIOPLAY "PropAudioPlayThread"
+ #define PR_VBT_PROPAUDIOPLAY_S PR_TSS_S
+ #define PR_VBT_PROPAUDIOPLAY PR_TSS
+
+ #define TN_VBT_PROPAUDIORECORD "PropAudioRecordThread"
+ #define PR_VBT_PROPAUDIORECORD_S PR_TSS_S
+ #define PR_VBT_PROPAUDIORECORD PR_TSS
+
+ #define TN_VBT_MAINTHREADPRIO "MainThreadPriority"
+ #define PR_VBT_MAINTHREADPRIO_S PR_TSS_S
+ #define PR_VBT_MAINTHREADPRIO PR_TSS
+
+ #define TN_VBT_ASRMANAGERGRAMMAR "AsrManagerGrammarGenerationThread"
+ #define PR_VBT_ASRMANAGERGRAMMAR_S PR_TSS_S
+ #define PR_VBT_ASRMANAGERGRAMMAR PR_TSS
+
+ #define TN_VBT_ASRVOCONRECO "AsrVoconRecoProcessThread"
+ #define PR_VBT_ASRVOCONRECO_S PR_TSS_S
+ #define PR_VBT_ASRVOCONRECO PR_TSS
+
+ #define TN_VBT_BROADCASTREAD "BroadCastReadThread"
+ #define PR_VBT_BROADCASTREAD_S PR_TSS_S
+ #define PR_VBT_BROADCASTREAD PR_TSS
+
+ #define TN_VBT_FILEAGGREGATOR "FileAggregatorDecompressThread"
+ #define PR_VBT_FILEAGGREGATOR_S PR_TSS_S
+ #define PR_VBT_FILEAGGREGATOR PR_TSS
+
+ #define TN_VBT_HTTPCURLREQUEST "HttpCurlRequestThread"
+ #define PR_VBT_HTTPCURLREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPCURLREQUEST PR_TSS
+
+ #define TN_VBT_HTTPDRIVERREQUEST "HttpDriverRequestThread"
+ #define PR_VBT_HTTPDRIVERREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPDRIVERREQUEST PR_TSS
+
+ #define TN_VBT_HTTPREQUESTSESSION "HttpRequestSessionStateThread"
+ #define PR_VBT_HTTPREQUESTSESSION_S PR_TSS_S
+ #define PR_VBT_HTTPREQUESTSESSION PR_TSS
+
+ #define TN_VBT_PLAYMGRSTOPASYNC "PlayMgrStopAsyncStreamThread"
+ #define PR_VBT_PLAYMGRSTOPASYNC_S PR_TSS_S
+ #define PR_VBT_PLAYMGRSTOPASYNC PR_TSS
+
+ #define TN_VBT_RESOURCEMGRQUEUE "ResourceMgrQueueHandlerThread"
+ #define PR_VBT_RESOURCEMGRQUEUE_S PR_TSS_S
+ #define PR_VBT_RESOURCEMGRQUEUE PR_TSS
+
+ #define TN_VBT_SMURFDRIVERTIMEOUT "SmurfDriverTimeoutThread"
+ #define PR_VBT_SMURFDRIVERTIMEOUT_S PR_TSS_S
+ #define PR_VBT_SMURFDRIVERTIMEOUT PR_TSS
+
+ #define TN_NVR_NVRMAIN "NvrMainThread"
+ #define PR_NVR_NVRMAIN_S PR_TSS_S
+ #define PR_NVR_NVRMAIN PR_TSS
+
+ #define TN_NVR_NVRRECO "NvrRecoThread"
+ #define PR_NVR_NVRRECO_S PR_TSS_S
+ #define PR_NVR_NVRRECO PR_TSS
+
+ #define TN_NVR_NVRDICT "NvrDictThread"
+ #define PR_NVR_NVRDICT_S PR_TSS_S
+ #define PR_NVR_NVRDICT PR_TSS
+
+ #define TN_NVR_NVRENC "NvrEncThread"
+ #define PR_NVR_NVRENC_S PR_TSS_S
+ #define PR_NVR_NVRENC PR_TSS
+
+//exec from VehicleInfo
+#define MN_VEHICLEINFOSERVICE "VehicleInfoSrv"
+#define PR_VEHICLEINFOSERVICE_S PR_TSS_S
+#define PR_VEHICLEINFOSERVICE PR_TSS
+
+//exec from _CWORD58_
+#define MN__CWORD58_SERVICE "_CWORD58_Service"
+#define PR__CWORD58_SERVICE_S PR_TSS_S
+#define PR__CWORD58_SERVICE PR_TSS
+
+#define MN__CWORD8_SRV "_CWORD8_Srv"
+#define PR__CWORD8_SRV_S PR_TSS_S
+#define PR__CWORD8_SRV PR_TSS
+
+#define MN_SPCSERVICE "SPCService"
+#define PR_SPCSERVICE_S PR_TSS_S
+#define PR_SPCSERVICE PR_TSS
+
+#define MN_LOCALSERVERPROXY "LSP"
+#define PR_LOCALSERVERPROXY_S PR_TSS_S
+#define PR_LOCALSERVERPROXY PR_TSS
+
+#define MN_EOMSERVICE "eOMService"
+#define PR_EOMSERVICE_S PR_TSS_S
+#define PR_EOMSERVICE PR_TSS
+
+//exec from _CWORD89_
+#define MN__CWORD89_SERVICE "_CWORD89_Service"
+#define PR__CWORD89_SERVICE_S PR_TSS_S
+#define PR__CWORD89_SERVICE PR_TSS
+
+//exec from NetworkManager
+#define MN_NETWORKMANAGER "NetworkManager"
+#define PR_NETWORKMANAGER_S PR_TSS_S
+#define PR_NETWORKMANAGER PR_TSS
+
+ #define TN_NWM_TH_CMDRCV "NWM_Th_CmdRcv"
+ #define PR_NWM_TH_CMDRCV_S PR_TSS_S
+ #define PR_NWM_TH_CMDRCV PR_TSS
+
+ #define TN_NWM_TH_PROCMGR "NWM_Th_ProcMgr"
+ #define PR_NWM_TH_PROCMGR_S PR_TSS_S
+ #define PR_NWM_TH_PROCMGR PR_TSS
+
+ #define TN_NWM_TH_CMDPROC "NWM_Th_CmdProc"
+ #define PR_NWM_TH_CMDPROC_S PR_TSS_S
+ #define PR_NWM_TH_CMDPROC PR_TSS
+
+ #define TN_NWM_TH_DNSMGR "NWM_Th_DnsMgr"
+ #define PR_NWM_TH_DNSMGR_S PR_TSS_S
+ #define PR_NWM_TH_DNSMGR PR_TSS
+
+ #define TN_NWM_TH_DHCPD "NWM_Th_Dhcpd"
+ #define PR_NWM_TH_DHCPD_S PR_TSS_S
+ #define PR_NWM_TH_DHCPD PR_TSS
+
+// DCM Service
+#define MN_DCMSERVICE "DCMService"
+#define PR_DCMSERVICE_S PR_TSS_S
+#define PR_DCMSERVICE PR_TSS
+
+ #define TN_DCM_TH_CMDRCV "DCM_Th_CmdRcv"
+ #define PR_DCM_TH_CMDRCV_S PR_TSS_S
+ #define PR_DCM_TH_CMDRCV PR_TSS
+
+ #define TN_DCM_TH_MSGRCV "DCM_Th_MsgRcv"
+ #define PR_DCM_TH_MSGRCV_S PR_TSS_S
+ #define PR_DCM_TH_MSGRCV PR_TSS
+
+ #define TN_DCM_TH_TIMER "DCM_Th_Timer"
+ #define PR_DCM_TH_TIMER_S PR_TSS_S
+ #define PR_DCM_TH_TIMER PR_TSS
+
+// HELP Service
+#define MN_HELPSERVICE "HELPService"
+#define PR_HELPSERVICE_S PR_TSS_S
+#define PR_HELPSERVICE PR_TSS
+
+//exec from RemoteService
+#define MN_REMOTESERVICE "RemoteService"
+#define PR_REMOTESERVICE_S PR_TSS_S
+#define PR_REMOTESERVICE PR_TSS
+
+ #define TN_RS_TH_CANCTRL "RS_Th_CANCtrl"
+ #define PR_RS_TH_CANCTRL_S PR_TSS_S
+ #define PR_RS_TH_CANCTRL PR_TSS
+
+ #define TN_RS_TH_DISPCTRL "RS_Th_DispCtrl"
+ #define PR_RS_TH_DISPCTRL_S PR_TSS_S
+ #define PR_RS_TH_DISPCTRL PR_TSS
+
+ #define TN_RS_TH_PARTSCTRL "RS_Th_PartsCtrl"
+ #define PR_RS_TH_PARTSCTRL_S PR_TSS_S
+ #define PR_RS_TH_PARTSCTRL PR_TSS
+
+ #define TN_RS_TH_HTTPPROC "RS_Th_HttpProc"
+ #define PR_RS_TH_HTTPPROC_S PR_TSS_S
+ #define PR_RS_TH_HTTPPROC PR_TSS
+
+//exec from VR
+#define MN_CONTENTSMGR "contentsmgr"
+#define PR_CONTENTSMGR_S PR_TSS_S
+#define PR_CONTENTSMGR PR_TSS
+
+ #define TN_CDB_CONTENDB "contendbThread"
+ #define PR_CDB_CONTENDB_S PR_TSS_S
+ #define PR_CDB_CONTENDB PR_TSS
+
+/* COMARB Service */
+#define MN_NW_COMARB "ComArbService"
+#define PR_NW_COMARB_S PR_TSS_S
+#define PR_NW_COMARB PR_TSS
+
+/* ASND_FRthread */
+#define MN_ASND_FRTH "ASND_FRthread"
+#define PR_ASND_FRTH_S PR_SND_VCETRFCTRL_S
+#define PR_ASND_FRTH PR_SND_VCETRFCTRL
+
+/* MLINK Service */
+#define MN_MLINKSERVICE "MlinkService"
+#define PR_MLINKSERVICE_S PR_TSS_S
+#define PR_MLINKSERVICE PR_TSS
+
+#define MN__CWORD74_SERVICE "_CWORD74_Service"
+#define PR__CWORD74_SERVICE_S PR_TSS_S
+#define PR__CWORD74_SERVICE PR_TSS
+#endif //__AGL_THREAD_H__
diff --git a/video_in_hal/agl-basefiles/share/agl.mk b/video_in_hal/agl-basefiles/share/agl.mk
new file mode 100644
index 0000000..77d4512
--- /dev/null
+++ b/video_in_hal/agl-basefiles/share/agl.mk
@@ -0,0 +1,677 @@
+#
+# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#################################################################################
+#
+# MAKE VARIABLES
+#
+# (mandatory)
+# MAKETOP : pprosrc/root directory
+#
+# (optional)
+# COMPONENT_NAME : component name
+# INST_HEADERS : headers to install
+# INST_LIBS : libraries to install
+# INST_SHLIBS : shared libraries to install
+# NOINST_LIBS : libraries for local use
+# INST_PROGS : programs to install
+# INST_CONFBIN : conf_bin to install
+# RPC_API : RPC API definitions (without suffix)
+# IPC_API : IPC API definitions (without suffix)
+# xxx_SRCS : source files of program xxx (*.{c,S,cc})
+# libxxx_SRCS : source files of library libxxx (*.{c,S,cc})
+# xxx_PCOS : pre-compiled object files of program xxx (*.{o,os,a})
+# libxxx_PCOS : pre-compiled object files of library libxxx (*.{o,os,a})
+# SUBDIRS : sub directories
+# CLEAN_FILES : extra files to clean
+# CLEAN_DIRS : extra directoies to clean
+# UNINST_FILES : extra files to uninstall
+# CPPFLAGS : preprocess options (-I, -D, ...)
+# CFLAGS : C source compile options
+# CXXFLAGS : C++ source compile options
+# ASFLAGS : assembler source assemble options
+# LDFLAGS : link options (-L, ...)
+# LDLIBS : libraries to link (-lxxx)
+# ALL : targets to make
+# (default: install-header install-lib install-prog install-data)
+# xxx_SONAME : dummy library SONAME
+#
+# MAKE TARGETS
+#
+# all, test : for target in $(ALL); do $(MAKE) $$target; done
+# install-prog : install program
+# install-lib : install-shlib and intall-arlib
+# install-shlib : install shared libraries
+# install-arlib : install static libraries
+# install-test-mock-lib : install mock libraries
+# install-test-mock-shlib : install shared mock libraries
+# install-test-mock-arlib : install static mock libraries
+# clean, clean-test : clean temporary files
+# clean-all, clean-all-test : clean temporary files and installed files
+# clean-self, clean-self-test : non-recursive clean
+#################################################################################
+
+
+ifneq ($(ADD_EXT),)
+ AEXT=.$(ADD_EXT)
+endif
+
+
+ifneq ($(strip $(filter $(MAKECMDGOALS),\
+ lint \
+ )),)
+endif
+
+ifneq ($(strip $(filter $(MAKECMDGOALS),\
+ )),)
+endif
+
+
+#################################################################################
+SYSROOT ?= $(SDKTARGETSYSROOT)
+DESTDIR ?= $(SDKTARGETSYSROOT)
+
+WARN_FLAGS ?= -Wall
+DEBUG_FLAGS ?= -g
+
+AUTO_INCLUDE := -include $(SYSROOT)/usr/agl/include/agl_types_obsoluted.h
+AGLCFLAGS := $(CFLAGS) $(COMPONENT_CFLAGS)
+AGLCXXFLAGS := $(CXXFLAGS) $(COMPONENT_CXXFLAGS)
+AGLCPPFLAGS := $(CPPFLAGS) $(COMPONENT_CPPFLAGS)
+AGLASFLAGS := $(ASFLAGS)
+AGLLDFLAGS := $(LDFLAGS) $(COMPONENT_LDFLAGS)
+AGLLDLIBS := $(LDLIBS) $(COMPONENT_LDLIBS)
+AGLARFLAGS := $(ARFLAGS)
+AGLPICFLAGS := -fPIC
+
+AGLCFLAGS += $(WARN_FLAGS) $(DEBUG_FLAGS) $(AUTO_INCLUDE)
+AGLCXXFLAGS += $(WARN_FLAGS) $(DEBUG_FLAGS) $(AUTO_INCLUDE)
+AGLASFLAGS += $(WARN_FLAGS) $(ARCH_FLAGS)
+
+
+ifdef LINK_CXX
+LINK := $(CXX)
+else
+LINK := $(CC)
+endif
+
+ifdef LINK_SHLIB_CXX
+LINK_SHLIB := $(CXX)
+else
+LINK_SHLIB := $(CC)
+endif
+
+ifdef DUMMY_SHLIB
+AGLLDFLAGS += -L.
+endif
+
+######### add gcov option ############
+
+
+
+define LINK_DUMMY
+if [ "$1" != "$3" ]; then \
+ echo "dummy lib ($1) created" ; \
+ $(LINK_SHLIB) -shared $(PIC_FLAGS) -Wl,-soname=$2 -o $1 -xc /dev/null ; \
+else \
+ echo "error: dummy lib must not have the same name as $3" ; \
+ exit 1 ; \
+fi ;
+endef
+
+define INST_DUMMY
+ @$(foreach lib,$(DUMMY_SHLIB),$(if $(lib),$(call LINK_DUMMY,$(lib),$(if $($(lib)_SONAME),$($(lib)_SONAME),$(lib)),$1)))
+endef
+
+define CLEAN_DUMMY
+ @$(foreach lib,$(DUMMY_SHLIB),$(if $(lib),rm -f $(lib)))
+endef
+
+define INSTALL_EXT
+@if [ "$(AEXT)" != "" ];then \
+ if echo "$(ADD_EXT)" | grep -q '^[A-Za-z]' ;then \
+ echo "$< -> $<$(AEXT)" ;\
+ mv $< $<$(AEXT) ;\
+ install -c -m 0755 $<$(AEXT) $@$(AEXT) ;\
+ if [ -f "$*.map" ];then \
+ mv $*.map $*.map$(AEXT) ;\
+ fi ;\
+ else \
+ echo "ADD_EXT : ERROR $(ADD_EXT)" ;\
+ exit 1 ;\
+ fi ;\
+fi
+endef
+
+
+define INSTALL_SCRIPT
+install -d -m 0755 $(@D)
+install -c -m 0755 $< $@
+endef
+
+define INSTALL_PIXMAP
+install -d -m 0755 $(@D)
+install -c -m 0644 $< $@
+endef
+
+define INSTALL_UCODE
+install -d -m 0755 $(@D)
+install -c -m 0644 $< $@
+endef
+
+define INSTALL_DATAINITOBJ
+if [ -n "$<" ]; then\
+ install -d -m 0755 $(@D);\
+ install -c -m 0644 $< $@;\
+fi;
+endef
+
+define INSTALL_OBJ
+install -d -m 0755 $(@D)
+install -c -m 0644 $< $@
+endef
+
+define INSTALL_CONFBIN
+if [ -n "$<" ]; then\
+ install -d -m 0755 $(@D);\
+ install -c -m 0644 $< $@;\
+fi;
+endef
+
+#################################################################################
+
+
+## for libc ##
+AGLCPPFLAGS += -D_GNU_SOURCE
+
+## for libPosixBased001Legacy
+AGLCPPFLAGS += -DAGL_PosixBasedOS001LEGACY_USED -DAGL_STUB -DLINUX
+
+## for agl header##
+AGLCPPFLAGS += -I$(SYSROOT)/usr/agl/include
+
+## for agl library##
+AGLLDFLAGS += -L$(SYSROOT)/usr/agl/lib
+
+ifneq ($(INST_SHLIBS),libagl_stub)
+AGLLDLIBS += -Wl,-Bdynamic -lpthread
+endif
+
+
+##########################################
+
+COMPONENT_NAME ?= $(error COMPONENT_NAME is not defined)
+AGL_TOPDIR ?= $(DESTDIR)/usr/agl
+AGL_INCDIR := $(AGL_TOPDIR)/include
+AGL_LIBDIR := $(AGL_TOPDIR)/lib
+AGL_BINDIR := $(AGL_TOPDIR)/bin
+AGL_PIXMAPDIR := $(AGL_TOPDIR)/pixmaps
+AGL_UCODEDIR := $(AGL_TOPDIR)/data/ucode
+
+#################################################################################
+
+HEADER_INSTALL_DIR := $(AGL_INCDIR)/$(COMPONENT_NAME)
+LIB_INSTALL_DIR := $(AGL_LIBDIR)
+PROG_INSTALL_DIR := $(AGL_BINDIR)
+PIXMAP_INSTALL_DIR := $(AGL_PIXMAPDIR)/$(COMPONENT_NAME)
+UCODE_INSTALL_DIR := $(AGL_UCODEDIR)
+DATAINITOBJ_INSTALL_DIR := $(AGL_DATAINITOBJDIR)
+CONFBIN_INSTALL_DIR := $(AGL_CONFBINDIR)
+
+#################################################################################
+
+DEL_OBJS = $(filter %.o,$($(1)_SRCS:%.c=%.o) $($(1)_SRCS:%.cc=%.o) \
+ $($(1)_SRCS:%.cpp=%.o) \
+ $($(1)_SRCS:%.S=%.o))
+OBJS = $(DEL_OBJS) $($(1)_PCOS)
+DEL_SOBJS = $(filter %.os,$($(1)_SRCS:%.c=%.os) $($(1)_SRCS:%.cc=%.os) \
+ $($(1)_SRCS:%.cpp=%.os) \
+ $($(1)_SRCS:%.S=%.os))
+DEL_GCDA = $(filter %.gcda,$($(1)_SRCS:%.c=%.gcda) $($(1)_SRCS:%.cc=%.gcda) \
+ $($(1)_SRCS:%.cpp=%.gcda) \
+ $($(1)_SRCS:%.S=%.gcda))
+DEL_GCNO = $(filter %.gcno,$($(1)_SRCS:%.c=%.gcno) $($(1)_SRCS:%.cc=%.gcno) \
+ $($(1)_SRCS:%.cpp=%.gcno) \
+ $($(1)_SRCS:%.S=%.gcno))
+DEL_GCOV = $(filter %.gcov,$($(1)_SRCS:%.c=%.gcov) $($(1)_SRCS:%.cc=%.gcov) \
+ $($(1)_SRCS:%.cpp=%.gcov) \
+ $($(1)_SRCS:%.S=%.gcov))
+
+DEL_INFO = $(filter %.info, \
+ $(dirname $($(1)_SRCS:%.c=%.tmp))lcov.info \
+ $(dirname $($(1)_SRCS:%.cc=%.tmp))lcov.info \
+ $(dirname $($(1)_SRCS:%.cpp=%.tmp))lcov.info \
+ $(dirname $($(1)_SRCS:%.S=%.tmp))lcov.info)
+
+SOBJS = $(DEL_SOBJS) $($(1)_PCOS)
+DEPS = $(join $(dir $(DEL_OBJS)),$(patsubst %.o,.%.d,$(notdir $(DEL_OBJS))))
+
+INST_TEST_MOCK_LIBS :=
+INST_TEST_MOCK_SHLIBS :=
+INST_ITV2_TESTPROGS :=
+INST_TESTPROGS :=
+
+CLEAN_OBJS := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(INST_TEST_MOCK_LIBS) $(INST_TEST_MOCK_SHLIBS) $(NOINST_LIBS) $(INST_PROGS) $(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(call DEL_OBJS,$(lib)))
+CLEAN_SOBJS := $(foreach lib,$(INST_SHLIBS) $(INST_TEST_MOCK_SHLIBS),$(call DEL_SOBJS,$(lib)))
+
+CLEAN_GCDA := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(NOINST_LIBS) $(INST_PROGS) $(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(call DEL_GCDA,$(lib)))
+CLEAN_GCNO := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(NOINST_LIBS) $(INST_PROGS) $(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(call DEL_GCNO,$(lib)))
+CLEAN_GCOV := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(NOINST_LIBS) $(INST_PROGS) $(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(call DEL_GCOV,$(lib)))
+CLEAN_CFG := $(INST_UT_SMCONF:%=%.cfg) $(INST_IT_SMCONF:%=%.cfg)
+
+CLEAN_INFO := $(sort $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(INST_TEST_MOCK_LIBS) $(INST_TEST_MOCK_SHLIBS) $(NOINST_LIBS) $(INST_PROGS) $(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(call DEL_INFO,$(lib))))
+
+LIB_DEPS := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(INST_TEST_MOCK_LIBS) $(INST_TEST_MOCK_SHLIBS) $(NOINST_LIBS),$(call DEPS,$(lib)))
+PROG_DEPS := $(foreach prog,$(INST_PROGS),$(call DEPS,$(prog)))
+TESTPROGS_DEPS :=
+PROG_RULES := $(foreach prog,$(INST_PROGS),$(if $(prog),.$(prog).out.rule))
+TESTPROG_RULES :=
+
+LIB_RULES := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(NOINST_LIBS) $(INST_TEST_MOCK_LIBS),$(if $($(lib)_SRCS),.$(lib).a.rule))
+SHLIB_RULES := $(foreach lib,$(INST_SHLIBS) $(INST_TEST_MOCK_SHLIBS),$(if $(lib),.$(lib).so.rule))
+ARLIB_RULES := $(foreach lib,$(INST_LIBS) $(NOINST_LIBS),$(if $($(lib)_SRCS),.$(lib).a.rule))
+
+PROG_MAPS := $(foreach prog,$(INST_PROGS),$(if $(prog),$(prog).map))
+TESTPROG_MAPS := $(foreach prog,$(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(if $(prog),$(prog).map))
+LIB_MAPS := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(NOINST_LIBS) $(INST_TEST_MOCK_LIBS) $(INST_TEST_MOCK_SHLIBS),$(if $(lib),$(lib).map))
+PROG_LIBDEPS := $(foreach prog,$(INST_PROGS),$(if $(prog),.$(prog).out.libdep))
+TESTPROG_LIBDEPS := $(foreach prog,$(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(if $(prog),.$(prog).out.libdep))
+
+BUILD_MK_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+include $(BUILD_MK_DIR)/rpc_rule.mk
+
+IPC_API_RULES := $(IPC_API:%=.%.ipc.rule)
+ipc_api := $(shell echo $(IPC_API) | tr A-Z a-z)
+CLEAN_IPC_API_SRCS := $(ipc_api:%=%_client.h) $(ipc_api:%=%_client.c) $(ipc_api:%=%_server.h) $(ipc_api:%=%_server.c)
+IPC_API_DEPS := $(ipc_api:%=%_client.d) $(ipc_api:%=%_server.d)
+
+CLEAN_PROGS := $(foreach prog,$(INST_PROGS),$(if $(prog),$(prog).out))
+CLEAN_TESTPROGS := $(foreach prog,$(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(if $(prog),$(prog).out))
+
+ifneq ($(AEXT),)
+CLEAN_PROGS += $(foreach prog,$(INST_PROGS),$(if $(prog),$(prog).out$(AEXT)))
+CLEAN_TESTPROGS += $(foreach prog,$(INST_ITV2_TESTPROGS) $(INST_TESTPROGS),$(if $(prog),$(prog).out$(AEXT)))
+endif
+CLEAN_LIBS := $(foreach lib,$(INST_LIBS) $(INST_SHLIBS) $(INST_TEST_MOCK_LIBS) $(INST_TEST_MOCK_SHLIBS) $(NOINST_LIBS),$(if $($(lib)_SRCS),$(lib).a))
+CLEAN_SHLIBS := $(foreach lib,$(INST_SHLIBS) $(INST_TEST_MOCK_SHLIBS),$(if $(lib),$(lib).so))
+ifneq ($(AEXT),)
+CLEAN_SHLIBS += $(foreach lib,$(INST_SHLIBS) $(INST_TEST_MOCK_SHLIBS),$(if $(lib),$(lib).so$(AEXT)))
+endif
+ifneq ($(DUMMY_SHLIB),)
+CLEAN_SHLIBS += $(DUMMY_SHLIB)
+endif
+
+CLEAN_FILES += $(CLEAN_OBJS) $(CLEAN_SOBJS)
+CLEAN_FILES += $(PROG_DEPS) $(LIB_DEPS) $(TESTPROG_DEPS)
+CLEAN_FILES += $(PROG_MAPS) $(PROG_LIBDEPS) $(TESTPROG_MAPS) $(TESTPROG_LIBDEPS)
+CLEAN_FILES += $(PROG_RULES) $(LIB_RULES) $(SHLIB_RULES) $(AR_RULES) $(TESTPROG_RULES)
+CLEAN_FILES += $(CLEAN_PROGS) $(CLEAN_LIBS) $(CLEAN_SHLIBS) $(LIB_MAPS) $(CLEAN_TESTPROGS)
+CLEAN_FILES += $(RPC_API_RULES) $(CLEAN_API_SRCS) $(RPC_API_DEPS)
+CLEAN_FILES += $(IPC_API_RULES) $(CLEAN_IPC_API_SRCS) $(IPC_API_DEPS)
+CLEAN_FILES += $(INST_DATAINITOBJ)
+CLEAN_FILES += $(CLEAN_INFO)
+CLEAN_FILES += $(CLEAN_GCNO) $(CLEAN_GCDA) $(CLEAN_GCOV)
+CLEAN_FILES += $(CLEAN_CFG)
+ifneq ($(AEXT),)
+CLEAN_FILES += $(foreach lib,$(INST_SHLIBS) $(INST_PROGS),$(if $(lib),$(lib).map$(AEXT)))
+endif
+
+
+#################################################################################
+
+RPATHLINK := $(SYSROOT)/usr/lib:$(SYSROOT)/lib:$(SYSROOT)/usr/agl/lib
+
+#################################################################################
+SUBDIRS := $(filter-out mock,$(SUBDIRS))
+
+.PHONY: all all-subdirs install test $(SUBDIRS:%=all-%) $(SUBDIRS:%=install--%)
+.PHONY: install-test $(SUBDIRS:%=install-test-%)
+.PHONY: build-lib
+.PHONY: build-prog $(SUBDIRS:%=build-prog-%)
+.PHONY: build-shlib $(SUBDIRS:%=build-shlib-%)
+.PHONY: build-arlib $(SUBDIRS:%=build-arlib-%)
+.PHONY: build-cfg
+.PHONY: install-header $(SUBDIRS:%=install-header-%)
+.PHONY: install-lib
+.PHONY: install-shlib $(SUBDIRS:%=install-shlib-%)
+.PHONY: install-arlib $(SUBDIRS:%=install-arlib-%)
+.PHONY: install-prog $(SUBDIRS:%=install-prog-%)
+.PHONY: install-data $(SUBDIRS:%=install-data-%)
+.PHONY: install-cfg $(SUBDIRS:%=install-cfg-%)
+.PHONY: install-preload
+.PHONY: clean-all
+.PHONY: clean-self
+.PHONY: clean-sub $(SUBDIRS:%=clean-%)
+.PHONY: clean-all-sub $(SUBDIRS:%=clean-all-%)
+.PHONY: clean-self-sub
+.PHONY: lint lint-exec
+
+
+REF_ROOT_DIR=/home/ref_root/
+TEST_SERVER_DIR=/home/agl_sysroot/
+REFHW_SERVER=192.168.1.2
+
+PHONY: all
+
+lint:
+ @set -e;\
+ $(MAKE) lint-exec
+
+
+#all: build-lib build-prog build-test-mock-lib build-cfg all-subdirs
+all: build-lib build-prog build-cfg all-subdirs
+
+all-subdirs:
+ @set -e;\
+ for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) all); done
+
+
+#lint-exec: $(INST_HEADERS) $($(INST_SHLIBS)_SRCS) $($(INST_LIBS)_SRCS) $($(INST_PROGS)_SRCS)
+# -cpplint.py $^ > cpplint_result.txt 2>&1
+
+lint-exec:
+ $(eval LINTFILES := $(shell find . -name "*.c*" -o -name "*.h*"))
+ -cpplint.py --extensions=hpp,cpp,c,cc,h $(LINTFILES) > cpplint_result.txt 2>&1
+
+
+#install: install-header install-lib install-prog install-data install-test-mock-header install-test-mock-lib install-test-casename $(SUBDIRS:%=install--%)
+install: install-header install-lib install-prog install-data $(SUBDIRS:%=install--%)
+
+
+build-lib: build-shlib build-arlib
+
+build-shlib: $(INST_SHLIBS:%=%.so)
+
+build-arlib: $(INST_LIBS:%=%.a) $(NOINST_LIBS:%=%.a)
+
+TOPDIR=$(abspath ./)
+generate-header-list: install-header-local
+ echo $(COMPONENT_NAME) > $(addsuffix .list, $(abspath ./))
+ ls -1 $(TOPDIR)/tmp_head/usr/agl/include/$(COMPONENT_NAME)/ >> $(addsuffix .list, $(abspath ./))
+ rm -rf ./tmp_head
+
+
+build-prog: $(INST_PROGS:%=%.out)
+
+
+install-lib: install-arlib install-shlib
+
+install-arlib: build-arlib
+ifneq ($(strip $(INST_LIBS)),)
+ install -m 0755 -d $(LIB_INSTALL_DIR)
+ install -m 0644 $(INST_LIBS).a $(LIB_INSTALL_DIR)
+endif
+
+install-shlib: build-shlib
+ifneq ($(strip $(INST_SHLIBS)),)
+ install -m 0755 -d $(LIB_INSTALL_DIR)
+ install -m 0644 $(INST_SHLIBS).so $(LIB_INSTALL_DIR)
+endif
+
+install-prog: build-prog
+ifneq ($(strip $(INST_PROGS)),)
+ install -m 0755 -d $(PROG_INSTALL_DIR)
+ $(foreach prog, $(INST_PROGS), install -m 0755 $(prog).out $(PROG_INSTALL_DIR)/$(prog);)
+endif
+
+
+install-header-r: install-header $(SUBDIRS:%=install-header-r-%)
+
+
+install-header-local:
+ $(MAKE) DESTDIR=`pwd`/tmp_head install-header-r
+
+
+install-header: $(INST_HEADERS:%=install-%)
+
+
+$(INST_HEADERS:%=install-%): install-%: %
+ifneq ($(strip $(INST_HEADERS)),)
+ install -m 0755 -d $(HEADER_INSTALL_DIR)
+ install -m 0644 $< $(HEADER_INSTALL_DIR)
+endif
+
+
+HOST_LAUNCH_XML2CFG = $(SYSROOT)/usr/agl/share/launch_xml2cfg.sh
+CONF_H = $(SYSROOT)/usr/agl/include/sm_launch_conf.h
+
+%.cfg: %.xml
+ set -e; \
+ cpp -P -include $(CONF_H) $< > $<.tmp ; \
+ cd $(dir $<.tmp); \
+ $(HOST_LAUNCH_XML2CFG) $(notdir $<.tmp) > $@ ; \
+ rm -f $<.tmp ;
+
+
+install-data: $(INST_PIXMAPS:%=$(PIXMAP_INSTALL_DIR)/%) $(INST_UCODE:%=$(UCODE_INSTALL_DIR)/%) $(INST_DATAINITOBJ:%=$(DATAINITOBJ_INSTALL_DIR)/%) $(OBJ_COPY_LIST:%=$(OBJ_COPY_INSTALL_DIR)/%) $(INST_CONFBIN:%=$(CONFBIN_INSTALL_DIR)/%)
+
+
+clean: $(SUBDIRS:%=clean--%)
+ rm -f $(CLEAN_FILES)
+ rm -rf $(CLEAN_DIRS)
+
+clean-all: $(SUBDIRS:%=clean-all--%)
+ rm -f $(CLEAN_FILES) $(UNINST_FILES)
+ rm -rf $(CLEAN_DIRS)
+
+clean-self: clean
+
+#################################################################################
+
+%.o: %.c
+ $(CC) -MD -MT $(@:%.o=%.os) -MT $@ -MF $(@D)/.$(@F:%.o=%.d) -MP $(AGLCPPFLAGS) $(AGLCFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLCPPFLAGS) $(AGLCFLAGS) -c $<
+endif
+
+%.o: %.cc
+ $(CXX) -MD -MT $(@:%.o=%.os) -MT $@ -MF $(@D)/.$(@F:%.o=%.d) -MP $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c $<
+endif
+
+%.o: %.cpp
+ $(CXX) -MD -MT $(@:%.o=%.os) -MT $@ -MF $(@D)/.$(@F:%.o=%.d) -MP $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c $<
+endif
+
+%.o: %.S
+ $(CC) -MD -MT $(@:%.o=%.os) -MT $@ -MF $(@D)/.$(@F:%.o=%.d) -MP $(AGLCPPFLAGS) $(AGLASFLAGS) -c -o $@ $<
+
+%.os: %.c
+ $(CC) -MD -MT $(@:%.os=%.o) -MT $@ -MF $(@D)/.$(@F:%.os=%.d) -MP $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCFLAGS) -c $<
+endif
+
+%.os: %.cc
+ $(CXX) -MD -MT $(@:%.os=%.o) -MT $@ -MF $(@D)/.$(@F:%.os=%.d) -MP $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c $<
+endif
+
+%.os: %.cpp
+ $(CXX) -MD -MT $(@:%.os=%.o) -MT $@ -MF $(@D)/.$(@F:%.os=%.d) -MP $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c -o $@ $<
+ifeq ($(SAFLAG),on)
+ $(SATOOL) $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLCXXFLAGS) -c $<
+endif
+
+%.os: %.S
+ $(CC) -MD -MT $(@:%.os=%.o) -MT $@ -MF $(@D)/.$(@F:%.os=%.d) -MP $(AGLPICFLAGS) $(AGLCPPFLAGS) $(AGLASFLAGS) -c -o $@ $<
+
+.%.out.rule:
+ @echo '$*.out: $$(call OBJS,$*)' > $@
+ @echo ' @rm -f $$(@:%=.%.libdep)' >> $@
+ @echo ' $$(LINK) $$(AGLLDFLAGS) -Wl,-rpath=$$(RPATH) -Wl,-rpath-link=$$(RPATHLINK),-Map=$$(@:%.out=%.map) $$(call OBJS,$*) $($(*F)_LDLIBS) $$(AGLLDLIBS) -o $$@' >> $@
+ @echo ' @awk '\''$$$$1=="LOAD" && $$$$2~/\.a$$$$/{print("$$@:", $$$$2);print($$$$2 ":")}'\'' $$(@:%.out=%.map) > $$(@:%=.%.libdep)' >> $@
+
+.%.a.rule:
+ @echo '$*.a: $$(call OBJS,$*)' > $@
+ @echo ' $$(AR) $$(AGLARFLAGS) $$@ $$?' >> $@
+
+.%.so.rule:
+ @echo '$*.so: $$(call SOBJS,$*)' > $@
+ @echo ' $$(call INST_DUMMY,$*.so)' >> $@
+ @test -f $*.ver && echo ' $$(LINK_SHLIB) -shared $$(AGLLDFLAGS) $($(*F)_LDFLAGS) $$(AGLLDLIBS) -Wl,-rpath=$$(RPATH) -Wl,-soname=$*.so,-Map=$$(@:%.so=%.map),--version-script,$*.ver $$^ -o $$@' >> $@ || echo ' $$(LINK_SHLIB) -shared $$(AGLLDFLAGS) $($(*F)_LDFLAGS) $$(AGLLDLIBS) -Wl,-rpath=$$(RPATH) -Wl,-soname=$*.so,-Map=$$(@:%.so=%.map) $$^ -o $$@' >> $@
+ @echo ' $$(call CLEAN_DUMMY)' >> $@
+
+.%.ipc.rule:
+ @echo 'ipc_name:=$(shell echo $* | tr A-Z a-z)' > $@
+ @echo '$$(ipc_name)_client.h $$(ipc_name)_client.c $$(ipc_name)_server.h $$(ipc_name)_server.c: $*.api $$(IPC_MKSTUB)' >> $@
+ @echo ' $$(IPC_MKSTUB) $$(AGLCPPFLAGS) $$(IPC_MKSTUB_FLAGS) $$<' >> $@
+ @echo >> $@
+ @echo '$*.api:' >> $@
+ @echo >> $@
+
+################################################################################
+
+#
+# If you write a pattern of smbols that the library may export,
+# it checks for unmatched symbols at installation time.
+#
+# (example)
+# libfoo_SYMBOL_PATTERN = ^(foo|FOO)_
+# libbar_SYMBOL_PATTERN = ^(bar|Bar)
+#
+
+$(LIB_INSTALL_DIR)/%.so: %.so
+ $(INSTALL_SHLIB)
+ $(INSTALL_EXT)
+ @test -z '$($*_SYMBOL_PATTERN)' || $(NM) -f posix -o $< \
+ | awk 'NF>=3 && $$3~/[ABCDGRST]/ && $$2!~/^(_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_edata|_end|__)/ && $$2!~/$($*_SYMBOL_PATTERN)/ \
+ {print $$1, "WARNING: A symbol ", $$2, " that does not match the registered pattern $($*_SYMBOL_PATTERN) is included." > "/dev/stderr"}'
+
+$(LIB_INSTALL_DIR)/%.a: %.a
+ $(INSTALL_LIB)
+ @test -z '$($*_SYMBOL_PATTERN)' || $(NM) -f posix -o $< \
+ | awk 'NF>=3 && $$3~/[ABCDGRST]/ && $$2!~/$($*_SYMBOL_PATTERN)/ \
+ {print $$1, "WARNING: A symbol ", $$2, " that does not match the registered pattern $($*_SYMBOL_PATTERN) is included." > "/dev/stderr"}'
+#################################################################################
+
+ifneq ($(strip $(SUBDIRS)),)
+$(SUBDIRS:%=all-%):
+ @set -e; \
+ dir=`pwd`; \
+ subdir=$(@:all-%=%); \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==START==" ; \
+ $(MAKE) -C $(@:all-%=%) all; \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==END==";
+
+$(SUBDIRS:%=install--%):
+ @set -e; \
+ dir=`pwd`; \
+ subdir=$(@:install--%=%); \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==START==" ; \
+ $(MAKE) -C $(@:install--%=%) install; \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==END==";
+
+$(SUBDIRS:%=install-header-r-%):
+ @set -e; \
+ dir=`pwd`; \
+ subdir=$(@:install-header-r-%=%); \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==START==" ; \
+ $(MAKE) -C $(@:install-header-r-%=%) install-header-r; \
+ echo "leve:$(MAKELEVEL) dir:`basename $$dir` SUBDIR:$$subdir ==END==";
+
+
+$(SUBDIRS:%=clean--%):
+ @$(MAKE) -C $(@:clean--%=%) clean
+
+$(SUBDIRS:%=clean-all--%):
+ @echo "$@ ==Start=="
+ @$(MAKE) -C $(@:clean-all--%=%) clean-all
+ @echo "$@ ==End=="
+
+endif
+
+
+#################################################################################
+
+ifeq ($(MAKECMDGOALS),all)
+-include $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),)
+-include $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),install)
+-include $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+ifeq ($(MAKECMDGOALS),install-test)
+-include $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+ifeq ($(MAKECMDGOALS),install-test-exec)
+-include $(PROG_RULES) $(TESTPROG_RULES) $(PROG_DEPS) $(TESTPROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),test)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),run-ct-local)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),run-itv2-local)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),run-ut-local)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+ifeq ($(MAKECMDGOALS),run-it-local)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+
+
+ifeq ($(MAKECMDGOALS),test-exec)
+-include $(TESTPROG_RULES) $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS) $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS) $(ARLIB_RULES)
+endif
+
+
+ifeq ($(MAKECMDGOALS),build-prog)
+-include $(PROG_RULES) $(PROG_DEPS) $(PROG_LIBDEPS)
+endif
+
+ifeq ($(MAKECMDGOALS),build-testdriver)
+-include $(PROG_RULES) $(TESTPROG_RULES) $(TESTPROG_DEPS) $(TESTPROG_LIBDEPS)
+endif
+
+ifeq ($(MAKECMDGOALS),build-lib)
+-include $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS)
+endif
+
+ifeq ($(MAKECMDGOALS),build-arlib)
+-include $(SHLIB_RULES) $(LIB_RULES) $(LIB_DEPS)
+endif
+
+ifeq ($(MAKECMDGOALS),build-shlib)
+-include $(SHLIB_RULES) $(LIB_DEPS)
+endif
+
+ifeq ($(MAKECMDGOALS),build-arlib)
+-include $(ARLIB_RULES) $(LIB_DEPS)
+endif
+
+ifeq ($(strip $(filter clean%,$(MAKECMDGOALS))),)
+ifneq ($(IPC_API_RULES),)
+-include $(IPC_API_RULES) $(IPC_API_DEPS)
+endif
+endif
+
diff --git a/video_in_hal/agl-basefiles/share/rpc_rule.mk b/video_in_hal/agl-basefiles/share/rpc_rule.mk
new file mode 100644
index 0000000..f5db71d
--- /dev/null
+++ b/video_in_hal/agl-basefiles/share/rpc_rule.mk
@@ -0,0 +1,42 @@
+#
+# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# rpc rule makefile
+#
+
+#rpc_apidef directory path must be added
+RPC_APIDEF := $(OECORE_NATIVE_SYSROOT)/usr/bin/rpc_apidef
+
+RPC_API_RULES := $(RPC_API:%=.%.api.rule)
+rpc_api := $(shell echo $(RPC_API) | tr A-Z a-z)
+CLEAN_API_SRCS := $(rpc_api:%=%_api.h) $(rpc_api:%=%_api_stub.c) $(rpc_api:%=%_srvr.h) $(rpc_api:%=%_srvr_stub.c)
+RPC_API_DEPS := $(rpc_api:%=%_api_stub.d) $(rpc_api:%=%_srvr_stub.d)
+
+.%.api.rule:
+ @echo 'rpc_name:=$(shell echo $* | tr A-Z a-z)' > $@
+ @echo '$$(rpc_name)_api.h $$(rpc_name)_api_stub.c $$(rpc_name)_srvr.h $$(rpc_name)_srvr_stub.c: $*.api $$(RPC_APIDEF)' >> $@
+ @echo ' $$(RPC_APIDEF) $$(CPPFLAGS) $$(RPC_APIDEF_FLAGS) $$<' >> $@
+ @echo >> $@
+ @echo '$*.api:' >> $@
+ @echo >> $@
+
+ifeq ($(strip $(filter clean%,$(MAKECMDGOALS))),)
+ifneq ($(RPC_API_RULES),)
+-include $(RPC_API_RULES) $(RPC_API_DEPS)
+endif
+endif
+
diff --git a/video_in_hal/agl-basefiles/share/system_launcher_main.xml b/video_in_hal/agl-basefiles/share/system_launcher_main.xml
new file mode 100644
index 0000000..ac34d29
--- /dev/null
+++ b/video_in_hal/agl-basefiles/share/system_launcher_main.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" ?>
+
+<!DOCTYPE system_launcher [
+ <!ELEMENT system_launcher (group+) >
+
+ <!ELEMENT group (launch+) >
+ <!ATTLIST group
+ name CDATA #REQUIRED
+ wait_time CDATA #REQUIRED
+ trigger (True|False) #REQUIRED
+ >
+
+ <!ELEMENT launch EMPTY >
+ <!ATTLIST launch
+ name CDATA #REQUIRED
+ path CDATA #REQUIRED
+ priority CDATA #REQUIRED
+ critical CDATA #REQUIRED
+ retry_cnt CDATA #REQUIRED
+ arguments CDATA #REQUIRED
+ logging_mask CDATA "NULL"
+ restart (me|NULL) #REQUIRED
+ is_start_required (True|False) #REQUIRED
+ shutdown_critical CDATA #REQUIRED
+ shutdown_wait_time CDATA #REQUIRED
+ fast_shutdown_wait_time CDATA #REQUIRED
+ user_name CDATA #REQUIRED
+ is_agl_unit (True|False) #IMPLIED
+ disable_agl_resethistory (True|False) #IMPLIED
+ disable_nonagl_resethistory (True|False) #IMPLIED
+ env_cond CDATA #IMPLIED
+ cpu_assign CDATA #IMPLIED
+ >
+
+ <!ENTITY system_launcher_body SYSTEM "system_launcher_body.xml">
+]>
+
+<system_launcher>
+ &system_launcher_body;
+</system_launcher>
diff --git a/video_in_hal/agl-systemd/99-agl.rules b/video_in_hal/agl-systemd/99-agl.rules
new file mode 100755
index 0000000..dd4e245
--- /dev/null
+++ b/video_in_hal/agl-systemd/99-agl.rules
@@ -0,0 +1,11 @@
+#modify sound related device permissions
+
+SUBSYSTEM=="sound",MODE="0666"
+
+#modify dri related device permissions
+
+SUBSYSTEM=="drm",MODE="0777"
+
+#modify agl/evk related device permissions
+
+SUBSYSTEM=="evk",KERNEL=="agl/evk",MODE="0666"
diff --git a/video_in_hal/agl-systemd/LICENSE b/video_in_hal/agl-systemd/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/agl-systemd/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/agl-systemd/agl-trigger.service b/video_in_hal/agl-systemd/agl-trigger.service
new file mode 100755
index 0000000..8cb752f
--- /dev/null
+++ b/video_in_hal/agl-systemd/agl-trigger.service
@@ -0,0 +1,18 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+#After=weston.service
+
+[Service]
+Type=oneshot
+#RemainAfterExit=yes
+EnvironmentFile=/tool_9E_SI/env.txt
+ExecStart=/tool_9E_SI/agl_set_capability.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/video_in_hal/agl-systemd/env.txt b/video_in_hal/agl-systemd/env.txt
new file mode 100755
index 0000000..48b83df
--- /dev/null
+++ b/video_in_hal/agl-systemd/env.txt
@@ -0,0 +1,130 @@
+VEHICLEPARAMETERLIBRARY_AREA="AREA1"
+XDG_RUNTIME_DIR="/run/user/0"
+AGL_NFS="y"
+VEHICLEPARAMETERLIBRARY_BRAND="BRAND1"
+LIBTHAI_DICTDIR="/usr/share/libthai"
+TERM="xterm"
+INIT_UID="1000"
+INIT_GID="1000"
+AGL_RWDATA_PATH="/nv"
+LD_LIBRARY_PATH="/lib:/usr/lib:/usr/agl/lib:/usr/debug/lib"
+ARB_OPT="FORCE_REBOOT"
+PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/agl/bin:/usr/debug/bin:/usr/debug/sbin:/usr/debug/usr/bin:/usr/debug/usr/sbin"
+PWD="/dev/mqueue"
+OLDPWD="/dev/mqueue"
+SHLVL="1"
+ALSA_CONFIG_PATH="/usr/share/alsa/alsa.conf"
+GPF_LOGFLAG="0x00000003"
+GPF_LOGLEVEL_DEBUG="0x00000000"
+_CWORD84__IPADDR="192.168.128.129"
+AGL_ON_SHELL="y"
+AGL_DEVDIAG_FLAG="ON"
+_="/usr/bin/printenv"
+UDEV_CONFIG_FILE="/etc/udev/udev.conf"
+VP_VEHICLEPARAMETERLIBRARY_version="AAAAAAAAA0001"
+VP_VEHICLEPARAMETERLIBRARY_maker_ID="00000-00000"
+VP_VEHICLEPARAMETERLIBRARY_area="AREA1"
+VP_VEHICLEPARAMETERLIBRARY_grade="GRADE1"
+VP_VEHICLEPARAMETERLIBRARY_model_ID="XXXXXXXX-XXXX"
+VP_VEHICLEPARAMETERLIBRARY_dest_c_code=""
+VP_VEHICLEPARAMETERLIBRARY_DAB_tuner_num="0"
+VP_VEHICLEPARAMETERLIBRARY_AMP_type="built_in_AMP"
+VP_VEHICLEPARAMETERLIBRARY_DISPLAY="InternalDisplay"
+VP_VEHICLEPARAMETERLIBRARY_DECK="CD_DECK"
+VP_VEHICLEPARAMETERLIBRARY_default_mode="home"
+VP_VEHICLEPARAMETERLIBRARY_VOICE_RECOGNITION_TUTORIAL="available"
+VP_VEHICLEPARAMETERLIBRARY_SEARCH="unavailable"
+VP_VEHICLEPARAMETERLIBRARY_CONTACT="unavailable"
+VP_VEHICLEPARAMETERLIBRARY_JPTrafficInfo_show="unavailable"
+VP_VEHICLEPARAMETERLIBRARY_INFOMATION_MANAGEMENT="available"
+VP_VEHICLEPARAMETERLIBRARY_WIFI_STA_ENABLE="False"
+VP_VEHICLEPARAMETERLIBRARY_WIFI_AP_ENABLE="True"
+VP_VEHICLEPARAMETERLIBRARY_WIFI_DIRECT_ENABLE="False"
+VP_VEHICLEPARAMETERLIBRARY_HAS_GPS="y"
+VP_VEHICLEPARAMETERLIBRARY__CWORD6_="n"
+VP_VEHICLEPARAMETERLIBRARY_PHASE="3"
+VP_VEHICLEPARAMETERLIBRARY__CWORD6_="unavailable"
+VP_VEHICLEPARAMETERLIBRARY_CONNECTION_SERVER="TRY"
+VP__CWORD31__version="XXXXXXXXX0001"
+VP__CWORD31__class_type_of_LAN="CAN_08_10PF"
+VP__CWORD31__reverse="direct"
+VP__CWORD31__PKB="direct"
+VP__CWORD31__ADIM__CWORD62_="direct_ADIM"
+VP__CWORD31__telematics_function="CAN_judge"
+VP__CWORD31__opening_picture="_CWORD31_"
+VP__CWORD31__theme_color="pure_white"
+VP__CWORD31__AC_onscreen="available"
+VP__CWORD31__AC_screen_operation="available"
+VP__CWORD31__AC_screen_home="available"
+VP__CWORD31__AC_switch_front_temp="available"
+VP__CWORD31__AC_temp_disp_outside="available"
+VP__CWORD31__AC_temp_disp_setting="available"
+VP__CWORD31__AC_switch_concierge="available"
+VP__CWORD31__AC_switch_S_flow="available"
+VP__CWORD31___CWORD11_="available"
+VP__CWORD31___CWORD11__home="available"
+VP__CWORD31___CWORD11__drive_wheel="FF"
+VP__CWORD31___CWORD11__drive_type="2WD"
+VP__CWORD31___CWORD11__battery_position="rear_tire"
+VP__CWORD31___CWORD11__battery_direction="lateral"
+VP__CWORD31___CWORD11__motor_position="Ahead"
+VP__CWORD31___CWORD9__trip="available"
+VP__CWORD31___CWORD9__trip="available"
+VP__CWORD31___CWORD9__home_trip="available"
+VP__CWORD31___CWORD9__fuel="available"
+VP__CWORD31___CWORD9__home_fuel="available"
+VP__CWORD31__FC_eco_safety_point_service="unavailable"
+VP__CWORD31__FC_scale_GAS="5"
+VP__CWORD31__FC_scale_HV="5"
+VP__CWORD31__FC_energy_mark="30wh"
+VP__CWORD31___CWORD9__type="type1"
+VP__CWORD31__FC_SIGNAL="unavailable"
+VP__CWORD31__display_setting_screen="unavailable"
+VP__CWORD31__VR_HVAC_control="unavailable"
+VP__CWORD31__clock_type="unavailable"
+VP__CWORD31__start_up_BGM="unavailable"
+VP__CWORD31__start_up_BGM_type="OFF"
+VP__CWORD31__DTV_antenna_FL="unavailable"
+VP__CWORD31__DTV_antenna_FR="unavailable"
+VP__CWORD31__DTV_antenna_RL="unavailable"
+VP__CWORD31__DTV_antenna_RR="unavailable"
+VP__CWORD31__DTV_ANTENNA="unavailable"
+VP__CWORD31__HF_voice_quality_type="0000"
+VP__CWORD31__tune_knob_push="available"
+VP__CWORD31__screen_switch_seek="unavailable"
+VP__CWORD31__DAB_antenna="unavailable"
+VP__CWORD31__hard_switch_beep="no_beep"
+VP__CWORD31__screen_switch_beep="beep"
+VP__CWORD31__steering_switch_type="2line_crosswise"
+VP__CWORD31__steering_switch_tel="1buttom"
+VP__CWORD31__class_circuit_mode="unavailable"
+VP__CWORD31___CWORD67__warning="unavailable"
+VP__CWORD31___CWORD67__accelerator="unavailable"
+VP__CWORD31__panel_microcomputer="available"
+VP__CWORD31__class_watch_at_brake_hold="unavailable"
+VP__CWORD31__GPS_antenna="available"
+VP__CWORD31__vehicle_signal_ILL="available"
+VP__CWORD31__switch_trigger="unavailable"
+VP__CWORD31__sensitivity_level="unavailable"
+VP__CWORD31__invalidity_term="500"
+VP__CWORD31__thumbnail_type="unavailable"
+VP__CWORD31__BT_device_name="CAR MULTIMEDIA"
+VP__CWORD31__eco_drive_max_volume="no_restriction"
+VP__CWORD31__EOM_function="unavailable"
+VP__CWORD31__Microphone_Type="_CWORD71__array"
+VP__CWORD31__Microphone_Location="ohc"
+VP__CWORD31__Wide_band_FM="unavailable"
+VP__CWORD31__display_type="one_screen_8"
+VP__CWORD31__clock_display="not_need"
+VP__CWORD31__destination="[]"
+VP__CWORD31__class_operation="touch"
+VP__CWORD31__opening_interval="1"
+VP__CWORD31__DES_function="unavailable"
+VP__CWORD31__beep_sound_keys=""
+VP_VEHICLEPARAMETERLIBRARY_SER_serial="00000000000"
+VP_VEHICLEPARAMETERLIBRARY_SER_HELPNET_ID="000000000000000000000"
+VP_VEHICLEPARAMETERLIBRARY_SER_map_update_ID="0000000000000000"
+VP_VEHICLEPARAMETERLIBRARY_SER_ship_date="00000000"
+VP_VEHICLEPARAMETERLIBRARY_SER_FACTORY_ID="0000000000000000000"
+BT_ADDR=""
+BT_DIAL=""
diff --git a/video_in_hal/agl-systemd/launch_sm.service b/video_in_hal/agl-systemd/launch_sm.service
new file mode 100755
index 0000000..8edc914
--- /dev/null
+++ b/video_in_hal/agl-systemd/launch_sm.service
@@ -0,0 +1,22 @@
+[Unit]
+Description=launch_sm
+After=setup_refhw.service agl-trigger.service
+
+[Service]
+PermissionsStartOnly=yes
+EnvironmentFile=/tool_9E_SI/env.txt
+ExecStartPre=/tool_9E_SI/set_cgroup_rt_runtime_us.sh 950000
+ExecStart=/tool_9E_SI/launch_sm.sh
+Type=oneshot
+User=root
+StandardOutput=inherit
+StandardError=inherit
+RemainAfterExit=yes
+LimitAS=infinity
+LimitRSS=infinity
+LimitCORE=infinity
+LimitNOFILE=65536
+LimitMSGQUEUE=infinity
+
+[Install]
+WantedBy=multi-user.target
diff --git a/video_in_hal/agl-systemd/options.conf b/video_in_hal/agl-systemd/options.conf
new file mode 100755
index 0000000..05c48d9
--- /dev/null
+++ b/video_in_hal/agl-systemd/options.conf
@@ -0,0 +1,2 @@
+[Mount]
+Options=rw,nodev
diff --git a/video_in_hal/agl-systemd/setup_refhw.service b/video_in_hal/agl-systemd/setup_refhw.service
new file mode 100755
index 0000000..427dfed
--- /dev/null
+++ b/video_in_hal/agl-systemd/setup_refhw.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Initialize Reference Hardware Settings
+#After=weston.service
+
+[Service]
+EnvironmentFile=/tool_9E_SI/env.txt
+ExecStart=/tool_9E_SI/setup_refhw.sh
+Type=oneshot
+#StandardInput=tty
+#TTYPath=/dev/tty1
+#TTYReset=yes
+#TTYVHangup=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/video_in_hal/agl-systemd/systemd-udev-trigger.service b/video_in_hal/agl-systemd/systemd-udev-trigger.service
new file mode 100755
index 0000000..07a3f30
--- /dev/null
+++ b/video_in_hal/agl-systemd/systemd-udev-trigger.service
@@ -0,0 +1,22 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=udev Coldplug all Devices
+Documentation=man:udev(7) man:systemd-udevd.service(8)
+DefaultDependencies=no
+Wants=systemd-udevd.service
+After=systemd-udevd-kernel.socket systemd-udevd-control.socket systemd-hwdb-update.service
+Before=sysinit.target
+ConditionPathIsReadWrite=/sys
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+EnvironmentFile=/tool_9E_SI/env.txt
+ExecStartPre=/tool_9E_SI/set_capability.sh
+ExecStart=/bin/udevadm trigger --type=subsystems --action=add ; /bin/udevadm trigger --type=devices --action=add
diff --git a/video_in_hal/agl-systemd/tool_9E_SI/agl_set_capability.sh b/video_in_hal/agl-systemd/tool_9E_SI/agl_set_capability.sh
new file mode 100755
index 0000000..6b108ae
--- /dev/null
+++ b/video_in_hal/agl-systemd/tool_9E_SI/agl_set_capability.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ROMFILESTOP=/
+CAP_LST=${ROMFILESTOP}/usr/target/agl_cap.lst
+echo `cat ${CAP_LST}`
+#-----------------------------------------------------------------------
+# Capability
+
+df -T / | grep nfs > /dev/null
+IS_EMMC_BOOT=$?
+
+#*********************from init_nfs_cap.sh**************************
+
+echo "init_nfs-cap.sh: Start"
+
+VERBOSE=y
+SKIPWARN=n
+#-----------------------------------------------------------------------
+# Set Capability for NFS or Set DummyLink for ROM
+#CAP_LST="/usr/debug/share/target/cap.lst"
+CAP_LST="/usr/target/agl_cap.lst"
+
+if [ $IS_EMMC_BOOT -eq 0 ]; then
+if [ -f "${CAP_LST}" ];then
+ echo "*** set capability for NFS environment ***"
+ CAPPATH=/tmp/
+ cd /
+ for PREAD in `cat ${CAP_LST}`
+ do
+ IFS_ORG=${IFS} ; IFS='|' ; PARAM=(${PREAD}) ; IFS=${IFS_ORG}
+ CAP_NAME=${PARAM[0]} ; FMODE=${PARAM[1]} ; FUID_GID=${PARAM[2]}
+ FCAP=${PARAM[3]} ; FKEEPORGPATH=${PARAM[4]}
+ if [ ! -f "${CAP_NAME}" -a ! -f "${CAP_NAME}.org" ];then
+ if [ "${SKIPWARN}" = "n" ];then
+ echo "set capability: ${CAP_NAME}: No such file or directory" 1>&2
+ fi
+ continue
+ fi
+ TCAP_NAME="/tmp/${CAP_NAME##*/}"
+ # Set Capability for NFS
+ if [ ! -L "${CAP_NAME}" ]; then
+ cp -a ${CAP_NAME} ${TCAP_NAME}
+ if [ "${FKEEPORGPATH}" = "y" ];then
+ mv ${CAP_NAME} ${CAP_NAME}.org
+ ln -fs ${TCAP_NAME} ${CAP_NAME}
+ fi
+ else
+ cp -a ${CAP_NAME}.org ${TCAP_NAME}
+ fi
+ if [ -n "${FUID_GID}" ];then
+ chown ${FUID_GID} ${TCAP_NAME}
+ fi
+ if [ -n "${FMODE}" ];then
+ chmod ${FMODE} ${TCAP_NAME}
+ fi
+ if [ -n "${FCAP}" ];then
+ setcap ${FCAP} ${TCAP_NAME}
+ #if [ "${VERBOSE}" = "y" ];then
+ # getcap ${TCAP_NAME}
+ #fi
+ fi
+ done
+ cd - > /dev/null
+else
+ unset CAPPATH
+fi
+fi
diff --git a/video_in_hal/agl-systemd/tool_9E_SI/launch_sm.sh b/video_in_hal/agl-systemd/tool_9E_SI/launch_sm.sh
new file mode 100755
index 0000000..ed1e8d1
--- /dev/null
+++ b/video_in_hal/agl-systemd/tool_9E_SI/launch_sm.sh
@@ -0,0 +1,26 @@
+#!/bin/bash -x
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# launch SS_SystemManager
+export APPS_CONFIG_FILENAME=sm_launch.cfg
+export SM_CONFIG_DATA_FILENAME=gpf_ss_sm_config_data.cfg
+export XDG_RUNTIME_DIR=/run/user/0
+cd /usr/agl/bin/
+rm -rf /nv/romaccess
+rm /dev/shm/lockfile
+
+/usr/agl/bin/SS_SystemManager &
diff --git a/video_in_hal/agl-systemd/tool_9E_SI/set_capability.sh b/video_in_hal/agl-systemd/tool_9E_SI/set_capability.sh
new file mode 100755
index 0000000..c16ab4a
--- /dev/null
+++ b/video_in_hal/agl-systemd/tool_9E_SI/set_capability.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ROMFILESTOP=/
+CAP_LST=${ROMFILESTOP}/usr/target/cap.lst
+echo `cat ${CAP_LST}`
+#-----------------------------------------------------------------------
+# Capability
+
+df -T / | grep nfs > /dev/null
+IS_EMMC_BOOT=$?
+
+#*********************from init_nfs_cap.sh**************************
+
+echo "init_nfs-cap.sh: Start"
+
+VERBOSE=y
+SKIPWARN=n
+#-----------------------------------------------------------------------
+# Set Capability for NFS or Set DummyLink for ROM
+#CAP_LST="/usr/debug/share/target/cap.lst"
+CAP_LST="/usr/target/cap.lst"
+
+if [ $IS_EMMC_BOOT -eq 0 ]; then
+if [ -f "${CAP_LST}" ];then
+ echo "*** set capability for NFS environment ***"
+ CAPPATH=/tmp/
+ cd /
+ for PREAD in `cat ${CAP_LST}`
+ do
+ IFS_ORG=${IFS} ; IFS='|' ; PARAM=(${PREAD}) ; IFS=${IFS_ORG}
+ CAP_NAME=${PARAM[0]} ; FMODE=${PARAM[1]} ; FUID_GID=${PARAM[2]}
+ FCAP=${PARAM[3]} ; FKEEPORGPATH=${PARAM[4]}
+ if [ ! -f "${CAP_NAME}" -a ! -f "${CAP_NAME}.org" ];then
+ if [ "${SKIPWARN}" = "n" ];then
+ echo "set capability: ${CAP_NAME}: No such file or directory" 1>&2
+ fi
+ continue
+ fi
+ TCAP_NAME="/tmp/${CAP_NAME##*/}"
+ # Set Capability for NFS
+ if [ ! -L "${CAP_NAME}" ]; then
+ cp -a ${CAP_NAME} ${TCAP_NAME}
+ if [ "${FKEEPORGPATH}" = "y" ];then
+ mv ${CAP_NAME} ${CAP_NAME}.org
+ ln -fs ${TCAP_NAME} ${CAP_NAME}
+ fi
+ else
+ cp -a ${CAP_NAME}.org ${TCAP_NAME}
+ fi
+ if [ -n "${FUID_GID}" ];then
+ chown ${FUID_GID} ${TCAP_NAME}
+ fi
+ if [ -n "${FMODE}" ];then
+ chmod ${FMODE} ${TCAP_NAME}
+ fi
+ if [ -n "${FCAP}" ];then
+ setcap ${FCAP} ${TCAP_NAME}
+ if [ "${VERBOSE}" = "y" ];then
+ getcap ${TCAP_NAME}
+ fi
+ fi
+ done
+ cd - > /dev/null
+else
+ unset CAPPATH
+fi
+fi
diff --git a/video_in_hal/agl-systemd/tool_9E_SI/set_cgroup_rt_runtime_us.sh b/video_in_hal/agl-systemd/tool_9E_SI/set_cgroup_rt_runtime_us.sh
new file mode 100755
index 0000000..41536f2
--- /dev/null
+++ b/video_in_hal/agl-systemd/tool_9E_SI/set_cgroup_rt_runtime_us.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+desired_rt_runtime_us=$1
+mygroup=${2:-$(awk -F: '$2 == "cpu,cpuacct" {print $3}' /proc/self/cgroup)}
+
+[[ $desired_rt_runtime_us -gt 0 ]] || exit
+[[ $mygroup ]] || exit
+[[ $mygroup = / ]] && exit
+
+echo "${0##*/}: setting cpu.rt_runtime_us for $mygroup" >&2
+
+cgpath=
+IFS=/ read -ra cgroups <<< "${mygroup:1}"
+for cg in "${cgroups[@]}"; do
+ cgpath="${cgpath}/${cg}"
+ echo "${0##*/}: $desired_rt_runtime_us -> /sys/fs/cgroup/cpu,cpuacct${cgpath}" >&2
+ echo "$desired_rt_runtime_us" > /sys/fs/cgroup/cpu,cpuacct${cgpath}/cpu.rt_runtime_us
+done
diff --git a/video_in_hal/agl-systemd/tool_9E_SI/setup_refhw.sh b/video_in_hal/agl-systemd/tool_9E_SI/setup_refhw.sh
new file mode 100755
index 0000000..e3f33a4
--- /dev/null
+++ b/video_in_hal/agl-systemd/tool_9E_SI/setup_refhw.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+#
+# @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#to expand msg_max
+sysctl -w fs.mqueue.msg_max=512
+
+# device detection
+echo -n "TARGET_BOARD=" > /tmp/udev_device.env
+cat /proc/device-tree/model | cut -d " " -f 2 >> /tmp/udev_device.env
+echo >> /tmp/udev_device.env
+echo "UID=$INIT_UID" >> /tmp/udev_device.env
+echo "GID=$INIT_GID" >> /tmp/udev_device.env
+echo "BRAND=$VEHICLEPARAMETERLIBRARY_BRAND" >> /tmp/udev_device.env
+echo "AREA=$VEHICLEPARAMETERLIBRARY_AREA" >> /tmp/udev_device.env
+
+# Start: Workaround for release ###############################################
+## Sprint 29 To make WebService can update contents.
+#chown -R agl:agl /usr/agl/data/electronicom
+## For btservice initial data.
+#chown -R agl:agl /nv/backup/D_BK_CA_BT_MANAGEMENT
+## Sprint 29 PFDRECThread
+mkdir -p /ramd/BS/ns/backup_manager/rwdata
+mkdir -p /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/diag
+restorecon -R /ramd
+#chmod 777 /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/diag
+## Sprint 29 communication
+#chmod -R 777 /home/root/.app_can_d
+# TODO:for bluetooth_service
+#chmod 777 /usr/agl/share
+
+#if `df -T / | grep nfs > /dev/null`; then
+#cp /sbin/insmod.kmod /tmp/insmod.kmod
+#ln -s -f /tmp/insmod.kmod /sbin/insmod
+#setcap cap_sys_module+ep /tmp/insmod.kmod
+#fi
+
+## Sprint 32 Positioning
+#chmod 777 /dev/ttySC3
+#chmod -R 777 /home/root/.app_gps_cmd_d
+
+## Sprint 37 BUG17P-9 clock
+ln -f -s /tmp/bs/clock/localtime /etc/localtime
+
+# END: Workaround for release #################################################
+
+# permission setting
+# wait for weston is properly launched
+#until [ -e /run/user/0/wayland-0 ]
+#do
+# usleep 50000
+#done
+#chmod 777 /run/user/0/wayland-0
+
+mkdir /tmp/shm
+
+chmod 777 /tmp/shm
+chmod 666 /dev/mqueue/IccSnd
+#chmod 777 /dev/mqueue/*
+#chmod 777 /dev/mqueue/NS_NPPService
+#chmod 777 /run/user/0
+
+rm -rf /nv/romaccess
+rm /dev/shm/lockfile
+
+
+
+
+export PATH=`echo -n ${PATH} | sed 's|/tmp:||'`
+
diff --git a/video_in_hal/agl-systemd/usr/target/agl_cap.lst b/video_in_hal/agl-systemd/usr/target/agl_cap.lst
new file mode 100755
index 0000000..89ea096
--- /dev/null
+++ b/video_in_hal/agl-systemd/usr/target/agl_cap.lst
@@ -0,0 +1,34 @@
+/usr/agl/bin/SS_SystemManager|||cap_sys_nice,cap_setuid,cap_setgid,cap_sys_resource+ep|y
+/usr/agl/bin/tskmgr|||cap_sys_nice,cap_setuid,cap_setgid=ep|y
+/usr/agl/bin/SS_DeviceDetectionService|||cap_setuid,cap_setgid,cap_sys_resource,cap_dac_override,cap_sys_admin+ep|y
+/usr/agl/bin/communication|||cap_dac_override+ep|y
+/usr/agl/bin/AS_AudioManager|||cap_sys_nice+ep|y
+/usr/agl/bin/acmsrv|||cap_dac_override,cap_sys_admin,cap_sys_nice,cap_sys_resource,cap_chown,cap_fowner,cap_setgid,cap_setuid,cap_kill+ep|y
+/usr/agl/bin/PS_SwitchHandler|||cap_sys_admin,cap_dac_override+ep|y
+/usr/agl/bin/LockManager|||cap_kill+ep|y
+/usr/agl/bin/nandupdate|||cap_dac_override+ep|y
+/usr/agl/bin/wlan_controller|||cap_net_raw,cap_net_admin+ep|y
+/usr/agl/bin/DummyRead|||cap_dac_read_search+ep|y
+/usr/agl/bin/clock|||cap_sys_time+ep|y
+/usr/agl/bin/Mounter|||cap_sys_admin,cap_dac_override+ep|y
+/usr/agl/bin/MounterEx|||cap_sys_admin,cap_fowner,cap_dac_override,cap_chown+ep|y
+/usr/agl/bin/DevReproService|||cap_chown,cap_fowner,cap_dac_override+ep|y
+/usr/agl/bin/PS_CDR|||cap_sys_admin+ep|y
+/usr/agl/bin/webdavmgr|||cap_net_admin,cap_net_raw+ep|y
+/usr/agl/bin/DiagService|||cap_sys_rawio,cap_dac_override+ep|y
+/usr/agl/bin/resm|||cap_setuid+ep|y
+/usr/agl/bin/SS_LoggerService|||cap_dac_override+ep|y
+/usr/agl/bin/NetworkManager|||cap_setuid,cap_setgid,cap_sys_admin,cap_chown,cap_kill,cap_net_raw,cap_net_admin,cap_net_bind_service+ep|y
+/usr/agl/bin/RadioService|||cap_sys_nice+ep|y
+/usr/agl/bin/ASND_VProxy|||cap_sys_nice+ep|y
+/usr/agl/bin/misink|||cap_sys_nice+ep|y
+/usr/agl/bin/mlink|||cap_sys_nice+ep|y
+/usr/agl/bin/media_service|||cap_dac_override,cap_sys_nice+ep|y
+/usr/agl/bin/_CWORD74__service|||cap_dac_override+ep|y
+/usr/agl/bin/PlaybackService|||cap_sys_nice+ep|y
+/usr/agl/bin/Positioning|||cap_dac_override+ep|y
+/usr/agl/bin/vehicle|||cap_dac_override+ep|y
+/usr/agl/bin/bluetooth_srv|||cap_dac_override,cap_sys_nice+ep|y
+/usr/agl/bin/btd_srv|||cap_dac_override,cap_sys_nice+ep|y
+/usr/agl/bin/NS_BackupMgr|||cap_dac_override+ep|y
+/usr/agl/bin/Sound|||cap_dac_override+ep|y
diff --git a/video_in_hal/agl-systemd/usr/target/cap.lst b/video_in_hal/agl-systemd/usr/target/cap.lst
new file mode 100755
index 0000000..c27de10
--- /dev/null
+++ b/video_in_hal/agl-systemd/usr/target/cap.lst
@@ -0,0 +1,24 @@
+/bin/udevadm|||cap_dac_override+ep|y
+/sbin/ifconfig|||cap_net_admin+ep|y
+/usr/libexec/firmware|||cap_sys_rawio,cap_dac_override+ep|y
+/usr/bin/fusedav|||cap_sys_admin+ep|y
+/sbin/dhclient|||cap_net_bind_service,cap_net_admin,cap_net_raw,cap_chown,cap_kill,cap_sys_admin+ep|y
+/sbin/dhcpd|||cap_net_bind_service,cap_net_admin,cap_net_raw,cap_chown,cap_kill,cap_sys_admin+ep|y
+/usr/debug/bin/busybox|||cap_sys_module,cap_net_raw+ep|y
+/sbin/insmod|||cap_sys_module+ep|y
+/sbin/rmmod|||cap_sys_module+ep|y
+/usr/sbin/xtables-multi|||cap_net_raw,cap_net_admin+ep|y
+/usr/bin/fusermount|||cap_sys_admin+ep|y
+/usr/bin/simple-mtpfs|||cap_sys_admin+ep|y
+/sbin/slattach|||cap_net_admin+ep|y
+/sbin/mkfs.ext4|||cap_dac_override+ep|y
+/sbin/losetup|||cap_dac_override+ep|y
+/usr/bin/aplay|||cap_sys_nice+ep|y
+/usr/bin/modetest|||cap_sys_admin+ep|y
+/sbin/fsck.ext4|||cap_dac_override+ep|y
+/usr/sbin/tune2fs|||cap_dac_override+ep|y
+/usr/bin/syslogd|||cap_dac_override+ep|y
+/usr/bin/dnsmasq|||cap_net_bind_service,cap_net_admin,cap_net_raw,cap_chown,cap_kill,cap_setgid,cap_setuid,cap_sys_admin+ep|y
+/usr/sbin/pppd|||cap_setuid,cap_sys_admin,cap_chown,cap_fowner,cap_kill,cap_net_admin,cap_dac_override+ep|y
+/sbin/ip|||cap_net_bind_service,cap_net_admin,cap_net_raw+ep|y
+/usr/bin/arping|||cap_net_bind_service,cap_net_admin,cap_net_raw,cap_setuid+ep|y
diff --git a/video_in_hal/agl-systemd/usr/target/dir.lst b/video_in_hal/agl-systemd/usr/target/dir.lst
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/video_in_hal/agl-systemd/usr/target/dir.lst
diff --git a/video_in_hal/agl-systemd/usr/target/mntfs.lst b/video_in_hal/agl-systemd/usr/target/mntfs.lst
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/video_in_hal/agl-systemd/usr/target/mntfs.lst
diff --git a/video_in_hal/boot_hal/LICENSE b/video_in_hal/boot_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/boot_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/boot_hal/Makefile b/video_in_hal/boot_hal/Makefile
new file mode 100755
index 0000000..d184316
--- /dev/null
+++ b/video_in_hal/boot_hal/Makefile
@@ -0,0 +1,65 @@
+#
+# @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libboot_hal.so
+
+HEADER := hal_api/boot_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := boot_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/video_in_hal/boot_hal/hal_api/boot_hal.h b/video_in_hal/boot_hal/hal_api/boot_hal.h
new file mode 100755
index 0000000..783db97
--- /dev/null
+++ b/video_in_hal/boot_hal/hal_api/boot_hal.h
@@ -0,0 +1,228 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_BOOT_HAL_H_
+#define HAL_API_BOOT_HAL_H_
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * @file boot_hal.h
+ * @brief This file provides API for get boot info from boot device, set boot info to boot device,
+ * set next boot mode to coldstart and get current boot mode
+ */
+
+/** @addtogroup reproservice
+ * @{
+ */
+/** @addtogroup boot_hal
+ * @ingroup reprogramming_service
+ * @{
+ */
+
+/**
+ * \~english BootHalBootMode
+ */
+enum BootHalBootMode{
+ /**
+ * \~english cold start
+ */
+ COLD_START = 0,
+ /**
+ * \~english hot start
+ */
+ HOT_START = 1,
+};
+
+/**
+ * \~english BootHalUpTableID
+ */
+enum BootHalUpTableID{
+ /**
+ * \~english UBOOT
+ */
+ BOOTHAL_SIDE_IDX_UBOOT = 0,
+ /**
+ * \~english Secure loader
+ */
+ BOOTHAL_SIDE_IDX_SECURE = 1,
+ /**
+ * \~english MAIN software
+ */
+ BOOTHAL_SIDE_IDX_MAINSOFT = 2,
+ /**
+ * \~english Max num of modules(include reserves)
+ */
+ BOOTHAL_NUMTARGS = 20
+};
+
+/**
+ * \~english BootHalStatus
+ */
+typedef enum BootHalStatus {
+/**
+ * \~english Success
+ */
+ BOOTHAL_RET_SUCCESS = 0,
+/**
+ * \~english No permission to operate
+ */
+ BOOTHAL_RET_ERR_PERMISSION = 1,
+/**
+ * \~english Time out
+ */
+ BOOTHAL_RET_ERR_TIMEOUT = 2,
+/**
+ * \~english Status error
+ */
+ BOOTHAL_RET_ERR_STATUS = 3,
+/**
+ * \~english Write error
+ */
+ BOOTHAL_RET_ERR_WRITE = 4,
+/**
+ * \~english Paramater error
+ */
+ BOOTHAL_RET_ERR_PARAM = 5,
+/**
+ * \~english Internal IO error(open, read, write, strstr, close)
+ */
+ BOOTHAL_RET_ERR_FAIL = 6,
+} BootHalStatus;
+
+/**
+ * \~english Not rewrite.
+ */
+#define BOOTHAL_SIDE_NONE 0
+/**
+ * \~english Rewrites side A.
+ */
+#define BOOTHAL_SIDE_A 1
+/**
+ * \~english Rewrites side B.
+ */
+#define BOOTHAL_SIDE_B 2
+/**
+ * \~english Max parameter num
+ */
+#define BOOTHAL_NUMSIDE_MAX 3
+
+/**\ingroup setSide
+ * \~english @par Brief
+ * This API set boot info to boot device, the caller control this API not be called at the
+ * same time
+ * \~english @param [in] upTableID
+ * unsigned int - Boot info
+ * \~english @retval BOOTHAL_RET_SUCCESS OK
+ * \~english @retval BOOTHAL_RET_ERR_PARAM Parameter error
+ * \~english @retval BOOTHAL_RET_ERR_WRITE Write error
+ * \~english @retval BOOTHAL_RET_ERR_FAIL Internal IO error
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter upTableId is NULL. [BOOTHAL_RET_ERR_PARAM]
+ * - If write /dev/mmcblk0boot1 return -1. [BOOTHAL_RET_ERR_WRITE]
+ * - Internal IO error(open, read, lseek). [BOOTHAL_RET_ERR_FAIL]
+ * \~english @par Detail
+ * - This API set boot info.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see getSide
+ */
+BootHalStatus setSide(unsigned int upTableID[]);
+
+/**\ingroup getSide
+ * \~english @par Brief
+ * Get boot info from boot device
+ * \~english @param [out] upTableID
+ * unsigned int - boot info
+ * \~english @retval BOOTHAL_RET_SUCCESS OK
+ * \~english @retval BOOTHAL_RET_ERR_PARAM Parameter error
+ * \~english @retval BOOTHAL_RET_ERR_FAIL Internal IO error
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter upTableId is NULL. [BOOTHAL_RET_ERR_PARAM]
+ * - Internal IO error.[BOOTHAL_RET_ERR_FAIL]
+ * \~english @par Detail
+ * - This API get boot info from boot device.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see setSide
+ */
+BootHalStatus getSide(unsigned int upTableID[]);
+
+/**\ingroup setBootColdStart
+ * \~english @par Brief
+ * Set next boot to ColdStart mode.
+ * \~english @retval BOOTHAL_RET_SUCCESS OK
+ * \~english @retval BOOTHAL_RET_ERR_FAIL set next boot start mode failed
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error.[BOOTHAL_RET_ERR_FAIL]
+ * \~english @par Detail
+ * - This API Set next boot to ColdStart mode.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see getBootMode
+ */
+BootHalStatus setBootColdStart(void);
+
+/**\ingroup getBootMode
+ * \~english @par Brief
+ * Get boot mode.
+ * \~english @param [out] mode
+ * unsigned int - boot mode(COLD_START or HOT_START)
+ * \~english @retval BOOTHAL_RET_SUCCESS OK
+ * \~english @retval BOOTHAL_RET_ERR_PARAM Parameter error
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter mode is NULL. [BOOTHAL_RET_ERR_PARAM]
+ * \~english @par Detail
+ * - This API get boot mode.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see setBootColdStart
+ */
+BootHalStatus getBootMode(uint32_t *mode);
+
+/** @}*/ // end of boot_hal
+/** @}*/ // end of reprogramming_service
+
+#endif // HAL_API_BOOT_HAL_H_
diff --git a/video_in_hal/boot_hal/inc/boot_hal_boothallog.h b/video_in_hal/boot_hal/inc/boot_hal_boothallog.h
new file mode 100755
index 0000000..4a037ee
--- /dev/null
+++ b/video_in_hal/boot_hal/inc/boot_hal_boothallog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_BOOT_HAL_BOOTHALLOG_H_
+#define INC_BOOT_HAL_BOOTHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_BOOT_HAL_BOOTHALLOG_H_
diff --git a/video_in_hal/boot_hal/src/boot_hal.cpp b/video_in_hal/boot_hal/src/boot_hal.cpp
new file mode 100755
index 0000000..d4d5581
--- /dev/null
+++ b/video_in_hal/boot_hal/src/boot_hal.cpp
@@ -0,0 +1,313 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <boot_hal.h>
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/vfs.h>
+
+#include <cstdio>
+#include <cerrno>
+#include <cstring>
+
+#include "boot_hal_boothallog.h"
+
+#define BOOT_PARTATION "/dev/mmcblk0boot1"
+#define BOOTINFO_FILEA "/repro/mmcblk0boot1-launch_a.bin"
+#define BOOTINFO_FILEB "/repro/mmcblk0boot1-launch_b.bin"
+
+#define MMCBLK0BOOT1_FORCE_RO "/sys/class/block/mmcblk0boot1/force_ro"
+#define MMCBLK0BOOT1_SIZE_PATH "/sys/class/block/mmcblk0boot1/size"
+#define MMCBLK0BOOT1_SIZE_DEF (0x1000000)
+#define BOOTINFO_SIZE (0x20000)
+#define SECTOR_SIZE (512)
+#define FILEPATH_MAX (256)
+
+#define BOOT_CMDLINE "/proc/cmdline"
+#define CMDLINE_MAX_SIZE (256)
+#define BOOT_ROOTFS_A "/dev/mmcblk0p1"
+#define BOOT_ROOTFS_B "/dev/mmcblk0p2"
+#define BOOTARGS_LST_ROOT "root="
+
+
+#define BOOT_COPYBUF_SIZE (64 * 1024)
+
+static int EnableMmcBlk(const char *path) {
+ int fd;
+ char enable[] = "0";
+
+ if ((fd = open(path, O_RDWR)) < 0) {
+ return -1;
+ }
+
+ if (write(fd, enable, sizeof(enable)) < 0) {
+ close(fd);
+ return -1;
+ }
+
+ close(fd);
+ return 0;
+}
+
+static int GetMmcBlkCount(const char *path) {
+ int fd;
+ char block_size[16] = {0};
+
+ if ((fd = open(path, O_RDONLY)) < 0) {
+ return -1;
+ }
+
+ if (read(fd, block_size, sizeof(block_size)) < 0) {
+ close(fd);
+ return -1;
+ }
+
+ close(fd);
+ return strtol(block_size, NULL, 10);
+}
+
+static ssize_t BootReadN(int fd, void *buffer, size_t n) {
+ size_t tot_read;
+ char *buf;
+
+ buf = reinterpret_cast<char *>(buffer);
+ for (tot_read = 0; tot_read < n;) {
+ ssize_t num_read;
+ num_read = read(fd, buf, n - tot_read);
+
+ if (num_read == 0) {
+ return tot_read;
+ }
+ if (num_read == -1) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ return -1;
+ }
+ }
+ tot_read += num_read;
+ buf += num_read;
+ }
+ return tot_read;
+}
+
+static ssize_t BootWriteN(int fd, const void *buffer, size_t n) {
+ size_t tot_written;
+ const char *buf;
+
+ buf = (const char *)buffer;
+ for (tot_written = 0; tot_written < n;) {
+ ssize_t num_written;
+ num_written = write(fd, buf, n - tot_written);
+
+ if (num_written <= 0) {
+ if (num_written == -1 && errno == EINTR) {
+ continue;
+ } else {
+ return -1;
+ }
+ }
+ tot_written += num_written;
+ buf += num_written;
+ }
+ return tot_written;
+}
+
+BootHalStatus setSide(unsigned int upTableID[]) {
+ BootHalStatus ret = BOOTHAL_RET_ERR_FAIL;
+ int binfo_fd = -1;
+ int mmc_fd = -1;
+ int sector_count = 0;
+ char *buf = NULL;
+ char binfo_file[FILEPATH_MAX] = {0};
+ off_t mmc_offset;
+
+ if (NULL == upTableID) {
+ return BOOTHAL_RET_ERR_PARAM;
+ }
+
+ if (upTableID[BOOTHAL_SIDE_IDX_MAINSOFT] == BOOTHAL_SIDE_A) {
+ snprintf(binfo_file, FILEPATH_MAX, "%s", BOOTINFO_FILEA);
+ } else if (upTableID[BOOTHAL_SIDE_IDX_MAINSOFT] == BOOTHAL_SIDE_B) {
+ snprintf(binfo_file, FILEPATH_MAX, "%s", BOOTINFO_FILEB);
+ } else {
+ ret = BOOTHAL_RET_ERR_PARAM;
+ goto exit;
+ }
+
+ binfo_fd = open(binfo_file, O_RDONLY);
+ if (binfo_fd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "open %s:%s", binfo_file, strerror(errno));
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ mmc_fd = open(BOOT_PARTATION, O_WRONLY);
+ if (mmc_fd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "open %s:%s", BOOT_PARTATION, strerror(errno));
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ /*
+ * enable mmcblk0boot1 for write
+ */
+ if (EnableMmcBlk(MMCBLK0BOOT1_FORCE_RO) < 0) {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ /*
+ * Get sector count of mmcblk0boot1 block from sys-file, every sector size is 512byte.
+ * The mmcblk0boot1 block default size is 16M.
+ */
+ if ((sector_count = GetMmcBlkCount(MMCBLK0BOOT1_SIZE_PATH)) < 0) {
+ mmc_offset = MMCBLK0BOOT1_SIZE_DEF - BOOTINFO_SIZE;
+ } else {
+ mmc_offset = sector_count * SECTOR_SIZE - BOOTINFO_SIZE;
+ }
+
+ /*
+ * The environment should be write to the latest 128K of mmcblk0boot1.
+ */
+ if (lseek(mmc_fd, mmc_offset, SEEK_SET) < 0) {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ buf = reinterpret_cast<char *>(mmap(NULL, BOOT_COPYBUF_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
+ if (buf == MAP_FAILED) {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ while (1) {
+ ssize_t rd, wr;
+
+ rd = BootReadN(binfo_fd, buf, BOOT_COPYBUF_SIZE);
+ if (!rd) {
+ // EOF
+ break;
+ }
+ if (rd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "read:%s", strerror(errno));
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ wr = BootWriteN(mmc_fd, buf, rd);
+ if (wr < rd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "write(%s):%s", BOOT_PARTATION, strerror(errno));
+ ret = BOOTHAL_RET_ERR_WRITE;
+ goto exit;
+ }
+ }
+
+ if (fsync(mmc_fd) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "fsync:%s", strerror(errno));
+ }
+ ret = BOOTHAL_RET_SUCCESS;
+
+exit:
+ if (binfo_fd >= 0) {
+ if (close(binfo_fd) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "close:%s", strerror(errno));
+ }
+ }
+
+ if (mmc_fd >= 0) {
+ if (close(mmc_fd) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "close:%s", strerror(errno));
+ }
+ }
+
+ if (buf) {
+ munmap(buf, BOOT_COPYBUF_SIZE);
+ }
+
+ return ret;
+}
+
+BootHalStatus getSide(unsigned int upTableID[]) {
+ BootHalStatus ret = BOOTHAL_RET_SUCCESS;
+ int fd;
+ int rd_size;
+ char buf[CMDLINE_MAX_SIZE] = {0};
+ char *rootfs = NULL;
+
+ if (NULL == upTableID) {
+ return BOOTHAL_RET_ERR_PARAM;
+ }
+
+ if ((fd = open(BOOT_CMDLINE, O_RDONLY)) < 0) {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ if ((rd_size = BootReadN(fd, buf, CMDLINE_MAX_SIZE)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "read %s error:%s", BOOT_CMDLINE, strerror(errno));
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ rootfs = strstr(buf, BOOTARGS_LST_ROOT);
+ if (!rootfs) {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ goto exit;
+ }
+
+ rootfs += strlen(BOOTARGS_LST_ROOT);
+ if (strncmp(rootfs, BOOT_ROOTFS_A, strlen(BOOT_ROOTFS_A)) == 0 &&
+ (rootfs[strlen(BOOT_ROOTFS_A)] == ' ' || rootfs[strlen(BOOT_ROOTFS_A)] == '\0')) {
+ upTableID[BOOTHAL_SIDE_IDX_MAINSOFT] = BOOTHAL_SIDE_A;
+ } else if (strncmp(rootfs, BOOT_ROOTFS_B, strlen(BOOT_ROOTFS_B)) == 0 &&
+ (rootfs[strlen(BOOT_ROOTFS_B)] == ' ' || rootfs[strlen(BOOT_ROOTFS_B)] == '\0')) {
+ upTableID[BOOTHAL_SIDE_IDX_MAINSOFT] = BOOTHAL_SIDE_B;
+ } else {
+ ret = BOOTHAL_RET_ERR_FAIL;
+ }
+
+exit:
+ if (fd >= 0) {
+ if (close(fd) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "close:%s", strerror(errno));
+ }
+ }
+
+ return ret;
+}
+
+BootHalStatus setBootColdStart(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return BOOTHAL_RET_SUCCESS;
+}
+
+BootHalStatus getBootMode(uint32_t *mode) {
+ if (NULL == mode) {
+ return BOOTHAL_RET_ERR_PARAM;
+ }
+
+ *mode = COLD_START;
+ return BOOTHAL_RET_SUCCESS;
+}
diff --git a/video_in_hal/can_hal/LICENSE b/video_in_hal/can_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/can_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/can_hal/Makefile b/video_in_hal/can_hal/Makefile
new file mode 100755
index 0000000..61e5cc2
--- /dev/null
+++ b/video_in_hal/can_hal/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := src
+
+include ./can_hal.mk
diff --git a/video_in_hal/can_hal/README.md b/video_in_hal/can_hal/README.md
new file mode 100755
index 0000000..e1a5e84
--- /dev/null
+++ b/video_in_hal/can_hal/README.md
@@ -0,0 +1,3 @@
+can_hal library
+==================
+CAN HAL implementation library for AGL Reference Board.
diff --git a/video_in_hal/can_hal/can_hal.mk b/video_in_hal/can_hal/can_hal.mk
new file mode 100755
index 0000000..19a824d
--- /dev/null
+++ b/video_in_hal/can_hal/can_hal.mk
@@ -0,0 +1,39 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME ?= can_hal
+
+#############################################################
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/video_in_hal/can_hal/hal_api/can_hal.h b/video_in_hal/can_hal/hal_api/can_hal.h
new file mode 100755
index 0000000..5f3ef4f
--- /dev/null
+++ b/video_in_hal/can_hal/hal_api/can_hal.h
@@ -0,0 +1,303 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HAL_API_CAN_HAL_H_
+#define HAL_API_CAN_HAL_H_
+/**
+ * @file can_hal.h
+ */
+
+/** @addtogroup communication
+ * @{
+ */
+/** @addtogroup can_hal
+ * @ingroup communication
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+/**
+ * \~english Max data length of nomarl can send
+ */
+#define CAN_NORMAL_MESSAGE_LEN (8)
+
+/**
+ * \~english Maximum data length
+ */
+#define CAN_MESSAGE_LEN (2048)
+
+/**
+ * \~english Maximum CAN_ID data length
+ */
+#define CAN_NUM_MAX (125)
+
+/**
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE, CID_CANHAL_CMD_CAN_SEND_STATUS, CANHalSndStsProcess);
+ * @endcode
+ * \~english Command ID to send CAN data and get the send status
+ */
+#define CID_CANHAL_CMD_CAN_SEND_STATUS (0x0A03)
+
+/**
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE, CID_CANHAL_CMD_CAN_RECV, CANHalRcvProcess);
+ * @endcode
+ * \~english Command ID to receive the CAN data
+ */
+#define CID_CANHAL_CMD_CAN_RECV (0x0A04)
+
+/**
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE, CID_CANHAL_CMD_CAN_READY, AnyCallback);
+ * @endcode
+ * \~english Command ID to receive Global CAN is ready.
+ */
+#define CID_CANHAL_CMD_CAN_READY (0x0A0C)
+
+/**
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE, CID_CANHAL_CMD_ERROR_NOTIFY, AnyCallback);
+ * @endcode
+ * \~english Command ID to receive can hal error.
+ */
+#define CID_CANHAL_CMD_ERROR_NOTIFY (0x0A10)
+
+/**
+ * \~english No target address
+ */
+#define CAN_NTA_NONE (0x00)
+
+/**
+ * \~english Size of error message.
+ */
+#define CANHAL_ERROR_MESSAGE_LEN (2048)
+
+/**
+ * \~english Return type of the API
+ */
+enum CANHAL_RET_API {
+ CANHAL_RET_NORMAL = 0, //!< \~english API Success
+ CANHAL_RET_ERR_ERR, //!< \~english API Failed
+ CANHAL_RET_ERR_PARAM, //!< \~english Parameter error
+ CANHAL_RET_ERR_STATE, //!< \~english Uninitialized(not called CanOpen)
+};
+
+/**
+ * \~english CAN type
+ */
+enum CanHalType {
+ CAN_HAL_TYPE_CAN = 0, //!< \~english CAN
+ NR_CAN_HAL_TYPES //!< \~english Number of CAN type
+};
+
+/**
+ * \~english device State
+ */
+enum DEVICE_STATE {
+ DEVICE_STATE_UNAVAILABLE, //!< \~english device unavailable
+ DEVICE_STATE_AVAILABLE, //!< \~english device available
+};
+
+/**
+ * \~english CAN Send Result
+ */
+enum CAN_SEND_RESULT {
+ CAN_SEND_RESULT_FAILURE = 0, //!< \~english Send failure
+ CAN_SEND_RESULT_SUCCESS, //!< \~english Send success
+};
+
+/**
+ * \~english structure of can data
+ */
+typedef struct CanMessageT {
+ uint32_t can_id; //!< \~english Target CAN ID
+ uint32_t dlc; //!< \~english Data length(1~2048)
+ uint8_t rid; //!< \~english Replay ID
+ uint8_t data[CAN_MESSAGE_LEN]; //!< \~english Data buffer
+} CanMessage;
+
+/**
+ * \~english structure of can send result
+ */
+typedef struct CanSendResultT {
+ uint32_t can_id; //!< \~english CAN ID
+ uint8_t rid; //!< \~english RID
+ CAN_SEND_RESULT result; //!< \~english Send result
+} CanSendResult;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \ingroup CanOpen
+ * \~english @par Brief
+ * API to start the can_hal service
+ * \~english @param [in] h_app
+ * HANDLE - Application handle
+ * \~english @param [in] type
+ * CanHalType - CAN type
+ * \~english @retval CANHAL_RET_NORMAL : API return OK
+ * \~english @retval CANHAL_RET_ERR_PARAM : Paramter error
+ * \~english @retval CANHAL_RET_ERR_ERR : Failed
+ * \~english @par Prerequisite
+ * None
+ * \~english @par Change of internal state
+ * - When calling of this API succeeds, the requested channel state is set to open.
+ * \~english @par Conditions of processing failure
+ * - Input paramter is invalid.
+ * - Internal processing failure.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Method
+ * \~english @par Detail
+ * - Perform device use preparation processing of the requested communication path.
+ * - Up to one process can use this library.
+ * \~english @see
+ * Nothing
+ */
+CANHAL_RET_API CanOpen(HANDLE h_app, CanHalType type);
+
+/**
+ * \ingroup CanClose
+ * \~english @par Brief
+ * API to stop the can_hal service
+ * \~english @param [in] h_app
+ * HANDLE - Application handle
+ * \~english @param [in] type
+ * CanHalType - CAN type
+ * \~english @retval CANHAL_RET_NORMAL : API return OK
+ * \~english @retval CANHAL_RET_ERR_PARAM : Paramter error
+ * \~english @retval CANHAL_RET_ERR_ERR : Failed
+ * \~english @retval CANHAL_RET_ERR_STATE : Failed because CanOpen is not called
+ * \~english @par Prerequisite
+ * Communication path status is open
+ * \~english @par Change of internal state
+ * - In the case of normal termination, the requested channel state is close.
+ * \~english @par Conditions of processing failure
+ * - CanOpen is not called.
+ * - Input paramter is invalid.
+ * - Internal processing failure.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Perform device use finalize processing of the requested communication path.
+ * - Up to one process can use this library.
+ * \~english @see
+ * None
+ */
+CANHAL_RET_API CanClose(HANDLE h_app, CanHalType type);
+
+/**
+ * \ingroup CanSend
+ * \~english @par Brief
+ * API to send the Can data
+ * \~english @param [in] h_app
+ * HANDLE - Application handle
+ * \~english @param [in] message
+ * const CanMessage * - Pointer to the structure of
+ * the data which is sent to the CAN
+ * \~english @param [in] type
+ * CanHalType - CAN type
+ * \~english @retval CANHAL_RET_NORMAL : API return OK
+ * \~english @retval CANHAL_RET_ERR_ERR : Failed
+ * \~english @retval CANHAL_RET_ERR_PARAM : Paramter error
+ * \~english @retval CANHAL_RET_ERR_STATE : Failed because CanOpen is not called
+ * \~english @par Prerequisite
+ * - can_hal start successfully
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Input paramter is invalid.
+ * - CanOpen is not called.
+ * - Send data to the sending thread failed.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Method
+ * \~english @par Detail
+ * - Check the sending data, if data is valid, then send the data
+ * to the sending thread; If data if invalid, then return error.
+ * - The API can only be used by 1 process.
+ * \~english @see
+ * \ref CanSendResult
+ */
+CANHAL_RET_API CanSend(HANDLE h_app, const CanMessage *message, CanHalType type);
+
+/**
+ * \ingroup CanGetVersion
+ * \~english @par Brief
+ * API to get the CAN micon version
+ * \~english @param [in] h_app
+ * HANDLE - Application handle
+ * \~english @param [out] p_version
+ * std::string * - Pointer to the version buffer
+ * \~english @retval CANHAL_RET_NORMAL : API return OK
+ * \~english @retval CANHAL_RET_ERR_STATE : Failed because CanOpen is not called
+ * \~english @retval CANHAL_RET_ERR_PARAM : Paramter error
+ * \~english @retval CANHAL_RET_ERR_ERR : Failed
+ * \~english @par Prerequisite
+ * - can_hal start successfully
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Input paramter is invalid.
+ * - CanOpen is not called.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - This API gets the CAN version.
+ * - The API can only be used by 1 process.
+ * - p_version detail\n
+ * Information on the following pink shaded part 4 BYTE in the version information \n
+ * of the CAN microcomputer is stored in string and returned.\n
+ * <table>
+ * <tr>
+ * <th></th><th>7bit-0bit</th>
+ * </tr>
+ * <tr>
+ * <td>1BYTE</td><td>7bit:M/S 6-0bit:Message kind</td>
+ * </tr>
+ * <tr>
+ * <td>2BYTE</td><td>7bit-0bit Operation Code</td>
+ * </tr>
+ * <tr>
+ * <td>3BYTE</td><td bgcolor="pink">7bit-0bit Software kind</td>
+ * </tr>
+ * <tr>
+ * <td>4BYTE</td><td bgcolor="pink">7bit-0bit version(Higher order)</td>
+ * </tr>
+ * <tr>
+ * <td>5BYTE</td><td bgcolor="pink">7bit-0bit version(middle order)</td>
+ * </tr>
+ * <tr>
+ * <td>6BYTE</td><td bgcolor="pink">7bit-0bit version(lower order)</td>
+ * </tr>
+ * </table>
+ * \~english @see
+ * None
+ */
+CANHAL_RET_API CanGetVersion(HANDLE h_app, std::string *p_version);
+
+/** @}*/ // end of can_hal
+/** @}*/ // end of communication
+#ifdef __cplusplus
+}
+#endif
+#endif // HAL_API_CAN_HAL_H_
diff --git a/video_in_hal/can_hal/src/Makefile b/video_in_hal/can_hal/src/Makefile
new file mode 100755
index 0000000..f34eb75
--- /dev/null
+++ b/video_in_hal/can_hal/src/Makefile
@@ -0,0 +1,52 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libcan_hal
+
+######### installed static library(*.a) #############
+
+######### install headers(*.h) #############
+INST_HEADERS = ../hal_api/can_hal.h
+
+######### compiled sources #############
+libcan_hal_SRCS = can_hal_core.cpp can_hal_stm.cpp can_hal_api.cpp
+libcan_hal_SRCS += driver_can__CWORD31_.c
+
+######### include paths/files ###################
+CPPFLAGS += -I./inc/
+CPPFLAGS += -I../hal_api/
+
+######### compile options #######################
+CPPFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH := /usr/lib:/usr/agl/lib
+
+######### linked library ########################
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lpthread
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+COMPONENT_NAME =
+AGL_TOPDIR ?= $(DESTDIR)/usr
+include ../can_hal.mk
diff --git a/video_in_hal/can_hal/src/can_hal_api.cpp b/video_in_hal/can_hal/src/can_hal_api.cpp
new file mode 100755
index 0000000..86a0104
--- /dev/null
+++ b/video_in_hal/can_hal/src/can_hal_api.cpp
@@ -0,0 +1,166 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "can_hal_core.h"
+#include "can_hal_stm.h"
+#include <stdio.h>
+#include <pthread.h>
+#include <string.h>
+#include <assert.h>
+
+CANHAL_RET_API CanOpen(HANDLE h_app, CanHalType type) {
+ CANHAL_RET_API ret = CANHAL_RET_ERR_ERR;
+
+ if (!TypeIsValid(type)) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!h_app) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (IsCanHalOpened(type)) {
+ return CANHAL_RET_NORMAL;
+ }
+
+ if (IsDeviceEnabled(type)) {
+ return CANHAL_RET_NORMAL;
+ }
+
+ ret = CanOpenCore(type);
+ if (CANHAL_RET_NORMAL != ret) {
+ return ret;
+ }
+
+ ret = CanHalCreateInternalThread(h_app, type);
+ if (CANHAL_RET_NORMAL != ret) {
+ CanCloseCore(type);
+ return ret;
+ }
+
+ SetDeviceStateEnable(type);
+ SetCanHalStateOpen(type);
+ InvokeStateCallback(type);
+ return ret;
+}
+
+CANHAL_RET_API CanClose(HANDLE h_app, CanHalType type) {
+ CANHAL_RET_API ret = CANHAL_RET_ERR_ERR;
+ if (!TypeIsValid(type)) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!h_app) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!IsCanHalOpened(type)) {
+ return CANHAL_RET_NORMAL;
+ }
+
+ if (IsDeviceEnabled(type)) {
+ ret = CanCloseCore(type);
+ if (CANHAL_RET_NORMAL != ret)
+ return ret;
+ }
+
+ ret = CanHalDestroyInternalThread(h_app, type);
+ if (CANHAL_RET_NORMAL != ret)
+ return ret;
+
+ SetDeviceStateDisable(type);
+ SetCanHalStateClose(type);
+ InvokeErrorCallback(h_app, type);
+
+ return ret;
+}
+
+static CANHAL_RET_API CanSendCommonCheck(const void *message,
+ enum CanHalType type) {
+ if (!TypeIsValid(type)) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!message) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!IsCanHalOpened(type)) {
+ return CANHAL_RET_ERR_STATE;
+ }
+
+ if (!IsDeviceEnabled(type)) {
+ return CANHAL_RET_ERR_STATE;
+ }
+
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API CanSend(HANDLE h_app,
+ const CanMessage *message, enum CanHalType type) {
+ CANHAL_RET_API ret = CANHAL_RET_ERR_ERR;
+ void *_message = NULL;
+ ssize_t sz = 0;
+
+ ret = CanSendCommonCheck(message, type);
+ if (ret != CANHAL_RET_NORMAL)
+ return ret;
+
+ if (!h_app) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (CAN_NORMAL_MESSAGE_LEN < message->dlc) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ _message = CanHalPackMessage(h_app, (const void *)message,
+ sizeof(CanMessage), &sz);
+ if (!_message)
+ return CANHAL_RET_ERR_ERR;
+
+ ret = CanHalInternalSend(type, _message, sz);
+ CanHalDestroyPackedMessage(_message);
+ return ret;
+}
+
+CANHAL_RET_API CanGetVersion(HANDLE h_app, std::string *p_version) {
+ CanHalType type = CAN_HAL_TYPE_CAN;
+ if (!h_app) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ if (!IsCanHalOpened(type)) {
+ return CANHAL_RET_ERR_STATE;
+ }
+
+ if (!IsDeviceEnabled(type)) {
+ return CANHAL_RET_ERR_STATE;
+ }
+
+ if (NULL == p_version) {
+ return CANHAL_RET_ERR_PARAM;
+ }
+
+ *p_version = "FFFF";
+ return CANHAL_RET_NORMAL;
+}
diff --git a/video_in_hal/can_hal/src/can_hal_core.cpp b/video_in_hal/can_hal/src/can_hal_core.cpp
new file mode 100755
index 0000000..bdbdbbc
--- /dev/null
+++ b/video_in_hal/can_hal/src/can_hal_core.cpp
@@ -0,0 +1,372 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "can_hal.h"
+#include "can_hal_core.h"
+#include "can_hal_internal.h"
+#include "can_hal_frameworkunifiedlog.h"
+#include "can_hal_stm.h"
+extern "C" {
+ #include "can_mng_api.h"
+}
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <string>
+
+static CanCtlApiObj g_driver_obj; // can driver handler
+
+typedef struct MessageWrapper {
+ HANDLE h_app;
+ void *message;
+} MessageWrapper;
+
+// define frame
+enum CANHAL_FRAME {
+ CANHAL_FRAME_SF = 0x00,
+ CANHAL_FRAME_FF,
+ CANHAL_FRAME_CF,
+ CANHAL_FRAME_NONE = 0xFF,
+};
+
+// Declaration of the local functions
+static EFrameworkunifiedStatus CanSendData(HANDLE h_app);
+static UINT8 PackageSendData(const CanMessage *send_msg,
+ UINT8 *send_cmd);
+static UINT8 PackageRecvData(const UINT8 *recv_data, CanMessage *message);
+static uint32_t GetCanId(const UINT8 *recv_data);
+
+#define CANHAL_VALID_NUM_INDEX 0x00
+#define CANHAL_CANID_HI_INDEX 0x00
+#define CANHAL_CANID_LO_INDEX 0x01
+#define CANHAL_DLC_INDEX 0x02
+#define CANHAL_DATA_START_INDEX 0x03
+
+#define CANHAL_RECV_DATA_LENGTH_INVALID 0xFF
+
+#define CANHAL_RECV_DATABLOCK_SIZE (0x0B)
+#define CANHAL_RECV_NTA_INDEX (0x03)
+
+// Register table for framework callback
+static const FrameworkunifiedProtocolCallbackHandler kCanHalPcbhs[] = {
+ { TX_INTERNAL, CanSendData },
+};
+
+void *CanHalPackMessage(HANDLE h_app, const void *msg, ssize_t msg_sz,
+ ssize_t *packed_sz) {
+ *packed_sz = msg_sz + sizeof(ssize_t) + sizeof(HANDLE);
+ void *p = malloc(*packed_sz);
+ if (p) {
+ char *_p = (char *)p;
+ // Set HANDLE to new buffer.
+ memcpy(_p, &h_app, sizeof(HANDLE));
+ // Set message size to new buffer
+ _p += sizeof(HANDLE);
+ *(ssize_t *)_p = msg_sz;
+ // Set message body to new buffer
+ _p += (sizeof(ssize_t));
+ memcpy(_p, msg, msg_sz);
+ }
+ return p;
+}
+
+void CanHalUnPackMessage(void *packed, HANDLE *h_app, void **msg,
+ ssize_t *msg_sz) {
+ char *_p = (char *)packed;
+ *h_app = *(HANDLE *)_p;
+ _p += sizeof(HANDLE);
+ *msg_sz = *((ssize_t *)_p);
+ _p += sizeof(ssize_t);
+ *msg = _p;
+}
+
+void CanHalDestroyPackedMessage(void *packed) {
+ free(packed);
+}
+
+// Start function of the receive thread
+void *CanRecvRun(void *arg) {
+ UINT8 data_start_index = 0;
+ UINT8 loop_num = 0;
+ UINT32 ret = 0;
+ CanCtlApiCmd recv_cmd;
+ memset(&recv_cmd, 0x00, sizeof(CanCtlApiCmd));
+ CanMessage recv_data_can;
+ memset(&recv_data_can, 0x00, sizeof(recv_data_can));
+ enum CanHalType *type = (enum CanHalType *)arg;
+
+ while (1) {
+ // call driver API to receive the can data
+ ret = CanCtlApiRcvCmd(&g_driver_obj, &recv_cmd);
+ if (CAN_CTL_RET_SUCCESS != ret) {
+ continue;
+ }
+
+ /**
+ * Receive data in the following structure:
+ * -----------------
+ * BYTE 01 | num of can data |
+ * -----------------
+ * BYTE 02 | CAN ID (Hi) |
+ * -----------------
+ * BYTE 03 | CAN ID (Lo) |
+ * -----------------
+ * BYTE 04 | DLC |
+ * -----------------
+ * BYTE 05 | DATA #1 |
+ * -----------------
+ * | ... |
+ * -----------------
+ * BYTE 12 | DATA #8 |
+ * -----------------
+ * BYTE 13 | CAN ID (Hi) |
+ * -----------------
+ * BYTE 14 | CAN ID (Lo) |
+ * -----------------
+ * BYTE 15 | DLC |
+ * -----------------
+ * BYTE 16 | DATA #1 |
+ * -----------------
+ * | ... |
+ * -----------------
+ * BYTE 23 | DATA #8 |
+ * -----------------
+ * | ... |
+ * -----------------
+ * BYTE 255 | |
+ * -----------------
+ *
+ * BYTE 0 for the invalid number of the can data
+ * CAN ID (Hi) and (Lo) combine for the CAN ID
+ * CAN ID (Hi) byte's low 7 bits is the high 7 bits of the CAN ID
+ * CAN ID (Lo) byte's high 4 bits is the low 4 bits of the CAN ID
+ * DLC for the length of the following data
+ * DATA #1 ~ #8 for the receive data, its actual length changes
+ * according to the previous DLC byte
+ */
+ UINT8 total_data_num = recv_cmd.data[CANHAL_VALID_NUM_INDEX];
+ data_start_index = 1;
+
+ for (loop_num = 0; loop_num < total_data_num; loop_num++) {
+ uint32_t can_id;
+ can_id = GetCanId(&(recv_cmd.data[data_start_index]));
+
+ // normal can
+ // Return value of the PackageRecvData is the total length
+ // of one can data package, so add to the data_start_index
+ // for the next can data package.
+ ret = PackageRecvData(&(recv_cmd.data[data_start_index]),
+ &recv_data_can);
+ if (CANHAL_RECV_DATA_LENGTH_INVALID == ret) {
+ continue;
+ }
+ data_start_index += ret;
+ CanHalReceiveNotify(*type, &(recv_data_can), sizeof(recv_data_can));
+ }
+
+ // reset buffer
+ memset(&recv_cmd, 0x00, sizeof(CanCtlApiCmd));
+ usleep(1000);
+ }
+
+ return NULL;
+}
+
+// get can id from recive buffer
+static uint32_t GetCanId(const UINT8 *recv_data) {
+ uint32_t can_id;
+ can_id = (recv_data[CANHAL_CANID_HI_INDEX] & 0x7F);
+ can_id <<= 4;
+ can_id |= ((recv_data[CANHAL_CANID_LO_INDEX] & 0xF0) >> 4);
+ return can_id;
+}
+
+static CANHAL_RET_API CanOpenCoreCAN(void) {
+ CanCtlRcvId recv_can_id;
+ memset(recv_can_id.id, 0xFF, sizeof(recv_can_id.id));
+ if (CAN_CTL_RET_SUCCESS != CanCtlApiOpen(&g_driver_obj))
+ return CANHAL_RET_ERR_ERR;
+
+ if (CAN_CTL_RET_SUCCESS != CanCtlApiSetRcvId(&g_driver_obj, &recv_can_id)) {
+ return CANHAL_RET_ERR_ERR;
+ }
+
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API CanOpenCore(CanHalType type) {
+ CANHAL_RET_API ret = CANHAL_RET_ERR_ERR;
+ switch (type) {
+ case CAN_HAL_TYPE_CAN:
+ ret = CanOpenCoreCAN();
+ break;
+ default:
+ // Do nothing
+ break;
+ }
+ return ret;
+}
+
+// Initialize the sending thread
+EFrameworkunifiedStatus CanSendThreadStart(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ intptr_t ptr;
+ e_status = FrameworkunifiedAttachCallbacksToDispatcher(h_app,
+ FRAMEWORKUNIFIED_ANY_SOURCE,
+ kCanHalPcbhs,
+ _countof(kCanHalPcbhs));
+ if (e_status != eFrameworkunifiedStatusOK)
+ goto finish;
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &ptr, sizeof(ptr));
+ if (e_status != eFrameworkunifiedStatusOK)
+ goto finish;
+
+ *((HANDLE *)ptr) = FrameworkunifiedMcOpenSender(h_app, FrameworkunifiedGetAppName(h_app));
+ if (!(*(HANDLE *)ptr))
+ e_status = eFrameworkunifiedStatusFail;
+
+finish:
+ return e_status;
+}
+
+// Clean the sending thread
+EFrameworkunifiedStatus CanSendThreadStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ intptr_t ptr;
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &ptr, sizeof(ptr));
+ if (e_status != eFrameworkunifiedStatusOK)
+ goto finish;
+
+ FrameworkunifiedMcClose(*((HANDLE*)ptr));
+finish:
+ return e_status;
+}
+
+static CANHAL_RET_API CanCloseCoreCAN(void) {
+ CanCtlApiClose(&g_driver_obj);
+ return CANHAL_RET_NORMAL;
+}
+
+// Stop the can hal
+CANHAL_RET_API CanCloseCore(CanHalType type) {
+ CANHAL_RET_API ret = CANHAL_RET_NORMAL;
+ switch (type) {
+ case CAN_HAL_TYPE_CAN:
+ ret = CanCloseCoreCAN();
+ if (ret != CANHAL_RET_NORMAL)
+ goto finish;
+ break;
+ default:
+ goto finish;
+ break;
+ }
+finish:
+ return ret;
+}
+
+// Callback for the sending thread to send the can data
+static EFrameworkunifiedStatus CanSendData(HANDLE h_app) {
+ UINT8 ret = 0;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ HANDLE hb = NULL;
+ CanMessage mb;
+ ssize_t sz = 0;
+ void *send_msg = NULL;
+ HANDLE unpacked_h_app;
+ CanMessage *unpacked_msg;
+ ssize_t unpacked_sz;
+
+ send_msg = CanHalPackMessage(hb, (const void *)&mb, sizeof(mb), &sz);
+ if (!send_msg)
+ return eFrameworkunifiedStatusFail;
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, send_msg, sz, eSMRRelease);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ if (eFrameworkunifiedStatusInvldBufSize == e_status) {
+ FrameworkunifiedClearMsgData(h_app);
+ }
+ return eFrameworkunifiedStatusFail;
+ }
+
+ CanHalUnPackMessage(send_msg, &unpacked_h_app,
+ (void **)&unpacked_msg, &unpacked_sz);
+
+ CanCtlApiCmd send_can_data;
+ memset(&send_can_data, 0, sizeof(CanCtlApiCmd));
+ send_can_data.data[CANHAL_VALID_NUM_INDEX] = 1;
+ ret = PackageSendData(unpacked_msg, &(send_can_data.data[1]));
+ send_can_data.len = ret + 1;
+ CanSendResult send_result;
+ send_result.can_id = unpacked_msg->can_id;
+ send_result.rid = unpacked_msg->rid;
+
+ if (CAN_CTL_RET_SUCCESS == CanCtlApiSndCmd(&g_driver_obj, &send_can_data)) {
+ send_result.result = CAN_SEND_RESULT_SUCCESS;
+ } else {
+ send_result.result = CAN_SEND_RESULT_FAILURE;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Send status is %d.", send_result.result);
+
+ if (CANHAL_RET_NORMAL != CanHalSendStatus(CAN_HAL_TYPE_CAN,
+ unpacked_h_app, &send_result, sizeof(send_result))) {
+ CanHalDestroyPackedMessage(send_msg);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ CanHalDestroyPackedMessage(send_msg);
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * param [in] send_msg
+ * param [out] send_can_data
+ */
+static UINT8 PackageSendData(const CanMessage *send_msg,
+ UINT8 *send_can_data) {
+ // package according to the rule of the data structure,
+ // refer to the line 108 and 109
+ send_can_data[CANHAL_CANID_HI_INDEX] = (send_msg->can_id & 0x7F0) >> 4;
+ send_can_data[CANHAL_CANID_LO_INDEX] = (send_msg->can_id & 0x0F) << 4;
+ send_can_data[CANHAL_DLC_INDEX] = send_msg->dlc;
+ memcpy(&(send_can_data[CANHAL_DATA_START_INDEX]),
+ send_msg->data,
+ send_msg->dlc);
+ return (send_msg->dlc + CANHAL_DATA_START_INDEX);
+}
+
+/**
+ * param [in] recv_data
+ * param [out] message
+ */
+static UINT8 PackageRecvData(const UINT8 *recv_data, CanMessage *message) {
+ if (CAN_NORMAL_MESSAGE_LEN < recv_data[CANHAL_DLC_INDEX]) {
+ // receive data's length is invalid
+ return CANHAL_RECV_DATA_LENGTH_INVALID;
+ }
+ // package according to the rule of the data structure,
+ // refer to the line 108 and 109
+ message->can_id = recv_data[CANHAL_CANID_HI_INDEX] & 0x7F;
+ message->can_id <<= 4;
+ message->can_id |= (recv_data[CANHAL_CANID_LO_INDEX] & 0xF0) >> 4;
+ message->dlc = recv_data[CANHAL_DLC_INDEX];
+ memcpy(message->data, &(recv_data[CANHAL_DATA_START_INDEX]), CAN_NORMAL_MESSAGE_LEN);
+
+ return CANHAL_RECV_DATABLOCK_SIZE;
+}
+
diff --git a/video_in_hal/can_hal/src/can_hal_stm.cpp b/video_in_hal/can_hal/src/can_hal_stm.cpp
new file mode 100755
index 0000000..fc24964
--- /dev/null
+++ b/video_in_hal/can_hal/src/can_hal_stm.cpp
@@ -0,0 +1,243 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "can_hal_stm.h"
+#include "can_hal_core.h"
+#include "can_hal_internal.h"
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <string>
+#include <stdbool.h>
+#include <stdint.h>
+#include <assert.h>
+#include <pthread.h>
+
+// BSS section would be initialized to all 0.
+struct CanHalStateMachine {
+ CanHalType type;
+ HANDLE h_app;
+ bool can_hal_is_opened;
+ bool device_is_enabled;
+ struct {
+ HANDLE tx;
+ HANDLE tx_sender;
+ uint32_t tx_cmd;
+ const char *tx_name;
+ bool rx_initialized;
+ pthread_t rx;
+ pthread_attr_t rx_attr;
+ } internal;
+} can_hal_stm[NR_CAN_HAL_TYPES];
+
+bool TypeIsValid(enum CanHalType type) {
+ if (CAN_HAL_TYPE_CAN == type)
+ return true;
+
+ return false;
+}
+
+bool IsCanHalOpened(enum CanHalType type) {
+ return can_hal_stm[type].can_hal_is_opened;
+}
+
+void SetCanHalStateOpen(enum CanHalType type) {
+ can_hal_stm[type].can_hal_is_opened = true;
+}
+
+void SetCanHalStateClose(enum CanHalType type) {
+ can_hal_stm[type].can_hal_is_opened = false;
+}
+
+bool IsDeviceEnabled(enum CanHalType type) {
+ return can_hal_stm[type].device_is_enabled;
+}
+
+void SetDeviceStateEnable(enum CanHalType type) {
+ can_hal_stm[type].device_is_enabled = true;
+}
+
+void SetDeviceStateDisable(enum CanHalType type) {
+ can_hal_stm[type].device_is_enabled = false;
+}
+
+CANHAL_RET_API CanHalDestroyInternalThread(HANDLE h_app, enum CanHalType type) {
+ intptr_t ptr = (intptr_t)&(can_hal_stm[type].internal.tx_sender);
+
+ if (can_hal_stm[type].internal.tx) {
+ FrameworkunifiedStopChildThread(h_app, can_hal_stm[type].internal.tx, sizeof(ptr), &ptr);
+ FrameworkunifiedDestroyChildThread(h_app, can_hal_stm[type].internal.tx);
+ can_hal_stm[type].internal.tx = NULL;
+ }
+
+ if (can_hal_stm[type].internal.rx_initialized) {
+ pthread_cancel(can_hal_stm[type].internal.rx);
+ pthread_join(can_hal_stm[type].internal.rx, NULL);
+ can_hal_stm[type].internal.rx_initialized = false;
+ }
+ can_hal_stm[type].h_app = NULL;
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API CanHalCreateInternalThread(HANDLE h_app, enum CanHalType type) {
+ enum CANHAL_RET_API ret = CANHAL_RET_ERR_PARAM;
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+ intptr_t ptr = (intptr_t)&(can_hal_stm[type].internal.tx_sender);
+
+ can_hal_stm[type].h_app = h_app;
+ can_hal_stm[type].internal.tx_name = CANHAL_CAN_SEND_THREAD;
+ can_hal_stm[type].internal.tx = FrameworkunifiedCreateChildThread(h_app,
+ can_hal_stm[type].internal.tx_name,
+ CanSendThreadStart, CanSendThreadStop);
+ if (!can_hal_stm[type].internal.tx)
+ goto cleanup;
+
+ err = FrameworkunifiedStartChildThread(h_app,
+ can_hal_stm[type].internal.tx,
+ sizeof(ptr), &ptr);
+ if (err != eFrameworkunifiedStatusOK)
+ goto cleanup;
+
+ if (0 != pthread_attr_init(&(can_hal_stm[type].internal.rx_attr)))
+ goto cleanup;
+
+ if (0 != pthread_create(&(can_hal_stm[type].internal.rx),
+ &(can_hal_stm[type].internal.rx_attr), CanRecvRun,
+ (void *)&(can_hal_stm[type].type)))
+ goto cleanup;
+
+ can_hal_stm[type].internal.rx_initialized = true;
+ ret = CANHAL_RET_NORMAL;
+ return ret;
+cleanup:
+ if (can_hal_stm[type].internal.tx) {
+ FrameworkunifiedStopChildThread(h_app, can_hal_stm[type].internal.tx, sizeof(ptr), &ptr);
+ FrameworkunifiedDestroyChildThread(h_app, can_hal_stm[type].internal.tx);
+ can_hal_stm[type].internal.tx = NULL;
+ }
+
+ return ret;
+}
+
+CANHAL_RET_API CanHalInternalSend_CWORD118_(enum CanHalType type,
+ const void *msg, ssize_t sz) {
+ EFrameworkunifiedStatus e_status = FrameworkunifiedSendMsg(can_hal_stm[type].internal.tx_sender,
+ TX_INTERNAL__CWORD118_, sz, msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ return CANHAL_RET_ERR_ERR;
+ }
+ return CANHAL_RET_NORMAL;
+}
+
+static EFrameworkunifiedStatus FrameworkunifiedSendMsgOneshot(HANDLE h_app, UI_32 cmd,
+ UI_32 l, PCVOID d) {
+ HANDLE h_client = NULL;
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusFail;
+
+ h_client = FrameworkunifiedMcOpenSender(h_app, FrameworkunifiedGetAppName(h_app));
+ if (!h_client)
+ return err;
+
+ err = FrameworkunifiedSendMsg(h_client, cmd, l, d);
+ FrameworkunifiedMcClose(h_client);
+ return err;
+}
+
+CANHAL_RET_API CanHalInternalSend(enum CanHalType type,
+ const void *msg, ssize_t sz) {
+ EFrameworkunifiedStatus e_status = FrameworkunifiedSendMsg(can_hal_stm[type].internal.tx_sender,
+ TX_INTERNAL, sz, msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ return CANHAL_RET_ERR_ERR;
+ }
+ return CANHAL_RET_NORMAL;
+}
+
+
+CANHAL_RET_API InvokeStateCallback(enum CanHalType type) {
+ HANDLE sender = can_hal_stm[type].h_app;
+ uint32_t cmd = 0;
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+ bool send = true;
+
+ switch (type) {
+ case CAN_HAL_TYPE_CAN:
+ cmd = CID_CANHAL_CMD_CAN_READY;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ err = FrameworkunifiedSendMsgOneshot(sender, cmd, sizeof(send), &send);
+ if (err != eFrameworkunifiedStatusOK)
+ return CANHAL_RET_ERR_ERR;
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API InvokeErrorCallback(HANDLE h_app, enum CanHalType type) {
+ HANDLE sender = h_app;
+ uint32_t cmd = CID_CANHAL_CMD_ERROR_NOTIFY;
+ char msg[CANHAL_ERROR_MESSAGE_LEN] = {0};
+ ssize_t sz = sizeof(msg);
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+
+ switch (type) {
+ case CAN_HAL_TYPE_CAN:
+ sprintf(msg, "Global CAN Stop");
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ err = FrameworkunifiedSendMsgOneshot(sender, cmd, sz, msg);
+ if (err != eFrameworkunifiedStatusOK)
+ return CANHAL_RET_ERR_ERR;
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API CanHalSendStatus(enum CanHalType type, HANDLE h_app,
+ const void *msg, ssize_t sz) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ e_status = FrameworkunifiedSendMsgOneshot(h_app, CID_CANHAL_CMD_CAN_SEND_STATUS, sz, msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ return CANHAL_RET_ERR_ERR;
+ }
+ return CANHAL_RET_NORMAL;
+}
+
+CANHAL_RET_API CanHalReceiveNotify(enum CanHalType type,
+ const void *msg, ssize_t sz) {
+ EFrameworkunifiedStatus e_status;
+ uint32_t cmd = 0;
+
+ switch (type) {
+ case CAN_HAL_TYPE_CAN:
+ cmd = CID_CANHAL_CMD_CAN_RECV;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ e_status = FrameworkunifiedSendMsgOneshot(can_hal_stm[type].h_app, cmd, sz, msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ return CANHAL_RET_ERR_ERR;
+ }
+
+ return CANHAL_RET_NORMAL;
+}
diff --git a/video_in_hal/can_hal/src/driver_can__CWORD31_.c b/video_in_hal/can_hal/src/driver_can__CWORD31_.c
new file mode 100755
index 0000000..bd9cb29
--- /dev/null
+++ b/video_in_hal/can_hal/src/driver_can__CWORD31_.c
@@ -0,0 +1,472 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+#include "can_mng_api.h"
+
+#include <poll.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <linux/can/raw.h>
+#include <net/if.h>
+
+
+#define DUMP_DIR "/nv/driver-can"
+#define DUMP_RCVID "/nv/driver-can/dump_rcvid"
+#define CAN_DATA_SIZE (sizeof(CanData))
+
+static int fd_can = -1;
+static struct sockaddr_can tx_address;
+static CanCtlRcvId RcvId;
+const char* device_name = "vcan0";
+
+static UINT32 getData(CanCtlRcvId*, CanCtlApiCmd*);
+static UINT32 getCanData(unsigned char*);
+static UINT32 copyEnableCandata(UINT16* , unsigned char*, unsigned char*);
+static UINT32 isOpendDriver(void);
+
+UINT32 CanCtlApiOpen(CanCtlApiObj* pClientObj)
+{
+ int err_no;
+ int ret;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+
+ /*----------------------------------------------------------------------*/
+ /* Clear Object */
+ /*----------------------------------------------------------------------*/
+ if (pClientObj != NULL) {
+ memset(pClientObj, 0, sizeof(*pClientObj));
+ }
+
+ if (fd_can != -1) {
+ CAN_MNG_API_LOGT("Already Opened");
+ CAN_MNG_API_LOGT("FUNC OUT");
+ return CAN_CTL_RET_SUCCESS;
+ }
+
+ // open socket
+ CAN_MNG_API_LOGT("open socket start");
+ struct ifreq ifr = {0};
+ fd_can = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+ err_no = errno;
+ CAN_MNG_API_LOGT("open socket end");
+ if (fd_can == -1) {
+ CAN_MNG_API_LOGE("Socket Open Error.");
+ CAN_MNG_API_LOGE("(errno[%d]).", err_no);
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ // ioctl(SIOCGIFINDEX)
+ strcpy(ifr.ifr_name, device_name);
+ ret = ioctl(fd_can, SIOCGIFINDEX, &ifr);
+ err_no = errno;
+ if (ret < 0) {
+ CAN_MNG_API_LOGE("ioctl(SIOCGIFINDEX) Error.");
+ CAN_MNG_API_LOGE("(errno[%d]).", err_no);
+ (void)close(fd_can);
+ fd_can = -1;
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ // bind
+ tx_address.can_family = AF_CAN;
+ tx_address.can_ifindex = ifr.ifr_ifindex;
+
+ ret = bind(fd_can, (struct sockaddr *)&tx_address, sizeof(tx_address));
+ err_no = errno;
+ if (ret < 0) {
+ CAN_MNG_API_LOGE("Socket Bind Error.");
+ CAN_MNG_API_LOGE("(errno[%d]).", err_no);
+ (void)close(fd_can);
+ fd_can = -1;
+ return -1;
+ }
+
+ // Initialize RcvId Map
+ memset(&RcvId, 0, sizeof(RcvId));
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+UINT32 CanCtlApiClose(CanCtlApiObj* pClientObj)
+{
+ /*----------------------------------------------------------------------*/
+ /* Clear Object */
+ /*----------------------------------------------------------------------*/
+ if (pClientObj != NULL) {
+ memset(pClientObj, 0, sizeof(*pClientObj));
+ }
+
+ if (fd_can != -1) {
+ (void)close(fd_can);
+ }
+
+ // Initialize fd info
+ fd_can = -1;
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+UINT32 CanCtlApiSndCmd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pSndCmd)
+{
+ int i;
+ printf("%s: call_id=0x%x len=%d\n",
+ __func__, pClientObj->call_id, pSndCmd->len);
+ for (i = 0; i < pSndCmd->len; i++) {
+ printf("[%d]0x%x ", i, pSndCmd->data[i]);
+ if ((i != 0) && ((i % 7) == 0))
+ printf("\n");
+ }
+ printf("\n");
+
+
+ int ret;
+ int err_no;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+ /*----------------------------------------------------------------------*/
+ /* Check Input Value */
+ /*----------------------------------------------------------------------*/
+ if (NULL == pSndCmd)
+ {
+ CAN_MNG_API_LOGE("%s(%p) invalid parameter.", __func__, pSndCmd);
+ return CAN_CTL_RET_ERR_PARAM;
+ }
+
+ ret = isOpendDriver();
+ if (ret != CAN_CTL_RET_SUCCESS) {
+ CAN_MNG_API_LOGE("Not Open Driver.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ struct can_frame frame = {0};
+
+ frame.can_id = pSndCmd->data[1] & 0x7F;
+ frame.can_id <<= 4;
+ frame.can_id |= (pSndCmd->data[2] & 0xF0) >> 4;
+ frame.can_dlc = pSndCmd->data[3];
+ frame.data[0] = pSndCmd->data[4];
+ frame.data[1] = pSndCmd->data[5];
+ frame.data[2] = pSndCmd->data[6];
+ frame.data[3] = pSndCmd->data[7];
+ frame.data[4] = pSndCmd->data[8];
+ frame.data[5] = pSndCmd->data[9];
+ frame.data[6] = pSndCmd->data[10];
+ frame.data[7] = pSndCmd->data[11];
+
+ CAN_MNG_API_LOGT("write() CanDataExtSendNotif start size = %d", (int)sizeof(frame));
+ ret = write(fd_can, &frame, sizeof(frame));
+ err_no = errno;
+ CAN_MNG_API_LOGE("write() ret = %d).", ret);
+
+ CAN_MNG_API_LOGT("write() CanDataExtSendNotif end");
+ if (ret == -1) {
+ CAN_MNG_API_LOGE("write() error(errno[%d]).", err_no);
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+UINT32 CanCtlApiSetRcvId(CanCtlApiObj* pClientObj, CanCtlRcvId* pRcvId)
+{
+ FILE* fp;
+ size_t nmemb;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+ /*----------------------------------------------------------------------*/
+ /* Check Input Value */
+ /*----------------------------------------------------------------------*/
+ if (NULL == pRcvId)
+ {
+ CAN_MNG_API_LOGE("%s(%p) invalid parameter.", __func__, pRcvId);
+ return CAN_CTL_RET_ERR_PARAM;
+ }
+
+ struct stat st;
+ int ret = 0;
+ if (stat(DUMP_DIR, &st) != 0) {
+ ret = mkdir(DUMP_DIR, 0755);
+ }
+ if (ret != 0) {
+ CAN_MNG_API_LOGE("Can not Created RcvId Dump dir.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+ CAN_MNG_API_LOGT("fopen(DUMP_RCVID) start");
+ fp = fopen(DUMP_RCVID, "wb");
+ CAN_MNG_API_LOGT("fopen(DUMP_RCVID) end");
+ if (fp == NULL) {
+ CAN_MNG_API_LOGE("Can not Opened RcvId Dump file.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("fwrite(pRcvId) start");
+ nmemb = fwrite(pRcvId, sizeof(CanCtlRcvId), 1, fp);
+ CAN_MNG_API_LOGT("fwrite(pRcvId) end");
+ if (nmemb != 1) {
+ CAN_MNG_API_LOGE("RcvId Dump file write error.");
+ (void)fclose(fp);
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("fclose() start");
+ (void)fclose(fp);
+ CAN_MNG_API_LOGT("fclose() end");
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+UINT32 CanCtlApiRcvCmd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pRcvCmd)
+{
+ int ret;
+ int enable_ret;
+
+ CanCtlRcvId InitialRcvId;
+ CanCtlRcvId RcvId;
+ FILE* fp;
+ size_t nmemb;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+ /*----------------------------------------------------------------------*/
+ /* Check Input Value */
+ /*----------------------------------------------------------------------*/
+ if (NULL == pRcvCmd)
+ {
+ CAN_MNG_API_LOGE("%s(%p) invalid parameter.", __func__, pRcvCmd);
+ return CAN_CTL_RET_ERR_PARAM;
+ }
+
+ ret = isOpendDriver();
+ if (ret != CAN_CTL_RET_SUCCESS) {
+ CAN_MNG_API_LOGE("Not Open Driver.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ // Restore RcvId
+ CAN_MNG_API_LOGT("fopen(DUMP_RCVID) start");
+ fp = fopen(DUMP_RCVID, "rb");
+ CAN_MNG_API_LOGT("fopen(DUMP_RCVID) end");
+ if (fp == NULL) {
+ CAN_MNG_API_LOGE("Can not Opened RcvId Dump file.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("fread(RcvId) start");
+ nmemb = fread(&RcvId, sizeof(CanCtlRcvId), 1, fp);
+ CAN_MNG_API_LOGT("fread(RcvId) end");
+ if (nmemb != 1) {
+ CAN_MNG_API_LOGE("RcvId Dump file read error.");
+ (void)fclose(fp);
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("fclose() start");
+ (void)fclose(fp);
+ CAN_MNG_API_LOGT("fclose() end");
+
+ memset(&InitialRcvId.id, 0, sizeof(InitialRcvId.id));
+
+ if (memcmp(InitialRcvId.id, RcvId.id, sizeof(RcvId.id)) == 0) {
+ CAN_MNG_API_LOGE("No RecvId Maps.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ enable_ret = getData(&RcvId, pRcvCmd);
+
+ if (enable_ret != CAN_CTL_RET_SUCCESS) {
+ CAN_MNG_API_LOGE("No data founds.");
+ return enable_ret;
+ }
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+static UINT32 getData(CanCtlRcvId* pRcvId, CanCtlApiCmd* pRcvCmd) {
+ int ret;
+ int total_cnt = 0;
+ int copy_cnt = 0;
+ int i;
+ unsigned char can_data[CAN_CTL_CMD_LEN_MAX+1];
+ unsigned char enable_can_data[CAN_CTL_CMD_LEN_MAX];
+ unsigned char store_can_data[CAN_CTL_CMD_LEN_MAX];
+ unsigned char* scd;
+
+
+ UINT16 id_map[CAN_CTL_CMD_ID_HI_NUM];
+
+ CAN_MNG_API_LOGT("FUNC IN");
+
+ memcpy(id_map, pRcvId->id, sizeof(id_map));
+
+ memset(store_can_data, 0, sizeof(store_can_data));
+ scd = store_can_data;
+
+ while(1) {
+ memset(can_data, 0, sizeof(can_data));
+ memset(enable_can_data, 0, sizeof(enable_can_data));
+ ret = getCanData(can_data);
+ if (ret != CAN_CTL_RET_SUCCESS) {
+ // In case of error, read next data
+ CAN_MNG_API_LOGE("getCanData error.");
+ continue;
+ }
+
+ // Extract data of "CAN data extended reception notification 4"
+ copy_cnt = copyEnableCandata(id_map, can_data, enable_can_data);
+ if( copy_cnt == 0 ){
+ continue;
+ }
+
+ // Store in work buffer
+ for (i = 0; i < copy_cnt; i++) {
+ if (total_cnt >= CAN_CTL_MAX_RCV_CAN_SIZE) {
+ CAN_MNG_API_LOGE("buffer over");
+ break;
+ }
+ memcpy(scd, &enable_can_data[CAN_DATA_SIZE * i], CAN_DATA_SIZE);
+ scd = scd + CAN_DATA_SIZE;
+ total_cnt++;
+ }
+
+ // Check work buffer overflow
+ if (total_cnt >= CAN_CTL_MAX_RCV_CAN_SIZE) {
+ CAN_MNG_API_LOGE("buffer over");
+ break;
+ }
+ }
+
+ // If data exists, set and return
+ if (total_cnt != 0) {
+ pRcvCmd->len = 1 + (total_cnt * CAN_DATA_SIZE);
+ pRcvCmd->data[0] = total_cnt;
+ memcpy( &(pRcvCmd->data[1]), store_can_data, (total_cnt * CAN_DATA_SIZE));
+ } else {
+ // If there is no data, return with length 0
+ pRcvCmd->len = 0;
+ memset( &(pRcvCmd->data[0]), 0, sizeof(UINT8) * CAN_DAT_LEN_MAX );
+ CAN_MNG_API_LOGE("data not found");
+ }
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+
+ return CAN_CTL_RET_SUCCESS;
+}
+
+static UINT32 getCanData(unsigned char *can_data) {
+ int err_no;
+ int i;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+
+ CAN_MNG_API_LOGE("recvfrom start");
+
+ int nbytes = 0;
+ struct can_frame frame = {0};
+ socklen_t addrlen = sizeof(struct sockaddr_can);
+ nbytes = recvfrom(fd_can, &frame, sizeof(frame), 0, (struct sockaddr*)&tx_address, &addrlen);
+ err_no = errno;
+ CAN_MNG_API_LOGE("recvfrom end ret = %d",nbytes);
+ if (nbytes == -1) {
+ CAN_MNG_API_LOGE("Not Read CAN Driver(errno[%d]).", err_no);
+ return CAN_CTL_RET_ERR_ERR;
+ } else if (nbytes != CAN_MTU) {
+ CAN_MNG_API_LOGE("Receive Error size: %d.", nbytes);
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("Recvfrom CAN Data(start)");
+ can_data[0] = (frame.can_id & 0x7F0) >> 4;
+ can_data[1] = (frame.can_id & 0x0F) << 4;
+ can_data[2] = frame.can_dlc;
+ for (i = 0; i < frame.can_dlc; i++) {
+ can_data[3+i] = frame.data[i];
+ CAN_MNG_API_LOGE(" 0x%02x", frame.data[i]);
+ }
+ CAN_MNG_API_LOGT("");
+ CAN_MNG_API_LOGT("Recvfrom Data(end)");
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+ return CAN_CTL_RET_SUCCESS;
+}
+
+static UINT32 copyEnableCandata(UINT16* id_map, unsigned char* can_data, unsigned char* enable_can_data) {
+ int id;
+ UINT16 val;
+ unsigned char* ecd = enable_can_data;
+ UINT32 count = 0;
+
+ CAN_MNG_API_LOGT("FUNC IN");
+ // Search data of "CAN data extended reception notification 4"
+ id = can_data[0];
+ val = can_data[1] >> 4; // Shift right 4 bits and determine search position
+
+ CAN_MNG_API_LOGE("data id =%x", id);
+ CAN_MNG_API_LOGE("data val=%x", val);
+ CAN_MNG_API_LOGE("file val=%x", id_map[id]);
+
+ // If the target data is found (If the bit is on ?)
+ if ((id_map[id] & (0x01 << val)) != 0) {
+ CAN_MNG_API_LOGT("matched.");
+ CAN_MNG_API_LOGE("id_map[%u]", id_map[id]);
+
+ // Store data in work buffer
+ memcpy(ecd, &can_data[0], CAN_DATA_SIZE);
+ count++;
+ }
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+ return count;
+}
+
+UINT32 CanCtlApiRcvSpd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pRcvCmd)
+{
+ // Note.
+ // If vendor needs the special implementation about receiving the vehicle speed,
+ // it should be implemented by vendor.
+ return CAN_CTL_RET_SUCCESS;
+}
+
+static UINT32 isOpendDriver() {
+ CAN_MNG_API_LOGT("FUNC IN");
+
+ if (fd_can == -1) {
+ CAN_MNG_API_LOGE("Not Open CAN Driver.");
+ return CAN_CTL_RET_ERR_ERR;
+ }
+
+ CAN_MNG_API_LOGT("FUNC OUT");
+ return CAN_CTL_RET_SUCCESS;
+}
diff --git a/video_in_hal/can_hal/src/inc/can_hal_core.h b/video_in_hal/can_hal/src/inc/can_hal_core.h
new file mode 100755
index 0000000..57a9c9d
--- /dev/null
+++ b/video_in_hal/can_hal/src/inc/can_hal_core.h
@@ -0,0 +1,37 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CAN_HAL_CORE_H_
+#define _CAN_HAL_CORE_H_
+#include <stdint.h>
+#include "can_hal.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+CANHAL_RET_API CanOpenCore(CanHalType type);
+CANHAL_RET_API CanCloseCore(CanHalType type);
+EFrameworkunifiedStatus CanSendThreadStart(HANDLE h_app);
+EFrameworkunifiedStatus CanSendThreadStop(HANDLE h_app);
+void *CanRecvRun(void *arg);
+void *CanHalPackMessage(HANDLE h_app, const void *msg, ssize_t msg_sz,
+ ssize_t *packed_sz);
+void CanHalUnPackMessage(void *packed, HANDLE *h_app, void **msg,
+ ssize_t *msg_sz);
+void CanHalDestroyPackedMessage(void *packed);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/video_in_hal/can_hal/src/inc/can_hal_frameworkunifiedlog.h b/video_in_hal/can_hal/src/inc/can_hal_frameworkunifiedlog.h
new file mode 100755
index 0000000..f3a5f50
--- /dev/null
+++ b/video_in_hal/can_hal/src/inc/can_hal_frameworkunifiedlog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_CAN_HAL_FRAMEWORKUNIFIEDLOG_H_
+#define INC_CAN_HAL_FRAMEWORKUNIFIEDLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+#endif // INC_CAN_HAL_FRAMEWORKUNIFIEDLOG_H_
diff --git a/video_in_hal/can_hal/src/inc/can_hal_internal.h b/video_in_hal/can_hal/src/inc/can_hal_internal.h
new file mode 100755
index 0000000..f42a73f
--- /dev/null
+++ b/video_in_hal/can_hal/src/inc/can_hal_internal.h
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_CAN_HAL_INTERNAL_H_
+#define INC_CAN_HAL_INTERNAL_H_
+
+/**
+ * \~english Name of the CAN send thread
+ */
+#define CANHAL_CAN_SEND_THREAD "HalCANSend"
+
+enum CanHalInternalCmd {
+ INVALID_CMD = 0,
+ TX_INTERNAL,
+ TX_INTERNAL__CWORD118_
+};
+
+#endif // INC_CAN_HAL_INTERNAL_H_
diff --git a/video_in_hal/can_hal/src/inc/can_hal_stm.h b/video_in_hal/can_hal/src/inc/can_hal_stm.h
new file mode 100755
index 0000000..cd07814
--- /dev/null
+++ b/video_in_hal/can_hal/src/inc/can_hal_stm.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CAN_HAL_STM_H_
+#define _CAN_HAL_STM_H_
+#include "can_hal.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+bool TypeIsValid(enum CanHalType type);
+bool IsCanHalOpened(enum CanHalType type);
+void SetCanHalStateOpen(enum CanHalType type);
+void SetCanHalStateClose(enum CanHalType type);
+bool IsDeviceEnabled(enum CanHalType type);
+void SetDeviceStateEnable(enum CanHalType type);
+void SetDeviceStateDisable(enum CanHalType type);
+CANHAL_RET_API InvokeStateCallback(enum CanHalType type);
+CANHAL_RET_API InvokeErrorCallback(HANDLE h_app, enum CanHalType type);
+CANHAL_RET_API CanHalInternalSend(enum CanHalType type,
+ const void *msg, ssize_t sz);
+CANHAL_RET_API CanHalInternalSend_CWORD118_(enum CanHalType type,
+ const void *msg, ssize_t sz);
+CANHAL_RET_API CanHalSendStatus(enum CanHalType type, HANDLE h_app,
+ const void *msg, ssize_t sz);
+CANHAL_RET_API CanHalReceiveNotify(enum CanHalType type,
+ const void *msg, ssize_t sz);
+CANHAL_RET_API CanHalCreateInternalThread(HANDLE h_app, enum CanHalType type);
+CANHAL_RET_API CanHalDestroyInternalThread(HANDLE h_app, enum CanHalType type);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/video_in_hal/can_hal/src/inc/can_mng_api.h b/video_in_hal/can_hal/src/inc/can_mng_api.h
new file mode 100755
index 0000000..ef03750
--- /dev/null
+++ b/video_in_hal/can_hal/src/inc/can_mng_api.h
@@ -0,0 +1,120 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CAN_MNG_API_H__
+#define __CAN_MNG_API_H__
+
+/** @includes
+ *
+ */
+
+/** @define
+ *
+ */
+#ifndef UINT8
+#define UINT8 unsigned char
+#endif
+#ifndef UINT16
+#define UINT16 unsigned short
+#endif
+#ifndef INT32
+#define INT32 int
+#endif
+#ifndef UINT32
+#define UINT32 unsigned int
+#endif
+
+/*------------------------------------------*/
+/* Log */
+/*------------------------------------------*/
+#if defined(CAN_MNG_API_FORCE_DEBUG)
+ #define CAN_MNG_API_LOGT(fmt,...) fprintf(stderr, "[T][CAN_API] %s(%s)(%d):" fmt "\n", __FILE__, __func__, __LINE__, ## __VA_ARGS__)
+ #define CAN_MNG_API_LOGD(fmt,...) fprintf(stderr, "[D][CAN_API] %s(%s)(%d):" fmt "\n", __FILE__, __func__, __LINE__, ## __VA_ARGS__)
+ #define CAN_MNG_API_LOGE(fmt,...) fprintf(stderr, "[E][CAN_API] %s(%s)(%d):" fmt "\n", __FILE__, __func__, __LINE__, ## __VA_ARGS__)
+#else
+ #define CAN_MNG_API_LOGT(fmt,...)
+ #define CAN_MNG_API_LOGD(fmt,...)
+ #define CAN_MNG_API_LOGE(fmt,...)
+#endif
+/*------------------------------------------*/
+/* API return value */
+/*------------------------------------------*/
+#define CAN_CTL_RET_SUCCESS 0 /* Normal end */
+#define CAN_CTL_RET_ERR_PARAM -1 /* Parameter error */
+#define CAN_CTL_RET_ERR_NOSVC -2 /* Service not open error */
+#define CAN_CTL_RET_ERR_ERR -3 /* Other error */
+
+/*------------------------------------------*/
+/* Received command information */
+/*------------------------------------------*/
+#define CAN_CTL_CMD_LEN_MAX 255 /* Maximum data length */
+#define CAN_DAT_LEN_MAX CAN_CTL_CMD_LEN_MAX /* Maximum data length */
+#define CAN_CTL_CMD_ID_HI_NUM 128 /* Number of higher CAN-ID(8bit) (00 to 7F) */
+
+#define CAN_CTL_MAX_RCV_CAN_SIZE 23
+
+/** @typedefs
+ *
+ */
+/* Object for CAN communication control API */
+typedef struct _CanCtlApiObj {
+ /* ID assigned to the command reception notification callback */
+ INT32 call_id;
+} CanCtlApiObj ;
+
+/* CAN command structure */
+typedef struct _CanCtlApiCmd {
+ UINT8 len; /* Data length */
+ UINT8 data[CAN_DAT_LEN_MAX]; /* Data */
+} CanCtlApiCmd;
+
+/* Received ID MAP information */
+typedef struct _CanCtlRcvId {
+ UINT16 id[CAN_CTL_CMD_ID_HI_NUM]; /* CAN ID MAP(000~7FF) */
+} CanCtlRcvId;
+
+
+/* CAN Frame structure */
+typedef union {
+ UINT8 Data[2];
+} CanId;
+
+#define LCN_SRV_MSB_FRAME_DAT_SIZE (8) /* MSB send/receive frame data size */
+
+typedef struct _CanData {
+ CanId id; /* CAN Frame structure */
+ UINT8 dlc; /* Valid bytes of DATA#1~#8. DLC is 1 to 8. */
+ UINT8 Data[LCN_SRV_MSB_FRAME_DAT_SIZE]; /* Receive data */
+ /* Data of DLC size is valid, otherwise set to 0 as invalid value. */
+} CanData;
+
+/** @forward declarations
+ *
+ */
+/* API prototype */
+#ifdef __cplusplus
+extern "C" {
+#endif
+UINT32 CanCtlApiOpen(CanCtlApiObj* pClientObj);
+UINT32 CanCtlApiClose(CanCtlApiObj* pClientObj);
+UINT32 CanCtlApiSndCmd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pSndCmd);
+UINT32 CanCtlApiSetRcvId(CanCtlApiObj* pClientObj, CanCtlRcvId* pRcvId);
+UINT32 CanCtlApiRcvCmd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pRcvCmd);
+UINT32 CanCtlApiRcvSpd(CanCtlApiObj* pClientObj, CanCtlApiCmd* pRcvCmd);
+#ifdef __cplusplus
+}
+#endif
+#endif /* __CAN_MNG_API_H__ */
diff --git a/video_in_hal/clock_hal/LICENSE b/video_in_hal/clock_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/clock_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/clock_hal/Makefile b/video_in_hal/clock_hal/Makefile
new file mode 100755
index 0000000..e417a15
--- /dev/null
+++ b/video_in_hal/clock_hal/Makefile
@@ -0,0 +1,67 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libclock_hal.so
+
+HEADER := hal_api/clock_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+CXXFLAGS += -DAGL_REFHW
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := clock_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/video_in_hal/clock_hal/README.md b/video_in_hal/clock_hal/README.md
new file mode 100755
index 0000000..0443f95
--- /dev/null
+++ b/video_in_hal/clock_hal/README.md
@@ -0,0 +1,3 @@
+clock_hal library
+==================
+Clock HAL implementation library for AGL Reference Board.
diff --git a/video_in_hal/clock_hal/hal_api/clock_hal.h b/video_in_hal/clock_hal/hal_api/clock_hal.h
new file mode 100755
index 0000000..8006b32
--- /dev/null
+++ b/video_in_hal/clock_hal/hal_api/clock_hal.h
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HAL_API_CLOCK_HAL_H_
+#define HAL_API_CLOCK_HAL_H_
+/**
+ * @file clock_hal.h
+ */
+#include <time.h>
+
+#include <native_service/frameworkunified_types.h>
+/** @addtogroup clock
+ * @{
+ */
+/** @addtogroup clock_hal
+ * @ingroup clock
+ * @{
+ */
+/**
+ * \ingroup SetHardwareClock
+ * \~english @par Brief
+ * API to set the RTC.
+ * \~english @param [in] h_app
+ * HANDLE - Handle for Application
+ * \~english @param [in] l_tm
+ * const struct tm * - pointer to the time will be set
+ * \~english @retval eFrameworkunifiedStatusOK : Ok
+ * \~english @retval eFrameworkunifiedStatusFail : Failed
+ * \~english @retval eFrameworkunifiedStatusInvldHandle : parameter "h_app" is NULL
+ * \~english @retval eFrameworkunifiedStatusNullPointer : parameter "l_tm" is NULL
+ * \~english @par Prerequisite
+ * - /dev/rtc node is exist, rtc driver is availability.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Set time to RTC failed. [eFrameworkunifiedStatusFail]
+ * - The parameter "l_tm" is NULL. [eFrameworkunifiedStatusNullPointer]
+ * - The parameter "h_app" is NULL. [eFrameworkunifiedStatusInvldHandle]
+ * \~english @par Detail
+ * - Set time to RTC.
+ * - The API can be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+EFrameworkunifiedStatus SetHardwareClock(HANDLE h_app, const struct tm *l_tm);
+
+
+/**@}*/ // end of clock_hal
+/**@}*/ // end of clock
+
+#endif // HAL_API_CLOCK_HAL_H_
diff --git a/video_in_hal/clock_hal/inc/clock_hal_clockhallog.h b/video_in_hal/clock_hal/inc/clock_hal_clockhallog.h
new file mode 100755
index 0000000..6ed5de5
--- /dev/null
+++ b/video_in_hal/clock_hal/inc/clock_hal_clockhallog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_CLOCK_HAL_CLOCKHALLOG_H_
+#define INC_CLOCK_HAL_CLOCKHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_CLOCK_HAL_CLOCKHALLOG_H_
diff --git a/video_in_hal/clock_hal/src/clock_hal.cpp b/video_in_hal/clock_hal/src/clock_hal.cpp
new file mode 100755
index 0000000..cccbd5b
--- /dev/null
+++ b/video_in_hal/clock_hal/src/clock_hal.cpp
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "clock_hal.h"
+
+#include <assert.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <linux/rtc.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+#include "clock_hal_clockhallog.h"
+
+#define RTC_NODE_PATH_DEPTH 64
+#define RTC_NODE_PERANT_PATH "/dev"
+
+// set time to hardware
+EFrameworkunifiedStatus SetHardwareClock(HANDLE h_app, const struct tm *l_tm) {
+ if (NULL == h_app) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+ if (NULL == l_tm) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ struct rtc_time hal_rtc_time;
+ hal_rtc_time.tm_year = l_tm->tm_year;
+ hal_rtc_time.tm_mon = l_tm->tm_mon;
+ hal_rtc_time.tm_mday = l_tm->tm_mday;
+ hal_rtc_time.tm_hour = l_tm->tm_hour;
+ hal_rtc_time.tm_min = l_tm->tm_min;
+ hal_rtc_time.tm_sec = l_tm->tm_sec;
+ hal_rtc_time.tm_wday = l_tm->tm_wday;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "setting time : %d-%02d/%02d %02d:%02d:%02d\n",
+ 1900 + l_tm->tm_year, l_tm->tm_mon + 1, l_tm->tm_mday,
+ l_tm->tm_hour, l_tm->tm_min, l_tm->tm_sec);
+
+ // Search RTC node
+ DIR *dir = ::opendir(RTC_NODE_PERANT_PATH);
+ char rtc_path[RTC_NODE_PATH_DEPTH] = { '\0' };
+ for (struct dirent *dp = readdir(dir); dp != NULL; dp = readdir(dir)) {
+ if (strstr(dp->d_name, "rtc") != NULL) {
+ snprintf(rtc_path, sizeof(rtc_path), "/dev/%s", dp->d_name);
+ break;
+ }
+ }
+ closedir(dir);
+ if (strlen(rtc_path) == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "/dev/rtcX not found.\n");
+ e_status = eFrameworkunifiedStatusFail;
+ return e_status;
+ }
+
+ // Set time to /dev/rtcX
+ int fd = ::open(rtc_path, O_WRONLY);
+ if (-1 == fd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error open(/dev/rtc)=[%d] errno=%d\n",
+ fd, errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ int ret = ::ioctl(fd, RTC_SET_TIME, &hal_rtc_time);
+ if (0 != ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Error ioctl(fd, RTC_SET_TIME, hal_rtc_time)=[%d] errno=%d\n",
+ ret, errno);
+ e_status = eFrameworkunifiedStatusFail;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Success ioctl(fd, RTC_SET_TIME, hal_rtc_time)=[%d]\n", ret);
+ }
+ ::close(fd);
+ return e_status;
+}
diff --git a/video_in_hal/deck_hal/LICENSE b/video_in_hal/deck_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/deck_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/deck_hal/Makefile b/video_in_hal/deck_hal/Makefile
new file mode 100755
index 0000000..fbe4ddf
--- /dev/null
+++ b/video_in_hal/deck_hal/Makefile
@@ -0,0 +1,67 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libdeck_hal.so
+
+HEADER := hal_api/deck_hal.h
+
+######### include paths/files ###################
+CXXFLAGS += -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH := /usr/lib
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+
+######### source files ##########################
+VPATH += src
+OBJS := deck_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=:$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/video_in_hal/deck_hal/hal_api/deck_hal.h b/video_in_hal/deck_hal/hal_api/deck_hal.h
new file mode 100755
index 0000000..74aa19a
--- /dev/null
+++ b/video_in_hal/deck_hal/hal_api/deck_hal.h
@@ -0,0 +1,322 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!-----------------------------------------------------------------------------
+ * @file deck_hal.h
+ * @~english
+ * @brief deck_hal API head
+ *
+ */
+
+#ifndef HAL_API_DECK_HAL_H_
+#define HAL_API_DECK_HAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * @file deck_hal.h
+ */
+
+/** @addtogroup interface_unified
+ * @{
+ */
+/** @addtogroup deck_hal
+ * @ingroup interface_unified
+ * @{
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif /*__cplusplus*/
+
+/*! @~english Maximum length of command data division */
+#define DECK_CMD_SIZE_CMDDATA_MAX 252
+/*! @~english Maximum length of notification destination */
+#define NOTIFY_NAME_MAX_SIZE 15
+
+// CID_DECK_SYS_DELIVERY is for deck_hal to report correspinding message to vehicle,
+// the value 0x40 can be changed in the future
+/**
+ * \~english @brief DECK SYS Command-Delivery Notification
+ * \~english @brief If you want to receive this DECK SYS command-delivery notification, use the NSFW IF as follows:
+ * \~english @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, DECKHAL_THREAD, CID_DECK_SYS_DELIVERY, LineSensDrvRcvDeckHal);
+ * @endcode
+ */
+#define CID_DECK_SYS_DELIVERY 0x40
+
+/*!
+ * @~english
+ * @brief Disc eject mode
+*/
+typedef enum {
+ /*! @~english normal eject */
+ DECK_EJECT_NORMAL,
+ /*! @~english forced eject */
+ DECK_EJECT_FORCED
+} DeckEjectMode;
+
+/*!
+ * @~english
+ * @brief Disc mode
+*/
+typedef enum {
+ /*! @~english CD */
+ DECK_KIND_CD,
+ /*! @~english DVD */
+ DECK_KIND_DVD,
+ /*! @~english Blue-lay disc */
+ DECK_KIND_BD
+} DeckKind;
+
+/*------------------------------------------------------------------------------
+ * typedefs
+ *----------------------------------------------------------------------------*/
+/**
+ * \~english Deck-Sys command header structure
+ */
+typedef struct {
+ /*! @~english Source logical address */
+ uint8_t lgadr_from;
+ /*! @~english Forwarding destination logical address */
+ uint8_t lgadr_to;
+ /*! @~english OP code */
+ uint8_t opc;
+ /*! @~english Reserve */
+ uint8_t reserve;
+} DeckCmdhdr;
+
+/**
+ * \~english Deck-Sys command body structure
+ */
+typedef struct DeckCmd {
+ /*! @~english Deck-Sys command header */
+ DeckCmdhdr cmdhdr;
+ /*! @~english Data length */
+ uint16_t data_length;
+ /*! @~english Reserve */
+ uint16_t reserve;
+ /*! @~english Command data */
+ uint8_t data[DECK_CMD_SIZE_CMDDATA_MAX];
+} DeckCmd;
+
+/*!
+ * @~english
+ * @brief Structure for message header
+ */
+typedef struct {
+ uint16_t replyid; //!< \~english Send Result ID
+ uint16_t sndpno; //!< \~english Send process No
+ uint16_t respno; //!< \~english Response No
+ uint16_t cid; //!< \~english Command ID
+ uint16_t msgbodysize; //!< \~english Message body size
+ uint8_t rid; //!< \~english Resource ID
+ uint8_t reserve; //!< \~english Reserve
+ uint8_t filler[2]; //!< \~english filler
+} DECK_HEADER_COMM;
+
+/*!
+ * @~english
+ * @brief Structure for buffer message header
+ */
+typedef struct {
+ uint32_t signo; //!< \~english Signal No
+ DECK_HEADER_COMM hdr; //!< \~english Message Header
+} DECK_MSGBUF_HEADER_COMM;
+
+/**
+ * \~english Delivery message structure
+ */
+typedef struct {
+ /*! @~english Header part */
+ DECK_MSGBUF_HEADER_COMM hdr;
+ /*! @~english Physical address */
+ uint16_t phyadr_from;
+ /*! @~english Communication type */
+ uint8_t service_type;
+ /*! @~english Reserve */
+ uint8_t reserve;
+ /*! @~english Data section */
+ DeckCmd cmd;
+} DECK_MSG_DELIVERY;
+
+/*!
+ * @~english
+ * @brief Structure for send command data
+ */
+typedef struct {
+ /*! @~english Physical address */
+ uint16_t phyadr_from;
+ /*! @~english Communication type */
+ uint8_t service_type;
+ /*! @~english Forwarding former logic address */
+ uint8_t lgadr_from;
+ /*! @~english Forwarding site logic address */
+ uint8_t lgadr_to;
+ /*! @~english Operation code */
+ uint8_t opc;
+ /*! @~english Data length (size in command data */
+ uint8_t d_length;
+ /*! @~english Command data */
+ uint8_t data[DECK_CMD_SIZE_CMDDATA_MAX];
+ /*! @~english reserve */
+ uint8_t reserve;
+} DECK_CMD_DATA;
+
+/*!
+ * @~english
+ * @brief Structure for send command
+ */
+typedef struct {
+ /*! @~english Command information */
+ DECK_CMD_DATA cmd_data;
+} DECK_CMD;
+
+/*------------------------------------------------------------------------------
+ * function declaration
+ *----------------------------------------------------------------------------*/
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StopDiscRotation
+/// \~english @par Brief
+/// Stop disc rotation
+/// \~english @param [in] -
+/// \~english @param [out] -
+/// \~english @retval eFrameworkunifiedStatusOK OK
+/// \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+/// \~english @par Prerequisite
+/// - Disc was inserted
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Error occurs when call open or ioctl function.[eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Stop disc rotation
+/// - Whatever disc is rotating or stoped, return successed.
+/// - The API can be used by multi-process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus StopDiscRotation();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EjectDisc
+/// \~english @par Brief
+/// Eject disc
+/// \~english @param [in] kind
+/// DeckKind - kind of deck.
+/// \~english @param [in] mode
+/// DeckEjectMode - eject mode(normal/forcedly)
+/// \~english @param [out] -
+/// \~english @retval eFrameworkunifiedStatusOK OK
+/// \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Error occurs when call open or ioctl function.[eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Eject disc
+/// - Whatever disc is Ejecting or Unejected, return successed.
+/// - The API can be used by multi-process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus EjectDisc(DeckKind kind, DeckEjectMode mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DeckHalSysSend
+/// \~english @par Brief
+/// Send Disc Sys-Command to MICON
+/// \~english @param [in] h_app
+/// HANDLE - Handle of caller (Handle to get in Dispatcher generation
+/// (FrameworkunifiedCreateDispatcherWithoutLoop etc.))
+/// \~english @param [in] name
+/// PCSTR - Name to notification of send result destination thread name
+/// \~english @param [in] cmd
+/// DECK_CMD - Send command pointer
+/// \~english @param [in] req_id
+/// uint8_t - Resource ID
+/// \~english @param [out] -
+/// \~english @retval eFrameworkunifiedStatusOK Normal termination
+/// \~english @retval eFrameworkunifiedStatusInvldParam Abnormal parameter
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[eFrameworkunifiedStatusInvldParam]
+/// - name is NULL or the length of name is longer than 15 bytes.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Send command pointer(cmd) is null.[eFrameworkunifiedStatusInvldParam]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Send SYS command to MICON
+/// - Now only usb disc exists,MICON disc is stub now.
+/// - The API can only be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DeckHalSysSend(HANDLE h_app, PCSTR name, const DECK_CMD* cmd, uint8_t req_id);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DeckHalRegister
+/// \~english @par Brief
+/// Register the deck_hal command to receive from MICON
+/// \~english @param [in] h_app
+/// HANDLE - Handle of caller (Handle to get in Dispatcher generation
+/// (FrameworkunifiedCreateDispatcherWithoutLoop etc.))
+/// \~english @param [in] notify_name
+/// PCSTR - Name to notification destination thread name
+/// \~english @param [out] -
+/// \~english @retval eFrameworkunifiedStatusOK Normal termination
+/// \~english @retval eFrameworkunifiedStatusInvldParam Abnormal parameter
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[eFrameworkunifiedStatusInvldParam]
+/// - notify_name is NULL or the length of notify_name is longer than 15 bytes.
+/// [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - After call this API, the user can received dech_hal command from MICON.
+/// - Now MICON is stub,so that deck_hal won't register to MICON.
+/// - The API can only be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DeckHalRegister(HANDLE h_app, PCSTR notify_name);
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus */
+
+/** @}*/ // end of deck_hal
+/** @}*/ // end of interface_unified
+
+#endif // HAL_API_DECK_HAL_H_
diff --git a/video_in_hal/deck_hal/inc/deck_hal_deckhallog.h b/video_in_hal/deck_hal/inc/deck_hal_deckhallog.h
new file mode 100755
index 0000000..9aa4624
--- /dev/null
+++ b/video_in_hal/deck_hal/inc/deck_hal_deckhallog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_DECK_HAL_DECKHALLOG_H_
+#define INC_DECK_HAL_DECKHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_DECK_HAL_DECKHALLOG_H_
diff --git a/video_in_hal/deck_hal/src/deck_hal.cpp b/video_in_hal/deck_hal/src/deck_hal.cpp
new file mode 100755
index 0000000..a116e6c
--- /dev/null
+++ b/video_in_hal/deck_hal/src/deck_hal.cpp
@@ -0,0 +1,159 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <fcntl.h>
+#include <unistd.h>
+#include <linux/cdrom.h>
+#include <sys/ioctl.h>
+#include <deck_hal.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <stdio.h>
+#include <string.h>
+#include "deck_hal_deckhallog.h"
+
+#define DECKHAL_THREAD "DeckHal"
+#define DISC_PATH "/dev/sr0"
+// static variables
+static char g_notify_name[NOTIFY_NAME_MAX_SIZE + 1] = {0};
+static bool g_register_status = false; // deck_hal register status
+
+// functions
+EFrameworkunifiedStatus DeckNotifyInfo(const DECK_MSG_DELIVERY &DeliveryData);
+
+EFrameworkunifiedStatus StopDiscRotation() {
+ int fd;
+ int ret;
+ fd = open(DISC_PATH, O_RDONLY);
+ if (fd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "open failed.");
+ return eFrameworkunifiedStatusFail;
+ }
+ ret = ioctl(fd, CDROMSTOP);
+ close(fd);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ioctl failed.");
+ return eFrameworkunifiedStatusFail;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus EjectDisc(DeckKind kind, DeckEjectMode mode) {
+ int fd;
+ int ret;
+ fd = open(DISC_PATH, O_RDONLY);
+ if (fd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "open failed.");
+ return eFrameworkunifiedStatusFail;
+ }
+ ret = ioctl(fd, CDROM_LOCKDOOR);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "unlock disc failed.");
+ close(fd);
+ return eFrameworkunifiedStatusFail;
+ }
+ ret = ioctl(fd, CDROMEJECT);
+ close(fd);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "eject disc failed.");
+ return eFrameworkunifiedStatusFail;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus DeckHalSysSend(HANDLE h_app, PCSTR name, const DECK_CMD* cmd, uint8_t req_id) {
+ EFrameworkunifiedStatus ret = eFrameworkunifiedStatusOK;
+
+ if (NULL == h_app || NULL == name || NULL == cmd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Input param is NULL\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (NOTIFY_NAME_MAX_SIZE < strlen(name)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Input name length is overlapped\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ // DeckHalSysSend aims to send command to micon,
+ // since micon is stub now,so DeckHalSysSend is stub either.
+
+ // deck_hal should notify chande mode status after received mode change info
+ // from micon,since now micon is stub,notify change mode status to vehicle
+ // immediately.
+ // the data notify to vehile is just a example.
+ DECK_MSG_DELIVERY data;
+ data.cmd.cmdhdr.lgadr_from = 0x44; // vehile:LSDRV_ADR_DVD_P
+ data.cmd.cmdhdr.lgadr_to = 0xC8; // vehicle:LSDRV_OPC_DRV_M_CH_A_DVD
+ data.cmd.cmdhdr.opc = 0xC8; // vehicle:LSDRV_OPC_DRV_M_CH_A_DVD
+ DeckNotifyInfo(data);
+
+ return ret;
+}
+
+EFrameworkunifiedStatus DeckHalRegister(HANDLE h_app, PCSTR notify_name) {
+ if (NULL == h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Input h_app is NULL\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (NULL == notify_name) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Input notify_name is NULL\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (strlen(notify_name) > NOTIFY_NAME_MAX_SIZE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Input notify_name length is overlapped\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ strncpy(g_notify_name, notify_name, NOTIFY_NAME_MAX_SIZE);
+
+ // now micon is stub,in the future,should register to micon
+
+ g_register_status = true;
+
+ return eFrameworkunifiedStatusOK;
+}
+
+// DeckNotifyInfo aims to send deck infos to vehicle
+// if micon is not stub in the future,after received meesage from micon
+// or any other ways triggered by micon,deck_hal should call this function
+// with different input data to send these data to vehicle.
+EFrameworkunifiedStatus DeckNotifyInfo(const DECK_MSG_DELIVERY &DeliveryData) {
+ EFrameworkunifiedStatus ret = eFrameworkunifiedStatusOK;
+ HANDLE send_handle = NULL;
+
+ if (g_register_status == true) {
+ send_handle = McOpenSender(g_notify_name);
+ if (send_handle == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedMcOpenSender to _CWORD121_Shadow Failed.");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ ret = McSend(send_handle, DECKHAL_THREAD, CID_DECK_SYS_DELIVERY,
+ sizeof(DECK_MSG_DELIVERY), &DeliveryData);
+
+ if (eFrameworkunifiedStatusOK != ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Failed to send CID_DECK_SYS_DELIVERY.");
+ ret = eFrameworkunifiedStatusFail;
+ }
+
+ if (send_handle != NULL) {
+ McClose(send_handle);
+ send_handle = NULL;
+ }
+ }
+
+ return ret;
+}
diff --git a/video_in_hal/hal_api/video_in_hal.h b/video_in_hal/hal_api/video_in_hal.h
new file mode 100755
index 0000000..20b45a0
--- /dev/null
+++ b/video_in_hal/hal_api/video_in_hal.h
@@ -0,0 +1,567 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_VIDEO_IN_HAL_H_
+#define HAL_API_VIDEO_IN_HAL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file video_in_hal.h
+ * @brief API definition of the function to control video
+ */
+
+/** @addtogroup graphics_service
+ * @{
+ */
+/** @addtogroup video_in_hal
+ * @ingroup graphics_service
+ * @{
+ */
+
+
+/* Monitor state */
+#define VIH_DISP_MONITOR_ON (0) //!< \~english Monitor on
+#define VIH_DISP_MONITOR_OFF (1) //!< \~english Monitor Off
+
+/* Illumination */
+#define VIH_DISP_ILLUMI_INIT (0) //!< \~english Not configured
+#define VIH_DISP_ILLUMI_DAY (1) //!< \~english Day screen
+#define VIH_DISP_ILLUMI_NIGHT (2) //!< \~english Night screen
+#define VIH_DISP_ILLUMI_FOURCE_DAY (3) //!< \~english Force day screen
+#define VIH_DISP_ILLUMI_FOURCE_NIGHT (4) //!< \~english Force night screen
+
+/* Auto dimmer */
+#define VIH_DISP_AUTO_DIMMER_OFF (0) //!< \~english Auto dimmer off
+#define VIH_DISP_AUTO_DIMMER_ON (1) //!< \~english Auto dimmer on
+
+/* MUTE */
+#define VIH_DISP_MUTE_OFF (0) //!< \~english Mute off
+#define VIH_DISP_MUTE_ON (1) //!< \~english Mute on
+
+/* Back light */
+#define VIH_DISP_BACKLIGHT_OFF (0) //!< \~english Back light off
+#define VIH_DISP_BACKLIGHT_ON (1) //!< \~english Back light on
+
+/* Type of video source */
+#define VIH_VIDEO_SOURCE_R_CAMERA (0x00) //!< \~english Rear video camera
+#define VIH_VIDEO_SOURCE_F_CAMERA (0x01) //!< \~english Front video camera
+#define VIH_VIDEO_SOURCE_S_CAMERA (0x02) //!< \~english Side video camera
+#define VIH_VIDEO_SOURCE_STOP (0x03) //!< \~english Stop the video
+#define VIH_VIDEO_SOURCE_DVD (0x04) //!< \~english DVD video
+#define VIH_VIDEO_SOURCE_BD (0x05) //!< \~english BD video
+#define VIH_VIDEO_SOURCE_DTV (0x06) //!< \~english DTV(Built-in)
+#define VIH_VIDEO_SOURCE_EXT_DTV (0x07) //!< \~english DTV(External)
+#define VIH_VIDEO_SOURCE_SD_VIDEO (0x08) //!< \~english SD video
+#define VIH_VIDEO_SOURCE_VTR (0x09) //!< \~english VTR(Built-in)
+#define VIH_VIDEO_SOURCE_VTR2 (0x0A) //!< \~english VTR2(Built-in)
+#define VIH_VIDEO_SOURCE_EXT_VTR (0x0B) //!< \~english VTR(External)
+#define VIH_VIDEO_SOURCE_EXT_NAVI (0x0C) //!< \~english NAVI(External)
+#define VIH_VIDEO_SOURCE_EXT (0x0D) //!< \~english Extension box
+#define VIH_VIDEO_SOURCE__CWORD57__VIDEO (0x0E) //!< \~english _CWORD57_(Video)
+#define VIH_VIDEO_SOURCE__CWORD57__OUT (0x0F) //!< \~english _CWORD57_(Out)
+#define VIH_VIDEO_SOURCE__CWORD57__NAVI (0x10) //!< \~english _CWORD57_(Navi)
+#define VIH_VIDEO_SOURCE_MIRRORLINK (0x11) //!< \~english Mirror link
+#define VIH_VIDEO_SOURCE_USB_VIDEO (0x12) //!< \~english USB video
+#define VIH_VIDEO_SOURCE_MIRACAST (0x16) //!< \~english Miracast
+#define VIH_VIDEO_SOURCE__CWORD27_ (0x17) //!< \~english _CWORD111_
+#define VIH_VIDEO_SOURCE_SD_VIDEO_CPRM (0x18) //!< \~english SD source(CPRM)
+#define VIH_VIDEO_SOURCE_SD_VIDEO_AVCHD (0x19) //!< \~english SD source(AVCHD)
+#define VIH_VIDEO_SOURCE_DIAG_CAMERA (0x1A) //!< \~english Camera diagnosis
+#define VIH_VIDEO_SOURCE_BLANK (0xFE) //!< \~english Blank
+
+/* Type of TV system */
+#define VIH_VIDEO_TVTYPE_NONE (0) //!< \~english Not configured
+#define VIH_VIDEO_TVTYPE_NTSC (1) //!< \~english NTSC
+#define VIH_VIDEO_TVTYPE_PAL (2) //!< \~english PAL
+#define VIH_VIDEO_TVTYPE_SECAM (3) //!< \~english SECAM
+#define VIH_VIDEO_TVTYPE_AUTO (255) //!< \~english Auto
+
+/* de-interlace */
+#define VIH_VIDEO_INTERLACE_DEFAULT (0) //!< \~english Interlaced(Default)
+#define VIH_VIDEO_INTERLACE_REPLICATE (1) //!< \~english Interlaced(Reprica)
+#define VIH_VIDEO_INTERLACE_WEAVE (2) //!< \~english Interlaced(Weave)
+#define VIH_VIDEO_INTERLACE_BOB (3) //!< \~english Interlaced(Bob)
+#define VIH_VIDEO_INTERLACE_AUTO (4) //!< \~english Interlaces(Auto)
+#define VIH_VIDEO_INTERLACE_LINE (5) //!< \~english Interlaces(Line)
+
+/* Aspect */
+#define VIH_VIDEO_ASPECT_NORMAL (0) //!< \~english Normal
+#define VIH_VIDEO_ASPECT_WIDE (1) //!< \~english Wide
+#define VIH_VIDEO_ASPECT_FULL (2) //!< \~english Full
+#define VIH_VIDEO_ASPECT_ZOOM (3) //!< \~english Zoom
+
+/* Aspect Ratio */
+#define VIH_VIDEO_ASPECT_RATIO_DEFAULT (0) //!< \~english Default
+#define VIH_VIDEO_ASPECT_RATIO_4_3 (1) //!< \~english 4:3
+#define VIH_VIDEO_ASPECT_RATIO_16_9 (2) //!< \~english 16:9
+#define VIH_VIDEO_ASPECT_RATIO_4_3_LB (3) //!< \~english 4:3(Letter box)
+
+/* Enable or disable */
+#define VIH_ENABLE (1) //!< \~english Enable
+#define VIH_DISABLE (0) //!< \~english Disable
+
+/* Send information: Control module */
+#define VIH_DISP_SEQ_CTRL 0x0003 //!< \~english Sequence control
+#define VIH_DISP_VCAP1_CTRL 0x0005 //!< \~english Video capture1 control
+#define VIH_DISP_VCAP2_CTRL 0x0006 //!< \~english Video capture2 control
+
+/* Message ID: Put or delete diagnosis code */
+#define VIH_DISP_MAIN_IND_PUTDIAG (0x5200) //!< \~english Put diagnosis code
+#define VIH_DISP_MAIN_IND_DELDIAG (0x5201) //!< \~english Delete diagnosis code
+
+/**
+ * \~english Event ID
+ */
+typedef enum TagVideoInHalEventID {
+ VIH_EVENT_ID_SOURCE, //!< \~english Display source change
+ VIH_EVENT_ID_QUALITY, //!< \~english Set quality(display)
+ VIH_EVENT_ID_VIDEOQUALITY, //!< \~english Set quality(video)
+ VIH_EVENT_ID_ASPECT, //!< \~english Set aspect
+ VIH_EVENT_ID_MONITOR, //!< \~english Set monitor(display)
+ VIH_EVENT_ID_VIDEOVISIBLE, //!< \~english Set video visible(video)
+ VIH_EVENT_ID_MUTE, //!< \~english Set mute
+ VIH_EVENT_ID_BACKLIGHT, //!< \~english Set backlight
+ VIH_EVENT_ID_NUM_MAX
+} VIH_EVENTID;
+
+/**
+ * \~english Control ID
+ */
+typedef enum TagVideoInHalControlID {
+ VIH_CONTROL_ID_SOURCE, //!< \~english Display source change
+ VIH_CONTROL_ID_QUALITY, //!< \~english Set quality(display)
+ VIH_CONTROL_ID_VIDEOQUALITY, //!< \~english Set quality(video)
+ VIH_CONTROL_ID_ASPECT, //!< \~english Set aspect
+ VIH_CONTROL_ID_MONITOR, //!< \~english Set monitor(display)
+ VIH_CONTROL_ID_VIDEOVISIBLE, //!< \~english Set video visible(video)
+ VIH_CONTROL_ID_START_CAPTURE, //!< \~english Start capture
+ VIH_CONTROL_ID_STOP_CAPTURE, //!< \~english Stop capture
+ VIH_CONTROL_ID_TVTYPE, //!< \~english Set TV type
+ VIH_CONTROL_ID_DEINTERLACE, //!< \~english Set de-interlace
+ VIH_CONTROL_ID_VMUTE, //!< \~english Set mute
+ VIH_CONTROL_ID_BACKLIGHT, //!< \~english Set backlight
+ VIH_CONTROL_ID_NUM_MAX
+} VIH_CONTROLID;
+
+/**
+ * \~english Type of video device's return value
+ */
+typedef enum TagVideoInHalRet {
+ VIH_RET_SUCCESS, //!< \~english OK
+ VIH_RET_INVALID_PARAMETER, //!< \~english Invalid parameter
+ VIH_RET_INTERNAL_ERROR, //!< \~english Internal error
+ VIH_RET_NUM_MAX
+} VIH_RET;
+
+/**
+ * \~english context kind
+ */
+typedef enum TagVideoInHalContext {
+ VIH_CONTEXT_DISP = 0, //!< \~english Display
+ VIH_CONTEXT_VIDEO, //!< \~english Video
+ VIH_CONTEXT_NUM_MAX
+} VIH_CONTEXT;
+
+/**
+ * \~english Display ID
+ */
+typedef enum TagVideoInHalDispIdx {
+ VIH_DISP_IDX_MONITOR0, //!< \~english Monitor0 (Front monitor)
+ VIH_DISP_IDX_MONITOR1, //!< \~english Monitor1 (Rear monitor)
+ VIH_DISP_IDX_MONITOR2, //!< \~english Monitor2
+ VIH_DISP_IDX_MONITOR3, //!< \~english Monitor3
+ VIH_DISP_IDX_MONITOR4, //!< \~english Monitor4
+ VIH_DISP_IDX_MONITOR5, //!< \~english Monitor5
+ VIH_DISP_IDX_NUM_MAX
+} VIH_DISP_IDX;
+
+/**
+ * \~english Video ID
+ */
+typedef enum TagVideoInHalVideoOut {
+ VIH_VIDEO_OUT_MONITOR0 = 0, //!< \~english Monitor0 (Front monitor)
+ VIH_VIDEO_OUT_MONITOR1, //!< \~english Monitor1 (Rear monitor)
+ VIH_VIDEO_OUT_MONITOR2, //!< \~english Monitor2
+ VIH_VIDEO_OUT_MONITOR3, //!< \~english Monitor3
+ VIH_VIDEO_OUT_MONITOR4, //!< \~english Monitor4
+ VIH_VIDEO_OUT_MONITOR5, //!< \~english Monitor5
+ VIH_VIDEO_OUT_NONE, //!< \~english Monitor none
+ VIH_VIDEO_OUT_NUM_MAX
+} VIH_VIDEO_OUT;
+
+/**
+ * \~english Structure for display tone color
+ */
+typedef struct TagVideoInHalDispTone {
+ int16_t day; //!< \~english Day screen
+ int16_t night; //!< \~english Night screen
+ int16_t force_day; //!< \~english Force day screen
+ int16_t force_night; //!< \~english Force night screen
+} VIH_DISPTONE;
+
+/**
+ * \~english Structure for display tone hue
+ */
+typedef struct TagVideoInHalDispHue {
+ int16_t day; //!< \~english Day screen
+ int16_t night; //!< \~english Night screen
+ int16_t force_day; //!< \~english Force day screen
+ int16_t force_night; //!< \~english Force night screen
+} VIH_DISPHUE;
+
+/**
+ * \~english Structure for display tone contrast
+ */
+typedef struct TagVideoInHalDispContrast {
+ int16_t day; //!< \~english Day screen
+ int16_t night; //!< \~english Night screen
+ int16_t force_day; //!< \~english Force day screen
+ int16_t force_night; //!< \~english Force night screen
+} VIH_DISPCONTRAST;
+
+/**
+ * \~english Structure for display tone brightness
+ */
+typedef struct TagVideoInHalDispBrightness {
+ int16_t day; //!< \~english Day screen
+ int16_t night; //!< \~english Night screen
+ int16_t force_day; //!< \~english Force day screen
+ int16_t force_night; //!< \~english Force night screen
+} VIH_DISPBRIGHTNESS;
+
+/**
+ * \~english Structure for display image quality parameters
+ */
+typedef struct TagVideoInHalDispParamSetUp {
+ u_int8_t source; //!< \~english Source type for quality setting
+ u_int8_t reserved[3]; //!< \~english Reserved
+ VIH_DISPTONE tone; //!< \~english Tone
+ VIH_DISPHUE hue; //!< \~english Hue
+ VIH_DISPCONTRAST contrast; //!< \~english Contrast
+ VIH_DISPBRIGHTNESS brightness; //!< \~english Brightness
+} VIH_DISP_PARAM_SETUP;
+
+/**
+ * \~english Structure for display parameters
+ */
+typedef struct TagVideoInHalDispParam {
+ u_int8_t monitor; //!< \~english Monitor state
+ u_int8_t reserve[3]; //!< \~english Reserve
+ VIH_DISP_PARAM_SETUP setup; //!< \~english Quality setting
+ u_int8_t illumi; //!< \~english Illumination
+ u_int8_t dimmer; //!< \~english Auto dimmer
+ u_int8_t mute; //!< \~english Mute
+ u_int8_t backlight; //!< \~english Back light
+} VIH_DISPPARAM;
+
+/**
+ * \~english Structure for video tone color
+ */
+typedef struct TagVideoInHalVideoTone {
+ int16_t day; //!< \~english Day screen
+ int16_t night; //!< \~english Night screen
+ int16_t force_day; //!< \~english Force day screen
+ int16_t force_night; //!< \~english Force night screen
+} VIH_VIDEOTONE;
+
+/**
+ * \~english Structure for video tone hue
+ */
+typedef struct TagVideoInHalVideoHue {
+ int16_t day; //!< \~english Day screen
+ int16_t night; //!< \~english Night screen
+ int16_t force_day; //!< \~english Force day screen
+ int16_t force_night; //!< \~english Force night screen
+} VIH_VIDEOHUE;
+
+/**
+ * \~english Structure for video tone contrast
+ */
+typedef struct TagVideoInHalVideoContrast {
+ int16_t day; //!< \~english Day screen
+ int16_t night; //!< \~english Night screen
+ int16_t force_day; //!< \~english Force day screen
+ int16_t force_night; //!< \~english Force night screen
+} VIH_VIDEOCONTRAST;
+
+/**
+ * \~english Structure for video tone brightness
+ */
+typedef struct TagVideoInHalVideoBrightness {
+ int16_t day; //!< \~english Day screen
+ int16_t night; //!< \~english Night screen
+ int16_t force_day; //!< \~english Force day screen
+ int16_t force_night; //!< \~english Force night screen
+} VIH_VIDEOBRIGHTNESS;
+
+/**
+ * \~english Structure for video image quality parameters
+ */
+typedef struct TagVideoInHalVideoParamSetUp {
+ u_int8_t source; //!< \~english Source type for quality setting
+ u_int8_t reserve[3]; //!< \~english reserve
+ VIH_VIDEOTONE tone; //!< \~english Tone
+ VIH_VIDEOHUE hue; //!< \~english Hue
+ VIH_VIDEOCONTRAST contrast; //!< \~english Contrast
+ VIH_VIDEOBRIGHTNESS brightness; //!< \~english Brightness
+} VIH_VIDEO_PARAM_SETUP;
+
+/**
+ * \~english Structure for video position and angle
+ */
+typedef struct TagVideoInHalVideoPos {
+ u_int32_t aspect_x; //!< \~english Display position x
+ u_int32_t aspect_y; //!< \~english Display position y
+ u_int32_t aspect_w; //!< \~english Display width
+ u_int32_t aspect_h; //!< \~english Display height
+} VIH_VIDEOPOS;
+
+/**
+ * \~english Structure for video parameters
+ */
+typedef struct TagVideoInHalVideoParam {
+ u_int8_t source; //!< \~english Video Source
+ u_int8_t type; //!< \~english TV type
+ u_int8_t interlace; //!< \~english De-interlace
+ u_int8_t aspect; //!< \~english Aspect Value
+ VIH_VIDEOPOS angle; //!< \~english Angle
+ VIH_VIDEO_PARAM_SETUP setup; //!< \~english Quality setting
+ u_int8_t monitor; //!< \~english Monitor
+ u_int8_t mute; //!< \~english Mute
+ u_int8_t aspect_ratio; //!< \~english Aspect ratio
+ u_int8_t reserve; //!< \~english Reserve
+ u_int32_t window_priority; //!< \~english Window priority
+} VIH_VIDEOPARAM;
+
+/**
+ * \~english Structure for display identify
+ */
+typedef struct TagVideoInHalDispVideoID {
+ VIH_CONTEXT kind; //!< \~english Context type
+ struct timespec tp; //!< \~english Context create time
+} VIH_DISPVIDEOID;
+
+/**
+ * \~english Structure for display information
+ */
+typedef struct TagVideoInHalDispVideoInfo {
+ VIH_DISPVIDEOID context_id; //!< \~english Context identify
+ u_int32_t dsp_idx; //!< \~english Display index
+ u_int32_t chgflg; //!< \~english Setting change flag
+} VIH_DISPVIDEOINFO;
+
+/**
+ * \~english Structure for display context
+ */
+typedef struct TagVideoInHalDispMngCtx {
+ VIH_DISPVIDEOINFO info; //!< \~english Display information
+ VIH_DISPPARAM disp_param[VIH_DISP_IDX_NUM_MAX]; //!< \~english Display parameter
+ VIH_VIDEOPARAM video_param[VIH_VIDEO_OUT_NUM_MAX]; //!< \~english Video parameter
+} VIH_DISPMNGCTX;
+
+/**
+ * \~english Structure for diagnosis code data
+ */
+typedef struct TagVideoInHalGRMainReqDiagData {
+ uint64_t err_id; //!< \~english Error ID
+ uint16_t videoinhal_code; //!< \~english Code
+ uint8_t reserve1[2]; //!< \~english Reserve
+} VIH_GR_MAIN_REQ_DIAGDATA;
+
+
+/**
+ * \ingroup SendDiagCodeCallBack
+ * \~english @par Brief
+ * Send diagnosis code call back.
+ * \~english @param [in] snd_info
+ * u_int16_t - Send information
+ * \~english @param [in] msg_id
+ * u_int32_t - Message ID
+ * \~english @param [in] diag_data
+ * VIH_GR_MAIN_REQ_DIAGDATA* - Diagnosis code data
+ * \~english @par
+ * u_int16_t snd_info
+ * \~english @code
+ * VIH_DISP_SEQ_CTRL 0x0003 // Sequence control
+ * VIH_DISP_VCAP1_CTRL 0x0005 // Video capture1 control
+ * VIH_DISP_VCAP2_CTRL 0x0006 // Video capture2 control
+ * @endcode
+ * \~english @par
+ * u_int32_t msg_id
+ * \~english @code
+ * VIH_DISP_MAIN_IND_PUTDIAG (0x5200) // Put diagnosis code
+ * VIH_DISP_MAIN_IND_DELDIAG (0x5201) // Delete diagnosis code
+ * @endcode
+ * \~english @par
+ * VIH_GR_MAIN_REQ_DIAGDATA struct
+ * \~english @code
+ * typedef struct TagVideoInHalGRMainReqDiagData
+ * {
+ * uint64_t err_id; // Error ID
+ * uint16_t videoinhal_code; // Videoinhal code
+ * uint8_t reserve1[2]; // Reserve
+ * } VIH_GR_MAIN_REQ_DIAGDATA;
+ * @endcode
+ * \~english @retval 0 : OK
+ * \~english @retval -1 : Invalid parameter
+ * \~english @par Detail
+ * - Notify diagnosis code request to graphics_service.
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Conditions of processing failure
+ * - When input parameter diag_data is NULL, return with error. [-1]
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+typedef int (*SendDiagCodeCallBack)(u_int16_t snd_info, u_int32_t msg_id, VIH_GR_MAIN_REQ_DIAGDATA* diag_data);
+
+/**
+ * \ingroup InitVideo
+ * \~english @par Brief
+ * API to display device initialize.
+ * \~english @param [in] call_back
+ * SendDiagCodeCallBack - Send diagnosis trace code call back function
+ * \~english @retval VIH_RET_SUCCESS : OK
+ * \~english @retval VIH_RET_INVALID_PARAMETER : Invalid parameter
+ * \~english @par Detail
+ * - Display device initialize, init parameter and threads.
+ * - The API can only be used by 1 process.
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Conditions of processing failure
+ * - When display device driver can not be found, return with error. [VIH_RET_INVALID_PARAMETER]
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+VIH_RET InitVideo(SendDiagCodeCallBack call_back);
+
+/**
+ * \ingroup ControlVideo
+ * \~english @par Brief
+ * API to Control display device.
+ * \~english @param [in] pctx
+ * VIH_DISPMNGCTX* - Point of parameter used by control display device
+ * \~english @param [in] event_id
+ * VIH_EVENTID - Event ID
+ * \~english @param [in] control_id
+ * VIH_CONTROLID - Control ID
+ * \~english @par
+ * VIH_DISPMNGCTX struct
+ * \~english @code
+ * typedef struct TagVideoInHalDispMngCtx
+ * {
+ * VIH_DISPVIDEOINFO info; // Information of display
+ * VIH_DISPPARAM disp_param[VIH_DISP_IDX_NUM_MAX]; // Paramter of diaplay
+ * VIH_VIDEOPARAM video_param[VIH_VIDEO_OUT_NUM_MAX]; // Paramter of video
+ * } VIH_DISPMNGCTX;
+ * @endcode
+ * \~english @par
+ * VIH_EVENTID enum
+ * \~english @code
+ * typedef enum TagVideoInHalEventID
+ * {
+ * VIH_EVENT_ID_SOURCE, // Display source change
+ * VIH_EVENT_ID_QUALITY, // Set quality(display)
+ * VIH_EVENT_ID_VIDEOQUALITY, // Set quality(video)
+ * VIH_EVENT_ID_ASPECT, // Set aspect
+ * VIH_EVENT_ID_MONITOR, // Set monitor(display)
+ * VIH_EVENT_ID_VIDEOVISIBLE, // Set video visible(video)
+ * VIH_EVENT_ID_MUTE, // Set mute
+ * VIH_EVENT_ID_BACKLIGHT, // Set backlight
+ * VIH_EVENT_ID_NUM_MAX
+ * } VIH_EVENTID;
+ * @endcode
+ * \~english @par
+ * VIH_CONTROLID enum
+ * \~english @code
+ * typedef enum TagVideoInHalControlID
+ * {
+ * VIH_CONTROL_ID_SOURCE, // Display source change
+ * VIH_CONTROL_ID_QUALITY, // Set quality(display)
+ * VIH_CONTROL_ID_VIDEOQUALITY, // Set quality(video)
+ * VIH_CONTROL_ID_ASPECT, // Set aspect
+ * VIH_CONTROL_ID_MONITOR, // Set monitor(display)
+ * VIH_CONTROL_ID_VIDEOVISIBLE, // Set video visible(video)
+ * VIH_CONTROL_ID_START_CAPTURE, // Start capture
+ * VIH_CONTROL_ID_STOP_CAPTURE, // Stop capture
+ * VIH_CONTROL_ID_TVTYPE, // Set TV type
+ * VIH_CONTROL_ID_DEINTERLACE, // Set de-interlace
+ * VIH_CONTROL_ID_VMUTE, // Set mute
+ * VIH_CONTROL_ID_BACKLIGHT, // Set backlight
+ * VIH_CONTROL_ID_NUM_MAX
+ * } VIH_CONTROLID;
+ * @endcode
+ * \~english @retval VIH_RET_SUCCESS : OK
+ * \~english @retval VIH_RET_INVALID_PARAMETER : Invalid parameter
+ * \~english @retval VIH_RET_INTERNAL_ERROR : Internal error
+ * \~english @par Detail
+ * - Control display device. Include display source, quality(display), quality(video), aspect , monitor, video visible, start capture, stop capture, mute, backlight, TV type, de-interlace.
+ * - The API can only be used by 1 process.
+ * \~english @par Prerequisite
+ * - Call InitVideo()
+ * \~english @par Conditions of processing failure
+ * - The point param is null [VIH_RET_INVALID_PARAMETER]
+ * - The display driver return error [VIH_RET_INTERNAL_ERROR]
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Fire and Forget
+ * \~english @see
+ * None
+ */
+VIH_RET ControlVideo(VIH_DISPMNGCTX* pctx, VIH_EVENTID event_id, VIH_CONTROLID control_id);
+
+/**
+ * \ingroup TerminateVideo
+ * \~english @par Brief
+ * API to display device Terminate.
+ * \~english @param None
+ * \~english @retval VIH_RET_SUCCESS : OK
+ * \~english @par Detail
+ * - Display device Terminate, init parameter.
+ * - The API can only be used by 1 process.
+ * \~english @par Prerequisite
+ * - Call InitVideo().
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+VIH_RET TerminateVideo();
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ //!< end of video_in_hal
+/** @}*/ //!< end of graphics_service
+
+#endif // HAL_API_VIDEO_IN_HAL_H_
diff --git a/video_in_hal/input_hal/LICENSE b/video_in_hal/input_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/input_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/input_hal/Makefile b/video_in_hal/input_hal/Makefile
new file mode 100755
index 0000000..35dfefd
--- /dev/null
+++ b/video_in_hal/input_hal/Makefile
@@ -0,0 +1,81 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+COMPONENT_NAME := peripheral_service
+
+######### installed program/file ################
+TARGET := libinput_hal.so
+
+HEADER := ./hal_api/input_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/include/libdrm
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+CXXFLAGS += -D_USE_DRM
+
+######### link options ##########################
+LDFLAGS := -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+######### linked library ########################
+LIBS := -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LIBS += -Wl,-Bdynamic -ludev
+LIBS += -Wl,-Bdynamic -lpthread
+LIBS += -Wl,-Bdynamic -ldrm
+
+######### source files ##########################
+VPATH := src
+OBJS := input_hal.o
+OBJS += input_touch_ilitek.o
+OBJS += input_util.o
+OBJS += input_udev_monitor.o
+OBJS += input_drm.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install: install-input
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
+
+install-input:
+ install -m 0755 -d $(DESTDIR)/usr/agl/include/$(COMPONENT_NAME)/
+ install -m 0644 ./hal_api/$(COMPONENT_NAME)/aglinput.h $(DESTDIR)/usr/agl/include/$(COMPONENT_NAME)/
+ install -m 0644 ./hal_api/$(COMPONENT_NAME)/extinput.h $(DESTDIR)/usr/agl/include/$(COMPONENT_NAME)/
diff --git a/video_in_hal/input_hal/README.md b/video_in_hal/input_hal/README.md
new file mode 100755
index 0000000..4a69113
--- /dev/null
+++ b/video_in_hal/input_hal/README.md
@@ -0,0 +1,3 @@
+input_hal library
+==================
+Input HAL implementation library for AGL Reference Board.
diff --git a/video_in_hal/input_hal/hal_api/input_hal.h b/video_in_hal/input_hal/hal_api/input_hal.h
new file mode 100755
index 0000000..bfc9d59
--- /dev/null
+++ b/video_in_hal/input_hal/hal_api/input_hal.h
@@ -0,0 +1,696 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_INPUT_HAL_H_
+#define HAL_API_INPUT_HAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+#include "peripheral_service/aglinput.h"
+
+/**
+ * @file input_hal.h
+ */
+
+/** @addtogroup switchhandler
+ * @{
+ */
+/** @addtogroup input_hal
+ * @ingroup switchhandler
+ * @{
+ */
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/**
+ * \~english Return value type
+ */
+enum HalInputRetType {
+ /**
+ * \~english Success
+ */
+ HAL_INPUT_RET_NORMAL = 0,
+ /**
+ * \~english Process abnormality
+ */
+ HAL_INPUT_RET_ERROR,
+ /**
+ * \~english Not support
+ */
+ HAL_INPUT_RET_NOT_SUPPORT,
+};
+/**
+ * \~english Touch panel IC type
+ */
+enum HalInputTouchDeviceType {
+ /**
+ * \~english Touch panel IC is invalid
+ */
+ HAL_INPUT_TOUCH_DEVICE_INVALID = 0,
+ /**
+ * \~english Touch panel IC is ILITEK
+ */
+ HAL_INPUT_TOUCH_DEVICE_ILITEK,
+};
+
+/**
+ * \~english Radio band type
+ */
+enum HalInputBandType {
+ /**
+ * \~english Radio band is AM
+ */
+ HAL_INPUT_BAND_TYPE_AM = 0,
+ /**
+ * \~english Radio band isn't AM
+ */
+ HAL_INPUT_BAND_TYPE_NOT_AM,
+};
+
+/**
+ * \~english Radio reception status
+ */
+enum HalInputTuneStatus {
+ /**
+ * \~english Radio is in normal state
+ */
+ HAL_INPUT_TUNE_STATUS_NORMAL = 0,
+ /**
+ * \~english Radio is in search state
+ */
+ HAL_INPUT_TUNE_STATUS_SERACH,
+};
+
+/**
+ * \~english Sensitivity Level
+ */
+enum HalInputTouchSensitivityLevel {
+ /**
+ * \~english Sensitivity level low
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_LOW = 1,
+ /**
+ * \~english Sensitivity level middle
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_MIDDLE,
+ /**
+ * \~english Sensitivity level high
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_HIGH,
+ /**
+ * \~english Sensitivity level none
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_NONE,
+};
+
+/**
+ * \~english input device type
+ */
+enum HalInputDeviceType {
+ /**
+ * \~english The device type invalid
+ */
+ HAL_INPUT_DEVICE_INVALID,
+ /**
+ * \~english The device is keyboard
+ */
+ HAL_INPUT_DEVICE_KEYBOARD,
+ /**
+ * \~english The device is touch
+ */
+ HAL_INPUT_DEVICE_TOUCH,
+ /**
+ * \~english The device is ESC-KEY
+ */
+ HAL_INPUT_DEVICE_TOUCH_ESCKEY,
+ /**
+ * \~english The device is steering SW
+ */
+ HAL_INPUT_DEVICE_STEERING,
+ /**
+ * \~english The device is tablet finger
+ */
+ HAL_INPUT_DEVICE_TABLET_FINGER,
+ /**
+ * \~english The device is rotary key
+ */
+ HAL_INPUT_DEVICE_ROTARY_KEY,
+};
+
+/**
+ * \~english Don't need to config touch panel
+ */
+#define HAL_INPUT_TOUCH_CONFIG_OFF (0)
+/**
+ * \~english Touch panel configed
+ */
+#define HAL_INPUT_TOUCH_CONFIG_ON (1)
+
+/**
+ * \~english Touch panel touch press
+ */
+#define HAL_INPUT_TOUCH_PRESS (0)
+/**
+ * \~english Touch panel touch release
+ */
+#define HAL_INPUT_TOUCH_RELEASE (1)
+
+/**
+ * \~english Don't report touch panel's touch event
+ */
+#define HAL_INPUT_TOUCH_UNREPORT (0)
+/**
+ * \~english Report touch panel's touch event
+ */
+#define HAL_INPUT_TOUCH_REPORT (1)
+
+/**
+ * \~english Test all case
+ */
+#define HAL_INPUT_TOUCH_SELFTEST_ID_ALL (0xFE)
+/**
+ * \~english Selftest data length
+ */
+#define HAL_INPUT_TOUCH_SELFTEST_DATA_LEN (5)
+/**
+ * \~english Selftest mode not support
+ */
+#define HAL_INPUT_TOUCH_SELFTEST_NOT_SUPPORT (0xEE)
+
+/**
+ * \~english max number of input_event per package.
+ */
+#define HAL_INPUT_EVENT_COUNT 64
+
+/**
+ * \~english Thread name defined
+ */
+#define HAL_INPUT_SOURCE_NAME "input_hal_mon"
+
+/**
+ * \~english Notify input event from touch panel,
+ * The data of the notification please refer the following two type.\n
+ * @ref HAL_INPUT_TOUCH_PRESS \n
+ * @ref HAL_INPUT_TOUCH_RELEASE \n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_TOUCH, fpOnCmd);
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_TOUCH 100
+/**
+ * \~english Notify input event from touch panel ESC-KEY,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_ESC_KEY, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_ESC_KEY 101
+/**
+ * \~english Notify input event from key board,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_KEY_BOARD, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_KEY_BOARD 102
+/**
+ * \~english Notify input event from steering,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_STEERING, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_STEERING 104
+/**
+ * \~english Notify input event from tablet finger,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_TABLET_FINGER, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_TABLET_FINGER 105
+/**
+ * \~english Notify input event from rotary-key,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_ROTARY_KEY, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_ROTARY_KEY 106
+
+/**
+ * \~english Initialzing touch result notify,
+ * The data format of the notification please refer to @ref TouchInitFinishInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH 120
+
+/**
+ * @struct RadioInfoTouch
+ * \~english @par Brief
+ * Radio information
+ */
+struct RadioInfoTouch {
+ /**
+ * \~english Radio band type
+ * \~english Please ref to @ref HalInputBandType
+ */
+ int16_t band;
+ /**
+ * \~english Frequency of the tuner[kHz]
+ * (Use only at the time of AM reception)
+ */
+ uint16_t freq;
+ /**
+ * \~english Reception status (Use only at the time of AM reception)
+ * \~english Please refer to @ref HalInputBandType
+ */
+ int32_t status;
+};
+
+/**
+ * @struct SelftestTouch
+ * \~english @par Brief
+ * Touch panel selftest mode result
+ */
+struct SelftestTouch {
+ /**
+ * \~english Touch panel selftest mode result
+ */
+ unsigned char r_code;
+ /**
+ * \~english Touch panel selftest mode data.
+ * The datail info is depend on hardware spec.
+ */
+ unsigned char r_data[HAL_INPUT_TOUCH_SELFTEST_DATA_LEN];
+};
+
+/**
+ * @struct EventsPackageInput
+ * \~english @par Brief
+ * Input event package defined
+ */
+struct EventsPackageInput {
+ /**
+ * \~english device type
+ */
+ int device_type;
+ /**
+ * \~english event count
+ */
+ int count;
+ /**
+ * \~english input event data.
+ */
+ struct input_event event[HAL_INPUT_EVENT_COUNT];
+};
+
+/**
+ * @struct TouchInitFinishInput
+ * \~english @par Brief
+ * The result of initializing touch
+ */
+struct TouchInitFinishInput {
+ /**
+ * \~english If initializing the touch successful, the result was set HAL_INPUT_RET_NORMAL.
+ * If an error occurred, the result was set HAL_INPUT_RET_ERROR.
+ */
+ int result;
+};
+/************************************************************************
+* Function prototype *
+************************************************************************/
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// initializing input_hal.
+/// \~english @param [in] app_name
+/// const char* - the app name for receive input event.
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Listen input devices and send input event.
+/// - After initializing touch panel, the event(@ref HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH) will be sent.
+/// - The API can be used by 1 process.
+/// \~english @see None.
+////////////////////////////////////////////////////////////////////////////////
+int InitInput(const char* app_name);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// finalize input_hal
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to finalize input_hal.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int DeInitInput();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Init those operating function of touch panel driver
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @par Prerequisite
+/// - Touch panel function exist
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - The API is a block I/F which initializes those operating functions of touch panel driver.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int InitTouch();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Make touch panel start work
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to prepare touch panel and make it start work.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int StartTouch();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Execute touch panel self test
+/// \~english @param [in] id
+/// int - selftest id(Pass HAL_INPUT_TOUCH_SELFTEST_ID_ALL :
+/// Execute all test(disconnection check))
+/// \~english @param [out] result
+/// void* - Touch panel selftest mode check result
+/// \~english @note Result struct SelftestTouch depend on hardware spec
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Param result is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to execute touch panel self test and get test result.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int SelfTestTouch(int id, void *result);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Set whether the driver sends touch panel data or not.
+/// \~english @param [in] status
+/// int - Touch panel whether report/unreport event\n
+/// HAL_INPUT_TOUCH_REPORT : Report touch panel's touch event\n
+/// HAL_INPUT_TOUCH_UNREPORT : Don't report touch panel's touch event\n
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @note It means this API isn't support when return
+/// @ref HAL_INPUT_RET_NOT_SUPPORT.
+/// The user need to implement it
+/// if don't need to report touch event.
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Status is none of @ref HAL_INPUT_TOUCH_REPORT /
+/// @ref HAL_INPUT_TOUCH_UNREPORT
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to set whether the driver sends touch panel data or not.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int LockTouch(int status);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Suspend touch panel
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @note It means this API isn't support when return
+/// @ref HAL_INPUT_RET_NOT_SUPPORT.
+/// The user need to implement it
+/// if don't need to report touch event.
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to suspend touch panel.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int SuspendTouch();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Set touch panel sensitivity level
+/// \~english @param [in] level
+/// int - Sensitivity level.
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Sensitivity level is none of @ref HalInputTouchSensitivityLevel
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to set touch panel sensitivity level.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int SetSensitivityLevelTouch(int level);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Get touch panel sensitivity level
+/// \~english @param [out] level
+/// int* - Sensitivity level.
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Param level is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to get touch panel sensitivity level.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int GetSensitivityLevelTouch(int *level);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Notify radio scan frequency
+/// \~english @param [in] info
+/// RadioInfoTouch* - SCAN frequence info
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Param info is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to notify radio scan frequency.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int NotifyRadioScanFreqTouch(struct RadioInfoTouch *info);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Get panel resolution
+/// \~english @param [in] reso_h
+/// int* - horizontal resolution
+/// \~english @param [in] reso_v
+/// int* - vertical resolution
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Param reso_h or reso_v is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to get horizontal and vertical resolution.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int GetPanelSpecResolutionInput(int *reso_h, int *reso_v);
+
+/** @}*/ // end of input_hal
+/** @}*/ // end of switchhandler
+
+#endif // HAL_API_INPUT_HAL_H_
diff --git a/video_in_hal/input_hal/hal_api/peripheral_service/aglinput.h b/video_in_hal/input_hal/hal_api/peripheral_service/aglinput.h
new file mode 100755
index 0000000..aa5f6ed
--- /dev/null
+++ b/video_in_hal/input_hal/hal_api/peripheral_service/aglinput.h
@@ -0,0 +1,536 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HAL_API_PERIPHERAL_SERVICE_AGLINPUT_H_
+#define HAL_API_PERIPHERAL_SERVICE_AGLINPUT_H_
+
+#include <peripheral_service/extinput.h>
+
+/*
+ * Extended Area for AGL
+ * In this file the Key definition based on the specification
+ * Redefine with '#undef/#define
+ */
+enum{
+ /**
+ * FP Switch : 0x0001 - 0x0064
+ * */
+ KEY_FP_TOP = 0x001,
+ KEY_FP_SW1 = KEY_FP_TOP,
+ KEY_FP_SW2 ,
+ KEY_FP_SW3 ,
+ KEY_FP_SW4 ,
+ KEY_FP_SW5 ,
+ KEY_FP_SW6 ,
+ KEY_FP_SW7 ,
+ KEY_FP_SW8 ,
+ KEY_FP_SW9 ,
+ KEY_FP_SW10 ,
+ KEY_FP_SW11 ,
+ KEY_FP_SW12 ,
+ KEY_FP_SW13 ,
+ KEY_FP_SW14 ,
+ KEY_FP_SW15 ,
+ KEY_FP_SW16 ,
+ KEY_FP_SW17 ,
+ KEY_FP_SW18 ,
+ KEY_FP_SW19 ,
+ KEY_FP_SW20 ,
+ KEY_FP_SW21 ,
+ KEY_FP_SW22 ,
+ KEY_FP_SW23 ,
+ KEY_FP_SW24 ,
+ KEY_FP_SW25 ,
+ KEY_FP_SW26 ,
+ KEY_FP_SW27 ,
+ KEY_FP_SW28 ,
+ KEY_FP_SW29 ,
+ KEY_FP_SW30 ,
+ KEY_FP_SW31 ,
+ KEY_FP_SW32 ,
+ KEY_FP_SW33 ,
+ KEY_FP_SW34 ,
+ KEY_FP_SW35 ,
+ KEY_FP_SW36 ,
+ KEY_FP_SW37 ,
+ KEY_FP_SW38 ,
+ KEY_FP_SW39 ,
+ KEY_FP_SW40 ,
+ KEY_FP_SW41 ,
+ KEY_FP_SW42 ,
+ KEY_FP_SW43 ,
+ KEY_FP_SW44 ,
+ KEY_FP_SW45 ,
+ KEY_FP_SW46 ,
+ KEY_FP_SW47 ,
+ KEY_FP_SW48 ,
+ KEY_FP_SW49 ,
+ KEY_FP_SW50 ,
+ KEY_FP_SW51 ,
+ KEY_FP_SW52 ,
+ KEY_FP_SW53 ,
+ KEY_FP_SW54 ,
+ KEY_FP_SW55 ,
+ KEY_FP_SW56 ,
+ KEY_FP_SW57 ,
+ KEY_FP_SW58 ,
+ KEY_FP_SW59 ,
+ KEY_FP_SW60 ,
+ KEY_FP_SW61 ,
+ KEY_FP_SW62 ,
+ KEY_FP_SW63 ,
+ KEY_FP_SW64 ,
+ KEY_FP_SW65 ,
+ KEY_FP_SW66 ,
+ KEY_FP_SW67 ,
+ KEY_FP_SW68 ,
+ KEY_FP_SW69 ,
+ KEY_FP_SW70 ,
+ KEY_FP_SW71 ,
+ KEY_FP_SW72 ,
+ KEY_FP_SW73 ,
+ KEY_FP_SW74 ,
+ KEY_FP_SW75 ,
+ KEY_FP_SW76 ,
+ KEY_FP_SW77 ,
+ KEY_FP_SW78 ,
+ KEY_FP_SW79 ,
+ KEY_FP_SW80 ,
+ KEY_FP_SW81 ,
+ KEY_FP_SW82 ,
+ KEY_FP_SW83 ,
+ KEY_FP_SW84 ,
+ KEY_FP_SW85 ,
+ KEY_FP_SW86 ,
+ KEY_FP_SW87 ,
+ KEY_FP_SW88 ,
+ KEY_FP_SW89 ,
+ KEY_FP_SW90 ,
+ KEY_FP_SW91 ,
+ KEY_FP_SW92 ,
+ KEY_FP_SW93 ,
+ KEY_FP_SW94 ,
+ KEY_FP_SW95 ,
+ KEY_FP_SW96 ,
+ KEY_FP_SW97 ,
+ KEY_FP_SW98 ,
+ KEY_FP_SW99 ,
+ KEY_FP_SW100 ,
+ KEY_FP_BOTTOM = KEY_FP_SW100,
+
+ /**
+ * RC Switch : 0x065 - 0x094
+ * */
+ KEY_RC_TOP = 0x0065,
+ KEY_RC_SW1 = KEY_RC_TOP,
+ KEY_RC_SW2 ,
+ KEY_RC_SW3 ,
+ KEY_RC_SW4 ,
+ KEY_RC_SW5 ,
+ KEY_RC_SW6 ,
+ KEY_RC_SW7 ,
+ KEY_RC_SW8 ,
+ KEY_RC_SW9 ,
+ KEY_RC_SW10 ,
+ KEY_RC_SW11 ,
+ KEY_RC_SW12 ,
+ KEY_RC_SW13 ,
+ KEY_RC_SW14 ,
+ KEY_RC_SW15 ,
+ KEY_RC_SW16 ,
+ KEY_RC_SW17 ,
+ KEY_RC_SW18 ,
+ KEY_RC_SW19 ,
+ KEY_RC_SW20 ,
+ KEY_RC_SW21 ,
+ KEY_RC_SW22 ,
+ KEY_RC_SW23 ,
+ KEY_RC_SW24 ,
+ KEY_RC_SW25 ,
+ KEY_RC_SW26 ,
+ KEY_RC_SW27 ,
+ KEY_RC_SW28 ,
+ KEY_RC_SW29 ,
+ KEY_RC_SW30 ,
+ KEY_RC_SW31 ,
+ KEY_RC_SW32 ,
+ KEY_RC_SW33 ,
+ KEY_RC_SW34 ,
+ KEY_RC_SW35 ,
+ KEY_RC_SW36 ,
+ KEY_RC_SW37 ,
+ KEY_RC_SW38 ,
+ KEY_RC_SW39 ,
+ KEY_RC_SW40 ,
+ KEY_RC_SW41 ,
+ KEY_RC_SW42 ,
+ KEY_RC_SW43 ,
+ KEY_RC_SW44 ,
+ KEY_RC_SW45 ,
+ KEY_RC_SW46 ,
+ KEY_RC_SW47 ,
+ KEY_RC_SW48 ,
+ KEY_RC_BOTTOM = KEY_RC_SW48,
+
+ /**
+ * R Switch : 0x0095 - 0x0096
+ * */
+ KEY_ROT_TOP = 0x0095,
+ KEY_ROT_SW1 = KEY_ROT_TOP,
+ KEY_ROT_SW2 ,
+ KEY_ROT_BOTTOM = KEY_ROT_SW2,
+
+ /**
+ * FSAC Switch : 0x0097 - 0x00D2
+ * */
+ KEY_FSAC_TOP = 0x0097,
+ KEY_FSAC_SW1 = KEY_FSAC_TOP,
+ KEY_FSAC_SW2 ,
+ KEY_FSAC_SW3 ,
+ KEY_FSAC_SW4 ,
+ KEY_FSAC_SW5 ,
+ KEY_FSAC_SW6 ,
+ KEY_FSAC_SW7 ,
+ KEY_FSAC_SW8 ,
+ KEY_FSAC_SW9 ,
+ KEY_FSAC_SW10 ,
+ KEY_FSAC_SW11 ,
+ KEY_FSAC_SW12 ,
+ KEY_FSAC_SW13 ,
+ KEY_FSAC_SW14 ,
+ KEY_FSAC_SW15 ,
+ KEY_FSAC_SW16 ,
+ KEY_FSAC_SW17 ,
+ KEY_FSAC_SW18 ,
+ KEY_FSAC_SW19 ,
+ KEY_FSAC_SW20 ,
+ KEY_FSAC_SW21 ,
+ KEY_FSAC_SW22 ,
+ KEY_FSAC_SW23 ,
+ KEY_FSAC_SW24 ,
+ KEY_FSAC_SW25 ,
+ KEY_FSAC_SW26 ,
+ KEY_FSAC_SW27 ,
+ KEY_FSAC_SW28 ,
+ KEY_FSAC_SW29 ,
+ KEY_FSAC_SW30 ,
+ KEY_FSAC_SW31 ,
+ KEY_FSAC_SW32 ,
+ KEY_FSAC_SW33 ,
+ KEY_FSAC_SW34 ,
+ KEY_FSAC_SW35 ,
+ KEY_FSAC_SW36 ,
+ KEY_FSAC_SW37 ,
+ KEY_FSAC_SW38 ,
+ KEY_FSAC_SW39 ,
+ KEY_FSAC_SW40 ,
+ KEY_FSAC_SW41 ,
+ KEY_FSAC_SW42 ,
+ KEY_FSAC_SW43 ,
+ KEY_FSAC_SW44 ,
+ KEY_FSAC_SW45 ,
+ KEY_FSAC_SW46 ,
+ KEY_FSAC_SW47 ,
+ KEY_FSAC_SW48 ,
+ KEY_FSAC_SW49 ,
+ KEY_FSAC_SW50 ,
+ KEY_FSAC_SW51 ,
+ KEY_FSAC_SW52 ,
+ KEY_FSAC_SW53 ,
+ KEY_FSAC_SW54 ,
+ KEY_FSAC_SW55 ,
+ KEY_FSAC_SW56 ,
+ KEY_FSAC_SW57 ,
+ KEY_FSAC_SW58 ,
+ KEY_FSAC_SW59 ,
+ KEY_FSAC_BOTTOM = KEY_FSAC_SW59,
+
+ /**
+ * Ste Switch : 0x00D3 - 0x00E6
+ * */
+ KEY_STE_TOP = 0x00D3,
+ KEY_STE_SW1 = KEY_STE_TOP,
+ KEY_STE_SW2 ,
+ KEY_STE_SW3 ,
+ KEY_STE_SW4 ,
+ KEY_STE_SW5 ,
+ KEY_STE_SW6 ,
+ KEY_STE_SW7 ,
+ KEY_STE_SW8 ,
+ KEY_STE_SW9 ,
+ KEY_STE_SW10 ,
+ KEY_STE_SW11 ,
+ KEY_STE_SW12 ,
+ KEY_STE_SW13 ,
+ KEY_STE_SW14 ,
+ KEY_STE_SW15 ,
+ KEY_STE_SW16 ,
+ KEY_STE_SW18 ,
+ KEY_STE_SW19 ,
+ KEY_STE_BOTTOM = KEY_STE_SW19,
+
+ /**
+ * RCP Switch : 0x00F0 - 0x00F8
+ * */
+ KEY_RCP_TOP = 0x00F0,
+ KEY_RCP_SW1 = KEY_RCP_TOP,
+ KEY_RCP_SW2 ,
+ KEY_RCP_SW3 ,
+ KEY_RCP_SW4 ,
+ KEY_RCP_SW5 ,
+ KEY_RCP_SW6 ,
+ KEY_RCP_SW7 ,
+ KEY_RCP_SW8 ,
+ KEY_RCP_BOTTOM = KEY_RCP_SW8,
+
+ /**
+ * RSE_RC Switch : 0x0160 - 0x01CF
+ * */
+ KEY_RSE_RC_TOP = 0x0160,
+ KEY_RSE_RC_SW1 = KEY_RSE_RC_TOP,
+ KEY_RSE_RC_SW2 ,
+ KEY_RSE_RC_SW3 ,
+ KEY_RSE_RC_SW4 ,
+ KEY_RSE_RC_SW5 ,
+ KEY_RSE_RC_SW6 ,
+ KEY_RSE_RC_SW7 ,
+ KEY_RSE_RC_SW8 ,
+ KEY_RSE_RC_SW9 ,
+ KEY_RSE_RC_SW10 ,
+ KEY_RSE_RC_SW11 ,
+ KEY_RSE_RC_SW12 ,
+ KEY_RSE_RC_SW13 ,
+ KEY_RSE_RC_SW14 ,
+ KEY_RSE_RC_SW15 ,
+ KEY_RSE_RC_SW16 ,
+ KEY_RSE_RC_SW17 ,
+ KEY_RSE_RC_SW18 ,
+ KEY_RSE_RC_SW19 ,
+ KEY_RSE_RC_SW20 ,
+ KEY_RSE_RC_SW21 ,
+ KEY_RSE_RC_SW22 ,
+ KEY_RSE_RC_SW23 ,
+ KEY_RSE_RC_SW24 ,
+ KEY_RSE_RC_SW25 ,
+ KEY_RSE_RC_SW26 ,
+ KEY_RSE_RC_SW27 ,
+ KEY_RSE_RC_SW28 ,
+ KEY_RSE_RC_SW29 ,
+ KEY_RSE_RC_SW30 ,
+ KEY_RSE_RC_SW31 ,
+ KEY_RSE_RC_SW32 ,
+ KEY_RSE_RC_SW33 ,
+ KEY_RSE_RC_SW34 ,
+ KEY_RSE_RC_SW35 ,
+ KEY_RSE_RC_SW36 ,
+ KEY_RSE_RC_SW37 ,
+ KEY_RSE_RC_SW38 ,
+ KEY_RSE_RC_SW39 ,
+ KEY_RSE_RC_SW40 ,
+ KEY_RSE_RC_SW41 ,
+ KEY_RSE_RC_SW42 ,
+ KEY_RSE_RC_SW43 ,
+ KEY_RSE_RC_SW44 ,
+ KEY_RSE_RC_SW45 ,
+ KEY_RSE_RC_SW46 ,
+ KEY_RSE_RC_SW47 ,
+ KEY_RSE_RC_SW48 ,
+ KEY_RSE_RC_SW49 ,
+ KEY_RSE_RC_SW50 ,
+ KEY_RSE_RC_SW51 ,
+ KEY_RSE_RC_SW52 ,
+ KEY_RSE_RC_SW53 ,
+ KEY_RSE_RC_SW54 ,
+ KEY_RSE_RC_SW55 ,
+ KEY_RSE_RC_SW56 ,
+ KEY_RSE_RC_SW57 ,
+ KEY_RSE_RC_SW58 ,
+ KEY_RSE_RC_SW59 ,
+ KEY_RSE_RC_SW60 ,
+ KEY_RSE_RC_SW61 ,
+ KEY_RSE_RC_SW65 ,
+ KEY_RSE_RC_SW66 ,
+ KEY_RSE_RC_SW67 ,
+ KEY_RSE_RC_SW68 ,
+ KEY_RSE_RC_SW69 ,
+ KEY_RSE_RC_SW70 ,
+ KEY_RSE_RC_SW71 ,
+ KEY_RSE_RC_SW72 ,
+ KEY_RSE_RC_SW73 ,
+ KEY_RSE_RC_SW74 ,
+ KEY_RSE_RC_SW75 ,
+ KEY_RSE_RC_SW76 ,
+ KEY_RSE_RC_SW77 ,
+ KEY_RSE_RC_SW78 ,
+ KEY_RSE_RC_SW79 ,
+ KEY_RSE_RC_SW80 ,
+ KEY_RSE_RC_SW81 ,
+ KEY_RSE_RC_SW82 ,
+ KEY_RSE_RC_SW83 ,
+ KEY_RSE_RC_SW84 ,
+ KEY_RSE_RC_SW85 ,
+ KEY_RSE_RC_SW86 ,
+ KEY_RSE_RC_SW87 ,
+ KEY_RSE_RC_SW88 ,
+ KEY_RSE_RC_SW89 ,
+ KEY_RSE_RC_SW90 ,
+ KEY_RSE_RC_SW91 ,
+ KEY_RSE_RC_SW92 ,
+ KEY_RSE_RC_SW93 ,
+ KEY_RSE_RC_SW94 ,
+ KEY_RSE_RC_SW95 ,
+ KEY_RSE_RC_SW96 ,
+ KEY_RSE_RC_SW97 ,
+ KEY_RSE_RC_SW98 ,
+ KEY_RSE_RC_SW99 ,
+ KEY_RSE_RC_SW100 ,
+ KEY_RSE_RC_SW101 ,
+ KEY_RSE_RC_SW102 ,
+ KEY_RSE_RC_SW62 ,
+ KEY_RSE_RC_SW63 ,
+ KEY_RSE_RC_SW64 ,
+ KEY_RSE_RC_SW103 ,
+ KEY_RSE_RC_SW104 ,
+ KEY_RSE_RC_SW105 ,
+ KEY_RSE_RC_SW106 ,
+ KEY_RSE_RC_SW107 ,
+ KEY_RSE_RC_SW108 ,
+ KEY_RSE_RC_SW109 ,
+ KEY_RSE_RC_SW110 ,
+ KEY_RSE_RC_SW111 ,
+ KEY_RSE_RC_SW112 ,
+ KEY_RSE_RC_BOTTOM = KEY_RSE_RC_SW112,
+
+ /**
+ * RTP Switch : 0x01D6 - 0x01DE
+ * */
+ KEY_RTP_TOP = 0x01D6,
+ KEY_RTP_SW1 = KEY_RTP_TOP,
+ KEY_RTP_SW2 ,
+ KEY_RTP_SW3 ,
+ KEY_RTP_SW4 ,
+ KEY_RTP_SW5 ,
+ KEY_RTP_SW6 ,
+ KEY_RTP_SW7 ,
+ KEY_RTP_SW8 ,
+ KEY_RTP_SW9 ,
+ KEY_RTP_BOTTOM = KEY_RTP_SW9,
+
+ /**
+ * RSP Switch : 0x01E0 - 0x0208
+ * */
+ KEY_RSP_TOP = 0x01E0,
+ KEY_RSP_SW1 = KEY_RSP_TOP,
+ KEY_RSP_SW2 ,
+ KEY_RSP_SW3 ,
+ KEY_RSP_SW4 ,
+ KEY_RSP_SW5 ,
+ KEY_RSP_SW6 ,
+ KEY_RSP_SW7 ,
+ KEY_RSP_SW8 ,
+ KEY_RSP_SW9 ,
+ KEY_RSP_SW10 ,
+ KEY_RSP_SW11 ,
+ KEY_RSP_SW12 ,
+ KEY_RSP_SW13 ,
+ KEY_RSP_SW14 ,
+ KEY_RSP_SW15 ,
+ KEY_RSP_SW16 ,
+ KEY_RSP_SW17 ,
+ KEY_RSP_SW18 ,
+ KEY_RSP_SW19 ,
+ KEY_RSP_SW20 ,
+ KEY_RSP_SW21 ,
+ KEY_RSP_SW22 ,
+ KEY_RSP_SW23 ,
+ KEY_RSP_SW24 ,
+ KEY_RSP_SW25 ,
+ KEY_RSP_SW26 ,
+ KEY_RSP_SW27 ,
+ KEY_RSP_SW28 ,
+ KEY_RSP_SW29 ,
+ KEY_RSP_SW30 ,
+ KEY_RSP_SW31 ,
+ KEY_RSP_SW32 ,
+ KEY_RSP_SW33 ,
+ KEY_RSP_SW34 ,
+ KEY_RSP_SW35 ,
+ KEY_RSP_SW36 ,
+ KEY_RSP_SW37 ,
+ KEY_RSP_SW38 ,
+ KEY_RSP_SW39 ,
+ KEY_RSP_SW40 ,
+ KEY_RSP_SW41 ,
+ KEY_RSP_BOTTOM = KEY_RSP_SW41,
+
+ /**
+ * Original Define : 0x02A0 - 0x02CF
+ * */
+ KEY_INPUTHAL_TOP = 0x02A0,
+ KEY_INPUTHAL_SW1 = KEY_INPUTHAL_TOP,
+ KEY_INPUTHAL_BTN_RIGHT,
+ KEY_INPUTHAL_BTN_MIDDLE,
+ KEY_INPUTHAL_BTN_SIDE,
+ KEY_INPUTHAL_BTN_EXTRA,
+ KEY_INPUTHAL_BTN_FORWARD,
+ KEY_INPUTHAL_BTN_BACK,
+ KEY_INPUTHAL_BTN_TASK,
+ KEY_INPUTHAL_SW9,
+ KEY_INPUTHAL_SW10,
+ KEY_INPUTHAL_BTN_JOYSTICK,
+ KEY_INPUTHAL_TOUCH,
+ KEY_INPUTHAL_SINGLE_TAP_UP,
+ KEY_INPUTHAL_DOUBLE_TOUCH_DOWN,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY1,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY2,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY3,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY4,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY5,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY6,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY7,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY8,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY9,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY10,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY11,
+ KEY_INPUTHAL_TOUCHPAD_DUMMY12,
+ KEY_INPUTHAL_TOUCH_POINT_3,
+ KEY_INPUTHAL_TOUCH_POINT_2,
+ KEY_INPUTHAL_PUSH,
+ KEY_INPUTHAL_TAP_SINGLE,
+ KEY_INPUTHAL_TAP_DOUBLE,
+ KEY_INPUTHAL_SW16,
+ KEY_INPUTHAL_NAVI,
+ KEY_INPUTHAL_HOME,
+ KEY_INPUTHAL_MEM1,
+ KEY_INPUTHAL_MEM2,
+ KEY_INPUTHAL_RECENT_JP,
+ KEY_INPUTHAL_WEB,
+ KEY_INPUTHAL_DEST_ERACE,
+ KEY_INPUTHAL_MENU_SEARCH,
+ KEY_INPUTHAL_MENU_GO_HOME,
+ KEY_INPUTHAL_MENU_RECENT_NA,
+ KEY_INPUTHAL_MENU_FAVORITE,
+ KEY_INPUTHAL_MENU_CONTACT,
+ KEY_INPUTHAL_MENU_OTHERS,
+ KEY_INPUTHAL_MENU_SUBSCREEN_NAVI,
+ KEY_INPUTHAL_INVALID_SW ,
+ KEY_INPUTHAL_BOTTOM = KEY_INPUTHAL_INVALID_SW,
+};
+
+#define BTN_TAP_DOUBLE KEY_INPUTHAL_SW10
+
+#define REL_PINCH 0x0a
+
+#endif // HAL_API_PERIPHERAL_SERVICE_AGLINPUT_H_
diff --git a/video_in_hal/input_hal/hal_api/peripheral_service/extinput.h b/video_in_hal/input_hal/hal_api/peripheral_service/extinput.h
new file mode 100755
index 0000000..0265a2d
--- /dev/null
+++ b/video_in_hal/input_hal/hal_api/peripheral_service/extinput.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HAL_API_PERIPHERAL_SERVICE_EXTINPUT_H_
+#define HAL_API_PERIPHERAL_SERVICE_EXTINPUT_H_
+
+#include <linux/input.h>
+
+/*
+ * Extended fields for each supplier
+ * If you want to modify the key definition at the supplier,
+ * redefine with '#undef/#define in this file.
+ */
+
+#endif // HAL_API_PERIPHERAL_SERVICE_EXTINPUT_H_
diff --git a/video_in_hal/input_hal/inc/input_drm.h b/video_in_hal/input_hal/inc/input_drm.h
new file mode 100755
index 0000000..11ffc32
--- /dev/null
+++ b/video_in_hal/input_hal/inc/input_drm.h
@@ -0,0 +1,22 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_INPUT_DRM_H_
+#define INC_INPUT_DRM_H_
+
+int GetPanelSpecResolutionInput(int *reso_h, int *reso_v);
+
+#endif // INC_INPUT_DRM_H_
diff --git a/video_in_hal/input_hal/inc/input_hal_debug.h b/video_in_hal/input_hal/inc/input_hal_debug.h
new file mode 100755
index 0000000..2fb7d86
--- /dev/null
+++ b/video_in_hal/input_hal/inc/input_hal_debug.h
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_INPUT_HAL_DEBUG_H_
+#define INC_INPUT_HAL_DEBUG_H_
+
+#include "input_hal_frameworkunifiedlog.h"
+
+// #define INPUT_DEBUG
+
+#ifdef INPUT_DEBUG
+#define INPUT_DBG_LOG(zone_index, fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(zone_index, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_DBG_LOG(zone_index, fmt, ...)
+#endif
+
+/* Log output control flag */
+#define INPUT_LOG_ENABLE_TRACE /* Normal log(Trace) */
+#define INPUT_LOG_ENABLE_ERROR /* Error log */
+#define INPUT_LOG_ENABLE_RETAIL /* Debug log */
+
+#ifdef INPUT_LOG_ENABLE_TRACE
+#define INPUT_LOG_TRACE(fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_LOG_TRACE(fmt, ...)
+#endif
+
+#ifdef INPUT_LOG_ENABLE_ERROR
+#define INPUT_ERROR_LOG(fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_ERROR_LOG(fmt, ...)
+#endif
+
+#ifdef INPUT_LOG_ENABLE_RETAIL
+#define INPUT_RETAIL_LOG(fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(ZONE_HMI_DBG, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_RETAIL_LOG(fmt, ...)
+#endif
+
+#endif // INC_INPUT_HAL_DEBUG_H_
diff --git a/video_in_hal/input_hal/inc/input_hal_frameworkunifiedlog.h b/video_in_hal/input_hal/inc/input_hal_frameworkunifiedlog.h
new file mode 100755
index 0000000..c54f16a
--- /dev/null
+++ b/video_in_hal/input_hal/inc/input_hal_frameworkunifiedlog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_INPUT_HAL_FRAMEWORKUNIFIEDLOG_H_
+#define INC_INPUT_HAL_FRAMEWORKUNIFIEDLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_INPUT_HAL_FRAMEWORKUNIFIEDLOG_H_
diff --git a/video_in_hal/input_hal/inc/input_hal_internal.h b/video_in_hal/input_hal/inc/input_hal_internal.h
new file mode 100755
index 0000000..4e57aed
--- /dev/null
+++ b/video_in_hal/input_hal/inc/input_hal_internal.h
@@ -0,0 +1,107 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_INPUT_HAL_INTERNAL_H_
+#define INC_INPUT_HAL_INTERNAL_H_
+
+/*
+ * Touch panel operation function info
+ */
+struct TouchHal {
+ /**
+ * \~english Make touch panel start work.
+ */
+ int (* start)(void);
+ /**
+ * \~english Get touch panel device horizontal resolution.
+ */
+ int (* get_reso_h)(int *);
+ /**
+ * \~english Get touch panel device vertical resolution.
+ */
+ int (* get_reso_v)(int *);
+ /**
+ * \~english Get whether X axis is inversion.
+ */
+ int (* get_reverse_axis_x)(bool *);
+ /**
+ * \~english Get whether Y axis is inversion.
+ */
+ int (* get_reverse_axis_y)(bool *);
+ /**
+ * \~english Config touch panel.
+ */
+ int (* config)(const char *, int, int);
+ /**
+ * \~english Get touch panel device name.
+ */
+ int (* get_touch_devicename)(char*, size_t);
+ /**
+ * \~english Get touch panel key device name.
+ */
+ int (* get_key_devicename)(char*, size_t);
+ /**
+ * \~english Execute touch panel self test.
+ */
+ int (* selftest)(int, void *);
+ /**
+ * \~english Get touch panel config status.
+ */
+ int (* get_config_status)(int *);
+ /**
+ * \~english Set whether the driver sends touch panel data or not.
+ */
+ int (* set_touch_lock)(int);
+ /**
+ * \~english Request touch panel touch suspend.
+ */
+ int (* set_touch_suspend)(void);
+ /**
+ * \~english Set touch panel sensitivity level.
+ */
+ int (* set_sensitivity_level)(int);
+ /**
+ * \~english Get touch panel sensitivity level.
+ */
+ int (* get_sensitivity_level)(int *);
+ /**
+ * \~english Notify radio scan frequency.
+ */
+ int (* notify_radio_scan_frequency)(struct RadioInfoTouch *);
+};
+
+
+/**
+ * Config touch panel
+ */
+int ConfigTouch(const char *path , int resolution_h, int resolution_v);
+
+/**
+ * Get touch panel device name
+ */
+int GetPanelNameTouch(char* name, size_t buf_length);
+
+/**
+ * Get touch panel key device name
+ */
+int GetKeyNameTouch(char* name, size_t buf_length);
+
+/**
+ * Get touch panel config status
+ */
+int GetConfigStatusTouch(int *status);
+
+#endif // INC_INPUT_HAL_INTERNAL_H_
diff --git a/video_in_hal/input_hal/inc/input_touch_ilitek.h b/video_in_hal/input_hal/inc/input_touch_ilitek.h
new file mode 100755
index 0000000..6d76d83
--- /dev/null
+++ b/video_in_hal/input_hal/inc/input_touch_ilitek.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_INPUT_TOUCH_ILITEK_H_
+#define INC_INPUT_TOUCH_ILITEK_H_
+
+#include "input_hal_internal.h"
+
+/*
+ * Init ilitek touch panel operation function
+ */
+int InputTouchIlitekInit(struct TouchHal *touch);
+
+#endif // INC_INPUT_TOUCH_ILITEK_H_
diff --git a/video_in_hal/input_hal/inc/input_udev_monitor.h b/video_in_hal/input_hal/inc/input_udev_monitor.h
new file mode 100755
index 0000000..0391f6f
--- /dev/null
+++ b/video_in_hal/input_hal/inc/input_udev_monitor.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_INPUT_UDEV_MONITOR_H_
+#define INC_INPUT_UDEV_MONITOR_H_
+
+#include <peripheral_service/aglinput.h>
+
+#include "input_util.h"
+
+#define INPUT_DEVICE_NODE_LENGTH_MAX (32)
+
+struct InputInputDeviceList{
+ int fd;
+ int device_assort;
+ char device_node[INPUT_DEVICE_NODE_LENGTH_MAX];
+ struct InputUtilList list;
+};
+
+struct InputUdevMonitorInfo {
+ struct udev *udev;
+ struct udev_monitor *monitor;
+ struct InputInputDeviceList dev_list;
+};
+
+int32_t InputUdevMonitorThreadCreate(void);
+
+#endif // INC_INPUT_UDEV_MONITOR_H_
diff --git a/video_in_hal/input_hal/inc/input_util.h b/video_in_hal/input_hal/inc/input_util.h
new file mode 100755
index 0000000..6d6a400
--- /dev/null
+++ b/video_in_hal/input_hal/inc/input_util.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_INPUT_UTIL_H_
+#define INC_INPUT_UTIL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+struct InputUtilList {
+ struct InputUtilList *next;
+ struct InputUtilList *prev;
+};
+
+#define INPUT_INIT_LIST_HEAD(ptr) \
+ (ptr)->next = (ptr); (ptr)->prev = (ptr);
+
+#define input_list_entry(ptr, type, member) \
+ (reinterpret_cast<type *>( \
+ reinterpret_cast<char *>(ptr) - (size_t)(&(reinterpret_cast<type *>(0))->member)))
+
+#define input_list_for_each(pos, head) \
+ for (pos = (head)->next; pos != (head); pos = pos->next)
+
+#define input_list_for_each_safe(pos, n, head) \
+ for (pos = (head)->next, n = pos->next; pos != (head); \
+ pos = n, n = pos->next)
+
+void InputUtilListAdd(struct InputUtilList *node_new, struct InputUtilList *node_head);
+void InputUtilListDelete(struct InputUtilList *node);
+int InputUtilMCSend(HANDLE h_message, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data);
+int InputUtilSleep(int usec);
+
+#endif // INC_INPUT_UTIL_H_
diff --git a/video_in_hal/input_hal/src/input_drm.cpp b/video_in_hal/input_hal/src/input_drm.cpp
new file mode 100755
index 0000000..20adf79
--- /dev/null
+++ b/video_in_hal/input_hal/src/input_drm.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "input_drm.h"
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#if defined(_USE_DRM)
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+#endif
+
+#include "input_hal.h"
+#include "input_hal_debug.h"
+
+#define DIR_PATH "/dev/dri/card0"
+#define DEFAULT_RESOLUTION_HORIZONTAL 1280 /* Horizontal resolution default value */
+#define DEFAULT_RESOLUTION_VERTICAL 800 /* Vertical resolution default value */
+/**
+ * Panel resolution acquisition / GetPanelSpecResolutionInput
+ */
+int GetPanelSpecResolutionInput(int *reso_h, int *reso_v) {
+ if ((NULL == reso_h) || (NULL == reso_v)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+#if defined(_USE_DRM)
+ int fd;
+ drmModeRes *resources = NULL;
+ drmModeConnector *connector = NULL;
+ drmModeEncoder *encoder = NULL;
+ drmModeCrtc *crtc = NULL;
+
+ fd = open(DIR_PATH, O_RDWR);
+ if (fd < 0) {
+ INPUT_ERROR_LOG("DRI Open Error=%s\n", DIR_PATH);
+ goto err_rtn;
+ }
+
+ resources = drmModeGetResources(fd);
+ if (!resources) {
+ INPUT_ERROR_LOG("No resources\n");
+ goto err_rtn;
+ }
+ if (2 > resources->count_connectors) {
+ INPUT_ERROR_LOG("DRI Connect Num Error connectors=%d\n",
+ resources->count_connectors);
+ goto err_rtn;
+ }
+
+ connector = drmModeGetConnector(fd, resources->connectors[1]);
+ if (!connector) {
+ INPUT_ERROR_LOG("No Connector\n");
+ goto err_rtn;
+ }
+
+ if ((DRM_MODE_CONNECTED == connector->connection) &&(connector->count_modes > 0)) {
+ } else {
+ INPUT_ERROR_LOG("Not found connected connector\n");
+ goto err_rtn;
+ }
+
+ encoder = drmModeGetEncoder(fd, connector->encoder_id);
+ if (!encoder) {
+ INPUT_ERROR_LOG("drmModeGetEncoder null\n");
+ goto err_rtn;
+ }
+
+ crtc = drmModeGetCrtc(fd, encoder->crtc_id);
+ if (!crtc) {
+ INPUT_ERROR_LOG("drmModeGetCrtc null\n");
+ goto err_rtn;
+ }
+
+ *reso_h = crtc->mode.hdisplay;
+ *reso_v = crtc->mode.vdisplay;
+
+ drmModeFreeCrtc(crtc);
+ drmModeFreeEncoder(encoder);
+ drmModeFreeConnector(connector);
+ drmModeFreeResources(resources);
+ close(fd);
+
+ INPUT_LOG_TRACE("width=%d height=%d\n", *reso_h, *reso_v);
+ return HAL_INPUT_RET_NORMAL;
+
+err_rtn:
+
+ if (encoder) {
+ drmModeFreeEncoder(encoder);
+ }
+ if (connector) {
+ drmModeFreeConnector(connector);
+ }
+ if (resources) {
+ drmModeFreeResources(resources);
+ }
+ if (fd >= 0) {
+ close(fd);
+ }
+
+ INPUT_ERROR_LOG("Use Default Resolution\n");
+ *reso_h = DEFAULT_RESOLUTION_HORIZONTAL;
+ *reso_v = DEFAULT_RESOLUTION_VERTICAL;
+
+ return HAL_INPUT_RET_ERROR;
+#else
+ *reso_h = DEFAULT_RESOLUTION_HORIZONTAL;
+ *reso_v = DEFAULT_RESOLUTION_VERTICAL;
+
+ return HAL_INPUT_RET_NORMAL;
+#endif
+}
diff --git a/video_in_hal/input_hal/src/input_hal.cpp b/video_in_hal/input_hal/src/input_hal.cpp
new file mode 100755
index 0000000..b5f4916
--- /dev/null
+++ b/video_in_hal/input_hal/src/input_hal.cpp
@@ -0,0 +1,267 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "input_hal.h"
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "input_hal_debug.h"
+#include "input_hal_internal.h"
+#include "input_touch_ilitek.h"
+#include "input_udev_monitor.h"
+
+// Touch panel operation function info
+static struct TouchHal g_input_touch_info = { 0 };
+
+char* g_app_name = NULL;
+static bool g_touch_inited = false;
+static bool g_input_inited = false;
+
+extern bool g_break_from_watch;
+extern pthread_t g_udev_monitor_thread;
+
+// Environment key name
+#define HAL_INPUT_TARGET_BOARD "TARGET_BOARD"
+// Reference board environment value of HAL_INPUT_TARGET_BOARD
+#define HAL_INPUT_REF_BOARD_NAME "agl_reference"
+// Invalid status of report touch panel's touch event
+#define HAL_INPUT_TOUCH_REPORT_INVALID (-1)
+
+/*
+ * Input device init.
+ */
+int InitInput(const char* app_name) {
+ if (NULL == app_name) {
+ INPUT_ERROR_LOG("param is error");
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (!g_touch_inited) {
+ INPUT_ERROR_LOG("call InitTouch first.");
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (g_input_inited) {
+ INPUT_ERROR_LOG("input inited.");
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ g_break_from_watch = false;
+ if (NULL != g_app_name) {
+ delete[] g_app_name;
+ }
+
+ g_app_name = new char[strlen(app_name) + 1];
+ snprintf(g_app_name, strlen(app_name) + 1, "%s", app_name);
+ if (HAL_INPUT_RET_ERROR == InputUdevMonitorThreadCreate()) {
+ delete[] g_app_name;
+ g_app_name = NULL;
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ g_input_inited = true;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Deinit input device
+ */
+int DeInitInput() {
+ g_break_from_watch = true;
+ void* ret_val = NULL;
+ if (NULL != g_app_name) {
+ delete[] g_app_name;
+ g_app_name = NULL;
+ }
+ if (g_udev_monitor_thread != static_cast<pthread_t>(-1)) {
+ pthread_join(g_udev_monitor_thread, &ret_val);
+ }
+ g_input_inited = false;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Init those operating function of touch panel driver
+ */
+int InitTouch() {
+ int ret = InputTouchIlitekInit(&g_input_touch_info);
+ g_touch_inited = true;
+ return ret;
+}
+
+/*
+ * Make touch panel start work
+ */
+int StartTouch() {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.start) {
+ ret = g_input_touch_info.start();
+ }
+
+ return ret;
+}
+
+/*
+ * Config touch panel
+ */
+int ConfigTouch(const char *path , int reso_h, int reso_v) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.config) {
+ ret = g_input_touch_info.config(path, reso_h, reso_v);
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel device name
+ */
+int GetPanelNameTouch(char* name, size_t buf_length) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_touch_devicename) {
+ ret = g_input_touch_info.get_touch_devicename(name, buf_length);
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel key device name
+ */
+int GetKeyNameTouch(char* name, size_t buf_length) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_key_devicename) {
+ ret = g_input_touch_info.get_key_devicename(name, buf_length);
+ }
+
+ return ret;
+}
+
+/*
+ * Execute touch panel self test
+ */
+int SelfTestTouch(int id, void *result) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.selftest) {
+ ret = g_input_touch_info.selftest(id, result);
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel config status
+ */
+int GetConfigStatusTouch(int *status) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_config_status) {
+ ret = g_input_touch_info.get_config_status(status);
+ }
+
+ return ret;
+}
+
+/*
+ * Set whether the driver sends touch panel data or not
+ */
+int LockTouch(int status) {
+ static int input_touch_lock_status = HAL_INPUT_TOUCH_REPORT_INVALID;
+
+ if (input_touch_lock_status == status) {
+ return HAL_INPUT_RET_NORMAL;
+ }
+
+ int ret = HAL_INPUT_RET_ERROR;
+ if (NULL != g_input_touch_info.set_touch_lock) {
+ ret = g_input_touch_info.set_touch_lock(status);
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ input_touch_lock_status = status;
+ }
+ }
+
+ return ret;
+}
+
+/*
+ * Suspend touch panel
+ */
+int SuspendTouch() {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.set_touch_suspend) {
+ ret = g_input_touch_info.set_touch_suspend();
+ }
+
+ return ret;
+}
+
+/*
+ * Set touch panel sensitivity level
+ */
+int SetSensitivityLevelTouch(int level) {
+ int cur = HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_NONE;
+
+ int ret = GetSensitivityLevelTouch(&cur);
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ if (cur == level) {
+ // Don't need to update sensitivity level
+ INPUT_LOG_TRACE("already set level=%d", level);
+ } else {
+ if (NULL != g_input_touch_info.set_sensitivity_level) {
+ ret = g_input_touch_info.set_sensitivity_level(level);
+ } else {
+ ret = HAL_INPUT_RET_ERROR;
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel sensitivity level
+ */
+int GetSensitivityLevelTouch(int *level) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_sensitivity_level) {
+ ret = g_input_touch_info.get_sensitivity_level(level);
+ }
+
+ return ret;
+}
+
+/*
+ * Notify radio scan frequency
+ */
+int NotifyRadioScanFreqTouch(struct RadioInfoTouch *info) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.notify_radio_scan_frequency) {
+ ret = g_input_touch_info.notify_radio_scan_frequency(info);
+ }
+
+ return ret;
+}
diff --git a/video_in_hal/input_hal/src/input_touch_ilitek.cpp b/video_in_hal/input_hal/src/input_touch_ilitek.cpp
new file mode 100755
index 0000000..9d1822a
--- /dev/null
+++ b/video_in_hal/input_hal/src/input_touch_ilitek.cpp
@@ -0,0 +1,226 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "input_touch_ilitek.h"
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "input_hal.h"
+
+// Touch panel device name
+#define HAL_INPUT_ILITEK_TOUCH_DEVICE_NAME "ILITEK ILITEK Multi-Touch"
+// Touch panel key device name
+#define HAL_INPUT_ILITEK_KEY_DEVICE_NAME ""
+
+// Touch panel horizontal resolution value
+#define HAL_INPUT_TOUCH_RESOLUTION_HORIZONTAL 4816
+
+// Touch panel vertical resolution value
+#define HAL_INPUT_TOUCH_RESOLUTION_VERTICAL 2992
+
+/*
+ * Make touch panel start work
+ */
+static int InputTouchStart() {
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Config touch panel
+ */
+static int InputTouchConfig(const char *path,
+ int resolution_h, int resolution_v) {
+ if (NULL == path) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (-1 == ::access(path, F_OK)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel device name
+ */
+static int InputTouchGetDeviceName(char* name, size_t buf_length) {
+ if (NULL == name) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (buf_length < (strlen(HAL_INPUT_ILITEK_TOUCH_DEVICE_NAME) + 1)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ snprintf(name, buf_length, "%s", HAL_INPUT_ILITEK_TOUCH_DEVICE_NAME);
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel key device name
+ */
+static int InputTouchGetKeyName(char* name, size_t buf_length) {
+ if (NULL == name) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (buf_length < (strlen(HAL_INPUT_ILITEK_KEY_DEVICE_NAME) + 1)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ snprintf(name, buf_length, "%s", HAL_INPUT_ILITEK_KEY_DEVICE_NAME);
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel device horizontal resolution
+ */
+static int InputTouchGetDeviceHResolution(int *resolution) {
+ if (NULL == resolution) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *resolution = HAL_INPUT_TOUCH_RESOLUTION_HORIZONTAL;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel device vertical resolution
+ */
+static int InputTouchGetDeviceVResolution(int *resolution) {
+ if (NULL == resolution) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *resolution = HAL_INPUT_TOUCH_RESOLUTION_VERTICAL;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get whether X axis is inversion
+ */
+static int InputTouchGetXAxisReverse(bool* is_reverse) {
+ if (NULL == is_reverse) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *is_reverse = false;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get whether Y axis is inversion
+ */
+static int InputTouchGetYAxisReverse(bool* is_reverse) {
+ if (NULL == is_reverse) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *is_reverse = false;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Execute touch panel self test
+ */
+static int InputTouchSelftest(int id, void *result) {
+ if (NULL == result) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Get touch panel config status
+ */
+static int InputTouchGetConfigStatus(int *status) {
+ if (NULL == status) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *status = HAL_INPUT_TOUCH_CONFIG_OFF;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Set whether the driver sends touch panel data or not
+ */
+static int InputTouchSetTouchLock(int lock) {
+ if ((HAL_INPUT_TOUCH_UNREPORT == lock) ||
+ (HAL_INPUT_TOUCH_REPORT == lock)) {
+ return HAL_INPUT_RET_NOT_SUPPORT;
+ }
+ return HAL_INPUT_RET_ERROR;
+}
+
+/*
+ * Suspend touch panel
+ */
+static int InputTouchSetTouchSuspend() {
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Set touch panel sensitivity level
+ */
+static int InputTouchSetSensitivityLevel(int level) {
+ if ((HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_LOW == level) ||
+ (HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_MIDDLE == level) ||
+ (HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_HIGH == level) ||
+ (HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_NONE == level) ) {
+ return HAL_INPUT_RET_NOT_SUPPORT;
+ }
+ return HAL_INPUT_RET_ERROR;
+}
+
+/*
+ * Get touch panel sensitivity level
+ */
+static int InputTouchGetSensitivityLevel(int *level) {
+ if (NULL == level) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Notify radio scan frequency
+ */
+static int InputTouchNotifyRadioScanFrequency(struct RadioInfoTouch *info) {
+ if (NULL == info) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Init touch panel operation function
+ */
+int InputTouchIlitekInit(struct TouchHal *touch) {
+ touch->start = InputTouchStart;
+ touch->config = InputTouchConfig;
+ touch->get_touch_devicename = InputTouchGetDeviceName;
+ touch->get_key_devicename = InputTouchGetKeyName;
+ touch->get_reso_h = InputTouchGetDeviceHResolution;
+ touch->get_reso_v = InputTouchGetDeviceVResolution;
+ touch->get_reverse_axis_x = InputTouchGetXAxisReverse;
+ touch->get_reverse_axis_y = InputTouchGetYAxisReverse;
+ touch->selftest = InputTouchSelftest;
+ touch->get_config_status = InputTouchGetConfigStatus;
+ touch->set_touch_lock = InputTouchSetTouchLock;
+ touch->set_touch_suspend = InputTouchSetTouchSuspend;
+ touch->set_sensitivity_level = InputTouchSetSensitivityLevel;
+ touch->get_sensitivity_level = InputTouchGetSensitivityLevel;
+ touch->notify_radio_scan_frequency = InputTouchNotifyRadioScanFrequency;
+ return HAL_INPUT_RET_NORMAL;
+}
diff --git a/video_in_hal/input_hal/src/input_udev_monitor.cpp b/video_in_hal/input_hal/src/input_udev_monitor.cpp
new file mode 100755
index 0000000..5d8cc6b
--- /dev/null
+++ b/video_in_hal/input_hal/src/input_udev_monitor.cpp
@@ -0,0 +1,566 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <libudev.h>
+#include <native_service/ns_message_center_if.h>
+
+#include "input_hal.h"
+#include "input_hal_debug.h"
+#include "input_hal_internal.h"
+#include "input_drm.h"
+#include "input_udev_monitor.h"
+
+#define HAL_INPUT_UDEVMONITOR_THREADNAME "input_hal_udevm"
+#define max_value(x, y) ((x) > (y) ? (x) : (y))
+
+#define INPUT_VIRTUAL_INPUTDEVICE_NAME "/devices/virtual" /* Virtual device name created by SwitchManager */
+
+// Enough name length to contain node name
+#define INPUT_NODE_NAME_LENGTH 256
+
+#define TRACKING_ID_NONE -1
+
+static struct InputUdevMonitorInfo g_input_udevmonitor_info;
+static HANDLE g_sender_handle;
+static bool g_input_touch_init_notify = false;
+extern char* g_app_name; /* app name */
+bool g_break_from_watch = false; /* watch thread loop break flag */
+pthread_t g_udev_monitor_thread = -1; /* udev monitor thread */
+
+static void InputUdevMonitorTouchInitFinEventSend(int result) {
+ struct TouchInitFinishInput msg;
+
+ if (g_input_touch_init_notify) {
+ return;
+ }
+
+ if (NULL == g_sender_handle) {
+ g_sender_handle = McOpenSender(g_app_name);
+ }
+ msg.result = result;
+
+ InputUtilMCSend(
+ g_sender_handle, HAL_INPUT_SOURCE_NAME,
+ HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH, sizeof(msg), &msg);
+ g_input_touch_init_notify = true;
+}
+
+static void InputUdevMonitorInputEventHandle(int fd, int device_type, int notify_id) {
+ ssize_t read_size;
+ struct EventsPackageInput events = {0};
+
+ read_size = read(fd, events.event, sizeof(events.event));
+ if (read_size > 0) {
+ events.count = read_size / sizeof(struct input_event);
+ events.device_type = device_type;
+
+ if (NULL == g_sender_handle) {
+ g_sender_handle = McOpenSender(g_app_name);
+ }
+
+ InputUtilMCSend(
+ g_sender_handle, HAL_INPUT_SOURCE_NAME,
+ notify_id, sizeof(events), &events);
+ }
+}
+
+static void InputUdevMonitorTouchEventHandle(int fd, int notify_id) {
+ ssize_t read_size;
+ struct input_event event[HAL_INPUT_EVENT_COUNT] = {0};
+ int touch_status;
+
+ read_size = read(fd, event, sizeof(event));
+
+ if (read_size > 0) {
+ if (NULL == g_sender_handle) {
+ g_sender_handle = McOpenSender(g_app_name);
+ }
+
+ int event_num = read_size / sizeof(struct input_event);
+
+ for (int index = 0; index < event_num; ++index) {
+ if (EV_ABS == event[index].type) {
+ if (event[index].code == ABS_MT_TRACKING_ID) {
+ if (TRACKING_ID_NONE == event[index].value) {
+ touch_status = HAL_INPUT_TOUCH_RELEASE;
+ } else {
+ touch_status = HAL_INPUT_TOUCH_PRESS;
+ }
+ InputUtilMCSend(
+ g_sender_handle, HAL_INPUT_SOURCE_NAME,
+ notify_id, sizeof(touch_status), &touch_status);
+ }
+ }
+ }
+ }
+}
+
+static int InputUdevMonitorDeviceAssort(struct udev_device *dev) {
+ const char *property;
+
+ char touch_key_device_name[INPUT_NODE_NAME_LENGTH] = { 0 };
+ GetKeyNameTouch(touch_key_device_name, sizeof(touch_key_device_name));
+ const char *sysattr_name = udev_device_get_sysattr_value(dev, "name");
+ if ((sysattr_name) &&
+ (0 == strcmp(touch_key_device_name, sysattr_name))) {
+ INPUT_LOG_TRACE("DeviceAssort : ESC_SW\n");
+ return HAL_INPUT_DEVICE_TOUCH_ESCKEY;
+ }
+
+ char touch_device_name[INPUT_NODE_NAME_LENGTH] = { 0 };
+ GetPanelNameTouch(touch_device_name, sizeof(touch_device_name));
+ sysattr_name = udev_device_get_sysattr_value(dev, "name");
+ if ((sysattr_name) &&
+ (0 == strcmp(touch_device_name, sysattr_name))) {
+ INPUT_LOG_TRACE("DeviceAssort : Touch\n");
+ return HAL_INPUT_DEVICE_TOUCH;
+ }
+
+ property = udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD");
+ if ((property) && (strcmp("1", property) == 0)) {
+ INPUT_LOG_TRACE("DeviceAssort : KeyBoard\n");
+ return HAL_INPUT_DEVICE_KEYBOARD;
+ }
+
+ property = udev_device_get_property_value(dev, "ID_INPUT_TABLET");
+ if ((property) && (strcmp("1", property) == 0)) {
+ INPUT_LOG_TRACE("DeviceAssort : Tablet\n");
+ return HAL_INPUT_DEVICE_INVALID;
+ }
+
+ property = udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD");
+ if ((property) && (strcmp("1", property) == 0)) {
+ INPUT_LOG_TRACE("DeviceAssort : Touch pad\n");
+ return HAL_INPUT_DEVICE_TABLET_FINGER;
+ }
+
+ return HAL_INPUT_DEVICE_INVALID;
+}
+
+static void InputUdevMonitorDeviceListOutput(void) {
+ struct InputUtilList *p;
+
+ INPUT_LOG_TRACE("OutputList >> start ======================\n");
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+ if (NULL != entry) {
+ INPUT_LOG_TRACE("FD: %d Device=%s Assort=%d\n",
+ entry->fd, entry->device_node, entry->device_assort);
+ }
+ }
+ INPUT_LOG_TRACE("OutputList << end ======================\n");
+}
+
+static void InputUdevMonitorDeviceListDelete(const char *node) {
+ struct InputUtilList *p;
+
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+ if (strcmp(node, entry->device_node) == 0) {
+ close(entry->fd);
+ InputUtilListDelete(p);
+ free(entry);
+ break;
+ }
+ }
+ InputUdevMonitorDeviceListOutput();
+}
+
+static int InputUdevMonitorDeviceListAdd(int fd, int device_assort, const char *node) {
+ int ret = HAL_INPUT_RET_NORMAL;
+ struct InputInputDeviceList *p;
+
+ p = (struct InputInputDeviceList *) malloc(sizeof(struct InputInputDeviceList));
+ if (p) {
+ p->fd = fd;
+ p->device_assort = device_assort;
+
+ if (strlen(node) < INPUT_DEVICE_NODE_LENGTH_MAX) {
+ strncpy(p->device_node, node, sizeof(p->device_node) - 1);
+ InputUdevMonitorDeviceListDelete(node);
+ InputUtilListAdd(&p->list, &g_input_udevmonitor_info.dev_list.list);
+ } else {
+ ret = HAL_INPUT_RET_ERROR;
+ }
+ } else {
+ ret = HAL_INPUT_RET_ERROR;
+ }
+
+ InputUdevMonitorDeviceListOutput();
+
+ return ret;
+}
+
+static int InputUdevMonitorInputEventGrab(const char *node, struct udev_device *dev) {
+ int fd, rtn;
+
+ InputUdevMonitorDeviceListDelete(node);
+
+ fd = open(node, O_RDONLY);
+
+ if (fd < 0) {
+ INPUT_ERROR_LOG("ERR: open %s errno=%d \n", node, errno);
+ goto err_rtn;
+ }
+
+ rtn = ioctl(fd, EVIOCGRAB, 1);
+ if (rtn) {
+ INPUT_ERROR_LOG("ERR: ioctl grab %s \n", node);
+ goto err_rtn_close;
+ }
+ INPUT_LOG_TRACE("%s Grab \n", node);
+
+ /* Backup FD */
+ rtn = InputUdevMonitorDeviceListAdd(fd, InputUdevMonitorDeviceAssort(dev), node);
+ if (rtn) {
+ goto err_rtn_close;
+ }
+
+ return HAL_INPUT_RET_NORMAL;
+
+err_rtn_close:
+ close(fd);
+err_rtn:
+ INPUT_LOG_TRACE("%s Grab impossible \n", node);
+ return HAL_INPUT_RET_ERROR;
+}
+
+static void InputUdevMonitorFDSet(int *nfds, fd_set *fds) {
+ struct InputUtilList *p;
+
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+
+ switch (entry->device_assort) {
+ case HAL_INPUT_DEVICE_TOUCH_ESCKEY:
+ case HAL_INPUT_DEVICE_TOUCH:
+ case HAL_INPUT_DEVICE_KEYBOARD:
+ case HAL_INPUT_DEVICE_TABLET_FINGER:
+ FD_SET(entry->fd, fds);
+ *nfds = max_value(*nfds, entry->fd);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void InputUdevMonitorFDHandle(fd_set *fds) {
+ struct InputUtilList *p;
+
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+ if (FD_ISSET(entry->fd, fds)) {
+ int notify_id = 0;
+ switch (entry->device_assort) {
+ case HAL_INPUT_DEVICE_TOUCH_ESCKEY:
+ notify_id = HAL_INPUT_NOTIFY_ESC_KEY;
+ break;
+ case HAL_INPUT_DEVICE_TOUCH:
+ notify_id = HAL_INPUT_NOTIFY_TOUCH;
+ break;
+ case HAL_INPUT_DEVICE_KEYBOARD:
+ notify_id = HAL_INPUT_NOTIFY_KEY_BOARD;
+ break;
+ case HAL_INPUT_DEVICE_TABLET_FINGER:
+ notify_id = HAL_INPUT_NOTIFY_TABLET_FINGER;
+ break;
+ default:
+ return;
+ }
+ if (notify_id == HAL_INPUT_NOTIFY_TOUCH) {
+ InputUdevMonitorTouchEventHandle(entry->fd, notify_id);
+ } else {
+ InputUdevMonitorInputEventHandle(entry->fd, entry->device_assort, notify_id);
+ }
+ }
+ }
+}
+
+static int InputUdevMonitorInit(void) {
+ g_input_udevmonitor_info.udev = udev_new();
+ if (NULL == g_input_udevmonitor_info.udev) {
+ INPUT_ERROR_LOG("ERR: udev_new ret=%d \n", errno);
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ // create the udev monitor
+ g_input_udevmonitor_info.monitor = udev_monitor_new_from_netlink(g_input_udevmonitor_info.udev, "udev");
+ udev_monitor_filter_add_match_subsystem_devtype(g_input_udevmonitor_info.monitor, "input", NULL);
+
+ // start receiving hotplug events
+ udev_monitor_enable_receiving(g_input_udevmonitor_info.monitor);
+
+ INPUT_INIT_LIST_HEAD(&g_input_udevmonitor_info.dev_list.list)
+
+ return HAL_INPUT_RET_NORMAL;
+}
+
+static void InputUdevMonitorDeinit(void) {
+ // destroy the udev monitor
+ udev_monitor_unref(g_input_udevmonitor_info.monitor);
+ // destroy the udev object
+ udev_unref(g_input_udevmonitor_info.udev);
+
+ if (g_sender_handle != NULL) {
+ McClose(g_sender_handle);
+ g_sender_handle = NULL;
+ }
+
+ g_input_touch_init_notify = false;
+}
+
+static int InputUdevMonitorDevicesGet(void) {
+ int ret;
+ struct udev_enumerate *enumerate;
+ struct udev_list_entry *devices, *dev_list_entry;
+ char touch_device_name[INPUT_NODE_NAME_LENGTH] = { 0};
+ const char* sysattr_name;
+ bool input_touch_device_found = false;
+
+ // Create a list of the devices in the 'usb_device' subsystem.
+ enumerate = udev_enumerate_new(g_input_udevmonitor_info.udev);
+ udev_enumerate_add_match_subsystem(enumerate, "input");
+ udev_enumerate_scan_devices(enumerate);
+ devices = udev_enumerate_get_list_entry(enumerate);
+ GetPanelNameTouch(touch_device_name, sizeof(touch_device_name));
+
+ // Enumerate device list
+ udev_list_entry_foreach(dev_list_entry, devices) {
+ const char *path, *node;
+
+ // Get the filename of the /sys entry for the device and create a udev_device object (dev) representing it
+ path = udev_list_entry_get_name(dev_list_entry);
+ struct udev_device* dev = udev_device_new_from_syspath(g_input_udevmonitor_info.udev, path);
+ if (NULL == dev) continue;
+
+ // usb_device_get_devnode() returns the path to the device node itself in /dev.
+ node = udev_device_get_devnode(dev);
+ if (!node) {
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // Filter device name is eventX
+ if (strncmp("event", udev_device_get_sysname(dev), sizeof("event") -1) != 0) {
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // virtual device
+ if (strncmp(INPUT_VIRTUAL_INPUTDEVICE_NAME, udev_device_get_devpath(dev),
+ sizeof(INPUT_VIRTUAL_INPUTDEVICE_NAME) - 1) == 0) {
+ INPUT_LOG_TRACE("Found Virtual Device : %s \n", node);
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // check parent is input
+ struct udev_device* input_dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL);
+ if (NULL == input_dev) {
+ udev_device_unref(dev);
+ continue;
+ }
+
+ sysattr_name = udev_device_get_sysattr_value(input_dev, "name");
+ if (NULL == sysattr_name) {
+ INPUT_ERROR_LOG("ERR: Unable to find sysattr \n");
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // touchpanel device
+ if (0 == strcmp(touch_device_name, sysattr_name)) {
+ INPUT_LOG_TRACE("Found %s : %s \n", touch_device_name, path);
+ int spec_reso_h;
+ int spec_reso_v;
+ GetPanelSpecResolutionInput(&spec_reso_h, &spec_reso_v);
+ ret = ConfigTouch(udev_device_get_syspath(input_dev),
+ spec_reso_h, spec_reso_v);
+
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ int status;
+ ret = GetConfigStatusTouch(&status);
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ if (HAL_INPUT_TOUCH_CONFIG_OFF == status) {
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_NORMAL);
+ }
+ } else {
+ INPUT_ERROR_LOG("GetConfigStatusTouch fail\n");
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_ERROR);
+ }
+ } else {
+ INPUT_ERROR_LOG("ConfigTouch fail\n");
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_ERROR);
+ }
+
+ input_touch_device_found = true;
+ }
+
+ INPUT_LOG_TRACE("Found Device : %s \n", node);
+
+ /* Modified not to notify input events to other processes */
+ InputUdevMonitorInputEventGrab(node, input_dev);
+
+ udev_device_unref(dev);
+ } // end foreach
+
+ if (!input_touch_device_found) {
+ INPUT_ERROR_LOG("ERR: Dummy Device Create");
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_NORMAL);
+ }
+
+ // Free the enumerator object
+ udev_enumerate_unref(enumerate);
+
+ return HAL_INPUT_RET_NORMAL;
+}
+
+static void InputUdevMonitorDeviceStatusChange(int fd, fd_set *fds) {
+ if (FD_ISSET(fd, fds)) {
+ // receive the relevant device
+ struct udev_device* dev = udev_monitor_receive_device(g_input_udevmonitor_info.monitor);
+ if (NULL == dev) return;
+
+ // input_udev_DevicesGet(udm);
+ const char* action = udev_device_get_action(dev);
+ const char* node = udev_device_get_devnode(dev);
+ if ((!action) || (!node)) {
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (strncmp("event", udev_device_get_sysname(dev), sizeof("event") -1) != 0) {
+ INPUT_LOG_TRACE("not event device %s \n", udev_device_get_sysname(dev));
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (strncmp(INPUT_VIRTUAL_INPUTDEVICE_NAME, udev_device_get_devpath(dev),
+ sizeof(INPUT_VIRTUAL_INPUTDEVICE_NAME) - 1) == 0) {
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (strcmp(action, "remove") == 0) {
+ InputUdevMonitorDeviceListDelete(node);
+ }
+
+ struct udev_device* input_dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL);
+ if (NULL == input_dev) {
+ udev_device_unref(dev);
+ return;
+ }
+ char touch_device_name[INPUT_NODE_NAME_LENGTH] = { 0};
+ GetPanelNameTouch(touch_device_name, sizeof(touch_device_name));
+ const char *sysattr_name = udev_device_get_sysattr_value(input_dev, "name");
+ if (NULL == sysattr_name) {
+ INPUT_ERROR_LOG("ERR: Unable to find sysattr \n");
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (0 == strcmp(touch_device_name, sysattr_name)) {
+ if (strcmp(action, "remove") == 0) {
+ } else {
+ INPUT_LOG_TRACE("Found %s \n", touch_device_name);
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_NORMAL);
+ }
+ }
+
+ INPUT_LOG_TRACE("%s : %s \n", node, action);
+ if (strcmp(action, "remove") == 0) {
+ } else {
+ /* Modified not to notify input events to other processes */
+ InputUdevMonitorInputEventGrab(node, input_dev);
+ }
+ udev_device_unref(dev);
+ }
+}
+
+static void InputUdevMonitorWatch(void) {
+ fd_set fds;
+ int fd = udev_monitor_get_fd(g_input_udevmonitor_info.monitor);
+
+ if (fd != -1) {
+ while (!g_break_from_watch) {
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ int nfds = max_value(0, fd);
+
+ InputUdevMonitorFDSet(&nfds, &fds);
+
+ struct timeval timeout;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 100 * 1000;
+ int ret = select(nfds + 1, &fds, NULL, NULL, &timeout);
+ if (ret > 0) {
+ InputUdevMonitorDeviceStatusChange(fd, &fds);
+
+ InputUdevMonitorFDHandle(&fds);
+ }
+ }
+ } else {
+ INPUT_ERROR_LOG("ERR: udev_monitor_get_fd");
+ }
+}
+
+static void *InputUdevMonitorMain(void * arg) {
+ int rtn;
+ prctl(PR_SET_NAME, HAL_INPUT_UDEVMONITOR_THREADNAME);
+
+ rtn = InputUdevMonitorInit();
+ if (rtn != HAL_INPUT_RET_NORMAL) {
+ goto err_rtn;
+ }
+
+ /* Get input device */
+ InputUdevMonitorDevicesGet();
+
+ /* Input device monitoring (basically never get out from here) */
+ InputUdevMonitorWatch();
+
+ InputUdevMonitorDeinit();
+
+ return NULL;
+
+err_rtn:
+ INPUT_LOG_TRACE("pthread_detach\n");
+ return NULL;
+}
+
+int32_t InputUdevMonitorThreadCreate(void) {
+ int ret;
+
+ ret = pthread_create(&g_udev_monitor_thread, NULL, InputUdevMonitorMain, NULL);
+ if (ret != 0) {
+ INPUT_ERROR_LOG("ERR: pthread_create =%d\n", errno);
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ return HAL_INPUT_RET_NORMAL;
+}
diff --git a/video_in_hal/input_hal/src/input_util.cpp b/video_in_hal/input_hal/src/input_util.cpp
new file mode 100755
index 0000000..bb349eb
--- /dev/null
+++ b/video_in_hal/input_hal/src/input_util.cpp
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "input_util.h"
+
+#include <native_service/ns_message_center_if.h>
+#include <stdio.h>
+
+#include "input_hal.h"
+#include "input_hal_debug.h"
+
+#define INPUT_UTIL_MESSAGE_SEND_RETRY 3
+#define INPUT_UTIL_MESSAGE_SEND_WAIT 10000 /* RetryWait:10ms */
+/*
+ * InputUtilListAdd
+ */
+void InputUtilListAdd(struct InputUtilList *node_new, struct InputUtilList *node_head) {
+ node_new->prev = node_head;
+ node_new->next = node_head->next;
+ node_head->next = node_new;
+ node_new->next->prev = node_new;
+}
+
+/*
+ * InputUtilListDelete
+ */
+void InputUtilListDelete(struct InputUtilList *node) {
+ node->prev->next = node->next;
+ node->next->prev = node->prev;
+}
+
+/*
+ * InputUtilMCSend
+ */
+int InputUtilMCSend(HANDLE h_message, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data) {
+ int i = 0;
+ EFrameworkunifiedStatus e_status; /* return value */
+
+ do {
+ e_status = McSend(h_message, source, cmd, length, data);
+ if (eFrameworkunifiedStatusOK == e_status) {
+ break;
+ }
+ InputUtilSleep(INPUT_UTIL_MESSAGE_SEND_WAIT);
+ } while (i++ < INPUT_UTIL_MESSAGE_SEND_RETRY);
+
+ if (e_status != eFrameworkunifiedStatusOK) {
+ INPUT_ERROR_LOG("ERR: MessageSend=%d \n", e_status);
+ }
+
+ return e_status;
+}
+
+/*
+ * InputUtilSleep
+ */
+int InputUtilSleep(int usec) {
+ struct timespec req;
+
+ req.tv_sec = 0;
+ req.tv_nsec = usec * 1000;
+ nanosleep(&req, NULL);
+
+ return HAL_INPUT_RET_NORMAL;
+}
diff --git a/video_in_hal/kernel-module-evklib/Makefile b/video_in_hal/kernel-module-evklib/Makefile
new file mode 100755
index 0000000..2c37667
--- /dev/null
+++ b/video_in_hal/kernel-module-evklib/Makefile
@@ -0,0 +1,30 @@
+# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Makefile for linux/drivers/agl
+#
+CFILES = evk_lib.c
+
+obj-m := evk_lib.o
+evklib-objs := $(CFILES:.c=.o)
+
+U_INCLUDE += -I$(PWD)
+U_INCLUDE += -I$(KERNEL_SRC)/include
+ccflags-y += $(U_INCLUDE)
+
+all:
+ make -C $(KERNEL_SRC) M=$(PWD) modules
+clean:
+ make -C $(KERNEL_SRC) M=$(PWD) clean
+
diff --git a/video_in_hal/kernel-module-evklib/agldd/agldd.h b/video_in_hal/kernel-module-evklib/agldd/agldd.h
new file mode 100755
index 0000000..112dbae
--- /dev/null
+++ b/video_in_hal/kernel-module-evklib/agldd/agldd.h
@@ -0,0 +1,94 @@
+/*
+ * adcpf common header
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _AGLDD_H_
+#define _AGLDD_H_
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <stdint.h>
+#if !defined(__cplusplus)
+#include <stdbool.h>
+#endif /* !defined(__cplusplus) */
+#endif /* __KERNEL__ */
+
+#ifndef __KERNEL__
+#define __LINUX_ARM_ARCH__ 7
+#define BITS_PER_LONG 32
+
+#define __AGLDD_TYPEDEF_I64
+typedef long long i64; /* 8-byte signed integer */
+
+#define __AGLDD_TYPEDEF_U64
+typedef unsigned long long u64; /* 8-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_U32
+typedef unsigned long u32; /* 4-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_U16
+typedef unsigned short u16; /* 2-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_I16
+typedef short i16; /* 2-byte signed integer */
+
+#define __AGLDD_TYPEDEF_U8
+typedef unsigned char u8; /* 1-byte unsigned integer */
+
+#define __AGLDD_TYPEDEF_I8
+typedef char i8; /* 1-byte signed integer */
+#endif
+
+#define __AGLDD_TYPEDEF_INT8
+typedef signed char INT8;
+
+#define __AGLDD_TYPEDEF_INT16
+typedef signed short INT16;
+
+#define __AGLDD_TYPEDEF_INT32
+typedef signed int INT32;
+
+#define __AGLDD_TYPEDEF_INT64
+typedef signed long long INT64;
+
+#define __AGLDD_TYPEDEF_UINT8
+typedef unsigned char UINT8;
+
+#define __AGLDD_TYPEDEF_UINT16
+typedef unsigned short UINT16;
+
+#define __AGLDD_TYPEDEF_UINT32
+typedef unsigned int UINT32;
+
+#define __AGLDD_TYPEDEF_UINT64
+typedef unsigned long long UINT64;
+
+#ifndef __KERNEL__
+#if !defined __WIN_TYPEDEF_BOOL
+#define __AGLDD_TYPEDEF_BOOL
+typedef UINT32 BOOL;
+#endif
+#endif
+
+#ifndef TRUE
+#define TRUE true
+#endif
+#ifndef FALSE
+#define FALSE false
+#endif
+
+#endif/* _AGLDD_H_ */
diff --git a/video_in_hal/kernel-module-evklib/agldd/ev_common.h b/video_in_hal/kernel-module-evklib/agldd/ev_common.h
new file mode 100755
index 0000000..0cc1183
--- /dev/null
+++ b/video_in_hal/kernel-module-evklib/agldd/ev_common.h
@@ -0,0 +1,135 @@
+/**
+ * @file ev_common.h
+ * @brief Event library -- User kernel common data structure
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ev_common_h_
+#define _ev_common_h_
+
+#include <agldd/ev_id.h>
+
+/** @addtogroup EV
+ * @{ */
+/** @brief Maximum number of bytes for message event */
+#define EV_MAX_MESSAGE_LENGTH 2048
+
+/** @brief -Maximum number of flag queue that can be created within a thread */
+#define EV_MAX_IDS_IN_THREAD 24
+
+/** @brief -Muximum number of threads that can be registered to the EV in a process */
+#define EV_MAX_THREADS_IN_PROCESS 16
+
+/** @brief -Maximum number of flag queue that can be creat within a process
+ */
+#define EV_MAX_IDS_IN_PROCESS \
+ (EV_MAX_IDS_IN_THREAD * EV_MAX_THREADS_IN_PROCESS)
+
+/** @brief Return values for even library function
+ *
+ * @see EV_ERR
+ */
+enum ev_err
+{
+ EV_OK = 0, /**< Normal completion */
+ EV_ERR_Exist, /**< The specified flag message queue does exist */
+ EV_ERR_Invalid_ID, /**< The specified flag message queue does not exist */
+ EV_ERR_Busy, /**< Message queue full failed to send */
+ EV_ERR_Interrupted, /**< Waiting function was interrupted by an interrupt */
+ EV_ERR_Thread_Over, /**< Exceeding the number of threads in the process */
+ EV_ERR_Invalid_Thread, /**< Invalid thread ID */
+ EV_ERR_Fatal, /**< Fatal error */
+};
+/** @brief Return values type for even library function
+ *
+ * @see ev_err
+ */
+typedef INT32 EV_ERR;
+
+/** @brief Event type
+ *
+ * Use in the type of EV_Event structs
+ * @see ev_type
+ */
+typedef UINT32 EV_Type;
+
+/** @brief Bit value representing the type of event */
+enum ev_type {
+ EV_EVENT_None = 0x00000000,
+
+ /** Flag event: Judged by EV_EVENT_IS_FLAG() */
+ EV_EVENT_Flag = 0x0001,
+#define EV_EVENT_IS_FLAG(tp) (((tp) & EV_EVENT_Flag) != 0)
+
+ /** Message event: Judged by EV_EVENT_IS_MESSAGE() */
+ EV_EVENT_Message = 0x0002,
+#define EV_EVENT_IS_MESSAGE(tp) (((tp) & EV_EVENT_Message) != 0)
+
+ /** 64bit flag event: Judged by EV_EVENT_IS_FLAG64() */
+ EV_EVENT_Flag64 = 0x0003,
+#define EV_EVENT_IS_FLAG64(tp) (((tp) & EV_EVENT_Flag64) != 0)
+
+};
+
+/** @brief Flag event structure */
+typedef struct {
+ EV_ID flagID;/**< Flag ID */
+ UINT32 bits;/**< Bit pattern */
+} EV_Flag;
+
+/** @brief 64bit flag event structure */
+typedef struct {
+ EV_ID flagID;/**< Flag ID */
+ UINT64 bits;/**< Bit pattern */
+} EV_Flag64;
+
+/** @brief Message event structure */
+typedef struct {
+ EV_ID queueID;/**< queue ID */
+ UINT32 senderInfo;/**< Source information */
+ UINT32 length;/**< Number of bytes in the message */
+ UINT32 dummy;/** dummy for pading */
+ UINT8 message[EV_MAX_MESSAGE_LENGTH];/**< Message */
+} EV_Message;
+
+/** @brief Event structure */
+typedef struct {
+ EV_Type type; /**< Event type */
+ union {
+ EV_Flag flag; /**< Flag event structure */
+ EV_Flag64 flag64; /**< Flag event structure */
+ EV_Message message; /**< Message event structure */
+ } u; /**< Union of structures per eventtype */
+} EV_Event;
+
+/** @brief Message event queue type
+ *
+ * Specify the action to be taken when the queue overflows (more events are received when the queue is full).
+ */
+enum ev_message_queue_type {
+ EV_MESSAGE_QUEUE_TYPE_BUSY,/**< Return a BUSY to the source */
+ EV_MESSAGE_QUEUE_TYPE_FIFO,/**< Delete the oldest event */
+ EV_MESSAGE_QUEUE_TYPE_REPLACE,/**< Replace the most recent event */
+};
+
+/** @brief Messge event queue type
+ *
+ * @see ev_message_queue_type
+ */
+typedef UINT8 EV_Message_Queue_Type;
+
+/** @} */
+
+#endif /* !_ev_common_h_ */
diff --git a/video_in_hal/kernel-module-evklib/agldd/ev_id.h b/video_in_hal/kernel-module-evklib/agldd/ev_id.h
new file mode 100755
index 0000000..2026ef7
--- /dev/null
+++ b/video_in_hal/kernel-module-evklib/agldd/ev_id.h
@@ -0,0 +1,104 @@
+/**
+ * @file ev_id.h
+ * @brief Event library(kernel) -- Defining flag queue ID
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ev_id_h_
+#define _ev_id_h_
+
+/** @addtogroup EV_ID_spec
+ * @{ */
+
+/** @brief Flag ID and queue ID types used when sending and receiving events
+ *
+ * Assign a 32-bit value as follows
+ *
+ * - Most significant 8 bits: Reserved
+ * - Next 16 bits: Modue ID
+ * - Lower 8 bits: Define in module
+ *
+ * Where module is the modules that creates the queue.
+ * The modules define ID according to the above assignments using EV_Flag_ID_Base and EV_Queue_ID_Base macros.
+ * @see EV_Flag_ID_Base
+ * @see EV_Queue_ID_Base
+ */
+typedef UINT32 EV_ID;
+
+#define EV_ID_BIT 0x80000000UL
+#define EV_FLAG64_BIT 0x40000000UL
+#define EV_FLAG_BIT 0x20000000UL
+#define EV_QUEUE_BIT 0x10000000UL
+#define EV_AUTO_ID_BIT 0x08000000UL
+#define EV_RESERVED_BIT 0xff000000UL
+#define EV_INVALID_ID EV_ID_BIT
+#define EV_NO_ID EV_INVALID_ID
+
+#define EV_ID_IS_FLAG(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_FLAG_BIT)) == (EV_ID_BIT|EV_FLAG_BIT))
+#define EV_ID_IS_FLAG64(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_FLAG64_BIT)) == (EV_ID_BIT|EV_FLAG64_BIT))
+#define EV_ID_IS_QUEUE(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_QUEUE_BIT)) == (EV_ID_BIT|EV_QUEUE_BIT))
+#define EV_ID_IS_AUTO_ID(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_AUTO_ID_BIT)) == (EV_ID_BIT|EV_AUTO_ID_BIT))
+#define EV_ID_IS_VALID(queueID) \
+ (EV_ID_IS_FLAG(queueID) || EV_ID_IS_FLAG64(queueID) || EV_ID_IS_QUEUE(queueID))
+
+/** @brief Macros for defining flag ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Flag_ID_Base EV_Flag_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Flag_foo (XXX_Flag_ID_Base + 1)
+ * - #define XXX_Flag_bar (XXX_Flag_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Flag_ID_Base(mod) (EV_ID_BIT|EV_FLAG_BIT|((mod)<<8))
+
+/** @brief Macros for defining 64 bits flag ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Flag64_ID_Base EV_Flag64_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Flag64_foo (XXX_Flag64_ID_Base + 1)
+ * - #define XXX_Flag64_bar (XXX_Flag64_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Flag64_ID_Base(mod) (EV_ID_BIT|EV_FLAG64_BIT|((mod)<<8))
+
+/** @brief Macros for defining mesage queue ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Queue_ID_Base EV_Queue_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Queue_foo (XXX_Queue_ID_Base + 1)
+ * - #define XXX_Queue_bar (XXX_Queue_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Queue_ID_Base(mod) (EV_ID_BIT|EV_QUEUE_BIT|((mod)<<8))
+
+/** @} */
+
+#endif /* ! _ev_id_h_ */
diff --git a/video_in_hal/kernel-module-evklib/agldd/evk_lib.h b/video_in_hal/kernel-module-evklib/agldd/evk_lib.h
new file mode 100755
index 0000000..416fb0f
--- /dev/null
+++ b/video_in_hal/kernel-module-evklib/agldd/evk_lib.h
@@ -0,0 +1,116 @@
+/**
+ * @file evk_lib.h
+ * @brief Event library -- API specifications for kernel modules
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _evk_lib_h_
+#define _evk_lib_h_
+
+#include <agldd/ev_common.h>
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+/* API definition */
+
+/** @addtogroup EV
+ * @{ */
+#ifdef __KERNEL__
+/* Flag message queue create/delete */
+EV_ERR EVK_create_flag(EV_ID flagID);
+EV_ERR EVK_create_flag64(EV_ID flagID);
+EV_ERR EVK_create_queue(EV_ID queueID,
+ UINT8 length,
+ UINT16 max_bytes,
+ EV_Message_Queue_Type type);
+
+EV_ERR EVK_create_flag_auto_id(/* OUT */EV_ID *flagID);
+EV_ERR EVK_create_flag64_auto_id(/* OUT */EV_ID *flagID);
+EV_ERR EVK_create_queue_auto_id(/* OUT */EV_ID *queueID,
+ UINT8 length,
+ UINT16 max_bytes,
+ EV_Message_Queue_Type type);
+
+EV_ERR EVK_destroy_flag(EV_ID flagID);
+EV_ERR EVK_destroy_queue(EV_ID queueID);
+
+/* Send events */
+EV_ERR EVK_set_flag(EV_ID flagID, UINT32 bits);
+EV_ERR EVK_set_flag64(EV_ID flagID, UINT64 bits);
+EV_ERR EVK_send_message(EV_ID queueID, UINT16 bytes, const void *message,
+ UINT32 senderInfo);
+
+/* Get event(with search conditions) */
+EV_ERR EVK_get_flag(EV_ID flagID, /* OUT */EV_Flag *flag);
+EV_ERR EVK_wait_flag(EV_ID flagID, /* OUT */EV_Flag *flag);/* block */
+EV_ERR EVK_peek_flag(EV_ID flagID, /* OUT */EV_Flag *flag);
+EV_ERR EVK_get_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);
+EV_ERR EVK_wait_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);/* block */
+EV_ERR EVK_peek_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);
+
+EV_ERR EVK_get_message(EV_ID queueID, /* OUT */EV_Message *message);
+EV_ERR EVK_wait_message(EV_ID queueID, /* OUT */EV_Message *message);/* block */
+EV_ERR EVK_peek_message(EV_ID queueID, /* OUT */EV_Message *message);
+
+EV_ERR EVK_find_message_by_sender(EV_ID queueID, UINT32 senderInfo,
+ /* OUT */EV_Message *message);
+EV_ERR EVK_find_message_by_content(EV_ID queueID, UINT16 length,
+ const void *compare_bytes,
+ /* OUT */EV_Message *message);
+#endif
+
+/** @} */
+
+/** @addtogroup EVK_in
+ * @{ */
+#define EVK_NAME "evk"
+#define EVK_DEV_NAME "/dev/agl/"EVK_NAME
+#define EVK_DEV_MAJOR (1033 % 256)
+#define EVK_IOC_MAGIC 0xE7
+
+#define EVK_IOC_CREATE_FLAG _IO(EVK_IOC_MAGIC, 0x00)
+#define EVK_IOC_CREATE_FLAG64 _IO(EVK_IOC_MAGIC, 0x01)
+#define EVK_IOC_CREATE_MESSAGE_QUEUE _IO(EVK_IOC_MAGIC, 0x02)
+#define EVK_IOC_ALLOC_FLAG_ID _IO(EVK_IOC_MAGIC, 0x03)
+#define EVK_IOC_ALLOC_FLAG64_ID _IO(EVK_IOC_MAGIC, 0x04)
+#define EVK_IOC_ALLOC_QUEUE_ID _IO(EVK_IOC_MAGIC, 0x05)
+#define EVK_IOC_DESTROY_QUEUE _IO(EVK_IOC_MAGIC, 0x06)
+#define EVK_IOC_STORE_FLAG _IO(EVK_IOC_MAGIC, 0x07)
+#define EVK_IOC_STORE_FLAG64 _IO(EVK_IOC_MAGIC, 0x08)
+#define EVK_IOC_STORE_MESSAGE _IO(EVK_IOC_MAGIC, 0x09)
+#define EVK_IOC_SET_POLL _IO(EVK_IOC_MAGIC, 0x0a)
+#define EVK_IOC_GET_EVENT _IO(EVK_IOC_MAGIC, 0x0b)
+#define EVK_IOC_PEEK_EVENT _IO(EVK_IOC_MAGIC, 0x0c)
+#define EVK_IOC_WAIT_EVENT _IO(EVK_IOC_MAGIC, 0x0d)
+#define EVK_IOC_GET_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0e)
+#define EVK_IOC_PEEK_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0f)
+#define EVK_IOC_DEBUG_LIST _IO(EVK_IOC_MAGIC, 0x10)
+
+typedef struct {
+ EV_ID queueID;/**< Queue ID */
+ UINT32 max_bytes;/**< Maximum number of bytes for an event */
+ UINT8 length;/**< Queue length */
+ EV_Message_Queue_Type type;/**< Type */
+} EVK_Message_Queue_Request;
+
+typedef struct {
+ INT32 num; /**< Number of queue ID of search */
+ EV_ID ids[EV_MAX_IDS_IN_PROCESS]; /**< Queue ID of search */
+ EV_Event ev; /**< [OUT] First event that occured */
+} EVK_Next_Event_Query;
+
+/** @} */
+
+#endif /* !_evk_lib_h */
diff --git a/video_in_hal/kernel-module-evklib/agldd/moduleid.h b/video_in_hal/kernel-module-evklib/agldd/moduleid.h
new file mode 100755
index 0000000..b18c1a1
--- /dev/null
+++ b/video_in_hal/kernel-module-evklib/agldd/moduleid.h
@@ -0,0 +1,69 @@
+/*
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <linux/autoconf.h>
+#ifndef _AGLDD_MODULEID_H_
+#define _AGLDD_MODULEID_H_
+
+/*
+ * Define module ID to be used by programs in moduleid_id.h .
+ * Define in the format of "#define XXX_MID ID number" (XXX is the module name).
+ *
+ * MID allocation policy shall be as follows.
+ * - UI Application : 0xxxh
+ * - Application Service : 1xxxh to 2xxxh
+ * + HMI : 10xxh
+ * + AV : 12xxh
+ * + Radio : 14xxh
+ * + Connectivity : 16xxh
+ * + Navigation/Location: 18xxh
+ * + Vehicle : 1Axxh
+ * + Communication : 1Cxxh
+ * + BasePF : 1Exxh
+ * + System : 20xxh
+ * + Other : 22xxh
+ * - Common Service : 3xxxh
+ * - Extension Service : 4xxxh
+ * - System/Device Driver : 5xxxh
+ */
+
+/* UI Application : 0xxxh */
+
+/* Application Service : 1xxxh to 2xxxh */
+#define MODEMANAGER_MID 0x1000
+#define ACTIVITYMANAGER_MID 0x1001
+
+/* Common Service : 3xxxh */
+#define IPMANAGER_MID 0x3000
+#define DEVICEMANAGER_MID 0x3001
+#define MSGBRK_MID 0x3002
+#define TIMERENTRYDRV_MID 0x3003
+#define SOUNDAGENT_MID 0x3004
+#define CAN_MID 0x3006
+#define _CWORD83__MID 0x3007
+#define SENSOR_MID 0x3008
+#define GPS_MID 0x3009
+#define RESMGR_MID 0x300A
+#define GRAPHICS_MID 0x300B
+
+/* Extension Service : 4xxxh */
+
+/* System/Device Driver : 5xxxh */
+#define EV_MID 0x5001
+#define RPC_MID 0x5002
+#define EVK_MID 0x5801
+
+#endif /* !_AGLDD_MODULEID_H_ */
diff --git a/video_in_hal/kernel-module-evklib/evk_lib.c b/video_in_hal/kernel-module-evklib/evk_lib.c
new file mode 100755
index 0000000..d5c1718
--- /dev/null
+++ b/video_in_hal/kernel-module-evklib/evk_lib.c
@@ -0,0 +1,2246 @@
+/*
+ * drivers/agl/evk_lib.c
+ *
+ * Event library (kernel space part)
+ *
+ * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <generated/autoconf.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/version.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+#include <linux/poll.h>
+#include <linux/list.h>
+#include <asm/uaccess.h>
+#include <linux/errno.h>
+#include <linux/vmalloc.h>
+
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+
+#include <linux/device.h>
+#include <linux/cdev.h>
+
+#ifndef STANDARD_INT_DEFINITIONS
+#define STANDARD_INT_DEFINITIONS
+typedef __u8 UINT8;
+typedef __u16 UINT16;
+typedef __u32 UINT32;
+typedef __u64 UINT64;
+typedef __s8 INT8;
+typedef __s16 INT16;
+typedef __s32 INT32;
+typedef __s64 INT64;
+#endif /* !STANDARD_INT_DEFINITIONS */
+
+#define ENABLE_PROC_FS 1
+
+#include <agldd/evk_lib.h>
+
+/** @addtogroup EV_in */
+/** @{ */
+/** In Linux2.4, list_for_each_entry is not provided, so it is prepared by self (in 2.6)
+ */
+#ifdef list_for_each_entry
+#define __LINUX_26_OR_HIGHER
+#endif
+
+#ifndef __LINUX_26_OR_HIGHER /* linux v2.4 */
+
+#define list_for_each_entry(pos, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ prefetch(pos->member.next); \
+ &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member), \
+ prefetch(pos->member.next))
+
+#define list_for_each_entry_safe(pos, n, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+#else /* linux v2.6 */
+
+#include <linux/jiffies.h>
+
+#endif /* linux v2.6 */
+
+#define EVK_assert(cond, mesg) \
+ if (!(cond)) { \
+ printk(KERN_ALERT "[EVK]ASSERT(pid:%d): " #cond " at %s:%d; " \
+ #mesg "\n", current->pid, __FILE__, __LINE__); \
+ do {} while(1); \
+ }
+
+#define EVK_BUG(mesg) \
+ printk(KERN_ALERT "[EVK]BUG: " mesg); \
+ do {} while(1);
+
+#if 0
+#define EVK_info0(s) printk(KERN_ALERT "[EVK]INFO: " s)
+#define EVK_info1(s, t) printk(KERN_ALERT "[EVK]INFO: " s, t)
+#else
+#define EVK_info0(s)
+#define EVK_info1(s, t)
+#endif
+
+static int devmajor = EVK_DEV_MAJOR;
+static int devminor = 0;
+static int nrdevs = 1;
+static struct cdev cdev;
+static struct class *pClass;
+
+DEFINE_SEMAPHORE(evk_mtx);
+static int down_pid;
+static int down_line;
+#define EVK_mutex_lock() { \
+ down(&evk_mtx); \
+ down_pid = current->pid; \
+ down_line = __LINE__; \
+}
+#define EVK_mutex_unlock() (up(&evk_mtx))
+
+#ifdef EVK_USE_KMALLOC
+#define evk_malloc(s) kmalloc((s), GFP_KERNEL)
+#define evk_free kfree
+#else // use vmalloc (this is the default)
+#define evk_malloc(s) vmalloc((s))
+#define evk_free vfree
+#endif
+
+enum {
+ evk_mem_user = 0,
+ evk_mem_kernel,
+};
+
+enum {
+ evk_enum_flag,
+ evk_enum_flag64,
+ evk_enum_queue,
+};
+
+#define GET_USER_OR_KERNEL(to, from) \
+({ \
+ int err; \
+ if (mem == evk_mem_user) { \
+ err = __get_user((to), &(from)); \
+ } else { \
+ (to) = (from); \
+ err = 0; \
+ } \
+ err; \
+})
+
+#define PUT_USER_OR_KERNEL(value, to) \
+({ \
+ int err; \
+ if (mem == evk_mem_user) { \
+ err = __put_user((value), &(to)); \
+ } else { \
+ (to) = (value); \
+ err = 0; \
+ } \
+ err; \
+})
+
+
+/** @brief Common part of the flag structure and message queue structure */
+#define EVK_COMMON_QUEUE_ELEMS \
+ struct list_head list; /**< List structure */ \
+ wait_queue_head_t wq_head; /**< Wait_queue of a process waiting for a queue */\
+ EV_ID queueID; /**< Flag ID/Queue ID */ \
+ UINT32 seq_num; /**< Order of event arrival */ \
+ pid_t read_pid; /**< Read process ID */ \
+ pid_t pid; /**< Owning process ID */
+
+/** @brief Common part of the flag structure and message queue structure */
+struct common_queue {
+ EVK_COMMON_QUEUE_ELEMS
+};
+
+/** @brief Flag structure */
+struct flag {
+ EVK_COMMON_QUEUE_ELEMS
+ UINT32 value;/**< Flags value */
+};
+#define EVK_PFLAG(queue) ((struct flag*)queue)
+
+/** @brief 64-bit flag structure */
+struct flag64 {
+ EVK_COMMON_QUEUE_ELEMS
+ UINT64 value;/**< Flags value */
+};
+#define EVK_PFLAG64(queue) ((struct flag64*)queue)
+
+/** @brief Message queue structure */
+struct message_queue {
+ EVK_COMMON_QUEUE_ELEMS
+ UINT8 type;/**< Type */
+ UINT8 length;/**< Queue length */
+ UINT8 num;/**< Number of messages stored */
+ UINT8 readptr;/**< Next read position(0~length-1) */
+ UINT32 max_bytes;/**< -Maximum bytes per message */
+ UINT8 *message;/**< Message storage area (ring buffer) */
+};
+#define EVK_PQUEUE(queue) ((struct message_queue*)queue)
+
+/** @brief Number of bytes to allocate per message
+ *
+ * This function allocates an area to store the number of bytes actually stored, the time of occurrence,
+ * and the senderInfo, in addition to the number of bytes specified by max_bytes.
+ */
+#define EVK_message_block_size(max_bytes) (sizeof(UINT32) * 3 + (max_bytes))
+
+#define HASH_KEY 15
+
+/** @brief Maximum number of flags used by all systems */
+#define EVK_MAX_FLAGS 48
+/** @brief Maximum number of 64-bit flags used by all systems */
+#define EVK_MAX_FLAG64S 4
+/** @brief Maximum number of message event queues used by all systems */
+/* M1SP BM3547 MESSAGE_QUEUES 128->144 */
+/* M9AT BM2066 MESSAGE_QUEUES 144->218 */
+#define EVK_MAX_MESSAGE_QUEUES 224
+
+/** @brief Allocate flag structure statically */
+static struct flag _flag_pool[EVK_MAX_FLAGS];
+/** @brief Statically allocates a 64-bit flag structure */
+static struct flag64 _flag64_pool[EVK_MAX_FLAG64S];
+/** @brief Beginning of the list of unused flags */
+static LIST_HEAD(flag_pool);
+/** @brief Beginning of the list of unused 64-bit flags */
+static LIST_HEAD(flag64_pool);
+
+/** @brief Allocate message queue structure statically */
+static struct message_queue _message_queue_pool[EVK_MAX_MESSAGE_QUEUES];
+/** @brief Top of the list of unused message queues */
+static LIST_HEAD(message_queue_pool);
+
+/** @brief List of Flags/Message Queues in Use
+ *
+ * Connects the usage flag/message queue to a list for each hash value obtained from the ID.
+ * The hash value is the remainder of the ID divided by HASH_KEY.
+ */
+static struct list_head queue_entry[HASH_KEY];
+
+/** @brief Sequence number to use during automatic ID assignment */
+static EV_ID sequence_id = 0;
+
+/** @brief Number to be assigned in order of occurrence of the event */
+static UINT32 sequence_number = 0;
+
+unsigned int
+evk_get_queue_entry(struct list_head **entries)
+{
+ if (entries) {
+ *entries = queue_entry;
+ return HASH_KEY;
+ }
+ return 0;
+}
+
+static __inline__ int
+calc_hash(UINT32 val)
+{
+ return val % HASH_KEY;
+}
+
+static __inline__
+struct flag *
+alloc_flag(void)
+{
+ struct flag *queue;
+ //EVK_assert(!list_empty(&flag_pool), "flag pool empty");
+ if (list_empty(&flag_pool)) {
+ printk("%s ERROR: flag pool empty\n", __func__);
+ return NULL;
+ }
+ queue = (struct flag *)flag_pool.next;
+ list_del_init(&(queue->list));
+ return queue;
+}
+
+static __inline__
+struct flag64 *
+alloc_flag64(void)
+{
+ struct flag64 *queue;
+ //EVK_assert(!list_empty(&flag64_pool), "flag64 pool empty");
+ if (list_empty(&flag64_pool)) {
+ printk("%s ERROR: flag64 pool empty\n", __func__);
+ return NULL;
+ }
+ queue = (struct flag64 *)flag64_pool.next;
+ list_del_init(&(queue->list));
+ return queue;
+}
+
+static __inline__ void
+free_flag(struct flag *queue)
+{
+ list_add((struct list_head *)queue, &flag_pool);
+}
+
+static __inline__ void
+free_flag64(struct flag64 *queue)
+{
+ list_add((struct list_head *)queue, &flag64_pool);
+}
+
+static __inline__
+struct message_queue *
+alloc_message_queue(void)
+{
+ struct message_queue *queue;
+ //EVK_assert(!list_empty(&message_queue_pool), "message queue pool empty");
+ if (list_empty(&message_queue_pool)) {
+ printk("%s ERROR: message queue pool empty\n", __func__);
+ return NULL;
+ }
+ queue = (struct message_queue *)message_queue_pool.next;
+ list_del_init(&(queue->list));
+ queue->message = NULL;
+ return queue;
+}
+
+static __inline__ void
+free_message_queue(struct message_queue *queue)
+{
+ if (queue->message != NULL) {
+ evk_free(queue->message);
+ queue->message = NULL;
+ }
+ list_add((struct list_head *)queue, &message_queue_pool);
+}
+
+static __inline__
+struct common_queue *
+find_queue_entry(EV_ID queueID)
+{
+ struct list_head *list;
+ struct common_queue *queue;
+ int hash = calc_hash(queueID);
+ list = &(queue_entry[hash]);
+ list_for_each_entry(queue, list, list) { /* pgr0060 */ /* pgr0039 */
+ if (queue->queueID == queueID) {
+ return queue;
+ }
+ }
+ return NULL;
+}
+
+static __inline__ void
+attach_queue_entry(struct common_queue *queue, EV_ID queueID)
+{
+ int hash = calc_hash(queueID);
+ list_add_tail((struct list_head *)queue, &(queue_entry[hash]));
+}
+
+static __inline__ void
+detach_queue_entry(struct common_queue *queue)
+{
+ list_del_init((struct list_head *)queue);
+}
+
+static __inline__ void
+init_common_queue(struct common_queue *queue, EV_ID queueID)
+{
+ queue->queueID = queueID;
+ queue->pid = current->pid;
+ queue->read_pid = 0;
+ init_waitqueue_head(&(queue->wq_head));
+}
+
+static __inline__ void
+evk_init_flag(struct flag *queue, EV_ID queueID)
+{
+ init_common_queue((struct common_queue *)queue, queueID);
+ queue->value = 0;
+}
+
+static __inline__ void
+evk_init_flag64(struct flag64 *queue, EV_ID queueID)
+{
+ init_common_queue((struct common_queue *)queue, queueID);
+ queue->value = 0;
+}
+
+static __inline__ int
+evk_init_message_queue(struct message_queue *queue, EV_ID queueID,
+ UINT8 length, UINT32 max_bytes, UINT8 type)
+{
+ init_common_queue((struct common_queue *)queue, queueID);
+ queue->type = type;
+ queue->length = length;
+ queue->max_bytes = max_bytes;
+ queue->num = 0;
+ queue->readptr = 0;
+ EVK_assert(queue->message == NULL, "message buffer was not freed");
+ queue->message = evk_malloc(length * EVK_message_block_size(max_bytes));
+ EVK_assert(queue->message != NULL, "can't alloc message buffer");
+ return 0;
+}
+
+static void
+__list_queues(void)
+{
+ struct list_head *list;
+ struct common_queue *queue;
+ int i;
+ for(i = 0 ; i < HASH_KEY ; i++) {
+ list = &(queue_entry[i]);
+ if (!list_empty(list)) {
+ printk(KERN_ALERT "%d->", i);
+ list_for_each_entry(queue, list, list) { /* pgr0060 */ /* pgr0039 */
+ printk("%x[%x] ", queue->queueID, queue->seq_num);
+ }
+ printk("\n");
+ }
+ }
+}
+
+static int
+evk_destroy_queue(EV_ID queueID)
+{
+ struct common_queue *queue;
+ int err = 0;
+ EVK_info1("flag destroy %x\n", queueID);
+
+ EVK_mutex_lock(); /*************************************/
+ queue = find_queue_entry(queueID);
+ if (queue == NULL) {
+ err = -ENOENT;
+ goto finish;
+ }
+
+ detach_queue_entry(queue);
+
+ /* wake up processes before destruction */
+ wake_up_interruptible(&(queue->wq_head));
+
+ init_common_queue(queue, EV_INVALID_ID);
+
+ if (EV_ID_IS_FLAG(queueID)) {
+ free_flag((struct flag *)queue);
+ } else if (EV_ID_IS_FLAG64(queueID)) {
+ free_flag64((struct flag64 *)queue);
+ } else if (EV_ID_IS_QUEUE(queueID)) {
+ free_message_queue((struct message_queue *)queue);
+ }
+ //__list_queues();
+ finish:
+ EVK_mutex_unlock(); /*************************************/
+ return err;
+}
+
+static int
+evk_open(struct inode *inode, struct file *file)
+{
+ // Recording of current and measures not to be read or deleted from others are required. */
+ file->private_data = (void *)EV_INVALID_ID;
+ return 0;
+}
+
+static int
+evk_close(struct inode *inode, struct file *file)
+{
+ if (EV_ID_IS_VALID((EV_ID)file->private_data)) {
+ evk_destroy_queue((EV_ID)file->private_data);
+ }
+ file->private_data = (void *)EV_INVALID_ID;
+ return 0;
+}
+
+static int
+evk_create_flag(EV_ID queueID)
+{
+ struct flag *queue;
+ int err = 0;
+ EVK_info1("flag create %x\n", queueID);
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct flag *)find_queue_entry(queueID);
+ if (queue != NULL) {
+ err = -EEXIST;
+ goto finish;
+ }
+
+ queue = alloc_flag();
+ if (queue == NULL) {
+ err = -ENOMEM;
+ goto finish;
+ }
+
+ evk_init_flag(queue, queueID);
+ attach_queue_entry((struct common_queue *)queue, queueID);
+
+ //__list_queues();
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+ return err;
+}
+
+static int
+evk_create_flag64(EV_ID queueID)
+{
+ struct flag64 *queue;
+ int err = 0;
+ EVK_info1("flag64 create %x\n", queueID);
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct flag64 *)find_queue_entry(queueID);
+ if (queue != NULL) {
+ err = -EEXIST;
+ goto finish;
+ }
+
+ queue = alloc_flag64();
+ if (queue == NULL) {
+ err = -ENOMEM;
+ goto finish;
+ }
+
+ evk_init_flag64(queue, queueID);
+ attach_queue_entry((struct common_queue *)queue, queueID);
+
+ //__list_queues();
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+ return err;
+}
+
+static int
+evk_create_message_queue(EV_ID queueID, UINT8 length,
+ UINT32 max_bytes, EV_Message_Queue_Type type)
+{
+ struct message_queue *queue;
+ int err;
+ EVK_info1("message create %x\n", queueID);
+
+ err = 0;
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct message_queue *)find_queue_entry(queueID);
+ if (queue != NULL) {
+ err = -EEXIST;
+ goto finish;
+ }
+
+ queue = alloc_message_queue();
+ if (queue == NULL) {
+ err = -ENOMEM;
+ goto finish;
+ }
+
+ err = evk_init_message_queue(queue, queueID, length, max_bytes, type);
+ if (err == 0) {
+ attach_queue_entry((struct common_queue *)queue, queueID);
+ } else {
+ free_message_queue(queue);
+ }
+
+ //__list_queues();
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+ return err;
+}
+
+static EV_ID
+get_seq_id(void)
+{
+ EV_ID ret;
+ sequence_id++;
+ if ((sequence_id & EV_RESERVED_BIT) != 0) {/* round to 1 */
+ sequence_id = 1;
+ EVK_info0("auto ID rounded\n");
+ }
+ ret = sequence_id;
+ return ret;
+}
+
+static int
+evk_alloc_flagID(EV_ID *queueID)
+{
+ EV_ID seq_id;
+
+ EVK_mutex_lock(); /*************************************/
+ do {
+ seq_id = get_seq_id();
+ seq_id |= (EV_ID_BIT | EV_FLAG_BIT | EV_AUTO_ID_BIT);
+ } while(find_queue_entry(seq_id) != NULL);
+ EVK_mutex_unlock(); /*************************************/
+
+ *queueID = seq_id;
+ return 0;
+}
+
+static int
+evk_alloc_flag64ID(EV_ID *queueID)
+{
+ EV_ID seq_id;
+
+ EVK_mutex_lock(); /*************************************/
+ do {
+ seq_id = get_seq_id();
+ seq_id |= (EV_ID_BIT | EV_FLAG64_BIT | EV_AUTO_ID_BIT);
+ } while(find_queue_entry(seq_id) != NULL);
+ EVK_mutex_unlock(); /*************************************/
+
+ *queueID = seq_id;
+ return 0;
+}
+
+static int
+evk_alloc_queueID(EV_ID *queueID)
+{
+ EV_ID seq_id;
+
+ EVK_mutex_lock(); /*************************************/
+ do {
+ seq_id = get_seq_id();
+ seq_id |= (EV_ID_BIT | EV_QUEUE_BIT | EV_AUTO_ID_BIT);
+ } while(find_queue_entry(seq_id) != NULL);
+ EVK_mutex_unlock(); /*************************************/
+
+ *queueID = seq_id;
+ return 0;
+}
+
+static int
+evk_store_flag(EV_Flag *ev, int mem)
+{
+ struct flag *queue;
+ int ret = 0;
+ EV_ID flagID;
+ UINT32 bits;
+
+ if (GET_USER_OR_KERNEL(flagID, ev->flagID)) /* pgr0039 */
+ return -EFAULT;
+ if (GET_USER_OR_KERNEL(bits, ev->bits)) /* pgr0039 */
+ return -EFAULT;
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct flag *)find_queue_entry(flagID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("set_flag: No such ID %x\n", flagID);
+ ret = -ENOENT;
+ goto finish;
+ }
+
+ if (queue->value == 0) {
+ queue->seq_num = sequence_number++;
+ }
+ queue->value |= bits; /* pgr0000 */
+
+ wake_up_interruptible(&(queue->wq_head));
+
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+ return ret;
+}
+
+static int
+evk_store_flag64(EV_Flag64 *ev, int mem)
+{
+ struct flag64 *queue;
+ int ret = 0;
+ EV_ID flagID;
+ UINT64 bits = 0;
+
+ if (GET_USER_OR_KERNEL(flagID, ev->flagID)) /* pgr0039 */
+ return -EFAULT;
+ //GET_USER_OR_KERNEL(bits, ev->bits); /* pgr0039 */
+ if (mem == evk_mem_user) {
+ if (copy_from_user(&bits, &(ev->bits), sizeof(bits)))
+ return -EFAULT;
+ } else {
+ bits = ev->bits;
+ }
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct flag64 *)find_queue_entry(flagID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("set_flag64: No such ID %x\n", flagID);
+ ret = -ENOENT;
+ goto finish;
+ }
+
+ if (queue->value == 0) {
+ queue->seq_num = sequence_number++;
+ }
+ queue->value |= bits; /* pgr0000 */
+
+ wake_up_interruptible(&(queue->wq_head));
+
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+ return ret;
+}
+
+static int
+evk_store_message(EV_Message *ev, int mem)
+{
+ struct message_queue *queue;
+ UINT8 *ptr;
+ UINT8 writeptr;
+ int ret = 0;
+ EV_ID queueID;
+ UINT32 length, senderInfo, seq;
+
+ if (GET_USER_OR_KERNEL(queueID, ev->queueID)) /* pgr0039 */
+ return -EFAULT;
+ if (GET_USER_OR_KERNEL(length, ev->length)) /* pgr0039 */
+ return -EFAULT;
+ if (GET_USER_OR_KERNEL(senderInfo, ev->senderInfo)) /* pgr0039 */
+ return -EFAULT;
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = (struct message_queue *)find_queue_entry(queueID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("store_message: No such queueID %x\n", queueID);
+ ret = -ENOENT;
+ goto finish;
+ }
+
+ if (length > queue->max_bytes) { /* pgr0000 */
+ EVK_info0("store_message: message is too long for the queue");
+ ret = -EINVAL;
+ goto finish;
+ }
+
+ if (queue->num == queue->length) {
+
+ switch(queue->type) {
+ case EV_MESSAGE_QUEUE_TYPE_BUSY:
+ EVK_info1("store_message: queue %x BUSY\n", queueID);
+ ret = -EBUSY;
+ goto finish;
+ break;
+
+ case EV_MESSAGE_QUEUE_TYPE_FIFO:
+ queue->readptr++;
+ queue->readptr %= queue->length;
+ queue->num--;
+ break;
+
+ case EV_MESSAGE_QUEUE_TYPE_REPLACE:
+ queue->num--;
+ break;
+
+ default:
+ EVK_BUG("internal error in store_message\n");
+ ret = -EINVAL;
+ goto finish;
+ break;
+ }
+ }
+
+ writeptr = (queue->readptr + queue->num) % queue->length;
+ ptr = queue->message + writeptr * EVK_message_block_size(queue->max_bytes);
+
+ memcpy(ptr, &length, sizeof(length));
+ ptr += sizeof(length);
+ memcpy(ptr, &senderInfo, sizeof(senderInfo));
+ ptr += sizeof(senderInfo);
+ seq = sequence_number++;
+ memcpy(ptr, &seq, sizeof(seq));
+ ptr += sizeof(seq);
+
+ if (queue->num == 0) {
+ queue->seq_num = seq;
+ }
+ queue->num++;
+
+ if (mem == evk_mem_user) {
+ if (copy_from_user(ptr, ev->message, length)) {
+ ret = -EFAULT;
+ goto finish;
+ }
+ } else {
+ memcpy(ptr, ev->message, length);
+ }
+
+ wake_up_interruptible(&(queue->wq_head));
+
+ finish:
+ EVK_mutex_unlock(); /***********************************/
+
+ return ret;
+}
+
+static int
+evk_set_poll(struct file *filp, EV_ID queueID)
+{
+ struct common_queue *queue;
+ int err = 0;
+
+ EVK_mutex_lock(); /*************************************/
+
+ queue = find_queue_entry(queueID);
+ if (queue == NULL) {
+ EVK_info1("set_poll: ID %x not found.\n", queueID);
+ err = -ENOENT;
+ goto finish;
+ }
+
+ filp->private_data = (void *)queueID;
+
+ finish:
+ EVK_mutex_unlock(); /*************************************/
+ return err;
+}
+
+static int
+evk_get_flag_event(EV_Event *ev, int peek_only, int wait, int mem)
+{
+ struct flag *queue, *queue2;
+ int err = 0;
+ int found = 0;
+ EV_ID flagID;
+
+ if (GET_USER_OR_KERNEL(flagID, ev->u.flag.flagID)) /* pgr0039 */
+ return -EFAULT;
+
+ retry:
+
+ queue = (struct flag *)find_queue_entry(flagID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("get_flag: No such flag %x\n", flagID);
+ err = -ENOENT;
+ goto finish;
+ }
+
+ if (queue->value != 0) {
+ UINT32 bits;
+
+ if (GET_USER_OR_KERNEL(bits, ev->u.flag.bits)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+
+ if (bits == 0 || ((bits & queue->value) != 0)) { /* pgr0000 */
+
+ if (PUT_USER_OR_KERNEL(EV_EVENT_Flag, ev->type)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (PUT_USER_OR_KERNEL(queue->value, ev->u.flag.bits)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ found = 1;
+
+ queue->read_pid = current->pid;
+ if (peek_only) {
+ ;
+ } else {
+ queue->value = 0;
+ }
+ }
+ }
+ finish:
+
+ if (queue != NULL && wait != 0 && found == 0) {
+ int wait_ret;
+ EVK_mutex_unlock(); /*************************************/
+
+ wait_ret
+ = wait_event_interruptible(queue->wq_head,
+ ((queue2 = (struct flag *)find_queue_entry(flagID)) == NULL
+ || queue2->value != 0));
+
+ EVK_mutex_lock(); /*************************************/
+
+ if (wait_ret != 0) {
+ EVK_info1("Interrupted while waiting for flag %x\n", flagID);
+ err = -EINTR;
+ } else if (queue2 == NULL) { /* pgr0039 */
+ EVK_info1("flag %x was destroyed while waiting for it\n", flagID);
+ err = -ENOENT;
+ } else {
+ goto retry;
+ }
+ }
+ return err;
+}
+
+static int
+evk_get_flag64_event(EV_Event *ev, int peek_only, int wait, int mem)
+{
+ struct flag64 *queue, *queue2;
+ int err = 0;
+ int found = 0;
+ EV_ID flagID;
+
+ if (GET_USER_OR_KERNEL(flagID, ev->u.flag64.flagID)) /* pgr0039 */
+ return -EFAULT;
+
+ retry:
+
+ queue = (struct flag64 *)find_queue_entry(flagID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("get_flag64: No such flag %x\n", flagID);
+ err = -ENOENT;
+ goto finish;
+ }
+
+ if (queue->value != 0) {
+ UINT64 bits = 0;
+
+ //GET_USER_OR_KERNEL(bits, ev->u.flag64.bits); /* pgr0039 */
+ if (mem == evk_mem_user) {
+ if (copy_from_user(&bits, &(ev->u.flag64.bits), sizeof(bits))) {
+ err = -EFAULT;
+ goto finish;
+ }
+ } else {
+ bits = ev->u.flag64.bits;
+ }
+
+ if (bits == 0 || ((bits & queue->value) != 0)) { /* pgr0000 */
+
+ if (PUT_USER_OR_KERNEL(EV_EVENT_Flag64, ev->type)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (PUT_USER_OR_KERNEL(queue->value, ev->u.flag64.bits)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ found = 1;
+
+ queue->read_pid = current->pid;
+ if (peek_only) {
+ ;
+ } else {
+ queue->value = 0;
+ }
+ }
+ }
+ finish:
+
+ if (queue != NULL && wait != 0 && found == 0) {
+ int wait_ret;
+ EVK_mutex_unlock(); /*************************************/
+
+ wait_ret
+ = wait_event_interruptible(queue->wq_head,
+ ((queue2 = (struct flag64 *)find_queue_entry(flagID)) == NULL
+ || queue2->value != 0));
+
+ EVK_mutex_lock(); /*************************************/
+
+ if (wait_ret != 0) {
+ EVK_info1("Interrupted while waiting for flag %x\n", flagID);
+ err = -EINTR;
+ } else if (queue2 == NULL) { /* pgr0039 */
+ EVK_info1("flag %x was destroyed while waiting for it\n", flagID);
+ err = -ENOENT;
+ } else {
+ goto retry;
+ }
+ }
+ return err;
+}
+
+static __inline__ void
+remove_message_event(struct message_queue *queue, UINT8 removeptr)
+{
+ UINT8 *ptr;
+ int i, from, to;
+ UINT8 *pFrom, *pTo;
+ UINT32 size;
+ int offset;
+
+ queue->num--;
+ offset = (int)removeptr - (int)(queue->readptr);
+
+ if (offset == 0) {/* To remove the head of the queue, advance the queue by one readptr only */
+ queue->readptr++;
+ queue->readptr %= queue->length;
+
+ if (queue->num > 0) {
+ /* Reset the occurrence time of the first message in the queue to the occurrence time of the queue. */
+ ptr = (queue->message
+ + queue->readptr * EVK_message_block_size(queue->max_bytes));
+ ptr += sizeof(UINT32) * 2;
+ memcpy(&(queue->seq_num), ptr, sizeof(UINT32));
+ }
+ return;
+ }
+ if (offset < 0) {
+ offset += queue->length;
+ }
+ if (offset == queue->num) {/* Do nothing to delete the end of the queue */
+ return;
+ }
+
+ /* To delete a message in the middle of the queue, pack the following messages. */
+ to = removeptr;
+ size = EVK_message_block_size(queue->max_bytes);
+
+ for(i = 0 ; i < queue->num - offset ; i++, to++) {
+ to %= queue->length;
+ from = (to + 1) % queue->length;
+ pFrom = queue->message + from * size;
+ pTo = queue->message + to * size;
+ memcpy(pTo, pFrom, size);
+ }
+}
+
+static int
+evk_get_message_event(EV_Event *ev, int peek_only, int wait, int mem)
+{
+ struct message_queue *queue, *queue2;
+ int err = 0;
+ EV_ID queueID;
+ UINT8 num;
+ UINT8 readptr;
+ UINT8 i, *ptr;
+ int matched = 0;
+
+ if (GET_USER_OR_KERNEL(queueID, ev->u.message.queueID)) /* pgr0039 */
+ return -EFAULT;
+
+ retry:
+ queue = (struct message_queue *)find_queue_entry(queueID); /* pgr0000 */
+ if (queue == NULL) {
+ EVK_info1("get_message: No such queue %x\n", queueID);
+ err = -ENOENT;
+ goto finish;
+ }
+
+ num = queue->num;
+ readptr = queue->readptr;
+ for(i = 0 ; i < num ; i++, readptr = (readptr + 1) % queue->length) {
+ UINT32 size, senderInfo, seq;
+ UINT32 length, q_senderInfo;
+
+ ptr = (queue->message
+ + readptr * EVK_message_block_size(queue->max_bytes));
+
+ memcpy(&size, ptr, sizeof(size));
+ ptr += sizeof(size);
+ memcpy(&senderInfo, ptr, sizeof(senderInfo));
+ ptr += sizeof(senderInfo);
+ memcpy(&seq, ptr, sizeof(seq));
+ ptr += sizeof(seq);
+
+ if (GET_USER_OR_KERNEL(length, ev->u.message.length)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (GET_USER_OR_KERNEL(q_senderInfo, ev->u.message.senderInfo)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+
+ if (q_senderInfo == 0 && length == 0) { /* pgr0000 */
+ matched = 1;
+ } else if (q_senderInfo != 0 && q_senderInfo == senderInfo) {
+ matched = 1;
+ } else if (length > 0 && size >= length) { /* pgr0000 */
+
+ if (mem == evk_mem_user) {
+ void *compbytes;
+ compbytes = evk_malloc(length);
+ if (compbytes != NULL) {
+ if (copy_from_user(compbytes, &(ev->u.message.message), length)) {
+ err = -EFAULT;
+ evk_free(compbytes);
+ goto finish;
+ }
+ if (memcmp(ptr, compbytes, length) == 0) {
+ matched = 1;
+ }
+ evk_free(compbytes);
+ }
+ } else {
+ if (memcmp(ptr, ev->u.message.message, length) == 0) {
+ matched = 1;
+ }
+ }
+ }
+
+ if (matched) {
+
+ if (PUT_USER_OR_KERNEL(EV_EVENT_Message, ev->type)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (PUT_USER_OR_KERNEL(size, ev->u.message.length)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (PUT_USER_OR_KERNEL(senderInfo, ev->u.message.senderInfo)) { /* pgr0039 */
+ err = -EFAULT;
+ goto finish;
+ }
+ if (mem == evk_mem_user) {
+ if (copy_to_user(ev->u.message.message, ptr, size)) {
+ err = -EFAULT;
+ goto finish;
+ }
+ } else {
+ memcpy(ev->u.message.message, ptr, size);
+ }
+
+ queue->read_pid = current->pid;
+ if (peek_only) {
+ ;
+ } else {
+ remove_message_event(queue, readptr);
+ }
+ goto finish;
+ }
+ }
+
+ finish:
+
+ if (queue != NULL && wait != 0 && matched == 0) {
+ int wait_ret;
+ EVK_mutex_unlock(); /*************************************/
+ wait_ret
+ = wait_event_interruptible(queue->wq_head,
+ ((queue2 = (struct message_queue *)find_queue_entry(queueID))==NULL
+ || queue2->num > 0));
+
+ EVK_mutex_lock(); /*************************************/
+
+ if (wait_ret != 0) {
+ EVK_info1("Interrupted while waiting for queue %x\n", queueID);
+ err = -EINTR;
+ } else if (queue2 == NULL) { /* pgr0039 */
+ EVK_info1("queue %x was destroyed while waiting for it\n", queueID);
+ err = -ENOENT;
+ } else {
+ goto retry;
+ }
+ }
+
+ return err;
+}
+
+static int
+evk_get_event(EV_Event *ev, int peek_only, int wait, int mem)
+{
+ EV_Type type;
+ int ret = -EINVAL;
+
+ if (GET_USER_OR_KERNEL(type, ev->type)) /* pgr0039 */
+ return -EFAULT;
+ if (PUT_USER_OR_KERNEL(EV_EVENT_None, ev->type)) /* pgr0039 */
+ return -EFAULT;
+
+ switch(type) { /* pgr0000 */
+ case EV_EVENT_Flag:
+ EVK_mutex_lock(); /*************************************/
+ ret = evk_get_flag_event(ev, peek_only, wait, mem);
+ EVK_mutex_unlock(); /*************************************/
+ break;
+
+ case EV_EVENT_Flag64:
+ EVK_mutex_lock(); /*************************************/
+ ret = evk_get_flag64_event(ev, peek_only, wait, mem);
+ EVK_mutex_unlock(); /*************************************/
+ break;
+
+ case EV_EVENT_Message:
+ EVK_mutex_lock(); /*************************************/
+ ret = evk_get_message_event(ev, peek_only, wait, mem);
+ EVK_mutex_unlock(); /*************************************/
+ break;
+
+ default:
+ break;
+ }
+ return ret;
+}
+
+static int
+evk_get_next_event(EVK_Next_Event_Query *query /* user */, int peek_only)
+{
+ EV_ID *ids;
+ int i, num, ret, first, found;
+ struct common_queue *queue;
+ UINT32 seq_oldest = 0;
+
+ ids = (EV_ID *)kmalloc( (sizeof(EV_ID)*EV_MAX_IDS_IN_PROCESS), GFP_KERNEL );
+ if( ids == NULL ){
+ return -ENOMEM;
+ }
+
+ if (__get_user(num, &(query->num))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish0;
+ }
+ if (copy_from_user(&ids[0], query->ids, num * sizeof(EV_ID))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish0;
+ }
+ if (__put_user(EV_EVENT_None, &(query->ev.type))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish0;
+ }
+
+ ret = 0;
+ first = 1;
+ found = -1;
+
+ EVK_mutex_lock(); /*************************************/
+
+ for(i = 0 ; i < num /* pgr0039 */ ; i++) {
+ queue = find_queue_entry(ids[i]);
+ if (queue != NULL) {/* Have the specified queue ID */
+ if ((EV_ID_IS_FLAG(ids[i])
+ && ((struct flag *)queue)->value != 0)
+ || (EV_ID_IS_FLAG64(ids[i])
+ && ((struct flag64 *)queue)->value != 0)
+ || (EV_ID_IS_QUEUE(ids[i])
+ && ((struct message_queue *)queue)->num > 0)) {/*There are events.*/
+ /* Compare with time_before macros for round 0 */
+ if (first || time_before((unsigned long)queue->seq_num, /* pgr0006 */ /* pgr0039 */
+ (unsigned long)seq_oldest)) {
+ first = 0;
+ seq_oldest = queue->seq_num;
+ found = i;
+ }
+ }
+ }
+ }
+
+ if (found >= 0) {
+ if (EV_ID_IS_FLAG(ids[found])) {
+ if (__put_user(ids[found], &(query->ev.u.flag.flagID))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish1;
+ }
+ ret = evk_get_flag_event(&(query->ev), peek_only, 0, evk_mem_user);
+ } else if (EV_ID_IS_FLAG64(ids[found])) {
+ if (__put_user(ids[found], &(query->ev.u.flag64.flagID))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish1;
+ }
+ ret = evk_get_flag64_event(&(query->ev), peek_only, 0, evk_mem_user);
+ } else if (EV_ID_IS_QUEUE(ids[found])) {
+ if (__put_user(ids[found], &(query->ev.u.message.queueID))) { /* pgr0039 */
+ ret = -EFAULT;
+ goto finish1;
+ }
+ ret = evk_get_message_event(&(query->ev), peek_only, 0, evk_mem_user);
+ }
+ }
+
+ finish1:
+ EVK_mutex_unlock(); /*************************************/
+ finish0:
+ kfree(ids);
+ return ret;
+}
+
+static long
+evk_ioctl(struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ EVK_Message_Queue_Request mesq;
+ int peek_only, wait;
+ EV_ID queueID;
+ int ret = -EINVAL;
+
+ //lock_kernel();
+
+ switch(cmd) {
+ case EVK_IOC_CREATE_FLAG:
+ queueID = (EV_ID)arg;
+ ret = evk_create_flag(queueID);
+ break;
+
+ case EVK_IOC_CREATE_FLAG64:
+ queueID = (EV_ID)arg;
+ ret = evk_create_flag64(queueID);
+ break;
+
+ case EVK_IOC_CREATE_MESSAGE_QUEUE:
+ if (access_ok(VERIFY_READ, arg, sizeof(mesq))) { /* pgr0039 */
+ if (copy_from_user(&mesq, (EV_Flag *)arg, sizeof(mesq))) {
+ ret = -EFAULT;
+ break;
+ }
+
+ ret = evk_create_message_queue(mesq.queueID, mesq.length,
+ mesq.max_bytes, mesq.type);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_ALLOC_FLAG_ID:
+ if (access_ok(VERIFY_WRITE, arg, sizeof(queueID))) { /* pgr0039 */
+ evk_alloc_flagID(&queueID);
+ if (put_user(queueID, (EV_ID *)arg)) { /* pgr0039 */
+ ret = -EFAULT;
+ break;
+ }
+ ret = 0;
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_ALLOC_FLAG64_ID:
+ if (access_ok(VERIFY_WRITE, arg, sizeof(queueID))) { /* pgr0039 */
+ evk_alloc_flag64ID(&queueID);
+ if (put_user(queueID, (EV_ID *)arg)) { /* pgr0039 */
+ ret = -EFAULT;
+ break;
+ }
+ ret = 0;
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_ALLOC_QUEUE_ID:
+ if (access_ok(VERIFY_WRITE, arg, sizeof(queueID))) { /* pgr0039 */
+ evk_alloc_queueID(&queueID);
+ if (put_user(queueID, (EV_ID *)arg)) { /* pgr0039 */
+ ret = -EFAULT;
+ break;
+ }
+ ret = 0;
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_DESTROY_QUEUE:
+ queueID = (EV_ID)arg;
+ ret = evk_destroy_queue(queueID);
+ break;
+
+ case EVK_IOC_STORE_FLAG:
+ if (access_ok(VERIFY_READ, arg, sizeof(EV_Flag))) { /* pgr0039 */
+ ret = evk_store_flag((EV_Flag *)arg, evk_mem_user);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_STORE_FLAG64:
+ if (access_ok(VERIFY_READ, arg, sizeof(EV_Flag64))) { /* pgr0039 */
+ ret = evk_store_flag64((EV_Flag64 *)arg, evk_mem_user);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_STORE_MESSAGE:
+ if (access_ok(VERIFY_READ, arg, sizeof(EV_Message))) { /* pgr0039 */
+ ret = evk_store_message((EV_Message *)arg, evk_mem_user);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_SET_POLL:
+ queueID = (EV_ID)arg;
+ ret = evk_set_poll(filp, queueID);
+ break;
+
+ case EVK_IOC_PEEK_EVENT:
+ peek_only = 1;
+ wait = 0;
+ goto get_event;
+ break;
+
+ case EVK_IOC_WAIT_EVENT:
+ peek_only = 0;
+ wait = 1;
+ goto get_event;
+ break;
+
+ case EVK_IOC_GET_EVENT:
+ peek_only = 0;
+ wait = 0;
+ get_event:
+ if (access_ok(VERIFY_WRITE, arg, sizeof(EV_Event))) { /* pgr0039 */
+ ret = evk_get_event((EV_Event *)arg, peek_only, wait, evk_mem_user);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_PEEK_NEXT_EVENT:
+ peek_only = 1;
+ goto get_next;
+ break;
+
+ case EVK_IOC_GET_NEXT_EVENT:
+ peek_only = 0;
+ get_next:
+ if (access_ok(VERIFY_WRITE, arg, sizeof(EVK_Next_Event_Query))) { /* pgr0039 */
+ ret = evk_get_next_event((EVK_Next_Event_Query *)arg, peek_only);
+ } else {
+ ret = -EFAULT;
+ }
+ break;
+
+ case EVK_IOC_DEBUG_LIST:
+ __list_queues();
+ //__list_message();
+ ret = 0;
+ break;
+
+ default:
+ ret = -EINVAL;
+ break;
+ }
+
+ //unlock_kernel();
+ return ret;
+}
+
+static unsigned int
+evk_poll(struct file *filp, poll_table *wait)
+{
+ unsigned int ret = 0;
+ struct common_queue *queue;
+
+ EV_ID queueID = (EV_ID)(filp->private_data);
+ // Returns errors without stopping at assert if queueID is invalid
+ // (Troubleshooting for Continuous Printing)
+ if (!EV_ID_IS_VALID(queueID)) {
+ printk("evk_poll ERROR: invalid queueID=%x\n", queueID);
+ return POLLERR|POLLHUP;
+ }
+ //EVK_assert(EV_ID_IS_VALID(queueID), "poll: flag/queueID not set");
+
+ EVK_mutex_lock();/*****************************************/
+
+ queue = find_queue_entry(queueID);
+ if (queue == NULL) {
+ EVK_info1("poll: No such flag/queueID %x\n", queueID);
+ ret = POLLERR|POLLHUP;
+ goto finish;
+ }
+
+ poll_wait(filp, &(queue->wq_head), wait);
+
+ if (EV_ID_IS_FLAG(queueID)) {
+ if (((struct flag *)queue)->value != 0) {
+ ret = POLLIN;
+ }
+ } else if (EV_ID_IS_FLAG64(queueID)) {
+ if (((struct flag64 *)queue)->value != 0) {
+ ret = POLLIN;
+ }
+ } else {
+ if (((struct message_queue *)queue)->num > 0) {
+ ret = POLLIN;
+ }
+ }
+
+ finish:
+ EVK_mutex_unlock(); /***************************************/
+
+ return ret;
+}
+
+/** List of system call corresponding function registrations */
+static struct file_operations evk_fops = {
+ .open = evk_open,
+ .release = evk_close,
+ .unlocked_ioctl = evk_ioctl,
+ .poll = evk_poll,
+};
+
+#ifdef ENABLE_PROC_FS
+static int
+evk_procFS_show(struct seq_file *m, int mode)
+{
+ int i, num;
+ struct list_head *list, *entries;
+ struct common_queue *queue;
+
+ seq_printf(m, "[ev library status ");
+
+ switch(mode) {
+ case evk_enum_flag:
+ seq_printf(m, "(flag)]\n");
+ seq_printf(m, "PID moduleID flagID[hash] value\n");
+ break;
+ case evk_enum_flag64:
+ seq_printf(m, "(flag64)]\n");
+ seq_printf(m, "PID moduleID flagID[hash] value\n");
+ break;
+ case evk_enum_queue:
+ seq_printf(m, "(queue)]\n");
+ seq_printf(m, "PID moduleID queueID[hash] maxbytes remain type\n");
+ break;
+ }
+
+ EVK_mutex_lock();
+
+ num = evk_get_queue_entry(&entries);
+
+ for (i = 0 ; i < num ; i++) {
+ list = &(entries[i]);
+ if (!list_empty(list)) {
+ list_for_each_entry(queue, list, list) {
+ if ((mode == evk_enum_flag && (!EV_ID_IS_FLAG(queue->queueID)))
+ || (mode == evk_enum_flag64 && (!EV_ID_IS_FLAG64(queue->queueID)))
+ || (mode == evk_enum_queue && (!EV_ID_IS_QUEUE(queue->queueID))))
+ {
+ continue;
+ }
+
+ seq_printf(m, "%08d ", queue->pid);
+ seq_printf(m, "%05d(%04x) ", ((queue->queueID & 0x00ffff00) >> 8), ((queue->queueID & 0x00ffff00) >> 8));
+ seq_printf(m, "0x%08x[%2d] ", queue->queueID, calc_hash(queue->queueID));
+
+ switch(mode) {
+ case evk_enum_flag:
+ seq_printf(m, "0x%x", EVK_PFLAG(queue)->value);
+ break;
+
+ case evk_enum_flag64:
+ seq_printf(m, "0x%llx", EVK_PFLAG64(queue)->value);
+ break;
+
+ case evk_enum_queue:
+ seq_printf(m, "%04d %02d ", EVK_PQUEUE(queue)->max_bytes, EVK_PQUEUE(queue)->length);
+ seq_printf(m, "%02d ", EVK_PQUEUE(queue)->num);
+ seq_printf(m, "%d ", EVK_PQUEUE(queue)->type);
+ break;
+ }
+ seq_printf(m, "\n");
+ }
+ }
+ }
+
+ EVK_mutex_unlock();
+ return 0;
+}
+
+static int
+evk_procFS_flag_show(struct seq_file *m, void *v)
+{
+ return evk_procFS_show(m, evk_enum_flag);
+}
+
+static int
+evk_procFS_flag64_show(struct seq_file *m, void *v)
+{
+ return evk_procFS_show(m, evk_enum_flag64);
+}
+
+static int
+evk_procFS_queue_show(struct seq_file *m, void *v)
+{
+ return evk_procFS_show(m, evk_enum_queue);
+}
+
+static int
+evk_procFS_flag_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, evk_procFS_flag_show, NULL);
+}
+
+static int
+evk_procFS_flag64_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, evk_procFS_flag64_show, NULL);
+}
+
+static int
+evk_procFS_queue_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, evk_procFS_queue_show, NULL);
+}
+
+static struct file_operations evk_proc_flag_fops = {
+ .owner = THIS_MODULE,
+ .open = evk_procFS_flag_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static struct file_operations evk_proc_flag64_fops = {
+ .owner = THIS_MODULE,
+ .open = evk_procFS_flag64_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static struct file_operations evk_proc_queue_fops = {
+ .owner = THIS_MODULE,
+ .open = evk_procFS_queue_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+#endif /*ENABLE_PROC_FS*/
+
+__init int
+EVK_init(void)
+{
+ int err;
+#ifdef CONFIG_PROC_FS
+#ifdef ENABLE_PROC_FS
+ struct proc_dir_entry *ret;
+#endif /* ENABLE_PROC_FS */
+#endif /* CONFIG_PROC_FS */
+ int i;
+ dev_t dev;
+
+ dev = MKDEV(devmajor, devminor);
+ err = register_chrdev_region(dev, nrdevs, EVK_NAME);
+ if (err) {
+ EVK_info1("register_chrdev_region error %d\n", -err);
+ return -EBUSY;
+ }
+
+ cdev_init(&cdev, &evk_fops);
+ cdev.owner = THIS_MODULE;
+ cdev.ops = &evk_fops;
+
+ err = cdev_add(&cdev, dev, 1);
+ if (err) {
+ EVK_info1("cdev_add error %d\n", -err);
+ return -EBUSY;
+ }
+
+ /* Initialization */
+ for(i = 0 ; i < EVK_MAX_FLAGS ; i++) {
+ list_add_tail((struct list_head *)&(_flag_pool[i]),
+ &flag_pool);
+ }
+ for(i = 0 ; i < EVK_MAX_FLAG64S ; i++) {
+ list_add_tail((struct list_head *)&(_flag64_pool[i]),
+ &flag64_pool);
+ }
+ for(i = 0 ; i < EVK_MAX_MESSAGE_QUEUES ; i++) {
+ list_add_tail((struct list_head *)&(_message_queue_pool[i]),
+ &message_queue_pool);
+ }
+ for(i = 0 ; i < HASH_KEY ; i++) {
+ INIT_LIST_HEAD(&(queue_entry[i]));
+ }
+
+#ifdef CONFIG_PROC_FS
+#ifdef ENABLE_PROC_FS
+ ret = proc_create("driver/ev_flag", 0, NULL, &evk_proc_flag_fops);
+ if( ret == NULL ) {
+ EVK_info1("Unable to initialize /proc entry %d\n", -err);
+ return -EBUSY;
+ }
+
+ ret = proc_create("driver/ev_flag64", 0, NULL, &evk_proc_flag64_fops);
+ if( ret == NULL ) {
+ EVK_info1("Unable to initialize /proc entry %d\n", -err);
+ return -EBUSY;
+ }
+
+ ret = proc_create("driver/ev_queue", 0, NULL, &evk_proc_queue_fops);
+ if( ret == NULL ) {
+ EVK_info1("Unable to initialize /proc entry %d\n", -err);
+ return -EBUSY;
+ }
+#endif /* ENABLE_PROC_FS */
+#endif /* CONFIG_PROC_FS */
+
+ pClass = class_create(THIS_MODULE, EVK_NAME);
+ device_create(pClass, NULL, dev, NULL, "agl/"EVK_NAME);
+
+ return 0;
+}
+
+void
+//#ifndef CONFIG_COMBINE_MODULES
+//__exit
+//#endif
+EVK_exit(void)
+{
+ dev_t dev = MKDEV(devmajor, devminor);
+ device_destroy(pClass, dev);
+ class_destroy(pClass);
+
+ cdev_del(&cdev);
+
+ unregister_chrdev_region(dev, nrdevs);
+
+ remove_proc_entry( "driver/ev_flag", 0 );
+ remove_proc_entry( "driver/ev_flag64", 0 );
+ remove_proc_entry( "driver/ev_queue", 0 );
+}
+
+/** @} */
+/** @addtogroup EV
+ * @{ */
+static EV_ERR
+EVK_create_flag_in(EV_ID flagID)
+{
+ int ret = evk_create_flag(flagID);
+
+ if (ret == -EEXIST) {
+ return EV_ERR_Exist;
+ } else if (ret < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+static EV_ERR
+EVK_create_flag64_in(EV_ID flagID)
+{
+ int ret = evk_create_flag64(flagID);
+
+ if (ret == -EEXIST) {
+ return EV_ERR_Exist;
+ } else if (ret < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+/** @see EV_create_flag */
+EV_ERR
+EVK_create_flag(EV_ID flagID)
+{
+ if (!EV_ID_IS_FLAG(flagID) || EV_ID_IS_AUTO_ID(flagID)) {
+ return EV_ERR_Invalid_ID;
+ }
+ return EVK_create_flag_in(flagID);
+}
+
+/** @see EV_create_flag64 */
+EV_ERR
+EVK_create_flag64(EV_ID flagID)
+{
+ if (!EV_ID_IS_FLAG64(flagID) || EV_ID_IS_AUTO_ID(flagID)) {
+ return EV_ERR_Invalid_ID;
+ }
+ return EVK_create_flag64_in(flagID);
+}
+
+static EV_ERR
+EVK_create_queue_in(EV_ID queueID, UINT8 length, UINT16 max_bytes,
+ EV_Message_Queue_Type type)
+{
+ int ret = evk_create_message_queue(queueID, length, max_bytes, type);
+
+ if (ret == -EEXIST) {
+ return EV_ERR_Exist;
+ } else if (ret < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+/** @see EV_create_queue */
+EV_ERR
+EVK_create_queue(EV_ID queueID, UINT8 length, UINT16 max_bytes,
+ EV_Message_Queue_Type type)
+{
+ if (!EV_ID_IS_QUEUE(queueID) || EV_ID_IS_AUTO_ID(queueID)) {
+ return EV_ERR_Invalid_ID;
+ }
+ return EVK_create_queue_in(queueID, length, max_bytes, type);
+}
+
+/** @see EV_create_flag_auto_id */
+EV_ERR
+EVK_create_flag_auto_id(/* OUT */EV_ID *flagID)
+{
+ EV_ERR err;
+ EVK_assert(flagID != NULL, "NULL pointer was specified");
+
+ if (evk_alloc_flagID(flagID) < 0) {
+ return EV_ERR_Fatal;
+ }
+
+ err = EVK_create_flag_in(*flagID);
+ if (err != EV_OK) {
+ *flagID = EV_NO_ID;
+ }
+ return err;
+}
+
+/** @see EV_create_flag64_auto_id */
+EV_ERR
+EVK_create_flag64_auto_id(/* OUT */EV_ID *flagID)
+{
+ EV_ERR err;
+ EVK_assert(flagID != NULL, "NULL pointer was specified");
+
+ if (evk_alloc_flag64ID(flagID) < 0) {
+ return EV_ERR_Fatal;
+ }
+
+ err = EVK_create_flag64_in(*flagID);
+ if (err != EV_OK) {
+ *flagID = EV_NO_ID;
+ }
+ return err;
+}
+
+/** @see EV_create_queue_auto_id */
+EV_ERR
+EVK_create_queue_auto_id(/* OUT */EV_ID *queueID, UINT8 length,
+ UINT16 max_bytes, EV_Message_Queue_Type type)
+{
+ EV_ERR err;
+ EVK_assert(queueID != NULL, "NULL pointer was specified");
+
+ if (evk_alloc_queueID(queueID) < 0) {
+ return EV_ERR_Fatal;
+ }
+
+ err = EVK_create_queue_in(*queueID, length, max_bytes, type);
+ if (err != EV_OK) {
+ *queueID = EV_NO_ID;
+ }
+ return err;
+}
+
+/** @see EV_destroy_flag */
+EV_ERR
+EVK_destroy_flag(EV_ID flagID)
+{
+ int err;
+ err = evk_destroy_queue(flagID);
+
+ if (err == -ENOENT) {
+ return EV_ERR_Invalid_ID;
+ } else if (err < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+/** @see EV_destroy_queue */
+EV_ERR
+EVK_destroy_queue(EV_ID queueID)
+{
+ return EVK_destroy_flag(queueID);
+}
+
+/* Sending the event */
+/** @see EV_set_flag */
+EV_ERR
+EVK_set_flag(EV_ID flagID, UINT32 bits)
+{
+ EV_Flag flag;
+ int ret;
+
+ if (!EV_ID_IS_FLAG(flagID)) {
+ return EV_ERR_Invalid_ID;
+ }
+ flag.flagID = flagID;
+ flag.bits = bits;
+
+ ret = evk_store_flag(&flag, evk_mem_kernel);
+ if (ret == -ENOENT) {
+ return EV_ERR_Invalid_ID;
+ } else if (ret < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+/** @see EV_set_flag64 */
+EV_ERR
+EVK_set_flag64(EV_ID flagID, UINT64 bits)
+{
+ EV_Flag64 flag;
+ int ret;
+
+ if (!EV_ID_IS_FLAG64(flagID)) {
+ return EV_ERR_Invalid_ID;
+ }
+ flag.flagID = flagID;
+ flag.bits = bits;
+
+ ret = evk_store_flag64(&flag, evk_mem_kernel);
+ if (ret == -ENOENT) {
+ return EV_ERR_Invalid_ID;
+ } else if (ret < 0) {
+ return EV_ERR_Fatal;
+ } else {
+ return EV_OK;
+ }
+}
+
+/** @see EV_send_message */
+EV_ERR
+EVK_send_message(EV_ID queueID, UINT16 bytes, const void *message,
+ UINT32 senderInfo)
+{
+ EV_Message *msg = NULL;
+ EV_ERR ev_ret;
+ int ret;
+
+ msg = evk_malloc( sizeof( EV_Message ) );
+ if( msg == NULL )
+ {
+ ev_ret = EV_ERR_Fatal;
+ goto L_END;
+ }
+
+ if (!EV_ID_IS_QUEUE(queueID)) {
+ ev_ret = EV_ERR_Invalid_ID;
+ goto L_END;
+ }
+ EVK_assert(message != NULL, "NULL pointer was specified");
+ EVK_assert(bytes <= EV_MAX_MESSAGE_LENGTH, "send_message: message too long");
+
+ msg->queueID = queueID;
+ msg->senderInfo = senderInfo;
+ msg->length = bytes;
+ memcpy(msg->message, message, bytes);
+
+ ret = evk_store_message(msg, evk_mem_kernel);
+ if (ret == -ENOENT) {
+ ev_ret = EV_ERR_Invalid_ID;
+ } else if (ret == -EBUSY) {
+ ev_ret = EV_ERR_Busy;
+ } else if (ret < 0) {
+ ev_ret = EV_ERR_Fatal;
+ } else {
+ ev_ret = EV_OK;
+ }
+
+L_END:
+ if( msg != NULL )
+ {
+ evk_free( msg );
+ }
+ return ev_ret;
+}
+
+/* Event acquisition(Order of arrival time) */
+//EV_ERR EV_get_next_event(/* OUT */EV_Event *ev);
+
+static EV_ERR
+EVK_get_flag_in(EV_ID flagID, EV_Flag *flag, int peek_only, int wait)
+{
+ EV_Event *ev = NULL;
+ EV_ERR ev_ret;
+ int ret;
+
+ ev = evk_malloc( sizeof( EV_Event ) );
+ if( ev == NULL )
+ {
+ ev_ret = EV_ERR_Fatal;
+ goto L_END;
+ }
+
+ EVK_assert(flag != NULL, "get_flag: NULL pointer was specified");
+ flag->flagID = EV_NO_ID;
+ flag->bits = 0;
+
+ if (!EV_ID_IS_FLAG(flagID)) {
+ ev_ret = EV_ERR_Invalid_ID;
+ goto L_END;
+ }
+
+ ev->type = EV_EVENT_Flag;
+ ev->u.flag.flagID = flagID;
+ ev->u.flag.bits = 0;
+
+ ret = evk_get_event(ev, peek_only, wait, evk_mem_kernel);
+
+ if (ret < 0) {
+ if (ret == -ENOENT) {
+ ev_ret = EV_ERR_Invalid_ID;
+ } else if (ret == -EINTR) {
+ ev_ret = EV_ERR_Interrupted;
+ } else {
+ ev_ret = EV_ERR_Fatal;
+ }
+ goto L_END;
+ }
+
+ if (ev->type == EV_EVENT_Flag) {
+ flag->flagID = ev->u.flag.flagID;
+ flag->bits = ev->u.flag.bits;
+ }
+ ev_ret = EV_OK;
+
+L_END:
+ if( ev != NULL )
+ {
+ evk_free( ev );
+ }
+ return ev_ret;
+}
+
+static EV_ERR
+EVK_get_flag64_in(EV_ID flagID, EV_Flag64 *flag, int peek_only, int wait)
+{
+ EV_Event *ev = NULL;
+ EV_ERR ev_ret;
+ int ret;
+
+ ev = evk_malloc( sizeof( EV_Event ) );
+ if( ev == NULL )
+ {
+ ev_ret = EV_ERR_Fatal;
+ goto L_END;
+ }
+
+ EVK_assert(flag != NULL, "get_flag64: NULL pointer was specified");
+ flag->flagID = EV_NO_ID;
+ flag->bits = 0;
+
+ if (!EV_ID_IS_FLAG64(flagID)) {
+ ev_ret = EV_ERR_Invalid_ID;
+ goto L_END;
+ }
+
+ ev->type = EV_EVENT_Flag64;
+ ev->u.flag64.flagID = flagID;
+ ev->u.flag64.bits = 0;
+
+ ret = evk_get_event(ev, peek_only, wait, evk_mem_kernel);
+
+ if (ret < 0) {
+ if (ret == -ENOENT) {
+ ev_ret = EV_ERR_Invalid_ID;
+ } else if (ret == -EINTR) {
+ ev_ret = EV_ERR_Interrupted;
+ } else {
+ ev_ret = EV_ERR_Fatal;
+ }
+ goto L_END;
+ }
+
+ if (ev->type == EV_EVENT_Flag64) {
+ flag->flagID = ev->u.flag64.flagID;
+ flag->bits = ev->u.flag64.bits;
+ }
+ ev_ret = EV_OK;
+
+L_END:
+ if( ev != NULL )
+ {
+ evk_free( ev );
+ }
+ return ev_ret;
+}
+
+/* Event acquisition(With Search Criteria) */
+/** @see EV_get_flag */
+EV_ERR
+EVK_get_flag(EV_ID flagID, /* OUT */EV_Flag *flag)
+{
+ return EVK_get_flag_in(flagID, flag, 0, 0);
+}
+
+/** @see EV_get_flag64 */
+EV_ERR
+EVK_get_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag)
+{
+ return EVK_get_flag64_in(flagID, flag, 0, 0);
+}
+
+/** @see EV_wait_flag */
+EV_ERR
+EVK_wait_flag(EV_ID flagID, /* OUT */EV_Flag *flag)/* block */
+{
+ return EVK_get_flag_in(flagID, flag, 0, 1);
+}
+
+/** @see EV_wait_flag64 */
+EV_ERR
+EVK_wait_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag)/* block */
+{
+ return EVK_get_flag64_in(flagID, flag, 0, 1);
+}
+
+/** @see EV_peek_flag */
+EV_ERR
+EVK_peek_flag(EV_ID flagID, /* OUT */EV_Flag *flag)
+{
+ return EVK_get_flag_in(flagID, flag, 1, 0);
+}
+
+/** @see EV_peek_flag64 */
+EV_ERR
+EVK_peek_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag)
+{
+ return EVK_get_flag64_in(flagID, flag, 1, 0);
+}
+
+static EV_ERR
+EVK_get_message_in(EV_ID queueID, EV_Message *message, UINT32 senderInfo,
+ UINT32 length, const void *compare_bytes,
+ int peek_only, int wait)
+{
+ EV_Event *ev = NULL;
+ EV_ERR ev_ret;
+ int ret;
+
+ ev = evk_malloc( sizeof( EV_Event ) );
+ if( ev == NULL )
+ {
+ ev_ret = EV_ERR_Fatal;
+ goto L_END;
+ }
+
+ EVK_assert(message != NULL, "get_message: NULL pointer was specified");
+ if (!EV_ID_IS_QUEUE(queueID)) {
+ ev_ret = EV_ERR_Invalid_ID;
+ goto L_END;
+ }
+ message->queueID = EV_NO_ID;
+ message->senderInfo = 0;
+ message->length = 0;
+
+ ev->type = EV_EVENT_Message;
+ ev->u.message.queueID = queueID;
+ ev->u.message.senderInfo = senderInfo;
+ if (compare_bytes != NULL) {
+ ev->u.message.length = length;
+ memcpy(ev->u.message.message, compare_bytes, length);
+ } else {
+ ev->u.message.length = 0;
+ }
+
+ ret = evk_get_event(ev, peek_only, wait, evk_mem_kernel);
+
+ if (ret < 0) {
+ if (ret == -ENOENT) {
+ ev_ret = EV_ERR_Invalid_ID;
+ } else if (ret == -EINTR) {
+ ev_ret = EV_ERR_Interrupted;
+ } else {
+ ev_ret = EV_ERR_Fatal;
+ }
+ goto L_END;
+ }
+
+ if (ev->type == EV_EVENT_Message) {
+ message->queueID = ev->u.message.queueID;
+ message->senderInfo = ev->u.message.senderInfo;
+ message->length = ev->u.message.length;
+ memcpy(message->message, ev->u.message.message, ev->u.message.length);
+ }
+ ev_ret = EV_OK;
+
+L_END:
+ if( ev != NULL )
+ {
+ evk_free( ev );
+ }
+ return ev_ret;
+}
+
+/** @see EV_get_message */
+EV_ERR
+EVK_get_message(EV_ID queueID, /* OUT */EV_Message *message)
+{
+ return EVK_get_message_in(queueID, message, 0, 0, NULL, 0, 0);
+}
+
+/** @see EV_wait_message */
+EV_ERR
+EVK_wait_message(EV_ID queueID, /* OUT */EV_Message *message)/* block */
+{
+ return EVK_get_message_in(queueID, message, 0, 0, NULL, 0, 1);
+}
+
+/** @see EV_peek_message */
+EV_ERR
+EVK_peek_message(EV_ID queueID, /* OUT */EV_Message *message)
+{
+ return EVK_get_message_in(queueID, message, 0, 0, NULL, 1, 0);
+}
+
+/** @see EV_find_message_by_sender */
+EV_ERR
+EVK_find_message_by_sender(EV_ID queueID, UINT32 senderInfo,
+ /* OUT */EV_Message *message)
+{
+ // Not mounted
+ return EV_ERR_Fatal;
+}
+
+/** @see EV_find_message_by_content */
+EV_ERR
+EVK_find_message_by_content(EV_ID queueID, UINT16 length,
+ const void *compare_bytes,
+ /* OUT */EV_Message *message)
+{
+ // Not mounted
+ return EV_ERR_Fatal;
+}
+/** @} */
+
+EXPORT_SYMBOL(evk_get_queue_entry);
+EXPORT_SYMBOL(EVK_init);
+EXPORT_SYMBOL(EVK_exit);
+
+EXPORT_SYMBOL(EVK_create_flag);
+EXPORT_SYMBOL(EVK_create_flag64);
+EXPORT_SYMBOL(EVK_create_queue);
+EXPORT_SYMBOL(EVK_create_flag_auto_id);
+EXPORT_SYMBOL(EVK_create_flag64_auto_id);
+EXPORT_SYMBOL(EVK_create_queue_auto_id);
+EXPORT_SYMBOL(EVK_destroy_flag);
+EXPORT_SYMBOL(EVK_destroy_queue);
+EXPORT_SYMBOL(EVK_set_flag);
+EXPORT_SYMBOL(EVK_set_flag64);
+EXPORT_SYMBOL(EVK_send_message);
+EXPORT_SYMBOL(EVK_get_flag);
+EXPORT_SYMBOL(EVK_wait_flag);
+EXPORT_SYMBOL(EVK_peek_flag);
+EXPORT_SYMBOL(EVK_get_flag64);
+EXPORT_SYMBOL(EVK_wait_flag64);
+EXPORT_SYMBOL(EVK_peek_flag64);
+EXPORT_SYMBOL(EVK_get_message);
+EXPORT_SYMBOL(EVK_wait_message);
+EXPORT_SYMBOL(EVK_peek_message);
+
+#ifndef CONFIG_COMBINE_MODULES
+//MODULE_LICENSE("proprietary");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("EVent library for Kernel");
+//MODULE_SUPPORTED_DEVICE(name);
+//MODULE_PARM(var,type)
+//MODULE_PARM_DESC(var,desc)
+module_init(EVK_init);
+module_exit(EVK_exit);
+#endif /* !CONFIG_COMBINE_MODULES */
diff --git a/video_in_hal/nsframework/backup_manager/LICENSE b/video_in_hal/nsframework/backup_manager/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/nsframework/backup_manager/Makefile.client b/video_in_hal/nsframework/backup_manager/Makefile.client
new file mode 100755
index 0000000..07bada3
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := config client
+
+include ../native_service.mk
diff --git a/video_in_hal/nsframework/backup_manager/Makefile.server b/video_in_hal/nsframework/backup_manager/Makefile.server
new file mode 100755
index 0000000..62bd0d6
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/Makefile.server
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := server
+
+include ../native_service.mk
diff --git a/video_in_hal/nsframework/backup_manager/client/Makefile b/video_in_hal/nsframework/backup_manager/client/Makefile
new file mode 100755
index 0000000..41d2bf7
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/client/Makefile
@@ -0,0 +1,53 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### libraries to be installed(*.so)#############
+INST_SHLIBS := libns_backup
+
+######### headers to be installed(*.h) #############
+INST_HEADERS := backup_manager.h ns_backup.h
+
+######### sources to be compiled #############
+libns_backup_SRCS := bkup_api.cpp
+
+######### search paths #############
+VPATH += ./src ./include/$(COMPONENT_NAME) ../server/include
+
+######### include paths #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I../server/include
+
+######### frameworkunifiedlog options #############
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### libraries to be linked(dynamic)#############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### other unit specific options #############
+LINK_CXX=Y
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+include ../../native_service.mk
diff --git a/video_in_hal/nsframework/backup_manager/client/include/bkup_api.h b/video_in_hal/nsframework/backup_manager/client/include/bkup_api.h
new file mode 100755
index 0000000..d5b0d2b
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/client/include/bkup_api.h
@@ -0,0 +1,60 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_CLIENT_INCLUDE_BKUP_API_H_
+#define BACKUP_MANAGER_CLIENT_INCLUDE_BKUP_API_H_
+
+#define BACKUP_CID 0xBACC1D00
+
+#define BKUP_MAX_ITEM_NAME 64
+
+/**
+ * media
+ */
+#include <nv_hal.h>
+
+/**
+ * command
+ */
+typedef enum {
+ BKUP_CMD_READ = 0,
+ BKUP_CMD_WRITE,
+ BKUP_CMD_FILL,
+ BKUP_CMD_SIZE,
+ BKUP_CMD_READ_NUM,
+ BKUP_CMD_SIZE_NUM,
+ BKUP_CMD_CHECK,
+ BKUP_CMD_DELETE,
+ BKUP_CMD_COPY_INNER,
+ BKUP_CMD_MAX,
+} bkup_protocol_command_t;
+
+/**
+ * api/process protocol
+ */
+typedef struct {
+ bkup_protocol_command_t command;
+ char item_name[64];
+ uint32_t num_id;
+ uint32_t offset;
+ uint32_t size;
+ char fill_patern;
+ enum NvHalMedia src_media;
+} bkup_protocol_header_t;
+
+#define SERVICE_BACKUP_MANAGER_MSG_HANDLE_THREAD "bkupmanagerthr"
+
+#endif // BACKUP_MANAGER_CLIENT_INCLUDE_BKUP_API_H_
diff --git a/video_in_hal/nsframework/backup_manager/client/include/native_service/backup_manager.h b/video_in_hal/nsframework/backup_manager/client/include/native_service/backup_manager.h
new file mode 100755
index 0000000..636c38c
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/client/include/native_service/backup_manager.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file backup_manager.h
+ * @brief backup_manager unit common header file.
+ */
+
+#ifndef NATIVESERVICE_BACKUPMANAGER_H_ // NOLINT(build/header_guard)
+#define NATIVESERVICE_BACKUPMANAGER_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup backup_manager
+ * @ingroup native_service
+ * @{
+ */
+
+#include <native_service/ns_backup.h>
+
+/**@}*/ // end of backup_manager
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
+
+#endif // NATIVESERVICE_BACKUPMANAGER_H_
diff --git a/video_in_hal/nsframework/backup_manager/client/include/native_service/ns_backup.h b/video_in_hal/nsframework/backup_manager/client/include/native_service/ns_backup.h
new file mode 100755
index 0000000..5655ae3
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/client/include/native_service/ns_backup.h
@@ -0,0 +1,498 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ns_backup.h
+ * @brief backup_manager function header file
+ */
+
+#ifndef BACKUP_MANAGER_CLIENT_INCLUDE_NATIVE_SERVICE_NS_BACKUP_H_
+#define BACKUP_MANAGER_CLIENT_INCLUDE_NATIVE_SERVICE_NS_BACKUP_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup backup_manager
+ * @ingroup native_service
+ * @{
+ */
+
+/**
+ * \~english Service availability notify
+ */
+#define NTFY_BackupMgr_Availability "NS_BackupMgr/Availability"
+
+/**
+ * \~english Return value: terminated normally
+ */
+#define BKUP_RET_NORMAL 0
+
+/**
+ * \~english Return value: abnormal termination(content not specified)
+ */
+#define BKUP_RET_ERROR -1
+
+/**
+ * \~english Return value: parameter error
+ */
+#define BKUP_RET_ERRPARAM -2
+
+/**
+ * \~english Return value: initializing
+ */
+#define BKUP_RET_ERRINIT -3
+
+/**
+ * \~english Return value: terminating
+ */
+#define BKUP_RET_ERRTERM -4
+
+/**
+ * \~english Return value: data does not exist
+ */
+#define BKUP_RET_ERRNOENT -5
+
+/**
+ * \~english Return value: data size error
+ */
+#define BKUP_RET_ERRSIZE -6
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \ingroup Backup_DataRd
+ * \~english @par Brief
+ * Read data from backup area
+ * \~english @param [in] tagID
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @param [in] uiOffset
+ * uint32_t - Offset from the beginning of the area(0~size of backup area identified by area ID)
+ * \~english @param [out] pvBuf
+ * void * - A pointer which point to buffer used to storage read data
+ * \~english @param [in] uiSize
+ * uint32_t - Read data size(0~size of backup area identified by area ID)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If the buffer point(pvBuf) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual read size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ Judge the type and access destination according to specified area ID and then read data.
+ * - If appointed size is less than registered size, read data of appointed size. [BKUP_RET_NORMAL]
+ * - If the backup data does not exist, buffer is filled 0. [BKUP_RET_NORMAL]
+ *
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * Backup_DataWt
+ */
+int32_t Backup_DataRd(PCSTR tag_id, uint32_t ui_offset, void *pv_buf, uint32_t ui_size);
+/**
+ * \ingroup Backup_DataWt
+ * \~english @par Brief
+ * Write data to backup area
+ * \~english @param [in] tagID
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @param [in] pvBuf
+ * void * - A pointer which point to buffer used to storage write data
+ * \~english @param [in] uiOffset
+ * uint32_t - Offset from the beginning of the area(0~size of backup area identified by area ID)
+ * \~english @param [in] uiSize
+ * uint32_t - Write data size(0~size of backup area identified by area ID)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If the buffer point(pvBuf) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If system call(mmap()) is error [BKUP_RET_ERROR]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual read size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the storage media type and access destination according to specified area ID and then write data.
+ * Calling @ref Backup_DataWt more than once for the same ID when writing data separately.
+ * Data integrity can not be guaranteed at power interruption.
+ * Data should be written at one time to guarantee data consistency.
+ * The work life of writing times depends on how the user writes,NS_BackupMgr doesn't guaranteed.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * Backup_DataRd
+ */
+int32_t Backup_DataWt(PCSTR tag_id, void *pv_buf, uint32_t ui_offset, uint32_t ui_size);
+
+
+/**
+ * \ingroup Backup_DataFil
+ * \~english @par Brief
+ * Write data to backup area with the specified pattern
+ * \~english @param [in] tagID
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @param [in] uiOffset
+ * uint32_t - Offset from the beginning of the area(0~size of backup area identified by area ID)
+ * \~english @param [in] ucPat
+ * uint8_t - Write pattern data(0x00~0xff)
+ * \~english @param [in] uiSize
+ * uint32_t - Write data size(0~size of backup area identified by area ID)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual read size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and then fill it with the specified pattern.
+ * The work life of writing times depends on how the usrs writes,NS_BackupMgr doesn't guaranteed.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * none
+ */
+int32_t Backup_DataFil(PCSTR tag_id, uint32_t ui_offset, uint8_t uc_pat, uint32_t ui_size);
+
+
+/**
+ * \ingroup Backup_DataSz
+ * \~english @par Brief
+ * Get the size of the backup area.
+ * \~english @param [in] tagID
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @param [out] puiSize
+ * uint32_t * - A pointer which point to storage size
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If the pointer(puiSize) that stores the size specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and acquire the size of the target data.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * none
+ */
+int32_t Backup_DataSz(PCSTR tag_id, uint32_t *pui_size);
+
+/**
+ * \ingroup Backup_DataRdByNumID
+ * \~english @par Brief
+ * Read data from backup area
+ * \~english @param [in] numID
+ * uint32_t - Area ID specified by number
+ * \~english @param [in] uiOffset
+ * uint32_t - Offset from the beginning of the area(0~size of backup area identified by area ID)
+ * \~english @param [out] pvBuf
+ * void * - A pointer which point to buffer used to storage read data
+ * \~english @param [in] uiSize
+ * uint32_t - Read data size(0~size of backup area identified by area ID)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If the buffer point(pvBuf) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual read size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and then read data.
+ * Backup Non-volatile Data Read API for DIAG
+ * Use from the module other than DIAG is prohibited.
+ *
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * Backup_DataRd
+ */
+int32_t Backup_DataRdByNumID(uint32_t num_id, uint32_t ui_offset, void *pv_buf, uint32_t ui_size);
+
+
+/**
+ * \ingroup Backup_DataSzByNumID
+ * \~english @par Brief
+ * Get the size of the backup area.
+ * \~english @param [in] numID
+ * uint32_t - Area ID specified by number
+ * \~english @param [out] puiSize
+ * uint32_t * - A pointer which point to storage size
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If the pointer(puiSize) that stores the size specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and acquire the size of the target data.
+ * Get Non-volatile backup data size API for DIAG
+ * Use from the module other than DIAG is prohibited.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * Backup_DataSz
+ */
+int32_t Backup_DataSzByNumID(uint32_t num_id, uint32_t *pui_size);
+
+/**
+ * \ingroup Backup_DataChk
+ * \~english @par Brief
+ * Check backup data.
+ * \~english @param [in] tagID
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRNOENT Data dose not exist(Sync message transmission or reception(@ref McInvokeSync) fails [eFrameworkunifiedStatusFileLoadError])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusFileLoadError [BKUP_RET_ERRNOENT]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * - If the size specified by the argument does not match the actual read size [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and check the target data.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * none
+ */
+int32_t Backup_DataChk(PCSTR tag_id);
+
+/**
+ * \ingroup Backup_DataDel
+ * \~english @par Brief
+ * Delete backup data.
+ * \~english @param [in] tag_id
+ * PCSTR - Area ID(character string of less than 64 bytes)
+ * \~english @retval BKUP_RET_NORMAL Terminated normally
+ * \~english @retval BKUP_RET_ERRPARAM Parameter error(Sync message transmission or reception(@ref McInvokeSync) error[eFrameworkunifiedStatusInvldParam])
+ * \~english @retval BKUP_RET_ERRINIT Initializing(Sync message send or receive(@ref McInvokeSync) error [eFrameworkunifiedStatusErrOther])
+ * \~english @retval BKUP_RET_ERRTERM Terminating(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusExit])
+ * \~english @retval BKUP_RET_ERRSIZE Data size error(Sync message transmission or reception(@ref McInvokeSync) error [eFrameworkunifiedStatusAccessError])
+ * \~english @retval BKUP_RET_ERROR Abnormal termination(@ref McOpenSender failed, or sync message transmission or reception(@ref McInvokeSync) error other than the above)
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the area ID(tagID) specified by the argument is NULL [BKUP_RET_ERRPARAM]
+ * - If the area ID(tagID) specified by the argument is 64 bytes or more than 64 bytes [BKUP_RET_ERRPARAM]
+ * - If system call(pctrl(PR_GET_NAME)) is error [BKUP_RET_ERROR]
+ * - If failed to open the message queue for transmission [BKUP_RET_ERROR]
+ * - If failed to genarate message queue name for synchronous communication [BKUP_RET_ERROR]
+ * - If failed to open the reception message queue for synchronous communication [BKUP_RET_ERROR]
+ * - Sync message transmission or reception(@ref McInvokeSync) error
+ * - If the return value is eFrameworkunifiedStatusInvldParam [BKUP_RET_ERRPARAM]
+ * - If the return value is eFrameworkunifiedStatusErrOther [BKUP_RET_ERRINIT]
+ * - If the return value is eFrameworkunifiedStatusExit [BKUP_RET_ERRTERM]
+ * - If the return value is eFrameworkunifiedStatusAccessError [BKUP_RET_ERRSIZE]
+ * - If the return value is eFrameworkunifiedStatusFail, it call will synchronization message transmission(@ref McInvokeSync) again after 100 milliseconds later
+ * If the return value is eFrameworkunifiedStatusFail, it will retry BKUP_RETRY_MAX(10) times
+ * - If the return value is other value [BKUP_RET_ERROR]
+ * \~english @par Detail
+ * Judge the type and access destination according to specified area ID and delete the target data.
+ * - If the target data does not exist, return value is terminated normally. [BKUP_RET_NORMAL]
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * none
+ */
+int32_t Backup_DataDel(PCSTR tag_id);
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus */
+
+/**@}*/ // end of backup_manager
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
+
+#endif // BACKUP_MANAGER_CLIENT_INCLUDE_NATIVE_SERVICE_NS_BACKUP_H_
diff --git a/video_in_hal/nsframework/backup_manager/client/libns_backup.ver b/video_in_hal/nsframework/backup_manager/client/libns_backup.ver
new file mode 100755
index 0000000..55003a8
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/client/libns_backup.ver
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# backup version script
+#
+{
+ global:
+ ### .text section ###
+ Backup_DataRd;
+ Backup_DataWt;
+ Backup_DataFil;
+ Backup_DataSz;
+ Backup_DataRdByNumID;
+ Backup_DataSzByNumID;
+ Backup_DataChk;
+ Backup_DataDel;
+ ### .data section ###
+ local:
+ *;
+};
diff --git a/video_in_hal/nsframework/backup_manager/client/src/bkup_api.cpp b/video_in_hal/nsframework/backup_manager/client/src/bkup_api.cpp
new file mode 100755
index 0000000..2c085c0
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/client/src/bkup_api.cpp
@@ -0,0 +1,343 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <native_service/ns_backup.h>
+#include <native_service/ns_message_center_if.h>
+#include <agl_thread.h>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include "bkup_api.h"
+#include "bkup_backupmanagerlog.h"
+#include "bkup_util.h"
+
+#define BKUP_RETRY_MAX (10)
+#define BKUP_RETRY_TIMER (100 * 1000)
+
+static __thread HANDLE g_bkup_msg_handle;
+static __thread HANDLE g_bkup_response_handle;
+
+static int32_t BkupApiCheckTagid(PCSTR tag_id) {
+ if (tag_id == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "tag_id is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ return BKUP_RET_ERRPARAM;
+ }
+ if (strlen(tag_id) >= BKUP_MAX_ITEM_NAME) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "tag_id is long:%zd", strlen(tag_id));
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ return BKUP_RET_ERRPARAM;
+ }
+ return BKUP_RET_NORMAL;
+}
+
+static int32_t BkupApiCall(void *snd_buf, size_t snd_size, void *rcv_buf, uint32_t rcv_size) {
+ int32_t ret = BKUP_RET_ERROR;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ uint32_t real_rcvlen = 0;
+ static __thread char thread_name[16];
+
+ if (g_bkup_msg_handle == NULL) {
+ char invoker_name[24];
+
+ if (prctl(PR_GET_NAME, thread_name) < 0) { // LCOV_EXCL_BR_LINE 5:prctl's error case.
+ // LCOV_EXCL_START 5:prctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "prctl(PR_GET_NAME):%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5:prctl's error case.
+ }
+
+ g_bkup_msg_handle = McOpenSender(SERVICE_BACKUP_MANAGER_MSG_HANDLE_THREAD);
+ if (g_bkup_msg_handle == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "McOpenSender");
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = McCreateInvokerName(thread_name, 0, invoker_name, sizeof(invoker_name))) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "McCreateInvokerName:%d", e_status);
+ McClose(g_bkup_msg_handle);
+ g_bkup_msg_handle = NULL;
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ g_bkup_response_handle = McOpenSyncReceiver(invoker_name);
+ if (g_bkup_response_handle == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "McOpenSyncReceiver");
+ McClose(g_bkup_msg_handle);
+ g_bkup_msg_handle = NULL;
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+ }
+
+ for (int retry_cnt = 0; retry_cnt < BKUP_RETRY_MAX; retry_cnt++) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ e_status = McInvokeSync(g_bkup_msg_handle, thread_name, BACKUP_CID, static_cast<UI_32>(snd_size), snd_buf, 0,
+ g_bkup_response_handle, rcv_size, rcv_buf, &real_rcvlen);
+ if (e_status != eFrameworkunifiedStatusFail) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ break;
+ }
+ usleep(BKUP_RETRY_TIMER);
+ }
+
+ if (e_status != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "McInvokeSync:%d", e_status);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ if (e_status == eFrameworkunifiedStatusInvldParam) {
+ ret = BKUP_RET_ERRPARAM;
+ } else if (e_status == eFrameworkunifiedStatusErrOther) {
+ ret = BKUP_RET_ERRINIT;
+ } else if (e_status == eFrameworkunifiedStatusExit) {
+ ret = BKUP_RET_ERRTERM;
+ } else if (e_status == eFrameworkunifiedStatusFileLoadError) {
+ ret = BKUP_RET_ERRNOENT;
+ } else if (e_status == eFrameworkunifiedStatusAccessError) {
+ ret = BKUP_RET_ERRSIZE;
+ } else {
+ ret = BKUP_RET_ERROR;
+ }
+ goto exit;
+ }
+ if (rcv_size != real_rcvlen) {
+ goto exit;
+ }
+ ret = BKUP_RET_NORMAL;
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataRd(PCSTR tag_id, uint32_t ui_offset, void *pv_buf, uint32_t ui_size) {
+ int32_t ret = BKUP_RET_NORMAL;
+ bkup_protocol_header_t hdr;
+
+ if ((ret = BkupApiCheckTagid(tag_id)) != BKUP_RET_NORMAL) {
+ goto exit;
+ }
+ if (pv_buf == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Buf is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = BKUP_RET_ERRPARAM;
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_READ;
+ BkupStrlcpy(hdr.item_name, tag_id, sizeof(hdr.item_name));
+ hdr.offset = ui_offset;
+ hdr.size = ui_size;
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), pv_buf, ui_size);
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataWt(PCSTR tag_id, void *pv_buf, uint32_t ui_offset, uint32_t ui_size) {
+ int32_t ret;
+ char *snd_buf = NULL;
+ size_t snd_buf_size = 0;
+ bkup_protocol_header_t *hdr;
+
+ if ((ret = BkupApiCheckTagid(tag_id)) != BKUP_RET_NORMAL) {
+ goto exit;
+ }
+ if (pv_buf == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Buf is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = BKUP_RET_ERRPARAM;
+ goto exit;
+ }
+
+ // LCOV_EXCL_BR_START 5:mmap's error case.
+ if ((snd_buf = BkupAnonMmap(sizeof(bkup_protocol_header_t) + ui_size)) == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ ret = BKUP_RET_ERROR;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+ snd_buf_size = sizeof(bkup_protocol_header_t) + ui_size;
+
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(snd_buf);
+ hdr->command = BKUP_CMD_WRITE;
+ BkupStrlcpy(hdr->item_name, tag_id, sizeof(hdr->item_name));
+ hdr->offset = ui_offset;
+ hdr->size = ui_size;
+ memcpy(snd_buf + sizeof(bkup_protocol_header_t), pv_buf, ui_size);
+
+ ret = BkupApiCall(snd_buf, snd_buf_size, NULL, 0);
+
+exit:
+ if (snd_buf) {
+ munmap(snd_buf, snd_buf_size);
+ }
+ return ret;
+}
+
+int32_t Backup_DataFil(PCSTR tag_id, uint32_t ui_offset, uint8_t uc_pat, uint32_t ui_size) {
+ int32_t ret;
+ bkup_protocol_header_t hdr;
+
+ if ((ret = BkupApiCheckTagid(tag_id)) != BKUP_RET_NORMAL) {
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_FILL;
+ BkupStrlcpy(hdr.item_name, tag_id, sizeof(hdr.item_name));
+ hdr.offset = ui_offset;
+ hdr.size = ui_size;
+ hdr.fill_patern = uc_pat;
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), NULL, 0);
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataSz(PCSTR tag_id, uint32_t *pui_size) {
+ int32_t ret;
+ bkup_protocol_header_t hdr;
+
+ if ((ret = BkupApiCheckTagid(tag_id)) != BKUP_RET_NORMAL) {
+ goto exit;
+ }
+ if (pui_size == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Buf is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = BKUP_RET_ERRPARAM;
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_SIZE;
+ BkupStrlcpy(hdr.item_name, tag_id, sizeof(hdr.item_name));
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), pui_size, sizeof(uint32_t));
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataRdByNumID(uint32_t num_id, uint32_t ui_offset, void *pv_buf, uint32_t ui_size) {
+ int32_t ret = BKUP_RET_NORMAL;
+ bkup_protocol_header_t hdr;
+
+ if (pv_buf == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Buf is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = BKUP_RET_ERRPARAM;
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_READ_NUM;
+ hdr.num_id = num_id;
+ hdr.offset = ui_offset;
+ hdr.size = ui_size;
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), pv_buf, ui_size);
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataSzByNumID(uint32_t num_id, uint32_t *pui_size) {
+ int32_t ret;
+ bkup_protocol_header_t hdr;
+
+ if (pui_size == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Buf is NULL");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = BKUP_RET_ERRPARAM;
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_SIZE_NUM;
+ hdr.num_id = num_id;
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), pui_size, sizeof(uint32_t));
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataChk(PCSTR tag_id) {
+ int32_t ret;
+ bkup_protocol_header_t hdr;
+
+ if ((ret = BkupApiCheckTagid(tag_id)) != BKUP_RET_NORMAL) {
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_CHECK;
+ BkupStrlcpy(hdr.item_name, tag_id, sizeof(hdr.item_name));
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), NULL, 0);
+
+exit:
+ return ret;
+}
+
+int32_t Backup_DataDel(PCSTR tag_id) {
+ int32_t ret;
+ bkup_protocol_header_t hdr;
+
+ ret = BkupApiCheckTagid(tag_id);
+ if (ret != BKUP_RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "tag_id is invalid");
+ goto exit;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.command = BKUP_CMD_DELETE;
+ BkupStrlcpy(hdr.item_name, tag_id, sizeof(hdr.item_name));
+
+ ret = BkupApiCall(&hdr, sizeof(hdr), NULL, 0);
+
+exit:
+ return ret;
+}
diff --git a/video_in_hal/nsframework/backup_manager/config/Makefile b/video_in_hal/nsframework/backup_manager/config/Makefile
new file mode 100755
index 0000000..b307a66
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/config/Makefile
@@ -0,0 +1,42 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+XML_PATH := ./conf/backup
+RNG_FILE := backup.rng
+ALL_XML := ALL_.xml
+ID_HEADER := ns_backup_id.h
+BACKUP_XML := backup*.xml
+
+######### headers to be installed(*.h) #############
+INST_HEADERS := $(ID_HEADER)
+
+######### make rule #############
+all: $(ID_HEADER)
+
+$(ID_HEADER): $(XML_PATH)/$(ALL_XML)
+ @set -e; \
+ for xml_file in `find $(XML_PATH) -name \*.xml | grep -v $(ALL_XML)`; do \
+ xmllint --noout --relaxng $(RNG_FILE) $$xml_file; \
+ ./uniqcheck.pl $$xml_file; \
+ done
+ ./createhdr.pl $(XML_PATH)/$(ALL_XML) > $(ID_HEADER)
+
+CLEAN_FILES := $(ID_HEADER)
+
+install: $(XML_PATH)/$(BACKUP_XML)
+ install -m 0755 -d $(DESTDIR)/usr/agl/conf/BS/ns/backup_manager/rodata
+ install -m 0644 $(XML_PATH)/$(BACKUP_XML) $(DESTDIR)/usr/agl/conf/BS/ns/backup_manager/rodata/
+include ../../native_service.mk
diff --git a/video_in_hal/nsframework/backup_manager/config/backup.rng b/video_in_hal/nsframework/backup_manager/config/backup.rng
new file mode 100755
index 0000000..6c9822b
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/config/backup.rng
@@ -0,0 +1,123 @@
+<element name="backup" xmlns="http://relaxng.org/ns/structure/1.0">
+ <zeroOrMore>
+ <element name="category" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <attribute name="name">
+ <data type="Name">
+ <param name="maxLength">64</param>
+ </data>
+ </attribute>
+ <choice>
+ <!-- NAND -->
+ <group>
+ <attribute name="nand">
+ <choice>
+ <value type="boolean">true</value>
+ </choice>
+ </attribute>
+ <optional>
+ <attribute name="cacheDram">
+ <data type="boolean"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="backupDram">
+ <data type="boolean"/>
+ </attribute>
+ </optional>
+ <attribute name="sync">
+ <data type="boolean"/>
+ </attribute>
+ <optional>
+ <attribute name="backupCycle">
+ <data type="positiveInteger"/>
+ </attribute>
+ </optional>
+ <attribute name="encrypt">
+ <data type="boolean"/>
+ </attribute>
+ </group>
+ <!-- CacheDRAM -->
+ <group>
+ <attribute name="cacheDram">
+ <choice>
+ <value type="boolean">true</value>
+ </choice>
+ </attribute>
+ <optional>
+ <attribute name="nand">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="backupDram">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="sync">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <attribute name="encrypt">
+ <data type="boolean"/>
+ </attribute>
+ </group>
+ <!-- BackupDRAM -->
+ <group>
+ <attribute name="backupDram">
+ <choice>
+ <value type="boolean">true</value>
+ </choice>
+ </attribute>
+ <optional>
+ <attribute name="nand">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="cacheDram">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="sync">
+ <choice>
+ <value type="boolean">false</value>
+ </choice>
+ </attribute>
+ </optional>
+ <attribute name="encrypt">
+ <data type="boolean"/>
+ </attribute>
+ </group>
+ </choice>
+ <zeroOrMore>
+ <element name="item">
+ <attribute name="name">
+ <data type="Name">
+ <param name="maxLength">64</param>
+ </data>
+ </attribute>
+ <attribute name="id">
+ <data type="positiveInteger">
+ <param name="maxInclusive">32767</param>
+ </data>
+ </attribute>
+ <attribute name="size">
+ <data type="positiveInteger"/>
+ </attribute>
+ </element>
+ </zeroOrMore>
+ </element>
+ </zeroOrMore>
+</element>
diff --git a/video_in_hal/nsframework/backup_manager/config/conf/backup/ALL_.xml b/video_in_hal/nsframework/backup_manager/config/conf/backup/ALL_.xml
new file mode 100755
index 0000000..bb42b63
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/config/conf/backup/ALL_.xml
@@ -0,0 +1,1216 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="D_BK_CA_GID_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_GID_D" id="0001" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MPT_D" id="0002" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT_D" id="0003" size="1"/>
+ </category>
+ <category name="D_BK_CA_LSDBKUP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LSDBKUP" id="0004" size="1"/>
+ </category>
+ <category name="D_BK_CA_GPSINFO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_GPSINFO" id="0005" size="1"/>
+ </category>
+ <category name="D_BK_CA_MADTIME" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MADTIME" id="0006" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_TEC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_TEC" id="0007" size="1"/>
+ </category>
+ <category name="D_BK_CA_HDW_SCL" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HDW_SCL" id="0008" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_POS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_POS" id="0009" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GYRO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GYRO" id="0010" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_DIST" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_DIST" id="0011" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_HELP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_HELP" id="0012" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_TDST" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_TDST" id="0013" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_PSSR" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_PSSR" id="0014" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GSRV" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GSRV" id="0015" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_TTBL" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_TTBL" id="0016" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_PLGN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_PLGN" id="0017" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_CAM" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_CAM" id="0018" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_DIAG" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_DIAG" id="0019" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_SLRN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_SLRN" id="0020" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_MCKH" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_MCKH" id="0021" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GSBK" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GSBK" id="0022" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_RLRN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_RLRN" id="0023" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_PARK" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_PARK" id="0024" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_SAPA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_SAPA" id="0025" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_TTJD" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_TTJD" id="0026" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_UPLD" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_UPLD" id="0027" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_TTKH" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_TTKH" id="0028" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_UPNR" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_UPNR" id="0029" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_OFRD" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_OFRD" id="0030" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_OSRS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_OSRS" id="0031" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_MCIN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_MCIN" id="0032" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCSM" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCSM" id="0033" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCSR" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCSR" id="0034" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS1" id="0035" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS2" id="0036" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS3" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS3" id="0037" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS4" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS4" id="0038" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS5" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS5" id="0039" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS6" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS6" id="0040" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS7" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS7" id="0041" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_LCS8" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_LCS8" id="0042" size="1"/>
+ </category>
+ <category name="D_BK_CA_MNT_BK1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MNT_BK1" id="0043" size="1"/>
+ </category>
+ <category name="D_BK_CA_MNT_BK2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MNT_BK2" id="0044" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLCM" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLCM" id="0045" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLCR" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLCR" id="0046" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC1" id="0047" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC2" id="0048" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC3" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC3" id="0049" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC4" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC4" id="0050" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC5" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC5" id="0051" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC6" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC6" id="0052" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC7" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC7" id="0053" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GLC8" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GLC8" id="0054" size="1"/>
+ </category>
+ <category name="D_BK_CA_GPSCNT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_GPSCNT" id="0055" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_MNG" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_MNG" id="0056" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_RT1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_RT1" id="0057" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_RT2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_RT2" id="0058" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_RT3" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_RT3" id="0059" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_RT4" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_RT4" id="0060" size="1"/>
+ </category>
+ <category name="D_BK_CA_MYRT_RT5" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MYRT_RT5" id="0061" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_NS1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_NS1" id="0062" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_NS2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_NS2" id="0063" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_NS3" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_HMI_NS3" id="0064" size="1"/>
+ </category>
+ <category name="D_BK_CA_AVD_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_AVD_D" id="0065" size="1"/>
+ </category>
+ <category name="D_BK_CA_GPT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_GPT_D" id="0066" size="1"/>
+ </category>
+ <category name="D_BK_CA_RTINF_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_RTINF_D" id="0067" size="1"/>
+ </category>
+ <category name="D_BK_CA_RDT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_RDT_D" id="0068" size="1"/>
+ </category>
+ <category name="D_BK_CA_ETA_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ETA_D" id="0069" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_GYTP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_GYTP" id="0070" size="1"/>
+ </category>
+ <category name="D_BK_CA_GID_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GID_F" id="0071" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPT_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MPT_F" id="0072" size="1"/>
+ </category>
+ <category name="D_BK_CA_AVD_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_AVD_F" id="0073" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_LPT_F" id="0074" size="1"/>
+ </category>
+ <category name="D_BK_CA_VR_POI" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VR_POI" id="0075" size="1"/>
+ </category>
+ <category name="D_BK_CA_BKWNRO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_BKWNRO" id="0076" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPTGRP_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MPTGRP_D" id="0077" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPTGRP_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MPTGRP_F" id="0078" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_TFPMMC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_TFPMMC" id="0079" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_TFPDATA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_TFPDATA" id="0080" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_BCN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_BCN" id="0081" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_FM" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_FM" id="0082" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_DSRC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_DSRC" id="0083" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_DRG" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_DRG" id="0084" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_BRD" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_BRD" id="0085" size="1"/>
+ </category>
+ <category name="D_BK_CA_MADMNG_RCVINFO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MADMNG_RCVINFO" id="0086" size="1"/>
+ </category>
+ <category name="D_BK_CA_MAD_UPDATEINFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MAD_UPDATEINFO" id="0087" size="1"/>
+ </category>
+ <category name="D_BK_CA_NM_NWINF01" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NM_NWINF01" id="0088" size="1"/>
+ </category>
+ <category name="D_BK_CA_NM_NWINF02" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NM_NWINF02" id="0089" size="1"/>
+ </category>
+ <category name="D_BK_CA_ND2_SAPA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ND2_SAPA" id="0090" size="1"/>
+ </category>
+ <category name="D_BK_CA_SMS_RVS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_SMS_RVS" id="0091" size="1"/>
+ </category>
+ <category name="D_BK_CA_SMS_VSC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_SMS_VSC" id="0092" size="1"/>
+ </category>
+ <category name="D_BK_CA_VCJ_CTL1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VCJ_CTL1" id="0093" size="1"/>
+ </category>
+ <category name="D_BK_CA_VCJ_MNT1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VCJ_MNT1" id="0094" size="1"/>
+ </category>
+ <category name="D_BK_CA_VCJ_CTL2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VCJ_CTL2" id="0095" size="1"/>
+ </category>
+ <category name="D_BK_CA_VCJ_MNT2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VCJ_MNT2" id="0096" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIC_SDAT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DIC_SDAT" id="0097" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIC_UDAT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DIC_UDAT" id="0098" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIC_MDAT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DIC_MDAT" id="0099" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPMNG_PB" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPMNG_PB" id="0100" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPMNG_UP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPMNG_UP" id="0101" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPMNG_CT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPMNG_CT" id="0102" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_EA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_EA" id="0103" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_ER" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_ER" id="0104" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_EBA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_EBA" id="0105" size="1"/>
+ </category>
+ <category name="D_BK_CA_LOC_EBD" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LOC_EBD" id="0106" size="1"/>
+ </category>
+ <category name="D_BK_CA_AWYMNG_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_AWYMNG_D" id="0107" size="1"/>
+ </category>
+ <category name="D_BK_CA_AWYDT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_AWYDT_D" id="0108" size="1"/>
+ </category>
+ <category name="D_BK_CA_AWYCD_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_AWYCD_D" id="0109" size="1"/>
+ </category>
+ <category name="D_BK_CA_PWMPT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PWMPT_D" id="0110" size="1"/>
+ </category>
+ <category name="D_BK_CA_GPOI_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_GPOI_D" id="0111" size="1"/>
+ </category>
+ <category name="D_BK_CA_LFM_REC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LFM_REC" id="0112" size="1"/>
+ </category>
+ <category name="D_BK_CA_LFM_RUN1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LFM_RUN1" id="0113" size="1"/>
+ </category>
+ <category name="D_BK_CA_LFM_RUN2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LFM_RUN2" id="0114" size="1"/>
+ </category>
+ <category name="D_BK_CA_LFM_INIT" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LFM_INIT" id="0115" size="1"/>
+ </category>
+ <category name="D_BK_CA_PWMPT_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_PWMPT_F" id="0116" size="1"/>
+ </category>
+ <category name="D_BK_CA_BDMPT_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BDMPT_F" id="0117" size="1"/>
+ </category>
+ <category name="D_BK_CA_GPOI_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GPOI_F" id="0118" size="1"/>
+ </category>
+ <category name="D_BK_CA_ECOLRNJP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ECOLRNJP" id="0119" size="1"/>
+ </category>
+ <category name="D_BK_CA_RDTECOJP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_RDTECOJP" id="0120" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPH_CONF" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPH_CONF" id="0121" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPH_ONDATA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPH_ONDATA" id="0122" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPH_CODATA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPH_CODATA" id="0123" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPFU_CND" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPFU_CND" id="0124" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPFU_COL" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPFU_COL" id="0125" size="1"/>
+ </category>
+ <category name="D_BK_CA_NPFU_STR" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_NPFU_STR" id="0126" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD67__ITS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID__CWORD67__ITS" id="0127" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_MS1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_MS1" id="0128" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_MS2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_MS2" id="0129" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_BTN" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_BTN" id="0134" size="1"/>
+ </category>
+ <category name="D_BK_CA_G_PER_CA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_G_PER_CA" id="0135" size="1"/>
+ </category>
+ <category name="D_BK_CA_G_BR_HIS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_G_BR_HIS" id="0136" size="1"/>
+ </category>
+ <category name="D_BK_CA_CAR_CDF" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CAR_CDF" id="0137" size="1"/>
+ </category>
+ <category name="D_BK_CA_ACC_CDF" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ACC_CDF" id="0138" size="1"/>
+ </category>
+ <category name="D_BK_CA_CEL_CDF" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CEL_CDF" id="0139" size="1"/>
+ </category>
+ <category name="D_BK_CA_CDF_ONS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CDF_ONS" id="0140" size="1"/>
+ </category>
+ <category name="D_BK_CA_CON_CDF1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CON_CDF1" id="0141" size="1"/>
+ </category>
+ <category name="D_BK_CA_CON_CDF2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CON_CDF2" id="0142" size="1"/>
+ </category>
+ <category name="D_BK_CA_SPFC_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_SPFC_D" id="0143" size="1"/>
+ </category>
+ <category name="D_BK_CA_ECORT_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ECORT_D" id="0144" size="1"/>
+ </category>
+ <category name="D_BK_CA_SPFC_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_SPFC_F" id="0145" size="1"/>
+ </category>
+ <category name="D_BK_CA_ECORT_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_ECORT_F" id="0146" size="1"/>
+ </category>
+ <category name="D_BK_CA_G_BM_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_G_BM_D" id="0149" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J09" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J09" id="0150" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J10" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J10" id="0151" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J11" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J11" id="0152" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J12" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J12" id="0153" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J13" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J13" id="0154" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J14" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J14" id="0155" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J15" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J15" id="0156" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J16" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J16" id="0157" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J17" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J17" id="0158" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J18" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J18" id="0159" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J19" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J19" id="0160" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J20" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J20" id="0161" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J21" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J21" id="0162" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J22" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J22" id="0163" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J23" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J23" id="0164" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J24" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J24" id="0165" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J25" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J25" id="0166" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J26" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J26" id="0167" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J27" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J27" id="0168" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J28" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J28" id="0169" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J29" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J29" id="0170" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J30" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J30" id="0171" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J31" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J31" id="0172" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J32" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J32" id="0173" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J33" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J33" id="0174" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J34" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J34" id="0175" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J35" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J35" id="0176" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J36" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J36" id="0177" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J37" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J37" id="0178" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J38" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J38" id="0179" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E01" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E01" id="0180" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E02" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E02" id="0181" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E03" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E03" id="0182" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E04" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E04" id="0183" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E05" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E05" id="0184" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E06" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E06" id="0185" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E07" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E07" id="0186" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E08" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E08" id="0187" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E09" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E09" id="0188" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E10" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E10" id="0189" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E11" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E11" id="0190" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E12" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E12" id="0191" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E13" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E13" id="0192" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E14" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E14" id="0193" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E15" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E15" id="0194" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E16" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E16" id="0195" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E17" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E17" id="0196" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E18" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E18" id="0197" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E19" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E19" id="0198" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E20" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E20" id="0199" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E21" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E21" id="0200" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E22" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E22" id="0201" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E23" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E23" id="0202" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E24" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E24" id="0203" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E25" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E25" id="0204" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E26" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E26" id="0205" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E27" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E27" id="0206" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E28" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E28" id="0207" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E29" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E29" id="0208" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E30" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E30" id="0209" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E31" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E31" id="0210" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E32" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E32" id="0211" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E33" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E33" id="0212" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E34" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E34" id="0213" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E35" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E35" id="0214" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E36" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E36" id="0215" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E37" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E37" id="0216" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_E38" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_E38" id="0217" size="1"/>
+ </category>
+ <category name="D_BK_CA_DAPL_ICN" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DAPL_ICN" id="0218" size="1"/>
+ </category>
+ <category name="D_BK_CA_MADMNG_MEMCLEAR" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MADMNG_MEMCLEAR" id="0219" size="1"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_STABLE_DATA" id="0227" size="1"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_DRAMBKUP_DATA" id="0228" size="1"/>
+ </category>
+ <category name="D_BK_CA_DUMMYREAD_OFFSET" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DUMMYREAD_OFFSET" id="0229" size="1"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_PARAMETER" id="0230" size="1"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_RESUME" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_MMCOM_RESUME" id="0231" size="1"/>
+ <item name="D_BK_ID_MEDSRV_ITGP_RESUME" id="0274" size="1"/>
+ <item name="D_BK_ID_MEDSRV_DISC_RESUME" id="0275" size="1"/>
+ <item name="D_BK_ID_MEDSRV__CWORD57__RESUME" id="0276" size="1"/>
+ <item name="D_BK_ID_MEDSRV_BTA_RESUME" id="0277" size="1"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_RESUME" id="0278" size="1"/>
+ <item name="D_BK_ID_MEDSRV_SDVCOM_RESUME" id="0444" size="1"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEPARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEPARAM" id="0232" size="1"/>
+ <item name="D_BK_ID_REPROS_SERVICEFLG" id="0371" size="1"/>
+ <item name="D_BK_ID_REPROS_AUTO_UPDATE_CHECK" id="0372" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLID" id="0373" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_RESULT" id="0374" size="1"/>
+ <item name="D_BK_ID_REPROS_RESUME_TIME" id="0375" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_PCGVER" id="0376" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMING" id="0377" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMEOUT" id="0378" size="1"/>
+ <item name="D_BK_ID_REPROS_NA05OUT_RESULT" id="0379" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLURL" id="0380" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_INFO" id="0381" size="1"/>
+ <item name="D_BK_ID_REPROS_CENTERCOMM_STATE" id="0382" size="1"/>
+ <item name="D_BK_ID_REPROS_MAP_VER" id="0383" size="1"/>
+ <item name="D_BK_ID_REPROS_NA07_HISTORY_INFO" id="0385" size="1"/>
+ <item name="D_BK_ID_REPROS_UPDATE_INFO" id="0386" size="1"/>
+ <item name="D_BK_ID_REPROS_NA05_DOWNLOAD_SIZE" id="0387" size="1"/>
+ <item name="D_BK_ID_REPROS_FILE_PATH_INFO" id="0399" size="1"/>
+ <item name="D_BK_ID_REPROS_UPDATE_FILE_EXIST" id="0401" size="1"/>
+ <item name="D_BK_ID_REPROS_START_STATE_INFO" id="0403" size="1"/>
+ <item name="D_BK_ID_REPROS_CHECKFORUPDATE_TIME" id="0404" size="1"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEHISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEHISTORY" id="0233" size="1"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEINFO" id="0234" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKB_N" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKB_N" id="0235" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKB_M" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKB_M" id="0236" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKB_G" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKB_G" id="0237" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKB_B" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKB_B" id="0238" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKB_T" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKB_T" id="0239" size="1"/>
+ </category>
+ <category name="D_BK_CA_CLOCK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_CLOCK_OFFSET" id="0240" size="1"/>
+ <item name="D_BK_ID_CLOCK_STATE" id="0241" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_SYNC_OFFSET" id="0242" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_ASYNC" nand="true" cacheDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_ASYNC_OFFSET" id="0243" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAG_INFORMATION" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAG_INFORMATION" id="0244" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAG_UTILIZATION" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAG_UTILIZATION" id="0245" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_VSDSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_VSDSRV_PARAMETER" id="0246" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_ACNSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_ACNSRV_PARAMETER" id="0247" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_ASYNC_GRP" id="0248" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_SYNC_GRP" id="0249" size="1"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_PARAMETER" id="0250" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_FIX_CNT" nand="true" cacheDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_FIX_CNT" id="0251" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TD_STS" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TD_STS" id="0252" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_ROLLOVER_CNT" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_ROLLOVER_CNT" id="0253" size="1"/>
+ </category>
+ <category name="D_BK_CA_WLANM_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_WLANM_INFO" id="0254" size="1"/>
+ </category>
+ <category name="D_BK_CA_BTSTK_LINKKEY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BTSTK_LINKKEY" id="0255" size="1"/>
+ </category>
+ <category name="D_BK_CA_EOM_CONTENTS_STATUS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_EOM_CONTENTS_STATUS" id="0256" size="1"/>
+ </category>
+ <category name="D_BK_CA_UPDSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_UPDSERVICE_PARAMETER" id="0257" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_RCV" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_RCV" id="0259" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_GENERAL_GRP" id="0260" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_STARTUPBGM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_GENERAL_STARTUPBGM" id="0261" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_CLOCK_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_CLOCK_GRP" id="0262" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_HOME_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_HOME_GRP" id="0263" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_GRP" id="0264" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_VOL" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_VOL" id="0265" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_GRP" id="0266" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_UIC_TAB" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_UIC_TAB" id="0268" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_GRP" id="0269" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_MET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_MET" id="0270" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_UIC_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_UIC_GRP" id="0271" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_UIC_FILENAME" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_UIC_FILENAME" id="0272" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_SMARTAGENT_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_SMARTAGENT_GRP" id="0273" size="1"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_DISC_SETTING" id="0279" size="1"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_SETTING" id="0280" size="1"/>
+ <item name="D_BK_ID_MEDSRV_COM_SETTING" id="420" size="1"/>
+ </category>
+ <category name="D_BK_CA_GNDB_UPDATE_HISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GNDB_UPDATE_HISTORY" id="0281" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MEM" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_MEM" id="0282" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_EXTINFO" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_EXTINFO" id="0283" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_TRIPCNT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_TRIPCNT" id="0284" size="1"/>
+ </category>
+ <category name="D_BK_CA_PFDREC_FUNC" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_PFDREC_FUNC" id="0285" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_WORK_BUF" nand="false" backupDram="true" sync="false" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_WORK_BUF" id="0286" size="1"/>
+ </category>
+ <category name="D_BK_CA_AS__CWORD76_VOLUME" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_AS__CWORD76_VOLUME" id="0287" size="1"/>
+ </category>
+ <category name="D_BK_CA_G_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_G_INFO" id="0288" size="1"/>
+ </category>
+ <category name="D_BK_CA_G_BM_S" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_G_BM_S" id="0289" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_BR_HIS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_F_BR_HIS" id="0290" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_COOKIE" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_F_COOKIE" id="0291" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_INFO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_F_INFO" id="0292" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_USE_INF" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_F_USE_INF" id="0293" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_BM_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_F_BM_D" id="0294" size="1"/>
+ </category>
+ <category name="D_BK_CA_F_BM_S" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_F_BM_S" id="0295" size="1"/>
+ </category>
+ <category name="D_BK_CA_KEYBOARD_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_KEYBOARD_PARAMETER" id="0296" size="1"/>
+ </category>
+ <category name="D_BK_CA_AUDIOSETTING_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_AUDIOSETTING_PARAMETER" id="0297" size="1"/>
+ </category>
+ <category name="D_BK_CA_CONNECTIVITY_LASTAPP" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CONNECTIVITY_LASTAPP" id="0298" size="1"/>
+ </category>
+ <category name="D_BK_CA_RADIOAPP_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RADIOAPP_PARAMETER" id="0299" size="1"/>
+ </category>
+ <category name="D_BK_CA_TOUCH" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_TOUCH_CONFIG" id="0300" size="1"/>
+ <item name="D_BK_ID_TOUCH_PARAMETER" id="0301" size="1"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_DCMFLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_DCMFLAG" id="0302" size="1"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG" id="0303" size="1"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_ACCON_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_ACCON_CDF" id="0304" size="1"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG_CDF" id="0305" size="1"/>
+ </category>
+ <category name="D_BK_CA_GRA_AMFMHD_CTRL" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_AMFMHD_STATION_LIST" id="0321" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_AMFMHD_STATION_LOGO" id="0322" size="1"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_LSM_DATA" id="0323" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_SC_CONFIG_PARAMS" id="0324" size="1"/>
+ </category>
+ <category name="D_BK_CA_GRA_SDARS_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_STATION_LIST" id="0326" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_CATEGORY_LIST" id="0327" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_IMDB_URL_CHN_LOGO" id="0328" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SMS_CFG" id="0365" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_RADIO_ID" id="0405" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SUBSCRIPTION_STATUS" id="0439" size="1"/>
+ </category>
+ <category name="D_BK_CA_DAB_TUN" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DAB_LM_ENS" id="0329" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_ENS_ORDER" id="0330" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_SRVC" id="0331" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_SRV_ORDER" id="0332" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_CMP" id="0333" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_COMP_ORDER" id="0334" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_HARD_LINK" id="0335" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_HARD_LINK_ORDER" id="0336" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_LINK_INFO" id="0337" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_LM_LINK_INFO_ORDER" id="0338" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_TPEG_LIST" id="0339" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_TPEG_LIST_ORDER" id="0340" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_OE_FREQ" id="0341" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_OE_FREQ_ORDER" id="0342" size="1"/>
+ <item name="D_BK_ID_NVM_DAB_OE_EID" id="0343" size="1"/>
+ <item name="D_BK_ID_NVM_DAB_OE_EID_ORDER" id="0344" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_BEST_FM_LINK" id="0440" size="1"/>
+ <item name="D_BK_ID_NVM_ID_DAB_ERROR_COUNT" id="0441" size="1"/>
+ </category>
+ <category name="D_BK_CA_DBG_POSTMORTEM" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_CPF_POSTMORTEM" id="0345" size="1"/>
+ </category>
+ <category name="D_BK_CA_DBG_FILTER_SET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DBG_FILTER_SET" id="0346" size="1"/>
+ </category>
+ <category name="D_BK_CA_DCM_CNCT_EN" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DCM_CNCT_EN" id="0347" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_CLK" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_CLK" id="0348" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_CP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_CP" id="0349" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_LCTY" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_LCTY" id="0350" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_LPOS" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_LPOS" id="0351" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_SRCA" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_SRCA" id="0352" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPTMNG_D" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MPTMNG_D" id="0353" size="1"/>
+ </category>
+ <category name="D_BK_CA_MPTMNG_F" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MPTMNG_F" id="0354" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TEST_ROLLOVER_CNT" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TEST_ROLLOVER_CNT" id="0355" size="1"/>
+ </category>
+ <category name="D_BK_CA_PAYD_ODO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PAYD_ODO" id="0358" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_RSDDS_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_RSDDS_STATS" id="0359" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_UPDATE_DB_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_UPDATE_DB_STATS" id="0360" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_HISTORY_LIST" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_HISTORY_LIST" id="0361" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WC_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WC_INFO" id="0362" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_VIDCM_DEPLOYMENT_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_VIDCM_DEPLOYMENT_INFO" id="0363" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_DEALER_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_DEALER_INFO" id="0384" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J01" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J01" id="0388" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J02" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J02" id="0389" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J03" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J03" id="0390" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J04" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J04" id="0391" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J05" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J05" id="0392" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J06" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J06" id="0393" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J07" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J07" id="0394" size="1"/>
+ </category>
+ <category name="D_BK_CA_SKN_J08" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_SKN_J08" id="0395" size="1"/>
+ </category>
+ <category name="D_BK_CA_MODEMANAGER_LASTMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODEMANAGER_LASTMODE" id="0396" size="1"/>
+ </category>
+ <category name="D_BK_CA_MODBPFSG" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODBPFSG" id="0397" size="1"/>
+ </category>
+ <category name="D_BK_CA_ASS_PARAMETER" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ASS_PARAMETER" id="0406" size="1"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_N" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_N" id="0407" size="1"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_D" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_D" id="0408" size="1"/>
+ </category>
+ <category name="D_BK_CA_VR_SYNC_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VR_INPUT_AUDIO_DUMP" id="0258" size="1"/>
+ <item name="D_BK_ID_VR_PVR_FLAG" id="0364" size="1"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_MANAGEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_MANAGEINFO" id="0409" size="1"/>
+ </category>
+ <category name="D_BK_CA_PCSECBK" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PCSECBK" id="0410" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_LRN_1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_LRN_1" id="0412" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_LRN_2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_LRN_2" id="0413" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_LRN_3" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_LRN_3" id="0414" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_LRN_4" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_LRN_4" id="0415" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_LRN_5" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_LRN_5" id="0416" size="1"/>
+ </category>
+ <category name="D_BK_CA_HV_HISORY" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HV_HISORY" id="0417" size="1"/>
+ </category>
+ <category name="D_BK_CA_REPROS_MAPUPDATE_PARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_MAPUPDATE_STATUS" id="0418" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__SYNC_GRP" id="0419" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_PNS1" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_PNS1" id="0421" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_PNS2" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_PNS2" id="0422" size="1"/>
+ </category>
+ <category name="D_BK_CA_HMI_USER" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_HMI_USER" id="0423" size="1"/>
+ </category>
+ <category name="D_BK_CA_PMG_SMAP" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_PMG_SMAP" id="0424" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT1_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT1_F" id="0425" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT2_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT2_F" id="0426" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT3_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT3_F" id="0427" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT4_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT4_F" id="0428" size="1"/>
+ </category>
+ <category name="D_BK_CA_LPT5_F" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_LPT5_F" id="0429" size="1"/>
+ </category>
+ <category name="D_BK_CA_MUDINFO" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_MUDINFO" id="0430" size="1"/>
+ </category>
+ <category name="D_BK_CA_CTRRTSRV" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_CTRRTSRV" id="0431" size="1"/>
+ </category>
+ <category name="D_BK_CA_VDU_MNG" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VDU_MNG" id="0432" size="1"/>
+ </category>
+ <category name="D_BK_CA_VDU_ICON" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_VDU_ICON" id="0433" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAG_DEVICEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAG_DEVICEINFO" id="0434" size="1"/>
+ </category>
+ <category name="D_BK_CA_BT_PAIRING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_PAIRING" id="0435" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_SET_TIME" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_SET_TIME" id="0436" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_SHUT_DOWN" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_FORECAST" id="0221" size="1"/>
+ <item name="D_BK_ID_DTSERVICE_COORDINATE" id="0223" size="1"/>
+ <item name="D_BK_ID_DTSERVICE_AFLIST" id="0224" size="1"/>
+ <item name="D_BK_ID_DTSERVICE_DOPPLER" id="0225" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_IMMIEDIATELY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_CITYDB" id="0220" size="1"/>
+ <item name="D_BK_ID_DTSERVICE_SETUP" id="0222" size="1"/>
+ <item name="D_BK_ID_DTSERVICE_WEATHER_HISTORY" id="0226" size="1"/>
+ </category>
+ <category name="D_BK_CA_TCS_LEARN_DICTIONARY" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_TCS_LEARN_DICTIONARY" id="437" size="1"/>
+ <item name="D_BK_ID_TCS_WNN_LEARN_DICTIONARY" id="438" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_INFO" id="0442" size="1"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_FLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_FLAG" id="0443" size="1"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL_IMM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_LIST" id="0325" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER1_LIST" id="0366" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER2_LIST" id="0367" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER3_LIST" id="0368" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER4_LIST" id="0369" size="1"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER5_LIST" id="0370" size="1"/>
+ </category>
+ <category name="D_BK_CA_CON_CWORD57__INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CON_CWORD57__INFO" id="0445" size="1"/>
+ </category>
+ <category name="D_BK_CA_HELP_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_HELP_DATA" id="0446" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_DRAM_OFFSET" id="0447" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_METSRV_PARAMETER" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VS_METSRV_PARAMETER" id="0448" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MASK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_MASK" id="0449" size="1"/>
+ </category>
+ <category name="D_BK_CA_NAVIPROXY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NAVIPROXY" id="0450" size="1"/>
+ </category>
+ <category name="D_BK_CA_AWBPROXY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_AWBPROXY" id="0451" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_CMRSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_CMRSRV_PARAMETER" id="0452" size="1"/>
+ </category>
+ <category name="D_BK_CA_DWR_DWRM" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DWR_DWRM" id="0453" size="1"/>
+ </category>
+ <category name="D_BK_CA_MUDINIT" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MUDINIT" id="0454" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__USER_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD27__SETTING" id="0457" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__SHARED_RAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD27__CONNECTION_MODE" id="0456" size="1"/>
+ </category>
+ <category name="D_BK_CA_DTI_ETCC" nand="true" backupDram="true" sync="false" backupCycle="30" encrypt="false">
+ <item name="D_BK_ID_DTI_ETCC" id="0458" size="1"/>
+ </category>
+ <category name="D_BK_CA_BT_MANAGEMENT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_POWER" id="0459" size="1"/>
+ <item name="D_BK_ID_BT_PINCODE" id="0460" size="1"/>
+ <item name="D_BK_ID_BT_NAME" id="0461" size="1"/>
+ <item name="D_BK_ID_BT_DEFAULT_NAME" id="0462" size="1"/>
+ <item name="D_BK_ID_BT_ADDRESS" id="0463" size="1"/>
+ <item name="D_BK_ID_BT_AUTOMATIC_CONNECTION" id="0464" size="1"/>
+ <item name="D_BK_ID_BT_PREFERRED_SETTING" id="0465" size="1"/>
+ <item name="D_BK_ID_BT_PHONE_DISPLAY_STATE" id="0466" size="1"/>
+ <item name="D_BK_ID_BT_AUDIOPLAYER_DISPLAY_STATE" id="0467" size="1"/>
+ <item name="D_BK_ID_BT_PROFILE_AVAILABLE" id="0468" size="1"/>
+ <item name="D_BK_ID_BT_DCM_PHONE" id="0469" size="1"/>
+ </category>
+ <category name="D_BK_CA_EOMSERVICE_LOCALSTORAGE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_EOMSERVICE_LOCALSTORAGE" id="0470" size="1"/>
+ </category>
+ <category name="D_BK_CA_DOA_EXISTENCE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DOA_EXISTENCE" id="0471" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_SETTING" id="0472" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_ODOMETER" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_ODOMETER" id="0473" size="1"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_DIAGMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_DIAGMODE" id="0474" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__ASYNC_GRP" id="0475" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__1TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__1TRIP_ASYNC_GRP" id="0476" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD28_AUTO_SHARED_RAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD28_AUTO_CONNECTION_MODE" id="0477" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD28_AUTO_USER_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD28_AUTO_SETTING" id="0478" size="1"/>
+ </category>
+ <category name="D_BK_CA__CWORD24_" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD24_" id="0479" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_ASYNC_GRP" id="0480" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_SYNC" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_SYNC_GRP" id="0481" size="1"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__TRIP_ASYNC_GRP" id="0482" size="1"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_METER_TYPE" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_METER_TYPE" id="0483" size="1"/>
+ </category>
+ <category name="D_BK_CA_ADAS_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ADAS_SETTING" id="0484" size="1"/>
+ </category>
+</backup>
diff --git a/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA1_L.xml b/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA1_L.xml
new file mode 100755
index 0000000..a9d523a
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA1_L.xml
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="D_BK_CA_VEHICLE_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_STABLE_DATA" id="0227" size="16"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_DRAMBKUP_DATA" id="0228" size="16"/>
+ </category>
+ <category name="D_BK_CA_DUMMYREAD_OFFSET" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DUMMYREAD_OFFSET" id="0229" size="512"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_PARAMETER" id="0230" size="4096"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_RESUME" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_MMCOM_RESUME" id="0231" size="53280"/>
+ <item name="D_BK_ID_MEDSRV_ITGP_RESUME" id="0274" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_DISC_RESUME" id="0275" size="1024"/>
+ <item name="D_BK_ID_MEDSRV__CWORD57__RESUME" id="0276" size="10656"/>
+ <item name="D_BK_ID_MEDSRV_BTA_RESUME" id="0277" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_RESUME" id="0278" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_SDVCOM_RESUME" id="0444" size="256"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEPARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEPARAM" id="0232" size="32"/>
+ <item name="D_BK_ID_REPROS_AUTO_UPDATE_CHECK" id="0372" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLID" id="0373" size="4"/>
+ <item name="D_BK_ID_REPROS_RESUME_TIME" id="0375" size="6"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_PCGVER" id="0376" size="4"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMING" id="0377" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMEOUT" id="0378" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLURL" id="0380" size="2048"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_INFO" id="0381" size="8192"/>
+ <item name="D_BK_ID_REPROS_CENTERCOMM_STATE" id="0382" size="1"/>
+ <item name="D_BK_ID_REPROS_NA07_HISTORY_INFO" id="0385" size="169192"/>
+ <item name="D_BK_ID_REPROS_NA05_DOWNLOAD_SIZE" id="0387" size="8"/>
+ <item name="D_BK_ID_REPROS_FILE_PATH_INFO" id="0399" size="1024"/>
+ <item name="D_BK_ID_REPROS_UPDATE_FILE_EXIST" id="0401" size="4"/>
+ <item name="D_BK_ID_REPROS_CHECKFORUPDATE_TIME" id="0404" size="4"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEHISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEHISTORY" id="0233" size="4096"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEINFO" id="0234" size="33792"/>
+ </category>
+ <category name="D_BK_CA_CLOCK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_CLOCK_OFFSET" id="0240" size="16"/>
+ <item name="D_BK_ID_CLOCK_STATE" id="0241" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_SYNC_OFFSET" id="0242" size="256"/>
+ </category>
+ <category name="D_BK_CA_DIAG_INFORMATION" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAG_INFORMATION" id="0244" size="2560"/>
+ </category>
+ <category name="D_BK_CA_VS_VSDSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_VSDSRV_PARAMETER" id="0246" size="4096"/>
+ </category>
+ <category name="D_BK_CA_VS_ACNSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_ACNSRV_PARAMETER" id="0247" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_ASYNC_GRP" id="0248" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_SYNC_GRP" id="0249" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_PARAMETER" id="0250" size="256"/>
+ </category>
+ <category name="D_BK_CA_WLANM_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_WLANM_INFO" id="0254" size="1024"/>
+ </category>
+ <category name="D_BK_CA_BTSTK_LINKKEY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BTSTK_LINKKEY" id="0255" size="20480"/>
+ </category>
+ <category name="D_BK_CA_EOM_CONTENTS_STATUS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_EOM_CONTENTS_STATUS" id="0256" size="4"/>
+ </category>
+ <category name="D_BK_CA_UPDSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_UPDSERVICE_PARAMETER" id="0257" size="4096"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_RCV" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_RCV" id="0259" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_GENERAL_GRP" id="0260" size="512"/>
+ </category>
+ <category name="D_BK_CA_INFS_CLOCK_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_CLOCK_GRP" id="0262" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_HOME_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_HOME_GRP" id="0263" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_GRP" id="0264" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_VOL" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_VOL" id="0265" size="64"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_GRP" id="0266" size="384"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_GRP" id="0269" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_SMARTAGENT_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_SMARTAGENT_GRP" id="0273" size="128"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_DISC_SETTING" id="0279" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_SETTING" id="0280" size="32"/>
+ <item name="D_BK_ID_MEDSRV_COM_SETTING" id="420" size="32"/>
+ </category>
+ <category name="D_BK_CA_GNDB_UPDATE_HISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GNDB_UPDATE_HISTORY" id="0281" size="400"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MEM" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_MEM" id="0282" size="9011200"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_EXTINFO" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_EXTINFO" id="0283" size="32"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_TRIPCNT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_TRIPCNT" id="0284" size="16"/>
+ </category>
+ <category name="D_BK_CA_PFDREC_FUNC" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_PFDREC_FUNC" id="0285" size="16"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_WORK_BUF" nand="false" backupDram="true" sync="false" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_WORK_BUF" id="0286" size="9068544"/>
+ </category>
+ <category name="D_BK_CA_AS__CWORD76_VOLUME" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_AS__CWORD76_VOLUME" id="0287" size="200"/>
+ </category>
+ <category name="D_BK_CA_KEYBOARD_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_KEYBOARD_PARAMETER" id="0296" size="8"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_LSM_DATA" id="0323" size="2048"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_SC_CONFIG_PARAMS" id="0324" size="64"/>
+ </category>
+ <category name="D_BK_CA_DBG_FILTER_SET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DBG_FILTER_SET" id="0346" size="240"/>
+ </category>
+ <category name="D_BK_CA_DCM_CNCT_EN" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DCM_CNCT_EN" id="0347" size="4"/>
+ </category>
+ <category name="D_BK_CA_RS_RSDDS_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_RSDDS_STATS" id="0359" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_UPDATE_DB_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_UPDATE_DB_STATS" id="0360" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_HISTORY_LIST" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_HISTORY_LIST" id="0361" size="2804"/>
+ </category>
+ <category name="D_BK_CA_RS_WC_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WC_INFO" id="0362" size="400"/>
+ </category>
+ <category name="D_BK_CA_RS_VIDCM_DEPLOYMENT_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_VIDCM_DEPLOYMENT_INFO" id="0363" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_DEALER_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_DEALER_INFO" id="0384" size="712"/>
+ </category>
+ <category name="D_BK_CA_MODEMANAGER_LASTMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODEMANAGER_LASTMODE" id="0396" size="512"/>
+ </category>
+ <category name="D_BK_CA_ASS_PARAMETER" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ASS_PARAMETER" id="0406" size="26384"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_N" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_N" id="0407" size="16"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_D" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_D" id="0408" size="8"/>
+ </category>
+ <category name="D_BK_CA_VR_SYNC_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VR_INPUT_AUDIO_DUMP" id="0258" size="4"/>
+ <item name="D_BK_ID_VR_PVR_FLAG" id="0364" size="4"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_MANAGEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_MANAGEINFO" id="0409" size="128"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__SYNC_GRP" id="0419" size="19433"/>
+ </category>
+ <category name="D_BK_CA_DIAG_DEVICEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAG_DEVICEINFO" id="0434" size="10240"/>
+ </category>
+ <category name="D_BK_CA_BT_PAIRING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_PAIRING" id="0435" size="102400"/>
+ </category>
+ <category name="D_BK_CA_TCS_LEARN_DICTIONARY" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_TCS_LEARN_DICTIONARY" id="437" size="2097152"/>
+ <item name="D_BK_ID_TCS_WNN_LEARN_DICTIONARY" id="438" size="1176004"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_FLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_FLAG" id="0443" size="4"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL_IMM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_LIST" id="0325" size="22896"/>
+ </category>
+ <category name="D_BK_CA_CON_CWORD57__INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CON_CWORD57__INFO" id="0445" size="256"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_DRAM_OFFSET" id="0447" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_METSRV_PARAMETER" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VS_METSRV_PARAMETER" id="0448" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MASK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_MASK" id="0449" size="4"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_SETTING" id="0472" size="64"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_ODOMETER" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_ODOMETER" id="0473" size="8"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_DIAGMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_DIAGMODE" id="0474" size="4"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__ASYNC_GRP" id="0475" size="19334"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__1TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__1TRIP_ASYNC_GRP" id="0476" size="99"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_ASYNC_GRP" id="0480" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_SYNC" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_SYNC_GRP" id="0481" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__TRIP_ASYNC_GRP" id="0482" size="19334"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_METER_TYPE" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_METER_TYPE" id="0483" size="1"/>
+ </category>
+ <category name="D_BK_CA_ADAS_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ADAS_SETTING" id="0484" size="512"/>
+ </category>
+</backup>
diff --git a/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA1_TE.xml b/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA1_TE.xml
new file mode 100755
index 0000000..a9d523a
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA1_TE.xml
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="D_BK_CA_VEHICLE_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_STABLE_DATA" id="0227" size="16"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_DRAMBKUP_DATA" id="0228" size="16"/>
+ </category>
+ <category name="D_BK_CA_DUMMYREAD_OFFSET" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DUMMYREAD_OFFSET" id="0229" size="512"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_PARAMETER" id="0230" size="4096"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_RESUME" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_MMCOM_RESUME" id="0231" size="53280"/>
+ <item name="D_BK_ID_MEDSRV_ITGP_RESUME" id="0274" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_DISC_RESUME" id="0275" size="1024"/>
+ <item name="D_BK_ID_MEDSRV__CWORD57__RESUME" id="0276" size="10656"/>
+ <item name="D_BK_ID_MEDSRV_BTA_RESUME" id="0277" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_RESUME" id="0278" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_SDVCOM_RESUME" id="0444" size="256"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEPARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEPARAM" id="0232" size="32"/>
+ <item name="D_BK_ID_REPROS_AUTO_UPDATE_CHECK" id="0372" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLID" id="0373" size="4"/>
+ <item name="D_BK_ID_REPROS_RESUME_TIME" id="0375" size="6"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_PCGVER" id="0376" size="4"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMING" id="0377" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMEOUT" id="0378" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLURL" id="0380" size="2048"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_INFO" id="0381" size="8192"/>
+ <item name="D_BK_ID_REPROS_CENTERCOMM_STATE" id="0382" size="1"/>
+ <item name="D_BK_ID_REPROS_NA07_HISTORY_INFO" id="0385" size="169192"/>
+ <item name="D_BK_ID_REPROS_NA05_DOWNLOAD_SIZE" id="0387" size="8"/>
+ <item name="D_BK_ID_REPROS_FILE_PATH_INFO" id="0399" size="1024"/>
+ <item name="D_BK_ID_REPROS_UPDATE_FILE_EXIST" id="0401" size="4"/>
+ <item name="D_BK_ID_REPROS_CHECKFORUPDATE_TIME" id="0404" size="4"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEHISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEHISTORY" id="0233" size="4096"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEINFO" id="0234" size="33792"/>
+ </category>
+ <category name="D_BK_CA_CLOCK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_CLOCK_OFFSET" id="0240" size="16"/>
+ <item name="D_BK_ID_CLOCK_STATE" id="0241" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_SYNC_OFFSET" id="0242" size="256"/>
+ </category>
+ <category name="D_BK_CA_DIAG_INFORMATION" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAG_INFORMATION" id="0244" size="2560"/>
+ </category>
+ <category name="D_BK_CA_VS_VSDSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_VSDSRV_PARAMETER" id="0246" size="4096"/>
+ </category>
+ <category name="D_BK_CA_VS_ACNSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_ACNSRV_PARAMETER" id="0247" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_ASYNC_GRP" id="0248" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_SYNC_GRP" id="0249" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_PARAMETER" id="0250" size="256"/>
+ </category>
+ <category name="D_BK_CA_WLANM_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_WLANM_INFO" id="0254" size="1024"/>
+ </category>
+ <category name="D_BK_CA_BTSTK_LINKKEY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BTSTK_LINKKEY" id="0255" size="20480"/>
+ </category>
+ <category name="D_BK_CA_EOM_CONTENTS_STATUS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_EOM_CONTENTS_STATUS" id="0256" size="4"/>
+ </category>
+ <category name="D_BK_CA_UPDSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_UPDSERVICE_PARAMETER" id="0257" size="4096"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_RCV" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_RCV" id="0259" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_GENERAL_GRP" id="0260" size="512"/>
+ </category>
+ <category name="D_BK_CA_INFS_CLOCK_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_CLOCK_GRP" id="0262" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_HOME_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_HOME_GRP" id="0263" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_GRP" id="0264" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_VOL" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_VOL" id="0265" size="64"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_GRP" id="0266" size="384"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_GRP" id="0269" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_SMARTAGENT_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_SMARTAGENT_GRP" id="0273" size="128"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_DISC_SETTING" id="0279" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_CDRIP_SETTING" id="0280" size="32"/>
+ <item name="D_BK_ID_MEDSRV_COM_SETTING" id="420" size="32"/>
+ </category>
+ <category name="D_BK_CA_GNDB_UPDATE_HISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GNDB_UPDATE_HISTORY" id="0281" size="400"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MEM" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_MEM" id="0282" size="9011200"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_EXTINFO" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_EXTINFO" id="0283" size="32"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_TRIPCNT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_TRIPCNT" id="0284" size="16"/>
+ </category>
+ <category name="D_BK_CA_PFDREC_FUNC" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_PFDREC_FUNC" id="0285" size="16"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_WORK_BUF" nand="false" backupDram="true" sync="false" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_WORK_BUF" id="0286" size="9068544"/>
+ </category>
+ <category name="D_BK_CA_AS__CWORD76_VOLUME" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_AS__CWORD76_VOLUME" id="0287" size="200"/>
+ </category>
+ <category name="D_BK_CA_KEYBOARD_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_KEYBOARD_PARAMETER" id="0296" size="8"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_LSM_DATA" id="0323" size="2048"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_SC_CONFIG_PARAMS" id="0324" size="64"/>
+ </category>
+ <category name="D_BK_CA_DBG_FILTER_SET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DBG_FILTER_SET" id="0346" size="240"/>
+ </category>
+ <category name="D_BK_CA_DCM_CNCT_EN" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DCM_CNCT_EN" id="0347" size="4"/>
+ </category>
+ <category name="D_BK_CA_RS_RSDDS_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_RSDDS_STATS" id="0359" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_UPDATE_DB_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_UPDATE_DB_STATS" id="0360" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_HISTORY_LIST" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_HISTORY_LIST" id="0361" size="2804"/>
+ </category>
+ <category name="D_BK_CA_RS_WC_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WC_INFO" id="0362" size="400"/>
+ </category>
+ <category name="D_BK_CA_RS_VIDCM_DEPLOYMENT_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_VIDCM_DEPLOYMENT_INFO" id="0363" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_DEALER_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_DEALER_INFO" id="0384" size="712"/>
+ </category>
+ <category name="D_BK_CA_MODEMANAGER_LASTMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODEMANAGER_LASTMODE" id="0396" size="512"/>
+ </category>
+ <category name="D_BK_CA_ASS_PARAMETER" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ASS_PARAMETER" id="0406" size="26384"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_N" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_N" id="0407" size="16"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_D" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_D" id="0408" size="8"/>
+ </category>
+ <category name="D_BK_CA_VR_SYNC_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VR_INPUT_AUDIO_DUMP" id="0258" size="4"/>
+ <item name="D_BK_ID_VR_PVR_FLAG" id="0364" size="4"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_MANAGEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_MANAGEINFO" id="0409" size="128"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__SYNC_GRP" id="0419" size="19433"/>
+ </category>
+ <category name="D_BK_CA_DIAG_DEVICEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAG_DEVICEINFO" id="0434" size="10240"/>
+ </category>
+ <category name="D_BK_CA_BT_PAIRING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_PAIRING" id="0435" size="102400"/>
+ </category>
+ <category name="D_BK_CA_TCS_LEARN_DICTIONARY" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_TCS_LEARN_DICTIONARY" id="437" size="2097152"/>
+ <item name="D_BK_ID_TCS_WNN_LEARN_DICTIONARY" id="438" size="1176004"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_FLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_FLAG" id="0443" size="4"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL_IMM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_LIST" id="0325" size="22896"/>
+ </category>
+ <category name="D_BK_CA_CON_CWORD57__INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CON_CWORD57__INFO" id="0445" size="256"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_DRAM_OFFSET" id="0447" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_METSRV_PARAMETER" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VS_METSRV_PARAMETER" id="0448" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MASK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_MASK" id="0449" size="4"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_SETTING" id="0472" size="64"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_ODOMETER" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_ODOMETER" id="0473" size="8"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_DIAGMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_DIAGMODE" id="0474" size="4"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__ASYNC_GRP" id="0475" size="19334"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__1TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__1TRIP_ASYNC_GRP" id="0476" size="99"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_ASYNC_GRP" id="0480" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_SYNC" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_SYNC_GRP" id="0481" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV__CWORD66__TRIP_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="60" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV__CWORD66__TRIP_ASYNC_GRP" id="0482" size="19334"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_METER_TYPE" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_METER_TYPE" id="0483" size="1"/>
+ </category>
+ <category name="D_BK_CA_ADAS_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ADAS_SETTING" id="0484" size="512"/>
+ </category>
+</backup>
diff --git a/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA2_T.xml b/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA2_T.xml
new file mode 100755
index 0000000..ec028ea
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA2_T.xml
@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="D_BK_CA_VEHICLE_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_STABLE_DATA" id="0227" size="16"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_DRAMBKUP_DATA" id="0228" size="16"/>
+ </category>
+ <category name="D_BK_CA_DUMMYREAD_OFFSET" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DUMMYREAD_OFFSET" id="0229" size="512"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_PARAMETER" id="0230" size="4096"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_RESUME" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_MMCOM_RESUME" id="0231" size="53280"/>
+ <item name="D_BK_ID_MEDSRV_ITGP_RESUME" id="0274" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_DISC_RESUME" id="0275" size="1024"/>
+ <item name="D_BK_ID_MEDSRV__CWORD57__RESUME" id="0276" size="10656"/>
+ <item name="D_BK_ID_MEDSRV_BTA_RESUME" id="0277" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_SDVCOM_RESUME" id="0444" size="256"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEPARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEPARAM" id="0232" size="32"/>
+ <item name="D_BK_ID_REPROS_AUTO_UPDATE_CHECK" id="0372" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLID" id="0373" size="4"/>
+ <item name="D_BK_ID_REPROS_RESUME_TIME" id="0375" size="6"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_PCGVER" id="0376" size="4"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMING" id="0377" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMEOUT" id="0378" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLURL" id="0380" size="2048"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_INFO" id="0381" size="8192"/>
+ <item name="D_BK_ID_REPROS_CENTERCOMM_STATE" id="0382" size="1"/>
+ <item name="D_BK_ID_REPROS_NA07_HISTORY_INFO" id="0385" size="169192"/>
+ <item name="D_BK_ID_REPROS_NA05_DOWNLOAD_SIZE" id="0387" size="8"/>
+ <item name="D_BK_ID_REPROS_FILE_PATH_INFO" id="0399" size="1024"/>
+ <item name="D_BK_ID_REPROS_UPDATE_FILE_EXIST" id="0401" size="4"/>
+ <item name="D_BK_ID_REPROS_CHECKFORUPDATE_TIME" id="0404" size="4"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEHISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEHISTORY" id="0233" size="4096"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEINFO" id="0234" size="33792"/>
+ </category>
+ <category name="D_BK_CA_CLOCK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_CLOCK_OFFSET" id="0240" size="16"/>
+ <item name="D_BK_ID_CLOCK_STATE" id="0241" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_SYNC_OFFSET" id="0242" size="256"/>
+ </category>
+ <category name="D_BK_CA_DIAG_INFORMATION" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAG_INFORMATION" id="0244" size="2560"/>
+ </category>
+ <category name="D_BK_CA_VS_VSDSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_VSDSRV_PARAMETER" id="0246" size="4096"/>
+ </category>
+ <category name="D_BK_CA_VS_ACNSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_ACNSRV_PARAMETER" id="0247" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_ASYNC_GRP" id="0248" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_SYNC_GRP" id="0249" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_PARAMETER" id="0250" size="256"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_FIX_CNT" nand="true" cacheDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_FIX_CNT" id="0251" size="16"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_ROLLOVER_CNT" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_ROLLOVER_CNT" id="0253" size="32"/>
+ </category>
+ <category name="D_BK_CA_WLANM_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_WLANM_INFO" id="0254" size="1024"/>
+ </category>
+ <category name="D_BK_CA_BTSTK_LINKKEY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BTSTK_LINKKEY" id="0255" size="20480"/>
+ </category>
+ <category name="D_BK_CA_UPDSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_UPDSERVICE_PARAMETER" id="0257" size="4096"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_RCV" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_RCV" id="0259" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_GENERAL_GRP" id="0260" size="512"/>
+ </category>
+ <category name="D_BK_CA_INFS_CLOCK_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_CLOCK_GRP" id="0262" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_HOME_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_HOME_GRP" id="0263" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_GRP" id="0264" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_VOL" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_VOL" id="0265" size="64"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_GRP" id="0266" size="384"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_GRP" id="0269" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_SMARTAGENT_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_SMARTAGENT_GRP" id="0273" size="128"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_DISC_SETTING" id="0279" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_COM_SETTING" id="420" size="32"/>
+ </category>
+ <category name="D_BK_CA_GNDB_UPDATE_HISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GNDB_UPDATE_HISTORY" id="0281" size="400"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MEM" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_MEM" id="0282" size="9011200"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_EXTINFO" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_EXTINFO" id="0283" size="32"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_TRIPCNT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_TRIPCNT" id="0284" size="16"/>
+ </category>
+ <category name="D_BK_CA_PFDREC_FUNC" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_PFDREC_FUNC" id="0285" size="16"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_WORK_BUF" nand="false" backupDram="true" sync="false" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_WORK_BUF" id="0286" size="9068544"/>
+ </category>
+ <category name="D_BK_CA_AS__CWORD76_VOLUME" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_AS__CWORD76_VOLUME" id="0287" size="200"/>
+ </category>
+ <category name="D_BK_CA_KEYBOARD_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_KEYBOARD_PARAMETER" id="0296" size="8"/>
+ </category>
+ <category name="D_BK_CA_TOUCH" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_TOUCH_CONFIG" id="0300" size="32"/>
+ <item name="D_BK_ID_TOUCH_PARAMETER" id="0301" size="4"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_DCMFLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_DCMFLAG" id="0302" size="8"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG" id="0303" size="2048"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_ACCON_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_ACCON_CDF" id="0304" size="2048"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG_CDF" id="0305" size="2048"/>
+ </category>
+ <category name="D_BK_CA_GRA_AMFMHD_CTRL" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_AMFMHD_STATION_LIST" id="0321" size="13168"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_LSM_DATA" id="0323" size="2048"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_SC_CONFIG_PARAMS" id="0324" size="64"/>
+ </category>
+ <category name="D_BK_CA_GRA_SDARS_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_STATION_LIST" id="0326" size="45056"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_CATEGORY_LIST" id="0327" size="7168"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SMS_CFG" id="0365" size="65536"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_RADIO_ID" id="0405" size="16"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SUBSCRIPTION_STATUS" id="0439" size="8"/>
+ </category>
+ <category name="D_BK_CA_DBG_FILTER_SET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DBG_FILTER_SET" id="0346" size="240"/>
+ </category>
+ <category name="D_BK_CA_DCM_CNCT_EN" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DCM_CNCT_EN" id="0347" size="4"/>
+ </category>
+ <category name="D_BK_CA_RS_RSDDS_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_RSDDS_STATS" id="0359" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_UPDATE_DB_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_UPDATE_DB_STATS" id="0360" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_HISTORY_LIST" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_HISTORY_LIST" id="0361" size="2804"/>
+ </category>
+ <category name="D_BK_CA_RS_WC_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WC_INFO" id="0362" size="400"/>
+ </category>
+ <category name="D_BK_CA_RS_VIDCM_DEPLOYMENT_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_VIDCM_DEPLOYMENT_INFO" id="0363" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_DEALER_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_DEALER_INFO" id="0384" size="712"/>
+ </category>
+ <category name="D_BK_CA_MODEMANAGER_LASTMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODEMANAGER_LASTMODE" id="0396" size="512"/>
+ </category>
+ <category name="D_BK_CA_ASS_PARAMETER" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ASS_PARAMETER" id="0406" size="26384"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_N" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_N" id="0407" size="16"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_D" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_D" id="0408" size="8"/>
+ </category>
+ <category name="D_BK_CA_VR_SYNC_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VR_INPUT_AUDIO_DUMP" id="0258" size="4"/>
+ <item name="D_BK_ID_VR_PVR_FLAG" id="0364" size="4"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_MANAGEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_MANAGEINFO" id="0409" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAG_DEVICEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAG_DEVICEINFO" id="0434" size="10240"/>
+ </category>
+ <category name="D_BK_CA_BT_PAIRING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_PAIRING" id="0435" size="102400"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_SHUT_DOWN" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_FORECAST" id="0221" size="153600"/>
+ <item name="D_BK_ID_DTSERVICE_COORDINATE" id="0223" size="128"/>
+ <item name="D_BK_ID_DTSERVICE_AFLIST" id="0224" size="1024"/>
+ <item name="D_BK_ID_DTSERVICE_DOPPLER" id="0225" size="73728"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_IMMIEDIATELY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_CITYDB" id="0220" size="113664"/>
+ <item name="D_BK_ID_DTSERVICE_SETUP" id="0222" size="64"/>
+ <item name="D_BK_ID_DTSERVICE_WEATHER_HISTORY" id="0226" size="1024"/>
+ </category>
+ <category name="D_BK_CA_TCS_LEARN_DICTIONARY" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_TCS_LEARN_DICTIONARY" id="437" size="2097152"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_INFO" id="0442" size="8"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_FLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_FLAG" id="0443" size="4"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL_IMM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_LIST" id="0325" size="22896"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER1_LIST" id="0366" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER2_LIST" id="0367" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER3_LIST" id="0368" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER4_LIST" id="0369" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER5_LIST" id="0370" size="10240"/>
+ </category>
+ <category name="D_BK_CA_CON_CWORD57__INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CON_CWORD57__INFO" id="0445" size="256"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_DRAM_OFFSET" id="0447" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_METSRV_PARAMETER" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VS_METSRV_PARAMETER" id="0448" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MASK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_MASK" id="0449" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__USER_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD27__SETTING" id="0457" size="1024"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__SHARED_RAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD27__CONNECTION_MODE" id="0456" size="1024"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_SETTING" id="0472" size="64"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_ODOMETER" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_ODOMETER" id="0473" size="8"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_DIAGMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_DIAGMODE" id="0474" size="4"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_ASYNC_GRP" id="0480" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_SYNC" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_SYNC_GRP" id="0481" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_METER_TYPE" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_METER_TYPE" id="0483" size="1"/>
+ </category>
+ <category name="D_BK_CA_ADAS_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ADAS_SETTING" id="0484" size="512"/>
+ </category>
+</backup>
diff --git a/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA2_TE.xml b/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA2_TE.xml
new file mode 100755
index 0000000..f80637c
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/config/conf/backup/backup_AREA2_TE.xml
@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="D_BK_CA_VEHICLE_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_STABLE_DATA" id="0227" size="16"/>
+ </category>
+ <category name="D_BK_CA_VEHICLE_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VEHICLE_DRAMBKUP_DATA" id="0228" size="16"/>
+ </category>
+ <category name="D_BK_CA_DUMMYREAD_OFFSET" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DUMMYREAD_OFFSET" id="0229" size="512"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_PARAMETER" id="0230" size="4096"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_RESUME" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_MMCOM_RESUME" id="0231" size="53280"/>
+ <item name="D_BK_ID_MEDSRV_ITGP_RESUME" id="0274" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_DISC_RESUME" id="0275" size="1024"/>
+ <item name="D_BK_ID_MEDSRV__CWORD57__RESUME" id="0276" size="10656"/>
+ <item name="D_BK_ID_MEDSRV_BTA_RESUME" id="0277" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_SDVCOM_RESUME" id="0444" size="256"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEPARAM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEPARAM" id="0232" size="32"/>
+ <item name="D_BK_ID_REPROS_AUTO_UPDATE_CHECK" id="0372" size="1"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLID" id="0373" size="4"/>
+ <item name="D_BK_ID_REPROS_RESUME_TIME" id="0375" size="6"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_PCGVER" id="0376" size="4"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMING" id="0377" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_TIMEOUT" id="0378" size="2"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_DLURL" id="0380" size="2048"/>
+ <item name="D_BK_ID_REPROS_NA03OUT_UPDATE_INFO" id="0381" size="8192"/>
+ <item name="D_BK_ID_REPROS_CENTERCOMM_STATE" id="0382" size="1"/>
+ <item name="D_BK_ID_REPROS_NA07_HISTORY_INFO" id="0385" size="169192"/>
+ <item name="D_BK_ID_REPROS_NA05_DOWNLOAD_SIZE" id="0387" size="8"/>
+ <item name="D_BK_ID_REPROS_FILE_PATH_INFO" id="0399" size="1024"/>
+ <item name="D_BK_ID_REPROS_UPDATE_FILE_EXIST" id="0401" size="4"/>
+ <item name="D_BK_ID_REPROS_CHECKFORUPDATE_TIME" id="0404" size="4"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEHISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEHISTORY" id="0233" size="4096"/>
+ </category>
+ <category name="D_BK_CA_REPROS_UPDATEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_REPROS_UPDATEINFO" id="0234" size="33792"/>
+ </category>
+ <category name="D_BK_CA_CLOCK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_CLOCK_OFFSET" id="0240" size="16"/>
+ <item name="D_BK_ID_CLOCK_STATE" id="0241" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_SYNC_OFFSET" id="0242" size="256"/>
+ </category>
+ <category name="D_BK_CA_DIAG_INFORMATION" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAG_INFORMATION" id="0244" size="2560"/>
+ </category>
+ <category name="D_BK_CA_VS_VSDSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_VSDSRV_PARAMETER" id="0246" size="4096"/>
+ </category>
+ <category name="D_BK_CA_VS_ACNSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_ACNSRV_PARAMETER" id="0247" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_ASYNC_GRP" id="0248" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_SYNC" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VS_FUCSRV_SYNC_GRP" id="0249" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_PARAMETER" id="0250" size="256"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_FIX_CNT" nand="true" cacheDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_FIX_CNT" id="0251" size="16"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_ROLLOVER_CNT" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_ROLLOVER_CNT" id="0253" size="32"/>
+ </category>
+ <category name="D_BK_CA_WLANM_INFO" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_WLANM_INFO" id="0254" size="1024"/>
+ </category>
+ <category name="D_BK_CA_BTSTK_LINKKEY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BTSTK_LINKKEY" id="0255" size="20480"/>
+ </category>
+ <category name="D_BK_CA_UPDSERVICE_PARAMETER" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_UPDSERVICE_PARAMETER" id="0257" size="4096"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_RCV" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_RCV" id="0259" size="1"/>
+ </category>
+ <category name="D_BK_CA_INFS_GENERAL_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_GENERAL_GRP" id="0260" size="512"/>
+ </category>
+ <category name="D_BK_CA_INFS_CLOCK_GRP" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_INFS_CLOCK_GRP" id="0262" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_HOME_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_HOME_GRP" id="0263" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_GRP" id="0264" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_VOL" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_VOL" id="0265" size="64"/>
+ </category>
+ <category name="D_BK_CA_INFS_MENU_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_MENU_GRP" id="0266" size="384"/>
+ </category>
+ <category name="D_BK_CA_INFS_METERCOOP_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_METERCOOP_GRP" id="0269" size="128"/>
+ </category>
+ <category name="D_BK_CA_INFS_SMARTAGENT_GRP" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_SMARTAGENT_GRP" id="0273" size="128"/>
+ </category>
+ <category name="D_BK_CA_MEDSRV_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MEDSRV_DISC_SETTING" id="0279" size="1024"/>
+ <item name="D_BK_ID_MEDSRV_COM_SETTING" id="420" size="32"/>
+ </category>
+ <category name="D_BK_CA_GNDB_UPDATE_HISTORY" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_GNDB_UPDATE_HISTORY" id="0281" size="400"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MEM" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_MEM" id="0282" size="9011200"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_EXTINFO" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_EXTINFO" id="0283" size="32"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_TRIPCNT" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_TRIPCNT" id="0284" size="16"/>
+ </category>
+ <category name="D_BK_CA_PFDREC_FUNC" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_PFDREC_FUNC" id="0285" size="16"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_WORK_BUF" nand="false" backupDram="true" sync="false" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_WORK_BUF" id="0286" size="9068544"/>
+ </category>
+ <category name="D_BK_CA_AS__CWORD76_VOLUME" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_AS__CWORD76_VOLUME" id="0287" size="200"/>
+ </category>
+ <category name="D_BK_CA_KEYBOARD_PARAMETER" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_KEYBOARD_PARAMETER" id="0296" size="8"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_DCMFLAG" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_DCMFLAG" id="0302" size="8"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG" id="0303" size="2048"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_ACCON_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_ACCON_CDF" id="0304" size="2048"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_SRVFLAG_CDF" nand="true" cacheDram="true" sync="false" backupCycle="60" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_SRVFLAG_CDF" id="0305" size="2048"/>
+ </category>
+ <category name="D_BK_CA_GRA_AMFMHD_CTRL" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_AMFMHD_STATION_LIST" id="0321" size="13168"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_LSM_DATA" id="0323" size="2048"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_SC_CONFIG_PARAMS" id="0324" size="64"/>
+ </category>
+ <category name="D_BK_CA_GRA_SDARS_CTRL" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_STATION_LIST" id="0326" size="45056"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_CATEGORY_LIST" id="0327" size="7168"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SMS_CFG" id="0365" size="65536"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_RADIO_ID" id="0405" size="16"/>
+ <item name="D_BK_ID_NVM_ID_GRA_SDARS_SUBSCRIPTION_STATUS" id="0439" size="8"/>
+ </category>
+ <category name="D_BK_CA_DBG_FILTER_SET" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_DBG_FILTER_SET" id="0346" size="240"/>
+ </category>
+ <category name="D_BK_CA_DCM_CNCT_EN" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DCM_CNCT_EN" id="0347" size="4"/>
+ </category>
+ <category name="D_BK_CA_RS_RSDDS_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_RSDDS_STATS" id="0359" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_UPDATE_DB_STATS" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_UPDATE_DB_STATS" id="0360" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_WNG_HISTORY_LIST" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WNG_HISTORY_LIST" id="0361" size="2804"/>
+ </category>
+ <category name="D_BK_CA_RS_WC_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_WC_INFO" id="0362" size="400"/>
+ </category>
+ <category name="D_BK_CA_RS_VIDCM_DEPLOYMENT_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_RS_VIDCM_DEPLOYMENT_INFO" id="0363" size="1"/>
+ </category>
+ <category name="D_BK_CA_RS_DEALER_INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_RS_DEALER_INFO" id="0384" size="712"/>
+ </category>
+ <category name="D_BK_CA_MODEMANAGER_LASTMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_MODEMANAGER_LASTMODE" id="0396" size="512"/>
+ </category>
+ <category name="D_BK_CA_ASS_PARAMETER" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ASS_PARAMETER" id="0406" size="26384"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_N" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_N" id="0407" size="16"/>
+ </category>
+ <category name="D_BK_CA_DPSSERVICE_ASPECTSET_D" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DPSSERVICE_ASPECTSET_D" id="0408" size="8"/>
+ </category>
+ <category name="D_BK_CA_VR_SYNC_NAND" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_VR_INPUT_AUDIO_DUMP" id="0258" size="4"/>
+ <item name="D_BK_ID_VR_PVR_FLAG" id="0364" size="4"/>
+ </category>
+ <category name="D_BK_CA_CUSERVICE_MANAGEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CUSERVICE_MANAGEINFO" id="0409" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAG_DEVICEINFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAG_DEVICEINFO" id="0434" size="10240"/>
+ </category>
+ <category name="D_BK_CA_BT_PAIRING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_BT_PAIRING" id="0435" size="102400"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_SHUT_DOWN" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_FORECAST" id="0221" size="153600"/>
+ <item name="D_BK_ID_DTSERVICE_COORDINATE" id="0223" size="128"/>
+ <item name="D_BK_ID_DTSERVICE_AFLIST" id="0224" size="1024"/>
+ <item name="D_BK_ID_DTSERVICE_DOPPLER" id="0225" size="73728"/>
+ </category>
+ <category name="D_BK_CA_DTSERVICE_WRITE_AT_IMMIEDIATELY" nand="true" cacheDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DTSERVICE_CITYDB" id="0220" size="113664"/>
+ <item name="D_BK_ID_DTSERVICE_SETUP" id="0222" size="64"/>
+ <item name="D_BK_ID_DTSERVICE_WEATHER_HISTORY" id="0226" size="1024"/>
+ </category>
+ <category name="D_BK_CA_TCS_LEARN_DICTIONARY" nand="true" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_TCS_LEARN_DICTIONARY" id="437" size="2097152"/>
+ </category>
+ <category name="D_BK_CA_POS_GPS_TIME_SET_INFO" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_POS_GPS_TIME_SET_INFO" id="0442" size="8"/>
+ </category>
+ <category name="D_BK_CA_GRA_MSTR_CTRL_IMM" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_LIST" id="0325" size="22896"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER1_LIST" id="0366" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER2_LIST" id="0367" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER3_LIST" id="0368" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER4_LIST" id="0369" size="10240"/>
+ <item name="D_BK_ID_NVM_ID_GRA_MSTR_PRESET_USER5_LIST" id="0370" size="10240"/>
+ </category>
+ <category name="D_BK_CA_CON_CWORD57__INFO" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_CON_CWORD57__INFO" id="0445" size="256"/>
+ </category>
+ <category name="D_BK_CA__CWORD76__INFO_DRAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD76__INFO_DRAM_OFFSET" id="0447" size="256"/>
+ </category>
+ <category name="D_BK_CA_VS_METSRV_PARAMETER" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VS_METSRV_PARAMETER" id="0448" size="128"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_MASK" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_MASK" id="0449" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__USER_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD27__SETTING" id="0457" size="1024"/>
+ </category>
+ <category name="D_BK_CA__CWORD27__SHARED_RAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD27__CONNECTION_MODE" id="0456" size="1024"/>
+ </category>
+ <category name="D_BK_CA_INFS_VOICE_INTERRUPT_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_INFS_VOICE_INTERRUPT_SETTING" id="0472" size="64"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_ODOMETER" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_DIAGCODE_ODOMETER" id="0473" size="8"/>
+ </category>
+ <category name="D_BK_CA_DIAGCODE_DIAGMODE" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_DIAGCODE_DIAGMODE" id="0474" size="4"/>
+ </category>
+ <category name="D_BK_CA__CWORD28_AUTO_SHARED_RAM" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID__CWORD28_AUTO_CONNECTION_MODE" id="0477" size="1024"/>
+ </category>
+ <category name="D_BK_CA__CWORD28_AUTO_USER_DATA" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD28_AUTO_SETTING" id="0478" size="1024"/>
+ </category>
+ <category name="D_BK_CA__CWORD24_" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID__CWORD24_" id="0479" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_ASYNC" nand="true" backupDram="true" sync="false" backupCycle="15" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_ASYNC_GRP" id="0480" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VS_FUCSRV_HISTORY_SYNC" nand="true" backupDram="true" sync="true" encrypt="true">
+ <item name="D_BK_ID_VS_FUCSRV_HISTORY_SYNC_GRP" id="0481" size="1024"/>
+ </category>
+ <category name="D_BK_CA_VINFOSRV_METER_TYPE" nand="false" backupDram="true" sync="false" encrypt="false">
+ <item name="D_BK_ID_VINFOSRV_METER_TYPE" id="0483" size="1"/>
+ </category>
+ <category name="D_BK_CA_ADAS_SETTING" nand="true" backupDram="true" sync="true" encrypt="false">
+ <item name="D_BK_ID_ADAS_SETTING" id="0484" size="512"/>
+ </category>
+</backup>
diff --git a/video_in_hal/nsframework/backup_manager/config/createhdr.pl b/video_in_hal/nsframework/backup_manager/config/createhdr.pl
new file mode 100755
index 0000000..c282f7b
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/config/createhdr.pl
@@ -0,0 +1,84 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+sub getlist($$)
+{
+ my $xmlfile = shift(@_);
+ my $xpath = shift(@_);
+
+ $xmlfile =~ s/([\[\]\*\(\)])/\\$1/g;
+
+ open(my $rs, "xmllint --xpath \"$xpath\" $xmlfile |") or die "Cannot open $xmlfile:$!";
+ my $result = join('', <$rs>);
+ close $rs;
+ $result =~ s/^ +//;
+ my @result_array = split(/ +/, $result);
+ return @result_array;
+}
+
+if ($#ARGV < 0 || !(-f $ARGV[0])) {
+ print "No such file or directory.\n";
+ exit 1;
+}
+
+my @item_array = getlist($ARGV[0], '//item/@name');
+
+print<<'HEADER';
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ns_backup_id.h
+ * @brief backup id define
+ */
+
+#ifndef BACKUP_MANAGER_CONFIG_NS_BACKUP_ID_H_
+#define BACKUP_MANAGER_CONFIG_NS_BACKUP_ID_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup backup_manager
+ * @ingroup native_service
+ * @{
+ */
+
+HEADER
+
+foreach my $item (@item_array) {
+ if ($item =~ /^name="(.+)"$/) {
+ printf("#define %s \"%s\"\n", $1, $1);
+ }
+ else {
+ print "Invalid input:$item\n";
+ exit 1;
+ }
+}
+
+print<<'FOOTER';
+
+/**@}*/ // end of backup_manager
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
+
+#endif // BACKUP_MANAGER_CONFIG_NS_BACKUP_ID_H_
+FOOTER
+
+0;
diff --git a/video_in_hal/nsframework/backup_manager/config/sample.xml b/video_in_hal/nsframework/backup_manager/config/sample.xml
new file mode 100755
index 0000000..cbf6c7a
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/config/sample.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<backup>
+ <category name="NandUnsync" nand="true" cacheDram="true" sync="false">
+ <item name="NandUnsync_001" id="1000" size="4491"/>
+ <item name="NandUnsync_002" id="1001" size="18752"/>
+ </category>
+ <category name="NandCycle" nand="true" cacheDram="true" sync="false" backupCycle="30">
+ <item name="NandCycle_001" id="2000" size="32231"/>
+ <item name="NandCycle_002" id="2001" size="8353"/>
+ </category>
+ <category name="NandSync" nand="true" cacheDram="false" sync="true">
+ <item name="NandSync_001" id="3000" size="25120"/>
+ <item name="NandSync_002" id="3001" size="18187"/>
+ </category>
+ <category name="BackupOnly" backupDram="true">
+ <item name="BackupOnly_001" id="4000" size="657"/>
+ <item name="BackupOnly_002" id="4001" size="526"/>
+ </category>
+ <category name="CacheOnly" cacheDram="true">
+ <item name="CacheOnly_001" id="5000" size="8694"/>
+ <item name="CacheOnly_002" id="5001" size="2051"/>
+ </category>
+</backup>
diff --git a/video_in_hal/nsframework/backup_manager/config/uniqcheck.pl b/video_in_hal/nsframework/backup_manager/config/uniqcheck.pl
new file mode 100755
index 0000000..1470d7c
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/config/uniqcheck.pl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my @checkxpath = ('//item/@name', '//item/@id', '//category/@name');
+
+sub uniqcheck($$)
+{
+ my $xpath = shift(@_);
+ my $list = shift(@_);
+ my %u = ();
+ foreach my $key (@{$list}) {
+ if (exists($u{$key})) {
+ print "detect duplicate $xpath $key\n";
+ exit 1;
+ }
+ $u{$key} = 1;
+ }
+}
+
+sub getlist($$)
+{
+ my $xmlfile = shift(@_);
+ my $xpath = shift(@_);
+
+ $xmlfile =~ s/([\[\]\*\(\)])/\\$1/g;
+
+ open(my $rs, "xmllint --xpath \"$xpath\" $xmlfile |") or die "Cannot open $xmlfile:$!";
+ my $result = join('', <$rs>);
+ close $rs;
+ $result =~ s/^ +//;
+ my @result_array = split(/ +/, $result);
+ return @result_array;
+}
+
+if ($#ARGV < 0 || !(-f $ARGV[0])) {
+ print "No such file or directory.\n";
+ exit 1;
+}
+
+foreach my $xpath (@checkxpath) {
+ my @result_array = getlist($ARGV[0], $xpath);
+ uniqcheck($xpath, \@result_array);
+}
+
+0;
diff --git a/video_in_hal/nsframework/backup_manager/server/Makefile b/video_in_hal/nsframework/backup_manager/server/Makefile
new file mode 100755
index 0000000..7f9fa39
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/Makefile
@@ -0,0 +1,67 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### programs to be installed #############
+INST_PROGS := NS_BackupMgr
+
+######### sources to be compiled #############
+NS_BackupMgr_SRCS := backupmanager_main.cpp \
+ bkup_process.cpp \
+ bkup_param.cpp \
+ bkup_crc32.cpp \
+ backupmanager_application.cpp
+
+######### search paths #############
+VPATH += ./src ./include ../client/include/$(COMPONENT_NAME)
+
+######### include paths #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I../client/include
+CPPFLAGS += -I$(SDKTARGETSYSROOT)/usr/include/libxml2
+
+######### frameworkunifiedlog options #############
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### libraries to be linked(dynamic)#############
+LDLIBS += -Wl,-Bdynamic \
+ -lSS_SystemIfUnified \
+ -lNS_FrameworkUnified \
+ -lxml2 \
+ -lrt \
+ -lnv_hal \
+ -lvp
+
+######### other unit specific options #############
+LINK_CXX=Y
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+install-data: install_data
+
+install_data:
+ install -d -m 755 $(DESTDIR)/nv/BS/ns/backup_manager/rwdata
+
+include ../../native_service.mk
diff --git a/video_in_hal/nsframework/backup_manager/server/include/bkup_backupmanagerlog.h b/video_in_hal/nsframework/backup_manager/server/include/bkup_backupmanagerlog.h
new file mode 100755
index 0000000..9df4a1c
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/include/bkup_backupmanagerlog.h
@@ -0,0 +1,80 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_SERVER_INCLUDE_BKUP_BACKUPMANAGERLOG_H_
+#define BACKUP_MANAGER_SERVER_INCLUDE_BKUP_BACKUPMANAGERLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_APP ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ZONE_ALSA ZONEMASK(103)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "StateMachine Example"
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_TEXT_103 "Api"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_APP, ZONE_ERR, ZONE_WARN, ZONE_INFO, ZONE_ALSA
+#endif
+
+extern const CHAR kAppName[];
+
+#endif // BACKUP_MANAGER_SERVER_INCLUDE_BKUP_BACKUPMANAGERLOG_H_
diff --git a/video_in_hal/nsframework/backup_manager/server/include/bkup_crc32.h b/video_in_hal/nsframework/backup_manager/server/include/bkup_crc32.h
new file mode 100755
index 0000000..132ffdc
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/include/bkup_crc32.h
@@ -0,0 +1,22 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_SERVER_INCLUDE_BKUP_CRC32_H_
+#define BACKUP_MANAGER_SERVER_INCLUDE_BKUP_CRC32_H_
+
+uint32_t BkupCrc32(const void *data, size_t length);
+
+#endif // BACKUP_MANAGER_SERVER_INCLUDE_BKUP_CRC32_H_
diff --git a/video_in_hal/nsframework/backup_manager/server/include/bkup_param.h b/video_in_hal/nsframework/backup_manager/server/include/bkup_param.h
new file mode 100755
index 0000000..0a2dbb1
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/include/bkup_param.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PARAM_H_
+#define BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PARAM_H_
+
+typedef struct {
+ int id;
+ int size;
+ void *opt;
+ bool nand;
+ bool cache_dram;
+ bool backup_dram;
+ bool sync;
+ bool encrypt;
+ int backup_cycle;
+ char category_name[64];
+} bkup_query_result_t;
+
+int BckupParamInit(void);
+
+int BkupParamGet(const char *item_name, bkup_query_result_t *result);
+int BkupParamGetNumid(uint32_t num_id, bkup_query_result_t *result, char *item_name, size_t item_name_size);
+void *BkupParamSetOpt(const char *item_name, void *opt);
+
+#endif // BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PARAM_H_
diff --git a/video_in_hal/nsframework/backup_manager/server/include/bkup_process.h b/video_in_hal/nsframework/backup_manager/server/include/bkup_process.h
new file mode 100755
index 0000000..72ac7e1
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/include/bkup_process.h
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PROCESS_H_
+#define BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PROCESS_H_
+
+#include <native_service/frameworkunified_types.h>
+
+EFrameworkunifiedStatus BkupHandler(HANDLE h_app);
+
+EFrameworkunifiedStatus bkup_power_handler(HANDLE hApp);
+EFrameworkunifiedStatus BkupInitHandler(HANDLE h_app);
+EFrameworkunifiedStatus BkupTerminateHandler(HANDLE h_app);
+
+void *BkupNandThread(void *arg);
+void *BkupDelayThread(void *arg);
+
+#endif // BACKUP_MANAGER_SERVER_INCLUDE_BKUP_PROCESS_H_
diff --git a/video_in_hal/nsframework/backup_manager/server/include/bkup_util.h b/video_in_hal/nsframework/backup_manager/server/include/bkup_util.h
new file mode 100755
index 0000000..78494fa
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/include/bkup_util.h
@@ -0,0 +1,53 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BACKUP_MANAGER_SERVER_INCLUDE_BKUP_UTIL_H_
+#define BACKUP_MANAGER_SERVER_INCLUDE_BKUP_UTIL_H_
+
+#include <sys/mman.h>
+#include <ctime>
+#include <cstring>
+
+static inline size_t BkupStrlcpy(char *dst, const char *src, size_t siz) {
+ size_t ret = strlen(src);
+ if (dst == NULL) {
+ return -1;
+ }
+ if (src == NULL) {
+ return -1;
+ }
+ if (siz) { // LCOV_EXCL_BR_LINE 6:double check
+ size_t len = (ret >= siz) ? siz - 1 : ret; // LCOV_EXCL_BR_LINE 11:unexpected branch
+ memcpy(dst, src, len);
+ dst[len] = '\0';
+ }
+ return ret;
+}
+
+static inline char *BkupAnonMmap(size_t size) {
+ char *map = static_cast<char *>(mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
+ return map;
+}
+
+static inline uint64_t BkupTimerReal(void) {
+ struct timespec ts;
+ if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts) != -1) { // LCOV_EXCL_BR_LINE 5:clock_gettime's error case.
+ return (uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec;
+ }
+ return -1;
+}
+
+#endif // BACKUP_MANAGER_SERVER_INCLUDE_BKUP_UTIL_H_
diff --git a/video_in_hal/nsframework/backup_manager/server/src/backupmanager_application.cpp b/video_in_hal/nsframework/backup_manager/server/src/backupmanager_application.cpp
new file mode 100755
index 0000000..c08e725
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/src/backupmanager_application.cpp
@@ -0,0 +1,277 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <native_service/ns_backup.h>
+#include <agl_thread.h>
+#include <system_service/ss_system_if.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <native_service/frameworkunified_multithreading.h>
+
+#include <nv_hal.h>
+#include <signal.h>
+#include <cerrno>
+#include <cstdio>
+#include "bkup_api.h"
+#include "bkup_param.h"
+#include "bkup_backupmanagerlog.h"
+#include "bkup_process.h"
+
+pthread_t g_work_thread_id = 0;
+pthread_t g_delay_thread_id = 0;
+pthread_t g_nand_thread_id = 0;
+HANDLE g_msg_handle_thread = NULL;
+
+typedef void (* signal_handler)(int);
+
+void SignalHandlerFuncForMsgHandleThread(int signum) {
+ pthread_exit(0);
+}
+
+EFrameworkunifiedStatus MsgHandleThreadStart(HANDLE h_app) {
+ signal_handler p_signal = SignalHandlerFuncForMsgHandleThread;
+ signal(SIGUSR1, p_signal);
+
+ g_work_thread_id = pthread_self();
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedAttachCallbackToDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, BACKUP_CID, BkupHandler)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedAttachCallbacksToDispatcher e_status:%d\n", e_status);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ return e_status;
+}
+
+EFrameworkunifiedStatus MsgHandleThreadStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ pthread_attr_t t_attr;
+ pthread_t t;
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedRegisterServiceAvailabilityNotification(h_app, NTFY_BackupMgr_Availability)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedRegisterServiceAvailabilityNotification e_status:%d\n", e_status);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ if (pthread_attr_init(&t_attr) < 0) { // LCOV_EXCL_BR_LINE 5:pthread_attr_init's error case.
+ // LCOV_EXCL_START 5:pthread_attr_init's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_attr_init:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5:pthread_attr_init's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5:pthread_attr_setinheritsched's error case.
+ if (pthread_attr_setinheritsched(&t_attr, PTHREAD_INHERIT_SCHED) < 0) {
+ // LCOV_EXCL_BR_STOP 5:pthread_attr_setinheritsched's error case.
+ // LCOV_EXCL_START 5:pthread_attr_setinheritsched's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_attr_setinheritsched:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5:pthread_attr_setinheritsched's error case.
+ }
+
+ if (pthread_create(&t, &t_attr, BkupNandThread, NULL) < 0) { // LCOV_EXCL_BR_LINE 5:pthread_create's error case.
+ // LCOV_EXCL_START 5:pthread_create's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_create:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5:pthread_create's error case.
+ }
+
+ if (pthread_create(&t, &t_attr, BkupDelayThread, NULL) < 0) { // LCOV_EXCL_BR_LINE 5:pthread_create's error case.
+ // LCOV_EXCL_START 5:pthread_create's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_create:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5:pthread_create's error case.
+ }
+
+ e_status = InitNv();
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "InitNv e_status:%d", e_status);
+ exit(EXIT_FAILURE);
+ }
+
+ if (BckupParamInit() < 0) { // LCOV_EXCL_BR_LINE 5:C API's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ exit(EXIT_FAILURE); // LCOV_EXCL_LINE 5:C API's error case.
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedAttachCallbackToDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, BACKUP_CID, BkupHandler)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedAttachCallbacksToDispatcher e_status:%d\n", e_status);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+
+ g_msg_handle_thread = FrameworkunifiedCreateChildThread(h_app, SERVICE_BACKUP_MANAGER_MSG_HANDLE_THREAD, MsgHandleThreadStart, MsgHandleThreadStop); // LCOV_EXCL_BR_LINE 11:Unexpected branch // NOLINT (whitespace/line_length)
+ if (g_msg_handle_thread == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 4: NSFW error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Fail to create SERVICE_BACKUP_MANAGER_MSG_HANDLE_THREAD");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ if (eFrameworkunifiedStatusOK != (e_status = FrameworkunifiedStartChildThread(h_app, g_msg_handle_thread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT (whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start SERVICE_BACKUP_MANAGER_MSG_HANDLE_THREAD. Status:%#x", e_status); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT (whitespace/line_length)
+ }
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedSubscribeNotificationWithCallback(h_app,
+ NTFY_SSSystemMgrPowerOnOff,
+ bkup_power_handler)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSubscribeNotificationWithCallback eStatus:%d", e_status); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT (whitespace/line_length)
+ }
+
+ e_status = BkupInitHandler(h_app); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedPublishServiceAvailability(h_app, TRUE)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedPublishServiceAvailability e_status:%d\n", e_status);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ return e_status;
+}
+
+// LCOV_EXCL_START 14 Resident process, not called by NSFW
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 14 Resident process, not called by NSFW
+
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = BkupTerminateHandler(h_app);
+
+ if (FrameworkunifiedPublishServiceAvailability(h_app, FALSE) != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 15:marco defined in "native_service/ns_logger_if.h"
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedPublishServiceAvailability fail\n");
+ // LCOV_EXCL_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if (eFrameworkunifiedStatusOK == (FrameworkunifiedStopChildThread(h_app, g_msg_handle_thread, 0, NULL))) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ FrameworkunifiedDestroyChildThread(h_app, g_msg_handle_thread);
+ g_msg_handle_thread = NULL;
+ }
+
+ int ret2 = pthread_kill(g_work_thread_id, SIGUSR1);
+ if (ESRCH == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "thread is already exit !");
+ } else if (EINVAL == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "signal is invalid !");
+ } else {
+ pthread_join(g_work_thread_id, NULL);
+ }
+
+ ret2 = pthread_kill(g_nand_thread_id, SIGUSR1);
+ if (ESRCH == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "thread is already exit !");
+ } else if (EINVAL == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "signal is invalid !");
+ } else {
+ pthread_join(g_nand_thread_id, NULL);
+ }
+
+ ret2 = pthread_kill(g_delay_thread_id, SIGUSR1);
+ if (ESRCH == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "thread is already exit !");
+ } else if (EINVAL == ret2) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "signal is invalid !");
+ } else {
+ pthread_join(g_delay_thread_id, NULL);
+ }
+
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 7:debug code
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "called");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 7:debug code
diff --git a/video_in_hal/nsframework/backup_manager/server/src/backupmanager_main.cpp b/video_in_hal/nsframework/backup_manager/server/src/backupmanager_main.cpp
new file mode 100755
index 0000000..f225524
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/src/backupmanager_main.cpp
@@ -0,0 +1,61 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <native_service/ns_version_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <agl_thread.h>
+#include <system_service/ss_system_if.h>
+#include <cerrno>
+#include <cstdio>
+#include "bkup_backupmanagerlog.h"
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(0, 0, 0); // NOLINT(readability/nolint).
+
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { // NOLINT(readability/nolint) The varable is used by FW
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+int main(int argc, char *argv[]) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ FrameworkunifiedDefaultCallbackHandler cb_funcs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cb_funcs);
+ FRAMEWORKUNIFIED_SET_ZONES();
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ EFrameworkunifiedStatus e_status = FrameworkunifiedDispatcherWithArguments(MN_NS_BACKUPMGR, argc, argv, &cb_funcs);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedDispatcherWithArguments: %d", e_status);
+ return EXIT_FAILURE;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ return EXIT_SUCCESS;
+} // LCOV_EXCL_BR_LINE 10:The final line
diff --git a/video_in_hal/nsframework/backup_manager/server/src/bkup_crc32.cpp b/video_in_hal/nsframework/backup_manager/server/src/bkup_crc32.cpp
new file mode 100755
index 0000000..f1d8449
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/src/bkup_crc32.cpp
@@ -0,0 +1,62 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstdio>
+#include "bkup_crc32.h"
+#include "bkup_util.h"
+
+/*
+ * CRC-32C lookup table
+ *
+ * Polynomial 0x1EDC6F41
+ */
+static const uint32_t kBkupCrc32Lookup[4][256] = {
+ {
+ },
+ {
+ },
+ {
+ },
+ {
+ }
+};
+
+/**
+ * compute CRC-32C (Slicing-by-4)
+ */
+uint32_t BkupCrc32(const void *data, size_t length) {
+ uint32_t crc = 0xFFFFFFFF;
+ const uint32_t *current = (const uint32_t *)data;
+
+ if (data == NULL) {
+ return -1;
+ }
+ while (length >= 4) {
+ uint32_t one = *current++ ^ crc;
+ crc = kBkupCrc32Lookup[0][(one >> 24) & 0xFF] ^
+ kBkupCrc32Lookup[1][(one >> 16) & 0xFF] ^
+ kBkupCrc32Lookup[2][(one >> 8) & 0xFF] ^
+ kBkupCrc32Lookup[3][one & 0xFF];
+ length -= 4;
+ }
+
+ const uint8_t *current_char = (const uint8_t *)current;
+ while (length-- > 0) {
+ crc = (crc >> 8) ^ kBkupCrc32Lookup[0][(crc & 0xFF) ^ *current_char++];
+ }
+
+ return ~crc;
+}
diff --git a/video_in_hal/nsframework/backup_manager/server/src/bkup_param.cpp b/video_in_hal/nsframework/backup_manager/server/src/bkup_param.cpp
new file mode 100755
index 0000000..900779b
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/src/bkup_param.cpp
@@ -0,0 +1,447 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <other_service/VP_GetEnv.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <libxml/xmlerror.h>
+#include <libxml/parser.h>
+#include <libxml/SAX2.h>
+#include <inttypes.h>
+#include <cerrno>
+#include <cstdio>
+#include <string>
+#include <map>
+#include <utility>
+#include "bkup_param.h"
+#include "bkup_backupmanagerlog.h"
+#include "bkup_util.h"
+
+#define BKUP_XML_PATH_MAX 100
+#define BKUP_XML_PATH "/usr/agl/conf/BS/ns/backup_manager/rodata/"
+#define BKUP_XML_PREFIX "backup_"
+#define BKUP_XML_EXTENSION ".xml"
+
+#define BKUP_AREA_1 "AREA1"
+#define BKUP_AREA_2 "AREA2"
+#define BKUP_BRAND_1 "BRAND1"
+#define BKUP_BRAND_2 "BRAND2"
+#define BKUP_GRADE_1 "GRADE1"
+#define BKUP_GRADE_2 "GRADE2"
+#define BKUP_DESTINATION_TYPE_AREA1_TE "AREA1_TE"
+#define BKUP_DESTINATION_TYPE_AREA1_L "AREA1_L"
+#define BKUP_DESTINATION_TYPE_AREA2_T "AREA2_T"
+#define BKUP_DESTINATION_TYPE_AREA2_TE "AREA2_TE"
+
+#define BKUP_DESTINATION_STR_MAX 10
+typedef struct {
+ char area[VP_MAX_LENGTH];
+ char brand[VP_MAX_LENGTH];
+ char grade[VP_MAX_LENGTH];
+ char destination[BKUP_DESTINATION_STR_MAX];
+} BkupDestinationTbl;
+
+const BkupDestinationTbl kDestinationTbl[] = {
+ // Destination:Area1
+ {BKUP_AREA_1, BKUP_BRAND_1, BKUP_GRADE_1, BKUP_DESTINATION_TYPE_AREA1_TE},
+ {BKUP_AREA_1, BKUP_BRAND_1, BKUP_GRADE_2, BKUP_DESTINATION_TYPE_AREA1_TE},
+ {BKUP_AREA_1, BKUP_BRAND_2, BKUP_GRADE_1, BKUP_DESTINATION_TYPE_AREA1_L},
+ {BKUP_AREA_1, BKUP_BRAND_2, BKUP_GRADE_2, BKUP_DESTINATION_TYPE_AREA1_L},
+ // Destination:Area2
+ {BKUP_AREA_2, BKUP_BRAND_1, BKUP_GRADE_1, BKUP_DESTINATION_TYPE_AREA2_TE},
+ {BKUP_AREA_2, BKUP_BRAND_1, BKUP_GRADE_2, BKUP_DESTINATION_TYPE_AREA2_TE},
+ {BKUP_AREA_2, BKUP_BRAND_2, BKUP_GRADE_1, BKUP_DESTINATION_TYPE_AREA2_T},
+ {BKUP_AREA_2, BKUP_BRAND_2, BKUP_GRADE_2, BKUP_DESTINATION_TYPE_AREA2_T},
+};
+
+typedef std::string Category;
+typedef struct {
+ bool nand;
+ bool cache_dram;
+ bool backup_dram;
+ bool sync;
+ bool encrypt;
+ int backup_cycle;
+} CategoryProperty;
+typedef std::map<Category, CategoryProperty> CategoryTable;
+
+typedef std::string Item;
+typedef struct {
+ int id;
+ int size;
+ void *opt;
+ Category category;
+} ItemProperty; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+typedef std::map<Item, ItemProperty> ItemTable;
+typedef std::map<int, Item> IdTable;
+
+typedef struct {
+ Category current;
+ CategoryTable category_table;
+ ItemTable item_table;
+ IdTable id_table;
+} BackupParams; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+static BackupParams *g_backup_params = NULL;
+
+static void StartElementNs(void *ctx, const xmlChar *localname,
+ const xmlChar *prefix, const xmlChar *uri,
+ int nb_namespaces, const xmlChar **namespaces,
+ int nb_attributes, int nb_defaulted,
+ const xmlChar **attributes) {
+ if (ctx == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "ctx is NULL");
+ return;
+ }
+ if (localname == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "localname is NULL");
+ return;
+ }
+ BackupParams *p_backup_params = static_cast<BackupParams *>(ctx);
+ std::string tag = (const char *)localname; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (tag.compare("backup") == 0) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // do nothing
+ } else if (tag.compare("category") == 0) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ CategoryProperty category_attr = {false, false, false, false, false, 0};
+ std::string category_name; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ for (int i = 0; i < nb_attributes; i++) {
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ std::string localname = (const char *)attributes[i * 5];
+ std::string value((const char *)attributes[i * 5 + 3], (const char *)attributes[i * 5 + 4]);
+ if (localname.compare("name") == 0) {
+ category_name = value;
+ } else if (localname.compare("nand") == 0) {
+ if (value.compare("true") == 0) {
+ category_attr.nand = true;
+ }
+ } else if (localname.compare("backupDram") == 0) {
+ if (value.compare("true") == 0) {
+ category_attr.backup_dram = true;
+ }
+ } else if (localname.compare("cacheDram") == 0) {
+ if (value.compare("true") == 0) {
+ category_attr.cache_dram = true;
+ }
+ } else if (localname.compare("sync") == 0) {
+ if (value.compare("true") == 0) {
+ category_attr.sync = true;
+ }
+ } else if (localname.compare("encrypt") == 0) {
+ if (value.compare("true") == 0) {
+ category_attr.encrypt = true;
+ }
+ } else if (localname.compare("backupCycle") == 0) {
+ category_attr.backup_cycle = atoi(value.c_str());
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Unknown attribute:%s", localname.c_str());
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ }
+
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ CategoryTable::iterator c_it = p_backup_params->category_table.find(category_name);
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ if (c_it != p_backup_params->category_table.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_START 200:Execute in server start period
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "duplicate category:%s", category_name.c_str());
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 200:Execute in server start period
+ }
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ p_backup_params->category_table.insert(std::make_pair(category_name, category_attr));
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ p_backup_params->current = category_name; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ } else if (tag.compare("item") == 0) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (p_backup_params->current.compare("") == 0) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_START 200:Execute in server start period
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Detect item before category");
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 200:Execute in server start period
+ }
+
+ ItemProperty item_property = {0, 0, NULL, p_backup_params->current}; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ std::string item_name; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ for (int i = 0; i < nb_attributes; i++) {
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ std::string localname = (const char *)attributes[i * 5];
+ std::string value((const char *)attributes[i * 5 + 3], (const char *)attributes[i * 5 + 4]);
+ if (localname.compare("name") == 0) {
+ item_name = value;
+ } else if (localname.compare("id") == 0) {
+ item_property.id = atoi(value.c_str());
+ } else if (localname.compare("size") == 0) {
+ item_property.size = atoi(value.c_str());
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Unknown attribute:%s", localname.c_str());
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ }
+
+ ItemTable::iterator i_it = p_backup_params->item_table.find(item_name); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (i_it != p_backup_params->item_table.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_START 200:Execute in server start period
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Duplicate item:%s", item_name.c_str());
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 200:Execute in server start period
+ }
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ p_backup_params->item_table.insert(std::make_pair(item_name, item_property));
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+
+ IdTable::iterator id_it = p_backup_params->id_table.find(item_property.id); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (id_it != p_backup_params->id_table.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_START 200:Execute in server start period
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Duplicate id:%d", item_property.id);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 200:Execute in server start period
+ }
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ p_backup_params->id_table.insert(std::make_pair(item_property.id, item_name));
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Unknown tag:%s", localname);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+}
+
+static int BkupGetXmlPath(char* path) {
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6:Excluded as no NULL is currently passed
+ // LCOV_EXCL_START 6:Excluded as no NULL is currently passed
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "path is NULL");
+ return -1;
+ // LCOV_EXCL_STOP 6:Excluded as no NULL is currently passed
+ }
+ memset(path, 0, BKUP_XML_PATH_MAX);
+ char param_area[VP_MAX_LENGTH] = "";
+ VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_AREA, param_area);
+ char param_brand[VP_MAX_LENGTH] = "";
+ VP_GetEnv(VEHICLEPARAMETERLIBRARY_BRAND, param_brand);
+ char param_grade[VP_MAX_LENGTH] = "";
+ VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_GRADE, param_grade);
+
+ bool is_match = false;
+ for (uint16_t i = 0; i < _countof(kDestinationTbl); i++) {
+ size_t area_size = static_cast<size_t>(std::string(kDestinationTbl[i].area).size());
+ // Check vehicle parameter settings (For VP_VEHICLEPARAMETERLIBRALY_AREA only, check the area size of tbl to check the character strings common to each area)
+ if ((strncmp(param_area, kDestinationTbl[i].area, area_size) == 0) &&
+ (strncmp(param_brand, kDestinationTbl[i].brand, sizeof(param_area)) == 0) &&
+ (strncmp(param_grade, kDestinationTbl[i].grade, sizeof(param_area)) == 0)) {
+ is_match = true;
+ snprintf(path, BKUP_XML_PATH_MAX, "%s%s%s%s", BKUP_XML_PATH, BKUP_XML_PREFIX,
+ kDestinationTbl[i].destination, BKUP_XML_EXTENSION);
+ break;
+ }
+ }
+ if (is_match == false) {
+ // If the destination settings do not match, set the AREA2_T path as failsafe
+ snprintf(path, BKUP_XML_PATH_MAX, "%s%s%s%s", BKUP_XML_PATH, BKUP_XML_PREFIX,
+ BKUP_DESTINATION_TYPE_AREA2_T, BKUP_XML_EXTENSION);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Unexpected VP area[%s] brand[%s] grade[%s]",
+ param_area, param_brand, param_grade);
+ }
+ return 0;
+}
+
+int BckupParamInit(void) {
+ int ret = -1;
+ xmlParserCtxtPtr xmlctx;
+ xmlSAXHandler saxh;
+ xmlDocPtr doc;
+ int fd = -1;
+ struct stat sb;
+ char *map = NULL;
+ uint64_t start, end;
+
+ g_backup_params = new BackupParams; // LCOV_EXCL_BR_LINE 11:except,C++ operator
+
+ LIBXML_TEST_VERSION // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ xmlInitParser(); // NOLINT(readability/nolint) Defined in library of libxml
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+
+ memset(&saxh, 0, sizeof(saxh));
+ saxh.initialized = XML_SAX2_MAGIC;
+ saxh.startElementNs = StartElementNs;
+
+ xmlctx = xmlCreatePushParserCtxt(&saxh, g_backup_params, NULL, 0, NULL); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ char xml_path[BKUP_XML_PATH_MAX] = {0};
+ ret = BkupGetXmlPath(xml_path);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6:Excluded because the return value does not cause an error
+ // LCOV_EXCL_START 6:Excluded because the return value does not cause an error
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "BkupGetXmlPath Error");
+ goto exit;
+ // LCOV_EXCL_STOP 6:Excluded because the return value does not cause an error
+ }
+
+ if ((fd = open(xml_path, O_RDONLY)) < 0) { // LCOV_EXCL_BR_LINE 5:open's error case.
+ // LCOV_EXCL_START 5:open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "open:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5:open's error case.
+ }
+ if (fstat(fd, &sb) < 0) { // LCOV_EXCL_BR_LINE 5:fstat's error case.
+ // LCOV_EXCL_START 5:fstat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "fstat:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5:fstat's error case.
+ }
+ map = reinterpret_cast<char *>(mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0));
+ if (map == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ start = BkupTimerReal();
+ if (xmlParseChunk(xmlctx, map, static_cast<int>(sb.st_size), 1)) { // LCOV_EXCL_BR_LINE 5:xmlParseChunk's error case.
+ // LCOV_EXCL_START 5:xmlParseChunk's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ xmlParserError(xmlctx, "xmlParseChunk");
+ goto exit;
+ // LCOV_EXCL_STOP 5:xmlParseChunk's error case.
+ }
+ end = BkupTimerReal();
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "spent:%" PRIu64 ".%06" PRIu64 "ms",
+ static_cast<uint64_t>((end - start) / 1000000),
+ static_cast<uint64_t>((end - start) % 1000000));
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+
+ doc = xmlctx->myDoc;
+ xmlFreeParserCtxt(xmlctx); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ xmlFreeDoc(doc); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ xmlCleanupParser(); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ret = 0;
+
+exit:
+ if (fd >= 0) { // LCOV_EXCL_BR_LINE 5:open's error case.
+ if (close(fd) < 0) { // LCOV_EXCL_BR_LINE 5:close's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, "close:%s", strerror(errno)); // LCOV_EXCL_LINE 5:close's error case.
+ }
+ }
+ if (map) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ if (munmap(map, sb.st_size) < 0) { // LCOV_EXCL_BR_LINE 5:munmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, "munmap:%s", strerror(errno)); // LCOV_EXCL_LINE 5:munmap's error case.
+ }
+ }
+ return ret;
+}
+
+int BkupParamGet(const char *item_name, bkup_query_result_t *result) {
+ if (g_backup_params == NULL) { // LCOV_EXCL_BR_LINE 6:g_backup_params will not be NULL
+ // LCOV_EXCL_START 6:g_backup_params will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Uninitialize call");
+ return -1;
+ // LCOV_EXCL_STOP 6:g_backup_params will not be NULL
+ }
+ if (result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "result is NULL");
+ return -1;
+ }
+ ItemTable::iterator item_it = g_backup_params->item_table.find(item_name); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (item_it == g_backup_params->item_table.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ return -1;
+ }
+
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ CategoryTable::iterator category_it = g_backup_params->category_table.find(item_it->second.category);
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ if (category_it == g_backup_params->category_table.end()) { // LCOV_EXCL_BR_LINE 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 6:double check
+ }
+
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ result->id = item_it->second.id;
+ result->size = item_it->second.size;
+ result->opt = item_it->second.opt;
+ result->nand = category_it->second.nand;
+ result->cache_dram = category_it->second.cache_dram;
+ result->backup_dram = category_it->second.backup_dram;
+ result->sync = category_it->second.sync;
+ result->encrypt = category_it->second.encrypt;
+ result->backup_cycle = category_it->second.backup_cycle;
+ BkupStrlcpy(result->category_name, item_it->second.category.c_str(), sizeof(result->category_name));
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+
+ return 0;
+}
+
+int BkupParamGetNumid(uint32_t num_id, bkup_query_result_t *result,
+ char *item_name, size_t item_name_size) {
+ if (g_backup_params == NULL) { // LCOV_EXCL_BR_LINE 6:g_backup_params will not be NULL
+ // LCOV_EXCL_START 6:g_backup_params will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Uninitialize call");
+ return -1;
+ // LCOV_EXCL_STOP 6:g_backup_params will not be NULL
+ }
+
+ // LCOV_EXCL_BR_START 11:except,C++ STL
+ IdTable::iterator id_it = g_backup_params->id_table.find(static_cast<int>(num_id));
+ // LCOV_EXCL_BR_STOP 11:except,C++ STL
+ if (id_it == g_backup_params->id_table.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ return -1;
+ }
+ BkupStrlcpy(item_name, id_it->second.c_str(), item_name_size); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ return BkupParamGet(id_it->second.c_str(), result); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+}
+
+void *BkupParamSetOpt(const char *item_name, void *opt) {
+ if (g_backup_params == NULL) { // LCOV_EXCL_BR_LINE 6:g_backup_params will not be NULL
+ // LCOV_EXCL_START 6:g_backup_params will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Uninitialize call");
+ return reinterpret_cast<void *>((-1));
+ // LCOV_EXCL_STOP 6:g_backup_params will not be NULL
+ }
+
+ ItemTable::iterator item_it = g_backup_params->item_table.find(item_name); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (item_it == g_backup_params->item_table.end()) { // LCOV_EXCL_BR_LINE 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return reinterpret_cast<void *>((-1)); // LCOV_EXCL_LINE 6:double check
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ return __sync_val_compare_and_swap(&item_it->second.opt, NULL, opt); // NOLINT(readability/nolint) Supplied by gcc
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+}
diff --git a/video_in_hal/nsframework/backup_manager/server/src/bkup_process.cpp b/video_in_hal/nsframework/backup_manager/server/src/bkup_process.cpp
new file mode 100755
index 0000000..f8032ef
--- /dev/null
+++ b/video_in_hal/nsframework/backup_manager/server/src/bkup_process.cpp
@@ -0,0 +1,2497 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <inttypes.h>
+#include <mqueue.h>
+#include <agl_thread.h>
+#include <poll.h>
+#include <signal.h>
+#include <sys/epoll.h>
+#include <sys/eventfd.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/timerfd.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_system_manager_if.h>
+#include <nv_hal.h>
+#include <aglpath.h>
+#include <cerrno>
+#include <cstdio>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include "bkup_api.h"
+#include "bkup_backupmanagerlog.h"
+#include "bkup_param.h"
+#include "bkup_crc32.h"
+#include "bkup_util.h"
+
+#define BKUP_THREAD_NAND "NS_BkupNAND"
+#define BKUP_THREAD_DELAY "NS_BkupDelay"
+const char kBkupPrexixEncryption[] = "ENC_";
+const size_t kBkupPrexixEncryptionSize = 4;
+
+typedef void (* signal_handler)(int);
+extern void SignalHandlerFuncForMsgHandleThread(int signum);
+extern pthread_t g_delay_thread_id;
+extern pthread_t g_nand_thread_id;
+
+#define MAX_FD_EPOLL 8
+
+/**
+ * internal state
+ */
+typedef enum {
+ BKUP_STATE_INIT = 0,
+ BKUP_STATE_NORMAL,
+ BKUP_STATE_TERM,
+} bkup_state_t;
+static bkup_state_t g_bkup_internal_state = BKUP_STATE_INIT;
+
+
+/**
+ * delay thread command
+ */
+typedef enum {
+ BKUP_DELAY_CMD_TERM = 0,
+ BKUP_DELAY_CMD_PRE_ACCOFF,
+ BKUP_DELAY_CMD_REGIST,
+} bkup_delay_cmd_t;
+
+
+/**
+ * inter thread communication message
+ */
+typedef union {
+ struct {
+ char client_name[16];
+ uint32_t seq_id;
+ char *rcv_buf;
+ int rcv_size;
+ } nand;
+ struct {
+
+// bool terminate;
+ bkup_delay_cmd_t cmd;
+
+ int event_fd;
+ char item_name[64];
+ } delay;
+} bkup_itc_message_t;
+
+/**
+ * reference response function
+ */
+typedef struct {
+ int (*set_response)(void *, void *, int, EFrameworkunifiedStatus);
+ void *opt;
+} bkup_response_t;
+
+/**
+ * response MQ map(TLS)
+ */
+typedef std::map<std::string, HANDLE> g_bkup_response_mq_t;
+static __thread g_bkup_response_mq_t *g_bkup_response_mq;
+
+/**
+ * NAND thread itc MQ
+ */
+static mqd_t g_bkup_nand_mqd = -1;
+
+/**
+ * Delay thread itc MQ
+ */
+static mqd_t g_bkup_delay_mqd = -1;
+
+static int g_bkup_nand_tid;
+static int g_bkup_delay_tid;
+
+/**
+ * prototype declared
+ */
+static void BkupApilog(bkup_response_t *response, enum NvHalMedia current_media,
+ bkup_protocol_header_t *hdr,
+ bkup_query_result_t *query_result, char *buf,
+ uint32_t crc32, EFrameworkunifiedStatus ret_value);
+
+/**
+ * check status of file spicefied by path
+ */
+static int BkupCheckStatFromNv(enum NvHalMedia media, const char *path,
+ int check_size);
+
+/**
+ * rwlock unlock
+ */
+static inline void BkupRwlockUnlock(pthread_rwlock_t *rwlock, const char *path);
+
+/**
+ * rwlock read lock
+ */
+static inline void BkupRwlockRdlock(pthread_rwlock_t *rwlock, const char *path);
+
+/**
+ * rwlock write lock
+ */
+static inline void BkupRwlockWrlock(pthread_rwlock_t *rwlock, const char *path);
+
+/**\ingroup CheckNv
+ * \~english @par Brief
+ * Check the data stored on the storage device and check the data size.
+ * \~english @param [in] media
+ * enum NvHalMedia - Media type
+ * \~english @param [in] filename
+ * const char* - Concatenated string of "category name/item name"
+ * \~english @param [in] size
+ * uint32_t - Data size to be checked
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusFileLoadError The file does not exist.
+ * \~english @retval eFrameworkunifiedStatusAccessError Check size failed
+ * \~english @retval eFrameworkunifiedStatusInvldParam Parameter error
+ * \~english @par Preconditons
+ * - none
+ * \~english @par Conditions of processing failure
+ * - If the media (media) specified in the parameter is smaller than NVHALMEDIA_CACHEDRAM or larger than NVHALMEDIA_NAND.\n
+ * [eFrameworkunifiedStatusInvldParam]
+ * - The identifier specified in the arguments is a NULL.[eFrameworkunifiedStatusInvldParam]
+ * - When the size specified in the arguments is 0.[eFrameworkunifiedStatusInvldParam]
+ * - Internal I/O handling errors (lstat).[eFrameworkunifiedStatusFileLoadError]
+ * - The size specified by the parameter does not correspond to the file size specified by the identifier.[eFrameworkunifiedStatusAccessError]
+ */
+static EFrameworkunifiedStatus CheckNv(enum NvHalMedia media, const char *filename, uint32_t size) {
+ uint32_t size_;
+ EFrameworkunifiedStatus ret;
+ ret = GetSizeNv(media, filename, &size_); // Get size
+ if (ret != eFrameworkunifiedStatusOK) { // If the GetSizeNv fails, the error is returned unchanged.
+ return ret;
+ }
+ if (size_ != size) { // Returns eFrameworkunifiedStatusAccessError if the sizes do not match.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid size:%d\n", size);
+ return eFrameworkunifiedStatusAccessError;
+ }
+ return eFrameworkunifiedStatusOK; // Returns eFrameworkunifiedStatusOK if size matches
+}
+
+
+
+/**
+ * read file spicefied by id
+ *
+ * \retval 0 read success
+ * \retval -1 crc error
+ * \retval -2 read failed
+ * \retval -3 invalid param
+ */
+static int32_t BkupBufferReadFromNv(const enum NvHalMedia media, const char* path,
+ char *buf, size_t size, uint32_t *crc32) {
+ int32_t ret = 0;
+ EFrameworkunifiedStatus nv_ret = eFrameworkunifiedStatusFail;
+ const uint32_t size_all = static_cast<uint32_t>(size + sizeof(uint32_t));
+ void* buffer = MAP_FAILED;
+ uint8_t* read_buffer = NULL;
+ uint32_t calc_crc32, get_crc32;
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 6:double check
+ }
+
+ if (!buf) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "buf is NULL");
+ return -1;
+ }
+ if ((buffer = BkupAnonMmap(size_all)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:map failed");
+ ret = -1;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ read_buffer = reinterpret_cast<uint8_t*>(buffer);
+ nv_ret = ReadNv(media, path, read_buffer, size_all);
+ if (nv_ret == eFrameworkunifiedStatusOK) {
+ const void* const src_buffer = reinterpret_cast<void *>(read_buffer + size);
+ void* dest_buffer = reinterpret_cast<void *>(&get_crc32);
+ memcpy(dest_buffer, src_buffer, sizeof(uint32_t));
+ calc_crc32 = BkupCrc32(read_buffer, size); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (get_crc32 != calc_crc32) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "invalid crc(%s):%#x:%#x", path, get_crc32, calc_crc32);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = -1;
+ goto exit;
+ }
+ if (crc32 != NULL) {
+ *crc32 = get_crc32;
+ }
+ dest_buffer = reinterpret_cast<void *>(buf);
+ memcpy(dest_buffer, buffer, size);
+ } else if (nv_ret == eFrameworkunifiedStatusInvldParam) { // LCOV_EXCL_BR_LINE 6:double check
+ ret = -3;
+ } else {
+ ret = -2;
+ }
+exit:
+ if (buffer != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ munmap(buffer, size_all);
+ }
+
+ return ret;
+}
+
+/*
+ * buffer -> file write
+ */
+static int32_t BkupBufferWriteToNv(const enum NvHalMedia media, const char* path,
+ char *buf, size_t size, uint32_t *crc32) {
+ if (buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "buf is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ int32_t ret = 0;
+ EFrameworkunifiedStatus nv_ret = eFrameworkunifiedStatusFail;
+ const uint32_t size_all = static_cast<uint32_t>(size + sizeof(uint32_t));
+ char *buffer = reinterpret_cast<char *>(MAP_FAILED);
+ uint32_t calc_crc32;
+
+ if ((buffer = BkupAnonMmap(size_all)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ ret = -1;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ calc_crc32 = BkupCrc32(buf, size); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (crc32) {
+ *crc32 = calc_crc32;
+ }
+
+ memcpy(buffer, buf, size);
+ memcpy(buffer + size, &calc_crc32, sizeof(uint32_t));
+
+ nv_ret = WriteNv(media, path, reinterpret_cast<uint8_t *>(buffer), size_all);
+ if (nv_ret != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "write to nv(%s):%s", path, strerror(ret));
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ ret = -1;
+ }
+
+exit:
+ if (buffer != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ munmap(buffer, size_all);
+ }
+
+ return ret;
+}
+
+/**
+ * inter media copy
+ */
+static int BkupMediaCopyFromNv(char *category_name, const char *item_name,
+ enum NvHalMedia src, enum NvHalMedia dst,
+ pthread_rwlock_t *src_rwlock,
+ pthread_rwlock_t *dst_rwlock) {
+ if (category_name == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "category_name is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ if (item_name == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "item_name is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ int ret = -1;
+ uint32_t crc32;
+ char id_path[FILENAME_MAX] = {0};
+ char *buffer = reinterpret_cast<char *>(MAP_FAILED);
+
+ bkup_query_result_t query_result;
+ BkupParamGet(item_name, &query_result); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ char prefix_name[kBkupPrexixEncryptionSize + 1] = {0};
+ if (query_result.encrypt != false) {
+ strncpy(prefix_name, kBkupPrexixEncryption, kBkupPrexixEncryptionSize);
+ }
+ snprintf(id_path, FILENAME_MAX, "%s/%s%s", category_name, prefix_name, item_name);
+
+ if ((buffer = BkupAnonMmap(query_result.size)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:map failed");
+ ret = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ BkupRwlockRdlock(src_rwlock, id_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if ((ret = BkupBufferReadFromNv(src, id_path, buffer, query_result.size,
+ &crc32)) >= 0) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupRwlockWrlock(dst_rwlock, id_path);
+ ret = BkupBufferWriteToNv(dst, id_path, buffer, query_result.size, &crc32);
+ BkupRwlockUnlock(dst_rwlock, id_path);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+ BkupRwlockUnlock(src_rwlock, id_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+exit:
+ if (buffer != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ munmap(buffer, query_result.size);
+ }
+
+ return ret;
+}
+
+/**
+ * make backup path
+ */
+static int BkupMakeBkupPathToNvId(const char *category_name,
+ const char *item_name, char **path_buf,
+ int buf_size) {
+ int ret = -1;
+ char prefix_name[kBkupPrexixEncryptionSize + 1] = {0};
+
+ if ((*path_buf = BkupAnonMmap(buf_size)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+ bkup_query_result_t query_result;
+ if (BkupParamGet(item_name, &query_result) < 0) { // LCOV_EXCL_BR_LINE 6:Excluded due to checking by upper-level function
+ // LCOV_EXCL_START 6:Excluded due to checking by upper-level function
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid item_name:%s", item_name);
+ goto exit;
+ // LCOV_EXCL_STOP 6:Excluded due to checking by upper-level function
+ }
+ if (query_result.encrypt != false) {
+ strncpy(prefix_name, kBkupPrexixEncryption, kBkupPrexixEncryptionSize);
+ }
+ snprintf(*path_buf, static_cast<size_t>(buf_size), "%s/%s%s",
+ category_name, prefix_name, item_name);
+ ret = 0;
+
+exit:
+ return ret;
+}
+
+/**
+ * delete data
+ */
+static int BkupDeleteDataFromNv(const enum NvHalMedia media, const char* const path) {
+ int ret = 0;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6:Excluded due to checking by upper-level function
+ // LCOV_EXCL_START 6:Excluded due to checking by upper-level function
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "path is NULL");
+ ret = -1;
+ return ret;
+ // LCOV_EXCL_STOP 6:Excluded due to checking by upper-level function
+ }
+ const size_t path_size = static_cast<size_t>(std::string(path).length());
+ if (path_size > FILENAME_MAX) { // LCOV_EXCL_BR_LINE 6:Excluded due to checking by upper-level function
+ // LCOV_EXCL_START 6:Excluded due to checking by upper-level function
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "path size error");
+ ret = -1;
+ return ret;
+ // LCOV_EXCL_STOP 6:Excluded due to checking by upper-level function
+ }
+
+ uint32_t size = 0;
+ e_status = GetSizeNv(media, path, &size);
+ if (e_status == eFrameworkunifiedStatusFileLoadError) {
+ // If the file does not exist, deleet it successfully
+ return ret;
+ } else if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "GetSizeNv e_status:%d\n", e_status);
+ ret = -1;
+ return ret;
+ } else {
+ // no proc
+ }
+
+ e_status = DeleteNv(media, path);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ ret = -1;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "DeleteNv e_status:%d\n", e_status);
+ }
+ return ret;
+}
+
+/**
+ * get rwlock
+ */
+static pthread_rwlock_t *BkupGetRwlock(const char *item_name,
+ enum NvHalMedia media,
+ bkup_query_result_t *query_result) {
+ int ret;
+ pthread_rwlock_t *rwlock, *org_rwlock;
+ pthread_rwlockattr_t attr;
+
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "query_result is NULL");
+ return NULL;
+ }
+
+ if (media != NVHALMEDIA_BACKUPDRAM || query_result->backup_dram == false || query_result->nand == false) {
+ return NULL;
+ }
+ // backupDram && nand
+ if (query_result->opt != NULL) {
+ return reinterpret_cast<pthread_rwlock_t *>(query_result->opt);
+ }
+
+ if ((ret = pthread_rwlockattr_init(&attr)) != 0) { // LCOV_EXCL_BR_LINE 5:pthread_rwlockattr_init's error case.
+ // LCOV_EXCL_START 5:pthread_rwlockattr_init's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlockattr_init:%s", strerror(ret));
+ return NULL;
+ // LCOV_EXCL_STOP 5:pthread_rwlockattr_init's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5:pthread_rwlockattr_setkind_np's error case.
+ if ((ret = pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)) != 0) {
+ // LCOV_EXCL_BR_STOP 5:pthread_rwlockattr_setkind_np's error case.
+ // LCOV_EXCL_START 5:pthread_rwlockattr_setkind_np's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlockattr_setkind_np:%s", strerror(ret));
+ return NULL;
+ // LCOV_EXCL_STOP 5:pthread_rwlockattr_setkind_np's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5:malloc's error case.
+ if ((rwlock = reinterpret_cast<pthread_rwlock_t *>(malloc(sizeof(pthread_rwlock_t)))) == NULL) {
+ // LCOV_EXCL_BR_STOP 5:malloc's error case.
+ // LCOV_EXCL_START 5:malloc's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "malloc failed");
+ return NULL;
+ // LCOV_EXCL_STOP 5:malloc's error case.
+ }
+
+ if ((ret = pthread_rwlock_init(rwlock, &attr)) != 0) { // LCOV_EXCL_BR_LINE 5:pthread_rwlock_init's error case.
+ // LCOV_EXCL_START 5:pthread_rwlock_init's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlock_init:%s", strerror(ret));
+ free(rwlock);
+ return NULL;
+ // LCOV_EXCL_STOP 5:pthread_rwlock_init's error case.
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ org_rwlock = reinterpret_cast<pthread_rwlock_t *>(BkupParamSetOpt(item_name, rwlock));
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (org_rwlock == reinterpret_cast<void *>(-1)) { // LCOV_EXCL_BR_LINE 6:org_rwlock will not be -1
+ // LCOV_EXCL_START 6:org_rwlock will not be -1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid item_name:%s", item_name != 0 ? item_name : NULL);
+ free(rwlock);
+ return NULL;
+ // LCOV_EXCL_STOP 6:org_rwlock will not be -1
+ } else if (org_rwlock != NULL) { // LCOV_EXCL_BR_LINE 5:gcc builtin function's error case
+ // conflict
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ free(rwlock); // LCOV_EXCL_LINE 5:gcc builtin function's error case
+ rwlock = org_rwlock; // LCOV_EXCL_LINE 5:gcc builtin function's error case
+ }
+
+ query_result->opt = rwlock;
+ return rwlock;
+}
+
+/**
+ * rwlock read lock
+ */
+static inline void BkupRwlockRdlock(pthread_rwlock_t *rwlock, const char *path) {
+ if (rwlock) {
+ int ret;
+ if ((ret = pthread_rwlock_rdlock(rwlock)) != 0) { // LCOV_EXCL_BR_LINE 5:pthread_rwlock_rdlock's error case.
+ // LCOV_EXCL_START 5:pthread_rwlock_rdlock's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlock_rdlock(%s):%s", path, strerror(ret));
+ // LCOV_EXCL_STOP 5:pthread_rwlock_rdlock's error case.
+ }
+ }
+}
+
+/**
+ * rwlock write lock
+ */
+static inline void BkupRwlockWrlock(pthread_rwlock_t *rwlock, const char *path) {
+ if (rwlock) {
+ int ret;
+ if ((ret = pthread_rwlock_wrlock(rwlock)) != 0) { // LCOV_EXCL_BR_LINE 5:pthread_rwlock_wrlock's error case.
+ // LCOV_EXCL_START 5:pthread_rwlock_wrlock's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlock_wrlock(%s):%s", path, strerror(ret));
+ // LCOV_EXCL_STOP 5:pthread_rwlock_wrlock's error case.
+ }
+ }
+}
+
+/**
+ * rwlock unlock
+ */
+static inline void BkupRwlockUnlock(pthread_rwlock_t *rwlock, const char *path) {
+ if (rwlock) {
+ int ret;
+ if ((ret = pthread_rwlock_unlock(rwlock)) != 0) { // LCOV_EXCL_BR_LINE 5:pthread_rwlock_unlock's error case.
+ // LCOV_EXCL_START 5:pthread_rwlock_unlock's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "pthread_rwlock_unlock(%s):%s", path, strerror(ret));
+ // LCOV_EXCL_STOP 5:pthread_rwlock_unlock's error case.
+ }
+ }
+}
+
+/**
+ * inter thread communication MQ open
+ */
+static mqd_t BkupItcMqopen(const char *mq_name, int flags) {
+ struct mq_attr attr;
+
+ if (mq_name == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "mq_name is NULL");
+ return -1;
+ }
+
+ attr.mq_flags = 0;
+ attr.mq_maxmsg = 256;
+ attr.mq_msgsize = sizeof(bkup_itc_message_t);
+
+ return mq_open(mq_name, flags, 0660, &attr);
+}
+
+/**
+ * write & rename
+ */
+static int BkupWriteRename(const char *category_name, const char *item_name,
+ enum NvHalMedia media, char *buf, int size,
+ pthread_rwlock_t *rwlock) {
+ int ret = -1;
+ char *full_path = reinterpret_cast<char *>(MAP_FAILED);
+
+ // LCOV_EXCL_BR_START 5:mmap's error case.
+ if (BkupMakeBkupPathToNvId(category_name, item_name, &full_path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ BkupRwlockWrlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (BkupBufferWriteToNv(media, full_path, buf, size, NULL) < 0) {
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ goto exit;
+ }
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ ret = size;
+
+exit:
+ if (full_path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ munmap(full_path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * stat check
+ *
+ * \retval 0 file exists
+ * \retval -1 file not exists
+ * \retval -2 size error
+ */
+static int BkupCheckStatFromNv(enum NvHalMedia media, const char *path,
+ int check_size) {
+ uint32_t size = check_size + static_cast<uint32_t>(sizeof(uint32_t));
+ const EFrameworkunifiedStatus ret = CheckNv(media, path, size);
+
+ if (path == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "path is NULL");
+ return -1;
+ }
+
+ if (eFrameworkunifiedStatusOK == ret) {
+ return 0;
+ } else if (eFrameworkunifiedStatusAccessError == ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CheckNv e_status:%d", ret);
+ return -2;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CheckNv e_status:%d", ret);
+ return -1;
+ }
+}
+
+/**
+ * media stat
+ */
+static int BkupMediaStat(const char *category_name, const char *item_name, enum NvHalMedia src, int size) {
+ int ret = -1;
+ char *path = reinterpret_cast<char *>(MAP_FAILED);
+
+ // LCOV_EXCL_BR_START 5:mmap's error case.
+ if (BkupMakeBkupPathToNvId(category_name, item_name, &path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+ ret = BkupCheckStatFromNv(src, path, size); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+exit:
+ if (path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ munmap(path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * stat check & read
+ *
+ * \retval 0 file exists
+ * \retval -1 file not exists
+ */
+static int BkupCheckStatRead(enum NvHalMedia current_media, const char *path,
+ char *buf, int check_size, uint32_t *crc32,
+ pthread_rwlock_t *rwlock) {
+ int ret;
+
+ if ((ret = BkupCheckStatFromNv(current_media, path, check_size)) < 0) {
+ return ret;
+ }
+
+ BkupRwlockRdlock(rwlock, path);
+
+ if (BkupBufferReadFromNv(current_media, path, buf, check_size, crc32) < 0) {
+ BkupRwlockUnlock(rwlock, path);
+ return -1;
+ }
+
+ BkupRwlockUnlock(rwlock, path);
+ return 0;
+}
+
+/**
+ * valid check
+ *
+ * \retval 0 file invalid & do nothing
+ * \retval -1 file invalid but create 0 fill file
+ * \retval 1 file valid
+ */
+static int BkupCheckRead(const char *path, enum NvHalMedia current_media,
+ bkup_protocol_command_t command, char *rcv_buf,
+ char *read_buf, uint32_t *crc32,
+ bkup_query_result_t *query_result,
+ pthread_rwlock_t *rwlock) {
+ int ret = -1;
+
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return 0;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return 0;
+ }
+
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+
+ if (BkupCheckStatRead(current_media, path, read_buf, query_result->size, crc32, rwlock) < 0) {
+ // file not exists
+ if (current_media == NVHALMEDIA_NAND || query_result->nand == false) {
+ goto exit;
+ } else {
+ if (command == BKUP_CMD_READ) {
+ /*
+ * Read
+ */
+ if (BkupCheckStatFromNv(NVHALMEDIA_NAND, path, query_result->size) == 0) {
+ // do nothing
+ ret = 0;
+ } else {
+ // take preference BackupDRAM or CacheDRAM
+ ret = -1;
+ }
+ } else {
+ /*
+ * Write/Fill
+ */
+ pthread_rwlock_t *nand_rwlock = BkupGetRwlock(hdr->item_name, NVHALMEDIA_NAND, query_result);
+ if (BkupCheckStatRead(NVHALMEDIA_NAND, path, read_buf, query_result->size, NULL, nand_rwlock) == 0) {
+ // write back cache
+ if (BkupWriteRename(query_result->category_name, hdr->item_name,
+ current_media, read_buf, query_result->size,
+ rwlock) >= 0) {
+ ret = 1;
+ } else {
+ // copy error, do nothing
+ ret = 0;
+ }
+ } else {
+ // take preference BackupDRAM or CacheDRAM
+ ret = -1;
+ }
+ }
+ goto exit;
+ }
+ }
+ ret = 1;
+exit:
+ return ret;
+}
+
+/**
+ * read command
+ */
+static int BkupCmdRead(bkup_response_t *response, enum NvHalMedia current_media,
+ char *rcv_buf, bkup_query_result_t *query_result) {
+ int ret = -1;
+ if (response == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "response is NULL");
+ return -1;
+ }
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return -1;
+ }
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *rwlock = BkupGetRwlock(hdr->item_name, current_media, query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ char *full_path = reinterpret_cast<char *>(MAP_FAILED);
+ char *buf = reinterpret_cast<char *>(MAP_FAILED);
+ size_t buf_size = 0;
+ uint32_t crc32 = 0;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ // LCOV_EXCL_BR_START 5:mmap's error case.
+ if (BkupMakeBkupPathToNvId(query_result->category_name, hdr->item_name, &full_path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+
+ if ((buf = BkupAnonMmap(query_result->size)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:mmap's error case.
+ // LCOV_EXCL_START 5:mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5:mmap's error case.
+ }
+ buf_size = query_result->size;
+
+ ret = BkupCheckRead(full_path, current_media, hdr->command, rcv_buf, buf,
+ &crc32, query_result, rwlock); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (ret == -1) {
+ // return all 0
+ ret = hdr->size;
+ goto exit;
+ } else if (ret == 0) {
+ // do nothing
+ goto exit;
+ }
+
+ // success
+ ret = hdr->size;
+
+ // caching to memory
+ if (current_media == NVHALMEDIA_NAND) {
+ if (query_result->cache_dram) {
+ if (BkupMediaStat(query_result->category_name, hdr->item_name,
+ NVHALMEDIA_CACHEDRAM, query_result->size) < 0) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *dst_rwlock =
+ BkupGetRwlock(hdr->item_name, NVHALMEDIA_CACHEDRAM, query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ BkupWriteRename(query_result->category_name, hdr->item_name,
+ NVHALMEDIA_CACHEDRAM, buf, query_result->size,
+ dst_rwlock); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ }
+ if (query_result->backup_dram) {
+ if (BkupMediaStat(query_result->category_name, hdr->item_name,
+ NVHALMEDIA_BACKUPDRAM, query_result->size) < 0) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *dst_rwlock =
+ BkupGetRwlock(hdr->item_name, NVHALMEDIA_BACKUPDRAM, query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ BkupWriteRename(query_result->category_name, hdr->item_name,
+ NVHALMEDIA_BACKUPDRAM, buf, query_result->size,
+ dst_rwlock); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ }
+ }
+
+exit:
+ if (ret != 0 && buf != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupApilog(response, current_media, hdr, query_result, buf, crc32, e_status);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((*response->set_response)(response->opt, buf + hdr->offset, hdr->size, e_status) < 0) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -1; // LCOV_EXCL_LINE 4: NSFW error case
+ }
+ }
+
+ if (full_path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(full_path, FILENAME_MAX);
+ }
+ if (buf != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(buf, buf_size);
+ }
+ return ret;
+}
+
+/**
+ * write command
+ */
+static int BkupCmdWrite(bkup_response_t *response,
+ enum NvHalMedia current_media, char *rcv_buf,
+ bkup_query_result_t *query_result) {
+ int ret = -1;
+
+ if (response == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "response is NULL");
+ return -1;
+ }
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return -1;
+ }
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *rwlock = BkupGetRwlock(hdr->item_name, current_media, query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ char *full_path = reinterpret_cast<char *>(MAP_FAILED);
+ char *buf = reinterpret_cast<char *>(MAP_FAILED);
+ char *header = NULL;
+ uint32_t crc32 = 0;
+ int buf_size = 0;
+
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if (BkupMakeBkupPathToNvId(query_result->category_name, hdr->item_name, &full_path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit; // LCOV_EXCL_LINE 5: mmap's error case.
+ }
+
+ if (hdr->offset != 0 || hdr->size != (uint32_t)query_result->size) {
+ /*
+ * partial write
+ */
+ if ((buf = BkupAnonMmap(query_result->size)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ buf_size = query_result->size;
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupCheckRead(full_path, current_media, hdr->command, rcv_buf, buf, NULL, query_result, rwlock);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (ret == 0) {
+ // do nothing
+ goto exit;
+ }
+
+ header = buf;
+ memcpy(buf + hdr->offset, rcv_buf + sizeof(bkup_protocol_header_t), hdr->size);
+ BkupRwlockWrlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (BkupBufferWriteToNv(current_media, full_path, buf, query_result->size, &crc32) < 0) {
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ goto exit;
+ }
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ /*
+ * whole write
+ */
+ header = rcv_buf + sizeof(bkup_protocol_header_t);
+ BkupRwlockWrlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (BkupBufferWriteToNv(current_media, full_path,
+ rcv_buf + sizeof(bkup_protocol_header_t), hdr->size, &crc32) < 0) {
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ goto exit;
+ }
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ // success
+ ret = hdr->size;
+
+exit:
+ EFrameworkunifiedStatus e_status = ret < 0 ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+ if (current_media == NVHALMEDIA_NAND) {
+ if (query_result->cache_dram == false && query_result->backup_dram == false) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupApilog(response, current_media, hdr, query_result, header, crc32, e_status);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+ if ((*response->set_response)(response->opt, NULL, 0, e_status) < 0) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -1; // LCOV_EXCL_LINE 4: NSFW error case
+ }
+ } else {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupApilog(response, current_media, hdr, query_result, header, crc32, e_status);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+
+ if (buf != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(buf, buf_size);
+ }
+ if (full_path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(full_path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * fill command
+ */
+static int BkupCmdFill(bkup_response_t *response, enum NvHalMedia current_media,
+ char *rcv_buf, bkup_query_result_t *query_result) {
+ int ret = -1;
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *rwlock = BkupGetRwlock(hdr->item_name, current_media, query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ char *full_path = reinterpret_cast<char *>(MAP_FAILED);
+ char *buf = reinterpret_cast<char *>(MAP_FAILED);
+ uint32_t crc32 = 0;
+
+ if (response == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "response is NULL");
+ return -1;
+ }
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return -1;
+ }
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if (BkupMakeBkupPathToNvId(query_result->category_name, hdr->item_name, &full_path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit; // LCOV_EXCL_LINE 5: mmap's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if ((buf = BkupAnonMmap(query_result->size)) == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+
+ if (hdr->offset != 0 || hdr->size != (uint32_t)query_result->size) {
+ /*
+ * partial fill
+ */
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupCheckRead(full_path, current_media, hdr->command, rcv_buf, buf, NULL, query_result, rwlock);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (ret == 0) {
+ // do nothing
+ goto exit;
+ }
+ }
+
+ memset(buf + hdr->offset, hdr->fill_patern, hdr->size);
+ BkupRwlockWrlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (BkupBufferWriteToNv(current_media, full_path, buf, query_result->size, &crc32) < 0) {
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ goto exit;
+ }
+ BkupRwlockUnlock(rwlock, full_path); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ // success
+ ret = hdr->size;
+
+exit:
+ EFrameworkunifiedStatus e_status = ret < 0 ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+ if (current_media == NVHALMEDIA_NAND) {
+ if (query_result->cache_dram == false && query_result->backup_dram == false) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupApilog(response, current_media, hdr, query_result, buf, crc32, e_status);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+ if ((*response->set_response)(response->opt, NULL, 0, e_status) < 0) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -1; // LCOV_EXCL_LINE 4: NSFW error case
+ }
+ } else {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupApilog(response, current_media, hdr, query_result, buf, crc32, e_status);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+
+ if (buf != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(buf, query_result->size);
+ }
+ if (full_path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(full_path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * copy command
+ */
+static int BkupCmdCopy(bkup_response_t *response, enum NvHalMedia current_media,
+ char *rcv_buf, bkup_query_result_t *query_result) {
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return -1;
+ }
+ bkup_protocol_header_t *hdr =
+ reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ pthread_rwlock_t *src_rwlock =
+ BkupGetRwlock(hdr->item_name, hdr->src_media, query_result);
+ pthread_rwlock_t *dst_rwlock =
+ BkupGetRwlock(hdr->item_name, current_media, query_result);
+
+ int ret = BkupMediaCopyFromNv(query_result->category_name, hdr->item_name, hdr->src_media, current_media, src_rwlock,
+ dst_rwlock);
+
+ if (response == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "response is NULL");
+ return -1;
+ }
+
+ if (current_media == NVHALMEDIA_NAND) {
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((*response->set_response)(response->opt, NULL, 0, ret < 0 ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK) < 0) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -1; // LCOV_EXCL_LINE 4: NSFW error case
+ }
+ }
+ return ret;
+}
+
+/**
+ * check command
+ */
+static int BkupCmdCheck(bkup_response_t *response,
+ enum NvHalMedia current_media, char *rcv_buf,
+ bkup_query_result_t *query_result) {
+ int ret = 0;
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ char *full_path = reinterpret_cast<char *>(MAP_FAILED);
+
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return -1;
+ }
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if (BkupMakeBkupPathToNvId(query_result->category_name, hdr->item_name, &full_path, FILENAME_MAX) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -3;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ ret = BkupCheckStatFromNv(current_media, full_path, query_result->size); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+exit:
+ if (full_path != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ munmap(full_path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * delete command
+ */
+static int BkupCmdDeleteData(bkup_response_t* const response,
+ const enum NvHalMedia current_media,
+ char* const rcv_buf,
+ bkup_query_result_t* const query_result) {
+ int ret = -1;
+ char *full_path = NULL;
+ bkup_protocol_header_t* hdr = reinterpret_cast<bkup_protocol_header_t*>(NULL);
+ pthread_rwlock_t* rwlock = reinterpret_cast<pthread_rwlock_t*>(NULL);
+ if ((response == NULL) || (rcv_buf == NULL) || (query_result == NULL)) { // LCOV_EXCL_BR_LINE 6:Excluded as no NULL is currently passed
+ // LCOV_EXCL_START 6:Excluded as no NULL is currently passed
+ AGL_ASSERT_NOT_TESTED();
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Resp or Buf or Query is NULL");
+ goto exit;
+ // LCOV_EXCL_STOP 6:Excluded as no NULL is currently passed
+ }
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ rwlock = BkupGetRwlock(hdr->item_name, current_media, query_result);
+ if (BkupMakeBkupPathToNvId(query_result->category_name, hdr->item_name, &full_path, FILENAME_MAX) < 0) { // LCOV_EXCL_BR_LINE 6:Excluded due to checking by upper-level function
+ // LCOV_EXCL_START 6:Excluded due to checking by upper-level function
+ AGL_ASSERT_NOT_TESTED();
+ goto exit;
+ // LCOV_EXCL_STOP 6:Excluded due to checking by upper-level function
+ }
+ BkupRwlockWrlock(rwlock, full_path);
+ ret = BkupDeleteDataFromNv(current_media, full_path);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "BkupDeleteDataFromNv Error");
+ }
+ BkupRwlockUnlock(rwlock, full_path);
+
+exit:
+ if ((response != NULL) && (query_result != NULL) && (hdr != NULL)) { // LCOV_EXCL_BR_LINE 6:Excluded as no NULL is currently passed
+ EFrameworkunifiedStatus e_status = (ret < 0) ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+ if (current_media == NVHALMEDIA_NAND) {
+ if ((query_result->cache_dram == false) && (query_result->backup_dram == false)) {
+ BkupApilog(response, current_media, hdr, query_result, NULL, 0, e_status);
+ }
+ if ((*response->set_response)(response->opt, NULL, 0, e_status) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Response Error");
+ ret = -1;
+ }
+ } else {
+ BkupApilog(response, current_media, hdr, query_result, NULL, 0, e_status);
+ }
+ }
+
+ if (full_path != NULL) { // LCOV_EXCL_BR_LINE 6:Excluded because checked by BkupMakeBkupPathToNvId()
+ munmap(full_path, FILENAME_MAX);
+ }
+ return ret;
+}
+
+/**
+ * common file handler
+ */
+static int BkupHandlerFile(bkup_response_t *response,
+ enum NvHalMedia current_media, char *rcv_buf,
+ bkup_query_result_t *query_result) {
+ int ret = 0;
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+
+ if (rcv_buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "rcv_buf is NULL");
+ return -1;
+ }
+
+ switch (hdr->command) { // LCOV_EXCL_BR_LINE 6:double check
+ case BKUP_CMD_READ:
+ ret = BkupCmdRead(response, current_media, rcv_buf, query_result);
+ break;
+
+ case BKUP_CMD_WRITE:
+ ret = BkupCmdWrite(response, current_media, rcv_buf, query_result);
+ break;
+
+ case BKUP_CMD_FILL:
+ ret = BkupCmdFill(response, current_media, rcv_buf, query_result);
+ break;
+
+ case BKUP_CMD_COPY_INNER:
+ ret = BkupCmdCopy(response, current_media, rcv_buf, query_result);
+ break;
+
+ case BKUP_CMD_DELETE:
+ ret = BkupCmdDeleteData(response, current_media, rcv_buf, query_result);
+ break;
+
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 6:double check
+ }
+ return ret;
+}
+
+/**
+ * Main's response
+ */
+static int BkupSetResponseNsfw(void *opt, void *buf, int size, EFrameworkunifiedStatus ret_value) {
+ EFrameworkunifiedStatus e_status;
+
+ if (buf != NULL) { // LCOV_EXCL_BR_LINE 6:double check
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((e_status = FrameworkunifiedSetSyncResponseData((HANDLE)opt, buf, size)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSetSyncResponseData:%d", e_status);
+ return -1;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+ }
+ return 0;
+}
+
+/**
+ * write apilog
+ */
+static void BkupApilog(bkup_response_t *response, enum NvHalMedia current_media,
+ bkup_protocol_header_t *hdr,
+ bkup_query_result_t *query_result, char *buf,
+ uint32_t crc32, EFrameworkunifiedStatus ret_value) {
+ const char *src;
+ const char *cmd;
+ char header[12] = "-- -- -- --";
+ const char c[] = "0123456789abcdef";
+
+ if (response == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "response is NULL");
+ return;
+ }
+ if (hdr == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "hdr is NULL");
+ return;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "query_result is NULL");
+ return;
+ }
+ if (response->set_response == BkupSetResponseNsfw) {
+ src = FrameworkunifiedGetMsgSrc((HANDLE)response->opt); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ src = (reinterpret_cast<bkup_itc_message_t *>(response->opt))->nand.client_name;
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+
+ switch (hdr->command) { // LCOV_EXCL_BR_LINE 6:double check
+ case BKUP_CMD_READ:
+ cmd = "RD";
+ break;
+ case BKUP_CMD_WRITE:
+ cmd = "WR";
+ break;
+ case BKUP_CMD_FILL:
+ cmd = "FILL";
+ break;
+ case BKUP_CMD_READ_NUM:
+ // LCOV_EXCL_START 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cmd = "RDN";
+ break;
+ // LCOV_EXCL_STOP 6:double check
+ case BKUP_CMD_SIZE_NUM:
+ // LCOV_EXCL_START 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cmd = "SZN";
+ break;
+ // LCOV_EXCL_STOP 6:double check
+ case BKUP_CMD_DELETE:
+ cmd = "DEL";
+ break;
+ default:
+ // LCOV_EXCL_START 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cmd = "UNKNOWN";
+ break;
+ // LCOV_EXCL_STOP 6:double check
+ }
+
+ if (buf) { // LCOV_EXCL_BR_LINE 6:double check
+ int i;
+ for (i = 0; i < 4; i++) {
+ if (query_result->size > i) {
+ header[i * 3] = c[*(buf + i) >> 4];
+ header[i * 3 + 1] = c[*(buf + i) & 0xf];
+ }
+ }
+ }
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ALSA, "", "%s/%s/%s/o:%d/s:%d/h:%s/c:%x/r:%d", src, cmd, hdr->item_name, hdr->offset, hdr->size,
+ header, crc32, ret_value);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+}
+
+/**
+ * Tweak command
+ */
+static int BkupTweakCommand(enum NvHalMedia current_media, char **rcv_buf,
+ int *rcv_size, bkup_query_result_t *query_result) {
+ int ret = -1;
+ bkup_protocol_header_t update_hdr;
+ bkup_protocol_header_t *hdr = reinterpret_cast<bkup_protocol_header_t *>(*rcv_buf);
+
+ if (current_media == NVHALMEDIA_NAND) { // LCOV_EXCL_BR_LINE 6:current_media never will be NVHALMEDIA_NAND
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = 0; // LCOV_EXCL_LINE 6:current_media never will be NVHALMEDIA_NAND
+ goto exit; // LCOV_EXCL_LINE 6:current_media never will be NVHALMEDIA_NAND
+ }
+ if (rcv_size == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "rcv_size is NULL");
+ return -1;
+ }
+ if (query_result == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "query_resul is NULL");
+ return -1;
+ }
+
+ if ((hdr->command == BKUP_CMD_WRITE || hdr->command == BKUP_CMD_FILL) &&
+ (hdr->offset != 0 || hdr->size != (uint32_t)query_result->size)) {
+ // partial request
+ if ((current_media == NVHALMEDIA_CACHEDRAM &&
+ (query_result->nand || query_result->backup_dram)) ||
+ (current_media == NVHALMEDIA_BACKUPDRAM && query_result->nand)) {
+ memset(&update_hdr, 0, sizeof(update_hdr));
+ BkupStrlcpy(update_hdr.item_name, hdr->item_name, sizeof(update_hdr.item_name));
+ update_hdr.command = BKUP_CMD_COPY_INNER;
+ update_hdr.src_media = current_media;
+ munmap(*rcv_buf, *rcv_size);
+ *rcv_size = 0;
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if ((*rcv_buf = BkupAnonMmap(sizeof(bkup_protocol_header_t))) == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ *rcv_size = sizeof(bkup_protocol_header_t);
+ memcpy(*rcv_buf, &update_hdr, sizeof(update_hdr));
+ }
+ }
+ ret = 0;
+
+exit:
+ return ret;
+}
+
+/**
+ * Main callback handler
+ */
+EFrameworkunifiedStatus BkupHandler(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ uint32_t rcv_size = 0;
+ char *rcv_buf = NULL;
+ bkup_protocol_header_t *hdr;
+ bkup_query_result_t query_result;
+ bool hold_rcv_buf = false;
+ int ret = 0;
+ bkup_response_t response_nsfw = {BkupSetResponseNsfw, h_app};
+
+ if ((rcv_size = FrameworkunifiedGetMsgLength(h_app)) < sizeof(bkup_protocol_header_t)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgLength: size fail:%d", rcv_size);
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ rcv_buf = reinterpret_cast<char *>(mmap(NULL, rcv_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
+ if (rcv_buf == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rcv_size = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap:%s", strerror(errno));
+ e_status = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if ((e_status = FrameworkunifiedGetMsgDataOfSize(h_app, rcv_buf, rcv_size, eSMRRelease)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize:%d", e_status);
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ if (hdr->command < 0 || hdr->command >= BKUP_CMD_MAX) { // LCOV_EXCL_BR_LINE 6:double check
+ // LCOV_EXCL_START 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid command:%d", hdr->command);
+ e_status = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ // LCOV_EXCL_STOP 6:double check
+ }
+
+ if (hdr->command == BKUP_CMD_READ_NUM || hdr->command == BKUP_CMD_SIZE_NUM) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (BkupParamGetNumid(hdr->num_id, &query_result, hdr->item_name, sizeof(hdr->item_name)) < 0) {
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", hdr->num_id);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ e_status = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ }
+
+ if (hdr->command == BKUP_CMD_READ_NUM) {
+ hdr->command = BKUP_CMD_READ;
+ }
+ } else {
+ if (BkupParamGet(hdr->item_name, &query_result) < 0) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid item_name:%s", hdr->item_name != 0 ? hdr->item_name : NULL);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ e_status = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ }
+ }
+
+ if (hdr->command == BKUP_CMD_READ || hdr->command == BKUP_CMD_WRITE || hdr->command == BKUP_CMD_FILL) {
+ if (hdr->size == 0) {
+ // do nothing
+ goto exit;
+ }
+ if (hdr->size + hdr->offset > (uint32_t)query_result.size) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid size+offset:%d+%d", hdr->size, hdr->offset);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ e_status = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ }
+ }
+
+ // LCOV_EXCL_BR_START 6: g_bkup_internal_state will not be BKUP_STATE_INIT
+ if (g_bkup_internal_state == BKUP_STATE_INIT) {
+ // LCOV_EXCL_BR_STOP 6: g_bkup_internal_state will not be BKUP_STATE_INIT
+ // LCOV_EXCL_START 6: same as above
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ e_status = eFrameworkunifiedStatusErrOther;
+ goto exit;
+ // LCOV_EXCL_STOP 6: same as above
+ }
+ // LCOV_EXCL_BR_START 6: g_bkup_internal_state will not be BKUP_STATE_TERM
+ if (g_bkup_internal_state == BKUP_STATE_TERM) {
+ // LCOV_EXCL_BR_STOP 6: g_bkup_internal_state will not be BKUP_STATE_TERM
+ // LCOV_EXCL_START 6: same as above
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ e_status = eFrameworkunifiedStatusExit;
+ goto exit;
+ // LCOV_EXCL_STOP 6: same as above
+ }
+
+ if (hdr->command == BKUP_CMD_SIZE || hdr->command == BKUP_CMD_SIZE_NUM) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupSetResponseNsfw(h_app, &query_result.size, sizeof(query_result.size), eFrameworkunifiedStatusOK);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ } else if (hdr->command == BKUP_CMD_CHECK) {
+ if (query_result.nand) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupCmdCheck(&response_nsfw, NVHALMEDIA_NAND, rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ } else if (query_result.backup_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupCmdCheck(&response_nsfw, NVHALMEDIA_BACKUPDRAM, rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ } else if (query_result.cache_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupCmdCheck(&response_nsfw, NVHALMEDIA_CACHEDRAM, rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ } else {
+ ret = -3;
+ }
+
+ if (ret == -1) {
+ // not exists
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Not exists:%s", hdr->item_name != 0 ? hdr->item_name : NULL);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ e_status = eFrameworkunifiedStatusFileLoadError;
+ } else if (ret == -2) {
+ // size error
+ e_status = eFrameworkunifiedStatusAccessError;
+ } else if (ret == -3) {
+ e_status = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ /*
+ * Cache DRAM
+ */
+ if (query_result.cache_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupHandlerFile(&response_nsfw, NVHALMEDIA_CACHEDRAM, rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (ret > 0) {
+ if (hdr->command == BKUP_CMD_READ) {
+ goto exit;
+ }
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if (BkupTweakCommand(NVHALMEDIA_CACHEDRAM, &rcv_buf,
+ reinterpret_cast<int *>(&rcv_size),
+ &query_result) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ }
+ }
+
+ /*
+ * Backup DRAM
+ */
+ if (query_result.backup_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupHandlerFile(&response_nsfw, NVHALMEDIA_BACKUPDRAM, rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ if (ret > 0) {
+ if (hdr->command == BKUP_CMD_READ) {
+ goto exit;
+ }
+ // LCOV_EXCL_BR_START 5: mmap's error case.
+ if (BkupTweakCommand(NVHALMEDIA_BACKUPDRAM, &rcv_buf,
+ reinterpret_cast<int *>(&rcv_size),
+ &query_result) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mmap's error case.
+ // LCOV_EXCL_START 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_buf);
+ }
+ }
+
+ /*
+ * NAND
+ */
+ if (query_result.nand) {
+ bkup_itc_message_t snd_msg;
+
+ if ((hdr->command == BKUP_CMD_READ) || (hdr->command == BKUP_CMD_DELETE) || (query_result.sync) || (ret == 0)) {
+ /*
+ * operation offload
+ */
+ const char *client_name;
+ char system_info[MAX_SYS_INFO_SIZE];
+
+ if (g_bkup_nand_mqd == -1) {
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((g_bkup_nand_mqd = BkupItcMqopen("/" BKUP_THREAD_NAND, O_WRONLY | O_CREAT | O_NONBLOCK | O_CLOEXEC)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ // LCOV_EXCL_START 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+ }
+
+ if ((client_name = FrameworkunifiedGetMsgSrc(h_app)) == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "invalid client_name");
+ e_status = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ FrameworkunifiedGetSystemInfo(h_app, system_info); // LCOV_EXCL_BR_LINE 11:unexpected branch.
+
+ memset(&snd_msg, 0, sizeof(snd_msg));
+ BkupStrlcpy(snd_msg.nand.client_name, client_name, sizeof(snd_msg.nand.client_name));
+ snd_msg.nand.seq_id = static_cast<uint32_t>(strtoul(system_info, NULL, 16));
+ snd_msg.nand.rcv_buf = rcv_buf;
+ snd_msg.nand.rcv_size = rcv_size;
+
+ // LCOV_EXCL_BR_START 5: mq_send's error case.
+ if (mq_send(g_bkup_nand_mqd, reinterpret_cast<char *>(&snd_msg), sizeof(snd_msg), 0) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_send's error case.
+ // LCOV_EXCL_START 5: mq_send's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int save_errno = errno;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_send:%s", strerror(errno));
+ e_status = eFrameworkunifiedStatusFail;
+ if (save_errno == EAGAIN) {
+ kill(g_bkup_nand_tid, SIGABRT);
+ }
+ goto exit;
+ // LCOV_EXCL_STOP 5: mq_send's error case.
+ }
+ FrameworkunifiedSetDeferredSyncResponse(h_app); // LCOV_EXCL_BR_LINE 11:unexpected branch.
+ hold_rcv_buf = true;
+ } else {
+ /*
+ * delay write
+ */
+ if (g_bkup_delay_mqd == -1) {
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((g_bkup_delay_mqd = BkupItcMqopen("/" BKUP_THREAD_DELAY, O_WRONLY | O_CREAT | O_NONBLOCK | O_CLOEXEC)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ // LCOV_EXCL_START 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+ }
+
+ memset(&snd_msg, 0, sizeof(snd_msg));
+
+// snd_msg.delay.terminate = false;
+ snd_msg.delay.cmd = BKUP_DELAY_CMD_REGIST;
+
+ BkupStrlcpy(snd_msg.delay.item_name, hdr->item_name, sizeof(snd_msg.delay.item_name));
+
+ // LCOV_EXCL_BR_START 5: mq_send's error case.
+ if (mq_send(g_bkup_delay_mqd, reinterpret_cast<char *>(&snd_msg), sizeof(snd_msg), 0) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_send's error case.
+ // LCOV_EXCL_START 5: mq_send's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int save_errno = errno;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_send:%s", strerror(errno));
+ e_status = eFrameworkunifiedStatusFail;
+ if (save_errno == EAGAIN) {
+ kill(g_bkup_delay_tid, SIGABRT);
+ }
+ goto exit;
+ // LCOV_EXCL_STOP 5: mq_send's error case.
+ }
+ }
+ }
+ }
+
+exit:
+ if (hold_rcv_buf == false && rcv_buf != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case
+ munmap(rcv_buf, rcv_size);
+ }
+ return e_status;
+}
+
+
+/**
+ * Power callback handler
+ */
+EFrameworkunifiedStatus bkup_power_handler(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ uint32_t rcv_size = 0;
+ T_SS_SM_UserModeOnOffNotification_StructType power_status;
+
+ if ((rcv_size = FrameworkunifiedGetMsgLength(hApp)) != sizeof(power_status)) { // LCOV_EXCL_BR_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 4: NSFW error case
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgLength: size fail:%d", rcv_size);
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ // LCOV_EXCL_BR_START 4: NSFW error case
+ if ((eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &power_status, rcv_size, eSMRRelease)) != eFrameworkunifiedStatusOK) {
+ // LCOV_EXCL_BR_STOP 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 4: NSFW error case
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize:%d", eStatus);
+ goto exit;
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+
+ if (g_bkup_internal_state != BKUP_STATE_NORMAL) { // LCOV_EXCL_BR_LINE 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 6:double check
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Invalid state:%d", g_bkup_internal_state);
+ goto exit;
+ // LCOV_EXCL_STOP 6:double check
+ }
+
+ if (power_status.isUserModeOn == FALSE) {
+ bkup_itc_message_t snd_msg;
+
+ if (g_bkup_delay_mqd == -1) {
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((g_bkup_delay_mqd = BkupItcMqopen("/" BKUP_THREAD_DELAY, O_WRONLY|O_CREAT|O_NONBLOCK|O_CLOEXEC)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 5: mq_open's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+ }
+
+ memset(&snd_msg, 0, sizeof(snd_msg));
+ snd_msg.delay.cmd = BKUP_DELAY_CMD_PRE_ACCOFF;
+
+ // LCOV_EXCL_BR_START 5: mq_send's error case.
+ if (mq_send(g_bkup_delay_mqd, (char *)&snd_msg, sizeof(snd_msg), 0) < 0) {
+ // LCOV_EXCL_BR_START 5: mq_send's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 5: mq_send's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_send:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP 5: mq_send's error case.
+ }
+ }
+
+exit:
+ return eStatus;
+}
+
+
+/**
+ * thread's response
+ */
+static int BkupSetResponseThread(void *opt, void *buf, int size, EFrameworkunifiedStatus ret_value) {
+ HANDLE response_mq;
+ char invoker_name[MAX_QUEUE_NAME_SIZE];
+ if (opt == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "opt is NULL");
+ return -1;
+ }
+ bkup_itc_message_t *msg = reinterpret_cast<bkup_itc_message_t *>(opt);
+ EFrameworkunifiedStatus e_status;
+ // LCOV_EXCL_BR_START 11:unexpected branch.
+ McCreateInvokerName(msg->nand.client_name, 0, invoker_name, sizeof(invoker_name));
+ // LCOV_EXCL_BR_STOP 11:unexpected branch.
+
+ if (g_bkup_response_mq == NULL) {
+ g_bkup_response_mq = new g_bkup_response_mq_t; // LCOV_EXCL_BR_LINE 11:except,C++ operator
+ }
+ g_bkup_response_mq_t::iterator mq_it = g_bkup_response_mq->find(invoker_name); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (mq_it != g_bkup_response_mq->end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ response_mq = mq_it->second; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ } else {
+ if ((response_mq = McOpenSyncSender(invoker_name)) == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mcOpenSyncSender");
+ return -1;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ g_bkup_response_mq->insert(std::make_pair(invoker_name, response_mq)); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch.
+ e_status = McSendSyncResponse(response_mq, MN_NS_BACKUPMGR, BACKUP_CID, msg->nand.seq_id, ret_value, size, buf);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch.
+ return (e_status == eFrameworkunifiedStatusOK) ? 0 : -1; // LCOV_EXCL_BR_LINE 11:unexpected branch
+}
+
+/**
+ * NAND Thread
+ */
+void *BkupNandThread(void *arg) {
+ mqd_t mqd;
+ struct pollfd fds[1];
+ bkup_itc_message_t rcv_msg;
+ bkup_protocol_header_t *hdr;
+ bkup_query_result_t query_result;
+ bkup_response_t response_thread = {BkupSetResponseThread, NULL};
+
+ signal_handler p_signal = SignalHandlerFuncForMsgHandleThread;
+ signal(SIGUSR1, p_signal);
+ g_nand_thread_id = pthread_self();
+
+ if (prctl(PR_SET_NAME, BKUP_THREAD_NAND) < 0) { // LCOV_EXCL_BR_LINE 5: prctl's error case.
+ // LCOV_EXCL_START 5: prctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "prctl(PR_SET_NAME):%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: prctl's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((mqd = BkupItcMqopen("/" BKUP_THREAD_NAND, O_RDONLY | O_CREAT | O_CLOEXEC)) < -1) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ // LCOV_EXCL_START 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+ g_bkup_nand_tid = static_cast<int>(syscall(__NR_gettid));
+
+ fds[0].fd = mqd;
+ fds[0].events = POLLIN;
+
+ while (1) {
+ int ret = poll(fds, sizeof(fds) / sizeof(struct pollfd), -1); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: poll's error case.
+ // LCOV_EXCL_START 5: poll's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == EINTR) {
+ continue;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "poll errno:%s", strerror(errno));
+ // LCOV_EXCL_STOP 5: poll's error case.
+ } else {
+ if ((fds[0].revents & POLLIN) != 0) {
+ // LCOV_EXCL_BR_START 5: mq_receive's error case.
+ if (mq_receive(mqd, reinterpret_cast<char *>(&rcv_msg), sizeof(rcv_msg), NULL) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_receive's error case.
+ // LCOV_EXCL_START 5: mq_receive's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_receive:%s", strerror(errno));
+ }
+ continue;
+ // LCOV_EXCL_STOP 5: mq_receive's error case.
+ }
+ hdr = reinterpret_cast<bkup_protocol_header_t *>(rcv_msg.nand.rcv_buf);
+ BkupParamGet(hdr->item_name, &query_result); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ response_thread.opt = &rcv_msg;
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ ret = BkupHandlerFile(&response_thread, NVHALMEDIA_NAND, rcv_msg.nand.rcv_buf, &query_result);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+
+ munmap(rcv_msg.nand.rcv_buf, rcv_msg.nand.rcv_size);
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/*
+ * delay backup thread
+ */
+typedef struct {
+ int fd;
+ std::string name;
+} bkup_delay_t; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+static int BkupDelayTimerAdd(int efd, const char *item_name, time_t backup_cycle) {
+ int ret = -1;
+ struct epoll_event ev;
+ bkup_delay_t *timer_ev = new bkup_delay_t; // LCOV_EXCL_BR_LINE 11:except,C++ operator
+ struct itimerspec itime;
+
+ if ((timer_ev->fd = timerfd_create(CLOCK_MONOTONIC, 0)) < 0) { // LCOV_EXCL_BR_LINE 5: timerfd_create's error case.
+ // LCOV_EXCL_START 5: timerfd_create's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_create:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5: timerfd_create's error case.
+ }
+ timer_ev->name = item_name; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ ev.events = EPOLLIN;
+ ev.data.ptr = timer_ev;
+ if (epoll_ctl(efd, EPOLL_CTL_ADD, timer_ev->fd, &ev) < 0) { // LCOV_EXCL_BR_LINE 5: epoll_ctl's error case.
+ // LCOV_EXCL_START 5: epoll_ctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ goto exit;
+ // LCOV_EXCL_STOP 5: epoll_ctl's error case.
+ }
+
+ memset(&itime, 0, sizeof(itime));
+ itime.it_value.tv_sec = backup_cycle;
+ itime.it_interval.tv_sec = backup_cycle;
+
+ if (timerfd_settime(timer_ev->fd, 0, &itime, NULL) < 0) { // LCOV_EXCL_BR_LINE 5: timerfd_settime's error case.
+ // LCOV_EXCL_START 5: timerfd_settime's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_settime:%s", strerror(errno));
+ epoll_ctl(efd, EPOLL_CTL_DEL, timer_ev->fd, &ev);
+ goto exit;
+ // LCOV_EXCL_STOP 5: timerfd_settime's error case.
+ }
+ ret = 0;
+
+exit:
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: C API's error case.
+ // LCOV_EXCL_START 5: C API's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (timer_ev->fd >= 0) {
+ if (close(timer_ev->fd) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_settime:%s", strerror(errno));
+ }
+ }
+ delete timer_ev;
+ }
+ // LCOV_EXCL_STOP 5: C API's error case.
+ return ret;
+}
+
+static uint64_t *g_bkup_syncreq;
+static pthread_rwlock_t g_syncreq_rwlock = PTHREAD_RWLOCK_INITIALIZER;
+#define BKUP_SYNCREQ_SIZE (4096)
+#define BKUP_SYNCREQ_ID_MAX (BKUP_SYNCREQ_SIZE * 8 - 1)
+#define BKUP_SYNCREQ_NAME "syncreq"
+
+static int BkupSyncreqInit(void) {
+ int ret = -1;
+ char *map;
+
+ map = reinterpret_cast<char *>(mmap(NULL, BKUP_SYNCREQ_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
+ if (map == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 5: mmap's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap failed");
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ g_bkup_syncreq = reinterpret_cast<uint64_t *>(map);
+ memset(g_bkup_syncreq, 0, BKUP_SYNCREQ_SIZE);
+
+ pthread_rwlock_wrlock(&g_syncreq_rwlock);
+ BkupBufferWriteToNv(NVHALMEDIA_BACKUPDRAM, BKUP_SYNCREQ_NAME,
+ reinterpret_cast<char *>(g_bkup_syncreq),
+ BKUP_SYNCREQ_SIZE, NULL);
+ pthread_rwlock_unlock(&g_syncreq_rwlock);
+ ret = 0;
+
+exit:
+ return ret;
+}
+
+static void BkupSyncreqTerm(void) {
+ if (g_bkup_syncreq != NULL) { // LCOV_EXCL_BR_LINE 6:g_bkup_syncreq will not be NULL
+ munmap(g_bkup_syncreq, BKUP_SYNCREQ_SIZE);
+ g_bkup_syncreq = NULL;
+ }
+}
+
+static int BkupSyncreqSet(int id) {
+ if (g_bkup_syncreq == NULL) { // LCOV_EXCL_BR_LINE 6:g_bkup_syncreq will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: mmap's error case.
+ }
+ if (id > BKUP_SYNCREQ_ID_MAX) {
+ return -1;
+ }
+ if (!(*(g_bkup_syncreq + id / 64) & (1ULL << (id % 64)))) {
+ *(g_bkup_syncreq + id / 64) |= (1ULL << (id % 64));
+ pthread_rwlock_wrlock(&g_syncreq_rwlock);
+ BkupBufferWriteToNv(NVHALMEDIA_BACKUPDRAM, BKUP_SYNCREQ_NAME,
+ reinterpret_cast<char *>(g_bkup_syncreq),
+ BKUP_SYNCREQ_SIZE, NULL);
+ pthread_rwlock_unlock(&g_syncreq_rwlock);
+ }
+ return 0;
+}
+
+static int BkupSyncreqClear(int id) {
+ if (g_bkup_syncreq == NULL) { // LCOV_EXCL_BR_LINE 6:g_bkup_syncreq will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: mmap's error case.
+ }
+ if (id > BKUP_SYNCREQ_ID_MAX) {
+ return -1;
+ }
+ if (*(g_bkup_syncreq + id / 64) & (1ULL << (id % 64))) {
+ *(g_bkup_syncreq + id / 64) &= ~(1ULL << (id % 64));
+ pthread_rwlock_wrlock(&g_syncreq_rwlock);
+ BkupBufferWriteToNv(NVHALMEDIA_BACKUPDRAM, BKUP_SYNCREQ_NAME,
+ reinterpret_cast<char *>(g_bkup_syncreq),
+ BKUP_SYNCREQ_SIZE, NULL);
+ pthread_rwlock_unlock(&g_syncreq_rwlock);
+ }
+
+ return 0;
+}
+
+static inline int BkupPopcnt64(uint64_t x) {
+ uint64_t n;
+
+ n = (x >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ n = (n >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ n = (n >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fULL;
+ x = x * 0x0101010101010101ULL;
+ return static_cast<int>(x >> 56);
+}
+
+static int BkupSyncreqSearch(void) {
+ int i;
+
+ if (g_bkup_syncreq == NULL) { // LCOV_EXCL_BR_LINE 6:g_bkup_syncreq will not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: mmap's error case.
+ }
+
+ for (i = 0; i < static_cast<int>(BKUP_SYNCREQ_SIZE / sizeof(uint64_t)); i++) {
+ if (*(g_bkup_syncreq + i) != 0) {
+ uint64_t bits, mrb1; // most right bit 1
+ bits = *(g_bkup_syncreq + i);
+ mrb1 = bits & (-bits);
+ return i * 64 + BkupPopcnt64(mrb1 - 1);
+ }
+ }
+
+ return -1;
+}
+
+static void BkupSyncreqDone(bool skip_cache) {
+ int id;
+ uint64_t start, end;
+
+ start = BkupTimerReal();
+
+ while ((id = BkupSyncreqSearch()) >= 0) {
+ char item_name[64];
+ bkup_query_result_t query_result;
+
+ if (BkupParamGetNumid(id, &query_result, item_name, sizeof(item_name)) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", id);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ } else {
+ if (query_result.cache_dram) {
+ if (!skip_cache) {
+ BkupMediaCopyFromNv(query_result.category_name, item_name,
+ NVHALMEDIA_CACHEDRAM, NVHALMEDIA_NAND, NULL,
+ NULL);
+ }
+ } else if (query_result.backup_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupMediaCopyFromNv(query_result.category_name, item_name,
+ NVHALMEDIA_BACKUPDRAM, NVHALMEDIA_NAND, NULL, NULL);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+ }
+
+ BkupSyncreqClear(id); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ }
+
+ end = BkupTimerReal();
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "spent:%" PRIu64 ".%06" PRIu64 "ms",
+ static_cast<uint64_t>((end - start) / 1000000),
+ static_cast<uint64_t>((end - start) % 1000000));
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+}
+
+void BkupSyncreqRestart(void) {
+ char *map;
+
+ map = reinterpret_cast<char *>(mmap(NULL, BKUP_SYNCREQ_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
+ if (map == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_START 5: mmap's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mmap failed");
+ goto exit;
+ // LCOV_EXCL_STOP 5: mmap's error case.
+ }
+ g_bkup_syncreq = reinterpret_cast<uint64_t *>(map);
+
+ if (BkupBufferReadFromNv(NVHALMEDIA_BACKUPDRAM, BKUP_SYNCREQ_NAME,
+ reinterpret_cast<char *>(g_bkup_syncreq),
+ BKUP_SYNCREQ_SIZE, NULL) < 0) {
+ goto exit;
+ }
+ BkupSyncreqDone(true);
+ BkupSyncreqTerm();
+
+exit:
+ return;
+}
+
+void *BkupDelayThread(void *arg) {
+ mqd_t mqd;
+ int efd;
+ struct epoll_event ev;
+ bkup_delay_t *mq_ev;
+ bkup_itc_message_t rcv_msg;
+ std::map<std::string, int> delay_req; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ signal_handler p_signal = SignalHandlerFuncForMsgHandleThread;
+ signal(SIGUSR1, p_signal);
+ g_delay_thread_id = pthread_self();
+
+
+ if (prctl(PR_SET_NAME, BKUP_THREAD_DELAY) < 0) { // LCOV_EXCL_BR_LINE 5: prctl's error case.
+ // LCOV_EXCL_START 5: prctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "prctl(PR_SET_NAME):%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: prctl's error case.
+ }
+
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((mqd = BkupItcMqopen("/" BKUP_THREAD_DELAY, O_RDONLY | O_CREAT | O_CLOEXEC)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ // LCOV_EXCL_START 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+
+ if ((efd = epoll_create(MAX_FD_EPOLL)) < 0) { // LCOV_EXCL_BR_LINE 5: epoll_create's error case.
+ // LCOV_EXCL_START 5: epoll_create's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "epoll_create:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: epoll_create's error case.
+ }
+ g_bkup_delay_tid = static_cast<int>(syscall(__NR_gettid));
+
+ mq_ev = new bkup_delay_t; // LCOV_EXCL_BR_LINE 11:except,C++ operator
+ mq_ev->fd = static_cast<int>(mqd);
+ mq_ev->name = "mq"; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ ev.events = EPOLLIN;
+ ev.data.ptr = mq_ev;
+ // LCOV_EXCL_BR_START 5: epoll_ctl's error case.
+ if (epoll_ctl(efd, EPOLL_CTL_ADD, static_cast<int>(mqd), &ev) < 0) {
+ // LCOV_EXCL_BR_STOP 5: epoll_ctl's error case.
+ // LCOV_EXCL_START 5: epoll_ctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 5: epoll_ctl's error case.
+ }
+
+ while (1) {
+ struct epoll_event events[MAX_FD_EPOLL];
+ int nfds;
+
+ nfds = epoll_wait(efd, events, MAX_FD_EPOLL, -1); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (nfds < 0) { // LCOV_EXCL_BR_LINE 5: epoll_wait's error case.
+ // LCOV_EXCL_START 5: epoll_wait's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "epoll_wait:%s", strerror(errno));
+ }
+ continue;
+ // LCOV_EXCL_STOP 5: epoll_wait's error case.
+ }
+
+ for (int i = 0; i < nfds; i++) {
+ bkup_delay_t *cur_ev = reinterpret_cast<bkup_delay_t *>(events[i].data.ptr);
+
+ if (cur_ev->fd == mqd) {
+ /*
+ * mq
+ */
+ // LCOV_EXCL_BR_START 5: mq_receive's error case.
+ if (mq_receive(mqd, reinterpret_cast<char *>(&rcv_msg), sizeof(rcv_msg), NULL) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_receive's error case.
+ // LCOV_EXCL_START 5: mq_receive's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_receive:%s", strerror(errno));
+ }
+ continue;
+ // LCOV_EXCL_STOP 5: mq_receive's error case.
+ }
+
+#if 0
+ if (rcv_msg.delay.terminate) {
+ // terminate request
+ // shutdown sync
+ BkupSyncreqDone(false); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ for (std::map<std::string, int>::iterator i = delay_req.begin(); i != delay_req.end(); ++i) {
+ i->second = 0; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+
+ // terminate finish response
+ int64_t term_event = 1;
+ // LCOV_EXCL_BR_START 5: write's error case.
+ if (write(rcv_msg.delay.event_fd, &term_event, sizeof(term_event)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: write's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "write:%s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case.
+ }
+ } else {
+ // delay request
+ bkup_query_result_t query_result;
+ BkupParamGet(rcv_msg.delay.item_name, &query_result); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ if (query_result.backup_cycle > 0) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (delay_req.find(rcv_msg.delay.item_name) != delay_req.end()) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ delay_req[rcv_msg.delay.item_name]++; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ } else {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ BkupDelayTimerAdd(efd, rcv_msg.delay.item_name, query_result.backup_cycle);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ delay_req[rcv_msg.delay.item_name] = 1; // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ if (BkupSyncreqSet(query_result.id) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", query_result.id);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ // write to ACC OFF
+ bkup_query_result_t query_result;
+ if (BkupParamGet(rcv_msg.delay.item_name, &query_result) < 0) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid item_name:%s",
+ rcv_msg.delay.item_name != 0 ? rcv_msg.delay.item_name : NULL);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ } else {
+ if (BkupSyncreqSet(query_result.id) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", query_result.id);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ }
+ }
+ }
+#endif
+ switch (rcv_msg.delay.cmd) {
+ case BKUP_DELAY_CMD_TERM:
+ case BKUP_DELAY_CMD_PRE_ACCOFF:
+ /*
+ * terminate or pre-acc_off request
+ */
+ // shutdown sync
+ BkupSyncreqDone(false);
+
+ for (std::map<std::string, int>::iterator i = delay_req.begin(); i != delay_req.end(); ++i) {
+ i->second = 0;
+ }
+
+ if (rcv_msg.delay.cmd == BKUP_DELAY_CMD_TERM) {
+ BkupSyncreqTerm();
+
+ // terminate finish response
+ int64_t term_event = 1;
+ // LCOV_EXCL_BR_START 5: write's error case.
+ if (write(rcv_msg.delay.event_fd, &term_event, sizeof(term_event)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: write's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "write:%s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case.
+ }
+ }
+ break;
+
+ case BKUP_DELAY_CMD_REGIST:
+ // delay regist request
+ bkup_query_result_t query_result;
+ BkupParamGet(rcv_msg.delay.item_name, &query_result);
+
+ if (query_result.backup_cycle > 0) {
+ if (delay_req.find(rcv_msg.delay.item_name) != delay_req.end()) {
+ delay_req[rcv_msg.delay.item_name]++;
+ } else {
+ BkupDelayTimerAdd(efd, rcv_msg.delay.item_name, query_result.backup_cycle);
+ delay_req[rcv_msg.delay.item_name] = 1;
+ }
+
+ if (BkupSyncreqSet(query_result.id) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", query_result.id);
+ }
+ } else {
+ // wite to ACC OFF
+ bkup_query_result_t query_result;
+ if (BkupParamGet(rcv_msg.delay.item_name, &query_result) < 0) { // LCOV_EXCL_BR_LINE 6:double check
+ // LCOV_EXCL_START 6:double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid item_name:%s", rcv_msg.delay.item_name);
+ // LCOV_EXCL_STOP 6:double check
+ } else {
+ if (BkupSyncreqSet(query_result.id) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", query_result.id);
+ }
+ }
+ }
+ break;
+ }
+
+ } else {
+ /*
+ * timerfd
+ */
+ uint64_t exp;
+ if (read(cur_ev->fd, &exp, sizeof(exp)) < 0) { // LCOV_EXCL_BR_LINE 5: read's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "read:%s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case.
+ }
+
+ if (delay_req[cur_ev->name] > 0) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ bkup_query_result_t query_result;
+ BkupParamGet(cur_ev->name.c_str(), &query_result); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ if (query_result.cache_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *src_rwlock = BkupGetRwlock(
+ cur_ev->name.c_str(), NVHALMEDIA_CACHEDRAM, &query_result);
+ pthread_rwlock_t *dst_rwlock = BkupGetRwlock(
+ cur_ev->name.c_str(), NVHALMEDIA_NAND, &query_result);
+ BkupMediaCopyFromNv(query_result.category_name,
+ cur_ev->name.c_str(), NVHALMEDIA_CACHEDRAM,
+ NVHALMEDIA_NAND, src_rwlock, dst_rwlock);
+ BkupMediaCopyFromNv(query_result.category_name,
+ cur_ev->name.c_str(), NVHALMEDIA_CACHEDRAM,
+ NVHALMEDIA_NAND, NULL, NULL);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ } else if (query_result.backup_dram) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ pthread_rwlock_t *src_rwlock = BkupGetRwlock(
+ cur_ev->name.c_str(), NVHALMEDIA_BACKUPDRAM, &query_result);
+ pthread_rwlock_t *dst_rwlock = BkupGetRwlock(
+ cur_ev->name.c_str(), NVHALMEDIA_NAND, &query_result);
+ BkupMediaCopyFromNv(query_result.category_name,
+ cur_ev->name.c_str(), NVHALMEDIA_BACKUPDRAM,
+ NVHALMEDIA_NAND, src_rwlock, dst_rwlock);
+ // LCOV_EXCL_BR_STOP 11:unexpected branch
+ }
+ delay_req[cur_ev->name] = 0; // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (BkupSyncreqClear(query_result.id) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid num_id:%d", query_result.id);
+ // LCOV_EXCL_BR_STOP 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ // not update. timer delte
+ // LCOV_EXCL_BR_START 5: epoll_ctl's error case.
+ if (epoll_ctl(efd, EPOLL_CTL_DEL, cur_ev->fd, &events[i]) < 0) {
+ // LCOV_EXCL_BR_STOP 5: epoll_ctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "epoll_ctl:%s", strerror(errno)); // LCOV_EXCL_LINE 5: epoll_ctl's error case.
+ }
+ if (close(cur_ev->fd) < 0) { // LCOV_EXCL_BR_LINE 5: close's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "close:%s", strerror(errno)); // LCOV_EXCL_LINE 5: close's error case.
+ }
+ delay_req.erase(cur_ev->name); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ delete cur_ev; // LCOV_EXCL_BR_LINE 11:except,C++ operator
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/**
+ * Terminate handler
+ */
+EFrameworkunifiedStatus BkupTerminateHandler(HANDLE h_app) {
+ bkup_itc_message_t snd_msg;
+ int event_fd;
+ int64_t term_event;
+
+ g_bkup_internal_state = BKUP_STATE_TERM;
+
+ if (g_bkup_delay_mqd == -1) {
+ // LCOV_EXCL_BR_START 5: mq_open's error case.
+ if ((g_bkup_delay_mqd = BkupItcMqopen("/" BKUP_THREAD_DELAY, O_WRONLY | O_CREAT | O_NONBLOCK | O_CLOEXEC)) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_open's error case.
+ // LCOV_EXCL_START 5: mq_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_open:%s", strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP 5: mq_open's error case.
+ }
+ }
+
+ if ((event_fd = eventfd(0, 0)) < 0) { // LCOV_EXCL_BR_LINE 5: eventfd's error case.
+ // LCOV_EXCL_START 5: eventfd's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "eventfd:%s", strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP 5: eventfd's error case.
+ }
+
+ memset(&snd_msg, 0, sizeof(snd_msg));
+
+// snd_msg.delay.terminate = true;
+ snd_msg.delay.cmd = BKUP_DELAY_CMD_TERM;
+
+ snd_msg.delay.event_fd = event_fd;
+
+ // LCOV_EXCL_BR_START 5: mq_send's error case.
+ if (mq_send(g_bkup_delay_mqd, reinterpret_cast<char *>(&snd_msg), sizeof(snd_msg), 0) < 0) {
+ // LCOV_EXCL_BR_STOP 5: mq_send's error case.
+ // LCOV_EXCL_START 5: mq_send's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "mq_send:%s", strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP 5: mq_send's error case.
+ }
+
+ while (1) {
+ if (read(event_fd, &term_event, sizeof(term_event)) < 0) { // LCOV_EXCL_BR_LINE 5: read's error case.
+ // LCOV_EXCL_START 5: read's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == EINTR) {
+ continue;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "read:%s", strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP 5: read's error case.
+ } else {
+ break;
+ }
+ }
+ if (close(event_fd) < 0) { // LCOV_EXCL_BR_LINE 5: close's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "close:%s", strerror(errno)); // LCOV_EXCL_LINE 5: close's error case.
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Init handler
+ */
+EFrameworkunifiedStatus BkupInitHandler(HANDLE h_app) {
+ BkupSyncreqRestart();
+ BkupSyncreqInit();
+
+ g_bkup_internal_state = BKUP_STATE_NORMAL;
+
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/nsframework/common_library/LICENSE b/video_in_hal/nsframework/common_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/nsframework/common_library/Makefile.client b/video_in_hal/nsframework/common_library/Makefile.client
new file mode 100755
index 0000000..e6210c4
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../native_service.mk
diff --git a/video_in_hal/nsframework/common_library/client/Makefile b/video_in_hal/nsframework/common_library/client/Makefile
new file mode 100755
index 0000000..4bda2aa
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/Makefile
@@ -0,0 +1,30 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+INST_SHLIBS := libcommon
+
+libcommon_SRCS := cl_process.c cl_sem.c cl_monitor.c cl_region.c cl_lock.c cl_cgroup.c
+INST_HEADERS := common_library.h cl_process.h cl_sem.h cl_monitor.h cl_lock.h cl_region.h cl_lockid.h
+
+VPATH = ./src ./include/$(COMPONENT_NAME)
+
+CPPFLAGS += -I./include/
+
+LDFLAGS += -Wl,--no-as-needed
+
+LDLIBS += -lrt
+
+include ../../native_service.mk
diff --git a/video_in_hal/nsframework/common_library/client/include/cl_cgroup.h b/video_in_hal/nsframework/common_library/client/include/cl_cgroup.h
new file mode 100755
index 0000000..10a7179
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/cl_cgroup.h
@@ -0,0 +1,35 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_cgroup_h_ // NOLINT(build/header_guard)
+#define _cl_cgroup_h_ // NOLINT(build/header_guard)
+
+typedef enum {
+ CL_CGROUP_MEMORY,
+ CL_CGROUP_CPU,
+} cl_cgroup_t;
+
+int cl_cgroup_make(cl_cgroup_t cgroup, const char *cgroup_name); // NOLINT(readability/nolint)
+int cl_cgroup_remove(cl_cgroup_t cgroup, const char *cgroup_name); // NOLINT(readability/nolint)
+int cl_cgroup_exist(cl_cgroup_t cgroup, const char *cgroup_name); // NOLINT(readability/nolint)
+int cl_cgroup_open(cl_cgroup_t cgroup, const char *cgroup_name, // NOLINT(readability/nolint)
+ const char *controler, int flags);
+int cl_cgroup_set_string(cl_cgroup_t cgroup, const char *cgroup_name, // NOLINT(readability/nolint)
+ const char *controler, const char *str);
+int cl_cgroup_set_num(cl_cgroup_t cgroup, const char *cgroup_name, // NOLINT(readability/nolint)
+ const char *controler, int64_t value);
+
+#endif // ifndef _cl_cgroup_h_ // NOLINT(build/header_guard)
diff --git a/video_in_hal/nsframework/common_library/client/include/cl_error.h b/video_in_hal/nsframework/common_library/client/include/cl_error.h
new file mode 100755
index 0000000..84bf64e
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/cl_error.h
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_error_h_ // NOLINT(build/header_guard)
+#define _cl_error_h_ // NOLINT(build/header_guard)
+
+#include <stdio.h>
+#include <unistd.h>
+#include <asm/unistd.h>
+
+static inline int gettid(void) { // NOLINT(readability/nolint)
+ return (int)syscall(__NR_gettid); // NOLINT(readability/casting)
+}
+
+#define _num_to_str(num) #num
+#define num_to_str(num) _num_to_str(num)
+#define CL_PERROR(msg) \
+ perror(__FILE__ ":" num_to_str(__LINE__)":"msg)
+
+#define CL_ERR_PRINT(fmt, args...) \
+ fprintf(stderr, "[ERR]%d %s:%d:"fmt"\n", gettid(), __func__, __LINE__, ##args)
+
+#if defined(CL_DBG_ENABLE)
+#define CL_DBG_PRINT(fmt, args...) \
+ fprintf(stdout, "[DBG]%d %s:%d:"fmt"\n", gettid(), __func__, __LINE__, ##args)
+#else
+#define CL_DBG_PRINT(fmt, args...)
+#endif
+
+
+#endif // #ifndef _cl_error_h_ // NOLINT(build/header_guard)
diff --git a/video_in_hal/nsframework/common_library/client/include/cl_lock_internal.h b/video_in_hal/nsframework/common_library/client/include/cl_lock_internal.h
new file mode 100755
index 0000000..7a2f623
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/cl_lock_internal.h
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_lock_internal_h_ // NOLINT(build/header_guard)
+#define _cl_lock_internal_h_ // NOLINT(build/header_guard)
+
+#include <native_service/cl_lockid.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file cl_lock_internal.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+#define LOCKFILE_NAME "lockfile" // lock file name
+#define SLOT_SIZE 4096 // slot size
+#define LOCKFILE_SIZE SLOT_SIZE * LID_NUM // the lock file size
+
+#define LOCK_TIMEOUT 3 // timeout(sec) for CL_LockTimedGet
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef _cl_lock_internal_h_ // NOLINT(build/header_guard)
diff --git a/video_in_hal/nsframework/common_library/client/include/cl_monitor_internal.h b/video_in_hal/nsframework/common_library/client/include/cl_monitor_internal.h
new file mode 100755
index 0000000..0a864a2
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/cl_monitor_internal.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_monitor_internal_h_ // NOLINT(build/header_guard)
+#define _cl_monitor_internal_h_ // NOLINT(build/header_guard)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int cl_monitor_cleanup(int pid); // NOLINT(readability/nolint)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef _cl_monitor_internal_h_ */
diff --git a/video_in_hal/nsframework/common_library/client/include/cl_process_internal.h b/video_in_hal/nsframework/common_library/client/include/cl_process_internal.h
new file mode 100755
index 0000000..ce001de
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/cl_process_internal.h
@@ -0,0 +1,53 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_process_internal_h_ // NOLINT(build/header_guard)
+#define _cl_process_internal_h_ // NOLINT(build/header_guard)
+
+typedef struct {
+ char name[20];
+ uid_t uid;
+ gid_t gid;
+ int sched_policy;
+ int sched_priority;
+ int create_group;
+ int stack_size;
+ int cpu_assign;
+ int hold_fds[CL_PROCESSS_ATTR_HOLD_FDS_NUM];
+ int disable_close_fds;
+ char cgroup_name[64];
+} CL_ProcessAttrInternal_t;
+
+typedef struct {
+ char name[20];
+} CL_ThreadAttrInternal_t;
+
+typedef struct {
+ int rt_runtime_us;
+ int cfs_quota_us;
+ int cpu_shares;
+ int memory_limit;
+ int usage_in_bytes;
+ int event_fd;
+} CL_ProcessCreateCgroupAttrInternal_t;
+
+#define CL_PROCESS_NAME_ENV "CL_PROCESS_NAME"
+
+#define CL_PROCESS_EXIT_INTERNAL 0x80
+
+#define CL_PROCESS_CGROUP_NAME_FORMAT "CGRP%05d"
+
+#endif // #ifndef _cl_process_internal_h_ // NOLINT(build/header_guard)
diff --git a/video_in_hal/nsframework/common_library/client/include/native_service/cl_lock.h b/video_in_hal/nsframework/common_library/client/include/native_service/cl_lock.h
new file mode 100755
index 0000000..d974540
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/native_service/cl_lock.h
@@ -0,0 +1,259 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _cl_lock_h_ // NOLINT(build/header_guard)
+#define _cl_lock_h_ // NOLINT(build/header_guard)
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file cl_lock.h
+ * @brief \~english This file contains the base api of cl_clock.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockSystemInit
+/// \~english @par Brief
+/// Initialize the system lock.
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - On system call shm_open error, -1 is returned.
+/// - On system call ftrancate error, -1 is returned.
+/// - On system call mmap error, -1 is returned.
+/// - On system call pthread_mutexattr_setpshared error, -1 is returned.
+/// \~english @par Detail
+/// This function will generate the Lock file, and initialize all the pthread_mutex_t slots.\n
+/// This function must to be called in the system once, which is recommended on the SystemManager start.\n
+/// \~english @par
+/// Lock file is formed with lots of slots. Every slot occupies 4KB.
+/// The slot layout is:
+/// 0 ~ 4Byte : field of PID
+/// 4Byte ~ 28Byte : field of pthread_mutex_t
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int32_t CL_LockSystemInit(void); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockProcessInit
+/// \~english @par Brief
+/// Initialize the process Lock file.
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// Should call CL_LockSystemInit() to generate Lock file.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - On system call shm_open error, -1 is returned.
+/// \~english @par Detail
+/// Open the Lock file.\n
+/// If process want to use the Lock, this function should be called.\n
+/// It is recommended that this function should be called since start main function.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int32_t CL_LockProcessInit(void); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockMap
+/// \~english @par Brief
+/// Mapping the Lock information address.
+/// \~english @param [in] lid
+/// int32_t - LockID of the Lock used.(0~LID_NUM) \n
+/// \~english @retval addr Lock address
+/// \~english @retval MAP_FAILED Error (errno)
+/// \~english @par Prerequisite
+/// Should call CL_LockSystemInit(), CL_LockProcessInit() to open the Lock file.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - If LockID(lid) < 0, errno is set as EINVAL, and MAP_FAILED is returned
+/// - If LockID(lid) > LID_NUM, errno is set as EINVAL, and MAP_FAILED is returned
+/// - If systemcall mmap is failure, errno is set euqal with the errno of mmap, and MAP_FAILED is returned
+/// \~english @par Detail
+/// Mapping the Lock information to the memory.\n
+/// The related LockID should be assigned, when apply the share memory.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// CL_LockUnmap
+////////////////////////////////////////////////////////////////////////////////////
+void *CL_LockMap(int32_t lid); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockUnmap
+/// \~english @par Brief
+/// Unmapping the Lock information.
+/// \~english @param [in] addr
+/// void* - Lock information address.
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// Should call CL_LockSystemInit(), CL_LockProcessInit() before this function is called
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - If systemcall munmap is failure, errno is set euqal with the errno of munmap, -1 is returned
+/// \~english @par Detail
+/// 0 would be returned, even if not get the Lock.
+/// The addr is the Lock information address that acquired from CL_LockMap.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// CL_LockMap
+////////////////////////////////////////////////////////////////////////////////////
+int32_t CL_LockUnmap(void *addr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockGet
+/// \~english @par Brief
+/// Get the Lock. Block until get the Lock.
+/// \~english @param [in] addr
+/// void* - Lock information address.
+/// \~english @retval 0 Success
+/// \~english @retval EINVAL Invalid parameter
+/// \~english @retval EDEADLK Mutex already locked
+/// \~english @par Prerequisite
+/// Should call CL_LockMap to get the Lock information address.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - EINVAL as the parameter of Lock information address is NULL
+/// - EINVAL as the parameter of Lock information address is MAP_FAILED
+/// - EINVAL as the mutex does not be initialized in the systemcall pthread_mutex_lock failure.
+/// - EDEADLK as the current thread already owns the mutex in the systemcall pthread_mutex_lock failure.
+/// \~english @par Detail
+/// Get the Lock until other threads release it.
+/// It will be deadlock if the current thread already owns the mutex.
+/// The addr is the Lock information address that should be acquired from CL_LockMap.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// CL_LockRelease
+////////////////////////////////////////////////////////////////////////////////////
+int32_t CL_LockGet(void *addr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockNowait
+/// \~english @par Brief
+/// Try to get Lock, shall immediately return.
+/// \~english @param [in] addr
+/// void* - Lock information address.
+/// \~english @retval 0 Success
+/// \~english @retval EINVAL Invalid parameter
+/// \~english @retval EBUSY Busy
+/// \~english @par Prerequisite
+/// Should call CL_LockMap to get the Lock information address.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - EINVAL as input parameter addr, the Lock information address is NULL
+/// - EINVAL as input parameter addr, the Lock information address if MAP_FAILED
+/// - EINVAL as the mutex does not be initialized in the systemcall pthread_mutex_trylock failure.
+/// - EBUSY as the mutex could not be acquired as it was already locked in the
+/// systemcall pthread_mutex_trylock failure.
+/// \~english @par Detail
+/// The addr is the Lock information address that should be acquired from CL_LockMap.
+/// Get the Lock information from the pointed share memory.
+/// Shall immediately return while not acquire the Lock.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// CL_LockRelease
+////////////////////////////////////////////////////////////////////////////////////
+int32_t CL_LockNowait(void *addr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_LockRelease
+/// \~english @par Brief
+/// Release the Lock.
+/// \~english @param [in] addr
+/// addr - Lock information address.
+/// \~english @retval 0 Success
+/// \~english @retval EINVAL Invalid parameter
+/// \~english @retval EPERM The current thread does not own the mutex
+/// \~english @par Prerequisite
+/// - Should call CL_LockMap to get the Lock information address.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - EINVAL as input parameter addr, the Lock information address is NULL
+/// - EINVAL as input parameter addr, the Lock information address if MAP_FAILED
+/// - EINVAL as the mutex does not be initialized in the systemcall pthread_mutex_unlock failure.
+/// - EPERM as the current thread does not own the mutex in the systemcall pthread_mutex_unlock failure.
+/// \~english @par Detail
+/// 0 would be returned, even if not get the Lock.
+/// The addr is the Lock information address that should be acquired from CL_LockMap.
+/// Release the Lock related with the share memory.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// CL_LockGet, CL_LockNowait
+////////////////////////////////////////////////////////////////////////////////////
+int CL_LockRelease(void *addr); // NOLINT(readability/nolint)
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#define LOCK_POS_MTX_RSV 40
+#define LOCK_HRDS_RSV 15
+#define LOCK_NSLOG_ACCES_IF_RSV 50
+#define LID_NUM 140
+#endif // #ifndef _cl_lock_h_ // NOLINT(build/header_guard)
diff --git a/video_in_hal/nsframework/common_library/client/include/native_service/cl_lockid.h b/video_in_hal/nsframework/common_library/client/include/native_service/cl_lockid.h
new file mode 100755
index 0000000..a790a4b
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/native_service/cl_lockid.h
@@ -0,0 +1,180 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file cl_lockid.h
+ * @brief Definition of LockID(LID)
+ *
+ */
+
+#ifndef _cl_lockid_h_ // NOLINT(build/header_guard)
+#define _cl_lockid_h_ // NOLINT(build/header_guard)
+#include <native_service/cl_lock.h>
+#include <assert.h>
+
+/**
+ * @file cl_lockid.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+/*
+ * Numbering rules
+ * Assign LID corresponding to the Lock name specified when requesting shared memories.
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ENUM_LOCK_ID
+/// \~english @par Brief
+/// ID for Exclusive Control\n
+/// When AGL users add their own definitions, add "_**" to the definitions.\n
+/// ("**" is an aribitrary character string indicating the organization that uses AGL.)
+/////////////////////////////////////////////////////////////////////////////////////
+
+typedef enum {
+// LID_TEST_1 = 0,
+// LID_TEST_2,
+ LOCK_ANA_LOG_SEM = 0, /* Exclusive Control to store application log on kernel unmanaged RAM*/
+ LOCK_POS_MTX_1, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_2, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_3, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_4, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_5, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_6, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_7, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_8, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_9, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_10, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_11, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_12, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_13, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_14, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_15, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_16, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_17, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_18, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_19, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_20, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_21, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_22, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_23, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_24, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_25, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_26, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_27, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_28, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_29, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_30, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_31, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_32, /* Exclusive Control between POSITIONING and others */
+ LOCK_POS_MTX_MAX, /* Exclusive Control between POSITIONING and others MAX */
+ LOCK_CLOCK_SEM_TZ = (LOCK_POS_MTX_1+LOCK_POS_MTX_RSV), /* Access control to shared memory for TimeZone */
+ LOCK_SEC_DATA_PROTECT, /* Exclusive control to shared memory for the application that use the security chip. */
+ LOCK_OS_SEM_ID__CWORD68_, /* Exclusive Control for SSL library. */
+ LOCK_ROM_ACCESS_IF, /* Exclusive access control for system manager nv area */
+ LOCK_BOOT_ACCESS_IF, /* Exclusive access control for system manager nor area */
+ LOCK_RAM_ACCESS_IF, /* Exclusive access control for system manager drambackup area */
+ LOCK_HRDS_1, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_2, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_3, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_4, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_5, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_6, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_7, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_8, /* Exclusive Control between DataService and others */
+ LOCK_HRDS_MAX, /* Exclusive Control between DataService and others MAX */
+ LOCK_LOGG_ACCESS_IF = (LOCK_HRDS_1+LOCK_HRDS_RSV), /* Exclusive access control for NsLoggerService nv area */
+ LOCK__CWORD76__HMI, /* Exclusive Control between _CWORD76_Service and HMI's */
+ LOCK__CWORD76___CWORD58_, /* Exclusive Control between _CWORD76_Service and _CWORD58_Service */
+ LOCK_DIAGCODE_MEM, /* Exclusive Control to diag code memory area */
+ LOCK_MOUNTER_MOUNT, /* Exclusive Control for Mount */
+ LOCK_NOR_ERCNT, /* Exclusive access control for NOR erase count information */
+ LOCK_RS_WNG_HIS_LIST_DATA, /* Exclusive Control between RemoteService and RS-HMI. */
+ LOCK_RS_WNG_SCREEN_DATA, /* Exclusive Control between RemoteService and RS-HMI. */
+ LOCK_RS_SCREEN_DATA, /* Exclusive Control between RemoteService and RS-HMI. */
+ LOCK_NSLOG_ACCES_IF_1, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_2, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_3, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_4, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_5, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_6, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_7, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_8, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_9, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_10, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_11, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_12, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_13, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_14, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_15, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_16, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_17, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_18, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_19, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_20, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_21, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_22, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_23, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_24, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_25, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_26, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_27, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_28, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_29, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_30, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_31, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_32, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_33, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_34, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_35, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_36, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_37, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_38, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_39, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_40, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_41, /* Exclusive Control between writing to log file */
+
+ LOCK_NSLOG_ACCES_IF_42, /* Exclusive Control between writing to log file */
+
+ LOCK_NSLOG_ACCES_IF_43, /* Exclusive Control between writing to log file */
+ LOCK_NSLOG_ACCES_IF_MAX, /* Exclusive Control between writing to log file MAX */
+ LOCK_INFOSETTING_REV = (LOCK_NSLOG_ACCES_IF_1+LOCK_NSLOG_ACCES_IF_RSV), /* Exclusive control revision information for managing the settings */
+ LOCK_SUBMENU_SELECT, /* Exclusive control between writing the selection information of the sub-menu*/
+ LOCK_DIAG_SEM1, /* Exclusive Control between DiagService and others */
+ LOCK_DIAG_SEM2, /* Exclusive Control between Collect thread and Upload thread */
+ LID_NUM_MAX /* Number of LockID */
+} ENUM_LOCK_ID;
+
+static_assert(LOCK_POS_MTX_MAX <= (LOCK_POS_MTX_1+LOCK_POS_MTX_RSV), "LOCK_POS_MTX_RSV resource empty. Please change limit and build AGL.");
+static_assert(LOCK_HRDS_MAX <= (LOCK_HRDS_1+LOCK_HRDS_RSV), "LOCK_HRDS_RSV resource empty. Please change limit and build AGL.");
+static_assert(LOCK_NSLOG_ACCES_IF_MAX <= (LOCK_NSLOG_ACCES_IF_1+LOCK_NSLOG_ACCES_IF_RSV), "LOCK_NSLOG_ACCES_IF_RSV resource empty. Please change limit and build AGL.");
+static_assert(LID_NUM_MAX <= LID_NUM, "LOCK_ID resource empty. Please change limit and build AGL.");
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+
+#endif // #ifndef _cl_lockid_h_ // NOLINT(build/header_guard)
diff --git a/video_in_hal/nsframework/common_library/client/include/native_service/cl_monitor.h b/video_in_hal/nsframework/common_library/client/include/native_service/cl_monitor.h
new file mode 100755
index 0000000..650492c
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/native_service/cl_monitor.h
@@ -0,0 +1,269 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english This file contains the enum,struct and api of cl_monitor.
+ */
+#ifndef _cl_monitor_h_ // NOLINT(build/header_guard)
+#define _cl_monitor_h_ // NOLINT(build/header_guard)
+
+#include <stdint.h>
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor init enum
+/////////////////////////////////////////////////////////////////////////////////////
+typedef enum {
+ CL_MONITOR_INIT_SYSTEM = 0,
+ CL_MONITOR_INIT_USER
+} CL_MonitorInit_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// the struct of Monitor Entry
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ uint16_t pid;
+ uint8_t type;
+ uint8_t state;
+
+// uint32_t timeout;
+ time_t timeout;
+ uint32_t id;
+ uint32_t user_data;
+} CL_MonitorEntry_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor type enum
+/////////////////////////////////////////////////////////////////////////////////////
+typedef enum {
+ CL_MONITOR_TYPE_GENERIC = 0,
+ CL_MONITOR_TYPE_RPC
+} CL_MonitorType_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor state enum
+/////////////////////////////////////////////////////////////////////////////////////
+typedef enum {
+ CL_MONITOR_STATE_SLEEP = 0,
+ CL_MONITOR_STATE_RUN
+} CL_MonitorState_t;
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// the struct of Monitor Search
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ CL_MonitorEntry_t *entry_list;
+ int entry_num;
+} CL_MonitorSearch_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file cl_monitor.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor initialize
+/// \~english @param [in] init_type
+/// CL_MonitorInit_t - the type of initialzation
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorInit(CL_MonitorInit_t init_type); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Set Monitor Entry
+/// \~english @param [in] type
+/// CL_MonitorType_t - the type of monitor
+/// \~english @param [in] state
+/// CL_MonitorState_t - the state of monitor
+/// \~english @param [in] timeout
+/// uint32_t - the vlaue of timeout
+/// \~english @param [in] user_data
+/// uint32_t - the user data
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorSetEntry(CL_MonitorType_t type, uint32_t id, // NOLINT(readability/nolint)
+ CL_MonitorState_t state, uint32_t timeout,
+ uint32_t user_data);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Get Monitor Entry
+/// \~english @param [in] type
+/// CL_MonitorType_t - the type of monitor
+/// \~english @param [in] id
+/// uint32_t - the monitor id
+/// \~english @param [out] entry
+/// CL_MonitorEntry_t* - the pointer to monitor entry
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorGetEntry(CL_MonitorType_t type, uint32_t id, CL_MonitorEntry_t *entry); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor searth intialize
+/// \~english @param [in] serch
+/// CL_MonitorSearch_t* - the pointor to monitory search
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorSearchInit(CL_MonitorSearch_t *serch); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor searth destroy
+/// \~english @param [in] serch
+/// CL_MonitorSearch_t* - the pointor to monitory search
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorSearchDestroy(CL_MonitorSearch_t *serch); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// Monitor searth timeout
+/// \~english @param [in] serch
+/// CL_MonitorSearch_t* - the pointor to monitory search
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+int CL_MonitorSearchTimeout(CL_MonitorSearch_t *search); // NOLINT(readability/nolint)
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef _cl_monitor_h_ */ // NOLINT(build/header_guard)
diff --git a/video_in_hal/nsframework/common_library/client/include/native_service/cl_process.h b/video_in_hal/nsframework/common_library/client/include/native_service/cl_process.h
new file mode 100755
index 0000000..6a9adbf
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/native_service/cl_process.h
@@ -0,0 +1,1288 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _cl_process_h_ // NOLINT(build/header_guard)
+#define _cl_process_h_ // NOLINT(build/header_guard)
+
+#include <sys/types.h>
+
+#define CL_PROCESSS_ATTR_HOLD_FDS_NUM 8
+
+#define CL_INTFY_FILENAME_FORMAT "/tmp/intfy_%05d"
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessAttr_t
+/// \~english @par Brief
+/// Process attribute structure
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ char body[148]; ///< process attribute
+} CL_ProcessAttr_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCleanupInfo_t
+/// \~english @par Brief
+/// Child-process attribute structure
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ pid_t pid; ///< child-process ID
+ int code; ///< signal code
+ int status; ///< end status or signal
+} CL_ProcessCleanupInfo_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessSchedPolicy_t
+/// \~english @par Brief
+/// Schedule policy
+/////////////////////////////////////////////////////////////////////////////////////
+typedef enum {
+ CL_PROCESS_SCHED_POLICY_OTHER = 0, ///< TSS
+ CL_PROCESS_SCHED_POLICY_RR, ///< Round robin
+ CL_PROCESS_SCHED_POLICY_FIFO, ///< FIFO
+} CL_ProcessSchedPolicy_t;
+
+typedef struct {
+ char body[20];
+} CL_ThreadAttr_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttr_t
+/// Cgroup attribute structure
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ char body[24]; ///< Cgroup attribute
+} CL_ProcessCreateCgroupAttr_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file cl_process.h
+ * @brief \~english This file contains the base api,enum and struct of cl_process.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessInit
+/// \~english @par Brief
+/// Initialize the process
+/// \~english @retval int file descriptor
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Failed to set up process prctl, -1 is returned.
+/// - Failed to set the signal set to the empty set sigemptyset, -1 is returned.
+/// - Failed to add a signal to the signal mask sigaddset, -1 is returned.
+/// - Failed to set sigprocmask, -1 is returned.
+/// - Failed to create a scripter in the file for signal acceptance signalfd, -1 is returned.
+/// \~english @par Detail
+/// This API must be called before createing a thread.
+/// Therefore, it is recommended that this API be called from within the main() function immediately after the API started.\n
+/// Initialize the process.\n
+/// The retuen value fd is assumed to be poll/select and used for waiting for event.\n
+/// An ready occurs when the child process terminates.\n
+/// Call process name setting(\ref CL_ProcessCreateAttrSetName) uniformly
+/// because it is applied only to the number of architecture after exec.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessInit(void); // NOLINT(readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreate
+/// \~english @par Brief
+/// Create the process
+/// \~english @param [in] file
+/// const char* -
+/// \~english @param [in] argv[]
+/// char* const -
+/// \~english @param [in] envp[]
+/// char* const
+/// \~english @param [in] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval int Success(PID)
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Need to be running CL_ProcessInit.
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the executable name (file) in the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the ARG parameter (argv[]) in the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When memory (malloc) of the data storagee area of the environment variable parameter (envp[]) specified
+/// by the arguments fails, set errno to EINVAL, -1 is returned.
+/// - When memory (malloc) of the data control area of the environment variable parameter (envp[]) specified
+/// by the arguments fails, set errno to EINVAL, -1 is returned.
+/// - Process creation (fork) fail, -1 is returned.
+/// - Process CPU affinity masking (sched_setaffinity) fail, -1 is returned.
+/// - When the character string output processing (snprintf) for process creation fail, -1 is returned.
+/// - When the character string output processing (snprintf) for PID setting of cgroup fail, -1 is returned.
+/// - Failure to allocate the area fo sstoring the path name of cgroup (malloc), -1 is returned.
+/// - Failure to open file descriptor (open) of cgroup, -1 is returned.
+/// - Failure to write file descriptor (write) of cgroup, -1 is returned.
+/// \~english @par Detail
+/// - This API must be called before createing a thread.
+/// \~english @par
+/// Create the process.\n
+/// The ARG parameter (argv[]) specified in the argment must satisfy the following conditions:\n
+/// - Can not be omitted.\n
+/// - The first argument must specify a pointer o the filename to be executed.\n
+/// - An array of pointer to NULL terminated strings.\n
+/// - Arrays must be terminated by NULL pointer.\n
+/// \~english @par
+/// Enviroment-variable parameters (envp[]) specified in arguments mus satisfy the following condiions:\n
+/// - When NULL is specified, the parent process inherits the parent process's environment variables.\n
+/// - An array of pointer to NULL terminated strings.\n
+/// - Arrays must be terminated by NULL pointer.\n
+/// \~english @par
+/// Be aware of the following.\n
+/// - Processing continues without interrupting event if setrlimit() fail.\n
+/// - System call access() checks whether or not there is access privilege,
+/// but returns PID regardless of the access privilege status.
+/// (If the process does not have access privilege, 100 retries are executed at 100 microseconds.)
+/// \~english @par
+/// Since the process attribute of a process cannot be changed during processing,
+/// if it is necessary to change the process attribute,
+/// it is necessary to call the following API and change the process attribute before calling this API.\n
+/// - CL_ProcessCreateAttrInit Initialize process attribute
+/// - CL_ProcessCreateAttrSetCgroup Setting process attribute (Cgroup)
+/// - CL_ProcessCreateAttrSetDisableCloseFds Setting process attribute (stop compulsion FD close)
+/// - CL_ProcessCreateAttrSetGid Setting process attribute (group ID)
+/// - CL_ProcessCreateAttrSetGroup Setting process attribute (process group)
+/// - CL_ProcessCreateAttrSetHoldFds Setting process attribute (maintain FD)
+/// - CL_ProcessCreateAttrSetName Setting process attribute (process name)
+/// - CL_ProcessCreateAttrSetSchedule Setting process attribute (schedule policy and priority)
+/// - CL_ProcessCreateAttrSetStackSize Setting process attribute (Stack Size)
+/// - CL_ProcessCreateAttrSetUid Setting process attribute (user ID)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// CL_ProcessTerminate, CL_ProcessTerminateGroup
+/// CL_ProcessCreateAttrInit, CL_ProcessCreateAttrSetCgroup,
+/// CL_ProcessCreateAttrSetDisableCloseFds, CL_ProcessCreateAttrSetGid,
+/// CL_ProcessCreateAttrSetGroup, CL_ProcessCreateAttrSetHoldFds,
+/// CL_ProcessCreateAttrSetName, CL_ProcessCreateAttrSetSchedule,
+/// CL_ProcessCreateAttrSetStackSize, CL_ProcessCreateAttrSetUid
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreate(const char *file, char * const argv[], char * const envp[], // NOLINT(readability/nolint)
+ const CL_ProcessAttr_t *attr);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrInit
+/// \~english @par Brief
+/// Initialize process attribute
+/// \~english @param [out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Initilize the CL_ProcessAttr_t structure that stores process attribute.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method(Async) / Fire and Forget / Broadcast / Sync / Set Get / Open Close / Request Notify / No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrInit(CL_ProcessAttr_t *attr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetName
+/// \~english @par Brief
+/// Set process name in process attribute
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] name
+/// const char* - process name (max length 16byte)
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the pointer (name) to the character string hat stores the process name specified
+/// by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process name to process attribute.\n
+/// The charactr string that stores the process name specified by the argument must satisfy the following conditions:\n
+/// - Terminated by a NULL.\n
+/// - The maximum lengthof character string is 16 byte including the termination character.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetName(CL_ProcessAttr_t *attr, const char *name); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetUid
+/// \~english @par Brief
+/// Set process attribute to user ID
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] uid
+/// uid_t - user ID
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to user ID.\n
+/// When UINT_MAX is set for the user ID,
+/// the user ID is set to 0 in the process attribute in the processing of CL_ProcessCreate().\n
+/// When 0 is set for the user ID,
+/// it is not reflected in the process attribute becose if is played by the process of CL_ProcessCreate().\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetUid(CL_ProcessAttr_t *attr, uid_t uid); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetGid
+/// \~english @par Brief
+/// Set process attribute to group ID
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] gid
+/// gid_t - Group ID
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to group ID.\n
+/// When 0 is set for the group ID,
+/// it is not reflected in the process attribute becose if is played by the process of CL_ProcessCreate().\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetGid(CL_ProcessAttr_t *attr, gid_t gid); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetSchedule
+/// \~english @par Brief
+/// Set process attribute to schedule policy and priority
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] policy
+/// CL_ProcessSchedPolicy_t - schedule policy
+/// \~english @param [in] priority
+/// int - priority
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @par
+/// enum CL_ProcessSchedPolicy_t Variable
+/// \~english @code
+/// typedef enum {
+/// CL_PROCESS_SCHED_POLICY_OTHER = 0, // TSS
+/// CL_PROCESS_SCHED_POLICY_RR, // Round-robin
+/// CL_PROCESS_SCHED_POLICY_FIFO, // FIFO
+/// } CL_ProcessSchedPolicy_t;
+/// @endcode
+/// \~english @par
+/// target to priority
+/// - -20~19 : CL_PROCESS_SCHED_POLICY_OTHER
+/// - 1~99 : CL_PROCESS_SCHED_POLICY_RR or CL_PROCESS_SCHED_POLICY_FIFO
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the schedule policy (policy) specified in the parameter is CL_PROCESS_SCHED_POLICY_RR
+/// and the priority (priority) is other than 1 to 99, set errno to EINVAL, -1 is returned.
+/// - When the schedule policy (policy) specified in the parameter is CL_PROCESS_SCHED_POLICY_FIFO
+/// and the priority (priority) is other than 1 to 99, set errno to EINVAL, -1 is returned.
+/// - Incorrect parameters are specified for the schedule policy (policy) specified in the arguments,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to schedule policy and priority.\n
+/// Error occur if the real-time schedule policy is set and
+/// the priority is passed value outside the range of 1-99.\n
+/// In the case of TSS, an error does not occur even if it is outside the range of -20 to 19,
+/// but ti is rounded to the nearest integer by a system call when a process is created.\n
+/// If not set by this funtion, the schedule policy set the TSS and priority sets 0.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetSchedule(CL_ProcessAttr_t *attr, // NOLINT(readability/nolint)
+ CL_ProcessSchedPolicy_t policy,
+ int priority);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetGroup
+/// \~english @par Brief
+/// Set process attribute to process group
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] create
+/// int - (0 or 1)
+/// \~english @par
+/// - 1 make
+/// - 0 not make(default)
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When a value oher than 0 or 1 is secified for the process group cration flag (create)
+/// specified in the parameter, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to process group.\n
+/// When a process group is created, all descendant process fork from child process also belong
+/// to the same process group, and the entire process group can be forcibly terminated.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetGroup(CL_ProcessAttr_t *attr, int create); // NOLINT(readability/nolint)
+
+int CL_ProcessCreateAttrSetCpuAssign(CL_ProcessAttr_t *attr, int cpu_assign); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetStackSize
+/// \~english @par Brief
+/// Set process attribute to stack size
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] stack_size
+/// int - stack size(byte)
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to stack size.\n
+/// The muximum configurable stack size is 1MB.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetStackSize(CL_ProcessAttr_t *attr, int stack_size); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetHoldFds
+/// \~english @par Brief
+/// Set process attribute to FD to maintain
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] hold_fds[]
+/// int -
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the array (hode_openfd[]) storing the list of the FD to be maintained specified
+/// by the arguments is NULL, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to FD to maintain.\n
+/// When nothing is set, FD other than 0, 1, and 2 are automatically close.\n
+/// For hold_openfds is stored in a CL_PROCESSS_ATTR_HOLD_FDS_NUM array,
+/// it is recommended that int hold_openfds[CL_PROCESSS_ATTR_HOLD_FDS_NUM] be used.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetHoldFds(CL_ProcessAttr_t *attr, int hold_fds[]); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetDisableCloseFds
+/// \~english @par Brief
+/// Set process attribute to suspend forced FD close
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to suspend forced FD close.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetDisableCloseFds(CL_ProcessAttr_t *attr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateAttrSetCgroup
+/// \~english @par Brief
+/// Set process attribute to Cgroup
+/// \~english @param [in,out] attr
+/// const CL_ProcessAttr_t* - Process attribute pointer
+/// \~english @param [in] cgroup_name
+/// const char* - Cgroup name
+/// \~english @par
+/// CL_ProcessAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[148];
+/// } CL_ProcessAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateAttrInit.
+/// - cgroup specified by CL_ProcessCreateCgroupCreate() has been created.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the pointer (name) to the character string hat stores the process name specified
+/// by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the character string length of the character string (cgroup_name) storing the process name specified
+/// by the argument is 64 byte or more, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set process attribute to Cgroup.\n
+/// Creat new Cgroup with CL_ProcessCreateCgroupCreate().\n
+/// An error occurs if an Cgroup name that does not exist is specified.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateAttrSetCgroup(CL_ProcessAttr_t *attr, // NOLINT(readability/nolint)
+ const char *cgroup_name);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessTerminate
+/// \~english @par Brief
+/// Kill the process
+/// \~english @param [in] pid
+/// pid_t - PID
+/// \~english @retval int file descriptor
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - CL_ProcessInit and CL_ProcessCreate must be running.
+/// (Process ID to be forcibly terminated exists)
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the process ID to be forcibly terminated does not exist, -1 is returned.
+/// \~english @par Detail
+/// The PID of the process is he return value (PID) of CL_ProcessCreate().
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// CL_ProcessCreate
+/////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessTerminate(pid_t pid); // NOLINT(readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessTerminateGroup
+/// \~english @par Brief
+/// Kill process group
+/// \~english @param [in] pid
+/// pid_t - process group ID
+/// \~english @retval int file descriptor
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - CL_ProcessInit and CL_ProcessCreate must be running.
+/// (Process ID to be forcibly terminated exists)
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the process ID to be forcibly terminated does not exist, -1 is returned.
+/// \~english @par Detail
+/// The process group ID is he return value (PID) of CL_ProcessCreate().
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// CL_ProcessCreate
+/////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessTerminateGroup(pid_t pid); // NOLINT(readability/nolint)
+
+int CL_ProcessAbort(pid_t pid); // NOLINT(readability/nolint)
+
+int CL_ProcessAbortGroup(pid_t pid); // NOLINT(readability/nolint)
+
+int CL_ProcessEuthanizeGroup(pid_t pid); // NOLINT(readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCleanup
+/// \~english @par Brief
+/// Collect child process
+/// \~english @param [in] sigchld_fd
+/// int - CL_ProcessInit() function return to fd
+/// \~english @param [out] cleanup_info
+/// CL_ProcessCleanupInfo_t* - Pointer to chiled process info
+/// \~english @par
+/// CL_ProcessCleanupInfo_t struct
+/// \~english @code
+/// typedef struct {
+/// pid_t pid; /* The process ID of the child. */
+/// int code; /* signal code */
+/// int status; /* the exit status of the child or the signal */
+/// } CL_ProcessCleanupInfo_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval 1 Success
+/// (If WNOHANG was specified and no child(ren) specified by id has yet changed state)
+/// \~english @retval -1 Error (setting to errno)
+/// \~english @par Prerequisite
+/// - Must be runnning CL_ProcessInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer (cleanup_info) to the child process information structure is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When a systemu call (waitid) fails, -1 is returned.
+/// - When there are no child process in state waitable, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// This API must be called before createing a thread.\n
+/// \~english @par
+/// It must be called many times while the return valu is 1.
+/// After the return value reaches 0, calling it again results in an error (ECHILD).\n
+/// The code of CL_ProcessCleanupInfo_t cotains the following value:\n
+/// - CLD_EXITED : Finished child process (exited)
+/// - CLD_KILLED : Killed child process
+/// - CLD_DUMPED : Ended abnormally child process
+/// - CLD_TRAPPED : Trapped traced child process
+/// - CLD_STOPPED : Stopped child process (stop)
+/// - CLD_CONTINUED restarted the sopped child process (after Linux 2.6.9)
+/// - The exit status is stored in status only when code is CLD_EXITED. Otherwise, signals are stored.
+/// - Need to include signal.h to use CLD_*.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCleanup(int sigchld_fd, CL_ProcessCleanupInfo_t *cleanup_info); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ThreadCreate
+/// \~english @par Brief
+/// Create thread
+/// \~english @param [out] thread
+/// pthread_t* - thread hadle
+/// \~english @param [in] attr
+/// pthread_attr_t* - Thread attibute pointer for pthread
+/// \~english @param [in] cl_attr
+/// CL_ThreadAttr_t* - Tred attribute pointer for expansion
+/// \~english @param [in] start_routine
+/// void*(*)(void*) - Pointer to the entry function of the thread
+/// \~english @param [in] arg
+/// void* - Argument to the entry function of the thread
+/// \~english @par
+/// CL_ThreadAttr_t structure
+/// \~english @code
+/// typedef struct {
+/// char body[20];
+/// } CL_ThreadAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error (set errno)
+/// \~english @retval EAGAIN failure to create thread
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the thread handler (thread) specified in the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the pointer of the thread attribute specified in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the pointer (start_routine) of the entry function of the thread specified by the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - Failure to initialize semaphore, set errno to sem_init, -1 is returned.
+/// - Failure to create thread (pthread_create), EAGAIN is returned.
+/// - Failure to rock semaphore (sem_wait), set errno to sem_init, -1 is returned.
+/// \~english @par Detail
+/// Create thread.\n
+/// The extension thread attribute (cl_attr) is used o assign the thread name set
+/// by CL_ThreadCreateAttrSetName(CL_ThreadAttr_t*, const char*).\n
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ThreadCreate(pthread_t *thread, pthread_attr_t *attr, // NOLINT(readability/nolint)
+ CL_ThreadAttr_t *cl_attr, void *(*start_routine)(void *),
+ void *arg);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ThreadCreateAttrInit
+/// \~english @par Brief
+/// Initialize thread attribute
+/// \~english @param [out] attr
+/// CL_ThreadAttr_t* - thread attribute pointer
+/// \~english @par
+/// CL_ThreadAttr_t structure
+/// \~english @code
+/// typedef struct {
+/// char body[20];
+/// } CL_ThreadAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error (set errno)
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer (attr) of the thread attributespecified by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Initialize structure CL_ThreadAttr_t that stores threade attribute.\n
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ThreadCreateAttrInit(CL_ThreadAttr_t *attr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ThreadCreateAttrSetName
+/// \~english @par Brief
+/// Set thread attribute to thread name
+/// \~english @param [out] attr
+/// CL_ThreadAttr_t* - thread attribute pointer
+/// \~english @param [in] name
+/// const char* - Pointer to the string storing the thread name (max length 16byte)
+/// \~english @par
+/// CL_ThreadAttr_t structure
+/// \~english @code
+/// typedef struct {
+/// char body[20];
+/// } CL_ThreadAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error (set errno)
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer (attr) of thread attribute specified by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the pointer (name) to the character string that stores the thread name specified
+/// by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Set thread attribute to thread name\n
+/// The characer string that stores the thread name specified by the argument must satisfy the following conditions:\n
+/// - Terminated by a NULL.\n
+/// - The maximum lengthof character string is 16 byte including the termination character.\n
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ThreadCreateAttrSetName(CL_ThreadAttr_t *attr, const char *name); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupCreate
+/// \~english @par Brief
+/// Create Cgroup
+/// \~english @param [in] cgroup_name
+/// const char* - cgroup name
+/// \~english @param [in] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribut
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr by CL_ProcessCreateCgroupAttrInit
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the Cgroup name (cgroup_name) specified by the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the pointer (attr) of the Cgroup attribute specified by the argumet is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When the area for directory path name of the CPU subsystem of Cgroup could not be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When the area for directory of the CPU subsystem of Cgroup could not be create, -1 is returned.
+/// - When the area for file path name of the CPU subsystem of Cgroup could not be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When file descriptor of the CPU subsystem of Cgroup could not be acquired, -1 is returned.
+/// - When setting value to CPU subsystem of Cgroup could not be written, -1 is returned.
+/// - When the area for directory path name of the memory subsystem of Cgroup could not be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When the area for directory of the memory subsystem of Cgroup could not be create, -1 is returned.
+/// - When the area for file path name of the memory subsystem of Cgroup could not be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When file descriptor of the memory subsystem of Cgroup could not be acquired, -1 is returned.
+/// - When setting value to memory subsystem of Cgroup could not be written, -1 is returned.
+/// \~english @par Detail
+/// Create Cgroup to which the process to be created belongs.
+/// If it belongs to Cgroup that has already been created, it is not necessary to create it.\n
+/// \~english @par
+/// Since the Cgroup attribute cannot be changed during Cgroup, if it is necessary o chage the Cgroup attribute,
+/// it is necessary to call the following API and change the Cgroup attribute calling this API.\n
+/// - CL_ProcessCreateCgroupAttrInit :Initialize Cgroup attribute
+/// - CL_ProcessCreateCgroupAttrSetCfsBandwidthControl :TSS process CPU time control by Bandwidth Control
+/// - CL_ProcessCreateCgroupAttrSetCpuShares :TSS process CPU time control
+/// - CL_ProcessCreateCgroupAttrSetMemoryLimit :Contol memory usage
+/// - CL_ProcessCreateCgroupAttrSetMemoryUsageNotification :Memory usage notification setting
+/// - CL_ProcessCreateCgroupAttrSetRtThrottling :FIFO/RR process CPU time control
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// CL_ProcessCreateCgroupDelete,
+/// CL_ProcessCreateCgroupAttrInit, CL_ProcessCreateCgroupAttrSetCfsBandwidthControl,
+/// CL_ProcessCreateCgroupAttrSetCpuShares, CL_ProcessCreateCgroupAttrSetMemoryLimit,
+/// CL_ProcessCreateCgroupAttrSetMemoryUsageNotification, CL_ProcessCreateCgroupAttrSetRtThrottling,
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupCreate(const char *cgroup_name, // NOLINT(readability/nolint)
+ CL_ProcessCreateCgroupAttr_t *attr);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrInit
+/// \~english @par Brief
+/// Initialize Cgroup attribute
+/// \~english @param [out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute pointer
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of Cgroup attribute (attr) specified in the arguments is NULL, set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Initialize Cgroup attibute with 0.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrInit(CL_ProcessCreateCgroupAttr_t *attr); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrSetRtThrottling
+/// \~english @par Brief
+/// Set FIFO/RR process CPU time control
+/// \~english @param [in,out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute
+/// \~english @param [in] runtime_us
+/// int - CPU allocation time(us)
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateCgroupAttrInit.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of Cgroup attribute (attr) specified in the arguments is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Limiting the CPU time allocated to a process to
+/// which a real-time class schedule policy (SCHED_FIFO/SCHED_RR) is applied.\n
+/// Set the value of argument runtime_us to the cpu.rt_runtime_us (CPU allocation time) of created Cgroup.\n
+/// cpu.rt_period_us(unit time:1000000us) is not changed.\n
+/// If not set, Cgroup created will remain at default (CPU allocation time:950000us).\n
+/// The configurable range of runtime_us depends on the use of Cgroup and the kernel version.
+/// The user sets an appropriate value.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrSetRtThrottling( // NOLINT(readability/nolint)
+ CL_ProcessCreateCgroupAttr_t *attr, int runtime_us);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrSetCpuShares
+/// \~english @par Brief
+/// Set TSS process CPU time control
+/// \~english @param [in,out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute pointer
+/// \~english @param [in] cpu_shares
+/// int - An integer value that sepcified the relative distribution of CPU time
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateCgroupAttrInit
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer (attr) of the Cgroup attribute specified by the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Cotrols the CPU time allocated to a process to which
+/// a class TSS schedule policy (SCHED_OTHER, etc.) is applied.\n
+/// If cpu_shares is set with this function, a single Cgroup is created and cpu.shares is set with that value.\n
+/// If not set, remain at default.\n
+/// cpu_shares is set to the standard value 1024, and CPU time is allocated according
+/// to the allocaion value specified between Cgroup.\n
+/// Task Cgroup with cpu.shares set to 1024 has twice as much CPU time as
+/// task Cgroup with cpu.shares set to 512.\n
+/// Processes belonging to the same Cgroup are equally allocated CPU time allocated to Cgroup.\n
+/// Note that the time distribution is distributed across al CPU cores on a multi-core system.\n
+/// In a multicore system, if Cgroup limit is set to 100% of the CPU,
+/// 100% of each CPU core wil be available.\n\n
+/// Examle) If Cgroup A is set to use 25% of the CPU and Cgroup B is set to use 75% of the CPU,\n
+/// and a process that uses CPU intensively is started on a 4-core system (1 process in A and 3 processes in B),\n
+/// the CPU allocaion is distributed as follows.\n\n
+/// \~english @par
+/// | PID | cgroup | CPU | CPU allotment |
+/// |:---:|:------:|:---:|:-------:|
+/// | 100 | A | 0 | CPU0 100% |
+/// | 101 | B | 1 | CPU1 100% |
+/// | 102 | B | 2 | CPU2 100% |
+/// | 103 | B | 3 | CPU3 100% |
+/// \~english @par
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrSetCpuShares(CL_ProcessCreateCgroupAttr_t *attr, // NOLINT(readability/nolint)
+ int cpu_shares);
+
+///////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrSetCfsBandwidthControl
+/// \~english @par Brief
+/// Set TS process CU time control by Bandwidth Control
+/// \~english @param [in,out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute pointer
+/// \~english @param [in] cfs_quota_us
+/// int - CPU allocation time
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateCgroupAttrInit
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Controls the amount of time allocated to processes o whitch TSS class schedule plicy (SCHED_OTHER, etc.) are
+/// applied using bandwidth control of CFS(Completely Fair Scheduler) implemented from kernel 3.2.\n
+/// Set the value of argument cfs_quota_us to the cpu.cfs_quota_us of created Cgroup.\n
+/// cpu.cfs_period_us(unit time:1000000us) is not changed.\n
+/// If not set, the created Cgroup will not have CPU allocatio control. (set cpu.cfs_guota_us to -1).\n
+/// The time (%) allocated to Cgroup can be set correctly,
+/// and it can be allocated correctly if the CPU is free.\n
+/// It is scheduled to be allocated as much as possible even if it conflicts with other Cgroup's.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrSetCfsBandwidthControl( // NOLINT(readability/nolint)
+ CL_ProcessCreateCgroupAttr_t *attr, int cfs_quota_us);
+
+/////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrSetMemoryLimit
+/// \~english @par Brief
+/// Control memory usage
+/// \~english @param [in,out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute pointer
+/// \~english @param [in] memory_limit
+/// int - memory limit (byte)
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateCgroupAttrInit
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// Control the CPU time allocated to a process.\n
+/// Set the value of argument memory_limit to the memory.limit_in_bytes of created Cgroup.\n
+/// If not set, there is no memory limit.When a request exceeding the memory limit is issued,
+/// a SIGKILL is sent from the kernel and the process is discarded.
+/// Note: When the memory limit is exceeded, control moves to 00M,
+/// but its operation ca be changed (Documentation/cgroup/memory.txt).\n
+/// Write memory.oom_control to 1 to stop the OOM-Killer.
+/// When OOM-Killer is stopped, the task below Cgroup becomes hang/sleep.\n
+/// The task moves when the limit of the memory Cgroup increaes or when usage decreases. When usage decreases,\n
+/// - Task was killed\n
+/// - Task was moved other group\n
+/// - File has been deleted\n
+/// \~english @par
+/// You can also receive a eventf notification from OOM.\n
+/// Memory usage is counted as follows\n
+/// - RSS(All mapped anon pages)\n
+/// - Page Cache\n
+/// - First acess Shared Pages in Cgroup\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrSetMemoryLimit(CL_ProcessCreateCgroupAttr_t *attr, // NOLINT(readability/nolint)
+ int memory_limit);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupAttrSetMemoryUsageNotification
+/// \~english @par Brief
+/// Set notificatio when memory usage exceeds the specified amount
+/// \~english @param [in,out] attr
+/// const CL_ProcessCreateCgroupAttr_t* - Cgroup attribute pointer
+/// \~english @param [in] usage_in_bytes
+/// int - usage in bytes(byte)
+/// \~english @param [in] event_fd
+/// int - File dexcriptor created by system call eventfd()
+/// \~english @par
+/// CL_ProcessCreateCgroupAttr_t struct
+/// \~english @code
+/// typedef struct {
+/// char body[24];
+/// } CL_ProcessCreateCgroupAttr_t;
+/// @endcode
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Initialize attr with CL_ProcessCreateCgroupAttrInit
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the pointer of the process attribute specified (attr) in the argument is NULL,
+/// set errno to EINVAL, -1 is returned.
+/// - When event_fd is negative for a file descriptor created by system call eventfd(),
+/// set errno to EINVAL, -1 is returned.
+/// \~english @par Detail
+/// event_fd is notifued when memory usage exceeds argument usage_in_bytes.\n
+/// See eventfd for details of event_fd.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupAttrSetMemoryUsageNotification( // NOLINT(readability/nolint)
+ CL_ProcessCreateCgroupAttr_t *attr, int usage_in_bytes, int event_fd);
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupDelete
+/// \~english @par Brief
+/// Delete Cgroup
+/// \~english @param [in] cgroup_name
+/// const char* - cgroup name
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Need to be runnning CL_ProcessCreateCgroupCreate.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the Cgroup (cgroup_name) name specified inthe argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the area for directory path name of the CPU subsystem of Cgroup and
+/// memory subsystem of Cgroup could not be allocated, set errno to EINVAL, -1 is returned.
+/// - When the area for the directory path name of the memory subsystem of Cgroup cannot be allocated and
+/// the directory for the CPU subsystem of Cgroup does not exist, set errno to EINVAL, -1 is returned.
+/// - When the directory for the CPU subsystem of Cgroup does not exist and
+/// the area for the directory path name of the memory subsystem of Cgroup cannot be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When the directory for the memory subsystem of Cgroup and
+/// the directory for the CPU subsystem of Cgroup does not exist, set errno to EINVAL, -1 is returned.
+/// - When the directory for the memory subsystem of Cgroup could not be deleted, -1 is returned.
+/// - When the directory for the CPU subsystem of Cgroup could not be deleted, -1 is returned.
+/// \~english @par Detail
+/// Delete Cgroup. If there is a proess belonging to Cgroup, error code (EBUSY) is returned.\n
+/// \~english @par
+/// Success is also notified in the following cases:\n
+/// - When the area for directory path name of memory subsyste Cgroup could not be allocated
+/// but CPU subsystem of Cgroup was deleted successfully.
+/// - When the directory for the memory subsystem of Cgroup does not exist,
+/// but CPU subsystem of Cgroup was deleted successfully.
+/// - When the area for directory path name of CPU subsyste Cgroup could not be allocated
+/// but memory subsystem of Cgroup was deleted successfully.
+/// - When the directory for the CPU subsystem of Cgroup does not exist,
+/// but memory subsystem of Cgroup was deleted successfully.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// CL_ProcessCreateCgroupCreate
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupDelete(const char *cgroup_name); // NOLINT(readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CL_ProcessCreateCgroupClassify
+/// \~english @par Brief
+/// Move process to the Cgroup
+/// \~english @param [in,out] cgroup_name
+/// const char* - Destination A name
+/// \~english @param [in] pid
+/// pid_t - process ID
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// - Need to be running CL_ProcessCreateCgroupCreate.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - When the Cgroup (cgroup_name) specified in the argument is NULL, set errno to EINVAL, -1 is returned.
+/// - When the area for directory path name of memory subsystem of Cgroup and
+/// CPU subsystem of Cgroup could not be allocated, set errno to EINVAL, -1 is returned.
+/// - When the area for directory path name of memory subsystem of Cgroup could not be allocated,
+/// and the directory for CPU subsystem of Cgroup does not exist, set errno to EINVAL, -1 is returned.
+/// - When the directory for memory subsystem of Cgroup does not exist and
+/// the directory for CU subsystem of Cgroup could not allocated , set errno to EINVAL, -1 is returned.
+/// - When the directory for the memory subsystem of Cgroup and
+/// the directory for the CPU subsystem of Cgroup does not exist, set errno to EINVAL, -1 is returned.
+/// - When the area for directory path name of the memory subsystem of Cgroup could not allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When the file descripter for the memory subsystem of Cgroup could not be obtained, -1 is returned.
+/// - When pid could not be written to the file for memory subsystem of Cgroup, -1 is returned.
+/// - When the area for directory path name of the CPU subsystem of Cgroup could not be allocated,
+/// set errno to EINVAL, -1 is returned.
+/// - When the file decsripter for the CPU subsystem of Cgroup could not be allocated, -1 is returned.
+/// - When pid could not be written to the file for CPU subsystem of Cgroup, -1 is returned.
+/// \~english @par Detail
+/// Move process to the Cgroup.\n
+/// \~english @par
+/// Success is also notified in the following cases:\n
+/// - When the area for directory path name of memory subsyste Cgroup could not be allocated
+/// but CPU subsystem of Cgroup was deleted successfully.
+/// - When the directory for the memory subsystem of Cgroup does not exist,
+/// but CPU subsystem of Cgroup was deleted successfully.
+/// - When the area for directory path name of CPU subsyste Cgroup could not be allocated
+/// but memory subsystem of Cgroup was deleted successfully.
+/// - When the directory for the CPU subsystem of Cgroup does not exist,
+/// but memory subsystem of Cgroup was deleted successfully.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////
+int CL_ProcessCreateCgroupClassify(const char *cgroup_name, pid_t pid); // NOLINT(readability/nolint)
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef _cl_process_h_ // NOLINT(build/header_guard)
diff --git a/video_in_hal/nsframework/common_library/client/include/native_service/cl_region.h b/video_in_hal/nsframework/common_library/client/include/native_service/cl_region.h
new file mode 100755
index 0000000..c9eec5f
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/native_service/cl_region.h
@@ -0,0 +1,257 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file cl_region.h
+ * @brief region manage
+ *
+ */
+
+#ifndef _CL_REGION_H_ // NOLINT(build/header_guard)
+#define _CL_REGION_H_ // NOLINT(build/header_guard)
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <unistd.h>
+
+#define CL_REGION_DEFAULT_SIZE (4 * 1024)
+
+#define CL_ALIGNOF(type) __alignof(type)
+
+typedef void (*cl_region_cleanup_pt)(void *data);
+
+typedef struct cl_region_cleanup_s cl_region_cleanup_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// region cleanup struct
+/////////////////////////////////////////////////////////////////////////////////////
+struct cl_region_cleanup_s { // NOLINT(readability/nolint)
+ cl_region_cleanup_pt handler;
+ void *data;
+ cl_region_cleanup_t *next;
+};
+
+
+typedef struct cl_region_large_s cl_region_large_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// region large struct
+/////////////////////////////////////////////////////////////////////////////////////
+struct cl_region_large_s { // NOLINT(readability/nolint)
+ cl_region_large_t *next;
+ void *alloc;
+ size_t size;
+};
+
+
+typedef struct cl_region_s cl_region_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// region data struct
+/////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ uint8_t *last;
+ uint8_t *end;
+ cl_region_t *next;
+ int failed;
+} cl_region_data_t;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Monitor
+/// \~english @par Brief
+/// region struct
+/////////////////////////////////////////////////////////////////////////////////////
+struct cl_region_s { // NOLINT(readability/nolint)
+ cl_region_data_t d;
+ size_t max;
+ cl_region_t *current;
+ cl_region_large_t *large;
+ cl_region_cleanup_t *cleanup;
+};
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file cl_region.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Region
+/// \~english @par Brief
+/// Region create
+/// \~english @param [in] size
+/// size_t - the size to create
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+cl_region_t *CL_RegionCreate(size_t size); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Region
+/// \~english @par Brief
+/// Region destroy
+/// \~english @param [in] region
+/// cl_region_t * - the region to destroy
+/// \~english @retval 0 Success
+/// \~english @retval -1 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+void CL_RegionDestroy(cl_region_t *region); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Region
+/// \~english @par Brief
+/// Region allocation
+/// \~english @param [in] region
+/// cl_region_t * - the region to allocate
+/// \~english @param [in] size
+/// size_t * - the size to allocate
+/// \~english @param [in] align_size
+/// size_t * - the size to align
+/// \~english @retval the pointer to region allocated
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+#define CL_RegionAlloc(region, type, length) \
+ cl_region_alloc(region, sizeof(type) * length, CL_ALIGNOF(type))
+void *cl_region_alloc(cl_region_t *region, size_t size, size_t align_size); // NOLINT(readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Region
+/// \~english @par Brief
+/// Region free
+/// \~english @param [in] region
+/// cl_region_t * - the region to free
+/// \~english @param [in] p
+/// void * - the pointer to region
+/// \~english @retval true Success
+/// \~english @retval false Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+bool CL_RegionFree(cl_region_t *region, void *p); // NOLINT(readability/nolint)
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Region
+/// \~english @par Brief
+/// add region cleanup
+/// \~english @param [in] region
+/// cl_region_t * - the region to allocate
+/// \~english @param [in] size
+/// size_t * - the size to add
+/// \~english @param [in] align_size
+/// size_t * - the size to align
+/// \~english @retval the pointer to region cleanup added
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+#define CL_RegionCleanupAdd(region, type, length) \
+ cl_region_cleanup_add(region, sizeof(type) * length, CL_ALIGNOF(type))
+cl_region_cleanup_t *cl_region_cleanup_add(cl_region_t *region, size_t size, // NOLINT(readability/nolint)
+ size_t align_size);
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _CL_REGION_H_ */ // NOLINT(build/header_guard)
+
+/* vim:set ts=8 sw=2 sts=2: */
diff --git a/video_in_hal/nsframework/common_library/client/include/native_service/cl_sem.h b/video_in_hal/nsframework/common_library/client/include/native_service/cl_sem.h
new file mode 100755
index 0000000..9dbe54e
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/native_service/cl_sem.h
@@ -0,0 +1,73 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _cl_sem_h_ // NOLINT(build/header_guard)
+#define _cl_sem_h_ // NOLINT(build/header_guard)
+
+#include <semaphore.h>
+
+#ifdef __cplusplus
+#define EXT_C extern "C"
+#else
+#define EXT_C
+#endif // __cplusplus
+
+/**
+ * @file cl_sem.h
+ * @brief \~english This file contains the api of sem wait.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Sem
+/// \~english @par Brief
+/// Sem wait
+/// \~english @param [in] semid
+/// sem_t * - the pointer to the union sem_t
+/// \~english @param [in] timeout
+/// unsigned int - the count of timeout
+/// \~english @retval 0 Success
+/// \~english @retval not 0 Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EXT_C int CL_SemWait(sem_t *semid, unsigned int timeout); // NOLINT(readability/nolint)
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+#endif // #ifndef _cl_sem_h_ // NOLINT(build/header_guard)
diff --git a/video_in_hal/nsframework/common_library/client/include/native_service/common_library.h b/video_in_hal/nsframework/common_library/client/include/native_service/common_library.h
new file mode 100755
index 0000000..929d04d
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/include/native_service/common_library.h
@@ -0,0 +1,48 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef NATIVESERVICE_COMMONLIBRARY_H_ // NOLINT(build/header_guard)
+#define NATIVESERVICE_COMMONLIBRARY_H_
+
+/**
+ * @file common_library.h
+ * @brief \~english include all common_library head files
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup common_library
+ * @ingroup native_service
+ * @{
+ */
+
+#include <native_service/cl_process.h>
+#include <native_service/cl_sem.h>
+#include <native_service/cl_monitor.h>
+#include <native_service/cl_lock.h>
+#include <native_service/cl_region.h>
+#include <native_service/cl_lockid.h>
+
+
+/** @}*/ // end of common_library
+/** @}*/ // end of NativeService
+/** @}*/ // end of BaseSystem
+
+#endif // NATIVESERVICE_COMMONLIBRARY_H_
diff --git a/video_in_hal/nsframework/common_library/client/libcommon.ver b/video_in_hal/nsframework/common_library/client/libcommon.ver
new file mode 100755
index 0000000..f89c9ba
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/libcommon.ver
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# CommonLib version script
+#
+{
+ global:
+ ### .text section ###
+ CL_*;
+ cl_region_alloc;
+ cl_region_cleanup_add;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/video_in_hal/nsframework/common_library/client/src/cl_cgroup.c b/video_in_hal/nsframework/common_library/client/src/cl_cgroup.c
new file mode 100755
index 0000000..812ccaa
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/src/cl_cgroup.c
@@ -0,0 +1,260 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <inttypes.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include "cl_cgroup.h"
+
+#define CL_CGROOT "/sys/fs/cgroup/"
+
+static char *cl_cgroup_base(cl_cgroup_t cgroup) {
+ switch (cgroup) { // LCOV_EXCL_BR_LINE 200: internal interface,code make sure
+ case CL_CGROUP_MEMORY:
+ return CL_CGROOT "/memory";
+ case CL_CGROUP_CPU:
+ return CL_CGROOT "/cpu";
+ }
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return NULL;// LCOV_EXCL_LINE 200:internal interface,code make sure nerver run
+}
+
+static char *cl_cgroup_create_path(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler) {
+ char *path = malloc(FILENAME_MAX);
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 5:fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = ENOMEM; // LCOV_EXCL_LINE 5:fail safe for libc malloc
+ goto error; // LCOV_EXCL_LINE 5:fail safe for libc malloc
+ }
+
+ if (cgroup != CL_CGROUP_MEMORY && cgroup != CL_CGROUP_CPU) { // LCOV_EXCL_BR_LINE 200: internal interface,code make sure
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = EINVAL; // LCOV_EXCL_LINE 200: internal interface,code make sure
+ goto error; // LCOV_EXCL_LINE 200: internal interface,code make sure
+ }
+
+ if (cgroup_name == NULL) { // LCOV_EXCL_BR_LINE 200: internal interface,code make sure
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = EINVAL; // LCOV_EXCL_LINE 200: internal interface,code make sure
+ goto error; // LCOV_EXCL_LINE 200: internal interface,code make sure
+ }
+
+ if (controler) {
+ snprintf(path, FILENAME_MAX, "%s/%s/%s", cl_cgroup_base(cgroup), cgroup_name, controler);
+ } else {
+ snprintf(path, FILENAME_MAX, "%s/%s", cl_cgroup_base(cgroup), cgroup_name);
+ }
+
+ return path;
+
+error:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ free(path); // LCOV_EXCL_LINE 200: internal interface,code make sure
+ return NULL; // LCOV_EXCL_LINE 200: internal interface,code make sure
+}
+
+int cl_cgroup_make(cl_cgroup_t cgroup, const char *cgroup_name) {
+ int r = -1;
+ char *path = cl_cgroup_create_path(cgroup, cgroup_name, NULL);
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ goto exit; // LCOV_EXCL_LINE 6: double check
+ }
+
+ if (mkdir(path, 0777) < 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc mkdir
+ goto exit;
+ }
+
+ r = 0;
+
+exit:
+ if (path) {// LCOV_EXCL_BR_LINE 6: double check
+ free(path);
+ }
+ return r;
+}
+
+int cl_cgroup_remove(cl_cgroup_t cgroup, const char *cgroup_name) {
+ int r = -1;
+ char *path = cl_cgroup_create_path(cgroup, cgroup_name, NULL);
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ goto exit; // LCOV_EXCL_LINE 6: double check
+ }
+
+ if (rmdir(path) < 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc rmdir
+ goto exit;
+ }
+
+ r = 0;
+
+exit:
+ if (path) { // LCOV_EXCL_BR_LINE 6: double check
+ free(path);
+ }
+ return r;
+}
+
+int cl_cgroup_exist(cl_cgroup_t cgroup, const char *cgroup_name) {
+ int r = -1;
+ char *path = cl_cgroup_create_path(cgroup, cgroup_name, NULL);
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ goto exit; // LCOV_EXCL_LINE 6: double check
+ }
+
+ r = access(path, F_OK);
+
+exit:
+ if (path) { // LCOV_EXCL_BR_LINE 6: double check
+ free(path);
+ }
+ return r;
+}
+
+int cl_cgroup_open(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler, int flags) {
+ int r = -1;
+ char *path = cl_cgroup_create_path(cgroup, cgroup_name, controler);
+ int fd = -1;
+
+ if (path == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ goto exit; // LCOV_EXCL_LINE 6: double check
+ }
+
+ if (controler == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = EINVAL; // LCOV_EXCL_LINE 6: double check
+ goto exit; // LCOV_EXCL_LINE 6: double check
+ }
+
+ if ((fd = open(path, flags | O_CLOEXEC)) < 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc open
+ goto exit;
+ }
+
+ r = fd;
+
+exit:
+ if (path) { // LCOV_EXCL_BR_LINE 6: double check
+ free(path);
+ }
+ return r;
+}
+
+int cl_cgroup_set_string(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler, const char *string) {
+ int r = -1;
+ int fd = -1;
+
+ if (controler == NULL || string == NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = EINVAL;// LCOV_EXCL_LINE 6: double check
+ goto exit;// LCOV_EXCL_LINE 6: double check
+ }
+
+ fd = cl_cgroup_open(cgroup, cgroup_name, controler, O_WRONLY);
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc funtion open
+ goto exit;
+ }
+
+ if (write(fd, string, strlen(string)) < 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc write
+ goto exit;
+ }
+
+ r = 0;
+
+exit:
+ if (fd >= 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc funtion open
+ int save_err = errno;
+ close(fd);
+ errno = save_err;
+ }
+ return r;
+}
+
+int cl_cgroup_set_num(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler, int64_t value) {
+ char num_str[22];
+
+ snprintf(num_str, sizeof(num_str), "%" PRId64, value);
+
+ return cl_cgroup_set_string(cgroup, cgroup_name, controler, num_str);
+}
+
+int cl_cgroup_get_string(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler, char *string, size_t length) { // LCOV_EXCL_START 8: dead code // NOLINT (readability/nolint)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ int r = -1;
+ int fd = -1;
+
+ if (controler == NULL || string == NULL) {
+ errno = EINVAL;
+ goto exit;
+ }
+
+ fd = cl_cgroup_open(cgroup, cgroup_name, controler, O_RDONLY);
+ if (fd < 0) {
+ goto exit;
+ }
+
+ if (read(fd, string, length) < 0) {
+ goto exit;
+ }
+
+ r = 0;
+
+exit:
+ if (fd >= 0) {
+ int save_err = errno;
+ close(fd);
+ errno = save_err;
+ }
+ return r;
+}
+// LCOV_EXCL_STOP
+
+int64_t cl_cgroup_get_num(cl_cgroup_t cgroup, const char *cgroup_name, const char *controler) { // LCOV_EXCL_START 8: dead code // NOLINT (readability/nolint)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ int r;
+ char num_str[22];
+
+ if ((r = cl_cgroup_get_string(cgroup, cgroup_name, controler, num_str, sizeof(num_str))) < 0) {
+ return r;
+ }
+
+ return atoll(num_str);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/nsframework/common_library/client/src/cl_lock.c b/video_in_hal/nsframework/common_library/client/src/cl_lock.c
new file mode 100755
index 0000000..6add2a5
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/src/cl_lock.c
@@ -0,0 +1,221 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// #include <stdio.h>
+// #include <stdlib.h>
+#include <errno.h>
+
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <pthread.h>
+
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+#include "cl_lock_internal.h"
+#include "cl_error.h"
+
+static int shm_id = -1;
+
+/*
+ * Lock file is consists of slots(4KB)
+ * The slot layout is:
+ * 0 ~ 4Byte : field of PID
+ * 4Byte ~ 28Byte : field of pthread_mutex_t
+ */
+
+
+static int cl_LockfileInit(void *base) {
+ int i;
+ /*
+ int j;
+ */
+ void *addr;
+ pthread_mutexattr_t attr;
+
+ if (pthread_mutexattr_init(&attr) != 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc pthread_mutexattr_init
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5:fail safe for libc pthread_mutexattr_init
+ }
+ if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED) != 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc pthread_mutexattr_setpshared
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5:fail safe for libc pthread_mutexattr_setpshared
+ }
+// if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP) != 0) {
+// return -1;
+// }
+ if (pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST) != 0) {
+ return -1;
+ }
+
+ for (i = 0; i < LID_NUM; i++) {
+ /*
+ addr = SLOT_SIZE * 1 + base;
+ for (j = 0; j < 1024; j++) {
+ *(int*)(addr + j * sizeof(int)) = j;
+ }
+ */
+ addr = SLOT_SIZE * i + (char *)base + sizeof(int);
+ pthread_mutex_init((pthread_mutex_t *)addr, &attr);
+
+ }
+ if (pthread_mutexattr_destroy(&attr) != 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc pthread_mutexattr_destroy
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5:fail safe for libc pthread_mutexattr_destroy
+ }
+ return 0;
+}
+
+/*
+ * Initialize in the system
+ * This function will generate the Lock file, and initialize pthread_mutex_t for all slots
+ */
+int CL_LockSystemInit(void) {
+ int fd = -1;
+ int ret = 0;
+ void *base = MAP_FAILED;
+
+ fd = shm_open(LOCKFILE_NAME, O_CREAT | O_EXCL | O_RDWR, (S_IRWXG | S_IRWXO | S_IRWXU));
+ if (fd < 0) {
+ ret = -1;
+ goto exit;
+ }
+ if (ftruncate(fd, LOCKFILE_SIZE) != 0) { // LCOV_EXCL_BR_LINE 5:fail safe for libc ftruncate
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ ret = -1; // LCOV_EXCL_LINE 5:fail safe for libc ftruncate
+ goto exit; // LCOV_EXCL_LINE 5:fail safe for libc ftruncate
+ }
+
+ base = mmap(NULL, LOCKFILE_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0);
+ if (base == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5:fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ ret = -1; // LCOV_EXCL_LINE 5:fail safe for libc mmap
+ goto exit; // LCOV_EXCL_LINE 5:fail safe for libc mmap
+ }
+
+ if (cl_LockfileInit(base) < 0) { // LCOV_EXCL_BR_LINE 11:out branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ ret = -1; // LCOV_EXCL_LINE 5:fail safe for libc
+ goto exit; // LCOV_EXCL_LINE 5:fail safe for libc
+ }
+
+exit:
+ if (fd >= 0) {
+ close(fd);
+ }
+ if (base != MAP_FAILED) {
+ munmap(base, LOCKFILE_SIZE);
+ }
+ return ret;
+}
+
+void CL_LockSystemFin_debug(void) {
+ if (shm_id >= 0) {
+ close(shm_id);
+ }
+ shm_unlink(LOCKFILE_NAME);
+ shm_id = -1;
+}
+
+/*
+ * Initialize in the process
+ * Open the Lock file
+ */
+int CL_LockProcessInit(void) {
+ if (shm_id < 0) {
+ shm_id = shm_open(LOCKFILE_NAME, O_RDWR, (S_IRWXG | S_IRWXO | S_IRWXU));
+ }
+ if (shm_id < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function shm_open
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for glibc function shm_open
+ }
+ return 0;
+}
+
+void *CL_LockMap(int lid) {
+ if ((lid < 0) || (lid >= LID_NUM)) {
+ errno = EINVAL;
+ return MAP_FAILED;
+ }
+ return mmap(NULL, SLOT_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, shm_id, (off_t)(lid * SLOT_SIZE));
+}
+
+int CL_LockUnmap(void *addr) {
+ return munmap(addr, SLOT_SIZE);
+}
+
+int CL_LockGet(void *addr) {
+ int ret;
+
+ if ((addr == NULL) || (addr == MAP_FAILED)) {
+ ret = EINVAL;
+ } else {
+ CL_DBG_PRINT("@@@@@ %s Start: pid = %d\n", __func__, *(int *)addr);
+ // LCOV_EXCL_BR_START 5:fail safe for libc pthread_mutex_lock
+ if ((ret = pthread_mutex_lock((pthread_mutex_t*)((char *)addr + sizeof(int)))) == 0) {
+ // LCOV_EXCL_BR_STOP
+ *(int *)addr = (int)getpid();
+ } else if (ret == EOWNERDEAD) {
+ if ((ret = pthread_mutex_consistent((pthread_mutex_t *)((char *)addr + sizeof(int)))) == 0) {
+ *(int *)addr = (int)getpid();
+ }
+ }
+ CL_DBG_PRINT("@@@@@ %s End: pid = %d\n", __func__, *(int *)addr);
+ }
+ return ret;
+}
+
+int CL_LockNowait(void *addr) {
+ int ret;
+
+ if ((addr == NULL) || (addr == MAP_FAILED)) {
+ ret = EINVAL;
+ } else {
+ CL_DBG_PRINT("@@@@@ %s Start: pid = %d\n", __func__, *(int *)addr);
+ if ((ret = pthread_mutex_trylock((pthread_mutex_t*)((char *)addr + sizeof(int)))) == 0) {
+ *(int *)addr = (int)getpid();
+ } else if (ret == EOWNERDEAD) {
+ if ((ret = pthread_mutex_consistent((pthread_mutex_t *)((char *)addr + sizeof(int)))) == 0) {
+ *(int *)addr = (int)getpid();
+ }
+ }
+ CL_DBG_PRINT("@@@@@ %s End: pid = %d\n", __func__, *(int *)addr);
+ }
+ return ret;
+}
+
+
+int CL_LockRelease(void *addr) {
+ int ret;
+ if ((addr == NULL) || (addr == MAP_FAILED)) {
+ ret = EINVAL;
+ } else {
+ CL_DBG_PRINT("@@@@@ %s : pid = %d\n", __func__, *(int *)addr);
+ *(int *)addr = (int)0;
+ ret = pthread_mutex_unlock((pthread_mutex_t*)((char *)addr + sizeof(int)));
+ }
+ return ret;
+}
+
+
+
diff --git a/video_in_hal/nsframework/common_library/client/src/cl_monitor.c b/video_in_hal/nsframework/common_library/client/src/cl_monitor.c
new file mode 100755
index 0000000..26d8e2e
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/src/cl_monitor.c
@@ -0,0 +1,442 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <time.h>
+#include <errno.h>
+#include <semaphore.h>
+
+#include "cl_error.h"
+#include <native_service/cl_region.h>
+#include <native_service/cl_monitor.h>
+
+#define CL_MONITOR_SHM_NAME "/cl_monitor"
+
+#define CL_MONITOR_ID_REAL_GENERIC_START (0)
+#define CL_MONITOR_ID_REAL_GENERIC_END (1023)
+#define CL_MONITOR_ID_REAL_RPC_START (49952)
+#define CL_MONITOR_ID_REAL_RPC_END (59999)
+
+#define CL_MONITOR_ID_FLAT_GENERIC_START (0)
+#define CL_MONITOR_ID_FLAT_GENERIC_END \
+ (CL_MONITOR_ID_FLAT_GENERIC_START + (CL_MONITOR_ID_REAL_GENERIC_END - CL_MONITOR_ID_REAL_GENERIC_START))
+#define CL_MONITOR_ID_FLAT_RPC_START (CL_MONITOR_ID_FLAT_GENERIC_END + 1)
+#define CL_MONITOR_ID_FLAT_RPC_END \
+ (CL_MONITOR_ID_FLAT_RPC_START + (CL_MONITOR_ID_REAL_RPC_END - CL_MONITOR_ID_REAL_RPC_START))
+#define CL_MONITOR_ENTRY_NUM (CL_MONITOR_ID_FLAT_RPC_END + 1)
+
+#define CL_MONITOR_BITMAP_LENGTH ((CL_MONITOR_ENTRY_NUM + 63) / 64) // aligned
+
+#define CL_ALIGN(x, a) (((x) + (a - 1)) / (a) * (a))
+
+struct cl_monitor_header {
+ char signature[4];
+ uint64_t bitmap[CL_MONITOR_BITMAP_LENGTH];
+ sem_t sem;
+};
+
+#define CL_MONITOR_OBJECT_SIZE \
+ CL_ALIGN((sizeof(struct cl_monitor_header) + (sizeof(CL_MonitorEntry_t) * CL_MONITOR_ENTRY_NUM)), 4096)
+
+#define CL_MONITOR_SET_BIT(a, i) (a[i / 64] |= (1ULL << (i % 64)))
+#define CL_MONITOR_CLEAR_BIT(a, i) (a[i / 64] &= ~(1ULL << (i % 64)))
+
+static struct cl_monitor_header *cl_monitor_obj;
+static CL_MonitorEntry_t *cl_monitor_entry_head;
+
+int CL_MonitorInit(CL_MonitorInit_t init_type) {
+ int fd;
+ int oflag;
+ mode_t mode;
+
+ if (init_type != CL_MONITOR_INIT_SYSTEM && init_type != CL_MONITOR_INIT_USER) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (cl_monitor_obj != NULL) {
+ return 0;
+ }
+
+ if (init_type == CL_MONITOR_INIT_SYSTEM) {
+ oflag = O_RDWR | O_CREAT | O_EXCL;
+ mode = 0666;
+ } else {
+ oflag = O_RDWR;
+ mode = 0;
+ }
+
+ if ((fd = shm_open(CL_MONITOR_SHM_NAME, oflag, mode)) == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function shm_open
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function shm_open
+ }
+
+ if (init_type == CL_MONITOR_INIT_SYSTEM) {
+ if (ftruncate(fd, CL_MONITOR_OBJECT_SIZE) == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function ftruncate
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for glibc function ftruncate
+ }
+ } else {
+ struct stat st_buf;
+ if (fstat(fd, &st_buf) == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function fstat
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for glibc function fstat
+ }
+
+ if (st_buf.st_size != CL_MONITOR_OBJECT_SIZE) {
+ errno = EAGAIN;
+ return -1;
+ }
+ }
+
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function mmap
+ if ((cl_monitor_obj = mmap(NULL, CL_MONITOR_OBJECT_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for glibc function mmap
+ }
+
+ if (init_type == CL_MONITOR_INIT_SYSTEM) { // LCOV_EXCL_BR_LINE 11: out branch
+ memcpy(cl_monitor_obj->signature, "CLAM", 4);
+ memset(cl_monitor_obj->bitmap, 0, sizeof(cl_monitor_obj->bitmap));
+ sem_init(&cl_monitor_obj->sem, 1, 1);
+ }
+ cl_monitor_entry_head = (CL_MonitorEntry_t *)(((char *)cl_monitor_obj) + sizeof(struct cl_monitor_header));
+
+ return 0;
+}
+
+static inline int cl_monitor_check_type_id(CL_MonitorType_t type, uint32_t id, int *offset) {
+ if (type == CL_MONITOR_TYPE_GENERIC) {
+ if (id > CL_MONITOR_ID_REAL_GENERIC_END) {
+ errno = ENOENT;
+ return -1;
+ }
+ *offset = (int)((id - CL_MONITOR_ID_REAL_GENERIC_START) + CL_MONITOR_ID_FLAT_GENERIC_START);
+ } else if (type == CL_MONITOR_TYPE_RPC) {
+ if (id < CL_MONITOR_ID_REAL_RPC_START || id > CL_MONITOR_ID_REAL_RPC_END) {
+ errno = ENOENT;
+ return -1;
+ }
+ *offset = (int)((id - CL_MONITOR_ID_REAL_RPC_START) + CL_MONITOR_ID_FLAT_RPC_START);
+ } else {
+ errno = ENOENT;
+ return -1;
+ }
+
+ return 0;
+}
+
+static inline int cl_monitor_sem_wait(sem_t *sem) {
+ int ret;
+
+retry:
+ ret = sem_wait(sem);
+ if (ret == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sem_wait
+ // LCOV_EXCL_START 5: fail safe for libc sem_wait
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ if (errno == EINTR) {
+ goto retry;
+ }
+ CL_PERROR("sem_wait");
+ }
+ // LCOV_EXCL_STOP
+
+ return ret;
+}
+
+static inline int cl_monitor_sem_post(sem_t *sem) {
+ int ret;
+
+ if ((ret = sem_post(sem)) == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sem_post
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("sem_post"); // LCOV_EXCL_LINE 5: fail safe for libc sem_post
+ }
+
+ return ret;
+}
+
+int CL_MonitorSetEntry(CL_MonitorType_t type, uint32_t id, CL_MonitorState_t state, uint32_t timeout,
+ uint32_t user_data) {
+ int offset;
+ CL_MonitorEntry_t *e;
+ struct timespec ts;
+
+ if (cl_monitor_obj == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (cl_monitor_check_type_id(type, id, &offset) == -1) {
+ return -1;
+ }
+
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) { // LCOV_EXCL_BR_LINE 5: fail safe for libc clock_gettime
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for libc clock_gettime
+ }
+
+ e = cl_monitor_entry_head + offset;
+ cl_monitor_sem_wait(&cl_monitor_obj->sem);
+
+ if (state == CL_MONITOR_STATE_SLEEP) {
+ memset(e, 0, sizeof(CL_MonitorEntry_t));
+ CL_MONITOR_CLEAR_BIT(cl_monitor_obj->bitmap, offset);
+ } else {
+ e->pid = (uint16_t)getpid();
+ e->type = type;
+ e->state = state;
+
+// e->timeout = (uint32_t)ts.tv_sec + timeout;
+ e->timeout = ts.tv_sec + timeout;
+ e->id = id;
+ e->user_data = user_data;
+ CL_MONITOR_SET_BIT(cl_monitor_obj->bitmap, offset);
+ }
+
+ cl_monitor_sem_post(&cl_monitor_obj->sem);
+
+ return 0;
+}
+
+int CL_MonitorGetEntry(CL_MonitorType_t type, uint32_t id, CL_MonitorEntry_t *entry) {
+ int offset;
+ CL_MonitorEntry_t *e;
+
+ if (cl_monitor_obj == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (entry == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (cl_monitor_check_type_id(type, id, &offset) == -1) {
+ return -1;
+ }
+
+ e = cl_monitor_entry_head + offset;
+ cl_monitor_sem_wait(&cl_monitor_obj->sem);
+
+ memcpy(entry, e, sizeof(CL_MonitorEntry_t));
+
+ cl_monitor_sem_post(&cl_monitor_obj->sem);
+
+ return 0;
+}
+
+int CL_MonitorSearchInit(CL_MonitorSearch_t *serch) {
+ if (serch == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ serch->entry_list = NULL;
+ serch->entry_num = 0;
+ return 0;
+}
+
+int CL_MonitorSearchDestroy(CL_MonitorSearch_t *serch) {
+ if (serch == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ free(serch->entry_list);
+ serch->entry_num = 0;
+ return 0;
+}
+
+static inline int cl_monitor_popcnt64(uint64_t x) {
+ uint64_t n;
+
+ n = (x >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ n = (n >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ n = (n >> 1) & 0x7777777777777777ULL;
+ x = x - n;
+ x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fULL;
+ x = x * 0x0101010101010101ULL;
+ return (int)(x >> 56);
+}
+
+typedef struct cl_monitor_offset_s cl_monitor_offset_t;
+struct cl_monitor_offset_s {
+ cl_monitor_offset_t *next;
+ int offset;
+};
+
+int CL_MonitorSearchTimeout(CL_MonitorSearch_t *search) {
+ int i;
+ int offset;
+ CL_MonitorEntry_t *e;
+ struct timespec ts;
+ int timeout_entry_num = 0;
+ cl_region_t *r;
+ cl_monitor_offset_t *o, *head = NULL, *tail = NULL;
+
+ if (cl_monitor_obj == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (search == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if ((r = CL_RegionCreate(CL_REGION_DEFAULT_SIZE)) == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ free(search->entry_list);
+ search->entry_list = NULL;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) {// LCOV_EXCL_BR_LINE 5: fail safe for libc clock_gettime
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1;// LCOV_EXCL_LINE 5: fail safe for libc clock_gettime
+ }
+
+ cl_monitor_sem_wait(&cl_monitor_obj->sem);
+
+ for (i = 0; i < CL_MONITOR_BITMAP_LENGTH; i++) {
+ if (cl_monitor_obj->bitmap[i] != 0) {
+ uint64_t bits, mrb1; // most right bit 1
+
+ bits = cl_monitor_obj->bitmap[i];
+ while (bits) {
+ mrb1 = bits & (-bits);
+ offset = i * 64 + cl_monitor_popcnt64(mrb1 - 1);
+ e = cl_monitor_entry_head + offset;
+
+ if (e->timeout <= ts.tv_sec) {
+ timeout_entry_num++;
+ if ((o = CL_RegionAlloc(r, cl_monitor_offset_t, 1)) == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for mmap
+ // LCOV_EXCL_START 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = ENOMEM;
+ timeout_entry_num = -1;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+
+ o->offset = offset;
+ o->next = NULL;
+
+ if (head == NULL) {
+ head = tail = o;
+ } else {
+ tail->next = o;
+ tail = o;
+ }
+ }
+ bits &= ~mrb1;
+ }
+ }
+ }
+
+ if (timeout_entry_num) {
+ CL_MonitorEntry_t *src, *dst;
+ dst = malloc(sizeof(CL_MonitorEntry_t) * (size_t)timeout_entry_num);
+ if (dst == NULL) { // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = ENOMEM; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ timeout_entry_num = -1; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ }
+
+ search->entry_list = dst;
+ o = head;
+ for (i = 0; i < timeout_entry_num; i++) {
+ src = cl_monitor_entry_head + o->offset;
+ memcpy(dst, src, sizeof(CL_MonitorEntry_t));
+
+ o = o->next;
+ dst++;
+ }
+ }
+
+exit:
+ cl_monitor_sem_post(&cl_monitor_obj->sem);
+
+ CL_RegionDestroy(r);
+ search->entry_num = (timeout_entry_num == -1) ? 0 : timeout_entry_num; // LCOV_EXCL_BR_LINE 11: out branch
+ return timeout_entry_num;
+}
+
+int cl_monitor_cleanup(int pid) {
+ int ret = 0;
+ int i;
+ int offset;
+ CL_MonitorEntry_t *e;
+
+ if (cl_monitor_obj == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (pid <= 0) { // LCOV_EXCL_LINE 5: fail safe for glibc function waitid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = EINVAL;// LCOV_EXCL_LINE 5: fail safe for glibc function waitid
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function waitid
+ }
+
+ cl_monitor_sem_wait(&cl_monitor_obj->sem);
+
+ for (i = 0; i < CL_MONITOR_BITMAP_LENGTH; i++) {
+ if (cl_monitor_obj->bitmap[i] != 0) {
+ uint64_t bits, mrb1; // most right bit 1
+
+ bits = cl_monitor_obj->bitmap[i];
+ while (bits) {
+ mrb1 = bits & (-bits);
+ offset = i * 64 + cl_monitor_popcnt64(mrb1 - 1);
+
+ e = cl_monitor_entry_head + offset;
+ if (e->pid == pid) {
+ memset(e, 0, sizeof(CL_MonitorEntry_t));
+ CL_MONITOR_CLEAR_BIT(cl_monitor_obj->bitmap, offset);
+ ret++;
+ }
+
+ bits &= ~mrb1;
+ }
+ }
+ }
+
+ cl_monitor_sem_post(&cl_monitor_obj->sem);
+
+ return ret;
+}
diff --git a/video_in_hal/nsframework/common_library/client/src/cl_process.c b/video_in_hal/nsframework/common_library/client/src/cl_process.c
new file mode 100755
index 0000000..5c9f5a4
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/src/cl_process.c
@@ -0,0 +1,1198 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <errno.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <sched.h>
+#include <semaphore.h>
+#include <pthread.h>
+#include <limits.h>
+#include <sys/prctl.h>
+#include <sys/signalfd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <sys/syscall.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#include <native_service/cl_process.h>
+#include "cl_process_internal.h"
+#include "cl_error.h"
+#include "cl_cgroup.h"
+#include "cl_monitor_internal.h"
+
+#define assert_static(e) \
+ do { \
+ enum { assert_static__ = 1/(e) }; \
+ } while (0)
+
+struct linux_dirent64 {
+ ino64_t d_ino;
+ off64_t d_off;
+ unsigned short d_reclen;
+ unsigned char d_type;
+ char d_name[];
+};
+
+/*
+ * Initialize the process
+ */
+int CL_ProcessInit(void) {
+ int sfd = -1;
+ char *name;
+ sigset_t mask;
+
+ assert_static(sizeof(CL_ProcessAttr_t) == sizeof(CL_ProcessAttrInternal_t));
+
+ name = getenv(CL_PROCESS_NAME_ENV);
+ if (name != NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc getenv
+ if (prctl(PR_SET_NAME, name) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc getenv
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("prctl"); // LCOV_EXCL_LINE 5: fail safe for libc getenv
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc getenv
+ }
+ }
+
+ if (sigemptyset(&mask) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sigemptyset
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("sigemptyset"); // LCOV_EXCL_LINE 5: fail safe for libc sigemptyset
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc sigemptyset
+ }
+ if (sigaddset(&mask, SIGCHLD) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sigaddset
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("sigaddset"); // LCOV_EXCL_LINE 5: fail safe for libc sigaddset
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc sigaddset
+ }
+ if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sigprocmask
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("sigprocmask"); // LCOV_EXCL_LINE 5: fail safe for libc sigprocmask
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc sigprocmask
+ }
+
+ if ((sfd = signalfd(-1, &mask, SFD_NONBLOCK | SFD_CLOEXEC)) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc signalfd
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ CL_PERROR("signalfd"); // LCOV_EXCL_LINE 5: fail safe for libc signalfd
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc signalfd
+ }
+
+exit:
+ return sfd;
+}
+
+/*
+ * start of the functions to be executed from fork to exec
+ */
+static void cl_process_pf_err(char no) {
+ char errorstr[17] = "err:post_fork:0\n";
+
+ errorstr[14] = no;
+ while (1) {
+ if (write(STDERR_FILENO, errorstr, 16) == -1 && errno == EINTR) { // LCOV_EXCL_BR_LINE 5: fail safe for libc write
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue; // LCOV_EXCL_LINE 5: fail safe for libc write
+ }
+ break;
+ }
+}
+
+static inline int cl_process_pf_set_schedule(const CL_ProcessAttrInternal_t *ia) {
+ int ret = -1;
+ struct sched_param param;
+ int policy;
+
+ switch (ia->sched_policy) {
+ case CL_PROCESS_SCHED_POLICY_RR:
+ policy = SCHED_RR;
+ param.sched_priority = ia->sched_priority;
+ break;
+ case CL_PROCESS_SCHED_POLICY_FIFO:
+ param.sched_priority = ia->sched_priority;
+ policy = SCHED_FIFO;
+ break;
+ default:
+ param.sched_priority = 0;
+ policy = SCHED_OTHER;
+ break;
+ }
+ if (sched_setscheduler(getpid(), policy, &param) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function sched_setscheduler
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('3');// LCOV_EXCL_LINE 5: fail safe for glibc function sched_setscheduler
+ goto exit;// LCOV_EXCL_LINE 5: fail safe for glibc function sched_setscheduler
+ }
+ if (ia->sched_policy == CL_PROCESS_SCHED_POLICY_OTHER) {
+ if (setpriority(PRIO_PROCESS, (__id_t)getpid(), ia->sched_priority) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function setpriority
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ cl_process_pf_err('4');// LCOV_EXCL_LINE 5: fail safe for glibc function setpriority
+ goto exit;// LCOV_EXCL_LINE 5: fail safe for glibc function setpriority
+ }
+ }
+ ret = 0;
+
+exit:
+ return ret;
+}
+
+static inline int cl_process_pf_check_close_fd(int check_fd, int dirfd, int hold_fds_num, const int *hold_fds) {
+ int i;
+
+ if (check_fd < 3 || check_fd == dirfd) {
+ return 0;
+ }
+
+ for (i = 0; i < hold_fds_num; i++) {
+ if (check_fd == *(hold_fds + i)) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+static inline int cl_process_pf_fname2fd(const char *s) {
+ int result = 0;
+ for (; *s != '\0'; s++) {
+ result = result * 10 + (*s - '0');
+ }
+ return result;
+}
+
+static inline int cl_process_pf_cleanup_fds(const CL_ProcessAttrInternal_t *ia) {
+ int ret = -1;
+ int dfd;
+#define BUF_SIZE 128
+ char buf[BUF_SIZE];
+ struct linux_dirent64 *d;
+ int hold_fds_num, i;
+
+ for (i = 0; i < CL_PROCESSS_ATTR_HOLD_FDS_NUM; i++) {
+ if (ia->hold_fds[i] == 0) {
+ break;
+ }
+ }
+ hold_fds_num = i;
+
+ if ((dfd = open("/proc/self/fd/", O_RDONLY | O_DIRECTORY | O_CLOEXEC)) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function open
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ cl_process_pf_err('8');// LCOV_EXCL_LINE 5: fail safe for glibc function open
+ goto exit;// LCOV_EXCL_LINE 5: fail safe for glibc function open
+ }
+
+ while (1) {
+ long nread;
+ int fd;
+ int bpos;
+
+ nread = syscall(SYS_getdents64, dfd, buf, sizeof(buf));
+ if (nread == -1) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function syscall
+ // LCOV_EXCL_START 5: fail safe for glibc function syscall
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ cl_process_pf_err('9');
+ close(dfd);
+ goto exit;
+ }
+ // LCOV_EXCL_STOP
+
+ if (nread == 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function syscall
+ break;
+ }
+
+ for (bpos = 0; bpos < nread;) {
+ d = (struct linux_dirent64 *)(buf + bpos);
+ fd = cl_process_pf_fname2fd(d->d_name);
+ if (cl_process_pf_check_close_fd(fd, dfd, hold_fds_num, ia->hold_fds)) {
+ close(fd);
+ }
+ bpos += d->d_reclen;
+ }
+ }
+ close(dfd);
+ ret = 0;
+
+exit:
+ return ret;
+}
+
+static void cl_process_post_fork(const char *file, char *const argv[], char *const envp[],
+ const CL_ProcessAttrInternal_t *ia) {
+ int intfy_fd;
+ char intfy_fname[32] = "/tmp/intfy_00000";
+ pid_t pid = getpid();
+
+ intfy_fname[11] = (char)(intfy_fname[11] + (pid / 10000));
+ intfy_fname[12] = (char)(intfy_fname[12] + ((pid / 1000) % 10));
+ intfy_fname[13] = (char)(intfy_fname[13] + ((pid / 100) % 10));
+ intfy_fname[14] = (char)(intfy_fname[14] + ((pid / 10) % 10));
+ intfy_fname[15] = (char)(intfy_fname[15] + (pid % 10));
+
+ unlink(intfy_fname);
+ if ((intfy_fd = open(intfy_fname, O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666)) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function open
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('0'); // LCOV_EXCL_LINE 5:libc fail safe for open
+ goto exit; // LCOV_EXCL_LINE 5:libc fail safe for open
+ }
+ if (close(intfy_fd) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function close
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('1'); // LCOV_EXCL_LINE 5:libc fail safe for close
+ goto exit; // LCOV_EXCL_LINE 5:libc fail safe for close
+ }
+
+ // Process group
+ if (ia->create_group) {
+ if (setpgid(getpid(), getpid()) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function setpgid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('2'); // LCOV_EXCL_LINE 5: fail safe for glibc function setpgid
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for glibc function setpgid
+ }
+ }
+
+ // Scheduling Policy/Priority
+ if (cl_process_pf_set_schedule(ia) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function sched_setscheduler
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for glibc function sched_setscheduler
+ }
+
+ // UID/GID
+ if (ia->gid) {
+ if (setgid(ia->gid) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function setgid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('5'); // LCOV_EXCL_LINE 5: fail safe for glibc function setgid
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for glibc function setgid
+ }
+ }
+
+ if (ia->uid) {
+ uid_t uid = (ia->uid == UINT_MAX) ? 0 : ia->uid;
+ if (setuid(uid) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function setuid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('6');// LCOV_EXCL_LINE 5: fail safe for glibc function setuid
+ goto exit;// LCOV_EXCL_LINE 5: fail safe for glibc function setuid
+ }
+ }
+
+ // stack size
+ if (ia->stack_size) {
+ struct rlimit rlim;
+ getrlimit(RLIMIT_STACK, &rlim);
+ rlim.rlim_cur = (rlim_t)ia->stack_size;
+ if (setrlimit(RLIMIT_STACK, &rlim) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function setrlimit
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ cl_process_pf_err('7');// LCOV_EXCL_LINE 5: fail safe for glibc function setrlimit
+ }
+ }
+
+ // cleanup fds
+ if (ia->disable_close_fds == 0) {
+ if (cl_process_pf_cleanup_fds(ia) < 0) {
+ goto exit;
+ }
+ }
+
+ // exec
+ if (execve(file, argv, envp) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function execve
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ cl_process_pf_err('A');// LCOV_EXCL_LINE 5: fail safe for glibc function execve
+ }
+
+exit:
+ return;
+}
+/*
+ * end of the functions to be executed from fork to exec
+ */
+
+static int cl_process_pre_fork(char *const envp[], char ***new_env, const CL_ProcessAttrInternal_t *ia) {
+ int i;
+ size_t envlen = 0;
+ char **e;
+ char *b;
+ int new_env_count;
+ size_t name_env_len = strlen(CL_PROCESS_NAME_ENV);
+ int last_name_env_pos = -1;
+
+ if (envp == NULL) {
+ e = environ;
+ } else {
+ e = (char **)envp;
+ }
+
+ for (i = 0; e[i] != NULL; i++) {
+ if (strncmp(e[i], CL_PROCESS_NAME_ENV, name_env_len) == 0) {
+ last_name_env_pos = i;
+ } else {
+ envlen += strlen(e[i]) + 1;
+ }
+ }
+
+ if (ia->name[0] != 0) {
+ envlen += strlen(CL_PROCESS_NAME_ENV) + 1 + strlen(ia->name) + 1;
+ i++;
+ }
+
+ if ((b = malloc(envlen)) == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_ERR_PRINT("malloc fail"); // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ errno = EFAULT; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ goto error; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ }
+ memset(b, 0, envlen);
+
+ if ((*new_env = malloc(sizeof(char *) * (size_t)(i + 1))) == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ free(b); // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ CL_ERR_PRINT("malloc fail"); // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ errno = EFAULT; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ goto error; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ }
+ memset(*new_env, 0, sizeof(char *) * (size_t)(i + 1));
+
+ new_env_count = 0;
+ for (i = 0; e[i] != NULL; i++) {
+ if (i == last_name_env_pos) {
+ continue;
+ }
+ strcpy(b, e[i]);
+ *(*new_env + i) = b;
+ b += strlen(e[i]) + 1;
+ new_env_count++;
+ }
+
+ if (ia->name[0] != 0) {
+ *(*new_env + new_env_count) = b;
+ b += sprintf(b, "%s=%s", CL_PROCESS_NAME_ENV, ia->name);
+ b++;
+ new_env_count++;
+ }
+
+ return 0;
+
+error:
+ return -1;
+}
+
+/*
+ * Create process
+ */
+int CL_ProcessCreate(const char *file, char *const argv[], char *const envp[], const CL_ProcessAttr_t *attr) {
+ const CL_ProcessAttrInternal_t *ia = (const CL_ProcessAttrInternal_t *)attr;
+ pid_t childpid;
+ char intfy_fname[32];
+ char **new_env;
+ int ret;
+ int retry;
+ int i = 0;
+
+ if (file == NULL || argv == NULL || attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (cl_process_pre_fork(envp, &new_env, ia) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc function malloc
+ return -1;
+ }
+
+ childpid = fork();
+ switch (childpid) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function fork
+ case 0: /* child process */
+ cl_process_post_fork(file, argv, new_env, ia);
+ _exit(CL_PROCESS_EXIT_INTERNAL);
+ break;
+
+ case -1: /* error */
+ goto exit;
+
+ default: /* parent process */
+ break;
+ }
+
+ if (ia->cpu_assign != 0) {
+ cpu_set_t set;
+ CPU_ZERO(&set);
+ for (i = 0; i < (sizeof(ia->cpu_assign) * 8); i++) {
+ if ((ia->cpu_assign >> i) & 0x1) {
+ CPU_SET(i, &set);
+ }
+ }
+ // LCOV_EXCL_BR_START 5: fail safe for libc sched_setaffinity
+ if (sched_setaffinity(childpid, sizeof(set), &set) < 0) {
+ // LCOV_EXCL_BR_STOP
+ int last_errno = errno;
+ CL_PERROR("sched_setaffinity");
+ errno = last_errno;
+ childpid = -1;
+ goto exit;
+ }
+ }
+
+ ret = snprintf(intfy_fname, sizeof(intfy_fname), CL_INTFY_FILENAME_FORMAT, childpid);
+ if (ret < 0 || ret > sizeof(intfy_fname)) {// LCOV_EXCL_BR_LINE 5: fail safe for libc snprintf
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_ERR_PRINT("snprintf fail:%d", ret); // LCOV_EXCL_LINE 5: fail safe for libc snprintf
+ childpid = -1; // LCOV_EXCL_LINE 5: fail safe for libc snprintf
+ goto exit; // LCOV_EXCL_LINE 5: fail safe for libc snprintf
+ }
+
+ if (ia->cgroup_name[0] != '\0') {
+ if (cl_cgroup_exist(CL_CGROUP_CPU, ia->cgroup_name) == 0) {
+ if (cl_cgroup_set_num(CL_CGROUP_CPU, ia->cgroup_name, "tasks", childpid) < 0) {
+ int last_errno = errno;
+ CL_PERROR("cl_cgroup_set_num");
+ errno = last_errno;
+ childpid = -1;
+ goto exit;
+ }
+ }
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function access
+ if (cl_cgroup_exist(CL_CGROUP_MEMORY, ia->cgroup_name) == 0) {
+ // LCOV_EXCL_BR_STOP
+ if (cl_cgroup_set_num(CL_CGROUP_MEMORY, ia->cgroup_name, "tasks", childpid) < 0) {
+ int last_errno = errno;
+ CL_PERROR("cl_cgroup_set_num");
+ errno = last_errno;
+ childpid = -1;
+ goto exit;
+ }
+ }
+ }
+
+ for (retry = 100; retry >= 0; retry--) {
+ if (access(intfy_fname, F_OK) == 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function access
+ break;
+ }
+ usleep(100);
+ }
+
+exit:
+ free(new_env[0]);
+ free(new_env);
+
+ return childpid;
+}
+
+/*
+ * Initialize process attribute
+ */
+int CL_ProcessCreateAttrInit(CL_ProcessAttr_t *attr) {
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset(attr, 0, sizeof(CL_ProcessAttr_t));
+ return 0;
+}
+
+/*
+ * Set process attribute (process name)
+ */
+int CL_ProcessCreateAttrSetName(CL_ProcessAttr_t *attr, const char *name) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL || name == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ strncpy(ia->name, name, 16);
+ ia->name[15] = 0;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (user ID)
+ */
+int CL_ProcessCreateAttrSetUid(CL_ProcessAttr_t *attr, uid_t uid) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->uid = uid;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (group ID)
+ */
+int CL_ProcessCreateAttrSetGid(CL_ProcessAttr_t *attr, gid_t gid) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->gid = gid;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (schedule policy and priority)
+ */
+int CL_ProcessCreateAttrSetSchedule(CL_ProcessAttr_t *attr, CL_ProcessSchedPolicy_t policy, int priority) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (policy == CL_PROCESS_SCHED_POLICY_RR || policy == CL_PROCESS_SCHED_POLICY_FIFO) {
+ if (priority < 1 || priority > 99) {
+ errno = EINVAL;
+ return -1;
+ }
+ } else if (policy == CL_PROCESS_SCHED_POLICY_OTHER) {
+ if (priority < -20 || priority > 19) {
+ CL_ERR_PRINT("Invlid SCHED_OTHER priority:%d", priority);
+ }
+ } else {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->sched_policy = policy;
+ ia->sched_priority = priority;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (process group)
+ */
+int CL_ProcessCreateAttrSetGroup(CL_ProcessAttr_t *attr, int create) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (create < 0 || create > 1) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->create_group = create;
+
+ return 0;
+}
+
+static int32_t CL_CpuAssignMsbCpu(int cpu_assign) {
+ int32_t i;
+ int32_t ret = 0;
+
+ for (i = 0; i < (sizeof(cpu_assign) * 8); i++) {
+ if ((cpu_assign >> i) & 0x1)
+ ret = i;
+ }
+
+ return ret;
+}
+
+/**
+ * Set process attribute (CPU Assign)
+ */
+int CL_ProcessCreateAttrSetCpuAssign(CL_ProcessAttr_t *attr, int cpu_assign) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (cpu_assign < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (CL_CpuAssignMsbCpu(cpu_assign) >= sysconf(_SC_NPROCESSORS_CONF)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->cpu_assign = cpu_assign;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (Stack Size)
+ */
+int CL_ProcessCreateAttrSetStackSize(CL_ProcessAttr_t *attr, int stack_size) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->stack_size = stack_size;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (FD to maintain)
+ */
+int CL_ProcessCreateAttrSetHoldFds(CL_ProcessAttr_t *attr, int hold_fds[]) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL || hold_fds == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memcpy(ia->hold_fds, hold_fds, sizeof(ia->hold_fds));
+
+ return 0;
+}
+
+/*
+ * Set process attribute (to suspend forced FD close)
+ */
+int CL_ProcessCreateAttrSetDisableCloseFds(CL_ProcessAttr_t *attr) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->disable_close_fds = 1;
+
+ return 0;
+}
+
+/*
+ * Set process attribute (Cgroup)
+ */
+int CL_ProcessCreateAttrSetCgroup(CL_ProcessAttr_t *attr, const char *cgroup_name) {
+ CL_ProcessAttrInternal_t *ia = (CL_ProcessAttrInternal_t *)attr;
+
+ if (attr == NULL || cgroup_name == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (strlen(cgroup_name) >= sizeof(ia->cgroup_name)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ strcpy(ia->cgroup_name, cgroup_name);
+
+ return 0;
+}
+
+/*
+ * Kill process
+ */
+int CL_ProcessTerminate(pid_t pid) {
+ return kill(pid, SIGKILL);
+}
+
+/*
+ * Kill process group
+ */
+int CL_ProcessTerminateGroup(pid_t pid) {
+ return killpg(pid, SIGKILL);
+}
+
+/**
+ * Forced process termination
+ */
+int CL_ProcessAbort(pid_t pid) {
+ return kill(pid, SIGABRT);
+}
+
+/**
+ * Forced process group termination
+ */
+int CL_ProcessAbortGroup(pid_t pid) {
+ return killpg(pid, SIGABRT);
+}
+
+/**
+ * Euthanize process group
+ */
+int CL_ProcessEuthanizeGroup(pid_t pid) {
+ usleep(10 * 1000);
+ return killpg(pid, SIGKILL);
+}
+
+/*
+ * Collect child process
+ */
+int CL_ProcessCleanup(int sigchld_fd, CL_ProcessCleanupInfo_t *cleanup_info) {
+ struct signalfd_siginfo fdsi;
+ ssize_t s;
+ siginfo_t info;
+ int ret;
+ char intfy_fname[32];
+
+ if (cleanup_info == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ while (1) {
+ s = read(sigchld_fd, &fdsi, sizeof(struct signalfd_siginfo));
+ if (s != sizeof(struct signalfd_siginfo)) {
+ if (s == -1 && errno == EINTR) {
+ continue;
+ }
+ break;
+ }
+ }
+
+ info.si_pid = 0;
+ while (1) {
+ ret = waitid(P_ALL, 0, &info, WEXITED | WNOHANG);
+ if (ret == -1) {
+ return -1;
+ } else if (ret == 0 && info.si_pid == 0) {
+ errno = ECHILD;
+ return -1;
+ }
+ break;
+ }
+
+ cleanup_info->pid = info.si_pid;
+ cleanup_info->code = info.si_code;
+ cleanup_info->status = info.si_status;
+
+ cl_monitor_cleanup(info.si_pid);
+
+ ret = snprintf(intfy_fname, sizeof(intfy_fname), CL_INTFY_FILENAME_FORMAT, info.si_pid);
+
+ if (ret < 0 || ret > sizeof(intfy_fname)) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function snprintf
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_ERR_PRINT("snprintf fail:%d\n", ret);// LCOV_EXCL_LINE 5: fail safe for glibc function snprintf
+ goto exit;// LCOV_EXCL_LINE 5: fail safe for glibc function snprintf
+ }
+ if (unlink(intfy_fname) < 0) {
+ CL_PERROR("unlink");
+ }
+
+exit:
+ info.si_pid = 0;
+ ret = waitid(P_ALL, 0, &info, WEXITED | WNOWAIT | WNOHANG);
+ if (ret == 0 && info.si_pid != 0) {
+ return 1;
+ } else if (ret == -1 && errno != ECHILD) {
+ return -1;
+ }
+ return 0;
+}
+
+typedef struct {
+ sem_t sem;
+ CL_ThreadAttrInternal_t *ia;
+ void *(*start_routine)(void *);
+ void *start_arg;
+} create_thread_arg_t;
+
+static void *thread_start_func(void *arg) {
+ create_thread_arg_t *p = (create_thread_arg_t *)arg;
+ void *(*start_routine)(void *) = p->start_routine;
+ void *start_arg = p->start_arg;
+
+ prctl(PR_SET_NAME, p->ia->name != 0 ? p->ia->name : NULL);
+
+ if (sem_post(&p->sem) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for libc sem_post
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_PERROR("sem_post"); // LCOV_EXCL_LINE 5: fail safe for libc sem_post
+ }
+
+ return (*start_routine)(start_arg);
+}
+
+/*
+ * Create thread
+ */
+int CL_ThreadCreate(pthread_t *thread, pthread_attr_t *attr, CL_ThreadAttr_t *cl_attr, void *(*start_routine)(void *),
+ void *arg) {
+ int ret;
+ create_thread_arg_t cr_arg = { .ia = (CL_ThreadAttrInternal_t *)cl_attr,
+ .start_routine = start_routine,
+ .start_arg = arg
+ };
+
+ if (thread == NULL || cl_attr == NULL || start_routine == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (sem_init(&cr_arg.sem, 0, 0) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sem_init
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for libc sem_init
+ }
+
+ // LCOV_EXCL_BR_START 5: fail safe for libc pthread_create
+ if ((ret = pthread_create(thread, attr, thread_start_func, &cr_arg)) != 0) {
+ // LCOV_EXCL_BR_STOP
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ errno = ret; // LCOV_EXCL_LINE 5: fail safe for libc pthread_create
+ return -1; // LCOV_EXCL_LINE 5: fail safe for libc pthread_create
+ }
+
+ if (sem_wait(&cr_arg.sem) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for libc sem_wait
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1; // LCOV_EXCL_LINE 5: fail safe for libc sem_wait
+ }
+
+ return 0;
+}
+
+/*
+ * Initialize CommonLibrary extension thread attribute
+ */
+int CL_ThreadCreateAttrInit(CL_ThreadAttr_t *attr) {
+ assert_static(sizeof(CL_ThreadAttr_t) == sizeof(CL_ThreadAttrInternal_t));
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset(attr, 0, sizeof(CL_ThreadAttr_t));
+ return 0;
+}
+
+/*
+ * Set CommonLibrary extension thread attribute (thread name)
+ */
+int CL_ThreadCreateAttrSetName(CL_ThreadAttr_t *attr, const char *name) {
+ CL_ThreadAttrInternal_t *ia = (CL_ThreadAttrInternal_t *)attr;
+
+ if (attr == NULL || name == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ strncpy(ia->name, name, 16);
+ ia->name[15] = 0;
+
+ return 0;
+}
+
+/*
+ * Create Cgroup
+ */
+int CL_ProcessCreateCgroupCreate(const char *cgroup_name, CL_ProcessCreateCgroupAttr_t *attr) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+ CL_ProcessCreateCgroupAttrInternal_t cmp;
+
+ if (cgroup_name == NULL || attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset(&cmp, 0, sizeof(CL_ProcessCreateCgroupAttrInternal_t));
+ if (memcmp(ia, &cmp, sizeof(CL_ProcessCreateCgroupAttrInternal_t)) == 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (ia->rt_runtime_us || ia->cfs_quota_us || ia->cpu_shares) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function mkdir
+ if (cl_cgroup_make(CL_CGROUP_CPU, cgroup_name) < 0) {
+ // LCOV_EXCL_BR_STOP
+ return -1;
+ }
+
+ if (ia->rt_runtime_us) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function write
+ if (cl_cgroup_set_num(CL_CGROUP_CPU, cgroup_name, "cpu.rt_runtime_us", ia->rt_runtime_us) < 0) {
+ // LCOV_EXCL_BR_STOP
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function write
+ }
+ }
+
+ if (ia->cfs_quota_us) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function write
+ if (cl_cgroup_set_num(CL_CGROUP_CPU, cgroup_name, "cpu.cfs_quota_us", ia->cfs_quota_us) < 0) {
+ // LCOV_EXCL_BR_STOP
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function write
+ }
+ }
+
+ if (ia->cpu_shares) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function write
+ if (cl_cgroup_set_num(CL_CGROUP_CPU, cgroup_name, "cpu.shares", ia->cpu_shares) < 0) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function write
+ }
+ }
+ }
+
+ if (ia->memory_limit || ia->usage_in_bytes || ia->event_fd) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function mkdir
+ if (cl_cgroup_make(CL_CGROUP_MEMORY, cgroup_name) < 0) {
+ // LCOV_EXCL_BR_STOP
+ return -1;
+ }
+
+ if (ia->memory_limit) {
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function write
+ if (cl_cgroup_set_num(CL_CGROUP_MEMORY, cgroup_name, "memory.limit_in_bytes", ia->memory_limit) < 0) {
+ // LCOV_EXCL_BR_STOP
+ return -1;
+ }
+
+ if (cl_cgroup_set_num(CL_CGROUP_MEMORY, cgroup_name, "memory.memsw.limit_in_bytes", ia->memory_limit) < 0) {
+ return -1;
+ }
+
+ }
+
+ if (ia->usage_in_bytes || ia->event_fd) {
+ int checkfd;
+ char setstr[64];
+
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function open
+ if ( (checkfd = cl_cgroup_open(CL_CGROUP_MEMORY, cgroup_name, "memory.memsw.usage_in_bytes", O_RDONLY)) < 0) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: fail safe for glibc function open
+ }
+
+ snprintf(setstr, sizeof(setstr), "%d %d %d", ia->event_fd, checkfd, ia->usage_in_bytes);
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function write
+ if (cl_cgroup_set_string(CL_CGROUP_MEMORY, cgroup_name, "cgroup.event_control", setstr) < 0) {
+ // LCOV_EXCL_BR_STOP
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return -1;// LCOV_EXCL_LINE 5: fail safe for glibc function write
+ }
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * Initialize Cgroup attribute
+ */
+int CL_ProcessCreateCgroupAttrInit(CL_ProcessCreateCgroupAttr_t *attr) {
+ assert_static(sizeof(CL_ProcessCreateCgroupAttr_t) == sizeof(CL_ProcessCreateCgroupAttrInternal_t));
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset(attr, 0, sizeof(CL_ProcessCreateCgroupAttr_t));
+ return 0;
+}
+
+/*
+ * Set Cgroup attribute (RT Throttling)
+ */
+int CL_ProcessCreateCgroupAttrSetRtThrottling(CL_ProcessCreateCgroupAttr_t *attr, int runtime_us) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->rt_runtime_us = runtime_us;
+
+ return 0;
+}
+
+/*
+ * Set Cgroup attribute (CFS Bandwidth Control)
+ */
+int CL_ProcessCreateCgroupAttrSetCfsBandwidthControl(CL_ProcessCreateCgroupAttr_t *attr, int cfs_quota_us) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->cfs_quota_us = cfs_quota_us;
+
+ return 0;
+}
+
+/*
+ * Set Cgroup attribute (CPU Shares)
+ */
+int CL_ProcessCreateCgroupAttrSetCpuShares(CL_ProcessCreateCgroupAttr_t *attr, int cpu_shares) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->cpu_shares = cpu_shares;
+
+ return 0;
+}
+
+/*
+ * Set Cgroup attribute (Memory Limit)
+ */
+int CL_ProcessCreateCgroupAttrSetMemoryLimit(CL_ProcessCreateCgroupAttr_t *attr, int memory_limit) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->memory_limit = memory_limit;
+
+ return 0;
+}
+
+/*
+ * Set Cgroup attribute (Memory Usage Notification)
+ */
+int CL_ProcessCreateCgroupAttrSetMemoryUsageNotification(CL_ProcessCreateCgroupAttr_t *attr, int usage_in_bytes,
+ int event_fd) {
+ CL_ProcessCreateCgroupAttrInternal_t *ia = (CL_ProcessCreateCgroupAttrInternal_t *)attr;
+
+ if (attr == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (event_fd < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ia->usage_in_bytes = usage_in_bytes;
+ ia->event_fd = event_fd;
+
+ return 0;
+}
+
+/*
+ * Delete Cgroup
+ */
+int CL_ProcessCreateCgroupDelete(const char *cgroup_name) {
+ int mem_ret = 1, mem_err;
+ int cpu_ret = 1, cpu_err;
+
+ if (cgroup_name == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function access
+ if (cl_cgroup_exist(CL_CGROUP_MEMORY, cgroup_name) == 0) {
+ // LCOV_EXCL_BR_STOP
+ mem_ret = cl_cgroup_remove(CL_CGROUP_MEMORY, cgroup_name);
+ mem_err = errno;
+ }
+
+ // LCOV_EXCL_BR_START 5: fail safe for glibc function access
+ if (cl_cgroup_exist(CL_CGROUP_CPU, cgroup_name) == 0) {
+ // LCOV_EXCL_BR_STOP
+ cpu_ret = cl_cgroup_remove(CL_CGROUP_CPU, cgroup_name);
+ cpu_err = errno;
+ }
+
+ if (mem_ret == 1 && cpu_ret == 1) {
+ errno = ENOENT;
+ return -1;
+ } else if (mem_ret < 0) {
+ errno = mem_err;
+ return -1;
+ } else if (cpu_ret < 0) {
+ errno = cpu_err;
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * Move process to the Cgroup
+ */
+int CL_ProcessCreateCgroupClassify(const char *cgroup_name, pid_t pid) {
+ int mem_ret = 1, mem_err;
+ int cpu_ret = 1, cpu_err;
+
+ if (cgroup_name == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (cl_cgroup_exist(CL_CGROUP_MEMORY, cgroup_name) == 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function access
+ mem_ret = cl_cgroup_set_num(CL_CGROUP_MEMORY, cgroup_name, "tasks", pid);
+ mem_err = errno;
+ }
+
+ if (cl_cgroup_exist(CL_CGROUP_CPU, cgroup_name) == 0) {// LCOV_EXCL_BR_LINE 5: fail safe for glibc function access
+ cpu_ret = cl_cgroup_set_num(CL_CGROUP_CPU, cgroup_name, "tasks", pid);
+ cpu_err = errno;
+ }
+
+ if (mem_ret == 1 && cpu_ret == 1) {
+ errno = ENOENT;
+ return -1;
+ } else if (mem_ret < 0) {
+ errno = mem_err;
+ return -1;
+ } else if (cpu_ret < 0) {
+ errno = cpu_err;
+ return -1;
+ }
+
+ return 0;
+}
+
+/* vim:set ts=8 sts=2 sw=2: */
diff --git a/video_in_hal/nsframework/common_library/client/src/cl_region.c b/video_in_hal/nsframework/common_library/client/src/cl_region.c
new file mode 100755
index 0000000..0f6d470
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/src/cl_region.c
@@ -0,0 +1,295 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file cl_region.c
+ * @brief region manage
+ *
+ */
+
+#include <stdio.h>
+#include <sys/mman.h>
+#include <native_service/cl_region.h>
+#include "cl_error.h"
+
+#define cl_align_ptr(p, a) \
+ (uint8_t *) (((long)(p) + ((long)a - 1)) & ~((long)a - 1))
+
+static void *cl_region_anonmmap(size_t size);
+static void *cl_region_expand(cl_region_t *region, size_t size, size_t align_size);
+static void *cl_region_alloc_large(cl_region_t *region, size_t size);
+
+cl_region_t *
+CL_RegionCreate(size_t size) {
+ cl_region_t *r;
+ long pagesize;
+
+ pagesize = sysconf(_SC_PAGE_SIZE);
+ size = ((size + (size_t)pagesize - 1) / (size_t)pagesize) * (size_t)pagesize;
+
+ r = cl_region_anonmmap(size);
+ if (r == NULL) {
+ return NULL;
+ }
+
+ r->d.last = (uint8_t *) r + sizeof(cl_region_t);
+ r->d.end = (uint8_t *) r + size;
+ r->d.next = NULL;
+ r->d.failed = 0;
+
+ size = size - sizeof(cl_region_t);
+ r->max = (size < (pagesize - 1)) ? size : (size_t)(pagesize - 1);
+
+ r->current = r;
+ r->large = NULL;
+ r->cleanup = NULL;
+
+ return r;
+}
+
+
+void
+CL_RegionDestroy(cl_region_t *region) {
+ cl_region_t *r, *n;
+ cl_region_large_t *l;
+ cl_region_cleanup_t *c;
+
+ for (c = region->cleanup; c; c = c->next) {
+ if (c->handler) {
+ CL_DBG_PRINT("run cleanup: %p\n", c->handler);
+ c->handler(c->data);
+ }
+ }
+
+ for (l = region->large; l; l = l->next) {
+
+ CL_DBG_PRINT("free: %p\n", l->alloc);
+
+ if (l->alloc) { // LCOV_EXCL_BR_LINE 6: double check, mmap in cl_monitor.c
+ if (munmap(l->alloc, l->size) < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc munmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_PERROR("munmap"); // LCOV_EXCL_LINE 5: fail safe for libc munmap
+ }
+ }
+ }
+
+ for (r = region, n = region->d.next; /* void */; r = n, n = n->d.next) {
+ if (munmap(r, (size_t)(r->d.end - (uint8_t *)r)) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for libc munmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_PERROR("munmap"); // LCOV_EXCL_LINE 5: fail safe for libc munmap
+ }
+
+ if (n == NULL) {
+ break;
+ }
+ }
+}
+
+
+void *
+cl_region_alloc(cl_region_t *region, size_t size, size_t align_size) {
+ uint8_t *m;
+ volatile uint8_t *old_last;
+ cl_region_t *r;
+
+ if (size <= region->max) {
+
+ r = region->current;
+
+ do {
+ retry:
+ old_last = r->d.last;
+ m = cl_align_ptr(old_last, align_size);
+ if ((size_t)(r->d.end - m) >= size) {
+ if (false == __sync_bool_compare_and_swap(&r->d.last, old_last, m + size)) {
+ goto retry;
+ }
+ return m;
+ }
+
+ r = r->d.next;
+
+ } while (r);
+
+ return cl_region_expand(region, size, align_size);
+ }
+
+ return cl_region_alloc_large(region, size);
+}
+
+
+static void *
+cl_region_anonmmap(size_t size) {
+ uint8_t *p;
+
+ p = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (p == MAP_FAILED) { /* pgr0203 */
+ CL_PERROR("mmap");
+ return NULL;
+ }
+
+ return p;
+}
+
+
+static void *
+cl_region_expand(cl_region_t *region, size_t size, size_t align_size) {
+ uint8_t *m;
+ size_t psize;
+ cl_region_t *r, *new, *current;
+
+ psize = (size_t)(region->d.end - (uint8_t *)region);
+
+ m = cl_region_anonmmap(psize);
+ if (m == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;// LCOV_EXCL_LINE 5: fail safe for libc mmap
+ }
+
+ new = (cl_region_t *)m;
+
+ new->d.end = m + psize;
+ new->d.next = NULL;
+ new->d.failed = 0;
+
+ m += sizeof(cl_region_data_t);
+ m = cl_align_ptr(m, align_size);
+ new->d.last = m + size;
+
+ current = region->current;
+
+ for (r = current; r->d.next; r = r->d.next) { /* pgr0689 */
+ if (r->d.failed++ > 4) {
+ current = r->d.next;
+ }
+ }
+
+ while (false == __sync_bool_compare_and_swap(&r->d.next, NULL, new)) {
+ for (r = r->d.next; r->d.next; r = r->d.next) {} /* pgr0689 */
+ }
+
+ region->current = current ? current : new;
+
+ return m;
+}
+
+
+static void *
+cl_region_alloc_large(cl_region_t *region, size_t size) {
+ void *p;
+ int n;
+ long pagesize;
+ cl_region_large_t *large;
+
+ pagesize = sysconf(_SC_PAGE_SIZE);
+ size = ((size + (size_t)pagesize - 1) / (size_t)pagesize) * (size_t)pagesize;
+
+ p = cl_region_anonmmap(size);
+
+ if (p == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;// LCOV_EXCL_LINE 5: fail safe for libc mmap
+ }
+
+ n = 0;
+
+ for (large = region->large; large; large = large->next) {
+ if (large->alloc == NULL) {
+ if (false == __sync_bool_compare_and_swap(&large->alloc, NULL, p)) {
+ break;
+ }
+ large->size = size;
+ return p;
+ }
+
+ if (n++ > 3) {
+ break;
+ }
+ }
+
+ large = CL_RegionAlloc(region, cl_region_large_t, 1);
+ if (large == NULL) { // LCOV_EXCL_START 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (munmap(p, size) < 0) {
+ CL_PERROR("munmap");
+ }
+ return NULL;
+ } // LCOV_EXCL_STOP
+
+ large->alloc = p;
+ large->size = size;
+ large->next = region->large;
+ while (false == __sync_bool_compare_and_swap(&region->large, large->next, large)) { // LCOV_EXCL_BR_LINE 100: race condition // NOLINT (readability/nolint)
+ // LCOV_EXCL_START 100: race condition
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ large->next = region->large;
+ } // LCOV_EXCL_STOP
+
+ return p;
+}
+
+
+bool
+CL_RegionFree(cl_region_t *region, void *p) {
+ cl_region_large_t *l;
+
+ for (l = region->large; l; l = l->next) {
+ if (p == l->alloc) {
+ CL_DBG_PRINT("free: %p\n", l->alloc);
+ if (munmap(l->alloc, l->size) < 0) {// LCOV_EXCL_BR_LINE 5: fail safe for libc munmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CL_PERROR("munmap");// LCOV_EXCL_LINE 5: fail safe for libc munmap
+ }
+ l->alloc = NULL;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+cl_region_cleanup_t *
+cl_region_cleanup_add(cl_region_t *region, size_t size, size_t align_size) {
+ cl_region_cleanup_t *c;
+
+ c = CL_RegionAlloc(region, cl_region_cleanup_t, 1);
+ if (c == NULL) { // LCOV_EXCL_START 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;
+ } // LCOV_EXCL_STOP
+
+ if (size) {
+ c->data = cl_region_alloc(region, size, align_size);
+ if (c->data == NULL) { // LCOV_EXCL_START 5: fail safe for libc mmap
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;
+ } // LCOV_EXCL_STOP
+ } else {
+ c->data = NULL;
+ }
+
+ c->handler = NULL;
+ c->next = region->cleanup;
+
+ region->cleanup = c;
+
+ CL_DBG_PRINT("add cleanup: %p\n", c);
+
+ return c;
+}
+
+/* vim:set ts=8 sw=2 sts=2: */
diff --git a/video_in_hal/nsframework/common_library/client/src/cl_sem.c b/video_in_hal/nsframework/common_library/client/src/cl_sem.c
new file mode 100755
index 0000000..911daff
--- /dev/null
+++ b/video_in_hal/nsframework/common_library/client/src/cl_sem.c
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <semaphore.h>
+#include <time.h>
+
+#include <native_service/cl_sem.h>
+#include "cl_error.h"
+
+#define CL_MILLI_TO_NANO(time) ((time) * 1000000U)
+#define CL_SEC_TO_NANO(time) ((time) * 1000000000U)
+#define CL_NANO_TO_SEC(time) ((time) / 1000000000U)
+
+static void cl_TimeoutCalc(struct timespec *ts, unsigned int timeout) {
+ unsigned long long nsec;
+
+ clock_gettime(CLOCK_REALTIME, ts);
+ nsec = (unsigned long long)ts->tv_nsec + (CL_MILLI_TO_NANO((unsigned long long)timeout));
+ ts->tv_sec = ts->tv_sec + (time_t)CL_NANO_TO_SEC(nsec);
+ ts->tv_nsec = (__syscall_slong_t)(nsec - CL_SEC_TO_NANO((unsigned long long)CL_NANO_TO_SEC(nsec)));
+}
+
+int CL_SemWait(sem_t *semid, unsigned int timeout) {
+ struct timespec ts, tmp;
+ int ret;
+
+ while (1) {
+ cl_TimeoutCalc(&ts, timeout);
+ if ((ret = sem_timedwait(semid, &ts)) != 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc
+ // LCOV_EXCL_START 5: fail safe for libc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == ETIMEDOUT) {
+ /* Check the time considering the case where the time has been changed by clock_settime/settimeofday */
+ /* If the current time is much larger than the timeout specified time,
+ the system assumes that the time has changed and re-executes the command.
+ (A threshold of 100 is appropriate) */
+ clock_gettime(CLOCK_REALTIME, &tmp);
+ if (difftime(tmp.tv_sec, ts.tv_sec) > 100.0) {
+ CL_DBG_PRINT("detect clock changed\n");
+ continue;
+ }
+ }
+ }
+ // LCOV_EXCL_STOP 5: fail safe for libc
+ break;
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ } // LCOV_EXCL_LINE 10: end line
+
+ return ret;
+}
+
diff --git a/video_in_hal/nsframework/framework_unified/LICENSE b/video_in_hal/nsframework/framework_unified/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/nsframework/framework_unified/Makefile.client b/video_in_hal/nsframework/framework_unified/Makefile.client
new file mode 100755
index 0000000..69ea68d
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../native_service.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/Makefile b/video_in_hal/nsframework/framework_unified/client/Makefile
new file mode 100755
index 0000000..29ed628
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/Makefile
@@ -0,0 +1,269 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+#INST_PROGS =
+
+######### installed library(*.a) #############
+#INST_LIBS =
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libNS_FrameworkUnified
+
+######### install headers(*.h) #############
+
+VPATH += ./include/$(COMPONENT_NAME)
+# native
+INST_HEADERS = ns_config_parser_if.h
+INST_HEADERS += ns_reader.h
+INST_HEADERS += ns_writer.h
+INST_HEADERS += ns_eventlogger.h
+INST_HEADERS += ns_logger_if.h
+INST_HEADERS += ns_message_center_if.h
+INST_HEADERS += ns_np_service.h
+INST_HEADERS += ns_np_service_if.h
+INST_HEADERS += ns_np_service_nor_persistence.h
+INST_HEADERS += ns_np_service_notification.h
+INST_HEADERS += ns_np_service_protocol.h
+INST_HEADERS += ns_np_service_nor_persistence_internal.h
+INST_HEADERS += ns_np_types.h
+INST_HEADERS += ns_plogger_if.h
+INST_HEADERS += ns_shared_mem.h
+INST_HEADERS += ns_shared_mem_if.h
+INST_HEADERS += ns_sharedmem.h
+INST_HEADERS += ns_sharedmem_reader.h
+INST_HEADERS += ns_sharedmem_writer.h
+INST_HEADERS += ns_ringbuffer.h
+INST_HEADERS += ns_system_mode.h
+INST_HEADERS += ns_timer_if.h
+INST_HEADERS += ns_timer_if.hpp
+INST_HEADERS += ns_transmit_log.h
+INST_HEADERS += ns_utility.hpp
+INST_HEADERS += ns_utility_if.h
+INST_HEADERS += ns_utility_sys.hpp
+INST_HEADERS += ns_version_if.h
+INST_HEADERS += ns_resource_controler.h
+INST_HEADERS += XMLParser.h
+INST_HEADERS += ns_msgs.h
+INST_HEADERS += ns_mc_system_info.h
+
+# inc
+INST_HEADERS += ns_version.h
+INST_HEADERS += frameworkunified_service_protocol.h
+INST_HEADERS += frameworkunified_types.h
+INST_HEADERS += wpf_legacy.h
+INST_HEADERS += framework_unified.h
+
+# nsrcs
+INST_HEADERS += ns_rcs_data_handler.hpp
+INST_HEADERS += ns_rcs_logger_types.h
+INST_HEADERS += ns_rcs_plugin.hpp
+
+# _CWORD77_
+INST_HEADERS += ns__CWORD77__common.h
+INST_HEADERS += ns__CWORD77__data_pool_if.h
+INST_HEADERS += ns__CWORD77__data_pool_key.h
+INST_HEADERS += ns__CWORD77__data_pool_table.h
+INST_HEADERS += ns__CWORD77__notifications.h
+INST_HEADERS += ns__CWORD77__types.h
+INST_HEADERS += frameworkunified__CWORD77__service_if.h
+INST_HEADERS += frameworkunified__CWORD77__session_if.h
+
+# utility
+INST_HEADERS += ns_endianess.h
+INST_HEADERS += nslogutil_cmd_if.h
+INST_HEADERS += nsfw_message.h
+INST_HEADERS += ns_util_directory.h
+INST_HEADERS += ns_util_crc.h
+
+# framework
+INST_HEADERS += frameworkunified_application.h
+INST_HEADERS += frameworkunified_dispatcher.h
+INST_HEADERS += frameworkunified_framework_error.hpp
+INST_HEADERS += frameworkunified_framework_if.h
+INST_HEADERS += frameworkunified_framework_sync.h
+INST_HEADERS += frameworkunified_framework_system_if.h
+INST_HEADERS += frameworkunified_framework_types.h
+INST_HEADERS += frameworkunified_multithreading.h
+INST_HEADERS += frameworkunified_service_if.h
+INST_HEADERS += frameworkunified_thread_priority.h
+INST_HEADERS += frameworkunified_timer.h
+
+# framework/statemachine
+INST_HEADERS += frameworkunified_sm_action.h
+INST_HEADERS += frameworkunified_sm_compositestate.h
+INST_HEADERS += frameworkunified_sm_conditionconnector.h
+INST_HEADERS += frameworkunified_sm_deephistorystate.h
+INST_HEADERS += frameworkunified_sm_dispatcher.h
+INST_HEADERS += frameworkunified_sm_eventdata.h
+INST_HEADERS += frameworkunified_sm_eventfactory.h
+INST_HEADERS += frameworkunified_sm_externaltransition.h
+INST_HEADERS += frameworkunified_sm_framework_dispatch.h
+INST_HEADERS += frameworkunified_sm_framework_if.h
+INST_HEADERS += frameworkunified_sm_framework_types.h
+INST_HEADERS += frameworkunified_sm_guard.h
+INST_HEADERS += frameworkunified_sm_historystate.h
+INST_HEADERS += frameworkunified_sm_hsm.h
+INST_HEADERS += frameworkunified_sm_hsmframework.h
+INST_HEADERS += frameworkunified_sm_internaltransition.h
+INST_HEADERS += frameworkunified_sm_leafstate.h
+INST_HEADERS += frameworkunified_sm_localtransition.h
+INST_HEADERS += frameworkunified_sm_multithreading.h
+INST_HEADERS += frameworkunified_sm_orthogonalstate.h
+INST_HEADERS += frameworkunified_sm_reaction.h
+INST_HEADERS += frameworkunified_sm_shallowhistorystate.h
+INST_HEADERS += frameworkunified_sm_state.h
+INST_HEADERS += frameworkunified_sm_transition.h
+
+# xmlparser
+INST_HEADERS += ns_xml_reader.h
+INST_HEADERS += ns_xml_writer.h
+INST_HEADERS += ns_xmlparser_if.h
+
+######### compiled sources #############
+
+# NS_Logger
+libNS_FrameworkUnified_SRCS += ./NS_Logger/src/ns_logger.cpp
+CPPFLAGS += -I./NS_Logger/include
+
+# NS_MessageQueue
+libNS_FrameworkUnified_SRCS += ./NS_MessageQueue/src/ns_msg_queue.c
+libNS_FrameworkUnified_SRCS += ./NS_MessageQueue/src/ns_mq_string.c
+CPPFLAGS += -I./NS_MessageQueue/include
+
+# NS_SharedMemIf
+libNS_FrameworkUnified_SRCS += ./NS_SharedMemIf/src/ns_shared_mem_if.cpp
+libNS_FrameworkUnified_SRCS += ./NS_SharedMemIf/src/ns_sharedmem.cpp
+libNS_FrameworkUnified_SRCS += ./NS_SharedMemIf/src/ns_sharedmem_reader.cpp
+libNS_FrameworkUnified_SRCS += ./NS_SharedMemIf/src/ns_sharedmem_writer.cpp
+
+# NS_RingBuffer
+libNS_FrameworkUnified_SRCS += ./NS_RingBuffer/src/ns_ringbuffer.cpp
+
+# NS_UtilityCenter
+libNS_FrameworkUnified_SRCS += ./NS_UtilityCenter/src/ns_endianess.cpp
+libNS_FrameworkUnified_SRCS += ./NS_UtilityCenter/src/ns_util_crc.cpp
+libNS_FrameworkUnified_SRCS += ./NS_UtilityCenter/src/ns_util_directory.cpp
+libNS_FrameworkUnified_SRCS += ./NS_UtilityCenter/src/ns_utility.cpp
+libNS_FrameworkUnified_SRCS += ./NS_UtilityCenter/src/frameworkunified_version.cpp
+CPPFLAGS += -I./NS_UtilityCenter/include
+
+# NS_MessageCenter
+libNS_FrameworkUnified_SRCS += ./NS_MessageCenter/src/ns_message_center.c
+CPPFLAGS += -I./NS_MessageCenter/include
+
+# NS_ConfigParser
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_cfg_parser.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_cfg_reader.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_cfg_writer.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_config_reader.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_config_reader_writer.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_config_writer.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_reader.cpp
+libNS_FrameworkUnified_SRCS += ./NS_ConfigParser/src/ns_writer.cpp
+CPPFLAGS += -I./NS_ConfigParser/include
+
+# NS_NPServiceIf
+libNS_FrameworkUnified_SRCS += ./NS_NPServiceIf/src/ns_np_service_api.c
+libNS_FrameworkUnified_SRCS += ./NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp
+CPPFLAGS += -I./NS_NPServiceIf/include
+
+# NS_Timer
+libNS_FrameworkUnified_SRCS += ./NS_Timer/src/mod_version.c
+libNS_FrameworkUnified_SRCS += ./NS_Timer/src/ns_timer.c
+libNS_FrameworkUnified_SRCS += ./NS_Timer/src/ns_timer_class.cpp
+CPPFLAGS += -I./NS_Timer/include
+
+# NS_FrameworkCore
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_dispatcher.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_error.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_logger.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_session.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_sync.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_framework_system.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_multithreading.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_service_if.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_thread_priority.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/frameworkunified_timer.cpp
+CPPFLAGS += -I./NS_FrameworkCore/include
+
+# NS_FrameworkCore/src/statemachine
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp
+libNS_FrameworkUnified_SRCS += ./NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp
+CPPFLAGS += -I./NS_FrameworkCore/include/statemachine
+
+# NS__CWORD77__ServiceIf
+libNS_FrameworkUnified_SRCS += ./NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp
+libNS_FrameworkUnified_SRCS += ./NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp
+libNS_FrameworkUnified_SRCS += ./NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp
+
+# NS_ResourceControler
+libNS_FrameworkUnified_SRCS += ./NS_ResourceControler/src/ns_resource_controler.cpp
+
+######### add include path #############
+CPPFLAGS += -I./include
+
+######### add compile option #############
+
+LDFLAGS += -Wl,--no-as-needed
+
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lrt
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+LDLIBS += -Wl,-Bdynamic -lcommon
+LINK_SHLIB_CXX = Y
+
+# buildversioncheck
+INST_HEADERS += ns_buildversioncheck.hpp
+
+
+SUBDIRS := NS_XMLConfigeParser NS_Utility
+
+
+
+all:
+
+install-data:install_cfg
+ install -d -m 775 $(DESTDIR)/nv/BS/ns/framework_unified/rwdata
+
+install_cfg:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ns/framework_unified/rodata
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ns/framework_unified/rodata NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg
+
+include ../../native_service.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_internal.h
new file mode 100755
index 0000000..64aad8b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_internal.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains the declaration of internal structure for parsing cfg configuration
+/// file.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_INTERNAL_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include <vector>
+
+class CNode {
+ public:
+ CNode(): m_cComment(""), m_cTag(""), m_cValue("") {} // LCOV_EXCL_BR_LINE 11:except branch
+
+ ~CNode() {}
+
+ std::string m_cComment;
+ std::string m_cTag;
+ std::string m_cValue;
+};
+
+class CBlock {
+ public:
+ CBlock(): m_cComment("") {} // LCOV_EXCL_BR_LINE 11:except branch
+
+ ~CBlock() {}
+
+ std::string m_cComment;
+ std::vector<CNode> m_vElementPair;
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_INTERNAL_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_parser.h b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_parser.h
new file mode 100755
index 0000000..8d7a47f
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_parser.h
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains the declaration of class CCFGParser.
+/// This class contains the parsing logic for reading and writing from and to cfg files
+/// respectively.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_PARSER_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_PARSER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <map>
+
+// forward declaration of classes
+class CNode;
+class CBlock;
+
+typedef std::map<std::string, CBlock *> CFGData_Type;
+
+class CCFGParser {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGParser
+ /// Constructor of CCFGReader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CCFGParser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGParser
+ /// Constructor of CCFGReader class
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - Full path of the configuration file
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CCFGParser(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CCFGParser
+ /// Destructor of CCFGReader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CCFGParser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFGParseFile
+ /// This function is used to parse the configuration file and store data in internal structure
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - full path of the configuration file
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CFGParseFile(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFGGetData
+ /// This function is used to get the value associated with the key from internal CFG structure
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ ///
+ /// \return std::string - value for key
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string CFGGetData(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFGGetData
+ /// This function is used to get the value associated with the key from internal CFG structure
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ /// \param [IN] f_c_value
+ /// std::string - Value of key
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - error if key not founf or else eFrameworkunifiedStatusOK
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CFGGetData(const std::string &f_c_key, std::string &f_c_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFGSetData
+ /// This function is used to set the value for the key in internal CFG structure
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ /// \param [IN] f_c_value
+ /// std::string - value to set
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CFGSetData(const std::string &f_c_key, std::string f_c_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFGSaveData
+ /// This function is used to save the changed value to the cfg config file
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - full path of the configuration file
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CFGSaveData(const std::string &f_c_filepath);
+
+ private:
+ // internal data structure created by parsing the cfg file
+ CFGData_Type *m_pmCFGData;
+ std::string m_cLastComment;
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_PARSER_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_reader.h b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_reader.h
new file mode 100755
index 0000000..d47c04b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_reader.h
@@ -0,0 +1,133 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class CCFGReader.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_READER_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_READER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_reader.h>
+#include <string>
+
+class CCFGParser;
+
+/*
+ * This class provides functionalities to read from CFG config file
+ */
+class CCFGReader: public IConfigReader {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGReader
+ /// Constructor of CCFGReader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CCFGReader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGReader
+ /// Constructor of CCFGReader class
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - Full path of the configuration file
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CCFGReader(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CCFGReader
+ /// Destructor of CCFGReader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CCFGReader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ParseFile
+ /// This function is used to parse the file
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - path of file to parse
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ParseFile(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetString
+ /// This function is used to get the value associated with the key
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ ///
+ /// \return std::string - value for key
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetValue(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetString
+ /// This function is used to get the value associated with the key
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ /// \param [REF] f_c_value
+ /// std::string - Value of key
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - error if key not found else eFrameworkunifiedStatusOK
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetValue(const std::string &f_c_key, std::string &f_c_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDataPtr
+ /// This function is used to get the data pointer. This pointer is then set in config writer.
+ /// This is needed to avoid recreation of same data structure object in both reader and writer
+ /// when we create object of NSConfigParser.
+ ///
+ /// \param
+ ///
+ /// \return PVOID - pointer of data structure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PVOID GetDataPtr();
+
+ private:
+ // path of config file
+ std::string m_cFilePath;
+
+ // CFG file parser object
+ CCFGParser *m_pCFGParser;
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_READER_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_writer.h b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_writer.h
new file mode 100755
index 0000000..58d1639
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_cfg_writer.h
@@ -0,0 +1,146 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class CCFGWriter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_WRITER_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_WRITER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_writer.h>
+#include <string>
+
+class CCFGParser;
+
+/*
+ * This class provides functionalities to write to CFG config file
+ */
+class CCFGWriter: public IConfigWriter {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGWriter
+ /// Constructor of CCFGWriter class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CCFGWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCFGWriter
+ /// Constructor of CCFGWriter class
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - Full path of the configuration file
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CCFGWriter(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CCFGWriter
+ /// Destructor of CCFGWriter class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CCFGWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ParseFile
+ /// This function is used to parse the file
+ ///
+ /// \param [IN] f_c_filepath
+ /// std::string - path of file to parse
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ParseFile(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetValue
+ /// This function is used to set the value for the key
+ ///
+ /// \param [IN] f_c_key
+ /// std::string - key to search
+ /// \param [IN] f_c_value
+ /// std::string - value to set
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - error if key not found else eFrameworkunifiedStatusOK
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetValue(const std::string &f_c_key, std::string f_c_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SaveData
+ /// This function is used to save the changed value to the cfg config file
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SaveData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDataPtr
+ /// This function is used to set the config file path
+ ///
+ /// \param [IN] f_c_path
+ /// std::string - Path of file
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPath(const std::string &f_c_path);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDataPtr
+ /// This function is used to set the data pointer in writer class with data pointer
+ /// created in config reader class.
+ /// This is needed to avoid recreation of same data structure object in both reader and writer
+ /// when we create object of NSConfigParser
+ ///
+ /// \param [IN] f_p_data
+ /// PVOID - Pointer to data structure
+ ///
+ /// \return VOID
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetDataPtr(PVOID f_p_data);
+
+ private:
+ // path of config file
+ std::string m_cFilePath;
+
+ // CFG file parser object
+ CCFGParser *m_pCFGParser;
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CFG_WRITER_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_config_parser_frameworkunifiedlog.h b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_config_parser_frameworkunifiedlog.h
new file mode 100755
index 0000000..c48f09d
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/include/ns_config_parser_frameworkunifiedlog.h
@@ -0,0 +1,88 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGZONES
+// #define FRAMEWORKUNIFIEDLOGZONES (ZONE_WARN|ZONE_ERR)
+#define FRAMEWORKUNIFIEDLOGZONES (ZONE_INIT|ZONE_FUNC|ZONE_INFO|ZONE_WARN|ZONE_ERR|ZONE_NS_WAR|ZONE_NS_ERR)
+#endif
+
+extern const CHAR kAppName[];
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_CONFIGPARSER_INCLUDE_NS_CONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..1e6e556
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/makefile_PosixBasedOS001
@@ -0,0 +1,207 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_ConfigParser
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_ConfigParser
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_XMLConfigParser/inc
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+#DYNAMIC_LIBS += \
+# xml2 \
+# m
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+module_dirs: build_dirs
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_parser.cpp b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_parser.cpp
new file mode 100755
index 0000000..a2abd78
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_parser.cpp
@@ -0,0 +1,365 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CCFGParser class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <ns_cfg_internal.h>
+#include <ns_cfg_parser.h>
+#include <ns_config_parser_frameworkunifiedlog.h>
+
+#include <fstream>
+#include <string>
+
+CCFGParser::CCFGParser()
+ : m_pmCFGData(NULL) {
+}
+
+// LCOV_EXCL_START 200:CCFGParser is not external API class, this constructed function isn't used by other function
+CCFGParser::CCFGParser(const std::string &f_cfilepath)
+ : m_pmCFGData(NULL) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CFGParseFile(f_cfilepath);
+}
+// LCOV_EXCL_STOP
+
+CCFGParser::~CCFGParser() {
+ CFGData_Type::iterator l_itCfgStructure;
+
+ if (NULL != m_pmCFGData) { // LCOV_EXCL_BR_LINE 5:m_pmCFGData cannot be NULL, because internal logic guarantee
+ // release the structure
+ for (l_itCfgStructure = m_pmCFGData->begin();
+ l_itCfgStructure != m_pmCFGData->end();
+ l_itCfgStructure++) {
+ CBlock *l_pBlock = (*l_itCfgStructure).second;
+ if (NULL != l_pBlock) { // LCOV_EXCL_BR_LINE 5:l_pBlock cannot be NULL, because map insert data success.
+ // clear the vector
+ l_pBlock->m_vElementPair.clear();
+
+ delete l_pBlock; // LCOV_EXCL_BR_LINE 11:except branch
+ l_pBlock = NULL;
+ }
+ }
+
+ delete m_pmCFGData; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pmCFGData = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CCFGParser::CFGParseFile(const std::string &f_cfilepath) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ size_t l_uiPos = 0;
+ std::string l_cLine("");
+ std::string l_cTag(""); // LCOV_EXCL_BR_LINE 11:except branch
+ std::string l_cComment(""); // LCOV_EXCL_BR_LINE 11:except branch
+
+ m_pmCFGData = new(std::nothrow) CFGData_Type(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (NULL != m_pmCFGData) { // LCOV_EXCL_BR_LINE 5:new's error case
+ // open the file
+ std::ifstream l_objFile(f_cfilepath.c_str()); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // check if file is opened
+ if (l_objFile.is_open()) {
+ CBlock *l_pBlock = NULL;
+
+ // read until end of file is not reached or any other stream error occurred
+ while (!l_objFile.eof()) {
+ // read the line from the file
+ getline(l_objFile, l_cLine); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // if line is a comment
+ if ('#' == l_cLine[0] || ';' == l_cLine[0]) {
+ if (!l_cComment.empty()) {
+ l_cComment.append("\n"); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+ l_cComment.append(l_cLine);
+ } else if ('[' == l_cLine[0]) { // if line is main tag
+ // creates new CBlock object,
+ // each block contains information of single like all its key-value pair and
+ // all the comments associated with it.
+ l_pBlock = new CBlock(); // LCOV_EXCL_BR_LINE 11:except branch
+ if (NULL != l_pBlock) { // LCOV_EXCL_BR_LINE 5:new's error case
+ // set the tag comment
+ l_pBlock->m_cComment = l_cComment;
+ l_cComment.clear();
+
+ if (std::string::npos != (l_uiPos = l_cLine.find(']'))) {
+ // set the tag
+ l_cTag = l_cLine.substr(1, l_uiPos - 1); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // insert the block with its tag name in structure(map)
+ m_pmCFGData->insert(make_pair(l_cTag, l_pBlock)); // NOLINT (readability/nolint)
+ } else {
+ delete l_pBlock; // LCOV_EXCL_BR_LINE 11:except branch
+ l_pBlock = NULL;
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "End Tag missing");
+ // LCOV_EXCL_BR_STOP
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+ }
+ } else {
+ // LCOV_EXCL_START 5:new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error allocating memory for l_pBlock");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ } else if (std::string::npos != (l_uiPos = l_cLine.find('='))) { // LCOV_EXCL_BR_LINE 11:except branch
+ if (NULL != l_pBlock) { // LCOV_EXCL_BR_LINE 5:new's error case
+ // create new node object,
+ // each node object contains the information of singlr key-value pair and
+ /// it's comment(if any)
+ // LCOV_EXCL_BR_START 11:except branch
+ CNode l_objNode;
+ l_objNode.m_cComment.append(l_cComment);
+ l_objNode.m_cTag = l_cLine.substr(0, l_uiPos);
+ l_objNode.m_cValue = l_cLine.substr(l_uiPos + 1);
+
+ // insert the node object in block
+ l_pBlock->m_vElementPair.push_back(l_objNode);
+ // LCOV_EXCL_BR_STOP
+
+ l_cComment.clear();
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "l_pBlock is NULL");
+ // LCOV_EXCL_BR_STOP
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ break;
+ }
+ }
+ }
+
+ // last comment
+ if (!l_cComment.empty()) {
+ m_cLastComment = l_cComment;
+ } else {
+ m_cLastComment.clear();
+ }
+
+ // close the file
+ l_objFile.close(); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error Opening File");
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5:new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pmCFGData is NULL");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ return l_eStatus;
+}
+
+std::string CCFGParser::CFGGetData(const std::string &f_ckey) {
+ CFGData_Type::iterator l_itCfgStructure;
+ std::string l_cHeadTag = "";
+ std::string l_cTag = ""; // LCOV_EXCL_BR_LINE 11:except branch
+ std::string l_cValue = ""; // LCOV_EXCL_BR_LINE 11:except branch
+
+ size_t l_uiPos = 0;
+
+ if (NULL != m_pmCFGData && !f_ckey.empty()) { // LCOV_EXCL_BR_LINE 5:new's error case(in function CFGParseFile)
+ if (std::string::npos != (l_uiPos = f_ckey.find('.'))) { // LCOV_EXCL_BR_LINE 11:except branch
+ l_cHeadTag = f_ckey.substr(0, l_uiPos); // LCOV_EXCL_BR_LINE 11:except branch
+ l_cTag = f_ckey.substr(l_uiPos + 1); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ // search for the key and its associated value in internal structure
+ for (l_itCfgStructure = m_pmCFGData->begin();
+ l_itCfgStructure != m_pmCFGData->end();
+ l_itCfgStructure++) {
+ CBlock *l_pBlock = (*l_itCfgStructure).second;
+
+ if (!l_cHeadTag.compare((*l_itCfgStructure).first) && NULL != l_pBlock) {
+ for (UI_32 l_uiCount = 0; l_uiCount < l_pBlock->m_vElementPair.size(); l_uiCount++) {
+ if (!l_cTag.compare(l_pBlock->m_vElementPair[l_uiCount].m_cTag)) {
+ // LCOV_EXCL_BR_START 200:After l_cValue assignment is empty,there is no other place to assignment the value
+ if (!l_cValue.empty()) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 200:After l_cValue assignment is empty,there is no other place to assignment the value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_cValue.append("\n");
+ // LCOV_EXCL_STOP 200
+ }
+ l_cValue.append(l_pBlock->m_vElementPair[l_uiCount].m_cValue);
+ }
+ }
+ }
+ }
+ }
+
+ return l_cValue;
+}
+
+EFrameworkunifiedStatus CCFGParser::CFGGetData(const std::string &f_ckey, std::string &f_cvalue) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ CFGData_Type::iterator l_itCfgStructure;
+ std::string l_cHeadTag = "";
+ std::string l_cTag = ""; // LCOV_EXCL_BR_LINE 11:except branch
+ std::string l_cValue = ""; // LCOV_EXCL_BR_LINE 11:except branch
+
+ size_t l_uiPos = 0;
+
+ if (NULL != m_pmCFGData && !f_ckey.empty()) { // LCOV_EXCL_BR_LINE 5:new's error case(in function CFGParseFile)
+ if (std::string::npos != (l_uiPos = f_ckey.find('.'))) { // LCOV_EXCL_BR_LINE 11:except branch
+ l_cHeadTag = f_ckey.substr(0, l_uiPos); // LCOV_EXCL_BR_LINE 11:except branch
+ l_cTag = f_ckey.substr(l_uiPos + 1); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ // search for the key and its associated value in internal structure
+ for (l_itCfgStructure = m_pmCFGData->begin();
+ l_itCfgStructure != m_pmCFGData->end();
+ l_itCfgStructure++) {
+ CBlock *l_pBlock = (*l_itCfgStructure).second;
+
+ if (!l_cHeadTag.compare((*l_itCfgStructure).first) && NULL != l_pBlock) {
+ for (UI_32 l_uiCount = 0; l_uiCount < l_pBlock->m_vElementPair.size(); l_uiCount++) {
+ if (!l_cTag.compare(l_pBlock->m_vElementPair[l_uiCount].m_cTag)) {
+ if (!f_cvalue.empty()) {
+ f_cvalue.append("\n");
+ }
+ f_cvalue.append(l_pBlock->m_vElementPair[l_uiCount].m_cValue);
+
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ }
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CCFGParser::CFGSetData(const std::string &f_cKey, std::string f_cvalue) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ CFGData_Type::iterator l_itCfgStructure;
+ std::string l_cHeadTag = "";
+ std::string l_cTag = ""; // LCOV_EXCL_BR_LINE 11:except branch
+ std::string l_cValue = ""; // LCOV_EXCL_BR_LINE 11:except branch
+ size_t l_uiPos = 0;
+
+ // LCOV_EXCL_BR_START 6:f_cKey is not NULL, because checked in CCFGWriter::SetValue
+ if (NULL != m_pmCFGData && !f_cKey.empty()) {
+ // LCOV_EXCL_BR_STOP
+ if (std::string::npos != (l_uiPos = f_cKey.find('.'))) { // LCOV_EXCL_BR_LINE 11:except branch
+ l_cHeadTag = f_cKey.substr(0, l_uiPos); // LCOV_EXCL_BR_LINE 11:except branch
+ l_cTag = f_cKey.substr(l_uiPos + 1); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ // search for the key in internal structure and set the data for it
+ for (l_itCfgStructure = m_pmCFGData->begin();
+ l_itCfgStructure != m_pmCFGData->end();
+ l_itCfgStructure++) {
+ CBlock *l_pBlock = (*l_itCfgStructure).second;
+
+ if (!l_cHeadTag.compare((*l_itCfgStructure).first) && NULL != l_pBlock) {
+ for (UI_32 l_uiCount = 0; l_uiCount < l_pBlock->m_vElementPair.size(); l_uiCount++) {
+ if (!l_cTag.compare(l_pBlock->m_vElementPair[l_uiCount].m_cTag)) {
+ l_pBlock->m_vElementPair[l_uiCount].m_cValue.assign(f_cvalue);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6:f_cKey is not NULL, because checked in CCFGWriter::SetValue
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pmCFGData is NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CCFGParser::CFGSaveData(const std::string &f_cfilepath) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CFGData_Type::iterator l_itCfgStructure;
+
+ if (NULL != m_pmCFGData) { // LCOV_EXCL_BR_LINE 5:m_pmCFGData cannot be NULL, because internal logic guarantee
+ std::ofstream l_objFile(f_cfilepath.c_str());
+
+ // check if file is open
+ if (l_objFile.is_open()) {
+ // write the updated CFG structure back to the file
+ for (l_itCfgStructure = m_pmCFGData->begin();
+ l_itCfgStructure != m_pmCFGData->end();
+ l_itCfgStructure++) {
+ CBlock *l_pBlock = (*l_itCfgStructure).second;
+ if (NULL != l_pBlock) { // LCOV_EXCL_BR_LINE 11:except branch
+ // write the main tag comment in file
+ if (!l_pBlock->m_cComment.empty()) {
+ l_objFile << l_pBlock->m_cComment << std::endl;
+ }
+
+ // write main tag to file
+ l_objFile << "[" << (*l_itCfgStructure).first << "]" << std::endl;
+
+ for (UI_32 l_uiCount = 0; l_uiCount < l_pBlock->m_vElementPair.size(); l_uiCount++) {
+ // comment over the key-value pair
+ if (!l_pBlock->m_vElementPair[l_uiCount].m_cComment.empty()) {
+ l_objFile << l_pBlock->m_vElementPair[l_uiCount].m_cComment << std::endl;;
+ }
+
+ // key-value
+ l_objFile << l_pBlock->m_vElementPair[l_uiCount].m_cTag << "="
+ << l_pBlock->m_vElementPair[l_uiCount].m_cValue << std::endl;
+ }
+ }
+ }
+
+ // last comment
+ if (!m_cLastComment.empty()) {
+ l_objFile << m_cLastComment << std::endl;
+ }
+
+ // close the file
+ l_objFile.close(); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Cannot Open File");
+ }
+ } else {
+ // LCOV_EXCL_START 5:m_pmCFGData cannot be NULL, because internal logic guarantee
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pmCFGData is NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_reader.cpp b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_reader.cpp
new file mode 100755
index 0000000..9eeb3c0
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_reader.cpp
@@ -0,0 +1,117 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CCFGReader class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <ns_cfg_reader.h>
+#include <ns_cfg_parser.h>
+#include <ns_config_parser_frameworkunifiedlog.h>
+#include <string>
+
+
+
+CCFGReader::CCFGReader(): m_cFilePath(""), m_pCFGParser(NULL) { // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+// LCOV_EXCL_START 200:CCFGReader is not external API class, this constructed function isn't used by other function
+CCFGReader::CCFGReader(const std::string &f_c_filepath): m_cFilePath(f_c_filepath), m_pCFGParser(NULL) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", m_cFilePath.c_str());
+
+ m_pCFGParser = new CCFGParser(m_cFilePath);
+
+ if (NULL == m_pCFGParser) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Memory allocation error for m_pCFGParser");
+ }
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CCFGReader::ParseFile(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ m_cFilePath.assign(f_c_filepath);
+
+ m_pCFGParser = new(std::nothrow) CCFGParser(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (NULL == m_pCFGParser) { // LCOV_EXCL_BR_LINE 5:new's error case
+ // LCOV_EXCL_START 5:new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Memory allocation error for m_pCFGParser");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ l_e_status = m_pCFGParser->CFGParseFile(f_c_filepath);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_e_status;
+}
+
+CCFGReader::~CCFGReader() {
+ if (NULL != m_pCFGParser) {
+ delete m_pCFGParser;
+ m_pCFGParser = NULL;
+ }
+}
+
+PVOID CCFGReader::GetDataPtr() {
+ return m_pCFGParser;
+}
+
+std::string CCFGReader::GetValue(const std::string &f_c_key) {
+ std::string l_cValue = "";
+
+ if (NULL != m_pCFGParser && !f_c_key.empty()) { // LCOV_EXCL_BR_LINE 11:except branch
+ // read the data from internal CFG structure
+ l_cValue = m_pCFGParser->CFGGetData(f_c_key); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ return l_cValue;
+}
+
+EFrameworkunifiedStatus CCFGReader::GetValue(const std::string &f_c_key, std::string &f_c_value) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL == m_pCFGParser) { // LCOV_EXCL_BR_LINE 5:m_pCFGParser cannot be NULL, because internal logic guarantee
+ // LCOV_EXCL_START 5:m_pCFGParser cannot be NULL, because internal logic guarantee
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Parser object(m_pCFGParser) is NULL");
+ // LCOV_EXCL_STOP
+ } else if (f_c_key.empty()) {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid Key");
+ // LCOV_EXCL_BR_STOP
+ } else {
+ // read the data from internal CFG structure
+ l_e_status = m_pCFGParser->CFGGetData(f_c_key, f_c_value);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_e_status;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_writer.cpp b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_writer.cpp
new file mode 100755
index 0000000..4bf16d5
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_cfg_writer.cpp
@@ -0,0 +1,135 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CCFGWriter class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include <ns_cfg_parser.h>
+#include <ns_cfg_writer.h>
+#include <ns_config_parser_frameworkunifiedlog.h>
+
+#include <fstream>
+#include <string>
+
+
+CCFGWriter::CCFGWriter(): m_cFilePath(""), m_pCFGParser(NULL) { // LCOV_EXCL_BR_LINE 11:except branch
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
+
+CCFGWriter::CCFGWriter(const std::string &f_c_filepath): m_cFilePath(f_c_filepath), m_pCFGParser(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", m_cFilePath.c_str());
+
+ m_pCFGParser = new CCFGParser(m_cFilePath);
+
+ if (NULL == m_pCFGParser) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Memory allocation error for m_pCFGParser");
+ }
+}
+
+CCFGWriter::~CCFGWriter() {
+ if (NULL != m_pCFGParser) {
+ delete m_pCFGParser; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pCFGParser = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CCFGWriter::ParseFile(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ m_cFilePath.assign(f_c_filepath);
+
+ m_pCFGParser = new(std::nothrow) CCFGParser(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (NULL == m_pCFGParser) { // LCOV_EXCL_BR_LINE 5:m_pCFGParser cannot be NULL, because internal logic guarantee
+ // LCOV_EXCL_START 5:m_pCFGParser cannot be NULL, because internal logic guarantee
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Memory allocation error for m_pCFGParser");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ l_e_status = m_pCFGParser->CFGParseFile(f_c_filepath);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CCFGWriter::SetPath(const std::string &f_c_path) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (!f_c_path.empty()) { // LCOV_EXCL_BR_LINE 11:except branch
+ // set the file path
+ m_cFilePath.assign(f_c_path);
+ } else {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_e_status;
+}
+
+VOID CCFGWriter::SetDataPtr(PVOID f_p_data) {
+ if (NULL != f_p_data) {
+ // set the doc pointer
+ m_pCFGParser = static_cast<CCFGParser *>(f_p_data);
+ } else {
+ m_pCFGParser = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Data Pointer not set in cfg writer"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+}
+
+EFrameworkunifiedStatus CCFGWriter::SetValue(const std::string &f_c_key, std::string f_c_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pCFGParser && !f_c_key.empty()) {
+ // set the data in internal CFG structure
+ l_e_status = m_pCFGParser->CFGSetData(f_c_key, f_c_value); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CCFGWriter::SaveData() {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pCFGParser) {
+ if (0 == access(m_cFilePath.c_str(), W_OK)) {
+ // save the data permanently in config file
+ l_e_status = m_pCFGParser->CFGSaveData(m_cFilePath);
+ } else {
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader.cpp b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader.cpp
new file mode 100755
index 0000000..839053a
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader.cpp
@@ -0,0 +1,346 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CNSConfigReader class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <stdlib.h>
+#include <ctype.h>
+#include <dlfcn.h>
+#include <errno.h>
+
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_reader.h>
+
+#include <cstring>
+#include <string>
+
+#include "ns_config_parser_frameworkunifiedlog.h"
+#include "ns_cfg_reader.h"
+CNSConfigReader::CNSConfigReader() {
+ m_pReader = NULL;
+}
+
+CNSConfigReader::CNSConfigReader(const std::string &f_c_filepath): m_pReader(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ if (eFrameworkunifiedStatusOK != Parse(f_c_filepath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Parsing file %s", f_c_filepath.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+}
+
+CNSConfigReader::~CNSConfigReader() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
+
+ if (NULL != m_pReader) {
+ delete m_pReader; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pReader = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CNSConfigReader::Parse(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ if (NULL != m_pReader) {
+ delete m_pReader; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pReader = NULL;
+ }
+
+ // create parser object depending on file extension
+ if (NULL != std::strstr(f_c_filepath.c_str(), ".cfg")) {
+ m_pReader = new(std::nothrow) CCFGReader(); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Not CFG"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->ParseFile(f_c_filepath);
+ } else {
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_e_status;
+}
+
+PVOID CNSConfigReader::GetDataPtr() {
+ if (NULL != m_pReader) {
+ // get the data pointer
+ return m_pReader->GetDataPtr();
+ } else {
+ return NULL;
+ }
+}
+
+BOOL CNSConfigReader::GetBool(const std::string &f_c_key) {
+ BOOL l_bResult = FALSE;
+
+ if (NULL != m_pReader) {
+ std::string l_c_temp = m_pReader->GetValue(f_c_key);
+
+ l_c_temp = FormatValue(l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (!strcasecmp(l_c_temp.c_str(), "true")) {
+ l_bResult = TRUE;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ return l_bResult;
+}
+
+F_64 CNSConfigReader::GetDouble(const std::string &f_c_key) {
+ F_64 l_fValue = 0;
+
+ if (NULL != m_pReader) {
+ std::string l_c_temp = m_pReader->GetValue(f_c_key);
+
+ errno = EOK;
+
+ // convert string to double
+ l_fValue = strtod(l_c_temp.c_str(), NULL);
+
+ if (EOK != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to double, errno=%d", l_c_temp.c_str(), errno);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ return l_fValue;
+}
+
+F_32 CNSConfigReader::GetFloat(const std::string &f_c_key) {
+ F_32 l_fValue = 0;
+
+ if (NULL != m_pReader) {
+ std::string l_c_temp = m_pReader->GetValue(f_c_key);
+ errno = EOK;
+ l_fValue = strtof(l_c_temp.c_str(), NULL);
+
+ if (EOK != errno) {
+ l_fValue = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to float, errno=%d", l_c_temp.c_str(), errno);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ return l_fValue;
+}
+
+SI_32 CNSConfigReader::GetInt(const std::string &f_c_key) {
+ UI_64 l_ui_value = 0;
+
+ if (NULL != m_pReader) {
+ std::string l_c_temp = m_pReader->GetValue(f_c_key);
+
+ errno = EOK;
+
+ if ((l_c_temp.size() >= 3) && ('0' == l_c_temp[0]) && ('X' == toupper(l_c_temp[1]))) {
+ l_ui_value = strtoul(l_c_temp.c_str(), NULL, 16);
+ } else {
+ l_ui_value = strtoul(l_c_temp.c_str(), NULL, 10);
+ }
+
+ if (EOK != errno) {
+ l_ui_value = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to int, errno=%d", l_c_temp.c_str(), errno);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ return static_cast<SI_32>(l_ui_value);
+}
+
+std::string CNSConfigReader::GetString(const std::string &f_c_key) {
+ std::string l_c_temp = "";
+
+ if (NULL != m_pReader) {
+ l_c_temp = m_pReader->GetValue(f_c_key); // LCOV_EXCL_BR_LINE 11:except branch
+
+ l_c_temp = FormatValue(l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ }
+
+ return l_c_temp;
+}
+
+EFrameworkunifiedStatus CNSConfigReader::GetBool(const std::string &f_c_key, BOOL &f_b_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ std::string l_c_temp = "";
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->GetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK == l_e_status) {
+ l_c_temp = FormatValue(l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (!strcasecmp(l_c_temp.c_str(), "true")) {
+ f_b_value = TRUE;
+ } else if (!strcasecmp(l_c_temp.c_str(), "false")) {
+ f_b_value = FALSE;
+ } else {
+ l_e_status = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigReader::GetDouble(const std::string &f_c_key, F_64 &f_d_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ std::string l_c_temp = "";
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->GetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK == l_e_status) {
+ errno = EOK;
+ f_d_value = strtod(l_c_temp.c_str(), NULL);
+
+ if (EOK != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to double, errno=%d", l_c_temp.c_str(), errno);
+ l_e_status = eFrameworkunifiedStatusInvldBuf;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigReader::GetFloat(const std::string &f_c_key, F_32 &f_f_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ std::string l_c_temp = "";
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->GetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK == l_e_status) {
+ errno = EOK;
+ f_f_value = strtof(l_c_temp.c_str(), NULL);
+
+ if (EOK != errno) {
+ f_f_value = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to float, errno=%d", l_c_temp.c_str(), errno);
+ l_e_status = eFrameworkunifiedStatusInvldBuf;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigReader::GetInt(const std::string &f_c_key, SI_32 &f_i_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ std::string l_c_temp = "";
+
+ UI_64 l_ui_value = 0;
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->GetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK == l_e_status) {
+ errno = EOK;
+
+ if ((l_c_temp.size() >= 3) && ('0' == l_c_temp[0]) && ('X' == toupper(l_c_temp[1]))) {
+ l_ui_value = strtoul(l_c_temp.c_str(), NULL, 16);
+ } else {
+ l_ui_value = strtoul(l_c_temp.c_str(), NULL, 10);
+ }
+
+ f_i_value = static_cast<SI_32>(l_ui_value);
+
+ if (EOK != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to int, errno=%d", l_c_temp.c_str(), errno);
+ l_e_status = eFrameworkunifiedStatusInvldBuf;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigReader::GetString(const std::string &f_c_key, std::string &f_c_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ std::string l_c_temp = "";
+
+ if (NULL != m_pReader) {
+ l_e_status = m_pReader->GetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK == l_e_status) {
+ l_c_temp = FormatValue(l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+
+ f_c_value.assign(l_c_temp);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Reader (m_pReader) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+std::string CNSConfigReader::FormatValue(const std::string &f_c_value) {
+ std::string l_c_newvalue = f_c_value;
+
+ if (0 < f_c_value.length()) {
+ UI_32 l_uiStrPos = static_cast<UI_32>(l_c_newvalue.length() - 1);
+
+ while ('\n' == l_c_newvalue[l_uiStrPos] || '\r' == l_c_newvalue[l_uiStrPos]) {
+ l_c_newvalue = l_c_newvalue.substr(0, l_uiStrPos);
+
+ if (0 == l_uiStrPos) {
+ break;
+ }
+
+ l_uiStrPos--;
+ }
+ }
+
+ return l_c_newvalue;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader_writer.cpp b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader_writer.cpp
new file mode 100755
index 0000000..6c2b2d6
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_reader_writer.cpp
@@ -0,0 +1,74 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CNSConfigParser class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_config_parser_if.h>
+#include <string>
+#include "ns_config_parser_frameworkunifiedlog.h"
+
+CNSConfigParser::CNSConfigParser() : CNSConfigReader(), CNSConfigWriter() { // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+CNSConfigParser::CNSConfigParser(const std::string &f_c_filepath): CNSConfigReader(f_c_filepath),
+ CNSConfigWriter(f_c_filepath, TRUE) { // LCOV_EXCL_BR_LINE 11:except branch
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ // get the data pointer from the config reader
+ PVOID l_pdata = GetDataPtr(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // set the same data pointer in config writer
+ SetDataPtr(l_pdata); // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+CNSConfigParser::~CNSConfigParser() { // LCOV_EXCL_BR_LINE 11:except branch
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
+
+ // set the data pointer to NULL in writer
+ SetDataPtr(NULL); // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+EFrameworkunifiedStatus CNSConfigParser::Parse(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ // parse and create config document structure with reader
+ if (eFrameworkunifiedStatusOK == (l_e_status = CNSConfigReader::Parse(f_c_filepath))) {
+ // set the data pointer to NULL in writer
+ SetDataPtr(NULL);
+
+ // sets the same config document structure in writer
+ if (eFrameworkunifiedStatusOK == (l_e_status = CNSConfigWriter::Create(f_c_filepath))) {
+ // get the data pointer from the config reader
+ PVOID l_pdata = GetDataPtr();
+
+ // set the same data pointer in config writer
+ SetDataPtr(l_pdata);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_e_status;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_writer.cpp b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_writer.cpp
new file mode 100755
index 0000000..601500d
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_config_writer.cpp
@@ -0,0 +1,227 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CNSConfigWriter class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_writer.h>
+#include <dlfcn.h>
+#include <sstream>
+#include <cstring>
+#include <string>
+#include "ns_cfg_writer.h"
+#include "ns_config_parser_frameworkunifiedlog.h"
+
+
+CNSConfigWriter::CNSConfigWriter(): m_pWriter(NULL) {
+}
+
+CNSConfigWriter::CNSConfigWriter(const std::string &f_c_filepath): m_pWriter(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ Parse(f_c_filepath);
+}
+
+CNSConfigWriter::CNSConfigWriter(const std::string &f_c_filepath, BOOL f_b_noload): m_pWriter(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_c_filepath.c_str());
+
+ Create(f_c_filepath);
+}
+
+CNSConfigWriter::~CNSConfigWriter() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
+
+ if (NULL != m_pWriter) {
+ delete m_pWriter; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pWriter = NULL;
+ }
+ // TODO(my_username): dlclose.
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Parse(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ delete m_pWriter; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pWriter = NULL;
+ }
+
+ // create parser object depending on file extension
+ if (std::strstr(f_c_filepath.c_str(), ".cfg") != NULL) {
+ m_pWriter = new(std::nothrow) CCFGWriter(); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Not CFG");
+ // LCOV_EXCL_BR_STOP
+ }
+
+ if (NULL != m_pWriter) {
+ l_e_status = m_pWriter->ParseFile(f_c_filepath);
+ } else {
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Create(const std::string &f_c_filepath) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ delete m_pWriter; // LCOV_EXCL_BR_LINE 11:except branch
+ m_pWriter = NULL;
+ }
+
+ // create parser object depending on file extension
+ if (std::strstr(f_c_filepath.c_str(), ".cfg") != NULL) {
+ m_pWriter = new(std::nothrow) CCFGWriter(); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Not CFG");
+ // LCOV_EXCL_BR_STOP
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+
+ if (NULL != m_pWriter) {
+ l_e_status = m_pWriter->SetPath(f_c_filepath);
+ } else {
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+VOID CNSConfigWriter::SetDataPtr(PVOID f_p_data) {
+ if (NULL != m_pWriter) {
+ m_pWriter->SetDataPtr(f_p_data);
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pWriter is NULL");
+ // LCOV_EXCL_BR_STOP
+ }
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Save() {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ // save the updated config file
+ l_e_status = m_pWriter->SaveData();
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL");
+ // LCOV_EXCL_BR_STOP
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::SetBool(const std::string &f_c_key, BOOL f_b_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ std::string l_c_temp = "";
+
+ if (TRUE == f_b_value) {
+ l_c_temp = "TRUE";
+ l_e_status = m_pWriter->SetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+ } else if (FALSE == f_b_value) { // LCOV_EXCL_BR_LINE 11:except branch
+ l_c_temp = "FALSE";
+ l_e_status = m_pWriter->SetValue(f_c_key, l_c_temp); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "received bool value is not proper:: %d", f_b_value);
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL");
+ // LCOV_EXCL_BR_STOP
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Set(const std::string &f_cKey, F_64 f_f_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ std::stringstream l_cStream;
+ l_cStream << f_f_value;
+
+ l_e_status = m_pWriter->SetValue(f_cKey, l_cStream.str()); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL");
+ // LCOV_EXCL_BR_STOP
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Set(const std::string &f_cKey, F_32 f_fValue) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) { // LCOV_EXCL_BR_LINE 11:except branch
+ std::stringstream l_cStream;
+ l_cStream << f_fValue;
+
+ l_e_status = m_pWriter->SetValue(f_cKey, l_cStream.str()); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL");
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Set(const std::string &f_cKey, SI_32 f_si_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ std::stringstream l_cStream;
+ l_cStream << f_si_value; // LCOV_EXCL_BR_LINE 11:except branch
+
+ l_e_status = m_pWriter->SetValue(f_cKey, l_cStream.str()); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL"); // LCOV_EXCL_BR_LINE 11:except branch
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
+
+EFrameworkunifiedStatus CNSConfigWriter::Set(const std::string &f_cKey, const std::string &f_s_value) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pWriter) {
+ l_e_status = m_pWriter->SetValue(f_cKey, f_s_value); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Config Writer (m_pWriter) is NULL"); // LCOV_EXCL_BR_LINE 11:except branch
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_e_status;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_reader.cpp b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_reader.cpp
new file mode 100755
index 0000000..ff3cc7a
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_reader.cpp
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of IConfigReader class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_reader.h>
+#include <ns_config_parser_frameworkunifiedlog.h>
+
+
+IConfigReader::IConfigReader() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
+
+IConfigReader::~IConfigReader() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_writer.cpp b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_writer.cpp
new file mode 100755
index 0000000..b2b52f0
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ConfigParser/src/ns_writer.cpp
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of IConfigWriter class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_writer.h>
+#include <ns_config_parser_frameworkunifiedlog.h>
+
+
+IConfigWriter::IConfigWriter() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
+
+IConfigWriter::~IConfigWriter() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_core.h b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_core.h
new file mode 100755
index 0000000..cb8bcee
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_core.h
@@ -0,0 +1,676 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Application framework's core structures and data types.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_CORE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_CORE_H_
+
+#include <pthread.h>
+#include <errno.h>
+
+#include <other_service/strlcpy.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/ns_logger_if.h>
+
+#include <iostream>
+#include <string>
+#include <map>
+#include <queue>
+#include <cstdio>
+#include <vector>
+#include <utility>
+
+static const UI_32 THREAD_SESSION_ID = 0;
+
+typedef HANDLE SessionHandle;
+typedef int SessionId; // < service protocol command
+typedef int ServiceProtocolCommand; // < service protocol command
+typedef int Fd; // < FD associated with callback
+typedef std::string Notification; // < notification name
+typedef std::string ServiceName; // < service name
+typedef std::string ThreadName;
+typedef std::string DataKey;
+typedef std::string InvokerName;
+typedef int Socket;
+typedef std::string ConnectKey;
+typedef PVOID Data;
+
+typedef std::map<Notification, CallbackFunctionPtr> NotificationTable;
+
+
+typedef std::map<ServiceProtocolCommand, CallbackFunctionPtr> ServiceProtocolTable;
+typedef std::map<SessionId, ServiceProtocolTable> SessionTable;
+typedef std::map<ServiceName, SessionTable> Services;
+typedef std::map<HANDLE, ServiceName> ServiceSendMsgHandle;
+typedef std::map<Fd, CallbackFunctionPtr> FdTable;
+
+typedef int EventId;
+typedef std::map<ServiceProtocolCommand, EventId> ServiceEventProtocolTable;
+typedef std::map<SessionId, ServiceEventProtocolTable> EventSessionTable;
+typedef std::map<ServiceName, EventSessionTable> EventServices;
+typedef std::map<Notification, EventId> NotificationEventTable;
+typedef std::map<SessionId, SessionHandle> SessionHandleTable;
+typedef std::map<ServiceName, SessionHandleTable> ServiceSessionTable;
+typedef std::map<InvokerName, HANDLE> InvokeResponseQTable;
+typedef std::map<Socket, ConnectKey> AcceptMonitorTable;
+typedef std::map<Socket, ConnectKey> ConnectMonitorTable;
+
+typedef std::pair<NotificationTable::iterator, bool> NotificationTableRetStatus;
+typedef std::map<DataKey, Data> AppData;
+
+// private event data structure
+typedef struct _EventData {
+ PVOID pData; /// <message data
+ UI_32 uiLength; /// <message length
+} EventData;
+
+// framework message queue info
+typedef struct _MsgQInfo {
+ CHAR cSrcName[MAX_NAME_SIZE_APP]; /// <source message queue name
+ CHAR cMsgQName[MAX_NAME_SIZE_APP]; /// <name of the handle to the msgq
+ UI_32 checkCode;
+ pthread_t self;
+ HANDLE hMsgQ; /// <handle to message queue
+ UI_32 sessionId; /// <Used only when it is a session handle
+} MsgQInfo;
+
+#define MSGQ_CHECK_CODE (0xACCE55ED)
+
+static inline BOOL frameworkunifiedCheckValidMsgQ(HANDLE hService) {
+ static __thread int detect_once = 0;
+ if (NULL != hService) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(hService);
+ /**
+ * @todo
+ * If an application handle is specified in place of a session handle,
+ * the element is accessed illegally without type checking,
+ * and a DeathTest occurs because the thread_self check is violated.
+ */
+ if (pMsgQ->self != pthread_self() && detect_once == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __func__, "Invalid thread context detect(hService/hSession):%#lx:%#lx", pMsgQ->self,
+ pthread_self());
+ detect_once = 1;
+ }
+ if (pMsgQ->checkCode == MSGQ_CHECK_CODE) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/* data structure for public state events and data associated with it */
+// map of state events and data associated with it
+typedef std::map<UI_32, EventData *> PublicStateEventTable;
+
+/* data structure for private state events and data associated with it */
+// list of session id's of service and event data(private) associated with it
+typedef std::map<UI_32, EventData *> SessionEventData;
+
+// map of service name and list of its session id's and associated event data
+typedef std::map<ServiceName, SessionEventData> ServiceSessionEventData;
+
+// map of private events and the data published on the all sessions of all services subscribed to it
+typedef std::map<UI_32, ServiceSessionEventData> PrivateStateEventTable;
+
+
+// list of session id's for each service registering with event
+typedef std::vector<UI_32> SessionIdList;
+typedef std::vector<UI_32> EventIdList;
+
+// map of service name and and list of its session id
+typedef std::map<ServiceName, SessionIdList> ServiceSessionIdListTable;
+// map of events and its subscribers
+typedef std::map<UI_32, ServiceSessionIdListTable> EventTable;
+
+// structure to hold the session handle and list of event ids for that session
+typedef struct _SessionEventInfo {
+ HANDLE m_hSession; // Msg queue handle for the specific session
+ EventIdList m_vEvents; // List of event ids corresponding to the session
+} SessionEventInfo, *PSessionEventInfo;
+
+// map to hold the session id and structure of session event info
+typedef std::map<SessionId, SessionEventInfo *> SessionToEventInfo;
+
+// map of service name with session id and session handle
+typedef std::map<ServiceName, SessionToEventInfo > ServiceSessionHandleTable;
+
+// Defer'ed queue
+// When a pop is issued this data will be copied to the internal CFrameworkunifiedFrameworkApp struct
+// which will call the FrameworkunifiedDispatchProcess that will process the message as if
+// it was received off the message queue!
+class DeferedMsgInfo {
+ void copy_me(const DeferedMsgInfo &defer) {
+ if (this != &defer) {
+ uiProtocolCmd = defer.uiProtocolCmd;
+ strlcpy(cMsgSrcName, defer.cMsgSrcName, sizeof(cMsgSrcName));
+ std::memcpy(uiMsgRcvBuffer, defer.uiMsgRcvBuffer, MAX_MSGQ_BUFFER);
+ }
+ }
+
+ public:
+ UI_32 uiProtocolCmd; /// <protocol req/ack received
+ CHAR cMsgSrcName[MAX_NAME_SIZE_APP]; /// <name of client/server(application) message queue
+ UI_8 uiMsgRcvBuffer[MAX_MSGQ_BUFFER]; /// <receive buffer for message queue
+
+ DeferedMsgInfo() : uiProtocolCmd(0) {
+ std::memset(uiMsgRcvBuffer, 0, MAX_MSGQ_BUFFER);
+ std::memset(cMsgSrcName, '\0', MAX_NAME_SIZE_APP);
+ }
+
+ DeferedMsgInfo(const DeferedMsgInfo &defer) {
+ copy_me(defer); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ DeferedMsgInfo(UI_32 cmd, PCSTR name, UI_8 buf[MAX_MSGQ_BUFFER]) {
+ DeferedMsgInfo defer;
+
+ defer.uiProtocolCmd = cmd;
+ strlcpy(defer.cMsgSrcName, name, sizeof(defer.cMsgSrcName));
+ std::memcpy(defer.uiMsgRcvBuffer, buf, MAX_MSGQ_BUFFER);
+
+ copy_me(defer);
+ }
+
+ DeferedMsgInfo &operator = (const DeferedMsgInfo &defer) {
+ copy_me(defer);
+
+ return *this;
+ }
+};
+
+typedef struct _ServiceNotificationInfo {
+ CHAR sNotificationName[MAX_SYS_INFO_SIZE];
+ UI_32 uiEventId;
+} ServiceNotificationInfo;
+
+typedef std::vector<ServiceNotificationInfo> NotificationList;
+typedef std::queue<DeferedMsgInfo> DeferedMessageQueue;
+
+typedef struct _LostSessionInfo {
+ std::string sServiceName;
+ SessionId iSessionId;
+} LostSessionInfo;
+
+typedef std::queue<LostSessionInfo> LostSessionQueue;
+
+#ifdef DISPATCHER_PROFILER
+class FrameworkunifiedMsgProfiler;
+#endif
+
+class ResponseData {
+ std::vector<UI_8> rawBuffer;
+
+ public:
+ void set(PVOID src, UI_32 size) {
+ rawBuffer.resize(size);
+ std::memcpy(&rawBuffer[0], src, size);
+ }
+
+ UI_8 *data(void) {
+ return rawBuffer.empty() ? NULL : &rawBuffer[0];
+ }
+
+ void clear(void) {
+ std::vector<UI_8>().swap(rawBuffer);
+ }
+
+ UI_32 size(void) {
+ return static_cast<UI_32>(rawBuffer.size());
+ }
+};
+
+
+// framework container
+typedef struct _CFrameworkunifiedFrameworkApp {
+ CHAR cAppName[MAX_NAME_SIZE_APP]; /// <application(client/service) name
+ UI_32 checkCode; /// <check code
+ pthread_t self;
+
+ // message receive information
+ HANDLE hAppRcvMsgQ; /// <handle to apps receive message queue
+ HANDLE hAppSndMsgQ; /// <handle to apps send message queue
+ UI_32 uiMsgLength; /// <length of data in message queue
+ UI_32 uiProtocolCmd; /// <protocol req/ack received
+ UI_32 uiSessionId;
+ CHAR cSystemInfo[MAX_SYS_INFO_SIZE];
+ CHAR cMsgSrcName[MAX_NAME_SIZE_APP]; /// <name of client/server(application) message queue
+ UI_8 uiMsgRcvBuffer[MAX_MSGQ_BUFFER]; /// <receive buffer for message queue
+ int efd; /// <FD for multiple wait generated by the epoll_create()
+ int defer_evfd; /// <FD for receiving Defer events to Dispatcher
+
+ Services services; /// <services <map>
+ ServiceSendMsgHandle servicesHandle; /// <serviceHandle <map>
+ NotificationTable notifications; /// <notification <map>
+ FdTable fds; /// <fdTable <map>
+
+ InvokeResponseQTable invokeResQTable;
+
+ AcceptMonitorTable acceptMonitorTable;
+ ConnectMonitorTable connectMonitorTable;
+ LostSessionQueue lostSessionQueue;
+ CallbackFunctionPtr lostSessionHandler;
+
+ EventServices eventservices;
+ NotificationEventTable notificationevents;
+
+ AppData appdata;
+
+ // Defer'ed Message Queue
+ DeferedMessageQueue deferedMsgQueue; /// <defer'ed message <queue>
+ BOOL fPopDeferedMsg;
+
+ HANDLE hNPSndMsgQ; /// <send msgq handle to NPService
+
+ // application & framework errors
+ EFrameworkunifiedStatus eLastFrameworkError; /// <Framework internal errors
+ EFrameworkunifiedStatus eLastAppError; /// <application(client/server/child thread) reported errors
+
+ /////////////////////////////////////////
+ void *FrameworkData;
+ HANDLE hParentSndMsgQ;
+ CHAR cParentAppName[MAX_NAME_SIZE_APP]; /// <application(client/service) name
+ /////////////////////////////////////////
+
+ HANDLE hConfigFileHandle;
+
+ class CFrameworkunifiedHSMFramework *m_pFrameworkunifiedStateMachine;
+
+ ServiceSessionTable sessiontable;
+ NotificationList servicenotificationlist;
+ CHAR sServiceAvailabilityNotification[MAX_SYS_INFO_SIZE];
+ BOOL bIsAvailable;
+
+ ServiceSessionHandleTable servicesessionhandletable;
+
+ void *pRsrcMgr;
+
+ // framework state information
+ // TODO(framework_unified): consider this for future
+
+ // Current user
+ HANDLE hUser;
+
+ // table holding list of all the events of service and its subscribers
+ EventTable eventtable;
+
+ // table holding list of all the public events of service and the event data corresponding to it
+ PublicStateEventTable publicstateeventtable;
+
+ // table holding list of all the private events of service and
+ // the event data corresponding to each of the subscribed session of its subscribers
+ PrivateStateEventTable privatestateeventtable;
+
+ ResponseData responsedata;
+
+ UI_64 total_occupy_time;
+ UI_64 total_run_count;
+ UI_32 max_occupy_time;
+
+ SI_32 siMonitorSock;
+
+ BOOL fDeferredSyncResponse;
+
+#ifdef DISPATCHER_PROFILER
+ // Profiler object. This is required per dispatcher
+ FrameworkunifiedMsgProfiler *m_pFrameworkunifiedMsgProfiler;
+#endif
+} CFrameworkunifiedFrameworkApp;
+
+// Structure containing the synchronization data
+struct SFrameworkunifiedSyncDataPacket {
+ PVOID m_pNotificationData; // Data published with the notification
+ UI_32 m_uiDataSize; // Size of the data published with the notification
+ time_t m_tTimeStamp; // Time when the notification was recently published
+};
+
+struct PCData {
+ PCData(pthread_barrier_t *bar, EFrameworkunifiedStatus *status, PCSTR parent, PCSTR child, CbFuncPtr init, CbFuncPtr shdn,
+ EFrameworkunifiedSchedPolicy policy, SI_32 priority, CbFuncPtr CreateHSM = NULL)
+ : barrier(bar),
+ childStatus(status),
+ parentName(parent),
+ childName(child),
+ initFn(init),
+ shdnFn(shdn),
+ schedPolicy(policy),
+ schedPriority(priority),
+ CbCreateStateMachine(CreateHSM) { // LCOV_EXCL_BR_LINE 11:except branch
+ }
+
+ pthread_barrier_t *barrier;
+ EFrameworkunifiedStatus *childStatus;
+ const ServiceName parentName;
+ const ServiceName childName;
+ CbFuncPtr initFn;
+ CbFuncPtr shdnFn;
+ EFrameworkunifiedSchedPolicy schedPolicy;
+ SI_32 schedPriority;
+ CbFuncPtr CbCreateStateMachine;
+};
+
+#define APP_CHECK_CODE (0xAC1D5EED)
+
+static inline BOOL frameworkunifiedCheckValidAppHandle(HANDLE hApp) {
+ static __thread int detect_once = 0;
+ if (NULL != hApp) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+ /**
+ * @todo
+ * eFrameworkunifiedStatusOK is returned even if a appHandle created in another thread is passed,
+ * and the specifications and operations differ.
+ * @todo
+ * If an application handle is specified in place of a session handle,
+ * the element is accessed illegally without type checking,
+ * and a DeathTest occurs because the thread_self check is violated.
+ * @todo
+ * If you specify an app handle for a child thread,
+ * the NULL's return value is not terminated abnormally at the intended point (frameworkunifiedCheckValidAppHandle).
+ */
+ if (pApp->self != pthread_self() && detect_once == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __func__, "Invalid thread context detect(hApp):%#lx:%#lx", pApp->self, pthread_self());
+ detect_once = 1;
+ }
+ if (pApp->checkCode == APP_CHECK_CODE) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSubscribeToNotification
+/// API to send message to Notification Service to add to subscription list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSubscribeToNotification(HANDLE hApp, PCSTR pNotification);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSubscribeToNotifications
+/// API to send message to Notification Service to add multiple subscriptions list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pList
+/// FrameworkunifiedNotificationCallbackHandler - Name of Notification
+/// \param [in] uiListLength
+/// UI_32 - number of notification that your subscribing too.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSubscribeToNotifications(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pList, UI_32 uiListLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPUnsubscribeFromNotification
+/// API to send message to Notification Service to remove from subscription list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnsubscribeFromNotification(HANDLE hApp, PCSTR pNotification);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPUnsubscribeFromNotifications
+/// API to send message to Notification Service to remove multiple notification from subscription list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pList
+/// FrameworkunifiedNotificationCallbackHandler - notifications list
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnsubscribeFromNotifications(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pList,
+ UI_32 uiListLength);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMSubscribeToNotificationsEvents
+/// API to send message to Notification Service to add multiple subscriptions list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pList
+/// FrameworkunifiedNotificationEvent - list of notification events
+/// \param [in] uiListLength
+/// UI_32 - number of notification that your subscribing too.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMSubscribeToNotificationsEvents(HANDLE hApp, const FrameworkunifiedNotificationEvent *pList,
+ UI_32 uiListLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMSubscribeToNotificationEvent
+/// API to send message to Notification Service to add to subscription list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMSubscribeToNotificationEvent(HANDLE hApp, PCSTR pNotification);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnsubscribeFromNotificationEvent
+/// API to send message to Notification Service to remove from subscription list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnsubscribeFromNotificationEvent(HANDLE hApp, PCSTR pNotification);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnsubscribeFromNotificationEvents
+/// API to send message to Notification Service to remove multiple subscriptions list for
+/// that notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pList
+/// FrameworkunifiedNotificationEvent - list of notification events
+/// \param [in] uiListLength
+/// UI_32 - number of notification that your subscribing too.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnsubscribeFromNotificationEvents(HANDLE hApp, const FrameworkunifiedNotificationEvent *pList,
+ UI_32 uiListLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateDispatcher
+///
+/// \param [in] cAppName
+/// PCSTR - Application name
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocol(HANDLE hApp);
+
+EFrameworkunifiedStatus frameworkunifiedAddConnectMonitor(HANDLE hApp, PCSTR serverName, PCSTR clientName);
+EFrameworkunifiedStatus frameworkunifiedDelConnectMonitorPre(int efd, PCSTR serverName, PCSTR clientName);
+EFrameworkunifiedStatus frameworkunifiedDelConnectMonitor(HANDLE hApp, PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateDispatcher
+///
+/// \param [in] cAppName
+/// PCSTR - Application name
+/// \param [out] hApp
+/// HANDLE& - Reference of application handle
+/// \param [in] bIsChildThread
+/// BOOL - child thread
+///
+/// \return status
+/// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if success
+/// eFrameworkunifiedStatusFail if invalid app name
+/// eFrameworkunifiedStatusNullPointer if unable to open message Q handle
+/// or possible errors from call FrameworkunifiedAttachSystemCallbacksDispatcher/
+/// FrameworkunifiedAttachLoggerCallbacksDispatcher/
+/// FrameworkunifiedAttachVersionCallbacksDispatcher
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateDispatcher(PCSTR cAppName, HANDLE &hApp, BOOL bIsChildThread = FALSE); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// RunDispatcher
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RunDispatcher(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// RunChildDispatcher
+/// Dispatcher for child thread. Only difference with \ref RunDispatcher is, child dispatcher
+/// exits when non eFrameworkunifiedStatusOK value by callback function is returned.
+/// Whereas, \ref RunDispatcher is not supposed to exit.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RunChildDispatcher(HANDLE hChildApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsValidWaitBarrier
+///
+/// \param [in] wbret
+/// int - barrier
+///
+/// \return bool
+/// valid or invalid
+////////////////////////////////////////////////////////////////////////////////////////////
+bool IsValidWaitBarrier(int wbret);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// setChildThreadSched
+///
+/// \param [in] policy
+/// EFrameworkunifiedSchedPolicy - scheduling policy
+/// \param [in] priority
+/// SI_32 - scheduling priority
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus setChildThreadSched(EFrameworkunifiedSchedPolicy policy, SI_32 priority);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateChildThread
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] childName
+/// PCSTR - Name of child thread to be created
+/// \param [in] CbInitialize
+/// CbFuncPtr - Initialize function.
+/// \param [in] CbShutdown
+/// CbFuncPtr - Shutdown function.
+/// \param [in] attr
+/// const FrameworkunifiedChildThreadAttr * - child thread attribute
+/// \param [in] CbCreateStateMachine
+/// CbFuncPtr - Function pointer to create state machine, in case of SM child thread, else NULL
+///
+/// \return HANDLE
+/// Non-null value if thread is created else NULL
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE CreateChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize, CbFuncPtr CbShutdown,
+ const FrameworkunifiedChildThreadAttr *attr, CbFuncPtr CbCreateStateMachine);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Child thread attribute initialize
+///
+/// \param [out] attr
+/// FrameworkunifiedChildThreadAttr - Child thread attribute
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateChildThreadAttrInit(FrameworkunifiedChildThreadAttr *attr);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Child thread attribute set schedule policy & priority
+///
+/// \param [out] attr
+/// FrameworkunifiedChildThreadAttr - Child thread attribute
+/// \param [int] policy
+/// EFrameworkunifiedSchedPolicy - Child thread scheduling policy
+/// \param [in] priority
+/// SI_32 - Child thread scheduling priority
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateChildThreadAttrSetSched(FrameworkunifiedChildThreadAttr *attr, EFrameworkunifiedSchedPolicy policy, SI_32 priority);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// DestroyThread
+// Sends eFrameworkunifiedStatusExit status to exits the dispatcher loop to terminate the thread.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DestroyThread(HANDLE hApp);
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_CORE_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_error_internal.hpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_error_internal.hpp
new file mode 100755
index 0000000..8599fb2
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_error_internal.hpp
@@ -0,0 +1,43 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief This file provides framework's API which are used by system services.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_INTERNAL_HPP_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_INTERNAL_HPP_
+
+#include <stdexcept>
+#include <native_service/frameworkunified_types.h>
+
+namespace frameworkunified {
+namespace framework {
+namespace error {
+
+class CSystemError : public std::runtime_error {
+ public:
+ explicit CSystemError(EFrameworkunifiedSystemError error, PCSTR errorMsg);
+ const EFrameworkunifiedSystemError m_eSystemError;
+};
+}
+}
+}
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_INTERNAL_HPP_
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_internal.h
new file mode 100755
index 0000000..4d38828
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_internal.h
@@ -0,0 +1,675 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Internal functions of the application framework.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_INTERNAL_H_
+
+#include <native_service/ns_shared_mem_if.h>
+#include <native_service/frameworkunified_types.h>
+#include "frameworkunified_framework_core.h"
+#define PASA_APPCONFIG_FILES "PASA_APPCONFIG_FILES"
+
+#define FRAMEWORKUNIFIEDLOG_CUT(zone, funcname, print_fmt, args...)
+
+//////////////////////////////////////////////////
+// dispatcher internal functions
+//////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachSystemCallbacksDispatcher
+/// All system defined callbacks will be attached to the dispatcher
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework.
+///
+/// \return eStatus
+/// EFrameworkunifiedStatus - success or error
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachSystemCallbacksDispatcher(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendSystemErrMessage
+/// This API is used to send application's critical error message to system manager.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework.
+/// \param [in] eSystemError
+/// EFrameworkunifiedSystemError - System error type
+///
+/// \return EFrameworkunifiedStatus - success or error
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendSystemErrMessage(HANDLE hApp, EFrameworkunifiedSystemError eSystemError);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateDispatcher
+/// Creates and initializes an applications/threads dispatcher.
+///
+/// \param [in] cAppname
+/// PCSTR - Application/ thread name
+/// \param [out] hApp
+/// HANDLE& - Reference of application handle
+/// \param [in] bIsChildThread
+/// BOOL - child thread
+///
+/// \return status
+/// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if Success
+/// possible errors from call CreateDispatcher
+///
+/// \see FrameworkunifiedDispatchBlock,
+/// FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcher(PCSTR cAppName, HANDLE &hApp, BOOL bIsChildThread); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateHSMDispatcher
+/// Creates and initializes an applications/threads hsm dispatcher.
+///
+/// \param [in] cAppname
+/// PCSTR - Application/ thread name
+/// \param [out] hApp
+/// HANDLE& - Reference of application handle
+/// \param [in] bIsThread
+/// BOOL - child thread
+/// \param [in] f_pFrameworkunifiedHSM
+/// CFrameworkunifiedHSMFramework* - statemachine instances
+///
+/// \return status
+/// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if Success
+/// possible errors from call CreateDispatcher
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateHSMDispatcher(PCSTR cAppName,
+ HANDLE &hApp, // NOLINT (readability/nolint)
+ BOOL bIsThread,
+ CFrameworkunifiedHSMFramework *f_pFrameworkunifiedHSM = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDispatchBlock
+/// Blocked until the dipatcher receives a notification of a service request or ack.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus -Success or error
+///
+/// \see FrameworkunifiedCreateDispatcher,
+/// FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatchBlock(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// frameworkunifiedFdHandler
+/// FD POLLIN blocked & process.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] efd
+/// int - epoll FD
+///
+/// \return status
+/// EFrameworkunifiedStatus -Success or error
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchProcess, FrameworkunifiedDispatchBlock,
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus frameworkunifiedFdHandler(HANDLE hApp , int efd);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDispatchProcess
+/// Processes the Service/system request or notification.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus -Success or error
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
+/// FrameworkunifiedCloseDispatcher,
+///
+/// \details
+/// \code
+/// Pseudo code:
+/// IF message_source != Notification Service
+/// FIND source_name
+/// IF source_name available
+/// FIND protocol_cmd
+/// IF protocol_cmd available
+/// execute callback
+/// ELSE
+/// ignore
+/// END
+/// ELSE
+/// ignore
+/// END
+/// ELSE // notification
+/// FIND notification_callback
+/// IF available
+/// execute callback
+/// END
+/// \endcode
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatchProcess(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCloseDispatcher
+/// Closing the dispatcher
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus -Success or error
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
+/// FrameworkunifiedDispatchProcess.
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseDispatcher(HANDLE hApp);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPopedDeferedMessage
+/// Checks the Defer'ed Message Queue should be pop'ed off
+/// the front of the queue!
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// BOOL - TRUE (a message has been pop'ed of the defer'ed msg queue)
+/// FALSE (no msg was pop'ed of the defer'ed msg queue)
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
+/// FrameworkunifiedDispatchProcess.
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedPopedDeferedMessage(HANDLE hApp);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDispatcherMain
+/// Main processing loop that is shared between FrameworkunifiedDispacther and FrameworkunifiedDispatcherWithCmdLnArguments.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// BOOL - TRUE (a message has been pop'ed of the defer'ed msg queue)
+/// FALSE (no msg was pop'ed of the defer'ed msg queue)
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
+/// FrameworkunifiedDispatchProcess.
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatcherMain(HANDLE hApp);
+
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherMain(HANDLE hApp);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDispatcherMain
+/// Main processing loop that is shared between FrameworkunifiedDispacther and FrameworkunifiedDispatcherWithCmdLnArguments.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// BOOL - TRUE (a message has been pop'ed of the defer'ed msg queue)
+/// FALSE (no msg was pop'ed of the defer'ed msg queue)
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
+/// FrameworkunifiedDispatchProcess.
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedArgumentParser(HANDLE hApp, int argc, char *argv[], CustomCommandLineOptions *cmdLineOptions);
+
+
+EFrameworkunifiedStatus FrameworkunifiedOnInitializationInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnDestroyInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnStartInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnStopInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnPreStartInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnPreStopInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStartInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStopInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDumpInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachineInternal(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterfaceInternal(HANDLE hApp);
+EFrameworkunifiedStatus RegistDefaultCbHandler(const FrameworkunifiedDefaultCallbackHandler *CbHandler);
+
+
+//////////////////////////////////////////////////
+// message center internal functions
+//////////////////////////////////////////////////
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// frameworkunifiedGetIsTypeOfSync
+/// Gets if message type is sync, return TRUE. or not return FALSE
+///
+/// \param [in] hApp
+/// HANDLE - Handle to a Application Framework
+///
+/// \return status
+/// BOOL - TRUE or FALSE
+///
+/// \see FrameworkunifiedInvokeSync, frameworkunifiedSendSyncResponse
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL frameworkunifiedGetIsTypeOfSync(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendSyncResponse
+/// Send Sync Response to the hApp.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the dispatcher to receive message
+/// \param [in] seq_id
+/// UI_32 - Sync sequence ID
+/// \param [in] retValue
+/// EFrameworkunifiedStatus - Return Status
+/// \param [in] length
+/// UI_32 - Length of the data to be receive response.
+/// \param [in] data
+/// PVOID - Pointer to the response data.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedInvokeSync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus frameworkunifiedSendSyncResponse(HANDLE hApp, UI_32 iCmd, UI_32 seq_id, EFrameworkunifiedStatus retValue, UI_32 length, PCVOID data);
+
+//////////////////////////////////////////////////
+// logger internal functions
+//////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachLoggerCallbacksDispatcher(HANDLE hApp);
+
+#ifdef DISPATCHER_PROFILER
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachMsgProfilerCallbacksDispatcher
+/// This function attaches callback function for profiler protocol for main thread.
+/// Protocol is attached considering the source as "nsprofilerutil"
+///
+/// \param [in] hApp
+/// HANDLE - Handle to a Application Framework
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachMsgProfilerCallbacksDispatcher(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachMsgProfilerCallbacksDispatcher
+/// This function attaches callback function for profiler protocol for child threads.
+/// Protocol is attached considering the source as parent thread
+///
+/// \param [in] hApp
+/// HANDLE - Handle to a Application Framework
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachChildMsgProfilerCallbacksDispatcher(HANDLE hApp);
+#endif
+
+EFrameworkunifiedStatus FrameworkunifiedSetLogMask(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedGetLogMask(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedSetOutputLogOpts(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedGetOutputLogOpts(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedSetLogSeverity(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedGetLogSeverity(HANDLE hApp);
+EFrameworkunifiedStatus FrameworkunifiedDebugDumpRequest(HANDLE hApp);
+
+EFrameworkunifiedStatus NSRcsSetLogSettings(HANDLE hApp);
+EFrameworkunifiedStatus NSRcsGetLogSettings(HANDLE hApp);
+EFrameworkunifiedStatus NSRcsSetLogMask(HANDLE hApp);
+EFrameworkunifiedStatus NSRcsSetOutputLogOpts(HANDLE hApp);
+EFrameworkunifiedStatus NSRcsSetLogSeverity(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetConfigHandle
+/// This Function opens the configuration file from given path and sets the file handle in hApp
+///
+/// \param [in] cAppname
+/// HANDLE - Application handle
+/// \param [in] sFilePath
+/// PCHAR - File path of the config file
+///
+/// \return status of the operation
+///
+/// \see SetDefaultFilePath,
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetConfigHandle(HANDLE hApp, PCHAR sFilePath);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetDefaultFilePath
+/// This Function fetches the default config path, opens the configuration file and sets the file
+/// handle in the application
+///
+/// \param [in] cAppname
+/// HANDLE - Application handle
+/// \param [in] sFilePath
+/// PCHAR - File path of the config file
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetDefaultConfigFile(HANDLE hApp);
+
+EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocolHSMEvent(HANDLE hApp, PCSTR pRequester);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ProcessProtocolEvents
+/// This Function registers the events of server with the client.
+/// If the event is published previously and is a state event then send the event data to the client.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus ProcessProtocolEvents(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ProcessPrivateEvents
+/// This Function registers the events of server with the client.
+/// If the event is published previously and is a state event then send the event data to the client.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus ProcessPrivateEvents(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CleanAllEventsOfSession
+/// This Function closes the session handle and removes its entry from the table of
+/// ServiceSessionHandleTable of application framework handle.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] serviceName
+/// PCSTR - Name of a service
+/// \param [in] sessionId
+/// UI_32 - Session id
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CleanAllEventsOfSession(HANDLE hApp, PCSTR serviceName, UI_32 sessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveEntryFromSessionEventInfoTable
+/// This Function removes the entry of event id from the session table based on the service
+/// name and session id.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] serviceName
+/// PCSTR - Name of service
+/// \param [in] sessionId
+/// UI_32 - Session id
+/// \param [in] eventId
+/// UI_32 - Event id which needs to be removed from internal table
+///
+/// \return eFrameworkunifiedStatusOK- Success, or eFrameworkunifiedStatusFail
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RemoveEntryFromSessionEventInfoTable(HANDLE hApp, PCSTR serviceName, UI_32 sessionId, UI_32 eventId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// HandleSessionEventOnCloseSession
+/// This Function does the handling of session events on close session request
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus HandleSessionEventOnCloseSession(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// UnregisterPrivateEvents
+/// This Function unregisters the private event.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \return status of the operation
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus UnregisterPrivateEvents(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetMsgQueueHandle
+/// Gets the message queue handle from servicesessionhandletable map.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] serviceName
+/// PCSTR - Service name of receiver
+/// \param [in] uiSessionId
+/// UI_32 - session id
+///
+/// \return Message queue handle
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE GetMsgQueueHandle(HANDLE hApp, PCSTR serviceName, const UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetNewMsgQueueHandle
+/// This function creates and returns the message queue handle.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] serviceName
+/// PCSTR - Service name of receiver
+/// \param [in] uiSessionId
+/// UI_32 - session id
+/// \param [in] uiEventId
+/// const UI_32 - event id
+///
+/// \return Message queue handle
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE GetNewHandleAndUpdateEventInfoTable(HANDLE hApp, PCSTR serviceName, const UI_32 uiSessionId,
+ const UI_32 uiEventId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsEventAlreadyRegistered
+/// Searches for the session id in the vector
+///
+/// \param [in] vSessionIdList
+/// SessionIdList - list of sessions id's
+/// \param [in] uiSessionId
+/// UI_32 - session id
+///
+/// \return true or false
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL IsEventAlreadyRegistered(const SessionIdList &vSessionIdList, const UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveEventEntryFromEventTable
+/// This Function removes the entry of event for received service on the active session id
+/// from Event Table.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] uiEventId
+/// UI_32 - event id
+/// \param [in] serviceName
+/// PCSTR - Service name of receiver
+/// \param [in] uiSessionId
+/// UI_32 - session id
+///
+/// \return success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RemoveEventEntryFromEventTable(HANDLE hApp, UI_32 uiEventId, PCSTR cServiceName, const UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendEventMessage
+/// This function sends the private event message to all the sessions of service registered
+/// for event.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] vSessionIdList
+/// SessionIdList - session id list
+/// \param [in] uiEventId
+/// UI_32 - event id
+/// \param [in] cServiceName
+/// PCSTR - Service name of receiver
+/// \param [in] pData
+/// PCVOID - data to send
+/// \param [in] uiLength
+/// UI_32 - length of data
+///
+/// \return success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendEventMessage(HANDLE hApp, const SessionIdList &vSessionIdList, UI_32 uiEventId, PCSTR cServiceName,
+ PCVOID pData, UI_32 uiLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdatePublicStateEventData
+/// This API updates the event data of public state event for all the session of
+/// all subscribed clients.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] uiEventId
+/// UI_32 - event id
+/// \param [in] pData
+/// PCVOID - data to send
+/// \param [in] uiLength
+/// UI_32 - length of data
+///
+/// \return success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus UpdatePublicStateEventData(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdatePrivateStateEventData
+/// This API updates the event data of private state event for session with
+/// session id uiSessionId of client pClientName.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] uiEventId
+/// UI_32 - event id
+/// \param [in] pClientName
+/// PCSTR - Event Subscriber name
+/// \param [in] uiSessionId
+/// UI_32 - session id
+/// \param [in] pData
+/// PCVOID - data to send
+/// \param [in] uiLength
+/// UI_32 - length of data
+///
+/// \return success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus UpdatePrivateStateEventData(HANDLE hApp, UI_32 uiEventId, PCSTR pClientName, UI_32 uiSessionId, PCVOID pData,
+ UI_32 uiLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// DeleteSessionEventData
+/// This function is called while destroying the session with client.
+/// This method removes the private event data associated with the session.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pClientName
+/// PCSTR - Event Subscriber name
+/// \param [in] uiSessionId
+/// UI_32 - session id
+///
+/// \return success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DeleteSessionEventData(HANDLE hApp, PCSTR pClientName, UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetDataUSID
+/// Gets the shared memory ID
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// UI_32 - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+TMemID FrameworkunifiedGetDataUSID(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedIsAutoPublishServiceAvailableEnabled
+/// This function is used to check whether auto publishing of service availability is
+/// enabled or not.
+///
+/// \param None
+///
+/// \return BOOL
+/// BOOL - true if auto publish is enabled for service else false
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsAutoPublishServiceAvailableEnabled();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedIsWaitInStoppingStateEnabled
+/// Check if wait in stopping state is enabled.
+///
+/// \param [in] none
+///
+/// \return BOOL - TRUE if enabled or FALSE
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsWaitInStoppingStateEnabled();
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_INTERNAL_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_utility.h b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_utility.h
new file mode 100755
index 0000000..b78297e
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_utility.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_UTILITY_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_UTILITY_H_
+
+#include <native_service/ns_utility.hpp>
+#include "frameworkunified_framework_internal.h"
+
+DEFINE_EXCEPTION(happ_error, std::runtime_error);
+
+class HAppTraits {
+ public:
+ typedef HANDLE Type;
+ typedef happ_error Exception;
+ static void Release(Type rsrc) {
+ FrameworkunifiedOnDestroyInternal(rsrc);
+ FrameworkunifiedCloseDispatcher(rsrc);
+ }
+
+ static BOOL BadValue(Type rsrc) {
+ return NULL == rsrc;
+ }
+};
+
+typedef ResourceMgr< HANDLE, HAppTraits > THApp;
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_UTILITY_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_msgprofiler.h b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_msgprofiler.h
new file mode 100755
index 0000000..f512e76
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_msgprofiler.h
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief File declares FrameworkunifiedMsgProfiler class which keeps profiler information for message dispatcher
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_MSGPROFILER_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_MSGPROFILER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <vector>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// Profiler class which keeps and manage profiler information for message dispatcher
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class FrameworkunifiedMsgProfiler {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedMsgProfiler
+ /// Parameterized constructor
+ /// \param [in] f_cAppName
+ /// const std::string& - Name of the application or dispatcher
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ explicit FrameworkunifiedMsgProfiler(const std::string &f_cAppName);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~FrameworkunifiedMsgProfiler
+ /// Class destructor
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ~FrameworkunifiedMsgProfiler();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// GetAppName
+ /// Returns application name corresponding to profiler
+ ///
+ /// \param [in] none
+ ///
+ /// \return std::string
+ /// std::string - Returns application name corresponding to profiler
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetAppName();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// AddChildName
+ /// Returns application name corresponding to profiler
+ ///
+ /// \param [in] f_cChildName
+ /// const std::string& - Add the name of child dispatcher profiler
+ ///
+ /// \return none
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID AddChildName(const std::string &f_cChildName);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// MsgReceived
+ /// Updates the profiler information once the message is received.
+ /// e.g. increaments msg count, save the time of msg received
+ ///
+ /// \param [in] none
+ ///
+ /// \return none
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID MsgReceived();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// MsgProcessed
+ /// Updates the profiler information once the message is processed.
+ /// e.g. Updates the frequency of execution of message
+ ///
+ /// \param [in] none
+ ///
+ /// \return none
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID MsgProcessed();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintProfileInfo
+ /// All the profiler information which FrameworkunifiedMsgProfiler class has prints it in message
+ /// queue FRAMEWORKUNIFIED_NS_MSGPROFILERUTIL
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Application framework handle
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PrintProfileInfo(HANDLE f_hApp);
+
+ static BOOL m_bMsgProfilerEnabled; /// Flag is enabled when command line argument -q is passed.
+ /// Otherwise no profiler information is maintained.
+
+ private:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// GetClock
+ /// GetClock of milliseconds
+ ///
+ /// \param [in] none
+ ///
+ /// \return UI_64
+ /// UI_64 - returns time in Milliseconds
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ UI_64 GetClock();
+
+ std::vector<std::string> m_vChildNames; /// vector to save list of all child threads dispatcher
+ std::string m_cAppName; /// Dispacther application name
+ UI_32 m_ui32TotalNoOfMsgsReceived; /// Total number of messages received by the dispatcher
+
+ // NOTE: Storing time in ClockCycle. So that it will not add overhead for converting it to miliseconds.
+ // It will get converted only when information is required to print.
+ UI_64 m_ui64MinMsgProcessingTime; // time is in clock cycles
+ UI_64 m_ui64MaxMsgProcessingTime; // time is in clock cycles
+
+ UI_64 m_ui64TotalMsgExecutionTime; /// total time spent in message execution
+ UI_64 m_ui64LastMsgReceivedTime; /// save the time when last message was received
+ UI_64 m_ui64AppInitTime; /// save the time when application got initialized
+ BOOL m_bLastMsgWasPrintProfile; /// TRUE if the last message received
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_MSGPROFILER_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_finalstate.h b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_finalstate.h
new file mode 100755
index 0000000..20ed3f6
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_finalstate.h
@@ -0,0 +1,97 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedFinalState class definitions. CFrameworkunifiedFinalState is derived from
+/// CFrameworkunifiedState class.This class implements the additional functionality supported by HSM Final
+/// state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FINALSTATE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FINALSTATE_H_
+
+
+#include <native_service/frameworkunified_sm_state.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM Final state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedFinalState : public CFrameworkunifiedState {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedFinalState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedFinalState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedFinalState
+ /// Class destructor
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedFinalState();
+
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateHistory
+ /// This function stores the last active state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UpdateHistory();
+
+ protected :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEntry
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnExit
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FINALSTATE_H_
+// @}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h
new file mode 100755
index 0000000..ea564df
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_framework_core.h
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This File has public Macro definition that simplifies the statemachine implementation
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_
+/// Include files
+#include <native_service/frameworkunified_framework_types.h>
+#include <vector>
+#include <utility>
+
+/// connect child state to parent state and sets it as default state
+#define CONNECT_DEFAULTSTATE(parent, child) \
+ FrameworkunifiedConnect(l_p## parent, l_p## child, TRUE);
+
+/// connect child state to parent state
+#define CONNECT_STATE(parent, child) \
+ FrameworkunifiedConnect(l_p## parent, l_p## child);
+
+/// connect the deferred event and reactions and associate them with the state
+#define CONNECT_DEFERREDEVENT(state, eventid) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, NULL, #eventid, TRUE); \
+
+/// connect the event and reactions and associate them with the state
+#define CONNECT_EVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid);
+
+/// connect the event and reactions and associate them with the state
+#define CONNECT_LOCAL_EVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pLocalTrn## reaction, #eventid);
+
+/// Sets the state as root state in the statemachine
+#define CONNECTROOT(state) \
+ FrameworkunifiedConnect(l_p## state);
+
+/// Creates the state
+#define CREATE_STATE(class_name) \
+ CHKNULL(m_pFrameworkunifiedStateList) \
+ C## class_name *l_p## class_name = new C## class_name(#class_name); \
+ CHKNULL(l_p## class_name) \
+ m_pFrameworkunifiedStateList->insert(std::pair<UI_32, CFrameworkunifiedState*>(e## class_name, l_p## class_name));
+
+// create a new shallow history state and add it in parent state
+#define ADD_SHALLOWHISTORYSTATE(parent) \
+ CFrameworkunifiedShallowHistoryState *l_p##parent##SHALLOWHISTORYSTATE = new CFrameworkunifiedShallowHistoryState(SHALLOWHISTORYSTATE);\
+ FrameworkunifiedConnect(l_p## parent, l_p##parent##SHALLOWHISTORYSTATE);\
+ l_p##parent##SHALLOWHISTORYSTATE->SetDefaultHistory();
+
+// create a new shallow history state and add it in parent state
+#define ADD_DEEPHISTORYSTATE(parent) \
+ CFrameworkunifiedDeepHistoryState *l_p##parent##DEEPHISTORYSTATE = new CFrameworkunifiedDeepHistoryState(DEEPHISTORYSTATE);\
+ FrameworkunifiedConnect(l_p## parent, l_p##parent##DEEPHISTORYSTATE);\
+ l_p##parent##DEEPHISTORYSTATE->SetDefaultHistory();
+
+/// connect deep history event to reaction and add to state
+#define CONNECT_DEEPHISTORYEVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##DEEPHISTORYSTATE, #eventid);
+
+/// connect shallow history event to reaction and add to state
+#define CONNECT_SHALLOWHISTORYEVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##SHALLOWHISTORYSTATE, #eventid);
+
+typedef struct _HSMConfigOptions {
+ EUserChangeOptions eUserChange;
+ BOOL bAutoPublishServiceAvaialble;
+ BOOL bWaitInStoppingState;
+} HSMConfigOptions;
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_CORE_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_multithreading_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_multithreading_internal.h
new file mode 100755
index 0000000..ff67029
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/include/statemachine/frameworkunified_sm_multithreading_internal.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Internal functions related to state machine child threads
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_INTERNAL_H_
+
+void *child_hsm_thread_proc(void *args);
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_INTERNAL_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_dispatcher.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_dispatcher.cpp
new file mode 100755
index 0000000..250edce
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_dispatcher.cpp
@@ -0,0 +1,2382 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/epoll.h>
+#include <sys/eventfd.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <fcntl.h>
+#include <pthread.h>
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_framework_sync.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/ns_resource_controler.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <other_service/strlcpy.h>
+
+#include <string>
+#include <utility>
+#include <map>
+
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+#include "ns_message_center_internal.h"
+#include "ns_mc_internal.h"
+#include "frameworkunified_framework_error_internal.hpp"
+#include "frameworkunified_framework_utility.h"
+#include "frameworkunified_sm_framework_core.h"
+
+#ifdef DISPATCHER_PROFILER
+#include "frameworkunified_msgprofiler.h"
+#include <boost/bind.hpp>
+#endif
+
+/*
+ * static variable
+ */
+static FrameworkunifiedDefaultCallbackHandler g_defaultCallbackHandler;
+
+//////////////////////////
+// prototype declaration
+//////////////////////////
+static EFrameworkunifiedStatus GetDispatcherMqFD(HANDLE hApp, int *fd);
+static EFrameworkunifiedStatus CreateMultiWaitingFD(HANDLE hApp);
+static EFrameworkunifiedStatus ProcessMq(HANDLE hApp);
+static EFrameworkunifiedStatus ProcessFd(HANDLE hApp , int fd);
+
+//////////////////////////////////////////
+// Function : ostream &operator<<
+//////////////////////////////////////////
+template <typename K, typename V, class C, class A>
+std::ostream &operator<< (std::ostream &os, const std::map<K, V, C, A> &m) {
+ os << "{ ";
+ typename std::map<K, V, C, A>::const_iterator p;
+ for (p = m.begin(); p != m.end(); ++p) {
+ os << p->first << ":" << p->second << ", ";
+ }
+ return os << "}";
+}
+
+EFrameworkunifiedStatus CreateDispatcher(PCSTR cAppName, HANDLE &hApp, BOOL bIsChildThread) { // NOLINT (readability/nolint)
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = new CFrameworkunifiedFrameworkApp; // LCOV_EXCL_BR_LINE 11:except branch
+ if (pApp != NULL) { // LCOV_EXCL_BR_LINE 5:fail safe for new
+ pApp->checkCode = APP_CHECK_CODE;
+ pApp->self = pthread_self();
+ // app name size should not exceed the max length
+ memset(pApp->cAppName, 0, MAX_NAME_SIZE_APP);
+ memset(pApp->sServiceAvailabilityNotification, 0, MAX_SYS_INFO_SIZE);
+ pApp->bIsAvailable = FALSE;
+ /*
+ * todo
+ * Setting NULL for arguments causes an Exception
+ */
+ if (strlen(cAppName) < MAX_NAME_SIZE_APP) {
+ memcpy(pApp->cAppName, cAppName, strlen(cAppName));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error : Aborting ... Exceeds Max App name size MAX_NAME_SIZE_APP : %d ",
+ MAX_NAME_SIZE_APP);
+ /*
+ * Error is set here, but the error is overwritten by the following process
+ */
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, " Application Created ");
+
+ // opening handle to receive message for the application
+ pApp->hAppRcvMsgQ = NULL;
+ if (NULL == (pApp->hAppRcvMsgQ = McOpenReceiver(pApp->cAppName))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Error : Failed to McOpenReceiver ");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ } else {
+ if (strcmp(cAppName, "NS_NPPService") != 0) {
+ McFlushReceiver(pApp->hAppRcvMsgQ);
+ }
+ }
+
+ // opening socket for abnormal monitoring
+ pApp->siMonitorSock = -1;
+ if ((eFrameworkunifiedStatusOK == eStatus) && (-1 == (pApp->siMonitorSock = mcOpenMonitor(pApp->cAppName)))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Error : Failed to mcOpenMonitor ");
+ eStatus = eFrameworkunifiedStatusFail;
+ pApp->siMonitorSock = -1;
+ }
+
+ // opening handle to send messages to itself
+ pApp->hAppSndMsgQ = NULL;
+ if ((eFrameworkunifiedStatusOK == eStatus) && (NULL == (pApp->hAppSndMsgQ = McOpenSender(pApp->cAppName)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Error : Failed to McOpenSender ");
+ // LCOV_EXCL_BR_STOP
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ // opening handles for Notification Persistence Service and Service Directory
+ pApp->hNPSndMsgQ = NULL;
+ if ((eFrameworkunifiedStatusOK == eStatus) &&
+ (NULL == (pApp->hNPSndMsgQ = FrameworkunifiedMcOpenSender(reinterpret_cast<HANDLE>(pApp), FRAMEWORKUNIFIED_NS_NPSERVICE)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error : Failed to FrameworkunifiedMcOpenSender < NS_NPPService >");
+ // LCOV_EXCL_BR_STOP
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ // stores the message queue handle of the parent thread.
+ // It will set after the dispatcher of child thread is created. And will be NULL for main thread.
+ pApp->hParentSndMsgQ = NULL;
+
+ if ((eFrameworkunifiedStatusOK == eStatus) && (!bIsChildThread)) {
+ // Define any system callback's with the dispatcher.
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachSystemCallbacksDispatcher(reinterpret_cast<HANDLE>(pApp)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error :: (%d) Failed to FrameworkunifiedAttachSystemCallbacksDispatcher ", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ // Define the logger callback's for setting up gets and sets with the dispatcher.
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachLoggerCallbacksDispatcher(reinterpret_cast<HANDLE>(pApp)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error :: (%d) Failed to FrameworkunifiedAttachLoggerCallbacksDispatcher ", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ }
+
+ // initialize
+ pApp->m_pFrameworkunifiedStateMachine = NULL;
+ pApp->uiProtocolCmd = 0;
+
+ // Clear the Defer'ed message pop flag.
+ pApp->fPopDeferedMsg = FALSE;
+
+ // Clear the Defer'ed sync response flag.
+ pApp->fDeferredSyncResponse = FALSE;
+
+ // buffer initialize
+ memset(pApp->uiMsgRcvBuffer, 0, MAX_MSGQ_BUFFER);
+ memset(pApp->cMsgSrcName, '\0', MAX_NAME_SIZE_APP);
+ memset(pApp->cSystemInfo, '\0', MAX_SYS_INFO_SIZE);
+
+ pApp->defer_evfd = -1;
+ pApp->efd = -1;
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ eStatus = CreateMultiWaitingFD((HANDLE)pApp);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : CreateMultiWaitingFD Failed, status=%d", eStatus);
+ }
+ }
+
+#ifdef DISPATCHER_PROFILER
+ // Assign default value
+ pApp->m_pFrameworkunifiedMsgProfiler = NULL;
+#endif
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ if (NULL != pApp->hAppRcvMsgQ) {
+ McClose(pApp->hAppRcvMsgQ);
+ pApp->hAppRcvMsgQ = NULL;
+ }
+
+ if (0 < pApp->siMonitorSock) {
+ mcCloseMonitor(pApp->cAppName);
+ pApp->siMonitorSock = -1;
+ }
+
+ if (NULL != pApp->hAppSndMsgQ) {
+ McClose(pApp->hAppSndMsgQ);
+ pApp->hAppSndMsgQ = NULL;
+ }
+
+ if (NULL != pApp->hNPSndMsgQ) {
+ FrameworkunifiedMcClose(pApp->hNPSndMsgQ);
+ pApp->hNPSndMsgQ = NULL;
+ }
+
+ // LCOV_EXCL_BR_START 6:According to line 158, pApp->hParentSndMsgQ is NULL.
+ if (NULL != pApp->hParentSndMsgQ) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6:According to line 158, pApp->hParentSndMsgQ is NULL.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ McClose(pApp->hParentSndMsgQ);
+ pApp->hParentSndMsgQ = NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 < pApp->defer_evfd) {
+ close(pApp->defer_evfd);
+ pApp->defer_evfd = -1;
+ }
+
+ if (0 < pApp->efd) {
+ close(pApp->efd);
+ pApp->efd = -1;
+ }
+
+ delete pApp; // LCOV_EXCL_BR_LINE 11:except branch
+ pApp = NULL;
+ }
+ }
+
+ hApp = pApp;
+
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedCreateDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcher(PCSTR cAppName, HANDLE &hApp, BOOL bIsChildThread) { // NOLINT (readability/nolint)
+ return CreateDispatcher(cAppName, hApp, bIsChildThread);
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedDispatchBlock
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatchBlock(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+// FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "+");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (eFrameworkunifiedStatusOK != (eStatus = McReceiveWithSession(pApp->hAppRcvMsgQ, pApp->cMsgSrcName,
+ &pApp->uiProtocolCmd, &pApp->uiSessionId, MAX_MSGQ_BUFFER,
+ (PVOID)(pApp->uiMsgRcvBuffer)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: (%d) Failed on McReceive", eStatus);
+ // LCOV_EXCL_BR_STOP
+ } else {
+// FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Message received on dispatcher:: Source: %s, Cmd: 0x%X, SessionId: %d ",
+// pApp->cMsgSrcName, pApp->uiProtocolCmd, pApp->uiSessionId);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+// FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "-");
+ return eStatus;
+}
+
+
+EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocolCallback(HANDLE hApp, PCSTR pRequester) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ Services::iterator s_iterator;
+
+ s_iterator = pApp->services.find(pRequester);
+ if (s_iterator != pApp->services.end()) {
+ SessionTable::iterator session_iterator;
+ session_iterator = (s_iterator->second).find(pApp->uiSessionId);
+ if (session_iterator != (s_iterator->second).end()) {
+ // FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, " %s found :: (%s) ", pApp->cMsgSrcName, s_iterator->second);
+
+ // find the protocol req/ack handler
+ ServiceProtocolTable::iterator spt_iterator;
+ spt_iterator = (session_iterator->second).find(pApp->uiProtocolCmd);
+ if (spt_iterator != (session_iterator->second).end()) {
+ // calling the protocol req/ack handler
+ eStatus = (*spt_iterator).second(hApp);
+ } else if ((session_iterator->second).end() != (spt_iterator =
+ (session_iterator->second).find(FRAMEWORKUNIFIED_ANY_COMMAND))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__,
+ "Processing callback function for (FRAMEWORKUNIFIED_ANY_COMMAND). "
+ "Dispatcher protocol command: (0x%x)", pApp->uiProtocolCmd);
+ // LCOV_EXCL_BR_STOP
+ eStatus = (*spt_iterator).second(hApp);
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocol(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // Check if the callback is associated with the Protocol for message source
+ eStatus = FrameworkunifiedProcessServiceProtocolCallback(hApp, const_cast<PCSTR>(pApp->cMsgSrcName));
+
+ if (eFrameworkunifiedStatusMsgNotProcessed == eStatus) {
+ // Check if the callback is associated with the Protocol for FRAMEWORKUNIFIED_ANY_SOURCE
+ eStatus = FrameworkunifiedProcessServiceProtocolCallback(hApp, FRAMEWORKUNIFIED_ANY_SOURCE);
+ if (eFrameworkunifiedStatusMsgNotProcessed == eStatus) {
+ if (pApp->m_pFrameworkunifiedStateMachine) {
+ // Check if the HSM event is associated with the Protocol for message source
+ eStatus = FrameworkunifiedProcessServiceProtocolHSMEvent(hApp, const_cast<PCSTR>(pApp->cMsgSrcName));
+
+ if (eFrameworkunifiedStatusMsgNotProcessed == eStatus) {
+ // Check if the HSM event is associated with the Protocol for FRAMEWORKUNIFIED_ANY_SOURCE
+ eStatus = FrameworkunifiedProcessServiceProtocolHSMEvent(hApp, FRAMEWORKUNIFIED_ANY_SOURCE);
+ }
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+EFrameworkunifiedStatus FrameworkunifiedSetDeferredSyncResponse(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldBuf;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->fDeferredSyncResponse = TRUE;
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ return eStatus;
+}
+
+
+static void frameworkunifiedProcessSyncResponse(HANDLE hApp, EFrameworkunifiedStatus retValue) {
+ EFrameworkunifiedStatus eStatus;
+ CHAR systemInfo[MAX_SYS_INFO_SIZE];
+ UI_32 seq_id;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (frameworkunifiedGetIsTypeOfSync(hApp) == TRUE) {
+ if (pApp->fDeferredSyncResponse == TRUE) {
+ if (pApp->responsedata.size() != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Response data is ignored for "
+ ":: source: %s, Protocol Command: 0x%x, Session Id: %u.",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL,
+ pApp->uiProtocolCmd, pApp->uiSessionId);
+ pApp->responsedata.clear();
+ }
+ } else {
+ FrameworkunifiedGetSystemInfo(hApp, systemInfo);
+ seq_id = (UI_32)strtoul(systemInfo, NULL, 16);
+
+ eStatus = frameworkunifiedSendSyncResponse(hApp, PROTOCOL_FRAMEWORKUNIFIED_ANY_COMMAND, seq_id, retValue, pApp->responsedata.size(),
+ pApp->responsedata.data());
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "retValu:%d errno:%d", eStatus, errno);
+ }
+ pApp->responsedata.clear();
+ }
+ } else {
+ if (pApp->responsedata.size() != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Response data is ignored for :: "
+ "source: %s, Protocol Command: 0x%x, Session Id: %u.",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL,
+ pApp->uiProtocolCmd, pApp->uiSessionId);
+ pApp->responsedata.clear();
+ }
+ }
+ pApp->fDeferredSyncResponse = FALSE;
+}
+
+
+inline static time_t frameworkunifiedTimeval2usec(const struct timeval &time) {
+ return static_cast<time_t>(time.tv_sec * 1000000 + time.tv_usec);
+}
+
+
+static void frameworkunifiedPrintRusage(HANDLE hApp, const struct rusage &start, const struct rusage &end) {
+ UI_32 occupy_time;
+ UI_32 average;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ occupy_time = static_cast<UI_32>(frameworkunifiedTimeval2usec(end.ru_utime) - frameworkunifiedTimeval2usec(start.ru_utime));
+ occupy_time += static_cast<UI_32>(frameworkunifiedTimeval2usec(end.ru_stime) - frameworkunifiedTimeval2usec(start.ru_stime));
+
+ pApp->total_occupy_time += occupy_time;
+ pApp->total_run_count++;
+ average = static_cast<UI_32>(pApp->total_occupy_time / pApp->total_run_count);
+
+ if (occupy_time > pApp->max_occupy_time) {
+ pApp->max_occupy_time = occupy_time;
+ }
+
+// FRAMEWORKUNIFIEDLOG(ZONE_NS_DEBUG_DUMP, __FUNCTION__, "cur:%d.%06d avg:%d.%06d max:%d.%06d",
+// occupy_time / 1000000, occupy_time % 1000000,
+// average / 1000000, average % 1000000,
+// pApp->max_occupy_time / 1000000, pApp->max_occupy_time % 1000000);
+}
+
+
+static inline void frameworkunifiedGetRusage(struct rusage *r) {
+ if (r == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "r is NULL");
+ return;
+ }
+ memset(r, 0, sizeof(struct rusage));
+ if (getrusage(RUSAGE_THREAD, r) == -1) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "getrusage errno:%d", errno);
+ // LCOV_EXCL_BR_STOP
+ }
+}
+
+static int frameworkunifiedPushLostSessionInfo(HANDLE hApp, PCSTR serviceName) {
+ int cntFound = 0;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ ServiceSessionTable::iterator s_iterator = pApp->sessiontable.find(serviceName);
+ if (s_iterator != pApp->sessiontable.end()) {
+ // LCOV_EXCL_BR_START 11:except branch
+ SessionHandleTable::iterator sh_iterator = pApp->sessiontable[serviceName].begin();
+ // LCOV_EXCL_BR_STOP
+ while (sh_iterator != pApp->sessiontable[serviceName].end()) {
+ LostSessionInfo l_info;
+ l_info.sServiceName = serviceName;
+ l_info.iSessionId = sh_iterator->first;
+ pApp->lostSessionQueue.push(l_info);
+ cntFound++;
+ sh_iterator++;
+ }
+ }
+ return cntFound;
+}
+
+///
+/// Abnormal monitor(server): Client socket close handle
+///
+EFrameworkunifiedStatus frameworkunifiedProcessClientAbnormalState(HANDLE hApp, int sockfd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ AcceptMonitorTable::iterator it;
+
+ if ((it = pApp->acceptMonitorTable.find(sockfd)) == pApp->acceptMonitorTable.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid fd", sockfd);
+ } else {
+ char clientName[16];
+ if (mcGetClientNameFromConnectKey((it->second).c_str(), clientName, sizeof(clientName)) < 0) {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Invlid connectKey:%s", (it->second).c_str());
+ // LCOV_EXCL_BR_STOP
+ } else {
+ if (pApp->lostSessionHandler != NULL) {
+ int cntFound = frameworkunifiedPushLostSessionInfo(hApp, clientName);
+ if (cntFound) {
+ // calling lost session handler
+ try {
+ eStatus = pApp->lostSessionHandler(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from: %s", e.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ }
+ }
+ pApp->acceptMonitorTable.erase(sockfd);
+ }
+
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///
+/// Abnormal monitor(server): Add
+///
+EFrameworkunifiedStatus frameworkunifiedAddAcceptMonitor(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ int acceptSock;
+
+ if ((acceptSock = mcGetAcceptMonitor(pApp->cAppName, pApp->cMsgSrcName)) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : mcGetAcceptMonitor srv:%s clnt:%s",
+ pApp->cAppName != 0 ? pApp->cAppName : NULL, pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL);
+ // LCOV_EXCL_BR_STOP
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ char connectKey[32];
+ mcSetConnectKey(connectKey, sizeof(connectKey), pApp->cAppName, pApp->cMsgSrcName);
+ pApp->acceptMonitorTable.insert(std::make_pair(acceptSock, connectKey));
+ }
+
+ return eStatus;
+}
+
+///
+/// Abnormal monitor(server): Del
+///
+EFrameworkunifiedStatus frameworkunifiedDelAcceptMonitor(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ long acceptSock; // NOLINT (readability/nolint)
+
+ char connectKey[32];
+ mcSetConnectKey(connectKey, sizeof(connectKey), pApp->cAppName, pApp->cMsgSrcName);
+ if (frameworkunifiedGetResource(FRAMEWORKUNIFIED_RES_ABNMLMON, connectKey, &acceptSock) < 0) {
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ if (pApp->acceptMonitorTable.find(static_cast<Socket>(acceptSock)) != pApp->acceptMonitorTable.end()) {
+ pApp->acceptMonitorTable.erase(static_cast<Socket>(acceptSock));
+ }
+ }
+
+ return eStatus;
+}
+
+///
+/// Abnormal monitor(client): Server socket close handle
+///
+EFrameworkunifiedStatus frameworkunifiedProcessServerAbnormalState(HANDLE hApp, int sockfd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ ConnectMonitorTable::iterator it;
+
+ if ((it = pApp->connectMonitorTable.find(sockfd)) == pApp->connectMonitorTable.end()) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid fd", sockfd);
+ // LCOV_EXCL_BR_STOP
+ } else {
+ char serverName[16];
+ if (mcGetServerNameFromConnectKey((it->second).c_str(), serverName, sizeof(serverName)) < 0) {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Invlid connectKey:%s", (it->second).c_str());
+ // LCOV_EXCL_BR_STOP
+ } else {
+ if (pApp->lostSessionHandler != NULL) {
+ int cntFound = frameworkunifiedPushLostSessionInfo(hApp, serverName); // LCOV_EXCL_BR_LINE 11:except branch
+ if (cntFound) {
+ // calling lost session handler
+ try {
+ eStatus = pApp->lostSessionHandler(hApp);
+ } catch (const std::exception &e) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from: %s", e.what());
+ // LCOV_EXCL_BR_STOP
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ }
+ }
+ pApp->connectMonitorTable.erase(sockfd);
+ }
+
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///
+/// Abnormal monitor(client): Add
+///
+EFrameworkunifiedStatus frameworkunifiedAddConnectMonitor(HANDLE hApp, PCSTR serverName, PCSTR clientName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ int connectSock = mcConnectMonitor(serverName, clientName);
+ if (connectSock < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error::%s:%s mcConnectMonitor",
+ serverName != 0 ? serverName : NULL, pApp->cAppName != 0 ? pApp->cAppName : NULL);
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ if (pApp->connectMonitorTable.find(connectSock) == pApp->connectMonitorTable.end()) {
+ char connectKey[32];
+ mcSetConnectKey(connectKey, sizeof(connectKey), serverName, clientName);
+
+ struct epoll_event event;
+ event.events = EPOLLRDHUP;
+ event.data.fd = connectSock;
+
+ if (epoll_ctl(pApp->efd, EPOLL_CTL_ADD, connectSock, &event) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (eStatus == eFrameworkunifiedStatusOK) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->connectMonitorTable.insert(std::make_pair(connectSock, connectKey));
+ }
+ }
+ }
+
+ return eStatus;
+}
+
+///
+/// Abnormal monitor(client): Del
+///
+EFrameworkunifiedStatus frameworkunifiedDelConnectMonitor(HANDLE hApp, PCSTR serverName, PCSTR clientName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ char connectKey[32];
+ mcSetConnectKey(connectKey, sizeof(connectKey), serverName, clientName);
+
+ long connectSock; // NOLINT (readability/nolint)
+ if (frameworkunifiedGetResource(FRAMEWORKUNIFIED_RES_ABNMLMON, connectKey, &connectSock) < 0) {
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ if (pApp->connectMonitorTable.find(static_cast<Socket>(connectSock)) != pApp->connectMonitorTable.end()) {
+ pApp->connectMonitorTable.erase(static_cast<Socket>(connectSock));
+ }
+
+ if (epoll_ctl(pApp->efd, EPOLL_CTL_DEL, static_cast<int>(connectSock), NULL) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ return eStatus;
+}
+
+///
+/// Abnormal monitor(common): Attach callback
+///
+EFrameworkunifiedStatus FrameworkunifiedAttachLostSessionCallbackToDispatcher(HANDLE hApp, CbFuncPtr fpLostSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) == FALSE || fpLostSession == NULL) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->lostSessionHandler = fpLostSession;
+ }
+
+ return eStatus;
+}
+
+///
+/// Abnormal monitor(common): Get lost session data
+///
+EFrameworkunifiedStatus FrameworkunifiedGetLostSessionData(HANDLE hApp, PSTR pServiceName, PUI_32 puiSessionId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) == FALSE || pServiceName == NULL || puiSessionId == NULL) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (pApp->lostSessionQueue.empty()) {
+ eStatus = eFrameworkunifiedStatusAccessError;
+ } else {
+ LostSessionInfo info = pApp->lostSessionQueue.front();
+ pApp->lostSessionQueue.pop();
+ strcpy(pServiceName, info.sServiceName.c_str()); // NOLINT (readability/nolint)
+ *puiSessionId = info.iSessionId;
+ }
+ }
+
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedDispatchProcess
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatchProcess(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ // FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "+");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ struct rusage start, end;
+ BOOL enable_rusage = NsLogIsZoneSet(ZONE_NS_DEBUG_DUMP);
+
+ if (enable_rusage == TRUE) {
+ frameworkunifiedGetRusage(&start);
+ }
+
+ if (0 != strcmp(FRAMEWORKUNIFIED_NS_NPSERVICE, pApp->cMsgSrcName)) { // < if not from NPP service
+ switch (pApp->uiProtocolCmd) {
+ case PROTOCOL_REGISTER_EVENTS: {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "%s subscribing to session event on sessionid %d",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL, pApp->uiSessionId);
+
+ eStatus = ProcessProtocolEvents(hApp);
+ }
+ break;
+
+ case PROTOCOL_UNREGISTER_EVENTS: {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "%s unsubscribing private event on sessionid %d",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL, pApp->uiSessionId);
+
+ eStatus = UnregisterPrivateEvents(hApp);
+ }
+ break;
+
+ case PROTOCOL_CLOSE_SESSION_REQ:
+ case PROTOCOL_CLOSE_SESSION_REQ_SYNC: {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "Close session request received from %s",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL);
+
+ // Handle the session events on the close session request
+ (VOID)HandleSessionEventOnCloseSession(hApp);
+
+ frameworkunifiedDelAcceptMonitor(hApp);
+
+ eStatus = FrameworkunifiedProcessServiceProtocol(hApp);
+ }
+ break;
+
+ case PROTOCOL_OPEN_SESSION_REQ:
+ case PROTOCOL_OPEN_SESSION_REQ_SYNC: {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "Open session request received from %s",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL);
+
+ eStatus = FrameworkunifiedProcessServiceProtocol(hApp);
+ if (eStatus == eFrameworkunifiedStatusOK) {
+ frameworkunifiedAddAcceptMonitor(hApp);
+ }
+ }
+ break;
+
+ default: {
+ eStatus = FrameworkunifiedProcessServiceProtocol(hApp);
+ }
+ break;
+ }
+ } else {
+ NotificationTable::iterator n_iterator;
+ FrameworkunifiedGetSystemInfo(pApp, pApp->cSystemInfo);
+ n_iterator = pApp->notifications.find(static_cast<PSTR>(pApp->cSystemInfo));
+ if (n_iterator != pApp->notifications.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, " Notification found in NS_NP :: (%s)."
+ " Processing callback function.", n_iterator->first.c_str());
+ eStatus = (*n_iterator).second(hApp);
+ } else {
+ NotificationEventTable::iterator n_iterator;
+ FrameworkunifiedGetSystemInfo(pApp, pApp->cSystemInfo);
+ n_iterator = pApp->notificationevents.find(static_cast<PSTR>(pApp->cSystemInfo));
+ if (n_iterator != pApp->notificationevents.end()) {
+ CFrameworkunifiedHSMFramework *l_pStateMachine = FrameworkunifiedGetStateMachine(hApp);
+ if (l_pStateMachine) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, " Notification found in NS_NP :: (%s)."
+ " Processing HSM event.", n_iterator->first.c_str());
+ eStatus = l_pStateMachine->FrameworkunifiedPostEvent(n_iterator->second);
+ }
+ } else {
+ /// Paul A. Dennis (FOUND BUG)
+ /// For Persistent Data NS_NP sends the data back as a normal command not via the
+ /// notification logic... The Ack's for NPReadPersistedData,NPRegisterFilePath and
+ /// NPLoadFileFromPersistentStorage were never getting back
+ /// to the requester because its's not looking in the correct location.
+ /// So, Check the Services to see if the user has defined the Ack commands via the
+ /// services map
+ eStatus = FrameworkunifiedProcessServiceProtocol(hApp);
+ }
+ }
+ }
+
+ frameworkunifiedProcessSyncResponse(hApp, eStatus);
+
+ if ((eStatus != eFrameworkunifiedStatusOK) && (eStatus != eFrameworkunifiedStatusExit) && (eStatus != eFrameworkunifiedStatusMsgNotProcessed)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error :: %d, (%s) Event Info :: (%s), (%d), (%s)",
+ eStatus,
+ pApp->cAppName != 0 ? static_cast<PSTR>(pApp->cAppName) : NULL,
+ pApp->cMsgSrcName != 0 ? static_cast<PSTR>(pApp->cMsgSrcName) : NULL,
+ pApp->uiProtocolCmd,
+ pApp->cSystemInfo != 0 ? static_cast<PSTR>(pApp->cSystemInfo) : NULL);
+ }
+
+ if (eStatus == eFrameworkunifiedStatusMsgNotProcessed) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING:: No handler found for :: "
+ "Source: %s, Protocol Command: 0x%x, Session Id: %u.",
+ pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL,
+ pApp->uiProtocolCmd, pApp->uiSessionId);
+ FrameworkunifiedClearMsgData(hApp);
+ eStatus = eFrameworkunifiedStatusOK;
+ } else {
+// FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Message processed. Status (0x%X) ::"
+// " Source: %s Command: 0x%x SessionId: %d.",
+// eStatus, pApp->cMsgSrcName != 0 ? pApp->cMsgSrcName : NULL,
+// pApp->uiProtocolCmd, pApp->uiSessionId);
+ }
+
+ if (enable_rusage == TRUE) {
+ frameworkunifiedGetRusage(&end);
+ frameworkunifiedPrintRusage(hApp, start, end);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "-");
+ return eStatus;
+}
+
+
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedCloseDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseDispatcher(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->checkCode = 0;
+
+ if (NULL != pApp->hAppRcvMsgQ) {
+ McClose(pApp->hAppRcvMsgQ);
+ pApp->hAppRcvMsgQ = NULL;
+ }
+
+ if (pApp->siMonitorSock) {
+ mcCloseMonitor(pApp->cAppName);
+ pApp->siMonitorSock = 0;
+ }
+
+ if (NULL != pApp->hAppSndMsgQ) {
+ McClose(pApp->hAppSndMsgQ);
+ pApp->hAppSndMsgQ = NULL;
+ }
+
+ if (NULL != pApp->hNPSndMsgQ) {
+ FrameworkunifiedMcClose(pApp->hNPSndMsgQ);
+ pApp->hNPSndMsgQ = NULL;
+ }
+
+ if (NULL != pApp->hParentSndMsgQ) {
+ McClose(pApp->hParentSndMsgQ);
+ pApp->hParentSndMsgQ = NULL;
+ }
+
+ if (0 < pApp->defer_evfd) {
+ close(pApp->defer_evfd);
+ pApp->defer_evfd = 0;
+ }
+
+ if (0 < pApp->efd) {
+ close(pApp->efd);
+ pApp->efd = 0;
+ }
+
+ delete(pApp);
+ pApp = NULL; // mb20110110 Added per comment 216
+ // NOTE: However, client still needs to set his own pointer to NULL
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedPopedDeferedMessage
+//////////////////////////////////////////
+BOOL FrameworkunifiedPopedDeferedMessage(HANDLE hApp) {
+ BOOL rtnFlag = FALSE;
+
+ // LCOV_EXCL_BR_START 6:FrameworkunifiedPopedDeferedMessage is internal function, hApp is checked in extenal API
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ // LCOV_EXCL_BR_STOP
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // check if the pop flag is send and there is something to pop!
+ if (pApp->fPopDeferedMsg && !pApp->deferedMsgQueue.empty()) {
+ // get the message at the top\front of the queue
+ DeferedMsgInfo defered(pApp->deferedMsgQueue.front());
+
+ // remove this item from the queue using pop
+ pApp->deferedMsgQueue.pop();
+
+ // copy the data into the pApp
+ pApp->uiProtocolCmd = defered.uiProtocolCmd;
+ strlcpy(pApp->cMsgSrcName, defered.cMsgSrcName, sizeof(pApp->cMsgSrcName));
+ std::memcpy(pApp->uiMsgRcvBuffer, defered.uiMsgRcvBuffer, MAX_MSGQ_BUFFER);
+
+ // clear the pop flag!
+ pApp->fPopDeferedMsg = FALSE;
+
+ // set the return flag TRUE, we have pop'ed
+ rtnFlag = TRUE;
+ }
+ }
+
+ return rtnFlag;
+}
+
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatcher(PCSTR cAppName, const FrameworkunifiedDefaultCallbackHandler *CbHandler) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "In");
+ return FrameworkunifiedDispatcherWithArguments(cAppName, 0, NULL, CbHandler);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+// FrameworkunifiedDispatcherWithArguments
+// Creates, initializes and runs the dispatcher
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatcherWithArguments(PCSTR cAppName, int argc, char *argv[],
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler,
+ CustomCommandLineOptions *cmdLineOptions) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (cAppName == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ NsLogSetProcessName(cAppName);
+ PLOG_TEXT("FrameworkunifiedDispatcher Start");
+ // set main thread name as provided in dispatcher
+ pthread_setname_np(pthread_self(), cAppName);
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "In");
+
+ if ((eStatus = RegistDefaultCbHandler(CbHandler)) != eFrameworkunifiedStatusOK) {
+ return eStatus;
+ }
+
+ try {
+ HANDLE hFrameworkApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcher(cAppName, hFrameworkApp, FALSE))) {
+ // LCOV_EXCL_BR_START 6:if FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hFrameworkApp is not NULL
+ if (NULL != hFrameworkApp) {
+ // LCOV_EXCL_BR_STOP
+ THApp hApp(hFrameworkApp);
+
+ /// Parse the Arguments via the FrameworkunifiedArgumentParser
+ /// passing an handle to the app and argument list
+ eStatus = FrameworkunifiedArgumentParser(hApp, argc, argv, cmdLineOptions);
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ eStatus = FrameworkunifiedDispatcherMain(hApp);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hFrameworkApp is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcher error, status=%d", eStatus);
+ }
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedCreateDispatcher: %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+
+ return eStatus;
+}
+
+// required for parsing subargument of -r
+char *g_cPlogSubOpts[] = {
+#define PLOG_OUTPUT 0
+ const_cast<PSTR>("output"),
+ NULL
+};
+
+EFrameworkunifiedStatus FrameworkunifiedArgumentParser(HANDLE hApp, int argc, char *argv[], CustomCommandLineOptions *cmdLineOptions) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ TFrameworkunifiedZoneMask mask = {};
+ PCHAR l_cMask = NULL;
+ UI_32 l_iMaskCount = 0;
+ CHAR l_logoutput[MAX_QUEUE_NAME_SIZE];
+ CHAR l_tFilePath[MAX_PATH_LENGTH];
+
+ BOOL l_bHasConfigFilepath = FALSE;
+
+ SI_32 l_iOpt = 0;
+ SI_32 l_iPriority = 10;
+ PSTR l_cOptions;
+ PSTR l_cValue;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "In");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+#ifdef DISPATCHER_PROFILER
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+#endif
+
+ if (argc > 0 && argv != NULL) {
+ // l:m:t:c: options are reserved for NS Framework and should not be used by other FRAMEWORKUNIFIED Applications.
+ CHAR l_cNSOptions[MAX_STRING_SIZE_TAG] = {};
+
+ strncpy(l_cNSOptions, "l:m:c:p:qr:s", (MAX_STRING_SIZE_TAG - 1));
+ optind = 1;
+
+ if (NULL != cmdLineOptions) {
+ // append custom options
+ strncat(l_cNSOptions, cmdLineOptions->cShortOptions, (MAX_STRING_SIZE_TAG - strlen(l_cNSOptions) - 1));
+ }
+ while ((eFrameworkunifiedStatusOK == eStatus) && ((l_iOpt = getopt(argc, argv, l_cNSOptions)) != -1)) {
+ switch (l_iOpt) {
+ case 'm': // mask value..
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-m (mask value): %s", optarg);
+ /*
+ * @todo
+ * If the second of the command-line arguments is-m and the third is not, an exception occurs.
+ */
+ char *saveptr;
+ l_cMask = strtok_r(optarg, ",", &saveptr);
+
+ while (NULL != l_cMask) {
+ mask[l_iMaskCount++] = static_cast<TFrameworkunifiedZone>(strtoul(l_cMask, NULL, 16));
+ l_cMask = strtok_r(NULL, ",", &saveptr);
+ }
+ NsLogSetControlMask(mask);
+ break;
+ case 'l': // log output
+ strncpy(l_logoutput, optarg, (MAX_QUEUE_NAME_SIZE - 1));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-l (log output option): %s", l_logoutput);
+ NsLogSetLogMethod(NsLogDetermineLogMethod(l_logoutput));
+ break;
+ case 'c': // config file option
+ strncpy(l_tFilePath, optarg, (MAX_PATH_LENGTH - 1));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-c (set config file): %s", l_tFilePath);
+ eStatus = SetConfigHandle(hApp, l_tFilePath);
+ l_bHasConfigFilepath = TRUE;
+ break;
+ case 'p': // priority
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-p (set priority): %s", optarg);
+ if (eFrameworkunifiedStatusOK != frameworkunified::framework::CFrameworkunifiedThreadPriorities::ParseThreadArguments(optarg)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING!! Failed to parse sub arguments of -p");
+ }
+ l_iPriority = frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(FrameworkunifiedGetAppName(hApp));
+ // set only if valid prio, otherwise use the default one
+ if (FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND != l_iPriority) {
+ pthread_setschedprio(pthread_self(),
+ frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(FrameworkunifiedGetAppName(hApp)));
+ }
+ break;
+ case 'q':
+#ifdef DISPATCHER_PROFILER
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-q (set msg dispatcher profiler)");
+ FrameworkunifiedMsgProfiler::m_bMsgProfilerEnabled = TRUE;
+ pApp->m_pFrameworkunifiedMsgProfiler = new(nothrow) FrameworkunifiedMsgProfiler(FrameworkunifiedGetAppName(hApp));
+#endif
+ break;
+ case 'r':
+ NSLogEnablePLog(TRUE);
+ l_cOptions = optarg;
+ while (*l_cOptions != '\0') {
+ switch (getsubopt(&l_cOptions, g_cPlogSubOpts, &l_cValue)) {
+ case PLOG_OUTPUT: {
+ if (l_cValue != NULL) {
+ NSLogSetPlogOutputOptions(static_cast<UI_8>(strtoul(l_cValue, NULL, 16)));
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ break;
+ case 's':
+ NSLogEnableSysEventLog(TRUE);
+ break;
+ default:
+ if (NULL != cmdLineOptions) {
+ // option other than l:m:t:c: is a custom option, therefore let application handle that option.
+ if (eFrameworkunifiedStatusOK != cmdLineOptions->callback(l_iOpt, optarg)) {
+ // Do not terminate an application even if invalid arguments received
+ // eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING!! Invalid cmd line argument received.");
+ }
+ } else {
+ // Do not terminate an application even if invalid arguments received
+ // eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING!! Invalid cmd line argument received.");
+ }
+ break;
+ }
+ }
+ }
+
+ // if no config option is selected then use the default config path
+ if ((FALSE == l_bHasConfigFilepath) && (eFrameworkunifiedStatusOK == eStatus)) {
+ eStatus = SetDefaultConfigFile(hApp);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSimpleDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSimpleDispatcher(PCSTR cAppName, const FrameworkunifiedDefaultCallbackHandler *CbHandler, CbFuncPtr CbShutdown,
+ BOOL isChildThread) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ // if main thread then set log process name
+ if (!isChildThread) {
+ NsLogSetProcessName(cAppName);
+ }
+
+ if ((eStatus = RegistDefaultCbHandler(CbHandler)) != eFrameworkunifiedStatusOK) {
+ return eStatus;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "+");
+
+ if (NULL != CbShutdown) {
+ try {
+ HANDLE hFrameworkApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcher(cAppName, hFrameworkApp, isChildThread))) {
+ // LCOV_EXCL_BR_START 6:if FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hFrameworkApp is not NULL
+ if (NULL != hFrameworkApp) {
+ // LCOV_EXCL_BR_STOP
+ THApp hApp(hFrameworkApp);
+
+ // Call application defined start function
+ eStatus = FrameworkunifiedOnInitializationInternal(hApp);
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedOnInitialization failed ");
+ throw happ_error();
+ } else {
+ while (eFrameworkunifiedStatusExit != eStatus) {
+ try {
+ // dispatch block: waits on receive message
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDispatchBlock(hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: FrameworkunifiedDispatchBlock : 0x%x ", eStatus);
+ continue;
+ }
+ // dispatch process: calls respective call back functions
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDispatchProcess(hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: FrameworkunifiedDispatchProcess : 0x%x ", eStatus);
+ }
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR :: %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const std::exception &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from: %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exiting dispatcher ");
+ }
+ // Call application defined stop function
+ eStatus = CbShutdown(hApp);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "hFrameworkApp is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcher error, status=%d", eStatus);
+ }
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedCreateDispatcher ");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus RunDispatcher(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ int efd;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+#ifdef DISPATCHER_PROFILER
+ // Get the application handle
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ FrameworkunifiedAttachMsgProfilerCallbacksDispatcher(hApp);
+ }
+#endif
+ FrameworkunifiedGetDispatcherFD(hApp, &efd);
+
+ while (1) {
+ frameworkunifiedFdHandler(hApp, efd);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+EFrameworkunifiedStatus FrameworkunifiedDispatcherMain(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ try {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "Success: FrameworkunifiedCreateDispatcher ");
+
+ // Initialize the global structures
+ // register service with service dir
+ // register notifications
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization +");
+ eStatus = FrameworkunifiedOnInitializationInternal(hApp);
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization -");
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedOnInitialization failed ");
+ throw happ_error();
+ } else {
+ eStatus = RunDispatcher(hApp);
+ CFrameworkunifiedSyncData::FrameworkunifiedReleaseSyncDataInstance();
+ }
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR :: %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedCreateDispatcher ");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcherWithoutLoop(PCSTR cAppName, HANDLE &hApp, int argc, char *argv[], // NOLINT (readability/nolint)
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler,
+ BOOL bIsConnectSM, CustomCommandLineOptions *cmdLineOptions) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ THApp *l_hApp = NULL;
+
+ if (cAppName == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ NsLogSetProcessName(cAppName);
+
+ PLOG_TEXT("FrameworkunifiedDispatcher Start");
+ // set main thread name as provided in dispatcher
+ pthread_setname_np(pthread_self(), cAppName);
+
+ if ((eStatus = RegistDefaultCbHandler(CbHandler)) != eFrameworkunifiedStatusOK) {
+ return eStatus;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "In");
+
+ try {
+ HANDLE hFrameworkApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcher(cAppName, hFrameworkApp,
+ bIsConnectSM == TRUE ? FALSE : TRUE))) {
+ // LCOV_EXCL_BR_START 6:if FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hFrameworkApp is not NULL
+ if (NULL != hFrameworkApp) {
+ // LCOV_EXCL_BR_STOP
+ l_hApp = new THApp(hFrameworkApp);
+ hApp = *l_hApp;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->pRsrcMgr = reinterpret_cast<void *>(l_hApp);
+
+ eStatus = FrameworkunifiedArgumentParser(hApp, argc, argv, cmdLineOptions);
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization +");
+ eStatus = FrameworkunifiedOnInitializationInternal(hApp);
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization -");
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedOnInitialization failed ");
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcher error, status=%d", eStatus);
+ }
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedCreateDispatcher ");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedDispatchProcessWithoutLoop(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ int efd; // FD for multi waiting
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ FrameworkunifiedGetDispatcherFD(hApp, &efd);
+ eStatus = frameworkunifiedFdHandler(hApp, efd);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedDestroyDispatcherWithoutLoop(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ try {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ THApp *RsrcMgr = reinterpret_cast<THApp *>(pApp->pRsrcMgr);
+ delete RsrcMgr;
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+static EFrameworkunifiedStatus GetDispatcherMqFD(HANDLE hApp, int *fd) {
+ if (fd == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "fd is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ *fd = McGetQueueFD(pApp->hAppRcvMsgQ);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+static EFrameworkunifiedStatus CreateMultiWaitingFD(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ int efd; // FD for multi waiting
+ int q_fd; // FD for Dispatcher's message queue
+ int defer_evfd; // FD for receiving Defer events to Dispatcher
+ struct epoll_event ev; // Info struct to associate with multiwaiting FD
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // Create efd
+ efd = epoll_create1(EPOLL_CLOEXEC);
+ if (-1 != efd) {
+ pApp->efd = efd;
+
+ // get fd to Dispatcher's message queue
+ eStatus = GetDispatcherMqFD(hApp, &q_fd);
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ // efd to monitor the q_fd.
+ ev.events = EPOLLIN;
+ ev.data.fd = q_fd;
+ if (-1 == epoll_ctl(efd, EPOLL_CTL_ADD, q_fd, &ev)) {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(q_fd, ADD) Failed, "
+ "status=%d, errno=%d", eStatus, errno);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : GetDispatcherMqFD Failed, status=%d", eStatus);
+ }
+
+ // create FD for receiving Defer events to Dispatcher
+ defer_evfd = eventfd(0, EFD_CLOEXEC);
+ if (-1 != defer_evfd) {
+ pApp->defer_evfd = defer_evfd;
+
+ // efd to monitor the defer_evfd.
+ ev.events = EPOLLIN;
+ ev.data.fd = defer_evfd;
+ if (-1 == epoll_ctl(efd, EPOLL_CTL_ADD, defer_evfd, &ev)) {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(defer_evfd, ADD) Failed,"
+ " status=%d, errno=%d", eStatus, errno);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : eventfd Failed, status=%d, errno=%d", eStatus, errno);
+ }
+
+ // add abnormal monitor socket polling
+ if (-1 != pApp->siMonitorSock) {
+ ev.events = EPOLLIN;
+ ev.data.fd = pApp->siMonitorSock;
+ if (-1 == epoll_ctl(efd, EPOLL_CTL_ADD, pApp->siMonitorSock, &ev)) {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl:%s", strerror(errno));
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_create1 Failed, status=%d, errno=%d", eStatus, errno);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedGetDispatcherFD(HANDLE hApp, int *efd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (NULL != efd) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ *efd = pApp->efd;
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnInitializationInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onInitilization != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onInitilization(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDestroyInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onDestroy != NULL) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (pApp->hParentSndMsgQ == NULL) {
+ // main thread
+ try {
+ eStatus = g_defaultCallbackHandler.onDestroy(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStartInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onStart != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onStart(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStopInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onStop != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onStop(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStartInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onPreStart != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onPreStart(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStopInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onPreStop != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onPreStop(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStartInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onBackgroundStart != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onBackgroundStart(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStopInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onBackgroundStop != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onBackgroundStop(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDumpInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.onDebugDump != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.onDebugDump(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachineInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.createStateMachine != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.createStateMachine(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterfaceInternal(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (g_defaultCallbackHandler.ssFrameworkInterface != NULL) {
+ try {
+ eStatus = g_defaultCallbackHandler.ssFrameworkInterface(hApp);
+ } catch (const std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: %s", e.what());
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus RegistDefaultCbHandler(const FrameworkunifiedDefaultCallbackHandler *CbHandler) {
+ if (CbHandler == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ } else if (CbHandler->onInitilization == NULL || CbHandler->onDestroy == NULL || CbHandler->onStart == NULL ||
+ CbHandler->onStop == NULL
+ || CbHandler->onPreStart == NULL || CbHandler->onPreStop == NULL
+ || CbHandler->onBackgroundStart == NULL || CbHandler->onBackgroundStop == NULL
+ || CbHandler->onDebugDump == NULL || CbHandler->createStateMachine == NULL
+ || CbHandler->ssFrameworkInterface == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " [ ABORT ] DefaultCallbackHandler is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ g_defaultCallbackHandler = *CbHandler;
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedGetDefaultCbHandler(FrameworkunifiedDefaultCallbackHandler *CbHandler) {
+ if (CbHandler == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ *CbHandler = g_defaultCallbackHandler;
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus frameworkunifiedFdHandler(HANDLE hApp , int efd) {
+ struct epoll_event events[MAX_FD_MULTIWAITING];
+ int nfds; // The number of events received
+ int q_fd; // The FD of events received
+ int n; // Loop counter
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ const char *key;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ eStatus = GetDispatcherMqFD(hApp, &q_fd);
+ // LCOV_EXCL_BR_START 6:Because of hApp is valid, GetDispatcherMqFD return eFrameworkunifiedStatusOK.
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ // LCOV_EXCL_BR_STOP
+ nfds = epoll_wait(efd, events, MAX_FD_MULTIWAITING, -1);
+ if (-1 != nfds) {
+ for (n = 0; n < nfds; ++n) {
+ if (pApp->siMonitorSock == events[n].data.fd) {
+ // abnormal monitor connect request
+ int socket;
+
+ if ((socket = mcAcceptMonitor(pApp->cAppName, pApp->siMonitorSock)) >= 0) {
+ struct epoll_event event;
+
+ event.events = EPOLLRDHUP;
+ event.data.fd = socket;
+
+ if (epoll_ctl(pApp->efd, EPOLL_CTL_ADD, socket, &event) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl:%s", strerror(errno));
+ }
+ }
+ }
+ }
+
+ for (n = 0; n < nfds; ++n) {
+ // The branch processing by FD on which the message was received
+ if (q_fd == events[n].data.fd) {
+ // process the message to the Dispatcher's message queue
+ eStatus = ProcessMq(hApp);
+ } else if (pApp->defer_evfd == events[n].data.fd) {
+ // process the Defer event to the Dispatcher
+ uint64_t data;
+ ssize_t len;
+
+ len = read(pApp->defer_evfd, &data, sizeof(uint64_t));
+ if (len < 0) {
+ // read error
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : read Failed, status=%d, errno=%d, defer_evfd=%d",
+ eStatus, errno, pApp->defer_evfd);
+ } else {
+ while (TRUE == (FrameworkunifiedPopedDeferedMessage(hApp))) {
+ try {
+ // dispatch process: calls respective call back functions
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDispatchProcess(hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : FrameworkunifiedDispatchProcess Status : 0x%x", eStatus);
+ }
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const std::exception &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from : %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ }
+ } else if (pApp->siMonitorSock == events[n].data.fd) {
+ // do nothing
+ } else if (frameworkunifiedSearchResourseKey(FRAMEWORKUNIFIED_RES_ABNMLMON, events[n].data.fd, &key) == 0) {
+ if (pApp->acceptMonitorTable.find(events[n].data.fd) != pApp->acceptMonitorTable.end()) {
+ // server: accept socket close
+ eStatus = frameworkunifiedProcessClientAbnormalState(hApp, events[n].data.fd);
+ } else if (pApp->connectMonitorTable.find(events[n].data.fd) != pApp->connectMonitorTable.end()) {
+ // client: connect socket close
+ eStatus = frameworkunifiedProcessServerAbnormalState(hApp, events[n].data.fd);
+ }
+
+ if (epoll_ctl(pApp->efd, EPOLL_CTL_DEL, events[n].data.fd, NULL) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl:%s", strerror(errno));
+ }
+ close(events[n].data.fd);
+ frameworkunifiedUnregistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, key);
+ } else {
+ // process the message to the FD set by the user
+ eStatus = ProcessFd(hApp, events[n].data.fd);
+ }
+ }
+ } else {
+ if (errno == EINTR) {
+ // signal interrupt
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_wait Failed, status=%d, errno=%d", eStatus, errno);
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6:Because of hApp is valid, GetDispatcherMqFD return eFrameworkunifiedStatusOK.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : GetDispatcherMqFD Failed, status=%d", eStatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+static EFrameworkunifiedStatus ProcessMq(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+#ifdef DISPATCHER_PROFILER
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+#endif
+
+ // handle defer'ed message
+ if (FALSE == FrameworkunifiedPopedDeferedMessage(hApp)) {
+ // dispatch block: waits on receive message
+ if ((eStatus = FrameworkunifiedDispatchBlock(hApp)) != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : FrameworkunifiedDispatchBlock Status : 0x%x", eStatus);
+ }
+ #ifdef DISPATCHER_PROFILER
+ else if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) { // NOLINT (readability/nolint)
+ pApp->m_pFrameworkunifiedMsgProfiler->MsgReceived();
+ }
+ #endif
+ }
+ try {
+ // dispatch process: calls respective call back functions
+ eStatus = FrameworkunifiedDispatchProcess(hApp);
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const std::exception &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from : %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+#ifdef DISPATCHER_PROFILER
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ pApp->m_pFrameworkunifiedMsgProfiler->MsgProcessed();
+ }
+#endif
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+static EFrameworkunifiedStatus ProcessFd(HANDLE hApp , int fd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ FdTable::iterator f_iterator;
+ struct rusage start, end;
+ BOOL enable_rusage = NsLogIsZoneSet(ZONE_NS_DEBUG_DUMP);
+
+ if (enable_rusage == TRUE) {
+ frameworkunifiedGetRusage(&start);
+ }
+
+ // finding callback func associated with FD
+ f_iterator = pApp->fds.find(fd);
+ if (f_iterator != pApp->fds.end()) {
+ try {
+ // calling func associated with FD
+ eStatus = (*f_iterator).second(hApp);
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR :: %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const std::exception &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Recovering from: %s", err.what());
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Callback associated with FD is not found. ", eStatus);
+ }
+
+ if (enable_rusage == TRUE) {
+ frameworkunifiedGetRusage(&end);
+ frameworkunifiedPrintRusage(hApp, start, end);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////////
+/// EFrameworkunifiedStatus SetConfigHandle(HANDLE hApp, PCHAR sFilePath )
+/// This Function opens the file from give path and sets the file handle in hApp
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetConfigHandle(HANDLE hApp, PCHAR sFilePath) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __PRETTY_FUNCTION__, "This function is not implemented");
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////////
+/// EFrameworkunifiedStatus SetDefaultFilePath(HANDLE hApp)
+/// This Function fetches the file path from Environment variable from PASA_APPCONFIG_FILES and
+/// pass it to the SetConfigHandle function
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetDefaultConfigFile(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ // Get the file path from environment variable
+ PCHAR l_strEnvValue = getenv(PASA_APPCONFIG_FILES);
+
+ if (l_strEnvValue) {
+ // FRAMEWORKUNIFIEDLOG( ZONE_NS_DIS, __FUNCTION__, "Configuration file path %s ",l_strEnvValue);
+
+ std::string l_strFilePath(l_strEnvValue);
+
+ if (!l_strFilePath.empty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Configuration file path %s ", l_strFilePath.c_str());
+ // Open the configuration file
+ SetConfigHandle(hApp, (PCHAR)l_strFilePath.c_str());
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocolHSMEvent(HANDLE hApp, PCSTR pRequester) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ EventServices::iterator s_iterator;
+
+ // finding the service
+ s_iterator = pApp->eventservices.find(pRequester);
+ if (s_iterator != pApp->eventservices.end()) {
+ EventSessionTable::iterator session_iterator;
+ session_iterator = (s_iterator->second).find(pApp->uiSessionId);
+ if (session_iterator != (s_iterator->second).end()) {
+ ServiceEventProtocolTable::iterator spt_iterator;
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, " %s found :: (%s) ", pApp->cMsgSrcName, s_iterator->second);
+
+ // find the protocol req/ack handler
+ spt_iterator = (session_iterator->second).find(pApp->uiProtocolCmd);
+ if (spt_iterator != (session_iterator->second).end()) {
+ // FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, " Protocol Command :: (0x%x) ", pApp->uiProtocolCmd);
+ // Post corresponding event
+ CFrameworkunifiedHSMFramework *l_pStateMachine = FrameworkunifiedGetStateMachine(hApp);
+ if (l_pStateMachine) {
+ eStatus = l_pStateMachine->FrameworkunifiedPostEvent(spt_iterator->second);
+ }
+ } else if ((session_iterator->second).end() != (spt_iterator =
+ (session_iterator->second).find(FRAMEWORKUNIFIED_ANY_COMMAND))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Processing HSM event for (FRAMEWORKUNIFIED_ANY_COMMAND). "
+ "Dispatcher protocol command: (0x%x)",
+ pApp->uiProtocolCmd);
+ // Post corresponding event
+ CFrameworkunifiedHSMFramework *l_pStateMachine = FrameworkunifiedGetStateMachine(hApp);
+ if (l_pStateMachine) {
+ eStatus = l_pStateMachine->FrameworkunifiedPostEvent(spt_iterator->second);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+
+ // if FrameworkunifiedPostEvent returns NULL
+ if (eFrameworkunifiedStatusNullPointer == eStatus) {
+ eStatus = eFrameworkunifiedStatusExit;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+
+ } else {
+ eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : ProcessProtocolEvents
+//////////////////////////////////////////
+EFrameworkunifiedStatus ProcessProtocolEvents(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // common event table iterator
+ EventTable::iterator e_iterator;
+ ServiceSessionIdListTable::iterator ssidl_iterator;
+
+ // public state event table iterator
+ PublicStateEventTable::iterator se_iterator;
+
+ // private state event table iterator
+ PrivateStateEventTable::iterator pse_iterator;
+ ServiceSessionEventData::iterator ssed_iterator;
+ SessionEventData::iterator sed_iterator;
+
+ HANDLE l_pClientHandle = NULL;
+
+ // get the name of the service from which message is received
+ PCSTR l_cServiceName = pApp->cMsgSrcName;
+ const UI_32 l_uiSessionId = pApp->uiSessionId;
+
+ // number of events to register
+ UI_32 l_uiListSize = static_cast<UI_32>(FrameworkunifiedGetMsgLength(hApp) / sizeof(UI_32));
+
+ // check if the received service name and data is valid
+ if (NULL != l_cServiceName && 0 < l_uiListSize) {
+ PUI_32 l_pData = new UI_32[l_uiListSize];
+ UI_32 l_uiEventId = 0;
+
+ // get the list of events
+ eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, l_pData, static_cast<UI_32>(l_uiListSize * sizeof(UI_32)));
+
+ if (NULL != l_pData && eFrameworkunifiedStatusOK == eStatus) {
+ for (UI_32 uiCount = 0; uiCount < l_uiListSize; uiCount++) {
+ // received event id
+ l_uiEventId = l_pData[uiCount];
+
+ // find the event in map of EventTable
+ e_iterator = pApp->eventtable.find(l_uiEventId);
+
+ // if event is registered by any of the clients
+ if (pApp->eventtable.end() != e_iterator) {
+ // table of services with list of their session id's registering this event
+ ServiceSessionIdListTable &l_mServiceSessionIdListTable = e_iterator->second;
+
+ // find the service name in map of ServiceSessionIdListTable
+ ssidl_iterator = l_mServiceSessionIdListTable.find(l_cServiceName);
+
+ // if service have already registered this event with any of its session
+ if (l_mServiceSessionIdListTable.end() != ssidl_iterator) {
+ // list of sessions id's registering with this event
+ SessionIdList &l_vSessionIdList = ssidl_iterator->second;
+
+ // event is registered with this session
+ if (IsEventAlreadyRegistered(l_vSessionIdList, l_uiSessionId)) {
+ // get the message queue handle from map servicesessionhandletable
+ l_pClientHandle = GetMsgQueueHandle(hApp, l_cServiceName, l_uiSessionId);
+ } else { // event is not registered with this session
+ // create new message queue handle and insert it in map servicesessionhandletable
+ l_pClientHandle = GetNewHandleAndUpdateEventInfoTable(hApp,
+ l_cServiceName, l_uiSessionId, l_uiEventId);
+
+ // insert the current session id
+ l_vSessionIdList.push_back(l_uiSessionId);
+ }
+ } else { // if service have not registered this event with any of its session
+ // create a list for storing session id's registering this event for this service
+ SessionIdList l_vSessionIdList;
+
+ // insert the current session id
+ l_vSessionIdList.push_back(l_uiSessionId);
+
+ // create new message queue handle and insert it in map servicesessionhandletable
+ l_pClientHandle = GetNewHandleAndUpdateEventInfoTable(hApp, l_cServiceName, l_uiSessionId, l_uiEventId);
+
+ // make a entry for service name and session id's list in map of ServiceSessionIdListTable
+ l_mServiceSessionIdListTable.insert(make_pair(l_cServiceName, l_vSessionIdList));
+ }
+ } else { // if event is not registered by any of the clients
+ // create a list for storing session id's registering this event for this service
+ SessionIdList l_vSessionIdList;
+
+ // insert the current session id
+ l_vSessionIdList.push_back(l_uiSessionId);
+
+ // create new message queue handle and insert it in map servicesessionhandletable
+ l_pClientHandle = GetNewHandleAndUpdateEventInfoTable(hApp, l_cServiceName, l_uiSessionId, l_uiEventId);
+
+ // create a table for storing services and its session id list, registering this event
+ ServiceSessionIdListTable l_mServiceSessionIdListTable;
+
+ // make a entry for service name and session id's list in map of ServiceSessionIdListTable
+ l_mServiceSessionIdListTable.insert(make_pair(l_cServiceName, l_vSessionIdList));
+
+ // insert the table with event id in EventTable
+ pApp->eventtable.insert(make_pair(l_uiEventId, l_mServiceSessionIdListTable));
+ }
+
+ // check whether event is defined as public state event
+ se_iterator = pApp->publicstateeventtable.find(l_uiEventId);
+
+ // if event is a state event, publish the event
+ if (pApp->publicstateeventtable.end() != se_iterator) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "%d is a public state event", l_uiEventId);
+
+ if (NULL != (se_iterator->second)) {
+ // send the event data for state event
+ eStatus = FrameworkunifiedSendMsg(l_pClientHandle,
+ l_uiEventId,
+ (se_iterator->second)->uiLength,
+ (se_iterator->second)->pData);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Sending event:%d to service:%s, session:%d, status:%d",
+ l_uiEventId,
+ l_cServiceName,
+ l_uiSessionId,
+ eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event %d yet not published ", l_uiEventId);
+ }
+ } else { // check whether the event is defined as private state event
+ pse_iterator = pApp->privatestateeventtable.find(l_uiEventId);
+
+ // if event found, publish the event
+ if (pApp->privatestateeventtable.end() != pse_iterator) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "%d is a private state event", l_uiEventId);
+
+ ssed_iterator = (pse_iterator->second).find(l_cServiceName);
+
+ // check whether the event had been published for this service before subscription
+ if ((pse_iterator->second).end() != ssed_iterator) {
+ sed_iterator = (ssed_iterator->second).find(l_uiSessionId);
+
+ // check whether the event had been published for this service for the same session
+ if ((ssed_iterator->second).end() != sed_iterator) {
+ if (NULL != (sed_iterator->second)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%d had been published for the "
+ "service:%s on sessionId:%d ", l_uiEventId,
+ l_cServiceName, l_uiSessionId);
+
+ // send the event data for state event
+ eStatus = FrameworkunifiedSendMsg(l_pClientHandle,
+ l_uiEventId,
+ (sed_iterator->second)->uiLength,
+ (sed_iterator->second)->pData);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Sending event:%d to service:%s, session:%d, status:%d",
+ l_uiEventId,
+ l_cServiceName,
+ l_uiSessionId,
+ eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event %d yet not published ", l_uiEventId);
+ }
+ }
+ }
+ }
+ }
+ } // end of for loop of events list
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, PROTOCOL_REGISTER_EVENTS Invalid data ", eStatus);
+ }
+
+ if (NULL != l_pData) {
+ delete[] l_pData;
+ l_pData = NULL;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, PROTOCOL_REGISTER_EVENTS Service Name invalid ", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : IsEventAlreadyRegistered
+//////////////////////////////////////////
+BOOL IsEventAlreadyRegistered(const SessionIdList &vSessionIdList, const UI_32 uiSessionId) {
+ for (UI_32 uiCount = 0; uiCount < vSessionIdList.size(); uiCount++) {
+ if (uiSessionId == vSessionIdList[uiCount]) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+//////////////////////////////////////////
+// Function : GetMsgQueueHandle
+//////////////////////////////////////////
+HANDLE GetMsgQueueHandle(HANDLE hApp, PCSTR serviceName, const UI_32 uiSessionId) {
+ HANDLE l_pClientHandle = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ ServiceSessionHandleTable::iterator ssh_iterator;;
+ SessionToEventInfo::iterator sh_iterator;
+
+ // find the service name
+ ssh_iterator = pApp->servicesessionhandletable.find(serviceName);
+
+ if (pApp->servicesessionhandletable.end() != ssh_iterator) {
+ // search for session id
+ sh_iterator = ssh_iterator->second.find(uiSessionId);
+
+ if (ssh_iterator->second.end() != sh_iterator) {
+ SessionEventInfo *l_ptSessionEventInfo = sh_iterator->second;
+ if (NULL != l_ptSessionEventInfo) {
+ l_pClientHandle = l_ptSessionEventInfo->m_hSession;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Handle found for service: %s, session: %d, handle:%p.",
+ serviceName, uiSessionId, l_pClientHandle);
+ }
+ }
+ }
+ }
+
+ if (NULL == l_pClientHandle) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Handle NULL for service: %s, session: %d.",
+ serviceName != 0 ? serviceName : NULL, uiSessionId);
+ }
+
+ return l_pClientHandle;
+}
+
+//////////////////////////////////////////
+// Function : GetNewHandleAndUpdateEventInfoTable
+//////////////////////////////////////////
+HANDLE GetNewHandleAndUpdateEventInfoTable(HANDLE hApp, PCSTR serviceName, const UI_32 uiSessionId,
+ const UI_32 uiEventId) {
+ HANDLE l_pClientHandle = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ ServiceSessionHandleTable::iterator ssh_iterator;;
+ SessionToEventInfo::iterator sh_iterator;
+
+ ssh_iterator = pApp->servicesessionhandletable.find(serviceName);
+
+ if (pApp->servicesessionhandletable.end() == ssh_iterator) {
+ SessionToEventInfo l_mSessionToEventInfoTable;
+ pApp->servicesessionhandletable.insert(make_pair(serviceName, l_mSessionToEventInfoTable));
+ }
+
+ sh_iterator = pApp->servicesessionhandletable[serviceName].find(uiSessionId);
+
+ if (pApp->servicesessionhandletable[serviceName].end() == sh_iterator) {
+ l_pClientHandle = FrameworkunifiedMcOpenSender(hApp, serviceName);
+ if (NULL != l_pClientHandle) {
+ (reinterpret_cast<MsgQInfo *>(l_pClientHandle))->sessionId = uiSessionId;
+ }
+ SessionEventInfo *l_ptSessionEventInfo = new(std::nothrow) SessionEventInfo;
+ if (NULL != l_ptSessionEventInfo) { // LCOV_EXCL_BR_LINE 5: new's error case.
+ l_ptSessionEventInfo->m_hSession = l_pClientHandle;
+ l_ptSessionEventInfo->m_vEvents.push_back(uiEventId);
+ pApp->servicesessionhandletable[serviceName].insert(std::make_pair(uiSessionId, l_ptSessionEventInfo));
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error(NULL) createing new session event info for "
+ "service:%s, session:%d, event:%d.",
+ serviceName, uiSessionId, uiEventId);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ SessionEventInfo *l_ptSessionEventInfo = sh_iterator->second;
+ if (NULL != l_ptSessionEventInfo) {
+ if (NULL == l_ptSessionEventInfo->m_hSession) {
+ l_ptSessionEventInfo->m_hSession = FrameworkunifiedMcOpenSender(hApp, serviceName);
+ if (NULL != l_ptSessionEventInfo->m_hSession) {
+ (reinterpret_cast<MsgQInfo *>(l_ptSessionEventInfo->m_hSession))->sessionId = uiSessionId;
+ }
+ }
+ l_pClientHandle = l_ptSessionEventInfo->m_hSession;
+ l_ptSessionEventInfo->m_vEvents.push_back(uiEventId);
+ }
+ }
+ }
+ return l_pClientHandle;
+}
+
+//////////////////////////////////////////
+// Function : UnregisterPrivateEvents
+//////////////////////////////////////////
+EFrameworkunifiedStatus UnregisterPrivateEvents(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // get the name of the service from which message is received
+ PCSTR l_cServiceName = pApp->cMsgSrcName;
+ const UI_32 l_uiSessionId = pApp->uiSessionId;
+
+ // number of events to unregister
+ UI_32 l_uiListSize = static_cast<UI_32>(FrameworkunifiedGetMsgLength(hApp) / sizeof(UI_32));
+
+ // check if the received service name and data is valid
+ if (NULL != l_cServiceName && 0 < l_uiListSize) {
+ PUI_32 l_pData = new(std::nothrow) UI_32[l_uiListSize];
+ UI_32 l_uiEventId = 0;
+
+ if (NULL != l_pData) { // LCOV_EXCL_BR_LINE 5: new's error case.
+ // get the list of events
+ eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, l_pData, static_cast<UI_32>(l_uiListSize * sizeof(UI_32)));
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ for (UI_32 uiCount = 0; uiCount < l_uiListSize; uiCount++) {
+ // received event id
+ l_uiEventId = l_pData[uiCount];
+
+ // remove the entry from map of Events and Session id's of services
+ eStatus = RemoveEventEntryFromEventTable(hApp, l_uiEventId, l_cServiceName, l_uiSessionId);
+ (VOID)RemoveEntryFromSessionEventInfoTable(hApp, l_cServiceName, l_uiSessionId, l_uiEventId);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, PROTOCOL_REGISTER_EVENTS Invalid data ", eStatus);
+ }
+ delete[] l_pData;
+ l_pData = NULL;
+ } else {
+ // LCOV_EXCL_START 5: new's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: PROTOCOL_UNREGISTER_EVENTS: "
+ "Unable to allocate memory for l_pData");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, PROTOCOL_UNREGISTER_EVENTS Service Name invalid ", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, Invalid hApp ", eStatus);
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : HandleSessionEventOnCloseSession
+//////////////////////////////////////////
+EFrameworkunifiedStatus HandleSessionEventOnCloseSession(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ // close session request structure
+ CloseSessionReq tClose = {};
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(tClose)) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tClose, sizeof(tClose)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, FrameworkunifiedGetMsgDataOfSize Failed ", eStatus);
+ } else {
+ CleanAllEventsOfSession(hApp, pApp->cMsgSrcName, tClose.sessionId);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid data length received:: Expected: %ld, Received: %d",
+ static_cast<long int>(sizeof(tClose)), FrameworkunifiedGetMsgLength(hApp)); // NOLINT (readability/nolint)
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid application handle status.");
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnDummy
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDummy(HANDLE hApp) {
+ return eFrameworkunifiedStatusOK;
+}
+
+#ifdef DISPATCHER_PROFILER
+EFrameworkunifiedStatus FrameworkunifiedAttachMsgProfilerCallbacksDispatcher(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp,
+ "NSProfileUtil",
+ PROTOCOL_DIS_MSGPROFILER,
+ boost::bind(&FrameworkunifiedMsgProfiler::PrintProfileInfo,
+ pApp->m_pFrameworkunifiedMsgProfiler, hApp));
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, "", "FrameworkunifiedAttachCallbackToDispatcher success for PROTOCOL_DIS_MSGPROFILER.");
+ }
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedAttachChildMsgProfilerCallbacksDispatcher(HANDLE hChildApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, "", "+");
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hChildApp);
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ eStatus = FrameworkunifiedAttachCallbackToDispatcher(hChildApp,
+ pApp->cParentAppName,
+ PROTOCOL_DIS_MSGPROFILER,
+ boost::bind(&FrameworkunifiedMsgProfiler::PrintProfileInfo,
+ pApp->m_pFrameworkunifiedMsgProfiler, hChildApp));
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, "", "FrameworkunifiedAttachCallbackToDispatcher success for PROTOCOL_DIS_MSGPROFILER.");
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, "", "-");
+ return eStatus;
+}
+#endif
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp
new file mode 100755
index 0000000..cb573c9
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_dispatch.cpp
@@ -0,0 +1,983 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <sys/epoll.h>
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_plogger_if.h>
+#include <other_service/strlcpy.h>
+
+#include <map>
+#include <utility>
+
+#include "frameworkunified_framework_core.h"
+///////////////////////////////////////////////////
+// Utility
+///////////////////////////////////////////////////
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetAppName
+//////////////////////////////////////////
+PCSTR FrameworkunifiedGetAppName(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ const CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return ((PCSTR)pApp->cAppName);
+ } else {
+ return NULL;
+ }
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSetThreadSpecificData
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetThreadSpecificData(HANDLE hApp, PVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->FrameworkData = data;
+
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetThreadSpecificData
+//////////////////////////////////////////
+PVOID FrameworkunifiedGetThreadSpecificData(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ const CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+ return pApp->FrameworkData;
+ } else {
+ return NULL;
+ }
+}
+
+
+
+template <typename K, typename V, class C, class A>
+std::ostream &operator<< (std::ostream &os, std::map<K, V, C, A> const &m) {
+ os << "{ ";
+ typename std::map<K, V, C, A>::const_iterator p;
+ for (p = m.begin(); p != m.end(); ++p) {
+ os << p->first << ":" << p->second << ", ";
+ }
+ return os << "}";
+}
+
+
+
+
+
+
+
+///////////////////////////////////////////////////
+// Service Protocol attach/detach to dispatcher
+///////////////////////////////////////////////////
+
+
+
+
+
+
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachCallbacksToDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbacksToDispatcher(HANDLE hApp, PCSTR pServiceName, const FrameworkunifiedProtocolCallbackHandler *handlers,
+ UI_32 handlerCount, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName && NULL != handlers && 0 != handlerCount) {
+ // setup callbacks
+ for (UI_32 i = 0; i < handlerCount; ++i) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, pServiceName, handlers[ i ].iCmd,
+ handlers[ i ].callBack, hSession))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+/////////////////////////////////////////////
+// Function : FrameworkunifiedAttachCallbackToDispatcher
+/////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbackToDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, CbFuncPtr fpOnCmd,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName && NULL != fpOnCmd) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ Services::iterator s_iterator;
+ SessionTable::iterator session_iterator;
+
+ UI_32 uiSessionId = 0;
+ if (hSession) {
+ uiSessionId = FrameworkunifiedGetSessionId(hSession);
+ }
+
+ // finding the service
+ s_iterator = pApp->services.find(pServiceName);
+ if (s_iterator == pApp->services.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (New service entry): service name [%s]", pApp->cAppName, pServiceName);
+ s_iterator = pApp->services.insert(std::make_pair(pServiceName, SessionTable())).first;
+ }
+
+ session_iterator = s_iterator->second.find(uiSessionId);
+ if (session_iterator == s_iterator->second.end()) {
+ session_iterator = s_iterator->second.insert(std::make_pair(uiSessionId, ServiceProtocolTable())).first;
+ }
+
+ session_iterator->second.insert(std::make_pair(iCmd, fpOnCmd));
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachCallbacksToDispatcherWithFd
+///////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbacksToDispatcherWithFd(HANDLE hApp, const FrameworkunifiedFdProtocolCallbackHandler *handlers,
+ UI_32 handlerCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != handlers && 0 != handlerCount) {
+ // setup callbacksWithFd
+ for (UI_32 i = 0; i < handlerCount; ++i) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachCallbackToDispatcherWithFd(hApp, handlers[ i ].fd,
+ handlers[ i ].callBack))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : %d, Invalid param ", eStatus);
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachCallbackToDispatcherWithFd
+///////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbackToDispatcherWithFd(HANDLE hApp, int fd, CbFuncPtr fpOnCmd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ int efd; // FD for multi waiting
+ struct epoll_event ev; // Info struct to associate with multiwaiting FD
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && 0 < fd && NULL != fpOnCmd) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // attach callbackFuncPtr and FD to FdTable.
+ pApp->fds.insert(std::make_pair(fd, fpOnCmd));
+
+ // Monitor FD by epoll.
+ efd = pApp->efd;
+ if (0 < efd) {
+ ev.events = EPOLLIN;
+ ev.data.fd = fd;
+ if (-1 == epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ev)) {
+ /**
+ * Duplicate registering the same FD in the Dispatcher causes an internal epoll_ctl errno EEXIST(val17) to be returned, which results in an error.
+ */
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(ADD) Failed, status=%d, errno=%d", eStatus, errno);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Multi waiting FD is Invalid , status=%d, efd=%d", eStatus, efd);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : %d, Invalid param ", eStatus);
+ }
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachParentCallbacksToDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachParentCallbacksToDispatcher(HANDLE hChildApp, const FrameworkunifiedProtocolCallbackHandler *handlers,
+ UI_32 handlerCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hChildApp) && NULL != handlers && 0 != handlerCount) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hChildApp);
+
+ eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hChildApp, pApp->cParentAppName, handlers, handlerCount);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachParentCallbacksFromDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachParentCallbacksFromDispatcher(HANDLE hChildApp, const PUI_32 puiCmdArray, UI_32 uiCommandCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hChildApp) && NULL != puiCmdArray && 0 != uiCommandCount) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hChildApp);
+
+ eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hChildApp, pApp->cParentAppName, puiCmdArray, uiCommandCount);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachCallbacksFromDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbacksFromDispatcher(HANDLE hApp, PCSTR pServiceName, const PUI_32 puiCmdArray,
+ UI_32 uiCommandCount, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName && NULL != puiCmdArray && 0 != uiCommandCount) {
+ // setup callbacks
+ for (UI_32 i = 0; i < uiCommandCount; ++i) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(hApp, pServiceName,
+ puiCmdArray[ i ], hSession))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+
+////////////////////////////////////////////
+// Function : FrameworkunifiedDetachCallbackFromDispatcher
+/////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbackFromDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ Services::iterator s_iterator;
+
+ UI_32 uiSessionId = 0;
+ if (hSession) {
+ uiSessionId = FrameworkunifiedGetSessionId(hSession);
+ }
+
+ // finding the service
+ s_iterator = pApp->services.find(pServiceName);
+ if (s_iterator != pApp->services.end()) {
+ SessionTable::iterator session_iterator;
+ session_iterator = (s_iterator->second).find(uiSessionId);
+ if (session_iterator != (s_iterator->second).end()) {
+ ServiceProtocolTable::iterator spt_iterator;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (found): service [%s]", pApp->cAppName, pServiceName);
+
+ spt_iterator = (session_iterator->second).find(iCmd);
+ if (spt_iterator != (session_iterator->second).end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : Detaching command [0x%X] service [%s]",
+ pApp->cAppName, iCmd, pServiceName);
+ (session_iterator->second).erase(spt_iterator);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "%s : Warning : Cmd NOT found [%d] service [%s]",
+ pApp->cAppName, iCmd, pServiceName);
+ }
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "%s : Warning : Cannot find service [%s]", pApp->cAppName, pServiceName);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachCallbacksFromDispatcherWithFd
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbacksFromDispatcherWithFd(HANDLE hApp, const int *fdArray, UI_32 uiCommandCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != fdArray && 0 != uiCommandCount) {
+ // setup callbacks
+ for (UI_32 i = 0; i < uiCommandCount; ++i) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbackFromDispatcherWithFd(hApp, fdArray[ i ]))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : %d, Invalid param ", eStatus);
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachCallbackFromDispatcherWithFd
+////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbackFromDispatcherWithFd(HANDLE hApp, int fd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && 0 < fd) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ FdTable::iterator f_iterator;
+ int efd; // FD for multi waiting
+ struct epoll_event ev; // Info struct to associate with multiwaiting FD
+
+ // finding the FD from FD table
+ f_iterator = pApp->fds.find(fd);
+ if (f_iterator != pApp->fds.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : Detaching fd [0x%x]", pApp->cAppName, fd);
+ pApp->fds.erase(f_iterator);
+
+ // Remove the monitoring of FD from multi waiting FD
+ efd = pApp->efd;
+ if (0 < efd) {
+ ev.events = EPOLLIN;
+ ev.data.fd = fd;
+ if (-1 == epoll_ctl(efd, EPOLL_CTL_DEL, fd, &ev)) {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(DEL) Failed, status=%d, errno=%d", eStatus, errno);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Multi waiting FD is Invalid , status=%d, efd=%d", eStatus, efd);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "%s : Warning : Cannot find fd [0x%x]", pApp->cAppName, fd);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error :: %d, Invalid param ", eStatus);
+ }
+
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachServiceFromDispatcher
+///////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachServiceFromDispatcher(HANDLE hApp, PCSTR pServiceName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ Services::iterator s_iterator;
+ EventServices::iterator es_iterator;
+
+ // finding the service
+ s_iterator = pApp->services.find(pServiceName);
+ if (s_iterator != pApp->services.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (found): service [%s]", pApp->cAppName, pServiceName);
+ pApp->services.erase(s_iterator);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "%s : Warning: Cannot find service [%s]", pApp->cAppName, pServiceName);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ // finding the service
+ es_iterator = pApp->eventservices.find(pServiceName);
+ if (es_iterator != pApp->eventservices.end()) {
+ eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (found): service [%s] in event map", pApp->cAppName, pServiceName);
+ pApp->eventservices.erase(es_iterator);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "%s : Warning : Cannot find service [%s] in event map",
+ pApp->cAppName, pServiceName);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////
+// Notification functions
+///////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachNotificationCallbacksToDispatcher
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationsWithCallback(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pNtfyHandler,
+ UI_32 uiHandlerCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNtfyHandler && (uiHandlerCount > 0)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ /// Deal with handling batch processing of subscriptions.
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPSubscribeToNotifications(hApp, pNtfyHandler, uiHandlerCount))) {
+ for (UI_32 i = 0; i < uiHandlerCount; ++i) {
+ // Notification names are character arrays of the MAX_STRING_SIZE_NOTIFICATION byte
+ // If there are no NULL characters in the array of Notification names, they will overrun during make_pair,
+ // so use a strlcpy that substitutes a trailing NULL character.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNtfyHandler[ i ].cNotification, MAX_STRING_SIZE_NOTIFICATION);
+ // service found
+ pApp->notifications.insert(std::make_pair(tmp_notification, pNtfyHandler[ i ].callBack));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : attaching call-back for notification [%s]", pApp->cAppName,
+ pNtfyHandler[ i ].cNotification);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to Subscribe to batch set of notifications",
+ pApp->cAppName, eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachNotificationCallbackToDispatcher
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationWithCallback(HANDLE hApp, PCSTR pNotification, CbFuncPtr fpOnCmd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification && NULL != fpOnCmd) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ NotificationTableRetStatus mRet;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPSubscribeToNotification(hApp, pNotification))) {
+ // Notification names are character arrays of the MAX_STRING_SIZE_NOTIFICATION byte
+ // If there are no NULL characters in the array of Notification names, they will overrun during make_pair,
+ // so use a strlcpy that substitutes a trailing NULL character.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNotification, MAX_STRING_SIZE_NOTIFICATION);
+
+ // service found
+ mRet = pApp->notifications.insert(std::make_pair(tmp_notification, fpOnCmd));
+ if (false == mRet.second) {
+ eStatus = eFrameworkunifiedStatusDuplicate;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s:Error:[%d] Unable to Subscribe to notification [%s]",
+ pApp->cAppName, eStatus, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s:attaching call-back for notification [%s]",
+ pApp->cAppName, pNotification);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s:Error:[%d] Unable to Subscribe to notification [%s]",
+ pApp->cAppName, eStatus, pNotification);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachNotificationCallbacksFromDispatcher
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationsWithCallback(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pNtfyHandler,
+ UI_32 uiHandlerCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ NotificationTable::iterator n_iterator;
+ PCSTR pNotification = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNtfyHandler && (uiHandlerCount > 0)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPUnsubscribeFromNotifications(hApp, pNtfyHandler, uiHandlerCount))) {
+ for (UI_32 l_unCount = 0; l_unCount < uiHandlerCount; ++l_unCount) {
+ // When registering using FrameworkunifiedSubscribeNotificationWithCallback, etc., the Nortification names NULL the 64th byte.
+ // In response to this, the UnRegister uses a strlcpy that puts a NULL in the 64th byte.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNtfyHandler[ l_unCount ].cNotification, MAX_STRING_SIZE_NOTIFICATION);
+
+ n_iterator = pApp->notifications.find(tmp_notification);
+ if (n_iterator != pApp->notifications.end()) {
+ pApp->notifications.erase(n_iterator);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : removed notification [%s]", pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : Cannot find notification [%s]", pApp->cAppName,
+ pNotification != 0 ? pNotification : NULL);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : detaching call-back for notification [%s]", pApp->cAppName,
+ pNotification != 0 ? pNotification : NULL);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to UnSubscribe from notifications ", pApp->cAppName,
+ eFrameworkunifiedStatusOK);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachNotificationCallbackToDispatcher
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationWithCallback(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ NotificationTable::iterator n_iterator;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPUnsubscribeFromNotification(hApp, pNotification))) {
+ // \todo : error handling on all map function calls
+
+ // When registering using FrameworkunifiedSubscribeNotificationWithCallback, etc., the Nortification names NULL the 64th byte.
+ // In response to this, the UnRegister uses a strlcpy that puts a NULL in the 64th byte.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNotification, MAX_STRING_SIZE_NOTIFICATION);
+
+ n_iterator = pApp->notifications.find(tmp_notification);
+ if (n_iterator != pApp->notifications.end()) {
+ pApp->notifications.erase(n_iterator);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s:removed notification [%s]", pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s:Error:Cannot find notification [%s]", pApp->cAppName, pNotification);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s:Error:[%d] Unable to UnSubscribe from notification [%s]",
+ pApp->cAppName, eStatus, pNotification);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////
+// Defer Message functions
+///////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedGetDeferQueueCnt
+////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetDeferQueueCnt(HANDLE hApp) {
+ UI_32 l_uiCnt = 0;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ l_uiCnt = static_cast<UI_32>(pApp->deferedMsgQueue.size());
+ }
+
+ return l_uiCnt;
+}
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedIsDeferQueueEmpty
+////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsDeferQueueEmpty(HANDLE hApp) {
+ BOOL l_bIsQEmpty = TRUE;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ l_bIsQEmpty = static_cast<BOOL>(pApp->deferedMsgQueue.empty());
+ }
+
+ return l_bIsQEmpty;
+}
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedDeferMessage
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDeferMessage(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ DeferedMsgInfo defer(pApp->uiProtocolCmd, pApp->cMsgSrcName, pApp->uiMsgRcvBuffer);
+ pApp->deferedMsgQueue.push(defer);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedClearDeferMessages
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedClearDeferMessages(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // clear the pop flag!
+ pApp->fPopDeferedMsg = FALSE;
+
+ // remove all items from the queue!
+ while (!pApp->deferedMsgQueue.empty()) {
+ pApp->deferedMsgQueue.pop();
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////
+// Function : FrameworkunifiedRetrieveDeferMessage
+////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRetrieveDeferMessage(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ uint64_t data = 1;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->fPopDeferedMsg = pApp->deferedMsgQueue.empty() ? FALSE : TRUE;
+ if (pApp->fPopDeferedMsg) {
+ if (-1 == (write(pApp->defer_evfd, &data, sizeof(uint64_t)))) {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : write Failed, status=%d, errno=%d, defer_evfd=%d",
+ eStatus, errno, pApp->defer_evfd);
+ }
+ }
+
+
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedIsStateMachineApp
+/// Returns TRUE if it's a state machine application else FALSE.
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsStateMachineApp(HANDLE hApp) {
+ BOOL l_bIsStateMachine = FALSE;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (NULL != pApp->m_pFrameworkunifiedStateMachine) {
+ l_bIsStateMachine = TRUE;
+ }
+ }
+
+ return l_bIsStateMachine;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetXMLConfigHandle
+/// Returns the handle to config file handle
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetXMLConfigHandle(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __PRETTY_FUNCTION__, "This function is not implemented!!!!");
+ return NULL;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedSetMandatoryServiceInfo(HANDLE hApp, PCSTR pNotification, UI_32 uiEventId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ ServiceNotificationInfo objNotification = {};
+ if (strlen(pNotification) < MAX_STRING_SIZE_NOTIFICATION) {
+ strlcpy(objNotification.sNotificationName, pNotification, sizeof(objNotification.sNotificationName));
+ objNotification.uiEventId = uiEventId;
+ pApp->servicenotificationlist.push_back(objNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ " Error : Aborting ... Exceeds Max Notification name size MAX_STRING_SIZE_NOTIFICATION : %d ",
+ MAX_STRING_SIZE_NOTIFICATION);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+BOOL FrameworkunifiedIsServiceAvailable(HANDLE hApp) {
+ BOOL l_bIsServiceAvailable = FALSE;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ // Publish notification
+ ServiceAvailability tServiceAvailability = {};
+
+ UI_32 l_uiLength = FrameworkunifiedGetMsgLength(hApp);
+
+ if (sizeof(tServiceAvailability) == l_uiLength) {
+ // Read the data from the message
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedGetMsgDataOfSize(hApp, &tServiceAvailability, sizeof(tServiceAvailability))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
+ } else {
+ // Check the Service availability
+ if (eFrameworkunifiedServiceAvailable == tServiceAvailability.eServiceAvailability) {
+ l_bIsServiceAvailable = TRUE;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error: Received message data size not matched :: %d", l_uiLength);
+ }
+ }
+
+ return l_bIsServiceAvailable;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedPublishServiceAvailability(HANDLE hApp, BOOL bIsAvailable) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (strlen(pApp->sServiceAvailabilityNotification)) {
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ pApp->bIsAvailable = bIsAvailable;
+ ServiceAvailability tServiceAvailability = {};
+ strlcpy(tServiceAvailability.cServiceName, FrameworkunifiedGetAppName(hApp), sizeof(tServiceAvailability.cServiceName));
+
+ if (bIsAvailable) {
+ tServiceAvailability.eServiceAvailability = eFrameworkunifiedServiceAvailable;
+ } else {
+ tServiceAvailability.eServiceAvailability = eFrameworkunifiedServiceNotAvailable;
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedNPPublishNotification(hApp, pApp->sServiceAvailabilityNotification,
+ &tServiceAvailability, sizeof(tServiceAvailability)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__,
+ "Failed to Publish notification: %s, status: %d", pApp->sServiceAvailabilityNotification, eStatus);
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE("Service Availability Status: %s, ERRORED %d", bIsAvailable ? "TRUE" : "FALSE", eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE("Service Availability Status: %s", bIsAvailable ? "TRUE" : "FALSE");
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__,
+ "Publish availability notfn:%s, status:%s", pApp->sServiceAvailabilityNotification,
+ bIsAvailable ? "TRUE" : "FALSE");
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+BOOL FrameworkunifiedGetSelfAvailability(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return pApp->bIsAvailable;
+ }
+
+ return FALSE;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedRegisterServiceAvailabilityNotification(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (strlen(pNotification) < MAX_STRING_SIZE_NOTIFICATION) {
+ strlcpy(pApp->sServiceAvailabilityNotification, pNotification, sizeof(pApp->sServiceAvailabilityNotification));
+
+ // Register Notifications
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedNPRegisterNotification(hApp, pNotification,
+ sizeof(ServiceAvailability), eFrameworkunifiedStateVar))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedNPRegisterNotifications %s Failed Status:0x%x ", pNotification, eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "FrameworkunifiedNPRegisterNotifications %s success Status:0x%x ",
+ pNotification, eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ " Error : Aborting ... Exceeds Max Notification name size MAX_STRING_SIZE_NOTIFICATION : %d ",
+ MAX_STRING_SIZE_NOTIFICATION);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterServiceAvailabilityNotification(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // Register Notifications
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedNPUnRegisterNotification(hApp, pApp->sServiceAvailabilityNotification))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedNPUnRegisterNotifications %s Failed Status:0x%x ",
+ pApp->sServiceAvailabilityNotification != 0 ? pApp->sServiceAvailabilityNotification : NULL, eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "FrameworkunifiedNPUnRegisterNotifications %s success Status:0x%x ",
+ pApp->sServiceAvailabilityNotification, eStatus);
+ }
+ memset(pApp->sServiceAvailabilityNotification, 0, MAX_SYS_INFO_SIZE);
+ pApp->bIsAvailable = FALSE;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetServiceNameOnServiceAvailabilityNotification
+/// To be used when client receives service availability notification to get the available
+/// service name.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetServiceNameOnServiceAvailabilityNotification(HANDLE hApp, PSTR pServiceName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ // Publish notification
+ ServiceAvailability tServiceAvailability;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName) {
+ UI_32 l_uiLength = FrameworkunifiedGetMsgLength(hApp);
+
+ if (sizeof(tServiceAvailability) == l_uiLength) {
+ // Read the data from the message
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tServiceAvailability, sizeof(tServiceAvailability)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ if (NULL == std::strncpy(pServiceName, tServiceAvailability.cServiceName, MAX_NAME_SIZE_APP)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " strcpy failed Failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Error: Received message data size not matched :: %d", l_uiLength);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetCurrentUser
+//////////////////////////////////////////
+HANDLE FrameworkunifiedGetCurrentUser(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ const CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return pApp->hUser;
+ } else {
+ return NULL;
+ }
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSetUser
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetUser(HANDLE hApp, HANDLE hUser) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pApp->hUser = hUser;
+ return eFrameworkunifiedStatusOK;
+ } else {
+ return eFrameworkunifiedStatusFail;
+ }
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSetAppData
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetAppData(HANDLE hApp, PCSTR pKey, PVOID pData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ // Insert the data element
+ std::pair<AppData::iterator, bool> l_tRet = pApp->appdata.insert(std::make_pair(pKey, pData));
+ if (false == l_tRet.second) {
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetAppData
+//////////////////////////////////////////
+PVOID FrameworkunifiedGetAppData(HANDLE hApp, PCSTR pKey) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ AppData::iterator n_iterator = pApp->appdata.find(pKey);
+ if (n_iterator != pApp->appdata.end()) {
+ return n_iterator->second;
+ }
+ }
+ return NULL;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedRemoveAppData
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRemoveAppData(HANDLE hApp, PCSTR pKey) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ AppData::iterator n_iterator = pApp->appdata.find(pKey);
+ if (n_iterator != pApp->appdata.end()) {
+ pApp->appdata.erase(n_iterator);
+
+ eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ return eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_error.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_error.cpp
new file mode 100755
index 0000000..cf07922
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_error.cpp
@@ -0,0 +1,130 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <native_service/frameworkunified_framework_error.hpp>
+#include <cstdio>
+#include <string>
+#include "frameworkunified_framework_error_internal.hpp"
+
+// using std::snprintf;
+typedef std::string TErrorDesc;
+typedef const TErrorDesc TCErrorDesc;
+
+namespace {
+
+PCSTR FrameworkunifiedStatusDesc(EFrameworkunifiedStatus status) {
+ switch (status) {
+ case eFrameworkunifiedStatusSessionLimitMaxedOut:
+ return "Session limit maxed out";
+ case eFrameworkunifiedStatusDbRecNotFound:
+ return "Db record not Found";
+ case eFrameworkunifiedStatusDbResultError:
+ return "Db result error";
+ case eFrameworkunifiedStatusDbExecuteFail:
+ return "Db execute failure";
+ case eFrameworkunifiedStatusSemCloseFail:
+ return "Semaphore close failure";
+ case eFrameworkunifiedStatusSemUnlockFail:
+ return "Semaphore unlock gailure";
+ case eFrameworkunifiedStatusSemLockFail:
+ return "Semaphore lock failure";
+ case eFrameworkunifiedStatusFail:
+ return "failure";
+ case eFrameworkunifiedStatusOK:
+ return "Status OK";
+ case eFrameworkunifiedStatusInvldBuf:
+ return "Invalid buffer";
+ case eFrameworkunifiedStatusInvldHandle:
+ return "Invalid handle";
+ case eFrameworkunifiedStatusInvldHndlType:
+ return "Invalid handle yype";
+ case eFrameworkunifiedStatusInvldQName:
+ return "Invalid queue name";
+ case eFrameworkunifiedStatusMsgQFull:
+ return "Message queue full";
+ case eFrameworkunifiedStatusInvldNotification:
+ return "Invliad notification";
+ case eFrameworkunifiedStatusInvldParam:
+ return "Invalid parameter";
+ case eFrameworkunifiedStatusInvldBufSize:
+ return "Invalid buffer size";
+ case eFrameworkunifiedStatusInvldID:
+ return "Invalid MemID";
+ case eFrameworkunifiedStatusCannotRelease:
+ return "Cannot release resource";
+ case eFrameworkunifiedStatusBadConnection:
+ return "Bad connection";
+ case eFrameworkunifiedStatusExit:
+ return "Exit";
+ case eFrameworkunifiedStatusNotImplemented:
+ return "Not implemented";
+ case eFrameworkunifiedStatusThreadBusy:
+ return "Thread busy";
+ case eFrameworkunifiedStatusThreadSelfJoin:
+ return "Attempted to self-join";
+ case eFrameworkunifiedStatusThreadInvalidVal:
+ return "Invalid value passed";
+ case eFrameworkunifiedStatusThreadNotExist:
+ return "Thread does not exist";
+ case eFrameworkunifiedStatusFault:
+ return "Fault";
+ case eFrameworkunifiedStatusServNotFound:
+ return "Service not found";
+ case eFrameworkunifiedStatusErrOther:
+ default:
+ return "Other error";
+ }
+}
+
+TCErrorDesc BuildFrameworkunifiedErrorDesc(EFrameworkunifiedStatus error, PCSTR errorMsg) {
+ CHAR buf[ MAX_QUEUE_MSG_SIZE ] = {};
+ snprintf(&buf[ 0 ],
+ MAX_QUEUE_MSG_SIZE,
+ "Framework Error: %s - %s",
+ FrameworkunifiedStatusDesc(error),
+ errorMsg != 0 ? errorMsg : NULL);
+ return TErrorDesc(&buf[ 0 ]);
+}
+
+TCErrorDesc BuildFrameworkunifiedSystemErrorDesc(EFrameworkunifiedSystemError error, PCSTR errorMsg) {
+ TErrorDesc l_cErrorMsg("Framework defined error desc: ");
+
+ switch (error) {
+ // Commented, because this is product specific error. Must handle by SystemServices only.
+ // case eFrameworkunifiedDSPHardwareReset : l_cErrorMsg.append("DSP HW RESET ERROR"); break;
+ default:
+ l_cErrorMsg.append("Other error");
+ break;
+ }
+
+ l_cErrorMsg.append(" :: Application provided error desc:");
+ l_cErrorMsg.append(errorMsg);
+ return l_cErrorMsg;
+}
+
+} // end namespace
+
+
+
+frameworkunified::framework::error::error::error(EFrameworkunifiedStatus error, PCSTR errorMsg)
+ : std::runtime_error(BuildFrameworkunifiedErrorDesc(error, errorMsg)),
+ m_error(error) {
+}
+
+frameworkunified::framework::error::CSystemError::CSystemError(EFrameworkunifiedSystemError error, PCSTR errorMsg)
+ : std::runtime_error(BuildFrameworkunifiedSystemErrorDesc(error, errorMsg)),
+ m_eSystemError(error) {
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_logger.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_logger.cpp
new file mode 100755
index 0000000..2912527
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_logger.cpp
@@ -0,0 +1,575 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Framework wrapper over the logger interface APIs
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_rcs_logger_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/nslogutil_cmd_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <cstdio>
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+#include "frameworkunified_framework_utility.h"
+
+FrameworkunifiedProtocolCallbackHandler rcs_logging_callbacks[] = {
+ { NSRCS_SET_LOG_SETTINGS_REQ, NSRcsSetLogSettings },
+ { NSRCS_GET_LOG_SETTINGS_REQ, NSRcsGetLogSettings },
+ { NSRCS_SET_LOG_MASK_REQ, NSRcsSetLogMask },
+ { NSRCS_SET_LOG_OUT_OPT_REQ, NSRcsSetOutputLogOpts },
+ { NSRCS_SET_LOG_SEVERITY_REQ, NSRcsSetLogSeverity },
+};
+
+
+FrameworkunifiedProtocolCallbackHandler logging_callbacks[] = {
+ { SET_LOG_MASK, FrameworkunifiedSetLogMask },
+ { GET_LOG_MASK, FrameworkunifiedGetLogMask },
+ { SET_LOG_OUT_OPT, FrameworkunifiedSetOutputLogOpts },
+ { GET_LOG_OUT_OPT, FrameworkunifiedGetOutputLogOpts },
+ // { kDebugDumpRequest, FrameworkunifiedDebugDumpRequest }, /// < Added to help Debug Issues with in CCR Radio
+ // Callback attach with frameworkunifieddebug is moved to SystemServices
+ { SET_LOG_SEVERITY, FrameworkunifiedSetLogSeverity },
+ { GET_LOG_SEVERITY, FrameworkunifiedGetLogSeverity },
+};
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachLoggerCallbacksDispatcher(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp, "nslogutil", logging_callbacks,
+ static_cast<UI_32>(_countof(logging_callbacks)));
+ // Callback attach with of kDebugDumpRequest with frameworkunifieddebug is moved to SystemServices. Keep only nslogutil.
+ eStatus = (eStatus != eFrameworkunifiedStatusOK) ? eStatus : FrameworkunifiedAttachCallbackToDispatcher(hApp, "nslogutil", kDebugDumpRequest,
+ FrameworkunifiedDebugDumpRequest);
+ eStatus = (eStatus != eFrameworkunifiedStatusOK) ? eStatus : FrameworkunifiedAttachCallbacksToDispatcher(hApp,
+ "SS_LoggerService",
+ logging_callbacks,
+ static_cast<UI_32>(_countof(logging_callbacks)));
+ eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_LOGGER_SETCONTROLMASK, FrameworkunifiedSetLogMask);
+
+ // This is optional only for remote control service. Therefore return value not checked
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbacksToDispatcher(hApp, FRAMEWORKUNIFIED_NS_REMOTECONTROLSERVICE, rcs_logging_callbacks,
+ static_cast<UI_32>(_countof(rcs_logging_callbacks)))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_WAR, __FUNCTION__,
+ " FrameworkunifiedAttachCallbacksToDispatcher failed for rcs_logging_callbacks with FRAMEWORKUNIFIED_NS_REMOTECONTROLSERVICE");
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetLogMask(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CHANGELOGPARAMS chngLogOpts;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(CHANGELOGPARAMS)) {
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&chngLogOpts, sizeof(chngLogOpts))) {
+ // Set the mask to the value that was just sent.
+ NsLogSetControlMask(chngLogOpts.uiZoneMask);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Retervial of Data Failed");
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Incorrect message sz");
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetLogMask(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ PCSTR pAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR pSrcName = FrameworkunifiedGetMsgSrc(hApp);
+
+ if (NULL != pAppName && NULL != pSrcName) {
+ HANDLE echoBack = McOpenSender(pSrcName);
+ if (NULL != echoBack) {
+ CHANGELOGPARAMS chng_log_params;
+
+ NsLogGetControlMask(chng_log_params.uiZoneMask);
+ if (eFrameworkunifiedStatusOK != (eStatus = McSend(echoBack, pAppName, GET_LOG_MASK_RESPONSE, sizeof(chng_log_params),
+ &chng_log_params))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Error sending message GET_LOG_MASK_RESPONSE");
+ }
+
+ McClose(echoBack);
+ echoBack = NULL;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetOutputLogOpts(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CHANGELOGPARAMS chngLogOpts;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(CHANGELOGPARAMS)) {
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&chngLogOpts, sizeof(chngLogOpts))) {
+ // Set the logging method to the value that was just received.
+ NsLogSetLogMethod(chngLogOpts.uiLogOptions);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Retervial of Data Failed");
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Incorrect message sz");
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ }
+
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetOutputLogOpts(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ PCSTR pAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR pSrcName = FrameworkunifiedGetMsgSrc(hApp);
+
+ if (NULL != pAppName && NULL != pSrcName) {
+ HANDLE echoBack = McOpenSender(pSrcName);
+
+ if (NULL != echoBack) {
+ CHANGELOGPARAMS chng_log_params;
+
+ chng_log_params.uiLogOptions = NsLogGetLogMethod();
+ if (eFrameworkunifiedStatusOK != (eStatus = McSend(echoBack, pAppName, GET_LOG_OUT_OPT_RESPONSE, sizeof(chng_log_params),
+ &chng_log_params))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Error sending message GET_LOG_OUT_OPT_RESPONSE");
+ }
+
+ McClose(echoBack);
+ echoBack = NULL;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSetLogSeverity
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetLogSeverity(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CHANGELOGPARAMS l_tChngLogOpts = {};
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(CHANGELOGPARAMS)) {
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tChngLogOpts, sizeof(l_tChngLogOpts))) {
+ // Set the logging method to the value that was just received.
+ NsLogSetSeverity(l_tChngLogOpts.eSeverity);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of log severity data Failed");
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size CHANGELOGPARAMS");
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetLogSeverity
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetLogSeverity(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+
+ if (NULL != l_cAppName && NULL != l_cSrcName) {
+ HANDLE l_hEchoBack = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hEchoBack) {
+ CHANGELOGPARAMS l_tChngLogParams = {};
+
+ l_tChngLogParams.eSeverity = NsLogGetSeverity();
+ if (eFrameworkunifiedStatusOK != (eStatus = McSend(l_hEchoBack, l_cAppName, GET_LOG_SEVERITY_RESPONSE,
+ sizeof(l_tChngLogParams), &l_tChngLogParams))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Error sending message GET_LOG_OUT_OPT_RESPONSE");
+ }
+
+ McClose(l_hEchoBack);
+ l_hEchoBack = NULL;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDebugDumpRequest: Calls an Applications FrameworkunifiedOnDebugDump method.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDebugDumpRequest(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DEBUG_DUMP, __FUNCTION__, "+");
+ eStatus = FrameworkunifiedOnDebugDumpInternal(hApp);
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DEBUG_DUMP, __FUNCTION__, "+");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus NSRcsSetLogSettings(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(TNSRCS_SetLogSettingsReq)) {
+ TNSRCS_SetLogSettingsReq l_tSetLogSettings = {};
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tSetLogSettings, sizeof(l_tSetLogSettings))) {
+ // Set the log mask
+ NsLogSetControlMask(l_tSetLogSettings.m_pui32ZoneMask);
+ // set the log output option
+ NsLogSetLogMethod(l_tSetLogSettings.m_ui8OutputLogOption);
+ // set the log severity
+ NsLogSetSeverity(l_tSetLogSettings.m_si32Severity);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Log settings applied");
+
+ // send the response back with the current settings
+ TNSRCS_SetLogSettingsResp l_tSetLogSettingsResp = {};
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ HANDLE l_hSendTo = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hSendTo) {
+ l_tSetLogSettingsResp.m_ui8ClientId = l_tSetLogSettings.m_ui8ClientId;
+ l_tSetLogSettingsResp.m_ui8SetStatus = static_cast<UI_8>(eFrameworkunifiedStatusOK);
+
+ NsLogGetControlMask(l_tSetLogSettingsResp.m_pui32ZoneMask);
+ l_tSetLogSettingsResp.m_ui8OutputLogOption = NsLogGetLogMethod();
+ l_tSetLogSettingsResp.m_si32Severity = NsLogGetSeverity();
+
+ if (eFrameworkunifiedStatusOK !=
+ McSend(l_hSendTo, l_cAppName, NSRCS_SET_LOG_SETTINGS_RESP,
+ sizeof(TNSRCS_SetLogSettingsResp), &l_tSetLogSettingsResp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending message "
+ "NSRCS_SET_LOG_SETTINGS_RESP to %s", l_cSrcName);
+ }
+ McClose(l_hSendTo);
+ l_hSendTo = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Sender handle NULL when sending response to %s", l_cSrcName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of Data Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size. Received: %d expected: %ld",
+ FrameworkunifiedGetMsgLength(hApp),
+ static_cast<long int>(sizeof(TNSRCS_SetLogSettingsReq))); // NOLINT (readability/nolint)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus NSRcsGetLogSettings(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(TNSRCS_GetLogSettingsReq)) {
+ TNSRCS_GetLogSettingsReq l_tGetLogSettings = {};
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tGetLogSettings, sizeof(l_tGetLogSettings))) {
+ // send the response back with the current settings
+ TNSRCS_GetLogSettingsResp l_tGetLogSettingsResp = {};
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ HANDLE l_hSendTo = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hSendTo) {
+ l_tGetLogSettingsResp.m_ui8ClientId = l_tGetLogSettings.m_ui8ClientId;
+ NsLogGetZoneTextList(l_tGetLogSettingsResp.m_cZoneList);
+ NsLogGetControlMask(l_tGetLogSettingsResp.m_pui32ZoneMask);
+ l_tGetLogSettingsResp.m_ui8OutputLogOption = NsLogGetLogMethod();
+ l_tGetLogSettingsResp.m_si32Severity = NsLogGetSeverity();
+
+ if (eFrameworkunifiedStatusOK !=
+ McSend(l_hSendTo, l_cAppName, NSRCS_GET_LOG_SETTINGS_RESP,
+ sizeof(TNSRCS_GetLogSettingsResp), &l_tGetLogSettingsResp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending message "
+ "NSRCS_GET_LOG_SETTINGS_RESP to %s", l_cSrcName);
+ }
+ McClose(l_hSendTo);
+ l_hSendTo = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Sender handle NULL when sending response to %s", l_cSrcName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of Data Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size. Received: %d expected: %ld",
+ FrameworkunifiedGetMsgLength(hApp),
+ static_cast<long int>(sizeof(TNSRCS_GetLogSettingsReq))); // NOLINT (readability/nolint)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus NSRcsSetLogMask(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(TNSRCS_SetLogSettingsReq)) {
+ TNSRCS_SetLogSettingsReq l_tSetLogSettings = {};
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tSetLogSettings, sizeof(l_tSetLogSettings))) {
+ // Set the log mask
+ NsLogSetControlMask(l_tSetLogSettings.m_pui32ZoneMask);
+
+ // 11 = number of chars in UI_32, 1 - nul char at the end
+ CHAR l_cOutMask[(ZONE_MASK_ARRAY_ELTS * 11) + 1] = {};
+ CHAR l_cMask[12] = {}; // 12 = 11+1: 11 = number of chars in UI_32, 1 - nul char at the end
+ for (UI_32 zoneIndex = 0; zoneIndex < ZONE_MASK_ARRAY_ELTS; zoneIndex++) {
+ std::strncpy(l_cMask, "", 11);
+ snprintf(l_cMask, sizeof(l_cMask), "0x%X,", l_tSetLogSettings.m_pui32ZoneMask[zoneIndex]);
+ std::strncat(l_cOutMask, l_cMask, (sizeof(l_cOutMask) - std::strlen(l_cMask) - 1));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Log settings (zone mask) applied: %s", l_cOutMask);
+
+ // send the response back with the current settings
+ TNSRCS_SetLogMaskResp l_tSetLogMaskResp = {};
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ HANDLE l_hSendTo = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hSendTo) {
+ l_tSetLogMaskResp.m_ui8ClientId = l_tSetLogSettings.m_ui8ClientId;
+ l_tSetLogMaskResp.m_ui8SetStatus = static_cast<UI_8>(eFrameworkunifiedStatusOK);
+
+ NsLogGetControlMask(l_tSetLogMaskResp.m_pui32ZoneMask);
+
+ if (eFrameworkunifiedStatusOK !=
+ McSend(l_hSendTo, l_cAppName, NSRCS_SET_LOG_MASK_RESP,
+ sizeof(TNSRCS_SetLogMaskResp), &l_tSetLogMaskResp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending message "
+ "NSRCS_SET_LOG_MASK_RESP to %s", l_cSrcName);
+ }
+ McClose(l_hSendTo);
+ l_hSendTo = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Sender handle NULL when sending response to %s", l_cSrcName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of Data Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size. Received: %d expected: %ld",
+ FrameworkunifiedGetMsgLength(hApp),
+ static_cast<long int>(sizeof(TNSRCS_SetLogSettingsReq))); // NOLINT (readability/nolint)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus NSRcsSetOutputLogOpts(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(TNSRCS_SetLogSettingsReq)) {
+ TNSRCS_SetLogSettingsReq l_tSetLogSettings = {};
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tSetLogSettings, sizeof(l_tSetLogSettings))) {
+ // set the log output option
+ NsLogSetLogMethod(l_tSetLogSettings.m_ui8OutputLogOption);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Log settings(log output option) applied: %d.",
+ l_tSetLogSettings.m_ui8OutputLogOption);
+
+ // send the response back with the current settings
+ TNSRCS_SetLogOutOptResp l_tSetLogOutputOptResp = {};
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ HANDLE l_hSendTo = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hSendTo) {
+ l_tSetLogOutputOptResp.m_ui8ClientId = l_tSetLogSettings.m_ui8ClientId;
+ l_tSetLogOutputOptResp.m_ui8SetStatus = static_cast<UI_8>(eFrameworkunifiedStatusOK);
+
+ l_tSetLogOutputOptResp.m_ui8OutputLogOption = NsLogGetLogMethod();
+
+ if (eFrameworkunifiedStatusOK !=
+ McSend(l_hSendTo, l_cAppName, NSRCS_SET_LOG_OUT_OPT_RESP,
+ sizeof(TNSRCS_SetLogOutOptResp), &l_tSetLogOutputOptResp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending message "
+ "NSRCS_SET_LOG_OUT_OPT_RESP to %s", l_cSrcName);
+ }
+ McClose(l_hSendTo);
+ l_hSendTo = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Sender handle NULL when sending response to %s", l_cSrcName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of Data Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size. Received: %d expected: %ld",
+ FrameworkunifiedGetMsgLength(hApp),
+ static_cast<long int>(sizeof(TNSRCS_SetLogSettingsReq))); // NOLINT (readability/nolint)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus NSRcsSetLogSeverity(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (FrameworkunifiedGetMsgLength(hApp) == sizeof(TNSRCS_SetLogSettingsReq)) {
+ TNSRCS_SetLogSettingsReq l_tSetLogSettings = {};
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&l_tSetLogSettings, sizeof(l_tSetLogSettings))) {
+ // set the log severity
+ NsLogSetSeverity(l_tSetLogSettings.m_si32Severity);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Log settings(log severity) applied: %d.",
+ l_tSetLogSettings.m_si32Severity);
+
+ // send the response back with the current settings
+ TNSRCS_SetLogSeverityResp l_tSetLogSeverityResp = {};
+ PCSTR l_cAppName = FrameworkunifiedGetAppName(hApp);
+ PCSTR l_cSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ HANDLE l_hSendTo = McOpenSender(l_cSrcName);
+
+ if (NULL != l_hSendTo) {
+ l_tSetLogSeverityResp.m_ui8ClientId = l_tSetLogSettings.m_ui8ClientId;
+ l_tSetLogSeverityResp.m_ui8SetStatus = static_cast<UI_8>(eFrameworkunifiedStatusOK);
+
+ l_tSetLogSeverityResp.m_si32Severity = NsLogGetSeverity();
+
+ if (eFrameworkunifiedStatusOK !=
+ McSend(l_hSendTo, l_cAppName, NSRCS_SET_LOG_SEVERITY_RESP,
+ sizeof(TNSRCS_SetLogSeverityResp), &l_tSetLogSeverityResp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending message "
+ "NSRCS_SET_LOG_SEVERITY_RESP to %s", l_cSrcName);
+ }
+ McClose(l_hSendTo);
+ l_hSendTo = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Sender handle NULL when sending response to %s", l_cSrcName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Retrieval of Data Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Incorrect message size. Received: %d expected: %ld",
+ FrameworkunifiedGetMsgLength(hApp),
+ static_cast<long int>(sizeof(TNSRCS_SetLogSettingsReq))); // NOLINT (readability/nolint)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp
new file mode 100755
index 0000000..ea953c9
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_message_center.cpp
@@ -0,0 +1,502 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <other_service/strlcpy.h>
+#include "frameworkunified_framework_core.h"
+#include "ns_mc_internal.h"
+
+using std::malloc;
+using std::free;
+using std::strcpy;
+using std::strlen;
+using std::memset;
+
+extern __thread HANDLE responseWaitQ;
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedMcOpenSender
+//////////////////////////////////////////
+HANDLE FrameworkunifiedMcOpenSender(HANDLE hApp, PCSTR pName) {
+ MsgQInfo *pMsgQ = NULL;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pName)) {
+ UI_32 l_ui32SrvNameLen = static_cast<UI_32>(strlen(pName));
+ /**
+ * @todo
+ * CHAR cSessionName[MAX_QUEUE_NAME_SIZE] cannot be determined to be 20 bytes including the termination NULL.
+ */
+ if ((l_ui32SrvNameLen < MAX_NAME_SIZE_APP) && (l_ui32SrvNameLen > 0)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ pMsgQ = reinterpret_cast<MsgQInfo *>(malloc(sizeof(MsgQInfo)));
+
+ if (NULL != pMsgQ) { // LCOV_EXCL_BR_LINE 5:malloc's error case.
+ errno = EOK; // flush previous errors, if any.
+ memset(pMsgQ, 0, sizeof(MsgQInfo));
+ if (NULL == (pMsgQ->hMsgQ = McOpenSender(pName))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Error::errno:%d, hApp:0x%p, %s failed to McOpenSender",
+ errno, hApp, pName);
+ free(pMsgQ);
+ pMsgQ = NULL;
+ } else {
+ pMsgQ->checkCode = MSGQ_CHECK_CODE;
+ pMsgQ->self = pthread_self();
+ strlcpy(pMsgQ->cSrcName, pApp->cAppName, sizeof(pMsgQ->cSrcName));
+ strlcpy(pMsgQ->cMsgQName, pName, sizeof(pMsgQ->cMsgQName));
+ pMsgQ->sessionId = 0;
+ }
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Invalid param. Name:%s, Following must be true: %d > len of passed name(%u) > 0.",
+ pName, MAX_NAME_SIZE_APP, l_ui32SrvNameLen);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Invalid param. hApp:0x%p, name:0x%p",
+ hApp, pName); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ return static_cast<HANDLE>(pMsgQ);
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedMcClose
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedMcClose(HANDLE hService) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidMsgQ(hService)) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(hService);
+ pMsgQ->checkCode = 0;
+ if (NULL != pMsgQ->hMsgQ) {
+ eStatus = McClose(pMsgQ->hMsgQ);
+ pMsgQ->hMsgQ = NULL;
+ }
+ free(pMsgQ);
+ pMsgQ = NULL;
+ hService = NULL; // This has no effect because hService is not passed as reference.
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSendMsg
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendMsg(HANDLE hService, UI_32 iCmd, UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidMsgQ(hService)) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(hService);
+
+ if ((NULL != pMsgQ->hMsgQ) && (0 != std::strlen(pMsgQ->cSrcName))) {
+ eStatus = McSendWithSession(pMsgQ->hMsgQ, pMsgQ->cSrcName, iCmd, length, data, pMsgQ->sessionId);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ // check if McSendWithSession failed with error destination msg queue full
+ // log the information
+ if (eFrameworkunifiedStatusMsgQFull == eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error!! Message queue full of receiver '%s' while sending CmdId = 0x%X",
+ FrameworkunifiedGetSessionName(hService), iCmd);
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedSendPriorityMsg
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendPriorityMsg(HANDLE hService, UI_32 iCmd, UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidMsgQ(hService)) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(hService);
+ eStatus = McSendWithPriority(pMsgQ->hMsgQ, pMsgQ->cSrcName, iCmd,
+ length, data, eFrameworkunifiedMsgPrioEmergency, pMsgQ->sessionId);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function: FrameworkunifiedSendSelf
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendSelf(HANDLE hApp, UI_32 iCmd, UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+ eStatus = McSend(pApp->hAppSndMsgQ, &pApp->cAppName[ 0 ], iCmd, length, data);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedInvokeSync
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedInvokeSync(HANDLE hService, UI_32 iCmd, UI_32 msgLenght, PCVOID msgData, UI_32 responseLength,
+ PVOID responseData, UI_32 *receivedLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidMsgQ(hService)) {
+ if (NULL != receivedLength) {
+ MsgQInfo *pMsgQ = static_cast<MsgQInfo *>(hService);
+
+ if (responseWaitQ == NULL) {
+ char mc_invoker_name[MAX_QUEUE_NAME_SIZE];
+ InvokerName invokerName;
+ // LCOV_EXCL_BR_START 11:except branch
+ McCreateInvokerName(pMsgQ->cSrcName, pMsgQ->sessionId, mc_invoker_name, sizeof(mc_invoker_name));
+ // LCOV_EXCL_BR_STOP
+ invokerName = mc_invoker_name;
+
+ responseWaitQ = McOpenSyncReceiver(invokerName.c_str());
+ if (NULL == responseWaitQ) {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ if (eStatus == eFrameworkunifiedStatusOK) {
+ eStatus = McInvokeSync(pMsgQ->hMsgQ, pMsgQ->cSrcName, iCmd, msgLenght, msgData, pMsgQ->sessionId,
+ responseWaitQ, responseLength, responseData, receivedLength);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : frameworkunifiedSendSyncResponse
+//////////////////////////////////////////
+EFrameworkunifiedStatus frameworkunifiedSendSyncResponse(HANDLE hApp, UI_32 iCmd, UI_32 seq_id, EFrameworkunifiedStatus retValue, UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ HANDLE responseSendQ;
+
+ char mc_invoker_name[MAX_QUEUE_NAME_SIZE];
+ InvokerName invokerName;
+ PVOID rcv_buf = static_cast<PVOID>(pApp->uiMsgRcvBuffer);
+ McCreateInvokerName(McGetMsgSrc(rcv_buf), mcGetMsgSsessionId(rcv_buf), mc_invoker_name, sizeof(mc_invoker_name));
+ invokerName = mc_invoker_name;
+
+ InvokeResponseQTable::iterator s_iterator = pApp->invokeResQTable.find(invokerName);
+ if (s_iterator != pApp->invokeResQTable.end()) {
+ responseSendQ = s_iterator->second;
+ } else {
+ responseSendQ = McOpenSyncSender(invokerName.c_str()); // LCOV_EXCL_BR_LINE 11:except branch
+ /*
+ * @todo
+ * FrameworkunifiedSendSyncResponse() uses McOpenSyncSender() to create a synchronous communication response queue handle,
+ * but there is no process to release the queue handle after the response.
+ */
+ if (NULL == responseSendQ) {
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ pApp->invokeResQTable[invokerName] = responseSendQ; // LCOV_EXCL_BR_LINE 11:except branch
+ }
+ }
+
+ if (eStatus == eFrameworkunifiedStatusOK) {
+ eStatus = McSendSyncResponse(responseSendQ, pApp->cAppName, iCmd, seq_id, retValue, length, data);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedDispatchProcess
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetSyncResponseData(HANDLE hApp, PVOID data, UI_32 size) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ /*
+ * @todo
+ * When the response data is 0 bytes, it can be transmitted as SYNC data.
+ */
+ if (frameworkunifiedCheckValidAppHandle(hApp) && data != NULL) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ try {
+ pApp->responsedata.set(data, size); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+ catch(std::bad_alloc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "bad_alloc");
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetMsgLength
+//////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgLength(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return McGetLength(static_cast<PVOID>(pApp->uiMsgRcvBuffer));
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetMsgProtocol
+//////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgProtocol(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return static_cast<UI_32>(pApp->uiProtocolCmd);
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetMsgDataOfSize
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetMsgDataOfSize(HANDLE hApp, PVOID pData, UI_32 uiSize, ESMRetrieveTypes eRetrieveMethod) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ /*
+ * @todo
+ * The behavior is the same as when "eSMRRetain" is set without getting an error when the ESMRetrieveTypes is not appropriate.
+ */
+ if (eSMRRelease == eRetrieveMethod) {
+ eStatus = McGetDataOfSize(static_cast<PVOID>(pApp->uiMsgRcvBuffer), pData, uiSize);
+ } else {
+ eStatus = McGetDataOfSizeWithSMRetain(static_cast<PVOID>(pApp->uiMsgRcvBuffer), pData, uiSize);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetDataPointer
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetDataPointer(HANDLE hApp, void **datap) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (NULL == datap) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ void *dt;
+ if ((dt = McGetDataPointer(reinterpret_cast<PVOID>(pApp->uiMsgRcvBuffer))) == NULL) {
+ return eFrameworkunifiedStatusInvldBufSize;
+ }
+
+ *datap = dt;
+ return eFrameworkunifiedStatusOK;
+ }
+ return eFrameworkunifiedStatusInvldHandle;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetMsgSrc
+//////////////////////////////////////////
+PCSTR FrameworkunifiedGetMsgSrc(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return (reinterpret_cast<PCSTR>(pApp->cMsgSrcName));
+ }
+ return NULL;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetMsgNotification
+//////////////////////////////////////////
+PCSTR FrameworkunifiedGetMsgNotification(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return (reinterpret_cast<PCSTR>(pApp->cSystemInfo));
+ }
+ return NULL;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedClearMsgData
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedClearMsgData(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ eStatus = McClearData(static_cast<PVOID>(pApp->uiMsgRcvBuffer));
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetDataUSID
+//////////////////////////////////////////
+TMemID FrameworkunifiedGetDataUSID(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return McGetDataUSID(static_cast<PVOID>(pApp->uiMsgRcvBuffer));
+ }
+ return BAD_MEM_ID;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedForwardMessage
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedForwardMessage(HANDLE hApp, HANDLE hChildQ, UI_32 iCmd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldBuf;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && hChildQ) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+
+ eStatus = McForward(hChildQ, &pApp->cAppName[ 0 ], iCmd, FrameworkunifiedGetDataUSID(hApp));
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedGetSystemInfo
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetSystemInfo(HANDLE hApp, PVOID pSystemInfo) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldBuf;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pSystemInfo != NULL) { // LCOV_EXCL_BR_LINE 11:except branch
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ eStatus = McGetSysInfoData(pApp->uiMsgRcvBuffer, pSystemInfo);
+// memcpy(pSystemInfo, pApp->cSystemInfo, _countof(pApp->cSystemInfo));
+// eStatus = eFrameworkunifiedStatusOK;
+ }
+ return eStatus;
+}
+
+
+//////////////////////////////////////////
+// Function : frameworkunifiedGetIsTypeOfSync
+//////////////////////////////////////////
+BOOL frameworkunifiedGetIsTypeOfSync(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return mcGetIsTypeOfSync(pApp->uiMsgRcvBuffer);
+ }
+ return FALSE;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetLastNotification
+/// Returns the last notification string that was received.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return pSourceName
+/// PCSTR - the last notification name that has been received.
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetLastNotification(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return static_cast<PCSTR>(pApp->cSystemInfo);
+ }
+
+ return NULL;
+}
+
+
+EFrameworkunifiedStatus FrameworkunifiedSendResponse(HANDLE hApp, UI_32 iCmd, UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ HANDLE hSession = FrameworkunifiedGetCurrentSessionHandle(hApp);
+
+ if (hSession) {
+ // send response
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(hSession, iCmd, length, data))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__,
+ "Response send Failed Status:0x%x ", eStatus);
+ // LCOV_EXCL_BR_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __PRETTY_FUNCTION__, "Response sent ");
+ }
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedSendRequest(HANDLE hApp, PCSTR pServerName, UI_32 uiSessionId, UI_32 iCmd,
+ UI_32 length, PCVOID data) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ HANDLE hSession = FrameworkunifiedGetSessionHandle(hApp, pServerName, uiSessionId);
+ if (hSession) {
+ // send response
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(hSession, iCmd, length, data))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__,
+ "Response send Failed Status:0x%x ", eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __PRETTY_FUNCTION__, "Response sent ");
+ }
+ }
+ }
+ return eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp
new file mode 100755
index 0000000..063e357
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_npservice.cpp
@@ -0,0 +1,867 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Framework wrapper over the NPService interface APIs
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <string.h>
+
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <other_service/strlcpy.h>
+
+#include "frameworkunified_framework_core.h"
+#include "ns_np_service_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterNotification(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const EFrameworkunifiedNotificationType persType) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ if (strlen(pNotification) && strlen(pNotification) < MAX_STRING_SIZE_NOTIFICATION) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ NotificationInfo notifInfo = {};
+ strlcpy(notifInfo.notificationName, pNotification, sizeof(notifInfo.notificationName));
+ notifInfo.persType = persType;
+ notifInfo.maxLength = max_length;
+
+ eStatus = NPRegisterNotifications(pMqInfo->hMsgQ, pApp->cAppName, 1, &notifInfo);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterImmediatePersistNotification(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const UI_32 delay) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification) {
+ if (strlen(pNotification) && strlen(pNotification) <= MAX_STRING_SIZE_NOTIFICATION) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ ImmediateNotificationInfo notifInfo = {};
+ strlcpy(notifInfo.notificationName, pNotification, sizeof(notifInfo.notificationName));
+ notifInfo.persType = eFrameworkunifiedImmediatePersistedStateVar;
+ notifInfo.maxLength = max_length;
+ notifInfo.delay = delay;
+
+ eStatus = NPRegisterImmediateNotifications(pMqInfo->hMsgQ, pApp->cAppName, 1, &notifInfo);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPPersistentSync
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPPersistentSync(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPPersistentSync(pMqInfo->cSrcName, pMqInfo->hMsgQ, pMqInfo->sessionId, pApp->cAppName);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eStatus;
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterNotifications(HANDLE hApp, const FrameworkunifiedNotificationsList *pList, UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ NotificationInfo *pNotificationList =
+ reinterpret_cast<NotificationInfo *>(malloc(sizeof(NotificationInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pNotificationList[i].notificationName, pList[i].cNotification,
+ sizeof(pNotificationList[i].notificationName));
+ pNotificationList[i].maxLength = pList[i].uiLengthData;
+ pNotificationList[i].persType = pList[i].persType;
+ }
+ eStatus = NPRegisterNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pNotificationList);
+
+ free(pNotificationList);
+ pNotificationList = NULL; // mb20110110 Fixed per comment 295
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPUnRegisterNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnRegisterNotification(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification && strlen(pNotification)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ NotificationInfo notifInfo = {};
+ strlcpy(notifInfo.notificationName, pNotification, sizeof(notifInfo.notificationName));
+
+ eStatus = NPUnRegisterNotifications(pMqInfo->hMsgQ, pApp->cAppName, 1, &notifInfo);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPUnRegisterNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnRegisterNotifications(HANDLE hApp, const FrameworkunifiedNotificationsList *pList, UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ NotificationInfo *pNotificationList =
+ reinterpret_cast<NotificationInfo *>(malloc(sizeof(NotificationInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pNotificationList[i].notificationName, pList[i].cNotification,
+ sizeof(pNotificationList[i].notificationName));
+ pNotificationList[i].maxLength = pList[i].uiLengthData;
+ pNotificationList[i].persType = pList[i].persType;
+ }
+ eStatus = NPUnRegisterNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pNotificationList);
+
+ free(pNotificationList);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPPublishNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPPublishNotification(HANDLE hApp, PCSTR pNotification,
+ PCVOID pData, UI_32 iLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if ((NULL != pMqInfo->hMsgQ) && (0 != std::strlen(pApp->cAppName))) {
+ eStatus = NPPublishNotification(pMqInfo->hMsgQ, pApp->cAppName, pNotification, pData, iLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSubscribeToNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSubscribeToNotification(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPSubscribeToNotification(pMqInfo->hMsgQ, pApp->cAppName, pNotification);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+EFrameworkunifiedStatus FrameworkunifiedNPSubscribeToNotifications(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pList,
+ UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ SubscribeInfo *pSubscribeList =
+ reinterpret_cast<SubscribeInfo *>(malloc(sizeof(SubscribeInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pSubscribeList[i].notificationName, pList[i].cNotification,
+ sizeof(pSubscribeList[i].notificationName));
+ }
+ eStatus = NPSubscribeToNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pSubscribeList);
+
+ free(pSubscribeList);
+ pSubscribeList = NULL; // mb20110110 Fixed per comment 307
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPUnSubscribeNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnsubscribeFromNotifications(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pList,
+ UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ SubscribeInfo *pSubscribeList =
+ reinterpret_cast<SubscribeInfo *>(malloc(sizeof(SubscribeInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pSubscribeList[i].notificationName, pList[i].cNotification, MAX_STRING_SIZE_NOTIFICATION);
+ }
+ eStatus = NPUnsubscribeFromNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pSubscribeList);
+
+ free(pSubscribeList);
+ pSubscribeList = NULL; // mb20110110 Fixed per comment 307
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPUnsubscribeFromNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnsubscribeFromNotification(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPUnsubscribeFromNotification(pMqInfo->hMsgQ, pApp->cAppName, pNotification);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReadPersistedData
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReadPersistedData(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPReadPersistedData(pMqInfo->hMsgQ, pApp->cAppName, pNotification);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSavePersistentData
+////////////////////////////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus FrameworkunifiedNPSavePersistentData(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED();
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPSavePersistentData(pMqInfo->hMsgQ, pApp->cAppName);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterPersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterPersistentFile(HANDLE hApp, PCSTR pTag, BOOL bIsUserFile) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ eStatus = NPRegisterPersistentFile(pMqInfo->hMsgQ, pApp->cAppName, pTag, bIsUserFile);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPLoadPersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPLoadPersistentFile(HANDLE hApp, PCSTR pDstFilePath, PCSTR pTag, HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pDstFilePath && pTag) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPLoadPersistentFile(pMqInfo->hMsgQ, pApp->cAppName, pDstFilePath, pTag, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFile(HANDLE hApp, BOOL bIsPersist, PCSTR pTag,
+ PCSTR pFullFilePath, HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag && pFullFilePath) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ EFrameworkunifiedReleaseType eReleaseType = (bIsPersist == FALSE) ? eFrameworkunifiedNotOnRelease : eFrameworkunifiedPersistOnShutdown;
+ eStatus = NPReleasePersistentFile(pMqInfo->hMsgQ, pApp->cAppName, eReleaseType, pTag,
+ pFullFilePath, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFile(HANDLE hApp, EFrameworkunifiedReleaseType eReleaseType, PCSTR pTag,
+ PCSTR pFullFilePath, HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag && pFullFilePath) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPReleasePersistentFile(pMqInfo->hMsgQ, pApp->cAppName, eReleaseType, pTag,
+ pFullFilePath, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPRegisterPersistentFolder
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterPersistentFolder(HANDLE hApp, PCSTR pTag, BOOL bIsUserFolder) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPRegisterPersistentFolder(pMqInfo->hMsgQ, pApp->cAppName, pTag, bIsUserFolder);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPLoadPersistentFolder
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPLoadPersistentFolder(HANDLE hApp, PCSTR pDstFolderPath, PCSTR pTag, HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag && pDstFolderPath) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ eStatus = NPLoadPersistentFolder(pMqInfo->hMsgQ, pApp->cAppName, pDstFolderPath, pTag, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFolder
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFolder(HANDLE hApp, BOOL bIsPersist, PCSTR pTag, PCSTR pFullFolderPath,
+ HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag && pFullFolderPath) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ EFrameworkunifiedReleaseType eReleaseType = (bIsPersist == FALSE) ? eFrameworkunifiedNotOnRelease : eFrameworkunifiedPersistOnShutdown;
+ eStatus = NPReleasePersistentFolder(pMqInfo->hMsgQ, pApp->cAppName, eReleaseType, pTag,
+ pFullFolderPath, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFolder
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFolder(HANDLE hApp, EFrameworkunifiedReleaseType eReleaseType, PCSTR pTag,
+ PCSTR pFullFolderPath,
+ HANDLE hUser) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pTag && pFullFolderPath) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ eStatus = NPReleasePersistentFolder(pMqInfo->hMsgQ, pApp->cAppName, eReleaseType, pTag,
+ pFullFolderPath, hUser);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+// 20110429_brp
+// defined for backward compatibility; will be removed once the persistence feature is finalized
+EFrameworkunifiedStatus FrameworkunifiedRegisterPersistentStorage(HANDLE hApp, PCSTR pFullFilePath) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pFullFilePath) {
+ eStatus = FrameworkunifiedNPRegisterPersistentFile(hApp, pFullFilePath);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+EFrameworkunifiedStatus FrameworkunifiedReleaseFileToPersistentStorage(HANDLE hApp, PCSTR pFullFilePath, BOOL persist) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pFullFilePath) {
+ eStatus = FrameworkunifiedNPReleasePersistentFile(hApp, persist, pFullFilePath, pFullFilePath);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMRegisterNotificationsEvents
+/// API to send message to Notification Service to register a notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMRegisterNotificationsEvents(HANDLE hApp, const FrameworkunifiedNotificationsList *pList,
+ UI_32 uiListLength) {
+ return FrameworkunifiedNPRegisterNotifications(hApp, pList, uiListLength);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMRegisterNotificatsionEvent
+/// API to send message to Notification Service to register a notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMRegisterNotificatsionEvent(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const EFrameworkunifiedNotificationType persType) {
+ return FrameworkunifiedNPRegisterNotification(hApp, pNotification, max_length, persType);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnRegisterNotificationEvent
+/// API to send message to Notification Service to remove a notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnRegisterNotificationEvent(HANDLE hApp, PCSTR pNotification) {
+ return FrameworkunifiedNPUnRegisterNotification(hApp, pNotification);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMSubscribeToNotificationsEvents
+/// API to send message to Notification Service to add multiple subscriptions list for
+/// that notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMSubscribeToNotificationsEvents(HANDLE hApp, const FrameworkunifiedNotificationEvent *pList,
+ UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ SubscribeInfo *pSubscribeList =
+ reinterpret_cast<SubscribeInfo *>(malloc(sizeof(SubscribeInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pSubscribeList[i].notificationName, pList[i].cNotification,
+ sizeof(pSubscribeList[i].notificationName));
+ }
+ eStatus = NPSubscribeToNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pSubscribeList);
+
+ free(pSubscribeList);
+ pSubscribeList = NULL; // mb20110110 Fixed per comment 307
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMSubscribeToNotificationEvent
+/// API to send message to Notification Service to add to subscription list for
+/// that notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMSubscribeToNotificationEvent(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPSubscribeToNotification(pMqInfo->hMsgQ, pApp->cAppName, pNotification);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnsubscribeFromNotificationEvent
+/// API to send message to Notification Service to remove from subscription list for
+/// that notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnsubscribeFromNotificationEvent(HANDLE hApp, PCSTR pNotification) {
+ return FrameworkunifiedNPUnsubscribeFromNotification(hApp, pNotification);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnsubscribeFromNotificationEvents
+/// API to send message to Notification Service to remove from subscription list for
+/// that notification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnsubscribeFromNotificationEvents(HANDLE hApp, const FrameworkunifiedNotificationEvent *pList,
+ UI_32 uiListLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pList) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ SubscribeInfo *pSubscribeList =
+ reinterpret_cast<SubscribeInfo *>(malloc(sizeof(SubscribeInfo) * uiListLength));
+
+ for (UI_32 i = 0; i < uiListLength; ++i) {
+ strlcpy(pSubscribeList[i].notificationName, pList[i].cNotification,
+ sizeof(pSubscribeList[i].notificationName));
+ }
+ eStatus = NPUnsubscribeFromNotifications(pMqInfo->hMsgQ, pApp->cAppName, uiListLength, pSubscribeList);
+
+ free(pSubscribeList);
+ pSubscribeList = NULL; // mb20110110 Fixed per comment 307
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetPersonality
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersonality(HANDLE hApp, PCSTR pUserName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pUserName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPSetPersonality(pMqInfo->hMsgQ, pApp->cAppName, pUserName);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPChangePersonality
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPChangePersonality(HANDLE hApp, PCSTR pUserName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pUserName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPChangePersonality(pMqInfo->hMsgQ, pApp->cAppName, pUserName);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendStopToNSNPP
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendStopToNSNPP(HANDLE hApp, EFrameworkunifiedShutdownType eShutdownType, UI_32 uiStopMsgData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = SendStopToNSNPP(pMqInfo->hMsgQ, pApp->cAppName, eShutdownType, uiStopMsgData);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPGetReadyStatusOfNPP
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPGetReadyStatusOfNPP(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ eStatus = NPGetReadyStatusOfNPP(pMqInfo->hMsgQ, pApp->cAppName);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPClearPersistedData
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPClearPersistedData(HANDLE hApp, EFrameworkunifiedClearPersistence eFrameworkunifiedClearPersistenceScope) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ eStatus = NPClearPersistedData(pMqInfo->hMsgQ, pApp->cAppName, eFrameworkunifiedClearPersistenceScope);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetPersistNotfnDefaultValue
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersistNotfnDefaultValue(HANDLE hApp, PCSTR pNotification, PVOID pData,
+ const UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pNotification)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPSetPersistNotfnDefaultValue(pMqInfo->hMsgQ,
+ pApp->cAppName,
+ pNotification,
+ pData,
+ uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetPersistentNotfnType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersistentNotfnType(HANDLE hApp, PCSTR pNotification, EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pNotification)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+ if (NULL != pMqInfo) {
+ eStatus = NPSetPersistentNotfnType(pMqInfo->hMsgQ,
+ pApp->cAppName,
+ pNotification,
+ ePersistCategory);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetFilePersistentType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetFilePersistentType(HANDLE hApp, PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pTag)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPSetFilePersistentType(pMqInfo->hMsgQ,
+ pApp->cAppName,
+ pTag,
+ ePersistCategory);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetFolderPersistentType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetFolderPersistentType(HANDLE hApp, PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pTag)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ MsgQInfo *pMqInfo = static_cast<MsgQInfo *>(pApp->hNPSndMsgQ);
+
+ if (NULL != pMqInfo) {
+ eStatus = NPSetFolderPersistentType(pMqInfo->hMsgQ,
+ pApp->cAppName,
+ pTag,
+ ePersistCategory);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_session.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_session.cpp
new file mode 100755
index 0000000..7c9935b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_session.cpp
@@ -0,0 +1,1357 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Framework service protocol session APIs implementation
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string.h>
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/ns_logger_if.h>
+#include <other_service/strlcpy.h>
+#include <utility>
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedOpenService
+//////////////////////////////////////////////////////
+HANDLE FrameworkunifiedOpenService(HANDLE hApp, PCSTR pServiceName) {
+ HANDLE hService = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pServiceName) {
+ if (NULL == (hService = FrameworkunifiedMcOpenSender(hApp, pServiceName))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error::hApp:0x%p, %s failed to FrameworkunifiedMcOpenSender", hApp, pServiceName);
+ // LCOV_EXCL_BR_STOP
+ } else {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ frameworkunifiedAddConnectMonitor(hApp, pServiceName, pApp->cAppName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Invalid param. hApp:0x%p, name:0x%p",
+ hApp, pServiceName);
+ }
+
+ return static_cast<HANDLE>(hService);
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedCloseService
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseService(HANDLE hApp, HANDLE hService) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hService)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ MsgQInfo *pMsgQ = static_cast<MsgQInfo *>(hService);
+
+ if (eFrameworkunifiedStatusOK != frameworkunifiedDelConnectMonitor(hApp, pMsgQ->cMsgQName, pApp->cAppName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : frameworkunifiedDelConnectMonitor(%s, %s) fail",
+ pMsgQ->cMsgQName != 0 ? pMsgQ->cMsgQName : NULL, pApp->cAppName != 0 ? pApp->cAppName : NULL);
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(hService))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : %s Failed to FrameworkunifiedMcClose",
+ pApp->cAppName != 0 ? pApp->cAppName : NULL);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+HANDLE FrameworkunifiedGenerateSessionHandle(HANDLE hApp, PCSTR pServiceName) {
+ HANDLE l_pSession = NULL;
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pServiceName)) {
+ l_pSession = FrameworkunifiedMcOpenSender(hApp, pServiceName);
+
+ if (NULL != l_pSession) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(l_pSession);
+ pMsgQ->sessionId = FrameworkunifiedGenerateNewSessionId();
+ }
+ }
+
+ return l_pSession;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedOpenSessionWithData
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionWithData(HANDLE hService, PVOID pData, UI_32 length) {
+ return FrameworkunifiedSendMsg(hService, PROTOCOL_OPEN_SESSION_REQ, length, pData);
+}
+
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedOpenSession
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSession(HANDLE hService) {
+ UI_32 l_uiDummy = 0;
+ return FrameworkunifiedSendMsg(hService, PROTOCOL_OPEN_SESSION_REQ, 0, &l_uiDummy);
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedOpenSessionWithDataSync
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionWithDataSync(HANDLE hService, PVOID pData, UI_32 length, OpenSessionAck *ack) {
+ UI_32 rcvLen;
+ return FrameworkunifiedInvokeSync(hService, PROTOCOL_OPEN_SESSION_REQ_SYNC, length, pData, sizeof(OpenSessionAck), ack, &rcvLen);
+}
+
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedOpenSessionSync
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionSync(HANDLE hService, OpenSessionAck *ack) {
+ UI_32 l_uiDummy = 0;
+ UI_32 rcvLen;
+ return FrameworkunifiedInvokeSync(hService, PROTOCOL_OPEN_SESSION_REQ_SYNC, 0, &l_uiDummy, sizeof(OpenSessionAck), ack, &rcvLen);
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedGetSessionHandle
+//////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetOpenSessionHandle(HANDLE hApp) {
+ HANDLE hSession = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ OpenSessionAck tAck;
+
+ if (sizeof(OpenSessionAck) == FrameworkunifiedGetMsgLength(hApp)) {
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedGetMsgDataOfSize(hApp, &tAck, sizeof(tAck))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedGetMsgDataOfSize");
+ } else {
+ if (eFrameworkunifiedStatusOK == tAck.eStatus) {
+ hSession = FrameworkunifiedMcOpenSender(hApp, tAck.cSessionName);
+ if (NULL != hSession) {
+ (reinterpret_cast<MsgQInfo *>(hSession))->sessionId = tAck.sessionId;
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedGetOpenSessionHandle");
+ }
+ }
+
+ return hSession;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedGetOpenSessionSyncHandle
+//////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetOpenSessionSyncHandle(HANDLE hApp, OpenSessionAck *tAck) {
+ HANDLE hSession = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && (NULL != tAck)) {
+ if (eFrameworkunifiedStatusOK == tAck->eStatus) {
+ hSession = FrameworkunifiedMcOpenSender(hApp, tAck->cSessionName);
+ if (NULL != hSession) {
+ (reinterpret_cast<MsgQInfo *>(hSession))->sessionId = tAck->sessionId;
+ }
+ }
+ }
+
+ return hSession;
+}
+
+//////////////////////////////////////////////////////
+/// frameworkunifiedCloseSessionInner
+//////////////////////////////////////////////////////
+static EFrameworkunifiedStatus frameworkunifiedCloseSessionInner(HANDLE hService, HANDLE hSession, CloseSessionAck *ack) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ CloseSessionReq tClose = {};
+
+ if (frameworkunifiedCheckValidMsgQ(hService) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ tClose.sessionId = (reinterpret_cast<MsgQInfo *>(hSession))->sessionId;
+ strlcpy(tClose.cSessionName, (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, sizeof(tClose.cSessionName));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Info : sessionid %d", tClose.sessionId);
+
+ if (NULL != ack) {
+ UI_32 rcvLen;
+ eStatus = FrameworkunifiedInvokeSync(hService, PROTOCOL_CLOSE_SESSION_REQ_SYNC, sizeof(tClose), (PVOID)&tClose,
+ sizeof(CloseSessionAck), ack, &rcvLen);
+ if (rcvLen != sizeof(CloseSessionAck)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : Invalid receive length %d", rcvLen);
+ }
+ } else {
+ eStatus = FrameworkunifiedSendMsg(hService, PROTOCOL_CLOSE_SESSION_REQ, sizeof(tClose), (PVOID)&tClose);
+ }
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ eStatus = FrameworkunifiedMcClose(hSession);
+ hSession = NULL;
+ }
+ }
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedCloseSession
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseSession(HANDLE hService, HANDLE hSession) {
+ return frameworkunifiedCloseSessionInner(hService, hSession, NULL);
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedCloseSessionSync
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseSessionSync(HANDLE hService, HANDLE hSession, CloseSessionAck *ack) {
+ if (NULL == ack) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return frameworkunifiedCloseSessionInner(hService, hSession, ack);
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedGetSessionId -> On Client side
+//////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetSessionId(HANDLE hSession) {
+ if (frameworkunifiedCheckValidMsgQ(hSession)) {
+ return ((reinterpret_cast<MsgQInfo *>(hSession))->sessionId);
+ } else {
+ return MAX_SESSION_ID_VAL;
+ }
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedGetSessionId -> On Client side
+//////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgSessionId(HANDLE hApp) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ return pApp->uiSessionId;
+ }
+ return MAX_SESSION_ID_VAL;
+}
+
+
+//////////////////////////////////////////////////////
+/// GenerateNewSessionId -> On Server side
+//////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGenerateNewSessionId() {
+ static UI_16 lastSessionId = 0;
+ lastSessionId++;
+ UI_32 sessionId = (lastSessionId % MAX_SESSION_ID_VAL);
+ return sessionId;
+}
+
+
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedRegisterEvents
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRegisterEvents(HANDLE hSession, PVOID puiEventsArray, UI_32 uiListSize) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (hSession) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS,
+ static_cast<UI_32>(uiListSize * sizeof(uiListSize)), puiEventsArray);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedRegisterEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRegisterEvent(HANDLE hSession, UI_32 uiEvent) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (hSession) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS, sizeof(uiEvent), (PVOID)&uiEvent);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedUnRegisterEvents
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterEvents(HANDLE hSession, PVOID puiEventsArray, UI_32 uiListSize) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (hSession) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS,
+ static_cast<UI_32>(uiListSize * sizeof(uiListSize)), puiEventsArray);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedUnRegisterEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterEvent(HANDLE hSession, UI_32 uiEvent) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (hSession) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS, sizeof(uiEvent), (PVOID)&uiEvent);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedDefineStateEvents
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefineStateEvents(HANDLE hApp, PVOID puiEvents, UI_32 uiListSize) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && puiEvents) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ EventData *l_pEventData = NULL;
+
+ UI_32 l_uiEventId;
+ PUI_32 l_pEventList = (PUI_32)puiEvents;
+
+ for (UI_32 uiCount = 0; uiCount < uiListSize; uiCount++) {
+ l_uiEventId = l_pEventList[uiCount];
+
+ // checks if event exists in state event list
+ if (pApp->publicstateeventtable.end() == pApp->publicstateeventtable.find(l_uiEventId)) {
+ // insert the event in state event list, data is passed as NULL as there is no data published
+ pApp->publicstateeventtable.insert(std::make_pair(l_uiEventId, l_pEventData));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event %d already registered as state event ", l_uiEventId);
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedBroadcastEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedBroadcastEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ eStatus = FrameworkunifiedPublishEvent(hApp, uiEventId, NULL, pData, uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedPublishEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishEvent(HANDLE hApp, UI_32 uiEventId, PCSTR pClientName, PCVOID pData, UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus eRetStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ EventTable::iterator e_iterator;
+ ServiceSessionIdListTable::iterator ssidl_iterator;
+
+ PCSTR l_cServiceName = "";
+
+ // set the data, if event is a state events
+ UpdatePublicStateEventData(hApp, uiEventId, pData, uiLength);
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // check if event is registered by client/s
+ e_iterator = pApp->eventtable.find(uiEventId);
+
+ if (pApp->eventtable.end() != e_iterator) {
+ // for loop for event table
+ for (ssidl_iterator = e_iterator->second.begin();
+ ssidl_iterator != e_iterator->second.end();
+ ssidl_iterator++) {
+ l_cServiceName = ssidl_iterator->first.c_str();
+
+ if (NULL != pClientName) {
+ // send message to only specified client
+ if (!std::strcmp(pClientName, l_cServiceName)) {
+ eStatus = SendEventMessage(hApp, ssidl_iterator->second, uiEventId, l_cServiceName, pData, uiLength);
+ break;
+ }
+ } else {
+ // send message to all registered client
+ eRetStatus = SendEventMessage(hApp, ssidl_iterator->second, uiEventId, l_cServiceName, pData, uiLength);
+ if (eFrameworkunifiedStatusOK != eRetStatus) {
+ eStatus = eRetStatus;
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "No subscriber has subscribed for event %d.", uiEventId);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// UpdatePublicStateEventData
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus UpdatePublicStateEventData(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if ((NULL == pData) && (uiLength > 0)) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ PublicStateEventTable::iterator se_iterator;
+ EventData *l_pEventData = NULL;
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // set the data, if event is a state events
+ se_iterator = pApp->publicstateeventtable.find(uiEventId);
+ if (pApp->publicstateeventtable.end() != se_iterator) {
+ l_pEventData = se_iterator->second;
+ if (NULL != l_pEventData) {
+ if (NULL != l_pEventData->pData) {
+ delete[](static_cast<PCHAR>(l_pEventData->pData));
+ (se_iterator->second)->pData = NULL;
+ }
+
+ delete l_pEventData;
+ se_iterator->second = NULL;
+ }
+
+ l_pEventData = new(std::nothrow) EventData();
+ /*
+ * @todo
+ * UpdatePublicStateEventData() in the pApp->publicstateeventtable
+ * The data area is being created, but there is no process to release.
+ */
+ if (NULL != l_pEventData) {
+ l_pEventData->uiLength = uiLength;
+ // LCOV_EXCL_BR_START 6:pData is checked in the top of this function, it should be not NULL here.
+ if (NULL == pData) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6:pData is checked in the top of this function, it should be not NULL here.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_pEventData->pData = NULL;
+ // LCOV_EXCL_STOP
+ } else {
+ l_pEventData->pData = new(std::nothrow) CHAR[uiLength];
+ if (NULL != l_pEventData->pData) {
+ std::memset(l_pEventData->pData, 0, uiLength);
+ std::memcpy(l_pEventData->pData, pData, uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+
+ se_iterator->second = l_pEventData;
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// SendEventMessage
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendEventMessage(HANDLE hApp,
+ const SessionIdList &vSessionIdList,
+ UI_32 uiEventId,
+ PCSTR cServiceName,
+ PCVOID pData,
+ UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus eStatusSendMsg = eFrameworkunifiedStatusOK;
+
+ UI_32 l_uiSessionId = 0;
+ HANDLE l_hClientHandle = NULL;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != cServiceName)) {
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < vSessionIdList.size();
+ l_uiCount++) {
+ l_uiSessionId = vSessionIdList[l_uiCount];
+ l_hClientHandle = GetMsgQueueHandle(hApp, cServiceName, l_uiSessionId);
+
+ // send message to all the registered sessions of the service
+ if (NULL != l_hClientHandle) {
+ if (eFrameworkunifiedStatusOK != (eStatusSendMsg = FrameworkunifiedSendMsg(l_hClientHandle, uiEventId, uiLength, pData))) {
+ eStatus = eFrameworkunifiedStatusErrOther;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "FrameworkunifiedSendMsg failed for EventID %d to service %s, status %d",
+ uiEventId, cServiceName, eStatusSendMsg);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send event %d to service %s, session %d. NULL handle found.",
+ uiEventId, cServiceName, l_uiSessionId);
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// RemoveEventEntryFromEventTable
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus RemoveEventEntryFromEventTable(HANDLE hApp, UI_32 uiEventId,
+ PCSTR cServiceName, const UI_32 uiSessionId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != cServiceName)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ EventTable::iterator e_iterator;
+ ServiceSessionIdListTable::iterator ssidl_iterator;
+
+ // event table = event id, service name, vector of session ids
+ // check if event is registered by client/s
+ e_iterator = pApp->eventtable.find(uiEventId);
+
+ if (pApp->eventtable.end() != e_iterator) {
+ ssidl_iterator = e_iterator->second.find(cServiceName);
+
+ if (e_iterator->second.end() != ssidl_iterator) {
+ // search for the session id in list of registered session of service with the event uiEventId
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < ssidl_iterator->second.size();
+ l_uiCount++) {
+ if (uiSessionId == ssidl_iterator->second[l_uiCount]) {
+ ssidl_iterator->second.erase(ssidl_iterator->second.begin() + l_uiCount);
+ break;
+ }
+ }
+
+ // no other session of service cServiceName is registered with the event uiEventId
+ if (ssidl_iterator->second.empty()) {
+ e_iterator->second.erase(ssidl_iterator);
+
+ // no other session is registered for the event uiEventId
+ if (e_iterator->second.empty()) {
+ pApp->eventtable.erase(e_iterator);
+ }
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////
+// Function : CleanAllEventsOfSession
+////////////////////////////////////////////
+EFrameworkunifiedStatus CleanAllEventsOfSession(HANDLE hApp, PCSTR serviceName, UI_32 sessionId) {
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != serviceName)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ ServiceSessionHandleTable::iterator ssh_iterator;
+ SessionToEventInfo::iterator sh_iterator;
+ HANDLE l_pClientHandle = NULL;
+ SessionEventInfo *l_ptSessionEventInfo = NULL;
+
+ // check whether client has registered for private event/s
+ ssh_iterator = pApp->servicesessionhandletable.find(serviceName);
+
+ if (pApp->servicesessionhandletable.end() != ssh_iterator) {
+ // get the table of session id and session handle of the received service over which private events are
+ // registered
+ sh_iterator = ssh_iterator->second.find(sessionId);
+
+ // client has registered for private event/s over this session
+ if (ssh_iterator->second.end() != sh_iterator) {
+ l_ptSessionEventInfo = sh_iterator->second;
+
+ if (NULL != l_ptSessionEventInfo) {
+ l_pClientHandle = l_ptSessionEventInfo->m_hSession;
+ if (NULL != l_pClientHandle) {
+ // close the session handle
+ eStatus = FrameworkunifiedMcClose(l_pClientHandle);
+ l_ptSessionEventInfo->m_hSession = NULL;
+ }
+ // Remove all the event entries from Event registry table
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_ptSessionEventInfo->m_vEvents.size();
+ l_uiCount++) {
+ (VOID)RemoveEventEntryFromEventTable(hApp,
+ l_ptSessionEventInfo->m_vEvents[l_uiCount],
+ serviceName,
+ sessionId);
+ }
+ l_ptSessionEventInfo->m_vEvents.clear(); // clear the event list
+ delete l_ptSessionEventInfo;
+ sh_iterator->second = NULL; // l_ptSessionEventInfo
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Deleting session event info entry for service: %s, session id: %d.",
+ serviceName, sessionId);
+ // remove the entry from SessionHandle table
+ ssh_iterator->second.erase(sh_iterator);
+
+ // remove the entry from ServiceSessionHandle table if this service have not registered for
+ // private events over other session
+ if (ssh_iterator->second.empty()) {
+ pApp->servicesessionhandletable.erase(ssh_iterator);
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid application handle or service name NULL");
+ }
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// RemoveEntryFromSessionEventInfoTable
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus RemoveEntryFromSessionEventInfoTable(HANDLE hApp, PCSTR serviceName, UI_32 sessionId, UI_32 eventId) {
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != serviceName)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ ServiceSessionHandleTable::iterator ssh_iterator;
+ SessionToEventInfo::iterator sh_iterator;
+ HANDLE l_pClientHandle = NULL;
+ SessionEventInfo *l_ptSessionEventInfo = NULL;
+
+ // check whether client has registered for private event/s
+ ssh_iterator = pApp->servicesessionhandletable.find(serviceName);
+
+ if (pApp->servicesessionhandletable.end() != ssh_iterator) {
+ // get the table of session id and session handle of the received service over which private events are
+ // registered
+ sh_iterator = ssh_iterator->second.find(sessionId);
+
+ // client has registered for private event/s over this session
+ if (ssh_iterator->second.end() != sh_iterator) {
+ l_ptSessionEventInfo = sh_iterator->second;
+
+ if (NULL != l_ptSessionEventInfo) {
+ // Remove event entry from session event info table
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_ptSessionEventInfo->m_vEvents.size();
+ l_uiCount++) {
+ if (eventId == l_ptSessionEventInfo->m_vEvents[l_uiCount]) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Removing session event info entry for "
+ "service:%s, session id:%d. event:%d",
+ serviceName, sessionId, eventId);
+ l_ptSessionEventInfo->m_vEvents.erase(l_ptSessionEventInfo->m_vEvents.begin() + l_uiCount);
+ break;
+ }
+ }
+
+ if (l_ptSessionEventInfo->m_vEvents.empty()) {
+ l_pClientHandle = l_ptSessionEventInfo->m_hSession;
+ if (NULL != l_pClientHandle) {
+ // close the session handle
+ eStatus = FrameworkunifiedMcClose(l_pClientHandle);
+ l_ptSessionEventInfo->m_hSession = NULL;
+ }
+ delete l_ptSessionEventInfo;
+ sh_iterator->second = NULL; // l_ptSessionEventInfo
+
+ // remove the entry from SessionHandle table
+ ssh_iterator->second.erase(sh_iterator);
+ }
+ }
+
+ // remove the entry from ServiceSessionHandle table if this service have not registered for
+ // private events over other session
+ if (ssh_iterator->second.empty()) {
+ pApp->servicesessionhandletable.erase(ssh_iterator);
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid application handle status:: %d", eStatus);
+ }
+
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedDefinePublicStateEvents
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefinePublicStateEvents(HANDLE hApp, PUI_32 puiEvents, UI_32 uiListSize) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != puiEvents) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ UI_32 l_uiEventId;
+
+ for (UI_32 uiCount = 0; uiCount < uiListSize; uiCount++) {
+ l_uiEventId = puiEvents[uiCount];
+
+ // checks if event exists in state event list
+ if (pApp->publicstateeventtable.end() == pApp->publicstateeventtable.find(l_uiEventId)) {
+ EventData *l_pEventData = NULL;
+ // insert the event in state event list, data is passed as NULL as there is no data published
+ pApp->publicstateeventtable.insert(std::make_pair(l_uiEventId, l_pEventData));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event %d already registered as public state event ", l_uiEventId);
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedDefinePrivateStateEvents
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefinePrivateStateEvents(HANDLE hApp, PUI_32 puiEvents, UI_32 uiListSize) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != puiEvents) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ UI_32 l_uiEventId = 0;
+
+ for (UI_32 uiCount = 0; uiCount < uiListSize; uiCount++) {
+ l_uiEventId = puiEvents[uiCount];
+
+ // checks if event exists in state event list
+ if (pApp->privatestateeventtable.end() == pApp->privatestateeventtable.find(l_uiEventId)) {
+ ServiceSessionEventData servicesessioneventdata;
+ pApp->privatestateeventtable.insert(std::make_pair(l_uiEventId, servicesessioneventdata));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event %d already registered as private state event", l_uiEventId);
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventWithCallback
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventWithCallback(HANDLE hApp, UI_32 uiCmd, CbFuncPtr fpOnCmd, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName,
+ uiCmd,
+ fpOnCmd,
+ hSession))) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS, sizeof(UI_32), (PVOID)&uiCmd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedAttachCallbackToDispatcher for "
+ "PROTOCOL_REGISTER_EVENTS Failed Status:: %d", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventsWithCallbacks
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventsWithCallbacks(HANDLE hApp, const FrameworkunifiedProtocolCallbackHandler *pMsgHandler,
+ UI_32 uiHandlerCount, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == pMsgHandler) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ } else if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ /**
+ * @todo
+ * If the CbFuncPtr in the pMsgHandler is set to NULL, the expected value is eFrameworkunifiedStatusInvldParam,
+ * but eFrameworkunifiedStatusOK is returned in the implementation.
+ * [Proposed measures]
+ * Exit by referring to the return code of the FrameworkunifiedAttachCallbacksToDispatcher executed in the FrameworkunifiedSubscribeToSessionEventsWithCallbacks.
+ */
+ /**
+ * @todo
+ * The behavior when NULL is set for a CbFuncPtr in a pMsgHandler in which more than one callback message is registered
+ * is not specified in the specifications.
+ * Ex: Prepare a pMsgHandler in which three callback information are registered,
+ * and specify NULL as the callback function pointer of the second callback information, and execute it.
+ * - Register the first callback function.
+ * - The second callback function is not registered with an error.
+ * - It is unspecified whether the third callback function is registered.
+ * [Proposed measures]
+ * Specifies that if there is callback information including NULL in the callback function pointer in pMsgHandler,
+ * the callback information will not be registered from the element following that callback function pointer.
+ */
+ eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName,
+ pMsgHandler,
+ uiHandlerCount,
+ hSession);
+ UI_32 l_uiCmdList[uiHandlerCount]; // NOLINT (readability/nolint)
+ for (UI_32 l_uiCnt = 0; l_uiCnt < uiHandlerCount; l_uiCnt++) {
+ l_uiCmdList[l_uiCnt] = pMsgHandler[l_uiCnt].iCmd;
+ }
+
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS,
+ static_cast<UI_32>(uiHandlerCount * sizeof(UI_32)), l_uiCmdList);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventWithCallback(HANDLE hApp, UI_32 uiEvent, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS, sizeof(uiEvent), (PVOID)&uiEvent);
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName,
+ uiEvent,
+ hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedDetachCallbackFromDispatcher failed status:: %d", eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : Failed to send PROTOCOL_UNREGISTER_EVENTS request to service:: %d",
+ eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventsWithCallbacks(HANDLE hApp, PUI_32 puiEventsArray, UI_32 uiListSize,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS, static_cast<UI_32>(uiListSize * sizeof(uiListSize)),
+ puiEventsArray);
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName,
+ puiEventsArray,
+ uiListSize,
+ hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedDetachCallbackFromDispatcher failed status:: %d", eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : Failed to send PROTOCOL_UNREGISTER_EVENTS request to service:: %d",
+ eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedPublishPrivateEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishPrivateEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ EventTable::iterator e_iterator;
+ ServiceSessionIdListTable::iterator ssidl_iterator;
+
+ PCSTR l_cServiceName = "";
+ BOOL l_bIsPublished = FALSE;
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // set the data, if event is a public state events
+ UpdatePrivateStateEventData(hApp,
+ uiEventId,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName,
+ (reinterpret_cast<MsgQInfo *>(hSession))->sessionId,
+ pData,
+ uiLength);
+
+ // check if event is registered by client/s
+ e_iterator = pApp->eventtable.find(uiEventId);
+
+ if (pApp->eventtable.end() != e_iterator) {
+ // for loop for event table
+ for (ssidl_iterator = e_iterator->second.begin();
+ ssidl_iterator != e_iterator->second.end();
+ ssidl_iterator++) {
+ l_cServiceName = ssidl_iterator->first.c_str();
+
+ // send message to only specified client
+ if (!std::strcmp(l_cServiceName, (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName)) {
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < ssidl_iterator->second.size();
+ l_uiCount++) {
+ if ((reinterpret_cast<MsgQInfo *>(hSession))->sessionId == ssidl_iterator->second[l_uiCount]) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(hSession, uiEventId, uiLength, pData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed for Event %d", uiEventId);
+ }
+
+ l_bIsPublished = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (l_bIsPublished) {
+ break;
+ }
+ }
+
+ if (!l_bIsPublished) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Failed to publish event %d to client [%s], session: [%d]. "
+ "Client not subscribed to the event on specified session.",
+ uiEventId, (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName != 0 ? \
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName : NULL,
+ (reinterpret_cast<MsgQInfo *>(hSession))->sessionId);
+ eStatus = eFrameworkunifiedStatusServNotFound;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Client %s is not subscribed to Event %d, session: [%d]",
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, uiEventId,
+ (reinterpret_cast<MsgQInfo *>(hSession))->sessionId);
+ eStatus = eFrameworkunifiedStatusServNotFound;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedPublishPublicEvent
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishPublicEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus eRetStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ EventTable::iterator e_iterator;
+ ServiceSessionIdListTable::iterator ssidl_iterator;
+
+ PCSTR l_cServiceName = "";
+
+ // set the data, if event is a state events
+ UpdatePublicStateEventData(hApp, uiEventId, pData, uiLength);
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // check if event is registered by client/s
+ e_iterator = pApp->eventtable.find(uiEventId);
+
+ if (pApp->eventtable.end() != e_iterator) {
+ // for loop for event table
+ for (ssidl_iterator = e_iterator->second.begin();
+ ssidl_iterator != e_iterator->second.end();
+ ssidl_iterator++) {
+ l_cServiceName = ssidl_iterator->first.c_str();
+
+ eRetStatus = SendEventMessage(hApp, ssidl_iterator->second, uiEventId, l_cServiceName, pData, uiLength);
+ if (eFrameworkunifiedStatusOK != eRetStatus) {
+ eStatus = eRetStatus;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "No client subscribed to EventID %d.", uiEventId);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// UpdatePrivateStateEventData
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus UpdatePrivateStateEventData(HANDLE hApp, UI_32 uiEventId, PCSTR pClientName, UI_32 uiSessionId,
+ PCVOID pData,
+ UI_32 uiLength) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((NULL == pData) && (uiLength > 0)) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ if ((eFrameworkunifiedStatusOK == eStatus) && (frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != pClientName)) {
+ PrivateStateEventTable::iterator pse_iterator;
+ ServiceSessionEventData::iterator ssed_iterator;
+ SessionEventData::iterator sed_iterator;
+
+ EventData *l_pEventData = NULL;
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // set the data, if event is a state events
+ pse_iterator = pApp->privatestateeventtable.find(uiEventId);
+ if (pApp->privatestateeventtable.end() != pse_iterator) {
+ ssed_iterator = (pse_iterator->second).find(pClientName);
+
+ if ((pse_iterator->second).end() != ssed_iterator) {
+ sed_iterator = (ssed_iterator->second).find(uiSessionId);
+ if ((ssed_iterator->second).end() != sed_iterator) {
+ l_pEventData = sed_iterator->second;
+
+ if (NULL != l_pEventData) {
+ if (NULL != l_pEventData->pData) {
+ delete[](static_cast<PCHAR>(l_pEventData->pData));
+ (sed_iterator->second)->pData = NULL;
+ }
+
+ delete l_pEventData;
+ sed_iterator->second = NULL;
+ }
+
+ l_pEventData = new(std::nothrow) EventData();
+
+ if (NULL != l_pEventData) {
+ l_pEventData->uiLength = uiLength;
+
+ if (NULL == pData) {
+ l_pEventData->pData = NULL;
+ } else {
+ l_pEventData->pData = new(std::nothrow) CHAR[uiLength];
+ if (NULL != l_pEventData->pData) {
+ std::memset(l_pEventData->pData, 0, uiLength);
+ std::memcpy(l_pEventData->pData, pData, uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ l_pEventData->uiLength = 0;
+ }
+ }
+
+ sed_iterator->second = l_pEventData;
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else { // if client has not yet subscribed to this event over the session uiSessionId
+ l_pEventData = new(std::nothrow) EventData();
+
+ if (NULL != l_pEventData) {
+ l_pEventData->uiLength = uiLength;
+
+ if (NULL == pData) {
+ l_pEventData->pData = NULL;
+ } else {
+ l_pEventData->pData = new(std::nothrow) CHAR[uiLength];
+ if (NULL != l_pEventData->pData) {
+ std::memset(l_pEventData->pData, 0, uiLength);
+ std::memcpy(l_pEventData->pData, pData, uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+
+ (ssed_iterator->second).insert(std::make_pair(uiSessionId, l_pEventData));
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ } else { // if client has not yet subscribed to this event
+ SessionEventData sessionEventData;
+
+ l_pEventData = new(std::nothrow) EventData();
+
+ if (NULL != l_pEventData) {
+ l_pEventData->uiLength = uiLength;
+
+ if (NULL == pData) {
+ l_pEventData->pData = NULL;
+ } else {
+ l_pEventData->pData = new(std::nothrow) CHAR[uiLength];
+ if (NULL != l_pEventData->pData) {
+ std::memset(l_pEventData->pData, 0, uiLength);
+ std::memcpy(l_pEventData->pData, pData, uiLength);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ l_pEventData->uiLength = 0;
+ }
+ }
+ sessionEventData.insert(std::make_pair(uiSessionId, l_pEventData));
+
+ (pse_iterator->second).insert(std::make_pair(pClientName, sessionEventData));
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// DeleteSessionEventData
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus DeleteSessionEventData(HANDLE hApp, PCSTR pClientName, UI_32 uiSessionId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ // map: eventid -> servicename -> sessionid -> eventdata(data, length)
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != pClientName) {
+ PrivateStateEventTable::iterator pse_iterator;
+ ServiceSessionEventData::iterator ssed_iterator;
+ SessionEventData::iterator sed_iterator;
+
+ EventData *l_pEventData = NULL;
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ // delete the private event data associated with the service over this session
+ for (pse_iterator = pApp->privatestateeventtable.begin();
+ pse_iterator != pApp->privatestateeventtable.end();
+ ++pse_iterator) {
+ ssed_iterator = (pse_iterator->second).find(pClientName);
+
+ if ((pse_iterator->second).end() != ssed_iterator) {
+ sed_iterator = (ssed_iterator->second).find(uiSessionId);
+ if ((ssed_iterator->second).end() != sed_iterator) {
+ l_pEventData = sed_iterator->second;
+
+ if (NULL != l_pEventData) {
+ if (NULL != l_pEventData->pData) {
+ delete[](static_cast<PCHAR>(l_pEventData->pData));
+ (sed_iterator->second)->pData = NULL;
+ }
+
+ delete l_pEventData;
+ sed_iterator->second = NULL;
+ }
+ }
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// Returns the number of session opened by the server for one client
+//////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetNumberOfSession(HANDLE hApp, PCSTR strServiceName) {
+ UI_32 l_uiSessionCount = 0;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ Services::iterator s_iterator = pApp->services.find(strServiceName);
+ if (s_iterator != pApp->services.end()) {
+ l_uiSessionCount = static_cast<UI_32>((s_iterator->second).size());
+ }
+ }
+
+ return l_uiSessionCount;
+}
+
+//////////////////////////////////////////////////////
+/// Sets the handle in the Application Framework
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetSessionHandle(HANDLE hApp, PCSTR strServiceName, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_uiSessionId = 0;
+ if (frameworkunifiedCheckValidMsgQ(hSession) && NULL != strServiceName && frameworkunifiedCheckValidAppHandle(hApp) &&
+ 0 != std::strlen(strServiceName)) {
+ MsgQInfo *pMsgQ = reinterpret_cast<MsgQInfo *>(hSession);
+
+ // Get session Id
+ l_uiSessionId = pMsgQ->sessionId;
+
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ ServiceSessionTable::iterator session_iterator;
+ SessionHandleTable::iterator session_handle_iterator;
+
+ // Find the service name
+ session_iterator = pApp->sessiontable.find(strServiceName);
+ if (session_iterator == pApp->sessiontable.end()) {
+ pApp->sessiontable.insert(std::make_pair(strServiceName, SessionHandleTable()));
+ }
+
+ // Find the session id
+ session_handle_iterator = pApp->sessiontable[strServiceName].find(l_uiSessionId);
+ if (session_handle_iterator != pApp->sessiontable[strServiceName].end()) {
+ pApp->sessiontable[strServiceName].erase(l_uiSessionId);
+ }
+
+ // Set the session handle
+ pApp->sessiontable[strServiceName].insert(std::make_pair(l_uiSessionId, hSession));
+
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// reads the handle from the Application Framework
+//////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetSessionHandle(HANDLE hApp, PCSTR strServiceName, UI_32 uiSessionId) {
+ HANDLE hSession = NULL;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && strServiceName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ ServiceSessionTable::iterator session_iterator;
+ SessionHandleTable::iterator session_handle_iterator;
+
+ // Find the service name
+ session_iterator = pApp->sessiontable.find(strServiceName);
+ if (session_iterator != pApp->sessiontable.end()) {
+ // Find the session id
+ session_handle_iterator = pApp->sessiontable[strServiceName].find(uiSessionId);
+ if (session_handle_iterator != pApp->sessiontable[strServiceName].end()) {
+ // Fetch the session handle
+ hSession = session_handle_iterator->second;
+ }
+ }
+ }
+ return hSession;
+}
+//////////////////////////////////////////////////////
+/// Close the handle stored in the Application Framework
+//////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRemoveSessionHandle(HANDLE hApp, PCSTR strServiceName, UI_32 uiSessionId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && strServiceName && 0 != std::strlen(strServiceName)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ pApp->sessiontable[strServiceName].erase(uiSessionId);
+ if (0 == pApp->sessiontable[strServiceName].size()) {
+ // If no entry is available for current service then remove the servicename
+ pApp->sessiontable.erase(strServiceName);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return eStatus;
+}
+
+//////////////////////////////////////////////////////
+/// FrameworkunifiedGetSession|Name -> On Client side
+//////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetSessionName(HANDLE hSession) {
+ if (frameworkunifiedCheckValidMsgQ(hSession)) {
+ return ((reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName);
+ } else {
+ return NULL;
+ }
+}
+
+
+HANDLE FrameworkunifiedGetCurrentSessionHandle(HANDLE hApp) {
+ HANDLE hSession = NULL;
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ UI_32 l_uiSessionId = FrameworkunifiedGetMsgSessionId(hApp);
+ PCSTR pRequester = FrameworkunifiedGetMsgSrc(hApp);
+
+ hSession = FrameworkunifiedGetSessionHandle(hApp, pRequester, l_uiSessionId);
+ }
+ return hSession;
+}
+
+HANDLE FrameworkunifiedCreateSession(HANDLE hApp, PCSTR pSessionName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ HANDLE hSession = NULL;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pSessionName && strlen(pSessionName)) {
+ hSession = FrameworkunifiedGenerateSessionHandle(hApp, pSessionName);
+ if (hSession) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSetSessionHandle(hApp, pSessionName, hSession))) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "Close session failed");
+ }
+ hSession = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "FrameworkunifiedCreateSession Failed Status:0x%x ", eStatus);
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return hSession;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedDestroySession(HANDLE hApp, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ UI_32 uiSessionId = (reinterpret_cast<MsgQInfo *>(hSession))->sessionId;
+ CHAR pRequester[MAX_NAME_SIZE_APP] = {};
+ strncpy(pRequester, (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, sizeof(pRequester) - 1);
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "Close session failed. Status: %d", eStatus);
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedRemoveSessionHandle(hApp, pRequester, uiSessionId))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "Remove session failed. Status: %d", eStatus);
+ }
+
+ DeleteSessionEventData(hApp, pRequester, uiSessionId);
+ }
+
+ return eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_sync.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_sync.cpp
new file mode 100755
index 0000000..80eec1f
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_sync.cpp
@@ -0,0 +1,439 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeService
+/// \brief This file contains the implementation for the synchronization
+/// API's class.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_framework_sync.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_logger_if.h>
+#include <string>
+#include <algorithm>
+#include <utility>
+#include "frameworkunified_framework_core.h"
+
+/// initialization of static members of class
+CFrameworkunifiedSyncData *CFrameworkunifiedSyncData::m_psSyncData = NULL;
+
+pthread_spinlock_t CFrameworkunifiedSyncData::m_pSyncLock;
+static pthread_mutex_t g_instance_lock = PTHREAD_MUTEX_INITIALIZER;
+
+// Template function to invoke callback function of CFrameworkunifiedSyncData class
+template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)> EFrameworkunifiedStatus SyncDataCallback(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ C *l_pClass = C::FrameworkunifiedGetSyncDataInstance();
+
+ if (NULL != l_pClass) {
+ l_eStatus = (l_pClass->*M)(hThread);
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedSyncData
+/// Constructor of CFrameworkunifiedSyncData class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedSyncData::CFrameworkunifiedSyncData(): m_bSyncThreadStarted(FALSE),
+ m_mSyncDataMap(NULL),
+ m_hSyncThreadAppHandle(NULL),
+ m_hAppHandle(NULL),
+ m_hSyncThreadMsgQHandle(NULL) {
+ pthread_spin_init(&m_pSyncLock, 1);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedSyncData
+/// Destructor of CFrameworkunifiedSyncData class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedSyncData::~CFrameworkunifiedSyncData() {
+ pthread_spin_destroy(&m_pSyncLock);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedStartNotificationSync
+/// This method is used to start the synchronization notification thread.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedStartNotificationSync(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ pthread_spin_lock(&m_pSyncLock);
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ m_hAppHandle = hApp;
+ std::string l_cThreadName = FrameworkunifiedGetAppName(hApp);
+ // l_cThreadName.append("SyncThread");
+ std::reverse(l_cThreadName.begin(), l_cThreadName.end());
+
+ if (NULL == m_hSyncThreadMsgQHandle) {
+ // Create Sync Thread
+ m_hSyncThreadMsgQHandle = FrameworkunifiedCreateChildThread(hApp,
+ l_cThreadName.c_str(),
+ SyncDataCallback<CFrameworkunifiedSyncData,
+ &CFrameworkunifiedSyncData::FrameworkunifiedSyncDataThreadStart>,
+ SyncDataCallback<CFrameworkunifiedSyncData,
+ &CFrameworkunifiedSyncData::FrameworkunifiedSyncDataThreadStop>);
+ if (NULL != m_hSyncThreadMsgQHandle) {
+ if (FALSE == m_bSyncThreadStarted) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(hApp,
+ m_hSyncThreadMsgQHandle,
+ 0,
+ NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Failed to start Thread.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, " Sync Data Thread Started");
+ m_bSyncThreadStarted = TRUE;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusThreadAlreadyRunning;
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Sync Data Thread Message Queue Null");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusThreadAlreadyRunning;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ pthread_spin_unlock(&m_pSyncLock);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedStartNotificationSync
+/// This method is used to stop the synchronization notification thread.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedStopNotificationSync(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (NULL != m_hSyncThreadMsgQHandle) {
+ pthread_spin_lock(&m_pSyncLock);
+ if (eFrameworkunifiedStatusOK != (l_eStatus = (FrameworkunifiedStopChildThread(hApp,
+ m_hSyncThreadMsgQHandle,
+ 0,
+ NULL)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread Sync Thread Failed.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "FrameworkunifiedStopChildThread Sync Thread Success.");
+ m_bSyncThreadStarted = FALSE;
+ }
+ pthread_spin_unlock(&m_pSyncLock);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusThreadNotExist;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetSyncDataInstance
+/// This function is used to get the singleton instance of class.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedSyncData *CFrameworkunifiedSyncData::FrameworkunifiedGetSyncDataInstance() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (NULL == m_psSyncData) {
+ pthread_mutex_lock(&g_instance_lock);
+ if (NULL == m_psSyncData) {
+ CFrameworkunifiedSyncData *l_pFrameworkunifiedSyncData = new(std::nothrow)CFrameworkunifiedSyncData();
+ m_psSyncData = l_pFrameworkunifiedSyncData;
+ }
+ pthread_mutex_unlock(&g_instance_lock);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return m_psSyncData;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedReleaseSyncDataInstance
+/// This function is used to release the instance of class.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedReleaseSyncDataInstance() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_psSyncData) {
+ pthread_mutex_lock(&g_instance_lock);
+ if (NULL != m_psSyncData) {
+ delete m_psSyncData;
+ m_psSyncData = NULL;
+ }
+ pthread_mutex_unlock(&g_instance_lock);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSyncDataThreadStart
+/// This function is callback function on the start of the sync thread.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedSyncDataThreadStart(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hThread) {
+ // Set Sync Thread Handle
+ m_hSyncThreadAppHandle = hThread;
+
+ if (NULL == m_mSyncDataMap) {
+ m_mSyncDataMap = new(std::nothrow)TSyncDataPacketList();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSyncDataThreadStop
+/// This function is callback function on the stop of the sync thread.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedSyncDataThreadStop(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (NULL != m_mSyncDataMap) {
+ for (TSyncDataPacketItr l_itSyncDataPacketItr = m_mSyncDataMap->begin() ;
+ l_itSyncDataPacketItr != m_mSyncDataMap->end();) {
+ SFrameworkunifiedSyncDataPacket *l_ptDataPacket = l_itSyncDataPacketItr->second;
+
+ if (NULL != l_ptDataPacket) {
+ if (NULL != l_ptDataPacket->m_pNotificationData) {
+ delete[](static_cast<PCHAR>(l_ptDataPacket->m_pNotificationData));
+ l_ptDataPacket->m_pNotificationData = NULL;
+ }
+ delete l_ptDataPacket;
+ l_ptDataPacket = NULL;
+ m_mSyncDataMap->erase(l_itSyncDataPacketItr++);
+ } else {
+ l_itSyncDataPacketItr++;
+ }
+ }
+
+ delete m_mSyncDataMap;
+ m_mSyncDataMap = NULL;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusExit;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeNotificationWithDataSync
+/// This function is used to subscribe to notifications.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedSubscribeNotificationWithDataSync(const std::string &f_cNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ pthread_spin_lock(&m_pSyncLock);
+ if (TRUE != f_cNotification.empty() && NULL != m_hSyncThreadAppHandle) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(
+ m_hSyncThreadAppHandle, // Thread Application handle
+ f_cNotification.c_str(), // Notification
+ SyncDataCallback<CFrameworkunifiedSyncData,
+ &CFrameworkunifiedSyncData::FrameworkunifiedSyncDataNotifCallback>))) { // Callback Function
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSubscribeNotificationWithCallback Sync Notification Data failed.");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "FrameworkunifiedSubscribeNotificationWithCallback Sync Notification Data success.");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ pthread_spin_unlock(&m_pSyncLock);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeNotificationWithDataSync
+/// This function is used to unsubscribe to notifications.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedUnSubscribeNotificationWithDataSync(const std::string &f_cNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ pthread_spin_lock(&m_pSyncLock);
+ if (TRUE != f_cNotification.empty() && NULL != m_hSyncThreadAppHandle) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedUnsubscribeNotificationWithCallback
+ (m_hSyncThreadAppHandle, // Thread Application Handle
+ f_cNotification.c_str()))) { // Notification
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedUnsubscribeNotificationWithCallback failed.");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "FrameworkunifiedUnsubscribeNotificationWithCallback success.");
+
+ TSyncDataPacketItr l_itSycDataPacketItr = m_mSyncDataMap->find(f_cNotification);
+ // Delete the notification data
+ if (m_mSyncDataMap->end() != l_itSycDataPacketItr) {
+ SFrameworkunifiedSyncDataPacket *l_ptDataPacket = l_itSycDataPacketItr->second;
+ if (NULL != l_ptDataPacket && NULL != l_ptDataPacket->m_pNotificationData) {
+ delete[](static_cast<PCHAR>(l_ptDataPacket->m_pNotificationData));
+ l_ptDataPacket->m_pNotificationData = NULL;
+ delete l_ptDataPacket;
+ l_ptDataPacket = NULL;
+ m_mSyncDataMap->erase(l_itSycDataPacketItr);
+ }
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ pthread_spin_unlock(&m_pSyncLock);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSyncDataNotifCallback
+/// This function is callback to notifications on publication of notifications.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedSyncDataNotifCallback(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == hThread) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ PCSTR l_pcLastNotification = FrameworkunifiedGetLastNotification(hThread);
+
+ if (NULL == l_pcLastNotification || 0 == std::strlen(l_pcLastNotification)) {
+ return eFrameworkunifiedStatusInvldNotification;
+ }
+
+ UI_32 l_uiBufferSize = FrameworkunifiedGetMsgLength(hThread);
+ PVOID l_pDataBuffer = new(std::nothrow)CHAR[l_uiBufferSize];
+
+ if ((NULL != l_pDataBuffer) &&
+ (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(hThread, l_pDataBuffer, l_uiBufferSize, eSMRRelease))) {
+ SFrameworkunifiedSyncDataPacket *l_ptDataPacket = NULL;
+
+ pthread_spin_lock(&m_pSyncLock);
+
+ TSyncDataPacketItr l_itSycDataPacketItr = m_mSyncDataMap->find(l_pcLastNotification);
+ // Delete the last notification data
+ if (m_mSyncDataMap->end() == l_itSycDataPacketItr) {
+ l_ptDataPacket = new(std::nothrow)SFrameworkunifiedSyncDataPacket();
+ } else {
+ l_ptDataPacket = l_itSycDataPacketItr->second;
+ if (NULL != l_ptDataPacket && NULL != l_ptDataPacket->m_pNotificationData) {
+ delete[](static_cast<PCHAR>(l_ptDataPacket->m_pNotificationData));
+ l_ptDataPacket->m_pNotificationData = NULL;
+ }
+ }
+
+ if (NULL != l_ptDataPacket) {
+ l_ptDataPacket->m_pNotificationData = l_pDataBuffer;
+ l_ptDataPacket->m_uiDataSize = l_uiBufferSize;
+ l_ptDataPacket->m_tTimeStamp = time(NULL);
+ m_mSyncDataMap->insert(std::make_pair(l_pcLastNotification, l_ptDataPacket));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "NULL pointer: l_ptDataPacket");
+ }
+
+ pthread_spin_unlock(&m_pSyncLock);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetSyncDataSize
+/// This function is used to get the size of the synchronization data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CFrameworkunifiedSyncData::FrameworkunifiedGetSyncDataSize(const std::string &f_cNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ UI_32 l_uiSyncDataSize = 0;
+
+ if (TRUE != f_cNotification.empty()) {
+ pthread_spin_lock(&m_pSyncLock);
+
+ TSyncDataPacketItr l_itSyncDataPacketItr = m_mSyncDataMap->find(f_cNotification);
+ SFrameworkunifiedSyncDataPacket *l_ptDataPacket = NULL;
+
+ if (m_mSyncDataMap->end() != l_itSyncDataPacketItr) {
+ l_ptDataPacket = l_itSyncDataPacketItr->second;
+ l_uiSyncDataSize = l_ptDataPacket->m_uiDataSize;
+ }
+ pthread_spin_unlock(&m_pSyncLock);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_uiSyncDataSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetSyncNotificationData
+/// This function is used to get the synchronization notification data for a particular notification .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedSyncData::FrameworkunifiedGetSyncNotificationData(const std::string &f_cNotification, PVOID f_pBuffer,
+ UI_16 f_nBufferSize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (TRUE != f_cNotification.empty() && NULL != f_pBuffer && 0 != f_nBufferSize) {
+ pthread_spin_lock(&m_pSyncLock);
+ TSyncDataPacketItr l_itSyncDataPacketItr = m_mSyncDataMap->find(f_cNotification);
+ if (m_mSyncDataMap->end() != l_itSyncDataPacketItr) {
+ if (NULL != l_itSyncDataPacketItr->second) {
+ if (NULL != std::memcpy(f_pBuffer, l_itSyncDataPacketItr->second->m_pNotificationData,
+ l_itSyncDataPacketItr->second->m_uiDataSize)) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ pthread_spin_unlock(&m_pSyncLock);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_system.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_system.cpp
new file mode 100755
index 0000000..3a2d434
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_framework_system.cpp
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Framework wrapper over the service directory interface APIs
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/ns_logger_if.h>
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+
+/// This is a library method in System Services....
+/// Note: Special care has been taken so that Native Services
+/// binaries don't have any circular dependence on System services.
+extern EFrameworkunifiedStatus SendSystemErrorToSystemManager(EFrameworkunifiedSystemError eSystemError) __attribute__((weak));
+
+
+EFrameworkunifiedStatus FrameworkunifiedAttachSystemCallbacksDispatcher(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ EFrameworkunifiedStatus eStatus = FrameworkunifiedSSFrameworkInterfaceInternal(hApp);
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_INFO, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendSystemErrMessage
+/// Sends a request to system manager for hard reset using function SendHardResetRequestToSystemManager
+/// which is defined in SystemServices library.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \param [in] eResetReason
+/// EFrameworkunifiedSystemError - Error Type
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - Returns status of operation
+///
+///////////////////////////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 200: System Error can't be tested for UT.
+EFrameworkunifiedStatus FrameworkunifiedSendSystemErrMessage(HANDLE hApp, EFrameworkunifiedSystemError eSystemError) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+
+ if (SendSystemErrorToSystemManager) {
+ l_eStatus = SendSystemErrorToSystemManager(eSystemError);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp
new file mode 100755
index 0000000..468478c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_msgprofiler.cpp
@@ -0,0 +1,210 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief File defines FrameworkunifiedMsgProfiler class which keeps profiler information for message dispatcher
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/* For FRAMEWORKUNIFIEDLOG*/
+#include <stdio.h>
+#include <time.h>
+#include <errno.h>
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_message_center_if.h>
+/* For PROTOCOL_DIS_MSGPROFILER */
+#include <native_service/frameworkunified_service_protocol.h>
+/* For FrameworkunifiedGetAppName */
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <string>
+#include <vector>
+/* Required for OpenSender, SendMessage, McSend, McOpenSender */
+#include "ns_msg_queue.h"
+#include "frameworkunified_msgprofiler.h"
+
+BOOL FrameworkunifiedMsgProfiler::m_bMsgProfilerEnabled = FALSE;
+
+//////////////////////////////////////////
+// Constructor
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+FrameworkunifiedMsgProfiler::FrameworkunifiedMsgProfiler(const std::string &f_cAppName)
+ : m_cAppName(f_cAppName),
+ m_ui32TotalNoOfMsgsReceived(0),
+ m_ui64MinMsgProcessingTime(720575940), // assign some big value
+ m_ui64MaxMsgProcessingTime(0),
+ m_ui64TotalMsgExecutionTime(0),
+ m_ui64LastMsgReceivedTime(0),
+ m_ui64AppInitTime(0),
+ m_bLastMsgWasPrintProfile(FALSE) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ m_ui64AppInitTime = GetClock();
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Destructor
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+FrameworkunifiedMsgProfiler::~FrameworkunifiedMsgProfiler() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : GetAppName
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+std::string FrameworkunifiedMsgProfiler::GetAppName() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ return m_cAppName;
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : MsgReceived
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+VOID FrameworkunifiedMsgProfiler::MsgReceived() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ m_ui32TotalNoOfMsgsReceived++;
+ m_ui64LastMsgReceivedTime = GetClock();
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : MsgProcessed
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+VOID FrameworkunifiedMsgProfiler::MsgProcessed() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ if (!m_bLastMsgWasPrintProfile) {
+ UI_64 l_ui64MsgProcessedTime = GetClock() - m_ui64LastMsgReceivedTime;
+
+ // set minimum execution time
+ if (l_ui64MsgProcessedTime < m_ui64MinMsgProcessingTime) {
+ m_ui64MinMsgProcessingTime = l_ui64MsgProcessedTime;
+ }
+
+ // set maximum execution time
+ if (l_ui64MsgProcessedTime > m_ui64MaxMsgProcessingTime) {
+ m_ui64MaxMsgProcessingTime = l_ui64MsgProcessedTime;
+ }
+
+ m_ui64TotalMsgExecutionTime += l_ui64MsgProcessedTime;
+ } else {
+ m_bLastMsgWasPrintProfile = FALSE;
+ }
+
+ // reset the last msg received time
+ m_ui64LastMsgReceivedTime = 0;
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : PrintProfileInfo
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus FrameworkunifiedMsgProfiler::PrintProfileInfo(HANDLE f_hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ HANDLE l_hProfileQ = OpenSender(FRAMEWORKUNIFIED_NS_MSGPROFILERUTIL);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __PRETTY_FUNCTION__, "Inside");
+ CHAR l_cData[MAX_QUEUE_MSG_SIZE] = {};
+ m_bLastMsgWasPrintProfile = TRUE;
+ // don't consider this message which is profiler specific. So decreasing the msg count by 1
+ m_ui32TotalNoOfMsgsReceived--;
+ if (NULL != l_hProfileQ) {
+ UI_64 l_ui64TimeSinceAppStart = (GetClock() - m_ui64AppInitTime) / 1000;
+ UI_64 l_ui64AvgMsgProcessingTime = m_ui64TotalMsgExecutionTime / m_ui32TotalNoOfMsgsReceived;
+
+ // MSG FORMAT: Tick, App/ThreadName, TotalMsgs, Freq(msgs/sec),
+ // Min MsgProcessingtime(cs,ms),:, Avg MsgProcessingtime (cs,ms) ,:, Max MsgProcessingtime (cs,ms)
+ snprintf(l_cData, MAX_QUEUE_MSG_SIZE, "%010lld, %-23s, %9d, %6.3f, "
+ "%30lld,%-5lld ,:, %30lld,%-5lld ,:, %30lld,%-5lld\n",
+ static_cast<long long int>(l_ui64TimeSinceAppStart), // NOLINT (readability/nolint)
+ m_cAppName.c_str(),
+ m_ui32TotalNoOfMsgsReceived,
+ (F_64)m_ui32TotalNoOfMsgsReceived / (F_64)l_ui64TimeSinceAppStart,
+ static_cast<long long int>(m_ui64MinMsgProcessingTime), // NOLINT (readability/nolint)
+ static_cast<long long int>(m_ui64MinMsgProcessingTime), // NOLINT (readability/nolint)
+ static_cast<long long int>(l_ui64AvgMsgProcessingTime), // NOLINT (readability/nolint)
+ static_cast<long long int>(l_ui64AvgMsgProcessingTime), // NOLINT (readability/nolint)
+ static_cast<long long int>(m_ui64MaxMsgProcessingTime), // NOLINT (readability/nolint)
+ static_cast<long long int>(m_ui64MaxMsgProcessingTime)); // NOLINT (readability/nolint)
+
+ SendMessage(l_hProfileQ, MAX_QUEUE_MSG_SIZE, l_cData);
+
+ if (eFrameworkunifiedStatusOK == CloseSender(l_hProfileQ)) {
+ l_hProfileQ = NULL;
+ }
+
+ // inform all childs to print msg profiler information.
+ std::vector<std::string>::iterator l_itChildList = m_vChildNames.begin();
+
+ HANDLE l_hChild = NULL;
+ while (m_vChildNames.end() != l_itChildList) {
+ if (!((*l_itChildList).empty())) {
+ l_hChild = McOpenSender((*l_itChildList).c_str());
+ if (NULL != l_hChild) {
+ if (eFrameworkunifiedStatusOK != McSend(l_hChild, FrameworkunifiedGetAppName(f_hApp), PROTOCOL_DIS_MSGPROFILER, 0, NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __PRETTY_FUNCTION__, "Error sending PROTOCOL_DIS_MSGPROFILER to child");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __PRETTY_FUNCTION__, "Msg PROTOCOL_DIS_MSGPROFILER sent to child");
+ }
+
+ McClose(l_hChild);
+ l_hChild = NULL;
+ }
+ }
+ l_itChildList++;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __PRETTY_FUNCTION__, "Exiting");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : AddChildName
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+VOID FrameworkunifiedMsgProfiler::AddChildName(const std::string &f_cChildName) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ if (!f_cChildName.empty()) {
+ m_vChildNames.push_back(f_cChildName);
+ }
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : GetClock
+//////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+UI_64 FrameworkunifiedMsgProfiler::GetClock() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "clock_gettime errno:%d", errno);
+ return 0;
+ }
+ return (UI_64)tp.tv_sec * 1000 * 1000 + tp.tv_nsec / 1000;
+}
+// LCOV_EXCL_STOP
+
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_multithreading.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_multithreading.cpp
new file mode 100755
index 0000000..986f3b3
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_multithreading.cpp
@@ -0,0 +1,531 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Framework wrapper over the service directory interface APIs
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/prctl.h>
+#include <sys/resource.h>
+#include <sys/syscall.h>
+
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/ns_utility.hpp>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_system_mode.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+
+#include <iostream>
+
+#ifdef DISPATCHER_PROFILER
+#include <boost/bind.hpp>
+#include "frameworkunified_msgprofiler.h"
+#endif
+
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_utility.h"
+#include "frameworkunified_framework_internal.h"
+#include "frameworkunified_sm_multithreading_internal.h"
+
+__thread HANDLE responseWaitQ = NULL;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsValidWaitBarrier
+////////////////////////////////////////////////////////////////////////////////////////////
+bool IsValidWaitBarrier(int wbret) {
+ return (PTHREAD_BARRIER_SERIAL_THREAD == wbret) ||
+ (0 == wbret);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// DestroyThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DestroyThread(HANDLE hApp) {
+ // terminates the dispatcher loop to destroy the thread
+ if (responseWaitQ != NULL) {
+ /**
+ * @todo
+ * The responseWaitQ is set in the FrameworkunifiedInvokeSync and is closed in the callback process (DestroyThread) of the FrameworkunifiedDestroyChildThread.
+ * Therefore, the responseWaitQ is not closed when FrameworkunifiedInvokeSync is used on the parent.
+ */
+ McClose(responseWaitQ);
+ responseWaitQ = NULL;
+ }
+ return eFrameworkunifiedStatusExit;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// setChildThreadSched
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus setChildThreadSched(EFrameworkunifiedSchedPolicy policy, SI_32 priority) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ struct sched_param param;
+ int get_policy, set_policy;
+ int set_priority;
+
+ if (pthread_getschedparam(pthread_self(), &get_policy, &param) != 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: pthread_getschedparam errno:%d", errno);
+ // LCOV_EXCL_BR_STOP
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (policy == eFrameworkunifiedSchedPolicyInherit) {
+ set_policy = get_policy;
+ } else {
+ if (policy == eFrameworkunifiedSchedPolicyFIFO) {
+ set_policy = SCHED_FIFO;
+ } else if (policy == eFrameworkunifiedSchedPolicyRR) {
+ set_policy = SCHED_RR;
+ } else {
+ set_policy = SCHED_OTHER;
+ }
+ }
+
+ if (priority == INHERIT_PARENT_THREAD_PRIO) {
+ if (get_policy != set_policy) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning: Change policy(%d-%d) but inherit priority", get_policy, set_policy);
+
+ if (set_policy == SCHED_OTHER) {
+ set_priority = 0;
+ } else {
+ set_priority = sched_get_priority_min(set_policy);
+ }
+ } else {
+ set_priority = param.sched_priority;
+ }
+ } else {
+ set_priority = priority;
+ }
+
+ switch (set_policy) {
+ case SCHED_OTHER:
+ param.sched_priority = 0;
+ if (pthread_setschedparam(pthread_self(), SCHED_OTHER, &param) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: pthread_setschedparam errno:%d", errno);
+ eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ if (setpriority(PRIO_PROCESS, static_cast<int>(syscall(__NR_gettid)), set_priority) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: setpriority errno:%d", errno);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ break;
+
+ case SCHED_FIFO:
+ case SCHED_RR:
+ param.sched_priority = set_priority;
+ if (pthread_setschedparam(pthread_self(), set_policy, &param) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: pthread_setschedparam errno:%d", errno);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ break;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// child_thread_proc
+////////////////////////////////////////////////////////////////////////////////////////////
+void *child_thread_proc(void *args) {
+ if (args == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "args is NULL");
+ return NULL;
+ }
+ PCData pcdata = *reinterpret_cast< PCData * >(args); // Create a local copy of data
+
+ try {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ HANDLE hApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcherChild(hApp,
+ pcdata.childName.c_str(),
+ pcdata.parentName.c_str()))) {
+ // LCOV_EXCL_BR_START 200: If FrameworkunifiedCreateDispatcherChild return eFrameworkunifiedStatusOK, hApp would also be valid.
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ // LCOV_EXCL_BR_STOP
+ THApp hChildApp(hApp);
+
+ const FrameworkunifiedProtocolCallbackHandler pcbhs[] = { { SYSTEM_ON_INITIALIZATION, pcdata.initFn },
+ { SYSTEM_ON_SHUTDOWN, pcdata.shdnFn },
+ { SYSTEM_ON_DESTROY, DestroyThread }
+ }; // LCOV_EXCL_BR_LINE 11:except branch
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbacksToDispatcher(hChildApp,
+ pcdata.parentName.c_str(),
+ &pcbhs[ 0 ],
+ static_cast<UI_32>(_countof(pcbhs)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Error: Attaching child callbacks to dispatcher %s", pcdata.childName.c_str());
+ }
+
+ char thread_name[16];
+ strncpy(thread_name, pcdata.childName.c_str(), sizeof(thread_name));
+ prctl(PR_SET_NAME, thread_name);
+ thread_name[15] = '\0';
+
+ setChildThreadSched(pcdata.schedPolicy, pcdata.schedPriority);
+
+ *pcdata.childStatus = eFrameworkunifiedStatusOK;
+ if (IsValidWaitBarrier(pthread_barrier_wait(pcdata.barrier))) {
+ RunChildDispatcher(hChildApp);
+ }
+ } else {
+ // LCOV_EXCL_START 200: If FrameworkunifiedCreateDispatcherChild return eFrameworkunifiedStatusOK, hApp would also be valid.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hApp is NULL");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcherChild error, status=%d", eStatus);
+
+ *pcdata.childStatus = eFrameworkunifiedStatusFail;
+ pthread_barrier_wait(pcdata.barrier);
+ }
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to create child %s", pcdata.childName.c_str());
+ }
+
+ return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE CreateChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize, CbFuncPtr CbShutdown,
+ const FrameworkunifiedChildThreadAttr *attr, CbFuncPtr CbCreateStateMachine) {
+ HANDLE hChildQ = NULL;
+ pthread_attr_t tAttr;
+ pthread_attr_t *pAttr = NULL;
+ SI_32 l_iThrCreate = 0;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
+ NULL != CbInitialize && NULL != CbShutdown && NULL != attr) {
+ if (attr->schedPolicy < eFrameworkunifiedSchedPolicyInherit || attr->schedPolicy >= eFrameworkunifiedSchedPolicyMAX) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ if (EOK == pthread_attr_init(&tAttr)) {
+ if (EOK != pthread_attr_setinheritsched(&tAttr, PTHREAD_INHERIT_SCHED)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ pAttr = &tAttr;
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ pthread_barrier_t barrier;
+ if (EOK == pthread_barrier_init(&barrier, NULL, 2)) {
+ PCData pc(&barrier, &l_eStatus, FrameworkunifiedGetAppName(hApp), childName, CbInitialize, CbShutdown,
+ attr->schedPolicy, attr->schedPriority, CbCreateStateMachine);
+ pthread_t childThread = 0;
+
+ if (NULL != CbCreateStateMachine) {
+ l_iThrCreate = pthread_create(&childThread, pAttr, child_hsm_thread_proc, &pc);
+ } else {
+ l_iThrCreate = pthread_create(&childThread, pAttr, child_thread_proc, &pc);
+ }
+
+ if (EOK == l_iThrCreate) {
+ if (IsValidWaitBarrier(pthread_barrier_wait(&barrier))) {
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ hChildQ = McOpenSenderChild(childName, childThread);
+ }
+ }
+ }
+ pthread_barrier_destroy(&barrier);
+ }
+ }
+#ifdef DISPATCHER_PROFILER
+ if (TRUE == FrameworkunifiedMsgProfiler::m_bMsgProfilerEnabled) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ pApp->m_pFrameworkunifiedMsgProfiler->AddChildName(childName);
+ }
+ }
+#endif
+ }
+ return hChildQ;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateChildThreadAttrInit
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateChildThreadAttrInit(FrameworkunifiedChildThreadAttr *attr) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (attr == NULL) {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ } else {
+ memset(attr, 0, sizeof(FrameworkunifiedChildThreadAttr));
+ attr->schedPolicy = eFrameworkunifiedSchedPolicyInherit;
+ attr->schedPriority = INHERIT_PARENT_THREAD_PRIO;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateChildThreadAttrSetSched
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateChildThreadAttrSetSched(FrameworkunifiedChildThreadAttr *attr, EFrameworkunifiedSchedPolicy policy, SI_32 priority) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (attr == NULL) {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ } else {
+ if (policy < eFrameworkunifiedSchedPolicyInherit || policy >= eFrameworkunifiedSchedPolicyMAX) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ attr->schedPolicy = policy;
+ attr->schedPriority = priority;
+ }
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateChildThreadAttrInit
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateChildThreadAttrInit(FrameworkunifiedChildThreadAttr *attr) {
+ return CreateChildThreadAttrInit(attr);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateChildThreadAttrSetSched
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateChildThreadAttrSetSched(FrameworkunifiedChildThreadAttr *attr, EFrameworkunifiedSchedPolicy policy, SI_32 priority) {
+ return CreateChildThreadAttrSetSched(attr, policy, priority);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
+ , CbFuncPtr CbShutdown) {
+ HANDLE hChildQ = NULL;
+ FrameworkunifiedChildThreadAttr attr;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
+ NULL != CbInitialize && NULL != CbShutdown) {
+ CreateChildThreadAttrInit(&attr);
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, &attr, NULL);
+ }
+
+ return hChildQ;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateChildThreadWithPriority
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThreadWithPriority(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
+ , CbFuncPtr CbShutdown, SI_32 schedPrio) {
+ HANDLE hChildQ = NULL;
+ FrameworkunifiedChildThreadAttr attr;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
+ NULL != CbInitialize && NULL != CbShutdown) {
+ CreateChildThreadAttrInit(&attr);
+ CreateChildThreadAttrSetSched(&attr, eFrameworkunifiedSchedPolicyFIFO, schedPrio);
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, &attr, NULL);
+ }
+
+ return hChildQ;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateChildThreadWithAttribute
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThreadWithAttribute(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
+ , CbFuncPtr CbShutdown, const FrameworkunifiedChildThreadAttr *attr) {
+ HANDLE hChildQ = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && strlen(childName) < LIMIT_NAME_SIZE_APP &&
+ NULL != CbInitialize && NULL != CbShutdown && NULL != attr) {
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, attr, NULL);
+ }
+
+ return hChildQ;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDestroyChildThread(HANDLE hApp, HANDLE hChildQ) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != hChildQ) {
+ eStatus = FrameworkunifiedSendChild(hApp, hChildQ, PROTOCOL_THREAD_DESTROY, 0, NULL);
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedJoinChild(hChildQ))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedJoinChild Error. status: %d", eStatus);
+ }
+
+ // close the child message queue handle
+ eStatus = McClose(hChildQ);
+ hChildQ = NULL;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedStartChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedStartChildThread(HANDLE hApp, HANDLE hChildQ, UI_32 length, PCVOID data) {
+ return FrameworkunifiedSendChild(hApp, hChildQ, SYSTEM_ON_INITIALIZATION, length, data);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedStopChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedStopChildThread(HANDLE hApp, HANDLE hChildQ, UI_32 length, PCVOID data) {
+ return FrameworkunifiedSendChild(hApp, hChildQ, SYSTEM_ON_SHUTDOWN, length, data);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendChild
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendChild(HANDLE hApp, HANDLE hChildQ, UI_32 iCmd, UI_32 length, PCVOID data) {
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hApp);
+ return McSend(hChildQ, &pApp->cAppName[ 0 ], iCmd, length, data);
+ }
+ return eFrameworkunifiedStatusInvldHandle;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendParent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendParent(HANDLE hChildApp, UI_32 iCmd, UI_32 length, PCVOID data) {
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
+ return McSend(pApp->hParentSndMsgQ, &pApp->cAppName[ 0 ], iCmd, length, data);
+ }
+ return eFrameworkunifiedStatusInvldHandle;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateDispatcherChild
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcherChild(HANDLE &hChildApp, // NOLINT (readability/nolint)
+ PCSTR childName,
+ PCSTR parentName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((NULL != childName) && (NULL != parentName) && (LIMIT_NAME_SIZE_APP > strlen(parentName)) &&
+ (LIMIT_NAME_SIZE_APP > strlen(parentName))) {
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateDispatcher(childName, hChildApp, TRUE))) {
+ // LCOV_EXCL_BR_START 200: If FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hChildApp would also be valid.
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ // LCOV_EXCL_BR_STOP
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
+
+ memset(pApp->cParentAppName, 0, sizeof(pApp->cParentAppName));
+ memcpy(pApp->cParentAppName, parentName, strlen(parentName));
+
+ pApp->hParentSndMsgQ = McOpenSender(parentName);
+ if (NULL == pApp->hParentSndMsgQ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "McOpenSender is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ return eStatus;
+ }
+ pApp->uiSessionId = THREAD_SESSION_ID;
+ } else {
+ // LCOV_EXCL_START 200: If FrameworkunifiedCreateDispatcher return eFrameworkunifiedStatusOK, hChildApp would also be valid.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hChildApp is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateDispatcher error, status=%d", eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid parameter received");
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedJoinChild
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedJoinChild(HANDLE hChildApp) {
+ return McJoinChild(hChildApp);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetChildThreadPriority
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio) {
+ return McGetChildThreadPriority(hChildApp, threadPrio);
+}
+
+EFrameworkunifiedStatus RunChildDispatcher(HANDLE hChildApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int efd;
+ // LCOV_EXCL_BR_START 6: RunChildDispatcher is a internal function, hChildApp would checked in child_thread_proc.
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ // LCOV_EXCL_BR_STOP
+#ifdef DISPATCHER_PROFILER
+ // Get the application handle
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
+ if (TRUE == FrameworkunifiedMsgProfiler::m_bMsgProfilerEnabled) {
+ pApp->m_pFrameworkunifiedMsgProfiler = new(std::nothrow) FrameworkunifiedMsgProfiler(FrameworkunifiedGetAppName(hChildApp));
+ if (NULL != pApp->m_pFrameworkunifiedMsgProfiler) {
+ FrameworkunifiedAttachChildMsgProfilerCallbacksDispatcher(hChildApp);
+ }
+ }
+#endif
+ FrameworkunifiedGetDispatcherFD(hChildApp, &efd);
+
+ while (eFrameworkunifiedStatusExit != l_eStatus) {
+ l_eStatus = frameworkunifiedFdHandler(hChildApp, efd);
+ }
+ } else {
+ // LCOV_EXCL_START 6: RunChildDispatcher is a internal function, hChildApp would checked in child_thread_proc.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_service_if.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_service_if.cpp
new file mode 100755
index 0000000..dccffa8
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_service_if.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_service_if.h>
+#include <string>
+//////////////////////////////////////////
+/// Function : CFrameworkunifiedServiceInterface
+//////////////////////////////////////////
+CFrameworkunifiedServiceInterface::CFrameworkunifiedServiceInterface() {
+}
+//////////////////////////////////////////
+/// Function : ~CFrameworkunifiedServiceInterface
+//////////////////////////////////////////
+CFrameworkunifiedServiceInterface::~CFrameworkunifiedServiceInterface() {
+}
+//////////////////////////////////////////
+/// Function : OpenService
+//////////////////////////////////////////
+HANDLE CFrameworkunifiedServiceInterface::OpenService(const HANDLE f_hApp, std::string f_sServiceName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ HANDLE l_hService = NULL;
+ if (NULL == (l_hService = FrameworkunifiedOpenService(f_hApp, f_sServiceName.c_str()))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Failed to open Service [%s]", f_sServiceName.c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_hService;
+}
+//////////////////////////////////////////
+/// Function : CloseService
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedServiceInterface::CloseService(const HANDLE f_hApp, const HANDLE f_hService) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ if ((NULL == f_hApp) || (NULL == f_hService)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseService(f_hApp, f_hService))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "CloseService Failed");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : OpenSession
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedServiceInterface::OpenSession(const HANDLE f_hApp, UI_32 f_uisessionType) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ if (NULL == f_hApp) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ l_eStatus = FrameworkunifiedOpenSessionWithData(f_hApp, (PVOID)&f_uisessionType, sizeof(UI_32));
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedOpenSession Failed, eFrameworkunifiedStatusOK = 0x%x, l_eStatus = 0x%x", eFrameworkunifiedStatusOK,
+ l_eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : OpenSessionAcknowledge
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedServiceInterface::OpenSessionAcknowledge(const HANDLE f_hApp, HANDLE &hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : CloseSession
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedServiceInterface::CloseSession(const HANDLE f_hService, const HANDLE f_hSession) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ if ((NULL == f_hService) || (NULL == f_hSession)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseSession(f_hService, f_hSession))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, " Failed to send session close request");
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS__CWORD77_, __FUNCTION__, " Session close request sent successfully");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : CloseSessionAcknowledge
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedServiceInterface::CloseSessionAcknowledge(const HANDLE hClient) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ CloseSessionAck tCloseAck;
+ if (NULL == hClient) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ if (eFrameworkunifiedStatusOK == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hClient, &tCloseAck, sizeof(tCloseAck)))) {
+ l_eStatus = tCloseAck.eStatus;
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR,
+ __FUNCTION__,
+ "Failed to get message data:%x", l_eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_thread_priority.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_thread_priority.cpp
new file mode 100755
index 0000000..88b5c50
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_thread_priority.cpp
@@ -0,0 +1,156 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+/// \brief <INSERT INFO HERE>.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+#include <stdlib.h>
+#include <string.h>
+
+#include <native_service/frameworkunified_thread_priority.h>
+#include <native_service/ns_logger_if.h>
+
+#include <string>
+
+char *priopts[] = {
+#define THREAD 0
+ const_cast<PSTR>("thrd"),
+ NULL
+};
+
+namespace frameworkunified {
+namespace framework {
+
+CFrameworkunifiedThreadPriorities::TThreadPriorityList CFrameworkunifiedThreadPriorities::ms_mapThreadPritories;
+
+//////////////////////////////////////////
+// Constructor
+//////////////////////////////////////////
+CFrameworkunifiedThreadPriorities::CFrameworkunifiedThreadPriorities() { // LCOV_EXCL_START 200:only use static function of this class
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Destructor
+//////////////////////////////////////////
+CFrameworkunifiedThreadPriorities::~CFrameworkunifiedThreadPriorities() { // LCOV_EXCL_START 200:only use static function of this class
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// GetPriority
+//////////////////////////////////////////
+SI_32 CFrameworkunifiedThreadPriorities::GetPriority(const std::string &f_cThreadName) {
+ SI_32 l_si32Prio = FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND;
+ ThreadPrioMapIter iter = ms_mapThreadPritories.find(f_cThreadName);
+ if (iter != ms_mapThreadPritories.end() && (FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND == l_si32Prio)) {
+ l_si32Prio = iter->second;
+ }
+
+ return l_si32Prio;
+}
+
+//////////////////////////////////////////
+// AddPriority
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedThreadPriorities::AddPriority(const std::string &f_cThreadName, SI_32 f_si32Priority) {
+ ms_mapThreadPritories[f_cThreadName] = f_si32Priority;
+ return eFrameworkunifiedStatusOK;
+}
+
+//////////////////////////////////////////
+// PrintPriorites
+//////////////////////////////////////////
+VOID CFrameworkunifiedThreadPriorities::PrintPriorites() { // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ThreadPrioMapIter iter = ms_mapThreadPritories.begin();
+ for (; iter != ms_mapThreadPritories.end(); iter++) {
+ std::string name = iter->first;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Thread name: %s Priority: %d", name.data(), iter->second);
+ }
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// ParseThreadArguments
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedThreadPriorities::ParseThreadArguments(PCHAR f_cArgumentValue) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ PCHAR l_cData = NULL;
+ PSTR l_cOptions;
+ PSTR l_cValue;
+ PCHAR saveptr;
+
+ if (NULL != f_cArgumentValue) {
+ l_cOptions = f_cArgumentValue;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "args of -p: %s", l_cOptions); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ while (*l_cOptions != '\0' && (eFrameworkunifiedStatusOK == l_eStatus)) {
+ switch (getsubopt(&l_cOptions, priopts, &l_cValue)) {
+ case THREAD: {
+ if (l_cValue == NULL) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ std::string l_cName("");
+ std::string l_cPriority(""); // LCOV_EXCL_BR_LINE 11: except branch
+ int at = static_cast<int>(frameworkunified::framework::args::name);
+
+ l_cData = strtok_r(l_cValue, ":", &saveptr); // NOLINT (readability/nolint)
+ while (NULL != l_cData) {
+ switch (at) {
+ case frameworkunified::framework::args::name:
+ l_cName = l_cData;
+ break;
+ case frameworkunified::framework::args::priority:
+ l_cPriority = l_cData;
+ break;
+ default:
+ break;
+ }
+
+ if (!l_cName.empty() && !l_cPriority.empty()) {
+ frameworkunified::framework::CFrameworkunifiedThreadPriorities::AddPriority(l_cName, atoi(l_cPriority.data()));
+ at = static_cast<int>(frameworkunified::framework::args::name);
+ l_cName.clear();
+ l_cPriority.clear();
+ } else {
+ at++;
+ }
+
+ l_cData = strtok_r(NULL, ":", &saveptr); // NOLINT (readability/nolint)
+ }
+ }
+ break;
+ }
+ default: {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ }
+ }
+ }
+ return l_eStatus;
+}
+
+} // namespace framework
+}; // namespace frameworkunified
+/// EOF
+
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_timer.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_timer.cpp
new file mode 100755
index 0000000..0663b85
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/frameworkunified_timer.cpp
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <native_service/frameworkunified_timer.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_timer_if.h>
+#include "frameworkunified_framework_core.h"
+
+const UI_32 TIMER_CALLBACK_CMD_ID = 42; // The answer to life, the universe, and everything
+const PCSTR TIMER_SERVICE_NAME = "TIMER";
+
+
+HANDLE FrameworkunifiedAttachTimerCallback(HANDLE hApp, UI_32 initMS, UI_32 repeatMS, CbFuncPtr CbFn) {
+ HANDLE timer = NULL;
+
+ if ((frameworkunifiedCheckValidAppHandle(hApp)) && (NULL != CbFn)) {
+ FrameworkunifiedAttachCallbackToDispatcher(hApp, TIMER_SERVICE_NAME, TIMER_CALLBACK_CMD_ID, CbFn);
+
+ CFrameworkunifiedFrameworkApp *pApp = const_cast<CFrameworkunifiedFrameworkApp *>(reinterpret_cast<const CFrameworkunifiedFrameworkApp *>(hApp));
+ NSTimerInfo ti = { WholeSeconds(initMS),
+ MSToNS(RemainderMs(initMS)),
+ TIMER_CALLBACK_CMD_ID,
+ WholeSeconds(repeatMS),
+ MSToNS(RemainderMs(repeatMS))
+ };
+ timer = NS_TimerCreate(ti, CALLBACK_MESSAGE, pApp->hAppSndMsgQ);
+ }
+
+ return timer;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedDetachTimerCallback(HANDLE hApp, HANDLE hTimer) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != hTimer) {
+ EFrameworkunifiedStatus sDel = NS_TimerDelete(hTimer);
+ hTimer = NULL;
+
+ EFrameworkunifiedStatus sDet = FrameworkunifiedDetachCallbackFromDispatcher(hApp,
+ TIMER_SERVICE_NAME,
+ TIMER_CALLBACK_CMD_ID);
+
+ // out of coverage
+ // Since the above frameworkunifiedCheckValidAppHandle(hApp) && NULL != hTimer have been confirmed,
+ // the condition will not be satisfied.
+ if (eFrameworkunifiedStatusOK != sDel || eFrameworkunifiedStatusOK != sDet) {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..025ec70
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/makefile_PosixBasedOS001
@@ -0,0 +1,214 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_FrameworkCore
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_FrameworkCore
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS += -D DISPATCHER_PROFILER
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_MessageQueue/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_UtilityCenter/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc/statemachine \
+ $(DEPENDS_INCLUDES) \
+
+# Libraries should be exported to the Domain Root. However if there is a
+# local static library (3rd Party) go ahead and add it here.
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+ $(wildcard statemachine/*.cpp)
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+# assuming all objects should be included in the library.
+ALL_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(notdir $(basename $(NON_LOCAL_SRCS) )) ) ) \
+ $(OBJECTS)
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/framework/*.h) \
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+ifdef DYNAMIC
+ DYNAMIC_LIBS += \
+ NS_MessageCenter$(DEBUG_EXT) \
+ NS_ConfigParser$(DEBUG_EXT) \
+ NS_NPServiceIf$(DEBUG_EXT) \
+ NS_Timer$(DEBUG_EXT)
+else
+ STATIC_LIBS +=
+endif
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS) $(ALL_OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+ $(MAKE) -C statemachine $(MAKECMDGOALS)
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(ALL_OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp
new file mode 100755
index 0000000..0cb4d67
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_action.cpp
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+/// This file has class declaration of the CFrameworkunifiedAction. This is an interface class that defines
+/// interfaces for implementing action
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_action.h>
+#include <string>
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedAction
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedAction::CFrameworkunifiedAction(std::string f_strName): m_strName(f_strName) {
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp
new file mode 100755
index 0000000..d975e93
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_compositestate.cpp
@@ -0,0 +1,371 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedCompositeState class definitions. CFrameworkunifiedCompositeState is derived from C
+/// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Composite
+/// state. It provides the standard interfaces for adding state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_compositestate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_sm_historystate.h>
+
+#include <sstream>
+#include <string>
+#include <map>
+#include <utility>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedCompositeState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedCompositeState::CFrameworkunifiedCompositeState(std::string f_pName): CFrameworkunifiedState(f_pName) {
+ try {
+ // ChildState map stores the pointers to sub state, key is state name
+ m_pChildStates = new ChildStateList();
+
+ m_pDefaultState = NULL;
+
+ m_pActiveState = NULL;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed in %s state ", f_pName.c_str());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedCompositeState::~CFrameworkunifiedCompositeState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "CFrameworkunifiedCompositeState destructor");
+ StateIterator l_objStateIterator;
+ try {
+ CHKNULL(m_pChildStates);
+
+ // Deleting the States
+ for (l_objStateIterator = m_pChildStates->begin();
+ l_objStateIterator != m_pChildStates->end(); l_objStateIterator++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, " deleting the state %s in state %s ",
+ (reinterpret_cast<CFrameworkunifiedState *>((*l_objStateIterator).second))->m_strStateName.c_str(),
+ m_strStateName.c_str());
+
+ CHKNULL((*l_objStateIterator).second);
+
+ delete(*l_objStateIterator).second;
+ (*l_objStateIterator).second = NULL;
+ }
+ m_pChildStates->clear();
+ delete m_pChildStates;
+ m_pChildStates = NULL;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to delete state %s",
+ ((reinterpret_cast<CFrameworkunifiedState *>((*l_objStateIterator).second))->m_strStateName).c_str());
+ }
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAddState
+/// sets the given state as a substate of the current state. If the f_eStateType is
+/// eFrameworkunifiedDefaultState then substate is default state for current state.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedAddState(CFrameworkunifiedState *f_pState,
+ FRAMEWORKUNIFIED_STATE_TYPE f_eStateType) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ std::map<std::string, CFrameworkunifiedState *>::iterator l_itChildStates;
+ CFrameworkunifiedHistoryState *l_pHistoryState = NULL;
+ try {
+ CHKNULL(f_pState);
+
+ CHKNULL(m_pChildStates);
+
+ // Set current state as the parent state of given state object
+ f_pState->m_pParentState = this;
+
+ // if given state is default state then set it as the default and active state of parent
+ // state
+ if (eFrameworkunifiedDefaultState == f_eStateType) {
+ m_pDefaultState = f_pState;
+ m_pActiveState = f_pState;
+
+ // set default shallow history state
+ l_itChildStates = m_pChildStates->find(SHALLOWHISTORYSTATE);
+ if (m_pChildStates->end() != l_itChildStates) {
+ l_pHistoryState = static_cast<CFrameworkunifiedHistoryState *>((*l_itChildStates).second);
+ CHKNULL(l_pHistoryState);
+ eStatus = l_pHistoryState->SetDefaultHistory();
+ }
+
+ // set default deep history state
+ l_itChildStates = m_pChildStates->find(DEEPHISTORYSTATE);
+ if (m_pChildStates->end() != l_itChildStates) {
+ l_pHistoryState = static_cast<CFrameworkunifiedHistoryState *>((*l_itChildStates).second);
+ CHKNULL(l_pHistoryState);
+ eStatus = l_pHistoryState->SetDefaultHistory();
+ }
+ }
+
+ // Insert the state in the map with key as state name
+ m_pChildStates->insert(std::pair<std::string, CFrameworkunifiedState *>(f_pState->m_strStateName, f_pState));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " %s state added in the state %s "
+ , (f_pState->m_strStateName).c_str(), (this->m_strStateName).c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to add state %s",
+ f_pState->m_strStateName.c_str());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetDefaultState
+/// Returns the default state of the current composite state.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedCompositeState::FrameworkunifiedGetDefaultState() {
+ return m_pDefaultState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPrintStates
+/// This logs the state name and events associated with the state
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedPrintStates() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ StateIterator l_objStateIterator;
+ EventReactionIterator l_objEventIterator;
+ try {
+ CHKNULL(m_pEventList);
+
+ if (m_pParentState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "%s:%s",
+ (m_pParentState->m_strStateName).c_str(), m_strStateName.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "NULL:%s", m_strStateName.c_str());
+ }
+
+ // print event
+ for (l_objEventIterator = m_pEventList->begin();
+ l_objEventIterator != m_pEventList->end(); l_objEventIterator++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "event %d %s", ((*l_objEventIterator).first),
+ (m_pEventName->find((*l_objEventIterator).first)->second).c_str());
+ }
+ CHKNULL(m_pDeferredEventList);
+ // print deferred events
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pDeferredEventList->size(); l_uiCount++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "deferred event %d %s", m_pDeferredEventList->at(l_uiCount),
+ (m_pEventName->find(m_pDeferredEventList->at(l_uiCount))->second).c_str());
+ }
+ CHKNULL(m_pChildStates);
+ // print states
+ for (l_objStateIterator = m_pChildStates->begin();
+ l_objStateIterator != m_pChildStates->end(); l_objStateIterator++) {
+ (reinterpret_cast<CFrameworkunifiedState *>((*l_objStateIterator).second))->FrameworkunifiedPrintStates();
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to print in state %s",
+ m_strStateName.c_str());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedHasSubStates
+/// This indicates if the state has sub states. It returns TRUE only in the CompositeState
+/// where this function is overridden
+///////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFrameworkunifiedCompositeState::FrameworkunifiedHasSubStates() {
+ return TRUE;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedCompositeState::FrameworkunifiedGetActiveState() {
+ CFrameworkunifiedState *l_pActiveState = NULL;
+ if (NULL != m_pActiveState) {
+ l_pActiveState = m_pActiveState->FrameworkunifiedGetActiveState();
+ } else {
+ l_pActiveState = this;
+ }
+ return l_pActiveState;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ StateIterator l_objStateIterator;
+ try {
+ CHKNULL(f_pStatemachine);
+ // iterate child states
+ for (l_objStateIterator = m_pChildStates->begin();
+ l_objStateIterator != m_pChildStates->end(); l_objStateIterator++) {
+ (reinterpret_cast<CFrameworkunifiedState *>((*l_objStateIterator).second))->FrameworkunifiedSetHSM(f_pStatemachine);
+ }
+ m_pStateMachine = f_pStatemachine;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EventReactionIterator l_objEventIterator;
+ StateIterator l_objStateIterator;
+ try {
+ CHKNULL(m_pEventList);
+ CHKNULL(m_pEventName);
+ CHKNULL(m_pDeferredEventList);
+
+ f_strXMLString << "<" << m_strStateName.c_str() << ">";
+
+ CHKNULL(m_pChildStates);
+ f_strXMLString << "<ChildStates>";
+ // print states
+ for (l_objStateIterator = m_pChildStates->begin();
+ l_objStateIterator != m_pChildStates->end(); l_objStateIterator++) {
+ (reinterpret_cast<CFrameworkunifiedState *>((*l_objStateIterator).second))->FrameworkunifiedPrintXML(f_strXMLString);
+ }
+
+ f_strXMLString << "</ChildStates>";
+
+ f_strXMLString << "<EventList>";
+ // print events
+ for (l_objEventIterator = m_pEventList->begin();
+ l_objEventIterator != m_pEventList->end(); l_objEventIterator++) {
+ std::string l_strEventName =
+ (m_pEventName->find((*l_objEventIterator).first)->second);
+
+ UI_32 l_uiEventId = (*l_objEventIterator).first;
+
+ f_strXMLString << "<Event " << "Id = " << "\"" << l_uiEventId << "\">";
+
+ f_strXMLString << "<Name>" << l_strEventName.c_str() << "</Name>";
+
+ f_strXMLString << "</Event>";
+ }
+ f_strXMLString << "</EventList>";
+
+ // print deferred events
+ f_strXMLString << "<DeferredEventList>";
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pDeferredEventList->size(); l_uiCount++) {
+ UI_32 l_uiEventId = m_pDeferredEventList->at(l_uiCount);
+
+ std::string l_strEventName = (m_pEventName->find(l_uiEventId)->second);
+
+ f_strXMLString << "<Event " << "Id = " << "\"" << l_uiEventId << "\">";
+
+ f_strXMLString << "<Name>" << l_strEventName.c_str() << "</Name>";
+
+ f_strXMLString << "</Event>";
+ }
+
+ f_strXMLString << "</DeferredEventList>";
+ f_strXMLString << "</" << m_strStateName.c_str() << ">";
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to print in state %s", m_strStateName.c_str());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::UpdateHistory() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // update shallow history state
+ l_eStatus = CheckHistory(SHALLOWHISTORYSTATE);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s Shallow History Update Failed", m_strStateName.c_str());
+ return l_eStatus;
+ }
+
+ // update deep history state
+ l_eStatus = CheckHistory(DEEPHISTORYSTATE);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s Deep History Update Failed", m_strStateName.c_str());
+ return l_eStatus;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CheckHistory
+/// This function searches for history state in this composite state and updates it.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedCompositeState::CheckHistory(std::string l_cHistoryType) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(m_pChildStates);
+
+ CFrameworkunifiedState *l_pHistoryState = NULL;
+
+ std::map<std::string, CFrameworkunifiedState *>::iterator l_itChildStates;
+
+ // update history state
+ l_itChildStates = m_pChildStates->find(l_cHistoryType);
+
+ if (m_pChildStates->end() != l_itChildStates) {
+ l_pHistoryState = (*l_itChildStates).second;
+ CHKNULL(l_pHistoryState);
+ l_eStatus = l_pHistoryState->UpdateHistory();
+ }
+
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp
new file mode 100755
index 0000000..6f27319
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_conditionconnector.cpp
@@ -0,0 +1,152 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has class definition of the CFrameworkunifiedConditionConnector. This class is responsible for
+/// implementing interfaces required to use condition connector in statemachine.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_conditionconnector.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_guard.h>
+
+#include <vector>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedConditionConnector
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedConditionConnector::CFrameworkunifiedConditionConnector(std::string f_strName): CFrameworkunifiedExternalTransition(NULL),
+ m_strName(f_strName) {
+ // Create the condition list
+ m_pConditionList = new std::vector<CCondition * >();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedConditionConnector
+/// destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedConditionConnector::~CFrameworkunifiedConditionConnector() {
+ if (m_pConditionList) {
+ TConditionIterator l_itConditionList = m_pConditionList->begin();
+
+ while (m_pConditionList->end() != l_itConditionList) {
+ delete *l_itConditionList;
+ l_itConditionList++;
+ }
+ // clear condition list
+ m_pConditionList->clear();
+ delete m_pConditionList;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CCondition
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedConditionConnector::CCondition::CCondition(CFrameworkunifiedGuard *f_pGuard, CFrameworkunifiedState *f_pTargetState)
+ : m_pGuard(f_pGuard), m_pTargetState(f_pTargetState) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedReaction
+/// This API evaluates the guards added in the condition list. If the guard is evaluated as
+/// true then statemachine transitions to target state associated with guard.
+//////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedConditionConnector::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) {
+ CFrameworkunifiedState *l_pActiveState = NULL;
+ BOOL l_bAllowTransition = FALSE;
+ try {
+ CHKNULL(f_pSourceState);
+ CHKNULL(m_pConditionList);
+ TConditionIterator l_itConditionList
+ = m_pConditionList->begin();
+
+ // iterate condition list and set the target state
+ while (m_pConditionList->end() != l_itConditionList) {
+ CCondition *l_pCondition = *l_itConditionList;
+ CHKNULL(l_pCondition);
+
+ CFrameworkunifiedGuard *l_pGuard = l_pCondition->m_pGuard;
+ CFrameworkunifiedState *l_pTargetState = l_pCondition->m_pTargetState;
+
+ CHKNULL(l_pGuard);
+ CHKNULL(l_pTargetState);
+
+ if (l_pGuard->FrameworkunifiedEvaluate()) {
+ m_pTargetState = l_pTargetState;
+ l_bAllowTransition = TRUE;
+ break;
+ }
+ l_itConditionList++;
+ }
+
+ if (l_bAllowTransition) {
+ // Transition to target state
+ l_pActiveState = ExecuteTransition(f_pSourceState, f_pData);
+
+ } else {
+ // No state changed
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__,
+ "Guard condition for External Transition from state %s to condition connector %s failed",
+ f_pSourceState->m_strStateName.c_str(), m_strName.c_str());
+
+ l_pActiveState = f_pSourceState;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+ return l_pActiveState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAddCondition
+/// Adds condition to condition list
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedConditionConnector::FrameworkunifiedAddCondition(CFrameworkunifiedGuard *f_pGuard, CFrameworkunifiedState *f_pTargetState) {
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pConditionList);
+ CHKNULL(f_pGuard);
+ CHKNULL(f_pTargetState);
+
+ CCondition *l_pCondition = new CCondition(f_pGuard, f_pTargetState);
+
+ m_pConditionList->push_back(l_pCondition);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+
+ return l_eFrameworkunifiedStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp
new file mode 100755
index 0000000..baac0d4
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_deephistorystate.cpp
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedDeepHistoryState class definitions. CFrameworkunifiedDeepHistoryState is derived
+/// from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported by
+/// HSM DeepHistory state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_deephistorystate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <string>
+
+// define static members of class
+const UI_32 CFrameworkunifiedDeepHistoryState::m_suievDeepHistory = 72;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedDeepHistoryState
+/// Parameterized constructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedDeepHistoryState::CFrameworkunifiedDeepHistoryState(std::string f_pName): CFrameworkunifiedHistoryState(f_pName) {
+ m_uiEventId = m_suievDeepHistory;
+ m_cEventName = "evDeepHistory";
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedDeepHistoryState
+/// Class destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedDeepHistoryState::~CFrameworkunifiedDeepHistoryState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "CFrameworkunifiedDeepHistoryState destructor");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedDeepHistoryState::UpdateHistory() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CFrameworkunifiedState *l_pActiveState = NULL;
+
+ try {
+ CHKNULL(m_pParentState);
+ l_pActiveState = m_pParentState->m_pActiveState;
+
+ while (NULL != l_pActiveState) {
+ m_pLastActiveState = l_pActiveState;
+ l_pActiveState = l_pActiveState->m_pActiveState;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp
new file mode 100755
index 0000000..a73408a
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_dispatcher.cpp
@@ -0,0 +1,240 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <pthread.h>
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_sm_dispatcher.h>
+
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_error_internal.hpp"
+#include "frameworkunified_sm_framework_core.h"
+#include "frameworkunified_framework_utility.h"
+
+static HSMConfigOptions s_tHSMConfigOptions = {eUserchangeIgnore, TRUE, FALSE};
+
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherMain(HANDLE hApp);
+//////////////////////////////////////////
+// Function : FrameworkunifiedCreateDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateHSMDispatcher(PCSTR cAppName,
+ HANDLE &hFrameworkApp, // NOLINT (readability/nolint)
+ BOOL bIsThread, CFrameworkunifiedHSMFramework *f_pFrameworkunifiedHSM) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != cAppName) {
+ if (eFrameworkunifiedStatusOK == (eStatus = CreateDispatcher(cAppName, hFrameworkApp, bIsThread))) {
+ if (NULL != hFrameworkApp) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hFrameworkApp);
+
+ if (NULL != f_pFrameworkunifiedHSM) {
+ pApp->m_pFrameworkunifiedStateMachine = f_pFrameworkunifiedHSM;
+ pApp->m_pFrameworkunifiedStateMachine->m_pHApp = pApp;
+ } else {
+ if (bIsThread) {
+ pApp->m_pFrameworkunifiedStateMachine = new CFrameworkunifiedHSMChildFramework(pApp);
+ } else {
+ pApp->m_pFrameworkunifiedStateMachine = new CFrameworkunifiedHSMParentFramework(pApp);
+ }
+ }
+
+ if (NULL != pApp->m_pFrameworkunifiedStateMachine) {
+ pApp->m_pFrameworkunifiedStateMachine->FrameworkunifiedCreate(&s_tHSMConfigOptions);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "hFrameworkApp is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "CreateDispatcher returned error, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "AppName is NULL");
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDispatcherWithArguments
+/// Creates, initializes and runs the dispatcher
+///
+/// \param [in] cAppname
+/// PCSTR - Application/ thread name
+///
+/// \return Never does, main loop for your application.
+///
+/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock,
+/// FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherWithArguments(PCSTR cAppName, int argc, char *argv[],
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler, CFrameworkunifiedHSMFramework *f_pFrameworkunifiedHSM,
+ CustomCommandLineOptions *cmdLineOptions) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (cAppName == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ NsLogSetProcessName(cAppName);
+ PLOG_TEXT("FrameworkunifiedHSMDispatcher Start");
+ // set main thread name as provided in dispatcher
+ pthread_setname_np(pthread_self(), cAppName);
+
+ if ((eStatus = RegistDefaultCbHandler(CbHandler)) != eFrameworkunifiedStatusOK) {
+ return eStatus;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_DIS, __FUNCTION__, "In"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ try {
+ HANDLE hFrameworkApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateHSMDispatcher(cAppName, hFrameworkApp, FALSE, f_pFrameworkunifiedHSM))) {
+ if (NULL != hFrameworkApp) {
+ THApp hApp(hFrameworkApp);
+
+ /// Parse the Arguments via the FrameworkunifiedArgumentParser
+ /// passing an handle to the app and argument list
+ eStatus = FrameworkunifiedArgumentParser(hApp, argc, argv, cmdLineOptions);
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ eStatus = FrameworkunifiedHSMDispatcherMain(hApp);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hFrameworkApp is NULL");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateHSMDispatcher error, status=%d", eStatus);
+ }
+ } catch (const THApp::Exception &) {
+ /**
+ * @todo
+ * When an exception error occurs in a FrameworkunifiedCreateHSMDispatcher,
+ * the caller cannot detect the exception because the exception becomes the eFrameworkunifiedStatusOK return code.
+ */
+ FRAMEWORKUNIFIEDLOG0(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedHSMCreateDispatcher ");
+ }
+
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function : FrameworkunifiedHSMDispatcherMain
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherMain(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "Success: FrameworkunifiedCreateDispatcher ");
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ CFrameworkunifiedHSMFramework *l_pStateMachine = pApp->m_pFrameworkunifiedStateMachine;
+
+ if (l_pStateMachine) {
+ eStatus = l_pStateMachine->FrameworkunifiedStart();
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedOnInitialization failed ");
+ l_pStateMachine->FrameworkunifiedClose();
+ throw happ_error();
+ } else {
+ eStatus = RunDispatcher(hApp);
+ }
+
+ l_pStateMachine->FrameworkunifiedClose();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "l_pStateMachine is NULL");
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ } catch (const frameworkunified::framework::error::CSystemError &err) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR :: %s", err.what());
+
+ FrameworkunifiedSendSystemErrMessage(hApp, err.m_eSystemError);
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to FrameworkunifiedCreateDispatcher ");
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function : FrameworkunifiedSetHSMType
+////////////////////////////////////////////////////////////////////////////////////////////
+void FrameworkunifiedSetHSMType(EUserChangeOptions f_eHSMType) {
+ s_tHSMConfigOptions.eUserChange = f_eHSMType;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function : FrameworkunifiedEnableAutoPublishServiceAvailable
+////////////////////////////////////////////////////////////////////////////////////////////
+void FrameworkunifiedEnableAutoPublishServiceAvailable() {
+ s_tHSMConfigOptions.bAutoPublishServiceAvaialble = TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function : FrameworkunifiedDisableAutoPublishServiceAvailable
+////////////////////////////////////////////////////////////////////////////////////////////
+void FrameworkunifiedDisableAutoPublishServiceAvailable() {
+ s_tHSMConfigOptions.bAutoPublishServiceAvaialble = FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function : FrameworkunifiedIsAutoPublishServiceAvailableEnabled
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsAutoPublishServiceAvailableEnabled() {
+ return s_tHSMConfigOptions.bAutoPublishServiceAvaialble;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedHSMEnableWaitInStoppingState
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID FrameworkunifiedHSMEnableWaitInStoppingState() {
+ s_tHSMConfigOptions.bWaitInStoppingState = TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedHSMDisableWaitInStoppingState
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID FrameworkunifiedHSMDisableWaitInStoppingState() {
+ s_tHSMConfigOptions.bWaitInStoppingState = FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedIsWaitInStoppingStateEnabled
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsWaitInStoppingStateEnabled() {
+ return s_tHSMConfigOptions.bWaitInStoppingState;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp
new file mode 100755
index 0000000..294dcf5
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_externaltransition.cpp
@@ -0,0 +1,225 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedExternalTransition class definitions. CFrameworkunifiedExternalTransition is derived
+/// from CFrameworkunifiedTransition class.This class implements the FrameworkunifiedReaction interface to support transition
+/// from one state to another state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_externaltransition.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_guard.h>
+#include <native_service/frameworkunified_sm_action.h>
+#include <vector>
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedExternalTransition::CFrameworkunifiedExternalTransition(CFrameworkunifiedState *f_pTargetState): CFrameworkunifiedTransition(f_pTargetState) {
+ m_pGuard = NULL;
+
+ // Create the condition list
+ m_pActionList = new std::vector<CFrameworkunifiedAction * >(); // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedExternalTransition::~CFrameworkunifiedExternalTransition() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+ if (m_pActionList) {
+ TActionListIterator l_itActionList = m_pActionList->begin();
+
+ while (m_pActionList->end() != l_itActionList) {
+ if (NULL != *l_itActionList) {
+ delete *l_itActionList;
+ *l_itActionList = NULL;
+ }
+ l_itActionList++;
+ }
+ // clear condition list
+ m_pActionList->clear();
+ delete m_pActionList;
+ m_pActionList = NULL;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedReaction
+/// The reaction for an event is implemented in this function. For external transition, Exit
+/// of the source state is called and entry of the target state is called recursively.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedExternalTransition::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) {
+ CFrameworkunifiedState *l_pActiveState = NULL;
+ BOOL l_bAllowTransition = FALSE;
+
+ try {
+ CHKNULL(f_pSourceState);
+ CHKNULL(m_pTargetState);
+
+ // Check if External transition has Guard condition
+ if (m_pGuard) {
+ // Evaluate guard condition
+ l_bAllowTransition = m_pGuard->FrameworkunifiedEvaluate();
+ } else {
+ // If Guard is not available then allow transition
+ l_bAllowTransition = TRUE;
+ }
+
+ if (l_bAllowTransition) {
+ l_pActiveState = ExecuteTransition(f_pSourceState, f_pData); // LCOV_EXCL_BR_LINE 11:except branch
+
+ } else {
+ // No state changed
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Guard condition for External Transition "
+ "from state %s to state %s failed"
+ , f_pSourceState->m_strStateName.c_str(), m_pTargetState->m_strStateName.c_str());
+
+ l_pActiveState = f_pSourceState;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pActiveState;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedExternalTransition::FrameworkunifiedSetGuard(CFrameworkunifiedGuard *f_pGuard) {
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pGuard);
+ m_pGuard = f_pGuard;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eFrameworkunifiedStatus;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedExternalTransition::ExecuteTransition(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) {
+ CFrameworkunifiedState *l_pActiveState = NULL;
+ try {
+ CHKNULL(m_pTargetState);
+ CHKNULL(f_pSourceState);
+ CFrameworkunifiedState *l_pTargetState = m_pTargetState;
+ CFrameworkunifiedState *l_pCurrentState = f_pSourceState;
+
+
+
+
+ // Find the common parent of the source and target state
+ // and then call recursively OnExit on source state and
+ // OnEntry on parent state
+ BOOL l_bFoundCommonParent = FALSE;
+ while (l_pCurrentState->m_pParentState) {
+ while (l_pTargetState->m_pParentState) {
+ // Check if current source state and target state has common parent
+ if (l_pCurrentState->m_pParentState == l_pTargetState->m_pParentState) {
+ l_bFoundCommonParent = TRUE;
+ break;
+ } else {
+ // Set the next target parent state
+ l_pTargetState = l_pTargetState->m_pParentState;
+ }
+ }
+
+ if (l_bFoundCommonParent) {
+ break;
+ } else {
+ // Set the next source parent state
+ l_pCurrentState = l_pCurrentState->m_pParentState;
+ l_pTargetState = m_pTargetState;
+ }
+ }
+
+ if (l_bFoundCommonParent) {
+ // recursively execute the exit on the current state
+ l_pCurrentState->FrameworkunifiedOnHSMStop(f_pData);
+
+ // execute actions associated with the external transition
+ CHKNULL(m_pActionList);
+ TActionListIterator l_itActionList = m_pActionList->begin();
+
+ // iterate action list and execute actions
+ while (m_pActionList->end() != l_itActionList) {
+ CFrameworkunifiedAction *l_pAction = *l_itActionList;
+ CHKNULL(l_pAction);
+
+ l_pAction->FrameworkunifiedAction(f_pSourceState, l_pTargetState, f_pData);
+
+ l_itActionList++;
+ }
+
+ // Set the target state as a active state
+ CFrameworkunifiedState *l_pState = m_pTargetState;
+ while (l_pState->m_pParentState != l_pTargetState->m_pParentState) {
+ CHKNULL(l_pState->m_pParentState);
+
+ l_pState->m_pParentState->m_pActiveState = l_pState;
+ l_pState = l_pState->m_pParentState;
+ }
+
+
+ // recursively execute the entry on the target state
+ l_pActiveState = l_pTargetState->FrameworkunifiedOnHSMStart(f_pData);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "External Transition from state %s to state %s"
+ , f_pSourceState->m_strStateName.c_str(), m_pTargetState->m_strStateName.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "External Transition from state %s to state %s failed"
+ , f_pSourceState->m_strStateName.c_str(), m_pTargetState->m_strStateName.c_str());
+ return NULL;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+
+ return l_pActiveState;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedExternalTransition::FrameworkunifiedAddAction(CFrameworkunifiedAction *f_pAction) {
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pActionList);
+
+ CHKNULL(f_pAction);
+
+ m_pActionList->push_back(f_pAction);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eFrameworkunifiedStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp
new file mode 100755
index 0000000..8b361fa
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_finalstate.cpp
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedFinalState class definitions. CFrameworkunifiedFinalState is derived from C
+/// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Final
+/// state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <string>
+#include "frameworkunified_sm_finalstate.h"
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedFinalState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedFinalState::~CFrameworkunifiedFinalState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "CFrameworkunifiedFinalState destructor");
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedFinalState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedFinalState::CFrameworkunifiedFinalState(std::string f_pName): CFrameworkunifiedState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedFinalState::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedFinalState::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedFinalState::FrameworkunifiedGetActiveState() {
+ return this;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedFinalState::UpdateHistory() {
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp
new file mode 100755
index 0000000..dfb2d5c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_framework_dispatch.cpp
@@ -0,0 +1,485 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_logger_if.h>
+#include <map>
+#include <utility>
+#include "frameworkunified_framework_core.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Registers a single event with the dispatcher for a given service.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachHSMEventToDispatcher(HANDLE hApp,
+ PCSTR pServiceName,
+ UI_32 iCmd,
+ UI_32 iEvent,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pServiceName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ EventServices::iterator s_iterator;
+ EventSessionTable::iterator session_iterator;
+
+ UI_32 uiSessionId = 0;
+ if (hSession) {
+ uiSessionId = FrameworkunifiedGetSessionId(hSession);
+ }
+
+ // finding the service
+ s_iterator = pApp->eventservices.find(pServiceName);
+ if (s_iterator == pApp->eventservices.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (service NOT found): service name [%s]", pApp->cAppName, pServiceName);
+ pApp->eventservices.insert(std::make_pair(pServiceName, EventSessionTable()));
+ }
+
+ session_iterator = pApp->eventservices[pServiceName].find(uiSessionId);
+ if (session_iterator == pApp->eventservices[pServiceName].end()) {
+ pApp->eventservices[pServiceName].insert
+ (std::make_pair(uiSessionId, ServiceEventProtocolTable()));
+ }
+
+ (pApp->eventservices[pServiceName].find(uiSessionId)->second).insert(std::make_pair(iCmd, iEvent));
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachHSMEventsToDispatcher
+/// Registers a multiple event with the dispatcher for a given service.
+////////////////////////////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus FrameworkunifiedAttachHSMEventsToDispatcher(HANDLE hApp, PCSTR pServiceName,
+ const FrameworkunifiedProtocolEvent *pEventIds, UI_32 uiEventCount, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pServiceName && pEventIds) {
+ // setup callbacks
+ for (UI_32 i = 0; i < uiEventCount; ++i) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachHSMEventToDispatcher(hApp,
+ pServiceName,
+ pEventIds[ i ].iCmd,
+ pEventIds[ i ].iEventId,
+ hSession))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedAttachParentCallbacksToDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachParentHSMEventsToDispatcher(HANDLE hChildApp, const FrameworkunifiedProtocolEvent *pEventIds,
+ UI_32 uiEventCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hChildApp);
+
+ eStatus = FrameworkunifiedAttachHSMEventsToDispatcher(hChildApp, pApp->cParentAppName, pEventIds, uiEventCount);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachParentCallbacksFromDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachParentHSMEventsFromDispatcher(HANDLE hChildApp,
+ const PUI_32 puiEventArray, UI_32 uiEventCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hChildApp);
+
+ eStatus = FrameworkunifiedDetachHSMEventsFromDispatcher(hChildApp, pApp->cParentAppName, puiEventArray, uiEventCount);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+/////////////////////////////////////////////////////
+// Function : FrameworkunifiedDetachHSMEventsFromDispatcher
+/////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachHSMEventsFromDispatcher(HANDLE hApp, PCSTR pServiceName, const PUI_32 puiEventArray,
+ UI_32 uiEventCount, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pServiceName) {
+ // setup callbacks
+ for (UI_32 i = 0; i < uiEventCount; ++i) {
+ /**
+ * @todo
+ * When an event-struct pointer is turned NULL, the array is accessed without NULL checking,
+ * and a segmentation fault occurs.
+ */
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachHSMEventFromDispatcher(hApp, pServiceName,
+ puiEventArray[ i ], hSession))) {
+ break;
+ }
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+/////////////////////////////////////////////
+// Function : FrameworkunifiedDetachHSMEventFromDispatcher
+/////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachHSMEventFromDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iEvent, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pServiceName) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ EventServices::iterator s_iterator;
+
+ UI_32 uiSessionId = 0;
+ if (hSession) {
+ uiSessionId = FrameworkunifiedGetSessionId(hSession);
+ }
+
+ // finding the service
+ s_iterator = pApp->eventservices.find(pServiceName);
+ if (s_iterator != pApp->eventservices.end()) {
+ EventSessionTable::iterator session_iterator;
+ session_iterator = (s_iterator->second).find(uiSessionId);
+ if (session_iterator != (s_iterator->second).end()) {
+ ServiceEventProtocolTable::iterator spt_iterator;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : (found): service [%s]", pApp->cAppName, pServiceName);
+
+ spt_iterator = (session_iterator->second).find(iEvent);
+ if (spt_iterator != (session_iterator->second).end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : Cmd found [%d] service [%s]",
+ pApp->cAppName, iEvent, pServiceName);
+ (session_iterator->second).erase(spt_iterator);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : Error : Cmd NOT found [%d] service [%s]",
+ pApp->cAppName, iEvent, pServiceName);
+ }
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : Cannot find service [%s]", pApp->cAppName, pServiceName);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachNotificationEventsToDispatcher
+/// API to attach a event to the dispatcher on receiving a specific notification.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationsWithHSMEvent(HANDLE hApp, const FrameworkunifiedNotificationEvent *pNtfyEvent,
+ UI_32 uiEventCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNtfyEvent) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ /// Deal with handling batch processing of subscriptions.
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPHSMSubscribeToNotificationsEvents(hApp, pNtfyEvent, uiEventCount))) {
+ for (UI_32 i = 0; i < uiEventCount; ++i) {
+ // service found
+ pApp->notificationevents.insert(std::make_pair(pNtfyEvent[ i ].cNotification, pNtfyEvent[ i ].iEventId));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : attaching call-back for notification [%s]", pApp->cAppName,
+ pNtfyEvent[ i ].cNotification);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to Subscribe "
+ "to batch set of notifications", pApp->cAppName,
+ eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachNotificationEventToDispatcher
+/// API to attach a event to the dispatcher on receiving a specific notification.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationWithHSMEvent(HANDLE hApp, PCSTR pNotification, UI_32 iEventId) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPHSMSubscribeToNotificationEvent(hApp, pNotification))) {
+ // service found
+ pApp->notificationevents.insert(std::make_pair(pNotification, iEventId));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : attaching call-back for notification [%s]",
+ pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to Subscribe "
+ "to notification [%s]", pApp->cAppName, eFrameworkunifiedStatusOK, pNotification);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachNotificationEventsFromDispatcher
+/// API to detach a notification event from the dispatcher.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationsWithHSMEvent(HANDLE hApp, const FrameworkunifiedNotificationEvent *pNtfyEvent,
+ UI_32 uiEventCount) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNtfyEvent) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ NotificationEventTable::iterator n_iterator;
+ PCSTR pNotification = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPHSMUnsubscribeFromNotificationEvents(hApp, pNtfyEvent, uiEventCount))) {
+ for (UI_32 l_unCount = 0; l_unCount < uiEventCount; ++l_unCount) {
+ pNotification = pNtfyEvent[ l_unCount ].cNotification;
+ n_iterator = pApp->notificationevents.find(pNotification);
+ if (n_iterator != pApp->notificationevents.end()) {
+ pApp->notificationevents.erase(n_iterator);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : removed notification [%s]", pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : Cannot find notification [%s]",
+ pApp->cAppName, pNotification);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : detaching call-back for notification [%s]",
+ pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to UnSubscribe from notifications ",
+ pApp->cAppName, eFrameworkunifiedStatusOK);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachNotificationEventsFromDispatcher
+/// API to detach a notification event from the dispatcher.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationWithHSMEvent(HANDLE hApp, PCSTR pNotification) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && pNotification) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ NotificationEventTable::iterator n_iterator;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedNPHSMUnsubscribeFromNotificationEvent(hApp, pNotification))) {
+ // \todo : error handling on all map function calls
+ n_iterator = pApp->notificationevents.find(pNotification);
+ if (n_iterator != pApp->notificationevents.end()) {
+ pApp->notificationevents.erase(n_iterator);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_DIS, __FUNCTION__, "%s : removed notification [%s]", pApp->cAppName, pNotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : Cannot find notification [%s]",
+ pApp->cAppName, pNotification);
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "%s : Error : [%d] Unable to UnSubscribe from notification [%s]",
+ pApp->cAppName, eFrameworkunifiedStatusOK, pNotification);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetStateMachine
+/// returns the pointer to the statemachine object
+////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMFramework *FrameworkunifiedGetStateMachine(HANDLE hApp) {
+ CFrameworkunifiedHSMFramework *l_pHSMFramework = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = static_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+ l_pHSMFramework = pApp->m_pFrameworkunifiedStateMachine;
+ }
+
+ return l_pHSMFramework;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSetStateMachine
+/// sets the statemachine object
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetStateMachine(HANDLE hApp,
+ CFrameworkunifiedHSM *f_pFrameworkunifiedHSM) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ if (NULL != f_pFrameworkunifiedHSM) {
+ (reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp))->m_pFrameworkunifiedStateMachine =
+ reinterpret_cast<CFrameworkunifiedHSMFramework *>(f_pFrameworkunifiedHSM);
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventWithHSMEvent
+/// This API is used for subscribing to single event of a service.
+/// This API also attaches the session event with HSM events.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventWithHSMEvent(HANDLE hApp,
+ UI_32 uiEventId,
+ UI_32 uiHSMEventId,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedAttachHSMEventToDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, uiEventId,
+ uiHSMEventId, hSession))) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS, sizeof(UI_32), (PVOID)&uiEventId);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedAttachCallbackToDispatcher "
+ "for PROTOCOL_REGISTER_EVENTS Failed Status:: %d", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventsWithHSMEvents
+/// This API is used for subscribing to multiple events of a service.
+/// This API also attaches the session events with hsm events.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventsWithHSMEvents(HANDLE hApp, const FrameworkunifiedProtocolEvent *pEventIds,
+ UI_32 uiEventCount,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession) && NULL != pEventIds) {
+ eStatus = FrameworkunifiedAttachHSMEventsToDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, pEventIds,
+ uiEventCount, hSession);
+
+ UI_32 l_uiCmdList[uiEventCount]; // NOLINT (readability/nolint)
+ for (UI_32 l_uiCnt = 0; l_uiCnt < uiEventCount; l_uiCnt++) {
+ l_uiCmdList[l_uiCnt] = pEventIds[l_uiCnt].iCmd;
+ }
+
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_REGISTER_EVENTS, static_cast<UI_32>(uiEventCount * sizeof(UI_32)),
+ l_uiCmdList);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventWithHSMEvent
+/// API to unsubscribe from event of a service. Also detaches HSM event.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventWithHSMEvent(HANDLE hApp, UI_32 uiEventId, HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession)) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS, sizeof(uiEventId), (PVOID)&uiEventId);
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedDetachHSMEventFromDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, uiEventId, hSession)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedDetachCallbackFromDispatcher failed status:: %d", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventsWithHSMEvents
+/// API to unsubscribe from multiple events of a service. Also detaches HSM events.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventsWithHSMEvents(HANDLE hApp, PUI_32 pEventsArray, UI_32 uiListSize,
+ HANDLE hSession) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && frameworkunifiedCheckValidMsgQ(hSession) && NULL != pEventsArray) {
+ eStatus = FrameworkunifiedSendMsg(hSession, PROTOCOL_UNREGISTER_EVENTS,
+ static_cast<UI_32>(uiListSize * sizeof(uiListSize)), pEventsArray);
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedDetachHSMEventsFromDispatcher(hApp,
+ (reinterpret_cast<MsgQInfo *>(hSession))->cMsgQName, pEventsArray,
+ uiListSize)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error : FrameworkunifiedDetachCallbackFromDispatcher failed status:: %d", eStatus);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp
new file mode 100755
index 0000000..7afabdb
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_guard.cpp
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedGuard class definitions. This is an interface that defines the Evaluate
+/// interface for guard condition validation.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_guard.h>
+#include <string>
+CFrameworkunifiedGuard::~CFrameworkunifiedGuard() {
+}
+
+CFrameworkunifiedGuard::CFrameworkunifiedGuard(std::string f_strName): m_strName(f_strName) {
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp
new file mode 100755
index 0000000..9640276
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_historystate.cpp
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedHistoryState class definitions. CFrameworkunifiedHistoryState is derived from
+/// CFrameworkunifiedState class.This class implements the additional functionality supported by HSM History
+/// state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_sm_historystate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedHistoryState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHistoryState::CFrameworkunifiedHistoryState(std::string f_pName): CFrameworkunifiedState(f_pName), m_pLastActiveState(NULL), m_uiEventId(0) { // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedHistoryState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHistoryState::~CFrameworkunifiedHistoryState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "CFrameworkunifiedHistoryState destructor");
+}
+
+CFrameworkunifiedState *CFrameworkunifiedHistoryState::FrameworkunifiedGetActiveState() {
+ return this;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHistoryState::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ try {
+ CHKNULL(m_pLastActiveState);
+ CHKNULL(m_pEventList);
+
+ CFrameworkunifiedExternalTransition *l_pTrnTargetState = new CFrameworkunifiedExternalTransition(m_pLastActiveState);
+
+ m_pActiveState = l_pTrnTargetState->FrameworkunifiedReaction(this, f_pEventData);
+ CHKNULL(m_pActiveState);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHistoryState::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// SetDefaultHistory
+/// This function sets the default active state in history state
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHistoryState::SetDefaultHistory() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(m_pParentState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ m_pLastActiveState = m_pParentState->m_pDefaultState;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus; // LCOV_EXCL_BR_LINE 11: except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnHSMStart
+/// This function internally calls the Entry function of the current state.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedHistoryState::FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pActiveState = this;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ // Call Entry method of the current state. Entry method of state is called in the order of
+ // Hierarchy from Outer state to Inner state
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedOnEntry(f_pEventData))) {
+ l_pActiveState = m_pActiveState;
+ } else {
+ // If FrameworkunifiedOnEntry failed then statemachine should report the error
+ // We can throw an exception but for now as a quick fix we are setting
+ // l_pActiveState as NULL which will stop the statemachine
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error:%d in state %s", eStatus,
+ l_pActiveState->m_strStateName.c_str());
+ // l_pActiveState = NULL;
+ /* Commenting it, because it was making state machine inactive. This should not be the expected behavior.
+ * Just log and take no action, if user return non-ok value.
+ * User defined error values should be handled separately */
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pActiveState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnHSMStop
+/// This function internally calls the Exit function of the current state.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedHistoryState::FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData) {
+ return this;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp
new file mode 100755
index 0000000..f6cdb09
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsm.cpp
@@ -0,0 +1,529 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedHSM class definitions. CFrameworkunifiedHSM is base class for HSM Framework.
+/// This class implements interfaces for connecting child states to parent states, connecting events
+/// to state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_sm_reaction.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_compositestate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_orthogonalstate.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <cstdio>
+#include <sstream>
+#include <string>
+
+#include "frameworkunified_framework_internal.h"
+#include "frameworkunified_sm_framework_core.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedHSM
+/// Class constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSM::CFrameworkunifiedHSM(PVOID f_pHApp): m_uiCurrentEvent(0), m_pHApp(f_pHApp), m_pActiveState(NULL), m_pRootState(NULL),
+ m_bIsTransitioning(FALSE) {
+ // PostEventList stores the list of events posted in the state
+ m_pPostEventList = new EventInfoList();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedHSM
+/// Class constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSM::CFrameworkunifiedHSM(): m_uiCurrentEvent(0), m_pHApp(NULL), m_pActiveState(NULL), m_pRootState(NULL),
+ m_bIsTransitioning(FALSE) {
+ // PostEventList stores the list of events posted in the state
+ m_pPostEventList = new EventInfoList();
+ m_pHApp = NULL;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedHSM
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSM::~CFrameworkunifiedHSM() {
+ if (NULL != m_pPostEventList) {
+ delete m_pPostEventList;
+ m_pPostEventList = NULL;
+ }
+
+ if (m_pRootState) {
+ FrameworkunifiedClose();
+ }
+
+ // we are not deleting this pointer because memory pointed by this pointer
+ // had already been deleted in above step.
+ m_pActiveState = NULL;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetActiveState
+/// Returns the active state of the statemachine
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedHSM::FrameworkunifiedGetActiveState() {
+ CFrameworkunifiedState *l_pCurrentState = m_pRootState;
+ CFrameworkunifiedState *l_pActiveState = NULL;
+
+ try {
+ // Iterate till the current state is leafstate or orthogonal state
+ while (l_pCurrentState != l_pActiveState) {
+ l_pActiveState = l_pCurrentState;
+ l_pCurrentState = l_pCurrentState->FrameworkunifiedGetActiveState();
+ CHKNULL(l_pCurrentState);
+ }
+
+ // Set active state
+ m_pActiveState = l_pActiveState;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Active state is %s "
+ , m_pActiveState->m_strStateName.c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_pActiveState = NULL;
+ }
+
+
+ return l_pActiveState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedStart
+/// This starts the state machine
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedStart(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(m_pActiveState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ m_bIsTransitioning = TRUE;
+
+ // Start the state machine execution on current state
+ m_pActiveState = m_pActiveState->FrameworkunifiedOnHSMStart(f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Active state is %s "
+ , m_pActiveState->m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ // post the event from events list
+ eStatus = ProcessEventQueue(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ m_bIsTransitioning = FALSE;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedConnect
+/// This connects the reaction to event and add event to child states then add child state
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::CFrameworkunifiedHSM::FrameworkunifiedConnect(CFrameworkunifiedState *f_pParentState, CFrameworkunifiedState *f_pChildState,
+ UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction,
+ BOOL f_bIsDefaultState, BOOL f_bIsDeferredEventType,
+ std::string f_strEventName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ // attach reaction to event and add it to the child state
+ eStatus = FrameworkunifiedConnect(f_pChildState, f_uiEventId, f_pReaction, f_strEventName, f_bIsDeferredEventType);
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ // add child state to parent state
+ eStatus = FrameworkunifiedConnect(f_pParentState, f_pChildState, f_bIsDefaultState);
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedConnect
+/// This add child state to parent state.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedConnect(CFrameworkunifiedState *f_pParentState, CFrameworkunifiedState *f_pChildState,
+ BOOL f_bIsDefaultState) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pParentState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(f_pChildState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ // Check if the state is composite state
+ if (f_pParentState->FrameworkunifiedHasSubStates()) {
+ // Check if the child state is default state
+ if (f_bIsDefaultState) {
+ // Add child state as default state
+ (reinterpret_cast<CFrameworkunifiedCompositeState *>(f_pParentState))->FrameworkunifiedAddState(f_pChildState,
+ CFrameworkunifiedCompositeState::eFrameworkunifiedDefaultState); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ // Add state as regular state
+ (reinterpret_cast<CFrameworkunifiedCompositeState *>(f_pParentState))->FrameworkunifiedAddState(f_pChildState); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ f_pChildState->FrameworkunifiedSetHSM(this); // LCOV_EXCL_BR_LINE 11: except branch
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error %s is not a composite state",
+ f_pParentState->m_strStateName.c_str());
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus; //LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedConnect
+/// This connects the reaction to event and add event to child states
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedConnect(CFrameworkunifiedState *f_pState, UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction,
+ std::string f_strEventName , BOOL f_bIsDeferredEventType) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ // check if the event is deferred event
+ if (f_bIsDeferredEventType) {
+ // Add event as deferred event
+ f_pState->FrameworkunifiedAddDeferredEvent(f_uiEventId, f_strEventName); // LCOV_EXCL_BR_LINE 11: except branch
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Deferred Event %d %s is "
+ "associated with Reaction and added to state %s "
+ , f_uiEventId, f_strEventName.c_str(), (f_pState->m_strStateName).c_str());
+ // LCOV_EXCL_BR_STOP
+ } else {
+ CHKNULL(f_pReaction); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ // Add event as regular event
+ f_pState->FrameworkunifiedAddEvent(f_uiEventId, f_pReaction, f_strEventName); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Event %d %s is associated with Reaction and added to state %s "
+ , f_uiEventId, f_strEventName.c_str(), (f_pState->m_strStateName).c_str());
+ // LCOV_EXCL_BR_STOP
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to add event %d in %s", f_uiEventId,
+ (f_pState->m_strStateName).c_str());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPostEvent
+/// This creates the default event data and sends the event to the active HSM state.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedPostEvent(UI_32 f_uiEventId) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; // LCOV_EXCL_BR_LINE 11: except branch
+ try {
+ CEventDataPtr l_pEventData(new CEventData(f_uiEventId)); // LCOV_EXCL_BR_LINE 11:except branch
+ CHKNULL(l_pEventData); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ l_eStatus = FrameworkunifiedPostEvent(l_pEventData); // LCOV_EXCL_BR_LINE 11: except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPostEvent
+/// This sends the event to the active HSM state
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedPostEvent(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pEventData); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ if (m_bIsTransitioning) {
+ eStatus = FrameworkunifiedQueueEvent(f_pEventData); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ m_bIsTransitioning = TRUE;
+
+ eStatus = ProcessEvent(f_pEventData); // LCOV_EXCL_BR_LINE 11: except branch
+
+ m_bIsTransitioning = FALSE;
+
+ CHKNULL(m_pActiveState);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Active state is %s ", m_pActiveState->m_strStateName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSM::ProcessEvent(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pActiveState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(f_pEventData); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pActiveState->m_pEventName); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ EventNameList::iterator l_itEventName;
+ l_itEventName = m_pActiveState->m_pEventName->find(f_pEventData->m_uiEventId);
+
+ if (m_pActiveState->m_pEventName->end() != l_itEventName) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Posting event %d %s to state %s",
+ f_pEventData->m_uiEventId,
+ l_itEventName->second.c_str(),
+ m_pActiveState->m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ }
+
+ m_uiCurrentEvent = f_pEventData->m_uiEventId;
+
+ // Send event to active state for processing
+ m_pActiveState = m_pActiveState->FrameworkunifiedOnEvent(f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+
+ CHKNULL(m_pActiveState);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Active state is %s ", m_pActiveState->m_strStateName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ // post the event from events list
+ eStatus = ProcessEventQueue(); // LCOV_EXCL_BR_LINE 11:except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedClose
+/// This stops the state machine and destroys all states and events
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedClose(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pRootState);
+ delete m_pRootState;
+ m_pRootState = NULL;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedConnect
+/// This sets the givens state as root state in the state machine
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedConnect(CFrameworkunifiedState *f_pRootState) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pRootState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ m_pActiveState = f_pRootState;
+ m_pRootState = f_pRootState;
+
+ m_pRootState->FrameworkunifiedSetHSM(this); // LCOV_EXCL_BR_LINE 11:except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPrintAllStates
+/// This prints all states and events associated with every state on console.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedPrintAllStates() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pRootState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ // Print the states
+ m_pRootState->FrameworkunifiedPrintStates();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedConnectOrthogonal(CFrameworkunifiedOrthogonalState *f_pOrthogonalState,
+ CFrameworkunifiedCompositeState *f_pOrthogonalRegion) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pOrthogonalState) // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(f_pOrthogonalRegion) // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ f_pOrthogonalState->FrameworkunifiedAddOrthogonalRegion(f_pOrthogonalRegion);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+HANDLE CFrameworkunifiedHSM::FrameworkunifiedGetAppHandle() {
+ return m_pHApp;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedPrintXML() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ try {
+ std::ostringstream l_strXMLString;
+ l_strXMLString << "<Statemachine>";
+
+ CHKNULL(m_pRootState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ // Write statemachine information in XML stream
+ m_pRootState->FrameworkunifiedPrintXML(l_strXMLString);
+ l_strXMLString << "</Statemachine>";
+
+ // Write a stream to XML file
+ if (m_pHApp) {
+ size_t l_uiLength = static_cast<size_t>(l_strXMLString.str().length());
+
+ PCHAR l_pStream = new CHAR[l_uiLength + 1];
+ if (NULL != l_pStream) {
+ std::FILE *l_pFile = NULL;
+
+ std::memset(l_pStream, 0, l_uiLength + 1);
+ std::strncpy(l_pStream, l_strXMLString.str().c_str(), l_uiLength);
+
+ std::ostringstream l_strFileName;
+
+ l_strFileName << "StatemachineXML_";
+
+ l_strFileName << FrameworkunifiedGetAppName(m_pHApp) << ".xml";
+
+ l_pFile = std::fopen(l_strFileName.str().c_str(), "wbe");
+
+ if (l_pFile) {
+ std::fwrite(l_pStream, l_uiLength, 1, l_pFile);
+ std::fclose(l_pFile);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "%s File Created"
+ , l_strFileName.str().c_str());
+ }
+ delete[] l_pStream;
+ l_pStream = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: StatemachineXML_%s.xml file not created", FrameworkunifiedGetAppName(m_pHApp));
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, l_strXMLString.str().c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSM::FrameworkunifiedQueueEvent(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pPostEventList); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pActiveState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(f_pEventData); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ // Push the event in the post event list(FIFO)
+ m_pPostEventList->push_back(f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ProcessEventQueue
+/// This post the event from events list
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::ProcessEventQueue() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(m_pPostEventList); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ if (!m_pPostEventList->empty()) {
+ CEventDataPtr l_pEventData = m_pPostEventList->front(); // LCOV_EXCL_BR_LINE 11:except branch
+ CHKNULL(l_pEventData); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ CHKNULL(m_pActiveState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "Processing posted event %d in state %s",
+ l_pEventData->m_uiEventId, m_pActiveState->m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ m_pPostEventList->erase(m_pPostEventList->begin());
+
+ eStatus = ProcessEvent(l_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveEventFromPostedEventQueue
+/// This API is used to remove the all events of eventId f_uiEventId from event queue of statemachine
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSM::RemoveEventFromPostedEventQueue(const UI_32 f_uiEventId) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldID;
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pPostEventList) {
+ int32_t l_siCnt = static_cast<int32_t>(m_pPostEventList->size() - 1);
+
+ for (; l_siCnt >= 0; l_siCnt--) {
+ if (NULL != m_pPostEventList->at(l_siCnt).get()) {
+ if (f_uiEventId == m_pPostEventList->at(l_siCnt).get()->m_uiEventId) {
+ m_pPostEventList->erase(m_pPostEventList->begin() + l_siCnt);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp
new file mode 100755
index 0000000..da060f2
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_hsmframework.cpp
@@ -0,0 +1,1419 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedHSMParentFramework class definitions. CFrameworkunifiedHSMParentFramework is derived from
+/// CFrameworkunifiedHSM class. It defines the states required for NS statemachine framework, it creates the NS
+/// statemachine and implements the reaction associated with the events
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_notification.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/ns_plogger_if.h>
+
+#include <map>
+#include <string>
+
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+#include "frameworkunified_framework_utility.h"
+#include "frameworkunified_sm_framework_core.h"
+
+extern EFrameworkunifiedStatus FrameworkunifiedHSMOnLoadData(HANDLE hApp) __attribute__((weak));
+extern EFrameworkunifiedStatus FrameworkunifiedHSMOnStopInsFrameworkunifiedRun(HANDLE hApp) __attribute__((weak));
+
+CFrameworkunifiedHSMFramework::CFrameworkunifiedHSMFramework(): CFrameworkunifiedHSM() {
+}
+CFrameworkunifiedHSMFramework::CFrameworkunifiedHSMFramework(PVOID f_pHApp): CFrameworkunifiedHSM(f_pHApp) {
+}
+CFrameworkunifiedHSMParentFramework::CFrameworkunifiedHSMParentFramework(): CFrameworkunifiedHSMFramework() {
+ try {
+ m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedHSMParentFramework
+/// default constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CFrameworkunifiedHSMParentFramework(PVOID f_pHApp): CFrameworkunifiedHSMFramework(f_pHApp) {
+ try {
+ m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedHSMParentFramework
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::~CFrameworkunifiedHSMParentFramework() {
+ // TODO(framework_unifeid) Auto-generated destructor stub
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreate
+/// Statemachine states and events created and connected in this interface.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::FrameworkunifiedCreate(PVOID f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ HSMConfigOptions *l_tHSMConfig = NULL;
+ try {
+ if (f_pEventData) {
+ l_tHSMConfig = reinterpret_cast<HSMConfigOptions *>(f_pEventData);
+ }
+
+ // Create states
+ CREATE_STATE(sFrameworkunifiedRoot)
+ CREATE_STATE(sFrameworkunifiedApp)
+ CREATE_STATE(sFrameworkunifiedInitialization)
+ CREATE_STATE(sFrameworkunifiedLoadData)
+ CREATE_STATE(sFrameworkunifiedRun)
+ CREATE_STATE(sFrameworkunifiedLoadSessions)
+ CREATE_STATE(sFrameworkunifiedReady)
+ CREATE_STATE(sFrameworkunifiedStop)
+ CREATE_STATE(sFrameworkunifiedStopping)
+ CREATE_STATE(sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CREATE_STATE(sFrameworkunifiedBackground) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ // connect states as per the statemachine
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedRoot, sFrameworkunifiedApp)
+ CONNECT_STATE(sFrameworkunifiedRoot, sFrameworkunifiedStop)
+
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedApp, sFrameworkunifiedInitialization)
+ CONNECT_STATE(sFrameworkunifiedApp, sFrameworkunifiedRun)
+
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedInitialization, sFrameworkunifiedLoadData)
+ CONNECT_STATE(sFrameworkunifiedInitialization, sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CONNECT_STATE(sFrameworkunifiedInitialization, sFrameworkunifiedBackground) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedRun, sFrameworkunifiedLoadSessions)
+ CONNECT_STATE(sFrameworkunifiedRun, sFrameworkunifiedReady)
+
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedStop, sFrameworkunifiedStopping)
+
+ // Create External Transition
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedApp)
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedStop)
+
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedLoadSessions)
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedReady)
+
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedBackground) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ // CREATE_ACTION(aFrameworkunifiedOnStart)
+
+ // this is a patch, this code will be fixed once we change the macro for CONNECT_ACTION
+ CFrameworkunifiedExternalTransition *l_pTrnsFrameworkunifiedRunevFrameworkunifiedStart = new CFrameworkunifiedExternalTransition(l_psFrameworkunifiedRun);
+
+ // CONNECT_ACTION(sFrameworkunifiedRunevFrameworkunifiedStart,aFrameworkunifiedOnStart)
+
+ // Connecting events to sFrameworkunifiedInitialization state
+ CONNECT_EVENT(sFrameworkunifiedInitialization, evFrameworkunifiedStart, sFrameworkunifiedRunevFrameworkunifiedStart)
+ CONNECT_EVENT(sFrameworkunifiedInitialization, evFrameworkunifiedPreStart, sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+ CONNECT_EVENT(sFrameworkunifiedInitialization, evFrameworkunifiedBackgroundStart, sFrameworkunifiedBackground) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+
+ // Create Local transitions
+ CREATE_LOCALTRANSITION(sFrameworkunifiedInitialization);
+ CREATE_LOCALTRANSITION(sFrameworkunifiedStop);
+
+ // Connect events to state
+
+ // Connecting events to sFrameworkunifiedLoadData state
+ CONNECT_DEFERREDEVENT(sFrameworkunifiedLoadData, evFrameworkunifiedStart)
+ CONNECT_DEFERREDEVENT(sFrameworkunifiedLoadData, evFrameworkunifiedUserChange)
+ CONNECT_LOCAL_EVENT(sFrameworkunifiedLoadData, evFrameworkunifiedLoadComplete, sFrameworkunifiedInitialization)
+
+ // Connecting events to App state
+ CONNECT_EVENT(sFrameworkunifiedApp, evFrameworkunifiedStop, sFrameworkunifiedStop)
+ CONNECT_LOCAL_EVENT(sFrameworkunifiedStopping, evFrameworkunifiedStopComplete, sFrameworkunifiedStop)
+ CONNECT_DEFERREDEVENT(sFrameworkunifiedStopping, evFrameworkunifiedStart)
+
+ // Connecting events to Connecting state
+ CONNECT_EVENT(sFrameworkunifiedLoadSessions, evFrameworkunifiedReady, sFrameworkunifiedReady)
+ // CONNECT_EVENT(sFrameworkunifiedReady,evFrameworkunifiedLoadSessions,sFrameworkunifiedRun)
+ CONNECT_EVENT(sFrameworkunifiedReady, evFrameworkunifiedLoadSessions, sFrameworkunifiedLoadSessions)
+
+ // Connecting events to Stop state
+ CONNECT_EVENT(sFrameworkunifiedStop, evFrameworkunifiedInit, sFrameworkunifiedApp)
+
+ // Create internal transitions
+ CREATE_INTERNALTRANSITION(OnEventStartInStopState)
+ CONNECT_EVENT(sFrameworkunifiedStop, evFrameworkunifiedStart, OnEventStartInStopState)
+
+ CREATE_INTERNALTRANSITION(OnEventStopInStoppingState)
+ CONNECT_EVENT(sFrameworkunifiedStopping, evFrameworkunifiedStop, OnEventStopInStoppingState)
+
+ // Connecting events to sFrameworkunifiedRun state
+ CONNECT_EVENT(sFrameworkunifiedRun, evFrameworkunifiedPreStop, sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CONNECT_EVENT(sFrameworkunifiedRun, evFrameworkunifiedBackgroundStop, sFrameworkunifiedBackground) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+
+ // Connecting events to sFrameworkunifiedBackground state
+ CONNECT_EVENT(sFrameworkunifiedBackground, evFrameworkunifiedPreStop, sFrameworkunifiedPre) // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ if (NULL != l_tHSMConfig) {
+ if (eUserchangeIgnore != l_tHSMConfig->eUserChange) {
+ if (eUserchangeReInit == l_tHSMConfig->eUserChange) {
+ // Create Internal Transition
+ CREATE_INTERNALTRANSITION(OnEventUserChangeInInitializationState)
+ CONNECT_EVENT(sFrameworkunifiedInitialization, evFrameworkunifiedUserChange, OnEventUserChangeInInitializationState)
+
+ // Create Internal Transition
+ CREATE_INTERNALTRANSITION(OnEventUserChangeInRunState)
+ CONNECT_EVENT(sFrameworkunifiedRun, evFrameworkunifiedUserChange, OnEventUserChangeInRunState)
+
+ CREATE_ACTION(aFrameworkunifiedOnStop)
+
+ // this is a patch, this code will be fixed once we change the macro for CONNECT_ACTION
+ CFrameworkunifiedExternalTransition *l_pTrnsFrameworkunifiedAppevFrameworkunifiedInit = new CFrameworkunifiedExternalTransition(l_psFrameworkunifiedApp);
+
+ CONNECT_ACTION(sFrameworkunifiedAppevFrameworkunifiedInit, aFrameworkunifiedOnStop)
+
+ CONNECT_EVENT(sFrameworkunifiedApp, evFrameworkunifiedInit, sFrameworkunifiedAppevFrameworkunifiedInit)
+
+ } else if (eUserchangeRetPrevState == l_tHSMConfig->eUserChange) {
+ CREATE_STATE(sFrameworkunifiedUserChange)
+
+ CONNECT_STATE(sFrameworkunifiedRoot, sFrameworkunifiedUserChange)
+
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedUserChange)
+
+ CONNECT_EVENT(sFrameworkunifiedApp, evFrameworkunifiedUserChange, sFrameworkunifiedUserChange)
+ CONNECT_EVENT(sFrameworkunifiedUserChange, evFrameworkunifiedStop, sFrameworkunifiedStop)
+
+ CONNECT_DEFERREDEVENT(sFrameworkunifiedUserChange, evFrameworkunifiedStart)
+ CONNECT_DEFERREDEVENT(sFrameworkunifiedUserChange, evFrameworkunifiedUserChange)
+
+ // add shallow history state in state sFrameworkunifiedApp
+ ADD_SHALLOWHISTORYSTATE(sFrameworkunifiedApp)
+
+ // create transition to shallow history state in state sFrameworkunifiedApp
+ CREATE_SHALLOWHISTORYTRANSITION(sFrameworkunifiedApp)
+
+ // Connecting events to UserChange State
+ CONNECT_SHALLOWHISTORYEVENT(sFrameworkunifiedUserChange, evFrameworkunifiedUserChangeComplete, sFrameworkunifiedApp)
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Incorrect Userchange config option %d", l_tHSMConfig->eUserChange);
+ }
+ }
+ }
+
+ // Connecting FrameworkRoot to statemachine
+ CONNECTROOT(sFrameworkunifiedRoot)
+
+ // Creating the application specific statemachine
+ CHKNULL(m_pHApp);
+ FrameworkunifiedCreateStateMachineInternal(m_pHApp);
+
+ // Print statemachine xml
+ PRINT_HSM();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedFrameworkConnect
+/// This adds the given state as a sub state of sReady state of the Framework
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::FrameworkunifiedFrameworkConnect(CFrameworkunifiedState *f_pAppState, BOOL f_bIsDefaultState) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pFrameworkunifiedStateList);
+ CHKNULL(f_pAppState);
+
+ if (m_pFrameworkunifiedStateList->find(esFrameworkunifiedReady) == m_pFrameworkunifiedStateList->end()) {
+ throw CNullPointerException();
+ }
+ CFrameworkunifiedState *l_pReady = reinterpret_cast<CFrameworkunifiedCompositeState *>(m_pFrameworkunifiedStateList->find(esFrameworkunifiedReady)->second);
+ CHKNULL(l_pReady);
+
+ eStatus = FrameworkunifiedConnect(l_pReady, f_pAppState, f_bIsDefaultState);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedFrameworkConnect
+/// This connects the reaction to event and add event to states
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::FrameworkunifiedFrameworkConnect(FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState, UI_32 f_uiEventId,
+ CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName,
+ BOOL f_bIsDeferredEvent) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pFrameworkunifiedStateList);
+
+ if (m_pFrameworkunifiedStateList->find(f_eFrameworkunifiedState) == m_pFrameworkunifiedStateList->end()) {
+ throw CNullPointerException();
+ }
+ CFrameworkunifiedState *l_pFrameworkunifiedState = reinterpret_cast<CFrameworkunifiedCompositeState *>(m_pFrameworkunifiedStateList->find(f_eFrameworkunifiedState)->second);
+
+ CHKNULL(l_pFrameworkunifiedState);
+
+ eStatus = FrameworkunifiedConnect(l_pFrameworkunifiedState, f_uiEventId, f_pReaction, f_strEventName, f_bIsDeferredEvent);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedRoot
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRoot::CsFrameworkunifiedRoot(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedRoot
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRoot::~CsFrameworkunifiedRoot() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// Initializes the application and registers the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRoot::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization +");
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedOnInitializationInternal(l_pHApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to Initialize application:0x%x ", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnInitialization -");
+
+ // Publish service unavailability
+ if (FrameworkunifiedIsAutoPublishServiceAvailableEnabled()) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedPublishServiceAvailability(l_pHApp, FALSE))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to set service availability notification:0x%x ", eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Service unavailable published");
+ }
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRoot::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedApp
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedApp::CsFrameworkunifiedApp(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedRoot
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedApp::~CsFrameworkunifiedApp() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// Initializes the application and registers the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedApp::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedApp::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedUserChange
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedUserChange::CsFrameworkunifiedUserChange(std::string f_pName): CFrameworkunifiedLeafState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedRoot
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedUserChange::~CsFrameworkunifiedUserChange() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// Initializes the application and registers the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedUserChange::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ if (!FrameworkunifiedIsReactionAvailable(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadUserData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, " Reaction not available for evFrameworkunifiedUserChangeComplete");
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, " No reaction for loading user specific data ");
+
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedUserChangeComplete));
+ } else {
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadUserData));
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedUserChange::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedInitialization
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedInitialization::CsFrameworkunifiedInitialization(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedInitialization
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedInitialization::~CsFrameworkunifiedInitialization() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedInitialization::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedInitialization::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedHSMParentFramework::COnEventUserChangeInInitializationState::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState,
+ CEventDataPtr f_pEventData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "In Reaction OnEventUserChangeInInitializationState");
+ CHKNULL(f_pSourceState);
+
+ // post the event to move to sFrameworkunifiedApp state
+ f_pSourceState->FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedInit));
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return f_pSourceState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedLoadData
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadData::CsFrameworkunifiedLoadData(std::string f_pName): CFrameworkunifiedLeafState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedLoadData
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadData::~CsFrameworkunifiedLoadData() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadData::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CHKNULL(FrameworkunifiedGetStateMachine(l_pHApp));
+
+ UI_32 l_uiCurrentEventId = FrameworkunifiedGetStateMachine(l_pHApp)->m_uiCurrentEvent;
+ if (!(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedUserChangeComplete) == l_uiCurrentEventId)) {
+ if (FrameworkunifiedHSMOnLoadData) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedHSMOnLoadData(l_pHApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to load application data:0x%X ", eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning: FrameworkunifiedHSMOnLoadData not defined by the application");
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSubscribeNotificationWithHSMEvent(l_pHApp,
+ NTFY_NPPService_UserChange,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedUserChange)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "FrameworkunifiedSubscribeNotificationWithHSMEvent "
+ "NTFY_NPPService_UserChange Failed Status:0x%x ", eStatus);
+ return eStatus;
+ }
+ // Attach callback : Event to start the StateMachine
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedAttachHSMEventToDispatcher(l_pHApp,
+ FRAMEWORKUNIFIED_ANY_SOURCE,
+ NPS_GET_PERS_FILE_ACK,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadFileAck)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher NPS_GET_PERS_FILE_ACK (FRAMEWORKUNIFIED_ANY_SOURCE) Failed Status:0x%x ", eStatus);
+ return eStatus;
+ }
+ if (!FrameworkunifiedIsReactionAvailable(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadFileAck))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, " Reaction not available for evFrameworkunifiedLoadFileAck");
+
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadComplete));
+ }
+ } else {
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedLoadComplete));
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadData::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pHSM);
+
+ UI_32 l_uiCurrentEventId = l_pHSM->m_uiCurrentEvent;
+
+ if (FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStop) == l_uiCurrentEventId) {
+ l_pHSM->RemoveEventFromPostedEventQueue(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart));
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedPre
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedPre::CsFrameworkunifiedPre(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others) // NOLINT(whitespace/line_length)
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedPre
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedPre::~CsFrameworkunifiedPre() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedPre::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CHKNULL(f_pEventData); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ // Only evFrameworkunifiedPreStart or evFrameworkunifiedPreStop events occur when functions are executed.
+ if (f_pEventData->m_uiEventId == FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedPreStart)) {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnPreStartInternal +"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ eStatus = FrameworkunifiedOnPreStartInternal(l_pHApp);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to pre start application:0x%x ", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnPreStartInternal -"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ } else {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnPreStopInternal +"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ eStatus = FrameworkunifiedOnPreStopInternal(l_pHApp);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to pre stop application:0x%x ", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnPreStopInternal -"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedPre::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedBackground
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedBackground::CsFrameworkunifiedBackground(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others) // NOLINT(whitespace/line_length)
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedBackground
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedBackground::~CsFrameworkunifiedBackground() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedBackground::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+ CHKNULL(f_pEventData); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions
+
+ // Only evFrameworkunifiedBackgroundStart or evFrameworkunifiedBackgroundStop events occur when functions are executed.
+ if (f_pEventData->m_uiEventId == FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedBackgroundStart)) {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnBackgroundStartInternal +"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+ eStatus = FrameworkunifiedOnBackgroundStartInternal(l_pHApp);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to background start application:0x%x ", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnBackgroundStartInternal -"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+ } else {
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnBackgroundStopInternal +"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+ eStatus = FrameworkunifiedOnBackgroundStopInternal(l_pHApp);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to background stop application:0x%x ", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("FrameworkunifiedOnBackgroundStopInternal -"); // LCOV_EXCL_BR_LINE 15:Excluded due to inlined functions // NOLINT(whitespace/line_length)
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedBackground::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedRun
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRun::CsFrameworkunifiedRun(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedRun
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRun::~CsFrameworkunifiedRun() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// Subscribes for the service availability notification and calls FrameworkunifiedOnStart
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRun::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ try {
+ HANDLE hApp = FrameworkunifiedGetAppHandle();
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ FrameworkunifiedOnStartInternal(hApp);
+
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ for (UI_32 l_uiCount = 0; l_uiCount < pApp->servicenotificationlist.size(); l_uiCount++) {
+ ServiceNotificationInfo objNotification = pApp->servicenotificationlist.at(l_uiCount);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSubscribeNotificationWithHSMEvent
+ (hApp, objNotification.sNotificationName, objNotification.uiEventId))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "failed to subscribe notification %s"
+ , objNotification.sNotificationName);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "successfully subscribe notification %s"
+ , objNotification.sNotificationName);
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "Application handle is NULL");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedRun::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+
+ try {
+ HANDLE hApp = FrameworkunifiedGetAppHandle();
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (frameworkunifiedCheckValidAppHandle(hApp)) {
+ // Let application also handle exit of sFrameworkunifiedRun state
+ if (FrameworkunifiedHSMOnStopInsFrameworkunifiedRun) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedHSMOnStopInsFrameworkunifiedRun(hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning: FrameworkunifiedHSMOnStopInsFrameworkunifiedRun returned: 0x%X ", l_eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning: FrameworkunifiedHSMOnStopInsFrameworkunifiedRun not defined by the application");
+ }
+
+ for (UI_32 l_uiCount = 0; l_uiCount < pApp->servicenotificationlist.size(); l_uiCount++) {
+ ServiceNotificationInfo objNotification = pApp->servicenotificationlist.at(l_uiCount);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedUnsubscribeNotificationWithHSMEvent(hApp,
+ objNotification.sNotificationName))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "failed to unsubscribe notification %s",
+ objNotification.sNotificationName);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "successfully unsubscribed from notification %s",
+ objNotification.sNotificationName);
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __PRETTY_FUNCTION__, "Application handle is NULL");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedHSMParentFramework::COnEventUserChangeInRunState::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState,
+ CEventDataPtr f_pEventData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "In Reaction OnEventUserChangeInRunState");
+ CHKNULL(f_pSourceState);
+
+ // post the event to move to sFrameworkunifiedApp state
+ f_pSourceState->FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedInit));
+
+ CHKNULL(f_pSourceState);
+
+ // post the event to move to sFrameworkunifiedRun state
+ f_pSourceState->FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart));
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+ return f_pSourceState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedLoadSessions
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadSessions::CsFrameworkunifiedLoadSessions(std::string f_pName): CFrameworkunifiedLeafState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedLoadSessions
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadSessions::~CsFrameworkunifiedLoadSessions() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadSessions::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ HANDLE hApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(hApp);
+
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast<CFrameworkunifiedFrameworkApp *>(hApp);
+
+ if (!pApp->servicenotificationlist.size()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, " No Mandatory services set ");
+
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedReady));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, " Wait for service availability of mandatory services ");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedLoadSessions::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedReady
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedReady::CsFrameworkunifiedReady(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedReady
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedReady::~CsFrameworkunifiedReady() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedReady::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ if (FrameworkunifiedIsAutoPublishServiceAvailableEnabled()) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ if (eFrameworkunifiedStatusOK != (FrameworkunifiedPublishServiceAvailability(l_pHApp, TRUE))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "warning:Failed to Publish service availability notification:0x%x ",
+ l_eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Service available published");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Auto Service available published feature disabled");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedReady::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ try {
+ ServiceSessionTable::iterator session_iterator;
+ SessionHandleTable::iterator session_handle_iterator;
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ if (FrameworkunifiedIsAutoPublishServiceAvailableEnabled()) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ if (eFrameworkunifiedStatusOK != (FrameworkunifiedPublishServiceAvailability(l_pHApp, FALSE))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Warning:Failed to set service availability notification:0x%x ", l_eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Service unavailable published");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Auto Service available published feature disabled");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedStop
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStop::CsFrameworkunifiedStop(std::string f_pName): CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedStop
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStop::~CsFrameworkunifiedStop() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStop::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ // every application need to implement this function
+ // all the resource deallocation like file release,etc should be done in this callback
+ l_eStatus = FrameworkunifiedOnStopInternal(l_pHApp);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING: FrameworkunifiedOnStop returned %d", l_eStatus);
+ // We just need to print the error.
+ // Returning this status to state machine is not required.
+ // Currently, If not OK is sent to state machine while FrameworkunifiedOnEntry, then state machine becomes dead.
+ l_eStatus = eFrameworkunifiedStatusOK; // Therefore assign ok.
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStop::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CsFrameworkunifiedStopping
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStopping::CsFrameworkunifiedStopping(std::string f_pName): CFrameworkunifiedLeafState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedStopping
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStopping::~CsFrameworkunifiedStopping() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStopping::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ try {
+ if (FrameworkunifiedIsWaitInStoppingStateEnabled()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Event evFrameworkunifiedStopComplete not posted. User has to post it.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Reaction not available for evFrameworkunifiedStopAck");
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Posting event evFrameworkunifiedStopComplete");
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStopComplete));
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMParentFramework::CsFrameworkunifiedStopping::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedHSMParentFramework::COnEventStopInStoppingState::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState,
+ CEventDataPtr f_pEventData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "In Reaction OnEventStopInStoppingState");
+ CHKNULL(f_pSourceState);
+
+ (VOID)f_pSourceState->FrameworkunifiedRemoveEventFromDeferredEventList(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart));
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+ return f_pSourceState;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedHSMParentFramework::COnEventStartInStopState::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState,
+ CEventDataPtr f_pEventData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "In Reaction OnEventStartInStopState");
+ CHKNULL(f_pSourceState);
+
+ // post the event to move to sFrameworkunifiedApp state
+ f_pSourceState->FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedInit));
+
+ CHKNULL(f_pSourceState);
+
+ // post the event to transit to sFrameworkunifiedRun state
+ f_pSourceState->FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart));
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+ return f_pSourceState;
+}
+
+VOID CFrameworkunifiedHSMParentFramework::CaFrameworkunifiedOnStop::FrameworkunifiedAction(CFrameworkunifiedState *f_pSourceState, CFrameworkunifiedState *f_pTargetState,
+ CEventDataPtr f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "In Action %s", m_strName.c_str());
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ if (NULL != l_pHApp) {
+ FrameworkunifiedOnStopInternal(l_pHApp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Application handle is NULL in Action %s", m_strName.c_str());
+ }
+}
+
+CFrameworkunifiedHSMChildFramework::CFrameworkunifiedHSMChildFramework(): CFrameworkunifiedHSMFramework() {
+}
+
+
+CFrameworkunifiedHSMChildFramework::CFrameworkunifiedHSMChildFramework(PVOID f_pHApp): CFrameworkunifiedHSMFramework(f_pHApp) {
+ try {
+ m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+}
+
+CFrameworkunifiedHSMChildFramework::~CFrameworkunifiedHSMChildFramework() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreate
+/// Statemachine states and events created and connected in this interface.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::FrameworkunifiedCreate(PVOID f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ // Create states
+ CREATE_STATE(sFrameworkunifiedThreadRoot)
+ CREATE_STATE(sFrameworkunifiedThreadIdle)
+ CREATE_STATE(sFrameworkunifiedThreadStart)
+ CREATE_STATE(sFrameworkunifiedThreadReady)
+ CREATE_STATE(sFrameworkunifiedThreadStop)
+
+ // connect states as per the statemachine
+ CONNECT_DEFAULTSTATE(sFrameworkunifiedThreadRoot, sFrameworkunifiedThreadIdle)
+ CONNECT_STATE(sFrameworkunifiedThreadRoot, sFrameworkunifiedThreadStart)
+ CONNECT_STATE(sFrameworkunifiedThreadRoot, sFrameworkunifiedThreadStop)
+ CONNECT_STATE(sFrameworkunifiedThreadRoot, sFrameworkunifiedThreadReady)
+
+ // Create External Transition
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedThreadIdle)
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedThreadStart)
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedThreadReady)
+ CREATE_EXTERNALTRANSITION(sFrameworkunifiedThreadStop)
+
+ // Connect events to state
+ CONNECT_EVENT(sFrameworkunifiedThreadIdle, evFrameworkunifiedStart, sFrameworkunifiedThreadStart)
+ CONNECT_EVENT(sFrameworkunifiedThreadStart, evFrameworkunifiedReady, sFrameworkunifiedThreadReady)
+ CONNECT_EVENT(sFrameworkunifiedThreadStart, evFrameworkunifiedError, sFrameworkunifiedThreadIdle)
+ CONNECT_EVENT(sFrameworkunifiedThreadReady, evFrameworkunifiedStop, sFrameworkunifiedThreadStop)
+ CONNECT_EVENT(sFrameworkunifiedThreadStop, evFrameworkunifiedStart, sFrameworkunifiedThreadStart)
+
+ // Create Internal Transition
+ CREATE_INTERNALTRANSITION(OnDestroyThread)
+ CONNECT_EVENT(sFrameworkunifiedThreadRoot, evFrameworkunifiedDestroy, OnDestroyThread)
+
+ // Connecting AppRoot to statemachine
+ CONNECTROOT(sFrameworkunifiedThreadRoot)
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// COnDestroyThread::FrameworkunifiedReaction
+/// This reaction is executed when request for terminating the thread is received.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedHSMChildFramework::COnDestroyThread::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState,
+ CEventDataPtr f_pEventData) {
+ // return the NULL to exit the dispatcher loop of thread
+ return NULL;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::FrameworkunifiedFrameworkConnect(CFrameworkunifiedState *f_pAppState, BOOL f_bIsDefaultState) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pFrameworkunifiedStateList);
+ CHKNULL(f_pAppState);
+
+ if (m_pFrameworkunifiedStateList->find(esFrameworkunifiedThreadReady) == m_pFrameworkunifiedStateList->end()) {
+ throw CNullPointerException();
+ }
+ CFrameworkunifiedState *l_pReady = reinterpret_cast<CFrameworkunifiedCompositeState *>(m_pFrameworkunifiedStateList->find(esFrameworkunifiedThreadReady)->second);
+ CHKNULL(l_pReady);
+
+ eStatus = FrameworkunifiedConnect(l_pReady, f_pAppState, f_bIsDefaultState);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::FrameworkunifiedFrameworkConnect(FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState, UI_32 f_uiEventId,
+ CFrameworkunifiedReaction *f_pReaction,
+ std::string f_strEventName, BOOL f_bIsDeferredEvent) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pFrameworkunifiedStateList);
+
+ if (m_pFrameworkunifiedStateList->find(f_eFrameworkunifiedState) == m_pFrameworkunifiedStateList->end()) {
+ throw CNullPointerException();
+ }
+ CFrameworkunifiedState *l_pFrameworkunifiedState = reinterpret_cast<CFrameworkunifiedCompositeState *>(m_pFrameworkunifiedStateList->find(f_eFrameworkunifiedState)->second);
+
+ CHKNULL(l_pFrameworkunifiedState);
+
+ eStatus = FrameworkunifiedConnect(l_pFrameworkunifiedState, f_uiEventId, f_pReaction, f_strEventName, f_bIsDeferredEvent);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedThreadRoot
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadRoot::CsFrameworkunifiedThreadRoot(std::string f_pName)
+ : CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedThreadRoot
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadRoot::~CsFrameworkunifiedThreadRoot() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// publishes the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadRoot::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadRoot::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedThreadIdle
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadIdle::CsFrameworkunifiedThreadIdle(std::string f_pName)
+ : CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedThreadIdle
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadIdle::~CsFrameworkunifiedThreadIdle() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// publishes the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadIdle::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadIdle::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedThreadStart
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStart::CsFrameworkunifiedThreadStart(std::string f_pName)
+ : CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedThreadStart
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStart::~CsFrameworkunifiedThreadStart() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// publishes the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStart::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >
+ (FrameworkunifiedGetAppHandle());
+ CHKNULL(reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine));
+ CHKNULL((reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStartThread);
+ if (eFrameworkunifiedStatusOK ==
+ (reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStartThread(pApp)) {
+ FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedReady));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Thread start Failed: %s", m_strStateName.c_str());
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStart::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedThreadReady
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadReady::CsFrameworkunifiedThreadReady(std::string f_pName)
+ : CFrameworkunifiedCompositeState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedThreadReady
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadReady::~CsFrameworkunifiedThreadReady() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// publishes the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadReady::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadReady::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedThreadStop
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStop::CsFrameworkunifiedThreadStop(std::string f_pName)
+ : CFrameworkunifiedLeafState(f_pName) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CsFrameworkunifiedThreadStop
+/// class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStop::~CsFrameworkunifiedThreadStop() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// publishes the service availability notification
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStop::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+
+ HANDLE hApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(hApp);
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >
+ (hApp);
+ CHKNULL(reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine));
+ CHKNULL((reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStopThread);
+
+ eStatus = (reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStopThread(pApp);
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "WARNING: Thread stop function returned %d", eStatus);
+ // We just need to print the error.
+ // Returning this status to state machine is not required.
+ // Currently, If not OK is sent to state machine while FrameworkunifiedOnEntry, then state machine becomes dead.
+ eStatus = eFrameworkunifiedStatusOK; // Therefore assign ok.
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedHSMChildFramework::CsFrameworkunifiedThreadStop::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp
new file mode 100755
index 0000000..6c44ebb
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_leafstate.cpp
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedLeafState class definitions. CFrameworkunifiedLeafState is derived from C
+/// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Leafstate.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_leafstate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedLeafState::CFrameworkunifiedLeafState(std::string f_pName): CFrameworkunifiedState(f_pName) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedLeafState::~CFrameworkunifiedLeafState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "CFrameworkunifiedLeafState destructor");
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedLeafState::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedLeafState::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedLeafState::FrameworkunifiedGetActiveState() {
+ return this;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedLeafState::UpdateHistory() {
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp
new file mode 100755
index 0000000..b5f9c0a
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_localtransition.cpp
@@ -0,0 +1,84 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_localtransition.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedExternalTransition
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedLocalTransition::CFrameworkunifiedLocalTransition(CFrameworkunifiedState *f_pTargetState): CFrameworkunifiedTransition(f_pTargetState) {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedExternalTransition
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedLocalTransition::~CFrameworkunifiedLocalTransition() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedReaction
+/// The reaction for an event is implemented in this function. For local transition from inner
+/// state to outer state exit of the inner state is invoked, but entry of outer state is not
+/// invoked and from outer state to inner state entry of the inner state is invoked but exit of
+/// outer state is not invoked
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedLocalTransition::FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) {
+ CFrameworkunifiedState *l_pActiveState = NULL;
+ CFrameworkunifiedState *l_pCurrentState = NULL;
+ try {
+ CHKNULL(f_pSourceState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pTargetState); // LCOV_EXCL_BR_LINE 15: marco defined in frameworkunified_sm_framework_types.h
+
+ // Local transition from inner state to outer state
+ if (f_pSourceState->m_pParentState == m_pTargetState) {
+ // Source is child of target
+ l_pCurrentState = f_pSourceState->FrameworkunifiedOnHSMStop(f_pData);
+
+ if (l_pCurrentState == f_pSourceState) {
+ l_pActiveState = m_pTargetState;
+
+ } else {
+ l_pActiveState = l_pCurrentState;
+ }
+
+ /**
+ * @todo
+ * If the parent state is registered and OnEvent is performed without OrthogonalReigonList, illegal accesses occur.
+ */
+ l_pActiveState->m_pActiveState = NULL;
+
+ // Local transition from outer state to inner state
+ } else if (f_pSourceState == m_pTargetState->m_pParentState) {
+ // Source is parent to target state
+ l_pActiveState = m_pTargetState->FrameworkunifiedOnHSMStart(f_pData);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Local Transition from state %s to state %s"
+ , f_pSourceState->m_strStateName.c_str(), m_pTargetState->m_strStateName.c_str());
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+
+ return NULL;
+ }
+
+ return l_pActiveState;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp
new file mode 100755
index 0000000..33dab56
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_multithreading.cpp
@@ -0,0 +1,211 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief This file has the function implementation for creating state machine child thread
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+#include <sys/prctl.h>
+
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_utility.hpp>
+#include <native_service/ns_system_mode.h>
+#include <native_service/frameworkunified_sm_multithreading.h>
+#include <native_service/frameworkunified_multithreading.h>
+
+#include <iostream>
+#include <string>
+
+#include "frameworkunified_framework_utility.h"
+#include "frameworkunified_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateHSMDispatcherChild
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateHSMDispatcherChild(PCSTR childName,
+ PCSTR parentName,
+ HANDLE &hChildApp, // NOLINT (readability/nolint)
+ CbFuncPtr pOnThreadStart,
+ CbFuncPtr pOnThreadStop) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((NULL != childName) && (NULL != parentName) && (strlen(childName) <= MAX_NAME_SIZE_APP) &&
+ (strlen(parentName) <= MAX_NAME_SIZE_APP)) {
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateHSMDispatcher(childName, hChildApp, TRUE))) {
+ if (frameworkunifiedCheckValidAppHandle(hChildApp)) {
+ CFrameworkunifiedFrameworkApp *pApp = reinterpret_cast< CFrameworkunifiedFrameworkApp * >(hChildApp);
+
+ (reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStartThread
+ = pOnThreadStart;
+
+ (reinterpret_cast<CFrameworkunifiedHSMChildFramework *>(pApp->m_pFrameworkunifiedStateMachine))->m_fpStopThread
+ = pOnThreadStop;
+
+ pApp->hParentSndMsgQ = McOpenSender(parentName);
+ if (NULL == pApp->hParentSndMsgQ) {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "McOpenSender failed");
+ return eStatus;
+ }
+ pApp->uiSessionId = THREAD_SESSION_ID;
+
+ memset(pApp->cParentAppName, 0, sizeof(pApp->cParentAppName));
+ memcpy(pApp->cParentAppName, parentName, strlen(parentName));
+ } else {
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hChildApp is NULL");
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateHSMDispatcher error, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid Param received"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eStatus;
+}
+
+void *child_hsm_thread_proc(void *args) {
+ if (args == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "args is NULL");
+ return NULL;
+ }
+ PCData pcdata = *reinterpret_cast< PCData * >(args); // Create a local copy of data
+
+ try {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ HANDLE hFrameworkApp = NULL;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedCreateHSMDispatcherChild(pcdata.childName.c_str(),
+ pcdata.parentName.c_str(),
+ hFrameworkApp,
+ pcdata.initFn,
+ pcdata.shdnFn))) {
+ if (NULL != hFrameworkApp) {
+ THApp hChildApp(hFrameworkApp);
+
+ if (pcdata.CbCreateStateMachine) {
+ pcdata.CbCreateStateMachine(hChildApp);
+ FRAMEWORKUNIFIED_PRINT_HSM(hChildApp)
+ }
+ const FrameworkunifiedProtocolEvent pcbhs[] = { { SYSTEM_ON_INITIALIZATION, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart) },
+ { SYSTEM_ON_SHUTDOWN, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStop) },
+ { SYSTEM_ON_DESTROY, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedDestroy) }
+ };
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(hChildApp,
+ pcdata.parentName.c_str(),
+ &pcbhs[ 0 ],
+ static_cast<UI_32>(_countof(pcbhs)),
+ NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to attach hsm events to child thread %s",
+ pcdata.childName.c_str());
+ }
+
+ // set child thread name
+ char thread_name[16];
+ strncpy(thread_name, pcdata.childName.c_str(), sizeof(thread_name));
+ prctl(PR_SET_NAME, thread_name);
+ thread_name[15] = '\0';
+
+ setChildThreadSched(pcdata.schedPolicy, pcdata.schedPriority);
+
+ (FrameworkunifiedGetStateMachine(hChildApp))->FrameworkunifiedStart();
+
+ *pcdata.childStatus = eFrameworkunifiedStatusOK;
+ if (IsValidWaitBarrier(pthread_barrier_wait(pcdata.barrier))) {
+ RunChildDispatcher(hChildApp);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "hFrameworkApp is NULL");
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedCreateHSMDispatcherChild error, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+
+ *pcdata.childStatus = eFrameworkunifiedStatusFail;
+ pthread_barrier_wait(pcdata.barrier);
+ }
+ } catch (const THApp::Exception &) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to create child %s", pcdata.childName.c_str());
+ }
+
+ return NULL;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateHSMChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize,
+ CbFuncPtr CbShutdown, CbFuncPtr CbCreateStateMachine) {
+ HANDLE hChildQ = NULL;
+ FrameworkunifiedChildThreadAttr attr;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && NULL != CbInitialize && NULL != CbShutdown &&
+ NULL != CbCreateStateMachine) {
+ CreateChildThreadAttrInit(&attr);
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, &attr, CbCreateStateMachine);
+ }
+
+ return hChildQ;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateHSMChildThreadWithPriority
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThreadWithPriority(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize,
+ CbFuncPtr CbShutdown, CbFuncPtr CbCreateStateMachine, SI_32 schedPrio) {
+ HANDLE hChildQ = NULL;
+ FrameworkunifiedChildThreadAttr attr;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && NULL != CbInitialize && NULL != CbShutdown &&
+ NULL != CbCreateStateMachine) {
+ CreateChildThreadAttrInit(&attr);
+ CreateChildThreadAttrSetSched(&attr, eFrameworkunifiedSchedPolicyRR, schedPrio);
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, &attr, CbCreateStateMachine);
+ }
+ return hChildQ;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreateHSMChildThreadWithAttribute
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThreadWithAttribute(HANDLE hApp,
+ PCSTR childName,
+ CbFuncPtr CbInitialize,
+ CbFuncPtr CbShutdown,
+ CbFuncPtr CbCreateStateMachine,
+ const FrameworkunifiedChildThreadAttr *attr) {
+ HANDLE hChildQ = NULL;
+
+ if (frameworkunifiedCheckValidAppHandle(hApp) && NULL != childName && NULL != CbInitialize && NULL != CbShutdown &&
+ NULL != CbCreateStateMachine) {
+ hChildQ = CreateChildThread(hApp, childName, CbInitialize, CbShutdown, attr, CbCreateStateMachine);
+ }
+ return hChildQ;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp
new file mode 100755
index 0000000..a8289a0
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_orthogonalstate.cpp
@@ -0,0 +1,337 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedOrthogonalState class definitions. CFrameworkunifiedOrthogonalState is derived from
+/// CFrameworkunifiedCompositeState class.This class implements the additional functionality supported by HSM
+/// Orthogonal state. It provides the standard interfaces for adding orthogonal state machines.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_orthogonalstate.h>
+#include <native_service/frameworkunified_sm_compositestate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <sstream>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedCompositeState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedOrthogonalState::CFrameworkunifiedOrthogonalState(std::string f_pName): CFrameworkunifiedState(f_pName) {
+ try {
+ m_pOrthogonalReigonList = new OrthogonalRegionList();
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedOrthogonalState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedOrthogonalState::~CFrameworkunifiedOrthogonalState() {
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ delete m_pOrthogonalReigonList->at(l_uiCount);
+ }
+ }
+ m_pOrthogonalReigonList->clear();
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "CFrameworkunifiedOrthogonalState destructor");
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEntry
+/// state initialization can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Entering state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnExit
+/// state cleanup can be performed in this function.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedOnExit(CEventDataPtr f_pEventData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, " Leaving state %s ", m_strStateName.c_str());
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedAddOrthogonalRegion(CFrameworkunifiedCompositeState *f_pOrthogonalRegion) {
+ try {
+ CHKNULL(f_pOrthogonalRegion);
+ CHKNULL(m_pOrthogonalReigonList);
+ f_pOrthogonalRegion->m_pParentState = this;
+ m_pOrthogonalReigonList->push_back(f_pOrthogonalRegion);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedOrthogonalState::FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pCurrentState = NULL;
+ CFrameworkunifiedState *l_pActiveState = NULL;
+
+ try {
+ FrameworkunifiedOnEntry(f_pEventData);
+
+ CHKNULL(m_pOrthogonalReigonList);
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ l_pActiveState = (m_pOrthogonalReigonList->at(l_uiCount));
+ CHKNULL(l_pActiveState);
+
+ l_pCurrentState = l_pActiveState->FrameworkunifiedOnHSMStart(f_pEventData);
+ CHKNULL(l_pCurrentState);
+
+ if (!IsOrthogonalChildState(l_pCurrentState)) {
+ break;
+ } else {
+ l_pCurrentState = this;
+ }
+ }
+ }
+
+ // set current state as the active state of its parent state to maintain the Hierarchy
+ if (m_pParentState) {
+ m_pParentState->m_pActiveState = l_pCurrentState;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pCurrentState;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedOrthogonalState::FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pCurrentState = NULL;
+ CFrameworkunifiedState *l_pActiveState = NULL;
+
+ try {
+ CHKNULL(m_pOrthogonalReigonList);
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ l_pActiveState = (m_pOrthogonalReigonList->at(l_uiCount));
+ CHKNULL(l_pActiveState);
+
+ l_pCurrentState = l_pActiveState->FrameworkunifiedOnHSMStop(f_pEventData);
+ CHKNULL(l_pCurrentState);
+
+ if (!IsOrthogonalChildState(l_pCurrentState)) {
+ break;
+ } else {
+ l_pCurrentState = this;
+ }
+ }
+ }
+ FrameworkunifiedOnExit(f_pEventData);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pCurrentState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEvent
+/// This function processes the event. If the reaction for event is available in the current
+/// state within eventlist and deferred eventlist then it is consumed in the current state
+/// otherwise forwarded to the parent state. Event forwarding is done recursively till either
+/// event is consumed or the root state has encountered. This also process the events posted
+/// in the reactions recursively till all posted events are cleared.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedOrthogonalState::FrameworkunifiedOnEvent(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pCurrentState = NULL;
+ CFrameworkunifiedState *l_pStateIterator = NULL;
+ CFrameworkunifiedState *l_pOrthogonalRegion = NULL;
+ BOOL l_bReactionAvailable = FALSE;
+ BOOL l_bIsEventProcessed = FALSE;
+
+ try {
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ l_pOrthogonalRegion = m_pOrthogonalReigonList->at(l_uiCount);
+
+ if (l_pOrthogonalRegion) {
+ // get the current active state
+ l_pCurrentState = l_pOrthogonalRegion->FrameworkunifiedGetActiveState();
+ CHKNULL(l_pCurrentState);
+
+ l_pStateIterator = l_pCurrentState;
+
+ // checks whether the reaction for the event is available in this orthogonal region
+ while (this != l_pStateIterator) {
+ if (l_pStateIterator->FrameworkunifiedIsReactionAvailable(f_pEventData->m_uiEventId)) {
+ l_bReactionAvailable = TRUE;
+ l_bIsEventProcessed = TRUE;
+ break;
+ }
+
+ // iterate to parent state in orthogonal region
+ l_pStateIterator = l_pStateIterator->m_pParentState;
+ }
+
+ // if reaction is found, post the event
+ if (l_bReactionAvailable) {
+ l_bReactionAvailable = FALSE;
+
+ l_pCurrentState = l_pCurrentState->FrameworkunifiedOnEvent(f_pEventData);
+ CHKNULL(l_pCurrentState);
+
+ // check whether current active state is within the orthogonal state
+ if (IsOrthogonalChildState(l_pCurrentState)) {
+ l_pCurrentState = this;
+ }
+
+ break;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Reaction not available in orthogonal region %s",
+ l_pOrthogonalRegion->m_strStateName.c_str());
+ l_pCurrentState = this;
+ }
+ }
+ }
+
+ // if event is not processed in any of orthogonal region, post the event to orthogonal state
+ if (!l_bIsEventProcessed) {
+ l_pCurrentState = CFrameworkunifiedState::FrameworkunifiedOnEvent(f_pEventData);
+
+ // check whether current active state is within the orthogonal state
+ if (IsOrthogonalChildState(l_pCurrentState)) {
+ l_pCurrentState = this;
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pCurrentState;
+}
+
+BOOL CFrameworkunifiedOrthogonalState::FrameworkunifiedHasOrthogoanlRegions() {
+ try {
+ CHKNULL(m_pOrthogonalReigonList);
+
+ if (m_pOrthogonalReigonList->size()) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return FALSE;
+ }
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedPrintStates() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "%s:%s",
+ (m_pParentState->m_strStateName).c_str(), m_strStateName.c_str());
+
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ m_pOrthogonalReigonList->at(l_uiCount)->FrameworkunifiedPrintStates();
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+BOOL CFrameworkunifiedOrthogonalState::IsOrthogonalChildState(CFrameworkunifiedState *f_pChildState) {
+ CFrameworkunifiedState *l_pParentState = f_pChildState;
+ BOOL l_bIsOrthgonalChild = FALSE;
+ while (l_pParentState) {
+ if (this == l_pParentState) {
+ l_bIsOrthgonalChild = TRUE;
+ break;
+ }
+
+ l_pParentState = l_pParentState->m_pParentState;
+ }
+
+ return l_bIsOrthgonalChild;
+}
+
+CFrameworkunifiedState *CFrameworkunifiedOrthogonalState::FrameworkunifiedGetActiveState() {
+ return this;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(f_pStatemachine);
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size();
+ l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ m_pOrthogonalReigonList->at(l_uiCount)->FrameworkunifiedSetHSM(f_pStatemachine);
+ }
+ }
+ m_pStateMachine = f_pStatemachine;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ f_strXMLString << "<" << m_strStateName.c_str() << ">";
+ f_strXMLString << "<OrthogonalRegions>";
+
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pOrthogonalReigonList->size(); l_uiCount++) {
+ if (m_pOrthogonalReigonList->at(l_uiCount)) {
+ m_pOrthogonalReigonList->at(l_uiCount)->FrameworkunifiedPrintXML(f_strXMLString);
+ }
+ }
+
+ f_strXMLString << "</OrthogonalRegions>";
+ f_strXMLString << "</" << m_strStateName.c_str() << ">";
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedOrthogonalState::UpdateHistory() {
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp
new file mode 100755
index 0000000..97b6e3b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_shallowhistorystate.cpp
@@ -0,0 +1,74 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedShallowHistoryState class definitions. CFrameworkunifiedShallowHistoryState is derived
+/// from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported by
+/// HSM ShallowHistory state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_shallowhistorystate.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <string>
+
+// define static members of class
+const UI_32 CFrameworkunifiedShallowHistoryState::m_suievShallowHistory = 71;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedShallowHistoryState
+/// Parameterized constructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedShallowHistoryState::CFrameworkunifiedShallowHistoryState(std::string f_pName): CFrameworkunifiedHistoryState(f_pName) {
+ m_uiEventId = m_suievShallowHistory;
+ m_cEventName = "evShallowHistory";
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedShallowHistoryState
+/// Class destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedShallowHistoryState::~CFrameworkunifiedShallowHistoryState() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "CFrameworkunifiedShallowHistoryState destructor");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateHistory
+/// This function stores the last active state
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedShallowHistoryState::UpdateHistory() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(m_pParentState);
+
+ m_pLastActiveState = m_pParentState->m_pActiveState;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp
new file mode 100755
index 0000000..af90583
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_state.cpp
@@ -0,0 +1,634 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedState class implementation. CFrameworkunifiedState is base class for all types of
+/// state classes.This class implements the basic functionality required for HSM state.
+/// It provides the standard interfaces for entering, exiting and reacting in a state.
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_reaction.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <sstream>
+#include <string>
+#include <utility>
+#include "frameworkunified_sm_framework_core.h"
+#include "frameworkunified_framework_internal.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedState
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState::CFrameworkunifiedState(std::string f_pName): m_strStateName(f_pName) {
+ try {
+ // EventList stores the list of events associated with the state
+ m_pEventList = new EventReactionList(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // Deferred eventlist stores the list of deferred events associated
+ // with the state
+ m_pDeferredEventList = new DeferredEventList(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // Deferred PostEventList stores the list of posted deferred events posted
+ // in the state
+ m_pDeferredPostEventList = new EventInfoList(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // EventName map stores the Name of event against event id, The event name is
+ // only used for debugging so this can be disbaled in case of release build
+ m_pEventName = new EventNameList(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ m_pDefaultState = NULL;
+ m_pActiveState = NULL;
+ m_pParentState = NULL;
+ m_pStateMachine = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "%s state created ", f_pName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed in %s state ", f_pName.c_str());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedState
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState::~CFrameworkunifiedState() {
+ EventReactionIterator l_objEventIterator;
+ EventReactionIterator l_objDeferredEventIterator;
+
+ try {
+ // Delete the event list
+ CHKNULL(m_pEventList);
+ for (l_objEventIterator = m_pEventList->begin();
+ l_objEventIterator != m_pEventList->end();
+ l_objEventIterator++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, " deleting the event %d in state %s",
+ (*l_objEventIterator).first , m_strStateName.c_str());
+
+ if (NULL != (*l_objEventIterator).second) {
+ (*l_objEventIterator).second->m_ucRefCount--;
+
+ if (0 == ((*l_objEventIterator).second->m_ucRefCount)) {
+ delete(*l_objEventIterator).second;
+ (*l_objEventIterator).second = NULL;
+ }
+ }
+ }
+
+ // Delete the eventlist
+ m_pEventList->clear();
+ delete m_pEventList;
+ m_pEventList = NULL;
+
+ // Delete the deferred eventlist
+ CHKNULL(m_pDeferredEventList);
+ m_pDeferredEventList->clear();
+ delete m_pDeferredEventList;
+ m_pDeferredEventList = NULL;
+
+ // delete deferred Post event list
+ CHKNULL(m_pDeferredPostEventList);
+ m_pDeferredPostEventList->clear();
+ delete m_pDeferredPostEventList;
+ m_pDeferredPostEventList = NULL;
+
+ // delete event name list
+ CHKNULL(m_pEventName);
+ m_pEventName->clear();
+ delete m_pEventName;
+ m_pEventName = NULL;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAddEvent
+/// Associates the event id with the reaction in the state. When the event is posted to the
+/// state the associated reaction is executed. This also adds the event name to the map
+/// which is used for debugging.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedAddEvent(UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ // LCOV_EXCL_BR_START 15:marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pEventName);
+ CHKNULL(m_pEventList);
+ CHKNULL(f_pReaction);
+ // LCOV_EXCL_BR_STOP
+ // associate the eventname with event id (debugging only)
+ m_pEventName->insert(std::pair<UI_32, std::string>(f_uiEventId, f_strEventName));
+
+ f_pReaction->m_ucRefCount++;
+
+ // associate the reaction with event id
+ m_pEventList->insert(std::pair<UI_32, CFrameworkunifiedReaction *>(f_uiEventId, f_pReaction));
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Reaction associated with the event %d %s in the state %s "
+ , f_uiEventId, (m_pEventName->find(f_uiEventId)->second).c_str(), m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to add event %d %s in state %s",
+ f_uiEventId , (m_pEventName->find(f_uiEventId)->second).c_str(), m_strStateName.c_str());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEvent
+/// This function processes the event. If the reaction for event is available in the current
+/// state within eventlist and deferred eventlist then it is consumed in the current state
+/// otherwise forwarded to the parent state. Event forwarding is done recursively till either
+/// event is consumed or the root state has encountered. This also process the events posted
+/// in the reactions recursively till all posted events are cleared.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedState::FrameworkunifiedOnEvent(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pCurrentState = this;
+ CFrameworkunifiedReaction *l_pEventReaction = NULL;
+
+ try {
+ // LCOV_EXCL_BR_START 15:marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pEventList);
+ CHKNULL(m_pDeferredEventList);
+ // LCOV_EXCL_BR_STOP
+ // Find the reaction object for given event id
+
+ /**
+ * @todo
+ * Unauthorized accesses will occur if NULL is specified for the event data.
+ */
+ if (m_pEventList->end() != m_pEventList->find(f_pEventData->m_uiEventId)) {
+ l_pEventReaction = reinterpret_cast<CFrameworkunifiedReaction *>((m_pEventList->find(f_pEventData->m_uiEventId))->second);
+ }
+
+ if (l_pEventReaction) {
+ // execute the reaction associated with the event
+ l_pCurrentState = l_pEventReaction->FrameworkunifiedReaction(this, f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "Reaction completed for event %d %s in state %s "
+ , f_pEventData->m_uiEventId, (m_pEventName->find(f_pEventData->m_uiEventId)->second).c_str(),
+ m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ } else if (IsEventDeferred(f_pEventData->m_uiEventId)) {
+ // If given event is deferred event then handle defer event
+ CHKNULL(m_pDeferredPostEventList);
+
+ m_pDeferredPostEventList->push_back(f_pEventData);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "deferred event %d %s posted to state %s ",
+ f_pEventData->m_uiEventId,
+ (m_pEventName->find(f_pEventData->m_uiEventId)->second).c_str(),
+ m_strStateName.c_str());
+
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_DEV_INFO, __FUNCTION__, "Reaction not available or event %d not found in state %s"
+ , f_pEventData->m_uiEventId, m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ // check if the current state has parent state
+ if (m_pParentState) {
+ // No reaction available fot given event in the current state
+ // then forward event to parent state
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Forwarding an event %d to %s"
+ , f_pEventData->m_uiEventId, m_pParentState->m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ l_pCurrentState = m_pParentState->FrameworkunifiedOnEvent(f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+
+ } else {
+ // No parent is available then reached root state,
+ // No reaction available in the statemachine then discard the event
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Discarding an event %d ", f_pEventData->m_uiEventId);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ CHKNULL(l_pCurrentState);
+
+ // This is a recursive function that recurse in parent states till the event is
+ // consumed or discarded So Setting the current state as the active state of the
+ // returned state, as the return state is parent state
+ if (l_pCurrentState->m_pActiveState) {
+ l_pCurrentState = l_pCurrentState->m_pActiveState;
+
+ } else {
+ // do nothing in leaf state, as current state is active state
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+ return l_pCurrentState;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAddDeferredEvent
+/// When the event is posted to the state the event is deferred and stored in the state.
+/// In case of implicit recall of the deferred events, events are processed before exiting the state.
+/// The deferred events can also be recalled explicitly in the state.
+/// This also adds the event name to the map which is used for debugging.
+//////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedAddDeferredEvent(UI_32 f_uiEventId, std::string f_strEventName) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ // LCOV_EXCL_BR_START 15:marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pEventName);
+
+ CHKNULL(m_pDeferredEventList);
+ // LCOV_EXCL_BR_STOP
+ // associate the deferred eventname with event id (debugging only)
+ m_pEventName->insert(std::pair<UI_32, std::string>(f_uiEventId, f_strEventName));
+
+ // associate the reaction with deferred event id
+ m_pDeferredEventList->push_back(f_uiEventId); // LCOV_EXCL_BR_LINE 11:except branch
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Added deferred event %d %s in the state %s "
+ , f_uiEventId, (m_pEventName->find(f_uiEventId)->second).c_str(), m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to add event %d %s in state %s",
+ f_uiEventId, (m_pEventName->find(f_uiEventId)->second).c_str(), m_strStateName.c_str());
+
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPostEvent
+/// This function creates new eventdata object and add the to event queue of the state.
+/// The events are posted in the reaction which are executed in the state.
+/// The event queue is processed once the execution of the reaction is completed.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedPostEvent(UI_32 f_uiEventId) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ try {
+ CHKNULL(m_pStateMachine); // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+
+ CEventDataPtr l_pEventData(new CEventData(f_uiEventId)); // LCOV_EXCL_BR_LINE 11:except branch
+
+ l_eStatus = m_pStateMachine->FrameworkunifiedPostEvent(l_pEventData); // LCOV_EXCL_BR_LINE 11:except branch // LCOV_EXCL_BR_LINE 11:except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPostEvent
+/// This function adds the event queue of the state. The events are posted in the reaction
+/// which are executed in the state. The event queue is processed once the execution of the
+/// reaction is completed.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedPostEvent(CEventDataPtr f_pEventData) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(m_pStateMachine);
+ CHKNULL(f_pEventData);
+
+ l_eStatus = m_pStateMachine->FrameworkunifiedPostEvent(f_pEventData);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnHSMStart
+/// This function is called recursively till the leaf state is reached. This internally
+/// calls the Entry function of the current state.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedState::FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pActiveState = this;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ // Call Entry method of the current state. Entry method of state is called in the order of
+ // Hierarchy from Outer state to Inner state
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedOnEntry(f_pEventData))) {
+ // If current state has sub states then enter into active state for state entry
+ // active state is same as the default state. In this case the FrameworkunifiedOnStart is called
+ // recursively and recursion breaks when the current state is leafstate that does not have
+ // any active/default state.
+ if (m_pActiveState) {
+ l_pActiveState = m_pActiveState->FrameworkunifiedOnHSMStart(f_pEventData); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ l_pActiveState = this;
+ }
+
+ // set current state as the active state of its parent state to maintain the Hierarchy
+ if (m_pParentState) {
+ m_pParentState->m_pActiveState = this;
+ }
+ } else {
+ // If FrameworkunifiedOnEntry failed then statemachine should report the error
+ // We can throw an exception but for now as a quick fix we are setting
+ // l_pActiveState as NULL which will stop the statemachine
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error:%d in FrameworkunifiedOnEntry of state %s", eStatus,
+ l_pActiveState->m_strStateName.c_str());
+ // LCOV_EXCL_BR_STOP
+ // l_pActiveState = NULL;
+ /* Commenting it, because it was making state machine inactive. This should not be the expected behavior.
+ * Just log and take no action, if user return non-ok value.
+ * User defined error values should be handled separately */
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pActiveState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnHSMStop
+/// This function is called recursively till the required parent state is reached. This
+/// internally calls the Exit function of the current state.
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedState *CFrameworkunifiedState::FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData) {
+ CFrameworkunifiedState *l_pActiveState = this;
+ try {
+ // if active state is composite state, update the shallow and deep history state(if exists)
+ UpdateHistory(); // LCOV_EXCL_BR_LINE 11:except branch
+
+ // if current state has active state then recursively call the FrameworkunifiedOnHSMStop till current
+ // state has no active state i.e. current state is leaf state
+ if (m_pActiveState) {
+ m_pActiveState->FrameworkunifiedOnHSMStop(f_pEventData);
+ }
+
+ m_pActiveState = m_pDefaultState;
+
+ // Post deferred events to statemachine event queue
+ CHKNULL(m_pDeferredPostEventList); // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+
+ // recall deferred events till the vector is empty
+ while (!m_pDeferredPostEventList->empty()) {
+ // get the first event list object
+ CEventDataPtr l_pEventData = m_pDeferredPostEventList->front();
+
+ CHKNULL(l_pEventData);
+ CHKNULL(m_pEventName);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Recalling event %d %s in state %s"
+ , l_pEventData->m_uiEventId,
+ (m_pEventName->find(l_pEventData->m_uiEventId)->second).c_str(), m_strStateName.c_str());
+
+ m_pDeferredPostEventList->erase(m_pDeferredPostEventList->begin());
+
+ // recall the event stored in the eventinfo object
+ FrameworkunifiedPostEvent(l_pEventData);
+ }
+
+ FrameworkunifiedOnExit(f_pEventData);
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ return NULL;
+ }
+
+ return l_pActiveState;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// IsEventDeferred
+/// This checks if the given event is marked as deferred in the state.
+///////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFrameworkunifiedState::IsEventDeferred(UI_32 f_uiEventId) {
+ BOOL bStatus = FALSE;
+ try {
+ CHKNULL(m_pDeferredEventList); // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pDeferredEventList->size(); l_uiCount++) {
+ if (f_uiEventId == m_pDeferredEventList->at(l_uiCount)) {
+ bStatus = TRUE;
+ break;
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+
+ return bStatus; // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedRemoveEventFromDeferredEventList
+/// This function removes the event from the posted deferred queue list of the state.
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedRemoveEventFromDeferredEventList(UI_32 f_uiEventId) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldID;
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "+");
+
+ try {
+ CHKNULL(m_pDeferredPostEventList);
+ int32_t l_siCnt = static_cast<int32_t>(m_pDeferredPostEventList->size() - 1);
+
+ for (; l_siCnt >= 0; l_siCnt--) {
+ if (NULL != m_pDeferredPostEventList->at(l_siCnt).get()) {
+ if (f_uiEventId == m_pDeferredPostEventList->at(l_siCnt).get()->m_uiEventId) {
+ m_pDeferredPostEventList->erase(m_pDeferredPostEventList->begin() + l_siCnt);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ FRAMEWORKUNIFIEDLOG_CUT(ZONE_NS_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedRecallEvent
+/// This indicates if the state has sub states. It returns TRUE only in the CompositeState
+/// where this function is overridden
+///////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFrameworkunifiedState::FrameworkunifiedHasSubStates() {
+ return FALSE;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedPrintStates
+/// This logs the state name and events associated with the state
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedPrintStates() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ EventReactionIterator l_objEventIterator;
+ try {
+ CHKNULL(m_pEventList);
+ CHKNULL(m_pDeferredEventList);
+ CHKNULL(m_pEventName);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "%s:%s",
+ (m_pParentState->m_strStateName).c_str(), m_strStateName.c_str());
+
+ // print events
+ for (l_objEventIterator = m_pEventList->begin();
+ l_objEventIterator != m_pEventList->end(); l_objEventIterator++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "event %d %s", ((*l_objEventIterator).first),
+ (m_pEventName->find((*l_objEventIterator).first)->second).c_str());
+ }
+
+ // print deferred events
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pDeferredEventList->size(); l_uiCount++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "deferred event %d %s", m_pDeferredEventList->at(l_uiCount),
+ (m_pEventName->find(m_pDeferredEventList->at(l_uiCount))->second).c_str());
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to print in state %s", m_strStateName.c_str());
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return eStatus;
+}
+
+BOOL CFrameworkunifiedState::FrameworkunifiedHasOrthogoanlRegions() {
+ return FALSE;
+}
+
+BOOL CFrameworkunifiedState::FrameworkunifiedIsReactionAvailable(UI_32 f_uiEventId) {
+ BOOL IsReactionAvailable = FALSE;
+ CFrameworkunifiedReaction *l_pEventReaction = NULL;
+
+ try {
+ // LCOV_EXCL_BR_START 15:marco defined in frameworkunified_sm_framework_types.h
+ CHKNULL(m_pEventList);
+ CHKNULL(m_pDeferredEventList);
+ // LCOV_EXCL_BR_STOP
+ if (m_pEventList->end() != m_pEventList->find(f_uiEventId)) {
+ // Find the reaction object for given event id
+ l_pEventReaction = reinterpret_cast<CFrameworkunifiedReaction *>((m_pEventList->find(f_uiEventId))->second);
+ }
+
+ if (l_pEventReaction) {
+ IsReactionAvailable = TRUE;
+ } else {
+ if (IsEventDeferred(f_uiEventId)) {
+ IsReactionAvailable = TRUE;
+ }
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+
+ return IsReactionAvailable; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(f_pStatemachine); // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+ m_pStateMachine = f_pStatemachine;
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+HANDLE CFrameworkunifiedState:: FrameworkunifiedGetAppHandle() {
+ HANDLE l_pHApp = NULL;
+ try {
+ CHKNULL(m_pStateMachine); // LCOV_EXCL_BR_LINE 15:marco defined in frameworkunified_sm_framework_types.h
+ l_pHApp = m_pStateMachine->FrameworkunifiedGetAppHandle(); // LCOV_EXCL_BR_LINE 11:except branch
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ }
+ return l_pHApp; // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+EFrameworkunifiedStatus CFrameworkunifiedState::FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EventReactionIterator l_objEventIterator;
+ try {
+ CHKNULL(m_pEventList);
+ CHKNULL(m_pDeferredEventList);
+ CHKNULL(m_pEventName);
+
+ f_strXMLString << "<" << m_strStateName.c_str() << ">";
+
+ f_strXMLString << "<EventList>";
+ // print events
+ for (l_objEventIterator = m_pEventList->begin();
+ l_objEventIterator != m_pEventList->end(); l_objEventIterator++) {
+ std::string l_strEventName =
+ (m_pEventName->find((*l_objEventIterator).first)->second);
+
+ UI_32 l_uiEventId = (*l_objEventIterator).first;
+
+ f_strXMLString << "<Event " << "Id = " << "\"" << l_uiEventId << "\">";
+
+ f_strXMLString << "<Name>" << l_strEventName.c_str() << "</Name>";
+
+ f_strXMLString << "</Event>";
+ }
+ f_strXMLString << "</EventList>";
+
+ // print deferred events
+ f_strXMLString << "<DeferredEventList>";
+ for (UI_32 l_uiCount = 0; l_uiCount < m_pDeferredEventList->size(); l_uiCount++) {
+ UI_32 l_uiEventId = m_pDeferredEventList->at(l_uiCount);
+
+ std::string l_strEventName = (m_pEventName->find(l_uiEventId)->second);
+
+ f_strXMLString << "<Event " << "Id = " << "\"" << l_uiEventId << "\">";
+
+ f_strXMLString << "<Name>" << l_strEventName.c_str() << "</Name>";
+
+ f_strXMLString << "</Event>";
+ }
+
+ f_strXMLString << "</DeferredEventList>";
+ f_strXMLString << "</" << m_strStateName.c_str() << ">";
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Failed to print in state %s", m_strStateName.c_str());
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp
new file mode 100755
index 0000000..1162f61
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/frameworkunified_sm_transition.cpp
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NSFramework
+/// .
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the CFrameworkunifiedTransition class definitions.This class provides the interface
+/// for reacting local transition and external transition
+///
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_transition.h>
+#include <native_service/frameworkunified_sm_state.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// CFrameworkunifiedTransition
+/// Parameterized constructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedTransition::CFrameworkunifiedTransition(CFrameworkunifiedState *f_pTargetState): m_pTargetState(f_pTargetState) {
+ if (m_pTargetState) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "Transition created with Target %s ",
+ (m_pTargetState->m_strStateName).c_str());
+ // LCOV_EXCL_BR_STOP
+ }
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// ~CFrameworkunifiedTransition
+/// Class destructor
+///////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedTransition::~CFrameworkunifiedTransition() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "+");
+}
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/makefile b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/makefile
new file mode 100755
index 0000000..964a1f5
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_FrameworkCore/src/statemachine/makefile
@@ -0,0 +1,99 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+COMPONENT_NAME = NS_FrameworkCore
+
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG). \
+ $(CC_IFLAG)../../inc \
+ $(CC_IFLAG)../../inc/statemachine \
+ $(DEPENDS_INCLUDES) \
+
+
+## Sources Section
+
+SOURCES = \
+ $(wildcard *.c*)
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard ../../inc/*.h) \
+ $(wildcard ../../inc/NS_Statemachine/*.h) \
+ $(wildcard $(REPOSITORY_ROOT)NativeServices/inc/*.h) \
+
+# Make targets
+# Standard
+all: banner module_dirs local
+
+base: banner module_dirs subdirs local
+
+binary: base
+
+local: $(OBJECTS)
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+# Defines specific for each deliverable
+
+
+# Default source file build rules
+$(OBJECTS): $(HEADERS)
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+
+module_dirs: build_dirs
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Logger/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS_Logger/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Logger/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Logger/include/frameworkunified_stub.h b/video_in_hal/nsframework/framework_unified/client/NS_Logger/include/frameworkunified_stub.h
new file mode 100755
index 0000000..2263038
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Logger/include/frameworkunified_stub.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_FRAMEWORKUNIFIED_STUB_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_FRAMEWORKUNIFIED_STUB_H_
+
+/*#include <PosixBasedOS001legacy_types.h>*/ // for _UintXXt
+
+#define _NTO_TRACE_USERFIRST (0x00000000)
+
+// from types.h
+typedef char *__NTO_va_list;
+
+// from sys/platform.h
+#define __CLOCKADJUST \
+ { \
+ unsigned long tick_count; /*NOLINT (readability/nolint)*/\
+ long tick_nsec_inc; /*NOLINT (readability/nolint)*/\
+ }
+
+// from syspage.h
+struct _clockadjust __CLOCKADJUST;
+struct qtime_entry {
+ _Uint64t cycles_per_sec; /* for ClockCycle */
+ _Uint64t volatile nsec_tod_adjust;
+ _Uint64t volatile nsec;
+ unsigned long nsec_inc; // NOLINT (readability/nolint)
+ unsigned long boot_time; /* UTC seconds when machine booted */ // NOLINT (readability/nolint)
+
+ struct _clockadjust adjust;
+ unsigned long timer_rate; /* times 10^timer_scale */ // NOLINT (readability/nolint)
+ long timer_scale; // NOLINT (readability/nolint)
+ unsigned long timer_load; // NOLINT (readability/nolint)
+ long intr; // NOLINT (readability/nolint)
+ unsigned long epoch; // NOLINT (readability/nolint)
+ unsigned long flags; // NOLINT (readability/nolint)
+ unsigned int rr_interval_mul;
+ unsigned long spare0; // NOLINT (readability/nolint)
+ _Uint64t volatile nsec_stable;
+ unsigned long spare[4]; // NOLINT (readability/nolint)
+};
+
+struct syspage_entry *_syspage_ptr;
+
+typedef struct {
+ _Uint16t entry_off;
+ _Uint16t entry_size;
+} syspage_entry_info;
+
+struct syspage_entry {
+ _Uint16t size; /* size of syspage_entry */
+ _Uint16t total_size; /* size of system page */
+ _Uint16t type;
+ _Uint16t num_cpu;
+ syspage_entry_info system_private;
+ syspage_entry_info asinfo;
+ syspage_entry_info meminfo;
+ syspage_entry_info hwinfo;
+ syspage_entry_info cpuinfo;
+ syspage_entry_info cacheattr;
+ syspage_entry_info qtime;
+ syspage_entry_info callout;
+ syspage_entry_info callin;
+ syspage_entry_info typed_strings;
+ syspage_entry_info strings;
+ syspage_entry_info intrinfo;
+ syspage_entry_info smp;
+ syspage_entry_info pminfo;
+ syspage_entry_info mdriver;
+ long spare[2]; // NOLINT (readability/nolint)
+ union {
+#if defined(SYSPAGE_TARGET_ALL) || defined(SYSPAGE_TARGET_X86)
+ struct x86_syspage_entry x86;
+#endif
+#if defined(SYSPAGE_TARGET_ALL) || defined(SYSPAGE_TARGET_PPC)
+ struct ppc_syspage_entry ppc;
+#endif
+#if defined(SYSPAGE_TARGET_ALL) || defined(SYSPAGE_TARGET_MIPS)
+ struct mips_syspage_entry mips;
+#endif
+#if defined(SYSPAGE_TARGET_ALL) || defined(SYSPAGE_TARGET_ARM)
+ struct arm_syspage_entry arm;
+#endif
+#if defined(SYSPAGE_TARGET_ALL) || defined(SYSPAGE_TARGET_SH)
+ struct sh_syspage_entry sh;
+#endif
+ struct {
+ long filler[20]; // NOLINT (readability/nolint)
+ } filler;
+ } un;
+};
+
+#define _SYSPAGE_ENTRY( __base, __field ) /*NOLINT (readability/nolint)*/\
+ ((struct __field##_entry *)reinterpret_cast<void *>(reinterpret_cast<char *>(__base)\
+ + (__base)->__field.entry_off))
+#define SYSPAGE_ENTRY(__field) _SYSPAGE_ENTRY(_syspage_ptr, __field)
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_FRAMEWORKUNIFIED_STUB_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Logger/include/ns_logger_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_Logger/include/ns_logger_internal.h
new file mode 100755
index 0000000..97bde91
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Logger/include/ns_logger_internal.h
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief API Header for Zone Player Service APIs to be used by senders and
+/// receivers.
+///
+/// Declares the external APIs to Zone Player Service.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_NS_LOGGER_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_NS_LOGGER_INTERNAL_H_
+
+// PASA Headers
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _GetTimeString(PSTR format, UI_16 length);
+void _BuildFormatString(HANDLE hMsgQ, const UI_16 f_uiZoneIndex, PCSTR process_name, PCSTR p_pstrClassName_i,
+ const UI_32 p_lLine_i, PCSTR lpszFormat, PSTR format, UI_16 length);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_LOGGER_INCLUDE_NS_LOGGER_INTERNAL_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Logger/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS_Logger/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..25318be
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Logger/src/makefile_PosixBasedOS001
@@ -0,0 +1,223 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_Logger
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_Logger
+
+#All possible logging options
+#NS_LOG_FORMAT = NS_LCLOCKCYCLES_IN_TIMESTRING
+#NS_LOG_FORMAT = NS_LCLOCKCYCLES_IN_MS
+#NS_LOG_FORMAT = NS_LCURDATETIME
+
+ifndef NS_LOG_FORMAT
+NS_LOG_FORMAT = NS_LCURDATETIME
+endif
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS += -D $(NS_LOG_FORMAT)
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_MessageQueue/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NS_MessageQueue/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NS_Logger/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+# NS_MessageCenter library is added as dependency for logger.
+# This is a temporary solution to support event logger (required by VehicleServices).
+# Fix the problem in proper way so that it should not depend on NS_MessageCenter after PastModel002 delivery.
+ifdef DYNAMIC
+ DYNAMIC_LIBS += \
+ NS_MessageQueue$(DEBUG_EXT) \
+ NS_MessageCenter$(DEBUG_EXT)
+else
+ STATIC_LIBS +=
+endif
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Logger/src/ns_logger.cpp b/video_in_hal/nsframework/framework_unified/client/NS_Logger/src/ns_logger.cpp
new file mode 100755
index 0000000..94f775c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Logger/src/ns_logger.cpp
@@ -0,0 +1,2260 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief
+///
+/// Frameworkunified Framework Handlers Logging to log services.
+///////////////////////////////////////////////////////////////////////////////
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/timeb.h>
+#include <time.h>
+#include <sys/syscall.h>
+#include <sys/prctl.h>
+#include <syslog.h>
+#include <boost/algorithm/string.hpp>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <aglpath.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <arpa/inet.h>
+
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/ns_ringbuffer.h>
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_eventlogger.h>
+#include <native_service/cl_lockid.h>
+
+#ifdef AGL_STUB
+#include <other_service/strlcat.h>
+#include <other_service/strlcpy.h>
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include "frameworkunified_stub.h"
+#else
+#include <sys/neutrino.h>
+#include <sys/trace.h> // trace_nlogf
+#include <sys/slog.h>
+#include <sys/slogcodes.h>
+#include <sys/syspage.h>
+#endif
+
+#include <map>
+#include <vector>
+#include <sstream>
+#include <utility>
+#include <string>
+
+#include "ns_logger_internal.h"
+#include "ns_msg_queue.h"
+#include "mqueue.h"
+
+static HANDLE g_hSSEventLogQ = INVALID_HANDLE;
+#ifndef AGL_STUB
+static HANDLE g_hNSplogMsgQ = INVALID_HANDLE;
+#endif
+static HANDLE g_hNSSysEventLogQ = INVALID_HANDLE;
+static __thread CHAR tls_strProcessName[MAX_NAME_SIZE_APP];
+static __thread pid_t tid = 0;
+static UI_32 g_msgcounter = 0;
+static FRAMEWORKUNIFIEDLOGPARAM g_LocalFrameworkunifiedLogParams;
+static UI_32 syslogopened;
+static int shm_fd = -1;
+static const unsigned int default_log_cfgtbl[] = {
+ // realTimeLog
+ FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF,
+ // flagIdNum
+ 1,
+ // logLevel
+ FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE,
+};
+static void *shm_pmap = reinterpret_cast<void *>(const_cast<unsigned int*>(default_log_cfgtbl));
+#define EXE_STR_LEN 64
+static char exe_link_path[EXE_STR_LEN] = {0};
+
+/// For PLog
+#define PLOG_GAP_FILE "/dev/shmem/Plog.gap"
+#define MAX_GAP_BUFFER_LEN 80
+#define MAX_PLOG_STRING_SIZE 1024
+#define MAX_TIME_FORMATSTR_LEN 3
+#define RETRY_COUNT 5
+FRAMEWORKUNIFIEDLOGPPARAM g_FrameworkunifiedLogPParams = {FALSE, EPLOG_TIME_FORMAT_USEC, 0, EPLOG_MSGQ}; // default values for PLog
+FRAMEWORKUNIFIEDLOGSYSEVENTPARAM g_FrameworkunifiedLogSysEventParams = {FALSE}; // default values for System event log
+
+#define ZONEMASK_MAX BITS_IN_TZONE // ((UI_32)(BITS_IN_TZONE * TZONE_COUNT))
+
+#define FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID (0)
+#define FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__FN "/usr/agl/conf/BS/ns/framework_unified/rodata/ns_logger_frameworkunifiedlog__CWORD84_.cfg"
+#define FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__TMP "ns_logger_frameworkunifiedlog__CWORD84_.tmp"
+#define FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV "ns_logger_frameworkunifiedlog__CWORD84_.cfg"
+
+#define FRAMEWORKUNIFIEDLOG_CONFIG_NV "/nv/BS/ns/framework_unified/rwdata/"
+
+#define FRAMEWORKUNIFIEDLOG_CONFIG_TMP_NV "ns_logger_frameworkunifiedlog_tmp.cfg"
+#ifndef TN_LOGGERRTIME
+#define TN_LOGGERRTIME "LoggerRtime"
+#define PR_LOGGERRTIME_S PR_TSS_S
+#define PR_LOGGERRTIME PR_TSS
+#endif // TN_LOGGERRTIME
+#define USB_REALTIME_MSGMAX 256
+#define USB_REALTIME_SIZMAX 4096
+#define USB_REALTIME_QNAME "/PlRtLogger"
+#define USB_REALTIME_RTRYMAX 10
+static mqd_t g_qid = (mqd_t)(-1);
+
+unsigned int g_FlagIdNum;
+std::vector<std::string> g_flag_name;
+
+typedef struct {
+ CNSRingBuffer *ring_buffer;
+ std::string file_name;
+ UI_32 size;
+ BOOL force_output;
+
+ BOOL real_time_log;
+} FrameworkunifiedLogMapTbl;
+
+typedef struct {
+ TFrameworkunifiedZone zone;
+ FrameworkunifiedLogMapTbl info;
+} FrameworkunifiedLogTbl;
+
+typedef std::map<TFrameworkunifiedZone, FrameworkunifiedLogMapTbl> TFrameworkunifiedLogMap;
+static TFrameworkunifiedLogMap g_FrameworkunifiedLogMap;
+static TFrameworkunifiedLogMap g_FrameworkunifiedLogFlagMap;
+static UI_32 g_FrameworkunifiedLogFlagId = FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID;
+
+static bool g_FrameworkunifiedLogFlagRealTimeLog = TRUE;
+pthread_mutex_t FrameworkunifiedLogMtx = PTHREAD_MUTEX_INITIALIZER;
+
+#ifdef ENABLE_DEBUG_SYSLOG // for FRAMEWORKUNIFIED_SET_ZONES() error
+#define DEB_SYSLOG(fmt, ...) {openlog(0, LOG_PID, LOG_USER); \
+ syslog(LOG_ERR, "[FRAMEWORKUNIFIEDLOG][ERR]EXE_LINK_PATH(%s)[%s:L%d] " fmt, exe_link_path, \
+ __FUNCTION__, __LINE__, ## __VA_ARGS__); \
+ closelog();}
+#else
+#define DEB_SYSLOG(fmt, ...)
+#endif
+
+static UI_32
+GetFrameworkunifiedLogRealtimeUartOutput(CNSConfigReader *cfg_reader) {
+ if (cfg_reader == NULL) {
+ return -1;
+ }
+
+ std::string output_str = cfg_reader->GetString("REALTIME_LOG.Output"); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (output_str.compare("UART") == 0) {
+ return FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART;
+ } else if (output_str.compare("USB") == 0) {
+ return FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB;
+ } else {
+ return FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ }
+}
+
+static EFrameworkunifiedStatus
+GetFrameworkunifiedLogZoneFileInfo(CNSConfigReader *cfg_reader, std::string &name, // NOLINT (readability/nolint)
+ FrameworkunifiedLogMapTbl &tbl, UI_32 &zone) { // NOLINT (readability/nolint)
+ std::string zone_key = name;
+ zone_key.append(".Zone");
+ std::string zone_filename_key = name; // LCOV_EXCL_BR_LINE 11:expect branch
+ zone_filename_key.append(".FileName");
+ std::string zone_filesize_key = name; // LCOV_EXCL_BR_LINE 11:expect branch
+ zone_filesize_key.append(".FileSizeMax");
+ std::string zone_force_output_key = name; // LCOV_EXCL_BR_LINE 11:expect branch
+ zone_force_output_key.append(".ForceOutput");
+
+ if (cfg_reader == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ tbl.ring_buffer = NULL;
+ tbl.file_name = cfg_reader->GetString(zone_filename_key);
+ tbl.size = static_cast<UI_32>(cfg_reader->GetInt(zone_filesize_key));
+ tbl.force_output
+ = (cfg_reader->GetString(zone_force_output_key) == "True") ? TRUE : FALSE;
+
+ tbl.real_time_log = TRUE;
+ zone = ZONEMASK(static_cast<UI_32>(cfg_reader->GetInt(zone_key)));
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus
+GetFrameworkunifiedLogFlagFileInfo(CNSConfigReader *cfg_reader, std::string &name, // NOLINT (readability/nolint)
+ FrameworkunifiedLogMapTbl &tbl, UI_32 &loglevel) { // NOLINT (readability/nolint)
+ std::string flag_loglevel_key = name;
+ flag_loglevel_key.append(".LogLevel");
+ std::string flag_filename_key = name; // LCOV_EXCL_BR_LINE 11:expect branch
+ flag_filename_key.append(".FileName");
+ std::string flag_filesize_key = name; // LCOV_EXCL_BR_LINE 11:expect branch
+ flag_filesize_key.append(".FileSizeMax");
+
+ std::string flag_real_time_log_key = name;
+ flag_real_time_log_key.append(".Realtimelog");
+
+ if (cfg_reader == NULL) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ tbl.ring_buffer = NULL;
+ tbl.file_name = cfg_reader->GetString(flag_filename_key); // LCOV_EXCL_BR_LINE 11:expect branch
+ tbl.size = static_cast<UI_32>(cfg_reader->GetInt(flag_filesize_key)); // LCOV_EXCL_BR_LINE 11:expect branch
+ tbl.force_output = FALSE;
+
+ tbl.real_time_log
+ = (cfg_reader->GetString(flag_real_time_log_key) == "False") ? FALSE : TRUE;
+
+
+ std::string loglevel_str = cfg_reader->GetString(flag_loglevel_key); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (loglevel_str.compare("Debug") == 0) {
+ loglevel = FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG;
+ } else {
+ loglevel = FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE;
+ }
+
+ if ((tbl.file_name.empty()) || (tbl.size == 0)) {
+ return eFrameworkunifiedStatusFail;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+static VOID
+GetFrameworkunifiedLogList(CNSConfigReader *cfg_reader, std::vector<std::string> &list, // NOLINT (readability/nolint)
+ std::string req_list) {
+ if (cfg_reader == NULL) {
+ return;
+ }
+
+ std::string list_str = cfg_reader->GetString(req_list);
+ if (!list_str.empty()) {
+ try {
+ boost::algorithm::split(list, list_str, boost::is_any_of(", "));
+ }
+ /*
+ * @todo
+ * Even if throw is executed by the process called by 'try', it cannot be captured by catch().
+ */
+ catch (...) {
+ fprintf(stderr, "occured exception handling by boost::algorithm::split in ns_logger\n");
+ }
+ }
+}
+
+static BOOL
+CheckMatchFrameworkunifiedLogFlagMap(TFrameworkunifiedLogMap &map, FrameworkunifiedLogMapTbl &check_tbl, // NOLINT (readability/nolint)
+ FrameworkunifiedLogMapTbl &out_tbl) { // NOLINT (readability/nolint)
+ TFrameworkunifiedLogMap::iterator itr;
+ for (itr = map.begin(); itr != map.end(); itr++) {
+ if (itr->second.file_name.compare(check_tbl.file_name) == 0) {
+ out_tbl = itr->second;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static BOOL
+IsDefinedFrameworkunifiedLogFlag(CNSConfigReader *cfg_reader, std::string &flag_name, // NOLINT (readability/nolint)
+ std::string &exe_name) { // NOLINT (readability/nolint)
+ UI_32 cnt = 1;
+ size_t pos1;
+
+ if (cfg_reader == NULL) {
+ return FALSE;
+ }
+
+ while (1) {
+ std::string service_key = flag_name;
+ std::ostringstream service_num; // LCOV_EXCL_BR_LINE 11:expect branch
+ service_num << ".Service" << cnt;
+ service_key.append(service_num.str());
+ std::string service_name = cfg_reader->GetString(service_key);
+ if (service_name.empty()) {
+ break;
+ }
+ pos1 = exe_name.find(service_name);
+ if ((pos1 != std::string::npos)
+ && (exe_name.length() - pos1) == service_name.length()) {
+ return TRUE;
+ }
+ cnt++;
+ }
+ return FALSE;
+}
+
+static VOID
+CreateFrameworkunifiedLogFileTbl(CNSConfigReader *cfg_reader, std::string &exe_str, // NOLINT (readability/nolint)
+ int *realTimeLog, int **logLevelArray) {
+ int *logLevel;
+
+ std::vector<std::string> zone_vector;
+ GetFrameworkunifiedLogList(cfg_reader, zone_vector, "ZONE_LIST.List");
+ for (UI_32 i = 0; i < zone_vector.size(); i++) {
+ FrameworkunifiedLogMapTbl zone_tbl;
+ UI_32 zone;
+ if (GetFrameworkunifiedLogZoneFileInfo(cfg_reader, zone_vector.at(i), zone_tbl, zone)
+ == eFrameworkunifiedStatusOK) {
+ g_FrameworkunifiedLogMap.insert(std::make_pair(zone, zone_tbl));
+ }
+ }
+
+ *realTimeLog = static_cast<int>(GetFrameworkunifiedLogRealtimeUartOutput(cfg_reader));
+
+ FrameworkunifiedLogMapTbl default_tbl;
+ UI_32 default_id = FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID;
+ std::string default_flag = "FLAG_DEFAULT"; // LCOV_EXCL_BR_LINE 11:expect branch
+ UI_32 default_loglevel;
+ if (GetFrameworkunifiedLogFlagFileInfo(cfg_reader, default_flag, default_tbl, default_loglevel)
+ != eFrameworkunifiedStatusOK) {
+ fprintf(stderr, "<WARNING>FRAMEWORKUNIFIEDLOG[%s:L%d]FLAG_DEFAULT is not definition into ns_logger_frameworkunifiedlog.cfg.\n",
+ __FUNCTION__, __LINE__);
+
+ DEB_SYSLOG("<WARNING>FLAG_DEFAULT is not definition into ns_logger_frameworkunifiedlog.cfg.)");
+ default_tbl.ring_buffer = NULL;
+ default_tbl.file_name = "frameworkunified_debug.log";
+ default_tbl.size = 100; // 100bytes
+
+ default_tbl.real_time_log = TRUE;
+ }
+ std::vector<std::string> flag_vector;
+ UI_32 flag_id = FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID + 1;
+ GetFrameworkunifiedLogList(cfg_reader, flag_vector, "FLAG_LIST.List"); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (g_FlagIdNum != (flag_vector.size() + 1)) {
+ if (!g_FrameworkunifiedLogFlagMap.empty()) {
+ TFrameworkunifiedLogMap::iterator delitr;
+ unsigned int delflag_id;
+ for (delflag_id = 0; delflag_id < g_FlagIdNum; delflag_id++) {
+ delitr = g_FrameworkunifiedLogFlagMap.find(delflag_id);
+ if (delitr->second.ring_buffer != NULL) {
+ delete delitr->second.ring_buffer;
+ delitr->second.ring_buffer = NULL;
+ }
+ }
+ g_FrameworkunifiedLogFlagMap.clear();
+ if (!g_flag_name.empty()) {
+ g_flag_name.clear();
+ }
+ }
+ g_FlagIdNum = static_cast<unsigned int>(flag_vector.size() + 1); // +1: [Add Default Flag]
+ g_flag_name.push_back(default_flag); // LCOV_EXCL_BR_LINE 11:expect branch
+ g_FrameworkunifiedLogFlagMap.insert(std::make_pair(default_id, default_tbl)); // LCOV_EXCL_BR_LINE 11:expect branch
+ }
+ logLevel = reinterpret_cast<int *>(malloc(sizeof(int) * g_FlagIdNum));
+ logLevel[0] = default_loglevel;
+
+ for (UI_32 i = 0; i < flag_vector.size(); i++) {
+ FrameworkunifiedLogMapTbl flag_tbl;
+ UI_32 loglevel;
+ if (GetFrameworkunifiedLogFlagFileInfo(cfg_reader, flag_vector.at(i), flag_tbl, loglevel)
+ == eFrameworkunifiedStatusOK) {
+ FrameworkunifiedLogMapTbl check_result_tbl;
+ if (CheckMatchFrameworkunifiedLogFlagMap(g_FrameworkunifiedLogFlagMap, flag_tbl, check_result_tbl)
+ == TRUE) {
+ flag_tbl.file_name = check_result_tbl.file_name;
+ flag_tbl.size = check_result_tbl.size;
+ }
+ if (g_FrameworkunifiedLogFlagMap.find(flag_id) == g_FrameworkunifiedLogFlagMap.end()) {
+ if (IsDefinedFrameworkunifiedLogFlag(cfg_reader, flag_vector.at(i), exe_str)
+ == TRUE) {
+ g_FrameworkunifiedLogFlagId = flag_id;
+
+ g_FrameworkunifiedLogFlagRealTimeLog = flag_tbl.real_time_log;
+ }
+ g_flag_name.push_back(flag_vector.at(i));
+ g_FrameworkunifiedLogFlagMap.insert(std::make_pair(flag_id, flag_tbl));
+ }
+ }
+ logLevel[flag_id] = loglevel;
+ flag_id++;
+ }
+ *logLevelArray = logLevel;
+}
+
+static VOID
+GetFrameworkunifiedLogRingBuffer(const UI_16 zone, CNSRingBuffer **ring_buf) {
+ TFrameworkunifiedLogMap::iterator itr = g_FrameworkunifiedLogMap.find(zone);
+
+ if (ring_buf == NULL) {
+ return;
+ }
+
+ if (itr == g_FrameworkunifiedLogMap.end()) {
+ itr = g_FrameworkunifiedLogFlagMap.find(g_FrameworkunifiedLogFlagId);
+ if (itr == g_FrameworkunifiedLogFlagMap.end()) {
+ // ASSERT
+ *ring_buf = NULL;
+ return;
+ }
+ }
+
+ pthread_mutex_lock(&FrameworkunifiedLogMtx);
+
+ if (itr->second.ring_buffer == NULL) {
+ std::string file_path;
+ int index;
+
+ file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ file_path.append("/"); // LCOV_EXCL_BR_LINE 11:expect branch
+ file_path.append(itr->second.file_name);
+
+ index = NSLogGetFrameworkunifiedlogIndex(file_path.c_str());
+ itr->second.ring_buffer = new(std::nothrow) CNSRingBuffer(file_path, itr->second.size,
+ index + LOCK_NSLOG_ACCES_IF_1); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (itr->second.ring_buffer != NULL) {
+ itr->second.ring_buffer->Open();
+ }
+ }
+ pthread_mutex_unlock(&FrameworkunifiedLogMtx);
+
+ *ring_buf = itr->second.ring_buffer;
+}
+
+static int
+MapShmInfo(int flagId) {
+ int size;
+ void *pmap;
+
+ if (shm_fd != -1) {
+ return -1;
+ }
+ shm_fd = shm_open(FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, O_RDONLY, S_IRWXU | S_IRWXO);
+ if (shm_fd == -1) {
+
+ DEB_SYSLOG("shm_open error errno:%d", errno);
+ return -1;
+ }
+ size = static_cast<int>(sizeof(int) * 2); // realTimeLog + flagIdNum
+ size += static_cast<int>(sizeof(int) * (flagId + 1)); // g_FrameworkunifiedLogFlagId + DefaultFlagId
+
+ pmap = reinterpret_cast<int *>(mmap(NULL, size, PROT_READ, MAP_SHARED, shm_fd, 0));
+ if (pmap == MAP_FAILED) {
+
+ DEB_SYSLOG("mmap error errno:%d", errno);
+ close(shm_fd);
+ shm_fd = -1;
+ return -1;
+ }
+ shm_pmap = pmap;
+
+ return 0;
+}
+
+static inline void
+GetShmInfo(int flagId, int *realTimeLog, int *logLevel) {
+ volatile ssize_t *p;
+
+ if ((realTimeLog == NULL) || (logLevel == NULL)) {
+ return;
+ }
+
+ p = static_cast<ssize_t *>(shm_pmap);
+ *realTimeLog = static_cast<int>(p[0]);
+ p += 2;
+ *logLevel = static_cast<int>(p[flagId]);
+}
+
+static BOOL
+IsExistFrameworkunifiedLogCfgShmem(void) {
+ if (shm_pmap == reinterpret_cast<void *>(const_cast<unsigned int*>(default_log_cfgtbl))) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static BOOL
+NsLogIsZonePrintEnable(const UI_16 zone, UI_8 *mode) {
+ int l_realTimeLog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ int l_loglevel = FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE;
+
+ if (mode == NULL) {
+ return FALSE;
+ }
+
+ GetShmInfo(g_FrameworkunifiedLogFlagId, &l_realTimeLog, &l_loglevel);
+ *mode = static_cast<UI_8>(l_realTimeLog);
+ if (l_realTimeLog == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF) {
+ return FALSE;
+ }
+
+ if ((ZONEMASK(96) <= (TFrameworkunifiedZone)zone)
+ && ((TFrameworkunifiedZone)zone <= ZONEMASK(127))) {
+ return FALSE;
+ }
+
+
+ if (g_FrameworkunifiedLogFlagRealTimeLog == FALSE) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static int
+copyFrameworkunifiedLogCfgFile(const char *l_cSrcPath, const char *l_cDestPath) {
+ int fd_in = -1;
+ int fd_ot = -1;
+ char l_buf[8*1024];
+ ssize_t l_nrd, l_nwr;
+
+ fd_in = open(l_cSrcPath, O_RDONLY | O_CLOEXEC);
+ if (fd_in == -1) {
+ return -1;
+ }
+
+ fd_ot = open(l_cDestPath, O_WRONLY | O_CREAT | O_CLOEXEC, 0640);
+ if (fd_ot == -1) {
+ close(fd_in);
+ return -1;
+ }
+
+ while (1) {
+ l_nrd = read(fd_in, l_buf, sizeof(l_buf));
+ if (l_nrd == 0) {
+ break;
+ }
+ if (l_nrd < 0) {
+ close(fd_in);
+ close(fd_ot);
+ return -1;
+ }
+
+ l_nwr = write(fd_ot, l_buf, l_nrd);
+ if (l_nwr < 0) {
+ close(fd_in);
+ close(fd_ot);
+ return -1;
+ }
+ }
+
+ if (fsync(fd_ot) != 0) {
+ close(fd_in);
+ close(fd_ot);
+ return -1;
+ }
+
+ close(fd_in);
+ close(fd_ot);
+
+ return 0;
+}
+
+
+static VOID
+copyFrameworkunifiedLogCfgFileToNv(void) {
+ int fd_in = -1;
+ int fd_ot = -1;
+ int fd_dr = -1;
+ char c[1];
+ ssize_t len;
+
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov constraints (others)
+ std::string config_dirpath = FRAMEWORKUNIFIEDLOG_CONFIG_NV;
+ std::string config_tempname = FRAMEWORKUNIFIEDLOG_CONFIG_NV;
+ std::string config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV;
+ fd_in = open(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__FN, O_RDONLY);
+ config_tempname.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__TMP);
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV);
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov constraints (others)
+
+ if (fd_in == -1) {
+ return;
+ }
+
+ unlink(config_tempname.c_str());
+
+ fd_ot = open(config_tempname.c_str(), O_WRONLY | O_CREAT, 0640); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (fd_ot == -1) {
+ DEB_SYSLOG("open error errno:%d", errno);
+ close(fd_in); // LCOV_EXCL_BR_LINE 11:expect branch
+ return;
+ }
+
+ while (1) {
+ len = read(fd_in, c, sizeof(c));
+ if (len == 0) {
+ break;
+ }
+ if (len < 0) {
+ close(fd_in);
+ close(fd_ot);
+ return;
+ }
+ len = write(fd_ot, c, sizeof(c));
+ if (len < 0) {
+ close(fd_in);
+ close(fd_ot);
+ return;
+ }
+ }
+
+ if (fsync(fd_ot) != 0) {
+ close(fd_in);
+ close(fd_ot);
+ return;
+ }
+
+ close(fd_in);
+ close(fd_ot);
+
+ if (rename(config_tempname.c_str(), config_filename.c_str()) != 0) {
+
+ DEB_SYSLOG("rename error errno:%d", errno);
+ return;
+ }
+
+ fd_dr = open(config_dirpath.c_str(), O_RDONLY);
+ if (fd_dr == -1) {
+
+ DEB_SYSLOG("mmap error errno:%d", errno);
+ return;
+ }
+
+ fsync(fd_dr);
+
+ close(fd_dr);
+}
+
+#define WTYPE_NORMAL 0
+#define WTYPE_RTIMELOG 1
+static int
+WriteSharedMem(int flag, int realTimeLog, unsigned int flagIdNum, int *logLevelArray) {
+ int fd;
+ ssize_t *pp;
+ volatile ssize_t *p;
+ int size;
+
+ if ((flag == WTYPE_NORMAL)
+ && (logLevelArray == NULL)) {
+ return -1;
+ }
+
+ size = static_cast<int>(sizeof(int) * 2); // realTimeLog + flagIdNum
+ size += static_cast<int>(sizeof(int) * flagIdNum);
+
+ fd = shm_open(FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, O_RDWR | O_CREAT, S_IRWXU | S_IRWXO);
+ if (fd == -1) {
+
+ DEB_SYSLOG("shm_open error errno:%d", errno);
+ return -1;
+ }
+
+ if (ftruncate(fd, size) == -1) {
+
+ DEB_SYSLOG("ftruncate error errno:%d", errno);
+ close(fd);
+ return -1;
+ }
+
+// pp = (int *)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ pp = static_cast<ssize_t *>(mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
+ if (pp == MAP_FAILED) {
+
+ DEB_SYSLOG("mmap error errno:%d", errno);
+ close(fd);
+ return -1;
+ }
+
+ p = pp;
+ p[0] = realTimeLog;
+
+ if (flag == WTYPE_NORMAL) {
+ // flagIdNum
+ p[1] = flagIdNum;
+
+ // log level
+ p += 2;
+ for (unsigned int i = 0; i < flagIdNum; i++) {
+ *p = logLevelArray[i];
+ p++;
+ }
+ }
+ close(fd);
+ munmap(pp, size);
+
+ return 0;
+}
+
+static int
+WriteSharedMemForFlagId(int realTimeLog, unsigned int flagIdNum, int flagId,
+ int logLevel) {
+ int fd;
+ volatile ssize_t *p;
+ ssize_t *pp;
+ int size;
+
+ size = static_cast<int>(sizeof(int) * 2); // realTimeLog + flagIdNum
+ size += static_cast<int>(sizeof(int) * flagIdNum);
+
+ fd = shm_open(FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, O_RDWR | O_CREAT, S_IRWXU | S_IRWXO);
+ if (fd == -1) {
+
+ DEB_SYSLOG("shm_open error errno:%d", errno);
+ return -1;
+ }
+
+ if (ftruncate(fd, size) == -1) {
+
+ DEB_SYSLOG("ftruncate error errno:%d", errno);
+ close(fd);
+ return -1;
+ }
+
+ pp = static_cast<ssize_t *>(mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
+ if (pp == MAP_FAILED) {
+
+ DEB_SYSLOG("mmap error errno:%d", errno);
+ close(fd);
+ return -1;
+ }
+
+ p = pp;
+ p[0] = realTimeLog;
+
+ // flagIdNum
+ p[1] = flagIdNum;
+
+ // log level
+ p += 2;
+ p[flagId] = logLevel;
+
+ close(fd);
+ munmap(pp, size);
+
+ return 0;
+}
+
+static BOOL
+IsExistFrameworkunifiedLogCfgNv(void) {
+ FILE *fp;
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov constraints (others)
+ std::string config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV;
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV);
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov constraints (others)
+
+ fp = fopen(config_filename.c_str(), "re");
+ if (fp == NULL) {
+ return FALSE;
+ }
+
+ fclose(fp);
+ return TRUE;
+}
+
+static int
+get_readlink_path(char *path) {
+ CHAR exe_path[EXE_STR_LEN];
+ CHAR buf[EXE_STR_LEN];
+ ssize_t len;
+
+ if (path == NULL) {
+ return -1;
+ }
+
+ path[0] = 0;
+ if (exe_link_path[0] == 0) {
+ pid_t pid = static_cast<pid_t>(syscall(__NR_getpid));
+ sprintf(exe_path, "/proc/%d/exe", pid); // NOLINT (readability/nolint)
+ memset(buf, 0, sizeof(buf));
+ len = readlink(exe_path, buf, (sizeof(buf) - 1));
+ if (len != -1) { // LCOV_EXCL_BR_LINE 200: exe_path can not non-existent
+ strcpy(exe_link_path, buf); // NOLINT (readability/nolint)
+ } else {
+ // LCOV_EXCL_START 200
+ AGL_ASSERT_NOT_TESTED();
+ fprintf(stderr, "<WARNING>FRAMEWORKUNIFIEDLOG[%s:L%d]Can't get readlink path(%s). errno(%d)\n", __FUNCTION__, __LINE__,
+ exe_path, errno);
+ DEB_SYSLOG("<WARNING>Can't get readlink path(%s)(errno:%d)", exe_path, errno);
+ return 0;
+ // LCOV_EXCL_STOP 200
+ }
+ }
+ strcpy(path, exe_link_path); // NOLINT (readability/nolint)
+ return 1; // OK
+}
+
+static void
+readConfig(int *realTimeLog, int **logLevelArray) {
+ CHAR buf[EXE_STR_LEN];
+
+ if (get_readlink_path(buf)) { // LCOV_EXCL_BR_LINE 200:get_readlink_path can not return false
+ std::string config_filename;
+ std::string exe_str = buf; // LCOV_EXCL_BR_LINE 11:expect branch
+
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov constraints (others)
+ if (IsExistFrameworkunifiedLogCfgNv()) {
+ config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV;
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV);
+ } else {
+ config_filename = FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__FN;
+ }
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov constraints (others)
+ CNSConfigReader *config_reader = new CNSConfigReader(); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (config_reader != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ if (config_reader->Parse(config_filename)
+ == eFrameworkunifiedStatusOK) {
+ CreateFrameworkunifiedLogFileTbl(config_reader, exe_str, realTimeLog, logLevelArray); // LCOV_EXCL_BR_LINE 11:expect branch
+ MapShmInfo(g_FrameworkunifiedLogFlagId); // LCOV_EXCL_BR_LINE 11:expect branch
+ } else {
+ DEB_SYSLOG("Parseg error %s", config_filename.c_str());
+ }
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEB_SYSLOG("new CNSConfigReader error");
+ // LCOV_EXCL_STOP 5
+ }
+ delete config_reader; // LCOV_EXCL_BR_LINE 11:expect branch1
+ } else {
+ // LCOV_EXCL_START 5: get_readlink_path can not return false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEB_SYSLOG("get_readlink_path error");
+ // LCOV_EXCL_STOP 5
+ }
+}
+
+//////////////////////////////////////////
+// NSLogGetFrameworkunifiedlogFileTotalNum
+//////////////////////////////////////////
+UI_32
+NSLogGetFrameworkunifiedlogFileTotalNum(void) {
+ return static_cast<UI_32>((g_FrameworkunifiedLogMap.size() + g_FrameworkunifiedLogFlagMap.size()));
+}
+
+//////////////////////////////////////////
+// NSLogGetFrameworkunifiedlogFileName
+//////////////////////////////////////////
+PCSTR
+NSLogGetFrameworkunifiedlogFileName(UI_32 index) {
+ PCSTR name = NULL;
+
+ if ((g_FrameworkunifiedLogMap.size() + g_FrameworkunifiedLogFlagMap.size()) <= index) {
+ return NULL;
+ }
+
+ TFrameworkunifiedLogMap::iterator itr;
+ TFrameworkunifiedLogMap::iterator itr_end;
+ UI_32 cnt;
+
+ if (index < g_FrameworkunifiedLogMap.size()) {
+ cnt = 0;
+ itr = g_FrameworkunifiedLogMap.begin();
+ itr_end = g_FrameworkunifiedLogMap.end();
+ } else {
+ cnt = static_cast<UI_32>(g_FrameworkunifiedLogMap.size());
+ itr = g_FrameworkunifiedLogFlagMap.begin();
+ itr_end = g_FrameworkunifiedLogFlagMap.end();
+ }
+
+ for (; itr != itr_end; itr++, cnt++) {
+ if (cnt == index) {
+ name = itr->second.file_name.c_str();
+ break;
+ }
+ }
+ return name;
+}
+
+//////////////////////////////////////////
+// NSLogGetFrameworkunifiedlogIndex
+//////////////////////////////////////////
+int
+NSLogGetFrameworkunifiedlogIndex(PCSTR filename) {
+ TFrameworkunifiedLogMap::iterator itr;
+ TFrameworkunifiedLogMap::iterator itr_end;
+ UI_32 i = 0;
+ /**
+ * @todo
+ * Defining a NULL for arguments results in exceptions.
+ */
+ std::string fname = filename;
+
+ itr = g_FrameworkunifiedLogFlagMap.begin();
+ itr_end = g_FrameworkunifiedLogFlagMap.end();
+ for (; itr != itr_end; itr++, i++) {
+ if (fname.find(itr->second.file_name) != std::string::npos) {
+ return i;
+ }
+ }
+
+ itr = g_FrameworkunifiedLogMap.begin();
+ itr_end = g_FrameworkunifiedLogMap.end();
+ for (; itr != itr_end; itr++, i++) {
+ if (fname.find(itr->second.file_name) != std::string::npos) {
+ return i;
+ }
+ }
+ return 0;
+}
+
+UI_32
+ConvertEndian(UI_32 *pvar) {
+ UI_32 retVal = (UI_32)0;
+
+ if (pvar == NULL) {
+ return retVal;
+ }
+
+ UI_32 var = *pvar;
+ retVal = (((var & 0xFF000000) >> 24) |
+ ((var & 0x00FF0000) >> 8) |
+ ((var & 0x0000FF00) << 8) |
+ ((var & 0x000000FF) << 24));
+ return (retVal);
+}
+
+static void
+check_syslog_opened(void) {
+ if (!syslogopened) {
+ openlog(0, LOG_CONS | LOG_NDELAY | LOG_PID, LOG_USER);
+ syslogopened = 1;
+ }
+}
+
+static time_t
+tick_msec_get(void) {
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) != 0) { // LCOV_EXCL_BR_LINE 5: clock_gettime's error case
+ // LCOV_EXCL_START 5: clock_gettime's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0; /* NG */
+ // LCOV_EXCL_STOP 5
+ }
+ return tp.tv_sec * 1000 + tp.tv_nsec / 1000000;
+}
+
+static inline int
+num2string(PSTR buf, int digits, UI_32 num) {
+ PSTR p = NULL;
+ char c;
+
+ switch (digits) {
+ case 5:
+ p = buf;
+ if (num >= 100000) {
+ *p++ = '0';
+ *p++ = '0';
+ *p++ = '0';
+ *p++ = '0';
+ *p = '0';
+ break;
+ }
+ c = static_cast<char>(num / 10000);
+ *p++ = static_cast<char>(c + '0');
+ num = num - (c * 10000);
+ c = static_cast<char>(num / 1000);
+ *p++ = static_cast<char>(c + '0');
+ num = num - (c * 1000);
+ case 3:
+ if (p == NULL) {
+ p = buf;
+ }
+ if (num >= 1000) {
+ *p++ = '0';
+ *p++ = '0';
+ *p = '0';
+ break;
+ }
+ c = static_cast<char>(num / 100);
+ *p++ = static_cast<char>(c + '0');
+ num = num - (c * 100);
+ case 2:
+ if (p == NULL) {
+ p = buf;
+ }
+ if (num >= 100) {
+ *p++ = '0';
+ *p = '0';
+ break;
+ }
+ c = static_cast<char>(num / 10);
+ *p++ = static_cast<char>(c + '0');
+ *p = static_cast<char>(num - (c * 10) + '0');
+ break;
+ default: {
+ int dig = 1;
+ int n = num;
+ p = buf;
+ while (n >= 10) {
+ n /= 10;
+ dig *= 10;
+ }
+ while (dig > 1) {
+ c = static_cast<char>(num / dig);
+ *p++ = static_cast<char>(c + '0');
+ num = num - (c * dig);
+ dig /= 10;
+ }
+ *p = static_cast<char>(num + '0');
+ }
+ break;
+ }
+ return static_cast<int>(p - buf + 1);
+}
+
+static void
+_GetTimeString2(PSTR format) {
+ time_t tick;
+ UI_32 hh, mm, ss, ms;
+
+ // "%02d:%02d:%02d.%03d/"
+ tick = tick_msec_get();
+
+ ms = static_cast<UI_32>(tick % 1000);
+ format[8] = '.';
+ num2string(&format[9], 3, ms);
+ format[12] = '/';
+
+ tick /= 1000;
+ ss = static_cast<UI_32>(tick % 60);
+ format[5] = ':';
+ num2string(&format[6], 2, ss);
+
+ tick /= 60;
+ mm = static_cast<UI_32>(tick % 60);
+ format[2] = ':';
+ num2string(&format[3], 2, mm);
+
+ tick /= 60;
+ hh = static_cast<UI_32>(tick);
+ num2string(&format[0], 2, hh);
+}
+
+// LCOV_EXCL_START 8: dead code
+void
+_GetTimeString(PSTR format, UI_16 length) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 8: dead code
+ time_t tick;
+ UI_32 hh, mm, ss, ms;
+
+ tick = tick_msec_get();
+ ms = static_cast<UI_32>(tick % 1000);
+ tick /= 1000;
+ ss = static_cast<UI_32>(tick % 60);
+ tick /= 60;
+ mm = static_cast<UI_32>(tick % 60);
+ tick /= 60;
+ hh = static_cast<UI_32>(tick);
+
+ snprintf(format, (length - 1), "%02d:%02d:%02d.%03d/", hh, mm, ss, ms);
+}
+// LCOV_EXCL_STOP 8
+
+static UI_64
+ClockCyclesToMs(void) {
+ return ClockCycle() / 1000;
+}
+
+static CHAR *
+_in_NsLog_part1(const UI_16 p_lLine_i, const UI_16 f_uiZoneIndex,
+ PCSTR p_pstrClassName_i, CHAR *format) {
+ CHAR t_name[16]; // thread name (not more than 15 characters)
+ int len;
+ CHAR *p = format;
+
+ if (format == NULL) {
+ return NULL;
+ }
+
+ // fixed format : "%s%ld/%d/%s/%05d/%s/%d/=%s\r\n"
+ // time_string
+ _GetTimeString2(p);
+ p += 13;
+
+ // g_msgcounter
+ g_msgcounter++;
+ len = num2string(p, 0, g_msgcounter);
+ p += len;
+ *p++ = '/';
+
+ // f_uiZoneIndex
+ len = num2string(p, 0, f_uiZoneIndex);
+ p += len;
+ *p++ = '/';
+
+ // Check whether thread name has previously been set
+ t_name[0] = 0;
+ if (tls_strProcessName[0] != 0) {
+ tls_strProcessName[sizeof(t_name) - 1] = '\0';
+ strcpy(t_name, tls_strProcessName); // NOLINT (readability/nolint)
+ } else {
+ if (prctl(PR_GET_NAME, t_name) != 0) {
+ strcpy(t_name, "UNKNOWN"); // NOLINT (readability/nolint)
+ }
+ NsLogSetProcessName(t_name);
+ }
+
+ // t_name
+ strcpy(p, t_name); // NOLINT (readability/nolint)
+ p += strlen(t_name);
+ *p++ = '/';
+
+ // t_id
+ if (tid == 0) {
+ tid = static_cast<pid_t>(syscall(__NR_gettid));
+ }
+ len = num2string(p, 5, tid);
+ p += len;
+ *p++ = '/';
+
+ // p_pstrClassName_i
+ if (p_pstrClassName_i) {
+ strcpy(p, p_pstrClassName_i); // NOLINT (readability/nolint)
+ } else {
+ strcpy(p, "(null)"); // NOLINT (readability/nolint)
+ }
+ p += strlen(p);
+ *p++ = '/';
+
+ // p_lLine_i
+ len = num2string(p, 0, p_lLine_i);
+ p += len;
+ *p++ = '/';
+ *p++ = '=';
+
+ return p;
+}
+
+static void
+_in_NsLog_part2(const UI_16 f_uiZoneIndex, CHAR *p, CHAR *format) {
+ UI_32 l_uiLength;
+
+ if (p == NULL) {
+ return;
+ }
+
+ *p++ = '\r';
+ *p++ = '\n';
+ *p = '\0';
+
+ if (format == NULL) {
+ return;
+ }
+
+ l_uiLength = static_cast<UI_32>(p - format);
+
+ // Write log message
+ if (l_uiLength > 0) {
+ UI_8 l_realTimeLog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ BOOL IsZonePrintEnable = NsLogIsZonePrintEnable(f_uiZoneIndex, &l_realTimeLog);
+ if (l_realTimeLog == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE) {
+ if (g_qid != (mqd_t)(-1)) {
+ mq_close(g_qid);
+ g_qid = (mqd_t)(-1);
+ }
+ return;
+ }
+ if (g_LocalFrameworkunifiedLogParams.uiLogOptions & LPRINT) {
+ ssize_t l_writtenbyte;
+ std::string usb_realtime_filename;
+ std::string ownAdrr;
+ std::string writeAdrr;
+ if (IsZonePrintEnable == TRUE) {
+ switch (l_realTimeLog) {
+ case FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF:
+ // Nothing
+ break;
+ case FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART:
+ // Write console
+ fwrite(format, 1, l_uiLength, stdout);
+ break;
+ case FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB:
+ if (g_qid == (mqd_t)(-1)) {
+ struct mq_attr qattr;
+
+ qattr.mq_flags = 0;
+ qattr.mq_maxmsg = USB_REALTIME_MSGMAX;
+ qattr.mq_msgsize = USB_REALTIME_SIZMAX;
+ qattr.mq_curmsgs = 0;
+ if ((g_qid = mq_open(USB_REALTIME_QNAME, O_WRONLY | O_CREAT, 0666, &qattr)) == (mqd_t)(-1)) {
+ fprintf(stderr, "Failed to create Message Queue %s, errno=%d\n", USB_REALTIME_QNAME, errno);
+ break;
+ }
+ }
+ l_writtenbyte = mq_send(g_qid, format, l_uiLength, 1);
+ if (l_writtenbyte == -1) {
+ fprintf(stderr, "mq_send ERROR, errno=%d\n", errno);
+ mq_close(g_qid);
+ g_qid = (mqd_t)(-1);
+ }
+ break;
+ case FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE:
+ if (g_qid != (mqd_t)(-1)) {
+ mq_close(g_qid);
+ g_qid = (mqd_t)(-1);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ if (g_LocalFrameworkunifiedLogParams.uiLogOptions & LSLOGGER) {
+ check_syslog_opened();
+ syslog(LOG_ERR, "%s", format);
+ }
+
+ {
+ CNSRingBuffer *ring_buffer = NULL;
+ GetFrameworkunifiedLogRingBuffer(f_uiZoneIndex, &ring_buffer);
+
+ if (ring_buffer != NULL) {
+ if (ring_buffer->IsOpen()) {
+ ring_buffer->Write(format, l_uiLength);
+ }
+ }
+ }
+ }
+}
+
+void
+NsLogTime(const UI_16 f_uiZoneIndex, PCSTR lpszFormat) {
+ CHAR format[MAX_QUEUE_MSG_SIZE];
+ CHAR *p = format;
+ CHAR *q = reinterpret_cast<CHAR *>(const_cast<char *>(lpszFormat));
+ int i;
+
+ // fixed format : "%s/=%s\r\n"
+ // time_string
+ _GetTimeString2(p);
+ p += 13;
+ *p++ = '=';
+
+ /**
+ * @todo
+ * Defining a NULL for the lpszFormat causes a segmentation fault.
+ */
+ for (i = 0; *q && i < MAX_QUEUE_MSG_SIZE - (p - format) - 3; i++) { // '3': '\r''\n''\0'
+ *p++ = *q++;
+ }
+ _in_NsLog_part2(f_uiZoneIndex, p, format);
+}
+
+void
+NsLogData(const UI_16 f_uiZoneIndex, PCSTR data, UI_32 size) {
+ int l_realTimeLog;
+ int l_logLevel;
+
+ GetShmInfo(g_FrameworkunifiedLogFlagId, &l_realTimeLog, &l_logLevel);
+ if (l_realTimeLog == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE) {
+ return;
+ }
+
+ if (size > 0) {
+ CNSRingBuffer *ring_buffer = NULL;
+ GetFrameworkunifiedLogRingBuffer(f_uiZoneIndex, &ring_buffer); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (ring_buffer != NULL) {
+ if (ring_buffer->IsOpen()) {
+ ring_buffer->Write(data, size);
+ }
+ }
+ }
+}
+
+void
+NsLog0(const UI_16 p_lLine_i, // Line number where message was generated
+ const UI_16 f_uiZoneIndex,
+ PCSTR p_pstrClassName_i,
+ PCSTR lpszFormat) {
+ CHAR format[MAX_QUEUE_MSG_SIZE];
+ CHAR *p;
+ CHAR *q = reinterpret_cast<CHAR *>(const_cast<char *>(lpszFormat));
+ int i;
+
+ p = _in_NsLog_part1(p_lLine_i, f_uiZoneIndex, p_pstrClassName_i, format);
+ /**
+ * @todo
+ * Setting p_pstrClassName_i to NULL results in a segmentation fault.
+ */
+ for (i = 0; *q && i < MAX_QUEUE_MSG_SIZE - (p - format) - 3; i++) { // '3': '\r''\n''\0'
+ *p++ = *q++;
+ }
+ _in_NsLog_part2(f_uiZoneIndex, p, format);
+}
+
+void
+NsLog(const UI_16 p_lLine_i, // Line number where message was generated
+ const UI_16 f_uiZoneIndex,
+ PCSTR p_pstrClassName_i,
+ PCSTR lpszFormat,
+ ...) {
+ va_list argList;
+ CHAR format[MAX_QUEUE_MSG_SIZE];
+ CHAR *p;
+ int num;
+ int size;
+
+ va_start(argList, lpszFormat);
+
+ p = _in_NsLog_part1(p_lLine_i, f_uiZoneIndex, p_pstrClassName_i, format);
+ size = static_cast<int>(MAX_QUEUE_MSG_SIZE - (p - format) - 3);
+ num = vsnprintf(p, size, lpszFormat, argList);
+ if (num >= size) {
+ num = size - 1;
+ } else if (num < 0) {
+ num = 0;
+ }
+ p += num;
+ _in_NsLog_part2(f_uiZoneIndex, p, format);
+
+ va_end(argList);
+}
+
+void
+NsLogSetFrameworkunifiedLogParams(FRAMEWORKUNIFIEDLOGPARAM *p_FrameworkunifiedLogParams) {
+ int l_realTimeLog = 0;
+ int *l_logLevelArray = NULL;
+ CHAR buf[EXE_STR_LEN];
+
+ if (p_FrameworkunifiedLogParams == NULL) {
+ return;
+ }
+
+ get_readlink_path(buf);
+ if (g_flag_name.empty()) { // LCOV_EXCL_BR_LINE 200:get_readlink_path can not return false
+ std::string config_filename;
+ CHAR buf[EXE_STR_LEN];
+
+ if (IsExistFrameworkunifiedLogCfgNv()) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ } else {
+ config_filename = FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__FN; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ }
+ if (get_readlink_path(buf)) {
+ std::string exe_str = buf; // LCOV_EXCL_BR_LINE 11:expect branch
+ CNSConfigReader *config_reader = new CNSConfigReader(); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (config_reader != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ if (config_reader->Parse(config_filename)
+ == eFrameworkunifiedStatusOK) {
+ CreateFrameworkunifiedLogFileTbl(config_reader, exe_str, &l_realTimeLog, &l_logLevelArray); // LCOV_EXCL_BR_LINE 11:expect branch
+ MapShmInfo(g_FrameworkunifiedLogFlagId); // LCOV_EXCL_BR_LINE 11:expect branch
+ } else {
+ DEB_SYSLOG("Parse error %s", config_filename.c_str());
+ }
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEB_SYSLOG("new CNSConfigReader error");
+ // LCOV_EXCL_STOP 5
+ }
+ delete config_reader; // LCOV_EXCL_BR_LINE 11:expect branch
+ } else {
+ // LCOV_EXCL_START 5: get_readlink_path can not return false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEB_SYSLOG("get_readlink_path error");
+ // LCOV_EXCL_STOP 5
+ }
+ } else {
+ // already read
+ // do nothing
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgShmem()) {
+ if (l_logLevelArray == NULL) {
+ readConfig(&l_realTimeLog, &l_logLevelArray);
+ }
+ WriteSharedMem(WTYPE_NORMAL, l_realTimeLog, g_FlagIdNum, l_logLevelArray);
+ MapShmInfo(g_FrameworkunifiedLogFlagId);
+ }
+ if (l_logLevelArray != NULL) {
+ free(l_logLevelArray);
+ }
+
+ /**
+ * @tood
+ * Segmentation faults occur when NULL is defined as arguments.
+ */
+ memcpy(&g_LocalFrameworkunifiedLogParams, p_FrameworkunifiedLogParams, sizeof(FRAMEWORKUNIFIEDLOGPARAM));
+
+ // Force Output ZONE_NS_WAR(8),ZONE_NS_ERR(9)
+ TFrameworkunifiedZone l_uiZoneMask = g_LocalFrameworkunifiedLogParams.uiZoneMask[0];
+ l_uiZoneMask = l_uiZoneMask | GET_ZONE_BIT_MASK(ZONE_NS_WAR) | GET_ZONE_BIT_MASK(ZONE_NS_ERR);
+ g_LocalFrameworkunifiedLogParams.uiZoneMask[0] = l_uiZoneMask;
+
+ // Force Output Zones
+ {
+ TFrameworkunifiedLogMap::iterator itr = g_FrameworkunifiedLogMap.begin();
+ TFrameworkunifiedLogMap::iterator itr_end = g_FrameworkunifiedLogMap.end();
+ for (; itr != itr_end; itr++) {
+ if (itr->second.force_output) {
+ UI_16 zone = static_cast<UI_16>(itr->first);
+ TFrameworkunifiedZone *pl_uiZoneMask = &g_LocalFrameworkunifiedLogParams.uiZoneMask[GET_ZONE_INDEX(zone)];
+ *pl_uiZoneMask |= GET_ZONE_BIT_MASK(zone);
+ }
+ }
+ }
+}
+
+void
+NsLogSetProcessName(PCSTR p_strProcessName_i) {
+ if ((p_strProcessName_i != NULL) && (strlen(p_strProcessName_i) < _countof(tls_strProcessName))) {
+ strcpy(tls_strProcessName, p_strProcessName_i); // NOLINT (readability/nolint)
+ }
+}
+
+void
+NsLogSetControlMask(TFrameworkunifiedZoneMask p_NSLogControl_i) {
+ for (UI_32 zoneIndex = 0; zoneIndex < ZONE_MASK_ARRAY_ELTS; zoneIndex++) {
+ /**
+ * @todo
+ * Setting NULL to arguments terminates abnormally
+ */
+ g_LocalFrameworkunifiedLogParams.uiZoneMask[zoneIndex] = p_NSLogControl_i[zoneIndex];
+ }
+}
+
+void
+NsLogGetControlMask(TFrameworkunifiedZoneMask p_Zonemask_i) {
+ for (UI_32 zoneIndex = 0; zoneIndex < ZONE_MASK_ARRAY_ELTS; zoneIndex++) {
+ /**
+ * @todo
+ * Setting NULL to arguments terminates abnormally
+ */
+ p_Zonemask_i[zoneIndex] = g_LocalFrameworkunifiedLogParams.uiZoneMask[zoneIndex];
+ }
+}
+
+BOOL
+NsLogIsZoneSet(UI_32 set_zone) {
+ int realTimeLog;
+ int logLevel = 0;
+
+ GetShmInfo(g_FrameworkunifiedLogFlagId, &realTimeLog, &logLevel);
+
+ if (logLevel == FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG)
+ {
+ return TRUE;
+ }
+
+ if (set_zone >= BITS_IN_ZONE_MASK) {
+ return FALSE;
+ }
+
+ if (0 != (g_LocalFrameworkunifiedLogParams.uiZoneMask[ GET_ZONE_INDEX(set_zone) ] & GET_ZONE_BIT_MASK(set_zone))) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+void
+NsLogSetLogMethod(UI_8 p_eMethod_i) {
+ g_LocalFrameworkunifiedLogParams.uiLogOptions = p_eMethod_i;
+}
+
+UI_8
+NsLogGetLogMethod(void) {
+ return g_LocalFrameworkunifiedLogParams.uiLogOptions;
+}
+
+void
+NsLogSetSeverity(TFrameworkunifiedLoggerSeverity p_eLogSeverity_i) {
+ g_LocalFrameworkunifiedLogParams.eSeverity = p_eLogSeverity_i;
+}
+
+TFrameworkunifiedLoggerSeverity
+NsLogGetSeverity(void) {
+ return g_LocalFrameworkunifiedLogParams.eSeverity;
+}
+
+UI_8
+NsLogDetermineLogMethod(PCSTR output_type) {
+ PSTR p = NULL;
+ const CHAR delims[] = "|";
+ UI_8 outmask = 0;
+ PSTR parse = NULL;
+ PSTR saveptr = NULL;
+
+ if (output_type != NULL) {
+ // since strtok modifies the var. we
+ // must create a copy of the string.
+ parse = strdup(output_type);
+ p = strtok_r (parse, delims, &saveptr); // NOLINT (readability/nolint)
+ while (p != NULL) {
+ // slogger|msgq|console
+#ifdef AGL_STUB
+ if (!strcasecmp(p, "slogger")) {
+#else
+ if (!strcmpi(p, "slogger")) {
+#endif
+ outmask |= LSLOGGER;
+#ifdef AGL_STUB
+ } else if (!strcasecmp(p, "msgq")) {
+#else
+ } else if (!strcmpi(p, "msgq")) {
+#endif
+ outmask |= LMSGQ;
+#ifdef AGL_STUB
+ } else if (!strcasecmp(p, "console")) {
+#else
+ } else if (!strcmpi(p, "console")) {
+#endif
+ outmask |= LPRINT;
+#ifdef AGL_STUB
+ } else if (!strcasecmp(p, "shmem")) {
+#else
+ } else if (!strcmpi(p, "shmem")) {
+#endif
+ outmask |= LSHAREDMEM;
+ } else {
+ // do nothing
+ }
+
+ p = strtok_r (NULL, delims, &saveptr); // NOLINT (readability/nolint)
+ }
+
+ // since we made dup of the char * passed we need to free it!
+ if (parse != NULL) {
+ free(parse);
+ parse = NULL;
+ }
+ }
+ return outmask;
+}
+
+void
+NsLogSetZones(UI_32 f_uiZoneCount, ...) {
+ va_list l_tArguments;
+
+ // Initialize the variable argument list
+ va_start(l_tArguments, f_uiZoneCount);
+
+ // Iterate the variable argument list
+ for (UI_32 l_uiArgumentCount = 0; l_uiArgumentCount < f_uiZoneCount; l_uiArgumentCount++) {
+ // get zone value
+ UI_32 l_uiZone = va_arg(l_tArguments, UI_32); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (l_uiZone < BITS_IN_ZONE_MASK) {
+ // add zone value to existing mask
+ UI_32 l_uiZoneMask = g_LocalFrameworkunifiedLogParams.uiZoneMask[GET_ZONE_INDEX(l_uiZone)];
+ l_uiZoneMask = l_uiZoneMask | GET_ZONE_BIT_MASK(l_uiZone);
+ g_LocalFrameworkunifiedLogParams.uiZoneMask[GET_ZONE_INDEX(l_uiZone)] = l_uiZoneMask;
+ }
+ }
+
+ va_end(l_tArguments);
+}
+
+void
+NsLogParseZones(FRAMEWORKUNIFIEDLOGPARAM *p_FrameworkunifiedLogParams, UI_32 f_uiZoneCount, ...) {
+ va_list l_tArguments;
+
+ if (p_FrameworkunifiedLogParams == NULL) {
+ return;
+ }
+
+ // Initialize the variable argument list
+ va_start(l_tArguments, f_uiZoneCount);
+
+ // Iterate the variable argument list
+ for (UI_32 l_uiArgumentCount = 0; l_uiArgumentCount < f_uiZoneCount; l_uiArgumentCount++) {
+ // get zone value
+ UI_32 l_uiZone = va_arg(l_tArguments, UI_32); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (l_uiZone < BITS_IN_ZONE_MASK) {
+ // add zone
+ UI_32 l_uiZoneMask = p_FrameworkunifiedLogParams->uiZoneMask[GET_ZONE_INDEX(l_uiZone)];
+ l_uiZoneMask = l_uiZoneMask | GET_ZONE_BIT_MASK(l_uiZone);
+ p_FrameworkunifiedLogParams->uiZoneMask[GET_ZONE_INDEX(l_uiZone)] = l_uiZoneMask;
+ }
+ }
+
+ va_end(l_tArguments);
+}
+
+void
+NsLog_EvtCnt(UI_16 Cnt_Id, UI_16 Evt_Id, UI_8 nu, ...) {
+ st_LogEvent log;
+ va_list EC_list;
+ va_start(EC_list, nu);
+ UI_8 i = 0;
+ UI_32 ts = (UI_32)ClockCyclesToMs();
+
+ memset(&log, 0, sizeof(log));
+
+ log.ts = ConvertEndian(&ts);
+ log.event_id = (UI_8)Evt_Id;
+ log.grp_ID = (UI_8)(Evt_Id >> 8);
+ log.cnt_ID = Cnt_Id;
+
+ switch (nu) {
+ case 1:
+ log.data[0] = (UI_8)va_arg(EC_list, int);
+ log.phase = NORMAL;
+ log.typeofdata = COMMON;
+ break;
+ case 2:
+ log.data[0] = (UI_8)va_arg(EC_list, int);;
+ log.phase = (SystemPhase)va_arg(EC_list, int);
+ log.typeofdata = COMMON;
+ break;
+ case 4:
+ for (i = 0; i < nu; i++) {
+ log.data[i] = (UI_8)va_arg(EC_list, int);
+ }
+ log.phase = NORMAL;
+ log.typeofdata = EVENT_SPECIFIC;
+ break;
+ case 5:
+ for (i = 0; i < (nu - 1); i++) {
+ log.data[i] = (UI_8)va_arg(EC_list, int);
+ }
+ log.phase = (SystemPhase)va_arg(EC_list, int);
+ log.typeofdata = EVENT_SPECIFIC;
+ break;
+ default:
+ memset(&log, 0, sizeof(log));
+ break;
+ }
+
+ if (log.cnt_ID != 0 && log.grp_ID != 0) {
+ if (g_hSSEventLogQ == INVALID_HANDLE) {
+ g_hSSEventLogQ = McOpenSender(EVENTLOG_MSGQ_NAME);
+ }
+ McSend(g_hSSEventLogQ, tls_strProcessName, SS_MSG_LOGGER_CNT_EVTLOG, sizeof(log), &log);
+ }
+ va_end(EC_list);
+}
+
+
+void
+NsLog_Evt(UI_16 Evt_Id, UI_8 nu, ...) {
+ st_LogEvent log_Evt;
+ va_list E_list;
+ va_start(E_list, nu);
+ UI_32 ts = (UI_32)ClockCyclesToMs();
+
+ memset(&log_Evt, 0, sizeof(st_LogEvent));
+
+ log_Evt.ts = ConvertEndian(&ts);
+ log_Evt.grp_ID = (UI_8)(Evt_Id >> 8);
+ log_Evt.event_id = (UI_8)Evt_Id;
+
+ UI_8 i;
+ switch (nu) {
+ case 1:
+ log_Evt.data[0] = (UI_8)va_arg(E_list, int); // LCOV_EXCL_BR_LINE 11:expect branch
+ log_Evt.typeofdata = COMMON;
+ break;
+ case 4:
+ for (i = 0; i < nu; i++) {
+ log_Evt.data[i] = (UI_8)va_arg(E_list, int); // LCOV_EXCL_BR_LINE 11:expect branch
+ }
+ log_Evt.typeofdata = EVENT_SPECIFIC;
+ break;
+ default:
+ memset(&log_Evt, 0, sizeof(st_LogEvent));
+ break;
+ }
+ if (log_Evt.grp_ID != 0) {
+ if (g_hSSEventLogQ == INVALID_HANDLE) {
+ g_hSSEventLogQ = McOpenSender(EVENTLOG_MSGQ_NAME);
+ }
+
+ McSend(g_hSSEventLogQ, tls_strProcessName, SS_MSG_EVTLOG, sizeof(log_Evt), &log_Evt);
+ }
+ va_end(E_list);
+}
+
+
+void
+NsLog_Cnt(UI_16 Cnt_Id, UI_8 nu, ...) {
+ st_LogCount log_Cnt;
+ va_list C_list;
+ va_start(C_list, nu);
+
+ memset(&log_Cnt, 0, sizeof(st_LogCount));
+ log_Cnt.cnt_id = Cnt_Id;
+
+ switch (nu) {
+ case 0:
+ log_Cnt.phase = NORMAL;
+ break;
+ case 1:
+ log_Cnt.phase = (SystemPhase)va_arg(C_list, int); // LCOV_EXCL_BR_LINE 11:expect branch
+ break;
+ default:
+ memset(&log_Cnt, 0, sizeof(st_LogCount));
+ break;
+ }
+ if (log_Cnt.cnt_id != 0) {
+ if (g_hSSEventLogQ == INVALID_HANDLE) {
+ g_hSSEventLogQ = McOpenSender(EVENTLOG_MSGQ_NAME);
+ }
+ McSend(g_hSSEventLogQ, tls_strProcessName, SS_MSG_LOGGERCNT, sizeof(log_Cnt), &log_Cnt);
+ }
+ va_end(C_list);
+}
+
+//////////////////////////////////////////
+// NSPrintPerformanceLog
+//////////////////////////////////////////
+VOID
+NSLogPrintPerformanceLog(const UI_16 f_ui16Line, PCSTR f_cFuncName, PCSTR __format, ...) {
+#ifndef AGL_STUB
+ va_list arg;
+ CHAR l_cFormat[MAX_PLOG_STRING_SIZE] = {};
+ CHAR l_cTimeFormat[MAX_TIME_FORMATSTR_LEN] = {};
+ UI_64 l_ui64CurrentTime = 0;
+
+ if (g_hNSplogMsgQ == INVALID_HANDLE) {
+ g_hNSplogMsgQ = OpenSender(NS_PLOGQ);
+ }
+
+ if (g_FrameworkunifiedLogPParams.ui64GapInuS == 0) {
+ FILE *l_fpPLogGap = NULL;
+ l_fpPLogGap = fopen(PLOG_GAP_FILE, "re");
+ if (l_fpPLogGap != NULL) {
+ CHAR l_cBuffer[MAX_GAP_BUFFER_LEN] = {};
+ if (fgets(l_cBuffer, MAX_GAP_BUFFER_LEN, l_fpPLogGap) != NULL) {
+ g_FrameworkunifiedLogPParams.ui64GapInuS = (unsigned)atoll(l_cBuffer);
+ }
+ fclose(l_fpPLogGap);
+ }
+ }
+
+ if (g_FrameworkunifiedLogPParams.eTimeFormat == EPLOG_TIME_FORMAT_USEC) {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ l_ui64CurrentTime = ClockCycle() + g_FrameworkunifiedLogPParams.ui64GapInuS;
+#endif
+ snprintf(l_cTimeFormat, MAX_TIME_FORMATSTR_LEN, "%s", "us");
+ } else if (g_FrameworkunifiedLogPParams.eTimeFormat == EPLOG_TIME_FORMAT_MSEC) {
+ l_ui64CurrentTime = ClockCyclesToMs() + (g_FrameworkunifiedLogPParams.ui64GapInuS / 1000);
+ snprintf(l_cTimeFormat, MAX_TIME_FORMATSTR_LEN, "%s", "ms");
+ } else if (g_FrameworkunifiedLogPParams.eTimeFormat == EPLOG_TIME_FORMAT_SEC) {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ l_ui64CurrentTime = (ClockCycle() / 1000000) + (g_FrameworkunifiedLogPParams.ui64GapInuS / 1000000);
+#endif
+ snprintf(l_cTimeFormat, MAX_TIME_FORMATSTR_LEN, "%s", "s");
+ } else {
+ // do nothing
+ }
+
+ va_start(arg, __format);
+ vsnprintf(l_cFormat, MAX_PLOG_STRING_SIZE - 1, __format, arg);
+ l_cFormat[MAX_PLOG_STRING_SIZE - 1] = '\0';
+ va_end(arg);
+
+ CHAR l_cMsg[MAX_QUEUE_MSG_SIZE] = {};
+ snprintf(l_cMsg, MAX_QUEUE_MSG_SIZE - 1, "PLog: %12llu[%s]:%s %s: %s: %s",
+ l_ui64CurrentTime, l_cTimeFormat, (g_FrameworkunifiedLogPParams.ui64GapInuS > 0) ? ("o") : ("x"),
+ tls_strProcessName, f_cFuncName, l_cFormat);
+
+ if (g_FrameworkunifiedLogPParams.uiLogOutputOptions & EPLOG_SLOG) {
+ // send to system logger
+ check_syslog_opened();
+ syslog(LOG_INFO, "%s", l_cMsg);
+ }
+
+ if (g_FrameworkunifiedLogPParams.uiLogOutputOptions & EPLOG_TRACEEVENT) {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ (VOID)trace_nlogf(_NTO_TRACE_USERFIRST, MAX_QUEUE_MSG_SIZE - 1, l_cMsg);
+#endif
+ }
+
+ if (g_FrameworkunifiedLogPParams.uiLogOutputOptions & EPLOG_MSGQ) {
+ // send to message queue /NSplog
+ if (g_hNSplogMsgQ != INVALID_HANDLE) {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcat(l_cMsg, "\n", sizeof(l_cMsg)); // insert new line... user may not have.
+#endif
+ if (SendMessage(g_hNSplogMsgQ, strlen(l_cMsg),
+ reinterpret_cast<void *>(const_cast<char *>(l_cMsg))) != eFrameworkunifiedStatusOK) {
+ // Note: Nothing will be printed on a failure.
+ }
+ }
+ }
+#endif
+}
+
+//////////////////////////////////////////
+// NSLogEnablePLog
+//////////////////////////////////////////
+VOID
+NSLogEnablePLog(BOOL f_bEnable) {
+ g_FrameworkunifiedLogPParams.bIsPLogEnabled = f_bEnable;
+}
+
+//////////////////////////////////////////
+// NsLogIsPLogEnabled
+//////////////////////////////////////////
+BOOL
+NsLogIsPLogEnabled(void) {
+ return g_FrameworkunifiedLogPParams.bIsPLogEnabled;
+}
+
+//////////////////////////////////////////
+// NSLogSetPlogTimeFormat
+//////////////////////////////////////////
+VOID
+NSLogSetPlogTimeFormat(EPLOG_TIME_FORMAT f_ePlogTimeFormat) {
+ g_FrameworkunifiedLogPParams.eTimeFormat = f_ePlogTimeFormat;
+}
+
+//////////////////////////////////////////
+// NSLogSetPlogOutputOptions
+//////////////////////////////////////////
+VOID
+NSLogSetPlogOutputOptions(UI_8 f_uiPlogOutputOption) {
+ g_FrameworkunifiedLogPParams.uiLogOutputOptions = f_uiPlogOutputOption;
+}
+
+//////////////////////////////////////////
+// NsLogInitialize for Diag Method
+//////////////////////////////////////////
+VOID
+NsLogInitialize(void) {
+ std::string config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ int l_realTimelog;
+ int *l_logLevelArray = NULL;
+
+ if (unlink(config_filename.c_str()) != 0) {
+ // error TODO wirte log, bit, not use frameworkunifiedlog
+ }
+
+ readConfig(&l_realTimelog, &l_logLevelArray); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (l_logLevelArray == NULL) {
+ return;
+ }
+ WriteSharedMem(WTYPE_NORMAL, l_realTimelog, g_FlagIdNum, l_logLevelArray); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (l_logLevelArray != NULL) {
+ free(l_logLevelArray);
+ }
+}
+
+static void writeUpdateConfigForString(std::string &name, // NOLINT (readability/nolint)
+ std::string set_key,
+ std::string value) {
+ std::string flag_loglevel_key = name;
+ flag_loglevel_key.append(set_key);
+
+ std::string config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:expect branch
+ std::string config_tmpfilename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ config_tmpfilename.append(FRAMEWORKUNIFIEDLOG_CONFIG_TMP_NV);
+
+ unlink(config_tmpfilename.c_str());
+ if (copyFrameworkunifiedLogCfgFile(config_filename.c_str(), config_tmpfilename.c_str()) != 0) {
+ DEB_SYSLOG("fail to copy file. no update config.");
+ return;
+ }
+
+// CNSConfigWriter *l_pConfigWriter = new(std::nothrow) CNSConfigWriter(config_filename.c_str());
+ CNSConfigWriter *l_pConfigWriter = new(std::nothrow) CNSConfigWriter(config_tmpfilename.c_str()); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (l_pConfigWriter != NULL) {
+ try {
+ // l_iReturnState = ConfigWriterUpdateValue(l_hHandle, l_sKeyValue.c_str(), actualOutput.c_str());
+ l_pConfigWriter->Set(flag_loglevel_key, value);
+ } catch (...) {
+ // error TODO
+ }
+ // ConfigWriterClose(l_hHandle);
+ l_pConfigWriter->Save();
+ delete l_pConfigWriter;
+ l_pConfigWriter = NULL;
+
+ if (rename(config_tmpfilename.c_str(), config_filename.c_str()) != 0) {
+ DEB_SYSLOG("rename error errno:%d", errno);
+ }
+
+ }
+}
+
+static void
+writeUpdateConfig(std::string set_key, std::string value) {
+ std::string config_filename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ std::string config_tmpfilename = FRAMEWORKUNIFIEDLOG_CONFIG_NV; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_filename.append(FRAMEWORKUNIFIEDLOG_CONFIG__CWORD84__NV); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ config_tmpfilename.append(FRAMEWORKUNIFIEDLOG_CONFIG_TMP_NV);
+
+ unlink(config_tmpfilename.c_str());
+ if (copyFrameworkunifiedLogCfgFile(config_filename.c_str(), config_tmpfilename.c_str())) {
+ DEB_SYSLOG("fail to copy file. no update config.");
+ return;
+ }
+
+// CNSConfigWriter *l_pConfigWriter = new(std::nothrow) CNSConfigWriter(config_filename.c_str());
+ CNSConfigWriter *l_pConfigWriter = new(std::nothrow) CNSConfigWriter(config_tmpfilename.c_str()); // LCOV_EXCL_BR_LINE 11:expect branch
+
+
+ if (l_pConfigWriter != NULL) {
+ l_pConfigWriter->Set(set_key.c_str(), value); // LCOV_EXCL_BR_LINE 11:expect branch
+ l_pConfigWriter->Save(); // LCOV_EXCL_BR_LINE 11:expect branch
+ delete l_pConfigWriter; // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (rename(config_tmpfilename.c_str(), config_filename.c_str()) != 0) {
+ DEB_SYSLOG("rename error errno:%d", errno);
+ }
+ }
+}
+
+//////////////////////////////////////////
+// NsLogSetFrameworkunifiedLogFlag for Diag Method
+//////////////////////////////////////////
+VOID
+NsLogSetFrameworkunifiedLogFlag(UI_8 flag_id, UI_8 mode) {
+ std::string l_key = ".LogLevel";
+ int l_realTimelog;
+ int *l_logLevelArray;
+ std::string l_value;
+
+ if (mode != FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG
+ && mode != FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE) {
+ return;
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgNv()) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ copyFrameworkunifiedLogCfgFileToNv(); // LCOV_EXCL_BR_LINE 11:expect branch
+ }
+
+ l_realTimelog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ l_logLevelArray = NULL;
+
+ readConfig(&l_realTimelog, &l_logLevelArray); // for make ramd data
+ if (l_logLevelArray == NULL) {
+ return;
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgShmem()) {
+ WriteSharedMem(WTYPE_NORMAL, l_realTimelog, g_FlagIdNum, l_logLevelArray);
+ MapShmInfo(g_FrameworkunifiedLogFlagId);
+ }
+
+ if (flag_id >= g_FlagIdNum) {
+ if (l_logLevelArray != NULL) {
+ free(l_logLevelArray);
+ }
+ return;
+ }
+
+ if (mode == FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG) {
+ l_value = "Debug";
+ l_logLevelArray[flag_id] = FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG;
+ } else {
+ l_value = "Release";
+ l_logLevelArray[flag_id] = FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE;
+ }
+ writeUpdateConfigForString(g_flag_name[flag_id], l_key, l_value); // LCOV_EXCL_BR_LINE 11:expect branch
+ WriteSharedMemForFlagId(l_realTimelog, g_FlagIdNum, flag_id, l_logLevelArray[flag_id]); // LCOV_EXCL_BR_LINE 11:expect branch
+
+ free(l_logLevelArray);
+}
+
+//////////////////////////////////////////
+// NsLogGetFrameworkunifiedLogFlag for Diag Method
+//////////////////////////////////////////
+EFrameworkunifiedStatus
+NsLogGetFrameworkunifiedLogFlag(UI_8 flag_id, UI_8 *mode) {
+ int l_realTimeLog;
+ int l_logLevel = 0;
+ int *l_logLevelArray;
+
+ if (mode == NULL) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ l_realTimeLog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ l_logLevelArray = NULL;
+
+ readConfig(&l_realTimeLog, &l_logLevelArray); // for make ramd data
+ if (l_logLevelArray == NULL) {
+ *mode = FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE;
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgShmem()) {
+ WriteSharedMem(WTYPE_NORMAL, l_realTimeLog, g_FlagIdNum, l_logLevelArray);
+ MapShmInfo(g_FrameworkunifiedLogFlagId);
+ }
+
+ if (l_logLevelArray != NULL) {
+ free(l_logLevelArray);
+ }
+
+ if ((flag_id >= g_FlagIdNum)) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ GetShmInfo(flag_id, &l_realTimeLog, &l_logLevel);
+ *mode = static_cast<UI_8>(l_logLevel);
+
+ return eFrameworkunifiedStatusOK;
+}
+
+//////////////////////////////////////////
+// NsLogSetRealtimeLog for Diag Method
+//////////////////////////////////////////
+VOID
+NsLogSetRealtimeLog(UI_8 mode) {
+ int l_realTimelog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ int *l_logLevelArray;
+ std::string l_key = "REALTIME_LOG.Output";
+ std::string l_value = "OFF"; // LCOV_EXCL_BR_LINE 11:expect branch
+
+ if (mode == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE) {
+ WriteSharedMem(WTYPE_RTIMELOG, FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE, g_FlagIdNum, NULL); // LCOV_EXCL_BR_LINE 11:expect branch
+ return;
+ }
+
+ if ((mode >= FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_MAX)
+ && (mode != FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE)) {
+ return;
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgNv()) { // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ copyFrameworkunifiedLogCfgFileToNv(); // LCOV_EXCL_BR_LINE 11:expect branch
+ }
+
+ l_logLevelArray = NULL;
+ readConfig(&l_realTimelog, &l_logLevelArray); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (l_logLevelArray == NULL) {
+ return;
+ }
+
+ if (!IsExistFrameworkunifiedLogCfgShmem()) {
+ WriteSharedMem(WTYPE_NORMAL, l_realTimelog, g_FlagIdNum, l_logLevelArray);
+ MapShmInfo(g_FrameworkunifiedLogFlagId);
+ }
+
+ if (mode == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART) {
+ l_value = "UART";
+ l_realTimelog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART;
+ } else if ((mode == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB)
+ || (mode == FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE)) {
+ l_value = "USB";
+ l_realTimelog = mode;
+ } else {
+ l_value = "OFF";
+ l_realTimelog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ }
+
+ writeUpdateConfig(l_key, l_value); // LCOV_EXCL_BR_LINE 11:expect branch
+ if (l_logLevelArray != NULL) {
+ WriteSharedMemForFlagId(l_realTimelog, g_FlagIdNum, FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID,
+ l_logLevelArray[FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID]); // LCOV_EXCL_BR_LINE 11:expect branch
+ free(l_logLevelArray);
+ }
+}
+
+//////////////////////////////////////////
+// NsLogGetRealtimeLog for Diag
+//////////////////////////////////////////
+VOID
+NsLogGetRealtimeLog(UI_8 *mode) {
+ int l_realTimelog;
+ int l_logLevel;
+ int *l_logLevelArray;
+
+ if (mode == NULL) {
+ return;
+ }
+ l_realTimelog = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ l_logLevelArray = NULL;
+
+ readConfig(&l_realTimelog, &l_logLevelArray); // for make ramd data
+ if (l_logLevelArray == NULL) {
+ *mode = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF;
+ return;
+ }
+ if (!IsExistFrameworkunifiedLogCfgShmem()) {
+ WriteSharedMem(WTYPE_NORMAL, l_realTimelog, g_FlagIdNum, l_logLevelArray);
+ MapShmInfo(g_FrameworkunifiedLogFlagId);
+ }
+ if (l_logLevelArray != NULL) {
+ free(l_logLevelArray);
+ }
+
+ GetShmInfo(g_FrameworkunifiedLogFlagId, &l_realTimelog, &l_logLevel);
+ *mode = static_cast<UI_8>(l_realTimelog);
+}
+
+//////////////////////////////////////////
+// NSLogPrintSysEventLog
+//////////////////////////////////////////
+VOID NSLogSysEvent(const UI_16 f_ui16Line, PCSTR f_cFuncName, PCSTR __format, ...) {
+ va_list arg;
+ CHAR l_cFormat[MAX_QUEUE_MSG_SIZE] = {};
+ CHAR l_cTimeFormat[MAX_TIME_FORMATSTR_LEN] = {};
+ UI_64 l_ui64CurrentTime = 0;
+ static UI_64 cps = 0;
+ static UI_64 l_ui64GapInUS = 0;
+
+ if (cps == 0) {
+ cps = SYSPAGE_ENTRY(qtime)->cycles_per_sec;
+ }
+ if (g_hNSSysEventLogQ == INVALID_HANDLE) {
+ g_hNSSysEventLogQ = OpenSender(NS_SYSEVENTLOGQ);
+ }
+ if (l_ui64GapInUS == 0) {
+ FILE *l_fpPLogGap = NULL;
+ l_fpPLogGap = fopen(PLOG_GAP_FILE, "re");
+ if (l_fpPLogGap != NULL) {
+ CHAR l_cBuffer[MAX_GAP_BUFFER_LEN] = {};
+ if (fgets(l_cBuffer, MAX_GAP_BUFFER_LEN, l_fpPLogGap) != NULL) {
+ l_ui64GapInUS = static_cast<UI_64>(atoll(l_cBuffer));
+ }
+ fclose(l_fpPLogGap);
+ }
+ }
+
+ if (g_hNSSysEventLogQ != INVALID_HANDLE) {
+ CHAR l_cMsg[MAX_QUEUE_MSG_SIZE] = {};
+ // build a format string
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ l_ui64CurrentTime = (ClockCycle() / (cps / 1000000)) + l_ui64GapInUS;
+#endif
+ snprintf(l_cTimeFormat, MAX_TIME_FORMATSTR_LEN, "%s", "us");
+
+ va_start(arg, __format);
+ vsnprintf(l_cFormat, MAX_PLOG_STRING_SIZE - 1, __format, arg);
+ l_cFormat[MAX_PLOG_STRING_SIZE - 1] = '\0';
+ va_end(arg);
+ UI_32 l_uiCharsWritten =
+ snprintf(l_cMsg, MAX_QUEUE_MSG_SIZE - 1,
+ "%12llu[%s]:%s %s: %s: %s\n",
+ static_cast<long long unsigned int>(l_ui64CurrentTime), // NOLINT (readability/nolint)
+ l_cTimeFormat,
+ (l_ui64GapInUS > 0) ? ("o") : ("x"),
+ tls_strProcessName != 0 ? tls_strProcessName : NULL,
+ f_cFuncName != 0 ? f_cFuncName : NULL, l_cFormat);
+
+ if (SendMessage(g_hNSSysEventLogQ, l_uiCharsWritten + 1,
+ reinterpret_cast<void *>(const_cast<char *>(l_cMsg)))
+ != eFrameworkunifiedStatusOK) {
+ // Note: Nothing will be printed on a failure.
+ }
+ }
+}
+
+/////////////////////////////////////////
+// NSLogEnableSysEventLog
+//////////////////////////////////////////
+VOID
+NSLogEnableSysEventLog(BOOL f_bEnable) {
+ g_FrameworkunifiedLogSysEventParams.bIsSysEventLogEnabled = f_bEnable;
+}
+
+//////////////////////////////////////////
+// NSLogIsSysEventLogEnabled
+//////////////////////////////////////////
+BOOL
+NSLogIsSysEventLogEnabled(void) {
+ return g_FrameworkunifiedLogSysEventParams.bIsSysEventLogEnabled;
+}
+
+//////////////////////////////////////////
+// NsLogGetZoneTextList
+//////////////////////////////////////////
+VOID
+NsLogGetZoneTextList(CHAR f_cZoneList[][ZONE_TEXT_SIZE]) {
+ if (f_cZoneList != NULL) {
+ UI_32 l_ui32CharsToWrite = ZONE_TEXT_SIZE - 1;
+ // first fill ns zone text list
+ strncpy(f_cZoneList[0], ZONE_TEXT_0, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[1], ZONE_TEXT_1, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[2], ZONE_TEXT_2, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[3], ZONE_TEXT_3, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[4], ZONE_TEXT_4, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[5], ZONE_TEXT_5, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[6], ZONE_TEXT_6, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[7], ZONE_TEXT_7, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[8], ZONE_TEXT_8, l_ui32CharsToWrite);
+ strncpy(f_cZoneList[9], ZONE_TEXT_9, l_ui32CharsToWrite);
+
+ // fill user zone text list
+ UI_32 l_ui32Count = 10; // start of user zones
+ UI_32 l_ui32ZoneListCount = 0;
+ for (; l_ui32Count < BITS_IN_ZONE_MASK; l_ui32Count++, l_ui32ZoneListCount++) {
+ strncpy(f_cZoneList[l_ui32Count], g_LocalFrameworkunifiedLogParams.cZones[l_ui32ZoneListCount], l_ui32CharsToWrite);
+ }
+ }
+}
+
+VOID
+NsForceClose(void) {
+ if (!syslogopened) {
+ closelog();
+ syslogopened = 0;
+ }
+
+ if (shm_pmap != reinterpret_cast<void *>(const_cast<unsigned int*>(default_log_cfgtbl))) {
+ int size;
+ size = static_cast<int>(sizeof(int) * 2); // realTimeLog + flagIdNum
+ size += static_cast<int>(sizeof(int) * g_FlagIdNum);
+ munmap(shm_pmap, size);
+ shm_pmap = reinterpret_cast<void *>(const_cast<unsigned int*>(default_log_cfgtbl));
+ }
+
+ if (shm_fd != -1) {
+ close(shm_fd);
+ shm_fd = -1;
+ }
+
+ if (g_qid != (mqd_t)(-1)) {
+ mq_close(g_qid);
+ g_qid = (mqd_t)(-1);
+ }
+
+ TFrameworkunifiedLogMap::iterator itr;
+ TFrameworkunifiedLogMap::iterator itr_end;
+ UI_32 i = 0;
+ unsigned int flag_id;
+ if (!g_FrameworkunifiedLogMap.empty()) {
+ itr = g_FrameworkunifiedLogMap.begin();
+ itr_end = g_FrameworkunifiedLogMap.end();
+ for (; itr != itr_end; itr++, i++) {
+ if (itr->second.ring_buffer != NULL) {
+ delete itr->second.ring_buffer; // LCOV_EXCL_BR_LINE 11:expect branch
+ itr->second.ring_buffer = NULL;
+ }
+ }
+ g_FrameworkunifiedLogMap.clear();
+ }
+
+ if (!g_FrameworkunifiedLogFlagMap.empty()) {
+ for (flag_id = 0; flag_id < g_FlagIdNum; flag_id++) {
+ itr = g_FrameworkunifiedLogFlagMap.find(flag_id);
+ if (itr->second.ring_buffer != NULL) {
+ delete itr->second.ring_buffer; // LCOV_EXCL_BR_LINE 11:expect branch
+ itr->second.ring_buffer = NULL;
+ }
+ }
+ g_FrameworkunifiedLogFlagMap.clear();
+ }
+
+ if (!g_flag_name.empty()) {
+ g_flag_name.clear();
+ }
+ g_FrameworkunifiedLogFlagId = FRAMEWORKUNIFIEDLOG_DEFAULT_FLAG_ID;
+ g_FlagIdNum = 0;
+} // LCOV_EXCL_BR_LINE 10:The final line
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Logger/tool/nslogsw.cpp b/video_in_hal/nsframework/framework_unified/client/NS_Logger/tool/nslogsw.cpp
new file mode 100755
index 0000000..b81b4a6
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Logger/tool/nslogsw.cpp
@@ -0,0 +1,114 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/ns_version.h>
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+_CWORD78_LOGPARAM g__CWORD78_LogParams = {
+ _CWORD78_LOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31
+ },
+ _CWORD78_LOGZONES
+};
+
+C_CWORD78_Version g__CWORD78_Version(MAJORNO, MINORNO, REVISION);
+
+static void
+Usage(char *exec) {
+ fprintf(stderr, "Usage: %s options\n", exec != 0 ? exec : NULL);
+ fprintf(stderr, " options\n");
+ fprintf(stderr, " -0 : REALTIMELOG_MODE_OFF\n");
+ fprintf(stderr, " -1 : REALTIMELOG_MODE_UART\n");
+ fprintf(stderr, " -2 : REALTIMELOG_MODE_USB\n");
+ fprintf(stderr, " -3 : REALTIMELOG_MODE_ETHER\n");
+ fprintf(stderr, " (none) print current status\n");
+}
+
+int
+main(int argc, char **argv) {
+ int c;
+
+ if (argc < 2) {
+ UI_8 realtimelog;
+ NsLogGetRealtimeLog(&realtimelog);
+ fprintf(stderr, "current status : -%d\n", realtimelog);
+ fprintf(stderr, " refer '%s -h'\n", argv[0] != 0 ? argv[0] : NULL);
+ return 0;
+ }
+
+ while ((c = getopt(argc, argv, "0123h")) != -1) {
+ switch (c) {
+ case '0':
+ fprintf(stderr, "set REALTIMELOG_MODE_OFF\n");
+ NsLogSetRealtimeLog(_CWORD78_LOG_REALTIMELOG_MODE_OFF);
+ return 0;
+ case '1':
+ fprintf(stderr, "set REALTIMELOG_MODE_UART\n");
+ NsLogSetRealtimeLog(_CWORD78_LOG_REALTIMELOG_MODE_UART);
+ return 0;
+ case '2':
+ fprintf(stderr, "set REALTIMELOG_MODE_USB\n");
+ NsLogSetRealtimeLog(_CWORD78_LOG_REALTIMELOG_MODE_USB);
+ return 0;
+ case '3':
+ fprintf(stderr, "set REALTIMELOG_MODE_ETHER\n");
+ NsLogSetRealtimeLog(_CWORD78_LOG_REALTIMELOG_MODE_ETHER);
+ return 0;
+ default:
+ Usage(argv[0]);
+ return 0;
+ }
+ }
+ Usage(argv[0]);
+ return 0;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/include/ns_mc_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/include/ns_mc_internal.h
new file mode 100755
index 0000000..2b6dae8
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/include/ns_mc_internal.h
@@ -0,0 +1,93 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_MessageCenter
+/// \brief Declares the internal methods of message center
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MC_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MC_INTERNAL_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetData
+/// Get the message data, this may be from a queue or shared memory.
+/// Deletes the data based on the value of BOOL retain, if it is stored in shared memory.
+///
+/// \param [in] data
+/// PVOID - pointer to the data received from the McReceive Call
+/// \param [in] to
+/// PVOID - pointer to the data to be received
+/// \param [in] retain
+/// BOOL - TRUE to retain the data in shared memory
+/// FALSE to release the data
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - status indicating success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetData(PVOID data, PVOID to, BOOL retain);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// McLogTransmitLoggingMsgProcessed
+///
+/// \param [in] p_sysHdr
+/// PVOID - Header of the received message. Passed as PVOID since Frameworkunified layer doesn't have
+/// knowledge about the header.
+/// \param [in] bMsgProcessed
+/// BOOL - TRUE - If any action was taken on the received message else FALSE
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID McLogTransmitLoggingMsgProcessed(PVOID p_sysHdr, BOOL bMsgProcessed);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Get the session id.
+///
+/// \param [in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+///
+/// \return UI_32
+/// sessionId - session id
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 mcGetMsgSsessionId(PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Gets the is type of sync from message header.
+///
+/// \param [in] pData
+/// void* - pointer to the data was received from the McReceive Call
+///
+/// \return BOOL
+/// isTypeOfSync -
+/// if message type is sync, return TRUE. or not return FALSE.
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL mcGetIsTypeOfSync(PVOID data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MC_INTERNAL_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/include/ns_message_center_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/include/ns_message_center_internal.h
new file mode 100755
index 0000000..a99e811
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/include/ns_message_center_internal.h
@@ -0,0 +1,185 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MESSAGE_CENTER_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MESSAGE_CENTER_INTERNAL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_shared_mem_if.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcOpenMonitor
+/// for Server API
+///
+/// \param [in] name
+/// PCSTR - Service name
+///
+/// \return int
+/// -1 - error
+/// >0 - Listen socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcOpenMonitor(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcCloseMonitor
+/// for Server API
+///
+/// \param [in] name
+/// PCSTR - Service name
+///
+/// \return int
+/// -1 - error
+/// 0 - success
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcCloseMonitor(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcSetConnectKey
+/// for Common API
+///
+/// \param [out] buf
+/// char * - buffer
+/// \param [in] size
+/// int - buffer size
+/// \param [in] serverName
+/// PCSTR - Server name
+/// \param [in] clientName
+/// PCSTR - Client name
+///
+/// \return int
+/// -1 - error
+/// >0 - Connect socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcSetConnectKey(char *buf, size_t size, PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcConnectMonitor
+/// for Client API
+///
+/// \param [in] serverName
+/// PCSTR - server name
+/// \param [in] clientName
+/// PCSTR - client name
+///
+/// \return int
+/// -1 - error
+/// >0 - Connect socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcConnectMonitor(PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcCloseConnectMonitor
+/// for Client API
+///
+/// \param [in] serverName
+/// PCSTR - server name
+/// \param [in] clientName
+/// PCSTR - client name
+///
+/// \return int
+/// -1 - error
+/// >0 - Connect socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcCloseConnectMonitor(PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcAcceptMonitor
+/// for Server API
+///
+/// \param [in] serverName
+/// PCSTR - server name
+/// \param [in] listenMonitorFd
+/// int - Listen socket FD
+///
+/// \return int
+/// -1 - error
+/// >0 - Accept socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcAcceptMonitor(PCSTR serverName, int listenMonitorFd);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcGetAcceptMonitor
+/// for Server API
+///
+/// \param [in] serverName
+/// PCSTR - server name
+/// \param [in] clientName
+/// PCSTR - client name
+///
+/// \return int
+/// -1 - error
+/// >0 - Accept socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcGetAcceptMonitor(PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcCloseAcceptMonitor
+/// for Server API
+///
+/// \param [in] serverName
+/// PCSTR - server name
+/// \param [in] clientName
+/// PCSTR - client name
+///
+/// \return int
+/// -1 - error
+/// >0 - Accept socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcCloseAcceptMonitor(PCSTR serverName, PCSTR clientName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcGetClientNameFromConnectKey
+/// for Server API
+///
+/// \param [in] connectKey
+/// PCSTR - connect key
+/// \param [out] clientName
+/// PCHAR - client name
+/// \param [out] len
+/// size_t - clientname buffer length
+///
+/// \return int
+/// -1 - error
+/// >0 - Accept socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcGetClientNameFromConnectKey(PCSTR connectKey, PCHAR clientName, size_t len);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// mcGetServerNameFromConnectKey
+/// for Client API
+///
+/// \param [in] connectKey
+/// PCSTR - connect key
+/// \param [out] serverName
+/// PCHAR - client name
+/// \param [out] len
+/// size_t - serverName buffer length
+///
+/// \return int
+/// -1 - error
+/// >0 - Accept socket FD
+////////////////////////////////////////////////////////////////////////////////////////////
+int mcGetServerNameFromConnectKey(PCSTR connectKey, PCHAR serverName, size_t len);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MESSAGE_CENTER_INTERNAL_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..c654ef7
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/src/makefile_PosixBasedOS001
@@ -0,0 +1,214 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_MessageCenter
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_MessageCenter
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_MessageQueue/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_SharedMemIf/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
+ $(wildcard $(TEAM_ROOT)NS_MessageQueue/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NS_SharedMemIf/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+ifdef DYNAMIC
+ DYNAMIC_LIBS += \
+ NS_SharedMemIf$(DEBUG_EXT) \
+ NS_MessageQueue$(DEBUG_EXT)
+else
+ STATIC_LIBS +=
+endif
+
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+module_dirs: build_dirs
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/src/ns_message_center.c b/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/src/ns_message_center.c
new file mode 100755
index 0000000..fe84128
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageCenter/src/ns_message_center.c
@@ -0,0 +1,1269 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageCenter
+/// \brief
+///
+/// APIs to Open\Close and Send\Receive on message queues and shared memory.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_message_center_if.h>
+#include <ns_message_center_internal.h>
+#include "ns_msg_queue.h"
+#include <ns_mq_internal.h>
+#include <ns_mc_internal.h>
+#include <native_service/ns_msgs.h>
+#include <string.h>
+#include <stdarg.h>
+#include <native_service/ns_shared_mem_if.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/timeb.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/resource.h>
+#include <sys/syscall.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <stddef.h>
+#include <sys/epoll.h>
+#include <native_service/ns_transmit_log.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_resource_controler.h>
+#include <native_service/nsfw_message.h>
+#include <limits.h>
+
+#include <other_service/strlcpy.h>
+
+#define assert_static(e) \
+ do { \
+ enum { assert_static__ = 1/(e) }; \
+ } while (0)
+
+#define MC_INVOKE_SYNC_TIMEOUT (60 * 1000)
+
+typedef struct {
+ UI_32 seq_id;
+ EFrameworkunifiedStatus ret_val;
+ UI_32 res_size;
+} ResponseHeader;
+
+static unsigned int mcSeed[4];
+
+HANDLE McOpenReceiverNotBlocked(PCSTR name) {
+ return OpenReceiverNotBlocked(name);
+}
+
+HANDLE McOpenReceiver(PCSTR name) {
+ return OpenReceiver(name);
+}
+
+HANDLE McOpenSyncReceiver(PCSTR name) {
+ return openSyncReceiver(name);
+}
+
+
+HANDLE McOpenSender(PCSTR name) {
+ return OpenSender(name);
+}
+
+HANDLE McOpenSenderNotBlocked(PCSTR name) {
+ return OpenSender(name);
+}
+
+HANDLE McOpenSyncSender(PCSTR name) {
+ return openSyncSender(name);
+}
+
+static int mcSetMonitorName(char *str, PCSTR name) {
+ int len;
+ if (str == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "str is NULL");
+ return -1;
+ }
+ *str = '\0';
+ len = sprintf(str + 1, "monitorS_%s", name != 0 ? name : NULL);
+ return len + 1;
+}
+
+static int OpenMonitor(PCSTR name) {
+ int monitor_sock = -1;
+ int monitor_sa_len;
+ struct sockaddr_un monitor_sa_un;
+
+ if ((monitor_sock = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "socket:%s", strerror(errno));
+ goto error;
+ }
+
+ memset(&monitor_sa_un, 0, sizeof(monitor_sa_un));
+ monitor_sa_un.sun_family = AF_UNIX;
+ monitor_sa_len = mcSetMonitorName(monitor_sa_un.sun_path, name);
+ monitor_sa_len += (int)offsetof(struct sockaddr_un, sun_path);
+
+ if (bind(monitor_sock, (struct sockaddr *)&monitor_sa_un, (socklen_t)monitor_sa_len) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "bind:%s:%s", name, strerror(errno)); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ goto error;
+ }
+
+ if (listen(monitor_sock, SOMAXCONN) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "listen:%s", strerror(errno)); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ goto error;
+ }
+ return monitor_sock;
+
+error:
+ if (monitor_sock >= 0) {
+ close(monitor_sock);
+ }
+ return -1;
+}
+
+int mcOpenMonitor(PCSTR name) {
+ long monitor_sock;
+
+ if (frameworkunifiedAcquireResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, name, &monitor_sock) < 0) {
+ if ((monitor_sock = OpenMonitor(name)) != -1) {
+ if (frameworkunifiedRegistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, name, monitor_sock, 1) < 0) {
+ close(monitor_sock);
+ monitor_sock = -1;
+ }
+ }
+ }
+
+ return (int)monitor_sock;
+}
+
+int mcCloseMonitor(PCSTR name) {
+ long monitor_sock;
+
+ if (frameworkunifiedGetResource(FRAMEWORKUNIFIED_RES_ABNMLMON, name, &monitor_sock) < 0) {
+ return -1;
+ }
+
+ frameworkunifiedUnregistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, name);
+ close((int)monitor_sock);
+
+ return 0;
+}
+
+static int mcSetClientName(char *str, PCSTR serverName, PCSTR clientName) {
+ int len;
+ if (str == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "str is NULL");
+ return -1;
+ }
+ *str = '\0';
+ len = sprintf(str + 1, "monitorC_%s:%s", serverName != 0 ? serverName : NULL, clientName != 0 ? clientName : NULL);
+ return len + 1;
+}
+
+static int ConnectMonitor(PCSTR serverName, PCSTR clientName) {
+ int client_sock = -1;
+ int client_sa_len, monitor_sa_len;
+ struct sockaddr_un client_sa_un, monitor_sa_un;
+
+ if ((client_sock = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) < 0) { // LCOV_EXCL_BR_LINE 5: socket's error case
+ // LCOV_EXCL_START 5:socket's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "socket:%s", strerror(errno));
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ memset(&client_sa_un, 0, sizeof(client_sa_un));
+ client_sa_un.sun_family = AF_UNIX;
+ client_sa_len = mcSetClientName(client_sa_un.sun_path, serverName, clientName);
+ client_sa_len += (int)offsetof(struct sockaddr_un, sun_path);
+
+ if (bind(client_sock, (struct sockaddr *)&client_sa_un, (socklen_t)client_sa_len) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "bind:%s:%s", client_sa_un.sun_path + 1, strerror(errno));
+ goto error;
+ }
+
+ memset(&monitor_sa_un, 0, sizeof(monitor_sa_un));
+ monitor_sa_un.sun_family = AF_UNIX;
+ monitor_sa_len = mcSetMonitorName(monitor_sa_un.sun_path, serverName);
+ monitor_sa_len += (int)offsetof(struct sockaddr_un, sun_path);
+
+ if (connect(client_sock, (struct sockaddr *)&monitor_sa_un, (socklen_t)monitor_sa_len) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "connect:%s", strerror(errno));
+ goto error;
+ }
+ return client_sock;
+
+error:
+ close(client_sock);
+ return -1;
+}
+
+int mcSetConnectKey(char *buf, size_t size, PCSTR serverName, PCSTR clientName) {
+ int len = snprintf(buf, size, "%s:%s", serverName != 0 ? serverName : NULL, clientName != 0 ? clientName : NULL);
+ if (buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "buf is NULL");
+ return -1;
+ }
+ buf[size - 1] = '\0';
+ return len;
+}
+
+int mcConnectMonitor(PCSTR serverName, PCSTR clientName) {
+ long client_sock;
+ char connect_key[32];
+
+ mcSetConnectKey(connect_key, sizeof(connect_key), serverName, clientName);
+
+ if (frameworkunifiedAcquireResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key, &client_sock) < 0) {
+ if ((client_sock = ConnectMonitor(serverName, clientName)) != -1) {
+ if (frameworkunifiedRegistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key, client_sock, 1) < 0) {
+ close(client_sock);
+ client_sock = -1;
+ }
+ }
+ }
+
+ return (int)client_sock;
+}
+
+int mcCloseConnectMonitor(PCSTR serverName, PCSTR clientName) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ long client_sock;
+ char connect_key[32];
+
+ mcSetConnectKey(connect_key, sizeof(connect_key), serverName, clientName);
+
+ if (frameworkunifiedGetResource(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key, &client_sock) == -1) {
+ return -1;
+ }
+
+ if (frameworkunifiedReleaseResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key) == 0) {
+ frameworkunifiedUnregistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key);
+ close((int)client_sock);
+ }
+
+ return 0;
+}
+// LCOV_EXCL_STOP
+static void mcGetClientName(const char *str, char *client_name, size_t size, int pathlen) {
+ size_t len = size - 1;
+ size_t str_len;
+ if (str == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "str is NULL");
+ return;
+ }
+ char *p_div = strchr(str + 1, ':');
+ if (p_div == NULL) {
+ return;
+ }
+ str_len = (size_t)(pathlen - (p_div - str + 1));
+ if (len > str_len) {
+ len = str_len;
+ }
+ if (client_name == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "client_name is NULL");
+ return;
+ }
+ strncpy(client_name, p_div + 1, len);
+ client_name[len] = '\0';
+}
+
+int mcAcceptMonitor(PCSTR serverName, int listenMonitorFd) {
+ int accept_sock = -1;
+ struct sockaddr_un client_sa_un;
+ socklen_t client_sa_len = sizeof(client_sa_un);
+ char client_name[16];
+ char connect_key[32];
+
+ if ((accept_sock = accept4(listenMonitorFd, (struct sockaddr *)&client_sa_un, &client_sa_len, SOCK_CLOEXEC)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "accept:%s", strerror(errno));
+ return -1;
+ }
+
+ mcGetClientName(client_sa_un.sun_path, client_name, sizeof(client_name), (int)(client_sa_len - offsetof(struct sockaddr_un,
+ sun_path)));
+ mcSetConnectKey(connect_key, sizeof(connect_key), serverName, client_name);
+
+ frameworkunifiedRegistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key, accept_sock, 0);
+ return accept_sock;
+}
+
+int mcGetAcceptMonitor(PCSTR serverName, PCSTR clientName) {
+ long accept_sock;
+ char connect_key[32];
+
+ mcSetConnectKey(connect_key, sizeof(connect_key), serverName, clientName);
+
+ if (frameworkunifiedAcquireResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key, &accept_sock) < 0) {
+ return -1;
+ }
+
+ return (int)accept_sock;
+}
+
+int mcGetClientNameFromConnectKey(PCSTR connectKey, PCHAR clientName, size_t len) {
+ char *p_div = strchr(connectKey, ':');
+ if (p_div == NULL) {
+ return -1;
+ }
+
+ strncpy(clientName, p_div + 1, len);
+ clientName[len - 1] = '\0';
+ return 0;
+}
+
+int mcGetServerNameFromConnectKey(PCSTR connectKey, PCHAR serverName, size_t len) {
+ char *p_div = strchr(connectKey, ':');
+ size_t min_len;
+
+ if (p_div == NULL) {
+ return -1;
+ }
+
+ min_len = ((len - 1) < (p_div - connectKey)) ? len - 1 : (size_t)(p_div - connectKey);
+ strncpy(serverName, connectKey, min_len);
+ serverName[min_len] = '\0';
+ return 0;
+}
+
+/////////////////////////////////////////
+HANDLE McOpenSenderChild(PCSTR name, pthread_t childid) {
+ return OpenSenderChild(name, childid);
+}
+
+EFrameworkunifiedStatus McJoinChild(HANDLE hChildApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (INVALID_HANDLE != hChildApp) { // LCOV_EXCL_BR_LINE 6: impossible to confirm because hChildApp checked is passed in the FrameworkunifiedDestroyChildThread function of the frameworkunified_multithreading.cpp
+ eStatus = JoinChild(hChildApp);
+ } else {
+ // LCOV_EXCL_START 6: impossible to confirm because hChildApp checked is passed in the FrameworkunifiedDestroyChildThread function of the frameworkunified_multithreading.cpp
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus McGetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (INVALID_HANDLE != hChildApp) {
+ eStatus = GetChildThreadPriority(hChildApp, threadPrio);
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ return eStatus;
+}
+
+/// endhack...
+/////////////////////////////////////////
+
+static EFrameworkunifiedStatus mcReceiveInternal(HANDLE hMessage, PSTR source, UI_32 *cmd, UI_32 *sessionid, UI_32 length,
+ PVOID data) {
+ PSSystemMsgHeader sysHdr = NULL;
+
+ // check if handle is valid
+ if (hMessage == INVALID_HANDLE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // check if buffer is null
+ if (data == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ // check for invalid length.
+ if (length <= 0) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ // check if the source is null
+ if (source == NULL) {
+ return eFrameworkunifiedStatusInvldQName;
+ }
+
+ if (cmd == NULL) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ if (-1 != ReceiveMessage(hMessage, length, data)) {
+ sysHdr = (PSSystemMsgHeader)data;
+ if (strlen(sysHdr->info.source) < MAX_QUEUE_NAME_SIZE) {
+ *cmd = sysHdr->info.command;
+ if (sessionid) {
+ *sessionid = sysHdr->info.sessionid;
+ }
+ strlcpy(source, sysHdr->info.source, MAX_NAME_SIZE_APP);
+ return eFrameworkunifiedStatusOK;
+ } else {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+ } else {
+ return TranslateError(errno);
+ }
+
+ return eFrameworkunifiedStatusFail;
+}
+
+EFrameworkunifiedStatus McReceive(HANDLE hMessage, PSTR source, UI_32 *cmd, UI_32 length, PVOID data) {
+ return mcReceiveInternal(hMessage, source, cmd, NULL, length, data);
+}
+
+EFrameworkunifiedStatus McReceiveWithSession(HANDLE hMessage, PSTR source, UI_32 *cmd, UI_32 *sessionid, UI_32 length, PVOID data) {
+ if (sessionid == NULL) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return mcReceiveInternal(hMessage, source, cmd, sessionid, length, data);
+}
+
+static EFrameworkunifiedStatus mcSendInternal(HANDLE hMessage, PCSTR source, UI_32 cmd, PCSTR sysInfo, UI_32 length, PCVOID data,
+ EFrameworkunifiedMessagePriorties priority, UI_32 sessionid, BOOL is_sync) {
+ assert_static(_NSFW_MSG_LEN_ == sizeof(SSystemMsgHeader));
+ assert_static(_NSFW_SYSINFO_SIZE_ == MAX_SYS_INFO_SIZE);
+ assert_static(_NSFW_SYSINFO_FLAG_ == MC_EMSGT_SYSINFO_MASK);
+
+ // check if handle is valid
+ if (mqCheckValidHandle(hMessage) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // check if buffer is null
+ if (data == NULL && length > 0) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ // check if the source is null
+ if (source == NULL) {
+ return eFrameworkunifiedStatusInvldQName;
+ }
+
+ // check if the source length exceeds than expected
+ /**
+ * @todo
+ * Although a send message queue handle can be created using a 19-byte message queue name, messages cannot be sent using the created send message queue handle.
+ * Because "/" is added to the queue name in the send message queue handle, a judgment error of MAX_QUEUE_NAME_SIZE (20 bytes) occurs during transmission and transmission cannot be performed.
+ */
+ if (strlen(source) >= MAX_QUEUE_NAME_SIZE) {
+ return eFrameworkunifiedStatusInvldQName;
+ }
+
+ // notification name size should be less than MAX_SYS_INFO_SIZE
+ // data length check
+ UI_32 max_length = 0;
+ if (NULL != sysInfo) {
+ if (strlen(sysInfo) >= MAX_SYS_INFO_SIZE) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ // If there is an sysInfo, the maximum send data length is the maximum send data length of UI_32 minus (header + sysInfo size).
+ max_length = 0xFFFFFFFF - sizeof(SSystemMsgHeader) - sizeof(TSysMsgSystemInfo);
+ } else {
+ // If there is no sysInfo, the maximum send data length is the maximum value of UI_32 minus the headers.
+ max_length = 0xFFFFFFFF - sizeof(SSystemMsgHeader);
+ }
+
+ if (length > max_length) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ EFrameworkunifiedStatus rtnStatus = eFrameworkunifiedStatusOK;
+
+ UI_8 sndBuf[ MAX_QUEUE_MSG_SIZE ];
+ SQhandle *sndHndl = (SQhandle *)hMessage;
+ SSystemMsgHeader *msgHdr = (SSystemMsgHeader *)sndBuf;
+ UI_32 send_length = 0;
+ UI_32 offset = sizeof(SSystemMsgHeader);
+
+ if (NULL == sndHndl->q_name) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // check if the dest length exceeds than expected
+ if (strlen(sndHndl->q_name) >= MAX_QUEUE_NAME_SIZE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // compose header
+ strcpy(msgHdr->info.source, source);
+ msgHdr->info.length = length; // this is length of the messages data...
+ msgHdr->info.command = cmd;
+ msgHdr->info.sessionid = sessionid;
+
+ msgHdr->eType = (UI_32)MC_EMSGT_VALID_TOKEN;
+ msgHdr->memId = 0; // not set...
+ if (NULL != sysInfo) {
+ msgHdr->eType |= MC_EMSGT_SYSINFO_MASK;
+ strcpy((char *)(sndBuf + offset), sysInfo);
+ offset += (UI_32)sizeof(TSysMsgSystemInfo);
+ }
+ if (is_sync) {
+ msgHdr->eType |= MC_EMSGT_SYNC_MASK;
+ }
+
+ // Build buffer to send...
+
+ // copy to buffer
+ /*
+ * @todo
+ * Do not throw an error even if the data size of the argument is set to 0.
+ * When "length + offset" is MAX_QUEUE_MSG_SIZE (4096) or more, the length becomes 0 in the process that is executed cannot be checked.
+ * Sizeof(SSystemMsgHeader) is 40, sizeof(TSysMsgSystemInfo) is 64, maximal. offset is 104, min. is 40
+ */
+ if ((length + offset) >= MAX_QUEUE_MSG_SIZE) {
+ // set the shared mem info in header....
+ msgHdr->eType |= MC_EMSGT_SHM_MASK;
+
+ // send data to shm
+ msgHdr->memId = SetDataToShared(data, length, source, sndHndl->q_name);
+
+ if (BAD_MEM_ID != msgHdr->memId) {
+ // update the send length
+ send_length += offset;
+ } else {
+ rtnStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else { // was less than the max
+ // update the send length
+ send_length += offset;
+
+ /**
+ * @todo
+ * If UINT_MAX (4294967295) is specified in the iLength of FrameworkunifiedNPPublishNotification,
+ * the comparison by (length + offset) >= MAX_QUEUE_MSG_SIZE fails to compare correctly because of an overflow,
+ * and the comparison is judged to be less than the max.
+ * Once in the else block, the data is treated as a sysHeader block of up to 4096 bytes,
+ * and the memcpy is performed again without size checking, resulting in a segmentation fault.
+ * Maximum message length that can be sent by FrameworkunifiedNPPublishNotification must be specified and the maximum message length must be checked.
+ */
+ // copy the msg to send buffer
+ memcpy(&sndBuf[0] + offset, data, length);
+
+ // update the send length
+ send_length += length;
+ }
+
+ if (eFrameworkunifiedStatusOK == rtnStatus) {
+ rtnStatus = SendMessageWithPriority(hMessage, send_length, (PVOID)&sndBuf[0], priority);
+ }
+
+ if (rtnStatus != eFrameworkunifiedStatusOK) {
+ // remove the shared mem since this failed.
+ McClearData(msgHdr);
+ }
+
+ return rtnStatus;
+}
+
+EFrameworkunifiedStatus McSendPrioWithSysInfo(HANDLE hMessage, PCSTR source, UI_32 cmd, PCSTR sysInfo, UI_32 length, PCVOID data,
+ EFrameworkunifiedMessagePriorties priority, UI_32 sessionid) {
+ if (NULL == sysInfo) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return mcSendInternal(hMessage, source, cmd, sysInfo, length, data, priority, sessionid, FALSE);
+}
+
+EFrameworkunifiedStatus McSendWithSysInfo(HANDLE hMessage, PCSTR source, UI_32 cmd, PCSTR sysInfo, UI_32 length, PCVOID data,
+ UI_32 sessionid) {
+ if (NULL == sysInfo) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return mcSendInternal(hMessage, source, cmd, sysInfo, length, data, eFrameworkunifiedMsgPrioNormal, sessionid, FALSE);
+}
+
+EFrameworkunifiedStatus McSend(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data) {
+ return mcSendInternal(hMessage, source, cmd, NULL, length, data, eFrameworkunifiedMsgPrioNormal, 0, FALSE);
+}
+
+EFrameworkunifiedStatus McSendWithPriority(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data,
+ EFrameworkunifiedMessagePriorties priority, UI_32 sessionid) {
+ return mcSendInternal(hMessage, source, cmd, NULL, length, data, priority, sessionid, FALSE);
+}
+
+EFrameworkunifiedStatus McSendWithSession(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data, UI_32 sessionid) {
+ return mcSendInternal(hMessage, source, cmd, NULL, length, data, eFrameworkunifiedMsgPrioNormal, sessionid, FALSE);
+}
+
+EFrameworkunifiedStatus McSendSyncResponse(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 seq_id, EFrameworkunifiedStatus ret_val, UI_32 length,
+ PCVOID data) {
+ EFrameworkunifiedStatus eStatus;
+ ResponseHeader *resHdr;
+ UI_8 *res_data;
+
+ if ((UINT_MAX - sizeof(ResponseHeader)) < length) {
+ return eFrameworkunifiedStatusInvldBufSize;
+ }
+
+ // check if buffer is null
+ if (data == NULL && length > 0) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ if ((res_data = calloc(length + sizeof(ResponseHeader), 1)) == NULL) { // LCOV_EXCL_BR_LINE 5: calloc's error case
+ // LCOV_EXCL_START 5: calloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+
+ resHdr = (ResponseHeader *)res_data;
+ resHdr->seq_id = seq_id;
+ resHdr->ret_val = ret_val;
+ resHdr->res_size = length;
+
+ memcpy(res_data + sizeof(ResponseHeader), data, length);
+
+ eStatus = mcSendInternal(hMessage, source, cmd, NULL, (UI_32)(length + sizeof(ResponseHeader)), res_data, eFrameworkunifiedMsgPrioNormal, 0,
+ TRUE);
+
+exit:
+ free(res_data);
+ res_data = NULL;
+ resHdr = NULL;
+
+ return eStatus;
+}
+
+/*
+ * Xorshift
+ */
+static inline unsigned int xor128(void) {
+ unsigned int t;
+ t = (mcSeed[0] ^ (mcSeed[0] << 11));
+ mcSeed[0] = mcSeed[1];
+ mcSeed[1] = mcSeed[2];
+ mcSeed[2] = mcSeed[3];
+ return (mcSeed[3] = (mcSeed[3] ^ (mcSeed[3] >> 19)) ^ (t ^ (t >> 8)));
+}
+
+static inline char *ultoa(unsigned long value, char *buf, int radix) {
+ const static char c[] = "0123456789abcdef";
+ char b[65];
+ char *p = b + sizeof(b);
+
+ *--p = '\0';
+ do {
+ *--p = c[value % (unsigned long)radix];
+ value /= (unsigned long)radix;
+ } while (value);
+ if (buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "buf is NULL");
+ return NULL;
+ }
+ strcpy(buf, p);
+
+ return buf;
+}
+
+EFrameworkunifiedStatus McInvokeSync(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 msgLength, PCVOID msgData, UI_32 sessionid,
+ HANDLE hRcvMessage, UI_32 responseLength, PVOID responseData, UI_32 *receivedLength) {
+ EFrameworkunifiedStatus eStatus;
+ TSysMsgSystemInfo sysInfo;
+ UI_32 seq_id;
+ ResponseHeader *resHdr;
+ UI_8 *rcv_buf = NULL;
+ CHAR resSource[MAX_NAME_SIZE_APP];
+ int efd = -1;
+ struct epoll_event events[2];
+ struct epoll_event ev;
+ int connect_sock = -1;
+ SQhandle *sndHndl = (SQhandle *)hMessage;
+
+ if (mqCheckValidHandle(hMessage) == FALSE || mqCheckValidHandle(hRcvMessage) == FALSE || (responseLength != 0 &&
+ responseData == NULL)) {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ /**
+ * @todo
+ * The system performs rcv_buf free without NULL determination.
+ */
+ goto exit;
+ }
+
+ if (NULL == receivedLength) {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ }
+ if ((rcv_buf = malloc(MAX_QUEUE_MSG_SIZE)) == NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case.
+ // LCOV_EXCL_START 5: malloc's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+
+ if (mcSeed[0] == 0) {
+ int fd;
+ if ((fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC)) < 0) {
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ }
+
+ if (read(fd, &mcSeed, sizeof(mcSeed)) < 0) {
+ close(fd);
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ }
+ close(fd);
+ }
+ seq_id = xor128();
+
+ sysInfo[0] = '0';
+ sysInfo[1] = 'x';
+ ultoa(seq_id, &sysInfo[2], 16);
+
+ Flush(hRcvMessage);
+
+ eStatus = mcSendInternal(hMessage, source, cmd, sysInfo, msgLength, msgData, eFrameworkunifiedMsgPrioNormal, sessionid, TRUE);
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ goto exit;
+ }
+
+ if ((connect_sock = mcConnectMonitor(sndHndl->q_name + 1, source)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "connect:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ }
+
+ if ((efd = epoll_create1(EPOLL_CLOEXEC)) < 0) { // LCOV_EXCL_BR_LINE 5: epoll_create1's error case.
+ // LCOV_EXCL_START 5: epoll_create1's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_create1:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+ ev.events = EPOLLIN;
+ ev.data.fd = McGetQueueFD(hRcvMessage);
+ if (epoll_ctl(efd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0) { // LCOV_EXCL_BR_LINE 5: epoll_ctl's error case.
+ // LCOV_EXCL_START 5: epoll_ctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+ ev.events = EPOLLRDHUP;
+ ev.data.fd = connect_sock;
+ if (epoll_ctl(efd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0) { // LCOV_EXCL_BR_LINE 5: epoll_ctl's error case.
+ // LCOV_EXCL_START 5: epoll_ctl's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+
+ while (1) {
+ int nfds, n;
+
+ nfds = epoll_wait(efd, events, 2, MC_INVOKE_SYNC_TIMEOUT);
+ if (nfds == -1) { // LCOV_EXCL_BR_LINE 5: epoll_wait's error case.
+ // LCOV_EXCL_START 5: epoll_wait's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == EINTR) {
+ continue;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_wait:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ // LCOV_EXCL_STOP
+ } else if (nfds == 0) { // LCOV_EXCL_BR_LINE 5: epoll_wait return value equal 0.
+ // LCOV_EXCL_START 5: epoll_wait return value equal 0.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_wait:time out");
+ eStatus = eFrameworkunifiedStatusAccessError;
+ goto exit;
+ // LCOV_EXCL_STOP
+ }
+
+ for (n = 0; n < nfds; n++) {
+ if (events[n].data.fd == connect_sock) {
+ /*
+ * connection fail
+ */
+ char connect_key[32];
+ mcSetConnectKey(connect_key, sizeof(connect_key), sndHndl->q_name + 1, source);
+
+ if (epoll_ctl(efd, EPOLL_CTL_DEL, connect_sock, events) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ }
+ if (close(connect_sock) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "close:%s", strerror(errno));
+ }
+ frameworkunifiedUnregistResouce(FRAMEWORKUNIFIED_RES_ABNMLMON, connect_key);
+
+ if ((connect_sock = mcConnectMonitor(sndHndl->q_name + 1, source)) < 0) {
+ eStatus = eFrameworkunifiedStatusBadConnection;
+ goto exit;
+ }
+ ev.events = EPOLLRDHUP;
+ ev.data.fd = connect_sock;
+ if (epoll_ctl(efd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "epoll_ctl:%s", strerror(errno));
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ }
+ } else {
+ /*
+ * response receive
+ */
+ if ((eStatus = McReceive(hRcvMessage, resSource, &cmd, MAX_QUEUE_MSG_SIZE, rcv_buf)) != eFrameworkunifiedStatusOK) {
+ goto exit;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)rcv_buf;
+ if (MC_EMSGT_IS_SHM(sysHdr->eType)) {
+ UI_32 shmLength = GetLengthOfDataFromShared(sysHdr->memId);
+ TMemID memId = sysHdr->memId;
+
+ if (shmLength == 0) {
+ eStatus = eFrameworkunifiedStatusErrOther;
+ goto exit;
+ }
+
+ free(rcv_buf);
+ if ((rcv_buf = calloc(shmLength, 1)) == NULL) {
+ eStatus = eFrameworkunifiedStatusFail;
+ goto exit;
+ }
+
+ if ((eStatus = GetDataFromShared(memId, rcv_buf, shmLength)) != eFrameworkunifiedStatusOK) {
+ eStatus = eFrameworkunifiedStatusErrOther;
+ goto exit;
+ }
+
+ DiscardDataFromShared(memId);
+ resHdr = (ResponseHeader *)rcv_buf;
+ } else {
+ resHdr = (ResponseHeader *)(rcv_buf + sizeof(SSystemMsgHeader));
+ }
+
+ if (resHdr->seq_id == seq_id) {
+ if (resHdr->res_size > 0 && responseLength > 0)
+ memcpy(responseData, (const void *)((char *)resHdr + sizeof(ResponseHeader)),
+ resHdr->res_size > responseLength ? responseLength : resHdr->res_size);
+
+ *receivedLength = resHdr->res_size;
+ eStatus = resHdr->ret_val;
+ goto exit; // success
+ }
+ }
+ }
+ }
+
+exit:
+ free(rcv_buf);
+ rcv_buf = NULL;
+ resHdr = NULL;
+
+ if (efd >= 0) {
+ close(efd);
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus McCreateInvokerName(PCSTR source, UI_32 sessionid, PSTR invokerName, UI_32 size) {
+ if (source == NULL || invokerName == NULL) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ // When the size of the synchronous communication message queue name storage area is 0.
+ if (0 == size) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ snprintf(invokerName, size - 1, "%s_r0", source);
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus McForward(HANDLE hMessage, PCSTR source, UI_32 iCmd, TMemID USID) {
+ // check if handle is valid
+ if (mqCheckValidHandle(hMessage) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // check if the source is null
+ if (source == NULL) {
+ return eFrameworkunifiedStatusInvldQName;
+ }
+
+ // check the shared memory id
+ if (USID == BAD_MEM_ID) {
+ return eFrameworkunifiedStatusErrOther;
+ }
+
+ // check if the source length exceeds than expected
+ if (strlen(source) >= MAX_QUEUE_NAME_SIZE) {
+ return eFrameworkunifiedStatusInvldQName;
+ }
+
+ UI_8 sndBuf[ MAX_QUEUE_MSG_SIZE ] = {};
+ SQhandle *sndHndl = (SQhandle *)hMessage;
+ SSystemMsgHeader msgHdr = {};
+
+ // check if the dest length exceeds than expected
+ if (strlen(sndHndl->q_name) >= MAX_QUEUE_NAME_SIZE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // compose header
+ strlcpy(msgHdr.info.source, source, sizeof(msgHdr.info.source));
+ msgHdr.info.length = GetLengthOfDataFromShared(USID); // this is length of the messages data...
+ msgHdr.info.command = iCmd;
+ msgHdr.eType = (UI_32)(MC_EMSGT_VALID_TOKEN | MC_EMSGT_SHM_MASK);
+ msgHdr.memId = USID;
+ msgHdr.info.sessionid = 0;
+
+ // copy to buffer
+ UI_8 offset = sizeof(SSystemMsgHeader);
+ // write header to send buffer
+ memcpy(&sndBuf[0], &msgHdr, offset);
+
+ return SendMessage(hMessage, MAX_QUEUE_MSG_SIZE, (PVOID)&sndBuf[0]);
+}
+
+PCSTR McGetMsgSrc(PVOID data) {
+ // check if buffer is null
+ if (data == NULL) {
+ return NULL; // The data is invalid return zero length.
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ return (PCSTR)sysHdr->info.source;
+}
+
+UI_32 mcGetMsgSsessionId(PVOID data) {
+ // check if buffer is null
+ if (data == NULL) {
+ return 0; // The data is invalid return zero.
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ return sysHdr->info.sessionid;
+}
+
+UI_32 McGetLength(PVOID data) {
+ // check if buffer is null
+ if (data == NULL) {
+ return 0; // The data is invalid return zero length.
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ return sysHdr->info.length;
+}
+
+PVOID McGetDataPointer(PVOID data) {
+ if (data == NULL) {
+ return NULL;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ int offset = sizeof(SSystemMsgHeader);
+
+ if (MC_EMSGT_HAS_SYSINFO(sysHdr->eType)) {
+ offset += (int)sizeof(TSysMsgSystemInfo);
+ }
+
+ return (PVOID)((long)data + offset);
+}
+
+EFrameworkunifiedStatus McGetSysInfoData(PVOID data, PVOID to) {
+ // check if buffers are null
+ if (data == NULL || to == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ if (MC_EMSGT_VALID((int)sysHdr->eType)) {
+ if (MC_EMSGT_HAS_SYSINFO(sysHdr->eType)) {
+ strlcpy(to, (char *)data + sizeof(SSystemMsgHeader), MAX_SYS_INFO_SIZE);
+ } else {
+ *(char *)to = '\0';
+ }
+ return eFrameworkunifiedStatusOK;
+ }
+
+ return eFrameworkunifiedStatusInvldHandle;
+}
+
+EFrameworkunifiedStatus McGetDataOfSize(PVOID data, PVOID to, UI_32 uiSize) {
+ if (McGetLength(data) > uiSize) {
+ return eFrameworkunifiedStatusInvldBufSize;
+ }
+ return GetData(data, to, FALSE);
+}
+
+EFrameworkunifiedStatus McGetDataOfSizeWithSMRetain(PVOID data, PVOID to, UI_32 uiSize) {
+ if (McGetLength(data) > uiSize) {
+ return eFrameworkunifiedStatusInvldBufSize;
+ }
+ return GetData(data, to, TRUE);
+}
+
+BOOL mcGetIsTypeOfSync(PVOID data) {
+ if (data == NULL) {
+ return FALSE;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+
+ if (MC_EMSGT_VALID((int)sysHdr->eType)) {
+ if (MC_EMSGT_IS_SYNC(sysHdr->eType)) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+EFrameworkunifiedStatus McClearData(PVOID data) {
+ // check if buffers are null
+ if (data == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+
+ if (MC_EMSGT_VALID((int)sysHdr->eType)) {
+ if (MC_EMSGT_IS_SHM(sysHdr->eType)) {
+ return DiscardDataFromShared(sysHdr->memId);
+ } else {
+ return eFrameworkunifiedStatusOK;
+ }
+ }
+
+ return eFrameworkunifiedStatusInvldParam;
+}
+
+EFrameworkunifiedStatus McClose(HANDLE hMessage) {
+ EFrameworkunifiedStatus rtnStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != hMessage) {
+ EQType qType = GetQueueType(hMessage);
+
+ if (eQTypeSender == qType) {
+ rtnStatus = CloseSender(hMessage);
+ } else if (eQTypeReveiver == qType) {
+ rtnStatus = CloseReceiver(hMessage);
+ }
+ }
+
+ return rtnStatus;
+}
+
+
+void McFlushReceiver(HANDLE hMessage) {
+ if (hMessage != INVALID_HANDLE) {
+ // proxy to the real function in msg queue
+ Flush(hMessage);
+ }
+}
+
+TMemID McGetDataUSID(PVOID pData) {
+ // check if buffer is null
+ if (pData == NULL) {
+ return BAD_MEM_ID;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)pData;
+
+ if (MC_EMSGT_VALID((int)sysHdr->eType)) {
+ if (MC_EMSGT_IS_SHM(sysHdr->eType)) {
+ return sysHdr->memId;
+ } else {
+ return BAD_MEM_ID;
+ }
+ }
+
+ return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetData
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetData(PVOID data, PVOID to, BOOL retain) {
+ EFrameworkunifiedStatus rtnStatus = eFrameworkunifiedStatusInvldHandle;
+
+ // check if buffers are null
+ if (data == NULL || to == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ PSSystemMsgHeader sysHdr = (PSSystemMsgHeader)data;
+ int offset = sizeof(SSystemMsgHeader);
+
+ if (MC_EMSGT_VALID((int)sysHdr->eType)) {
+ if (MC_EMSGT_HAS_SYSINFO(sysHdr->eType)) {
+ offset += (int)sizeof(TSysMsgSystemInfo);
+ }
+
+ if (MC_EMSGT_IS_SHM(sysHdr->eType)) {
+ // need to get the message from shared memory
+
+ // get the length based on the memId
+ UI_32 shmLength = GetLengthOfDataFromShared(sysHdr->memId);
+ /*
+ * todo
+ * When a eFrameworkunifiedStatusInvldID error occurs in GetDataFromShared, the abnormal values are also returned in eFrameworkunifiedStatusErrOther.
+ */
+ if (0 != shmLength && eFrameworkunifiedStatusOK == GetDataFromShared(sysHdr->memId, to, shmLength)) {
+ if (!retain) {
+ // now that the data has been retrieved we may now discard it.
+ McClearData(data);
+ }
+ rtnStatus = eFrameworkunifiedStatusOK;
+ } else {
+ rtnStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ // memcpy the data to the buffer provided.
+ memcpy(to, (PVOID)((long)data + offset), sysHdr->info.length);
+ rtnStatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ rtnStatus = eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ return rtnStatus;
+}
+
+PCSTR McGetQueueName(HANDLE hMessage) {
+ PCSTR name = NULL;
+
+ if (NULL != hMessage) {
+ name = GetQueueName(hMessage);
+ }
+
+ return name;
+}
+
+int McGetQueueFD(HANDLE hMessage) {
+ int fd = -1;
+
+ if (NULL != hMessage) {
+ fd = GetQueueFD(hMessage);
+ }
+
+ return fd;
+}
+
+EFrameworkunifiedStatus McTranslateError(int error) {
+ return TranslateError(error);
+}
+
+EFrameworkunifiedStatus McZcSetParam(HANDLE handle, UI_32 cmd, UI_32 length) {
+ if (handle == NULL) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ SQhandle *sndHndl = (SQhandle *)handle;
+ SSystemMsgHeader *msgHdr = (SSystemMsgHeader *)(sndHndl->sendbuf);
+
+ // QueueType checking
+ EQType qType = GetQueueType(handle);
+ if (eQTypeSender != qType) {
+ return eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ if (mqCheckValidHandle(handle) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+ if (sndHndl->sendbuf == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+ if (length > (MAX_QUEUE_MSG_SIZE - sizeof(SSystemMsgHeader))) {
+ return eFrameworkunifiedStatusInvldBufSize;
+ }
+
+ msgHdr->info.command = cmd;
+ msgHdr->info.length = length;
+ return eFrameworkunifiedStatusOK;
+}
+
+PVOID McZcGetBuf(HANDLE handle) {
+ if (handle == NULL) {
+ return NULL;
+ }
+
+ SQhandle *sndHndl = (SQhandle *)handle;
+
+ // QueueType checking
+ EQType qType = GetQueueType(handle);
+ if (eQTypeSender != qType) {
+ return NULL;
+ }
+
+ if (mqCheckValidHandle(handle) == FALSE) {
+ return NULL;
+ }
+ if (sndHndl->sendbuf == NULL) {
+ return NULL;
+ }
+ return (char *)(sndHndl->sendbuf) + sizeof(SSystemMsgHeader);
+}
+
+EFrameworkunifiedStatus McZcSend(HANDLE hMessage) {
+ if (hMessage == NULL) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ // QueueType checking
+ EQType qType = GetQueueType(hMessage);
+ if (eQTypeSender != qType) {
+ return eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ SQhandle *sndHndl = (SQhandle *)hMessage;
+
+ SSystemMsgHeader *msgHdr = (SSystemMsgHeader *)(sndHndl->sendbuf);
+
+ if (mqCheckValidHandle(hMessage) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+ if (sndHndl->sendbuf == NULL) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ return SendMessageWithPriority(hMessage, (UI_32)(msgHdr->info.length + sizeof(SSystemMsgHeader)), sndHndl->sendbuf,
+ eFrameworkunifiedMsgPrioNormal);
+}
+
+HANDLE McZcOpenSender(PCSTR source) {
+ HANDLE handle = openSenderZc(source);
+
+ if (handle != NULL) {
+ SQhandle *sndHndl = (SQhandle *)handle;
+ SSystemMsgHeader *msgHdr = (SSystemMsgHeader *)(sndHndl->sendbuf);
+
+ strlcpy(msgHdr->info.source, source, sizeof(msgHdr->info.source));
+ msgHdr->info.command = 0;
+ msgHdr->info.length = 0;
+ msgHdr->info.sessionid = 0;
+ msgHdr->eType = (UI_32)MC_EMSGT_VALID_TOKEN;
+ msgHdr->memId = 0;
+ }
+
+ return handle;
+}
+
+EFrameworkunifiedStatus McZcClose(HANDLE handle) {
+ return CloseSender(handle);
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_anomaly.h b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_anomaly.h
new file mode 100755
index 0000000..5b02e2b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_anomaly.h
@@ -0,0 +1,35 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_ANOMALY_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_ANOMALY_H_
+
+#include <native_service/frameworkunified_types.h>
+
+typedef struct {
+ CHAR name[18];
+ UI_32 maxMsg;
+} mq_anomaly_t;
+
+mq_anomaly_t mq_anomaly_list[] = {
+ { "/NS_NPPService", 256 },
+ { "/NS_NPPWriteWkr", 256 },
+ { "/NS_NPPReadWkr", 256 },
+ { "/NS_NPPIPWkr", 256 },
+ { "/audio_app", 256 },
+};
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_ANOMALY_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_internal.h
new file mode 100755
index 0000000..ca02218
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_mq_internal.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageQueue
+/// \brief API Header for Logger.
+///
+/// Declares the external APIs to Logger.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_INTERNAL_H_
+
+/////////////////////////////////////////
+#include <pthread.h>
+/////////////////////////////////////////
+
+
+/// \brief Struct that defines internal handle object
+typedef struct tQHandle {
+ UI_32 check_code;
+ SI_32 fd;
+ PSTR q_name;
+ EQType q_type;
+ void *sendbuf;
+
+ /////////////////////////////////////////
+ pthread_t threadid; // thread id of child thread (may be NULL)
+ /////////////////////////////////////////
+} SQhandle;
+
+#define MQ_CHECK_CODE (0xC0D1F1ED)
+
+static inline BOOL mqCheckValidHandle(HANDLE hMessage) {
+ if (INVALID_HANDLE != hMessage) {
+ SQhandle *sndHndl = (SQhandle *)hMessage; // NOLINT (readability/nolint)
+ if (sndHndl->check_code == MQ_CHECK_CODE) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MQ_INTERNAL_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_msg_queue.h b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_msg_queue.h
new file mode 100755
index 0000000..111b5be
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/include/ns_msg_queue.h
@@ -0,0 +1,295 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_msg_queue.h
+ * @brief \~english TestFramework provides interface for implementing functional test classes.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MSG_QUEUE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MSG_QUEUE_H_
+
+#include <native_service/frameworkunified_types.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// \brief Enum that defines the value Q Types
+typedef enum eQType {
+ eQTypeReveiver,
+ eQTypeSender,
+ eQTypeInvld
+} EQType;
+
+// PASA CCR IPC Framework API
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// OpenReceiver
+/// The opens a handle to a Receiver message queue.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+///
+/// \return HANDLE
+/// handle - to a recevier's message queue
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE OpenReceiver(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// OpenReceiverNotBlocked
+/// The opens a handle to a Receiver message queue. Operations on this queue
+/// are non-blocking if queue is empty or full.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+///
+/// \return HANDLE
+/// handle - to a recevier's message queue
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE OpenReceiverNotBlocked(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// OpenSyncReceiver
+/// The opens a handle to a response Receiver message queue.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+///
+/// \return HANDLE
+/// handle - to a recevier's message queue
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE openSyncReceiver(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// OpenSender
+/// The opens a handle for sending messages to another message queue.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to send messages too
+///
+/// \return HANDLE
+/// handle - senders message queue handle
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE OpenSender(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// openSyncSender
+/// The opens a handle for sending response to another message queue.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to send messages too
+///
+/// \return HANDLE
+/// handle - senders message queue handle
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE openSyncSender(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// openSenderZc
+/// The opens a handle for sending response to another message queue.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to send messages too
+///
+/// \return HANDLE
+/// handle - senders message queue handle
+/// INVALID_HANDLE - Either message name is NULL or length is >= MAX_QUEUE_NAME_SIZE
+/// INVALID_HANDLE - or an error occurred while opening a queue
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE openSenderZc(PCSTR name);
+
+/////////////////////////////////////////
+#include <pthread.h>
+HANDLE OpenSenderChild(PCSTR name, pthread_t threadid);
+/////////////////////////////////////////
+
+/////////////////////////////////////////
+EFrameworkunifiedStatus JoinChild(HANDLE hChildApp);
+/////////////////////////////////////////
+
+/////////////////////////////////////////
+EFrameworkunifiedStatus GetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio);
+/////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendMessage
+/// The function sends a message to a queue.
+///
+/// \param [in] hMessage
+/// Handle - handle to the sendMessage, OpenSender
+/// \param [in] length
+/// UI_32 - length of the data to be sent
+/// \param [in] data
+/// const void* - pointer to the data that needs to be transmitted
+///
+/// \return EFrameworkunifiedaStatus
+/// status - status of the message(error)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendMessage(HANDLE hMessage, UI_32 length, PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendMessageWithPriority
+/// The function sends a message to a queue.
+///
+/// \param [in] hMessage
+/// Handle - handle to the sendMessage, OpenSender
+/// \param [in] length
+/// UI_32 - length of the data to be sent
+/// \param [in] data
+/// const void* - pointer to the data that needs to be transmitted
+/// \param [in] priority
+/// EFrameworkunifiedMessagePriorties - priority at which the message should be sent at!
+///
+/// \return EFrameworkunifiedaStatus
+/// status - status of the message(error)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendMessageWithPriority(HANDLE hMessage, UI_32 length, PVOID data, EFrameworkunifiedMessagePriorties priority);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ReceiveMessage
+/// The function blocks on a message queue waiting for data to be received.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the recvMessage, OpenReceiver
+/// \param [in] length
+/// UI_32 - length of the data buffer provided
+/// \param [in] data
+/// void* - pointer to the data to be received
+///
+/// \return SI_32
+/// length read - indicates the number of bytes that were read from the queue (eFrameworkunifiedStatusErrOther) error
+////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 ReceiveMessage(HANDLE hMessage, UI_32 length, PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CloseReceiver
+/// The closes a connection to a Receiver message queue.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the recvMessage that will be closed
+///
+/// \return EFrameworkunifiedaStatus
+/// status - indicates if the close was successfully (eFrameworkunifiedStatusOK) or not (anything else)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CloseReceiver(HANDLE handle);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CloseReceiver
+/// The closes a connection to a Receiver message queue.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the recvMessage that will be closed
+///
+/// \return EFrameworkunifiedaStatus
+/// status - indicates if the close was successfully (eFrameworkunifiedStatusOK) or not (anything else)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CloseSender(HANDLE handle);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Flush
+/// Flush all data on HANDLE's Receiver message queue.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the recvMessage queue that will be flushed
+///
+/// \return void
+////////////////////////////////////////////////////////////////////////////////////////////
+void Flush(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetQueueType
+/// Get the handle's queue type.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the Message queue
+///
+/// \return EQType
+/// EQType - queue type of handle
+////////////////////////////////////////////////////////////////////////////////////////////
+EQType GetQueueType(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Function : TranslateError
+// Translates global error variables into FW EFrameworkunifiedStatus
+///
+/// \param [in] error
+/// int - error variable
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - frameworkunified error type
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus TranslateError(int error);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetQueueName
+/// This gets the name of the message queue
+///
+/// \param [in] hMessage
+/// HANDLE - handle of the message queue
+/// (handle created with McOpenReceiver or McOpenSender)
+///
+/// \return PCSTR
+/// name - name of the message queue if handle is valid else NULL
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR GetQueueName(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetQueueFD
+/// This gets the fd of the message queue
+///
+/// \param [in] hMessage
+/// HANDLE - handle of the message queue
+/// (handle created with McOpenReceiver or McOpenSender)
+///
+/// \return int
+/// fd - fd of the message queue if handle is valid else -1
+////////////////////////////////////////////////////////////////////////////////////////////
+int GetQueueFD(HANDLE hMessage);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGEQUEUE_INCLUDE_NS_MSG_QUEUE_H_
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..054db6d
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/makefile_PosixBasedOS001
@@ -0,0 +1,207 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_MessageQueue
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_MessageQueue
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+# mqS is not available for x86
+ifneq ($(TARGET),x86)
+ # Link mqS only to PastModel003*1!
+ ifeq ($(PRODUCT_NAME),PastModel004)
+ STATIC_LIBS += mqS
+ LD_OFLAG := -Wl,-Bsymbolic $(LD_OFLAG)
+ endif
+endif
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/ns_mq_string.c b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/ns_mq_string.c
new file mode 100755
index 0000000..8749a99
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/ns_mq_string.c
@@ -0,0 +1,60 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <native_service/ns_logger_if.h>
+
+size_t strlcpy(char *dst, const char *src, size_t siz) {
+ if (dst == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "dst is NULL");
+ return 0;
+ }
+ if (src == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "src is NULL");
+ return 0;
+ }
+ size_t ret = strlen(src);
+
+ if (siz) {
+ size_t len = (ret >= siz) ? siz - 1 : ret;
+ memcpy(dst, src, len);
+ dst[len] = '\0';
+ }
+ return ret;
+}
+
+size_t strlcat(char *dst, const char *src, size_t siz) {
+ if (dst == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "dst is NULL");
+ return 0;
+ }
+ if (src == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "src is NULL");
+ return 0;
+ }
+ size_t dsiz = strlen(dst);
+ size_t len = strlen(src);
+ size_t res = dsiz + len;
+
+ dst += dsiz;
+ siz -= dsiz;
+ if (len >= siz) {
+ len = siz - 1;
+ }
+ memcpy(dst, src, len);
+ dst[len] = '\0';
+ return res;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/ns_msg_queue.c b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/ns_msg_queue.c
new file mode 100755
index 0000000..1990061
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_MessageQueue/src/ns_msg_queue.c
@@ -0,0 +1,596 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageQueue
+/// \brief API Header for Zone Player Service APIs to be used by senders and
+/// receivers.
+///
+/// APIs to register/unregister notifications and add/remove recievers to the notifications.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include "ns_msg_queue.h"
+#include <malloc.h>
+#include <mqueue.h>
+#include <ns_mq_internal.h>
+#include <errno.h>
+#include "ns_mq_anomaly.h"
+
+#include <other_service/strlcpy.h>
+#include <other_service/strlcat.h>
+
+const UI_32 DEFAULT_MSG_PRIORITY = 10;
+const UI_32 MAX_MESSAGES_STORED_IN_QUEUE = 256;
+const UI_32 MAX_SYNC_RESPONSE_STORED_IN_QUEUE = 2;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : TranslateError
+// Translates global error variables into FW EFrameworkunifiedStatus
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus TranslateError(int error) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ switch (error) {
+ case EOK:
+ eStatus = eFrameworkunifiedStatusOK;
+ break;
+ case EBUSY:
+ eStatus = eFrameworkunifiedStatusThreadBusy;
+ break;
+ case EDEADLK:
+ eStatus = eFrameworkunifiedStatusThreadSelfJoin;
+ break;
+ case EFAULT:
+ eStatus = eFrameworkunifiedStatusFault;
+ break;
+ case EINVAL:
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ case ESRCH:
+ eStatus = eFrameworkunifiedStatusThreadNotExist;
+ break;
+ case EBADF:
+ eStatus = eFrameworkunifiedStatusErrNoEBADF;
+ break;
+ case EAGAIN:
+ eStatus = eFrameworkunifiedStatusErrNoEAGAIN;
+ break;
+ case EINTR:
+ eStatus = eFrameworkunifiedStatusErrNoEINTR;
+ break;
+ case EMSGSIZE:
+ eStatus = eFrameworkunifiedStatusInvldBufSize;
+ break;
+ case ENOTSUP:
+ eStatus = eFrameworkunifiedStatusNotImplemented;
+ break;
+ case EPERM:
+ eStatus = eFrameworkunifiedStatusAccessError;
+ break;
+ default:
+ eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+
+ return eStatus;
+}
+
+static UI_8 GetNormalizedMqName(PSTR normalized_mqname , PCSTR name, size_t size) {
+ if ((NULL != name) && (NULL != normalized_mqname)) {
+ if (name[0] != '/') {
+ strlcpy(normalized_mqname, "/", size);
+ strlcat(normalized_mqname, name, size);
+ } else {
+ strlcpy(normalized_mqname, name, size);
+ }
+
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+HANDLE OpenReceiverNotBlocked(PCSTR name) {
+ HANDLE rtnHandle = INVALID_HANDLE; // invalid until made valid.
+ PSTR normalized_qname = NULL;
+ SI_32 q_fd = -1; // fd to mqueue
+ SQhandle *rcvHndl = NULL;
+ struct mq_attr mqattr;
+ size_t norm_qname_size = 0;
+
+ // Check for invalid name
+ if (name == NULL) {
+ return INVALID_HANDLE;
+ }
+
+ if (strlen(name) >= MAX_QUEUE_NAME_SIZE) {
+ return INVALID_HANDLE;
+ }
+
+ norm_qname_size = strlen(name) + 2;
+ normalized_qname = (PSTR)malloc(norm_qname_size);
+
+ if (0 != GetNormalizedMqName(normalized_qname, name, norm_qname_size)) {
+ if (strlen(normalized_qname) > LIMIT_QUEUE_NAME_SIZE) {
+ free(normalized_qname);
+ return INVALID_HANDLE;
+ }
+
+ mqattr.mq_flags = 0;
+ mqattr.mq_maxmsg = (__syscall_slong_t)MAX_MESSAGES_STORED_IN_QUEUE;
+ mqattr.mq_msgsize = MAX_QUEUE_MSG_SIZE;
+
+ q_fd = mq_open(normalized_qname, O_RDONLY | O_CREAT | O_NONBLOCK | O_CLOEXEC , 0666, &mqattr);
+
+ if (q_fd != -1) {
+ rcvHndl = (SQhandle *)malloc(sizeof(SQhandle));
+ if (rcvHndl != NULL) {
+ rcvHndl->check_code = MQ_CHECK_CODE;
+ rcvHndl->fd = q_fd;
+ rcvHndl->q_name = normalized_qname;
+ rcvHndl->q_type = eQTypeReveiver;
+
+ /////////////////////////////////////////
+ rcvHndl->threadid = 0;
+ /////////////////////////////////////////
+
+ // Set the return handle to rcvHndl
+ rtnHandle = rcvHndl;
+ }
+ }
+ }
+
+ if (INVALID_HANDLE == rtnHandle) {
+ // couldn't connect the queue,
+ // release the memory to normalized queue name
+ if (normalized_qname != NULL) {
+ free(normalized_qname);
+ normalized_qname = NULL; // mb20110108 item 11
+ }
+ }
+
+ return rtnHandle;
+}
+
+static HANDLE openReceiverInternal(PCSTR name, UI_32 mq_maxmsg, UI_32 mq_msgsize, BOOL is_internal) {
+ HANDLE rtnHandle = INVALID_HANDLE; // invalid until made valid.
+ PSTR normalized_qname = NULL;
+ SI_32 q_fd = -1; // fd to mqueue
+ SQhandle *rcvHndl = NULL;
+ struct mq_attr mqattr;
+ size_t norm_qname_size = 0;
+
+ // Check for invalid name
+ if (name == NULL) {
+ return INVALID_HANDLE;
+ }
+
+ if (strlen(name) >= MAX_QUEUE_NAME_SIZE) {
+ return INVALID_HANDLE;
+ }
+
+ norm_qname_size = strlen(name) + 2;
+ normalized_qname = (PSTR)malloc(norm_qname_size);
+
+ if (0 != GetNormalizedMqName(normalized_qname, name, norm_qname_size)) {
+ int i;
+
+ if (!is_internal && strlen(normalized_qname) > LIMIT_QUEUE_NAME_SIZE) {
+ free(normalized_qname);
+ return INVALID_HANDLE;
+ }
+
+ mqattr.mq_flags = 0;
+ mqattr.mq_maxmsg = (__syscall_slong_t)mq_maxmsg;
+ mqattr.mq_msgsize = (__syscall_slong_t)mq_msgsize;
+
+ for (i = 0; i < (sizeof(mq_anomaly_list) / sizeof(mq_anomaly_list[0])); i++) {
+ if (strcmp(normalized_qname, mq_anomaly_list[i].name) == 0) {
+ mqattr.mq_maxmsg = (__syscall_slong_t)mq_anomaly_list[i].maxMsg;
+ break;
+ }
+ }
+
+
+ q_fd = mq_open(normalized_qname, O_RDONLY | O_CREAT | O_CLOEXEC, 0666, &mqattr);
+
+ if (q_fd != -1) {
+ rcvHndl = (SQhandle *)malloc(sizeof(SQhandle));
+ if (rcvHndl != NULL) {
+ rcvHndl->check_code = MQ_CHECK_CODE;
+ rcvHndl->fd = q_fd;
+ rcvHndl->q_name = normalized_qname;
+ rcvHndl->q_type = eQTypeReveiver;
+
+ /////////////////////////////////////////
+ rcvHndl->threadid = 0;
+ /////////////////////////////////////////
+
+ // Set the return handle to rcvHndl
+ rtnHandle = rcvHndl;
+ }
+
+ }
+ }
+
+ if (INVALID_HANDLE == rtnHandle) {
+ // couldn't connect the queue,
+ // release the memory to normalized queue name
+ if (normalized_qname != NULL) {
+ free(normalized_qname);
+ normalized_qname = NULL; // mb20110108 item 11
+ }
+ }
+
+ return rtnHandle;
+}
+
+HANDLE OpenReceiver(PCSTR name) {
+ return openReceiverInternal(name, MAX_MESSAGES_STORED_IN_QUEUE, MAX_QUEUE_MSG_SIZE, FALSE);
+}
+
+HANDLE openSyncReceiver(PCSTR name) {
+ return openReceiverInternal(name, MAX_SYNC_RESPONSE_STORED_IN_QUEUE , MAX_QUEUE_MSG_SIZE, TRUE);
+}
+
+static HANDLE openSenderInternal(PCSTR name, UI_32 mq_maxmsg, UI_32 mq_msgsize, BOOL is_internal, BOOL zero_copy) {
+ HANDLE rtnHandle = INVALID_HANDLE; // invalid until made valid.
+ SI_32 q_fd = -1; // fd to queue
+ SQhandle *sndHndl = NULL;
+ PSTR normalized_qname = NULL;
+ size_t norm_qname_size = 0;
+
+ struct mq_attr mqattr;
+
+ // Check for invalid name
+ if (name == NULL) {
+ return rtnHandle;
+ }
+
+ if (strlen(name) >= MAX_QUEUE_NAME_SIZE) {
+ return rtnHandle;
+ }
+
+ norm_qname_size = strlen(name) + 2;
+ normalized_qname = (PSTR)malloc(norm_qname_size);
+
+ if (NULL == normalized_qname) {
+ return rtnHandle;
+ }
+
+ if (0 != GetNormalizedMqName(normalized_qname, name, norm_qname_size)) {
+ int i;
+
+
+ if (!is_internal && strlen(normalized_qname) > LIMIT_QUEUE_NAME_SIZE) {
+ free(normalized_qname);
+ return INVALID_HANDLE;
+ }
+
+ mqattr.mq_flags = 0;
+ mqattr.mq_maxmsg = (__syscall_slong_t)mq_maxmsg;
+ mqattr.mq_msgsize = (__syscall_slong_t)mq_msgsize;
+
+ for (i = 0; i < (sizeof(mq_anomaly_list) / sizeof(mq_anomaly_list[0])); i++) {
+ if (strcmp(normalized_qname, mq_anomaly_list[i].name) == 0) {
+ mqattr.mq_maxmsg = (__syscall_slong_t)mq_anomaly_list[i].maxMsg;
+ break;
+ }
+ }
+
+ q_fd = mq_open(normalized_qname, O_WRONLY | O_CREAT | O_NONBLOCK | O_CLOEXEC, 0666, &mqattr);
+
+ if (q_fd != -1) {
+ sndHndl = (SQhandle *)malloc(sizeof(SQhandle));
+ if (NULL != sndHndl) {
+ sndHndl->check_code = MQ_CHECK_CODE;
+ sndHndl->fd = q_fd;
+ sndHndl->q_name = normalized_qname;
+ sndHndl->q_type = eQTypeSender;
+
+ sndHndl->threadid = 0;
+
+
+ // Set the return handle to sndHndl
+ rtnHandle = sndHndl;
+
+ if (zero_copy) {
+ sndHndl->sendbuf = malloc(MAX_QUEUE_MSG_SIZE);
+ if (sndHndl->sendbuf == NULL) {
+ // LCOV_EXCL_START 5: malloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ free(sndHndl);
+ rtnHandle = INVALID_HANDLE;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ sndHndl->sendbuf = NULL;
+ }
+ }
+ }
+ }
+
+ if (INVALID_HANDLE == rtnHandle) {
+ // couldn't connect the queue,
+ // release the memory to normalized queue name
+ if (normalized_qname != NULL) {
+ free(normalized_qname);
+ normalized_qname = NULL; // mb20110108 item 11
+ }
+ if (q_fd != -1) {
+ mq_close(q_fd);
+ }
+ }
+
+ return rtnHandle; // invalid until made valid.
+}
+
+HANDLE OpenSender(PCSTR name) {
+ return openSenderInternal(name, MAX_MESSAGES_STORED_IN_QUEUE, MAX_QUEUE_MSG_SIZE, FALSE, FALSE);
+}
+
+
+HANDLE OpenSenderChild(PCSTR name, pthread_t threadid) {
+ HANDLE h = OpenSender(name);
+ if (INVALID_HANDLE != h) {
+ SQhandle *sq = (SQhandle *)h;
+ sq->threadid = threadid;
+ }
+ return h;
+}
+
+
+HANDLE openSyncSender(PCSTR name) {
+ return openSenderInternal(name, MAX_SYNC_RESPONSE_STORED_IN_QUEUE, MAX_QUEUE_MSG_SIZE, TRUE, FALSE);
+}
+
+HANDLE openSenderZc(PCSTR name) {
+ return openSenderInternal(name, MAX_MESSAGES_STORED_IN_QUEUE, MAX_QUEUE_MSG_SIZE, FALSE, TRUE);
+}
+
+
+EFrameworkunifiedStatus JoinChild(HANDLE hChildApp) {
+ // mb20110108 Code re-structured per comments 24 & 25
+ if (mqCheckValidHandle(hChildApp)) {
+ SQhandle *sq = (SQhandle *)hChildApp;
+ return TranslateError(pthread_join(sq->threadid, NULL));
+ } else {
+ return eFrameworkunifiedStatusFail;
+ }
+}
+
+EFrameworkunifiedStatus GetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 6:GetChildThreadPriority is called by McGetChildThreadPriority, and hChildApp will check there.
+ if (mqCheckValidHandle(hChildApp)) {
+ // LCOV_EXCL_BR_STOP
+ SQhandle *sq = (SQhandle *)hChildApp;
+ SI_32 schedPolicy; // this is needed according to syntax of pthread_getschedparam. api not available to get prio directly.
+ struct sched_param schedParam;
+ eStatus = TranslateError(pthread_getschedparam(sq->threadid, &schedPolicy, &schedParam));
+
+ *threadPrio = schedParam.sched_priority;
+ } else {
+ // LCOV_EXCL_START 6:GetChildThreadPriority is called by McGetChildThreadPriority, and hChildApp will check there.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+ return eStatus;
+}
+
+/// endhack...
+/////////////////////////////////////////
+
+EFrameworkunifiedStatus SendMessage(HANDLE hMessage, UI_32 length, PVOID data) {
+ return SendMessageWithPriority(hMessage, length, data, eFrameworkunifiedMsgPrioNormal);
+}
+
+EFrameworkunifiedStatus SendMessageWithPriority(HANDLE hMessage, UI_32 length, PVOID data, EFrameworkunifiedMessagePriorties priority) {
+ // define a Q handle structure
+ SQhandle *sndHndl = NULL;
+
+ // mb20110108 Added per comments 27 & 28
+ if (length > 0 && NULL == data) {
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+ // check handle for null case...
+ if (mqCheckValidHandle(hMessage) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ sndHndl = (SQhandle *)hMessage;
+
+ // check to see if this is a sender handle
+ if (sndHndl->q_type != eQTypeSender) {
+ return eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ if (-1 == mq_send((mqd_t)sndHndl->fd, (PCSTR)data, (size_t)length, (unsigned int)priority)) {
+ if (errno == EAGAIN) {
+ return eFrameworkunifiedStatusMsgQFull;
+ } else {
+ return TranslateError(errno);
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+SI_32 ReceiveMessage(HANDLE hMessage, UI_32 length, PVOID data) {
+ // define a Q handle structure
+ SQhandle *rcvHndl = NULL;
+
+ // check handle for null case...
+ if (mqCheckValidHandle(hMessage) == FALSE) {
+ errno = ENODATA;
+ return -1;
+ }
+
+ rcvHndl = (SQhandle *)hMessage;
+
+ // check to see if this is a receiver handle
+ if (rcvHndl->q_type != eQTypeReveiver) {
+ errno = ENODATA;
+ return -1;
+ }
+
+
+ return (SI_32)mq_receive((mqd_t)rcvHndl->fd, (char *)data, (size_t)length, NULL);
+}
+
+EFrameworkunifiedStatus CloseReceiver(HANDLE handle) {
+ SQhandle *rcvHndl = NULL;
+ SI_32 q_fd;
+
+ // check handle for null case...
+ if (mqCheckValidHandle(handle) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ rcvHndl = (SQhandle *)handle;
+
+ // check to see if this is a receiver handle
+ if (rcvHndl->q_type != eQTypeReveiver) {
+ return eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ rcvHndl->check_code = 0;
+ q_fd = rcvHndl->fd;
+
+ if (NULL != rcvHndl->q_name) {
+ free(rcvHndl->q_name); // remove the memory to the name
+ rcvHndl->q_name = NULL;
+ }
+ free((void *)handle); // remove handle.. now..
+ handle = INVALID_HANDLE;
+
+ return ((-1 == mq_close((mqd_t)q_fd)) ? eFrameworkunifiedStatusInvldHandle : eFrameworkunifiedStatusOK);
+}
+
+EFrameworkunifiedStatus CloseSender(HANDLE handle) {
+ SQhandle *sndHndl = NULL;
+ SI_32 q_fd;
+
+ // check handle for null case...
+ if (mqCheckValidHandle(handle) == FALSE) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ sndHndl = (SQhandle *)handle;
+
+ // check to see if this is a sender handle
+ if (sndHndl->q_type != eQTypeSender) {
+ return eFrameworkunifiedStatusInvldHndlType;
+ }
+
+ sndHndl->check_code = 0;
+ q_fd = sndHndl->fd; // copy the fd, need it to close the queues....
+
+ if (NULL != sndHndl->q_name) {
+ free(sndHndl->q_name); // remove the memory to the name
+ sndHndl->q_name = NULL;
+ }
+ if (NULL != sndHndl->sendbuf) {
+ free(sndHndl->sendbuf);
+ sndHndl->sendbuf = NULL;
+ }
+ free((void *)handle); // remove handle.. now..
+ handle = INVALID_HANDLE; // invalidate handle so user doesn't reuse...
+
+ return (-1 == mq_close((mqd_t)q_fd)) ? eFrameworkunifiedStatusInvldHandle : eFrameworkunifiedStatusOK;
+}
+
+static UI_8 IsMessageAvailable(SI_32 fd) {
+ struct mq_attr sMqStatus;
+ if (-1 == mq_getattr(fd, &sMqStatus)) {
+ // Error Detected.
+ return 0;
+ } else {
+ if (0 < sMqStatus.mq_curmsgs) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+}
+
+void Flush(HANDLE hMessage) {
+ SQhandle *rcvHndl = NULL;
+
+ if (mqCheckValidHandle(hMessage)) {
+ rcvHndl = (SQhandle *)hMessage;
+
+ if (rcvHndl->q_type != eQTypeReveiver) {
+ return;
+ }
+
+ // check there is anything on the queue before going into the loop....
+ if (IsMessageAvailable(rcvHndl->fd)) {
+ CHAR l_pReceiveBuffer_o[MAX_QUEUE_MSG_SIZE];
+
+ // read till there isn't anything on the queue.
+ while (IsMessageAvailable(rcvHndl->fd)) {
+ mq_receive((mqd_t)rcvHndl->fd, l_pReceiveBuffer_o, (size_t)MAX_QUEUE_MSG_SIZE, NULL);
+ }
+ }
+ }
+}
+
+EQType GetQueueType(HANDLE hMessage) {
+ EQType qType = eQTypeInvld;
+
+ if (mqCheckValidHandle(hMessage)) {
+ SQhandle *handle = (SQhandle *)hMessage;
+ qType = handle->q_type;
+ }
+
+ return qType;
+}
+
+PCSTR GetQueueName(HANDLE hMessage) {
+ PCSTR name = NULL;
+
+ if (mqCheckValidHandle(hMessage)) {
+ SQhandle *hMsgQ = (SQhandle *)hMessage;
+
+ if (hMsgQ->q_type == eQTypeSender ||
+ hMsgQ->q_type == eQTypeReveiver) {
+ name = hMsgQ->q_name;
+ }
+ }
+
+ return name;
+}
+
+int GetQueueFD(HANDLE hMessage) {
+ int fd = -1;
+
+ if (mqCheckValidHandle(hMessage)) {
+ SQhandle *hMsgQ = (SQhandle *)hMessage;
+
+ if (hMsgQ->q_type == eQTypeSender ||
+ hMsgQ->q_type == eQTypeReveiver) {
+ fd = hMsgQ->fd;
+ }
+ }
+
+ return fd;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/include/ns_np_service_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/include/ns_np_service_internal.h
new file mode 100755
index 0000000..469b4c0
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/include/ns_np_service_internal.h
@@ -0,0 +1,75 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_np_service_internal.h
+ * @brief \~english TestFramework provides interface for implementing functional test classes.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_INTERNAL_H_
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendStopToNSNPP
+/// To be used by System Manager Service only. This API would push NPP Service to persist
+/// the data/files. Ideally this should be sent during system shutdown by System Manager Service
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of the requesters message queue
+/// \param [in] eShutdownType
+/// EFrameworkunifiedShutdownType - shutdown type
+/// \param [in] uiStopMsgData
+/// UI_32 - Flag representing which data to persist and which data to delete
+/// from persistent memory
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendStopToNSNPP(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedShutdownType eShutdownType, UI_32 uiStopMsgData);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_INTERNAL_H_
+/** @}*/
+/** @}*/
+/** @}*/
+
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..cbfc140
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/makefile_PosixBasedOS001
@@ -0,0 +1,208 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_NPServiceIf
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_NPServiceIf
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_UtilityCenter/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+ifdef DYNAMIC
+ DYNAMIC_LIBS += \
+ NS_MessageCenter$(DEBUG_EXT)
+else
+ STATIC_LIBS +=
+endif
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_api.c b/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_api.c
new file mode 100755
index 0000000..d41514d
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_api.c
@@ -0,0 +1,1001 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPService
+/// \brief APIs to be used by clients while invoking Notification Service.
+///
+/// Implementation of APIs for Publishers and Subscribers of notifications.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_mc_system_info.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <limits.h>
+#include <other_service/strlcpy.h>
+
+// define user name as blank for global persistence file
+#define GLOBAL_PERSISTENCE ""
+
+// this is the maximum number of notifications that can be registered/ unregistered at once
+const UI_32 maxNotification = UINT_MAX / sizeof(NC_register_notif_msg);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPRegisterNotifications
+/// API to send message to Notification Service to register a set of notifications
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] numNotifications
+/// PCSTR - Name of Notification
+/// \param [in] pNotificationArray
+/// NotificationInfo - Array of notifications
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ NotificationInfo *pNotificationArray) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (maxNotification < numNotifications) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ size_t sizeOfMsg = (sizeof(NC_register_notif_msg) * numNotifications) + sizeof(UI_32);
+ if (NULL == pNotificationArray) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ PCHAR *pMsgBuffer = (PCHAR *)malloc(sizeOfMsg);
+
+ if (NULL == pMsgBuffer) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ NC_register_multiple_notif_msg *pNotifMsg = (NC_register_multiple_notif_msg *)pMsgBuffer;
+
+ pNotifMsg->numNotifications = numNotifications;
+ memcpy(&pNotifMsg->notifierList[0], pNotificationArray, sizeof(NC_register_notif_msg) * numNotifications);
+
+ for(UI_32 i = 0; i < numNotifications; i++) {
+ // Insert \0 at the end of character (up to 64bytes) by copying with strlcpy.
+ strlcpy(pNotifMsg->notifierList[i].notificationName,
+ pNotificationArray[i].notificationName,
+ sizeof(pNotificationArray[i].notificationName));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_REGISTER_EV_REQ, (UI_32)sizeOfMsg, (PVOID)pNotifMsg) ;
+
+ free(pMsgBuffer);
+ pMsgBuffer = NULL;
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPUnRegisterNotifications
+/// API to send message to Notification Service to remove a set of notifications
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] numNotifications
+/// PCSTR - Name of Notification
+/// \param [in] pNotificationArray
+/// NotificationInfo - Array of notifications
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnRegisterNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ NotificationInfo *pNotificationArray) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (maxNotification < numNotifications) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ size_t sizeOfMsg = (sizeof(NC_unregister_notif_msg) * numNotifications) + sizeof(UI_32);
+ UI_32 i = 0;
+ if (NULL == pNotificationArray) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ PCHAR *pMsgBuffer = (PCHAR *)malloc(sizeOfMsg);
+
+ if (NULL == pMsgBuffer) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ NC_unregister_multiple_notif_msg *pNotifMsg = (NC_unregister_multiple_notif_msg *)pMsgBuffer;
+
+ pNotifMsg->numNotifications = numNotifications;
+
+ for (i = 0; i < numNotifications; ++i) {
+ strlcpy(pNotifMsg->notificationList[i].notificationName, pNotificationArray[i].notificationName,
+ sizeof(pNotifMsg->notificationList[i].notificationName));
+ }
+
+ // mb20110110 Fixed issue 135
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_UNREGISTER_EV_REQ, (UI_32)sizeOfMsg, (VOID *)pMsgBuffer) ;
+
+ free(pMsgBuffer);
+ pMsgBuffer = NULL; // mb20110110 issue 134
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPRegisterNotification
+/// API to send message to Notification Service to register a notification
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] notif_name
+/// PCSTR - Name of Notification
+/// \param [in] max_length
+/// const UI_32 - Max size of the notification message
+/// \param [in] bIsPersistent
+/// const UI_8 - Flag to indicate if it has to be persistent
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR notificationName,
+ const UI_32 maxLength, const EFrameworkunifiedNotificationType perstype)
+
+{
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != notificationName) {
+ if (strlen(pPublisherName) && strlen(notificationName)) {
+ NotificationInfo data = {};
+ strlcpy(data.notificationName, notificationName, sizeof(data.notificationName));
+ data.persType = perstype;
+ data.maxLength = maxLength;
+
+ eFrameworkunifiedStatus = NPRegisterNotifications(hNPMsgQ, pPublisherName, 1, &data);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPUnRegisterNotification
+/// API to send message to Notification Service to remove a notification
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnRegisterNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification) {
+
+ NotificationInfo data = {};
+ strlcpy(data.notificationName, pNotification, sizeof(data.notificationName));
+ return (NPUnRegisterNotifications(hNPMsgQ, pPublisherName, 1, &data));
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPPublishNotification
+/// API to send message to Notification Service to notify subscribers
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+/// \param [in] pData
+/// VOID * - Data buffer
+/// \param [in] iLength
+/// const UI_32 - Size of data buffer
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPPublishNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification,
+ PCVOID pData, const UI_32 iLength) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pNotification) {
+ if (strlen(pPublisherName) && strlen(pNotification)) {
+ if (strlen(pNotification) < MAX_STRING_SIZE_NOTIFICATION) {
+ // Insert \0 at the end of characters (up to 64bytes) by copying pNotification to local variables with strlcpy.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNotification, MAX_STRING_SIZE_NOTIFICATION);
+ eFrameworkunifiedStatus = McSendWithSysInfo(hNPMsgQ, pPublisherName, NPS_PUBLISH_EV_REQ,
+ tmp_notification, iLength, pData, 0);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSubscribeToNotification
+/// API to send message to Notification Service to add to subscription list for
+/// that notification
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSubscribeToNotification(HANDLE hNPMsgQ, PCSTR pSubscriberName, PCSTR pNotification) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ if (NULL != hNPMsgQ && NULL != pSubscriberName && NULL != pNotification) {
+ if (strlen(pSubscriberName) && strlen(pNotification)) {
+ NC_subscribe_msg data;
+ snprintf(data.notificationName, sizeof(data.notificationName), "%s", pNotification);
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pSubscriberName, NPS_SUBSCRIBE_TO_EV_REQ, sizeof(NC_subscribe_msg), (PVOID)&data);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// NPSubscribeToNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSubscribeToNotifications(HANDLE hNPMsgQ, PCSTR pSubscriberName, UI_32 numNotifications,
+ SubscribeInfo *pSubscribeInfoArray) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (maxNotification < numNotifications) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ size_t sizeOfMsg = (sizeof(NC_subscribe_msg) * numNotifications) + sizeof(UI_32);
+ if (NULL == pSubscribeInfoArray) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ PCHAR *pMsgBuffer = (PCHAR *)malloc(sizeOfMsg);
+
+ if (NULL == pMsgBuffer) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ NC_subscribe_multiple_notif_msg *pSubscribeMsg = (NC_subscribe_multiple_notif_msg *)pMsgBuffer;
+
+ pSubscribeMsg->numNotifications = numNotifications;
+ memcpy(&pSubscribeMsg->notificationList[0], pSubscribeInfoArray, sizeof(NC_subscribe_msg) * numNotifications);
+
+ for(UI_32 i = 0; i < numNotifications; i++) {
+ // Insert \0 at the end of character (up to 64bytes) by copying with strlcpy.
+ strlcpy(pSubscribeMsg->notificationList[i].notificationName,
+ pSubscribeInfoArray[i].notificationName,
+ sizeof(pSubscribeInfoArray[i].notificationName));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pSubscriberName, NPS_BATCH_SUBSCRIBE_TO_EV_REQ, (UI_32)sizeOfMsg, (PVOID)pSubscribeMsg) ;
+
+ free(pMsgBuffer);
+ pMsgBuffer = NULL;
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPUnsubscribeFromNotification
+/// API to send message to Notification Service to remove from subscription list for
+/// that notification
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnsubscribeFromNotification(HANDLE hNPMsgQ, PCSTR pSubscriberName, PCSTR pNotification) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pSubscriberName && NULL != pNotification) {
+ if (strlen(pSubscriberName) && strlen(pNotification)) {
+ NC_unsubscribe_frm_notif_msg data;
+ snprintf(data.notificationName, sizeof(data.notificationName), "%s", pNotification);
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pSubscriberName, NPS_UNSUBSCRIBE_FROM_EV_REQ, sizeof(NC_unsubscribe_frm_notif_msg),
+ (PVOID)&data);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// NPUnsubscribeToNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnsubscribeFromNotifications(HANDLE hNPMsgQ, PCSTR pUnSubscriberName, UI_32 numNotifications,
+ SubscribeInfo *pUnSubscribeInfoArray) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pUnSubscriberName) {
+ if (strlen(pUnSubscriberName)) {
+ if (maxNotification < numNotifications) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ size_t sizeOfMsg = (sizeof(NC_subscribe_msg) * numNotifications) + sizeof(UI_32);
+ if (NULL == pUnSubscribeInfoArray) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ PCHAR *pMsgBuffer = (PCHAR *)malloc(sizeOfMsg);
+
+ if (NULL == pMsgBuffer) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ NC_unsubscribe_multiple_notif_msg *pUnSubscribeMsg = (NC_unsubscribe_multiple_notif_msg *)pMsgBuffer;
+
+ pUnSubscribeMsg->numNotifications = numNotifications;
+ memcpy(&pUnSubscribeMsg->notificationList[0], pUnSubscribeInfoArray, sizeof(NC_subscribe_msg) * numNotifications);
+
+ for(UI_32 i = 0; i < numNotifications; i++) {
+ // Insert \0 at the end of character (up to 64bytes) by copying with strlcpy.
+ strlcpy(pUnSubscribeMsg->notificationList[i].notificationName,
+ pUnSubscribeInfoArray[i].notificationName,
+ sizeof(pUnSubscribeInfoArray[i].notificationName));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pUnSubscriberName, NPS_BATCH_UNSUBSCRIBE_FROM_EV_REQ, (UI_32)sizeOfMsg, (PVOID)pUnSubscribeMsg) ;
+
+ free(pMsgBuffer);
+ pMsgBuffer = NULL;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPReadPersistedData
+/// API to requested the persistent data corresponding to specified notification if available
+/// The caller recieves an acknowledgement once NPS completes data retrieval and sends it.
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \param [in] notification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPReadPersistedData(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR notification) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != notification) {
+ if (strlen(pPublisherName) && strlen(notification)) {
+ NC_get_pers_data_msg msg;
+
+ snprintf(msg.notificationName, sizeof(msg.notificationName), "%s", notification);
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_GET_PERS_DATA_REQ, sizeof(msg), (PVOID)&msg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSavePersistentData
+/// API to send message to Notification Service to save all persisted data that in Ram
+/// to the filesystem via a file write.
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of publisher message queue
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSavePersistentData(HANDLE hNPMsgQ, PCSTR pPublisherName) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_SAVE_PERS_DATA_REQ, 0, NULL) ;
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPRegisterPersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterPersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pTag,
+ BOOL bIsUserFile) { // EFrameworkunifiedRegisterType eRegisterType)
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pTag) {
+ if (strlen(pPublisherName) && strlen(pTag)) {
+ NC_RegisterPersistentFileMsg tMsg;
+
+ snprintf(tMsg.cFileTag, sizeof(tMsg.cFileTag), "%s", pTag);
+ tMsg.bIsUserFile = bIsUserFile;
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_SET_PERSIST_FILE_PATH_REQ, sizeof(tMsg),
+ (PVOID)&tMsg);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPLoadPersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPLoadPersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pDstFilePath,
+ PCSTR pTag, HANDLE hUser) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName &&
+ NULL != pDstFilePath && NULL != pTag) {
+ if (strlen(pPublisherName) && strlen(pDstFilePath) && strlen(pTag)) {
+ NC_LoadPersistedFileMsg tMsg = {};
+
+ snprintf(tMsg.cFilePath, sizeof(tMsg.cFilePath), "%s", pDstFilePath);
+ snprintf(tMsg.cFileTag, sizeof(tMsg.cFileTag), "%s", pTag);
+
+ if (hUser) {
+ NC_User *pUser = (NC_User *) hUser;
+ snprintf(tMsg.cUsername, sizeof(tMsg.cUsername), "%s", pUser->cUsername != 0 ? pUser->cUsername : NULL);
+ } else {
+ strlcpy(tMsg.cUsername, GLOBAL_PERSISTENCE, sizeof(tMsg.cUsername));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_GET_PERS_FILE_REQ, sizeof(tMsg), (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPReleasePersistentFile
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPReleasePersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType, PCSTR pTag,
+ PCSTR pFullFilePath, HANDLE hUser) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName &&
+ NULL != pTag && NULL != pFullFilePath) {
+ if (strlen(pPublisherName) && strlen(pTag) && strlen(pFullFilePath)) {
+ NC_ReleasePersistentFileMsg tMsg = {eFrameworkunifiedReleaseType, {0}, {0}};
+
+ snprintf(tMsg.cFilePath, sizeof(tMsg.cFilePath), "%s", pFullFilePath);
+ snprintf(tMsg.cFileTag, sizeof(tMsg.cFileTag), "%s", pTag);
+
+ if (hUser) {
+ NC_User *pUser = (NC_User *) hUser;
+ snprintf(tMsg.cUsername, sizeof(tMsg.cUsername), "%s", pUser->cUsername != 0 ? pUser->cUsername : NULL);
+ } else {
+ strlcpy(tMsg.cUsername, GLOBAL_PERSISTENCE, sizeof(tMsg.cUsername));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_RELEASE_PERS_FILE_REQ, sizeof(tMsg), (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPPersistentSync
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPPersistentSync(PCSTR SrcName, HANDLE hNPMsgQ, UI_32 sessionid, PCSTR pPublisherName) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ CHAR data[4];
+ UI_32 length;
+ HANDLE hResponse;
+ char mc_invoker_name[MAX_QUEUE_NAME_SIZE];
+
+ McCreateInvokerName(SrcName, sessionid, mc_invoker_name, sizeof(mc_invoker_name));
+ hResponse = McOpenSyncReceiver(&mc_invoker_name[0]);
+ if (hResponse != NULL) {
+ eFrameworkunifiedStatus = McInvokeSync(hNPMsgQ, pPublisherName, NPS_NPP_SYNC_REQ , sizeof(data), data, sessionid,
+ hResponse, 0, NULL, &length);
+ McClose(hResponse);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ return eFrameworkunifiedStatus;
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSetPersonality
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetPersonality(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pUserName) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pUserName) {
+ if (strlen(pPublisherName) && strlen(pUserName)) {
+ // NC_SetPersonalityMsg tMsg;
+ NC_User tMsg;
+
+ snprintf(tMsg.cUsername, sizeof(tMsg.cUsername), "%s", pUserName);
+
+ // eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_SET_PERSONALITY_REQ, sizeof(tMsg), (PVOID)&tMsg ) ;
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_CHANGE_PERSONALITY_REQ, sizeof(tMsg), (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPRegisterPersistentFolder
+/// API to register persistence tag to folder that need to persist
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \param [in] pTag
+/// PCSTR - Tag associated to folder that need to persist
+/// \param [in] bIsUserFolder
+/// BOOL - TRUE - user specific folder
+/// FALSE - global file
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterPersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pTag, BOOL bIsUserFolder) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pTag) {
+ if (strlen(pPublisherName) && strlen(pTag)) {
+ NC_RegisterPersistentFolderMsg tMsg;
+
+ snprintf(tMsg.cFolderTag, sizeof(tMsg.cFolderTag), "%s", pTag);
+ tMsg.bIsUserFolder = bIsUserFolder;
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_SET_PERSIST_FOLDER_PATH_REQ, sizeof(tMsg),
+ (PVOID)&tMsg);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPLoadPersistentFolder
+/// API to load folder to given path and associated with given tag from persistent memory
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \param [in] pDstFolderPath
+/// PCSTR - Destination where folder needs to be loaded
+/// \param [in] pTag
+/// PCSTR - Tag associated to folder that need to loaded from persistent memory
+/// \param [in] hUser
+/// HANDLE - Handle of the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPLoadPersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pDstFolderPath,
+ PCSTR pTag, HANDLE hUser) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName &&
+ NULL != pDstFolderPath && NULL != pTag) {
+ if (strlen(pPublisherName) && strlen(pDstFolderPath) && strlen(pTag)) {
+ NC_LoadPersistedFolderMsg tMsg;
+
+ snprintf(tMsg.cFolderPath, sizeof(tMsg.cFolderPath), "%s", pDstFolderPath);
+ snprintf(tMsg.cFolderTag, sizeof(tMsg.cFolderTag), "%s", pTag);
+
+ if (hUser) {
+ NC_User *pUser = (NC_User *) hUser;
+ snprintf(tMsg.cUsername, sizeof(tMsg.cUsername), "%s", pUser->cUsername != 0 ? pUser->cUsername : NULL);
+ } else {
+ strlcpy(tMsg.cUsername, GLOBAL_PERSISTENCE, sizeof(tMsg.cUsername));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_GET_PERS_FOLDER_REQ, sizeof(tMsg), (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPReleasePersistentFolder
+/// API to release folder for saving with tag name to persistent memory
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \param [in] eFrameworkunifiedReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease :not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly :persist instantly
+/// \param [in] pTag
+/// PCSTR - Tag associated to folder that need to persist
+/// \param [in] pFullFolderPath
+/// PCSTR - full folder path of folder that need to be stored in persistent memory
+/// \param [in] hUser
+/// HANDLE - Handle of the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPReleasePersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType,
+ PCSTR pTag, PCSTR pFullFolderPath, HANDLE hUser) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName &&
+ NULL != pTag && NULL != pFullFolderPath) {
+ if (strlen(pPublisherName) && strlen(pFullFolderPath) && strlen(pTag)) {
+ NC_ReleasePersistentFolderMsg tMsg = {eFrameworkunifiedReleaseType, {0}, {0}};
+
+ snprintf(tMsg.cFolderPath, sizeof(tMsg.cFolderPath), "%s", pFullFolderPath);
+ snprintf(tMsg.cFolderTag, sizeof(tMsg.cFolderTag), "%s", pTag);
+
+ if (hUser) {
+ NC_User *pUser = (NC_User *) hUser;
+ snprintf(tMsg.cUsername, sizeof(tMsg.cUsername), "%s", pUser->cUsername != 0 ? pUser->cUsername : NULL);
+ } else {
+ strlcpy(tMsg.cUsername, GLOBAL_PERSISTENCE, sizeof(tMsg.cUsername));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_RELEASE_PERS_FOLDER_REQ, sizeof(tMsg), (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPChangePersonality
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPChangePersonality(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pUserName) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != pUserName && 0 != strlen(pUserName)) {
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_CHANGE_PERSONALITY_REQ, sizeof(pUserName), (PVOID)&pUserName) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendStopToNSNPP
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendStopToNSNPP(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedShutdownType eShutdownType, UI_32 uiStopMsgData) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != pPublisherName && 0 != strlen(pPublisherName)) {
+ NC_StopMsgData tMsg;
+ tMsg.eShutdownType = eShutdownType;
+ tMsg.uiStopMsgData = uiStopMsgData;
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_NPP_STOP_REQ, sizeof(tMsg), (PVOID)&tMsg);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPGetReadyStatusOfNPP
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPGetReadyStatusOfNPP(HANDLE hNPMsgQ, PCSTR pRequesterName) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != pRequesterName && 0 != strlen(pRequesterName)) {
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pRequesterName, NPS_GET_READYSTATUS_REQ, 0, NULL);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPRegisterImmediateNotifications
+/// API to send message to Notification Service to register a set of notifications
+///
+/// \param [in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \param [in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \param [in] numNotifications
+/// PCSTR - Name of Notification
+/// \param [in] pNotificationArray
+/// ImmediateNotificationInfo - Array of notifications
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterImmediateNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ ImmediateNotificationInfo *pNotificationArray) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (maxNotification < numNotifications) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ size_t sizeOfMsg = (sizeof(NC_register_immediate_notif_msg) * numNotifications) + sizeof(UI_32);
+ if (NULL == pNotificationArray) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ PCHAR *pMsgBuffer = (PCHAR *)malloc(sizeOfMsg);
+
+ if (NULL == pMsgBuffer) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ NC_register_multiple_immediate_notif_msg *pNotifMsg = (NC_register_multiple_immediate_notif_msg *)pMsgBuffer;
+
+ if (NULL != pNotifMsg) {
+ pNotifMsg->numNotifications = numNotifications;
+ }
+
+ memcpy(&pNotifMsg->notifierList[0], pNotificationArray, sizeof(NC_register_immediate_notif_msg) * numNotifications);
+
+ for(UI_32 i = 0; i < numNotifications; i++ ) {
+ // Insert \0 at the end of character (up to 64bytes) by copying with strlcpy.
+ strlcpy(pNotifMsg->notifierList[i].notificationName,
+ pNotificationArray[i].notificationName,
+ sizeof(pNotificationArray[i].notificationName));
+ }
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ, pPublisherName, NPS_REGISTER_NOR_EV_REQ, (UI_32)sizeOfMsg, (PVOID)pNotifMsg) ;
+
+ if (NULL != pMsgBuffer) {
+ free(pMsgBuffer);
+ pMsgBuffer = NULL;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPClearPersistedData
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPClearPersistedData(HANDLE hNPMsgQ, PCSTR pRequesterName, EFrameworkunifiedClearPersistence eFrameworkunifiedClearPersistenceScope) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if ((NULL != hNPMsgQ) && (NULL != pRequesterName) && (0 != strlen(pRequesterName))) {
+ NC_ClearPersistedDataReq tMsg = {};
+ tMsg.ePersistenceData = eFrameworkunifiedClearPersistenceScope;
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ,
+ pRequesterName,
+ NPS_DELETE_PERSISTED_DATA_REQ,
+ sizeof(tMsg),
+ &tMsg);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSetPersistNotfnDefaultValue
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetPersistNotfnDefaultValue(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification, PCVOID pData,
+ const UI_32 iLength) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pNotification) {
+ if ((0 != strlen(pPublisherName)) && (0 != strlen(pNotification))) {
+
+ // Insert \0 at the end of characters (up to 64bytes) by copying pNotification to local variables with strlcpy.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNotification, MAX_STRING_SIZE_NOTIFICATION);
+
+ eFrameworkunifiedStatus = McSendWithSysInfo(hNPMsgQ,
+ pPublisherName,
+ NPS_SET_DEFAULT_PERS_DATA,
+ (PCHAR)tmp_notification,
+ iLength,
+ pData,
+ 0);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSetPersistentNotfnType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetPersistentNotfnType(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification,
+ EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pNotification) {
+ if ((0 != strlen(pPublisherName)) && (0 != strlen(pNotification))) {
+
+ // Insert \0 at the end of characters (up to 64bytes) by copying pNotification to local variables with strlcpy.
+ char tmp_notification[MAX_STRING_SIZE_NOTIFICATION] = {0};
+ strlcpy(tmp_notification, pNotification, MAX_STRING_SIZE_NOTIFICATION);
+
+ eFrameworkunifiedStatus = McSendWithSysInfo(hNPMsgQ,
+ pPublisherName,
+ NPS_SET_NOTFN_PERSISTENT_TYPE,
+ (PCHAR)tmp_notification,
+ sizeof(ePersistCategory),
+ &ePersistCategory,
+ 0);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSetFilePersistentType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetFilePersistentType(HANDLE hNPMsgQ, PCSTR pPublisherName,
+ PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pTag) {
+ if ((0 != strlen(pPublisherName)) && (0 != strlen(pTag))) {
+ NC_SetFilePersistType tMsg = {};
+
+ tMsg.ePersistType = ePersistCategory;
+
+ snprintf(tMsg.cTag, sizeof(tMsg.cTag), "%s", pTag);
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ,
+ pPublisherName,
+ NPS_SET_FILE_PERSISTENT_TYPE,
+ sizeof(tMsg),
+ (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSetFolderPersistentType
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetFolderPersistentType(HANDLE hNPMsgQ, PCSTR pPublisherName,
+ PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hNPMsgQ && NULL != pPublisherName && NULL != pTag) {
+ if ((0 != strlen(pPublisherName)) && (0 != strlen(pTag))) {
+ NC_SetFolderPersistType tMsg = {};
+
+ tMsg.ePersistType = ePersistCategory;
+ snprintf(tMsg.cTag, sizeof(tMsg.cTag), "%s", pTag);
+
+ eFrameworkunifiedStatus = McSend(hNPMsgQ,
+ pPublisherName,
+ NPS_SET_FOLDER_PERSISTENT_TYPE,
+ sizeof(tMsg),
+ (PVOID)&tMsg) ;
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp b/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp
new file mode 100755
index 0000000..a777743
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_NPServiceIf/src/ns_np_service_nor_persistence.cpp
@@ -0,0 +1,498 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPService
+/// \brief This file contains the API to store and retrieve immediate
+/// notification data from and to persistent storage.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dirent.h>
+#include <semaphore.h>
+#include <aglpath.h>
+
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_util_directory.h>
+#include <native_service/ns_np_service_nor_persistence.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+#include <string>
+
+#include <native_service/ns_np_service_nor_persistence_internal.h>
+#include <native_service/ns_np_types.h>
+#include <native_service/ns_mc_system_info.h>
+
+sem_t g_FileAccessSemaphore;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousReadPersistentData
+/// Read immediate persistent data from the persistent memory
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousReadPersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ UI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ NC_NorPersistentData l_tNorPersistentData = {};
+
+ if (NULL != pAppName && NULL != notif_name && NULL != pData) {
+ if (eFrameworkunifiedStatusOK != NPSynchronousGetPersistentData(pAppName, notif_name, pData, uiDataSize, l_tNorPersistentData,
+ ePersistCategory)) {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousGetPersistentData
+/// Get the notification data from the persistent storage
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousGetPersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ UI_32 uiDataSize,
+ NC_NorPersistentData &ptImmediatePersistentData, // NOLINT (readability/nolint)
+ const EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != notif_name && NULL != pData && 0 < uiDataSize) {
+ FILE *l_fFilePtr = NULL;
+
+ if (0 == sem_init(&g_FileAccessSemaphore, 1, 1)) { // LCOV_EXCL_BR_LINE 5: sem_init's error case
+ if (sem_wait(&g_FileAccessSemaphore) == 0) { // LCOV_EXCL_BR_LINE 5: sem_wait's error case
+ // Create unique filename
+ std::string l_cTempPath = notif_name;
+ size_t l_uiTempPathSize = 0;
+
+ std::string l_cPath = "";
+ std::string l_cNewPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+ std::string l_cOldPath = IMMEDIATE_PERSISTENCE_STORAGE_V1;
+
+ // replace all '/' by '_'
+ l_uiTempPathSize = l_cTempPath.find_first_of("/");
+ while (std::string::npos != l_uiTempPathSize) {
+ l_cTempPath[l_uiTempPathSize] = '_';
+ l_uiTempPathSize = l_cTempPath.find_first_of("/", l_uiTempPathSize + 1);
+ }
+
+ switch (ePersistCategory) {
+ case eFrameworkunifiedFactoryData: {
+ l_cNewPath.append(FACTORYDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedFactoryCustomerData: {
+ l_cNewPath.append(FACTORYCUSTOMERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedDealerData: {
+ l_cNewPath.append(DEALERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedUserData:
+ default: {
+ l_cNewPath.append(USERDATADIR);
+ l_cNewPath.append(ALLUSERAPPDATADIR);
+ }
+ break;
+ }
+
+ l_cNewPath.append(IMMEDIATEDATADIR);
+ l_cNewPath.append(l_cTempPath);
+
+ if (NULL != pAppName) { // LCOV_EXCL_BR_LINE 6: pAppName was checed in NPSynchronousReadPersistentData
+ l_cNewPath.append(pAppName);
+ }
+
+ if (0 == access(l_cNewPath.c_str(), F_OK)) {
+ l_cPath.assign(l_cNewPath);
+ } else {
+ l_cOldPath.append(l_cTempPath);
+ if (NULL != pAppName) { // LCOV_EXCL_BR_LINE 6: pAppName was checed in NPSynchronousReadPersistentData
+ l_cOldPath.append(pAppName);
+ }
+
+ if (0 == access(l_cOldPath.c_str(), F_OK)) {
+ l_cPath.assign(l_cOldPath);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == eFrameworkunifiedStatus) {
+ size_t PersistData;
+ // Open and read from a file
+ l_fFilePtr = fopen(l_cPath.c_str(), "re");
+ if (NULL != l_fFilePtr) {
+ // read notification info structure
+ if (fread(&ptImmediatePersistentData, 1, sizeof(ptImmediatePersistentData),
+ l_fFilePtr) == sizeof(ptImmediatePersistentData)) {
+ if (0 == feof(l_fFilePtr)) {
+ // read data
+ PersistData = fread(pData, 1, uiDataSize, l_fFilePtr);
+ if (PersistData != uiDataSize) {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ fclose(l_fFilePtr);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ sem_post(&g_FileAccessSemaphore);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusErrOther;
+ }
+ sem_destroy(&g_FileAccessSemaphore);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousWritePersistentData
+/// Store the notification data on the persistent memory
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousWritePersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ const UI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ HANDLE l_hReceiverMq = NULL;
+
+ // if this API is used to write the data directly then max data size will be same as data write size
+ l_eStatus = SynchronousWritePersistentData(pAppName, notif_name, pData, uiDataSize, 0, uiDataSize, ePersistCategory);
+
+ l_hReceiverMq = McOpenSender(FRAMEWORKUNIFIED_NS_NPSERVICE);
+
+ if (NULL != l_hReceiverMq) {
+ (VOID)McSendWithSysInfo(l_hReceiverMq,
+ pAppName,
+ NPS_SYNCHRONOUS_WRITE_NOTIFY_REQ,
+ (PCHAR)notif_name,
+ uiDataSize,
+ pData,
+ 0);
+
+ McClose(l_hReceiverMq);
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SynchronousWritePersistentData
+/// Store the notification data on the persistent memory
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SynchronousWritePersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ const UI_32 uiDataSize,
+ const UI_32 uiDelay,
+ const UI_32 uiMaxSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ FILE *l_fFilePtr = NULL;
+ NC_NorPersistentData l_tImmediatePersistentData = {};
+
+ if (NULL != notif_name && NULL != pAppName && NULL != pData) {
+ if (strlen(notif_name) < MAX_STRING_SIZE_NOTIFICATION && strlen(pAppName) < MAX_NAME_SIZE_APP) {
+ // Create unique filename
+ std::string l_cTempPath = notif_name;
+ size_t l_uiTempPathSize = 0;
+
+ // replace all '/' by '_'
+ l_uiTempPathSize = l_cTempPath.find_first_of("/");
+ while (std::string::npos != l_uiTempPathSize) {
+ l_cTempPath[l_uiTempPathSize] = '_';
+ l_uiTempPathSize = l_cTempPath.find_first_of("/", l_uiTempPathSize + 1);
+ }
+
+ strncpy(l_tImmediatePersistentData.notificationName, notif_name,
+ sizeof(l_tImmediatePersistentData.notificationName) - 1);
+ strncpy(l_tImmediatePersistentData.pPublisherName, pAppName,
+ sizeof(l_tImmediatePersistentData.pPublisherName) - 1);
+ l_tImmediatePersistentData.dataSize = uiDataSize;
+ l_tImmediatePersistentData.uiDelay = uiDelay;
+ l_tImmediatePersistentData.uiMaxSize = uiMaxSize;
+
+ if (0 == sem_init(&g_FileAccessSemaphore, 1, 1)) { // LCOV_EXCL_BR_LINE 5: sem_init's error case
+ if (sem_wait(&g_FileAccessSemaphore) == 0) { // LCOV_EXCL_BR_LINE 5: sem_wait's error case
+ std::string l_cPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+
+ switch (ePersistCategory) {
+ case eFrameworkunifiedFactoryData: {
+ l_cPath.append(FACTORYDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedFactoryCustomerData: {
+ l_cPath.append(FACTORYCUSTOMERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedDealerData: {
+ l_cPath.append(DEALERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedUserData:
+ default: {
+ l_cPath.append(USERDATADIR);
+ l_cPath.append(ALLUSERAPPDATADIR);
+ }
+ break;
+ }
+
+ l_cPath.append(IMMEDIATEDATADIR);
+
+ if (!DoesDirecotryExist(l_cPath)) {
+ eFrameworkunifiedStatus = CreateDirectory(l_cPath);
+ }
+
+ if (eFrameworkunifiedStatusOK == eFrameworkunifiedStatus) {
+ l_cPath.append(l_cTempPath);
+
+ l_cPath.append(pAppName);
+
+ l_fFilePtr = fopen(l_cPath.c_str(), "we");
+ if (NULL != l_fFilePtr) {
+ // write header
+ fwrite(&l_tImmediatePersistentData , 1 , sizeof(l_tImmediatePersistentData) , l_fFilePtr);
+ if (0 == ferror(l_fFilePtr)) {
+ // write data
+ fwrite(pData , 1 , uiDataSize , l_fFilePtr);
+ if (0 != ferror(l_fFilePtr)) {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ fsync(fileno(l_fFilePtr));
+ fclose(l_fFilePtr);
+ }
+ }
+
+ sem_post(&g_FileAccessSemaphore);
+ }
+ sem_destroy(&g_FileAccessSemaphore);
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousGetPersistentDataSize
+/// Get the size of the notification data stored in the persistent memory
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousGetPersistentDataSize(PCSTR notif_name, PUI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != notif_name && NULL != uiDataSize) {
+ FILE *l_fFilePtr = NULL;
+ NC_NorPersistentData l_ptImmediatePersistentData = {};
+
+ *uiDataSize = 0;
+
+ if (0 == sem_init(&g_FileAccessSemaphore, 1, 1)) { // LCOV_EXCL_BR_LINE 5: sem_init's error case
+ if (sem_wait(&g_FileAccessSemaphore) == 0) { // LCOV_EXCL_BR_LINE 5: sem_wait's error case
+ // Create unique filename
+ std::string l_cTempPath = notif_name;
+ size_t l_uiTempPathSize = 0;
+
+ std::string l_cPath = "";
+ std::string l_cNewPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+ std::string l_cOldPath = IMMEDIATE_PERSISTENCE_STORAGE_V1;
+
+ // replace all '/' by '_'
+ l_uiTempPathSize = l_cTempPath.find_first_of("/");
+ while (std::string::npos != l_uiTempPathSize) {
+ l_cTempPath[l_uiTempPathSize] = '_';
+ l_uiTempPathSize = l_cTempPath.find_first_of("/", l_uiTempPathSize + 1);
+ }
+
+ switch (ePersistCategory) {
+ case eFrameworkunifiedFactoryData: {
+ l_cNewPath.append(FACTORYDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedFactoryCustomerData: {
+ l_cNewPath.append(FACTORYCUSTOMERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedDealerData: {
+ l_cNewPath.append(DEALERDATADIR);
+ }
+ break;
+
+ case eFrameworkunifiedUserData:
+ default: {
+ l_cNewPath.append(USERDATADIR);
+ l_cNewPath.append(ALLUSERAPPDATADIR);
+ }
+ break;
+ }
+
+ l_cNewPath.append(IMMEDIATEDATADIR);
+ l_cNewPath.append(l_cTempPath);
+
+ if (0 == access(l_cNewPath.c_str(), F_OK)) {
+ l_cPath.assign(l_cNewPath);
+ } else {
+ l_cOldPath.append(l_cTempPath);
+
+ if (0 == access(l_cOldPath.c_str(), F_OK)) {
+ l_cPath.assign(l_cOldPath);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ size_t PersistData;
+ // Open and read from a file
+ l_fFilePtr = fopen(l_cPath.c_str(), "re");
+ if (NULL != l_fFilePtr) {
+ // read notification info structure
+ PersistData = fread(&l_ptImmediatePersistentData, 1, sizeof(l_ptImmediatePersistentData), l_fFilePtr);
+ if (PersistData == sizeof(l_ptImmediatePersistentData)) {
+ *uiDataSize = l_ptImmediatePersistentData.dataSize;
+ } else {
+ *uiDataSize = static_cast<UI_32>(PersistData);
+ }
+ fclose(l_fFilePtr);
+ }
+ }
+
+ sem_post(&g_FileAccessSemaphore);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+
+ sem_destroy(&g_FileAccessSemaphore);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SynchronousMovePersistentData
+/// API to move all the immediate notification data from f_cSrcDir directory to
+/// f_cDestDir directory
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SynchronousMovePersistentData(PCSTR f_cSrcDir,
+ PCSTR f_cDestDir) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != f_cSrcDir && NULL != f_cDestDir) {
+ if (0 == sem_init(&g_FileAccessSemaphore, 1, 1)) {
+ if (sem_wait(&g_FileAccessSemaphore) == 0) { // LCOV_EXCL_BR_LINE 5: sem_init's error case
+ if (DoesDirecotryExist(f_cSrcDir)) { // LCOV_EXCL_BR_LINE 5: sem_wait's error case
+ if (!DoesDirecotryExist(f_cDestDir)) {
+ l_eStatus = CreateDirectory(f_cDestDir);
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ DIR *l_pDir = NULL;
+ struct dirent *l_pdirent = NULL;
+
+ std::string l_cSrcPath = "";
+ std::string l_cDestPath = "";
+
+ if (NULL != (l_pDir = opendir(f_cSrcDir))) {
+ while (NULL != (l_pdirent = readdir(l_pDir))) {
+ if (0 != std::strcmp(l_pdirent->d_name, ".") &&
+ 0 != std::strcmp(l_pdirent->d_name, "..")) {
+ l_cSrcPath.assign(f_cSrcDir);
+ l_cSrcPath.append(l_pdirent->d_name);
+
+ l_cDestPath.assign(f_cDestDir);
+ l_cDestPath.append(l_pdirent->d_name);
+
+ // move the old app user data to the UserData fodler
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ closedir(l_pDir);
+
+ sync();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ }
+ }
+
+ sem_post(&g_FileAccessSemaphore);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ sem_destroy(&g_FileAccessSemaphore);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_ResourceControler/src/ns_resource_controler.cpp b/video_in_hal/nsframework/framework_unified/client/NS_ResourceControler/src/ns_resource_controler.cpp
new file mode 100755
index 0000000..5122e39
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_ResourceControler/src/ns_resource_controler.cpp
@@ -0,0 +1,168 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <pthread.h>
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_resource_controler.h>
+
+#include <map>
+#include <string>
+#include <utility>
+
+struct frameworkunifiedResource {
+ int ref_counter;
+ long resource; // NOLINT (readability/nolint)
+};
+
+typedef std::map<std::string, frameworkunifiedResource> frameworkunifiedResourceTable_t;
+typedef std::map<long, std::string> frameworkunifiedResourceTableR_t; // NOLINT (readability/nolint)
+
+struct frameworkunifiedResourceTable {
+ frameworkunifiedResourceTable_t resTable;
+ frameworkunifiedResourceTableR_t resTableR;
+};
+
+typedef std::map<std::string, frameworkunifiedResourceTable> frameworkunifiedResourceModuleTable_t;
+
+static __thread frameworkunifiedResourceModuleTable_t *frameworkunifiedResourceModuleTable;
+
+static frameworkunifiedResource *frameworkunifiedSearchResourse(const char *mod, const char *key) {
+ if (frameworkunifiedResourceModuleTable == NULL) {
+ frameworkunifiedResourceModuleTable = new frameworkunifiedResourceModuleTable_t;
+ /*
+ * @todo
+ * There is no release processing for "new frameworkunifiedResourceModuleTable_t" created under McOpenMonitor() (Valgrind pointed).
+ */
+ }
+ frameworkunifiedResourceModuleTable_t::iterator mod_it = frameworkunifiedResourceModuleTable->find(mod);
+ if (mod_it == frameworkunifiedResourceModuleTable->end()) {
+ return NULL;
+ }
+
+ frameworkunifiedResourceTable_t::iterator res_it = mod_it->second.resTable.find(key);
+ if (res_it == mod_it->second.resTable.end()) {
+ return NULL;
+ }
+
+ return &res_it->second;
+}
+
+int frameworkunifiedGetResource(const char *mod, const char *key, long *resource) { // NOLINT (readability/nolint)
+ frameworkunifiedResource *r = frameworkunifiedSearchResourse(mod, key);
+ if (r == NULL) {
+ return -1;
+ }
+ if (resource == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "resource is NULL");
+ return -1;
+ }
+ *resource = r->resource;
+ return 0;
+}
+
+int frameworkunifiedAcquireResouce(const char *mod, const char *key, long *resource) { // NOLINT (readability/nolint)
+ frameworkunifiedResource *r = frameworkunifiedSearchResourse(mod, key);
+ if (r == NULL) {
+ return -1;
+ }
+ *resource = r->resource;
+ return ++(r->ref_counter);
+}
+
+int frameworkunifiedReleaseResouce(const char *mod, const char *key) {
+ frameworkunifiedResource *r = frameworkunifiedSearchResourse(mod, key);
+ if (r == NULL) {
+ return -1;
+ }
+ return --(r->ref_counter);
+}
+
+int frameworkunifiedSearchResourseKey(const char *mod, long resource, const char **key) { // NOLINT (readability/nolint)
+ if (frameworkunifiedResourceModuleTable == NULL) {
+ frameworkunifiedResourceModuleTable = new frameworkunifiedResourceModuleTable_t;
+ }
+ frameworkunifiedResourceModuleTable_t::iterator mod_it = frameworkunifiedResourceModuleTable->find(mod);
+ if (mod_it == frameworkunifiedResourceModuleTable->end()) {
+ return -1;
+ }
+
+ frameworkunifiedResourceTableR_t::iterator resR_it = mod_it->second.resTableR.find(resource);
+ if (resR_it == mod_it->second.resTableR.end()) {
+ return -1;
+ }
+
+ *key = (resR_it->second).c_str();
+ return 0;
+}
+
+int frameworkunifiedRegistResouce(const char *mod, const char *key, long resource, // NOLINT (readability/nolint)
+ int init_counter) {
+ int ret = 0;
+
+ if (frameworkunifiedResourceModuleTable == NULL) {
+ frameworkunifiedResourceModuleTable = new frameworkunifiedResourceModuleTable_t;
+ }
+ frameworkunifiedResourceModuleTable_t::iterator mod_it = frameworkunifiedResourceModuleTable->find(mod);
+
+ if (mod_it == frameworkunifiedResourceModuleTable->end()) {
+ frameworkunifiedResourceTable mod_res;
+ frameworkunifiedResourceModuleTable->insert(std::make_pair(mod, mod_res)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ mod_it = frameworkunifiedResourceModuleTable->find(mod); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ if (mod_it->second.resTable.find(key) == mod_it->second.resTable.end()) {
+ frameworkunifiedResource regist_res;
+ regist_res.ref_counter = init_counter;
+ regist_res.resource = resource;
+ mod_it->second.resTable.insert(std::make_pair(key, regist_res));
+ mod_it->second.resTableR.insert(std::make_pair(resource, key));
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __func__, "Key(%s) already regist", key != 0 ? key : NULL);
+ // LCOV_EXCL_BR_STOP
+ ret = -1;
+ }
+
+ return ret;
+}
+
+int frameworkunifiedUnregistResouce(const char *mod, const char *key) {
+ if (frameworkunifiedResourceModuleTable == NULL) {
+ frameworkunifiedResourceModuleTable = new frameworkunifiedResourceModuleTable_t;
+ }
+ frameworkunifiedResourceModuleTable_t::iterator mod_it = frameworkunifiedResourceModuleTable->find(mod);
+
+ if (mod_it == frameworkunifiedResourceModuleTable->end()) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __func__, "Mod(%s) undefined", mod != 0 ? mod : NULL);
+ // LCOV_EXCL_BR_STOP
+ } else {
+ frameworkunifiedResourceTable_t::iterator res_it = mod_it->second.resTable.find(key);
+ if (res_it != mod_it->second.resTable.end()) {
+ long resource = res_it->second.resource; // NOLINT (readability/nolint)
+ mod_it->second.resTable.erase(key);
+
+ if (mod_it->second.resTableR.find(resource) != mod_it->second.resTableR.end()) {
+ mod_it->second.resTableR.erase(resource);
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __func__, "Key(%s) no regist", key != 0 ? key : NULL);
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ return 0;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_RingBuffer/src/ns_ringbuffer.cpp b/video_in_hal/nsframework/framework_unified/client/NS_RingBuffer/src/ns_ringbuffer.cpp
new file mode 100755
index 0000000..1fbc5b5
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_RingBuffer/src/ns_ringbuffer.cpp
@@ -0,0 +1,1029 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSRingBuffer
+/// \brief This file contains implementation of class CNSRingBuffer.
+/// This class provides API to open, read, write and close ring buffer
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+
+#include <native_service/ns_ringbuffer.h>
+#include <native_service/cl_lock.h>
+
+#include <string>
+
+#define RBUF_HEADER_EXT "Hdr"
+#define RBUF_RETRY_SLEEP (1000)
+#define RBUF_RETRY_COUNT (8)
+#define RBUF_PAGE_SIZE (4096)
+#define RBUF_PAGE_ALIGN(p) ((p / RBUF_PAGE_SIZE) * RBUF_PAGE_SIZE)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSRingBuffer
+/// Parameterized Constructor of CNSRingBuffer class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSRingBuffer::CNSRingBuffer(const std::string &f_cMappedFilePath, const UI_32 f_uiSize, int f_lid):
+ m_cMappedFilePath(f_cMappedFilePath), m_uiRingBuffSize(f_uiSize), m_pRbufMtx(NULL), m_pRbufHdr(NULL), m_pRbuf(NULL),
+ m_lid(f_lid), m_pLockAddr(NULL), m_siProcessLastWrtPage(-1) { // LCOV_EXCL_BR_LINE 11: except branch
+ m_cMappedFileHdrPath = f_cMappedFilePath;
+ m_cMappedFileHdrPath.append(RBUF_HEADER_EXT); // LCOV_EXCL_BR_LINE 11: except branch
+
+ m_cRbufMtxName = f_cMappedFilePath;
+ std::size_t found = m_cRbufMtxName.find_first_of('/');
+ while (found != std::string::npos) {
+ m_cRbufMtxName[found] = '_';
+ found = m_cRbufMtxName.find_first_of('/', found + 1);
+ }
+ m_cRbufMtxName[0] = '/';
+ pthread_mutex_init(&m_tOpenMutex, NULL);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSRingBuffer
+/// Constructor of CNSRingBuffer class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSRingBuffer::CNSRingBuffer():
+ m_cMappedFilePath(""), m_uiRingBuffSize(0), m_pRbufMtx(NULL), m_pRbufHdr(NULL), m_pRbuf(NULL), m_lid(-1),
+ m_pLockAddr(NULL), m_siProcessLastWrtPage(-1) {
+ pthread_mutex_init(&m_tOpenMutex, NULL);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNSRingBuffer
+/// Destructor of CNSRingBuffer class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSRingBuffer::~CNSRingBuffer() {
+ if (NULL != m_pRbufHdr) {
+ // un-map the ring buffer object
+ Close();
+
+ m_pRbufHdr = NULL;
+ m_pRbufMtx = NULL;
+ }
+ pthread_mutex_destroy(&m_tOpenMutex);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Open
+/// This function opens and maps the ring buffer object.
+/// It creates the ring buffer if it does not exists.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::Open() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusErrOther;
+
+ pthread_mutex_lock(&m_tOpenMutex);
+
+ if (NULL == m_pRbufMtx) {
+ // Open ring buffer mutex
+ if (eFrameworkunifiedStatusOK != (l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pRbufMtx),
+ m_cRbufMtxName, sizeof(NSRingBufferMtx)))) {
+ if (ENOENT == errno) {
+ errno = EOK;
+
+
+// if (eFrameworkunifiedStatusOK == CreateRBMutex()) {
+ EFrameworkunifiedStatus l_eStatus1 = CreateRBMutex();
+ if ((l_eStatus1 == eFrameworkunifiedStatusOK) || (l_eStatus1 == eFrameworkunifiedStatusDuplicate)) {
+
+ l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pRbufMtx), m_cRbufMtxName, sizeof(NSRingBufferMtx));
+ }
+ }
+ } else {
+ if (m_pRbufMtx->m_lid != m_lid) {
+ // Different Lock ID in constructor parameter and mutex object
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (m_lid >= 0 && NULL == m_pLockAddr) {
+ CL_LockProcessInit();
+ if ((m_pLockAddr = CL_LockMap(m_lid)) == MAP_FAILED) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (NULL == m_pRbufHdr) {
+ // Open header ring buffer
+ if (eFrameworkunifiedStatusOK != (l_eStatus = Map(reinterpret_cast<PVOID *>(&m_pRbufHdr),
+ m_cMappedFileHdrPath, sizeof(NSRingBufferHdr)))) {
+ if (ENOENT == errno) { // ring buffer is not created yet
+ errno = EOK;
+
+ // Create ring buffer
+
+// if (eFrameworkunifiedStatusOK == CreateRBHeader()) {
+ EFrameworkunifiedStatus l_eStatus1 = CreateRBHeader();
+ if ((l_eStatus1 == eFrameworkunifiedStatusOK) || (l_eStatus1 == eFrameworkunifiedStatusDuplicate)) {
+
+ // Retry to open
+ l_eStatus = Map(reinterpret_cast<PVOID *>(&m_pRbufHdr),
+ m_cMappedFileHdrPath, sizeof(NSRingBufferHdr));
+
+// }
+ } else {
+ l_eStatus = l_eStatus1;
+ }
+
+ }
+ } else {
+
+#if 0
+ LockMtx();
+
+ struct stat st;
+ int ret = stat(m_cMappedFilePath.c_str(), &st);
+
+ if (m_uiRingBuffSize == 0) {
+ if (ret == 0) { // LCOV_EXCL_BR_LINE 5:stat's error case.
+ // LCOV_EXCL_START 5: stat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if ((UI_32)st.st_size != m_pRbufHdr->m_uiRingBufferSize || (UI_32)st.st_size < m_pRbufHdr->m_uiReadPtr
+ || (UI_32)st.st_size < m_pRbufHdr->m_uiWritePtr) {
+ memset(m_pRbufHdr, 0, sizeof(NSRingBufferHdr));
+ m_pRbufHdr->m_uiRingBufferSize = static_cast<UI_32>(st.st_size);
+ unlink(m_cMappedFilePath.c_str());
+ }
+ m_uiRingBuffSize = static_cast<UI_32>(st.st_size);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ if (m_uiRingBuffSize != m_pRbufHdr->m_uiRingBufferSize || m_uiRingBuffSize < m_pRbufHdr->m_uiReadPtr
+ || m_uiRingBuffSize < m_pRbufHdr->m_uiWritePtr || (ret == 0 && m_uiRingBuffSize != (UI_32)st.st_size)) {
+ memset(m_pRbufHdr, 0, sizeof(NSRingBufferHdr));
+ m_pRbufHdr->m_uiRingBufferSize = m_uiRingBuffSize;
+ unlink(m_cMappedFilePath.c_str());
+ }
+ }
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ struct stat st;
+ int ret = stat(m_cMappedFilePath.c_str(), &st);
+
+ if (m_uiRingBuffSize == 0) {
+ if (ret == 0) {
+ if ((UI_32)st.st_size != m_pRbufHdr->m_uiRingBufferSize || (UI_32)st.st_size < m_pRbufHdr->m_uiReadPtr ||
+ (UI_32)st.st_size < m_pRbufHdr->m_uiWritePtr) {
+ memset(m_pRbufHdr, 0, sizeof(NSRingBufferHdr));
+ m_pRbufHdr->m_uiRingBufferSize = static_cast<UI_32>(st.st_size);
+ unlink(m_cMappedFilePath.c_str());
+ }
+ m_uiRingBuffSize = static_cast<UI_32>(st.st_size);
+ }
+ } else {
+ if (m_uiRingBuffSize != m_pRbufHdr->m_uiRingBufferSize || m_uiRingBuffSize < m_pRbufHdr->m_uiReadPtr ||
+ m_uiRingBuffSize < m_pRbufHdr->m_uiWritePtr || (ret == 0 && m_uiRingBuffSize != (UI_32)st.st_size)) {
+ memset(m_pRbufHdr, 0, sizeof(NSRingBufferHdr));
+ m_pRbufHdr->m_uiRingBufferSize = m_uiRingBuffSize;
+ unlink(m_cMappedFilePath.c_str());
+ }
+ }
+
+ UnlockMtx();
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ munmap(m_pRbufHdr, sizeof(NSRingBufferHdr));
+ m_pRbufHdr = NULL;
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus && 0 != m_uiRingBuffSize) {
+ if (NULL == m_pRbuf) {
+ // Open ring buffer data buffer, create if not exists
+ if (eFrameworkunifiedStatusOK != (l_eStatus = Map(reinterpret_cast<PVOID *>(&m_pRbuf),
+ m_cMappedFilePath, m_uiRingBuffSize))) {
+ if (ENOENT == errno) { // ring buffer is not created yet
+ // Create ring buffer
+
+// if (eFrameworkunifiedStatusOK == CreateRBDataBuffer()) {
+ EFrameworkunifiedStatus l_eStatus1 = CreateRBDataBuffer();
+ if ((l_eStatus1 == eFrameworkunifiedStatusOK) || (l_eStatus1 == eFrameworkunifiedStatusDuplicate)) {
+
+ // Retry to open
+ l_eStatus = Map(reinterpret_cast<PVOID *>(&m_pRbuf),
+ m_cMappedFilePath, m_uiRingBuffSize);
+ }
+ }
+ }
+ }
+ }
+
+ pthread_mutex_unlock(&m_tOpenMutex);
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsOpen
+/// This function is used to check whether the ring buffer is opened or not.
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNSRingBuffer::IsOpen() {
+ return NULL == m_pRbufHdr ? FALSE : TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Close
+/// This function closes the ring buffer object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::Close() {
+ if (NULL != m_pLockAddr) {
+ CL_LockUnmap(m_pLockAddr);
+ }
+
+ EFrameworkunifiedStatus l_eStatus1 = UnMap(m_pRbufHdr, sizeof(NSRingBufferHdr));
+ m_pRbufHdr = NULL;
+
+ EFrameworkunifiedStatus l_eStatus2 = eFrameworkunifiedStatusOK;
+ if (0 != m_uiRingBuffSize) {
+ l_eStatus2 = UnMap(m_pRbuf, m_uiRingBuffSize);
+ m_pRbuf = NULL;
+ }
+
+ EFrameworkunifiedStatus l_eStatus3 = UnMap(m_pRbufMtx, sizeof(NSRingBufferMtx));
+ m_pRbufMtx = NULL;
+
+ return (eFrameworkunifiedStatusOK != l_eStatus1 || eFrameworkunifiedStatusOK != l_eStatus2 ||
+ eFrameworkunifiedStatusOK != l_eStatus3) ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Read
+/// This function reads data from the ring buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSRingBuffer::Read(PSTR f_pBuffer, const UI_32 f_uilength) {
+ SI_32 l_iReadSize = -1;
+
+ if ((NULL != f_pBuffer) && (NULL != m_pRbufHdr) && (0 != f_uilength)) {
+ UI_32 l_uiDataSizeToRead = 0;
+
+ // Remaining buffer size from read pointer to end of the buffer
+ UI_32 l_uiRemainSize = 0;
+
+
+#if 0
+ LockMtx();
+
+ // if ring buffer size is changed by some other process, remap the updated buffer size in this process
+ // ring buffer size can only be changed if the initial size is 0.
+ if (m_uiRingBuffSize != m_pRbufHdr->m_uiRingBufferSize) {
+ if (eFrameworkunifiedStatusOK == Map(reinterpret_cast<PVOID *>(&m_pRbuf),
+ m_cMappedFilePath, m_pRbufHdr->m_uiRingBufferSize)) {
+ m_uiRingBuffSize = m_pRbufHdr->m_uiRingBufferSize;
+ }
+ }
+
+ if (NULL != m_pRbuf) {
+ l_uiRemainSize = m_uiRingBuffSize - m_pRbufHdr->m_uiReadPtr;
+
+ // Round read data size depending on un-read data size in the buffer
+ l_uiDataSizeToRead = m_pRbufHdr->m_uiUnReadSize < f_uilength ? m_pRbufHdr->m_uiUnReadSize : f_uilength;
+
+ if (l_uiRemainSize < l_uiDataSizeToRead) {
+ // Wrapping read
+ memcpy(f_pBuffer, m_pRbuf + m_pRbufHdr->m_uiReadPtr, l_uiRemainSize);
+ memcpy(f_pBuffer + l_uiRemainSize, m_pRbuf, l_uiDataSizeToRead - l_uiRemainSize);
+ m_pRbufHdr->m_uiReadPtr = l_uiDataSizeToRead - l_uiRemainSize;
+ } else {
+ memcpy(f_pBuffer, m_pRbuf + m_pRbufHdr->m_uiReadPtr, l_uiDataSizeToRead);
+
+ m_pRbufHdr->m_uiReadPtr += l_uiDataSizeToRead;
+
+ // Read pointer is the end of the buffer
+ if (m_pRbufHdr->m_uiReadPtr == m_uiRingBuffSize) {
+ m_pRbufHdr->m_uiReadPtr = 0;
+ }
+ }
+
+ m_pRbufHdr->m_uiUnReadSize -= l_uiDataSizeToRead; // Update un-read data size
+
+ l_iReadSize = l_uiDataSizeToRead;
+ }
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ // if ring buffer size is changed by some other process, remap the updated buffer size in this process
+ // ring buffer size can only be changed if the initial size is 0.
+ if (m_uiRingBuffSize != m_pRbufHdr->m_uiRingBufferSize) {
+ if (eFrameworkunifiedStatusOK == Map(reinterpret_cast<PVOID *>(&m_pRbuf),
+ m_cMappedFilePath, m_pRbufHdr->m_uiRingBufferSize)) {
+ m_uiRingBuffSize = m_pRbufHdr->m_uiRingBufferSize;
+ }
+ }
+
+ if (NULL != m_pRbuf) {
+ l_uiRemainSize = m_uiRingBuffSize - m_pRbufHdr->m_uiReadPtr;
+
+ // Round read data size depending on un-read data size in the buffer
+ l_uiDataSizeToRead = m_pRbufHdr->m_uiUnReadSize < f_uilength ? m_pRbufHdr->m_uiUnReadSize : f_uilength;
+
+ if (l_uiRemainSize < l_uiDataSizeToRead) {
+ // Wrapping read
+ memcpy(f_pBuffer, m_pRbuf + m_pRbufHdr->m_uiReadPtr, l_uiRemainSize);
+ memcpy(f_pBuffer + l_uiRemainSize, m_pRbuf, l_uiDataSizeToRead - l_uiRemainSize);
+ m_pRbufHdr->m_uiReadPtr = l_uiDataSizeToRead - l_uiRemainSize;
+ } else {
+ memcpy(f_pBuffer, m_pRbuf + m_pRbufHdr->m_uiReadPtr, l_uiDataSizeToRead);
+
+ m_pRbufHdr->m_uiReadPtr += l_uiDataSizeToRead;
+
+ // Read pointer is the end of the buffer
+ if (m_pRbufHdr->m_uiReadPtr == m_uiRingBuffSize) {
+ m_pRbufHdr->m_uiReadPtr = 0;
+ }
+ }
+
+ m_pRbufHdr->m_uiUnReadSize -= l_uiDataSizeToRead; // Update un-read data size
+
+ l_iReadSize = l_uiDataSizeToRead;
+ }
+
+ UnlockMtx();
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ l_iReadSize = 0;
+ }
+
+ }
+
+ return l_iReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Write
+/// This function writes the data into the ring buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSRingBuffer::Write(PCSTR f_pBuffer, const UI_32 f_uilength) {
+ SI_32 l_iWriteSize = -1;
+
+ // size available in buffer
+ UI_32 l_uiRemainSize = 0;
+
+ if (NULL != m_pRbufHdr && NULL != m_pRbuf && NULL != f_pBuffer && f_uilength <= m_uiRingBuffSize) { // LCOV_EXCL_BR_LINE 11:except branch
+#if 0
+ LockMtx();
+
+ UI_32 l_uiLastPage = RBUF_PAGE_ALIGN(m_pRbufHdr->m_uiWritePtr);
+ l_uiRemainSize = m_uiRingBuffSize - m_pRbufHdr->m_uiWritePtr;
+
+ if (m_siProcessLastWrtPage >= 0) {
+ if ((UI_32)m_siProcessLastWrtPage != l_uiLastPage) {
+ if (madvise(m_pRbuf + m_siProcessLastWrtPage, RBUF_PAGE_SIZE, MADV_DONTNEED) < 0) {
+ fprintf(stderr, "[CNSRingBuffer::Write] madvise(%p) error: %s\n",
+ m_pRbuf + m_siProcessLastWrtPage, strerror(errno));
+ }
+ }
+ }
+
+ // Write data to the buffer
+ if (l_uiRemainSize < f_uilength) {
+ // Wrapping write
+ memcpy(m_pRbuf + m_pRbufHdr->m_uiWritePtr, f_pBuffer, l_uiRemainSize);
+ memcpy(m_pRbuf, f_pBuffer + l_uiRemainSize, f_uilength - l_uiRemainSize);
+
+ // Update the write pointer
+ m_pRbufHdr->m_uiWritePtr = f_uilength - l_uiRemainSize;
+
+ // The buffer is full of valid data
+ m_pRbufHdr->m_bIsFull = TRUE;
+ } else {
+ memcpy(m_pRbuf + m_pRbufHdr->m_uiWritePtr, f_pBuffer, f_uilength);
+
+ // Update the write pointer
+ m_pRbufHdr->m_uiWritePtr += f_uilength;
+
+ // Write pointer is the end of the buffer
+ if (m_pRbufHdr->m_uiWritePtr == m_uiRingBuffSize) {
+ m_pRbufHdr->m_uiWritePtr = 0;
+
+ // The buffer is full of valid data
+ m_pRbufHdr->m_bIsFull = TRUE;
+ }
+ }
+
+ // Update un-read data size
+ m_pRbufHdr->m_uiUnReadSize += f_uilength;
+
+ // Set read pointer to be same as write pointer if write pointer exceeds the read pointer
+ if (m_uiRingBuffSize < m_pRbufHdr->m_uiUnReadSize) {
+ m_pRbufHdr->m_uiReadPtr = m_pRbufHdr->m_uiWritePtr;
+ m_pRbufHdr->m_uiUnReadSize = m_uiRingBuffSize;
+ }
+
+ while (l_uiLastPage != RBUF_PAGE_ALIGN(m_pRbufHdr->m_uiWritePtr)) {
+ if (madvise(m_pRbuf + l_uiLastPage, RBUF_PAGE_SIZE, MADV_DONTNEED) < 0) {
+ fprintf(stderr, "[CNSRingBuffer::Write] madvise(%p) error: %s\n", m_pRbuf + l_uiLastPage, strerror(errno));
+ }
+ l_uiLastPage += RBUF_PAGE_SIZE;
+ if (l_uiLastPage >= m_uiRingBuffSize) {
+ l_uiLastPage = 0;
+ }
+ }
+ m_siProcessLastWrtPage = (SI_32)l_uiLastPage;
+
+ UnlockMtx();
+
+ l_iWriteSize = f_uilength;
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ UI_32 l_uiLastPage = RBUF_PAGE_ALIGN(m_pRbufHdr->m_uiWritePtr);
+ l_uiRemainSize = m_uiRingBuffSize - m_pRbufHdr->m_uiWritePtr;
+
+ if (m_siProcessLastWrtPage >= 0) {
+ if ((UI_32)m_siProcessLastWrtPage != l_uiLastPage) {
+ if (madvise(m_pRbuf + m_siProcessLastWrtPage, RBUF_PAGE_SIZE, MADV_DONTNEED) < 0) {
+ fprintf(stderr, "[CNSRingBuffer::Write] madvise(%p) error: %s\n",
+ m_pRbuf + m_siProcessLastWrtPage, strerror(errno));
+ }
+ }
+ }
+
+ // Write data to the buffer
+ if (l_uiRemainSize < f_uilength) {
+ // Wrapping write
+ memcpy(m_pRbuf + m_pRbufHdr->m_uiWritePtr, f_pBuffer, l_uiRemainSize);
+ memcpy(m_pRbuf, f_pBuffer + l_uiRemainSize, f_uilength - l_uiRemainSize);
+
+ // Update the write pointer
+ m_pRbufHdr->m_uiWritePtr = f_uilength - l_uiRemainSize;
+
+ // The buffer is full of valid data
+ m_pRbufHdr->m_bIsFull = TRUE;
+ } else {
+ memcpy(m_pRbuf + m_pRbufHdr->m_uiWritePtr, f_pBuffer, f_uilength);
+
+ // Update the write pointer
+ m_pRbufHdr->m_uiWritePtr += f_uilength;
+
+ // Write pointer is the end of the buffer
+ if (m_pRbufHdr->m_uiWritePtr == m_uiRingBuffSize) {
+ m_pRbufHdr->m_uiWritePtr = 0;
+
+ // The buffer is full of valid data
+ m_pRbufHdr->m_bIsFull = TRUE;
+ }
+ }
+
+ // Update un-read data size
+ m_pRbufHdr->m_uiUnReadSize += f_uilength;
+
+ // Set read pointer to be same as write pointer if write pointer exceeds the read pointer
+ if (m_uiRingBuffSize < m_pRbufHdr->m_uiUnReadSize) {
+ m_pRbufHdr->m_uiReadPtr = m_pRbufHdr->m_uiWritePtr;
+ m_pRbufHdr->m_uiUnReadSize = m_uiRingBuffSize;
+ }
+
+ while (l_uiLastPage != RBUF_PAGE_ALIGN(m_pRbufHdr->m_uiWritePtr)) {
+ if (madvise(m_pRbuf + l_uiLastPage, RBUF_PAGE_SIZE, MADV_DONTNEED) < 0) {
+ fprintf(stderr, "[CNSRingBuffer::Write] madvise(%p) error: %s\n",
+ m_pRbuf + l_uiLastPage, strerror(errno));
+ }
+ l_uiLastPage += RBUF_PAGE_SIZE;
+ if (l_uiLastPage >= m_uiRingBuffSize) {
+ l_uiLastPage = 0;
+ }
+ }
+ m_siProcessLastWrtPage = (SI_32)l_uiLastPage;
+
+ UnlockMtx();
+
+ l_iWriteSize = f_uilength;
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ l_iWriteSize = 0;
+ }
+
+ }
+
+ return l_iWriteSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// DumpToFile
+/// This function writes all the data in the buffer into provided file f_pPath.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ ssize_t l_iSize = 0;
+
+ SI_32 fd = -1;
+
+ if (NULL == f_uiDumpSize) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ *f_uiDumpSize = 0;
+
+ if (NULL != f_pPath) {
+ if (NULL != m_pRbufHdr) {
+ // Open file
+ if (-1 != (fd = open(f_pPath, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0640))) {
+ if (NULL != m_pRbuf && 0 != m_uiRingBuffSize) {
+
+#if 0
+ LockMtx();
+ // Write buffer data to file
+ if (m_pRbufHdr->m_bIsFull) {
+ // Buffer has full of data (read data from write pointer)
+ if (-1 != (l_iSize = write(fd, m_pRbuf + m_pRbufHdr->m_uiWritePtr,
+ m_uiRingBuffSize - m_pRbufHdr->m_uiWritePtr))) {
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+
+ if (-1 != (l_iSize = write(fd, m_pRbuf, m_pRbufHdr->m_uiWritePtr))) {
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ }
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ // Write buffer data to file
+ if (m_pRbufHdr->m_bIsFull) {
+ // Buffer has full of data (read data from write pointer)
+ if (-1 != (l_iSize = write(fd, m_pRbuf + m_pRbufHdr->m_uiWritePtr,
+ m_uiRingBuffSize - m_pRbufHdr->m_uiWritePtr))) {
+
+// *f_uiDumpSize += l_iSize;
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+
+ if (-1 != (l_iSize = write(fd, m_pRbuf, m_pRbufHdr->m_uiWritePtr))) {
+
+// *f_uiDumpSize += l_iSize;
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ }
+
+ UnlockMtx();
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ }
+
+ } else if (NULL == m_pRbuf && 0 != m_uiRingBuffSize) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // do nothing
+ }
+
+ // Sync the file to force I/O operation completed
+ fsync(fd);
+
+ close(fd);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSize
+/// This function returns the number of unread bytes which can be read by Read().
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSRingBuffer::GetSize() {
+ SI_32 l_uiReadSize = -1;
+
+ if (NULL != m_pRbufHdr) {
+ l_uiReadSize = m_pRbufHdr->m_uiUnReadSize;
+ }
+
+ return l_uiReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearBuf
+/// This function clears the buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::ClearBuf() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pRbufHdr) {
+
+#if 0
+ LockMtx();
+
+ // Initialize the r/w pointers
+ m_pRbufHdr->m_uiReadPtr = 0;
+ m_pRbufHdr->m_uiWritePtr = 0;
+ m_pRbufHdr->m_uiUnReadSize = 0;
+ m_pRbufHdr->m_bIsFull = FALSE;
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ((ret = LockMtx()) == 0) {
+ // Initialize the r/w pointers
+ m_pRbufHdr->m_uiReadPtr = 0;
+ m_pRbufHdr->m_uiWritePtr = 0;
+ m_pRbufHdr->m_uiUnReadSize = 0;
+ m_pRbufHdr->m_bIsFull = FALSE;
+
+ UnlockMtx();
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ }
+
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReadPtrToWritePtr
+/// This function sets the position of read ptr to write ptr in buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::SetReadPtrToWritePtr() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pRbufHdr) {
+
+#if 0
+ LockMtx();
+
+ // Initialize the r/w pointers
+ m_pRbufHdr->m_uiReadPtr = m_pRbufHdr->m_uiWritePtr;
+ m_pRbufHdr->m_uiUnReadSize = 0;
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ // Initialize the r/w pointers
+ m_pRbufHdr->m_uiReadPtr = m_pRbufHdr->m_uiWritePtr;
+ m_pRbufHdr->m_uiUnReadSize = 0;
+
+ UnlockMtx();
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ }
+
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+//
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateRBMutex
+/// This function creates the shared memory object for mutex.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::CreateRBMutex() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of shared memory
+ SI_32 l_siId = -1;
+
+ // ring buffer mutex
+ NSRingBufferMtx *l_pRbufMtx = NULL;
+
+ if ((!m_cRbufMtxName.empty()) || (m_cRbufMtxName.size() <= NAME_MAX)) {
+ // Try to create shared memory
+ l_siId = shm_open(m_cRbufMtxName.c_str(), O_CREAT | O_EXCL | O_RDWR, 0640);
+
+ if (-1 != l_siId) {
+ // Set the size of shared memory
+ if (-1 != ftruncate(l_siId, sizeof(NSRingBufferMtx))) {
+ // Map the shared memory
+ l_pRbufMtx = reinterpret_cast<NSRingBufferMtx *>(mmap(NULL,
+ sizeof(NSRingBufferMtx), (PROT_READ | PROT_WRITE), MAP_SHARED, l_siId, 0));
+
+ if (MAP_FAILED != l_pRbufMtx) {
+ if (m_lid == -1) {
+ // mutex attribute
+ pthread_mutexattr_t l_tMtxAttr = {};
+
+ // Initialize mutex
+ pthread_mutexattr_init(&l_tMtxAttr);
+ pthread_mutexattr_setpshared(&l_tMtxAttr, PTHREAD_PROCESS_SHARED);
+ pthread_mutex_init(&l_pRbufMtx->m_tBufMutex, &l_tMtxAttr);
+ pthread_mutexattr_destroy(&l_tMtxAttr);
+
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ // CL_Lock
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ l_pRbufMtx->m_lid = m_lid;
+
+ // Once initialized un-map the shared memory
+ munmap(l_pRbufMtx, sizeof(NSRingBufferMtx));
+ }
+ }
+
+ close(l_siId);
+ } else if (EEXIST == errno) {
+ // Shared memory is already created
+ l_eStatus = eFrameworkunifiedStatusDuplicate;
+ } else {
+ // do nothing
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateRBHeader
+/// This function creates the ring buffer object for header.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::CreateRBHeader() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of ring buffer
+ SI_32 l_siFd = -1;
+
+ // ring buffer headers
+ NSRingBufferHdr *l_pRbufHdr = NULL;
+
+ if (!m_cMappedFileHdrPath.empty()) { // LCOV_EXCL_BR_LINE 11: except branch
+ // Try to create ring buffer
+ l_siFd = open(m_cMappedFileHdrPath.c_str(), O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, 0640);
+
+ if (-1 != l_siFd) {
+ // Set the size of ring buffer
+ if (-1 != ftruncate(l_siFd, sizeof(NSRingBufferHdr))) {
+ // Map the ring buffer
+ l_pRbufHdr = reinterpret_cast<NSRingBufferHdr *>(mmap(NULL,
+ sizeof(NSRingBufferHdr), (PROT_READ | PROT_WRITE), MAP_SHARED, l_siFd, 0));
+
+ if (MAP_FAILED != l_pRbufHdr) {
+
+#if 0
+ LockMtx();
+
+ // Initialize the r/w pointers
+ l_pRbufHdr->m_uiReadPtr = 0;
+ l_pRbufHdr->m_uiWritePtr = 0;
+ l_pRbufHdr->m_uiUnReadSize = 0;
+ l_pRbufHdr->m_bIsFull = FALSE;
+ l_pRbufHdr->m_uiRingBufferSize = m_uiRingBuffSize;
+
+ UnlockMtx();
+#endif
+ int ret;
+ if ( (ret = LockMtx()) == 0) {
+ // Initialize the r/w pointers
+ l_pRbufHdr->m_uiReadPtr = 0;
+ l_pRbufHdr->m_uiWritePtr = 0;
+ l_pRbufHdr->m_uiUnReadSize = 0;
+ l_pRbufHdr->m_bIsFull = FALSE;
+ l_pRbufHdr->m_uiRingBufferSize = m_uiRingBuffSize;
+
+ UnlockMtx();
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ fprintf(stderr, "[%s] LockMtx error: %s\n", __PRETTY_FUNCTION__, strerror(ret));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+
+ // Once initialized un-map the ring buffer
+ munmap(l_pRbufHdr, sizeof(NSRingBufferHdr));
+ }
+ }
+
+ close(l_siFd);
+ } else if (EEXIST == errno) {
+ // ring buffer is already created
+ l_eStatus = eFrameworkunifiedStatusDuplicate;
+ } else {
+ // do nothing
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateRBDataBuffer
+/// This function creates the ring buffer object for data buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::CreateRBDataBuffer() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of ring buffer
+ SI_32 l_siFd = -1;
+
+ if (!m_cMappedFilePath.empty()) {
+ // Try to create ring buffer
+ l_siFd = open(m_cMappedFilePath.c_str(), O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, 0640);
+
+ if (-1 != l_siFd) {
+ // Set the size of ring buffer
+ if (-1 != ftruncate(l_siFd, m_uiRingBuffSize)) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ close(l_siFd);
+ } else if (EEXIST == errno) {
+ // ring buffer is already created
+ l_eStatus = eFrameworkunifiedStatusDuplicate;
+ } else {
+ // do nothing
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// MapRBHeader
+/// This function open and maps in process space.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::Map(PVOID *f_pRbuf, const std::string &f_cMappedFile, const UI_32 f_uiRbufSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of ring buffer
+ SI_32 l_siFd = -1;
+
+ // ring buffer headers
+ PVOID l_pRbuf = NULL;
+
+ // Open ring buffer
+ l_siFd = open(f_cMappedFile.c_str(), O_RDWR | O_CLOEXEC, NULL);
+
+ if (-1 != l_siFd) {
+ if (CheckSize(l_siFd, f_uiRbufSize) == eFrameworkunifiedStatusOK) {
+ // Map the ring buffer into its memory space
+ l_pRbuf = mmap(NULL, f_uiRbufSize, (PROT_READ | PROT_WRITE), MAP_SHARED, l_siFd, 0);
+
+ if (MAP_FAILED != l_pRbuf) {
+ *f_pRbuf = l_pRbuf;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+
+ close(l_siFd);
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CheckSize
+/// This function check mmap size
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::CheckSize(int fd, off_t size) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ struct stat st;
+ int i;
+
+ for (i = 0; i < RBUF_RETRY_COUNT; i++) {
+ if (fstat(fd, &st) < 0) {
+ fprintf(stderr, "[CNSRingBuffer::CheckSize] fstat error: %s\n", strerror(errno));
+ goto out;
+ }
+ if (st.st_size == size) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+ }
+ usleep(RBUF_RETRY_SLEEP);
+ }
+ if (i >= RBUF_RETRY_COUNT) {
+ errno = ENOMEM;
+ }
+
+out:
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// MapSM
+/// This function shm_open and maps the shared memory in process space.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::MapSM(PVOID *f_pShMem, const std::string &f_cShmName, const UI_32 f_uiShmSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of shared memory
+ SI_32 l_siId = -1;
+
+ // shared memory buffer headers
+ PVOID l_pShmBuf = NULL;
+
+ // Open shared memory
+ l_siId = shm_open(f_cShmName.c_str(), O_RDWR, 0640);
+
+ if (-1 != l_siId) {
+ if (CheckSize(l_siId, f_uiShmSize) == eFrameworkunifiedStatusOK) {
+ // Map the shared memory into its memory space
+ l_pShmBuf = mmap(NULL, f_uiShmSize, (PROT_READ | PROT_WRITE), MAP_SHARED, l_siId, 0);
+
+ if (MAP_FAILED != l_pShmBuf) {
+ *f_pShMem = l_pShmBuf;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+
+ close(l_siId);
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// UnMap
+/// This function unmaps object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSRingBuffer::UnMap(PVOID f_pRbuf, const UI_32 f_uiRbufSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // Un-map the ring buffer
+ if (NULL != f_pRbuf) {
+ if (0 != munmap(f_pRbuf, f_uiRbufSize)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+
+//void CNSRingBuffer::LockMtx() {
+// if (m_lid == -1) {
+// pthread_mutex_lock(&m_pRbufMtx->m_tBufMutex);
+// } else {
+// CL_LockGet(m_pLockAddr);
+// }
+//}
+int CNSRingBuffer::LockMtx() {
+ int ret = 0;
+
+ if (m_lid == -1) {
+ ret = pthread_mutex_lock(&m_pRbufMtx->m_tBufMutex);
+ } else {
+ ret = CL_LockGet(m_pLockAddr);
+ }
+
+ return ret;
+}
+
+
+void CNSRingBuffer::UnlockMtx() {
+ if (m_lid == -1) {
+ pthread_mutex_unlock(&m_pRbufMtx->m_tBufMutex);
+ } else {
+ CL_LockRelease(m_pLockAddr);
+ }
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/api/nsapi_sharedmem.cpp b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/api/nsapi_sharedmem.cpp
new file mode 100755
index 0000000..89c7421
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/api/nsapi_sharedmem.cpp
@@ -0,0 +1,431 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+ *
+ * FILENAME : nsapi_sharedmem.cpp
+ *
+ * DESCRIPTION : TestApp - NS_SharedMem
+ *
+ ************************************************************************/
+
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_shared_mem_if.h>
+#include <native_service/ns_transmit_log.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ss_version.h"
+#include "ns_unittest_internal.h"
+
+#define AVAILABLE_API
+#if defined(AVAILABLE_API)
+static CNSSharedMem *g_pTransmitLogSharedBuf = NULL;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemTransmitLogOpen
+/// Open the shared memory for transmit logging
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogOpen() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == g_pTransmitLogSharedBuf) {
+ // Create the instance
+ g_pTransmitLogSharedBuf = new(std::nothrow) CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ }
+
+ if (NULL != g_pTransmitLogSharedBuf) {
+ if (!g_pTransmitLogSharedBuf->IsOpen()) {
+ // maps the shared memory buffer
+ l_eStatus = g_pTransmitLogSharedBuf->Open();
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemTransmitLogClose
+/// Close the transmit logging shared memory
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogClose() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != g_pTransmitLogSharedBuf) {
+ // un-map the shared memory object
+ l_eStatus = g_pTransmitLogSharedBuf->Close();
+
+ delete g_pTransmitLogSharedBuf;
+ g_pTransmitLogSharedBuf = NULL;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemReadTransmitLog
+/// Reads transmit log from the shared memory buffer.
+////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemReadTransmitLog(PSTR f_pBuffer, const UI_32 f_uiLength, const BOOL f_bBlock) {
+ // no. of bytes read
+ SI_32 l_iReadSize = NS_SHM_ERROR;
+
+ if (NULL != g_pTransmitLogSharedBuf && NULL != f_pBuffer) {
+ // Writes log data into shared memory buffer
+ l_iReadSize = g_pTransmitLogSharedBuf->Read(f_pBuffer, f_uiLength, f_bBlock);
+ }
+
+ return l_iReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemWriteTransmitLog
+/// Write transmit log into the shared memory buffer.
+////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemWriteTransmitLog(PCSTR f_pBuffer, const UI_32 f_uiLength) {
+ // no. of bytes read
+ SI_32 l_iWriteSize = NS_SHM_ERROR;
+
+ if (NULL != g_pTransmitLogSharedBuf && NULL != f_pBuffer) {
+ // Writes log data into shared memory buffer
+ l_iWriteSize = g_pTransmitLogSharedBuf->Write(f_pBuffer, f_uiLength);
+ }
+
+ return l_iWriteSize;
+}
+#endif
+
+
+// For NsLog
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INFO, ZONE_WARN, ZONE_ERR
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+ LPRINT,
+ {
+ "Init", "Function", "Memory",
+ "", "", "",
+ "", "", "",
+ "", "", "",
+ "", "", "",
+ "", "", "",
+ "",
+ "Info", "Warning", "Error"
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+/** sleep */
+static int
+sleep_msec(int msec) {
+ struct timespec ts, rem;
+ ts.tv_sec = msec / 1000;
+ ts.tv_nsec = (msec % 1000) * 1000000;
+ int ret;
+ for (;;) {
+ ret = nanosleep(&ts, &rem);
+ if (ret == 0 || (ret < 0 && errno != EINTR)) {
+ break;
+ }
+ ts = rem;
+ }
+ return ret;
+}
+
+/** usage */
+void usage(void) {
+ printf("nsapi_sharedmem [command] [option]\n");
+ printf(" command: preset\n");
+#if !defined(AVAILABLE_API)
+ printf(" preset service_write\n");
+ printf(" preset service_write_read n\n");
+#endif
+ printf(" preset sharedmem_write\n");
+ printf(" preset sharedmem_write_read n\n");
+ printf(" preset write_6_A\n");
+ printf(" preset write_6_B\n");
+ printf(" preset write_7_A\n");
+ printf(" preset write_7_B\n");
+ printf(" command: manual\n");
+ printf(" manual ***\n");
+}
+
+/** main */
+int main(int argc, char *argv[]) {
+ int status = 0;
+
+ FRAMEWORKUNIFIED_SET_ZONES();
+
+ if (argc < 2) {
+ usage();
+ return 0;
+ } else {
+ char *command = argv[1];
+ int option = 0;
+
+ /* Execute command */
+ if (strcmp(command, "preset") == 0) {
+ if (argc > 2) {
+ char *preset = argv[2];
+ if (argc > 3) {
+ option = atoi(argv[3]);
+ }
+
+#if defined(AVAILABLE_API)
+ if (strcmp(preset, "sharedmem_write") == 0) {
+ NSUT_ASSERT(NSSharedMemTransmitLogOpen() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogOpen() error.");
+ SI_32 size = NSSharedMemWriteTransmitLog(argv[2], static_cast<UI_32>(strlen(argv[2]) + 1));
+ NSUT_ASSERT(size == (SI_32)(strlen(argv[2]) + 1), "NSSharedMemWriteTransmitLog() error.");
+ NSUT_ASSERT(NSSharedMemTransmitLogClose() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogClose() error.");
+ if (size != (SI_32)(strlen(argv[2]) + 1)) {
+ return -1;
+ }
+ } else if (strcmp(preset, "sharedmem_write_read") == 0) {
+ for (int i = 0; i < option; i++) {
+ NSUT_ASSERT(NSSharedMemTransmitLogOpen() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogOpen() error.");
+ SI_32 size = NSSharedMemWriteTransmitLog(argv[2], static_cast<UI_32>(strlen(argv[2]) + 1));
+ NSUT_ASSERT(size == (SI_32)(strlen(argv[2]) + 1), "NSSharedMemWriteTransmitLog() error.");
+ char f_pBuffer[100] = {0};
+ NSSharedMemReadTransmitLog(f_pBuffer, sizeof(f_pBuffer), FALSE);
+ NSUT_ASSERT(NSSharedMemTransmitLogClose() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogClose() error.");
+ }
+ }
+#else
+ if (strcmp(preset, "service_write") == 0) {
+ TMemID id = SetDataToShared(argv[2], strlen(argv[2]) + 1);
+ NSUT_ASSERT(id != BAD_MEM_ID, "SetDataToShared() error.");
+ if (id == BAD_MEM_ID) {
+ return -1;
+ }
+ } else if (strcmp(preset, "service_write_read") == 0) {
+ for (int i = 0; i < option; i++) {
+ EFrameworkunifiedStatus status;
+ TMemID id = SetDataToShared(argv[2], strlen(argv[2]) + 1);
+ NSUT_ASSERT(id != BAD_MEM_ID, "SetDataToShared() error.");
+ UI_32 size = GetLengthOfDataFromShared(id);
+ NSUT_ASSERT(size == (strlen(argv[2]) + 1), "NSSharedMemWriteTransmitLog() error.");
+ void *data[100] = { 0 };
+ status = GetDataFromShared(id, data, sizeof(data));
+ NSUT_ASSERT(eFrameworkunifiedStatusOK == status, "GetDataFromShared()");
+ status = DiscardDataFromShared(id);
+ NSUT_ASSERT(eFrameworkunifiedStatusOK == status, "DiscardDataFromShared()");
+ }
+ } else if (strcmp(preset, "sharedmem_write") == 0) {
+ NSUT_ASSERT(NSSharedMemTransmitLogOpen() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogOpen() error.");
+ SI_32 size = NSSharedMemWriteTransmitLog(argv[2], strlen(argv[2]) + 1);
+ NSUT_ASSERT(size == (SI_32)(strlen(argv[2]) + 1), "NSSharedMemWriteTransmitLog() error.");
+ NSUT_ASSERT(NSSharedMemTransmitLogClose() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogClose() error.");
+ if (size != (SI_32)(strlen(argv[2]) + 1)) {
+ return -1;
+ }
+ } else if (strcmp(preset, "sharedmem_write_read") == 0) {
+ for (int i = 0; i < option; i++) {
+ NSUT_ASSERT(NSSharedMemTransmitLogOpen() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogOpen() error.");
+ SI_32 size = NSSharedMemWriteTransmitLog(argv[2], strlen(argv[2]) + 1);
+ NSUT_ASSERT(size == (SI_32)(strlen(argv[2]) + 1), "NSSharedMemWriteTransmitLog() error.");
+ char f_pBuffer[100] = {0};
+ NSSharedMemReadTransmitLog(f_pBuffer, sizeof(f_pBuffer), FALSE);
+ NSUT_ASSERT(NSSharedMemTransmitLogClose() == eFrameworkunifiedStatusOK, "NSSharedMemTransmitLogClose() error.");
+ }
+ }
+#endif
+ else if (strcmp(preset, "write_6_A") == 0) { // NOLINT (readability/nolint)
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ sleep(2);
+ char f_pBuffer[100] = {0};
+ if (testObj->Read(f_pBuffer, sizeof(f_pBuffer), FALSE) != 7) {
+ status = -1;
+ }
+ if (memcmp(f_pBuffer, "ABCDEFG", 7) != 0) {
+ printf("memcmp() error.");
+ return -1;
+ }
+ if (testObj->Close() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+ } else if (strcmp(preset, "write_6_B") == 0) {
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ if (testObj->Write("ABCDEFG", static_cast<UI_32>(strlen("ABCDEFG"))) != 7) {
+ status = -1;
+ }
+ if (testObj->Close() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+ } else if (strcmp(preset, "write_7_A") == 0) {
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ sleep(2);
+ char f_pBuffer[100] = {0};
+ if (testObj->Read(f_pBuffer, sizeof(f_pBuffer), FALSE) == 7) {
+ status = -1;
+ }
+ if (testObj->Close() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+ } else if (strcmp(preset, "write_7_B") == 0) {
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() == eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ if (testObj->Write("ABCDEFG", static_cast<UI_32>(strlen("ABCDEFG"))) == 7) {
+ status = -1;
+ }
+ if (testObj->Close() == eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+ } else if (strcmp(preset, "stress_4") == 0) {
+ int i;
+ char *writeBuffer = new char[0x400]();
+ for (i = 0; i < 0x400; i++) {
+ writeBuffer[i] = static_cast<char>(i);
+ }
+
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ int timeout = 0;
+ int test_count = 0;
+ while ((timeout < 10) && (test_count < option)) {
+ if (testObj->GetSize() > (SI_32)(TRANSMIT_LOG_SHAREDMEM_SIZE - 0x800)) {
+ sleep_msec(100);
+ timeout++;
+ // printf("timeout = %d\n", timeout);
+ continue;
+ }
+ if (testObj->ClearBuf() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ if (testObj->SetReadPtrToWritePtr() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ if (testObj->Write(writeBuffer, 0x400) != 0x400) {
+ status = -1;
+ }
+ timeout = 0;
+ test_count++;
+ }
+ if (testObj->Close() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+
+ delete[] writeBuffer;
+ } else if (strcmp(preset, "stress_5") == 0) {
+ int i;
+ char *writeBuffer = new char[0x100]();
+ for (i = 0; i < 0x100; i++) {
+ writeBuffer[i] = static_cast<char>(0xff - i);
+ }
+
+ CNSSharedMem *testObj = new CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ if (testObj->Open() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ int timeout = 0;
+ int count = 0;
+ while (timeout < 10) {
+ int size = (count % 0xff) + 1;
+ if (testObj->GetSize() > (SI_32)(TRANSMIT_LOG_SHAREDMEM_SIZE - 0x800)) {
+ sleep_msec(100);
+ timeout++;
+ continue;
+ }
+ if (testObj->Write(&writeBuffer[0xff - size], size) != size) {
+ status = -1;
+ }
+ timeout = 0;
+ count++;
+ }
+ if (testObj->Close() != eFrameworkunifiedStatusOK) {
+ status = -1;
+ }
+ delete testObj;
+
+ delete[] writeBuffer;
+ } else {
+ usage();
+ }
+ } else {
+ usage();
+ }
+ } else if (strcmp(command, "manual") == 0) {
+ int testno;
+ char buf[32];
+ INT8 active = 1;
+
+ while (active) {
+ printf(" ----- imageapi ----------\n");
+ printf(" 0: debug_test()\n");
+ printf(" 1: gfx_ut_image_api()\n");
+ printf(" 2: gfx_ut_image_csv()\n");
+ printf(" q: quit\n");
+ printf(" -------------------------\n");
+
+ fgets(buf, sizeof(buf), stdin);
+ if (buf[0] == '\n') {
+ continue;
+ } else if (buf[0] == 'q' || buf[0] == 'Q') {
+ active = 0;
+ continue;
+ }
+ testno = atoi(buf);
+
+ switch (testno) {
+ case 0:
+ // debug_test();
+ break;
+ case 1:
+ // gfx_ut_image_api();
+ break;
+ case 2:
+ // gfx_ut_image_csv((char *)"it_image.csv");
+ break;
+ default:
+ break;
+ }
+ }
+ } else {
+ usage();
+ }
+ }
+ return status;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..dc225c4
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/makefile_PosixBasedOS001
@@ -0,0 +1,190 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_SharedMemIf
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_SharedMemIf
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS += -Wstrict-aliasing
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_SharedMem/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_UtilityCenter/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_shared_mem_if.cpp b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_shared_mem_if.cpp
new file mode 100755
index 0000000..e60a404
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_shared_mem_if.cpp
@@ -0,0 +1,254 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief SharedMemIf implementation
+///
+/// Implements interface functions to SharedMem service
+//////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_shared_mem_if.h> ///< Shared mem source interface file
+#include <native_service/ns_logger_if.h>
+
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+
+#define NS_SHM_HEADER_SIZE (48)
+
+/////////////////////////////////////////////////////////////////////////////
+/// Utility functions and classes
+
+static TMemID getclock(void) {
+ struct timespec tp;
+ if (clock_gettime(CLOCK_MONOTONIC_RAW, &tp) < 0) { // LCOV_EXCL_BR_LINE 5: clock_gettime's error case.
+ return 0;
+ }
+ return (TMemID)(((uint64_t)tp.tv_sec * 1000 * 1000 * 1000 + tp.tv_nsec) >> 8);
+}
+
+static size_t uitoa(unsigned int value, char *buf) {
+ static const char c[] = "0123456789abcdef";
+ int i;
+
+ if (buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "buf is NULL");
+ return 0;
+ }
+ for (i = 0; i < 8; i++) {
+ buf[i] = c[(value >> ((7 - i) * 4)) & 0xf];
+ }
+ buf[i] = '\0';
+
+ return i;
+}
+
+static inline void create_shmname(char *buf, TMemID id) {
+ if (buf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "buf is NULL");
+ return;
+ }
+ strcpy(buf, "nsshm_"); // NOLINT (readability/nolint)
+ buf += sizeof("nsshm_") - 1;
+ uitoa(id, buf);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+// Public interface function definitions
+
+TMemID SetDataToShared(const void *data, UI_32 dataBytes, const char *from, const char *to) {
+ TMemID id;
+ char shmname[16];
+ int fd;
+ void *addr = MAP_FAILED;
+
+ if (data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "data is NULL");
+ return BAD_MEM_ID;
+ }
+ if (from == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "from is NULL");
+ return BAD_MEM_ID;
+ }
+ if (to == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "to is NULL");
+ return BAD_MEM_ID;
+ }
+
+ if (dataBytes == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "DataSize is invalied(%d)", dataBytes);
+ return BAD_MEM_ID;
+ }
+
+ while (1) {
+ id = getclock();
+ create_shmname(shmname, id);
+
+ if ((fd = shm_open(shmname, O_CREAT | O_EXCL | O_RDWR, 0666)) < 0) {
+ if (errno == EEXIST) {
+ continue;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "shm_open: %s", strerror(errno));
+ return BAD_MEM_ID;
+ }
+ break;
+ }
+
+ if (ftruncate(fd, dataBytes + NS_SHM_HEADER_SIZE) < 0) { // LCOV_EXCL_BR_LINE 5: ftruncate's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "ftruncate: %s", strerror(errno));
+ id = BAD_MEM_ID;
+ goto exit;
+ }
+
+ if ((addr = mmap(NULL, dataBytes + NS_SHM_HEADER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "mmap: %s", strerror(errno));
+ id = BAD_MEM_ID;
+ goto exit;
+ }
+
+ strcpy(reinterpret_cast<char *>(addr), from); // NOLINT (readability/nolint)
+ strcpy(reinterpret_cast<char *>(addr) + (NS_SHM_HEADER_SIZE / 2), to); // NOLINT (readability/nolint)
+ /**
+ * @todo
+ * Specifying a large number (4097 or higher) for the Session Data Size for transmission results in a segmentation fault.
+ */
+ memcpy(reinterpret_cast<char *>(addr) + NS_SHM_HEADER_SIZE, data, dataBytes);
+
+exit:
+ close(fd);
+ if (addr != MAP_FAILED) {
+ munmap(addr, dataBytes + NS_SHM_HEADER_SIZE);
+ }
+ if (id == BAD_MEM_ID) {
+ shm_unlink(shmname);
+ }
+ return id;
+}
+
+EFrameworkunifiedStatus GetDataFromShared(TMemID id, void *data, UI_32 dataMaxBytes) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ char shmname[16];
+ int fd;
+ void *addr = MAP_FAILED;
+ struct stat sb;
+
+ if (id == BAD_MEM_ID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "ShMemID is invalied(%u)", id);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "data is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (dataMaxBytes == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "DataSize is invalied(%d)", dataMaxBytes);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ create_shmname(shmname, id);
+
+ if ((fd = shm_open(shmname, O_RDONLY, 0)) < 0) {
+ if (errno == ENOENT) {
+ eStatus = eFrameworkunifiedStatusInvldID;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "shm_open: %s", strerror(errno));
+ return eStatus;
+ }
+
+ if (fstat(fd, &sb) < 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "fstat: %s", strerror(errno));
+ goto exit;
+ }
+ if (sb.st_size - NS_SHM_HEADER_SIZE > static_cast<SI_64>(dataMaxBytes)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "DataSize is invalied(%d-%d)", dataMaxBytes, (int)sb.st_size);
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ goto exit;
+ }
+
+ if ((addr = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "mmap: %s", strerror(errno)); // LCOV_EXCL_LINE 5: mmap's error case.
+ goto exit;
+ }
+
+ memcpy(data, reinterpret_cast<char *>(addr) + NS_SHM_HEADER_SIZE, sb.st_size - NS_SHM_HEADER_SIZE);
+ eStatus = eFrameworkunifiedStatusOK;
+
+exit:
+ close(fd);
+ if (addr != MAP_FAILED) {
+ munmap(addr, sb.st_size);
+ }
+ return eStatus;
+}
+
+UI_32 GetLengthOfDataFromShared(TMemID id) {
+ UI_32 size = 0;
+ char shmname[16];
+ int fd;
+ struct stat sb;
+
+ if (id == BAD_MEM_ID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "ShMemID is invalied(%u)", id); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return 0;
+ }
+
+ create_shmname(shmname, id);
+
+ if ((fd = shm_open(shmname, O_RDWR, 0)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "shm_open: %s", strerror(errno));
+ return 0;
+ }
+
+ if (fstat(fd, &sb) < 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "fstat: %s", strerror(errno)); // LCOV_EXCL_LINE 5: mmap's error case.
+ goto exit;
+ }
+
+ size = static_cast<UI_32>(sb.st_size - NS_SHM_HEADER_SIZE);
+
+exit:
+ close(fd);
+ return size;
+}
+
+EFrameworkunifiedStatus DiscardDataFromShared(TMemID id) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ char shmname[16];
+
+ if (id == BAD_MEM_ID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "ShMemID is invalied(%u)", id);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ create_shmname(shmname, id);
+
+ if (shm_unlink(shmname) < 0) {
+ if (errno == ENOENT) {
+ eStatus = eFrameworkunifiedStatusInvldID;
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "shm_unlink: %s", strerror(errno));
+ }
+
+ return eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem.cpp b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem.cpp
new file mode 100755
index 0000000..fe1e9bc
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem.cpp
@@ -0,0 +1,697 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMem.
+/// This class provides API to open, read, write and close shared memory
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <unistd.h>
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_transmit_log.h>
+
+#include <string>
+
+static CNSSharedMem *g_pTransmitLogSharedBuf = NULL;
+
+#define SHM_HEADER_EXT "Hdr"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemTransmitLogOpen
+/// Open the shared memory for transmit logging
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogOpen() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == g_pTransmitLogSharedBuf) {
+ // Create the instance
+ g_pTransmitLogSharedBuf = new(std::nothrow) CNSSharedMem(TRANSMIT_LOG_SHAREDMEM_NAME, TRANSMIT_LOG_SHAREDMEM_SIZE);
+ }
+
+ if (NULL != g_pTransmitLogSharedBuf) {
+ if (!g_pTransmitLogSharedBuf->IsOpen()) {
+ // maps the shared memory buffer
+ l_eStatus = g_pTransmitLogSharedBuf->Open();
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemTransmitLogClose
+/// Close the transmit logging shared memory
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogClose() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != g_pTransmitLogSharedBuf) {
+ // un-map the shared memory object
+ l_eStatus = g_pTransmitLogSharedBuf->Close();
+
+ delete g_pTransmitLogSharedBuf;
+ g_pTransmitLogSharedBuf = NULL;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemReadTransmitLog
+/// Reads transmit log from the shared memory buffer.
+////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemReadTransmitLog(PSTR f_pBuffer, const UI_32 f_uiLength, const BOOL f_bBlock) {
+ // no. of bytes read
+ SI_32 l_iReadSize = NS_SHM_ERROR;
+
+ if (NULL != g_pTransmitLogSharedBuf && NULL != f_pBuffer) {
+ // Writes log data into shared memory buffer
+ l_iReadSize = g_pTransmitLogSharedBuf->Read(f_pBuffer, f_uiLength, f_bBlock);
+ }
+
+ return l_iReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemWriteTransmitLog
+/// Write transmit log into the shared memory buffer.
+////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemWriteTransmitLog(PCSTR f_pBuffer, const UI_32 f_uiLength) {
+ // no. of bytes read
+ SI_32 l_iWriteSize = NS_SHM_ERROR;
+
+ if (NULL != g_pTransmitLogSharedBuf && NULL != f_pBuffer) {
+ // Writes log data into shared memory buffer
+ l_iWriteSize = g_pTransmitLogSharedBuf->Write(f_pBuffer, f_uiLength);
+ }
+
+ return l_iWriteSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemDumpTransmitLogToFile
+/// Dump transmit log from the shared memory buffer into file.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemDumpTransmitLogToFile(PCSTR f_pPath, PUI_32 f_puiDumpSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ if (NULL != g_pTransmitLogSharedBuf && NULL != f_pPath) {
+ // Writes log data into shared memory buffer
+ l_eStatus = g_pTransmitLogSharedBuf->DumpToFile(f_pPath, f_puiDumpSize);
+ }
+
+ return l_eStatus;
+}
+
+// Used only in nstest_sharedmem.
+#if defined(SHM_UNITTEST_ENABLE)
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSSharedMemTransmitLogIsOpen
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NSSharedMemTransmitLogIsOpen() {
+ if (g_pTransmitLogSharedBuf != NULL) {
+ return g_pTransmitLogSharedBuf->IsOpen();
+ } else {
+ return FALSE;
+ }
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMem
+/// Parameterized Constructor of CNSSharedMem class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMem::CNSSharedMem(const std::string &f_cSharedMemName, const UI_32 f_uiSize):
+ m_cShmName(f_cSharedMemName), m_uiShmBuffSize(f_uiSize), m_pShmHdr(NULL), m_pShmBuff(NULL) {
+ m_cShmHdrName = f_cSharedMemName;
+ m_cShmHdrName.append(SHM_HEADER_EXT);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMem
+/// Constructor of CNSSharedMem class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMem::CNSSharedMem():
+ m_cShmName(""), m_uiShmBuffSize(0), m_pShmHdr(NULL), m_pShmBuff(NULL) {
+ // do nothing
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNSSharedMem
+/// Destructor of CNSSharedMem class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMem::~CNSSharedMem() {
+ if (NULL != m_pShmHdr) {
+ // un-map the shared memory object
+ Close();
+
+ m_pShmHdr = NULL;
+ }
+
+ // TODO(framework_unified): currently shared memory is not being unlinked,
+ // we need to find a method where we can unlink the sharedmem
+ // shm_unlink(m_cShmName.c_str());
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Open
+/// This function opens and maps the shared memory object.
+/// It creates the shared memory if it does not exists.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::Open() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusErrOther;
+
+// Used only in nstest_sharedmem.
+#if defined(SHM_UNITTEST_ENABLE)
+ if (getenv(NSTEST_FAIL_SHAREDMEM_OPEN) != NULL) {
+ return l_eStatus;
+ }
+#endif
+
+ if (NULL == m_pShmHdr) {
+ // Open header shared memory
+ if (eFrameworkunifiedStatusOK != (l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pShmHdr),
+ m_cShmHdrName, sizeof(NSSharedBufferHdr)))) {
+ if (ENOENT == errno) { // Shared memory is not created yet
+ errno = EOK;
+
+ // Create shared memory
+ if (eFrameworkunifiedStatusOK == CreateSMHeader()) {
+ // Retry to open
+ l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pShmHdr), m_cShmHdrName, sizeof(NSSharedBufferHdr));
+ }
+ }
+ } else {
+ pthread_mutex_lock(&m_pShmHdr->m_tBufMutex);
+
+ // if shared memory buffer is created with size 0, then set new size in header if any change
+ if (0 == m_pShmHdr->m_uiShMemSize && 0 < m_uiShmBuffSize) {
+ m_pShmHdr->m_uiShMemSize = m_uiShmBuffSize;
+ } else if (0 < m_pShmHdr->m_uiShMemSize && 0 == m_uiShmBuffSize) {
+ m_uiShmBuffSize = m_pShmHdr->m_uiShMemSize;
+ } else {
+ // do nothing
+ }
+
+ pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex);
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus && 0 != m_uiShmBuffSize) {
+ if (NULL == m_pShmBuff) {
+ // Open shared memory data buffer, create if not exists
+ if (eFrameworkunifiedStatusOK != (l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pShmBuff), m_cShmName, m_uiShmBuffSize))) {
+ if (ENOENT == errno) { // Shared memory is not created yet
+ // Create shared memory
+ if (eFrameworkunifiedStatusOK == CreateSMDataBuffer()) {
+ // Retry to open
+ l_eStatus = MapSM(reinterpret_cast<PVOID *>(&m_pShmBuff), m_cShmName, m_uiShmBuffSize);
+ }
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsOpen
+/// This function is used to check whether the shared memory buffer is opened or not.
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNSSharedMem::IsOpen() {
+ return NULL == m_pShmHdr ? FALSE : TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Close
+/// This function closes the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::Close() {
+ EFrameworkunifiedStatus l_eStatus1 = UnMapSM(m_pShmHdr, sizeof(NSSharedBufferHdr));
+ m_pShmHdr = NULL;
+
+ EFrameworkunifiedStatus l_eStatus2 = eFrameworkunifiedStatusOK;
+ if (0 != m_uiShmBuffSize) {
+ l_eStatus2 = UnMapSM(m_pShmBuff, m_uiShmBuffSize);
+ m_pShmBuff = NULL;
+ }
+ /*
+ * todo
+ * Even if an error occurs due to eFrameworkunifiedStatusNullPointer when UnMapSM fails,
+ * the error type cannot be determined by the caller because it is rounded to eFrameworkunifiedStatusFail
+ * if the API final determination is not OK.
+ */
+ return (eFrameworkunifiedStatusOK != l_eStatus1 || eFrameworkunifiedStatusOK != l_eStatus2) ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Read
+/// This function reads data from the shared memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMem::Read(PSTR f_pBuffer, const UI_32 f_uilength, const BOOL f_bBlock) {
+ SI_32 l_iReadSize = NS_SHM_ERROR;
+
+ if ((NULL != f_pBuffer) && (NULL != m_pShmHdr) && (0 != f_uilength)) {
+ UI_32 l_uiDataSizeToRead = 0;
+
+ // Remaining buffer size from read pointer to end of the buffer
+ UI_32 l_uiRemainSize = 0;
+
+ if (0 == pthread_mutex_lock(&m_pShmHdr->m_tBufMutex)) {
+ if ((TRUE == f_bBlock) && (0 == m_pShmHdr->m_uiUnReadSize)) {
+ pthread_cond_wait(&m_pShmHdr->m_tCondVar, &m_pShmHdr->m_tBufMutex);
+ }
+
+ // if shared memory buffer size is changed by some other process, remap the updated buffer size in this process
+ // shared memory buffer size can only be changed if the initial size is 0.
+ if (m_uiShmBuffSize != m_pShmHdr->m_uiShMemSize) {
+ if (eFrameworkunifiedStatusOK == MapSM(reinterpret_cast<PVOID *>(&m_pShmBuff), m_cShmName, m_pShmHdr->m_uiShMemSize)) {
+ m_uiShmBuffSize = m_pShmHdr->m_uiShMemSize;
+ }
+ }
+
+ if (NULL != m_pShmBuff) {
+ l_uiRemainSize = m_uiShmBuffSize - m_pShmHdr->m_uiReadPtr;
+
+ // Round read data size depending on un-read data size in the buffer
+ l_uiDataSizeToRead = m_pShmHdr->m_uiUnReadSize < f_uilength ? m_pShmHdr->m_uiUnReadSize : f_uilength;
+
+ if (l_uiRemainSize < l_uiDataSizeToRead) {
+ // Wrapping read
+ memcpy(f_pBuffer, m_pShmBuff + m_pShmHdr->m_uiReadPtr, l_uiRemainSize);
+ memcpy(f_pBuffer + l_uiRemainSize, m_pShmBuff, l_uiDataSizeToRead - l_uiRemainSize);
+ m_pShmHdr->m_uiReadPtr = l_uiDataSizeToRead - l_uiRemainSize;
+ } else {
+ memcpy(f_pBuffer, m_pShmBuff + m_pShmHdr->m_uiReadPtr, l_uiDataSizeToRead);
+
+ m_pShmHdr->m_uiReadPtr += l_uiDataSizeToRead;
+
+ // Read pointer is the end of the buffer
+ if (m_pShmHdr->m_uiReadPtr == m_uiShmBuffSize) {
+ m_pShmHdr->m_uiReadPtr = 0;
+ }
+ }
+
+ m_pShmHdr->m_uiUnReadSize -= l_uiDataSizeToRead; // Update un-read data size
+
+ l_iReadSize = l_uiDataSizeToRead;
+ }
+
+ pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex);
+ }
+ }
+
+ return l_iReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Write
+/// This function writes the data into the shared memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMem::Write(PCSTR f_pBuffer, const UI_32 f_uilength) {
+ SI_32 l_iWriteSize = NS_SHM_ERROR;
+
+ // size available in buffer
+ UI_32 l_uiRemainSize = 0;
+
+ if (NULL != m_pShmHdr && NULL != m_pShmBuff && NULL != f_pBuffer && f_uilength <= m_uiShmBuffSize) {
+ if (0 == pthread_mutex_lock(&m_pShmHdr->m_tBufMutex)) {
+ l_uiRemainSize = m_uiShmBuffSize - m_pShmHdr->m_uiWritePtr;
+
+ // Write data to the buffer
+ if (l_uiRemainSize < f_uilength) {
+ // Wrapping write
+ memcpy(m_pShmBuff + m_pShmHdr->m_uiWritePtr, f_pBuffer, l_uiRemainSize);
+ memcpy(m_pShmBuff, f_pBuffer + l_uiRemainSize, f_uilength - l_uiRemainSize);
+
+ // Update the write pointer
+ m_pShmHdr->m_uiWritePtr = f_uilength - l_uiRemainSize;
+
+ // The buffer is full of valid data
+ m_pShmHdr->m_bIsFull = TRUE;
+ } else {
+ memcpy(m_pShmBuff + m_pShmHdr->m_uiWritePtr, f_pBuffer, f_uilength);
+
+ // Update the write pointer
+ m_pShmHdr->m_uiWritePtr += f_uilength;
+
+ // Write pointer is the end of the buffer
+ if (m_pShmHdr->m_uiWritePtr == m_uiShmBuffSize) {
+ m_pShmHdr->m_uiWritePtr = 0;
+
+ // The buffer is full of valid data
+ m_pShmHdr->m_bIsFull = TRUE;
+ }
+ }
+
+ // Update un-read data size
+ m_pShmHdr->m_uiUnReadSize += f_uilength;
+
+ // Set read pointer to be same as write pointer if write pointer exceeds the read pointer
+ if (m_uiShmBuffSize < m_pShmHdr->m_uiUnReadSize) {
+ m_pShmHdr->m_uiReadPtr = m_pShmHdr->m_uiWritePtr;
+ m_pShmHdr->m_uiUnReadSize = m_uiShmBuffSize;
+ }
+
+ pthread_cond_signal(&m_pShmHdr->m_tCondVar);
+
+ pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex);
+
+ l_iWriteSize = f_uilength;
+ }
+ }
+
+ return l_iWriteSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// DumpToFile
+/// This function writes all the data in the buffer into provided file f_pPath.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ ssize_t l_iSize = 0;
+
+ SI_32 fd = -1;
+
+ if (NULL == f_uiDumpSize) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ *f_uiDumpSize = 0;
+
+ if (NULL != f_pPath) {
+ if (NULL != m_pShmHdr) {
+ // Open file
+ if (-1 != (fd = open(f_pPath, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, S_IRWXU | S_IRWXG | S_IRWXO))) {
+ if (NULL != m_pShmBuff && 0 != m_uiShmBuffSize) {
+ if (0 == pthread_mutex_lock(&m_pShmHdr->m_tBufMutex)) {
+ // Write buffer data to file
+ if (m_pShmHdr->m_bIsFull) {
+ // Buffer has full of data (read data from write pointer)
+ if (-1 != (l_iSize = write(fd, m_pShmBuff + m_pShmHdr->m_uiWritePtr,
+ m_uiShmBuffSize - m_pShmHdr->m_uiWritePtr))) {
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+
+ if (-1 != (l_iSize = write(fd, m_pShmBuff, m_pShmHdr->m_uiWritePtr))) {
+ *f_uiDumpSize += static_cast<UI_32>(l_iSize);
+ }
+
+ if (0 != pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex)) {
+ l_eStatus = eFrameworkunifiedStatusSemUnlockFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusSemLockFail;
+ }
+ } else if (NULL == m_pShmBuff && 0 != m_uiShmBuffSize) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // do nothing
+ }
+
+ // Sync the file to force I/O operation completed
+ fsync(fd);
+
+ close(fd);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSize
+/// This function returns the number of unread bytes which can be read by Read().
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMem::GetSize() {
+ SI_32 l_uiReadSize = NS_SHM_ERROR;
+
+ if (NULL != m_pShmHdr) {
+ l_uiReadSize = m_pShmHdr->m_uiUnReadSize;
+ }
+
+ return l_uiReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearBuf
+/// This function clears the buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::ClearBuf() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmHdr) {
+ if (0 == pthread_mutex_lock(&m_pShmHdr->m_tBufMutex)) {
+ // Initialize the r/w pointers
+ m_pShmHdr->m_uiReadPtr = 0;
+ m_pShmHdr->m_uiWritePtr = 0;
+ m_pShmHdr->m_uiUnReadSize = 0;
+ m_pShmHdr->m_bIsFull = FALSE;
+
+ if (0 != pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex)) {
+ l_eStatus = eFrameworkunifiedStatusSemUnlockFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusSemLockFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReadPtrToWritePtr
+/// This function sets the position of read ptr to write ptr in buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::SetReadPtrToWritePtr() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmHdr) {
+ if (0 == pthread_mutex_lock(&m_pShmHdr->m_tBufMutex)) { // LCOV_EXCL_BR_LINE 5: pthread_mutex_lock's error case
+ // Initialize the r/w pointers
+ m_pShmHdr->m_uiReadPtr = m_pShmHdr->m_uiWritePtr;
+ m_pShmHdr->m_uiUnReadSize = 0;
+
+ if (0 != pthread_mutex_unlock(&m_pShmHdr->m_tBufMutex)) { // LCOV_EXCL_BR_LINE 5: pthread_mutex_unlock's error
+ l_eStatus = eFrameworkunifiedStatusSemUnlockFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusSemLockFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateSMHeader
+/// This function creates the shared memory object for header.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::CreateSMHeader() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of shared memory
+ SI_32 l_siId = -1;
+
+ // shared memory buffer headers
+ NSSharedBufferHdr *l_pShmHdr = NULL;
+
+ if ((!m_cShmHdrName.empty()) && (m_cShmHdrName.size() <= NAME_MAX)) {
+ // Try to create shared memory
+ l_siId = shm_open(m_cShmHdrName.c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO);
+
+ if (-1 != l_siId) {
+ // Set the size of shared memory
+ if (-1 != ftruncate(l_siId, sizeof(NSSharedBufferHdr))) {
+ // Map the shared memory
+ l_pShmHdr = reinterpret_cast<NSSharedBufferHdr *>(mmap(NULL, sizeof(NSSharedBufferHdr),
+ (PROT_READ | PROT_WRITE), MAP_SHARED, l_siId, 0));
+
+ if (MAP_FAILED != l_pShmHdr) {
+ // mutex attribute
+ pthread_mutexattr_t l_tMtxAttr = {};
+ pthread_condattr_t l_tCondAttr = {};
+
+ // Initialize mutex
+ pthread_mutexattr_init(&l_tMtxAttr);
+ pthread_mutexattr_setpshared(&l_tMtxAttr, PTHREAD_PROCESS_SHARED);
+ pthread_mutex_init(&l_pShmHdr->m_tBufMutex, &l_tMtxAttr);
+ pthread_mutexattr_destroy(&l_tMtxAttr);
+
+ pthread_condattr_init(&l_tCondAttr);
+ pthread_condattr_setpshared(&l_tCondAttr, PTHREAD_PROCESS_SHARED);
+ pthread_cond_init(&l_pShmHdr->m_tCondVar, &l_tCondAttr);
+ pthread_condattr_destroy(&l_tCondAttr);
+
+ pthread_mutex_lock(&l_pShmHdr->m_tBufMutex);
+
+ // Initialize the r/w pointers
+ l_pShmHdr->m_uiReadPtr = 0;
+ l_pShmHdr->m_uiWritePtr = 0;
+ l_pShmHdr->m_uiUnReadSize = 0;
+ l_pShmHdr->m_bIsFull = FALSE;
+ l_pShmHdr->m_uiShMemSize = m_uiShmBuffSize;
+
+ pthread_mutex_unlock(&l_pShmHdr->m_tBufMutex);
+
+ // Once initialized un-map the shared memory
+ munmap(l_pShmHdr, sizeof(NSSharedBufferHdr));
+
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+
+ close(l_siId);
+ } else if (EEXIST == errno) {
+ // Shared memory is already created
+ l_eStatus = eFrameworkunifiedStatusDuplicate;
+ } else {
+ // do nothing
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateSMDataBuffer
+/// This function creates the shared memory object for data buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::CreateSMDataBuffer() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of shared memory
+ SI_32 l_siId = -1;
+
+ if ((!m_cShmName.empty()) && (m_cShmName.size() <= NAME_MAX)) {
+ // Try to create shared memory
+ l_siId = shm_open(m_cShmName.c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO);
+
+ if (-1 != l_siId) {
+ // Set the size of shared memory
+ if (-1 != ftruncate(l_siId, m_uiShmBuffSize)) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ close(l_siId);
+ } else if (EEXIST == errno) {
+ // Shared memory is already created
+ l_eStatus = eFrameworkunifiedStatusDuplicate;
+ } else {
+ // do nothing
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// MapSMHeader
+/// This function open and maps the shared memory header in process space.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::MapSM(PVOID *f_pShMem, const std::string &f_cShmName, const UI_32 f_uiShmSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ // file descriptor of shared memory
+ SI_32 l_siId = -1;
+
+ // shared memory buffer headers
+ PVOID l_pShmBuf = NULL;
+
+ // Open shared memory
+ l_siId = shm_open(f_cShmName.c_str(), O_RDWR, 0);
+
+ if (-1 != l_siId) {
+ // Map the shared memory into its memory space
+ l_pShmBuf = mmap(NULL, f_uiShmSize, (PROT_READ | PROT_WRITE), MAP_SHARED, l_siId, 0);
+
+ if (MAP_FAILED != l_pShmBuf) {
+ *f_pShMem = l_pShmBuf;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ close(l_siId);
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// UnMapSM
+/// This function unmaps the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMem::UnMapSM(PVOID f_pShMem, const UI_32 f_uiShmSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // Un-map the shared memory
+ if (NULL != f_pShMem) {
+ if (0 != munmap(f_pShMem, f_uiShmSize)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_reader.cpp b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_reader.cpp
new file mode 100755
index 0000000..79f9f54
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_reader.cpp
@@ -0,0 +1,169 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMemReader.
+/// This class provides API to open, close and perform read operation on shared memory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_reader.h>
+#include <string>
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMemReader
+/// Constructor of CNSSharedMemReader class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemReader::CNSSharedMemReader(): m_pShmReader(NULL), m_bBlock(TRUE) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMemReader
+/// Parameterized Constructor of CNSSharedMemReader class
+/// This creates the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemReader::CNSSharedMemReader(const std::string &f_cSharedMemName, const BOOL f_bBlock): m_bBlock(f_bBlock) {
+ m_pShmReader = new(std::nothrow) CNSSharedMem(f_cSharedMemName, 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNSSharedMemReader
+/// Destructor of CNSSharedMemReader class.
+/// Closes the shared memory, if it is open.
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemReader::~CNSSharedMemReader() {
+ if (NULL != m_pShmReader) {
+ if (m_pShmReader->IsOpen()) {
+ m_pShmReader->Close();
+ }
+
+ delete m_pShmReader;
+ m_pShmReader = NULL;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Open
+/// This function opens and maps the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemReader::Open() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmReader) {
+ l_eStatus = m_pShmReader->Open();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsOpen
+/// This function is used to check whether the shared memory buffer is opened or not.
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNSSharedMemReader::IsOpen() {
+ BOOL l_bOpen = FALSE;
+
+ if (NULL != m_pShmReader) {
+ l_bOpen = m_pShmReader->IsOpen();
+ }
+
+ return l_bOpen;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Close
+/// This function unmaps the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemReader::Close() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmReader) {
+ l_eStatus = m_pShmReader->Close();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Read
+/// This function reads data from the shared memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMemReader::Read(PSTR buffer, const UI_32 f_uilength) {
+ SI_32 l_iReadSize = NS_SHM_ERROR;
+
+ if (NULL != m_pShmReader) {
+ l_iReadSize = m_pShmReader->Read(buffer, f_uilength, m_bBlock);
+ }
+
+ return l_iReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// DumpToFile
+/// This function writes all the data in the buffer into provided file f_pPath.
+/// This function does not changes the unread buffer.
+/// This function overwrites the file if it exists.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemReader::DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmReader) {
+ l_eStatus = m_pShmReader->DumpToFile(f_pPath, f_uiDumpSize);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSize
+/// This function returns the number of unread bytes which can be read by Read().
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMemReader::GetSize() {
+ UI_32 l_uiReadSize = NS_SHM_ERROR;
+
+ if (NULL != m_pShmReader) {
+ l_uiReadSize = m_pShmReader->GetSize();
+ }
+
+ return l_uiReadSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReadPtrToWritePtr
+/// This function sets the position of read ptr to write ptr in buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemReader::SetReadPtrToWritePtr() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmReader) {
+ l_eStatus = m_pShmReader->SetReadPtrToWritePtr();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_writer.cpp b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_writer.cpp
new file mode 100755
index 0000000..2561415
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_SharedMemIf/src/ns_sharedmem_writer.cpp
@@ -0,0 +1,137 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMemReader.
+/// This class provides API to open, close and perform read operation on shared memory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_writer.h>
+#include <string>
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMemWriter
+/// Constructor of CNSSharedMemWriter class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemWriter::CNSSharedMemWriter(): m_pShmWriter(NULL) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSSharedMemWriter
+/// Parameterized Constructor of CNSSharedMemWriter class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemWriter::CNSSharedMemWriter(const std::string &f_cSharedMemName, const UI_32 f_uiSize) {
+ m_pShmWriter = new(std::nothrow) CNSSharedMem(f_cSharedMemName, f_uiSize);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNSSharedMemWriter
+/// Destructor of CNSSharedMemWriter class.
+/// Closes the shared memory, if it is open.
+////////////////////////////////////////////////////////////////////////////////////////////////
+CNSSharedMemWriter::~CNSSharedMemWriter() {
+ if (NULL != m_pShmWriter) {
+ if (m_pShmWriter->IsOpen()) {
+ m_pShmWriter->Close();
+ }
+
+ delete m_pShmWriter;
+ m_pShmWriter = NULL;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Open
+/// This function opens and maps the shared memory object.
+/// It creates the shared memory if it does not exists.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemWriter::Open() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmWriter) {
+ l_eStatus = m_pShmWriter->Open();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsOpen
+/// This function is used to check whether the shared memory buffer is opened or not.
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNSSharedMemWriter::IsOpen() {
+ BOOL l_bOpen = FALSE;
+
+ if (NULL != m_pShmWriter) {
+ l_bOpen = m_pShmWriter->IsOpen();
+ }
+
+ return l_bOpen;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Close
+/// This function unmaps the shared memory object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemWriter::Close() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmWriter) {
+ l_eStatus = m_pShmWriter->Close();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Write
+/// This function writes the data into the shared memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CNSSharedMemWriter::Write(PCSTR buffer, const UI_32 f_uilength) {
+ SI_32 l_iWriteSize = NS_SHM_ERROR;
+
+ if ((NULL != m_pShmWriter) && (NULL != buffer) && (0 != f_uilength)) {
+ l_iWriteSize = m_pShmWriter->Write(buffer, f_uilength);
+ }
+
+ return l_iWriteSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearBuf
+/// This function clears the shared memory buffer.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSSharedMemWriter::ClearBuf() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pShmWriter) {
+ l_eStatus = m_pShmWriter->ClearBuf();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Timer/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS_Timer/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Timer/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Timer/include/ns_timer_handle.h b/video_in_hal/nsframework/framework_unified/client/NS_Timer/include/ns_timer_handle.h
new file mode 100755
index 0000000..7d082e7
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Timer/include/ns_timer_handle.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSTimer
+/// \brief Contains the internal structures that used by ns_timer
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_HANDLE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_HANDLE_H_
+#include <stdio.h>
+#include <time.h>
+#include <signal.h>
+#include <native_service/frameworkunified_types.h>
+
+typedef void (*pfCb)(UI_16 cmd);
+
+/// \brief Struct that defines internal function callback for a timer
+typedef struct _TimerNotifyInfo {
+ UI_16 iCmd;
+ PSTR q_name;
+} TTimerInfo, *PTimerInfo;
+
+/// \brief Struct that defines internal handle object for a timer
+typedef struct _NSTimerHandle {
+ int timerfd;
+ struct itimerspec itime;
+ PTimerInfo tTimerInfo;
+ UI_8 timerState;
+} NSTimerHandle, *PNSTimerHandle;
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_HANDLE_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Timer/include/ns_timer_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_Timer/include/ns_timer_internal.h
new file mode 100755
index 0000000..43418a2
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Timer/include/ns_timer_internal.h
@@ -0,0 +1,28 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSTimer
+/// \brief Contains the internal APIs that used by NS_Timer
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_INTERNAL_H_
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_TIMER_INCLUDE_NS_TIMER_INTERNAL_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..b3eb74d
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/makefile_PosixBasedOS001
@@ -0,0 +1,206 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_Timer
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_Timer
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+ifdef DYNAMIC
+ DYNAMIC_LIBS += \
+ NS_MessageCenter$(DEBUG_EXT)
+else
+ STATIC_LIBS +=
+endif
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+module_dirs: build_dirs
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/mod_version.c b/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/mod_version.c
new file mode 100755
index 0000000..c6e28eb
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/mod_version.c
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_ModVersion
+/// \brief Identifies module version
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <native_service/frameworkunified_types.h>
+
+#define MOD_VERSION_LENGTH 12
+
+
+
+static CHAR s_ModVersion[MOD_VERSION_LENGTH + 1] = "0.0.0";
+
+SI_8 GetModuleVersion(CHAR *pRetBuf, UI_8 nBufLen) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ UI_8 CopyLen = 0;
+ SI_8 RetVal = -1;
+
+ if (NULL != pRetBuf) {
+ CopyLen = MIN_VAL(nBufLen, MOD_VERSION_LENGTH);
+ strncpy(pRetBuf, s_ModVersion, CopyLen);
+ pRetBuf[CopyLen] = '\0';
+ RetVal = 0;
+ }
+ return RetVal;
+}
+// LCOV_EXCL_STOP
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/ns_timer.c b/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/ns_timer.c
new file mode 100755
index 0000000..d24264b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/ns_timer.c
@@ -0,0 +1,514 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSTimer
+/// \brief Native Services Timer Interface code
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <unistd.h>
+#include <string.h>
+#include <malloc.h>
+#include <errno.h>
+#include <sys/epoll.h>
+#include <sys/eventfd.h>
+#include <sys/timerfd.h>
+#include <sys/prctl.h>
+
+#include <native_service/ns_timer_if.h>
+#include <ns_timer_handle.h>
+#include <native_service/ns_message_center_if.h>
+#include <ns_timer_internal.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_resource_controler.h>
+
+#define INVALID_TIMERFD -1
+
+#define RUNNING_STATE 0
+#define DELETING_STATE 1
+#define DELETED_STATE 2
+
+#define MAX_FD_EPOLL 10
+
+int epollFd; // To listen to multiple timerfd events.
+int eventFd; // To use not complete at epoll_wait
+pthread_t timerTh_id = 0; // Thread ID of the TimerMonitoringThread
+pthread_mutex_t m_mtx = PTHREAD_MUTEX_INITIALIZER;
+
+const UI_32 MS_IN_SEC = 1000;
+const UI_64 NS_IN_MS = 1000000;
+
+BOOL DebugFlag = FALSE;
+
+static PVOID TimerMonitoringThread(PVOID args) {
+ struct epoll_event events[MAX_FD_EPOLL];
+ int nfds; // The number of events received
+ int n; // Loop counter
+ PNSTimerHandle hTimer;
+ char *p, name[32];
+ uint64_t exp;
+
+ // Thread naming
+#define NSTIMER_APPEND_NAME "_T"
+#ifndef NSTIMER_SIZE_PROCESSNAME
+#define NSTIMER_SIZE_PROCESSNAME 15 // Profiler analysis tool name length limitations
+#endif
+ prctl(PR_GET_NAME, name);
+ name[NSTIMER_SIZE_PROCESSNAME] = '\0';
+ if (strlen(name) + strlen(NSTIMER_APPEND_NAME) > NSTIMER_SIZE_PROCESSNAME) {
+ p = name + NSTIMER_SIZE_PROCESSNAME - strlen(NSTIMER_APPEND_NAME);
+ } else {
+ p = name + strlen(name);
+ }
+ strcpy(p, NSTIMER_APPEND_NAME);
+ prctl(PR_SET_NAME, name);
+
+ for (;;) {
+ nfds = epoll_wait(epollFd, events, MAX_FD_EPOLL, -1);
+ if (-1 != nfds) {
+ for (n = 0; n < nfds; ++n) {
+ hTimer = (PNSTimerHandle)events[n].data.ptr;
+ if (NULL != hTimer) {
+ if (-1 == read(hTimer->timerfd, &exp, sizeof(uint64_t))) {
+ if (errno != EAGAIN) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Failed to read in timeout : fd=%d, errno=%d",
+ hTimer->timerfd, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ continue;
+ }
+
+ if (RUNNING_STATE == hTimer->timerState) {
+ if (NULL != hTimer->tTimerInfo) {
+ EFrameworkunifiedStatus eStatus;
+ HANDLE hReceiver = NULL;
+ if (frameworkunifiedAcquireResouce(FRAMEWORKUNIFIED_RES_TIMER, hTimer->tTimerInfo->q_name, (long *)&hReceiver) < 0) {
+ if ((hReceiver = McOpenSender(hTimer->tTimerInfo->q_name)) == NULL) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : McOpenSender is Failed");
+ // LCOV_EXCL_BR_STOP
+ continue;
+ } else {
+ if (frameworkunifiedRegistResouce(FRAMEWORKUNIFIED_RES_TIMER, hTimer->tTimerInfo->q_name, (long)hReceiver, 1) < 0) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : frameworkunifiedRegistResouce is Failed : q_name=%s",
+ hTimer->tTimerInfo->q_name);
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ }
+
+ eStatus = McSendWithPriority(hReceiver,
+ TIMER_QUE,
+ hTimer->tTimerInfo->iCmd,
+ 0,
+ NULL,
+ eFrameworkunifiedMsgPrioEmergency,
+ 0);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : McSendWithPriority to %s is Failed, eStatus=%d", hTimer->tTimerInfo->q_name,
+ eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR(RUNNING_STATE) : tTimerInfo is NULL");
+ // LCOV_EXCL_BR_STOP
+ }
+ } else if (DELETED_STATE == hTimer->timerState) {
+ if (-1 == epoll_ctl(epollFd, EPOLL_CTL_DEL, hTimer->timerfd, events)) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(DEL) Failed, fd=%d, errno=%d",
+ hTimer->timerfd, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ if (-1 == close(hTimer->timerfd)) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : close(fd=%d) Failed, errno=%d", hTimer->timerfd, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ hTimer->timerfd = INVALID_TIMERFD;
+
+ if (NULL != hTimer->tTimerInfo) {
+ HANDLE hReceiver;
+ if (frameworkunifiedAcquireResouce(FRAMEWORKUNIFIED_RES_TIMER, hTimer->tTimerInfo->q_name, (long *)&hReceiver) >= 0) {
+ if (frameworkunifiedReleaseResouce(FRAMEWORKUNIFIED_RES_TIMER, hTimer->tTimerInfo->q_name) <= 0) {
+ frameworkunifiedUnregistResouce(FRAMEWORKUNIFIED_RES_TIMER, hTimer->tTimerInfo->q_name);
+ McClose(hReceiver);
+ }
+ }
+ free(hTimer->tTimerInfo->q_name);
+ free(hTimer->tTimerInfo); // delete the timer info
+ hTimer->tTimerInfo = NULL;
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR(DELETED_STATE) : tTimerInfo is NULL");
+ // LCOV_EXCL_BR_STOP
+ }
+
+ free(hTimer); // delete the handle
+ events[n].data.ptr = NULL;
+ } else {
+ // do nothing
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : hTimer is NULL");
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ } else {
+ if (errno == EINTR) {
+ // signal interrupt
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_wait Failed, errno=%d", errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ }
+ return NULL;
+}
+
+static EFrameworkunifiedStatus CreateTimerMonitoringThread() {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ struct epoll_event ev; // Info struct to associate with multiwaiting FD
+ int ret;
+
+ pthread_mutex_lock(&m_mtx);
+
+ // Create the TimerMonitoringThread If the thread has not been generated.
+ if (0 == timerTh_id) {
+ epollFd = epoll_create1(EPOLL_CLOEXEC);
+ if (-1 != epollFd) {
+ eventFd = eventfd(0, EFD_CLOEXEC);
+ if (-1 != eventFd) {
+ ev.events = EPOLLIN;
+ ev.data.fd = eventFd;
+ if (-1 != epoll_ctl(epollFd, EPOLL_CTL_ADD, eventFd, &ev)) {
+ if (0 != (ret = pthread_create(&timerTh_id, NULL, TimerMonitoringThread, NULL))) {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Failed to pthread_create : errno %d", ret);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(eventFd=%d, ADD) Failed, status=%d, errno=%d", eventFd, eStatus,
+ errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR :eventfd Failed, status=%d, errno=%d", eStatus, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_create1 Failed, status=%d, errno=%d",
+ eStatus, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ }
+
+ if (TRUE == DebugFlag) { // LCOV_EXCL_BR_LINE 7: debug code
+ // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "[DEBUG] sleep 3 Sec START.");
+ sleep(3);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "[DEBUG] sleep 3 Sec END.");
+ // LCOV_EXCL_STOP
+ }
+ pthread_mutex_unlock(&m_mtx);
+
+ return eStatus;
+}
+
+HANDLE NS_TimerCreate(NSTimerInfo timer_info, eNSTimerCallbackMechanism cbMech, HANDLE sndMqHndl) {
+ PNSTimerHandle hTimer = NULL;
+
+ if ((NULL != sndMqHndl) && (cbMech == CALLBACK_MESSAGE)) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ PTimerInfo pTimerInfo = NULL;
+ struct epoll_event ev; // Info struct to associate with multiwaiting FD
+ int timerfd = INVALID_TIMERFD;
+
+ eStatus = CreateTimerMonitoringThread();
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ hTimer = (PNSTimerHandle)malloc(sizeof(NSTimerHandle));
+ if (NULL != hTimer) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+ pTimerInfo = (PTimerInfo)malloc(sizeof(TTimerInfo));
+
+ if (NULL != pTimerInfo) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+ hTimer->timerState = RUNNING_STATE;
+
+ // set the timer info structure
+ PCSTR pName = McGetQueueName(sndMqHndl);
+ if (NULL != pName) {
+ pTimerInfo->q_name = strdup(pName);
+ } else {
+ pTimerInfo->q_name = NULL;
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : McGetQueueName(sndMqHndl) Failed, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ pTimerInfo->iCmd = timer_info.iCmd;
+
+ hTimer->tTimerInfo = pTimerInfo;
+ if (INVALID_TIMERFD != (timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC|TFD_NONBLOCK))) {
+ ev.events = EPOLLIN;
+ ev.data.ptr = hTimer;
+ if (-1 != epoll_ctl(epollFd, EPOLL_CTL_ADD, timerfd, &ev)) {
+ hTimer->timerfd = timerfd;
+ if (eFrameworkunifiedStatusOK == NS_TimerSetTime(hTimer, timer_info)) {
+ // set the interval in timer handle
+ hTimer->itime.it_value.tv_sec = (__time_t)timer_info.t_sec;
+ hTimer->itime.it_value.tv_nsec = (__syscall_slong_t)timer_info.t_nsec;
+ hTimer->itime.it_interval.tv_sec = (__time_t)timer_info.rpt_sec;
+ hTimer->itime.it_interval.tv_nsec = (__syscall_slong_t)timer_info.rpt_nsec;
+
+ } else {
+ eStatus = eFrameworkunifiedStatusErrOther;
+
+ // if timer interval is not set or memory is not allocated for hTimer
+ close(timerfd);
+ timerfd = INVALID_TIMERFD;
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : epoll_ctl(timerfd=%d, ADD) Failed, status=%d, errno=%d", timerfd, eStatus,
+ errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusErrOther;
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : (PTimerInfo)malloc(sizeof(TTimerInfo)) Failed, status=%d", eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ if (NULL != pTimerInfo) {
+ if (NULL != pTimerInfo->q_name) {
+ free(pTimerInfo->q_name);
+ pTimerInfo->q_name = NULL;
+ }
+
+ free(pTimerInfo);
+ pTimerInfo = NULL;
+ }
+
+ if (NULL != hTimer) {
+ free(hTimer);
+ hTimer = NULL;
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : malloc(sizeof(NSTimerHandle)) Failed");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : CreateTimerMonitoringThread Failed, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Invalid param");
+ // LCOV_EXCL_BR_STOP
+ }
+
+ return hTimer;
+}
+
+EFrameworkunifiedStatus NS_TimerDelete(HANDLE hTimer) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (NULL != hTimer) {
+ PNSTimerHandle tTimerHndl = (PNSTimerHandle)hTimer;
+ /**
+ * @todo
+ * Dropping by typing the service handle instead of the timer handle
+ */
+ if (DELETED_STATE != tTimerHndl->timerState) {
+ if (NULL != tTimerHndl->tTimerInfo) {
+ tTimerHndl->timerState = DELETING_STATE;
+ NSTimerInfo timer_info = {1, 0, tTimerHndl->tTimerInfo->iCmd, 0, 0};
+
+ if (eFrameworkunifiedStatusOK != (eStatus = NS_TimerSetTime(tTimerHndl, timer_info))) {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "ERROR : NS_TimerSetTime for Timer delete Failed, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ tTimerHndl->timerState = DELETED_STATE;
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : tTimerInfo is NULL, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Timer is not RUNNING State, timerStatus=%d, status=%d",
+ tTimerHndl->timerState, eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : hTimer is NULL, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus NS_TimerSetTime(HANDLE hTimer, NSTimerInfo timer_info) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hTimer) {
+ PNSTimerHandle tTimerHndl = (PNSTimerHandle)hTimer;
+ struct itimerspec itime;
+
+ if (DELETED_STATE != tTimerHndl->timerState) {
+ // set periodic interval values
+ itime.it_value.tv_sec = (__time_t)timer_info.t_sec;
+ itime.it_value.tv_nsec = (__syscall_slong_t)timer_info.t_nsec;
+
+ // set periodic interval values
+ itime.it_interval.tv_sec = (__time_t)timer_info.rpt_sec;
+ itime.it_interval.tv_nsec = (__syscall_slong_t)timer_info.rpt_nsec;
+
+ if (-1 != timerfd_settime(tTimerHndl->timerfd, 0, &itime, NULL)) {
+ // updated the value of the timer values in the handler
+ tTimerHndl->itime = itime;
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : timerfd_settime is failed, status=%d, errno=%d", eStatus, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Timer is not RUNNING State, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : hTimer is NULL, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus NS_TimerGetTime(HANDLE hTimer, NSTimerInfo *timer_info) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if ((NULL != hTimer) && (NULL != timer_info)) {
+ PNSTimerHandle tTimerHndl = (PNSTimerHandle)hTimer;
+ struct itimerspec itime;
+
+ if (DELETED_STATE != tTimerHndl->timerState) {
+ if (-1 != timerfd_gettime(tTimerHndl->timerfd, &itime)) {
+ // set periodic interval values
+
+// timer_info->t_sec = (UI_32)itime.it_value.tv_sec;
+ timer_info->t_sec = itime.it_value.tv_sec;
+ timer_info->t_nsec = (UI_64)itime.it_value.tv_nsec;
+
+ // set periodic interval values
+
+// timer_info->rpt_sec = (UI_32)itime.it_interval.tv_sec;
+ timer_info->rpt_sec = itime.it_interval.tv_sec;
+ timer_info->rpt_nsec = (UI_64)itime.it_interval.tv_nsec;
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : timerfd_gettime is failed, status=%d, errno=%d", eStatus, errno);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Timer is not RUNNING State, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "ERROR : Invalid param, status=%d", eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+
+ return eStatus;
+}
+
+
+//UI_32 WholeSeconds(UI_32 ms) {
+// return ms / MS_IN_SEC;
+//}
+time_t WholeSeconds(UI_32 ms) {
+ return (time_t)(ms / MS_IN_SEC);
+}
+
+
+UI_32 RemainderMs(UI_32 ms) {
+ return ms % MS_IN_SEC;
+}
+
+UI_64 MSToNS(UI_32 ms) {
+ return (UI_64)ms * NS_IN_MS;
+}
+
+void NS_TimerDebugOn(BOOL FlagState) { // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (DebugFlag != FlagState) {
+ DebugFlag = FlagState;
+ if (TRUE == DebugFlag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "NS_Timer debugging is enabled.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_IMP_INFO, __FUNCTION__, "NS_Timer debugging is disabled.");
+ }
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/ns_timer_class.cpp b/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/ns_timer_class.cpp
new file mode 100755
index 0000000..47b41e9
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Timer/src/ns_timer_class.cpp
@@ -0,0 +1,177 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSTimer
+/// \brief
+///
+/// Timer class for setting timers.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_timer_if.hpp>
+#include <native_service/ns_message_center_if.h>
+#include <string.h>
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// Constructor
+//////////////////////////////////////////////////////////////////////////////////////////////
+NSTimer::NSTimer():
+ m_hTimer(NULL),
+ m_u64TimeInterval(0),
+ m_bRepeatTimer(FALSE) {
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// Destructor
+//////////////////////////////////////////////////////////////////////////////////////////////
+NSTimer::~NSTimer() {
+ if (NULL != m_hTimer) {
+ NS_TimerDelete(m_hTimer);
+ m_hTimer = NULL;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// SetNotifyMethod
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSTimer::SetNotifyMethod(UI_16 notifyCmdId, PCSTR notifyToAppName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ NSTimerInfo l_tTimerInfo = {};
+
+ if ((NULL != notifyToAppName) && (strlen(notifyToAppName) <= MAX_SERVICE_NAME)) {
+ HANDLE l_hSenderHandle = McOpenSender(notifyToAppName);
+
+ if (NULL != l_hSenderHandle) { // reset previous notify method, and set new
+ // resets previous timer timeout action if any
+ if (NULL != m_hTimer) {
+ NS_TimerDelete(m_hTimer);
+ m_hTimer = NULL;
+ }
+
+ l_tTimerInfo.iCmd = notifyCmdId;
+ // Create timer. Do not start.
+ if (NULL == (m_hTimer = NS_TimerCreate(l_tTimerInfo, CALLBACK_MESSAGE, l_hSenderHandle))) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ McClose(l_hSenderHandle);
+ } else {
+ // just return fail. Don't reset any previous notify method
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// SetRepeatTimer
+//////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSTimer::SetRepeatTimer(BOOL repeatTimer) {
+ m_bRepeatTimer = repeatTimer;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// SetTime
+//////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSTimer::SetTime(UI_32 seconds, UI_64 msecs) {
+ m_u64TimeInterval = msecs + seconds * 1000ULL; // internally, set interval as milliseconds
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// SetTime
+//////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSTimer::SetTime(UI_32 hrs, UI_32 mins, UI_32 seconds, UI_64 msecs) {
+ // internally, set interval as milliseconds
+ m_u64TimeInterval = msecs + seconds * 1000ULL + mins * 60000ULL + hrs * 3600000ULL;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// Start
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSTimer::Start(UI_32 seconds, UI_64 msecs) {
+ this->SetTime(seconds, msecs);
+ return (this->Start());
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// Start
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSTimer::Start() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (NULL != m_hTimer) {
+ NSTimerInfo l_tTimerInfo = {};
+
+ l_tTimerInfo.t_sec = WholeSeconds(static_cast<UI_32>(m_u64TimeInterval)); /// Converts to seconds
+ l_tTimerInfo.t_nsec = MSToNS(RemainderMs(static_cast<UI_32>(m_u64TimeInterval))); /// Converts to nano seconds
+
+ if (TRUE == m_bRepeatTimer) {
+ l_tTimerInfo.rpt_sec = l_tTimerInfo.t_sec;
+ l_tTimerInfo.rpt_nsec = l_tTimerInfo.t_nsec;
+ }
+ l_eStatus = NS_TimerSetTime(m_hTimer, l_tTimerInfo);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// Stop
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSTimer::Stop() {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_hTimer) {
+ NSTimerInfo l_tTimerInfo = {};
+ l_eStatus = NS_TimerSetTime(m_hTimer, l_tTimerInfo);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// IsRunning
+//////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NSTimer::IsRunning() {
+ BOOL l_bIsRunning = FALSE;
+
+ if (NULL != m_hTimer) {
+ NSTimerInfo l_tTimerInfo = {};
+ NS_TimerGetTime(m_hTimer, &l_tTimerInfo);
+ if ((0 != l_tTimerInfo.t_sec) || (0 != l_tTimerInfo.t_nsec) || (0 != l_tTimerInfo.rpt_sec) ||
+ (0 != l_tTimerInfo.rpt_nsec)) {
+ l_bIsRunning = TRUE;
+ }
+ }
+ return l_bIsRunning;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+///// GetInterval
+//////////////////////////////////////////////////////////////////////////////////////////////
+UI_64 NSTimer::GetInterval() {
+ return m_u64TimeInterval;
+}
+
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Utility/Makefile b/video_in_hal/nsframework/framework_unified/client/NS_Utility/Makefile
new file mode 100755
index 0000000..2f4dfef
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Utility/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS = buildversioncheck
+
+include ../../../native_service.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/Makefile b/video_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/Makefile
new file mode 100755
index 0000000..03ca87c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/Makefile
@@ -0,0 +1,21 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := library
+
+
+
+include ../../../../native_service.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/Makefile b/video_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/Makefile
new file mode 100755
index 0000000..e1b0a6d
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/Makefile
@@ -0,0 +1,62 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+
+
+######### installed library(*.a) #############
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libNS_BuildVersionCheck
+
+######### install headers(*.h) #############
+
+######### compiled sources #############
+libNS_BuildVersionCheck_SRCS = NS_BuildVersionCheck.cpp
+
+######### add source path #############
+VPATH += ./src
+
+######### add include path #############
+CPPFLAGS += -I./../../../include/
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fdata-sections -ffunction-sections -DFLG_LEGACY
+
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+CPPFLAGS += -DBUILD_VERSION=PastModel002_stable_c1_I20130701-0000
+
+CPPFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -g -Wl,--gc-sections -shared
+
+LDLIBS += -Wl,-Bdynamic -lstdc++
+
+######### linked library #############
+
+######### linked library (dynamic) #############
+
+######### add library path #############
+
+include ../../../../../native_service.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/src/NS_BuildVersionCheck.cpp b/video_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/src/NS_BuildVersionCheck.cpp
new file mode 100755
index 0000000..633797b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_Utility/buildversioncheck/library/src/NS_BuildVersionCheck.cpp
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// Interfaces
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_buildversioncheck.hpp>
+#include <cstdlib>
+#include <cstring>
+
+namespace {
+
+namespace frameworkunified_ns_bvc {
+
+const UI_32 kMaxBuildVersionLength = 32;
+PCSTR g_build_version_env_var_name = "BUILD_VERSION";
+PCSTR g_build_version = _BUILD_VERSION; // Should be defined when library is built
+
+bool isEmptyString(PCSTR str) { // NOLINT (readability/nolint)
+ return 0 == std::strncmp("", str, 1);
+}
+
+} // namespace frameworkunified_ns_bvc
+
+} // namespace
+
+namespace frameworkunified {
+
+namespace ns {
+
+namespace utility {
+
+BOOL buildVersionsMatch(PCSTR build_version) { // NOLINT (readability/nolint)
+ PCSTR env_build_version = getEnvironmentBuildVersion();
+ PCSTR lib_build_version = getLibraryBuildVersion();
+ return 0 == std::strncmp(env_build_version, build_version, frameworkunified_ns_bvc::kMaxBuildVersionLength) &&
+ 0 == std::strncmp(lib_build_version, build_version, frameworkunified_ns_bvc::kMaxBuildVersionLength) &&
+ !frameworkunified_ns_bvc::isEmptyString(build_version) &&
+ !frameworkunified_ns_bvc::isEmptyString(env_build_version) &&
+ !frameworkunified_ns_bvc::isEmptyString(lib_build_version);
+}
+
+PCSTR getEnvironmentBuildVersion() { // NOLINT (readability/nolint)
+ static PCSTR env_version = std::getenv(frameworkunified_ns_bvc::g_build_version_env_var_name);
+ return env_version != NULL ? env_version : "";
+}
+
+PCSTR getLibraryBuildVersion() { // NOLINT (readability/nolint)
+ return frameworkunified_ns_bvc::g_build_version;
+}
+
+namespace utility_private {
+
+PCSTR niceBuildVersion(PCSTR build_version) { // NOLINT (readability/nolint)
+ return frameworkunified_ns_bvc::isEmptyString(build_version) ? "<Not defined>" : build_version;
+}
+
+} // namespace utility_private
+
+} // namespace utility
+
+} // namespace ns
+
+} // namespace frameworkunified
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_if_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_if_internal.h
new file mode 100755
index 0000000..fc0b761
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_if_internal.h
@@ -0,0 +1,193 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains declaration of common APIs for NS_UtilityCenter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_utility_if_internal.h
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_IF_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_IF_INTERNAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of leading zeros in a given 16bit value.
+/// \~english @param [in] f_ui_val
+/// UI_16 - the value to be counted
+/// \~english @retval the number of leading zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of leading zeros in a given 16bit value.
+/// \~english @see NS_CountLeadingZeros_32Bit NS_CountLeadingZeros_64Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountLeadingZeros_16Bit(UI_16 f_ui_val); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of leading zeros in a given 32bit value.
+/// \~english @param [in] f_ui_val
+/// UI_32 - the value to be counted
+/// \~english @retval the number of leading zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of leading zeros in a given 32bit value.
+/// \~english @see NS_CountLeadingZeros_16Bit NS_CountLeadingZeros_64Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountLeadingZeros_32Bit(UI_32 f_ui_val); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of leading zeros in a given 64bit value.
+/// \~english @param [in] f_ui_val
+/// UI_64 - the value to be counted
+/// \~english @retval the number of leading zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of leading zeros in a given 64bit value.
+/// \~english @see NS_CountLeadingZeros_16Bit NS_CountLeadingZeros_32Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountLeadingZeros_64Bit(UI_64 f_ui_val); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of trailing zeros in a given 16bit value.
+/// \~english @param [in] f_ui_val
+/// UI_16 - the value to be counted
+/// \~english @retval the number of trailing zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of trailing zeros in a given 16bit value.
+/// \~english @see NS_CountTrailingZeros_32Bit NS_CountTrailingZeros_64Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountTrailingZeros_16Bit(UI_16 f_ui_val); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of trailing zeros in a given 32bit value.
+/// \~english @param [in] f_ui_val
+/// UI_32 - the value to be counted
+/// \~english @retval the number of trailing zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of trailing zeros in a given 32bit value.
+/// \~english @see NS_CountTrailingZeros_16Bit NS_CountTrailingZeros_64Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountTrailingZeros_32Bit(UI_32 f_ui_val); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the number of trailing zeros in a given 64bit value.
+/// \~english @param [in] f_ui_val
+/// UI_64 - the value to be counted
+/// \~english @retval the number of trailing zeros
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the number of trailing zeros in a given 64bit value.
+/// \~english @see NS_CountTrailingZeros_16Bit NS_CountTrailingZeros_32Bit
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 NS_CountTrailingZeros_64Bit(UI_64 f_ui_val); // NOLINT (readability/nolint)
+
+/** @}*/ // end of framework_unified
+
+/** @}*/ // end of native_service
+
+/** @}*/ // end of BaseSystem
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_IF_INTERNAL_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_sys_internal.hpp b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_sys_internal.hpp
new file mode 100755
index 0000000..8c71ace
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/include/ns_utility_sys_internal.hpp
@@ -0,0 +1,353 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// @file ns_utility_sys_internal.hpp
+/// @brief This file contains declaration of common APIs for NS_UtilityCenter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_SYS_INTERNAL_HPP_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_SYS_INTERNAL_HPP_
+
+#include <native_service/frameworkunified_types.h>
+#include <pthread.h>
+#include <errno.h>
+
+#include <native_service/ns_utility.hpp>
+
+UI_32 utility_sys_rand(); // NOLINT (readability/nolint)
+
+// Random Functions //////////////////////////////////////////////////////////
+
+template< class T>
+T randomValue(T min, T max) {
+ const int32_t lmin = static_cast< int32_t >(min);
+ const int32_t range = static_cast< int32_t >(max) - lmin + 1;
+ if (range > 0) {
+ return static_cast< T >(utility_sys_rand() % range + lmin);
+ } else {
+ return min;
+ }
+}
+
+template< class T, UI_32 N >
+T randomItem(const T(&arr)[ N ]) {
+ return arr[ randomValue< UI_32 >(0, N - 1) ];
+}
+
+
+template< class T, class Lock > class CLockedData;
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &, // NOLINT (readability/nolint)
+ typename FSig< Fn >::TArg2); // NOLINT (readability/nolint)
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5,
+ typename FSig< Fn >::TArg6);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5,
+ typename FSig< Fn >::TArg6, typename FSig< Fn >::TArg7);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &); // NOLINT (readability/nolint)
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5,
+ typename FSig< Fn >::TArg6);
+template< class T, class Lock, class Fn > typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T, Lock > &,
+ typename FSig< Fn >::TArg2, typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5,
+ typename FSig< Fn >::TArg6, typename FSig< Fn >::TArg7);
+
+
+template< class T, class Lock >
+class CWithReadLock {
+ public:
+ typedef const T TData;
+
+ CWithReadLock(CLockedData< T, Lock > &);
+ ~CWithReadLock();
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5, typename FSig< Fn >::TArg6);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithReadLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5, typename FSig< Fn >::TArg6,
+ typename FSig< Fn >::TArg7);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CWithReadLock);
+
+ const TData &data() const; // NOLINT (readability/nolint)
+ CLockedData< T, Lock > &m_LockedData;
+};
+
+template< class T, class Lock >
+class CWithWriteLock {
+ public:
+ typedef T TData;
+
+ CWithWriteLock(CLockedData< T, Lock > &);
+ ~CWithWriteLock();
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5, typename FSig< Fn >::TArg6);
+
+ template< class T1, class Lock1, class Fn >
+ friend typename FSig< Fn >::RType WithWriteLock(Fn, CLockedData< T1, Lock1 > &, typename FSig< Fn >::TArg2,
+ typename FSig< Fn >::TArg3, typename FSig< Fn >::TArg4, typename FSig< Fn >::TArg5, typename FSig< Fn >::TArg6,
+ typename FSig< Fn >::TArg7);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CWithWriteLock);
+
+ TData &data(); // NOLINT (readability/nolint)
+ CLockedData< T, Lock > &m_LockedData;
+};
+
+/// \brief Represents a piece of data protected by a lock
+///
+/// Data wrapped with Can only be accessed using helper functions
+/// WithReadLock and WithWriteLock
+///
+/// Example usage:
+///
+/// void ModifySharedData( int& n ) { ... modify n ... };
+/// int ReadSharedData( const int& n ){ ... read n ... };
+///
+/// void DoSomething()
+/// {
+/// CLocked< int > my_data( -1 ); // initialize value to -1
+/// WithWriteLock( ModifySharedData, my_data );
+/// int val = WithReadLock( ReadSharedData, my_data );
+/// }
+///
+/// NOTE: that data is locked for the duration of the time that helper functions
+/// ModifySharedData, and ReadSharedData are called - once they return, the data becomes
+/// unlocked automatically.
+template< class T, class Lock = CMutex >
+class CLockedData {
+ public:
+ typedef CWithReadLock< T, Lock > TReadLock;
+ typedef CWithWriteLock< T, Lock > TWriteLock;
+
+ CLockedData() {}
+ template< class T1 > CLockedData(T1 t1) : m_data(t1) {}
+ template< class T1, class T2 > CLockedData(T1 t1, T2 t2) : m_data(t1, t2) {}
+ template< class T1, class T2, class T3 > CLockedData(T1 t1, T2 t2, T3 t3) : m_data(t1, t2, t3) {}
+ template< class T1, class T2, class T3, class T4 > CLockedData(T1 t1, T2 t2, T3 t3, T4 t4) : m_data(t1, t2, t3,
+ t4) {}
+ template< class T1, class T2, class T3, class T4, class T5 > CLockedData(T1 t1, T2 t2, T3 t3, T4 t4,
+ T5 t5) : m_data(t1, t2, t3, t4, t5) {}
+ template< class T1, class T2, class T3, class T4, class T5, class T6 > CLockedData(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5,
+ T6 t6) : m_data(t1, t2, t3, t4, t5, t6) {}
+ template< class T1, class T2, class T3, class T4, class T5, class T6, class T7 > CLockedData(T1 t1, T2 t2, T3 t3,
+ T4 t4, T5 t5, T6 t6, T7 t7) : m_data(t1, t2, t3, t4, t5, t6, t7) {}
+
+ friend class CWithReadLock< T, Lock >;
+ friend class CWithWriteLock< T, Lock >;
+
+ private:
+ T m_data;
+ Lock m_lock;
+};
+
+// CWithReadLock and CWithWriteLock implementation //////////////////////////////////////////////
+
+template< class T, class Lock >
+CWithReadLock< T, Lock >::CWithReadLock(CLockedData< T, Lock > &ld) : m_LockedData(ld) {
+ m_LockedData.m_lock.ReadLock();
+}
+
+template< class T, class Lock >
+CWithReadLock< T, Lock >::~CWithReadLock() {
+ m_LockedData.m_lock.Unlock();
+}
+
+template< class T, class Lock >
+const typename CWithReadLock< T, Lock >::TData &CWithReadLock< T, Lock >::data() const { // NOLINT (readability/nolint)
+ return m_LockedData.m_data;
+}
+
+template< class T, class Lock >
+CWithWriteLock< T, Lock >::CWithWriteLock(CLockedData< T, Lock > &ld) : m_LockedData(ld) {
+ m_LockedData.m_lock.WriteLock();
+}
+
+template< class T, class Lock >
+CWithWriteLock< T, Lock >::~CWithWriteLock() {
+ m_LockedData.m_lock.Unlock();
+}
+
+template< class T, class Lock >
+typename CWithWriteLock< T, Lock >::TData &CWithWriteLock< T, Lock >::data() { // NOLINT (readability/nolint)
+ return m_LockedData.m_data;
+}
+
+// WithReadLock / WithWriteLock ///////////////////////////////////////////////
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data());
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2, t3);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2, t3, t4);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2, t3, t4, t5);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5,
+ typename FSig< Fn >::TArg6 t6) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2, t3, t4, t5, t6);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithReadLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5,
+ typename FSig< Fn >::TArg6 t6, typename FSig< Fn >::TArg7 t7) {
+ typename CLockedData< T, Lock >::TReadLock rl(data);
+ return f(rl.data(), t2, t3, t4, t5, t6, t7);
+}
+
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data());
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2, t3);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2, t3, t4);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2, t3, t4, t5);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5,
+ typename FSig< Fn >::TArg6 t6) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2, t3, t4, t5, t6);
+}
+
+template< class T, class Lock, class Fn >
+typename FSig< Fn >::RType WithWriteLock(Fn f, CLockedData< T, Lock > &data, typename FSig< Fn >::TArg2 t2,
+ typename FSig< Fn >::TArg3 t3, typename FSig< Fn >::TArg4 t4, typename FSig< Fn >::TArg5 t5,
+ typename FSig< Fn >::TArg6 t6, typename FSig< Fn >::TArg7 t7) {
+ typename CLockedData< T, Lock >::TWriteLock wl(data);
+ return f(wl.data(), t2, t3, t4, t5, t6, t7);
+}
+
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_UTILITYCENTER_INCLUDE_NS_UTILITY_SYS_INTERNAL_HPP_
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/frameworkunified_version.cpp b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/frameworkunified_version.cpp
new file mode 100755
index 0000000..3ee907f
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/frameworkunified_version.cpp
@@ -0,0 +1,236 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeServices
+/// \brief Implementation of CFrameworkunifiedVersion class
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_version_if.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
+#include <string>
+
+
+// defaults - top level makefile for entire system will provide an override
+#ifndef FRAMEWORKUNIFIED_SIGNATURE
+#define FRAMEWORKUNIFIED_SIGNATURE 0xE0344333
+#endif
+
+#ifndef FRAMEWORKUNIFIED_STRUC_VER
+#define FRAMEWORKUNIFIED_STRUC_VER 0x02
+#endif
+
+#ifndef FRAMEWORKUNIFIED_PRODUCT_VER
+#define FRAMEWORKUNIFIED_PRODUCT_VER 0x01
+#endif
+
+#ifndef PRODUCT_LABEL
+#define PRODUCT_LABEL "undefined"
+#endif
+
+#ifndef FRAMEWORKUNIFIED_BUILD_VER
+#define FRAMEWORKUNIFIED_BUILD_VER "undefined"
+#endif
+
+/* For future use */
+#define YEAR ((((__DATE__[7] - '0') * 10 + (__DATE__[8] - '0')) * 10 \
++ (__DATE__[9] - '0')) * 10 + (__DATE__[10] - '0'))
+
+#define MONTH (__DATE__[2] == 'n' ? 0 \
+: __DATE__[2] == 'b' ? 1 \
+: __DATE__[2] == 'r' ? (__DATE__[0] == 'M' ? 2 : 3) \
+: __DATE__[2] == 'y' ? 4 \
+: __DATE__[2] == 'n' ? 5 \
+: __DATE__[2] == 'l' ? 6 \
+: __DATE__[2] == 'g' ? 7 \
+: __DATE__[2] == 'p' ? 8 \
+: __DATE__[2] == 't' ? 9 \
+: __DATE__[2] == 'v' ? 10 : 11)
+
+#define DAY ((__DATE__[4] == ' ' ? 0 : __DATE__[4] - '0') * 10 \
++ (__DATE__[5] - '0'))
+
+#define DATE_AS_INT (((YEAR - 2000) * 12 + MONTH) * 31 + DAY)
+
+#define HOUR (((__TIME__[0] - '0') * 10 + (__TIME__[1] - '0')))
+
+#define MIN (((__TIME__[3] - '0') * 10 + (__TIME__[4] - '0')))
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Default Constructor
+////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedVersion::CFrameworkunifiedVersion():
+ m_tVersionInfo(const_cast<PSTR>(PRODUCT_LABEL),
+ FRAMEWORKUNIFIED_SIGNATURE,
+ FRAMEWORKUNIFIED_STRUC_VER,
+ FRAMEWORKUNIFIED_PRODUCT_VER,
+ DATE_AS_INT,
+ 0,
+ 0,
+ const_cast<PSTR>(FRAMEWORKUNIFIED_BUILD_VER),
+ 0),
+ m_u32Month(MONTH + 1),
+ m_u32Year(YEAR),
+ m_u32Day(DAY) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Parametrized constructor
+////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedVersion::CFrameworkunifiedVersion(UI_16 major, UI_16 minor, UI_16 revision) :
+ m_tVersionInfo(const_cast<PSTR>(PRODUCT_LABEL),
+ FRAMEWORKUNIFIED_SIGNATURE,
+ FRAMEWORKUNIFIED_STRUC_VER,
+ FRAMEWORKUNIFIED_PRODUCT_VER,
+ DATE_AS_INT,
+ major,
+ minor,
+ const_cast<PSTR>(FRAMEWORKUNIFIED_BUILD_VER),
+ revision),
+ m_u32Month(MONTH + 1),
+ m_u32Year(YEAR),
+ m_u32Day(DAY) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Destructor
+////////////////////////////////////////////////////////////////////////////////////////////
+CFrameworkunifiedVersion::~CFrameworkunifiedVersion() {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Compares two version instances
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL operator == (CFrameworkunifiedVersion &a, CFrameworkunifiedVersion &b) { // NOLINT (readability/nolint)
+ return a.operator == (b);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Compares two version instances
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFrameworkunifiedVersion::operator == (const CFrameworkunifiedVersion &f_test_i) {
+ if (!strcmp(m_tVersionInfo.p_str_product, f_test_i.m_tVersionInfo.p_str_product) &&
+ !strcmp(m_tVersionInfo.p_str_build, f_test_i.m_tVersionInfo.p_str_build) &&
+ (m_tVersionInfo.u16_major == f_test_i.m_tVersionInfo.u16_major) &&
+ (m_tVersionInfo.u16_minor == f_test_i.m_tVersionInfo.u16_minor) &&
+ (m_tVersionInfo.u16_revision == f_test_i.m_tVersionInfo.u16_revision) &&
+ (m_tVersionInfo.u32_date == f_test_i.m_tVersionInfo.u32_date) &&
+ (m_tVersionInfo.u32_product_version == f_test_i.m_tVersionInfo.u32_product_version) &&
+ (m_tVersionInfo.u32_signature == f_test_i.m_tVersionInfo.u32_signature) &&
+ (m_tVersionInfo.u32_struc_version == f_test_i.m_tVersionInfo.u32_struc_version)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the version string
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR CFrameworkunifiedVersion::VersionStr() {
+ static char version[30] = {};
+
+ snprintf(version, sizeof(version) - 1, "%s_%s_%02d.%02d.%02d",
+ m_tVersionInfo.p_str_product,
+ m_tVersionInfo.p_str_build,
+ m_tVersionInfo.u16_major,
+ m_tVersionInfo.u16_minor,
+ m_tVersionInfo.u16_revision);
+
+ return version;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the date when the new version of the app was created
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR CFrameworkunifiedVersion::DateStr() {
+ static char date[30] = {};
+
+ snprintf(date, sizeof(date) - 1, "%d-%02d-%02d",
+ m_u32Year,
+ m_u32Month,
+ m_u32Day);
+
+ return date;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the Signature
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CFrameworkunifiedVersion::Signature() const {
+ return m_tVersionInfo.u32_signature;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns a new structure version
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CFrameworkunifiedVersion::StrucVersion() const {
+ return m_tVersionInfo.u32_struc_version;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the product version
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CFrameworkunifiedVersion::ProductVersion() const {
+ return m_tVersionInfo.u32_product_version;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the date
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CFrameworkunifiedVersion::Date() const {
+ return m_tVersionInfo.u32_date;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the major number
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_16 CFrameworkunifiedVersion::Major() const {
+ return m_tVersionInfo.u16_major;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the minor number
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_16 CFrameworkunifiedVersion::Minor() const {
+ return m_tVersionInfo.u16_minor;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the unique product identifier
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR CFrameworkunifiedVersion::Product() const {
+ return m_tVersionInfo.p_str_product;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the unique build identifier number
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR CFrameworkunifiedVersion::Build() const {
+ return m_tVersionInfo.p_str_build;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Function: Returns the revision number
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_16 CFrameworkunifiedVersion::Revision() const {
+ return m_tVersionInfo.u16_revision;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..14ad4d8
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/makefile_PosixBasedOS001
@@ -0,0 +1,194 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_UtilityCenter
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_UtilityCenter
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for utility functions
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_endianess.cpp b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_endianess.cpp
new file mode 100755
index 0000000..3dea53c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_endianess.cpp
@@ -0,0 +1,52 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <native_service/ns_endianess.h>
+
+UI_16 ConvertEndian_UI16(UI_16 f_value) { // NOLINT (readability/nolint)
+ UI_16 l_ret = static_cast<UI_16>((f_value << 8) | (f_value >> 8));
+ return l_ret;
+}
+
+
+SI_16 ConvertEndian_SI16(SI_16 f_value) { // NOLINT (readability/nolint)
+ SI_16 l_ret = static_cast<SI_16>((f_value << 8) | ((f_value >> 8) & 0xFF));
+ return l_ret;
+}
+
+
+UI_32 ConvertEndian_UI32(UI_32 f_value) { // NOLINT (readability/nolint)
+ UI_32 l_ret = ((f_value << 8) & 0xFF00FF00) | ((f_value >> 8) & 0xFF00FF);
+ return (l_ret << 16) | (l_ret >> 16);
+}
+
+SI_32 ConvertEndian_SI32(SI_32 f_value) { // NOLINT (readability/nolint)
+ SI_32 l_ret = ((f_value << 8) & 0xFF00FF00) | ((f_value >> 8) & 0xFF00FF);
+ return (l_ret << 16) | ((l_ret >> 16) & 0xFFFF);
+}
+
+UI_64 ConvertEndian_UI64(UI_64 f_value) { // // NOLINT (readability/nolint)
+ UI_64 l_ret = ((f_value << 8) & 0xFF00FF00FF00FF00ULL) | ((f_value >> 8) & 0x00FF00FF00FF00FFULL);
+ l_ret = ((l_ret << 16) & 0xFFFF0000FFFF0000ULL) | ((l_ret >> 16) & 0x0000FFFF0000FFFFULL);
+ return (l_ret << 32) | (l_ret >> 32);
+}
+
+SI_64 ConvertEndian_SI64(SI_64 f_value) { // NOLINT (readability/nolint)
+ SI_64 l_ret = ((f_value << 8) & 0xFF00FF00FF00FF00ULL) | ((f_value >> 8) & 0x00FF00FF00FF00FFULL);
+ l_ret = ((l_ret << 16) & 0xFFFF0000FFFF0000ULL) | ((l_ret >> 16) & 0x0000FFFF0000FFFFULL);
+ return (l_ret << 32) | ((l_ret >> 32) & 0xFFFFFFFFULL);
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_crc.cpp b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_crc.cpp
new file mode 100755
index 0000000..af82364
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_crc.cpp
@@ -0,0 +1,125 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_UtilityCenter
+/// \brief This file contains implementation of APIs to calcuate 16-bit and 32-bit CRC checksum of file.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_util_crc.h>
+#include <stdio.h>
+
+// buffer size for reading from file
+#define MAX_BUFFER_SIZE 4096
+
+// Static 32 bit CRC lookup table
+UI_16 g_arr_crc16_table[256] = {
+};
+
+// Static 32 bit CRC lookup table
+UI_32 g_arr_crc32_table[256] = {
+};
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CalculateCRC16
+/// This API calculates the 16 bit CRC checksum of a file
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CalculateCRC16(PCSTR f_c_file_name, UI_16 &f_ui_check_sum) { // NOLINT (readability/nolint)
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ CHAR l_c_buffer[MAX_BUFFER_SIZE] = {0};
+ size_t l_ui_bytes_read = 0;
+ FILE *l_p_file = NULL;
+
+ if (NULL != f_c_file_name) {
+ f_ui_check_sum = 0xFFFF;
+
+ // Open the file
+ l_p_file = fopen(f_c_file_name, "rbe");
+
+ if (NULL == l_p_file) {
+ l_e_status = eFrameworkunifiedStatusFileLoadError;
+ } else {
+ l_ui_bytes_read = fread(l_c_buffer, 1, sizeof(l_c_buffer), l_p_file);
+
+ while (0 != l_ui_bytes_read) { // LCOV_EXCL_BR_LINE 11: not a branch
+ for (UI_32 l_ui_bytes_cnt = 0; l_ui_bytes_cnt < l_ui_bytes_read; l_ui_bytes_cnt++) { // LCOV_EXCL_BR_LINE 11: not a branch
+ f_ui_check_sum = static_cast<UI_16>(
+ g_arr_crc16_table[((f_ui_check_sum >> 8) ^ l_c_buffer[l_ui_bytes_cnt]) & 0xFF] ^ (f_ui_check_sum << 8));
+ }
+
+ l_ui_bytes_read = fread(l_c_buffer, 1, sizeof(l_c_buffer), l_p_file);
+ }
+
+ fclose(l_p_file);
+ l_p_file = NULL;
+ }
+
+ f_ui_check_sum = static_cast<UI_16>(~f_ui_check_sum);
+ } else {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_e_status;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CalculateCRC32
+/// This API calculates the 32 bit CRC checksum of a file
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CalculateCRC32(PCSTR f_c_file_name, UI_32 &f_ui_check_sum) { // NOLINT (readability/nolint)
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ CHAR l_c_buffer[MAX_BUFFER_SIZE] = {0};
+ size_t l_ui_bytes_read = 0;
+ FILE *l_p_file = NULL;
+
+ if (NULL != f_c_file_name) {
+ f_ui_check_sum = 0xFFFFFFFF;
+
+ // Open the file
+ l_p_file = fopen(f_c_file_name, "rbe");
+
+ if (NULL == l_p_file) {
+ l_e_status = eFrameworkunifiedStatusFileLoadError;
+ } else {
+ l_ui_bytes_read = fread(l_c_buffer, 1, sizeof(l_c_buffer), l_p_file);
+
+ while (0 != l_ui_bytes_read) { // LCOV_EXCL_BR_LINE 11: not a branch
+ for (UI_32 l_ui_bytes_cnt = 0; l_ui_bytes_cnt < l_ui_bytes_read; l_ui_bytes_cnt++) { // LCOV_EXCL_BR_LINE 11: not a branch
+ f_ui_check_sum = (f_ui_check_sum >> 8)
+ ^ g_arr_crc32_table[(l_c_buffer[l_ui_bytes_cnt] ^ f_ui_check_sum) & 0xFF];
+ }
+
+ l_ui_bytes_read = fread(l_c_buffer, 1, sizeof(l_c_buffer), l_p_file);
+ }
+
+ fclose(l_p_file);
+ l_p_file = NULL;
+ }
+
+ f_ui_check_sum = ~f_ui_check_sum;
+ } else {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_e_status;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_directory.cpp b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_directory.cpp
new file mode 100755
index 0000000..a8b4263
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_util_directory.cpp
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_UtilityCenter
+/// \brief This file contains API implementation for handling file and folder functionalities.
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_util_directory.h>
+
+#include <dirent.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <cstring>
+#include <string>
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetFileList
+/// Get list of files present in a specific directory
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetFileList(TFileList *f_pv_tfile_list, PCSTR f_pc_path) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ DIR *l_p_dir = NULL;
+ struct dirent *l_pt_dirent = NULL;
+
+ if (NULL != f_pc_path && NULL != f_pv_tfile_list) {
+ if (NULL != (l_p_dir = opendir(f_pc_path))) {
+ PCHAR l_c_file_name = NULL;
+ size_t l_ui_str_length = 0;
+ while (NULL != (l_pt_dirent = readdir(l_p_dir))) { // LCOV_EXCL_BR_LINE 11: not a branch
+ if (!((std::strcmp(l_pt_dirent->d_name, ".") == 0) || (std::strcmp(l_pt_dirent->d_name, "..") == 0))) {
+ l_ui_str_length = std::strlen(l_pt_dirent->d_name);
+
+ l_c_file_name = new(std::nothrow) CHAR[l_ui_str_length + 1];
+
+ if (NULL != l_c_file_name) { // LCOV_EXCL_BR_LINE 11: new's error case(c++)
+ std::memset(l_c_file_name, 0, (sizeof(CHAR) * (l_ui_str_length + 1)));
+
+ std::strncpy(l_c_file_name, l_pt_dirent->d_name, l_ui_str_length);
+
+ f_pv_tfile_list->push_back(l_c_file_name); // LCOV_EXCL_BR_LINE 11: not a branch
+
+ delete[] l_c_file_name; // LCOV_EXCL_BR_LINE 11: not a branch
+ l_c_file_name = NULL;
+ } else {
+ l_e_status = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ }
+ closedir(l_p_dir);
+ } else {
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_e_status = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_e_status;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateDirectory
+/// Method to create a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateDirectory(std::string f_c_dir_path) {
+ EFrameworkunifiedStatus l_e_status = eFrameworkunifiedStatusOK;
+
+ if (!f_c_dir_path.empty()) {
+ PSTR l_c_temp_dir_path;
+ PSTR l_c_parsed_dir_path;
+ PCSTR l_c_copy_path = f_c_dir_path.c_str();
+
+ l_c_temp_dir_path = const_cast<PSTR >(f_c_dir_path.c_str());
+ // LCOV_EXCL_BR_START 11: not a branch
+ while (l_e_status == eFrameworkunifiedStatusOK && (l_c_parsed_dir_path = std::strchr(l_c_temp_dir_path, '/')) != 0) {
+ // LCOV_EXCL_BR_STOP
+ if (l_c_parsed_dir_path != l_c_temp_dir_path) {
+ /* Neither root nor double slash in path */
+ *l_c_parsed_dir_path = '\0';
+ if (0 != mkdir(l_c_copy_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+ if (EEXIST != errno) { // LCOV_EXCL_BR_LINE 11: not a branch
+ l_e_status = eFrameworkunifiedStatusFail;
+ } else {
+ // file already exist
+ if (TRUE != DoesDirecotryExist(f_c_dir_path)) { // LCOV_EXCL_BR_LINE 5: DoesDirecotryExist's error case
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ *l_c_parsed_dir_path = '/';
+ }
+ l_c_temp_dir_path = l_c_parsed_dir_path + 1;
+ }
+ if (eFrameworkunifiedStatusOK == l_e_status) { // LCOV_EXCL_BR_LINE 11: not a branch
+ if (0 != mkdir(l_c_copy_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+ if (EEXIST != errno) { // LCOV_EXCL_BR_LINE 11: not a branch
+ l_e_status = eFrameworkunifiedStatusFail;
+ } else {
+ // file already exist
+ if (TRUE != DoesDirecotryExist(f_c_dir_path)) { // LCOV_EXCL_BR_LINE 5: DoesDirecotryExist's error case
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ }
+ } else {
+ l_e_status = eFrameworkunifiedStatusFail;
+ }
+ return l_e_status;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DoesDirecotryExist
+/// Method to check if a directory exists.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL DoesDirecotryExist(std::string f_c_dir_path) {
+ BOOL l_b_directory_status = FALSE;
+
+ DIR *l_p_dir_descriptor = opendir(f_c_dir_path.c_str());
+ if (NULL != l_p_dir_descriptor) {
+ closedir(l_p_dir_descriptor);
+ l_b_directory_status = TRUE;
+ }
+ return l_b_directory_status;
+}
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_utility.cpp b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_utility.cpp
new file mode 100755
index 0000000..d9e6776
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_UtilityCenter/src/ns_utility.cpp
@@ -0,0 +1,144 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <native_service/ns_utility_if.h>
+#include <native_service/ns_utility_sys.hpp>
+#include <stdlib.h>
+#include <ctime>
+#include <cstring>
+#include "ns_utility_sys_internal.hpp"
+#include "ns_utility_if_internal.h"
+// Random functions ////////////////////////////////////////////////////
+void utility_sys_seedrand() { // NOLINT (readability/nolint)
+ static bool s_seeded = false;
+ if (!s_seeded) {
+ s_seeded = true;
+ srand48(std::time(NULL));
+ }
+}
+
+UI_32 utility_sys_rand() { // NOLINT (readability/nolint)
+ utility_sys_seedrand();
+ return static_cast< UI_32 >(mrand48());
+}
+
+// Lock wrapper implementation /////////////////////////////////////
+
+///////////////////////////////////////////
+// Implements locking policy for mutexes //
+///////////////////////////////////////////
+
+// CMutex helper function
+template< class TErr >
+void MutexLock(pthread_mutex_t *mtx) {
+ if (EOK != pthread_mutex_lock(mtx)) {
+ throw TErr("");
+ }
+}
+
+CMutex::CMutex() {
+ pthread_mutex_t mtx_tmp = PTHREAD_MUTEX_INITIALIZER;
+ std::memcpy(&m_mtx, &mtx_tmp, sizeof(m_mtx));
+ if (EOK != pthread_mutex_init(&m_mtx, NULL)) {
+ throw lock_creation_error();
+ }
+}
+
+CMutex::~CMutex() {
+ pthread_mutex_destroy(&m_mtx);
+}
+
+void CMutex::ReadLock() {
+ MutexLock< lock_acquireread_error >(&m_mtx);
+}
+
+void CMutex::WriteLock() {
+ MutexLock< lock_acquirewrite_error >(&m_mtx);
+}
+
+void CMutex::Unlock() {
+ if (EOK != pthread_mutex_unlock(&m_mtx)) {
+ throw lock_release_error("");
+ }
+}
+
+
+/////////////////////////////////////////////////////////
+// implements locking policy for reader / writer locks //
+/////////////////////////////////////////////////////////
+CRWLock::CRWLock() {
+ pthread_rwlock_t rw_tmp = PTHREAD_RWLOCK_INITIALIZER;
+ std::memcpy(&m_rwl, &rw_tmp, sizeof(m_rwl));
+ if (EOK != pthread_rwlock_init(&m_rwl, NULL)) {
+ throw lock_creation_error();
+ }
+}
+
+CRWLock::~CRWLock() {
+ pthread_rwlock_destroy(&m_rwl);
+}
+
+void CRWLock::ReadLock() {
+ if (EOK != pthread_rwlock_rdlock(&m_rwl)) {
+ throw lock_acquireread_error();
+ }
+}
+
+void CRWLock::WriteLock() {
+ if (EOK != pthread_rwlock_wrlock(&m_rwl)) {
+ throw lock_acquirewrite_error();
+ }
+}
+
+void CRWLock::Unlock() {
+ if (EOK != pthread_rwlock_unlock(&m_rwl)) {
+ throw lock_release_error();
+ }
+}
+
+/////////////////////////////////////////////////////////
+// implements GNU Builtins for counting leading zeros //
+/////////////////////////////////////////////////////////
+
+// returns the number of leading zeros in a given 16bit value
+SI_16 NS_CountLeadingZeros_16Bit(UI_16 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_clz(f_ui_val)); // NOLINT (readability/nolint)
+}
+
+// returns the number of leading zeros in a given 32bit value
+SI_16 NS_CountLeadingZeros_32Bit(UI_32 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_clzl(f_ui_val)); // NOLINT (readability/nolint)
+}
+
+// returns the number of leading zeros in a given 64bit value
+SI_16 NS_CountLeadingZeros_64Bit(UI_64 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_clzll(f_ui_val)); // NOLINT (readability/nolint)
+}
+
+// returns the number of trailing zeros in a given 16bit value
+SI_16 NS_CountTrailingZeros_16Bit(UI_16 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_ctz(f_ui_val)); // NOLINT (readability/nolint)
+}
+
+// returns the number of trailing zeros in a given 32bit value
+SI_16 NS_CountTrailingZeros_32Bit(UI_32 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_ctzl(f_ui_val)); // NOLINT (readability/nolint)
+}
+
+// returns the number of trailing zeros in a given 64bit value
+SI_16 NS_CountTrailingZeros_64Bit(UI_64 f_ui_val) { // NOLINT (readability/nolint)
+ return static_cast<SI_16>((f_ui_val == 0) ? NS_INVALID_RETURN : __builtin_ctzll(f_ui_val)); // NOLINT (readability/nolint)
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/Makefile b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/Makefile
new file mode 100755
index 0000000..1cc5e18
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/Makefile
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS :=library
+
+
+include ../../../native_service.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile
new file mode 100755
index 0000000..520b5f7
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS = src
+
+include ../../../../native_service.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h
new file mode 100755
index 0000000..4186f09
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h
@@ -0,0 +1,113 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup MY 14 Platfom Software Team
+/// \brief Internal Header for ns_config_parser_XML.c
+///
+/// These functions are used to read from and write to XML file.
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include <ns_config_parser_internal.h>
+#define BUFFERSIZE 200
+#define ZERO 0
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// XMLGetValue:
+/// Function : get value for given key.
+///
+/// \param [in] pCurrNode
+/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
+/// \param [in] pNodePath
+/// const char * - pNodePath is a Pointer to path of Current XML node.
+/// \param [in] pUserKey
+/// const char * - pUserKey is a Pointer to Key provided by user.
+/// \param [in] pReturnValue
+/// char * - pReturnValue is a Pointer to value to be returned corresponding to Key.
+/// \param [in] pReturnState
+/// int * - pReturnState is updated depending upon user provided Key\n
+/// returns 0 if user passed valid key.\n
+/// returns 1 if user passed invalid key.\n
+/// \return status
+/// void
+///////////////////////////////////////////////////////////////////////////////////////////
+void XMLGetValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, char *preturnvalue,
+ int *preturnstate);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// XMLUpdateOldValue:
+/// Function : update value corresponding to given user key.
+///
+/// \param [in] pCurrNode
+/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
+/// \param [in] pNodePath
+/// const char * - pNodePath is a Pointer to path of Current XML node.
+/// \param [in] pUserKey
+/// const char * - pUserKey is a Pointer to Key provided by user.
+/// \param [in] pValue
+/// const char * - pValue is a Pointer to the new value for attribute or text.
+/// \param [in] pReturnState
+/// int * - returns 0 if user passed valid key.\n
+/// returns -6 if old value is not updated with new value.\n
+/// \return status
+/// void
+///////////////////////////////////////////////////////////////////////////////////////////
+void XMLUpdateOldValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, const char *preturnvalue,
+ int *preturnstate);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// XMLUpdateOldValueWithNewValue:
+/// Function : Traverse all nodes of XML tree read value to given node,compare with old value,\n
+/// if old value matched then write new value in place of old value.
+///
+/// \param [in] pCurrNode
+/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
+/// \param [in] pNodePath
+/// const char * -pNodePath is a Pointer to path of Current XML node.
+/// \param [in] pUserKey
+/// const char * -pUserKey is a Pointer to Key provided by user.
+/// \param [in] pOldValue
+/// const char * - pOldValue is a Pointer to the old value for attribute or text of key passed.
+/// \param [in] pNewValue
+/// const char * -pNewValue is a Pointer to the new value for attribute or text to be assigned to the key.
+/// \param [in] pReturnState
+/// int * - returns 0 if user passed valid key.\n
+/// returns -6 if old value is not updated with new value.\n
+/// \return status
+/// void
+///////////////////////////////////////////////////////////////////////////////////////////
+void XMLUpdateOldValueWithNewValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey,
+ const char *poldvalue, const char *pnewvalue, int *preturnstate);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
+
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h
new file mode 100755
index 0000000..6dcf11a
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup MY 14 Platform Software Team
+/// \brief Internal Header for ns_config_parser_cfg.c
+///
+/// These functions are used to read from and write to cfg file.
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <ns_config_parser_internal.h>
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CFGGetValue:
+/// Function : Traverse cfg file and read value corresponding to key.
+///
+/// \param [in] filePtr
+/// FILE * - filePtr is a Pointer to a file descriptor.
+/// \param [in] pKey
+/// const char * -pKey is a Pointer to user key.
+/// \param [in] pRetValue
+/// char * - pRetValue is a Pointer to value or values to be returned corresponding to user key.
+/// \return status
+/// int - value returned depending upon user provided Key is valid or not.\n
+/// returns 1 if user passed invalid key.\n
+/// returns 0 if user passed valid key.\n
+///
+///////////////////////////////////////////////////////////////////////////////////////////
+int CFGGetValue(FILE *file_ptr, const char *p_key, char *p_ret_value);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CFGUpdateOldValue:
+/// Function : Traverse the cfg file and update the value corresponding to given key.
+///
+/// \param [in] hConfigFile
+/// HANDLE - hConfigFile is a handle to given file.
+/// \param [in] pKey
+/// const char * - pKey is a Pointer to user key.
+/// \param [in] pValue
+/// const char * - pValue is a Pointer to new value corresponding to user key.
+/// \return status
+/// int - returns 1 if user passed invalid key.\n
+/// returns 0 if user passed valid key.\n
+/// returns -1 if memory allocation fail.\n
+/// returns -6 if value not updated in file.\n
+///
+///////////////////////////////////////////////////////////////////////////////////////////
+int CFGUpdateOldValue(HANDLE h_config_file, const char *p_key, const char *p_value);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CFGUpdateOldValueWithNewValue
+/// Function : Traverse the cfg file read value to given node,compare with old value,\n
+/// if old value matched then write new value in place of old value.\n
+///
+/// \param [in] hConfigFile
+/// HANDLE - hConfigFile is a handle to given file.
+/// \param [in] pKey
+/// const char * - pKey is a Pointer to user key.
+/// \param [in] pOldValue
+/// const char * - pOldValue is a Pointer to Old Value corresponding to user key.
+/// \param [in] pNewValue
+/// const char * - pNewValue is a Pointer to New Value corresponding to user key.
+/// \return status
+/// int - returns 1 if user passed invalid key.\n
+/// returns 0 if user passed valid key.\n
+/// returns -1 if memory allocation fail.\n
+/// returns -6 if value not updated in file.\n
+///
+///////////////////////////////////////////////////////////////////////////////////////////
+
+int CFGUpdateOldValueWithNewValue(HANDLE h_config_file, const char *p_key,
+ const char *p_old_value, const char *p_new_value);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_
+
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h
new file mode 100755
index 0000000..97c9be6
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h
@@ -0,0 +1,60 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup MY 14 Platform Software Team
+/// \brief Internal Header for ns_config_parser_cfg.c
+///
+/// These structures are file handler structure.
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_
+
+#include <libxml/tree.h>
+#include <ns_config_parser.h>
+
+
+// defines enum for MODE
+// in which file is opened
+typedef enum MODE {
+ kReadMode = 0, kWriteMode, kAppend
+} MODE;
+
+// defines enum for STATUS
+typedef enum STATUS {
+ kSuccess = 0, kFailure
+} STATUS;
+
+// defines enum for Filetype
+// i.e .cfg or .xml or other type of file
+typedef enum Filetype {
+ kCfg = 0, kXml, kOther
+} Filetype;
+
+// FILE STRUCTURE
+typedef struct FILESTRUCT {
+ char *filename;
+ Filetype filetype;
+ MODE mode;
+ xmlDocPtr doc;
+ FILE *fileptr;
+} FILESTRUCT;
+
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h
new file mode 100755
index 0000000..0587489
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h
@@ -0,0 +1,88 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGZONES
+// #define FRAMEWORKUNIFIEDLOGZONES (ZONE_WARN|ZONE_ERR)
+#define FRAMEWORKUNIFIEDLOGZONES (ZONE_INIT|ZONE_FUNC|ZONE_INFO|ZONE_WARN|ZONE_ERR|ZONE_NS_WAR|ZONE_NS_ERR)
+#endif
+
+extern const CHAR kAppName[];
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile
new file mode 100755
index 0000000..9ec700c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile
@@ -0,0 +1,57 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+
+
+######### installed library(*.a) #############
+
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libNS_XMLConfigParser
+
+######### install headers(*.h) #############
+
+
+######### compiled sources #############
+libNS_XMLConfigParser_SRCS = ns_xml_reader.cpp ns_xml_writer.cpp ns_xmlparser.cpp ns_xmlparser_attributes.cpp ns_xmlparser_node.cpp
+
+######### add source path #############
+
+######### add include path #############
+
+CPPFLAGS += -I$(SDKTARGETSYSROOT)/usr/include/libxml2
+CPPFLAGS += -I../../../include
+CPPFLAGS += -I../include
+CPPFLAGS += -I../../../include
+#inc_dummy
+CPPFLAGS += -I../../../NS_ConfigParser/include
+
+######### add compile option #############
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+
+######### add library path #############
+LDFLAGS += -L../../../
+LDFLAGS += -Wl,--no-as-needed
+######### linked library (dynamic) #############
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lxml2
+LDLIBS += -Wl,-Bdynamic -lm
+
+LINK_SHLIB_CXX = Y
+
+include ../../../../../native_service.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..cdf3238
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001
@@ -0,0 +1,208 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS_XMLConfigParser
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS_XMLConfigParser
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NS_ConfigParser/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+DYNAMIC_LIBS += \
+ xml2 \
+ m
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+module_dirs: build_dirs
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp
new file mode 100755
index 0000000..01abb97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp
@@ -0,0 +1,522 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CXMLReader class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_xml_reader.h>
+#include <string>
+#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+CXMLReader *GetCXMLReaderObject(CHAR *f_cfilepath) {
+ CXMLReader *l_p_xml_reader = NULL;
+ if (NULL != f_cfilepath) {
+ l_p_xml_reader = new(std::nothrow) CXMLReader(f_cfilepath); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ return l_p_xml_reader;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+CXMLReader::CXMLReader(): m_pXmlDoc(NULL) {
+}
+
+CXMLReader::CXMLReader(const std::string &f_cFilePath): m_pXmlDoc(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_cFilePath.c_str());
+
+ // create document object structure
+ m_pXmlDoc = xmlParseFile(f_cFilePath.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (!m_pXmlDoc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+}
+
+CXMLReader::~CXMLReader() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
+
+ if (NULL != m_pXmlDoc) {
+ xmlFreeDoc(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
+ m_pXmlDoc = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CXMLReader::ParseFile(const std::string &f_cFilePath) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // create document object structure
+ m_pXmlDoc = xmlParseFile(f_cFilePath.c_str());
+
+ if (NULL == m_pXmlDoc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+PVOID CXMLReader::GetDataPtr() {
+ return m_pXmlDoc;
+}
+
+std::string CXMLReader::GetValue(const std::string &f_cKey) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Key %s", f_cKey.c_str());
+
+ std::string l_cValue = "";
+
+ if (NULL != m_pXmlDoc && (!f_cKey.empty())) {
+ std::string l_cUserKey = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ l_cUserKey.assign(f_cKey);
+
+ // get the root node element
+ xmlNodePtr l_pCurrNode = xmlDocGetRootElement(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (NULL != l_pCurrNode) {
+ // remove the root node name from key
+ size_t l_uiLength = l_cUserKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (std::string::npos != l_uiLength) {
+ l_cUserKey = l_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // if root node name matches with the name in received key
+ if (!(f_cKey.substr(0, l_uiLength)).compare((PCSTR)l_pCurrNode->name)) {
+ l_cValue = XMLGetValue(l_pCurrNode,
+ l_cUserKey);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Parsed Value :: %s", l_cValue.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document structure pointer m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+
+ return l_cValue;
+}
+
+std::string CXMLReader::XMLGetValue(xmlNodePtr f_pCurrNode,
+ const std::string &f_cUserKey) {
+ std::string l_cReturnValue = "";
+
+ if (NULL != f_pCurrNode && (!f_cUserKey.empty())) {
+ std::string l_cKey = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // result of previous attribute of same node
+ BOOL l_bResult = TRUE;
+
+ // this parameter specifies whether to AND or OR the current result with previous result
+ // TRUE means AND while FALSE means OR
+ BOOL l_bOperation = FALSE;
+
+ // position of "@" in user key if exists
+ size_t l_uiAttrLen = 0;
+
+ // get the single attribute from list of attributes of node
+ std::string l_cAttr = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ std::string l_cNodeName = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // contains the single attribute key, value
+ std::string l_cAttrOpt = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // l_cAttrId of the attribute
+ std::string l_cAttrId = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ // value of the attribute
+ std::string l_cAttrValue = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ size_t l_uiSplitProp = 0;
+ size_t l_uiAttrSplit = 0;
+ BOOL l_bCurrentResult = FALSE;
+
+ l_cKey.assign(f_cUserKey);
+
+ // position of first "." in user key
+ size_t l_uiLength = l_cKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+ if (std::string::npos != l_uiLength) {
+ // get the current node name string with node attributes
+ l_cKey = l_cKey.substr(0, l_uiLength); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ l_cNodeName.assign(l_cKey);
+
+ // get children of current node
+ f_pCurrNode = f_pCurrNode->children;
+
+ while (NULL != f_pCurrNode) {
+ // check whether current node is an element node.
+ if (XML_ELEMENT_NODE == f_pCurrNode->type) {
+ l_bResult = TRUE;
+ l_bOperation = FALSE;
+ l_uiAttrLen = 0;
+ l_cAttr.clear();
+
+ // check whether key contains attribute for current node
+ if (std::string::npos != (l_uiAttrLen = l_cKey.find('@'))) {
+ // get the attribute string from node key
+ l_cAttr.assign(l_cKey, (l_uiAttrLen + 1), std::string::npos); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // remove the attribute string from key string
+ l_cKey = l_cKey.substr(0, l_uiAttrLen); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // check whether node name string matches with the current node name
+ if (!l_cKey.compare((PCSTR)f_pCurrNode->name)) {
+ l_cAttrOpt.assign(l_cAttr);
+
+ while (0 < l_cAttr.length()) {
+ // initialize variables
+ l_cAttrId.clear();
+ l_cAttrValue.clear();
+ l_uiSplitProp = 0;
+ l_uiAttrSplit = 0;
+ l_bCurrentResult = FALSE;
+
+ // check whether node have multiple attributes
+ if (std::string::npos != (l_uiSplitProp = l_cAttr.find('|'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else if (std::string::npos != (l_uiSplitProp = l_cAttr.find('&'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else {
+ l_uiSplitProp = l_cAttr.length() - 1;
+ if (std::string::npos != (l_uiAttrSplit = l_cAttr.find('='))) {
+ l_cAttrId = l_cAttr.substr(0, l_uiAttrSplit); // LCOV_EXCL_BR_LINE 11: except branch
+ l_cAttrValue = l_cAttr.substr(l_uiAttrSplit + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+
+ // compare the value of attributes
+ xmlChar *l_pAttrValue = xmlGetProp(f_pCurrNode, (const xmlChar *)l_cAttrId.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
+ if (NULL != l_pAttrValue) {
+ if (!l_cAttrValue.compare((PCSTR)l_pAttrValue)) {
+ l_bCurrentResult = TRUE;
+ }
+ }
+ xmlFree(l_pAttrValue); // LCOV_EXCL_BR_LINE 11: except branch
+ l_pAttrValue = NULL;
+
+ // combine the result of all attributes
+ if (!l_bOperation) {
+ l_bResult = l_bResult && l_bCurrentResult;
+ } else {
+ l_bResult = l_bResult || l_bCurrentResult;
+ }
+
+ if ('|' == l_cAttr[l_uiSplitProp]) {
+ l_bOperation = TRUE;
+ } else {
+ l_bOperation = FALSE;
+ }
+
+ if ((!l_bResult) && (!l_bOperation)) {
+ // break from current while loop
+ break;
+ }
+
+ l_cAttr = l_cAttr.substr(l_uiSplitProp + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // if attributes not matched move to next node
+ if (!l_bResult) {
+ // search for the same node name in next child nodes
+ l_cKey.assign(l_cNodeName);
+ } else {
+ // read text of current node
+ if ((NULL != f_pCurrNode->children) &&
+ (XML_TEXT_NODE == f_pCurrNode->children->type) &&
+ (NULL == f_pCurrNode->children->next)) {
+ // append the result in string
+ l_cReturnValue.append((PCSTR) f_pCurrNode->children->content); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+ } else {
+ l_bResult = FALSE;
+ }
+
+ if (l_bResult) {
+ // parse children and next nodes of current node
+ if (std::string::npos != l_uiLength) {
+ l_cKey = f_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+
+ std::string l_cValue = XMLGetValue(f_pCurrNode, l_cKey); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (!l_cReturnValue.empty() && !l_cValue.empty()) {
+ l_cReturnValue.append("\n");
+ }
+
+ // append the received string
+ l_cReturnValue.append(l_cValue);
+ }
+
+ l_cKey = l_cNodeName;
+ }
+ }
+
+ f_pCurrNode = f_pCurrNode->next;
+ }
+ }
+
+ return l_cReturnValue;
+}
+
+EFrameworkunifiedStatus CXMLReader::GetValue(const std::string &f_cKey, std::string &f_cValue) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pXmlDoc && (!f_cKey.empty())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Key is %s", f_cKey.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ std::string l_cUserKey = "";
+ l_cUserKey.assign(f_cKey);
+
+ // get the root node element
+ xmlNodePtr l_pCurrNode = xmlDocGetRootElement(m_pXmlDoc);
+
+ if (NULL != l_pCurrNode) {
+ // remove the root node name from key
+ size_t l_uiLength = l_cUserKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (std::string::npos != l_uiLength) {
+ l_cUserKey = l_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // if root node name matches with the name in received key
+ if (!(f_cKey.substr(0, l_uiLength)).compare((PCSTR)l_pCurrNode->name)) {
+ BOOL l_bKeyFound = FALSE;
+
+ XMLGetValue(l_pCurrNode, l_cUserKey, f_cValue, l_bKeyFound);
+
+ if (!l_bKeyFound) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Root Node ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Parsed Value :: %s", f_cValue.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document structure pointer m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CXMLReader::XMLGetValue(xmlNodePtr f_pCurrNode, const std::string &f_cUserKey, std::string &f_cValue,
+ BOOL &f_bKeyFound) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_pCurrNode && (!f_cUserKey.empty())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Key :: %s", f_cUserKey.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ std::string l_cKey = "";
+
+ // result of previous attribute of same node
+ BOOL l_bResult = TRUE;
+
+ // this parameter specifies whether to AND or OR the current result with previous result
+ // TRUE means AND while FALSE means OR
+ BOOL l_bOperation = FALSE;
+
+ // position of "@" in user key if exists
+ size_t l_uiAttrLen = 0;
+
+ // get the single attribute from list of attributes of node
+ std::string l_cAttr = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ std::string l_cNodeName = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // contains the single attribute key, value
+ std::string l_cAttrOpt = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // l_cAttrId of the attribute
+ std::string l_cAttrId = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ // value of the attribute
+ std::string l_cAttrValue = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ size_t l_uiSplitProp = 0;
+ size_t l_uiAttrSplit = 0;
+ BOOL l_bCurrentResult = FALSE;
+
+ l_cKey.assign(f_cUserKey);
+
+ // position of first "." in user key
+ size_t l_uiLength = l_cKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+ if (std::string::npos != l_uiLength) {
+ // get the current node name string with node attributes
+ l_cKey = l_cKey.substr(0, l_uiLength); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ l_cNodeName.assign(l_cKey);
+
+ // get children of current node
+ f_pCurrNode = f_pCurrNode->children;
+
+ while (NULL != f_pCurrNode) {
+ // check whether current node is an element node.
+ if (XML_ELEMENT_NODE == f_pCurrNode->type) {
+ l_bResult = TRUE;
+ l_bOperation = FALSE;
+ l_uiAttrLen = 0;
+ l_cAttr.clear();
+
+ // check whether key contains attribute for current node
+ if (std::string::npos != (l_uiAttrLen = l_cKey.find('@'))) {
+ // get the attribute string from node key
+ l_cAttr.assign(l_cKey, (l_uiAttrLen + 1), std::string::npos); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // remove the attribute string from key string
+ l_cKey = l_cKey.substr(0, l_uiAttrLen); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // check whether node name string matches with the current node name
+ if (!l_cKey.compare((PCSTR)f_pCurrNode->name)) {
+ l_cAttrOpt.assign(l_cAttr);
+
+ while (0 < l_cAttr.length()) {
+ // initialize variables
+ l_cAttrId.clear();
+ l_cAttrValue.clear();
+ l_uiSplitProp = 0;
+ l_uiAttrSplit = 0;
+ l_bCurrentResult = FALSE;
+
+ // check whether node have multiple attributes
+ if (std::string::npos != (l_uiSplitProp = l_cAttr.find('|'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else if (std::string::npos != (l_uiSplitProp = l_cAttr.find('&'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else {
+ l_uiSplitProp = l_cAttr.length() - 1;
+ if (std::string::npos != (l_uiAttrSplit = l_cAttr.find('='))) {
+ l_cAttrId = l_cAttr.substr(0, l_uiAttrSplit); // LCOV_EXCL_BR_LINE 11: except branch
+ l_cAttrValue = l_cAttr.substr(l_uiAttrSplit + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+
+ // compare the value of attributes
+ xmlChar *l_pAttrValue = xmlGetProp(f_pCurrNode, (const xmlChar *)l_cAttrId.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
+ if (NULL != l_pAttrValue) {
+ if (!l_cAttrValue.compare((PCSTR)l_pAttrValue)) {
+ l_bCurrentResult = TRUE;
+ }
+
+ xmlFree(l_pAttrValue); // LCOV_EXCL_BR_LINE 11: except branch
+ l_pAttrValue = NULL;
+ }
+
+ // combine the result of all attributes
+ if (!l_bOperation) {
+ l_bResult = l_bResult && l_bCurrentResult;
+ } else {
+ l_bResult = l_bResult || l_bCurrentResult;
+ }
+
+ if ('|' == l_cAttr[l_uiSplitProp]) {
+ l_bOperation = TRUE;
+ } else {
+ l_bOperation = FALSE;
+ }
+
+ if ((!l_bResult) && (!l_bOperation)) {
+ // break from current while loop
+ break;
+ }
+
+ l_cAttr = l_cAttr.substr(l_uiSplitProp + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // if attributes not matched move to next node
+ if (!l_bResult) {
+ // search for the same node name in next child nodes
+ l_cKey.assign(l_cNodeName);
+ } else {
+ // read text of current node
+ if ((NULL != f_pCurrNode->children) &&
+ (XML_TEXT_NODE == f_pCurrNode->children->type) &&
+ (NULL == f_pCurrNode->children->next)) {
+ if (!f_cValue.empty()) {
+ f_cValue.append("\n");
+ }
+
+ // append the result in string
+ f_cValue.append((PCSTR) f_pCurrNode->children->content); // LCOV_EXCL_BR_LINE 11: except branch
+
+ f_bKeyFound = TRUE;
+ }
+ }
+ } else {
+ l_bResult = FALSE;
+ }
+
+ if (l_bResult) {
+ // parse children and next nodes of current node
+ if (std::string::npos != l_uiLength) {
+ l_cKey = f_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+
+ l_eStatus = XMLGetValue(f_pCurrNode, l_cKey, f_cValue, f_bKeyFound);
+ }
+
+ l_cKey = l_cNodeName;
+ }
+ }
+
+ f_pCurrNode = f_pCurrNode->next;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp
new file mode 100755
index 0000000..2876e22
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp
@@ -0,0 +1,338 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains implementation of CXMLWriter class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_xml_writer.h>
+#include <string>
+#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+CXMLWriter *GetCXMLWriterObject(CHAR *f_cfilepath) {
+ CXMLWriter *l_p_xml_writer = NULL;
+ if (NULL != f_cfilepath) {
+ l_p_xml_writer = new(std::nothrow) CXMLWriter(f_cfilepath); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ return l_p_xml_writer;
+}
+
+CXMLWriter *GetCXMLWriterObjectNoParam() {
+ return (new(std::nothrow) CXMLWriter()); // LCOV_EXCL_BR_LINE 11: except branch
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+CXMLWriter::CXMLWriter(): m_pXmlDoc(NULL), m_cFilePath("") {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+}
+
+CXMLWriter::CXMLWriter(const std::string &f_cFilePath): m_pXmlDoc(NULL), m_cFilePath(f_cFilePath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_cFilePath.c_str());
+
+ // create document object structure
+ m_pXmlDoc = xmlParseFile(m_cFilePath.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (!m_pXmlDoc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL");
+ }
+}
+
+CXMLWriter::~CXMLWriter() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
+
+ if (NULL != m_pXmlDoc) {
+ xmlFreeDoc(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
+ m_pXmlDoc = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CXMLWriter::ParseFile(const std::string &f_cFilePath) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = SetPath(f_cFilePath);
+
+ if (NULL != m_pXmlDoc) {
+ xmlFreeDoc(m_pXmlDoc);
+ m_pXmlDoc = NULL;
+ }
+
+ // create document object structure
+ m_pXmlDoc = xmlParseFile(f_cFilePath.c_str());
+
+ if (NULL == m_pXmlDoc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CXMLWriter::SetPath(const std::string &f_cPath) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (!f_cPath.empty()) {
+ // set the file path
+ m_cFilePath.assign(f_cPath);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+VOID CXMLWriter::SetDataPtr(PVOID f_pData) {
+ m_pXmlDoc = NULL;
+ if (NULL != f_pData) {
+ // set the doc pointer
+ m_pXmlDoc = static_cast<xmlDocPtr>(f_pData);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Data Pointer not set in xml writer"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+}
+
+EFrameworkunifiedStatus CXMLWriter::SetValue(const std::string &f_cKey, std::string f_cValue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Key %s", f_cKey.c_str());
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pXmlDoc && (!f_cKey.empty())) {
+ std::string l_cUserKey = "";
+ l_cUserKey.assign(f_cKey);
+
+ // get the root node element
+ xmlNodePtr l_pCurrNode = xmlDocGetRootElement(m_pXmlDoc);
+
+ if (NULL != l_pCurrNode) {
+ // remove the root node name from key
+ size_t l_uiLength = l_cUserKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (std::string::npos != l_uiLength) {
+ l_cUserKey = l_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // if root node name matches with the name in received key
+ if (!(f_cKey.substr(0, l_uiLength)).compare((PCSTR)l_pCurrNode->name)) {
+ BOOL l_bKeyFound = FALSE;
+ l_eStatus = XMLSetValue(l_pCurrNode, l_cUserKey, f_cValue, l_bKeyFound);
+
+ if (!l_bKeyFound) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document structure pointer m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CXMLWriter::XMLSetValue(xmlNodePtr f_pCurrNode,
+ const std::string &f_cUserKey,
+ std::string &f_cValue,
+ BOOL &f_bKeyFound) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (!f_cUserKey.empty() && NULL != f_pCurrNode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Key :: %s", f_cUserKey.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ std::string l_cKey = "";
+
+ // result of previous attribute of same node
+ BOOL l_bResult = TRUE;
+
+ // this parameter specifies whether to AND or OR the current result with previous result
+ // TRUE means AND while FALSE means OR
+ BOOL l_bOperation = FALSE;
+
+ // position of "@" in user key if exists
+ size_t l_uiAttrLen = 0;
+
+ // get the single attribute from list of attributes of node
+ std::string l_cAttr = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ std::string l_cNodeName = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // contains the single attribute key, value
+ std::string l_cAttrOpt = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ // l_cAttrId of the attribute
+ std::string l_cAttrId = ""; // LCOV_EXCL_BR_LINE 11: except branch
+ // value of the attribute
+ std::string l_cAttrValue = ""; // LCOV_EXCL_BR_LINE 11: except branch
+
+ size_t l_uiSplitProp = 0;
+ size_t l_uiAttrSplit = 0;
+ BOOL l_bCurrentResult = FALSE;
+
+ l_cKey.assign(f_cUserKey);
+
+ // position of first "." in user key
+ size_t l_uiLength = l_cKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
+ if (std::string::npos != l_uiLength) {
+ // get the current node name string with node attributes
+ l_cKey = l_cKey.substr(0, l_uiLength); // LCOV_EXCL_BR_LINE 11: except branch
+
+ l_cNodeName.assign(l_cKey);
+ }
+
+ // get children of current node
+ f_pCurrNode = f_pCurrNode->children;
+
+ while (NULL != f_pCurrNode) {
+ // check whether current node is an element node.
+ if (XML_ELEMENT_NODE == f_pCurrNode->type) {
+ l_bResult = TRUE;
+ l_bOperation = FALSE;
+ l_uiAttrLen = 0;
+ l_cAttr.clear();
+
+ // check whether key contains attribute for current node
+ if (std::string::npos != (l_uiAttrLen = l_cKey.find('@'))) {
+ // get the attribute string from node key
+ l_cAttr.assign(l_cKey, (l_uiAttrLen + 1), std::string::npos); // LCOV_EXCL_BR_LINE 11: except branch
+
+ // remove the attribute string from key string
+ l_cKey = l_cKey.substr(0, l_uiAttrLen); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // check whether node name string matches with the current node name
+ if (!l_cKey.compare((PCSTR)f_pCurrNode->name)) {
+ l_cAttrOpt.assign(l_cAttr);
+
+ while (0 < l_cAttr.length()) {
+ // initialize variables
+ l_cAttrId.clear();
+ l_cAttrValue.clear();
+ l_uiSplitProp = 0;
+ l_uiAttrSplit = 0;
+ l_bCurrentResult = FALSE;
+
+ // check whether node have multiple attributes
+ if (std::string::npos != (l_uiSplitProp = l_cAttr.find('|'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else if (std::string::npos != (l_uiSplitProp = l_cAttr.find('&'))) {
+ l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
+
+ if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
+ l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
+ l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
+ }
+ } else {
+ l_uiSplitProp = l_cAttr.length() - 1;
+ if (std::string::npos != (l_uiAttrSplit = l_cAttr.find('='))) {
+ l_cAttrId = l_cAttr.substr(0, l_uiAttrSplit); // LCOV_EXCL_BR_LINE 11: except branch
+ l_cAttrValue = l_cAttr.substr(l_uiAttrSplit + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+
+ // compare the value of attributes
+ xmlChar *l_pAttrValue = xmlGetProp(f_pCurrNode, (const xmlChar *)l_cAttrId.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
+ if (NULL != l_pAttrValue) {
+ if (!l_cAttrValue.compare((PCSTR)l_pAttrValue)) {
+ l_bCurrentResult = TRUE;
+ }
+ }
+ xmlFree(l_pAttrValue);
+ l_pAttrValue = NULL;
+
+ // combine the result of all attributes
+ if (!l_bOperation) {
+ l_bResult = l_bResult && l_bCurrentResult;
+ } else {
+ l_bResult = l_bResult || l_bCurrentResult;
+ }
+
+ if ('|' == l_cAttr[l_uiSplitProp]) {
+ l_bOperation = TRUE;
+ } else {
+ l_bOperation = FALSE;
+ }
+
+ if ((!l_bResult) && (!l_bOperation)) {
+ // break from current while loop
+ break;
+ }
+
+ l_cAttr = l_cAttr.substr(l_uiSplitProp + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ // if attributes not matched move to next node
+ if (!l_bResult) {
+ // search for the same node name in next child nodes
+ l_cKey.assign(l_cNodeName);
+ } else {
+ // read text of current node
+ if ((NULL != f_pCurrNode->children) &&
+ (XML_TEXT_NODE == f_pCurrNode->children->type) &&
+ (NULL == f_pCurrNode->children->next)) {
+ // set the value
+ xmlNodeSetContent(f_pCurrNode, (const xmlChar *)f_cValue.c_str());
+
+ f_bKeyFound = TRUE;
+ }
+ }
+ }
+
+ if (l_bResult) {
+ // parse children and next nodes of current node
+ l_cKey = f_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
+ l_eStatus = XMLSetValue(f_pCurrNode, l_cKey, f_cValue, f_bKeyFound);
+ }
+ }
+
+ f_pCurrNode = f_pCurrNode->next;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CXMLWriter::SaveData() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // save the doc structure to the file
+ if (-1 == xmlSaveFileEnc(m_cFilePath.c_str(), m_pXmlDoc, "UTF-8")) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp
new file mode 100755
index 0000000..cb05865
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp
@@ -0,0 +1,354 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_XmlParser
+/// \brief This file contains implementation of CXmlParser class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_xmlparser_if.h>
+#include <fstream>
+#include <string>
+#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CXmlParser
+/// Constructor
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlParser::CXmlParser(): m_pXmlDoc(NULL), m_cFileName(""), m_pRootNode(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // for maintaining indentation
+ xmlKeepBlanksDefault(0); // LCOV_EXCL_BR_LINE 11: except branch
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CXmlParser
+/// Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlParser::~CXmlParser() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // clears the document structure
+ ClearDocument(); // LCOV_EXCL_BR_LINE 11: except branch
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ParseXml
+/// Parses the xml file and creates a document structure
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlParser::ParseXml(std::string f_cFileName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // clears the document structure
+ ClearDocument(); // LCOV_EXCL_BR_LINE 11: except branch
+
+ m_cFileName = f_cFileName;
+
+ if (IsReadable(m_cFileName)) {
+ // create document object structure
+ m_pXmlDoc = xmlParseFile(m_cFileName.c_str());
+
+ if (NULL != m_pXmlDoc) {
+ // sets the root node in class
+ m_pRootNode.SetXmlNodePtr(xmlDocGetRootElement(m_pXmlDoc));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document not parsed successfully :: %s", f_cFileName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "File not exists :: %s", f_cFileName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateNewXmlDoc
+/// Creates a new xml document with f_cRootNodeName as root node
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlParser::CreateNewXmlDoc(std::string f_cRootNodeName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ xmlNodePtr l_pRootNodePtr = NULL;
+
+ // clears the document structure
+ ClearDocument();
+
+ if (0 < f_cRootNodeName.length()) {
+ // creates new document structure
+ m_pXmlDoc = xmlNewDoc((const xmlChar *)"1.0");
+ if (NULL != m_pXmlDoc) {
+ // create new node(root)
+ l_pRootNodePtr = xmlNewNode(NULL,
+ (const xmlChar *)f_cRootNodeName.c_str());
+ if (NULL != l_pRootNodePtr) {
+ // sets the root node in document structure
+ xmlDocSetRootElement(m_pXmlDoc, l_pRootNodePtr);
+
+ // sets the root node in class
+ m_pRootNode.SetXmlNodePtr(l_pRootNodePtr);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error creating new root node"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Unable to create new xml document structure"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid root node name :: %s", f_cRootNodeName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SaveXml
+/// Saves the document structure in an xml file
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlParser::SaveXml(std::string f_cFileName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_cFileName = "";
+
+ // if user explicitly provides file name
+ if (0 < f_cFileName.length()) {
+ l_cFileName.assign(f_cFileName);
+ } else { // takes the file name from the CXmlParser object
+ l_cFileName.assign(m_cFileName);
+ }
+
+ if (NULL != m_pXmlDoc) {
+ if (IsReadable(l_cFileName)) {
+ // save the doc structure to the file
+ if (-1 == xmlSaveFormatFileEnc(l_cFileName.c_str(), m_pXmlDoc, "UTF-8", 1)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "File not exists :: %s", f_cFileName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRootNode
+/// Gets the root node object of xml
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlParser::GetRootNode() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_pRootNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddNewNode
+/// Adds the new node to the parent node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlParser::AddNewNode(CXmlNode m_pParentNode, std::string f_cNewNodeName, std::string f_cContent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (!m_pParentNode.IsNull()) {
+ l_pXmlNode = m_pParentNode.AddChildNode(f_cNewNodeName, f_cContent); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveNode
+/// Removes the node from the xml
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlParser::RemoveNode(CXmlNode m_pNode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (!m_pNode.IsNull()) {
+ xmlUnlinkNode(m_pNode.m_pXmlNodePtr);
+ xmlFreeNode(m_pNode.m_pXmlNodePtr);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FindNode
+/// Finds the first matching node, by tag name or path
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlParser::FindNode(std::string f_cNodePath, CXmlNode f_pCurrentNode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ xmlXPathObjectPtr l_pXpathObj = GetNodeSet(f_cNodePath, f_pCurrentNode); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (NULL != l_pXpathObj) {
+ if (NULL != l_pXpathObj->nodesetval && 0 < l_pXpathObj->nodesetval->nodeNr) {
+ l_pXmlNode.SetXmlNodePtr(l_pXpathObj->nodesetval->nodeTab[0]); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NodeSetVal is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ xmlXPathFreeObject(l_pXpathObj); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "xmlXPathObjectPtr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FindAllNodes
+/// Finds all the matching node, by tag name or path
+////////////////////////////////////////////////////////////////////////////////////////////////
+TNodeList CXmlParser::FindAllNodes(std::string f_cNodePath, CXmlNode f_pCurrentNode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TNodeList l_pNodeList;
+
+ xmlXPathObjectPtr l_pXpathObj = GetNodeSet(f_cNodePath, f_pCurrentNode); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (NULL != l_pXpathObj) {
+ if (NULL != l_pXpathObj->nodesetval && 0 < l_pXpathObj->nodesetval->nodeNr) {
+ for (UI_8 l_uiSize = 0;
+ l_uiSize < l_pXpathObj->nodesetval->nodeNr;
+ l_uiSize++) {
+ if (NULL != l_pXpathObj->nodesetval->nodeTab[l_uiSize]) {
+ CXmlNode l_pNode(l_pXpathObj->nodesetval->nodeTab[l_uiSize]); // LCOV_EXCL_BR_LINE 11: except branch
+ l_pNodeList.push_back(l_pNode);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "node pointer is NULL");
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NodeSetVal is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ xmlXPathFreeObject(l_pXpathObj); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "xmlXPathObjectPtr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNodeList;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetNodeSet
+/// Gets the node set resulting from search of nodepath using XPath
+////////////////////////////////////////////////////////////////////////////////////////////////
+xmlXPathObjectPtr CXmlParser::GetNodeSet(std::string f_cNodePath, CXmlNode f_pCurrentNode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ xmlXPathObjectPtr l_pXpathObj = NULL;
+
+ xmlXPathContextPtr l_pXpathCtx = NULL;
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlDoc) {
+ if (!f_pCurrentNode.IsNull()) {
+ l_pXmlNode = f_pCurrentNode;
+ }
+
+ // Create xpath evaluation context
+ l_pXpathCtx = xmlXPathNewContext(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (NULL != l_pXpathCtx) {
+ // set the current node in path context
+ l_pXpathCtx->node = l_pXmlNode.m_pXmlNodePtr;
+
+ // Evaluate xpath expression
+ l_pXpathObj = xmlXPathEvalExpression((const xmlChar *)f_cNodePath.c_str(), l_pXpathCtx); // LCOV_EXCL_BR_LINE 11: except branch
+
+ if (NULL == l_pXpathObj) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to evaluate nodepath :: \"%s\"", f_cNodePath.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ // Cleanup of XPath data
+ xmlXPathFreeContext(l_pXpathCtx); // LCOV_EXCL_BR_LINE 11: except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to create new XPath context"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "document object is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXpathObj;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearDocument
+/// Clears the document structure and resets the root node
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CXmlParser::ClearDocument() {
+ if (NULL != m_pXmlDoc) {
+ // free the document
+ xmlFreeDoc(m_pXmlDoc);
+ m_pXmlDoc = NULL;
+
+ // free the global variables that may have been allocated by the parser
+ xmlCleanupParser();
+ }
+
+ m_pRootNode = NULL;
+ m_cFileName.clear();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsReadable
+/// Checks whether the file exists or not
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CXmlParser::IsReadable(const std::string &filename) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReadable = FALSE;
+
+ std::ifstream l_ifstream(filename.c_str());
+
+ if (l_ifstream.good()) {
+ l_bReadable = TRUE;
+ l_ifstream.close(); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReadable;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp
new file mode 100755
index 0000000..27b6bad
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_XmlParser
+/// \brief This file contains implementation of CXmlAttr class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_xmlparser_if.h>
+#include <string>
+#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CXmlAttr
+/// Constructor of CXmlAttr class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlAttr::CXmlAttr(): m_cKey(""), m_cValue("") {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CXmlAttr
+/// Parameterized constructor of CXmlAttr class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlAttr::CXmlAttr(std::string f_cKey, std::string f_cValue): m_cKey(f_cKey), m_cValue(f_cValue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CXmlAttr
+/// Destructor of CXmlAttr class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlAttr::~CXmlAttr() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp
new file mode 100755
index 0000000..47f6caa
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp
@@ -0,0 +1,658 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_XmlParser
+/// \brief This file contains implementation of CXmlNode class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_xmlparser_if.h>
+#include <string>
+#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CXmlNode
+/// Constructor
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode::CXmlNode(): m_pXmlNodePtr(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CXmlNode
+/// Parameterized Constructor
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode::CXmlNode(xmlNodePtr f_pXmlNodePtr): m_pXmlNodePtr(f_pXmlNodePtr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CXmlNode
+/// Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode::~CXmlNode() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetXmlNodePtr
+/// Sets the xmlNodePtr in class
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CXmlNode::SetXmlNodePtr(xmlNodePtr f_pXmlNodePtr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_pXmlNodePtr = f_pXmlNodePtr;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsNull
+/// Checks whether the node is valid or not
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CXmlNode::IsNull() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bNull = FALSE;
+
+ if (NULL == m_pXmlNodePtr) {
+ l_bNull = TRUE;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bNull;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Type
+/// Gets the type of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedXmlNodeTypes CXmlNode::Type() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedXmlNodeTypes l_eNodeType = FRAMEWORKUNIFIED_XML_NODE_NONE;
+
+ if (NULL != m_pXmlNodePtr) {
+ switch (m_pXmlNodePtr->type) {
+ case XML_ELEMENT_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ELEMENT_NODE;
+ break;
+ case XML_ATTRIBUTE_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ATTRIBUTE_NODE;
+ break;
+ case XML_TEXT_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_TEXT_NODE;
+ break;
+ case XML_CDATA_SECTION_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_CDATA_SECTION_NODE;
+ break;
+ case XML_ENTITY_REF_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ENTITY_REF_NODE;
+ break;
+ case XML_ENTITY_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ENTITY_NODE;
+ break;
+ case XML_PI_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_PI_NODE;
+ break;
+ case XML_COMMENT_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_COMMENT_NODE;
+ break;
+ case XML_DOCUMENT_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_DOCUMENT_NODE;
+ break;
+ case XML_DOCUMENT_TYPE_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_DOCUMENT_TYPE_NODE;
+ break;
+ case XML_DOCUMENT_FRAG_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_DOCUMENT_FRAG_NODE;
+ break;
+ case XML_NOTATION_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_NOTATION_NODE;
+ break;
+ case XML_HTML_DOCUMENT_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_HTML_DOCUMENT_NODE;
+ break;
+ case XML_DTD_NODE:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_DTD_NODE;
+ break;
+ case XML_ELEMENT_DECL:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ELEMENT_DECL;
+ break;
+ case XML_ATTRIBUTE_DECL:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ATTRIBUTE_DECL;
+ break;
+ case XML_ENTITY_DECL:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_ENTITY_DECL;
+ break;
+ case XML_NAMESPACE_DECL:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_NAMESPACE_DECL;
+ break;
+ case XML_XINCLUDE_START:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_XINCLUDE_START;
+ break;
+ case XML_XINCLUDE_END:
+ l_eNodeType = FRAMEWORKUNIFIED_XML_XINCLUDE_END;
+ break;
+ default:
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eNodeType;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Name
+/// Gets the name of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+std::string CXmlNode::Name() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_cNodeName = "";
+
+ if (NULL != m_pXmlNodePtr && NULL != m_pXmlNodePtr->name) {
+ l_cNodeName = std::string((PCSTR)m_pXmlNodePtr->name); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_cNodeName;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetContent
+/// Gets the content of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+std::string CXmlNode::GetContent() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_cText = "";
+
+ if ((NULL != m_pXmlNodePtr) &&
+ (NULL != m_pXmlNodePtr->children) &&
+ (XML_TEXT_NODE == m_pXmlNodePtr->children->type) &&
+ (NULL == m_pXmlNodePtr->children->next)) {
+ xmlChar * p_xmlText = xmlNodeGetContent(m_pXmlNodePtr);
+ l_cText = std::string((PCSTR)p_xmlText); // LCOV_EXCL_BR_LINE 11: except branch
+ xmlFree(p_xmlText); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_cText;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetContent
+/// Sets or updates the content of current node.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::SetContent(std::string f_cUpdatedText) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pXmlNodePtr) {
+ xmlNodeSetContent(m_pXmlNodePtr, (const xmlChar *)f_cUpdatedText.c_str());
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetAttributeValue
+/// Gets the attribute's value for the key.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::GetAttributeValue(std::string f_cKey, std::string &f_cAttributeValue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pXmlNodePtr) {
+ xmlChar *l_pAttrValue = xmlGetProp(m_pXmlNodePtr,
+ (const xmlChar *)f_cKey.c_str());
+ if (NULL != l_pAttrValue) {
+ f_cAttributeValue.assign((PCSTR)l_pAttrValue);
+
+ xmlFree(l_pAttrValue);
+ l_pAttrValue = NULL;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Attribute key :: %s not found", f_cKey.c_str());
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Node ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetAttributeValue
+/// Sets the attribute's value for the key
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::SetAttributeValue(std::string f_cKey, std::string f_cValue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "SetAttributeValue feature is not available,"
+ "Reason: This API is not supported by libxml2 present in PosixBasedOS001"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddNewAttribute
+/// Add new attribute to the node
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::AddNewAttribute(std::string f_cKey, std::string f_cAttributeValue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ xmlChar* p_key = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cKey.c_str()));
+ xmlChar* p_value = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cAttributeValue.c_str()));
+ if (NULL != m_pXmlNodePtr) {
+ if (NULL == xmlNewNsProp(m_pXmlNodePtr,
+ NULL,
+ p_key,
+ p_value)) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Unable to add new property :: %s", f_cKey.c_str());
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Node ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveAttribute
+/// Removes the attribute from the node with the specified key
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::RemoveAttribute(std::string f_cKey) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "RemoveAttribute feature is not available,"
+ "Reason: This API is not supported by libxml2 present in PosixBasedOS001"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetAttributeItems
+/// Gets the list of all the attribute's key and value of the node
+////////////////////////////////////////////////////////////////////////////////////////////////
+TAttrList CXmlNode::GetAttributeItems() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TAttrList l_cAttrList;
+ std::string l_cKey;
+ std::string l_cValue;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlAttrPtr l_pAttr = m_pXmlNodePtr->properties;
+ l_pAttr != NULL;
+ l_pAttr = l_pAttr->next) {
+ l_cKey = (PCSTR)l_pAttr->name;
+ l_cValue = "";
+
+ if (NULL != l_pAttr->children) {
+ l_cValue = (PCSTR)l_pAttr->children->content;
+ }
+
+ CXmlAttr l_pXmlAttr(l_cKey, l_cValue);
+ l_cAttrList.push_back(l_pXmlAttr); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_cAttrList;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Parent
+/// Gets the parent node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::Parent() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr && NULL != m_pXmlNodePtr->parent) {
+ if (XML_ELEMENT_NODE == m_pXmlNodePtr->parent->type) {
+ l_pXmlNode.SetXmlNodePtr(m_pXmlNodePtr->parent); // LCOV_EXCL_BR_LINE 11: except branch
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FirstChild
+/// Gets the first child of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::FirstChild() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->next) {
+ if (XML_ELEMENT_NODE == l_pNodePtr->type) {
+ l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// LastChild
+/// Gets the last child of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::LastChild() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->last;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->prev) {
+ if (XML_ELEMENT_NODE == l_pNodePtr->type) {
+ l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// Children
+/// Gets the list of all the child node of current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+TNodeList CXmlNode::Children() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TNodeList l_pNodeList;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->next) {
+ if (XML_ELEMENT_NODE == l_pNodePtr->type) {
+ CXmlNode l_pXmlNode(l_pNodePtr);
+ l_pNodeList.push_back(l_pXmlNode);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNodeList;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NextSibling
+/// Gets the next sibling node of current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::NextSibling() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->next;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->next) {
+ if (XML_ELEMENT_NODE == l_pNodePtr->type) {
+ l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// PrevSibling
+/// Gets the previous sibling node of current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::PrevSibling() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->prev;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->prev) {
+ if (XML_ELEMENT_NODE == l_pNodePtr->type) {
+ l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FindChildNode
+/// Finds the first immediate sub node matching tag as f_cNodeName.
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::FindChildNode(std::string f_cNodeName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CXmlNode l_pXmlNode;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->next) {
+ if ((XML_ELEMENT_NODE == m_pXmlNodePtr->type) &&
+ (0 == f_cNodeName.compare((PCSTR)l_pNodePtr->name))) {
+ l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pXmlNode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FindAllChildNodes
+/// Gets the list of all the immediate sub node matching tag as f_cNodeName.
+////////////////////////////////////////////////////////////////////////////////////////////////
+TNodeList CXmlNode::FindAllChildNodes(std::string f_cNodeName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TNodeList l_pNodeList;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
+ l_pNodePtr != NULL;
+ l_pNodePtr = l_pNodePtr->next) {
+ if ((XML_ELEMENT_NODE == m_pXmlNodePtr->type) &&
+ (0 == f_cNodeName.compare((PCSTR)l_pNodePtr->name))) {
+ CXmlNode l_pXmlNode(l_pNodePtr);
+ l_pNodeList.push_back(l_pXmlNode);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNodeList;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetContentOfChildNode
+/// Finds the first level sub node matching tag as f_cNodeName.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::GetContentOfChildNode(std::string f_cNodeName, std::string &f_cContent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CXmlNode l_pXmlNode = FindChildNode(f_cNodeName);
+
+ if (!l_pXmlNode.IsNull()) {
+ f_cContent.assign(l_pXmlNode.GetContent());
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddChildNode
+/// Adds sub node to the current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::AddChildNode(std::string f_cNodeName, std::string f_cText) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // pointer of child node
+ xmlNodePtr l_pChildNode = NULL;
+
+ // content of child node
+ xmlChar *l_cNodeContent = NULL;
+
+ // validate the node name
+ if (NULL != m_pXmlNodePtr && 0 < f_cNodeName.length()) {
+ if (0 < f_cText.length()) {
+ xmlChar* p_text = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cText.c_str()));
+ l_cNodeContent = p_text;
+ }
+
+ if (NULL == (l_pChildNode = xmlNewDocNode(m_pXmlNodePtr->doc,
+ m_pXmlNodePtr->ns,
+ (const xmlChar *)f_cNodeName.c_str(),
+ l_cNodeContent))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error creating child node");
+ } else {
+ l_pChildNode->type = XML_ELEMENT_NODE;
+ l_pChildNode->parent = m_pXmlNodePtr;
+ l_pChildNode->doc = m_pXmlNodePtr->doc;
+
+ // if there is no other child to the parent
+ if (m_pXmlNodePtr->children == NULL) {
+ m_pXmlNodePtr->children = l_pChildNode;
+ m_pXmlNodePtr->last = l_pChildNode;
+ } else { // else add the new child to the end of children list
+ // temp node
+ xmlNodePtr l_pTempNode = m_pXmlNodePtr->last;
+ l_pTempNode->next = l_pChildNode;
+ l_pChildNode->prev = l_pTempNode;
+
+ m_pXmlNodePtr->last = l_pChildNode;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return CXmlNode(l_pChildNode);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddSiblingNode
+/// Adds new node as sibling to the current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+CXmlNode CXmlNode::AddSiblingNode(std::string f_cNodeName, std::string f_cText) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ xmlNodePtr l_pNewNode = NULL;
+ xmlNodePtr l_pSiblingNode = NULL;
+
+ if (NULL != m_pXmlNodePtr &&
+ !this->Parent().IsNull()) { // check whether the node is root node
+ if (NULL != (l_pNewNode = xmlNewNode(NULL,
+ (const xmlChar *)f_cNodeName.c_str()))) {
+ if (0 < f_cText.length()) {
+ xmlChar* p_text = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cText.c_str()));
+ xmlNodeSetContent(l_pNewNode, p_text);
+ }
+
+ l_pSiblingNode = xmlAddSibling(m_pXmlNodePtr,
+ l_pNewNode);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return CXmlNode(l_pSiblingNode);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveChildNode
+/// Removes the child node from current node
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::RemoveChildNode(std::string f_cNodeName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CXmlNode l_pXmlNode = FindChildNode(f_cNodeName);
+ if (!l_pXmlNode.IsNull()) {
+ xmlUnlinkNode(l_pXmlNode.m_pXmlNodePtr);
+ xmlFreeNode(l_pXmlNode.m_pXmlNodePtr);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearNode
+/// Clears the contents, attributes of node
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CXmlNode::ClearNode() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_pXmlNodePtr) {
+ for (xmlNodePtr l_pXmlNode = m_pXmlNodePtr->children;
+ l_pXmlNode != NULL;
+ l_pXmlNode = m_pXmlNodePtr->children) {
+ xmlUnlinkNode(l_pXmlNode);
+ xmlFreeNode(l_pXmlNode);
+ }
+
+ for (xmlAttrPtr l_pXmlAttr = m_pXmlNodePtr->properties;
+ l_pXmlAttr != NULL;
+ l_pXmlAttr = m_pXmlNodePtr->properties) {
+ xmlRemoveProp(l_pXmlAttr);
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk
new file mode 100755
index 0000000..93b9f97
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/cfg/depends.mk
@@ -0,0 +1,25 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+# Utilizing Base Domain Dependency File. Can override at any point
+include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp
new file mode 100755
index 0000000..3965783
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__service_if.cpp
@@ -0,0 +1,367 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified__CWORD77__service_if.h>
+#include <native_service/ns__CWORD77__data_pool_if.h>
+#include <other_service/strlcpy.h>
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "ns__CWORD77__data_pool_internal.h"
+#include "ns__CWORD77__common_internal.h"
+
+#define NS__CWORD77__MAX_SESSION_RETRY_COUNT 10
+
+//////////////////////////////////////////
+/// Function : CFrameworkunified_CWORD77_Service
+//////////////////////////////////////////
+CFrameworkunified_CWORD77_Service::CFrameworkunified_CWORD77_Service()
+ : m_cbResponse(NULL),
+ m_cbSessionACK(NULL),
+ m_pSession(NULL),
+ m_cServiceName(""),
+ m_bServiceAvailable(FALSE),
+ m_ui8SessionRetryCount(0),
+ m_hApp(NULL) { // LCOV_EXCL_BR_LINE 11:except branch
+ m_SessTypeToSessObj.clear();
+}
+//////////////////////////////////////////
+/// Function : ~CFrameworkunified_CWORD77_Service
+//////////////////////////////////////////
+CFrameworkunified_CWORD77_Service::~CFrameworkunified_CWORD77_Service() { // LCOV_EXCL_BR_LINE 11:except branch
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ while (l_iter != m_SessTypeToSessObj.end()) {
+ CFrameworkunified_CWORD77_Session *l_pTemp = l_iter->second;
+ DELETEPTR(l_pTemp); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns__CWORD77__common.h"
+ l_iter++;
+ }
+}
+//////////////////////////////////////////
+/// Function : SetResponseCallback
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::SetResponseCallback(ResponseServiceTo_CWORD77_ cbResponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ m_cbResponse = cbResponse;
+ if (m_cbResponse == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "Call back function ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ while (l_iter != m_SessTypeToSessObj.end()) {
+ if (l_iter->second != NULL) {
+ l_iter->second->SetResponseCallback(m_cbResponse);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ l_iter++;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : SetSession
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::SetSession(CFrameworkunified_CWORD77_Session *f_pSessionObj) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ m_SessTypeToSessObj[f_pSessionObj->GetSessionType()] = f_pSessionObj;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : SendMessageToSession
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::SendMessageToSession(UI_32 f_uiSessionType, UI_32 f_uiSrvProtocol) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ l_iter = m_SessTypeToSessObj.find(f_uiSessionType);
+ if (l_iter != m_SessTypeToSessObj.end()) {
+ if (l_iter->second != NULL) {
+ if (eFrameworkunifiedStatusSessionErr == l_iter->second->HandleSessionMessage(f_uiSrvProtocol)) {
+ if (m_bServiceAvailable) {
+ if (NS__CWORD77__MAX_SESSION_RETRY_COUNT < m_ui8SessionRetryCount) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send cmd 0x%X."
+ " But, service is available. Open session req max limit reached [%s].",
+ f_uiSrvProtocol, m_cServiceName.c_str());
+ // TODO(framework_unified): what to do in case of max limit reached?
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send cmd 0x%X."
+ " But, service is available. Re-sending open session req [%s].",
+ f_uiSrvProtocol, m_cServiceName.c_str());
+ // send open session request
+ OpenSessionRetry(f_uiSessionType);
+ m_ui8SessionRetryCount++;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "Unable to send cmd 0x%X."
+ " Service not yet available.", f_uiSrvProtocol);
+ }
+ } else {
+ // ignore error, already printed by HandleSessionMessage
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object is not there in Map for session type %d ", f_uiSessionType);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+//////////////////////////////////////////
+/// Function : OpenSession
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::OpenSession(HANDLE f_hApp, const std::string &f_sServiceName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ m_cServiceName = f_sServiceName;
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ while (l_iter != m_SessTypeToSessObj.end()) {
+ if (l_iter->second != NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, " Sent open session request for session %d ", l_iter->first); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_iter->second->OpenSession(f_hApp, f_sServiceName); // LCOV_EXCL_BR_LINE 11:except branch
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ l_iter++;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : CloseSession
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::CloseSession(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ while (l_iter != m_SessTypeToSessObj.end()) {
+ if (l_iter->second != NULL) {
+ l_iter->second->CloseSession(f_hApp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ l_iter++;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : OpenSessionAcks
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::OpenSessionAcks(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ OpenSessionAck tOpenSessAck;
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ m_ui8SessionRetryCount = 0;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &tOpenSessAck, sizeof(tOpenSessAck)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "/***********************************************************************/");
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_,
+ __PRETTY_FUNCTION__,
+ "Open session ACK obtained for service: [%s] with session type: [%d]",
+ tOpenSessAck.cSessionName != 0 ? tOpenSessAck.cSessionName : NULL,
+ tOpenSessAck.sessionType);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "/***********************************************************************/");
+ // LCOV_EXCL_BR_STOP
+ UI_32 l_uisessionType = tOpenSessAck.sessionType;
+ /// Session Acks
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.begin();
+ while (l_iter != m_SessTypeToSessObj.end()) {
+ if (l_iter->second != NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __PRETTY_FUNCTION__, "Get session type = %d", l_iter->second->GetSessionType()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ if (l_uisessionType == l_iter->second->GetSessionType()) {
+ l_iter->second->OpenSessionAcknowledge(f_hApp);
+
+ if (m_cbSessionACK != NULL) {
+ (VOID)m_cbSessionACK(f_hApp, m_cServiceName, tOpenSessAck.cSessionName, tOpenSessAck.sessionType,
+ tOpenSessAck.eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR,
+ __FUNCTION__,
+ "Unexpected Session_Type from service [%s]. Obtained Session_Type: [%d] != Expected Session_Type: [%d]",
+ tOpenSessAck.cSessionName != 0 ? tOpenSessAck.cSessionName : NULL,
+ l_uisessionType,
+ l_iter->second->GetSessionType()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ l_iter++;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : OpenServiceOnAvailability
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::OpenServiceOnAvailability(HANDLE f_hApp, const std::string &f_sServiceName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ m_hApp = f_hApp;
+ m_bServiceAvailable = TRUE;
+ m_ui8SessionRetryCount = 0;
+ AttachOpenSessionAckCallback(f_hApp);
+ OpenSession(f_hApp, f_sServiceName);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return eStatus;
+}
+//////////////////////////////////////////
+/// Function : CloseServiceOnUnavailability
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::CloseServiceOnUnavailability(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ m_bServiceAvailable = FALSE;
+ m_ui8SessionRetryCount = 0;
+ CloseSession(f_hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return eStatus;
+}
+
+//////////////////////////////////////////
+/// Function : AddNotification
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::AddNotification(PCSTR f_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ FrameworkunifiedNotificationCallbackHandler tNotifyStruct = {};
+ /**
+ * @todo
+ * Defining a NULL for argument f_pNotification results in a segmentation fault.
+ */
+ strlcpy(tNotifyStruct.cNotification, f_pNotification, sizeof(tNotifyStruct.cNotification)); // LCOV_EXCL_BR_LINE 11:except branch
+ tNotifyStruct.callBack = CCallback< CFrameworkunified_CWORD77_Service, &CFrameworkunified_CWORD77_Service::OnServiceNtf >::set(this); // LCOV_EXCL_BR_LINE 11:except branch
+ m_vServiceNotifications.push_back(tNotifyStruct); // LCOV_EXCL_BR_LINE 11:except branch
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+
+//////////////////////////////////////////
+/// Function : SubscribeNotifications
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::SubscribeNotifications(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t Size = m_vServiceNotifications.size();
+ for (size_t i = 0; i < Size; i++) {
+ if (m_vServiceNotifications[i].callBack != NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "Before subscribing notifications"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSubscribeNotificationWithCallback(f_hApp, m_vServiceNotifications[i].cNotification,
+ m_vServiceNotifications[i].callBack)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSubscribeNotificationWithCallback fail"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : UnSubscribeNotifications
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::UnSubscribeNotifications(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t Size = m_vServiceNotifications.size();
+ for (size_t i = 0; i < Size; i++) {
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedUnsubscribeNotificationWithCallback(f_hApp, m_vServiceNotifications[i].cNotification)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedUnsubscribeNotificationWithCallback fail");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+/// Function : OnServiceNtf
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Service::OnServiceNtf(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {};
+ PCSTR l_cNotificationName = FrameworkunifiedGetLastNotification(hApp);
+ // retrieve notification name
+ // FrameworkunifiedGetSystemInfo(hApp, l_cNotificationName);
+
+ UI_32 l_uiLength = FrameworkunifiedGetMsgLength(hApp);
+ if (l_uiLength != 0) {
+ std::vector<char> data;
+ data.resize(l_uiLength);
+ if (eFrameworkunifiedStatusOK == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &data[0], l_uiLength))) {
+ SetRespNotfnDataIn_CWORD77_DataPool(l_cNotificationName, static_cast<UI_32>(data.size()), &data[0]);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Error, "
+ "Resp Notfn Data not set in _CWORD77_ data pool, status: 0x%x", l_eStatus);
+ }
+ } else {
+ SetRespNotfnDataIn_CWORD77_DataPool(l_cNotificationName, 0, NULL);
+ }
+
+ m_cbResponse(hApp, NOTIFICATION, m_cServiceName);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+/// Function : OpenSessionRetry
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::OpenSessionRetry(UI_32 f_ui32SessionType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_FUNC, __FUNCTION__, "+");
+ if (!m_cServiceName.empty() && (NULL != m_hApp)) {
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *>::iterator l_iter;
+ l_iter = m_SessTypeToSessObj.find(f_ui32SessionType);
+ if (l_iter != m_SessTypeToSessObj.end()) {
+ if (NULL != l_iter->second) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "Re-sending open session req for session type %d ", l_iter->first);
+ l_iter->second->OpenSession(m_hApp, m_cServiceName);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Object ptr for session type[%d] is NULL ", l_iter->first);
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Can't retry for open session req. Service name: [%s], hApp:[%p].",
+ m_cServiceName.c_str(),
+ m_hApp);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_FUNC, __FUNCTION__, "-");
+}
+
+//////////////////////////////////////////
+/// Function : Set_CWORD77_OpenSessionACK
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Service::Set_CWORD77_OpenSessionACK(SessionAckTo_CWORD77_ cbResponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ m_cbSessionACK = cbResponse;
+ if (NULL == m_cbSessionACK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __PRETTY_FUNCTION__, "Call back function ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp
new file mode 100755
index 0000000..1211f91
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified__CWORD77__session_if.cpp
@@ -0,0 +1,325 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified__CWORD77__session_if.h>
+#include <native_service/ns__CWORD77__data_pool_if.h>
+#include <boost/bind.hpp>
+#include <utility>
+#include <vector>
+#include "ns__CWORD77__data_pool_internal.h"
+#include "ns__CWORD77__common_internal.h"
+
+//////////////////////////////////////////
+/// Function : CFrameworkunified_CWORD77_Session
+//////////////////////////////////////////
+CFrameworkunified_CWORD77_Session::CFrameworkunified_CWORD77_Session() {
+ m_hSession = NULL;
+ m_hApp = NULL;
+ m_hService = NULL;
+ m_uiSessionType = 0;
+}
+//////////////////////////////////////////
+/// Function : ~CFrameworkunified_CWORD77_Session
+//////////////////////////////////////////
+CFrameworkunified_CWORD77_Session::~CFrameworkunified_CWORD77_Session() { // LCOV_EXCL_BR_LINE 11:except branch
+}
+
+void CFrameworkunified_CWORD77_Session::SetSessionType(const UI_32 &sessioType) {
+ m_uiSessionType = sessioType;
+}
+
+//////////////////////////////////////////
+/// Function : GetSessionType
+//////////////////////////////////////////
+UI_32 CFrameworkunified_CWORD77_Session::GetSessionType() {
+ return m_uiSessionType;
+}
+//////////////////////////////////////////
+/// Function : SetResponseCallback
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Session::SetResponseCallback(ResponseServiceTo_CWORD77_ f_cbResponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ m_ResponseTo_CWORD77_ = f_cbResponse;
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+//////////////////////////////////////////
+/// Function : AddProtocolHandler
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Session::AddProtocolHandler(UI_32 f_uiCmdId, CbFuncPtr f_cbFuncPtr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ FrameworkunifiedProtocolCallbackHandler l_tProtocolCallback;
+ l_tProtocolCallback.iCmd = f_uiCmdId;
+ l_tProtocolCallback.callBack = f_cbFuncPtr;
+ m_vSessionProtocolHanlder.push_back(l_tProtocolCallback);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+//////////////////////////////////////////
+/// Function : AddEventHandler
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Session::AddEventHandler(UI_32 f_uiCmdId, CbFuncPtr f_cbFuncPtr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ FrameworkunifiedProtocolCallbackHandler l_tProtocolCallback;
+ l_tProtocolCallback.iCmd = f_uiCmdId;
+ l_tProtocolCallback.callBack = f_cbFuncPtr;
+ m_vSessionEventHandler.push_back(l_tProtocolCallback);
+ m_vEventVector.push_back(f_uiCmdId); // Code added by Shyam
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+//////////////////////////////////////////
+/// Function : AttachProtocolwithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::AttachProtocolwithDispatcher(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_uiSize = m_vSessionProtocolHanlder.size();
+ PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp);
+ for (size_t i = 0; i < l_uiSize; i++) {
+ FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, m_vSessionProtocolHanlder[i].iCmd,
+ m_vSessionProtocolHanlder[i].callBack, m_hSession);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : DetachProtocolwithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::DetachProtocolwithDispatcher(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_uiSize = m_vSessionProtocolHanlder.size();
+ PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp);
+ for (size_t i = 0; i < l_uiSize; i++) {
+ FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_pRequester, m_vSessionProtocolHanlder[i].iCmd,
+ m_hSession);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : AttachEventswithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::AttachEventswithDispatcher(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_uiSize = m_vEventVector.size();
+
+ for (size_t i = 0; i < l_uiSize; i++) {
+ l_eStatus = FrameworkunifiedRegisterEvent(m_hSession, m_vEventVector[i]);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : AttachEventswithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::RegisterEvents(HANDLE f_hApp) {
+ // Function: added by Shyam to overcome the naming conflict in registering the event
+ return AttachEventswithDispatcher(f_hApp);
+}
+
+//////////////////////////////////////////
+/// Function : AttachEventHandlerswithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::AttachEventHandlerswithDispatcher(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_uiSize = m_vSessionEventHandler.size();
+ PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp);
+ for (size_t i = 0; i < l_uiSize; i++) {
+ FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, m_vSessionEventHandler[i].iCmd,
+ m_vSessionEventHandler[i].callBack, m_hSession);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//////////////////////////////////////////
+/// Function : DetachEventHandlerswithDispatcher
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::DetachEventHandlerswithDispatcher(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_uiSize = m_vSessionEventHandler.size();
+ PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp);
+ for (size_t i = 0; i < l_uiSize; i++) {
+ FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_pRequester, m_vSessionEventHandler[i].iCmd,
+ m_hSession);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+/// Function : HandleSessionMessage
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::HandleSessionMessage(UI_32 cmdID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ UI_32 size = 0;
+ PVOID data = NULL;
+
+ if (NULL != m_hSession && NULL != m_hService) {
+ eStatus = GetReqDataFrom_CWORD77_DataPool(std::make_pair(cmdID, FrameworkunifiedGetSessionName(m_hService)), size, data);
+
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ eStatus = FrameworkunifiedSendMsg(m_hSession, cmdID, size, data);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg() returned %d", eStatus);
+ }
+ } else if (eFrameworkunifiedStatusDbRecNotFound == eStatus) {
+ // FIXME: This is added to help, if there is any command with no data. So, that services
+ // don't need to provide _CWORD77_ interfaces for such command.
+ // Correct way to solve the problem is, let services provide one _CWORD77_ interface
+ // which will write 0 length in data pool.
+ // Impact: This may have one impact that, service is expecting some data, but
+ // _CWORD77_ sends data with 0 length because it didn't find anything in the data pool.
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__,
+ "GetReqDataFrom_CWORD77_DataPool() returned %d. But, still sending cmd 0x%X to service %s with length 0.",
+ eStatus, cmdID, FrameworkunifiedGetSessionName(m_hService));
+ eStatus = FrameworkunifiedSendMsg(m_hSession, cmdID, 0, NULL);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg() returned %d", eStatus);
+ }
+ // end fixme
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "GetReqDataFrom_CWORD77_DataPool() returned %d. Can't send cmd 0x%X to service %s.",
+ eStatus, cmdID, FrameworkunifiedGetSessionName(m_hService));
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Error: HandleSessionMessage: Error sending cmd 0x%X request to service."
+ " Session handle %p Service Handle %p", cmdID, m_hSession, m_hService);
+ if (NULL == m_hSession) {
+ eStatus = eFrameworkunifiedStatusSessionErr;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "- %d", eStatus);
+ return eStatus;
+}
+
+//////////////////////////////////////////
+/// Function : AttachResponseCallbacks
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Session::AttachResponseCallbacks(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ UI_32 l_uiCount = 0;
+ PCSTR l_pRequester = FrameworkunifiedGetMsgSrc(f_hApp);
+
+ // attach response protocols
+ UI_32 const *l_uiResponseProtocol = GetResponseProtocolArray();
+ if (NULL != l_uiResponseProtocol) {
+ for (; l_uiCount < GetResponseProtocolArrayLength(); l_uiResponseProtocol++, l_uiCount++) {
+ FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, *l_uiResponseProtocol,
+ boost::bind(&CFrameworkunified_CWORD77_Session::OnResponse, this, f_hApp), m_hSession);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No Response protocols available for session with %s",
+ FrameworkunifiedGetSessionName(m_hService));
+ }
+
+ // attach events
+ l_uiCount = 0;
+ UI_32 const *l_uiEvents = GetEventArray();
+ if (NULL != l_uiEvents) {
+ for (; l_uiCount < GetEventArrayLength(); l_uiEvents++, l_uiCount++) {
+ // attach callback
+ FrameworkunifiedAttachCallbackToDispatcher(f_hApp, l_pRequester, *l_uiEvents,
+ boost::bind(&CFrameworkunified_CWORD77_Session::OnResponse, this, f_hApp), m_hSession); // LCOV_EXCL_BR_LINE 11:except branch
+ // register event
+ FrameworkunifiedRegisterEvent(m_hSession, *l_uiEvents);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No event protocols available for session with %s",
+ FrameworkunifiedGetSessionName(m_hService));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+
+//////////////////////////////////////////
+/// Function : DetachResponseCallbacks
+//////////////////////////////////////////
+void CFrameworkunified_CWORD77_Session::DetachResponseCallbacks(HANDLE f_hApp) {
+ if (NULL != m_hSession) {
+ UI_32 l_uiCount = 0;
+ PCSTR l_cSessionName = FrameworkunifiedGetSessionName(m_hSession);
+ // detach response protocols
+ UI_32 const *l_uiResponseProtocol = GetResponseProtocolArray();
+ if (NULL != l_uiResponseProtocol) {
+ for (; l_uiCount < GetResponseProtocolArrayLength(); l_uiResponseProtocol++, l_uiCount++) {
+ FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_cSessionName, *l_uiResponseProtocol, m_hSession);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No Response protocols available for session with %s",
+ FrameworkunifiedGetSessionName(m_hService));
+ }
+
+ // detach and unregister events
+ l_uiCount = 0;
+ UI_32 const *l_uiEvents = GetEventArray();
+ if (NULL != l_uiEvents) {
+ for (; l_uiCount < GetEventArrayLength(); l_uiEvents++, l_uiCount++) {
+ FrameworkunifiedDetachCallbackFromDispatcher(f_hApp, l_cSessionName, *l_uiEvents, m_hSession);
+ FrameworkunifiedUnRegisterEvent(m_hSession, *l_uiEvents);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "No event protocols available for session with %s",
+ FrameworkunifiedGetSessionName(m_hService));
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_INFO, __FUNCTION__, "Detach not required. Session not yet available");
+ }
+}
+
+//////////////////////////////////////////
+/// Function : OnResponse
+//////////////////////////////////////////
+EFrameworkunifiedStatus CFrameworkunified_CWORD77_Session::OnResponse(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ UI_32 length = FrameworkunifiedGetMsgLength(f_hApp);
+ UI_32 cmdId = FrameworkunifiedGetMsgProtocol(f_hApp);
+ PCSTR l_cMsgSourceName = FrameworkunifiedGetMsgSrc(f_hApp);
+ if (NULL != l_cMsgSourceName) {
+ if (length != 0) {
+ std::vector<char> data;
+ data.resize(length);
+ eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &data[0], length);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "OnResponse from %s cmdId:%d", l_cMsgSourceName, cmdId);
+ SetRespDataIn_CWORD77_DataPool(std::make_pair(cmdId, l_cMsgSourceName), static_cast<UI_32>(data.size()), &data[0]);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "OnResponse from %s cmdId:[%d], Value: [NULL]", l_cMsgSourceName, cmdId);
+ SetRespDataIn_CWORD77_DataPool(std::make_pair(cmdId, l_cMsgSourceName), 0, NULL);
+ }
+
+ m_ResponseTo_CWORD77_(f_hApp, RESPONSE, l_cMsgSourceName);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error: Setting response value of cmd 0x%X in data pool.", cmdId);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "- %d", eStatus);
+ return eStatus;
+}
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h
new file mode 100755
index 0000000..68efb44
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/frameworkunified_stub.h
@@ -0,0 +1,20 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS__CWORD77__SERVICEIF_SRC_FRAMEWORKUNIFIED_STUB_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS__CWORD77__SERVICEIF_SRC_FRAMEWORKUNIFIED_STUB_H_
+extern size_t strlcpy(char *destination, const char *source, size_t size);
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS__CWORD77__SERVICEIF_SRC_FRAMEWORKUNIFIED_STUB_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..88693cd
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/makefile_PosixBasedOS001
@@ -0,0 +1,208 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = NS__CWORD77__ServiceIf
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Name of the componet (team/domain prefix '_' component name)
+# This must be the same as the RTC Component name and Eclipse Project Name
+COMPONENT_NAME = NS__CWORD77__ServiceIf
+
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Do the same if you need to include library paths as well
+# Do an incremental in case additional library paths are defined
+# at the top-level make. Use similar guidelines as for includes
+# for example to include a team component library it would be
+# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
+LIB_PATHS += \
+ $(DEPENDS_LIB_PATHS) \
+
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+ifdef DYNAMIC
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
+ $(wildcard $(TEAM_ROOT)NativeServices/inc/_CWORD77_/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+#DYNAMIC_LIBS += \
+# xml2 \
+# m
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC
+# For a dynamic library
+ $(SLIB_CMD)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
+ $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+module_dirs: build_dirs
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h
new file mode 100755
index 0000000..78f96a7
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__common_internal.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// @defgroup tag_HMI_CWORD77_Controller HMI _CWORD77_ Controller
+/// @file ns__CWORD77__common_internal.h
+/// @brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__COMMON_INTERNAL_H_ // NOLINT (readability/nolint)
+#define NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__COMMON_INTERNAL_H_
+
+#include <native_service/ns__CWORD77__types.h>
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+EFrameworkunifiedStatus Set_CWORD77_DataPoolKeyValue(std::string Key, std::string Value);
+std::string Get_CWORD77_DataPoolKeyValue(std::string Key);
+
+template <typename T>
+UI_32 _CWORD77_GetMsgLength(HANDLE hApp) {
+ UI_32 uiLength = FrameworkunifiedGetMsgLength(hApp);
+ return (uiLength / sizeof(T));
+}
+
+template <typename T>
+EFrameworkunifiedStatus _CWORD77_GetMsgData(HANDLE hApp, T *pData) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_8 *pTemp = reinterpret_cast<UI_8 *>(pData);
+ eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, pTemp, sizeof(T));
+ return eStatus;
+}
+
+#endif // NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__COMMON_INTERNAL_H_ // NOLINT (readability/nolint)
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h
new file mode 100755
index 0000000..1ad792e
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_internal.h
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// @file ns__CWORD77__data_pool_internal.h
+/// @brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__DATA_POOL_INTERNAL_H_ // NOLINT (readability/nolint)
+#define NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__DATA_POOL_INTERNAL_H_
+
+#include <native_service/ns__CWORD77__types.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRespDataIn_CWORD77_DataPool
+/// API to set data associated with response into _CWORD77_ Data Pool
+///
+/// \param [in] f_DataPoolKey
+/// _CWORD77_DataPoolKey - Data pool key
+/// \param [in] f_uiSize
+/// UI_32 - size of the data
+/// \param [in] f_pData
+/// PVOID - void pointer to data
+///
+/// \return VOID - None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID SetRespDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, const PVOID f_pData);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetReqDataIn_CWORD77_DataPool
+/// API to get data associated with request from _CWORD77_ Data Pool
+///
+/// \param [in] f_DataPoolKey
+/// _CWORD77_DataPoolKey - Data pool key
+/// \param [in] f_uiSize
+/// UI_32 - size of the data
+/// \param [in] f_pData
+/// PVOID - void pointer to data
+///
+/// \return EFrameworkunifiedStatus - Succes or Error
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetReqDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData); // NOLINT (readability/nolint)
+
+#endif // NS_NS__CWORD77__SERVICEIF_SRC_NS__CWORD77__DATA_POOL_INTERNAL_H_ // NOLINT (readability/nolint)
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp
new file mode 100755
index 0000000..b48062a
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NS__CWORD77__ServiceIf/src/ns__CWORD77__data_pool_table.cpp
@@ -0,0 +1,538 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns__CWORD77__data_pool_table.h>
+#include <native_service/ns__CWORD77__data_pool_if.h>
+#include <vector>
+#include <string>
+#include <map>
+#include <utility>
+#include "ns__CWORD77__data_pool_internal.h"
+#include "ns__CWORD77__common_internal.h"
+
+C_CWORD77_DataPool g__CWORD77_DataPool;
+C_CWORD77_DataPool *C_CWORD77_DataPool::m_p_CWORD77_DataPoolInstance = NULL;
+
+// For getting/setting notification data from data pool,
+// data key will be pair<g_uiNotificationDataPoolId,"NotificationName">
+static const UI_32 g_uiNotificationDataPoolId = 0;
+
+/////////////////////////////////////////////////////////////////////////////////
+/// NoOfElementsinData
+/////////////////////////////////////////////////////////////////////////////////
+UI_32 NoOfElementsinData(std::string Input) {
+ std::string first = "";
+ std::istringstream ss(Input);
+ int i = 0;
+ while (!ss.eof()) {
+ getline(ss, first, ',');
+ if (first != "") {
+ i++;
+ }
+ }
+ return i;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// ConvertArrayStringsToString
+/////////////////////////////////////////////////////////////////////////////////
+std::string ConvertArrayStringsToString(std::string *strArr, int Size) {
+ int length = 0;
+ std::string Result;
+ if (strArr == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "strArr is NULL");
+ Result.append("");
+ return Result;
+ }
+ while (length < Size) {
+ Result.append(strArr[length]);
+ Result.append(",");
+ length++;
+ }
+ Result.append("");
+ return Result;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// ConvertStringToArrString
+/////////////////////////////////////////////////////////////////////////////////
+void ConvertStringToArrString(std::string Input, std::string *strArr,
+ UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ if (strArr == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "strArr is NULL");
+ return;
+ }
+ int i = 0;
+ std::string first = "";
+ std::istringstream ss(Input);
+ while (!ss.eof()) {
+ getline(ss, first, ',');
+ if (first != "") {
+ strArr[i] = first;
+ i++;
+ }
+ }
+ ArraySize = i;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// C_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+C_CWORD77_DataPool::C_CWORD77_DataPool() {
+ m__CWORD77_DataRequestTable.clear();
+ m__CWORD77_DataResponseTable.clear();
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// ~C_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+C_CWORD77_DataPool::~C_CWORD77_DataPool() {
+ m__CWORD77_DataRequestTable.clear();
+ m__CWORD77_DataResponseTable.clear();
+}
+
+//////////////////////////////////////////
+/// Function : GetInstance
+//////////////////////////////////////////
+C_CWORD77_DataPool *C_CWORD77_DataPool::GetInstance() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "GetInstance");
+ if (m_p_CWORD77_DataPoolInstance == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "Before creating object");
+ m_p_CWORD77_DataPoolInstance = new C_CWORD77_DataPool();
+ }
+ return m_p_CWORD77_DataPoolInstance;
+}
+
+//////////////////////////////////////////
+/// Function : DeleteInstance
+//////////////////////////////////////////
+void C_CWORD77_DataPool::DeleteInstance() {
+ DELETEPTR(m_p_CWORD77_DataPoolInstance);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetValueFromMap
+/////////////////////////////////////////////////////////////////////////////////
+void C_CWORD77_DataPool::GetValueFromMap(ETableType TableType, UI_32 VarName, EDataType &DataType, std::string &Strvalue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::map<UI_32, _CWORD77_Data>::iterator iter;
+ std::string temp;
+
+ if (TableType == REQUEST_TABLE) {
+ iter = m__CWORD77_DataRequestTable.begin();
+ iter = m__CWORD77_DataRequestTable.find(VarName);
+ if (iter != m__CWORD77_DataRequestTable.end()) {
+ DataType = iter->second.DataType;
+ temp = iter->second.DataValue;
+ }
+ } else {
+ iter = m__CWORD77_DataResponseTable.begin();
+ iter = m__CWORD77_DataResponseTable.find(VarName);
+ if (iter != m__CWORD77_DataResponseTable.end()) {
+ DataType = iter->second.DataType;
+ temp = iter->second.DataValue;
+ }
+ }
+ Strvalue.assign(temp);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetValueinMap
+/////////////////////////////////////////////////////////////////////////////////
+void C_CWORD77_DataPool::SetValueinMap(ETableType TableType, UI_32 VarName, EDataType VarType, std::string Result) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ _CWORD77_Data t_CWORD77_Data;
+ t_CWORD77_Data.DataType = VarType;
+ t_CWORD77_Data.DataValue = Result;
+ if (TableType == REQUEST_TABLE) {
+ m__CWORD77_DataRequestTable[VarName] = t_CWORD77_Data;
+ } else {
+ m__CWORD77_DataResponseTable[VarName] = t_CWORD77_Data;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetNoofElementsofData
+/////////////////////////////////////////////////////////////////////////////////
+UI_32 C_CWORD77_DataPool::GetNoofElementsofData(ETableType TableType, UI_32 KeyName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EDataType DataType = UNKNOWNTYPE;
+ std::string Result = "";
+ GetValueFromMap(TableType, KeyName, DataType, Result);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return NoOfElementsinData(Result);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetDataType
+/////////////////////////////////////////////////////////////////////////////////
+EDataType C_CWORD77_DataPool::GetDataType(ETableType TableType, UI_32 KeyName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EDataType DataType = UNKNOWNTYPE;
+ std::string Result = "";
+ GetValueFromMap(TableType, KeyName, DataType, Result);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return DataType;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void C_CWORD77_DataPool::SetArrayStringData(ETableType TableType, UI_32 VarName, EDataType VarType,
+ std::string DataValue[], UI_32 size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::string Result = ConvertArrayStringsToString(DataValue, size);
+ SetValueinMap(TableType, VarName, VarType, Result);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void C_CWORD77_DataPool::GetArrayStringData(ETableType TableType, UI_32 VarName, std::string DataValue[], UI_32 &size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::string Result = "";
+ EDataType DataType = UNKNOWNTYPE;
+ GetValueFromMap(TableType, VarName, DataType, Result);
+ ConvertStringToArrString(Result, DataValue, size);
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRequestArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void SetRequestArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size) {
+ g__CWORD77_DataPool.SetReqArrayStringData(VarName, VarType, DataValue, size);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetResponseArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void SetResponseArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size) {
+ g__CWORD77_DataPool.SetRespArrayStringData(VarName, VarType, DataValue, size);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequestArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void GetRequestArrayStringData(UI_32 VarName, std::string DataValue[],
+ UI_32 &size) { // NOLINT (readability/nolint)
+ g__CWORD77_DataPool.GetReqArrayStringData(VarName, DataValue, size);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetResponseArrayStringData
+/////////////////////////////////////////////////////////////////////////////////
+void GetResponseArrayStringData(UI_32 VarName, std::string DataValue[],
+ UI_32 &size) { // NOLINT (readability/nolint)
+ g__CWORD77_DataPool.GetRespArrayStringData(VarName, DataValue, size);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRequestStringData
+/////////////////////////////////////////////////////////////////////////////////
+
+void SetRequestStringData(UI_32 VarName, EDataType VarType, std::string DataValue) {
+ g__CWORD77_DataPool.SetReqStringData(VarName, VarType, DataValue);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetResponseStringData
+/////////////////////////////////////////////////////////////////////////////////
+void SetResponseStringData(UI_32 VarName, EDataType VarType, std::string DataValue) {
+ g__CWORD77_DataPool.SetRespStringData(VarName, VarType, DataValue);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequestStringData
+/////////////////////////////////////////////////////////////////////////////////
+std::string GetRequestStringData(UI_32 VarName) {
+ return g__CWORD77_DataPool.GetReqStringData(VarName);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequestDataSize
+/////////////////////////////////////////////////////////////////////////////////
+UI_32 GetRequestDataSize(UI_32 Key) {
+ return g__CWORD77_DataPool.GetReqDataSize(Key);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetResponseDataSize
+/////////////////////////////////////////////////////////////////////////////////
+UI_32 GetResponseDataSize(UI_32 Key) {
+ return g__CWORD77_DataPool.GetRespDataSize(Key);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequestDataType
+/////////////////////////////////////////////////////////////////////////////////
+EDataType GetRequestDataType(UI_32 Key) {
+ return g__CWORD77_DataPool.GetReqDataType(Key);
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetResponseDataType
+/////////////////////////////////////////////////////////////////////////////////
+EDataType GetResponseDataType(UI_32 Key) {
+ return g__CWORD77_DataPool.GetRespDataType(Key);
+}
+
+
+
+C_CWORD77_Data *C_CWORD77_Data::m_p_CWORD77_DataInstance = NULL;
+
+/////////////////////////////////////////////////////////////////////////////////
+/// Constructor
+/////////////////////////////////////////////////////////////////////////////////
+C_CWORD77_Data::C_CWORD77_Data() {
+ m__CWORD77_RequestDataTable.clear();
+ m__CWORD77_ResponseDataTable.clear();
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// Destructor
+/////////////////////////////////////////////////////////////////////////////////
+C_CWORD77_Data::~C_CWORD77_Data() {
+ m__CWORD77_RequestDataTable.clear();
+ m__CWORD77_ResponseDataTable.clear();
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetInstacne
+/////////////////////////////////////////////////////////////////////////////////
+C_CWORD77_Data *C_CWORD77_Data::GetInstance() {
+ if (m_p_CWORD77_DataInstance == NULL) {
+ m_p_CWORD77_DataInstance = new C_CWORD77_Data(); // LCOV_EXCL_BR_LINE 11:except branch
+ }
+ return m_p_CWORD77_DataInstance;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// DeleteInstance
+/////////////////////////////////////////////////////////////////////////////////
+void C_CWORD77_Data::DeleteInstance() {
+ delete m_p_CWORD77_DataInstance;
+ m_p_CWORD77_DataInstance = NULL;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRequData
+/////////////////////////////////////////////////////////////////////////////////
+VOID C_CWORD77_Data::SetRequData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::vector<CHAR> &DataVector = m__CWORD77_RequestDataTable[f_DataPoolKey];
+ CHAR *l_pTemp = static_cast<CHAR *>(f_pData);
+ DataVector.assign(l_pTemp, (l_pTemp + f_uiSize));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRequData
+/////////////////////////////////////////////////////////////////////////////////
+VOID C_CWORD77_Data::SetRequData(UI_32 f_uiMsgId, UI_32 f_uiSize, PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::vector<CHAR> &DataVector = m__CWORD77_RequestDataTableOrig[f_uiMsgId];
+ CHAR *l_pTemp = static_cast<CHAR *>(f_pData);
+ DataVector.assign(l_pTemp, (l_pTemp + f_uiSize));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRespoData
+/////////////////////////////////////////////////////////////////////////////////
+VOID C_CWORD77_Data::SetRespoData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, const PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ std::vector<CHAR> &DataVector = m__CWORD77_ResponseDataTable[f_DataPoolKey];
+ CHAR *l_pTemp = static_cast<CHAR *>(f_pData);
+ DataVector.assign(l_pTemp, (l_pTemp + f_uiSize));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRespoData
+/////////////////////////////////////////////////////////////////////////////////
+VOID C_CWORD77_Data::SetRespoData(UI_32 f_uiMsgId, UI_32 f_uiSize, const PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ std::vector<CHAR> &DataVector = m__CWORD77_ResponseDataTableOrig[f_uiMsgId];
+ CHAR *l_pTemp = static_cast<CHAR *>(f_pData);
+ DataVector.assign(l_pTemp, (l_pTemp + f_uiSize));
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequData
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus C_CWORD77_Data::GetRequData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 &f_uiSize, PVOID &f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusDbRecNotFound; // data not found in data pool
+ T_CWORD77_DataPool::iterator l_iter;
+
+ l_iter = m__CWORD77_RequestDataTable.find(f_DataPoolKey);
+ if (l_iter != m__CWORD77_RequestDataTable.end()) {
+ f_uiSize = static_cast<UI_32>(l_iter->second.size());
+ if (f_uiSize > 0) {
+ f_pData = &l_iter->second[0];
+ } else {
+ f_pData = NULL;
+ }
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRequData
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus C_CWORD77_Data::GetRequData(UI_32 f_uiMsgId, UI_32 &f_uiSize, PVOID &f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusDbRecNotFound; // data not found in data pool
+ std::map<UI_32, std::vector<CHAR> >::iterator l_iter;
+
+ l_iter = m__CWORD77_RequestDataTableOrig.find(f_uiMsgId);
+ if (l_iter != m__CWORD77_RequestDataTableOrig.end()) {
+ f_uiSize = static_cast<UI_32>(l_iter->second.size());
+ if (f_uiSize > 0) {
+ f_pData = &l_iter->second[0];
+ } else {
+ f_pData = NULL;
+ }
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRespoData
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus C_CWORD77_Data::GetRespoData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 &f_uiSize, PVOID &f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ T_CWORD77_DataPool::iterator l_iter;
+ l_iter = m__CWORD77_ResponseDataTable.find(f_DataPoolKey);
+ if (l_iter != m__CWORD77_ResponseDataTable.end()) {
+ f_uiSize = static_cast<UI_32>(l_iter->second.size());
+ if (f_uiSize > 0) {
+ /**
+ * @todo
+ * If *f_pData is set to NULL, a segmentation fault occurs.
+ */
+ f_pData = &l_iter->second[0];
+ } else {
+ f_pData = NULL;
+ }
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return l_eStatus;
+}
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRespoData
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus C_CWORD77_Data::GetRespoData(UI_32 f_uiMsgId,
+ UI_32 &f_uiSize, PVOID &f_pData) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::map<UI_32, std::vector<CHAR> >::iterator l_iter;
+ l_iter = m__CWORD77_ResponseDataTableOrig.find(f_uiMsgId);
+ if (l_iter != m__CWORD77_ResponseDataTableOrig.end()) {
+ f_uiSize = static_cast<UI_32>(l_iter->second.size());
+ if (f_uiSize > 0) {
+ f_pData = &l_iter->second[0];
+ } else {
+ f_pData = NULL;
+ }
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetReqDataIn_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+VOID SetReqDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 f_uiSize, PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ if (C_CWORD77_Data::GetInstance()) {
+ C_CWORD77_Data::GetInstance()->SetRequData(f_DataPoolKey, f_uiSize, f_pData);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRespDataIn_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+VOID SetRespDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 f_uiSize, const PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ if (C_CWORD77_Data::GetInstance()) {
+ C_CWORD77_Data::GetInstance()->SetRespoData(f_DataPoolKey, f_uiSize, f_pData);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// SetRespNotfnDataIn_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+VOID SetRespNotfnDataIn_CWORD77_DataPool(const std::string &f_cNotificationName, // NOLINT (readability/nolint)
+ UI_32 f_uiSize, const PVOID f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ if (C_CWORD77_Data::GetInstance()) {
+ // LCOV_EXCL_BR_START 11:except branch
+ C_CWORD77_Data::GetInstance()->SetRespoData(std::make_pair(g_uiNotificationDataPoolId, f_cNotificationName), f_uiSize, // LCOV_EXCL_BR_LINE 11:except branch
+ f_pData);
+ // LCOV_EXCL_BR_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetReqDataFrom_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetReqDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if (C_CWORD77_Data::GetInstance()) {
+ l_eStatus = C_CWORD77_Data::GetInstance()->GetRequData(f_DataPoolKey, f_uiSize, f_pData);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRespDataFrom_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetRespDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if (C_CWORD77_Data::GetInstance()) {
+ l_eStatus = C_CWORD77_Data::GetInstance()->GetRespoData(f_DataPoolKey, f_uiSize, f_pData);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+/// GetRespDataFrom_CWORD77_DataPool
+/////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetRespNotfnDataFrom_CWORD77_DataPool(const std::string &f_cNotificationName, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if (C_CWORD77_Data::GetInstance()) {
+ // LCOV_EXCL_BR_START 11:except branch
+ l_eStatus = C_CWORD77_Data::GetInstance()->GetRespoData(std::make_pair(g_uiNotificationDataPoolId, f_cNotificationName),
+ f_uiSize, f_pData);
+ // LCOV_EXCL_BR_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NS__CWORD77_, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return l_eStatus;
+}
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/Makefile b/video_in_hal/nsframework/framework_unified/client/NativeServices/Makefile
new file mode 100755
index 0000000..c346b28
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/Makefile
@@ -0,0 +1,29 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+SUBDIRS = src
+
+
+all:
+
+install-data:install_cfg
+
+install_cfg:
+ install -d -m 775 $(SDKTARGETSYSROOT)/usr/agl/conf/ns_logger
+ install -m 644 -t $(SDKTARGETSYSROOT)/usr/agl/conf/ns_logger scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg
+
+include ../../../native_service.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_arm.mk b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_arm.mk
new file mode 100755
index 0000000..3baa0f2
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_arm.mk
@@ -0,0 +1,88 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# QCC arm COMPILER SETTINGS
+# Standard form of tool.mk file configured for PosixBasedOS001 vmware
+
+# Tools and Options
+LIB_EXT = a
+SO_EXT = so
+LIB_PREFIX = lib
+OBJ_EXT = o
+BIN_EXT =
+CC = qcc -c
+CPP = qcc -c
+AS = ntoarm-as
+AR = ntoarm-ar
+LD = qcc
+# Add addtion Linker Flags....
+# If your application contains c++ code you will need
+# the -lang-c++
+LD_CPP = -lang-c++
+
+# Compile options and commands
+TARGET_FLG = -Vgcc_ntoarmle
+
+# Set Debug Flag
+ifdef DEBUG
+CC_DEBUG_FLG = -g
+DEBUG_EXT=_g
+endif
+
+# Set Profiling Flag
+ifdef PROFILING
+CC_PROFILING_FLG = -p
+endif
+
+# Set Optimization Flag
+ifeq ($(OPTIMIZATION),OPTIMIZE)
+CC_OPT_FLG = -O2
+else
+ifeq ($(OPTIMIZATION),FULL_OPTIMIZE)
+CC_OPT_FLG = -O3
+else
+ifeq ($(OPTIMIZATION),NONE)
+CC_OPT_FLG =
+endif
+endif
+endif
+
+
+# Compiler Options
+CC_OFLAG = -o
+CC_IFLAG = -I
+CC_FLAGS = $(TARGET_FLG) -w9 -Wc,-Wall -shared $(CC_OPT_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG)
+CC_TARGET = $(@)
+CC_CMD = $(CC) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.c) -o $(@)
+CPP_CMD = $(CPP) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.cpp) -o $(@)
+
+# Archive Options (Static Library)
+AR_OFLAG =
+AR_FLAGS = -r
+AR_CMD = $(AR) $(AR_FLAGS) $(AR_OFLAG)$(@) $^
+
+# Linker Options
+# Executable
+# Used in the form of $(LD_CMD) -L[Library Paths] -l[libraries] [objects] $(LD_OFLAG) executable_name.$(BIN_EXT)
+LD_FLAGS = $(TARGET_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG) $(LD_CPP)
+LD_OFLAG = -o
+LD_CMD = $(LD) -L$(LIB_PATH) $(LD_FLAGS)
+EXEC_CMD = $(LD_CMD) $(LD_OFLAG) $(@) $(OBJECTS) $(addprefix -L , $(LIB_PATHS)) -Bstatic $(addprefix -l , $(STATIC_LIBS)) -Bdynamic $(addprefix -l , $(DYNAMIC_LIBS))
+
+# To create shared objects use the linker command but add -shared
+SO_CMD = $(LD) $(LD_FLAGS) -shared
+SLIB_CMD = $(SO_CMD) $^ $(LD_OFLAG) $(@) $(addprefix -L, $(LIB_PATHS)) \
+ -Bstatic $(addprefix -l,$(STATIC_LIBS)) -Bdynamic $(addprefix -l,$(DYNAMIC_LIBS))
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_armv7.mk b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_armv7.mk
new file mode 100755
index 0000000..68d15da
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_armv7.mk
@@ -0,0 +1,96 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# QCC arm COMPILER SETTINGS
+# Standard form of tool.mk file configured for PosixBasedOS001 arm v7
+# Note: Make sure PosixBasedOS001_HOST is set to install version desired
+
+# Tools and Options
+LIB_EXT = a
+SO_EXT = so
+LIB_PREFIX = lib
+OBJ_EXT = o
+BIN_EXT =
+CC = ${PosixBasedOS001_HOST}/usr/bin/qcc -c
+CPP = ${PosixBasedOS001_HOST}/usr/bin/qcc -c
+AS = ${PosixBasedOS001_HOST}/usr/bin/ntoarmv7-as
+AR = ${PosixBasedOS001_HOST}/usr/bin/ntoarmv7-ar
+OBJCPY := ${PosixBasedOS001_HOST}/usr/bin/ntoarmv7-objcopy
+LD = qcc
+# Add addtion Linker Flags....
+# If your application contains c++ code you will need
+# the -lang-c++
+LD_CPP = -lang-c++ #-lm
+
+# Compile options and commands
+TARGET_FLG = -Vgcc_ntoarmv7le
+
+# Define Map file Option
+MAP_FILE_FLG=-M
+
+# Set Debug Flag
+ifdef DEBUG
+CC_DEBUG_FLG = -g
+DEBUG_EXT=_g
+endif
+
+# Set Profiling Flag
+ifdef PROFILING
+CC_PROFILING_FLG = -p
+endif
+
+# Set Optimization Flag (precident to force none, force full, force basic, or default remain as defined)
+ifeq ($(OPTIMIZATION),OPTIMIZE)
+CC_OPT_FLG = -O2
+else
+ifeq ($(OPTIMIZATION),FULL_OPTIMIZE)
+CC_OPT_FLG = -O3
+else
+ifeq ($(OPTIMIZATION),NONE)
+CC_OPT_FLG =
+endif
+endif
+endif
+
+
+# Compiler Options
+CC_OFLAG = -o
+CC_IFLAG = -I
+CC_FLAGS = $(TARGET_FLG) -w9 -Wc,-Wall -shared $(CC_OPT_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG)
+CC_TARGET = $(@)
+CC_CMD = $(CC) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.c) -o $(@)
+CPP_CMD = $(CPP) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.cpp) -o $(@)
+CPP_D_CMD = arm-unknown-nto-PosixBasedOS001.5.0eabi-gcc.exe -c $(DEFS) $(INCLUDES) -MM -MP $< > $(@:.o=.d)
+
+# Archive Options (Static Library)
+AR_OFLAG =
+AR_FLAGS = -r
+AR_CMD = $(AR) $(AR_FLAGS) $(AR_OFLAG)$(@) $^
+
+# Linker Options
+# Executable
+# Used in the form of $(LD_CMD) -L[Library Paths] -l[libraries] [objects] $(LD_OFLAG) executable_name.$(BIN_EXT)
+LD_FLAGS = $(TARGET_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG) $(LD_CPP)
+LD_OFLAG = -o
+LD_CMD = $(LD) -L$(LIB_PATH) $(LD_FLAGS) $(MAP_FILE_FLG)
+EXEC_CMD = $(LD_CMD) $(LD_OFLAG) $(@) $(OBJECTS) $(addprefix -L , $(LIB_PATHS)) \
+ -Bstatic $(addprefix -l , $(STATIC_LIBS)) -Bdynamic $(addprefix -l , $(DYNAMIC_LIBS))
+
+# To create shared objects use the linker command but add -shared
+SO_CMD = $(LD) $(LD_FLAGS) -shared $(MAP_FILE_FLG)
+SLIB_CMD = $(SO_CMD) $^ $(LD_OFLAG) $(@) $(addprefix -L, $(LIB_PATHS)) \
+ -Bstatic $(addprefix -l,$(STATIC_LIBS)) -Bdynamic $(addprefix -l,$(DYNAMIC_LIBS))
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_x86.mk b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_x86.mk
new file mode 100755
index 0000000..528e7ea
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/PosixBasedOS001_x86.mk
@@ -0,0 +1,89 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# QCC x86 COMPILER SETTINGS
+# Standard form of tool.mk file configured for PosixBasedOS001 vmware
+
+# Tools and Options
+LIB_EXT = a
+SO_EXT = so
+LIB_PREFIX = lib
+OBJ_EXT = o
+BIN_EXT =
+CC = qcc -c
+CPP = qcc -c
+AS = qcc -c
+AR = qcc -a
+LD = qcc
+LD_CPP = -lang-c++ #-lm
+OBJCPY := ${PosixBasedOS001_HOST}/usr/bin/ntox86-objcopy
+
+# Compile options and commands
+TARGET_FLG = -Vgcc_ntox86
+
+# Set Debug Flag
+ifdef DEBUG
+CC_DEBUG_FLG = -g
+DEBUG_EXT=_g
+endif
+
+# Define Map file Option
+MAP_FILE_FLG=-M
+
+# Set Profiling Flag
+ifdef PROFILING
+CC_PROFILING_FLG = -p
+endif
+
+# Set Optimization Flag (precident to force none, force full, force basic, or default remain as defined)
+ifeq ($(OPTIMIZATION),OPTIMIZE)
+CC_OPT_FLG = -O2
+else
+ifeq ($(OPTIMIZATION),FULL_OPTIMIZE)
+CC_OPT_FLG = -O3
+else
+ifeq ($(OPTIMIZATION),NONE)
+CC_OPT_FLG =
+endif
+endif
+endif
+
+
+# Compiler Options
+CC_OFLAG = -o
+CC_IFLAG = -I
+CC_FLAGS = $(TARGET_FLG) -w9 -Wc,-Wall -shared $(CC_OPT_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG) $(CC_OPT_FLG)
+CC_TARGET = $(@)
+CC_CMD = $(CC) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.c*) -o $(@)
+CPP_CMD = $(CPP) $(CC_FLAGS) $(DEFS) $(INCLUDES) $(@F:.$(OBJ_EXT)=.cpp) -o $(@)
+CPP_D_CMD = i486-pc-nto-PosixBasedOS001.5.0-gcc.exe $(DEFS) $(INCLUDES) -MM $< > $(@:.o=.d)
+
+# Archive Options (Static Library)
+AR_OFLAG =
+AR_FLAGS =
+AR_CMD = $(AR) $(AR_FLAGS) $(AR_OFLAG)$(@) $^
+
+# Linker Options
+# Executable
+# Used in the form of $(LD_CMD) -L[Library Paths] -l[libraries] [objects] $(LD_OFLAG) executable_name.$(BIN_EXT)
+LD_FLAGS = $(TARGET_FLG) $(CC_PROFILING_FLG) $(CC_DEBUG_FLG) $(LD_CPP)
+LD_OFLAG = -o
+LD_CMD = $(LD) -L$(LIB_PATH) $(LD_FLAGS) $(MAP_FILE_FLG)
+
+# To create shared objects use the linker command but add -shared
+SO_CMD = $(LD) $(LD_FLAGS) -shared $(MAP_FILE_FLG)
+SLIB_CMD = $(SO_CMD) $^ $(LD_OFLAG) $(@) $(addprefix -L, $(LIB_PATHS)) \
+ -Bstatic $(addprefix -l,$(STATIC_LIBS)) -Bdynamic $(addprefix -l,$(DYNAMIC_LIBS))
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/analysis.mk b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/analysis.mk
new file mode 100755
index 0000000..c1e14fd
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/analysis.mk
@@ -0,0 +1,73 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# QCC arm COMPILER SETTINGS
+# Standard form of tool.mk file configured for PosixBasedOS001 vmware
+
+#Add PosixBasedOS001 binary tools to path
+PATH := $(PosixBasedOS001_HOME)/usr/bin/;$(PATH)
+
+# include the compiler definitions in which we are linting against
+include $(PRJ_ROOT)/cfg/PosixBasedOS001_armv7.mk
+
+# Tools and Options
+CODE_COUNT = surveyor
+LINT = lint-nt
+CC_IFLAG = -i
+
+CC_DEFS = -D__LANGUAGE_C -D_LANGUAGE_C -D__PosixBasedOS001__ -D__PosixBasedOS001__ \
+ -D__GNUC__=4 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=2 \
+ -D__unix__ -D__unix -D__ELF__ -D__ARM__ -D__arm__ \
+ -D__ARM_ARCH_4__ -D__APCS_32__ -D__LITTLEENDIAN__ -D__ARMEL__ -D_MUDFLAPTH
+
+CPP_DEFS = -D__cplusplus -D__PosixBasedOS001__ -D__PosixBasedOS001__ \
+ -D__GNUC__=4 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=2 \
+ -D__NO_INLINE__ -D__DEPRECATED -D__EXCEPTIONS \
+ -D__unix__ -D__unix -D__ELF__ -D__ARM__ -D__arm__ \
+ -D__ARM_ARCH_4__ -D__APCS_32__ -D__LITTLEENDIAN__ -D__ARMEL__ -D_MUDFLAPTH
+
+LINT_C_INCLUDES = \
+ $(CC_IFLAG)C:/lint.PosixBasedOS001 \
+ $(CC_IFLAG)$(PosixBasedOS001_TARGET)/usr/include \
+
+LINT_CPP_INCLUDES = \
+ $(CC_IFLAG)C:/lint.PosixBasedOS001 \
+ $(CC_IFLAG)$(PosixBasedOS001_TARGET)/usr/include \
+ $(CC_IFLAG)$(PosixBasedOS001_HOST)/usr/lib/gcc/arm-unknown-nto-PosixBasedOS001.5.0/4.4.2/include \
+ $(CC_IFLAG)$(PosixBasedOS001_TARGET)/usr/include/cpp/c \
+ $(CC_IFLAG)$(PosixBasedOS001_TARGET)/usr/include/cpp \
+
+LINT_SOURCES := $(shell find .. -iname "*.c" -or -iname "*.cc" -or -iname "*.cpp")
+LINT_IMPLIED_DIRS := $(addprefix $(CC_IFLAG), $(sort $(dir $(shell find .. -iname "*.c" -or -iname "*.cc" -or -iname "*.cpp"))))
+
+# Metric Rule
+metrics:
+ @echo --------------------
+ @echo Start metrics on $(COMPONENT_NAME)
+ @echo --------------------
+ -@mkdir -p $(PRJ_ROOT)/ana/metrics
+ -@$(CODE_COUNT) -detailed -progress -out $(PRJ_ROOT)/ana/metrics/metrics_$(COMPONENT_NAME).csv ..
+
+# Static Analysis Rule
+lint:
+ @echo --------------------
+ @echo Performing Lint on $(COMPONENT_NAME)
+ @echo --------------------
+ @echo includes the following files:
+ @echo $(LINT_SOURCES)
+ @echo --------------------
+ -@c:/lint/$(LINT) $(PRJ_ROOT)cfg/options.lnt C:/lint.PosixBasedOS001/co-gcc.lnt $(CC_DEFS) $(LINT_C_INCLUDES) $(INCLUDES) $(LINT_IMPLIED_DIRS) $(filter %.c ,$(LINT_SOURCES))
+ -@c:/lint/$(LINT) $(PRJ_ROOT)cfg/options.lnt C:/lint.PosixBasedOS001/co-gcc.lnt $(CPP_DEFS) $(LINT_CPP_INCLUDES) $(INCLUDES) $(LINT_IMPLIED_DIRS) $(filter %.cpp %.cc %.cxx,$(LINT_SOURCES) )
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/common.mk b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/common.mk
new file mode 100755
index 0000000..10a9a6b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/common.mk
@@ -0,0 +1,175 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+####################################################################
+# DO NOT EDIT THIS FILE
+# Common Project Makefile definitions shared by all types of makefiles
+#
+#
+# Please use project.mk in your build folder to customize your build
+#######################################################################
+
+include $(PRJ_ROOT)cfg/depends.mk
+
+ifndef COMPONENT_ROOT
+export COMPONENT_ROOT=$(COMPONENT_NAME)
+endif
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS += $(PROJECT_FLAGS)
+
+# Set local includes and then the reference includes (priority order determines search path)
+INCLUDES = \
+ $(CC_IFLAG)./ \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_ROOT)/inc \
+ $(addprefix $(CC_IFLAG),$(PROJECT_INCLUDE_PATHS)) \
+ $(DEPENDS_INCLUDES) \
+
+
+# Do the same if you need to include library paths as well
+LIB_PATHS += \
+ $(PROJECT_LIB_PATHS) \
+ $(DEPENDS_LIB_PATHS) \
+
+
+LD_STATIC_LIBS += \
+ $(PROJECT_STATIC_LIBS)
+
+LD_DYNAMIC_LIBS += \
+ $(PROJECT_DYNAMIC_LIBS)
+
+## Sources Section
+
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+# Convert the source files to object files with correct folder location.
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+D_FILES = $(OBJECTS:.o=.d)
+
+# pull in dependency info for existing .o files
+-include $(D_FILES)
+
+
+ifeq ($(BUILDTYPE),APP)
+COMPONENT_EXEC = $(BIN_PATH)$(COMPONENT_NAME)$(DEBUG_EXT)
+BINARIES = \
+ $(COMPONENT_EXEC)
+
+$(COMPONENT_EXEC): $(OBJECTS)
+ $(LD_CMD) $(LD_OFLAG) $(@) $(OBJECTS) $(addprefix -L , $(LIB_PATHS)) -Bstatic $(addprefix -l , $(LD_STATIC_LIBS)) -Bdynamic $(addprefix -l , $(LD_DYNAMIC_LIBS))
+
+endif
+
+ifeq ($(BUILDTYPE),DLL)
+COMPONENT_SOLIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+LIBRARIES = \
+ $(COMPONENT_SOLIB) \
+
+$(COMPONENT_SOLIB): $(OBJECTS)
+ $(SO_CMD) $(OBJECTS) $(LD_OFLAG) $(@) $(addprefix -L, $(LIB_PATHS)) \
+ -Bstatic $(addprefix -l,$(STATIC_LIBS)) -Bdynamic $(addprefix -l,$(DYNAMIC_LIBS))
+
+endif
+
+ifeq ($(BUILDTYPE),LIB)
+COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+$(COMPONENT_LIB): $(OBJECTS)
+ $(AR_CMD)
+
+endif
+
+
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+base: banner module_dirs subdirs local
+
+
+$(BLD_PATH)/%.o: %.cpp
+ $(CPP_CMD)
+ $(CPP_D_CMD)
+ @mv -f $(@:.o=.d) $(@:.o=.d).tmp
+ @sed -e 's|.*: |$@: |' < $(@:.o=.d).tmp > $(@:.o=.d)
+ @rm -f $(@:.o=.d).tmp
+
+local: $(OBJECTS)
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(D_FILES)
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib paths: --> $(LIB_PATHS)"
+ @echo "static libs: --> $(LD_STATIC_LIBS)"
+ @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/config.mk b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/config.mk
new file mode 100755
index 0000000..5eb23f4
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/config.mk
@@ -0,0 +1,115 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Configuration Makefile version 2.0
+#
+
+.SUFFIXES:
+
+# Setup configuration exports to make sure other "subprojects" have the correct configuration settings.
+# Export shared variables
+export DEFS
+export LIBS
+export LIB_PATHS
+
+# Export setup
+export MAKE_DEPS := $(PRJ_ROOT)cfg/depends.mk
+export MAKE_CFG := $(TOOLS_CFG)config.mk
+
+# Set the location of build files. By default all build files become local to the initating location of the build so
+# one doesn't impact a referenced project
+# Alteratively a directed path can also be supported.
+ifndef PRJ_OUTPUT_ROOT
+PRJ_OUTPUT_ROOT = $(PRJ_ROOT)
+endif
+
+# Select Compiler Tool by name and select the tool configuration file
+# default behavior is to generate for arm
+ifeq ($(TARGET),analysis)
+export MAKE_TOOLS := $(TOOLS_CFG)analysis.mk
+else
+ifeq ($(TARGET),x86)
+export MAKE_TOOLS := $(TOOLS_CFG)PosixBasedOS001_x86.mk
+else
+ifeq ($(TARGET),armle)
+export MAKE_TOOLS := $(TOOLS_CFG)PosixBasedOS001_arm.mk
+else
+export MAKE_TOOLS := $(TOOLS_CFG)PosixBasedOS001_armv7.mk
+TARGET = armle-v7
+endif
+endif
+endif
+
+
+# Set specific flags as path suffixes to make sure the right build options are picked up
+ifdef DEBUG
+BUILD_CFG+=/debug
+endif
+ifdef PROFILING
+BUILD_CFG+=/profile
+endif
+ifndef BUILD_CFG
+BUILD_CFG=/release
+endif
+
+# Set File Paths
+export BIN_PATH := $(PRJ_OUTPUT_ROOT)bin/$(TARGET)$(BUILD_CFG)/
+export BLD_PATH := $(PRJ_OUTPUT_ROOT)bld/$(TARGET)$(BUILD_CFG)/$(COMPONENT_NAME)/
+export LIB_PATH := $(PRJ_OUTPUT_ROOT)lib/$(TARGET)$(BUILD_CFG)/
+export SLIB_PATH := $(PRJ_OUTPUT_ROOT)dll/$(TARGET)$(BUILD_CFG)/
+export BUILD_DIRS = $(BIN_PATH) $(LIB_PATH) $(SLIB_PATH) $(BLD_PATH)
+export BUILD_ROOTS := $(addprefix $(PRJ_OUTPUT_ROOT), bin bld lib dll)
+
+# Set Staging Location - set to a default location to prevent accidents
+ifndef STAGE_LOCATION
+export STAGE_LOCATION = C:/temp/stage/
+endif
+
+# Now include the defintions that have been exported
+include $(MAKE_TOOLS)
+
+# Add additional configuration includes reflective of project and decisions expressed in include makefiles.
+# So local includes, base infrastructure, and target platform.
+# This is also the variable to add local overriding header file locations for configuration in makefiles
+# prior to spawning to subprojects. Which means if you want to utilize different header files than those
+# the project you are going to build this will force an early search path to override with.
+ifndef CFG_INCS
+ export CFG_INCS +=
+endif
+
+# Standard Targets (and defaults)
+all:
+
+subdirs:
+
+# Building necessary directories
+build_dirs: $(BUILD_DIRS)
+
+$(BUILD_DIRS):
+ -mkdir -p $(@)
+
+# Stage "public" directories
+stage:
+ -rm -r $(STAGE_LOCATION)/$(COMPONENT_NAME)
+ mkdir -p $(STAGE_LOCATION)/$(COMPONENT_NAME)
+ cp -r ../bin ../dll ../lib ../inc ../cfg ../doc $(STAGE_LOCATION)/$(COMPONENT_NAME)/
+
+
+# Debug Headers
+banner:
+ @echo Making $(COMPONENT_NAME)
+ @echo Bld Roots $(BLD_ROOTS)
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/depends.mk b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/depends.mk
new file mode 100755
index 0000000..57ecd9b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/depends.mk
@@ -0,0 +1,115 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Dependency Makefile Version 2.0
+#
+# Dependency file dictates not only what other modules the project is dependent on, but
+# also where to get that dependent element which logically includes versioning or
+# baselining information
+
+
+# Begin User Build Location Definition
+# This is the prefixing information which dictates the versioning of dependant projects
+# Typically path statements will include some set of versioning information.
+
+# The Repository Root is the base location of where a build is put in context
+# By default this is up a directory from the project root. This is based on
+# the default local build where a component where a project is started to build is
+# on the same level as other components in the repository. Otherwise a value can
+# be forced by setting the value before operating on the configuration file.
+#
+# Example would be to setting the Repository Root to a baseline label name
+# where the contents of the baseline lable are exported to the filesystem.
+ifndef REPOSITORY_ROOT
+export REPOSITORY_ROOT = $(PRJ_ROOT)../
+endif
+
+# The Team Root is akin to the Repository Root. It sets the location of
+# the root for other components in the same stream. It is very rare to
+# modify the value of the team root. However it is entirely possible that
+# the repository root and the team root are pointed to the same location.
+# By default the Team Root is set to the workspace location of your project
+ifndef TEAM_ROOT
+export TEAM_ROOT = $(PRJ_ROOT)../
+endif
+
+# Setup the include paths for project functional dependencies by component.
+# This is a list of include paths that should be done with relative locations
+# that are relative to the repository root for all elements external to the
+# component. All Dependency includes should be based on the $(REPOSITORY_ROOT)
+# all local (team/local) dependencies should be handled in the main makefile.
+# Note: Internal include locations should be simply in the makefile directly using
+# the './' as the notation for referencing location.
+# EXCEPTION: The first include is a TEAM_ROOT for the locally "globally" visible
+# module(s) of the Domain. (When doing the product release this is overridden)
+DEPENDS_INCLUDES = \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/framework \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/_CWORD77_ \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/services \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/utility \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/native \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/framework/statemachine \
+ $(CC_IFLAG)$(TEAM_ROOT)SystemServices/inc \
+ $(CC_IFLAG)$(TEAM_ROOT)NativeServices/inc/testautomationframework \
+ $(CC_IFLAG)$(REPOSITORY_ROOT)OpenSource/inc \
+
+DEPENDS_LIB_PATHS = \
+ $(TEAM_ROOT)NativeServices/lib/$(TARGET)$(BUILD_CFG)/ \
+ $(TEAM_ROOT)NativeServices/dll/$(TARGET)$(BUILD_CFG)/
+
+# BSP is required for PastModel002 because of mq (libmqS.a)
+ifneq ($(TARGET),x86)
+ ifeq ($(PRODUCT_NAME),PastModel004)
+ ifdef TARGET_BSP
+ ifndef BSP
+ BSP = $(TARGET_BSP)
+ endif
+ endif
+ ifndef BSP
+ ifneq ($(findstring all,$(MAKECMDGOALS)),)
+$(error \
+$(\n) \
+$(\n)***************************************************************************************** \
+$(\n)!!!ERROR!!! BSP not defined. Please, define TARGET_BSP variable in your make environment \
+$(\n)***************************************************************************************** \
+$(\n))
+ endif
+ else
+ DEPENDS_LIB_PATHS += $(REPOSITORY_ROOT)/$(BSP)/prebuilt/armle-v7/usr/lib
+ endif
+ endif
+endif
+
+
+# $(REPOSITORY_ROOT)SystemServices/lib/$(TARGET)$(BUILD_CFG)/ \
+
+# Setup library definintions. Same rules
+include $(TEAM_ROOT)NativeServices/cfg/nativeserviceslibraries.mk
+
+# Setup the include location for the tools configuration. This sets the
+# standard tool definition locations. By default these are local, but
+# long term will be a standard component for a project to include. This
+# definition is inherited in cases that this is a recursive call.
+
+# Set tools location
+ifndef TOOLS_CFG
+TOOLS_CFG = $(TEAM_ROOT)NativeServices/cfg/
+endif
+
+# Include the configuration
+include $(TOOLS_CFG)config.mk
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/nativeserviceslibraries.mk b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/nativeserviceslibraries.mk
new file mode 100755
index 0000000..67205f1
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/cfg/nativeserviceslibraries.mk
@@ -0,0 +1,54 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# TODO make this more functionally oriented.
+# That is to make them more like the types ... so client libraries, etc.
+
+#NATIVE_SERVICES_DYNAMIC_LIBS = \
+# NS_FrameworkCore$(DEBUG_EXT) \
+# NS_Logger$(DEBUG_EXT) \
+# NS_Timer$(DEBUG_EXT)\
+# NS_MessageCenter$(DEBUG_EXT) \
+# NS_MessageQueue$(DEBUG_EXT) \
+# NS_SharedMemIf$(DEBUG_EXT) \
+# NS_NPServiceIf$(DEBUG_EXT) \
+# NS_UtilityCenter$(DEBUG_EXT) \
+# NS_ConfigParser$(DEBUG_EXT) \
+# NS__CWORD77__ServiceIf$(DEBUG_EXT) \
+
+# For improving startup performance, all libraries are merged into one
+# Other modules can still use individual libraries if required. Other NS libraries are also available.
+#NATIVE_SERVICES_DYNAMIC_LIBS = \
+# NS_Storage$(DEBUG_EXT) \
+# sqlite3 \
+# z \
+# NS_FrameworkUnified$(DEBUG_EXT) \
+
+NATIVE_SERVICES_DYNAMIC_LIBS = \
+ NS_FrameworkUnified$(DEBUG_EXT) \
+
+NATIVE_SERVICES_IMAGE_STORE_DYNAMIC_LIBS = \
+ sqlite3 \
+ z \
+ NS_Storage$(DEBUG_EXT) \
+ NS_ImageStorage$(DEBUG_EXT) \
+
+NATIVE_SERVICES_DYNAMIC_LIBS_CORE = \
+ NS_CoreUnified$(DEBUG_EXT) \
+
+TEST_AUTOMATION_FRAMEWORK_STATIC_LIBS = \
+ NS_TestAutomationFramework$(DEBUG_EXT) \
+
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/makefile_PosixBasedOS001 b/video_in_hal/nsframework/framework_unified/client/NativeServices/makefile_PosixBasedOS001
new file mode 100755
index 0000000..9b512f4
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/makefile_PosixBasedOS001
@@ -0,0 +1,55 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Top level makefile triggered to export all options
+
+# Set Optimization on for all lower makefiles
+#export OPTIMIZATION=OPTIMIZE
+
+all interface clean clean_interface clean_test:
+ $(MAKE) -C src OPTIMIZATION=FULL_OPTIMIZE DYNAMIC=TRUE $(MAKECMDGOALS)
+ $(MAKE) -C src DEBUG=TRUE OPTIMIZATION=NONE DYNAMIC=TRUE $(MAKECMDGOALS)
+ $(MAKE) -C src TARGET=x86 DYNAMIC=TRUE $(MAKECMDGOALS)
+ $(MAKE) -C src TARGET=x86 DEBUG=TRUE DYNAMIC=TRUE $(MAKECMDGOALS)
+
+# doxygen and graphviz tools must be in path of Jazz Build Engine
+# tested with doxygen 1.7.2 and graphviz 2.26.3
+docs:
+ $(MAKE) -C dox all
+
+lint:
+ $(MAKE) -C src TARGET=analysis lint
+
+# unit tests require main libraries -- typically not run directly, but part of a build engine
+unittest:
+ #$(MAKE) -C src OPTIMIZATION=FULL_OPTIMIZE $(MAKECMDGOALS)
+ #$(MAKE) -C src TARGET=x86 $(MAKECMDGOALS)
+ $(MAKE) -C src TARGET=x86 DYNAMIC=TRUE $(MAKECMDGOALS)
+ $(MAKE) -C src TARGET=x86 DEBUG=TRUE DYNAMIC=TRUE $(MAKECMDGOALS)
+
+functionaltest misc:
+ #$(MAKE) -C src OPTIMIZATION=FULL_OPTIMIZE DYNAMIC=TRUE $(MAKECMDGOALS)
+ #$(MAKE) -C src DEBUG=TRUE OPTIMIZATION=NONE DYNAMIC=TRUE $(MAKECMDGOALS)
+ $(MAKE) -C src TARGET=x86 DYNAMIC=TRUE $(MAKECMDGOALS)
+ #$(MAKE) -C src TARGET=x86 DEBUG=TRUE DYNAMIC=TRUE $(MAKECMDGOALS)
+
+
+# Stage is a forced clean, build, export
+# Expectation is that the user sets the STAGE_LOCATION in initiating the makefile
+stage:
+ $(MAKE) clean
+ $(MAKE) all
+ $(MAKE) -C src stage
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_filestorage.sql b/video_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_filestorage.sql
new file mode 100755
index 0000000..b6aa172
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_filestorage.sql
@@ -0,0 +1,9 @@
+CREATE TABLE IF NOT EXISTS IMAGE(
+ METAUID VARCHAR NOT NULL,
+ FORMAT VARCHAR NULL,
+ PATH VARCHAR NULL,
+ CRC BIGINT NOT NULL,
+ FILEID BIGINT NOT NULL,
+ TIMESTAMP DATETIME NOT NULL,
+ PRIMARY KEY ( METAUID,FILEID )
+);
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog.cfg b/video_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog.cfg
new file mode 100755
index 0000000..729fe2f
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog.cfg
@@ -0,0 +1,278 @@
+[REALTIME_LOG]
+Output=OFF
+
+[ZONE_LIST]
+List=ZONE_PERFORMANCE,ZONE_SCREEN_TRANS,ZONE_SWDL,ZONE_SYSTEMDATA,ZONE_LOG_SH,ZONE_LOG_SYS,ZONE_LOG__CWORD52_,ZONE_SECURE,ZONE_CAN_FILTER,ZONE_COMM_PROCESS,ZONE_CONNECT_DEVICE,ZONE_COMM_SYS,ZONE_COMM_SH,ZONE_COMM_USB
+
+[ZONE_PERFORMANCE]
+Zone=64
+FileName=frameworkunified_performance.log
+FileSizeMax=1048576
+
+[ZONE_SCREEN_TRANS]
+Zone=65
+FileName=frameworkunified_screen_trans.log
+FileSizeMax=20480
+
+[ZONE_SWDL]
+Zone=66
+FileName=frameworkunified_swdl.log
+FileSizeMax=10240
+
+[ZONE_SYSTEMDATA]
+Zone=67
+FileName=frameworkunified_systemdata.log
+FileSizeMax=655360
+
+[ZONE_LOG_SH]
+Zone=68
+FileName=frameworkunified_sh.log
+FileSizeMax=65536
+
+[ZONE_LOG_SYS]
+Zone=69
+FileName=frameworkunified_sys.log
+FileSizeMax=131072
+
+[ZONE_LOG__CWORD52_]
+Zone=70
+FileName=frameworkunified__CWORD52_.log
+FileSizeMax=4096
+
+[ZONE_SECURE]
+Zone=71
+FileName=frameworkunified_secure.log
+FileSizeMax=4096
+
+[ZONE_CAN_FILTER]
+Zone=72
+FileName=frameworkunified_can_filter.log
+FileSizeMax=40960
+
+[ZONE_COMM_PROCESS]
+Zone=73
+FileName=frameworkunified_comm_process.log
+FileSizeMax=1048576
+
+[ZONE_CONNECT_DEVICE]
+Zone=74
+FileName=frameworkunified_connect_device.log
+FileSizeMax=20480
+
+[ZONE_COMM_SYS]
+Zone=96
+FileName=frameworkunified_comm_sys.log
+FileSizeMax=1048576
+
+[ZONE_COMM_SH]
+Zone=97
+FileName=frameworkunified_comm_sh.log
+FileSizeMax=1048576
+
+[ZONE_COMM_USB]
+Zone=98
+FileName=frameworkunified_comm_usb.log
+FileSizeMax=1048576
+
+[FLAG_DEFAULT]
+LogLevel=Release
+FileName=frameworkunified_debug.log
+FileSizeMax=3419136
+
+[FLAG_LIST]
+List=FLAG_UIAPP,FLAG_RADIO,FLAG_MEDIA,FLAG_VEHICLE,FLAG_NETWORK,FLAG_CONNECTIVITY,FLAG_APPFW,FLAG_BTTEL,FLAG_VR,FLAG_NAVI,FLAG_SYSTEM,FLAG_BASEPF,FLAG_COMMUNICATION
+
+[FLAG_UIAPP]
+LogLevel=Release
+FileName=frameworkunified_debug_uiapp.log
+FileSizeMax=10485760
+Service1=proxy_app
+Service2=audio_app
+Service3=connect_app
+Service4=diag_app
+Service5=home_app
+Service6=repro_app
+Service7=vui_app
+Service8=VehicleInfoSrv
+Service9=InfoSettingSrv
+Service10=MenuService
+Service11=DelPersonalSrv
+
+[FLAG_RADIO]
+LogLevel=Release
+FileName=frameworkunified_debug_radio.log
+FileSizeMax=81920
+Service1=RadioService
+Service2=RadioHDArbiter
+Service3=hrds_manager
+
+[FLAG_MEDIA]
+LogLevel=Release
+FileName=frameworkunified_debug_media.log
+FileSizeMax=81920
+Service1=DtvService
+Service2=PlaybackService
+Service3=DiscService
+Service4=_CWORD8_Srv
+Service5=DtvVupService
+
+[FLAG_VEHICLE]
+LogLevel=Release
+FileName=frameworkunified_debug_vehicle.log
+FileSizeMax=81920
+Service1=DiagService
+Service2=vehicle_app
+Service3=VS_ACNSrv
+Service4=VS_CMRSrv
+Service5=VS_DMSSrv
+Service6=VS_ENMSrv
+Service7=VS_FUCSrv
+Service8=VS_METSrv
+Service9=VS_NMSSrv
+Service10=VS_VSDSrv
+
+[FLAG_NETWORK]
+LogLevel=Release
+FileName=frameworkunified_debug_network.log
+FileSizeMax=81920
+Service1=NetworkManager
+Service2=ComArb_CWORD84_
+
+[FLAG_CONNECTIVITY]
+LogLevel=Release
+FileName=frameworkunified_debug_connectivity.log
+FileSizeMax=81920
+Service1=_CWORD57_DTService
+Service2=_CWORD57_UtilService
+Service3=MisinkService
+Service4=MisinkMiddle
+Service5=_CWORD27_Service
+Service6=RemoteService
+Service7=_CWORD76_Service
+Service8=_CWORD58_Service
+Service9=SDLService
+Service10=_CWORD89_Service
+Service11=SPCService
+Service12=eOMService
+Service13=LSP
+Service14=AwtPrimary
+Service15=TFFProxy
+Service16=EnformService
+
+[FLAG_APPFW]
+LogLevel=Release
+FileName=frameworkunified_debug_appfw.log
+FileSizeMax=81920
+
+[FLAG_BTTEL]
+LogLevel=Release
+FileName=frameworkunified_debug_bttel.log
+FileSizeMax=81920
+Service1=BT_BLLSrv
+Service2=BT_CnctSrv
+Service3=BT_PhoneSrv
+Service4=DCM_PhoneSrv
+Service5=BT_PbkSrv
+Service6=BT_MsgSrv
+Service7=WlanMiddle
+Service8=wlan_controller
+Service9=DCMService
+Service10=HELPService
+Service11=hciattach_qca
+
+[FLAG_VR]
+LogLevel=Release
+FileName=frameworkunified_debug_vr.log
+FileSizeMax=81920
+Service1=vrmanager_area1
+Service2=vrmanager_area2
+Service3=vrmanager_area3
+Service4=vrmanager_area4
+Service5=contentsmgr
+Service6=vrmanager_area1_t
+Service7=vrmanager_area1__CWORD84__t
+Service8=vrmanager_area1__CWORD84_
+Service9=vrmanager_area2__CWORD84_
+
+[FLAG_NAVI]
+LogLevel=Release
+FileName=frameworkunified_debug_navi.log
+FileSizeMax=1024
+
+[FLAG_SYSTEM]
+LogLevel=Release
+FileName=frameworkunified_debug_system.log
+FileSizeMax=81920
+Service1=ReproService
+Service2=Positioning
+
+[FLAG_BASEPF]
+LogLevel=Release
+FileName=frameworkunified_debug_base_pf.log
+FileSizeMax=1126400
+Service1=AS_AudioManager
+Service2=graphics
+Service3=CANGW_M
+Service4=CANGW_S
+Service5=DummyRead
+Service6=ExtUnitAuth
+Service7=LockManager
+Service8=Mounter
+Service9=MounterEx
+Service10=NS_BackupMgr
+Service11=NS_NPPService
+Service12=NS_RemoteCtrlService
+Service13=NS_SharedMem
+Service14=NW_MicService
+Service15=PS_CDR
+Service16=PS_CommSH4A
+Service17=PS_CommUSB
+Service18=PS_IPC
+Service19=PS_IPC_MP_Shadow
+Service20=PS_LanServer
+Service21=PS_LoggerShadow
+Service22=PS_PSMShadow
+Service23=PS_SwitchHandler
+Service24=ProxyService
+Service25=SS_DeviceDetectionService
+Service26=SS_GroupLaunchTrigger
+Service27=SS_LoggerService
+Service28=SS_PartitionRemount
+Service29=SS_PowerService
+Service30=SS_ScrShot
+Service31=SS_SystemManager
+Service32=SS_WinSys
+Service33=Sound
+Service34=StartUpBgm
+Service35=ViewerApp
+Service36=_CWORD52_vup
+Service37=clock
+Service38=communication
+Service39=dcmDevNotify
+Service40=dsrcDevNotify
+Service41=fatfsck
+Service42=hubDevNotify
+Service43=mkfatfs
+Service44=mscDevNotify
+Service45=nandupdate
+Service46=ncmDevNotify
+Service47=norvup
+Service48=nsprofileutil
+Service49=nsverutil
+Service50=resm
+Service51=rootfsvup
+Service52=sdDevNotify
+Service53=sysupdate
+Service54=sysvup
+Service55=tskmgr
+Service56=updateservice
+Service57=usbDevNotify
+Service58=vehicle
+Service59=vupprogressui
+Service60=vupservice
+Service61=webdavmgr
+
+[FLAG_COMMUNICATION]
+LogLevel=Release
+FileName=frameworkunified_debug_communication.log
+FileSizeMax=81920
diff --git a/video_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg b/video_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg
new file mode 100755
index 0000000..0ca29e5
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/NativeServices/scfg/ns_logger_frameworkunifiedlog__CWORD84_.cfg
@@ -0,0 +1,427 @@
+[REALTIME_LOG]
+Output=OFF
+
+[ZONE_LIST]
+
+#List=ZONE_PERFORMANCE,ZONE_SCREEN_TRANS,ZONE_SWDL,ZONE_SYSTEMDATA,ZONE_LOG_SH,ZONE_LOG_SYS,ZONE_LOG__CWORD52_,ZONE_SECURE,ZONE_CAN_FILTER,ZONE_COMM_PROCESS,ZONE_CONNECT_DEVICE,ZONE_COMM_SYS,ZONE_COMM_SH,ZONE_COMM_USB,ZONE_POS_SYS_IN,ZONE_POS_GPS_IN,ZONE_POS_CMD_IN,ZONE_ALSA,ZONE_WINSYS,ZONE_SOC_TEMP,ZONE_VERSION,ZONE_COMM_SYS_STS,ZONE_HDARBITER
+
+#List=ZONE_PERFORMANCE,ZONE_SCREEN_TRANS,ZONE_SWDL,ZONE_SYSTEMDATA,ZONE_LOG_SH,ZONE_LOG_SYS,ZONE_LOG__CWORD52_,ZONE_SECURE,ZONE_CAN_FILTER,ZONE_COMM_PROCESS,ZONE_CONNECT_DEVICE,ZONE_COMM_SYS,ZONE_COMM_SH,ZONE_COMM_USB,ZONE_POS_SYS_IN,ZONE_POS_GPS_IN,ZONE_POS_CMD_IN,ZONE_ALSA,ZONE_WINSYS,ZONE_SOC_TEMP,ZONE_VERSION,ZONE_COMM_SYS_STS,ZONE_HDARBITER,ZONE_TOUCH
+List=ZONE_PERFORMANCE,ZONE_SCREEN_TRANS,ZONE_SWDL,ZONE_SYSTEMDATA,ZONE_LOG_SH,ZONE_LOG_SYS,ZONE_LOG__CWORD52_,ZONE_CAN_FILTER,ZONE_COMM_PROCESS,ZONE_CONNECT_DEVICE,ZONE_COMM_SYS,ZONE_COMM_SH,ZONE_COMM_USB,ZONE_POS_SYS_IN,ZONE_POS_GPS_IN,ZONE_POS_CMD_IN,ZONE_ALSA,ZONE_WINSYS,ZONE_SOC_TEMP,ZONE_VERSION,ZONE_COMM_SYS_STS,ZONE_HDARBITER,ZONE_TOUCH
+
+[ZONE_PERFORMANCE]
+Zone=64
+FileName=frameworkunified_performance.log
+FileSizeMax=131072
+
+[ZONE_SCREEN_TRANS]
+Zone=65
+FileName=frameworkunified_screen_trans.log
+FileSizeMax=20480
+
+[ZONE_SWDL]
+Zone=66
+FileName=frameworkunified_swdl.log
+FileSizeMax=10240
+
+[ZONE_SYSTEMDATA]
+Zone=67
+FileName=frameworkunified_systemdata.log
+FileSizeMax=655360
+
+[ZONE_LOG_SH]
+Zone=68
+FileName=frameworkunified_sh.log
+FileSizeMax=65536
+
+[ZONE_LOG_SYS]
+Zone=69
+FileName=frameworkunified_sys.log
+FileSizeMax=131072
+
+[ZONE_LOG__CWORD52_]
+Zone=70
+FileName=frameworkunified__CWORD52_.log
+FileSizeMax=4096
+
+
+#[ZONE_SECURE]
+#Zone=71
+#FileName=frameworkunified_secure.log
+#FileSizeMax=4096
+
+
+[ZONE_CAN_FILTER]
+Zone=72
+FileName=frameworkunified_can_filter.log
+FileSizeMax=40960
+
+[ZONE_COMM_PROCESS]
+Zone=73
+FileName=frameworkunified_comm_process.log
+FileSizeMax=1024
+
+[ZONE_CONNECT_DEVICE]
+Zone=74
+FileName=frameworkunified_connect_device.log
+FileSizeMax=20480
+
+[ZONE_COMM_SYS]
+Zone=96
+FileName=frameworkunified_comm_sys.log
+FileSizeMax=1048576
+
+[ZONE_COMM_SH]
+Zone=97
+FileName=frameworkunified_comm_sh.log
+FileSizeMax=1048576
+
+[ZONE_COMM_USB]
+Zone=98
+FileName=frameworkunified_comm_usb.log
+FileSizeMax=1048576
+
+[ZONE_POS_SYS_IN]
+Zone=99
+FileName=frameworkunified_pos_sys_in.log
+FileSizeMax=102400
+
+[ZONE_POS_GPS_IN]
+Zone=100
+FileName=frameworkunified_pos_gps_in.log
+FileSizeMax=20480
+
+[ZONE_POS_CMD_IN]
+Zone=101
+FileName=frameworkunified_pos_cmd_in.log
+FileSizeMax=10240
+
+[ZONE_ALSA]
+Zone=103
+FileName=frameworkunified_alsa.log
+FileSizeMax=450560
+ForceOutput=True
+
+[ZONE_WINSYS]
+Zone=105
+FileName=frameworkunified_winsys.log
+FileSizeMax=512000
+ForceOutput=True
+
+[ZONE_SOC_TEMP]
+Zone=104
+FileName=frameworkunified_soc_temp.log
+FileSizeMax=2048
+
+[ZONE_VERSION]
+Zone=106
+FileName=frameworkunified_version.log
+FileSizeMax=8192
+
+[ZONE_COMM_SYS_STS]
+Zone=107
+FileName=frameworkunified_comm_sys_sts.log
+FileSizeMax=102400
+
+[ZONE_HDARBITER]
+Zone=108
+FileName=frameworkunified_hdarbiter.log
+FileSizeMax=102400
+
+
+[ZONE_TOUCH]
+Zone=109
+FileName=frameworkunified_touch_display.log
+FileSizeMax=32768
+
+
+[FLAG_DEFAULT]
+LogLevel=Release
+FileName=frameworkunified_debug.log
+FileSizeMax=2097152
+
+Realtimelog=True
+
+[FLAG_LIST]
+
+#List=FLAG_UIAPP,FLAG_RADIO,FLAG_MEDIA,FLAG_VEHICLE,FLAG_DIAG,FLAG_NETWORK,FLAG_CONNECTIVITY,FLAG_APPFW,FLAG_BTTEL,FLAG_VR,FLAG_NAVI,FLAG_SYSTEM,FLAG_BASEPF,FLAG_COMMUNICATION,FLAG_LSP,FLAG__CWORD76_,FLAG_MISINK,FLAG_CONNPROXY
+List=FLAG_UIAPP,FLAG_RADIO,FLAG_MEDIA,FLAG_VEHICLE,FLAG_DIAG,FLAG_NETWORK,FLAG_CONNECTIVITY,FLAG_APPFW,FLAG_BTTEL,FLAG_VR,FLAG_NAVI,FLAG_SYSTEM,FLAG_BASEPF,FLAG_COMMUNICATION,FLAG_LSP,FLAG__CWORD76_,FLAG_MISINK,FLAG_CONNPROXY,FLAG_CPAA
+
+[FLAG_UIAPP]
+LogLevel=Release
+FileName=frameworkunified_debug_uiapp.log
+FileSizeMax=5242880
+
+Realtimelog=True
+Service1=proxy_app
+Service2=audio_app
+Service3=connect_app
+Service4=diag_app
+Service5=home_app
+Service6=repro_app
+Service7=vui_app
+Service8=VehicleInfoSrv
+Service9=InfoSettingSrv
+Service10=MenuService
+Service11=DelPersonalSrv
+Service12=vehicle_app
+
+[FLAG_RADIO]
+LogLevel=Release
+FileName=frameworkunified_debug_radio.log
+FileSizeMax=1249280
+
+Realtimelog=True
+Service1=RadioService
+Service2=RadioHDArbiter
+Service3=hrds_manager
+
+[FLAG_MEDIA]
+LogLevel=Release
+FileName=frameworkunified_debug_media.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=DtvService
+Service2=PlaybackService
+Service3=DiscService
+Service4=_CWORD8_Srv
+Service5=DtvVupService
+
+[FLAG_VEHICLE]
+LogLevel=Release
+FileName=frameworkunified_debug_vehicle.log
+FileSizeMax=6553600
+
+Realtimelog=True
+Service1=VS_ACNSrv
+Service2=VS_CMRSrv
+Service3=VS_DMSSrv
+Service4=VS_ENMSrv
+Service5=VS_FUCSrv
+Service6=VS_METSrv
+Service7=VS_NMSSrv
+Service8=VS_VSDSrv
+Service9=VS_TMCSrv
+Service10=VS_DASSrv
+
+[FLAG_DIAG]
+LogLevel=Release
+FileName=frameworkunified_debug_diag.log
+FileSizeMax=6553600
+
+[FLAG_NETWORK]
+LogLevel=Release
+FileName=frameworkunified_debug_network.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=NetworkManager
+Service2=ComArb_CWORD84_
+
+[FLAG_CONNECTIVITY]
+LogLevel=Release
+FileName=frameworkunified_debug_connectivity.log
+FileSizeMax=81920
+
+#Service1=_CWORD27_Service
+#Service2=eOMService
+#Service3=_CWORD57_DTService
+#Service4=_CWORD57_UtilService
+#Service5=SPCService
+Realtimelog=True
+Service1=eOMService
+Service2=_CWORD57_DTService
+Service3=_CWORD57_UtilService
+Service4=SPCService
+
+
+[FLAG_APPFW]
+LogLevel=Release
+FileName=frameworkunified_debug_appfw.log
+FileSizeMax=1048576
+
+Realtimelog=True
+Service1=modemanager
+Service2=acmsrv
+
+[FLAG_BTTEL]
+LogLevel=Release
+FileName=frameworkunified_debug_bttel.log
+
+#FileSizeMax=6291456
+FileSizeMax=6023168
+Realtimelog=True
+
+Service1=TEL_BLLSrv
+Service2=BT_CnctSrv
+Service3=BT_PhoneSrv
+Service4=DCM_PhoneSrv
+Service5=BT_PbkSrv
+Service6=BT_MsgSrv
+Service7=WlanMiddle
+Service8=wlan_controller
+Service9=DCMService
+Service10=HELPService
+Service11=hciattach_qca
+
+[FLAG_VR]
+LogLevel=Release
+FileName=frameworkunified_debug_vr.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=vrmanager_area1
+Service2=vrmanager_area2
+Service3=vrmanager_area3
+Service4=contentsmgr
+Service5=vrmanager_area1_t
+Service6=vrmanager_area1__CWORD84__t
+Service7=vrmanager_area1__CWORD84_
+Service8=vrmanager_area2__CWORD84_
+Service9=vrmanager_area3__CWORD84_
+Service10=vrmanager_area5__CWORD84_
+
+[FLAG_NAVI]
+LogLevel=Release
+FileName=frameworkunified_debug_navi.log
+FileSizeMax=1024
+
+Realtimelog=True
+
+[FLAG_SYSTEM]
+LogLevel=Release
+FileName=frameworkunified_debug_system.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=ReproService
+Service2=Positioning
+
+[FLAG_BASEPF]
+LogLevel=Release
+FileName=frameworkunified_debug_base_pf.log
+FileSizeMax=5017600
+
+Realtimelog=True
+Service1=AS_AudioManager
+Service2=graphics
+Service3=CANGW_M
+Service4=CANGW_S
+Service5=DummyRead
+Service6=ExtUnitAuth
+Service7=LockManager
+Service8=Mounter
+Service9=MounterEx
+Service10=NS_BackupMgr
+Service11=NS_NPPService
+Service12=NS_RemoteCtrlService
+Service13=NS_SharedMem
+Service14=NW_MicService
+Service15=PS_CDR
+Service16=PS_CommSH4A
+Service17=PS_CommUSB
+Service18=PS_IPC
+Service19=PS_IPC_MP_Shadow
+Service20=PS_LanServer
+Service21=PS_LoggerShadow
+Service22=PS_PSMShadow
+Service23=PS_SwitchHandler
+Service24=ProxyService
+Service25=SS_DeviceDetectionService
+Service26=SS_GroupLaunchTrigger
+Service27=SS_LoggerService
+Service28=SS_PartitionRemount
+Service29=SS_PowerService
+Service30=SS_ScrShot
+Service31=SS_SystemManager
+Service32=SS_WinSys
+Service33=Sound
+Service34=StartUpBgm
+Service35=ViewerApp
+Service36=_CWORD52_vup
+Service37=clock
+Service38=communication
+Service39=dcmDevNotify
+Service40=dsrcDevNotify
+Service41=fatfsck
+Service42=hubDevNotify
+Service43=mkfatfs
+Service44=mscDevNotify
+Service45=nandupdate
+Service46=ncmDevNotify
+Service47=norvup
+Service48=nsprofileutil
+Service49=nsverutil
+Service50=resm
+Service51=rootfsvup
+Service52=sdDevNotify
+Service53=sysupdate
+Service54=sysvup
+Service55=tskmgr
+Service56=updateservice
+Service57=usbDevNotify
+Service58=vehicle
+Service59=vupprogressui
+Service60=vupservice
+Service61=webdavmgr
+Service62=drop_caches
+
+Service63=ASND_Server
+
+[FLAG_COMMUNICATION]
+LogLevel=Release
+FileName=frameworkunified_debug_communication.log
+FileSizeMax=81920
+
+Realtimelog=True
+
+[FLAG_LSP]
+LogLevel=Release
+FileName=frameworkunified_debug_lsp.log
+FileSizeMax=1048576
+
+Realtimelog=True
+Service1=LSP
+Service2=ConnUtilSlave
+Service3=ServiceFlagMgr
+Service4=ConnMgr
+
+[FLAG__CWORD76_]
+LogLevel=Release
+FileName=frameworkunified_debug__CWORD76_.log
+FileSizeMax=245760
+
+Realtimelog=True
+Service1=_CWORD76_Service
+Service2=_CWORD58_Service
+Service3=SDLService
+Service4=_CWORD89_Service
+
+[FLAG_MISINK]
+LogLevel=Release
+FileName=frameworkunified_debug_misink.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=MisinkService
+Service2=misink
+Service3=MlinkService
+Service4=mlink
+
+[FLAG_CONNPROXY]
+LogLevel=Release
+FileName=frameworkunified_debug_connproxy.log
+FileSizeMax=81920
+
+Realtimelog=True
+Service1=TFFProxySlave
+
+
+[FLAG_CPAA]
+LogLevel=Release
+FileName=frameworkunified_debug_cpaa.log
+FileSizeMax=81920
+Realtimelog=True
+Service1=_CWORD27_Service
+Service2=_CWORD28_AutoService
+
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/XMLParser.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/XMLParser.h
new file mode 100755
index 0000000..36467ba
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/XMLParser.h
@@ -0,0 +1,289 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup MY 14 Platform Software Team
+/// \brief Xml parser used to extract and update data from Xml file
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file XMLParser.h
+ * @brief \~english Xml parser used to extract and update data from Xml file
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef XMLPARSER_H_ // NOLINT (build/header_guard)
+#define XMLPARSER_H_
+
+#include <libxml/tree.h>
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+
+#include <vector>
+#include <list>
+#include <string>
+#include <map>
+#include <sstream>
+
+////////////////////////////////////////////////////////////////////////
+/// CTestCaseData : Class used to fill testcase data from XML
+////////////////////////////////////////////////////////////////////////
+
+
+class CTestCaseData {
+ public:
+ std::string key;
+
+ // Delay for testCase
+ SI_32 m_testDelaySec;
+ SI_32 m_testDelayMSec;
+ SI_32 m_testDelayUSec;
+ // TestLoop Count
+ SI_32 m_testLoop;
+
+ SI_32 m_testReset;
+ SI_32 m_testPrintResult;
+ std::string m_testCategory;
+ std::string m_testResultType;
+
+ std::vector<std::string> macroVector;
+ // Delay for TestMacros
+ std::string m_macroDelaySecVal;
+ std::string m_macroDelayMsecVal;
+ std::string m_macroDelayUsecVal;
+
+ std::list<std::string> expOut;
+
+
+ CTestCaseData(const xmlChar *name, std::string testDelaySec, std::string testDelayMSec, std::string testDelayUSec,
+ std::string testLoopVal, std::string testReset, std::string testPrintResult, std::string testCategory,
+ std::string testResultType, std::vector<std::string> paramMacroVector, std::string macroDelaySecVal,
+ std::string macroDelayMSecVal, std::string macroDelayUSecVal,
+ std::list<std::string> expOutputVector);
+
+ CTestCaseData(const CTestCaseData &value);
+
+ ~CTestCaseData();
+};
+
+class XMLParser {
+ private:
+ struct FindByName {
+ std::string l_sName;
+ FindByName(const std::string &name) : l_sName(name) {} // NOLINT (readability/nolint)
+ bool operator()(const xmlNodePtr &xmlNode) {
+ std::stringstream l_sStream;
+ l_sStream << xmlNode->name;
+ std::string l_sStr = l_sStream.str();
+ return l_sStr == l_sName;
+ }
+ };
+
+ public:
+ static std::string xmlCharToString(const xmlChar *value);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// XMLParser
+ /// Class Constructor
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ XMLParser();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// XMLParser
+ /// Class Destructor
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ ~XMLParser();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// readAllXml
+ /// read all XML files from xmlInputFile
+ ///
+ /// \param [in] xmlInputFile
+ /// string
+ /// xmlList
+ /// string
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void readAllXml(const std::string &xmlInputFile, std::list<std::string> &xmlList); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// getChildNodeList
+ ///
+ /// \param [in] node
+ /// xmlNodePtr
+ /// nodeVector
+ /// vector<xmlNodePtr>
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void getChildNodeList(xmlNodePtr node, std::vector<xmlNodePtr> &nodeVector); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// fillMacroVector
+ ///
+ /// \param [in] node
+ /// xmlFileHandle
+ /// xmlDocPtr
+ /// macroNodeVector
+ /// vector<xmlNodePtr>
+ /// expOutValue
+ /// string
+ /// expOutputVector
+ /// list<std::string>
+ /// macroDelayVal
+ /// string
+ /// paramMacroVector
+ /// vector<std::string>
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void fillMacroVector(xmlDocPtr &xmlFileHandle, // NOLINT (readability/nolint)
+ std::vector<xmlNodePtr> &macroNodeVector, // NOLINT (readability/nolint)
+ std::string &expOutValue, // NOLINT (readability/nolint)
+ std::list<std::string> &expOutputVector, // NOLINT (readability/nolint)
+ std::string &macroSecDelayVal, // NOLINT (readability/nolint)
+ std::string &macroMSecDelayVal, // NOLINT (readability/nolint)
+ std::string &macroUSecDelayVal, // NOLINT (readability/nolint)
+ std::vector<std::string> &paramMacroVector); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// StringToNumber
+ /// Convert the string to number
+ ///
+ /// \param [in]
+ /// Text
+ /// string
+ ///
+ /// \return number value
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static int StringToNumber(const std::string &Text) { // NOLINT (readability/nolint)
+ std::istringstream ss(Text, std::istringstream::in);
+ int result;
+ return ss >> result ? result : 0;
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// createTestCaseVector
+ ///
+ /// \param [in]
+ /// testCaseNodeVector
+ /// vector<xmlNodePtr>
+ /// xmlFileHandle
+ /// xmlDocPtr
+ /// testCaseDataVector
+ /// vector<CTestCaseData>
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void createTestCaseVector(std::vector<xmlNodePtr> &testCaseNodeVector, xmlDocPtr &xmlFileHandle, // NOLINT (readability/nolint)
+ std::vector<CTestCaseData> &testCaseDataVector); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetXmlNodeAttributeValueToString
+ ///
+ /// \param [in]
+ /// arg
+ /// void *
+ /// str
+ /// const char *
+ /// xmlFileHandle
+ /// xmlDocPtr
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetXmlNodeAttributeValueToString(void *arg, const char *str, xmlDocPtr xmlFileHandle);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// populateTestCaseMap
+ ///
+ /// \param [in]
+ /// testCaseDataVector
+ /// vector<CTestCaseData>
+ /// xmlFileHandle
+ /// xmlDocPtr
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void populateTestCaseMap(std::vector<CTestCaseData> &testCaseDataVector, xmlDocPtr xmlFileHandle) ; // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// updateXmlActualOutput
+ ///
+ /// \param [in]
+ /// xmlName
+ /// string
+ /// testCaseName
+ /// string
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void updateXmlActualOutput(const std::string &xmlName, // NOLINT (readability/nolint)
+ std::string &testCaseName, // NOLINT (readability/nolint)
+ std::string &actualOutput); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetXmlExpectedOutput
+ ///
+ /// \param [in]
+ /// pKey
+ /// string
+ /// pValue
+ /// string
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void GetXmlExpectedOutput(std::string pKey, std::string pValue);
+
+ private:
+ xmlDocPtr m_xmlFileHandle;
+ static const std::string EXPECTEDOUTPUT;
+ static const std::string VALUE;
+ static const std::string DELAYSEC;
+ static const std::string DELAYMSEC;
+ static const std::string DELAYUSEC;
+ static const std::string TESTLOOP;
+ static const std::string TESTRESET;
+ static const std::string TESTPRINTRESULT;
+ static const std::string TESTCATEGORY;
+ static const std::string TESTCASEDATA;
+ static const std::string MACRODELAYSEC;
+ static const std::string MACRODELAYMSEC;
+ static const std::string MACRODELAYUSEC;
+ static const std::string LOOPPVAL;
+ static const std::string ACTUALOUTOUT;
+ static const std::string OUTPUT_SEPARATOR;
+ static const std::string ACCESS_OPERATOR;
+ static const std::string TERMINATE_STR;
+ static const SI_32 LOOP_DEFAULT_VALUE;
+ static const std::string DEFAULT_VALUE;
+ static const std::string PARAMETER_SEPARATOR;
+ static const std::string TESTRESULTTYPE;
+ static const std::string RESULT_AUTOMATIC;
+ static const std::string RESULT_MANUAL;
+};
+
+#endif /* XMLPARSER_H_ */ // NOLINT (build/header_guard)
+
+// EOF
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/framework_unified.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/framework_unified.h
new file mode 100755
index 0000000..b3c2f29
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/framework_unified.h
@@ -0,0 +1,130 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file framework_unified.h
+ * @brief \~english include all framework_unified head files
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef NATIVESERVICE_FRAMEWORKUNIFIED_H_ // NOLINT (build/header_guard)
+#define NATIVESERVICE_FRAMEWORKUNIFIED_H_
+
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_eventlogger.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_np_service_nor_persistence.h>
+#include <native_service/ns_np_service_notification.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/ns_shared_mem.h>
+#include <native_service/ns_shared_mem_if.h>
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_reader.h>
+#include <native_service/ns_sharedmem_writer.h>
+#include <native_service/ns_ringbuffer.h>
+#include <native_service/ns_system_mode.h>
+#include <native_service/ns_timer_if.h>
+#include <native_service/ns_timer_if.hpp>
+#include <native_service/ns_transmit_log.h>
+#include <native_service/ns_utility.hpp>
+#include <native_service/ns_utility_if.h>
+#include <native_service/ns_utility_sys.hpp>
+#include <native_service/ns_util_directory.h>
+#include <native_service/ns_util_crc.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/ns_resource_controler.h>
+#include <native_service/ns_version.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/wpf_legacy.h>
+#include <native_service/ns_rcs_data_handler.hpp>
+#include <native_service/ns_rcs_logger_types.h>
+#include <native_service/ns_rcs_plugin.hpp>
+#include <native_service/ns__CWORD77__common.h>
+#include <native_service/ns__CWORD77__data_pool_if.h>
+#include <native_service/ns__CWORD77__data_pool_key.h>
+#include <native_service/ns__CWORD77__data_pool_table.h>
+#include <native_service/ns__CWORD77__notifications.h>
+#include <native_service/ns__CWORD77__types.h>
+#include <native_service/frameworkunified__CWORD77__service_if.h>
+#include <native_service/frameworkunified__CWORD77__session_if.h>
+#include <native_service/ns_buildversioncheck.hpp>
+#include <native_service/ns_endianess.h>
+#include <native_service/nslogutil_cmd_if.h>
+#include <native_service/nsfw_message.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_framework_sync.h>
+#include <native_service/frameworkunified_framework_system_if.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_service_if.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <native_service/frameworkunified_timer.h>
+#include <native_service/frameworkunified_sm_action.h>
+#include <native_service/frameworkunified_sm_compositestate.h>
+#include <native_service/frameworkunified_sm_conditionconnector.h>
+#include <native_service/frameworkunified_sm_deephistorystate.h>
+#include <native_service/frameworkunified_sm_dispatcher.h>
+#include <native_service/frameworkunified_sm_eventdata.h>
+#include <native_service/frameworkunified_sm_eventfactory.h>
+#include <native_service/frameworkunified_sm_externaltransition.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/frameworkunified_sm_framework_if.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_guard.h>
+#include <native_service/frameworkunified_sm_historystate.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+#include <native_service/frameworkunified_sm_internaltransition.h>
+#include <native_service/frameworkunified_sm_leafstate.h>
+#include <native_service/frameworkunified_sm_localtransition.h>
+#include <native_service/frameworkunified_sm_multithreading.h>
+#include <native_service/frameworkunified_sm_orthogonalstate.h>
+#include <native_service/frameworkunified_sm_reaction.h>
+#include <native_service/frameworkunified_sm_shallowhistorystate.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <native_service/frameworkunified_sm_transition.h>
+#include <native_service/XMLParser.h>
+#include <native_service/ns_xml_reader.h>
+#include <native_service/ns_xml_wrter.h>
+#include <native_service/ns_xmlparser_if.h>
+#include <native_service/ns_reader.h>
+#include <native_service/ns_writer.h>
+
+#endif // NATIVESERVICE_FRAMEWORKUNIFIED_H_ NOLINT (build/header_guard)
+/**@}*/ // end of inc
+/**@}*/ // end of framework_unified
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__service_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__service_if.h
new file mode 100755
index 0000000..823257f
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__service_if.h
@@ -0,0 +1,554 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified__CWORD77__service_if.h
+ * @brief \~english This file contains a interface class for all services classes.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIED__CWORD77_SERVICE_H_ // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIED__CWORD77_SERVICE_H_
+
+#include <native_service/ns__CWORD77__common.h>
+#include <native_service/frameworkunified__CWORD77__session_if.h>
+#include <string>
+#include <map>
+#include <vector>
+
+///////////////////////////////////////////////////////////////////////////
+/// class: CFrameworkunified_CWORD77_Service
+/// Description: This is interface class for all services classes.
+///
+////////////////////////////////////////////////////////////////////////////
+
+class CFrameworkunified_CWORD77_Service {
+ protected:
+ std::map<UI_32, CFrameworkunified_CWORD77_Session *> m_SessTypeToSessObj; ///< Map of session type to session object
+ ResponseServiceTo_CWORD77_ m_cbResponse; ///< Call back function pointer
+ SessionAckTo_CWORD77_ m_cbSessionACK; // Call back function pointer for session ACK
+ std::vector<FrameworkunifiedNotificationCallbackHandler> m_vServiceNotifications; ///< vector of Frameworkunifiednotification callbacks
+ CFrameworkunified_CWORD77_Session *m_pSession; ///< Pointer to an instance of I_CWORD77_Session
+ std::string m_cServiceName;
+ BOOL m_bServiceAvailable;
+ UI_8 m_ui8SessionRetryCount;
+ HANDLE m_hApp; ///> application framework handle
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Function to send message to a session
+ /// \~english @param[in] f_uiSessionType
+ /// UI_32 - session type
+ /// \~english @param[in] f_uiSrvProtocol
+ /// UI_32 - Protocol ID
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// CFrameworkunified_CWORD77_Service::SetSession()
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Send specified sessionType message by FrameworkunifiedSendMsg().
+ /// \~english @par
+ /// If the session object corresponding to the session Public specified by the arguments is not registered,
+ /// the system terminates normally without sending the object.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see SetSession,FrameworkunifiedSendMsg
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SendMessageToSession(UI_32 f_uiSessionType, UI_32 f_uiSrvProtocol);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Function to open sessions with specified Service Name
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle to the Framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @param [in] f_sServiceName
+ /// f_sServiceName - Service Name
+ /// \~english @par
+ /// f_sServiceName - const std::string&
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - Save service name into member variable.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Function to open sessions with specified Service Name
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void OpenSession(HANDLE f_hApp, const std::string &f_sServiceName);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Function to close sessions
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle to the Framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Function to close sessions
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ void CloseSession(HANDLE f_hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Function to add notification
+ /// \~english @param[in] f_pNotification
+ /// PCSTR - Notification name
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Session obeject is declared in CFrameworkunified_CWORD77_Service::SetSession()
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// -Bind Notification name declared in parameter with callbak function in OnServiceNtf()
+ /// \~english @par Detail
+ /// -subscribed notifications will transfor into subscribe instance in SubscribeNotifications()
+ /// \~english @par Detail
+ /// -Process will not commit when notification parameter name is null
+ /// \~english @par Classification
+ /// -public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see SetSession,OnServiceNtf,SubscribeNotifications,UnSubscribeNotifications
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void AddNotification(PCSTR f_pNotification);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AttachOpenSessionAckCallback
+ /// virtual function to attche open session ack callback
+ ///
+ /// \param [in] hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus AttachOpenSessionAckCallback(HANDLE hApp) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// OpenSessionRetry
+ /// This function sends open session request to the service m_cServiceName
+ ///
+ /// \param [in] f_ui32SessionType
+ /// UI_32 - Session type to open
+ /// \return none
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ void OpenSessionRetry(UI_32 f_ui32SessionType);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Constructor for CFrameworkunified_CWORD77_Service
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// -No preconditions
+ /// \~english @par Change of internal status
+ /// -The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// -Create CFrameworkunified_CWORD77_Service class instance
+ /// -Initialize class member variable(m_cbResponse, m_cbSessionACK, m_pSession, m_cServiceName,\n
+ /// m_bServiceAvailable, m_ui8SessionRetryCount, m_hApp, m_SessTypeToSessObj).\n
+ /// \~english @par Classification
+ /// -public
+ /// \~english @par type
+ /// -None
+ /// \~english @see ~CFrameworkunified_CWORD77_Service
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunified_CWORD77_Service();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunified_CWORD77_Service
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -CFrameworkunified_CWORD77_Service instance is decleared in Constructor
+ /// \~english @par Change of internal status
+ /// -The internal status is not changed
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// -Release the CFrameworkunified_CWORD77_Service class instance
+ /// \~english @par Classification
+ /// -Pubulic
+ /// \~english @par Type
+ /// -None
+ /// \~english @see CFrameworkunified_CWORD77_Service
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunified_CWORD77_Service();
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// HandleMessage
+ /// virtual function to process message coming from _CWORD77_
+ /// \~english @param [in] cmdID
+ /// cmdID - Request ID
+ /// \~english @par
+ /// cmdID UI_32
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or Error
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// - none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus HandleServiceMessage(UI_32 cmdID) = 0;
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// function to open session with specified Service name when service available.
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle to the Framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @param [in] f_sServiceName
+ /// f_sServiceName - service name
+ /// \~english @par
+ /// f_sServiceName - const std::string &
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or Error
+ /// \~english @par Preconditions
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - save Framework handler into m_hApp.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// function to open session with specified Service name
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see AttachOpenSessionAckCallback, OpenSession
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenServiceOnAvailability(HANDLE f_hApp, const std::string &f_sServiceName);
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// function to close session when service unavailable.
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle to the Framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or Error
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - set m_bServiceAvailable FALSE.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// function to close session when service unavailable.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CloseSession
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseServiceOnUnavailability(HANDLE hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Set Call back function into Sessions.
+ /// \~english @param [in] fptr
+ /// fptr - Pointer to call back function
+ /// \~english @par
+ /// fptr ResponseServiceTo_CWORD77_*
+ /// \~english @retval
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - set m_cbResponse with fptr.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Set Call back function into Sessions.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetResponseCallback(ResponseServiceTo_CWORD77_ fptr);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// API to set session objects in service.
+ /// \~english @param [in] f_pSessionObj
+ /// f_pSessionObj - Pointer to an instance of session object.
+ /// \~english @par
+ /// f_pSessionObj CFrameworkunified_CWORD77_Session*
+ /// \~english @retval
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - set sessionobj into m_SessTypeToSessObj.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Set session objects in service.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetSession(CFrameworkunified_CWORD77_Session *f_pSessionObj);
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Subscribe notifications.
+ /// \~english @param [in] hApp
+ /// hApp - Handle to the Framework.
+ /// \~english @par
+ /// hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or eFrameworkunifiedStatusInvldParam
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - save pointer of notifications into framework handler.
+ /// \~english @par Conditions of processing failure
+ /// - FrameworkunifiedSubscribeNotificationWithCallback() failed [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Detail
+ /// Send subscribe message to NPPService for Subscribe notifications.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedSubscribeNotificationWithCallback
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SubscribeNotifications(HANDLE hApp);
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// unsubscribe notifications
+ /// \~english @param [in] hApp
+ /// hApp - Handle to the Framework.
+ /// \~english @par
+ /// hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or eFrameworkunifiedStatusInvldParam
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - delete notifications from framework handler.
+ /// \~english @par Conditions of processing failure
+ /// - FrameworkunifiedNPUnsubscribeFromNotifications() failed [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Detail
+ /// Send unsubscribe message to NPPService for delete subscribe notifications.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedSubscribeNotificationWithCallback
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnSubscribeNotifications(HANDLE hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// virtual function to enable session in service
+ /// \~english @param [in] f_uiNum
+ /// f_uiNum - Number of arguments
+ /// \~english @par
+ /// f_uiNum UI_32
+ /// \~english @param [in] f_uiFirst
+ /// f_uiFirst - first argument
+ /// \~english @par
+ /// f_uiFirst UI_32
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// None
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// None
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual void EnableSession(UI_32 f_uiNum, UI_32 f_uiFirst, ...) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// unsubscribe notifications
+ /// \~english @param [in] hApp
+ /// hApp - Handle to the Framework.
+ /// \~english @par
+ /// hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or eFrameworkunifiedStatusNullPointer
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none.
+ /// \~english @par Conditions of processing failure
+ /// - FrameworkunifiedGetMsgDataOfSize() failed [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Call register subscribe notification.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedGetMsgDataOfSize, SetRespNotfnDataIn_CWORD77_DataPool
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnServiceNtf(HANDLE hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Acknowledgement process of open session
+ /// \~english @param[in] f_hApp
+ /// HANDLE - Handle to the Application
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Set Session object in CFrameworkunified_CWORD77_Service::SetSession()
+ /// - Set Callback function in CFrameworkunified_CWORD77_Service::Set_CWORD77_OpenSessionACK()
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Set the application handle as Parameter when receiving acknowledgement for open session process.
+ /// Call OpenSessionAcknowledge() in session object which has same session type.
+ /// Call the callback function for open session acknowledgement.
+ /// \~english @par
+ /// Message sending process will be stoped in reguler when the session type of open session process is not
+ /// declared.
+ /// \~english @par
+ /// Callback function will be stoped in reguler when callback function is not declared.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see SetSession,Set_CWORD77_OpenSessionACK
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void OpenSessionAcks(HANDLE f_hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Service
+ /// \~english @par Brief
+ /// Attach open session ack callback function to service.
+ /// \~english @param [in] fptr
+ /// fptr - Callback Function pointer of notify open session ack.
+ /// \~english @par
+ /// fptr SessionAckTo_CWORD77_*
+ /// \~english @retval
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - set callback function into m_cbSessionACK..
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Attach open session ack callback function to service.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void Set_CWORD77_OpenSessionACK(SessionAckTo_CWORD77_ fptr);
+};
+
+#endif // _FRAMEWORKUNIFIED__CWORD77_SERVICE_H_ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__session_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__session_if.h
new file mode 100755
index 0000000..2c189a7
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified__CWORD77__session_if.h
@@ -0,0 +1,495 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified__CWORD77__session_if.h
+ * @brief \~english This file provides API for operating session
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIED__CWORD77_SESSION_H_ // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIED__CWORD77_SESSION_H_
+
+#include <native_service/ns__CWORD77__common.h>
+#include <string>
+#include <vector>
+
+class CFrameworkunified_CWORD77_Session {
+ protected:
+ HANDLE m_hSession; ///< Handle to session
+ HANDLE m_hApp; ///< Handle to Framework
+ HANDLE m_hService; ///< Handle to Service
+ UI_32 m_uiSessionType; ///< Session Type
+ ResponseServiceTo_CWORD77_ m_ResponseTo_CWORD77_; ///< Call back function pointer
+ std::vector<FrameworkunifiedProtocolCallbackHandler> m_vSessionProtocolHanlder;
+ std::vector<UI_32> m_vEventVector;
+ std::vector<FrameworkunifiedProtocolCallbackHandler> m_vSessionEventHandler;
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddProtocol
+ /// Function to add notification
+ ///
+ /// \param[in] f_uiCmdId
+ /// UI_32 - Command id
+ /// \param[in] f_cbFuncPtr
+ /// CbFuncPtr - Callback function pointer
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void AddProtocolHandler(UI_32 f_uiCmdId, CbFuncPtr f_cbFuncPtr);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AttachProtocolwithDispatcher
+ /// API to Register Session 1 of Service A protocols with Dispatcher
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AttachProtocolwithDispatcher(HANDLE f_hApp);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// DetachProtocolwithDispatcher
+ /// API to Un Register Session 1 of Service A protocols with Dispatcher
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DetachProtocolwithDispatcher(HANDLE f_hApp);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AttachEventswithDispatcher
+ /// Function to register events with dispatcher
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AttachEventswithDispatcher(HANDLE f_hApp);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// RegisterEvents
+ /// Function to register events
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterEvents(HANDLE f_hApp); // Function: added by Shyam to overcome
+ /// the naming conflict in registering the event
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AttachEventHandlerswithDispatcher
+ /// API to Register Session 1 of Service A protocols with Dispatcher
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AttachEventHandlerswithDispatcher(HANDLE f_hApp);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// DetachEventHandlerswithDispatcher
+ /// API to Un Register Session 1 of Service A protocols with Dispatcher
+ ///
+ /// \param [in] f_hApp
+ /// HANDLE - Handle to the Framework
+ /// \return status
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DetachEventHandlerswithDispatcher(HANDLE f_hApp);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventHandler
+ /// Function to add event handler
+ ///
+ /// \param[in] f_uiCmdId
+ /// UI_32 - Command id
+ /// \param[in] f_cbFuncPtr
+ /// CbFuncPtr - Callback function pointer
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void AddEventHandler(UI_32 f_uiCmdId, CbFuncPtr f_cbFuncPtr);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// Constructor for CFrameworkunified_CWORD77_Session
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// no preconditions
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Create CFrameworkunified_CWORD77_Session instance and initialize the member parameter(m_hSession, m_hApp,m_hService,\n
+ /// m_uiSessionType)
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunified_CWORD77_Session
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunified_CWORD77_Session();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunified_CWORD77_Session
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// CFrameworkunified_CWORD77_Session is decleared in constructor
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Release CFrameworkunified_CWORD77_Session class instance
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunified_CWORD77_Session
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunified_CWORD77_Session();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// send specific command by session
+ /// \~english @param [in] cmdID
+ /// cmdID - commond id
+ /// \~english @par
+ /// cmdID UI_32
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK or failed
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - GetReqDataFrom_CWORD77_DataPool() failed [eFrameworkunifiedStatusDbRecNotFound]
+ /// - FrameworkunifiedSendMsg() failed
+ /// - if m_hSession is NULL. [eFrameworkunifiedStatusSessionErr]
+ /// \~english @par Detail
+ /// send specified commond by session.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see GetReqDataFrom_CWORD77_DataPool
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ // virtual EFrameworkunifiedStatus HandleSessionMessage(UI_32 cmdID);
+ EFrameworkunifiedStatus HandleSessionMessage(UI_32 cmdID);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// Set Call back function in Session
+ /// \~english @param [in] fptr
+ /// fptr - Pointer to call back function
+ /// \~english @par
+ /// fptr ResponseServiceTo_CWORD77_*
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - set callback into m_ResponseTo_CWORD77_.
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Set Call back function in Session
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetResponseCallback(ResponseServiceTo_CWORD77_ fptr);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// function to Open Session.(pure virtual function)
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle of framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @param [in] f_sServiceName
+ /// f_sServiceName - Service Name
+ /// \~english @par
+ /// f_sServiceName std::string
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus OpenSession(HANDLE f_hApp, std::string f_sServiceName) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// function to close Session.(pure virtual function)
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle of framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// - none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus CloseSession(HANDLE f_hApp) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// Open Session acknowledge.(pure virtual function)
+ /// \~english @param [in] f_hApp
+ /// f_hApp - Handle of framework
+ /// \~english @par
+ /// f_hApp HANDLE*
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// -none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus OpenSessionAcknowledge(HANDLE f_hApp) = 0;
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSessionType
+ /// API to get session type
+ ///
+ /// \return UI_32 - Session type
+ /// EFrameworkunifiedStatus - Success or Error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// API to get session type
+ /// \~english @param none
+ /// \~english @retval UI_32 - Session type
+ /// \~english @par Preconditons
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// API to get session type.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetSessionType();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// API to set session type into class CFrameworkunified_CWORD77_Session object.
+ /// \~english @param[in] sessioType
+ /// const UI_32& - Session type
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// API to set session type into class CFrameworkunified_CWORD77_Session object.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ /// none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetSessionType(const UI_32 &sessioType);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// declear callback funcion into Dispatcher
+ /// \~english @param[in] hApp
+ /// HANDLE - Handle to Application
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// no precondition
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// declear OnResponse() of callback function by calling FrameworkunifiedAttachCallbackToDispatcher()\n
+ /// get decleared protocol ID through GetResponseProtocolArray()\n
+ /// get decleared event ID through GetEventArray() and regist event-sending instance in FrameworkunifiedRegisterEvent
+ /// \~english @par
+ /// cautions in using this API:\n
+ /// -Registrition will fail without msg When Application handle is uncorrect set by parameter\n
+ /// -Registrition process in FrameworkunifiedAttachCallbackToDispatcher() will not commit when
+ /// GetResponseProtocolArray()\n
+ /// or GetEventArray() returns NULL or NULL list
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedRegisterEvent,
+ /// GetResponseProtocolArray, GetEventArray, OnResponse
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void AttachResponseCallbacks(HANDLE hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// unscrible dispatcher callback function
+ /// \~english @param[in] hApp
+ /// HANDLE - Handle to Application
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// no preconditions
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// declear OnResponse() of callback function by calling FrameworkunifiedDetachCallbackFromDispatcher()\n
+ /// get unregistrition protocol ID through GetResponseProtocolArray()\n
+ /// get unregistrition event ID through GetEventArray() and unregist event-sending instance in \n
+ /// FrameworkunifiedUnRegisterEvent()
+ /// \~english @par Detail
+ /// cautions in using this API:\n
+ /// -Unregistrition will fail without msg When Application handle is uncorrect set by parameter\n
+ /// -Unregistrition process in FrameworkunifiedDetachCallbackFromDispatcher() will not commit when
+ /// GetResponseProtocolArray()\n
+ /// or GetEventArray() returns NULL or NULL list
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedUnRegisterEvent,
+ /// GetResponseProtocolArray, GetEventArray
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void DetachResponseCallbacks(HANDLE hApp);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnResponse
+ /// Callback function on receiving response protocol or event specified in the list, returned
+ /// by either \ref GetResponseProtocolArray or \ref GetEventArray
+ ///
+ /// \param [in] hApp
+ /// HANDLE - Handle to framework
+ /// \return None
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunified_CWORD77_Session
+ /// \~english @par Brief
+ /// Callback function on receiving response protocol or event specified in the list, returned
+ /// by either \ref GetResponseProtocolArray or \ref GetEventArray
+ /// \~english @param [in] f_hApp
+ /// HANDLE - Handle of framework
+
+ /// \~english @retval EFrameworkunifiedStatus
+ /// SuceFrameworkunifiedStatusOK or eFrameworkunifiedStatusNullPointer
+ /// \~english @par Preconditions
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - framework handler is invalid handler.[eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Callback function on receiving response protocol or event specified in the list, returned
+ /// by either \ref GetResponseProtocolArray or \ref GetEventArray
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedGetMsgDataOfSize
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnResponse(HANDLE hApp);
+
+ // FIXME: Following set of functions should be pure virtual functions.
+ // But, in order to avoid build errors for HMI__CWORD77_, it is defined as virtual functions only.
+ // Because nobody who is currently deriving off of frameworkunified__CWORD77__session_if.h has these functions implemented.
+ virtual UI_32 const *GetResponseProtocolArray() = 0;
+ virtual UI_32 const GetResponseProtocolArrayLength() = 0;
+ virtual UI_32 const *GetEventArray() = 0;
+ virtual UI_32 const GetEventArrayLength() = 0;
+};
+
+#endif // _FRAMEWORKUNIFIED__CWORD77_SESSION_H_ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_application.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_application.h
new file mode 100755
index 0000000..9d96751
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_application.h
@@ -0,0 +1,376 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief System callbacks that applications should address.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_application.h
+ * @brief \~english This file contains the base api of an application that must be provided.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_APPLICATION_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_APPLICATION_H__
+
+#include <native_service/frameworkunified_types.h>
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup IsNull
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton initialize
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp);
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton WaleUp
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnWakeup(HANDLE hApp); /// << deprecated
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton shutdown
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE hApp); /// << deprecated
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton EShutdown
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE hApp); /// << deprecated
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton start
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp);
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton stop
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOnPreStart
+/// \~english @par Brief
+/// callback of Application Life cycle event
+/// \~english @param [in] hApp
+/// HANDLE - Application Handle
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// Depend on the implementation in the inheriting class
+/// \~english @par Change of internal state
+/// Depend on the implementation in the inheriting class
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// callback of Application Pre start
+/// \~english @par
+/// - include frameworkunified_application.h
+/// - Library libNS_FrameworkUnified.so
+/// - Set compile option for "-DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND" when this API in the each application implements.
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOnPreStop
+/// \~english @par Brief
+/// callback of Application Life cycle event
+/// \~english @param [in] hApp
+/// HANDLE - Application Handle
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// Depend on the implementation in the inheriting class
+/// \~english @par Change of internal state
+/// Depend on the implementation in the inheriting class
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// callback of Application Pre stop
+/// \~english @par
+/// - include frameworkunified_application.h
+/// - Library libNS_FrameworkUnified.so
+/// - Set compile option for "-DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND" when this API in the each application implements.
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOnBackgroundStart
+/// \~english @par Brief
+/// callback of Application Life cycle event
+/// \~english @param [in] hApp
+/// HANDLE - Application Handle
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// Depend on the implementation in the inheriting class
+/// \~english @par Change of internal state
+/// Depend on the implementation in the inheriting class
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// callback of Application Background start
+/// \~english @par
+/// - include frameworkunified_application.h
+/// - Library libNS_FrameworkUnified.so
+/// - Set compile option for "-DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND" when this API in the each application implements.
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOnBackgroundStop
+/// \~english @par Brief
+/// callback of Application Life cycle event
+/// \~english @param [in] hApp
+/// HANDLE - Application Handle
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// Depend on the implementation in the inheriting class
+/// \~english @par Change of internal state
+/// Depend on the implementation in the inheriting class
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// callback of Application Background stop
+/// \~english @par
+/// - include frameworkunified_application.h
+/// - Library libNS_FrameworkUnified.so
+/// - Set compile option for "-DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND" when this API in the each application implements.
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp);
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton reinit
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnReinit(HANDLE hApp);
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton destroy
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp);
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval EFrameworkunifiedStatus depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of applicaiton debugdump
+////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp); // << Used for CCR Debugging
+
+
+/// \~english @par Brief
+/// Base class of application
+/// \~english @param None
+/// \~english @retval PCSTR depends on the implement of derived class
+/// \~english @par Prerequisite
+/// - depends on the implement of derived class
+/// \~english @par Inside state change
+/// - depends on the implement of derived class
+/// \~english @par None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The callback of get applicaiton servcice avaible
+////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetServiceAvailabilityNotification(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOnDummy
+/// \~english @par Brief
+/// dummy callback of Application Life cycle event
+/// \~english @param [in] hApp
+/// HANDLE - Application Handle
+/// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
+/// \~english @par Prerequisite
+/// Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Registered dummy callback when not processing
+/// \~english @par
+/// - include frameworkunified_application.h
+/// - Library libNS_FrameworkUnified.so
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDummy(HANDLE hApp);
+
+#endif /* __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_APPLICATION_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_dispatcher.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_dispatcher.h
new file mode 100755
index 0000000..8aa4572
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_dispatcher.h
@@ -0,0 +1,803 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Application dispatch interface functions
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_dispatcher.h
+ * @brief \~english This file contains the base class of application.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_DISPATCHER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_DISPATCHER_H__
+
+#include <native_service/frameworkunified_framework_types.h>
+// #include <native_service/frameworkunified_sm_hsmframework.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDispatcher
+/// \~english @par Brief
+/// This API creates, initializes the dispatcher and runs mainloop for event handling.
+/// \~english @param [in] cAppName
+/// PCSTR - Pointer to application thread name
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Pointer to default callback functions.
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Function is called when a Dispatcher is created.
+/// */
+/// CbFuncPtr onDestroy; /* Function is called when the Dispatcher is
+/// released. */
+/// CbFuncPtr onStart; /* Function is called when the Dispatcher is started.
+/// */
+/// CbFuncPtr onStop; /* Function is called when the Dispatcher is stopped.
+/// */
+/// CbFuncPtr onPreStart; /* Function is called when the Dispatcher is pre started. */
+/// CbFuncPtr onPreStop; /* Function is called when the Dispatcher is pre stoped. */
+/// CbFuncPtr onBackgroundStart; /* Function is called when the Dispatcher is Background started. */
+/// CbFuncPtr onBackgroundStop; /* Function is called when the Dispatcher is Background stopped. */
+/// CbFuncPtr onDebugDump; /* Function is called when the Dispatcher detects
+/// abnormal state. */
+/// CbFuncPtr createStateMachine; /* Set dummy function that does nothing.
+/// */
+/// CbFuncPtr ssFrameworkInterface; /* Function to connect to SystemManager
+/// */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @par
+/// About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
+/// - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
+/// - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+/// - If application is resident service, link library libSS_SystemIfUnified
+/// (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
+/// - If application is nonresident service, define function that does nothing below.
+/// - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - Pointer to default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusNullPointer]
+/// - One of members in default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
+/// 15byte). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
+/// - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+/// the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl).
+/// [eFrameworkunifiedStatusFail]
+/// - The result of FrameworkunifiedOnInitialization is not eFrameworkunifiedStatusOK. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API creates and initializes the dispatcher.\n
+/// It starts to mainloop that receives request or notification, and runs registered callback to dispatcher.
+/// When success starting mainloop, never return.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedDispatcherWithArguments
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatcher(PCSTR cAppName, const FrameworkunifiedDefaultCallbackHandler *CbHandler);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDispatcherWithArguments
+/// \~english @par Brief
+/// This API creates, initializes the dispatcher and runs loop with command-line options.
+/// \~english @param [in] cAppName
+/// PCSTR - Pointer to application thread name
+/// \~english @param [in] argc
+/// int - Number of command-line options
+/// \~english @param [in] argv
+/// char *[] - Array of pointer to command-line options
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Pointer to default callback functions.
+/// \~english @param [in] cmdLineOptions
+/// CustomCommandLineOptions* - Parser setting of command-line options(Optional. When don't use, set NULL.)
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Function is called when a Dispatcher is created.
+/// */
+/// CbFuncPtr onDestroy; /* Function is called when the Dispatcher is
+/// released. */
+/// CbFuncPtr onStart; /* Function is called when the Dispatcher is started.
+/// */
+/// CbFuncPtr onStop; /* Function is called when the Dispatcher is stopped.
+/// */
+/// CbFuncPtr onPreStart; /* Function is called when the Dispatcher is pre started. */
+/// CbFuncPtr onPreStop; /* Function is called when the Dispatcher is pre stoped. */
+/// CbFuncPtr onBackgroundStart; /* Function is called when the Dispatcher is Background started. */
+/// CbFuncPtr onBackgroundStop; /* Function is called when the Dispatcher is Background stopped. */
+/// CbFuncPtr onDebugDump; /* Function is called when the Dispatcher detects
+/// abnormal state. */
+/// CbFuncPtr createStateMachine; /* Set dummy function that does nothing.
+/// */
+/// CbFuncPtr ssFrameworkInterface; /* Function to connect to SystemManager
+/// */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @par
+/// CustomCommandLineOptions Structure
+/// \~english @code
+/// typedef struct _CustomCommandLineOptions
+/// {
+/// PCSTR cShortOptions; /* Short options list. */
+/// PCHAR cLongOptions; /* Reserved. Set to NULL. */
+/// CbArgumentParser callback; /* Pointer to callback function to parse command-line
+/// options. */
+/// } CustomCommandLineOptions;
+/// @endcode
+/// \~english @par
+/// About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
+/// - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
+/// - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+/// - If application is resident service, link library libSS_SystemIfUnified
+/// (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
+/// - If application is nonresident service, define function that does nothing below.
+/// - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - Pointer to default callback functions specified in the argument (CbHandler) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - One of members in default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
+/// 15byte). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
+/// - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - The result of FrameworkunifiedOnInitialization is not eFrameworkunifiedStatusOK. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API creates and initializes the dispatcher with command-line options.\n
+/// It starts to mainloop that receives request or notification, and runs registered callback to dispatcher.
+/// When success starting mainloop, never return.
+/// Use this API to take over a command-line options to the dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedDispatcher, FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock,
+/// FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatcherWithArguments(PCSTR cAppName, int argc, char *argv[],
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler,
+ CustomCommandLineOptions *cmdLineOptions = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSimpleDispatcher
+/// \~english @par none
+/// Generatings/intializes a Dispatcher and executs main loops for handling events.
+/// \~english @param [in] cAppName
+/// PCSTR - Pointer to the application thread name
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Pointer to a default-defined callback function
+/// \~english @param [in] CbShutdown
+/// CbFuncPtr - Pointer to the callack function o be called when the main loop is exited
+/// \~english @param [in] isChildThread
+/// BOOL - Whether the child thread is a dispatcher (Default:TRUE)
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Callback function to run when creating dispatcher instance */
+/// CbFuncPtr onDestroy; /* Callback function to run when releasing dispatcher instance */
+/// CbFuncPtr onStart; /* Callback function executed when dispatcher starts processing */
+/// CbFuncPtr onStop; /* Callback function to be executed when dispatcher termination is requested */
+/// CbFuncPtr onPreStart; /* Callback function executed when dispatcher requestes activation */
+/// CbFuncPtr onPreStop; /* Callback function to be executed when an-request is made to the dispatcher on board status */
+/// CbFuncPtr onBackgroundStart; /* Callback function executed when dispatcher parking is requested */
+/// CbFuncPtr onBackgroundStop; /* Callback function executed when requesting termination of a dispatcher's parking status */
+/// CbFuncPtr onDebugDump; /* Callback function to be executed when an error is detected */
+/// CbFuncPtr createStateMachine; /* Specify an empty function */
+/// CbFuncPtr ssFrameworkInterface; /* Callback function for connecting to the systemManager */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @par
+/// About setting the default definition callback function (FrameworkunifiedDefaultCallbackHandler)
+/// The FrameworkunifiedDefaultCallbackHandler structure passed as argument CbHandler must be initialized using the FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK macro.
+/// - The application that executes this API must define a function with the following name. (Can also be an functio)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+/// If the applicatio is a resident service, link the library libSS_SystemIfUnified
+/// (which provides the function FrameworkunifiedSSFrameworkInterface that performs connection processin with SystemManager).
+/// - If the applicatio is a nonresident service, define the following names with empy function.
+/// - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifiying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusFail User-specific continuation.
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplicate entry error
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Category Type
+/// \~english @retval eFrameworkunifiedStatusErrOther Shared-memory accesses for sending message for NPP Service fail.
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF If the timers fail,...
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Service does not exist
+/// \~english @par Failed to acquire
+/// -
+/// \~english @par Log output string
+/// - The internal state is not changed.
+/// \~english @par You do not use.
+/// - When the pointer (CbHandler) to the default-definition callback function specified by the arguments is NULL [eFrameworkunifiedStatusNullPointer]
+/// - If any of the member of the default-defined callback-function sruct specified in he arguments is NULL [eFrameworkunifiedStatusInvldParam]
+/// - When the pointer (CbShutdown) to the callback fuction to be called when the main loop specified by the arguments exits is NULL [eFrameworkunifiedStatusFail]
+/// - When the pointer (cAppName) to the threade name of the application specified by the arguments is NULL [eFrameworkunifiedStatusNullPointer]
+/// - When the application name (cAppName) specified in the parameter exceeds 15 byte [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open a message queue (mq_open) [eFrameworkunifiedStatusNullPointer]
+/// - When acquisition (malloc) of the message queue management information area fails, [eFrameworkunifiedStatusNullPointer]
+/// - If the creation (socket, bind, listen) of sockets for error monitoring fails,... [eFrameworkunifiedStatusFail]
+/// - Application handles and callback function cannot be added to Notification lists [eFrameworkunifiedStatusDuplicate]
+/// - When the Notification name specified in the arguments has already been registred i the Dispatcher [eFrameworkunifiedStatusDuplicate]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for the NPP Service.... [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages for sessions for NPP Service [eFrameworkunifiedStatusErrOther]
+/// - Failed to create epoll instances (epoll_create1) [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register Dispatcher message queue descriptor for epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to create file descriptor for receiving events to Dispatcher (eventfd) [eFrameworkunifiedStatusFail]
+/// - Failed to register file descriptor for receiving Dispatcher events to epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to register socket for monitoring Dispatcher error in epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - If FrameworkunifiedOnInitialization of result is not eFrameworkunifiedStatusOK [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Type
+/// Creats or initializes a Dispatcher, receives requests and notifications to the Dispatcher, and starts a main loop that executes the registred callback functions.\n
+/// When the main loop is started normally, this API does not retur until the hread terminates.\n
+/// At thread termination, the callback function specified by the third argument is called, and the processing result is returned.\n
+/// \n
+/// This API can be used for both main and child threads.\n
+/// However, since this API is an API for chid threads created without going through the API of NS framework such as \ref FrameworkunifiedCreateChildThread,
+/// it is recommended to use \ref FrameworkunifiedDispatcherWithArguments or other API to create Dispatcher in the main thread.\n
+/// \~english @par Immediate
+/// Brief
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see
+/// FrameworkunifiedDispatcherWithArguments
+///
+/// \~english @par Brief
+/// Generatings/intializes a Dispatcher and executs main loops for handling events
+/// \~english @param [in] cAppName
+/// PCSTR - Application/ thread name
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Function that primes the dispatch pump. i.e. start function
+/// \~english @param [in] CbShutdown
+/// CbFuncPtr * - Shutdown function. Functions gets called if the dispatcher loop exits.
+/// \~English @param[in] isChildThread
+/// BOOL - Default value is TRUE. TRUE - child thread dispatcher else main thread dispatcher
+/// \~english @retval Never does. Unless any callback function returns eFrameworkunifiedStatusExit
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer
+/// \~english @retval eFrameworkunifiedStatusFail Invalid Parameter
+/// \~english @retval eFrameworkunifiedStatusErrOther Unknown Error
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - cAppName is NULL[eFrameworkunifiedStatusNullPointer]
+/// - Length of cAppName is longer than MAX_NAME_SIZE_APP[eFrameworkunifiedStatusNullPointer]
+/// - NativeService has some issues [eFrameworkunifiedStatusNullPointer]
+/// - When the pointer (CbHandler) to the default-definition callback function specified by the arguments is NULL [eFrameworkunifiedStatusNullPointer]
+/// - If any of the member of the default-defined callback-function sruct specified in he arguments is NULL [eFrameworkunifiedStatusInvldParam]
+/// - When the pointer (CbShutdown) to the callback fuction to be called when the main loop specified by the arguments exits is NULL [eFrameworkunifiedStatusFail]
+/// - Failed to open a message queue (mq_open) [eFrameworkunifiedStatusNullPointer]
+/// - When acquisition (malloc) of the message queue management information area fails, [eFrameworkunifiedStatusNullPointer]
+/// - If the creation (socket, bind, listen) of sockets for error monitoring fails,... [eFrameworkunifiedStatusFail]
+/// - Application handles and callback function cannot be added to Notification lists [eFrameworkunifiedStatusDuplicate]
+/// - When the Notification name specified in the arguments has already been registred i the Dispatcher [eFrameworkunifiedStatusDuplicate]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for the NPP Service.... [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// - When an interrupt by a system call (signal) occurs while sending Service session-specific messages. [eFrameworkunifiedStatusErrOther]
+/// - Failed to create epoll instances (epoll_create1) [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register Dispatcher message queue descriptor for epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to create file descriptor for receiving events to Dispatcher (eventfd) [eFrameworkunifiedStatusFail]
+/// - Failed to register file descriptor for receiving Dispatcher events to epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to register socket for monitoring Dispatcher error in epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - If FrameworkunifiedOnInitialization of result is not eFrameworkunifiedStatusOK [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// Creates, initializes and runs the dispatcher. This dispatcher function can be used with child thread or main
+/// thread. <BR>
+/// But, recommended to use for child thread. For main thread use \ref FrameworkunifiedDispatcherWithArguments<BR>
+/// Intention to provide this API is for child threads created from dynamically loaded plugin, where thread wants
+/// to <BR>
+/// subscribe to PASA notification, attach callbacks. This can be done in the start function specified with this
+/// API.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedDispatcherWithArguments
+/// \~english @todo not enough inforamtion need readon why this API is for child thread.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSimpleDispatcher(PCSTR cAppName, const FrameworkunifiedDefaultCallbackHandler *CbHandler, CbFuncPtr CbShutdown,
+ BOOL isChildThread = TRUE);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateDispatcherWithoutLoop
+/// \~english @par Brief
+/// This API creates and initializes the dispatcher with command-line options.
+/// \~english @param [in] cAppName
+/// PCSTR - Pointer to application thread name
+/// \~english @param [out] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [in] argc
+/// int - Number of command-line options
+/// \~english @param [in] argv
+/// char *[] - Array of pointer to command-line options
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Pointer to default callback functions.
+/// \~english @param [in] bIsConnectSM
+/// BOOL - whether or not connect with System Manager(TRUE/FALSE)
+/// \~english @param [in] cmdLineOptions
+/// CustomCommandLineOptions* - Parser setting of command-line options(Optional. When don't use, set NULL.)
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Function is called when a Dispatcher is created.
+/// */
+/// CbFuncPtr onDestroy; /* Function is called when the Dispatcher is
+/// released. */
+/// CbFuncPtr onStart; /* Function is called when the Dispatcher is started.
+/// */
+/// CbFuncPtr onStop; /* Function is called when the Dispatcher is stopped.
+/// */
+/// CbFuncPtr onPreStart; /* Function is called when the Dispatcher is pre started. */
+/// CbFuncPtr onPreStop; /* Function is called when the Dispatcher is pre stoped. */
+/// CbFuncPtr onBackgroundStart; /* Function is called when the Dispatcher is Background started. */
+/// CbFuncPtr onBackgroundStop; /* Function is called when the Dispatcher is Background stopped. */
+/// CbFuncPtr onDebugDump; /* Function is called when the Dispatcher detects
+/// abnormal state. */
+/// CbFuncPtr createStateMachine; /* Set dummy function that does nothing.
+/// */
+/// CbFuncPtr ssFrameworkInterface; /* Function to connect to SystemManager
+/// */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @par
+/// CustomCommandLineOptions Structure
+/// \~english @code
+/// typedef struct _CustomCommandLineOptions
+/// {
+/// PCSTR cShortOptions; /* Short options list. */
+/// PCHAR cLongOptions; /* Reserved. Set to NULL. */
+/// CbArgumentParser callback; /* Pointer to callback function to parse command-line
+/// options. */
+/// } CustomCommandLineOptions;
+/// @endcode
+/// \~english @par
+/// About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
+/// - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
+/// - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+/// - If application is resident service, link library libSS_SystemIfUnified
+/// (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
+/// - If application is nonresident service, define function that does nothing below.
+/// - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - Pointer to default callback functions specified in the argument (CbHandler) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - One of members in default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
+/// 15byte). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
+/// - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API creates and initializes the dispatcher with command-line options without running main loop.\n
+/// Use this, if application control some contexts(include NS framework).\n
+/// when the dispatcher generated by this API, Application need to handle event.\n
+/// Use FrameworkunifiedGetDispatcherFD and FrameworkunifiedDispatchProcessWithoutLoop for event handling.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDestroyDispatcherWithoutLoop, FrameworkunifiedGetDispatcherFD
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcherWithoutLoop(PCSTR cAppName, HANDLE &hApp, int argc, char *argv[], // NOLINT (readability/nolint)
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler,
+ BOOL bIsConnectSM, CustomCommandLineOptions *cmdLineOptions = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDispatchProcessWithoutLoop
+/// \~english @par Brief
+/// Receive request or notification, and run registered callback to dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - If the waiting message (epoll_wait) , was terminated with an error other than interrupt (EINTR)
+/// [eFrameworkunifiedStatusFail]
+/// - Service name that has been set in the received message exceeds the 20byte. [eFrameworkunifiedStatusFail]
+/// - Message queue in the HANDLE specified in the argument (hApp) is not for receive. [eFrameworkunifiedStatusFail]
+/// - Message queue for receive is empty. [eFrameworkunifiedStatusFail]
+/// - File descriptor of message queue for receive is invalid. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) has occurred during the message receiving. [eFrameworkunifiedStatusFail]
+/// - Size of the receive buffer of the message is illegal. [eFrameworkunifiedStatusFail]
+/// - Any errors occur during the message receiving. [eFrameworkunifiedStatusFail]
+/// - Service name in the received message is not appropriate(The name is NULL, Length is 0byte) [eFrameworkunifiedStatusFail]
+/// - The received message data length is more than data length in the received message header. [eFrameworkunifiedStatusFail]
+/// - The received message is not appropriate. [eFrameworkunifiedStatusFail]
+/// - Shared memory ID for receiving message is invalid. [eFrameworkunifiedStatusFail]
+/// - Failed to access to shared memory for receive message. [eFrameworkunifiedStatusFail]
+/// - Data size of shared memory for receiving message is more than destination buffer size. [eFrameworkunifiedStatusFail]
+/// - Message queue of the processing result destination is invalid. [eFrameworkunifiedStatusFail]
+/// - The transmission data that is the received request processing result is NULL. [eFrameworkunifiedStatusFail]
+/// - Service name of the processing result destination is not appropriate(The name is NULL, more than 20byte).
+/// [eFrameworkunifiedStatusFail]
+/// - Failed to access to shared memory for send message. [eFrameworkunifiedStatusFail]
+/// - Message queue type is not for sending. [eFrameworkunifiedStatusFail]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusFail]
+/// - File descriptor of message queue for sending is invalid. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) has occurred during the message sending. [eFrameworkunifiedStatusFail]
+/// - Size of the send buffer of the message is illegal. [eFrameworkunifiedStatusFail]
+/// - Any errors occur during the message sending. [eFrameworkunifiedStatusFail]
+/// - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusFail]
+/// - Failed to get memory buffer for message receiving. [eFrameworkunifiedStatusFail]
+/// - Failed to read data from file descriptor that is set from application. [eFrameworkunifiedStatusFail]
+/// - Failed to run callback that is set from application. [eFrameworkunifiedStatusFail]
+/// - The callback that is set from application returned error. [eFrameworkunifiedStatusFail]
+/// - I could not found callback function associated with file descriptor that is set from application.
+/// [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// If the Dispatcher was created by FrameworkunifiedCreateDispatcherWithoutLoop, \n
+/// you use this API to receive request or notification, and run registered callback to dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDestroyDispatcherWithoutLoop, FrameworkunifiedGetDispatcherFD
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDispatchProcessWithoutLoop(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDestroyDispatcherWithoutLoop
+/// \~english @par Brief
+/// This API destroy the dispatcher created by FrameworkunifiedCreateDispatcherWithoutLoop.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to release memory referenced by HANDLE specified in the argument (hApp). [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API destroy the dispatcher created by FrameworkunifiedCreateDispatcherWithoutLoop.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+/// FrameworkunifiedCreateDispatcherWithoutLoop
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDestroyDispatcherWithoutLoop(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetDispatcherFD
+/// \~english @par Brief
+/// Get the Dispatcher file descriptor corresponding to the given application handle.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [out] efd
+/// int* - Dispatcher file descriptor
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - The argument efd is NULL. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API gets the Dispatcher file descriptor corresponding to the given application handle.\n
+/// The application can use file descriptor to detect event of NS Framework.\n
+/// When events detected, run FrameworkunifiedDispatchProcessWithoutLoop to handling events.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see FrameworkunifiedDispatchProcessWithoutLoop
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetDispatcherFD(HANDLE hApp, SI_32 *efd); // Replace int with SI_32
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetDefaultCbHandler
+/// \~english @par Brief
+/// Get default callback handler table
+/// \~english @param [out] CbHandler
+/// FrameworkunifiedGetDefaultCbHandler * - Default callback handler table pointer
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Function is called when a Dispatcher is created.
+/// */
+/// CbFuncPtr onDestroy; /* Function is called when the Dispatcher is
+/// released. */
+/// CbFuncPtr onStart; /* Function is called when the Dispatcher is started.
+/// */
+/// CbFuncPtr onStop; /* Function is called when the Dispatcher is stopped.
+/// */
+/// CbFuncPtr onPreStart; /* Function is called when the Dispatcher is pre started. */
+/// CbFuncPtr onPreStop; /* Function is called when the Dispatcher is pre stoped. */
+/// CbFuncPtr onBackgroundStart; /* Function is called when the Dispatcher is Background started. */
+/// CbFuncPtr onBackgroundStop; /* Function is called when the Dispatcher is Background stopped. */
+/// CbFuncPtr onDebugDump; /* Function is called when the Dispatcher detects
+/// abnormal state. */
+/// CbFuncPtr createStateMachine; /* Set dummy function that does nothing.
+/// */
+/// CbFuncPtr ssFrameworkInterface; /* Function to connect to SystemManager
+/// */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer to default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// Gets the default defined callback fuction set by FrameworkunifiedDispatcherWithArguments, FrameworkunifiedSimpleDispatcher, and FrameworkunifiedCreateDispatcherWithoutLoop.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see FrameworkunifiedDispatchProcessWithoutLoop
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetDefaultCbHandler(FrameworkunifiedDefaultCallbackHandler *CbHandler);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachLostSessionCallbackToDispatcher
+/// \~english Register
+/// abnormal session disconnect callback
+/// \~english @param[in] hApp
+/// HANDLE - Application framework handle
+/// \~english @param[in] fpLostSession
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
+/// done.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+/// \~english @par Preconditions
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
+/// done.
+/// \~english @par Change of internal status
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - hApp is NULL [eFrameworkunifiedStatusInvldParam]
+/// - hApp is invalid [eFrameworkunifiedStatusInvldParam]
+/// - fpLostSession is NULL [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Registers a callback fuction to be called when a session disconnection occurs in the specified application handle.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDispatcherWithArguments, FrameworkunifiedSimpleDispatcher
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachLostSessionCallbackToDispatcher(HANDLE hApp, CbFuncPtr fpLostSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetLostSessionData
+/// \~english @par Brief
+/// Get last lost session data
+/// \~english @param [in] hApp
+/// HANDLE - Application framework handle
+/// \~english @param [out] pServiceName
+/// PSTR - Disconnect service name
+/// \~english @param [out] puiSessionId
+/// PUI_32 - Disconnect session ID
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+/// \~english @retval eFrameworkunifiedStatusAccessError Error when accessing resource
+/// \~english @par Preconditions
+/// - Generation/Initialization of Dispatcher for the Application
+/// by FrameworkunifiedCreateDispatcherWithoutLoop has been done.
+/// \~english @par Change of internal status
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - hApp is invalid [eFrameworkunifiedStatusInvldParam]
+/// - pServiceName is NULL [eFrameworkunifiedStatusInvldParam]
+/// - puiSessionId is NULL [eFrameworkunifiedStatusInvldParam]
+/// - Lost session queue is empty [eFrameworkunifiedStatusAccessError]
+/// \~english @par Detail
+/// Gets the service name and session ID disconnected from the hadle for the specified application.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDispatcherWithArguments, FrameworkunifiedSimpleDispatcher
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetLostSessionData(HANDLE hApp, PSTR pServiceName, PUI_32 puiSessionId);
+
+#endif /* __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_DISPATCHER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_error.hpp b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_error.hpp
new file mode 100755
index 0000000..8c8e3f5
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_error.hpp
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief This file provides framework's API which are used by system services.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_framework_error.hpp
+ * @brief \~english This file provides framework's API which are used by system services.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <stdexcept>
+
+namespace frameworkunified {
+namespace framework {
+namespace error {
+
+class error : public std::runtime_error {
+ public:
+ explicit error(EFrameworkunifiedStatus error, PCSTR errorMsg);
+ private:
+ const EFrameworkunifiedStatus m_error;
+};
+
+}
+}
+}
+
+#define DEFINE_FRAMEWORKUNIFIED_ERROR( name ) \
+class name : public framework_unified::framework::error::error \
+{ \
+public: \
+ explicit name ( EFrameworkunifiedStatus error, PCSTR str ) \
+ : framework_unified::framework::error::error ( error, str ) \
+ {} \
+}
+
+#endif // __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_ERROR_H__ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_if.h
new file mode 100755
index 0000000..44ef854
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_if.h
@@ -0,0 +1,6007 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+// tag_NSFramework
+// Application framework's interface header file.
+//
+// The interfaces exposed here are
+// - Application framework Dispatcher
+// - attaching/detaching service protocol callbacks
+// - attaching/detaching notification callbacks
+// - Message Center
+// - send messaging to services/clients
+// - read the incoming message information
+// - Service Directory
+// - open and close a service
+// - register/unregister a service
+// - Notification & Persistence Service
+// - register/unregister and publish a notification
+// - subscribe/unsubscribe to a notification
+//
+/////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_framework_if.h
+ * @brief \~english Application framework's interface header file.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup Native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/ns_shared_mem_if.h>
+#include <native_service/ns_np_service.h>
+///////////////////////////////////
+// To avoid integration build break: removing dependency on SM framework.
+// #include <native_service/frameworkunified_sm_hsmframework.h>
+
+// QUICK FIX Files added here, which was included by frameworkunified_sm_hsmframework.h
+// if we simply comment frameworkunified_sm_hsmframework.h inclusion, then other modules build may
+// break, if they are not including below files explicitly and was relying of frameworkunified_framework_if.h.
+#include <native_service/ns_timer_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_logger_if.h>
+#include <map>
+#include <string>
+#include <vector>
+///////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Dispatcher functions
+////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachCallbacksToDispatcher
+/// \~english @par Brief
+/// API to register multiple Callback-informations to the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to the service name
+/// \~english @param [in] pMsgHandler
+/// FrameworkunifiedProtocolCallbackHandler* - Pointer to the Message Handler structure
+/// \~english @param [in] uiHandlerCount
+/// UI_32 - Message Handler count(1 to 4294967295)
+/// \~english @param [in] hSession
+/// HANDLE - Session handle (Default:NULL)
+/// \~english @par
+/// FrameworkunifiedProtocolCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedProtocolCallbackHandler
+/// {
+/// /* Command ID/request ID/approval ID of protocol on the service */
+/// UI_32 iCmd;
+/// /* Pointer to Callback function that would be called on receiving iCmd from pServiceName. */
+/// CbFuncPtr callBack;
+/// }FrameworkunifiedProtocolCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(pServiceName) is NULL to the service name specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Message Handler number specified in the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// - NULL Callback function pointer of the Message Handler structure specified by the argument.
+/// [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Register multiple Callback-informations(iCmd,CbFuncPtr) of the service that has been specified by the argument
+/// \n
+/// to the Dispatcher.\n
+/// Thus, if the iCmd is requested from the service, so the appropriate Callback function is called. \n
+/// When multiple registration, if an error occurs in the second and subsequent, becomes effective only \n
+/// information that has been registered so far. \n
+/// For number of upper limit of the registration possible message handler, depending on \n
+/// the securable size as the area of the message handler structure. Therefore, note to ensure \n
+/// the size of the area of the message handler structure at the call side of API, and define \n
+/// the number of message handler.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the handle (hSession) for the session specified by the arguments is not appropriate (disabled),
+/// the system assumes that the session ID = MAX_SESSION_ID_VAL(0xFFFF) is specified.\n
+/// - It is not possible to register more than one callback with the same command ID (iCmd) for the same service/session ID,
+/// and the callback function will win.
+/// - Operatio is not guaranteed if the number of elements of the array indicated by the address of the pointer (pMsgHandler)
+/// to the message handler structure does not match the number of arrays specified by the number of
+/// party-specified message hadlers (uiHandlerCount).
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbacksToDispatcher(HANDLE hApp, PCSTR pServiceName,
+ const FrameworkunifiedProtocolCallbackHandler *pMsgHandler,
+ UI_32 uiHandlerCount, HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachCallbackToDispatcher
+/// \~english @par Brief
+/// API to register a Callback-information to the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to the service name
+/// \~english @param [in] iCmd
+/// UI_32 - Command ID/request ID/approval ID of protocol on the service
+/// \~english @param [in] fpOnCmd
+/// CbFuncPtr - Pointer to Callback function that would be called on receiving iCmd from pServiceName.
+/// \~english @param [in] hSession
+/// HANDLE - Session handle (Default:NULL)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(pServiceName) is NULL to the service name specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Pointer (fpOnCmd) is NULL to the Callback function specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Register a Callback-information(iCmd,CbFuncPtr) of the service that has been specified by the argument \n
+/// to the Dispatcher.\n
+/// Thus, if the iCmd is requested from the service, so the appropriate Callback function is called.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the handle (hSession) for the session specified by the arguments is not appropriate (disabled),
+/// the system assumes that the session ID = MAX_SESSION_ID_VAL(0xFFFF) is specified.
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbackToDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, CbFuncPtr fpOnCmd,
+ HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachCallbacksToDispatcherWithFd
+/// \~english @par Brief
+/// API to register multiple Callback and file descriptor set to the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] handlers
+/// FrameworkunifiedFdProtocolCallbackHandler* - Pointer to the Message Handler structure to be registered
+/// \~english @param [in] handlerCount
+/// UI_32 - Message Handler Count(1 to 4294967295)
+/// \~english @par
+/// FrameworkunifiedFdProtocolCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedFdProtocolCallbackHandler
+/// {
+/// int fd; /* File descriptor for message waiting control */
+/// CbFuncPtr callBack; /* Pointer to Callback function */
+/// }FrameworkunifiedFdProtocolCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer (handlers) to the Message Handler structure of the registration object specified in the argument is
+/// NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Message Handler number of registered specified by the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor in the Message Handler structure(FrameworkunifiedFdProtocolCallbackHandler) specified in the argument is
+/// incorrect(If fd is less than or equal to 0). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(fpOnCmd) to the Callback function in the Message Handler structure(FrameworkunifiedFdProtocolCallbackHandler)
+/// specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor specified in the argument is incorrect(If fd is less than or equal to 0).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Pointer (fpOnCmd) is NULL to the Callback function specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Monitoring file descriptor for epoll managed by the HANDLE(hApp) specified in the argument is not
+/// appropriate. [eFrameworkunifiedStatusFail]
+/// - File descriptor in the Message Handler structure(FrameworkunifiedFdProtocolCallbackHandler) specified in the argument is
+/// already registered to the monitoring control(epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - It failed to add the file descriptor of the message waiting control to the monitoring of epoll_ctl().
+/// [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Register multiple callbacks that link to file descriptor that has been specified by the argument to
+/// the Dispatcher.\n
+/// For epoll_ctl() of Dispatcher, add multiple file descriptor for the specified message waiting control \n
+/// by the argument.\n
+/// Thus, for the file descriptor registered in the message waiting control, when receiving a message, \n
+/// so the appropriate Callback function is called. \n
+/// When multiple registration, if an error occurs in the second and subsequent, becomes effective only \n
+/// information that has been registered so far. \n
+/// For number of upper limit of the registration possible message handler, depending on \n
+/// the securable size as the area of the message handler structure. Therefore, note to ensure \n
+/// the size of the area of the message handler structure at the call side of API, and define \n
+/// the number of message handler.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - The operation cannot be guaranteed if the number of elements of the array entity indicated by the address of the pointer (handlers)
+/// to the message handler structure to be registered does not match the number of arrays specified in the number of message handlers o be registered (handlerCount).\n
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcherWithFd, FrameworkunifiedDetachCallbackFromDispatcherWithFd,
+/// FrameworkunifiedDetachCallbacksFromDispatcherWithFd
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbacksToDispatcherWithFd(HANDLE hApp, const FrameworkunifiedFdProtocolCallbackHandler *handlers,
+ UI_32 handlerCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachCallbackToDispatcherWithFd
+/// \~english @par Brief
+/// API to register a callback that link to a single file descriptor to the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] fd
+/// int - File descriptor for message waiting control
+/// \~english @param [in] fpOnCmd
+/// CbFuncPtr - Pointer to Callback function
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor specified in the argument is incorrect(If fd is less than or equal to 0).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Pointer (fpOnCmd) is NULL to the Callback function specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Monitoring file descriptor for epoll managed by the HANDLE(hApp) specified in the argument is not
+/// appropriate. [eFrameworkunifiedStatusFail]
+/// - File descriptor(fd) specified in the argument is already registered to the monitoring control(epoll_ctl).
+/// [eFrameworkunifiedStatusFail]
+/// - It failed to add the file descriptor(fd) of the message waiting control to the monitoring of epoll_ctl().
+/// [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Register a callback that link to a file descriptor that has been specified by the argument to
+/// the Dispatcher.\n
+/// For epoll_ctl() of Dispatcher, add a file descriptor(fd) for the specified message waiting control \n
+/// by the argument.\n
+/// Thus, for the file descriptor registered in the message waiting control, when receiving a message, \n
+/// so the appropriate Callback function is called.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedDetachCallbackFromDispatcherWithFd,
+/// FrameworkunifiedDetachCallbacksFromDispatcherWithFd
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachCallbackToDispatcherWithFd(HANDLE hApp, int fd, CbFuncPtr fpOnCmd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachParentCallbacksToDispatcher
+/// \~english @par Brief
+/// API to register multiple callback information for the parent thread to the Dispatcher.
+/// \~english @param [in] hChildApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pMsgHandler
+/// FrameworkunifiedProtocolCallbackHandler* - Pointer to the Message Handler structure
+/// \~english @param [in] uiHandlerCount
+/// UI_32 - Message Handler count(1 to 4294967295)
+/// \~english @par
+/// FrameworkunifiedProtocolCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedProtocolCallbackHandler
+/// {
+/// /* Command ID/request ID/approval ID of protocol on the service */
+/// UI_32 iCmd;
+/// /* Pointer to Callback function that would be called on receiving iCmd from pServiceName. */
+/// CbFuncPtr callBack;
+/// }FrameworkunifiedProtocolCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE(hApp) specified in the argument is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Parent service name in the HANDLE(hApp) specified in the argument is NULL . [eFrameworkunifiedStatusInvldParam]
+/// - Message Handler number specified in the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// - NULL Callback function pointer of the Message Handler structure specified by the argument.
+/// [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Register multiple Callback-informations(iCmd,CbFuncPtr) to the Dispatcher to process \n
+/// the message from the parent thread. \n
+/// Thus, if the iCmd is requested from the parent service(application), so the appropriate \n
+/// Callback function is called. \n
+/// When multiple registration, if an error occurs in the second and subsequent, becomes \n
+/// effective only information that has been registered so far.\n
+/// For number of upper limit of the registration possible message handler, depending on \n
+/// the securable size as the area of the message handler structure. Therefore, note to ensure \n
+/// the size of the area of the message handler structure at the call side of API, and define \n
+/// the number of message handler.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation is not guaranteed if the number of elements of the array indicated by the address of the pointer (pMsgHandler)
+/// to the message handler structure does not match the number of arrays specified by the number of
+/// party-specified message hadlers (uiHandlerCount).
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachParentCallbacksToDispatcher(HANDLE hChildApp, const FrameworkunifiedProtocolCallbackHandler *pMsgHandler,
+ UI_32 uiHandlerCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachCallbacksFromDispatcher
+/// \~english @par Brief
+/// API to cancel multiple Callback-informations from the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to the service name
+/// \~english @param [in] puiCmdArray
+/// PUI_32 - Pointer to Command ID/request ID/approval ID of protocol on the service
+/// \~english @param [in] uiCommandCount
+/// UI_32 - Cancel handler count
+/// \~english @param [in] hSession
+/// HANDLE - Session handle (Default:NULL)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(pServiceName) is NULL to the service name specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(puiCmdArray) to cancel target ID specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - The number(uiCommandCount) of handlers to cancel specified by the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// - Specified service (ServiceName) in the argument is not present. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel a Callback-information(iCmd,CbFuncPtr) of the service that has been specified by the argument \n
+/// from the Dispatcher.\n
+/// Thus, if the iCmd is requested from the service, so the appropriate Callback function is not called. \n
+/// If you have already specified the iCmd of revocation has been subject, to return the eFrameworkunifiedStatusOK.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the iCmad to be canceled is specified, the eFrameworkunifiedStatusOK is returned.
+/// - Event if an error occurs during deletion of two or more iCmd, the subsequent iCmd is deleted.
+/// - If a iCmd larger than the iCmd array is specified eFrameworkunifiedStatusOK is returned and all iCmd is deleted.\n
+/// - If the hade (hSession) for the session specified by the arguments is not appropriate (disabled),
+/// the system assumes that the session ID = MAX_SESSION_ID_VAL(0xFFFF) is specified.\n
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedDetachCallbackFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbacksFromDispatcher(HANDLE hApp, PCSTR pServiceName, const PUI_32 puiCmdArray,
+ UI_32 uiCommandCount, HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachCallbackFromDispatcher
+/// \~english @par Brief
+/// API to cancel a Callback-information from the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to the service name
+/// \~english @param [in] iCmd
+/// UI_32 - Command ID/request ID/approval ID of protocol on the service
+/// \~english @param [in] hSession
+/// HANDLE - Session handle (Default:NULL)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(pServiceName) is NULL to the service name specified in the argument. [eFrameworkunifiedStatusInvldParam]
+/// - Specified service (ServiceName) in the argument is not present. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel a Callback-information(iCmd,CbFuncPtr) of the service that has been specified by the argument \n
+/// from the Dispatcher.\n
+/// Thus, if the iCmd is requested from the service, so the appropriate Callback function is not called. \n
+/// If you have already specified the cancellation has been the subject or unregistered iCmd, to return \n
+/// the eFrameworkunifiedStatusOK.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the handle (hSession) for the session specified by the arguments is not appropriate (disabled),
+/// the system assumes that the session ID = MAX_SESSION_ID_VAL(0xFFFF) is specified.\n
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbackFromDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachCallbacksFromDispatcherWithFd
+/// \~english @par Brief
+/// API to cancel multiple Callback and file descriptor set from the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] fdArray
+/// int* - Pointer to cancel the target file descriptor array
+/// \~english @param [in] handlerCount
+/// UI_32 - Handler count of cancellation
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(fdArray) is NULL to cancel the target file descriptor array specified in the argument.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Handler count(handlerCount) of canceled specified by the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor of the file descriptor in the array(fdArray) specified by the argument is incorrect(If fd is
+/// less than or equal to 0). [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor in the file descriptor array(fdArray) specified in the argument is already deleted from the
+/// management table, and can not search. [eFrameworkunifiedStatusFail]
+/// - There is no file descriptor management table of the specified HANDLE(hApp) in argument. [eFrameworkunifiedStatusFail]
+/// - Monitoring file descriptor for epoll managed by the HANDLE(hApp) specified in the argument is not
+/// appropriate. [eFrameworkunifiedStatusFail]
+/// - It failed to delete the file descriptor(fd) of the message waiting control from the monitoring of
+/// epoll_ctl(). [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel Callback and file descriptor set that has been specified by the argument from the Dispatcher.\n
+/// For epoll_ctl() of Dispatcher, delete multiple file descriptor for the specified message waiting control \n
+/// by the argument.\n
+/// Thus, for the file descriptor became cancellation target, when receiving the message, the appropriate \n
+/// Callback function is not called.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation cannot be guaranteed if the number of elements of the array specified by the address of the pointer
+/// to the file descriptor array to be canceled (fdArray) does not match the number of arrays specified by the number of
+/// file descriptors to be canceled (uiCommandCount).
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackFromDispatcherWithFd,
+/// FrameworkunifiedDetachCallbackFromDispatcherWithFd
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbacksFromDispatcherWithFd(HANDLE hApp, const int *fdArray, UI_32 uiCommandCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachCallbackFromDispatcherWithFd
+/// \~english @par Brief
+/// API to cancel a Callback and file descriptor from the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] fd
+/// int - Cancel the target file descriptor
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE(hApp) specified in the argument is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor(fd) specified in the argument is incorrect(If fd is less than or equal to 0).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - File descriptor specified in the argument is already deleted from the management table, and can not search.
+/// [eFrameworkunifiedStatusFail]
+/// - There is no file descriptor management table of the specified HANDLE(hApp) in argument. [eFrameworkunifiedStatusFail]
+/// - Monitoring file descriptor for epoll managed by the HANDLE(hApp) specified in the argument is not
+/// appropriate. [eFrameworkunifiedStatusFail]
+/// - It failed to delete the file descriptor(fd) of the message waiting control from the monitoring of
+/// epoll_ctl(). [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel a Callback and file descriptor that has been specified by the argument from the Dispatcher.\n
+/// For epoll_ctl() of Dispatcher, delete a file descriptor(fd) for the specified message waiting control \n
+/// by the argument.\n
+/// Thus, for the file descriptor became cancellation target, when receiving the message, the appropriate \n
+/// Callback function is not called.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackFromDispatcherWithFd,
+/// FrameworkunifiedDetachCallbacksFromDispatcherWithFd
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachCallbackFromDispatcherWithFd(HANDLE hApp, int fd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachParentCallbacksFromDispatcher
+/// \~english @par Brief
+/// API to cancel the multiple of Callback information for the parent thread from Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] puiCmdArray
+/// PUI_32 - Pointer to an array of command/request on the service protocol
+/// \~english @param [in] uiCommandCount
+/// UI_32 - Handler count of cancellation
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE(hApp) specified in the argument is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer(puiCmdArray) to an array of command/request that you specified in the argument is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Handler count(uiCommandCount) of canceled specified by the argument is 0. [eFrameworkunifiedStatusInvldParam]
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Parent service name in the HANDLE(hApp) specified in the argument is NULL . [eFrameworkunifiedStatusInvldParam]
+/// - There is no parent service of the target in the HANDLE(hApp) specified in the argument. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel multiple Callback-informations(iCmd,CbFuncPtr) from the Dispatcher to process \n
+/// the message from the parent thread. \n
+/// Thus, if iCmd has been requested from the parent service (application), the corresponding \n
+/// Callback function is no longer referred to. \n
+/// If you have already specified the iCmd of revocation has been subject, to return the eFrameworkunifiedStatusOK.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation cannot be guaranteed if the number of elements of the array specified by the address of the pointer (puiCmdArray)
+/// to the array of commands/requests on the service protocol does not match the number of arrays specified by the number of hadles to cancel (uiCommandCount).
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedAttachParentCallbacksToDispatcher, FrameworkunifiedDetachParentCallbacksFromDispatcher,
+/// FrameworkunifiedDetachServiceFromDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachParentCallbacksFromDispatcher(HANDLE hApp, const PUI_32 puiCmdArray, UI_32 uiCommandCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachServiceFromDispatcher
+/// \~english @par Brief
+/// Disconnect the service from Dispatcher, and API to cancel all the associated callbacks.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to the service name
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE(hApp) specified in the argument is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Pointer (pServiceName) to the service name specified in the argument is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Information corresponding to the service name(pServiceName) specified in the argument is not registered in
+/// Dispatcher. [eFrameworkunifiedStatusFail]
+/// - Callback information(Event information) of the service name(pServiceName) specified in the argument is not
+/// registered. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Cancel the entry of service information from Dispatcher, and cancel all callback \n
+/// information(event information) related to the service.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Service registration available/API processing when an event is registered:delete service, delete event, return eFrameworkunifiedStatusOK
+/// - Service registration available/API processing when an event is registered:delete service, return eFrameworkunifiedStatusOK
+/// - Service registration available/API processing when an event is registered:delete event, return eFrameworkunifiedStatusOK
+/// - Service registration available/API processing when an event is registered:nothing, return eFrameworkunifiedStatusFail
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedAttachParentCallbacksToDispatcher
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachServiceFromDispatcher(HANDLE hApp, PCSTR pServiceName);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSubscribeNotificationsWithCallback
+/// \~english @par Brief
+/// API to send a message to the notification service in order to register multiple Notification of list format.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pNtfyHandler
+/// FrameworkunifiedNotificationCallbackHandler - Pointer to a structure of the Notification Handler
+/// \~english @param [in] uiHandlerCount
+/// UI_32 - Notification Handler number
+/// \~english @par
+/// FrameworkunifiedNotificationCallbackHandler Structure
+/// \~english @code
+/// #define MAX_STRING_SIZE_NOTIFICATION 64
+/// typedef struct _FrameworkunifiedNotificationCallbackHandler
+/// {
+/// CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION]; /* Notification Name */
+/// CbFuncPtr callBack; /* Callback function pointer */
+/// }FrameworkunifiedNotificationCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded the maximum number of
+/// Notification. [eFrameworkunifiedStatusFail]
+/// - The acquisition of the buffer for storing a plurality of information of Notification Handler specified by
+/// the argument has failed. [eFrameworkunifiedStatusInvldParam]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// The Callback information of multiple Notification upon receipt that is specified in the form of a list, \n
+/// set to the notification service (NS_NPPService). \n
+/// In addition, collectively set the Callback information at the time of multiple Notification received that \n
+/// have been specified in the list format to Dispatcher.\n
+/// When the notification service receives the public message of the Notification, it sends a NPS_NOTIFY_EV_REQ \n
+/// message to the client that has registered the Notification. The client having received the NPS_NOTIFY_EV_REQ
+/// \n
+/// message, based on the Callback information registered in the Dispatcher, call a Callback corresponding to the
+/// \n
+/// Notification.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation is not guaranteed if the number of elemets of the array entity indicated by the address of the pointer (pNtfyHandler)
+/// to the Notification Handler structure does not match the number of arrays specified by the Notification Handler number (uiHandlerCount).
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationsWithCallback(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pNtfyHandler,
+ UI_32 uiHandlerCount);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSubscribeNotificationWithCallback
+/// \~english @par Brief
+/// API to set the Callback information at the time of Notification received Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @param [in] pNotification
+/// PCSTR - Notification String.
+/// \param [in] fpOnCmd
+/// CbFuncPtr - Callback function that will be called on receiving pNotification.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNotification) is NULL to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - CbFuncPtr specified in the argument (fpOnCmd) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Can not add HANDLE specified in the argument (hApp) and CbFuncPtr specified in the argument (fpOnCmd) to
+/// notification list [eFrameworkunifiedStatusDuplicate]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Notification name specified by the argument has already been registered in the Dispatcher.
+/// [eFrameworkunifiedStatusDuplicate]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// The Callback information at the time of Notification received that has been specified by the argument, \n
+/// set in the notification service (NS_NPPService).\n
+/// Also, it sets the Callback information at the time of Notification received that has been specified by \n
+/// the argument to the Dispatcher.\n
+/// When the notification service receives the public message of the Notification, it sends a NPS_NOTIFY_EV_REQ \n
+/// message to the client that has registered the Notification. The client having received the NPS_NOTIFY_EV_REQ
+/// \n
+/// message, based on the Callback information registered in the Dispatcher, call a Callback corresponding to the
+/// \n
+/// Notification.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback, FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationWithCallback(HANDLE hApp, PCSTR pNotification, CbFuncPtr fpOnCmd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnsubscribeNotificationsWithCallback
+/// \~english @par Brief
+/// API to bulk delete the Callback information at the time of multiple Notification received from the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pNtfyHandler
+/// FrameworkunifiedNotificationCallbackHandler - Pointer to a structure of the Notification Handler
+/// \~english @param [in] uiHandlerCount
+/// UI_32 - Notification Handler number
+/// \~english @par
+/// FrameworkunifiedNotificationCallbackHandler Structure
+/// \~english @code
+/// #define MAX_STRING_SIZE_NOTIFICATION 64
+/// typedef struct _FrameworkunifiedNotificationCallbackHandler
+/// {
+/// CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION]; /* Notification Name */
+/// CbFuncPtr callBack; /* Callback function pointer */
+/// }FrameworkunifiedNotificationCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded the maximum number of
+/// Notification. [eFrameworkunifiedStatusFail]
+/// - In Notification name in the structure of the Notification Handler specified in the argument, there is not
+/// applicable in those registered as Callback information. [eFrameworkunifiedStatusFail]
+/// - The acquisition of the buffer for storing a plurality of information of Notification Handler specified by
+/// the argument has failed. [eFrameworkunifiedStatusInvldParam]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// The Callback information of multiple Notification upon receipt that is specified in the form of a list, \n
+/// collectively removed from the notification service (NS_NPPService). \n
+/// In addition, the bulk delete the Callback information at the time of multiple Notification received that \n
+/// are specified in the form of a list from the Dispatcher.\n
+/// By bulk delete the Callback information, if the notification services receives the public message
+/// Notification, \n
+/// because the Notification information applicable also been deleted, Callback does not occur.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPRegisterNotifications,
+/// FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationsWithCallback(HANDLE hApp, const FrameworkunifiedNotificationCallbackHandler *pNtfyHandler,
+ UI_32 uiHandlerCount);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnsubscribeNotificationWithCallback
+/// \~english @par Brief
+/// API to detach a notification callback from the dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @param [in] pNotification
+/// PCSTR - Notification String.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNotification) is NULL to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - Length of pointer (pNotification) is 0 to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Missing HANDLE specified in the argument (hApp) in notification list [eFrameworkunifiedStatusFail]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// The Callback information at the time of Notification received that has been specified by the argument, \n
+/// to remove from the notification service (NS_NPPService).\n
+/// Also, delete the Callback information of Notification upon receipt, which is specified by the argument \n
+/// from the Dispatcher.
+/// By bulk delete the Callback information, if the notification services receives the public message
+/// Notification, \n
+/// because the Notification information applicable also been deleted, Callback does not occur.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPRegisterNotifications,
+/// FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationWithCallback(HANDLE hApp, PCSTR pNotification);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetAppName
+/// \~english @par Brief
+/// Get the application thread name that is registered with the dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval PCSTR Pointer to application thread name
+/// \~english @retval NULL NULL pointer (Failed to get application name)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// \~english @par Detail
+/// Get the application thread name that was registered at initialization of dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedDispatcherWithArguments, FrameworkunifiedDispatcher, FrameworkunifiedCreateDispatcherWithoutLoop
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetAppName(HANDLE hApp);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetThreadSpecificData
+/// \~english @par Brief
+/// Set pointer to the application-specific data to the application HANDLE.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] data
+/// PVOID - Pointer to the application-specific data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// This API sets application-specific data to internal pointer inside application framwork HANDLE.\n
+/// You can share data in callback function or thread.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedGetThreadSpecificData
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetThreadSpecificData(HANDLE hApp, PVOID data);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetThreadSpecificData
+/// \~english @par Brief
+/// Get pointer to the application-specific data from the application HANDLE.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @retval PVOID pointer to application-specific data.
+/// \~english @retval NULL NULL pointer(failed to get data)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// \~english @par Detail
+/// This API gets application-specific data that set with FrameworkunifiedSetThreadSpecificData from internal pointer inside
+/// application framwork HANDLE.\n
+/// You can share data in callback function or thread.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedSetThreadSpecificData
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID FrameworkunifiedGetThreadSpecificData(HANDLE hApp);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOpenService
+/// \~english @par Brief
+/// API to acquire a service HANDLE.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pServiceName
+/// PCSTR - Pointer to service name
+/// \~english @retval HANDLE Handle to the service
+/// \~english @retval NULL NULL pointer (Failed to get service handle)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// - Only when will open the session by FrameworkunifiedOpenSession, you can use the handle obtained by this API.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Service name specified in the argument (pServiceName) is NULL. [NULL]
+/// - Service name specified in the argument (pServiceName) is not appropriate (NULL, over 20byte). [NULL]
+/// - Normalized service name for message queue is not appropriate (over 15byte). [NULL]
+/// - Can not be acquired memory for message queue infomation(malloc). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Detail
+/// Create a communication resource for communicating with the specified service , return the HANDLE.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedCloseService, FrameworkunifiedOpenSession
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedOpenService(HANDLE hApp, PCSTR pServiceName);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCloseService
+/// \~english @par Brief
+/// API to close service HANDLE.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService HANDLE acquired in)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hService) is mismatch.(eQTypeSender or
+/// eQTypeReveiver) [eFrameworkunifiedStatusInvldHndlType]
+/// - Failed to close message queue specified in the argument (hService). [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// This API closes service HANDLE specified by argument.\n
+/// And close message queue of the service.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenService
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseService(HANDLE hApp, HANDLE hService);
+
+//////////////////////////////////////////////////
+// message center functions
+//////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedMcOpenSender
+/// \~english @par Brief
+/// Generate a handle to the message queue for sending.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [in] pName
+/// PCSTR - Message queue name of destination service
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (pName) is NULL. [NULL]
+/// - Message queue name specified in the argument (pName) is not appropriate (NULL, over 20byte). [NULL]
+/// - Normalized message queue name is not appropriate (over 15byte). [NULL]
+/// - Can not be acquired memory for message queue infomation(malloc). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Detail
+/// This API generates and returns a handle to the message queue for sending of service.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedMcClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedMcOpenSender(HANDLE hApp, PCSTR pName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedMcClose
+/// \~english @par Brief
+/// API for closing a message queue handle
+/// \~english @param [in] hService
+/// HANDLE - Handle for services (handle obtained by FrameworkunifiedMcOpenSender)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hService specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hService specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle in the handle (hService) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hService) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the message queue types of the handles (hService) specified in the arguments do not match, [eFrameworkunifiedStatusInvldHandle]
+/// - Closing the message queue for the handle (hService) specified in the arguments fails, [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Closes the message queue for the specified service.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedMcOpenSender
+///
+/// To close message queue handle to a service
+///
+/// \param [in] hService
+/// HANDLE - Handle to a service
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedMcClose(HANDLE hService);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendMsg
+/// \~english @par Brief
+/// Asynchronous API that sends messages to the service
+/// \~english @param [in] hService
+/// HANDLE - Handle for services (handle acquired by FrameworkunifiedMcOpenSender, etc.)
+/// \~english @param [in] uiCmd
+/// UI_32 - Command ID, Request ID, and Authorization ID on the service's protocol
+/// \~english @param [in] uiLength
+/// UI_32 - Data size to be sent (0 to 4294967255)
+/// \~english @param [in] pData
+/// PCVOID - Pointer to the data to send
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Handles for services must be acquired (FrameworkunifiedMcOpenSender, etc.).
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hService specified in the arguments is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - If the hService specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue name of the handle (hService) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue of the handle (hService) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle in the handle (hService) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hService) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the send data (pData) specified in the parameter is NULL and the data length (uiLength) is not 0, [eFrameworkunifiedStatusInvldBuf]
+/// - When the name of the message queue handle in the handle (hService) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldQName]
+/// - If the name of the message queue handle (hService) specified in the argument exceeds 20 bytes, [eFrameworkunifiedStatusInvldQName]
+/// - When the message queue type of the handle (hService) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sessions for services is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for sessions intended for the service [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for services [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for the services [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages for sessions for services [eFrameworkunifiedStatusErrOther]
+/// - When the size (uiLength) of the data to be sent specified in the parameter is out of range, [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Messages are sent to the service using the message queue associated with the service handle.\n
+/// A destination is a service specified as arguments such as FrameworkunifiedMcOpenSender when a service handle was created.\n
+/// This API operates asynchronously.
+/// \~english @par
+/// - The consistency between the size of the data to be sent and the size of the area indicated by the pointer to the data to be sent is ensure by the caller.
+/// - The maximum data size (uiLength) described above is a theoretical value. The maximum data size that can be actually used depends on the environment requirements.\n
+/// The maximum value is the upper limit of the type (UINT_MAX) minus the following size.\n
+/// Message header section\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method
+/// \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedOpenService
+///
+/// Send message to the service.
+///
+/// \param [in] hService
+/// HANDLE - Handle to the service.
+/// \param [in] uiCmd
+/// UI_32 - Protocol message id.
+/// \param [in] uiLength
+/// UI_32 - Length of the data to be send.
+/// \param [in] pData
+/// PVOID - Pointer to the data.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendMsg(HANDLE hService, UI_32 uiCmd, UI_32 uiLength, PCVOID pData);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendPriorityMsg
+/// Send message to a service. It places your message at the top of the services message queue.
+/// \b Applications should not use this unless absolutely required - use cases must be reviewed by
+/// \b Framework Team.
+///
+/// \param [in] hService
+/// HANDLE - Handle to the service.
+/// \param [in] uiCmd
+/// UI_32 - Protocol message id.
+/// \param [in] uiLength
+/// UI_32 - Length of the data to be send.
+/// \param [in] pData
+/// PVOID - Pointer to the data.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendPriorityMsg(HANDLE hService, UI_32 uiCmd, UI_32 uiLength, PCVOID pData);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendSelf
+/// \~english @par Brief
+/// Asynchronous APIs that send messages to the application's own Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] iCmd
+/// UI_32 - Command ID, Request ID, and Authorization ID on the service's protocol
+/// \~english @param [in] length
+/// UI_32 - Data size to be sent (0 to 4294967255)
+/// \~english @param [in] data
+/// PCVOID - Pointer to the data to send
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hService specified in the arguments is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - If the hService specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle for the own Dispatcher in the handle (hService) specified by the arguments is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - Invalid message queue handle for its own Dispatcher in the handle (hService) specified by the arguments [eFrameworkunifiedStatusInvldHandle]
+/// - When the send data (data) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldBuf]
+/// - When the service name of the handle (hService) specified in the arguments is not appropriate (when the service name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue handle for the own Dispatcher in the handle (hService) specified in the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - Failed to access shared memory for sending messages for its own Dispatcher [eFrameworkunifiedStatusErrOther]
+/// - When the message queue type for the own Dispatcher of the handle (hService) specified in the parameter is not the send type [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue for your Dispatcher is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for own Dispatcher [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending messages for the Dispatcher itself [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for your Dispatcher [eFrameworkunifiedStatusFail]
+/// - When the size (length) of the data to be sent specified in the parameter is out of range, [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Send messages to the application's own Dispatcher.\n
+/// This API operates asynchronously.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - The maximum data size (length) described above is a theoretical value. The maximum data size that can be actually used depends on the environment requirements.\n
+/// The maximum value is the upper limit of the type (UINT_MAX) minus the following size.\n
+/// Message header section\n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address of the pointer (data) to the data buffer does not match the size specified by the size of the data buffer (length).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method
+/// \~english @see FrameworkunifiedSendMsg
+///
+/// Send message to the hApp.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the dispatcher to receive message
+/// \param [in] iCmd
+/// UI_32 - Protocol message id.
+/// \param [in] length
+/// UI_32 - Length of the data to be send.
+/// \param [in] data
+/// PVOID - Pointer to the data.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendSelf(HANDLE hApp, UI_32 iCmd, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedInvokeSync
+/// \~english @par Brief
+/// API for synchronous communication of the message.
+/// \~english @param [in] hService
+/// HANDLE - Handle for the message queue
+/// \~english @param [in] iCmd
+/// UI_32 - Command ID
+/// \~english @param [in] msgLenght
+/// UI_32 - Data length of the send message
+/// \~english @param [in] msgData
+/// PCVOID - Pointer to send the message
+/// \~english @param [in] responseLength
+/// UI_32 - Size of the received message storage buffer
+/// \~english @param [out] responseData
+/// PVOID - Pointer to the received message storage buffer
+/// \~english @param [out] receivedLength
+/// UI_32 * - Data length of the received message
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// - Handles for message queue must be acquired (FrameworkunifiedMcOpenSender, etc.).
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hService) specified in the argument is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE(hService) specified in the argument is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - It failed to open the message queue for the response received [eFrameworkunifiedStatusFail]
+/// - Send message queue HANDLE in HANDLE(hService) specified in the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Send message queue HANDLE in HANDLE(hService) specified in the argument is not appropriate (which is
+/// invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE for the response received is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE for the response received is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - The size of the received message storage buffer specified by the argument is not 0, and the pointer is NULL
+/// to the received message storage buffer. [eFrameworkunifiedStatusInvldHandle]
+/// - It fails to get the message storage buffer for the response received. [eFrameworkunifiedStatusFail]
+/// - Random number generation to fail for the sequence ID of the message for transmission. [eFrameworkunifiedStatusFail]
+/// - Message queue name of HANDLE(hService) specified in the argument is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue name of HANDLE(hService) specified in the argument exceeds 20byte. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE(hService) specified in the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE(hService) specified in the argument exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE(hService) specified in the argument is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmit and receive file descriptor of the session message. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) occurs during the transmission and reception of the session
+/// message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the sending and receiving of a session message. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// - It failed to Socket connection of the response message for the reception. [eFrameworkunifiedStatusFail]
+/// - The wait control of the response message received failed. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) to wait in the response message received has occurred.
+/// [eFrameworkunifiedStatusFail]
+/// - In response message at the time of failure to receive, it failed to re-connection of the Socket.
+/// [eFrameworkunifiedStatusBadConnection]
+/// \~english @par Detail
+/// Under the following procedure, perform synchronous communication of the message.
+/// - During the first call, it generates a message queue name for the response message received by the
+/// McCreateInvokerName(),
+/// and to open the message queue for the response message received by the McOpenSyncReceiver ().
+/// - By the McInvokeSync(), perform synchronous communication of the message.
+/// \~english @par
+/// If the received response message is greater than the storage buffer, to store up to store buffer length.\n
+/// The user is able to detect an abnormality by comparing store buffer length and a received message length.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedSendMsg
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedInvokeSync(HANDLE hService, UI_32 iCmd, UI_32 msgLenght, PCVOID msgData, UI_32 responseLength,
+ PVOID responseData, UI_32 *receivedLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetSyncResponseData
+/// \~english @par Brief
+/// API to set the response data of the synchronization communication.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @param [in] data
+/// PVOID - Pointer to the response data
+/// \~english @param [in] size
+/// UI_32 - The response data size
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE(hApp) specified in the argument is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - Pointer to the response data(data) specified in the argument is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - If the size (size) of the response data specified in the arguments cannot be allocated, [eFrameworkunifiedStatusFail]
+/// - When the response data size (size) specified in the parameter is out of range, [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Store the response data specified in the storage area of the response data \n
+/// in the handle specified by the argument.
+/// \~english @par
+/// Response data set by this PROCESS is automatically sent by the Dispatcher after the callback function completes execution, so the API does not need to send the response data.
+/// \~english @par
+/// - The response data is registered to the heap.
+/// - If the pointer (data) to the response data is normal (not NULL) and 0 is specified for the size (size) of the response data, the response data is set to empty.
+/// - The maximum size (size) of the response data described above is a theoretical value. The maximum size that can be used is environment-dependent.\n
+/// The maximum value is the upper limit of the type (UINT_MAX) minus the following size.\n
+/// Message header section and response message header section\n
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedInvokeSync
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetSyncResponseData(HANDLE hApp, PVOID data, UI_32 size);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetMsgLength
+/// \~english @par Brief
+/// API to retrieve the data length of the received message.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval UI_32 The data length of the received message
+/// \~english @retval 0 Error or No data
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [0]
+/// - HANDLE(hApp) specified in the argument is not appropriate (which is invalid). [0]
+/// \~english @par Detail
+/// To return the data length of the received messages in the handle(hApp) \n
+/// that you specified in the argument as a return value. \n
+/// It is possible to get by to use when the message was received. \n
+/// If the return value is 0, there is a need for caution because of either \n
+/// error or no data.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgLength(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetMsgProtocol
+/// \~english @par Brief
+/// API to get the Command ID/Request ID/Approval ID on the protocol.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval UI_32 Command ID/Request ID/Approval ID
+/// \~english @retval 0 Error
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE(hApp) specified in the argument is NULL. [0]
+/// - HANDLE(hApp) specified in the argument is not appropriate (which is invalid). [0]
+/// \~english @par Detail
+/// To return the Command ID/Request ID/Approval ID that are within \n
+/// the handle(hApp) specified in the argument as a return value.
+/// \~english @par
+/// The application shall execute this API using an application handle passed as an argument to the callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp),
+/// and then executed by the application callback functions.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgProtocol(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetMsgDataOfSize
+/// \~english @par Brief
+/// API to get the data of the received message
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [out] pData
+/// PVOID - Pointer to the buffer where the received message data will be copied
+/// \~english @param [in] uiSize
+/// UI_32 - Size of the buffer to which received message data is copied
+/// \~english @param [in] eRetrieveMethod
+/// ESMRetrieveTypes - Shared memory-acquisition-type (optional; eSMRRelease if not specified)
+/// \~english @par
+/// enum ESMRetrieveTypes variables
+/// - eSMRRelease = 0 : The shared memory data is deleted after acquisition.
+/// - eSMRRetain = 1 : Shared memory data is maintained.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the data size is larger than the buffer size (uiSize) specified by the parameter, [eFrameworkunifiedStatusInvldBufSize]
+/// - If the buffer (pData) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldBuf]
+/// - Incoming messages are incorrect [eFrameworkunifiedStatusInvldHndlType]
+/// - If the shared memory ID specified in the received message is invalid [FrameworkunifiedStatusErrOther]
+/// - If accessing shared memory (shm_open/fstat/mmap) fails [eFrameworkunifiedStatusErrOther]
+/// - If the size of the data in shared memory is larger than the buffer size (uiSize) specified by the arguments [FrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Receive message data is acquired from the receive buffer in the application handle (hApp) or the shared memory (message is stored in the shared memory when the size is 4096 bytes or more), and is stored in the area passed in the parameter pData.\n
+/// When data exists in the shared memory, the data is held or deleted in the shared memory by specifying the eRetrieveMethod of arguments of this API
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Execute this API using an application handle passed as an argument of a callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp), and then executed by the application callback functions.)
+/// - Before executing this API, the size of the received message must be checked by the FrameworkunifiedGetMsgLength to determine whether data is to be retained in the shared memory.
+/// - If it is kept in shared memory, the application must execute the FrameworkunifiedClearMsgData and delete it.
+/// - If an invalid value other than the ESMRetrieveTypes defined value is specified for the shared memory allocation type (eRetrieveMethod), the shared memory allocation type behaves as if eSMRRetain were specified.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedClearMsgData
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [out] pData
+/// PVOID - Buffer to which the received message data will be copied.
+/// \param [out] uiSize
+/// UI_32 - Size of the buffer to which the received message data will be copied.
+/// \param [in] eRetrieveMethod
+/// ESMRetrieveTypes -
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \~english @par Type
+/// Sync
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetMsgDataOfSize(HANDLE hApp, PVOID pData, UI_32 uiSize, ESMRetrieveTypes eRetrieveMethod = eSMRRelease);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetDataPointer
+/// \~english @par Brief
+/// API to get start address of data from received message
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [out] datap
+/// void** - Pointer to the data of the received message
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the receive buffer address of the handle (hApp) specified in the parameter is NULL [eFrameworkunifiedStatusInvldBufSize]
+/// - When the pointer (datap) to the data of the received message specified by the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// This function gets the received message data from the receive buffer in the application handle (hApp)
+/// and returns the start address of the received message in the argument datap.\n
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - This API can be executed for messages that do not use shared memory (messages with a message size less than 4096 bytes).
+/// Check the size of received messages in the FrameworkunifiedGetMsgLength prior to executing this API.
+/// - Since the pointers acquired by this API are part of the Dispatcher, the pointers acquired by this API must not be released by the application.
+/// - Execute this API using an application handle passed as an argument of a callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp), and then executed by the application callback functions.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgDataOfSize
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [out] datap
+/// void ** - Pointer to which the receive message data.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @par Type
+/// Sync
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetDataPointer(HANDLE hApp, void **datap);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetMsgSrc
+/// \~english @par Brief
+/// API to get the application name of the sender of the received message
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval PCSTR Name of the application from which the message was sent
+/// \~english @retval NULL NULL pointer (Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// \~english @par Detail
+/// This API returns the application name of the sender of the received message.\n
+/// The application name acquired by this API is used for establishing sessions, creating message queues for responses,
+/// and registering/releasing callbacks to the Dispatcher.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Execute this API using an application handle passed as an argument of a callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp), and then executed by the application callback functions.)
+/// - Since the pointers acquired by this API are part of the Dispatcher, the pointers acquired by this API must not be released by the application.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedOpenService, FrameworkunifiedCreateSession, FrameworkunifiedMcOpenSender, \n
+/// FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedAttachCallbacksToDispatcher, \n
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher, FrameworkunifiedDetachServiceFromDispatcher
+///
+/// Source of the message.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return pSourceName
+/// PCSTR - Source name of the message.
+/// \~english @par Type
+/// Sync
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetMsgSrc(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetLastNotification
+/// \~english @par Brief
+/// Get the most recent Notification names
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval PCSTR Pointers to Notification
+/// \~english @retval NULL NULL pointer (Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// \~english @par Detail
+/// This API acquires and returns the most recent Notification name from the received data.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Execute this API using an application handle passed as an argument of a callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp), and then executed by the application callback functions.)
+/// - Since the pointers acquired by this API are part of the Dispatcher, the pointers acquired by this API must not be released by the application.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedNPPublishNotification
+///
+/// Returns the last notification string that was received.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return pSourceName
+/// PCSTR - the last notification name that has been received.
+/// \~english @par Type
+/// Sync
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetLastNotification(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedClearMsgData
+/// \~english @par Brief
+/// API to delete shared memory used for sending and receiving messages
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval eFrameworkunifiedStatusOK Successful or Use Shared Memory Messages
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldID Invalid ID
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - Framework generating failure [eFrameworkunifiedStatusInvldParam]
+/// - If the shared memory ID specified in the message is invalid [eFrameworkunifiedStatusInvldParam]
+/// - If an attempt is made to remove a non-existent shared memory, [eFrameworkunifiedStatusInvldID]
+/// - If accessing shared memory (shm_unlink) fails, [eFrameworkunifiedStatusFail]
+/// - When the receive buffer address of the handle (hApp) specified in the parameter is NULL [eFrameworkunifiedStatusInvldBuf]
+/// \~english @par Detail
+/// This API deletes the shared memory used for sending and receiving messages.\n
+/// When an application gets received messages by specifying eSMRRetain as FrameworkunifiedGetMsgDataOfSize, it deletes the shared memories by using this API...\n
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - The shared memory information to be deleted by this API shall be executed by the application on the message receiving side because it is obtained from the received message.\n
+/// - Execute this API using an application handle passed as an argument of a callback function.
+/// (Messages are received within the framework, stored in the application handles (hApp), and then executed by the application callback functions.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedSendMsg, FrameworkunifiedGetMsgDataOfSize
+///
+/// Explicit call to clear the data from shared memory.
+/// To be used incase of forwarding messages ???
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @par Type
+/// Sync
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedClearMsgData(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedForwardMessage
+/// Forward a message to a service or a client.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the service
+/// \param [in] hChildQ
+/// HANDLE - Handle to the child thread
+/// \param [in] iCmd
+/// UI_32 - .
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedGetSystemInfo
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedForwardMessage(HANDLE hApp, HANDLE hChildQ, UI_32 iCmd);
+
+
+
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Notification & Persistence Service
+////////////////////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPRegisterNotification
+/// \~english @par Brief
+/// To the notification service to register the Notification, API to send a message.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pNotification
+/// PCSTR - A pointer to the Notification name
+/// \~english @param [in] max_length
+/// UI_32 - The maximum length of the Notification message (64byte below)
+/// \~english @param [in] persType
+/// \~english @par
+/// EFrameworkunifiedNotificationType - Type of Notification
+/// enum EFrameworkunifiedNotificationType Variable
+/// - eFrameworkunifiedNotificationVar : Non Persistent. Not stored locally by NPS.
+/// - eFrameworkunifiedStateVar : Non Persistent. stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateVar : Not to be used. Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateUserVar : Not to be used. User specific Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedImmediatePersistedStateVar : Not to be used.
+/// - eFrameworkunifiedUnknown : Not to be used. This is not a type of notification.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNotification) is NULL to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - It is not appropriate length of the specified Notification name in argument(0, or more than a 64byte).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// To the notification service (NS_NPPService) to register the Notification, \n
+/// send a message for the Notification registration.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedNPRegisterNotifications, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback, FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterNotification(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const EFrameworkunifiedNotificationType persType);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetPersistNotfnDefaultValue
+/// API to send message to Notification Service to set the default value for the notification.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+/// \param [in] data
+/// PVOID - Set the default value for the notification.
+/// \param [in] uiLength
+/// const UI_32 - length of the data
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersistNotfnDefaultValue(HANDLE hApp, PCSTR pNotification, PVOID data, const UI_32 uiLength);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPSetPersistentNotfnType
+/// \~english @par Brief
+/// API to send message to Notification Service to set persistent notification category.
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \~english @param [in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @param [in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - Persistent Category
+/// \~english @return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @code
+/// typedef enum _EFrameworkunifiedNotificationType
+/// {
+/// eFrameworkunifiedNotificationVar = 0, /* Not persistent (not retained by NPS) */
+/// eFrameworkunifiedStateVar, /* Not persistent (held by NPS) */
+/// eFrameworkunifiedPersistedStateVar, /* persistent. Only kept in NPS */
+/// eFrameworkunifiedPersistedStateUserVar, /* Invalid handle type. Only kept in NPS */
+/// eFrameworkunifiedImmediatePersistedStateVar, /* Invalid handle. See \ref
+/// FrameworkunifiedNPRegisterImmediatePersistNotification */
+/// eFrameworkunifiedUnknown /* No Notification typing. Not recommended */
+/// } EFrameworkunifiedNotificationType;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue information handle specified in the argument (hApp) is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see none
+///
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersistentNotfnType(HANDLE hApp, PCSTR pNotification, EFrameworkunifiedPersistCategory ePersistCategory);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPRegisterImmediatePersNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to register a immediate notification
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \~english @param [in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @param [in] max_length
+/// const UI_32 - Max size of the notification message (should be <= 1Kb)
+/// \~english @param [in] delay
+/// const UI_32 - Min time interval between every persist (in sec)
+/// \~english @return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the pNotification to the Notification specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the length of the Notification specified by the arguments is 0, [eFrameworkunifiedStatusInvldParam]
+/// - If the length of the Notification specified in the arguments is 64 (MAX_STRING_SIZE_NOTIFICATION) or greater [eFrameworkunifiedStatusInvldParam]
+/// - Failed to get buffers to store Notification [eFrameworkunifiedStatusInvldParam]
+/// - When memory could not be allocated due to the allocation of message-sending buffers (malloc),... [eFrameworkunifiedStatusFail]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API registers a Notification to the notification service (NS_NPPService).\n
+/// By sending a Notification registration message to the notification service, the specified Notification is registered in the received notification service.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedNPRegisterNotifications, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,FrameworkunifiedSubscribeNotificationsWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterImmediatePersistNotification(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const UI_32 delay);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPPersistentSync
+/// Processing which synchronizes by NPPService (syncfs)
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPPersistentSync(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPRegisterNotifications
+/// \~english @par Brief
+/// API to send a message to the notification service in order to register multiple Notification of list format.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pList
+/// FrameworkunifiedNotificationsList - Pointer to the Notification list to be registered
+/// \~english @param [in] uiListLength
+/// UI_32 - List length
+/// \~english @par
+/// FrameworkunifiedNotificationsList Structure
+/// \~english @code
+/// #define MAX_STRING_SIZE_NOTIFICATION 64
+/// typedef struct _FrameworkunifiedNotificationsList
+/// {
+/// CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION]; /* Notification Name */
+/// UI_32 uiLengthData; /* Notification Name length(64byte below) */
+/// EFrameworkunifiedNotificationType persType; /* Notification Type */
+/// }
+/// @endcode
+/// \~english @par
+/// enum EFrameworkunifiedNotificationType Variable
+/// - eFrameworkunifiedNotificationVar : Non Persistent. Not stored locally by NPS.
+/// - eFrameworkunifiedStateVar : Non Persistent. stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateVar : Not to be used. Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateUserVar : Not to be used. User specific Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedImmediatePersistedStateVar : Not to be used.
+/// - eFrameworkunifiedUnknown : Not to be used. This is not a type of notification.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - A pointer to the Notification list to register specified in the argument (pList) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - And fail to acquire the buffer for storing a plurality Notification. [eFrameworkunifiedStatusInvldParam]
+/// - List specified in the argument length (uiListLength) has exceeded the maximum number of Notification.
+/// [eFrameworkunifiedStatusFail]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// This API is to register multiple Notification of list format to the notification service (NS_NPPService).\n
+/// By transmitting multiple Notification registration message to the notification service, Notification \n
+/// specified in the received notification service is registered. \n
+/// It sends a message for multiple Notification registered with the notification service (NS_NPPService) \n
+/// in order to register multiple Notification of list format.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback, FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterNotifications(HANDLE hApp, const FrameworkunifiedNotificationsList *pList, UI_32 uiListLength);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPUnRegisterNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to remove a notification.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pNotification
+/// PCSTR - A pointer to the Notification name
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNotification) is NULL to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - It fails to get the buffer that stores the Notification. [eFrameworkunifiedStatusInvldParam]
+/// - It is not appropriate length of the specified Notification name in argument(0, or more than a 64byte).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Can not be acquired memory in the acquisition of buffer for internal processing (malloc). [eFrameworkunifiedStatusFail]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// This API is, to remove the Notification from the notification service (NS_NPPService). \n
+/// By deleting, Notification specified from the notification service will no longer be delivered.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPRegisterNotifications, FrameworkunifiedNPUnRegisterNotifications,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback, FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnRegisterNotification(HANDLE hApp, PCSTR pNotification);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPUnRegisterNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to delete a notification.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pList
+/// FrameworkunifiedNotificationsList - Pointer to the Notification list that you want to delete
+/// \~english @param [in] uiListLength
+/// UI_32 - List length
+/// \~english @par
+/// FrameworkunifiedNotificationsList Structure
+/// \~english @code
+/// #define MAX_STRING_SIZE_NOTIFICATION 64
+/// typedef struct _FrameworkunifiedNotificationsList
+/// {
+/// CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION]; /* Notification Name */
+/// UI_32 uiLengthData; /* Notification Name length(64byte below) */
+/// EFrameworkunifiedNotificationType persType; /* Notification Type */
+/// }
+/// @endcode
+/// \~english @par
+/// enum EFrameworkunifiedNotificationType Variable
+/// - eFrameworkunifiedNotificationVar : Non Persistent. Not stored locally by NPS.
+/// - eFrameworkunifiedStateVar : Non Persistent. stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateVar : Not to be used. Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedPersistedStateUserVar : Not to be used. User specific Persistent. Also stored locally by NPS.
+/// - eFrameworkunifiedImmediatePersistedStateVar : Not to be used.
+/// - eFrameworkunifiedUnknown : Not to be used. This is not a type of notification.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - It fails to get the buffer that stores multiple Notification. [eFrameworkunifiedStatusInvldParam]
+/// - List specified in the argument length (uiListLength) has exceeded the maximum number of Notification.
+/// [eFrameworkunifiedStatusFail]
+/// - Can not be acquired memory in the acquisition of buffer for internal processing (malloc). [eFrameworkunifiedStatusFail]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// This API is, delete multiple Notification of list format from the notification service (NS_NPPService). \n
+/// By deleting, Notification specified from the notification service will no longer be delivered.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPRegisterNotifications, FrameworkunifiedNPUnRegisterNotification,
+/// FrameworkunifiedNPPublishNotification, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedUnsubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback, FrameworkunifiedUnsubscribeNotificationsWithCallback
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPUnRegisterNotifications(HANDLE hApp, const FrameworkunifiedNotificationsList *pList,
+ UI_32 uiListLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPPublishNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to notify subscribers
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application
+/// \~english @param [in] pNotification
+/// PCSTR - A pointer to the Notification name
+/// \~english @param [in] pData
+/// VOID * - Data buffer pointer
+/// \~english @param [in] iLength
+/// UI_32 - Size of data buffer
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some kind of error has occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - NS_NPPService of the process has been started.
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Conditions of processing failure
+/// - Pointer (pNotification) is NULL to the Notification name specified. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam]
+/// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+/// [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more than
+/// 20byte) [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission of the session message for the NPP Service.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Detail
+/// Send a message to the notification service(NS_NPPService), and notifies the Subscriber.\n
+/// - Publisher is required registration of Notification in advance FrameworkunifiedNPRegisterNotification.
+/// - Publisher is possible cancellation of the Notification in FrameworkunifiedNPUnRegisterNotification.
+/// - Subscriber need a reception procedure of Notification in advance FrameworkunifiedSubscribeNotification.
+/// - Subscriber is capable of receiving cancellation of the Notification in FrameworkunifiedUnsubscribeNotification.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedNPRegisterNotification, FrameworkunifiedNPUnRegisterNotification
+/// FrameworkunifiedNPRegisterNotifications, FrameworkunifiedNPUnRegisterNotifications
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPPublishNotification(HANDLE hApp, PCSTR pNotification,
+ PCVOID pData, UI_32 iLength);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPReadPersistedData
+/// \~english @par Brief
+/// API to requested the persistent data corresponding to the notification if available
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \~english @param [in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the pNotification to the Notification specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the length of the Notification specified by the arguments is 0, [eFrameworkunifiedStatusInvldParam]
+/// - Failed to get buffers to store Notification [eFrameworkunifiedStatusInvldParam]
+/// - When memory could not be allocated due to the allocation of message-sending buffers (malloc),... [eFrameworkunifiedStatusFail]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for the NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see none
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReadPersistedData(HANDLE hApp, PCSTR pNotification);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPRegisterPersistentFile
+/// \~english @par Brief
+/// APIs that send messages to notification services and register Persistent file tags
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pTag
+/// PCSTR - Tag name
+/// \~english @param [in] bIsUserFile
+/// BOOL - User specified (TRUE: user-specific/FALSE: all users) (Default:FALSE)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue information handle specified in the argument (hApp) is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is an empty character, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends messages to the notification service (NS_NPPService) and registers Persistent file tags.\n
+/// Tag name is 64 bytes or less. If the tag name exceeds 64 bytes, the tag name is truncated to 64 bytes or less. Therefore, specify a tag name of 64 bytes or less.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget
+/// \~english @see FrameworkunifiedNPLoadPersistentFile, FrameworkunifiedNPReleasePersistentFile
+///
+/// API to send message to Notification Service to add a file path as to be persisted
+///
+/// \param [in] pTag
+/// PCSTR - A unique identifier for the file path specified,
+/// this is used in retrieve/Load the file later
+///
+/// \param [in] bIsUserFile
+/// BOOL - set TRUE if want to register a file for user.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPLoadPersistentFile, FrameworkunifiedNPReleasePersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterPersistentFile(HANDLE hApp, PCSTR pTag, BOOL bIsUserFile = FALSE);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetFilePersistentType
+/// API to send message to Notification Service to set persistent file category.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pTag
+/// PCSTR - File tag
+/// \param [in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - Persistent category
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetFilePersistentType(HANDLE hApp, PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPLoadPersistentFile
+/// \~english @par Brief
+/// APIs that send messages to notification services and request Load of Persistent file tags
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pDstFilePath
+/// PCSTR - Address of arbitrary data
+/// \~english @param [in] pTag
+/// PCSTR - Tag name
+/// \~english @param [in] hUser
+/// BOOL - Parameter error(Default:NULL)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue information handle specified in the argument (hApp) is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the Load destination file path (pDstFilePath) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the Load destination filepath (pDstFilePath) specified in the parameter is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is an empty character, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends messages to the notification service (NS_NPPService) and requests the Load of Persistent file tags.\n
+/// The copy destination file path is 255 bytes or less, and any file that exceeds 255 bytes is truncated to 255 bytes. Therefore, specify a file path of 255 bytes or less.\n
+/// Tag name is 64 bytes or less. If the tag name exceeds 64 bytes, the tag name is truncated to 64 bytes or less. Therefore, specify a tag name of 64 bytes or less.\n
+///
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method(Async)
+/// \~english @see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPReleasePersistentFile
+///
+/// API to send message to Notification Service to copy file from persistent memory to
+/// specified path. The caller recieves an acknowledgement once NPS completes file copy
+///
+/// \param [in] pDstFilePath
+/// PCSTR - Complete file path to which the file should be copied from persistent area
+/// \param [in] pTag
+/// PCSTR - Tag associated with the file that needs to be copied to pDstFilePath
+/// \param [in] hUser
+/// HANDLE - Handle for the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPReleasePersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPLoadPersistentFile(HANDLE hApp, PCSTR pDstFilePath, PCSTR pTag, HANDLE hUser = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPReleasePersistentFile
+/// \~english @par Brief
+/// API to send message to Notification Service to notify that the file can be persisted.
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \~english @param [in] bIsPersist
+/// BOOL - If the specified file needs to be persisted or not on release
+/// \~english @param [in] pTag
+/// PCSTR - Tag associated with the file released
+/// \~english @param [in] pFullFilePath
+/// PCSTR - Full path name of the file to be persisted
+/// \~english @param [in] hUser
+/// HANDLE - Handle for the user
+/// \~english @return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue information handle specified in the argument (hApp) is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the Release destination file path (pFullFilePath) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the Release destination filepath (pFullFilePath) specified in the parameter is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is an empty character, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends messages to the notification service (NS_NPPService) and requests the Load of Persistent file tags.\n
+/// The copy destination file path is 255 bytes or less, and any file that exceeds 255 bytes is truncated to 255 bytes. Therefore, specify a file path of 255 bytes or less.\n
+/// Tag name is 64 bytes or less. If the tag name exceeds 64 bytes, the tag name is truncated to 64 bytes or less. Therefore, specify a tag name of 64 bytes or less.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPLoadPersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFile(HANDLE hApp, BOOL bIsPersist, PCSTR pTag, PCSTR pFullFilePath,
+ HANDLE hUser = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPReleasePersistentFile
+/// \~english @par Brief
+/// API to send message to Notification Service to notify that the file can be persisted.
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \~english @param [in] eReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease :not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly :persist instantly
+/// \~english @param [in] pTag
+/// PCSTR - Tag associated with the file released
+/// \~english @param [in] pFullFilePath
+/// PCSTR - Full path name of the file to be persisted
+/// \~english @param [in] hUser
+/// HANDLE - Handle for the user
+/// \~english @return status
+/// EFrameworkunifiedStatus - success or error
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue information handle specified in the argument (hApp) is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the Load destination file path (pDstFilePath) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the Load destination filepath (pDstFilePath) specified in the parameter is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the tag name (pTag) specified in the arguments is an empty character, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends messages to the notification service (NS_NPPService) and requests the Load of Persistent file tags.\n
+/// The copy destination file path is 255 bytes or less, and any file that exceeds 255 bytes is truncated to 255 bytes. Therefore, specify a file path of 255 bytes or less.\n
+/// Tag name is 64 bytes or less. If the tag name exceeds 64 bytes, the tag name is truncated to 64 bytes or less. Therefore, specify a tag name of 64 bytes or less.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPLoadPersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFile(HANDLE hApp, EFrameworkunifiedReleaseType eReleaseType, PCSTR pTag, PCSTR pFullFilePath,
+ HANDLE hUser = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPRegisterPersistentFolder
+/// API to send message to Notification Service to add a folder path to be persisted
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pTag
+/// PCSTR - A unique identifier for the folder path specified,
+/// this is used in retrieve/Load the folder later
+///
+/// \param [in] bIsUserFolder
+/// BOOL - set TRUE if want to register a folder for user.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPLoadPersistentFolder, FrameworkunifiedNPReleasePersistentFolder
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPRegisterPersistentFolder(HANDLE hApp, PCSTR pTag, BOOL bIsUserFolder = FALSE);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetFolderPersistentType
+/// API to send message to Notification Service to set persistent folder category.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pTag
+/// PCSTR - A unique identifier for the folder path specified,
+/// this is used in retrieve/Load the folder later
+/// \param [in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - Persistent category
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetFolderPersistentType(HANDLE hApp, PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPLoadPersistentFolder
+/// API to send message to Notification Service to copy folder from persistent memory to
+/// specified path. The caller recieves an acknowledgement once NPS completes folder copy
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pDstFolderPath
+/// PCSTR - Complete folder path to which the folder should be copied from persistent area
+/// \param [in] pTag
+/// PCSTR - Tag associated with the folder that needs to be copied to pDstFolderPath
+/// \param [in] hUser
+/// HANDLE - Handle for the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFolder, FrameworkunifiedNPReleasePersistentFolder
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPLoadPersistentFolder(HANDLE hApp, PCSTR pDstFolderPath, PCSTR pTag, HANDLE hUser = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFolder
+/// API to send message to Notification Service to notify that the folder can be persisted.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] bIsPersist
+/// BOOL - If the specified folder needs to be persisted or not on release
+/// \param [in] pTag
+/// PCSTR - Tag associated with the folder released
+/// \param [in] pFullFolderPath
+/// PCSTR - Full path name of the folder to be persisted
+/// \param [in] hUser
+/// HANDLE - Handle for the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFolder, FrameworkunifiedNPLoadPersistentFolder
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFolder(HANDLE hApp, BOOL bIsPersist, PCSTR pTag, PCSTR pFullFolderPath,
+ HANDLE hUser = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPReleasePersistentFolder
+/// API to send message to Notification Service to notify that the folder can be persisted.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] eFrameworkunifiedReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease :not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly :persist instantly
+/// \param [in] pTag
+/// PCSTR - Tag associated with the folder released
+/// \param [in] pFullFolderPath
+/// PCSTR - Full path name of the folder to be persisted
+/// \param [in] hUser
+/// HANDLE - Handle for the user
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFolder, FrameworkunifiedNPLoadPersistentFolder
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPReleasePersistentFolder(HANDLE hApp, EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType, PCSTR pTag,
+ PCSTR pFullFolderPath, HANDLE hUser = NULL);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Session APIs
+////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOpenSession
+/// \~english @par Brief
+/// API sends a message to the service requesting a session.
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService HANDLE acquired in)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (Service) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) during the transmission of the session message to the service
+/// occurs. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// To send a message of the session request to the service.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedGetOpenSessionHandle, FrameworkunifiedOpenSessionWithData, FrameworkunifiedCloseSession, FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSession(HANDLE hService);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOpenSessionWithData
+/// \~english @par Brief
+/// API to send to service the message of the session request together with the data.
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService HANDLE acquired in)
+/// \~english @param [in] pData
+/// PVOID - Pointer to the session data for transmission
+/// \~english @param [in] length
+/// UI_32 - Size of the session data for transmission
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - A pointer to the session data for transmission to the specified non-zero size at NULL in argument.
+/// [eFrameworkunifiedStatusInvldBuf]
+/// - The pointer is NULL to the session data for transmission specified in the argument. [eFrameworkunifiedStatusErrOther]
+/// - Size of the session data for transmission specified in the argument is 0. [eFrameworkunifiedStatusErrOther]
+/// - HANDLE specified in the argument (Service) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) during the transmission of the session message to the service
+/// occurs. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// To send to the service a message of session request together with the data.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSession, FrameworkunifiedGetOpenSessionHandle, FrameworkunifiedCloseSession, FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionWithData(HANDLE hService, PVOID pData, UI_32 length);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOpenSessionSync
+/// \~english @par Brief
+/// Synchronous API of sending a message of the session request to the service.
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService/FrameworkunifiedGetOpenSessionHandle/FrameworkunifiedGetOpenSessionSyncHandle HANDLE
+/// acquired in)
+/// \~english @param [out] ack
+/// OpenSessionAck - Pointer to the response data of the session initiation
+/// \~english @par
+/// OpenSessionAck Structure
+/// \~english @code
+/// #define MAX_QUEUE_NAME_SIZE 20
+/// typedef struct _OpenSessionAck
+/// {
+/// EFrameworkunifiedStatus eStatus; /* Status */
+/// UI_32 sessionId; /* Session ID */
+/// CHAR cSessionName[MAX_QUEUE_NAME_SIZE]; /* Session Name(20byte) */
+/// UI_32 sessionType; /* Session Type */
+/// }OpenSessionAck;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (Service) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - It failed to open the message queue for the response received [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - It fails to get the message storage buffer for the response received. [eFrameworkunifiedStatusFail]
+/// - Random number generation to fail for the sequence ID of the message for transmission. [eFrameworkunifiedStatusFail]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmit and receive file descriptor of the session message to the service.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) occurs during the transmission and reception of the session message
+/// to the service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the sending and receiving of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// - It failed to Socket connection of the response message for the reception from the service. [eFrameworkunifiedStatusFail]
+/// - The wait control of the response message received from the service failed. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) to wait in the response message received from the service has
+/// occurred. [eFrameworkunifiedStatusFail]
+/// - In response message at the time of failure to receive from the service, it failed to re-connection of the
+/// Socket. [eFrameworkunifiedStatusBadConnection]
+/// \~english @par Detail
+/// Send in the synchronous type the message of the session request to the service.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSessionWithDataSync, FrameworkunifiedGetOpenSessionSyncHandle, FrameworkunifiedCloseSessionSync,
+/// FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionSync(HANDLE hService, OpenSessionAck *ack);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedOpenSessionWithDataSync
+/// \~english @par Brief
+/// Synchronous API that transmits to the service a message session request with the data.
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService/FrameworkunifiedGetOpenSessionHandle/FrameworkunifiedGetOpenSessionSyncHandle HANDLE
+/// acquired in)
+/// \~english @param [in] pData
+/// PVOID - Pointer to session data for transmission
+/// \~english @param [in] length
+/// UI_32 - Size of the session data for transmission
+/// \~english @param [out] ack
+/// OpenSessionAck - Pointer to the response data of the session initiation
+/// \~english @par
+/// OpenSessionAck Structure
+/// \~english @code
+/// #define MAX_QUEUE_NAME_SIZE 20
+/// typedef struct _OpenSessionAck
+/// {
+/// EFrameworkunifiedStatus eStatus; /* Status */
+/// UI_32 sessionId; /* Session ID */
+/// CHAR cSessionName[MAX_QUEUE_NAME_SIZE]; /* Session Name(20byte) */
+/// UI_32 sessionType; /* Session Type */
+/// }OpenSessionAck;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid Buffer
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - A pointer to the session data for transmission to the specified non-zero size at NULL in argument.
+/// [eFrameworkunifiedStatusInvldBuf]
+/// - The pointer is NULL to the session data for transmission specified in the argument. [eFrameworkunifiedStatusErrOther]
+/// - Size of the session data for transmission specified in the argument is 0. [eFrameworkunifiedStatusErrOther]
+/// - HANDLE specified in the argument (Service) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - It failed to open the message queue for the response received [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - It fails to get the message storage buffer for the response received. [eFrameworkunifiedStatusFail]
+/// - Random number generation to fail for the sequence ID of the message for transmission. [eFrameworkunifiedStatusFail]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmit and receive file descriptor of the session message to the service.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) occurs during the transmission and reception of the session message
+/// to the service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the sending and receiving of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for transmission and reception of the service for the message for the session
+/// failed. [eFrameworkunifiedStatusErrOther]
+/// - It failed to Socket connection of the response message for the reception from the service. [eFrameworkunifiedStatusFail]
+/// - The wait control of the response message received from the service failed. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) to wait in the response message received from the service has
+/// occurred. [eFrameworkunifiedStatusFail]
+/// - In response message at the time of failure to receive from the service, it failed to re-connection of the
+/// Socket. [eFrameworkunifiedStatusBadConnection]
+/// \~english @par Detail
+/// Send in the synchronous type to service the message of the session request along with the data.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSessionSync, FrameworkunifiedGetOpenSessionSyncHandle, FrameworkunifiedCloseSessionSync, FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOpenSessionWithDataSync(HANDLE hService, PVOID pData, UI_32 length, OpenSessionAck *ack);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetOpenSessionHandle
+/// \~english @par Brief
+/// Asynchronous API to get the session handler.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application (FrameworkunifiedCreateDispatcherWithoutLoop() HANDLE acquired in)
+/// \~english @retval HANDLE HANDLE for the session
+/// \~english @retval NULL Failure to HANDLE acquisition for the session
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// Under the following conditions, HANDLE is returned as NULL.
+/// - HANDLE specified in the argument (hApp) is NULL.
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid).
+/// - Data size received by the HANDLE specified in the argument (hApp) is not the data size of
+/// ProtocolOpenSessionAck message.
+/// - Can not get the data and the data length received by the HANDLE specified in the argument (hApp).
+/// - Size of the session name of the data received by the specified HANDLE (hApp) in the argument is more than
+/// 20byte.
+/// - Not be able to acquire the memory of the buffer for the internal processing.
+/// - Session name is NULL of data received by the HANDLE specified in the argument (hApp).
+/// - It failed to generate the message queue name.
+/// - It failed to open the message queue.
+/// \~english @par Detail
+/// This API will be used in an asynchronous type specification. \n
+/// Acquires received data ProtocolOpenSessionAck from HANDLE specified in the argument (hApp), \n
+/// obtains the session HANDLE from the session name.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSession, FrameworkunifiedOpenSessionWithData, FrameworkunifiedCloseSession, FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetOpenSessionHandle(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetOpenSessionSyncHandle
+/// \~english @par Brief
+/// API to get the session ID without using the received data of ProtocolOpenSessionAck.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE for Application (FrameworkunifiedCreateDispatcherWithoutLoop() HANDLE acquired in)
+/// \~english @param [in] tAck
+/// OpenSessionAck - Pointer to the OpenSessionAck structure
+/// \~english @par
+/// OpenSessionAck Structure
+/// \~english @code
+/// #define MAX_QUEUE_NAME_SIZE 20
+/// typedef struct _OpenSessionAck
+/// {
+/// EFrameworkunifiedStatus eStatus; /* Status */
+/// UI_32 sessionId; /* Session ID */
+/// CHAR cSessionName[MAX_QUEUE_NAME_SIZE]; /* Session Name(20byte) */
+/// UI_32 sessionType; /* Session Type */
+/// }OpenSessionAck;
+/// @endcode
+/// \~english @retval HANDLE HANDLE for the session
+/// \~english @retval NULL Failure to HANDLE acquisition for the session
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// Under the following conditions, HANDLE is returned as NULL.
+/// - HANDLE specified in the argument (hApp) is NULL.
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid).
+/// - Data size received by the HANDLE specified in the argument (hApp) is not the data size of
+/// ProtocolOpenSessionAck message.
+/// - Size of the session name of the data received by the specified HANDLE (hApp) in the argument is more than
+/// 20byte.
+/// - Not be able to acquire the memory of the buffer for the internal processing.
+/// - Session name is NULL of data received by the HANDLE specified in the argument (hApp).
+/// - It failed to generate the message queue name.
+/// - It failed to open the message queue.
+/// \~english @par Detail
+/// This API is to be used at the time of the synchronous type specification. \n
+/// Use the session name of OpenSessionAck structure specified by the argument, to get the session HANDLE.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSessionSync, FrameworkunifiedOpenSessionWithDataSync, FrameworkunifiedCloseSessionSync, FrameworkunifiedGenerateNewSessionId,
+/// FrameworkunifiedGetSessionId
+////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetOpenSessionSyncHandle(HANDLE hApp, OpenSessionAck *tAck);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGenerateSessionHandle
+/// API will be called by server on receiving the Open session request to Create session
+///
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the framework application
+/// \param [in] pServiceName
+/// PCSTR - Service Name
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+///
+/// \see FrameworkunifiedOpenSession, FrameworkunifiedCloseSession, FrameworkunifiedGenerateNewSessionId
+/// FrameworkunifiedGetSessionId
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGenerateSessionHandle(HANDLE hApp, PCSTR pServiceName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCloseSession
+/// \~english @par Brief
+/// API to close the session.
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService HANDLE acquired in)
+/// \~english @param [in] hSession
+/// HANDLE - Handle to the session(FrameworkunifiedOpenSession HANDLE acquired in)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hSession) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hSession) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) during the transmission of the session message to the service
+/// occurs. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// - Message queue type of HANDLE specified in the argument (hSession) is mismatch.(eQTypeSender or
+/// eQTypeReveiver) [eFrameworkunifiedStatusInvldHndlType]
+/// - Failed to close message queue HANDLE specified in the argument (hSession). [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Send a message of the session close request to the service.\n
+/// And close message queue of the session.
+/// This is asynchronous API.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSession, FrameworkunifiedOpenSessionWithData, FrameworkunifiedGetOpenSessionHandle
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseSession(HANDLE hService, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCloseSessionSync
+/// \~english @par Brief
+/// API to close the session (synchronous).
+/// \~english @param [in] hService
+/// HANDLE - Handle to the service(FrameworkunifiedOpenService HANDLE acquired in)
+/// \~english @param [in] hSession
+/// HANDLE - Handle to the session(FrameworkunifiedOpenSessionSync HANDLE acquired in)
+/// \~english @param [out] ack
+/// CloseSessionAck - Pointer to the response data of the session close
+/// \~english @par
+/// CloseSessionAck Structure
+/// \~english @code
+/// typedef struct _CloseSessionAck
+/// {
+/// UI_32 sessionId; /* Session ID */
+/// EFrameworkunifiedStatus eStatus; /* Status */
+/// }CloseSessionAck;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusOK [eStatus in CloseSessionAck]Success in serivice side.
+/// \~english @retval eFrameworkunifiedStatusFail [eStatus in CloseSessionAck]Some sort of error occurred in service side.
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure (API)
+/// - CloseSessionAck specified in the argument (ack) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (Service) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hService) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hSession) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - HANDLE specified in the argument (hSession) is not appropriate (which is invalid). [eFrameworkunifiedStatusNullPointer]
+/// - It failed to open the message queue for the response received [eFrameworkunifiedStatusFail]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - It fails to get the message storage buffer for the response received. [eFrameworkunifiedStatusFail]
+/// - Random number generation to fail for the sequence ID of the message for transmission. [eFrameworkunifiedStatusFail]
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Message queue HANDLE name in the HANDLE specified in the argument (hService) exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Message queue type of HANDLE specified in the argument (hService) is not a transmission type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - To the service session message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmit and receive file descriptor of the session message to the service.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) occurs during the transmission and reception of the session message
+/// to the service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmit buffer of the message for the session to the service is illegal.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the sending and receiving of a session message to the service. [eFrameworkunifiedStatusFail]
+/// - In the shared memory access for the session message to be sent to service failed. [eFrameworkunifiedStatusErrOther]
+/// - It failed to Socket connection of the response message for the reception from the service. [eFrameworkunifiedStatusFail]
+/// - The wait control of the response message received from the service failed. [eFrameworkunifiedStatusFail]
+/// - Interruption by the system call (signal) to wait in the response message received from the service has
+/// occurred. [eFrameworkunifiedStatusFail]
+/// - In response message at the time of failure to receive from the service, it failed to re-connection of the
+/// Socket. [eFrameworkunifiedStatusBadConnection]
+/// - Failed to close message queue HANDLE specified in the argument (hSession). [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue type of HANDLE specified in the argument (hSession) is mismatch.(eQTypeSender or
+/// eQTypeReveiver) [eFrameworkunifiedStatusInvldHndlType]
+/// \~english @par Conditions of processing failure (eStatus in CloseSessionAck)
+/// - Any errors occur during in service side. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Send a message synchronously of the session close request to the service.\n
+/// And close message queue of the session.\n
+/// The eStatus value in CloseSessionAck is dependent on service. So we indecates major return value.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSessionSync, FrameworkunifiedOpenSessionWithDataSync
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCloseSessionSync(HANDLE hService, HANDLE hSession, CloseSessionAck *ack);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGenerateNewSessionId
+/// Used on the Server side to get the next session id
+///
+///
+/// \return sessionID
+/// UI_32 - session ID value
+///
+///
+/// \see FrameworkunifiedOpenSession, FrameworkunifiedGetOpenSessionHandle, FrameworkunifiedCloseSession,
+/// FrameworkunifiedGetSessionId
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGenerateNewSessionId();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetSessionId
+/// \~english @par Brief
+/// Returns the session id corresponding to the given session handle.
+/// \~english @param [in] hSession
+/// HANDLE - Handle to the session(FrameworkunifiedMcOpenSender HANDLE acquired in)
+/// \~english @retval UI_32 session ID value
+/// \~english @retval MAX_SESSION_ID_VAL Failed to get session ID value
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hSession) is NULL. [MAX_SESSION_ID_VAL]
+/// - HANDLE specified in the argument (hSession) is not appropriate (which is invalid). [MAX_SESSION_ID_VAL]
+/// \~english @par Detail
+/// Returns the session id corresponding to the given session handle.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedOpenSession, FrameworkunifiedOpenSessionSync, FrameworkunifiedOpenSessionWithData, FrameworkunifiedOpenSessionWithDataSync, \n
+/// FrameworkunifiedGetOpenSessionHandle, FrameworkunifiedGetOpenSessionSyncHandle, FrameworkunifiedGetCurrentSessionHandle, \n
+/// FrameworkunifiedMcOpenSender, FrameworkunifiedCreateSession
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetSessionId(HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetMsgSessionId
+/// \~english @par Brief
+/// Get session ID from received message.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval UI_32 session ID value
+/// \~english @retval MAX_SESSION_ID_VAL Failed to get session ID value
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been
+/// done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [MAX_SESSION_ID_VAL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [MAX_SESSION_ID_VAL]
+/// \~english @par Detail
+/// Get session ID from received message.\n
+/// Mostly, this API is used to get session ID from message received by callback function that is registered to
+/// Dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedGetSessionHandle
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetMsgSessionId(HANDLE hApp);
+
+
+
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Defer Message APIs
+////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetDeferQueueCnt
+/// Get the number of messages in the defer queue
+///
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the App / Thread
+///
+/// \return count
+/// UI_32 - number of messages on Defered Queue
+///
+///
+/// \see FrameworkunifiedDeferMessage, FrameworkunifiedRetrieveDeferMessage
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetDeferQueueCnt(HANDLE hApp);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedIsDeferQueueEmpty
+/// \~english @par Brief
+/// Empty determination of DeferQueue
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval BOOL DeferQueue status (TRUE: empty or FALSE: not empty)
+/// \~english @retval TRUE Judgment failure
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [TRUE]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [TRUE]
+/// \~english @par Detail
+/// Returns whether the DeferQueue in the application-handle given by the arguments is empty
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see FrameworkunifiedDeferMessage, FrameworkunifiedRetrieveDeferMessage
+/// FrameworkunifiedIsDeferQueueEmpty
+/// Get the number of messages in the defer queue
+///
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the App / Thread
+///
+/// \return count
+/// BOOL - Indicates if the defer queue is empty, TRUE (empty), FALSE (not empty)
+///
+///
+/// \see FrameworkunifiedDeferMessage, FrameworkunifiedRetrieveDeferMessage, FrameworkunifiedGetDeferQueueCnt
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsDeferQueueEmpty(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDeferMessage
+/// \~english @par Brief
+/// Push messages to the DeferQueue
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Push received messages in the application handles specified by the arguments to the DeferQueue.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Set Get
+/// \~english @see FrameworkunifiedRetrieveDeferMessage
+/// FrameworkunifiedDeferMessage
+/// Defers the current message; Pushes the message on to a defer msg queue
+///
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the App / Thread
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+///
+/// \see FrameworkunifiedClearDeferMessages, FrameworkunifiedRetrieveDeferMessage
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDeferMessage(HANDLE hApp);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedClearDeferMessages
+/// Clear all the defer messages
+///
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the App / Thread
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+///
+/// \see FrameworkunifiedDeferMessage, FrameworkunifiedRetrieveDeferMessage
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedClearDeferMessages(HANDLE hApp);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedRetrieveDeferMessage
+/// \~english @par Brief
+/// Write Messages Registered in DeferQueue to FD
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Write the messages registered in the DeferQueue in the application handler specified by arguments to the FD.\n
+/// This allows the main loop to receive the message.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Set Get
+/// \~english @see FrameworkunifiedDeferMessage
+/// FrameworkunifiedRetrieveDeferMessage
+/// Enables Checking for deferred message and retrieves messages when
+/// callback returns to the dispatcher.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the App / Thread
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+///
+/// \see FrameworkunifiedDeferMessage, FrameworkunifiedClearDeferMessages
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRetrieveDeferMessage(HANDLE hApp);
+
+// TODO(framework_unified) : clean up the old FrameworkunifiedRegisterPersistentStorage api's
+// 20110429_brp
+// defined for backward compatibility; will be removed once the persistence feature is finalized
+EFrameworkunifiedStatus FrameworkunifiedRegisterPersistentStorage(HANDLE hApp, PCSTR pFullFilePath);
+EFrameworkunifiedStatus FrameworkunifiedReleaseFileToPersistentStorage(HANDLE hApp, PCSTR pFullFilePath, BOOL persist);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedRegisterEvent
+/// \~english @par Brief
+/// Registering Applications for Delivery of Service-Specific Events
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @param [in] uiEventId
+/// UI_32 - Event ID (Identification ID on the service's protocol)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sessions for services is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for sessions intended for the service [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for services [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for the services [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Issues a request for registering the application that executes this API to the delivery target of the device-specific events of the service associated with the handle (hSession) specified in the arguments.\n
+/// The application specifies the type of events to receive in the uiEventId of arguments.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message. The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API is deprecated and should now use FrameworkunifiedSubscribeToSessionEventWithCallback.
+/// - When this API is used, the application shall use a FrameworkunifiedAttachCallbackToDispatcher or the like to register callback functions in its own Dispatcher for handling events.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackToDispatcherWithFd,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents
+///
+/// API to register for event of a service.
+/// This API is depricated, use FrameworkunifiedSubscribeToSessionEventWithCallback.
+///
+/// \param [in] hSession
+/// HANDLE - Handle to the application session
+/// \param [in] uiEventId
+/// UI_32 - Event registering for.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents, FrameworkunifiedBroadcastEvent, FrameworkunifiedDefineStateEvents,
+/// FrameworkunifiedPublishEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRegisterEvent(HANDLE hSession, UI_32 uiEventId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedRegisterEvents
+/// \~english @par Brief
+/// Registering Applications for Delivery of Service-Specific Events
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @param [in] puiEventsArray
+/// PVOID - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID array (0 to 4294967295)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (puiEventsArray) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldBuf]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sessions for services is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for sessions intended for the service [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for services [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for the services [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages for sessions for services [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Issues a request for registering the application that executes this API to the delivery target of the device-specific events of the service associated with the handle (hSession) specified in the arguments.\n
+/// The application specifies more than one type of events to receive in the puiEventsArray of arguments.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message. The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API is deprecated and should now use FrameworkunifiedSubscribeToSessionEventsWithCallbacks.
+/// - When this API is used, the application shall use a FrameworkunifiedAttachCallbackToDispatcher or the like to register callback functions in its own Dispatcher for handling events.
+/// - The maximum number of event IDs that can be registered depends on the size that can be allocated as the area for the event ID array.\n
+/// Therefore, the API caller should consider the size of the event ID array and define the number of event IDs (uiListSize).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedRegisterEvent, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackToDispatcherWithFd,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents
+///
+/// API to register for events of a service.
+/// This API is depricated, use FrameworkunifiedSubscribeToSessionEventsWithCallbacks.
+///
+/// \param [in] hSession
+/// HANDLE - Handle to the application session
+/// \param [in] puiEventsArray
+/// PVOID - Array of events registering for.
+/// \param [in] uiListSize
+/// UI_32 - count of elements in array.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedRegisterEvent, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents, FrameworkunifiedBroadcastEvent, FrameworkunifiedDefineStateEvents,
+/// FrameworkunifiedPublishEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRegisterEvents(HANDLE hSession, PVOID puiEventsArray, UI_32 uiListSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnRegisterEvent
+/// \~english @par Brief
+/// Unregistering Service-Specific Events from Delivery
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @param [in] uiEventId
+/// UI_32 - Event ID (Identification ID on the service's protocol)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sessions for services is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for sessions intended for the service [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for services [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for the services [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Issues a request to unregister the application that executed this API from the delivery target of the service-specific event associated with the handle (hSession) specified in the arguments.\n
+/// The application specifies events that are no longer needed for delivery in the uiEventId of arguments.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API is deprecated and should now use FrameworkunifiedUnSubscribeSessionEventWithCallback.
+/// - When this API is used, the application shall unregister callbacks for events registered in its own Dispatcher by means of FrameworkunifiedDetachCallbackFromDispatcher, etc.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedRegisterEvent, FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcherWithFd, FrameworkunifiedDetachCallbacksFromDispatcherWithFd,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks,
+/// FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents
+///
+/// API to unregister from event of a service.
+/// This API is depricated, use FrameworkunifiedUnSubscribeSessionEventsWithCallbacks.
+///
+/// \param [in] hSession
+/// HANDLE - Handle to the application session
+/// \param [in] uiEventId
+/// UI_32 - Event registering for.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnRegisterEvents, FrameworkunifiedRegisterEvent, FrameworkunifiedBroadcastEvent, FrameworkunifiedDefineStateEvents, FrameworkunifiedPublishEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterEvent(HANDLE hSession, UI_32 uiEventId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnRegisterEvents
+/// \~english @par Brief
+/// Unregistering Service-Specific Events from Delivery
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @param [in] puiEventsArray
+/// PVOID - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID array (0 to 4294967295)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (puiEventsArray) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldBuf]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sessions for services is full [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptor for sending messages for sessions intended for the service [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending session-specific messages for services [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of send buffers for sessions intended for services [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for the services [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages for sessions for services [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Issues a request to unregister the application that executed this API from the delivery target of the service-specific event associated with the handle (hSession) specified in the arguments.\n
+/// The application specifies the unneeded events in the puiEventsArray of arguments.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API is deprecated and should now use FrameworkunifiedUnSubscribeSessionEventsWithCallbacks.
+/// - After executing this API, the callback of the event registered in the Dispatcher of the application itself must be unregistered by FrameworkunifiedDetachCallbackFromDispatcher, etc.
+/// - The maximum number of event IDs that can be registered depends on the size that can be allocated as the area for the event ID array.\n
+/// Therefore, the API caller should consider the size of the event ID array and define the number of event IDs (uiListSize).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedRegisterEvent, FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcherWithFd, FrameworkunifiedDetachCallbacksFromDispatcherWithFd,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks,
+/// FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents
+///
+/// API to unregister from events of a service.
+/// This API is depricated, use FrameworkunifiedUnSubscribeSessionEventsWithCallbacks.
+///
+/// \param [in] hSession
+/// HANDLE - Handle to the application session
+/// \param [in] puiEventsArray
+/// PVOID - Array of events registering for.
+/// \param [in] uiListSize
+/// UI_32 - count of elements in array.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnRegisterEvent, FrameworkunifiedRegisterEvent, FrameworkunifiedBroadcastEvent, FrameworkunifiedDefineStateEvents, FrameworkunifiedPublishEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterEvents(HANDLE hSession, PVOID puiEventsArray, UI_32 uiListSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDefineStateEvents
+/// \~english @par Brief
+/// Subscribing to Application-Specific Events in the Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] puiEvents
+/// PVOID - Pointer to an array (UI_32 arrays) of event IDs (identification IDs on the service protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID array (0 to 4294967295)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (puiEvents) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Register unique events in your Dispatcher that applications can deliver to other applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// For application-specific events registered by this API, the event is delivered by Dispatcher when the application executes the FrameworkunifiedPublishPublicEvent.\n
+/// Events are distributed to applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API is deprecated, use FrameworkunifiedDefinePublicStateEvents or FrameworkunifiedDefinePrivateStateEvents now.
+/// - The maximum number of event IDs that can be registered depends on the size that can be allocated as the area for the event ID array.\n
+/// Therefore, the API caller should consider the size of the event ID array and define the number of event IDs (uiListSize).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents,
+/// FrameworkunifiedPublishEvent, FrameworkunifiedBroadcastEvent, FrameworkunifiedPublishPublicEvent, FrameworkunifiedPublishPrivateEvent
+/// FrameworkunifiedRegisterEvent, FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks,
+///
+/// API to define the state events of the service.
+/// This API is depricated, use FrameworkunifiedDefinePublicStateEvents or FrameworkunifiedDefinePrivateStateEvents.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] puiEvents
+/// PVOID - Array of state events or single state event.
+/// \param [in] uiListSize
+/// UI_32 - size of events list.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedRegisterEvent, FrameworkunifiedBroadcastEvent, FrameworkunifiedPublishEvent, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefineStateEvents(HANDLE hApp, PVOID puiEvents, UI_32 uiListSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedPublishEvent
+/// \~english @par Brief
+/// Deliver application-specific events
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] pClientName
+/// PCSTR - Destination application name (distributed to all registered applications when NULL is specified),
+/// \~english @param [in] pData
+/// PCVOID - Pointer to trasmission data
+/// \~english @param [in] iLength
+/// UI_32 - Transmission data length
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - The events to be delivered must be specified in a FrameworkunifiedDefinePublicStateEvents, etc.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the application name of the delivery destination in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - Sessioninformation is not found with the application being delivered to within the handles (hApp) specified in the arguments. [eFrameworkunifiedStatusErrOther]
+/// - If the destination handles are inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is NULL [eFrameworkunifiedStatusErrOther]
+/// - If the application name in the destination handles is not set, [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - When the send data length (iLength) specified in the arguments is not 0 and the pointer to the send data pointer (pData) is NULL, [eFrameworkunifiedStatusErrOther]
+/// - When the name of the application in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle is NULL, [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - If the message queue type of the destination handler is not the send type [eFrameworkunifiedStatusErrOther]
+/// - When the message queue is full [eFrameworkunifiedStatusErrOther]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrOther]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrOther]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusErrOther]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusErrOther]
+/// - Failed to access shared memory for sending messages [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Delivers application-specific events to subscribed applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// The delivery destination of events is the application specified by the argument pClientName or (when the argument pClientName is NULL)
+/// all the applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks etc.\n
+/// The data (pData) to be distributed is the same for all distribution destinations.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation cannot be guaranteed if the size of the area indicated by the pointer (pData) address to the send data does not match the size specified by the send data length (iLength) address.
+/// \~english @par
+/// This API is deprecated, use FrameworkunifiedPublishPublicEvent or FrameworkunifiedPublishPrivateEvent now.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents,
+/// FrameworkunifiedBroadcastEvent, FrameworkunifiedPublishPublicEvent,
+/// FrameworkunifiedRegisterEvent, FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackToDispatcherWithFd,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcherWithFd, FrameworkunifiedDetachCallbacksFromDispatcherWithFd,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to publish the event to one of the client subscribed to this event.
+/// This API can be used to publish the event to all the clients subscribed to this event by
+/// passing pClientName as NULL.
+/// This API is depricated, use FrameworkunifiedPublishPrivateEvent or FrameworkunifiedPublishPublicEvent.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] uiEventId
+/// UI_32 - Event id of Message
+/// \param [in] pClientName
+/// PCSTR - Name of the client
+/// \param [in] pData
+/// PCVOID - Data buffer
+/// \param [in] iLength
+/// UI_32 - Size of data buffer
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedRegisterEvent, FrameworkunifiedBroadcastEvent, FrameworkunifiedDefineStateEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishEvent(HANDLE hApp, UI_32 uiEventId, PCSTR pClientName, PCVOID pData, UI_32 iLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedBroadcastEvent
+/// \~english @par Brief
+/// Broadcast application-specific events
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] pData
+/// PCVOID - Pointer to trasmission data
+/// \~english @param [in] iLength
+/// UI_32 - Transmission data length
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - The events to be delivered must be specified in a FrameworkunifiedDefinePublicStateEvents, etc.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusNullPointer]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusNullPointer]
+/// - When the application name of the delivery destination in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - Sessioninformation is not found with the application being delivered to within the handles (hApp) specified in the arguments. [eFrameworkunifiedStatusErrOther]
+/// - If the destination handles are inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is NULL [eFrameworkunifiedStatusErrOther]
+/// - If the application name in the destination handles is not set, [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - When the send data length (iLength) specified in the arguments is not 0 and the pointer to the send data pointer (pData) is NULL, [eFrameworkunifiedStatusErrOther]
+/// - When the name of the application in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle is NULL, [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - If the message queue type of the destination handler is not the send type [eFrameworkunifiedStatusErrOther]
+/// - When the message queue is full [eFrameworkunifiedStatusErrOther]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrOther]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrOther]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusErrOther]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Broadcast application-specific events to all registered applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// Events are delivered to all applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.
+/// The data (pData) to be distributed is the same for all distribution destinations.
+/// \~english @par
+/// This API is deprecated and should now use FrameworkunifiedPublishPublicEvent.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedDefineStateEvents, FrameworkunifiedDefinePublicStateEvents,
+/// FrameworkunifiedPublishEvent, FrameworkunifiedPublishPublicEvent,
+/// FrameworkunifiedRegisterEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents,
+/// FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedAttachCallbackToDispatcher,
+/// FrameworkunifiedAttachCallbacksToDispatcherWithFd, FrameworkunifiedAttachCallbackToDispatcherWithFd,
+/// FrameworkunifiedDetachCallbackFromDispatcher, FrameworkunifiedDetachCallbacksFromDispatcher,
+/// FrameworkunifiedDetachCallbackFromDispatcherWithFd, FrameworkunifiedDetachCallbacksFromDispatcherWithFd,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to publish the event to all the clients subscribed to this event.
+/// This API is depricated, use FrameworkunifiedPublishPublicEvent.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] uiEventId
+/// UI_32 - Event id of Message
+/// \param [in] pData
+/// PCVOID - Data buffer
+/// \param [in] iLength
+/// UI_32 - Size of data buffer
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedRegisterEvent, FrameworkunifiedPublishEvent, FrameworkunifiedDefineStateEvents, FrameworkunifiedUnRegisterEvent, FrameworkunifiedUnRegisterEvents
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedBroadcastEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 iLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDefinePublicStateEvents
+/// \~english @par Brief
+/// Subscribing to Application-Specific Events in the Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] puiEvents
+/// PUI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID array (0 to 4294967295)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (puiEvents) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Register unique events in your Dispatcher that applications can deliver to other applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// For application-specific events registered by this API, the event is delivered by Dispatcher when the application executes the FrameworkunifiedPublishPublicEvent.\n
+/// Events are distributed to all applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.
+/// \~english @par
+/// The difference from FrameworkunifiedDefinePrivateStateEvents is that when the Dispatcher distributes events registered by this API, the same data is distributed to all registered applications.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - The maximum number of event IDs that can be registered depends on the size that can be allocated as the area for the event ID array.\n
+/// Therefore, the API caller should consider the size of the event ID array and define the number of event IDs (uiListSize).
+/// - FrameworkunifiedDefinePrivateStateEvents should be used to deliver individual data by registered application sessions.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedPublishPublicEvent, FrameworkunifiedDefinePrivateStateEvents, FrameworkunifiedPublishPrivateEvent,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to define the public state events of the service.
+/// Public Event means the data associated with the event will be same for all the clients
+/// subscribed to it.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] puiEvents
+/// PUI_32 - Array of state events or single state event.
+/// \param [in] uiListSize
+/// UI_32 - size of events list.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedDefinePrivateStateEvents
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefinePublicStateEvents(HANDLE hApp, PUI_32 puiEvents, UI_32 uiListSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDefinePrivateStateEvents
+/// \~english @par Brief
+/// Subscribing to Application-Specific Events in the Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] puiEvents
+/// PUI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID array (0 to 4294967295)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (puiEvents) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Register unique events in your Dispatcher that applications can deliver to other applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// For application-specific events registered by this API, the event is delivered by Dispatcher when the application executes the FrameworkunifiedPublishPrivateEvent.\n
+/// Events are distributed to applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.
+/// \~english @par
+/// The difference from FrameworkunifiedDefinePublicStateEvents is that when the Dispatcher distributes events registered by this API, it distributes individual data by sessions of the registered application.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - The maximum number of event IDs that can be registered depends on the size that can be allocated as the area for the event ID array.\n
+/// Therefore, the API caller should consider the size of the event ID array and define the number of event IDs (uiListSize).
+/// - Use FrameworkunifiedDefinePublicStateEvents to deliver broadcasts to all registered applications.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedPublishPrivateEvent, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedPublishPublicEvent,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to define the private state events of the service.
+/// Private event means the data associated with the event will be specific for
+/// every session of all the clients on which it has subscribed.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] puiEvents
+/// PUI_32 - Array of state events or single state event.
+/// \param [in] uiListSize
+/// UI_32 - size of events list.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedDefinePublicStateEvents
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDefinePrivateStateEvents(HANDLE hApp, PUI_32 puiEvents, UI_32 uiListSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSubscribeToSessionEventWithCallback
+/// \~english @par Brief
+/// Register delivery of service-specific events and set callback for receiving events
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - Event ID (Identification ID on the service protocol) (PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD)
+/// \~english @param [in] fpOnCmd
+/// CbFuncPtr - Pointer to callback function when event is received
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the callback function pointer (fpOnCmd) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sets the callback function for the event ID (iCmd) specified in the application Dispatcher.\n
+/// Then, it issues a request for registering the application that executed this API to the delivery target of the device-specific events of the service associated with the handle (hSession) specified in the argument.\n
+/// The application specifies the type of event to be received from the service by the event ID (uiEventId) of the arguments.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message. The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedSubscribeToSessionEventsWithCallbacks, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used for subscribing to single event of a service.
+/// This API also attaches the session event with callback.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] uiEventId
+/// UI_32 - Event id
+/// \param [in] fpOnCmd
+/// CbFuncPtr - pointer to callback function
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSubscribeToSessionEventsWithCallbacks
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventWithCallback(HANDLE hApp, UI_32 uiEventId, CbFuncPtr fpOnCmd, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSubscribeToSessionEventsWithCallbacks
+/// \~english @par Brief
+/// Registering multiple service-specific events for delivery and configuring callback settings when an event is received
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pEventHandler
+/// const FrameworkunifiedProtocolCallbackHandler* - Pointer to array of event handler structure
+/// \~english @param [in] uiHandlerCount
+/// UI_32 - Number of event handlers to register (0 to 214748362)
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @par
+/// FrameworkunifiedProtocolCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedProtocolCallbackHandler
+/// {
+/// UI_32 iCmd; /* Event ID (Identification ID on the service's protocol) */
+/// CbFuncPtr callBack; /* Reference to an XML stream */
+/// }FrameworkunifiedProtocolCallbackHandler;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the event handler structure array (pEventHandler) specified by arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Sets the callback functions for the IDs specified by the pEventHandler arguments in the Dispatcher of the application.\n
+/// Then, it issues a request for registering the application that executed this API to the delivery target of the device-specific events of the service associated with the handle (hSession) specified in the argument.\n
+/// The application specifies the type of event to be received from the service by the event ID.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message. The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the callback function pointer in the event handler structure (pEventHandler) specified in the arguments is NULL, the callback function up to NULL is registered.\n
+/// Later, FrameworkunifiedSendMsg() is executed inside this API, and the result becomes the return code of this API.\n
+/// Do not set NULL in the callback function pointer because operation cannot be guaranteed.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used for subscribing to multiple events of a service.
+/// This API also attaches the session event with callbacks.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pEventHandler
+/// FrameworkunifiedProtocolCallbackHandler - Array of event handler structures
+/// \param [in] uiHandlerCount
+/// UI_32 - number of event handlers
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSubscribeToSessionEventWithCallback
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventsWithCallbacks(HANDLE hApp, const FrameworkunifiedProtocolCallbackHandler *pEventHandler,
+ UI_32 uiHandlerCount, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnSubscribeSessionEventWithCallback
+/// \~english @par Brief
+/// Undeliver service-specific events and delete callbacks when events are received
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - Event ID (Identification ID on the service protocol) (PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD)
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// - If the service specified by the parameter hSession is not registered in the Dispatcher, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Issues a request to unregister the application that executed this API from the delivery target of device-specific events
+/// of services associated with the handle (hSession) specified in the arguments.\n
+/// Then, the callback functions for the specified event ID (iCmd) are deleted from the application Dispatcher.\n
+/// The application specifies the type of event to be undelivered from the service by the event ID (uiEventId) of the arguments.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message.
+/// The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedUnSubscribeSessionEventsWithCallbacks, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks
+///
+/// API to unsubscribe from event of a service. Also detaches callback.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] uiEventId
+/// UI_32 - Event id
+/// \param [in] hSession
+/// HANDLE - Session Handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventWithCallback(HANDLE hApp, UI_32 uiEventId, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+/// \~english @par Brief
+/// Undeliver multiple service-specific events and delete callbacks when an event is received
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pEventsArray
+/// PUI_32 - Pointer to an array of Event IDs (Identification IDs in the service's protocol)
+/// \~english @param [in] uiListSize
+/// UI_32 - Number of elements in the event ID (identification ID in the service protocol) array (1 to 1073741813)
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (obtained by FrameworkunifiedOpenSession)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Services and sessions are established (FrameworkunifiedOpenSession)
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle in the handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hSession) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle specified in the argument (hSession) is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the array (pEventsArray) of event IDs specified by arguments is NULL, [eFrameworkunifiedStatusInvldBuf]
+/// - When the name of the application in the handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the handle (hSession) specified in the argument exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hSession) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// - When the number of elements (uiListSize) of the event ID array specified by the arguments is 0, [eFrameworkunifiedStatusInvldParam]
+/// - If the service specified by the parameter hSession is not registered in the Dispatcher, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Issues a request to unregister the application that executed this API from the delivery target of the plurality of unique events of the service associated with the handle (hSession) specified by the argument.\n
+/// Then, the callback functions for the IDs specified in the pEventsArray arguments are deleted from the application Dispatcher.\n
+/// The application specifies the type of event to be undelivered from the service by the event ID (pEventsArray) of the arguments.\n
+/// (The event ID of this API refers to the identification ID on the protocol of the service, and the application identifies the content of the message. The specifiable service-specific events are events set by the service, such as the FrameworkunifiedDefinePublicStateEvents.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks
+///
+/// API to unsubscribe from multiple events of a service. Also detaches callbacks.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] pEventsArray
+/// PUI_32 - Array of events id's.
+/// \param [in] uiListSize
+/// UI_32 - count of elements in array.
+/// \param [in] hSession
+/// HANDLE - Session Handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnSubscribeSessionEventWithCallback
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventsWithCallbacks(HANDLE hApp, PUI_32 pEventsArray, UI_32 uiListSize,
+ HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedPublishPublicEvent
+/// \~english @par Brief
+/// Broadcast application-specific events
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] pData
+/// PCVOID - Pointer to trasmission data
+/// \~english @param [in] uiLength
+/// UI_32 - Transmission data length
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - The events to be delivered must be specified in the FrameworkunifiedDefinePublicStateEvents.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the application name of the delivery destination in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - Sessioninformation is not found with the application being delivered to within the handles (hApp) specified in the arguments. [eFrameworkunifiedStatusErrOther]
+/// - If the destination handles are inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is NULL [eFrameworkunifiedStatusErrOther]
+/// - If the application name in the destination handles is not set, [eFrameworkunifiedStatusErrOther]
+/// - If the message queue handle in the destination handle is inappropriate (disabled) [eFrameworkunifiedStatusErrOther]
+/// - When the send data length (uiLength) specified in the arguments is not 0 and the pointer to the send data pointer (pData) is NULL [eFrameworkunifiedStatusErrOther]
+/// - When the name of the application in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle is NULL, [eFrameworkunifiedStatusErrOther]
+/// - When the name of the message queue in the destination handle exceeds 20 bytes [eFrameworkunifiedStatusErrOther]
+/// - If the message queue type of the destination handler is not the send type [eFrameworkunifiedStatusErrOther]
+/// - When the message queue is full [eFrameworkunifiedStatusErrOther]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrOther]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrOther]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusErrOther]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusErrOther]
+/// - Failed to access shared memory for sending messages [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Broadcast application-specific events to subscribed applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// Events are delivered to all applications registered by FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.\n
+/// The data (pData) to be distributed is the same for all distribution destinations.
+/// \~english @par
+/// FrameworkunifiedPublishPrivateEvent should be used to deliver individual data by registered application sessions.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedDefinePrivateStateEvents, FrameworkunifiedPublishPrivateEvent,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to publish the event to all the client over all the session it is subscribed to.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] uiEventId
+/// UI_32 - Event id of Message
+/// \param [in] pData
+/// PCVOID - Data buffer
+/// \param [in] uiLength
+/// UI_32 - Size of data buffer
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedPublishPrivateEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishPublicEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedPublishPrivateEvent
+/// \~english @par Brief
+/// Delivers application-specific events to a specified session
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] uiEventId
+/// UI_32 - The event ID to deliver (the identification ID on the service's protocol)
+/// \~english @param [in] pData
+/// PCVOID - Pointer to trasmission data
+/// \~english @param [in] uiLength
+/// UI_32 - Transmission data length
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusServNotFound Perform the event processing
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - The events to be delivered must be specified in the FrameworkunifiedDefinePrivateStateEvents.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the application handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application handle (hApp) specified in the arguments is not appropriate (disabled) [eFrameworkunifiedStatusInvldParam]
+/// - If the session handle (hSession) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the sessionhandle (hSession) specified in the arguments is not appropriate (is not valid) [eFrameworkunifiedStatusInvldParam]
+/// - The event ID (uiEventId) specified in the parameter is not registered as an event to be delivered to the Dispatcher. [eFrameworkunifiedStatusServNotFound]
+/// - When the session handle (hSession) specified in the arguments is not registered as the delivery destination in the Dispatcher [eFrameworkunifiedStatusServNotFound]
+/// - When the message queue handle in the session handle (hSession) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the application name in the session handle (hSession) specified by the arguments is not set [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue handle in the session handle (hSession) specified by the arguments is invalid. [eFrameworkunifiedStatusInvldHandle]
+/// - When the send data length (uiLength) specified in the arguments is not 0 and the pointer to the send data pointer (pData) is NULL [eFrameworkunifiedStatusInvldBuf]
+/// - When the name of the application in the session handle (hSession) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue in the session handle (hSession) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue in the session handle (hSession) specified in the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the session handle (hSession) specified in the parameter is not the send type [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Delivers application-specific events to specified sessions in registered applications.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// Events are delivered to the sessions specified in the hSession of arguments among the applications registered in the FrameworkunifiedSubscribeToSessionEventsWithCallbacks, etc.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - When broadcasting to all registered applications, use FrameworkunifiedPublishPublicEvent.
+/// - This API shall be executed from within a callback function, and a session-use handle acquired using FrameworkunifiedGetCurrentSessionHandle shall be passed to the parameter hSession.
+/// - Operation cannot be guaranteed if the size of the area indicated by the pointer (pData) address to the send data does not match
+/// the size specified by the send data length (iLength) address.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see FrameworkunifiedDefinePrivateStateEvents, FrameworkunifiedDefinePublicStateEvents, FrameworkunifiedPublishPublicEvent,
+/// FrameworkunifiedSubscribeToSessionEventWithCallback, FrameworkunifiedSubscribeToSessionEventsWithCallbacks,
+/// FrameworkunifiedUnSubscribeSessionEventWithCallback, FrameworkunifiedUnSubscribeSessionEventsWithCallbacks
+///
+/// This API is used to publish the event over session to the client subscribed to it using session handle.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application framework
+/// \param [in] uiEventId
+/// UI_32 - Event id of Message
+/// \param [in] pData
+/// PCVOID - Data buffer
+/// \param [in] uiLength
+/// UI_32 - Size of data buffer
+/// \param [in] hSession
+/// HANDLE - Session Handle
+///
+/// \return EFrameworkunifiedStatus
+/// eFrameworkunifiedStatusOK - If publish event success
+/// eFrameworkunifiedStatusInvldParam - Invalid parameter passed
+/// eFrameworkunifiedStatusServNotFound - If event uiEventId not subscribed on hSession by a client
+/// Any other values returned by FrameworkunifiedSendMsg
+///
+/// \see FrameworkunifiedPublishPublicEvent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishPrivateEvent(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetServiceAvailabilityTable
+/// returns the list that stores the available services
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application session
+
+/// \return ServiceAvailabilityList
+/// ServiceAvailabilityTable - ServiceAvailabilityList
+///
+/// \see FrameworkunifiedRegisterEvent
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+std::map<std::string, EFrameworkunifiedServiceAvailableStatus> FrameworkunifiedGetServiceAvailabilityTable(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedIsStateMachineApp
+/// \~english @par Brief
+/// Returns the presence or absence of a State Machine Application
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval BOOL State Machine Application existence (TRUE: existent/FALSE: nonexistent)
+/// \~english @retval FALSE Judgment failure
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [FALSE]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [FALSE]
+/// \~english @par Detail
+/// Determines whether there is a State Machine Application from the application handle specified by the arguments, and returns the handle.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see FrameworkunifiedSetStateMachine, FrameworkunifiedHSMDispatcherWithArguments
+///
+/// FrameworkunifiedIsStateMachineApp
+/// Returns TRUE if it's a state machine application else FALSE.
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application session
+///
+/// \return TRUE - if a state machine application.
+/// FALSE - if not a state machine application
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsStateMachineApp(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetXMLConfigHandle
+/// Returns the handle to config file handle
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application session
+///
+/// \return handle
+/// HANDLE - Config file handle
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetXMLConfigHandle(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetNumberOfSession
+/// API to get the number of sessions created in the system.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] strServiceName
+/// PCSTR - Service name.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 FrameworkunifiedGetNumberOfSession(HANDLE hApp, PCSTR strServiceName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetSessionHandle
+/// \~english @par Brief
+/// Registering Session Handles with an Application Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] strServiceName
+/// PCSTR - Service name established for the session
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions (Acquired by FrameworkunifiedGetOpenSessionHandle, etc.)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - If the service-name (strServiceName) specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the length of the service-name (strServiceName) specified in the arguments is 0, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// After the application establishes a session with the service using a FrameworkunifiedOpenSession or the like,
+/// the session handle is registered in the application Dispatcher in association with the service name and session ID.
+/// Session handles shall be acquired by using a FrameworkunifiedGetOpenSessionHandle or the like when a response is received from the service.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedGetSessionHandle, FrameworkunifiedRemoveSessionHandle,
+/// FrameworkunifiedOpenSession, FrameworkunifiedOpenSessionWithData, FrameworkunifiedOpenSessionSync, FrameworkunifiedOpenSessionWithDataSync,
+/// FrameworkunifiedGetOpenSessionHandle, FrameworkunifiedGetOpenSessionSyncHandle,
+///
+/// Sets the session handle in the Application Framework. It stores the mapping between
+/// source, session id and session handle in the application framework.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] strServiceName
+/// PCSTR -Name of the associated service name
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedCreateSession, FrameworkunifiedGetSessionHandle, FrameworkunifiedRemoveSessionHandle.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetSessionHandle(HANDLE hApp, PCSTR strServiceName, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetSessionHandle
+/// \~english @par Brief
+/// Get the session handle for the given service name and session ID
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] strServiceName
+/// PCSTR - service name
+/// \~english @param [in] uiSessionId
+/// UI_32 - session ID
+/// \~english @retval HANDLE Handles for sessions
+/// \~english @retval NULL NULL pointer(Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// - If the service-name (strServiceName) specified in the parameter is NULL, [NULL]
+/// - If the session with the service name (strServiceName) specified in the parameter is not registered in the Dispatcher, [NULL]
+/// - If the session with the session ID name (uiSessionId) specified in the parameter is not registered in the Dispatcher, [NULL]
+/// \~english @par Detail
+/// Gets and returns the session handle associated with the specified service and session id from the application Dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedSetSessionHandle, FrameworkunifiedRemoveSessionHandle
+///
+/// Returns the requested session handle associated with service name and session id.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] strServiceName
+/// PCSTR -Name of the associated service name
+/// \param [in] uiSessionId
+/// HANDLE - Session Id
+///
+/// \return handle
+/// HANDLE - Session handle
+///
+/// \see FrameworkunifiedSetSessionHandle
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetSessionHandle(HANDLE hApp, PCSTR strServiceName, UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetCurrentSessionHandle
+/// \~english @par Brief
+/// Get the session handle for the most recent incoming message
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval HANDLE Handles for sessions
+/// \~english @retval NULL NULL pointer (Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// - When the source service name obtained from received messages is NULL [NULL]
+/// - If the Dispatcher does not have a session associated with the source service-name retrieved from the received message [NULL]
+/// - When the session ID acquired from the received message is not registered in the Dispatcher, [NULL]
+/// \~english @par Detail
+/// Gets and returns the session-handle associated with the most recently received message from the application's Dispatcher.
+/// \~english @par
+/// The application shall execute this API using an application handle passed as an argument to the callback function.\n
+/// (The callback functions are executed after the information required to execute the APIs is stored in the application handles (hApp) by receiving messages in the frameworks.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedGetSessionHandle, FrameworkunifiedSetSessionHandle
+///
+/// Returns the session handle for the current session. Useful, if used in the callback
+/// function of protocol. Current session means on which the protocol message received.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \return handle
+/// HANDLE - Session handle
+///
+/// \see FrameworkunifiedSetSessionHandle, FrameworkunifiedGetSessionHandle.
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetCurrentSessionHandle(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedRemoveSessionHandle
+/// \~english @par Brief
+/// Deletes the session handle for the given service name and session ID
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] strServiceName
+/// PCSTR - Service name
+/// \~english @param [in] uiSessionId
+/// UI_32 - session ID
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - If the service-name (strServiceName) specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the length of the service-name (strServiceName) specified in the arguments is 0, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This service call deletes the session handle associated with the specified service name and session ID among the session handles registered in the application's Dispatcher by FrameworkunifiedSetSessionHandle.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - When a session ID that has been deleted (or unregistered) is specified, this API returns an eFrameworkunifiedStatusOK.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedSetSessionHandle
+///
+/// Removes the session handle from the Application Framework associated with service name
+/// and session id. It actually removes the mapping between source, session id and session
+/// handle in the application framework which was set using FrameworkunifiedSetSessionHandle.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] strServiceName
+/// PCSTR -Name of the associated service name
+/// \param [in] uiSessionId
+/// HANDLE - Session Id
+///
+/// \return handle
+/// HANDLE - Session handle
+///
+/// \see FrameworkunifiedSetSessionHandle
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRemoveSessionHandle(HANDLE hApp, PCSTR strServiceName, UI_32 uiSessionId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetMandatoryServiceInfo
+/// \~english @par Brief
+/// Registers the specified Notification and event ID in the Notification list of the Dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pNotification
+/// PCSTR - Notification name
+/// \~english @param [in] uiEventId
+/// UI_32 - Event ID (Identification ID on the service's protocol)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the Notification name (pNotification) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the length of the Notification name (pNotification) specified in the arguments is 64 bytes or greater, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Registers the specified Notification and event ID in the Notification list of the Dispatcher.\n
+/// (The event ID of this API is the identification ID on the protocol of the service, which the application identifies the content of the message.)\n
+/// By registering a Notification with this API, a Notification registration/unregistration request
+/// to the notification service (NS_NPPService) is automatically issued by the Dispatcher when the Dispatcher starts/ends.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the Notification name is specified as an empty character, eFrameworkunifiedStatusOK is returned. Cannot guarantee operation.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Broadcast
+/// \~english @see
+///
+/// Sets the given service as Mandatory service in application handle
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNotification
+/// PCSTR -Name of the Notification
+/// \param [in] uiEventId
+/// UI_32 - event id
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetMandatoryServiceInfo(HANDLE hApp, PCSTR pNotification, UI_32 uiEventId);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetSessionName
+/// \~english @par Brief
+/// Gets the name of the message queue from the session handle
+/// \~english @param [in] hSession
+/// HANDLE - Handles for sessions
+/// \~english @retval PCSTR Pointer to the message queue name
+/// \~english @retval NULL NULL pointer (Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hSession specified in the parameter is NULL, [NULL]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [NULL]
+/// \~english @par Detail
+/// Gets the name of the message queue from the session handle (hSession) passed in the parameter.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+///
+/// Returns the session name corresponding to the given session handle.
+///
+///
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return session_name
+/// PCSTR - Session name
+///
+/// \see
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR FrameworkunifiedGetSessionName(HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedIsServiceAvailable
+/// \~english @par Brief
+/// Determine the availability of services
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application
+/// \~english @retval BOOL Use (TRUE: Available, FALSE: Not Available)
+/// \~english @retval FALSE Acquisition failure
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [FALSE]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [FALSE]
+/// - If the received message is not a service-availability notice... [FALSE]
+/// - Incoming messages are invalid [FALSE]
+/// \~english @par Detail
+/// Based on the received Notification, the service is judged to be usable or unusable, and true/false is returned.
+/// \~english @par
+/// The application shall execute this API using the handle of the application passed as the argument of the service availability notification callback function.\n
+/// (The callback functions are executed after the information required to execute the APIs is stored in the application handles (hApp) by receiving messages in the frameworks.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Broadcast
+/// \~english @see FrameworkunifiedGetServiceNameOnServiceAvailabilityNotification,
+/// FrameworkunifiedSubscribeNotificationWithCallback, FrameworkunifiedSubscribeNotificationsWithCallback
+///
+/// This API should only be called in the callback/reaction associated with the Service
+/// availability notification. It returns TRUE if service is available and FALSE if service
+/// is not available.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return service_availability
+/// BOOL - returns TRUE if service is available otherwise returns FALSE
+///
+/// \see
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedIsServiceAvailable(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedPublishServiceAvailability
+/// \~english @par Brief
+/// Publish application availability status
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] bIsAvailable
+/// BOOL - Availability status of the application (TRUE: Available, FALSE: Not Available)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Notification must be registered by FrameworkunifiedRegisterServiceAvailabilityNotification.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - If the service-availability Notification is not set for the handle (hApp) specified in the parameter, [eFrameworkunifiedStatusFail]
+/// - When the message queue handle for NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the application name in the handler (hApp) specified by the arguments is not set, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle for NPP services in the handle (hApp) specified in the arguments is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hApp) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue for the NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue for NPP services in the handle (hApp) specified in the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - If the message queue type is not the send type [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusErrFail]
+/// \~english @par Detail
+/// Notifies (issues a Notification) the availability status of an application to another application.\n
+/// Applications must use this API to notify other applications when the availability of services provided by the application changes.\n
+/// (However, the state machine managed application generated by FrameworkunifiedHSMDispatcherWithArguments, etc. is excluded because the state machine automatically issues a Notification.)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Broadcast
+/// \~english @see FrameworkunifiedRegisterServiceAvailabilityNotification, FrameworkunifiedGetSelfAvailability
+///
+/// This API publishes service availability status of the service. This API needs to be
+/// used when service is up and ready to process clients requests.
+/// FrameworkunifiedRegisterServiceAvailabilityNotification must be called before calling this API.
+/// In Frameworkunified HSM Framework based application service availability is published by the Framework
+/// So this API can be used only in Non-FRAMEWORKUNIFIED HSM based application.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] bIsAvailable
+/// BOOL - TRUE if Service Available and FALSE if service is unavailable
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+/// FrameworkunifiedRegisterServiceAvailabilityNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedPublishServiceAvailability(HANDLE hApp, BOOL bIsAvailable);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetSelfAvailability
+/// \~english @par Brief
+/// Gets the availability status of the application itself
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval BOOL Use (TRUE: Available, FALSE: Not Available)
+/// \~english @retval FALSE Acquisition failure
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [FALSE]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [FALSE]
+/// \~english @par Detail
+/// Gets the availability status of the applications managed in the Dispatcher.\n
+/// Availability states are the values specified by the application when the FrameworkunifiedPublishServiceAvailability is executed.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see FrameworkunifiedPublishServiceAvailability
+///
+/// This API get service availability status of the service. This API needs to be
+/// used when service is up and ready to process clients requests.
+/// FrameworkunifiedRegisterServiceAvailabilityNotification must be called before calling this API.
+/// In Frameworkunified HSM Framework based application service availability is published by the Framework
+/// So this API can be used only in Non-FRAMEWORKUNIFIED HSM based application.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+/// FrameworkunifiedRegisterServiceAvailabilityNotification, FrameworkunifiedPublishServiceAvailability
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL FrameworkunifiedGetSelfAvailability(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedRegisterServiceAvailabilityNotification
+/// \~english @par Brief
+/// Registering Application Availability Notification with NPP-Service
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pNotification
+/// PCSTR - Pointers to Notification names
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the Notification name (pNotification) specified in the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the length of the Notification name (pNotification) specified in the arguments is 64 bytes or greater, [eFrameworkunifiedStatusFail]
+/// - When the length of the Notification name (pNotification) specified in the arguments is 0, [eFrameworkunifiedStatusInvldParam]
+/// - Get buffer for sending messages (malloc) failed [eFrameworkunifiedStatusFail]
+/// - When the message queue handle for NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle for NPP services in the handle (hApp) specified in the arguments is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hApp) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue for the NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue for NPP services in the handle (hApp) specified in the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - If the message queue type is not the send type [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusErrFail]
+/// \~english @par Detail
+/// Requests that NPPservice register a Notification to notify the application availability status.\n
+/// A Notification registered by this API can publish the availability status to other applications by executing FrameworkunifiedPublishServiceAvailability from the application.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation is not guaranteed when the same application executes this API more than once with different Notification names.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Broadcast
+/// \~english @see FrameworkunifiedUnRegisterServiceAvailabilityNotification, FrameworkunifiedPublishServiceAvailability
+///
+/// This API registers the given service availability notification. Need to be used by
+/// service.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNotification
+/// PCSTR -Name of the Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+/// FrameworkunifiedPublishServiceAvailability
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRegisterServiceAvailabilityNotification(HANDLE hApp, PCSTR pNotification);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedUnRegisterServiceAvailabilityNotification
+/// \~english @par Brief
+/// Revoke application availability Notification from NPPservice
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Notification must be registered by FrameworkunifiedRegisterServiceAvailabilityNotification.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - If the service-availability Notification is not set for the handle (hApp) specified in the parameter, [eFrameworkunifiedStatusInvldParam]
+/// - Get buffer for sending messages (malloc) failed [eFrameworkunifiedStatusFail]
+/// - When the message queue handle for NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue handle for NPP services in the handle (hApp) specified in the arguments is invalid (invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the application in the handle (hApp) specified by the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the name of the message queue for the NPP service in the handle (hApp) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the name of the message queue for NPP services in the handle (hApp) specified in the arguments exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - If the message queue type is not the send type [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Requests that NPPservice abandon the Notification to notify the availability status of the application that executed this API.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Broadcast
+/// \~english @see FrameworkunifiedRegisterServiceAvailabilityNotification
+///
+/// This API unregisters the service availability notification
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+/// FrameworkunifiedPublishServiceAvailability, FrameworkunifiedRegisterServiceAvailabilityNotification
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnRegisterServiceAvailabilityNotification(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateSession
+/// \~english @par Brief
+/// Create handles for sessions and register them with the application's Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pSessionName
+/// PCSTR - Session name (application name or thread name)
+/// \~english @retval HANDLE Handles for sessions
+/// \~english @retval NULL NULL pointer (Acquisition failure)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// - The session name (pSessionName) specified in the arguments is invalid.
+/// (For NULL, if the length is 0 or 20 bytes or more) [NULL]
+/// - When acquisition (malloc) of the message queue management information area fails, [NULL]
+/// - When the normalized message queue name from the session name (pSessionName) is inappropriate (exceeds 16 bytes) [NULL]
+/// - When acquisition (malloc) of the storage area for the message queue name fails, [NULL]
+/// - The open of the message queue (mq_open) failed [NULL]
+/// \~english @par Detail
+/// Creates handles (send message queues) for sessions with the specified application and registers them in the application's Dispatcher.\n
+/// The pSessionName is set to the application name or thread name of the client that establishes the session.\n
+/// This API is used to establish a session with a client application when an application on the service providing side receives a session start request from the client application.
+/// The application shall execute this API from the corresponding callback function.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedDestroySession
+///
+/// This API generates the session handle and sets it in the Application Framework. This API
+/// should be used by the server in the callback function attached to the open session request.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pSessionName
+/// PCSTR - SessionName can be application name or thread name
+///
+/// \return session_handle
+/// HANDLE - Session Handle
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateSession(HANDLE hApp, PCSTR pSessionName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDestroySession
+/// \~english @par Brief
+/// Destroys the session handle and removes the session handle from the application Dispatcher
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] hSession
+/// HANDLE - Handle for sessions (handle obtained with FrameworkunifiedCreateSession)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - If the hSession specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hSession specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - When the length of the message queue name of the handle (hSession) specified in the arguments is 0, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Destroys the specified session handle and removes the specified session handle from the application Dispatcher.\n
+/// This API is used when the service-providing application receives a session termination request from the client application and discards the session with the client application.
+/// The application shall execute this API from the corresponding callback function.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see FrameworkunifiedCreateSession
+///
+/// This API destroys the session handle and removes it from the Application Framework.
+/// This API should be called by the server in the callback attached to the close session
+/// request
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDestroySession(HANDLE hApp, HANDLE hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendResponse
+/// \~english @par Brief
+/// Sending a Response to the Source of an Incoming Message
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] iCmd
+/// UI_32 - Identification ID on the service's protocol
+/// \~english @param [in] length
+/// UI_32 - Data size to be sent (0 to 4294967255)
+/// \~english @param [in] data
+/// PCVOID - Pointer to the data to send
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Bad buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other errors (Failed to open/allocate shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// - Sessions are registered in the Dispatcher by FrameworkunifiedCreateSession, etc.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusFail]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusFail]
+/// - When the source service name obtained from received messages is NULL [eFrameworkunifiedStatusFail]
+/// - If the Dispatcher does not have a session associated with the source service-name retrieved from the received message [eFrameworkunifiedStatusFail]
+/// - When the session ID acquired from the received message is not registered in the Dispatcher, [eFrameworkunifiedStatusFail]
+/// - If the sessionhandle for incoming messages is NULL [eFrameworkunifiedStatusNullPointer]
+/// - If the handles for sessions corresponding to incoming messages are inappropriate (disabled) [eFrameworkunifiedStatusNullPointer]
+/// - When the message queue handle corresponding to the received message in the session handle is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - When the application name length in the session handle corresponding to received messages is 0, [eFrameworkunifiedStatusInvldHandle]
+/// - Incorrect (invalid) message queue handle in session handle for incoming message [eFrameworkunifiedStatusInvldHandle]
+/// - When the data (data) of the send message specified by the parameter is NULL and the data length (length) is not 0, [eFrameworkunifiedStatusInvldBuf]
+/// - When the length of the application name in the session handle corresponding to the received message exceeds 20 bytes [eFrameworkunifiedStatusInvldQName]
+/// - When the message queue name of the session handle corresponding to the received message is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue name of the session handle corresponding to the received message exceeds 20 bytes [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the session handle corresponding to the received message is not the transmission type [eFrameworkunifiedStatusInvldHndlType]
+/// - When the message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending messages is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a systemcall (signal) occurs while sending messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - If the size of the message transmission buffer is invalid [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending messages [eFrameworkunifiedStatusErrOther]
+/// - When the size (length) of the data to be sent specified in the parameter is out of range, [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Gets the session ID and session name from received messages, and the corresponding session handles from Dispatcher.\n
+/// Send a response to the sender of the received message using the acquired session handle.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - The maximum data size (length) described above is a theoretical value. The maximum data size that can be actually used depends on the environment requirements.\n
+/// The maximum value is the upper limit of the type (UINT_MAX) minus the following size.\n
+/// Message header section\n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address of the pointer (data) to the data buffer does not match the size specified by the size of the data buffer (length).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method
+/// \~english @see FrameworkunifiedCreateSession, FrameworkunifiedSetSessionHandle
+///
+/// This API retrieves the session handle from the application framework and sends the response
+/// to the client on the same session. The session id and message source name available in the
+/// hApp at that instance is used to get the session handle. This API will work if server has
+/// created session using FrameworkunifiedCreateSession or has used FrameworkunifiedSetSessionHandle after creating the
+/// session.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] iCmd
+/// UI_32 - Protocol command
+/// \param [in] length
+/// UI_32 - size of message data
+/// \param [in] data
+/// PCVOID - message data
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedCreateSession, FrameworkunifiedSetSessionHandle, FrameworkunifiedSendRequest.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendResponse(HANDLE hApp, UI_32 iCmd, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSendRequest
+/// This API retrieves the session handle from the application framework and sends the request
+/// to the server with specific service name and session id. This API will work, if application
+/// has previously stored associated session handle using FrameworkunifiedSetSessionHandle.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pServerName
+/// PCSTR - Name of the server
+/// \param [in] uiSessionId
+/// UI_32 - session id
+/// \param [in] iCmd
+/// UI_32 - Protocol command
+/// \param [in] length
+/// UI_32 - size of message data
+/// \param [in] data
+/// PCVOID - message data
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSetSessionHandle, FrameworkunifiedSendResponse
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendRequest(HANDLE hApp, PCSTR pServerName, UI_32 uiSessionId, UI_32 iCmd,
+ UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPSetPersonality
+/// API to send message to Notification Service to set Personality
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] pUserName
+/// PCSTR - Name of the new Personality
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPLoadPersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPSetPersonality(HANDLE hApp, PCSTR pUserName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPChangePersonality
+/// API to send message to Notification Service to set new Personality
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] pUserName
+/// PCSTR - Name of the new Personality
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedNPRegisterPersistentFile, FrameworkunifiedNPLoadPersistentFile
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPChangePersonality(HANDLE hApp, PCSTR pUserName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendStopToNSNPP
+/// \~english @par Brief
+/// API that sends a message to the notification service and requests a shutdown
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] eShutdownType
+/// EFrameworkunifiedShutdownType - Shutdown type
+/// \~english @param [in] uiStopMsgData
+/// UI_32 - Flag subject to resetting (Default:0)
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends a message to the notification service (NS_NPPService) and requests shutdown.\n
+/// The reset target flag (uiStopMsgData) is valid only when the shutdown type (eShutdownType) is eFrameworkunifiedDataResetShutdown.\n
+/// The reset target flag (uiStopMsgData) indicates the target of data reset at shutdown.\n
+/// The target can be OR-set by using EFrameworkunifiedPersistCategory defined values.\n
+/// The specified target is reset from the non-volatile memory.
+/// Eg: uiStopMsgData = (eFrameworkunifiedUserData | eFrameworkunifiedFactoryCustomerData) = 0x0101\n
+/// eFrameworkunifiedUserData bit : 1 : user data resets\n
+/// eFrameworkunifiedFactoryData bit : 0 : factory data not reset-target\n
+/// eFrameworkunifiedFactoryCustomerData bit : 1 : factory customer data resets\n
+/// eFrameworkunifiedDealerData bit : 0 : persist dealer data not reset-target\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+///
+/// FrameworkunifiedSendStopToNSNPP
+/// To be used by System Manager Service only. This API would push NPP Service to persist
+/// the data/files. Ideally this should be sent during system shutdown by System Manager Service
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+///
+/// \param [in] eShutdownType
+/// EFrameworkunifiedShutdownType - shutdown type
+///
+/// \param [in] uiStopMsgData
+/// UI_32 - Flag representing which data to persist and which data to delete from
+/// persistent memory during shutdown.
+/// This needs to be specified only when shutdown type is eFrameworkunifiedDataResetShutdown.
+/// If not specified with DataReset type, then NPP will do normal shutdown.
+/// For other shutdown type this parameter has no effect.
+/// uiStopMsgData = 0 means Normal shutdown persisting all data
+/// else value from enum EFrameworkunifiedPersistCategory, multiple value from enum can be ORed.
+/// Bit value 1 represent resetting of data while value 0 bit represent data persisting
+/// Eg: uiStopMsgData = (eFrameworkunifiedUserData|eFrameworkunifiedFactoryCustomerData) = 0x0101 indicates
+/// eFrameworkunifiedUserData bit value 1 means delete user data
+/// eFrameworkunifiedFactoryData bit value 0 means persist factory data
+/// eFrameworkunifiedFactoryCustomerData bit value 1 means delete factory customer data
+/// eFrameworkunifiedDealerData bit value 0 means persist dealer data
+///
+/// \return status
+/// EFrameworkunifiedStatus - success if request sent to NPPService or error
+/// \~english @par Type
+/// Pub-Sub
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendStopToNSNPP(HANDLE hApp, EFrameworkunifiedShutdownType eShutdownType, UI_32 uiStopMsgData = 0x0);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedNPGetReadyStatusOfNPP
+/// \~english @par Brief
+/// APIs that send messages to notification services and obtain Ready status
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - The process of NS_NPPService is started.
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the application-name storage area address in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the application name in the handle (hApp) specified by the arguments is empty, [eFrameworkunifiedStatusInvldParam]
+/// - When the message queue handle in the handle (hApp) specified by the arguments is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - When the message queue type of the handle (hApp) specified in the parameter is not the send type, [eFrameworkunifiedStatusInvldHndlType]
+/// - If the message queue handle in the hApp specified by the arguments is inappropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - The message queue name of the handle (hApp) specified in the arguments is not appropriate (the name exceeds NULL, 20 bytes) [eFrameworkunifiedStatusInvldHandle]
+/// - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
+/// - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
+/// - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrectly sized send buffers for sessions destined for NPP Service [eFrameworkunifiedStatusInvldBufSize]
+/// - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Sends messages to the notification service (NS_NPPService) and acquires the Ready status.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method
+/// \~english @see
+///
+/// FrameworkunifiedNPGetReadyStatusOfNPP
+/// To be used by System Manager Service only. SystemManager will use this API to get the
+/// ready status of NPPService.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success if request sent to NPPService or error
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPGetReadyStatusOfNPP(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetServiceNameOnServiceAvailabilityNotification
+/// \~english @par Brief
+/// Get the available service names
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [out] pServiceName
+/// PSTR - Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some error occurred
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - When the service-name storage area (pServiceName) specified in the parameter is NULL, [eFrameworkunifiedStatusInvldParam]
+/// - If the received message is not a service-availability notice... [eFrameworkunifiedStatusFail]
+/// - Incoming messages are invalid [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// When an application receives a service availability notification, it gets the name of the available service.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - The application shall execute this API using an application handle passed as an argument to the callback function.\n
+/// (The callback functions are executed after the information required to execute the APIs is stored in the application handles (hApp) by receiving messages in the frameworks.)
+/// - The size of the buffer passed in the argument pServiceName must be at least MAX_NAME_SIZE_APP(20).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see FrameworkunifiedIsServiceAvailable, FrameworkunifiedSubscribeNotificationWithCallback,
+/// FrameworkunifiedSubscribeNotificationsWithCallback
+///
+/// To be used when client receives service availability notification to get the available
+/// service name.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [out] pServiceName
+/// PSTR - Name of the available service.
+/// Size of the buffer should be equal to or greater than MAX_NAME_SIZE_APP
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetServiceNameOnServiceAvailabilityNotification(HANDLE hApp, PSTR pServiceName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetCurrentUser
+/// Get the current user for the application
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+///
+/// \return userhandle
+/// HANDLE - Returns current user handle
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedGetCurrentUser(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSetUser
+/// Set the current user for the application in application framework
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] hUser
+/// HANDLE - User handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetUser(HANDLE hApp, HANDLE hUser);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetAppData
+/// \~english @par Brief
+/// Hold the specified arbitrary data
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pKey
+/// PCSTR - Key strings
+/// \~english @param [in] pData
+/// PVOID - Service name that can be used
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Retention failure
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [eFrameworkunifiedStatusInvldHandle]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldHandle]
+/// - If the addresses of the key strings are NULL [eFrameworkunifiedStatusInvldParam]
+/// - Failed to retain arbitrary data. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This function stores an arbitrary data address in the heap using the specified key string as a key.
+/// Since the object to be held is an address, the caller must specify an accessible global address, etc.
+/// The caller should pay attention to the addresses of arbitrary data, since they retain the addresses of arbitrary data even if they are NULL.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Set Get
+/// \~english @see FrameworkunifiedGetAppData, FrameworkunifiedRemoveAppData
+///
+/// FrameworkunifiedSetAppData
+/// This API stores the data pointer against a key in application framework. This can be used
+/// as a global data and can be accessed in the FRAMEWORKUNIFIED functions. Please note that application
+/// developer should avoid using global data.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pKey
+/// PSTR - Data key
+/// \param [in] pData
+/// PVOID - data
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedGetAppData, FrameworkunifiedRemoveAppData
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetAppData(HANDLE hApp, PCSTR pKey, PVOID pData);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetAppData
+/// \~english @par Brief
+/// Returns the address of any data associated with the key string
+/// \~english @param [in] hApp
+/// HANDLE - Handle for the application
+/// \~english @param [in] pKey
+/// PCSTR - Key strings
+/// \~english @retval PVOID Address of arbitrary data
+/// \~english @retval NULL NULL pointers (unsuccessful retrieval, anomaly parameters)
+/// \~english @par Prerequisite
+/// - Creation/initialization (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) of the Dispatcher for the application must be performed.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the hApp specified in the parameter is NULL, [NULL]
+/// - If the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// - If the addresses of the Key strings are NULL [NULL]
+/// \~english @par Detail
+/// Returns the corresponding data address using the specified key string as the key.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Set Get
+/// \~english @see FrameworkunifiedSetAppData, FrameworkunifiedRemoveAppData
+///
+/// FrameworkunifiedGetAppData
+/// This API retrieves the data stored against a key in application framework.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pKey
+/// PSTR - Data key
+/// \return [in] pData
+/// PVOID - data
+///
+/// \see FrameworkunifiedSetAppData, FrameworkunifiedRemoveAppData
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID FrameworkunifiedGetAppData(HANDLE hApp, PCSTR pKey);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedRemoveAppData
+/// This API removes the data stored against a key in application framework.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pKey
+/// PSTR - Data key
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSetAppData, FrameworkunifiedGetAppData
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedRemoveAppData(HANDLE hApp, PCSTR pKey);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetSystemInfo
+/// Gets some internal notification information
+///
+/// \param [in] hApp
+/// HANDLE - Handle to a Application Framework
+/// \param [in, out] pSystemInfo
+/// PVOID - Buffer pointer to which system info is copied.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
+/// FrameworkunifiedClearMsgData, FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetSystemInfo(HANDLE hApp, PVOID pSystemInfo);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSetDeferredSyncResponse
+/// Set sync response deferred flag
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the dispatcher to receive message
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetDeferredSyncResponse(HANDLE hApp);
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_H__ */ // NOLINT (build/header_guard)
+/**@}*/ // end of framework
+/**@}*/ // end of framework_unified
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_sync.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_sync.h
new file mode 100755
index 0000000..3573e8c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_sync.h
@@ -0,0 +1,370 @@
+/*
+ *
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeService
+/// \brief This file contains the class declaration for synchronization
+/// API's.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_framework_sync.h
+ * @brief \~english This file contains the class declaration for synchronization
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYNC_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYNC_H__
+
+#include <pthread.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <time.h>
+#include <map>
+#include <string>
+
+struct SFrameworkunifiedSyncDataPacket;
+
+// Map containing the synchronization data as per the notification
+typedef std::map<std::string, SFrameworkunifiedSyncDataPacket *> TSyncDataPacketList;
+
+// Iterator to the map containing the synchronization data as per the notification
+typedef TSyncDataPacketList::iterator TSyncDataPacketItr;
+
+/**
+ * @class CFrameworkunifiedSyncData
+ * \~english @brief this file has the CFrameworkunifiedSyncData class definitions
+ * \~english @par Brief Introduction
+ * - This class provids some functions to handle the synchronization data as per the notification.
+ *
+ */
+class CFrameworkunifiedSyncData {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - This function is used to get the singleton instance of class.
+ /// \~english @param None
+ /// \~english @retval CFrameworkunifiedSyncData - singleton instance of class
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - If m_psSyncData is NULL,will create a new object,otherwise, will return m_psSyncData.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @see CFrameworkunifiedSyncData::CFrameworkunifiedSyncData
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ static CFrameworkunifiedSyncData *FrameworkunifiedGetSyncDataInstance();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - This function is used to release the instance of class.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval except eFrameworkunifiedStatusOK - failure
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - system function error.[Not eFrameworkunifiedStatusOK]
+ /// \~english @par Detail
+ /// - If m_psSyncData is NULL,return success,otherwise, will delete m_psSyncData.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see CFrameworkunifiedSyncData::CFrameworkunifiedSyncData
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus FrameworkunifiedReleaseSyncDataInstance();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - This method is used by the application to start the notification synchronization thread.
+ /// \~english @param [in] hApp
+ /// HANDLE - Application Handle.
+ /// \~english @retval eFrameworkunifiedStatusOK - On Success
+ /// \~english @retval eFrameworkunifiedStatusThreadAlreadyRunning - If thread already running
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - Null Handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid Handle
+ /// \~english @par Preconditons
+ /// - The function FrameworkunifiedReleaseSyncDataInstance is successed, object is created successfully.
+ /// \~english @par Change of internal status
+ /// -m_hSyncThreadMsgQHandle saves sync thread handle.
+ /// \~english @par Conditions of processing failure
+ /// - m_hSyncThreadMsgQHandle is not NULL, thread already running.[eFrameworkunifiedStatusThreadAlreadyRunning]
+ /// - Null Handle.[eFrameworkunifiedStatusNullPointer]
+ /// - Invalid Handle.[eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Detail
+ /// - This fucntion create a child thread of hApp, m_hSyncThreadMsgQHandle saves the child thread.
+ /// - The child thread will be used to receive and send notification data.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedStartNotificationSync(HANDLE hApp);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - This method is used to stop the synchronization notification thread.
+ /// \~english @param [in] hApp
+ /// HANDLE - Application Handle.
+ /// \~english @retval eFrameworkunifiedStatusOK - On Success
+ /// \~english @retval eFrameworkunifiedStatusThreadNotExist - If thread already running
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - Null Handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid Handle
+ /// \~english @par Preconditons
+ /// -The function FrameworkunifiedStartNotificationSync is successed.
+ /// \~english @par Change of internal status
+ /// - m_hSyncThreadMsgQHandle will be delete.
+ /// \~english @par Conditions of processing failure
+ /// - If thread doesn't exist.[eFrameworkunifiedStatusThreadNotExist]
+ /// - Null Handle.[eFrameworkunifiedStatusNullPointer]
+ /// - Invalid Handle.[eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Detail
+ /// - This method is used by the application to stop the notification synchronization thread.
+ /// m_hSyncThreadMsgQHandle is Invalid and can't be used to get notification data for hApp.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedStopNotificationSync(HANDLE hApp);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - API to subscribe to a synchronization notification data.
+ /// \~english @param [in] f_cNotification
+ /// std::string - Notification to be subscribed.
+ /// \~english @retval eFrameworkunifiedStatusOK - On Success
+ /// \~english @retval eFrameworkunifiedStatusFail - On failure
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If f_cNotification is empty or m_hSyncThreadAppHandle is NULL.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - API to subscribe to a synchronization notification data.\n
+ /// application will get the synchronization notification data at run-time.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - eFrameworkunifiedStatusFail:Failure
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationWithDataSync(const std::string &f_cNotification);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - API to unsubscribe to a synchronization notification data.
+ /// \~english @param [in] f_cNotification
+ /// std::string - Notification to be subscribed.
+ /// \~english @retval eFrameworkunifiedStatusOK - On Success
+ /// \~english @retval eFrameworkunifiedStatusFail - On failure
+ /// \~english @par Preconditons
+ /// - the FrameworkunifiedSubscribeNotificationWithDataSync result is success.
+ /// \~english @par Change of internal status
+ /// - The synchronization data's pointor of the special notification will be remove and delete.
+ /// - The synchronization data of the special notification will delete from m_mSyncDataMap.
+ /// \~english @par Conditions of processing failure
+ /// - If f_cNotification is empty or m_hSyncThreadAppHandle is NULL.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - API to unsubscribe to a synchronization notification data.\n
+ /// After unsubscribing,notification synchronization data of application will be freed.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - eFrameworkunifiedStatusFail:Failure
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedUnSubscribeNotificationWithDataSync(const std::string &f_cNotification);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - This function is used to get the synchronization notification data for a particular notification.
+ /// \~english @param [in] f_cNotification
+ /// std::string - Notification for which data is required
+ /// \~english @param [in] f_pBuffer
+ /// PVOID - Buffer for the synchronization data
+ /// \~english @param [in] f_nBufferSize
+ /// UI_16 - size of notification data buffer
+ /// \~english @retval eFrameworkunifiedStatusOK - Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - Null pointor
+ /// \~english @retval eFrameworkunifiedStatusFail - failure
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If f_cNotification is empty or m_hSyncThreadAppHandle is NULL or f_nBufferSize is 0.[eFrameworkunifiedStatusFail]
+ /// - If l_itSyncDataPacketItr is not in m_mSyncDataMap.[eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// - This function is used to get the synchronization notification data for a particular notification.
+ /// f_cNotification is the iterator to the map containing the synchronization data of notification,\n
+ /// using this iterator to get data from m_mSyncDataMap.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedGetSyncNotificationData(const std::string &f_cNotification, PVOID f_pBuffer, UI_16 f_nBufferSize);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedSyncData
+ /// \~english @par Brief
+ /// - API to get the size of synchronization notification data.
+ /// \~english @param [in] f_cNotification
+ /// const std::string - Notification to be subscribed.
+ /// \~english @retval UI_32 - size of notification data
+ /// \~english @par Preconditons
+ /// -Instance is created successfully.
+ /// \~english @par Change of internal status
+ /// -None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - This function is used to get the size of the synchronization data.
+ /// if f_cNotification is null or l_itSyncDataPacketItr is not in m_mSyncDataMap\n
+ /// the function will return 0.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 FrameworkunifiedGetSyncDataSize(const std::string &f_cNotification);
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedSyncData
+ /// Constructor of CFrameworkunifiedSyncData class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedSyncData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedSyncData
+ /// Destructor of CFrameworkunifiedSyncData class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFrameworkunifiedSyncData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSyncDataThreadStart
+ /// Callback on the start of the sync thread.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Thread Application Handle.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedSyncDataThreadStart(HANDLE hThread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSyncDataThreadStop
+ /// Callback on the stop of the sync thread.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Thread Application Handle.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedSyncDataThreadStop(HANDLE hThread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSyncDataNotifCallback
+ /// Callback on the receiving the published notification.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Thread Application Handle.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedSyncDataNotifCallback(HANDLE hThread);
+
+ static CFrameworkunifiedSyncData *m_psSyncData; ///< singleton instance of class
+
+ BOOL m_bSyncThreadStarted; /// Check to verify if thread started
+
+ TSyncDataPacketList
+ *m_mSyncDataMap; /// Pointer to the map containing the synchronization data as per the notification
+
+ HANDLE m_hSyncThreadAppHandle; /// S ynchronization thread Application Handle
+
+ HANDLE m_hAppHandle; /// Application Handle
+
+ HANDLE m_hSyncThreadMsgQHandle; /// Synchronization thread message queue handle
+
+ static pthread_spinlock_t m_pSyncLock; /// Synchronization Spinlock
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYNC_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_system_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_system_if.h
new file mode 100755
index 0000000..af7a4f9
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_system_if.h
@@ -0,0 +1,110 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief This file provides framework's API which are used by system services.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_framework_system_if.h
+ * @brief \~english This file provides framework's API which are used by system services.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYSTEM_IF_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYSTEM_IF_H__
+
+#include <native_service/frameworkunified_types.h>
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FrameworkunifiedNPClearPersistedData
+ /// \~english @par Summary
+ /// API to delete all the persistent files and notification data from persistent memory
+ /// related to NS_NPS.
+ /// Note: This API is only to be used HMI service.
+ /// This API should not be used by the other application.
+ /// \~english @param [in] hApp
+ /// hApp - Handle to the Framework
+ /// \~english @par
+ /// hApp HANDLE*
+ /// \~english @param [in] eFrameworkunifiedClearPersistenceScope
+ /// eFrameworkunifiedClearPersistenceScope - specifies what data to delete from persistent memory
+ /// \~english @par
+ /// eFrameworkunifiedClearPersistenceScope EFrameworkunifiedClearPersistence enum
+ /// \~english @code
+ /// typedef enum _EFrameworkunifiedClearPersistence {
+ /// eFrameworkunifiedClearAllData = 0, ///< clears all the data in persistence memory for all users
+ /// ///< (currently only this enum value is supported.)
+ /// eFrameworkunifiedClearAllApplicationData, ///< clears all the data(files, folders) related to all application for all
+ /// users
+ /// eFrameworkunifiedClearAllNotificationData, ///< clears all the notification data related to all application for all users
+ /// eFrameworkunifiedClearCurrentUserData, ///< clears all the data in persistence memory for current users
+ /// eFrameworkunifiedClearCurrentUserApplicationData, ///< clears all the data(files, folders) related to all application for
+ /// current users
+ /// eFrameworkunifiedClearCurrentUserNotificationData ///< clears all the notification data related to all application for
+ /// current users
+ /// } EFrameworkunifiedClearPersistence;
+ /// @endcode
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @par
+ /// eFrameworkunifiedStatusOK
+ /// eFrameworkunifiedStatusNullPointer
+ /// eFrameworkunifiedStatusInvldParam
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If input parameter Framework handler is invalid. [eFrameworkunifiedStatusNullPointer]
+ /// - If communicate handler of NPPService is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Function NPClearPersistedData return invalid parameter. [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// API to delete all the persistent files and notification data from persistent memory
+ /// related to NS_NPS.
+ /// Note: This API is only to be used HMI service.
+ /// This API should not be used by the other application.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPClearPersistedData(HANDLE hApp, EFrameworkunifiedClearPersistence eFrameworkunifiedClearPersistenceScope = eFrameworkunifiedClearAllData);
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_INC_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_SYSTEM_IF_H__ */ // NOLINT (build/header_guard)
+/**@}*/ // end of framework
+/**@}*/ // end of framework_unified
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_types.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_types.h
new file mode 100755
index 0000000..aa4119d
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_framework_types.h
@@ -0,0 +1,173 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+/// \brief Application framework's core structures and data types.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_framework_types.h
+ * @brief \~english Application framework's core structures and data types.
+ *
+ */
+/** @addtogroup BaseSystem
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <boost/function.hpp>
+
+#define MAX_LEN MAX_QUEUE_NAME_SIZE
+#define MAX_MSGQ_BUFFER MAX_QUEUE_MSG_SIZE
+#define MAX_SESSION_ID_VAL 0xFFFF
+#define MAX_FD_MULTIWAITING 8
+
+#define FRAMEWORKUNIFIED_ANY_SOURCE "NS_ANY_SRC"
+#define FRAMEWORKUNIFIED_ANY_COMMAND 0xFFFFFFFF
+#define FRAMEWORKUNIFIED_NS_NPSERVICE "NS_NPPService"
+#define FRAMEWORKUNIFIED_NS_VERSIONUTIL "nsverutil"
+#define FRAMEWORKUNIFIED_NS_MSGPROFILERUTIL "NSDisMsgProfile"
+#define FRAMEWORKUNIFIED_NS_REMOTECONTROLSERVICE "NS_RemoteControlService"
+
+// call back function definition
+typedef boost::function< EFrameworkunifiedStatus(HANDLE) > TCbFunction;
+typedef TCbFunction CallbackFunctionPtr;
+typedef TCbFunction CbFuncPtr;
+typedef EFrameworkunifiedStatus(*CbArgumentParser)(SI_32 argument, PCHAR argumentValue);
+
+typedef enum _EFrameworkunifiedServiceAvailableStatus {
+ eFrameworkunifiedServiceAvailable = 0,
+ eFrameworkunifiedServiceNotAvailable,
+} EFrameworkunifiedServiceAvailableStatus;
+
+// Share Memory Retrieve Types
+typedef enum _ESMRetrieveTypes {
+ eSMRRelease = 0, ///< data will be released on a read
+ eSMRRetain = 1, ///< data will be retained in the shared memory
+} ESMRetrieveTypes;
+
+/**
+ * \~english Callbacks structure of Application Life cycle
+ */
+typedef struct _FrameworkunifiedDefaultCallbackHandler {
+ CbFuncPtr onInitilization; //!< \~english Callback of initialization
+ CbFuncPtr onDestroy; //!< \~english Callback of destroy
+ CbFuncPtr onStart; //!< \~english Callback of startup
+ CbFuncPtr onStop; //!< \~english Callback of stop
+ CbFuncPtr onPreStart; //!< \~english Callback of pre start
+ CbFuncPtr onPreStop; //!< \~english Callback of pre stop
+ CbFuncPtr onBackgroundStart; //!< \~english Callback of Background start
+ CbFuncPtr onBackgroundStop; //!< \~english Callback of Background stop
+ CbFuncPtr onDebugDump; //!< \~english Callback of debug dump
+ CbFuncPtr createStateMachine; //!< \~english Callback of created state machine
+ CbFuncPtr ssFrameworkInterface; //!< \~english Callback to Establish a session with the system_manager
+} FrameworkunifiedDefaultCallbackHandler;
+
+// LCOV_EXCL_BR_START 11:Occurred in the above test
+typedef struct _FrameworkunifiedProtocolCallbackHandler {
+ UI_32 iCmd;
+ CbFuncPtr callBack;
+} FrameworkunifiedProtocolCallbackHandler;
+// LCOV_EXCL_BR_STOP
+
+typedef struct _FrameworkunifiedFdProtocolCallbackHandler {
+ int fd;
+ CbFuncPtr callBack;
+} FrameworkunifiedFdProtocolCallbackHandler;
+
+// LCOV_EXCL_BR_START 11:Occurred in the above test
+typedef struct _FrameworkunifiedNotificationCallbackHandler {
+ CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
+ CbFuncPtr callBack;
+} FrameworkunifiedNotificationCallbackHandler;
+// LCOV_EXCL_BR_STOP
+
+typedef struct _FrameworkunifiedNotificationsList {
+ CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
+ UI_32 uiLengthData;
+ EFrameworkunifiedNotificationType persType;
+} FrameworkunifiedNotificationsList;
+
+typedef struct _FrameworkunifiedProtocolEvent {
+ UI_32 iCmd;
+ UI_32 iEventId;
+} FrameworkunifiedProtocolEvent;
+
+typedef struct _FrameworkunifiedNotificationEvent {
+ CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
+ UI_32 iEventId;
+} FrameworkunifiedNotificationEvent;
+
+typedef struct _ServiceAvailability {
+ CHAR cServiceName[MAX_NAME_SIZE_APP];
+ EFrameworkunifiedServiceAvailableStatus eServiceAvailability;
+} ServiceAvailability;
+
+typedef enum _EFrameworkunifiedShutdowntatus {
+ eFrameworkunifiedShutdownOk = 0,
+ eFrameworkunifiedShutdownTimeout,
+ eFrameworkunifiedShutdownFail,
+} EFrameworkunifiedShutdownStatus;
+
+typedef struct _ShutdownComplete {
+ CHAR cServiceName[MAX_NAME_SIZE_APP];
+ EFrameworkunifiedShutdownStatus eShutdownCompleteStatus;
+} ShutdownComplete;
+
+typedef struct _CustomCommandLineOptions {
+ PCSTR cShortOptions;
+ PCHAR cLongOptions; // reserved for long options.
+ CbArgumentParser callback;
+} CustomCommandLineOptions;
+
+/// Scheduling Policy
+typedef enum _EFrameworkunifiedSchedPolicy {
+ eFrameworkunifiedSchedPolicyInherit = 0,
+ eFrameworkunifiedSchedPolicyTSS,
+ eFrameworkunifiedSchedPolicyFIFO,
+ eFrameworkunifiedSchedPolicyRR,
+ eFrameworkunifiedSchedPolicyMAX
+} EFrameworkunifiedSchedPolicy;
+
+/// Child Thread Attribute
+typedef struct _FrameworkunifiedChildThreadAttr {
+ EFrameworkunifiedSchedPolicy schedPolicy;
+ SI_32 schedPriority;
+} FrameworkunifiedChildThreadAttr;
+
+#endif /* __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_multithreading.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_multithreading.h
new file mode 100755
index 0000000..b943596
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_multithreading.h
@@ -0,0 +1,745 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Application framework's core structures and data types.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_multithreading.h
+ * @brief \~english Application framework's core structures and data types.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NSFRAMEWORK_NFRAMEWORKCORE_MULTITHREADING__ // NOLINT (build/header_guard)
+#define __NSFRAMEWORK_NFRAMEWORKCORE_MULTITHREADING__
+
+#include <native_service/frameworkunified_framework_types.h>
+
+#define INHERIT_PARENT_THREAD_PRIO -100
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateChildThread
+/// \~english @par Brief
+/// Create child thread and dispatcher for child thread, and initialize it
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] childName
+/// PCSTR - Child thread name
+/// \~english @param [in] CbInitialize
+/// CbFuncPtr - Pointer to the callback function for initializing child thread
+/// \~english @param [in] CbShutdown
+/// CbFuncPtr - Pointer to the callback function for stopping child thread
+/// \~english @retval HANDLE handle for communicate with child thread
+/// \~english @retval NULL Failure to get HANDLE
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize, CbShutdown) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Detail
+/// This API creates child thread and returns handle for communicate with child thread.\n
+/// Generated child thread creates dispatcher for itself, and initializes the dispatcher. \n
+/// It starts to mainloop that receives request or notification,
+/// and runs registered callback to dispatcher for child thread.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize, CbFuncPtr CbShutdown);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateChildThreadWithPriority
+/// \~english @par Brief
+/// Create child thread with specified priority and dispatcher for child thread, and initialize it
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] childName
+/// PCSTR - Child thread name
+/// \~english @param [in] CbInitialize
+/// CbFuncPtr - Pointer to the callback function for initializing child thread
+/// \~english @param [in] CbShutdown
+/// CbFuncPtr - Pointer to the callback function for stopping child thread
+/// \~english @param [in] schedPrio
+/// SI_32 - priority of child thread
+/// (If INHERIT_PARENT_THREAD_PRIO specified, inherit from parent thread priority)
+/// \~english @retval HANDLE handle for communicate with child thread
+/// \~english @retval NULL Failure to get HANDLE
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize,CbShutdown) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Detail
+/// This API creates child thread with specified priority(schedPrio) and
+/// returns handle for communicate with child thread.\n
+/// The thread scheduling policy of generated child thread is fixed to first in-first out scheduling
+/// (eFrameworkunifiedSchedPolicyFIFO).\n
+/// Generated child thread creates dispatcher for itself, and initializes the dispatcher. \n
+/// It starts to mainloop that receives request or notification,
+/// and runs registered callback to dispatcher for child thread.\n
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThreadWithPriority(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
+ , CbFuncPtr CbShutdown, SI_32 schedPrio);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateDispatcherChild
+/// \~english @par Breif
+/// Creates and initializes a handle for the child thread's application
+/// \~english @param [out] hChildApp
+/// HANDLE & - A handle for the child thread's application
+/// \~english @param [in] childName
+/// PCSTR - Child thread name
+/// \~english @param [in] parentName
+/// PCSTR - Parent thread name
+/// \~english @retval eFrameworkunifiedStatusOK succss
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Framework generation failure
+/// \~english @par Prerequisite
+/// - A child thread has been created.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If the childName to the child thread name of the application specified in the arguments is NULL [eFrameworkunifiedStatusInvldParam]
+/// - If the parentName to the parent thread name of the application specified in the arguments is NULL [eFrameworkunifiedStatusInvldParam]
+/// - When the parent thread name (parentName) of the application specified in the arguments exceeds 16 bytes [eFrameworkunifiedStatusInvldParam]
+/// - When the normalized message queue name from the childName specified in the arguments exceeds 16 bytes [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open a message queue (mq_open) [eFrameworkunifiedStatusNullPointer]
+/// - When acquisition (malloc) of the message queue management information area fails [eFrameworkunifiedStatusNullPointer]
+/// - If the creation (socket, bind, listen) of sockets for error monitoring fails [eFrameworkunifiedStatusFail]
+/// - When a message queue is created with the name of an already registered thread [eFrameworkunifiedStatusFail]
+/// - Failed to create epoll instances (epoll_create1) [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register Dispatcher message queue descriptor for epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to create file descriptor for receiving events to Dispatcher (eventfd) [eFrameworkunifiedStatusFail]
+/// - Failed to register file descriptor for receiving Dispatcher events to epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// - Failed to register socket for monitoring Dispatcher error in epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API creates a handle for the application of the child thread, initializes it, and returns the handle.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+///
+/// \~english @par Brief
+/// Create and initialize an threads dispatcher.
+///
+/// \~english \param [out] hChildApp
+/// HANDLE& - Reference of application handle
+/// \~english \param [in] childName
+/// PCSTR - create thread name
+/// \~english \param [in] parentName
+/// PCSTR - parent thread name
+///
+/// \~english \return status
+/// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if Success
+/// possible errors from call CreateDispatcher
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateDispatcherChild(HANDLE &hChildApp, PCSTR childName, PCSTR parentName); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateChildThreadWithAttribute
+/// \~english @par Brief
+/// Create child thread with specified thread attributes and dispatcher for child thread, and initialize it
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] childName
+/// PCSTR - Child thread name
+/// \~english @param [in] CbInitialize
+/// CbFuncPtr - Pointer to the callback function for initializing child thread
+/// \~english @param [in] CbShutdown
+/// CbFuncPtr - Pointer to the callback function for stopping child thread
+/// \~english @param [out] attr
+/// FrameworkunifiedChildThreadAttr* - Pointer to thread attributes
+/// \~english @par
+/// FrameworkunifiedChildThreadAttr Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedChildThreadAttr
+/// {
+/// EFrameworkunifiedSchedPolicy schedPolicy; // Thread scheduling policy(Default is eFrameworkunifiedSchedPolicyInherit)
+/// SI_32 schedPriority; // Thread priority(Default is INHERIT_PARENT_THREAD_PRIO)
+/// } FrameworkunifiedChildThreadAttr;
+/// @endcode
+/// \~english @par
+/// enum EFrameworkunifiedSchedPolicy Variable
+/// \~english @code
+/// typedef enum _EFrameworkunifiedSchedPolicy {
+/// eFrameworkunifiedSchedPolicyInherit = 0, // Inherit from parent thread.
+/// eFrameworkunifiedSchedPolicyTSS, // Time Sharing System scheduling
+/// eFrameworkunifiedSchedPolicyFIFO, // First in-first out scheduling
+/// eFrameworkunifiedSchedPolicyRR, // Round-robin scheduling
+/// eFrameworkunifiedSchedPolicyMAX // EFrameworkunifiedSchedPolicy Max(Not to be used.)
+/// } EFrameworkunifiedSchedPolicy;
+/// @endcode
+/// \~english @retval HANDLE handle for communicate with child thread
+/// \~english @retval NULL Failure to get HANDLE
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize,CbShutdown) is NULL. [NULL]
+/// - Thread attribute specified in the argument (attr) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Detail
+/// This API creates child thread with specified thread attributes(attr)
+/// and returns handle for communicate with child thread.\n
+/// Generated child thread creates dispatcher for itself, and initializes the dispatcher. \n
+/// It starts to mainloop that receives request or notification,
+/// and runs registered callback to dispatcher for child thread.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateChildThreadWithAttribute(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize
+ , CbFuncPtr CbShutdown, const FrameworkunifiedChildThreadAttr *attr);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateChildThreadAttrInit
+/// \~english @par Brief
+/// Initialize thread attribute object.
+/// \~english @param [out] attr
+/// FrameworkunifiedChildThreadAttr* - Pointer to thread attribute
+/// \~english @par
+/// FrameworkunifiedChildThreadAttr Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedChildThreadAttr
+/// {
+/// EFrameworkunifiedSchedPolicy schedPolicy; // Thread scheduling policy(Default is eFrameworkunifiedSchedPolicyInherit)
+/// SI_32 schedPriority; // Thread priority(Default is INHERIT_PARENT_THREAD_PRIO)
+/// } FrameworkunifiedChildThreadAttr;
+/// @endcode
+/// \~english @par
+/// enum EFrameworkunifiedSchedPolicy Variable
+/// \~english @code
+/// typedef enum _EFrameworkunifiedSchedPolicy {
+/// eFrameworkunifiedSchedPolicyInherit = 0, // Inherit from parent thread.
+/// eFrameworkunifiedSchedPolicyTSS, // Time Sharing System scheduling
+/// eFrameworkunifiedSchedPolicyFIFO, // First in-first out scheduling
+/// eFrameworkunifiedSchedPolicyRR, // Round-robin scheduling
+/// eFrameworkunifiedSchedPolicyMAX // EFrameworkunifiedSchedPolicy Max(Not to be used.)
+/// } EFrameworkunifiedSchedPolicy;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - the argument attr is NULL. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API initialize thread attribute (attr) by default value of NS framework.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedCreateChildThreadWithAttribute
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateChildThreadAttrInit(FrameworkunifiedChildThreadAttr *attr);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateChildThreadAttrSetSched
+/// \~english @par Brief
+/// Initialize thread attribute object with specified value.
+/// \~english @param [out] attr
+/// FrameworkunifiedChildThreadAttr* - Pointer to thread attribute
+/// \~english @param [in] policy
+/// EFrameworkunifiedSchedPolicy - Thread shcheduling policy at thread start
+/// \~english @param [in] priority
+/// SI_32 - Thread priority at thread start
+/// \~english @par
+/// FrameworkunifiedChildThreadAttr Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedChildThreadAttr
+/// {
+/// EFrameworkunifiedSchedPolicy schedPolicy; // Thread scheduling policy(Default is eFrameworkunifiedSchedPolicyInherit)
+/// SI_32 schedPriority; // Thread priority(Default is INHERIT_PARENT_THREAD_PRIO)
+/// } FrameworkunifiedChildThreadAttr;
+/// @endcode
+/// \~english @par
+/// enum EFrameworkunifiedSchedPolicy Variable
+/// \~english @code
+/// typedef enum _EFrameworkunifiedSchedPolicy {
+/// eFrameworkunifiedSchedPolicyInherit = 0, // Inherit from parent thread.
+/// eFrameworkunifiedSchedPolicyTSS, // Time Sharing System scheduling
+/// eFrameworkunifiedSchedPolicyFIFO, // First in-first out scheduling
+/// eFrameworkunifiedSchedPolicyRR, // Round-robin scheduling
+/// eFrameworkunifiedSchedPolicyMAX // EFrameworkunifiedSchedPolicy Max(Not to be used.)
+/// } EFrameworkunifiedSchedPolicy;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - the argument attr is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - the argument policy is out of range
+/// (less than eFrameworkunifiedSchedPolicyInherit, over eFrameworkunifiedSchedPolicyMAX). [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// This API initializes thread attribute object for child thread with specified value.\n
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// FrameworkunifiedCreateChildThreadWithAttribute
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateChildThreadAttrSetSched(FrameworkunifiedChildThreadAttr *attr, EFrameworkunifiedSchedPolicy policy, SI_32 priority);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedStartChildThread
+/// \~english @par Brief
+/// Send initialize request to the child thread.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] hChildQ
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @param [in] length
+/// UI_32 - Length of send message data
+/// \~english @param [in] data
+/// PCVOID - Pointer to message data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state is depend on application implements.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Data buffer specified in the argument (data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Thread name specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldQName]
+/// - Message queue name of child thread specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusErrOther]
+/// - Type of message queue to child thread is not for sending. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during message sending. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Any errors occur during the transmission of message to the child thread. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API sends initialize request to the child thread from parent thread.\n
+/// Taking this request,
+/// child thread runs callback function for initialize that specified when the thread create.
+/// \~english @par
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Open Close
+/// \~english @see
+/// FrameworkunifiedStopChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedStartChildThread(HANDLE hApp, HANDLE hChildQ, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedStopChildThread
+/// \~english @par Brief
+/// Send shutdown request to the child thread.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] hChildQ
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @param [in] length
+/// UI_32 - Length of send message data
+/// \~english @param [in] data
+/// PCVOID - Pointer to message data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state is depend on application implements.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Data buffer specified in the argument (data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Thread name specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldQName]
+/// - Message queue name of child thread specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusErrOther]
+/// - Type of message queue to child thread is not for sending. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during message sending. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Any errors occur during the transmission of message to the child thread. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API sends shutdown request to the child thread.\n
+/// Taking this request,
+/// child thread runs callback function for shutdown that specified when the thread create.\n
+/// This API does not terminate child thread.
+/// Use FrameworkunifiedDestroyChildThread to terminate child thread from parent thread.
+/// \~english @par
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// FrameworkunifiedStartChildThread FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedStopChildThread(HANDLE hApp, HANDLE hChildQ, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDestroyChildThread
+/// \~english @par Brief
+/// Terminate child thread.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] hChildQ
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusThreadNotExist Thread is not exist
+/// \~english @retval eFrameworkunifiedStatusThreadSelfJoin Self thread specified
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread
+/// (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state is depend on application implements.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hChildQ) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - HANDLE specified in the argument (hChildQ) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Thread name specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldQName]
+/// - Message queue name of child thread specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+/// - Type of message queue to child thread is not for sending. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during message sending. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Message data size is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of message to the child thread. [eFrameworkunifiedStatusFail]
+/// - Child thread is invalid (thread exit or invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Another thread is already waiting to join with this child thread. [eFrameworkunifiedStatusInvldParam]
+/// - Already child thread is in termination process [eFrameworkunifiedStatusInvldParam]
+/// - Thread specified in argument is self thread. [eFrameworkunifiedStatusThreadSelfJoin]
+/// - Failed to close message queue specified in the argument (hChildQ). [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// This API sends terminate request to child thread , and waits to terminate child thread.\n
+/// Taking this request, child thread terminates itself.\n
+/// After child thread terminates, parent thread destroys handle for communicate with child thread.
+/// \~english @par Classification
+/// Public
+/// \~english @see FrameworkunifiedCreateChildThread FrameworkunifiedCreateChildThreadWithAttribute FrameworkunifiedCreateChildThreadWithPriority
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDestroyChildThread(HANDLE hApp, HANDLE hChildQ);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendChild
+/// \~english @par Brief
+/// Send a message to the child thread.
+/// \~english @param [in] hApp
+/// HANDLE - Handle for Application of parent thread
+/// \~english @param [in] hChildQ
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @param [in] iCmd
+/// UI_32 - Command of message
+/// \~english @param [in] length
+/// UI_32 - Length of send message data
+/// \~english @param [in] data
+/// PCVOID - Pointer to message data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildQ) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Data buffer specified in the argument (data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Thread name specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldQName]
+/// - Message queue name of child thread specified in the argument (hChildQ) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusErrOther]
+/// - Type of message queue to child thread is not for sending. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during message sending. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Any errors occur during the transmission of message to the child thread. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API sends a message to the child thread from parent thread.\n
+/// This API is available only from parent thread.
+/// \~english @par
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedSendParent
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendChild(HANDLE hApp, HANDLE hChildQ, UI_32 iCmd, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSendParent
+/// \~english @par Brief
+/// Send a message to the parent thread.
+/// \~english @param [in] hChildApp
+/// HANDLE - Handle for Application of child thread(get as argument of callback function)
+/// \~english @param [in] iCmd
+/// UI_32 - Command of message
+/// \~english @param [in] length
+/// UI_32 - Length of send message data
+/// \~english @param [in] data
+/// PCVOID - Pointer to message data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hChildApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildApp) is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue for parent thread in HANDLE (hChildApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue for parent thread in HANDLE (hChildApp) is not appropriate
+/// (which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Data buffer specified in the argument (data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Thread name specified in the argument (hChildApp) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldQName]
+/// - The name of message queue for parent thread specified in the argument (hChildApp) is not appropriate
+/// (The name is NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusErrOther]
+/// - Type of message queue to parent thread is not for sending. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during message sending. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Any errors occur during the transmission of message to the parent thread. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// This API sends a message to the parent thread from child thread.\n
+/// This API is available only from child thread.
+/// \~english @par
+/// \n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedSendChild
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSendParent(HANDLE hChildApp, UI_32 iCmd, UI_32 length, PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedJoinChild
+/// \~english @par Brief
+/// Wait for child thread terminates.
+/// \~english @param [in] hChildApp
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusThreadNotExist Thread is not exist
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusThreadSelfJoin Self thread specified
+/// \~english @retval eFrameworkunifiedStatusFail thread exit or invalid
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hChildApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Child thread is invalid (thread exit or invalid) [eFrameworkunifiedStatusFail]
+/// - Another thread is already waiting to join with this child thread. [eFrameworkunifiedStatusInvldParam]
+/// - Already child thread is in termination process [eFrameworkunifiedStatusInvldParam]
+/// - Thread specified in argument is self thread. [eFrameworkunifiedStatusThreadSelfJoin]
+/// \~english @par Detail
+/// It waits for terminate of child thread it was created by FrameworkunifiedCreateChildThread
+/// (or similar one) in the parent thread.\n
+/// This API blocks the calling thread until child thread terminates.\n
+/// This API does not terminate child thread.
+/// Use FrameworkunifiedDestroyChildThread to terminate child thread from parent thread.
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// FrameworkunifiedCreateChildThread, FrameworkunifiedCreateChildThreadWithPriority, FrameworkunifiedDestroyChildThread
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedJoinChild(HANDLE hChildApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetChildThreadPriority
+/// \~english @par Brief
+/// Get the child thread priority.
+/// \~english @param [in] hChildApp
+/// HANDLE - Handle for communicate with child thread(returned by FrameworkunifiedCreateChildThread)
+/// \~english @param [out] threadPrio
+/// PSI_32 - Dispatcher file descriptor
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusThreadNotExist Thread is not exist
+/// \~english @retval eFrameworkunifiedStatusFault Error occured during function
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// - Generation/Initialization of Dispatcher for the child thread (FrameworkunifiedCreateChildThread, etc.) has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hChildApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hChildApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - child thread priority in the argument (threadPrio) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Failed to get child thread priority (pthread_getschedparam). [eFrameworkunifiedStatusFault]
+/// - If child threads are inalid or already terminated. [eFrameworkunifiedStatusThreadNotExist]
+/// \~english @par Detail
+/// This API set the child thread priority generated by FrameworkunifiedCreateChildThread to argument threadPrio.
+/// Use to get child thread priority from parent thread.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// FrameworkunifiedCreateChildThread, FrameworkunifiedCreateChildThreadWithPriority
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedGetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio);
+#endif // __NSFRAMEWORK_NFRAMEWORKCORE_MULTITHREADING__ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_service_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_service_if.h
new file mode 100755
index 0000000..b142d11
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_service_if.h
@@ -0,0 +1,267 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_service_if.h
+ * @brief \~english This is base class for service interface classes
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __CSERVICESESSION_H__ // NOLINT (build/header_guard)
+#define __CSERVICESESSION_H__
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////
+/// class: CServiceSession
+/// Description: This is base class for service interface classes
+///
+////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedServiceInterface {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// Constructor for CFrameworkunifiedServiceInterface
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// no preconditions
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// create CFrameworkunifiedServiceInterface class instance
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunifiedServiceInterface
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedServiceInterface();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedServiceInterface
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// CFrameworkunifiedServiceInterface is decleared in constructor
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Release CFrameworkunifiedServiceInterface instance
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedServiceInterface
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFrameworkunifiedServiceInterface();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to open Service.
+ /// \~english @param [in] f_hApp
+ /// HANDLE* - Handle of framework
+ /// \~english @param [in] f_sServiceName
+ /// std::string - Service Name
+ /// \~english @retval HANDLE
+ /// \~english @par Preconditions
+ /// - no preconditions
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Open service by specified name and retrun handle of service. \n
+ /// If FrameworkunifiedOpenService failed, handle is NULL.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedOpenService
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ HANDLE OpenService(const HANDLE f_hApp, std::string f_sServiceName);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to close service.
+ /// \~english @param [in] f_hApp
+ /// HANDLE* - Handle of framework
+ /// \~english @param [in] f_hService
+ /// HANDLE - Handle of the service
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter f_hApp is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - If parameter f_hService is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - If FrameworkunifiedCloseService failed. [eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Detail
+ /// close service by handle \n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedCloseService
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseService(const HANDLE f_hApp, const HANDLE f_hService);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to open session
+ /// \~english @param [in] f_hApp
+ /// HANDLE* -framework handle
+ /// \~english @param [in] f_uisessionType
+ /// UI_32 - sessiontype
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter f_hApp is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - If FrameworkunifiedOpenSessionWithData failed. [eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Detail
+ /// open session by specified session type \n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedOpenSessionWithData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenSession(const HANDLE f_hApp, UI_32 f_uisessionType);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to open session Acknowledge
+ /// \~english @param [in] f_hApp
+ /// HANDLE* - Handle of framework
+ /// \~english @param [in] hSession
+ /// HANDLE - Session Handle
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Empty implement.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see one
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus OpenSessionAcknowledge(const HANDLE f_hApp, HANDLE &hSession); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to close session.
+ /// \~english @param [in] f_hService
+ /// HANDLE* - Handle of service
+ /// \~english @param [in] hSession
+ /// HANDLE - Session Handle
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter f_hService is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - If parameter f_hSession is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - If FrameworkunifiedCloseSession failed. [eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Detail
+ /// close session of specified service. \n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedCloseSession
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseSession(const HANDLE f_hService, const HANDLE f_hSession);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedServiceInterface
+ /// \~english @par Brief
+ /// API to close session.
+ /// \~english @param [in] f_hService
+ /// HANDLE* - Handle of service
+ /// \~english @param [in] hSession
+ /// HANDLE - Session Handle
+ /// \~english @retval EFrameworkunifiedStatus
+ /// Success or Error
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter hClient is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If FrameworkunifiedGetMsgDataOfSize failed. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Check close session acknowledge.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedGetMsgDataOfSize
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseSessionAcknowledge(const HANDLE hClient);
+};
+#endif // __CSERVICESESSION_H__ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_service_protocol.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_service_protocol.h
new file mode 100755
index 0000000..e66119e
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_service_protocol.h
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeServices
+/// \brief
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_service_protocol.h
+ * @brief \~english Include enums, structs and frameworkunified_types.h
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef FRAMEWORKUNIFIED_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard)
+#define FRAMEWORKUNIFIED_SERVICE_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+#define NS_INVALID_SESSION 0xFFFF
+
+typedef enum _EBaseProtocol {
+ PROTOCOL_OPEN_SESSION_REQ = 0x00, ///< Open session request (client > service)
+ PROTOCOL_OPEN_SESSION_ACK = 0x01, ///< Open session ack (service > client)
+ PROTOCOL_OPEN_SESSION_REQ_SYNC = 0x02, ///< Open session request sync (client > service)
+ PROTOCOL_CLOSE_SESSION_REQ = 0x03, ///< Close session request (client > service)
+ PROTOCOL_CLOSE_SESSION_ACK = 0x04, ///< Close session ack (service > client)
+ PROTOCOL_CLOSE_SESSION_REQ_SYNC = 0x05, ///< Close session request sync (client > service)
+
+ PROTOCOL_REGISTER_EVENTS = 0x06, ///< Register for events (client > service)
+ PROTOCOL_REGISTER_EVENTS_ACK = 0x07, ///< Register for events ack (service > client)
+ PROTOCOL_UNREGISTER_EVENTS = 0x08, ///< Un-Register for events (client > service)
+
+ PROTOCOL_THREAD_INITIALIZATION = 0x09, ///< Initialize thread after creation
+ PROTOCOL_THREAD_WAKEUP = 0x0A, ///< Wakeup Thread after sleep
+ PROTOCOL_THREAD_SHUTDOWN = 0x0B, ///< Stop the thread
+ PROTOCOL_THREAD_DESTROY = 0x0C, ///< Destroy the thread
+ PROTOCOL_RSV_0D = 0x0D, ///< Reserved
+ PROTOCOL_RSV_0E = 0x0E, ///< Reserved
+ PROTOCOL_DIS_MSGPROFILER = 0x0F, ///< Reserved
+
+ PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD = 0x10, ///< Protocols between range PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD
+ PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD = 0xFFFFFFF0, ///< are available for FRAMEWORKUNIFIED applications to use.
+
+ PROTOCOL_RSV_xF1 = 0xFFFFFFF1, ///< Reserved
+ PROTOCOL_RSV_xF2 = 0xFFFFFFF2, ///< Reserved
+ PROTOCOL_RSV_xF3 = 0xFFFFFFF3, ///< Reserved
+ PROTOCOL_RSV_xF4 = 0xFFFFFFF4, ///< Reserved
+ PROTOCOL_RSV_xF5 = 0xFFFFFFF5, ///< Reserved
+ PROTOCOL_RSV_xF6 = 0xFFFFFFF6, ///< Reserved
+ PROTOCOL_RSV_xF7 = 0xFFFFFFF7, ///< Reserved
+ PROTOCOL_RSV_xF8 = 0xFFFFFFF8, ///< Reserved
+ PROTOCOL_RSV_xF9 = 0xFFFFFFF9, ///< Reserved
+ PROTOCOL_RSV_xFA = 0xFFFFFFFA, ///< Reserved
+ PROTOCOL_RSV_xFB = 0xFFFFFFFB, ///< Reserved
+ PROTOCOL_RSV_xFC = 0xFFFFFFFC, ///< Reserved
+
+ PROTOCOL_TIMER_DUMMY_CMD = 0xFFFFFFFD, ///< NS internally use this command in timer
+
+ PROTOCOL_FRAMEWORKUNIFIED_NOTIFICATION = 0xFFFFFFFE,
+ PROTOCOL_FRAMEWORKUNIFIED_ANY_COMMAND = 0xFFFFFFFF
+} EBaseProtocol;
+
+typedef struct _OpenSessionAck {
+ EFrameworkunifiedStatus eStatus;
+ UI_32 sessionId;
+ CHAR cSessionName[MAX_QUEUE_NAME_SIZE];
+ UI_32 sessionType;
+} OpenSessionAck;
+
+
+typedef struct _CloseSessionReq {
+ UI_32 sessionId;
+ CHAR cSessionName[MAX_QUEUE_NAME_SIZE];
+} CloseSessionReq;
+
+typedef struct _CloseSessionAck {
+ UI_32 sessionId;
+ EFrameworkunifiedStatus eStatus;
+} CloseSessionAck;
+
+#endif /* FRAMEWORKUNIFIED_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_action.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_action.h
new file mode 100755
index 0000000..58dbf22
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_action.h
@@ -0,0 +1,150 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief This file has class declaration of the CFrameworkunifiedAction. This is an
+/// interface class that defines interfaces for implementing action
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_action.h
+ * @brief \~english This file has class declaration of the CFrameworkunifiedAction. This is an interface class that defines
+ * interfaces for implementing action
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMACTION_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMACTION_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <boost/smart_ptr.hpp>
+#include <string>
+
+class CFrameworkunifiedState;
+
+class CEventData;
+typedef boost::shared_ptr<CEventData> CEventDataPtr;
+
+class CFrameworkunifiedAction {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedAction
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedAction.
+ /// \~english @param [in] f_strName
+ /// std::string -Name of Action object
+ /// \~english @retval
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Constructor of CFrameworkunifiedAction class. Create an object of CFrameworkunifiedAction. \n
+ /// Initialize member value with name designated by f_strName. \n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunifiedAction
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedAction(std::string f_strName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedAction
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedAction
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Pure virtual function , implemented by child class
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedAction
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedAction() {
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedAction
+ /// \~english @par Brief
+ /// Callback function of CFrameworkunifiedAction.(pure virtual function)
+ /// \~english @param [in] f_pSourceState
+ /// CFrameworkunifiedState - pointer of source state
+ /// \~english @param [in] f_pTargetState
+ /// CFrameworkunifiedState - pointer of target state
+ /// \~english @param [in] f_pData
+ /// CEventDataPtr - pointer of event data
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - none
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// Callback function of CFrameworkunifiedAction.(pure virtual function)
+ /// Implement action by subclass
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual VOID FrameworkunifiedAction(CFrameworkunifiedState *f_pSourceState, CFrameworkunifiedState *f_pTargetState,
+ CEventDataPtr f_pData) = 0;
+
+ // action name
+ std::string m_strName;
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMACTION_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_compositestate.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_compositestate.h
new file mode 100755
index 0000000..72ac640
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_compositestate.h
@@ -0,0 +1,434 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedCompositeState class definitions. CFrameworkunifiedCompositeState is derived from C
+/// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Composite
+/// state. It provides the standard interfaces for adding state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_compositestate.h
+ * @brief \~english This file has the CFrameworkunifiedCompositeState class definitions. CFrameworkunifiedCompositeState is derived from C
+ * FrameworkunifiedState class.This class implements the additional functionality supported by HSM Composite
+ * state. It provides the standard interfaces for adding state.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDCOMPOSITESTATE_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDCOMPOSITESTATE_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_state.h>
+#include <map>
+#include <string>
+
+typedef std::map<std::string, CFrameworkunifiedState *> ChildStateList;
+typedef std::map<std::string, CFrameworkunifiedState *>::iterator StateIterator;
+
+class CFrameworkunifiedHSM;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM Composite
+/// state. It provides the standard interfaces for adding state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedCompositeState : public CFrameworkunifiedState {
+ public :
+
+ typedef enum _FRAMEWORKUNIFIED_STATE_TYPE {
+ eFrameworkunifiedState = 0,
+ eFrameworkunifiedDefaultState
+ } FRAMEWORKUNIFIED_STATE_TYPE;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedCompositeState.
+ /// \~english @param [in] f_strName
+ /// std::string -Name of state
+ /// \~english @retval
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// This class inherit from CFrameworkunifiedState(basic class of state machine), \n
+ /// and create object of CFrameworkunifiedCompositeState class. \n
+ /// Create and initialize child state, and set the pointor to member variable. \n
+ /// Initialize other member variables with NULL. \n
+ /// Output the process error logs.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState, ~CFrameworkunifiedCompositeState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedCompositeState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedCompositeState
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Release the objects of CFrameworkunifiedState class and CFrameworkunifiedCompositeState class. \n
+ /// Release all the child states registered in child states list of member variable. \n
+ /// Output error log if failed.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState, CFrameworkunifiedCompositeState::CFrameworkunifiedCompositeState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedCompositeState();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// sets the given state as a substate of the current state. If the f_eStateType is
+ /// eFrameworkunifiedDefaultState then substate is default state for current state.
+ /// \~english @param [in] f_pState
+ /// CFrameworkunifiedState* - Pointer to the substate object to be added in the current state
+ /// \~english @param [in] f_eStateType
+ /// FRAMEWORKUNIFIED_STATE_TYPE - state type indicating if it is default state
+ /// \~english @retval EFrameworkunifiedStatus
+ /// success or fail
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter f_pState is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If m_pChildStates is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// sets the given state as a substate of the current state. If the f_eStateType is
+ /// eFrameworkunifiedDefaultState then substate is default state for current state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedAddState(CFrameworkunifiedState *f_pState,
+ FRAMEWORKUNIFIED_STATE_TYPE f_eStateType = eFrameworkunifiedState);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Returns the default state of the current composite state.
+ /// \~english @param none
+ /// \~english @retval CFrameworkunifiedState* - pointer default state
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Returns the default state of the current composite state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedState *FrameworkunifiedGetDefaultState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Logs the state name and events associated with the state.
+ /// \~english @param none
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer failed
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - Don't create instance of CFrameworkunifiedCompositeState [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This function overrides the fuction of CFrameworkunifiedState::FrameworkunifiedPrintStates.
+ /// This function outputs log of state name and events associated with the state as follows:
+ /// - state name of parent state machine and self state machine
+ /// - all the event names in event list
+ /// - all the event names in delay event list
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedPrintStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// This indicates if the state has sub states. It returns TRUE only in the CompositeState
+ /// where this function is overridden
+ /// \~english @param none
+ /// \~english @retval BOOL TRUE - has substate FALSE - has not substatue
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// This function overrides the fuction of CFrameworkunifiedState::FrameworkunifiedHasSubStates.
+ /// Return true only in CFrameworkunifiedCompositeState class.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedHasSubStates
+ virtual BOOL FrameworkunifiedHasSubStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// This interface returns the Active state of the current composite state. In case of
+ /// non-composite state current state is active state
+ /// \~english @param none
+ /// \~english @retval CFrameworkunifiedState* pointer of active state
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// This function overrides the pure virtual fuction of CFrameworkunifiedState::FrameworkunifiedGetActiveState.
+ /// Reture active state of current composite state. If it isn't a composite state,
+ /// return current state as an active state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedGetActiveState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// This function stores the last active state
+ /// \~english @param none
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// This function overrides the pure virtual fuction of CFrameworkunifiedState::UpdateHistory.
+ /// Store the last active state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState::UpdateHistory
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UpdateHistory();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Update the State information in the given stream in the form of XML tags
+ ///
+ /// \~english @param f_strXMLString
+ /// std::ostringstream & - reference to the XML stream
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
+ /// eFrameworkunifiedStatusNullPointer
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedCompositeState created.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal status
+ /// - Self instance of CFrameworkunifiedCompositeState created failed. [eFrameworkunifiedStatusNullPointer].
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Detail
+ /// This function overrides the fuction of CFrameworkunifiedState::FrameworkunifiedPrintXML.
+ /// Set parameter f_strXMLString with the following state information by XML type.
+ /// - state name
+ /// - all the event information in event list(event ID, event name)
+ /// - all the event information in delay event list(event ID, event name)
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedPrintXML
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString);
+
+
+ protected :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Initialize state
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @par Preconditions
+ /// - Its own instance (CFrameworkunifiedCompositeState) has been created.
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides and uses CFrameworkunifiedState::FrameworkunifiedOnEntry, which is pure virtual functions, to initialize state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedOnEntry, FrameworkunifiedOnExit
+ ///
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Clean up state.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @par Preconditions
+ /// - Its own instance (CFrameworkunifiedCompositeState) has been created.
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides and uses CFrameworkunifiedState::FrameworkunifiedOnExit, which is pure virtual functions, to clean up state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedOnExit, FrameworkunifiedOnEntry
+ ///
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
+
+ /// stores the pointers to sub state, key is state name
+ ChildStateList *m_pChildStates;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedCompositeState
+ /// \~english @par Brief
+ /// Associate the state machine with the current state.
+ /// \~english @param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Pointers to state machines (CFrameworkunifiedHSM classes)
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+ /// \~english @par Preconditions
+ /// - Its own instance (CFrameworkunifiedCompositeState) has been created.
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - When the pointers to the state machines (CFrameworkunifiedHSM classes) specified in the arguments (f_pStatemachine) are NULL [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This method is used by overriding CFrameworkunifiedState::FrameworkunifiedSetHSM.\n
+ /// Associates a state machine with the current state by setting a pointer (f_pStatemachine)
+ /// to the state machine (CFrameworkunifiedHSM) specified by the argument to the pointer to the state machine of the member variable. \n
+ /// Calling FrameworkunifiedSetHSM() for child states also associates the state machine of the child states with the state of the current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedHSM, CFrameworkunifiedState::FrameworkunifiedSetHSM
+ ///
+ /// Sets the statemachine in the status
+ ///
+ /// \param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Statemachine pointer
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine);
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CheckHistory
+ /// This function searches for history state in this composite state and updates it.
+ ///
+ /// \param [in] l_cHistoryType
+ /// string - Type of history state (shallow or deep)
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CheckHistory(std::string l_cHistoryType);
+};
+
+#endif // _FRAMEWORKUNIFIEDCOMPOSITESTATE_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_conditionconnector.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_conditionconnector.h
new file mode 100755
index 0000000..110c151
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_conditionconnector.h
@@ -0,0 +1,203 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+/// This file has class declaration of the CFrameworkunifiedConditionConnector. This class is responsible for
+/// implementing interfaces required to use condition connector in statemachine.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_conditionconnector.h
+ * @brief \~english This file has class declaration of the CFrameworkunifiedConditionConnector. This class is responsible for
+ * implementing interfaces required to use condition connector in statemachine.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMCONDITIONCONNECTOR_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMCONDITIONCONNECTOR_H__
+
+#include <native_service/frameworkunified_sm_externaltransition.h>
+#include <string>
+#include <vector>
+
+// This class is responsible for implementing interfaces required to use condition connector in statemachine.
+class CFrameworkunifiedConditionConnector : public CFrameworkunifiedExternalTransition {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedConditionConnector
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedConditionConnector.
+ /// \~english @param [in] f_strName
+ /// std::string - Name of the condition connector
+ /// \~english @retval
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Inherite from base class CFrameworkunifiedExternalTransition.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedExternalTransition, ~CFrameworkunifiedConditionConnector
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedConditionConnector(std::string f_strName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedConditionConnector
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedCompositeState
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedConditionConnector created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Class CFrameworkunifiedExternalTransition instance and CFrameworkunifiedConditionConnector instance release.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedConditionConnector::CFrameworkunifiedConditionConnector
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedConditionConnector();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedConditionConnector
+ /// \~english @par Brief
+ /// This API evaluates the guards added in the condition list. If the guard is evaluated as
+ /// true then statemachine transitions to target state associated with guard.
+ /// \~english @param [in] f_pSourceState
+ /// CFrameworkunifiedState* - Source state in which reaction is being executed
+ /// \~english @param [in] f_pData
+ /// CEventDataPtr - event data
+ /// \~english @retval CFrameworkunifiedState*
+ /// CFrameworkunifiedState* - Returns Active state
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedConditionConnector created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If parameter f_pSourceState is NULL. [NULL]
+ /// - If m_pConditionList is NULL. [NULL]
+ /// \~english @par Detail
+ /// This API evaluates the guards added in the condition list. If the guard is evaluated as
+ /// true then statemachine transitions to target state associated with guard.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedConditionConnector
+ /// \~english @par Brief
+ /// Adds connect condition into condition list of current connection
+ /// \~english @param [in] f_pGuard
+ /// CFrameworkunifiedState* - Pointer to the guard object to be added in the currrent connection
+ /// \~english @param [in] f_pTargetState
+ /// CFrameworkunifiedState* - Target state for given guard condition
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
+ /// eFrameworkunifiedStatusNullPointer
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedConditionConnector created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If m_pConditionList is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If parameter f_pGuard is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If parameter f_pTargetState is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Adds connect condition into condition list of current connection.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedAddCondition(CFrameworkunifiedGuard *f_pGuard, CFrameworkunifiedState *f_pTargetState);
+
+ private:
+ // This class defines the conditions required in condition connector
+ class CCondition {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CCondition
+ /// Parameterized constructor
+ /// \param [in] f_pGuard
+ /// CFrameworkunifiedGuard* - guard object
+ /// \param [in] f_pTargetState
+ /// CFrameworkunifiedState* - target state for a condition
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CCondition(CFrameworkunifiedGuard *f_pGuard, CFrameworkunifiedState *f_pTargetState);
+
+ // pointer to guard that will be evaluated for a condition
+ CFrameworkunifiedGuard *m_pGuard;
+
+ // pointer to target state for a condition
+ CFrameworkunifiedState *m_pTargetState;
+ };
+
+ // Condition list
+ typedef std::vector<CCondition *> TConditionList;
+
+ // Condition list iterator
+ typedef TConditionList::iterator TConditionIterator;
+
+ // condition connector name
+ std::string m_strName;
+
+ // List of conditions
+ TConditionList *m_pConditionList;
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMCONDITIONCONNECTOR_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_deephistorystate.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_deephistorystate.h
new file mode 100755
index 0000000..fbb74ee
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_deephistorystate.h
@@ -0,0 +1,141 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the declaration of class CFrameworkunifiedDeepHistoryState . CFrameworkunifiedDeepHistoryState is
+/// derived from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported
+/// by HSM Deep History state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_deephistorystate.h
+ * @brief \~english This file has the declaration of class CFrameworkunifiedDeepHistoryState.CFrameworkunifiedDeepHistoryState is
+ * derived from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported
+ * by HSM Deep History state.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_SM_DEEPHISTORYSTATE_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_SM_DEEPHISTORYSTATE_H__
+
+#include <native_service/frameworkunified_sm_historystate.h>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM Shallow History state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedDeepHistoryState : public CFrameworkunifiedHistoryState {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedDeepHistoryState
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedDeepHistoryState.
+ /// \~english @param [in] f_pName
+ /// std::string - Name of the state
+ /// \~english @retval
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Inherite from base class CFrameworkunifiedHistoryState.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedHistoryState, ~CFrameworkunifiedDeepHistoryState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedDeepHistoryState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedDeepHistoryState
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedDeepHistoryState
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedDeepHistoryState created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Class CFrameworkunifiedHistoryState instance and CFrameworkunifiedDeepHistoryState instance release.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedDeepHistoryState::CFrameworkunifiedDeepHistoryState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ~CFrameworkunifiedDeepHistoryState();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedDeepHistoryState
+ /// \~english @par Brief
+ /// This function stores the last active state
+ /// \~english @param
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK
+ /// eFrameworkunifiedStatusNullPointer
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedConditionConnector created.
+ /// \~english @par Change of internal status
+ /// - none
+ /// \~english @par Conditions of processing failure
+ /// - If m_pParentState is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This function stores the last active state.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UpdateHistory();
+
+ private:
+ static const UI_32 m_suievDeepHistory;
+};
+
+#endif /* __FRAMEWORKUNIFIED_SM_DEEPHISTORYSTATE_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_dispatcher.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_dispatcher.h
new file mode 100755
index 0000000..2f392ba
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_dispatcher.h
@@ -0,0 +1,338 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Application dispatch interface functions
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_dispatcher.h
+ * @brief \~english Application dispatch interface functions
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_SM_DISPATCHER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_SM_DISPATCHER_H__
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+
+class CFrameworkunifiedHSMFramework;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedHSMDispatcher
+/// \~english @par Brief
+/// Creates, initializes and runs the HSM dispatcher.
+/// \~english @param [in] cAppName
+/// PCSTR - pointer of Application/ thread name
+/// \~english @retval EFrameworkunifiedStatus
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// none
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcher(PCSTR cAppName);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedHSMDispatcherWithArguments
+/// \~english @par Brief
+/// This API creates, initializes the dispatcher and runs loop with command-line options.
+/// \~english @param [in] cAppName
+/// PCSTR - Pointer to application thread name
+/// \~english @param [in] argc
+/// int - Number of command-line options
+/// \~english @param [in] argv
+/// char *[] - Array of pointer to command-line options
+/// \~english @param [in] CbHandler
+/// const FrameworkunifiedDefaultCallbackHandler* - Pointer to default callback functions.
+/// \~english @param [in] f_pFrameworkunifiedHSM
+/// CFrameworkunifiedHSMFramework* - state machine object pointer(default NULL)
+/// \~english @param [in] cmdLineOptions
+/// CustomCommandLineOptions* - Parser setting of command-line options(Optional. When don't use, set NULL.)
+/// \~english @par
+/// FrameworkunifiedDefaultCallbackHandler Structure
+/// \~english @code
+/// typedef struct _FrameworkunifiedDefaultCallbackHandler
+/// {
+/// CbFuncPtr onInitilization; /* Function is called when a Dispatcher is created. */
+/// CbFuncPtr onDestroy; /* Function is called when the Dispatcher is released. */
+/// CbFuncPtr onStart; /* Function is called when the Dispatcher is started. */
+/// CbFuncPtr onStop; /* Function is called when the Dispatcher is stopped. */
+/// CbFuncPtr onPreStart; /* Function is called when the Dispatcher is pre started. */
+/// CbFuncPtr onPreStop; /* Function is called when the Dispatcher is pre stoped. */
+/// CbFuncPtr onBackgroundStart; /* Function is called when the Dispatcher is Background started. */
+/// CbFuncPtr onBackgroundStop; /* Function is called when the Dispatcher is Background stopped. */
+/// CbFuncPtr onDebugDump; /* Function is called when the Dispatcher detects abnormal state. */
+/// CbFuncPtr createStateMachine; /* Set dummy function that does nothing. */
+/// CbFuncPtr ssFrameworkInterface; /* Function to connect to SystemManager */
+/// } FrameworkunifiedDefaultCallbackHandler;
+/// @endcode
+/// \~english @par
+/// CustomCommandLineOptions Structure
+/// \~english @code
+/// typedef struct _CustomCommandLineOptions
+/// {
+/// PCSTR cShortOptions; /* Short options list. */
+/// PCHAR cLongOptions; /* Reserved. Set to NULL. */
+/// CbArgumentParser callback; /* Pointer to callback function to parse command-line options. */
+/// } CustomCommandLineOptions;
+/// @endcode
+/// \~english @par
+/// About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
+/// - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
+/// - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
+/// - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+/// - If application is resident service, link library libSS_SystemIfUnified
+/// (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
+/// - If application is nonresident service, define function that does nothing below.
+/// - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - Pointer to default callback functions specified in the argument (CbHandler) is NULL. [eFrameworkunifiedStatusNullPointer]
+/// - One of members in default callback functions specified in the argument (CbHandler) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
+/// 15byte). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
+/// - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
+/// - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
+/// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+/// - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) has occurred during the transmission of the session message for the
+/// NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+/// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+/// - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
+/// - The result of FrameworkunifiedOnInitialization is not eFrameworkunifiedStatusOK. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Detail
+/// This API creates and initializes the dispatcher with command-line options.\n
+/// It starts to mainloop that receives request or notification, and runs registered callback to dispatcher.
+/// When success starting mainloop, never return.
+/// Use this API to take over a command-line options to the dispatcher.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Error handling is not performed when the state machine event registration process (CFrameworkunifiedHSMFramework::FrameworkunifiedCreate) fails.\n
+/// The behavior of state machine objects must be guaranteed by the application implementation.
+/// - When an exception occurs during Dispatcher generating, an error log is output and eFrameworkunifiedStatusOK is returned.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see none
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherWithArguments(PCSTR cAppName, int argc, char *argv[],
+ const FrameworkunifiedDefaultCallbackHandler *CbHandler,
+ CFrameworkunifiedHSMFramework *f_pFrameworkunifiedHSM = NULL,
+ CustomCommandLineOptions *cmdLineOptions = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetHSMType
+/// \~english @par Brief
+/// Set the Application Statemachine Type
+/// \~english @param [in] cAppName
+/// PCSTR - pointer of Application/ thread name
+/// \~english @code
+/// typedef enum _EUserChangeOptions {
+/// eUserchangeIgnore = 0,
+/// eUserchangeReInit,
+/// eUserchangeRetPrevState
+/// } EUserChangeOptions;
+/// @endcode
+/// \~english @retval EFrameworkunifiedStatus
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// none
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void FrameworkunifiedSetHSMType(EUserChangeOptions f_eHSMType);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedEnableAutoPublishServiceAvailable
+/// \~english @par Brief
+/// Enables the AutoPublishServiceAvailability Feature
+/// \~english @param none
+/// \~english @retval EFrameworkunifiedStatus
+/// \~english @par Prerequisite
+/// - Prerequisites are nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// Enables the AutoPublishServiceAvailability Feature that publishes the service
+/// availability on entry of sFrameworkunifiedReady state and publishes the service unavailability
+/// on exit of sFrameworkunifiedReady state.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// none
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void FrameworkunifiedEnableAutoPublishServiceAvailable();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDisableAutoPublishServiceAvailable
+/// \~english @par Brief
+/// Disable to the AutoPublishServiceAvailability Feature.
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - Prerequisite is nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// None.
+/// \~english @par Detail
+/// This API disable feature that notify automatically service availability to clients
+/// at the timing of changing of internal state.\n
+/// If you disable this feature, the application needs to publish service availability state explicitly
+/// using FrameworkunifiedPublishServiceAvailability.
+/// \~english @par Classification
+/// Forbidden
+/// \~english @see FrameworkunifiedHSMDispatcherWithArguments FrameworkunifiedPublishServiceAvailability
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDisableAutoPublishServiceAvailable
+/// Disables the AutoPublishServiceAvailability Feature that publishes the service
+/// availability on entry of sFrameworkunifiedReady state and publishes the service unavailability
+/// on exit of sFrameworkunifiedReady state. Applications are responsible for publishing the service
+/// availability.
+void FrameworkunifiedDisableAutoPublishServiceAvailable();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedHSMEnableWaitInStoppingState
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedHSMEnableWaitInStoppingState
+/// If HSM application should wait in sStoppingState until user explicitly publishes evFrameworkunifiedStopComplete,
+/// then call this function before FrameworkunifiedHSMDispatcher APIs.
+/// Default behavior is application will not wait is sStoppingState.
+///
+/// \~english @par Brief
+/// Change state application when call FrameworkunifiedOnStop().
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - Prerequisite is nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// None.
+/// \~english @par Detail
+/// If HSM application should wait in sStoppingState until user explicitly publishes evFrameworkunifiedStopComplete,
+/// then call this function before FrameworkunifiedHSMDispatcher APIs.
+/// Default behavior is application will not wait in sStoppingState.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// none
+/// \~english @see FrameworkunifiedHSMDisableWaitInStoppingState
+VOID FrameworkunifiedHSMEnableWaitInStoppingState();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedHSMDisableWaitInStoppingState
+/// \~english @par Brief
+/// Chanage state to not wait in sStoppingState.
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - Prerequisite is nothing.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// None.
+/// \~english @par Detail
+/// If HSM application should not wait in sStoppingState, then call this function before FrameworkunifiedHSMDispatcher APIs.\n
+/// Default behavior is application will not wait is sStoppingState. So, it's not mandatory to use it.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// none
+/// \~english @see FrameworkunifiedHSMEnableWaitInStoppingState
+VOID FrameworkunifiedHSMDisableWaitInStoppingState();
+
+#endif // __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_SM_DISPATCHER_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventdata.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventdata.h
new file mode 100755
index 0000000..e54d095
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventdata.h
@@ -0,0 +1,83 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+/// This file has class declaration of the CFrameworkunifiedAction. This is an interface class that defines
+/// interfaces for implementing action
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_eventdata.h
+ * @brief \~english This file has class declaration of the CFrameworkunifiedAction. This is an interface class that defines
+ * interfaces for implementing action
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMEVENTDATA_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMEVENTDATA_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+#include <boost/smart_ptr.hpp>
+
+
+class CEventData {
+ public:
+ CEventData(UI_32 f_uiEventId): m_uiEventId(f_uiEventId) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "CEventData parameterized constructor"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ virtual ~CEventData() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "CEventData destructor"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+ // event id
+ UI_32 m_uiEventId;
+
+ private:
+ CEventData() {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_SM_USR_INFO, __FUNCTION__, "CEventData constructor");
+ }
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSFRAMEWORKCORE_STATEMACHINE_INC_FRAMEWORKUNIFIEDSMEVENTDATA_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventfactory.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventfactory.h
new file mode 100755
index 0000000..02a2b3b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_eventfactory.h
@@ -0,0 +1,114 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file defines the events used by the statemachine framework
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_eventfactory.h
+ * @brief \~english This file defines the events used by the statemachine framework.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef CFRAMEWORKUNIFIEDEVENTFACTORY_H_ // NOLINT (build/header_guard)
+#define CFRAMEWORKUNIFIEDEVENTFACTORY_H_
+
+#include <native_service/frameworkunified_types.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class defines the events used by the statemachine framework
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedEventFactory {
+ public:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedEventFactory
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedEventFactory.
+ /// \~english @param none
+ /// \~english @retval
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunifiedEventFactory
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedEventFactory();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedEventFactory
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedEventFactory
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedEventFactory created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Class CFrameworkunifiedHistoryState instance release.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedEventFactory::CFrameworkunifiedEventFactory
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedEventFactory();
+
+ /// Defines the events for starting an application
+ static const UI_32 evFrameworkunifiedStart = 0;
+
+ /// Defines the Higher limit for event id reserved only for framework
+ static const UI_32 evFrameworkunifiedEventLimit = 10;
+};
+
+#endif /* CFRAMEWORKUNIFIEDEVENTFACTORY_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_externaltransition.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_externaltransition.h
new file mode 100755
index 0000000..a466806
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_externaltransition.h
@@ -0,0 +1,268 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedExternalTransition class definitions. CFrameworkunifiedExternalTransition is derived
+/// from CFrameworkunifiedTransition class.This class implements the FrameworkunifiedReaction interface to support transition
+/// from one state to another state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_externaltransition.h
+ * @brief \~english This file has the CFrameworkunifiedExternalTransition class definitions. CFrameworkunifiedExternalTransition is derived
+ * from CFrameworkunifiedTransition class.This class implements the FrameworkunifiedReaction interface to support transition
+ * from one state to another state.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_EXTERNALTRANSITION_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_EXTERNALTRANSITION_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_transition.h>
+#include <vector>
+class CFrameworkunifiedGuard;
+class CFrameworkunifiedAction;
+class CEventData;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the FrameworkunifiedReaction interface to support transition
+/// from one state to another state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedExternalTransition : public CFrameworkunifiedTransition {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedExternalTransition
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedExternalTransition.
+ /// \~english @param [in] f_pTargetState
+ /// CFrameworkunifiedState* - pointer of target CFrameworkunifiedState object
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// inherit the CFrameworkunifiedTransition class and create instance of CFrameworkunifiedExternalTransition class \n
+ /// create the list for CFrameworkunifiedAction class,set pointer as member parameter\n
+ /// this class is intanced with FrameworkunifiedReaction interfase in order to support changing one state to other state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedExternalTransition, FrameworkunifiedReaction, FrameworkunifiedAddAction
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedExternalTransition
+ /// Parameterized constructor
+ /// \param [in] f_pTargetState
+ /// CFrameworkunifiedState* - Target state object
+ ///
+ /// \return none
+ CFrameworkunifiedExternalTransition(CFrameworkunifiedState *f_pTargetState); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedExternalTransition
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedExternalTransition
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedExternalTransition created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Class CFrameworkunifiedHistoryState instance release. \n
+ /// Member variable active action list of CFrameworkunifiedAction release.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedExternalTransition::CFrameworkunifiedExternalTransition
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedExternalTransition
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedExternalTransition();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedExternalTransition
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedReaction
+ /// The reaction for an event is implemented in this function. For external transition, Exit
+ /// of the source state is called and entry of the target state is called recursively.
+ ///
+ /// \~english @par Brief
+ /// CFrameworkunifiedExternalTransition instance event process.
+ /// \~english @param f_pSourceState
+ /// CFrameworkunifiedState* - source state object pointer
+ /// \~english @param f_pData
+ /// CEventDataPtr* - CEventData event pointer
+ /// \~english @retval CFrameworkunifiedState* active state pointer
+ /// \~english @retval NULL
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedExternalTransition created.
+ /// \~english @par Change of internal status
+ /// - If input parameter f_pSourceState is NULL. [NULL]
+ /// - If member variable m_pTargetState is NULL. [NULL]
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// if the self-instance has guard object,event operation will not conduct.
+ /// return soucestate(CFrameworkunifiedState class)object()f_pSourceState(set from parameter) as
+ /// activestate(CFrameworkunifiedState class)object\n
+ /// as activestate(CFrameworkunifiedState class)object
+ /// if there is no guard object:
+ /// - Exit process(FrameworkunifiedOnHSMStop call)for sorcestate(CFrameworkunifiedStateclass)object will conduct once more.
+ /// - Entryt process(FrameworkunifiedOnHSMStart call)for target state(CFrameworkunifiedState class)objectwill conduct once more.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedSetGuard, FrameworkunifiedAddAction
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedExternalTransition
+ /// \~english @par Brief
+ /// Sets the Guard object in External Transition
+ /// \~english @param f_pGuard
+ /// CFrameworkunifiedGuard* - CFrameworkunifiedGuard object pointer
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedExternalTransition created.
+ /// \~english @par Change of internal status
+ /// - If input parameter CFrameworkunifiedGuard is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Sets the Guard object in CFrameworkunifiedExternalTransition instance\n
+ /// in order to guard the transform process. and during setting process,\n
+ /// transform is not conduct
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedReaction, FrameworkunifiedAddAction
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSetGuard
+ /// Sets the Guard object in External Transition
+ ///
+ /// \param [in] f_pGuard
+ /// CFrameworkunifiedGuard* - guard object
+ ///
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus -
+ ///
+ virtual EFrameworkunifiedStatus FrameworkunifiedSetGuard(CFrameworkunifiedGuard *f_pGuard);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedExternalTransition
+ /// \~english @par Brief
+ /// Adds CFrameworkunifiedAction object to the action list
+ /// \~english @param f_pAction
+ /// CFrameworkunifiedAction* - CFrameworkunifiedAction object pointer
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedExternalTransition created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - If input parameter CFrameworkunifiedAction is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If member variable m_pActionList is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// add CFrameworkunifiedAction class object to the end of the list for CFrameworkunifiedAction class in parameter
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedReaction, FrameworkunifiedSetGuard
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedAddAction(CFrameworkunifiedAction *f_pAction);
+
+
+ protected :
+ /// pointer to the guard condition object
+ CFrameworkunifiedGuard *m_pGuard;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ExecuteTransition
+ /// Execute the transition actions, calls OnExit of Source State and OnEntry of target state
+ ///
+ /// \param [in] f_pSourceState
+ /// CEventDataPtr - source state
+ ///
+ /// \param [in] f_pData
+ /// CFrameworkunifiedState* - Event data
+ ///
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus -
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedState *ExecuteTransition(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData);
+
+ // Action list
+ typedef std::vector<CFrameworkunifiedAction *> TActionList;
+
+ // Action list iterator
+ typedef TActionList::iterator TActionListIterator;
+
+ // List of conditions
+ TActionList *m_pActionList;
+};
+#endif // __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_EXTERNALTRANSITION_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_dispatch.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_dispatch.h
new file mode 100755
index 0000000..70afea1
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_dispatch.h
@@ -0,0 +1,1054 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_framework_dispatch.h
+ * @brief \~english This file contains basic api to operate state machine
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_DISPATCH_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_DISPATCH_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedSetStateMachine
+/// \~english @par Brief
+/// Get pointer to the statemachine object.
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the framework application
+/// \~english @retval CFrameworkunifiedHSMParentFramework* pointer to the statemachine object
+/// \~english @retval NULL Failed to get pointer to the statemachine object
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) . [NULL]
+/// - Pointer to statemachine object is NULL. [NULL]
+/// \~english @par Detail
+/// Get pointer to the statemachine object associated with application framework handle.\n
+/// Do not release the statemachine object in application, because it is a part of the Dispathcer.
+/// \~english @par Classification
+/// public
+/// \~english @par type
+/// sync only
+/// \~english @see FrameworkunifiedHSMDispatcherWithArguments,FrameworkunifiedGetStateMachine
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSetStateMachine
+/// sets the statemachine object
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application session
+///
+/// \param [in] f_pFrameworkunifiedHSM
+/// CFrameworkunifiedHSM - Pointer to statemachine object
+///
+/// \return pointer to the StateMachine object
+/// CFrameworkunifiedHSMParentFramework* - pointer to the StateMachine object
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSetStateMachine(HANDLE hApp,
+ CFrameworkunifiedHSM *f_pFrameworkunifiedHSM);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventToDispatcher
+/// \~english @par Brief
+/// Register an event in dispatcher
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application framework handle
+/// \~english @param [in] pServiceName
+/// PCSTR pServiceName - Service Name
+/// \~english @param [in] iCmd
+/// UI_32 iCmd - service protocol command/request/acknowledgment ID
+/// \~english @param [in] iEvent
+/// UI_32 iEvent - event to be posted to active state on receiving iCmd from pServiceName.
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to service name specified in the argument (pServiceName) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Register an event information (iCmd,iEvent) for service specified in the argument in dispatcher.\n
+/// After that, when receiving an iCmd from service, post the event to active state.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Operation is not guaranteed if a different handle is set for an application handle.
+/// - Operation is not guaranteed if an invalid handle is set for a session handle.
+/// - This API registers one event for one command and one callback for one event.\n
+/// When registration is performed for the same command, the previously registered event is activated.
+/// - The callback information is registered to the heap.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see FrameworkunifiedAttachHSMEventsToDispatcher
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachHSMEventToDispatcher
+/// Registers a single event with the dispatcher for a given service.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pServiceName
+/// PCSTR - Service Name
+/// \param [in] iCmd
+/// UI_32 - service protocol command/request/acknowledgment ID
+/// \param [in] iEvent
+/// UI_32 - event to be posted to active state on receiving iCmd from pServiceName.
+/// \param [in] hSession
+/// HANDLE - Session Handle.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachHSMEventToDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, UI_32 iEvent,
+ HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// Register events in dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application framework handle
+/// \~english @param [in] pServiceName
+/// PCSTR pServiceName - Service Name
+/// \~english @param [in] pEventIds
+/// const FrameworkunifiedProtocolEvent *pEventIds - structure mapping event ids with the messages
+/// \~english @param [in] uiEventCount
+/// UI_32 uiEventCount - no of events
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to service name specified in the argument (pServiceName) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to FrameworkunifiedProtocolEvent structure specified in the argument is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Register events information (iCmd,iEvent) for service specified in the argument in dispatcher.\n
+/// After that, when receiving an iCmd from service, post the event to active state.\n
+/// If register failed, only the events that register before it are valid.\n
+/// When multiple registration, if an error occurs in the second and subsequent, becomes effective only \n
+/// information that has been registered so far. \n
+/// For number of upper limit of the registration possible event, depending on \n
+/// the securable size as the area of the FrameworkunifiedProtocolEvent structure. Therefore, note to ensure \n
+/// the size of the area of the FrameworkunifiedProtocolEvent structure at the call side of API, and define \n
+/// the number of event.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Operation is not guaranteed if a different handle is set to Handle for the application.
+/// - Operation is not guaranteed if an invalid handle is set for a session handle.
+/// - If an error occurs when multiple events are registered, it is impossible to determine which event was valid.
+/// Therefore, either register multiple event information again or delete multiple event information at the same time when registration fails.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see FrameworkunifiedAttachHSMEventToDispatcher
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachHSMEventsToDispatcher
+/// Registers a multiple event with the dispatcher for a given service.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pServiceName
+/// PCSTR - Service Name
+/// \param [in] pEventIds
+/// const FrameworkunifiedProtocolEvent* - structure mapping event ids with the messages
+/// \param [in] uiEventCount
+/// UI_32 - no of events
+/// \param [in] hSession
+/// HANDLE - Session Handle.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachHSMEventsToDispatcher(HANDLE hApp, PCSTR pServiceName,
+ const FrameworkunifiedProtocolEvent *pEventIds,
+ UI_32 uiEventCount,
+ HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// register a notification in service
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNotification
+/// PCSTR pNotification - Name of Notification
+/// \~english @param [in] max_length
+/// const UI_32 max_length - Max size of the notification message
+/// \~english @param [in] persType
+/// const EFrameworkunifiedNotificationType persType - Type of persistent
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pNotification) to service name is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// send message to Notification Service to register a notification
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMRegisterNotificatsionEvent
+/// API to send message to Notification Service to register a notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+/// \param [in] max_length
+/// const UI_32 - Max size of the notification message
+/// \param [in] persType
+/// const EFrameworkunifiedNotificationType - Type of persistent
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMRegisterNotificatsionEvent(HANDLE hApp, PCSTR pNotification, const UI_32 max_length,
+ const EFrameworkunifiedNotificationType persType);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// register many notifications in service
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pList
+/// const FrameworkunifiedNotificationsList *pList - List of the notifications that need to be registered
+/// \~english @param [in] uiListLength
+/// UI_32 uiListLength - Length of the list
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pList) to service name is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// send message to Notification Service to register many notifications
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMRegisterNotificationsEvents
+/// API to send message to Notification Service to register a notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pList
+/// FrameworkunifiedNotificationsList - List of the notifications that need to be registered
+/// \param [in] uiListLength
+/// const UI_32 - Length of the list
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMRegisterNotificationsEvents(HANDLE hApp, const FrameworkunifiedNotificationsList *pList,
+ UI_32 uiListLength);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// remove a notification in service
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNotification
+/// cPCSTR pNotification - Name of Notification
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pNotification) to service name is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// send message to Notification Service to remove a notification
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedNPHSMUnRegisterNotificationEvent
+/// API to send message to Notification Service to remove a notification
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the Framework
+/// \param [in] pNotification
+/// PCSTR - Name of Notification
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedNPHSMUnRegisterNotificationEvent(HANDLE hApp, PCSTR pNotification);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// attach an event to the dispatcher on receiving a specific notification.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNotification
+/// cPCSTR pNotification - Name of Notification
+/// \~english @param [in] iEventId
+/// UI_32 iEventId - event ID
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pNotification) to service name is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// attach an event to the dispatcher on receiving a specific notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachNotificationEventToDispatcher
+/// API to attach a event to the dispatcher on receiving a specific notification.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNotification
+/// PCSTR - Notification String.
+/// \param [in] iEventId
+/// UI_32 - event to be posted to active state on receiving iCmd from pServiceName.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationWithHSMEvent(HANDLE hApp, PCSTR pNotification,
+ UI_32 iEventId);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// attach many events to eath dispatcher on receiving a specific notification.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNtfyEvent
+/// const FrameworkunifiedNotificationEvent *pNtfyEvent - Notification event structure.
+/// \~english @param [in] uiEventCount
+/// UI_32 uiEventCount - Number of Notification event
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to FrameworkunifiedProtocolEvent structure specified in the argument is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// attach many events to eath dispatcher on receiving a specific notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachNotificationEventsToDispatcher
+/// API to attach a event to the dispatcher on receiving a specific notification.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNtfyEvent
+/// const FrameworkunifiedNotificationEvent* - Notification event structure.
+/// \param [in] uiEventCount
+/// UI_32 - Number of Notification event
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeNotificationsWithHSMEvent(HANDLE hApp, const FrameworkunifiedNotificationEvent *pNtfyEvent,
+ UI_32 uiEventCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// detach events from the dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNtfyHandler
+/// const FrameworkunifiedNotificationEvent *pNtfyHandler - Notification handler structure.
+/// \~english @param [in] uiHandlerCount
+/// UI_32 uiHandlerCount - Notification handler structure.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to FrameworkunifiedProtocolEvent structure specified in the argument is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// detach events from the dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnsubscribeNotificationsWithHSMEvent
+/// API to detach a notification event from the dispatcher.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNtfyHandler
+/// const FrameworkunifiedNotificationEvent* - Notification handler structure.
+/// \param [in] uiHandlerCount
+/// UI_32 - Number of notification handlers
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationsWithHSMEvent(HANDLE hApp, const FrameworkunifiedNotificationEvent *pNtfyHandler,
+ UI_32 uiHandlerCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// detach a notification event from the dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Handle to the Framework
+/// \~english @param [in] pNotification
+/// PCSTR pNotification - Notification String.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pNotification) to service name is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// detach a notification event from the dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachNotificationEventsFromDispatcher
+/// API to detach a notification event from the dispatcher.
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pNotification
+/// PCSTR - Notification String.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnsubscribeNotificationWithHSMEvent(HANDLE hApp, PCSTR pNotification);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// Registers a multiple HSM event with the dispatcher for a given service.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Child Thread handle
+/// \~english @param [in] pEventIds
+/// const FrameworkunifiedProtocolEvent *pEventIds - structure mapping event ids with the messages
+/// \~english @param [in] uiEventCount
+/// UI_32 uiEventCount - no of events
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to FrameworkunifiedProtocolEvent structure specified in the argument is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Registers a multiple HSM event with the dispatcher for a given service.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedAttachParentHSMEventsToDispatcher
+/// Registers a multiple HSM event with the dispatcher for a given service.
+///
+///
+/// \param [in] hChildApp
+/// HANDLE - Application framework handle
+/// \param [in] pEventIds
+/// const FrameworkunifiedProtocolEvent* - structure mapping event ids with the messages
+/// \param [in] uiEventCount
+/// UI_32 - no of events
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedAttachParentHSMEventsToDispatcher(HANDLE hChildApp, const FrameworkunifiedProtocolEvent *pEventIds,
+ UI_32 uiEventCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachHSMEventsToDispatcher
+/// \~english @par Brief
+/// detach notification HSM events from the dispatcher.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Child Thread handle
+/// \~english @param [in] puiEventArray
+/// const PUI_32 puiEventArray - Array of events
+/// \~english @param [in] uiEventCount
+/// UI_32 uiEventCount - Number of events
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// detach notification HSM events from the dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+/////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachParentHSMEventsFromDispatcher
+/// API to detach a notification HSM event from the dispatcher.
+///
+///
+/// \param [in] hChildApp
+/// HANDLE - Child Thread handle
+/// \param [in] puiEventArray
+/// const PUI_32 puiEventArray - Array of events
+/// \param [in] uiEventCount
+/// UI_32 - Number of events
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachParentHSMEventsFromDispatcher(HANDLE hChildApp, const PUI_32 puiEventArray, UI_32 uiEventCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventsFromDispatcher
+/// \~english @par Brief
+/// detach multiple events from the dispatcher
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application framework handle
+/// \~english @param [in] pServiceName
+/// PCSTR pServiceName - Service Name
+/// \~english @param [in] puiCmdArray
+/// const PUI_32 puiCmdArray - Array of commands
+/// \~english @param [in] uiCmdCount
+/// UI_32 uiCmdCount - Number of Commands
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @retval eFrameworkunifiedStatusInvldParam invalid parameter
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to service name specified in the argument (pServiceName) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pServiceName) to service name doesn't exist [eFrameworkunifiedStatusFail]
+/// - Pointer to event array specified in the argument which will be deleted is NULL [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// Detach multiple events(puiCmdArray) information for service specified in the argument from dispatcher.\n
+/// After that, when receiving command from service, post the event to unactive state.\n
+/// If the information has been deleted, return eFrameworkunifiedStatusOK.\n
+/// If the specific event has not been registered, return eFrameworkunifiedStatusOK.\n
+/// If number of puiCmdArray to be deleted is 0, return eFrameworkunifiedStatusOK.\n
+/// When deleting multiple events, if an error occurs, stop deleting. \n
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Operation is not guaranteed if a different handle is set for an application handle.
+/// - Operation is not guaranteed if an invalid handle is set for a session handle.
+/// - Operatuib is not guaranteed if a puiCmdArray that differs from the events to be deleted is set.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see FrameworkunifiedDetachHSMEventFromDispatcher
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachHSMEventsFromDispatcher
+/// API to detach a notification HSM event from the dispatcher.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pServiceName
+/// PCSTR - Service Name
+/// \param [in] puiCmdArray
+/// const PUI_32 - Array of commands
+/// \param [in] uiCmdCount
+/// UI_32 - Number of Commands
+/// \param [in] hSession
+/// HANDLE - Session Handle.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+EFrameworkunifiedStatus FrameworkunifiedDetachHSMEventsFromDispatcher(HANDLE hApp, PCSTR pServiceName, const PUI_32 puiCmdArray,
+ UI_32 uiCmdCount, HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventFromDispatcher
+/// \~english @par Brief
+/// detach an event from the dispatcher
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application framework handle
+/// \~english @param [in] pServiceName
+/// PCSTR pServiceName - Service Name
+/// \~english @param [in] iCmd
+/// UI_32 iCmd - service protocol command/request/acknowledgment ID
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to service name specified in the argument (pServiceName) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer(pServiceName) to service name doesn't exist [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Detach an event information for service specified in the argument from dispatcher.\n
+/// After that, when receiving command from service, post the event to unactive state.\n
+/// If the information has been deleted or the specific iCmd has not been registered, return eFrameworkunifiedStatusOK.\n
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Operation is not guaranteed if a different handle is set for an application handle.
+/// - Operation is not guaranteed if an invalid handle is set for a session handle.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see FrameworkunifiedDetachHSMEventsFromDispatcher
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedDetachHSMEventFromDispatcher
+/// API to detach a notification HSM event from the dispatcher.
+///
+///
+/// \param [in] hApp
+/// HANDLE - Application framework handle
+/// \param [in] pServiceName
+/// PCSTR - Service Name
+/// \param [in] iCmd
+/// UI_32 - service protocol command/request/acknowledgment ID
+/// \param [in] hSession
+/// HANDLE - Session Handle.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see
+///
+EFrameworkunifiedStatus FrameworkunifiedDetachHSMEventFromDispatcher(HANDLE hApp, PCSTR pServiceName, UI_32 iCmd, HANDLE hSession = NULL);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedGetStateMachine
+/// \~english @par Brief
+/// Get pointer to the statemachine object.
+/// \~english @param [in] hApp
+/// HANDLE - Handle to the framework application
+/// \~english @retval CFrameworkunifiedHSMParentFramework* pointer to the statemachine object
+/// \~english @retval NULL Failed to get pointer to the statemachine object
+/// \~english @par Prerequisite
+/// - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedHSMDispatcherWithArguments has been done.
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) . [NULL]
+/// - HANDLE specified in the argument (hApp) is not generated by FrameworkunifiedHSMDispatcherWithArguments. [NULL]
+/// \~english @par Detail
+/// Get pointer to the statemachine object associated with application framework handle.\n
+/// Do not release the statemachine object in application, because it is a part of the Dispathcer.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see FrameworkunifiedHSMDispatcherWithArguments,FrameworkunifiedSetStateMachine
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedGetStateMachine
+/// returns the pointer to the statemachine object
+///
+/// \param [in] hApp
+/// HANDLE - Handle to the application session
+///
+/// \return pointer to the StateMachine object
+/// CFrameworkunifiedHSMParentFramework* - pointer to the StateMachine object
+///
+/// \see
+///
+CFrameworkunifiedHSMFramework *FrameworkunifiedGetStateMachine(HANDLE hApp);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventFromDispatcher
+/// \~english @par Brief
+/// subscribing to single event of a service. attaches the session event with HSM events.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application handle
+/// \~english @param [in] uiEventId
+/// UI_32 uiEventId - Session Event id
+/// \~english @param [in] uiHSMEventId
+/// UI_32 uiHSMEventId- Statemachine Event id
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// This API is used for subscribing to single event of a service.
+/// This API also attaches the session event with HSM events.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventWithHSMEvent
+/// This API is used for subscribing to single event of a service.
+/// This API also attaches the session event with HSM events.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] uiEventId
+/// UI_32 - Session Event id
+/// \param [in] uiHSMEventId
+/// UI_32 - Statemachine Event id
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSubscribeToSessionEventsWithHSMEvents
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventWithHSMEvent(HANDLE hApp, UI_32 uiEventId, UI_32 uiHSMEventId, HANDLE hSession);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventFromDispatcher
+/// \~english @par Brief
+/// subscribing to multiple events of a service. attaches the session events with HSM events.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application handle
+/// \~english @param [in] pEventIds
+/// const FrameworkunifiedProtocolEvent *pEventIds - structure mapping session event id's with the hsm event id's
+/// \~english @param [in] uiEventCount
+/// UI_32 uiEventCount - count of events
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// - Pointer to FrameworkunifiedProtocolEvent structure specified in the argument is NULL [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// This API is used for subscribing to multiple events of a service.
+/// his API also attaches the session events with hsm events.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedSubscribeToSessionEventsWithHSMEvents
+/// This API is used for subscribing to multiple events of a service.
+/// This API also attaches the session events with hsm events.
+///
+/// \param [in] hApp
+/// HANDLE - Application handle
+/// \param [in] pEventIds
+/// FrameworkunifiedProtocolEvent - structure mapping session event id's with the hsm event id's
+/// \param [in] uiEventCount
+/// UI_32 - count of events
+/// \param [in] hSession
+/// HANDLE - Session handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedSubscribeToSessionEventWithHSMEvent
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSubscribeToSessionEventsWithHSMEvents(HANDLE hApp, const FrameworkunifiedProtocolEvent *pEventIds, UI_32 uiEventCount,
+ HANDLE hSession);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventFromDispatcher
+/// \~english @par Brief
+/// unsubscribe from event of a service. detaches HSM event from session event.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application handle
+/// \~english @param [in] uiEventId
+/// UI_32 uiEventId - Event id
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// API to unsubscribe from event of a service. Also detaches HSM event from session event.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventWithHSMEvent
+/// API to unsubscribe from event of a service. Also detaches HSM event from session event.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] uiEventId
+/// UI_32 - Event id
+/// \param [in] hSession
+/// HANDLE - Session Handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnSubscribeSessionEventsWithHSMEvents
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventWithHSMEvent(HANDLE hApp, UI_32 uiEventId, HANDLE hSession);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachHSMEventFromDispatcher
+/// \~english @par Brief
+/// unsubscribe from multiple events of a service. detaches HSM events from session events.
+/// \~english @param [in] hApp
+/// HANDLE hApp - Application handle
+/// \~english @param [in] pEventsArray
+/// PUI_32 pEventsArray - Array of events id's.
+/// \~english @param [in] uiListSize
+/// UI_32 uiListSize - count of elements in array.
+/// \~english @param [in] hSession
+/// HANDLE hSession - Session Handle.
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle invalid state handle
+/// \~english @retval eFrameworkunifiedStatusFail process failed
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// API to unsubscribe from multiple events of a service. Also detaches HSM events from session events.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedUnSubscribeSessionEventsWithHSMEvents
+/// API to unsubscribe from multiple events of a service. Also detaches HSM events from session events.
+///
+/// \param [in] hApp
+/// HANDLE - Application Handle
+/// \param [in] pEventsArray
+/// PUI_32 - Array of events id's.
+/// \param [in] uiListSize
+/// UI_32 - count of elements in array.
+/// \param [in] hSession
+/// HANDLE - Session Handle
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+///
+/// \see FrameworkunifiedUnSubscribeSessionEventWithHSMEvent
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedUnSubscribeSessionEventsWithHSMEvents(HANDLE hApp, PUI_32 pEventsArray, UI_32 uiListSize,
+ HANDLE hSession);
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_DISPATCH_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_if.h
new file mode 100755
index 0000000..8c90e59
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_if.h
@@ -0,0 +1,486 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_framework_if.h
+ * @brief \~english This File has public Macro definition that simplifies the statemachine implementation
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_IF_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_IF_H__
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro creates an instance of a state object.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro creates an instance of a state object with the specified class name.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Create a instance of state object
+#define CREATE_STATE(class_name) \
+ C## class_name *l_p## class_name = new C## class_name(#class_name);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates a framework event with a process and adds it to a state.
+/// \~english @param [in] state State
+/// \~english @param [in] eventid Event ID
+/// \~english @param [in] reaction Pointers to CFrameworkunifiedReaction objects
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macros retrieves the current state machine from the application handles used in the process
+/// and associates framework events with the process and adds them to the state using FrameworkunifiedFrameworkConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Connect framework event to reaction and add to state
+#define FRAMEWORKUNIFIED_CONNECT_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(CFrameworkunifiedHSMParentFramework::e## state, \
+ CFrameworkunifiedHSMParentFramework::_## eventid, l_pTrn## reaction, #eventid);
+
+#define FRAMEWORKUNIFIED_CONNECT_LOCAL_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(CFrameworkunifiedHSMParentFramework::e## state, \
+ CFrameworkunifiedHSMParentFramework::_## eventid, l_pLocalTrn## reaction, #eventid);
+
+/// Connect framework event to reaction and add to state as deferred event
+#define FRAMEWORKUNIFIED_CONNECT_DEFERREDEVENT(state, eventid) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(CFrameworkunifiedHSMParentFramework::e## state, \
+ CFrameworkunifiedHSMParentFramework::_## eventid, NULL, #eventid, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates a child state as the default state with the ready state of the framework.
+/// \~english @param [in] child Child state
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro retrieves the current state machine from the application handles used in the process and uses FrameworkunifiedFrameworkConnect() to associate the specified child state with the ready state of the framework as the default state.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect state to framework ready state as default state
+#define FRAMEWORKUNIFIED_CONNECT_DEFAULTSTATE(child) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(l_p## child, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates the child state with the ready state of the framework.
+/// \~english @param [in] child Child state
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro retrieves the current state machine from the application handles used in the process and associates the specified child state with the ready state of the framework using FrameworkunifiedFrameworkConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect state to framework ready state
+#define FRAMEWORKUNIFIED_CONNECT_STATE(child) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(l_p## child);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// A macro that associates a child state as the defaut state with a parent state.
+/// \~english @param [in] parent Parent state
+/// \~english @param [in] child Child state
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro takes the current state machine from the application handles used in the process and uses FrameworkunifiedConnect() to associate the specified child state with the specified parent state as the default state.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect child state to parent state as default state
+#define CONNECT_DEFAULTSTATE(parent, child) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## parent, l_p## child, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// A macro that associates a child state with a parent state.
+/// \~english @param [in] parent Parent state
+/// \~english @param [in] child Child state
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro takes the current state machine from the application handles used in the process and associates the specified child state with the specified parent state using FrameworkunifiedConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect child state to parent state
+#define CONNECT_STATE(parent, child) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## parent, l_p## child);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates a state as the state of the root.
+/// \~english @param [in] orthogonalstate quadrature state(CFrameworkunifiedOrthogonalState*)
+/// \~english @param [in] orthogonalregion orthographic region(CFrameworkunifiedCompositeState*)
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro gets the current state machine from the application handles used in the process and associates the specified orthographic state as the state of the root using FrameworkunifiedConnectOrthogonal().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect child state to parent state
+#define CONNECT_ORTHOGONAL_REGION(orthogonalstate, orthogonalregion) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnectOrthogonal(l_p## orthogonalstate, l_p## orthogonalregion);
+
+/// connect the deferred event and reactions and associate them with the state
+#define CONNECT_DEFERREDEVENT(state, eventid) \
+ FrameworkunifiedGetStateMachine(hApp)->FrameworkunifiedConnect(l_p## state, _## eventid, NULL, #eventid, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates a framework event with a process and adds it to a state.
+/// \~english @param [in] state State
+/// \~english @param [in] eventid Event ID
+/// \~english @param [in] reaction Pointers to CFrameworkunifiedReaction objects
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macros retrieves the current state machine from the application handles used in the process and associates framework events with the process and adds them to the state using FrameworkunifiedConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect event to reaction and add to state
+#define CONNECT_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid);
+
+/// connect event to reaction and add to state
+#define CONNECT_LOCAL_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, _## eventid, l_pLocalTrn## reaction, #eventid);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro logs state and events of the state machine.
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro gets the current state machine from the application handles used in the process and logs the state and events of the state machine using FrameworkunifiedPrintAllStates().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// print state machine states and events
+#define PRINTSTATEMACHINE() \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedPrintAllStates();
+
+/// Connect application defined event to application defined reaction and add to framework state
+#define CONNECT_FRAMEWORKUNIFIED_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, CFrameworkunifiedHSMParentFramework::_## eventid, \
+ l_pTrn## reaction, #eventid);
+
+/// Connect application defined deferred event to framework state
+#define CONNECT_FRAMEWORKUNIFIED_DEFERREDEVENT(state, eventid) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, CFrameworkunifiedHSMParentFramework::_## eventid, \
+ NULL, #eventid, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro associates an application event with a process and adds it to a state.
+/// \~english @param [in] state State
+/// \~english @param [in] eventid Event ID
+/// \~english @param [in] reaction Pointers to CFrameworkunifiedReaction objects
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macros retrieves the current state machine from the application handles used in the process, and associates the events of the application with the process and adds them to the state using FrameworkunifiedFrameworkConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIED_CONNECT_APP_EVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(CFrameworkunifiedHSMParentFramework::e## state, _## eventid, \
+ l_pTrn## reaction, #eventid);
+
+#define FRAMEWORKUNIFIED_CONNECT_APP_DEFERREDEVENT(state, eventid) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedFrameworkConnect(CFrameworkunifiedHSMParentFramework::e## state, _## eventid, \
+ NULL, #eventid, TRUE);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that create and add Shallow history states to their parents.
+/// \~english @param [in] parent Parent state
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro retrieves the current state machine from the application handles used in the process after a new Shallow history state is created, and adds the Shallow history state created to the parent state using FrameworkunifiedConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+// create a new shallow history state and add it in parent state
+#define ADD_SHALLOWHISTORYSTATE(parent) \
+ CFrameworkunifiedShallowHistoryState *l_p##parent##SHALLOWHISTORYSTATE = new CFrameworkunifiedShallowHistoryState(SHALLOWHISTORYSTATE);\
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## parent, l_p##parent##SHALLOWHISTORYSTATE);\
+ CHKNULL(l_p##parent##SHALLOWHISTORYSTATE);\
+ l_p##parent##SHALLOWHISTORYSTATE->SetDefaultHistory();
+
+// create a new shallow history state and add it in parent state
+#define ADD_DEEPHISTORYSTATE(parent) \
+ CFrameworkunifiedDeepHistoryState *l_p##parent##DEEPHISTORYSTATE = new CFrameworkunifiedDeepHistoryState(DEEPHISTORYSTATE);\
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## parent, l_p##parent##DEEPHISTORYSTATE);\
+ CHKNULL(l_p##parent##DEEPHISTORYSTATE);\
+ l_p##parent##DEEPHISTORYSTATE->SetDefaultHistory();
+
+/// connect deep history event to reaction and add to state
+#define CONNECT_DEEPHISTORYEVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##DEEPHISTORYSTATE, #eventid);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that associate Shallow history events with processes and add them to states.
+/// \~english @param [in] state State
+/// \~english @param [in] eventid Event ID
+/// \~english @param [in] reaction Pointers to CFrameworkunifiedReaction objects
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macros retrieves the current state machine from the application handles used in the process and associates Shallow history events with the process and adds them to the state using FrameworkunifiedConnect().
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// connect shallow history event to reaction and add to state
+#define CONNECT_SHALLOWHISTORYEVENT(state, eventid, reaction) \
+ (FrameworkunifiedGetStateMachine(hApp))->FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn##reaction##SHALLOWHISTORYSTATE, #eventid);
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+///////////////////////////////////////////////////////////////////////////////////////////
+
+/// FrameworkunifiedCreateStateMachine
+/// The application state machine is created in this interface. User defined events can also
+/// be connected to the framework states in this interface.
+///
+/// \~english @par Brief
+/// - It's a callback function to create state machine used by application.
+/// \~english @param [in] hApp
+/// HANDLE - handle to application
+/// \~english @retval eFrameworkunifiedStatusOK -successed
+/// \~english @retval Except eFrameworkunifiedStatusOK - failure
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Inside state change
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// The application state machine is created in this interface. User defined events can also\n
+/// be connected to the framework states in this interface.
+/// - FrameworkunifiedDispatcherWithArguments
+/// - FrameworkunifiedDispatcher
+/// - FrameworkunifiedCreateDispatcherWithoutLoop
+/// \~english @par Classification
+/// - Public
+/// \~english @see FrameworkunifiedDispatcherWithArguments, FrameworkunifiedDispatcher, FrameworkunifiedCreateDispatcherWithoutLoop
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+///////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////
+/// All HSM applications must define this function. This function will be called on entry
+/// of sFrameworkunifiedLoadData state.
+// Expected in this function:
+/// All the persistent data of the applications should be loaded in this function.
+///
+/// \~english @par Brief
+/// - This function defines loading persistent data of HSM application.
+/// \~english @param [in] hApp
+/// HANDLE - handle to application
+/// \~english @retval eFrameworkunifiedStatusOK -successed
+/// \~english @retval Except eFrameworkunifiedStatusOK - failure
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Inside state change
+/// - None
+/// \~english @par Conditions of processing failure
+/// - The implementation specification of the callback depends on the implementation (design) of the application.
+/// For this reason, the application should consider the Public of errors in the failed condition.
+/// \~english @par Detail
+/// - All HSM applications must define this function. This function will be called on entry\n
+/// of sFrameworkunifiedLoadData state.Expected in this function:\n
+/// All the persistent data of the applications should be loaded in this function.
+/// \~english @par Classification
+/// - Private
+/// \~english @par Detail
+/// - None
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMOnLoadData(HANDLE hApp);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+///////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////
+/// All HSM applications must define this function. This function will be called on exit
+/// of sFrameworkunifiedRun state.
+// Expected in this function:
+/// Send stop request to all the child threads.
+///
+/// \~english @par Brief
+/// - This function defines sending stop request to the child threads of HSM application.
+/// \~english @param [in] hApp
+/// HANDLE - handle to application
+/// \~english @retval eFrameworkunifiedStatusOK -successed
+/// \~english @retval Except eFrameworkunifiedStatusOK - failure
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Inside state change
+/// - None
+/// \~english @par Conditions of processing failure
+/// - The implementation specification of the callback depends on the implementation (design) of the application.
+/// For this reason, the application should consider the Public of errors in the failed condition.
+/// \~english @par Detail
+/// - All HSM applications must define this function.\n
+/// This function will be called on exit of sFrameworkunifiedRun state.\n
+/// Expected in this function:Send stop request to all the child threads.
+/// \~english @par Classification
+/// - Private
+/// \~english @par Type
+/// - None
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedHSMOnStopInsFrameworkunifiedRun(HANDLE hApp);
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_FRAMEWORK_IF_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_types.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_types.h
new file mode 100755
index 0000000..fb00ecd
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_framework_types.h
@@ -0,0 +1,494 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This File has public Macro definition that simplifies the statemachine implementation
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_framework_types.h
+ * @brief \~english This File has public Macro definition that simplifies the statemachine implementation
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_FRAMEWORKUNIFIED_SM_FRAMEWORK_TYPES_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_FRAMEWORKUNIFIED_SM_FRAMEWORK_TYPES_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_leafstate.h>
+#include <native_service/frameworkunified_sm_internaltransition.h>
+#include <native_service/frameworkunified_sm_compositestate.h>
+#include <native_service/frameworkunified_sm_eventfactory.h>
+#include <native_service/frameworkunified_sm_externaltransition.h>
+#include <native_service/frameworkunified_sm_localtransition.h>
+#include <native_service/frameworkunified_sm_orthogonalstate.h>
+#include <native_service/frameworkunified_sm_shallowhistorystate.h>
+#include <native_service/frameworkunified_sm_deephistorystate.h>
+#include <native_service/frameworkunified_sm_guard.h>
+#include <native_service/frameworkunified_sm_conditionconnector.h>
+#include <native_service/frameworkunified_sm_action.h>
+#include <native_service/frameworkunified_sm_eventdata.h>
+#include <exception>
+#include <string>
+
+class CFrameworkunifiedState;
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the null pointer exception
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CNullPointerException: public std::exception {
+ virtual const char *what() const throw() {
+ return "Null pointer exception";
+ }
+};
+
+
+/// Macro to check pointer for null value and throw null pointer exception
+#define CHKNULL(x) if (NULL == x) throw CNullPointerException();
+
+#define SHALLOWHISTORYSTATE "ShallowHistory"
+#define DEEPHISTORYSTATE "DeepHistory"
+
+/// Defines the state machine class
+#define DEFINE_STATEMACHINE(class_name) \
+ class C## class_name : public CFrameworkunifiedHSM{ \
+ public: \
+ C## class_name(); \
+ virtual ~C## class_name(); \
+ EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL); \
+ };
+
+/// Defines the leafstate class that does not override entry and exit of base state
+#define DEFINE_LEAFSTATE(class_name) \
+ class C## class_name : public CFrameworkunifiedLeafState { \
+ public: \
+ C## class_name(std::string f_pName):CFrameworkunifiedLeafState(f_pName) {} };
+
+/// Defines the Composite state that does not override entry and exit of base state
+#define DEFINE_COMPOSITESTATE(class_name) \
+ class C## class_name : public CFrameworkunifiedCompositeState { \
+ public: \
+ C## class_name(std::string f_pName):CFrameworkunifiedCompositeState(f_pName) {} };
+
+/// Defines the Orthogonal state that does not override entry and exit of base state
+#define DEFINE_ORTHOGONALSTATE(class_name) \
+ class C## class_name : public CFrameworkunifiedOrthogonalState { \
+ public: \
+ C## class_name(std::string f_pName):CFrameworkunifiedOrthogonalState(f_pName) {} };
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that inherit CFrameworkunifiedLeafState classes.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that inherit from CFrameworkunifiedLeafState classes and override the following methods:
+/// The following overriding methods should be implemented by the user.
+/// - FrameworkunifiedOnEntry
+/// - FrameworkunifiedOnExit
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the leafstate that overrides entry and exit of base state
+#define DEFINE_LEAFSTATE_OVERRIDE(class_name) \
+ class C## class_name : public CFrameworkunifiedLeafState{ \
+ public: \
+ C## class_name(std::string f_pName); \
+ virtual ~C## class_name(); \
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData); \
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData); \
+ };
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that inherit CFrameworkunifiedCompositeState classes.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that inherit from CFrameworkunifiedCompositeState classes and override the following methods:
+/// The following overriding methods should be implemented by the user.
+/// - FrameworkunifiedOnEntry
+/// - FrameworkunifiedOnExit
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the Composite state class that overrides entry and exit of base state
+#define DEFINE_COMPOSITESTATE_OVERRIDE(class_name) \
+ class C## class_name : public CFrameworkunifiedCompositeState{ \
+ public: \
+ C## class_name(std::string f_pName); \
+ virtual ~C## class_name(); \
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData); \
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData); \
+ };
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that inherit CFrameworkunifiedOrthogonalState classes.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that inherit from CFrameworkunifiedOrthogonalState classes and override the following methods:
+/// The following overriding methods should be implemented by the user.
+/// - FrameworkunifiedOnEntry
+/// - FrameworkunifiedOnExit
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the Orthogonal state that overrides entry and exit of base state
+#define DEFINE_ORTHOGONALSTATE_OVERRIDE(class_name) \
+ class C## class_name : public CFrameworkunifiedOrthogonalState{ \
+ public: \
+ C## class_name(std::string f_pName); \
+ virtual ~C## class_name(); \
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData); \
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData); \
+ };
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that inherit CFrameworkunifiedInternalTransition classes.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that inherit from CFrameworkunifiedInternalTransition classes and override the following methods:
+/// The following overriding methods should be implemented by the user.
+/// - FrameworkunifiedReaction
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the InternalTransition class
+#define DEFINE_INTERNALTRANSITION(class_name) \
+ class C## class_name : public CFrameworkunifiedInternalTransition{ \
+ public: \
+ virtual CFrameworkunifiedState* FrameworkunifiedReaction(CFrameworkunifiedState* f_pSourceState, CEventDataPtr f_pData); \
+ };
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Macros that define application events.
+/// \~english @param [in] event_name Event name
+/// \~english @param [in] value Event value
+/// \~english @retval UI_32 Event value for the application
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Values of events defined in CFrameworkunifiedEventFactory classes (evFrameworkunifiedEventLimit:10) are specifiedMacros that define events for an application by adding event values (value).
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Defines the application event
+#define DEFINE_EVENT(event_name, value) \
+ static const UI_32 _## event_name = CFrameworkunifiedEventFactory::evFrameworkunifiedEventLimit + value;
+
+#define DEFINE_ACTION(class_name) \
+ class C## class_name: public CFrameworkunifiedAction{ \
+ public: \
+ C## class_name(std::string f_strName):CFrameworkunifiedAction(f_strName) {} \
+ VOID FrameworkunifiedAction(CFrameworkunifiedState *f_pSourceState, CFrameworkunifiedState *f_pTargetState, CEventDataPtr f_pEventData); \
+ };
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro creates an instance for an internal transition.
+/// \~english @param [in] class_name Class name
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// This macro creates an instance for an internal transition of a class with the specified name.\n
+/// Otherwise, the CNullPointerException objects are excepted.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// creates the instance of the internal transition
+#define CREATE_INTERNALTRANSITION(class_name) \
+ C## class_name *l_pTrn## class_name = new C## class_name(); \
+ CHKNULL(l_pTrn## class_name);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// This macro creates an instance for an external transition.
+/// \~english @param [in] target_state State name for external transition
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that instantiate CFrameworkunifiedExternalTransition classes for external transitions.\n
+/// Otherwise, the CNullPointerException objects are excepted.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// creates the instance of the external transition
+#define CREATE_EXTERNALTRANSITION(target_state) \
+ CFrameworkunifiedExternalTransition *l_pTrn## target_state = new CFrameworkunifiedExternalTransition(l_p## target_state); \
+ CHKNULL(l_pTrn## target_state);
+
+/// creates the instance of the external transition
+#define CREATE_CONDITIONCONNECTOR(connector_name) \
+ CFrameworkunifiedConditionConnector *l_pTrn## connector_name = new CFrameworkunifiedConditionConnector( #connector_name); \
+ CHKNULL(l_pTrn## connector_name);
+
+
+/// creates the instance of the local transition
+#define CREATE_LOCALTRANSITION(target_state) \
+ CFrameworkunifiedLocalTransition *l_pLocalTrn## target_state = new CFrameworkunifiedLocalTransition(l_p## target_state); \
+ CHKNULL(l_pLocalTrn## target_state);
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// A macro that instantiates an orthographic region.
+/// \~english @param [in] target_state State name for external transition
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// Macros that create instances of compound states (CFrameworkunifiedCompositeState classes) as instances of orthographic regions.\n
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// create orthogonal region
+#define CREATE_ORTHOGONALREGION(name) \
+ CFrameworkunifiedCompositeState *l_p## name = new CFrameworkunifiedCompositeState(#name);
+
+/// create action for external transition
+#define CREATE_ACTION(class_name) \
+ C## class_name *l_pTrn## class_name = new C## class_name( #class_name); \
+ CHKNULL(l_pTrn## class_name);
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// A macro that defines events for the framework.
+/// \~english @param [in] eventid Event ID
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// These macros define the IDs of the current events in the CFrameworkunifiedHSMParentFramework classes.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// framework event
+#define FRAMEWORKUNIFIED_EVENT(eventid) \
+ CFrameworkunifiedHSMParentFramework::_## eventid
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// Is a macro that defines events for an application
+/// \~english @param [in] eventid Event ID
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// A macro that defines an event ID for an application.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Application event
+#define EVENT(eventid) \
+ _## eventid
+
+/// FrameworkunifiedReaction function signature for internal transition class
+#define IMPLEMENT_INTERNALTRANSITION(name) \
+ CFrameworkunifiedState* C## name::FrameworkunifiedReaction(CFrameworkunifiedState* f_pSourceState, CEventDataPtr f_pData)
+
+#define IMPLEMENT_ACTION(action_name) \
+ void C## action_name::FrameworkunifiedAction(CFrameworkunifiedState *f_pSourceState, CFrameworkunifiedState *f_pTargetState, CEventDataPtr f_pEventData)
+
+#define DEFINE_GUARD(guard_name)\
+ class C## guard_name : public CFrameworkunifiedGuard{ \
+ public: \
+ C## guard_name(std::string f_pName):CFrameworkunifiedGuard(f_pName) {} \
+ virtual BOOL FrameworkunifiedEvaluate();\
+ };
+
+#define CREATE_GUARD(guard_name)\
+ CFrameworkunifiedGuard *l_pGrd## guard_name = new C## guard_name(#guard_name);
+
+#define CONNECT_GUARD(transition, guard)\
+ l_pTrn## transition->FrameworkunifiedSetGuard(l_pGrd## guard);
+
+#define CONNECT_CONDITION(connector_name , guard , target_state) \
+ CHKNULL(l_pTrn## connector_name)\
+ l_pTrn## connector_name->FrameworkunifiedAddCondition(l_pGrd## guard , l_p## target_state); \
+
+#define IMPLEMENT_GUARD(guard_name) \
+ BOOL C## guard_name::FrameworkunifiedEvaluate()
+
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StateMachine_Macro
+/// \~english @par Brief
+/// These macros create instances for Shallow history transitions.
+/// \~english @param [in] parent State name for external transition
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// These macros create instances of CFrameworkunifiedExternalTransition classes for external transitions of Shallow history transitions.\n
+/// Otherwise, the CNullPointerException objects are excepted.
+/// \~english @par Classification
+/// Public
+/// \~english @see None
+///////////////////////////////////////////////////////////////////////////////////////////
+/// creates the instance of the shallow history transition
+#define CREATE_SHALLOWHISTORYTRANSITION(parent) \
+ CFrameworkunifiedExternalTransition *l_pTrn##parent##SHALLOWHISTORYSTATE = \
+ new CFrameworkunifiedExternalTransition(l_p##parent##SHALLOWHISTORYSTATE); \
+ CHKNULL(l_pTrn##parent##SHALLOWHISTORYSTATE);
+
+/// creates the instance of the deep history transition
+#define CREATE_DEEPHISTORYTRANSITION(parent) \
+ CFrameworkunifiedExternalTransition *l_pTrn##parent##DEEPHISTORYSTATE = \
+ new CFrameworkunifiedExternalTransition(l_p##parent##DEEPHISTORYSTATE); \
+ CHKNULL(l_pTrn##parent##DEEPHISTORYSTATE);
+
+#define CONNECT_CONDITION_SHALLOWHISTORYTRANSITION(connector_name , guard , target_state) \
+ CHKNULL(l_pTrn## connector_name)\
+ l_pTrn## connector_name->FrameworkunifiedAddCondition(l_pGrd## guard , l_p## target_state##SHALLOWHISTORYSTATE); \
+
+
+#define CONNECT_CONDITION_DEEPHISTORYTRANSITION(connector_name , guard , target_state) \
+ CHKNULL(l_pTrn## connector_name)\
+ l_pTrn## connector_name->FrameworkunifiedAddCondition(l_pGrd## guard , l_p## target_state##DEEPHISTORYSTATE); \
+
+
+#define CONNECT_ACTION(transition, action_name) \
+ CHKNULL(l_pTrn## action_name); \
+ CHKNULL(l_pTrn## transition); \
+ l_pTrn## transition->FrameworkunifiedAddAction(l_pTrn## action_name); \
+
+#ifdef DEBUG
+#define FRAMEWORKUNIFIED_PRINT_HSM(x) (FrameworkunifiedGetStateMachine(x))->FrameworkunifiedPrintXML();
+#define PRINT_HSM() FrameworkunifiedPrintXML();
+#else
+#define FRAMEWORKUNIFIED_PRINT_HSM(x)
+#define PRINT_HSM()
+#endif
+
+/// defines options for integrating user change state
+typedef enum _EUserChangeOptions {
+ eUserchangeIgnore = 0,
+ eUserchangeReInit,
+ eUserchangeRetPrevState
+} EUserChangeOptions;
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_FRAMEWORKUNIFIED_SM_FRAMEWORK_TYPES_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_guard.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_guard.h
new file mode 100755
index 0000000..1792f72
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_guard.h
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedGuard class definitions. This is an interface that defines the Evaluate
+/// interface for guard condition validation.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_guard.h
+ * @brief \~english This file has the CFrameworkunifiedGuard class definitions.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDGUARD_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDGUARD_H
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+
+/**
+ * @class CNSSharedMem
+ * \~english @brief this file has the CFrameworkunifiedGuard class definitions
+ * \~english @par Brief Introduction
+ * This file has the CFrameworkunifiedGuard class definitions. This is an interface \n
+ * that defines the Evaluate interface for guard condition validation.
+ *
+ */
+class CFrameworkunifiedGuard {
+ public :
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedGuard
+ /// \~english @par Brief
+ /// CFrameworkunifiedGuard's constructor
+ /// \~english @param [in] f_strName
+ /// string - Name of the guard
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - CFrameworkunifiedGuard's constructor
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see ~CFrameworkunifiedGuard
+ ////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedGuard(std::string f_strName); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CFrameworkunifiedGuard
+ /// \~english @par Brief
+ /// - Destructor of CFrameworkunifiedGuard class
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Destruct the object of this class.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see CFrameworkunifiedGuard
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedGuard();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedGuard
+ /// \~english @par Brief
+ /// This is a pure virtual function that defines the logic for evaluating the guard condition
+ /// \~english @param None
+ /// \~english @retval TRUE - if test passes
+ /// \~english @retval FALSE - otherwise returns false
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - This is a pure virtual function that defines the logic for evaluating the guard condition
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual BOOL FrameworkunifiedEvaluate() = 0;
+
+ private:
+ std::string m_strName;
+};
+
+#endif // _FRAMEWORKUNIFIEDGUARD_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_historystate.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_historystate.h
new file mode 100755
index 0000000..47d5914
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_historystate.h
@@ -0,0 +1,253 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the declaration of CFrameworkunifiedHistoryState interface.
+/// CFrameworkunifiedHistoryState is derived from CFrameworkunifiedState class.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_historystate.h
+ * @brief \~english This file has the declaration of CFrameworkunifiedHistoryState interface.
+ * CFrameworkunifiedHistoryState is derived from CFrameworkunifiedState class.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDHISTORYSTATE_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDHISTORYSTATE_H
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_sm_state.h>
+#include <string>
+
+/**
+ * @class CFrameworkunifiedHistoryState
+ * \~english @brief this file has the CFrameworkunifiedHistoryState class definitions
+ * \~english @par Brief Introduction
+ * This class implements the additional functionality supported by HSM History state.
+ *
+ */
+class CFrameworkunifiedHistoryState : public CFrameworkunifiedState {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHistoryState
+ /// \~english @par Brief
+ /// -Constructor of CFrameworkunifiedHistoryState.
+ /// \~english @param [in] f_pName
+ /// std::string - Name of the state
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - This class inherits from CFrameworkunifiedState, which is the base class of state machine.
+ /// This class implements the additional functionality supported by HSM History state.
+ /// This function creates an object of CFrameworkunifiedHistoryState class.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @see ~CFrameworkunifiedHistoryState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedHistoryState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ CFrameworkunifiedHistoryState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHistoryState
+ /// \~english @par Brief
+ /// -Destructor of CFrameworkunifiedHistoryState.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// -Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// -Destruct the object of this class.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @see CFrameworkunifiedHistoryState::CFrameworkunifiedHistoryState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedHistoryState
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedHistoryState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHistoryState
+ /// \~english @par Brief
+ /// - Gets the pointor of this class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Gets the pointor of this class.The pointor of this class's base class will get it.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHistoryState
+ /// \~english @par Brief
+ /// - This function stores the last active state.
+ /// \~english @param None
+ /// \~english @retval EFrameworkunifiedStatus - Returns status of operation
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - This function stores the last active state.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus UpdateHistory() = 0;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHistoryState
+ /// \~english @par Brief
+ /// - This function sets the default active state in history state.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK - Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - Null Pointer
+ /// \~english @par Preconditons
+ /// -Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// -m_pParentState is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// -This function sets the default state of parent state to the newest active state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDefaultHistory
+ /// This function sets the default active state in history state
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ EFrameworkunifiedStatus SetDefaultHistory();
+
+ protected :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEntry
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnExit
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStart
+ /// This function is called recursively till the leaf state is reached. This internally
+ /// calls the Entry function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStop
+ /// This function is called recursively till the required parent state is reached. This
+ /// internally calls the Exit function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData);
+
+ // last active state
+ CFrameworkunifiedState *m_pLastActiveState;
+
+ // event id of history state
+ UI_32 m_uiEventId;
+
+ // event name
+ std::string m_cEventName;
+};
+#endif // _FRAMEWORKUNIFIEDHISTORYSTATE_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsm.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsm.h
new file mode 100755
index 0000000..1a8e1d7
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsm.h
@@ -0,0 +1,798 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedHSM class definitions. CFrameworkunifiedHSM is base class for HSM Framework.
+/// This class implements interfaces for connecting child states to parent states, connecting events
+/// to state.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_hsm.h
+ * @brief \~english This file has the CFrameworkunifiedHSM class definitions. CFrameworkunifiedHSM is base class for HSM Framework.
+ * This class implements interfaces for connecting child states to parent states, connecting events to state.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSM_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSM_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/frameworkunified_sm_eventdata.h>
+#include <vector>
+#include <exception>
+#include <map>
+#include <string>
+
+class CFrameworkunifiedEvent;
+
+class CFrameworkunifiedState;
+
+class CFrameworkunifiedCompositeState;
+
+class CFrameworkunifiedReaction;
+
+class CFrameworkunifiedOrthogonalState;
+
+class CEventData;
+
+typedef boost::shared_ptr<CEventData> CEventDataPtr;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements interfaces for connecting child states to parent states, connecting events
+/// to state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedHSM {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Destructor for CFrameworkunifiedHSM
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal status
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Release class CFrameworkunifiedHistoryState instance.\n
+ /// Release event in postevent list.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedHSM
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedHSM();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedHSM.
+ /// \~english @param
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSM class is the super class of HSM framework.
+ /// this class produce interface to connected super class state with sub class state and to connect event with
+ /// state
+ /// create the instance of CFrameworkunifiedHSM class\n
+ /// create event list as following and hold the member parameter,others will be initialized as NULL
+ /// - event list which is supported in state
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSM();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Constructor for class CFrameworkunifiedHSM.
+ /// \~english @param f_pHApp
+ /// PVOID - handle of application
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// none
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSM class is the super class of HSM framework.
+ /// this class produce interface to connected super class state with sub class state and to connect event with
+ /// state
+ /// create the instance of CFrameworkunifiedHSM class\n
+ /// create event list as following and hold the member parameter,others will be initialized as NULL
+ /// - event list which is supported in state
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see ~CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedHSM(PVOID f_pHApp)
+ /// Class constructor
+ ///
+ /// \return none
+ CFrameworkunifiedHSM(PVOID f_pHApp); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Returns the active state of the statemachine
+ /// \~english @param none
+ /// \~english @retval CFrameworkunifiedState* - Returns ActiveState
+ /// \~english @retval NULL - failed
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created and active state exist.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - active state do not exist. [NULL]
+ /// \~english @par Detail
+ /// route state search will be continued until current state become active
+ /// route state search will be continued until Leaf State or orthogonal State is found\n
+ /// if there is no active state.reture NULL\n
+ /// if there is active state,this state will be hold in memeber parameter as return value
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedGetActiveState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This creates the default event data and sends the event to the active HSM state.
+ /// \~english @param f_uiEventId
+ /// UI_32 - Event Id
+ /// \~english @retval eFrameworkunifiedStatusOK add succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Event data instance create faield. [eFrameworkunifiedStatusNullPointer]
+ /// - The pointer of post event list in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - The pointer of active state in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - The name of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// create new event data object and send this event to active HSM state,\n
+ /// then add to event queue of the statemachine
+ /// add to event queque in order to process event using statemachine
+ /// event will be deleted from event queue when process complete
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedPostEvent(CEventDataPtr), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPostEvent
+ /// This creates the default event data and sends the event to the active HSM state.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event Id
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedPostEvent(UI_32 f_uiEventId);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPostEvent
+ /// This sends the event to the active HSM state
+ ///
+ /// \~english @par Brief
+ /// Add event data into event queue of state machine.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Event data
+ /// \~english @retval eFrameworkunifiedStatusOK add succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pEventData is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - The pointer of post event list in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - The pointer of active state in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - The name of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ ///
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedPostEvent(UI_32), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedPostEvent(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This is pure virtual function to be implemented by the derived classes. Statemachine
+ /// states and events created and connected in this interface.
+ /// \~english @param f_pEventData
+ /// PVOID - Event data
+ /// \~english @retval EFrameworkunifiedStatus Returns status of operation
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ // none
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL) = 0;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedStart
+ /// This starts the state machine
+ ///
+ /// \~english @par Brief
+ /// Start the state machine.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Event data
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ // - Pointer of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ ///
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedPostEvent(UI_32), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedStart(CEventDataPtr f_pEventData = boost::make_shared<CEventData>(0));
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Stop the state machine.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Event data
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ // - Pointer of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Stop the state machine.\n
+ /// Release route state of state machine.\n
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedPostEvent(UI_32), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedClose(CEventDataPtr f_pEventData = boost::make_shared<CEventData>(0));
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPrintAllStates
+ /// This prints all states and events associated with every state on console.
+ ///
+ /// \~english @par Brief
+ /// Output log of all states and events name associated with every state.
+ /// \~english @param
+ /// \~english @retval EFrameworkunifiedStatus succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Root state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Self instance of CFrameworkunifiedHSM does not create. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// print out log for connected state name and event name\n
+ /// following log will be print put
+ /// - super statemachine state name and self-statemachine state name
+ /// - all the event name on event list
+ /// - all the event on delayed event list
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedPrintAllStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This connects the reaction to event and add event to child states then add child state
+ /// to parent state.
+ /// \~english @param f_pParentState
+ /// CFrameworkunifiedState* - Parent state pointer
+ /// \~english @param f_pChildState
+ /// CFrameworkunifiedState* - Child state pointer
+ /// \~english @param f_uiEventId
+ /// UI_32 - eventi id
+ /// \~english @param f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ /// \~english @param f_eIsDefaultState
+ /// BOOL - Does has default state.(default: FALSE)
+ /// \~english @par
+ /// - TRUE : has default state
+ /// - FALSE: not has default state
+ /// \~english @param f_eIsDeferredEventType
+ /// BOOL - Does has the deferred event(default: FALSE)
+ /// \~english @par
+ /// - TRUE : has the deferred event
+ /// - FALSE: not has the deferred event
+ /// \~english @param f_strEventName
+ /// std::string - name of event(default:"")
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pParentState pointer is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pChildState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pReaction pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pParentState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pChildState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// connect process with event and add the event to sub state.
+ /// and do following considering the event delay and event declare(f_eIsDeferredEventType)
+ /// - if TRUE : add the event as delayed event(add to event name list and delayed event list)
+ /// - if FALSE:add normal event and event(add to event name list and event list)
+ /// \~english @par
+ /// After adding an event to a child state, associate the child state with the parent state and
+ /// set the HSM state machine for the child state only if the parent state is a compound state.
+ /// The following associations are made depending on whether or not a default state is defined (f_eIsDefaultState).
+ /// - TRUE: Associates a child state as the default state with the parent state.
+ /// - FALSE: Associates a child state with a parent state as a normal state.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,std::string,BOOL),
+ /// FrameworkunifiedConnect(CFrameworkunifiedState*,CFrameworkunifiedState*,BOOL)
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedConnect
+ /// This connects the reaction to event and add event to child states then add child state
+ /// to parent state.
+ ///
+ /// \param [in] f_pParentState
+ /// CFrameworkunifiedState* - Parent state
+ ///
+ /// \param [in] f_pChildState
+ /// CFrameworkunifiedState* - Child state
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id
+ ///
+ /// \param [in] f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ ///
+ /// \param [in] f_eIsDefaultState
+ /// BOOL - Defines if the state is default state
+ ///
+ /// \param [in] f_eIsDeferredEventType
+ /// BOOL - defines if the event is deferred event
+ ///
+ /// \param [in] f_strEventName
+ /// BOOL - Event name
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pParentState, CFrameworkunifiedState *f_pChildState,
+ UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction,
+ BOOL f_eIsDefaultState = FALSE,
+ BOOL f_eIsDeferredEventType = FALSE,
+ std::string f_strEventName = "");
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This add child state to parent state.
+ /// \~english @param f_pParentState
+ /// CFrameworkunifiedState* - Parent state pointer
+ /// \~english @param f_pChildState
+ /// CFrameworkunifiedState* - Child state pointer
+ /// \~english @param f_eIsDefaultState
+ /// BOOL - Does has default state.(default: FALSE)
+ /// \~english @par
+ /// - TRUE : has default state
+ /// - FALSE: not has default state
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pParentState pointer is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pChildState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pParentState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pChildState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// connect super state with sub state and set HSM state machine to sub state only when super state is compond
+ /// state
+ /// according to the default state define(f_eIsDefaultState),doing the connection below
+ /// - if TRUE: connect sub state as default state with super state
+ /// - if FALSE: connect sub state as normal state with super state
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,std::string,BOOL),
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedConnect
+ /// This add child state to parent state.
+ ///
+ /// \param [in] f_pParentState
+ /// CFrameworkunifiedState* - Parent state
+ ///
+ /// \param [in] f_pChildState
+ /// CFrameworkunifiedState* - Child state
+ ///
+ /// \param [in] f_eIsDefaultState
+ /// BOOL - Defines if the state is default state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pParentState, CFrameworkunifiedState *f_pChildState,
+ BOOL f_eIsDefaultState = FALSE);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedConnect
+ /// This connects the reaction to event and add event to states
+ ///
+ /// \~english @par Brief
+ /// This connects the reaction to event and add event to states.
+ /// \~english @param f_pState
+ /// CFrameworkunifiedState* - pointer of state class
+ /// \~english @param f_uiEventId
+ /// UI_32 - eventi id
+ /// \~english @param f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ /// \~english @param f_eIsDefaultState
+ /// BOOL - Does has default state.(default: FALSE)
+ /// \~english @par
+ /// - TRUE : has default state
+ /// - FALSE: not has default state
+ /// \~english @param f_eIsDeferredEventType
+ /// BOOL - Does has the deferred event(default: FALSE)
+ /// \~english @par
+ /// - TRUE : has the deferred event
+ /// - FALSE: not has the deferred event
+ /// \~english @param f_strEventName
+ /// std::string - name of event(default:"")
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pReaction pointer is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pState pointer does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// connect process with event and add event to sub state
+ /// following will be added according to whether delayed event or event define exsist
+ /// - if TRUE : add event as delayed event(add to event name list and delayed event list)
+ /// - if FALSE: add event as normal event(add to event name list and event list)
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,BOOL,BOOL,std::string)
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pState, UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction,
+ std::string f_strEventName = "", BOOL f_eIsDeferredEventType = FALSE);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This sets the givens state as root state in the state machine
+ /// \~english @param f_pRootState
+ /// CFrameworkunifiedState* - Root state
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pRootState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pRootState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// set state(f_pRootState, which is designated as route state) to HSM state machine
+ /// set route state pointer(f_pRootState,which is set as parameter value)as pointer of
+ /// active state for member
+ /// parameter and routestate
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,BOOL,BOOL,std::string)
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedConnect
+ /// This sets the givens state as root state in the state machine
+ ///
+ /// \param [in] f_pRootState
+ /// CFrameworkunifiedState* - Root state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pRootState);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Set Composite state as HSM state OrthogonalState.
+ /// \~english @param f_pOrthogonalState
+ /// CFrameworkunifiedOrthogonalState* - Orthogonal state pointer
+ /// \~english @param f_pOrthogonalRegion
+ /// CFrameworkunifiedCompositeState* - Composite state pointer
+ /// \~english @retval eFrameworkunifiedStatusOK succ
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer(process failed)
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - Input parameter f_pOrthogonalState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pOrthogonalRegion pointer is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Input parameter f_pOrthogonalState does not instance. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Set Composite state as HSM state OrthogonalState.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedConnect
+ /// This sets the givens state as root state in the state machine
+ ///
+ /// \param [in] f_pOrthogonalState
+ /// CFrameworkunifiedOrthogonalState* - Orthogonal state
+ ///
+ /// \param [in] f_pOrthogonalRegion
+ /// CFrameworkunifiedCompositeState* - Orthogonal region
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedConnectOrthogonal(CFrameworkunifiedOrthogonalState *f_pOrthogonalState,
+ CFrameworkunifiedCompositeState *f_pOrthogonalRegion);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// This interface returns the application handle
+ /// \~english @param none
+ /// \~english @retval HANDLE application handle
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ HANDLE FrameworkunifiedGetAppHandle();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Output statemachine information into XML file.
+ /// \~english @param none
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedPrintXML();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Push the event in the post event list.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - pointer of event data
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
+ /// eFrameworkunifiedStatusNullPointer NULL pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - If input parameter f_pEventData is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If member variable m_pActiveState is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - If member variable m_pPostEventList is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedQueueEvent(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSM
+ /// \~english @par Brief
+ /// Remove the all events of eventId f_uiEventId from event queue of statemachine.
+ /// \~english @param f_pEventData
+ /// const UI_32 - event id
+ /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
+ /// eFrameworkunifiedStatusInvldID Not found event id
+ /// eFrameworkunifiedStatusNullPointer NULL pointer
+ /// \~english @par Prerequisite
+ /// - Self instance of CFrameworkunifiedHSM created.
+ /// \~english @par Change of internal state
+ /// none
+ /// \~english @par Conditions of processing failure
+ /// - If not find event id. [eFrameworkunifiedStatusInvldID]
+ /// - If member variable m_pPostEventList is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// none
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RemoveEventFromPostedEventQueue(const UI_32 f_uiEventId);
+
+ UI_32 m_uiCurrentEvent;
+
+ /// Application handle
+ HANDLE m_pHApp;
+
+ private:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ProcessEventQueue
+ /// Gets the event from StateMachine events list and post it.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ProcessEventQueue();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ProcessEvent
+ /// Processes the event posted to the statemachine
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ProcessEvent(CEventDataPtr f_pEventData);
+
+ /// pointer to the active state object
+ CFrameworkunifiedState *m_pActiveState;
+
+ /// pointer to the root state object
+ CFrameworkunifiedState *m_pRootState;
+
+ std::vector<CEventDataPtr> *m_pPostEventList;
+
+ BOOL m_bIsTransitioning;
+};
+
+#endif // __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSM_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsmframework.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsmframework.h
new file mode 100755
index 0000000..fd61117
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_hsmframework.h
@@ -0,0 +1,873 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedHSMParentFramework class definitions. CFrameworkunifiedHSMParentFramework is derived from
+/// CFrameworkunifiedHSM class. It defines the states required for NS statemachine framework, it creates the NS
+/// statemachine and implements the reaction associated with the events
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_hsmframework.h
+ * @brief \~english This file has the CFrameworkunifiedHSMParentFramework class definitions. CFrameworkunifiedHSMParentFramework is derived from
+ * CFrameworkunifiedHSM class. It defines the states required for NS statemachine framework, it creates the NS
+ * statemachine and implements the reaction associated with the events
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSMFRAMEWORK_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSMFRAMEWORK_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/ns_timer_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <map>
+#include <string>
+
+class CFrameworkunifiedHSMFramework: public CFrameworkunifiedHSM {
+ public:
+ /**
+ * \~english state machine state
+ */
+ typedef enum _FRAMEWORKUNIFIED_HSM_STATES {
+ esFrameworkunifiedRoot = 0, //!< \~english Root state
+ esFrameworkunifiedInitialization, //!< \~english Initialization state
+ esFrameworkunifiedLoadData, //!< \~english LoadData state
+ esFrameworkunifiedPre, //!< \~english Pre state
+ esFrameworkunifiedBackground, //!< \~english Background state
+ esFrameworkunifiedRun, //!< \~english Run state
+ esFrameworkunifiedLoadSessions, //!< \~english LoadSessions state
+ esFrameworkunifiedReady, //!< \~english Ready state
+ esFrameworkunifiedStop, //!< \~english Stop state
+ esFrameworkunifiedApp, //!< \~english App state
+ esFrameworkunifiedUserChange, //!< \~english UserChange state
+ esFrameworkunifiedThreadRoot, //!< \~english ThreadRoot state
+ esFrameworkunifiedThreadIdle, //!< \~english ThreadIdle state
+ esFrameworkunifiedThreadStart, //!< \~english ThreadStart state
+ esFrameworkunifiedThreadReady, //!< \~english ThreadReady state
+ esFrameworkunifiedThreadStop, //!< \~english ThreadStop state
+ esFrameworkunifiedStopping, //!< \~english Stopping state
+ } FRAMEWORKUNIFIED_HSM_STATES;
+
+ /// Define evFrameworkunifiedStart event
+ DEFINE_EVENT(evFrameworkunifiedStart, 1)
+
+ /// Define evFrameworkunifiedStop event
+ DEFINE_EVENT(evFrameworkunifiedStop, 5)
+
+ /// Define evFrameworkunifiedDestroy event
+ DEFINE_EVENT(evFrameworkunifiedDestroy, 3)
+
+ /// Define evFrameworkunifiedReady event
+ DEFINE_EVENT(evFrameworkunifiedReady, 12)
+
+ /// Define evFrameworkunifiedError event
+ DEFINE_EVENT(evFrameworkunifiedError, 16)
+
+ /// Define evFrameworkunifiedPreStart event
+ DEFINE_EVENT(evFrameworkunifiedPreStart, 19)
+
+ /// Define evFrameworkunifiedPreStop event
+ DEFINE_EVENT(evFrameworkunifiedPreStop, 20)
+
+ /// Define evFrameworkunifiedBackgroundStart event
+ DEFINE_EVENT(evFrameworkunifiedBackgroundStart, 21)
+
+ /// Define evFrameworkunifiedBackgroundStop event
+ DEFINE_EVENT(evFrameworkunifiedBackgroundStop, 22)
+
+ // Define internal transition for event evFrameworkunifiedStart in sFrameworkunifiedStop state
+ DEFINE_INTERNALTRANSITION(OnEventStartInStopState)
+
+ // Define internal transition for event evFrameworkunifiedUserChange in sFrameworkunifiedInitialization state
+ DEFINE_INTERNALTRANSITION(OnEventUserChangeInInitializationState)
+
+ // Define internal transition for event evFrameworkunifiedUserChange in sFrameworkunifiedRun state
+ DEFINE_INTERNALTRANSITION(OnEventUserChangeInRunState)
+
+ DEFINE_INTERNALTRANSITION(OnEventStopInStoppingState)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMFramework default constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// CFrameworkunifiedHSM()
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMFramework default constructor, for create CFrameworkunifiedHSMFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMFramework();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMFramework constructor with param
+ /// \~english @param [in] f_pHApp
+ /// PVOID f_pHApp - for parent class constructor
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// CFrameworkunifiedHSM(f_pHApp)
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMFramework constructor with param, for create CFrameworkunifiedHSMFramework object
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMFramework(PVOID f_pHApp); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMFramework
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param [in] f_pEventData
+ /// PVOID f_pEventData - event data
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedCreate
+ /// Statemachine states and events created and connected in this interface.
+ ///
+ /// \param [in] f_pEventData
+ /// PVOID - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMFramework
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param [in] f_pAppState
+ /// CFrameworkunifiedState *f_pAppState - state object to be added in the ready state.
+ /// \~english @param [in] f_bIsDefaultState
+ /// BOOL f_bIsDefaultState - if the state is default state
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This adds the given state as a sub state of sReady state of the Framework
+ ///
+ /// \param [in] f_pAppState
+ /// CFrameworkunifiedState* - state object to be added in the ready state.
+ ///
+ /// \param [in] f_bIsDefaultState
+ /// BOOL - defines if the state is default state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(CFrameworkunifiedState *f_pAppState, BOOL f_bIsDefaultState = FALSE) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMFramework
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState - enum maping to framework state
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - Event id
+ /// \~english @param [in] f_pReaction
+ /// CFrameworkunifiedReaction *f_pReaction - Reaction object for attaching to event
+ /// \~english @param [in] f_strEventName
+ /// std::string f_strEventName - Event name
+ /// \~english @param [in] f_bIsDeferredEvent
+ /// BOOL f_bIsDeferredEvent - defines if the event is deferred event
+ /// \~english @retval EFrameworkunifiedStatus depend on implement class
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This connects the reaction to event and add event to states
+ ///
+ /// \param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES - enum maping to framework state
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id
+ ///
+ /// \param [in] f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ ///
+ /// \param [in] f_strEventName
+ /// std::string - Event name
+ ///
+ /// \param [in] f_bIsDeferredEvent
+ /// BOOL - defines if the event is deferred event
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState, UI_32 f_uiEventId,
+ CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName = "",
+ BOOL f_bIsDeferredEvent = FALSE) = 0;
+
+ protected:
+ /// Stores the state objects against FRAMEWORKUNIFIED_HSM_STATES enumerations
+ std::map<UI_32, CFrameworkunifiedState *> *m_pFrameworkunifiedStateList;
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// It defines the states required for NS statemachine framework, it creates the NS
+/// statemachine and implements the reaction associated with the events
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedHSMParentFramework: public CFrameworkunifiedHSMFramework {
+ public:
+ /// Define evFrameworkunifiedLoadPersistenceAck event
+ DEFINE_EVENT(evFrameworkunifiedLoadFileAck, 2)
+
+ /// Define evFrameworkunifiedLoadComplete event
+ DEFINE_EVENT(evFrameworkunifiedLoadComplete, 4)
+
+ /// Define evFrameworkunifiedUserChange event
+ DEFINE_EVENT(evFrameworkunifiedUserChange, 6)
+
+ /// Define evFrameworkunifiedReInit event
+ DEFINE_EVENT(evFrameworkunifiedReInit, 7)
+
+ /// Define evFrameworkunifiedLoadUserData event
+ DEFINE_EVENT(evFrameworkunifiedLoadUserData, 8)
+
+ /// Define evFrameworkunifiedCloseSessionAck event
+ DEFINE_EVENT(evFrameworkunifiedCloseSessionAck, 9)
+
+ /// Define evFrameworkunifiedCloseSessionAck event
+ DEFINE_EVENT(evFrameworkunifiedOpenSessionAck, 10)
+
+ /// Define evFrameworkunifiedStopComplete event
+ DEFINE_EVENT(evFrameworkunifiedStopComplete, 11)
+
+ /// Define evFrameworkunifiedOpenSessionReq event
+ DEFINE_EVENT(evFrameworkunifiedOpenSessionReq, 14)
+
+ /// Define evFrameworkunifiedCloseSessionReq event
+ DEFINE_EVENT(evFrameworkunifiedCloseSessionReq, 15)
+
+ /// Define evFrameworkunifiedInit event
+ DEFINE_EVENT(evFrameworkunifiedInit, 16)
+
+ /// Define evFrameworkunifiedUserChangeComplete event
+ DEFINE_EVENT(evFrameworkunifiedUserChangeComplete, 17)
+
+ /// Define evFrameworkunifiedLoadSessions event
+ DEFINE_EVENT(evFrameworkunifiedLoadSessions, 18)
+
+ /// Define sFrameworkunifiedRoot state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedRoot)
+
+ /// Define sFrameworkunifiedRoot state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedApp)
+
+ /// Define sFrameworkunifiedInitialization state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedInitialization)
+
+ /// Define sFrameworkunifiedPre state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedPre)
+
+ /// Define sFrameworkunifiedBackground state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedBackground)
+
+ /// Define sFrameworkunifiedRun state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedRun)
+
+ /// Define sFrameworkunifiedStop state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedStop)
+
+ /// Define sFrameworkunifiedReady state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedReady)
+
+ /// Define sFrameworkunifiedLoadData state
+ DEFINE_LEAFSTATE_OVERRIDE(sFrameworkunifiedLoadData)
+
+ /// Define sFrameworkunifiedLoadSessions state
+ DEFINE_LEAFSTATE_OVERRIDE(sFrameworkunifiedLoadSessions)
+
+ /// Define sFrameworkunifiedStopping state
+ DEFINE_LEAFSTATE_OVERRIDE(sFrameworkunifiedStopping)
+
+ /// Define sFrameworkunifiedUserChange state
+ DEFINE_LEAFSTATE_OVERRIDE(sFrameworkunifiedUserChange)
+
+ // DEFINE_ACTION(aFrameworkunifiedOnStart)
+ DEFINE_ACTION(aFrameworkunifiedOnStop)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMFramework default constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ /// \~english @par Conditions of processing failure
+ /// apply space for m_pFrameworkunifiedStateList failed
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMFramework default constructor, for create CFrameworkunifiedHSMFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMParentFramework();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMFramework constructor with param
+ /// \~english @param [in] f_pHApp
+ /// PVOID f_pHApp - Name of the state
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ /// \~english @par Conditions of processing failure
+ /// apply space for m_pFrameworkunifiedStateList failed
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMFramework constructor with param, for create CFrameworkunifiedHSMFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedHSMParentFramework
+ /// default constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMParentFramework(PVOID f_pHApp); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMFramework destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMFramework destructor, for destory CFrameworkunifiedHSMFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedHSMParentFramework
+ /// Class destructor
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedHSMParentFramework();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// create state and event
+ /// \~english @param [in] f_pEventData
+ /// PVOID f_pEventData - event data
+ /// \~english @retval eFrameworkunifiedStatusOK create state and event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when create state and event
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL pointer exception occur
+ /// \~english @par Detail
+ /// Statemachine states and events created and connected in this interface.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedCreate
+ /// Statemachine states and events created and connected in this interface.
+ ///
+ /// \param [in] f_pHApp
+ /// PVOID - application handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// add sub state
+ /// \~english @param [in] f_pAppState
+ /// CFrameworkunifiedState *f_pAppState - state object to be added in the ready state.
+ /// \~english @param [in] f_bIsDefaultState
+ /// BOOL f_bIsDefaultState - defines if the state is default state.
+ /// \~english @retval eFrameworkunifiedStatusOK add sub state success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when add sub state
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL point exception occur when add sub state
+ /// \~english @par Detail
+ /// This adds the given state as a sub state of sReady state of the Framework
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This adds the given state as a sub state of sReady state of the Framework
+ ///
+ /// \param [in] f_pAppState
+ /// CFrameworkunifiedState* - state object to be added in the ready state.
+ ///
+ /// \param [in] f_bIsDefaultState
+ /// BOOL - defines if the state is default state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(CFrameworkunifiedState *f_pAppState, BOOL f_bIsDefaultState = FALSE);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMParentFramework
+ /// \~english @par Brief
+ /// connects the reaction to event and add event to states
+ /// \~english @param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState - framework state
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - Event id
+ /// \~english @param [in] f_pReaction
+ /// CFrameworkunifiedReaction *f_pReaction - Reaction object
+ /// \~english @param [in] f_strEventName
+ /// std::string f_strEventName - Event name
+ /// \~english @param [in] f_bIsDeferredEvent
+ /// BOOL f_bIsDeferredEvent - defines if the event is deferred event
+ /// \~english @retval eFrameworkunifiedStatusOK add sub state success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when add sub state
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL point exception occur when add sub state
+ /// \~english @par Detail
+ /// This connects the reaction to event and add event to states
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This connects the reaction to event and add event to states
+ ///
+ /// \param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES - enum maping to framework state
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id
+ ///
+ /// \param [in] f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ ///
+ /// \param [in] f_strEventName
+ /// std::string - Event name
+ ///
+ /// \param [in] f_bIsDeferredEvent
+ /// BOOL - defines if the event is deferred event
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState, UI_32 f_uiEventId,
+ CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName = "",
+ BOOL f_bIsDeferredEvent = FALSE);
+};
+
+class CFrameworkunifiedHSMChildFramework: public CFrameworkunifiedHSMFramework {
+ public:
+ /// Define sFrameworkunifiedThreadIdle state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedThreadRoot)
+
+ /// Define sFrameworkunifiedThreadIdle state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedThreadIdle)
+
+ /// Define sFrameworkunifiedThreadStart state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedThreadStart)
+
+ /// Define sFrameworkunifiedThreadReady state
+ DEFINE_COMPOSITESTATE_OVERRIDE(sFrameworkunifiedThreadReady)
+
+ /// Define sFrameworkunifiedThreadStop state
+ DEFINE_LEAFSTATE_OVERRIDE(sFrameworkunifiedThreadStop)
+
+ // Define internal transition for event evFrameworkunifiedDestroy
+ DEFINE_INTERNALTRANSITION(OnDestroyThread)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMChildFramework constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMChildFramework constructor, for create CFrameworkunifiedHSMChildFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedHSMChildFramework
+ /// default constructor
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMChildFramework();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMChildFramework constructor with param
+ /// \~english @param [in] f_pHApp
+ /// PVOID f_pHApp - application handle
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// m_pFrameworkunifiedStateList = new std::map<UI_32, CFrameworkunifiedState *>();
+ /// \~english @par Conditions of processing failure
+ /// m_pFrameworkunifiedStateList apply space fail
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMChildFramework constructor with param, for create CFrameworkunifiedHSMChildFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedHSMChildFramework
+ /// default constructor
+ /// \param [in] f_pHApp
+ /// PVOID - application handle
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedHSMChildFramework(PVOID f_pHApp); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// CFrameworkunifiedHSMChildFramework destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedHSMChildFramework destructor, for destory CFrameworkunifiedHSMChildFramework object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedHSMChildFramework
+ /// Class destructor
+ ///
+ /// \return none
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedHSMChildFramework();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// create state and event
+ /// \~english @param [in] f_pEventData
+ /// PVOID f_pEventData - event data
+ /// \~english @retval eFrameworkunifiedStatusOK create state and event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when create state and event
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL pointer exception occur
+ /// \~english @par Detail
+ /// Statemachine states and events created and connected in this interface.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedCreate
+ /// Statemachine states and events created and connected in this interface.
+ ///
+ /// \param [in] f_pEventData
+ /// PVOID - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// add sub state
+ /// \~english @param [in] f_pAppState
+ /// CFrameworkunifiedState *f_pAppState - state object to be added in the ready state.
+ /// \~english @param [in] f_bIsDefaultState
+ /// BOOL f_bIsDefaultState - defines if the state is default state.
+ /// \~english @retval eFrameworkunifiedStatusOK add sub state success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when add sub state
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL point exception occur when add sub state
+ /// \~english @par Detail
+ /// This adds the given state as a sub state of sReady state of the Framework
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This adds the given state as a sub state of sReady state of the Framework
+ ///
+ /// \param [in] f_pAppState
+ /// CFrameworkunifiedState* - state object to be added in the ready state.
+ ///
+ /// \param [in] f_bIsDefaultState
+ /// BOOL - defines if the state is default state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(CFrameworkunifiedState *f_pAppState, BOOL f_bIsDefaultState = FALSE);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedHSMChildFramework
+ /// \~english @par Brief
+ /// connects the reaction to event and add event to states
+ /// \~english @param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState - framework state
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - Event id
+ /// \~english @param [in] f_pReaction
+ /// CFrameworkunifiedReaction *f_pReaction - Reaction object
+ /// \~english @param [in] f_strEventName
+ /// std::string f_strEventName - Event name
+ /// \~english @param [in] f_bIsDeferredEvent
+ /// BOOL f_bIsDeferredEvent - defines if the event is deferred event
+ /// \~english @retval eFrameworkunifiedStatusOK add sub state success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL point exception occur when add sub state
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// NULL point exception occur when add sub state
+ /// \~english @par Detail
+ /// This connects the reaction to event and add event to states
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedFrameworkConnect
+ /// This connects the reaction to event and add event to states
+ ///
+ /// \param [in] f_eFrameworkunifiedState
+ /// FRAMEWORKUNIFIED_HSM_STATES - enum maping to framework state
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id
+ ///
+ /// \param [in] f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction object for attaching to event
+ ///
+ /// \param [in] f_strEventName
+ /// std::string - Event name
+ ///
+ /// \param [in] f_bIsDeferredEvent
+ /// BOOL - defines if the event is deferred event
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedFrameworkConnect(FRAMEWORKUNIFIED_HSM_STATES f_eFrameworkunifiedState,
+ UI_32 f_uiEventId,
+ CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName = "",
+ BOOL f_bIsDeferredEvent = FALSE);
+
+ /// function pointer of the Thread start routine
+ CbFuncPtr m_fpStartThread;
+
+ /// function pointer of the Thread stop routine
+ CbFuncPtr m_fpStopThread;
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSMFRAMEWORK_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_internaltransition.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_internaltransition.h
new file mode 100755
index 0000000..71eebec
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_internaltransition.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedInternalTransition class definitions. CFrameworkunifiedInternalTransition is derived
+/// from CFrameworkunifiedReaction class.This class provides the interface for defining a reaction for an event
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_internaltransition.h
+ * @brief \~english This file has the CFrameworkunifiedInternalTransition class definitions. CFrameworkunifiedInternalTransition is derived
+ * from CFrameworkunifiedReaction class.This class provides the interface for defining a reaction for an event
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDINTERNALTRANSITION_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDINTERNALTRANSITION_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_reaction.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class provides the interface for defining a reaction for an event
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedInternalTransition : public CFrameworkunifiedReaction {
+ public :
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedInternalTransition
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param [in] f_pSourceState
+ /// CFrameworkunifiedState* f_pSourceState - source state
+ /// \~english @param [in] f_pData
+ /// CEventDataPtr f_pData - event data
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Pure virtual function , implemented by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedReaction
+ /// The reaction for the event has to be implemented in this function
+ ///
+ /// \param [in] f_pSourceState
+ /// CFrameworkunifiedState* - Event id of the event to be added in the state
+ ///
+ /// \param [in] f_pData
+ /// CEventDataPtr - Reaction to be associated with the with event id in the state
+ ///
+ /// \return ActiveState
+ /// CFrameworkunifiedState* - Returns Active state
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) = 0;
+};
+
+#endif // _FRAMEWORKUNIFIEDINTERNALTRANSITION_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_leafstate.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_leafstate.h
new file mode 100755
index 0000000..e1aa6bd
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_leafstate.h
@@ -0,0 +1,252 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedLeafState class definitions. CFrameworkunifiedLeafState is derived from C
+/// FrameworkunifiedState class.This class implements the additional functionality supported by HSM Leafstate.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_leafstate.h
+ * @brief \~english This file has the CFrameworkunifiedLeafState class definitions. CFrameworkunifiedLeafState is derived from C
+ * FrameworkunifiedState class.This class implements the additional functionality supported by HSM Leafstate.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDLEAFSTATE_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDLEAFSTATE_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_state.h>
+#include <string>
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM Leafstate.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedLeafState : public CFrameworkunifiedState {
+ public :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// It is a constructor for CFrameworkunifiedLeafState classes.
+ /// \~english @param [in] f_pName
+ /// std::string - state name
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Inherits CFrameworkunifiedState, which is a superclass of state machines.\n
+ /// This class is implemented by HSM Leafstate as an additional class of functional support.\n
+ /// It inherits from the CFrameworkunifiedState classes and instantiates the CFrameworkunifiedLeafState.
+ /// \~english @par Immediate
+ /// Brief
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see ~CFrameworkunifiedLeafState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ CFrameworkunifiedLeafState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// Destructors for CFrameworkunifiedLeafState classes.
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedLeafState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Frees instances of CFrameworkunifiedLeafState classes.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedLeafState::CFrameworkunifiedLeafState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedState
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedLeafState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// Get the active state.
+ /// \~english @retval CFrameworkunifiedState* Pointers to active-state (CFrameworkunifiedState classes) objects
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedLeafState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides and uses CFrameworkunifiedState::FrameworkunifiedGetActiveState, which is pure virtual functions.\n
+ /// Returns the current state (this) as the active state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedGetActiveState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedGetActiveState
+ /// This interface returns the Active state of the current composite state. In case of
+ /// non-composite state current state is active state
+ ///
+ /// \return Active state
+ /// CFrameworkunifiedState* - Active state
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// Save the last active state.
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedLeafState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides CFrameworkunifiedState::UpdateHistory, which is pure virtual functions.Used and saves the last active state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::UpdateHistory
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateHistory
+ /// This function stores the last active state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ EFrameworkunifiedStatus UpdateHistory();
+
+ protected :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// Initialize state
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedLeafState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides and uses CFrameworkunifiedState::FrameworkunifiedOnEntry, which is pure virtual functions, to initialize state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedOnEntry, FrameworkunifiedOnExit
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEntry
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLeafState
+ /// \~english @par Brief
+ /// Clean up state.
+ /// \~english @param f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedLeafState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This method overrides and uses CFrameworkunifiedState::FrameworkunifiedOnExit, which is pure virtual functions, to clean up state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedState::FrameworkunifiedOnExit, FrameworkunifiedOnEntry
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnExit
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
+};
+
+#endif // _FRAMEWORKUNIFIEDLEAFSTATE_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_localtransition.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_localtransition.h
new file mode 100755
index 0000000..99975eb
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_localtransition.h
@@ -0,0 +1,163 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedLocalTransition class definitions. CFrameworkunifiedLocalTransition is derived
+/// from CFrameworkunifiedTransition class.This class provides the interface for local transition over event
+///////////////////////////////////////////// //////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_localtransition.h
+ * @brief \~english This file has the CFrameworkunifiedLocalTransition class definitions. CFrameworkunifiedLocalTransition is derived
+ * from CFrameworkunifiedTransition class.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDLOCALTRANSITIONS_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDLOCALTRANSITIONS_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_transition.h>
+
+class CFrameworkunifiedEventData;
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class provides the interface for local transition over event
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedLocalTransition : public CFrameworkunifiedTransition {
+ public :
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLocalTransition
+ /// \~english @par Brief
+ /// CFrameworkunifiedLocalTransition constructor
+ /// \~english @param [in] f_pTargetState
+ /// CFrameworkunifiedState *f_pTargetState - target state
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// Constructor of CFrameworkunifiedLocalTransition, to create CFrameworkunifiedLocalTransition object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedLocalTransition(CFrameworkunifiedState *f_pTargetState); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLocalTransition
+ /// \~english @par Brief
+ /// CFrameworkunifiedLocalTransition destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedLocalTransition destructor, for destory CFrameworkunifiedLocalTransition object
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedLocalTransition();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedLocalTransition
+ /// \~english @par Brief
+ /// reaction for location transition
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// For local transition from inner
+ /// state to outer state exit of the inner state is invoked, but entry of outer state is not
+ /// invoked and from outer state to inner state entry of the inner state is invoked but exit of
+ /// outer state is not invoked
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedReaction
+ /// The reaction for an event is implemented in this function. For local transition from inner
+ /// state to outer state exit of the inner state is invoked, but entry of outer state is not
+ /// invoked and from outer state to inner state entry of the inner state is invoked but exit of
+ /// outer state is not invoked
+ ///
+ /// \param [in] f_pSourceState
+ /// CFrameworkunifiedState* - Source state in which reaction is being executed
+ ///
+ /// \param [in] f_pData
+ /// CEventDataPtr - event data
+ ///
+ /// \return ActiveState
+ /// CFrameworkunifiedState* - Returns Active state
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData);
+};
+
+#endif // _FRAMEWORKUNIFIEDLOCALTRANSITIONS_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_multithreading.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_multithreading.h
new file mode 100755
index 0000000..827b180
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_multithreading.h
@@ -0,0 +1,227 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \~english \brief Application framework's core structures and data types.
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_multithreading.h
+ * @brief \~english Application framework's core structures and data types.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_H__
+
+#include <native_service/frameworkunified_framework_types.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedCreateHSMChildThread
+/// \~english @par Brief
+/// Start a subordinate dispatcher in a separate thread
+///
+/// \~english \param [in] hApp
+/// HANDLE - parent framework HANDLE
+/// \~english \param [in] childName
+/// PCSTR - Name to give to the child object
+/// \~english \param [in] CbInitialize
+/// CbFuncPtr - Initialization callback - use this to initialize and configure
+/// the child's dispatcher.
+/// \~english \param [in] CbShutdown
+/// CbFuncPtr - Shutdown callback - use this to shutdown and close the child
+/// The correct way for child to exit dispatch loop is to return eFrameworkunifiedStatusExit
+/// directly from this callback, or from some other interaction triggered by this
+/// callback
+///
+/// \~english \param [in] CbCreateStateMachine
+/// CbFuncPtr - StateMachine callback - use this to add new states, events and reactions
+/// in the Thread statemachine.
+/// \~english @retval HANDLE create thread with Priority success
+/// \~english @retval NULL create thread with Priority failed
+/// \~english @par Preconditions
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+/// \~english @par Change of the internal state
+/// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize,CbShutdown) is NULL. [NULL]
+/// - Thread attribute specified in the argument (attr) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// Start a subordinate dispatcher in a separate thread
+/// This API creates a child thread and returns a handle for communication with the child thread.\n
+/// After creating/initializing the Dispatcher for the child thread, the child thread receives requests
+/// and notifications to the Dispatcher and starts a main loop that executes the registered callback.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThread(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize, CbFuncPtr
+ CbShutdown, CbFuncPtr CbCreateStateMachine);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FrameworkunifiedCreateHSMChildThread
+ /// \~english @par Summary
+ /// Start a subordinate dispatcher in a separate thread with given Priority
+ /// \~english @param [in] hApp
+ /// HANDLE - parent framework HANDLE
+ /// \~english @param [in] childName
+ /// PCSTR - Name to give to the child object
+ /// \~english @param [in] CbInitialize
+ /// CbFuncPtr - Initialization callback - use this to initialize and configure
+ /// the child's dispatcher.
+ /// \~english @param [in] CbShutdown
+ /// CbFuncPtr - Shutdown callback - use this to shutdown and close the child
+ /// The correct way for child to exit dispatch loop is to return eFrameworkunifiedStatusExit
+ /// directly from this callback, or from some other interaction triggered by this
+ /// callback
+ ///
+ /// \~english @param [in] CbCreateStateMachine
+ /// CbFuncPtr - StateMachine callback - use this to add new states, events and reactions
+ /// in the Thread statemachine.
+ /// \~english @param [in] schedPrio
+ /// SI_32 - given Priority for create thread
+ /// \~english @retval HANDLE create thread with Priority success
+ /// \~english @retval NULL create thread with Priority failed
+ /// \~english @par Preconditions
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize,CbShutdown) is NULL. [NULL]
+/// - Thread attribute specified in the argument (attr) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Start a subordinate dispatcher in a separate thread with given Priority
+ /// This API creates a child thread and returns a handle for communication with the child thread.\n
+ /// After creating/initializing the Dispatcher for the child thread, the child thread receives requests
+ /// and notifications to the Dispatcher and starts a main loop that executes the registered callback.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThreadWithPriority(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize,
+ CbFuncPtr CbShutdown, CbFuncPtr CbCreateStateMachine, SI_32 schedPrio);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FrameworkunifiedCreateHSMChildThread
+ /// \~english @par Summary
+ /// Start a subordinate dispatcher in a separate thread with given attribute
+ /// \~english @param [in] hApp
+ /// HANDLE - parent framework HANDLE
+ /// \~english @param [in] childName
+ /// PCSTR - Name to give to the child object
+ /// \~english @param [in] CbInitialize
+ /// CbFuncPtr - Initialization callback - use this to initialize and configure
+ /// the child's dispatcher.
+ /// \~english @param [in] CbShutdown
+ /// CbFuncPtr - Shutdown callback - use this to shutdown and close the child
+ /// The correct way for child to exit dispatch loop is to return eFrameworkunifiedStatusExit
+ /// directly from this callback, or from some other interaction triggered by this
+ /// callback
+ ///
+ /// \~english @param [in] CbCreateStateMachine
+ /// CbFuncPtr - StateMachine callback - use this to add new states, events and reactions
+ /// in the Thread statemachine.
+ /// \~english @param [in] attr
+ /// const FrameworkunifiedChildThreadAttr * - given attribute to create thread
+ /// \~english @retval HANDLE create thread with Priority success
+ /// \~english @retval NULL create thread with Priority failed
+ /// \~english @par Preconditions
+/// - Generation/Initialization of Dispatcher for the Application
+/// (FrameworkunifiedCreateDispatcherWithoutLoop, etc.) has been done.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+/// \~english @par Conditions of processing failure
+/// - HANDLE specified in the argument (hApp) is NULL. [NULL]
+/// - HANDLE specified in the argument (hApp) is not appropriate (which is invalid). [NULL]
+/// - Message queue name specified in the argument (childName) is not appropriate (NULL, over 16byte). [NULL]
+/// - Callback function pointer specified in the argument (CbInitialize,CbShutdown) is NULL. [NULL]
+/// - Thread attribute specified in the argument (attr) is NULL. [NULL]
+/// - Failed to set the inherit-scheduler attribute (pthread_attr_setinheritsched) of the child thread. [NULL]
+/// - Failed to initialize barrier object (pthread_barrier_init) for thread synchronization. [NULL]
+/// - Failed to create child thread (pthread_create). [NULL]
+/// - Failed to wait thread synchronization (pthread_barrier_wait). [NULL]
+/// - Can not be acquired memory for message queue name(malloc). [NULL]
+/// - Failed to open message queue(mq_open). [NULL]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Start a subordinate dispatcher in a separate thread with given attribute
+ /// This API creates a child thread and returns a handle for communication with the child thread.\n
+ /// After creating/initializing the Dispatcher for the child thread, the child thread receives requests
+ /// and notifications to the Dispatcher and starts a main loop that executes the registered callback.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedCreateHSMChildThreadWithAttribute(HANDLE hApp, PCSTR childName, CbFuncPtr CbInitialize,
+ CbFuncPtr CbShutdown, CbFuncPtr CbCreateStateMachine,
+ const FrameworkunifiedChildThreadAttr *attr);
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_MULTITHREADING_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_orthogonalstate.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_orthogonalstate.h
new file mode 100755
index 0000000..c9ea8c7
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_orthogonalstate.h
@@ -0,0 +1,513 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedOrthogonalState class definitions. CFrameworkunifiedOrthogonalState is derived from
+/// CFrameworkunifiedCompositeState class.This class implements the additional functionality supported by HSM
+/// Orthogonal state. It provides the standard interfaces for adding orthogonal state machines.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_orthogonalstate.h
+ * @brief \~english This file has the CFrameworkunifiedOrthogonalState class definitions. CFrameworkunifiedOrthogonalState is derived from
+ * CFrameworkunifiedCompositeState class.This class implements the additional functionality supported by HSM
+ * Orthogonal state. It provides the standard interfaces for adding orthogonal state machines.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDORTHOGONALSTATE_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDORTHOGONALSTATE_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_state.h>
+#include <vector>
+
+typedef std::vector<CFrameworkunifiedState *> OrthogonalRegionList;
+
+class CFrameworkunifiedCompositeState;
+
+class CFrameworkunifiedHSM;
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM
+/// Orthogonal state. It provides the standard interfaces for adding orthogonal state machines.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedOrthogonalState : public CFrameworkunifiedState {
+ public :
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Constructors for CFrameworkunifiedOrthogonalState classes
+ /// \~english @param [in] f_pName
+ /// std::string - state name
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - When the quadrature region list cannot be created due to insufficient memory
+ /// \~english @par Detail
+ /// Generates an orthographic region list.\n
+ /// CFrameworkunifiedOrthogonalState classes are used to manage the status of independent features individually.\n
+ /// For example, when the function of the clock is set to the following two, the management of the internal state is performed according to the function.\n
+ /// - Clock function (Clock display by 12h/24h)\n
+ /// - Alarm function (on/off setting)
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see ~CFrameworkunifiedOrthogonalState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedCompositeState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ CFrameworkunifiedOrthogonalState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Destructors of CFrameworkunifiedOrthogonalState classes
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Frees the memory in the orthographic area list and clears the memory contents.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedOrthogonalState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedOrthogonalState
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedOrthogonalState();
+
+
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Initialize state
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval Successful pointer to the current state after processing
+ /// \~english @retval NULL Exception supine in internal processing
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - The State Machine for the current state of the application is set in the FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - Failed recursive function call (FrameworkunifiedOnEntry call)[NULL]
+ /// - If the pointers to the orthographic regions are NULL [NULL]
+ /// \~english @par Detail
+ /// Loops as many times as the number of elements in the quadrature area list, and initializes the active state (calls FrameworkunifiedOnEntry).\n
+ /// If the current state is Leaf State, it does not initialize because it does not have any active state.\n
+ /// If, after initialization, the current state is a child state of Orthogonal State, sets itself (the this pointer) to the current state.\n
+ /// Breaks looping if the current state is not a child state of Orthogonal State.\n
+ /// To maintain the hierarchy, the active state of the parent state is set to the current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see FrameworkunifiedOnHSMStop, FrameworkunifiedOnEntry, CFrameworkunifiedState::FrameworkunifiedOnHSMStart, IsOrthogonalChildState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStart
+ /// This function is called recursively till the leaf state is reached. This internally
+ /// calls the Entry function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ CFrameworkunifiedState *FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Clean up state.
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval Successful pointer to the current state after processing
+ /// \~english @retval NULL Exception supine in internal processing
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - The State Machine for the current state of the application is set in the FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - If the pointers to the orthographic regions are NULL [NULL]
+ /// - If the pointers to the orthographic area lists of the member variables are NULL [NULL]
+ /// - Active state pointers from orthographic area lists of member variables are NULL [NULL]
+ /// - If the current state of the state being cleaned up is NULL [NULL]
+ /// \~english @par Detail
+ /// Loops as many times as the number of elements in the quadrature area list, and performs cleanup of the active state (calls FrameworkunifiedOnExit).\n
+ /// If the current state is Leaf State,Do not clean up because it does not have any active state.\n
+ /// If the current state is a child state of Orthogonal State (orthographic state) after the cleanup process finishes,Sets itself (the this pointer) to the current state.\n
+ /// Breaks looping if the current state is not a child state of Orthogonal State.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see FrameworkunifiedOnHSMStart, CFrameworkunifiedState::FrameworkunifiedOnHSMStop, CFrameworkunifiedState::FrameworkunifiedPostEvent, FrameworkunifiedOnExit,
+ /// IsOrthogonalChildState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStop
+ /// This function is called recursively till the required parent state is reached. This
+ /// internally calls the Exit function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ CFrameworkunifiedState *FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedAddOrthogonalRegion
+ /// This Interface adds orthogonal region in the orthogonal state.
+ ///
+ /// \param [in] f_pOrthogonalRegion
+ /// CFrameworkunifiedCompositeState - Orthogonal region object to be associated with state.
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedAddOrthogonalRegion(CFrameworkunifiedCompositeState *f_pOrthogonalRegion);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Checks whether OrthogonalRegion (orthographic area) is registered or not.
+ /// \~english @retval TRUE OrthogonalRegion (orthographic area) is registered
+ /// \~english @retval FALSE OrthogonalRegion (orthographic area) is not registered
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - OrthogonalRegion (orthographic area) is registered in FrameworkunifiedAddOrthogonalRegion.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - If the pointers to the orthographic regions are NULL [FALSE]
+ /// - When the OrthogonalRegion (orthographic area) is not registered and the number of elements (size) of the orthographic area is 0, [FALSE]
+ /// \~english @par Detail
+ /// Checks whether OrthogonalRegion (orthographic area) is registered by referring to the number of elements (size) of the orthographic area list.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedHasOrthogoanlRegions
+ /// This checks if the current state has Orthogonal regions
+ ///
+ ///
+ /// \return TRUE/FASLE
+ /// BOOL - returns TRUE if orthogonal regions are available in the state
+ virtual BOOL FrameworkunifiedHasOrthogoanlRegions();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Event handling
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to the event data class
+ /// \~english @retval Successful pointer to the current state after processing
+ /// \~english @retval NULL Operation cannot be guaranteed.
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - The State Machine for the current state of the application is set in the FrameworkunifiedSetHSM.
+ /// - OrthogonalRegion (orthographic area) is registered in FrameworkunifiedAddOrthogonalRegion.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - If the pointers to the orthographic regions are NULL [NULL]
+ /// - If the event data class is pointed to by NULL [NULL]
+ /// \~english @par Detail
+ /// If the event specified in the argument (f_pEventData) is available in the current state,Set itself (this) to current state and return it.\n
+ /// Invokes the parent-state FrameworkunifiedOnEvent if not available in the current state
+ /// (Repeated until the root state is reached.)\n
+ /// However, since the FrameworkunifiedState that is the parent state of the Orthogonal State (orthographic state) is the root state,You call the FrameworkunifiedOnEvent of FrameworkunifiedState.\n
+ /// If the current state is a child state of the Orthogonal State (quadrature state) after the above process, sets itself (the this pointer) to the current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedCompositeState::FrameworkunifiedGetActiveState, CFrameworkunifiedState::FrameworkunifiedIsReactionAvailable, CFrameworkunifiedState::FrameworkunifiedOnEvent,
+ /// IsOrthogonalChildState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEvent
+ /// This function processes the event. If the reaction for event is available in the current
+ /// state within eventlist and deferred eventlist then it is consumed in the current state
+ /// otherwise forwarded to the parent state. Event forwarding is done recursively till either
+ /// event is consumed or the root state has encountered. This also process the events posted
+ /// in the reactions recursively till all posted events are cleared.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ ///
+ /// \return state
+ /// CFrameworkunifiedState* - Returns current state after the event is processed
+ ///
+ virtual CFrameworkunifiedState *FrameworkunifiedOnEvent(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Logs the state name and event name.
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Specifying NULL pointers
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - OrthogonalRegion (orthographic area) is registered in FrameworkunifiedAddOrthogonalRegion.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - If the pointers to the orthographic regions are NULL [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Size of the log output data
+ /// - State name of the parent state machine and the state name of the self-state machine
+ /// - All event names on the event list
+ /// - All event names on the deferred event list
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedCompositeState::FrameworkunifiedPrintStates
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPrintStates
+ /// This logs the state name and events associated with the state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedPrintStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Get the active state.
+ /// \~english @retval Successful pointer to the active state
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// In this class, the current state (this state) is always returned as the active state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see None
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedGetActiveState
+ /// This interface returns the Active state of the current composite state. In case of
+ /// non-composite state current state is active state
+ ///
+ /// \return Active state
+ /// CFrameworkunifiedState* - Active state
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Associate the state machine with the current state.
+ /// \~english @param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Pointers to state machines (CFrameworkunifiedHSM classes)
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Specifiying NULL pointers
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - When the pointers to the state machines (CFrameworkunifiedHSM classes) specified in the arguments (f_pStatemachine) are NULL
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Associates a state machine with the current state by setting a pointer (f_pStatemachine) to the state machine (CFrameworkunifiedHSM) specified by the argument to the pointer to the state machine of the member variables.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedCompositeState::FrameworkunifiedSetHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSetHSM
+ /// This Interface associates the gives statemachine with the current state
+ ///
+ /// \param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Statemachine associated with the state.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Outputs state information in the form of XML tags.
+ /// \~english @param [out] f_strXMLString
+ /// std::ostringstream& - Only kept in NPS
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Specifiying NULL pointers
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// - The State Machine for the current state of the application is set in the FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - If generating of own instance (CFrameworkunifiedOrthogonalState) failed, [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Outputs the following state information in XML tag format to the XML stream specified by the argument.
+ /// - Sate name
+ /// - All event information (event ID and event name) in the event list
+ /// - All event information (event ID and event name) in the deferred event list
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see CFrameworkunifiedCompositeState::FrameworkunifiedPrintXML
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPrintXML
+ /// Update the State information in the given stream in the form of XML tags
+ ///
+ /// \param [in] f_strXMLString
+ /// std::ostringstream & - reference to the XML stream
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_CFrameworkunifiedOrthogonalState
+ /// \~english @par Brief
+ /// Always returns eFrameworkunifiedStatusOK (Successful).
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @par Prerequisite
+ /// - Its own instance (CFrameworkunifiedOrthogonalState) has been created.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// In this class, eFrameworkunifiedStatusOK is always returned because the class does not require the History feature.\n
+ /// The History feature holds the active state prior to preprocessing and
+ /// returns the inside state to the active state prior to processing after the processing is executed.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Not applicable
+ /// \~english @see
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateHistory
+ /// This function stores the last active state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ EFrameworkunifiedStatus UpdateHistory();
+
+ protected :
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEntry
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnExit
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData);
+
+ private:
+ /// Pointer to the map that stores the pointer to Orthogonal region list
+ OrthogonalRegionList *m_pOrthogonalReigonList;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// IsOrthogonalChildState
+ /// Checks if the given state is a child of orthogonal region
+ ///
+ /// \param [in] f_pChildState
+ /// CFrameworkunifiedState* - Child state pointer
+ ///
+ /// \return TRUE/FASLE
+ /// BOOL - returns TRUE if the given state is child of orthogonal state
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsOrthogonalChildState(CFrameworkunifiedState *f_pChildState);
+};
+
+#endif // _FRAMEWORKUNIFIEDORTHOGONALSTATE_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_reaction.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_reaction.h
new file mode 100755
index 0000000..83beea0
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_reaction.h
@@ -0,0 +1,184 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedReaction class definitions.This class provides the interface
+/// for defining a reaction for an event
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_reaction.h
+ * @brief \~english This file has the CFrameworkunifiedReaction class definitions.This class provides the interface
+ * for defining a reaction for an event
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef _FRAMEWORKUNIFIEDREACTION_H // NOLINT (build/header_guard)
+#define _FRAMEWORKUNIFIEDREACTION_H
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#include <boost/smart_ptr.hpp>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+#include <exception>
+
+class CFrameworkunifiedState;
+class CEventData;
+
+typedef boost::shared_ptr<CEventData> CEventDataPtr;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class provides the interface for defining a reaction for an event
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedReaction {
+ public :
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedReaction
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param [in] f_pSourceState
+ /// CFrameworkunifiedState* f_pSourceState - source state
+ /// \~english @param [in] f_pData
+ /// CEventDataPtr f_pData - event data
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedReaction
+ /// The reaction for the event has to be implemented in this function
+ ///
+ /// \param [in] f_pSourceState
+ /// CFrameworkunifiedState* - Source state in which reaction is being executed
+ ///
+ /// \param [in] f_pData
+ /// CEventDataPtr - event data
+ ///
+ /// \return ActiveState
+ /// CFrameworkunifiedState* - Returns Active state
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedReaction
+ /// \~english @par Summary
+ /// CFrameworkunifiedReaction constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - m_ucRefCount = 0
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// CFrameworkunifiedReaction Constructor, for create CFrameworkunifiedReaction object
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedReaction
+ /// Constructor
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedReaction() {
+ m_ucRefCount = 0;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedReaction
+ /// \~english @par Summary
+ /// CFrameworkunifiedReaction destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// CFrameworkunifiedReaction destructor, for destory CFrameworkunifiedReaction object
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedReaction
+ /// Destructor
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedReaction() {}
+
+ // count to check the number of reference of this reaction in all the states of statemachine
+ UI_8 m_ucRefCount;
+};
+#endif // _FRAMEWORKUNIFIEDREACTION_H // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_shallowhistorystate.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_shallowhistorystate.h
new file mode 100755
index 0000000..945749d
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_shallowhistorystate.h
@@ -0,0 +1,163 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief
+///
+/// This file has the declaration of class CFrameworkunifiedShallowHistoryState . CFrameworkunifiedShallowHistoryState is
+/// derived from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported
+/// by HSM Shallow History state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_shallowhistorystate.h
+ * @brief \~english This file has the declaration of class CFrameworkunifiedShallowHistoryState . CFrameworkunifiedShallowHistoryState is
+ * derived from CFrameworkunifiedHistoryState class.This class implements the additional functionality supported
+ * by HSM Shallow History state.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_SM_SHALLOWHISTORYSTATE_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_SM_SHALLOWHISTORYSTATE_H__
+
+#include <native_service/frameworkunified_sm_historystate.h>
+#include <string>
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the additional functionality supported by HSM Shallow History state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedShallowHistoryState : public CFrameworkunifiedHistoryState {
+ public :
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedShallowHistoryState
+ /// \~english @par Brief
+ /// CFrameworkunifiedShallowHistoryState constructor
+ /// \~english @param [in] f_pName
+ /// std::string - Name of the state
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This class inherits from CFrameworkunifiedHistoryState class and creates CFrameworkunifiedShallowHistoryState object. \n
+ /// In this function, we set member variable m_uiEventId to ShallowHistoryID(71), \n
+ /// and set member variable m_cEventName to evShallowHistory"evShallowHistory".
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see ~CFrameworkunifiedShallowHistoryState
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedShallowHistoryState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ CFrameworkunifiedShallowHistoryState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedShallowHistoryState
+ /// \~english @par Brief
+ /// CFrameworkunifiedShallowHistoryState destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Destory CFrameworkunifiedShallowHistoryState object.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedShallowHistoryState::CFrameworkunifiedShallowHistoryState
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedShallowHistoryState
+ /// Class destructor
+ ///
+ /// \return none
+ ~CFrameworkunifiedShallowHistoryState();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedShallowHistoryState
+ /// \~english @par Brief
+ /// update history infomation
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK update history infomation success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when update history infomation
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// m_pParentState is NULL
+ /// \~english @par Detail
+ /// update last active state, failed if m_pParentState is NULL
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateHistory
+ /// This function stores the last active state
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UpdateHistory();
+
+ private:
+ static const UI_32 m_suievShallowHistory;
+};
+
+#endif /* __FRAMEWORKUNIFIED_SM_SHALLOWHISTORYSTATE_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_state.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_state.h
new file mode 100755
index 0000000..438e2e5
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_state.h
@@ -0,0 +1,872 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedState class definitions. CFrameworkunifiedState is base class for all types of
+/// state classes.This class implements the basic functionality required for HSM state.
+/// It provides the standard interfaces for entering, exiting and reacting in a state.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_state.h
+ * @brief \~english This file has the CFrameworkunifiedState class definitions. CFrameworkunifiedState is base class for all types of
+ * state classes.This class implements the basic functionality required for HSM state.
+ * It provides the standard interfaces for entering, exiting and reacting in a state.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_STATE_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_STATE_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_reaction.h>
+#include <string>
+#include <map>
+#include <exception>
+#include <vector>
+
+class CFrameworkunifiedReaction;
+class CFrameworkunifiedHSM;
+
+/// defines the map of event reactions
+typedef std::map<UI_32, CFrameworkunifiedReaction *> EventReactionList;
+
+typedef std::vector<UI_32> DeferredEventList;
+
+/// defines the map of event names
+typedef std::map<UI_32, std::string> EventNameList;
+
+/// defines the iterator for event reaction map
+typedef std::map<UI_32, CFrameworkunifiedReaction *>::iterator EventReactionIterator;;
+
+typedef std::vector<CEventDataPtr> EventInfoList;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class implements the basic functionality required for HSM state. It provides the standard
+/// interfaces for entering, exiting and reacting in a state.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedState {
+ public :
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// CFrameworkunifiedState constructor
+ /// \~english @param [in] f_pName
+ /// std::string - Name of the state
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This clase is a base class of state machine. \n
+ /// It creates object of CFrameworkunifiedState class, and initializes the member variable with state name specified by
+ /// argument(f_pName). \n
+ /// It creates the following event lists, and saves them as member variables. About the other member variables,
+ /// it initialzes them with NULL. \n
+ /// If error occurs, output the error log. \n
+ /// - list of events associated with the state(used for managing state of eace event)
+ /// - list of deferred events associated with the state(used for managing state of deferred event)
+ /// - list of deferred events posted in the state(used for posting list of deferred events)
+ /// - list of event names(used for managing event names)
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see ~CFrameworkunifiedState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CFrameworkunifiedState
+ /// Parameterized constructor
+ /// \param [in] f_pName
+ /// string - Name of the state
+ ///
+ /// \return none
+ CFrameworkunifiedState(std::string f_pName); // NOLINT (readability/nolint)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// CFrameworkunifiedState destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This class destroys object of CFrameworkunifiedState class.\n
+ /// It destroys the following event list. If error occurs, output the error log.
+ /// - list of events associated with the state
+ /// - list of deferred events associated with the state
+ /// - list of deferred events posted in the state
+ /// - list of event names
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFrameworkunifiedState
+ /// Class destructor
+ ///
+ /// \return none
+ virtual ~CFrameworkunifiedState();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// add event information
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - event ID
+ /// \~english @param [in] f_pReaction
+ /// CFrameworkunifiedReaction *f_pReaction - event reaction
+ /// \~english @param [in] f_strEventName
+ /// std::string f_strEventName - event name
+ /// \~english @retval eFrameworkunifiedStatusOK add event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when add event
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// given param is NULL
+ /// \~english @par Detail
+ /// add event information to event list, failed if given param is NULL
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedAddEvent
+ /// Associates the event id with the reaction in the state. When the event is posted to the
+ /// state the associated reaction is executed. This also adds the event name to the map
+ /// which is used for debugging.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id of the event to be added in the state
+ ///
+ /// \param [in] f_pReaction
+ /// CFrameworkunifiedReaction* - Reaction to be associated with the with event id in the state
+ ///
+ /// \param [in] f_strEventName
+ /// string - Name of the event (used for debugging purpose only)
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedAddEvent(UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction, std::string f_strEventName = "");
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This function processes the event.
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to event data class
+ /// \~english @retval CFrameworkunifiedState* Pointer to current CFrameworkunifiedState object after processing event
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to call constructor to create object. [this(current CFrameworkunifiedState object]
+ /// - Pointer to event data class is NULL. [NULL]
+ /// \~english @par Detail
+ /// This function processes the event. If the reaction for event is available in the current
+ /// state within eventlist and deferred eventlist then it is consumed in the current state
+ /// otherwise forwarded to the parent state. Event forwarding is done recursively till either
+ /// event is consumed or the root state has encountered. This also process the events posted
+ /// in the reactions recursively till all posted events are cleared.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CEventData, FrameworkunifiedIsReactionAvailable
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEvent
+ /// This function processes the event. If the reaction for event is available in the current
+ /// state within eventlist and deferred eventlist then it is consumed in the current state
+ /// otherwise forwarded to the parent state. Event forwarding is done recursively till either
+ /// event is consumed or the root state has encountered. This also process the events posted
+ /// in the reactions recursively till all posted events are cleared.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ ///
+ /// \return state
+ /// CFrameworkunifiedState* - Returns current state after the event is processed
+ ///
+ virtual CFrameworkunifiedState *FrameworkunifiedOnEvent(CEventDataPtr f_pEventData);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// add deferred event information
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - event ID
+ /// \~english @param [in] f_strEventName
+ /// std::string f_strEventName - event name
+ /// \~english @retval eFrameworkunifiedStatusOK add deferred event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when add deferred event
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// given param is NULL
+ /// \~english @par Detail
+ /// add deferred event information to event list , failed if given param is NULL
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedAddDeferredEvent
+ /// Associates the deferred event id with the reaction in the state. When the event is posted
+ /// to the state the event is deferred and stored in the state. In case of implicit recall
+ /// of the deferred events, events are processed before exiting the state. The deferred
+ /// events can also be recalled explicitly in the state This also adds the event name
+ /// to the map which is used for debugging.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id of the event to be added in the state
+ ///
+ /// \param [in] f_strEventName
+ /// string - Name of the event (used for debugging purpose only)
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedAddDeferredEvent(UI_32 f_uiEventId, std::string f_strEventName = "");
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This function creates new eventdata object and add it to event queue of the state machine.
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - event ID
+ /// \~english @retval eFrameworkunifiedStatusOK post event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when post event
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - State machine of application is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Failed to create object of eventdata. [eFrameworkunifiedStatusNullPointer]
+ /// - Pointer to event list in which to add eventdata in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Pointer to active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Name of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This function creates new eventdata object and add it to event queue of the state machine.\n
+ /// The events are posted in the reaction which are executed in the state.
+ /// The event queue is processed once the execution of the reaction is completed.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedPostEvent(CEventDataPtr), CEventData, CFrameworkunifiedHSM::FrameworkunifiedQueueEvent, CFrameworkunifiedHSM::ProcessEvent
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPostEvent
+ /// This function creates new eventdata object and add the to event queue of the state.
+ /// The events are posted in the reaction which are executed in the state.
+ /// The event queue is processed once the execution of the reaction is completed.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event Id
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedPostEvent(UI_32 f_uiEventId);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This function adds event data to event queue of the state machine.
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to event data class
+ /// \~english @retval eFrameworkunifiedStatusOK post event success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when post event
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - State machine of application is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Pointer to event data class specified by argument(f_pEventData) is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Pointer to event list in which to add eventdata in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Pointer to active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Name of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This function adds event data to event queue of the state machine. The events are posted in the reaction
+ /// which are executed in the state. The event queue is processed once the execution of the
+ /// reaction is completed.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CEventData, FrameworkunifiedIsReactionAvailable, CFrameworkunifiedHSM::FrameworkunifiedQueueEvent, CFrameworkunifiedHSM::ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPostEvent
+ /// This function adds the event queue of the state. The events are posted in the reaction
+ /// which are executed in the state. The event queue is processed once the execution of the
+ /// reaction is completed.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ EFrameworkunifiedStatus FrameworkunifiedPostEvent(CEventDataPtr f_pEventData);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// delete event from deferred event list
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 f_uiEventId - event ID
+ /// \~english @retval eFrameworkunifiedStatusOK delete deferred event success
+ /// \~english @retval eFrameworkunifiedStatusInvldID invalid event ID
+ /// \~english @retval eFrameworkunifiedStatusNullPointer exception occur when delete deferred event
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// delete event from deferred event list by event ID
+ /// failed if event id is not exist. exception occur if given param is NULL
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedRemoveEventFromDeferredEventList
+ /// This function removes the event from the posted deferred queue list of the state.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event id
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if event removed
+ /// eFrameworkunifiedStatusInvldID if event not found in list
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FrameworkunifiedRemoveEventFromDeferredEventList(UI_32 f_uiEventId);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This function indicates if the state has sub states.
+ /// \~english @param None
+ /// \~english @retval BOOL if the state has sub states
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function indicates if the state has sub states. It returns TRUE only in the CompositeState
+ /// where this function is overridden
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedCompositeState::FrameworkunifiedHasSubStates
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedHasSubStates
+ /// This indicates if the state has sub states. It returns TRUE only in the CompositeState
+ /// where this function is overridden
+ ///
+ /// \return TRUE/FASLE
+ /// BOOL - returns TRUE if it has sub states otherwise returns false.
+ virtual BOOL FrameworkunifiedHasSubStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This function indicates if the state has sub states.
+ /// \~english @param None
+ /// \~english @retval BOOL if the state has sub states
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function indicates if the state has sub states. It returns TRUE only in the OrthogonalState
+ /// where this function is overridden
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedOrthogonalState
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedHasOrthogoanlRegions
+ /// This indicates if the state has sub states. It returns TRUE only in the OrthogonalState
+ /// where this function is overridden
+ ///
+ /// \return TRUE/FASLE
+ /// BOOL - returns TRUE if it has sub states otherwise returns false.
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual BOOL FrameworkunifiedHasOrthogoanlRegions();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This logs the state name and event name associated with the state
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer exception
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to call constructor to create object. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This logs the state name and event name associated with the state. \n
+ /// It outputs the following logs:
+ /// - state name of parent state machine and self state machine
+ /// - all event names in event list
+ /// - all event names in deferred event list
+ /// CFrameworkunifiedCompositeState and CFrameworkunifiedOrthogonalState class overrides this function
+ /// and use it.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPrintStates
+ /// This logs the state name and events associated with the state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedPrintStates();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// Initialize state.
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to event data class
+ /// \~english @retval CFrameworkunifiedState* Pointer to current CFrameworkunifiedState object after processing event
+ /// \~english @retval NULL error occurs in internal process
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to call function(FrameworkunifiedOnEntry) recursively. [NULL]
+ /// \~english @par Detail
+ /// This function is called recursively till the leaf state is reached. This internally
+ /// calls the Entry function of the current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CEventData, FrameworkunifiedOnEntry, FrameworkunifiedOnHSMStop
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStart
+ /// This function is called recursively till the leaf state is reached. This internally
+ /// calls the Entry function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStart(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// Clearup state.
+ /// \~english @param [in] f_pEventData
+ /// CEventDataPtr - Pointer to event data class
+ /// \~english @retval CFrameworkunifiedState* Pointer to current CFrameworkunifiedState object after processing event
+ /// \~english @retval NULL error occurs in internal process
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to call constructor to create object. [NULL]
+ /// - Pointer to list of deferred events posted in the state is NULL. [NULL]
+ /// - Pointer to event data getted from list of deferred events posted in the state is NULL. [NULL]
+ /// - Event name of event data getted from list of deferred events posted in the state is NULL. [NULL]
+ /// \~english @par Detail
+ /// This function is called recursively till the required parent state is reached. This
+ /// internally calls the Exit function of the current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CEventData, FrameworkunifiedOnExit, FrameworkunifiedOnHSMStart
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnHSMStop
+ /// This function is called recursively till the required parent state is reached. This
+ /// internally calls the Exit function of the current state.
+ ///
+ /// \param [in] f_pEventData
+ /// CECEventDataPtr Event data
+ /// \return CurrentState
+ /// CFrameworkunifiedState* - Returns current state after operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedOnHSMStop(CEventDataPtr f_pEventData);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// Check the availability of event.
+ /// \~english @param [in] f_uiEventId
+ /// UI_32 - event ID
+ /// \~english @retval TRUE reaction is available for this event
+ /// \~english @retval FALSE reaction is not available for this event
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// If the event specified by argument(f_uiEventId) is in event list,
+ /// the reaction is available for this event, return TRUE.
+ /// If the event specified by argument(f_uiEventId) is in deferred event list
+ /// but not in event list, the reaction is available for this event, return TRUE.
+ /// Otherwise, the event specified by argument(f_uiEventId) isn't available, return FALSE.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see FrameworkunifiedPostEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedIsReactionAvailable
+ ///
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event identifier
+ ///
+ /// \return TRUE/FASLE
+ /// BOOL - returns TRUE if it reaction is available for this event
+ virtual BOOL FrameworkunifiedIsReactionAvailable(UI_32 f_uiEventId);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param None
+ /// \~english @retval CFrameworkunifiedState* depend on implement class
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedGetActiveState
+ /// This interface returns the Active state of the current composite state. In case of
+ /// non-composite state current state is active state
+ ///
+ /// \return Active state
+ /// CFrameworkunifiedState* - Active state
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedGetActiveState() = 0;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// This Interface associates the gives statemachine with the current state
+ /// \~english @param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Statemachine associated with the state.
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer exception
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Pointer to state machine(CFrameworkunifiedHSM class) specified by argument(f_pStatemachine) is NULL.
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// This Interface sets state machine of member variable to state machine specified by argument,
+ /// so it can associate the giving statemachine with current state.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedHSM
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedSetHSM
+ /// This Interface associates the gives statemachine with the current state
+ ///
+ /// \param [in] f_pStatemachine
+ /// CFrameworkunifiedHSM* - Statemachine associated with the state.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ virtual EFrameworkunifiedStatus FrameworkunifiedSetHSM(CFrameworkunifiedHSM *f_pStatemachine);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// Get application handle.
+ /// \~english @param None
+ /// \~english @retval HANDLE application handle
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to get application handle. [NULL]
+ /// \~english @par Detail
+ /// This interface gets and returns the application handle with following steps:
+ /// - If member variable used for state machine of application is not setted, return NULL.
+ /// - Get application handle from state machine of application.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CFrameworkunifiedHSM::FrameworkunifiedGetAppHandle
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedGetAppHandle
+ /// This interface returns the application handle
+ ///
+ /// \return HANDLE
+ /// HANDLE - Application Handle
+ ///
+ virtual HANDLE FrameworkunifiedGetAppHandle();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Brief
+ /// Update the State information in the given stream in the form of XML tags
+ /// \~english @param [out] f_strXMLString
+ /// std::ostringstream & - reference to the XML stream
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer exception
+ /// \~english @par Prerequisite
+ /// - Calls constructor to successfully create object.
+ /// - State machine of current state in the applicaton is setted in FrameworkunifiedSetHSM.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Failed to call constructor to create object. [eFrameworkunifiedStatusNullPointer]
+ /// \~english @par Detail
+ /// Update the following State information in the given stream in the form of XML tags
+ /// - state name
+ /// - all event information in event list(eventID, event name)
+ /// - all event information in deferred event list(eventID, event name)
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CEventData, FrameworkunifiedIsReactionAvailable, CFrameworkunifiedHSM::FrameworkunifiedQueueEvent, CFrameworkunifiedHSM::ProcessEvent
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedPrintXML
+ /// Update the State information in the given stream in the form of XML tags
+ ///
+ /// \param [in] f_strXMLString
+ /// std::ostringstream & - reference to the XML stream
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ virtual EFrameworkunifiedStatus FrameworkunifiedPrintXML(std::ostringstream &f_strXMLString);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedState
+ /// \~english @par Summary
+ /// pure virtual fuction
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// pure virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateHistory
+ /// This function stores the last active state
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus UpdateHistory() = 0;
+
+ protected :
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnEntry
+ /// This is pure virtual function implemented by the derived classes of the application.
+ /// state initialization can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_pEventData) = 0;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedOnExit
+ /// This is pure virtual function implemented by the derived classes of the application.
+ /// state cleanup can be performed in this function.
+ ///
+ /// \param [in] f_pEventData
+ /// CEventDataPtr - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_pEventData) = 0;
+
+ private:
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// IsEventDeferred
+ /// This checks if the given event is marked as deferred in the state.
+ ///
+ /// \param [in] f_uiEventId
+ /// UI_32 - Event identifier
+ ///
+ /// \return BOOL
+ /// BOOL - event deferred or not
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsEventDeferred(UI_32 f_uiEventId);
+
+ public:
+ /// state name
+ std::string m_strStateName;
+
+ /// Pointer to the parent state
+ CFrameworkunifiedState *m_pParentState;
+
+ /// pointer to the default state
+ CFrameworkunifiedState *m_pDefaultState;
+
+ /// pointer to the active state
+ CFrameworkunifiedState *m_pActiveState;
+
+ /// pointer to the map that stores the event name against event id
+ EventNameList *m_pEventName;
+
+ protected :
+ /// pointer to the map that stores the reaction against event id
+ EventReactionList *m_pEventList;
+
+ /// pointer to the map that stores deferred event ids
+ DeferredEventList *m_pDeferredEventList;
+
+ /// pointer to the vector that stores the eventinfo of the posted deferred event
+ EventInfoList *m_pDeferredPostEventList;
+
+ /// pointer to the application statemachine
+ CFrameworkunifiedHSM *m_pStateMachine;
+};
+
+#endif // __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_STATE_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_transition.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_transition.h
new file mode 100755
index 0000000..232c91e
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_sm_transition.h
@@ -0,0 +1,150 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_StateMachine
+/// \brief
+///
+/// This file has the CFrameworkunifiedTransition class definitions.This class provides the
+/// interface for reacting local transition and external transition
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_sm_transition.h
+ * @brief \~english This file has the CFrameworkunifiedTransition class definitions.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+/** @addtogroup statemachine
+ * @ingroup framework
+ * @{
+ */
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_TRANSITION_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_TRANSITION_H__
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_sm_reaction.h>
+
+class CFrameworkunifiedState;
+class CFrameworkunifiedEventData;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class provides the interface for reacting local transition and external transition
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedTransition : public CFrameworkunifiedReaction {
+ public :
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedTransition
+ /// \~english @par Summary
+ /// CFrameworkunifiedTransition constructor
+ /// \~english @param [in] f_pTargetState
+ /// CFrameworkunifiedState *f_pTargetState - set m_pTargetState value
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - m_pTargetState = f_pTargetState
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// CFrameworkunifiedTransition constructor, for create CFrameworkunifiedTransition object
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedTransition(CFrameworkunifiedState *f_pTargetState); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedTransition
+ /// \~english @par Summary
+ /// CFrameworkunifiedTransition destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// CFrameworkunifiedTransition destructor, for destroy CFrameworkunifiedTransition object
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedTransition();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedTransition
+ /// \~english @par Summary
+ /// virtual fuction
+ /// \~english @param [in] f_pSourceState
+ /// CFrameworkunifiedState *f_pSourceState - source state
+ /// \~english @param [in] f_pData
+ /// CEventDataPtr f_pData - event data
+ /// \~english @retval CFrameworkunifiedState* depend on implement class
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// virtual function , implement by child class
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual CFrameworkunifiedState *FrameworkunifiedReaction(CFrameworkunifiedState *f_pSourceState, CEventDataPtr f_pData) = 0;
+
+ protected :
+
+ /// Pointer to the target state of transition
+ CFrameworkunifiedState *m_pTargetState;
+};
+
+#endif // __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_TRANSITION_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_thread_priority.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_thread_priority.h
new file mode 100755
index 0000000..2af26a3
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_thread_priority.h
@@ -0,0 +1,235 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief The file provide CFrameworkunifiedThreadPriorities class.
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_thread_priority.h
+ * @brief \~english The file contains declaration of CFrameworkunifiedThreadPriorities class
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef FRAMEWORKUNIFIED_THREAD_PRIORITY_H_ // NOLINT (build/header_guard)
+#define FRAMEWORKUNIFIED_THREAD_PRIORITY_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <map>
+
+#define FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND -1 ///< \~english if specified thread name not found
+
+namespace frameworkunified {
+namespace framework {
+class args {
+ public:
+ enum {
+ name,
+ priority
+ };
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// This class parses and stores thread priorities
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class CFrameworkunifiedThreadPriorities {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Brief
+ /// CFrameworkunifiedThreadPriorities constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedThreadPriorities constructor, for create CFrameworkunifiedThreadPriorities
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedThreadPriorities();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Brief
+ /// CFrameworkunifiedThreadPriorities destructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// None
+ /// \~english @par Change of internal state
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// CFrameworkunifiedThreadPriorities destructor, for destory CFrameworkunifiedThreadPriorities
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ ///
+ /////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedThreadPriorities();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Brief
+ /// Get the priority of the thread. Priority of the thread was added by \ref AddPriority(),
+ /// when parsing command line arguments.
+ /// \~english @param [in] f_cThreadName
+ /// const std::string& - Name of thread
+ /// \~english @retval SI_32 Returns the priority of a thread.
+ /// \~english @retval FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND if specified thread name not found
+ /// \~english @par
+ /// FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND
+ /// \~english @code
+ /// #define FRAMEWORKUNIFIED_PRIORITY_NOT_FOUND -1 // if specified thread name not found
+ /// @endcode
+ /// \~english @par Prerequisite
+ /// - Call AddPriority() and set priority.
+ /// \~english @par Change of internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - Thread name is not registered in AddPriority()
+ /// \~english @par Detail
+ /// Get the priority of the thread. Priority of the thread was added by \ref AddPriority(),
+ /// when parsing command line arguments.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see
+ /// AddPriority
+ /////////////////////////////////////////////////////////////////////////////////////
+ static SI_32 GetPriority(const std::string &f_cThreadName);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Summary
+ /// set thread Priority
+ /// \~english @param [in] f_cThreadName
+ /// const std::string &f_cThreadName - thread name
+ /// \~english @param [in] f_si32Priority
+ /// SI_32 f_si32Priority - Priority
+ /// \~english @retval eFrameworkunifiedStatusOK set Priority success
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Change of the internal state
+ /// - ms_mapThreadPritories[f_cThreadName] = f_si32Priority
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// set thread Priority through thread name
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus AddPriority(const std::string &f_cThreadName, SI_32 f_si32Priority);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Summary
+ /// print thread Priority
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// read each thread and print it's Priority
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+ static VOID PrintPriorites();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CFrameworkunifiedThreadPriorities
+ /// \~english @par Summary
+ /// analyse thread param
+ /// \~english @param [in] f_cArgumentValue
+ /// PCHAR f_cArgumentValue - thread param string
+ /// \~english @retval eFrameworkunifiedStatusOK parse thread param success
+ /// \~english @retval eFrameworkunifiedStatusFail parse thread param failed
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - f_cArgumentValue == NULL
+ /// - f_cArgumentValue is invalid
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// analyse thread param data, and set param to thread.
+ /// if given data is NULL or invalid , return false
+ /// \~english @see getsubopt, AddPriority
+ ////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus ParseThreadArguments(PCHAR f_cArgumentValue);
+
+ private:
+ typedef std::map<std::string, SI_32> TThreadPriorityList;
+ typedef TThreadPriorityList::iterator ThreadPrioMapIter;
+ static TThreadPriorityList ms_mapThreadPritories; // map of thread name and priority
+};
+
+} // namespace framework
+}; // namespace frameworkunified
+
+#endif /* FRAMEWORKUNIFIED_THREAD_PRIORITY_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_timer.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_timer.h
new file mode 100755
index 0000000..7a3c762
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_timer.h
@@ -0,0 +1,143 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+/// \brief Application framework's core structures and data types.
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file frameworkunified_timer.h
+ * @brief \~english Application framework's core structures and data types.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NSFRAMEWORK_NFRAMEWORKCORE_FRAMEWORKUNIFIEDTIMER__ // NOLINT (build/header_guard)
+#define __NSFRAMEWORK_NFRAMEWORKCORE_FRAMEWORKUNIFIEDTIMER__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedAttachTimerCallback
+/// \~english @par Brief
+/// Attach a callback to hApp dispatcher that will get called initially at initNS nanoseconds,
+/// and then repeatedly at repeatNS nanoseconds
+/// \~english @param[in] hApp
+/// HANDLE - hApp parent framework HANDLE
+/// \~english @param[in] initMS
+/// UI_32 - milliseconds to begin triggering callback(0 to 4294967295)
+/// \~english @param[in] repeatMS
+/// UI_32 - milliseconds between repeated triggerings of callback(0 to 4294967295)
+/// \~english @param[in] CbFn
+/// CbFuncPtr - Callback to be triggered
+/// \~english @retval Handle to the timer object or NULL on failure
+/// \~english @par Preconditons
+/// - hApp has already gotten the dispatcher(return NULL)
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - hApp is not application HNADLE(return NULL)
+/// - eFrameworkunifiedStatusFail if the hApp specified in the arguments is not appropriate (not valid) [NULL]
+/// - CbFn is NULL(return NULL))
+/// - If the send message queue handle specified in the argument (hApp) to itself is NULL [NULL]
+/// - Failed to create epoll instances (epoll_create1/eventfd) for timer event monitoring [NULL]
+/// - Failed to create a timer event monitor thread (pthread_create) [NULL]
+/// - When acquisition (malloc) of the timer-management-information area fails [NULL]
+/// - If the send message queue type to the handle (hApp) specified in the parameter is neither send nor receive, [NULL]
+/// - Failed to generate timers (timerfd_create) [NULL]
+/// - Failed to register file descriptors for timer notification to epoll instances (epoll_ctl) [NULL]
+/// - Failed to start/stop timer (timerfd_settime) [NULL]
+/// \~english @par Detail
+/// After registering the callback functions for timer events in the Dispatcher specified by the hApp arguments,
+/// it creates and starts a timer and returns its handles.\n
+/// Dispatcher executes callback functions when the timers generated by the APIs fire.\n
+/// The application shall use this API when there is a process to be executed once or repeatedly in response to a specified time elapsed.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - If the application specifies a initMS of 0, a timer is created and handles are returned, but the callback is not executed because the timer is stopped.
+/// - If the application specifies a repeatMS of zero, the callback is executed only once.
+/// - Since the timer handle is a FrameworkunifiedAttachTimerCallback return value, the callback cannot be set twice with the same timer handle.
+/// - If multiple calls are made with the same application handle, the second and subsequent callbacks are not set,
+/// and the first registered callback function is started at the last registered timer interval.
+/// - Create a thread for sending messages, but do not make dynamic calls because the thread is not destroyed even if FrameworkunifiedDetachTimerCallback is executed.
+/// \~english @par Classification
+/// \~english @par Type
+/// Open Close
+/// \~english @see FrameworkunifiedDetachTimerCallback
+/// \~english @todo needs to clarify this API require initMS except 0
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE FrameworkunifiedAttachTimerCallback(HANDLE hApp, UI_32 initMS, UI_32 repeatMS, CbFuncPtr CbFn);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup FrameworkunifiedDetachTimerCallback
+/// \~english @par Brief
+/// Detach callback and deallocate a timer previous created with FrameworkunifiedAttachTimerCallback
+/// \~english @param[in] hApp
+/// HANDLE - hApp parent framework HANDLE
+/// \~english @param[in] hTimer
+/// HANDLE - timer HANDLE
+/// \~english @retval HANDLE HANDLE used to communicate with child. NULL...failure, otherwize...success
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusFail(not happened)
+/// \~english @retval eFrameworkunifiedStatusInvldParam
+/// \~englsih @par Preconditions
+/// - Timer is dispatched for hApp Callback
+/// \~englsih @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - hApp is not application HNADLE(eFrameworkunifiedStatusInvldParam)
+/// - eFrameworkunifiedStatusFail if the hApp specified in the arguments is not appropriate (not valid) [eFrameworkunifiedStatusInvldParam]
+/// - hTimer is NULL(eFrameworkunifiedStatusInvldParam)
+/// - When the timer has been stopped by the timer administrative info of the timer handle specified by the arguments, [eFrameworkunifiedStatusFail]
+/// - When the timer administrative information of the timer handle specified by the arguments is NULL, [eFrameworkunifiedStatusFail]
+/// - Failed to stop the timer (timerfd_settime) [eFrameworkunifiedStatusFail]
+/// - If a callback for the timer event is not registered in the Dispatcher specified by the hApp, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Stops the timer (hTimer) specified by the argument and registrations the callback functions
+/// for timer events from the Dispacther specified by the argument hApp.
+/// \~english @par
+/// Please note the following points when using this API for application.\n
+/// - Operation is not guaranteed if a different handle is set for the timer handle.
+/// - If a normal timer handle and an invalid application handle are set, only the timer information is deleted, resulting in an inconsistent state.
+/// \~english @par Classification
+/// \~english @par Type
+/// Open Close
+/// \~english @see FrameworkunifiedAttachTimerCallback
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedDetachTimerCallback(HANDLE hApp, HANDLE hTimer);
+
+#endif // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_types.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_types.h
new file mode 100755
index 0000000..faaf3aa
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/frameworkunified_types.h
@@ -0,0 +1,268 @@
+/*
+ *
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file frameworkunified_types.h
+ * @brief \~english This file contains basic define,enum and struct of framework_unified.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef FRAMEWORKUNIFIED_TYPES_H_ // NOLINT (build/header_guard)
+#define FRAMEWORKUNIFIED_TYPES_H_
+
+#include <stdint.h>
+
+#define DEFINE_HANDLE_TYPE(struct_type, handle_type) typedef struct struct_type* handle_type;
+
+#define MIN_VAL(a, b) ((a) < (b)? (a) : (b))
+
+#ifndef NULL
+#define NULL 0
+#endif
+#ifndef VOID
+typedef void VOID;
+#endif
+#ifndef CONST
+#define CONST const
+#endif
+
+/// Lengths and Max Sizes
+#define INVALID_HANDLE NULL
+#define MAX_QUEUE_MSG_SIZE 4096
+// #define MAX_QUEUE_NAME_SIZE 24
+#define MAX_QUEUE_NAME_SIZE 20
+#define LIMIT_QUEUE_NAME_SIZE 16
+#define MAX_SYS_INFO_SIZE 64
+
+#define MAX_NAME_SIZE_APP MAX_QUEUE_NAME_SIZE ///< Maximum name size of the APP (Client/Service)
+#define LIMIT_NAME_SIZE_APP LIMIT_QUEUE_NAME_SIZE ///< Limit name size of the APP (Client/Service)
+#define MAX_NAME_SIZE_NOTIFICATION 24 ///< Maximum name size of the Notification
+#define MAX_STRING_SIZE_NOTIFICATION 64
+
+#define MAX_STRING_SIZE_TAG 64
+#define MAX_PATH_LENGTH 255
+
+
+#define NS_SHM_ERROR -1
+
+// Types
+typedef int8_t SI_8;
+typedef uint8_t UI_8;
+typedef int16_t SI_16;
+typedef uint16_t UI_16;
+typedef int32_t SI_32;
+typedef uint32_t UI_32;
+typedef int64_t SI_64;
+typedef uint64_t UI_64;
+typedef float F_32;
+typedef double F_64;
+// use it defined kernelmoduleevklibdd.h typedef UI_32 BOOL;
+#define PFALSE ((BOOL)0)
+#define PTRUE ((BOOL)1)
+
+#ifndef FALSE
+#define FALSE PFALSE
+#endif
+#ifndef TRUE
+#define TRUE PTRUE
+#endif
+
+// Pointer Types
+typedef BOOL *PBOOL;
+typedef SI_8 *PSI_8;
+typedef UI_8 *PUI_8;
+typedef SI_16 *PSI_16;
+typedef UI_16 *PUI_16;
+typedef UI_32 *PUI_32;
+typedef SI_32 *PSI_32;
+typedef UI_64 *PUI_64;
+typedef SI_64 *PSI_64;
+typedef F_32 *PF_32;
+typedef void *PVOID;
+typedef CONST void *PCVOID;
+
+typedef char CHAR, *PCHAR;
+typedef CONST char *PCSTR;
+typedef char *PSTR;
+
+typedef UI_8 _TUCHAR;
+typedef SI_32 HFILE;
+typedef PVOID HANDLE;
+typedef HANDLE *PHANDLE;
+typedef CHAR TSysMsgSystemInfo[MAX_SYS_INFO_SIZE]; ///< Information passed via the framework
+
+
+/// CR carry over types...
+/// \brief Types that have been carried
+/// over from Color Radio header file WPFAPI_types.h.
+typedef UI_16 MID;
+typedef UI_16 FRAMEWORKUNIFIED_CID;
+typedef UI_8 RID;
+typedef UI_16 PNO;
+typedef UI_8 BYTE;
+
+#define LOWORD(l) ((WORD)(l))
+#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
+#define _countof(array) (sizeof(array)/sizeof(array[0]))
+
+/// \typedef EFrameworkunifiedStatus
+/// \brief Status and return types
+typedef enum eFrameworkunifiedStatus {
+ eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+ eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+ eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+ eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+ eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+ eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+ eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+ eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+ eFrameworkunifiedStatusFail = -2, ///< Failed
+ eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+ eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+ eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+ eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+ eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+ eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+ eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+ eFrameworkunifiedStatusInvldNotification = 6, ///< The Notification event not present
+ eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+ eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+ eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+ eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+ eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+ eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+ eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+ eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+ eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+ eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+ eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+ eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+ eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+ eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+ eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+ eFrameworkunifiedStatusNullPointer = 22,
+ eFrameworkunifiedStatusMsgNotProcessed = 23,
+ eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+ eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+ eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+ eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+ eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+ eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+ eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+ eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+ eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+ eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+ eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+ eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+} EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+
+/// \typedef EFrameworkunifiedNotificationType
+/// \brief Notification types
+typedef enum _EFrameworkunifiedNotificationType {
+ eFrameworkunifiedNotificationVar = 0, ///< Non Persistent. Not stored locally by NPS
+ eFrameworkunifiedStateVar, ///< Non Persistent. stored locally by NPS
+ eFrameworkunifiedPersistedStateVar, ///< Persistent. Also stored locally by NPS
+ eFrameworkunifiedPersistedStateUserVar, ///< User specific Persistent. Also stored locally by NPS
+ eFrameworkunifiedImmediatePersistedStateVar, ///< Not to be used. See \ref FrameworkunifiedNPRegisterImmediatePersistNotification
+ eFrameworkunifiedUnknown ///< This is not a type of notification and should not be used while
+ ///< defining any notification.
+} EFrameworkunifiedNotificationType;
+
+/// \typedef ENS_ApplicationState
+/// \brief Application States that all module must handle
+/// this should be handle by Publishing a "ModuleName/State"
+/// with the parameter being one of these state values.
+typedef enum _EApplicationStates {
+ eAppInital = 0, ///< Initial: state value
+ eAppIdle, ///< Idle: application shouldn't be processing anything
+ eAppReady, ///< Ready: application is ready to do work
+ eAppConnecting, ///< Connecting: Service is connecting
+ eAppDisconnecting ///< Disconnecting: Service is disconnecting
+} EApplicationStates;
+
+
+typedef enum _EFrameworkunifiedMessagePriorties {
+ eFrameworkunifiedMsgPrioVeryLow = 1,
+ eFrameworkunifiedMsgPrioLow = 8,
+ eFrameworkunifiedMsgPrioNormal = 16,
+ eFrameworkunifiedMsgPrioEmergency = 30,
+} EFrameworkunifiedMessagePriorties;
+
+// defines what data to delete from persistent memory
+typedef enum _EFrameworkunifiedClearPersistence {
+ eFrameworkunifiedClearAllData = 0, ///< clears all the data in persistence memory for all users
+ ///< (currently only this enum value is supported.)
+ eFrameworkunifiedClearAllApplicationData, ///< clears all the data(files, folders) related to all application for all users
+ eFrameworkunifiedClearAllNotificationData, ///< clears all the notification data related to all application for all users
+ eFrameworkunifiedClearCurrentUserData, ///< clears all the data in persistence memory for current users
+ eFrameworkunifiedClearCurrentUserApplicationData, ///< clears all the data(files, folders)
+ ///< related to all application for current users
+ eFrameworkunifiedClearCurrentUserNotificationData ///< clears all the notification data
+ ///< related to all application for current users
+} EFrameworkunifiedClearPersistence;
+
+/// Enum defining category of persistent data
+typedef enum _EFrameworkunifiedPersistCategory {
+ eFrameworkunifiedUserData = 0x0001,
+ eFrameworkunifiedFactoryData = 0x0010,
+ eFrameworkunifiedFactoryCustomerData = 0x0100,
+ eFrameworkunifiedDealerData = 0x1000
+} EFrameworkunifiedPersistCategory;
+
+// defines the type of system error
+typedef enum _EFrameworkunifiedSystemError {
+ // TODO(framework_unified): add generic system errors
+ eFrameworkunifiedSystemErrorNone = 0,
+ eFrameworkunifiedDSPHardwareReset = 1 // system error is DSP hardware reset.
+ // It was commented, because this is product
+ // specific error. Must handle by SystemServices only.
+ // Uncommented per system services request.
+} EFrameworkunifiedSystemError;
+
+/// defines the shutdown types
+typedef enum _EFrameworkunifiedShutdownType {
+ eFrameworkunifiedNormalShutdown = 0,
+ eFrameworkunifiedQuickShutdown,
+ eFrameworkunifiedDataResetShutdown
+} EFrameworkunifiedShutdownType;
+
+/// defines the Release types
+typedef enum _EFrameworkunifiedReleaseType {
+ eFrameworkunifiedNotOnRelease = 0, ///< 0:not on release
+ eFrameworkunifiedPersistOnShutdown, ///< 1:persist on shutdown
+ eFrameworkunifiedPersistInstantly, ///< 2:persist instantly
+} EFrameworkunifiedReleaseType;
+
+#endif // FRAMEWORKUNIFIED_TYPES_H_ // NOLINT (build/header_guard))
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__common.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__common.h
new file mode 100755
index 0000000..e472b30
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__common.h
@@ -0,0 +1,129 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns__CWORD77__common.h
+ * @brief \~english This file has templet class declaration of CCallback and CResCallback
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _NS__CWORD77_COMMON_H_ // NOLINT (build/header_guard)
+#define _NS__CWORD77_COMMON_H_
+
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns__CWORD77__types.h>
+
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+#define MAX_DATA_SIZE 512;
+// using namespace std;
+
+
+// typedef string ServiceName;
+
+
+#define DELETEPTR(p) {if (p != NULL) {delete p; p = NULL;}}
+
+typedef EFrameworkunifiedStatus(*_CWORD77_FuncPtr)(HANDLE hApp, BOOL bTImerExpiry);
+typedef EFrameworkunifiedStatus(*ResponseServiceTo_CWORD77_)(HANDLE hApp, E_CWORD77_ResponseType ResponseType, std::string ServiceName);
+typedef boost::function< EFrameworkunifiedStatus(HANDLE, std::string, std::string, UI_32, EFrameworkunifiedStatus) > SessionAckTo_CWORD77_;
+
+// typedef EFrameworkunifiedStatus (*_CWORD77_TimeoutFuncPtr)(HANDLE hApp,UI_32 uiCmdId, E_CWORD77_MessageType MessageType);
+
+template <typename C, EFrameworkunifiedStatus(C::*M)(HANDLE)>
+class CCallback {
+ public:
+ static CallbackFunctionPtr set(void *pInst) {
+ if (pInst == NULL) {
+ throw;
+ }
+ if (ms_pInst != NULL) {
+ // TODO(framework_unified): FRAMEWORKUNIFIEDLOG some warning, preferably outside the template (i.e. use a global),
+ // to limit executable size, as this code will be replicated many times over
+ }
+ ms_pInst = pInst;
+ return &CCallback::call;
+ }
+ static EFrameworkunifiedStatus call(HANDLE y) {
+ if (ms_pInst == NULL) {
+ return eFrameworkunifiedStatusFault; // can't throw here
+ }
+ C *c = static_cast<C *>(ms_pInst);
+ return (c->*M)(y);
+ }
+ private:
+ static void *ms_pInst;
+};
+
+
+
+template <typename C, EFrameworkunifiedStatus(C::*M)(HANDLE)>
+void *CCallback<C, M>::ms_pInst = NULL;
+
+
+
+template <typename C, EFrameworkunifiedStatus(C::*M)(HANDLE, E_CWORD77_ResponseType, std::string)>
+class CResCallback {
+ public:
+ static ResponseServiceTo_CWORD77_ set(void *pInst) {
+ if (pInst == NULL) {
+ throw;
+ }
+ if (ms_pInst != NULL) {
+ // TODO(framework_unified): FRAMEWORKUNIFIEDLOG some warning, preferably outside the template (i.e. use a global),
+ // to limit executable size, as this code will be replicated many times over
+ }
+ ms_pInst = pInst;
+ return &CResCallback::call;
+ }
+ static EFrameworkunifiedStatus call(HANDLE y, E_CWORD77_ResponseType ResponseType, std::string ServiceName) {
+ if (ms_pInst == NULL) {
+ return eFrameworkunifiedStatusFault; // can't throw here
+ }
+ C *c = static_cast<C *>(ms_pInst);
+ return (c->*M)(y, ResponseType, ServiceName);
+ }
+ private:
+ static void *ms_pInst;
+};
+
+template <typename C, EFrameworkunifiedStatus(C::*M)(HANDLE, E_CWORD77_ResponseType, std::string)>
+void *CResCallback<C, M>::ms_pInst = NULL;
+
+
+#endif // _NS__CWORD77_COMMON_H_ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_if.h
new file mode 100755
index 0000000..0fab83b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_if.h
@@ -0,0 +1,183 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns__CWORD77__data_pool_if.h
+ * @brief \~english This file provides api to operating _CWORD77_DataPool
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+#ifndef _C_CWORD77_DATAPOOLIF_H_ // NOLINT (build/header_guard)
+#define _C_CWORD77_DATAPOOLIF_H_
+
+#include <native_service/ns__CWORD77__types.h>
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_HMI_CWORD77_Controller
+ /// \~english @par Brief
+ /// API to set data associated with request into _CWORD77_ Data Pool
+ /// \~english @param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \~english @param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \~english @param [in] f_pData
+ /// PVOID - void pointer to data
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - None.
+ /// \~english @par Detail
+ /// API to set data associated with request into _CWORD77_ Data Pool
+ /// \~english @par
+ /// It is maintained by executing C_CWORD77_Data::SetRespoData().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see GetRespDataFrom_CWORD77_DataPool, C_CWORD77_Data::SetRespoData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+VOID SetReqDataIn_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, PVOID f_pData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_HMI_CWORD77_Controller
+ /// \~english @par Brief
+ /// API to get data associated with response from _CWORD77_ Data Pool
+ /// \~english @param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \~english @param [out] f_uiSize
+ /// UI_32 - size of the data
+ /// \~english @param [out] f_pData
+ /// PVOID - void pointer to data
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusFail Error
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - C_CWORD77_Data Class instance fail or create fail [eFrameworkunifiedStatusFail]
+ /// - f_DataPoolKey is not registered [eFrameworkunifiedStatusFail]
+ /// - f_pData is NULL [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// API to get data associated with response from _CWORD77_ Data Pool
+ /// \~english @par
+ /// Use SetRespNotfnDataFrom_CWORD77_DataPool() to keep the data.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see SetRespNotfnDataFrom_CWORD77_DataPool, C_CWORD77_Data::GetRespoData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetRespDataFrom_CWORD77_DataPool(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_HMI_CWORD77_Controller
+ /// \~english @par Brief
+ /// API to set data associated with notification response into _CWORD77_ Data Pool
+ /// \~english @param[in] f_cNotificationName
+ /// const std::string& - Name of the notification
+ /// \~english @param[in] f_uiSize
+ /// UI_32 - size of the data
+ /// \~english @param[in] f_pData
+ /// const PVOID - void pointer to data
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - None.
+ /// \~english @par Detail
+ /// API to set data associated with notification response into _CWORD77_ Data Pool
+ /// \~english @par
+ /// Use GetRespNotfnDataFrom_CWORD77_DataPool() to get the held data.
+ /// \~english @par
+ /// It is maintained by executing C_CWORD77_Data::SetRespoData().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see GetRespNotfnDataFrom_CWORD77_DataPool, C_CWORD77_Data::SetRespoData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+VOID SetRespNotfnDataIn_CWORD77_DataPool(const std::string &f_cNotificationName, UI_32 f_uiSize, const PVOID f_pData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tag_HMI_CWORD77_Controller
+ /// \~english @par Brief
+ /// API to set data associated with notification response into _CWORD77_ Data Pool
+ /// \~english @param[in] f_cNotificationName
+ /// const std::string& - Name of the notification
+ /// \~english @param[out] f_uiSize
+ /// UI_32& - size of the data
+ /// \~english @param[out] f_pData
+ /// PVOID& - void pointer to data
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusFail Fail
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - C_CWORD77_Data Class instance fail or create fail [eFrameworkunifiedStatusFail]
+ /// - f_cNotificationName is not registered [eFrameworkunifiedStatusFail]
+ /// - f_pData is NULL [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// API to set data associated with notification response into _CWORD77_ Data Pool
+ /// \~english @par
+ /// Use SetRespNotfnDataFrom_CWORD77_DataPool() to keep the data.
+ /// \~english @par
+ /// Get by executing C_CWORD77_Data::GetRespoData().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see SetRespNotfnDataFrom_CWORD77_DataPool, C_CWORD77_Data::GetRespoData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetRespNotfnDataFrom_CWORD77_DataPool(const std::string &f_cNotificationName, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData); // NOLINT (readability/nolint)
+
+#endif // _C_CWORD77_DATAPOOLIF_H_ NOLINT (build/header_guard)
+//@}
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_key.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_key.h
new file mode 100755
index 0000000..6e3fbc1
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_key.h
@@ -0,0 +1,53 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns__CWORD77__data_pool_key.h
+ * @brief \~english Provide function _CWORD77__DATA_POOL_KEY of make_pair
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+#ifndef NS__CWORD77__DATA_POOL_KEY_H_ // NOLINT (build/header_guard)
+#define NS__CWORD77__DATA_POOL_KEY_H_
+
+#define _CWORD77__DATA_POOL_KEY(ProtocolId) (std::make_pair(ProtocolId, g_c_CWORD77_ServiceName))
+
+#endif /* NS__CWORD77__DATA_POOL_KEY_H_ */ // NOLINT (build/header_guard)
+//@}
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_table.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_table.h
new file mode 100755
index 0000000..73f6a20
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__data_pool_table.h
@@ -0,0 +1,1217 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns__CWORD77__data_pool_table.h
+ * @brief \~english This file provides API for convert and C_CWORD77_DataPool class
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _CWORD77__DATA_POOL_TABLE_H_ // NOLINT (build/header_guard)
+#define _CWORD77__DATA_POOL_TABLE_H_
+
+#include <native_service/ns__CWORD77__common.h>
+#include <sstream>
+#include <map>
+#include <string>
+#include <vector>
+
+/// Enumeration for Type of Table
+typedef enum _ETableType {
+ REQUEST_TABLE = 1,
+ RESPONSE_TABLE
+} ETableType, *PETableType;
+
+/// Enumeration for Data Type
+typedef enum _EDataType {
+ UNKNOWNTYPE = -1,
+ SIGNEDINT,
+ UNSIGNEDINT,
+ FLOAT,
+ DOUBLE,
+ CHARACTER,
+ BOOLEAN,
+ STRING,
+} EDataType, *PEDataType;
+
+/// _CWORD77_ Data structure
+typedef struct __CWORD77_Data {
+ EDataType DataType;
+ std::string DataValue;
+} _CWORD77_Data, *P_CWORD77_Data;
+
+typedef std::map< _CWORD77_DataPoolKey, std::vector< CHAR > > T_CWORD77_DataPool;
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NoOfElementsinData
+/// Function to get number of elements for given string
+///
+/// \param [in] Input
+/// string - string
+///
+/// \return UI_32 - Number of elements
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 NoOfElementsinData(std::string Input);
+
+/// Template to Convert Number to String
+
+template <typename T>
+std::string NumberToString(T Number) {
+ std::ostringstream ss;
+ ss << Number;
+ return ss.str();
+}
+
+/// Template to convert String to Number
+
+template <typename T>
+T StringToNumber(const std::string &Text) {
+ std::istringstream ss(Text);
+ T result;
+ ss >> result;
+ return result;
+}
+
+/// Template to Convert an Array To String
+
+template<class T>
+std::string ConvertArrayToString(T *Array, int Arraysize) {
+ int length = 0;
+ std::string Result = "";
+ while (length < Arraysize) {
+ Result.append(NumberToString<T>(Array[length]));
+ Result.append(",");
+ length++;
+ }
+ Result.append("");
+ return Result;
+}
+
+/// Template to Convert String To Array
+template<class T>
+void ConvertStringToArray(std::string Input, std::vector<T> &Array, UI_32 &Arraysize) { // NOLINT (readability/nolint)
+ int i = 0;
+ std::string first = "";
+ std::istringstream ss(Input);
+ int Size = NoOfElementsinData(Input);
+ // T Arr[Size];
+ while (!ss.eof()) {
+ getline(ss, first, ',');
+ if (first != "") {
+ Array[i] = StringToNumber<T>(first);
+ i++;
+ }
+ }
+ Arraysize = i;
+ // memcpy(Array,(void *)Arr,Arraysize*sizeof(T));
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ConvertArrayStringsToString
+/// Function to convert array of strings to string
+///
+/// \param [in] strArr
+/// string * - pointer to array of strings
+/// \param [in] Size
+/// SI_32 - Number of strings
+///
+/// \return string
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string ConvertArrayStringsToString(std::string *strArr, SI_32 Size);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ConvertArrayStringsToString
+/// Function to convert string to array of strings
+///
+/// \param [in] Input
+/// string - string contains array of strings
+/// \param [out] strArr
+/// string * - Pointer to Array of strings
+/// \param [out] ArraySize
+/// UI_32 - No of elements in Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void ConvertStringToArrString(std::string Input, std::string *strArr, UI_32 &ArraySize); // NOLINT (readability/nolint)
+
+///////////////////////////////////////////////////////////////////////////
+/// class: C_CWORD77_DataPool
+/// Description: This is interface class to _CWORD77_ Data base.
+/// It provides APIs to set and get data from _CWORD77_ Data base
+///
+////////////////////////////////////////////////////////////////////////////
+class C_CWORD77_DataPool {
+ private:
+ std::map<UI_32, _CWORD77_Data> m__CWORD77_DataRequestTable; ///< Request Data Table
+ std::map<UI_32, _CWORD77_Data> m__CWORD77_DataResponseTable; ///< Response Data Table
+
+ static C_CWORD77_DataPool *m_p_CWORD77_DataPoolInstance; ///< Static instance to C_CWORD77_DataPool
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetData
+ /// Templatized Function to get data from _CWORD77_ Data base
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// string - Variable Name or key value
+ /// \param [out] Array
+ /// T * - Pointer to an array of given type
+ /// \param [out] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ template<class T>
+ void GetData(ETableType TableType, UI_32 VarName, T *Array, UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ EDataType DataType = SIGNEDINT;
+ std::string DataValue;
+ GetValueFromMap(TableType, VarName, DataType, DataValue);
+ UI_32 Num = NoOfElementsinData(DataValue);
+ std::vector<T> Temp;
+ Temp.resize(Num);
+ ConvertStringToArray<T>(DataValue, Temp, ArraySize);
+ for (unsigned int i = 0; i < Num; i++) {
+ Array[i] = Temp[i];
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetData
+ /// Templatized Function to set data into _CWORD77_ Data base
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// string - Variable Name or key value
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] Array
+ /// T * - Pointer to an array of given type
+ /// \param [in] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void SetData(ETableType TableType, UI_32 VarName, EDataType DataType, T *Array, UI_32 ArraySize) {
+ std::string Result = ConvertArrayToString(Array, ArraySize);
+ SetValueinMap(TableType, VarName, DataType, Result);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetValueFromMap
+ /// Function to get data from _CWORD77_ map
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// string - Variable Name or key value
+ /// \param [out] DataType
+ /// EDataType - Data Type of key
+ /// \param [out] Strvalue
+ /// string - Output in the form of string
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void GetValueFromMap(ETableType TableType, UI_32 VarName, EDataType &DataType, std::string &Strvalue); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetValueinMap
+ /// Function to set data in _CWORD77_ map
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// string - Variable Name or key value
+ /// \param [in] VarType
+ /// EDataType - Data Type of key
+ /// \param [in] Result
+ /// string - input in the form of string
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetValueinMap(ETableType TableType, UI_32 VarName, EDataType VarType, std::string Result);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetArrayStringData
+ /// Function to set string data in _CWORD77_ map
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// string - Variable Name or key value
+ /// \param [in] VarType
+ /// EDataType - Data Type of key
+ /// \param [in] DataValue
+ /// string [] - Array of strings
+ /// \param [in] Size
+ /// UI_32 - No of elements in Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetArrayStringData(ETableType TableType,
+ UI_32 VarName,
+ EDataType VarType,
+ std::string DataValue[],
+ UI_32 size);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetArrayStringData
+ /// Function to get string data in _CWORD77_ map
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [out] DataValue
+ /// string [] - Array of strings
+ /// \param [out] Size
+ /// UI_32 - No of elements in Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void GetArrayStringData(ETableType TableType, UI_32 VarName, std::string DataValue[], UI_32 &size); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNoofElementsofData
+ /// Function to get Number of elements in data item
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// UI_32 - key
+
+ ///
+ /// \return UI_32 - Number of elements
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetNoofElementsofData(ETableType TableType, UI_32 Key);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDataType
+ /// Function to get data type of given key Name
+ ///
+ /// \param [in] TableType
+ /// ETableType - Table Type (Request or Response)
+ /// \param [in] VarName
+ /// UI_32 - key
+
+ ///
+ /// \return EDataType - Data type of variable
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ EDataType GetDataType(ETableType TableType, UI_32 Key);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// C_CWORD77_DataPool
+ /// Constructor for C_CWORD77_DataPool
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ C_CWORD77_DataPool();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~C_CWORD77_DataPool
+ /// Destructor for C_CWORD77_DataPool
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ ~C_CWORD77_DataPool();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetInstance
+ /// API to get single instance of C_CWORD77_DataPool
+ /// \param None
+ /// \return Pointer to single instance of C_CWORD77_Controller
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static C_CWORD77_DataPool *GetInstance();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// DeleteInstance
+ /// API to delete single instance of C_CWORD77_DataPool
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static void DeleteInstance();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestArrayData
+ /// Templatized Function to set array data into Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] Array
+ /// T * - Pointer to an array of given type
+ /// \param [in] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void SetReqArrayData(UI_32 VarName, EDataType DataType, T *Array, UI_32 ArraySize) {
+ SetData<T>(REQUEST_TABLE, VarName, DataType, Array, ArraySize);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestArrayData
+ /// Templatized Function to set array data into Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] Array
+ /// T * - Pointer to an array of given type
+ /// \param [in] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void SetRespArrayData(UI_32 VarName, EDataType DataType, T *Array, UI_32 ArraySize) {
+ SetData<T>(RESPONSE_TABLE, VarName, DataType, Array, ArraySize);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequestArrayData
+ /// Templatized Function to get array data from Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [out] Array
+ /// T * - Pointer to an array of given type
+ /// \param [out] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void GetReqArrayData(UI_32 VarName, T *Array, UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ GetData<T>(REQUEST_TABLE, VarName, Array, ArraySize);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequestArrayData
+ /// Templatized Function to get array data from Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [out] Array
+ /// T * - Pointer to an array of given type
+ /// \param [out] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void GetRespArrayData(UI_32 VarName, T *Array, UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ GetData<T>(RESPONSE_TABLE, VarName, Array, ArraySize);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestData
+ /// Templatized Function to set data into Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] Array
+ /// T - Data type of key
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void SetReqData(UI_32 VarName, EDataType DataType, T Array) {
+ SetData<T>(REQUEST_TABLE, VarName, DataType, &Array, 1);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestData
+ /// Templatized Function to set data into Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] Array
+ /// T - Data type of key
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ void SetRespData(UI_32 VarName, EDataType DataType, T Array) {
+ SetData<T>(RESPONSE_TABLE, VarName, DataType, &Array, 1);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequestData
+ /// Templatized Function to get data from Resquest _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return T - value belong to type T
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ T GetReqData(UI_32 VarName) {
+ T Data;
+ UI_32 ArraySize = 0;
+ GetData<T>(REQUEST_TABLE, VarName, &Data, ArraySize);
+ return Data;
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetResponseData
+ /// Templatized Function to get data from Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return T - value belong to type T
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ template<class T>
+ T GetRespData(UI_32 VarName) {
+ T Data;
+ UI_32 ArraySize = 0;
+ GetData<T>(RESPONSE_TABLE, VarName, &Data, ArraySize);
+ return Data;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestArrayStringData
+ /// API to set array of string data into Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] DataValue
+ /// string [] - array of strings
+ /// \param [in] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ void SetReqArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size) {
+ SetArrayStringData(REQUEST_TABLE, VarName, VarType, DataValue, size);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestArrayStringData
+ /// API to set array of string data into Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] DataValue
+ /// string [] - array of strings
+ /// \param [in] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetRespArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size) {
+ SetArrayStringData(RESPONSE_TABLE, VarName, VarType, DataValue, size);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequestArrayStringData
+ /// API to get array of string data from Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [out] DataValue
+ /// string [] - array of strings
+ /// \param [out] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ void GetReqArrayStringData(UI_32 VarName, std::string DataValue[], UI_32 &size) { // NOLINT (readability/nolint)
+ GetArrayStringData(REQUEST_TABLE, VarName, DataValue, size);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetResponseArrayStringData
+ /// API to get array of string data from Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [out] DataValue
+ /// string [] - array of strings
+ /// \param [out] ArraySize
+ /// UI_32 - No of elements of Array
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void GetRespArrayStringData(UI_32 VarName, std::string DataValue[], UI_32 &size) { // NOLINT (readability/nolint)
+ GetArrayStringData(RESPONSE_TABLE, VarName, DataValue, size);
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRequestStringData
+ /// API to set string data into Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] DataValue
+ /// string [] - array of strings
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetReqStringData(UI_32 VarName, EDataType VarType, std::string DataValue) {
+ UI_32 size = 1;
+ SetArrayStringData(REQUEST_TABLE, VarName, VarType, &DataValue, size);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetResponseStringData
+ /// API to set string data into Response _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ /// \param [in] DataType
+ /// EDataType - Data Type of key
+ /// \param [in] DataValue
+ /// string [] - array of strings
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void SetRespStringData(UI_32 VarName, EDataType VarType, std::string DataValue) {
+ UI_32 size = 1;
+ SetArrayStringData(RESPONSE_TABLE, VarName, VarType, &DataValue, size);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequestStringData
+ /// API to get string data from Request _CWORD77_ Data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return string - value of data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetReqStringData(UI_32 VarName) {
+ UI_32 size = 0;
+ std::string DataValue = "";
+ GetArrayStringData(REQUEST_TABLE, VarName, &DataValue, size);
+ return DataValue;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNoofElementsFromRequestTable
+ /// API to get No of elements in a key from request data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return UI_32 - No of elements
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetReqDataSize(UI_32 Key) {
+ return GetNoofElementsofData(REQUEST_TABLE, Key);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNoofElementsFromResponseTable
+ /// API to get No of elements in a key from response data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return UI_32 - No of elements
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ UI_32 GetRespDataSize(UI_32 Key) {
+ return GetNoofElementsofData(RESPONSE_TABLE, Key);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDataTypeFromRequestTable
+ /// API to get data type of key from request data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return EDataType - Data type of key
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+ EDataType GetReqDataType(UI_32 Key) {
+ return GetDataType(REQUEST_TABLE, Key);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDataTypeFromResponseTable
+ /// API to get data type of key from response data base
+ ///
+ /// \param [in] VarName
+ /// UI_32 - key
+ ///
+ /// \return EDataType - Data type of key
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EDataType GetRespDataType(UI_32 Key) {
+ return GetDataType(RESPONSE_TABLE, Key);
+ }
+};
+
+extern C_CWORD77_DataPool g__CWORD77_DataPool;
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestArrayData
+/// Templatized Function to set array data into Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] Array
+/// T * - Pointer to an array of given type
+/// \param [in] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void SetRequestArrayData(UI_32 VarName, EDataType DataType, T *Array, UI_32 ArraySize) {
+ g__CWORD77_DataPool.SetReqArrayData(VarName, DataType, Array, ArraySize);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestArrayData
+/// Templatized Function to set array data into Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] Array
+/// T * - Pointer to an array of given type
+/// \param [in] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void SetResponseArrayData(UI_32 VarName, EDataType DataType, T *Array, UI_32 ArraySize) {
+ g__CWORD77_DataPool.SetRespArrayData<T>(VarName, DataType, Array, ArraySize);
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestArrayData
+/// Templatized Function to get array data from Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [out] Array
+/// T * - Pointer to an array of given type
+/// \param [out] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void GetRequestArrayData(UI_32 VarName, T *Array, UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ g__CWORD77_DataPool.GetReqArrayData<T>(VarName, Array, ArraySize);
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestArrayData
+/// Templatized Function to get array data from Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [out] Array
+/// T * - Pointer to an array of given type
+/// \param [out] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void GetResponseArrayData(UI_32 VarName, T *Array, UI_32 &ArraySize) { // NOLINT (readability/nolint)
+ g__CWORD77_DataPool.GetRespArrayData<T>(VarName, Array, ArraySize);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestData
+/// Templatized Function to set data into Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] Array
+/// T - Data type of key
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void SetRequestData(UI_32 VarName, EDataType DataType, T Array) {
+ g__CWORD77_DataPool.SetReqData<T>(VarName, DataType, Array);
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestData
+/// Templatized Function to set data into Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] Array
+/// T - Data type of key
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+void SetResponseData(UI_32 VarName, EDataType DataType, T Array) {
+ g__CWORD77_DataPool.SetRespData<T>(VarName, DataType, Array);
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestData
+/// Templatized Function to get data from Resquest _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return T - value belong to type T
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+T GetRequestData(UI_32 VarName) {
+ return g__CWORD77_DataPool.GetReqData<T>(VarName);
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetResponseData
+/// Templatized Function to get data from Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return T - value belong to type T
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+template<class T>
+T GetResponseData(UI_32 VarName) {
+ return g__CWORD77_DataPool.GetRespData<T>(VarName);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestArrayStringData
+/// API to set array of string data into Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] DataValue
+/// string [] - array of strings
+/// \param [in] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+
+void SetRequestArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestArrayStringData
+/// API to set array of string data into Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] DataValue
+/// string [] - array of strings
+/// \param [in] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void SetResponseArrayStringData(UI_32 VarName, EDataType VarType, std::string DataValue[], UI_32 size);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestArrayStringData
+/// API to get array of string data from Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [out] DataValue
+/// string [] - array of strings
+/// \param [out] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+
+void GetRequestArrayStringData(UI_32 VarName, std::string DataValue[], UI_32 &size); // NOLINT (readability/nolint)
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetResponseArrayStringData
+/// API to get array of string data from Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [out] DataValue
+/// string [] - array of strings
+/// \param [out] ArraySize
+/// UI_32 - No of elements of Array
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void GetResponseArrayStringData(UI_32 VarName, std::string DataValue[], UI_32 &size); // NOLINT (readability/nolint)
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetRequestStringData
+/// API to set string data into Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] DataValue
+/// string [] - array of strings
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void SetRequestStringData(UI_32 VarName, EDataType VarType, std::string DataValue);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetResponseStringData
+/// API to set string data into Response _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+/// \param [in] DataType
+/// EDataType - Data Type of key
+/// \param [in] DataValue
+/// string [] - array of strings
+///
+/// \return None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void SetResponseStringData(UI_32 VarName, EDataType VarType, std::string DataValue);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestStringData
+/// API to get string data from Request _CWORD77_ Data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return string - value of data
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string GetRequestStringData(UI_32 VarName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequestDataLength
+/// API to get No of elements in a key from request data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return UI_32 - No of elements
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 GetRequestDataLength(UI_32 Key);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetResponseDataLength
+/// API to get No of elements in a key from response data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return UI_32 - No of elements
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+
+UI_32 GetResponseDataLength(UI_32 Key);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetDataTypeFromRequestTable
+/// API to get data type of key from request data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return EDataType - Data type of key
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+
+EDataType GetRequestDataType(UI_32 Key);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetDataTypeFromResponseTable
+/// API to get data type of key from response data base
+///
+/// \param [in] VarName
+/// UI_32 - key
+///
+/// \return EDataType - Data type of key
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EDataType GetResponseDataType(UI_32 Key);
+
+
+
+class C_CWORD77_Data {
+ private:
+ T_CWORD77_DataPool m__CWORD77_RequestDataTable; ///< Request Data Table
+ T_CWORD77_DataPool m__CWORD77_ResponseDataTable; ///< Response Data Table
+
+ // Original data pool
+ // Depricated. Remove once all modules migrates to new API's for accessing data pool
+ std::map< UI_32, std::vector<CHAR> > m__CWORD77_RequestDataTableOrig; ///< Request Data Table
+ std::map< UI_32, std::vector<CHAR> > m__CWORD77_ResponseDataTableOrig; ///< Response Data Table
+
+ static C_CWORD77_Data *m_p_CWORD77_DataInstance; /// instance to C_CWORD77_Data
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// C_CWORD77_Data
+ /// Constructor for C_CWORD77_Data
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ C_CWORD77_Data();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// C_CWORD77_Data
+ /// Destructor for C_CWORD77_Data
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ ~C_CWORD77_Data();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetInstance
+ /// API to get single instance of C_CWORD77_Data
+ /// \param None
+ /// \return Pointer to single instance of C_CWORD77_Data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static C_CWORD77_Data *GetInstance();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// DeleteInstance
+ /// API to delete single instance of C_CWORD77_DataPool
+ /// \param None
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static void DeleteInstance();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReqDataIn_CWORD77_DataPool
+ /// API to set data associated with request into _CWORD77_ Data Pool
+ ///
+ /// \param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return VOID - None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetRequData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 f_uiSize, PVOID f_pData); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReqDataIn_CWORD77_DataPool
+ /// API to set data associated with request into _CWORD77_ Data Pool
+ /// Depricated. Do not use.
+ ///
+ /// \param [in] f_uiMsgId
+ /// UI_32 - MsgId
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return VOID - None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetRequData(UI_32 f_uiMsgId, UI_32 f_uiSize, PVOID f_pData);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRespDataIn_CWORD77_DataPool
+ /// API to set data associated with response into _CWORD77_ Data Pool
+ ///
+ /// \param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return VOID - None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetRespoData(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 f_uiSize, const PVOID f_pData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetRespDataIn_CWORD77_DataPool
+ /// API to set data associated with response into _CWORD77_ Data Pool
+ /// Depricated. Do not use.
+ ///
+ /// \param [in] f_uiMsgId
+ /// UI_32 - MsgId
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return VOID - None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetRespoData(UI_32 f_uiMsgId, UI_32 f_uiSize, const PVOID f_pData); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetReqDataIn_CWORD77_DataPool
+ /// API to get data associated with request from _CWORD77_ Data Pool
+ ///
+ /// \param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return EFrameworkunifiedStatus - Succes or Error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetRequData(const _CWORD77_DataPoolKey &f_DataPoolKey, UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetReqDataIn_CWORD77_DataPool
+ /// API to get data associated with request from _CWORD77_ Data Pool
+ /// Depricated. Do not use.
+ ///
+ /// \param [in] f_uiMsgId
+ /// UI_32 - MsgId
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return EFrameworkunifiedStatus - Succes or Error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetRequData(UI_32 f_uiMsgId, UI_32 &f_uiSize, PVOID &f_pData); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRespDataFrom_CWORD77_DataPool
+ /// API to get data associated with response from _CWORD77_ Data Pool
+ ///
+ /// \param [in] f_DataPoolKey
+ /// _CWORD77_DataPoolKey - Data pool key
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return EFrameworkunifiedStatus - Succes or Error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetRespoData(const _CWORD77_DataPoolKey &f_DataPoolKey, // NOLINT (readability/nolint)
+ UI_32 &f_uiSize, // NOLINT (readability/nolint)
+ PVOID &f_pData); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRespDataFrom_CWORD77_DataPool
+ /// API to get data associated with response from _CWORD77_ Data Pool
+ /// Depricated. Do not use.
+ ///
+ /// \param [in] f_uiMsgId
+ /// UI_32 - MsgId
+ /// \param [in] f_uiSize
+ /// UI_32 - size of the data
+ /// \param [in] f_pData
+ /// PVOID - void pointer to data
+ ///
+ /// \return EFrameworkunifiedStatus - Succes or Error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetRespoData(UI_32 f_uiMsgId, UI_32 &f_uiSize, PVOID &f_pData); // NOLINT (readability/nolint)
+};
+
+#endif /* _CWORD77__DATA_POOL_TABLE_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__notifications.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__notifications.h
new file mode 100755
index 0000000..5d7e399
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__notifications.h
@@ -0,0 +1,53 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns__CWORD77__notifications.h
+ * @brief \~english This file defines _CWORD77_ Service Availability Notification.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef NS__CWORD77__NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define NS__CWORD77__NOTIFICATIONS_H_
+
+#define NTFY_REG__CWORD77__Available "_CWORD77_/Available" ///< _CWORD77_ Service Availability Notification
+
+#endif /* NS__CWORD77__NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__types.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__types.h
new file mode 100755
index 0000000..ae6ce83
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns__CWORD77__types.h
@@ -0,0 +1,68 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file
+ * @brief \~english This file contains enum of PE_CWORD77_ResponseType
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup _CWORD77_
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _NS__CWORD77__TYPES_H_ // NOLINT (build/header_guard)
+#define _NS__CWORD77__TYPES_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <sstream>
+#include <utility>
+#include <string>
+// using namespace std;
+
+typedef enum _E_CWORD77_ResponseType {
+ RESPONSE = 0,
+ NOTIFICATION,
+ EVENT
+} E_CWORD77_ResponseType, *PE_CWORD77_ResponseType;
+
+// Pair to uniquely identify protocol commands and notifications for different services
+// pair of protocol id and service name in case of protocol interfaces
+// pair of 0 and notification name in case of notifications, as notification name will always be unique
+typedef std::pair<UI_32, std::string> _CWORD77_DataPoolKey;
+
+#endif /* _NS__CWORD77__TYPES_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_buildversioncheck.hpp b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_buildversioncheck.hpp
new file mode 100755
index 0000000..d7f702c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_buildversioncheck.hpp
@@ -0,0 +1,227 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_buildversioncheck.hpp
+ * @brief \~english Provide the APIs to check/get version
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_UTILITY_BUILDVERSIONCHECK_LIBRARY_INCLUDE_NATIVE_SERVICE_NS_BUILDVERSIONCHECK_HPP_ // NOLINT (build/header_guard)
+#define FRAMEWORK_UNIFIED_CLIENT_NS_UTILITY_BUILDVERSIONCHECK_LIBRARY_INCLUDE_NATIVE_SERVICE_NS_BUILDVERSIONCHECK_HPP_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+/**
+ * \~english the namespace frameworkunified
+ */
+namespace frameworkunified {
+/**
+ * \~english the namespace ns
+ */
+namespace ns {
+/**
+ * \~english the namespace utility
+ */
+namespace utility {
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_BuildVersionCheck
+/// \~english @par Brief
+/// Check whether the input param build_version is matched or not.
+/// \~english @param [in] build_version
+/// PCSTR - The version to be checked
+/// \~english @retval TRUE: match; FALSE: does not match
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// If the input param version string build_version is empty, the function returns FALSE. \n
+/// If the input param version string build_version is equal to the environment build version \n
+/// and library build version, the function returns TRUE.
+/// \~english @see getEnvironmentBuildVersion getLibraryBuildVersion
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL buildVersionsMatch(PCSTR build_version); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_BuildVersionCheck
+/// \~english @par Brief
+/// Get the build version from environment variable.
+/// \~english @retval the build version string
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The funcion returns the value of the system environment variable "BUILD_VERSION". If \n
+/// the environment variable does not exist, the function returns "".
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR getEnvironmentBuildVersion(); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_BuildVersionCheck
+/// \~english @par Brief
+/// Get the library build version string
+/// \~english @retval the library buidling version string
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function returns the string as macro _BUILD_VERSION.
+/// \~english @see _BUILD_VERSION
+////////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR getLibraryBuildVersion(); // NOLINT (readability/nolint)
+
+/**
+ * \~english the namespace utility_private
+ */
+namespace utility_private {
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_BuildVersionCheck
+/// \~english @par Brief
+/// Check whether the input param is empty or not.
+/// \~english @param [in] build_version
+/// PCSTR - the build version
+/// \~english @retval the input param build_version or "<Not defined>"
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// If the input param build_version is not empty, the function returns build_version, \n
+/// or the function returns "<Not defined>".
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR niceBuildVersion(PCSTR build_version); // NOLINT (readability/nolint)
+
+/**
+ * \~english the end of namespace utility_private
+ */
+}
+/**
+ * \~english the end of namespace utility
+ */
+}
+/**
+ * \~english the end of namespace ns
+ */
+}
+/**
+ * \~english the end of namespace frameworkunified
+ */
+}
+
+/**
+ * \~english define the macro _BUILD_VERSION
+ */
+#ifndef BUILD_VERSION
+#define _BUILD_VERSION ""
+#else
+#define QUOTE( ___str___ ) #___str___
+#define EXPAND_AND_QUOTE( ___str___ ) QUOTE( ___str___ )
+#define _BUILD_VERSION EXPAND_AND_QUOTE( BUILD_VERSION )
+#endif
+
+/**
+ * \~english define the macro WARNING_STRING to print the warning
+ */
+#define WARNING_STRING "\n\
+!!! WARNING - Build Versions do not match !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\
+project build: %s\n\
+library build: %s\n\
+environment build: %s\n\
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+
+/**
+ * \~english define the macro _BUILD_VERSION
+ */
+#if defined STDOUT_LOGGING
+#include <cstdio>
+#define BUILDVERSIONLOG( ___log_string___, ...) std::printf( ___log_string___ "\n", __VA_ARGS__)
+#define BUILDVERSION_NULL_STATEMENT (0)
+#elif defined NO_LOGGING
+#define BUILDVERSIONLOG(...) ((void)0)
+#define BUILDVERSION_NULL_STATEMENT ((void)0)
+#else
+#include <native_service/ns_logger_if.h>
+#define BUILDVERSIONLOG( ___log_string___, ...) TEXT( __PRETTY_FUNCTION__, ___log_string___, __VA_ARGS__)
+/**
+ * \~english define the macro BUILDVERSION_NULL_STATEMENT
+ */
+#define BUILDVERSION_NULL_STATEMENT ((void)0)
+#endif
+
+/**
+ * \~english define the macro CHECK_BUILD_VERSION to check the version
+ */
+#define CHECK_BUILD_VERSION() \
+ (!framework_unified::ns::utility::buildVersionsMatch( _BUILD_VERSION )) ? \
+ BUILDVERSIONLOG( WARNING_STRING, \
+ framework_unified::ns::utility::utility_private::niceBuildVersion( _BUILD_VERSION ), \
+ framework_unified::ns::utility::utility_private::niceBuildVersion( framework_unified::ns::utility::getLibraryBuildVersion() ), \
+ framework_unified::ns::utility::utility_private::niceBuildVersion( framework_unified::ns::utility::getEnvironmentBuildVersion() ) ) :\
+ BUILDVERSION_NULL_STATEMENT
+
+/** @}*/ // end of framework_unified
+
+/** @}*/ // end of native_service
+
+/** @}*/ // end of BaseSystem
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_UTILITY_BUILDVERSIONCHECK_LIBRARY_INCLUDE_NATIVE_SERVICE_NS_BUILDVERSIONCHECK_HPP_ // NOLINT (build/header_guard)
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_config_parser_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_config_parser_if.h
new file mode 100755
index 0000000..b40c01e
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_config_parser_if.h
@@ -0,0 +1,1038 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_config_parser_if.h
+ * @brief \~english This file contains declaration of class CNSConfigReader, CNSConfigWriter and CNSConfigParser. -- API
+ * define head file
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup Native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef NS_NATIVESERVICES_INC_NATIVE_NS_CONFIG_PARSER_IF_H_ // NOLINT (build/header_guard)
+#define NS_NATIVESERVICES_INC_NATIVE_NS_CONFIG_PARSER_IF_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+// forward declaration of classes
+class IConfigReader;
+class IConfigWriter;
+
+/**
+ * @class CNSConfigReader
+ * @brief \~english Configuration File Read Service Class
+ * @par \~english Brief Introduction
+ * \~english This class provides API's to application to read from configuration files.
+ *
+ */
+class CNSConfigReader {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigReader
+ /// \~english @par Brief
+ /// Constructor of CNSConfigReader class
+ /// This constructor can only be called by derived class. Application cannot use this constructor
+ /// to create object of CNSConfigReader class.
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It is called when generating the instance of CNSConfigParser class.
+ /// \~english @see CNSConfigReader::~CNSConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSConfigReader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigReader
+ /// \~english @par Brief
+ /// Constructor of CNSConfigReader class
+ /// This is depricated. Use parameterless constructor instead to create object and
+ /// Parse(filepath) to parse the file using reader object.
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Name of the configuration file
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It doesn't need to call Parse() function to execute parse process of configuration file,
+ /// when using the constructor with file path. However, because we don't execute error process,
+ /// if it needs to reply error about parse process, we must to use the constructor without parameter
+ /// and call Parse() function.
+ /// \~english @see CNSConfigReader::~CNSConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CNSConfigReader(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Parse
+ /// \~english @par Brief
+ /// This function is used to parse configuration file
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Name of the configuration file
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - if memory allocation failed or document is not proper
+ /// \~english @retval eFrameworkunifiedStatusFail - invalid file type
+ /// \~english @retval eFrameworkunifiedStatusInvldParam invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusErrOther - file data error
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File(f_c_filepath) designated by parameter is not proper [eFrameworkunifiedStatusNullPointer]
+ /// - Data of file(f_c_filepath) designated by parameter is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Expansion name of file(f_c_filepath) designated by parameter is not cfg [eFrameworkunifiedStatusFail]
+ /// - Failed to open file(f_c_filepath) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Path of file designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Data of file designated by parameter has error [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parse designated configuration file. If the data format is correct, get memory to store the parsed result,
+ /// and store the parsed contents in it.
+ /// \~english @see CNSConfigWriter::Parse, CNSConfigParser::Parse
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Parse(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CNSConfigReader
+ /// \~english @par Brief
+ /// Destructor of CNSConfigReader class.
+ /// It is used when release the instance.
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Release the used memory and the parsed result of configuration file.
+ /// \~english @see CNSConfigReader::CNSConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSConfigReader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetBool
+ /// \~english @par Brief
+ /// This function is used to get the bool value associated with key.
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// This API has been depricated, use GetBool(key, ref_value)
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @retval TRUE - value associated with key
+ /// \~english @retval FALSE - Failed to get value associated with key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [FALSE]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [FALSE]
+ /// - Can not find search key(f_c_key) designated by parameter [FALSE]
+ /// - Value getted from configuration file is not true or false [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(TRUE/FALSE) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// This API has been depricated, please use GetBool(const std::string& f_c_key, BOOL& f_bValue).
+ /// \~english @see CNSConfigWriter::SetBool
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL GetBool(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetDouble
+ /// \~english @par Brief
+ /// This function is used to get the double value associated with key.
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// This API has been depricated, use GetDouble(key, ref_value)
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @param [out] - none
+ /// \~english @retval F_64 - value associated with key
+ /// \~english @retval 0 - Failed to get value associated with key(64bit)
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [0]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [0]
+ /// - Can not find search key(f_c_key) designated by parameter [0]
+ /// - Failed to change data getted from configuration file from string type to double type [0]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - We can take the value in specification only if it is in the range of
+ /// [1.17549435082228750797e-38F, 3.40282346638528859812e+38F](min value of double, max value of double).
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(64bit) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// This API has been depricated, please use GetDouble(const std::string& f_c_key, F_64& f_f_value).
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ F_64 GetDouble(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetFloat
+ /// \~english @par Brief
+ /// This function is used to get the float value associated with key
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// This API has been depricated, use GetFloat(key, ref_value)
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @retval F_32 value associated with key
+ /// \~english @retval 0 - Failed to get value associated with key(32bit)
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [0]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [0]
+ /// - Can not find search key(f_c_key) designated by parameter [0]
+ /// - Can not change the data string, because that data string getted
+ /// from configuration file is over range [9.8765436e+12]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(32bit) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// This API has been depricated, please use GetFloat(const std::string& f_c_key, F_32& f_f_value).
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ F_32 GetFloat(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetInt
+ /// \~english @par Brief
+ /// This function is used to get the integer value associated with key
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// This API has been depricated, use GetInt(key, ref_value)
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @retval SI_32 - value associated with key
+ /// \~english @retval 0.0f - Failed to get value associated with key(32bit)
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [0]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [0]
+ /// - Can not find search key(f_c_key) designated by parameter [0]
+ /// - Failed to change data getted from Configuration file from string type to Int type [0]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(32bit) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// This API has been depricated, please use GetInt(const std::string& f_c_key, SI_32& f_si_value).
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - If data string getted from file is larger than INT_MAX(2147483648), return -1.
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetInt(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetString
+ /// \~english @par Brief
+ /// This function is used to get the string value associated with key
+ /// If there are multiple values associated with the same key, all the values separated by
+ /// delimiter "\n" are returned.
+ /// This API has been depricated, use GetString(key, ref_value)
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @retval std::string value(string) associated with key
+ /// \~english @retval nullbuffer - Failed to get value associated with key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [null buffer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [null buffer]
+ /// - Can not find search key(f_c_key) designated by parameter [null buffer]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(string) associated with key.
+ /// If there are multiple values associated with the same key,
+ /// return all the values separated by delimiter "\n".
+ /// This API has been depricated, please use GetString(
+ /// const std::string& f_c_key, std::string& f_cValue).
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetString(const std::string &f_c_key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetBool
+ /// \~english @par Brief
+ /// This function is used to get the bool value associated with key
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key string
+ /// \~english @param [in] f_b_value
+ /// BOOL& - value associated with key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @retval eFrameworkunifiedStatusErrOther - value is not bool type
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Value getted from configuration file is not true or false [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(TRUE/FALSE) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// \~english @see CNSConfigWriter::SetBool
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetBool(const std::string &f_c_key, BOOL &f_b_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetDouble
+ /// \~english @par Brief
+ /// This function is used to get the double value associated with key.
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @param [in] f_f_value
+ /// F_64& - value associated with key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @retval eFrameworkunifiedStatusInvldBuf - change error
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Changed result of data string getted from configuration file is overflow or underflow [eFrameworkunifiedStatusInvldBuf]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - Return eFrameworkunifiedStatusOK if we didn't excute the changing operation
+ /// - We can take the value in specification only if it is in the range of
+ /// [1.17549435082228750797e-38F, 3.40282346638528859812e+38F](min value of double, max value of double).
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(64bit) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetDouble(const std::string &f_c_key, F_64 &f_f_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetFloat
+ /// \~english @par Brief
+ /// This function is used to get the float value associated with key
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @param [in] f_f_value
+ /// F_32& - value associated with key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @retval eFrameworkunifiedStatusInvldBuf - change error
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Can not change the data string, because that data string getted
+ /// from configuration file is over range [9.8765436e+12]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(32bit) associated with key.
+ /// If there are multiple values associated with the same key, return the first value.
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetFloat(const std::string &f_c_key, F_32 &f_f_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetInt
+ /// \~english @par Brief
+ /// This function is used to get the integer value associated with key
+ /// If there are multiple values associated with the same key, then the first value is returned.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @param [out] f_si_value
+ /// SI_32& - value associated with key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @retval eFrameworkunifiedStatusInvldBuf - change error
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Failed to change data getted from Configuration file from string type to Int type [eFrameworkunifiedStatusInvldBuf]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(32bit) associated with key.
+ /// If there are multiple values associated with the same key, return all the values separated by delimiter "\n".
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetInt(const std::string &f_c_key, SI_32 &f_si_value); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetString
+ /// \~english @par Brief
+ /// This function is used to get the string value associated with key
+ /// If there are multiple values associated with the same key, all the values separated by
+ /// delimiter "\n" are returned.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key to search
+ /// \~english @param [in] f_c_value
+ /// std::string& - value(string) associated with key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigReader
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(string) associated with key.
+ /// If there are multiple values associated with the same key,
+ /// return all the values separated by delimiter "\n".
+ /// \~english @see CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetString(const std::string &f_c_key, std::string &f_c_value); // NOLINT (readability/nolint)
+
+ protected:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDataPtr
+ /// This function is used to get the data pointer. This pointer is then set in config writer.
+ /// This is needed to avoid recreation of same data structure object in both reader and writer
+ /// when we create object of NSConfigParser.
+ ///
+ /// \return PVOID - pointer of data structure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PVOID GetDataPtr();
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FormatValue
+ /// This function is used to remove the line feed or carriage return from string
+ ///
+ /// \param [in] f_cValue
+ /// std::string - value
+ ///
+ /// \return std::string - formated data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string FormatValue(const std::string &f_c_value);
+
+ // config reader pointer
+ IConfigReader *m_pReader;
+ static HANDLE m_hNSXMLLibHandle; // NOLINT (readability/nolint)
+};
+
+
+/**
+ * @class CNSConfigWriter
+ * @brief \~english File Write Service Class
+ * @par \~english Brief Introduction
+ * \~english This class provides API's to application to write to configuration files.
+ *
+ */
+class CNSConfigWriter {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigWriter
+ /// \~english @par Brief
+ /// Constructor of CNSConfigWriter class
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It is called when generating the instance of CNSConfigWriter class.
+ /// \~english @see CNSConfigWriter::~CNSConfigWriter
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSConfigWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigWriter
+ /// \~english @par Brief
+ /// Constructor of CNSConfigWriter class
+ /// This is depricated. Use parameterless constructor instead to create object and
+ /// Parse(filepath) to parse the file using writer object.
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Full path of the configuration file
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It doesn't need to call Parse() function to execute parse process of configuration File,
+ /// when using the constructor with file path. However, because we don't execute error process,
+ /// if it needs to reply error about parse process, we must to use the constructor without parameter
+ /// and call Parse() function.
+ /// \~english @see CNSConfigWriter::~CNSConfigWriter
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CNSConfigWriter(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CNSConfigWriter
+ /// \~english @par Brief
+ /// Destructor of CNSConfigWriter class
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Release the used memory and the parsed result of Configuration File.
+ /// \~english @see CNSConfigWriter::CNSConfigWriter
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSConfigWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Parse
+ /// \~english @par Brief
+ /// This function is used to parse the configuration file
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Name of the configuration file
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - if memory allocation failed or document not proper
+ /// \~english @retval eFrameworkunifiedStatusFail - invalid file type
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusErrOther - file data error
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File(f_c_filepath) designated by parameter is not proper [eFrameworkunifiedStatusNullPointer]
+ /// - Data of file(f_c_filepath) designated by parameter is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Expansion name of file(f_c_filepath) designated by parameter is not cfg [eFrameworkunifiedStatusFail]
+ /// - Failed to open file(f_c_filepath) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Path of file designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Data of file designated by parameter has error [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parse designated configuration file. If the data format is correct, get memory to store the parsed result,
+ /// and store the parsed contents in it.
+ /// \~english @see CNSConfigParser::Parse, CNSConfigWriter::Parse
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Parse(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Save
+ /// \~english @par Brief
+ /// This function is used to save the configuration settings to config file
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusFail - file access fail
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - File doesn't exit [eFrameworkunifiedStatusFail]
+ /// - File access error [eFrameworkunifiedStatusFail]
+ /// - Can't open file [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Save the data stored in memory to configuration file.
+ /// \~english @see CNSConfigWriter::SetBool, CNSConfigWriter::Set
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Save();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetBool
+ /// \~english @par Brief
+ /// This function is used to set the bool value corresponding to key
+ /// This function is not overloaded with other Set() API's of this class because
+ /// BOOL is typedef of UI_32 so when we pass integer or BOOL to Set API it would have
+ /// called the same API.
+ /// If multiple identical keys are found it sets the value for all the keys.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key
+ /// \~english @param [in] f_b_value
+ /// BOOL - bool value to set for key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @retval eFrameworkunifiedStatusErrOther - if passsed value is invalid
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Data(f_bValue) of search key designated by parameter is not bool [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - Valid condition of search key string: there is no separator and line feed in config tag
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the value(bool type) associated with key to data stored in memory.
+ /// If there are multiple keys, set the values associated with all keys.
+ /// \~english @see CNSConfigReader::GetBool
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetBool(const std::string &f_c_key, BOOL f_b_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Set
+ /// \~english @par Brief
+ /// This function is used to set the double value corresponding to key.
+ /// If multiple identical keys are found it sets the value for all the keys.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key
+ /// \~english @param [in] f_f_value
+ /// F_64 - double value to set for key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - We can take the value in specification only if it is in the range of
+ /// [2.22507385850720138309e-308L, 1.7976931348623157e+308L](min value of double, max value of double).
+ /// - Valid condition of search key string: there is no separator and line feed in config tag
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the bool type value(64bit) associated with key to data stored in memory.
+ /// If there are multiple keys, set the values associated with all keys.
+ /// \~english @see CNSConfigReader::GetDouble
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Set(const std::string &f_c_key, F_64 f_f_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Set
+ /// \~english @par Brief
+ /// This function is used to set the float value corresponding to key.
+ /// If multiple identical keys are found it sets the value for all the keys.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key
+ /// \~english @param [in] f_f_value
+ /// F_32 - float value to set for key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - We can take the value in specification only if it is in the range of
+ /// [1.17549435082228750797e-38F, 3.40282346638528859812e+38F](min value of double, max value of double).
+ /// - Valid condition of search key string: there is no separator and line feed in config tag
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the float type value(32bit) associated with key to data stored in memory.
+ /// If there are multiple keys, set the values associated with all keys.
+ /// \~english @see CNSConfigReader::GetFloat
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Set(const std::string &f_c_key, F_32 f_f_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Set
+ /// \~english @par Brief
+ /// This function is used to set the integer value corresponding to key.
+ /// If multiple identical keys are found it sets the value for all the keys.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key
+ /// \~english @param [in] f_si_value
+ /// SI_32 - integer value to set for key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - Valid condition of search key string: there is no separator and line feed in config tag
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the int type value(32bit) associated with key to data stored in memory.
+ /// If there are multiple keys, set the values associated with all keys.
+ /// \~english @see CNSConfigReader::GetInt
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Set(const std::string &f_c_key, SI_32 f_si_value);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Set
+ /// \~english @par Brief
+ /// This function is used to set the string value corresponding to key.
+ /// If multiple identical keys are found it sets the value for all the keys.
+ /// \~english @param [in] f_c_key
+ /// const std::string& - key
+ /// \~english @param [in] f_s_value
+ /// const std::string& - string value to set for key
+ /// \~english @retval eFrameworkunifiedStatusOK - success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - memory allocation failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - can not find key
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigWriter
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File data is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Data of search key(f_c_key) designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Can not find search key(f_c_key) designated by parameter [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par
+ /// Please pay attention to the following points when you use this API.\n
+ /// - Valid condition of search key string: there is no separator and line feed in config tag
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the string type value associated with key to data stored in memory.
+ /// If there are multiple keys, set the values associated with all keys.
+ /// \~english @see CNSConfigReader::GetString
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Set(const std::string &f_c_key, const std::string &f_s_value);
+
+ protected:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSConfigWriter
+ /// Constructor of CNSConfigWriter class
+ ///
+ /// \param [in] f_c_filepath
+ /// const std::string& - Full path of the configuration file
+ /// \param [in] f_b_noload
+ /// BOOL - load writer with no data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSConfigWriter(const std::string &f_c_filepath, BOOL f_b_noload);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDataPtr
+ /// This function is used to set the data pointer in writer class with data pointer
+ /// created in config reader class.
+ /// This is needed to avoid recreation of same data structure object in both reader and writer
+ /// when we create object of NSConfigParser
+ ///
+ /// \param [in] f_p_data
+ /// PVOID - Pointer to data structure
+ ///
+ /// \return VOID
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetDataPtr(PVOID f_p_data);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Create
+ /// This function is used to create config object
+ ///
+ /// \param [in] f_c_filepath
+ /// const std::string& - Name of the configuration file
+ ///
+ /// \return EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Create(const std::string &f_c_filepath);
+
+ private:
+ // config writer pointer
+ IConfigWriter *m_pWriter;
+ static HANDLE m_hNSXMLLibHandle; // NOLINT (readability/nolint)
+};
+
+
+/**
+ * @class CNSConfigParser
+ * @brief \~english File both Reade and Write Service Class
+ * @par \~english Brief Introduction
+ * \~english This class provides API's to application for both reading and writing into configuration files.
+ *
+ */
+class CNSConfigParser: public CNSConfigReader, public CNSConfigWriter {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigParser
+ /// \~english @par Brief
+ /// Constructor of CNSConfigParser class
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It is called when generating the instance of CNSConfigParser class.
+ /// \~english @see CNSConfigParser::~CNSConfigParser
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSConfigParser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSConfigParser
+ /// \~english @par Brief
+ /// Constructor of CNSConfigParser class
+ /// This is depricated. Use parameterless constructor instead to create object and
+ /// Parse(filepath) to parse the file using parser object.
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Full path of the configuration file
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// It doesn't need to call Parse() function to execute parse process of configuration File,
+ /// when using the constructor with file path. However, because we don't execute error process,
+ /// if it needs to reply error about parse process, we must to use the constructor without parameter
+ /// and call Parse() function.
+ /// \~english @see CNSConfigParser::~CNSConfigParser
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CNSConfigParser(const std::string &f_c_filepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CNSConfigParser
+ /// \~english @par Brief
+ /// Destructor of CNSConfigParser class
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigParser
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Release the used memory and the parsed result of Configuration File.
+ /// \~english @see CNSConfigParser::CNSConfigParser
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSConfigParser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Parse
+ /// \~english @par Brief
+ /// This function is used to create config reader object and config writer object
+ /// which then parses the configuration file.
+ /// \~english @param [in] f_c_filepath
+ /// const std::string& - Name of the configuration file
+ /// \~english @retval eFrameworkunifiedStatusOK on success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer - if memory allocation failed or document not proper
+ /// \~english @retval eFrameworkunifiedStatusFail - invalid file type
+ /// \~english @retval eFrameworkunifiedStatusInvldParam invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusErrOther file data error
+ /// \~english @par Prerequisite
+ /// - Call the construct of CNSConfigParser
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Memory allocation failed [eFrameworkunifiedStatusNullPointer]
+ /// - File(f_c_filepath) designated by parameter is not proper [eFrameworkunifiedStatusNullPointer]
+ /// - Data of file(f_c_filepath) designated by parameter is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Expansion name of file(f_c_filepath) designated by parameter is not cfg [eFrameworkunifiedStatusFail]
+ /// - Failed to open file(f_c_filepath) designated by parameter [eFrameworkunifiedStatusFail]
+ /// - Path of file designated by parameter is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Data of file designated by parameter has error [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parse designated configuration file. If the data format is correct, get memory to store the parsed result,
+ /// and store the parsed contents in it.
+ /// \~english @see CNSConfigReader::Parse, CNSConfigWriter::Parse
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Parse(const std::string &f_c_filepath);
+};
+
+#endif // NS_NATIVESERVICES_INC_NATIVE_NS_CONFIG_PARSER_IF_H_ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_endianess.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_endianess.h
new file mode 100755
index 0000000..33fa858
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_endianess.h
@@ -0,0 +1,192 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_endianess.h
+ * @brief \~english Provide api for convert value
+ */
+
+#ifndef NS_NATIVESERVICES_INC_UTILITY_NS_ENDIANESS_H_ // NOLINT (build/header_guard)
+#define NS_NATIVESERVICES_INC_UTILITY_NS_ENDIANESS_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup utility
+ * @ingroup framework_unified
+ * @{
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the UI_16(unsigned 16bit) value to big-endian.
+/// \~english @param [in] f_value
+/// UI_16 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function converts the UI_16(unsigned 16bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+UI_16 ConvertEndian_UI16(UI_16 f_value); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the SI_16(signed 16bit) value to big-endian.
+/// \~english @param [in] f_value
+/// SI_16 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function converts the SI_16(signed 16bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_16 ConvertEndian_SI16(SI_16 f_value); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the UI_32(unsigned 32bit) value to big-endian.
+/// \~english @param [in] f_value
+/// UI_32 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function convers the UI_32(unsigned 32bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 ConvertEndian_UI32(UI_32 f_value); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the SI_32(signed 32bit) value to big-endian.
+/// \~english @param [in] f_value
+/// SI_32 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function convers the SI_32(signed 32bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 ConvertEndian_SI32(SI_32 f_value); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the UI_64(unsigned 64bit) value to big-endian.
+/// \~english @param [in] f_value
+/// UI_64 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function convers the UI_64(unsigned 64bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+UI_64 ConvertEndian_UI64(UI_64 f_value); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Convert the SI_64(signed 64bit) value to big-endian.
+/// \~english @param [in] f_value
+/// SI_64 - The value to be converted
+/// \~english @retval the big-endian value of the input param f_value
+///
+/// \~english @par Prerequisite
+/// - NULL
+/// \~english @par Change of internal state
+/// - NULL
+/// \~english @par Conditions of processing failure
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function convers the SI_64(signed 64bit) value to big-endian.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_64 ConvertEndian_SI64(SI_64 f_value); // NOLINT (readability/nolint)
+
+#endif // NS_NATIVESERVICES_INC_UTILITY_NS_ENDIANESS_H_ // NOLINT (build/header_guard)
+
+/** @}*/ // end of utility
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_eventlogger.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_eventlogger.h
new file mode 100755
index 0000000..ab96e11
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_eventlogger.h
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief structures used by ns_logger.cpp for event and counter logging
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ * @brief \~english structures used by ns_logger.cpp for event and counter logging
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup Native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_EVENTLOGGER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_EVENTLOGGER_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// event log messageQ name
+#define EVENTLOG_MSGQ_NAME "/EvntLogQue"
+
+typedef enum _Datatype_ {
+ COMMON,
+ EVENT_SPECIFIC
+} Datatype;
+
+typedef enum _SystemPhase_ {
+ STARTUP = 0x21,
+ NORMAL = 0x22,
+ SHUTDOWN = 0x23,
+} SystemPhase;
+
+typedef enum _NStoSS_LOGGERSERVICEPROTOCOL {
+ SS_MSG_EVTLOG = 6463, // NS to Event Logger Thread
+ SS_MSG_LOGGERCNT, // NS to Event logger Thread
+ SS_MSG_LOGGER_CNT_EVTLOG // NS to event logger thread
+} NStoSS_loggerserviceprotocol;
+
+// Note: Don't remove #paragma pack(1) this is required for the
+// ARM processor, forces data structures to be on a byte boundary
+// all messages should be place in between #pragma pack(1) and #pragma pack()
+#pragma pack(1)
+typedef struct _stLogEvent_ {
+ UI_32 ts;
+ UI_8 grp_ID;
+ UI_8 event_id;
+ UI_8 data[4];
+ SystemPhase phase;
+ UI_16 cnt_ID;
+ Datatype typeofdata;
+} st_LogEvent;
+#pragma pack(0)
+
+#pragma pack(1)
+typedef struct _stLogCount_ {
+ SystemPhase phase;
+ UI_16 cnt_id;
+} st_LogCount;
+#pragma pack(0)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NATIVESERVICES_EVENTLOGGER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_logger_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_logger_if.h
new file mode 100755
index 0000000..a1ca9ef
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_logger_if.h
@@ -0,0 +1,1646 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file
+/// Declares the external APIs to Logger.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ * @brief \~english Declares the external APIs to Logger.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup Native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_LOGGER_IF_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_LOGGER_IF_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FRAMEWORKUNIFIEDLOG_MSGQ_NAME "/NSLog"
+#define FRAMEWORKUNIFIEDLOG_SHAREDMEM_NAME "/frameworkunified_debug.log.1"
+#define FRAMEWORKUNIFIEDLOG_SHAREDMEM_SIZE 5242880 // 5MB
+
+#define MASTER_ZONE_COUNT 16U
+
+#include <native_service/loglibrarylog_if.h>
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief typedef of ZONE
+///////////////////////////////////////////////////////////////////////////////
+typedef UI_32 TFrameworkunifiedZone;
+// Note: if the BITS_IN_TZONE macro is getting modified do the corresponding changes
+// in GET_ZONE_INDEX and GET_ZONE_BIT_MASK
+#define BITS_IN_BYTE (8U)
+#define BITS_IN_TZONE ((UI_32 )(sizeof( TFrameworkunifiedZone ) * BITS_IN_BYTE))
+#define TZONE_COUNT ((UI_32)MASTER_ZONE_COUNT)
+#define BITS_IN_ZONE_MASK ((UI_32)(BITS_IN_TZONE * TZONE_COUNT))
+#define DEBUG_ZONE_COUNT BITS_IN_ZONE_MASK
+
+#define ZONE_MASK_ARRAY_ELTS ((UI_32)TZONE_COUNT)
+
+#define USER_ZONES_COUNT BITS_IN_ZONE_MASK -10
+
+#define ZONE_TEXT_SIZE 24
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief Array of mask options
+///////////////////////////////////////////////////////////////////////////////
+typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
+
+typedef enum _TFrameworkunifiedLoggerSeverity {
+ FRAMEWORKUNIFIED_SEVERITY_LOW = 0x0, /// <all enable(default)
+ FRAMEWORKUNIFIED_SEVERITY_DEBUG2, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
+ FRAMEWORKUNIFIED_SEVERITY_DEBUG1, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
+ FRAMEWORKUNIFIED_SEVERITY_INFO, /// <enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
+ FRAMEWORKUNIFIED_SEVERITY_WARN, /// <enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
+ FRAMEWORKUNIFIED_SEVERITY_ERROR, /// <enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
+ FRAMEWORKUNIFIED_SEVERITY_FATAL, /// <enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
+ FRAMEWORKUNIFIED_SEVERITY_ALWAYS /// <enable FRAMEWORKUNIFIEDLOG_ALWAYS()
+} TFrameworkunifiedLoggerSeverity;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG parameter
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _FRAMEWORKUNIFIEDLOGPARAM {
+ UI_8 uiLogOptions; /// <output options (ref. NS_LoggingMethod_t )
+ CHAR cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE]; /// <mask text ZONE_TEXT_10 ... ZONE_TEXT_n
+ TFrameworkunifiedZoneMask uiZoneMask; /// <mask options ZONEMASK(10)...ZONEMASK(n) (ref. TFrameworkunifiedZone)
+ TFrameworkunifiedLoggerSeverity eSeverity; /// <severity level(ref. TFrameworkunifiedLoggerSeverity)
+} FRAMEWORKUNIFIEDLOGPARAM, *LPFRAMEWORKUNIFIEDLOGPARAM;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG output direction
+/// \note LMSGQ and LSLOGGER are disabled
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _NS_LOGGER_METHODS {
+ LPRINT = 0x01, /// <Print to the console(similar to printf)
+ LMSGQ = 0x02, /// <Disabled
+ LSLOGGER = 0x04, /// <Disabled
+ LSHAREDMEM = 0x08 /// <Output to shared memory. this is the default logging method.
+} NS_LoggingMethod_t;
+// Note: Don't remove #paragma pack(1) this is required for the
+// ARM processor, forces data structures to be on a byte boundary
+// all messages should be place in between #pragma pack(1) and #pragma pack()
+#pragma pack(1) // *** DO NOT REMOVE ***
+
+typedef struct tag_Change_Log_Parameters {
+ TFrameworkunifiedZoneMask uiZoneMask;
+ UI_8 uiLogOptions;
+ TFrameworkunifiedLoggerSeverity eSeverity;
+} CHANGELOGPARAMS;
+
+#pragma pack(0) // *** DO NOT REMOVE ***
+
+// RCS related
+#define NS_RCS_LOGGER_PLUGIN_Q "/NsRcsLoggerPlugin"
+
+typedef enum _NS_RCS_LOGGER_SETTINGS {
+ NS_RCS_LOGGER_PLUGIN_ADD_APPNAME = 0x500,
+} NS_RCS_LOGGER_SETTINGS;
+
+typedef struct _TNS_EnableRcsLogging {
+ CHAR m_cAppName[MAX_NAME_SIZE_APP];
+ BOOL m_bEnable;
+} TNS_EnableRcsLogging;
+
+// End RCS related
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLog
+/// \~english @par Brief
+/// Writes a log to the Native Services logging mechanism
+/// \~english @param [in] p_lLine_i
+/// const UI_16 - Line number(0 to 65535) that this log was was written on
+/// \~english @param [in] f_uiZoneIndex
+/// const UI_64 - Mask value(0 to 511) to check against
+/// \~english @param [in] p_pstrClassName_i
+/// PCSTR - Name of the class or method where the log was written
+/// \~english @param [in] lpszFormat
+/// PCSTR - string similar to that of a printf statement
+/// \~english @param [in] arg list
+/// ... - Data arguments(option)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// FRAMEWORKUNIFIEDLOG parameter is set throuth NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
+/// But in case of FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE real-time log and/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog /will not print out
+/// \~~english @par
+/// - in the following conditions,real-time log will not print out:
+/// - log output way is LPRINT but f_uiZoneIndex parameter is in [96 to 127]
+/// - log output way is LPRINT but real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_open system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_send system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and socket system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and setsockopt system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and bind system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and inet_addr system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and sendto system call failed(retry 5 times)
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE
+/// \~english @par
+/// in the following conditions /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/ log can not be print out
+/// - log file for parameter f_uiZoneIndex and
+/// log file for parameter FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter can not be found
+/// - the ring_buffer of log file(log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when
+/// log file is not exited) for parameter f_uiZoneIndex is not opened (CNSRingBuffer::IsOpen())
+/// - the write-in operation to ring_buffer of log file for parameter f_uiZoneIndex
+/// (log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when file is not exited) is failed
+/// \~english @par Detail
+/// Writes a log to the Native Services logging mechanism
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLog(const UI_16 p_lLine_i, // Line number where message was generated
+ const UI_16 f_uiZoneIndex,
+ PCSTR p_pstrClassName_i,
+ PCSTR lpszFormat,
+ ...)
+#ifdef __GNUC__
+__attribute__((format(printf, 4, 5)))
+#endif
+; // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLog0
+/// \~english @par Brief
+/// Writes a log to the Native Services logging mechanism
+/// \~english @param [in] p_lLine_i
+/// const UI_16 - Line number(0 to 65535) that this log was was written on
+/// \~english @param [in] f_uiZoneIndex
+/// const UI_64 - Mask value(0 to 511) to check against
+/// \~english @param [in] p_pstrClassName_i
+/// PCSTR - Name of the class or method where the log was written
+/// \~english @param [in] lpszFormat
+/// PCSTR - string similar to that of a printf statement
+/// \~english @param [in] arg list
+/// ... - Data arguments(option)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// FRAMEWORKUNIFIEDLOG parameter is set throuth NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
+/// But in case of FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE real-time log and/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog /will not print out
+/// \~~english @par
+/// - in the following conditions,real-time log will not print out:
+/// - log output way is LPRINT but f_uiZoneIndex parameter is in [96 to 127]
+/// - log output way is LPRINT but real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_open system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_send system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and socket system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and setsockopt system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and bind system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and inet_addr system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and sendto system call failed(retry 5 times)
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE
+/// \~english @par
+/// in the following conditions /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/ log can not be print out
+/// - log file for parameter f_uiZoneIndex and
+/// log file for parameter FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter can not be found
+/// - the ring_buffer of log file(log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when
+/// log file is not exited) for parameter f_uiZoneIndex is not opened (CNSRingBuffer::IsOpen())
+/// - the write-in operation to ring_buffer of log file for parameter f_uiZoneIndex
+/// (log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when file is not exited) is failed
+/// \~english @par Detail
+/// Writes a log to the Native Services logging mechanism
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLog0(const UI_16 p_lLine_i, // Line number where message was generated
+ const UI_16 f_uiZoneIndex,
+ PCSTR p_pstrClassName_i,
+ PCSTR lpszFormat);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogTime
+/// \~english @par Brief
+/// Print out real-time in log using Native Service mechanism
+/// \~english @param [in] f_uiZoneIndex
+/// const UI_64 - Mask value(0 to 511) to check against
+/// \~english @param [in] lpszFormat
+/// PCSTR - string similar to that of a printf statement
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// parameter FRAMEWORKUNIFIEDLOG has already set using NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
+/// But in case of FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE real-time log and/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog /will not print out
+/// \~~english @par
+/// - in the following conditions,real-time log will not print out:
+/// - log output way is LPRINT but f_uiZoneIndex parameter is in [96 to 127]
+/// - log output way is LPRINT but real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_open system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_send system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and socket system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and setsockopt system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and bind system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and inet_addr system call failed
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and sendto system call failed(retry 5 times)
+/// - log output way is LPRINT,real-time log output setting is
+/// FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE
+/// \~english @par
+/// in the following conditions /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/ log can not be print out
+/// - log file for parameter f_uiZoneIndex and
+/// log file for parameter FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter can not be found
+/// - the ring_buffer of log file(log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when
+/// log file is not exited) for parameter f_uiZoneIndex is not opened (CNSRingBuffer::IsOpen())
+/// - the write-in operation to ring_buffer of log file for parameter f_uiZoneIndex
+/// (log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when file is not exited) is failed
+/// \~english @par Detail
+/// Print out real-time in log using Native Service mechanism
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogTime(const UI_16 f_uiZoneIndex,
+ PCSTR lpszFormat);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogData
+/// \~english @par Brief
+/// log print-out function
+/// \~english @param [in] f_uiZoneIndex
+/// const UI_64 - Mask value(0 to 511) to check against
+/// \~english @param [in] data
+/// PCSTR -log print-out data
+/// \~english @param [in] size (0 to ULONG_MAX)
+/// UI_32 - data size (0 to ULONG_MAX)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// FRAMEWORKUNIFIEDLOG has already set by NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// -Process will failed under following conditions:
+/// -Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
+/// But the set value is FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE
+/// -the log file for f_uiZoneIndex and log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter
+/// are both not found
+/// - the ring_buffer of log file for f_uiZoneIndex(using log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG
+/// if file is not exited)is not opened (CNSRingBuffer::IsOpen())
+/// - write operation on ring_buffer of log file for f_uiZoneIndex
+/// (using log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG if file is not exited)is failed
+/// \~english @par Detail
+/// the difference bewteen NsLog and NsLogData:
+/// - NsLog()will print out real-time log
+/// NsLogData() will not print out real-time log but noly print out logs under /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/
+/// - NsLog() will add ZoneIndex, process name, real-time info to log but
+/// NsLogData() only print out log
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogData(const UI_16 f_uiZoneIndex,
+ PCSTR data,
+ UI_32 size);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetFrameworkunifiedLogParams
+/// \~english @par Brief
+/// Sets the FRAMEWORKUNIFIEDLOG parameter of your application\process based on
+/// the value passed in.
+/// \~english @param [in] p_FrameworkunifiedLogParams
+/// FRAMEWORKUNIFIEDLOGPARAM * - FRAMEWORKUNIFIEDLOG parameter in process
+/// \~english @par
+/// FRAMEWORKUNIFIEDLOGPARAM Structure
+/// \~english @code
+/// typedef struct _FRAMEWORKUNIFIEDLOGPARAM {
+/// UI_8 uiLogOptions; // output options (ref. NS_LoggingMethod_t )
+/// CHAR cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE]; // mask text ZONE_TEXT_10 ... ZONE_TEXT_n
+/// // mask options ZONEMASK(10)...ZONEMASK(n) (ref. TFrameworkunifiedZone)
+/// TFrameworkunifiedZoneMask uiZoneMask;
+/// TFrameworkunifiedLoggerSeverity eSeverity; // severity level(ref. TFrameworkunifiedLoggerSeverity)
+/// } FRAMEWORKUNIFIEDLOGPARAM, *LPFRAMEWORKUNIFIEDLOGPARAM;
+/// @endcode
+/// \~english @par
+/// TFrameworkunifiedZoneMask Array
+/// \~english @code
+/// typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
+/// @endcode
+/// \~english @par
+/// TFrameworkunifiedZone typedef
+/// \~english @code
+/// UI_32 TFrameworkunifiedZone; // 32bit
+/// @endcode
+/// \~english @par
+/// TFrameworkunifiedLoggerSeverity Enum
+/// \~english @code
+/// typedef enum _TFrameworkunifiedLoggerSeverity {
+/// FRAMEWORKUNIFIED_SEVERITY_LOW = 0x0, // all enable(default)
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG2, // enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG1, // enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_INFO, // enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_WARN, // enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_ERROR, // enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_FATAL, // enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// FRAMEWORKUNIFIED_SEVERITY_ALWAYS // enable FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// } TFrameworkunifiedLoggerSeverity;
+/// @endcode
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - process will not conducted when p_FrameworkunifiedLogParams is NULL.
+/// \~english @par Detail
+/// set the FRAMEWORKUNIFIEDLOG of Application using the parameter set in parameter\n
+/// ZONE_NS_WAR(8), ZONE_NS_ERR(9) will be put-out forcely in the function\n
+/// log will be print out when ForceOutput is set.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetFrameworkunifiedLogParams(FRAMEWORKUNIFIEDLOGPARAM *p_FrameworkunifiedLogParams);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetProcessName
+/// \~english @par Brief
+/// Sets the name of your application\process based on
+/// the value passed in.
+/// \~english @param [in] p_strProcessName_i
+/// PCSTR - name of your application process.(string array ended by NULL below 20byte)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// The specified Aplication names are not set in the following cases:
+/// - When the Application name specified in the arguments (p_strProcessName_i) is NULL
+/// - When the Application name specified in the arguments (p_strProcessName_i) is a NULL termination character string of 21 bytes or more
+/// \~english @par Detail
+/// -name in prarameter should be string array(less than 20byte) ended by NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetProcessName(PCSTR p_strProcessName_i);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetControlMask
+/// \~english @par Brief
+/// Sets the control word that should be logged
+/// \~english @param [in] p_ulNSLogControl_i
+/// TFrameworkunifiedZoneMask - Set mask to the new value.
+/// \~english @par
+/// TFrameworkunifiedZoneMask Array
+/// \~english @code
+/// typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
+/// @endcode
+/// \~english @par
+/// TFrameworkunifiedZone typedef
+/// \~english @code
+/// UI_32 TFrameworkunifiedZone; // 32bit
+/// @endcode
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// -process will not be conducted when p_ulNSLogControl_i is none
+/// \~english @par Detail
+/// -Sets the control word that should be logged
+/// zone mask(16) will be rewrited using parameter value
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NsLogGetControlMask
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetControlMask(TFrameworkunifiedZoneMask p_ulNSLogControl_i);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogIsZoneSet
+/// \~english @par Brief
+/// check wheather the FRAMEWORKUNIFIEDLOG ZONE is set by your application process.
+/// \~english @param [in] set_zone
+/// UI_32 - checking zone_index
+/// \~english @retval TRUE zone is enable
+/// \~english @retval FALSE zone is disable
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// If the parameter of set_zone is outside(set_zone < 0 or 511 > set_zone), it will return FALSE.
+/// \~english @par Detail
+/// check wheather the FRAMEWORKUNIFIEDLOG ZONE is set by your application process.\n
+/// zone parameter first 4bit(0 to 15)is the index of zone mask array\n
+/// second 5bit(0 to 31) is showing bit position of mask(9bit,511 for the most)\n
+/// True will be returned when bit for zone mask is set as 1
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NsLogIsZoneSet(UI_32 set_zone);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetControlMask
+/// \~english @par Brief
+/// Get the control word that you currently have set.
+/// \~english @param [out] p_Zonemask_i
+/// TFrameworkunifiedZoneMask - current mask value.
+/// \~english @par
+/// TFrameworkunifiedZoneMask Array
+/// \~english @code
+/// typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
+/// @endcode
+/// \~english @par
+/// TFrameworkunifiedZone typedef
+/// \~english @code
+/// UI_32 TFrameworkunifiedZone; // 32bit
+/// @endcode
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - If p_Zonemask_i is NULL, no operation is performed.
+/// \~english @par Detail
+/// Get all 16 zone mask.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NsLogSetControlMask
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogGetControlMask(TFrameworkunifiedZoneMask p_Zonemask_i);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetLogMethod
+/// \~english @par Brief
+/// Sets the logging place, LPRINT, LSHAREDMEM or any combination of these.
+/// If this is never called the default is LSHAREDMEM.
+/// \~english @param [in] p_eMethod_i
+/// UI_8 - Where you would like to log your data.
+/// \~english @par
+/// NS_LoggingMethod_t Enum
+/// \~english @code
+/// typedef enum _NS_LOGGER_METHODS {
+/// LPRINT = 0x01, // Print to the console(similar to printf)
+/// LMSGQ = 0x02, // Disabled
+/// LSLOGGER = 0x04, // Disabled
+/// LSHAREDMEM = 0x08 // Output to shared memory. this is the default logging method.
+/// } NS_LoggingMethod_t;
+/// @endcode
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// -switch the out-put place for NsLog API
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// Sets the logging place, LPRINT, LSHAREDMEM or any combination of these.
+/// If this is never called the default is LSHAREDMEM.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NsLogGetLogMethod
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetLogMethod(UI_8 p_eMethod_i);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetLogMethod
+/// \~english @par Brief
+/// Get the logging method.
+/// \~english @param None
+/// \~english @retval - return the way you log your data.
+/// UI_8 - Log data type(NS_LoggingMethod_t Enum).
+/// \~english @par
+/// NS_LoggingMethod_t Enum
+/// \~english @code
+/// typedef enum _NS_LOGGER_METHODS {
+/// LPRINT = 0x01, // Print to the console(similar to printf)
+/// LMSGQ = 0x02, // Disabled
+/// LSLOGGER = 0x04, // Disabled
+/// LSHAREDMEM = 0x08 // Output to shared memory. this is the default logging method.
+/// } NS_LoggingMethod_t;
+/// @endcode
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// Invoke callback function to get the logging method.\n
+/// If callback function is null and expectedCalls is '0',
+/// using default SetSeparator function to get the logging method. \n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogSetLogMethod
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_8 NsLogGetLogMethod(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogInitialize
+/// \~english @par Brief
+/// Initialize the log level and real-time log out-put setting
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// if the getting process of FRAMEWORKUNIFIEDLOG CONFIG file data is failed
+/// \~english @par Detail
+/// Initialize the log level and real-time log out-put setting
+/// if the getting process of FRAMEWORKUNIFIEDLOG CONFIG file data is failed,log
+/// level and real-time log out-put setting will not be initialized
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogInitialize(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetFrameworkunifiedLogFlag
+/// \~english @par Brief
+/// set LogLevel of FRAMEWORKUNIFIEDLOG flag
+/// \~english @param [in] flag_id
+/// UI_8 - index for FRAMEWORKUNIFIEDLOG flag(0 to FLAG_LIST(declared in FRAMEWORKUNIFIEDLOG CONFIG file)
+/// \~english @param [in] mode
+/// UI_8 - LogLevel
+/// \~english @par
+/// avaliable LogLevel
+/// - FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE
+/// - FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// in the following conditions FRAMEWORKUNIFIEDLOG flag will not be set
+/// - mode is not FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE, FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG
+/// - the getting process of FRAMEWORKUNIFIEDLOG CONFIG file is failed(ns_logger_frameworkunifiedlog_xxx.cfg)
+/// - flag_id is not declared in FRAMEWORKUNIFIEDLOG CONFIG file
+/// \~english @par Detail
+/// set loglevel for specific FRAMEWORKUNIFIEDLOG flag
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogGetFrameworkunifiedLogFlag
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetFrameworkunifiedLogFlag(UI_8 flag_id, UI_8 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetFrameworkunifiedLogFlag
+/// \~english @par Brief
+/// get LogLevel of FRAMEWORKUNIFIEDLOG flag
+/// \~english @param [in] flag_id
+/// UI_8 - index for FRAMEWORKUNIFIEDLOG flag(0 to FLAG_LIST(declared in FRAMEWORKUNIFIEDLOG CONFIG file)
+/// \~english @param [out]mode
+/// UI_8 - LogLevel value
+/// \return none
+/// void - there is no return.
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusFail any sort of error occurred
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// -parameter mode is NULL[eFrameworkunifiedStatusFail]
+/// -flag_id is not declared in FRAMEWORKUNIFIEDLOG CONFIG file [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// get FRAMEWORKUNIFIEDLOG flage for specific flag_id
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogSetFrameworkunifiedLogFlag
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NsLogGetFrameworkunifiedLogFlag(UI_8 flag_id, UI_8 *mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetRealtimeLog
+/// \~english @par Brief
+/// real-time log output setting
+/// \~english @param [in] mode
+/// UI_8 - set mode for Real time log
+/// \~english @par
+/// available setting for real-time log output
+/// default value is REALTIME_LOG in FRAMEWORKUNIFIEDLOG CFG file
+/// (FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF when FRAMEWORKUNIFIEDLOG CFG file get failed)
+/// \~english @code
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART 1 // : UARTOUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB 2 // : USB OUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE 0x82 // : USB OFF
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER 3 // : Ether OUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF 0 // : ALL OFF
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE 0xFF // : FREEZE
+/// @endcode
+/// \~english @retval none
+/// void - there is no return
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// -mode is not in FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_XXX above
+/// \~english @par Detail
+/// set the real-time log output using the setting value.\n
+/// need to reboot during ROM start in order to switch to Ethernet output\n
+/// /nv/BS/ns/framework_unified/rwdata/frameworkunifiedlog.ether file will be generated
+/// when mode FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER /nv/BS/ns/framework_unified/rwdata/frameworkunifiedlog.ether\n
+/// and /nv/BS/ns/framework_unified/rwdata/frameworkunifiedlog.ether file will be delated when mode is not FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogGetRealtimeLog
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetRealtimeLog(UI_8 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetRealtimeLog
+/// \~english @par Brief
+/// get the setting of real-time log output
+/// \~english @param [out] mode
+/// UI_8 * -the setting of real-time log output
+/// \~english @par
+/// available settings of real-time log output
+/// default value is REALTIME_LOG in FRAMEWORKUNIFIEDLOG CFG file
+/// (FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF when FRAMEWORKUNIFIEDLOG CFG file get failed)
+/// \~english @code
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART 1 // : UARTOUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB 2 // : USB OUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE 0x82 // : USB OFF
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER 3 // : Ether OUT
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF 0 // : ALL OFF
+/// #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE 0xFF // : FREEZE
+/// @endcode
+/// \~english @retval none
+/// void - there is no return
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - cannot get when mode is NULL
+/// -FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF will be returned when the approach
+/// of FRAMEWORKUNIFIEDLOG CONFIG file (ns_logger_frameworkunifiedlog_xxx.cfg)is failed
+/// \~english @par Detail
+/// get the setting of real-time log output
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogSetRealtimeLog
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogGetRealtimeLog(UI_8 *mode);
+
+// Deprecated API: Not use.
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetSeverity
+/// \~english @par Brief
+/// Set log severity level
+/// \~english @param [in] p_eLogSeverity_i
+/// TFrameworkunifiedLoggerSeverity - Log severity
+/// \~english @par
+/// TFrameworkunifiedLoggerSeverity Enum
+/// \~english @code
+/// typedef enum _TFrameworkunifiedLoggerSeverity {
+/// FRAMEWORKUNIFIED_SEVERITY_LOW = 0x0, /// <all enable(default)
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG2, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG1, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_INFO, /// <enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_WARN, /// <enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_ERROR, /// <enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_FATAL, /// <enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// FRAMEWORKUNIFIED_SEVERITY_ALWAYS /// <enable FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// } TFrameworkunifiedLoggerSeverity;
+/// @endcode
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(p_eLogSeverity_i).
+/// \~english @par Detail
+/// Invoke callback function to set log severity.\n
+/// If callback function is null and expectedCalls is '0', using default function to set log severity.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogGetSeverity
+////////////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetSeverity(TFrameworkunifiedLoggerSeverity p_eLogSeverity_i);
+
+// Deprecated API: Not use.
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetSeverity
+/// \~english @par Brief
+/// Get the log severity.
+/// \~english @param none
+/// \~english @retval Log Severity
+/// TFrameworkunifiedLoggerSeverity - Log severity.
+/// \~english @par
+/// TFrameworkunifiedLoggerSeverity Enum
+/// \~english @code
+/// typedef enum _TFrameworkunifiedLoggerSeverity {
+/// FRAMEWORKUNIFIED_SEVERITY_LOW = 0x0, /// <all enable(default)
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG2, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_DEBUG1, /// <enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_INFO, /// <enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_WARN, /// <enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_ERROR, /// <enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
+/// FRAMEWORKUNIFIED_SEVERITY_FATAL, /// <enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// FRAMEWORKUNIFIED_SEVERITY_ALWAYS /// <enable FRAMEWORKUNIFIEDLOG_ALWAYS()
+/// } TFrameworkunifiedLoggerSeverity;
+/// @endcode
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// none
+/// \~english @par Detail
+/// Invoke callback function to get log severity.\n
+/// If callback function is null and expectedCalls is '0', using default function to get log severity.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogSetSeverity
+////////////////////////////////////////////////////////////////////////////////////////////
+TFrameworkunifiedLoggerSeverity NsLogGetSeverity(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLog_EvtCnt
+/// \~english @par Brief
+/// Event and count logger.
+/// \~english @param [in] @param [in] Cnt_Id
+/// UI_16 - ID of counter from comm layer
+/// \~english @param [in] Evt_Id
+/// UI_16 - ID of Event from comm layer
+/// \~english @param [in] n
+/// UI_8 - number of variable arguments inputted
+/// \~english @param [in] arg list
+/// ... - Data arguments(option)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(Cnt_Id).
+/// - It is an incorrect value(Evt_Id).
+/// - It is an incorrect value(n).
+/// \~english @par Detail
+/// Invoke callback function with argument 'Cnt_Id', 'Evt_Id', 'n' to log.\n
+/// If callback function is null and expectedCalls is '0', using default SetSeparator function to log. \n
+/// In other situation, match and log 'Cnt_Id', 'Evt_Id', 'n'.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+// Deprecated API: Not use.
+void NsLog_EvtCnt( // Line number where message was generated
+ UI_16 Cnt_Id,
+ UI_16 Evt_Id, UI_8 n,
+ ...);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLog_Evt
+/// \~english @par Brief
+/// Event logger mechanism.(Send data to SS event logger Queue)
+/// \~english @param [in] Evt_Id
+/// UI_16 - ID of Event from comm layer
+/// \~english @param [in] nu
+/// UI_8 - number of variable arguments inputted
+/// \~english @param [in] ...
+/// ... - Data arguments
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - process nothing when Evt_id is in [0 to 0xFF]
+/// - process nothing when nu is not 1 or 4
+/// \~english @par Detail
+/// -send the log event queue to SS(logger mechanism Event)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+// Deprecated API: Not use.
+void NsLog_Evt(UI_16 Evt_Id, UI_8 nu, ...);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLog_Cnt
+/// \~english @par Brief
+/// Counter logger mechanism.(Send data to SS event logger Queue)
+/// \~english @param [in] Cnt_Id
+/// UI_16 - ID of Counter from comm layer
+/// \~english @param [in] nu
+/// UI_8 - number of variable arguments inputted
+/// \~english @param [in] ...
+/// ... - Data arguments
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - process nothing when Cnt_Id is 0
+/// - process nothing when nu is not 0 or 1
+/// \~english @par Detail
+/// send the log event queue to SS(logger mechanism counter)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+// Deprecated API: Not use.
+void NsLog_Cnt(UI_16 Cnt_Id, UI_8 nu, ...); // Not to use.
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogDetermineLogMethod
+/// \~english @par Brief
+/// Determines the control log method based on the string passed.
+/// If the string passed doesn't match any of the key words:
+/// slogger or msgr or console the method will return a value of
+/// zero. This string may be in the form of the following:
+/// "msgq|console" would cause the output to go to both the NSLog
+/// message queue and the console.
+/// \~english @param [in] output_type
+/// PCSTR - The key words:
+/// \~english @retval 1 ... 0xF Success
+/// \~english @retval 0 the string passed doesn't match any of the key words
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// the string passed doesn't match any of the key words
+/// \~english @par Detail
+/// mask value retruned from application can be used as parameter in NsLogSetLogMethod()
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_8 NsLogDetermineLogMethod(PCSTR output_type);
+
+// Unused API.
+// VOID NsLogEnableRcsLogging(BOOL f_bRCSEnableLogging);
+
+// Private API.
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogGetZoneTextList
+/// \~english @par Brief
+/// Get the zone data list.
+/// \~english @param [out] f_cZoneList
+/// CHAR [][ZONE_TEXT_SIZE] - zone text list(0 ... 511)
+/// \~english @par
+/// PUI_32 - Pointer to preallocated array of CHAR cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE];
+/// \~english @retval none
+/// VOID - There is no return
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(f_cZoneList) or f_cZoneList is empty.
+/// - Some error occur when get value from f_cZoneList
+/// \~english @par Detail
+/// Invoke callback function to get zone text list.\n
+/// If callback function is null and expectedCalls is '0', using default function to get zone text list.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NsLogSetZones
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID NsLogGetZoneTextList(CHAR f_cZoneList[][ZONE_TEXT_SIZE]);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogSetZones
+/// \~english @par Brief
+/// set FRAMEWORKUNIFIEDLOG ZONE
+/// \~english @param [in] f_uiZoneCount
+/// UI_32 - number of zone
+/// \~english @param [in] ...
+/// arg_list - zone list (0 ... 511)
+/// \~english @retval none
+/// void - there is no return.
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - zone value will not over 512
+/// \~english @par Detail
+/// set the specific bit to existed zone mask\n
+/// first 4bit(0 to 15) in zone is the index of zone mask array\n
+/// second 5bit(0 to 31)set the 9bit which shows the bit position of mask(blew 511)\n
+/// eg:in the case of setting three zones=31,30,29, function should be called like NsLogSetZones(3,31,30,29) \n
+/// operation may not be right when parameter shows in arg_list differs with array num in f_uiZoneCount
+///
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Set Get
+/// \~english @see
+/// none
+/////////////////////////////////////////////////////////////////////////////////////
+void NsLogSetZones(UI_32 f_uiZoneCount, ...);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogParseZones
+/// \~english @par Brief
+/// Parse the FRAMEWORKUNIFIEDLOG ZONE.
+/// \~english @param [out] p_FrameworkunifiedLogParams
+/// FRAMEWORKUNIFIEDLOGPARAM * - Input/output FRAMEWORKUNIFIEDLOG parameter
+/// \~english @param [in] f_uiZoneCount
+/// UI_32 - Zone setting
+/// \~english @param [in] ...
+/// arg_list - Zone lists (zone values are 0 to 511)
+/// \~english @par
+/// FRAMEWORKUNIFIEDLOGPARAM structures
+/// \~english @code
+/// typedef struct _FRAMEWORKUNIFIEDLOGPARAM {
+/// UI_8 uiLogOptions; // Log output location (ref NS_LoggingMethod_t)
+/// CHAR cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE]; // ZONE_TEXT_10 ... ZONE_TEXT_n
+/// TFrameworkunifiedZoneMask uiZoneMask; // ZONEMASK(10)...ZONEMASK(n) (ref TFrameworkunifiedZone)
+/// TFrameworkunifiedLoggerSeverity eSeverity; // Logging level (ref TFrameworkunifiedLoggerSeverity)
+/// } FRAMEWORKUNIFIEDLOGPARAM, *LPFRAMEWORKUNIFIEDLOGPARAM;
+/// @endcode
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// In the FRAMEWORKUNIFIEDLOG parameter (p_FrameworkunifiedLogParams) specified in the arguments,\n
+/// add (or) all masked values of the zone lists specified by the arguments.
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// none
+/////////////////////////////////////////////////////////////////////////////////////
+void NsLogParseZones(FRAMEWORKUNIFIEDLOGPARAM *p_FrameworkunifiedLogParams, UI_32 f_uiZoneCount, ...);
+
+// Unused API.
+// VOID NsRcsSendTraceData(PCHAR f_pData, UI_32 f_len);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSLogGetFrameworkunifiedlogFileTotalNum
+/// \~english @par Brief
+/// get total number of log file
+/// \~english @retval num
+/// UI_32 - Total numger of frameworkunifiedlog files.
+/// \~english @par Prerequisite
+/// set log file using NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// get total number of log file
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 NSLogGetFrameworkunifiedlogFileTotalNum(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSLogGetFrameworkunifiedlogFileName
+/// \~english @par Brief
+/// get the name of log file
+/// \~english @param [in] index
+/// UI_32 - Index of a list of frameworkunifiedlog file names.(0 to NSLogGetFrameworkunifiedlogFileTotalNum()-1)
+/// \~english @retval file name -file with specific index is exsisted
+/// \~english @retval NULL -file with specific index is not exsisted
+/// \~english @par Prerequisite
+/// set log file using NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// file with specific index is not exsisted
+/// \~english @par Detail
+/// get the file name with specific index is not exsisted
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No macth
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR NSLogGetFrameworkunifiedlogFileName(UI_32 index);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSLogGetFrameworkunifiedlogFileName
+/// \~english @par Brief
+/// get index of log file
+/// \~english @param [in] filename
+/// PCSTR - Name of frameworkunifiedlog file.
+/// \~english @retval 0 log file specific logfile is not exsisted
+/// \~english @retval index of log file specific logfile is exsisted
+/// \~english @par Prerequisite
+/// set log file using NsLogSetFrameworkunifiedLogParams
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// process nothing when file name is NULL
+/// process nothing when file name is not exsisted
+/// \~english @par Detail
+/// get index of log file
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+int NSLogGetFrameworkunifiedlogIndex(PCSTR filename);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsForceClose
+/// \~english @par Brief
+/// clear log forcely.
+/// \~english @retval none
+/// return void
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// -clear log forcely.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID NsForceClose(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief extern FRAMEWORKUNIFIEDLOG parameter
+///////////////////////////////////////////////////////////////////////////////
+/// Global variable that's used by the Native Services Logger.
+/// An application will setup this variable in their main,
+/// values are user defined and provide user control of what
+/// should and shouldn't get logged.
+/// \code
+/// FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams =
+/// {
+/// FRAMEWORKUNIFIEDLOGOPTIONS,
+/// {
+/// ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+/// ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+/// ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+/// ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+/// ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+/// ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+/// ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+/// ZONE_TEXT_31, ZONE_TEXT_32, ZONE_TEXT_33,
+/// ZONE_TEXT_34, ZONE_TEXT_35, ZONE_TEXT_36,
+/// ZONE_TEXT_37, ZONE_TEXT_38, ZONE_TEXT_39,
+/// ZONE_TEXT_40, ZONE_TEXT_41, ZONE_TEXT_42,
+/// ZONE_TEXT_43, ZONE_TEXT_44, ZONE_TEXT_45,
+/// ZONE_TEXT_46, ZONE_TEXT_47, ZONE_TEXT_48,
+/// ZONE_TEXT_49, ZONE_TEXT_50, ZONE_TEXT_51,
+/// ZONE_TEXT_52, ZONE_TEXT_53, ZONE_TEXT_54,
+/// ZONE_TEXT_55
+/// },
+/// FRAMEWORKUNIFIEDLOGZONES
+/// };
+/// \endcode
+///
+
+/// if FRAMEWORKUNIFIEDLOGZONES not defined in makefile
+#ifndef FRAMEWORKUNIFIEDLOGZONES
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief g_FrameworkunifiedLogParams
+/// if FRAMEWORKUNIFIEDLOGZONES not defined in makefile
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOGZONES {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup FRAMEWORKUNIFIED_SET_ZONES
+/// \~english @par Brief
+/// This macro API register FRAMEWORKUNIFIEDLOGAPPZONES.
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// in main() function use macro FRAMEWORKUNIFIED_SET_ZONES() before FrameworkunifiedDispatcher()
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NsLogSetFrameworkunifiedLogParams
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIED_SET_ZONES() {UI_32 LogArr[] = {FRAMEWORKUNIFIEDLOGAPPZONES}; \
+ NsLogParseZones(&g_FrameworkunifiedLogParams, (UI_32)_countof(LogArr), FRAMEWORKUNIFIEDLOGAPPZONES); \
+ NsLogSetFrameworkunifiedLogParams(&g_FrameworkunifiedLogParams);}
+#else
+#warning "Zones defined by FRAMEWORKUNIFIEDLOGAPPZONES are overridden by FRAMEWORKUNIFIEDLOGZONES"
+#define FRAMEWORKUNIFIED_SET_ZONES() NsLogSetFrameworkunifiedLogParams(&g_FrameworkunifiedLogParams)
+#endif
+
+#define ZONE_END UINT_MAX
+// Unused API
+// #define CHECK_SEVERITY_LEVEL(sev_level) ((sev_level) >= NsLogGetSeverity())
+// If value of BITS_IN_TZONE changes in future then need to consider changes in the values 5 and 0x1F in below macros
+// here 5 represents (sizeof(TFrameworkunifiedZone)+1) and 0x1F represents (BITS_IN_TZONE-1)
+#define GET_ZONE_INDEX(zone) (((UI_32)zone) >> 5)
+#define GET_ZONE_BIT_MASK(zone) ((TFrameworkunifiedZone)(1U << (((UI_32)zone) & 0x1F)))
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ZONEMASK
+/// \~english @par Brief
+/// the Macro for zone index mask
+/// \~english @param [in] n
+/// zone index
+/// \~english @retval num
+/// UI_32 - zone index
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// mask the zone index
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define ZONEMASK( n ) ((TFrameworkunifiedZone)( n ))
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup IS_ZONE_SET
+/// \~english @par Brief
+/// check wheather the FRAMEWORKUNIFIEDLOG ZONE is set by your application process.
+/// \~english @param [in] set_zone
+/// UI_32 - checking zone_index
+/// \~english @retval TRUE zone is enable
+/// \~english @retval FALSE zone is disable
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// Checks if the FRAMEWORKUNIFIEDLOG ZONE can be configured by Application processes.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NsLogIsZoneSet
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define IS_ZONE_SET(set_zone) (NsLogIsZoneSet(set_zone) == TRUE)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup FRAMEWORKUNIFIEDLOG
+/// \~english @par Brief
+/// Developers should use the FRAMEWORKUNIFIEDLOG for logging.
+/// \~english @param [in] zone
+/// Defined zone in a process (e.g. ZONE_FUNC)
+/// \~english @param [in] funcname
+/// Name of the class or method where the log was written (e.g. "main")
+/// \~english @param [in] print_fmt
+/// string similar to that of a printf statement
+/// \~english @param [in] args
+/// Data arguments(option)
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If print_fmt is NULL, no operation is performed.
+/// \~english @par Detail
+/// FRAMEWORKUNIFIEDLOG is simple macro to make it easy to log messages from any point in your code.
+/// This macro has smarts that does fast checks to determine if your log should or shouldn't be printed.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// ZONEMASK, IS_ZONE_SET, NsLog, NsLog0
+///////////////////////////////////////////////////////////////////////////////
+#ifndef _FRAMEWORKUNIFIEDLOG_ZONE_FUNC_ENABLE_
+#define FRAMEWORKUNIFIEDLOG(zone, funcname, print_fmt, args...)\
+ (zone != ZONEMASK(11))?((IS_ZONE_SET(zone))?TEXT_ZONE(zone, funcname, print_fmt, ## args):((void)0)):((void)(0))
+#else // _FRAMEWORKUNIFIEDLOG_ZONE_FUNC_ENABLE_
+#define FRAMEWORKUNIFIEDLOG(zone, funcname, print_fmt, args...)\
+ ((IS_ZONE_SET(zone)) ? TEXT_ZONE(zone, funcname, print_fmt, ## args) : ((void)0))
+#endif // _FRAMEWORKUNIFIEDLOG_ZONE_FUNC_ENABLE_
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \~english @par Brief
+/// This is the log output macro for clock display in milliseconds.
+/// \~english @param [in] zone
+/// Zone indexes to be checked
+/// \~english @param [in] str
+/// Log output string
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// A simple macro for logging messages in milliseconds from any point in the source code.\n
+/// The log is output in the following format. "Hours:Minutes:Seconds.Milliseconds/=log-output-string"
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// IS_ZONE_SET
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_TIME(zone, str)\
+ ((IS_ZONE_SET(zone))?NsLogTime(zone, str):((void)(0)))
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \~english @par Brief
+/// This is a simplified version of the log output macro.
+/// \~english @param [in] zone
+/// Zone indexes to be checked
+/// \~english @param [in] data
+/// Log output data
+/// \~english @param [in] size
+/// Size of the log output data
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// A simple macro for logging messages from any point in the source code.\n
+/// \ref The macro FRAMEWORKUNIFIEDLOG can specify variable argument lists for log output data,
+/// but the macro is a macro that specifies only data character strings.
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// IS_ZONE_SET, NsLogData
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_DATA(zone, data, size)\
+ ((IS_ZONE_SET(zone))?NsLogData(zone, data, size):((void)(0)))
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_EVTCNT
+///////////////////////////////////////////////////////////////////////////////
+/// Deprecated API. Not use.
+#define FRAMEWORKUNIFIEDLOG_EVTCNT(zone, CntId, EvtId, n...) NsLog_EvtCnt(CntId, EvtId, ##n)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_EVT
+///////////////////////////////////////////////////////////////////////////////
+/// Event logger mechanism.(Send data to SS event logger Queue)
+/// \note The ZONE is not used.
+///
+/// \param [in] zone
+/// Defined zone in a process (e.g. ZONE_FUNC)
+/// \param [in] EvtId
+/// UI_16 - ID of Event from comm layer
+/// \param [in] n
+/// UI_8 - number of variable arguments inputted
+///////////////////////////////////////////////////////////////////////////////
+/// Deprecated API. Not use.
+#define FRAMEWORKUNIFIEDLOG_EVT(zone, EvtId, n...) NsLog_Evt(EvtId, ##n)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_CNT
+///////////////////////////////////////////////////////////////////////////////
+/// Counter logger mechanism.(Send data to SS event logger Queue)
+/// \note The ZONE is not used.
+///
+/// \param [in] zone
+/// Defined zone in a process (e.g. ZONE_FUNC)
+/// \param [in] CntId
+/// UI_16 - ID of Event from comm layer
+/// \param [in] n
+/// UI_8 - number of variable arguments inputted
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Deprecated API. Not use.
+#define FRAMEWORKUNIFIEDLOG_CNT(zone, CntId, n...) NsLog_Cnt(CntId, ##n) // Not to use
+
+/// Deprecated API. Not use.
+#define TEXT(funcname, args...) TEXT_ZONE(BITS_IN_ZONE_MASK, funcname, ## args)
+
+// Unused API
+// #define TEXT0(funcname, print_fmt ) NsLog(__LINE__, BITS_IN_ZONE_MASK, funcname, print_fmt)
+
+#define GET_MACRO(_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, NAME, ...) NAME
+#define NsLogFunc(...)\
+ GET_MACRO(__VA_ARGS__, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
+ NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog0)
+#define TEXT_ZONE(zone_index, funcname, ...)\
+ NsLogFunc(__VA_ARGS__)(__LINE__, zone_index, funcname, __VA_ARGS__)
+
+/// Deprecated API. Not use.
+#define TEXT_EVTCNT(CntId, EvtId, n...) NsLog_EvtCnt(CntId, EvtId, ##n)
+/// Deprecated API. Not use
+#define TEXT_EVT(EvtID, n...) NsLog_Evt(EvtID, ##n)
+/// Deprecated API. Not use.
+#define TEXT_CNT(CntId, n...) NsLog_Cnt(CntId, ##n)
+/// Used to log data that contains trailing arguments \n
+/// Example: FRAMEWORKUNIFIEDLOG0(ZONE_INFO, __FUNCTION__, "testers return value is [%d]!", rtnValue);
+
+
+/// Deprecated API. Use FRAMEWORKUNIFIEDLOG instead.
+#define FRAMEWORKUNIFIEDLOG0 FRAMEWORKUNIFIEDLOG
+
+
+/// Note: These bits are reserved for Framework logging and debugging
+#define ZONE_NS_FUNC ZONEMASK(0)
+#define ZONE_NS_DIS ZONEMASK(1)
+#define ZONE_NS__CWORD77_ ZONEMASK(2)
+#define ZONE_NS_IMP_INFO ZONEMASK(3)
+#define ZONE_NS_SM_DEV_INFO ZONEMASK(4)
+#define ZONE_NS_SM_USR_INFO ZONEMASK(5)
+#define ZONE_NS_INFO ZONEMASK(6)
+#define ZONE_NS_DEBUG_DUMP ZONEMASK(7)
+#define ZONE_NS_WAR ZONEMASK(8)
+#define ZONE_NS_ERR ZONEMASK(9)
+#define ZONE_DEBUG_DUMP ZONE_NS_DEBUG_DUMP
+
+#define ZONE_TEXT_0 "NS_Func"
+#define ZONE_TEXT_1 "NS_Dispatcher"
+#define ZONE_TEXT_2 "NS__CWORD77_"
+#define ZONE_TEXT_3 "NS_Reserved"
+#define ZONE_TEXT_4 "NS_StateMachine_Dev"
+#define ZONE_TEXT_5 "NS_StateMachine_Usr"
+#define ZONE_TEXT_6 "NS_Info"
+#define ZONE_TEXT_7 "NS_Debug_Dump"
+#define ZONE_TEXT_8 "NS_Warning"
+#define ZONE_TEXT_9 "NS_Error"
+
+////
+// Following is old definitions. Only for compile.
+// Specific ZONE to use the ns_logger_frameworkunifiedlog.cfg
+// If possible, following Specific ZONE difinitions shall be delete.
+////
+// Special ZONE(64)-(95)
+/// Note: These bits are reserved for special ZONE
+#define ZONE_PERFORMANCE ZONEMASK(64)
+#define ZONE_SCREEN_TRANS ZONEMASK(65)
+#define ZONE_SWDL ZONEMASK(66)
+#define ZONE_SYSTEMDATA ZONEMASK(67)
+#define ZONE_LOG_SH ZONEMASK(68)
+#define ZONE_LOG_SYS ZONEMASK(69)
+#define ZONE_LOG__CWORD52_ ZONEMASK(70)
+#define ZONE_SECURE ZONEMASK(71)
+#define ZONE_CAN_FILTER ZONEMASK(72)
+#define ZONE_COMM_PROCESS ZONEMASK(73)
+#define ZONE_CONNECT_DEVICE ZONEMASK(74)
+#define ZONE_SP_ZONE_75 ZONEMASK(75)
+#define ZONE_SP_ZONE_76 ZONEMASK(76)
+#define ZONE_SP_ZONE_77 ZONEMASK(77)
+#define ZONE_SP_ZONE_78 ZONEMASK(78)
+#define ZONE_SP_ZONE_79 ZONEMASK(79)
+#define ZONE_SP_ZONE_80 ZONEMASK(80)
+#define ZONE_SP_ZONE_81 ZONEMASK(81)
+#define ZONE_SP_ZONE_82 ZONEMASK(82)
+#define ZONE_SP_ZONE_83 ZONEMASK(83)
+#define ZONE_SP_ZONE_84 ZONEMASK(84)
+#define ZONE_SP_ZONE_85 ZONEMASK(85)
+#define ZONE_SP_ZONE_86 ZONEMASK(86)
+#define ZONE_SP_ZONE_87 ZONEMASK(87)
+#define ZONE_SP_ZONE_88 ZONEMASK(88)
+#define ZONE_SP_ZONE_89 ZONEMASK(89)
+#define ZONE_SP_ZONE_90 ZONEMASK(90)
+#define ZONE_SP_ZONE_91 ZONEMASK(91)
+#define ZONE_SP_ZONE_92 ZONEMASK(92)
+#define ZONE_SP_ZONE_93 ZONEMASK(93)
+#define ZONE_SP_ZONE_94 ZONEMASK(94)
+#define ZONE_SP_ZONE_95 ZONEMASK(95)
+
+// Special ZONE(96)-(127) (console off)
+/// Note: These bits are reserved for special ZONE
+#define ZONE_COMM_SYS ZONEMASK(96)
+#define ZONE_COMM_SH ZONEMASK(97)
+#define ZONE_COMM_USB ZONEMASK(98)
+#define ZONE_SP_ZONE_99 ZONEMASK(99)
+#define ZONE_SP_ZONE_100 ZONEMASK(100)
+#define ZONE_SP_ZONE_101 ZONEMASK(101)
+#define ZONE_SP_ZONE_102 ZONEMASK(102)
+#define ZONE_SP_ZONE_103 ZONEMASK(103)
+#define ZONE_SP_ZONE_104 ZONEMASK(104)
+#define ZONE_SP_ZONE_105 ZONEMASK(105)
+#define ZONE_SP_ZONE_106 ZONEMASK(106)
+#define ZONE_SP_ZONE_107 ZONEMASK(107)
+#define ZONE_SP_ZONE_108 ZONEMASK(108)
+#define ZONE_SP_ZONE_109 ZONEMASK(109)
+#define ZONE_SP_ZONE_110 ZONEMASK(110)
+#define ZONE_SP_ZONE_111 ZONEMASK(111)
+#define ZONE_SP_ZONE_112 ZONEMASK(112)
+#define ZONE_SP_ZONE_113 ZONEMASK(113)
+#define ZONE_SP_ZONE_114 ZONEMASK(114)
+#define ZONE_SP_ZONE_115 ZONEMASK(115)
+#define ZONE_SP_ZONE_116 ZONEMASK(116)
+#define ZONE_SP_ZONE_117 ZONEMASK(117)
+#define ZONE_SP_ZONE_118 ZONEMASK(118)
+#define ZONE_SP_ZONE_119 ZONEMASK(119)
+#define ZONE_SP_ZONE_120 ZONEMASK(120)
+#define ZONE_SP_ZONE_121 ZONEMASK(121)
+#define ZONE_SP_ZONE_122 ZONEMASK(122)
+#define ZONE_SP_ZONE_123 ZONEMASK(123)
+#define ZONE_SP_ZONE_124 ZONEMASK(124)
+#define ZONE_SP_ZONE_125 ZONEMASK(125)
+#define ZONE_SP_ZONE_126 ZONEMASK(126)
+#define ZONE_SP_ZONE_127 ZONEMASK(127)
+
+#endif /* __NATIVESERVICES_LOGGER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_mc_system_info.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_mc_system_info.h
new file mode 100755
index 0000000..b61268a
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_mc_system_info.h
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageCenter
+/// \brief Native Services Special Interfaces
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_MC_SYSTEM_INFO_H_
+#define FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_MC_SYSTEM_INFO_H_
+
+
+#include <native_service/ns_msgs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageCenter
+/// McSendWithSysInfo
+/// Sends data to a message queue, user defined system info.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \param [in] source
+/// LPCSTR - app (You) the sender
+/// \param [in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \param [in] sysInfo
+/// PCHAR - pointer to sysInfo data that will be placed in the header of the message.
+/// \param [in] length
+/// UI_32 - length of the data buffer provided
+/// \param [in] data
+/// void* - pointer to the data to be sent
+///
+/// \return EFrameworkunifiedStatus
+/// status -
+/// indicates if the message was sent successfully
+/// success >> (eFrameworkunifiedStatusOK)
+/// failure >> (anything else)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSendWithSysInfo(HANDLE hMessage, PCSTR source, UI_32 cmd, PCHAR sysInfo, UI_32 length, PCVOID data,
+ UI_32 sessionid);
+
+// EFrameworkunifiedStatus McSendWithSysInfoWithSession(HANDLE hMessage, PCSTR source,
+// UI_32 cmd, PCHAR sysInfo, UI_32 length, PCVOID data, UI_32 sessionid);
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageCenter
+/// McSendWithSysInfo
+/// Sends data to a message queue, user defined system info.
+///
+/// \param [in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \param [in] source
+/// LPCSTR - app (You) the sender
+/// \param [in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \param [in] sysInfo
+/// PCHAR - pointer to sysInfo data that will be placed in the header of the message.
+/// \param [in] length
+/// UI_32 - length of the data buffer provided
+/// \param [in] data
+/// void* - pointer to the data to be sent
+/// \param [in] priority
+/// EFrameworkunifiedMessagePriorties - various Message Priorities that a process can assign.
+///
+/// \return EFrameworkunifiedStatus
+/// status -
+/// indicates if the message was sent successfully
+/// success >> (eFrameworkunifiedStatusOK)
+/// failure >> (anything else)
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSendPrioWithSysInfo(HANDLE hMessage, PCSTR source, UI_32 cmd, PCSTR sysInfo, UI_32 length, PCVOID data,
+ EFrameworkunifiedMessagePriorties priority, UI_32 sessionid);
+
+// EFrameworkunifiedStatus McSendPrioWithSysInfoWithSession(HANDLE hMessage, PCSTR source,
+// UI_32 cmd, PCSTR sysInfo, UI_32 length, PCVOID data, EFrameworkunifiedMessagePriorties priority, UI_32 sessionid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_MC_SYSTEM_INFO_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_message_center_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_message_center_if.h
new file mode 100755
index 0000000..cfd350f
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_message_center_if.h
@@ -0,0 +1,1536 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * @brief \~english APIs to Open/Close and Send/Receive on message queues and shared memory.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_MESSAGE_CENTER_IF_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_MESSAGE_CENTER_IF_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_shared_mem_if.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McOpenReceiver
+/// \~english @par Brief
+/// Opens a handle to a Receiver message queue.
+/// \~english @param[in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+/// \~english @retval Handle to a recevier's message queue (If INVALID_HANDLE is returned its an error)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size of message queue name string specified by argument(name) is larger then 20byte. [NULL]
+/// - Message queue name specified by argument(name) is NULL. [NULL]
+/// - Size of name normalised from argument(name) for message queue is larger then 15byte[16byte when starts with
+/// "/"]. [NULL]
+/// - Failed to create(malloc) buffer to storage name normalised from argument(name) for message queue. [NULL]
+/// - Failed to get(mq_open) message queue. [NULL]
+/// - Failed to create(malloc) buffer to storage management information of message queue. [NULL]
+/// \~english @par Detail
+/// Create a message queue whose name is specified by argument, and return a handle for receiving message. \n
+/// The message queue created in this API is used to receive message, but not to send message. \n
+/// You can use message queue in McOpenSender to send message.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McReceive, McClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenReceiver(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McOpenReceiverNotBlocked
+/// \~english @par Brief
+/// Opens a handle to a Receiver message queue. Operations on this queue are
+/// non-blocking if queue is empty or full.
+/// \~english @param[in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+/// \~english @retval Handle to a recevier's message queue (If INVALID_HANDLE is returned its an error)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size of message queue name string specified by argument(name) is larger then 20byte. [NULL]
+/// - Message queue name specified by argument(name) is NULL. [NULL]
+/// - Size of name normalised from argument(name) for message queue is larger then 15byte[16byte when starts with
+/// "/"]. [NULL]
+/// - Failed to create(malloc) buffer to storage name normalised from argument(name) for message queue. [NULL]
+/// - Failed to get(mq_open) message queue. [NULL]
+/// - Failed to create(malloc) buffer to storage management information of message queue. [NULL]
+/// \~english @par Detail
+/// Create a message queue whose name is specified by argument, and return a handle for receiving message. \n
+/// The message queue created in this API is used to receive message, but not to send message. \n
+/// You can use message queue in McOpenSender to send message.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McReceive, McClose, McOpenSenderNotBlocked
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenReceiverNotBlocked(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McOpenSyncReceiver
+/// \~english @par Brief
+/// Opens a handle to a response Receiver message queue.
+/// \~english @param[in] name
+/// PCSTR - name of the message queue you want to receiver messages on
+/// \~english @retval Handle to a recevier's message queue (If INVALID_HANDLE is returned its an error)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size of message queue name string specified by argument(name) is larger then 20byte. [NULL]
+/// - Message queue name specified by argument(name) is NULL. [NULL]
+/// - Size of name normalised from argument(name) for message queue(don't start with "/") is larger then 19byte.
+/// [NULL]
+/// - Size of name normalised from argument(name) for message queue(start with "/") is larger then 20byte. [NULL]
+/// - Failed to create(malloc) buffer to storage name normalised from argument(name) for message queue. [NULL]
+/// - Failed to get(mq_open) message queue. [NULL]
+/// - Failed to create(malloc) buffer to storage management information of message queue. [NULL]
+/// \~english @par Detail
+/// Create a message queue whose name is specified by argument, and return a handle for receiving message
+/// by synchronous communication.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// When the application used the message queue acquired by this API, note the following.
+/// - Use McCreateInvokerName to obtain the receive message queue handle to be passed to the parameter name.
+/// - It can not be used transmission because it is for reception.
+/// McOpenSender must be used for the message queue trasmission.
+/// - Cannot be used other than for waiting for response during synchronous communication.
+/// (because the maxmum number of messages in the queue is specified as 2)
+/// - When a message queue name (name) that has not been normalized is specified, transmission falis unless 18 byte are specified.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McCreateInvokerName, McInvokeSync, McClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenSyncReceiver(PCSTR name);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McOpenSender
+/// \~english @par Brief
+/// The opens a handle for sending messages to another message queue.
+/// \~english @param[in] name
+/// PCSTR - name of the message queue you want to send messages too
+/// \~english @retval Handle for sending messages to a queue (If INVALID_HANDLE is returned its an error)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size of message queue name string specified by argument(name) is larger then 20byte. [NULL]
+/// - Message queue name specified by argument(name) is NULL. [NULL]
+/// - Size of name normalised from argument(name) for message queue is larger then 15byte[16byte when starts with
+/// "/"]. [NULL]
+/// - Failed to create(malloc) buffer to storage name normalised from argument(name) for message queue. [NULL]
+/// - Failed to get(mq_open) message queue. [NULL]
+/// - Failed to create(malloc) buffer to storage management information of message queue. [NULL]
+/// \~english @par Detail
+/// Create a message queue whose name is specified by argument, and return a handle for sending message. \n
+/// The message queue created in this API is used to send message, but not to receive message. \n
+/// You can use message queue in McOpenReceiver to receive message.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McSend, McClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenSender(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// The opens a handle for sending messages to another message queue.
+/// operations on this queue are non-blocking if queue is empty or full.
+///
+/// \param [in] name
+/// PCSTR - name of the message queue you want to send messages too
+///
+/// \return HANDLE
+/// handle - for sending messages to a queue (If INVALID_HANDLE is returned its an error)
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenSenderNotBlocked(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McOpenSyncSender
+/// \~english @par Brief
+/// The opens a handle for sending responce to another message queue.
+/// \~english @param[in] name
+/// PCSTR - name of the message queue you want to send messages too
+/// \~english @retval Handle for sending response to a queue (If INVALID_HANDLE is returned its an error)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size of message queue name string specified by argument(name) is larger then 20byte. [NULL]
+/// - Message queue name specified by argument(name) is NULL. [NULL]
+/// - Size of name normalised from argument(name) for message queue(don't start with "/") is larger then 19byte.
+/// [NULL]
+/// - Size of name normalised from argument(name) for message queue(start with "/") is larger then 20byte. [NULL]
+/// - Failed to create(malloc) buffer to storage name normalised from argument(name) for message queue. [NULL]
+/// - Failed to get(mq_open) message queue. [NULL]
+/// - Failed to create(malloc) buffer to storage management information of message queue. [NULL]
+/// \~english @par Detail
+/// Create a message queue whose name is specified by argument, and return a handle for sending message. \n
+/// The message queue created in this API is used to send message, but not to receive message. \n
+/// You can use message queue in McOpenReceiver to receive message.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McSend, McClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McOpenSyncSender(PCSTR name);
+
+/////////////////////////////////////////
+#include <pthread.h>
+HANDLE McOpenSenderChild(PCSTR name, pthread_t childid);
+/////////////////////////////////////////
+
+/////////////////////////////////////////
+EFrameworkunifiedStatus McJoinChild(HANDLE hChildApp);
+/////////////////////////////////////////
+
+/////////////////////////////////////////
+EFrameworkunifiedStatus McGetChildThreadPriority(HANDLE hChildApp, PSI_32 threadPrio);
+/////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McReceive
+/// \~english @par Brief
+/// Retrieves data from a message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the recvMessage, McOpenRecevier
+/// \~english @param[out] source
+/// PSTR - app that sent this message
+/// \~english @param[out] cmd
+/// UI_32* - command message that has been received.
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[out] data
+/// PVOID - pointer to the data to be received
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName - Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail - Invalid handle of message queue for receiving message
+/// \~english @par Preconditons
+/// Message queue(McOpenReceiver etc.) for receiving message is created.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Data buffer specified by argument(data) for receiving message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Size of data buffer specified by argument(length) for receiving message is 0. [eFrameworkunifiedStatusInvldBuf]
+/// - Buffer to storage application name specified by argument(source) for sending message is NULL.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Buffer to storage commond ID of protocol on the service specified by argument(cmd) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Size of application name of sender getted from received message is lager then 20byte. [eFrameworkunifiedStatusInvldBuf]
+/// - Handle specified by argument(hMessage) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified by argument(hMessage) is not appropriate(which is invalid). [eFrameworkunifiedStatusFail]
+/// - Message queue type of handle specified by argument(hMessage) is not receiving type. [eFrameworkunifiedStatusFail]
+/// - File descriptor for receiving message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when receiving message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for receiving message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// \~english @par Detail
+/// Receives data from message queue specified by argument.
+/// Sets application of sender(source), commond ID of protocol on the service(cmd), receiving data(data), and
+/// return.
+/// It will block until getting message from message queue.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// Since data is exchanged only in the message queue, the data size that can be received is up to 4096 bytes.
+/// \~english @par
+/// The caller must guarantee the allocation of the area for the receive data buffer
+/// and the consistency of the sizes set in the arguments.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McSend
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McReceive(HANDLE hMessage, PSTR source, UI_32 *cmd, UI_32 length, PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McReceiveWithSession
+/// \~english @par Brief
+/// Retrieves data from a message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the recvMessage, McOpenRecevier
+/// \~english @param[out] source
+/// PSTR - app that sent this message
+/// \~english @param[out] cmd
+/// UI_32* - command message that has been received.
+/// \~english @param[out] sessionid
+/// UI_32* - Session ID
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[out] data
+/// PVOID - pointer to the data to be received
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldQName - Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail - Invalid handle of message queue for receiving message
+/// \~english @par Preconditons
+/// Message queue(McOpenReceiver etc.) for receiving message is created.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Buffer to storage session ID specified by argument(sessionid) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Buffer to storage handle of message queue specified by argument(hMessage) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Data buffer specified by argument(data) for receiving message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Size of data buffer specified by argument(length) for receiving message is 0. [eFrameworkunifiedStatusInvldBuf]
+/// - Buffer to storage application name specified by argument(source) for sending message is NULL.
+/// [eFrameworkunifiedStatusInvldQName]
+/// - Buffer to storage commond ID of protocol on the service specified by argument(cmd) is NULL.
+/// [eFrameworkunifiedStatusInvldParam]
+/// - Size of application name of sender getted from received message is lager then 20byte. [eFrameworkunifiedStatusInvldBuf]
+/// - Handle specified by argument(hMessage) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified by argument(hMessage) is not appropriate(which is invalid). [eFrameworkunifiedStatusFail]
+/// - Message queue type of handle specified by argument(hMessage) is not receiving type. [eFrameworkunifiedStatusFail]
+/// - File descriptor for receiving message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when receiving message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for receiving message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// \~english @par Detail
+/// Receives data from message queue specified by argument.Sets application of sender(source),
+/// commond ID of protocol on the service(cmd), receiving data(data), session id(sessionid), and return.
+/// It will block until getting message from message queue.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// The caller must guarantee the allocation of the area for the receive data buffer
+/// and the consistency of the sizes set in the arguments.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McSendWithSession
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McReceiveWithSession(HANDLE hMessage, PSTR source, UI_32 *cmd, UI_32 *sessionid,
+ UI_32 length, PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetLength
+/// \~english @par Brief
+/// Get the length of data that needs to be retrieved.
+/// \~english @param[in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+/// \~english @retval UI_32 indicates the number of bytes that in the message
+/// \~english @par
+/// if return is 0 or less then invalid data was passed.
+/// \~english @par Preconditons
+/// - Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Data of received message(data) is NULL. [0]
+/// \~english @par Detail
+/// Return message data length specified by the header of received message. \n
+/// Use this data length as the buffer size specified by McGetDataOfSize.
+/// \~english @par
+/// This API does not distinguish between error and no data.
+/// \~english @par
+/// The parameter data of this API must be the data obtained from the message queue by McReceive, etc.
+/// (Since the data obtained from the message queue incudes header information,
+/// this API acquires necessary iformation from the header)
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McReceive, McReceiveWithSession, McGetDataOfSize
+////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 McGetLength(PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetDataPointer
+/// \~english @par Brief
+/// Get header address of data from received message.
+/// \~english @param[in] data
+/// PVOID - received message data
+/// \~english @retval PVOID - data address of received message
+/// \~english @par Preconditons
+/// Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Data of received message(data) is NULL. [NULL]
+/// \~english @par Detail
+/// Get header address of data from received message excepting the header and system information.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - Since the pointer acquired by this API is part of the received message passed as an argument to this API,
+/// the pointer must not be released by specifying he address acquired by this API.
+/// - The parameter data of this API must be the data obtained from the message queue by McReceive, etc.
+/// (Since the data obtained from the message queue incudes header information,
+/// this API acquires necessary iformation from the header)
+/// - When the next message is received, the internally held data is discarded.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McReceive, McReceiveWithSession, McGetDataOfSize
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID McGetDataPointer(PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetDataOfSize
+/// \~english @par Brief
+/// Get the message data, this may be from a queue or shared memory where the maximum
+/// size of the data should not exceed the maximum size passed in.
+/// And deletes the data if it is stored in shared memory.
+/// \~english @param[in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+/// \~english @param[in] to
+/// PVOID - pointer to the data to be received
+/// \~english @param[in] uiSize
+/// UI_32 - maximum size of the buffer to which the received data is copied
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK - success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusErrOther - invalid shared memory ID specified by received message
+/// \~english @par Preconditons
+/// - Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size specified by argument(uiSize) is smaller then size of received message data(data).
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Data of received message(data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Pointer to buffer(to) which is used to storage data getted from message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Received message data specified by argument(data) is invalid. [eFrameworkunifiedStatusInvldHndlType]
+/// - Failed to access(shm_open/fstat/mmap) the shared memory of received message data(data).
+/// [eFrameworkunifiedStatusErrOther]
+/// - Shared memory ID specified by received message is invalid. [FrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Get data from received message excepting the header and system information.
+/// Delete data storaged in shared memory after getting the data successfully.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - In the case where he received message data becomes 0byte, there is no need to call this API,
+/// and be careful not to allocate the memory for the received message data by 0byte.
+/// - Error details related to shared memory access canno be detected.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McGetLength
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McGetDataOfSize(PVOID data, PVOID to, UI_32 uiSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetDataOfSizeWithSMRetain
+/// \~english @par Brief
+/// Get the message data, this may be from a queue or shared memory where the maximum
+/// size of the data should not exceed the maximum size passed in.
+/// Does not delete the data if it is stored in shared memory.
+/// \~english @param[in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+/// \~english @param[in] to
+/// PVOID - pointer to the data to be received
+/// \~english @param[in] uiSize
+/// UI_32 - maximum size of the buffer to which the received data is copied
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK - success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusErrOther - invalid shared memory ID specified by received message
+/// \~english @par Preconditons
+/// - Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Size specified by argument(uiSize) is smaller then size of received message data(data).
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Data of received message(data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Pointer to buffer(to) which is used to storage data getted from message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Received message data specified by argument(data) is invalid. [eFrameworkunifiedStatusInvldHndlType]
+/// - Failed to access(shm_open/fstat/mmap) the shared memory of received message data(data).
+/// [eFrameworkunifiedStatusErrOther]
+/// - Shared memory ID specified by received message is invalid. [FrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// Get data from received message excepting the header and system information.
+/// Does not delete data storaged in shared memory after getting the data successfully.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - In the case where he received message data becomes 0byte, there is no need to call this API,
+/// and be careful not to allocate the memory for the received message data by 0byte.
+/// - Error details related to shared memory access canno be detected.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// McReceive
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McGetDataOfSizeWithSMRetain(PVOID data, PVOID to, UI_32 uiSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetSysInfoData
+/// \~english @par Brief
+/// Gets the data from system info buffer from message header.
+/// \~english @param[in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+/// \~english @param[out] to
+/// PVOID - pointer to the data to be received
+/// \~english @retval EFrameworkunifiedStatus indicates if the close was successfully
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @par Preconditons
+/// Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Data of received message(data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Pointer to buffer(to) which is used to storage system info getted from message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Received message data specified by argument(data) is invalid. [eFrameworkunifiedStatusInvldHndlType]
+/// \~english @par Detail
+/// Gets system info from received message, and set argument(to) with it. \n
+/// If there is no system info in received message,and set argument(to) with "\0".
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - The parameter data of this API must be the data obtained from the message queue by McReceive, etc.
+/// (Since the data obtained from the message queue incudes header information,
+/// this API acquires necessary iformation from the header)
+/// - Since the system information is 64 bytes (including the null character), the area of 64 byte must be allocated in the argument to fo this API.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McReceive, McReceiveWithSession
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McGetSysInfoData(PVOID data, PVOID to);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McClearData
+/// \~english @par Brief
+/// Clears the data that may be pending for the a message in shared memory.
+/// \~english @param[in] data
+/// PVOID - pointer to the data was received from the McReceive Call
+/// \~english @retval EFrameworkunifiedStatus indicates if the data was clear successfully
+/// \~english @retval eFrameworkunifiedStatusOK - success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldParam - invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldID - invalid ID
+/// \~english @retval eFrameworkunifiedStatusFail - other errors
+/// \~english @par Preconditons
+/// - Message is received by McReceive and so on.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Data of received message(data) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Received message data specified by argument(data) is invalid. [eFrameworkunifiedStatusInvldParam]
+/// - Shared memory ID in received message is invalid. [eFrameworkunifiedStatusInvldParam]
+/// - Shared memory specified by ID in received message does not exist. [eFrameworkunifiedStatusInvldID]
+/// - Failed to delete shared memory specified by ID in received message. [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Delete data from received message.
+/// And delete the received message data if it is stored in shared memory.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McReceive, McReceiveWithSession
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McClearData(PVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McSend
+/// \~english @par Brief
+/// Sends data to a message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @param[in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[in] data
+/// PCVOID - pointer to the data to be sent
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK - Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer - NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName - Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull - Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF I- nvalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail - Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther - other errors(Failed to open/allocate shared memory)
+/// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+/// \~english @par Preconditons
+/// - Message queue(McOpenSender) for sending message is created.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Message queue name of HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue name of HANDLE specified in the argument (hService) exceeds 20byte. [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Application name of sender specified in the argument (source) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Application name of sender specified in the argument (source) exceeds 20byte. [eFrameworkunifiedStatusInvldQName]
+/// - Sender data does not match sender data size(size is larger then 0, and data is NULL). [eFrameworkunifiedStatusInvldBuf]
+/// - Message queue type of handle specified by argument(hMessage) is not sending type. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when sending message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for sending message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// - Some errors occur, when sending message. [eFrameworkunifiedStatusFail]
+/// - Failed to access(shm_open/ftruncate/mmap) the shared memory for sending message data. [eFrameworkunifiedStatusErrOther]
+/// - Sending data size specified in the argument (length) is out of range. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// It is an asynchronous API. It provides function to send message by message queue. \n
+/// Message queue name created by McOpenSender is the sender.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// Command ID must be within the range PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD(0x10) to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD(0xFFFFFFF0).
+/// Even if a command ID out of range is specified, a message is sent by the command ID (no erro occurs).
+/// Command ID out of range are resered ID used for session connection, etc.
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - The maximum transmission data size (ength) described above is a theoretical value,
+/// and the maximum actually usable data size depends on the environment requirements.\n
+/// The maximum value is the upper limit of the type (UNIT_MAX) minus the following size.\n
+/// Message header section \n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address
+/// of the pointer (data) to the data buffer does not match the size specified by the size of the data buffer (length).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McSendWithSession, McReceive
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSend(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McSendWithSession
+/// \~english @par Brief
+/// Sends data to a message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @param[in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[in] data
+/// PCVOID - pointer to the data to be sent
+/// \~english @param[in] sessionid
+/// UI_32 - session id
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK - Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer - NULL pointer specified
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusInvldQName - Illegal Message Queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull - Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail - Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther - other errors(Failed to open/allocate shared memory)
+/// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+/// \~english @par Preconditons
+/// - Message queue(McOpenSender) for sending message is created.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Message queue HANDLE in HANDLE specified in the argument (hService) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - HANDLE specified in the argument message queue HANDLE in (hService) is not appropriate (which is invalid).
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Application name of sender specified in the argument (source) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Application name of sender specified in the argument (source) exceeds 20byte. [eFrameworkunifiedStatusInvldQName]
+/// - Sender data does not match sender data size(size is larger then 0, and data is NULL). [eFrameworkunifiedStatusInvldBuf]
+/// - Message queue type of handle specified by argument(hMessage) is not sending type. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor for sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when sending message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for sending message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// - Some errors occur, when sending message. [eFrameworkunifiedStatusFail]
+/// - Failed to access(shm_open/ftruncate/mmap) the shared memory for sending message data. [eFrameworkunifiedStatusErrOther]
+/// - Sending data size specified in the argument (length) is out of range. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// It is an asynchronous API. It provides function to send message by message queue. \n
+/// Message queue name created by McOpenSender is the sender.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// Command ID must be within the range PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD(0x10) to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD(0xFFFFFFF0).
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - McSend should be used if no sessionid is specified.
+/// - To communicate with an application that uses NS Framework Dispatcher, use FrameworkunifiedSendMsg, etc.
+/// - The maximum transmission data size (length) described above is a theoretical value,
+/// and the maximum actually usable data size depends on the environment requirements.\n
+/// - The maximum value is the upper limit of the type (UNIT_MAX) minus the following size.\n
+/// Message header section\n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address
+/// of the pointer (data) to the data buffer does not match the size specified by the size of the data buffer (length).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McSend, McReceiveWithSession, FrameworkunifiedSendMsg
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSendWithSession(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data, UI_32 sessionid);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McSendWithPriority
+/// \~english @par Brief
+/// Sends data to a message queue, inserts based on priority given.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @param[in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[in] data
+/// PCVOID - pointer to the data to be sent
+/// \~english @param[in] sessionid
+/// UI_32 - session id
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK(success)
+/// \~english @retval eFrameworkunifiedStatusFail(anything else)
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hMessage) or hMessage is NULL.
+/// - It is an incorrect value(source) or hMessage is NULL.
+/// - It is an incorrect value(data) or hMessage is NULL.
+/// - It is an incorrect value(priority).
+/// - It is an incorrect value(sessionid).
+/// \~english @par Detail
+/// Invoke callback function with arguments to send data to message queue based on priority given.\n
+/// If callback function is null and expectedCalls is '0', using default function 'McSendWithPriority' to send
+/// data to message queue based on priority given.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// Command ID must be within the range PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD(0x10) to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD(0xFFFFFFF0).
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - McSend should be used if no sessionid is specified.
+/// - To communicate with an application that uses NS Framework Dispatcher, use FrameworkunifiedSendMsg, etc.
+/// - The maximum transmission data size (length) described above is a theoretical value,
+/// and the maximum actually usable data size depends on the environment requirements.\n
+/// The maximum value is the upper limit of the type (UNIT_MAX) minus the following size.\n
+/// Message header section\n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address
+/// of the pointer (data) to the data buffer does not match the size specified by the size of the data buffer (length).
+/// \~english @par
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+// McOpenSender, McSend, McSendWithSession, FrameworkunifiedSendMsg
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSendWithPriority(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data,
+ EFrameworkunifiedMessagePriorties priority, UI_32 sessionid);
+
+// EFrameworkunifiedStatus McSendWithPriorityWithSession(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data,
+// EFrameworkunifiedMessagePriorties priority, UI_32 sessionid);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McInvokeSync
+/// \~english @par Brief
+/// Synchronous Invoke. Send data to message queue, and Receive data from message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @param[in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \~english @param[in] msgLength
+/// UI_32 - length of the data buffer provided
+/// \~english @param[in] msgData
+/// PCVOID - pointer to the data to be sent
+/// \~english @param[in] sessionid
+/// UI_32 - session ID
+/// \~english @param[in] hRcvMessage
+/// HANDLE - handle to the receive message queue, McOpenSyncReceiver
+/// \~english @param[in] responseLength
+/// UI_32 - length of the responnce receive buffer provided
+/// \~english @param[out] responseData
+/// PVOID - pointer to the data to be receive
+/// \~english @param[out] receivedLength
+/// UI_32* - length of the data to be receive
+/// \~english @retval EFrameworkunifiedStatus indicates invoke response or message sent error or response receive error
+/// \~english @retval eFrameworkunifiedStatusOK - success
+/// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - Invalid handle type
+/// \~english @retval eFrameworkunifiedStatusInvldQName - Invalid message queue name
+/// \~english @retval eFrameworkunifiedStatusMsgQFull - Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - Invalid file descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - Invalid buffer size
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusBadConnection - Can't connect with Socket
+/// \~english @retval eFrameworkunifiedStatusFail - Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther - other errors(Failed to open/allocate shared memory)
+/// \~english @par Preconditons
+/// - Message queue specified by argument hMessage and hRcvMessage is useful.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Message queue handle specified in the argument (hMessage) for sending message is NULL.
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue handle specified in the argument (hMessage) for sending message is not appropriate (which is
+/// invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue handle specified in the argument (hRcvMessage) for receiving message is NULL.
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Message queue handle specified in the argument (hRcvMessage) for receiving message is not appropriate (which
+/// is invalid). [eFrameworkunifiedStatusInvldHandle]
+/// - Size of buffer(responseLength) which is used to storage received message is not 0,
+/// but the pointer to this buffer(responseData) is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - Failed to create buffer to storage the response message. [eFrameworkunifiedStatusFail]
+/// - Failed to generete random number of the sequence ID for sending message. [eFrameworkunifiedStatusFail]
+/// - Data size of sending message is not 0, but the message data(msgData) is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Application name of sender specified in the argument (source) is NULL. [eFrameworkunifiedStatusInvldQName]
+/// - Application name of sender specified in the argument (source) exceeds 20byte. [eFrameworkunifiedStatusInvldQName]
+/// - Name of message queue handle specified in the argument (hMessage) for sending message is NULL.
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Name of message queue handle specified in the argument (hMessage) for sending message exceeds 20byte.
+/// [eFrameworkunifiedStatusInvldHandle]
+/// - Size of sending message specified in the argument is not 0,
+/// but the pointer to sending message is NULL. [eFrameworkunifiedStatusInvldBuf]
+/// - Message queue type of handle specified by argument(hMessage) is not sending type. [eFrameworkunifiedStatusInvldHndlType]
+/// - Message queue for sending message is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor of message queue for sending message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when sending message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for sending message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// - Some errors occur, when sending message. [eFrameworkunifiedStatusFail]
+/// - Failed to access the shared memory for sending message data. [eFrameworkunifiedStatusErrOther]
+/// - Failed to connect with the socket(socket/bind/connect) for checking the connection with application of
+/// sender. [eFrameworkunifiedStatusFail]
+/// - Failed to wait(epoll_create/epoll_ctl/epoll_wait) for receiving response message. [eFrameworkunifiedStatusFail]
+/// - Failed to reconnect with the socket(socket/bind/connect) for checking the connection with application of
+/// sender. [eFrameworkunifiedStatusBadConnection]
+/// - Application name of sender in response message exceeds 20byte.[eFrameworkunifiedStatusInvldBuf]
+/// - Message queue type of handle specified by argument(hMessage) is not receiving type.
+/// [eFrameworkunifiedStatusInvldHndlType]
+/// - File descriptor of message queue for receiving message is invalid. [eFrameworkunifiedStatusErrNoEBADF]
+/// - An interrupt is generated by the system call (signal) when receiving message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of buffer for receiving message is invalid. [eFrameworkunifiedStatusInvldBufSize]
+/// - Received message is storaged in shared memory, but data size of shared memory is 0. [eFrameworkunifiedStatusErrOther]
+/// - Failed to create buffer(calloc) to storage date getted from shared memory. [eFrameworkunifiedStatusFail]
+/// - Failed to access(shm_open/fstat/mmap) the shared memory for receiving message data. [eFrameworkunifiedStatusErrOther]
+/// - Data size of received message specified by argument(receivedLength) is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Sending data size specified in the argument (msgLength) is out of range. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// It provides synchronous communication for message queue between sender and receiver specified in the
+/// argument. \n
+/// As it is a synchronous function, after sending a message, the sender will wait until getting response form
+/// receiver.
+/// After receiving the response, set responseData with the received data and return.
+/// \~english @par
+/// This API provides the inter-process communication function by the message queue for the application
+/// which does not use the inter-process communication by NS Framework Dispatcher.
+/// \~english @par
+/// When data larger than the receive message storage buffer size (resposeLength) is received,
+/// the write size to the receive message storage buffer (responseData) does not exceed the specified size,
+/// but the receive size is set in the receive message data length (recievedLength) as is.
+/// \~english @par
+/// The caller must guarantee the allocation of the receive message storage buffer (resonseData) area
+/// and the consistency of the receive message stoage buffer sizes (resposeLength).
+/// \~english @par
+/// Please note the following points when using this API for application.
+/// - This API stores up to the storage buffer length (responseLength) and returs eFrameworkunifiedStatusOK even
+/// if the received reply message is larger than the storage buffer (responseData) size.\n
+/// Therefore, the application shoud compare the received message length (recievedLenght) and the storage buffer length (responseLength) even
+/// if this API returns eFrameworkunifiedStatusOK, and detect the above.
+/// - Specify 0 for the sessionid of argument.
+/// If a value other than 0 is specified, no error occurs and the value is used as is.
+/// - To communicate with an application that uses NS Framework Dispatcher, use FrameworkunifiedInvokeSync, etc.
+/// - The maximum data lenght (msgLength) of sent messages is a theoretical value,
+/// and the maximum value that can be actually used is environment-depedent.\n
+/// The maximum value is the upper limit of the type (UNIT_MAX) minus the following size.\n
+/// Message header section, System information department in messages\n
+/// - Operation cannot be guaranteed when the size of the allocated area indicated by the address
+/// of the pointer (msgData) to the data buffer does not match the size specified by the size of the data buffer (msgLength).
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McOpenSyncReceiver, FrameworkunifiedInvokeSync
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McInvokeSync(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 msgLength, PCVOID msgData, UI_32 sessionid,
+ HANDLE hRcvMessage, UI_32 responseLength, PVOID responseData, UI_32 *receivedLength);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McSendSyncResponse
+/// \~english @par Brief
+/// Sends response to a message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSyncSender
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @param[in] cmd
+/// UI_32 - command id aka the message that's being sent
+/// \~english @param[in] seq_id
+/// UI_32 - response sequence ID
+/// \~english @param[in] ret_val
+/// EFrameworkunifiedStatus - response status
+/// \~english @param[in] length
+/// UI_32 - length of the data buffer provided
+/// \~english @param[in] data
+/// PCVOID - pointer to the data to be sent
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - If handle is NULL or invalid
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType -if handle type is invalid
+/// \~english @retval eFrameworkunifiedStatusInvldQName - if MQ name is invalid
+/// \~english @retval eFrameworkunifiedStatusMsgQFull - if MQ is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - if fd is invalid
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR - if system call(signal) interupt occurs
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize -if buffer size is invalid
+/// \~english @retval eFrameworkunifiedStatusInvldBuf -if buffer is invalid
+/// \~english @retval eFrameworkunifiedStatusFail - any other error
+/// \~english @retval eFrameworkunifiedStatusErrOther -other error(memory open/allocate fail)
+/// \~english @par Preconditons
+/// - The message queue specified by argument hMessage of this API must be allocated
+/// in advance by McOpenSender and McOpenSyncSender.
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - sending MQ handle(designated by parameter)is NULL[eFrameworkunifiedStatusInvldHandle]
+/// - sending MQ handle(designated by parameter)is invalid[eFrameworkunifiedStatusInvldHandle]
+/// - the type of sending MQ handle(designated by parameter)is not sending type[eFrameworkunifiedStatusInvldHndlType]
+/// - application name(source,designated by parameter)is NULL[eFrameworkunifiedStatusInvldQName]
+/// - the length of application name(designated by parameter)is over 20byte[eFrameworkunifiedStatusInvldQName]
+/// - sending data not in accordance with the size of sending data(eg:size is not 0 but data is NULL)
+/// [eFrameworkunifiedStatusInvldBuf]
+/// - sending data MQ is full [eFrameworkunifiedStatusMsgQFull]
+/// - fd of sending data MQ is invalid [eFrameworkunifiedStatusErrNoEBADF]
+/// - system call(signal) interupt occurs during MQ receiveing process[eFrameworkunifiedStatusErrNoEINTR]
+/// - the size of receiveing MQ buffer is invalid[eFrameworkunifiedStatusInvldBufSize]
+/// - error occurs during MQ receiveing process [eFrameworkunifiedStatusFail]
+/// - failed to access shared memmory for sending message[eFrameworkunifiedStatusErrOther]
+/// - failed to allocate buffer for data retriving from shared memmory[eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// set the response data to buffer and call this API
+/// when need to response to synchronous message get from synchronous communication(McInvokeSync)
+/// \~english @par
+/// This API applies communication function(using message queue)between processes to the application which do not
+/// use
+/// Dispatcher of NS Framework
+/// \~english @par
+/// cautions when using this API
+/// - Use FrameworkunifiedSetSyncResponseData if communacate with application which use the Dispatcher of NS Framework\n
+/// - the limit of size for sending data is according to system
+/// but the total size of SSystemMsgHeader and ResponseHeader shared memmory header is 48byte
+/// size limit should be(UINT_MAX-48byte)
+/// - operation is not guaranteed if the size which shown in data buffer pointer(data) is not in
+/// accordance with the length set in data buffer
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McOpenSyncReceiver, McInvokeSync, FrameworkunifiedSetSyncResponseData
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McSendSyncResponse(HANDLE hMessage, PCSTR source, UI_32 cmd, UI_32 seq_id, EFrameworkunifiedStatus ret_val, UI_32 length,
+ PCVOID data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McCreateInvokerName
+/// \~english @par Brief
+/// Create synchronous invoke response MQ name.
+/// \~english @param[in] source
+/// PCSTR - source service name
+/// \~english @param[in] sessionid
+/// UI_32 - session id
+/// \~english @param[in] invokerName
+/// PSTR - create invoker name buffer
+/// \~english @param[in] size
+/// UI_32 - InvokerName buffer size
+/// \~english @retval EFrameworkunifiedStatus indicates if the close was successfully
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusInvldParam -if parameter is invalid
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - sender application name(source,designated by parameter) is NULL[eFrameworkunifiedStatusInvldParam]
+/// - synchronous communication MQ name(invokerName,designated by parameter) is NULL[eFrameworkunifiedStatusInvldParam]
+/// - the size of synchronous communication MQ name buffer(designated by parameter)is NULL[eFrameworkunifiedStatusInvldParam]
+/// \~english @par Detail
+/// This API will add specific letters to the end of sender application name and return it as synchronous
+/// communication MQ name
+/// This name will be used when application create the MQ through McOpenSyncReceiver
+/// \~english @par
+/// cautions when using this API:
+/// - the synchronous communication MQ name(invokerName) buffer size should be larger than the length of source
+/// application
+/// name(at least 4byte larger)
+/// - source application name(designated by parameter) should be less than 15byte(according to NS framework
+/// spec,error occurs
+/// if message name length is over 20byte
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSyncReceiver
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McCreateInvokerName(PCSTR source, UI_32 sessionid, PSTR invokerName, UI_32 size);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McClose
+/// \~english @par Brief
+/// Close a connection to a Receiver message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle that will be closed
+/// \~english @retval EFrameworkunifiedStatus indicates if the close was successfully
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - If hMessage is NULL or invalid
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType - if hMessage is invalid
+/// \~english @par Preconditons
+/// message queue(McOpenSender, McOpenReceiver) is created in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(hMessage,designated by parameter) is NULL[eFrameworkunifiedStatusInvldHandle]
+/// - handle(hMessage,designated by parameter) is invalid[eFrameworkunifiedStatusInvldHandle]
+/// - the type of handle(designated by parameter) is neither sending or receiveing[eFrameworkunifiedStatusInvldHndlType]
+/// - fail to close the message queue(mq_close)[eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// close the message sending or receiveing message queue which is designated by parameter\n
+/// Application can call this API to close the message queue which is created by McOpenSender
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McOpenReceiver, McOpenSyncReceiver
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McClose(HANDLE hMessage);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetDataUSID
+/// \~english @par Brief
+/// Get the USID is the Unique Shared Memory ID.e. from the message that was received.
+/// \~english @param[in] pData
+/// void* - pointer to the data was received from the McReceive Call
+/// \~english @retval TMemID Type of memory buffer identifiers(unsigned int).
+/// \~english @retval NoneZero(Success)
+/// \~english @retval Zero(Failed)
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(pData) or pData is NULL.
+/// \~english @par Detail
+/// Invoke callback function with arguments to get the USID from the message that was received.\n
+/// If callback function is null and expectedCalls is '0', using default function 'McGetDataUSID' to get the USID
+/// from the message that was received.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+// FrameworkunifiedGetDataUSID, FrameworkunifiedForwardMessage
+//////////////////////////////////////////////////////////////////////////////////////////////
+TMemID McGetDataUSID(PVOID pData);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetMsgSrc
+/// \~english @par Brief
+/// Gets the constant pointer to source message queue.
+/// \~english @param[in] data
+/// PVOID - pointer to the data to be received
+/// \~english @retval PCSTR message queue's address
+/// CONST char* - constant pointer to source message queue
+/// \~english @retval NotNull(Success)
+/// \~english @retval Null(Failed)
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(data) or data is NULL.
+/// \~english @par Detail
+/// Invoke callback function with arguments to get the constant pointer to source message queue.\n
+/// If callback function is null and expectedCalls is '0', using default function 'McGetMsgSrc' to the constant
+/// pointer to source message queue.\n
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+// frameworkunifiedSendSyncResponse, frameworkunifiedProcessSyncResponse
+//////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR McGetMsgSrc(PVOID data);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McForward
+/// \~english @par Brief
+/// Forward a Message to indicate that there is a Shared Memory
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the send message queue, McOpenSender
+/// \~english @param[in] source
+/// PCSTR - the sender of this forwarding message.
+/// \~english @param[in] iCmd
+/// UI_32 - Command Id message to forward
+/// \~english @param[in] USID
+/// UI_32 - Unique Shared memory Id
+/// \~english @retval EFrameworkunifiedStatus indicates if the close was successfully
+/// CONST char* - constant pointer to source message queue
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Failed(anything else)
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hMessage) or hMessage is NULL.
+/// - It is an incorrect value(source) or source is NULL.
+/// - It is an incorrect value(iCmd).
+/// - It is an incorrect value(USID).
+/// \~english @par Detail
+/// Invoke callback function with arguments to forward a Message.\n
+/// If callback function is null and expectedCalls is '0', using default function 'McForward' to forward a
+/// Message.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+// FrameworkunifiedForwardMessage
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McForward(HANDLE hMessage, PCSTR source, UI_32 iCmd, TMemID USID);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McFlushReceiver
+/// \~english @par Brief
+/// Flush's all data on HANDLE's Receiver message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the recvMessage queue that will be flushed
+/// \~english @retval void
+/// \~english @par Preconditons
+/// message queue(McOpenReceiver)is created in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(hMessage,designated by parameter) is NULL
+/// - handle(hMessage,designated by parameter) is invalid [-1]
+/// - the type of handle(designated by parameter) is neither sending or receiveing[-1]
+/// \~english @par Detail
+/// message will not be flushed if process failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenSender, McOpenReceiver, McOpenSyncReceiver
+////////////////////////////////////////////////////////////////////////////////////////////
+void McFlushReceiver(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetQueueName
+/// \~english @par Brief
+/// Gets the name of the message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle of the message queue,
+/// (handle created with McOpenReceiver or McOpenSender)
+/// \~english @retval PCSTR name - name of the message queue if handle is valid else NULL
+/// \~english @par Preconditons
+/// Dispatcher for application should be created and initilized(FrameworkunifiedCreateDispatcherWithoutLoop)in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(hMessage,designated by parameter) is NULL
+/// - handle(hMessage,designated by parameter) is invalid [-1]
+/// - the type of handle(designated by parameter) is neither sending or receiveing[-1]
+/// \~english @par Detail
+/// return the name of specific message queue
+/// this APL is used for application to supervize message queue
+/// \~english @par
+/// This API applies communication function(using message queue)between processes to the application which do not
+/// use
+/// Dispatcher of NS Framework
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McOpenSender
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR McGetQueueName(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McGetQueueFD
+/// \~english @par Brief
+/// Gets the fd of the message queue.
+/// \~english @param[in] hMessage
+/// HANDLE - handle of the message queue.(handle created with McOpenReceiver or McOpenSender)
+/// \~english @retval int fd - fd of the message queue if handle is valid else -1
+/// \~english @par Preconditons
+/// - Dispatcher for application is created and initialized(FrameworkunifiedCreateDispatcherWithoutLoop) in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(hMessage,designated by parameter) is NULL
+/// - handle(hMessage,designated by parameter) is invalid [-1]
+/// - the type of handle(designated by parameter) is neither sending or receiveing[-1]
+/// \~english @par Detail
+/// return the fd of specific message queue
+/// this APL is used for application to supervize message queue
+/// \~english @par
+/// This API applies communication function(using message queue)between processes to the application which do not
+/// use
+/// Dispatcher of NS Framework
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McOpenReceiver, McOpenSender
+////////////////////////////////////////////////////////////////////////////////////////////
+int McGetQueueFD(HANDLE hMessage);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McTranslateError
+/// \~english @par Brief
+/// Translates global error variables into FW EFrameworkunifiedStatus
+/// \~english @param[in] error
+/// int - error variable
+/// \~english @retval EFrameworkunifiedStatus indicates frameworkunified error type
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(error).
+/// \~english @par Detail
+/// Invoke callback function with arguments to translates global error variables.\n
+/// If callback function is null and expectedCalls is '0', using default function 'McTranslateError' to translates
+/// global error variables.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+// none
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McTranslateError(int error);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McZcSetParam
+/// \~english @par Brief
+/// set variable parameter to messeg-sending header
+/// \~english @param[in] handle
+/// HANDLE - handle to the send message queue, McZcOpenSender
+/// \~english @param[in] cmd
+/// UI_32 -cmd for sending(ID to identify protocol of service)
+/// \~english @param[in] length
+/// UI_32 -size of buffer for message-sending
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was set successfully
+/// \~english @retval eFrameworkunifiedStatusOK sucess
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - If hMessage is NULL or invalid
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - invalid buffer
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize - invalid buffer size
+/// \~english @par Preconditons
+/// message queue is created by McZcOpenSender in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(designated by parameter) is NULL[NULL]
+/// - handle(designated by parameter) is invalid [NULL]
+/// - the buffer for sending in handle(designated by parameter) is NULL[NULL]
+/// - the size of data for sending(designated by parameter)(except header) is larger than the size of
+/// sending-buffer[eFrameworkunifiedStatusInvldBufSize]
+/// \~english @par Detail
+/// set the variable sending cmd and sending data length in sending buffer of message-sending handle
+/// This API will only do the initialization of message header.detail setting of data for sending will be done\n
+/// Application can use McZcGetBuf to do data setting
+/// \~english @par
+/// CMD ID should be in (PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD(0x10) to PROTOCOL_FRAMEWORKUNIFIED_MAX_CMD(0xFFFFFFF0))
+/// \~english @par
+/// cautions when using this API
+/// - detail data sending size should be in accordance with the data sending size which is set in this API
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McZcGetBuf, McZcSend
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McZcSetParam(HANDLE handle, UI_32 cmd, UI_32 length);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McZcGetBuf
+/// \~english @par Brief
+/// get the fist address of buffer for sending
+/// \~english @param[in] handle
+/// HANDLE - handle to the send message queue, McZcOpenSender
+/// \~english @retval PVOID the first address of buffer for data-sending
+/// \~english @retval NULL NULL pointer(fail to get)
+/// \~english @par Preconditons
+/// message queue is created by McZcOpenSender in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(designated by parameter) is NULL[NULL]
+/// - handle(designated by parameter) is invalid [NULL]
+/// - the buffer for sending in handle(designated by parameter) is NULL[NULL]
+/// \~english @par Detail
+/// get the first address of data(excpet the message-header)from sending-buffer in message-sending handle
+/// application will set the address got as sending message
+/// \~english @par
+/// cautions When using the application
+/// - result will not be guaranteed if the handle set is different from message-sending queue handle
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McZcGetBuf
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID McZcGetBuf(HANDLE handle);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McZcSend
+/// \~english @par Brief
+/// send message
+/// \~english @param[in] hMessage
+/// HANDLE - handle to the sendMessage, McZcOpenSender
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was sent successfully
+/// \~english @retval eFrameworkunifiedStatusOK success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - If hMessage is NULL or invalid
+/// \~english @retval eFrameworkunifiedStatusInvldBuf - buffer is invalid
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType -handle type is invalid
+/// \~english @retval eFrameworkunifiedStatusMsgQFull - message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF - file descriptor invalid
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR -system call(signal) interupt
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize -invalid buffer size
+/// \~english @par Preconditons
+/// message queuqe is created by McZcOpenSender
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - handle(hMessage,designated by parameter)is NULL[eFrameworkunifiedStatusInvldHandle]
+/// - handle(hMessage,designated by parameter)is invalid[eFrameworkunifiedStatusInvldHandle]
+/// - the sending-buffer in handle(hMessage,designated by parameter)is NULL[eFrameworkunifiedStatusInvldBuf]
+/// - the type of message queue in handle(hMessage,designated by parameter)is not sending
+/// type[eFrameworkunifiedStatusInvldHndlType]
+/// - message-sending queue is full[eFrameworkunifiedStatusMsgQFull]
+/// - file descriptor of message-sending queue is invalid[eFrameworkunifiedStatusErrNoEBADF]
+/// - system call(singal) interupts during the message sending process[eFrameworkunifiedStatusErrNoEINTR]
+/// - the size of buffer for message-sending is invalid[eFrameworkunifiedStatusInvldBufSize]
+/// \~english @par Detail
+/// send message using specific message-sending handle.\n
+/// data for sending should be set to message-sending handle(hMessage)beforhead using McZcSetParam, McZcGetBuf
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method
+/// \~english @see McZcOpenSender, McZcSetParam, McZcGetBuf
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McZcSend(HANDLE hMessage);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McZcOpenSender
+/// \~english @par Brief
+/// create message-sending queuqe
+/// \~english @param[in] source
+/// PCSTR - app (You) the sender
+/// \~english @retval Handle for sending messages to a queue (If INVALID_HANDLE is returned its an error)
+/// \~english @retval NULL NULL pointer(fail to get)
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - message queue name(designated by parameter)is NULL[NULL]
+/// - the length of message queue name(designated by parameter)(source) is over 20byte[NULL]
+/// - fail to get memmory for restoring formated message queue name [NULL]
+/// - length of formated message queue name is over 15byte or 16byte(when initial letter is'/')[NULL]
+/// - fail to get message queue(mq_open)[NULL]
+/// - fail to get memmory for message queue info managment(malloc)[NULL]
+/// - fail to get memory for sending buffer[NULL]
+/// \~english @par Detail
+/// create message queuqe and return the handle
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McZcSetParam, McZcGetBuf, McZcSend, McZcClose
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE McZcOpenSender(PCSTR source);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup McZcClose
+/// \~english @par Brief
+/// close the handle to message queue
+/// \~english @param[in] handle
+/// HANDLE - handle to the send message queue, handle got through McZcOpenSender
+/// \~english @retval EFrameworkunifiedStatus indicates if the message was close successfully
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusInvldHandle - If hMessage is NULL or invalid
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType If handle type is invalid
+/// \~english @par Preconditons
+/// - message queue is created by McZcOpenSender in advance
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - message handle(designated by parameters) is NULL[eFrameworkunifiedStatusInvldHandle]
+/// - message handle(designated by parameters) is invalid [eFrameworkunifiedStatusInvldHandle]
+/// - message handle type(designated by parameters) is not match(neither send or receive)[eFrameworkunifiedStatusInvldHndlType]
+/// - fail to close message queue(mq_close)[eFrameworkunifiedStatusInvldHandle]
+/// \~english @par Detail
+/// Close message-sending or message-receiving handle(designated by parameters)\n
+/// application call this function to close message queue which is created by McZcOpenSender.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see McZcOpenSender
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus McZcClose(HANDLE handle);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NATIVESERVICES_MESSAGE_CENTER_IF_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_msgs.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_msgs.h
new file mode 100755
index 0000000..48c83e7
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_msgs.h
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSMessageCenter
+/// \brief
+///
+/// Header defines the messaging IF header that will be at the start of each message.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MSGS_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MSGS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_shared_mem_if.h>
+
+#define MC_EMSGT_VALID_TOKEN (0xC8 << 24)
+#define MC_EMSGT_VALID_MASK (0xFF << 24)
+#define MC_EMSGT_VALID(t) ((t & MC_EMSGT_VALID_MASK) == MC_EMSGT_VALID_TOKEN) // NOLINT (readability/nolint)
+
+#define MC_EMSGT_SHM_MASK (0x1 << 0)
+#define MC_EMSGT_IS_SHM(t) (t & MC_EMSGT_SHM_MASK) // NOLINT (readability/nolint)
+
+#define MC_EMSGT_SYNC_MASK (0x1 << 1)
+#define MC_EMSGT_IS_SYNC(t) (t & MC_EMSGT_SYNC_MASK) // NOLINT (readability/nolint)
+
+#define MC_EMSGT_SYSINFO_MASK (0x1 << 2)
+#define MC_EMSGT_HAS_SYSINFO(t) (t & MC_EMSGT_SYSINFO_MASK) // NOLINT (readability/nolint)
+
+#pragma pack(1)
+/// \brief brief description of Messages Header that's pass via Message Center.
+/// Note: Don't remove #paragma pack(1) this is required for the
+/// ARM processor, forces data structures to be on a byte boundary
+/// all messages should be place in between #pragma pack(1) and #pragma pack()
+typedef struct tSysMsgHeader {
+ UI_32 eType; // The type of the message
+ TMemID memId; // Unique MemID of the data stored in shared memory,
+ // this is only valid if eType == IPC_MSG_SHM_TYPE
+ struct {
+ CHAR source[MAX_QUEUE_NAME_SIZE]; // Task that's sending the message.
+ UI_32 command; // The command id of the message
+ UI_32 length; // The length of the complete message in contiguous memory
+ // including the header and data block
+ UI_32 sessionid;
+ } info;
+} SSystemMsgHeader, *PSSystemMsgHeader;
+
+#pragma pack()
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MSGS_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service.h
new file mode 100755
index 0000000..e2a2deb
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service.h
@@ -0,0 +1,271 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief Header for message structures for notification_persistent_service.
+///
+/// Declares the external APIs to Notification and Persistence Service.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_np_service.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __NATIVESERVICES_NP_SERVICE_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NP_SERVICE_H__
+
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english A structure to register notification msg
+ */
+typedef struct _NC_register_notif_msg {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english notification event name string
+ UI_32 maxLength; //!< \~english Maximum possible length (bytes) of
+ // the message data
+ // UI_8 bIsPersistent; ///< Flag to indicate if data has to be persisted.
+ EFrameworkunifiedNotificationType persType; //!< \~english Specifies persitence for this notification
+ UI_8 dummy[4]; //!< \~english Packing to 32 bit boundary
+} NC_register_notif_msg;
+
+/**
+ * \~english A structure to register multiple notification msg
+ */
+typedef struct _NC_register_multiple_notif_msg {
+ UI_32 numNotifications; //!< \~english This has to be UI_32 to avoid holes.
+ NC_register_notif_msg notifierList[1]; //!< \~english variable number of structures
+} NC_register_multiple_notif_msg;
+
+/**
+ * \~english A structure to register immediate notification msg
+ */
+typedef struct _NC_register_immediate_notif_msg {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english Notification Event Name string
+ UI_32 maxLength; //!< \~english Maximum possible length (bytes) of
+ // the message data
+ EFrameworkunifiedNotificationType persType; //!< \~english Specifies persitence for this notification
+ UI_32 delay; //!< \~english Delay time for persistence
+ UI_8 dummy[4]; //!< \~english Packing to 32 bit boundary
+} NC_register_immediate_notif_msg;
+
+/**
+ * \~english A structure to register multiple immediate notification msg
+ */
+typedef struct _NC_register_multiple_immediate_notif_msg {
+ UI_32 numNotifications; //!< \~english This has to be UI_32 to avoid holes.
+ NC_register_immediate_notif_msg notifierList[1]; //!< \~english variable number of structures
+} NC_register_multiple_immediate_notif_msg;
+
+/**
+ * \~english A structure to unregister notification msg
+ */
+typedef struct _NC_unregister_notif_msg {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english Notification Event Name string
+} NC_unregister_notif_msg, NC_subscribe_msg, NC_unsubscribe_frm_notif_msg, NC_get_pers_data_msg;
+
+/**
+ * \~english A structure to unregister multiple notification msg
+ */
+typedef struct _NC_unregister_multiple_notif_msg {
+ UI_32 numNotifications; //!< \~english notification event name num
+ NC_unregister_notif_msg notificationList[1]; //!< \~english notification event name List
+} NC_unregister_multiple_notif_msg;
+
+/**
+ * \~english A structure to save pers data
+ */
+typedef struct _NC_savepersdata_ack {
+ EFrameworkunifiedStatus eStatus; //!< \~english eFrameworkunifiedStatusOK is (valid - data stored, anything else is
+} NC_savepersdata_ack;
+
+/**
+ * \~english A structure to subscribe multiple notification msg
+ */
+typedef struct _NC_subscribe_multiple_notif_msg {
+ UI_32 numNotifications; //!< \~english notification event name num
+ NC_subscribe_msg notificationList[1]; //!< \~english notification event name List
+} NC_subscribe_multiple_notif_msg;
+
+/**
+ * \~english A structure to subscribe multiple notification msg
+ */
+typedef struct _NC_unsubscribe_multiple_notif_msg {
+ UI_32 numNotifications; //!< \~english notification event name num
+ NC_unsubscribe_frm_notif_msg notificationList[1]; //!< \~english notification event name List
+} NC_unsubscribe_multiple_notif_msg;
+
+/**
+ * \~english A structure to get pers data failed
+ */
+typedef struct __NC_get_persdata_failed_ack {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english notification name
+} NC_get_persdata_failed_ack;
+
+/**
+ * \~english A structure to set personality
+ */
+typedef struct _NC_User {
+ CHAR cUsername[MAX_PATH_LENGTH]; //!< \~english name of personality
+} NC_User;
+
+/**
+ * \~english A structure to register persistent file with the notification_persistent_service
+ */
+typedef struct _NC_RegisterPersistentFileMsg {
+ CHAR cFileTag[MAX_STRING_SIZE_TAG]; //!< \~english Tag associated with the
+ // file that would be persisted
+ BOOL bIsUserFile; //!< \~english is user file
+} NC_RegisterPersistentFileMsg;
+
+/**
+ * \~english A structure to specify where to load the file associated with the Tag
+ */
+typedef struct _NC_LoadPersistedFileMsg {
+ CHAR cFileTag[MAX_STRING_SIZE_TAG]; //!< \~english Tag associated with the file
+ CHAR cFilePath[MAX_PATH_LENGTH]; //!< \~english path to which the file needs to retrieved
+ CHAR cUsername[MAX_PATH_LENGTH]; //!< \~english Name of the user for user specific file.
+} NC_LoadPersistedFileMsg;
+
+/**
+ * \~english A structure to release persistent file
+ */
+typedef struct _NC_ReleasePersistentFileMsg {
+ EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType; //!< \~english should the file be persisted
+ CHAR cFilePath[MAX_PATH_LENGTH]; //!< \~english path from which the
+ // file needs to be picked up to persist
+ CHAR cFileTag[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english Tag associated with the
+ // file to be persisted
+ CHAR cUsername[MAX_PATH_LENGTH]; //!< \~english Name of the user for user specific file.
+} NC_ReleasePersistentFileMsg;
+
+/**
+ * \~english A structure to register persistent folder with the notification_persistent_service
+ */
+typedef struct _NC_RegisterPersistentFolderMsg {
+ CHAR cFolderTag[MAX_STRING_SIZE_TAG]; //!< \~english Tag associated with the
+ // folder that would be persisted
+ BOOL bIsUserFolder; //!< \~english Check if the folder is of user type
+} NC_RegisterPersistentFolderMsg;
+
+/**
+ * \~english A structure to specify where to load the folder associated with the Tag
+ */
+typedef struct _NC_LoadPersistedFolderMsg {
+ CHAR cFolderTag[MAX_STRING_SIZE_TAG]; //!< \~english Tag associated with the folder
+ CHAR cFolderPath[MAX_PATH_LENGTH]; //!< \~english path to which the folder needs to retrieved
+ CHAR cUsername[MAX_PATH_LENGTH]; //!< \~english Name of the user for user specific folder.
+} NC_LoadPersistedFolderMsg;
+
+/**
+ * \~english A structure to Release Persistent Folder Msg
+ */
+typedef struct _NC_ReleasePersistentFolderMsg {
+ EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType; //!< \~english should the file be persisted
+ CHAR cFolderPath[MAX_PATH_LENGTH]; //!< \~english path from which the folder
+ // needs to be picked up to persist
+ CHAR cFolderTag[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english Tag associated with
+ // the folder to be persisted
+ CHAR cUsername[MAX_PATH_LENGTH]; //!< \~english Name of the user for user
+ // specific folder.
+} NC_ReleasePersistentFolderMsg;
+
+/**
+ * \~english A structure to Load Persisted Ack
+ */
+typedef struct _NC_LoadPersistedAck {
+ EFrameworkunifiedStatus eStatus; //!< \~english ack the success/failure in
+ // retrieving the file/folder from persistence
+ CHAR cTag[MAX_PATH_LENGTH]; //!< \~english tag of the file/folder for which acknowledge is made
+} NC_LoadPersistedAck, NC_ReleasePersistedAck;
+
+/**
+ * \~english A structure to Nor Persistent Data
+ */
+typedef struct _NC_NorPersistentData {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english Notification Event Name string
+ CHAR pPublisherName[MAX_NAME_SIZE_APP]; //!< \~english Publisher Event Name string
+ UI_32 dataSize; //!< \~english data size
+ UI_32 uiDelay; //!< \~english ui Delay
+ UI_32 uiMaxSize; //!< \~english ui Max Size
+} NC_NorPersistentData;
+
+/**
+ * \~english A structure to request for deleting data from persistent memory
+ */
+typedef struct _NC_ClearPersistedDataReq {
+ EFrameworkunifiedClearPersistence ePersistenceData; //!< \~english defines what
+ // data to be deleted from persistent memory
+} NC_ClearPersistedDataReq;
+
+/**
+ * \~english A structure for receiving ack of data deleted from persistent memory
+ */
+typedef struct _NC_ClearPersisteDatadAck {
+ EFrameworkunifiedStatus eStatus; //!< \~english ack status of ClearPersistedData request
+} NC_ClearPersisteDatadAck;
+
+/**
+ * \~english A structure to request stop message to notification_persistent_service.
+ */
+typedef struct _NC_StopMsgData {
+ EFrameworkunifiedShutdownType eShutdownType; //!< \~english shutdown type
+ UI_32 uiStopMsgData; //!< \~english Reason for sending stop message to NPPService
+} NC_StopMsgData;
+
+/**
+ * \~english A structure to set the persist type of file and folder
+ */
+typedef struct _NC_SetPersistType {
+ EFrameworkunifiedPersistCategory ePersistType; //!< \~english persist type
+ CHAR cTag[MAX_PATH_LENGTH]; //!< \~english tag name of the file or folder
+} NC_SetFilePersistType, NC_SetFolderPersistType;
+
+/**
+ * \~english A data received with ack sent by notification_persistent_service when immediate notification data is
+ * written in persistent memory
+ */
+typedef struct _NC_ImmediateWriteAck {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; //!< \~english notification Name
+ EFrameworkunifiedStatus eStatus; //!< \~english status of request
+} NC_ImmediateWriteAck;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NATIVESERVICES_NP_SERVICE_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_if.h
new file mode 100755
index 0000000..b188958
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_if.h
@@ -0,0 +1,2482 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_np_service_if.h
+ * @brief \~english Declares the external APIs to Notification and Persistence Service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __NATIVESERVICES_NP_SERVICE_IF_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NP_SERVICE_IF_H__
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english A structure to Notification Info
+ */
+typedef struct _NotificationInfo {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; ///< Notification Event Name string
+ UI_32 maxLength; ///< Maximum possible length (bytes) of the message data
+ EFrameworkunifiedNotificationType persType; ///< Specifies persitence for this notification
+ UI_8 dummy[4]; ///< Packing to 32 bit boundary
+} NotificationInfo;
+
+/**
+ * \~english A structure to Immediate Notification Info
+ */
+typedef struct _ImmediateNotificationInfo {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; ///< Notification Event Name string
+ UI_32 maxLength; ///< Maximum possible length (bytes) of the message data
+ EFrameworkunifiedNotificationType persType; ///< Specifies persitence for this notification
+ UI_32 delay;
+ UI_8 dummy[4]; ///< Packing to 32 bit boundary
+} ImmediateNotificationInfo;
+
+/**
+ * \~english A structure to Subscribe Info
+ */
+typedef struct _SubscribeInfo {
+ CHAR notificationName[MAX_STRING_SIZE_NOTIFICATION]; ///< Notification Event Name string
+} SubscribeInfo;
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPRegisterNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to register a set of notification
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \~english @param[in] numNotifications
+/// PCSTR - Name of Notification
+/// \~english @param[in] pNotificationArray
+/// NotificationInfo - Array of notifications
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(numNotifications).
+/// - It is an incorrect value(pNotificationArray) or pNotificationArray is NULL.
+/// \~english @par Detail
+/// Invoke callback function with arguments to register a set of notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPRegisterNotifications' to
+/// register a set of notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPRegisterNotification, NPRegisterNotification
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ NotificationInfo *pNotificationArray);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPRegisterImmediateNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to register a set of immediate notifications
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue.
+/// \~english @param[in] numNotifications
+/// PCSTR - Name of Notification.
+/// \~english @param[in] pNotificationArray
+/// ImmediateNotificationInfo - Array of immediate notifications
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(numNotifications).
+/// - It is an incorrect value(pNotificationArray) or pNotificationArray is NULL.
+/// \~english @par Detail
+/// Invoke callback function with arguments to register a set of immediate notification.\n
+/// If callback function is null and expectedCalls is '0', using default function
+/// 'NPRegisterImmediateNotifications' to register a set\n
+/// of immediate notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPRegisterImmediatePersistNotification
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterImmediateNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ ImmediateNotificationInfo *pNotificationArray);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPRegisterNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to register a notification
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \~english @param[in] notif_name
+/// PCSTR - Name of Notification
+/// \~english @param[in] max_length
+/// const UI_32 - Max size of the notification message
+/// \~english @param[in] perstype
+/// const EFrameworkunifiedPersistentVarType - Flag to indicate if it has to be persistent
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(notif_name) or notif_name is NULL.
+/// - It is an incorrect value(max_length).
+/// \~english @par Detail
+/// Invoke callback function with arguments to register a notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPRegisterNotification' to
+/// register a notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// NPRegisterNotifications, FrameworkunifiedNPRegisterNotification
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPRegisterNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR notif_name,
+ const UI_32 max_length, const EFrameworkunifiedNotificationType perstype);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPUnRegisterNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to remove a notification
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \~english @param[in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pNotification) or pNotification is NULL.
+/// \~english @par Detail
+/// Invoke NPUnRegisterNotifications to remove one notification named 'pPublisherName'.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPUnRegisterNotification, NPUnRegisterNotifications
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnRegisterNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSetPersistentNotfnType
+/// \~english @par Brief
+/// API to send message to Notification Service to set the persist category of notification.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Service Name
+/// \~english @param[in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @param[in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - Persistent category
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pNotification) or pNotification is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to set the persist category of
+/// notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSetPersistentNotfnType' to
+/// send\n
+/// message to Notification Service to set the persist category of notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSetPersistentNotfnType
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetPersistentNotfnType(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification,
+ EFrameworkunifiedPersistCategory ePersistCategory);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSetPersistNotfnDefaultValue
+/// \~english @par Brief
+/// API to send message to Notification Service to set default value of persistent category in notification.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Service Name
+/// \~english @param[in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @param[in] pData
+/// PVOID - Data buffer
+/// \~english @param[in] iLength
+/// const UI_32 - Size of data buffer
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pNotification) or pNotification is NULL.
+/// - It is an incorrect value(pData) or pData is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to set default value of persistent category
+/// in notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSetPersistNotfnDefaultValue'
+/// to send message\n
+/// to Notification Service to set default value of persistent category in notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSetPersistNotfnDefaultValue
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSetPersistNotfnDefaultValue(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification,
+ PCVOID pData, const UI_32 iLength);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPUnRegisterNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to remove a set of notification
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \~english @param[in] numNotifications
+/// UI_32 - Number of Notification
+/// \~english @param[in] pNotificationArray
+/// NotificationInfo - Array of notifications
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(numNotifications).
+/// - It is an incorrect value(pNotificationArray) or pNotificationArray is NULL.
+/// - Allocate memory for deal with original notification array failed.
+/// \~english @par Detail
+/// Copy original notification array to temp allocated memory and then remove the given notifications from the
+/// memory.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPUnRegisterNotifications
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPUnRegisterNotifications(HANDLE hNPMsgQ, PCSTR pPublisherName, UI_32 numNotifications,
+ NotificationInfo *pNotificationArray);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPPublishNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to notify subscribers
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of Publisher message queue
+/// \~english @param[in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @param[in] pData
+/// PVOID - Data buffer
+/// \~english @param[in] iLength
+/// const UI_32 - Size of data buffer
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusInvldParam
+/// \~english @retval eFrameworkunifiedStatusMsgQFull
+/// \~english @retval eFrameworkunifiedStatusErrNoEBAD
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize
+/// \~english @retval eFrameworkunifiedStatusFail
+/// \~english @retval eFrameworkunifiedStatusErrOther
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - none
+/// \~english @par Conditions of processing failure
+/// - queue handle(hNPMsgQ,designated by parameter)is NULL[eFrameworkunifiedStatusInvldParam]
+/// - pubulisher name(pPublisherName,designated by parameter)is NULL[eFrameworkunifiedStatusInvldParam]
+/// - Notification name(pNotification)is NULL[eFrameworkunifiedStatusInvldParam]
+/// - pubulisher name(pPublisherName,designated by parameter)is nullbuffer[eFrameworkunifiedStatusInvldParam]
+/// - Notification name(pNotification,designated by parameter)is nullbuffer[eFrameworkunifiedStatusInvldParam]
+/// - message queue is full [eFrameworkunifiedStatusMsgQFull]
+/// - wrong file discriptor for message sending [eFrameworkunifiedStatusErrNoEBAD]
+/// - system call disruput during message sending process[eFrameworkunifiedStatusErrNoEINTR]
+/// - wrong buffer size for sending message[eFrameworkunifiedStatusInvldBufSize]
+/// - message sending failed[eFrameworkunifiedStatusFail]
+/// - failed access to shared memmory for message sending[eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail
+/// send system info as Notification name and command[NPS_PUBLISH_EV_REQ] through McSendWithSysInfo()
+/// NPP service wii process according to command[NPS_PUBLISH_EV_REQ]when get the message above
+/// \~english @par Classification
+/// - pubulic
+/// \~english @par Type
+/// Pub-Sub
+/// \~english @see McSendWithSysInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPPublishNotification(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pNotification,
+ PCVOID pData, const UI_32 iLength);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSubscribeToNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to add to subscription list for.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \~english @param[in] notif_name
+/// PCSTR - Name of Notification
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(notif_name) or notif_name is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to add to subscription list for given
+/// notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSubscribeToNotification' to
+/// Notification Service to add to subscription list for given notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSubscribeToNotification
+//////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSubscribeToNotification(HANDLE hNPMsgQ, PCSTR pSubscriberName, PCSTR notif_name);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSubscribeToNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to add multiple subscriptions for a set of notification.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \~english @param[in] numNotifications
+/// UI_32 - Number of Notifications
+/// \~english @param[in] pSubscribeInfoArray
+/// SubscribeInfo* - Array of SubscribeInfo
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(numNotifications).
+/// - It is an incorrect value(pSubscribeInfoArray) or pSubscribeInfoArray is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to add multiple subscriptions for a set of
+/// notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSubscribeToNotifications' to
+/// Notification Service to add multiple subscriptions for a set of notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSubscribeToNotifications
+EFrameworkunifiedStatus NPSubscribeToNotifications(HANDLE hNPMsgQ, PCSTR pSubscriberName, UI_32 numNotifications,
+ SubscribeInfo *pSubscribeInfoArray);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPUnsubscribeFromNotification
+/// \~english @par Brief
+/// API to send message to Notification Service to remove from subscription list for given notification.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \~english @param[in] pNotification
+/// PCSTR - Name of Notification
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(pNotification) or pNotification is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to remove from subscription list for given
+/// notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPUnsubscribeFromNotification'
+/// to send message to Notification Service to remove from subscription list for given notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPUnsubscribeFromNotification
+EFrameworkunifiedStatus NPUnsubscribeFromNotification(HANDLE hNPMsgQ, PCSTR pSubscriberName, PCSTR pNotification);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPUnsubscribeFromNotifications
+/// \~english @par Brief
+/// API to send message to Notification Service to unsubscribe multiple subscriptions for a set of notification.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pSubscriberName
+/// PCSTR - Name of subscriber message queue
+/// \~english @param[in] numNotifications
+/// UI_32 - Number of Notifications
+/// \~english @param[in] pUnSubscribeInfoArray
+/// SubscribeInfo - Array of notifications
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(numNotifications).
+/// - It is an incorrect value(pUnSubscribeInfoArray) or pUnSubscribeInfoArray is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to unsubscribe multiple subscriptions for a
+/// set of notification.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPUnsubscribeFromNotifications'
+/// to send message to Notification Service to unsubscribe multiple subscriptions for a set of notification.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPUnsubscribeFromNotifications
+EFrameworkunifiedStatus NPUnsubscribeFromNotifications(HANDLE hNPMsgQ, PCSTR pUnSubscriberName, UI_32 numNotifications,
+ SubscribeInfo *pUnSubscribeInfoArray);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPReadPersistedData
+/// \~english @par Brief
+/// API to requested the persistent data corresponding to the notification if available.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \~english @param[in] notification
+/// PCSTR - Name of Notification
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(notification) or notification is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to requested the persistent data corresponding to the notification if
+/// available.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPReadPersistedData' to
+/// requested the persistent data corresponding to the notification if available.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPReadPersistedData
+EFrameworkunifiedStatus NPReadPersistedData(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR notification);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSavePersistentData
+/// \~english @par Brief
+/// API to send message to Notification Service to save all persisted data that in Ram to the file system via a
+/// file write.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to save all persisted data.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSavePersistentData' to send
+/// message to Notification Service to save all persisted data.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSavePersistentData
+EFrameworkunifiedStatus NPSavePersistentData(HANDLE hNPMsgQ, PCSTR pPublisherName);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPRegisterPersistentFile
+/// \~english @par Brief
+/// API to send message to Notification Service to add a file path as to be persisted.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pTag
+/// PCSTR - A unique identifier for the file path specified, this is used in retrieve/Load the file later.
+/// \~english @param[in] bIsUserFile
+/// BOOL - Set TRUE, if registering user file.
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to add a file path as to be persisted.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPRegisterPersistentFile' to
+/// send message to Notification Service to add a file path as to be persisted.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPRegisterPersistentFile
+EFrameworkunifiedStatus NPRegisterPersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pTag, BOOL bIsUserFile);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSetFilePersistentType
+/// \~english @par Brief
+/// API to send message to Notification Service to add a file path as to be persisted.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pTag
+/// PCSTR - A unique identifier for the file path specified, this is used in retrieve/Load the file later.
+/// \~english @param[in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - persist category
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pSubscriberName) or pSubscriberName is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to add a file path as to be persisted. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSetFilePersistentType' to
+/// send message to Notification Service to add a file path as to be persisted.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSetFilePersistentType
+EFrameworkunifiedStatus NPSetFilePersistentType(HANDLE hNPMsgQ, PCSTR pPublisherName,
+ PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPLoadPersistentFile
+/// \~english @par Brief
+/// API to send message to Notification Service to copy file from persistent memory to
+/// specified path. The caller recieves an acknowledgement once NPS completes file copy
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pDstFilePath
+/// PCSTR - Complete file path to which the file should be copied from persistent area.
+/// \~english @param[in] pTag
+/// PCSTR - Tag associated with the file that needs to be copied to pDstFilePath.
+/// \~english @param[in] hUser
+/// HANDLE - Load the file for the specified user.
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pDstFilePath) or pDstFilePath is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// - It is an incorrect value(hUser) or hUser is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to copy file from persistent memory to
+/// specified path. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPLoadPersistentFile' to send
+/// message to Notification Service to copy file from persistent memory to specified path.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPLoadPersistentFile
+EFrameworkunifiedStatus NPLoadPersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pDstFilePath,
+ PCSTR pTag, HANDLE hUser);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPReleasePersistentFile
+/// \~english @par Brief
+/// API to send message to Notification Service to notify that the file can be persisted.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] eReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease:not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly:persist instantly
+/// \~english @param[in] pTag
+/// PCSTR - Tag associated with the file released
+/// \~english @param[in] pFullFilePath
+/// PCSTR - Full path name of the file to be persisted
+/// \~english @param[in] hUser
+/// HANDLE - Release the file for the specified user.
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pDstFilePath) or pDstFilePath is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// - It is an incorrect value(pFullFilePath) or pFullFilePath is NULL.
+/// - It is an incorrect value(hUser) or hUser is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to notify that the file can be persisted. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPReleasePersistentFile' to
+/// send message to Notification Service to notify that the file can be persisted.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPReleasePersistentFile
+EFrameworkunifiedStatus NPReleasePersistentFile(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedReleaseType eReleaseType, PCSTR pTag,
+ PCSTR pFullFilePath, HANDLE hUser);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPPersistentSync
+/// \~english @par Brief
+/// API to synchronizes by NPPService.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] eReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease:not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly:persist instantly
+/// \~english @param[in] SrcName
+/// PCSTR - source service name.
+/// \~english @param[in] sessionid
+/// UI_32 - session ID
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(SrcName) or SrcName is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(sessionid).
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to synchronizes by NPPService. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPPersistentSync' to
+/// synchronizes by NPPService.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPPersistentSync
+EFrameworkunifiedStatus NPPersistentSync(PCSTR SrcName, HANDLE hNPMsgQ, UI_32 sessionid, PCSTR pPublisherName);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSetPersonality
+/// \~english @par Brief
+/// API to send message to Notification Service to set the Personality.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pUserName
+/// PCSTR - Name of new Personality
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pUserName) or pUserName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to set the Personality. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSetPersonality' to send
+/// message to Notification Service to set the Personality.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSetPersonality
+EFrameworkunifiedStatus NPSetPersonality(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pUserName);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPChangePersonality
+/// \~english @par Brief
+/// API to send message to Notification Service to change the current Personality.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pUserName
+/// PCSTR - Name of new Personality
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pUserName) or pUserName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to change the current Personality. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPChangePersonality' to send
+/// message to Notification Service to change the current Personality.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPChangePersonality
+EFrameworkunifiedStatus NPChangePersonality(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pUserName);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPGetReadyStatusOfNPP
+/// \~english @par Brief
+/// To be used by System Manager Service only. SystemManager will use this API to get the ready status of
+/// NPPService.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pRequesterName
+/// PCSTR - Name of the requesters message queue.
+/// \~english @param[in] pUserName
+/// PCSTR - Name of new Personality
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pRequesterName) or pRequesterName is NULL.
+/// - It is an incorrect value(pUserName) or pUserName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to get the ready status of NPPService. \n
+/// If callback function is null and expectedCalls is '0', using default function 'NPGetReadyStatusOfNPP' to get
+/// the ready status of NPPService.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPGetReadyStatusOfNPP
+EFrameworkunifiedStatus NPGetReadyStatusOfNPP(HANDLE hNPMsgQ, PCSTR pRequesterName);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPClearPersistedData
+/// \~english @par Brief
+/// API to delete the persisted data of NS_NPS.
+/// Note: Currently to be used by HMI service only
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pRequesterName
+/// PCSTR - Name of the requesters message queue.
+/// \~english @param[in] eFrameworkunifiedClearPersistenceScope
+/// EFrameworkunifiedClearPersistence - specifies what data to delete from persistent memory.
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pRequesterName) or pRequesterName is NULL.
+/// \~english @par Detail
+/// Invoke callback function to delete the persisted data of NS_NPS.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPClearPersistedData' to delete
+/// the persisted data of NS_NPS.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPClearPersistedData
+EFrameworkunifiedStatus NPClearPersistedData(HANDLE hNPMsgQ, PCSTR pRequesterName, EFrameworkunifiedClearPersistence eFrameworkunifiedClearPersistenceScope);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPRegisterPersistentFolder
+/// \~english @par Brief
+/// API to send message to Notification Service to add a folder path as to be persisted.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pTag
+/// PCSTR - A unique identifier for the folder path specified, this is used in retrieve/Load the folder later.
+/// \~english @param[in] bIsUserFolder
+/// BOOL - Set TRUE, if registering user folder.
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to add a folder path as to be persisted.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPRegisterPersistentFolder' to
+/// send message to Notification Service to add a folder path as to be persisted.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPRegisterPersistentFolder
+EFrameworkunifiedStatus NPRegisterPersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pTag, BOOL bIsUserFolder);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPSetFolderPersistentType
+/// \~english @par Brief
+/// API to send message to Notification Service to set the persist category of file.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pTag
+/// PCSTR - A unique identifier for the file path specified, this is used in retrieve/Load the file later
+/// \~english @param[in] ePersistCategory
+/// EFrameworkunifiedPersistCategory - persist category
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to set the persist category of file.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPSetFolderPersistentType' to
+/// send message to Notification Service to set the persist category of file.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPSetFolderPersistentType
+EFrameworkunifiedStatus NPSetFolderPersistentType(HANDLE hNPMsgQ, PCSTR pPublisherName,
+ PCSTR pTag, EFrameworkunifiedPersistCategory ePersistCategory);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPLoadPersistentFolder
+/// \~english @par Brief
+/// API to send message to Notification Service to copy folder from persistent memory to
+/// specified path. The caller recieves an acknowledgement once NPS completes folder copy.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to message queue of Notification service.
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] pDstFolderPath
+/// PCSTR - Complete folder path to which the folder should be copied from persistent area
+/// \~english @param[in] pTag
+/// PCSTR - Tag associated with the folder that needs to be copied to pDstFolderPath
+/// \~english @param[in] hUser
+/// HANDLE - Name of new Personality
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pDstFolderPath) or pDstFolderPath is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// - It is an incorrect value(hUser) or hUser is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to copy folder from persistent memory to
+/// specified path.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPLoadPersistentFolder' to send
+/// message to Notification Service to copy folder from persistent memory to specified path.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPLoadPersistentFolder
+EFrameworkunifiedStatus NPLoadPersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, PCSTR pDstFolderPath,
+ PCSTR pTag, HANDLE hUser);
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NPReleasePersistentFolder
+/// \~english @par Brief
+/// API to send message to Notification Service to notify that the folder can be persisted.
+/// \~english @param[in] hNPMsgQ
+/// HANDLE - Handle to the Framework
+/// \~english @param[in] pPublisherName
+/// PCSTR - Name of publisher message queue.
+/// \~english @param[in] eFrameworkunifiedReleaseType
+/// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease :not on release
+/// eFrameworkunifiedPersistOnShutdown:persist on shutdown
+/// eFrameworkunifiedPersistInstantly :persist instantly
+/// \~english @param[in] pTag
+/// PCSTR - Tag associated with the folder released
+/// \~english @param[in] pFullFolderPath
+/// PCSTR - Full path name of the folder to be persisted
+/// \~english @param[in] hUser
+/// HANDLE - Name of new Personality
+/// \~english @retval EFrameworkunifiedStatus indicates success or error
+/// \~english @retval Success(eFrameworkunifiedStatusOK)
+/// \~english @retval Error(anything else)
+/// \~english @par
+/// EFrameworkunifiedStatus Enum
+/// \~english @code
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Function pointer specified by the argument is NULL.
+/// - It is an incorrect value(hNPMsgQ) or hNPMsgQ is NULL.
+/// - It is an incorrect value(pPublisherName) or pPublisherName is NULL.
+/// - It is an incorrect value(pDstFolderPath) or pDstFolderPath is NULL.
+/// - It is an incorrect value(pTag) or pTag is NULL.
+/// - It is an incorrect value(hUser) or hUser is NULL.
+/// \~english @par Detail
+/// Invoke callback function to send message to Notification Service to notify that the folder can be persisted.\n
+/// If callback function is null and expectedCalls is '0', using default function 'NPReleasePersistentFolder' to
+/// send message to Notification Service to notify that the folder can be persisted.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @see
+/// FrameworkunifiedNPReleasePersistentFolder
+EFrameworkunifiedStatus NPReleasePersistentFolder(HANDLE hNPMsgQ, PCSTR pPublisherName, EFrameworkunifiedReleaseType eFrameworkunifiedReleaseType, PCSTR pTag,
+ PCSTR pFullFolderPath, HANDLE hUser);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NATIVESERVICES_NP_SERVICE_IF_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence.h
new file mode 100755
index 0000000..88daef7
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence.h
@@ -0,0 +1,151 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief This file contains the declaration for methods to retrieve and store data for NOR storage
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_np_service_nor_persistence.h
+ * @brief This file contains the declaration for methods to retrieve and store data for NOR storage
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __NATIVESERVICES_NP_NOR_SERVICE_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NP_NOR_SERVICE_H__
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NPSynchronousReadPersistentData
+ /// \~english @par Brief
+ /// API to synchronously read persistent data corresponding to a notification before NPPService is available
+ /// \~english @param[in] pAppName
+ /// PCSTR - Application/ thread name
+ /// \~english @param[in] notif_name
+ // PCSTR - Name of Notification
+ /// \~english @param[in] pData
+ /// PVOID - Pointer to the buffer where read data will be written.
+ /// \~english @param[in] uiDataSize
+ /// UI_32 - Length of the data buffer.
+ /// \~english @param[in] ePersistCategory
+ /// const EFrameworkunifiedPersistCategory - Persist Category of Notification.
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusInvldParam
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - NULL handle specified in the argument(pAppName).[eFrameworkunifiedStatusInvldParam]
+ /// - NULL handle specified in the argument(notif_name).[eFrameworkunifiedStatusInvldParam]
+ /// - NULL handle specified in the argument(pData).[eFrameworkunifiedStatusInvldParam]
+ /// - 0 specified in the argument(uiDataSize).[eFrameworkunifiedStatusFail]
+ /// - Handle of the application [eFrameworkunifiedStatusFail]
+ /// - If the file access process fails,.... [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// API to synchronously read persistent data corresponding to a notification before NPPService is available
+ /// \~english @par
+ /// File reading by this API is exclusive control by semaphore,
+ /// and writing to non-voatie area is to use NPSynchronousWritePersistentData().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see NPSynchronousWritePersistentData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousReadPersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ UI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NPSynchronousWritePersistentData
+ /// \~english @par Brief
+ /// API to synchronously write persistent data corresponding to a notification before NPPService is available
+ /// \~english @param[in] pAppName
+ /// PCSTR - Application/ thread name
+ /// \~english @param[in] notif_name
+ // PCSTR - Name of Notification
+ /// \~english @param[in] pData
+ /// PVOID - Pointer to the buffer where read data will be written.
+ /// \~english @param[in] uiDataSize
+ /// UI_32 - Length of the data buffer.
+ /// \~english @param[in] ePersistCategory
+ /// const EFrameworkunifiedPersistCategory - Persist Category of Notification.
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusInvldParam
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - NULL handle specified in the argument(pAppName).[eFrameworkunifiedStatusInvldParam]
+ /// - NULL handle specified in the argument(notif_name).[eFrameworkunifiedStatusInvldParam]
+ /// - NULL handle specified in the argument(pData).[eFrameworkunifiedStatusInvldParam]
+ /// - 0 specified in the argument(uiDataSize).[eFrameworkunifiedStatusFail]
+ /// - Handle of the application [eFrameworkunifiedStatusFail]
+ /// - If the file access process fails,.... [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// API to synchronously read persistent data corresponding to a notification before NPPService is available
+ /// \~english @par
+ /// File reading by this API is exclusive control by semaphore,
+ /// and writing to non-voatie area is to use NPSynchronousWritePersistentData().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Set Get
+ /// \~english @see NPSynchronousWritePersistentData
+ ////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousWritePersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ const UI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory = eFrameworkunifiedUserData);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NATIVESERVICES_NP_NOR_SERVICE_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence_internal.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence_internal.h
new file mode 100755
index 0000000..ea149c5
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_nor_persistence_internal.h
@@ -0,0 +1,131 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPServiceIf
+/// \brief This file contains the declaration for internal functions to retrieve and store
+/// immediate notification data from and to persistent storage.
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_NOR_PERSISTENCE_INTERNAL_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_NOR_PERSISTENCE_INTERNAL_H_
+
+///////////////////////////////////////////////////////////////////////////////
+// Include Files
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousGetPersistentData
+/// API to retrieve immediate storage notification data structure.
+///
+///
+/// \param [in] pAppName
+/// PCSTR - Name of application service
+/// \param [in] notif_name
+/// PCSTR - Name of notification to be written to immediate storage
+/// \param [in] pData
+/// PVOID - Notification data
+/// \param [in] uiDataSize
+/// UI_32 - Size of notification data
+/// \param [out] ptNorPersistentData
+/// NC_NorPersistentData - Immediate notification structure
+/// \param [in] ePersistCategory
+/// const EFrameworkunifiedPersistCategory - Persist Category of Notification.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousGetPersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ UI_32 uiDataSize,
+ NC_NorPersistentData &ptNorPersistentData,
+ const EFrameworkunifiedPersistCategory ePersistCategory);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPSynchronousGetPersistentDataSize
+/// API to get immediate storage notification data size.
+///
+/// \param [in] notif_name
+/// PCSTR - Name of notification to be read from immediate storage
+/// \param [out] uiDataSize
+/// PUI_32 - notification data size
+/// \param [in] ePersistCategory
+/// const EFrameworkunifiedPersistCategory - Persist Category of Notification.
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - success or failure
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPSynchronousGetPersistentDataSize(PCSTR notif_name,
+ PUI_32 uiDataSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SynchronousGetPersistentDataSize
+/// API to write immediate persistence notification data.
+///
+/// \param [in] notif_name
+/// PCSTR - Name of notification to be read from immediate storage
+/// \param [in] ePersistCategory
+/// const EFrameworkunifiedPersistCategory - Persist Category of Notification.
+///
+/// \return UI_32
+/// UI_32 - size of the data
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SynchronousWritePersistentData(PCSTR pAppName,
+ PCSTR notif_name,
+ PVOID pData,
+ const UI_32 uiDataSize,
+ const UI_32 uiDelay,
+ const UI_32 uiMaxSize,
+ const EFrameworkunifiedPersistCategory ePersistCategory);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SynchronousMovePersistentData
+/// API to move all the immediate notification data from f_cSrcDir directory to
+/// f_cDestDir directory
+///
+/// \param [in] f_cSrcDir
+/// PCSTR - Source directory full path
+/// \param [in] f_cDestDir
+/// PCSTR - Dest directory full path
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - eFrameworkunifiedStatusAccessError if source path not exists
+/// eFrameworkunifiedStatusFileLoadError if unable to access src directory
+/// eFrameworkunifiedStatusInvldParam if invalid parameter is received
+/// eFrameworkunifiedStatusFail if error occurs while copying file
+/// eFrameworkunifiedStatus on success
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SynchronousMovePersistentData(PCSTR f_cSrcDir,
+ PCSTR f_cDestDir);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_NOR_PERSISTENCE_INTERNAL_H_
+
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_notification.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_notification.h
new file mode 100755
index 0000000..5d389ec
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_notification.h
@@ -0,0 +1,50 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief Notifications for notification service messages used by senders and receivers.
+///
+/// Declares the external Notification messages to the Notification Service.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ns_np_service_notification.h
+ */
+
+
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef NS_NP_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define NS_NP_SERVICE_NOTIFICATIONS_H_
+
+#define NTFY_NPPService_UserChange "NPPService/UserChange" //!< \~english notification_persistent_service server's Availability folder
+
+#endif /* NS_NP_SERVICE_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_protocol.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_protocol.h
new file mode 100755
index 0000000..475950b
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_service_protocol.h
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief API Header for Notification Service messages used by senders and recievers.
+///
+/// Declares the external Protocol messages to the Notification Service.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ns_np_service_protocol.h
+ */
+
+
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+#ifndef __NATIVESERVICES_NP_SERVICE_PROTOCOL_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NP_SERVICE_PROTOCOL_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english notification_persistent_service protocol msg name define
+ */
+typedef enum _NS_NPServiceProtocol {
+ NPS_REGISTER_EV_REQ = PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD + 0, /// <16+0 Request to register a Notification
+ NPS_UNREGISTER_EV_REQ , /// <1 Request to unregister a Notification
+ NPS_PUBLISH_EV_REQ , /// <2 Sender request to NP service to publish (send) a notification to subscribers
+ NPS_NOTIFY_EV_REQ , /// <3 Message to subscribers that the notification was generated by publisher
+ NPS_SUBSCRIBE_TO_EV_REQ , /// <4 Request to subscribe to a notification
+ NPS_UNSUBSCRIBE_FROM_EV_REQ , /// <5 Request to unsubscribe from a notification
+ NPS_SET_PERSIST_FILE_PATH_REQ , /// <6 Request to add a path to the list of files to be persisted
+ NPS_GET_PERS_DATA_REQ , /// <7 Request to get persistent data for specified notification
+ NPS_GET_PERS_DATA_ACK , /// <8 MSG from NPS to requester of persistent data.
+ NPS_GET_PERS_FILE_REQ , /// <9 Request to get persistent File from specified path
+ NPS_GET_PERS_FILE_ACK , /// <10 MSG from NPS to inform that file was retrieved from persistent
+ /// mem and copied.
+ NPS_SAVE_PERS_DATA_REQ , /// <11 Request to save the persistent data to what ever file that has
+ /// been defined.
+ NPS_SAVE_PERS_DATA_ACK , /// <12 MSG from NPS to requester of Save Action.
+ NPS_RELEASE_PERS_FILE_REQ , /// <13 Request to NPS to persist file in persistent memory
+ NPS_NPP_STOP_REQ , /// <14 MSG from system manager to NS_NPS to stop processing.
+ /// NS_NPS goes to idle state.
+ NPS_TST_WAKEUP , /// <15
+ NPS_BATCH_SUBSCRIBE_TO_EV_REQ , /// <16 Request to subscribe to a batch of notification(s)
+ NPS_GET_PERS_DATA_FAILED_ACK , /// <17 Failed to get persistent data
+ NPS_SET_PERSONALITY_REQ , /// <18 Request to change current user
+ NPS_CHANGE_PERSONALITY_REQ , /// <19 Request to change current user
+ NPS_USER_CHANGE_REQ , /// <20 MSG from NPS to frameworkunified applications.
+ NPS_SET_PERSIST_FOLDER_PATH_REQ , /// <21 Request to add a path to the folder to be persisted
+ NPS_GET_PERS_FOLDER_REQ , /// <22 Request to get persistent Folder from specified path
+ NPS_RELEASE_PERS_FOLDER_REQ , /// <23 Request to NPS to persist folder in persistent memory
+ NPS_GET_PERS_FOLDER_ACK, /// <24 Ack from NPS to requester to inform that folder was retrieved from persistent mem
+ /// and copied.
+ NPS_NPP_STOP_ACK , /// <25 Ack from NS_NPS to system manager on NPS_NPP_STOP_REQ request
+ NPS_BATCH_UNSUBSCRIBE_FROM_EV_REQ , /// <26
+ NPS_GET_READYSTATUS_REQ , /// <27 Request from system manager to check the ready status of NPPService
+ NPS_GET_READYSTATUS_ACK , /// <28 Ack from NPPService to system manager, only if NPPService is in ready state
+ NPS_REGISTER_NOR_EV_REQ , /// <29 Request to register immediate notification
+ NPS_DELETE_PERSISTED_DATA_REQ , /// <30 Request to delete the persistent data.
+ NPS_DELETE_PERSISTED_DATA_ACK , /// <31 Ack of deleting the persistent data.
+ NPS_SET_DEFAULT_PERS_DATA , /// <32 Sets the default data for persistent notification.
+ NPS_SET_NOTFN_PERSISTENT_TYPE , /// <33 Sets the persistent type of notification.
+ NPS_SET_FILE_PERSISTENT_TYPE , /// <34 Sets the persistent type of file.
+ NPS_SET_FOLDER_PERSISTENT_TYPE , /// <35 Sets the persistent type of folder.
+ NPS_SYNCHRONOUS_WRITE_NOTIFY_REQ , /// <36 Updates the immediate notification data in NPPService,
+ /// when written using synchronous API.
+ NPS_IMMEDIATE_WRITE_ACK , /// <37 Sends the ack to publisher of immediate notification after
+ /// data is written to persistent memory.
+ NPS_NPP_SYNC_REQ /// <38 Processing which synchronizes by NPPService (syncfs)
+} NS_NPServiceProtocol;
+
+/**
+ * \~english notification_persistent_service service event
+ */
+typedef enum _NS_NPServiceEvent {
+ NPS_NPP_READY_EVENT = 0x100,
+} NS_NPServiceEvent;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NATIVESERVICES_NP_SERVICE_PROTOCOL_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+// EOF
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_types.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_types.h
new file mode 100755
index 0000000..01559d9
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_np_types.h
@@ -0,0 +1,47 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPServiceIf
+/// \brief
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_TYPES_H_
+#define FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_TYPES_H_
+
+// Path of immediate notification data in NS_NPS version 1
+#define IMMEDIATE_PERSISTENCE_STORAGE_V1 "/nv/BS/ns/npp/rwdata/NPSNOR/"
+
+// Path of immediate notification data in NS_NPS version 2
+#define IMMEDIATE_PERSISTENCE_STORAGE_V2 "/nv/BS/ns/npp/rwdata/"
+
+// name of persistence folder for persistent type categorization
+#define USERDATADIR "UserData/" // stores all the user data (all user common data as well as user specific data)
+#define FACTORYDATADIR "FactoryData/" // stores all the factory data
+#define FACTORYCUSTOMERDATADIR "FactoryCustomerData/" // store all the factory customer data
+#define DEALERDATADIR "DealerData/" // stores all the dealer data
+
+#define IMMEDIATEDATADIR "__ImmNotfn/" // all immediate notification are stored under this folder name
+
+// folder for storing userdata common for all user
+#define ALLUSERAPPDATADIR "AllUserAppData/"
+
+#define RELEASETEMP_DIR "/nps_tmp/"
+#define RELEASETEMP_FILENAME "/ReleaseWork.nps_tmp"
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_TYPES_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_plogger_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_plogger_if.h
new file mode 100755
index 0000000..f926f38
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_plogger_if.h
@@ -0,0 +1,288 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file
+/// Declares functions and macros related to performance logging
+///
+/// \ingroup tag_NSLogger
+/// @{
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ * @brief \~english Declares functions and macros related to performance logging
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+
+#ifndef NS_PLOGGER_IF_H_ // NOLINT (build/header_guard)
+#define NS_PLOGGER_IF_H_
+
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NS_PLOGQ "/NSplog"
+#define NS_SYSEVENTLOGQ "/NSSysEventLog"
+
+/// Performance logging
+typedef enum _EPLOG_TIME_FORMAT {
+ EPLOG_TIME_FORMAT_USEC, ///< microseconds
+ EPLOG_TIME_FORMAT_MSEC, ///< miliseconds
+ EPLOG_TIME_FORMAT_SEC, ///< seconds
+} EPLOG_TIME_FORMAT;
+
+typedef enum _EPLOG_OUTPUT_OPTION {
+ EPLOG_SLOG = 0x01, ///< log to standard logging i.e. slogger
+ EPLOG_MSGQ = 0x02, ///< log to message queue NSPlog
+ EPLOG_TRACEEVENT = 0x04 ///< log to trace events
+} EPLOG_OUTPUT_OPTION;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief Performance LOG parameter
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _FRAMEWORKUNIFIEDLOGPPARAM {
+ BOOL bIsPLogEnabled; ///< PLog enabled or disabled
+ EPLOG_TIME_FORMAT eTimeFormat; ///< Time format when PLog is printed
+ UI_64 ui64GapInuS; ///< Gap in micro seconds
+ UI_8 uiLogOutputOptions; ///< Output log options
+} FRAMEWORKUNIFIEDLOGPPARAM, *LFRAMEWORKUNIFIEDLOGPPARAM;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief System event LOG parameter
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _FRAMEWORKUNIFIEDLOGSYSEVENTPARAM {
+ BOOL bIsSysEventLogEnabled; ///< SysEvent log enabled or disabled
+} FRAMEWORKUNIFIEDLOGSYSEVENTPARAM, *LFRAMEWORKUNIFIEDLOGSYSEVENTPARAM;
+
+extern FRAMEWORKUNIFIEDLOGPPARAM g_FrameworkunifiedLogPParams;
+extern FRAMEWORKUNIFIEDLOGSYSEVENTPARAM g_FrameworkunifiedLogSysEventParams;
+
+#define PLOG_TEXT(args...) NSLogPrintPerformanceLog(__LINE__, __FUNCTION__, ## args)
+#define SYSEVENTLOG_TEXT(args...) NSLogSysEvent(__LINE__, __FUNCTION__, ## args)
+#define IS_PLOG_ENABLED() NsLogIsPLogEnabled()
+#define IS_SYSEVENTLOG_ENABLED() NSLogIsSysEventLogEnabled()
+
+#ifdef __FRAMEWORKUNIFIEDLOG_NDEBUG_LEVEL2__
+#define FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG(print_fmt, args...) ((void)0)
+#else
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG
+///////////////////////////////////////////////////////////////////////////////
+/// Prints a performance log in PosixBasedOS001 system log. These logs can be viewed by using utility sloginfo.
+/// \note This macro API is disable in Linux system
+/// This macro API is disable if defined "__FRAMEWORKUNIFIEDLOG_NDEBUG_LEVEL2__"
+///
+/// \param [in] print_fmt
+/// PCSTR - Input string
+/// \param [in] args
+/// string similar to that of a printf statement and data argments
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG(print_fmt, args...) ((IS_PLOG_ENABLED()) ? PLOG_TEXT(print_fmt, ## args): ((void)0))
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_PERFORMANCE
+///////////////////////////////////////////////////////////////////////////////
+/// FRAMEWORKUNIFIEDLOG_PERFORMANCE is a logging API provided specifically for logging performance metrics.
+/// \note This macro API is disable in Linux system
+/// It should be used in few locations within an application. (Max 5 times per application).
+/// It should never be used in place of FRAMEWORKUNIFIEDLOG.
+///
+/// \param [in] print_fmt
+/// string similar to that of a printf statement
+/// \param [in] args
+/// Data arguments
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_PERFORMANCE(print_fmt, args...) ((IS_PLOG_ENABLED()) ? PLOG_TEXT(print_fmt, ## args): ((void)0))
+
+///////////////////////////////////////////////////////////////////////////////
+/// FRAMEWORKUNIFIEDLOG_SYSTEMEVENT
+///
+/// \param [in] print_fmt
+/// string similar to that of a printf statement
+/// \param [in] args
+/// Data arguments
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_SYSTEMEVENT(print_fmt, args...) ((IS_SYSEVENTLOG_ENABLED()) ?\
+ SYSEVENTLOG_TEXT(print_fmt, ## args): ((void)0))
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSLogPrintPerformanceLog
+/// \~english @par Brief
+/// This macro API is disable in Linux system
+/// \~english @param [in] f_ui16Line
+/// const UI_16 - line number
+/// \~english @param [in] f_cFuncName
+/// PCSTR - Function name. It takes __PRETTY_FUNCTION__
+/// \~english @param [in] print_fmt
+/// PCSTR - Input string
+/// \~english @retval none
+/// \~english @par Prerequisite
+/// - Work ony when AGL_STUB is disabled.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// none
+/// \~english @par Detail
+/// Prints a performance log in PosixBasedOS001 system log. These logs can be viewed by using utility sloginfo.
+/// Log is in format: "Plog: Time[us]:x or o (if gap in cs):Line:Function Input string"\n
+/// - Outputs in time units (microseconds/milliseconds/second) that can be set by the NSLogSetPlogTimeFormat.
+/// - The time data to be output is added to the gap data described in the/dev/shmem/Plog.gap files.
+/// - This information is output to the log output destinations (system log, NSPlog message queue, and event trace)
+/// that can be set by the NSLogSetPlogOutputOptions.(Default: NSPLog message queue)
+/// - PLOG_TEXT, Use this API from the FRAMEWORKUNIFIEDLOG_PERFORMANCE and FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG macros.\n
+/// Continued:\n
+/// - PLOG_TEXT("Service Availability Status: %d", IsAvailable);
+/// - FRAMEWORKUNIFIEDLOG_PERFORMANCE("Service Availability Status: %d", IsAvailable);
+/// - FRAMEWORKUNIFIEDLOG_PERFORMANCE_DEBUG("Service Availability Status: %d", IsAvailable);
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// none
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogPrintPerformanceLog(const UI_16 f_ui16Line, PCSTR f_cFuncName, PCSTR __format, ...);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogEnablePLog
+/// Enables/Disables the performance logging
+///
+/// \param [in] f_bEnable
+/// BOOL - TRUE- Enable performance logging, FALSE - Disable
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogEnablePLog(BOOL f_bEnable);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NsLogIsPLogEnabled
+/// \~english @par Brief
+/// Is Enables/Disables the performance logging
+/// \~english @retval TRUE current state of plog enable.
+/// \~english @retval FALSE current state of plog disable.
+/// \~english @par Prerequisite
+/// -
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// -
+/// \~english @par Detail
+/// Get the Performance Log enable/disable status.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// No match
+/// \~english @see
+/// NSLogEnablePLog
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NsLogIsPLogEnabled(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogSetPlogTimeFormat
+/// Set the time format for performance logging.
+///
+/// \param [in] f_ePlogTimeFormat
+/// EPLOG_TIME_FORMAT - Time format for performance logging
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogSetPlogTimeFormat(EPLOG_TIME_FORMAT f_ePlogTimeFormat);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogSetPlogOutputOptions
+/// Set the output options for performance logging.
+///
+/// \param [in] f_uiPlogOutputOption
+/// UI_8 - Output option. Value is generated by or'ed value of enum EPLOG_OUTPUT_OPTION
+/// e.g. EPLOG_SLOG | EPLOG_MSGQ
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogSetPlogOutputOptions(UI_8 f_uiPlogOutputOption);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogSysEvent()
+/// Prints system event log in message queue NSSyseventlog.
+///
+/// \param [in] f_ui16Line
+/// const UI_16 - line number
+/// \param [in] f_cFuncName
+/// PCSTR - Function name. It takes __PRETTY_FUNCTION__
+/// \param [in] __format
+/// PCSTR - Input string
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogSysEvent(const UI_16 f_ui16Line, PCSTR f_cFuncName, PCSTR __format, ...);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogEnableSysEventLog
+/// Enables/Disables the system event logging
+///
+/// \param [in] f_bEnable
+/// BOOL - TRUE- Enable system event logging, FALSE - Disable
+///
+/// \return none
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID NSLogEnableSysEventLog(BOOL f_bEnable);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSLogIsSysEventLogEnabled
+/// Is Enables/Disables the system event logging
+///
+/// \return SysEventLogEnabled
+/// BOOL - current state of sys event log(enable/disable).
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NSLogIsSysEventLogEnabled(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* NS_PLOGGER_IF_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+/// @}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_data_handler.hpp b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_data_handler.hpp
new file mode 100755
index 0000000..6f303f1
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_data_handler.hpp
@@ -0,0 +1,1159 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * @brief \~english This file contains declaration of CPassThruInDataHandler class
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup nsrcs
+ * @ingroup framework_unified
+ * @{
+ */
+
+// todo: move this file to the rcs interface folder
+
+#ifndef _NS_RCS_DATA_HANDLER_H__ // NOLINT (build/header_guard)
+#define _NS_RCS_DATA_HANDLER_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_endianess.h>
+#include <vector>
+
+#ifdef AGL_STUB
+#include <cstring>
+#endif
+
+typedef UI_8 NSRCS_BOOL;
+
+#define SIZE_OF_PASSTHRU_DATATYPE_IDENTIFIER 1
+#define SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER 3
+#define PASSTHRU_DATA_HEADER_LEN 8
+
+
+// not valid for buffer or array
+// \return - 0 - invalid type id
+/*UI_16 GetLengthOfBasicType(UI_8 f_ui8TypeId)
+{
+
+ UI_16 l_ui16LengthOfBasicType = 0;
+ switch(f_ui8TypeId)
+ {
+ case 0x01: l_ui16LengthOfBasicType = 2; break; // eBool
+ case 0x02: l_ui16LengthOfBasicType = 1; break; // eUint8
+ case 0x03: l_ui16LengthOfBasicType = 2; break; // eUint16
+ case 0x04: l_ui16LengthOfBasicType = 4; break; // eUint32
+ case 0x05: l_ui16LengthOfBasicType = 8; break; // eUint64
+ case 0x06: l_ui16LengthOfBasicType = 1; break; // eSint8
+ case 0x07: l_ui16LengthOfBasicType = 2; break; // eSint16
+ case 0x08: l_ui16LengthOfBasicType = 4; break; // eSint32
+ case 0x09: l_ui16LengthOfBasicType = 8; break; // eSint64
+ case 0x0A: l_ui16LengthOfBasicType = 8; break; // eReal
+ default: break;
+ }
+ return l_ui16LengthOfBasicType;
+}*/
+
+/////////////////////////////////////////
+/// Class: CPassThruInDataHandler
+/////////////////////////////////////////
+/**
+ * @class CPassThruInDataHandler
+ * \~english @brief Data Handler
+ * \~english @par Brief Introduction
+ * Class to get/set function to do input data handler
+ *
+ */
+class CPassThruInDataHandler {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CPassThruInDataHandler
+ /// \~english @par Summary
+ /// Constructor of CPassThruInDataHandler class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a CPassThruInDataHandler class. \n
+ /// Member variables (m_ui8Data, m_ui16TotalLength, m_ui16ParamCount, m_pui8CurOffset, m_ui16RemainingLength) to
+ /// be initialized. \n
+ /// \~english @see ~CPassThruInDataHandler
+ ////////////////////////////////////////////////////////////////////////////////////
+ CPassThruInDataHandler(UI_8 *f_pui8Data, UI_16 f_ui16Length, UI_16 f_ui16ParamCount)
+ : m_ui8Data(f_pui8Data),
+ m_ui16TotalLength(f_ui16Length),
+ m_ui16ParamCount(f_ui16ParamCount),
+ m_pui8CurOffset(f_pui8Data),
+ m_ui16RemainingLength(f_ui16Length) {
+
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CPassThruInDataHandler
+ /// \~english @par Summary
+ /// Destructor of CPassThruInDataHandler class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a CPassThruInDataHandler class. \n
+ /// \~english @see CPassThruInDataHandler
+ ////////////////////////////////////////////////////////////////////////////////////
+ ~CPassThruInDataHandler() {
+ m_ui8Data = NULL; // Do not delete. Because, not allocated in this class
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetBool
+ /// \~english @par Brief
+ /// This function is used to convert value to type NSRCS_BOOL
+ /// \~english @param [out] f_rcsboolOutValue
+ /// NSRCS_BOOL & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type NSRCS_BOOL(f_rcsboolOutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetBool(NSRCS_BOOL &f_rcsboolOutValue) {
+ return GetValue<NSRCS_BOOL>(f_rcsboolOutValue);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetUI8
+ /// \~english @par Brief
+ /// This function is used to convert value to type UI_8
+ /// \~english @param [out] f_rcsboolOutValue
+ /// UI_8 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type UI_8(f_ui8OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetUI8(UI_8 &f_ui8OutValue) {
+ return GetValue<UI_8>(f_ui8OutValue);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetUI16
+ /// \~english @par Brief
+ /// This function is used to convert value to type UI_16
+ /// \~english @param [out] f_rcsboolOutValue
+ /// UI_16 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type UI_16(f_ui16OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetUI16(UI_16 &f_ui16OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<UI_16>(f_ui16OutValue);
+ f_ui16OutValue = ConvertEndian_UI16(f_ui16OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetUI32
+ /// \~english @par Brief
+ /// This function is used to convert value to type UI_32
+ /// \~english @param [out] f_rcsboolOutValue
+ /// UI_32 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type UI_32(f_ui32OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetUI32(UI_32 &f_ui32OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<UI_32>(f_ui32OutValue);
+ f_ui32OutValue = ConvertEndian_UI32(f_ui32OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetUI64
+ /// \~english @par Brief
+ /// This function is used to convert value to type UI_64
+ /// \~english @param [out] f_rcsboolOutValue
+ /// UI_64 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type UI_64(f_ui64OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetUI64(UI_64 &f_ui64OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<UI_64>(f_ui64OutValue);
+ f_ui64OutValue = ConvertEndian_UI64(f_ui64OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetSI8
+ /// \~english @par Brief
+ /// This function is used to convert value to type SI_8
+ /// \~english @param [out] f_rcsboolOutValue
+ /// SI_8 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type SI_8(f_si8OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetSI8(SI_8 &f_si8OutValue) {
+ return GetValue<SI_8>(f_si8OutValue);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetSI16
+ /// \~english @par Brief
+ /// This function is used to convert value to type SI_16
+ /// \~english @param [out] f_rcsboolOutValue
+ /// SI_16 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type SI_16(f_si16OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetSI16(SI_16 &f_si16OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<SI_16>(f_si16OutValue);
+ f_si16OutValue = ConvertEndian_SI16(f_si16OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetSI32
+ /// \~english @par Brief
+ /// This function is used to convert value to type SI_32
+ /// \~english @param [out] f_rcsboolOutValue
+ /// SI_32 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type SI_32(f_si32OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetSI32(SI_32 &f_si32OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<SI_32>(f_si32OutValue);
+ f_si32OutValue = ConvertEndian_SI32(f_si32OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetSI64
+ /// \~english @par Brief
+ /// This function is used to convert value to type SI_64
+ /// \~english @param [out] f_rcsboolOutValue
+ /// SI_64 & - the given type of covert result
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Convert member data to the type SI_64(f_si64OutValue).
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetSI64(SI_64 &f_si64OutValue) {
+ EFrameworkunifiedStatus l_eStatus = GetValue<SI_64>(f_si64OutValue);
+ f_si64OutValue = ConvertEndian_SI64(f_si64OutValue);
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetBuffer
+ /// \~english @par Brief
+ /// This function is used to get the buffer and its size.
+ /// \~english @param [out] f_pui8Buffer
+ /// UI_8 *& - buffer address
+ /// \~english @param [out] f_ui16BufLength
+ /// UI_16 - buffer size
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - invalid data type id passed
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient data is available
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_ui16RemainingLength) is invalid(outrange of the size
+ /// SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER) [eFrameworkunifiedStatusInvldParam]
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get buffer address(f_pui8Buffer) and its size.
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetBuffer(UI_8 *&f_pui8Buffer, UI_16 &f_ui16BufLength) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (f_pui8Buffer == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "f_pui8Buffer is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ if (m_pui8CurOffset == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "m_pui8CurOffsetis NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ if (m_ui16RemainingLength >= SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER) {
+ if (0xB == *m_pui8CurOffset) { // check if the corresponding data is of type buffer
+ m_pui8CurOffset++;
+ f_ui16BufLength = *(static_cast<UI_16 *>(static_cast<PVOID>(m_pui8CurOffset)));
+ f_ui16BufLength = ConvertEndian_UI16(f_ui16BufLength);
+ m_pui8CurOffset += sizeof(UI_16);
+ m_ui16RemainingLength = static_cast<UI_16>(m_ui16RemainingLength - SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER);
+
+ if (m_ui16RemainingLength >= f_ui16BufLength) {
+ f_pui8Buffer = m_pui8CurOffset;
+ m_pui8CurOffset += f_ui16BufLength;
+ m_ui16RemainingLength = static_cast<UI_16>(m_ui16RemainingLength - f_ui16BufLength);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetArrayCount
+ /// \~english @par Brief
+ /// This function is used to get the buffer and its size.
+ /// \~english @param [out] f_ui16NoOfArrayElements
+ /// UI_16 - buffer size
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - If no array id found at the current location
+ /// \~english @retval eFrameworkunifiedStatusFail - no sufficient buffer to read the data
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Data of value(m_ui16RemainingLength) is invalid(outrange of the size
+ /// SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER) [eFrameworkunifiedStatusInvldParam]
+ /// - Data of value(m_pui8CurOffset) is invalid [eFrameworkunifiedStatusInvldParam]
+ /// - Covert value(m_pui8CurOffset) failed [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get buffer address(f_pui8Buffer) and its size.
+ /// Return the value(type EFrameworkunifiedStatus) indicate the operation result.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetArrayCount(UI_16 &f_ui16NoOfArrayElements) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (m_pui8CurOffset == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "m_pui8CurOffsetis NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ if (m_ui16RemainingLength >= SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER) {
+ if (0xC == *m_pui8CurOffset) { // check if the corresponding data is of type array
+ m_pui8CurOffset++;
+ f_ui16NoOfArrayElements = *(static_cast<UI_16 *>(static_cast<PVOID>(m_pui8CurOffset)));
+ f_ui16NoOfArrayElements = ConvertEndian_UI16(f_ui16NoOfArrayElements);
+ m_pui8CurOffset += sizeof(UI_16);
+ m_ui16RemainingLength = static_cast<UI_16>(m_ui16RemainingLength - SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ return l_eStatus;
+ }
+
+ UI_16 GetDataLength() {
+ return m_ui16TotalLength;
+ }
+
+ private:
+ // template <class DataType>
+ // EFrameworkunifiedStatus GetValue(DataType& f_dtOutValue);
+
+
+ /*
+ * \return -
+ * eFrameworkunifiedStatusFail - no sufficient data is available
+ * eFrameworkunifiedStatusOK - data retrieved
+ * eFrameworkunifiedStatusInvldID - invalid data type id passed
+ */
+ template <class DataType>
+ EFrameworkunifiedStatus GetValue(DataType &l_dtOutValue) {
+ if (m_pui8CurOffset == NULL) {
+ FRAMWEORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "m_pui8CurOffsetis NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (m_ui16RemainingLength >= (sizeof(DataType) + SIZE_OF_PASSTHRU_DATATYPE_IDENTIFIER)) {
+ if ((0x1 <= *m_pui8CurOffset) && (*m_pui8CurOffset <= 0x9)) // Get value is applicable only for basic types,
+ // not for buffer and array
+ {
+ m_pui8CurOffset++;
+ l_dtOutValue = *(static_cast<DataType *>(static_cast<PVOID>(m_pui8CurOffset)));
+ m_ui16RemainingLength = static_cast<UI_16>(m_ui16RemainingLength - sizeof(DataType));
+ m_pui8CurOffset += sizeof(DataType);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ return l_eStatus;
+ }
+
+ UI_8 *m_ui8Data;
+ UI_16 m_ui16TotalLength; // total data length
+ UI_16 m_ui16ParamCount;
+
+ UI_8 *m_pui8CurOffset;
+ UI_16 m_ui16RemainingLength; // remaining data length. Not yet parsed
+};
+
+/////////////////////////////////////////
+//// CPassThruOutDataHandler
+/////////////////////////////////////////
+/**
+ * @class CPassThruOutDataHandler
+ * \~english @brief Data Handler
+ * \~english @par Brief Introduction
+ * Class to get/set function to do output data handler
+ *
+ */
+class CPassThruOutDataHandler {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CPassThruOutDataHandler
+ /// \~english @par Summary
+ /// Constructor of CPassThruOutDataHandler class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a CPassThruOutDataHandler class. \n
+ /// Member variables (m_ui16TotalLength, m_ui16ParamCount, m_ui16CurOffset, m_ui16CurrentArrCount,
+ /// m_bArrayTypeSet, m_ui8LastArrDataType) to be initialized. \n
+ /// \~english @see ~CPassThruOutDataHandler
+ ////////////////////////////////////////////////////////////////////////////////////
+ CPassThruOutDataHandler(UI_8 f_ui8ClientId, UI_8 f_ui8PluginId, UI_32 f_ui32CommandId)
+ : m_ui16TotalLength(PASSTHRU_DATA_HEADER_LEN),
+ m_ui16ParamCount(0),
+ m_ui16CurOffset(0),
+ m_ui16CurrentArrCount(0),
+ m_bArrayTypeSet(FALSE),
+ m_ui8LastArrDataType(0) { // default data type eNull
+ m_vui8Data.resize(PASSTHRU_DATA_HEADER_LEN);
+ // TODO: check error condition for resize operation
+ // TODO: try if &m_vui8Data[m_ui16CurOffset] directly works without casting
+ *static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = f_ui8ClientId;
+ m_ui16CurOffset++;
+ *static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = f_ui8PluginId;
+ m_ui16CurOffset++;
+ *static_cast<UI_32 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = ConvertEndian_UI32(f_ui32CommandId);
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + sizeof(UI_32));
+ *static_cast<UI_16 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = 0; // initialize param count
+ m_ui16ParamCount = m_ui16CurOffset;
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + sizeof(UI_16));
+ m_ui8ClientId = f_ui8ClientId;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CPassThruOutDataHandler
+ /// \~english @par Summary
+ /// Destructor of CPassThruOutDataHandler class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of internal state
+ /// - The internal state is not changed.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a CPassThruOutDataHandler class. \n
+ /// \~english @see CPassThruOutDataHandler
+ ////////////////////////////////////////////////////////////////////////////////////
+ ~CPassThruOutDataHandler() {
+ m_vui8Data.clear();
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetClientID
+ /// \~english @par Brief
+ /// This function is used to get clinet id.
+ /// \~english @param none
+ /// \~english @retval
+ /// UI_8 - client id
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return the value(m_ui8ClientId).
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_8 GetClientID() {
+ return m_ui8ClientId;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetData
+ /// \~english @par Brief
+ /// This function is used to get m_vui8Data data address.
+ /// \~english @param none
+ /// \~english @retval
+ /// UI_8 * - m_vui8Data data address
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return m_vui8Data data address.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_8 *GetData() {
+ return static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[0]));
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetLength
+ /// \~english @par Brief
+ /// This function is used to get m_ui16CurOffset value.
+ /// \~english @param none
+ /// \~english @retval
+ /// UI_16 - m_ui16CurOffset value
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Return m_ui16CurOffset value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_16 GetLength() {
+ return m_ui16CurOffset;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetBool
+ /// \~english @par Brief
+ /// This function is used to set NSRCS_BOOL type value.
+ /// \~english @param[in] f_rcsboolValue
+ /// NSRCS_BOOL - new NSRCS_BOOL value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set NSRCS_BOOL type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetBool(NSRCS_BOOL &f_rcsboolValue) {
+ return SetValue<NSRCS_BOOL>(f_rcsboolValue, 0x1);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetUI8
+ /// \~english @par Brief
+ /// This function is used to set UI_8 type value.
+ /// \~english @param[in] f_ui8Value
+ /// UI_8 - new UI_8 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set UI_8 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetUI8(UI_8 f_ui8Value) {
+ return SetValue<UI_8>(f_ui8Value, 0x2);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetUI16
+ /// \~english @par Brief
+ /// This function is used to set UI_16 type value.
+ /// \~english @param[in] f_ui16Value
+ /// UI_16 - new UI_16 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set UI_16 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetUI16(UI_16 f_ui16Value) {
+ return SetValue<UI_16>(ConvertEndian_UI16(f_ui16Value), 0x3);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetUI32
+ /// \~english @par Brief
+ /// This function is used to set UI_32 type value.
+ /// \~english @param[in] f_ui32Value
+ /// UI_32 - new UI_32 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set UI_32 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetUI32(UI_32 f_ui32Value) {
+ return SetValue<UI_32>(ConvertEndian_UI32(f_ui32Value), 0x4);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetUI64
+ /// \~english @par Brief
+ /// This function is used to set UI_64 type value.
+ /// \~english @param[in] f_ui64Value
+ /// UI_64 - new UI_64 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set UI_64 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetUI64(UI_64 f_ui64Value) {
+ return SetValue<UI_64>(ConvertEndian_UI64(f_ui64Value), 0x5);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetSI8
+ /// \~english @par Brief
+ /// This function is used to set SI_8 type value.
+ /// \~english @param[in] f_si8Value
+ /// SI_8 - new SI_8 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set SI_8 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetSI8(SI_8 f_si8Value) {
+ return SetValue<SI_8>(f_si8Value, 0x6);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetSI16
+ /// \~english @par Brief
+ /// This function is used to set SI_16 type value.
+ /// \~english @param[in] f_si16Value
+ /// SI_16 - new SI_16 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set SI_16 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetSI16(SI_16 f_si16Value) {
+ return SetValue<SI_16>(ConvertEndian_SI16(f_si16Value), 0x7);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetSI32
+ /// \~english @par Brief
+ /// This function is used to set SI_32 type value.
+ /// \~english @param[in] f_si32Value
+ /// SI_32 - new SI_32 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set SI_32 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetSI32(SI_32 f_si32Value) {
+ return SetValue<SI_32>(ConvertEndian_SI32(f_si32Value), 0x8);
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetSI64
+ /// \~english @par Brief
+ /// This function is used to set SI_64 type value.
+ /// \~english @param[in] f_si64Value
+ /// SI_64 - new SI_64 value
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - set array element of different type
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set SI_64 type value.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetSI64(SI_64 f_si64Value) {
+ return SetValue<SI_64>(ConvertEndian_SI64(f_si64Value), 0x9);
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetBuffer
+ /// \~english @par Brief
+ /// This function is used to set buffer and size.
+ /// \~english @param[in] f_pui8Buffer
+ /// UI_8* - buffer address
+ /// \~english @param[in] f_ui16BufLength
+ /// UI_16 - buffer size
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @retval eFrameworkunifiedStatusOK - data retrieved
+ /// \~english @retval eFrameworkunifiedStatusInvldID - data member(m_ui8LastArrDataType) is invalid value
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set buffer and size.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetBuffer(UI_8 *f_pui8Buffer, UI_16 f_ui16BufLength) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // TODO: add error check for resize operation
+ if (f_pui8Buffer == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __func__, "f_pui8Buffer is NULL");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+ m_ui16TotalLength = static_cast<UI_16>(m_ui16TotalLength + f_ui16BufLength + SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER);
+ m_vui8Data.resize(m_ui16TotalLength);
+ *static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = 0xB;
+ m_ui16CurOffset++;
+ *static_cast<UI_16 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = ConvertEndian_UI16(f_ui16BufLength);
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + sizeof(UI_16));
+ std::memcpy(&m_vui8Data[m_ui16CurOffset], f_pui8Buffer, f_ui16BufLength);
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + f_ui16BufLength);
+
+ if (!m_bArrayTypeSet) {
+// *static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount])) =
+// (*static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount]))) + 1;
+ UpdateParamCount();
+ } else {
+ // setting array element
+ m_ui16CurrentArrCount--;
+
+ if ((m_ui8LastArrDataType != 0) && (m_ui8LastArrDataType != 0xB)) {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ } else {
+ m_ui8LastArrDataType = 0xB;
+ if (0 == m_ui16CurrentArrCount) {
+ m_ui8LastArrDataType = 0; // default data type eNull
+ m_bArrayTypeSet = FALSE;
+ }
+ }
+ }
+ return l_eStatus;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetArrayCount
+ /// \~english @par Brief
+ /// This function is used to set ArrayCount.
+ /// \~english @param f_ui16ArrayCount
+ /// UI_16 - ArrayCount
+ /// \~english @retval none
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - none
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set ArrayCount.
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetArrayCount(UI_16 f_ui16ArrayCount) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // TODO: add error check for resize operation
+ m_ui16TotalLength = static_cast<UI_16>(m_ui16TotalLength + SIZE_OF_PASSTHRU_PARAM_BUFFERTYPE_HEADER);
+ m_vui8Data.resize(m_ui16TotalLength);
+ *static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = 0xC;
+ m_ui16CurOffset++;
+ *static_cast<UI_16 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = ConvertEndian_UI16(f_ui16ArrayCount);
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + sizeof(UI_16));
+
+ m_ui16CurrentArrCount = f_ui16ArrayCount;
+ m_bArrayTypeSet = TRUE;
+// *static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount])) =
+// (*static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount]))) + 1;
+ UpdateParamCount();
+
+ // TODO: add error handling, if any other element is added before the array count reaches to f_ui16ArrayCount
+ return l_eStatus;
+ }
+
+ private:
+ CPassThruOutDataHandler() {
+
+ }
+
+ // SetValue
+ // \return - eFrameworkunifiedStatusInvldID - If setting array element of different type
+ template <class DataType>
+ EFrameworkunifiedStatus SetValue(DataType l_dtValue, UI_8 f_ui8DataType) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // TODO: add error check for resize operation
+
+ m_ui16TotalLength = static_cast<UI_16>(m_ui16TotalLength + SIZE_OF_PASSTHRU_DATATYPE_IDENTIFIER + sizeof(DataType));
+ m_vui8Data.resize(m_ui16TotalLength);
+ *static_cast<UI_8 *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = f_ui8DataType;
+ m_ui16CurOffset++;
+ *static_cast<DataType *>(static_cast<PVOID>(&m_vui8Data[m_ui16CurOffset])) = l_dtValue;
+ m_ui16CurOffset = static_cast<UI_16>(m_ui16CurOffset + sizeof(DataType));
+
+ if (!m_bArrayTypeSet) {
+// *static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount])) =
+// (*static_cast<UI_16*>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount]))) + 1;
+ UpdateParamCount();
+ } else {
+ // setting array element
+ m_ui16CurrentArrCount--;
+
+ if ((m_ui8LastArrDataType != 0) && (m_ui8LastArrDataType != f_ui8DataType)) {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ } else {
+ m_ui8LastArrDataType = f_ui8DataType;
+ if (0 == m_ui16CurrentArrCount) {
+ m_ui8LastArrDataType = 0; // default data type eNull
+ m_bArrayTypeSet = FALSE;
+ }
+ }
+ }
+ return l_eStatus;
+ }
+
+ VOID UpdateParamCount() {
+ UI_16 l_ui16ParamCount = static_cast<UI_16>(ConvertEndian_UI16(*static_cast<UI_16 *>(static_cast<PVOID>
+ (&m_vui8Data[m_ui16ParamCount]))) + 1);
+ l_ui16ParamCount = ConvertEndian_UI16(l_ui16ParamCount);
+ *static_cast<UI_16 *>(static_cast<PVOID>(&m_vui8Data[m_ui16ParamCount])) = l_ui16ParamCount;
+ }
+
+ // UI_8* m_ui8Data;
+ std::vector<UI_8> m_vui8Data;
+ UI_16 m_ui16TotalLength; // total data length
+ UI_16 m_ui16ParamCount;
+ UI_16 m_ui16CurOffset;
+ UI_8 m_ui8ClientId;
+
+ // required for array data type
+ UI_16 m_ui16CurrentArrCount;
+ BOOL m_bArrayTypeSet;
+ UI_8 m_ui8LastArrDataType;
+};
+
+#endif // _NS_RCS_DATA_HANDLER_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_logger_types.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_logger_types.h
new file mode 100755
index 0000000..cc28f7c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_logger_types.h
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * ns_rcs_logger_if.h
+ */
+/**
+ * @file
+ * @brief \~english This file provides logger type's structures
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup nsrcs
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _NS_RCS_LOGGER_IF_H_ // NOLINT (build/header_guard)
+#define _NS_RCS_LOGGER_IF_H_
+
+#include <native_service/ns_logger_if.h>
+
+// protocol: NSRCS_SET_LOG_SETTINGS_REQ,
+// NSRCS_SET_LOG_MASK_REQ,
+// NSRCS_SET_LOG_OUT_OPT_REQ,
+// NSRCS_SET_LOG_SEVERITY_REQ
+typedef struct _TNSRCS_SetLogSettingsReq {
+ UI_8 m_ui8ClientId;
+ TFrameworkunifiedZoneMask m_pui32ZoneMask;
+ UI_8 m_ui8OutputLogOption;
+ TFrameworkunifiedLoggerSeverity m_si32Severity;
+} TNSRCS_SetLogSettingsReq;
+
+// protocol: NSRCS_SET_LOG_SETTINGS_RESP
+typedef struct _TNSRCS_SetLogSettingsResp {
+ UI_8 m_ui8ClientId;
+ UI_8 m_ui8SetStatus;
+ TFrameworkunifiedZoneMask m_pui32ZoneMask;
+ UI_8 m_ui8OutputLogOption;
+ TFrameworkunifiedLoggerSeverity m_si32Severity;
+} TNSRCS_SetLogSettingsResp;
+
+// protocol: NSRCS_GET_LOG_SETTINGS_REQ
+typedef struct _TNSRCS_GetLogSettingsReq {
+ UI_8 m_ui8ClientId;
+} TNSRCS_GetLogSettingsReq;
+
+// protocol: NSRCS_GET_LOG_SETTINGS_RESP
+typedef struct _TNSRCS_GetLogSettingsResp {
+ UI_8 m_ui8ClientId;
+ CHAR m_cZoneList[BITS_IN_ZONE_MASK][ZONE_TEXT_SIZE];
+ TFrameworkunifiedZoneMask m_pui32ZoneMask;
+ UI_8 m_ui8OutputLogOption;
+ TFrameworkunifiedLoggerSeverity m_si32Severity;
+} TNSRCS_GetLogSettingsResp;
+
+// protocol: NSRCS_SET_LOG_MASK_RESP
+typedef struct _TNSRCS_SetLogMaskResp {
+ UI_8 m_ui8ClientId;
+ UI_8 m_ui8SetStatus;
+ TFrameworkunifiedZoneMask m_pui32ZoneMask;
+} TNSRCS_SetLogMaskResp;
+
+// protocol: NSRCS_SET_LOG_OUT_OPT_RESP
+typedef struct _TNSRCS_SetLogOutOptResp {
+ UI_8 m_ui8ClientId;
+ UI_8 m_ui8SetStatus;
+ UI_8 m_ui8OutputLogOption;
+} TNSRCS_SetLogOutOptResp;
+
+// protocol: NSRCS_SET_LOG_SEVERITY_RESP
+typedef struct _TNSRCS_SetLogSeverityResp {
+ UI_8 m_ui8ClientId;
+ UI_8 m_ui8SetStatus;
+ SI_32 m_si32Severity;
+} TNSRCS_SetLogSeverityResp;
+
+#endif /* _NS_RCS_LOGGER_IF_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_plugin.hpp b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_plugin.hpp
new file mode 100755
index 0000000..617aa1d
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_rcs_plugin.hpp
@@ -0,0 +1,328 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * @brief \~english This file contains the declaration of CNSRcsPlugin class
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup nsrcs
+ * @ingroup framework_unified
+ * @{
+ */
+
+#ifndef _NS_RCS_PLUGIN_H__ // NOLINT (build/header_guard)
+#define _NS_RCS_PLUGIN_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+typedef EFrameworkunifiedStatus(*TFPNSRcsSendPassthruData)(UI_8 f_ui8clientId, PVOID f_data, UI_16 f_ui16PayloadLength);
+
+// forward declaration
+class CPassThruInDataHandler;
+
+/**
+ * @class CNSRcsPlugin
+ * \~english @brief CNSRcsPlugin
+ * \~english @par Brief Introduction
+ * Class to provide base class of CNSRcsPlugin
+ */
+
+class CNSRcsPlugin {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// Constructor of CNSRcsPlugin class.
+ /// \~english @param [in] f_cPluginName
+ /// std::string - the name of plugin
+ /// \~english @param [in] f_fpNSRcsSendPassthruData
+ /// TFPNSRcsSendPassthruData - the pointer of send data function
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Constructor of CNSRcsPlugin class. \n
+ /// variables (m_cPluginName,m_fpNSRcsSendPassthruData,m_uiPluginId) to be initialization.
+ /// \~english @see ~CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ CNSRcsPlugin(std::string f_cPluginName, TFPNSRcsSendPassthruData f_fpNSRcsSendPassthruData)
+ : m_fpNSRcsSendPassthruData(f_fpNSRcsSendPassthruData),
+ m_cPluginName(f_cPluginName) {
+ static UI_8 l_uiPluginId = 0;
+ m_uiPluginId = ++l_uiPluginId;
+ }
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// Destructor of CNSRcsPlugin class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// To delete a CNSRcsPlugin class. \n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CNSRcsPlugin() {
+
+ }
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// get plugin id.
+ /// \~english @param None
+ /// \~english @retval Plugin Id
+ /// UI_8 - the ID of plugin
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar get plugin id. \n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_8 GetPluginId() {
+ return m_uiPluginId;
+ }
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// get plugin id.
+ /// \~english @param None
+ /// \~english @retval m_cPluginName
+ /// std::string - the name of plugin
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar get plugin name. \n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ std::string GetPluginName() {
+ return m_cPluginName;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// set parent name.
+ /// \~english @param f_cParentName
+ /// std::string - the name of parent
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar set parent name. \n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ static VOID SetParentName(const std::string &f_cParentName) {
+ CNSRcsPlugin::m_cParentName = f_cParentName;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// request from host side.
+ /// \~english @param f_uiProtocol
+ /// UI_32 - protocol ID
+ /// \~english @param f_ui8ClientId
+ /// UI_8 - client ID
+ /// \~english @param f_pData
+ /// CPassThruInDataHandler - the handler of transfer data
+ /// \~english @retval none
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar request from host side.\n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ProcessRequestMessage(UI_32 f_uiProtocol, UI_8 f_ui8ClientId, CPassThruInDataHandler *f_pData) = 0;
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// response from service side on target
+ /// \~english @param f_cMsgSource
+ /// PCSTR -
+ /// \~english @param f_uiProtocol
+ /// UI_32 - protocol ID
+ /// \~english @param f_pui8Data
+ /// UI_8 - pointer of data
+ /// \~english @param f_uiDataLength
+ /// UI_32 - length of data
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar response from service side on target.\n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ProcessResponseMessage(PCSTR f_cMsgSource, UI_32 f_uiProtocol, UI_8 *f_pui8Data,
+ UI_32 f_uiDataLength) = 0;
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// get response protocol array
+ /// \~english @param none
+ /// \~english @retval UI_32 const *
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar get response protocol array.\n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual UI_32 const *GetResponseProtocolArray() = 0;
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// get length of response protocol array
+ /// \~english @param none
+ /// \~english @retval UI_32 const
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar get length of response protocol array.\n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual UI_32 const GetResponseProtocolArrayLength() = 0;
+
+ static std::string m_cParentName; // TODO: move to private
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRcsPlugin
+ /// \~english @par Summary
+ /// the function of transport data
+ /// \~english @param f_ui8ClientId
+ /// UI_8 - client id
+ /// \~english @param f_data
+ /// PVOID - the pointer of transport data
+ /// \~english @param f_ui16PayloadLength
+ /// UI_16 - the size of transport data
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// provide API whar the function of transport data.\n
+ /// \~english @see CNSRcsPlugin
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SendPassthruOutData(UI_8 f_ui8clientId, PVOID f_data, UI_16 f_ui16PayloadLength) {
+ return m_fpNSRcsSendPassthruData(f_ui8clientId, f_data, f_ui16PayloadLength);
+ }
+ private:
+ CNSRcsPlugin() {
+ }
+
+ UI_8 m_uiPluginId;
+ TFPNSRcsSendPassthruData m_fpNSRcsSendPassthruData;
+ std::string m_cPluginName;
+};
+
+// std::string CNSRcsPlugin::m_cParentName = "";
+
+#endif // _NS_RCS_PLUGIN_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_reader.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_reader.h
new file mode 100755
index 0000000..f306a52
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_reader.h
@@ -0,0 +1,207 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class IConfigReader.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_reader.h
+ * @brief \~english This file contains declaration of class IConfigReader.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_READER_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_READER_H__ // NOLINT(build/header_guard)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h> // NOLINT(build/header_guard)
+#include <string>
+
+/*
+ * IConfigReader is an abstract class which is inherited by different type configuration file
+ * reader class.
+ */
+/**
+ * @class IConfigReader
+ * \~english @brief IConfigReader
+ * \~english @par Brief Introduction
+ * Class to provide class of parse config file.
+ */
+class IConfigReader {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// Constructor of IConfigReader class.
+ /// \~english @param none
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Constructor of IConfigReader class.
+ /// \~english @see ~IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ IConfigReader();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// Destructor of IConfigReader class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// To delete a IConfigReader class.
+ /// \~english @see IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~IConfigReader();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// This function is used to parse the file.
+ /// \~english @param [IN] f_c_filepath
+ /// const std::string - path of file to parse.
+ /// \~english @retval EFrameworkunifiedStatus
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to parse the file.\n
+ /// This is abstract function.
+ /// \~english @see IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ParseFile(const std::string &f_c_filepath) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// This function is used to get the value associated with the key.
+ /// \~english @param [IN] f_c_key
+ /// const std::string - key to search.
+ /// \~english @retval l_cValue value for key
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to get the value associated with the key.\n
+ /// This is abstract function.
+ /// \~english @see IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual std::string GetValue(const std::string &f_c_key) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// This function is used to get the value associated with the key.
+ /// \~english @param [IN] f_c_key
+ /// const std::string - key to search.
+ /// \~english @param [OUT] f_c_value
+ /// const std::string - value for key.
+ /// \~english @retval EFrameworkunifiedStatus error error if key not found else eFrameworkunifiedStatusOK
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to get the value associated with the key.\n
+ /// This is abstract function.
+ /// \~english @see IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus GetValue(const std::string &f_c_key, std::string &f_c_value) = 0; // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigReader
+ /// \~english @par Summary
+ /// This function is used to get the data pointer.
+ /// \~english @param none.
+ /// \~english @retval PVOID - pointer of data structure
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to get the data pointer. This pointer is then set in config writer.\n
+ /// This is needed to avoid recreation of same data structure object in both reader and writer.\n
+ /// when we create object of NSConfigParser.
+ /// This is abstract function.
+ /// \~english @see IConfigReader
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual PVOID GetDataPtr() = 0;
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_READER_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_resource_controler.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_resource_controler.h
new file mode 100755
index 0000000..0cce23a
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_resource_controler.h
@@ -0,0 +1,216 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ns_resource_controler.h
+ * @brief \~english This file provides api for operating Resource
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef _ns_resource_controler_h_ // NOLINT (build/header_guard)
+#define _ns_resource_controler_h_
+
+#define FRAMEWORKUNIFIED_RES_ABNMLMON "FRAMEWORKUNIFIED_RES_ABNMLMON"
+#define FRAMEWORKUNIFIED_RES_TIMER "FRAMEWORKUNIFIED_RES_TIMER"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to get the resourceid associated with the mod and the key.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] key
+ /// const char * - the key of resource
+ /// \~english @param [OUT] resource
+ /// long * - resource ID
+ /// \~english @retval -1 fail
+ /// \~english @retval 0 success
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to get the resourceid associated with the mod and the key.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+int frameworkunifiedGetResource(const char *mod, const char *key, long *resource); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to acquire the resourceid associated with the mod and the key.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] key
+ /// const char * - the key of resource
+ /// \~english @param [OUT] resource
+ /// long * - resource ID
+ /// \~english @retval ref_counter the counter of user
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to acquire the resourceid associated with the mod and the key.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+int frameworkunifiedAcquireResouce(const char *mod, const char *key, long *resource); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to release the resourceid associated with the mod and the key.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] key
+ /// const char * - the key of resource
+ /// \~english @retval ref_counter the counter of user
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to release the resourceid associated with the mod and the key.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+int frameworkunifiedReleaseResouce(const char *mod, const char *key);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to get the key associated with the mod and the resourceid.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] resource
+ /// long - resource ID
+ /// \~english @param [OUT] key
+ /// const char * - the key of resource
+ /// \~english @retval -1 fail
+ /// \~english @retval 0 success
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to get the key associated with the mod and the resourceid.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+int frameworkunifiedSearchResourseKey(const char *mod, long resource, const char **key); // NOLINT (readability/nolint)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to register the resource associated with the mod and the key.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] key
+ /// const char * - the key of resource
+ /// \~english @param [IN] resource
+ /// const char * - resource ID
+ /// \~english @param [IN] init_counter
+ /// long - resource user counter
+ /// \~english @retval -1 fail
+ /// \~english @retval 0 success
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to register the resource associated with the mod and the key.init counter.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+
+int frameworkunifiedRegistResouce(const char *mod, const char *key, long resource, int init_counter); // NOLINT (readability/nolint)
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup BaseSystem
+ /// \~english @par Summary
+ /// This function is used to unregister the resource associated with the mod and the key.
+ /// \~english @param [IN] mod
+ /// const char * - the mod of resource
+ /// \~english @param [IN] key
+ /// const char * - the key of resource
+ /// \~english @retval 0 success
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// This function is used to unregister the resource associated with the mod and the key.init counter.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////
+int frameworkunifiedUnregistResouce(const char *mod, const char *key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _ns_resource_controler_h_ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_ringbuffer.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_ringbuffer.h
new file mode 100755
index 0000000..b67cd17
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_ringbuffer.h
@@ -0,0 +1,523 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSRingBuffer
+/// \brief This file contains implementation of class CNSRingBuffer.
+/// This class provides API to open, read, write and close ring buffer
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_ringbuffer.h
+ * @brief \~english This file contains implementation of class CNSRingBuffer.
+ * This class provides API to open, read, write and close ring buffer
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_RINGBUFFER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_RINGBUFFER_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <pthread.h>
+
+#include <native_service/frameworkunified_types.h>
+
+#include <string>
+
+// Structure of the header of the ring buffer
+typedef struct _NSRingBufferHdr {
+ UI_32 m_uiReadPtr; // Read pointer
+ UI_32 m_uiWritePtr; // Write pointer
+ UI_32 m_uiUnReadSize; // Data size not read yet
+ BOOL m_bIsFull; // Flag indicating if the buffer has full of data
+ UI_32 m_uiRingBufferSize; // Size of the ring buffer
+} NSRingBufferHdr;
+
+// Structure of the mutex of the ring buffer
+typedef struct _NSRingBufferMtx {
+ pthread_mutex_t m_tBufMutex; // Mutex object to mutual exclusion
+ int m_lid;
+} NSRingBufferMtx;
+
+
+/**
+ * @class CNSRingBuffer
+ * \~english @brief CNSRingBuffer
+ * \~english @par Brief Introduction
+ * Class to provide class of ring buffer.
+ */
+class CNSRingBuffer {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// Constructor for CNSRingBuffer
+ /// \~english @param[in] f_cMappedFilePath
+ /// const std::string& - path of the ring buffer mapped file
+ /// \~english @param[in] f_uiSize
+ /// const UI_32 - size of ring buffer
+ /// \~english @param[in] f_lid
+ /// int - Lock ID
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Create an instance of CNSRingBuffer class.\n
+ /// Initializes cass member (m_cMappedFilePath, m_uiRingBuffSize, m_pRbufMtx, m_pRbufHdr,
+ /// m_pRbuf, m_lid, m_pLockAddr, m_siProcessLastWrtPage, m_cRbufMtxName).\n
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Constructor of CNSRingBuffer class.
+ /// variables (m_cMappedFilePath, m_uiRingBuffSize, m_pRbufMtx, m_pRbufHdr,
+ /// m_pRbuf, m_lid, m_pLockAddr, m_siProcessLastWrtPage, m_cRbufMtxName) to be initialization.
+ /// \~english @see ~CNSRingBuffer
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSRingBuffer(const std::string &f_cMappedFilePath, const UI_32 f_uiSize, int f_lid = -1);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// Destructor for CNSRingBuffer.
+ /// \~english @param none
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - The constructor creates an instance of the CNSRingBuffer class.
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// Closes the ring buffer, if it is open.
+ /// \~english @par
+ /// Closes the ring buffer if it is open.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CNSRingBuffer
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSRingBuffer();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function opens and maps the ring buffer object.
+ /// \~english @param none
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusInvldParam
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @retval eFrameworkunifiedStatusErrOther
+ /// \~english @par Preconditons
+ /// none
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - Different Lock ID in constructor parameter and mutex object [eFrameworkunifiedStatusInvldParam]
+ /// - If the path at the time of CNSRingBuffer class instantiation is empty [eFrameworkunifiedStatusFail]
+ /// - When the CNSRingBuffer class is instantiated with a path longer than 255 characters... [eFrameworkunifiedStatusFail]
+ /// - If accessing the information header file (shm_open/ mmap) fails [eFrameworkunifiedStatusFail]
+ /// - When accessing the ring buffer file (shm_open/ mmap) fails [eFrameworkunifiedStatusFail]
+ /// - Accessing a mutex file (shm_open/ mmap) fails [eFrameworkunifiedStatusFail]
+ /// - Alreadey opened [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Detail
+ /// It creates the ring buffer if it does not exists.
+ /// Opens the path information header, ring buffer, and mutex set at instance creation.
+ /// \~english @par
+ /// Update ring buffer size for instances created with different sizes on the same path.
+ /// \~english @par
+ /// Execute close() to close.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CNSRingBuffer, Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Open();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function is used to check whether the ring buffer is opened or not..
+ /// \~english @param none
+ /// \~english @retval TRUE - Open
+ /// \~english @retval FALSE - Not open
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// none
+ /// \~english @par Detail
+ /// This function is used to check whether the ring buffer is opened or not.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see CNSRingBuffer, Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsOpen();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function unmaps the ring buffer object.
+ /// \~english @param none
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// - Open has been performed.
+ /// \~english @par Change of internal status
+ /// - The internal state is not changed.
+ /// \~english @par Conditions of processing failure
+ /// - not open [eFrameworkunifiedStatusFail]
+ /// - information header file munmap fail [eFrameworkunifiedStatusFail]
+ /// - ring buffer file munmap fail [eFrameworkunifiedStatusFail]
+ /// - minidesk file munmap fail [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function unmaps the ring buffer object.
+ /// \~english @par
+ /// Close processing is also performed when an instance is destructed to prevent leakage.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Close();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function reads data from the ring buffer.
+ /// \~english @param [OUT] buffer
+ /// PSTR - pointer to the buffer in which the read data is stored
+ /// \~english @param [IN] f_uilength
+ /// UI_32 - length of the data buffer provided
+ /// \~english @retval SI_32 Returns The number of bytes actually read
+ /// \~english @retval -1 error occurred
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - not open [-1]
+ /// \~english @par Detail
+ /// - This function reads data from the ring buffer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Read(PSTR buffer, const UI_32 f_uilength);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function writes the data into the ring buffer.
+ /// \~english @param [OUT] buffer
+ /// PSTR - pointer to the buffer containing the data to be written
+ /// \~english @param [IN] f_uilength
+ /// UI_32 - length of the data buffer to be written
+ /// \~english @retval SI_32 Returns The number of bytes written
+ /// \~english @retval -1 error occurred
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - not open [-1]
+ /// \~english @par Detail
+ /// - This function writes the data into the ring buffer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Write(PCSTR buffer, const UI_32 f_uilength);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function writes all the data in the buffer into provided file f_pPath.
+ /// \~english @param[in] f_pPath
+ /// PCSTR - file path.
+ /// \~english @param[in] f_uiDumpSize
+ /// PUI_32 - Returns The number of bytes written into file
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusNullPointer
+ /// \~english @retval eFrameworkunifiedStatusInvldParam
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @retval eFrameworkunifiedStatusFileLoadError
+ /// \~english @retval eFrameworkunifiedStatusErrOther
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - f_uiDumpSize is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - dump file path is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - not open [eFrameworkunifiedStatusFail]
+ /// - dump file open fail [eFrameworkunifiedStatusFileLoadError]
+ /// - ring buffer access fail [eFrameworkunifiedStatusFail]
+ /// - dump file write fail [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Detail
+ /// This function does not changes the unread buffer.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Writing to a dump file is overwritten.
+ /// \~english @par
+ /// This function overwrites the file if it exists.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function returns the number of unread bytes which can be read by Read().
+ /// \~english @retval SI_32 Returns The number of bytes which can be read by Read()
+ /// \~english @retval -1 error occurred
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - not open [-1]
+ /// \~english @par Detail
+ /// - This function returns the number of unread bytes which can be read by Read().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetSize();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function clears the ring buffer.
+ /// \~english @param none
+ /// \~english @retval eFrameworkunifiedStatusOK
+ /// \~english @retval eFrameworkunifiedStatusFail
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - not open [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// This function clears the ring buffer.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Only read/write information cleared, and the size of the ring buffer itself is not changed.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearBuf();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSRingBuffer
+ /// \~english @par Brief
+ /// This function sets the position of read ptr to write ptr in buffer.
+ /// \~english @param none
+ /// \~english @retval eFrameworkunifiedStatusOK success
+ /// \~english @retval eFrameworkunifiedStatusFail ring buffer is not open
+ /// \~english @par Preconditions
+ /// - Open().
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - not open [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// This function sets the position of read ptr to write ptr in buffer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetReadPtrToWritePtr();
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSRingBuffer
+ /// Constructor of CNSRingBuffer class
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSRingBuffer();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateRBMutex
+ /// This function creates the ring buffer mutex object.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK ring buffer created successfully
+ /// eFrameworkunifiedStatusDuplicate ring buffer already exists
+ /// eFrameworkunifiedStatusInvldParam invalid ring buffer name
+ /// eFrameworkunifiedStatusFail on error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateRBMutex();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateRBHeader
+ /// This function creates the ring buffer object for header.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK ring buffer created successfully
+ /// eFrameworkunifiedStatusDuplicate ring buffer already exists
+ /// eFrameworkunifiedStatusInvldParam invalid ring buffer name
+ /// eFrameworkunifiedStatusFail on error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateRBHeader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateRBDataBuffer
+ /// This function creates the ring buffer object for data buffer.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK ring buffer created successfully
+ /// eFrameworkunifiedStatusDuplicate ring buffer already exists
+ /// eFrameworkunifiedStatusInvldParam invalid ring buffer name
+ /// eFrameworkunifiedStatusFail on error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateRBDataBuffer();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// MapRBHeader
+ /// This function open and maps the file in process space.
+ ///
+ /// \param [out] f_pRbuf
+ /// PVOID* - address of the mapped memory
+ /// \param [in] f_cMappedFile
+ /// std::string - Path of the ring buffer mapped file
+ /// \param [in] f_uiRbufSize
+ /// UI_32 - Size of the ring buffer
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK if ring buffer opened successfully
+ /// eFrameworkunifiedStatusFail unable to open ring buffer
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Map(PVOID *f_pRbuf, const std::string &f_cMappedFile, const UI_32 f_uiRbufSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// MapRBHeader
+ /// This function open and maps the shared memory in process space.
+ ///
+ /// \param [out] f_pShMem
+ /// PVOID* - address of the mapped memory
+ /// \param [in] f_cShmName
+ /// std::string - Name of the shared memory
+ /// \param [in] f_uiShmSize
+ /// UI_32 - Size of the shared memory
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK if shared memory opened successfully
+ /// eFrameworkunifiedStatusFail unable to open shared memory
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus MapSM(PVOID *f_pShMem, const std::string &f_cShmName, const UI_32 f_uiShmSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// UnMapRB
+ /// This function unmaps the object.
+ ///
+ /// \param [in] f_pRbuf
+ /// PCSTR - address of the memory to unmap
+ /// \param [in] f_uiRbufSize
+ /// UI_32 - Size of the memory to be unmapped
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK if ring buffer closed successfully
+ /// eFrameworkunifiedStatusFail if ring buffer is not open
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnMap(PVOID f_pRbuf, const UI_32 f_uiRbufSize);
+
+ EFrameworkunifiedStatus CheckSize(int fd, off_t size);
+
+
+// void LockMtx();
+ int LockMtx();
+
+ void UnlockMtx();
+
+ std::string m_cRbufMtxName; // name of the ring buffer mutex name
+
+ std::string m_cMappedFileHdrPath; // path of the ring buffer mapped file header
+
+ std::string m_cMappedFilePath; // path of the ring buffer mapped file
+
+ UI_32 m_uiRingBuffSize; // ring buffer size
+
+ NSRingBufferMtx *m_pRbufMtx; // The pointer to the ring buffer mutex
+
+ NSRingBufferHdr *m_pRbufHdr; // The pointer to the ring buffer header
+
+ PCHAR m_pRbuf; // The pointer to the ring buffer data buffer
+
+ pthread_mutex_t m_tOpenMutex; // for multithread process
+
+ int m_lid; // Lock ID
+ void *m_pLockAddr; // Lock Address
+
+ SI_32 m_siProcessLastWrtPage; // to hold page that each process wrote in last
+};
+
+#endif /* __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_RINGBUFFER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_shared_mem.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_shared_mem.h
new file mode 100755
index 0000000..981c1ad
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_shared_mem.h
@@ -0,0 +1,100 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief Shared interface file for SharedMemory Service
+/// Detail description of interface and usage
+/// \ref http://ptcframeworkunifiedaccbuild2/TikiWiki/tiki-index.php?page=Shared+Memory
+/// http://ptcframeworkunifiedaspsql01/sites/ptcsweng/SW%20Engineering%20Document%20Library/
+/// Projects/Connected%20Color%20Radio%20(CCR)/Architecture/Framework/
+/// CCR%20Messaging.vsd
+///
+/// Declares the external APIs to Zone Player Service.
+///
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_shared_mem.h
+ * @brief \~english Shared interface file for SharedMemory Service
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+
+#ifndef __CCR_NATIVESERVICES_MESSAGECENTER_SHAREDMEMORY_H__ // NOLINT (build/header_guard)
+#define __CCR_NATIVESERVICES_MESSAGECENTER_SHAREDMEMORY_H__
+
+
+#include <native_service/frameworkunified_types.h> ///< Header file for Template
+#include <stdint.h>
+#ifdef AGL_STUB
+#else
+#include <devctl.h>
+#include <sys/neutrino.h>
+#endif
+
+typedef struct _pulse_t TPosixHdr; ///> Header for system-provided messages
+
+enum ESharedMemCommand {
+ eSharedMemCommandWrite = 1,
+ eSharedMemCommandRead = 2,
+ eSharedMemCommandSize = 3,
+ eSharedMemCommandDelete = 4,
+};
+
+#define NS_SHAREDMEM_NAME "NS_SharedMem"
+#define NS_SHAREDMEM_SOCK_QUEUE 10
+DEFINE_HANDLE_TYPE(SSHMemID, TShMemID);
+
+#ifdef AGL_STUB
+#else
+#include <_pack1.h>
+#endif
+struct SMsgHeader {
+ uint16_t cmd; // Command to the NS_SharedMem
+ uintptr_t id; // NS_SharedMem ID
+ UI_32 size; // The size of the data to write to NS_SharedMem
+};
+
+struct SReplyHeader {
+ EFrameworkunifiedStatus status; // write result
+ UI_32 size; // The size of the data to read from NS_SharedMem
+};
+#ifdef AGL_STUB
+#else
+#include <_packpop.h>
+#endif
+
+#endif // __CCR_NATIVESERVICES_MESSAGECENTER_SHAREDMEMORY_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_shared_mem_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_shared_mem_if.h
new file mode 100755
index 0000000..25c5da1
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_shared_mem_if.h
@@ -0,0 +1,196 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_shared_mem_if.h
+ * @brief \~english API Header for Logger.
+ * Declares the external APIs to Logger.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __CCR_NATIVESERVICES_MESSAGECENTER_NSSHAREDMEMIF_H__ // NOLINT (build/header_guard)
+#define __CCR_NATIVESERVICES_MESSAGECENTER_NSSHAREDMEMIF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <native_service/frameworkunified_types.h> ///< Standard Types
+
+typedef unsigned int TMemID; ///< Type of memory buffer identifiers
+#define BAD_MEM_ID (0)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SetDataToShared
+/// \~english @par Summary
+/// - Store a large chunk of memory using SharedMem service
+/// \~english @param [in] data
+/// - const void* - data to be stored in shared memory
+/// \~english @param [in] dataBytes
+/// - UI_32 - length of the data (in bytes) that is stored in shared memory
+/// \~english @param [in] from
+/// - const char * - start address
+/// \~english @param [in] to
+/// - const char * - end address
+/// \~english @retval TMemID - unique MemID of the data stored in the shared memory, 0 if error occurs
+/// \~english @par Preconditions
+/// - None
+/// \~english @par Change of the internal state
+/// - shared memory changed
+/// \~english @par Causes of failures
+/// - param is Invalid.[BAD_MEM_ID]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - The function sets the data to the shared memory and associates it with a\n
+/// unique MemID that can be used to refer to data in subsequent calls \n
+/// (not necessarily from the same process).
+/// \~english @par
+/// - TMemID:Result
+/// - Except 0:Success
+/// - 0:Failure
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TMemID SetDataToShared(const void *data, UI_32 dataBytes, const char *from, const char *to);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetDataFromShared
+/// \~english @par Summary
+/// - Retrieve a large chunk of memory using SharedMem service
+/// \~english @param [in] id
+/// - TMemID - MemID of the shared data
+/// \~english @param [in] data
+/// - void* - Buffer to store data in, must be at least as large as buffer associated with id
+/// \~english @param [in] dataMaxBytes
+/// - UI_32 - Size of data - system will never copy more than dataMaxBytes bytes into data
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldID Invalid id
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Preconditions
+/// -
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - param is Invalid. [eFrameworkunifiedStatusInvldParam]
+/// - id is Invalid. [eFrameworkunifiedStatusInvldID]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - Retrieve data, given a MemID. Each MemID is only safe to use until a call to \n
+/// DiscardDataFromShared If the call succeeds, the return value is eFrameworkunifiedStatusOK.\n
+/// Otherwise, the contents of data are undefined.
+/// \~english @par
+/// - eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Failure
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetDataFromShared(TMemID id, void *data, UI_32 dataMaxBytes);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetLengthOfDataFromShared
+/// \~english @par Summary
+/// - Query the minimum buffer size, in bytes, necessary to hold a chunk of memory in SharedMem
+/// \~english @param [in] id
+/// - TMemID - MemID of the shared data
+/// \~english @retval length - Minimum buffer size, in bytes, required to hold the data associated with id.
+/// \~english @par Preconditions
+/// -
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - param is Invalid.[BAD_MEM_ID]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - Returns the minimum buffer size, in bytes, required to hold the data associated with id.\n
+/// Return value of 0 indicates failure.For an id, may be called one or more times \n
+/// until a successful call to either GetDataFromShared or DiscardDataFromShared with that id.
+/// \~english @par
+/// - TMemID:Result
+/// - Except 0:Success
+/// - 0:Failure
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+UI_32 GetLengthOfDataFromShared(TMemID id);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DiscardDataFromShared
+/// \~english @par Summary
+/// - Discard a chunk of memory in SharedMem
+/// \~english @param [in] id
+/// - TMemID - MemID of the shared data
+/// \~english @retval eFrameworkunifiedStatusOK - Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam -Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusInvldID -Invalid id
+/// \~english @retval eFrameworkunifiedStatusFail -Some sort of error occurred
+/// \~english @par Preconditions
+/// -
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - param is Invalid. [eFrameworkunifiedStatusInvldParam]
+/// - id is Invalid. [eFrameworkunifiedStatusInvldID]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - Invalidates the data stored with the MemID. Each id is only safe to use in a\n
+/// single successful call to GetDataFromShared or DiscardDataFromShared
+/// If the call succeeds, the return value is eImageStatusOK.
+/// On failure, the state of shared memory shall not be altered
+/// \~english @par
+/// - eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Failure
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DiscardDataFromShared(TMemID id);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // __CCR_NATIVESERVICES_MESSAGECENTER_NSSHAREDMEMIF_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem.h
new file mode 100755
index 0000000..d8ac8b9
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem.h
@@ -0,0 +1,486 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMem.
+/// This class provides API to open, read, write and close shared memory
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_sharedmem.h
+ * @brief \~english This file contains implementation of class CNSSharedMem.
+ * This class provides API to open, read, write and close shared memory
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_H__
+
+// Used only in nstest_sharedmem.
+// set environment, CNSSharedMem::Open() always fail. ===> eFrameworkunifiedStatusErrOther
+#define NSTEST_FAIL_SHAREDMEM_OPEN "NSTEST_FAIL_SHAREDMEM_OPEN"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <pthread.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+// Structure of the header of the shared memory buffer
+typedef struct _NSSharedBuffer {
+ pthread_mutex_t m_tBufMutex; // Mutex object to mutual exclusion
+ pthread_cond_t m_tCondVar; // Condition Variable
+ UI_32 m_uiReadPtr; // Read pointer
+ UI_32 m_uiWritePtr; // Write pointer
+ UI_32 m_uiUnReadSize; // Data size not read yet
+ BOOL m_bIsFull; // Flag indicating if the buffer has full of data
+ UI_32 m_uiShMemSize; // Size of the shared memory buffer
+} NSSharedBufferHdr;
+
+/**
+ * @class CNSSharedMem
+ * \~english @brief shared memory
+ * \~english @par Brief Introduction
+ * This class is used for handle shared memory.
+ *
+ */
+class CNSSharedMem {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// Constructor for CNSSharedMem
+ /// \~english @param[in] f_cSharedMemName
+ /// const std::string& - name of the shared memory
+ /// \~english @param[in] f_uiSize
+ /// const UI_32 - size of shared memory
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// Create object of CNSSharedMem class.
+ /// This class don't used to open shared memory object or allocate memory.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// \~english @see ~CNSSharedMem
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMem(const std::string &f_cSharedMemName, const UI_32 f_uiSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// Destructor for CNSSharedMem.
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// None
+ /// \~english @par Change of internal status
+ /// - Change the state of shared memory to closed state
+ /// \~english @par Conditions of processing failure
+ /// None
+ /// \~english @par Detail
+ /// Closes the shared memory, if it is open.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Since the destructor does not delete the shared memory area, \n
+ /// the application must execute shm_unlink to delete the shared memory area.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// \~english @see CNSSharedMem(const std::string&, const UI_32), CNSSharedMem(), Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSSharedMem();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function opens and maps the shared memory object.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory opened successfully
+ /// \~english @retval eFrameworkunifiedStatusFail unable to open shared memory
+ /// \~english @retval eFrameworkunifiedStatusErrOther if shared memory already opened
+ /// \~english @par Preconditons
+ /// None
+ /// \~english @par Change of internal status
+ /// - Open shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - if shared memory already opened [eFrameworkunifiedStatusErrOther]
+ /// - Unable to open shared memory(shm_open) [eFrameworkunifiedStatusFail]
+ /// - Unable to create shared memory(mmap) [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// It creates the shared memory if it does not exists.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Open();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function is used to check whether the shared memory buffer is opened or not.
+ /// \~english @retval TRUE - Open
+ /// \~english @retval FALSE - Not open
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Check whether the shared memory buffer is opened or not, and return the result.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsOpen();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function unmaps the shared memory object.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory closed successfully
+ /// \~english @retval eFrameworkunifiedStatusFail if shared memory is not opened
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - Close the shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - The shared memory object is not opened. [eFrameworkunifiedStatusFail]
+ /// - Unable to unmap(munmap) the shared memory object [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function unmaps the shared memory object from memory space.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Since the destructor does not delete the shared memory area, \n
+ /// the application must execute shm_unlink to delete the shared memory area.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Close();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ // Read data from shared memory.
+ /// \~english @param [out] buffer
+ /// PSTR - pointer to the buffer in which the read data is stored
+ /// \~english @param [in] f_uilength
+ /// UI_32 - length of the data buffer provided
+ /// \~english @param [in] f_bBlock
+ /// BOOL - TRUE - blocking call
+ /// FALSE - non blocking call
+ /// \~english @retval SI_32 Returns The number of bytes actually read, or NS_SHM_ERROR if an error occurred
+ /// \~english @retval NS_SHM_ERROR
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - The shared memory object is not opened. [NS_SHM_ERROR]
+ /// - Pointor to buffer(buffer) is NULL. [NS_SHM_ERROR]
+ /// - Byte of data(f_uilength)is 0. [NS_SHM_ERROR]
+ /// \~english @par Detail
+ /// This function reads data from the shared memory.
+ /// If this function is used as blocking call, then the calling thread will get blocked
+ /// until data is available for read. By default it is a blocking call.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Write
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Read(PSTR buffer, const UI_32 f_uilength, const BOOL f_bBlock = TRUE);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function writes the data into the shared memory.
+ /// \~english @param[in] buffer
+ /// PCSTR - pointer to the buffer containing the data to be written
+ /// \~english @param[in] f_uilength
+ /// const UI_32 - length of the data buffer to be written
+ /// \~english @retval SI_32 Returns The number of bytes written, or NS_SHM_ERROR if an error occurred
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - The shared memory object is not opened. [NS_SHM_ERROR]
+ /// - Pointor to buffer(buffer) is NULL. [NS_SHM_ERROR]
+ /// - Size of buffer(f_uilength) is larger than the size designated by constructor. [NS_SHM_ERROR]
+ /// \~english @par Detail
+ /// - This function writes the data into the shared memory.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Read
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Write(PCSTR buffer, const UI_32 f_uilength);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// Dump data to file.
+ /// \~english @param [in] f_pPath
+ /// PCSTR - file path.
+ /// \~english @param[in] [in] f_uiDumpSize
+ /// PUI_32 - Returns The number of bytes written into file
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK on success,
+ /// eFrameworkunifiedStatusFileLoadError - file path is incorrect
+ /// eFrameworkunifiedStatusSemLockFail/
+ /// eFrameworkunifiedStatusSemLockFail - mutex locking/unlocking error
+ /// eFrameworkunifiedStatusFail - shared memory is not opened
+ /// eFrameworkunifiedStatusInvldParam - invalid param
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// -None
+ /// \~english @par Conditions of processing failure
+ /// - file path is incorrect.[eFrameworkunifiedStatusFileLoadError]
+ /// - mutex locking/unlocking error.[eFrameworkunifiedStatusSemLockFail/eFrameworkunifiedStatusSemLockFail]
+ /// - shared memory is not opened.[eFrameworkunifiedStatusFail]
+ /// - invalid param.[eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Detail
+ /// - This function writes all the data in the buffer into provided file f_pPath.
+ /// - This function does not changes the unread buffer.
+ /// - This function overwrites the file if it exists.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function gets size of unread bytes.
+ /// \~english @param None
+ /// \~english @retval Except NS_SHM_ERROR - Returns The number of unread bytes
+ /// \~english @retval NS_SHM_ERROR -if an error occurred
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// if m_pShmHdr is null.[NS_SHM_ERROR]
+ /// \~english @par Detail
+ /// This function returns the number of unread bytes which can be read by Read().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par
+ /// - l_uiReadSize:Result
+ /// - NS_SHM_ERROR:Failure
+ /// - Except NS_SHM_ERROR:Success
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetSize();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// Clear buffer.
+ /// \~english @param None
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK on success,
+ /// eFrameworkunifiedStatusSemLockFail/
+ /// eFrameworkunifiedStatusSemLockFail - mutex locking/unlocking error
+ /// eFrameworkunifiedStatusFail - shared memory is not opened
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// - set m_pShmHdr->m_uiReadPtr with 0;
+ /// - set m_pShmHdr->m_uiWritePtr with 0;
+ /// - set m_pShmHdr->m_uiUnReadSize with 0;
+ /// - set m_pShmHdr->m_bIsFull with FALSE;
+ /// \~english @par Conditions of processing failure
+ /// - mutex locking/unlocking error.[eFrameworkunifiedStatusSemLockFail/eFrameworkunifiedStatusSemLockFail]
+ /// - shared memory is not opened.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function clears the shared memory buffer.if m_pShmHdr is null,return failure.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearBuf();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMem
+ /// \~english @par Brief
+ /// This function sets the position of read ptr to write ptr in buffer.
+ /// \~english @param None
+ /// \~english @retval EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK on success,
+ /// eFrameworkunifiedStatusSemLockFail/
+ /// eFrameworkunifiedStatusSemLockFail - mutex locking/unlocking error
+ /// eFrameworkunifiedStatusFail - shared memory is not opened
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// - set m_pShmHdr->m_uiReadPtr with m_pShmHdr->m_uiWritePtr;
+ /// - set m_pShmHdr->m_uiUnReadSize with 0;
+ /// \~english @par Conditions of processing failure
+ /// - mutex locking/unlocking error.[eFrameworkunifiedStatusSemLockFail/eFrameworkunifiedStatusSemLockFail]
+ /// - shared memory is not opened.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function sets the position of read ptr to write ptr in buffer.\n
+ /// If m_pShmHdr of lock failure or unlock failure,result is error.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetReadPtrToWritePtr();
+
+ protected:
+ // no members in protected
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSSharedMem
+ /// Constructor of CNSSharedMem class
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMem();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateSMHeader
+ /// This function creates the shared memory object for header.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK shared memory created successfully
+ /// eFrameworkunifiedStatusDuplicate shared memory already exists
+ /// eFrameworkunifiedStatusInvldParam invalid shared memory name
+ /// eFrameworkunifiedStatusFail on error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateSMHeader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateSMDataBuffer
+ /// This function creates the shared memory object for data buffer.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK shared memory created successfully
+ /// eFrameworkunifiedStatusDuplicate shared memory already exists
+ /// eFrameworkunifiedStatusInvldParam invalid shared memory name
+ /// eFrameworkunifiedStatusFail on error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateSMDataBuffer();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// MapSMHeader
+ /// This function open and maps the shared memory in process space.
+ ///
+ /// \param [out] f_pShMem
+ /// PVOID* - address of the mapped memory
+ /// \param [in] f_cShmName
+ /// std::string - Name of the shared memory
+ /// \param [in] f_uiShmSize
+ /// UI_32 - Size of the shared memory
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK if shared memory opened successfully
+ /// eFrameworkunifiedStatusFail unable to open shared memory
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus MapSM(PVOID *f_pShMem, const std::string &f_cShmName, const UI_32 f_uiShmSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// UnMapSM
+ /// This function unmaps the shared memory object.
+ ///
+ /// \param [in] f_pShMem
+ /// PCSTR - address of the memory to unmap
+ /// \param [in] f_uiShmSize
+ /// UI_32 - Size of the memory to be unmapped
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// eFrameworkunifiedStatusOK if shared memory closed successfully
+ /// eFrameworkunifiedStatusFail if shared memory is not opened
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnMapSM(PVOID f_pShMem, const UI_32 f_uiShmSize);
+
+ std::string m_cShmHdrName; // name of the shared memory header
+
+ std::string m_cShmName; // name of the shared memory data
+
+ UI_32 m_uiShmBuffSize; // shared memory size
+
+ NSSharedBufferHdr *m_pShmHdr; // The pointer to the shared memory header
+
+ PCHAR m_pShmBuff; // The pointer to the shared memory data buffer
+};
+
+#endif /* __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem_reader.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem_reader.h
new file mode 100755
index 0000000..9a34909
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem_reader.h
@@ -0,0 +1,340 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMemReader.
+/// This class provides API to open, close and perform read operation on shared memory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_sharedmem_reader.h
+ * @brief \~english This file contains implementation of class CNSSharedMemReader.
+ * This class provides API to open, close and perform read operation on shared memory.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_READER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_READER_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+class CNSSharedMem;
+
+/**
+ * @class CNSSharedMemReader
+ * \~english @brief read shared memory
+ * \~english @par Brief Introduction
+ * This class is used for read shared memory.
+ *
+ */
+class CNSSharedMemReader {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// Constructor for CNSSharedMemReader
+ /// \~english @param[in] f_cSharedMemName
+ /// const std::string& - name of the shared memory
+ /// \~english @param[in] f_bBlock
+ /// BOOL - TRUE - blocking call for Read() API,Thread will get blocked \n
+ /// the thread until data is available for read.
+ /// FALSE - non blocking call for Read() API
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Create object of CNSSharedMemReader class.
+ /// This class don't used to open shared memory object or allocate memory.
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - None
+ /// \~english @see ~CNSSharedMemReader
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMemReader(const std::string &f_cSharedMemName, const BOOL f_bBlock = TRUE); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// Destructor for CNSSharedMemReader.
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - Change the state of shared memory to closed state
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Closes the shared memory, if it is open.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Since the destructor does not delete the shared memory area, \n
+ /// the application must execute shm_unlink to delete the shared memory area.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see CNSSharedMemReader(const std::string&, const BOOL), CNSSharedMemReader(), Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSSharedMemReader();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function opens and maps the shared memory object.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory opened successfully
+ /// \~english @retval eFrameworkunifiedStatusFail unable to open shared memory
+ /// \~english @retval eFrameworkunifiedStatusErrOther if shared memory already opened
+ /// \~english @par Preconditons
+ /// None
+ /// \~english @par Change of internal status
+ /// - Open shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - if shared memory already opened [eFrameworkunifiedStatusErrOther]
+ /// - Unable to open shared memory(shm_open) [eFrameworkunifiedStatusFail]
+ /// - Unable to create shared memory(mmap) [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// Opens a shared memory object and allocates it to a memory space.\n
+ /// It creates the shared memory if it does not exists.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Open();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function is used to check whether the shared memory buffer is opened or not.
+ /// \~english @retval TRUE - Open
+ /// \~english @retval FALSE - Not open
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Check whether the shared memory buffer is opened or not, and return the result.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsOpen();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function unmaps the shared memory object.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory closed successfully
+ /// \~english @retval eFrameworkunifiedStatusFail if shared memory is not opened
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - Close the shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - The shared memory object is not opened. [eFrameworkunifiedStatusFail]
+ /// - Unable to unmap(munmap) the shared memory object [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function unmaps the shared memory object from memory space.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Since the closing does not delete the shared memory area, \n
+ /// the application must execute shm_unlink to delete the shared memory area.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Open
+ ////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Close();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function reads data from the shared memory.
+ /// \~english @param[in] buffer
+ /// PSTR - pointer to the buffer in which the read data is stored
+ /// \~english @param[in] f_uilength
+ /// const UI_32 - length of the data buffer provided
+ /// \~english @retval The number of bytes actually read, or NS_SHM_ERROR if an error occurred
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - The shared memory object is not opened. [NS_SHM_ERROR]
+ /// - Pointor to buffer(buffer) is NULL. [NS_SHM_ERROR]
+ /// - Byte of data(f_uilength)is 0. [NS_SHM_ERROR]
+ /// \~english @par Detail
+ /// If this constructor is used as blocking call, then the calling thread will get blocked\n
+ /// until data is available for read.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Write
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Read(PSTR buffer, const UI_32 f_uilength);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function writes all the data in the buffer into provided file f_pPath.
+ /// \~english @param[in] f_pPath
+ /// PCSTR - file path.
+ /// \~english @param[in] f_uiDumpSize
+ /// PUI_32 - Returns The number of bytes written into file
+ /// \~english @retval eFrameworkunifiedStatusOK - on success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - invalid param
+ /// \~english @retval eFrameworkunifiedStatusFail - shared memory is not open
+ /// \~english @retval eFrameworkunifiedStatusFileLoadError - file path is incorrect
+ /// \~english @retval eFrameworkunifiedStatusErrOther
+ /// \~english @retval eFrameworkunifiedStatusSemUnlockFail
+ /// \~english @par Preconditons
+ /// - File is opened.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - Pointor to dump size(f_uiDumpSize)is NULL [eFrameworkunifiedStatusNullPointer]
+ /// - Dump file path is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - File is not opened [eFrameworkunifiedStatusFail]
+ /// - Failed to open dump file [eFrameworkunifiedStatusFileLoadError]
+ /// - Failed to access shared memory [eFrameworkunifiedStatusFail]
+ /// - Failed to write data into dump file [eFrameworkunifiedStatusErrOther]
+ /// - Failed to lock mutex [eFrameworkunifiedStatusSemLockFail]
+ /// - Failed to unlock mutex [eFrameworkunifiedStatusSemUnlockFail]
+ /// \~english @par Detail
+ /// This function does not changes the unread buffer.
+ /// \~english @par
+ /// This function overwrites the file if it exists.
+ /// \~english @par Classification
+ /// public
+ /// \~english @par Type
+ /// none
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DumpToFile(PCSTR f_pPath, PUI_32 f_uiDumpSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function gets size of unread .bytes.
+ /// \~english @param None
+ /// \~english @retval Except NS_SHM_ERROR - Returns The number of bytes written,
+ /// \~english @retval NS_SHM_ERROR -if an error occurred
+ /// \~english @par Preconditons
+ /// -
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// if m_pShmHdr is null.[NS_SHM_ERROR]
+ /// \~english @par Detail
+ /// This function returns the number of unread bytes which can be read by Read().
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par
+ /// - l_uiReadSize:Result
+ /// - NS_SHM_ERROR:Failure
+ /// - Except NS_SHM_ERROR:Success
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetSize();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemReader
+ /// \~english @par Brief
+ /// This function sets the position of read ptr to write ptr in buffer.
+ /// \~english @retval eFrameworkunifiedStatusOK - on success
+ /// \~english @retval eFrameworkunifiedStatusFail - shared memory is not open
+ /// \~english @retval eFrameworkunifiedStatusSemLockFail - mutex locking error
+ /// \~english @retval eFrameworkunifiedStatusSemUnlockFail - mutex unlocking error
+ /// \~english @par Preconditons
+ /// - File is opened.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - File is not opened [eFrameworkunifiedStatusFail]
+ /// - Failed to lock mutex [eFrameworkunifiedStatusSemLockFail]
+ /// - Failed to unlock mutex [eFrameworkunifiedStatusSemUnlockFail]
+ /// \~english @par Detail
+ /// - Set the position of read ptr to write ptr in buffer.\n
+ /// - Initialize state of unreading bytes to 0.
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// Open Close
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetReadPtrToWritePtr();
+
+ protected:
+ // no members in protected
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSSharedMemReader
+ /// Constructor of CNSSharedMemReader class
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMemReader();
+
+ CNSSharedMem *m_pShmReader; // pointer to the CNSSharedMem object
+
+ BOOL m_bBlock; // blocking or non blocking read
+};
+
+#endif /*__NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_READER_H__*/ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem_writer.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem_writer.h
new file mode 100755
index 0000000..de6e9f9
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_sharedmem_writer.h
@@ -0,0 +1,283 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains implementation of class CNSSharedMemWriter.
+/// This class provides API to open, close and perform write operation on shared memory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_sharedmem_writer.h
+ * @brief \~english This file contains implementation of class CNSSharedMemWriter.
+ * This class provides API to open, close and perform write operation on shared memory.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_WRITER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_WRITER_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+class CNSSharedMem;
+
+/**
+ * @class CNSSharedMemWriter
+ * \~english @brief write shared memory
+ * \~english @par Brief Introduction
+ * This class is used for write shared memory.
+ *
+ */
+class CNSSharedMemWriter {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// Constructor for CNSSharedMemWriter
+ /// \~english @param[in] f_cSharedMemName
+ /// const std::string& - name of the shared memory
+ /// \~english @param[in] f_uiSize
+ /// UI_32 - size of shared memory
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// Create object of CNSSharedMemWriter class.
+ /// This class don't used to open shared memory object or allocate memory.
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @see ~CNSSharedMemWriter
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMemWriter(const std::string &f_cSharedMemName, const UI_32 f_uiSize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// Destructor of CNSSharedMemWriter class.
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - Change the state of shared memory to closed state
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Closes the shared memory, if it is open.
+ /// \~english @par
+ /// Please note the following points when using this API for application.
+ /// - Since the destructor does not delete the shared memory area, \n
+ /// the application must execute shm_unlink to delete the shared memory area.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @see CNSSharedMemWriter(const std::string&, const BOOL), CNSSharedMemWriter(), Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSSharedMemWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// This function opens and maps the shared memory object.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory opened successfully
+ /// \~english @retval eFrameworkunifiedStatusNullPointer pointer of the CNSSharedMem object is NULL
+ /// \~english @retval eFrameworkunifiedStatusFail unable to open shared memory
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - Open shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - pointer of the CNSSharedMem object is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - unable to open shared memory.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// This function opens and maps the shared memory object.\n
+ /// It creates the shared memory if it does not exists.
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see Close
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Open();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// This function is used to check whether the shared memory buffer is opened or not.
+ /// \~english @retval TRUE - Open
+ /// \~english @retval FALSE - Not open
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Check whether the shared memory buffer is opened or not, and return the result.
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsOpen();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// This function unmaps the shared memory object.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory closed successfully
+ /// \~english @retval eFrameworkunifiedStatusNullPointer pointer of the CNSSharedMem object is NULL
+ /// \~english @retval eFrameworkunifiedStatusFail if shared memory is not open
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - Close the shared memory object
+ /// \~english @par Conditions of processing failure
+ /// - Pointer of the CNSSharedMem object is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - If shared memory is not open.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function unmaps the shared memory object.\n
+ /// If pointer of the CNSSharedMem object is NULL, will return eFrameworkunifiedStatusNullPointer.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see Open
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Close();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// This function writes the data into the shared memory.
+ /// \~english @param[in] buffer
+ /// PSTR - pointer to the buffer containing the data to be written
+ /// \~english @param[in] f_uilength
+ /// const UI_32 - length of the data buffer to be written
+ /// \~english @retval The number of bytes written
+ /// \~english @retval NS_SHM_ERROR if an error occurred
+ /// \~english @par Preconditons
+ /// - Open the shared memory object
+ /// \~english @par Change of internal status
+ /// - shared memory is changed.
+ /// \~english @par Conditions of processing failure
+ /// - m_pShmWriter is NULL.
+ /// - buffer is NULL.
+ /// - f_uilength is 0.
+ /// \~english @par Detail
+ /// - This function writes the buffer's data whose length is f_uilength to shared memory.\n
+ /// If successed,return write size,else return NS_SHM_ERROR.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// Sync only
+ /// \~english @par
+ /// - l_iWriteSize:Result
+ /// - NS_SHM_ERROR:Failure
+ /// - Except NS_SHM_ERROR:Success
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 Write(PCSTR buffer, const UI_32 f_uilength);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CNSSharedMemWriter
+ /// \~english @par Brief
+ /// This function clears the shared memory buffer.
+ /// \~english @retval eFrameworkunifiedStatusOK if shared memory cleared successfully
+ /// \~english @retval eFrameworkunifiedStatusNullPointer pointer of the CNSSharedMem object is NULL
+ /// \~english @retval eFrameworkunifiedStatusFail if shared memory is not open
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - shared memory is changed.
+ /// \~english @par Conditions of processing failure
+ /// - Pointer of the CNSSharedMem object is NULL.[eFrameworkunifiedStatusNullPointer]
+ /// - If shared memory is not open.[eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - This function clears the shared memory buffer.\n
+ /// If pointer of the CNSSharedMem object is NULL, will return eFrameworkunifiedStatusNullPointer.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @par
+ /// - eFrameworkunifiedStatus:Result
+ /// - eFrameworkunifiedStatusOK:Success
+ /// - Except eFrameworkunifiedStatusOK:Failure
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearBuf();
+
+ protected:
+ // no members in protected
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSSharedMemWriter
+ /// Constructor of CNSSharedMemWriter class
+ ///
+ /// \param
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNSSharedMemWriter();
+
+ CNSSharedMem *m_pShmWriter; // pointer to the CNSSharedMem object
+};
+
+#endif /*__NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_WRITER_H__*/ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_system_mode.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_system_mode.h
new file mode 100755
index 0000000..9815904
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_system_mode.h
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * NS_SYSTEM_MODE.h
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSFramework
+///////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_system_mode.h
+ * @brief \~english The file defines enum SystemModeProtocol
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_SYSTEM_MODE_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_SYSTEM_MODE_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_System
+/// \brief System Mode Protocol
+////////////////////////////////////////////////////////////////////////////////////////////////
+typedef enum _SystemModeProtocol {
+ SYSTEM_ON_INITIALIZATION = PROTOCOL_THREAD_INITIALIZATION, ///< Initialize thread after creation
+ SYSTEM_ON_WAKEUP = PROTOCOL_THREAD_WAKEUP, ///< Wakeup Thread after sleep
+ SYSTEM_ON_SHUTDOWN = PROTOCOL_THREAD_SHUTDOWN, ///< Stop the thread
+ SYSTEM_ON_DESTROY = PROTOCOL_THREAD_DESTROY ///< Destroy the thread
+} SystemModeProtocol;
+
+#endif /* __NATIVESERVICES_SYSTEM_MODE_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_timer_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_timer_if.h
new file mode 100755
index 0000000..549fc4c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_timer_if.h
@@ -0,0 +1,317 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_timer_if.h
+ * @brief \~english APIs to create, delete and use Native Service timers .
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_TIMER_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_TIMER_H__
+
+#include <native_service/frameworkunified_types.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TIMER_QUE "TIMER"
+
+#define MAX_SERVICE_NAME 15
+
+/// \brief Timer Function Pointer definition
+/// Detailed description of the class
+typedef void (*TimerCb)(UI_16 cmd);
+
+/// \brief Timer info, defines the initial
+/// start of a timer, the repeat timer
+/// values and the cmd id for a timer
+typedef struct _NSTimerInfo {
+
+// UI_32 t_sec;
+ time_t t_sec;
+ UI_64 t_nsec;
+ UI_16 iCmd;
+
+// UI_32 rpt_sec;
+ time_t rpt_sec;
+ UI_64 rpt_nsec;
+} NSTimerInfo;
+
+/// \brief Enum Types for valid Callback Mechanisms for
+/// a NS_Timer
+typedef enum _NSTimerCallbackMechanism {
+ CALLBACK_MESSAGE
+} eNSTimerCallbackMechanism;
+
+/// \brief Helper methods that convert time provided in MS.
+/// mseconds
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup WholeSeconds
+/// \~english @par Brief
+/// Converts a time value in milliseconds (ms) to a time value in secods (s).
+/// \~english @param [in] ms
+/// UI_32 - Time value in milliseconds(0 to ULONG_MAX)
+/// \~english @retval Time value in seconds
+/// \~english @par Preconditons
+/// - none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Detail
+/// This function converts a time value in ms to a time value in s and returns it.\n
+/// For example, 12345ms obtains 12s as the conversion result.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Not applicable
+/// \~english @see
+/// none
+///
+/// \~english @par Brief
+/// Get the number of whole seconds in the milsecond number that was passed.
+/// \~english @param[in] ms
+/// UI_32 - time value in mil seconds
+/// \~english @retval Number of whole seconds in the number passed.
+/// \~english @par Preconditons
+/// \~english @par Change of internal status
+/// \~english @par Conditions of processing failure
+/// \~english @par Detail
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see
+/// none
+/////////////////////////////////////////////////////////////////////////////////////
+
+//UI_32 WholeSeconds(UI_32 ms);
+time_t WholeSeconds(UI_32 ms);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RemainderMs
+/// \~english @par Brief
+/// Get the number of remaining milseconds out of whole second for the number passed.
+/// \~english @param[in] ms
+/// UI_32 - time value in mil seconds
+/// \~english @retval Number of remaining mil seconds in the number passed.
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// none
+/// \~english @par Detail
+/// This function returns the time value in ms of the remainder from converting the time value in ms to the time value in s.\n
+/// For example, 12345ms obtains 345ms as the conversion result.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see
+/// none
+/////////////////////////////////////////////////////////////////////////////////////
+UI_32 RemainderMs(UI_32 ms);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup MSToNS
+/// \~english @par Brief
+/// Converts mil seconds to nano seconds.
+/// \~english @param[in] ms
+/// UI_32 - time value in mil seconds
+/// \~english @retval Number of nano seconds there are in mil seconds in the number passed.
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// none
+/// \~english @par Detail
+/// This function converts a time value in ms to a time value in ns and returns it.\n
+/// For example, 1234ms obtains 1234000000ns as the conversion result.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see
+/// none
+/////////////////////////////////////////////////////////////////////////////////////
+UI_64 MSToNS(UI_32 ms);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_TimerCreate
+/// \~english @par Brief
+/// to create an instance of a timer object, and start it
+/// \~english @param[in] timer_info
+/// NSTimerInfo - timer value represents an absolute expiration timeout
+/// \~english @param[in] cbMech
+/// eNSTimerCallbackMechanism - CALLBACKMECHANISM_ENUM - specifies the callback mechanism associated with the
+/// timer\n
+/// CALLBACK_MESSAGE will send a message to a message queue
+/// \~english @param[in] sndMqHndl
+/// HANDLE - implies a MESSAGE QUE HANDLE generated by McOpenSender() is specified
+/// \~english @retval Handle to the timer object or NULL on failure
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If HANDLE(sndMqHndl) is NULL, [NULL]
+/// - If the Callback mechanism (cbMech) specified in the arguments is not CALLBACK_MESSAGE [NULL]
+/// - If thread creation fails (reateTimerMonitoringThread(); returns eFrameworkunifiedStatusFail) [NULL]
+/// - Unable to allocate memory for timer handle structures [NULL]
+/// - Memory cannot be allocated for the timer-information struct. [NULL]
+/// - When the message queue name of the handle (sndMqHndl) specified in the arguments is NULL,[NULL]
+/// - If a system call (such as epoll_ctl()) is in error,[NULL]
+/// \~english @par Detail
+/// Creates an instance of a timer object, sends a CALLBACK_MESSAGE message to the message queue, and starts the timer.\n
+/// When McOpenSender() is executed to execute NS_TimerCreate, the handles should be closed if not needed.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see NS_TimerDelete,NS_TimerSetTime
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE NS_TimerCreate(NSTimerInfo timer_info, eNSTimerCallbackMechanism cbMech, HANDLE sndMqHndl);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_TimerDelete
+/// \~english @par Brief
+/// to delete an instance of a timer object
+/// \~english @param[in] hTimer
+/// HANDLE - a timer handle that was created via NS_TimerCreate
+/// \~english @retval EFrameworkunifiedStatus indicates if the timer handle was delete successfully
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusFail
+/// \~english @retval eFrameworkunifiedStatusInvldParam
+/// \~english @par Preconditons
+/// - NS_TimerCreate has generated a HANDLE of timers
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If HANDLE(hTimer) is NULL,[eFrameworkunifiedStatusInvldParam]
+/// - Initializes the state. [eFrameworkunifiedStatusFail]
+/// - Invalid timed objects for HANDLE(hTimer specified by arguments:[eFrameworkunifiedStatusInvldParam]
+/// - If semaphoring fails, [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// If the timer is set, the timer is stopped.\n
+/// Delete an instance of a timer object.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see NS_TimerCreate, NS_TimerSetTime
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NS_TimerDelete(HANDLE hTimer);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_TimerSetTime
+/// \~english @par Brief
+/// to start or stop a timer by setting the time interval associated
+/// with a timer, value of 0 in t_sec & t_nsec, will stop the timer.
+/// \~english @param[in] hTimer
+/// HANDLE - handle to timer that your specifying the timer to be set
+/// \~english @param[in] timer_info
+/// NSTimerInfo - timer value represents an absolute expiration timeout
+/// \~english @retval EFrameworkunifiedStatus indicates if the timer info was set successfully
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusInvldHandle
+/// \~english @retval eFrameworkunifiedStatusFail
+/// \~english @par Preconditons
+/// the timer must have already been created with NS_TimerCreate
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If HANDLE(hTimer) is NULL,[eFrameworkunifiedStatusInvldHandle]
+/// - Initializes the state. [eFrameworkunifiedStatusFail]
+/// - Retrieving timers fails [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// When the timer information (t_sec and t_nsec) is 0, the timer is stopped.\n
+/// If it is not 0, the timer is started based on the timer information.\n
+/// The hTimer must have been created with NS_TimerCreate.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see NS_TimerCreate, NS_TimerGetTime
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NS_TimerSetTime(HANDLE hTimer, NSTimerInfo timer_info);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_TimerGetTime
+/// \~english @par Brief
+/// to retrieve the time until a timer expires
+/// \~english @param[in] hTimer
+/// HANDLE - handle to timer that your trying to get information about
+/// \~english @param[out] timer_info
+/// NSTimerInfo* - a structure to store the delay time until the timer expires
+/// \~english @retval EFrameworkunifiedStatus indicates if the timer info was get successfully
+/// \~english @retval eFrameworkunifiedStatusOK
+/// \~english @retval eFrameworkunifiedStatusInvldHandle
+/// \~english @retval eFrameworkunifiedStatusFail
+/// \~english @par Preconditons
+/// - NS_TimerCreate has generated a HANDLE of timers
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - If HANDLE(hTimer) is NULL,[eFrameworkunifiedStatusInvldHandle]
+/// - If the timer_info specified in the arguments is NULL,... [eFrameworkunifiedStatusInvldHandle]
+/// - Initializes the state. [eFrameworkunifiedStatusFail]
+/// - If the timerdelete fails.... [eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Gets the time until the timer expires.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see NS_TimerCreate, NS_TimerSetTime
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NS_TimerGetTime(HANDLE hTimer, NSTimerInfo *timer_info);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_TimerDebugOn
+/// \~english @par Brief
+/// to make a flag for the debugging process. for debug.
+/// \~english @param[in] FlagState
+/// BOOL - DebugFlag state
+/// \~english @retval none
+/// \~english @par Preconditons
+/// none
+/// \~english @par Change of internal status
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// none
+/// \~english @par Detail
+/// Sets the debug flag specified by the argument.\n
+/// However, if the set flag is the same as the flag specified in the argument, no operation is performed.
+/// \~english @par Classification
+/// \~english @par Type
+/// \~english @see none
+////////////////////////////////////////////////////////////////////////////////////////////
+void NS_TimerDebugOn(BOOL FlagState);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NATIVESERVICES_TIMER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_timer_if.hpp b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_timer_if.hpp
new file mode 100755
index 0000000..ffcd8c8
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_timer_if.hpp
@@ -0,0 +1,393 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSTimer
+/// \brief Header file for Timer class.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_timer_if.hpp
+ * @brief \~english Header file for Timer class.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef NS_TIMER_IF_HPP_ // NOLINT (build/header_guard)
+#define NS_TIMER_IF_HPP_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_timer_if.h>
+
+/**
+ * @class NSTimer
+ * \~english @brief Handle Timer
+ * \~english @par Brief Introduction
+ * Timer class is using to handle the timer.creating, starting, stopping,and so on.
+ *
+ */
+class NSTimer {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Creates a timer object with default behavior as single timeout timer.
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// -To create the instance of this class.init the member var using m_hTimer, m_u64TimeInterval,
+ /// m_bRepeatTimer.\n
+ /// Default status,all time will be set 0.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -
+ /// \~english @see ~NSTimer
+ ////////////////////////////////////////////////////////////////////////////////////
+ NSTimer();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Deletes a timer object.
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -Instance of this class is created successfully.
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// -Destruct the instance of this class.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see NSTimer
+ ////////////////////////////////////////////////////////////////////////////////////
+ ~NSTimer();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// This function overloads \ref SetNotifyMethod().
+ /// On timeout, sends the command id to the message queue of specified application.
+ /// Resets previous notify method if any.
+ /// \~english @param[in] notifyCmdId
+ /// UI_16 - command id.
+ /// \~english @param[in] notifyToAppName
+ /// PCSTR - Send command id to the message queue of this application
+ /// \~english @retval EFrameworkunifiedStatus - Returns eFrameworkunifiedStatusOK if the action is set otherwise eFrameworkunifiedStatusFail
+ /// \~english @retval eFrameworkunifiedStatusOK - Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam - Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusFail - process error
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// - Pointer of AppName specified by argument(notifyToAppName) is NULL [eFrameworkunifiedStatusInvldParam]
+ /// - Bytes of AppName specified by argument(notifyToAppName) are larger then MAX_SERVICE_NAME(15byte)
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - There isn't enough buffer(malloc) to storage message queue name, when getting(McOpenSender) message queue
+ /// handle [eFrameworkunifiedStatusFail]
+ /// - Bytes of message queue name are larger then LIMIT_QUEUE_NAME_SIZE(16byte), when getting(McOpenSender)
+ /// message queue handle [eFrameworkunifiedStatusFail]
+ /// - Failed to get message queue(mq_open), when getting(McOpenSender) message queue handle [eFrameworkunifiedStatusFail]
+ /// - There isn't enough buffer(malloc) to storage message queue information, when getting(McOpenSender) message
+ /// queue handle [eFrameworkunifiedStatusFail]
+ /// - Failed to create(epoll_create1) file descriptor for epoll, when creating timer handle(NS_TimerCreate)
+ /// [eFrameworkunifiedStatusFail]
+ /// - Failed to create(eventfd) file descriptor for event notification, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - Failed to connect(epoll_ctl) file descriptors for epoll and event notification, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - Failed to create(pthread_create) timer thread for event notification, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - There isn't enough buffer(malloc) to storage timer handle structure, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - There isn't enough buffer(malloc) to storage timer information structure,, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - Message queue handle is INVALID_HANDLE(-1), when creating timer handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - Checking code of message queue handle is not MQ_CHECK_CODE, when creating timer handle(NS_TimerCreate)
+ /// [eFrameworkunifiedStatusFail]
+ /// - Type of message queue handle is not send/receive, when creating timer handle(NS_TimerCreate)
+ /// [eFrameworkunifiedStatusFail]
+ /// - Failed to create(timerfd_create) file descriptor for timer, when creating timer handle(NS_TimerCreate)
+ /// [eFrameworkunifiedStatusFail]
+ /// - Failed to connect(epoll_ctl) file descriptors for epoll and timer, when creating timer
+ /// handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// - Timer handle state of instance has been deleted(DELETED_STATE), when creating timer handle(NS_TimerCreate)
+ /// [eFrameworkunifiedStatusFail]
+ /// - Failed to start/stop(timerfd_settime) timer, when creating timer handle(NS_TimerCreate) [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// This function overloads \ref SetNotifyMethod().
+ /// On timeout, sends the command id to the message queue of specified application.
+ /// Create a timer handle(m_hTimer) of instance, if the time handle already exits, delete it then create a new
+ /// one.
+ /// If there is resource for timer notification before, reset it.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see McOpenSender, McClose, NS_TimerCreate
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetNotifyMethod(UI_16 notifyCmdId, PCSTR notifyToAppName);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Sets the timer as a repeat timer. Timer timeouts repeatedly as per the interval set.
+ /// Default timer fires only once.
+ /// Not effective, if the timer is running. Effective on next \ref Start() or \ref Start(seconds, msecs) call.
+ /// \~english @param[in] repeatTimer
+ /// BOOL - TRUE - set repeat timer
+ /// FALSE - set single timeout timer. (Default behavior)
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// -None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Sets the timer as a repeat timer. Timer timeouts repeatedly as per the interval set.
+ /// Default timer fires only once.
+ /// Not effective, if the timer is running. Effective on next \ref Start() or \ref Start(seconds, msecs) call.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////
+ VOID SetRepeatTimer(BOOL repeatTimer);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Set the interval of timeout. Interval is addition of seconds and milliseconds passed as an arguments.
+ /// \~english @param[in] seconds
+ /// UI_32 - Time in seconds
+ /// \~english @param[in] msecs
+ /// UI_64 - Time in milliseconds
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Set the interval of timeout. Interval is addition of seconds and milliseconds passed as an arguments.
+ /// The default value of interval time is 0.
+ /// If interval time is 0, stop timer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////
+ VOID SetTime(UI_32 seconds, UI_64 msecs);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// This function overloads SetTime(). Set the interval of timeout. Interval is addition of hrs,
+ /// mins, seconds and milliseconds passed as an arguments.
+ /// \~english @param[in] hrs
+ /// UI_32 - Time in hours
+ /// \~english @param[in] mins
+ /// UI_64 - Time in minutes
+ /// \~english @param[in] seconds
+ /// UI_32 - Time in seconds
+ /// \~english @param[in] msecs
+ /// UI_64 - Time in milliseconds
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// This function overloads SetTime(). Set the interval of timeout. Interval is addition of hrs,
+ /// mins, seconds and milliseconds passed as an arguments.
+ /// The default value of interval time is 0.
+ /// If interval time is 0, stop timer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see none
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetTime(UI_32 hrs, UI_32 mins, UI_32 seconds, UI_64 msecs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Starts or restarts timer with specified time interval. Interval is addition of seconds and
+ /// milliseconds passed as an arguments.
+ /// \~english @param[in] seconds
+ /// UI_32 - Time in seconds
+ /// \~english @param[in] msecs
+ /// UI_64 - Time in milliseconds
+ /// \~english @retval EFrameworkunifiedStatus - Returns eFrameworkunifiedStatusOK on success otherwise eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// - Create a timer handle of instance by SetNotifyMethod()
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// - Timer handle of instance is NULL [eFrameworkunifiedStatusFail]
+ /// - Timer handle state of instance has been deleted(DELETED_STATE) [eFrameworkunifiedStatusFail]
+ /// - Failed to start/stop(timerfd_settime) timer [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// Starts or restarts timer with specified time interval. Interval is addition of seconds and
+ /// milliseconds passed as an arguments.
+ /// Interval time setted by this method will overwrite interval time setted by SetTime(UI_32, UI_64).
+ /// If interval time is 0, stop timer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// - None
+ /// \~english @see SetTime(UI_32, UI_64), Start, Stop, SetNotifyMethod
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Start(UI_32 seconds, UI_64 msecs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// This function overloads Start(). Starts or restarts timer with interval specified using SetTime()
+ /// or last interval (if the timer was started before using Start(seconds, msecs)).
+ /// \~english @retval EFrameworkunifiedStatus - Returns eFrameworkunifiedStatusOK on success otherwise eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// - Create a timer handle of instance by SetNotifyMethod()
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// - Timer handle of instance is NULL [eFrameworkunifiedStatusFail]
+ /// - Timer handle state of instance has been deleted(DELETED_STATE) [eFrameworkunifiedStatusFail]
+ /// - Failed to start/stop(timerfd_settime) timer [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - Starts or restarts timer with interval specified using SetTime(UI_32, UI_64) or Start(UI_32, UI_64).
+ /// If interval time is not setted, default value is 0. If interval time is 0, stop timer.
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// - None
+ /// \~english @see SetTime(UI_32, UI_64), Stop, SetNotifyMethod, WholeSeconds, MSToNS, NS_TimerSetTime
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Start();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Stops the timer
+ /// \~english @retval EFrameworkunifiedStatus - Returns eFrameworkunifiedStatusOK on success otherwise eFrameworkunifiedStatusFail
+ /// \~english @par Preconditons
+ /// - Create a timer handle of instance by SetNotifyMethod()
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// - Timer handle of instance is NULL [eFrameworkunifiedStatusFail]
+ /// - Timer handle state of instance has been deleted(DELETED_STATE) [eFrameworkunifiedStatusFail]
+ /// - Failed to stop(timerfd_settime) timer [eFrameworkunifiedStatusFail]
+ /// \~english @par Detail
+ /// - Stops the timer
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// - None
+ /// \~english @see Start, Start(UI_32, UI_64), SetNotifyMethod, NS_TimerSetTime
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Stop();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Returns timer running status
+ /// \~english @retval BOOL - TRUE if timer is running else FALSE
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// -Returns timer running status
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see Start, Start(UI_32, UI_64), SetNotifyMethod, NS_TimerSetTime
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsRunning();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NSTimer
+ /// \~english @par Brief
+ /// Returns timeout interval in milliseconds
+ /// \~english @retval UI_64 - Timeout interval in milliseconds
+ /// \~english @par Preconditons
+ /// -None
+ /// \~english @par Change of internal status
+ /// None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// - Returns timeout interval in milliseconds
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// -None
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_64 GetInterval();
+
+ private:
+
+ HANDLE m_hTimer; ///< Corresponding NS timer handle
+
+ UI_64 m_u64TimeInterval; ///< time interval in milliseconds
+
+ BOOL m_bRepeatTimer; ///< if it is a repeat timer. Default value is false.
+};
+
+
+#endif // NS_TIMER_IF_HPP_ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_transmit_log.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_transmit_log.h
new file mode 100755
index 0000000..e61ec7e
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_transmit_log.h
@@ -0,0 +1,256 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSSharedMemory
+/// \brief This file contains declaration of wrapper C type API's for class CNSSharedMem
+/// to read and write transmit log to shared memory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_transmit_log.h
+ * @brief \~english This file contains declaration of wrapper C type API for reading and writing
+ * transmit log on shared memory.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_LOG_H__ // NOLINT (build/header_guard)
+#define __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_LOG_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define TRANSMIT_LOG_SHAREDMEM_NAME "/TransmitLogShBuf"
+#define TRANSMIT_LOG_SHAREDMEM_SIZE 5242880 // 5MB
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemTransmitLogOpen
+/// \~english @par Brief
+/// Open the shared memory for transmit logging.
+/// \~english @param[in]
+/// \~english @retval eFrameworkunifiedStatusOK if shared memory is opened.
+/// \~english @retval eFrameworkunifiedStatusNullPointer if memory allocation error while creating shared memory pointer.
+/// \~english @retval eFrameworkunifiedStatusFail if shared memory not open
+/// \~english @par Preconditons
+/// - None
+/// \~english @par Change of internal status
+/// - Open shared memory object
+/// \~english @par Conditions of processing failure
+/// - Memory allocation error while creating shared memory pointer.[eFrameworkunifiedStatusNullPointer]
+/// - If shared memory not open.[eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Open the shared memory for transmit logging.\n
+/// If shared memory is not exist,then create a shared memory,and open.
+/// \~english @par Classification
+/// - public
+/// \~english @par Type
+/// - sync only
+/// \~english @par
+/// - eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Failure
+/// \~english @see NSSharedMemTransmitLogClose
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogOpen();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemTransmitLogClose
+/// \~english @par Brief
+/// Close the transmit logging shared memory
+/// \~english @param[in]
+/// \~english @retval eFrameworkunifiedStatusOK if shared memory is closed
+/// \~english @retval eFrameworkunifiedStatusNullPointer if shared memory pointer is NULL.
+/// \~english @retval eFrameworkunifiedStatusFail if shared memory was not closed.
+/// \~english @par Preconditons
+/// - None
+/// \~english @par Change of internal status
+/// -Open shared memory object
+/// \~english @par Conditions of processing failure
+/// - shared memory pointer is NULL.[eFrameworkunifiedStatusNullPointer]
+/// - If shared memory not close.[eFrameworkunifiedStatusFail]
+/// \~english @par Detail
+/// Close the transmit logging shared memory.\n
+/// If shared memory closed failure or shared memory don't exist,then return failure.
+/// \~english @par Classification
+/// - public
+/// \~english @par Type
+/// - sync only
+/// \~english @par
+/// - eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Failure
+/// \~english @see NSSharedMemTransmitLogOpen
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemTransmitLogClose();
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemReadTransmitLog
+/// \~english @par Brief
+/// Reads transmit log from the shared memory buffer.
+/// \~english @param [in] f_pBuffer
+/// PSTR - pointer to the buffer in which data to be read.
+/// \~english @param [in] f_uiLength
+/// UI_32 - length of the data to be read.
+/// \~english @param [in] f_bBlock
+/// BOOL - TRUE - blocking call
+/// FALSE - non blocking call
+/// \~english @retval Except NS_SHM_ERROR - Indicates the number of bytes read.
+/// \~english @retval NS_SHM_ERROR -if shared memory is not opened.
+/// \~english @par Preconditons
+/// -None
+/// \~english @par Change of internal status
+/// None
+/// \~english @par Conditions of processing failure
+/// if g_pTransmitLogSharedBuf or f_pBuffer is null.[NS_SHM_ERROR]
+/// \~english @par Detail
+/// If this function is used as blocking call,\n
+/// then the calling thread will get blocked until data is available for read.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par
+/// - l_iReadSize:Result
+/// - NS_SHM_ERROR:Failure
+/// - Except NS_SHM_ERROR:Success
+/// \~english @see NSSharedMemWriteTransmitLog
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemReadTransmitLog(PSTR f_pBuffer, const UI_32 f_uiLength, const BOOL f_bBlock);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemWriteTransmitLog
+/// \~english @par Brief
+/// Write transmit log into the shared memory buffer.
+/// \~english @param [in] f_pBuffer
+/// PSTR - pointer to the buffer containing the data to be written.
+/// \~english @param [in] f_uiLength
+/// UI_32 - length of the data buffer to be written.
+/// \~english @retval Except NS_SHM_ERROR - Indicates the number of bytes written,
+/// \~english @retval NS_SHM_ERROR -if shared memory is not opened.
+/// \~english @par Preconditons
+/// -None
+/// \~english @par Change of internal status
+/// None
+/// \~english @par Conditions of processing failure
+/// if g_pTransmitLogSharedBuf or f_pBuffer is null.[NS_SHM_ERROR]
+/// \~english @par Detail
+/// If this function is used as blocking call,\n
+/// then the calling thread will get blocked until data is available for write.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par
+/// - l_iReadSize:Result
+/// - NS_SHM_ERROR:Failure
+/// - Except NS_SHM_ERROR:Success
+/// \~english @see NSSharedMemReadTransmitLog
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 NSSharedMemWriteTransmitLog(PCSTR f_pBuffer, const UI_32 f_uiLength);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemDumpTransmitLogToFile
+/// \~english @par Brief
+/// Dump the transmit logging shared memory to file
+/// \~english @param [in] f_pPath
+/// PCSTR - full file path
+/// \~english @param [in] f_puiSize
+/// PCSTR - Size of data dumped to file
+/// \~english @retval eFrameworkunifiedStatusOK if shared memory is closed
+/// \~english @retval eFrameworkunifiedStatusFileLoadError file path is incorrect
+/// \~english @retval eFrameworkunifiedStatusSemLockFail/
+/// eFrameworkunifiedStatusSemUnLockFail - mutex locking/unlocking error
+/// \~english @retval eFrameworkunifiedStatusFail shared memory is not open
+/// \~english @par Preconditons
+/// - None
+/// \~english @par Change of internal status
+/// -Open shared memory object
+/// \~english @par Conditions of processing failure
+/// - shared memory pointer is NULL.[eFrameworkunifiedStatusNullPointer]
+/// - mutex locking/unlocking error.[eFrameworkunifiedStatusSemLockFail/eFrameworkunifiedStatusSemUnLockFail]
+/// - shared memory is not open.[eFrameworkunifiedStatusFail]
+/// - file path is incorrect.[eFrameworkunifiedStatusFileLoadError]
+/// \~english @par Detail
+/// Writes all the data in the buffer into provided file path.\n
+/// Overwrites the file if it exists.
+/// \~english @par Classification
+/// - public
+/// \~english @par Type
+/// - sync only
+/// \~english @par
+/// - eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Failure
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSSharedMemDumpTransmitLogToFile(PCSTR f_pPath, PUI_32 f_puiDumpSize);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NSSharedMemTransmitLogIsOpen
+/// \~english @par Brief
+/// This function is used to check whether the shared memory buffer is opened or not.
+/// \~english @retval TRUE - Open
+/// \~english @retval FALSE - Not open
+/// \~english @par Preconditons
+/// - None
+/// \~english @par Change of internal status
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// - This function is used to check whether the shared memory buffer is opened or not.\n
+/// Used only in nstest_sharedmem.
+/// \~english @par Classification
+/// - public
+/// \~english @par Type
+/// Sync only
+/// \~english @see none
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL NSSharedMemTransmitLogIsOpen();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NATIVESERVICES_NATIVESERVICES_INC_NATIVE_NS_SHAREDMEM_LOG_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_util_crc.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_util_crc.h
new file mode 100755
index 0000000..5528007
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_util_crc.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \brief This file contains declaration of APIs to calcuate 16-bit and 32-bit CRC checksum of file.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_util_crc.h
+ */
+
+#ifndef NS_NS_UTILITYCENTER_INC_NS_UTIL_CRC_H_ // NOLINT (build/header_guard)
+#define NS_NS_UTILITYCENTER_INC_NS_UTIL_CRC_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup utility
+ * @ingroup framework_unified
+ * @{
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Calculate the CRC value of the file
+/// \~english @param [in] f_c_file_name
+/// PCSTR - the file to be calculated
+/// \~english @param [out] f_ui_check_sum
+/// UI_16 - the CRC value of the file
+/// \~english @retval eFrameworkunifiedStatusOK : Success
+/// \~english @retval eFrameworkunifiedStatusFileLoadError : File Load Error
+/// \~english @retval eFrameworkunifiedStatusInvldParam : Invalid Param
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - Failed to open the file. [eFrameworkunifiedStatusFileLoadError]
+/// - The pointer f_c_file_name is NULL. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function calculates the CRC value(16 bit) of the file f_c_file_name.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CalculateCRC16(PCSTR f_c_file_name, UI_16 & f_ui_check_sum); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Calculate the CRC value of the file
+/// \~english @param [in] f_c_file_name
+/// PCSTR - the file to be calculated
+/// \~english @param [out] f_ui_check_sum
+/// UI_32 - the CRC value of the file
+/// \~english @retval eFrameworkunifiedStatusOK : Success
+/// \~english @retval eFrameworkunifiedStatusFileLoadError : File Load Error
+/// \~english @retval eFrameworkunifiedStatusInvldParam : Invalid Param
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - Failed to open the file. [eFrameworkunifiedStatusFileLoadError]
+/// - The pointer f_c_file_name is NULL. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function calculates the CRC value(32 bit) of the file f_c_file_name.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CalculateCRC32(PCSTR f_c_file_name, UI_32 & f_ui_check_sum); // NOLINT (readability/nolint)
+
+#endif // NS_NS_UTILITYCENTER_INC_NS_UTIL_CRC_H_ // NOLINT (build/header_guard)
+
+/** @}*/ // end of utility
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_util_directory.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_util_directory.h
new file mode 100755
index 0000000..945275c
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_util_directory.h
@@ -0,0 +1,160 @@
+/**
+ * @file ns_util_directory.h
+ * @brief \~english This file contains declaration of ns_util_directory.
+ *
+ */
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains utility functions to handle file and folder operations.
+///
+///
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef NS_NS_UTILITYCENTER_INC_NS_UTIL_DIRECTORY_H_ // NOLINT (build/header_guard)
+#define NS_NS_UTILITYCENTER_INC_NS_UTIL_DIRECTORY_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <vector>
+#include <string>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup utility
+ * @ingroup framework_unified
+ * @{
+ */
+
+/**
+ * \~english an abbreviation for std::vector<std::string>
+ */
+typedef std::vector< std::string > TFileList;
+
+/**
+ * \~english a abbreviation for std::vector<std::string>::iterator
+ */
+typedef TFileList::iterator TFileListIterator;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Get the name of files existing in a specific directory
+/// \~english @param [in] f_pc_path
+/// PCSTR - the directory path
+/// \~english @param [out] f_pv_tfile_list
+/// TFileList - store the name of the files in the specific directory
+/// \~english @retval eFrameworkunifiedStatusOK : Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam : Invalid Param
+/// \~english @retval eFrameworkunifiedStatusNullPointer : NULL Pointer
+/// \~english @retval eFrameworkunifiedStatusFail : Abnormal Error
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - The pointer f_pv_tfile_list or f_pc_path is NULL. [eFrameworkunifiedStatusInvldParam]
+/// - Failed to open the directory f_pc_path. [eFrameworkunifiedStatusFail]
+/// - Failed to new a buffer for inner using. [eFrameworkunifiedStatusNullPointer]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function gets all the name of the file locating at the directory f_pc_path and stores \n
+/// them in f_pv_tfile_list.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetFileList(TFileList * f_pv_tfile_list, PCSTR f_pc_path);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Check whether the directory is existing or not.
+/// \~english @param [in] f_c_dir_path
+/// std::string - the directory to be checked
+/// \~english @retval TRUE: the directory is existing.
+/// FALSE: the directory is not existing.
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function checks whether the directory is existing or not.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL DoesDirecotryExist(std::string f_c_dir_path);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup NS_UtilityCenter
+/// \~english @par Brief
+/// Create the directory f_c_dir_path.
+/// \~english @param [in] f_c_dir_path
+/// std::string - the directory to be created
+/// \~english @retval eFrameworkunifiedStatusOK : Success
+/// \~english @retval eFrameworkunifiedStatusFail : Abnormal Error
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - The input param f_c_dir_path is empty. [eFrameworkunifiedStatusFail]
+/// - Faild to create(mkdir) the direcory. [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// The function creates the directory f_c_dir_path.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CreateDirectory(std::string f_c_dir_path);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // NS_NS_UTILITYCENTER_INC_NS_UTIL_DIRECTORY_H_ NOLINT (build/header_guard)
+
+/** @}*/ // end of utility
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility.hpp b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility.hpp
new file mode 100755
index 0000000..07fe4f5
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility.hpp
@@ -0,0 +1,572 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_UtilityCenter
+/// \brief This file contains declaration of common APIs for NS_UtilityCenter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//@{
+/**
+ * @file ns_utility.hpp
+ * @brief \~english This file contains declaration of common APIs for NS_UtilityCenter.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __NSFRAMEWORK_NSUTILITY_NSUTILITY__ // NOLINT (build/header_guard)
+#define __NSFRAMEWORK_NSUTILITY_NSUTILITY__
+
+#include <native_service/frameworkunified_types.h>
+#include <new>
+#include <exception>
+#include <algorithm>
+#include <iterator>
+
+#ifdef AGL_STUB
+#include <stdexcept>
+#endif
+
+// Macros ///////////////////////////////////////////////////////////////
+
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&); \
+ void operator=(const TypeName& )
+
+#define DEFINE_EXCEPTION( name, base ) \
+class name : public base \
+{ \
+public: \
+ name ( const char* str = "" ) : base ( str ) \
+ {} \
+}
+
+// Helpful type definitions ////////////////////////////////////////////////
+template <int v>
+struct Int2Type {
+ enum { value = v }; // NOLINT (readability/nolint)
+};
+
+template <class T>
+struct Type2Type {
+ typedef T Type;
+};
+
+// Helpful Fucntions /////////////////////////////////////////////////////////
+template< class T, UI_32 N >
+const T *ArrBeg(const T(&arr)[ N ]) {
+ return &arr[ 0 ];
+}
+
+template< class T, UI_32 N >
+const T *ArrEnd(const T(&arr)[ N ]) {
+ return &arr[ 0 ] + N;
+}
+
+template< class O, class I >
+O SimpleCast(I i) {
+ return static_cast< O >(i);
+}
+
+template< class R, class B >
+R UnalignedRet(B *b) {
+ return *reinterpret_cast< R volatile * >(b);
+}
+
+template< class Cont, class Gen >
+Cont genRange(UI_32 N, Gen genFn) {
+ Cont c;
+ std::generate_n(std::back_inserter(c), N, genFn);
+ return c;
+}
+
+template< class OCont, class IIter, class MapFn >
+OCont mapRange(const IIter &begin, const IIter &end, MapFn fn) {
+ OCont c;
+ std::transform(begin, end, std::inserter(c, c.begin()), fn);
+ return c;
+}
+// Static Compile-time list creation /////////////////////////////////////////
+
+#ifdef AGL_STUB
+#else
+////////////////////////
+#include <_pack1.h> //
+//////////////////////////
+#endif
+
+template< class T, UI_32 N >
+struct TList {
+ T datum;
+ TList < T, N - 1 > data;
+
+ T *operator&() { // NOLINT (readability/nolint)
+ return reinterpret_cast< T * >(this);
+ }
+ const T *operator&() const { // NOLINT (readability/nolint)
+ return reinterpret_cast< const T * >(this);
+ }
+ static const UI_32 count = N; // NOLINT (readability/nolint)
+
+};
+
+template< class T >
+struct TList< T, 1 > {
+ T datum;
+
+ T *operator&() { // NOLINT (readability/nolint)
+ return reinterpret_cast< T * >(this);
+ }
+ const T *operator&() const { // NOLINT (readability/nolint)
+ return reinterpret_cast< const T * >(this);
+ }
+ static const UI_32 count = 1; // NOLINT (readability/nolint)
+
+};
+
+#ifdef AGL_STUB
+#else
+/////////////////////////
+#include <_packpop.h> //
+///////////////////////
+#endif
+
+// Function Decomposition ///////////////////////////////////////////////////
+
+template< class Sig >
+struct FSig {
+};
+
+template<class R>
+struct FSig< R(*)() > {
+ typedef R RType;
+ static const UI_32 argCount = 0; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1>
+struct FSig< R(*)(T1) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ static const UI_32 argCount = 1; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2>
+struct FSig< R(*)(T1, T2) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ static const UI_32 argCount = 2; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2, class T3>
+struct FSig< R(*)(T1, T2, T3) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ typedef T3 TArg3;
+ static const UI_32 argCount = 3; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2, class T3, class T4>
+struct FSig< R(*)(T1, T2, T3, T4) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ typedef T3 TArg3;
+ typedef T4 TArg4;
+ static const UI_32 argCount = 4; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2, class T3, class T4, class T5>
+struct FSig< R(*)(T1, T2, T3, T4, T5) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ typedef T3 TArg3;
+ typedef T4 TArg4;
+ typedef T5 TArg5;
+ static const UI_32 argCount = 5; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2, class T3, class T4, class T5, class T6>
+struct FSig< R(*)(T1, T2, T3, T4, T5, T6) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ typedef T3 TArg3;
+ typedef T4 TArg4;
+ typedef T5 TArg5;
+ typedef T6 TArg6;
+ static const UI_32 argCount = 6; // NOLINT (readability/nolint)
+};
+
+template<class R, class T1, class T2, class T3, class T4, class T5, class T6, class T7>
+struct FSig< R(*)(T1, T2, T3, T4, T5, T6, T7) > {
+ typedef R RType;
+ typedef T1 TArg1;
+ typedef T2 TArg2;
+ typedef T3 TArg3;
+ typedef T4 TArg4;
+ typedef T5 TArg5;
+ typedef T6 TArg6;
+ typedef T7 TArg7;
+ static const UI_32 argCount = 7; // NOLINT (readability/nolint)
+};
+
+
+
+// Accumulator definition //////////////////////////////////////////////////
+
+/// \brief Accumultor type
+///
+/// An accumulator is an object that keeps an internal counter, and will increment its
+/// counter by n, which defaults to 1, each time operator() is called on it. Eample usage:
+///
+/// Accumulator< int > a( 42 ); // initialize a to 42
+/// int v1 = a(); // <-- v1 == 43
+/// int v2 = a(); // <-- v2 == 44
+/// int v4 = a(10); // <-- v4 == 54
+/// int v5 = a(); // <-- v5 == 55
+template<typename T>
+class Accumulator {
+ public:
+ Accumulator(T n) : n(n) {}
+
+ template<typename U>
+ Accumulator(const Accumulator<U> &u) : n(u.n) {}
+
+ T operator()(T i = 1) { // NOLINT (readability/nolint)
+ return operator()< T >(i);
+ }
+
+ template<typename U>
+ T operator()(U i) {
+ return n += i;
+ }
+
+ template< typename U >
+ friend class Accumulator;
+
+ private:
+ T n;
+};
+
+
+/// \brief Accumulator utility function
+///
+/// Given a value n of type T, returns an accumulator of type Accumulator<T> initialized to value n
+template<typename T>
+Accumulator<T> MakeAccumulator(T n) {
+ return Accumulator<T>(n);
+}
+
+// Rsrc Management helper class /////////////////////////////////////////////
+
+template< class T >
+class MemTraits {
+ public:
+ typedef T *Type;
+ typedef std::bad_alloc Exception;
+ static void Release(Type rsrc) {
+ delete rsrc;
+ }
+
+ static BOOL BadValue(Type rsrc) {
+ return NULL == rsrc;
+ }
+};
+
+template< class RsrcTraits >
+class RaiseExceptionPolicy {
+ public:
+ typedef typename RsrcTraits::Type Type;
+ static Type check(Type t) { // NOLINT (readability/nolint)
+ if (RsrcTraits::BadValue(t)) {
+ throw typename RsrcTraits::Exception();
+ }
+
+ return t;
+ }
+};
+
+template< class RsrcTraits >
+class CheckForErrorPolicy { // no exceptions
+ public:
+ typedef typename RsrcTraits::Type Type;
+
+ static Type check(Type t) { // NOLINT (readability/nolint)
+ return t;
+ }
+
+ static bool isValid(Type t) { // NOLINT (readability/nolint)
+ return ! RsrcTraits::BadValue(t);
+ }
+};
+
+template < class T,
+ class RsrcTraits = MemTraits< T >,
+ template <class> class ErrorPolicy = RaiseExceptionPolicy >
+class ResourceMgr : public RsrcTraits {
+ public:
+ typedef typename RsrcTraits::Type Type;
+ typedef ErrorPolicy< RsrcTraits > TFullErrorPolicy;
+
+ ResourceMgr(Type rsrc) : m_rsrc(TFullErrorPolicy::check(rsrc)) {}
+
+ ~ResourceMgr() {
+ RsrcTraits::Release(m_rsrc);
+ }
+
+ operator Type() { // NOLINT (readability/nolint)
+ return m_rsrc;
+ }
+
+ operator const Type() const { // NOLINT (readability/nolint)
+ return m_rsrc;
+ }
+
+ bool isValid() const { // NOLINT (readability/nolint)
+ return TFullErrorPolicy::isValid(m_rsrc);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ResourceMgr);
+
+ Type m_rsrc;
+};
+
+// Functor Helper classes /////////////////////////////////////
+template< class R >
+class IFunctor {
+ public:
+ IFunctor() {}
+ virtual ~IFunctor() {}
+
+ virtual R operator()() const = 0; // NOLINT (readability/nolint)
+ virtual UI_32 size() const = 0; // NOLINT (readability/nolint)
+};
+
+template< class TFn >
+class CFunctor0 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+ CFunctor0(TFn fn) : m_function(fn) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function();
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn);
+ }
+
+ private:
+ TFn m_function;
+};
+
+template< class TFn, class Arg1 >
+class CFunctor1 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+
+ CFunctor1(TFn fn, Arg1 arg1) : m_function(fn), m_arg1(arg1) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1);
+ }
+
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+};
+
+template< class TFn, class Arg1, class Arg2 >
+class CFunctor2 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+
+ CFunctor2(TFn fn, Arg1 arg1, Arg2 arg2) : m_function(fn), m_arg1(arg1), m_arg2(arg2) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+};
+
+template< class TFn, class Arg1, class Arg2, class Arg3 >
+class CFunctor3 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+
+ CFunctor3(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3) : m_function(fn), m_arg1(arg1), m_arg2(arg2), m_arg3(arg3) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2, m_arg3);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2) + sizeof(Arg3);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+ Arg3 m_arg3;
+};
+
+template< class TFn, class Arg1, class Arg2, class Arg3, class Arg4 >
+class CFunctor4 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+ CFunctor4(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) : m_function(fn), m_arg1(arg1), m_arg2(arg2),
+ m_arg3(arg3), m_arg4(arg4) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2, m_arg3, m_arg4);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2) + sizeof(Arg3) + sizeof(Arg4);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+ Arg3 m_arg3;
+ Arg4 m_arg4;
+};
+
+template< class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
+class CFunctor5 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+ CFunctor5(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) : m_function(fn), m_arg1(arg1), m_arg2(arg2),
+ m_arg3(arg3), m_arg4(arg4), m_arg5(arg5) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2, m_arg3, m_arg4, m_arg5);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2) + sizeof(Arg3) + sizeof(Arg4) + sizeof(Arg5);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+ Arg3 m_arg3;
+ Arg4 m_arg4;
+ Arg5 m_arg5;
+};
+
+template< class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6 >
+class CFunctor6 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+ CFunctor6(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6) : m_function(fn), m_arg1(arg1),
+ m_arg2(arg2), m_arg3(arg3), m_arg4(arg4), m_arg5(arg5), m_arg6(arg6) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2) + sizeof(Arg3) + sizeof(Arg4) + sizeof(Arg5) + sizeof(Arg6);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+ Arg3 m_arg3;
+ Arg4 m_arg4;
+ Arg5 m_arg5;
+ Arg6 m_arg6;
+};
+
+template< class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7 >
+class CFunctor7 : public IFunctor< typename FSig< TFn >::RType > {
+ public:
+ CFunctor7(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6, Arg7 arg7)
+ : m_function(fn), m_arg1(arg1), m_arg2(arg2), m_arg3(arg3), m_arg4(arg4), m_arg5(arg5), m_arg6(arg6), m_arg7(arg7) {}
+ typename FSig< TFn >::RType operator()() const { // NOLINT (readability/nolint)
+ return m_function(m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7);
+ }
+ UI_32 size() const { // NOLINT (readability/nolint)
+ return sizeof(TFn) + sizeof(Arg1) + sizeof(Arg2) + sizeof(Arg3) + sizeof(Arg4) + sizeof(Arg5) + sizeof(Arg6) + sizeof(Arg7);
+ }
+ private:
+ TFn m_function;
+ Arg1 m_arg1;
+ Arg2 m_arg2;
+ Arg3 m_arg3;
+ Arg4 m_arg4;
+ Arg5 m_arg5;
+ Arg6 m_arg6;
+ Arg7 m_arg7;
+};
+
+
+template<class TFn>
+CFunctor0<TFn> functor(TFn fn) {
+ return CFunctor0<TFn>(fn);
+}
+
+template<class TFn, class Arg1>
+CFunctor1<TFn, Arg1> functor(TFn fn, Arg1 arg1) {
+ return CFunctor1<TFn, Arg1>(fn, arg1);
+}
+
+template<class TFn, class Arg1, class Arg2>
+CFunctor2<TFn, Arg1, Arg2> functor(TFn fn, Arg1 arg1, Arg2 arg2) {
+ return CFunctor2<TFn, Arg1, Arg2>(fn, arg1, arg2);
+}
+
+template<class TFn, class Arg1, class Arg2, class Arg3>
+CFunctor3<TFn, Arg1, Arg2, Arg3> functor(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3) {
+ return CFunctor3<TFn, Arg1, Arg2, Arg3>(fn, arg1, arg2, arg3);
+}
+
+template<class TFn, class Arg1, class Arg2, class Arg3, class Arg4>
+CFunctor4<TFn, Arg1, Arg2, Arg3, Arg4> functor(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) {
+ return CFunctor4<TFn, Arg1, Arg2, Arg3, Arg4>(fn, arg1, arg2, arg3, arg4);
+}
+
+template<class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5>
+CFunctor5<TFn, Arg1, Arg2, Arg3, Arg4, Arg5> functor(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) {
+ return CFunctor5<TFn, Arg1, Arg2, Arg3, Arg4, Arg5>(fn, arg1, arg2, arg3, arg4, arg5);
+}
+
+template<class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6>
+CFunctor6<TFn, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6> functor(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4,
+ Arg5 arg5, Arg6 arg6) {
+ return CFunctor6<TFn, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>(fn, arg1, arg2, arg3, arg4, arg5, arg6);
+}
+
+template<class TFn, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7>
+CFunctor7<TFn, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7> functor(TFn fn, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4,
+ Arg5 arg5, Arg6 arg6, Arg7 arg7) {
+ return CFunctor7<TFn, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>(fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+}
+
+#endif // __NSFRAMEWORK_NSUTILITY_NSUTILITY__ NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility_if.h
new file mode 100755
index 0000000..ee10337
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility_if.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains declaration of common APIs for NS_UtilityCenter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ns_utility_if.h
+ */
+
+#ifndef NS_NATIVESERVICES_INC_NATIVE_NS_UTILITY_IF_H_ // NOLINT (build/header_guard)
+#define NS_NATIVESERVICES_INC_NATIVE_NS_UTILITY_IF_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+
+/**
+ * \~english Macro for invalid/undefined return
+ */
+#define NS_INVALID_RETURN -1
+
+/**
+ * \~english Macro for setting the i bit of x to one
+ */
+#define NS_SETBIT(x, i) ((x) |= (1 << (i)))
+
+/**
+ * \~english Macro for setting the i bit of x to zero
+ */
+#define NS_CLEARBIT(x, i) ((x) &= ~(1 << (i)))
+
+/**
+ * \~english Macro for making the exclusive-OR operator on the i bit of x with one
+ */
+#define NS_TOGGLEBIT(x, i) ((x) ^= (1 << (i)))
+
+/**
+ * \~english Macro for checking whether the i bit of x is one or not
+ */
+#define NS_ISBITSET(x, i) (((x) & (1 << (i))) != 0)
+
+#endif // NS_NATIVESERVICES_INC_NATIVE_NS_UTILITY_IF_H_ // NOLINT (build/header_guard)
+
+/** @}*/ // end of native
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility_sys.hpp b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility_sys.hpp
new file mode 100755
index 0000000..5780144
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_utility_sys.hpp
@@ -0,0 +1,321 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains declaration of common APIs for NS_UtilityCenter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_utility_sys.hpp
+ */
+
+#ifndef __NSFRAMEWORK_NSUTILITY_NSUTILITYSYS__ // NOLINT (build/header_guard)
+#define __NSFRAMEWORK_NSUTILITY_NSUTILITYSYS__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_utility.hpp>
+#include <pthread.h>
+#include <errno.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+
+// Lock Wrapper ////////////////////////////////////////////////////////////////
+
+/**
+ * \~english define the lock_error class inherit from std::runtime_error
+ */
+DEFINE_EXCEPTION(lock_error, std::runtime_error);
+
+/**
+ * \~english define the lock_creation_error class inherit from lock_error
+ */
+DEFINE_EXCEPTION(lock_creation_error, lock_error);
+
+/**
+ * \~english define the lock_acquireread_error class inherit from lock_error
+ */
+DEFINE_EXCEPTION(lock_acquireread_error, lock_error);
+
+/**
+ * \~english define the lock_acquirewrite_error class inherit from lock_error
+ */
+DEFINE_EXCEPTION(lock_acquirewrite_error, lock_error);
+
+/**
+ * \~english define the lock_release_error class inherit from lock_error
+ */
+DEFINE_EXCEPTION(lock_release_error, lock_error);
+
+
+/**
+ * @class CMutex
+ * @brief \~english Mutex Lock Class
+ * @par \~english Brief Introduction
+ * \~english This class defines locking policy for Mutexes.
+ *
+ */
+class CMutex {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Construct a CMutex object.
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function constructs a CMutex object.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CMutex();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Destruct the CMutex object.
+ /// \~english @par Prerequisite
+ /// - Construct a CMutex object
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function destructs the CMutex object.
+ /// \~english @see CMutex()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CMutex();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Lock the CMutex object when reading.
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CMutex object
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function locks the CMutex object when reading.
+ /// \~english @see CMutex(), WriteLock(), UnLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void ReadLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Lock the CMutex object when writing.
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CMutex object
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function locks the CMutex object when writing.
+ /// \~english @see CMutex(), ReadLock(), UnLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void WriteLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Open the lock of the CMutex object.
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CMutex object
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function opens the lock of the CMutex object.
+ /// \~english @see CMutex(), ReadLock(), WriteLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void Unlock();
+
+ private:
+
+ pthread_mutex_t m_mtx;
+};
+
+/**
+ * @class CRWLock
+ * @brief \~english Read/Write Lock Class
+ * @par \~english Brief Introduction
+ * \~english This class defines locking policy for reader/writer.
+ *
+ */
+class CRWLock {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// - Construct a CRWLock object.
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function constructs a CRWLock object.
+ /// \~english @see ~CRWLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRWLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Destruct the CRWLock object.
+ /// \~english @par Prerequisite
+ /// - Construct a CRWLock object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function destructs the CRWLock object.
+ /// \~english @see CRWLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CRWLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Lock the CRWLock object when reading.
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CRWLock object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function locks the CRWLock object when reading.
+ /// \~english @see CRWLock(), WriteLock(), UnLoack()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void ReadLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Lock the CRWLock object when writing.
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CRWLock object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function locks the CRWLock object when writing.
+ /// \~english @see CRWLock(), ReadLock(), UnLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void WriteLock();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Open the lock of CRWLock object
+ /// \~english @retval void
+ ///
+ /// \~english @par Prerequisite
+ /// - Construct a CRWLock object.
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function opens the lock of the CRWLock object.
+ /// \~english @see CRWLock(), ReadLock(), WriteLock()
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ void Unlock();
+
+ private:
+ pthread_rwlock_t m_rwl;
+};
+
+#endif // __NSFRAMEWORK_NSUTILITY_NSUTILITYSYS__ // NOLINT (build/header_guard)
+/** @}*/ // end of native
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_version.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_version.h
new file mode 100755
index 0000000..fad7eff
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_version.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_version.h
+ * @brief \~english This file provides version define
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef VERSION_H_ // NOLINT (build/header_guard)
+#define VERSION_H_
+
+#define MAJORNO 0x02
+#define MINORNO 0x02
+#define REVISION 0x05
+
+#endif /* VERSION_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_version_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_version_if.h
new file mode 100755
index 0000000..d0f5172
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_version_if.h
@@ -0,0 +1,510 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Header for CFrameworkunifiedVersion class
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_version_if.h
+* @brief \~english Header for CFrameworkunifiedVersion class
+ */
+
+#ifndef NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_ // NOLINT (build/header_guard)
+#define NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_
+#include <native_service/frameworkunified_types.h>
+#include <string.h>
+
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+#include <other_service/strlcat.h>
+#endif
+
+
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup native
+ * @ingroup framework_unified
+ * @{
+ */
+
+/**
+ * @class CFrameworkunifiedVersion
+ * @brief \~english Version Info Class
+ * @par \~english Brief Introduction
+ * \~english This class provides functions to get various information of the version.
+ *
+ */
+class CFrameworkunifiedVersion {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Construct a CFrameworkunifiedVersion object.
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function constructs a CFrameworkunifiedVersion object.
+ /// \~english @see ~CFrameworkunifiedVersion
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedVersion();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Constructs a CFrameworkunifiedVersion object with parameters.
+ /// \~english @param[in] major
+ /// UI_16 - Major number of the application
+ /// \~english @param[in] minor
+ /// UI_16 - Minor number of the application
+ /// \~english @param[in] revision
+ /// UI_16 - Revision number of the application
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function constructs a CFrameworkunifiedVersion object with parameters.
+ /// \~english @see ~CFrameworkunifiedVersion
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFrameworkunifiedVersion(UI_16 major, UI_16 minor, UI_16 revision);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Destruct the CFrameworkunifiedVersion object.
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function destructs the CFrameworkunifiedVersion object.
+ /// \~english @see CFrameworkunifiedVersion
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CFrameworkunifiedVersion();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the data number
+ /// \~english @param [in] a
+ /// CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against b.
+ /// \~english @param [in] b
+ /// CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against a.
+ /// \~english @retval TRUE: Match, FALSE: Does not Match
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function is a friend function of the class. \n
+ /// The function checks whether the object matchs the other or not. Match: returns TRUE, \n
+ /// Does not match: returns FALSE.
+ /// \~english @see operator ==
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ friend BOOL operator == (CFrameworkunifiedVersion &a, CFrameworkunifiedVersion &b); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the data number
+ /// \~english @param [in] f_test_i
+ /// CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against this obj.
+ /// \~english @retval TRUE: Match, FALSE: Does not Match
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function checks whether the object matchs the other or not. Match: returns TRUE, \n
+ /// Does not match: returns FALSE.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL operator == (const CFrameworkunifiedVersion &f_test_i); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the version as string
+ /// \~english @retval the vision string
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the version string.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PCSTR VersionStr();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the date as string
+ /// \~english @retval the date string
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the date when building.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PCSTR DateStr();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the signature number
+ /// \~english @retval the signature
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the signature number.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 Signature() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the structure version number
+ /// \~english @retval the structure version number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the structure version number.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 StrucVersion() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the product version
+ /// \~english @retval the product version
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the product version.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 ProductVersion() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the date as number
+ /// \~english @retval the date number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the date as number.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 Date() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the major verion number
+ /// \~english @retval the major version number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the major version number.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_16 Major() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the minor version number
+ /// \~english @retval the minor version number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the minor version number.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_16 Minor() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the unique product identifier
+ /// \~english @retval the revision number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the unique product identifier generated by the build server.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PCSTR Product() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the building version string
+ /// \~english @retval the building version string
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the unique build identifier generated by the build server.
+ /// \~english @see
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ PCSTR Build() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NS_UtilityCenter
+ /// \~english @par Brief
+ /// Get the revision number
+ /// \~english @retval the revision number
+ ///
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Change of internal state
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// The function returns the revision as number.
+ /// \~english @see CFrameworkunifiedVersion
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_16 Revision() const;
+
+ private:
+ CFrameworkunifiedVersion(const CFrameworkunifiedVersion &);
+ CFrameworkunifiedVersion &operator= (const CFrameworkunifiedVersion &); // NOLINT (readability/nolint)
+ struct VersionInfo {
+ PSTR p_str_product;
+ UI_32 u32_signature;
+ UI_32 u32_struc_version;
+ UI_32 u32_product_version;
+ UI_32 u32_date;
+ UI_16 u16_major;
+ UI_16 u16_minor;
+ PSTR p_str_build;
+ UI_16 u16_revision;
+ VersionInfo(PSTR p, UI_32 a, UI_32 b, UI_32 c, UI_32 d, UI_16 e, UI_16 f , PSTR g, UI_16 h) :
+ u32_signature(a),
+ u32_struc_version(b),
+ u32_product_version(c),
+ u32_date(d),
+ u16_major(e),
+ u16_minor(f),
+ u16_revision(h) {
+ size_t length = strlen(p) + 1;
+ p_str_product = new CHAR[length]; // LCOV_EXCL_BR_LINE 11:except branch
+ if (NULL != p_str_product) { // LCOV_EXCL_BR_LINE 5:new's error case
+ memset(p_str_product, 0, length);
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(p_str_product, p, length);
+#endif
+ }
+
+ length = strlen(g) + 1;
+ p_str_build = new CHAR[length]; // LCOV_EXCL_BR_LINE 11:except branch
+ if (NULL != p_str_build) { // LCOV_EXCL_BR_LINE 5:new's error case
+ memset(p_str_build, 0, length);
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(p_str_build, g , length);
+#endif
+ }
+ }
+ ~VersionInfo() {
+ delete[] p_str_product; // LCOV_EXCL_BR_LINE 11:except branch
+ p_str_product = NULL;
+ delete[] p_str_build; // LCOV_EXCL_BR_LINE 11:except branch
+ p_str_build = NULL;
+ }
+ } m_tVersionInfo;
+ UI_32 m_u32Month;
+ UI_32 m_u32Year;
+ UI_32 m_u32Day;
+};
+
+/**
+ * \~english define macro for version string
+ */
+#define FRAMEWORKUNIFIED_GET_VERSION() "undefined_undefined_00.00.00"
+
+/**
+ * \~english define macro for the major number of the version
+ */
+#define FRAMEWORKUNIFIED_APP_VERSION_MAJOR() (0)
+
+/**
+ * \~english define macro for the minor number of the version
+ */
+#define FRAMEWORKUNIFIED_APP_VERSION_MINOR() (0)
+
+/**
+ * \~english define macro for the revision number
+ */
+#define FRAMEWORKUNIFIED_APP_VERSION_REVISION() (0)
+
+/**
+ * \~english define macro for the building version
+ */
+#define FRAMEWORKUNIFIED_APP_VERSION_BUILDVER() "undefined"
+
+/**
+ * \~english define macro for product version
+ */
+#define FRAMEWORKUNIFIED_APP_VERSION_PRODUCTID() "undefined"
+
+#endif // NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_ // NOLINT (build/header_guard)
+/** @}*/ // end of native
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_writer.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_writer.h
new file mode 100755
index 0000000..788b6a4
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_writer.h
@@ -0,0 +1,229 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class IConfigWriter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ns_writer.h
+ * @brief \~english This file contains declaration of class IConfigWriter.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_WRITER_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_WRITER_H__ // NOLINT(build/header_guard)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h> // NOLINT(build/header_guard)
+#include <string>
+
+
+/**
+ * @class IConfigWriter
+ * \~english @brief Config writer abstract class.
+ * \~english @par Brief Introduction
+ * IConfigWriter is an abstract class which is inherited by\n
+ * different type configuration file writer class.
+ *
+ */
+class IConfigWriter {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// Constructor of IConfigWriter class
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - To get a instance of this class.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see ~IConfigWriter
+ ////////////////////////////////////////////////////////////////////////////////////
+ IConfigWriter();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~IConfigWriter
+ /// \~english @par Brief
+ /// Destructor of IConfigWriter class
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// - Destruct the object of this class.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see IConfigWriter
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~IConfigWriter();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// This function is used to parse the file.
+ /// \~english @param [in] f_c_filepath
+ /// std::string - path of file to parse
+ /// \~english @retval EFrameworkunifiedStatus - success or failure
+ /// \~english @par Preconditons
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function is used to parse the file.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ParseFile(const std::string &f_c_filepath) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// This function is used to set the value for the key
+ /// \~english @param [in] f_c_key
+ /// std::string - key to search
+ /// \~english @param [in] f_c_value
+ /// std::string - value to set
+ /// \~english @retval EFrameworkunifiedStatus - error if key not found else eFrameworkunifiedStatusOK
+ /// \~english @par Preconditons
+ /// - Calls constructor to successfully create object.
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function is used to set the value for the key
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SetValue(const std::string &f_c_key, std::string f_c_value) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// This function is used to save the changed value permanently to the config source
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function is used to save the changed value permanently to the config source
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SaveData() = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// This function is used to set the config file path
+ /// \~english @param [in] f_cpath
+ /// std::string - Path of file
+ /// \~english @retval EFrameworkunifiedStatus - success or failure
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function is used to set the config file path
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SetPath(const std::string &f_cpath) = 0;
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IConfigWriter
+ /// \~english @par Brief
+ /// This function is used to set the data pointer in config writer class with data pointer\n
+ /// created in config reader class.\n
+ /// This is needed to avoid recreation of same data structure object in both reader and writer\n
+ /// when we create object of NSConfigParser.\n
+ /// \~english @param [in] f_pdata
+ /// PVOID - Pointer to data structure
+ /// \~english @retval None
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - None
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Detail
+ /// This function is used to set the data pointer in config writer class with data pointer\n
+ /// created in config reader class.\n
+ /// This is needed to avoid recreation of same data structure object in both reader and writer\n
+ /// when we create object of NSConfigParser.\n
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync only
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual VOID SetDataPtr(PVOID f_pdata) = 0;
+};
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_CONFIG_WRITER_H__ */ // NOLINT (build/header_guard)
+/** @}*/ // end of framework_unified
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_xml_reader.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_xml_reader.h
new file mode 100755
index 0000000..91e88c0
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_xml_reader.h
@@ -0,0 +1,291 @@
+/**
+ * @file ns_xml_reader.h
+ * @brief \~english This file contains declaration of class CXMLReader.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class CXMLReader.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_READER_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_READER_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <libxml/tree.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_reader.h>
+#include <string>
+
+
+/**
+ * @class CXMLReader
+ * \~english @par Brief Introduction
+ * This class provides functionalities to read from XML config file.
+ *
+ */
+class CXMLReader: public IConfigReader {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXMLReader
+ /// \~english @par Brief
+ /// This API constructor of CXMLReader class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API should be called by ServiceA and create a new object of CXMLReader.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ CXMLReader();
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXMLReader
+ /// \~english @par Brief
+ /// This API constructor of CXMLReader class.
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - Full path of the configuration file
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API should be called by ServiceA and create a new object of CXMLReader with filepath.
+ /// \~english @see GetCXMLReaderObject
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXMLReader(const std::string &f_cFilePath); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CXMLReader
+ /// \~english @par CXMLReader
+ /// Destructor of CXMLReader class.
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// - Close shared memory object.
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Destruct the object of CXMLReader
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @see CXMLReader
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CXMLReader();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseFile
+ /// \~english @par Brief
+ /// This API parser file
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - path of file to parse
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// - Create XmlReader object.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API is used to parse the file from the path.
+ /// \~english @see CXMLReader or GetCXMLReaderObject
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus ParseFile(const std::string &f_cFilePath);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseFile
+ /// \~english @par Brief
+ /// Get Value with key
+ /// \~english @param [IN] f_cKey
+ /// std::string - key to search
+ /// \~english @retval std::string - value for key
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// - Create XmlReader object.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to get the value associated with the key
+ /// \~english @see CXMLReader or GetCXMLReaderObject
+ ////////////////////////////////////////////////////////////////////////////////
+ std::string GetValue(const std::string &f_cKey);
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseFile
+ /// \~english @par Brief
+ /// Get Value with key
+ /// \~english @param [IN] f_cKey
+ /// std::string - key to search
+ /// \~english @param [REF] f_cValue
+ /// std::string - Value of key
+ /// \~english @retval eFrameworkunifiedStatusOK Success / Pass / OK
+ /// \~english @retval eFrameworkunifiedStatusFail Failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// - Create XmlReader object.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to get the value associated with the key
+ /// \~english @see CXMLReader or GetCXMLReaderObject
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ EFrameworkunifiedStatus GetValue(const std::string &f_cKey, std::string &f_cValue); // NOLINT (readability/nolint)
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseFile
+ /// \~english @par Brief
+ /// Get Value with key
+ /// \~english @param None
+ /// \~english @retval PVOID - pointer of data structure
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// - Create XmlReader object.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to get the data pointer. This pointer is then set in config writer.
+ /// \~english @see CXMLReader or GetCXMLReaderObject
+ ////////////////////////////////////////////////////////////////////////////////
+ PVOID GetDataPtr();
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// XMLGetValue
+ /// This function is used to parse and get the value from xml file
+ ///
+ /// \param [IN] f_pCurrNode
+ /// xmlNodePtr - pointer to current node in xml
+ /// \param [IN] f_cUserKey
+ /// std::string - Key to be searched for
+ ///
+ /// \return std::string - content of key node
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string XMLGetValue(xmlNodePtr f_pCurrNode, const std::string &f_cUserKey);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// XMLGetValue
+ /// This function is used to parse and get the value from xml file
+ ///
+ /// \param [IN] f_pCurrNode
+ /// xmlNodePtr - pointer to current node in xml
+ /// \param [IN] f_cUserKey
+ /// std::string - Key to be searched for
+ /// \param [IN] f_cValue
+ /// std::string - Value of Key
+ /// \param [IN] f_bKeyFound
+ /// BOOL - flag to check whether key exists in xml file or not
+ ///
+ /// \return EFrameworkunifiedStatus - error if key not found or else eFrameworkunifiedStatusOK
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus XMLGetValue(xmlNodePtr f_pCurrNode,
+ const std::string &f_cUserKey, std::string &f_cValue, BOOL &f_bKeyFound); // NOLINT (readability/nolint)
+ // pointer of xml document structure(DOM)
+ xmlDocPtr m_pXmlDoc;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetCXMLReaderObject
+ /// \~english @par Brief
+ /// Get CXMLReader object.
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - path of file to parse
+ /// \~english @retval CXMLReader *
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API is used to create CXMLReader object with file path and return the CXMLReader pointer.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+CXMLReader *GetCXMLReaderObject(CHAR *f_cFilePath);
+#ifdef __cplusplus
+}
+#endif
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_READER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_xml_writer.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_xml_writer.h
new file mode 100755
index 0000000..7686553
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_xml_writer.h
@@ -0,0 +1,336 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ns_xml_writer.h
+ * @brief \~english This file contains declaration of class CXMLWriter.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_ConfigParser
+/// \brief This file contains declaration of class CXMLWriter.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_WRITER_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_WRITER_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <libxml/tree.h>
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_writer.h>
+
+#include <string>
+
+/**
+ * @class CXMLWriter
+ * \~english @brief this file has the CXMLWriter class definitions
+ * \~english @par Brief Introduction
+ * This class provides functionalities to write to XML config file
+ *
+ */
+class CXMLWriter: public IConfigWriter {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXMLWriter
+ /// \~english @par Brief
+ /// Parameterless Constructor of CXMLWriter class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API should be called by ServiceA and create a new object without file path of CXMLWriter
+ /// \~english @see GetCXMLWriterObjectNoParam
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXMLWriter();
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXMLWriter
+ /// \~english @par Brief
+ /// Constructor of CXMLWriter class
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - Full path of the configuration file
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API should be called by ServiceA and create a new object with file path of CXMLWriter
+ /// \~english @see GetCXMLWriterObject
+ ////////////////////////////////////////////////////////////////////////////////
+ CXMLWriter(const std::string &f_cFilePath); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CXMLWriter
+ /// \~english @par CXMLWriter
+ /// Destructor of CXMLWriter class.
+ /// \~english @param None
+ /// \~english @retval none
+ /// \~english @par Preconditons
+ /// - None
+ /// \~english @par Change of internal status
+ /// -None
+ /// \~english @par Conditions of processing failure
+ /// -None
+ /// \~english @par Detail
+ /// Destruct the object of CXMLWriter
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @see CXMLWriter
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CXMLWriter();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseFile
+ /// \~english @par Brief
+ /// Parse file
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - path of file to parse
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Create CXMLWriter object
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to parse the file
+ /// \~english @see CXMLWriter
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus ParseFile(const std::string &f_cFilePath);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetValue
+ /// \~english @par Brief
+ /// Set vaule for key
+ /// \~english @param [IN] f_cKey
+ /// std::string - key to search
+ /// \~english @param [IN] f_cValue
+ /// std::string - value to set
+ /// \~english @retval eFrameworkunifiedStatusOK Success / Pass / OK
+ /// \~english @retval eFrameworkunifiedStatusFail Failed
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Create CXMLWriter object
+ /// - ParseFile set the path
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to set the value for the key
+ /// \~english @see CXMLWriter,ParseFile
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SetValue(const std::string &f_cKey, std::string f_cValue);
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SaveData
+ /// \~english @par Brief
+ /// Save changed data
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success / Pass / OK
+ /// \~english @retval eFrameworkunifiedStatusFail Failed
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Create CXMLWriter object
+ /// - ParseFile set the path
+ /// - Change the data
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to save the changed value to the xml config file
+ /// \~english @see GetCXMLWriterObjectNoParam
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SaveData();
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetPath
+ /// \~english @par Brief
+ /// Updata file path
+ /// \~english @param [IN] f_cPath
+ /// std::string - Path of file
+ /// \~english @retval eFrameworkunifiedStatusOK Success / Pass / OK
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Create CXMLWriter object
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to set the config file path
+ /// \~english @see GetCXMLWriterObjectNoParam
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SetPath(const std::string &f_cPath);
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetDataPtr
+ /// \~english @par Brief
+ /// Parse file
+ /// \~english @param [IN] f_pData
+ /// PVOID - Pointer to data structure
+ /// \~english @retval VOID
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Create CXMLWriter object
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This function is used to set the data pointer in config writer class
+ /// \~english @see CXMLWriter
+ ////////////////////////////////////////////////////////////////////////////////
+
+ VOID SetDataPtr(PVOID f_pData);
+
+ private:
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// XMLSetValue
+/// This function is used to parse the value from xml file
+///
+/// \param [IN] f_pCurrNode
+/// xmlNodePtr - pointer to current node in xml
+/// \param [IN] f_cUserKey
+/// std::string - Key to be searched for
+/// \param [IN] f_cValue
+/// std::string - Required Value for key
+/// \param [IN] f_bKeyFound
+/// std::string - Flag to check whether key is present in xml file
+///
+/// \return EFrameworkunifiedStatus- success or failure
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus XMLSetValue(xmlNodePtr f_pCurrNode,
+ const std::string &f_cUserKey, // NOLINT (readability/nolint)
+ std::string &f_cValue, // NOLINT (readability/nolint)
+ BOOL &f_bKeyFound); // NOLINT (readability/nolint)
+
+// pointer of xml document structure(DOM)
+ xmlDocPtr m_pXmlDoc;
+
+// path of config file
+ std::string m_cFilePath;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetCXMLWriterObject
+ /// \~english @par Brief
+ /// Get CXMLWriter object.
+ /// \~english @param [IN] f_cFilePath
+ /// std::string - path of file to parse
+ /// \~english @retval CXMLWriter *
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API is used to create CXMLWriter object with file path and return the CXMLWriter pointer.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+CXMLWriter *GetCXMLWriterObject(CHAR *f_cFilePath);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetCXMLWriterObjectNoParam
+ /// \~english @par Brief
+ /// Get CXMLWriter object.
+ /// \~english @param None
+ /// \~english @retval CXMLWriter *
+ /// \~english @par Prerequisite
+ /// - Load the shared library first.
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync
+ /// \~english @par Detail
+ /// This API is used to create CXMLWriter object without file path and return the CXMLWriter pointer.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+
+CXMLWriter *GetCXMLWriterObjectNoParam();
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NSCONFIGPARSER_INC_NS_XML_WRITER_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_xmlparser_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_xmlparser_if.h
new file mode 100755
index 0000000..f944ddd
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/ns_xmlparser_if.h
@@ -0,0 +1,1150 @@
+/**
+ * @file ns_xmlparser_if.h
+ * @brief \~english This file contains declaration of class CXmlParser, CXmlNode and CXmlAttr.
+ * This file provides the interface for Parsing XML file, API for operation on node
+ * of an xml structure.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NS_XMLPARSER_INC_NS_XMLPARSER_IF_H__ // NOLINT (build/header_guard)
+#define __FRAMEWORKUNIFIED_NATIVESERVICES_NS_XMLPARSER_INC_NS_XMLPARSER_IF_H__
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <string>
+#include <list>
+
+// defines the type of xml nodes
+/**
+ * \~english type of xml nodes
+ */
+typedef enum _EFrameworkunifiedXmlNodeTypes {
+ FRAMEWORKUNIFIED_XML_NODE_NONE = 0, //!< \~english not exist node
+ FRAMEWORKUNIFIED_XML_ELEMENT_NODE = 1, //!< \~english element node
+ FRAMEWORKUNIFIED_XML_ATTRIBUTE_NODE = 2, //!< \~english attribute node
+ FRAMEWORKUNIFIED_XML_TEXT_NODE = 3, //!< \~english text node
+ FRAMEWORKUNIFIED_XML_CDATA_SECTION_NODE = 4, //!< \~english section node
+ FRAMEWORKUNIFIED_XML_ENTITY_REF_NODE = 5, //!< \~english entity ref node
+ FRAMEWORKUNIFIED_XML_ENTITY_NODE = 6, //!< \~english entity node
+ FRAMEWORKUNIFIED_XML_PI_NODE = 7, //!< \~english PI node
+ FRAMEWORKUNIFIED_XML_COMMENT_NODE = 8, //!< \~english comment node
+ FRAMEWORKUNIFIED_XML_DOCUMENT_NODE = 9, //!< \~english document node
+ FRAMEWORKUNIFIED_XML_DOCUMENT_TYPE_NODE = 10, //!< \~english document type node
+ FRAMEWORKUNIFIED_XML_DOCUMENT_FRAG_NODE = 11, //!< \~english document frag node
+ FRAMEWORKUNIFIED_XML_NOTATION_NODE = 12, //!< \~english notation node
+ FRAMEWORKUNIFIED_XML_HTML_DOCUMENT_NODE = 13, //!< \~english document node
+ FRAMEWORKUNIFIED_XML_DTD_NODE = 14, //!< \~english dtd node
+ FRAMEWORKUNIFIED_XML_ELEMENT_DECL = 15, //!< \~english element decl
+ FRAMEWORKUNIFIED_XML_ATTRIBUTE_DECL = 16, //!< \~english attribute decl
+ FRAMEWORKUNIFIED_XML_ENTITY_DECL = 17, //!< \~english entity decl
+ FRAMEWORKUNIFIED_XML_NAMESPACE_DECL = 18, //!< \~english namespace decl
+ FRAMEWORKUNIFIED_XML_XINCLUDE_START = 19, //!< \~english include start
+ FRAMEWORKUNIFIED_XML_XINCLUDE_END = 20, //!< \~english include end
+ FRAMEWORKUNIFIED_XML_DOCB_DOCUMENT_NODE = 21 //!< \~english document node
+} EFrameworkunifiedXmlNodeTypes;
+
+// forward declaration
+class CXmlNode;
+class CXmlAttr;
+
+// list of CXmlNode
+typedef std::list<CXmlNode> TNodeList;
+typedef TNodeList::iterator TNodeListIterator;
+
+// list of CXmlAttr
+typedef std::list<CXmlAttr> TAttrList;
+typedef std::list<CXmlAttr>::iterator TAttrListIterator;
+
+
+/**
+ * @class CXmlNode
+ * \~english @brief This class represents node of an XML.
+ * \~english @par Brief Introduction
+ * Provides API for performing operations on node.
+ *
+ */
+class CXmlNode {
+ friend class CXmlParser;
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlNode
+ /// \~english @par Brief
+ /// Destructor of CXmlNode class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Inside state change
+ /// - None
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Destructor of CXmlNode class
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ ~CXmlNode();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IsNull
+ /// \~english @par Brief
+ /// Check xmlNodePtr
+ /// \~english @param None
+ /// \~english @retval BOOL true if valid else false
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Checks whether the corresponding xmlNodePtr is valid or not
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ BOOL IsNull();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Type
+ /// \~english @par Brief
+ /// Get type
+ /// \~english @param None
+ /// \~english @retval FRAMEWORKUNIFIED_XML_NODE_NONE not exist node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ELEMENT_NODE element node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_TEXT_NODE text node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_CDATA_SECTION_NODE section node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ENTITY_REF_NODE entity ref node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ENTITY_NODE entity node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_PI_NODE PI node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_COMMENT_NODE comment node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_DOCUMENT_NODE document node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_DOCUMENT_TYPE_NODE document type node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_DOCUMENT_FRAG_NODE document frag node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_NOTATION_NODE notation node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_HTML_DOCUMENT_NODE document node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_DTD_NODE dtd node
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ELEMENT_DECL element decl
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ATTRIBUTE_DECL attribute decl
+ /// \~english @retval FRAMEWORKUNIFIED_XML_ENTITY_DECL entity decl
+ /// \~english @retval FRAMEWORKUNIFIED_XML_NAMESPACE_DECL namespace decl
+ /// \~english @retval FRAMEWORKUNIFIED_XML_XINCLUDE_START include start
+ /// \~english @retval FRAMEWORKUNIFIED_XML_XINCLUDE_END include end
+ /// \~english @retval FRAMEWORKUNIFIED_XML_DOCB_DOCUMENT_NODE document node
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Gets the type of XML node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedXmlNodeTypes Type();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Name
+ /// \~english @par Brief
+ /// Get name
+ /// \~english @param None
+ /// \~english @retval std::string node name
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the name/tag of an XML node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ std::string Name();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetContent
+ /// \~english @par Brief
+ /// Get content
+ /// \~english @param None
+ /// \~english @retval std::string content of current node
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Gets the content of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ std::string GetContent();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetContent
+ /// \~english @par Brief
+ /// Set content
+ /// \~english @param [IN] f_cUpdatedText
+ /// std::string - updated value
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set or update the content of current node. If the node has children then it removes all the child
+ /// nodes and sets the content for the current node.
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SetContent(std::string f_cUpdatedText);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetAttributeValue
+ /// \~english @par Brief
+ /// Get attribute
+ /// \~english @param [IN] f_cKey
+ /// std::string - attribute name
+ /// \~english @param [OUT] f_cAttributeValue
+ /// std::string& - attribute value
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the attribute's value for the key
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus GetAttributeValue(std::string f_cKey, std::string &f_cAttributeValue); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetAttributeValue
+ /// \~english @par Brief
+ /// Set attribute
+ /// \~english @param [IN] f_cKey
+ /// std::string - attribute name
+ /// \~english @param [IN] f_cValue
+ /// std::string - attribute value
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Set the attribute's value for the key
+ /// If attribute is not found then new attribute key-value pair is created and added to node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SetAttributeValue(std::string f_cKey, std::string f_cValue);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup AddNewAttribute
+ /// \~english @par Brief
+ /// Add new attribute
+ /// \~english @param [IN] f_cKey
+ /// std::string - attribute name
+ /// \~english @param [IN] f_cValue
+ /// std::string - attribute value
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Add new attribute to the node. If the attribute key is existing then it updates the existing
+ /// value with the new value or else adds the new attribute
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus AddNewAttribute(std::string f_cKey, std::string f_cAttributeValue);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RemoveAttribute
+ /// \~english @par Brief
+ /// Removes attribute
+ /// \~english @param [IN] f_cKey
+ /// std::string - attribute name
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Remove the attribute from the node with the specified key
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus RemoveAttribute(std::string f_cKey);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetAttributeItems
+ /// \~english @par Brief
+ /// Get attributes list
+ /// \~english @param None
+ /// \~english @retval TAttrList - list of all attributes of node or empty list in case of no attributes
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the list of all the attribute's key and value of the node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ TAttrList GetAttributeItems();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Parent
+ /// \~english @par Brief
+ /// Get parent
+ /// \~english @param None
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the parent node of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ CXmlNode Parent();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FirstChild
+ /// \~english @par Brief
+ /// Get first child
+ /// \~english @param None
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the first child node of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode FirstChild();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LastChild
+ /// \~english @par Brief
+ /// Get last child
+ /// \~english @param None
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the last child node of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode LastChild();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Children
+ /// \~english @par Brief
+ /// Get child list
+ /// \~english @param None
+ /// \~english @retval TNodeList - list of all child node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the list of all the child nodes of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ TNodeList Children();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NextSibling
+ /// \~english @par Brief
+ /// Get next node
+ /// \~english @param None
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the next sibling node of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode NextSibling();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup PrevSibling
+ /// \~english @par Brief
+ /// Get previous node
+ /// \~english @param None
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the previous sibling node of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode PrevSibling();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FindChildNode
+ /// \~english @par Brief
+ /// Find child node
+ /// \~english @param [IN] f_cNodeName std::string - tag name of the node
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the first immediate sub node with matching node name
+ /// This function does not provide support to find node based on attribute value
+ /// Use FindNode() API of CXmlParser to find node based on XPath expression
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ CXmlNode FindChildNode(std::string f_cNodeName);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FindAllChildNodes
+ /// \~english @par Brief
+ /// Get list of all the immediate sub node
+ /// \~english @param [IN] f_cNodeName std::string - tag name of the node
+ /// \~english @retval TNodeList - list of matching nodes
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the list of all the immediate sub node matching tag as f_cNodeName.
+ /// This function does not provide support to find node based on attribute value.
+ /// Use FindNode() API of CXmlParser to find node based on XPath expression.
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ TNodeList FindAllChildNodes(std::string f_cNodeName);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetContentOfChildNode
+ /// \~english @par Brief
+ /// Find first level node
+ /// \~english @param [IN] f_cNodeName
+ /// std::string - name of the node
+ /// \~english @param [OUT] f_cContent
+ /// std::string& - content of the node
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusFail Failed
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Find the first level sub node matching tag as f_cNodeName
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus GetContentOfChildNode(std::string f_cNodeName, std::string &f_cContent); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup AddChildNode
+ /// \~english @par Brief
+ /// Add sub node
+ /// \~english @param [IN] f_cNodeName
+ /// std::string - tag of the new node
+ /// \~english @param [IN] f_cText
+ /// std::string - content of the new node
+ /// \~english @retval CXmlNode - object of child node
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Add sub node to the current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode AddChildNode(std::string f_cNodeName, std::string f_cText = "");
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup AddSiblingNode
+ /// \~english @par Brief
+ /// Add new node to siblings
+ /// \~english @param [IN] f_cNodeName
+ /// std::string - tag of the new node
+ /// \~english @param [IN] f_cText
+ /// std::string - content of the new node
+ /// \~english @retval CXmlNode - object of sibling node
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Add a new node to the list of siblings of current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode AddSiblingNode(std::string f_cNodeName, std::string f_cText = "");
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RemoveChildNode
+ /// \~english @par Brief
+ /// Remove child node
+ /// \~english @param [IN] f_cNodeName
+ /// std::string - name of child node
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Remove the child node from current node
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus RemoveChildNode(std::string f_cNodeName);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ClearNode
+ /// \~english @par Brief
+ /// Removes elements and attributes
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// This function removes all sub elements, clears all attributes,
+ /// and sets the text and tail attributes to None
+ /// \~english @see CXmlNode
+ ////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearNode();
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CXmlNode
+ /// Constructor of CXmlNode class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CXmlNode();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CXmlNode
+ /// Parameterized constructor of CXmlNode class
+ ///
+ /// \param f_pXmlNodePtr
+ /// xmlNodePtr - pointer of an xml node
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CXmlNode(xmlNodePtr f_pXmlNodePtr); // NOLINT (readability/nolint)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetXmlNodePtr
+ /// Sets the xmlNodePtr
+ ///
+ /// \param f_pXmlNodePtr
+ /// xmlNodePtr - pointer of an xml node
+ ///
+ /// \return VOID
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetXmlNodePtr(xmlNodePtr f_pXmlNodePtr);
+
+ // pointer to xml node
+ xmlNodePtr m_pXmlNodePtr;
+};
+
+
+/**
+ * @class CXmlAttr
+ * \~english @brief This class represents the attribute of an xml node.
+ * \~english @par Brief Introduction
+ * This class represents the attribute of an xml node.
+ *
+ */
+class CXmlAttr {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlAttr
+ /// \~english @par Brief
+ /// CXmlAttr constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parameterized constructor of CXmlAttr class
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ CXmlAttr();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlAttr
+ /// \~english @par Brief
+ /// CXmlAttr constructor
+ /// \~english @param [IN] f_cKey
+ /// std::string - attributes key
+ /// \~english @param [IN] f_cValue
+ /// std::string - attributes value
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parameterized constructor of CXmlAttr class
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ CXmlAttr(std::string f_cKey, std::string f_cValue);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlAttr
+ /// \~english @par Brief
+ /// Destructor of CXmlAttr class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Inside state change
+ /// - None
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Destructor of CXmlAttr class
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ ~CXmlAttr();
+
+ // atrribute key
+ std::string m_cKey;
+
+ // atrribute value
+ std::string m_cValue;
+};
+
+/**
+ * @class CXmlParser
+ * \~english @brief This class represents the XML parser.
+ * \~english @par Brief Introduction
+ * Provides API for parsing xml file. Also provides API to search node/nodes based on Xml Path
+ *
+ */
+class CXmlParser {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlParser
+ /// \~english @par Brief
+ /// CXmlParser constructor
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Constructor of CXmlParser class
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////
+ CXmlParser();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CXmlParser
+ /// \~english @par Brief
+ /// Destructor of CXmlParser class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Prerequisite
+ /// - None
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Destructor of CXmlParser class
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+ ~CXmlParser();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ParseXml
+ /// \~english @par Brief
+ /// Parses xml file
+ /// \~english @param [IN] f_cFileName
+ /// std::string - full path of xml file to be parsed
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Parses the xml file and creates a document structure
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus ParseXml(std::string f_cFileName);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateNewXmlDoc
+ /// \~english @par Brief
+ /// Creates new xml
+ /// \~english @param [IN] f_cRootNodeName
+ /// std::string - root node name in new doc
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Create a new xml document
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus CreateNewXmlDoc(std::string f_cRootNodeName);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SaveXml
+ /// \~english @par Brief
+ /// Save XML file
+ /// \~english @param [IN] f_cFileName
+ /// std::string - full path of output xml file
+ /// In case of parsing an xml file,
+ /// if f_cFileName is empty, output will be saved in source xml file
+ /// else output will be saved in user provided file path
+ /// In case of creating new xml document,
+ /// if f_cFileName is empty, returns error
+ /// else output will be saved in user provided file path
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Save the updated structure to the XML file
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus SaveXml(std::string f_cFileName = "");
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetRootNode
+ /// \~english @par Brief
+ /// Get root node
+ /// \~english @param None
+ /// \~english @retval CXmlNode - root node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Get the root node object
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode GetRootNode();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup AddNewNode
+ /// \~english @par Brief
+ /// Create and add node
+ /// \~english @param [IN] f_pParentNode
+ /// CXmlNode - parent node
+ /// \~english @param [IN] f_cNewNodeName
+ /// std::string - tag name of the new node
+ /// \~english @param [IN] f_cContent
+ /// std::string - text to set for the new node
+ /// \~english @retval CXmlNode - new node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Create new node and add it to the parent node
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ CXmlNode AddNewNode(CXmlNode m_pParentNode, std::string f_cNewNodeName, std::string f_cContent = "");
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RemoveNode
+ /// \~english @par Brief
+ /// Remove node
+ /// \~english @param [IN] f_pNode
+ /// CXmlNode - node object
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Null pointer
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Remove the node from the xml
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ EFrameworkunifiedStatus RemoveNode(CXmlNode m_pNode);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FindNode
+ /// \~english @par Brief
+ /// Find first matching node
+ /// \~english @param [IN] f_cNodePath
+ /// std::string - name or path of node(XPath) path is relative to current node or absolute path
+ /// \~english @param [IN] f_pCurrentNode
+ /// CXmlNode - current node
+ /// \~english @retval CXmlNode - node object
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Find the first matching node, by tag name or path relative to current node path or
+ /// absolute path. Here the path is XPath expression
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+
+ CXmlNode FindNode(std::string f_cNodePath, CXmlNode f_pCurrentNode);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FindAllNodes
+ /// \~english @par Brief
+ /// Find all matching node
+ /// \~english @param [IN] f_cNodePath
+ /// std::string - name or path of node(XPath) path is relative to current node or absolute path
+ /// \~english @param [IN] f_pCurrentNode
+ /// CXmlNode - current node
+ /// \~english @retval TNodeList - list of matching nodes
+ /// \~english @par Prerequisite
+ /// - Load the shared library first
+ /// - Get CXmlNode from CXmlParser
+ /// \~english @par Inside state change
+ /// - The API no inside state change
+ /// \~english @par None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync Only
+ /// \~english @par Detail
+ /// Find all the matching node, by tag name or path relative to current node path or
+ /// absolute path.
+ /// \~english @see CXmlParser
+ ////////////////////////////////////////////////////////////////////////////////
+
+ TNodeList FindAllNodes(std::string f_cNodePath, CXmlNode f_pCurrentNode);
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNodeSet
+ /// Gets the node set resulting from search of nodepath using XPath
+ ///
+ /// \param f_cNodePath
+ /// std::string - name or path of node
+ /// path is relative to current node or absolute path
+ /// \param f_pCurrentNode
+ /// CXmlNode - current node
+ ///
+ /// \return xmlXPathObjectPtr
+ /// xmlXPathObjectPtr - returns the xpath object pointer containing nodes pointer
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ xmlXPathObjectPtr GetNodeSet(std::string f_cNodePath, CXmlNode f_pCurrentNode);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsReadable
+ /// Checks whether the file exists or not
+ ///
+ /// \param
+ ///
+ /// \return VOID
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsReadable(const std::string &filename);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ClearDocument
+ /// Clears the document structure and resets the root node
+ ///
+ /// \param
+ ///
+ /// \return VOID
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ClearDocument();
+
+ // pointer to structure created from xml after parsing
+ xmlDocPtr m_pXmlDoc;
+
+ // stores the name/path of source xml file
+ std::string m_cFileName;
+
+ // pointer to the root node of xml structure
+ CXmlNode m_pRootNode;
+};
+
+
+#endif /* __FRAMEWORKUNIFIED_NATIVESERVICES_NS_XMLPARSER_INC_NS_XMLPARSER_IF_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/nsfw_message.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/nsfw_message.h
new file mode 100755
index 0000000..b5872c5
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/nsfw_message.h
@@ -0,0 +1,65 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file nsfw_message.h
+ * @brief \~english The file definition of NSFW message for NSFW independent module reference
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup utility
+ * @ingroup framework_unified
+ * @{
+ */
+/*
+ * The definition of NSFW message for NSFW independent module reference.
+ *
+ */
+//@{
+#ifndef _nsfw_message_h_ // NOLINT (build/header_guard)
+#define _nsfw_message_h_
+
+/*
+ * The following definitions are defined only for NSFW to check consistency.
+ * NOT TO BE USED IN ANY WAY.
+ */
+#define _NSFW_MSG_LEN_ (40)
+#define _NSFW_SYSINFO_FLAG_ (4)
+#define _NSFW_SYSINFO_SIZE_ (64)
+
+/*
+ * The following definitions are published definitions.
+ */
+#define NSFW_GET_MESSAGE(msg) \
+ ((*((unsigned int *)msg) & _NSFW_SYSINFO_FLAG_) ? \
+ ((unsigned char *)msg) + _NSFW_MSG_LEN_ + _NSFW_SYSINFO_SIZE_ : \
+ ((unsigned char *)msg) + _NSFW_MSG_LEN_)
+
+#endif // _nsfw_message_h_ // NOLINT (build/header_guard)
+//@}
+/**@}*/ // end of utility
+/**@}*/ // end of framework_unified
+/**@}*/ // end of native_service
+/**@}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/nslogutil_cmd_if.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/nslogutil_cmd_if.h
new file mode 100755
index 0000000..90f03b7
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/nslogutil_cmd_if.h
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file
+/// Declares COMMANDS related to Log Utility
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file
+ * @brief \~english Declares COMMANDS related to Log Utility
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup utility
+ * @ingroup framework_unified
+ * @{
+ */
+
+#ifndef COMMANDS_H_ // NOLINT (build/header_guard)
+#define COMMANDS_H_
+
+// Notifications
+#define NTFY_LOGGER_SETCONTROLMASK "LoggerService/SetControlMask"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief Logger Utility Commands
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _COMMANDS {
+ SET_LOG_MASK = 0xAEA, // < Sets the NS log mask for a process. uses CHANGELOGPARAMS
+ GET_LOG_MASK, // < Gets the NS log mask for a process. uses CHANGELOGPARAMS
+ SET_LOG_OUT_OPT, // < Sets the NS log output option mask for a process. uses CHANGELOGPARAMS
+ GET_LOG_OUT_OPT, // < Gets the NS log output option mask for a process. uses CHANGELOGPARAMS
+ GET_LOG_MASK_RESPONSE, // < Get the response about NS log masks
+ GET_LOG_OUT_OPT_RESPONSE, // < Get the response about NS log output options
+ SET_MSGTX_RX_ON_AND_TX_OFF, // < Sets TransmissionLogger to receive ON, transmit OFF
+ SET_MSGTX_RX_OFF_AND_TX_ON, // < Sets TransmissionLogger to receive OFF, transmit ON
+ SET_MSGTX_RX_AND_TX_ON, // < Sets TransmissionLogger to receive ON, transmit ON
+ SET_MSGTX_RX_AND_TX_OFF, // < Sets TransmissionLogger to receive OFF, transmit OFF
+ kDebugDumpRequest, // < Sets a debug dump log to the debug dump queue
+ SET_LOG_SEVERITY, // < Sets the NS severity log level
+ GET_LOG_SEVERITY, // < Gets the NS severity log level
+ GET_LOG_SEVERITY_RESPONSE, // < Get the response about NS serverity log level
+
+ // list of protocols provided for rcs logger plugin
+ NSRCS_SET_LOG_SETTINGS_REQ, // < Set the NS RCS log setting request
+ NSRCS_SET_LOG_SETTINGS_RESP, // < Set the NS RCS log setting response
+ NSRCS_GET_LOG_SETTINGS_REQ, // < Get the NS RCS log setting request
+ NSRCS_GET_LOG_SETTINGS_RESP, // < Get the NS RCS log setting response
+ NSRCS_SET_LOG_MASK_REQ, // < Set the NS RCS log mask request
+ NSRCS_SET_LOG_MASK_RESP, // < Get the NS RCS log mask response
+ NSRCS_SET_LOG_OUT_OPT_REQ, // < Set the NS RCS log output option request
+ NSRCS_SET_LOG_OUT_OPT_RESP, // < Set the NS RCS log output option response
+ NSRCS_SET_LOG_SEVERITY_REQ, // < Set the NS RCS severity log level request
+ NSRCS_SET_LOG_SEVERITY_RESP, // < Set the NS RCS severity log level response
+} COMMANDS;
+
+#endif /* COMMANDS_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/native_service/wpf_legacy.h b/video_in_hal/nsframework/framework_unified/client/include/native_service/wpf_legacy.h
new file mode 100755
index 0000000..7553f91
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/native_service/wpf_legacy.h
@@ -0,0 +1,152 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english This file define primary types to use
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup framework_unified
+ * @ingroup native_service
+ * @{
+ */
+/** @addtogroup framework
+ * @ingroup framework_unified
+ * @{
+ */
+#ifndef __WPF_LEGACY_H__ // NOLINT (build/header_guard)
+#define __WPF_LEGACY_H__
+
+// these are legacy definitions.
+// these were defined at Windows_Def.h ... in the past.
+// if you make new code , you should not use these.
+// you should use definitions in frameworkunified_types.h.
+
+#include <native_service/frameworkunified_types.h>
+
+
+// Windows_Def.h
+#define CALLBACK
+#define INVALID_HANDLE_VALUE ((void*)(-1))
+#define INFINITE 0xFFFFFFFF
+
+typedef int INT;
+typedef unsigned int UINT;
+typedef unsigned int *PUINT;
+#define VOID void
+typedef char CHAR;
+typedef short SHORT; // NOLINT (readability/nolint)
+typedef long LONG; // NOLINT (readability/nolint)
+typedef SHORT *PSHORT;
+typedef LONG *PLONG;
+typedef unsigned long ULONG; // NOLINT (readability/nolint)
+typedef ULONG *PULONG;
+typedef unsigned short USHORT; // NOLINT (readability/nolint)
+typedef USHORT *PUSHORT;
+typedef unsigned char UCHAR;
+typedef UCHAR *PUCHAR;
+typedef unsigned long DWORD; // NOLINT (readability/nolint)
+// defined in kernelmoduleevklibdd.h typedef int BOOL;
+typedef unsigned char BYTE;
+typedef unsigned short WORD; // NOLINT (readability/nolint)
+typedef float FLOAT;
+typedef FLOAT *PFLOAT;
+typedef BOOL *PBOOL;
+typedef BOOL *LPBOOL;
+typedef BYTE *PBYTE;
+typedef BYTE *LPBYTE;
+typedef int *PINT;
+typedef int *LPINT;
+typedef WORD *PWORD;
+typedef WORD *LPWORD;
+typedef long *LPLONG; // NOLINT (readability/nolint)
+typedef DWORD *PDWORD;
+typedef DWORD *LPDWORD;
+typedef void *PVOID;
+typedef void *LPVOID;
+typedef const void *LPCVOID;
+typedef wchar_t WCHAR;
+typedef size_t SIZE_T;
+typedef DWORD COLORREF;
+typedef DWORD *LPCOLORREF;
+typedef CHAR *PCHAR, *LPCH, *PCH;
+typedef CONST CHAR *LPCCH, *PCCH;
+typedef CHAR *NPSTR, *LPSTR, *PSTR;
+typedef PSTR *PZPSTR;
+typedef CONST PSTR *PCZPSTR;
+typedef CONST CHAR *LPCSTR, *PCSTR;
+typedef PCSTR *PZPCSTR;
+typedef void *HGDIOBJ;
+typedef int INT_PTR, *PINT_PTR;
+typedef unsigned int UINT_PTR, *PUINT_PTR;
+typedef long LONG_PTR, *PLONG_PTR; // NOLINT (readability/nolint)
+typedef unsigned long ULONG_PTR, *PULONG_PTR; // NOLINT (readability/nolint)
+typedef unsigned long ULONGLONG; // NOLINT (readability/nolint)
+typedef char CCHAR;
+typedef DWORD LCID;
+typedef PDWORD PLCID;
+typedef WORD LANGID;
+typedef long LONGLONG; // NOLINT (readability/nolint)
+typedef WORD ATOM;
+
+typedef pthread_mutex_t CRITICAL_SECTION;
+typedef CRITICAL_SECTION *LPCRITICAL_SECTION;
+
+#define __readableTo(extent)
+#define __nullterminated __readableTo(sentinel(0))
+
+typedef __nullterminated WCHAR *NWPSTR, *LPWSTR, *PWSTR;
+typedef __nullterminated PWSTR *PZPWSTR;
+typedef __nullterminated CONST PWSTR *PCZPWSTR;
+typedef __nullterminated CONST WCHAR *LPCWSTR, *PCWSTR;
+typedef __nullterminated PCWSTR *PZPCWSTR;
+
+#ifdef UNICODE
+#define wsprintf swprintf
+typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
+typedef LPWSTR PTSTR, LPTSTR;
+typedef LPCWSTR PCTSTR, LPCTSTR;
+#else /* UNICODE */
+#define wsprintf sprintf
+typedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR;
+typedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR;
+typedef WCHAR *LPWCH;
+typedef WCHAR *PWCHAR; // 110509 chg
+#endif /* UNICODE */
+
+#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
+
+typedef struct _SYSTEMTIME {
+ WORD wYear;
+ WORD wMonth;
+ WORD wDayOfWeek;
+ WORD wDay;
+ WORD wHour;
+ WORD wMinute;
+ WORD wSecond;
+ WORD wMilliseconds;
+} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
+
+#endif /* __WPF_LEGACY_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/framework_unified/client/include/ns__CWORD77__template.h b/video_in_hal/nsframework/framework_unified/client/include/ns__CWORD77__template.h
new file mode 100755
index 0000000..e4069dd
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/ns__CWORD77__template.h
@@ -0,0 +1,60 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_HMI_CWORD77_Controller
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////
+//@{
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS__CWORD77__TEMPLATE_H_
+#define FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS__CWORD77__TEMPLATE_H_
+
+#include <iterator>
+#include <algorithm>
+
+/// Template for Map range transformation
+template< class OCont, class IIter, class MapFn >
+OCont mapRange(const IIter &begin, const IIter &end, MapFn fn) {
+ OCont c;
+ std::transform(begin, end, std::inserter(c, c.begin()), fn);
+ return c;
+}
+
+
+/// Template to get Array begining
+template< class T, UI_32 N >
+const T *ArrBeg(const T(&arr)[ N ]) {
+ return &arr[ 0 ];
+}
+
+/// Template to get Array ending
+template< class T, UI_32 N >
+const T *ArrEnd(const T(&arr)[ N ]) {
+ return &arr[ 0 ] + N;
+}
+
+/// Template to convert structure to Map
+template< class Cont, class T, class C, class TFn >
+const Cont GetMap(const T *mapTable, C N, TFn transform) {
+ return mapRange< Cont >(&mapTable[0], &mapTable[0] + N, transform);
+}
+
+ServiceResponseTableItem TransformServiceResponseTableIteminMap(const ServiceResponse &uch);
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS__CWORD77__TEMPLATE_H_
+//@}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/ns_logger_additional_if.h b/video_in_hal/nsframework/framework_unified/client/include/ns_logger_additional_if.h
new file mode 100755
index 0000000..4d67e18
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/ns_logger_additional_if.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file
+/// Declares the external APIs to Logger.Include this header when you want to use FRAMEWORKUNIFIEDLOG_TEXT.
+/// \ingroup tag_NSLogger
+/// @{
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_LOGGER_ADDITIONAL_IF_H_
+#define FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_LOGGER_ADDITIONAL_IF_H_
+
+#include <native_service/ns_logger_if.h>
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NSLogger
+/// \brief FRAMEWORKUNIFIEDLOG_TEXT
+///////////////////////////////////////////////////////////////////////////////
+/// FRAMEWORKUNIFIEDLOG_TEXT macro will output the log without relationship to the ZONE.
+/// \note Developers should use the FRAMEWORKUNIFIEDLOG for logging.
+///////////////////////////////////////////////////////////////////////////////
+#define FRAMEWORKUNIFIEDLOG_TEXT(funcname, args...) TEXT_ZONE(BITS_IN_ZONE_MASK, funcname, ## args)
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS_LOGGER_ADDITIONAL_IF_H_
+/// @}
diff --git a/video_in_hal/nsframework/framework_unified/client/include/nsverutil_cmd_if.h b/video_in_hal/nsframework/framework_unified/client/include/nsverutil_cmd_if.h
new file mode 100755
index 0000000..70705e8
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/include/nsverutil_cmd_if.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NSVERUTIL_CMD_IF_H_
+#define FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NSVERUTIL_CMD_IF_H_
+
+typedef enum _VERCOMMANDS {
+ GET_VERSION_RESPONSE = 0xBEB, /**< Version response from framework */
+ GET_VERSION /**< Version request to framework */
+} VERCOMMANDS;
+
+#endif // FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NSVERUTIL_CMD_IF_H_
diff --git a/video_in_hal/nsframework/framework_unified/client/libNS_FrameworkUnified.ver b/video_in_hal/nsframework/framework_unified/client/libNS_FrameworkUnified.ver
new file mode 100755
index 0000000..764c5bb
--- /dev/null
+++ b/video_in_hal/nsframework/framework_unified/client/libNS_FrameworkUnified.ver
@@ -0,0 +1,144 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libNS_FrameworkUnified version script
+#
+{
+ global:
+ ### .text section ###
+ extern "C++" {
+ Frameworkunified*;
+ SetReqDataIn_CWORD77_DataPool*;
+ GetResp*;
+ SetResp*;
+ CalculateCRC32*;
+ ConvertEndian_*;
+ CFrameworkunifiedAction::*;
+ CFrameworkunifiedVersion::*;
+ operator*CFrameworkunifiedVersion*;
+ CNSSharedMem::*;
+ CNSSharedMemReader::*;
+ CNSRingBuffer::*;
+ CFrameworkunifiedLeafState::*;
+ CFrameworkunified_CWORD77_Service::*;
+ CFrameworkunified_CWORD77_Session::*;
+ CNSConfig*::*;
+ CFrameworkunifiedCompositeState::*;
+ CFrameworkunifiedOrthogonalState::*;
+ CFrameworkunifiedConditionConnector::*;
+ CFrameworkunifiedExternalTransition::*;
+ frameworkunified::framework::CFrameworkunifiedThreadPriorities::*;
+ CMutex::*;
+ CFrameworkunifiedHSM::*;
+ CRWLock::*;
+ NSTimer::*;
+ NsForceClose;
+ CFrameworkunifiedGuard::*;
+ CFrameworkunifiedState::*;
+ CFrameworkunifiedLocalTransition::*;
+ CFrameworkunifiedShallowHistoryState::*;
+ CFrameworkunifiedHistoryState::*;
+ CFrameworkunifiedDeepHistoryState::*;
+ CFrameworkunifiedHSMParentFramework::*;
+ CFrameworkunifiedSyncData::*;
+ IConfigWriter::*;
+ IConfigReader::*;
+ };
+ GetFileList;
+ MSToNS;
+ DoesDirecotryExist;
+ CreateDirectory;
+ Mc*;
+ NP*;
+ NSLog*;
+ NsLogIsPLogEnabled;
+ NsLogData;
+ NsLogTime;
+ NsLog0;
+ NsLog;
+ NsLogSetFrameworkunifiedLogParams;
+ NsLogSetProcessName;
+ NsLogSetControlMask;
+ NsLogIsZoneSet;
+ NsLogGetControlMask;
+ NsLogSetLogMethod;
+ NsLog_EvtCnt;
+ NsLog_Evt;
+ NsLog_Cnt;
+ NsLogDetermineLogMethod;
+ NsLogSetZones;
+ NsLogParseZones;
+ NsRcsSendTraceData;
+ NSLogGetFrameworkunifiedlogFileTotalNum;
+ NSLogGetFrameworkunifiedlogFileName;
+ NsLogGetLogMethod;
+ NsLogSetFrameworkunifiedLogFlag;
+ NsLogGetFrameworkunifiedLogFlag;
+ NsLogSetRealtimeLog;
+ NsLogGetRealtimeLog;
+ NsLogInitialize;
+ NS_Timer*;
+ OpenReceiver;
+ OpenReceiverNotBlocked;
+ CloseSender;
+ CloseReceiver;
+ OpenSender;
+ ReceiveMessage;
+ RemainderMs;
+ SendMessage;
+ SynchronousWritePersistentData;
+ SynchronousMovePersistentData;
+ WholeSeconds;
+ _init;
+ _fini;
+ GetLengthOfDataFromShared;
+
+ ### .data section ###
+ extern "C++" {
+ typeinfo?for?CFrameworkunifiedAction;
+ typeinfo?for?CFrameworkunifiedVersion;
+ typeinfo?for?CNSSharedMem;
+ typeinfo?for?CNSSharedMemReader;
+ typeinfo?for?CNSRingBuffer;
+ typeinfo?for?CFrameworkunifiedLeafState;
+ typeinfo?for?CFrameworkunified_CWORD77_Service;
+ typeinfo?for?CFrameworkunified_CWORD77_Session;
+ typeinfo?for?CNSConfig*;
+ typeinfo?for?CFrameworkunifiedCompositeState;
+ typeinfo?for?CFrameworkunifiedOrthogonalState;
+ typeinfo?for?CFrameworkunifiedConditionConnector;
+ typeinfo?for?CFrameworkunifiedExternalTransition;
+ typeinfo?for?frameworkunified::framework::CFrameworkunifiedThreadPriorities;
+ typeinfo?for?CMutex;
+ typeinfo?for?CFrameworkunifiedHSM;
+ typeinfo?for?CRWLock;
+ typeinfo?for?NSTimer;
+ typeinfo?for?CFrameworkunifiedGuard;
+ typeinfo?for?CFrameworkunifiedState;
+ typeinfo?for?CFrameworkunifiedLocalTransition;
+ typeinfo?for?CFrameworkunifiedShallowHistoryState;
+ typeinfo?for?CFrameworkunifiedHistoryState;
+ typeinfo?for?CFrameworkunifiedDeepHistoryState;
+ typeinfo?for?CFrameworkunifiedHSMParentFramework;
+ typeinfo?for?CFrameworkunifiedSyncData;
+ typeinfo?for?IConfigWriter;
+ typeinfo?for?IConfigReader;
+ };
+ local:
+ *;
+};
+
diff --git a/video_in_hal/nsframework/log_library/LICENSE b/video_in_hal/nsframework/log_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/nsframework/log_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/nsframework/log_library/Makefile.client b/video_in_hal/nsframework/log_library/Makefile.client
new file mode 100755
index 0000000..fb995b3
--- /dev/null
+++ b/video_in_hal/nsframework/log_library/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS = client
+
+include ../native_service.mk
diff --git a/video_in_hal/nsframework/log_library/client/Makefile b/video_in_hal/nsframework/log_library/client/Makefile
new file mode 100755
index 0000000..2427927
--- /dev/null
+++ b/video_in_hal/nsframework/log_library/client/Makefile
@@ -0,0 +1,32 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### libraries to be installed(*.a) #############
+INST_SHLIBS = liblog
+######### headers to be installed(*.h) #############
+INST_HEADERS := loglibrarylog_library.h loglibrarylog_if.h
+
+######### sources to be compiled #############
+liblog_SRCS := loglibrarylog.c
+
+######### search paths #############
+VPATH = ./src ./include/$(COMPONENT_NAME)
+
+######### include paths #############
+CFLAGS += -I./include
+LDFLAGS += -Wl,--no-as-needed
+
+include ../../native_service.mk
diff --git a/video_in_hal/nsframework/log_library/client/include/loglibrarylog_internal.h b/video_in_hal/nsframework/log_library/client/include/loglibrarylog_internal.h
new file mode 100755
index 0000000..af6e7cf
--- /dev/null
+++ b/video_in_hal/nsframework/log_library/client/include/loglibrarylog_internal.h
@@ -0,0 +1,26 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@{
+
+#ifndef LOG_LIBRARY_CLIENT_INCLUDE_LOGLIBRARYLOG_INTERNAL_H_
+#define LOG_LIBRARY_CLIENT_INCLUDE_LOGLIBRARYLOG_INTERNAL_H_
+
+// Prototype
+int LOGLIBRARYLOG_Freeze(void);
+
+#endif // LOG_LIBRARY_CLIENT_INCLUDE_LOGLIBRARYLOG_INTERNAL_H_
+//@}
diff --git a/video_in_hal/nsframework/log_library/client/include/native_service/loglibrarylog_if.h b/video_in_hal/nsframework/log_library/client/include/native_service/loglibrarylog_if.h
new file mode 100755
index 0000000..5bf90c3
--- /dev/null
+++ b/video_in_hal/nsframework/log_library/client/include/native_service/loglibrarylog_if.h
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english This file contains defines and LOGLIBRARYLOG_Freeze API for free frameworkunifiedlog.
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup log_library
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef __LOGLIBRARYLOG_IF_H__ // NOLINT (readability/nolint)
+#define __LOGLIBRARYLOG_IF_H__
+
+#define FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME "loglibrarylogconfig.cfg"
+#define FRAMEWORKUNIFIEDLOG_RAMDISC_NAME "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/frameworkunified_debug.log"
+#define FRAMEWORKUNIFIEDLOG_RAMDISC_PATH "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog"
+
+// Out put mode
+#define FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG 1 // Debug
+#define FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE 0 // :Release
+
+// RealtimeLog mode
+#define LOGLIBRARYLOG_REALTIMELOG_DISABLE_MASK 0x80
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE 0xFF // : FREEZE
+
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF 0 // :ALL OFF
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART 1 // :UARTOUT
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB 2 // :USB OUT
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE \
+ (FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB | LOGLIBRARYLOG_REALTIMELOG_DISABLE_MASK)
+#define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_MAX 3 // :MAX NUM
+
+//////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup LOGLIBRARYLOG_Freeze
+/// \~english @par Brief
+/// Freeze Loglibrarylog API.
+/// \~english @retval 0: success
+/// \~english @retval -1: error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// This API is provide to freeze Loglibrarylog.
+/// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+int LOGLIBRARYLOG_Freeze(void);
+
+#endif // __LOGLIBRARYLOG_IF_H__ // NOLINT (readability/nolint)
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/log_library/client/include/native_service/loglibrarylog_library.h b/video_in_hal/nsframework/log_library/client/include/native_service/loglibrarylog_library.h
new file mode 100755
index 0000000..60edd01
--- /dev/null
+++ b/video_in_hal/nsframework/log_library/client/include/native_service/loglibrarylog_library.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english include all log_library head files
+ *
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup log_library
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef NATIVESERVICE_LOGLIBRARY_H_ // NOLINT(build/header_guard)
+#define NATIVESERVICE_LOGLIBRARY_H_
+
+#include <native_service/loglibrarylog_if.h>
+
+#endif // NATIVESERVICE_LOGLIBRARY_H_
+/** @}*/
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/nsframework/log_library/client/src/loglibrarylog.c b/video_in_hal/nsframework/log_library/client/src/loglibrarylog.c
new file mode 100755
index 0000000..7aa7c2b
--- /dev/null
+++ b/video_in_hal/nsframework/log_library/client/src/loglibrarylog.c
@@ -0,0 +1,60 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <native_service/loglibrarylog_if.h>
+#include "loglibrarylog_internal.h"
+
+int
+LOGLIBRARYLOG_Freeze(void) {
+ int fd;
+ int *pmap;
+ int ret;
+
+ fd = shm_open(FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, O_RDWR | O_CREAT, S_IRWXU | S_IRWXO);
+ if (fd == -1) {
+ fprintf(stderr, "[%s:L%d]shm_open(%s) error(%d)\n", __FUNCTION__, __LINE__,
+ FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, errno);
+ return -1;
+ }
+
+ ret = ftruncate(fd, sizeof(int));
+ if (ret == 0) {
+ fprintf(stderr, "[%s:L%d]ftruncate() error(%d)\n", __FUNCTION__, __LINE__, ret);
+ close(fd);
+ return -1;
+ }
+
+ pmap = mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ close(fd);
+ if (pmap == MAP_FAILED) {
+ fprintf(stderr, "[%s:L%d]mmap() error(%d)\n", __FUNCTION__, __LINE__, errno);
+ return -1;
+ }
+ *pmap = FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE;
+
+ if (munmap(pmap, sizeof(int)) != 0) {
+ fprintf(stderr, "[%s:L%d]munmap() error(%d)\n", __FUNCTION__, __LINE__, errno);
+ }
+
+ return 0;
+}
diff --git a/video_in_hal/nsframework/native_service.mk b/video_in_hal/nsframework/native_service.mk
new file mode 100755
index 0000000..729362c
--- /dev/null
+++ b/video_in_hal/nsframework/native_service.mk
@@ -0,0 +1,44 @@
+#############################################################
+#
+# Common Makefile for native_service
+# Copyright (C) 2017-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := native_service
+
+#############################################################
+
+
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/video_in_hal/nsframework/notification_persistent_service/LICENSE b/video_in_hal/nsframework/notification_persistent_service/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/nsframework/notification_persistent_service/Makefile.server b/video_in_hal/nsframework/notification_persistent_service/Makefile.server
new file mode 100755
index 0000000..1347519
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/Makefile.server
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := server
+
+include ../native_service.mk
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/Makefile b/video_in_hal/nsframework/notification_persistent_service/server/Makefile
new file mode 100755
index 0000000..b5b80cb
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/Makefile
@@ -0,0 +1,87 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = NS_NPPService
+
+######### add source path #############
+VPATH += ./src
+VPATH += ./include/$(COMPONENT_NAME)
+
+######### installed library(*.a) #############
+#INST_LIBS =
+
+######### installed shared library(*.so) #############
+#INST_SHLIBS =
+
+######### install headers(*.h) #############
+INST_HEADERS = notification_persistent_service.h
+
+######### compiled sources #############
+NS_NPPService_SRCS = app_states.cpp \
+ ns_npp.cpp \
+ ns_npp_archive.cpp \
+ ns_npp_binary_accesser.cpp \
+ ns_npp_copy_worker.cpp \
+ ns_npp_fs_directory.cpp \
+ ns_npp_handlelist.cpp \
+ ns_npp_nor_persistence_worker_thread.cpp \
+ ns_npp_notification.cpp \
+ ns_npp_notification_manager.cpp \
+ ns_npp_notification_receiver.cpp \
+ ns_npp_persist_file.cpp \
+ ns_npp_persist_folder.cpp \
+ ns_npp_persistence.cpp \
+ ns_npp_persistence_manager.cpp \
+ ns_npp_persistent_data.cpp \
+ ns_npp_personalization_manager.cpp \
+ ns_npp_registry_entry.cpp \
+ ns_npp_regular_notification.cpp \
+ ns_npp_state_nor_persistence_notification.cpp \
+ ns_npp_state_notification.cpp \
+ ns_npp_state_persistence_notification.cpp \
+ ns_npp_state_persistence_user_notification.cpp \
+ notificationpersistentservice_application.cpp \
+ notificationpersistentservice_main.cpp
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+######### add compile option #############
+ENABLE_PARA_INST += install-prog # PARALLEL MAKE
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+######### linked library #############
+
+######### linked library (dynamic) #############
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -ltar
+LDLIBS += -Wl,-Bdynamic -lz
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy #-lPosixBasedOS001ClockCycleApi -lPosixBasedOS001MsgApi -lPosixBasedOS001GetPrioApi -lPosixBasedOS001TimeApi -lPosixBasedOS001SlogApi
+
+LINK_CXX=Y
+
+######### add library path #############
+
+include ../../native_service.mk
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/app_states.h b/video_in_hal/nsframework/notification_persistent_service/server/include/app_states.h
new file mode 100755
index 0000000..a7f4b4a
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/app_states.h
@@ -0,0 +1,187 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file all the states, events, internal transitions of state machine.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_APP_STATES_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_APP_STATES_H_
+
+#include <native_service/frameworkunified_sm_framework_if.h>
+#include <native_service/ns_np_service.h>
+#include <string>
+
+const UI_32 kCuiEventIdStartLimit = 20;
+
+DEFINE_COMPOSITESTATE(sNotificationpersistentserviceNPPRoot) // NOLINT (readability/naming)
+DEFINE_ORTHOGONALSTATE_OVERRIDE(sNotificationpersistentserviceNPPStart)
+DEFINE_LEAFSTATE(sNotificationpersistentserviceNPPError)
+
+// =====Define Persistence state
+DEFINE_LEAFSTATE_OVERRIDE(sNotificationpersistentservicePersistenceReady)
+DEFINE_LEAFSTATE(sNotificationpersistentservicePersistenceError)
+
+// DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReadPersistedData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReleaseFileAck)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnSaveDataAck)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPNorDataSaveAck)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFile)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFile)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFile)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFolder)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFolder)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFolder)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFilePersistentType)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFolderPersistentType)
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnUserChange)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceCheckAllReleaseRequestsProcessed)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPersistentSync)
+
+// =====Define Shutdown state
+DEFINE_LEAFSTATE(sNotificationpersistentserviceShutdownIdle)
+// DEFINE_LEAFSTATE_OVERRIDE(sNotificationpersistentserviceShutdownDataSave)
+class CsNotificationpersistentserviceShutdownDataSave : public CFrameworkunifiedLeafState {
+ public:
+ explicit CsNotificationpersistentserviceShutdownDataSave(std::string f_pName);
+ virtual ~CsNotificationpersistentserviceShutdownDataSave();
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_peventdata);
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_peventdata);
+ private:
+ std::string m_cShutdownRequestor;
+};
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPShutdown) // NOLINT (readability/naming)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnShutdownTimeout)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceReInitShutdownTimer)
+
+// =====Define Notification state
+DEFINE_LEAFSTATE(sNotificationpersistentserviceNotificationReady)
+DEFINE_LEAFSTATE(sNotificationpersistentserviceNotificationError)
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishNotification)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotification)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnRegisterNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotification)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterImmediateNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPGetReadyStatus)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPClearPersistedData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetDefaultPersistentData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetNotfnPersistentType)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishImmediateNotification)
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfileNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfilePersistence)
+
+#endif
+
+// ==========Define event
+DEFINE_EVENT(evIdle, kCuiEventIdStartLimit + 1)
+DEFINE_EVENT(evReady, kCuiEventIdStartLimit + 2)
+DEFINE_EVENT(evShutdown, kCuiEventIdStartLimit + 3)
+DEFINE_EVENT(evError, kCuiEventIdStartLimit + 4)
+
+DEFINE_EVENT(evNPSetNotfnPersistentType, kCuiEventIdStartLimit + 5)
+DEFINE_EVENT(evNPSetDefaultPersistentData, kCuiEventIdStartLimit + 6)
+DEFINE_EVENT(evNPReadPersistedData, kCuiEventIdStartLimit + 7)
+DEFINE_EVENT(evNPReleaseLoadAck, kCuiEventIdStartLimit + 8)
+DEFINE_EVENT(evNPNorShutdownAck, kCuiEventIdStartLimit + 9)
+DEFINE_EVENT(evNPRegisterPersistentFile, kCuiEventIdStartLimit + 10)
+DEFINE_EVENT(evNPReleasePersistentFile, kCuiEventIdStartLimit + 11)
+DEFINE_EVENT(evNPLoadPersistentFile, kCuiEventIdStartLimit + 12)
+DEFINE_EVENT(evNPSetFilePersistentType, kCuiEventIdStartLimit + 13)
+DEFINE_EVENT(evNPSetFolderPersistentType, kCuiEventIdStartLimit + 14)
+DEFINE_EVENT(evUserChange, kCuiEventIdStartLimit + 15)
+DEFINE_EVENT(evShutdownTimeout, kCuiEventIdStartLimit + 16)
+
+DEFINE_EVENT(evNPPublishNotification, kCuiEventIdStartLimit + 17)
+DEFINE_EVENT(evNPRegisterNotifications, kCuiEventIdStartLimit + 18)
+DEFINE_EVENT(evNPSubscribeToNotification, kCuiEventIdStartLimit + 19)
+DEFINE_EVENT(evNPSubscribeToNotifications, kCuiEventIdStartLimit + 20)
+DEFINE_EVENT(evNPUnRegisterNotifications, kCuiEventIdStartLimit + 21)
+DEFINE_EVENT(evNPUnSubscribeFromNotification, kCuiEventIdStartLimit + 22)
+DEFINE_EVENT(evNPRegisterPersistentFolder, kCuiEventIdStartLimit + 23)
+DEFINE_EVENT(evNPLoadPersistentFolder, kCuiEventIdStartLimit + 24)
+DEFINE_EVENT(evNPReleasePersistentFolder, kCuiEventIdStartLimit + 25)
+DEFINE_EVENT(evNPUnSubscribeFromNotifications, kCuiEventIdStartLimit + 26)
+DEFINE_EVENT(evCheckAllFilesPersisted, kCuiEventIdStartLimit + 27)
+DEFINE_EVENT(evNPGetReadyStatus, kCuiEventIdStartLimit + 28)
+DEFINE_EVENT(evNPRegisterImmediateNotifications, kCuiEventIdStartLimit + 29)
+DEFINE_EVENT(evNPClearPersistedData, kCuiEventIdStartLimit + 30)
+
+DEFINE_EVENT(evNPShutdownDataSave, kCuiEventIdStartLimit + 31)
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+DEFINE_EVENT(evNPProfileNotification, kCuiEventIdStartLimit + 32)
+DEFINE_EVENT(evNPProfilePersistence, kCuiEventIdStartLimit + 33)
+
+#endif
+
+DEFINE_EVENT(evNPPublishImmediateNotification, kCuiEventIdStartLimit + 34)
+DEFINE_EVENT(evNPPersistentSync, kCuiEventIdStartLimit + 35)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersonality
+/// Set the personality in the framework on userchange.
+///
+/// \param [IN] f_happ
+/// HANDLE - Application Handle
+///
+/// \param [IN] f_tMsg
+/// NC_User - Structure containing user specific details
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetPersonality(HANDLE f_happ, NC_User &f_tMsg); // NOLINT (runtime/references)
+
+
+/*
+ * CShutDownMsgData
+ * This class is used to pass the data between states sShutdownIdle and sShutdownDataSave
+ */
+class CShutDownMsgData : public CEventData {
+ public:
+ // constructor
+ CShutDownMsgData(UI_32 f_uieventid, EFrameworkunifiedShutdownType f_etype, UI_32 f_uidata): CEventData(f_uieventid),
+ m_eShutdownType(f_etype), m_uiMsgData(f_uidata) {} // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ // destructor
+ virtual ~CShutDownMsgData() {}
+
+ EFrameworkunifiedShutdownType m_eShutdownType;
+
+ UI_32 m_uiMsgData;
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_APP_STATES_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h b/video_in_hal/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h
new file mode 100755
index 0000000..a7c9f8e
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file notification_persistent_service.h
+ * @brief \~english include all notification_persistent_service head files
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef NATIVESERVICE_NOTIFICATIONPERSISTENTSERVICE_H_ // NOLINT(build/header_guard)
+#define NATIVESERVICE_NOTIFICATIONPERSISTENTSERVICE_H_
+
+#endif // NATIVESERVICE_NOTIFICATIONPERSISTENTSERVICE_H_
+
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp.h
new file mode 100755
index 0000000..f96dd75
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp.h
@@ -0,0 +1,296 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_H_
+
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+
+class CPersistenceManager;
+class CNotificationManager;
+class CnotificationpersistentservicePersonalizationManager;
+
+/**
+ * This class act as a controller class which holds the instance of notification, personalization
+ * and persistence manager respectively.
+ */
+class CNSNPP: public CFrameworkunifiedHSM {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSNPP
+ /// Constructor of CNSNPP class
+ ///
+ /// \param f_happ
+ /// PVOID - application handle
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CNSNPP(PVOID f_happ);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNSNPP
+ /// Destructor of CNSNPP class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSNPP();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// Init
+ /// This function is used to allocate dynamic memory for member variables of this class after
+ /// creation of object.
+ ///
+ /// \param f_happ
+ /// HANDLE - Application handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Init(HANDLE f_happ);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// DeInit
+ /// This function is used to deinitialize the NPP object.
+ ///
+ /// \param f_happ
+ /// HANDLE - Application handle
+ ///
+ /// \return VOID
+ /// VOID - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID DeInit(HANDLE f_happ);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedCreate
+ /// This function is pure virtual function of parent class.
+ /// In this function, states and events of StateMachine are created and connected.
+ ///
+ /// \param [in] f_peventdata
+ /// PVOID - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_peventdata = NULL);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentservicePersistAll
+ /// Persist all persistent state, user persistent state notification data;
+ /// and all global and user related files to permenant storage
+ ///
+ /// \param [in] f_eshutdowntype
+ /// EFrameworkunifiedShutdownType - shutdown type i.e. normal shutdown, quick, data reset
+ ///
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentservicePersistAll(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSaveNotificationPersistentData
+ /// In this function, all the data related to persistent notification is retrieved from
+ /// notification manager and stored in persistent file by persistent manager.
+ ///
+ /// \param [in] f_epersistenttype
+ /// EFrameworkunifiedPersistentVarType - Type of persistent notification
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSaveNotificationPersistentData(EFrameworkunifiedNotificationType f_epersistenttype,
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag = 0x0);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceLoadPersistentNotificationData
+ /// In this transition, persistent file is loaded by persistent manager and
+ /// persistent notifications and its data is loaded to notification manager.
+ ///
+ /// \param [in] f_epersistenttype
+ /// EFrameworkunifiedPersistentVarType - Type of persistent notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceLoadPersistentNotificationData(EFrameworkunifiedNotificationType f_epersistenttype);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// DeletePersistedDataFolder
+ /// This function does not deletes the data instead just rename the folder which needs to
+ /// be deleted. And this data will gets deleted during next startup.
+ ///
+ /// \param f_uipersistcategoryflag
+ /// UI_32 - Rename the persisted data folder depending on enum EFrameworkunifiedPersistCategory value
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DeletePersistedDataFolder(UI_32 f_uipersistcategoryflag);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// Syncfs
+ /// Syncfs is carried out.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Syncfs();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Singleton instance of NotificationManager
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationManager *m_pNotificationManager; ///< Instance of Notification Manager
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Singleton instance of PersonalizationManager
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CnotificationpersistentservicePersonalizationManager *m_pPersonalizationManager; ///< Instance of Personalization Manager
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Singleton instance of PersistenceManager
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistenceManager *m_pPersistenceManager;
+ // scheduling priority of read thread
+ static SI_32 m_siReadThreadPrio; // NOLINT (readability/naming)
+ // scheduling priority of write thread
+ static SI_32 m_siWriteThreadPrio; // NOLINT (readability/naming)
+ // scheduling priority of immediate persistence thread
+ static SI_32 m_siImmediatePersistenceThreadPrio; // NOLINT (readability/naming)
+ // number of times CRC check is required. (CRC check will be done more than once only on failure)
+ static UI_16
+ m_siCRCCheckCount; // NOLINT (readability/naming)
+
+ private:
+ ///< name of reader thread
+ const std::string m_cReadThreadName; // NOLINT (readability/naming)
+ ///< name of writer thread
+ const std::string m_cWriteThreadName; // NOLINT (readability/naming)
+ ///< name of immediate persistence thread
+ const std::string m_cImmediatePersistenceThreadName; // NOLINT (readability/naming)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateAndStartChildThreads
+ /// This function creates and start all child threads.
+ ///
+ /// \param f_happ
+ /// HANDLE - Application handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateAndStartChildThreads(HANDLE f_happ);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SwitchToFileStructureVersion1
+ /// Copy all the data from old persistent path to new persistent path
+ ///
+ /// \param [IN] f_uinppversion
+ /// UI_32 - New version of NPPService
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SwitchToFileStructureVersion1(const UI_32 f_uinppversion);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SwitchToFileStructureVersion2
+ /// Move immediate notification data files from IMMEDIATE_PERSISTENCE_STORAGE_V1 to
+ /// IMMEDIATE_PERSISTENCE_STORAGE_V2/AllUserAppData/UserData
+ ///
+ /// \param [IN] f_uinppversion
+ /// UI_32 - New version of NPPService
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SwitchToFileStructureVersion2(const UI_32 f_uinppversion);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNSNPPVersion
+ /// Get the version of NSNPP from version.txt
+ ///
+ /// \param
+ ///
+ /// \return UI_8
+ /// UI_8 - version number
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetNSNPPVersion();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SetNSNPPVersion
+ /// Set the version of NSNPP in version.txt
+ ///
+ /// \param [IN] f_uiversion
+ /// UI_32 - version number
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetNSNPPVersion(UI_8 f_uiversion);
+
+ HANDLE m_hNSReadThread; ///< Reader thread handle
+
+ HANDLE m_hNSWriteThread; ///< Writer thread handle
+
+ HANDLE m_hNSImmediatePersistenceThread; ///< immediate persistence thread handle
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h
new file mode 100755
index 0000000..aed4d2a
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h
@@ -0,0 +1,230 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CBinaryAccesser class.
+/// This class stores data in a file in binary format.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_BINARY_ACCESSER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_BINARY_ACCESSER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <vector>
+#include "ns_npp_persistent_accesser.h"
+
+class CPersistentAccesser;
+class CPersistentData;
+class CNotificationsToPersist;
+class CPersistDataHeader;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// vector of all available persistent notification and its data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+typedef Persistent_Notification_List_Type::iterator Persistent_Notification_List_Iterator;
+
+/**
+ * This class stores data in a file in binary format.
+ *
+ */
+class CBinaryAccesser: public CPersistentAccesser {
+ public:
+ typedef enum FileOpentype {
+ EREAD = 0,
+ EWRITE
+ } FILE_OPEN_TYPE;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CBinaryAccesser
+ /// Constructor of CBinaryAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CBinaryAccesser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CBinaryAccesser
+ /// Destructor of CBinaryAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CBinaryAccesser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistData
+ /// Persist data in persistent memory in a file in binary format.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Memory file path for saving notification.
+ ///
+ /// \param [IN] f_vdata
+ /// Persistent_Notification_List_Type* - Data which has to be persisted.
+ ///
+ /// \param [IN] f_epersistenttype
+ /// EFrameworkunifiedNotificationType - Type of Notification.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PersistData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *f_vdata,
+ EFrameworkunifiedNotificationType f_epersistenttype,
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RetrieveData
+ /// Retrieve data from from a file from persistent memory and store in a vector.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Memory file path from where to retrieve notification data.
+ ///
+ /// \param [OUT] f_vdata
+ /// Persistent_Notification_List_Type*& - Retrieved notification data is filled in this vector.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RetrieveData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *&f_vdata, // NOLINT (runtime/references)
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ private:
+ UI_32 m_uiCurStrOffset;
+ UI_32 m_uiCurStrSize;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OpenFileForReading
+ /// Open file in read mode.
+ ///
+ /// \param [OUT] f_Fd
+ /// int * - File descriptor to read from a file
+ ///
+ /// \param [IN] f_cfilepath
+ /// std::string - File Path from the file is to be read
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenFileForReading(int *f_infd,
+ std::string f_cfilepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OpenFileForWriting
+ /// Open file in write mode.
+ ///
+ /// \param [OUT] f_Fd
+ /// int * - File descriptor to write to a file
+ ///
+ /// \param [IN] f_cfilepath
+ /// std::string - File Path for the file that is to be written
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenFileForWriting(int *f_outfd,
+ std::string f_cfilepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// WriteHeaderAndData
+ /// Write header and data in a file.
+ ///
+ /// \param [IN] f_pnotificationstopersist
+ /// CNotificationsToPersist - Object of class CNotificationsToPersist
+ ///
+ /// \param [IN] f_pdata
+ /// PVOID - notification data
+ ///
+ /// \param [IN] f_Fd
+ /// int - File descriptor to write the file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus WriteHeaderAndData(CNotificationsToPersist *f_pnotificationstopersist,
+ PVOID f_pdata,
+ int f_outfd);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ReadHeaderAndData
+ /// Read header from the file.
+ ///
+ /// \param [IN] f_objcpersistdataheader
+ /// CPersistDataHeader& - Object of class CPersistDataHeader
+ ///
+ /// \param [OUT] f_pdata
+ /// CHAR*& -
+ ///
+ /// \param [IN] f_Fd
+ /// int - File descriptor to read the file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ReadHeaderAndData(CPersistDataHeader &f_objcpersistdataheader, // NOLINT (runtime/references)
+ CHAR *&f_pdata, int f_infd); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FillNotificationList
+ /// This function retrieves the notification data from file and fill it in map.
+ ///
+ /// \param [IN] f_Fd
+ /// int - File descriptor to retrieve notification data.
+ ///
+ /// \param [OUT] f_vdata
+ /// Persistent_Notification_List_Type*& - Retrieved notification data is filled in this vector.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FillNotificationList(int f_infd,
+ Persistent_Notification_List_Type *&f_vdata, // NOLINT (runtime/references)
+ EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ EFrameworkunifiedStatus WriteFileHeaderAndDuplicate(int f_outfd, std::string f_cfilepath);
+ EFrameworkunifiedStatus CheckFileHeader(int f_infd);
+ EFrameworkunifiedStatus OpenBakFileForReading(int *f_infd, std::string f_cfilepath);
+ UI_32 CalcCRC(PVOID f_pdata, UI_32 f_size);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_BINARY_ACCESSER_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h
new file mode 100755
index 0000000..984296f
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h
@@ -0,0 +1,558 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CCopyWorker and CArchive.
+/// Class CCopyWorker holds the implementation for worker thread.
+/// Class CArchive holds the implementation for archive.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_COPY_WORKER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_COPY_WORKER_H_
+
+#define LIBTARFAIL -1
+#define LIBTARSUCCESS 0
+#define TARMODE 0644
+#define FILEERROR -1
+
+#include <pthread.h>
+#include <libtar.h>
+#include <stdio.h>
+#include <zlib.h>
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_utility_sys.hpp>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/ns_np_service.h>
+
+#include <map>
+#include <string>
+
+#include "ns_npp_types.h"
+
+typedef std::map<std::string, UI_32> TMTagCRC; // map of tag and corresponding CRC
+typedef std::map<std::string, TMTagCRC> TMServiceTagCRC; // map of service and tag list
+typedef std::map<int, gzFile> GZFiles;
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPCopyWorkerOnStart
+/// Callback method on start of worker thread.
+///
+/// \param [IN] f_hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPCopyWorkerOnStart(HANDLE f_hthread);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPCopyWorkerOnStop
+/// Callback method on stopping of worker thread.
+///
+/// \param [IN] f_hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPCopyWorkerOnStop(HANDLE f_hthread);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// gzopen_frontend
+/// Method to set archiving options.
+///
+/// \param [IN] f_pcpathname
+/// PCHAR - Thread Handle
+///
+/// \param [IN] f_sioflags
+/// SI_32 - Open file flags
+///
+/// \param [IN] f_simode
+/// SI_32 - File Mode
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 OpenArchive(PCHAR f_pcpathname, SI_32 f_sioflags, SI_32 f_simode);
+
+int CloseArchive(int fd);
+ssize_t ReadArchive(int fd, void *buf, size_t count);
+ssize_t WriteArchive(int fd, const void *buf, size_t count);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPServiceOnDeleteOldDataCmd
+/// This callback is used to delete the data which was requested to be deleted during
+/// previous shutdown.
+///
+/// \param [in] f_happ
+/// HANDLE - Handle to notificationpersistentservice_application Framework.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPServiceOnDeleteOldDataCmd(HANDLE f_happ);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPDataResetThreadCallback
+/// Callback of data reset thread.
+/// This callback delete all the data which was requested for reset during previous shutdown.
+///
+/// \param [in] f_parg
+/// PVOID - Thread argument
+///
+/// \return PVOID
+/// PVOID - NULL
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID NSPDataResetThreadCallback(PVOID f_parg);
+
+class CCopyWorker {
+ public:
+ static TMServiceTagCRC g_mservicetagcrc;
+ static CMutex g_objmtxservicetag;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCopyWorker
+ /// Constructor of class CCopyWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CCopyWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CCopyWorker
+ /// Destructor of class CCopyWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CCopyWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdCopy
+ /// Callback method for start copy command.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdCopy(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdResume
+ /// Callback method for resuming worker thread.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdResume(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdStart
+ /// Callback method for starting worker thread.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdStart(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdArchive
+ /// Callback method to start archiving/unarchiving for file or folder
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdArchive(HANDLE f_hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdStop
+ /// Callback method for stopping worker thread.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdStop(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnCmdShutdownRequest
+ /// Callback method on shutdown request.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnCmdShutdownRequest(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Abort
+ /// Method to abort worker thread tasks.
+ ///
+ ///
+ /// \return VOID
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ static VOID Abort();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetCopyStatusToFailure
+ /// Method to set the copy status to failure.
+ ///
+ /// \param [IN] f_tcopystatusresponse
+ /// NSP_CopyStatusResponse - Response status struct
+ ///
+ /// \param [IN] f_eworkerfailcmd
+ /// ENPS_CopyWorkerFailures - Worker failure Commands
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetCopyStatusToFailure(NSP_CopyStatusResponse &f_tcopystatusresponse, // NOLINT (runtime/references)
+ const ENPS_CopyWorkerFailures f_eworkerfailcmd);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// InAbortState
+ /// Method to check if the thread is in abort state
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return BOOL
+ // BOOL - true if in abort state or false.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL InAbortState() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SendAck
+ /// Method to send ack to the parent thread
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \param [IN] f_eworkercmd
+ /// ENSP_CopyWorkerProtocol - Worker protocol command
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SendAck(HANDLE hthread, const ENSP_CopyWorkerProtocol &f_eworkercmd);
+
+ private:
+ static pthread_mutex_t m_sAbortMutex; // NOLINT (readability/naming) , Mutex for abort
+ static BOOL m_sbAbortCopy; // NOLINT (readability/naming) , Check for abort state
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CopyFile
+ /// Copy the content of source file f_csrcpath to destination file f_cdestpath.
+ /// Creates the destination file path if does not exists.
+ ///
+ /// \param [IN] f_csrcpath
+ /// PCSTR - source file path
+ ///
+ /// \param [IN] f_cdestpath
+ /// PCSTR - dest file path
+ ///
+ /// \param [OUT] f_uiwritesize
+ /// UI_32 - number of bytes written to the destination file
+ ///
+ /// \param [IN] f_btmpfile
+ /// BOOL - TRUE:RELEASE-temp file use /FALSE:LOAD-temp file not use
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK on success else eFrameworkunifiedStatusFail
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CopyFile(PCSTR f_csrcpath, PCSTR f_cdestpath, UI_32 &f_uiwritesize, BOOL btmpfile = FALSE); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetCopyBufSize
+ /// Get the buffer size appropriate for file copy
+ ///
+ /// \param [IN] f_si32openfd
+ /// SI_32 - File descriptor of a file opened with open() api
+ ///
+ /// \param [OUT] f_ui32filesize
+ /// UI_32 - Get the size of file
+ ///
+ /// \return SI_32
+ /// SI_32 - Returns the buffer size appropriate for file copy
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetCopyBufSize(SI_32 f_si32openfd, UI_32 &f_ui32filesize); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// VerifyWithStoredCRC
+ /// Verify CRC stored internally for the tag matches with the CRC of a file (file passed as a argument)
+ ///
+ /// \param [IN] f_crequesterappname
+ /// PCSTR - Name of the requester. This is to find the corresponding stored CRC
+ ///
+ /// \param [IN] f_cpersistenttag
+ /// PCSTR - Tag. This is to find the corresponding stored CRC
+ ///
+ /// \param [IN] f_cFile
+ /// PCSTR - Complete file path on temporary storage.
+ /// Comparison of CRC needs to be done with this temporary file.
+ ///
+ /// \return BOOL
+ /// BOOL - Returns TRUE if f_cFile's CRC matches with CRC stored internally for the corresponding tag
+ /// else FALSE
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL VerifyWithStoredCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, PCSTR f_cFile, UI_32 &f_ui32crc); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateTagCRC
+ /// Update the passed CRC in the internal map for the corresponding requester and tag.
+ ///
+ /// \param [IN] f_crequesterappname
+ /// PCSTR - Name of the requester.
+ ///
+ /// \param [IN] f_cpersistenttag
+ /// PCSTR - File Tag.
+ ///
+ /// \param [IN] f_ui32crc
+ /// UI_32 - New CRC.
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID UpdateTagCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, UI_32 f_ui32crc);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// TryFileCopyWithCRCCheck
+ /// Try to copy file from source to destination until src and dest CRC matches or max f_ui32checkcount
+ /// number of times
+ ///
+ /// \param [IN] f_csource
+ /// PCSTR - Source file
+ ///
+ /// \param [IN] f_cdest
+ /// PCSTR - Destination file
+ ///
+ /// \param [IN] f_ui32checkcount
+ /// UI_32 - Maximum number of times to perform file copy
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK - If file copy done successfully and CRC matches.
+ /// eFrameworkunifiedStatusFail - otherwise
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus TryFileCopyWithCRCCheck(PCSTR f_csource, PCSTR f_cdest, UI_32 f_ui32checkcount);
+
+ class CArchive {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CArchive
+ /// Constructor of CArchive class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CArchive();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CArchive
+ /// Destructor of CArchive class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CArchive();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Archive
+ /// Method for performing folder archive or extraction operation.
+ ///
+ /// \param [IN] f_tarchiveinfocmd
+ /// NSP_CopyInfoCmd - Archive Command Info Structure
+ ///
+ /// \param [IN] f_tarchivestatusresponse
+ /// NSP_CopyStatusResponse - Archive Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Archive(NSP_CopyInfoCmd &f_tarchiveinfocmd, NSP_CopyStatusResponse &f_tarchivestatusresponse); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FileOperationUsingLibz
+ /// Method to determine whether to compress or decompres file using libz.
+ ///
+ /// \param [IN] f_toperainfocmd
+ /// NSP_CopyInfoCmd - File Operation Command Info Structure
+ ///
+ /// \param [IN] f_toperarespstatus
+ /// NSP_CopyStatusResponse - File Operation Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FileOperationUsingLibz(NSP_CopyInfoCmd &f_toperainfocmd, NSP_CopyStatusResponse &f_toperarespstatus); // NOLINT (runtime/references)
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateTar
+ /// Method to Create tar archive.
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the folder to be archived
+ ///
+ /// \param [IN] f_cdestpath
+ /// std::string - Destination path for the archived folder.
+ ///
+ /// \param [IN] f_tarchivestatusresponse
+ /// NSP_CopyStatusResponse - Archive Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateTar(const std::string &f_csourepath, const std::string &f_cdestpath,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ExtractTar
+ /// Method to extract tar archive.
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the folder to be extracted
+ ///
+ /// \param [IN] f_csourcedest
+ /// std::string - Destination path for the extracted folder.
+ ///
+ /// \param [IN] f_tarchivestatusresponse
+ /// NSP_CopyStatusResponse - Archive Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ExtractTar(const std::string &f_csourepath, const std::string &f_csourcedest,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Create
+ /// Method to Create archive
+ ///
+ /// \param [IN] f_pctarfiledestpath
+ /// CHAR - Destination path for the archived folder.
+ ///
+ /// \param [IN] f_pcrootdirpath
+ /// CHAR - Source path of the folder to be archived
+ ///
+ /// \param [IN] f_plibtarlist
+ /// BOOL - TRUE if user file else FALSE
+ ///
+ /// \return SI_32
+ //
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Create(std::string &f_pctarfiledestpath, std::string &f_pcrootdirpath, libtar_list_t *f_plibtarlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Extract
+ /// Nethod to extract archive.
+ ///
+ /// \param [IN] f_pcrootdirpath
+ /// CHAR - Source path of the folder to be extracted
+ ///
+ /// \param [IN] f_pctarfiledestpath
+ /// CHAR - Destination path for extraction.
+ ///
+ /// \return SI_32
+ //
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Extract(std::string &f_pcrootdirpath, std::string &f_pctarfiledestpath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CompressUsingZlib
+ /// Method to compress file using libz
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the file to be compressed
+ ///
+ /// \param [IN] f_cdestpath
+ /// std::string - Destination path for the compressed file.
+ ///
+ /// \param [IN] f_iziplevel
+ /// Level of compression i.e.
+ /// More compression results in more time taken for compression operation and vice versa.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CompressUsingZlib(const std::string &f_csourepath, const std::string &f_cdestpath, SI_32 f_iziplevel);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// DeCompressUsingZlib
+ /// Method to decompress file using libz.
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the file to be decompressed.
+ ///
+ /// \param [IN] f_csourcedest
+ /// std::string - Destination path for the decompressed file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DeCompressUsingZlib(const std::string &f_csourepath, const std::string &f_csourcedest);
+ };
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_COPY_WORKER_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h
new file mode 100755
index 0000000..4f7876d
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CFSDirectory.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_FS_DIRECTORY_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_FS_DIRECTORY_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+
+
+// Class to provide file system directory operations like create,delete etc.
+class CFSDirectory {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFSDirectory
+ /// Constructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFSDirectory
+ /// Destructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to check if the directory exists.
+ ///
+ /// \param [in] f_cdirpath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL DoesDirecotryExist(const std::string &f_cdirpath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to create a directory.
+ ///
+ /// \param [in] f_cdirpath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus CreateDirectory(const std::string &f_cdirpath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to verify directory.
+ ///
+ /// \param [in] f_cpath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL IsDirectory(const std::string &f_cpath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to delete directory with delay of f_uidelay(msec)
+ /// between consecutive deletes.
+ ///
+ /// \param [in] f_cpath
+ /// std::string - Path of the directory to delete.
+ /// \param [in] f_uidelay
+ /// UI_32 - delay in millisec before recursive call.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL RemoveDirectory(std::string f_cpath, const UI_32 f_uidelay = 0);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_FS_DIRECTORY_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h
new file mode 100755
index 0000000..30c8a26
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup tag_NS_NPPService
+/// \ingroup tag_NS_NPPService
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This class holds the message queue handles for notification subscribers
+///
+/// This is a singleton class which holds the message queue handles for notification subscribers.
+/// This will ensure that NS_NPPService will hold only one handle per subscriber.
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <map>
+#include <utility>
+
+typedef std::map<std::string, HANDLE> HandleList_Type;
+typedef std::pair<HandleList_Type::iterator, bool> HandleListRetStatus_Type;
+
+
+
+/**
+ * This class holds the message queue handles for notification subscribers
+ */
+class CHandleList {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetHandleList
+ /// This function is used to get the singleton instance of class.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \return CHandleList
+ /// CHandleList - singleton instance of class
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ static CHandleList *GetHandleList();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ReleaseHandleList
+ /// This function is used to release the instance of class.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus ReleaseHandleList();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddHandleInList
+ /// Add pair of subscriber name and corresponding handle in map.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ /// \param [IN] f_hmqhandle
+ /// HANDLE - Message queue handle of the subscriber
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus -
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddHandleInList(std::string f_csubscribername, HANDLE f_hmqhandle);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RemoveHandleFromList
+ /// Remove handle for subscriber from the list.
+ /// Handle will actually get removed when all the notifications are unsubscribed by the subscriber
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus -
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RemoveHandleFromList(std::string f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSubscriberMqHandle
+ /// Get the message queue handle of a subscriber.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return HANDLE
+ // HANDLE - Message queue handle of the subscriber
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ HANDLE GetSubscriberMqHandle(std::string f_csubscribername);
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CHandleList
+ /// Constructor of CHandleList class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CHandleList();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CHandleList
+ /// Destructor of CHandleList class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CHandleList();
+
+ HandleList_Type m_mHandleList; ///< map which stores all the message queue handle
+
+ static CHandleList *m_psHandleList; // NOLINT (readability/naming)
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h
new file mode 100755
index 0000000..a3994ca
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h
@@ -0,0 +1,218 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CImmediatePersistenceWorker and holds the
+/// implementation for worker thread.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOR_PERSISTENCE_WORKER_THREAD_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOR_PERSISTENCE_WORKER_THREAD_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_timer_if.hpp>
+
+#include "ns_npp_types.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSP_NorPersistenceWorkerOnStart
+/// Callback method on start of worker thread.
+///
+/// \param [IN] hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStart(HANDLE hthread);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPNorPersistenceWorkerOnStop
+/// Callback method on stopping of worker thread.
+///
+/// \param [IN] hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStop(HANDLE hthread);
+
+// Forward Declaration for class
+class CNotificationsToPersist;
+
+
+/**
+ * This class handles the immediate persistence notification related requests.
+ *
+ */
+class CNorPersistenceWorker {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNorPersistenceWorker
+ /// Constructor of class CNorPersistenceWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNorPersistenceWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNorPersistenceWorker
+ /// Destructor of class CNorPersistenceWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNorPersistenceWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnNorPersistenceTimerStart
+ /// When immediate persistence notification publish request is received by NPPService. It sends a
+ /// NOR_PERSISTENCE_TIMER_START command to the worker thread and this function gets called.
+ /// This function starts the respective timer of the notification. Timeout of timer writes
+ /// corresponding notification data to persistent memory.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnNorPersistenceTimerStart(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RegisterImmediatePersistNotification
+ /// When immediate persistence notification register request is received by NPPService. It sends a
+ /// NOR_PERSISTENCE_REGISTER command to the worker thread and this function gets called.
+ /// Registration with worker thread is required because only child thread will be responsible for
+ /// data saving related stuff. It creates a timer corresponding to the notification.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterImmediatePersistNotification(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// UnregisterImmediatePersistNotification
+ /// When immediate persistence notification unregister request is received by NPPService. It sends a
+ /// NOR_PERSISTENCE_UNREGISTER command to the worker thread and this function gets called.
+ /// It deletes a timer corresponding to the notification.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnregisterImmediatePersistNotification(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnShutdown
+ /// This API stops all the immediate notification timer.
+ /// This API immediately writes the data to persistent memory if the timer is runnning,
+ /// irrespective of delay unless the data .
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnShutdown(HANDLE hthread);
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnCategoryChange
+ /// This API updates the category of immediate persistence notification.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnCategoryChange(HANDLE hthread);
+};
+
+/**
+ * CTimerHelper class maps the timer id and corresponding data.
+ *
+ */
+class CTimerHelper: public NSTimer {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CTimerHelper
+ /// Constructor of class CTimerHelper
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CTimerHelper();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CTimerHelper
+ /// Destructor of class CTimerHelper
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CTimerHelper();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetCmdId
+ /// Returns the timer id of the timer.
+ ///
+ /// \param [IN] none
+ ///
+ /// \return UI_32
+ // UI_32 - Timer id of the timer
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetCmdId();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnTimeOut
+ /// This function gets called when timer expires. This function writes the notification data in
+ /// persistent memory.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnTimeOut(HANDLE hthread);
+
+ // member variables
+ PUI_8 m_pui8HeaderAndData; // header and corresponding data of the notfn stored as part of timer
+
+ private:
+ UI_32 m_uiCmdId; // command id associated with timer
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOR_PERSISTENCE_WORKER_THREAD_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification.h
new file mode 100755
index 0000000..673e54c
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification.h
@@ -0,0 +1,323 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include <string>
+#include <iostream>
+#include "ns_npp_notification_receiver.h"
+
+typedef std::map<std::string, CNotificationReceiver *> NotifReceiver_Type;
+
+/// Iterator of map of CNotificationReceiver
+typedef NotifReceiver_Type::iterator NotifReceiver_Iterator_Type;
+
+/**
+ * This class is base class for all the notification types classes.
+ */
+class CNotification {
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotification
+ /// Parameterless Constructor of CNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification();
+
+ protected:
+ std::string m_cNotificationName; ///< Name of Notification
+
+ UI_32 m_uiMaxMsgSize; ///< Maximum size of notification data
+
+ EFrameworkunifiedNotificationType m_ePersistentType; ///< type of notification
+
+ std::string m_cServiceName; ///< List of services registering notification
+
+ NotifReceiver_Type *m_pmSubscribersList; ///< list of subscribers of notification
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddReceiverInMap
+ /// This function adds the name of the service to receiver list of notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddReceiverInMap(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PublishData
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_hmsgqhandle
+ /// HANDLE - MessageQ Handle of ReceiverQ
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PublishData(HANDLE f_hmsgqhandle,
+ const PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotification
+ /// Constructor of CNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotification
+ /// Destructor of CNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventReciever
+ /// This function adds the name of the application to receiver list of particular notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// DeleteEventReciever
+ /// This function deletes the name of application from receivers list.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DeleteEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetNewSubscribersList
+ /// This function sets the subscribers list of notification
+ ///
+ /// \param [IN] f_pnotification
+ /// CNotification - notification object containing subscribers list
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetNewSubscribersList(CNotification *f_pnotification);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetEventPublisher
+ /// This function set the publisher name to current received service name
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of application
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetEventPublisher(const std::string &f_cservicename);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetEventPublisher
+ /// This function resets the publisher name to NULL
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of application
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ResetEventPublisher(const std::string &f_cservicename);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsServiceRegistered
+ /// This function checks whether the notification is registered with any service or not.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - true,if subscriber list is empty
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsServiceRegistered();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsSubscribersListEmpty
+ /// This function is used to check whether any service is subscribed to notification
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - true,if subscriber list is empty
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsSubscribersListEmpty();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNotificationName
+ /// This function is used to get the notification name.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - notification name
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetNotificationName();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPublisherName
+ /// This function is used to get the publisher name of notification.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - service name
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetPublisherName();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceType
+ /// This function is used to get the type of notification.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedPersistentVarType
+ // EFrameworkunifiedPersistentVarType - persistent type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedNotificationType GetNotificationType();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetMaxMessageSize
+ /// This function is used to get the max size of data of notification message.
+ ///
+ /// \param
+ ///
+ /// \return UI_32
+ // UI_32 - Max Message Size
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetMaxMessageSize();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetMaxMessageSize
+ /// This function reset the max size of data that can be published with notification
+ ///
+ /// \param [IN] f_uilength
+ /// std::string - Max size for notification data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ResetMaxMessageSize(const UI_32 f_uilength);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSubscriberList
+ /// Returns the list of subscribers subscribed to notification
+ ///
+ /// \param
+ ///
+ /// \return NotifReceiver_Type
+ // NotifReceiver_Type - subscriber's list of notification
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ NotifReceiver_Type *GetSubscriberList();
+
+#endif
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h
new file mode 100755
index 0000000..e730d02
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h
@@ -0,0 +1,496 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of singleton class CNotificationManager which is used
+/// to manage notification information.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_MANAGER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_MANAGER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+
+#include <map>
+#include <vector>
+#include <string>
+#include <iostream>
+
+/// forward declaration of class
+class CNotification;
+class CPersistentData;
+class CNotificationsToPersist;
+class CStateNotification;
+
+/// map of all the available notification.
+typedef std::map<std::string, CNotification *> Notification_Type;
+
+/// iterator for map of notifications.
+typedef Notification_Type::iterator Notification_Iterator_Type;
+
+/// map of all available persistent notification and its data.
+typedef std::map<std::string, CPersistentData *> Persistent_Type;
+
+/// Iterator for map of persistent notifications.
+typedef Persistent_Type::iterator Persistent_Iterator_Type;
+
+/**
+ * This class is used to manage the operations related to notification
+ * on registration, subscription, publication, etc.
+ */
+class CNotificationManager {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationManager
+ /// Constructor of CNotificationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationManager
+ /// Destructor of CNotificationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnRegisterEvents
+ /// This function creates notification object depending on its type and if already created it
+ /// adds the service name to the list in the notification object.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_uimsglength
+ /// UI_32 - Maximum length of Message
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedPersistentVarType - type of notification
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - Delay time for persistence
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnRegisterEvents(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay = 0);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnUnRegisterEvents
+ /// This function removes the name of the service from the notification object.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service unregistering from notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnUnRegisterEvents(const std::string &f_cservicename,
+ const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnPublishEvent
+ /// This function stores the published data in the notification object in case of state and
+ /// persistent notification.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - pointer to message
+ ///
+ /// \param f_uimsgsize
+ /// UI_32 - size of Message
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnPublishEvent(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnSubscribeToEvent
+ /// This function adds the name of the application to subscribers list in notification object.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing to notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnSubscribeToEvent(const std::string &f_csubscribername,
+ const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnUnSubscribeFromEvent
+ /// This function adds the name of the application to subscribers list in notification object.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing to notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnUnSubscribeFromEvent(const std::string &f_csubscribername,
+ const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NPGetPersistentNotificationData
+ /// Get data for notification name
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - name of notification
+ /// \param [OUT] f_pnotificationdata
+ /// PVOID - data corresponding to notification name
+ /// \param [IN] f_uidatasize
+ /// UI_32 - size of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NPGetPersistentNotificationData(const std::string &f_cnotificationname,
+ PVOID f_pnotificationdata, const UI_32 f_uidatasize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnGetPersistentData
+ /// This function is used to get the persistent data stored related to notification.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification Name
+ ///
+ /// \param [IN] f_creceivername
+ /// std::string - Source Name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnGetPersistentData(const std::string &f_cnotificationname,
+ const std::string &f_creceivername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceGetPersistentNotificationData
+ /// This function is used to get the list of persistent notifications and the data associated
+ /// with it.
+ ///
+ /// \param [OUT] f_pvpersistnotification
+ /// CNotificationsToPersist - vector containing list of persistent notifications and
+ /// data associated with it.
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedNotificationType - Type of notification
+ ///
+ /// \param [IN] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceGetPersistentNotificationData(std::vector<CNotificationsToPersist *> *f_pvpersistnotification,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersistentNotificationData
+ /// This function is used to create the persistent notifications object and fill the data
+ /// related with it on system load.
+ ///
+ /// \param [IN] f_pvpersistnotification
+ /// vector<CNotificationsToPersist> - vector containing list of notifications and data associated with it
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersistentNotificationData(std::vector<CNotificationsToPersist *> *f_pvpersistnotification);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNotificationInfo
+ /// This function is used to get the notification information.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification Name
+ ///
+ /// \param [IN] l_pnotificationstopersist
+ /// CNotificationsToPersist - Notification info structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetNotificationInfo(const std::string &f_cnotificationname,
+ CNotificationsToPersist *&l_pnotificationstopersist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetDefaultPersistentNotificationData
+ /// This function is used to set the default data of persistent notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ /// \param [IN] f_pmessage
+ /// PVOID - message data
+ /// \param [IN] f_uimsgsize
+ /// UI_32 - message size
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetDefaultPersistentNotificationData(const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersistentCategory
+ /// This function is used to set the persistent type of persistent notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ /// \param [IN] f_epersistenttype
+ /// EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersistentCategory(const std::string &f_cnotificationname,
+ const EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentservicePublishImmediateNotification
+ /// This function publish the immediate notification f_cnotificationname to all its subscribers.
+ /// This API is called when service updates the immediate notification data in persistent memory
+ /// using synchronous API.
+ ///
+ /// \param [IN] f_cservicename
+ /// const std::string& - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// const std::string& - notification name
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - pointer to message
+ ///
+ /// \param f_uimsgsize
+ /// UI_32 - size of Message
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - eFrameworkunifiedStatusOK on success
+ /// eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// eFrameworkunifiedStatusNullPointer - if notification not found
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentservicePublishImmediateNotification(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNotificationProfilingData
+ /// This function is used to get the notification profiling information.
+ ///
+ /// \param [OUT] f_tNotificationProfileInfo
+ /// std::string - all the notification info of all applications concated in a string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetNotificationProfilingData(std::string &f_cnotificationprofileInfo); // NOLINT (runtime/references)
+
+#endif
+
+ private:
+ Notification_Type *m_pmNotificationList; /// < map containing list of all notifications.
+
+ std::vector<std::string> *m_pvPersistentList; /// < vector containing list of all persistent notifications.
+
+ std::vector<std::string> *m_pvUserPersistentList; /// < vector containing list of all user persistent notifications.
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateNotificationObject
+ /// This function is used to get notification object from map if it exists else create new
+ /// object as per type of notification.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_uimsglength
+ /// UI_32 - Maximum size of notification message
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedPersistentVarType - Delay time for persistence
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - Persistence Delay
+ ///
+ /// \return CNotification
+ // CNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification *CreateNotificationObject(const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay = 0);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SearchNotification
+ /// This function is used to search whether notification object is present in map or not.
+ /// If present it sends the reference. CNotification - reference to pointer of notification object
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return CNotification
+ // CNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification *SearchNotification(const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SearchPersistenceNotification
+ /// This function is used to search whether the given persistent notification object
+ /// is present in map or not.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return CStateNotification
+ // CStateNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStateNotification *SearchPersistenceNotification(const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateNotificationObjectToPersist
+ /// Creates the CNotificationsToPersist object from notification object and the persistent data.
+ ///
+ /// \param [IN] f_pnotification
+ /// CStateNotification - notification object ptr
+ /// \param [IN] f_pdata
+ /// CPersistentData - persistent data
+ ///
+ /// \return CNotification
+ // CNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationsToPersist *CreateNotificationObjectToPersist(CStateNotification *f_pnotification,
+ const CPersistentData *f_pdata);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RemoveUserSpecificNotificationEntry
+ /// This function is used to get the singleton instance of class.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RemoveUserSpecificNotificationEntry();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ChangeNotificationType
+ /// This function creates new notification object depending on the type and replaces the old one.
+ /// The subscribers list is copied from the old notification object is copied to the new one.
+ ///
+ /// \param [IN] f_pnotification
+ /// CNotification* - old notification object
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_uimsglength
+ /// UI_32 - Maximum length of Message
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedPersistentVarType - new type of notification
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - Delay time for persistence
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ChangeNotificationType(CNotification *f_pnotification,
+ const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_MANAGER_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h
new file mode 100755
index 0000000..09f6b15
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h
@@ -0,0 +1,68 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CNotificationReceiver.
+/// It holds the handle of message queue for sending notification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_RECEIVER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_RECEIVER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+class CNotificationReceiver {
+ private:
+ // no members in private
+
+ public:
+ HANDLE m_MsgQHandle; ///< handle to message queue
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationReceiver
+ /// Constructor of CNotificationReceiver class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationReceiver();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationReceiver
+ /// Destructor of CNotificationReceiver class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationReceiver();
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_RECEIVER_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h
new file mode 100755
index 0000000..e668af6
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATIONPERSISTENTSERVICELOG_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATIONPERSISTENTSERVICELOG_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_NPP_INFO ZONEMASK(25)
+#define ZONE_PRD_INFO3 ZONEMASK(26)
+#define ZONE_PRD_INFO2 ZONEMASK(27)
+#define ZONE_PRD_INFO1 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 "NPP Info"
+#define ZONE_TEXT_26 "Product Info3"
+#define ZONE_TEXT_27 "Product Info2"
+#define ZONE_TEXT_28 "Product Info1"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_NS_WAR, ZONE_NS_ERR, ZONE_PRD_INFO2
+#endif
+
+extern const CHAR AppName[]; // NOLINT (readability/naming)
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATIONPERSISTENTSERVICELOG_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h
new file mode 100755
index 0000000..04468be
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CFilePersistence class.
+/// This class is responsible for persisting and retrieving of files.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FILE_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FILE_H_
+
+#include <native_service/ns_np_service.h>
+#include <string>
+#include <map>
+#include "ns_npp_persistence.h"
+
+// Forward declaration of classes.
+class CPersistence;
+class CRegistryEntry;
+
+/**
+ * This class is responsible for persisting and retrieving of files..
+ */
+class CFilePersistence : public CPersistence {
+ private:
+ TSourceRegistryList m_mPersistFileRegistry;
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFilePersistence
+ /// Constructor of CFilePersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFilePersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFilePersistence
+ /// Destructor of CFilePersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFilePersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Release
+ /// Request for release file to persistent storage. File persist will be done at shutdown.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - File which needs to persist.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Release(std::string f_cappname, std::string f_ctag, std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype, std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Load
+ /// Load file from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Filepath for retrieved file.
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Load(std::string f_cappname, std::string f_ctag, std::string f_cretrievepath,
+ std::string f_cusername);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FILE_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h
new file mode 100755
index 0000000..39cf975
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h
@@ -0,0 +1,122 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FOLDER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FOLDER_H_
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <string>
+
+#include "ns_npp_persistence.h"
+
+
+// class CPersistence;
+
+class CFolderPersistence : public CPersistence {
+ private:
+ TSourceRegistryList m_mPersistFolderRegistry; // map to hold the folder registry entries
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFolderPersistence
+ /// Constructor of CFolderPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFolderPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFolderPersistence
+ /// Destructor of CFolderPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFolderPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Release
+ /// Entry for the folder is stored in map for persistence.
+ /// If f_bPersist is TRUE folder will be persisted immediately else will be persisted on shutdown
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - Folder which needs to persist.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Release(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Load
+ /// Load folder from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Filepath for retrieved file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Load(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ std::string f_cusername);
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FOLDER_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h
new file mode 100755
index 0000000..d84f9fb
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h
@@ -0,0 +1,365 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CPersistence class.
+/// This is a abstract class for file and folder persistency.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+#include <string>
+#include <map>
+#include <list>
+
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_copy_worker.h"
+
+class CRegistryEntry;
+
+typedef std::string TSourceName;
+typedef std::string TTag;
+typedef std::map< TTag, CRegistryEntry > TTagRegistryList;
+typedef TTagRegistryList::iterator TTagRegistryListItr;
+
+typedef std::map<TSourceName, TTagRegistryList> TSourceRegistryList;
+typedef TSourceRegistryList::iterator TSourceRegistryListItr;
+
+typedef std::list<NSP_CopyInfoCmd> TPendingJobs;
+typedef TPendingJobs::iterator TPendingJobsItr;
+
+/**
+ * This is a abstract class for file and folder persistence.
+ */
+class CPersistence {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistence
+ /// Constructor of CPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistence
+ /// Destructor of CPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Register
+ /// Register file/folder tag for persistence.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] bisuserpersistence
+ /// BOOL - TRUE if user persistence else FALSE
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Register(std::string f_crequestorappname, std::string f_ctag, BOOL bisuserpersistence);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Release
+ /// Entry for the file/Folder is stored in map for persistence.
+ /// If f_bPersist is TRUE file/folder will be persisted immediately else will be persist on shutdown
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - File/Folder path that is to be persisted.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Release(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername) = 0;
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Load
+ /// Load file/folder from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Path to retrieve.
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Load(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ std::string f_cusername) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Persist
+ /// Persist file/folder immediately
+ ///
+ /// \param [IN] f_objregistryentry
+ /// CRegistryEntry& - Registry entry job object to persist.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Persist(CRegistryEntry &f_objregistryentry); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AckReceivedFromWorker
+ ///
+ ///
+ /// \param [in] pSource
+ /// PCSTR - Name of the source.
+ /// \param [in] f_ctag
+ /// PCSTR - file/folder tag.
+ /// \param [in] f_bcopystatus
+ /// BOOL - Status of file/folder copy by copy worker.
+ /// \param [in] f_eloadtype
+ /// ENPS_Loadtype - Type of load release or load.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, BOOL f_bcopystatus,
+ ENPS_Loadtype f_eloadtype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistAllReleaseRequests
+ /// Persist all files/folders which are not persisted yet.
+ ///
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HaveAllReleaseRequestsPersisted
+ /// Checks if all release requests are processed or not
+ ///
+ /// \param [out] f_ctagnotreleased
+ /// std::string - list of tags not released by application
+ ///
+ /// \return BOOL
+ /// TRUE if all release requests are processed else false
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL HaveAllReleaseRequestsPersisted(std::string &f_ctagnotreleased); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetPersistFlag
+ /// Resets persist flag.
+ ///
+ /// \param none
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ResetPersistFlag();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistAllUserRequests
+ /// Persist all files/folders which are not persisted yet.
+ ///
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus PersistAllUserRequests();
+
+ // virtual VOID ListAllInMap() = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReadThreadHandle
+ /// Set read thread handle.
+ ///
+ /// \param [in] f_hreadthread
+ /// HANDLE - Handle of the read thread.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetReadThreadHandle(HANDLE f_hreadthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetWriteThreadHandle
+ /// Set write thread handle.
+ ///
+ /// \param [in] f_hwritethread
+ /// HANDLE - Handle of the write thread.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetWriteThreadHandle(HANDLE f_hwritethread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetStoragePath
+ /// Get the permanent storage path. Get it from NS_NPPService's config file.
+ ///
+ /// \return std::string
+ /// std::string - Permanant storage path
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static std::string GetStoragePath();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persist type of file/folder
+ ///
+ /// \param [IN] f_crequestorname
+ /// string - Application Name
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(const std::string &f_crequestorname,
+ const std::string &f_ctag,
+ EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsUserPersistence
+ /// Check if the file/folder being persisted is user specific
+ ///
+ /// \param [in] - f_ctag
+ /// std::string - File/Folder Tag
+ ///
+ /// \return status
+ /// BOOL - TRUE for user specific persistence
+ /// FALSE for global persistence
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual BOOL IsUserPersistence(std::string f_ctag);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceProfilingData
+ /// This function is used to get the persistence info
+ ///
+ /// \param [out] f_cpersistenceprofileinfo
+ /// std::string - Persistence info concated in a string
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo); // NOLINT (runtime/references)
+
+#endif
+
+ protected:
+ EFrameworkunifiedStatus ProcessReleaseRequest(std::string f_crequesterappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername);
+
+ EFrameworkunifiedStatus ProcessLoadRequest(std::string f_crequesterappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cretrievepath,
+ std::string f_cusername);
+
+ VOID AddRequestData(NSP_CopyInfoCmd &f_tcpinfo, // NOLINT (runtime/references)
+ std::string f_sourcepath,
+ std::string f_destpath,
+ std::string f_crequesterappname,
+ std::string f_ctag,
+ ENPS_Loadtype f_eloadtype,
+ ENotificationpersistentservicePersistType f_epersisttype);
+
+ EFrameworkunifiedStatus SendRequestMessage(NSP_CopyInfoCmd &f_tcpinfo); // NOLINT (runtime/references)
+
+ std::string m_cStoragePath; ///< Persistent memory storage path
+
+ NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_eCompressionType; ///< Compression type for file/folder persistency
+
+ HANDLE m_hNSWriteToPersistentMem; ///< Child thread handle, copies file to persistent memory.
+
+ HANDLE m_hNSReadFromPersistentMem; ///< Child thread handle, copies file from persistent memory.
+
+ // TODO(my_username): Remove this member var. Once the API to get application handle is available, use that.
+ HANDLE m_hAppHandle;
+
+ TSourceRegistryList m_mPersistRegistry;
+
+ TPendingJobs m_lPendingJobs; ///< stores the list of pending jobs sequentially
+
+ BOOL m_bPersist; ///< persist or not. It will be set to TRUE either on shutdown or userchange
+
+ UI_32 m_uiNotificationpersistentservicePersistCategoryFlag; ///< Stores the persist category flag value on shutdown request.
+ ///< It is needed to decide which data to persist, if
+ ///< release request is received by NSNPP after shutdown request
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h
new file mode 100755
index 0000000..99f98d7
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h
@@ -0,0 +1,536 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CPersistenceManager class.
+/// This class acts as a manager for notification persistent data storage
+/// and file and folder persistence.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_MANAGER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_MANAGER_H_
+
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+#include <map>
+#include <string>
+#include <vector>
+#include "ns_npp_types.h"
+#include "ns_npp_persistent_accesser.h"
+
+class CPersistence;
+class CPersistentData;
+class CNotificationsToPersist;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// vector of all available persistent notification and its data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Map of all persist file type. i.e. FilePersistence and FolderPersistence
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::map<ENotificationpersistentservicePersistType, CPersistence *> Persist_Type;
+
+typedef Persist_Type::iterator Persist_Type_Iter;
+
+/**
+ * This class acts as a manager for storing notification data,file and folder in
+ * persistent memory.
+ */
+class CPersistenceManager {
+ public:
+ /// Disable Persistence
+ static BOOL m_bPersistenceDisabled; // NOLINT (readability/naming)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistenceManager
+ /// Constructor of CPersistenceManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistenceManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistenceManager
+ /// Destructor of CPersistenceManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CPersistenceManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceRegister
+ /// Registers a tag for the file or folder. This tag will be used for releasing or loading a
+ /// file or folder.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Tag to register is for a file
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Tag to register is for a folder
+ ///
+ /// \param [IN] bisuserpersistence
+
+ /// BOOL - TRUE if user persistence else FALSE
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceRegister(std::string f_cappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ BOOL bisuserpersistence);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceRelease
+ /// Entry for the file or folder is stored in map for persistence.
+ /// If f_bPersist is TRUE file or folder will be persist immediately else will be persist
+ /// on shutdown
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - File/Folder which needs to persist.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Persist a file to a persistent memory
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Persist a folder to a persistent memory
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceRelease(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceLoad
+ /// Load file/folder from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Filepath for retrieved file/folder.
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Load a file from persistent memory
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Load a folder from persistent memory
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceLoad(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AckReceivedFromWorker
+ /// Send release ack to file/folder persistence object.
+ ///
+ /// \param [IN] f_csource
+ /// PCSTR - Source of released file/folder
+ ///
+ /// \param [IN] f_ctag
+ /// PCSTR - Tag of released file/folder
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Ack for file persistence object
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Ack for folder persistence object
+ ///
+ /// \param [in] f_bcopystatus
+ /// BOOL - Status of file/folder copy by worker.
+ ///
+ /// \param [in] f_eloadtype
+ /// ENPS_Loadtype - Type of load release or load.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, ENotificationpersistentservicePersistType f_epersisttype,
+ BOOL f_bcopystatus, ENPS_Loadtype f_eloadtype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSaveNotificationData
+ /// Save notification data in a persistent file.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - List of all notifications and corresponding data.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSaveNotificationData(Persistent_Notification_List_Type *f_vpersistentnotificationlist);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSaveUserNotificationData
+ /// Save notification data of user in a persistent file.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - List of all notifications and corresponding data.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSaveUserNotificationData(Persistent_Notification_List_Type *f_vpersistentnotificationlist);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceReadNotificationData
+ /// Get the list of all persistent notifications from a persistent memory and store it in a map.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceReadNotificationData(Persistent_Notification_List_Type *&f_vnotificationlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceReadUserNotificationData
+ /// Get the list of all user persistent notifications from a persistent memory and store it in a map.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceReadUserNotificationData(Persistent_Notification_List_Type *&f_vnotificationlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceReadNorNotificationData
+ /// Get the list of all Nor persistent notifications from a persistent memory and store it in a map.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceReadNorNotificationData(Persistent_Notification_List_Type *&f_vnotificationlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistAllReleaseRequests
+ /// Persist all files and folder contained in the map in persistent memory.
+ ///
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentservicePersistAllUserRequests
+ /// Persist all user files and folder contained in the map in persistent memory.
+ ///
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentservicePersistAllUserRequests();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReadThreadHandle
+ /// Pass the handle of the read thread to the object of file/folder persistence
+ ///
+ /// \param [IN] f_hreadthread
+ /// HANDLE - Handle of read thread.
+ ///
+ /// \return
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetReadThreadHandle(HANDLE f_hreadthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetWriteThreadHandle
+ /// Pass the handle of the write thread to the object of file/folder persistence
+ ///
+ /// \param [IN] f_hwritethread
+ /// HANDLE - Handle of write thread.
+ ///
+ /// \return
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetWriteThreadHandle(HANDLE f_hwritethread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetNorPersistenceThreadHandle
+ /// Pass the handle of the Nor persistence write thread to the object of file/folder persistence
+ ///
+ /// \param [IN] f_hwritethread
+ /// HANDLE - Handle of write thread.
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetNorPersistenceThreadHandle(HANDLE f_hwritethread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetUserPersistentPath
+ /// Set user persistent path.
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - Name of user
+ ///
+ /// \return
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetUserPersistentPath(std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsUserPersistence
+ /// Check if the persistence is user specific
+ ///
+ /// \param [in] - f_ctag
+ /// std::string - File/folder Tag
+ ///
+ /// \param [in] - f_epersisttype
+ /// ENotificationpersistentservicePersistType - persistent type
+ ///
+ /// \return status
+ /// BOOL - TRUE for user specific persistence
+ /// FALSE for global persistence
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsUserPersistence(std::string f_ctag, ENotificationpersistentservicePersistType f_epersisttype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HaveAllReleaseRequestsPersisted
+ /// Checks if all files and immediate persistent data are persisted.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ /// TRUE if all release requests are processed else false
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL HaveAllReleaseRequestsPersisted();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetPersistFlag
+ /// Resets persist flag.
+ ///
+ /// \param none
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ResetPersistFlag();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ClearPersistenceData
+ /// Deletes the data from the persistent memory
+ ///
+ /// \param [in] f_enotificationpersistentserviceclearpersistencescope
+ /// EFrameworkunifiedClearPersistence - data to be deleted from memory
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearPersistenceData(const EFrameworkunifiedClearPersistence &f_enotificationpersistentserviceclearpersistencescope);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersistentCategory
+ /// Sets the persist type of file or folder
+ ///
+ /// \param [IN] f_crequestorname
+ /// string - Application name
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \param [IN] f_bPersist
+ /// ENotificationpersistentservicePersistType - file or folder
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersistentCategory(std::string f_crequestorname,
+ std::string f_ctag,
+ EFrameworkunifiedPersistCategory f_epersistcategory,
+ ENotificationpersistentservicePersistType f_epersisttype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistNORData
+ /// Sends the message to Immediate Persistence Thread to Persists the data immediately or reset
+ /// the NOR data depending on persist category flag during shutdown irrespective of delay.
+ ///
+ /// \param f_eshutdowntype
+ /// EFrameworkunifiedShutdownType - shutdown type - normal, quick, data reset
+ ///
+ /// \param f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - flag representing whether to persist or reset data.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PersistNORData(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetImmediateDataPersistedStatus
+ /// Set/Reset the persistence status of immediate persistence data
+ ///
+ /// \param [in] - f_bstatus
+ /// BOOL
+ /// TRUE - immediate persistent data are persisted
+ /// FALSE - immediate persistent data not persisted
+ ///
+ /// \return
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetImmediateDataPersistedStatus(BOOL f_bstatus);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetFilePersistedStatus
+ /// Set/Reset the persistence status of files and folders
+ ///
+ /// \param [in] - f_bstatus
+ /// BOOL
+ /// TRUE - all files are persisted
+ /// FALSE - all files and folders are not persisted
+ ///
+ /// \return
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetFilePersistedStatus(BOOL f_bstatus);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceProfilingData
+ /// This function is used to get the persistence info
+ ///
+ /// \param [out] f_cpersistenceprofileinfo
+ /// std::string - Persistence info concated in a string
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo); // NOLINT (runtime/references)
+
+#endif
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ReadImmediateNotificationData
+ /// Get the list of all immediate persistent notifications of f_epersistcategory
+ /// from a persistent memory in a vector.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \param [IN] f_epersistcategory
+ /// const EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ReadImmediateNotificationData(Persistent_Notification_List_Type *&f_vpersistentnotificationlist, // NOLINT (runtime/references)
+ const EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ std::string m_cUserNotificationTag; ///< Tag associated with a file which is used
+ ///< for storing user related notification persistent data.
+
+ std::string m_cNotificationPersistFilepath; ///< Persistent file path for storing persistent data
+
+ std::string m_cNotificationUserMemFilepath; ///< Memory location of a file for storing persistent data of a user
+
+ Persist_Type m_mPersist_Type; ///< Map holds the objects of file and folder persistency.
+
+ CPersistentAccesser *m_poDataAccesser; ///< Object for persistent data accesser
+
+ HANDLE m_hNSImmediatePersistenceThread; ///< Nor persistence thread handle
+
+ BOOL m_bAllFilePersisted; // all files have been persisted
+
+ BOOL m_bImmediatedDataPersisted; // all immediate peristence data have been persisted
+
+ EFrameworkunifiedStatus Init();
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPServiceOnCpWorkerAckCmd
+/// Handles when the CopyWorker sends an ack back for a message received .
+///
+/// \param [in] f_happ
+/// HANDLE - Handle to notificationpersistentservice_application Framework.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPServiceOnCpWorkerAckCmd(HANDLE f_happ);
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_MANAGER_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h
new file mode 100755
index 0000000..bfb1538
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h
@@ -0,0 +1,119 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CPersistentAccesser class.
+/// This is a abstract class. Derived classes of this class will store the data in different
+/// file formats.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_ACCESSER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_ACCESSER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <vector>
+
+class CPersistentData;
+class CNotificationsToPersist;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// vector of all available persistent notification and its data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+/**
+ * This is a abstract class. Derived classes of this class will store the data in different
+ * file formats.
+ */
+class CPersistentAccesser {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistentAccesser
+ /// Constructor of CPersistentAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistentAccesser() {}
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistentAccesser
+ /// Destructor of CPersistentAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CPersistentAccesser() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistData
+ /// Persist data in persistent memory depending on file format.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Data which has to be persisted.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Read data from this file.
+ ///
+ /// \param [IN] f_epersistenttype
+ /// EFrameworkunifiedNotificationType - Type of persistent notification
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus PersistData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *f_vpersistentnotificationlist,
+ EFrameworkunifiedNotificationType f_epersistenttype,
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RetrieveData
+ /// Retrieve data in persistent memory depending on file format.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Write data from this file.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type* - Retrieved data.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus RetrieveData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *&f_vpersistentnotificationlist, // NOLINT (runtime/references)
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData) = 0;
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_ACCESSER_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h
new file mode 100755
index 0000000..84e2b43
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h
@@ -0,0 +1,165 @@
+ /*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file conains declaration of CPersistentData, CNotificationsToPersist and CPersistDataHeader class.
+/// This class is used to hold the persistent data related to state and persistent
+/// notification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+#ifdef AGL_STUB
+#include <cstring>
+#endif
+/**
+ * This class holds the message and message length of notification data.
+ */
+class CPersistentData {
+ private:
+ // no members in private
+
+ public:
+ PVOID m_pMessage; ///< pointer to message structure
+
+ UI_32 m_uiMsgSize; ///< length of message
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistentData
+ /// Constructor of CPersistentData class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistentData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistentData
+ /// Destructor of CPersistentData class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CPersistentData();
+};
+
+class CNotificationsToPersist {
+ private:
+ // no members in private
+
+ public:
+ std::string m_cNotificationName; ///< Name of Notification
+
+ UI_32 m_uiMaxMsgLength; ///< Maximum data length of notification
+
+ EFrameworkunifiedNotificationType m_ePersistentType; ///< type of notification
+
+ EFrameworkunifiedPersistCategory m_ePersistCategory; ///< Persistent category
+
+ std::string m_cPublisherName; ///< Service Name
+
+ CPersistentData *m_pPersistentData; ///< Persistent data related to notification
+
+ UI_32 m_uiDelay; ///< Maximum delay for persistence
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationsToPersist
+ /// Constructor of CNotificationsToPersist class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationsToPersist(): m_cNotificationName(""),
+ m_uiMaxMsgLength(0),
+ m_ePersistentType(eFrameworkunifiedUnknown),
+ m_ePersistCategory(eFrameworkunifiedUserData),
+ m_cPublisherName(""),
+ m_pPersistentData(NULL),
+ m_uiDelay(0) {
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationsToPersist
+ /// Destructor of CNotificationsToPersist class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationsToPersist() {
+ if (NULL != m_pPersistentData) { // LCOV_EXCL_BR_LINE 6: m_pPersistentData can't be NULL
+ delete m_pPersistentData;
+ m_pPersistentData = NULL;
+ }
+ }
+};
+
+class CPersistDataHeader {
+ private:
+ // no members in private
+
+ public:
+ UI_32 m_uiSize; ///< size of the associated data blob
+ UI_32 m_uiOffset; ///< Offset at which the data blob starts
+ EFrameworkunifiedNotificationType m_ePersistentType;
+ CHAR m_cPublisherName[MAX_QUEUE_NAME_SIZE];
+ CHAR m_cNotificationName[MAX_STRING_SIZE_NOTIFICATION];
+ UI_32 m_uiMaxMsgLength; ///< max size of the associated data
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistDataHeader
+ /// Constructor of CPersistDataHeader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistDataHeader(): m_uiSize(0),
+ m_uiOffset(0),
+ m_ePersistentType(eFrameworkunifiedPersistedStateVar),
+ m_uiMaxMsgLength(0) {
+ std::memset(m_cPublisherName, 0, MAX_QUEUE_NAME_SIZE);
+ std::memset(m_cNotificationName, 0, MAX_STRING_SIZE_NOTIFICATION);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistDataHeader
+ /// Destructor of CPersistDataHeader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CPersistDataHeader() {
+ }
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personality.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personality.h
new file mode 100755
index 0000000..9ac052f
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personality.h
@@ -0,0 +1,75 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of CNotificationpersistentservicePersonality class.
+/// The class object define personality.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALITY_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALITY_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+/**
+ * This class holds all the informations related to a personality.
+ */
+class CNotificationpersistentservicePersonality {
+ private:
+ // no members in private
+
+ public:
+ std::string m_cUserName; ///< user name
+
+ UI_32 m_uiUserId; ///< unique identifier of each user
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationpersistentservicePersonality
+ /// Constructor of CNotificationpersistentservicePersonality class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationpersistentservicePersonality(): m_cUserName(""), m_uiUserId(0) {} // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationpersistentservicePersonality
+ /// Destructor of CNotificationpersistentservicePersonality class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationpersistentservicePersonality() {}
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALITY_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h
new file mode 100755
index 0000000..b1042fb
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h
@@ -0,0 +1,132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of singleton class CnotificationpersistentservicePersonalizationManager which is
+/// used to manage information of personality.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALIZATION_MANAGER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALIZATION_MANAGER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <string>
+#include <map>
+#include "ns_npp_personality.h"
+
+typedef std::map<std::string, CNotificationpersistentservicePersonality *> Personality_Type;
+
+/**
+ * This class maintains information on creation of new personality or
+ * change of personality.
+ */
+class CnotificationpersistentservicePersonalizationManager {
+ private:
+ Personality_Type *m_pmPersonality; ///< list of personality
+
+ UI_32 m_uiUserId; ///< unique user id
+
+ std::string m_cCurrentPersonality; ///< current personality name
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreatePersonality
+ /// This function is used to create new Personality.
+ ///
+ /// \param [IN] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreatePersonality(const std::string &f_cpersonalityname);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CnotificationpersistentservicePersonalizationManager
+ /// Constructor of CnotificationpersistentservicePersonalizationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CnotificationpersistentservicePersonalizationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CnotificationpersistentservicePersonalizationManager
+ /// Destructor of CnotificationpersistentservicePersonalizationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CnotificationpersistentservicePersonalizationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceGetPersonality
+ /// This function is used to get the current personality.
+ ///
+ /// \param [OUT] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceGetPersonality(std::string &f_cpersonalityname); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersonality
+ /// This function is used to set the new personality.
+ ///
+ /// \param [IN] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersonality(const std::string f_cpersonalityname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceIsValidPersonality
+ /// Check if user is valid or not.
+ ///
+ /// \param [IN] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return BOOL
+ /// TRUE - Valid user
+ /// FALSE - Not a valid user
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL NotificationpersistentserviceIsValidPersonality(const std::string f_cpersonalityname);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALIZATION_MANAGER_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h
new file mode 100755
index 0000000..13b96a2
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeServices
+/// \brief This file contains declaration of all the protocols and structures related to profiling.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PROFILING_PROTOCOLS_INTERNAL_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PROFILING_PROTOCOLS_INTERNAL_H_
+
+
+#define NPS_PROFILE_NOTIFICATION_REQ 0x1AA
+#define NPS_PROFILE_NOTIFICATION_RESP 0x1BB
+
+#define NPS_PROFILE_PERSISTENCE_REQ 0x2AA
+#define NPS_PROFILE_PERSISTENCE_RESP 0x2BB
+
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PROFILING_PROTOCOLS_INTERNAL_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h
new file mode 100755
index 0000000..3cb475e
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h
@@ -0,0 +1,330 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CRegistryEntry class.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "ns_npp_types.h"
+
+/**
+ * This class contains the registry information of the files/folders to be peresisted.
+ */
+class CRegistryEntry {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CRegistryEntry
+ /// Constructor of CRegistryEntry class
+ ///
+ /// \param [OUT] f_ctag
+ /// std::string& - File or Folder tag
+ ///
+ /// \param [OUT] f_crequester
+ /// std::string& - Requester Name
+ ///
+ /// \param [OUT] f_cstoragepath
+ /// std::string& - File or Folder persistence storage path
+ ///
+ /// \param [IN] f_bisuserpersistence
+ /// BOOL - File or Folder is user specific
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CRegistryEntry(const std::string &f_ctag, const std::string &f_crequester,
+ const std::string &f_cstoragepath, BOOL f_bisuserpersistence);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CRegistryEntry
+ /// Copy Constructor of CRegistryEntry class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRegistryEntry(const CRegistryEntry &f_objin);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// operator=
+ /// Operator overload =
+ ///
+ /// \param [IN] f_objin
+ /// CRegistryEntry& - In object.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRegistryEntry &operator=(const CRegistryEntry &f_objin); // NOLINT (readability/naming)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReleasePath
+ /// Set release path.
+ ///
+ /// \param [IN] f_creleasepath
+ /// std::string& - Path of the file/folder to be released.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetReleasePath(const std::string &f_creleasepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetBeingPersisted
+ /// Set the file/folder persist member variable to true to notify that the file/folder is being
+ /// persisted.
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetBeingPersisted();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AckReceived
+ /// Ack from copy worker received. Process the ack.
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID AckReceived();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsReleased
+ /// Check if File/folder released or not.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if file/folder is released else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsReleased() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// HasntBeenPersisted
+ /// File persisted or not
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if file is not persisted else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL HasntBeenPersisted() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsPersisted
+ /// File/Folder persisted or not
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if file/folder is persisted else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsPersisted() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsAckPending
+ /// Ack is pending or not.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if ack is pending else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsAckPending() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistPath
+ /// Get the persist path.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the persist path.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetPersistPath() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetReleasePath
+ /// Get the release path.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the release path.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetReleasePath() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetLoadPath
+ /// Get the load path.
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - type of persisted data
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - Current user name
+ ///
+ ///
+ /// \return std::string
+ // std::string - Returns the load path.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetLoadPath(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequester
+ /// Get the name of requester.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the name of requester.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetRequester() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetTag
+ /// Get the tag.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the tag.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetTag() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsUserPersistence
+ /// Returns TRUE if it is a user persistence.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - Returns TRUE if it is a user persistence.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsUserPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetCurrentAction
+ /// Set current copying action of a the corresponding tag.
+ ///
+ /// \param [IN] f_ecurrentaction
+ /// ENPS_Loadtype - Current action
+ ///
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetCurrentAction(ENPS_Loadtype f_ecurrentaction);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetPersistedFlag
+ /// Reset Persist flags
+ ///
+ /// \param
+ ///
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ResetPersistedFlag();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistProperties
+ /// creates persistence path and stores the persist type
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - Set persist type
+ /// \param [IN] f_cusername
+ /// std::string - Username related to persist tag if any.
+ ///
+ ///
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetPersistProperties(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername = "");
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistType
+ /// Returns persist type of a job
+ ///
+ /// \param
+ ///
+ /// \return ENotificationpersistentservicePersistType
+ // ENotificationpersistentservicePersistType - Returns persist type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ENotificationpersistentservicePersistType GetPersistType() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persistent type related to tag
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentCategory
+ /// Returns persistent type of tag
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedPersistCategory
+ // EFrameworkunifiedPersistCategory - Returns persistent type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedPersistCategory GetPersistentCategory();
+
+ ENPSPersistenceJobState m_eJobState; // Current state of a job
+
+ private:
+ std::string m_cTag; // File/Folder tag
+ std::string m_cRequestor; // Requester application name
+ BOOL m_bIsReleased; // if file or folder released
+ BOOL m_bIsPersisted; // if file or folder is persisted
+ std::string m_cPersistPath; // Persist path
+ std::string m_cReleasePath; // Release path
+ std::string m_cBasePath; // Persist base path
+ BOOL m_bIsUserPersistence; // If user persistence
+ ENPS_Loadtype m_eCurrentAction; // Current action to load file to/from
+ /// temporary/persistence memory
+ ENotificationpersistentservicePersistType m_ePersistType;
+ EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h
new file mode 100755
index 0000000..da5427d
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h
@@ -0,0 +1,109 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CRegularNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGULAR_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGULAR_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_notification.h"
+
+/**
+ * This class inherits CNotification class and implements regular notification related operations.
+ */
+class CRegularNotification : public CNotification {
+ private:
+ // no members in private
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CRegularNotification
+ /// Constructor of CRegularNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRegularNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CRegularNotification
+ /// Destructor of CRegularNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CRegularNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventReciever
+ /// This function adds the name of the application to receiver list of particular notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+};
+
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGULAR_NOTIFICATION_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h
new file mode 100755
index 0000000..26edf73
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h
@@ -0,0 +1,177 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStateNorPersistenceNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_state_notification.h"
+
+/**
+ * This class inherits CStateNotification class and implements specific operations related to
+ * nor persistent notifications.
+ */
+class CStateNorPersistenceNotification : public CStateNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStateNorPersistenceNotification
+ /// Constructor of CStateNorPersistenceNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - delay
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStateNorPersistenceNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize,
+ const UI_32 f_uidelay,
+ const EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStateNorPersistenceNotification
+ /// Destructor of CStateNorPersistenceNotification class
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CStateNorPersistenceNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceDelay
+ /// Method to get the persistence delay for a specific notification.
+ ///
+ /// \param
+ ///
+ /// \return UI_32
+ // UI_32 - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetPersistenceDelay();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients and saves the data
+ /// immediately to persistent memory.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PublishNotification
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PublishNotification(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentCategory
+ /// Gets the persist type of notification
+ ///
+ ///
+ /// \return EFrameworkunifiedPersistCategory
+ // EFrameworkunifiedPersistCategory - persist type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedPersistCategory GetPersistentCategory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persist type of notification
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory);
+ // Handle of the immediate persistence worker thread.
+ static HANDLE m_hNSImmediatePersistenceThread; // NOLINT (readability/naming)
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SaveDataToNor
+ /// Saves the persistent data to nor
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SaveDataToNor(PVOID f_pmessage,
+ const UI_32 f_msgsize);
+
+ UI_32 m_uiDelay; // Time Delay between persistence on NOR
+
+ EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h
new file mode 100755
index 0000000..aaa6992
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h
@@ -0,0 +1,221 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStateNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_notification.h"
+
+class CPersistentData;
+
+/**
+ * This class inherits CNotification class and implements state and persistent notification
+ * related operations.
+ */
+class CStateNotification : public CNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStateNotification
+ /// Constructor of CStateNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStateNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStateNotification
+ /// Destructor of CStateNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CStateNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventReciever
+ /// This function adds the name of the application to receiver list of particular notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentData
+ /// This function get the data related to notification
+ ///
+ /// \param
+ ///
+ /// \return CPersistentData
+ // CPersistentData - notification data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ const CPersistentData *GetPersistentData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentData
+ /// This function is used to set the data related to notification
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SetPersistentData(PVOID f_pmessage,
+ const UI_32 f_msgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDefaultPersistentData
+ /// This function get the default data(if any) related to notification
+ ///
+ /// \param
+ ///
+ /// \return CPersistentData
+ // CPersistentData - notification data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ const CPersistentData *GetDefaultPersistentData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDefaultPersistentData
+ /// This function is used to set the default data related to notification
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SetDefaultPersistentData(PVOID f_pmessage,
+ const UI_32 f_msgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsPublished
+ /// This functions returns the published status of notification.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - returns true if published before
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsPublished();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetMaxMessageSize
+ /// This function reset the max size of data that can be published with notification.
+ /// Also deletes the old persistent data and default data.
+ ///
+ /// \param [IN] f_uilength
+ /// std::string - Max size for notification data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ResetMaxMessageSize(const UI_32 f_uilength);
+
+ protected:
+ CPersistentData *m_pData; ///< persistent data of notification
+
+ CPersistentData *m_pDefaultData; ///< persistent data of notification
+
+ BOOL m_bWasPublished; ///< Flag to check whether publisher had published notification
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetData
+ /// This function is used to set the persistent data
+ ///
+ /// \param [IN] f_pdata
+ /// CPersistentData - persistent data ptr
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetData(CPersistentData *f_pdata,
+ PVOID f_pmessage,
+ const UI_32 f_msgsize);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h
new file mode 100755
index 0000000..1123941
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStatePersistenceNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <string>
+#include "ns_npp_state_notification.h"
+
+/**
+ * This class inherits CStateNotification class and implements specific operations related to
+ * persistent notifications.
+ */
+class CStatePersistenceNotification : public CStateNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStatePersistenceNotification
+ /// Constructor of CStatePersistenceNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStatePersistenceNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize,
+ const EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStatePersistenceNotification
+ /// Destructor of CStatePersistenceNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CStatePersistenceNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentCategory
+ /// Gets the persist type of notification
+ ///
+ ///
+ /// \return EFrameworkunifiedPersistCategory
+ // EFrameworkunifiedPersistCategory - persist type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedPersistCategory GetPersistentCategory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persist type of notification
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ private:
+ EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_NOTIFICATION_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h
new file mode 100755
index 0000000..8423e3e
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h
@@ -0,0 +1,73 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStatePersistenceUserNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_USER_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_USER_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_state_notification.h"
+
+
+/**
+ * This class inherits CStateNotification class and implements specific operations related to
+ * persistent notifications specific to user.
+ */
+class CStatePersistenceUserNotification : public CStateNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStatePersistenceUserNotification
+ /// Constructor of CStatePersistenceUserNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStatePersistenceUserNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStatePersistenceUserNotification
+ /// Destructor of CStatePersistenceUserNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CStatePersistenceUserNotification();
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_USER_NOTIFICATION_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_threads.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_threads.h
new file mode 100755
index 0000000..042e857
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_threads.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_THREADS_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_THREADS_H_
+
+// name of threads
+#define NS_NPP_READ_THREAD_NAME "NS_NPPReadWkr"
+#define NS_NPP_WRITE_THREAD_NAME "NS_NPPWriteWkr"
+#define NS_NPP_IMMEDIATE_PERSIST_THREAD_NAME "NS_NPPIPWkr"
+#define NS_NPP_DATA_RESET_THREAD_NAME "NS_NPPDataRst"
+
+// priority of threads
+#define NS_NPP_READ_THREAD_PRIO 15
+#define NS_NPP_WRITE_THREAD_PRIO 15
+#define NS_NPP_IMMEDIATE_PERSIST_THREAD_PRIO 25
+#define NS_NPP_DATA_RESET_THREAD_PRIO 10
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_THREADS_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_types.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_types.h
new file mode 100755
index 0000000..79a44d7
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_types.h
@@ -0,0 +1,212 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
+
+#include <native_service/frameworkunified_sm_eventdata.h>
+#include <aglpath.h>
+#include <native_service/ns_np_types.h>
+
+// name of notification file to be saved in persistent memory depending on the persistent type category
+
+#define NOTIFICATIONFILE "PERSISTENT_NOTIFICATION" // stores user notification common to all user
+#define USERNOTIFICATIONFILE "USER_PERSISTENT_NOTIFICATION" // stores user notification specific to particular user
+#define FACTORYNOTIFICATIONFILE "FACTORY_NOTIFICATION" // stores factory notification
+#define FACTORYCUSTOMERNOTIFICATIONFILE "FACTORYCUSTOMER_NOTIFICATION" // stores factorycustomer notification
+#define DEALERNOTIFICATIONFILE "DEALER_NOTIFICATION" // stores dealer notification
+
+// name of persistence folder for persistent type categorization
+#define USERDATA "UserData" // name of folder contatining userdata
+#define FACTORYDATA "FactoryData" // name of folder contatining factory data
+#define FACTORYCUSTOMERDATA "FactoryCustomerData" // name of folder contatining factory customer data
+#define DEALERDATA "DealerData" // name of folder contatining dealer data
+
+// default user name for personalization
+#define DEFAULTUSERNAME "DefaultUser"
+
+// name of NSNPS version file
+#define VERSION_TXT "version.txt"
+
+#define STORAGE_PATH "/nv/BS/ns/npp/rwdata/"
+
+
+typedef enum ENPSLoadType {
+ LOADTYPE_NONE = -1,
+ LOADTYPE_RELEASE = 0, // load file to persistent memory
+ LOADTYPE_LOAD = 1, // load file to temporary memory
+ LOADTYPE_RELOAD = 2, // reload the file.
+} ENPS_Loadtype;
+
+/// \typedef ENotificationpersistentservicePersistType
+/// \brief Persist file types
+typedef enum ENotificationpersistentservicePersistType {
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST = 0, ///< Add values after this value only.
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE, ///< Persist a file to a persistent memory
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, ///< Persist a folder to a persistent memory
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTNONE, ///< no type
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST, ///< Add values before this value only.
+} ENotificationpersistentservicePersistType;
+
+typedef enum ENPSPersistenceJobState {
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE = 0, ///< Job is idle. // NOLINT (readability/naming)
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS = 1, ///< Job is in process. Either release or load. // NOLINT (readability/naming)
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED = 2, ///< Job release was aborted due to abort shutdown. // NOLINT (readability/naming)
+} ENPSPersistenceJobState;
+
+typedef CHAR CopyInfoStr[MAX_PATH_LENGTH]; ///< Information passed via the framework
+
+
+typedef enum ENPSCopyWorkerProtocol {
+ // > Command(s)
+ CP_WRK_CMD_START = 1500,
+ CP_WRK_CMD_STOP = 1501,
+ CP_WRK_CMD_COPY = 1502,
+ CP_WRK_CMD_RESUME = 1503, // This will release the thread from the abort command.
+
+ // < Command Ack(s)
+ CP_WRK_ACK_CMD_COMPLETE = 1504,
+
+ // < Notification(s)
+ CP_WRK_NTFY = 1505,
+
+ // < Shutdown request command
+ CMD_WRK_SHUTDOWN_REQ = 1506,
+ CMD_WRK_SHUTDOWN_ACK = 1507,
+
+ CMD_DELETE_OLD_DATA = 1508,
+
+ AR_CMD_START = 1400,
+ AR_CMD_STOP = 1401,
+ AR_CMD_ARCHIVE = 1402,
+ AR_CMD_RESUME = 1403, // This will release the thread from the abort command.
+
+ // < Command Ack(s)
+ AR_ACK_CMD_COMPLETE = 1404,
+
+ // < Notification(s)
+ AR_CMD_NTFY = 1405,
+
+ NOR_PERSISTENCE_TIMER_START = 1406,
+ NOR_PERSISTENCE_REGISTER = 1407,
+ NOR_PERSISTENCE_UNREGISTER = 1408,
+ // this cmd is used to tell the NOR thread to stop the timer
+ // for all the the notifications in case of userdata reset during shutdown
+ NOR_PERSISTENCE_ONSHUTDOWN = 1409,
+ // while to persist the data immediately irrespective of delay in case of shutdown without userdata reset.
+ // ack sent to NPPService main thread by Nor worker thread after persisting immediate data
+ NOR_PERSISTENCE_ONSHUTDOWN_ACK = 1410,
+ // message sent by main thread to immediate persistence thread
+ // to change the persistent category of immediate notification
+ NOR_PERSISTENCE_CHANGE_CATEGORY = 1411
+} ENSP_CopyWorkerProtocol, *PENSP_CopyWorkerProtocol, ENPS_ArchiveProtocol;
+
+
+typedef enum ENPSCopyWorkerFailures {
+ // > Failure codes(s)
+ CP_WRK_FAILURE_SRC_NOT_FND = 3500,
+ CP_WRK_FAILURE_DST_CREATE = 3501,
+ CP_WRK_FAILURE_ABORT_DURING_CP = 3502,
+ CP_WRK_FAILURE_ABORT_BEFORE_CP = 3503,
+ CP_WRK_FAILURE_WRITE_ERROR_CP = 3504,
+
+ AR_THREAD_FAILURE_SRC_NOT_FND = 3400,
+ AR_THREAD_FAILURE_DST_CREATE = 3401,
+ AR_THREAD_FAILURE_ABORT_DURING_ARCHIVE = 3402,
+ AR_THREAD_FAILURE_ABORT_BEFORE_ARCHIVE = 3403,
+} ENPS_CopyWorkerFailures, *PENPS_CopyWorkerFailures, ENPS_ArchiveFailures;
+
+typedef struct NPSCopyAckMsg {
+ ENSP_CopyWorkerProtocol m_eworkerprotocol; // Worker Load or Release Protocol Id
+} NSP_CopyAckMsg;
+
+typedef enum NotificationpersistentserviceCompressionType {
+ ENOTIFICATIONPERSISTENTSERVICENONE = 0, /// No Compression before file persistence
+ ENOTIFICATIONPERSISTENTSERVICEDEFAULTCOMPRESSION, /// Compress file before persistence using default compression method
+ ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ /// Compress file before persistence using libz
+} NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE;
+
+typedef struct NPSCopyInfoMsg {
+ CopyInfoStr m_csourcepath; // Source path
+ CopyInfoStr m_cdestinationpath; // Destination path
+ CopyInfoStr m_cpersistenttag; // Tag for Persistence
+ CopyInfoStr m_crequesterappname; // Requester Name
+ ENPS_Loadtype m_eloadtype; // Load to Persistent or Temporary Memory
+ ENotificationpersistentservicePersistType m_epersisttype; // Folder or File Persistence
+ NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_ecompressiontype; // Check for Compression of the file
+} NSP_CopyInfoCmd;
+
+typedef struct NPSCopyStatus {
+ BOOL m_bpersistencechk; // Persistence Success or Failure
+ ENPS_CopyWorkerFailures m_ecopyfailures; // Failure Protocol ID
+ CopyInfoStr m_cpersistenttag; // Tag for Persistence
+ CopyInfoStr m_crequesterappname; // Requester Name
+ ENPS_Loadtype m_eloadtype; // Load to Persistent or Temporary Memory
+ ENotificationpersistentservicePersistType m_epersisttype; // Folder or File Persistence
+ NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_ecompressiontype; // Check for Compression of the file
+} NSP_CopyStatusResponse, NSP_CopyCancel;
+
+
+// Structure for Nor Persistent Notification
+typedef struct TNorPersistenceNotifInfoHeader {
+ CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
+ UI_32 m_uimaxmsglength; ///< Maximum data length of notification
+ EFrameworkunifiedNotificationType m_epersistenttype; ///< type of notification
+ CHAR m_cpublishername[MAX_NAME_SIZE_APP]; ///< Service Name
+ UI_32 m_uimsgsize; ///< length of message
+ UI_32 m_uidelay; ///< Time delay between persistence
+ EFrameworkunifiedPersistCategory m_epersistcategory; ///< Persistent Category
+} TNorPersistenceNotifInfoHeader;
+
+typedef struct _TImmediatePersistenceRegisterNotifInfo { // NOLINT (readability/naming)
+ CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
+ UI_32 m_uidelay; ///< Time delay between persistence
+ EFrameworkunifiedPersistCategory m_epersistcategory; ///< Persistent Category
+} TImmediatePersistenceRegisterNotifInfo;
+
+typedef struct _TImmediatePersistenceUnregisterNotifInfo { // NOLINT (readability/naming)
+ CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
+} TImmediatePersistenceUnregisterNotifInfo;
+
+typedef struct _NPS_CopyShutdown { // NOLINT (readability/naming)
+ CopyInfoStr m_crequesterappname;
+} NSP_CopyShutdown, NSP_CopyShutdownAck;
+
+typedef struct _TImmediatePersistenceChangeCategory { // NOLINT (readability/naming)
+ TNorPersistenceNotifInfoHeader m_tnornotifInfoheader; ///< Notification info with new persist category type
+ EFrameworkunifiedPersistCategory m_eoldpersistcategory; ///< Old Persistent Category of notification
+} TImmediatePersistenceChangeCategory;
+
+typedef struct _TImmediateShutdown { // NOLINT (readability/naming)
+ EFrameworkunifiedShutdownType f_eshutdowntype;
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag;
+} TImmediateShutdown;
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/app_states.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/app_states.cpp
new file mode 100755
index 0000000..c54508b
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/app_states.cpp
@@ -0,0 +1,2684 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of internal transitions of state machine
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <unistd.h>
+#include <native_service/ns_np_service.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_notification.h>
+#include <string>
+#include <vector>
+#include "app_states.h"
+#include "ns_npp.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_notification_manager.h"
+#include "ns_npp_persistence_manager.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_personalization_manager.h"
+
+
+#ifdef NPP_PROFILEINFO_ENABLE
+#include <ns_npp_profiling_protocols_internal.h>
+#endif
+
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+#endif
+
+static size_t NppUIToA(unsigned int value, char *buf) {
+ static const char c[] = "0123456789";
+ char b[12];
+ char *p = b + sizeof(b);
+ int i = 0;
+
+ *--p = '\0';
+ do {
+ *--p = c[value % 10];
+ value /= 10;
+ ++i;
+ } while (value);
+ strcpy(buf, p); // NOLINT (runtime/printf)
+
+ return i;
+}
+
+static size_t NppStrlcpy(char *dst, const char *src, size_t siz) {
+ size_t ret = strlen(src);
+
+ if (siz) { // LCOV_EXCL_BR_LINE 6: siz can't be 0
+ size_t len = (ret >= siz) ? siz - 1 : ret;
+ memcpy(dst, src, len);
+ dst[len] = '\0';
+ }
+ return ret;
+}
+
+#define NPP_SET_FIXSTR(buf, str) \
+ do { \
+ strcpy(buf, str); /* NOLINT (runtime/printf) */ \
+ buf += sizeof(str) - 1; \
+ } while (0)
+
+#define NPP_SET_VARSTR(buf, str, siz) \
+ buf += NppStrlcpy(buf, str, siz)
+
+extern CHAR g_csendreadyackto[];
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPRegisterNotifications
+/// The state machine executes this transition when event for registering notification is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterNotifications) { // NOLINT (readability/naming)
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_register_multiple_notif_msg *l_pMsg = NULL;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get app name of message source
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register notifications. Invalid message length received."); // LCOV_EXCL_LINE 6: l_uiMsgLength must be greater than 0 // NOLINT[whitespace/line_length]
+ } else {
+ std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(
+ l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) {
+ l_pMsg = reinterpret_cast<NC_register_multiple_notif_msg *>(&l_vData[0]);
+
+ if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
+ NC_register_notif_msg *l_pEventInfo = NULL;
+
+ // register all the notifications
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_pMsg->numNotifications;
+ ++l_uiCount) {
+ l_pEventInfo = &l_pMsg->notifierList[l_uiCount];
+
+ if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Register Notfn request, src=%s, name=%s, len=%d, type=%d",
+ l_cMsgSource, l_pEventInfo->notificationName, l_pEventInfo->maxLength, l_pEventInfo->persType);
+
+ // register the notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(l_cMsgSource,
+ l_pEventInfo->notificationName,
+ l_pEventInfo->maxLength,
+ l_pEventInfo->persType)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnRegisterEvents :: %s", l_pEventInfo->notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register notification from source %s. l_pEventInfo is NULL", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid src mq"); // LCOV_EXCL_LINE 6: l_pMsg can't be NULL
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register notifications from source %s, Unable to get message data. Error Status: 0x%x",
+ l_cMsgSource, l_estatus);
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pNotificationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSubscribeToNotification
+/// The state machine executes this transition when event for subscribing single notification is
+/// triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotification) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_subscribe_msg l_objSubscribeMsg;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_subscribe_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // get the data received
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_objSubscribeMsg), sizeof(NC_subscribe_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+#ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
+ char buf[128];
+ char *p = buf;
+ NPP_SET_FIXSTR(p, "Subscribing Notfn request, src=");
+ NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
+ NPP_SET_FIXSTR(p, ", name=");
+ strcpy(p, l_objSubscribeMsg.notificationName); // NOLINT (runtime/printf)
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
+ /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ * "Subscribing Notfn request, src=%s, name=%s",
+ * l_cMsgSource, l_objSubscribeMsg.notificationName);*/
+#endif // ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
+
+ // subscribe for notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnSubscribeToEvent(
+ l_cMsgSource,
+ l_objSubscribeMsg.notificationName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnSubscribeToEvent :: %s", l_objSubscribeMsg.notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't subscribe to notification from source %s. Unable to get msg data, status: 0x%x",
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't subscribe to notification from source %s. Invalid message length received.",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't subscribe to notification from source %s. l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSubscribeToNotifications
+/// The state machine executes this transition when event for subscribing multiple notification is
+/// triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotifications) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_subscribe_multiple_notif_msg *l_pMsg = NULL;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
+ // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid msg len");
+ // LCOV_EXCL_STOP
+ } else {
+ std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the data received
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_pMsg = reinterpret_cast<NC_subscribe_multiple_notif_msg *>(&l_vData[0]);
+
+ if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
+ NC_subscribe_msg *l_pEventInfo = NULL;
+
+ // subscribe to multiple notifications
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_pMsg->numNotifications;
+ ++l_uiCount) {
+ l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
+
+ if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
+#ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
+ char buf[128];
+ char *p = buf;
+ NPP_SET_FIXSTR(p, "Subscribe Notfn request, src=");
+ NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
+ NPP_SET_FIXSTR(p, ", name=");
+ strcpy(p, l_pEventInfo->notificationName); // NOLINT (runtime/printf)
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
+ /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "Subscribe Notfn request, src=%s, name=%s",
+ l_cMsgSource,
+ l_pEventInfo->notificationName);*/
+#endif // ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
+
+ // subscribe to notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnSubscribeToEvent(
+ l_cMsgSource,
+ l_pEventInfo->notificationName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnSubscribeToEvent :: %s", l_pEventInfo->notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to subscribe to notifications from source %s, l_pEventInfo is NULL", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pMsg can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to subscribe to notifications from source %s, Invalid src mq", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+
+ l_vData.clear();
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to subscribe to notifications from source %s, error retrieving message data, status: 0x%x",
+ l_cMsgSource,
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to subscribe to notifications from source %s, l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPPublishNotification
+/// The state machine executes this transition when event for publishing notification is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishNotification) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+
+ CHAR l_cData[MAX_SYS_INFO_SIZE];
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get the app name of message source
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ // retrieve notification name
+ FrameworkunifiedGetSystemInfo(l_pHApp, l_cData);
+
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ char buf[144];
+ char *p = buf;
+ NPP_SET_FIXSTR(p, "Publish Notfn request, src=");
+ NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
+ NPP_SET_FIXSTR(p, ", name=");
+ NPP_SET_VARSTR(p, l_cData, sizeof(buf) - (p - buf));
+ NPP_SET_FIXSTR(p, ", len=");
+ NppUIToA(l_uiMsgLength, p);
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
+ /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "Publish Notfn request, src=%s, name=%s, len=%d",
+ l_cMsgSource, l_cData, l_uiMsgLength);*/
+
+ if (0 != l_uiMsgLength) {
+ std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], static_cast<UI_32>(pMsgData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // publish the notification
+ (VOID)l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(l_cMsgSource, l_cData,
+ (PVOID)&pMsgData[0], l_uiMsgLength);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't publish notification from source %s, Unable to get messsage data, Error Status: 0x%x",
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP 4: NSFW error case
+ }
+ } else {
+ // publish the notification
+ (VOID)l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(l_cMsgSource, l_cData, NULL, l_uiMsgLength);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't publish notification from source %s. l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPUnSubscribeFromNotification
+/// The state machine executes this transition when event for unsubscribing notification is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotification) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_unsubscribe_frm_notif_msg unsubscribeMsg;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get the msg source name
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 200: l_pNotificationManager can't be NULL
+ if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_unsubscribe_frm_notif_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&unsubscribeMsg), sizeof(NC_unsubscribe_frm_notif_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source: %s is unsubscribing from notification: %s", l_cMsgSource,
+ unsubscribeMsg.notificationName);
+
+ // unsubscribe from notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnSubscribeFromEvent(
+ l_cMsgSource,
+ unsubscribeMsg.notificationName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnUnSubscribeFromEvent :: %s",
+ unsubscribeMsg.notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "%s is unable to subscribe from notification, error getting message data, status: 0x%x",
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe to notification from source %s, Invalid Message size received.",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe to notification from source %s, l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPUnSubscribeFromNotification
+/// The state machine executes this transition when event for unsubscribing notification is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotifications) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_unsubscribe_multiple_notif_msg *l_pMsg = NULL;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
+ // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe from notifications from source %s. Invalid message length received",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ } else {
+ std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the data received
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_pMsg = reinterpret_cast<NC_unsubscribe_multiple_notif_msg *>(&l_vData[0]);
+
+ if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
+ NC_unsubscribe_frm_notif_msg *l_pEventInfo = NULL;
+
+ // subscribe to multiple notifications
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_pMsg->numNotifications;
+ ++l_uiCount) {
+ l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
+
+ if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source: %s is unsubscribing from notification: %s", l_cMsgSource,
+ l_pEventInfo->notificationName);
+
+ // unsubscribe from notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnSubscribeFromEvent(
+ l_cMsgSource,
+ l_pEventInfo->notificationName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnUnSubscribeFromEvent :: %s", l_pEventInfo->notificationName);
+ }
+
+ } else {
+ // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe from notifications from source %s. l_pEventInfo is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pMsg can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe from notifications from source %s. Invalid src mq", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+
+ l_vData.clear();
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe from notifications from source %s, error getting message data, status: 0x%x",
+ l_cMsgSource,
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unsubscribe from notifications from source %s. l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPUnRegisterNotifications
+/// The state machine executes this transition when event for unregistering notifications is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnRegisterNotifications) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_unregister_multiple_notif_msg *l_pMsg = NULL;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get the source name
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
+ // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unregister to notifications from source %s. Invalid message length received.",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ } else {
+ std::vector<CHAR>l_vData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_pMsg = reinterpret_cast<NC_unregister_multiple_notif_msg *>(&l_vData[0]);
+
+ // unregister multiple notifications
+ if (NULL != l_cMsgSource && NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_cMsgSource and l_pMsg can't be NULL
+ NC_unregister_notif_msg *l_pEventInfo = NULL;
+
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_pMsg->numNotifications;
+ ++l_uiCount) {
+ l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
+
+ if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source %s is unregistering to notification %s", l_cMsgSource,
+ l_pEventInfo->notificationName);
+
+ // unregister notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnRegisterEvents(
+ l_cMsgSource,
+ l_pEventInfo->notificationName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnUnRegisterEvents :: %s", l_pEventInfo->notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unregister to notifications from source %s, l_pEventInfo is NULL", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_cMsgSource and l_pMsg can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unregister to notificationsfrom source %s, Invalid src mq ", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+
+ l_vData.clear();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unregister to notifications from source %s, Unable to get message data, status: 0x%x",
+ l_cMsgSource, l_estatus);
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't unregister to notifications from source %s, l_pNotificationManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPReadPersistedData
+/// The state machine executes this transition when event for getting notification's persistent data
+/// is triggered.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPReadPersistedData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_get_pers_data_msg l_tMsg;
+
+ l_tMsg.notificationName[0] = '\0';
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_get_pers_data_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // get the message data received
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(NC_get_pers_data_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Source %s is requesting to read data for persistent notification %s",
+ l_cMsgSource, l_tMsg.notificationName);
+ // get persistent data related to notification
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceServiceOnGetPersistentData(
+ l_tMsg.notificationName,
+ l_cMsgSource))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in NotificationpersistentserviceServiceOnGetPersistentData :: %s", l_tMsg.notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't read persistent data for source %s, Error getting message data, status: 0x%x",
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't read persistent data for source %s. Invalid Message size received.",
+ l_cMsgSource);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't read persistent data for source %s. l_pNotificationManager is NULL",
+ l_cMsgSource);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ // if any error occurs while reading persistent data, send failed ack to the requestor
+ if (eFrameworkunifiedStatusOK != l_estatus) {
+ HANDLE l_hReceiverMq = McOpenSender(l_cMsgSource);
+ if (NULL != l_hReceiverMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ NC_get_persdata_failed_ack gpdFailed = {};
+ std::strncpy(&gpdFailed.notificationName[0], l_tMsg.notificationName, MAX_STRING_SIZE_NOTIFICATION);
+
+ // send the failure ack to requester
+ l_estatus = McSend(l_hReceiverMq, AppName, NPS_GET_PERS_DATA_FAILED_ACK, sizeof(gpdFailed), &gpdFailed); // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "Sent NPS_GET_PERS_DATA_FAILED_ACK to %s. Status: %d.",
+ l_cMsgSource, l_estatus);
+
+ McClose(l_hReceiverMq);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in opening sender queue of %s. Can't send NPS_GET_PERS_DATA_FAILED_ACK",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPPublishImmediateNotification
+/// This transition is executed when service updates the immediate notification data
+/// using synchronous API
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishImmediateNotification) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ // get the app name of message source
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+ CHKNULL(l_pNotificationManager);
+
+ CHAR l_cNotfName[MAX_SYS_INFO_SIZE] = {};
+
+ // retrieve notification name
+ (VOID)FrameworkunifiedGetSystemInfo(l_pHApp, l_cNotfName);
+
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Warning::Notification %s published using sync API by %s, Data length: %d",
+ l_cNotfName,
+ l_cMsgSource, l_uiMsgLength);
+
+ if (0 != l_uiMsgLength) {
+ std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], l_uiMsgLength, eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // publish the notification
+ (VOID)l_pNotificationManager->NotificationpersistentservicePublishImmediateNotification(l_cMsgSource, l_cNotfName, (PVOID)&pMsgData[0],
+ l_uiMsgLength);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't publish notification %s from source %s, Unable to get messsage data, Error Status: 0x%x",
+ l_cNotfName,
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // publish the notification
+ (VOID)l_pNotificationManager->NotificationpersistentservicePublishImmediateNotification(l_cMsgSource, l_cNotfName, NULL, l_uiMsgLength);
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPPersistentSync
+/// Processing which synchronizes by NPPService (syncfs)
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPersistentSync) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ if (TRUE == l_pnsnpp->Syncfs()) { // LCOV_EXCL_BR_LINE 6: always return true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "syncfs are processed."); // LCOV_EXCL_LINE 6: always return true
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPReleaseFileAck) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ NSP_CopyStatusResponse l_tCpStatus = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, (PVOID)&l_tCpStatus, sizeof(l_tCpStatus), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s for tag: %s sender: %s, persist type:%d",
+ (l_tCpStatus.m_bpersistencechk ? "Successful copy" : "Non-Successful copy"),
+ l_tCpStatus.m_cpersistenttag, l_tCpStatus.m_crequesterappname, l_tCpStatus.m_eloadtype);
+
+ if (LOADTYPE_LOAD == l_tCpStatus.m_eloadtype) { // ack for load file/folder
+ HANDLE hMq = NULL;
+ NC_LoadPersistedAck l_tMsgAck = {};
+
+ // HANDLE hMq = McOpenSender(l_tCpStatus.sender);
+ hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_tCpStatus.m_crequesterappname);
+
+ // send NC_LoadPersistedAck to the requester
+ l_tMsgAck.eStatus = (TRUE == l_tCpStatus.m_bpersistencechk) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
+
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_tMsgAck.cTag, l_tCpStatus.m_cpersistenttag, sizeof(l_tMsgAck.cTag));
+#endif
+
+ if (NULL == hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // catastrophic failure!
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s ", l_tCpStatus.m_crequesterappname); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ } else {
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == l_tCpStatus.m_epersisttype) {
+ // send ack to requester for file successfully persisted
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR :: Sending NPS_GET_PERS_FILE_ACK message to %s", l_tCpStatus.m_crequesterappname);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "NPS_GET_PERS_FILE_ACK is sent to %s for file tag %s and load status: %d.",
+ l_tCpStatus.m_crequesterappname, l_tMsgAck.cTag, l_tMsgAck.eStatus);
+ }
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == l_tCpStatus.m_epersisttype) { // LCOV_EXCL_BR_LINE 6: m_epersisttype must be ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE or ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER // NOLINT[whitespace/line_length]
+ // send ack to requester for folder successfully persisted
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_GET_PERS_FOLDER_ACK, sizeof(l_tMsgAck), &l_tMsgAck)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR :: Sending NPS_GET_PERS_FOLDER_ACK message to %s", l_tCpStatus.m_crequesterappname);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "NPS_GET_PERS_FOLDER_ACK is sent to %s for folder tag %s and load status: %d.",
+ l_tCpStatus.m_crequesterappname, l_tMsgAck.cTag, l_tMsgAck.eStatus);
+ }
+ } else {
+ // do nothing
+ }
+ // close mq
+ FrameworkunifiedMcClose(hMq);
+ hMq = NULL;
+ }
+ }
+
+ // Update registry
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ if (l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: unexpected branch can't be NULL
+ l_pPersistenceManager->AckReceivedFromWorker(l_tCpStatus.m_crequesterappname,
+ l_tCpStatus.m_cpersistenttag,
+ l_tCpStatus.m_epersisttype,
+ l_tCpStatus.m_bpersistencechk,
+ l_tCpStatus.m_eloadtype);
+ }
+
+ if (LOADTYPE_RELEASE == l_tCpStatus.m_eloadtype) {
+ f_pSourceState->FrameworkunifiedPostEvent(EVENT(evCheckAllFilesPersisted));
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR ::invalid length FrameworkunifiedGetMsgDataOfSize expected(%ld)", static_cast<long int>(sizeof(l_tCpStatus))); // NOLINT (runtime/int)
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnSaveDataAck) { // LCOV_EXCL_START 6: unused code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnUserChange
+/// The state machine executes this transition when event to set or change personality is received
+/// from the system.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnUserChange) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ try {
+ CHKNULL(f_pSourceState);
+ NC_User l_tMsg;
+ std::string l_cCurrentUsername;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ // TODO(my_username): Only accept user change from authorized app. Compare l_cMsgSource with authorized source.
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(NC_User), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: l_pnsnpp can't be NULL
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ CnotificationpersistentservicePersonalizationManager *l_pPersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+
+ if (NULL != l_pPersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersonalizationManager can't be NULL
+ l_pPersonalizationManager->NotificationpersistentserviceGetPersonality(l_cCurrentUsername);
+ }
+
+ // writes the temporary user files and folders to permanent memory
+ if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
+ if (!l_cCurrentUsername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_cCurrentUsername can't be empty
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentservicePersistAllUserRequests()) { // LCOV_EXCL_BR_LINE 6: NotificationpersistentservicePersistAllUserRequests will always return ok // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while persisting user files and folders."); // LCOV_EXCL_LINE 6: NotificationpersistentservicePersistAllUserRequests will always return ok // NOLINT[whitespace/line_length]
+ }
+ }
+ }
+
+ // save the user persistent notification data
+ if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentserviceSaveNotificationPersistentData(eFrameworkunifiedPersistedStateUserVar)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while NotificationpersistentserviceSaveNotificationPersistentData");
+ }
+ }
+
+ // set new personality
+ SetPersonality(l_pHApp, l_tMsg);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "Cannot set new personality, error getting message data, status: 0x%x", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+// ===========Shutdown
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnShutdownTimeout) { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+// LCOV_EXCL_STOP
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceCheckAllReleaseRequestsProcessed) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ CHKNULL(l_pPersistenceManager);
+ if (TRUE == l_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: always return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All release requests are processed.");
+ f_pSourceState->FrameworkunifiedPostEvent(EVENT(evIdle));
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceReInitShutdownTimer) { // LCOV_EXCL_START 8: not be used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+// LCOV_EXCL_STOP
+
+CsNotificationpersistentserviceNPPStart::CsNotificationpersistentserviceNPPStart(std::string f_strName): CFrameworkunifiedOrthogonalState(f_strName) {
+}
+
+CsNotificationpersistentserviceNPPStart::~CsNotificationpersistentserviceNPPStart() { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CsNotificationpersistentserviceNPPStart::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // Get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ NC_User l_tMsg = {};
+
+ // register the user change notification
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(AppName, // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ NTFY_NPPService_UserChange,
+ sizeof(NC_User),
+ eFrameworkunifiedPersistedStateVar)) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in user change notification registration."); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ }
+
+ // Set initial user. By default, NS_NPPService will set the current user as last user. If no
+ // last user found set the default user.
+ UI_32 l_uiUserNotificationDataSize = 0;
+ EFrameworkunifiedStatus l_eGetNotificationDataStatus = eFrameworkunifiedStatusFail;
+ l_eGetNotificationDataStatus = l_pNotificationManager->NPGetPersistentNotificationData(
+ NTFY_NPPService_UserChange,
+ (PVOID)&l_tMsg,
+ sizeof(l_tMsg));
+
+ if ((eFrameworkunifiedStatusOK != l_eGetNotificationDataStatus) || (l_uiUserNotificationDataSize <= 0)) {
+ // set default user
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_tMsg.cUsername, DEFAULTUSERNAME, sizeof(l_tMsg.cUsername));
+#endif
+ }
+
+ l_estatus = SetPersonality(l_pHApp, l_tMsg);
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return l_estatus;
+}
+
+EFrameworkunifiedStatus SetPersonality(HANDLE l_pHApp, NC_User &f_tMsg) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: l_pnsnpp can't be NULL
+ // Get the instance of personalization manager
+ CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+
+ if (NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationpersistentservicePersonalizationManager can't be NULL
+ // send msg to all notificationpersistentservice apps that user has change.
+ // register user change notification
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality :: %s", f_tMsg.cUsername);
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceSetPersonality(f_tMsg.cUsername))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Personality not set in Personality Manager :: user : %s", f_tMsg.cUsername);
+ } else {
+ // Get the instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
+ l_pPersistenceManager->SetUserPersistentPath(f_tMsg.cUsername);
+
+ // save the user persistent notification data
+ if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentserviceLoadPersistentNotificationData(eFrameworkunifiedPersistedStateUserVar)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while loading user specific notification data.");
+ }
+
+ // Get instance of notification manager
+ CNotificationManager *l_pNotificationManager = NULL;
+ l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ // publish the user change notification
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(AppName, NTFY_NPPService_UserChange, (PVOID)&f_tMsg, sizeof(f_tMsg)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in publish user change event."); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ }
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationpersistentservicePersonalizationManager is NULL"); // LCOV_EXCL_LINE 6: l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return l_estatus;
+}
+
+EFrameworkunifiedStatus CsNotificationpersistentserviceNPPStart:: FrameworkunifiedOnExit(CEventDataPtr f_peventdata) { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+}
+
+CsNotificationpersistentserviceShutdownDataSave::CsNotificationpersistentserviceShutdownDataSave(std::string f_strName): CFrameworkunifiedLeafState(f_strName) {
+}
+
+CsNotificationpersistentserviceShutdownDataSave::~CsNotificationpersistentserviceShutdownDataSave() { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CsNotificationpersistentserviceShutdownDataSave::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ m_cShutdownRequestor = l_cMsgSource;
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "NS_NPP received STOP message from %s.", l_cMsgSource);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: can't be NULL
+ CShutDownMsgData *l_pMsgData = dynamic_cast<CShutDownMsgData *>(f_peventdata.get());
+ CHKNULL(l_pMsgData);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Shutdown Type=%d, Data received with shutdown message:: %x",
+ l_pMsgData->m_eShutdownType, l_pMsgData->m_uiMsgData);
+
+ // save the persistent data on shutdown
+ if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentservicePersistAll(l_pMsgData->m_eShutdownType, l_pMsgData->m_uiMsgData)) { // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in NotificationpersistentserviceOnSavePersistentData"); // LCOV_EXCL_LINE 6: always return ok
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CsNotificationpersistentserviceShutdownDataSave:: FrameworkunifiedOnExit(CEventDataPtr f_peventdata) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ try {
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ CHKNULL(l_pPersistenceManager);
+
+ l_pPersistenceManager->ResetPersistFlag();
+
+ // before sending shutdown ack, synchronize all the modified block buffers by NPPService for writing
+ l_pnsnpp->Syncfs();
+
+ // Send shutdown ack response to requester
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Sending shutdown complete message to requestor %s.",
+ m_cShutdownRequestor.c_str());
+ HANDLE hMq = FrameworkunifiedMcOpenSender(l_pHApp, m_cShutdownRequestor.c_str());
+ if (NULL != hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_NPP_STOP_ACK, 0, NULL)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error sending shutdown complete message to requestor %s.",
+ m_cShutdownRequestor.c_str());
+ // LCOV_EXCL_STOP
+ }
+ FrameworkunifiedMcClose(hMq);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in OpenSender for requestor %s.", m_cShutdownRequestor.c_str()); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnRegisterPersistentFile
+/// The state machine executes this transition when event for registering persistent file tag is
+/// received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFile) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+ NC_RegisterPersistentFileMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ std::string l_cName;
+ l_cName = l_tMsg.cFileTag;
+
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRegister(l_cMsgSource, // LCOV_EXCL_BR_LINE 6: always return ok
+ l_tMsg.cFileTag,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
+ // l_tMsg.eRegisterType,
+ l_tMsg.bIsUserFile)) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Registering Persitence File :: %s", l_tMsg.cFileTag); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Registered File %s as TO BE PERSISTED for %s",
+ l_tMsg.cFileTag, l_cMsgSource);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent file. Invalid message size received."); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent file. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnReleasePersistentFile
+/// The state machine executes this transition when event for releasing persistent file tag is
+/// received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFile) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ // Check if persistence has been disabled than return immediately
+ if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return f_pSourceState; // LCOV_EXCL_LINE 6: custom command line options
+ }
+
+ CHKNULL(f_pSourceState);
+ NC_ReleasePersistentFileMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get the instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ // get the instance of persistence manager
+ CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // Check if the filetag is registered as user specific persistence
+ if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFileTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
+ if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRelease(l_cMsgSource,
+ l_tMsg.cFileTag,
+ l_tMsg.cFilePath,
+ l_tMsg.eFrameworkunifiedReleaseType, // NOLINT (readability/naming)
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
+ l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in releasing persitence file :: %s", l_tMsg.cFileTag);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Release file %s to tag %s for source %s",
+ l_tMsg.cFilePath, l_tMsg.cFileTag, l_cMsgSource);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent file. Invalid message size received"); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent file. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnLoadPersistentFile
+/// The state machine executes this transition when event for loading persistent file is received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFile) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+ NC_LoadPersistedFileMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+ // get the instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Load file %s that was PERSISTED by %s with tag %s",
+ l_tMsg.cFilePath, l_cMsgSource, l_tMsg.cFileTag);
+
+ // Check if the filetag is registered as user specific persistence
+ if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFileTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
+ if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+ }
+ }
+
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ NC_LoadPersistedAck l_tMsgAck = {};
+
+ HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
+
+ if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ //// Check if persistence has been disabled than send positive acknowledgement to the application
+ if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: custom command line options
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_tMsgAck.eStatus = eFrameworkunifiedStatusOK;
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_tMsgAck.cTag, l_tMsg.cFileTag, sizeof(l_tMsgAck.cTag));
+#endif
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pPersistenceManager->NotificationpersistentserviceLoad(l_cMsgSource,
+ l_tMsg.cFileTag,
+ l_tMsg.cFilePath,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
+ l_tMsg.cUsername))) {
+ if (eFrameworkunifiedStatusFileLoadSuccess == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus can't be eFrameworkunifiedStatusFileLoadSuccess // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_tMsgAck.eStatus = eFrameworkunifiedStatusOK; // LCOV_EXCL_LINE 6: l_estatus can't be eFrameworkunifiedStatusFileLoadSuccess
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Loading Persitence File :: %s", l_tMsg.cFileTag);
+
+ // return error to requester
+ l_tMsgAck.eStatus = l_estatus;
+ }
+
+ std::strncpy(l_tMsgAck.cTag, l_tMsg.cFileTag, (MAX_PATH_LENGTH - 1));
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "NPS_GET_PERS_FILE_ACK is sent to %s. File load status: %d, "
+ "message sent status: %d ", l_cMsgSource, l_tMsgAck.eStatus, l_estatus);
+ }
+ }
+
+ FrameworkunifiedMcClose(l_hMq);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // catastrophic failure!
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent file. Invalid message size received."); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent file. l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnRegisterPersistentFolder
+/// The state machine executes this transition when event for registering persistent folder tag is
+/// received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFolder) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+ NC_RegisterPersistentFolderMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, // LCOV_EXCL_BR_LINE 4: NSFW error case
+ static_cast<PVOID>(&l_tMsg),
+ sizeof(l_tMsg),
+ eSMRRelease)) {
+ std::string l_cName;
+ l_cName = l_tMsg.cFolderTag;
+
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRegister(l_cMsgSource, // LCOV_EXCL_BR_LINE 6: always return ok
+ l_tMsg.cFolderTag,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
+ // l_tMsg.eRegisterType,
+ l_tMsg.bIsUserFolder)) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Registering Persitence Folder :: %s", l_tMsg.cFolderTag); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Registered Folder %s as TO BE PERSISTED for %s",
+ l_tMsg.cFolderTag, l_cMsgSource);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent folder. Invalid message size received.");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent folder.. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnLoadPersistentFolder
+/// The state machine executes this transition when event for loading persistent folder is received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFolder) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+ NC_LoadPersistedFolderMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+
+ // get the instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Load folder %s that was PERSISTED by %s with tag %s",
+ l_tMsg.cFolderPath, l_cMsgSource, l_tMsg.cFolderTag);
+
+ // Check if the foldertag is registered as user specific persistence
+ if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFolderTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
+ if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+ }
+ }
+
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ NC_LoadPersistedAck l_tMsgAck = {};
+ HANDLE l_hMq = NULL;
+ l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
+
+ if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ //// Check if persistence has been disabled than send positive acknowledgement to the application
+ if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: custom command line options
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_tMsgAck.eStatus = eFrameworkunifiedStatusOK;
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_tMsgAck.cTag, l_tMsg.cFolderTag, sizeof(l_tMsgAck.cTag));
+#endif
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq,
+ NPS_GET_PERS_FOLDER_ACK,
+ sizeof(l_tMsgAck), &l_tMsgAck))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pPersistenceManager->NotificationpersistentserviceLoad(l_cMsgSource,
+ l_tMsg.cFolderTag,
+ l_tMsg.cFolderPath,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
+ l_tMsg.cUsername))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Loading Persitence Folder :: %s", l_tMsg.cFolderTag);
+
+ // return error to requester
+ l_tMsgAck.eStatus = l_estatus;
+ std::strncpy(l_tMsgAck.cTag, l_tMsg.cFolderTag, (MAX_PATH_LENGTH - 1));
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, // LCOV_EXCL_BR_LINE 4: NSFW error case
+ NPS_GET_PERS_FOLDER_ACK,
+ sizeof(l_tMsgAck), &l_tMsgAck))) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ FrameworkunifiedMcClose(l_hMq);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't send ack NPS_GET_PERS_FOLDER_ACK. McOpenSender failed for %s ", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent folder. Invalid message size received.");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent folder. l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnReleasePersistentFolder
+/// The state machine executes this transition when event for releasing persistent folder tag is
+/// received.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFolder) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ // Check if persistence has been disabled than return immediately
+ if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options
+ // LCOV_EXCL_START 6: custom command line options
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+ // LCOV_EXCL_STOP
+ }
+
+ NC_ReleasePersistentFolderMsg l_tMsg = {};
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get the instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
+
+ if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // Check if the foldertag is registered as user specific persistence
+ if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFolderTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
+ if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+ }
+ }
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRelease(l_cMsgSource,
+ l_tMsg.cFolderTag,
+ l_tMsg.cFolderPath,
+ l_tMsg.eFrameworkunifiedReleaseType, // NOLINT (readability/naming)
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
+ l_tMsg.cUsername)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in releasing persitence folder :: %s", l_tMsg.cFolderTag);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Release Folder %s to tag %s for source %s",
+ l_tMsg.cFolderPath, l_tMsg.cFolderTag, l_cMsgSource);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent folder. Invalid message size received.");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent folder. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPGetReadyStatus
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPGetReadyStatus) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
+ if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_READYSTATUS_ACK, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __PRETTY_FUNCTION__, "NPP ready status sent to %s.", l_cMsgSource);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error sending NPS_GET_READYSTATUS_ACK to %s, status: %d", l_cMsgSource,
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+
+ FrameworkunifiedMcClose(l_hMq);
+ l_hMq = NULL;
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // catastrophic failure!
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s ", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterImmediateNotifications) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+ NC_register_multiple_immediate_notif_msg *l_pMsg = NULL;
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+
+ // get app name of message source
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
+ // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register immediate persistence notification from source %s. Invalid message length.",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ } else {
+ std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_pMsg = reinterpret_cast<NC_register_multiple_immediate_notif_msg *>(&l_vData[0]);
+
+ if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 5: reinterpret_cast's error case.
+ NC_register_immediate_notif_msg *l_pEventInfo = NULL;
+ UI_32 l_uiCount;
+ // register all the notifications
+ for (l_uiCount = 0 ; l_uiCount < l_pMsg->numNotifications; ++l_uiCount) {
+ l_pEventInfo = &l_pMsg->notifierList[l_uiCount];
+
+ if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Register immediate persistence notification: "
+ "NotificationName[%d] = %s, data length = %d ",
+ l_uiCount, l_pEventInfo->notificationName, l_pEventInfo->maxLength);
+
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(l_cMsgSource,
+ l_pEventInfo->notificationName,
+ l_pEventInfo->maxLength,
+ l_pEventInfo->persType,
+ l_pEventInfo->delay)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceServiceOnRegisterEvents :: %s", l_pEventInfo->notificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register immediate persistence notification from source %s. l_pEventInfo is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 5: reinterpret_cast's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register immediate persistence notification from source %s. Invalid src mq",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register immediate persistence notification from source %s, "
+ "Error getting message data, status: 0x%x",
+ l_cMsgSource, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't register immediate persistence notification from source %s. "
+ "l_pNotificationManager is NULL", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPClearPersistedData
+/// Deletes NPS Persistent Data and sends the ack back to requester
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPClearPersistedData) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+
+ // requeter MsgQ handle for sending Ack
+ HANDLE hRequesterAck = NULL;
+
+ // Application Handle
+ HANDLE l_pHApp = NULL;
+
+ // Received request data
+ NC_ClearPersistedDataReq l_tMsg = {};
+
+ // Ack structure
+ NC_ClearPersisteDatadAck l_tMsgAck = {};
+
+ // requester name
+ PCSTR pRequester = NULL;
+
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ pRequester = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(pRequester);
+
+ if (sizeof(NC_ClearPersistedDataReq) == FrameworkunifiedGetMsgLength(l_pHApp)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, (PVOID)(&l_tMsg), sizeof(NC_ClearPersistedDataReq), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Request for deleting the persistent data of type %d received from %s",
+ l_tMsg.ePersistenceData, pRequester);
+
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ CHKNULL(l_pPersistenceManager);
+
+ l_estatus = l_pPersistenceManager->ClearPersistenceData(l_tMsg.ePersistenceData);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize Error");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't delete persistent data. Invalid message size received.");
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ // sending acknowledgement to the requester
+
+ // create the requestor handle to send the ack
+ hRequesterAck = FrameworkunifiedMcOpenSender(l_pHApp,
+ pRequester);
+
+ if (NULL != hRequesterAck) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // set the status
+ l_tMsgAck.eStatus = l_estatus;
+
+ // send NC_ClearPersisteDatadAck to the requester
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hRequesterAck, // LCOV_EXCL_BR_LINE 4: NSFW error case
+ NPS_DELETE_PERSISTED_DATA_ACK,
+ sizeof(l_tMsgAck),
+ &l_tMsgAck)) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending NPS_GET_PERS_FILE_ACK message to %s", pRequester);
+ // LCOV_EXCL_STOP
+ }
+
+ // close handle
+ FrameworkunifiedMcClose(hRequesterAck);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedMcOpenSender failed for %s ", pRequester);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSetDefaultPersistentData
+/// Sets the default value of the persistent notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetDefaultPersistentData) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
+ UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
+
+ CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {};
+
+ // retrieve notification name
+ FrameworkunifiedGetSystemInfo(l_pHApp, l_cNotificationName);
+
+ if (0 != std::strlen(l_cNotificationName)) { // LCOV_EXCL_BR_LINE 6: double check, l_cNotificationName can't be empty // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "Set default value request for Notification:: %s from :: %s", l_cNotificationName,
+ l_cMsgSource);
+
+ if (0 != l_uiMsgLength) {
+ std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], static_cast<UI_32>(pMsgData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // set the default notification data
+ if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceSetDefaultPersistentNotificationData(l_cNotificationName,
+ (PVOID)&pMsgData[0],
+ l_uiMsgLength)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in NotificationpersistentserviceSetDefaultPersistentNotificationData :: %s", l_cNotificationName);
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to set default persistent notification data for %s, "
+ "Error retrieving data from message, status: 0x%x",
+ l_cNotificationName, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Not setting default persistent notification data for %s, Data length received is %d",
+ l_cNotificationName, l_uiMsgLength);
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_cNotificationName can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to Set DefaultPersistentNotificationData from source %s, Notification name is blank",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't set default value for notification from source %s, l_pNotificationManager is NULL", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSetNotfnPersistentType
+/// Sets the persist type of notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetNotfnPersistentType) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {};
+
+ // retrieve notification name
+ FrameworkunifiedGetSystemInfo(l_pHApp,
+ l_cNotificationName);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+
+ if (NULL != l_pNotificationManager && 0 != std::strlen(l_cNotificationName)) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL, l_cNotificationName can't be empty // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Set persist type request for Notification:: %s", l_cNotificationName);
+
+ EFrameworkunifiedPersistCategory ePersistCategory = eFrameworkunifiedUserData;
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &ePersistCategory, sizeof(EFrameworkunifiedPersistCategory), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // set the notification persist type
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceSetPersistentCategory(l_cNotificationName, // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
+ ePersistCategory))) {
+ // LCOV_EXCL_START 6: always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Setting PersistentType for notification :: %s, Status: 0x%x",
+ l_cNotificationName, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in getting the PersistentType message data for notification :: %s, Status: 0x%x",
+ l_cNotificationName, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL, l_cNotificationName can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't set persist type for notification :: %s", l_cNotificationName);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSetFilePersistentType
+/// Sets the persist type of file
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFilePersistentType) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
+ NC_SetFilePersistType l_tMsg = {};
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ if (0 != std::strlen(l_tMsg.cTag)) { // LCOV_EXCL_BR_LINE 6: double check, l_tMsg.cTag can't be empty
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "Set persist type request for file tag:: %s from %s", l_tMsg.cTag, l_cMsgSource);
+
+ // set the file persist type
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceSetPersistentCategory(l_cMsgSource,
+ l_tMsg.cTag,
+ l_tMsg.ePersistType,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in Setting FilePersistentType for tag:: %s for request from:: %s", l_tMsg.cTag,
+ l_cMsgSource);
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_tMsg.cTag can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "set file persistent type request for NULL file tag from source:: %s", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pPersistenceManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't process request for setting persist type for file from source: %s, l_pPersistenceManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPSetFolderPersistentType
+/// Sets the persist type of folder
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFolderPersistentType) {
+ try {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
+ NC_SetFolderPersistType l_tMsg = {};
+
+ // get the received data
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ if (0 != std::strlen(l_tMsg.cTag)) { // LCOV_EXCL_BR_LINE 6: double check, l_tMsg.cTag can't be empty
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Set persist type request for folder tag:: %s", l_tMsg.cTag);
+
+ // set the file persist type
+ if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceSetPersistentCategory(l_cMsgSource,
+ l_tMsg.cTag,
+ l_tMsg.ePersistType,
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error in Setting FolderPersistentType for tag:: %s for request from:: %s", l_tMsg.cTag,
+ l_cMsgSource);
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_tMsg.cTag can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "set file persistent type request for NULL folder tag from source:: %s", l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pPersistenceManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't process request for setting persist type for folder from source: %s, l_pPersistenceManager is NULL",
+ l_cMsgSource);
+ // LCOV_EXCL_STOP
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPShutdown
+/// Internal transition when NPP receives shutdown message
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPShutdown) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ try {
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ NC_StopMsgData l_tStopMsgData = {};
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tStopMsgData), sizeof(l_tStopMsgData), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // make a transition to sNotificationpersistentserviceShutdownDataSave state and pass the message data through event
+ CShutDownMsgData *l_pMsgData = new(std::nothrow) CShutDownMsgData(EVENT(evNPShutdownDataSave),
+ l_tStopMsgData.eShutdownType,
+ l_tStopMsgData.uiStopMsgData);
+ CHKNULL(l_pMsgData);
+
+ CEventDataPtr l_pData(l_pMsgData);
+ f_pSourceState->FrameworkunifiedPostEvent(l_pData);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Shutdown Message received from %s with data: %d", l_cMsgSource,
+ l_tStopMsgData.uiStopMsgData);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't process shutdown request from:: %s, Invalid message data", l_cMsgSource); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnNPNorDataSaveAck
+/// Internal transition when NPP receives shutdown ack message nor worker thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPNorDataSaveAck) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ try {
+ // data received with ack
+ UI_32 l_uiPersistCategoryFlag = 0;
+
+ CHKNULL(f_pSourceState);
+
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CHKNULL(l_pNotificationpersistentserviceHSM);
+
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+ CHKNULL(l_pPersistenceManager);
+
+ l_pPersistenceManager->SetImmediateDataPersistedStatus(TRUE);
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_uiPersistCategoryFlag), sizeof(l_uiPersistCategoryFlag), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "ShutdownAck received from %s with data: %d", l_cMsgSource,
+ l_uiPersistCategoryFlag);
+ }
+
+ // depending on the flag delete the persisted data from persistent memory
+ // which are not to be persisted during shutdown
+ l_pnsnpp->DeletePersistedDataFolder(l_uiPersistCategoryFlag);
+
+ if (TRUE == l_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: always return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All release requests are processed.");
+ f_pSourceState->FrameworkunifiedPostEvent(EVENT(evIdle));
+ }
+ } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+CsNotificationpersistentservicePersistenceReady::CsNotificationpersistentservicePersistenceReady(std::string f_strName): CFrameworkunifiedLeafState(f_strName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+}
+
+CsNotificationpersistentservicePersistenceReady::~CsNotificationpersistentservicePersistenceReady() { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CsNotificationpersistentservicePersistenceReady::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
+
+ if (NULL != l_pHApp) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, g_csendreadyackto);
+
+ if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // send ack to requester
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_NPP_READY_EVENT, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __PRETTY_FUNCTION__, "NPP ready status sent to %s.", g_csendreadyackto);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error sending NPS_NPP_READY_EVENT to %s, status: %d", g_csendreadyackto,
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ FrameworkunifiedMcClose(l_hMq);
+ l_hMq = NULL;
+ } else {
+ // catastrophic failure!
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "McOpenSender failed for %s ", g_csendreadyackto); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CsNotificationpersistentservicePersistenceReady::FrameworkunifiedOnExit(CEventDataPtr f_peventdata) { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+}
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfileNotifications) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ try {
+ CHKNULL(f_pSourceState);
+
+ // get the application handle
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ // get the statemachine pointer of application
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ // get the message source name
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get the message queue handle for sending the response
+ HANDLE hSrcMqHandle = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
+ CHKNULL(hSrcMqHandle);
+
+ // get instance of notification manager
+ CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
+ CHKNULL(l_pNotificationManager);
+
+ std::string l_cNotificationProfileInfo = "";
+
+ // get the data from notification manager
+ if (eFrameworkunifiedStatusOK == l_pNotificationManager->GetNotificationProfilingData(l_cNotificationProfileInfo)) {
+ UI_32 l_uiLength = l_cNotificationProfileInfo.size();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_NOTIFICATION_RESP Msg Length: %d", l_uiLength);
+
+ PCHAR l_pData = new CHAR[l_uiLength];
+ std::memset(l_pData, '0', l_uiLength);
+
+ std::strncpy(l_pData, l_cNotificationProfileInfo.c_str(), l_cNotificationProfileInfo.size());
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSrcMqHandle,
+ NPS_PROFILE_NOTIFICATION_RESP,
+ l_uiLength,
+ l_pData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
+ "FrameworkunifiedSendMsg NPS_PROFILE_NOTIFICATION_RESP for Notification Profiling failed.");
+ }
+
+ delete[] l_pData;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Failed to get Notification profiling data from NSNPP.");
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfilePersistence) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ try {
+ CHKNULL(f_pSourceState);
+
+ // get the application handle
+ HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
+ CHKNULL(l_pHApp);
+
+ // get the statemachine pointer of application
+ CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
+ CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
+ CHKNULL(l_pnsnpp);
+
+ // get the message source name
+ PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
+ CHKNULL(l_cMsgSource);
+
+ // get the message queue handle for sending the response
+ HANDLE hSrcMqHandle = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
+ CHKNULL(hSrcMqHandle);
+
+ // get instance of persistence manager
+ CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
+
+ CHKNULL(l_pPersistenceManager);
+
+ std::string l_cPersistenceProfileInfo = "";
+
+ if (eFrameworkunifiedStatusOK == l_pPersistenceManager->GetPersistenceProfilingData(l_cPersistenceProfileInfo)) {
+ UI_32 l_uiLength = l_cPersistenceProfileInfo.size();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_PERSISTENCE_RESP Msg Length: %d", l_uiLength);
+
+ PCHAR l_pData = new CHAR[l_uiLength];
+ std::memset(l_pData, '0', l_uiLength);
+
+ std::strncpy(l_pData, l_cPersistenceProfileInfo.c_str(), l_cPersistenceProfileInfo.size());
+
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSrcMqHandle,
+ NPS_PROFILE_PERSISTENCE_RESP,
+ l_uiLength,
+ l_pData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_PERSISTENCE_RESP for Persistence Profiling failed.");
+ }
+
+ delete[] l_pData;
+ }
+ } catch (std::exception &e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
+ f_pSourceState = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return f_pSourceState;
+}
+
+#endif
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp
new file mode 100755
index 0000000..c1b97f9
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp
@@ -0,0 +1,258 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_notification.h>
+
+#include "app_states.h"
+#include "ns_npp.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_persistence_manager.h"
+
+using std::malloc;
+
+#ifdef NPP_PROFILEINFO_ENABLE
+#include "ns_npp_profiling_protocols_internal.h"
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnInitialization
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE happ) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != happ) { // LCOV_EXCL_BR_LINE 4: happ can't be null
+ FrameworkunifiedProtocolEvent ns_npp_protocol_handlers[] = {
+ {NPS_REGISTER_EV_REQ, EVENT(evNPRegisterNotifications)},
+ {NPS_PUBLISH_EV_REQ, EVENT(evNPPublishNotification)},
+ {NPS_SUBSCRIBE_TO_EV_REQ, EVENT(evNPSubscribeToNotification)},
+ {NPS_BATCH_SUBSCRIBE_TO_EV_REQ, EVENT(evNPSubscribeToNotifications)},
+ {NPS_UNSUBSCRIBE_FROM_EV_REQ, EVENT(evNPUnSubscribeFromNotification)},
+ {NPS_UNREGISTER_EV_REQ, EVENT(evNPUnRegisterNotifications)},
+ {NPS_GET_PERS_DATA_REQ, EVENT(evNPReadPersistedData)},
+ {NPS_SET_PERSIST_FILE_PATH_REQ, EVENT(evNPRegisterPersistentFile)},
+ {NPS_RELEASE_PERS_FILE_REQ, EVENT(evNPReleasePersistentFile)},
+ {NPS_GET_PERS_FILE_REQ, EVENT(evNPLoadPersistentFile)},
+ {NPS_SET_PERSIST_FOLDER_PATH_REQ, EVENT(evNPRegisterPersistentFolder)},
+ {NPS_GET_PERS_FOLDER_REQ, EVENT(evNPLoadPersistentFolder)},
+ {NPS_RELEASE_PERS_FOLDER_REQ, EVENT(evNPReleasePersistentFolder)},
+ {NPS_CHANGE_PERSONALITY_REQ, EVENT(evUserChange)},
+ {NPS_NPP_STOP_REQ, EVENT(evShutdown)},
+ {NPS_BATCH_UNSUBSCRIBE_FROM_EV_REQ, EVENT(evNPUnSubscribeFromNotifications)},
+ {NPS_GET_READYSTATUS_REQ, EVENT(evNPGetReadyStatus)},
+ {NPS_REGISTER_NOR_EV_REQ, EVENT(evNPRegisterImmediateNotifications)},
+ {NPS_DELETE_PERSISTED_DATA_REQ, EVENT(evNPClearPersistedData)},
+ {NPS_SET_DEFAULT_PERS_DATA, EVENT(evNPSetDefaultPersistentData)},
+ {NPS_SET_NOTFN_PERSISTENT_TYPE, EVENT(evNPSetNotfnPersistentType)},
+ {NPS_SET_FILE_PERSISTENT_TYPE, EVENT(evNPSetFilePersistentType)},
+ {NPS_SET_FOLDER_PERSISTENT_TYPE, EVENT(evNPSetFolderPersistentType)},
+ {NPS_SYNCHRONOUS_WRITE_NOTIFY_REQ, EVENT(evNPPublishImmediateNotification)},
+ {NPS_NPP_SYNC_REQ, EVENT(evNPPersistentSync)}
+ };
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ FrameworkunifiedProtocolEvent ns_npp_profile_protocol_handlers[] = {
+ {NPS_PROFILE_NOTIFICATION_REQ, EVENT(evNPProfileNotification)},
+ {NPS_PROFILE_PERSISTENCE_REQ, EVENT(evNPProfilePersistence)},
+ };
+
+ if (eFrameworkunifiedStatusOK == FrameworkunifiedAttachHSMEventsToDispatcher(happ,
+ "NSProfileUtil",
+ ns_npp_profile_protocol_handlers,
+ _countof(ns_npp_profile_protocol_handlers))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Profile info messages are attached to events");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to attach profile info messages to events");
+ }
+
+#endif
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedAttachHSMEventsToDispatcher(happ, FRAMEWORKUNIFIED_ANY_SOURCE, ns_npp_protocol_handlers, static_cast<UI_32>(_countof(ns_npp_protocol_handlers))))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ CNSNPP *l_pnsnpp = new(std::nothrow) CNSNPP(happ);
+ if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 5: new's error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "l_pnsnpp object created");
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = l_pnsnpp->Init(happ))) { // LCOV_EXCL_BR_LINE 200: can't test
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "l_pnsnpp object initialized");
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = l_pnsnpp->FrameworkunifiedCreate())) { // LCOV_EXCL_BR_LINE 200: the result of l_pnsnpp->FrameworkunifiedCreate() is always eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ FrameworkunifiedSetStateMachine(happ, l_pnsnpp);
+
+ l_pnsnpp->FrameworkunifiedStart();
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NSNPP statemachine not created, status: 0x%x", l_estatus); // LCOV_EXCL_LINE 200: the result of l_pnsnpp->FrameworkunifiedCreate() is always eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 200: can't test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pnsnpp object initialization error, status: %d", l_estatus);
+
+ // de-initialize the partially initialize object
+ l_pnsnpp->DeInit(happ);
+
+ delete l_pnsnpp;
+ l_pnsnpp = NULL;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pnsnpp object not created");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedAttachHSMEventsToDispatcher Failed Status:0x%x ", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: happ can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Application handle happ is NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE happ) { // LCOV_EXCL_START 14: Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnDebugDump
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE happ) { // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+ /// << Dump internal tables!
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE happ) {
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE happ) {
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnStart
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE happ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnStop
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE happ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnPreStart
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnPreStop
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnBackgroundStart
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : FrameworkunifiedOnBackgroundStop
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
+ return eFrameworkunifiedStatusOK;
+}
+
+extern const FrameworkunifiedDefaultCallbackHandler kDefaultCbHandler = { // NOLINT (readability/naming)
+ FrameworkunifiedOnInitialization,
+ FrameworkunifiedOnDestroy,
+ FrameworkunifiedOnStart,
+ FrameworkunifiedOnStop,
+ FrameworkunifiedOnPreStart,
+ FrameworkunifiedOnPreStop,
+ FrameworkunifiedOnBackgroundStart,
+ FrameworkunifiedOnBackgroundStop,
+ FrameworkunifiedOnDebugDump,
+ FrameworkunifiedCreateStateMachine,
+ FrameworkunifiedSSFrameworkInterface
+}; // LCOV_EXCL_BR_LINE 10: The final line
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp
new file mode 100755
index 0000000..fd963c5
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp
@@ -0,0 +1,131 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_version.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <stdlib.h>
+#include <cstdlib>
+#include <iostream>
+
+#include "ns_npp.h" // for static members. Set thread prio.
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_persistence_manager.h" // for static members. Set enable/disable persistence feature.
+
+const CHAR AppName[] = FRAMEWORKUNIFIED_NS_NPSERVICE; // NOLINT (readability/naming)
+CHAR g_csendreadyackto[MAX_QUEUE_NAME_SIZE];
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION); // NOLINT (readability/naming)
+
+// Argument Parser for NSNPP
+EFrameworkunifiedStatus NPPArgumentParser(SI_32 f_iargument, PCHAR f_pargumentvalue);
+
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { // NOLINT (readability/naming)
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31,
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+extern const FrameworkunifiedDefaultCallbackHandler kDefaultCbHandler;
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function : main
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+int main(int argc, char *argv[]) {
+ FRAMEWORKUNIFIED_SET_ZONES();
+ CustomCommandLineOptions l_tcmdlineoptions = { "i:e:w:fa:v:", NULL, NPPArgumentParser};
+ EFrameworkunifiedStatus l_estatus = FrameworkunifiedDispatcherWithArguments(AppName, argc, argv, &kDefaultCbHandler, &l_tcmdlineoptions);
+
+ return static_cast<SI_32>(l_estatus);
+}
+
+EFrameworkunifiedStatus NPPArgumentParser(SI_32 f_iargument, PCHAR f_pargumentvalue) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ SI_32 l_iTmpArgValue = 0;
+ switch (f_iargument) { // LCOV_EXCL_BR_LINE 8: cannot test
+ // Disable Persistence
+ case 'f': {
+ CPersistenceManager::m_bPersistenceDisabled = TRUE;
+ break;
+ }
+ case 'i': {
+ l_iTmpArgValue = atoi(f_pargumentvalue);
+ if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
+ CNSNPP::m_siImmediatePersistenceThreadPrio = l_iTmpArgValue;
+ }
+ break;
+ }
+ case 'e': {
+ l_iTmpArgValue = atoi(f_pargumentvalue);
+ if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
+ CNSNPP::m_siReadThreadPrio = l_iTmpArgValue;
+ }
+ break;
+ }
+ case 'w': {
+ l_iTmpArgValue = atoi(f_pargumentvalue);
+ if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
+ CNSNPP::m_siWriteThreadPrio = l_iTmpArgValue;
+ }
+ break;
+ }
+ case 'a': {
+ std::memset(g_csendreadyackto, 0, MAX_QUEUE_NAME_SIZE);
+ std::strncpy(g_csendreadyackto, f_pargumentvalue, (MAX_QUEUE_NAME_SIZE - 1));
+ break;
+ }
+ case 'v': {
+ l_iTmpArgValue = atoi(f_pargumentvalue);
+ CNSNPP::m_siCRCCheckCount = static_cast<UI_16>(l_iTmpArgValue);
+ break;
+ }
+
+ default:
+ l_estatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ return l_estatus;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp.cpp
new file mode 100755
index 0000000..25b6443
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp.cpp
@@ -0,0 +1,1149 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <sys/timeb.h>
+#include <sys/types.h>
+
+#include <native_service/frameworkunified_sm_leafstate.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/ns_np_service_protocol.h>
+
+#include <string>
+#include <vector>
+
+#include <native_service/ns_np_service_nor_persistence_internal.h>
+#include "app_states.h"
+#include "ns_npp.h"
+#include "ns_npp_types.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_threads.h"
+#include "ns_npp_copy_worker.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_persist_folder.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_persistence_manager.h"
+#include "ns_npp_notification_manager.h"
+#include "ns_npp_personalization_manager.h"
+#include "ns_npp_nor_persistence_worker_thread.h"
+
+#define NPP_VERSION_INVALID 255
+#define NPP_VERSION_0 0
+#define NPP_VERSION_1 1
+
+#define NPP_CONNECT_DEFAULTSTATE(parent, child) \
+ FrameworkunifiedConnect(l_p## parent, l_p## child, TRUE);
+
+#define NPP_CONNECT_STATE(parent, child) \
+ FrameworkunifiedConnect(l_p## parent, l_p## child);
+
+#define NPP_CONNECT_DEFERREDEVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid, TRUE); \
+
+#define NPP_CONNECT_EVENT(state, eventid, reaction) \
+ FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid);
+
+#define NPP_CONNECTROOT(state) \
+ FrameworkunifiedConnect(l_p## state);
+
+#define NPP_CONNECT_ORTHOGONAL_REGION(orthogonalstate, orthogonalregion) \
+ FrameworkunifiedConnectOrthogonal(l_p## orthogonalstate, l_p## orthogonalregion);
+
+#define NPP_CREATE_STATE(class_name) \
+ C## class_name *l_p## class_name = new (std::nothrow) C## class_name(#class_name);
+
+#define NPP_PRINTSTATEMACHINE() \
+ FrameworkunifiedPrintAllStates();
+
+// typedef of vector of CNotificationsToPersist
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+// iterator for CNotificationsToPersist vector
+typedef Persistent_Notification_List_Type::iterator Persistent_Notification_List_Iterator;
+
+// initialize static variables
+SI_32 CNSNPP::m_siWriteThreadPrio = NS_NPP_WRITE_THREAD_PRIO;
+SI_32 CNSNPP::m_siReadThreadPrio = NS_NPP_READ_THREAD_PRIO;
+SI_32 CNSNPP::m_siImmediatePersistenceThreadPrio = NS_NPP_IMMEDIATE_PERSIST_THREAD_PRIO;
+UI_16 CNSNPP::m_siCRCCheckCount = 0;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSNPP
+/// Class Constructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNSNPP::CNSNPP(PVOID f_happ) : CFrameworkunifiedHSM(f_happ),
+ m_cReadThreadName(NS_NPP_READ_THREAD_NAME),
+ m_cWriteThreadName(NS_NPP_WRITE_THREAD_NAME),
+ m_cImmediatePersistenceThreadName(NS_NPP_IMMEDIATE_PERSIST_THREAD_NAME) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_hNSReadThread = NULL;
+ m_hNSWriteThread = NULL;
+ m_hNSImmediatePersistenceThread = NULL;
+
+ m_pNotificationManager = NULL;
+ m_pPersonalizationManager = NULL;
+ m_pPersistenceManager = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNSNPP
+/// Class Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNSNPP::~CNSNPP() { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pNotificationManager) {
+ delete m_pNotificationManager;
+ m_pNotificationManager = NULL;
+ }
+
+ if (NULL != m_pPersonalizationManager) {
+ delete m_pPersonalizationManager;
+ m_pPersonalizationManager = NULL;
+ }
+ if (NULL != m_pPersistenceManager) {
+ delete m_pPersistenceManager;
+ m_pPersistenceManager = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Init
+/// This function is used to allocate dynamic memory for member variables of this class after
+/// creation of object.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::Init(HANDLE f_happ) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FrameworkunifiedProtocolEvent ns_npp_internal_protocol_handlers[] = {
+ {CP_WRK_NTFY, EVENT(evNPReleaseLoadAck)}
+ };
+
+ FrameworkunifiedProtocolEvent immediate_thread_protocol_handlers[] = {
+ {NOR_PERSISTENCE_ONSHUTDOWN_ACK, EVENT(evNPNorShutdownAck)},
+ };
+
+ UI_32 l_uiNPPVersion = NPP_VERSION_INVALID;
+
+ // initialize Notification Manager
+ m_pNotificationManager = new(std::nothrow) CNotificationManager();
+ // initialize Personalization Manager
+ m_pPersonalizationManager = new(std::nothrow) CnotificationpersistentservicePersonalizationManager();
+ // initialize Persistence Manager
+ m_pPersistenceManager = new(std::nothrow) CPersistenceManager();
+
+ if ((NULL == f_happ) || (NULL == m_pNotificationManager) || (NULL == m_pPersonalizationManager) || (NULL == m_pPersistenceManager)) { // LCOV_EXCL_BR_LINE 5: f_happ, m_pNotificationManager, m_pPersonalizationManager, m_pPersistenceManager can't be NULL // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5: f_happ, m_pNotificationManager, m_pPersonalizationManager, m_pPersistenceManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "f_happ or m_pNotificationManager or m_pPersonalizationManager or m_pPersistenceManager is NULL");
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ if ((eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbackToDispatcher( // LCOV_EXCL_BR_LINE 4: NSFW error case
+ f_happ, m_cReadThreadName.c_str(),
+ CP_WRK_ACK_CMD_COMPLETE,
+ NPServiceOnCpWorkerAckCmd))
+ || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbackToDispatcher(
+ f_happ, m_cWriteThreadName.c_str(),
+ CP_WRK_ACK_CMD_COMPLETE,
+ NPServiceOnCpWorkerAckCmd))
+ || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(
+ f_happ, m_cWriteThreadName.c_str(),
+ ns_npp_internal_protocol_handlers,
+ static_cast<UI_32>(_countof(ns_npp_internal_protocol_handlers))))
+ || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(
+ f_happ, m_cReadThreadName.c_str(),
+ ns_npp_internal_protocol_handlers,
+ static_cast<UI_32>(_countof(ns_npp_internal_protocol_handlers))))
+ || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(
+ f_happ, m_cImmediatePersistenceThreadName.c_str(),
+ immediate_thread_protocol_handlers,
+ static_cast<UI_32>(_countof(immediate_thread_protocol_handlers))))) {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Attaching callbacks and events failed for protocols CP_WRK_ACK_CMD_COMPLETE, CP_WRK_NTFY");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ l_estatus = CreateAndStartChildThreads(f_happ);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ if (NPP_VERSION_INVALID != (l_uiNPPVersion = GetNSNPPVersion())) { // LCOV_EXCL_BR_LINE 6: l_uiNPPVersion can't be NPP_VERSION_INVALID // NOLINT[whitespace/line_length]
+ if (NPP_VERSION_0 == l_uiNPPVersion) {
+ l_estatus = SwitchToFileStructureVersion1(l_uiNPPVersion + 1);
+
+ l_estatus = SwitchToFileStructureVersion2(l_uiNPPVersion + 2);
+ } else if (NPP_VERSION_1 == l_uiNPPVersion) { // LCOV_EXCL_BR_LINE 200: cannot test code in init sequence
+ // LCOV_EXCL_START 200: cannot test code in init sequence
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = SwitchToFileStructureVersion2(l_uiNPPVersion + 1);
+
+ // send the message to write worker thread to delete the persistent
+ /// which was requested for deletion during previous shutdown
+ l_estatus = FrameworkunifiedSendChild(f_happ, m_hNSWriteThread, CMD_DELETE_OLD_DATA, 0, NULL);
+ // LCOV_EXCL_STOP
+ } else {
+ // send the message to write worker thread to delete the persistent
+ /// which was requested for deletion during previous shutdown
+ l_estatus = FrameworkunifiedSendChild(f_happ, m_hNSWriteThread, CMD_DELETE_OLD_DATA, 0, NULL);
+ }
+
+ // Try to load persisted notification data
+ NotificationpersistentserviceLoadPersistentNotificationData(eFrameworkunifiedPersistedStateVar);
+
+ // load immediate persistence data as the respective thread is now started.
+ NotificationpersistentserviceLoadPersistentNotificationData(eFrameworkunifiedImmediatePersistedStateVar);
+ } else {
+ // LCOV_EXCL_START 6: l_uiNPPVersion can't be NPP_VERSION_INVALID
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid version of NPPService");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in creating child threads of NPPService"); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DeInit
+/// This function is used to deinitialize the NPP object
+////////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CNSNPP::DeInit(HANDLE f_happ) { // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pNotificationManager) {
+ delete m_pNotificationManager;
+ m_pNotificationManager = NULL;
+ }
+
+ if (NULL != m_pPersonalizationManager) {
+ delete m_pPersonalizationManager;
+ m_pPersonalizationManager = NULL;
+ }
+
+ if (NULL != m_pPersistenceManager) {
+ delete m_pPersistenceManager;
+ m_pPersistenceManager = NULL;
+ }
+
+ if (NULL != f_happ) {
+ EFrameworkunifiedStatus eStatus;
+
+ if (NULL != m_hNSReadThread) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedStopChildThread(f_happ, m_hNSReadThread, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread Read Thread Failed. status=%d", eStatus);
+ }
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroyChildThread(f_happ, m_hNSReadThread))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedDestroyChildThread Read Thread Failed. status=%d", eStatus);
+ }
+ m_hNSReadThread = NULL;
+ }
+
+ if (NULL != m_hNSWriteThread) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedStopChildThread(f_happ, m_hNSWriteThread, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread Write Thread Failed. status=%d", eStatus);
+ }
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroyChildThread(f_happ, m_hNSWriteThread))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedDestroyChildThread Write Thread Failed. status=%d", eStatus);
+ }
+ m_hNSWriteThread = NULL;
+ }
+
+ if (NULL != m_hNSImmediatePersistenceThread) {
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedStopChildThread(f_happ, m_hNSImmediatePersistenceThread, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread ImmidatePersistence Thread Failed. status=%d", eStatus);
+ }
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroyChildThread(f_happ, m_hNSImmediatePersistenceThread))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedDestroyChildThread ImmidatePersistence Thread Failed. status=%d", eStatus);
+ }
+ m_hNSImmediatePersistenceThread = NULL;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SwitchToFileStructureVersion1
+/// Copy all the user data from old persistent path to new persistent path i.e. UserData folder
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::SwitchToFileStructureVersion1(const UI_32 f_uinppversion) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string l_cSrcPath = "";
+ std::string l_cDestPath = "";
+
+ std::string l_cNSNPSPath = CPersistence::GetStoragePath();
+ std::string l_cUserDataPath = "";
+
+ if (CFSDirectory::DoesDirecotryExist(l_cNSNPSPath)) { // LCOV_EXCL_BR_LINE 6: l_cNSNPSPath must exist
+ DIR *l_pdir = NULL;
+
+ struct dirent *l_pdirent = NULL;
+
+ l_pdir = opendir(l_cNSNPSPath.c_str());
+
+ if (NULL != l_pdir) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ if (l_cNSNPSPath[l_cNSNPSPath.length() - 1] != '/') { // LCOV_EXCL_BR_LINE 6: l_cNSNPSPath must has '/'
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_cNSNPSPath.append("/"); // LCOV_EXCL_LINE 6: l_cNSNPSPath must has '/'
+ }
+
+ // set the userdata folder path
+ l_cUserDataPath.assign(l_cNSNPSPath);
+ l_cUserDataPath.append(USERDATADIR);
+ l_cUserDataPath.append(ALLUSERAPPDATADIR);
+
+ // create the userdata directory
+ if (!CFSDirectory::DoesDirecotryExist(l_cUserDataPath)) {
+ l_estatus = CFSDirectory::CreateDirectory(l_cUserDataPath);
+ }
+
+ // if directory successfully created or is already present on target
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus must be eFrameworkunifiedStatusOK
+ while (NULL != (l_pdirent = readdir(l_pdir))) {
+ if (0 != std::strcmp(l_pdirent->d_name, ".") &&
+ 0 != std::strcmp(l_pdirent->d_name, "..") &&
+ 0 != std::strcmp(l_pdirent->d_name, AppName) &&
+ 0 != std::strcmp(l_pdirent->d_name, USERDATA)) {
+ l_cSrcPath.assign(l_cNSNPSPath.c_str());
+ l_cSrcPath.append(l_pdirent->d_name);
+
+ if (CFSDirectory::IsDirectory(l_cSrcPath)) { // LCOV_EXCL_BR_LINE 6: cannot test in init sequence
+ l_cDestPath.assign(l_cUserDataPath);
+ l_cDestPath.append(l_pdirent->d_name);
+
+ // move the old app user data to the UserData fodler
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: rename must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error renaming folder %s to %s",
+ l_cSrcPath.c_str(), l_cDestPath.c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to create directory:: %s", l_cDestPath.c_str()); // LCOV_EXCL_LINE 6: l_estatus must be eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ }
+
+ closedir(l_pdir); // close the directory
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pdir is NULL");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ l_estatus = SetNSNPPVersion(static_cast<UI_8>(f_uinppversion));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SwitchToFileStructureVersion2
+/// Move immediate notification data files from IMMEDIATE_PERSISTENCE_STORAGE_V1 to
+/// IMMEDIATE_PERSISTENCE_STORAGE_V2/AllUserAppData/UserData
+//// ////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::SwitchToFileStructureVersion2(const UI_32 f_uinppversion) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // immediate notification persistent path for NPPService version 1
+ std::string l_cSrcDir = IMMEDIATE_PERSISTENCE_STORAGE_V1;
+
+ // immediate notification persistent path for NPPService version 2
+ std::string l_cDestDir = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+ l_cDestDir.append(USERDATADIR);
+ l_cDestDir.append(ALLUSERAPPDATADIR);
+ l_cDestDir.append(IMMEDIATEDATADIR);
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = SynchronousMovePersistentData(l_cSrcDir.c_str(), l_cDestDir.c_str()))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ if (!CFSDirectory::RemoveDirectory(l_cSrcDir)) { // LCOV_EXCL_BR_LINE 6: cannot test in init sequence
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error deleting old immediate pers. dir %s", l_cSrcDir.c_str());
+ }
+
+ l_estatus = SetNSNPPVersion(static_cast<UI_8>(f_uinppversion));
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SynchronousMovePersistentData faiure, status=%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+/// GetNSNPPVersion
+/// Get the version of NSNPP from version.txt
+///////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CNSNPP::GetNSNPPVersion() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ UI_32 l_uiVersion = NPP_VERSION_INVALID;
+ CHAR l_cVerStr[3] = {};
+ FILE *l_pFile = NULL;
+
+ std::string l_cVersion = CPersistence::GetStoragePath();
+ if (l_cVersion[l_cVersion.length() - 1] != '/') { // LCOV_EXCL_BR_LINE 6: must has '/'
+ l_cVersion += "/";
+ }
+ l_cVersion.append(VERSION_TXT);
+
+ if (NULL != (l_pFile = fopen(l_cVersion.c_str(), "r"))) {
+ // read the version from file
+ if (NULL == fgets(l_cVerStr, 2, l_pFile)) { // LCOV_EXCL_BR_LINE 6: can't return NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "File empty: %s", l_cVersion.c_str()); // LCOV_EXCL_LINE 6: can't return NULL
+ } else {
+ errno = EOK;
+ l_uiVersion = static_cast<UI_32>(strtol(l_cVerStr, NULL, 10));
+
+ if (EOK != errno) { // LCOV_EXCL_BR_LINE 6: errno always is EOK
+ // LCOV_EXCL_START 6: errno always is EOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to hex, errno=%d", l_cVerStr, errno);
+ l_uiVersion = NPP_VERSION_0;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ fclose(l_pFile);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file: %s, errno=%d", l_cVersion.c_str(), errno);
+ l_uiVersion = NPP_VERSION_0;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_uiVersion;
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// Syncfs
+/// Syncfs is carried out.
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+/// EFrameworkunifiedStatus - Returns status of operation
+///
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::Syncfs() {
+ int dfd;
+
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string l_cPath = CPersistence::GetStoragePath();
+
+ // create the file
+ dfd = open(l_cPath.c_str(), O_RDONLY | O_DIRECTORY);
+ if (-1 != dfd) {
+ // syncfs()
+ if (syncfs(dfd) < 0) { // LCOV_EXCL_BR_LINE 5: syncfs's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to syncfs: %s errno=%d", l_cPath.c_str(), errno); // LCOV_EXCL_LINE 5: syncfs's error case. // NOLINT[whitespace/line_length]
+ }
+ close(dfd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file: %s serrno=%d", l_cPath.c_str(), errno);
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+///////////////////////////////////////////////////////////////////////////////////////////
+/// SetNSNPPVersion
+/// Set the version of NSNPP in version.txt
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::SetNSNPPVersion(UI_8 f_uiversion) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FILE *l_pFile = NULL;
+
+ std::string l_cVersion = CPersistence::GetStoragePath();
+ if (l_cVersion[l_cVersion.length() - 1] != '/') { // LCOV_EXCL_BR_LINE 6: must has '/'
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_cVersion += "/"; // LCOV_EXCL_LINE 6: must has '/'
+ }
+ if (!CFSDirectory::DoesDirecotryExist(l_cVersion)) {
+ CFSDirectory::CreateDirectory(l_cVersion);
+ }
+
+ l_cVersion.append(VERSION_TXT);
+
+ // create the file and write
+ l_pFile = fopen(l_cVersion.c_str(), "w");
+ if (NULL != l_pFile) { // LCOV_EXCL_BR_LINE 6: l_pFile can't be NULL
+ // write the version to file
+ fprintf(l_pFile, "%d", f_uiversion);
+ fclose(l_pFile);
+ } else {
+ // LCOV_EXCL_START 6: l_pFile can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file: %s", l_cVersion.c_str());
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedCreate
+/// In this function, states and events of StateMachine are created and connected.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::FrameworkunifiedCreate(PVOID f_peventdata) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // ========Create states
+ NPP_CREATE_STATE(sNotificationpersistentserviceNPPRoot)
+ NPP_CREATE_STATE(sNotificationpersistentserviceNPPStart)
+ NPP_CREATE_STATE(sNotificationpersistentserviceNPPError)
+
+ CREATE_ORTHOGONALREGION(sNotificationpersistentservicePersistence)
+ CREATE_ORTHOGONALREGION(sNotificationpersistentserviceShutdown)
+ CREATE_ORTHOGONALREGION(sNotificationpersistentserviceNotification)
+
+ NPP_CREATE_STATE(sNotificationpersistentservicePersistenceReady)
+ NPP_CREATE_STATE(sNotificationpersistentservicePersistenceError)
+
+ NPP_CREATE_STATE(sNotificationpersistentserviceNotificationReady)
+ NPP_CREATE_STATE(sNotificationpersistentserviceNotificationError)
+
+ NPP_CREATE_STATE(sNotificationpersistentserviceShutdownIdle)
+ NPP_CREATE_STATE(sNotificationpersistentserviceShutdownDataSave)
+
+ // ========Connect states
+ NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentserviceNPPRoot, sNotificationpersistentserviceNPPStart)
+ NPP_CONNECT_STATE(sNotificationpersistentserviceNPPRoot, sNotificationpersistentserviceNPPStart)
+ NPP_CONNECT_STATE(sNotificationpersistentserviceNPPRoot, sNotificationpersistentserviceNPPError)
+
+ NPP_CONNECT_ORTHOGONAL_REGION(sNotificationpersistentserviceNPPStart, sNotificationpersistentservicePersistence)
+ NPP_CONNECT_ORTHOGONAL_REGION(sNotificationpersistentserviceNPPStart, sNotificationpersistentserviceShutdown)
+ NPP_CONNECT_ORTHOGONAL_REGION(sNotificationpersistentserviceNPPStart, sNotificationpersistentserviceNotification)
+
+ NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentservicePersistence, sNotificationpersistentservicePersistenceReady)
+ NPP_CONNECT_STATE(sNotificationpersistentservicePersistence, sNotificationpersistentservicePersistenceError)
+
+ NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentserviceShutdown, sNotificationpersistentserviceShutdownIdle)
+ NPP_CONNECT_STATE(sNotificationpersistentserviceShutdown, sNotificationpersistentserviceShutdownDataSave)
+
+ NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentserviceNotification, sNotificationpersistentserviceNotificationReady)
+ NPP_CONNECT_STATE(sNotificationpersistentserviceNotification, sNotificationpersistentserviceNotificationError)
+
+ // ========Create external transitions
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNPPStart)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNPPError)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentservicePersistenceReady)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentservicePersistenceError)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceShutdownIdle)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceShutdownDataSave)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNotificationReady)
+ CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNotificationError)
+
+ // ========Create internal transitions
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReadPersistedData)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReleaseFileAck)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnUserChange)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPNorDataSaveAck)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFile)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFile)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFile)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFolder)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFolder)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFolder)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFilePersistentType)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFolderPersistentType)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPersistentSync)
+
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPShutdown)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnShutdownTimeout)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceCheckAllReleaseRequestsProcessed)
+
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishNotification)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotification)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnRegisterNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotification)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPGetReadyStatus)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterImmediateNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPClearPersistedData)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetDefaultPersistentData)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetNotfnPersistentType)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishImmediateNotification)
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfileNotifications)
+ CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfilePersistence)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPProfileNotification, NotificationpersistentserviceOnNPProfileNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPProfilePersistence, NotificationpersistentserviceOnNPProfilePersistence)
+
+#endif
+
+ // ========Connect events
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNPPRoot, evNPClearPersistedData, NotificationpersistentserviceOnNPClearPersistedData)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNPPStart, evError, sNotificationpersistentserviceNPPError)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNPPError, evReady, sNotificationpersistentserviceNPPStart)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evError, sNotificationpersistentservicePersistenceError)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceError, evReady, sNotificationpersistentservicePersistenceReady)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReadPersistedData, NotificationpersistentserviceOnNPReadPersistedData)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReleaseLoadAck, NotificationpersistentserviceOnNPReleaseFileAck)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPRegisterPersistentFile, NotificationpersistentserviceOnRegisterPersistentFile)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReleasePersistentFile, NotificationpersistentserviceOnReleasePersistentFile)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPLoadPersistentFile, NotificationpersistentserviceOnLoadPersistentFile)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPRegisterPersistentFolder, NotificationpersistentserviceOnRegisterPersistentFolder)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPLoadPersistentFolder, NotificationpersistentserviceOnLoadPersistentFolder)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReleasePersistentFolder, NotificationpersistentserviceOnReleasePersistentFolder)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPGetReadyStatus, NotificationpersistentserviceOnNPGetReadyStatus)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPSetFilePersistentType, NotificationpersistentserviceOnNPSetFilePersistentType)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPSetFolderPersistentType, NotificationpersistentserviceOnNPSetFolderPersistentType)
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPPersistentSync, NotificationpersistentserviceOnNPPersistentSync)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evUserChange, NotificationpersistentserviceOnUserChange)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownIdle, evShutdown, NotificationpersistentserviceOnNPShutdown)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownIdle, evNPShutdownDataSave, sNotificationpersistentserviceShutdownDataSave)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evIdle, sNotificationpersistentserviceShutdownIdle)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evShutdownTimeout, NotificationpersistentserviceOnShutdownTimeout)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evCheckAllFilesPersisted, NotificationpersistentserviceCheckAllReleaseRequestsProcessed)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evNPNorShutdownAck, NotificationpersistentserviceOnNPNorDataSaveAck)
+
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evError, sNotificationpersistentserviceNotificationError)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationError, evReady, sNotificationpersistentserviceNotificationReady)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPPublishNotification, NotificationpersistentserviceOnNPPublishNotification)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPRegisterNotifications, NotificationpersistentserviceOnNPRegisterNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSubscribeToNotification, NotificationpersistentserviceOnNPSubscribeToNotification)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSubscribeToNotifications, NotificationpersistentserviceOnNPSubscribeToNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPUnRegisterNotifications, NotificationpersistentserviceOnNPUnRegisterNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPUnSubscribeFromNotification, NotificationpersistentserviceOnNPUnSubscribeFromNotification)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPUnSubscribeFromNotifications, NotificationpersistentserviceOnNPUnSubscribeFromNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPRegisterImmediateNotifications, NotificationpersistentserviceOnNPRegisterImmediateNotifications)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSetDefaultPersistentData, NotificationpersistentserviceOnNPSetDefaultPersistentData)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSetNotfnPersistentType, NotificationpersistentserviceOnNPSetNotfnPersistentType)
+ NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPPublishImmediateNotification, NotificationpersistentserviceOnNPPublishImmediateNotification)
+
+ NPP_CONNECTROOT(sNotificationpersistentserviceNPPRoot)
+
+ NPP_PRINTSTATEMACHINE() // NOLINT (whitespace/empty_if_body)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentservicePersistAll
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::NotificationpersistentservicePersistAll(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedQuickShutdown == f_eshutdowntype) {
+ if (NULL != m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
+ // set all file persisted status as TRUE
+ m_pPersistenceManager->SetFilePersistedStatus(TRUE);
+
+ // send request to immediate persistence thread to stop all the immediate notification timer
+ m_pPersistenceManager->PersistNORData(f_eshutdowntype, f_uinotificationpersistentservicepersistcategoryflag);
+ }
+ } else {
+ if (eFrameworkunifiedNormalShutdown == f_eshutdowntype) {
+ f_uinotificationpersistentservicepersistcategoryflag = 0x0;
+ }
+
+ // save global notification data of persisted state notification
+ if (eFrameworkunifiedStatusOK != NotificationpersistentserviceSaveNotificationPersistentData(eFrameworkunifiedPersistedStateVar, f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while saving notification persistent data.");
+ // LCOV_EXCL_STOP
+ }
+
+ // save user notification data for the current user
+ if (eFrameworkunifiedStatusOK != NotificationpersistentserviceSaveNotificationPersistentData(eFrameworkunifiedPersistedStateUserVar, f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while saving user notification persistent data.");
+ // LCOV_EXCL_STOP
+ }
+
+ // NOR data is saved immediately,
+ // but during shutdown it can be possible that because of delay in consecutive save to NOR
+ // the latest data may not get persisted. So if we get shutdown we will need to persist the data immediately.
+ if (NULL != m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
+ m_pPersistenceManager->PersistNORData(f_eshutdowntype, f_uinotificationpersistentservicepersistcategoryflag);
+ }
+
+ // delete all persistent files and folders for all applications
+ if ((eFrameworkunifiedUserData | eFrameworkunifiedFactoryData | eFrameworkunifiedFactoryCustomerData | eFrameworkunifiedDealerData) == f_uinotificationpersistentservicepersistcategoryflag) {
+ if (NULL != m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
+ m_pPersistenceManager->SetFilePersistedStatus(TRUE);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: m_pPersistenceManager can't be NULL
+ }
+ } else {
+ // writes the temporary global and user files to permanent memory
+ if (m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
+ if (eFrameworkunifiedStatusOK == m_pPersistenceManager->PersistAllReleaseRequests(f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 6: PersistAllReleaseRequests will always return ok // NOLINT[whitespace/line_length]
+ // this is needed to check in case when there are no file to persist
+ if (TRUE == m_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: HaveAllReleaseRequestsPersisted will always return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: HaveAllReleaseRequestsPersisted will always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All file release requests processed");
+ m_pPersistenceManager->SetFilePersistedStatus(TRUE);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: PersistAllReleaseRequests will always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while persisting temporary files.");
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DeletePersistedDataFolder
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::DeletePersistedDataFolder(UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ struct timeb timebuf;
+ struct tm *theTime;
+
+ ftime(&timebuf);
+ theTime = gmtime(&timebuf.time); // NOLINT (runtime/threadsafe_fn)
+
+ // get the current date and time to append to the folder name
+ PCHAR l_cDateTime = new CHAR[MAX_STRING_SIZE_TAG];
+ snprintf(l_cDateTime, MAX_STRING_SIZE_TAG, "_%02d%02d%02d_%02d%02d%02d", theTime->tm_mon + 1, theTime->tm_mday,
+ theTime->tm_year + 1900, theTime->tm_hour, theTime->tm_min, theTime->tm_sec);
+
+ std::string l_cBasePath = CPersistence::GetStoragePath();
+ std::string l_cSrcPath = "";
+ std::string l_cDestPath = "";
+
+ if (eFrameworkunifiedUserData == (eFrameworkunifiedUserData & f_uinotificationpersistentservicepersistcategoryflag)) {
+ l_cSrcPath.assign(l_cBasePath);
+ l_cSrcPath.append(USERDATA);
+
+ if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
+ l_cDestPath.assign(l_cSrcPath);
+ l_cDestPath.append(l_cDateTime);
+
+ // instead of deleting the data, rename the persistence folder before shutdown
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
+ // LCOV_EXCL_START 6: rename must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error renaming folder %s to %s, errno = %d",
+ l_cSrcPath.c_str(),
+ l_cDestPath.c_str(),
+ errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ if (eFrameworkunifiedFactoryData == (eFrameworkunifiedFactoryData & f_uinotificationpersistentservicepersistcategoryflag)) {
+ l_cSrcPath.assign(l_cBasePath);
+ l_cSrcPath.append(FACTORYDATA);
+
+ if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
+ l_cDestPath.assign(l_cSrcPath);
+ l_cDestPath.append(l_cDateTime);
+
+ // instead of deleting the data, rename the persistence folder before shutdown
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
+ // LCOV_EXCL_START 6: rename must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error renaming folder %s to %s, errno = %d",
+ l_cSrcPath.c_str(),
+ l_cDestPath.c_str(),
+ errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ if (eFrameworkunifiedFactoryCustomerData == (eFrameworkunifiedFactoryCustomerData & f_uinotificationpersistentservicepersistcategoryflag)) {
+ l_cSrcPath.assign(l_cBasePath);
+ l_cSrcPath.append(FACTORYCUSTOMERDATA);
+
+ if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
+ l_cDestPath.assign(l_cSrcPath);
+ l_cDestPath.append(l_cDateTime);
+
+ // instead of deleting the data, rename the persistence folder before shutdown
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
+ // LCOV_EXCL_START 6: rename must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error renaming folder %s to %s, errno = %d",
+ l_cSrcPath.c_str(),
+ l_cDestPath.c_str(),
+ errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ if (eFrameworkunifiedDealerData == (eFrameworkunifiedDealerData & f_uinotificationpersistentservicepersistcategoryflag)) {
+ l_cSrcPath.assign(l_cBasePath);
+ l_cSrcPath.append(DEALERDATA);
+
+ if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
+ l_cDestPath.assign(l_cSrcPath);
+ l_cDestPath.append(l_cDateTime);
+
+ // instead of deleting the data, rename the persistence folder before shutdown
+ if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
+ // LCOV_EXCL_START 6: rename must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error renaming folder %s to %s, errno = %d",
+ l_cSrcPath.c_str(),
+ l_cDestPath.c_str(),
+ errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+
+ if (NULL != l_cDateTime) { // LCOV_EXCL_BR_LINE 6: l_cDateTime can't be NULL
+ delete[] l_cDateTime;
+ l_cDateTime = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSaveNotificationPersistentData
+/// In this function, all the data related to persistent notification is retrieved from
+/// notification manager and stored in persistent file by persistent manager.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::NotificationpersistentserviceSaveNotificationPersistentData(EFrameworkunifiedNotificationType f_epersistenttype,
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // pointer of Notification Manager
+ CNotificationManager *l_pNotificationManager = NULL;
+
+ // pointer of Persistence Manager
+ CPersistenceManager *l_pCNotificationpersistentservicePersistenceManager = NULL;
+
+ Persistent_Notification_List_Type *l_vPersistentNotificationList = NULL;
+
+ // get the instance of notification manager
+ l_pNotificationManager = m_pNotificationManager;
+
+ // get the instance of persistence manager
+ l_pCNotificationpersistentservicePersistenceManager = m_pPersistenceManager;
+
+ if (NULL != l_pNotificationManager && NULL != l_pCNotificationpersistentservicePersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager and l_pCNotificationpersistentservicePersistenceManager can't be NULL // NOLINT[whitespace/line_length]
+ // create new vector to retrieve persistent notification data
+ l_vPersistentNotificationList = new(std::nothrow) Persistent_Notification_List_Type();
+
+ if (NULL != l_vPersistentNotificationList) { // LCOV_EXCL_BR_LINE 5: l_vPersistentNotificationList can't be NULL
+ // get all the persistent notification data in vector from notification manager
+ l_pNotificationManager->NotificationpersistentserviceGetPersistentNotificationData(l_vPersistentNotificationList,
+ f_epersistenttype,
+ f_uinotificationpersistentservicepersistcategoryflag);
+ } else {
+ // LCOV_EXCL_START 5: l_vPersistentNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_vPersistentNotificationList is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ if (NULL != l_vPersistentNotificationList) { // LCOV_EXCL_BR_LINE 5: l_vPersistentNotificationList can't be NULL
+ if (eFrameworkunifiedPersistedStateVar == f_epersistenttype) {
+ // save persistent notification data from vector to file
+ l_estatus = l_pCNotificationpersistentservicePersistenceManager->NotificationpersistentserviceSaveNotificationData(l_vPersistentNotificationList);
+ } else if (eFrameworkunifiedPersistedStateUserVar == f_epersistenttype) { // LCOV_EXCL_BR_LINE 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar // NOLINT[whitespace/line_length]
+ l_estatus = l_pCNotificationpersistentservicePersistenceManager->NotificationpersistentserviceSaveUserNotificationData(l_vPersistentNotificationList);
+ } else {
+ // LCOV_EXCL_START 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Save data for %d PersistentVarType not supported", f_epersistenttype);
+ // LCOV_EXCL_STOP
+ }
+
+
+ // delete the locally created vector
+ if (!l_vPersistentNotificationList->empty()) {
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_vPersistentNotificationList->size();
+ l_uiCount++) {
+ if (NULL != l_vPersistentNotificationList->at(l_uiCount)) { // LCOV_EXCL_BR_LINE 6: can't be NULL
+ delete l_vPersistentNotificationList->at(l_uiCount);
+ }
+ }
+
+ // clear the vector
+ l_vPersistentNotificationList->clear();
+ }
+
+ delete l_vPersistentNotificationList;
+ l_vPersistentNotificationList = NULL;
+ } else {
+ // LCOV_EXCL_START 5: l_vPersistentNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_vPersistentNotificationList is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager and l_pCNotificationpersistentservicePersistenceManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationManager is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceOnLoadPersistentData
+/// In this transition, persistent file is loaded by persistent manager and
+/// persistent notifications and its data is stored by notification manager.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::NotificationpersistentserviceLoadPersistentNotificationData(EFrameworkunifiedNotificationType f_epersistenttype) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // pointer of Notification Manager
+ CNotificationManager *l_pNotificationManager = NULL;
+
+ // pointer of Persistence Manager
+ CPersistenceManager *l_pNotificationpersistentservicePersistenceManager = NULL;
+
+ // iterator of CNotificationToPersist vector
+ Persistent_Notification_List_Type *l_vPersistentNotificationList = NULL;
+
+ // get the instance of notification manager
+ l_pNotificationManager = m_pNotificationManager;
+
+ // get the instance of persistent manager
+ l_pNotificationpersistentservicePersistenceManager = m_pPersistenceManager;
+
+ // create new vector for persistent notifications
+ l_vPersistentNotificationList = new(std::nothrow) Persistent_Notification_List_Type();
+
+ if (NULL != l_vPersistentNotificationList) { // LCOV_EXCL_BR_LINE 5: l_vPersistentNotificationList can't be NULL
+ if (NULL != l_pNotificationManager && NULL != l_pNotificationpersistentservicePersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager and l_pNotificationpersistentservicePersistenceManager can't be NULL // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedPersistedStateVar == f_epersistenttype) {
+ // read persistent notification data from file and store in vector
+ l_estatus = l_pNotificationpersistentservicePersistenceManager->NotificationpersistentserviceReadNotificationData(l_vPersistentNotificationList);
+ } else if (eFrameworkunifiedPersistedStateUserVar == f_epersistenttype) {
+ l_estatus = l_pNotificationpersistentservicePersistenceManager->NotificationpersistentserviceReadUserNotificationData(l_vPersistentNotificationList);
+ } else if (eFrameworkunifiedImmediatePersistedStateVar == f_epersistenttype) { // LCOV_EXCL_BR_LINE 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar or eFrameworkunifiedImmediatePersistedStateVar // NOLINT[whitespace/line_length]
+ l_estatus = l_pNotificationpersistentservicePersistenceManager->NotificationpersistentserviceReadNorNotificationData(l_vPersistentNotificationList);
+ } else {
+ // LCOV_EXCL_START 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar or eFrameworkunifiedImmediatePersistedStateVar // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Read data for %d PersistentVarType not supported", f_epersistenttype);
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 < l_vPersistentNotificationList->size()) {
+ // send the notification list to notification manager
+ l_estatus = l_pNotificationManager->NotificationpersistentserviceSetPersistentNotificationData(l_vPersistentNotificationList);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationManager and l_pNotificationpersistentservicePersistenceManager can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationManager or l_pNotificationpersistentservicePersistenceManager is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ if (!l_vPersistentNotificationList->empty()) {
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_vPersistentNotificationList->size();
+ l_uiCount++) {
+ if (NULL != l_vPersistentNotificationList->at(l_uiCount)) { // LCOV_EXCL_BR_LINE 6: can't be NULL
+ delete l_vPersistentNotificationList->at(l_uiCount);
+ }
+ }
+
+ // clear the vector
+ l_vPersistentNotificationList->clear();
+ }
+
+ delete l_vPersistentNotificationList;
+ l_vPersistentNotificationList = NULL;
+ } else {
+ // LCOV_EXCL_START 5: l_vPersistentNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error for l_vPersistentNotificationList");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateAndStartChildThreads
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNSNPP::CreateAndStartChildThreads(HANDLE f_happ) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == f_happ) { // LCOV_EXCL_BR_LINE 6: f_happ can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_happ can't be NULL
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is eFrameworkunifiedStatusOK
+ // create reader thread
+ if (NULL != (m_hNSReadThread = FrameworkunifiedCreateChildThreadWithPriority(f_happ, m_cReadThreadName.c_str(), NSPCopyWorkerOnStart, NSPCopyWorkerOnStop, CNSNPP::m_siReadThreadPrio))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Thread %s created, Prio=%d",
+ m_cReadThreadName.c_str(),
+ CNSNPP::m_siReadThreadPrio);
+
+ // start the reader thread
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedStartChildThread(f_happ, m_hNSReadThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ m_pPersistenceManager->SetReadThreadHandle(m_hNSReadThread);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start Read Worker thread. Status:0x%x", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error creating NPP Read Worker thread");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is eFrameworkunifiedStatusOK
+ // create writer thread
+ if (NULL != (m_hNSWriteThread = FrameworkunifiedCreateChildThreadWithPriority(f_happ, m_cWriteThreadName.c_str(), NSPCopyWorkerOnStart, NSPCopyWorkerOnStop, CNSNPP::m_siWriteThreadPrio))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Thread %s created, Prio=%d",
+ m_cWriteThreadName.c_str(),
+ CNSNPP::m_siWriteThreadPrio);
+
+ // start the writer thread
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedStartChildThread(f_happ, m_hNSWriteThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ m_pPersistenceManager->SetWriteThreadHandle(m_hNSWriteThread);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start Write Worker thread. Status:0x%x", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error creating NPP Write Worker thread");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is eFrameworkunifiedStatusOK
+ // create immediate Persistence thread
+ if (NULL != (m_hNSImmediatePersistenceThread = FrameworkunifiedCreateChildThreadWithPriority(f_happ, m_cImmediatePersistenceThreadName.c_str(), NSPNorPersistenceWorkerOnStart, NSPNorPersistenceWorkerOnStop, CNSNPP::m_siImmediatePersistenceThreadPrio))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Thread %s created, Prio=%d", m_cImmediatePersistenceThreadName.c_str(),
+ CNSNPP::m_siImmediatePersistenceThreadPrio);
+
+ // start the immediate Persistence thread
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedStartChildThread(f_happ, m_hNSImmediatePersistenceThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ m_pPersistenceManager->SetNorPersistenceThreadHandle(m_hNSImmediatePersistenceThread);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start immediate persistence thread. Status:0x%x", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error creating NPP immediate persistence Worker thread");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ return l_estatus;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp
new file mode 100755
index 0000000..b54faeb
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp
@@ -0,0 +1,846 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains the implementation for archiving and extracting files and folders.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <zlib.h>
+#include <dirent.h>
+#include <zconf.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <libtar_listhash.h>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_copy_worker.h"
+
+
+tartype_t g_gztype = { (openfunc_t) OpenArchive, (closefunc_t) CloseArchive,
+ (readfunc_t) ReadArchive, (writefunc_t) WriteArchive
+ };
+
+GZFiles g_gzfiles;
+
+// CHUNK Size 256 Kb
+// Buffer size for feeding data to and pulling data from the zlib routines
+const size_t kChunkSize = 1U << 18;
+// buff size 32KB
+const size_t kBufSize = 1U << 15;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CArchive
+/// Constructor of CArchive class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CCopyWorker::CArchive::CArchive() {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CArchive
+/// Destructor of CArchive class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CCopyWorker::CArchive::~CArchive() {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FolderOperation
+/// Method to perform archive or extract operations
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::Archive(NSP_CopyInfoCmd &f_tarchiveinfocmd,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_pSourcePath = f_tarchiveinfocmd.m_csourcepath;
+ std::string l_pDestPath = f_tarchiveinfocmd.m_cdestinationpath;
+
+ if (!l_pSourcePath.empty() || !l_pDestPath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_pSourcePath and l_pDestPath can't be empty // NOLINT[whitespace/line_length]
+ size_t l_ifound = l_pDestPath.rfind("/");
+ // get string from start to last occurrence of '/'. Which will return directory path
+ std::string l_cOutDirPath = l_pDestPath.substr(0, l_ifound);
+ // check for load file or release file
+ if (LOADTYPE_RELEASE == f_tarchiveinfocmd.m_eloadtype) {
+ if (CFSDirectory::DoesDirecotryExist(l_pSourcePath)) {
+ // check if destination directory exist
+ if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s DOESN'T exist, Creating...",
+ l_cOutDirPath.c_str());
+ l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath);
+ }
+ // Create archive
+ if (eFrameworkunifiedStatusOK == (l_estatus = CreateTar(l_pSourcePath, l_pDestPath, // LCOV_EXCL_BR_LINE 6: CreateTar always return eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ f_tarchivestatusresponse))) {
+ // sync tar file to persistent memory
+ SI_32 l_iTarHandle = LIBTARFAIL;
+ if (LIBTARFAIL != (l_iTarHandle = open(l_pDestPath.c_str() , O_RDONLY))) {
+ struct stat l_objStat;
+ if (-1 != fstat(l_iTarHandle , &l_objStat)) { // LCOV_EXCL_BR_LINE 6: fstat always return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written in NAND memory, %ld, file=%s", l_objStat.st_size,
+ l_pDestPath.c_str());
+ }
+
+ close(l_iTarHandle);
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ // LCOV_EXCL_START 6: CreateTar always return eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Create tar Failed.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "CP_WRK_FAILURE_SRC_NOT_FND for %s ",
+ l_pSourcePath.c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ // check if destination directory exist
+ if (!CFSDirectory::DoesDirecotryExist(l_pDestPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s DOESN'T exist, Creating...",
+ l_pDestPath.c_str());
+ l_estatus = CFSDirectory::CreateDirectory(l_pDestPath);
+ }
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus will be always eFrameworkunifiedStatusOK
+ // Extract archive
+ l_estatus = ExtractTar(l_pSourcePath, l_pDestPath, f_tarchivestatusresponse);
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pSourcePath and l_pDestPath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateTar
+/// Method to create tar
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::CreateTar(const std::string &f_csourepath,
+ const std::string &f_cdestpath,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_cDestPath = f_cdestpath;
+ std::string l_pcRootDirPath = f_csourepath;
+
+ libtar_list_t *l_pLibTarList = NULL;
+ l_pLibTarList = libtar_list_new(LIST_QUEUE, NULL);
+ libtar_list_add(l_pLibTarList, (void *)l_pcRootDirPath.c_str()); // NOLINT (readability/casting)
+
+ if (!l_cDestPath.empty() || !l_pcRootDirPath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_cDestPath and l_pcRootDirPath cannot be empty // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != Create(l_cDestPath, l_pcRootDirPath, l_pLibTarList)) { // LCOV_EXCL_BR_LINE 6: Create always return eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: Create always return eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // not copied properly so remove temporary file
+ if (TRUE == CFSDirectory::RemoveDirectory(l_cDestPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete persistent directory successful.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete persistent directory unsuccessful.");
+ }
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archiving fails for %s to %s", l_pcRootDirPath.c_str(),
+ l_cDestPath.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Folder archived %s ", l_cDestPath.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Source Path %s", l_pcRootDirPath.c_str());
+
+ if (TRUE == CFSDirectory::RemoveDirectory(l_pcRootDirPath)) { // LCOV_EXCL_BR_LINE 6: always return true
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete temporary directory successful.");
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete temporary directory unsuccessful."); // LCOV_EXCL_LINE 6: always return true // NOLINT[whitespace/line_length]
+ }
+ l_estatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_cDestPath and l_pcRootDirPath cannot be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ libtar_list_free(l_pLibTarList, NULL);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ExtractTar
+/// Method to extract tar
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::ExtractTar(const std::string &f_csourepath,
+ const std::string &f_cdestpath,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_pcTarFileDestPath = f_cdestpath;
+ std::string l_pcRootDirPath = f_csourepath;
+
+ if (!l_pcTarFileDestPath.empty() || !l_pcRootDirPath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be empty // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != Extract(l_pcRootDirPath, l_pcTarFileDestPath)) {
+ // not copied properly so remove temporary file
+ if (TRUE == CFSDirectory::RemoveDirectory(l_pcTarFileDestPath)) { // LCOV_EXCL_BR_LINE 6: RemoveDirectory always return true // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete retrieved directory successful.");
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete retrieved directory unsuccessful."); // LCOV_EXCL_LINE 6: RemoveDirectory always return true // NOLINT[whitespace/line_length]
+ }
+
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "ABORT WAS CALLED!");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Extraction fails for %s to %s",
+ l_pcTarFileDestPath.c_str(), l_pcTarFileDestPath.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Folder extracted %s ", l_pcTarFileDestPath.c_str());
+ l_estatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Create
+/// Method to create tar
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::Create(std::string &f_pctarfiledestpath,
+ std::string &f_pcrootdirpath,
+ libtar_list_t *f_plibtarlist) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (FILEERROR == access(f_pcrootdirpath.c_str(), R_OK)) { // LCOV_EXCL_BR_LINE 6: access always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 6: access always return ok
+ }
+
+ TAR *l_pTarInfo = NULL;
+ CHAR l_cBuffer[MAX_PATH_LENGTH];
+ libtar_listptr_t l_pTarListPtr;
+
+ PCHAR l_pcTarFileDestPath = const_cast<PCHAR >(f_pctarfiledestpath.c_str());
+ PCHAR l_pcRootDirPath = const_cast<PCHAR >(f_pcrootdirpath.c_str());
+
+ CHAR l_temp[] = "/";
+
+ if (l_pcTarFileDestPath || l_pcRootDirPath) { // LCOV_EXCL_BR_LINE 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be NULL // NOLINT[whitespace/line_length]
+ // open tar archive
+ if (LIBTARFAIL == (tar_open(&l_pTarInfo, l_pcTarFileDestPath, &g_gztype, O_WRONLY | O_CREAT, // LCOV_EXCL_BR_LINE 6: tar_open always return ok // NOLINT[whitespace/line_length]
+ TARMODE, TAR_GNU))) {
+ // LCOV_EXCL_START 6: tar_open always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_open(): %s", std::strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ libtar_listptr_reset(&l_pTarListPtr);
+
+ while (libtar_list_next(f_plibtarlist, &l_pTarListPtr) != LIBTARSUCCESS) {
+ if (l_pcRootDirPath[0] != '/') { // LCOV_EXCL_BR_LINE 6: l_pcRootDirPath must begin with '/'
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s", l_pcRootDirPath); // LCOV_EXCL_LINE 6: l_pcRootDirPath must begin with '/' // NOLINT[whitespace/line_length]
+ } else {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_cBuffer, l_pcRootDirPath, sizeof(l_cBuffer));
+#endif
+ }
+
+ if (tar_append_tree(l_pTarInfo, l_cBuffer, l_temp) != LIBTARSUCCESS) { // LCOV_EXCL_BR_LINE 6: tar_append_tree always return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: tar_append_tree always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__,
+ "tar_append_tree(\"%s\", \"%s\"): %s", l_cBuffer,
+ l_temp, std::strerror(errno));
+ tar_close(l_pTarInfo);
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+ if (tar_append_eof(l_pTarInfo) != LIBTARSUCCESS) { // LCOV_EXCL_BR_LINE 6: tar_append_eof always return ok
+ // LCOV_EXCL_START 6: tar_append_eof always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_append_eof(): %s", std::strerror(errno));
+ tar_close(l_pTarInfo);
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (tar_close(l_pTarInfo) != LIBTARSUCCESS) { // LCOV_EXCL_BR_LINE 6: tar_close always return ok
+ // LCOV_EXCL_START 6: tar_close always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_close(): %s", std::strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// create
+/// Method to extract tar
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::Extract(std::string &f_pcrootdirpath, std::string &f_pctarfiledestpath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (FILEERROR == access(f_pcrootdirpath.c_str(), R_OK)) { // LCOV_EXCL_BR_LINE 6: access always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 6: access always return ok
+ }
+
+ PCHAR l_pcRootDirPath = const_cast<PCHAR >(f_pcrootdirpath.c_str());
+ PCHAR l_pcTarFileDestPath = const_cast<PCHAR >(f_pctarfiledestpath.c_str());
+
+ TAR *l_pTarInfo = NULL;
+
+ if (l_pcRootDirPath || l_pcTarFileDestPath) { // LCOV_EXCL_BR_LINE 6: double check, l_pcRootDirPath and l_pcTarFileDestPath can't be NULL // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Extraction open for %s to ", l_pcRootDirPath);
+
+ if (LIBTARFAIL == (tar_open(&l_pTarInfo, l_pcRootDirPath, &g_gztype, O_RDONLY, LIBTARSUCCESS, TAR_GNU))) { // LCOV_EXCL_BR_LINE 6: tar_open always return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: tar_open always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_open(): %s", std::strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (LIBTARSUCCESS != tar_extract_all(l_pTarInfo, l_pcTarFileDestPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_extract_all(): %s", std::strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (LIBTARSUCCESS != tar_close(l_pTarInfo)) { // LCOV_EXCL_BR_LINE 6: tar_close always return ok
+ // LCOV_EXCL_START 6: tar_close always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_close(): %s", std::strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pcRootDirPath and l_pcTarFileDestPath can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+SI_32 OpenArchive(PCHAR f_pcpathname, SI_32 f_sioflags, SI_32 f_simode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ gzFile l_gzfile = Z_NULL;
+ SI_32 l_sifiledescriptor = LIBTARFAIL;
+ if (f_pcpathname) { // LCOV_EXCL_BR_LINE 6: double check, f_pcpathname can't be NULL
+ PCHAR l_pcgzoflags;
+
+ switch (f_sioflags & O_ACCMODE) {
+ case O_WRONLY: {
+ l_pcgzoflags = (PCHAR)"wb";
+ break;
+ }
+ case O_RDONLY: {
+ l_pcgzoflags = (PCHAR)"rb";
+ break;
+ }
+ case O_RDWR:
+ default: {
+ // LCOV_EXCL_START 6: must be O_WRONLY or O_RDONLY
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EINVAL;
+ return LIBTARFAIL;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ l_sifiledescriptor = open(f_pcpathname, f_sioflags, f_simode);
+
+ if (LIBTARFAIL == l_sifiledescriptor) { // LCOV_EXCL_BR_LINE 6: l_sifiledescriptor always be ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return LIBTARFAIL; // LCOV_EXCL_LINE 6: l_sifiledescriptor always be ok
+ }
+
+ if (((f_sioflags & O_CREAT) && fchmod(l_sifiledescriptor, f_simode))) { // LCOV_EXCL_BR_LINE 6: always be ok
+ // LCOV_EXCL_START 6: always be ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(l_sifiledescriptor);
+ return LIBTARFAIL;
+ // LCOV_EXCL_STOP
+ }
+
+ l_gzfile = gzdopen(l_sifiledescriptor, l_pcgzoflags);
+ if (!l_gzfile) { // LCOV_EXCL_BR_LINE 6: l_gzfile always be not null
+ // LCOV_EXCL_START 6: l_gzfile always be not null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(l_sifiledescriptor);
+
+ errno = ENOMEM;
+ return LIBTARFAIL;
+ // LCOV_EXCL_STOP
+ } else {
+ g_gzfiles.insert(std::make_pair(l_sifiledescriptor, l_gzfile));
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path empty."); // LCOV_EXCL_LINE 6: double check, f_pcpathname can't be NULL // NOLINT[whitespace/line_length]
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_sifiledescriptor;
+}
+
+int CloseArchive(int fd) {
+ int ret;
+ gzFile gzfile = Z_NULL;
+
+ /* checks */
+ if (g_gzfiles.empty()) { // LCOV_EXCL_BR_LINE 6: g_gzfiles always be not empty
+ // LCOV_EXCL_START 6: g_gzfiles always be not empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EBADF;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ GZFiles::iterator gzfiles_it = g_gzfiles.find(fd);
+ if (gzfiles_it == g_gzfiles.end()) { // LCOV_EXCL_BR_LINE 6: fd will always be found
+ // LCOV_EXCL_START 6: fd will always be found
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EINVAL;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ /* call zlib */
+ gzfile = gzfiles_it->second;
+ ret = gzclose(gzfile);
+
+ /* remove gzFile* association from our list */
+ g_gzfiles.erase(gzfiles_it);
+
+ return ret;
+}
+
+ssize_t ReadArchive(int fd, void *buf, size_t count) {
+ gzFile gzfile = Z_NULL;
+
+ if (g_gzfiles.empty()) { // LCOV_EXCL_BR_LINE 6: g_gzfiles always be not empty
+ // LCOV_EXCL_START 6: g_gzfiles always be not empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EBADF;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ GZFiles::iterator gzfiles_it = g_gzfiles.find(fd);
+ if (gzfiles_it == g_gzfiles.end()) { // LCOV_EXCL_BR_LINE 6: fd will always be found
+ // LCOV_EXCL_START 6: fd will always be found
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EINVAL;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ gzfile = gzfiles_it->second;
+ return gzread(gzfile, buf, static_cast<UI_32>(count));
+}
+
+ssize_t WriteArchive(int fd, const void *buf, size_t count) {
+ gzFile gzfile = Z_NULL;
+
+ if (g_gzfiles.empty()) { // LCOV_EXCL_BR_LINE 6: g_gzfiles always be not empty
+ // LCOV_EXCL_START 6: g_gzfiles always be not empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EBADF;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ GZFiles::iterator gzfiles_it = g_gzfiles.find(fd);
+ if (gzfiles_it == g_gzfiles.end()) { // LCOV_EXCL_BR_LINE 6: fd will always be found
+ // LCOV_EXCL_START 6: fd will always be found
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ errno = EINVAL;
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ gzfile = gzfiles_it->second;
+ return gzwrite(gzfile, buf, static_cast<UI_32>(count));
+}
+
+// LCOV_EXCL_START 6: unused code
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FileOperationUsingLibz
+/// Method to determine whether to compress/decompress file using libz
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::FileOperationUsingLibz(NSP_CopyInfoCmd &f_toperainfocmd,
+ NSP_CopyStatusResponse &f_toperarespstatus) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_pSourcePath = f_toperainfocmd.m_csourcepath;
+ std::string l_pDestPath = f_toperainfocmd.m_cdestinationpath;
+
+ if (!l_pSourcePath.empty() || !l_pDestPath.empty()) {
+ size_t l_ifound = l_pDestPath.rfind("/");
+ // get string from start to last occurrence of '/'. Which will return directory path
+ std::string l_cOutDirPath = l_pDestPath.substr(0, l_ifound);
+
+ // check if destination directory exist
+ if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s DOESN'T exist, Creating...",
+ l_cOutDirPath.c_str());
+ l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath);
+ }
+
+ // check for load file or release file
+ if (LOADTYPE_RELEASE == f_toperainfocmd.m_eloadtype) {
+ // Zip
+ if (eFrameworkunifiedStatusOK == (l_estatus = CompressUsingZlib(l_pSourcePath, l_pDestPath, Z_BEST_COMPRESSION))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "File Compression successful.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "File Compression failed.");
+ f_toperarespstatus.m_bpersistencechk = FALSE;
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else if (LOADTYPE_LOAD == f_toperainfocmd.m_eloadtype) {
+ // Unzip
+ if (eFrameworkunifiedStatusOK == (l_estatus = DeCompressUsingZlib(l_pSourcePath, l_pDestPath))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "File DeCompression successful.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "File DeCompression failed.");
+ f_toperarespstatus.m_bpersistencechk = FALSE;
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Wrong Request or No request for compression or decompression!");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path or Destination Path Empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 6: unused code
+////////////////////////////////////////////////////////////////////////////////////////////
+/// CompressUsingZlib
+/// Method to compress file using libz
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::CompressUsingZlib(const std::string &f_csourepath,
+ const std::string &f_cdestpath,
+ SI_32 f_iziplevel) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (!f_csourepath.empty() || !f_cdestpath.empty()) {
+ std::string l_cSourePath = f_csourepath;
+ std::string l_cDestPath = f_cdestpath;
+
+ std::string l_TempFile = "";
+ l_TempFile.append(l_cDestPath.c_str());
+ l_TempFile.append(".nps_tmp");
+
+ FILE *l_pSrcFilePtr = fopen(l_cSourePath.c_str(), "rb");
+
+ if (NULL != l_pSrcFilePtr) {
+ FILE *l_pDestFilePtr = fopen(l_TempFile.c_str(), "wb");
+ if (NULL != l_pDestFilePtr) {
+ setvbuf(l_pSrcFilePtr, NULL, _IOFBF, kBufSize);
+ setvbuf(l_pDestFilePtr, NULL, _IOFBF, kBufSize);
+
+ // structure used to pass information to and from the zlib routines
+ z_stream l_tZstreamInfo = {};
+
+ // Allocate deflate state
+ l_tZstreamInfo.zalloc = Z_NULL;
+ l_tZstreamInfo.zfree = Z_NULL;
+ l_tZstreamInfo.opaque = Z_NULL;
+
+ // Initialize deflates
+ SI_32 l_iDeflateStatus = deflateInit(&l_tZstreamInfo, f_iziplevel);
+
+ // Deflate Flush Status to determine end of input file
+ SI_32 l_iDeflateFlushState = Z_FINISH;
+
+ std::vector< UI_8 > l_vInBuffer(kChunkSize);
+ std::vector< UI_8 > l_vOutBuffer(kChunkSize);
+
+ // pointer to the read bytes from the input file
+ UI_8 *l_pReadBuffer = &l_vInBuffer[0];
+ // pointer to the next available byte space to write to output file
+ UI_8 *l_pWriteBuffer = &l_vOutBuffer[0];
+
+ size_t l_uiDeflateRetData = 0;
+
+ if (Z_OK == l_iDeflateStatus) {
+ do {
+ // bytes read from input file
+ l_tZstreamInfo.avail_in = static_cast<uInt>(fread(l_pReadBuffer, 1, kChunkSize, l_pSrcFilePtr));
+
+ if (0 == ferror(l_pSrcFilePtr)) {
+ // if the eof input file reached set the flush state to Z_FINISH
+ // Z_NO_FLUSH to indicate that we still have uncompressed data
+ l_iDeflateFlushState = feof(l_pSrcFilePtr) ? Z_FINISH : Z_NO_FLUSH;
+ l_tZstreamInfo.next_in = l_pReadBuffer;
+
+ // run deflate() on input until output buffer not full, finish
+ // compression if all of source has been read in
+ do {
+ l_tZstreamInfo.avail_out = kChunkSize;
+ l_tZstreamInfo.next_out = l_pWriteBuffer;
+ // no bad return value
+ l_iDeflateStatus = deflate(&l_tZstreamInfo, l_iDeflateFlushState);
+ // state not clobbered
+ if (Z_STREAM_ERROR == l_iDeflateStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "zlib stream error");
+ } else {
+ l_uiDeflateRetData = kChunkSize - l_tZstreamInfo.avail_out;
+ if ((fwrite(l_pWriteBuffer, 1, l_uiDeflateRetData, l_pDestFilePtr) != l_uiDeflateRetData) ||
+ // all data not written properly
+ (0 != ferror(l_pDestFilePtr))) { // file error in writing
+ deflateEnd(&l_tZstreamInfo);
+ l_estatus = eFrameworkunifiedStatusFail;
+ l_tZstreamInfo.avail_out = 0;
+ l_iDeflateFlushState = Z_FINISH;
+ }
+ }
+ } while (0 == l_tZstreamInfo.avail_out); //<< check if deflate() has no more output
+ } else { // by seeing that it did not fill the output buffer
+ deflateEnd(&l_tZstreamInfo); // leaving avail_out greater than zero >>//
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ // all input will be used
+ if (0 != l_tZstreamInfo.avail_in) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All inputs in z-stream avail_in not used");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ // done when last data in file processed
+ } while (Z_FINISH != l_iDeflateFlushState);
+ // stream will be complete
+ if (Z_STREAM_END != l_iDeflateStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "z-stream not completed");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Compressed %lu bytes down to %lu bytes",
+ l_tZstreamInfo.total_in, l_tZstreamInfo.total_out);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written in NAND memory, %lu, file=%s", l_tZstreamInfo.total_out,
+ f_cdestpath.c_str());
+
+ // clean up and return
+ deflateEnd(&l_tZstreamInfo);
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "deflateInit Failed");
+ }
+
+ fclose(l_pDestFilePtr);
+
+ if (0 != rename(l_TempFile.c_str(), l_cDestPath.c_str())) {
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error renaming file %s to %s",
+ l_TempFile.c_str(), l_cDestPath.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Destination File Opening Error");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ fclose(l_pSrcFilePtr);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Source File Opening Error");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path or Destination Path Empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 6: unused code
+////////////////////////////////////////////////////////////////////////////////////////////
+/// DeCompressUsingZlib
+/// Method to decompress file using libz
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CArchive::DeCompressUsingZlib(const std::string &f_csourepath,
+ const std::string &f_cdestpath) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (!f_csourepath.empty() || !f_cdestpath.empty()) {
+ std::string l_cSourePath = f_csourepath;
+ std::string l_cDestPath = f_cdestpath;
+
+ std::string l_TempFile = "";
+ l_TempFile.append(l_cDestPath.c_str());
+ l_TempFile.append(".nps_tmp");
+
+ FILE *l_pSrcFilePtr = fopen(l_cSourePath.c_str(), "rb");
+
+ if (NULL != l_pSrcFilePtr) {
+ FILE *l_pDestFilePtr = fopen(l_TempFile.c_str(), "wb");
+ if (NULL != l_pDestFilePtr) {
+ setvbuf(l_pSrcFilePtr, NULL, _IOFBF, kBufSize);
+ setvbuf(l_pDestFilePtr, NULL, _IOFBF, kBufSize);
+
+ z_stream l_tZstreamInfo = {};
+
+ // allocate inflate state
+ l_tZstreamInfo.zalloc = Z_NULL;
+ l_tZstreamInfo.zfree = Z_NULL;
+ l_tZstreamInfo.opaque = Z_NULL;
+ l_tZstreamInfo.avail_in = 0;
+ l_tZstreamInfo.next_in = Z_NULL;
+
+ SI_32 l_iInflateStatus = inflateInit(&l_tZstreamInfo);
+
+ if (Z_OK == l_iInflateStatus) {
+ std::vector< UI_8 > l_vInBuffer(kChunkSize);
+ std::vector< UI_8 > l_vOutBuffer(kChunkSize);
+
+ // pointer to the read bytes from the input file
+ UI_8 *l_pReadBuffer = &l_vInBuffer[0];
+ // pointer to the next available byte space to write to output file
+ UI_8 *l_pWriteBuffer = &l_vOutBuffer[0];
+
+ size_t l_uiDeflateRetData = 0;
+
+ do {
+ l_tZstreamInfo.avail_in = static_cast<uInt>(fread(l_pReadBuffer, 1, kChunkSize, l_pSrcFilePtr));
+ if (0 == ferror(l_pSrcFilePtr)) {
+ if (0 == l_tZstreamInfo.avail_in) {
+ break;
+ }
+ l_tZstreamInfo.next_in = l_pReadBuffer;
+ // run inflate() on input until output buffer not full
+ do {
+ l_tZstreamInfo.avail_out = kChunkSize;
+ l_tZstreamInfo.next_out = l_pWriteBuffer;
+ l_iInflateStatus = inflate(&l_tZstreamInfo, Z_NO_FLUSH);
+
+ // state clobbered
+ if (Z_STREAM_ERROR == l_iInflateStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "zlib stream error");
+ l_estatus = eFrameworkunifiedStatusFail;
+ } else if (Z_NEED_DICT == l_iInflateStatus) {
+ l_iInflateStatus = Z_DATA_ERROR;
+ l_estatus = eFrameworkunifiedStatusFail;
+ } else if (Z_MEM_ERROR == l_iInflateStatus) {
+ inflateEnd(&l_tZstreamInfo);
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Out of Memory");
+ } else {
+ l_uiDeflateRetData = kChunkSize - l_tZstreamInfo.avail_out;
+ // all data not written
+ if ((fwrite(l_pWriteBuffer, 1, l_uiDeflateRetData, l_pDestFilePtr) != l_uiDeflateRetData) ||
+ (0 != ferror(l_pDestFilePtr))) { // or file writing error
+ inflateEnd(&l_tZstreamInfo);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ } while (0 == l_tZstreamInfo.avail_out);
+ } else {
+ inflateEnd(&l_tZstreamInfo);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ // done when inflate() says it's done
+ } while (Z_STREAM_END != l_iInflateStatus);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " De-compressed %lu bytes to %lu bytes",
+ l_tZstreamInfo.total_in, l_tZstreamInfo.total_out);
+ // clean up and return
+ inflateEnd(&l_tZstreamInfo);
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ fclose(l_pDestFilePtr);
+
+ if (0 != rename(l_TempFile.c_str(), l_cDestPath.c_str())) {
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error renaming file %s to %s",
+ l_TempFile.c_str(), l_cDestPath.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Destination File Opening Error");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ fclose(l_pSrcFilePtr);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Source File Opening Error");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path or Destination Path Empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp
new file mode 100755
index 0000000..e0a749f
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp
@@ -0,0 +1,649 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains definition of CBinaryAccesser class.
+/// This class stores data in a file in binary format.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+#endif
+#include <cerrno>
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_binary_accesser.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_persistent_accesser.h"
+
+struct PersistFileHeder {
+ char check_code[4];
+ unsigned int crc;
+};
+#define NPP_CHECK_CODE "NPPD"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CBinaryAccesser
+/// Constructor of CBinaryAccesser class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CBinaryAccesser::CBinaryAccesser() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_uiCurStrOffset = 0;
+ m_uiCurStrSize = 0;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CBinaryAccesser
+/// Destructor of CBinaryAccesser class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CBinaryAccesser::~CBinaryAccesser() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// PersistData
+/// Persist data in persistent memory in a file in binary format.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::PersistData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *f_vdata,
+ EFrameworkunifiedNotificationType f_epersistenttype,
+ EFrameworkunifiedPersistCategory f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ int l_OutFd;
+
+ if (NULL != f_vdata) { // LCOV_EXCL_BR_LINE 6: f_vdata can't be NULL
+ // Open global file in write mode.
+ if ((eFrameworkunifiedStatusOK == OpenFileForWriting(&l_OutFd, f_cmemfilepath))) {
+ Persistent_Notification_List_Iterator l_itNotificationList = f_vdata->begin();
+
+ // Iterate through a vector f_vdata
+ for (; l_itNotificationList != f_vdata->end(); l_itNotificationList++) {
+ if (eFrameworkunifiedPersistedStateVar == (*l_itNotificationList)->m_ePersistentType) {
+ if (f_epersistcategory == (*l_itNotificationList)->m_ePersistCategory) {
+ // write header and data
+ if (eFrameworkunifiedStatusOK != WriteHeaderAndData((*l_itNotificationList),
+ (*l_itNotificationList)->m_pPersistentData->m_pMessage,
+ l_OutFd)) {
+ l_estatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ }
+ } else {
+ // write header and data
+ if (eFrameworkunifiedStatusOK != WriteHeaderAndData((*l_itNotificationList),
+ (*l_itNotificationList)->m_pPersistentData->m_pMessage,
+ l_OutFd)) {
+ l_estatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != WriteFileHeaderAndDuplicate(l_OutFd, f_cmemfilepath)) {
+ l_estatus = eFrameworkunifiedStatusFail;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written in NAND memory, %ld, file=%s",
+ static_cast<long int>(m_uiCurStrOffset - sizeof(PersistFileHeder)), f_cmemfilepath.c_str()); // NOLINT (runtime/int)
+ }
+ close(l_OutFd);
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file %s", f_cmemfilepath.c_str());
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// RetrieveData
+/// Retrieve data in persistent memory in a file in binary format.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::RetrieveData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *&f_vdata,
+ EFrameworkunifiedPersistCategory f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ int l_InFd;
+
+ if (NULL != f_vdata) { // LCOV_EXCL_BR_LINE 6: f_vdata can't be NULL
+ if ((eFrameworkunifiedStatusOK == (l_estatus = OpenFileForReading(&l_InFd, f_cmemfilepath)))) {
+ l_estatus = FillNotificationList(l_InFd, f_vdata, f_epersistcategory);
+
+ close(l_InFd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file %s, status=%d", f_cmemfilepath.c_str(), l_estatus);
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_vdata can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_pdata is NULL");
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// FillNotificationList
+/// This function retrieve the notification data from file and fill it in map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::FillNotificationList(int f_infd,
+ Persistent_Notification_List_Type *&f_vdata,
+ EFrameworkunifiedPersistCategory f_epersistcategory) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL == f_vdata) { // LCOV_EXCL_BR_LINE 6: f_vdata can't be NULL
+ // LCOV_EXCL_START 6: f_vdata can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_pdata is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ while (eFrameworkunifiedStatusOK == l_estatus) {
+ CPersistDataHeader l_objCPersistDataHeader;
+ CHAR *l_pData = NULL;
+
+ // Read header and data.
+ l_estatus = ReadHeaderAndData(l_objCPersistDataHeader, l_pData, f_infd);
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ CNotificationsToPersist *l_objCNotificationsToPersist = new(std::nothrow) CNotificationsToPersist();
+ CPersistentData *l_objCPersistentData = new(std::nothrow) CPersistentData();
+
+ // fill the appropriate values in l_objCNotificationsToPersist
+ if ((NULL != l_objCPersistentData) && (NULL != l_objCNotificationsToPersist)) { // LCOV_EXCL_BR_LINE 5: new's error case // NOLINT[whitespace/line_length]
+ l_objCPersistentData->m_pMessage = new(std::nothrow) CHAR[l_objCPersistDataHeader.m_uiSize];
+ if (NULL != l_objCPersistentData->m_pMessage) { // LCOV_EXCL_BR_LINE 5: new's error case
+ std::memcpy(l_objCPersistentData->m_pMessage, l_pData, l_objCPersistDataHeader.m_uiSize);
+ l_objCPersistentData->m_uiMsgSize = l_objCPersistDataHeader.m_uiSize;
+ l_objCNotificationsToPersist->m_ePersistentType = l_objCPersistDataHeader.m_ePersistentType;
+ l_objCNotificationsToPersist->m_ePersistCategory = f_epersistcategory;
+
+ l_objCNotificationsToPersist->m_cNotificationName = l_objCPersistDataHeader.m_cNotificationName;
+ l_objCNotificationsToPersist->m_cPublisherName = l_objCPersistDataHeader.m_cPublisherName;
+
+ l_objCNotificationsToPersist->m_pPersistentData = l_objCPersistentData;
+
+ l_objCNotificationsToPersist->m_uiMaxMsgLength = l_objCPersistDataHeader.m_uiMaxMsgLength;
+ f_vdata->push_back(l_objCNotificationsToPersist);
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::memset(&l_objCPersistDataHeader, 0, sizeof(CPersistDataHeader));
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::memset(&l_objCPersistDataHeader, 0, sizeof(CPersistDataHeader));
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ } else if (eFrameworkunifiedStatusErrOther == l_estatus) {
+ // EOF
+ l_estatus = eFrameworkunifiedStatusOK;
+ break;
+ } else {
+ std::memset(&l_objCPersistDataHeader, 0, sizeof(CPersistDataHeader));
+ break;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::OpenFileForReading(int *f_infd,
+ std::string f_cfilepath) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // raw & raw.bak file unlink
+ std::string l_cUnlinkPath(f_cfilepath);
+ unlink(l_cUnlinkPath.c_str());
+ l_cUnlinkPath.append(".bak");
+ unlink(l_cUnlinkPath.c_str());
+
+ // add .valid
+ std::string l_cValidPath(f_cfilepath);
+ l_cValidPath.append(".valid");
+
+ if ((*f_infd = open(l_cValidPath.c_str(), O_RDONLY)) >= 0) {
+ if (eFrameworkunifiedStatusOK == CheckFileHeader(*f_infd)) {
+ struct stat st;
+ if (fstat(*f_infd, &st) == 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
+ if (st.st_size == 0) {
+ // If original file is 0byte, to confirm bak file
+ int bak_fd;
+ if (eFrameworkunifiedStatusOK == OpenBakFileForReading(&bak_fd, l_cValidPath)) {
+ close(*f_infd);
+ *f_infd = bak_fd;
+ }
+ }
+ }
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ close(*f_infd);
+ l_estatus = OpenBakFileForReading(f_infd, l_cValidPath);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) fail: %s", l_cValidPath.c_str(), strerror(errno));
+ l_estatus = OpenBakFileForReading(f_infd, l_cValidPath);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// OpenFileForWriting
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::OpenFileForWriting(int *f_outfd,
+ std::string f_cfilepath) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ std::string l_cPath(f_cfilepath);
+ size_t l_ifound = l_cPath.rfind("/");
+ std::string l_cOutDirPath = l_cPath.substr(0, l_ifound);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Path for persistence %s ", l_cOutDirPath.c_str());
+
+ // if parent directory path doesn't exists, create it
+ if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s DOESN'T exist, Creating...", l_cOutDirPath.c_str());
+ if (eFrameworkunifiedStatusOK != (l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath))) { // LCOV_EXCL_BR_LINE 6: CreateDirectory always return ok // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Failed to create %s ", l_cOutDirPath.c_str()); // LCOV_EXCL_LINE 6: CreateDirectory always return ok // NOLINT[whitespace/line_length]
+ }
+ }
+
+ // add .valid
+ std::string l_cValidPath(f_cfilepath);
+ l_cValidPath.append(".valid");
+
+ if ((*f_outfd = open(l_cValidPath.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0660)) >= 0) {
+ if (lseek(*f_outfd, sizeof(PersistFileHeder), SEEK_SET) == sizeof(PersistFileHeder)) { // LCOV_EXCL_BR_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ l_estatus = eFrameworkunifiedStatusOK;
+ m_uiCurStrOffset = sizeof(PersistFileHeder);
+ } else {
+ // LCOV_EXCL_START 5: lseek's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno));
+ close(*f_outfd);
+ *f_outfd = -1;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) fail: %s", l_cValidPath.c_str(), strerror(errno));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// WriteHeaderAndData
+/// Write header and data in a file.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::WriteHeaderAndData(CNotificationsToPersist *f_pnotificationstopersist,
+ PVOID f_pdata,
+ int f_outfd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+
+ if ((NULL == f_pdata) || (NULL == f_pnotificationstopersist)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_pdata is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ } else {
+ CPersistDataHeader l_objCPersistDataHeader;
+
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_objCPersistDataHeader.m_cNotificationName, f_pnotificationstopersist->m_cNotificationName.c_str(),
+ sizeof(l_objCPersistDataHeader.m_cNotificationName));
+ strlcpy(l_objCPersistDataHeader.m_cPublisherName, f_pnotificationstopersist->m_cPublisherName.c_str(),
+ sizeof(l_objCPersistDataHeader.m_cPublisherName));
+#endif
+
+ // size check
+ if (UINT32_MAX >= static_cast<size_t>(sizeof(CPersistDataHeader) + l_objCPersistDataHeader.m_uiSize)) { // LCOV_EXCL_BR_LINE 5: the size is not bigger than UINT32_MAX // NOLINT[whitespace/line_length]
+ l_objCPersistDataHeader.m_uiOffset = static_cast<UI_32>(m_uiCurStrOffset + sizeof(CPersistDataHeader));
+ l_objCPersistDataHeader.m_uiSize = f_pnotificationstopersist->m_pPersistentData->m_uiMsgSize;
+ l_objCPersistDataHeader.m_ePersistentType = f_pnotificationstopersist->m_ePersistentType;
+ l_objCPersistDataHeader.m_uiMaxMsgLength = f_pnotificationstopersist->m_uiMaxMsgLength;
+
+ // write header
+ if (write(f_outfd, (PCHAR)&l_objCPersistDataHeader, sizeof(CPersistDataHeader)) == sizeof(CPersistDataHeader)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ // write data
+ if (write(f_outfd, (PCHAR)f_pdata, // LCOV_EXCL_BR_LINE 5: write's error case
+ l_objCPersistDataHeader.m_uiSize) == (ssize_t)l_objCPersistDataHeader.m_uiSize) {
+ // save offset of end of current record's data
+ m_uiCurStrOffset += static_cast<UI_32>(sizeof(CPersistDataHeader) + l_objCPersistDataHeader.m_uiSize);
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while writing data: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while writing header: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CBinaryAccesser::ReadHeaderAndData(CPersistDataHeader &f_objcpersistdataheader,
+ CHAR *&f_pdata, int f_infd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ static UI_32 l_uisPrevAllocSz = 0;
+ ssize_t l_iRet;
+
+ // read header
+ l_iRet = read(f_infd, (PCHAR)&f_objcpersistdataheader, sizeof(f_objcpersistdataheader));
+ if (l_iRet != sizeof(f_objcpersistdataheader)) {
+ if (l_iRet < 0) { // LCOV_EXCL_BR_LINE 5: read's error case
+ // LCOV_EXCL_START 5: read's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while reading header: %s", strerror(errno));
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ l_estatus = eFrameworkunifiedStatusErrOther; // TODO(my_username): set specific error as eNotificationpersistentserviceStatusEOFReadched
+ }
+ std::memset(&f_objcpersistdataheader, 0, sizeof(CPersistDataHeader));
+ } else { // read data
+ m_uiCurStrOffset += static_cast<UI_32>(sizeof(CPersistDataHeader));
+ if (static_cast<int>(f_objcpersistdataheader.m_uiSize) > 0 &&
+ m_uiCurStrOffset + f_objcpersistdataheader.m_uiSize <= m_uiCurStrSize) {
+ // if f_pdata has space allocated and if the allocated size less than new size,
+ // free and reallocate
+ if ((NULL != f_pdata) && (l_uisPrevAllocSz < f_objcpersistdataheader.m_uiSize)) { // LCOV_EXCL_BR_LINE 6: f_pdata must be null // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: f_pdata must be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete[] f_pdata;
+ f_pdata = NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ if (NULL == f_pdata) { // LCOV_EXCL_BR_LINE 200: f_pdata must be null
+ f_pdata = new(std::nothrow) CHAR[f_objcpersistdataheader.m_uiSize];
+ } else {
+ // memory already allcoated.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+
+ if (NULL != f_pdata) { // LCOV_EXCL_BR_LINE 6: f_pdata can't be null
+ l_uisPrevAllocSz = f_objcpersistdataheader.m_uiSize;
+ l_iRet = read(f_infd, (PCHAR)f_pdata, f_objcpersistdataheader.m_uiSize);
+ if (l_iRet == (ssize_t)f_objcpersistdataheader.m_uiSize) { // LCOV_EXCL_BR_LINE 5: read's error case
+ m_uiCurStrOffset += f_objcpersistdataheader.m_uiSize;
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while reading data: %s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_pdata can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem Allocation failure");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invlide data size: %u", f_objcpersistdataheader.m_uiSize);
+ std::memset(&f_objcpersistdataheader, 0, sizeof(CPersistDataHeader));
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+EFrameworkunifiedStatus CBinaryAccesser::WriteFileHeaderAndDuplicate(int f_outfd, std::string f_cfilepath) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ struct stat st;
+
+ if (fstat(f_outfd, &st) == 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
+ if (st.st_size > static_cast<long>(sizeof(PersistFileHeder))) { // NOLINT (runtime/int)
+ size_t body_size = static_cast<size_t>(st.st_size - sizeof(PersistFileHeder));
+ char *buf = new(std::nothrow) char[body_size];
+ if (buf != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ if (lseek(f_outfd, sizeof(PersistFileHeder), SEEK_SET) == sizeof(PersistFileHeder)) { // LCOV_EXCL_BR_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ if (read(f_outfd, buf, body_size) == static_cast<ssize_t>(body_size)) { // LCOV_EXCL_BR_LINE 5: read's error case // NOLINT[whitespace/line_length]
+ PersistFileHeder f_header;
+ std::memcpy(&f_header.check_code, NPP_CHECK_CODE, sizeof(f_header.check_code));
+ f_header.crc = static_cast<UI_32>(CalcCRC(buf, static_cast<UI_32>(body_size)));
+ if (lseek(f_outfd, 0, SEEK_SET) == 0) { // LCOV_EXCL_BR_LINE 5: lseek's error case
+ if (write(f_outfd, &f_header, sizeof(f_header)) == sizeof(f_header)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ eStatus = eFrameworkunifiedStatusOK;
+
+ // file duplicate
+ std::string bak_file_path = f_cfilepath;
+ bak_file_path.append(".valid.bak");
+ int bak_fd = open(bak_file_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0660);
+ if (bak_fd >= 0) { // LCOV_EXCL_BR_LINE 5: open's error case
+ if (write(bak_fd, &f_header, sizeof(f_header)) == sizeof(f_header)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ if (write(bak_fd, buf, body_size) != static_cast<ssize_t>(body_size)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ }
+ close(bak_fd);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: open's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case
+ }
+ delete[] buf;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem Allocation failure"); // LCOV_EXCL_LINE 5: new's error case
+ }
+ } else {
+ // 0byte file through
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: fstat's error case
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CBinaryAccesser::CheckFileHeader(int f_infd) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ struct stat st;
+
+ if (fstat(f_infd, &st) == 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
+ if (st.st_size > static_cast<long>(sizeof(PersistFileHeder))) { // NOLINT (runtime/int)
+ size_t body_size = static_cast<size_t>(st.st_size - sizeof(PersistFileHeder));
+ char *buf = new(std::nothrow) char[body_size];
+ if (buf != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ if (lseek(f_infd, sizeof(PersistFileHeder), SEEK_SET) == sizeof(PersistFileHeder)) { // LCOV_EXCL_BR_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ if (read(f_infd, buf, body_size) == static_cast<ssize_t>(body_size)) {
+ UI_32 crc32 = static_cast<UI_32>(CalcCRC(buf, static_cast<UI_32>(body_size)));
+ PersistFileHeder f_header;
+ if (lseek(f_infd, 0, SEEK_SET) == 0) { // LCOV_EXCL_BR_LINE 5: lseek's error case
+ if (read(f_infd, &f_header, sizeof(f_header)) == sizeof(f_header)) { // LCOV_EXCL_BR_LINE 5: read's error case // NOLINT[whitespace/line_length]
+ if (std::memcmp(&f_header.check_code, NPP_CHECK_CODE, sizeof(f_header.check_code)) == 0
+ && f_header.crc == crc32) {
+ m_uiCurStrOffset = sizeof(f_header);
+ m_uiCurStrSize = static_cast<UI_32>(st.st_size);
+ eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "file header fail: %02x %02x %02x %02x %#x:%#x",
+ f_header.check_code[0], f_header.check_code[1],
+ f_header.check_code[2], f_header.check_code[3], crc32, f_header.crc);
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail: %s", strerror(errno));
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case
+ }
+ delete[] buf;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem Allocation failure"); // LCOV_EXCL_LINE 5: new's error case
+ }
+ } else {
+ // 0byte file through
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: fstat's error case
+ }
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CBinaryAccesser::OpenBakFileForReading(int *f_infd, std::string f_cfilepath) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ std::string bak_file_path = f_cfilepath;
+ bak_file_path.append(".bak");
+
+ *f_infd = open(bak_file_path.c_str(), O_RDONLY);
+ if (*f_infd >= 0) {
+ struct stat st;
+ if (fstat(*f_infd, &st) == 0) {
+ // Error if bak file is 0byte
+ if (st.st_size > 0) {
+ if (eFrameworkunifiedStatusOK == CheckFileHeader(*f_infd)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s fail. bak file correct.", f_cfilepath.c_str());
+ eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ close(*f_infd);
+ *f_infd = -1;
+ }
+ } else {
+ close(*f_infd);
+ *f_infd = -1;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat fail: %s", strerror(errno));
+ close(*f_infd);
+ *f_infd = -1;
+ }
+ }
+
+ return eStatus;
+}
+
+/*
+ * CRC-32C lookup table
+ *
+ * Polynomial 0x1EDC6F41
+ */
+static const UI_32 crc32_lookup[4][256] = { // NOLINT (readability/naming)
+ {
+ },
+ {
+ },
+ {
+ },
+ {
+ }
+};
+
+UI_32 CBinaryAccesser::CalcCRC(PVOID f_pdata, UI_32 f_size) {
+ UI_32 crc = 0xFFFFFFFF;
+ const UI_32 *current = (const UI_32 *)f_pdata;
+
+ while (f_size >= 4) {
+ UI_32 one = *current++ ^ crc;
+ crc = crc32_lookup[0][(one >> 24) & 0xFF] ^
+ crc32_lookup[1][(one >> 16) & 0xFF] ^
+ crc32_lookup[2][(one >> 8) & 0xFF] ^
+ crc32_lookup[3][one & 0xFF];
+ f_size -= 4;
+ }
+
+ const UI_8 *current_char = (const UI_8 *)current;
+ while (f_size-- > 0) {
+ crc = (crc >> 8) ^ crc32_lookup[0][(crc & 0xFF) ^ *current_char++];
+ }
+
+ return ~crc;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp
new file mode 100755
index 0000000..4638a7d
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp
@@ -0,0 +1,1153 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file implements the CCopyWorker class.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_util_crc.h>
+#include <native_service/ns_logger_if.h>
+
+// standard headers
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <dirent.h>
+
+#include <string>
+#include <utility>
+
+// ns headers
+#include "ns_npp_copy_worker.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_persistence.h"
+#include "ns_npp_threads.h"
+#include "ns_npp.h"
+
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+/*#include "PosixBasedOS001legacy_types.h"*/
+#include <unistd.h>
+#include <sys/syscall.h>
+#endif
+
+#define NS_NPP_WRITESIZE1 4096
+#define NS_NPP_WRITESIZE2 32768
+#define NS_NPP_REMOVE_DIR_DELAY 100 // in ms
+#define NS_NPP_FILEWRITE_DELAY 50 // in ms
+
+pthread_mutex_t g_mutworkerthread = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t CCopyWorker::m_sAbortMutex = PTHREAD_MUTEX_INITIALIZER;
+BOOL CCopyWorker::m_sbAbortCopy = FALSE;
+
+template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)> EFrameworkunifiedStatus WorkerCallback(HANDLE hthread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ C *l_pClass = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hthread));
+
+ if (l_pClass) { // LCOV_EXCL_BR_LINE 6: l_pClass can't be NULL
+ l_estatus = (l_pClass->*M)(hthread);
+ }
+
+ return l_estatus;
+}
+
+// Initialize static members
+TMServiceTagCRC CCopyWorker::CCopyWorker::g_mservicetagcrc;
+CMutex CCopyWorker::CCopyWorker::g_objmtxservicetag;
+
+static FrameworkunifiedProtocolCallbackHandler aServiceHandlers[] = { // NOLINT (readability/naming) // LCOV_EXCL_BR_LINE 11: unexpected branch
+ { CP_WRK_CMD_COPY, WorkerCallback<CCopyWorker, &CCopyWorker::OnWrkCmdCopy> },
+ { CP_WRK_CMD_RESUME, WorkerCallback<CCopyWorker, &CCopyWorker::OnWrkCmdResume> },
+ { AR_CMD_ARCHIVE, WorkerCallback<CCopyWorker, &CCopyWorker::OnWrkCmdArchive> },
+ { CMD_WRK_SHUTDOWN_REQ, WorkerCallback<CCopyWorker, &CCopyWorker::OnCmdShutdownRequest>},
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CCopyWorker
+/// Constructor of CCopyWorker class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CCopyWorker::CCopyWorker() {
+ pthread_mutex_init(&m_sAbortMutex, NULL);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CCopyWorker
+/// Destructor of CCopyWorker class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CCopyWorker::~CCopyWorker() {
+ pthread_mutex_destroy(&m_sAbortMutex);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Abort
+/// Method to abort worker thread.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CCopyWorker::Abort() { // LCOV_EXCL_START 8: not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ pthread_mutex_lock(&m_sAbortMutex);
+ m_sbAbortCopy = TRUE;
+ pthread_mutex_unlock(&m_sAbortMutex);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// InAbortState
+/// Method to check for abort state.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CCopyWorker::InAbortState() const {
+ BOOL l_bAbortStatus = FALSE;
+ pthread_mutex_lock(&m_sAbortMutex);
+ l_bAbortStatus = m_sbAbortCopy;
+ pthread_mutex_unlock(&m_sAbortMutex);
+
+ return l_bAbortStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetCopyStatusToFailure
+/// Method to set the copy status failure.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::SetCopyStatusToFailure(NSP_CopyStatusResponse &f_tcopystatusresponse, // LCOV_EXCL_START 8: not used // NOLINT[whitespace/line_length]
+ const ENPS_CopyWorkerFailures f_eworkerfailcmd) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ f_tcopystatusresponse.m_bpersistencechk = FALSE;
+ f_tcopystatusresponse.m_ecopyfailures = f_eworkerfailcmd;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusFail;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnWrkCmdCopy
+/// Callback method on copy command.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnWrkCmdCopy(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ NSP_CopyStatusResponse l_tCopyStatus = {};
+ NSP_CopyInfoCmd l_tCopyInfo = {};
+ UI_32 l_uiFileSize = 0;
+ UI_32 l_ui32FileCRC = 0;
+ PSTR l_cTmpStorageFile = NULL;
+
+ if (NULL != hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
+ if (FrameworkunifiedGetMsgLength(hthread) == sizeof(l_tCopyInfo)) { // LCOV_EXCL_BR_LINE 200: the size of msg must be sizeof(NSP_CopyInfoCmd) // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tCopyInfo, sizeof(NSP_CopyInfoCmd), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_tCopyStatus.m_eloadtype = l_tCopyInfo.m_eloadtype;
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(l_tCopyStatus.m_cpersistenttag, l_tCopyInfo.m_cpersistenttag, sizeof(l_tCopyStatus.m_cpersistenttag));
+ strlcpy(l_tCopyStatus.m_crequesterappname,
+ l_tCopyInfo.m_crequesterappname,
+ sizeof(l_tCopyStatus.m_crequesterappname));
+#endif
+
+ l_tCopyStatus.m_epersisttype = l_tCopyInfo.m_epersisttype;
+
+ if (ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ == l_tCopyInfo.m_ecompressiontype) { // LCOV_EXCL_BR_LINE 6: l_tCopyInfo.m_ecompressiontype can't be ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: l_tCopyInfo.m_ecompressiontype can't be ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CCopyWorker::CArchive *l_pCArchive = new(std::nothrow) CCopyWorker::CArchive();
+
+ if (NULL != l_pCArchive) {
+ // Start the folder archive or extract operation
+ if (eFrameworkunifiedStatusOK == (l_estatus = l_pCArchive->FileOperationUsingLibz(l_tCopyInfo, l_tCopyStatus))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Compress/Decompress Successful");
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail; // Set the archive status to failure
+ }
+ delete l_pCArchive;
+ l_pCArchive = NULL;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Tag: %s SourceFile: %s DestFile: %s",
+ l_tCopyInfo.m_cpersistenttag != 0 ? l_tCopyInfo.m_cpersistenttag : NULL,
+ l_tCopyInfo.m_csourcepath != 0 ? l_tCopyInfo.m_csourcepath : NULL,
+ l_tCopyInfo.m_cdestinationpath != 0 ? l_tCopyInfo.m_cdestinationpath : NULL);
+
+ if (LOADTYPE_RELEASE == l_tCopyStatus.m_eloadtype) {
+ // if release, source file needs to check whether it's changed or not
+ l_cTmpStorageFile = l_tCopyInfo.m_csourcepath;
+ } else if (LOADTYPE_LOAD == l_tCopyStatus.m_eloadtype) { // LCOV_EXCL_BR_LINE 6: m_eloadtype must be LOADTYPE_RELEASE or LOADTYPE_LOAD // NOLINT[whitespace/line_length]
+ // if load, dest file needs to check whether it's changed or not
+ l_cTmpStorageFile = l_tCopyInfo.m_cdestinationpath;
+
+ // check if file on temporary location exists, then no need to load from persistent memory
+ if (0 == access(l_tCopyInfo.m_cdestinationpath, F_OK)) { // LCOV_EXCL_BR_LINE 5: access's error case
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "File to load::%s for source::%s "
+ "is already present on path:: %s.",
+ l_tCopyInfo.m_cpersistenttag != 0 ? l_tCopyInfo.m_cpersistenttag : NULL,
+ l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL,
+ l_tCopyInfo.m_cdestinationpath != 0 ? l_tCopyInfo.m_cdestinationpath : NULL);
+ l_estatus = eFrameworkunifiedStatusFileLoadSuccess;
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // let l_cTmpStorageFile be NULL.
+ }
+
+ if (eFrameworkunifiedStatusFileLoadSuccess == l_estatus) {
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ if (NULL != l_cTmpStorageFile) { // LCOV_EXCL_BR_LINE 6: l_cTmpStorageFile can't be NULL
+ if (!VerifyWithStoredCRC(l_tCopyStatus.m_crequesterappname,
+ l_tCopyStatus.m_cpersistenttag,
+ l_cTmpStorageFile,
+ l_ui32FileCRC)) { // l_ui32FileCRC: out param
+ // Check if file release and CRC verification is enabled
+ if ((LOADTYPE_RELEASE == l_tCopyStatus.m_eloadtype) && (CNSNPP::m_siCRCCheckCount > 0)) { // LCOV_EXCL_BR_LINE 200: cannot test code // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200: cannot test code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = TryFileCopyWithCRCCheck(l_tCopyInfo.m_csourcepath,
+ l_tCopyInfo.m_cdestinationpath,
+ CNSNPP::m_siCRCCheckCount);
+ // LCOV_EXCL_STOP
+ } else {
+ if (LOADTYPE_RELEASE == l_tCopyStatus.m_eloadtype) {
+ l_estatus = CopyFile(l_tCopyInfo.m_csourcepath,
+ l_tCopyInfo.m_cdestinationpath,
+ l_uiFileSize,
+ TRUE);
+ } else {
+ l_estatus = CopyFile(l_tCopyInfo.m_csourcepath,
+ l_tCopyInfo.m_cdestinationpath,
+ l_uiFileSize,
+ FALSE);
+ }
+ }
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written:%d file=%s",
+ l_uiFileSize, l_tCopyInfo.m_cdestinationpath != 0 ? l_tCopyInfo.m_cdestinationpath : NULL);
+ if (0 == l_ui32FileCRC) {
+ if (eFrameworkunifiedStatusOK != CalculateCRC32(l_cTmpStorageFile, l_ui32FileCRC)) { // LCOV_EXCL_BR_LINE 200: CalculateCRC32() return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200: CalculateCRC32() return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warn: getting crc. File:%s, crc:%d",
+ l_cTmpStorageFile, l_ui32FileCRC);
+ // LCOV_EXCL_STOP
+ }
+ }
+ UpdateTagCRC(l_tCopyStatus.m_crequesterappname, l_tCopyInfo.m_cpersistenttag, l_ui32FileCRC);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FileCopy Error, status : 0x%x", l_estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
+ "File %s not changed. No copy done. Load type:%d. Tag:%s for Requester:%s.",
+ l_cTmpStorageFile,
+ l_tCopyStatus.m_eloadtype,
+ l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL,
+ l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL);
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_cTmpStorageFile can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unknown load type:%d, for tag:%s",
+ l_tCopyStatus.m_eloadtype,
+ l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != l_estatus) {
+ l_tCopyStatus.m_bpersistencechk = FALSE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "COPY_FAILED_ID sending parent message. Tag:%s for Requester:%s.",
+ l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL,
+ l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL);
+
+ FrameworkunifiedSendParent(hthread, CP_WRK_NTFY, sizeof(NSP_CopyStatusResponse), &l_tCopyStatus);
+ } else {
+ l_tCopyStatus.m_bpersistencechk = TRUE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "COPY_COMPLETE_ID sending parent message. Tag:%s for Requester:%s.",
+ l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL,
+ l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL);
+
+ FrameworkunifiedSendParent(hthread, CP_WRK_NTFY, sizeof(NSP_CopyStatusResponse), &l_tCopyStatus);
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:FrameworkunifiedGetMsgDataOfSize returned:%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 200: the size of msg must be sizeof(NSP_CopyInfoCmd)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:MsgLength: Expected:%ld, Received:%d.",
+ static_cast<long int>(sizeof(l_tCopyInfo)), FrameworkunifiedGetMsgLength(hthread)); // NOLINT (runtime/int)
+ // LCOV_EXCL_STOP
+ }
+ l_estatus = SendAck(hthread, CP_WRK_CMD_COPY);
+ } else {
+ // LCOV_EXCL_START 6: hthread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetCopyBufSize
+/// Get the proper buffer size.
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 CCopyWorker::GetCopyBufSize(SI_32 f_si32openfd, UI_32 &f_ui32filesize) {
+ UI_32 l_ui32BufSize = NS_NPP_WRITESIZE1;
+ // to get the size of file
+ struct stat l_tSrcFstat = {};
+
+ if (-1 == fstat(f_si32openfd , &l_tSrcFstat)) { // LCOV_EXCL_BR_LINE 5: fstat's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat failure, errno:%d", errno); // LCOV_EXCL_LINE 5: fstat's error case
+ } else {
+ f_ui32filesize = static_cast<UI_32>(l_tSrcFstat.st_size); // set out param
+ if (l_tSrcFstat.st_size < NS_NPP_WRITESIZE1) {
+ l_ui32BufSize = NS_NPP_WRITESIZE1;
+ } else {
+ l_ui32BufSize = NS_NPP_WRITESIZE2;
+ }
+ }
+ return l_ui32BufSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CopyFile
+/// Copy the content of source file f_csrcpath to destination file f_cdestpath
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::CopyFile(PCSTR f_csrcpath, PCSTR f_cdestpath, UI_32 &f_uiNS_NPP_WRITESIZE, BOOL btmpfile) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // declare variables
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ SI_32 l_iSourceFileFd = -1; // file descriptor of source file
+ SI_32 l_iDestFileFd = -1; // file descriptor of destination file
+ PSTR l_cWriteBuffer = NULL;
+ SI_32 l_si32BufSize = NS_NPP_WRITESIZE1;
+ size_t l_iReadBuffLength = 0; // size of data read from source file
+ UI_32 l_ui32SrcFileSize = 0;
+ std::string l_cTempDestPath; // temporary file path
+ if (btmpfile == FALSE) {
+ l_cTempDestPath = f_cdestpath;
+ } else {
+ l_cTempDestPath = CPersistence::GetStoragePath(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ if (l_cTempDestPath.length() > 0) { // LCOV_EXCL_BR_LINE 6: l_cTempDestPath.length() is bigger than 0
+ l_cTempDestPath.append(RELEASETEMP_DIR); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ // create the destination folder path if does not exists
+ if (!CFSDirectory::DoesDirecotryExist(l_cTempDestPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s DOESN'T exist, Creating...", l_cTempDestPath.c_str());
+ if (eFrameworkunifiedStatusOK != (l_estatus = CFSDirectory::CreateDirectory(l_cTempDestPath))) { // LCOV_EXCL_BR_LINE 200: CreateDirectory() is eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200: CreateDirectory() is eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to create %s, errno:%d", l_cTempDestPath.c_str(), errno);
+ return l_estatus;
+ // LCOV_EXCL_STOP
+ }
+ }
+ l_cTempDestPath.append(RELEASETEMP_FILENAME);
+
+ } else {
+ // LCOV_EXCL_START 6: l_cTempDestPath.length() is bigger than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_cTempDestPath.length():%ld", static_cast<long int>(l_cTempDestPath.length())); // NOLINT (runtime/int)
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+ // get the destination folder path from full file path
+ std::string l_cOutDirPath(f_cdestpath);
+ size_t l_ifound = l_cOutDirPath.rfind("/");
+ l_cOutDirPath = l_cOutDirPath.substr(0, l_ifound);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Full Path for persistence %s.", f_cdestpath);
+
+ // create the destination folder path if does not exists
+ if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s DOESN'T exist, Creating...", l_cOutDirPath.c_str());
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to create %s, errno:%d", l_cOutDirPath.c_str(), errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+
+ // open source file
+ if (-1 == (l_iSourceFileFd = open(f_csrcpath, O_RDONLY, S_IRUSR))) { // LCOV_EXCL_BR_LINE 5: open's error case
+ // LCOV_EXCL_START 5: open's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Warning :: CP_WRK_FAILURE_SRC_NOT_FND, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ // open the destination file for writing or create if does not exists
+ if (-1 == (l_iDestFileFd = open(l_cTempDestPath.c_str(), O_WRONLY | O_CREAT | O_TRUNC, // LCOV_EXCL_BR_LINE 5: open's error case // NOLINT[whitespace/line_length]
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH))) {
+ // LCOV_EXCL_START 5: open's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_DST_CREATE, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ l_si32BufSize = GetCopyBufSize(l_iSourceFileFd, l_ui32SrcFileSize);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Src file:%s, size:%d", f_csrcpath, l_ui32SrcFileSize);
+ l_cWriteBuffer = (PSTR) std::malloc(l_si32BufSize);
+ f_uiNS_NPP_WRITESIZE = 0;
+
+ if (NULL != l_cWriteBuffer) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+#ifdef AGL_STUB
+ while (1) {
+ std::memset(l_cWriteBuffer, 0, l_si32BufSize);
+ l_iReadBuffLength = read(l_iSourceFileFd, l_cWriteBuffer, l_si32BufSize);
+ if (0 == l_iReadBuffLength) {
+ break;
+ } else if (0 < l_iReadBuffLength) { // LCOV_EXCL_BR_LINE 5: read's error case
+ f_uiNS_NPP_WRITESIZE += static_cast<UI_32>(l_iReadBuffLength);
+
+ if (-1 == write(l_iDestFileFd, l_cWriteBuffer, l_iReadBuffLength)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_WRITE_ERROR_CP, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (InAbortState()) { // LCOV_EXCL_START 200: the state can't be aborted
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_ABORT_DURING_CP");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ // LCOV_EXCL_START 5: read's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error reading from source file, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK != l_estatus) {
+ break;
+ }
+ }
+#else
+ while (!eof(l_iSourceFileFd)) {
+ std::memset(l_cWriteBuffer, 0, l_si32BufSize);
+ if (-1 != (l_iReadBuffLength = read(l_iSourceFileFd, l_cWriteBuffer, l_si32BufSize))) {
+ f_uiNS_NPP_WRITESIZE += static_cast<UI_32>(l_iReadBuffLength);
+
+ if (-1 == write(l_iDestFileFd, l_cWriteBuffer, l_iReadBuffLength)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_WRITE_ERROR_CP, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (InAbortState()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_ABORT_DURING_CP");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error reading from source file, errno:%d", errno);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (eFrameworkunifiedStatusOK != l_estatus) {
+ break;
+ }
+ }
+#endif
+
+ free(l_cWriteBuffer);
+ l_cWriteBuffer = NULL;
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem alloc error for l_cWriteBuffer");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ close(l_iDestFileFd);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ if (btmpfile == TRUE) {
+ if (0 != rename(l_cTempDestPath.c_str(), f_cdestpath)) { // LCOV_EXCL_START 5: rename's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "Error renaming file %s to %s, errno: %d", l_cTempDestPath.c_str(), f_cdestpath,
+ errno);
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // remove the source file after successful copy
+ if (0 != remove(l_cTempDestPath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Temporary file not deleted::%s, errno:%d", l_cTempDestPath.c_str(), errno);
+ }
+ }
+ }
+
+ close(l_iSourceFileFd);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnWrkCmdResume
+/// Callback on resume worker thread command
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnWrkCmdResume(HANDLE hthread) { // LCOV_EXCL_START 8: not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (hthread) {
+ pthread_mutex_lock(&m_sAbortMutex);
+ m_sbAbortCopy = FALSE;
+ pthread_mutex_unlock(&m_sAbortMutex);
+ l_estatus = SendAck(hthread, CP_WRK_CMD_RESUME);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnWrkCmdStart
+/// Callback method on start worker thread command.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnWrkCmdStart(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (hthread) { // LCOV_EXCL_BR_LINE 6:hthread can't be NULL
+ l_estatus = SendAck(hthread, CP_WRK_CMD_START);
+ } else {
+ // LCOV_EXCL_START 6:hthread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnWrkCmdStop
+/// Callback method on stop worker thread command.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnWrkCmdStop(HANDLE hthread) { // LCOV_EXCL_START 200: can't test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (hthread) {
+ l_estatus = SendAck(hthread, CP_WRK_CMD_STOP);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnCmdShutdownRequest
+/// Callback method for shutdown request command.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnCmdShutdownRequest(HANDLE hthread) { // LCOV_EXCL_START 8: not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (hthread) {
+ NSP_CopyShutdownAck l_tCopyShutdownAck = {};
+ if (FrameworkunifiedGetMsgLength(hthread) == sizeof(l_tCopyShutdownAck)) {
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tCopyShutdownAck, sizeof(NSP_CopyShutdownAck),
+ eSMRRelease))) {
+ FrameworkunifiedSendParent(hthread, CMD_WRK_SHUTDOWN_ACK, sizeof(NSP_CopyShutdown), &l_tCopyShutdownAck);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:FrameworkunifiedGetMsgDataOfSize returned:%d", l_estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:MsgLength: Expected:%ld, Received:%d.",
+ static_cast<long int>(sizeof(l_tCopyShutdownAck)), FrameworkunifiedGetMsgLength(hthread)); // NOLINT (runtime/int)
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SendAck
+/// Method to send ack to the parent thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::SendAck(HANDLE hthread, const ENSP_CopyWorkerProtocol &f_eworkercmd) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
+ NSP_CopyAckMsg l_tCopyAckMs = {};
+ l_tCopyAckMs.m_eworkerprotocol = f_eworkercmd;
+ l_estatus = FrameworkunifiedSendParent(hthread, CP_WRK_ACK_CMD_COMPLETE, sizeof(l_tCopyAckMs), &l_tCopyAckMs);
+ } else {
+ // LCOV_EXCL_START 6: hthread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnWrkCmdArchive
+/// Callback method on archive command
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::OnWrkCmdArchive(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // Archive response struct
+ NSP_CopyStatusResponse l_tArchiveStatusResponse;
+
+ if (f_hThread) { // LCOV_EXCL_BR_LINE 6: f_hThread can't be NULL
+ // Archive info struct
+ NSP_CopyInfoCmd l_tArchiveInfo = {};
+
+ if (FrameworkunifiedGetMsgLength(f_hThread) == sizeof(l_tArchiveInfo)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(f_hThread, &l_tArchiveInfo, sizeof(NSP_CopyInfoCmd), // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ eSMRRelease))) {
+ // Copy archive status response
+ l_tArchiveStatusResponse.m_eloadtype = l_tArchiveInfo.m_eloadtype;
+ l_tArchiveStatusResponse.m_epersisttype = l_tArchiveInfo.m_epersisttype;
+ std::strncpy(l_tArchiveStatusResponse.m_cpersistenttag, l_tArchiveInfo.m_cpersistenttag, (MAX_PATH_LENGTH - 1));
+ std::strncpy(l_tArchiveStatusResponse.m_crequesterappname,
+ l_tArchiveInfo.m_crequesterappname, (MAX_PATH_LENGTH - 1));
+
+ CCopyWorker::CArchive *l_pCArchive = new CCopyWorker::CArchive();
+
+ // Start the folder archive or extract operation
+ if (eFrameworkunifiedStatusOK == (l_estatus = l_pCArchive->Archive(l_tArchiveInfo, l_tArchiveStatusResponse))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archive/Extract Successful!");
+ } else {
+ // Set the archive status to failure
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ if (NULL != l_pCArchive) { // LCOV_EXCL_BR_LINE 5: l_pCArchive can't be null
+ delete l_pCArchive;
+ l_pCArchive = NULL;
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:FrameworkunifiedGetMsgDataOfSize returned:%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:MsgLength: Expected:%ld, Received:%d.",
+ static_cast<long int>(sizeof(l_tArchiveInfo)), FrameworkunifiedGetMsgLength(f_hThread)); // NOLINT (runtime/int)
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK != l_estatus) {
+ l_tArchiveStatusResponse.m_bpersistencechk = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archive/Extract fail.Sending parent message!");
+ } else {
+ l_tArchiveStatusResponse.m_bpersistencechk = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archive/Extract success.Sending parent message!");
+ }
+
+ FrameworkunifiedSendParent(f_hThread, CP_WRK_NTFY, sizeof(NSP_CopyStatusResponse), &l_tArchiveStatusResponse);
+ } else {
+ // LCOV_EXCL_START 6: f_hThread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread Application Handle NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPCopyWorkerOnStart
+/// Callback method on start of worker thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPCopyWorkerOnStart(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
+ pthread_mutex_lock(&g_mutworkerthread);
+
+ // Note: this variable is made static just to ignore the resource leak showing in coverity analysis
+ static CCopyWorker *l_pccopyworker = NULL;
+
+ l_pccopyworker = new(std::nothrow) CCopyWorker; // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ if (NULL != l_pccopyworker) { // LCOV_EXCL_BR_LINE 5: l_pccopyworker can't be NULL
+ if (eFrameworkunifiedStatusOK == (l_estatus = l_pccopyworker->OnWrkCmdStart(hthread))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, l_pccopyworker);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ l_estatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hthread, AppName, aServiceHandlers, static_cast<UI_32>(_countof(aServiceHandlers)));
+
+ if (0 == std::strcmp(NS_NPP_WRITE_THREAD_NAME, FrameworkunifiedGetAppName(hthread))) {
+ l_estatus = FrameworkunifiedAttachCallbackToDispatcher(hthread, AppName,
+ CMD_DELETE_OLD_DATA, NPServiceOnDeleteOldDataCmd);
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete l_pccopyworker;
+ l_pccopyworker = NULL;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete l_pccopyworker;
+ l_pccopyworker = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread Start failed.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5: l_pccopyworker can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null.");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ pthread_mutex_unlock(&g_mutworkerthread);
+ } else {
+ // LCOV_EXCL_START 6: hthread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPCopyWorkerOnStop
+/// Callback method on stop of worker thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPCopyWorkerOnStop(HANDLE hthread) { // LCOV_EXCL_START 200: can't test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hthread) {
+ pthread_mutex_lock(&g_mutworkerthread);
+ CCopyWorker *l_pccopyworker = static_cast<CCopyWorker *>(FrameworkunifiedGetThreadSpecificData(hthread));
+
+ if (NULL != l_pccopyworker) {
+ l_pccopyworker->OnWrkCmdStop(hthread);
+
+ delete l_pccopyworker;
+ l_pccopyworker = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSetThreadSpecificData Error, status=%d", l_estatus);
+ }
+
+ PCSTR l_cservice = FrameworkunifiedGetAppName(hthread);
+ if (NULL != l_cservice) {
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedDetachServiceFromDispatcher(hthread, l_cservice))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Detaching service %s from dispatcher, status=%d", l_cservice, l_estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetAppName returned NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ pthread_mutex_unlock(&g_mutworkerthread);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPServiceOnDeleteOldDataCmd
+/// This callback is used to delete the data which was requested to be deleted during
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPServiceOnDeleteOldDataCmd(HANDLE f_happ) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ SI_32 l_ithreadcreate = 0;
+ pthread_attr_t l_tattr;
+ struct sched_param l_tschedparam = {};
+
+ // thread id
+ pthread_t childthread = 0;
+
+ if (EOK == pthread_attr_init(&l_tattr)) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // detach the thread from parent thread
+ if (EOK != pthread_attr_setdetachstate(&l_tattr, PTHREAD_CREATE_DETACHED)) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // LCOV_EXCL_START 11:except,C++ STL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error setting detach state attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
+ // set the schedule property of thread
+ if (EOK != pthread_attr_setinheritsched(&l_tattr, PTHREAD_EXPLICIT_SCHED)) { // LCOV_EXCL_BR_LINE 5:except,C++ STL // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5:except,C++ STL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error setting inherit schedule attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
+ if (EOK != pthread_attr_getschedparam(&l_tattr, &l_tschedparam)) { // LCOV_EXCL_BR_LINE 5:except,C++ STL
+ // LCOV_EXCL_START 5:except,C++ STL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error getting schedule param attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
+ // set the schedule priority of thread
+ l_tschedparam.sched_priority = NS_NPP_DATA_RESET_THREAD_PRIO;
+ if (EOK != pthread_attr_setschedparam(&l_tattr, &l_tschedparam)) { // LCOV_EXCL_BR_LINE 5:except,C++ STL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error setting schedule param attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ // start the child thread
+ if (EOK == (l_ithreadcreate = pthread_create(&childthread, &l_tattr, NSPDataResetThreadCallback, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Thread id %ld created, name=%s, prio=%d", childthread, NS_NPP_DATA_RESET_THREAD_NAME,
+ NS_NPP_DATA_RESET_THREAD_PRIO);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pthread_create failed for %s, error = %d", NS_NPP_DATA_RESET_THREAD_NAME,
+ l_ithreadcreate);
+ }
+ }
+
+ // release the thread attribute object
+ pthread_attr_destroy(&l_tattr);
+ } else {
+ // LCOV_EXCL_START 11:except,C++ STL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to initialize attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPDataResetThreadCallback
+/// Callback of data reset thread.
+///////////////////////////////////////////////////////////////////////////////////////////
+PVOID NSPDataResetThreadCallback(PVOID f_parg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string f_csourcepath = "";
+ std::string f_ctargetpath = "";
+ std::string l_ctargetdir = "";
+
+ DIR *l_pdir = NULL;
+ struct dirent *l_pdirent = NULL;
+
+ // set the name of thread
+ if (EOK == pthread_setname_np(0, NS_NPP_DATA_RESET_THREAD_NAME)) { // LCOV_EXCL_BR_LINE 5:pthread_setname_np's error case // NOLINT[whitespace/line_length]
+#ifdef AGL_STUB
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Name of thread id %ld set to %s",
+ syscall(__NR_gettid), NS_NPP_DATA_RESET_THREAD_NAME);
+#else
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Name of thread id %d set to %s", gettid(), NS_NPP_DATA_RESET_THREAD_NAME);
+#endif
+ } else {
+ // LCOV_EXCL_START 5:pthread_setname_np's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#ifdef AGL_STUB
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error setting name %s for thread-id %ld", NS_NPP_DATA_RESET_THREAD_NAME,
+ syscall(__NR_gettid));
+#else
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error setting name %s for thread-id %d", NS_NPP_DATA_RESET_THREAD_NAME, gettid());
+#endif
+ // LCOV_EXCL_STOP
+ }
+
+ f_csourcepath = CPersistence::GetStoragePath();
+ l_pdir = opendir(f_csourcepath.c_str());
+
+ if (NULL != l_pdir) { // LCOV_EXCL_BR_LINE 5:opendir's error case
+ if ('/' != f_csourcepath[f_csourcepath.length() - 1]) { // LCOV_EXCL_BR_LINE 200: there must be '/' in f_csourcepath // NOLINT[whitespace/line_length]
+ f_csourcepath.append("/");
+ }
+
+ /*
+ * Old Persistent data folders which needs to be deleted are renamed with the orignal folder name
+ * followed by underscore and date and time.
+ */
+ std::string l_colduserdata = USERDATA;
+ l_colduserdata.append("_");
+
+ std::string l_coldfactorydata = FACTORYDATA;
+ l_coldfactorydata.append("_");
+
+ std::string l_coldfactorycustomerdata = FACTORYCUSTOMERDATA;
+ l_coldfactorycustomerdata.append("_");
+
+ std::string l_colddealerdata = DEALERDATA;
+ l_colddealerdata.append("_");
+
+ while (NULL != (l_pdirent = readdir(l_pdir))) {
+ l_ctargetdir = l_pdirent->d_name;
+
+ if (0 == l_ctargetdir.find(l_colduserdata) ||
+ 0 == l_ctargetdir.find(l_coldfactorydata) ||
+ 0 == l_ctargetdir.find(l_coldfactorycustomerdata) ||
+ 0 == l_ctargetdir.find(l_colddealerdata)) {
+ f_ctargetpath.assign(f_csourcepath);
+ f_ctargetpath.append(l_ctargetdir);
+
+ if (!CFSDirectory::RemoveDirectory(f_ctargetpath, NS_NPP_REMOVE_DIR_DELAY)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to delete directory :: %s", f_ctargetpath.c_str());
+ }
+ }
+ }
+ closedir(l_pdir); // close the directory
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory does not exists :: %s", f_csourcepath.c_str()); // LCOV_EXCL_LINE 5:opendir's error case // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// VerifyWithStoredCRC
+/// Check if crc of the file passed matches with existing crc of a file
+///////////////////////////////////////////////////////////////////////////////////////////
+BOOL CCopyWorker::VerifyWithStoredCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, PCSTR f_cFile,
+ UI_32 &f_ui32crc) {
+ UI_32 l_ui32StoredCrc = 0;
+ BOOL l_bRet = FALSE;
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ TMServiceTagCRC::iterator l_itServiceTag;
+ TMTagCRC::iterator l_itTagCRC;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ f_ui32crc = 0; // initialize with default
+
+ if ((NULL != f_crequesterappname) && (NULL != f_cpersistenttag) && (NULL != f_cFile)) { // LCOV_EXCL_BR_LINE 6: f_crequesterappname, f_cpersistenttag, f_cFile can't be null // NOLINT[whitespace/line_length]
+ // Get the existing crc of a file from the map
+ CCopyWorker::g_objmtxservicetag.ReadLock();
+ l_itServiceTag = CCopyWorker::g_mservicetagcrc.find(f_crequesterappname);
+ if (l_itServiceTag != CCopyWorker::g_mservicetagcrc.end()) {
+ l_itTagCRC = (l_itServiceTag->second).find(f_cpersistenttag);
+ if (l_itTagCRC != (l_itServiceTag->second).end()) {
+ l_ui32StoredCrc = (l_itTagCRC->second);
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ // Do nothing.
+ }
+ } else {
+ // Do nothing.
+ }
+ CCopyWorker::g_objmtxservicetag.Unlock();
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ // get the crc of a file
+ l_estatus = CalculateCRC32(f_cFile, f_ui32crc);
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: CalculateCRC32() return ok
+ if (f_ui32crc == l_ui32StoredCrc) {
+ l_bRet = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "CRC matched. crc:%u", l_ui32StoredCrc);
+ } else {
+ // Do nothing. Return value already set.
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "CRC different. stored:%u, new:%u",
+ l_ui32StoredCrc, f_ui32crc);
+ }
+ } else {
+ // LCOV_EXCL_START: CalculateCRC32() return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warn: getting crc:file:%s, status:%d, errno:%d",
+ f_cFile, l_estatus, errno);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // Do nothing. Return value already set.
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_crequesterappname, f_cpersistenttag, f_cFile can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid param::f_crequesterappname:%p, f_cpersistenttag:%p, f_cFile:%p",
+ f_crequesterappname, f_cpersistenttag, f_cFile);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// UpdateTagCRC
+/// Update the internal map with new crc
+///////////////////////////////////////////////////////////////////////////////////////////
+VOID CCopyWorker::UpdateTagCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, UI_32 f_ui32crc) {
+ TMServiceTagCRC::iterator l_itServiceTag;
+ TMTagCRC::iterator l_itTagCRC;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CCopyWorker::g_objmtxservicetag.ReadLock();
+ l_itServiceTag = CCopyWorker::g_mservicetagcrc.find(f_crequesterappname);
+ if (l_itServiceTag != CCopyWorker::g_mservicetagcrc.end()) {
+ l_itTagCRC = (l_itServiceTag->second).find(f_cpersistenttag);
+ if (l_itTagCRC != (l_itServiceTag->second).end()) {
+ l_itTagCRC->second = f_ui32crc;
+ } else {
+ (l_itServiceTag->second).insert(std::make_pair(f_cpersistenttag, f_ui32crc));
+ }
+ } else {
+ TMTagCRC l_mTagCRC;
+ l_mTagCRC.insert(std::make_pair(f_cpersistenttag, f_ui32crc));
+ CCopyWorker::g_mservicetagcrc.insert(std::make_pair(f_crequesterappname, l_mTagCRC));
+ }
+ CCopyWorker::g_objmtxservicetag.Unlock();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// TryFileCopyWithCRCCheck
+/// Try file copy with CRC validation
+///////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CCopyWorker::TryFileCopyWithCRCCheck(PCSTR f_csource, PCSTR f_cdest, UI_32 f_ui32checkcount) { // LCOV_EXCL_START 200: cannot test code // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_uiSrcFileCrc = 0;
+ UI_32 l_uiDestFileCrc = 0;
+ UI_32 l_uiFileSize = 0;
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ for (UI_16 l_uiCrcCnt = 1; l_uiCrcCnt <= CNSNPP::m_siCRCCheckCount; l_uiCrcCnt++) {
+ l_uiSrcFileCrc = 0;
+ l_uiDestFileCrc = 0;
+ l_uiFileSize = 0;
+
+ l_estatus = CopyFile(f_csource, f_cdest, l_uiFileSize, TRUE);
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ // calculate crc of file in temp memory(RAM)
+ l_estatus = CalculateCRC32(f_csource, l_uiSrcFileCrc);
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ // calculate crc of file stored in persistent memory
+ l_estatus = CalculateCRC32(f_cdest, l_uiDestFileCrc);
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ if (l_uiSrcFileCrc == l_uiDestFileCrc) { // if checksum matches for both the files
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CRC Checksum matches for file:%s :: 0x%x", f_csource, l_uiSrcFileCrc);
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written:%d file=%s",
+ l_uiFileSize, f_cdest);
+ break;
+ } else { // else delete the file from target
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CRC doesn't match for src:%s::0x%x and dest:%s::0x%x, CRC cnt=%d",
+ f_csource, l_uiSrcFileCrc, f_cdest, l_uiDestFileCrc, l_uiCrcCnt);
+ // if the checksum does not matches even for the last time, do not delete the file from target
+ if (l_uiCrcCnt < (CNSNPP::m_siCRCCheckCount)) {
+ if (0 != remove(f_cdest)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error deleting file:%s, errno:%d", f_cdest, errno);
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Calculating Checksum for DestFile:%s",
+ f_cdest != 0 ? f_cdest : NULL);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Calculating Checksum for SrcFile:%s",
+ f_csource != 0 ? f_csource : NULL);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FileCopy Error:%d", l_estatus);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp
new file mode 100755
index 0000000..8f4f98a
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp
@@ -0,0 +1,232 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains the implementation for class CFSDirectory.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef AGL_STUB
+#include <other_service/PosixBasedOS001TimeApi.h>
+#endif
+
+#include <stdio.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifdef AGL_STUB
+#include <cstring>
+#endif
+#include <string>
+
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_types.h"
+#include "ns_npp_fs_directory.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFSDirectory
+/// Constructor of CFSDirectory class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFSDirectory::CFSDirectory() { // LCOV_EXCL_START 8: all methods are static
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFSDirectory
+/// Destructor of CFSDirectory class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFSDirectory::~CFSDirectory() { // LCOV_EXCL_START 8: all methods are static
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateDirectory
+/// Method to create a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFSDirectory::CreateDirectory(const std::string &f_cdirpath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (!f_cdirpath.empty()) {
+ PSTR l_cTempDirPath;
+ PSTR l_cParsedDirPath;
+ PCSTR l_cCopypath = f_cdirpath.c_str();
+
+ l_cTempDirPath = const_cast<PSTR >(f_cdirpath.c_str());
+ while (l_estatus == eFrameworkunifiedStatusOK && (l_cParsedDirPath = std::strchr(l_cTempDirPath, '/')) != 0) {
+ if (l_cParsedDirPath != l_cTempDirPath) {
+ /* Neither root nor double slash in path */
+ *l_cParsedDirPath = '\0';
+ if (0 != mkdir(l_cCopypath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { // LCOV_EXCL_BR_LINE 5: mkdir's error case // NOLINT[whitespace/line_length]
+ if (EEXIST != errno) { // LCOV_EXCL_BR_LINE 5: errno can't be changed
+ // LCOV_EXCL_START 5: errno can't be changed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Cannot Create directory %s", l_cCopypath);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ // file already exist
+ }
+ }
+ *l_cParsedDirPath = '/';
+ }
+ l_cTempDirPath = l_cParsedDirPath + 1;
+ }
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
+ if (0 != mkdir(l_cCopypath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { // LCOV_EXCL_BR_LINE 5: mkdir's error case // NOLINT[whitespace/line_length]
+ if (EEXIST != errno) { // LCOV_EXCL_BR_LINE 5: errno can't be changed
+ // LCOV_EXCL_START 5: errno can't be changed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Cannot Create directory %s", l_cCopypath);
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ // file already exist
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory path is empty.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DoesDirecotryExist
+/// Method to check if a directory exists.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::DoesDirecotryExist(const std::string &f_cdirpath) {
+ DIR *l_pDirDescriptor = opendir(f_cdirpath.c_str());
+ if (NULL != l_pDirDescriptor) {
+ closedir(l_pDirDescriptor);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsDirectory
+/// Method to check if the entity is a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::IsDirectory(const std::string &f_cpath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReturn = FALSE;
+
+ if (!f_cpath.empty()) { // LCOV_EXCL_BR_LINE 200: f_cpath can't be empty
+ struct stat st_buf;
+
+ if (0 == stat(f_cpath.c_str(), &st_buf)) { // LCOV_EXCL_BR_LINE 5: stat's error case
+ // Get the status of the file
+ if (S_ISREG(st_buf.st_mode)) {
+ l_bReturn = FALSE; // return false if f_cpath is a regular file
+ }
+ if (S_ISDIR(st_buf.st_mode)) {
+ l_bReturn = TRUE; // return true if f_cpath is a directory
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving status of path : %s", f_cpath.c_str()); // LCOV_EXCL_LINE 5: stat's error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory path is empty."); // LCOV_EXCL_LINE 200: f_cpath can't be empty
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReturn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveDirectory
+/// Method to remove a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::RemoveDirectory(std::string f_cpath, const UI_32 f_uidelay) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReturn = FALSE;
+
+ if (!f_cpath.empty()) { // LCOV_EXCL_BR_LINE 200: f_cpath can't be empty.
+ std::string l_cFilePath = "";
+
+ struct dirent *l_pdirent = NULL;
+ DIR *l_pdir = NULL;
+
+ l_pdir = opendir(f_cpath.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (NULL != l_pdir) {
+ if ('/' != f_cpath[f_cpath.length() - 1]) {
+ f_cpath.append("/");
+ }
+
+ while (NULL != (l_pdirent = readdir(l_pdir))) {
+ if (0 != std::strcmp(l_pdirent->d_name, ".") &&
+ 0 != std::strcmp(l_pdirent->d_name, "..")) {
+ l_cFilePath.assign(f_cpath);
+ l_cFilePath.append(l_pdirent->d_name); // concatenate the strings to get the complete f_cpath
+
+ if (TRUE == IsDirectory(l_cFilePath)) {
+ (void)RemoveDirectory(l_cFilePath, f_uidelay);
+ } else {
+ // it's a file, we can use unlink
+ unlink(l_cFilePath.c_str());
+
+ if (0 < f_uidelay) { // LCOV_EXCL_START 200: f_uidelay is 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ delay(f_uidelay);
+#endif
+ }
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ closedir(l_pdir); // close the directory
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pdir is NULL");
+ }
+
+ // delete the directory
+ if (0 == rmdir(f_cpath.c_str())) {
+ if (0 < f_uidelay) { // LCOV_EXCL_START 200: f_uidelay is 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ delay(f_uidelay);
+#endif
+ }
+ // LCOV_EXCL_STOP
+ l_bReturn = TRUE;
+ }
+ } else {
+ // LCOV_EXCL_START 200: f_cpath can't be empty.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory path is empty.");
+ l_bReturn = FALSE;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReturn;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp
new file mode 100755
index 0000000..c9e88a8
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp
@@ -0,0 +1,149 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup tag_NS_NPPService
+/// \ingroup tag_NS_NPPService
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This class holds the message queue handles for notification subscribers
+///
+/// This is a singleton class which holds the message queue handles for notification subscribers.
+/// This will ensure that NS_NPPService will hold only one handle per subscriber.
+//////////////////////////////////////////////////////////////////////////////////////////////////
+#include <utility>
+#include <string>
+#include "ns_npp_handlelist.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+
+// define static member of class CHandleList
+CHandleList *CHandleList::m_psHandleList = NULL;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CHandleList
+/// Class Constructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CHandleList::CHandleList() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CHandleList
+/// Class Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CHandleList::~CHandleList() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetHandleList
+/// This function is used to get the singleton instance of class.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CHandleList *CHandleList::GetHandleList() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // create the instance of class
+ if (NULL == m_psHandleList) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Creating handle list."); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ m_psHandleList = new(std::nothrow) CHandleList(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_psHandleList;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ReleaseHandleList
+/// This function is used to release the instance of class.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CHandleList::ReleaseHandleList() { // LCOV_EXCL_START 100: not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_psHandleList) {
+ delete m_psHandleList;
+ m_psHandleList = NULL;
+ } else {
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddHandleInList
+/// Add pair of subscriber name and corresponding handle in map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CHandleList::AddHandleInList(std::string f_csubscribername, HANDLE f_hmqhandle) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ HandleListRetStatus_Type l_prRetValue;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_prRetValue = m_mHandleList.insert(make_pair(f_csubscribername, f_hmqhandle));
+ if (false == l_prRetValue.second) {
+ l_estatus = eFrameworkunifiedStatusDuplicate;
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Handle exists in list for %s.", f_csubscribername.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Handle added in list for %s.", f_csubscribername.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ }
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveHandleFromList
+/// Remove handle for subscriber from the list.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CHandleList::RemoveHandleFromList(std::string f_csubscribername) { // LCOV_EXCL_START 100: not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // TODO(my_username): Implementation of this function.
+ // NOTE: Right now this feature is not required. Let the NS_NPPService hold one handle for
+ // each subscriber, even if all the notifications are unsubscribed by subscriber.
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSubscriberMqHandle
+/// Get the message queue handle of a subscriber.
+////////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE CHandleList::GetSubscriberMqHandle(std::string f_csubscribername) {
+ HANDLE l_hMqHandle = NULL;
+ HandleList_Type::iterator l_itHandleList;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_itHandleList = m_mHandleList.find(f_csubscribername);
+ if (l_itHandleList != m_mHandleList.end()) {
+ l_hMqHandle = l_itHandleList->second;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_hMqHandle;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp
new file mode 100755
index 0000000..d4b1604
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp
@@ -0,0 +1,747 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CNorPersistenceWorker and CArchive.
+/// Class CNorPersistenceWorker holds the implementation for worker thread.
+/// Class CArchive holds the implementation for archive.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_timer_if.hpp>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_utility_sys.hpp>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_np_service_nor_persistence.h>
+
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <boost/bind.hpp>
+#include <map>
+#include <utility>
+#include <string>
+
+#include <native_service/ns_np_service_nor_persistence_internal.h>
+#include "ns_npp_types.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_nor_persistence_worker_thread.h"
+
+
+
+typedef std::string NotificationName;
+typedef std::map<NotificationName, CTimerHelper *> TTimerList;
+static TTimerList g_mtimers; /// List of all the timers for immediate persistence notifications
+CMutex g_objmutextimerdata; /// Mutex object on g_mtimers
+
+// Template function for NorWorkerCallback
+template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)> EFrameworkunifiedStatus NorWorkerCallback(HANDLE hthread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ C *l_pClass = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hthread));
+
+ if (l_pClass) { // LCOV_EXCL_BR_LINE 6: l_pClass can't be NULL
+ l_estatus = (l_pClass->*M)(hthread);
+ }
+ return l_estatus;
+}
+
+static FrameworkunifiedProtocolCallbackHandler aServiceHandlers[] = { // NOLINT (readability/naming)
+ { NOR_PERSISTENCE_TIMER_START, NorWorkerCallback<CNorPersistenceWorker,
+ &CNorPersistenceWorker::OnNorPersistenceTimerStart>},
+ { NOR_PERSISTENCE_REGISTER, NorWorkerCallback<CNorPersistenceWorker,
+ &CNorPersistenceWorker::RegisterImmediatePersistNotification>},
+ { NOR_PERSISTENCE_UNREGISTER, NorWorkerCallback<CNorPersistenceWorker,
+ &CNorPersistenceWorker::UnregisterImmediatePersistNotification>},
+ { NOR_PERSISTENCE_ONSHUTDOWN, NorWorkerCallback<CNorPersistenceWorker,
+ &CNorPersistenceWorker::OnShutdown>},
+ { NOR_PERSISTENCE_CHANGE_CATEGORY, NorWorkerCallback<CNorPersistenceWorker,
+ &CNorPersistenceWorker::OnCategoryChange>}
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPNorPersistenceWorkerOnStart
+/// Callback method on start of worker thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStart(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
+ // Note: this variable is made static just to ignore the resource leak showing in coverity analysis
+ static CNorPersistenceWorker *l_pcnorpersistenceworker = new(std::nothrow) CNorPersistenceWorker;
+
+ if (NULL != l_pcnorpersistenceworker) { // LCOV_EXCL_BR_LINE 5: new's error case
+ l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, l_pcnorpersistenceworker);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ l_estatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hthread, AppName, aServiceHandlers, static_cast<UI_32>(_countof(aServiceHandlers)));
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete l_pcnorpersistenceworker;
+ l_pcnorpersistenceworker = NULL;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null.");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: hthread can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPNorPersistenceWorkerOnStop
+/// Callback method on stop of worker thread
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStop(HANDLE hthread) { // LCOV_EXCL_START 200: can't test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != hthread) {
+ CNorPersistenceWorker *l_pcnorpersistenceworker = static_cast<CNorPersistenceWorker *>(FrameworkunifiedGetThreadSpecificData(
+ hthread));
+
+ if (NULL != l_pcnorpersistenceworker) {
+ delete l_pcnorpersistenceworker;
+ l_pcnorpersistenceworker = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSetThreadSpecificData error, status=%d", l_estatus);
+ }
+
+ PCSTR l_cservice = FrameworkunifiedGetAppName(hthread);
+ if (NULL != l_cservice) {
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedDetachServiceFromDispatcher(hthread, l_cservice))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error detaching service %s from dispatcher, status=%d", l_cservice, l_estatus);
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetAppName returned NULL");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Class : CNorPersistenceWorker
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNorPersistenceWorker
+/// Constructor of CNorPersistenceWorker class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNorPersistenceWorker::CNorPersistenceWorker() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNorPersistenceWorker
+/// Destructor of CNorPersistenceWorker class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNorPersistenceWorker::~CNorPersistenceWorker() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnNorPersistenceTimerStart
+/// This function starts the respective timer of the notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNorPersistenceWorker::OnNorPersistenceTimerStart(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ TNorPersistenceNotifInfoHeader *l_ptNorPersistentData = NULL;
+ UI_32 l_ui32ReceivedDataLength = FrameworkunifiedGetMsgLength(f_hThread);
+ UI_8 *l_pui32ReceivedData = new(std::nothrow) UI_8[l_ui32ReceivedDataLength];
+
+ if (l_ui32ReceivedDataLength >= sizeof(TNorPersistenceNotifInfoHeader)) { // LCOV_EXCL_BR_LINE 200: l_ui32ReceivedDataLength is bigger than sizeof(TNorPersistenceNotifInfoHeader) // NOLINT[whitespace/line_length]
+ if (NULL != l_pui32ReceivedData) { // LCOV_EXCL_BR_LINE 5: new's error case
+ std::memset(l_pui32ReceivedData, 0, l_ui32ReceivedDataLength);
+ l_estatus = FrameworkunifiedGetMsgDataOfSize(f_hThread, l_pui32ReceivedData, l_ui32ReceivedDataLength, eSMRRelease);
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ TTimerList::iterator l_itTimerList;
+ l_ptNorPersistentData = static_cast<TNorPersistenceNotifInfoHeader *>(static_cast<PVOID>(l_pui32ReceivedData));
+
+ g_objmutextimerdata.WriteLock();
+ // find the corresponding timer object in the list of timers
+ l_itTimerList = g_mtimers.find(l_ptNorPersistentData->m_cnotificationname);
+ if (g_mtimers.end() != l_itTimerList) { // LCOV_EXCL_BR_LINE 200: the notification must be registered
+ if (NULL != (l_itTimerList->second)) { // LCOV_EXCL_BR_LINE 200: l_itTimerList->second can't be null
+ if (NULL != (l_itTimerList->second)->m_pui8HeaderAndData) {
+ delete[](l_itTimerList->second)->m_pui8HeaderAndData;
+ (l_itTimerList->second)->m_pui8HeaderAndData = NULL;
+ }
+
+ // Update specific immediate persistence notification data
+ (l_itTimerList->second)->m_pui8HeaderAndData = l_pui32ReceivedData;
+
+ // if corresponding timer is not already running start it.
+ if (!(l_itTimerList->second)->IsRunning()) {
+ (l_itTimerList->second)->Start();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Timer started, Notfn=%s", l_ptNorPersistentData->m_cnotificationname);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Timer already running for notfn %s. Data updated",
+ l_ptNorPersistentData->m_cnotificationname);
+ }
+
+ l_estatus = eFrameworkunifiedStatusOK;
+ } else {
+ // LCOV_EXCL_START 200: l_itTimerList->second can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Immediate persistence: Timer object NULL for Notfn:%s.",
+ l_ptNorPersistentData->m_cnotificationname);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: the notification must be registered
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Immediate persistence notification not registered. Notification: %s ",
+ l_ptNorPersistentData->m_cnotificationname != 0 ? l_ptNorPersistentData->m_cnotificationname : NULL);
+ // LCOV_EXCL_STOP
+ }
+ g_objmutextimerdata.Unlock();
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetMsgDataOfSize failed while retrieving immediate persistence notfn data. Status:0x%x ", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to allocate data. Can't persist.");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: l_ui32ReceivedDataLength is bigger than sizeof(TNorPersistenceNotifInfoHeader)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldBuf;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid data length received. Can't persist.");
+ // LCOV_EXCL_STOP
+ }
+
+ if ((eFrameworkunifiedStatusOK != l_estatus) && (NULL != l_pui32ReceivedData)) {
+ delete[] l_pui32ReceivedData;
+ l_pui32ReceivedData = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RegisterImmediatePersistNotification
+/// It creates a timer corresponding to the notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNorPersistenceWorker::RegisterImmediatePersistNotification(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ TImmediatePersistenceRegisterNotifInfo l_tRegisterNotifInfo = {};
+
+ if (sizeof(l_tRegisterNotifInfo) == FrameworkunifiedGetMsgLength(hthread)) { // LCOV_EXCL_BR_LINE 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo) // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tRegisterNotifInfo, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ sizeof(TImmediatePersistenceRegisterNotifInfo), eSMRRelease))) {
+ g_objmutextimerdata.WriteLock();
+
+ TTimerList::iterator l_itTimerList = g_mtimers.find(l_tRegisterNotifInfo.m_cnotificationname);
+ if (l_itTimerList != g_mtimers.end()) { // LCOV_EXCL_BR_LINE 6: notification can't be registered again
+ // LCOV_EXCL_START 6: notification can't be registered again
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification %s is already registered for immediate data persistence ",
+ l_tRegisterNotifInfo.m_cnotificationname);
+ // LCOV_EXCL_STOP
+ } else {
+ // create timer corresponding to notification
+ CTimerHelper *l_pTimerHelper = new CTimerHelper();
+ if (NULL != l_pTimerHelper) { // LCOV_EXCL_BR_LINE 5: new's error case
+ l_pTimerHelper->SetTime(l_tRegisterNotifInfo.m_uidelay, 0);
+ // todo: modify SetNotifyMethod of timer NSTimer class to accept sender handle as well.
+ // This will help to have only one handle, instead of one handle per timer.
+ l_pTimerHelper->SetNotifyMethod(static_cast<UI_16>(l_pTimerHelper->GetCmdId()), FrameworkunifiedGetAppName(hthread));
+
+ // associate timer's timeout with the callback function.
+ FrameworkunifiedAttachCallbackToDispatcher(hthread, TIMER_QUE, l_pTimerHelper->GetCmdId(),
+ boost::bind(&CTimerHelper::OnTimeOut, l_pTimerHelper, hthread));
+ // add created timer in timers list
+ g_mtimers.insert(std::make_pair(l_tRegisterNotifInfo.m_cnotificationname, l_pTimerHelper));
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification %s is registered for immediate data persistence ",
+ l_tRegisterNotifInfo.m_cnotificationname != 0 ? l_tRegisterNotifInfo.m_cnotificationname : NULL);
+ }
+ }
+
+ g_objmutextimerdata.Unlock();
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error getting message data for registering Immediate persistent notification, status: 0x%x", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetMsgLength and size of TImmediatePersistenceRegisterNotifInfo mismatched."
+ "Length received %d, buffer available: %ld ",
+ FrameworkunifiedGetMsgLength(hthread), static_cast<long int>(sizeof(TImmediatePersistenceRegisterNotifInfo))); // NOLINT (runtime/int)
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// UnregisterImmediatePersistNotification
+/// It deletes a timer corresponding to the notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNorPersistenceWorker::UnregisterImmediatePersistNotification(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ TImmediatePersistenceUnregisterNotifInfo l_tRegisterNotifInfo = {};
+
+ if (sizeof(l_tRegisterNotifInfo) == FrameworkunifiedGetMsgLength(hthread)) { // LCOV_EXCL_BR_LINE 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo) // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tRegisterNotifInfo, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ sizeof(TImmediatePersistenceUnregisterNotifInfo), eSMRRelease))) {
+ g_objmutextimerdata.WriteLock();
+
+ TTimerList::iterator l_itTimerList = g_mtimers.find(l_tRegisterNotifInfo.m_cnotificationname);
+ if (l_itTimerList != g_mtimers.end()) { // LCOV_EXCL_BR_LINE 6: notification can't be unregistered again
+ if (NULL != (l_itTimerList->second)) { // LCOV_EXCL_BR_LINE 200: l_itTimerList->second can't be null
+ EFrameworkunifiedStatus eStatus;
+ // detach callbacks
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(hthread, TIMER_QUE, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ (l_itTimerList->second)->GetCmdId()))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedDetachCallbackFromDispatcher Failed Status:0x%x ", eStatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ delete l_itTimerList->second;
+ l_itTimerList->second = NULL;
+ }
+ g_mtimers.erase(l_itTimerList);
+ } else {
+ // LCOV_EXCL_START 6: notification can't be registered again
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Can't unregister. Notification %s is not a registered notification for immediate data persistence.",
+ l_tRegisterNotifInfo.m_cnotificationname != 0 ? l_tRegisterNotifInfo.m_cnotificationname : NULL);
+ // LCOV_EXCL_STOP
+ }
+
+ g_objmutextimerdata.Unlock();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Notification %s is unregistered for immediate data persistence, FrameworkunifiedGetMsgDataOfSize Error, status: 0x%x",
+ l_tRegisterNotifInfo.m_cnotificationname != 0 ? l_tRegisterNotifInfo.m_cnotificationname : NULL,
+ l_estatus);
+ }
+ } else {
+ // LCOV_EXCL_START 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetMsgLength and size of TImmediatePersistenceUnregisterNotifInfo mismatched."
+ "Length received %d, buffer available: %ld ",
+ FrameworkunifiedGetMsgLength(hthread), static_cast<long int>(sizeof(TImmediatePersistenceUnregisterNotifInfo))); // NOLINT (runtime/int)
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnShutdown
+/// This API saves or deletes the data of NOR irrespective of delay depending on the message data
+/// received from parent thread during shutdown.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNorPersistenceWorker::OnShutdown(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ UI_32 l_uiPersistCategoryFlag = 0;
+
+ TImmediateShutdown l_tImmShutdown = {};
+
+ CTimerHelper *l_pTimerHelper = NULL;
+
+ // iterator of list of nor notifications and its timers
+ TTimerList::iterator l_itTimerList;
+
+ TNorPersistenceNotifInfoHeader *l_ptImmediateNotfnHeader = NULL;
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(f_hThread, &l_tImmShutdown, sizeof(l_tImmShutdown), // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ eSMRRelease))) {
+ l_uiPersistCategoryFlag = l_tImmShutdown.f_uinotificationpersistentservicepersistcategoryflag;
+
+ // if quick shutdown is received then just stop the timer and dont save the data
+ if (eFrameworkunifiedQuickShutdown == l_tImmShutdown.f_eshutdowntype) {
+ for (l_itTimerList = g_mtimers.begin(); l_itTimerList != g_mtimers.end(); l_itTimerList++) {
+ l_pTimerHelper = l_itTimerList->second;
+
+ if (NULL != l_pTimerHelper && l_pTimerHelper->IsRunning()) {
+ // stop the timer
+ l_pTimerHelper->Stop();
+ }
+ }
+ } else { // stop the timer and save the data
+ for (l_itTimerList = g_mtimers.begin(); l_itTimerList != g_mtimers.end(); l_itTimerList++) {
+ l_pTimerHelper = l_itTimerList->second;
+
+ if (NULL != l_pTimerHelper && l_pTimerHelper->IsRunning()) {
+ // stop the timer
+ l_pTimerHelper->Stop();
+
+ l_ptImmediateNotfnHeader = static_cast<TNorPersistenceNotifInfoHeader *>
+ (static_cast<PVOID>(l_pTimerHelper->m_pui8HeaderAndData));
+
+ if (NULL != l_ptImmediateNotfnHeader) { // LCOV_EXCL_BR_LINE 200: l_ptImmediateNotfnHeader can't be null
+ if (eFrameworkunifiedUserData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag) &&
+ eFrameworkunifiedFactoryData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag) &&
+ eFrameworkunifiedFactoryCustomerData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag) &&
+ eFrameworkunifiedDealerData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag)) {
+ // save the new data to persistent memory
+ l_pTimerHelper->OnTimeOut(f_hThread);
+ }
+ } else {
+ // LCOV_EXCL_START 200: l_ptImmediateNotfnHeader can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Immediate notification data header is NULL");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize failed for protocol NOR_PERSISTENCE_ONSHUTDOWN, status : %d",
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendParent(f_hThread, NOR_PERSISTENCE_ONSHUTDOWN_ACK, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ sizeof(l_uiPersistCategoryFlag), &l_uiPersistCategoryFlag))) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendParent failed for protocol NOR_PERSISTENCE_ONSHUTDOWN_ACK, status : %d",
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnCategoryChange
+/// This callback is called when category of immediate persistence is changed
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNorPersistenceWorker::OnCategoryChange(HANDLE hthread) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != hthread) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ UI_32 l_ui32ReceivedDataLength = FrameworkunifiedGetMsgLength(hthread);
+
+ if (l_ui32ReceivedDataLength >= sizeof(TImmediatePersistenceChangeCategory)) { // LCOV_EXCL_BR_LINE 200: l_ui32ReceivedDataLength is bigger than sizeof(TImmediatePersistenceChangeCategory) // NOLINT[whitespace/line_length]
+ UI_8 *l_pui32ReceivedData = new(std::nothrow) UI_8[l_ui32ReceivedDataLength];
+
+ if (NULL != l_pui32ReceivedData) { // LCOV_EXCL_BR_LINE 5: new's error case
+ std::memset(l_pui32ReceivedData, 0, l_ui32ReceivedDataLength);
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, l_pui32ReceivedData, l_ui32ReceivedDataLength, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ eSMRRelease))) {
+ TImmediatePersistenceChangeCategory *l_pChangePersistentCategory =
+ static_cast<TImmediatePersistenceChangeCategory *>(static_cast<PVOID>(l_pui32ReceivedData));
+ PUI_8 l_pui8Data = l_pui32ReceivedData + sizeof(TImmediatePersistenceChangeCategory);
+
+ TTimerList::iterator l_itTimerList;
+
+ g_objmutextimerdata.WriteLock();
+ // find the corresponding timer object in the list of timers
+ l_itTimerList = g_mtimers.find(l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname);
+ if (g_mtimers.end() != l_itTimerList) { // LCOV_EXCL_BR_LINE 6: notification must be in list
+ CTimerHelper *l_pTimerHelper = l_itTimerList->second;
+
+ if (NULL != l_pTimerHelper && l_pTimerHelper->IsRunning()) {
+ TNorPersistenceNotifInfoHeader *l_ptImmediateNotfnHeader =
+ static_cast<TNorPersistenceNotifInfoHeader *>(static_cast<PVOID>(l_pTimerHelper->m_pui8HeaderAndData));
+
+ if (NULL != l_ptImmediateNotfnHeader) { // LCOV_EXCL_BR_LINE 200: l_ptImmediateNotfnHeader can't be null
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Changing category from %d to %d for notfn %s in dataHdr",
+ l_ptImmediateNotfnHeader->m_epersistcategory,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory,
+ l_ptImmediateNotfnHeader->m_cnotificationname);
+
+ l_ptImmediateNotfnHeader->m_epersistcategory =
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory;
+ }
+ }
+
+ EFrameworkunifiedPersistCategory l_eOldPersistCategory = l_pChangePersistentCategory->m_eoldpersistcategory;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Changing persist category of %s from %d to %d",
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname,
+ l_eOldPersistCategory,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory);
+
+ // write data to emmc
+ l_estatus = SynchronousWritePersistentData(
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_cpublishername,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname,
+ static_cast<PVOID>(l_pui8Data),
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_uimsgsize,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_uidelay,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_uimaxmsglength,
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory);
+
+ // Create the old file path string to be removed
+ std::string l_cPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+ std::string l_cTempPath = l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname;
+ size_t l_uiTempPathSize = 0;
+
+ // replace all '/' by '_'
+ l_uiTempPathSize = l_cTempPath.find_first_of("/");
+ while (std::string::npos != l_uiTempPathSize) {
+ l_cTempPath[l_uiTempPathSize] = '_';
+ l_uiTempPathSize = l_cTempPath.find_first_of("/", l_uiTempPathSize + 1);
+ }
+
+ switch (l_eOldPersistCategory) {
+ case eFrameworkunifiedFactoryData:
+ l_cPath.append(FACTORYDATADIR);
+ break;
+ case eFrameworkunifiedFactoryCustomerData:
+ l_cPath.append(FACTORYCUSTOMERDATADIR);
+ break;
+ case eFrameworkunifiedDealerData:
+ l_cPath.append(DEALERDATADIR);
+ break;
+ case eFrameworkunifiedUserData:
+ default: {
+ l_cPath.append(USERDATADIR);
+ l_cPath.append(ALLUSERAPPDATADIR);
+ }
+ break;
+ }
+
+ l_cPath.append(IMMEDIATEDATADIR);
+ l_cPath.append(l_cTempPath);
+
+ l_cPath.append(l_pChangePersistentCategory->m_tnornotifInfoheader.m_cpublishername);
+
+ if (0 != unlink(l_cPath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error deleting file %s, errno=%d", l_cPath.c_str(), errno);
+ }
+ } else {
+ // LCOV_EXCL_START 6: notification must be in list
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't update persistent category, notfn %s not found in g_mtimers map",
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname != 0 ?
+ l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname : NULL);
+ // LCOV_EXCL_STOP
+ }
+ g_objmutextimerdata.Unlock();
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize failed while retrieving"
+ "immediate persistence notfn data. Status:0x%x ", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+
+ delete[] l_pui32ReceivedData;
+ l_pui32ReceivedData = NULL;
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to allocate data. Can't persist, errno=%d", errno);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: l_ui32ReceivedDataLength is bigger than sizeof(TImmediatePersistenceChangeCategory)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldBuf;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid data length received %d. Can't persist.", l_ui32ReceivedDataLength);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid param, hthread is NULL");
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+/////////////////////////////
+/// Class: CTimerHelper
+/////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CTimerHelper
+/// Constructor of CTimerHelper class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CTimerHelper::CTimerHelper() {
+ static UI_32 l_uiTimerCounter = PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD;
+ l_uiTimerCounter++;
+ m_uiCmdId = l_uiTimerCounter;
+ m_pui8HeaderAndData = NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CTimerHelper
+/// Destructor of CTimerHelper class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CTimerHelper::~CTimerHelper() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pui8HeaderAndData) {
+ delete[] m_pui8HeaderAndData;
+ m_pui8HeaderAndData = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetCmdId
+/// Returns id for timer
+////////////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CTimerHelper::GetCmdId() {
+ return m_uiCmdId;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// OnTimeOut
+/// This function writes the corresponding data in NOR when timer expires.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CTimerHelper::OnTimeOut(HANDLE hthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ g_objmutextimerdata.ReadLock();
+ if (NULL != m_pui8HeaderAndData) { // LCOV_EXCL_BR_LINE 200: m_pui8HeaderAndData can't be null
+ TNorPersistenceNotifInfoHeader *l_ptImmediateNotfnHeader =
+ static_cast<TNorPersistenceNotifInfoHeader *>(static_cast<PVOID>(m_pui8HeaderAndData));
+ PUI_8 l_pui8Data = m_pui8HeaderAndData + sizeof(TNorPersistenceNotifInfoHeader);
+ HANDLE l_hReceiverMq = McOpenSender(l_ptImmediateNotfnHeader->m_cpublishername);
+
+ // write data to emmc
+ l_estatus = SynchronousWritePersistentData(l_ptImmediateNotfnHeader->m_cpublishername,
+ l_ptImmediateNotfnHeader->m_cnotificationname,
+ static_cast<PVOID>(l_pui8Data),
+ l_ptImmediateNotfnHeader->m_uimsgsize,
+ l_ptImmediateNotfnHeader->m_uidelay,
+ l_ptImmediateNotfnHeader->m_uimaxmsglength,
+ l_ptImmediateNotfnHeader->m_epersistcategory);
+
+ // update corresponding application about data written status.
+ if (NULL != l_hReceiverMq) { // LCOV_EXCL_BR_LINE 5: NSFW error case
+ NC_ImmediateWriteAck l_tWriteAck = {};
+ std::strncpy(l_tWriteAck.notificationName, l_ptImmediateNotfnHeader->m_cnotificationname,
+ sizeof(l_tWriteAck.notificationName) - 1);
+ l_tWriteAck.eStatus = l_estatus;
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSend(l_hReceiverMq, AppName, NPS_IMMEDIATE_WRITE_ACK, sizeof(l_tWriteAck), // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ &l_tWriteAck))) {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error Sending NPS_IMMEDIATE_WRITE_ACK to %s for %s, Status: %d",
+ l_ptImmediateNotfnHeader->m_cpublishername != 0 ? l_ptImmediateNotfnHeader->m_cpublishername : NULL,
+ l_ptImmediateNotfnHeader->m_cnotificationname != 0 ?
+ l_ptImmediateNotfnHeader->m_cnotificationname : NULL,
+ l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ McClose(l_hReceiverMq);
+ l_hReceiverMq = NULL;
+ } else {
+ // LCOV_EXCL_START 5: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error creating sender handle for service %s, Notification name %s Write Status: %d",
+ l_ptImmediateNotfnHeader->m_cpublishername != 0 ? l_ptImmediateNotfnHeader->m_cpublishername : NULL,
+ l_ptImmediateNotfnHeader->m_cnotificationname != 0 ?
+ l_ptImmediateNotfnHeader->m_cnotificationname : NULL,
+ l_estatus);
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: m_pui8HeaderAndData can't be null
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Not writing immediate persistence data. Data is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // LCOV_EXCL_STOP
+ }
+ g_objmutextimerdata.Unlock();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+/// EOF
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp
new file mode 100755
index 0000000..8e2bb2d
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp
@@ -0,0 +1,485 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of CNotification class.
+/// It define functionalities common to all types of notification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <utility>
+#include <iostream>
+#include <string>
+#include <native_service/ns_mc_system_info.h>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_handlelist.h"
+#include "ns_npp_notification.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNotification
+/// Constructor of CNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotification::CNotification() { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_cNotificationName = "";
+ m_uiMaxMsgSize = 0;
+ m_ePersistentType = eFrameworkunifiedUnknown;
+
+ m_cServiceName = "";
+
+ m_pmSubscribersList = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNotification
+/// Constructor of CNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotification::CNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_cNotificationName = "";
+ m_uiMaxMsgSize = 0;
+ m_ePersistentType = eFrameworkunifiedUnknown;
+ m_pmSubscribersList = NULL;
+
+ if (!f_cnotificationname.empty()) { // LCOV_EXCL_BR_LINE 200: f_cnotificationname can't be empty
+ m_cNotificationName = f_cnotificationname;
+ m_uiMaxMsgSize = f_uimaxmsgsize;
+// m_ePersistentType = eFrameworkunifiedUnknown;
+
+ m_cServiceName = "";
+
+ m_pmSubscribersList = new(std::nothrow) NotifReceiver_Type(); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ // LCOV_EXCL_START 200: f_cnotificationname can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification String is Empty");
+
+ CNotification();
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNotification
+/// Destructor of CNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotification::~CNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator of CNotificationReceiver map
+ NotifReceiver_Iterator_Type l_itNotifReceiver;
+
+ CNotificationReceiver *l_pNotificationReceiver = NULL;
+
+ if (NULL != m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: m_pmSubscribersList can't be NULL
+ if (!m_pmSubscribersList->empty()) {
+ for (l_itNotifReceiver = m_pmSubscribersList->begin();
+ l_itNotifReceiver != m_pmSubscribersList->end();
+ l_itNotifReceiver++) {
+ l_pNotificationReceiver = (*l_itNotifReceiver).second;
+
+ if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: l_pNotificationReceiver can't be NULL
+ // NOTE: Uncomment following code when implementation of the function RemoveHandleFromList
+ // is available. To find the reason why it is not implemented, see the function definition.
+ // CHandleList *l_hHandleList = CHandleList::GetHandleList();
+ // l_hHandleList->RemoveHandleFromList((*l_itNotifReceiver).first);
+
+ delete l_pNotificationReceiver; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_pNotificationReceiver = NULL;
+ }
+ }
+
+ // clear the map
+ m_pmSubscribersList->clear();
+ }
+
+ delete m_pmSubscribersList; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ m_pmSubscribersList = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddEventReciever
+/// This function adds the name of the application to receiver list of particular notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::AddEventReciever(const std::string &f_csubscribername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: f_csubscribername can't be empty
+ l_estatus = AddReceiverInMap(f_csubscribername);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_csubscribername can't be empty
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Publish
+/// This function publishes the notification to subscribed clients.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusFail;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DeleteEventReciever
+/// This function deletes the name of application from receivers list.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::DeleteEventReciever(const std::string &f_csubscribername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator of CNotificationReceiver map
+ NotifReceiver_Iterator_Type l_iterator;
+
+ CNotificationReceiver *l_pNotificationReceiver = NULL;
+
+ if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_csubscribername can't be empty
+ l_iterator = m_pmSubscribersList->find(f_csubscribername);
+
+
+ if (l_iterator != m_pmSubscribersList->end()) {
+ l_pNotificationReceiver = (*l_iterator).second;
+
+ if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: l_pNotificationReceiver can't be NULL
+ // NOTE: Uncomment following code when implementation of the function RemoveHandleFromList
+ // is available. To find the reason why it is not implemented, see the function definition.
+ // CHandleList *l_hHandleList = CHandleList::GetHandleList();
+ // l_hHandleList->RemoveHandleFromList((*l_iterator).first);
+
+ delete l_pNotificationReceiver; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_pNotificationReceiver = NULL;
+ }
+
+ m_pmSubscribersList->erase(l_iterator);
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Subscriber successfully deleted"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Invalid Iterator");
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, f_csubscribername can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Subscriber Name String is Empty");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetNewSubscribersList
+/// This function sets the subscribers list of notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::SetNewSubscribersList(CNotification *f_pnotification) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator of CNotificationReceiver map
+ NotifReceiver_Iterator_Type l_itNotifReceiver;
+
+ std::string l_cSubscriberName;
+
+ if (NULL != f_pnotification && NULL != f_pnotification->m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: f_pnotification and f_pnotification->m_pmSubscribersList can't be empty // NOLINT[whitespace/line_length]
+ if (!f_pnotification->m_pmSubscribersList->empty()) {
+ for (l_itNotifReceiver = f_pnotification->m_pmSubscribersList->begin();
+ l_itNotifReceiver != f_pnotification->m_pmSubscribersList->end();
+ l_itNotifReceiver++) {
+ l_cSubscriberName = (*l_itNotifReceiver).first;
+ AddReceiverInMap(l_cSubscriberName); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Subscriber List Empty");
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_pnotification and f_pnotification->m_pmSubscribersList can't be empty // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetEventPublisher
+/// This function set the publisher name to current received service name
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::SetEventPublisher(const std::string &f_cservicename) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!f_cservicename.empty()) {
+ m_cServiceName = f_cservicename;
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Service successfully set"); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Service Name String is Empty");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetEventPublisher
+/// This function resets the publisher name
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::ResetEventPublisher(const std::string &f_cservicename) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_cservicename.empty()) { // LCOV_EXCL_BR_LINE 6: f_cservicename can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_cservicename can't be empty
+ } else {
+ if (0 == m_cServiceName.compare(f_cservicename)) {
+ m_cServiceName = "";
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Service successfully reset"); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Service Name Not Registered"); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+EFrameworkunifiedStatus CNotification::AddReceiverInMap(const std::string &f_csubscribername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Message Queue Handle for passsing messages
+ HANDLE l_hMsgSenQueHandle = NULL;
+
+ // Pointer to class CNotificationReceiver
+ CNotificationReceiver *l_pCNotificationReceiver = NULL;
+
+ // Iterator for Notification Receiver map
+ NotifReceiver_Iterator_Type l_itrNotifReceiver;
+
+ if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: f_csubscribername can't be empty
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Message Queue Handle Set"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ CHandleList *l_hHandleList = CHandleList::GetHandleList();
+
+ l_hMsgSenQueHandle = l_hHandleList->GetSubscriberMqHandle(f_csubscribername); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ // If handle not found
+ if (NULL == l_hMsgSenQueHandle) {
+ // Open a handle for sending messages to another message queue
+ l_hMsgSenQueHandle = McOpenSender(f_csubscribername.c_str());
+ l_hHandleList->AddHandleInList(f_csubscribername, l_hMsgSenQueHandle); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ }
+
+ if (NULL != m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: m_pmSubscribersList can't be NULL
+ l_pCNotificationReceiver = new(std::nothrow) CNotificationReceiver(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ if (NULL != l_pCNotificationReceiver) { // LCOV_EXCL_BR_LINE 5: l_pCNotificationReceiver can't be NULL
+ l_pCNotificationReceiver->m_MsgQHandle = l_hMsgSenQueHandle;
+
+ // Insert Subscriber name and associated message queue handle in the map
+ m_pmSubscribersList->insert(make_pair(f_csubscribername, l_pCNotificationReceiver));
+ } else {
+ // LCOV_EXCL_START 5: l_pCNotificationReceiver can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pCNotificationReceiver is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: m_pmSubscribersList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_pmSubscribersList is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusNullPointer == l_estatus) {
+ // close the queue handle
+ // NOTE: Uncomment following code when implementation of the function RemoveHandleFromList
+ // is available. To find the reason why it is not implemented, see the function definition.
+ // CHandleList *l_hHandleList = CHandleList::GetHandleList();
+ // l_hHandleList->RemoveHandleFromList(f_csubscribername);
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_csubscribername can't be empty
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// PublishData
+/// This function publishes the notification to client.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::PublishData(HANDLE f_hmsgqhandle,
+ const PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_hmsgqhandle) { // LCOV_EXCL_BR_LINE 6: f_hmsgqhandle can't be NULL
+ // Notification Name
+ PSTR l_cNotificationName = const_cast<PSTR>(m_cNotificationName.c_str());
+
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSendWithSysInfo(f_hmsgqhandle, AppName, NPS_NOTIFY_EV_REQ, l_cNotificationName, f_uimsgsize, f_pmessage, 0))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PublishData failed while McSend for Notification %s, Error Status: 0x%x",
+ l_cNotificationName, l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_hmsgqhandle can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsServiceRegistered
+/// This function checks whether the notification is registered with any service or not.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNotification::IsServiceRegistered() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!m_cServiceName.empty()) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsSubscribersListEmpty
+/// This function is used to check whether any service is subscribed to notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CNotification::IsSubscribersListEmpty() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: m_pmSubscribersList can't be NULL
+ if (m_pmSubscribersList->empty()) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetNotificationName
+/// This function is used to get the notification name.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+std::string CNotification::GetNotificationName() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ return m_cNotificationName;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPublisherName
+/// This function is used to get the publisher name of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+std::string CNotification::GetPublisherName() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ return m_cServiceName;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistenceType
+/// This function is used to get the type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedNotificationType CNotification::GetNotificationType() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ return m_ePersistentType;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetMaxMessageSize
+/// This function is used to get the max size of data of notification message.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CNotification::GetMaxMessageSize() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ return m_uiMaxMsgSize;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetMaxMessageSize
+/// This function reset the max size of data that can be published with notification.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotification::ResetMaxMessageSize(const UI_32 f_uilength) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_uiMaxMsgSize = f_uilength;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSubscriberList
+/// Returns the list of subscribers subscribed to notification
+////////////////////////////////////////////////////////////////////////////////////////////////
+NotifReceiver_Type *CNotification::GetSubscriberList() {
+ return m_pmSubscribersList;
+}
+
+#endif
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp
new file mode 100755
index 0000000..73ce838
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp
@@ -0,0 +1,1558 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of singleton class CNotificationManager.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <algorithm>
+#include <utility>
+#include <string>
+#include <vector>
+#include "ns_npp_types.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_threads.h"
+#include "ns_npp_notification.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_state_notification.h"
+#include "ns_npp_regular_notification.h"
+#include "ns_npp_notification_manager.h"
+#include "ns_npp_state_persistence_notification.h"
+#include "ns_npp_state_nor_persistence_notification.h"
+#include "ns_npp_state_persistence_user_notification.h"
+
+#ifdef NPP_PROFILEINFO_ENABLE
+#include <sstream>
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNotificationManager
+/// Constructor of CNotificationManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotificationManager::CNotificationManager() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_pmNotificationList = new(std::nothrow) Notification_Type(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ m_pvPersistentList = new(std::nothrow) std::vector<std::string>(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ m_pvUserPersistentList = new(std::nothrow) std::vector<std::string>(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ if (NULL == CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread =
+ McOpenSender(NS_NPP_IMMEDIATE_PERSIST_THREAD_NAME);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNotificationManager
+/// Destructor of CNotificationManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotificationManager::~CNotificationManager() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ CNotification *l_pNotification = NULL;
+
+ // delete the members in map of Notification
+ if (NULL != m_pmNotificationList) {
+ if (!m_pmNotificationList->empty()) {
+ for (l_itNotification = m_pmNotificationList->begin();
+ l_itNotification != m_pmNotificationList->end();
+ l_itNotification++) {
+ l_pNotification = (*l_itNotification).second;
+
+ if (NULL != l_pNotification) {
+ delete l_pNotification;
+ l_pNotification = NULL;
+ }
+ }
+
+ // clear the map
+ m_pmNotificationList->clear();
+ }
+
+ delete m_pmNotificationList;
+ m_pmNotificationList = NULL;
+ }
+
+ // delete the members in vector of persistent notification
+ if (NULL != m_pvPersistentList) {
+ if (!m_pvPersistentList->empty()) {
+ // clear the vector
+ m_pvPersistentList->clear();
+ }
+
+ delete m_pvPersistentList;
+ m_pvPersistentList = NULL;
+ }
+
+ // delete the members in vector of user persistent notification
+ if (NULL != m_pvUserPersistentList) {
+ if (!m_pvUserPersistentList->empty()) {
+ // clear the vector
+ m_pvUserPersistentList->clear();
+ }
+
+ delete m_pvUserPersistentList;
+ m_pvUserPersistentList = NULL;
+ }
+
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) {
+ McClose(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread);
+ CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateNotificationObject
+/// This function is used to get notification object from map. If doesn't exists, it create new
+/// object as per type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotification *CNotificationManager::CreateNotificationObject(const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // pointer of notification object
+ CNotification *l_pNotification = NULL;
+
+ // iterator to find notification from map of CNotification
+ Notification_Iterator_Type l_itNotification;
+
+ if (NULL == m_pmNotificationList || NULL == m_pvPersistentList || NULL == m_pvUserPersistentList) { // LCOV_EXCL_START 6: double check, m_pmNotificationList, m_pvPersistentList, m_pvUserPersistentList can't be NULL // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map/vector object is NULL"); // LCOV_EXCL_LINE 6: m_pmNotificationList, m_pvPersistentList, m_pvUserPersistentList can't be NULL // NOLINT[whitespace/line_length]
+ return NULL;
+ }
+ // LCOV_EXCL_STOP
+
+ // check if notification already exists
+ l_itNotification = m_pmNotificationList->find(f_cnotificationname);
+
+ // if exists remove previous entry
+ if (m_pmNotificationList->end() != l_itNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Removing previous entry of notification %s from map", f_cnotificationname.c_str());
+ m_pmNotificationList->erase(l_itNotification);
+ }
+
+ switch (f_enotificationtype) {
+ // if notification is regular notification
+ case eFrameworkunifiedNotificationVar: {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Regular Notification :: %s", f_cnotificationname.c_str());
+ l_pNotification = new(std::nothrow) CRegularNotification(f_cnotificationname,
+ f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ break;
+ }
+
+ // if notification is state notification
+ case eFrameworkunifiedStateVar: {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "State Notification :: %s", f_cnotificationname.c_str());
+ l_pNotification = new(std::nothrow) CStateNotification(f_cnotificationname,
+ f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ break;
+ }
+
+ // if notification is persistence notification
+ case eFrameworkunifiedPersistedStateVar: {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "PersistedState Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_pNotification = new(std::nothrow) CStatePersistenceNotification(f_cnotificationname,
+ f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ // insert notification in persistent notification vector
+ m_pvPersistentList->push_back(f_cnotificationname);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory not allocated"); // LCOV_EXCL_LINE 5: It's impossible to mock new() function // NOLINT[whitespace/line_length]
+ }
+
+ break;
+ }
+
+ // if notification is user persistence notification
+ case eFrameworkunifiedPersistedStateUserVar: {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "PersistedStateUser Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_pNotification = new(std::nothrow) CStatePersistenceUserNotification(f_cnotificationname,
+ f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ // insert notification in user persistent notification vector
+ m_pvUserPersistentList->push_back(f_cnotificationname);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NULL pointer error"); // LCOV_EXCL_LINE 5: It's impossible to mock new() function // NOLINT[whitespace/line_length]
+ }
+
+ break;
+ }
+
+ // if notification is immediate persistence notification
+ case eFrameworkunifiedImmediatePersistedStateVar: {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Immediate PersistedState Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_pNotification = new(std::nothrow) CStateNorPersistenceNotification(f_cnotificationname,
+ f_uimsglength,
+ f_uidelay); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if (NULL != l_pNotification) {
+ // insert notification in notification map
+ m_pmNotificationList->insert(make_pair(f_cnotificationname, l_pNotification));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object creation failed for %s.", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNotification;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SearchNotification
+/// This function is used to search whether notification object is present in map or not.
+/// If present it sends the reference.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotification *CNotificationManager::SearchNotification(const std::string &f_cnotificationname) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ if (NULL == m_pmNotificationList || f_cnotificationname.empty()) { // LCOV_EXCL_BR_LINE 6: double check, m_pmNotificationList can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map pointer is NULL"); // LCOV_EXCL_LINE 6: m_pmNotificationList can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ } else {
+ // check if this notification's object present in map
+ l_itNotification = m_pmNotificationList->find(f_cnotificationname);
+
+ // if notification found in map
+ if (m_pmNotificationList->end() != l_itNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification found in map :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // get the notification object pointer from map
+ l_pNotification = (*l_itNotification).second;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Notification not found :: %s", f_cnotificationname.c_str());
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNotification;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SearchPersistenceNotification
+/// This function is used to search for the given persistent notification in map.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStateNotification *CNotificationManager::SearchPersistenceNotification(const std::string &f_cnotificationname) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // pointer of notification object
+ CNotification *l_pNotification = NULL;
+ CStateNotification *l_pStateNotification = NULL;
+
+ // search the notification in the map
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ if (NULL != l_pNotification) {
+ if (eFrameworkunifiedPersistedStateVar == l_pNotification->GetNotificationType() ||
+ eFrameworkunifiedPersistedStateUserVar == l_pNotification->GetNotificationType() ||
+ eFrameworkunifiedImmediatePersistedStateVar == l_pNotification->GetNotificationType()) {
+ l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "There is no persistence notification registered with name :: %s",
+ f_cnotificationname.c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pStateNotification;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnRegisterEvents
+/// This function creates notification object depending on its type and if already created it adds
+/// the service name to the list in the notification object.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnRegisterEvents(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+
+ if (f_cservicename.empty() || f_cnotificationname.empty()) {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ // get the notification object from map or create new object
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ // if new notification is registered
+ if (NULL == l_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Create new notification object :: %s", f_cnotificationname.c_str());
+
+ // create the new notification object depending on type and insert in map and vector
+ l_pNotification = CreateNotificationObject(f_cnotificationname,
+ f_uimsglength,
+ f_enotificationtype,
+ f_uidelay);
+
+ if (NULL != l_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Set Notification publisher %s for notification %s", f_cservicename.c_str(),
+ f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+
+ // set publisher name
+ l_estatus = l_pNotification->SetEventPublisher(f_cservicename);
+ }
+ } else { // if notification object already exists
+ EFrameworkunifiedNotificationType l_eNotificationType = l_pNotification->GetNotificationType();
+
+ // <<notification type is eFrameworkunifiedUnknown
+ // if some service had already subscribed to the notification before registering it.>>
+ if (eFrameworkunifiedUnknown == l_eNotificationType) {
+ // creates new notification object depending on the type and insert it in notification map
+ l_estatus = ChangeNotificationType(l_pNotification, f_cservicename, f_cnotificationname, f_uimsglength,
+ f_enotificationtype, f_uidelay);
+
+ // delete the old notification object
+ delete l_pNotification; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_pNotification = NULL;
+ } else { // notification is already registered by some service
+ // update the notification property, if re-registered by the same publisher
+ if (f_cservicename == l_pNotification->GetPublisherName() || // if re-register by service
+ "" == l_pNotification->GetPublisherName()) { // if previously unregistered by service
+ // if type is same just update the length of notification data
+ if (l_eNotificationType == f_enotificationtype) {
+ if (l_pNotification->GetMaxMessageSize() != f_uimsglength) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Updating max size of notification %s to %d from %d", f_cnotificationname.c_str(),
+ f_uimsglength, l_pNotification->GetMaxMessageSize());
+ l_estatus = l_pNotification->ResetMaxMessageSize(f_uimsglength);
+ }
+
+ if ("" == l_pNotification->GetPublisherName()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Updating publisher name of notification %s to %s from %s", f_cservicename.c_str(),
+ f_cnotificationname.c_str(), l_pNotification->GetPublisherName().c_str());
+ l_pNotification->SetEventPublisher(f_cservicename);
+ }
+ } else if (eFrameworkunifiedImmediatePersistedStateVar != l_eNotificationType &&
+ eFrameworkunifiedImmediatePersistedStateVar != f_enotificationtype) {
+ // else create new notification object depending on the type and delete the old one
+ // note: do not change immediate notification type
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Changing type of notfn %s from %d to %d", f_cnotificationname.c_str(),
+ l_eNotificationType, f_enotificationtype);
+
+ std::vector<std::string>::iterator l_itNotificationName;
+
+ // remove the notification name from the persistent list of notification(if any)
+ if (eFrameworkunifiedPersistedStateVar == l_eNotificationType) {
+ l_itNotificationName = find(m_pvPersistentList->begin(), m_pvPersistentList->end(), f_cnotificationname);
+
+ if (m_pvPersistentList->end() != l_itNotificationName) {
+ m_pvPersistentList->erase(l_itNotificationName);
+ }
+ } else if (eFrameworkunifiedPersistedStateUserVar == l_eNotificationType) {
+ l_itNotificationName = find(m_pvUserPersistentList->begin(),
+ m_pvUserPersistentList->end(),
+ f_cnotificationname);
+
+ if (m_pvUserPersistentList->end() != l_itNotificationName) {
+ m_pvUserPersistentList->erase(l_itNotificationName);
+ }
+ } else {
+ // do nothing
+ }
+
+ // creates new notification object depending on the new type and insert it in map and delete the old one
+ l_estatus = ChangeNotificationType(l_pNotification, f_cservicename, f_cnotificationname, f_uimsglength,
+ f_enotificationtype, f_uidelay);
+
+ // delete the old notification object
+ delete l_pNotification;
+ l_pNotification = NULL;
+ } else {
+ // do nothing
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notfn: %s already registered by %s, skipping register request by %s",
+ f_cnotificationname.c_str(), l_pNotification->GetPublisherName().c_str(), f_cservicename.c_str());
+
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ChangeNotificationType
+/// This function creates new notification object depending on the type and replaces the old one.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::ChangeNotificationType(CNotification *f_pnotification,
+ const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNewNotification = NULL;
+
+ if (NULL != f_pnotification) { // LCOV_EXCL_BR_LINE 6: f_pnotification can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Create New Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // create new notification object as per notification type
+ l_pNewNotification = CreateNotificationObject(f_cnotificationname, f_uimsglength, f_enotificationtype, f_uidelay);
+
+ if (NULL != l_pNewNotification) {
+ l_estatus = l_pNewNotification->SetEventPublisher(f_cservicename);
+
+ // assign subscribers list to newly created notification
+ l_pNewNotification->SetNewSubscribersList(f_pnotification);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error creating notification object for notification:%s",
+ f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_pnotification can't be NULL
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnUnRegisterEvents
+/// This function removes the name of the service from the notification object.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnUnRegisterEvents(const std::string &f_cservicename,
+ const std::string &f_cnotificationname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+ std::vector<std::string> *l_pvPersistentList = NULL;
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ if (f_cservicename.empty() || f_cnotificationname.empty()) {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ // check if this notification's object present in map
+ l_itNotification = m_pmNotificationList->find(f_cnotificationname);
+
+ // if notification found in map
+ if (m_pmNotificationList->end() != l_itNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification found in map"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // get the notification object pointer from map
+ l_pNotification = (*l_itNotification).second;
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: f_pnotification can't be NULL
+ if (eFrameworkunifiedPersistedStateUserVar == l_pNotification->GetNotificationType()) {
+ l_pvPersistentList = m_pvUserPersistentList;
+ } else if (eFrameworkunifiedPersistedStateVar == l_pNotification->GetNotificationType()) {
+ l_pvPersistentList = m_pvPersistentList;
+ }
+
+ // reset the publisher name
+ l_estatus = l_pNotification->ResetEventPublisher(f_cservicename);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ // if no other service is subscribed to this notification and no service is registered
+ // to this notification remove the notification object from map
+ if (!l_pNotification->IsServiceRegistered() &&
+ l_pNotification->IsSubscribersListEmpty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Deleting Notification Object"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // delete the notification
+ delete l_pNotification; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_pNotification = NULL;
+
+ m_pmNotificationList->erase(l_itNotification);
+
+ if (l_pvPersistentList) {
+ // find the notification in vector
+ std::vector<std::string>::iterator l_itNotificationName;
+
+ l_itNotificationName = find(l_pvPersistentList->begin(),
+ l_pvPersistentList->end(),
+ f_cnotificationname);
+
+ if (l_pvPersistentList->end() != l_itNotificationName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification name from vector");
+ l_pvPersistentList->erase(l_itNotificationName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Persistent list empty"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Services still registered or subscriber list empty"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s is not registered by service %s",
+ f_cnotificationname.c_str(), f_cservicename.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_pnotification can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not registered", f_cnotificationname.c_str());
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not found.", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnPublishEvent
+/// This function stores the published data in the notification object in case of state and
+/// persistent notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnPublishEvent(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+
+ if (f_cservicename.empty() || f_cnotificationname.empty()) { // LCOV_EXCL_BR_LINE 6: f_cservicename and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_cservicename and f_cnotificationname can't be empty
+ } else {
+ // get the notification object from map
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ if (NULL != l_pNotification) {
+ // publish the notification
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotification->Publish(f_cservicename,
+ f_pmessage,
+ f_uimsgsize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error publishing notification %s published by %s, status: %d",
+ f_cnotificationname.c_str(), f_cservicename.c_str(), l_estatus); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification not registered"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnSubscribeToEvent
+/// This function adds the name of the application to subscribers list in notification object.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnSubscribeToEvent(const std::string &f_csubscribername,
+ const std::string &f_cnotificationname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ CNotification *l_pNotification = NULL;
+
+ if (f_cnotificationname.empty() || f_csubscribername.empty()) {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ } else if (NULL == m_pmNotificationList) { // LCOV_EXCL_BR_LINE 6 m_pmNotificationList can't be NULL
+ // LCOV_EXCL_START 6: m_pmNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map pointer is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ // get the notification object from map or create new object
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ if (NULL == l_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "CNotification object created for %s", f_cnotificationname.c_str());
+
+ l_pNotification = new(std::nothrow) CNotification(f_cnotificationname, 0); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ m_pmNotificationList->insert(make_pair(f_cnotificationname, l_pNotification));
+ }
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: double check, l_pNotification can't be NULL
+ // add subscribers name in subscribers list of notification
+ l_estatus = l_pNotification->AddEventReciever(f_csubscribername);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory not allocated for l_pNotification"); // LCOV_EXCL_LINE 6: double check, l_pNotification can't be NULL // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnUnSubscribeFromEvent
+/// This function removes the name of the application from the subscribers list in notification object.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnUnSubscribeFromEvent(const std::string &f_csubscribername,
+ const std::string &f_cnotificationname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotificationType;
+
+ std::vector<std::string> *l_pvPersistentList = NULL;
+
+ if (f_cnotificationname.empty() || f_csubscribername.empty()) {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ } else if (NULL == m_pmNotificationList) { // LCOV_EXCL_BR_LINE 6: m_pmNotificationList can't be NULL
+ // LCOV_EXCL_START 6: m_pmNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification list pointer is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ // check if this notification's object present in map
+ l_itNotificationType = m_pmNotificationList->find(f_cnotificationname);
+
+ // if notification found in map
+ if (m_pmNotificationList->end() != l_itNotificationType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification %s found in map", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ l_pNotification = (*l_itNotificationType).second;
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: l_pNotification can't be NULL
+ if (eFrameworkunifiedPersistedStateUserVar == l_pNotification->GetNotificationType()) {
+ l_pvPersistentList = m_pvUserPersistentList;
+ } else if (eFrameworkunifiedPersistedStateVar == l_pNotification->GetNotificationType()) {
+ l_pvPersistentList = m_pvPersistentList;
+ }
+
+ // removes the subscribers name from subscribers list of notification
+ l_estatus = l_pNotification->DeleteEventReciever(f_csubscribername);
+
+ // if no other service is subscribed to this notification and no service is registered
+ // to this notification remove the notification object from map
+ if (!l_pNotification->IsServiceRegistered() &&
+ l_pNotification->IsSubscribersListEmpty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification Object from map"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // delete notification object from map
+ delete l_pNotification; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_pNotification = NULL;
+
+ m_pmNotificationList->erase(l_itNotificationType);
+
+ if (l_pvPersistentList) {
+ // find notification in vector
+ std::vector<std::string>::iterator l_itNotificationName;
+ l_itNotificationName = find(l_pvPersistentList->begin(),
+ l_pvPersistentList->end(),
+ f_cnotificationname);
+
+ if (l_pvPersistentList->end() != l_itNotificationName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification from vector"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_pvPersistentList->erase(l_itNotificationName);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Persistent list Empty."); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotification can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Notification %s not registered", f_cnotificationname.c_str());
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Notification %s not found.", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NPGetPersistentNotificationData
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NPGetPersistentNotificationData(const std::string &f_cnotificationname,
+ PVOID f_pnotificationdata,
+ const UI_32 f_uidatasize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+ CStateNotification *l_pStateNotification = NULL;
+ const CPersistentData *l_pPersistentData = NULL;
+
+ if (f_cnotificationname.empty() || NULL == f_pnotificationdata) { // LCOV_EXCL_BR_LINE 6: f_pnotificationdata can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_pnotificationdata can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ } else {
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 200: f_cnotificationname must be NTFY_NPPService_UserChange, NTFY_NPPService_UserChange must be registered in FrameworkunifiedOnEntry() by itself. // NOLINT[whitespace/line_length]
+ const EFrameworkunifiedNotificationType l_eNotificationType = l_pNotification->GetNotificationType();
+
+ if (eFrameworkunifiedStateVar == l_eNotificationType ||
+ eFrameworkunifiedPersistedStateVar == l_eNotificationType ||
+ eFrameworkunifiedPersistedStateUserVar == l_eNotificationType ||
+ eFrameworkunifiedImmediatePersistedStateVar == l_eNotificationType) { // LCOV_EXCL_BR_LINE 200: NTFY_NPPService_UserChange's type is eFrameworkunifiedPersistedStateVar. // NOLINT[whitespace/line_length]
+ l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
+
+ l_pPersistentData = l_pStateNotification->GetPersistentData();
+
+ if (NULL != l_pPersistentData) {
+ if (f_uidatasize >= l_pPersistentData->m_uiMsgSize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending Data Size %d", l_pPersistentData->m_uiMsgSize);
+
+ if (NULL != l_pPersistentData->m_pMessage) {
+ std::memcpy(f_pnotificationdata, l_pPersistentData->m_pMessage, l_pPersistentData->m_uiMsgSize);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification data is NULL");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Smaller buffer size %d is received for notification data of size %d", f_uidatasize,
+ l_pPersistentData->m_uiMsgSize);
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Persistent data object is NULL for notification %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 200: NTFY_NPPService_UserChange's type is eFrameworkunifiedPersistedStateVar.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Get notification data failed, Notification %s is registered as type %d",
+ f_cnotificationname.c_str(), l_eNotificationType);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: f_cnotificationname must be NTFY_NPPService_UserChange, NTFY_NPPService_UserChange must be registered in FrameworkunifiedOnEntry() by itself. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not found.", f_cnotificationname.c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceServiceOnGetPersistentData
+/// This function is used to get the persistent data stored related to notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnGetPersistentData(const std::string &f_cnotificationname,
+ const std::string &f_creceivername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+ CStateNotification *l_pStateNotification = NULL;
+ const CPersistentData *l_pPersistentData = NULL;
+
+ if (f_cnotificationname.empty() || f_creceivername.empty()) { // LCOV_EXCL_BR_LINE 6: f_creceivername can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: f_creceivername can't be NULL and f_cnotificationname can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ // open the receiver message queue
+ HANDLE l_hReceiverMq = McOpenSender(f_creceivername.c_str());
+
+ if (NULL == l_hReceiverMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // catastrophic failure!
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open MessageQ %s ", f_creceivername.c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ // get the notification object from map or create new object
+ l_pNotification = SearchNotification(f_cnotificationname);
+
+ if (NULL != l_pNotification) {
+ l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
+
+ if (NULL != l_pStateNotification) { // LCOV_EXCL_BR_LINE 5: fail safe for static_cast<CStateNotification *>
+ l_pPersistentData = l_pStateNotification->GetPersistentData();
+
+ if (NULL != l_pPersistentData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending Data Size %d", l_pPersistentData->m_uiMsgSize);
+
+ if (NULL == l_pPersistentData->m_pMessage) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending Data is NULL");
+ }
+
+ // sent the notification data to requester
+ l_estatus = McSend(l_hReceiverMq,
+ AppName,
+ NPS_GET_PERS_DATA_ACK,
+ l_pPersistentData->m_uiMsgSize,
+ l_pPersistentData->m_pMessage);
+ FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Persistent data found for notification %s. "
+ "Sent NPS_GET_PERS_DATA_ACK to %s. Status: %d."
+ , f_cnotificationname.c_str(), f_creceivername.c_str(), l_estatus);
+ } else { // In case of failure, we send back a failure ACK
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "No persistent data found for notification %s. "
+ , f_cnotificationname.c_str());
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not found", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ // Close the mq handle
+ McClose(l_hReceiverMq);
+ l_hReceiverMq = NULL;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceGetPersistentNotificationData
+/// This function is used to get the list of persistent notifications and data associated with it.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceGetPersistentNotificationData(std::vector<CNotificationsToPersist *>
+ *f_pvpersistnotification,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+ CStateNotification *l_pStateNotification = NULL;
+ CStatePersistenceNotification *l_pStatePersistenceNotification = NULL;
+
+ std::string l_cNotificationName = "";
+ CNotificationsToPersist *l_pNotificationsToPersist = NULL;
+ const CPersistentData *l_pPData = NULL;
+
+ std::vector<std::string> *l_pvPersistentList = NULL;
+
+ // iterator for retrieving notifications from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ if (eFrameworkunifiedPersistedStateUserVar == f_enotificationtype) {
+ l_pvPersistentList = m_pvUserPersistentList;
+ } else if (eFrameworkunifiedPersistedStateVar == f_enotificationtype) { // LCOV_EXCL_BR_LINE 6: f_enotificationtype must be eFrameworkunifiedPersistedStateUserVar or eFrameworkunifiedPersistedStateVar // NOLINT[whitespace/line_length]
+ l_pvPersistentList = m_pvPersistentList;
+ }
+
+ // copy all the notification data in map to received vector
+ if (NULL != f_pvpersistnotification && NULL != l_pvPersistentList) { // LCOV_EXCL_BR_LINE 6: f_pvpersistnotification and l_pvPersistentList can't be null // NOLINT[whitespace/line_length]
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < l_pvPersistentList->size();
+ l_uiCount++) {
+ // get the persistent notification name from vector
+ l_cNotificationName = l_pvPersistentList->at(l_uiCount);
+
+ // search for notification in map
+ l_itNotification = m_pmNotificationList->find(l_cNotificationName);
+
+ // notification found in map
+ if (m_pmNotificationList->end() != l_itNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Persistent Notification: %s", l_cNotificationName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ // get notification object from map
+ l_pNotification = (*l_itNotification).second;
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: l_pNotification can't be NULL
+ if (eFrameworkunifiedPersistedStateVar == f_enotificationtype) {
+ l_pStatePersistenceNotification = static_cast<CStatePersistenceNotification *>(l_pNotification);
+
+ // get the notification's default data
+ if ((eFrameworkunifiedUserData == l_pStatePersistenceNotification->GetPersistentCategory() &&
+ (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedUserData)) ||
+ (eFrameworkunifiedFactoryData == l_pStatePersistenceNotification->GetPersistentCategory() &&
+ (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedFactoryData)) ||
+ (eFrameworkunifiedFactoryCustomerData == l_pStatePersistenceNotification->GetPersistentCategory() &&
+ (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedFactoryCustomerData)) ||
+ (eFrameworkunifiedDealerData == l_pStatePersistenceNotification->GetPersistentCategory() &&
+ (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedDealerData))) {
+ l_pPData = l_pStatePersistenceNotification->GetDefaultPersistentData();
+ } else {
+ l_pStateNotification = l_pStatePersistenceNotification;
+
+ // get the published notification data
+ if (l_pStateNotification->IsPublished()) {
+ l_pPData = l_pStateNotification->GetPersistentData();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification not published");
+ }
+ }
+ } else {
+ l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
+
+ // if not to reset userdata
+ if (0 == (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedUserData)) {
+ if (l_pStateNotification->IsPublished()) {
+ l_pPData = l_pStateNotification->GetPersistentData();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification not published");
+ }
+ }
+ }
+
+ if ((NULL != l_pStateNotification) && (NULL != l_pPData)) {
+ l_pNotificationsToPersist = CreateNotificationObjectToPersist(l_pStateNotification, l_pPData); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ // insert the persistent data in map
+ f_pvpersistnotification->push_back(l_pNotificationsToPersist); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ l_pPData = NULL;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "no data is stored in notification %s", l_cNotificationName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object is NULL for %s", l_cNotificationName.c_str()); // LCOV_EXCL_LINE 6: l_pNotification can't be NULL // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Non Persistent Notification: %s", l_cNotificationName.c_str());
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_pvpersistnotification and l_pvPersistentList can't be null // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateNotificationObjectToPersist
+/// Creates the CNotificationsToPersist object from notification object and the persistent data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotificationsToPersist *CNotificationManager::CreateNotificationObjectToPersist(CStateNotification
+ *f_pStateNotification,
+ const CPersistentData *f_pdata) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotificationsToPersist *l_pNotificationsToPersist = NULL;
+ CPersistentData *l_pData = NULL;
+
+ if (NULL != f_pStateNotification && NULL != f_pdata) { // LCOV_EXCL_BR_LINE 6: f_pStateNotification and f_pdata can't be NULL // NOLINT[whitespace/line_length]
+ if (f_pStateNotification->GetMaxMessageSize() >= f_pdata->m_uiMsgSize) {
+ l_pNotificationsToPersist = new(std::nothrow) CNotificationsToPersist(); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ if (NULL != l_pNotificationsToPersist) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ l_pNotificationsToPersist->m_pPersistentData = new(std::nothrow) CPersistentData(); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ l_pData = l_pNotificationsToPersist->m_pPersistentData;
+
+ if (NULL != l_pData) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ l_pNotificationsToPersist->m_cNotificationName = f_pStateNotification->GetNotificationName();
+ l_pNotificationsToPersist->m_uiMaxMsgLength = f_pStateNotification->GetMaxMessageSize();
+ l_pNotificationsToPersist->m_ePersistentType = f_pStateNotification->GetNotificationType();
+
+ if (eFrameworkunifiedPersistedStateVar == l_pNotificationsToPersist->m_ePersistentType) {
+ l_pNotificationsToPersist->m_ePersistCategory = (static_cast<CStatePersistenceNotification *>
+ (f_pStateNotification))->GetPersistentCategory();
+ }
+
+ l_pNotificationsToPersist->m_cPublisherName = f_pStateNotification->GetPublisherName();
+
+ l_pData->m_uiMsgSize = f_pdata->m_uiMsgSize;
+ l_pData->m_pMessage = new(std::nothrow) CHAR[l_pNotificationsToPersist->m_uiMaxMsgLength];
+
+ if (NULL != l_pData->m_pMessage) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ std::memset(l_pData->m_pMessage, 0, l_pNotificationsToPersist->m_uiMaxMsgLength);
+ std::memcpy(l_pData->m_pMessage, f_pdata->m_pMessage, f_pdata->m_uiMsgSize);
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "memory not allocated for l_pNotificationsToPersist"); // LCOV_EXCL_LINE 5: It's impossible to mock new() function // NOLINT[whitespace/line_length]
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error persisting notfn, Data size of notification %s is %d greater than max registered size %d",
+ f_pStateNotification->GetNotificationName().c_str(),
+ f_pdata->m_uiMsgSize, f_pStateNotification->GetMaxMessageSize());
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid parameter received"); // LCOV_EXCL_LINE 6: f_pStateNotification and f_pdata can't be NULL // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_pNotificationsToPersist;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSetPersistentNotificationData
+/// This function is used to create the persistent notifications object and fill the data related
+/// with it on system load.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceSetPersistentNotificationData(std::vector<CNotificationsToPersist *>
+ *f_pvpersistnotification) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CStateNotification *l_pNotification = NULL;
+ CNotificationsToPersist *l_pNotificationsToPersist = NULL;
+
+ std::vector<std::string> *l_pvPersistentList = NULL;
+
+ Persistent_Iterator_Type l_itPersistentData;
+
+ // store all the notification data received in vector to map of CNotification and to vector of
+ // persistent notification in case of persistent and user persistent notification
+ if (NULL != f_pvpersistnotification) { // LCOV_EXCL_BR_LINE 6: double check, f_pvpersistnotification can't be NULL
+ for (UI_32 l_uiCount = 0;
+ l_uiCount < f_pvpersistnotification->size();
+ l_uiCount++) {
+ // get the persistent data object
+ l_pNotificationsToPersist = f_pvpersistnotification->at(l_uiCount);
+
+ if (NULL != l_pNotificationsToPersist) { // LCOV_EXCL_BR_LINE 6: double check, l_pNotificationsToPersist can't be NULL // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Persistent Type %d", l_pNotificationsToPersist->m_ePersistentType);
+
+ if (eFrameworkunifiedPersistedStateVar == l_pNotificationsToPersist->m_ePersistentType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "PersistentState Notification");
+
+ l_pNotification = new(std::nothrow) CStatePersistenceNotification(
+ l_pNotificationsToPersist->m_cNotificationName,
+ l_pNotificationsToPersist->m_uiMaxMsgLength,
+ l_pNotificationsToPersist->m_ePersistCategory);
+
+ l_pvPersistentList = m_pvPersistentList;
+ } else if (eFrameworkunifiedPersistedStateUserVar == l_pNotificationsToPersist->m_ePersistentType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "PersistentStateUser Notification");
+
+ l_pNotification = new(std::nothrow) CStatePersistenceUserNotification(
+ l_pNotificationsToPersist->m_cNotificationName,
+ l_pNotificationsToPersist->m_uiMaxMsgLength);
+
+ l_pvPersistentList = m_pvUserPersistentList;
+ } else if (eFrameworkunifiedImmediatePersistedStateVar == l_pNotificationsToPersist->m_ePersistentType) { // LCOV_EXCL_BR_LINE 6: l_pNotificationsToPersist->m_ePersistentType must be eFrameworkunifiedPersistedStateVar, eFrameworkunifiedPersistedStateUserVar, eFrameworkunifiedImmediatePersistedStateVar // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "PersistentStateUser Notification");
+
+ l_pNotification = new(std::nothrow) CStateNorPersistenceNotification(
+ l_pNotificationsToPersist->m_cNotificationName,
+ l_pNotificationsToPersist->m_uiMaxMsgLength,
+ l_pNotificationsToPersist->m_uiDelay,
+ l_pNotificationsToPersist->m_ePersistCategory);
+ }
+
+ if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: l_pNotification can't be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Insert persistent notification object in map");
+
+ l_pNotification->SetPersistentData(l_pNotificationsToPersist->m_pPersistentData->m_pMessage,
+ l_pNotificationsToPersist->m_pPersistentData->m_uiMsgSize);
+
+ l_pNotification->SetEventPublisher(l_pNotificationsToPersist->m_cPublisherName);
+
+ if (NULL != m_pmNotificationList) { // LCOV_EXCL_BR_LINE 6: double check, m_pmNotificationList can't be NULL
+ m_pmNotificationList->insert(make_pair(l_pNotificationsToPersist->m_cNotificationName, l_pNotification));
+
+ if (NULL != l_pvPersistentList) {
+ l_pvPersistentList->push_back(l_pNotificationsToPersist->m_cNotificationName);
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Inserted persistent notification object in map");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Inserted persistent notification object in vector");
+ } else {
+ // LCOV_EXCL_START 6: double check, m_pmNotificationList can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete l_pNotification;
+ l_pNotification = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object not inserted in map/vector");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotification can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "notification object is NULL");
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pNotificationsToPersist can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationsToPersist is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, f_pvpersistnotification can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistent data pointer is NULL");
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveUserSpecificNotificationEntry
+/// This function is used to remove the user persistent notifications entry
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::RemoveUserSpecificNotificationEntry() { // LCOV_EXCL_START 100: never be used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string l_cNotificationName;
+
+ std::vector<std::string>::iterator l_itNotificationName;
+
+ // iterator to find notification from map of notifications
+ Notification_Iterator_Type l_itNotification;
+
+ CNotification *l_pNotification = NULL;
+
+ for (l_itNotificationName = m_pvUserPersistentList->begin() ; l_itNotificationName < m_pvUserPersistentList->end() ;
+ l_itNotificationName++) {
+ l_cNotificationName = *(l_itNotificationName);
+
+ // check if this notification's object present in map
+ l_itNotification = m_pmNotificationList->find(l_cNotificationName);
+
+ if (m_pmNotificationList->end() != l_itNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification found in map");
+
+ // get the notification object pointer from map
+ l_pNotification = (*l_itNotification).second;
+
+ if (NULL != l_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification Object");
+
+ // delete the notification
+ delete l_pNotification;
+ l_pNotification = NULL;
+
+ m_pmNotificationList->erase(l_itNotification);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification name from vector");
+ m_pvUserPersistentList->erase(l_itNotificationName);
+
+ l_itNotificationName = m_pvUserPersistentList->begin();
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification not found.");
+
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CNotificationManager::GetNotificationInfo(const std::string &f_cnotificationname, // LCOV_EXCL_START 100: never be used // NOLINT[whitespace/line_length]
+ CNotificationsToPersist *&f_pnotificationstopersist) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification *l_pNotification = NULL;
+ CStateNotification *l_pStateNotification = NULL;
+ const CPersistentData *l_pPData = NULL;
+
+ l_pNotification = SearchNotification(f_cnotificationname);
+ l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
+
+ if (NULL != l_pStateNotification) {
+ if (l_pStateNotification->IsPublished()) {
+ l_pPData = l_pStateNotification->GetPersistentData();
+
+ if (NULL != l_pPData) {
+ f_pnotificationstopersist = new(std::nothrow) CNotificationsToPersist();
+
+ if (NULL == f_pnotificationstopersist) {
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error for f_pnotificationstopersist");
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ f_pnotificationstopersist->m_pPersistentData = new(std::nothrow) CPersistentData();
+
+ if (NULL == f_pnotificationstopersist->m_pPersistentData) {
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error for f_pnotificationstopersist->m_pPersistentData");
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ f_pnotificationstopersist->m_cNotificationName = l_pStateNotification->GetNotificationName();
+ f_pnotificationstopersist->m_uiMaxMsgLength = l_pStateNotification->GetMaxMessageSize();
+ f_pnotificationstopersist->m_cPublisherName = l_pStateNotification->GetPublisherName();
+ f_pnotificationstopersist->m_ePersistentType = l_pStateNotification->GetNotificationType();
+
+ if (eFrameworkunifiedPersistedStateVar == f_pnotificationstopersist->m_ePersistentType) {
+ f_pnotificationstopersist->m_ePersistCategory = (static_cast<CStatePersistenceNotification *>
+ (l_pStateNotification))->GetPersistentCategory();
+ }
+
+ if (eFrameworkunifiedImmediatePersistedStateVar == f_pnotificationstopersist->m_ePersistentType) {
+ CStateNorPersistenceNotification *l_pStateNorPersistenceNotification =
+ static_cast<CStateNorPersistenceNotification *>(l_pStateNotification);
+ f_pnotificationstopersist->m_uiDelay = l_pStateNorPersistenceNotification->GetPersistenceDelay();
+ f_pnotificationstopersist->m_ePersistCategory = (static_cast<CStateNorPersistenceNotification *>
+ (l_pStateNotification))->GetPersistentCategory();
+ }
+
+ f_pnotificationstopersist->m_pPersistentData->m_pMessage = new(std::nothrow)
+ CHAR[f_pnotificationstopersist->m_uiMaxMsgLength];
+ std::memset(f_pnotificationstopersist->m_pPersistentData->m_pMessage, 0,
+ f_pnotificationstopersist->m_uiMaxMsgLength);
+ std::memcpy(f_pnotificationstopersist->m_pPersistentData->m_pMessage,
+ l_pPData->m_pMessage, l_pPData->m_uiMsgSize);
+
+ f_pnotificationstopersist->m_pPersistentData->m_uiMsgSize = l_pPData->m_uiMsgSize;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "No data is stored in notification %s", f_cnotificationname.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification %s not published", f_cnotificationname.c_str());
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSetDefaultPersistentNotificationData
+/// This function is used to set the default data of persistent notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceSetDefaultPersistentNotificationData(const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // pointer of notification object
+ CStateNotification *l_pStateNotification = SearchPersistenceNotification(f_cnotificationname);
+
+ if (NULL != l_pStateNotification) {
+ l_estatus = l_pStateNotification->SetDefaultPersistentData(f_pmessage, f_uimsgsize);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to set default notification data for %s, notification does not exists",
+ f_cnotificationname.c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSetPersistentCategory
+/// This function is used to set the persistent type of persistent notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceSetPersistentCategory(const std::string &f_cnotificationname,
+ const EFrameworkunifiedPersistCategory f_epersistcategory) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // pointer of notification object
+ CStateNotification *l_pStateNotification = SearchPersistenceNotification(f_cnotificationname);
+
+ if (NULL != l_pStateNotification) {
+ EFrameworkunifiedNotificationType l_eNotificationType = l_pStateNotification->GetNotificationType();
+
+ if (eFrameworkunifiedPersistedStateVar == l_eNotificationType) {
+ l_estatus = (static_cast<CStatePersistenceNotification *>(l_pStateNotification))->SetPersistentCategory(
+ f_epersistcategory);
+ } else if (eFrameworkunifiedImmediatePersistedStateVar == l_eNotificationType) {
+ l_estatus = (static_cast<CStateNorPersistenceNotification *>(l_pStateNotification))->SetPersistentCategory(
+ f_epersistcategory);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Cannot set category %d for notification %s of type %d", f_epersistcategory,
+ f_cnotificationname.c_str(), l_eNotificationType);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Cannot set category %d for %s, Either not registered or not a persistent notification",
+ f_epersistcategory, f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentservicePublishImmediateNotification
+/// This function publish the immediate notification f_cnotificationname to all its subscribers.
+/// This API is called when service updates the immediate notification data in persistent memory
+/// using synchronous API.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CNotificationManager::NotificationpersistentservicePublishImmediateNotification(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_cservicename.empty() || f_cnotificationname.empty()) {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ // get the notification object from map
+ CStateNotification *l_pStateNotf = SearchPersistenceNotification(f_cnotificationname);
+
+ if (NULL != l_pStateNotf) {
+ if (eFrameworkunifiedImmediatePersistedStateVar == l_pStateNotf->GetNotificationType()) {
+ CStateNorPersistenceNotification *l_pImmediateNotf =
+ static_cast<CStateNorPersistenceNotification *>(l_pStateNotf);
+
+ // publish the notification
+ if (eFrameworkunifiedStatusOK != (l_estatus = l_pImmediateNotf->PublishNotification(f_cservicename,
+ f_pmessage,
+ f_uimsgsize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error publishing notification %s published by %s, status: %d",
+ f_cnotificationname.c_str(), f_cservicename.c_str(), l_estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s is not registered as immediate persistence by service %s",
+ f_cnotificationname.c_str(), f_cservicename.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not registered by service %s", f_cnotificationname.c_str(),
+ f_cservicename.c_str());
+
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+EFrameworkunifiedStatus CNotificationManager::GetNotificationProfilingData(std::string &f_cnotificationprofileInfo) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ Notification_Iterator_Type l_itNotification;
+ NotifReceiver_Iterator_Type l_itNotifReceiver_Iterator;
+
+ CNotification *l_pNotification = NULL;
+ NotifReceiver_Type *l_pSubscriberList = NULL;
+
+ std::stringstream ss;
+ UI_32 l_uiSubscriberCnt = 0;
+
+ std::string l_cPublisher = "";
+ std::string l_cNotification = "";
+
+ try {
+ if (NULL == m_pmNotificationList) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification List m_pmNotificationList is NULL in notification manager");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus && m_pmNotificationList->empty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification List m_pmNotificationList Empty in notification manager");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ f_cnotificationprofileInfo.append("Application Name,");
+ f_cnotificationprofileInfo.append("Notification Name,");
+ f_cnotificationprofileInfo.append("Type,");
+ f_cnotificationprofileInfo.append("Length,");
+ f_cnotificationprofileInfo.append("Subscribed By,");
+ f_cnotificationprofileInfo.append("Subscribers Count");
+
+ for (l_itNotification = m_pmNotificationList->begin();
+ l_itNotification != m_pmNotificationList->end();
+ l_itNotification++) {
+ l_pNotification = (*l_itNotification).second;
+ if (NULL == l_pNotification) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object ptr is NULL");
+ l_estatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_cPublisher = l_pNotification->GetPublisherName();
+ if (l_cPublisher.empty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Publisher name empty");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ l_cNotification = l_pNotification->GetNotificationName();
+ if (l_cNotification.empty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification name empty");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ l_pSubscriberList = l_pNotification->GetSubscriberList();
+ if (NULL == l_pSubscriberList) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Subscribers List ptr is NULL");
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) {
+ f_cnotificationprofileInfo.append("\n");
+
+ f_cnotificationprofileInfo.append(l_cPublisher);
+ f_cnotificationprofileInfo.append(",");
+
+ f_cnotificationprofileInfo.append(l_cNotification);
+ f_cnotificationprofileInfo.append(",");
+
+ switch (l_pNotification->GetNotificationType()) {
+ case eFrameworkunifiedNotificationVar : {
+ f_cnotificationprofileInfo.append("Regular");
+ }
+ break;
+
+ case eFrameworkunifiedStateVar : {
+ f_cnotificationprofileInfo.append("State");
+ }
+ break;
+
+ case eFrameworkunifiedPersistedStateVar : {
+ f_cnotificationprofileInfo.append("PersistenceState");
+ }
+ break;
+
+ case eFrameworkunifiedPersistedStateUserVar : {
+ f_cnotificationprofileInfo.append("UserPersistenceState");
+ }
+ break;
+
+ case eFrameworkunifiedImmediatePersistedStateVar : {
+ f_cnotificationprofileInfo.append("ImmediatePersistenceState");
+ }
+ break;
+
+ case eFrameworkunifiedUnknown: {
+ f_cnotificationprofileInfo.append("Unknown");
+ }
+ break;
+
+ default:
+ break;
+ }
+ f_cnotificationprofileInfo.append(",");
+
+ ss << l_pNotification->GetMaxMessageSize();
+ f_cnotificationprofileInfo.append(ss.str());
+ ss.str("");
+ f_cnotificationprofileInfo.append(",\"");
+
+ l_uiSubscriberCnt = 0;
+ for (l_itNotifReceiver_Iterator = l_pSubscriberList->begin();
+ l_pSubscriberList->end() != l_itNotifReceiver_Iterator;) {
+ f_cnotificationprofileInfo.append(l_itNotifReceiver_Iterator->first);
+ ++l_uiSubscriberCnt;
+
+ ++l_itNotifReceiver_Iterator;
+
+ if (l_pSubscriberList->end() != l_itNotifReceiver_Iterator) {
+ f_cnotificationprofileInfo.append(",");
+ }
+ }
+
+ f_cnotificationprofileInfo.append("\",");
+
+ ss << l_uiSubscriberCnt;
+ f_cnotificationprofileInfo.append(ss.str());
+ ss.str("");
+ }
+
+ l_estatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ } catch (std::exception &exp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Exception:: %s", exp.what());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+#endif
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp
new file mode 100755
index 0000000..53b9eab
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp
@@ -0,0 +1,50 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CNotificationReceiver.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include "ns_npp_notification_receiver.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CNotificationReceiver
+/// Constructor of CNotificationReceiver class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotificationReceiver::CNotificationReceiver() {
+ m_MsgQHandle = NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CNotificationReceiver
+/// Destructor of CNotificationReceiver class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CNotificationReceiver::~CNotificationReceiver() {
+ m_MsgQHandle = NULL;
+}
+
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp
new file mode 100755
index 0000000..4b0e452
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp
@@ -0,0 +1,100 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains definition of CFilePersistence class.
+/// This class is responsible for persisting and retrieving of files.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <unistd.h>
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_copy_worker.h"
+#include "ns_npp_persist_file.h"
+#include "ns_npp_registry_entry.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFilePersistence
+/// Constructor of CFilePersistence class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFilePersistence::CFilePersistence() {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFilePersistence
+/// Destructor of CFilePersistence class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFilePersistence::~CFilePersistence() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Release
+/// Entry for the file is stored in map for persistence.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFilePersistence::Release(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_cmempath.empty() || f_crequesterappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cmempath, f_crequesterappname and f_ctag can't be empty
+ // LCOV_EXCL_START 6: f_cmempath, f_crequesterappname and f_ctag can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid file path, requester or tag.");
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ l_estatus = ProcessReleaseRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE, f_cmempath, enotificationpersistentservicereleasetype,
+ f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Load
+/// Load file from persistent memory to the specified location.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFilePersistence::Load(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ if (!f_ctag.empty() && !f_crequesterappname.empty() && !f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_ctag, f_crequesterappname and f_cretrievepath can't be empty
+ l_estatus = ProcessLoadRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE, f_cretrievepath, f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ } else {
+ // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cretrievepath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid argument passed (RetrievePath:%s ,tag:%s, requester:%s)",
+ f_cretrievepath.c_str(), f_ctag.c_str(), f_crequesterappname.c_str());
+
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp
new file mode 100755
index 0000000..87b1ed4
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp
@@ -0,0 +1,96 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <unistd.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <string>
+#include "ns_npp_persistence.h"
+#include "ns_npp_persist_folder.h"
+#include "ns_npp_registry_entry.h"
+
+// Constructor of class CFolderPersistence
+CFolderPersistence::CFolderPersistence() {
+}
+
+// Destructor of class CFolderPersistence
+CFolderPersistence::~CFolderPersistence() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+// Method to release folder for persistence.
+EFrameworkunifiedStatus CFolderPersistence::Release(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_cmempath.empty() || f_crequesterappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cmempath, f_crequesterappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cmempath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid folder path, requester or tag.");
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ // Call to method requesting to release the folder for persistence.
+ l_estatus = ProcessReleaseRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, f_cmempath, enotificationpersistentservicereleasetype,
+ f_cusername);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
+ return l_estatus;
+}
+
+// Method to load folder from persistent memory.
+EFrameworkunifiedStatus CFolderPersistence::Load(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ if (!f_ctag.empty() && !f_crequesterappname.empty() && !f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cretrievepath, f_crequesterappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ // Call to method requesting to load the folder from persistent memory.
+ l_estatus = ProcessLoadRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, f_cretrievepath, f_cusername);
+ } else {
+ // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cretrievepath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid argument passed (RetrievePath:%s ,tag:%s, requester:%s)",
+ f_cretrievepath.c_str(), f_ctag.c_str(), f_crequesterappname.c_str());
+
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp
new file mode 100755
index 0000000..a39b836
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp
@@ -0,0 +1,743 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CPersistence.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#ifdef AGL_STUB
+#include <other_service/strlcpy.h>
+// #include "frameworkunified_stub.h"
+#endif
+#include <unistd.h>
+#include <stdlib.h> // for getenv()
+#ifdef AGL_STUB
+#include <cstdio>
+#endif
+#include <utility>
+#include <string>
+#include "ns_npp_persistence.h"
+#include "ns_npp_registry_entry.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CPersistence
+/// Constructor of CPersistence class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistence::CPersistence():
+ m_cStoragePath(GetStoragePath()),
+ m_eCompressionType(ENOTIFICATIONPERSISTENTSERVICEDEFAULTCOMPRESSION),
+ m_hNSWriteToPersistentMem(NULL),
+ m_hNSReadFromPersistentMem(NULL),
+ m_hAppHandle(NULL),
+ m_bPersist(FALSE),
+ m_uiNotificationpersistentservicePersistCategoryFlag(0) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CPersistence
+/// Destructor of CPersistence class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistence::~CPersistence() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReadThreadHandle
+/// Set read thread handle.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistence::SetReadThreadHandle(HANDLE f_hreadthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_hNSReadFromPersistentMem = f_hreadthread;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetWriteThreadHandle
+/// Set write thread handle.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistence::SetWriteThreadHandle(HANDLE f_hwritethread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_hNSWriteToPersistentMem = f_hwritethread;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetStoragePath
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+std::string CPersistence::GetStoragePath() {
+ std::string l_cStoragePath(STORAGE_PATH);
+
+ return l_cStoragePath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Register
+/// Register tag for persistence.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::Register(std::string f_crequestorappname, std::string f_ctag, BOOL bisuserpersistence) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (f_ctag.empty() || f_crequestorappname.empty()) { // LCOV_EXCL_BR_LINE 6: f_ctag and f_crequestorappname can't be empty // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: f_ctag and f_crequestorappname can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid tag or requester.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ TSourceRegistryListItr l_itRegistry = m_mPersistRegistry.find(f_crequestorappname);
+ if (l_itRegistry != m_mPersistRegistry.end()) {
+ // source available, check for file/folder availability
+ TTagRegistryListItr l_itRegistryList = (l_itRegistry->second).find(f_ctag);
+ if (l_itRegistryList != (l_itRegistry->second).end()) {
+ // found already in the registry
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Already exists %s , %s", f_ctag.c_str(), f_crequestorappname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ // tag not found .. so add to the registry
+ CRegistryEntry l_objRegistryEntry(f_ctag, f_crequestorappname, m_cStoragePath,
+ bisuserpersistence); // f_eRegisterType, f_cUser);
+
+ (l_itRegistry->second).insert(make_pair(f_ctag, l_objRegistryEntry));
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s found adding tag %s", f_crequestorappname.c_str(), f_ctag.c_str());
+ }
+ } else {
+ // source not found, so creating a new entry
+ CRegistryEntry l_objRegistryEntry(f_ctag, f_crequestorappname, m_cStoragePath,
+ bisuserpersistence); // f_eRegisterType, f_cUser);
+
+ TTagRegistryList l_mRegList;
+ l_mRegList.insert(make_pair(f_ctag, l_objRegistryEntry)); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ m_mPersistRegistry.insert(std::make_pair(f_crequestorappname, l_mRegList)); // LCOV_EXCL_BR_LINE 11:except,C++ STL // NOLINT[whitespace/line_length]
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "none exists %s , %s. So, added entry.", // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ f_ctag.c_str(), f_crequestorappname.c_str()); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
+
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ProcessReleaseRequest
+/// Persist file/folder that need to be persisted.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::ProcessReleaseRequest(std::string f_crequesterappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (f_cmempath.empty() || f_crequesterappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6:f_cmempath, f_crequesterappname and f_ctag can`t be empty // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: f_cmempath, f_crequesterappname and f_ctag can`t be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG0(ZONE_ERR, __FUNCTION__, "Invalid file path, requester or tag.");
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ // Persistence Registry map iterator
+ TSourceRegistryListItr l_itTSourceRegistryListItr = m_mPersistRegistry.find(f_crequesterappname);
+
+ if (l_itTSourceRegistryListItr != m_mPersistRegistry.end()) {
+ // source available, check for file if registered
+ TTagRegistryListItr l_itTRegistryList = (l_itTSourceRegistryListItr->second).find(f_ctag);
+ if (l_itTRegistryList != (l_itTSourceRegistryListItr->second).end()) {
+ if (eFrameworkunifiedNotOnRelease != enotificationpersistentservicereleasetype) {
+ // Set release path
+ l_itTRegistryList->second.SetReleasePath(f_cmempath);
+ // Set persist path
+ l_itTRegistryList->second.SetPersistProperties(f_epersisttype, f_cusername); // LCOV_EXCL_BR_LINE 11:except,C++ STL // NOLINT[whitespace/line_length]
+
+ // file/folder found in registry
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "%s released %s. Found in registry. queued up to persist from %s",
+ f_crequesterappname.c_str(), f_ctag.c_str(), l_itTRegistryList->second.GetReleasePath().c_str());
+
+ // check if persist flag is set due to shutdown or user change
+ if ((m_bPersist // It will be set to TRUE either on shutdown or userchange
+ && l_itTRegistryList->second.HasntBeenPersisted()) // File/Folder persisted or not
+ || (eFrameworkunifiedPersistInstantly == enotificationpersistentservicereleasetype)) {
+ // reset the data
+ if (((eFrameworkunifiedUserData == l_itTRegistryList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedUserData & m_uiNotificationpersistentservicePersistCategoryFlag)) ||
+ ((eFrameworkunifiedFactoryData == l_itTRegistryList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedFactoryData & m_uiNotificationpersistentservicePersistCategoryFlag)) ||
+ ((eFrameworkunifiedFactoryCustomerData == l_itTRegistryList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedFactoryCustomerData & m_uiNotificationpersistentservicePersistCategoryFlag)) ||
+ ((eFrameworkunifiedDealerData == l_itTRegistryList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedDealerData & m_uiNotificationpersistentservicePersistCategoryFlag))) {
+ // set the status of file/folder persisted as reset has been called on these data
+ l_itTRegistryList->second.SetCurrentAction(LOADTYPE_RELEASE);
+ l_itTRegistryList->second.SetBeingPersisted();
+ } else { // persist the data
+ if (eFrameworkunifiedStatusOK != (l_estatus = Persist(static_cast<CRegistryEntry &>(l_itTRegistryList->second)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+ } else {
+ // Don't persist now. Persist on shutdown.
+ }
+ } else { // not on release
+ // set the status of file/folder as released and persisted as these data need not to be persisted on shutdown
+ l_itTRegistryList->second.SetReleasePath("");
+ l_itTRegistryList->second.SetCurrentAction(LOADTYPE_RELEASE);
+ l_itTRegistryList->second.SetBeingPersisted();
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s didn't register %s, not persisting",
+ f_crequesterappname.c_str(), f_ctag.c_str()); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ // source not registered, cannot persist
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s is not registered ignoring release of %s",
+ f_ctag.c_str(), f_crequesterappname.c_str());
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ }
+ return l_estatus;
+}
+
+EFrameworkunifiedStatus CPersistence::Persist(CRegistryEntry &f_objregistryentry) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // Persistence Info Structure
+ NSP_CopyInfoCmd l_tCpInfo = {};
+
+
+ std::string l_cSourcePath = f_objregistryentry.GetReleasePath();
+ std::string l_cPersistPath = f_objregistryentry.GetPersistPath(); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ // Fill the persistence info structure
+ AddRequestData(l_tCpInfo,
+ l_cSourcePath,
+ l_cPersistPath,
+ f_objregistryentry.GetRequester(),
+ f_objregistryentry.GetTag(),
+ LOADTYPE_RELEASE,
+ f_objregistryentry.GetPersistType());
+
+ // Persist only if file was released.
+ // Release means application has asked NPPService to persist file at shutdown.)
+ // Persist means actual persisting a file at persistent storage
+ if (f_objregistryentry.IsReleased()) {
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS == f_objregistryentry.m_eJobState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Another job with source: %s and tag %s is in process. "
+ "Therefore adding release request to the pending queue.",
+ f_objregistryentry.GetRequester().c_str(), f_objregistryentry.GetTag().c_str());
+ // if job corresponding to the tag is already in process, add it in pending queue
+ m_lPendingJobs.push_back(l_tCpInfo);
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE == f_objregistryentry.m_eJobState) {
+ if (eFrameworkunifiedStatusOK == (SendRequestMessage(l_tCpInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Release message passed to writer thread."); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ f_objregistryentry.SetCurrentAction(LOADTYPE_RELEASE);
+ f_objregistryentry.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS;
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failure in passing release message to writer thread.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File/Folder not released yet.");
+ }
+
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ProcessLoadRequest
+/// Load persisted file/folder.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::ProcessLoadRequest(std::string f_crequesterappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cretrievepath,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // file/folder found in registry
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Load request received: Requester: %s and Tag: %s Load at: %s.",
+ f_crequesterappname.c_str(), f_ctag.c_str(), f_cretrievepath.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ if (f_ctag.empty() || f_crequesterappname.empty() || f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: both f_ctag and f_crequesterappname and f_cretrievepath can`t be empty // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: both f_ctag and f_crequesterappname and f_cretrievepath can`t be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid argument passed (RetrievePath:%s ,tag:%s, requester:%s)",
+ f_cretrievepath.c_str(), f_ctag.c_str(), f_crequesterappname.c_str());
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ // Persistence Registry Map Iterator
+ TSourceRegistryListItr l_itTRegistry = m_mPersistRegistry.find(f_crequesterappname);
+
+ // Persistence Info Struct
+ NSP_CopyInfoCmd l_tCopyInfo = {};
+
+ if (l_itTRegistry != m_mPersistRegistry.end()) {
+ // source available, check for file/folder
+ TTagRegistryListItr l_itTRegistryList = (l_itTRegistry->second).find(f_ctag);
+ if (l_itTRegistryList != (l_itTRegistry->second).end()) {
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED == l_itTRegistryList->second.m_eJobState)) { // LCOV_EXCL_BR_LINE 6: m_eJobState can`t be ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: m_eJobState can`t be ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::string l_cReleasePath(l_itTRegistryList->second.GetReleasePath());
+ // if job was aborted due to some reason like abort shutdown.
+ // Then persistent storage doesn't have updated file/folder. Just restore
+ // aborted released file.
+ // just rename it
+ if (0 == std::rename(l_cReleasePath.c_str(), f_cretrievepath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File loaded at requested location.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error while processing load request when tried to move. source: %s dest: %s",
+ l_cReleasePath.c_str(), f_cretrievepath.c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ l_itTRegistryList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE;
+ // LCOV_EXCL_STOP
+ } else {
+ std::string l_cLoadPath(l_itTRegistryList->second.GetLoadPath(f_epersisttype, f_cusername)); // LCOV_EXCL_BR_LINE 11:except,C++ STL // NOLINT[whitespace/line_length]
+
+ if (0 == access(l_cLoadPath.c_str(), R_OK)) {
+ // file/folder found in registry
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Found in registry. checking in persistence...(%s)", l_cLoadPath.c_str());
+
+ AddRequestData(l_tCopyInfo,
+ l_cLoadPath,
+ f_cretrievepath,
+ f_crequesterappname,
+ f_ctag,
+ LOADTYPE_LOAD,
+ f_epersisttype);
+
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS == (l_itTRegistryList->second).m_eJobState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Another job with source: %s and tag %s is in process. "
+ "Therefore adding load request to the pending queue.",
+ f_crequesterappname.c_str(), f_ctag.c_str());
+ m_lPendingJobs.push_back(l_tCopyInfo);
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE == (l_itTRegistryList->second).m_eJobState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Found in persistence.");
+ if (eFrameworkunifiedStatusOK == (SendRequestMessage(l_tCopyInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Load message passed to reader thread. Retrieving..");
+ // file/folder is requested for loading so reset the persisted flag.
+ l_itTRegistryList->second.ResetPersistedFlag();
+ l_itTRegistryList->second.SetCurrentAction(LOADTYPE_LOAD);
+ l_itTRegistryList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS;
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failure in passing load message to reader thread.");
+ l_estatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s requested by %s. Not found in persistence memory.", // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ f_ctag.c_str(), f_crequesterappname.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ l_estatus = eFrameworkunifiedStatusAccessError;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s requesting %s .. Tag not found",
+ f_crequesterappname.c_str(), f_ctag.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ // source not found
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s requesting %s .. Requester not found",
+ f_crequesterappname.c_str(), f_ctag.c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ return l_estatus;
+}
+
+VOID CPersistence::AddRequestData(NSP_CopyInfoCmd &f_tcpinfo,
+ std::string f_sourcepath,
+ std::string f_destpath,
+ std::string f_crequesterappname,
+ std::string f_ctag,
+ ENPS_Loadtype f_eloadtype,
+ ENotificationpersistentservicePersistType f_epersisttype) {
+#ifdef AGL_PosixBasedOS001LEGACY_USED
+ strlcpy(f_tcpinfo.m_csourcepath, f_sourcepath.c_str(), sizeof(f_tcpinfo.m_csourcepath));
+ strlcpy(f_tcpinfo.m_cdestinationpath, f_destpath.c_str(), sizeof(f_tcpinfo.m_cdestinationpath));
+ strlcpy(f_tcpinfo.m_crequesterappname, f_crequesterappname.c_str(), sizeof(f_tcpinfo.m_crequesterappname));
+ strlcpy(f_tcpinfo.m_cpersistenttag, f_ctag.c_str(), sizeof(f_tcpinfo.m_cpersistenttag));
+#endif
+ f_tcpinfo.m_eloadtype = f_eloadtype;
+ f_tcpinfo.m_epersisttype = f_epersisttype;
+ // f_tcpinfo.m_eCompressionType = ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ;
+}
+
+EFrameworkunifiedStatus CPersistence::SendRequestMessage(NSP_CopyInfoCmd &f_tcpinfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ HANDLE l_hThreadHandle = NULL;
+ // Worker Command Protocol
+ ENSP_CopyWorkerProtocol l_eWorkerProtocol = CP_WRK_CMD_COPY;
+
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == f_tcpinfo.m_epersisttype) {
+ l_eWorkerProtocol = CP_WRK_CMD_COPY;
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == f_tcpinfo.m_epersisttype) {
+ l_eWorkerProtocol = AR_CMD_ARCHIVE;
+ }
+
+ if (LOADTYPE_RELEASE == f_tcpinfo.m_eloadtype) {
+ l_hThreadHandle = m_hNSWriteToPersistentMem;
+ } else if (LOADTYPE_LOAD == f_tcpinfo.m_eloadtype) {
+ l_hThreadHandle = m_hNSReadFromPersistentMem;
+ }
+
+ if (l_hThreadHandle) {
+ // issue a copy to the worker thread
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSend(l_hThreadHandle, AppName, l_eWorkerProtocol, sizeof(NSP_CopyInfoCmd), &f_tcpinfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for thread failed %d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// AckReceivedFromWorker
+/// This is callback function for ack that file is released to persistenet memory.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, BOOL f_bcopystatus,
+ ENPS_Loadtype f_eloadtype) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus retVal = eFrameworkunifiedStatusOK;
+
+ std::string l_cRequester(f_csource);
+ std::string l_cTag(f_ctag); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ TSourceRegistryListItr l_itTReg = m_mPersistRegistry.find(l_cRequester);
+ if (l_itTReg != m_mPersistRegistry.end()) {
+ // source available, check for file
+ TTagRegistryListItr l_itTRegList = (l_itTReg->second).find(l_cTag);
+ if (l_itTRegList != (l_itTReg->second).end()) {
+ if (LOADTYPE_RELEASE == f_eloadtype) {
+ l_itTRegList->second.SetBeingPersisted(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ if (f_bcopystatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File persisted %s / %s", f_csource, f_ctag);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ "File not persisted %s / %s, Negative ack received from copy worker thread",
+ f_csource,
+ f_ctag); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ }
+
+ // Job processed. Set job state as idle
+ l_itTRegList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE;
+
+ // check if there are any pending jobs for corresponding source and tag
+ if (!m_lPendingJobs.empty()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Retrieving next pending job for persistence...");
+ TPendingJobsItr l_itrPendingJobs;
+ for (l_itrPendingJobs = m_lPendingJobs.begin(); l_itrPendingJobs != m_lPendingJobs.end(); ++l_itrPendingJobs) {
+ if (0 == std::strcmp((*l_itrPendingJobs).m_crequesterappname, f_csource)
+ && (0 == std::strcmp((*l_itrPendingJobs).m_cpersistenttag, f_ctag))) {
+ if (eFrameworkunifiedStatusOK == (retVal = (SendRequestMessage((*l_itrPendingJobs))))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // set job state as processing
+ l_itTRegList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS;
+ // set current action
+ l_itTRegList->second.SetCurrentAction((*l_itrPendingJobs).m_eloadtype);
+ // Reset persisted flag. It requires to process release request for this tag.
+ // Because, file will be persisted only once. Unless, anyone loads the file again.
+ if (LOADTYPE_LOAD == (*l_itrPendingJobs).m_eloadtype) {
+ l_itTRegList->second.ResetPersistedFlag();
+ }
+
+ // remove job from pending list
+ m_lPendingJobs.erase(l_itrPendingJobs);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failure in passing load/release message to the worker threads.");
+ retVal = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ break;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No pending jobs"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // tag not found ..
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " ERROR %s, tag %s not found ", f_csource, f_ctag);
+ }
+ } else {
+ // source not found
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR none exists %s , %s", f_csource, f_ctag);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return retVal;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// PersistAllReleaseRequests
+/// Persist all files which are not persisted yet.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ m_bPersist = TRUE; // set to true because persist of all release requests have been triggered.
+ // Trigger reason: shutdown
+
+ m_uiNotificationpersistentservicePersistCategoryFlag = f_uinotificationpersistentservicepersistcategoryflag;
+
+ TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
+
+ for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
+ TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
+ for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
+ if (l_itTRegList->second.HasntBeenPersisted()) {
+ // reset the data
+ if (((eFrameworkunifiedUserData == l_itTRegList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedUserData & f_uinotificationpersistentservicepersistcategoryflag)) ||
+ ((eFrameworkunifiedFactoryData == l_itTRegList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedFactoryData & f_uinotificationpersistentservicepersistcategoryflag)) ||
+ ((eFrameworkunifiedFactoryCustomerData == l_itTRegList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedFactoryCustomerData & f_uinotificationpersistentservicepersistcategoryflag)) ||
+ ((eFrameworkunifiedDealerData == l_itTRegList->second.GetPersistentCategory()) &&
+ (eFrameworkunifiedDealerData & f_uinotificationpersistentservicepersistcategoryflag))) {
+ // set the status of file/folder as released and persisted as these data need not to be persisted on shutdown
+ l_itTRegList->second.SetCurrentAction(LOADTYPE_RELEASE);
+ l_itTRegList->second.SetBeingPersisted();
+ } else { // persist the data
+ if (eFrameworkunifiedStatusOK != Persist(static_cast<CRegistryEntry &>(l_itTRegList->second))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+BOOL CPersistence::HaveAllReleaseRequestsPersisted(std::string &f_ctagnotreleased) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bRetVal = TRUE;
+
+ TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
+
+ f_ctagnotreleased.assign("");
+
+ for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
+ TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
+ for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
+ if (l_itTRegList->second.HasntBeenPersisted()) {
+ l_bRetVal = FALSE;
+
+ if (!l_itTRegList->second.IsReleased()) {
+ f_ctagnotreleased.append("\n");
+ f_ctagnotreleased.append(l_itTRegList->second.GetTag());
+ f_ctagnotreleased.append(" [");
+ f_ctagnotreleased.append(l_itTRegList->second.GetRequester());
+ f_ctagnotreleased.append("]");
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bRetVal;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// PersistAllUserRequests
+/// Persist all user files which are not persisted yet.
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::PersistAllUserRequests() {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ // TODO(my_username): Persist data on userchange. Uncomment following.
+ // m_bPersist = TRUE; // set to true because persist of all user release requests have been triggered.
+ // Trigger reason: user change
+
+ TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
+
+ for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
+ TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
+ for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
+ if (l_itTRegList->second.IsUserPersistence()) {
+ if (eFrameworkunifiedStatusOK != Persist(static_cast<CRegistryEntry &>(l_itTRegList->second))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+ }
+ }
+ return l_estatus;
+}
+
+BOOL CPersistence::IsUserPersistence(std::string f_ctag) {
+ BOOL l_bUserPersistence = FALSE;
+
+ TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
+
+ for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
+ TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
+ for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
+ if (l_itTRegList->second.GetTag() == f_ctag) {
+ if (l_itTRegList->second.IsUserPersistence()) {
+ l_bUserPersistence = TRUE;
+ }
+ break;
+ }
+ }
+ }
+
+ return l_bUserPersistence;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistentCategory
+/// Sets the persist type of file/folder
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistence::SetPersistentCategory(const std::string &f_crequesterappname,
+ const std::string &f_ctag,
+ EFrameworkunifiedPersistCategory f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // Persistence Registry map iterator
+ TSourceRegistryListItr l_itTSourceRegistryListItr = m_mPersistRegistry.find(f_crequesterappname);
+
+ if (m_mPersistRegistry.end() != l_itTSourceRegistryListItr) {
+ // source available, check for file if registered
+ TTagRegistryListItr l_itTRegistryList = (l_itTSourceRegistryListItr->second).find(f_ctag);
+
+ if ((l_itTSourceRegistryListItr->second).end() != l_itTRegistryList) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppName:: %s, Tag:: %s found in registry", f_crequesterappname.c_str(),
+ f_ctag.c_str());
+
+ l_estatus = (l_itTRegistryList->second).SetPersistentCategory(f_epersistcategory);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s didn't register %s", f_crequesterappname.c_str(), f_ctag.c_str());
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ // source not registered, cannot persist
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s is not registered", f_ctag.c_str());
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetPersistFlag
+/// Resets the persist flag.
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistence::ResetPersistFlag() {
+ m_bPersist = FALSE;
+
+ m_uiNotificationpersistentservicePersistCategoryFlag = 0;
+}
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+EFrameworkunifiedStatus CPersistence::GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ TSourceRegistryListItr l_itrTSourceRegistryListItr;
+ TTagRegistryListItr l_itrTTagRegistryListItr;
+
+ for (l_itrTSourceRegistryListItr = m_mPersistRegistry.begin();
+ l_itrTSourceRegistryListItr != m_mPersistRegistry.end();
+ l_itrTSourceRegistryListItr++) {
+ for (l_itrTTagRegistryListItr = (l_itrTSourceRegistryListItr->second).begin();
+ l_itrTTagRegistryListItr != (l_itrTSourceRegistryListItr->second).end();
+ l_itrTTagRegistryListItr++) {
+ f_cpersistenceprofileinfo.append("\n");
+ f_cpersistenceprofileinfo.append((*l_itrTSourceRegistryListItr).first);
+ f_cpersistenceprofileinfo.append(",");
+
+ f_cpersistenceprofileinfo.append(l_itrTTagRegistryListItr->first);
+ f_cpersistenceprofileinfo.append(",");
+
+ switch ((l_itrTTagRegistryListItr->second).GetPersistType()) {
+ case ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE: {
+ f_cpersistenceprofileinfo.append("File,");
+ }
+ break;
+
+ case ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER: {
+ f_cpersistenceprofileinfo.append("Folder,");
+ }
+ break;
+
+ default: {
+ f_cpersistenceprofileinfo.append(",");
+ }
+ break;
+ }
+
+ if ((l_itrTTagRegistryListItr->second).IsUserPersistence()) {
+ f_cpersistenceprofileinfo.append("Yes,");
+ } else {
+ f_cpersistenceprofileinfo.append("No,");
+ }
+
+ if ((l_itrTTagRegistryListItr->second).IsReleased()) {
+ f_cpersistenceprofileinfo.append("Yes,");
+ } else {
+ f_cpersistenceprofileinfo.append("No,");
+ }
+
+ if ((l_itrTTagRegistryListItr->second).IsPersisted()) {
+ f_cpersistenceprofileinfo.append("Yes");
+ } else {
+ f_cpersistenceprofileinfo.append("No");
+ }
+ }
+ }
+ return l_estatus;
+}
+
+#endif
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp
new file mode 100755
index 0000000..7f5d292
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp
@@ -0,0 +1,1132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief This file contains implementation of class CPersistenceManager.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <stdio.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_util_directory.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <string>
+#include <native_service/ns_np_service_nor_persistence_internal.h>
+#include "ns_npp.h"
+#include "ns_npp_types.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_copy_worker.h"
+#include "ns_npp_persistence.h"
+#include "ns_npp_persist_file.h"
+#include "ns_npp_fs_directory.h"
+#include "ns_npp_persist_folder.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_binary_accesser.h"
+#include "ns_npp_persistence_manager.h"
+#include "ns_npp_nor_persistence_worker_thread.h"
+#include "ns_npp_state_nor_persistence_notification.h"
+
+extern const CHAR AppName[]; // NOLINT (readability/naming)
+
+// Initialisation of static class member for disabling persistence
+BOOL CPersistenceManager::m_bPersistenceDisabled = FALSE;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CPersistenceManager
+/// Constructor of CPersistenceManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistenceManager::CPersistenceManager() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_cUserNotificationTag = USERNOTIFICATIONFILE;
+
+ m_poDataAccesser = NULL;
+
+ m_cNotificationPersistFilepath = CPersistence::GetStoragePath(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Storage path for persistence=%s", m_cNotificationPersistFilepath.c_str()); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+
+ m_cNotificationPersistFilepath += AppName;
+ m_cNotificationPersistFilepath += "/";
+
+ m_hNSImmediatePersistenceThread = NULL;
+ m_bAllFilePersisted = FALSE;
+ m_bImmediatedDataPersisted = FALSE;
+
+ if (eFrameworkunifiedStatusOK != Init()) { // LCOV_EXCL_BR_LINE 6: Init() must be return eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to initialize Persistent Manager."); // LCOV_EXCL_LINE 6: Init() must be return eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CPersistenceManager
+/// Destructor of CPersistenceManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistenceManager::~CPersistenceManager() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_poDataAccesser) {
+ delete m_poDataAccesser;
+ }
+
+ Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
+ // Remove memory allocated for persistence objects
+ for (; l_itPersist_Type != m_mPersist_Type.end(); ++l_itPersist_Type) {
+ if (NULL != (*l_itPersist_Type).second) {
+ delete(*l_itPersist_Type).second;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CPersistenceManager::Init() {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE] = new(std::nothrow) CFilePersistence(); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER] = new(std::nothrow) CFolderPersistence(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT[whitespace/line_length]
+
+ m_poDataAccesser = new(std::nothrow) CBinaryAccesser(); // Save data in binary format. // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT[whitespace/line_length]
+
+ // check if all object creation is successful
+ if (NULL != m_poDataAccesser) { // LCOV_EXCL_BR_LINE 5:m_poDataAccesser can`t be NULL
+ Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
+
+ // check if all object creation is successful
+ for (; l_itPersist_Type != m_mPersist_Type.end();
+ ++l_itPersist_Type) {
+ if (NULL == (*l_itPersist_Type).second) { // LCOV_EXCL_START 6:(*l_itPersist_Type).second can`t be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 5: m_poDataAccesser can`t be NULL
+ }
+
+ if (eFrameworkunifiedStatusOK != l_estatus) { // LCOV_EXCL_START 6: l_estatus must be eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (NULL != m_poDataAccesser) {
+ delete m_poDataAccesser;
+ }
+
+ Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
+ // check if all object creation is successful
+ for (; l_itPersist_Type != m_mPersist_Type.end(); ++l_itPersist_Type) {
+ if (NULL != (*l_itPersist_Type).second) {
+ delete(*l_itPersist_Type).second;
+ }
+ }
+ // LCOV_EXCL_STOP
+ }
+ std::string f_csourcepath = CPersistence::GetStoragePath();
+ if (f_csourcepath.length() > 0) { // LCOV_EXCL_BR_LINE 6: f_csourcepath.length() is always bigger then 0
+ f_csourcepath.append(RELEASETEMP_DIR); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (CFSDirectory::DoesDirecotryExist(f_csourcepath)) {
+ f_csourcepath.append(RELEASETEMP_FILENAME);
+ if (0 != remove(f_csourcepath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Temporary file not deleted::%s, errno:%d", f_csourcepath.c_str(), errno);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceRegister
+/// Registers a tag for the file/folder. This tag will be used for releasing or loading
+/// a file/folder.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceRegister(std::string f_cappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ BOOL bisuserpersistence) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+
+ if (f_cappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Appname & tag should not be empty."); // LCOV_EXCL_LINE 6: f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ } else {
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ // register tag
+ l_estatus = m_mPersist_Type[f_epersisttype]->Register(f_cappname, f_ctag,
+ bisuserpersistence); // f_eRegisterType, f_cUser); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ // m_mPersist_Type[f_ePersistFileType]->ListAllInMap();
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always biger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceRelease
+/// Entry for the file/folder is stored in map for persistence.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceRelease(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cusername) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+
+ if (f_cappname.empty() || f_ctag.empty() || f_cmempath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cappname, f_cmempath and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Appname & tag should not be empty."); // LCOV_EXCL_LINE 6: double check, f_cappname, f_cmempath and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ } else {
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ // release file
+ if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ l_estatus = m_mPersist_Type[f_epersisttype]->Release(f_cappname,
+ f_ctag,
+ f_cmempath,
+ enotificationpersistentservicereleasetype,
+ f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceLoad
+/// Load file/folder from persistent memory to the specified location.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceLoad(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cusername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_cappname.empty() || f_ctag.empty() || f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cretrievepath, f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Appname, tag & retrieve path should not be empty."); // LCOV_EXCL_LINE 6: double check, f_cretrievepath, f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
+ } else {
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ // load file
+ l_estatus = m_mPersist_Type[f_epersisttype]->Load(f_cappname, f_ctag, f_cretrievepath, f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// AckReceivedFromWorker
+/// Send release ack to file/folder persistence object.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, ENotificationpersistentservicePersistType f_epersisttype,
+ BOOL f_bcopystatus, ENPS_Loadtype f_eloadtype) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if ((NULL == f_csource) || (NULL == f_ctag)) { // LCOV_EXCL_BR_LINE 6: f_csource and f_ctag can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_csource or f_ctag is NULL."); // LCOV_EXCL_LINE 6: f_csource and f_ctag can't be NULL // NOLINT[whitespace/line_length]
+ } else {
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ if (NULL != m_mPersist_Type[f_epersisttype]) {
+ // Send release ack to file/folder persistence object.
+ l_estatus = m_mPersist_Type[f_epersisttype]->AckReceivedFromWorker(f_csource, f_ctag,
+ f_bcopystatus, f_eloadtype);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype);
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSaveNotificationData
+/// Save notification data in a persistent file.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceSaveNotificationData(Persistent_Notification_List_Type
+ *f_vpersistentnotificationlist) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if ((NULL == m_poDataAccesser) || (NULL == f_vpersistentnotificationlist)) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_poDataAccesser or f_vpersistentnotificationlist is NULL."); // LCOV_EXCL_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
+ } else {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_cNotificationFilePath = "";
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += NOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedPersistedStateVar,
+ eFrameworkunifiedUserData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += FACTORYNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedPersistedStateVar,
+ eFrameworkunifiedFactoryData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += FACTORYCUSTOMERNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedPersistedStateVar,
+ eFrameworkunifiedFactoryCustomerData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += DEALERNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedPersistedStateVar,
+ eFrameworkunifiedDealerData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSaveUserNotificationData
+/// Save user notification data in a persistent file.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceSaveUserNotificationData(Persistent_Notification_List_Type
+ *f_vpersistentnotificationlist) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if ((NULL == m_poDataAccesser) || (NULL == f_vpersistentnotificationlist)) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_poDataAccesser or f_vpersistentnotificationlist is NULL."); // LCOV_EXCL_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
+ } else {
+ l_estatus = m_poDataAccesser->PersistData(m_cNotificationUserMemFilepath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedPersistedStateUserVar); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceReadNotificationData
+/// Get the list of all persistent notifications from a persistent memory and store it in a map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceReadNotificationData(Persistent_Notification_List_Type
+ * &f_vpersistentnotificationlist) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_poDataAccesser) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser would not be null
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ std::string l_cNotificationFilePath = "";
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += NOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedUserData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += FACTORYNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedFactoryData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += FACTORYCUSTOMERNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedFactoryCustomerData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+
+ l_cNotificationFilePath = m_cNotificationPersistFilepath;
+ l_cNotificationFilePath += DEALERNOTIFICATIONFILE;
+ if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedDealerData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
+ l_cNotificationFilePath.c_str(), l_estatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceReadUserNotificationData
+/// Get the list of all user persistent notifications from a persistent memory and store it in a map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceReadUserNotificationData(Persistent_Notification_List_Type
+ * &f_vpersistentnotificationlist) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_poDataAccesser) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser would not be null
+ l_estatus = m_poDataAccesser->RetrieveData(m_cNotificationUserMemFilepath,
+ f_vpersistentnotificationlist,
+ eFrameworkunifiedUserData); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// PersistAllReleaseRequests
+/// Persist all released files and folder contained in the map in persistent memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+
+ // Persist all i.e files and folders
+ while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
+ if (NULL != m_mPersist_Type[l_ePersistType]) {
+ if (eFrameworkunifiedStatusFail == m_mPersist_Type[l_ePersistType]->PersistAllReleaseRequests(f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentservicePersistAllUserRequests
+/// Persist all user files and folder contained in the map in persistent memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentservicePersistAllUserRequests() {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+
+ // Persist all i.e files and folders
+ while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
+ if (NULL != m_mPersist_Type[l_ePersistType]) {
+ l_estatus = m_mPersist_Type[l_ePersistType]->PersistAllUserRequests();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType);
+ }
+
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReadThreadHandle
+/// Pass the handle of the read thread to the object of file/folder persistence
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetReadThreadHandle(HANDLE f_hreadthread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_hreadthread != NULL) { // LCOV_EXCL_BR_LINE 6: f_hreadthread would not be null
+ // Set thread handle for object persistfile objects. i.e. for file/folder
+ for (Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
+ l_itPersist_Type != m_mPersist_Type.end();
+ ++l_itPersist_Type) {
+ if (NULL != (*l_itPersist_Type).second) { // LCOV_EXCL_BR_LINE 6: (*l_itPersist_Type).second can't be NULL
+ (*l_itPersist_Type).second->SetReadThreadHandle(f_hreadthread);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetWriteThreadHandle
+/// Pass the handle of the write thread to the object of file/folder persistence
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetWriteThreadHandle(HANDLE f_hwritethread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_hwritethread) { // LCOV_EXCL_BR_LINE 6: f_hwritethread would not be null
+ // Set thread handle for object persist objects. i.e. for file/folder
+ for (Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
+ l_itPersist_Type != m_mPersist_Type.end();
+ ++l_itPersist_Type) {
+ if (NULL != (*l_itPersist_Type).second) { // LCOV_EXCL_BR_LINE 6: (*l_itPersist_Type).second can't be NULL
+ (*l_itPersist_Type).second->SetWriteThreadHandle(f_hwritethread);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetWriteThreadHandle
+/// Pass the handle of the write thread to the object of file/folder persistence
+////////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetNorPersistenceThreadHandle(HANDLE f_hwritethread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_hwritethread) { // LCOV_EXCL_BR_LINE 6: f_hwritethread would not be null
+ m_hNSImmediatePersistenceThread = f_hwritethread;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPServiceOnCpWorkerAckCmd
+/// Handles when the CopyWorker sends an ack back for a message received .
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPServiceOnCpWorkerAckCmd(HANDLE f_happ) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ NSP_CopyAckMsg l_tack = {};
+ if (f_happ) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(f_happ, (PVOID)&l_tack, sizeof(NSP_CopyAckMsg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length] // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "CP_WRK_ACK_CMD_COMPLETE for cmd 0x%X", l_tack.m_eworkerprotocol); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Unable to get message data in NPServiceOnCpWorkerAckCmd, status : 0x%x", l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetUserPersistentPath
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetUserPersistentPath(std::string f_cusername) {
+ m_cNotificationUserMemFilepath = CPersistence::GetStoragePath();
+ m_cNotificationUserMemFilepath += AppName;
+ m_cNotificationUserMemFilepath += "/";
+ m_cNotificationUserMemFilepath += f_cusername;
+ m_cNotificationUserMemFilepath += "/";
+ m_cNotificationUserMemFilepath += m_cUserNotificationTag;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsUserPersistence
+/// Check if tag is user persistence
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CPersistenceManager::IsUserPersistence(std::string f_ctag, ENotificationpersistentservicePersistType f_epersisttype) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ BOOL l_bUserPersistence = FALSE;
+
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
+ // load file
+ l_bUserPersistence = m_mPersist_Type[f_epersisttype]->IsUserPersistence(f_ctag); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT[whitespace/line_length]
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bUserPersistence;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// HaveAllReleaseRequestsPersisted
+/// Check if all release requests processed or not
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CPersistenceManager::HaveAllReleaseRequestsPersisted() {
+ BOOL l_bRetVal = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // check if all files are persisted
+ if (FALSE == m_bAllFilePersisted) {
+ ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+
+ std::string l_cTagNotReleased = "";
+ std::string l_cTagList = ""; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ // Persist all i.e files and folders
+ while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
+ if (NULL != m_mPersist_Type[l_ePersistType]) {
+ l_cTagNotReleased.assign(""); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // if(eFrameworkunifiedStatusFail == m_mPersist_Type[l_ePersistType]->PersistAllReleaseRequests())
+ if (FALSE == m_mPersist_Type[l_ePersistType]->HaveAllReleaseRequestsPersisted(l_cTagNotReleased)) {
+ l_bRetVal = FALSE;
+ l_cTagList.append(l_cTagNotReleased);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+ }
+
+ if (0 != l_cTagList.size()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Tags not released:: %s", l_cTagList.c_str());
+ }
+ }
+
+ if (TRUE == l_bRetVal) {
+ m_bAllFilePersisted = TRUE;
+
+ // if all files are persisted set the return value to the status of immediate data persistency
+ l_bRetVal = m_bImmediatedDataPersisted;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bRetVal;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetPersistFlag
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::ResetPersistFlag() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+
+ // Persist all i.e files and folders
+ while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
+ if (NULL != m_mPersist_Type[l_ePersistType]) {
+ m_mPersist_Type[l_ePersistType]->ResetPersistFlag();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
+ }
+
+ m_bAllFilePersisted = FALSE;
+
+ m_bImmediatedDataPersisted = FALSE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceReadNorNotificationData
+/// Get the list of all user persistent notifications from a persistent memory and store it in a map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceReadNorNotificationData(Persistent_Notification_List_Type
+ * &f_vpersistentnotificationlist) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedUserData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate User data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedFactoryData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate Factory data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedFactoryCustomerData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate Factory Customer data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedDealerData)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate Dealer data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ClearPersistenceData
+/// Deletes the data from the persistent memory.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::ClearPersistenceData(const EFrameworkunifiedClearPersistence &f_enotificationpersistentserviceclearpersistencescope) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ // persistence memory path to be cleared
+ std::string l_cPath = "";
+
+ switch (f_enotificationpersistentserviceclearpersistencescope) { // LCOV_EXCL_BR_LINE 6: f_enotificationpersistentserviceclearpersistencescope must be eFrameworkunifiedClearAllData, eFrameworkunifiedClearAllApplicationData, eFrameworkunifiedClearAllNotificationData, eFrameworkunifiedClearCurrentUserData, eFrameworkunifiedClearCurrentUserApplicationData, eFrameworkunifiedClearCurrentUserNotificationData. // NOLINT[whitespace/line_length]
+ case eFrameworkunifiedClearAllData: {
+ // clears all the data from the persistent memory
+ l_cPath.append(CPersistence::GetStoragePath());
+ }
+ break;
+
+ case eFrameworkunifiedClearAllApplicationData: {
+ // TODO(my_username): clears all the application folder in persistence memory
+ // don't delete the NS_NPS folder
+ }
+ break;
+
+ case eFrameworkunifiedClearAllNotificationData: {
+ // TODO(my_username): deletes the NS_NPS folder
+ }
+ break;
+
+ case eFrameworkunifiedClearCurrentUserData: {
+ // TODO(my_username): deletes the user folder from all the application folder in persisted memory
+ // as well as from the NS_NPS folder
+ }
+ break;
+
+ case eFrameworkunifiedClearCurrentUserApplicationData: {
+ // TODO(my_username): deletes the user folder from all the application folder
+ }
+ break;
+
+ case eFrameworkunifiedClearCurrentUserNotificationData: {
+ // TODO(my_username): deletes the user folder from the NS_NPS folder
+ }
+ break;
+
+ default: {
+ // LCOV_EXCL_START 6: f_enotificationpersistentserviceclearpersistencescope must be eFrameworkunifiedClearAllData, eFrameworkunifiedClearAllApplicationData, eFrameworkunifiedClearAllNotificationData, eFrameworkunifiedClearCurrentUserData, eFrameworkunifiedClearCurrentUserApplicationData, eFrameworkunifiedClearCurrentUserNotificationData. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid _EFrameworkunifiedClearPersistence Parameter:: %d", f_enotificationpersistentserviceclearpersistencescope);
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+ break;
+ }
+
+ if (0 != l_cPath.size()) {
+ if (CFSDirectory::DoesDirecotryExist(l_cPath)) {
+ if (TRUE == CFSDirectory::RemoveDirectory(l_cPath)) { // LCOV_EXCL_BR_LINE 6: RemoveDirectory always return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete persistent directory successful : %s", l_cPath.c_str());
+ } else {
+ // LCOV_EXCL_START 6: RemoveDirectory always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete persistent directory unsuccessful : %s", l_cPath.c_str());
+ l_estatus = eFrameworkunifiedStatusErrOther;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusErrOther;
+ }
+
+ // delete NOR data
+ l_cPath.clear();
+ l_cPath.append(IMMEDIATE_PERSISTENCE_STORAGE_V2);
+ if (0 != l_cPath.size()) { // LCOV_EXCL_BR_LINE 6: l_cPath.size can't be 0
+ if (CFSDirectory::DoesDirecotryExist(l_cPath)) {
+ if (TRUE == CFSDirectory::RemoveDirectory(l_cPath)) { // LCOV_EXCL_BR_LINE 6: RemoveDirectory always return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete nor persistent directory successful : %s", l_cPath.c_str());
+ } else {
+ // LCOV_EXCL_START 6: RemoveDirectory always return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete nor persistent directory unsuccessful : %s", l_cPath.c_str());
+ l_estatus = eFrameworkunifiedStatusErrOther;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusErrOther; // LCOV_EXCL_LINE 6: l_cPath.size can't be 0
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSetPersistentCategory
+/// Sets the persist type of file or folder.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceSetPersistentCategory(std::string f_crequestorname,
+ std::string f_ctag,
+ EFrameworkunifiedPersistCategory f_epersistcategory,
+ ENotificationpersistentservicePersistType f_epersisttype) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ if (f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_ctag.size can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Tag name is empty."); // LCOV_EXCL_LINE 6: double check, f_ctag.size can't be empty
+ } else {
+ // check boundary conditions
+ if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
+ // set the persist type
+ l_estatus = m_mPersist_Type[f_epersisttype]->SetPersistentCategory(f_crequestorname,
+ f_ctag,
+ f_epersistcategory);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// PersistNORData
+/// Sends the message to Immediate Persistence Thread to Persists the data immediately or reset
+/// the NOR data depending on persist category flag during shutdown irrespective of delay.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::PersistNORData(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ TImmediateShutdown l_tImmShutdown = {};
+ l_tImmShutdown.f_eshutdowntype = f_eshutdowntype;
+ l_tImmShutdown.f_uinotificationpersistentservicepersistcategoryflag = f_uinotificationpersistentservicepersistcategoryflag;
+
+ // send the message to NOR to persist or reset the data during shutdown
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_ONSHUTDOWN, sizeof(l_tImmShutdown), &l_tImmShutdown))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for cmd 0x%X failed", NOR_PERSISTENCE_ONSHUTDOWN); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetImmediateDataPersistedStatus
+/// Set/Reset the persistence status of immediate persistence data
+///////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetImmediateDataPersistedStatus(BOOL f_bstatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_bImmediatedDataPersisted = f_bstatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetFilePersistedStatus
+/// Set/Reset the persistence status of files and folders
+///////////////////////////////////////////////////////////////////////////////////////////
+VOID CPersistenceManager::SetFilePersistedStatus(BOOL f_bstatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_bAllFilePersisted = f_bstatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ReadImmediateNotificationData
+/// Get the list of all immediate persistent notifications of f_epersistcategory from a
+/// persistent memory and store it in a map.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CPersistenceManager::ReadImmediateNotificationData(Persistent_Notification_List_Type
+ * &f_vpersistentnotificationlist,
+ const EFrameworkunifiedPersistCategory f_epersistcategory) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string l_pcPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
+ std::string l_cNotificationName = ""; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ // stores the list of invalid immediate notification files at persistent location
+ std::string l_cInvalidFileList = ""; // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ PCSTR l_pPublisherName = NULL;
+ PSTR l_pData = NULL;
+ UI_32 l_uiDataSize = 0;
+
+ NC_NorPersistentData l_ptNorPersistentData = {};
+
+ TFileList l_pTFileList;
+
+ if ('/' != l_pcPath[l_pcPath.length() - 1]) { // LCOV_EXCL_BR_LINE 6: the last char is always '/'
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_pcPath.append("/"); // LCOV_EXCL_LINE 6: the last char is always '/'
+ }
+
+ switch (f_epersistcategory) {
+ case eFrameworkunifiedFactoryData: {
+ l_pcPath.append(FACTORYDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ break;
+
+ case eFrameworkunifiedFactoryCustomerData: {
+ l_pcPath.append(FACTORYCUSTOMERDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ break;
+
+ case eFrameworkunifiedDealerData: {
+ l_pcPath.append(DEALERDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ break;
+
+ case eFrameworkunifiedUserData:
+ default: {
+ l_pcPath.append(USERDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ l_pcPath.append(ALLUSERAPPDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ break;
+ }
+
+ l_pcPath.append(IMMEDIATEDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ if (eFrameworkunifiedStatusOK == GetFileList(&l_pTFileList, l_pcPath.c_str())) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ if (!l_pTFileList.empty()) { // LCOV_EXCL_BR_LINE 200: if GetFileList() returns eFrameworkunifiedStatusOK, l_pTFileList can't be empty // NOLINT[whitespace/line_length]
+ for (UI_32 l_uiCount = 0; l_uiCount < l_pTFileList.size(); l_uiCount++) {
+ l_uiDataSize = 0;
+
+ // get the persistent notification name from vector
+ l_cNotificationName = l_pTFileList.at(l_uiCount);
+
+ if (eFrameworkunifiedStatusOK == NPSynchronousGetPersistentDataSize(l_cNotificationName.c_str(), &l_uiDataSize, // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ f_epersistcategory) && (0 != l_uiDataSize)) {
+ l_pData = new(std::nothrow) CHAR[l_uiDataSize];
+ std::memset(l_pData, 0, l_uiDataSize);
+
+ if (NULL != l_pData) { // LCOV_EXCL_BR_LINE 6: l_pData can't be null
+ l_pPublisherName = NULL;
+
+ // clear the memory
+ std::memset(&l_ptNorPersistentData, 0, sizeof(NC_NorPersistentData));
+
+ // As NS_NPP does a recursive filename read from directory it has the complete filename.
+ // So it does not require to pass the Publisher name i.e. l_pPublisherName.So it is being passed as NULL.
+ if (eFrameworkunifiedStatusOK == NPSynchronousGetPersistentData(l_pPublisherName, // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ l_cNotificationName.c_str(),
+ (PVOID)l_pData,
+ l_uiDataSize,
+ l_ptNorPersistentData,
+ f_epersistcategory)) {
+ CNotificationsToPersist *l_objCNotificationsToPersist = new(std::nothrow) CNotificationsToPersist();
+ if (NULL != l_objCNotificationsToPersist) { // LCOV_EXCL_BR_LINE 6: l_objCNotificationsToPersist can't be null // NOLINT[whitespace/line_length]
+ CPersistentData *l_objCPersistentData = new(std::nothrow) CPersistentData();
+
+ // fill the appropriate values in l_objCNotificationsToPersist
+ if (NULL != l_objCPersistentData) { // LCOV_EXCL_BR_LINE 6: l_objCPersistentData can't be null
+ l_objCPersistentData->m_pMessage = new(std::nothrow) CHAR[l_ptNorPersistentData.dataSize];
+ std::memset(l_objCPersistentData->m_pMessage, 0, l_ptNorPersistentData.dataSize);
+
+ if (NULL != l_objCPersistentData->m_pMessage) { // LCOV_EXCL_BR_LINE 6: l_objCPersistentData->m_pMessage can't be null // NOLINT[whitespace/line_length]
+ std::memcpy(l_objCPersistentData->m_pMessage, l_pData, l_ptNorPersistentData.dataSize);
+
+ l_objCNotificationsToPersist->m_uiMaxMsgLength = l_ptNorPersistentData.uiMaxSize;
+ l_objCPersistentData->m_uiMsgSize = l_ptNorPersistentData.dataSize;
+ l_objCNotificationsToPersist->m_ePersistentType = eFrameworkunifiedImmediatePersistedStateVar;
+
+ l_objCNotificationsToPersist->m_cNotificationName = l_ptNorPersistentData.notificationName;
+ l_objCNotificationsToPersist->m_cPublisherName = l_ptNorPersistentData.pPublisherName;
+ l_objCNotificationsToPersist->m_uiDelay = l_ptNorPersistentData.uiDelay;
+
+ l_objCNotificationsToPersist->m_pPersistentData = l_objCPersistentData;
+
+ l_objCNotificationsToPersist->m_ePersistCategory = f_epersistcategory;
+
+ f_vpersistentnotificationlist->push_back(l_objCNotificationsToPersist);
+ } else {
+ // LCOV_EXCL_START 6: l_objCPersistentData->m_pMessage can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Memory allocation error for notification data of size %d",
+ l_ptNorPersistentData.dataSize);
+
+ if (NULL != l_objCNotificationsToPersist) {
+ delete l_objCNotificationsToPersist;
+ l_objCNotificationsToPersist = NULL;
+ }
+
+ if (NULL != l_objCPersistentData) {
+ delete l_objCPersistentData;
+ l_objCPersistentData = NULL;
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_objCPersistentData can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Memory allocation error for CPersistentData object");
+
+ if (NULL != l_objCNotificationsToPersist) {
+ delete l_objCNotificationsToPersist;
+ l_objCNotificationsToPersist = NULL;
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Memory allocation error for CNotificationsToPersist object"); // LCOV_EXCL_LINE 6: l_objCNotificationsToPersist can't be null // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_cInvalidFileList.append(l_cNotificationName);
+ l_cInvalidFileList.append(",");
+ // LCOV_EXCL_STOP
+ }
+
+ delete[] l_pData;
+ l_pData = NULL;
+ } else {
+ // LCOV_EXCL_START 6: l_pData can't be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Persistent data received as NULL from immediate notification file :: %s",
+ l_cNotificationName.c_str());
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_cInvalidFileList.append(l_cNotificationName);
+ l_cInvalidFileList.append(",");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (0 != l_cInvalidFileList.size()) { // LCOV_EXCL_START 200: l_cInvalidFileList's size must be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Unable to get persistent data for following immediate notification files :: %s",
+ l_cInvalidFileList.c_str());
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "No Immediate persistence data available at :: %s", l_pcPath.c_str()); // LCOV_EXCL_LINE 200: if GetFileList() returns eFrameworkunifiedStatusOK, l_pTFileList can't be empty // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to get the list of files from Immediate persistent location :: %s",
+ l_pcPath.c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+EFrameworkunifiedStatus CPersistenceManager::GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ f_cpersistenceprofileinfo.append("Application Name,");
+ f_cpersistenceprofileinfo.append("Tag Name,");
+ f_cpersistenceprofileinfo.append("Type,");
+ f_cpersistenceprofileinfo.append("UserSpecific,");
+ f_cpersistenceprofileinfo.append("Released,");
+ f_cpersistenceprofileinfo.append("Persisted");
+
+ CPersistence *l_pPersistence = m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE];
+ l_pPersistence->GetPersistenceProfilingData(f_cpersistenceprofileinfo);
+
+ l_pPersistence = m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER];
+ l_pPersistence->GetPersistenceProfilingData(f_cpersistenceprofileinfo);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+#endif
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp
new file mode 100755
index 0000000..8a9127e
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CPersistentData.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include "ns_npp_persistent_data.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// CPersistentData
+/// Constructor of CPersistentData class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistentData::CPersistentData() {
+ m_pMessage = NULL;
+ m_uiMsgSize = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CPersistentData
+/// Destructor of CPersistentData class
+////////////////////////////////////////////////////////////////////////////////////////////////
+CPersistentData::~CPersistentData() {
+ if (NULL != m_pMessage) {
+ delete[](static_cast<PCHAR>(m_pMessage)); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ m_pMessage = NULL;
+ }
+}
+
+
+
+
+
+
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp
new file mode 100755
index 0000000..4371465
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp
@@ -0,0 +1,181 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CnotificationpersistentservicePersonalizationManager.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <utility>
+#include <string>
+#ifdef AGL_STUB
+#include "ns_npp_personalization_manager.h"
+#else
+#include "ns_npp_Personalization_manager.h"
+#endif
+#include "ns_npp_notificationpersistentservicelog.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CnotificationpersistentservicePersonalizationManager
+/// Constructor of CnotificationpersistentservicePersonalizationManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CnotificationpersistentservicePersonalizationManager::CnotificationpersistentservicePersonalizationManager() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_uiUserId = 0;
+
+ m_cCurrentPersonality.clear();
+
+ m_pmPersonality = new(std::nothrow) Personality_Type(); // LCOV_EXCL_BR_LINE 11: except,C++ STL
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CnotificationpersistentservicePersonalizationManager
+/// Destructor of CnotificationpersistentservicePersonalizationManager class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CnotificationpersistentservicePersonalizationManager::~CnotificationpersistentservicePersonalizationManager() { // LCOV_EXCL_START 14: Resident process, global instance not released // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pmPersonality) {
+ m_pmPersonality->clear();
+
+ delete m_pmPersonality;
+ m_pmPersonality = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceGetPersonality
+/// This function is used to get the current personality.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CnotificationpersistentservicePersonalizationManager::NotificationpersistentserviceGetPersonality(std::string &f_cpersonalityname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ f_cpersonalityname = m_cCurrentPersonality;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceSetPersonality
+/// This function is used to set the new personality.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CnotificationpersistentservicePersonalizationManager::NotificationpersistentserviceSetPersonality(const std::string f_cpersonalityname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // iterator to find personality name from map of personality
+ Personality_Type::iterator l_itPersonality;
+
+ if (!f_cpersonalityname.empty()) {
+ if (NULL != m_pmPersonality) { // LCOV_EXCL_BR_LINE 6: double check, m_pmPersonality can't be NULL
+ l_itPersonality = m_pmPersonality->find(f_cpersonalityname);
+
+ // if personality found in map
+ if (m_pmPersonality->end() != l_itPersonality) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality found in map");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality not found in map");
+
+ l_estatus = CreatePersonality(f_cpersonalityname);
+ }
+
+ m_cCurrentPersonality = f_cpersonalityname;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map object is NULL"); // LCOV_EXCL_LINE 6: m_pmPersonality can't be NULL
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreatePersonality
+/// This function is used to create new Personality.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CnotificationpersistentservicePersonalizationManager::CreatePersonality(const std::string &f_cpersonalityname) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pmPersonality) { // LCOV_EXCL_BR_LINE 6: m_pmPersonality can't be NULL
+ CNotificationpersistentservicePersonality *l_pPersonality = new(std::nothrow) CNotificationpersistentservicePersonality(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ if (NULL != l_pPersonality) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
+ l_pPersonality->m_uiUserId = ++m_uiUserId;
+ l_pPersonality->m_cUserName = f_cpersonalityname;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Inserting new personality in map"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ m_pmPersonality->insert(make_pair(f_cpersonalityname, l_pPersonality));
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map object is NULL"); // LCOV_EXCL_LINE 6: m_pmPersonality can't be NULL
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// NotificationpersistentserviceIsValidPersonality
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CnotificationpersistentservicePersonalizationManager::NotificationpersistentserviceIsValidPersonality(const std::string f_cpersonalityname) {
+ BOOL l_bReturnValue = FALSE;
+ // iterator to find personality name from map of personality
+ Personality_Type::iterator l_itPersonality;
+ if (NULL != m_pmPersonality) { // LCOV_EXCL_BR_LINE 6: m_pmPersonality can't be NULL
+ l_itPersonality = m_pmPersonality->find(f_cpersonalityname);
+
+ // if personality found in map
+ if (m_pmPersonality->end() != l_itPersonality) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality found in map");
+ l_bReturnValue = TRUE;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality not found in map");
+ }
+ } else {
+ // LCOV_EXCL_START 6: m_pmPersonality can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map object is NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ return l_bReturnValue;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp
new file mode 100755
index 0000000..dc74580
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp
@@ -0,0 +1,333 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CRegistryEntry class.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_registry_entry.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Constructor
+////////////////////////////////////////////////////////////////////////////////////////////
+CRegistryEntry::CRegistryEntry(const std::string &f_ctag, const std::string &f_crequester,
+ const std::string &f_cstoragepath,
+ const BOOL f_bisuserpersistence):
+ m_eJobState(ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE),
+ m_cTag(f_ctag),
+ m_cRequestor(f_crequester),
+ m_bIsReleased(FALSE),
+ m_bIsPersisted(FALSE),
+ m_bIsUserPersistence(f_bisuserpersistence),
+ m_eCurrentAction(LOADTYPE_NONE),
+ m_ePersistType(ENOTIFICATIONPERSISTENTSERVICEPERSISTNONE),
+ m_ePersistCategory(eFrameworkunifiedUserData) {
+ m_cBasePath.clear();
+
+ // set base path.
+ m_cBasePath += f_cstoragepath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Copy Constructor
+////////////////////////////////////////////////////////////////////////////////////////////
+CRegistryEntry::CRegistryEntry(const CRegistryEntry &in):
+ m_eJobState(ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE),
+ m_cTag(in.m_cTag),
+ m_cRequestor(in.m_cRequestor),
+ m_bIsReleased(in.m_bIsReleased),
+ m_bIsPersisted(in.m_bIsPersisted),
+ m_cPersistPath(in.m_cPersistPath),
+ m_cBasePath(in.m_cBasePath),
+ m_bIsUserPersistence(in.m_bIsUserPersistence),
+ m_eCurrentAction(in.m_eCurrentAction),
+ m_ePersistType(in.m_ePersistType),
+ m_ePersistCategory(in.m_ePersistCategory) {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// Operator overload
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+CRegistryEntry &CRegistryEntry::operator=(const CRegistryEntry &in) { // LCOV_EXCL_START 8: never be used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (this != &in) {
+ m_eJobState = in.m_eJobState;
+ m_cTag = in.m_cTag;
+ m_cRequestor = in.m_cRequestor;
+ m_bIsReleased = in.m_bIsReleased;
+ m_bIsPersisted = in.m_bIsPersisted;
+ m_cPersistPath = in.m_cPersistPath;
+ m_cBasePath = in.m_cBasePath;
+ m_bIsUserPersistence = in.m_bIsUserPersistence;
+ m_ePersistType = in.m_ePersistType;
+ }
+ return *this;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetReleasePath
+/// Set release path.
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CRegistryEntry::SetReleasePath(const std::string &f_creleasepath) {
+ m_bIsReleased = TRUE;
+ m_cReleasePath = f_creleasepath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetBeingPersisted
+/// Set the file/folder is being persisted.
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CRegistryEntry::SetBeingPersisted() {
+ if (LOADTYPE_RELEASE == m_eCurrentAction) {
+ m_bIsPersisted = TRUE;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsReleased
+/// File/folder released or not.
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CRegistryEntry::IsReleased() const {
+ return m_bIsReleased;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// HasntBeenPersisted
+/// File/Folder persisted or not
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CRegistryEntry::HasntBeenPersisted() const {
+ return !m_bIsPersisted;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsPersisted
+/// File persisted or not
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CRegistryEntry::IsPersisted() const {
+ return m_bIsPersisted;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistPath
+/// Get the persist path.
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string CRegistryEntry::GetPersistPath() const {
+ return m_cPersistPath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetReleasePath
+/// Get the release path.
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string CRegistryEntry::GetReleasePath() const {
+ return m_cReleasePath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetLoadPath
+/// Get the load path.
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string CRegistryEntry::GetLoadPath(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) const {
+ std::string l_cLoadPath = "";
+
+ if (f_epersisttype > ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST && f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be in range. // NOLINT[whitespace/line_length]
+ l_cLoadPath = m_cBasePath;
+
+ switch (m_ePersistCategory) {
+ case eFrameworkunifiedUserData: {
+ l_cLoadPath += USERDATADIR;
+
+ // Check if to persist for user
+ if (m_bIsUserPersistence) {
+ // if its a user file, user name can't be empty
+ if (!f_cusername.empty()) { // LCOV_EXCL_BR_LINE 6: f_cusername can't be empty
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Tag %s is registered for user %s", m_cTag.c_str(), f_cusername.c_str());
+ l_cLoadPath += f_cusername;
+ l_cLoadPath += "/";
+ }
+ } else {
+ l_cLoadPath += ALLUSERAPPDATADIR;
+ }
+
+ break;
+ }
+ case eFrameworkunifiedFactoryData: {
+ l_cLoadPath += FACTORYDATADIR;
+ break;
+ }
+ case eFrameworkunifiedFactoryCustomerData: {
+ l_cLoadPath += FACTORYCUSTOMERDATADIR;
+ break;
+ }
+ case eFrameworkunifiedDealerData: {
+ l_cLoadPath += DEALERDATADIR;
+ break;
+ }
+ }
+
+ l_cLoadPath += m_cRequestor;
+ l_cLoadPath += "/";
+
+ // file and folder persistency has different storage paths mapped
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == f_epersisttype) {
+ l_cLoadPath += "NSFile/";
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == f_epersisttype) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE or ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER. // NOLINT[whitespace/line_length]
+ l_cLoadPath += "NSFolder/";
+ }
+
+ l_cLoadPath += m_cTag;
+ }
+
+ return l_cLoadPath;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetRequester
+/// Get the name of requester.
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string CRegistryEntry::GetRequester() const {
+ return m_cRequestor;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetTag
+/// Get the tag.
+////////////////////////////////////////////////////////////////////////////////////////////
+std::string CRegistryEntry::GetTag() const {
+ return m_cTag;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// IsUserPersistence
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CRegistryEntry::IsUserPersistence() {
+ return m_bIsUserPersistence;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetCurrentAction
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CRegistryEntry::SetCurrentAction(ENPS_Loadtype f_ecurrentaction) {
+ m_eCurrentAction = f_ecurrentaction;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetPersistedFlag
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CRegistryEntry::ResetPersistedFlag() {
+ m_bIsPersisted = FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistProperties
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID CRegistryEntry::SetPersistProperties(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) {
+ if (f_epersisttype > ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST && f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be in range. // NOLINT[whitespace/line_length]
+ // set the persist type
+ m_ePersistType = f_epersisttype;
+
+ // set the persist file based on the persist type and username (if a user file)
+ m_cPersistPath = m_cBasePath;
+
+ switch (m_ePersistCategory) {
+ case eFrameworkunifiedUserData: {
+ m_cPersistPath += USERDATADIR;
+
+ // Check if to persist for user
+ if (m_bIsUserPersistence) {
+ // if its a user file, user name can't be empty
+ if (!f_cusername.empty()) { // LCOV_EXCL_BR_LINE 6: f_cusername can't be empty
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Tag %s is registered for user %s", m_cTag.c_str(), f_cusername.c_str());
+ m_cPersistPath += f_cusername;
+ m_cPersistPath += "/";
+ }
+ } else {
+ m_cPersistPath += ALLUSERAPPDATADIR;
+ }
+
+ break;
+ }
+ case eFrameworkunifiedFactoryData: {
+ m_cPersistPath += FACTORYDATADIR;
+ break;
+ }
+ case eFrameworkunifiedFactoryCustomerData: {
+ m_cPersistPath += FACTORYCUSTOMERDATADIR;
+ break;
+ }
+ case eFrameworkunifiedDealerData: {
+ m_cPersistPath += DEALERDATADIR;
+ break;
+ }
+ }
+
+ m_cPersistPath += m_cRequestor;
+ m_cPersistPath += "/";
+
+ // file and folder persistency has different storage paths mapped
+ if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == f_epersisttype) {
+ m_cPersistPath += "NSFile/";
+ } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == f_epersisttype) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE or ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER. // NOLINT[whitespace/line_length]
+ m_cPersistPath += "NSFolder/";
+ }
+
+ m_cPersistPath += m_cTag;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistType
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+ENotificationpersistentservicePersistType CRegistryEntry::GetPersistType() const {
+ return m_ePersistType;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistentCategory
+/// Sets the persistent type related to tag
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CRegistryEntry::SetPersistentCategory(EFrameworkunifiedPersistCategory f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+
+ m_ePersistCategory = f_epersistcategory;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistentCategory
+/// Gets the persistent type of a tag
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedPersistCategory CRegistryEntry::GetPersistentCategory() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_ePersistCategory;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp
new file mode 100755
index 0000000..6d75091
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp
@@ -0,0 +1,158 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CRegularNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <mqueue.h>
+#include <iostream>
+#include <string>
+#include <native_service/ns_mc_system_info.h>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_regular_notification.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CRegularNotification
+/// Constructor of CRegularNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CRegularNotification::CRegularNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize):
+ CNotification(f_cnotificationname, f_uimaxmsgsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistentType = eFrameworkunifiedNotificationVar;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CRegularNotification
+/// Destructor of CRegularNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CRegularNotification::~CRegularNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddEventReciever
+/// This function adds the name of the application to receiver list of particular notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CRegularNotification::AddEventReciever(const std::string &f_csubscribername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_csubscribername can't be empty
+ l_estatus = AddReceiverInMap(f_csubscribername);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_csubscribername can't be empty
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Publish
+/// This function publishes the notification to subscribed clients.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CRegularNotification::Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Message Queue Handle
+ HANDLE l_hMsgQHandle = NULL;
+
+ // Pointer to class CNotificationReceiver
+ CNotificationReceiver *l_pNotificationReceiver = NULL;
+
+ // Iterator for Notification Receiver map
+ NotifReceiver_Iterator_Type l_itrNotifReceiver;
+
+ if (m_uiMaxMsgSize >= f_uimsgsize) {
+ if (0 == m_cServiceName.compare(f_cservicename)) {
+ for (l_itrNotifReceiver = m_pmSubscribersList->begin();
+ l_itrNotifReceiver != m_pmSubscribersList->end();
+ l_itrNotifReceiver++) {
+ l_pNotificationReceiver = l_itrNotifReceiver->second;
+
+ if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: l_pNotificationReceiver can't be NULL
+ l_hMsgQHandle = l_pNotificationReceiver->m_MsgQHandle;
+
+ if (NULL != l_hMsgQHandle) { // LCOV_EXCL_BR_LINE 6: l_hMsgQHandle can't be NULL
+ if (eFrameworkunifiedStatusOK != (l_estatus = PublishData(l_hMsgQHandle, f_pmessage, f_uimsgsize))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error Publishing notification %s to %s published by %s, error status: 0x%x",
+ m_cNotificationName.c_str(), l_itrNotifReceiver->first.c_str(), f_cservicename.c_str(), l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_hMsgQHandle can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: l_pNotificationReceiver can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationReceiver is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't publish notification %s. Registered by %s and published by %s.",
+ m_cNotificationName.c_str(), m_cServiceName.c_str(), f_cservicename.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h"
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't publish notification %s. Message data size (%d) is greater than maximum registered data size (%d)",
+ m_cNotificationName.c_str(), f_uimsgsize, m_uiMaxMsgSize);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp
new file mode 100755
index 0000000..7898f38
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp
@@ -0,0 +1,305 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CStateNorPersistenceNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <errno.h>
+#include <native_service/ns_message_center_if.h>
+#include <string>
+#include <iostream>
+
+#include "ns_npp_types.h"
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_state_nor_persistence_notification.h"
+
+HANDLE CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread = NULL;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CStateNorPersistenceNotification
+/// Constructor of CStateNorPersistenceNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStateNorPersistenceNotification::CStateNorPersistenceNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize,
+ const UI_32 f_uidelay,
+ const EFrameworkunifiedPersistCategory f_epersistcategory):
+ CStateNotification(f_cnotificationname, f_uimaxmsgsize),
+ m_uiDelay(f_uidelay),
+ m_ePersistCategory(f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistentType = eFrameworkunifiedImmediatePersistedStateVar;
+
+ // also, register the notification with worker thread responsible for writing notification data
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
+ TImmediatePersistenceRegisterNotifInfo l_tRegisterNotifInfo = {};
+ std::strncpy(l_tRegisterNotifInfo.m_cnotificationname,
+ f_cnotificationname.c_str(),
+ sizeof(l_tRegisterNotifInfo.m_cnotificationname) - 1);
+ l_tRegisterNotifInfo.m_uidelay = f_uidelay;
+ l_tRegisterNotifInfo.m_epersistcategory = f_epersistcategory;
+
+ if (eFrameworkunifiedStatusOK != McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_REGISTER, sizeof(l_tRegisterNotifInfo), &l_tRegisterNotifInfo)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for cmd 0x%X failed", NOR_PERSISTENCE_REGISTER); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CStateNorPersistenceNotification
+/// Constructor of CStateNorPersistenceNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStateNorPersistenceNotification::~CStateNorPersistenceNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // also, unregister the notification with worker thread responsible for writing notification data
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
+ TImmediatePersistenceUnregisterNotifInfo l_tUnregisterNotifInfo = {};
+ std::strncpy(l_tUnregisterNotifInfo.m_cnotificationname,
+ GetNotificationName().c_str(), // LCOV_EXCL_BR_LINE 11: except,C++ STL
+ sizeof(l_tUnregisterNotifInfo.m_cnotificationname) - 1);
+
+ if (eFrameworkunifiedStatusOK != McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_UNREGISTER, sizeof(l_tUnregisterNotifInfo), &l_tUnregisterNotifInfo)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for cmd 0x%X failed", NOR_PERSISTENCE_UNREGISTER); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistenceDelay
+/// Method to get the persistence time delay.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+UI_32 CStateNorPersistenceNotification::GetPersistenceDelay() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_uiDelay;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Publish
+/// This function publishes the notification to subscribed clients and saves the data
+/// immediately to persistent memory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNorPersistenceNotification::Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK == (l_estatus = PublishNotification(f_cservicename,
+ f_pmessage,
+ f_uimsgsize))) {
+ if (eFrameworkunifiedStatusOK != (l_estatus = SaveDataToNor(f_pmessage, f_uimsgsize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in saving persistent data on nor for %s published by %s, status: %d",
+ m_cNotificationName.c_str(), f_cservicename.c_str(), l_estatus); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// PublishNotification
+/// This function publishes the notification to subscribed clients.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNorPersistenceNotification::PublishNotification(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_estatus = CStateNotification::Publish(f_cservicename, f_pmessage, f_uimsgsize);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SaveDataToNor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNorPersistenceNotification::SaveDataToNor(PVOID f_pmessage, const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_pmessage && f_uimsgsize > 0) {
+ TNorPersistenceNotifInfoHeader l_tNorPersistentData = {};
+ UI_32 l_ui32SendDataTotalLength = static_cast<UI_32>(sizeof(TNorPersistenceNotifInfoHeader) + f_uimsgsize);
+ UI_8 *l_ui8SendData = new(std::nothrow) UI_8[l_ui32SendDataTotalLength];
+ UI_8 *l_ui8TmpOffset = l_ui8SendData;
+
+ if (NULL != l_ui8SendData) { // LCOV_EXCL_BR_LINE 6: l_ui8SendData can't be NULL
+ std::strncpy(l_tNorPersistentData.m_cnotificationname,
+ this->GetNotificationName().c_str(),
+ sizeof(l_tNorPersistentData.m_cnotificationname) - 1);
+ std::strncpy(l_tNorPersistentData.m_cpublishername,
+ this->GetPublisherName().c_str(),
+ sizeof(l_tNorPersistentData.m_cpublishername) - 1);
+ l_tNorPersistentData.m_epersistenttype = this->GetNotificationType();
+ l_tNorPersistentData.m_uimaxmsglength = this->GetMaxMessageSize();
+ l_tNorPersistentData.m_uidelay = this->GetPersistenceDelay();
+ l_tNorPersistentData.m_uimsgsize = f_uimsgsize;
+ l_tNorPersistentData.m_epersistcategory = m_ePersistCategory;
+
+ std::memset(l_ui8SendData, 0, l_ui32SendDataTotalLength);
+ std::memcpy(l_ui8SendData, &l_tNorPersistentData, sizeof(l_tNorPersistentData));
+ l_ui8TmpOffset += sizeof(l_tNorPersistentData);
+ std::memcpy(l_ui8TmpOffset, f_pmessage, f_uimsgsize);
+
+ // issue a copy to the worker thread
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_TIMER_START, l_ui32SendDataTotalLength, l_ui8SendData))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for nor worker thread failed %d ", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ }
+ } else {
+ // LCOV_EXCL_START 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Sender handle of nor worker thread is NULL. Can't send message.");
+ // LCOV_EXCL_STOP
+ }
+
+ delete[] l_ui8SendData; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ l_ui8SendData = NULL;
+ } else {
+ // LCOV_EXCL_START 6: l_ui8SendData can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification data is NULL, size is %d", f_uimsgsize); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistentCategory
+/// Gets the persist type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedPersistCategory CStateNorPersistenceNotification::GetPersistentCategory() { // LCOV_EXCL_START 100: never be used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_ePersistCategory;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistentCategory
+/// Sets the persist type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNorPersistenceNotification::SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_epersistcategory != m_ePersistCategory) {
+ if (NULL != m_pData && NULL != m_pData->m_pMessage) { // LCOV_EXCL_BR_LINE 6: if m_pData is not null, the m_pData->m_pMessage can not be null // NOLINT[whitespace/line_length]
+ if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
+ TImmediatePersistenceChangeCategory l_tChangeCategory = {};
+ UI_32 l_ui32SendDataTotalLength =
+ static_cast<UI_32>(sizeof(TImmediatePersistenceChangeCategory) + m_pData->m_uiMsgSize);
+ UI_8 *l_ui8SendData = new(std::nothrow) UI_8[l_ui32SendDataTotalLength];
+ UI_8 *l_ui8TmpOffset = l_ui8SendData;
+
+ if (NULL != l_ui8SendData) { // LCOV_EXCL_BR_LINE 6: l_ui8SendData can't be NULL
+ std::strncpy(l_tChangeCategory.m_tnornotifInfoheader.m_cnotificationname, this->GetNotificationName().c_str(),
+ sizeof(l_tChangeCategory.m_tnornotifInfoheader.m_cnotificationname) - 1);
+ std::strncpy(l_tChangeCategory.m_tnornotifInfoheader.m_cpublishername, this->GetPublisherName().c_str(),
+ sizeof(l_tChangeCategory.m_tnornotifInfoheader.m_cpublishername) - 1);
+ l_tChangeCategory.m_tnornotifInfoheader.m_epersistenttype = this->GetNotificationType();
+ l_tChangeCategory.m_tnornotifInfoheader.m_uimaxmsglength = this->GetMaxMessageSize();
+ l_tChangeCategory.m_tnornotifInfoheader.m_uidelay = this->GetPersistenceDelay();
+ l_tChangeCategory.m_tnornotifInfoheader.m_uimsgsize = m_pData->m_uiMsgSize;
+ l_tChangeCategory.m_tnornotifInfoheader.m_epersistcategory = f_epersistcategory;
+
+ l_tChangeCategory.m_eoldpersistcategory = m_ePersistCategory;
+
+ std::memset(l_ui8SendData, 0, l_ui32SendDataTotalLength);
+ std::memcpy(l_ui8SendData, &l_tChangeCategory, sizeof(l_tChangeCategory));
+ l_ui8TmpOffset += sizeof(l_tChangeCategory);
+ std::memcpy(l_ui8TmpOffset, m_pData->m_pMessage, m_pData->m_uiMsgSize);
+
+ // issue a copy to the worker thread
+ if (eFrameworkunifiedStatusOK != (l_estatus = McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ AppName,
+ NOR_PERSISTENCE_CHANGE_CATEGORY,
+ l_ui32SendDataTotalLength,
+ l_ui8SendData))) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "McSend failed while changing category for notfn %s from %d to %d, status=%d",
+ m_cNotificationName.c_str(), m_ePersistCategory, f_epersistcategory, l_estatus);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__,
+ "Msg sent to immediate pers. thread to change persist category of %s from %d to %d",
+ m_cNotificationName.c_str(), m_ePersistCategory, f_epersistcategory);
+ }
+
+ delete[] l_ui8SendData;
+ l_ui8SendData = NULL;
+ } else {
+ // LCOV_EXCL_START 6: l_ui8SendData can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory alloc error for l_ui8SendData, errno=%d", errno);
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Sender handle of nor worker thread is NULL. Can't send message.");
+ l_estatus = eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+ } else { // no data is persisted in emmc for this notfn, so no need to send msg to worker thread
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notfn %s has no data to persist", m_cNotificationName.c_str());
+ }
+
+ m_ePersistCategory = f_epersistcategory;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp
new file mode 100755
index 0000000..ff8f054
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp
@@ -0,0 +1,402 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CStateNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <iostream>
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_persistent_data.h"
+#include "ns_npp_state_notification.h"
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CStateNotification
+/// Constructor of CStateNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStateNotification::CStateNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize):
+ CNotification(f_cnotificationname, f_uimaxmsgsize),
+ m_pData(NULL),
+ m_pDefaultData(NULL),
+ m_bWasPublished(FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistentType = eFrameworkunifiedStateVar;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CStateNotification
+/// Destructor of CStateNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStateNotification::~CStateNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != m_pData) {
+ delete m_pData; // LCOV_EXCL_BR_LINE 11: unexpected branch
+ m_pData = NULL;
+ }
+
+ if (NULL != m_pDefaultData) {
+ delete m_pDefaultData;
+ m_pDefaultData = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistentData
+/// This function is used to get the persistent data pointer
+////////////////////////////////////////////////////////////////////////////////////////////////////
+const CPersistentData *CStateNotification::GetPersistentData() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return m_pData;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistentData
+/// This function is used to set the data related to notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::SetPersistentData(PVOID f_pmessage,
+ const UI_32 f_msgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL == m_pData) {
+ m_pData = new(std::nothrow) CPersistentData(); // LCOV_EXCL_BR_LINE 11: unexpected branch
+ }
+
+ l_estatus = SetData(m_pData, f_pmessage, f_msgsize);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetDefaultPersistentData
+/// This function get the default data(if any) related to notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+const CPersistentData *CStateNotification::GetDefaultPersistentData() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return m_pDefaultData;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetDefaultPersistentData
+/// This function is used to set the default data related to notification
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::SetDefaultPersistentData(PVOID f_pmessage,
+ const UI_32 f_msgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL == m_pDefaultData) {
+ m_pDefaultData = new(std::nothrow) CPersistentData(); // LCOV_EXCL_BR_LINE 11: except,C++ STL
+ }
+
+ // set the default persistent data
+ if (eFrameworkunifiedStatusOK == (l_estatus = SetData(m_pDefaultData, f_pmessage, f_msgsize))) {
+ if (NULL == m_pData) {
+ // set the default data as persistent data if notification is not yet published
+ l_estatus = SetPersistentData(f_pmessage, f_msgsize);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Setting Persistent data");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistent data already set");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error setting default persistent data for notification:: %s",
+ m_cNotificationName.c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetData
+/// This function is used to set the persistent data
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::SetData(CPersistentData *f_pdata,
+ PVOID f_pmessage,
+ const UI_32 f_msgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL != f_pdata) { // LCOV_EXCL_BR_LINE 6: double check, f_pdata can't be NULL
+ if (m_uiMaxMsgSize >= f_msgsize) {
+ f_pdata->m_uiMsgSize = f_msgsize;
+
+ if (NULL != f_pmessage && 0 != f_msgsize) {
+ if (NULL == f_pdata->m_pMessage) {
+ f_pdata->m_pMessage = new(std::nothrow) CHAR[m_uiMaxMsgSize];
+ }
+
+ if (NULL != f_pdata->m_pMessage) { // LCOV_EXCL_BR_LINE 5: new error case
+ std::memset(f_pdata->m_pMessage, 0, m_uiMaxMsgSize);
+ std::memcpy(f_pdata->m_pMessage, f_pmessage, f_msgsize);
+ } else {
+ // LCOV_EXCL_START 5: new error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error, unable to set persistent data for notification: %s",
+ m_cNotificationName.c_str());
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ if (NULL != f_pdata->m_pMessage) {
+ delete[](static_cast<PCHAR>(f_pdata->m_pMessage));
+ f_pdata->m_pMessage = NULL;
+ }
+ }
+
+ m_bWasPublished = TRUE;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't set notification data. Message data size (%d) is greater than maximum registered data size (%d)"
+ " of notification (%s).", f_msgsize, m_uiMaxMsgSize, GetNotificationName().c_str());
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, f_pdata can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to set persistent data for notification: %s, persistent object is NULL",
+ m_cNotificationName.c_str());
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// AddEventReciever
+/// This function adds the name of the application to receiver list of particular notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::AddEventReciever(const std::string &f_csubscribername) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Message Queue Handle
+ HANDLE l_hMsgQHandle = NULL;
+
+ // iterator of CNotificationReceiver map
+ NotifReceiver_Iterator_Type l_iterator;
+
+ CNotificationReceiver *l_pNotificationReceiver = NULL;
+
+ if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_csubscribername can't be empty
+ l_estatus = AddReceiverInMap(f_csubscribername);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: double check, f_csubscribername can't be empty
+ }
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: double check, l_estatus must be eFrameworkunifiedStatusOK
+ if (m_bWasPublished) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Republish Notification to subscriber :: %s", f_csubscribername.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+
+ if (NULL != m_pData) {
+ l_iterator = m_pmSubscribersList->find(f_csubscribername);
+
+ if (m_pmSubscribersList->end() != l_iterator) {
+ l_pNotificationReceiver = (*l_iterator).second;
+
+ if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: double check, l_pNotificationReceiver can't be NULL // NOLINT[whitespace/line_length]
+ l_hMsgQHandle = l_pNotificationReceiver->m_MsgQHandle;
+
+ if (NULL != l_hMsgQHandle) { // LCOV_EXCL_BR_LINE 6: double check, l_hMsgQHandle can't be NULL
+ if (eFrameworkunifiedStatusOK != (l_estatus = PublishData(l_pNotificationReceiver->m_MsgQHandle, m_pData->m_pMessage, m_pData->m_uiMsgSize))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error Publishing notification %s to %s published by %s, error status: 0x%x",
+ m_cNotificationName.c_str(), l_iterator->first.c_str(), m_cServiceName.c_str(), l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_hMsgQHandle can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pNotificationReceiver can't be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationReceiver is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_pData pointer is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Subscribing Notfn, src=%s name=%s. Notification not published.",
+ f_csubscribername.c_str(), m_cNotificationName.c_str());
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_estatus must be eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_estatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Receiver Not Added in map");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Publish
+/// This function publishes the notification to subscribed clients.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Message Queue Handle
+ HANDLE l_hMsgQHandle = NULL;
+
+ // Pointer to class CNotificationReceiver
+ CNotificationReceiver *l_pNotificationReceiver = NULL;
+
+ // Iterator for Notification Receiver map
+ NotifReceiver_Iterator_Type l_itrNotifReceiver;
+
+ if (m_uiMaxMsgSize >= f_uimsgsize) {
+ if (0 == m_cServiceName.compare(f_cservicename)) {
+ l_estatus = SetPersistentData(f_pmessage,
+ f_uimsgsize);
+
+ if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is always eFrameworkunifiedStatusOK
+ for (l_itrNotifReceiver = m_pmSubscribersList->begin();
+ l_itrNotifReceiver != m_pmSubscribersList->end();
+ l_itrNotifReceiver++) {
+ l_pNotificationReceiver = l_itrNotifReceiver->second;
+
+ if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6:double check, l_pNotificationReceiver can not be null // NOLINT[whitespace/line_length]
+ l_hMsgQHandle = l_pNotificationReceiver->m_MsgQHandle;
+
+ if (NULL != l_hMsgQHandle && NULL != m_pData) { // LCOV_EXCL_BR_LINE 6:double check, l_hMsgQHandle and m_pData can not be null // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != (l_estatus = PublishData(l_hMsgQHandle, m_pData->m_pMessage, f_uimsgsize))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error Publishing notification %s to %s published by %s, error status: 0x%x",
+ m_cNotificationName.c_str(),
+ l_itrNotifReceiver->first.c_str(),
+ f_cservicename.c_str(), l_estatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_hMsgQHandle and m_pData can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: double check, l_pNotificationReceiver can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationReceiver is NULL");
+ l_estatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistent Data Not Set"); // LCOV_EXCL_LINE 6: double check, l_estatus is always eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't publish notification %s. Registered by %s and published by %s.",
+ GetNotificationName().c_str(), m_cServiceName.c_str(), f_cservicename.c_str());
+ l_estatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Can't publish notification %s. Message data size (%d) is greater than maximum registered data size (%d)",
+ GetNotificationName().c_str(), f_uimsgsize, m_uiMaxMsgSize);
+ l_estatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsPublished
+/// This functions returns the published status of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CStateNotification::IsPublished() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ return m_bWasPublished;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// ResetMaxMessageSize
+/// This function reset the max size of data that can be published with notification.
+/// Also deletes the old persistent data and default data.
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStateNotification::ResetMaxMessageSize(const UI_32 f_uilength) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CNotification::ResetMaxMessageSize(f_uilength);
+
+ // delete the old data as the size is changed the data may become invalid
+ if (NULL != m_pData) {
+ delete m_pData;
+ m_pData = NULL;
+ }
+
+ if (NULL != m_pDefaultData) {
+ delete m_pDefaultData;
+ m_pDefaultData = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp
new file mode 100755
index 0000000..1bb9dd1
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp
@@ -0,0 +1,87 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CStatePersistenceNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <iostream>
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_state_persistence_notification.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CStatePersistenceNotification
+/// Constructor of CStatePersistenceNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStatePersistenceNotification::CStatePersistenceNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize,
+ const EFrameworkunifiedPersistCategory f_epersistcategory):
+ CStateNotification(f_cnotificationname, f_uimaxmsgsize),
+ m_ePersistCategory(f_epersistcategory) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistentType = eFrameworkunifiedPersistedStateVar;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CStatePersistenceNotification
+/// Constructor of CStatePersistenceNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStatePersistenceNotification::~CStatePersistenceNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// GetPersistentCategory
+/// Gets the persist type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedPersistCategory CStatePersistenceNotification::GetPersistentCategory() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return m_ePersistCategory;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersistentCategory
+/// Sets the persist type of notification.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CStatePersistenceNotification::SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory) {
+ EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistCategory = f_epersistcategory;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_estatus;
+}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp
new file mode 100755
index 0000000..222ada3
--- /dev/null
+++ b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp
@@ -0,0 +1,61 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains implementation of class CStatePersistenceUserNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <iostream>
+#include <string>
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_state_persistence_user_notification.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CStatePersistenceUserNotification
+/// Constructor of CStatePersistenceUserNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStatePersistenceUserNotification::CStatePersistenceUserNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize):
+ CStateNotification(f_cnotificationname, f_uimaxmsgsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_ePersistentType = eFrameworkunifiedPersistedStateUserVar;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// ~CStatePersistenceUserNotification
+/// Destructor of CStatePersistenceUserNotification class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CStatePersistenceUserNotification::~CStatePersistenceUserNotification() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
diff --git a/video_in_hal/nv_hal/LICENSE b/video_in_hal/nv_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/nv_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/nv_hal/Makefile b/video_in_hal/nv_hal/Makefile
new file mode 100755
index 0000000..2f2d89f
--- /dev/null
+++ b/video_in_hal/nv_hal/Makefile
@@ -0,0 +1,65 @@
+#
+# @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libnv_hal.so
+
+HEADER := hal_api/nv_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := nv_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/video_in_hal/nv_hal/hal_api/nv_hal.h b/video_in_hal/nv_hal/hal_api/nv_hal.h
new file mode 100755
index 0000000..2014754
--- /dev/null
+++ b/video_in_hal/nv_hal/hal_api/nv_hal.h
@@ -0,0 +1,245 @@
+/*
+ * @copyright Copyright(c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_NV_HAL_H_
+#define HAL_API_NV_HAL_H_
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * @file nv_hal.h
+ * @brief This file provides API for accessing storage device.
+ */
+
+/** @addtogroup backup_manager
+ * @{
+ */
+/** @addtogroup nv_hal
+ * @ingroup backup_manager
+ * @{
+ */
+
+/**
+ * \~english NvHalMedia
+ */
+enum NvHalMedia {
+ /**
+ * \~english CacheDram
+ */
+ NVHALMEDIA_CACHEDRAM = 0,
+ /**
+ * \~english BackupDram
+ */
+ NVHALMEDIA_BACKUPDRAM,
+ /**
+ * \~english nand
+ */
+ NVHALMEDIA_NAND,
+ /**
+ * \~english Max
+ */
+ NVHALMEDIA_MAX
+};
+
+/**\ingroup InitNv
+ * \~english @par Brief
+ * Initialize Nv hal library.
+ * \~english @retval eFrameworkunifiedStatusOK : succsess initialize.
+ * \~english @retval eFrameworkunifiedStatusFail : fail initialize
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Initialization processing failure.[eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Perform Nv_hal library initialization.
+ * - This process also performs deletion of temporary files accompanying system reset\n
+ * during write processing.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * - None
+ */
+EFrameworkunifiedStatus InitNv(void);
+
+/**\ingroup GetSizeNv
+ * \~english @par Brief
+ * This API get data size which is stored in storage device.
+ * \~english @param [in] media
+ * enum NvHalMedia - Media type
+ * \~english @param [in] filename
+ * const char* - file name(Concatenated[category name/item name])
+ * \~english @param [out] size
+ * uint32_t - Data size
+ * \~english @par
+ * - Get decrypted data size as encryption data when item name in the argument of filename (file name) is added Prefix "ENC_".
+ * - Non encryption data : D_BK_CA_GID_D/D_BK_ID_GID_D
+ * - Encryption data : D_BK_CA_GID_D/ENC_D_BK_ID_GID_D
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusFileLoadError File not exists
+ * \~english @retval eFrameworkunifiedStatusInvldParam Parameter error
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter media is less than NVHALMEDIA_CACHEDRAM or greater than\n
+ * NVHALMEDIA_NAND. [eFrameworkunifiedStatusInvldParam]
+ * - Parameter id is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Value of parameter size is 0. [eFrameworkunifiedStatusInvldParam]
+ * - Internal IO error(lstat).[eFrameworkunifiedStatusFileLoadError]
+ * \~english @par Detail
+ * - This API get the data size according to specified media and ID.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see WriteNv ReadNv
+ */
+EFrameworkunifiedStatus GetSizeNv(enum NvHalMedia media, const char *filename, uint32_t* size);
+
+
+
+/**\ingroup ReadNv
+ * \~english @par Brief
+ * Read data from storage device.
+ * \~english @param [in] media
+ * enum NvHalMedia - Media type
+ * \~english @param [in] filename
+ * const char* - file name(Concatenated[category name/item name])
+ * \~english @param [out] buffer
+ * uint8_t* - Buffer for storing read data
+ * \~english @param [in] size
+ * uint32_t - Data size
+ * \~english @par
+ * - Decrypt and read data as encryption data when item name in the argument of filename (file name) is added Prefix "ENC_".
+ * - Non encryption data : D_BK_CA_GID_D/D_BK_ID_GID_D
+ * - Encryption data : D_BK_CA_GID_D/ENC_D_BK_ID_GID_D
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Parameter error
+ * \~english @retval eFrameworkunifiedStatusFail Read data failed
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter media is less than NVHALMEDIA_CACHEDRAM or greater than\n
+ * NVHALMEDIA_NAND. [eFrameworkunifiedStatusInvldParam]
+ * - Parameter id is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Parameter buffer is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Value of parameter size is 0. [eFrameworkunifiedStatusInvldParam]
+ * - Internal IO error(open, pread, lstat, close).[eFrameworkunifiedStatusFail]
+ * - The value of parameter size is not equal to the file size specified by id.
+ * [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - This API reads data according to specified media and ID.
+ * - ID is managed by backup_manager.For details, refer to "Details about XML file" in external specification of backup_manager.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see CheckNv WriteNv
+ */
+EFrameworkunifiedStatus ReadNv(enum NvHalMedia media, const char *filename, uint8_t *buffer, uint32_t size);
+
+/**\ingroup WriteNv
+ * \~english @par Brief
+ * Write data to storage device.
+ * \~english @param [in] media
+ * enum NvHalMedia - Media type
+ * \~english @param [in] filename
+ * const char* - filename(Concatenated[category name/item name])
+ * \~english @param [in] buffer
+ * uint8_t* - Buffer for storing written data
+ * \~english @param [in] size
+ * uint32_t - Data size
+ * \~english @par
+ * - Encrypt and write data as encryption data when item name in the argument of filename (file name) is added Prefix "ENC_".
+ * - Non encryption data : D_BK_CA_GID_D/D_BK_ID_GID_D
+ * - Encryption data : D_BK_CA_GID_D/ENC_D_BK_ID_GID_D
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Parameter error
+ * \~english @retval eFrameworkunifiedStatusFail Write data failed
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter media is less than NVHALMEDIA_CACHEDRAM or greater than\n
+ * NVHALMEDIA_NAND. [eFrameworkunifiedStatusInvldParam]
+ * - Parameter id is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Parameter buffer is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Value of parameter size is 0. [eFrameworkunifiedStatusInvldParam]
+ * - Internal IO error(open, pwrite, close, mkdir).[eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - This API writes data according to specified media and ID.
+ * - filename is managed by backup_manager.For details, refer to "Details about XML file" in external specification of backup_manager.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see CheckNv ReadNv
+ */
+EFrameworkunifiedStatus WriteNv(enum NvHalMedia media, const char *filename, uint8_t *buffer, uint32_t size);
+
+/**\ingroup DeleteNv
+ * \~english @par Brief
+ * Delete data which is stored in storage device.
+ * \~english @param [in] media
+ * enum \ref NvHalMedia - Media type
+ * \~english @param [in] filename
+ * const char* - filename(Concatenated[category name/item name])
+ * \~english @par
+ * - Delete data as encryption data when item name in the argument of filename (file name) is added Prefix "ENC_".
+ * - Non encryption data : D_BK_CA_GID_D/D_BK_ID_GID_D
+ * - Encryption data : D_BK_CA_GID_D/ENC_D_BK_ID_GID_D
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Parameter error
+ * \~english @retval eFrameworkunifiedStatusFail Delete data failed
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter media is less than \ref NVHALMEDIA_CACHEDRAM or greater than\n
+ * \ref NVHALMEDIA_NAND . [eFrameworkunifiedStatusInvldParam]
+ * - Parameter filename (filename) is NULL. [eFrameworkunifiedStatusInvldParam]
+ * - Internal IO error.[eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - This API delete data according to specified media and filename.
+ * - This API delete encryption key if data is encrypted.
+ * - filename is managed by backup_manager.For details, refer to "Details about XML file" in external specification of backup_manager.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see GetSizeNv ReadNv WriteNv
+ */
+EFrameworkunifiedStatus DeleteNv(enum NvHalMedia media, const char *filename);
+
+/** @}*/ // end of nv_hal
+/** @}*/ // end of backup_manager
+
+#endif // HAL_API_NV_HAL_H_
diff --git a/video_in_hal/nv_hal/inc/nv_hal_nvhallog.h b/video_in_hal/nv_hal/inc/nv_hal_nvhallog.h
new file mode 100755
index 0000000..d62bd88
--- /dev/null
+++ b/video_in_hal/nv_hal/inc/nv_hal_nvhallog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_NV_HAL_NVHALLOG_H_
+#define INC_NV_HAL_NVHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_NV_HAL_NVHALLOG_H_
diff --git a/video_in_hal/nv_hal/src/nv_hal.cpp b/video_in_hal/nv_hal/src/nv_hal.cpp
new file mode 100755
index 0000000..d746ea0
--- /dev/null
+++ b/video_in_hal/nv_hal/src/nv_hal.cpp
@@ -0,0 +1,242 @@
+/*
+ * @copyright Copyright(c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "nv_hal.h"
+#include <errno.h>
+#include <fcntl.h>
+#include <aglpath.h>
+#include <sys/syscall.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "nv_hal_nvhallog.h"
+
+/**
+ * Media type difine.
+ */
+const char *kMediaType[NVHALMEDIA_MAX] = {
+ "/tmp/bkup/",
+ "/ramd/BS/ns/backup_manager/rwdata/",
+ "/nv/BS/ns/backup_manager/rwdata/",
+};
+
+const int kMaxPath = 127; // Max length of path
+
+/**
+ * Initialize Nv hal
+ */
+EFrameworkunifiedStatus InitNv(void) {
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Get data size.
+ */
+EFrameworkunifiedStatus GetSizeNv(enum NvHalMedia media, const char *filename, uint32_t *size) {
+ if ((media < NVHALMEDIA_CACHEDRAM) || (media > NVHALMEDIA_NAND)) { // Argument range checking
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid media type:%d\n", media);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == filename) { // NULL checking of arguments
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "filename is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == size) { // NULL checking of arguments
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "size is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ char path[kMaxPath];
+ memset(path, '\0', kMaxPath);
+ snprintf(path, kMaxPath, "%s%s", kMediaType[media], filename);
+ // Geting the file size
+ struct stat file_stat;
+ if (0 > lstat(path, &file_stat)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lstat() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFileLoadError;
+ }
+ *size = file_stat.st_size;
+ return eFrameworkunifiedStatusOK;
+}
+
+
+
+/**
+ * Reading data from memory device.
+ */
+EFrameworkunifiedStatus ReadNv(enum NvHalMedia media, const char *filename, uint8_t *buffer, uint32_t size) {
+ if ((media < NVHALMEDIA_CACHEDRAM) || (media > NVHALMEDIA_NAND)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid media type:%d\n", media);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == filename) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "filename is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == buffer) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "buffer is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid size:%d\n", size);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ char path[kMaxPath];
+ memset(path, '\0', kMaxPath);
+ snprintf(path, kMaxPath, "%s%s", kMediaType[media], filename);
+ struct stat file_stat;
+ if (0 > lstat(path, &file_stat)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lstat() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ if (file_stat.st_size != size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "size error:%ld != %d\n", file_stat.st_size, size);
+ return eFrameworkunifiedStatusFail;
+ }
+ int fd = open(path, O_RDONLY);
+ if (-1 == fd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) error, errno=%d\n", path, errno);
+ return eFrameworkunifiedStatusFail;
+ } else {
+ size_t tot_read;
+ // Read data by support EINTR
+ for (tot_read = 0; tot_read < static_cast<size_t>(size);) {
+ ssize_t read_size = pread(fd, &buffer[tot_read], static_cast<size_t>(size) - tot_read, tot_read);
+ if (-1 == read_size) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pread() error, errno=%d\n", errno);
+ if (0 != close(fd)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "close() error, errno=%d\n", errno);
+ }
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ tot_read += read_size;
+ }
+ if (0 != close(fd)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "close() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Writing data to memory device.
+ */
+EFrameworkunifiedStatus WriteNv(enum NvHalMedia media, const char *filename, uint8_t *buffer, uint32_t size) {
+ if ((media < NVHALMEDIA_CACHEDRAM) || (media > NVHALMEDIA_NAND)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid media type:%d\n", media);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == filename) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "filename is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == buffer) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "buffer is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid size:%d\n", size);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ char path[kMaxPath];
+ memset(path, '\0', kMaxPath);
+ snprintf(path, kMaxPath, "%s%s", kMediaType[media], filename);
+ struct stat file_stat;
+ // Check file exists or not, mkdir first if file no exists.
+ if (0 > lstat(path, &file_stat)) {
+ char *dir_point = path;
+ char dir_buff[kMaxPath];
+ dir_point++;
+ while ((dir_point = strchr(dir_point, '/'))) {
+ memset(dir_buff, '\0', kMaxPath);
+ memcpy(dir_buff, path, dir_point - path);
+ if (0 > mkdir(dir_buff, 0770)) {
+ if (EEXIST != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "mkdir() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ } else {
+ dir_point++;
+ continue;
+ }
+ }
+ dir_point++;
+ }
+ }
+ int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0660);
+ if (-1 == fd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) error, errno=%d\n", path, errno);
+ return eFrameworkunifiedStatusFail;
+ } else {
+ size_t tot_written;
+ // Write data by support EINTR
+ for (tot_written = 0; tot_written < static_cast<size_t>(size);) {
+ ssize_t write_size = pwrite(fd, &buffer[tot_written], static_cast<size_t>(size) - tot_written, tot_written);
+ if (0 >= write_size) {
+ if (-1 == write_size && errno == EINTR) {
+ continue;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pwrite() error, errno=%d\n", errno);
+ if (0 != close(fd)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "close() error, errno=%d\n", errno);
+ }
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ tot_written += write_size;
+ }
+ if (0 != close(fd)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "close() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Delete data.
+ */
+EFrameworkunifiedStatus DeleteNv(enum NvHalMedia media, const char *filename) {
+ if ((media < NVHALMEDIA_CACHEDRAM) || (media > NVHALMEDIA_NAND)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "invalid media type:%d\n", media);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == filename) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "filename is NULL.\n");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ char path[kMaxPath];
+ memset(path, '\0', kMaxPath);
+ snprintf(path, kMaxPath, "%s%s", kMediaType[media], filename);
+ struct stat file_stat;
+
+ if (0 > lstat(path, &file_stat)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lstat() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (0 != unlink(path)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "unlink() error, errno=%d\n", errno);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/otherservice/event_library/LICENSE b/video_in_hal/otherservice/event_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/otherservice/event_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/otherservice/event_library/Makefile.client b/video_in_hal/otherservice/event_library/Makefile.client
new file mode 100755
index 0000000..f00b09d
--- /dev/null
+++ b/video_in_hal/otherservice/event_library/Makefile.client
@@ -0,0 +1,18 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+SUBDIRS := library
+
+include ../other_service.mk
diff --git a/video_in_hal/otherservice/event_library/library/Makefile b/video_in_hal/otherservice/event_library/library/Makefile
new file mode 100755
index 0000000..3127439
--- /dev/null
+++ b/video_in_hal/otherservice/event_library/library/Makefile
@@ -0,0 +1,37 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+INST_SHLIBS = libev
+libev_SRCS := src/ev_lib.c
+VPATH = ./src ./include/$(COMPONENT_NAME)/
+INST_HEADERS = ev_lib.h event_library.h
+
+CPPFLAGS = -I./include
+
+FDLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wpointer-to-int-cast
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS := -lpthread
+
+include ../../other_service.mk
diff --git a/video_in_hal/otherservice/event_library/library/include/other_service/ev_lib.h b/video_in_hal/otherservice/event_library/library/include/other_service/ev_lib.h
new file mode 100755
index 0000000..6b87ea2
--- /dev/null
+++ b/video_in_hal/otherservice/event_library/library/include/other_service/ev_lib.h
@@ -0,0 +1,1856 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ev_lib.h
+ * @brief \~english Event library -- API define head file
+ */
+
+#ifndef OTHERSERVICE_EV_LIB_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_EV_LIB_H_ // NOLINT(build/header_guard)
+
+#include <agl_types_obsoluted.h>
+#include <agldd/ev_common.h>
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup event_library
+ * @ingroup other_service
+ * @{
+ */
+
+#ifndef __KERNEL__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Create/Delete flag and message queue */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag
+/// \~english @par Brief
+/// Create flag for event flag by the flag_id.
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID of the flag event
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist Duplication Error
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id: The ID is not created by function of EV_moduleID_to_flagID().
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - flag_id registered in launch thread
+/// - Flag corresponding to flag_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Creates flag with ID specified by the argument.
+/// An error occurs if flag of the specified ID already exists.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_create_flag, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag(EV_ID flag_id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag64
+/// \~english @par Brief
+/// Create flag for event flag by the flag_id.
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID of the flag event
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist Duplication Error
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id: The ID is not created by function of EV_moduleID_to_flag64ID ().
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - flag_id registered in launch thread
+/// - Flag corresponding to flag_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Creates flag with ID specified by the argument.
+/// An error occurs if flag of the specified ID already exists.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_create_flag, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag64(EV_ID flag_id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_queue
+/// \~english @par Brief
+/// Create message queue with the queue_id.
+/// \~english @param [in] queue_id
+/// EV_ID - queue_id of message event
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [in] length
+/// UINT8 - length of message queue (Maximum accumulated number of the messages)
+/// \~english @param [in] max_bytes
+/// UINT16 - the maximum number of bytes per 1 message(MAX 2048)
+/// \~english @param [in] type
+/// EV_Message_Queue_Type - classification of the processing when the queue received more event
+/// - in the queue full state.
+/// \~english @par
+/// EV_Message_Queue_Type
+/// \~english @code
+/// typedef UINT8 EV_Message_Queue_Type;
+/// - EV_MESSAGE_QUEUE_TYPE_BUSY = 0 // Return error(EV_ERR_Busy) to origin of message transmission
+/// - EV_MESSAGE_QUEUE_TYPE_FIFO = 1 // Delete the top message of the queue, and shift message
+/// // (Delete the oldest message)
+/// - EV_MESSAGE_QUEUE_TYPE_REPLACE = 2 // Overwrite the last message of the queue
+/// // (Overwrite the newest message)
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist Duplication Error
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id is not created by function of EV_moduleID_to_queueID ().
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - queue_id registered in launch thread
+/// - Message queue corresponding to queue_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Message queue pool is NULL
+/// - Message queue generation corresponding to queue_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Creates message queue with ID specified by the argument.
+/// When queue is created, a memory area corresponding to "length" x "max_bytes" is dynamically secured.
+/// An error occurs if queue of the specified ID already exists.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_create_message_queue, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_queue(EV_ID queue_id, // NOLINT (readability/nolint)
+ UINT8 length, // NOLINT (readability/nolint)
+ UINT16 max_bytes, // NOLINT (readability/nolint)
+ EV_Message_Queue_Type type); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag_auto_id
+/// \~english @par Brief
+/// Automatically assign flag ID, and creates flag with flag ID.
+/// \~english @param [out] flag_id
+/// EV_ID* - flag_id assigned automatically
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Automatically assign flag ID, and creates flag with flag ID.
+/// It is the same as "EV_create_flag" except that flag ID is automatically allocated.
+/// \~english @see EV_create_flag, evk_open, evk_close, evk_ioctl, evk_create_flag, evk_alloc_flag_id, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag_auto_id(/* OUT */EV_ID *flag_id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag64_auto_id
+/// \~english @par Brief
+/// Automatically assign flag ID, and creates flag with flag ID.
+/// \~english @param [out] flag_id
+/// EV_ID* - flag_id assigned automatically
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Automatically assign flag ID, and creates flag with flag ID.
+/// It is the same as "EV_create_flag" except that flag ID is automatically allocated.
+/// \~english @see EV_create_flag, evk_open, evk_close, evk_ioctl, evk_create_flag, evk_alloc_flag_id, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag64_auto_id(/* OUT */EV_ID *flag_id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_queue_auto_id
+/// \~english @par Brief
+/// Automatically assign queue ID, and creates message queue with queue ID.
+/// It stores queue_id assigned automatically in argument.
+/// \~english @param [out] queue_id
+/// EV_ID* - queue_id assigned automatically
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [in] length
+/// UINT8 - length of message queue (Maximum accumulated number of the messages)
+/// \~english @param [in] max_bytes
+/// UINT16 - the maximum number of bytes per 1 message(MAX 2048)
+/// \~english @param [in] type
+/// EV_Message_Queue_Type - classification of the processing when the queue received more event
+/// in the queue full state.
+/// \~english @par
+/// EV_Message_Queue_Type
+/// \~english @code
+/// typedef UINT8 EV_Message_Queue_Type;
+/// - EV_MESSAGE_QUEUE_TYPE_BUSY = 0 // Return error(EV_ERR_Busy) to origin of message transmission
+/// - EV_MESSAGE_QUEUE_TYPE_FIFO = 1 // Delete the top message of the queue, and shift message
+/// // (Delete the oldest message)
+/// - EV_MESSAGE_QUEUE_TYPE_REPLACE = 2 // Overwrite the last message of the queue
+/// // (Overwrite the newest message)
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Thread is unregistered and threads started up to the maximum of event thread(16 threads)
+/// - EV_ERR_Thread_Over
+/// - Message queue corresponding to queue_id already exists
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Message queue pool is NULL
+/// - Message queue generation corresponding to queue_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Automatically assign queue id, and creates message queue with queue id, It stores queue_id
+/// assigned automatically in argument.
+/// It is the same as "EV_queue_flag" except that queue ID is automatically allocated.
+/// \~english @see EV_create_queue, evk_open, evk_close, evk_ioctl, evk_create_message_queue,
+/// evk_alloc_queueID, evk_set_poll
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_queue_auto_id(/* OUT */EV_ID *queue_id, // NOLINT (readability/nolint)
+ UINT8 length, // NOLINT (readability/nolint)
+ UINT16 max_bytes, // NOLINT (readability/nolint)
+ EV_Message_Queue_Type type); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_destroy_flag
+/// \~english @par Brief
+/// Deletes flag with ID specified by the argument.
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID of the flag event
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Flag corresponding to queue_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Deletes flag with ID specified by the argument.
+/// The user can only delete flag created by user process.
+/// Due to deletion, program waiting for this flag (poll or wait) wakes up.
+/// \~english @see evk_close, evk_ioctl, evk_destroy_queue
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_destroy_flag(EV_ID queue_id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_destroy_queue
+/// \~english @par Brief
+/// Delete queue for message event by the queue_id.
+/// \~english @param [in] queue_id
+/// EV_ID - queue_id of the message event
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Message queue corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Deletes message queue with ID specified by the argument.
+/// The user can only delete message queue created by user process.
+/// Due to deletion, program waiting for this message queue (poll or wait) wakes up.
+/// \~english @see EV_destroy_flag, evk_close, evk_ioctl, evk_destroy_queue
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_destroy_queue(EV_ID queue_id); // NOLINT (readability/nolint)
+
+/* Send event */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_set_flag
+/// \~english @par Brief
+/// Set Event flag
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID of the event flag
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [in] bits
+/// UINT32 - event flag bit pattern
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - Flag corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sets bit pattern specified by argument to flag of ID specified by argument.
+/// When setting a plurality of bit patterns in the same flag, "only OR
+/// operation result of all bit patterns" is held in flag.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_store_flag
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_set_flag(EV_ID flag_id, UINT32 bits); // NOLINT (readability/nolint)
+
+/* Send event */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_set_flag64
+/// \~english @par Brief
+/// Set Event flag
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID of the event flag
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [in] bits
+/// UINT32 - event flag bit pattern
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - Flag corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sets bit pattern specified by argument to flag of ID specified by argument.
+/// When setting a plurality of bit patterns in the same flag, "only OR operation
+/// result of all bit patterns" is held in flag.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_store_flag
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_set_flag64(EV_ID flag_id, UINT64 bits); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_send_message
+/// \~english @par Brief
+/// Send Message event
+/// \~english @param [in] queue_id
+/// EV_ID - Queue ID of the message destination
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [in] bytes
+/// UINT16 - The bytes of the send message
+/// \~english @param [in] message
+/// const void * - Pointer to a transmitting byte line
+/// \~english @param [in] senderInfo
+/// UINT32 - Message Source(It is specified when it is used for application identification.
+/// When do not use it, appoint 0.)
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Busy Queue overflow
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Message queue corresponding to queue_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Queue overflow in kernel space
+/// - EV_ERR_Busy
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Invalid queue types
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sends message specified by argument to message queue of ID specified by argument.
+/// An error occurs when message queue of the specified ID doesn't exist or
+/// message size exceeds the specified size.
+/// When message queue is FULL, the processing differs depending on the type of message queue specified
+/// at the time of creation message queue.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_store_message
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_send_message(EV_ID queue_id, // NOLINT (readability/nolint)
+ UINT16 bytes, // NOLINT (readability/nolint)
+ const void *message, // NOLINT (readability/nolint)
+ UINT32 senderInfo); // NOLINT (readability/nolint)
+
+/* \~english Get events in the order of arrivals */
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_next_event
+/* \~english get events by reaching time */
+/// \~english @par Brief get the first reached event(non-block)
+/// \~english @param [out] ev
+/// event Structure
+/// \~english @par
+/// EV_Event struct
+/// @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_Type;
+/// typedef UINT32 EV_ID;
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// enum ev_message_queue_type {
+/// EV_MESSAGE_QUEUE_TYPE_BUSY,
+/// EV_MESSAGE_QUEUE_TYPE_FIFO,
+/// EV_MESSAGE_QUEUE_TYPE_REPLACE,
+/// };
+///
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT32 bits;
+/// } EV_Flag;
+///
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT64 bits;
+/// } EV_Flag64;
+///
+/// typedef struct {
+/// EV_ID queueID;
+/// UINT32 senderInfo;
+/// UINT32 length;
+/// UINT32 dummy;
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH];
+/// } EV_Message;
+///
+/// typedef struct {
+/// EV_Type type; // please reference ev_message_queue_type.
+/// union {
+/// EV_Flag flag;
+/// EV_Flag64 flag64;
+/// EV_Message message;
+/// } u;
+/// } EV_Event;
+///
+/// @endcode
+
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_Thread: unregistered thread
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - unregistered thread
+/// - EV_ERR_Invalid_Thread
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Get the first reached event which occurred for
+/// flags or message queues created in current process.
+/// If there is no event, set ev->type to EV_EVENT_None, then return immediately.
+/// The event is flag or message is decided by
+/// the ev->type is EV_EVENT_Flag or EV_EVENT_Message.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_next_event(/* OUT */EV_Event *ev); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_peek_next_event
+/// \~english @par Brief get the first reached event(non-destructive)
+/// \~english @param [out] ev
+/// event Structure
+/// @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_Type;
+/// typedef UINT32 EV_ID;
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// enum ev_message_queue_type {
+/// EV_MESSAGE_QUEUE_TYPE_BUSY,
+/// EV_MESSAGE_QUEUE_TYPE_FIFO,
+/// EV_MESSAGE_QUEUE_TYPE_REPLACE,
+/// };
+///
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT32 bits;
+/// } EV_Flag;
+///
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT64 bits;
+/// } EV_Flag64;
+///
+/// typedef struct {
+/// EV_ID queueID;
+/// UINT32 senderInfo;
+/// UINT32 length;
+/// UINT32 dummy;
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH];
+/// } EV_Message;
+///
+/// typedef struct {
+/// EV_Type type; // please reference ev_message_queue_type.
+/// union {
+/// EV_Flag flag;
+/// EV_Flag64 flag64;
+/// EV_Message message;
+/// } u;
+/// } EV_Event;
+///
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_Thread: unregistered thread
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - unregistered thread
+/// - EV_ERR_Invalid_Thread
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Get the first reached event which occurred for
+/// flags or message queues created in current process non-destructively.
+/// If the event is not getted from other processes, then call the function of
+/// EV_get_next_event() or EV_peek_next_event(), it will return a same event.
+/// If there is no event, set ev->type to EV_EVENT_None, then return immediately.
+/// The event is flag or message is decided by
+/// ev->type is EV_EVENT_Flag or EV_EVENT_Message.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_peek_next_event(/* OUT */EV_Event *ev); // NOLINT (readability/nolint)
+
+/* Get eventflag (ID specified) */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_flag
+/// \~english @par Brief
+/// Get event flag(non-block)
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] flag
+/// EV_Flag * - event flag structure
+/// \~english @par
+/// EV_Flag structure
+/// \~english @code
+/// typedef struct {
+/// EV_ID flagID; // Flag ID
+/// UINT32 bits; // event flag bit pattern
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets bit pattern specified by argument to flag of ID specified by argument.
+/// The user can only get flag created by user process, and clear bit pattern of acquired flag.
+/// An error occurs if flag of the specified ID doesn't exist.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_flag(EV_ID flag_id, /* OUT */EV_Flag *flag); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_wait_flag
+/// \~english @par Brief
+/// Get event flag(block)
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] flag
+/// EV_Flag * - event flag structure
+/// \~english @par
+/// EV_Flag structure
+/// \~english @code
+/// typedef struct {
+/// EV_ID flagID; // Flag ID
+/// UINT32 bits; // event flag bit pattern
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Interrupted signal interrupt
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Task blocking was canceled by signal interrupt
+/// - EV_ERR_Interrupted
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets bit pattern specified by argument to flag of ID specified by argument.
+/// The user can only get flag created by user process, and clear bit pattern of acquired flag.
+/// An error occurs if flag of the specified ID doesn't exist.
+/// If bit pattern is not set in flag, block until bit pattern is set.
+/// However, if a signal interrupt or corresponding flag is deleted, it will abort and return an error.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_wait_flag(EV_ID flag_id, /* OUT */EV_Flag *flag); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_peek_flag
+/// \~english @par Brief get flag event(non-destructive)
+/// \~english @param [in] flag_id
+/// ID of message event queue
+/// \~english @param [out] flag
+/// flag struct
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @par
+/// EV_Flag Structure
+/// @code
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT32 bits;
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: The specified flag ID is not existing,
+/// or it is not created in current process.
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Task blocking was canceled by signal interrupt
+/// - EV_ERR_Interrupted
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Get a flag event whose ID is specified non-destructively.
+/// If there is no event, just return.
+/// If there is no event, set flag->flagID to EV_NO_ID.
+/// You can judge that there is no event, even though flag->bits is 0.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_peek_flag(EV_ID flag_id, /* OUT */EV_Flag *flag); // NOLINT (readability/nolint)
+
+/* Get eventflag (ID specified) */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_flag64
+/// \~english @par Brief
+/// Get event flag(non-block)
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] flag
+/// EV_Flag * - event flag structure
+/// \~english @par
+/// EV_Flag structure
+/// \~english @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_ID
+///
+/// typedef struct {
+/// EV_ID flagID; // Flag ID
+/// UINT32 bits; // event flag bit pattern
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets bit pattern specified by argument to flag of ID specified by argument.
+/// The user can only get flag created by user process, and clear bit pattern of acquired flag.
+/// An error occurs if flag of the specified ID doesn't exist.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_flag64(EV_ID flag_id, /* OUT */EV_Flag64 *flag); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_wait_flag64
+/// \~english @par Brief
+/// Get event flag(block)
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] flag
+/// EV_Flag * - event flag structure
+/// \~english @par
+/// EV_Flag structure
+/// \~english @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_ID
+///
+/// typedef struct {
+/// EV_ID flagID; // Flag ID
+/// UINT32 bits; // event flag bit pattern
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Interrupted signal interrupt
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Task blocking was canceled by signal interrupt
+/// - EV_ERR_Interrupted
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets bit pattern specified by argument to flag of ID specified by argument.
+/// The user can only get flag created by user process, and clear bit pattern of acquired flag.
+/// An error occurs if flag of the specified ID doesn't exist.
+/// If bit pattern is not set in flag, block until bit pattern is set.
+/// However, if a signal interrupt or corresponding flag is deleted, it will abort and return an error.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_wait_flag64(EV_ID flag_id, /* OUT */EV_Flag64 *flag); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_peek_flag64
+/// \~english @par Brief get flag event(non-destructive)
+/// \~english @param [in] flag_id
+/// ID of message event queue
+/// \~english @param [out] flag
+/// flag struct
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @par
+/// EV_Flag Structure
+/// @code
+/// typedef struct {
+/// EV_ID flagID;
+/// UINT32 bits;
+/// } EV_Flag;
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: The specified flag ID is not existing,
+/// or it is not created in current process.
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Flag corresponding to flag_id doesn't exist
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Task blocking was canceled by signal interrupt
+/// - EV_ERR_Interrupted
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Get a flag event whose ID is specified non-destructively.
+/// If there is no event, just return.
+/// If there is no event, set flag->flagID to EV_NO_ID.
+/// You can judge that there is no event, even though flag->bits is 0.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_peek_flag64(EV_ID flag_id, /* OUT */EV_Flag64 *flag); // NOLINT (readability/nolint)
+
+/* Get Message Event (ID specified) */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_message
+/// \~english @par Brief
+/// Get message event(non-block)
+/// \~english @param [in] queue_id
+/// EV_ID - Message queue ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] message
+/// EV_Message * - Message event structure
+/// \~english @par
+/// EV_Message structure
+/// \~english @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_ID
+///
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// typedef struct {
+/// EV_ID queueID; // ID of message queue
+/// UINT32 senderInfo; // Message Source
+/// UINT32 length; // length of message
+/// UINT32 dummy; // dummy for padding
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH]; // message
+/// } EV_Message;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Message queue corresponding to queue_id doesn't exist
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets 1 message specified by argument to message queue of ID specified by argument.
+/// The user can only get message queue created by user process, and clear 1 message of acquired message queue.
+/// An error occurs if message queue of the specified ID doesn't exist.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_message(EV_ID queue_id, /* OUT */EV_Message *message); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_wait_message
+/// \~english @par Brief
+/// Get message event(block)
+/// \~english @param [in] queue_id
+/// EV_ID - Message queue ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] message
+/// EV_Message * - Message event structure
+/// \~english @par
+/// EV_Message structure
+/// \~english @code
+/// typedef unsigned int UINT32;
+/// typedef UINT32 EV_ID
+///
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// typedef struct {
+/// EV_ID queueID; // ID of message queue
+/// UINT32 senderInfo; // Message Source
+/// UINT32 length; // length of message
+/// UINT32 dummy; // dummy for padding
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH]; // message
+/// } EV_Message;
+/// @endcode
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Interrupted signal interrupt
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Message queue corresponding to queue_id doesn't exist
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Task blocking was canceled by signal interrupt
+/// - EV_ERR_Interrupted
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets 1 message specified by argument to message queue of ID specified by argument.
+/// The user can only get message queue created by user process, and clear 1 message of acquired message queue.
+/// An error occurs if message queue of the specified ID doesn't exist.
+/// If message is not set in message queue, block until message is sent.
+/// However, if a signal interrupt or corresponding message queue is deleted, it will abort and return an error.
+/// \~english @see
+/// evk_ioctl, evk_get_event
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_wait_message(EV_ID queue_id, /* OUT */EV_Message *message); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_peek_message
+/// \~english @par Brief get message event(non-destructive)
+/// \~english @param [in] queue_id
+/// ID of message event queue
+/// \~english @param [out] message
+/// message event queue struct
+/// \~english @par
+/// EV_ID define
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+
+/// \~english @par
+/// EV_Message struct
+/// @code
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// typedef struct {
+/// EV_ID queueID;
+/// UINT32 senderInfo;
+/// UINT32 length;
+/// UINT32 dummy;
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH];
+/// } EV_Message;
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: The specified queue ID is not existing,
+/// or it is not created in current process.
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Message queue corresponding to queue_id doesn't exist
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Get a message event queue whose ID is specified non-destructively.
+/// If there is no event, just return.
+/// If there is no event, set message->queueID to EV_NO_ID.
+/// It is the same with EV_get_message(), except the message is remained in the queue.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_peek_message(EV_ID queue_id, /* OUT */EV_Message *message); // NOLINT (readability/nolint)
+
+/* \~english Get events(with search criteria) */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_find_message_by_sender
+/* \~english get event(with search sender infomation condition) */
+/// \~english @param [in] queue_id
+/// ID of message event queue
+/// \~english @param [in] senderInfo
+/// sender information
+/// \~english @param [out] message
+/// message event struct
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @par
+/// EV_Message struct
+/// @code
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// typedef struct {
+/// EV_ID queueID;
+/// UINT32 senderInfo;
+/// UINT32 length;
+/// UINT32 dummy;
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH];
+/// } EV_Message;
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: The specified queue ID is not existing,
+/// or it is not created in current process.
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Not find same sender information's message according to input sender information information
+/// - EV_ERR_Invalid_ID
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Message queue pool is NULL
+/// - Message queue generation corresponding to queue_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// If there is a event whose sender information is same with
+/// any event in message event queue whose ID is specified, get the event and delete it from queue.
+/// If such a message is not existing,
+/// set message->queueID to EV_NO_ID, then return.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_find_message_by_sender(EV_ID queue_id, UINT32 senderInfo, EV_Message *message); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_find_message_by_content
+/// \~english @par Brief get message event(search with contents)
+/// \~english @param [in] queue_id
+/// ID of message event queue
+/// \~english @param [in] bytes
+/// size of compare bytes
+/// \~english @param [in] compare_bytes
+/// bytes that used to campare the contents
+/// \~english @param [out] message
+/// message event struct
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @par
+/// EV_Message struct
+/// @code
+/// #define EV_MAX_MESSAGE_LENGTH 2048
+/// typedef struct {
+/// EV_ID queueID;
+/// UINT32 senderInfo;
+/// UINT32 length;
+/// UINT32 dummy;
+/// UINT8 message[EV_MAX_MESSAGE_LENGTH];
+/// } EV_Message;
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: The specified queue ID is not existing,
+/// or it is not created in current process.
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Not find contents's message according to input contents information
+/// - EV_ERR_Invalid_ID
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Message queue pool is NULL
+/// - Message queue generation corresponding to queue_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// If the event in compare bytes is same with
+/// any event in message event queue whose ID is specified,
+/// get the event and delete it from queue.
+/// If such a message is not existing, set message->queueID to EV_NO_ID, then return.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_find_message_by_content(EV_ID queue_id, // NOLINT (readability/nolint)
+ UINT16 length, // NOLINT (readability/nolint)
+ const void *compare_bytes, // NOLINT (readability/nolint)
+ /* OUT */EV_Message *message); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_flag_fd
+/// \~english @par Brief
+/// Obtain fd for polling flag event
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] fd
+/// int * - event flag queue fd for Polling
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @par Prerequisite
+/// Execute EV_create_flag(),EV_create_flag_auto_id() and flag has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - Flag corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets fd(File Descriptor) corresponding to flag of ID specified by argument.
+/// The user can only get flag created by user process .
+/// This fd(File Descriptor) can be used only for designation to poll / select, and operation when other
+/// operations are performed is not guaranteed.
+/// At the time of poll, only POLLIN can be specified, and at the time of select,
+/// it is possible to check only whether it can be read.
+/// Also, if flag is deleted in poll / select, it exits poll / select. * In case of poll, POLLERR is set.
+/// When calling the same ID more than once, it returns the same fd(File Descriptor)
+/// each time (unless destroy / create is done).
+/// \~english @see
+/// nothing
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_flag_fd(EV_ID flag_id, /* OUT */int *fd); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_get_queue_fd
+/// \~english @par Brief
+/// Obtain fd for polling message event
+/// \~english @param [in] flag_id
+/// EV_ID - Flag ID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @param [out] fd
+/// int * - Message queue fd for Polling
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error
+/// - Message queue corresponding to queue_id doesn't exist
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Gets fd(File Descriptor) corresponding to message queue of ID specified by argument.
+/// The user can only get message queue created by user process .
+/// This fd(File Descriptor) can be used only for designation to poll / select,
+/// and operation when other operations are performed is not guaranteed.
+/// At the time of poll, only POLLIN can be specified, and at the time of select,
+/// it is possible to check only whether it can be read.
+/// Also, if message queue is deleted in poll / select, it exits poll / select.
+/// * In case of poll, POLLERR is set.
+/// When calling the same ID more than once, it returns the same fd(File Descriptor)
+/// each time (unless destroy / create is done).
+/// \~english @see
+/// nothing
+////////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_get_queue_fd(EV_ID queue_id, /* OUT */int *fd); // NOLINT (readability/nolint)
+
+/* \~english Functions that specify the module ID (16 bits) instead of the flag ID and queue ID */
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_moduleID_to_flag_id
+/* \~english function group used to specify moduleID(16bit) instead of flag_id, queue_id */
+/// \~english @par Brief change from moduleID to flag_id
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @retval flag_id
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of flags with one moduleID. return error:EV_ERR_Exist.
+/// This function is only used for generating one event by one module ID.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ID EV_moduleID_to_flagID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_moduleID_to_flag64ID
+/// \~english @par Brief change from moduleID to 64bit flag_id
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval 64bit flag_id
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of flags with one moduleID. return error:EV_ERR_Exist.
+/// This function is only used for generating one event by one module ID.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ID EV_moduleID_to_flag64ID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_moduleID_to_queueID
+/// \~english @par Brief change from moduleID to queue_id
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @par
+/// EV_ID type parameter
+/// @code
+/// typedef UINT32 EV_ID
+/// @endcode
+/// \~english @retval queue_id
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - none
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of queues with one moduleID.
+// \~english @see none
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ID EV_moduleID_to_queueID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag_by_mID
+/// \~english @par Brief create flag(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist Duplication Error
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The ID is not created by function of EV_moduleID_to_flagID ().
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - flag_id registered in launch thread
+/// - Flag corresponding to flag_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of flags with one moduleID.return error:EV_ERR_Exist.
+/// This function is only used for generating one event by one module ID.
+// \~english @see EV_create_flag
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag_by_mID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_flag64_by_mID
+/// \~english @par Brief create 64bit flag(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist Duplication Error
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The ID is not created by function of EV_moduleID_to_flag64ID ().
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - flag_id registered in launch thread
+/// - Flag corresponding to flag_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Flag pool is NULL
+/// - Flag generation corresponding to flag_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of flags with one moduleID. return error:EV_ERR_Exist.
+/// This function is only used for generating one event by one module ID.
+// \~english @see EV_create_flag64
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_create_flag64_by_mID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_create_queue_by_mID
+/// \~english @par Brief create queue(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @param [in] length
+/// length of message queue
+/// \~english @param [in] max_bytes
+/// one max bytes for message
+/// \~english @param [in] type
+/// treat type of receiving events even though the queue is full
+/// \~english @par
+/// ev_message_queue_type struct
+/// @code
+/// enum ev_message_queue_type {
+/// EV_MESSAGE_QUEUE_TYPE_BUSY,
+/// EV_MESSAGE_QUEUE_TYPE_FIFO,
+/// EV_MESSAGE_QUEUE_TYPE_REPLACE,
+/// };
+/// @endcode
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: set en invalid flag ID
+/// \~english @retval EV_ERR_Thread_Over The MAX of event thread.
+/// \~english @retval EV_ERR_Exist: a same flag ID is existing
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// There is no prerequisite
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - EV_ERR_Invalid_ID
+/// - Startup thread upper limit (16) error
+/// - EV_ERR_Thread_Over
+/// - queue_id registered in launch thread
+/// - Message queue corresponding to queue_id already exists
+/// - EV_ERR_Exist
+/// - Securing free space of thread information management table (malloc) Failure
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Message queue pool is NULL
+/// - Message queue generation corresponding to queue_id failed
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of queues with one moduleID.
+// \~english @see EV_create_queue
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR
+EV_create_queue_by_mID(UINT16 m_id, // NOLINT (readability/nolint)
+ UINT8 length, // NOLINT (readability/nolint)
+ UINT16 max_bytes, // NOLINT (readability/nolint)
+ EV_Message_Queue_Type type); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_destroy_flag_by_mID
+/// \~english @par Brief delete flag(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @par length [in]length of message queue
+/// \~english @par max_bytes [in]one max bytes for message
+/// \~english @par type [in]treat type of receiving events even though the queue is full
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: set en invalid flag ID
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// - none
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The flag_id of event/message which has not been created.
+/// - Flag corresponding to queue_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// \~english You can not use this function to
+/// \~english create a multiple of flags with one moduleID. return error:EV_ERR_Exist.
+/// This function is only used for generating one event by one module ID.
+// \~english @see EV_destroy_flag
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_destroy_flag_by_mID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_destroy_queue_by_mID
+/// \~english @par Brief delete queue(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Message queue corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// You can not use this function to
+/// create a multiple of queues with one moduleID
+// \~english @see EV_destroy_queue
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_destroy_queue_by_mID(UINT16 m_id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_set_flag_by_mID
+/// \~english @par Brief send flag(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @param [in] bits
+/// value of flag
+/// \~english @retval EV_OK: normal termination
+/// \~english @retval EV_ERR_Invalid_ID: set en invalid flag ID
+/// \~english @retval EV_ERR_Fatal: Fatal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - Flag corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sets bit pattern specified by argument to flag of ID specified by argument.
+/// When setting a plurality of bit patterns in the same flag,
+/// "only OR operation result of all bit patterns" is held in flag.
+// \~english @see EV_set_flag
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_set_flag_by_mID(UINT16 m_id, UINT32 bits); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_set_flag64_by_mID
+/// \~english @par Brief send 64bit flag(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @param [in] bits
+/// value of flag
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid flag_id
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// - none
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect flag_id)
+/// --incorrect flag_id:The flag_id of event which has not been created.
+/// - Flag corresponding to flag_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sets bit pattern specified by argument to flag of ID specified by argument.
+/// When setting a plurality of bit patterns in the same flag, "only
+/// OR operation result of all bit patterns" is held in flag.
+// \~english @see EV_set_flag64
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR EV_set_flag64_by_mID(UINT16 m_id, UINT64 bits); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EV_send_message_by_mID
+/// \~english @par Brief send message(moduleID specified)
+/// \~english @param [in] m_id
+/// moduleID
+/// \~english @param [in] bytes
+/// number of send bytes
+/// \~english @param [in] message
+/// pointer to sender contents
+/// \~english @param [in] senderInfo
+/// sender information
+/// \~english @retval EV_OK Successful completion
+/// \~english @retval EV_ERR_Invalid_ID Invalid queue_id
+/// \~english @retval EV_ERR_Busy Queue overflow
+/// \~english @retval EV_ERR_Fatal Abnormal error
+/// \~english @par Prerequisite
+/// Execute EV_create_queue(),EV_create_queue_auto_id() and message queue has already been created.
+/// \~english @par Change of internal state
+/// There is no change of the internal Status
+/// \~english @par Conditions of processing failure
+/// - Input parameter error (specifying incorrect queue_id)
+/// --incorrect queue_id:The queue_id of essage which has not been created.
+/// - Message queue corresponding to queue_id doesn't exist
+/// - EV_ERR_Invalid_ID
+/// - Queue overflow in kernel space
+/// - EV_ERR_Busy
+/// - Access failed from kernel space to user space reference area
+/// - Failed to copy data from user space to kernel space
+/// - Invalid queue types
+/// - EV_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Sends message specified by argument to message moduleID specified by argument.
+/// An error occurs when message queue of the specified ID doesn't exist
+/// or message size exceeds the specified size.
+/// When message queue is FULL, the processing differs depending on the type
+/// of message queue specified at the time of creation message queue.
+/// \~english @see evk_open, evk_close, evk_ioctl, evk_store_message
+////////////////////////////////////////////////////////////////////////////////
+
+EV_ERR
+EV_send_message_by_mID(UINT16 m_id, // NOLINT (readability/nolint)
+ UINT16 bytes, // NOLINT (readability/nolint)
+ const void *message, // NOLINT (readability/nolint)
+ UINT32 senderInfo); // NOLINT (readability/nolint)
+
+/** @}*/ // end of event_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+/**
+ *
+ * @brief Method to specify module IDs as flag IDs and queue IDs
+ *
+ * The function with module ID as an argument directly can be used in the case of that created only
+ * one flag and queue in the module, other than using macros EV_Flag_ID_Base() or EV_Queue_ID_Base().
+ * @see EV_create_flag_by_mID
+ * @see EV_create_queue_by_mID
+ * @see EV_destroy_flag_by_mID
+ * @see EV_destroy_queue_by_mID
+ * @see EV_set_flag_by_mID
+ * @see EV_send_message_by_mID
+ *
+ * So the following API can be used to convert IDs created using above method to flag IDs or queue ID
+ * when pass them to other modules.
+ * @see EV_moduleID_to_flagID(UINT16 m_id)
+ * @see EV_moduleID_to_queueID(UINT16 m_id)
+ *
+ * @see EV_ID_spec
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* !__KERNEL__ */
+
+#endif // OTHERSERVICE_EV_LIB_H_
diff --git a/video_in_hal/otherservice/event_library/library/include/other_service/event_library.h b/video_in_hal/otherservice/event_library/library/include/other_service/event_library.h
new file mode 100755
index 0000000..ea6285c
--- /dev/null
+++ b/video_in_hal/otherservice/event_library/library/include/other_service/event_library.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english include all event_library head files
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup event_library
+ * @ingroup other_service
+ * @{
+ */
+#ifndef OTHERSERVICE_EVENTLIBRARY_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_EVENTLIBRARY_H_ // NOLINT(build/header_guard)
+
+#include <other_service/ev_lib.h>
+
+#endif // OTHERSERVICE_EVENTLIBRARY_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/otherservice/event_library/library/libev.ver b/video_in_hal/otherservice/event_library/library/libev.ver
new file mode 100755
index 0000000..a361455
--- /dev/null
+++ b/video_in_hal/otherservice/event_library/library/libev.ver
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+######################
+# ev version script #
+######################
+{
+ global:
+ ### .text section ###
+ EV_*;
+ ev_lock_func;
+ ev_lock_line;
+ ev_lock_pid;
+ ev_process_global_mutex;
+ g_destory_message_invalid_id_wrapper_flag;
+ g_destory_message_fatal_wrapper_flag;
+ g_receive_message_no_exist_fatal_wrapper_flag;
+ g_receive_message_fatal_wrapper_flag;
+ g_send_message_invalid_id_wrapper_flag;
+ g_send_message_fatal_wrapper_flag;
+ g_create_event_fatal_wrapper_flag;
+ g_create_event_set_poll_fatal_wrapper_flag;
+ ### .data section ###
+ ### .bss section ###
+ local:
+ *;
+};
+
diff --git a/video_in_hal/otherservice/event_library/library/src/ev_lib.c b/video_in_hal/otherservice/event_library/library/src/ev_lib.c
new file mode 100755
index 0000000..f6b784a
--- /dev/null
+++ b/video_in_hal/otherservice/event_library/library/src/ev_lib.c
@@ -0,0 +1,1551 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ev_lib.c
+ * @brief Events Library -- Implementing API Functions
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/prctl.h>
+#include <other_service/ev_lib.h>
+#include <agldd/evk_lib.h>
+#include <agldd/ev_common.h>
+#include <assert.h>
+#define EV_perror perror
+#define EV_assert assert
+
+/*
+ * Not use dbg_output in the EV so that the DTV apps and semiconductor vendor use this function.
+ */
+#define ev_log(format, arg...) \
+{ \
+ { \
+ char procname[33]; \
+ prctl(PR_GET_NAME, procname); \
+ int pid = getpid(); \
+ printf(format, procname, pid, ##arg); \
+ } \
+}
+
+#define EV_DEBUG_INFO(format, arg...) \
+{ \
+ if (getenv("EV_DEBUG") != NULL) { \
+ ev_log("[EV: info](%s:%d) " format, ##arg); \
+ } \
+}
+
+#define EV_DEBUG_WARNING(format, arg...) \
+{ \
+ ev_log("[EV: warning](%s:%d) " format, ##arg); \
+}
+
+#define EV_DEBUG_ERR(format, arg...) \
+{ \
+ ev_log("[EV: ERR](%s:%d) " format, ##arg); \
+}
+
+/** @brief Structures for managing ID and FD in use by processes
+ */
+typedef struct {
+ EV_ID id; /**< flag/queue ID */
+ INT32 fd; /**< file descriptor */
+}
+EV_Info;
+
+/*----------------------------------------*/
+/** @brief EV management information table per thread */
+/*----------------------------------------*/
+typedef struct {
+ /** Thread calling the EV library */
+ pthread_t thread;
+ /** Registration information by ID */
+ EV_Info ev_info[EV_MAX_IDS_IN_THREAD];
+ /** Number of registered IDs */
+ UINT8 num;
+}
+EV_thread_info_type;
+
+/** Thread information acquisition mode */
+#define EV_THREAD_INFO_CREATE 0
+#define EV_THREAD_INFO_PEEK 1
+#define EV_SEARCH_ALL_THREAD -1
+
+/* Related process exclusion control in the process */
+const char *g_ev_lock_func;
+int g_ev_lock_line;
+int g_ev_lock_pid;
+pthread_mutex_t g_ev_process_global_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+#define EV_PROCESS_MUTEX_LOCK \
+ pthread_mutex_lock(&g_ev_process_global_mutex); \
+ g_ev_lock_func = __FUNCTION__; \
+ g_ev_lock_line = __LINE__; \
+ g_ev_lock_pid = getpid();
+#define EV_PROCESS_MUTEX_UNLOCK \
+ pthread_mutex_unlock(&g_ev_process_global_mutex);
+
+/** @mainpage
+ * This document describes the following specifications:
+ * - Event Library (EV) API specifications
+ * - Event ID specifications
+ *
+ * In principle, the API specifications of the event library for kernel space (EVK) is
+ * the same as the event library for user space (EV) except for the function name prefixed ""EVK"".
+ * If there are differences between the EV and EVK, it is described as "difference in kernel version".
+ */
+/** @defgroup Event Library (EV) API specifications */
+/** @defgroup EV_ID_spec Event ID specifications */
+/** @defgroup EV_m_id Function specifying module ID instead of event ID */
+/** @defgroup EV_in internal specifications of the event library for user space (EV) */
+/** @defgroup EVK_in Internal specifications of the event library for kernel space (EVK) */
+/** @addtogroup EV_in
+ * @{ */
+
+/** EV thread information management table */
+EV_thread_info_type *EV_thread_info[EV_MAX_THREADS_IN_PROCESS];
+
+/*----------------------------------------------------------------------
+ * Return the registered position of the thread ID
+ * Allocate and initialize space for unregistered threads
+ * @brief Sending message (specified module-ID)
+ * @param index [OUT] Thread index
+ * @param flag [IN] Operating Mode
+ ----------------------------------------------------------------------*/
+EV_ERR
+EV_thread_id_check(int *index, int flag) {
+ int i, empty;
+
+ /* Current threadID */
+ pthread_t EV_self_thread_id;
+
+ /* Get thread ID */
+ EV_self_thread_id = pthread_self();
+
+ /* Control-process lock */
+ EV_PROCESS_MUTEX_LOCK;
+
+ /* Whether or not the thread has already been registered. */
+ for(i = 0, empty = -1; i < EV_MAX_THREADS_IN_PROCESS; i++) {
+ /* Free space */
+ if(EV_thread_info[i] == NULL) {
+ /* Set free space index */
+ empty = (empty == -1) ? i: empty;
+ continue;
+ }
+
+ if(EV_thread_info[i]->thread == EV_self_thread_id) {
+ *index = i;
+
+ /* Cancel in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+ return EV_OK;
+ }
+ }
+
+ if(flag == EV_THREAD_INFO_PEEK) {
+ EV_DEBUG_ERR("thread id is not found.\n");
+
+ /* Cancel in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+ return EV_ERR_Invalid_Thread;
+ }
+
+ /* If there are no unregistered threads and there is no space */
+ if(empty == -1) {
+ EV_DEBUG_ERR("thread id is full.\n");
+
+ /* Cancel in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+ return EV_ERR_Thread_Over;
+ }
+
+ /* Set to free space */
+ EV_thread_info[empty] = malloc(sizeof(*(EV_thread_info[empty])));
+ EV_thread_info_type *th = EV_thread_info[empty];
+
+ /* malloc failed */
+ if(th == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function malloc
+ /* Cancel in-process mutual exclusion */
+ // LCOV_EXCL_START 5: fail safe for glibc function malloc
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ EV_PROCESS_MUTEX_UNLOCK;
+ return EV_ERR_Fatal;
+ }
+ // LCOV_EXCL_STOP
+
+ /* Initialization */
+ memset(th, '\0', sizeof(*th));
+ th->thread = EV_self_thread_id;
+ /* th->num = 0; */
+
+ /* Cancel in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+
+ /* Set registration position */
+ *index = empty;
+
+ return EV_OK;
+}
+
+// free thread information when create event/message fail and no release thread buffer.
+// If no release thread buffer will cause be error:
+// Creation event's Thread count num less than MAX count(16) when one thread create event/message
+// fail and no longer to create event/message.
+static void
+free_thread_buffer(int th_index) {
+ /* in-process mutual exclusion */
+ EV_PROCESS_MUTEX_LOCK;
+ if ((th_index >= 0)
+ &&(th_index < EV_MAX_THREADS_IN_PROCESS)
+ && (NULL != EV_thread_info[th_index])
+ && (0 == EV_thread_info[th_index]->num)) {
+ free(EV_thread_info[th_index]);
+ EV_thread_info[th_index] = NULL;
+ EV_DEBUG_ERR("Free thread buffer by th_index:%d.\n", th_index);
+ }
+ /* in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+}
+
+/* EV_info update function */
+static void
+add_ev_info(int th_index, EV_ID id, int fd) {
+ /* Check storage position of ID information */
+ /* beginning of in-process mutual exclusion */
+ EV_PROCESS_MUTEX_LOCK;
+
+ int id_index = EV_thread_info[th_index]->num;
+ EV_assert(id_index < EV_MAX_IDS_IN_THREAD);
+
+ /* Set information */
+ EV_thread_info[th_index]->ev_info[id_index].id = id;
+ EV_thread_info[th_index]->ev_info[id_index].fd = fd;
+ EV_thread_info[th_index]->num++;
+
+ /* end of in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+}
+
+/* EV_info search function */
+static int
+find_ev_info(int th_index, EV_ID id) {
+ int i, j, start, end;
+ int ret = -1;
+
+ /* Search all threads */
+ if(th_index == EV_SEARCH_ALL_THREAD) {
+ start = 0;
+ end = EV_MAX_THREADS_IN_PROCESS;
+ } else {
+ start = th_index;
+ end = th_index + 1;
+ }
+
+ /* in-process mutual exclusion */
+ EV_PROCESS_MUTEX_LOCK;
+
+ for(j = start; j < end; j++) {
+ if(EV_thread_info[j] == NULL) {
+ continue;
+ }
+
+ for(i = 0; i < EV_thread_info[j]->num; i++) {
+ if(id == EV_thread_info[j]->ev_info[i].id) {
+ ret = EV_thread_info[j]->ev_info[i].fd;
+ break;
+ }
+ }
+ }
+
+ /* Cancel in-process mutual exclusion */
+ EV_PROCESS_MUTEX_UNLOCK;
+
+ return ret;
+}
+
+static int
+delete_ev_info(EV_ID id) {
+ int fd = -1;
+ int i, j;
+ int found_th_index = -1;
+ int found_idx = -1;
+ EV_thread_info_type *th = NULL;
+
+ /* beginning of in-thread mutual exclusion */
+ EV_PROCESS_MUTEX_LOCK;
+
+ for(i = 0 ; i < EV_MAX_THREADS_IN_PROCESS && found_idx == -1 ; i++) {
+ th = EV_thread_info[i];
+ if (th == NULL) {
+ continue;
+ }
+ for(j = 0 ; j < th->num ; j++) {
+ if (th->ev_info[j].id == id) {
+ fd = th->ev_info[j].fd;
+ found_th_index = i;
+ found_idx = j;
+ break;
+ }
+ }
+ }
+
+ if(found_idx == -1) {
+ EV_PROCESS_MUTEX_UNLOCK;
+ return -1;
+ }
+
+ if (found_idx < th->num - 1) { /* pgr0060 */
+ memmove(&(th->ev_info[found_idx]), &(th->ev_info[found_idx+1]),
+ sizeof(th->ev_info[0]) * (size_t)(th->num - 1 - found_idx));
+ }
+ th->num--;
+
+ /* If everything is deleted */
+ if(th->num == 0 && EV_thread_info[found_th_index] != NULL) {
+ free(EV_thread_info[found_th_index]);
+ EV_thread_info[found_th_index] = NULL;
+ }
+ EV_PROCESS_MUTEX_UNLOCK;
+ return fd;
+}
+
+/** @} */
+/** @addtogroup EV
+ * @{ */
+
+static EV_ERR
+EV_create_flag_in(int th_index, EV_ID flag_id, int is64bit) {
+ int fd;
+
+ /* Open device driver */
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ int ret = ioctl(fd, is64bit ? EVK_IOC_CREATE_FLAG64:
+ EVK_IOC_CREATE_FLAG, flag_id);
+ int myerrno = errno;
+
+ if(ret < 0) {
+ if(myerrno == EEXIST) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function ioctl
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ close(fd); // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ EV_DEBUG_ERR("flag_id %x already exists.\n", flag_id); // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ return EV_ERR_Exist; // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ } else {
+ close(fd);
+ errno = myerrno;
+ return EV_ERR_Fatal;
+ }
+ }
+
+ ret = ioctl(fd, EVK_IOC_SET_POLL, flag_id);
+ if(ret < 0) {
+ close(fd);
+ EV_DEBUG_ERR("set_poll: internal error\n");
+ return EV_ERR_Fatal;
+ }
+
+ add_ev_info(th_index, flag_id, fd);
+ return EV_OK;
+}
+
+/** @brief Create flag
+ *
+ * Create a flag with the given ID.
+ * Return error if a flag with the same flag ID already exists
+ *
+ * @param flag_id [IN]flag ID
+ * @see EV_ID
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Specified an invalid flag ID
+ * @retval EV_ERR_Exist: A flag with the same ID already exists
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_create_flag (EV_ID flag_id) {
+ EV_ERR err;
+ int th_index;
+
+ /* Flag ID check */
+ if(!EV_ID_IS_FLAG(flag_id) || EV_ID_IS_AUTO_ID(flag_id)) {
+ EV_DEBUG_ERR("create_flag: Invalid flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ return err;
+ }
+
+ EV_DEBUG_INFO("EV_create_flag (th_index=%d)\n", th_index);
+
+ /* case of already created */
+ int fd = find_ev_info(th_index, flag_id);
+ if(fd >= 0) {
+ EV_DEBUG_ERR("create_flag: You already created flag_id %x.\n", flag_id);
+ return EV_ERR_Exist;
+ }
+
+ err = EV_create_flag_in(th_index, flag_id, 0);
+ if (EV_OK != err) {
+ free_thread_buffer(th_index);
+ }
+
+ return err;
+}
+
+/** @brief Create 64-bit flag
+ *
+ * Create a 64-bit flag with the given ID.
+ * Return error if a flag with the same flag ID already exists
+ *
+ * @param flag_id [IN]64-bit flag ID
+ * @see EV_ID
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Specified an invalid 64-bit flag ID
+ * @retval EV_ERR_Exist: A 64-bit flag with same ID already exists
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_create_flag64(EV_ID flag_id) {
+ EV_ERR err;
+ int th_index;
+
+ if(!EV_ID_IS_FLAG64(flag_id) || EV_ID_IS_AUTO_ID(flag_id)) {
+ EV_DEBUG_ERR("create_flag: Invalid flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ return err;
+ }
+
+ int fd = find_ev_info(th_index, flag_id);
+ if(fd >= 0) {
+ EV_DEBUG_ERR("create_flag: You already created flag_id %x.\n", flag_id);
+ return EV_ERR_Exist;
+ }
+
+ err = EV_create_flag_in(th_index, flag_id, 1);
+ if (EV_OK != err) {
+ free_thread_buffer(th_index);
+ }
+
+ return err;
+}
+
+/** @brief Create flag (auto-assign ID)
+ *
+ * Automatically assign a flag ID and creates a flag.
+ * Same as EV_create_flag(), except that ID is automatically assigned.
+ *
+ * @param flag_id [OUT]Area for storing the assigned flag ID
+ *
+ * @see EV_create_flag
+ */
+EV_ERR
+EV_create_flag_auto_id(EV_ID *flag_id) {
+ EV_assert(flag_id != NULL);
+
+ EV_ERR err;
+ int fd, th_index;
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ int ret = ioctl(fd, EVK_IOC_ALLOC_FLAG_ID, flag_id);
+ close(fd);
+ EV_assert(ret == 0);
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ *flag_id = EV_NO_ID;
+ return err;
+ }
+
+ err = EV_create_flag_in(th_index, *flag_id, 0);
+ if (err != EV_OK) {
+ free_thread_buffer(th_index);
+
+ *flag_id = EV_NO_ID;
+ return EV_ERR_Fatal;
+ }
+ return EV_OK;
+}
+
+/** @brief Create 64-bit flag(auto-assign ID)
+ *
+ * Automatically assign a 64-bit flag ID and creates a 64-bit flag.
+ * Same as EV_create_flag64(), except that ID is automatically assigned.
+ *
+ * @param flag_id [OUT]Area for storing the assigned 64-bit flag ID
+ *
+ * @see EV_create_flag64
+ */
+EV_ERR
+EV_create_flag64_auto_id(EV_ID *flag_id) {
+ EV_assert(flag_id != NULL);
+
+ EV_ERR err;
+ int fd, th_index;
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ int ret = ioctl(fd, EVK_IOC_ALLOC_FLAG64_ID, flag_id);
+ close(fd);
+ EV_assert(ret == 0);
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ *flag_id = EV_NO_ID;
+ return err;
+ }
+
+ err = EV_create_flag_in(th_index, *flag_id, 1);
+ if (err != EV_OK) {
+ free_thread_buffer(th_index);
+
+ *flag_id = EV_NO_ID;
+ return EV_ERR_Fatal;
+ }
+ return EV_OK;
+}
+
+static EV_ERR
+EV_create_queue_in(int th_index, EV_ID queue_id, UINT8 length,
+ UINT16 max_bytes, EV_Message_Queue_Type type) {
+ int fd;
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ EVK_Message_Queue_Request req;
+ req.queueID = queue_id;
+ req.length = length;
+ req.max_bytes = max_bytes;
+ req.type = type;
+
+ int ret = ioctl(fd, EVK_IOC_CREATE_MESSAGE_QUEUE, &req);
+ int myerrno = errno;
+ if (ret < 0) {
+ if (myerrno == EEXIST) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function ioctl
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ close(fd); // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ EV_DEBUG_ERR("queue %x already exists.\n", queue_id); // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ return EV_ERR_Exist; // LCOV_EXCL_LINE 5: fail safe for glibc function ioctl
+ } else {
+ close(fd);
+ errno = myerrno;
+ //EV_perror("create queue");
+ return EV_ERR_Fatal;
+ }
+ }
+
+ ret = ioctl(fd, EVK_IOC_SET_POLL, queue_id);
+ if (ret < 0) {
+ close(fd);
+ EV_DEBUG_ERR("set_poll: internal error\n");
+ return EV_ERR_Fatal;
+ }
+
+ add_ev_info(th_index, queue_id, fd);
+ return EV_OK;
+}
+
+/** @brief message event queue creation
+ *
+ * Create a queue of message event with the specified ID.
+ * Return error if a queue with the same ID already exists.
+ *
+ * A memory area corresponding to the specified maximum number of bytes x queue length is allocated dynamically.
+ *
+ * @param queue_id [IN] Message queue ID
+ * @param length [IN] Message queue length
+ * @param max_bytes [IN] - Maximum number of bytes per message
+ * @param type [IN] Type of action to take when more events are received when the queue is full
+ * @see EV_ID
+ * @see ev_message_queue_type
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Specified an invalid flag ID
+ * @retval EV_ERR_Exist: A flag with the same ID already exists
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_create_queue(EV_ID queue_id, UINT8 length, UINT16 max_bytes,
+ EV_Message_Queue_Type type) {
+ EV_ERR err;
+ int th_index;
+
+ if(!EV_ID_IS_QUEUE(queue_id) || EV_ID_IS_AUTO_ID(queue_id)) {
+ EV_DEBUG_ERR("create_queue: Invalid queue_id %x was specified.\n",
+ queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ return err;
+ }
+
+ int fd = find_ev_info(th_index, queue_id);
+ if(fd >= 0) {
+ EV_DEBUG_ERR("create_queue: You already created queue_id %x.\n",
+ queue_id);
+ return EV_ERR_Exist;
+ }
+
+ err = EV_create_queue_in(th_index, queue_id, length, max_bytes, type);
+ if (EV_OK != err) {
+ free_thread_buffer(th_index);
+ }
+
+ return err;
+}
+
+/** @brief message event queue creation(auto-assign ID)
+ *
+ * Automatically assigns a queue ID and creates a queue for message events.
+ * Same as EV_create_queue(), except that ID is automatically assigned.
+ *
+ * @param queue_id [OUT] Area for storing the assigned flag ID
+ * @param length [IN] Message queue length
+ * @param max_bytes [IN] - Maximum number of bytes per message
+ * @param type [IN] Type of action to take when more events are received when the queue is full
+ *
+ * @see EV_create_queue
+ */
+EV_ERR
+EV_create_queue_auto_id(EV_ID *queue_id, UINT8 length, UINT16 max_bytes,
+ EV_Message_Queue_Type type) {
+ int th_index;
+
+ EV_assert(queue_id != NULL);
+ EV_ERR err;
+ int fd;
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ int ret = ioctl(fd, EVK_IOC_ALLOC_QUEUE_ID, queue_id);
+ close(fd);
+ EV_assert(ret == 0);
+
+ /* Thread information check */
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_CREATE);
+ if(err != EV_OK) {
+ *queue_id = EV_NO_ID;
+ return err;
+ }
+
+ err = EV_create_queue_in(th_index, *queue_id, length, max_bytes,
+ type);
+ if (err != EV_OK) {
+ free_thread_buffer(th_index);
+
+ *queue_id = EV_NO_ID;
+ return EV_ERR_Fatal;
+ }
+ return EV_OK;
+}
+
+/** @brief Deleting flag event
+ *
+ * Delete the flag with the specified ID.
+ * Only flags created by this process can be deleted.
+ *
+ * - differences in kernel versions
+ * EVK_destroy_flag can be used to delete any existing message event queue.
+ *
+ * @note The program wakes up that waiting for this queue (poll or wait)
+ * due to deletion.
+ *
+ * @param flag_id [IN] ID of flag
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_destroy_flag(EV_ID flag_id) {
+ int fd = delete_ev_info(flag_id);
+ if (fd < 0) {
+ EV_DEBUG_ERR("You haven't created flag/queue_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int ret = ioctl(fd, EVK_IOC_DESTROY_QUEUE, flag_id);
+ int myerrno = errno;
+ close(fd);
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_ERR("destroy: no such ID %x\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ } else {
+ errno = myerrno;
+ EV_perror("destroy");
+ return EV_ERR_Fatal;
+ }
+ }
+ return EV_OK;
+}
+
+/** @brief Delete message event queue
+ *
+ * Delete the message event queue with the specified ID.
+ * Only message event queues created by this process can be deleted.
+ *
+ * - differences in kernel versions
+ * EVK_destroy_queue can be used to delete any existing message event queue.
+ *
+ * @note The program wakes up that waiting for this queue (poll or wait)
+ * due to deletion.
+ *
+ * @param flag_id [IN] Message event queue ID
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The message queue with the specified ID does not exist,
+ * or there is no message event queue created by this process.
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_destroy_queue(EV_ID queue_id) {
+ return EV_destroy_flag(queue_id);
+}
+
+static EV_ERR
+EV_get_flag_in(EV_ID flag_id, EV_Flag *flag, int peek_only, int wait) {
+ EV_assert(flag != NULL);
+ flag->flagID = EV_NO_ID;
+ flag->bits = 0;
+
+ if (!EV_ID_IS_FLAG(flag_id)) {
+ EV_DEBUG_ERR("get_flag: %x is not a flag_id.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int fd = find_ev_info(EV_SEARCH_ALL_THREAD, flag_id);
+ if(fd < 0) {
+ EV_DEBUG_ERR("You have not created flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ EV_Event ev;
+ ev.type = EV_EVENT_Flag;
+ ev.u.flag.flagID = flag_id;
+ ev.u.flag.bits = 0;
+ int ret = ioctl(
+ fd,
+ (peek_only ? EVK_IOC_PEEK_EVENT : (wait ? EVK_IOC_WAIT_EVENT : EVK_IOC_GET_EVENT)),
+ &ev);
+
+ int myerrno = errno;
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_ERR("get_flag: No such flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+ else if (myerrno == EINTR) {
+ EV_DEBUG_ERR("get_flag: Interrupted\n");
+ return EV_ERR_Interrupted;
+ } else {
+ errno = myerrno;
+ EV_perror("get flag");
+ return EV_ERR_Fatal;
+ }
+ }
+
+ if (ev.type == EV_EVENT_Flag) {
+ flag->flagID = ev.u.flag.flagID;
+ flag->bits = ev.u.flag.bits;
+ }
+ return EV_OK;
+}
+
+static EV_ERR
+EV_get_flag64_in(EV_ID flag_id, EV_Flag64 *flag, int peek_only, int wait) {
+ EV_assert(flag != NULL);
+ flag->flagID = EV_NO_ID;
+ flag->bits = 0;
+
+ if (!EV_ID_IS_FLAG64(flag_id)) {
+ EV_DEBUG_ERR("get_flag: %x is not a flag_id.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int fd = find_ev_info(EV_SEARCH_ALL_THREAD, flag_id);
+ if (fd < 0) {
+ EV_DEBUG_ERR("You have not created flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ EV_Event ev;
+ ev.type = EV_EVENT_Flag64;
+ ev.u.flag64.flagID = flag_id;
+ ev.u.flag64.bits = 0;
+ int ret = ioctl(
+ fd,
+ (peek_only ? EVK_IOC_PEEK_EVENT : (wait ? EVK_IOC_WAIT_EVENT : EVK_IOC_GET_EVENT)),
+ &ev);
+
+ int myerrno = errno;
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_ERR("get_flag: No such flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+ else if (myerrno == EINTR) {
+ EV_DEBUG_ERR("get_flag: Interrupted\n");
+ return EV_ERR_Interrupted;
+ } else {
+ errno = myerrno;
+ EV_perror("get flag");
+ return EV_ERR_Fatal;
+ }
+ }
+
+ if (ev.type == EV_EVENT_Flag64) {
+ flag->flagID = ev.u.flag64.flagID;
+ flag->bits = ev.u.flag64.bits;
+ }
+ return EV_OK;
+}
+
+/** @brief Get flag event(non-block)
+ *
+ * Get the flag event with the specified ID, and clears the flag.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be used to determine no events.
+ * Only flags created by this process can be gotten.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] Flag Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_flag(EV_ID flag_id, EV_Flag *flag) {
+ return EV_get_flag_in(flag_id, flag, 0, 0);
+}
+
+/** @brief Get 64bit flag event(non-block)
+ *
+ * Get the 64-bit flag event with the specified ID, and clears the 64-bit flag.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be used to determine no events.
+ * Only flags created by this process can be gotten.
+ * Be sure to specify the flag ID created by specifying 64-bits.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] 64-bit flag struct
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_flag64(EV_ID flag_id, EV_Flag64 *flag) {
+ return EV_get_flag64_in(flag_id, flag, 0, 0);
+}
+
+/** @brief Get flag event(block)
+ *
+ * Get the flag event with the specified ID, and clear the flag.
+ * If there is no event, block until an event is received.
+ * However, if the interrupt is interrupted by a signal interrupt, EV_ERR_Interrupted is returned.
+ * If the flag is deleted while waiting, the wait is suspended
+ * and EV_ERR_Invalid_ID is returned.
+ * When interrupted, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be judged to have been interrupted.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] Flag Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval EV_ERR_Interrupted: Interrupted by a signal interrupt
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_wait_flag(EV_ID flag_id, EV_Flag *flag) {
+ return EV_get_flag_in(flag_id, flag, 0, 1);
+}
+
+/** @brief Get 64bit flag event(block)
+ *
+ * Get the 64-bit flag event with the specified ID, and clear the 64-bit flag.
+ * If there is no event, block until an event is received.
+ * However, if the interrupt is interrupted by a signal interrupt, EV_ERR_Interrupted is returned.
+ * If the flag is deleted while waiting, the wait is suspended
+ * and EV_ERR_Invalid_ID is returned.
+ * When interrupted, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be judged to have been interrupted.
+ * Be sure to specify the flag ID created by specifying 64 bits.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] 64-bit flag structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval EV_ERR_Interrupted: Interrupted by a signal interrupt
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_wait_flag64(EV_ID flag_id, EV_Flag64 *flag) {
+ return EV_get_flag64_in(flag_id, flag, 0, 1);
+}
+
+/** @brief Get flag event(non-destructive)
+ *
+ * Get the flag event with the specified ID non-destructively.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be used to determine no events.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] Flag Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_peek_flag(EV_ID flag_id, EV_Flag *flag) {
+ return EV_get_flag_in(flag_id, flag, 1, 0);
+}
+
+/** @brief Get 64bit flag event(non-destructive)
+ *
+ * Gets the 64-bit flag event with the specified ID non-destructively.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in flag->flagID.
+ * A flag->bits of 0 can also be used to determine no events.
+ *
+ * @param flag_id [IN] Message event queue ID
+ * @param flag [OUT] 64-bit flag structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist,
+ * Or it is not a flag created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_peek_flag64(EV_ID flag_id, EV_Flag64 *flag) {
+ return EV_get_flag64_in(flag_id, flag, 1, 0);
+}
+
+static EV_ERR
+EV_get_message_in(EV_ID queue_id, EV_Message *message, UINT32 senderInfo,
+ UINT32 length, const void *compare_bytes,
+ int peek_only, int wait) {
+ EV_assert(message != NULL);
+ message->queueID = EV_NO_ID;
+ message->senderInfo = 0;
+ message->length = 0;
+
+ if (!EV_ID_IS_QUEUE(queue_id)) {
+ EV_DEBUG_ERR("get_message: Invalid queue_id %x\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int fd = find_ev_info(EV_SEARCH_ALL_THREAD, queue_id);
+ if(fd < 0) {
+ EV_DEBUG_ERR("You have not created queue_id %x.\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ EV_Event ev;
+ ev.type = EV_EVENT_Message;
+ ev.u.message.queueID = queue_id;
+ ev.u.message.senderInfo = senderInfo;
+ if(length > 0 && compare_bytes != NULL) {
+ ev.u.message.length = length;
+ memcpy(ev.u.message.message, compare_bytes, length);
+ } else {
+ ev.u.message.length = 0;
+ }
+
+ int ret = ioctl(
+ fd,
+ (peek_only ? EVK_IOC_PEEK_EVENT : (wait ? EVK_IOC_WAIT_EVENT : EVK_IOC_GET_EVENT)),
+ &ev);
+
+ int myerrno = errno;
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_ERR("No such queue_id %x\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+ else if (myerrno == EINTR) {
+ EV_DEBUG_INFO("Interrupted.\n");
+ return EV_ERR_Interrupted;
+ } else {
+ errno = myerrno;
+ EV_perror("get message");
+ return EV_ERR_Fatal;
+ }
+ }
+
+ if(ev.type == EV_EVENT_Message) {
+ message->queueID = ev.u.message.queueID;
+ message->senderInfo = ev.u.message.senderInfo;
+ message->length = ev.u.message.length;
+ memcpy(message->message, ev.u.message.message,
+ ev.u.message.length);
+ }
+
+ return EV_OK;
+}
+
+/** @brief Get message events(non-block)
+ *
+ * Get one message event from the queue with the specified ID.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in message-> queue_id.
+ * The acquired message is deleted from the queue.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param message [OUT] Message Event Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Queue with specified ID does not exist
+ * Or not a message event queue created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_message(EV_ID queue_id, EV_Message *message) {
+ return EV_get_message_in(queue_id, message, 0, 0, NULL, 0, 0);
+}
+
+/** @brief Get message event(block)
+ *
+ * Get one message event from the queue with the specified ID.
+ * If there is no event, block until an event is received.
+ * However, if the interrupt is interrupted by a signal interrupt, EV_ERR_Interrupted is returned.
+ * If the queue is deleted while waiting, the waiting is suspended,
+ * EV_ERR_Invalid_ID is returned.
+ * When interrupted, EV_NO_ID is stored in message-> queue_id.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param message [OUT] Message Event Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Queue with specified ID does not exist
+ * Or not a message event queue created by invoking process
+ * @retval EV_ERR_Interrupted: Interrupted by a signal interrupt
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_wait_message(EV_ID queue_id, EV_Message *message) {
+ return EV_get_message_in(queue_id, message, 0, 0, NULL, 0, 1);
+}
+
+/** @brief Get message event(non-destructive)
+ *
+ * Get one message event queue of the specified ID non-destructively.
+ * Even if there is no event, it returns immediately.
+ * If there are no events, EV_NO_ID is stored in message-> queue_id.
+ * Same as EV_get_message(), except that the retrieved message remains in the queue.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param message [OUT] Message Event Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Queue with specified ID does not exist
+ * Or not a message event queue created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_peek_message(EV_ID queue_id, EV_Message *message) {
+ return EV_get_message_in(queue_id, message, 0, 0, NULL, 1, 0);
+}
+
+static EV_ERR
+EV_get_next_event_in(EV_Event *ev, int peek_only) {
+ int i, th_index;
+ EV_ERR err;
+ EVK_Next_Event_Query query;
+
+ EV_assert(ev != NULL);
+ ev->type = EV_EVENT_None;
+
+ bzero(&query, sizeof(query));
+
+ err = EV_thread_id_check(&th_index, EV_THREAD_INFO_PEEK);
+ if(err != EV_OK) {
+ return err;
+ }
+
+ EV_PROCESS_MUTEX_LOCK;
+ query.num = EV_thread_info[th_index]->num;
+ for(i = 0 ; i < query.num ; i++) {
+ query.ids[i] = EV_thread_info[th_index]->ev_info[i].id;
+ }
+ EV_PROCESS_MUTEX_UNLOCK;
+
+ if (query.num == 0) {
+ return EV_OK;
+ }
+
+ int fd;
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ int ret = ioctl(
+ fd,
+ (peek_only ? EVK_IOC_PEEK_NEXT_EVENT: EVK_IOC_GET_NEXT_EVENT),
+ &query);
+
+ int myerrno = errno;
+ close(fd);
+
+ if (ret < 0) {
+ errno = myerrno;
+ EV_perror("get_next_event");
+ return EV_ERR_Fatal;
+ }
+ memcpy(ev, &(query.ev), sizeof(*ev));
+ return EV_OK;
+}
+
+/** @brief Get the first event that arrived(non-block)
+ *
+ * Get the first arrival of a flag created by invoking process or an event
+ * that occurred in the message queue.
+ * If there are no events, EV_EVENT_None is stored in the ev->type and returned immediately.
+ *
+ * @param ev [OUT] Event Structure
+ * Whether the acquired event type is flag or message is determined
+ * by ev->type is EV_EVENT_Flag or EV_EVENT_Message.
+ *
+ * @retval EV_OK: Normal completion
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_next_event(EV_Event *ev) {
+ return EV_get_next_event_in(ev, 0);
+}
+
+/** @brief Get the first event that arrived(non-destructive)
+ *
+ * Get the first arrival of a flag created by invoking process or an event
+ * that occurred in the message queue non-destructively.
+ * The next call to EV_get_next_event() or EV_peek_next_event(),
+ * return the same event as long as no other program gets it.
+ * If there are no events, EV_EVENT_None is stored in the ev->type and returned immediately.
+ *
+ * @param ev [OUT] Event Structure
+ * Whether the acquired event flag or message is a message is determined
+ * by whether ev->type is EV_EVENT_Flag or EV_EVENT_Message.
+ *
+ * @retval EV_OK: Normal completion
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_peek_next_event(EV_Event *ev) {
+ return EV_get_next_event_in(ev, 1);
+}
+
+/** @brief Get message event(search by source info)
+ *
+ * If there is an event whose source information matches
+ * in the message event queue of the specified ID,it is gotten and deleted from the queue.
+ * If there are no such messages,
+ * EV_NO_ID is stored in message->queue_id, and the system call returns immediately.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param senderInfo [IN] Source Info
+ * @param message [OUT] Message Event Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Queue with specified ID does not exist
+ * Or not a message event queue created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_find_message_by_sender(EV_ID queue_id, UINT32 senderInfo,
+ EV_Message *message) {
+ EV_assert(message != NULL);
+ EV_assert(senderInfo != 0);
+ return EV_get_message_in(queue_id, message, senderInfo, 0, NULL, 0, 0);
+}
+
+/** @brief Get message event(search by content)
+ *
+ * If there is an event with byte sequence matching the specified bytes from the beginning
+ * in the message event queue of the specified ID,it is gotten and deleted from the queue.
+ * If there are no such messages,
+ * EV_NO_ID is stored in message->queue_id, and the system call returns immediately.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param bytes [IN] Bytes to compare
+ * @param compare_bytes [IN] Byte sequence to compare content against
+ * @param message [OUT] Message Event Structure
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Queue with specified ID does not exist
+ * Or not a message event queue created by invoking process
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_find_message_by_content(EV_ID queue_id,
+ UINT16 bytes, const void *compare_bytes,
+ EV_Message *message) {
+ EV_assert(message != NULL);
+ EV_assert(bytes <= EV_MAX_MESSAGE_LENGTH);
+ EV_assert(compare_bytes != NULL);
+
+ return EV_get_message_in(queue_id, message, 0, bytes,
+ compare_bytes, 0, 0);
+}
+
+/** @brief Set flag event
+ *
+ * Set the flag with the specified ID.
+ *
+ * @param queue_id [IN] Flag ID
+ * @param bits [IN] Flag bit-pattern
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist.
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_set_flag(EV_ID flag_id, UINT32 bits) {
+ if (!EV_ID_IS_FLAG(flag_id)) {
+ EV_DEBUG_ERR("set_flag: %x is not a valid flag_id.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ EV_Flag flag;
+ flag.flagID = flag_id;
+ flag.bits = bits;
+
+ int ret = ioctl(fd, EVK_IOC_STORE_FLAG, &flag);
+ int myerrno = errno;
+ close(fd);
+
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_WARNING("set_flag: No such flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+ errno = myerrno;
+ EV_perror("set flag");
+ return EV_ERR_Fatal;
+ }
+ return EV_OK;
+}
+
+/** @brief Set 64bit flag event
+ *
+ * Set the flag with the specified ID.
+ *
+ * @param queue_id [IN] Flag ID
+ * @param bits [IN] Bit pattern of 64-bit flag
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: The flag with the specified ID does not exist.
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_set_flag64(EV_ID flag_id, UINT64 bits) {
+ if (!EV_ID_IS_FLAG64(flag_id)) {
+ EV_DEBUG_ERR("set_flag: %x is not a valid flag_id.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ int fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ EV_assert(fd >= 0);
+
+ EV_Flag64 flag;
+ flag.flagID = flag_id;
+ flag.bits = bits;
+
+ int ret = ioctl(fd, EVK_IOC_STORE_FLAG64, &flag);
+ int myerrno = errno;
+ close(fd);
+
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_ERR("set_flag: No such flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ errno = myerrno;
+ EV_perror("set flag");
+ return EV_ERR_Fatal;
+ }
+
+ return EV_OK;
+}
+
+/** @brief Send Messaging Event
+ *
+ * Send a message event to the specified queue ID.
+ *
+ * @param queue_id [IN] Queue ID
+ * @param bytes [IN] Bytes to send
+ * @param buf [IN] Pointer to the byte sequence to send
+ * @param senderInfo [IN] Source info
+ * Specify this option to identify applications, etc.
+ * When not used, specify 0.
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: Message event queue with specified ID does not exist
+ * @retval EV_ERR_Busy: Queue overflow
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_send_message(EV_ID queue_id, UINT16 bytes, const void *buf, UINT32 senderInfo) {
+ EV_assert(buf != NULL);
+ EV_assert(bytes <= EV_MAX_MESSAGE_LENGTH);
+ if (!EV_ID_IS_QUEUE(queue_id)) {
+ EV_DEBUG_ERR("send_message: %x is not a valid queue_id.\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+
+ /*
+ * Open fd at the first time of send_message in process,
+ * and continue to use the fd with it open after that.
+ * Reason:
+ * - Prevent frequent use of open/close system calls.
+ * - If the process is nonresident, the fd is close after the process is terminated.
+ * - Even for resident processes, there is no problem because processes
+ * that use event library normally continue to use event library
+ * from the beginning to the end.
+ */
+ static int fd = -1;
+ EV_PROCESS_MUTEX_LOCK;
+ if (fd < 0) {
+ fd = open(EVK_DEV_NAME, O_RDWR|O_CLOEXEC);
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for glibc function open
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ EV_PROCESS_MUTEX_UNLOCK; // LCOV_EXCL_LINE 5: fail safe for glibc function open
+ return EV_ERR_Fatal; // LCOV_EXCL_LINE 5: fail safe for glibc function open
+ }
+ fcntl(fd, F_SETFD, FD_CLOEXEC|(fcntl(fd, F_GETFD, 0)));
+ }
+
+ EV_Message msg;
+ msg.queueID = queue_id;
+ msg.senderInfo = senderInfo;
+ msg.length = bytes;
+ memcpy(msg.message, buf, bytes);
+
+ int ret = ioctl(fd, EVK_IOC_STORE_MESSAGE, &msg);
+ int myerrno = errno;
+ EV_PROCESS_MUTEX_UNLOCK;
+
+ if (ret < 0) {
+ if (myerrno == ENOENT) {
+ EV_DEBUG_WARNING("send_message: No such queue_id %x.\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ } else if (myerrno == EBUSY) {
+ EV_DEBUG_WARNING("send_message: queue_id %x returned BUSY.\n", queue_id);
+ return EV_ERR_Busy;
+ }
+
+ errno = myerrno;
+ EV_perror("send message");
+ return EV_ERR_Fatal;
+ }
+
+ return EV_OK;
+}
+
+/** @brief Get fd for poll flag event
+ *
+ * Get file descriptor (FD) that used to wait for a flag
+ * with the specified ID in a poll/select.
+ * Only flags created by invoked process can be specified.
+ *
+ * This FD can only be used to specify a poll/select.
+ * Subsequent operations are not guaranteed if any other operations are performed.
+ * When use poll, only POLLIN can be specified in events.
+ * When use select, you can only check if it is readable.
+ *
+ * If the same flag_id is called more than once,
+ * The same FD is returned each time (unless there is a destroy/create during that time).
+ *
+ * - differences in kernel versions
+ * - This API is not provided in the EVK.
+ *
+ * @note If the flag is deleted during poll/select using the FD gotten by the API,
+ * the poll/select is exited.
+ * POLLERR is set as event for poll.
+ *
+ * @param flag_id [IN] Flag ID
+ * @param fd [OUT] Pointer to the area to store the file descriptor
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: An invalid flag ID was specified.
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_flag_fd(EV_ID flag_id, int *fd) {
+ EV_assert(fd != NULL);
+ *fd = -1;
+ if ((!EV_ID_IS_FLAG(flag_id))&& (!EV_ID_IS_FLAG64(flag_id))) {
+ EV_DEBUG_ERR("get_flag_fd: %x is not a valid flag_id.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ *fd = find_ev_info(EV_SEARCH_ALL_THREAD, flag_id);
+ if (*fd < 0) {
+ EV_DEBUG_ERR("You have not created flag_id %x.\n", flag_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ return EV_OK;
+}
+
+/** @brief Get fd for message event queue poll
+ *
+ * Get file descriptor (FD) that used to wait for a queue
+ * with the specified ID in a poll/select.
+ * Only message event queues created by invoked process can be specified.
+ *
+ * This FD can only be used to specify a poll/select.
+ * Subsequent operations are not guaranteed if any other operations are performed.
+ * When use poll, only POLLIN can be specified in events.
+ * When use select, you can only check if it is readable.
+ *
+ * If the same queue_id is called more than once,
+ * The same FD is returned each time (unless there is a destroy/create during that time).
+ *
+ * - differences in kernel versions
+ * - This API is not provided in the EVK.
+ *
+ * @note If the queue is deleted during poll/select using the FD gotten by the API,
+ * the poll/select is exited.
+ * POLLERR is set as event for poll.
+ *
+ * @param queue_id [IN] Message event queue ID
+ * @param fd [OUT] Pointer to the area to store the file descriptor
+ *
+ * @retval EV_OK: Normal completion
+ * @retval EV_ERR_Invalid_ID: An invalid flag ID was specified.
+ * @retval Otherwise: FATAL error
+ */
+EV_ERR
+EV_get_queue_fd(EV_ID queue_id, int *fd) {
+ EV_assert(fd != NULL);
+ *fd = -1;
+ if (!EV_ID_IS_QUEUE(queue_id)) {
+ EV_DEBUG_ERR("get_queue_fd: %x is not a valid queue_id.\n",
+ queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+
+ *fd = find_ev_info(EV_SEARCH_ALL_THREAD, queue_id);
+ if (*fd < 0) {
+ EV_DEBUG_ERR("You have not created queue_id %x.\n", queue_id);
+ return EV_ERR_Invalid_ID;
+ }
+ return EV_OK;
+}
+
+/* \~english Functions that specify the module ID (16 bits) instead of the flag ID and queue ID */
+EV_ID EV_moduleID_to_flagID(UINT16 mID)
+{
+ return EV_Flag_ID_Base(mID);
+}
+
+EV_ID EV_moduleID_to_flag64ID(UINT16 mID)
+{
+ return EV_Flag64_ID_Base(mID);
+}
+
+EV_ID EV_moduleID_to_queueID(UINT16 mID)
+{
+ return EV_Queue_ID_Base(mID);
+}
+
+EV_ERR EV_create_flag_by_mID(UINT16 mID)
+{
+ return EV_create_flag(EV_moduleID_to_flagID(mID));
+}
+
+EV_ERR EV_create_flag64_by_mID(UINT16 mID)
+{
+ return EV_create_flag64(EV_moduleID_to_flag64ID(mID));
+}
+
+EV_ERR EV_create_queue_by_mID(UINT16 mID, UINT8 length,UINT16 max_bytes,
+ EV_Message_Queue_Type type)
+{
+ return EV_create_queue(EV_moduleID_to_queueID(mID), length, max_bytes, type);
+}
+
+EV_ERR EV_destroy_flag_by_mID(UINT16 mID)
+{
+ return EV_destroy_flag(EV_moduleID_to_flagID(mID));
+}
+
+EV_ERR EV_destroy_queue_by_mID(UINT16 mID)
+{
+ return EV_destroy_queue(EV_moduleID_to_queueID(mID));
+}
+
+EV_ERR EV_set_flag_by_mID(UINT16 mID, UINT32 bits)
+{
+ return EV_set_flag(EV_moduleID_to_flagID(mID), bits);
+}
+
+EV_ERR EV_set_flag64_by_mID(UINT16 mID, UINT64 bits)
+{
+ return EV_set_flag64(EV_moduleID_to_flag64ID(mID), bits);
+}
+
+EV_ERR EV_send_message_by_mID(UINT16 mID, UINT16 bytes, const void *message,
+ UINT32 senderInfo)
+{
+ return EV_send_message(EV_moduleID_to_queueID(mID),
+ bytes, message, senderInfo);
+}
+/** @} */
diff --git a/video_in_hal/otherservice/other_service.mk b/video_in_hal/otherservice/other_service.mk
new file mode 100755
index 0000000..85a2f2c
--- /dev/null
+++ b/video_in_hal/otherservice/other_service.mk
@@ -0,0 +1,42 @@
+#############################################################
+#
+# Common Makefile for other_service
+# Copyright (C) 2017-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := other_service
+
+#############################################################
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/LICENSE b/video_in_hal/otherservice/posix_based_os001_legacy_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/Makefile.client b/video_in_hal/otherservice/posix_based_os001_legacy_library/Makefile.client
new file mode 100755
index 0000000..4192704
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/Makefile.client
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+SUBDIRS := library
+
+include ../other_service.mk
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/Makefile b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/Makefile
new file mode 100755
index 0000000..874a431
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/Makefile
@@ -0,0 +1,48 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+INST_SHLIBS = libPosixBasedOS001legacy
+
+VPATH = ./src ./include/$(COMPONENT_NAME)/
+INST_HEADERS = strlcat.h strlcpy.h \
+itoa.h \
+PosixBasedOS001TimeApi.h \
+PosixBasedOS001ClockCycleApi.h \
+ultoa.h \
+posix_based_os001_legacy_library.h
+
+libPosixBasedOS001legacy_SRCS += strlcat.c strlcpy.c \
+itoa.c \
+PosixBasedOS001TimeApi.c \
+PosixBasedOS001ClockCycleApi.c \
+ultoa.c
+
+CPPFLAGS = -I./include
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wpointer-to-int-cast
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+
+
+include ../../other_service.mk
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h
new file mode 100755
index 0000000..2c3fb44
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h
@@ -0,0 +1,83 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_CLOCK_CYCLE_API_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_CLOCK_CYCLE_API_H_ // NOLINT(build/header_guard)
+
+#include <stdint.h>
+
+/******************************************************************************/
+/* define */
+
+/******************************************************************************/
+/* typedef */
+
+/******************************************************************************/
+/* struct */
+
+
+/******************************************************************************/
+/* function */
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file PosixBasedOS001ClockCycleApi.h
+ * @brief \~english This file provides ClockCycle API to get number of clock cycles.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ClockCycle
+/// \~english @par Brief
+/// Get the number of clock cycles.
+/// \~english @retval Microsecond
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+uint64_t ClockCycle(void);
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_CLOCK_CYCLE_API_H_
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h
new file mode 100755
index 0000000..616bda4
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// libraries for replacing PosixBasedOS001 to Linux
+// PosixBasedOS001TimeApi.h
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_TIMEAPI_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_TIMEAPI_H_ // NOLINT(build/header_guard)
+
+#include <sys/types.h>
+
+/*******************************************************************************/
+/* define */
+
+/*******************************************************************************/
+/* typedef */
+
+/*******************************************************************************/
+/* struct */
+
+/*******************************************************************************/
+/* function */
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file PosixBasedOS001TimeApi.h
+ * @brief \~english This file provides delay API to delay for the specified time.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup delay
+/// \~english @par Brief
+/// Delay for the specified time.
+/// \~english @param [in] duration
+/// unsigned int - The number of milliseconds for which to suspend the calling thread from execution
+/// \~english @retval EOK
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Detail
+/// If duration is more than 1000 milliseconds, return immediately.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+unsigned int delay(unsigned int duration); // NOLINT(readability/nolint)
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_TIMEAPI_H_
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/itoa.h b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/itoa.h
new file mode 100755
index 0000000..4f26634
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/itoa.h
@@ -0,0 +1,74 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ITOA_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ITOA_H_ // NOLINT(build/header_guard)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file itoa.h
+ * @brief \~english This file provides itoa API to convert integer value to null terminated string
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup itoa
+/// \~english @par Brief
+/// Integer value to null terminated string.
+/// \~english @param [in] value
+/// int - value Number to convert
+/// \~english @param [out] buff
+/// char - buff Result string
+/// \~english @param [in] radix
+/// int - radix Radix of value
+/// \~english @retval String pointer
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+char* itoa(int value, char buff[], int radix); // NOLINT(readability/nolint)
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ITOA_H_
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h
new file mode 100755
index 0000000..188cb01
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english include all posix_based_os001_legacy_library head files
+ */
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_H_ // NOLINT(build/header_guard)
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <other_service/PosixBasedOS001TimeApi.h>
+#include <other_service/itoa.h>
+#include <other_service/strlcat.h>
+#include <other_service/strlcpy.h>
+#include <other_service/ultoa.h>
+
+
+/** @}*/ // posix_based_os001_legacy_library
+/** @}*/ // other_service
+/** @}*/ // BaseSystem
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_H_
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcat.h b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcat.h
new file mode 100755
index 0000000..d42c136
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcat.h
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCAT_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCAT_H_ // NOLINT(build/header_guard)
+
+#include <strings.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file strlcat.h
+ * @brief \~english This file provides strlcat API to concatenate strings
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup strlcat
+/// \~english @par Brief
+/// Concatenate strings
+/// \~english @param [in/out] dst
+/// char * - Destination string
+/// \~english @param [in] src
+/// const char * - Concatenated string
+/// \~english @param [in] siz
+/// size_t - Size of dst
+/// \~english @retval String length after concatenation
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// Appends src to string dst of size siz (unlike strncat, siz is the full size of dst, not space left).
+/// At most siz-1 characters will be copied. Always NUL terminates (unless siz <= strlen(dst)).
+/// Returns strlen(src) + MIN(siz, strlen(initial dst)). If retval >= siz, truncation occurred.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+size_t strlcat(char *dst, const char *src, size_t siz); // NOLINT(readability/nolint)
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCAT_H_
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h
new file mode 100755
index 0000000..14c51fe
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCPY_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCPY_H_ // NOLINT(build/header_guard)
+
+#include <strings.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file strlcpy.h
+ * @brief \~english This file provides API to copy string
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup strlcpy
+/// \~english @par Brief
+/// Copy string
+/// \~english @param [in/out] dst
+/// char * - Destination string
+/// \~english @param [in] src
+/// const char * - Copy string
+/// \~english @param [in] siz
+/// size_t - Size of dst
+/// \~english @retval Length of copied character string
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// Copy src to string dst of size siz. At most siz-1 characters will be copied.
+/// Always NUL terminates (unless siz == 0).
+/// Returns strlen(src); if retval >= siz, truncation occurred.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+size_t strlcpy(char *dst, const char *src, size_t siz); // NOLINT(readability/nolint)
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_STRLCPY_H_
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/ultoa.h b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/ultoa.h
new file mode 100755
index 0000000..2291f1a
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/include/other_service/ultoa.h
@@ -0,0 +1,74 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ULTOA_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ULTOA_H_ // NOLINT(build/header_guard)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @file ultoa.h
+ * @brief \~english This file provides ultoa API to convert unsigned long type to NULL terminated character string
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup posix_based_os001_legacy_library
+ * @ingroup other_service
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ultoa
+/// \~english @par Brief
+/// Convert unsigned long type to NULL terminated character string.
+/// \~english @param [in] value
+/// int - value Number to convert
+/// \~english @param [out] buff
+/// char - buff Result string
+/// \~english @param [in] radix
+/// int - radix Radix of value
+/// \~english @retval String pointer
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Detail
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+char *ultoa(unsigned long value, char *buf, int radix); // NOLINT (readability/nolint)
+
+/** @}*/ // end of posix_based_os001_legacy_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_POSIXBASEDOS001LEGACYLIBRARY_POSIXBASEDOS001_ULTOA_H_
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c
new file mode 100755
index 0000000..b4e73c5
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c
@@ -0,0 +1,56 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <time.h>
+
+/******************************************************************************/
+/*
+Overview :GetTickCount() like Win32 API
+Arguments :void
+Return :OK:usec NG:0
+Note :
+*/
+static uint64_t GetTickCount(void )
+{
+ struct timespec tp;
+ /*--------------------------------------------------------------------*/
+
+ if(clock_gettime(CLOCK_MONOTONIC, &tp) != 0) // LCOV_EXCL_BR_LINE 5: fail safe for libc clock_gettime
+ {
+ return 0;
+ }
+
+ return (uint64_t)(tp.tv_sec * 1000000 + tp.tv_nsec / 1000);
+}
+
+
+/******************************************************************************/
+/*
+Overview :Get the number of clock cycles
+Arguments :void
+Return :OK:usec NG:0
+Note :
+*/
+uint64_t ClockCycle( void )
+{
+ return GetTickCount();
+}
+
+/******************************************************************************/
+/* End of souce code.*/
+/******************************************************************************/
+
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c
new file mode 100755
index 0000000..2a1dd72
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// libraries for replacing PosixBasedOS001 to Linux
+// PosixBasedOS001TimeApi.c
+
+#include <other_service/PosixBasedOS001TimeApi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <unistd.h> // for using usleep()
+#include <time.h> // for using clock()
+
+// delay()
+// NOTE: Control a device
+// duration
+// The number of milliseconds for which to suspend the calling thread from execution.
+//
+// _CWORD72_ doesnot use return code of delay, and sets 1,100,and 1000.
+unsigned int delay( unsigned int duration ){
+
+ int ret;
+ useconds_t duration_usec = duration * 1000;
+
+ ret = EOK;
+
+ if( duration_usec > 1000000 ){
+ printf("delay():over flow!\n");
+ }else{
+
+ // using usec order
+ ret = usleep(duration_usec);
+
+ // error of usleep() = 0(E_OK), -1(ERROR)
+ // delay() cannot return error code. [data type unmatch]
+ if(ret < 0){ // LCOV_EXCL_BR_LINE 5: fail safe for libc function usleep
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("delay():error!\n"); // LCOV_EXCL_LINE 5: fail safe for libc function usleep
+ }
+ }
+
+ return EOK;
+}
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/itoa.c b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/itoa.c
new file mode 100755
index 0000000..49a24bf
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/itoa.c
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+char* itoa( int value, char buff[], int radix ) {
+ static const char table[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+ char *head = buff;
+ char *tail = buff;
+ char temp;
+
+ // Converting minus sign to character
+ if ( value < 0 ){
+ *tail++ = '-';
+ value = -value;
+ }
+ // Converting integer to character
+ if ( value == 0 ){
+ *tail++ = '0';
+ }
+ else for ( head = tail ; value != 0 ; value /= radix ){
+ *tail++ = table[ value % radix ];
+ }
+ *tail = '\0';
+
+ // swapping characters
+ for ( tail-- ; head < tail ; head++, tail-- ){
+ temp = *head;
+ *head = *tail;
+ *tail = temp;
+ }
+
+ return buff;
+}
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/strlcat.c b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/strlcat.c
new file mode 100755
index 0000000..8d11eab
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/strlcat.c
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+size_t
+strlcat(char *dst, const char *src, size_t size)
+{
+ size_t dstsize, srcsize, copysize;
+
+ dstsize = strnlen(dst, size);
+ srcsize = strlen(src);
+ if (dstsize == size) {
+ return dstsize + srcsize;
+ }
+
+ copysize = size - dstsize - 1;
+ if (srcsize < copysize) {
+ copysize = srcsize;
+ }
+
+ memcpy(dst + dstsize, src, copysize);
+ dst[dstsize + copysize] = '\0';
+
+ return dstsize + srcsize;
+}
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/strlcpy.c b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/strlcpy.c
new file mode 100755
index 0000000..f440c0e
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/strlcpy.c
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+/*
+ * Copy src to string dst of size siz. At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+size_t
+strlcpy(char *dst, const char *src, size_t siz)
+{
+ char *d = dst;
+ const char *s = src;
+ size_t n = siz;
+
+ /* Copy as many bytes as will fit */
+ if (n != 0) {
+ while (--n != 0) {
+ if ((*d++ = *s++) == '\0')
+ break;
+ }
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++)
+ ;
+ }
+
+ return (size_t)(s - src - 1); /* count does not include NUL */
+}
diff --git a/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/ultoa.c b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/ultoa.c
new file mode 100755
index 0000000..1984246
--- /dev/null
+++ b/video_in_hal/otherservice/posix_based_os001_legacy_library/library/src/ultoa.c
@@ -0,0 +1,33 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+
+char *ultoa(unsigned long value, char *buf, int radix)
+{
+ const static char c[] = "0123456789abcdef";
+ char b[65];
+ char *p = b + sizeof(b);
+
+ *--p ='\0';
+ do {
+ *--p = c[value % (unsigned int)radix];
+ value /= (unsigned int)radix;
+ } while (value);
+ strcpy(buf, p);
+
+ return buf;
+}
diff --git a/video_in_hal/otherservice/rpc_library/LICENSE b/video_in_hal/otherservice/rpc_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/otherservice/rpc_library/Makefile.client b/video_in_hal/otherservice/rpc_library/Makefile.client
new file mode 100755
index 0000000..36a4dee
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := tool_for_arm library
+
+include ../other_service.mk
diff --git a/video_in_hal/otherservice/rpc_library/library/Makefile b/video_in_hal/otherservice/rpc_library/library/Makefile
new file mode 100755
index 0000000..75c734a
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/Makefile
@@ -0,0 +1,46 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+INST_SHLIBS := librpc
+librpc_SRCS := rpc_lib.c \
+ rpc_marshall.c \
+ rpc_event.c \
+ rpc_udp.c \
+ rpc_thread.c
+
+CPPFLAGS = -I../tool \
+ -I./include \
+ -D_GNU_SOURCE \
+
+CPPFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wpointer-to-int-cast
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS := -lrt -lcommon
+
+
+VPATH = ./src ./include/$(COMPONENT_NAME)
+INST_HEADERS := rpc.h \
+ rpc_id.h \
+ rpc_library.h \
+
+include ../../other_service.mk
diff --git a/video_in_hal/otherservice/rpc_library/library/include/other_service/rpc.h b/video_in_hal/otherservice/rpc_library/library/include/other_service/rpc.h
new file mode 100755
index 0000000..f669331
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/include/other_service/rpc.h
@@ -0,0 +1,765 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc.h
+ * @brief \~english RPC library --API define header file
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rpc_library
+ * @ingroup other_service
+ * @{
+ */
+#ifndef OTHERSERVICE_RPC_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPC_H_ // NOLINT(build/header_guard)
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <other_service/rpc_id.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+* @brief \~english RPC_ID max number
+*/
+#define RPC_MAX_THREADS_IN_PROCESS 64
+
+/** @brief \~english fd max number in one process.
+ * 0 = main/sub thread communication pipe fd.
+ * 1 = inotify() process listen fd.
+ * 2~129 = even num : API request data socket.
+ * odd num : secure stream socket.
+ * */
+#define RPC_MAX_FD_IN_PROCESS 130
+
+
+#define RPC_MAX_API_ARG_NUM 8
+///< \~english API call parameter max num
+
+
+#define RPC_MAX_API_ARG_SIZE 1024
+///< \~english API call one parameter max byte
+
+#define RPC_MAX_API_ARG_TOTAL_SIZE 1500
+///< \~english API call all parameter max byte
+
+#define RPC_MAX_APICALL_QUEUE 16
+///< \~english API call max queue num
+
+#define RPC_NO_PORT 0
+///< \~english invalid port num
+
+/** @brief \~english RPC library function return value
+ */
+enum rpc_result { // NOLINT (readability/nolint)
+ RPC_OK = 0, ///< \~english ok
+ RPC_ERR_No_Response = 0x8fff0000, ///< \~english has no response
+ RPC_ERR_Timeout, ///< \~english timeout
+ RPC_ERR_Busy, ///< \~english busy
+ RPC_ERR_API_Error, ///< \~english API error
+ RPC_ERR_API_Fatal, ///< \~english API fatal
+ RPC_ERR_Fatal, ///< \~english fatal
+ RPC_ERR_Configuration, ///< \~english configuration
+ RPC_ERR_Server_DeadLock, ///< \~english server deadlock
+ RPC_ERR_Server_Finish, ///< \~english server finish
+ RPC_ERR_Reject_connect, ///< \~english reject connect
+};
+/** @brief \~english RPC library function return type
+ * @see rpc_result
+ * */
+typedef INT32 RPC_Result;
+
+/** @brief \~english RPC ID
+ *
+ */
+typedef UINT32 RPC_ID;
+
+#define RPC_NO_ID RPC_NO_PORT
+///< \~english The ID when destination is invalid
+
+#define RPC_SELF_ID RPC_NO_PORT
+///< \~english The ID when destination is self
+
+/** @brief \~english The ID when destination is any
+ * */
+#define RPC_ANY_ID RPC_NO_PORT
+
+
+typedef RPC_Result (*RPC_dispatch_func_t)(UINT16 api_num,
+ const char *args_string,
+ unsigned int args_size,
+ char **ret_string,
+ unsigned int *ret_bytes);
+
+#ifdef RPC_DISPATCH_FUNC
+#error "Please include <rpc.h> before \"*_srvr.h\"."
+#else /* !RPC_DISPATCH_FUNC */
+#define RPC_DISPATCH_FUNC NULL
+#endif /* !RPC_DISPATCH_FUNC */
+
+/* RPC Library Start Function Macro */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_START_SERVER
+/// \~english @par Brief
+/// server start(certification of the client by UID)
+/// \~english @param [in] ID
+/// RPC_ID - program's RPC_ID
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Case of an input parameter error
+/// - Case of fail to information generation
+/// - When RPC_start has already been issued
+/// - Case of space reservation fails
+/// - Case of socket generation fails
+/// - Case of socket allocation fails
+/// - Case of creating a pipe fails
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - Used when the server program of RPC-API performs RPC library use start processing
+/// - ID specifies a symbol in the form of XXX_RPC_ID defined by rpc_id.h
+/// - Only one server program is permitted per thread
+/// - When the server program calls the API as a client of another server,
+/// it only needs to call RPC_START_SERVER, there is no need to call RPC_START_CLIENT
+/// \~english @see RPC_start, RPC_end
+////////////////////////////////////////////////////////////////////////////////////
+#define RPC_START_SERVER(ID) RPC_start((ID), RPC_DISPATCH_FUNC, NULL, NO_SECURE_CHECK)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_START_SECURE_SERVER
+/// \~english @par Brief
+/// server start(certification of the client by UID)
+/// \~english @param [in] ID
+/// RPC_ID - program's RPC_ID
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Case of an input parameter error
+/// - Case of fail to information generation
+/// - When RPC_start has already been issued
+/// - Case of space reservation fails
+/// - Case of socket generation fails
+/// - Case of socket allocation fails
+/// - Case of creating a pipe fails
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - Used when the server program of RPC-API performs RPC library use start processing
+/// - ID specifies a symbol in the form of XXX_RPC_ID defined by rpc_id.h
+/// - Only one server program is permitted per thread
+/// - When the server program calls the API as a client of another server,
+/// it only needs to call RPC_START_SERVER, there is no need to call RPC_START_CLIENT
+/// \~english @see RPC_start, RPC_end
+////////////////////////////////////////////////////////////////////////////////////
+#define RPC_START_SECURE_SERVER(ID) RPC_start((ID), RPC_DISPATCH_FUNC, NULL, NEED_SECURE_CHECK)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_START_CLIENT
+/// \~english @par Brief
+/// client start
+/// \~english @param [out] pID
+/// RPC_ID * - auto allocated program's RPC_ID
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - input parameter error
+/// - Unable to get the rpc lib info for the self-thread.
+/// - Memory allocation fail for id info.
+/// - Socket generation fail.
+/// - Socket allocation fail.
+/// - Unable to get the socket name.
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - This macro supports only client function of RPC library.
+/// - Run the start processing by using this macro only when the APIs provided by the other program are called.
+/// \~english @see RPC_start, RPC_end
+////////////////////////////////////////////////////////////////////////////////////
+#define RPC_START_CLIENT(pID) RPC_start((UINT16)RPC_NO_ID, NULL, (pID), NO_SECURE_CHECK)
+//!< \~english client start
+
+/* Client authentication by registering the server's UID list */
+#define NEED_SECURE_CHECK 1 ///< \~english has secure check
+#define NO_SECURE_CHECK 0 ///< \~english has no secure check
+
+/* Setting whether to register UID list of server */
+#define REGISTERED 1 ///< \~english registered
+#define NO_REGISTERED 0 ///< \~english not registered
+
+/* API Function Prototypes in the RPC Library */
+RPC_Result RPC_start(RPC_ID id, RPC_dispatch_func_t func, RPC_ID *pID, INT32 secure_check); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_get_fd
+/// \~english @par Brief
+/// Get the file descriptor to judge whether there is the request of RPC-API call or not.
+/// \~english @param [in] id
+/// RPC_ID - server program's RPC_ID
+/// \~english @param [out] fd
+/// int * - area for fd
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// RPC_START_SERVER or RPC_START_SECURE_SERVER is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Argument(id) is RPC_NO_ID.
+/// - Argument(fd) is NULL.
+/// - Unable to get the rpc lib info for the self-thread.
+/// - RPC sub thread doesn't exist.
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - This function returns the fd(file descriptor) to judge whether there is the request to server.
+/// - Return value(fd) is used only for poll function or select function parameter.
+/// - Usage
+/// - To get fd from this function.
+/// - Wait for the data to use poll function or select function.
+/// - After that, call RPC_process_API_request function.
+/// - As a result, the API call request from client is done(that is, run the server API).
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_get_fd(RPC_ID id, int *fd); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_process_API_request
+/// \~english @par Brief
+/// Run the processing of RPC-API call
+/// \~english @param [in] id
+/// RPC_ID - server program's RPC_ID
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// RPC_START_SERVER or RPC_START_SECURE_SERVER is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Argument(id) is RPC_NO_ID.
+/// - Unable to get the rpc lib info for the self-thread.
+/// - RPC sub thread doesn't exist.
+/// - fail to send UDP packet.
+/// - API processing from the client returns the error.
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - Process all the queued API running requests from the client.
+/// - API function of server program is called in this function.
+/// - If there are no requests to run API, this function doesn't wait and return immediately.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_process_API_request(RPC_ID id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_end
+/// \~english @par Brief
+/// End processing of RPC library.
+/// \~english @param [in] id
+/// RPC_ID - program's RPC_ID
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// RPC_START_SERVER or RPC_START_SECURE_SERVER or RPC_START_CLIENT is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - End processing(socket close and memory release etc) is done.
+/// - When there are no more program that uses RPC_ID, RPC sub thread started by RPC_start will be ended.
+/// - Need to call this function before the program is ended.
+/// - Need to call this function from which the thread called RPC_start.
+/// - Nothing is done when incorrect or no more used RPC_ID is designated.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+void RPC_end(RPC_ID id); // NOLINT (readability/nolint)
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_end_all
+/// \~english @par Brief
+/// End processing of RPC library(forcing to clean up).
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Delete the socket files created in process for communication. /n
+/// The program which use RPC library must call RPC_end() to free resource, /n
+/// This API is used for insurance processing when socket file's link lost. /n
+/// 1,Before process ends, call this API. /n
+/// When process is ending, auto running socket's close and memory free is not work. /n
+/// 2,After called this API, all the RPC's process(both server and client) become to useless. /n
+/// Even if after called this API, call RPC_START to repair it also can't make sure to active. /n
+/// RPC library which use Unix autobind is nothing to do. /n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+void RPC_end_all(void); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_set_API_timeout
+/// \~english @par Brief
+/// Set timeout time for server side API processing time
+/// \~english @param [in] sec
+/// INT32 - timeout time
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @retval RPC_ERR_Configuration Argument is out of range
+/// \~english @par Prerequisite
+/// RPC_START_SERVER or RPC_START_SECURE_SERVER is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Unable to get the rpc lib info for the self-thread.
+/// - Server id info doesn't exist.
+/// - Info for API call reception processing doesn't exist.
+/// - RPC_ERR_Fatal
+/// - The value of the argument(sec) is out of range.
+/// - RPC_ERR_Configuration
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// None
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_set_API_timeout(INT32 sec); // NOLINT (readability/nolint)
+
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_is_server_ready
+/// \~english @par Brief
+/// Return RPC server's status
+/// \~english @param [in] id
+/// RPC_ID - server program's RPC_ID
+///
+/// \~english @retval RPC_OK : Success
+/// \~english @retval RPC_ERR_No_Response : No response
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// return the server's work status.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_is_server_ready(RPC_ID id); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_regist_credential
+/// \~english @par Brief
+/// Register UID and GID list
+/// \~english @param [in] uid_num
+/// int - UID number to regist(number of elements of UID list)
+/// \~english @param [in] uid_list
+/// uid_t* - head pointer of UID list
+/// \~english @param [in] gid_num
+/// int - GID number to regist(number of elements of GID list)
+/// \~english @param [in] uid_list
+/// gid_t* - head pointer of GID list
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @retval RPC_ERR_Configuration Argument is out of range
+/// \~english @par Prerequisite
+/// RPC_START_SECURE_SERVER is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Unable to get the rpc lib info for the self-thread.
+/// - Server id info doesn't exist.
+/// - Info for API call reception processing doesn't exist.
+/// - Arguments(client_uid and client_gid) are NULL.
+/// - Client authentication check is not necessary.
+/// - Authentication info is already registered.
+/// - Memory allocation fail for UID and GID lists.
+/// - RPC_ERR_Fatal
+/// - Values of Arguments(uid_num and gid_num) are out of range.
+/// - RPC_ERR_Configuration
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - Register the UID and GID lists acceptable by the RPC server.
+/// - If RPC_START_SECURE_SERVER is not called, this function returns the error.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_regist_credential(int uid_num, uid_t *uid_list, int gid_num, gid_t *gid_list); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_get_client_credential
+/// \~english @par Brief
+/// Get UID and GID of client that requested to run APIs processing
+/// \~english @param [out] client_uid
+/// uid_t* - UID of client that requested to run APIs processing
+/// \~english @param [out] client_gid
+/// gid_t* - GID of client that requested to run APIs processing
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal Error
+/// \~english @par Prerequisite
+/// RPC_START_SECURE_SERVER is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Server id info doesn't exist.
+/// - Info for API call reception processing doesn't exist.
+/// - Arguments(client_uid and client_gid) are NULL.
+/// - Client authentication check is not necessary.
+/// - There are no running clients.
+/// - Info for the running client is not applicable.
+/// - RPC_ERR_Fatal
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - This function is to get UID and GID of client that requested to run APIs processing.
+/// - If RPC_START_SECURE_SERVER is not called, this function returns the error.
+/// - If the running client doesn't exist, this function returns the error.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_get_client_credential(uid_t *client_uid, gid_t *client_gid); // NOLINT (readability/nolint)
+
+/*
+ * The following are only used in stub files
+ */
+#define RPC_RETCODE_LEN 9
+
+#define RPC_MARSHALL_FLAG_BITS_CODE 12
+#define RPC_MARSHALL_FLAG_BITS_IS_VARARRAY 1
+#define RPC_MARSHALL_FLAG_BITS_IS_POINTER 1
+#define RPC_MARSHALL_FLAG_BITS_IN_OUT 2
+
+/** @brief \~english APIcall property stored struct
+ *
+ */
+typedef union {
+ UINT32 all; ///< \~english all property
+ struct {
+ unsigned int code: RPC_MARSHALL_FLAG_BITS_CODE; ///< \~english value type
+ /** @brief \~english vararray or not
+ *
+ */
+ unsigned int is_vararray: RPC_MARSHALL_FLAG_BITS_IS_VARARRAY;
+ /** @brief \~english pointer or not
+ *
+ */
+ unsigned int is_pointer: RPC_MARSHALL_FLAG_BITS_IS_POINTER;
+ /** @brief \~english in/out parameter property
+ *
+ */
+ unsigned int in_out: RPC_MARSHALL_FLAG_BITS_IN_OUT;
+ /** @brief \~english string or user define type byte num.other is 0
+ *
+ */
+ UINT16 bytes;
+ } bits; ///< \~english variable properties
+} RPC_marshall_flag;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_API_call
+/// \~english @par brief
+/// API call execution function (client)
+/// \~english @param [in] id
+/// RPC_ID - RPC_ID of server program
+/// \~english @param [in] api_num
+/// UINT16 - Request API number
+/// \~english @param [in] args_string
+/// const char* - Argument string
+/// \~english @param [in] args_size
+/// unsigned int - Argument string length
+/// \~english @param [out] ret_string
+/// char** - Process result string
+/// \~english @param [out] ret_size
+/// unsigned int* - Process result string length
+/// \~english @retval RPC_OK Normal End
+/// \~english @retval RPC_ERR_Fatal Fatal error
+/// \~english @retval RPC_ERR_No_Response No response
+/// \~english @retval RPC_ERR_Busy API call queue overflow
+/// \~english @retval RPC_ERR_Server_DeadLock RPC server deadlock
+/// \~english @retval RPC_ERR_Reject_connect The RPC server does not allow communication
+/// \~english @par Prerequisite
+/// The RPC server is running.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Acquisition of rpc library information for self thread fails
+/// - Generation of self-thread rpc library information fails
+/// - The RPC ID information does not exist
+/// - Failed to receive data from the server at initial authentication
+/// - Analysis of received data failed during initial authentication
+/// - Commands not expected to be received during initial authentication
+/// - Server response when initial authentication is API call error
+/// - Failed to receive data from the server at API processing request
+/// - Analysis of received data failed during API processing request
+/// - Commands not expected to be received during API processing request
+/// - Server response when API processing request is API call error
+/// - Error in server response other than deadlock when processing results are received
+/// - Server shut down
+/// - RPC_ERR_Fatal
+/// - UDP packet transmission fails at initial authentication
+/// - A timeout occurred in response from the server during initial authentication
+/// - UDP packet transmission failed at API processing request
+/// - A timeout occurred in response from the server during API processing request
+/// - RPC_ERR_No_Response
+/// - Server response when initial authentication is API call queue overflow
+/// - Server response when API processing request is API call queue overflow
+/// - RPC_ERR_Busy
+/// - When the server response is deadlocked on initial authentication
+/// - When the server response is deadlocked on API processing request
+/// - Server response is deadlocked when processing result is received
+/// - RPC_ERR_Server_DeadLock
+/// - Server response is not authenticated at initial authentication
+/// - RPC_ERR_Reject_connect
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - Request execution of RPC-API from the client side.
+/// - However, since this API is called from the automatically generated code, it is not used directly by the user.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RPC_Result RPC_API_call(RPC_ID id, UINT16 api_num, // NOLINT (readability/nolint)
+ const char *args_string, unsigned int args_size,
+ char **ret_string, unsigned int *ret_size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_demarshall_arguments
+/// \~english @par Brief
+/// Confirm whether the input character string conforms to the prescribed format.
+/// \~english @param [in] from
+/// const char * - Input string
+/// \~english @param [in] size
+/// unsigned int - Byte length of the input string
+/// \~english @param [in] need_alloc
+/// int - Flag whether memory allocation is necessary or not.
+/// \~english @param [in] num_args
+/// int - Number of the variable length arguments
+/// \~english @param [in] ...
+/// void * - Variable length arguments
+/// \~english @retval 0 Normal End
+/// \~english @retval -1 Abnormal End
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - Byte length of the input string is 0 bytes or less or larger than 1024 bytes.
+/// - The input character string doesn't conform to the prescribed format.
+/// - -1
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// This function is used in the stub file only and user must not call this function directly.
+/// \~english @see RPC_marshall_arguments
+////////////////////////////////////////////////////////////////////////////////////
+int RPC_demarshall_arguments(const char *from, unsigned int size, // NOLINT (readability/nolint)
+ int need_alloc, int num_args, ...);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_marshall_arguments
+/// \~english @par Brief
+/// Collect variable arguments, convert them to a format that matches the receiver's specification,
+/// and stuff them into the message buffer.
+/// \~english @param [in] size
+/// unsigned int * - data size after conversion
+/// \~english @param [in] dont_marshall_out_args
+/// int - input/output kind(when the argument is a pointer)
+/// \~english @param [in] num_args
+/// int - value of variable argument
+/// \~english @param [in] ...
+/// void * - variable argument
+/// \~english @retval char * Message buffer after conversion
+/// \~english @retval NULL Abnormal
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - When marshall work securing work area fails
+/// - When the specified type size is abnormal
+/// - When securing the area of the message buffer after conversion fails
+/// - NULL
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// This function is used in the stub file for client only and user must not call this function directly.
+/// \~english @see RPC_demarshalol_arguments
+////////////////////////////////////////////////////////////////////////////////////
+char *RPC_marshall_arguments(unsigned int *size, int dont_marshall_out_args, // NOLINT (readability/nolint)
+ int num_args, ...);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_marshall_free
+/// \~english @par Brief
+/// Variadic function for memory release
+/// \~english @param [in] num
+/// int - number of memory to be released
+/// \~english @param [in] ...
+/// void * - allocated memory
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - This function is used in the stub file only and user must not call this function directly.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+void RPC_marshall_free(int num, ...); // NOLINT (readability/nolint)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_free_return_string
+/// \~english @par Brief
+/// release memory allocated during running API call.
+/// \~english @param [in] ptr
+/// void * - allocated memory
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// RPC_API_call is already called.
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - This function is used in the stub file for client only and user must not call this function directly.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+void RPC_free_return_string(void *ptr); // NOLINT (readability/nolint)
+
+#ifdef DBG_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RPC_record_dbg_log
+/// \~english @par Brief
+/// RPC-API call process's log
+/// \~english @param [in] filename
+/// const char - filename's point
+/// \~english @param [in] funcname
+/// const char - function name's point
+/// \~english @param [in] line
+/// int - file's line
+/// \~english @param [in] apiname
+/// const char - called API name's point
+/// \~english @param [out]
+///
+/// \~english @retval 0 : Success
+///
+/// \~english @par Prerequisite
+/// - DBG_ENABLE is defined.
+/// \~english @par Change of internal state
+/// - None
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// Receipt and record the client's filename, function name,
+/// line and called API's function name which called this API.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int RPC_record_dbg_log(const char *filename, const char *funcname, int line,
+ const char *apiname);
+#endif
+
+#define rpc_malloc malloc
+#define rpc_free free
+
+/*
+ * RPC debug message control
+ * if set to non-null and some critical information is displayed.
+ */
+extern char *RPC_DEBUG; // NOLINT (readability/nolint)
+
+/** @}*/ // end of rpc_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // OTHERSERVICE_RPC_H_
diff --git a/video_in_hal/otherservice/rpc_library/library/include/other_service/rpc_id.h b/video_in_hal/otherservice/rpc_library/library/include/other_service/rpc_id.h
new file mode 100755
index 0000000..e43e03c
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/include/other_service/rpc_id.h
@@ -0,0 +1,96 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_id.h
+ * @brief \~english RPC library -- RPC_ID(port no) define
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rpc_library
+ * @ingroup other_service
+ * @{
+ */
+
+/** @brief \~english define the RPC_ID used by program
+ * like #define XXX_RPC_ID ID
+ * but RPC_START_CLIENT() is not necessary
+ *
+ * RPC_ID as the following
+ * - UI Application : 50xxx
+ * - Application Service : 51xxx
+ * + HMI : 511xx
+ * + AV : 512xx
+ * + Radio : 513xx
+ * + Connectivity : 514xx
+ * + Navigation/Location: 515xx
+ * + Vehicle : 516xx
+ * + Communication : 517xx
+ * + BasePF : 518xx
+ * + System : 519xx
+ * + Others : 510xx
+ * - Common Service : 53xxx
+ * - Extension Service : 55xxx
+ * - System/Device Driver : 56xxx
+ *
+ * - 49152~59999 are Reserved.
+ * @note \~english RPC_ID==port num ,
+ * when not call from RPClibrary, and not well-known(~1023)/registered(1024~49151)
+ * use the fixed port num to IP communicate, use 6xxxx port number.
+ * @note \~english when RPC_START_CLIENT,and distribute automatically.
+ * use the linux kernel port distribute function
+ * 1024~4999 as the port num unused.
+ */
+
+#ifndef OTHERSERVICE_RPCID_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPCID_H_ // NOLINT(build/header_guard)
+
+
+#define test_RPC_ID 49999
+///< \~english sample(ID is used by RPClibrary test program)
+
+/* UI Aapplication : 50xxx */
+
+/* Application Service : 51xxx */
+#define MODEMANAGER_RPC_ID 51100 /* ModeManager */
+#define ACTIVITYMANAGER_RPC_ID 51101 /* ActivityManager */
+
+/* Common Service : 53xxx */
+#define TIMERENTRYDRV_RPC_ID 53000 /* TimerEntryDrv */
+#define TSKM_RPC_ID 53001 /* TaskManager */
+#define MSGBRK_RPC_ID 53002 /* MessageBroker */
+#define IPMANAGER_RPC_ID 53003 /* IPManager */
+#define IPMANAGER_RPC_ID 53003 /* IPManager */
+#define DEVICEMANAGER_RPC_ID 53004 /* DeviceManager */
+#define CAN_RPC_ID 53005 /* Communication(CAN) */
+#define _CWORD83__RPC_ID 53006 /* Communication(_CWORD83_) */
+#define SENSOR_RPC_ID 53007 /* Vehicle(Sensor) */
+#define GPS_RPC_ID 53008 /* Vehicle(GPS) */
+#define RESMGR_RPC_ID 53009 /* ResourceManager */
+#define GRAPHICS_RPC_ID 53010 /* Graphic */
+
+/* Extension Service : 55xxx */
+
+/* System/Device Driver : 56xxx */
+/** @}*/ // end of rpc_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+#endif // OTHERSERVICE_RPCID_H_
diff --git a/video_in_hal/otherservice/rpc_library/library/include/other_service/rpc_library.h b/video_in_hal/otherservice/rpc_library/library/include/other_service/rpc_library.h
new file mode 100755
index 0000000..298f741
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/include/other_service/rpc_library.h
@@ -0,0 +1,41 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file
+ * @brief \~english include all rpc_library head files
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rpc_library
+ * @ingroup other_service
+ * @{
+ */
+#ifndef OTHERSERVICE_RPCLIBRARY_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPCLIBRARY_H_ // NOLINT(build/header_guard)
+
+#include <other_service/rpc.h>
+#include <other_service/rpc_id.h>
+
+#endif // OTHERSERVICE_RPCLIBRARY_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/otherservice/rpc_library/library/include/rpc_internal.h b/video_in_hal/otherservice/rpc_library/library/include/rpc_internal.h
new file mode 100755
index 0000000..2b293ca
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/include/rpc_internal.h
@@ -0,0 +1,135 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_internal.h
+ * @brief RPC Library Internal Implementation-Type, macro, and function definitions used internally
+ *
+ */
+/** @addtogroup RPClib_in
+ */
+#ifndef OTHERSERVICE_RPCINTERNAL_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPCINTERNAL_H_ // NOLINT(build/header_guard)
+
+#include <unistd.h>
+#include <stdlib.h>
+
+#if defined(__linux__)
+/* Using unix autobind Features That Are Only Available in linux */
+#define RPC_USE_UNIX_AUTOBIND
+#endif /* __linux__ */
+
+#define RPC_USE_SYSLOG
+
+typedef RPC_ID *RPC_ID_p;
+
+#include "rpc_udp.h"
+#include "rpc_thread.h"
+
+RPC_Result RpcQueueAPIRequestBefore(RpcIdInfo *id,
+ UINT32 size, char **buff);
+RPC_Result RpcQueueAPIRequestAfter(RpcIdInfo *id, RPC_ID client,
+ const char *mesg, UINT32 size,
+ char *args);
+void RpcFreeAPIArgsString(char *args_string);
+UINT16 RpcGetAPIRequest(RpcIdInfo *id, RPC_ID_p client,
+ char **args_string, unsigned int *args_size);
+RPC_Result RpcSetAPIcallReturn(RpcIdInfo *id,
+ const char *mesg, UINT32 size);
+void RpcDiscardAPIcallReturn(RpcIdInfo *id);
+
+RPC_Result RpcDeleteSrvrPid(RpcIdInfo *idinfo, RPC_ID srvr_rpc_id, int wd);
+
+#define StrEqual(a, b) (strcmp((a), (b)) == 0)
+#define MemEqual(a, b, c) (memcmp((a), (b), (c)) == 0)
+
+#define RPC_IS_INVALID_ID(a) ((a) == RPC_NO_ID)
+#define RPC_INVALIDATE_ID(a) ((a) = RPC_NO_ID)
+#define RPC_ID_COPY(a, b) ((a) = (b))
+#define RPC_ID_Equal(a, b) ((a) == (b))
+
+/* inotify Events read Sizes */
+#define EVENT_SIZE ( sizeof(struct inotify_event) ) /* One inotify event size */
+#define BUF_LEN (4 * EVENT_SIZE) /* Read sizes */
+
+#define LESS_THAN <
+
+#define SET_NONBLOCK(fd) { \
+ int flag; \
+ flag = fcntl((fd), F_GETFL, 0); \
+ fcntl((fd), F_SETFL, O_NONBLOCK|flag); \
+ }
+
+#define SET_CLOSE_ON_EXEC(fd) { \
+ int flag; \
+ flag = fcntl((fd), F_GETFD, 0); \
+ fcntl((fd), F_SETFD, FD_CLOEXEC|flag); \
+ }
+
+#if defined(RPC_USE_SYSLOG)
+
+#include <syslog.h>
+
+#define RPC_LOG_CRIT(format, arg...) syslog(LOG_CRIT, format "\n", ##arg)
+#define RPC_LOG_ERR(format, arg...) syslog(LOG_ERR, format "\n", ##arg)
+#define RPC_LOG_STATE(format, arg...) syslog(LOG_INFO, format "\n", ##arg)
+#define RPC_LOG_DEBUG(format, arg...) syslog(LOG_DEBUG, format "\n", ##arg)
+
+#else // defined(RPC_USE_SYSLOG)
+
+#define RPC_LOG_CRIT(format, arg...) fprintf(stderr, "[RPC:CRIT](%d): " format "\n", getpid(), ##arg)
+#define RPC_LOG_ERR(format, arg...) fprintf(stderr, "[RPC:ERR](%d): " format "\n", getpid(), ##arg)
+#define RPC_LOG_STATE(format, arg...) fprintf(stderr, "[RPC:STATE](%d): " format "\n", getpid(), ##arg)
+#define RPC_LOG_DEBUG(format, arg...)
+
+#endif // defined(RPC_USE_SYSLOG)
+
+#include <sys/prctl.h>
+
+#define RPC_LOG_ERR_W_NAME(format, arg...) \
+do { \
+ char name[16]; \
+ prctl(PR_GET_NAME, name); \
+ name[15] = '\0'; \
+ RPC_LOG_ERR("(%s): " format, name, ##arg); \
+} while (0)
+
+#define RPC_LOG_PERROR(format, arg...) RPC_LOG_ERR("[%s:%d] %s : " format, __FILE__, __LINE__, strerror(errno), ##arg);
+
+#include <assert.h>
+#define rpc_assert assert
+
+#define BUG_ASSERT(cond, x) \
+ if (!(cond)) { \
+ rpc_assert("BUG ASSERTION! " #x " @ " __FILE__ ==NULL); \
+ }
+#define CONFIG_ASSERT(s) rpc_assert((s) == NULL)
+
+#define RUNS_IN_CALLERS_THREAD
+#define RUNS_IN_READING_THREAD
+
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+
+#define RPC_SOCKET_NAME "/tmp/RPC/%05d"
+
+static inline void
+rpc_set_socket_name(char *str, RPC_ID id) {
+ sprintf(str, RPC_SOCKET_NAME, id); // NOLINT (readability/nolint)
+}
+
+#endif /* !AUTOBIND */
+
+#endif // OTHERSERVICE_RPCINTERNAL_H_
diff --git a/video_in_hal/otherservice/rpc_library/library/include/rpc_thread.h b/video_in_hal/otherservice/rpc_library/library/include/rpc_thread.h
new file mode 100755
index 0000000..819e5a6
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/include/rpc_thread.h
@@ -0,0 +1,240 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_RPCTHREAD_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPCTHREAD_H_ // NOLINT(build/header_guard)
+
+#include <pthread.h>
+
+/** @addtogroup RPClib_in
+ * @{
+ */
+
+#define RPC_NO_SOCKET -1
+#define RPC_NO_THREAD 0
+
+#define RPC_MAIN_SUB_COMMAND "%-2d %-16lx"
+#define RPC_MAIN_SUB_COMMAND_SIZE 20
+#define RPC_MAIN_SUB_COMMANDs "%d %lx"
+/** Type of command sent from the main thread to the subthread */
+enum {
+ RPC_COMMAND_ADD_SERVER, /* Addition of RPC_ID */
+ RPC_COMMAND_REMOVE_SERVER, /* Remove RPC_ID */
+ RPC_COMMAND_EXIT, /* Sub-thread termination (when all RPC_ID are exhausted) */
+};
+
+#define APICALL_TIMEOUT_DEFAULT -1
+
+/** Periodic checking timeout (mSec) for detecting deadlocks */
+#define TIMEOUT_FOR_DEADLOCK_CHECK 1000
+
+/** Length of the socket name
+ API request datagram socket = '\0' + "5-digit number associated with RPC_ID"
+ Authentication stream socket = '\0' + "secure_" + "5-digit number associated with RPC_ID" */
+#define SOCK_NAME_LEN (1+5) /* API request datagram socket */
+#define SECURE_SOCK_NAME_LEN (1+12) /* Authentication stream socket */
+
+#define rpc_mutex_lock pthread_mutex_lock
+#define rpc_mutex_unlock pthread_mutex_unlock
+
+/** Upper limit of UID and GID list registration */
+#define CREDENTIAL_LIST_NUM_MAX 32
+
+/** Authentication result to be sent to the client */
+typedef struct {
+ UINT16 certify_res; /**< Client Authentication Result */
+ pid_t srvr_pid; /**< Server PID */
+} RpcCertifyResult;
+
+#define CERTIFY_OK 0
+#define CERTIFY_NG 1
+
+/** Received API call request */
+typedef struct {
+ RPC_ID client; /**< API ID of the requested program */
+ UINT16 api_num; /**< Calling API number */
+ char *args_string; /**< API Call Arguments */
+ UINT32 args_size; /**< Number of bytes in the argument */
+} rpc_apicall_queue;
+
+/** Source Client Socket Name Management Table */
+typedef struct RpcClientSockNameInfoST RpcClientSockNameInfo;
+struct RpcClientSockNameInfoST {
+ char client_sock_name[SOCK_NAME_LEN]; /**< Socket Name List for Source Client */
+ pid_t pid; /**< Source pid */
+ uid_t uid; /**< Source uid */
+ gid_t gid; /**< Source gid */
+ int wd; /**< Non-negative inotify monitored descriptors */
+ RpcClientSockNameInfo *next; /**< Pointer to the next node */
+};
+
+/** Communication server PID management table */
+typedef struct RpcSrvrPidInfoST RpcSrvrPidInfo;
+struct RpcSrvrPidInfoST {
+ RPC_ID srvr_rpc_id; /**< Communication destination server RPC_ID */
+ pid_t srvr_pid; /**< Communication destination server pid */
+ int wd; /**< Non-negative inotify monitored descriptors */
+ RpcSrvrPidInfo *next; /**< Pointer to the next node */
+};
+
+/** Buffer structure for API call acceptance processing.
+ * This function is allocated only when the dispatch function is specified by RPC_start().
+ */
+typedef struct {
+ RPC_dispatch_func_t dispatch_func;/**< Dispatch Functions to APIs (in stub) */
+#define RPC_apicall_dispatch_func(id) \
+ ((id)->apicall ? (id)->apicall->dispatch_func : 0)
+
+ INT32 pipe_sub_main[2];/**< Notification pipe from the subthread to the main thread */
+#define RPC_pipe_sub_main(th) ((th)->srvr_id->apicall->pipe_sub_main)
+
+ UINT16 num_queue;/**< Number of queued API call requests */
+#define RPC_apicall_num_queue(id) \
+ ((id)->apicall ? (id)->apicall->num_queue : 0)
+#define RPC_apicall_num_queue_inc(id) ((id)->apicall->num_queue++)
+#define RPC_apicall_num_queue_dec(id) ((id)->apicall->num_queue--)
+
+ rpc_apicall_queue queue[RPC_MAX_APICALL_QUEUE];/**< Queuing API Call Requests (FIFO) */
+#define RPC_apicall_queue(id, i) ((id)->apicall->queue[(i)])
+#define RPC_apicall_queue_client(id, i) ((id)->apicall->queue[(i)].client)
+#define RPC_apicall_queue_api_num(id, i) ((id)->apicall->queue[(i)].api_num)
+#define RPC_apicall_queue_args(id, i) ((id)->apicall->queue[(i)].args_string)
+#define RPC_apicall_queue_args_size(id, i) ((id)->apicall->queue[(i)].args_size)
+
+ RPC_ID in_process_client;/**< Clients running on ID */
+#define RPC_apicall_in_process_client(id) ((id)->apicall->in_process_client)
+
+ INT32 timeout_sec;/**< API processing timeout */
+#define RPC_apicall_api_timeout_sec(id) ((id)->apicall->timeout_sec)
+
+ INT32 secure_check;/**< Client Authentication Check Enabled/Disabled */
+#define RPC_secure_check(id) ((id)->apicall->secure_check)
+
+ INT32 regist_credential_info;/**< Registration of authentication information */
+#define RPC_regist_credential_info(id) ((id)->apicall->regist_credential_info)
+
+ uid_t *uid_list;/**< List of UIDs that can communicate */
+#define RPC_uid_list(id, i) ((id)->apicall->uid_list[(i)])
+
+ INT32 uid_num;/**< Number of UID list elements that can communicate */
+#define RPC_uid_num(id) ((id)->apicall->uid_num)
+
+ gid_t *gid_list;/**< GID list that can communicate */
+#define RPC_gid_list(id, i) ((id)->apicall->gid_list[(i)])
+
+ INT32 gid_num;/**< Number of GID list elements that can communicate */
+#define RPC_gid_num(id) ((id)->apicall->gid_num)
+
+ RpcClientSockNameInfo *sock_info_head;/**< Leading node of the source client's socket information management table */
+#define RPC_sock_info_head(id) ((id)->apicall->sock_info_head)
+#define RPC_client_sock_name(id) ((id)->apicall->sock_info_head->client_sock_name)
+#define RPC_client_sock_pid(id) ((id)->apicall->sock_info_head->pid)
+#define RPC_client_sock_next_node(id) ((id)->apicall->sock_info_head->next)
+
+ INT32 client_sock_name_num;/**< Number of elements in the source client's socket name list */
+#define RPC_client_sock_name_num(id) ((id)->apicall->client_sock_name_num)
+#define RPC_client_sock_name_num_inc(id) ((id)->apicall->client_sock_name_num++)
+#define RPC_client_sock_name_num_dec(id) ((id)->apicall->client_sock_name_num--)
+} RpcApicallInfo;
+
+struct RpcThreadInfo;
+
+/** Structure that holds information about each RPC_ID */
+typedef struct RpcIdInfo {
+ struct RpcThreadInfo *thread_info;
+
+ RPC_ID port;/**< Port number (=ID) used by the RPC library */
+#define RPC_port(id) ((id)->port)
+#define RPC_my_id(id) RPC_port(id)
+#define rpc_get_port(id) (id)
+
+ INT32 sock;/**< Sockets used by the RPC library */
+#define RPC_my_sock(id) ((id)->sock)
+
+ INT32 secure_sock;/**< Authentication socket used by the RPC library */
+#define RPC_my_secure_sock(id) ((id)->secure_sock)
+
+ int inotify_fd;/**< Server process monitoring inotify */
+#define RPC_clnt_inotify_fd(id) ((id)->inotify_fd)
+
+ INT32 count;/**< Number of clients using the same RPC_ID */
+#define RPC_clnt_count(id) ((id)->count)
+#define RPC_inc_clnt_count(id) ((id)->count++)
+#define RPC_dec_clnt_count(id) ((id)->count--)
+
+ RpcApicallInfo *apicall;/**< Information for API call acceptance processing */
+#define RPC_apicall_info(id) ((id)->apicall)
+
+ RpcSrvrPidInfo *srvr_pid_head;/**< Communication destination server PID management table top node */
+#define RPC_srvr_pid_head(id) ((id)->srvr_pid_head)
+#define RPC_srvr_rpc_id(id) ((id)->srvr_pid_head->srvr_rpc_id)
+#define RPC_srvr_pid(id) ((id)->srvr_pid_head->srvr_pid)
+#define RPC_srvr_pid_next_node(id) ((id)->srvr_pid_head->next)
+
+ UINT32 return_str_len;/**<Number of bytes in the returned string as a result of an API call*/
+ /* Including the terminating '\0' */
+#define RPC_apicall_return_str_len(id) ((id)->return_str_len)
+
+ UINT8 *return_str;/**<String returned as a result of an API call*/
+#define RPC_apicall_return_str(id) ((id)->return_str)
+} RpcIdInfo;
+
+/** Received response packet */
+typedef struct {
+ RPC_ID id;/**< ID of the thread that sent the response */
+ UINT16 type;/**< Response type */
+ UINT32 seq_num;/**< The packet number to which this was sent (the response to this) */
+} RpcResponse;
+
+/** Structure that stores the state of each thread that called the RPC library */
+typedef struct RpcThreadInfo {
+ pthread_mutex_t th_mtx;/**< Mutex for modifying this struct */
+#define RPC_THREAD_MUTEX_LOCK(th) (rpc_mutex_lock(&((th)->th_mtx)))
+#define RPC_THREAD_MUTEX_UNLOCK(th) (rpc_mutex_unlock(&((th)->th_mtx)))
+
+ pthread_t thread;/**< Thread calling the RPC library */
+#define RPC_main_thread(th) ((th)->thread)
+
+ UINT32 sequence_number;/**< Sequence number given to the transmitted packet */
+ /* Send 30 times per second from the beginning of the thread, then wrap around two years.
+ * It is not necessary to wrap around 0 because there is no comparison.
+ */
+ UINT32 magic;/**< Magic number to detect corrupted memories */
+
+ RpcIdInfo *srvr_id;/**< Information by RPC_ID (server) */
+#define RPC_srvr_idinfo(th) ((th)->srvr_id)
+
+ RpcIdInfo *clnt_id;/**< Info by RPC_ID (client) */
+#define RPC_clnt_idinfo(th) ((th)->clnt_id)
+} RpcThreadInfo;
+
+extern pthread_t g_rpc_thread;
+extern UINT32 g_rpc_thread_alive;
+
+#define PIPE_READ 0
+#define PIPE_WRITE 1
+extern int g_rpc_pipe_main_sub[2];
+
+RpcThreadInfo *RpcMyThreadInfo(void);
+RpcThreadInfo *RpcCreateThreadInfo(void);
+int RpcCreateIdInfo(RpcThreadInfo *th, RPC_ID id,
+ RPC_dispatch_func_t dispatch, INT32 secure_check);
+void RpcDestroyIdInfo(RpcThreadInfo *th, RpcIdInfo *idinfo);
+void RpcDestroyThreadInfo(void);
+void RpcUnlinkSocketFiles(void);
+
+/** @} */
+#endif // OTHERSERVICE_RPCTHREAD_H_
diff --git a/video_in_hal/otherservice/rpc_library/library/include/rpc_udp.h b/video_in_hal/otherservice/rpc_library/library/include/rpc_udp.h
new file mode 100755
index 0000000..8c45ce6
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/include/rpc_udp.h
@@ -0,0 +1,162 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OTHERSERVICE_RPCUDP_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_RPCUDP_H_ // NOLINT(build/header_guard)
+
+/** @addtogroup RPClib_in */
+/** @{ */
+/** Number of bytes of payload that can be stored in a UDP packet */
+#define RPC_UDP_PAYLOAD RPC_MAX_API_ARG_TOTAL_SIZE
+
+/** UDP packet header
+ *
+ * Packet type, source ID, sequence number, packet size, packet position
+ */
+#define RPC_PACKET_HEADER "%-2d %-5x %-8x %-4u %1d "
+/** Number of bytes in the UDP packet header
+ */
+#define RPC_PACKET_HEADER_LEN (2+1 + 5+1 + 8+1 + 4+1 + 1+1)
+
+/** Number of bytes to store in the UDP packet */
+#define RPC_UDP_PACKET_SIZE (RPC_UDP_PAYLOAD + RPC_PACKET_HEADER_LEN)
+
+#define RPC_COMMAND_LEN 3
+
+/** Format string for UDP packet header analysis */
+#define RPC_PACKET_HEADER_scanf "%d %x %x %d"
+
+/** Header (API number) to be added to the API call packet */
+#define RPC_APICALL_FORMAT "%-4d "
+/** Number of bytes in the header of an API call packet */
+#define RPC_APICALL_FORMAT_ARGS_START 5
+
+#define RPC_MAX_RESPONSE_MESSAGE_SIZE 5
+
+#define RPC_SEQ_NUM_START 1
+#define RPC_SEQ_NUM_INVALID 0
+
+/** Internal API call number for checking server existence */
+#define RPC_API_NUM_RPC_ALIVE 0
+
+/** Type of packet that the RPC library sends */
+typedef enum {
+ RPC_PACKET_APICALL = 0,/**< API call request */
+
+ RPC_RESPONSE_APICALL,/**< Responding to API Call Requests */
+#define RPC_RESPONSE_NONE 0x0000
+#define RPC_RESPONSE_API_OK 0x0001
+#define RPC_RESPONSE_API_BUSY 0x0002
+#define RPC_RESPONSE_API_ERR 0x0004
+#define RPC_RESPONSE_API_DEADLOCK 0x0005 /* Server deadlock */
+#define RPC_RESPONSE_API_CERTIFY 0x0006 /* Authentication request */
+
+ RPC_PACKET_APIRETURN,/**< Result of the API call */
+
+ RPC_PACKET_NONE,
+} RPC_packet_type;
+
+/** Packet Location (Multi-Fragment Packet Support) */
+typedef enum {
+ RPC_PACKET_POS_ONEANDONLY = 0,/**< Complete with one packet */
+} rpc_packet_position;
+
+/** Transmitting buffer */
+typedef struct {
+ unsigned int bytes;
+ const void *buf;
+} rpc_send_buf;
+
+/** Valid bytes in the sockaddr_un struct specified for send */
+#define RPC_SOCKET_NAME_LEN 6 /**< Name: 5 characters + first NULL bytes */
+#define RPC_SOCKET_ADDR_LEN (sizeof(short) + RPC_SOCKET_NAME_LEN) // NOLINT (readability/nolint)
+
+enum {
+ RPC_SEND_TO_CLIENT,
+ RPC_SEND_TO_SERVER,
+ RPC_SEND_TO_SERVER_NO_RETRY,
+};
+
+struct RpcIdInfo;
+
+int RpcSendUdp(struct RpcIdInfo *id, RPC_ID receiver, int direction,
+ RPC_packet_type type, const void *mesg, unsigned int bytes);
+int RpcSendUdp2(struct RpcIdInfo *id, RPC_ID receiver, int direction,
+ RPC_packet_type type, unsigned int num, rpc_send_buf *sendbuf);
+RPC_Result RpcSendUdpResponse(struct RpcIdInfo *id, RPC_ID receiver,
+ int direction,
+ RPC_packet_type type,
+ UINT32 seq_num, char *mesg, UINT32 bytes);
+
+int RpcReadUdpPacket(const struct RpcIdInfo *id, UINT8 *buf);
+
+RPC_Result RpcParsePacketHeader(const char *str, RPC_packet_type *command,
+ RPC_ID_p id, UINT32 *seq_num, UINT32 *size);
+
+RPC_Result RpcClientWaitResponse(struct RpcIdInfo *idinfo,
+ UINT32 seq_num,
+ UINT32 timeout_msec, UINT16 *response);
+RPC_Result RpcClientWaitResult(struct RpcIdInfo *idinfo, RPC_ID srvr_id);
+
+#if defined(RPC_USE_UNIX_AUTOBIND)
+/* ===pathname of datagram sockets for API requests=== */
+static inline void
+RpcSetServerName(char *str, RPC_ID id) {
+ *str = '\0';
+ sprintf(str + 1, "S%04x", id); // NOLINT (readability/nolint)
+}
+
+static inline void
+RpcSetClientName(char *str, RPC_ID id) {
+ *str = '\0';
+ sprintf(str + 1, "%05x", id); // NOLINT (readability/nolint)
+}
+
+static inline void
+RpcGetClientName(const char *str, RPC_ID *id) {
+ char buf[6];
+ memcpy(buf, str + 1, 5);
+ buf[5] = '\0';
+ if (buf[1] == 'X') {
+ *id = (RPC_ID)(strtoul(buf + 1, NULL, 16));
+ } else {
+ *id = (RPC_ID)(strtoul(buf, NULL, 16));
+ }
+}
+
+/* ===pathname of stream-socket for authenticating=== */
+static inline void
+RpcSetServerSecureName(char *str, RPC_ID id) {
+ *str = '\0';
+ sprintf(str + 1, "secure_S%04x", id); // NOLINT (readability/nolint)
+}
+
+static inline void
+RpcSetClientSecureName(char *str, RPC_ID id) {
+ *str = '\0';
+ sprintf(str + 1, "secure_%05x", id); // NOLINT (readability/nolint)
+}
+
+static inline void
+RpcGetClientNameFromSock(const char *str, char *client_sock_name) {
+ memcpy(client_sock_name, str + 8, 5);
+ client_sock_name[5] = '\0';
+}
+
+#endif /* !AUTOBIND */
+
+/** @} */
+#endif // OTHERSERVICE_RPCUDP_H_
diff --git a/video_in_hal/otherservice/rpc_library/library/librpc.ver b/video_in_hal/otherservice/rpc_library/library/librpc.ver
new file mode 100755
index 0000000..2fbb9dc
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/librpc.ver
@@ -0,0 +1,29 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+######################
+# rpc version script #
+######################
+{
+ global:
+ ### .text section ###
+ RPC_*;
+ ### .data section ###
+ local:
+ *;
+};
+
+
diff --git a/video_in_hal/otherservice/rpc_library/library/src/rpc_event.c b/video_in_hal/otherservice/rpc_library/library/src/rpc_event.c
new file mode 100755
index 0000000..2e3fd38
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/src/rpc_event.c
@@ -0,0 +1,158 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_event.c
+ * @brief RPC Library Internal Implementation--Event Handling
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <native_service/cl_monitor.h>
+
+#include <other_service/rpc.h>
+#include "rpc_internal.h"
+
+/** @ingroup RPClib_in
+ */
+RUNS_IN_READING_THREAD
+RPC_Result
+RpcQueueAPIRequestBefore(RpcIdInfo *id, UINT32 size, char **buff) {
+ RPC_THREAD_MUTEX_LOCK(id->thread_info);
+
+ int n = RPC_apicall_num_queue(id); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_thread.h
+
+ if (n >= RPC_MAX_APICALL_QUEUE) {
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info);
+ RPC_LOG_STATE("Returned BUSY.");
+ return RPC_ERR_Busy;
+ } else {
+ *buff = rpc_malloc(size);/* malloc */
+ if (*buff == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc function malloc
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info); // LCOV_EXCL_START 5: fail safe for libc function malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_STATE("queue API request: No Memory");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ }
+ return RPC_OK;
+}
+/** @ingroup RPClib_in
+ */
+RUNS_IN_READING_THREAD
+RPC_Result
+RpcQueueAPIRequestAfter(RpcIdInfo *id, RPC_ID client,
+ const char *mesg, UINT32 size, char *args) {
+ int n = RPC_apicall_num_queue(id); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_thread.h
+
+ UINT16 api_num;
+ api_num = (UINT16)strtol(mesg, NULL, 10);
+ memcpy(args, mesg + RPC_APICALL_FORMAT_ARGS_START, size);
+ RPC_ID_COPY(RPC_apicall_queue_client(id, n), client);
+ RPC_apicall_queue_api_num(id, n) = api_num;
+ RPC_apicall_queue_args(id, n) = args;
+ RPC_apicall_queue_args_size(id, n) = size;
+ RPC_apicall_num_queue_inc(id);
+
+ /* set RUN state */
+ CL_MonitorSetEntry(CL_MONITOR_TYPE_RPC,
+ RPC_port(id),
+ CL_MONITOR_STATE_RUN,
+ (uint32_t)(RPC_apicall_api_timeout_sec(id)),
+ api_num);
+
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info);
+ return RPC_OK;
+}
+
+/** @ingroup RPClib_in
+ */
+RUNS_IN_CALLERS_THREAD
+void
+RpcFreeAPIArgsString(char *args_string) {
+ if (args_string != NULL) { // LCOV_EXCL_BR_LINE 5: free the memory, malloced in RpcQueueAPIRequestBefore(...)
+ rpc_free(args_string);/* free */
+ }
+}
+
+/** @ingroup RPClib_in
+ */
+RUNS_IN_CALLERS_THREAD
+UINT16
+RpcGetAPIRequest(RpcIdInfo *id, RPC_ID_p client,
+ char **args_string, unsigned int *args_size) {
+ UINT16 api_num = 0;
+
+ RPC_THREAD_MUTEX_LOCK(id->thread_info);
+
+ UINT32 n = RPC_apicall_num_queue(id); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_thread.h
+ if (n > 0) {
+ RPC_ID_COPY(*client, RPC_apicall_queue_client(id, 0));
+ api_num = RPC_apicall_queue_api_num(id, 0);
+ *args_string = RPC_apicall_queue_args(id, 0);
+ /* this string must be freed by the caller using discard_APIcall_return()*/
+ *args_size = RPC_apicall_queue_args_size(id, 0);
+
+ if (n > 1) {
+ memmove(&(RPC_apicall_queue(id, 0)), &(RPC_apicall_queue(id, 1)),
+ (n - 1) * sizeof(RPC_apicall_queue(id, 0)));
+ }
+ RPC_apicall_num_queue_dec(id);
+ }
+
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info);
+ return api_num;
+}
+
+/** @ingroup RPClib_in
+ */
+RUNS_IN_READING_THREAD
+RPC_Result
+RpcSetAPIcallReturn(RpcIdInfo *id, const char *mesg, UINT32 size) {
+ if (RPC_apicall_return_str(id) != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ RPC_LOG_STATE("previous APIcall return string was not used"); // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RpcDiscardAPIcallReturn(id);
+ } // LCOV_EXCL_STOP
+ RPC_THREAD_MUTEX_LOCK(id->thread_info);
+
+ RPC_apicall_return_str(id) = rpc_malloc(size);/* malloc */
+ if (RPC_apicall_return_str(id) == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc function malloc
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info); // LCOV_EXCL_START 5: fail safe for libc function malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_STATE("set APIcall return: No Memory");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ RPC_apicall_return_str_len(id) = size;
+ memcpy(RPC_apicall_return_str(id), mesg, size);
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info);
+ return RPC_OK;
+}
+
+/** @ingroup RPClib_in
+ */
+RUNS_IN_CALLERS_THREAD
+void
+RpcDiscardAPIcallReturn(RpcIdInfo *id) {
+ RPC_THREAD_MUTEX_LOCK(id->thread_info);
+ if (RPC_apicall_return_str(id) != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ rpc_free(RPC_apicall_return_str(id));/* free */
+ RPC_apicall_return_str_len(id) = 0;
+ RPC_apicall_return_str(id) = NULL;
+ }
+ RPC_THREAD_MUTEX_UNLOCK(id->thread_info);
+}
diff --git a/video_in_hal/otherservice/rpc_library/library/src/rpc_lib.c b/video_in_hal/otherservice/rpc_library/library/src/rpc_lib.c
new file mode 100755
index 0000000..76f0d49
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/src/rpc_lib.c
@@ -0,0 +1,1264 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_lib.c
+ * @brief RPC Library-API Function Implementation
+ *
+ */
+/** @mainpage
+ * This document describes the following API functions, structures,
+ * type declarations, and macros.
+ * - RPC library external specification
+ * - External specifications for RPC tools
+ *
+ * For an overview of other RPC libraries and tools and anomaly processing,
+ * to reference the Word version of the documentation.
+ * (external specifications and programming guides) */
+/** @defgroup RPClib RPC library external specification */
+/** @defgroup RPCtool RPC tool (rpc_apidef) */
+/** @defgroup RPC_ID_assign RPC_ID Assignment */
+/** @defgroup RPClib_in RPC library internal specifications (incomplete) */
+/** @addtogroup RPClib
+ * @{
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/select.h>
+#include <sys/poll.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <sys/un.h>
+#include <sys/inotify.h>
+
+#include <other_service/rpc.h>
+#include "rpc_internal.h"
+
+#include <native_service/cl_process.h> // for CL_INTFY_FILENAME_FORMAT
+#include <native_service/cl_monitor.h>
+
+
+/* Prototype declarations */
+static RPC_Result ProcessAPIcallRequest(RpcIdInfo *idinfo, RPC_ID client,
+ UINT16 api_num, char *args_string,
+ unsigned int args_size);
+static RPC_Result RpcAllDeleteSrvrPid(RpcIdInfo *idinfo);
+static RPC_Result RpcClientWaitCertification(RpcIdInfo *idinfo, pid_t *srvr_pid);
+static RPC_Result RpcRegistSrvrPid(RpcIdInfo *idinfo, RPC_ID srvr_rpc_id, pid_t srvr_pid, int wd);
+
+#define THREAD_INFO_CHECK(th) \
+ if ((th) == NULL) { \
+ RPC_LOG_STATE("No thread info"); \
+ return RPC_ERR_Fatal; \
+ }
+
+#define SUB_THREAD_CHECK() \
+ if (g_rpc_thread_alive == 0) { \
+ RPC_LOG_STATE("No sub thread -- shutdown"); \
+ RpcDestroyThreadInfo(); \
+ return RPC_ERR_Fatal; \
+ }
+
+/**
+ * Waiting for response packet for API call and API result transmission
+ * Timeout time in msec.
+ * If the other program is abnormal (process termination), delay occurs in the meanwhile.
+ * Confirm the operation on the actual machine and set again.
+ */
+#define RESPONSE_WAIT_MSEC_DEFAULT 2000
+static unsigned int Response_wait_msec = RESPONSE_WAIT_MSEC_DEFAULT;
+
+char *RPC_DEBUG = NULL;
+
+#if defined(RPC_USE_UNIX_AUTOBIND)
+
+ static RPC_Result
+CreateClientIdinfo(RpcThreadInfo *th, RPC_ID *pID) {
+ if (RpcCreateIdInfo(th, *pID, NULL, NO_SECURE_CHECK) < 0) {
+ RPC_LOG_ERR("Can't create id_info");
+ return RPC_ERR_Fatal;
+ }
+
+ *pID = RPC_my_id(RPC_clnt_idinfo(th));
+ RPC_LOG_DEBUG("RPC: assigned client ID %d", *pID);
+ if (RPC_DEBUG) { // LCOV_EXCL_BR_LINE 7: debug
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("RPC[%s]: client start finished.\n", RPC_DEBUG); // LCOV_EXCL_LINE 7: debug
+ }
+ return RPC_OK;
+}
+#else /* !AUTOBIND */
+
+#include <sys/file.h>
+
+ static int
+FindUniqClientId(void) {
+#define RPC_ID_FILE_NAME "/tmp/RPC/id"
+#define RPC_MIN_CLIENT_ID 1024
+#define RPC_MAX_CLIENT_ID (1024+32768-1)
+
+ int fd, found;
+ RPC_ID id, next;
+ struct stat statbuf;
+ char fname[32];
+
+ fd = open(RPC_ID_FILE_NAME, O_RDWR|O_CLOEXEC, 0777);
+ if (fd < 0) {
+ id = RPC_MIN_CLIENT_ID;
+ fd = open(RPC_ID_FILE_NAME, O_RDWR|O_CREAT|O_CLOEXEC, 0777);
+ if (fd < 0) {
+ return -1;
+ }
+ flock(fd, LOCK_EX); // Possible sleep here
+ } else {
+ flock(fd, LOCK_EX); // Possible sleep here
+ read(fd, &id, sizeof(id));
+ }
+
+ found = 0;
+ while(found == 0) {
+ rpc_set_socket_name(fname, id);
+ if (stat(fname, &statbuf) < 0) {
+ found = 1;
+ break;
+ }
+ id++;
+ if (id > RPC_MAX_CLIENT_ID) {
+ id = RPC_MIN_CLIENT_ID;
+ }
+ }
+
+ next = id + 1;
+ if (next > RPC_MAX_CLIENT_ID) {
+ next = RPC_MIN_CLIENT_ID;
+ }
+
+ lseek(fd, 0, SEEK_SET);
+ write(fd, &next, sizeof(next));
+ flock(fd, LOCK_UN);
+ close(fd);
+
+ return id;
+}
+
+ static RPC_Result
+CreateClientIdinfo(RpcThreadInfo *th, UINT16 port) {
+ if (RpcCreateIdInfo(th, port, NULL, NO_SECURE_CHECK) < 0) {
+ RPC_LOG_ERR("Can't create id_info");
+ return RPC_ERR_Fatal;
+ }
+ // LCOV_EXCL_BR_START 7: debug
+ if (RPC_DEBUG) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("RPC[%s]: client start finished.\n", RPC_DEBUG);
+ }
+ // LCOV_EXCL_BR_STOP
+ return RPC_OK;
+}
+#endif /* AUTOBIND */
+
+/** @fn RPC_START_SERVER(ID)
+ * @brief RPC_start() macro for the server
+ *
+ * Used by RPC-API server programs to activate the RPC library.
+ * ID specifies a symbol of the form XXX_RPC_ID defined in rpc_id.h.
+ * Only one server program per thread is allowed.
+ * When a server program calls an API as a client of another server,
+ * it only needs to call RPC_START_SERVER,
+ * not RPC_START_CLIENT.
+ *
+ * RPC_end() should be called when the RPC library is no longer needed.
+ * @param ID [IN]RPC_ID of the program
+ * @see RPC_start
+ * @see RPC_end
+ */
+/** @fn RPC_START_CLIENT(pID)
+ * @brief RPC_start() macro for clients
+ *
+ * Use only the client functions of the RPC library
+ * (only calling APIs provided by other programs),
+ * This macro is used for the start process.
+ *
+ *
+ * RPC_end() should be called when the RPC library is no longer needed.
+ *
+ * @param pID [OUT]Pointer to the RPC_ID of the program
+ * @see RPC_start
+ * @see RPC_end
+ */
+/** @brief Start processing of the RPC library
+ *
+ * - With an open socket, RPC_ID, and API call dispatching functions
+ * Register in the global variable (managed separately for each thread and RPC_ID)
+ * - Starting use as a server
+ * - func specifies a function pointer (defined in stub) that is not a NULL.
+ * - Specifies a fixed ID defined in rpc_id.h as the ID.
+ * - If the same thread has already started using the server, an error code is returned.
+ * - When the server function is started for the first time in a process,
+ * one subthread is started to process received packets
+ * in the background.
+ * - Starting use as a client
+ * - NULL is specified in the func.
+ * - In principle, an invalid ID value (RPC_NO_PORT) is specified.
+ * This function automatically assigns IDs and returns the assignment result to pID.
+ * - However, if another program has already started using it as a client,
+ * it shares the socket/RPC_ID instead of creating a new socket.
+ * - Exceptionally, it is allowed to specify a fixed ID defined in rpc_id.h as the ID.
+ * This is the only way to use RPC_start() in programs
+ * where it is difficult to always call RPC_end() at the end of use by program structure/design.
+ * - In this case, the pID argument is not referenced.
+ * - The maximum number of threads that use the RPC library in a process is
+ * specified by RPC_MAX_THREADS_IN_PROCESS.
+ *
+ * @param id [IN]RPC_ID of the program (in the case of RPC_NO_PORT, this means automatic assignment)
+ * @param dispatch_func Dispatching functions (defined in stub files for servers,
+ * and NULL specified in programs that do not provide APIs)
+ * @param pID [OUT]RPC_ID of the automatically assigned program
+ *
+ * @retval RPC_OK: normal completion
+ * @retval Otherwise: Abnormal termination (FATAL)
+ *
+ * @note Normally, this function is not called directly, but the following macro is used.
+ * - RPC_START_SERVER(ID)
+ * For programs that provide RPC server functions.
+ * This macro is also used when both server and client functions are used.
+ * - RPC_START_CLIENT(pID)
+ * For programs that use only the RPC client function.
+ */
+ RPC_Result
+RPC_start(RPC_ID id, RPC_dispatch_func_t func, RPC_ID *pID, INT32 secure_check)
+{
+#if defined(RPC_USE_SYSLOG)
+ static int init_syslog = 0;
+
+ if (init_syslog == 0) {
+ openlog("librpc", LOG_PID, LOG_USER);
+ setlogmask(LOG_UPTO(LOG_INFO));
+ /* setlogmask(LOG_MASK(LOG_DEBUG)); */
+ init_syslog = 1;
+ if (func != NULL)
+ RPC_LOG_STATE("RPC_START_SERVER(%#x)\n", id);
+ }
+#endif /* RPC_USE_SYSLOG */
+
+ if (func != NULL && id == RPC_NO_ID) { /* No ID is specified despite as a server */
+ RPC_LOG_ERR("Invalid RPC_start server arg");
+ return RPC_ERR_Fatal;
+ }
+ if (func != NULL && pID != NULL) { /* Requested obtaining pID despite as a server */ // LCOV_EXCL_BR_LINE 200: macro guarantee impossible both not NULL, RPC_START_***
+ RPC_LOG_ERR("Invalid RPC_start server arg"); // LCOV_EXCL_START 200: macro guarantee impossible both not NULL, RPC_START_***
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ if (func == NULL && id != RPC_NO_ID) { /* Specified ID despite as a client */
+ RPC_LOG_ERR("Invalid RPC_start server arg");
+ return RPC_ERR_Fatal;
+ }
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ if (func == NULL && pID == NULL) {
+ /* pID is NULL despite as a client (not supported for ID-specified clients) */
+ RPC_LOG_ERR_W_NAME("RPC_Start(ID, NULL, NULL) is no longer supported, ID is auto-assigned");
+ return RPC_ERR_Fatal;
+ }
+#else /* !AUTOBIND */
+ if (func == NULL && id == RPC_NO_ID && pID == NULL) {
+ /* pID is NULL despite as an auto-assigned client */
+ RPC_LOG_ERR("Invalid RPC_start arg");
+ return RPC_ERR_Fatal;
+ }
+#endif /* !AUTOBIND */
+ if ((secure_check != NO_SECURE_CHECK) && (secure_check != NEED_SECURE_CHECK)) { // LCOV_EXCL_BR_LINE 200: macro guarantee only two value, RPC_START_***
+ /* Check Arguments for Client Authentication */
+ RPC_LOG_ERR("Invalid RPC_start arg"); // LCOV_EXCL_START 200: macro guarantee only two value, RPC_START_***
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ if (th == NULL) {
+ th = RpcCreateThreadInfo();
+ if (th == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ return RPC_ERR_Fatal;
+ }
+ }
+
+ /* RPC_start is already done in the same thread */
+ if (func != NULL) {/* Server start */
+ if (RPC_srvr_idinfo(th) != NULL) {/* Server already started */
+ RPC_LOG_ERR("duplicated RPC_START_SERVER");
+ return RPC_ERR_Fatal;
+ }
+ } else { /* Client start */
+ if (RPC_clnt_idinfo(th) != NULL) {/* Client already started */
+ if (pID != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ *pID = (RPC_clnt_idinfo(th))->port;
+ RPC_LOG_DEBUG("use existing client ID=%d", *pID);
+ RPC_inc_clnt_count(RPC_clnt_idinfo(th));
+ }
+ /*
+ * When pID == NULL (RPC_ID fixed), there is no guarantee
+ * that RPC_end() will be called as many times as needed, so it does not count up.
+ */
+ return RPC_OK;
+ }
+ }
+
+ if (func == NULL) {/* Client start */
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ /* Automatically assign everything without supporting ID specification */
+ RPC_ID id_local = RPC_NO_ID;
+ RPC_Result ret = CreateClientIdinfo(th, &id_local);
+ if(RPC_OK != ret) return ret;
+
+ if (pID) { // LCOV_EXCL_BR_LINE 6: double check
+ *pID = id_local;
+ }
+ RPC_clnt_inotify_fd(RPC_clnt_idinfo(th)) = inotify_init1(IN_CLOEXEC);
+ return ret;
+#else /* !AUTOBIND */
+ if (id == RPC_NO_ID) {
+ /* No port number specified -> Automatically assign an ID and port number here */
+ /*
+ * FindUniqClientId() returns ID within the range of RPC_MIN_CLIENT_ID(1024) to RPC_MAX_CLIENT_ID(1024+32768-1)
+ */
+ int ret;
+ ret = FindUniqClientId();
+ if (ret < 0) {
+ return RPC_ERR_Fatal;
+ }
+ /* pID != NULL is already checked */
+ *pID = (UINT16)ret;
+ return CreateClientIdinfo(th, *pID);
+ } else {
+ /*
+ * Client start with specified port number
+ * Programs that cannot guarantee an RPC_end() call
+ * at termination specify a fixed RPC_ID from the upper level and use it.
+ * (To avoid memory shortage caused by building up socket-files in /tmp/RPC)
+ */
+ return CreateClientIdinfo(th, id);
+ }
+#endif /* !AUTOBIND */
+ }
+
+ /* Dispatch func specified (servers) -> bind */
+ CL_MonitorInit(CL_MONITOR_INIT_USER); /* Using the API for Error Monitoring */
+
+ if (RpcCreateIdInfo(th, id, func, secure_check) < 0) {
+ RPC_LOG_ERR("Can't create id_info");
+ return RPC_ERR_Fatal;
+ }
+
+ if (RPC_DEBUG) { // LCOV_EXCL_BR_LINE 7: debug
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("RPC[%s]: server thread invoked\n", RPC_DEBUG); // LCOV_EXCL_LINE 7: debug
+ }
+ char *env;
+ if ((env = getenv("RPC_RESPONSE_WAIT")) != NULL) {
+ Response_wait_msec = (unsigned int)strtol(env, NULL, 10);
+ }
+
+ return RPC_OK;
+}
+
+ static void
+RpcEndSub(RpcThreadInfo *th, RpcIdInfo *idinfo) {
+ int sockfd;
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+ char path[120];
+
+ rpc_set_socket_name(path, RPC_my_id(idinfo));
+#endif /* !AUTOBIND */
+ sockfd = idinfo->sock;
+ RpcDestroyIdInfo(th, idinfo);
+ close(sockfd);
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+ unlink(path);
+#endif /* !AUTOBIND */
+}
+
+/** @brief RPC Library End-of-Use Processing
+ *
+ * - Perform termination processing such as closing the opened socket, releasing the memory.
+ * (Server/Client Common)
+ * - If there are no programs in the thread that use RPC_ID,
+ * the subthread started by RPC_start is terminated.
+ * - Each RPC_ID must be called before the program exits.
+ * - RPC_end must be called by the thread that performed the RPC_start.
+ * - Ignored unused or no longer used RPC_ID if specified.
+ *
+ * @param ID [IN]RPC_ID of the program
+ */
+ void
+RPC_end(RPC_ID id) {
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ if (th == NULL) {
+ return;
+ }
+ RpcIdInfo *idinfo;
+ idinfo = RPC_srvr_idinfo(th);
+ if (idinfo != NULL && RPC_my_id(idinfo) == id) {/* srvr */
+ RpcEndSub(th, idinfo);
+ }
+
+ idinfo = RPC_clnt_idinfo(th);
+ if (idinfo != NULL && RPC_my_id(idinfo) == id) {/* client */
+
+ RPC_dec_clnt_count(idinfo);
+ if (RPC_clnt_count(idinfo) == 0) {
+ /* Deleting management table of the communication destination server PID */
+ RpcAllDeleteSrvrPid(idinfo);
+ close(RPC_clnt_inotify_fd(idinfo));
+
+ RpcEndSub(th, idinfo);
+ }
+ }
+ if (RPC_srvr_idinfo(th) == NULL && RPC_clnt_idinfo(th) == NULL) {
+ RPC_LOG_DEBUG("destroy thread info %p", th);
+ RpcDestroyThreadInfo();
+ }
+}
+
+/** @brief RPC library use termination processing (forced cleanup at process termination)
+ *
+ * Deletes the socket file created for RPC communication in the process.
+ * For to release the resources of programs that use the RPC library with RPC_end() in principle,
+ * but this API is an insurance process to eliminate socket file leaks.
+ *
+ * - Since it is assumed that the socket is called immediately before the process terminates,
+ * closing sockets and releasing memory is not performed automatically when the process terminates.
+ * - All RPC processing (both server and client) after this API call cannot be used.
+ * Operation is not guaranteed even if RPC_START is performed again after that.
+ *
+ * No action for versions of the RPC library that use Unix autobind.
+ */
+ void
+RPC_end_all(void) {
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+ RpcUnlinkSocketFiles();
+#endif
+}
+
+/**
+ * @fn RPC_Result RPC_set_API_timeout(RPC_ID id, UINT32 sec)
+ * @brief Setting the timeout period during server API processing
+ *
+ * @param sec [IN] Timeout (sec) Set within the range of 1 to 60 sec.
+ *
+ * @retval RPC_OK: normal completion
+ * @retval RPC_ERR_Configuration: Argument out of range
+ * @retval RPC_ERR_Fatal: Fatal error
+ */
+ RPC_Result
+RPC_set_API_timeout(INT32 sec) {
+ /* param check */
+ if ((sec > 60) || (sec < 1)) {
+ RPC_LOG_ERR( "RPC_set_API_timeout() : Invalid Param." );
+ return RPC_ERR_Configuration;
+ }
+
+ /* thread_info check */
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ THREAD_INFO_CHECK(th);
+
+ /* thread_info->id_info check */
+ if (RPC_srvr_idinfo(th) != NULL ) { // LCOV_EXCL_BR_LINE 200: server start abnormal can't test
+ RpcIdInfo *idinfo = RPC_srvr_idinfo(th);
+
+ /* thread_info->id_info->apicall_info check */
+ if( RPC_apicall_info(idinfo) != NULL ) { // LCOV_EXCL_BR_LINE 200: server start abnormal can't test
+ RPC_apicall_api_timeout_sec(idinfo) = sec;
+ } else { // LCOV_EXCL_START 200: server start abnormal can't test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR( "No apicall_info" );
+ return RPC_ERR_Fatal;
+ }
+
+ } else {
+ RPC_LOG_STATE("No srvr_id info");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ return RPC_OK;
+}
+
+
+/** @brief API call execution function (client side)
+ *
+ * (These functions are called from within a client-facing STUB. Users never use these directly.)
+ */
+ RPC_Result
+RPC_API_call(RPC_ID server, UINT16 api_num,
+ const char *args_string, unsigned int args_size,
+ char **ret_string, unsigned int *ret_size) {
+ *ret_string = NULL;
+
+ RpcThreadInfo *th = RpcMyThreadInfo();
+
+ THREAD_INFO_CHECK(th);
+
+ RpcIdInfo *idinfo;
+ idinfo = RPC_clnt_idinfo(th);
+
+ pid_t srvr_pid;
+
+ if (idinfo == NULL) { // LCOV_EXCL_BR_LINE 8: dead code, idinfo always isn't NULL
+ /*
+ * In the past, the remedy of uninitialized clients has been done here.
+ * However, because it becomes to accumulate garbage in the /tmp/RPC by changing UNIX sockets,
+ * as an error without remedies.
+ */
+ // LCOV_EXCL_START 8: dead code, idinfo always isn't NULL
+ RPC_LOG_ERR_W_NAME("warning!!! RPC call without RPC_start(): server=%d, api_num=%d", server, api_num);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ RPC_ID id = RPC_NO_ID;
+ RPC_Result ret = CreateClientIdinfo(th, &id);
+#else /* !AUTOBIND */
+ int id;
+ id = FindUniqClientId();
+ if (id < 0) {
+ return RPC_ERR_Fatal;
+ }
+ RPC_Result ret = CreateClientIdinfo(th, (UINT16)id);
+#endif /* !AUTOBIND */
+ if (ret != RPC_OK) {
+ return ret;
+ }
+ idinfo = RPC_clnt_idinfo(th);
+ if (idinfo == NULL) {
+ return RPC_ERR_Fatal;
+ }
+ } // LCOV_EXCL_STOP
+
+ char api_head[RPC_APICALL_FORMAT_ARGS_START + 1];
+ sprintf(api_head, RPC_APICALL_FORMAT, api_num);
+
+ rpc_send_buf sendbuf[2];
+ sendbuf[0].buf = api_head;
+ sendbuf[0].bytes = RPC_APICALL_FORMAT_ARGS_START;
+ if (args_size > 0) {
+ sendbuf[1].buf = args_string;
+ sendbuf[1].bytes = args_size;
+ }
+
+ int seq_num;
+
+send_api_call:
+ seq_num = RpcSendUdp2(idinfo, server,
+ (api_num == RPC_API_NUM_RPC_ALIVE
+ ? RPC_SEND_TO_SERVER_NO_RETRY
+ : RPC_SEND_TO_SERVER),
+ RPC_PACKET_APICALL,
+ (args_size > 0) ? 2 : 1, sendbuf);
+ if (seq_num < 0) {
+ return RPC_ERR_No_Response;
+ }
+
+ // wait for response
+ UINT16 response;
+ RPC_Result result = RpcClientWaitResponse(idinfo, (UINT32)seq_num, Response_wait_msec,
+ &response);
+ if (result != RPC_OK) {
+ return result;
+ }
+
+ if (response == RPC_RESPONSE_API_BUSY) { /* Server is busy */
+ return RPC_ERR_Busy;
+ } else if (response == RPC_RESPONSE_API_ERR) { /* API call error */
+ RPC_LOG_STATE("APIcall error (can't queue)");
+ return RPC_ERR_Fatal;
+ } else if (response == RPC_RESPONSE_API_DEADLOCK) { /* Server is in deadlock */
+ RPC_LOG_STATE("server DeadLock.");
+ return RPC_ERR_Server_DeadLock;
+ } else if (response == RPC_RESPONSE_API_CERTIFY) { /* Authentication request */
+ struct sockaddr_un srvr_sa_un, secure_sa_un;
+ socklen_t srvr_sa_len, secure_sa_len;
+ int secure_sock_un;
+
+ /* Create client socket for authentication */
+ memset(&secure_sa_un, 0, sizeof(secure_sa_un));
+ secure_sa_un.sun_family = AF_UNIX;
+ secure_sock_un = socket(PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
+ RpcSetClientSecureName(secure_sa_un.sun_path, RPC_port(idinfo));
+ secure_sa_len = (socklen_t)(sizeof(secure_sa_un.sun_family) + SECURE_SOCK_NAME_LEN);
+ if (bind(secure_sock_un, (struct sockaddr *)&secure_sa_un, secure_sa_len) < 0) {
+ RPC_LOG_PERROR("STREAM : bind(unix), ID:%#x", RPC_port(idinfo));
+ }
+ idinfo->secure_sock = secure_sock_un;
+
+ /* Destination Server Socket Setting */
+ memset(&srvr_sa_un, 0, sizeof(srvr_sa_un));
+ srvr_sa_un.sun_family = AF_UNIX;
+ RpcSetServerSecureName(srvr_sa_un.sun_path, server);
+ srvr_sa_len = (socklen_t)(sizeof(srvr_sa_un.sun_family) + SECURE_SOCK_NAME_LEN);
+
+ /* Connection */
+ int cr = connect(RPC_my_secure_sock(idinfo), (struct sockaddr *)&srvr_sa_un, srvr_sa_len);
+ if (0 > cr) {
+ RPC_LOG_STATE("client connect() is failed.");
+ return RPC_ERR_Fatal;
+ }
+
+ /* Waiting for server authentication */
+ RPC_Result ret_certify = RpcClientWaitCertification(idinfo, &srvr_pid);
+ close(RPC_my_secure_sock(idinfo));
+ if (RPC_OK != ret_certify) {/* Authentication NG */
+ RPC_LOG_STATE("denied the connection.");
+ return ret_certify;
+ }
+
+ /* inotify monitoring of server processes */
+ char intfy_fname[32];
+ snprintf(intfy_fname, sizeof(intfy_fname), CL_INTFY_FILENAME_FORMAT, srvr_pid);
+ int wd = inotify_add_watch(RPC_clnt_inotify_fd(idinfo), intfy_fname, IN_DELETE_SELF);
+ if (0 > wd) {
+ RPC_LOG_STATE("intfy_fname is Not Found [%s].", intfy_fname);
+ }
+
+ /* Register the communication destination server PID in the management table. */
+ if (RPC_OK != RpcRegistSrvrPid(idinfo, server, srvr_pid, wd)) {
+ return RPC_ERR_Fatal;
+ }
+ goto send_api_call; /* Sending the API request again */
+
+ } else if (response == RPC_RESPONSE_NONE) { // LCOV_EXCL_BR_LINE 8: dead code, not implement
+ // Not implemented to cancel processing
+ // LCOV_EXCL_START 8: dead code, not implement
+ RPC_LOG_STATE("No response for API call");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_No_Response;
+ } // LCOV_EXCL_STOP
+
+ // When the server ALIVE is queried, no result is returned, so return here
+ if (api_num == RPC_API_NUM_RPC_ALIVE) {
+ return RPC_OK;
+ }
+
+ // API call is accepted at server
+ // now wait for the return packet
+ result = RpcClientWaitResult(idinfo, server);
+ if (result != RPC_OK) {
+ RpcDiscardAPIcallReturn(idinfo);
+ return result;
+ }
+
+ /****** Function error and return value must be handled separately *******/
+ UINT8 *return_str = RPC_apicall_return_str(idinfo); /* pgr0689 */
+#ifdef APICALL_RETURN_TIMEOUT
+ if (return_str == NULL) {
+ RPC_LOG_STATE("APIcall return timeout");
+ return RPC_ERR_No_Response;
+ }
+#else
+ rpc_assert(return_str != NULL); // LCOV_EXCL_BR_LINE 6: double check
+#endif
+
+ RPC_THREAD_MUTEX_LOCK(idinfo->thread_info);
+
+ *ret_string = rpc_malloc(RPC_apicall_return_str_len(idinfo));
+ if (*ret_string != NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ if (ret_size) {
+ *ret_size = RPC_apicall_return_str_len(idinfo);
+ }
+ memcpy(*ret_string, RPC_apicall_return_str(idinfo),
+ RPC_apicall_return_str_len(idinfo));
+ } else {
+ RPC_LOG_STATE("APIcall: No Memory"); // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ result = RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ RPC_THREAD_MUTEX_UNLOCK(idinfo->thread_info);
+ RpcDiscardAPIcallReturn(idinfo);
+
+ return result;
+}
+
+/** @brief Releasing allocated memory while API call is processing
+ *
+ * (These functions are called from within a client-facing STUB. Users never use it directly.)
+ */
+ void
+RPC_free_return_string(void *ptr) {
+ if (ptr != NULL) {
+ rpc_free(ptr);
+ }
+}
+
+/** @brief Retrieving file descriptors for determining whether RPC-API calls are requested
+ *
+ * - This function returns a file descriptor used to determine whether or not there is a request to the server.
+ * - For the FD returned by this function, Don't use the other way than the FD specified
+ * in the poll or select parameter.
+ * - Intended use
+ * - Obtain FD using this function.
+ * - Wait for data to arrive by poll or select.
+ * - Call RPC_process_API_request() when data arrived.
+ * - This procedure performs handling request of the API call from the client.
+ * (Server-side API function is executed.)
+ *
+ * @param id [IN]RPC_ID of the server program.
+ * @param fd [OUT]Storage of file descriptor
+ *
+ * @retval RPC_OK: normal completion
+ * @retval Otherwise: Abnormal termination (FATAL)
+ * @see RPC_process_API_request
+ */
+ RPC_Result
+RPC_get_fd(RPC_ID id, int *fd) {
+ if ((id == RPC_NO_ID) || (fd == NULL)) {
+ return RPC_ERR_Fatal;
+ }
+ rpc_assert(fd != NULL); // LCOV_EXCL_BR_LINE 6: double check
+
+ RpcThreadInfo *th = RpcMyThreadInfo();
+
+ THREAD_INFO_CHECK(th);
+
+ SUB_THREAD_CHECK(); // LCOV_EXCL_BR_LINE 15: macro define in rpc_lib.c
+
+ RpcIdInfo *idinfo = RPC_srvr_idinfo(th);
+
+ rpc_assert(idinfo != NULL && RPC_my_id(idinfo) == id); // LCOV_EXCL_BR_LINE 6: double check
+
+ *fd = RPC_pipe_sub_main(th)[PIPE_READ];
+
+ return RPC_OK;
+}
+
+/** API Call Request Handling
+*/
+ static RPC_Result
+ProcessAPIcallRequest(RpcIdInfo *idinfo, RPC_ID client, UINT16 api_num,
+ char *args_string, unsigned int args_size) {
+ /* ----------------------------
+ * call API dispatch function
+ * ----------------------------
+ */
+
+ /* API Running Client RPC_ID Setting */
+ RPC_apicall_in_process_client(idinfo) = client;
+
+ char *ret_string = NULL;
+ unsigned int ret_size = 0;
+ RPC_dispatch_func_t dispatch = RPC_apicall_dispatch_func(idinfo);
+ rpc_assert(dispatch != NULL); // LCOV_EXCL_BR_LINE 6: double check
+ RPC_Result api_ret;
+ api_ret = dispatch(api_num, args_string, args_size, &ret_string, &ret_size); /* pgr0060 */
+
+ unsigned char retcode[RPC_RETCODE_LEN+1];
+ sprintf((char *)retcode, "%08x ", api_ret);
+
+ rpc_send_buf sendbuf[2];
+ sendbuf[0].buf = retcode;
+ sendbuf[0].bytes = sizeof(retcode) - 1;
+
+ int seq_num;
+
+ if (ret_string != NULL) {
+ sendbuf[1].buf = ret_string;
+ sendbuf[1].bytes = ret_size;
+ seq_num = RpcSendUdp2(idinfo, client, RPC_SEND_TO_CLIENT,
+ RPC_PACKET_APIRETURN, 2, sendbuf);
+ } else {
+ seq_num = RpcSendUdp2(idinfo, client, RPC_SEND_TO_CLIENT,
+ RPC_PACKET_APIRETURN, 1, sendbuf);
+ }
+ RPC_marshall_free(1, ret_string);
+
+ if (seq_num < 0) {
+ RPC_LOG_ERR("send result failed!");
+ return RPC_ERR_Fatal;
+ }
+
+ /* Set API Running Client RPC_ID to None */
+ RPC_apicall_in_process_client(idinfo) = RPC_NO_PORT;
+
+ /* Sleep API-processing entries */
+ RPC_THREAD_MUTEX_LOCK(idinfo->thread_info);
+ CL_MonitorSetEntry(CL_MONITOR_TYPE_RPC, RPC_port(idinfo),
+ CL_MONITOR_STATE_SLEEP, 0, 0);
+ RPC_THREAD_MUTEX_UNLOCK(idinfo->thread_info);
+
+ return api_ret;
+}
+
+/** @brief Executing RPC-API calls
+ *
+ * Process all queued API execution requests from clients.
+ * The API function of the server program is called from here.
+ * If there is no API execution request, the system returns normally immediately without waiting.
+ *
+ * @param id [IN]RPC_ID of the server program
+ * @retval RPC_OK: normal completion
+ * @retval Otherwise: Fatal errors
+ */
+ RPC_Result
+RPC_process_API_request(RPC_ID id) {
+ if (id == RPC_NO_ID) {
+ return RPC_ERR_Fatal;
+ }
+ RpcThreadInfo *th = RpcMyThreadInfo();
+
+ THREAD_INFO_CHECK(th);
+
+ SUB_THREAD_CHECK();
+
+ RpcIdInfo *idinfo = RPC_srvr_idinfo(th);
+
+ rpc_assert(idinfo != NULL && id == RPC_my_id(idinfo)); // LCOV_EXCL_BR_LINE 6: double check
+
+ rpc_assert(RPC_apicall_info(idinfo) != NULL /* pgr0689 */ // LCOV_EXCL_BR_LINE 6: double check
+ && RPC_apicall_dispatch_func(idinfo) != NULL); // LCOV_EXCL_BR_LINE 6: double check
+
+ char c;
+ read(RPC_pipe_sub_main(th)[PIPE_READ], &c, sizeof(c));
+
+ /* Process all API calls here */
+ UINT16 api_num;
+ RPC_ID client = RPC_NO_PORT;
+ RPC_Result result = RPC_OK;
+ char *args_string;
+ unsigned int args_size;
+ do {
+ api_num = RpcGetAPIRequest(idinfo, &client,
+ &args_string, &args_size);
+
+ if (api_num > 0) {/* API calls were queued */
+ result = ProcessAPIcallRequest(idinfo, client, api_num,
+ args_string, args_size);
+
+ RpcFreeAPIArgsString(args_string);
+
+ if (result == RPC_ERR_API_Fatal || result == RPC_ERR_Fatal) {
+ break;
+ } else {
+ result = RPC_OK;
+ }
+ }
+ } while(api_num > 0);
+
+ return result;
+}
+
+/** @brief Returns the operational state of the RPC server
+ *
+ * Returns whether or not the server with the specified RPC_ID is running.
+ *
+ * @param id [IN]RPC_ID of the server program
+ * @retval RPC_OK: Running
+ * @retval RPC_ERR_No_Response: Server is not running
+ */
+ RPC_Result
+RPC_is_server_ready(RPC_ID id) {
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ char *ret_string = NULL;
+ unsigned int ret_size;
+ RPC_Result ret;
+
+ // Invoke Internal-API Calls for Server ALIVE Queries
+ ret = RPC_API_call(id, RPC_API_NUM_RPC_ALIVE, NULL, 0,
+ &ret_string, &ret_size);
+ RPC_free_return_string(ret_string);
+
+ return ret;
+#else /* !AUTOBIND */
+ struct stat statbuf;
+ int err;
+ char sockname[128];
+
+ /* Check if server socket is created */
+ rpc_set_socket_name(sockname, id);
+ err = stat(sockname, &statbuf);
+ if (err == 0) {
+ return RPC_OK;
+ } else {
+ return RPC_ERR_No_Response;
+ }
+#endif /* !AUTOBIND */
+}
+
+/** @brief Registering UIDs and GID Lists
+ *
+ * Register a list of UIDs and GIDs that can be accepted by the RPC server.
+ * A function used by the RPC server after RPC_START_SECURE_SERVER().
+ * Return error if called from an RPC client or an RPC server that has not called RPC_START_SECURE_SERVER().
+ *
+ * @param uid_num [IN] Number of registered UIDs (number of elements in UID list array)
+ * @param *uid_list [IN] Start pointer of registered UID list
+ * @param gid_num [IN] Number of registered GIDs (number of elements in the array of GID lists)
+ * @param *gid_list [IN] Start pointer of registered GID list
+ * @retval RPC_OK: List registration completed
+ * @retval RPC_ERR_Fatal: Failed to save to list
+ */
+RPC_Result
+RPC_regist_credential(int uid_num, uid_t *uid_list, int gid_num, gid_t *gid_list) {
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ THREAD_INFO_CHECK(th);
+
+ if (NULL == RPC_srvr_idinfo(th)) {
+ RPC_LOG_ERR("No server thread info");
+ return RPC_ERR_Fatal;
+ }
+
+ RpcIdInfo *idinfo = RPC_srvr_idinfo(th);
+ if ((NULL == idinfo) || (NULL == RPC_apicall_info(idinfo))) { // LCOV_EXCL_BR_LINE 8: dead code, idinfo always isn't NULL
+ // LCOV_EXCL_START 8: dead code, idinfo always isn't NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("No RPC_ID info");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ /* Neither UID nor GID list is specified. */
+ if ((NULL == uid_list) && (NULL == gid_list)) {
+ RPC_LOG_ERR("RPC_regist_credential() : UID and GID list is NULL.");
+ return RPC_ERR_Fatal;
+ }
+
+ /* UID list argument check */
+ if ((NULL == uid_list) && ((0 < uid_num ) && (uid_num <= CREDENTIAL_LIST_NUM_MAX))) {/* UID list is invalid */
+ RPC_LOG_ERR("RPC_regist_credential() : UID list is illegal.");
+ return RPC_ERR_Fatal;
+ } else if ((NULL != uid_list) && ((1 > uid_num) || (uid_num > CREDENTIAL_LIST_NUM_MAX))) {/* Number of UID list elements is invalid */
+ RPC_LOG_ERR("RPC_regist_credential() : UID list num is illegal.");
+ return RPC_ERR_Configuration;
+ }
+
+ /* GID list argument check */
+ if ((NULL == gid_list) && ((0 < gid_num ) && (gid_num <= CREDENTIAL_LIST_NUM_MAX))) {/* GID list is invalid */
+ RPC_LOG_ERR("RPC_regist_credential() : GID list is illegal.");
+ return RPC_ERR_Fatal;
+ } else if ((NULL != gid_list) && ((1 > gid_num) || (gid_num > CREDENTIAL_LIST_NUM_MAX))) {/* Number of GID list elements is invalid */
+ RPC_LOG_ERR("RPC_regist_credential() : GID list num is illegal.");
+ return RPC_ERR_Configuration;
+ }
+
+ if (NO_SECURE_CHECK == RPC_secure_check(idinfo)) {/* Return error if registration is not necessary */
+ RPC_LOG_ERR("Needless secure check.");
+ return RPC_ERR_Fatal;
+ }
+
+ if (REGISTERED == RPC_regist_credential_info(idinfo)) {/* Return error if a list has already been registered */
+ RPC_LOG_ERR("credential info has been registered already.");
+ return RPC_ERR_Fatal;
+ }
+
+ /* Allocate as many memory areas as there are UID and GID lists */
+ RPC_apicall_info(idinfo)->uid_list = rpc_malloc(sizeof(uid_t) * (unsigned int)uid_num);
+ if (NULL == RPC_apicall_info(idinfo)->uid_list) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ RPC_LOG_ERR("Can't malloc uid_list."); // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ RPC_apicall_info(idinfo)->gid_list = rpc_malloc(sizeof(gid_t) * (unsigned int)gid_num);
+ if (NULL == RPC_apicall_info(idinfo)->gid_list) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ RPC_LOG_ERR("Can't malloc gid_list."); // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ /* Copy UID and GID registration list and number of elements */
+ memcpy(RPC_apicall_info(idinfo)->uid_list, uid_list, sizeof(uid_t) * (unsigned int)uid_num); /* UID list */
+ memcpy(RPC_apicall_info(idinfo)->gid_list, gid_list, sizeof(gid_t) * (unsigned int)gid_num); /* GID list */
+ RPC_uid_num(idinfo) = uid_num; /* Number of elements in the UID list */
+ RPC_gid_num(idinfo) = gid_num; /* Number of elements in the GID list */
+
+ /* Set whether to register authentication information to Yes/No */
+ RPC_regist_credential_info(idinfo) = REGISTERED;
+
+ return RPC_OK;
+}
+
+/** @brief Obtain authentication info (UID, GID) of API requesting client
+ *
+ * Obtain the UID and GID of the client that requested the API processing being executed.
+ * Return error if called from an RPC client or to an RPC server that has not called RPC_START_SECURE_SERVER().
+ * This function should be called within an API function (in other words, API is being executed) provided to the client.
+ * if called the other function, error is returned because there is no API being executed.
+ *
+ * @param *client_uid [OUT] Requesting client UID of running API
+ * @param *client_gid [OUT] Requesting client GID of running API
+ * @retval RPC_OK: Succeeded to obtain of authentication info
+ * @retval RPC_ERR_Fatal: Failed to obtain of authentication Info
+ */
+RPC_Result
+RPC_get_client_credential(uid_t *client_uid, gid_t *client_gid) {
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ THREAD_INFO_CHECK(th);
+
+ if (NULL == RPC_srvr_idinfo(th)) {
+ RPC_LOG_ERR("No server thread info");
+ return RPC_ERR_Fatal;
+ }
+
+ RpcIdInfo *idinfo = RPC_srvr_idinfo(th);
+ if ((NULL == idinfo) || (NULL == RPC_apicall_info(idinfo))) { // LCOV_EXCL_BR_LINE 8: dead code, idinfo always isn't NULL
+ // LCOV_EXCL_START 8: dead code, idinfo always isn't NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("No RPC_ID info");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ if ((NULL == client_uid) || (NULL == client_gid)) {/* Argument check */
+ RPC_LOG_ERR("RPC_regist_credential() : Invalid Param.");
+ return RPC_ERR_Fatal;
+ }
+
+ if (NO_SECURE_CHECK == RPC_secure_check(idinfo)) {/* Return error if no security */
+ RPC_LOG_ERR("Needless secure check.");
+ return RPC_ERR_Fatal;
+ }
+
+ if (RPC_NO_PORT == RPC_apicall_in_process_client(idinfo)) {/* Return error if the API is not being executed */
+ RPC_LOG_ERR("NOT in process APIcall.");
+ return RPC_ERR_Fatal;
+ }
+
+ char buf[7], client_path_name[SOCK_NAME_LEN]; /* Client socket name */
+
+ /* Converting client_id to the socket name associated with RPC_ID */
+ RpcSetClientName(buf, RPC_apicall_in_process_client(idinfo));
+ memcpy(client_path_name, buf + 1, 5);
+ client_path_name[5] = '\0';
+ RpcClientSockNameInfo *current = RPC_sock_info_head(idinfo);
+
+ /* Search info of running client from the management table */
+ while (NULL != current) {
+ if (0 == strcmp(current->client_sock_name, client_path_name)) {/* Match Running Client Info */
+ *client_uid = current->uid;
+ *client_gid = current->gid;
+ return RPC_OK;
+ }
+ current = current->next;
+ }
+ RPC_LOG_ERR("Nothing client credential info.");
+ return RPC_ERR_Fatal; /* Not found Client info */
+}
+
+/** @brief Waiting for server authentication
+ *
+ * When a client requests an API to the server,
+ * wait for the server to check whether it is allowed to communicate.
+ *
+ * @param *idinfo [IN] Information associated with the client's RPC_ID
+ *
+ * @retval RPC_OK: Authentication OK (communication with the server is permitted)
+ * @retval RPC_ERR_Reject_connect: Authentication NG (Communication denied)
+ */
+static RPC_Result
+RpcClientWaitCertification(RpcIdInfo *idinfo, pid_t *srvr_pid) {
+ fd_set fds;
+ RpcCertifyResult recv_ret; /* Authentication result from the server */
+ RPC_Result ret = RPC_ERR_Fatal;
+
+ for(;;) {
+ FD_ZERO(&fds);
+ FD_SET(RPC_my_secure_sock(idinfo), &fds);
+
+ int sret = select(RPC_my_secure_sock(idinfo) + 1, &fds, NULL, NULL, NULL);
+ if (sret < 0 && errno == EINTR) {/* signal interrupt */ // LCOV_EXCL_BR_LINE 5: fail safe for libc select
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue; // LCOV_EXCL_LINE 5: fail safe for libc select
+ } else if (sret > 0 && FD_ISSET(RPC_my_secure_sock(idinfo), &fds)) {
+ /* Check the response from the server */
+ ssize_t rret = recv(RPC_my_secure_sock(idinfo), (char*)&recv_ret, sizeof(RpcCertifyResult), 0);
+ if (0 < rret) { // LCOV_EXCL_BR_LINE 5: fail safe for libc recv
+ switch(recv_ret.certify_res) {
+ case CERTIFY_OK: /* OK */
+ ret = RPC_OK;
+ *srvr_pid = recv_ret.srvr_pid;
+ break;
+
+ case CERTIFY_NG: /* NG */
+ ret = RPC_ERR_Reject_connect;
+ break;
+
+ default:
+ ret = RPC_ERR_Fatal;
+ break;
+ }
+ goto exit_loop_ok;
+ } else if(0 == rret) { // LCOV_EXCL_START 5: fail safe for libc recv
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("server process terminate.");
+ return RPC_ERR_Fatal;
+ } else {
+ RPC_LOG_PERROR("certification_wait recv()");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ }
+ }
+exit_loop_ok:
+ return ret;
+}
+
+/** @brief Register the PID of the communication destination server in the management table.
+ *
+ * Register a pair of the PID and ID of the server in the management table.
+ *
+ * @param *idinfo [IN] Information associated with the client's RPC_ID
+ * @param srvr_rpc_id [IN] RPC_ID of the communication destination server
+ * @param srvr_pid [IN] PID of the communication destination server
+ *
+ * @retval RPC_OK : Registration completed
+ * @retval RPC_ERR_Fatal : Registration failed
+ */
+static RPC_Result
+RpcRegistSrvrPid(RpcIdInfo *idinfo, RPC_ID srvr_rpc_id, pid_t srvr_pid, int wd) {
+ if ((NULL == idinfo) || (srvr_rpc_id == RPC_NO_ID) || (0 > srvr_pid)) { // LCOV_EXCL_START 8: dead code, idinfo always isn't NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("RpcRegistSrvrPid() : Invalid Param.");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RpcSrvrPidInfo *srvr_pid_buf, *current;
+
+ srvr_pid_buf = rpc_malloc(sizeof(RpcSrvrPidInfo));
+ if( srvr_pid_buf == NULL ){ // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ srvr_pid_buf->srvr_rpc_id = srvr_rpc_id; /* Server RPC_ID */
+ srvr_pid_buf->srvr_pid = srvr_pid; /* Server PID */
+ srvr_pid_buf->wd = wd; /* wd */
+ srvr_pid_buf->next = NULL; /* Next node in the communication destination server PID management table */
+
+ if (0 == RPC_srvr_pid_head(idinfo)) {
+ RPC_srvr_pid_head(idinfo) = srvr_pid_buf;
+ } else {
+ for (current = RPC_srvr_pid_head(idinfo); current->next != NULL; current = current->next)
+ ;
+ current->next = srvr_pid_buf;
+ }
+ return RPC_OK;
+}
+
+/** @brief Delete Termination Process PID from Management Table
+ *
+ * Check whether the terminated process matches the communicating server process, and delete it from the management table.
+ *
+ * @param *idinfo [IN] Information associated with the client's RPC_ID
+ * @param srvr_rpc_id [IN] Currently communicating server RPC_ID
+ * @param wd [IN] Wd of the termination process
+ *
+ * @retval RPC_OK : Deletion completed
+ * @retval RPC_ERR_Server_Finish: Deletion completed (server process in communication terminated)
+ * @retval RPC_ERR_Fatal : Argument error
+ */
+ RPC_Result
+RpcDeleteSrvrPid(RpcIdInfo *idinfo, RPC_ID srvr_rpc_id, int wd) {
+ if ((NULL == idinfo) || (RPC_NO_ID == srvr_rpc_id)) { // LCOV_EXCL_START 8: dead code, idinfo always isn't NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("rpc_check_srvr_pid() : Invalid Param.");
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RPC_Result ret = RPC_OK;
+ int cnt = 0;
+ RpcSrvrPidInfo *current, *previous;
+ current = RPC_srvr_pid_head(idinfo);
+
+ while (NULL != current) {
+ if (wd == current->wd) {
+
+ /* Check whether the termination process matches the communicating server process */
+ if (srvr_rpc_id == current->srvr_rpc_id) {
+ ret = RPC_ERR_Server_Finish;
+ }
+
+ /* Delete info from the Server info table */
+ if (0 == cnt) {/* Delete the start of the management table */
+ RPC_srvr_pid_head(idinfo) = RPC_srvr_pid_head(idinfo)->next;
+ rpc_free(current);
+ current = RPC_srvr_pid_head(idinfo);
+ cnt = -1;
+ } else {/* Delete all but the first element */
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ previous->next = current->next;
+ rpc_free(current);
+ current = previous->next;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ previous = current;
+ current = current->next;
+ }
+ cnt ++;
+ }
+ return ret;
+}
+
+/** @brief Delete all PID management tables of the communication destination server
+ *
+ * Releases the PID management table and deletes all data when the client terminates with RPC_end().
+ *
+ * @param *idinfo [IN] Information associated with the client's RPC_ID
+ *
+ * @retval RPC_OK : Deletion completed
+ * @retval RPC_ERR_Fatal : Argument error
+ */
+static RPC_Result
+RpcAllDeleteSrvrPid(RpcIdInfo *idinfo) {
+ if (NULL == idinfo) { // LCOV_EXCL_BR_LINE 6: double check in rpc_lib.c --> RPC_end()
+ RPC_LOG_ERR("RpcAllDeleteSrvrPid() : Invalid Param."); // LCOV_EXCL_START 6: double check in rpc_lib.c --> RPC_end()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RpcSrvrPidInfo *current = RPC_srvr_pid_head(idinfo);
+ while (NULL != current) {
+
+ if (0 <= current->wd) {
+ inotify_rm_watch(RPC_clnt_inotify_fd(idinfo), current->wd);
+ }
+
+ RpcSrvrPidInfo *previous = current;
+ current = current->next;
+
+ rpc_free(previous);
+ }
+ RPC_srvr_pid_head(idinfo) = NULL;
+ return RPC_OK;
+}
+
+/** @brief Logging RPC-API calling process
+ *
+ * Receive File name, function name and line-number of the client calling API and API-function-name, and logging them.
+ *
+ * @param filename [IN]Pointer to caller filename string
+ * @param funcname [IN]Pointer to caller function-name string
+ * @param line [IN]Line-number in the source file of the client
+ * @param apiname [IN]Pointer to call-API-function-name string
+ * @retval 0: normal completion
+ * @retval Otherwise: Fatal error
+ */
+ int
+RPC_record_dbg_log( const char *filename, const char *funcname, int line,
+ const char *apiname ) {
+ printf( "[RPC debug log]%s() called from %s() [%s, line %d]\n",
+ apiname, funcname, filename, line );
+ return 0;
+}
+
+/** @}*/
diff --git a/video_in_hal/otherservice/rpc_library/library/src/rpc_marshall.c b/video_in_hal/otherservice/rpc_library/library/src/rpc_marshall.c
new file mode 100755
index 0000000..8a4a56a
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/src/rpc_marshall.c
@@ -0,0 +1,740 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_marshall.c
+ * @brief RPC Library Internal Implementation--Argument Conversion During API Calls
+ *
+ */
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h>
+#include <math.h>
+
+#include <other_service/rpc.h>
+#include "rpc_internal.h"
+
+#include "apidef.tab.h"
+#include "apidef.h"
+
+/** @addtogroup RPClib_in
+ * @{
+ */
+/** Structures for String Add Operations */
+typedef struct {
+ char *start;
+ char *wp;
+ unsigned int units;
+ unsigned int remain;
+} RpcString;
+
+#ifdef STRETCH_STRING
+#define _STRING_ALLOC_UNIT 512
+#else
+/*
+ * Batch allocate total bytes of arguments + data to be added internally
+ * (maximal 6 bytes per argument)
+ */
+#define _STRING_ALLOC_UNIT \
+ (RPC_MAX_API_ARG_TOTAL_SIZE + RPC_MAX_API_ARG_NUM * (2 + 4))
+#endif
+
+#define _ENOUGH_SPACE_FOR_ALL_TYPES \
+ (sizeof(UINT64) > sizeof(double) ? sizeof(UINT64) : sizeof(double))
+
+static RpcString* NewRpcString(void);
+#ifdef STRETCH_STRING
+static int StretchString(RpcString *str, UINT16 bytes);
+#endif
+static char *CopyString(RpcString *str, unsigned int *size);
+static void DestroyString(RpcString *str);
+static inline int AppendString(RpcString *str,
+ const UINT8 *append, UINT16 applen);
+static inline int MarshallUINT8(RpcString *str, UINT8 uc);
+static inline int MarshallUINT16(RpcString *str, UINT16 uh);
+static inline int MarshallUINT32(RpcString *str, UINT32 ui);
+static inline int MarshallUINT64(RpcString *str, UINT64 ul);
+static inline int Marshallfloat(RpcString *str, float f);
+static inline int Marshalldouble(RpcString *str, double d);
+static inline int MarshallUINT8Stream(RpcString *str, const UINT8 *buf,
+ UINT16 bytes);
+static inline int MarshallString(RpcString *str, char *buf,
+ UINT16 bytes);
+static inline int MarshallNullPointer(RpcString *str);
+static inline int MarshallPointer(RpcString *str);
+
+static RpcString *
+NewRpcString(void) {
+ RpcString *str;
+
+ str = rpc_malloc(sizeof(RpcString));
+ if (str == NULL) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;
+ } // LCOV_EXCL_STOP
+
+ str->start = rpc_malloc(_STRING_ALLOC_UNIT);
+ if (str->start == NULL) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rpc_free(str);
+ return NULL;
+ } // LCOV_EXCL_STOP
+ str->start[0] = '\0';
+ str->wp = str->start;
+ str->units = 1;
+ str->remain = _STRING_ALLOC_UNIT - 1;
+
+ return str;
+}
+
+#ifdef STRETCH_STRING
+static int
+StretchString(RpcString *str, UINT16 bytes) {
+ unsigned int oldunits = str->units;
+ unsigned int units = 1 + (bytes / _STRING_ALLOC_UNIT) + oldunits;
+ if (units == oldunits) {
+ return 0;
+ }
+ unsigned int length = str->wp - str->start;
+ char *newp = rpc_malloc(units * _STRING_ALLOC_UNIT);
+ if (newp == NULL) {
+ return -1;
+ }
+ memcpy(newp, str->start, length);
+ rpc_free(str->start);
+ str->start = newp;
+ str->wp = str->start + length;
+ *(str->wp) = '\0';
+ str->units = units;
+ str->remain += (units - oldunits) * _STRING_ALLOC_UNIT;
+ return 0;
+}
+#endif /* STRETCH_STRING */
+
+static inline int
+AppendString(RpcString *str, const UINT8 *append, UINT16 applen) {
+ rpc_assert(append != NULL); // LCOV_EXCL_BR_LINE 6: double check
+#ifdef STRETCH_STRING
+ if (applen > str->remain) {
+ if (StretchString(str, applen - str->remain) < 0) {
+ return -1;
+ }
+ }
+#else
+ rpc_assert(applen <= str->remain); // LCOV_EXCL_BR_LINE 6: double check
+#endif
+ memcpy(str->wp, append, applen);
+ str->wp += applen;
+ str->remain -= applen;
+ return 0;
+}
+
+static char *
+CopyString(RpcString *str, unsigned int *size) {
+ unsigned int length = (unsigned int)(str->wp - str->start);
+ char *ret = rpc_malloc(length);
+ // LCOV_EXCL_BR_START 5: fail safe for libc malloc
+ if (ret == NULL) {
+ return NULL;
+ }
+ // LCOV_EXCL_BR_STOP
+ memcpy(ret, str->start, length);
+ if (size != NULL) {
+ *size = length;
+ }
+
+ return ret;
+}
+
+static void
+DestroyString(RpcString *str) {
+ rpc_free(str->start);
+ rpc_free(str);
+}
+
+static inline int
+MarshallUINT8(RpcString *str, UINT8 c) {
+ UINT8 buf[1 + sizeof(c)];
+ buf[0] = 'C';
+ buf[1] = c;
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+MarshallUINT8Stream(RpcString *str, const UINT8 *buf, UINT16 bytes) {
+ int ret = AppendString(str, (const UINT8 *)"B", 1);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 15: inline func rpc_marshall.c
+ return -1;
+ }
+ return AppendString(str, buf, bytes);
+}
+
+static inline int
+MarshallVararrayStream(RpcString *str, const UINT8 *buf, UINT16 bytes) {
+ char head_str[1+4+1+1]; /* Area where symbol "V" + size is stored */
+ sprintf(head_str, "V%03d ", bytes);
+ head_str[1+4+1] = '\0';
+
+ if (AppendString(str, (const UINT8 *)head_str, (UINT16)strlen(head_str)) < 0) { // LCOV_EXCL_BR_LINE 15: inline func rpc_marshall.c
+ return -1;
+ }
+
+ if (AppendString(str, buf, bytes) < 0) { // LCOV_EXCL_BR_LINE 15: inline func rpc_marshall.c
+ return -1;
+ }
+ return 0;
+}
+
+static inline int
+MarshallString(RpcString *str, char *buf, UINT16 bytes) {
+ char *p = buf;
+ UINT16 count = 0;
+ /* count the number of bytes in the argument */
+ while(*p != '\0' && count < (UINT16)(bytes - 1)) {
+ count++;
+ p++;
+ }
+
+ char count_str[1+strlen("1024")+1+1];
+ sprintf(count_str, "S%d ", count);
+
+ if (AppendString(str, (const UINT8 *)count_str, (UINT16)strlen(count_str)) < 0 || AppendString(str, (const UINT8 *)buf, count) < 0) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ return -1;
+ }
+ return 0;
+}
+
+static int
+MarshallUINT16(RpcString *str, UINT16 uh) {
+ UINT8 buf[1 + sizeof(uh)];
+ buf[0] = 'H';
+ memcpy(buf + 1, &uh, sizeof(uh));
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+MarshallUINT32(RpcString *str, UINT32 ui) {
+ UINT8 buf[1 + sizeof(ui)];
+ buf[0] = 'I';
+ memcpy(buf + 1, &ui, sizeof(ui));
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+Marshallint(RpcString *str, int i) {
+ return MarshallUINT32(str, (UINT32)i);
+}
+
+static inline int
+MarshallUINT64(RpcString *str, UINT64 ul) {
+ UINT8 buf[1 + sizeof(ul)];
+ buf[0] = 'L';
+ memcpy(buf + 1, &ul, sizeof(ul));
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+Marshallfloat(RpcString *str, float f) {
+ UINT8 buf[1 + sizeof(f)];
+ buf[0] = 'F';
+ memcpy(buf + 1, &f, sizeof(f));
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+Marshalldouble(RpcString *str, double d) {
+ UINT8 buf[1 + sizeof(d)];
+ buf[0] = 'D';
+ memcpy(buf + 1, &d, sizeof(d));
+ return AppendString(str, buf, sizeof(buf));
+}
+
+static inline int
+MarshallPointer(RpcString *str) {
+ /* only to specify that a non-NULL pointer was delivered */
+ return AppendString(str, (const UINT8 *)"P", 1);
+}
+
+static inline int
+MarshallNullPointer(RpcString *str /*, int code*/) {
+ return AppendString(str, (const UINT8 *)"N", 1);
+}
+
+/** @ingroup RPClib_in
+ */
+
+#define MACROMarshallPointer(TYPE) \
+ do { \
+ TYPE *p = (TYPE *)temp; \
+ error = Marshall##TYPE(str, *p); \
+ } while(0)
+
+#define MACROMarshallValue(TYPE, STACK_TYPE) \
+ do { \
+ TYPE value = (TYPE)va_arg(ap, STACK_TYPE); \
+ error = Marshall##TYPE(str, value); \
+ } while(0)
+
+char *
+RPC_marshall_arguments(unsigned int *size, int dont_marshall_out_pointer,
+ int num_args, ...) {
+ rpc_assert(num_args <= RPC_MAX_API_ARG_NUM); // LCOV_EXCL_BR_LINE 6: double check
+ va_list ap;
+
+ RpcString *str;
+ str = NewRpcString();
+ if (str == NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL; // LCOV_EXCL_LINE 5: fail safe for libc malloc
+ }
+
+ va_start(ap, num_args);
+
+ int ii, error;
+ error = 0;
+
+ for(ii = 0 ; ii < num_args && error == 0 ; ii++) {
+ unsigned int code, is_vararray, is_pointer, in_out, out_only;
+ UINT16 bytes;
+ unsigned int val = va_arg(ap, unsigned int);
+
+ RPC_marshall_flag flag;
+ flag.all = ntohl(val);
+ code = flag.bits.code;
+ is_vararray = flag.bits.is_vararray;
+ is_pointer = flag.bits.is_pointer;
+ in_out = flag.bits.in_out;
+ bytes = flag.bits.bytes;
+ rpc_assert(bytes <= RPC_MAX_API_ARG_SIZE); // LCOV_EXCL_BR_LINE 6: double check
+
+
+ out_only = 0;
+ if (in_out == RPC_OUT_ARG) { /* OUT only argument */
+ out_only = 1;
+ }
+
+ if (is_pointer) { /* Argument passed by pointer */
+
+ void *temp = (void *)va_arg(ap, void *);
+ if (temp == NULL) {
+ /* NULL pointer */
+ error = MarshallNullPointer(str);
+ } else if (dont_marshall_out_pointer && out_only) {
+ /* Not refer to the contents of a pointer */
+ error = MarshallPointer(str);
+ } else {/* Marshall the contents of pointers */
+ if (is_vararray) {
+ /* Variable-length array */
+ error = MarshallVararrayStream(str, temp, bytes);
+ } else {
+ switch(code) {
+ case rpc_CHAR:
+ case rpc_INT8:
+ case rpc_UINT8:
+ MACROMarshallPointer(UINT8);
+ break;
+ case rpc_INT16:
+ case rpc_UINT16:
+ MACROMarshallPointer(UINT16);
+ break;
+ case rpc_INT:
+ case rpc_SINT:
+ case rpc_UINT:
+ MACROMarshallPointer(int);
+ break;
+ case rpc_INT32:
+ case rpc_UINT32:
+ MACROMarshallPointer(UINT32);
+ break;
+ case rpc_INT64:
+ case rpc_UINT64:
+ MACROMarshallPointer(UINT64);
+ break;
+ case rpc_FLOAT:
+ MACROMarshallPointer(float);
+ break;
+ case rpc_DOUBLE:
+ MACROMarshallPointer(double);
+ break;
+ case rpc_STRING:
+ error = MarshallString(str, temp, bytes);
+ break;
+ case rpc_USER_DEFINED:
+ error = MarshallUINT8Stream(str, temp, bytes);
+ break;
+ default:
+ error = -1;
+ break;
+ }
+ }
+ }
+ } else {/* Argument passed by value */
+
+ /* Note: In this area, the code depends on the CPU architecture */
+
+ switch(code) {
+ case rpc_CHAR:
+ case rpc_INT8:
+ case rpc_UINT8:
+ MACROMarshallValue(UINT8, unsigned int);
+ break;
+ case rpc_INT16:
+ case rpc_UINT16:
+ MACROMarshallValue(UINT16, unsigned int);
+ break;
+ case rpc_INT:
+ case rpc_SINT:
+ case rpc_UINT:
+ MACROMarshallValue(int, int); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT32:
+ case rpc_UINT32:
+ MACROMarshallValue(UINT32, UINT32); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT64:
+ case rpc_UINT64:
+ MACROMarshallValue(UINT64, UINT64); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_FLOAT:
+ MACROMarshallValue(float, double); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_DOUBLE:
+ MACROMarshallValue(double, double); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_USER_DEFINED:
+ rpc_assert(bytes <= sizeof(UINT64));
+ /* This area is very architecture-dependent! */
+ if (bytes <= sizeof(UINT32)) {
+ UINT32 value = (UINT32)va_arg(ap, UINT32); // LCOV_EXCL_BR_LINE 15: macro defined in stdarg.h
+ error = MarshallUINT8Stream(str, (UINT8 *)&value, bytes);
+ } else if (bytes <= sizeof(UINT64)) { // LCOV_EXCL_BR_LINE 6: double check
+ UINT64 value = (UINT64)va_arg(ap, UINT64); // LCOV_EXCL_BR_LINE 15: macro defined in stdarg.h
+ error = MarshallUINT8Stream(str, (UINT8 *)&value, bytes);
+ }
+ break;
+ default:
+ error = -1;
+ break;
+ }
+ }
+ }
+ va_end(ap);
+
+ if (error != 0) {
+ DestroyString(str);
+ return NULL;
+ }
+
+ char *ret = CopyString(str, size);
+ DestroyString(str);
+ return ret;
+}
+
+static inline int DeMarshallUINT8(const char *from, UINT8 *ucp);
+static inline int DeMarshallUINT16(const char *from, UINT16 *uhp);
+static inline int DeMarshallUINT32(const char *from, UINT32 *uip);
+static inline int DeMarshallUINT64(const char *from, UINT64 *ulp);
+static inline int DeMarshallfloat(const char *from, float *fp);
+static inline int DeMarshalldouble(const char *from, double *dp);
+static inline int DeMarshallUINT8Stream(const char *from, UINT8 *buffer,
+ UINT16 bytes);
+static inline int DeMarshallString(const char *from, char *buffer,
+ UINT16 bytes);
+
+static inline int
+DeMarshallUINT8(const char *from, UINT8 *ucp) {
+ if (*from == 'C') {
+ *ucp = *(UINT8 *)(from + 1);
+ return 1 + sizeof(*ucp);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallUINT16(const char *from, UINT16 *uhp) {
+ if (*from == 'H') {
+ memcpy(uhp, from + 1, sizeof(*uhp));
+ return 1 + sizeof(*uhp);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallUINT32(const char *from, UINT32 *uip) {
+ if (*from == 'I') {
+ memcpy(uip, from + 1, sizeof(*uip));
+ return 1 + sizeof(*uip);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallint(const char *from, int *ip) {
+ return DeMarshallUINT32(from, (UINT32 *)ip);
+}
+
+static inline int
+DeMarshallUINT64(const char *from, UINT64 *ulp) {
+ if (*from == 'L') {
+ memcpy(ulp, from + 1, sizeof(*ulp));
+ return 1 + sizeof(*ulp);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallfloat(const char *from, float *fp) {
+ if (*from == 'F') {
+ memcpy(fp, from + 1, sizeof(*fp));
+ return 1 + sizeof(*fp);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshalldouble(const char *from, double *dp) {
+ if (*from == 'D') {
+ memcpy(dp, from + 1, sizeof(*dp));
+
+ return 1 + sizeof(*dp);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallUINT8Stream(const char *from, UINT8 *buffer, UINT16 bytes) {
+ if (*from == 'B') {
+ memcpy(buffer, from + 1, bytes);
+ return (int)(1 + bytes);
+ } else {
+ return -1;
+ }
+}
+
+static inline int
+DeMarshallString(const char *from, char *buffer, UINT16 bytes) {
+ if (*from == 'S') {
+ char *start;
+ long len = strtol(from + 1, &start, 10);
+ if (len < 0 || len >= bytes) { // LCOV_EXCL_BR_LINE 5: fail safe for libc strtol
+ return -1;
+ }
+ start++; /* skip ' ' */
+ int skip = (int)(start - from);
+ memcpy(buffer, start, (size_t)len);
+ buffer[len] = '\0';
+ return skip + (int)len;
+ } else {
+ return -1;
+ }
+}
+
+/* Variable-length array data */
+static inline int
+DemarshallVararrayInfo(const char *from, UINT16 *bytes/* OUT */) {
+ if (*from == 'V') {
+ char *end;
+ long len = strtol((char *)(from + 1), &end, 10);
+ if (len <= 0 || len > RPC_MAX_API_ARG_SIZE) { // LCOV_EXCL_BR_LINE 5: fail safe for libc strtol
+ return -1;
+ }
+ *bytes = (UINT16)len;
+ return (int)(end - from + 1); /* skip ' ' */
+ } else {
+ return -1;
+ }
+}
+
+/** @ingroup RPClib_in
+ */
+
+#define MACRODemarshall(TYPE) \
+ do {\
+ TYPE *p; \
+ if (need_alloc && is_pointer) { \
+ p = rpc_malloc(sizeof(TYPE)); \
+ *(TYPE **)temp = p; \
+ } else { \
+ p = (TYPE *)temp; \
+ } \
+ if (p != NULL) { \
+ ret = DeMarshall##TYPE(from, p); \
+ } \
+ } while(0)
+
+int
+RPC_demarshall_arguments(const char *from, unsigned int size,
+ int need_alloc, int num_args, ...) {
+ rpc_assert(num_args <= RPC_MAX_API_ARG_NUM); // LCOV_EXCL_BR_LINE 6: double check
+ va_list ap;
+ va_start(ap, num_args);
+
+ int ii, error;
+ error = 0;
+ int remain_len = (int)size;
+
+ for(ii = 0 ; ii < num_args && error == 0 && remain_len > 0 ; ii++) {
+ unsigned int code, is_pointer, is_vararray;
+ UINT16 bytes;
+ unsigned int val = va_arg(ap, unsigned int);
+ RPC_marshall_flag flag;
+ flag.all = ntohl(val);
+ code = flag.bits.code;
+ is_vararray = flag.bits.is_vararray;
+ is_pointer = flag.bits.is_pointer;
+ bytes = flag.bits.bytes;
+ rpc_assert(bytes <= RPC_MAX_API_ARG_SIZE); // LCOV_EXCL_BR_LINE 6: double check
+
+
+ void *temp = va_arg(ap, void *);
+ int ret = -1;
+
+ if (*from == 'N') { /* NULL pointer */
+ if (bytes > 0 || is_pointer != 0) {
+ if (need_alloc) {
+ *(void **)temp = NULL;
+ } else {
+ /* do nothing */
+ }
+ ret = 1;
+ }
+ } else if (*from == 'P') { /* Pointer(no content) */
+ if (need_alloc) {
+ if (bytes > 0) { /* String type or user-defined type */
+ *(void **)temp = rpc_malloc(bytes);
+ } else if (is_pointer != 0) { /* Other pointers */
+ *(void **)temp = rpc_malloc(_ENOUGH_SPACE_FOR_ALL_TYPES);
+ }
+ ret = 1;
+ }
+ } else { /* non-NULL pointer */
+ if ( is_vararray ) { /* Variable-length array */
+ ret = DemarshallVararrayInfo(from, &bytes);
+ if( ret < 0 ) {
+ va_end(ap);
+ return -1; /* pgr0524 */
+ }
+ char *p;
+ if (need_alloc) {
+ p = rpc_malloc(sizeof(char)*bytes);
+ *(char **)temp = p;
+ } else {
+ p = (char *)temp; /* pgr0524 */
+ }
+ if (p != NULL) {
+ memcpy(p, from + ret, bytes);
+ ret += bytes;
+ }
+ } else {
+ switch(code) {
+ case rpc_CHAR:
+ case rpc_INT8:
+ case rpc_UINT8:
+ MACRODemarshall(UINT8); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT16:
+ case rpc_UINT16:
+ MACRODemarshall(UINT16); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT:
+ case rpc_SINT:
+ case rpc_UINT:
+ MACRODemarshall(int); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT32:
+ case rpc_UINT32:
+ MACRODemarshall(UINT32); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_INT64:
+ case rpc_UINT64:
+ MACRODemarshall(UINT64); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_FLOAT:
+ MACRODemarshall(float); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_DOUBLE:
+ MACRODemarshall(double); /* pgr0524 */ // LCOV_EXCL_BR_LINE 15: marco defined in rpc_marshall.c
+ break;
+ case rpc_USER_DEFINED: {
+ UINT8 *p;
+ if (need_alloc && is_pointer) {
+ p = rpc_malloc(bytes);
+ *(UINT8 **)temp = p;
+ } else {
+ p = (UINT8 *)temp; /* pgr0524 */
+ }
+ if (p != NULL) {
+ ret = DeMarshallUINT8Stream(from, p, bytes);
+ }
+ break;
+ }
+ case rpc_STRING: {
+ char *p;
+ if (need_alloc) {
+ p = rpc_malloc(sizeof(char)*bytes);
+ *(char **)temp = p;
+ } else {
+ p = (char *)temp; /* pgr0524 */
+ }
+ if (p != NULL) {
+ ret = DeMarshallString(from, p, bytes);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+ if (ret < 0) {
+ error = 1;
+ } else {
+ remain_len -= ret;
+ from += ret;
+ }
+ }
+ va_end(ap);
+
+ if (error) {
+ return -1; /* pgr0524 */
+ } else {
+ return 0; /* pgr0524 */
+ }
+}
+
+void
+RPC_marshall_free(int num, ...) {
+ va_list ap;
+ va_start(ap, num);
+
+ int i;
+ for(i = 0 ; i < num ; i++) {
+ void *ptr = va_arg(ap, void *); // LCOV_EXCL_BR_LINE 15: macro defined in stdarg.h
+ if (ptr != NULL) {
+ rpc_free(ptr);
+ }
+ }
+ va_end(ap);
+}
diff --git a/video_in_hal/otherservice/rpc_library/library/src/rpc_thread.c b/video_in_hal/otherservice/rpc_library/library/src/rpc_thread.c
new file mode 100755
index 0000000..df0f746
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/src/rpc_thread.c
@@ -0,0 +1,1224 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_thread.c
+ * @brief RPC Library Internal Implementation--Processing of Internally Generated Threads
+ *
+ */
+/** @addtogroup RPClib_in */
+/** @{ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <malloc.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/select.h>
+#include <sys/poll.h>
+#include <sys/prctl.h>
+
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <sys/inotify.h>
+
+#include <other_service/rpc.h>
+#include "rpc_internal.h"
+
+#include <native_service/cl_monitor.h>
+#include <native_service/cl_process.h>
+
+/** Sub-threads that wake up in the RPC library */
+static RpcThreadInfo *Thread_info[RPC_MAX_THREADS_IN_PROCESS];
+static int Num_thread_info;
+pthread_t g_rpc_thread = RPC_NO_THREAD;
+UINT32 g_rpc_thread_alive;/**< Sub-thread running */
+
+#define RPC_MAGIC_ID (('R'<<24)|('P'<<16)|('C'<<8)|'L')
+
+/** Pipes used for communication with sub-threads
+ * Read: Main thread, Write: Sub-thread */
+int g_rpc_pipe_main_sub[2] = { -1, -1 };
+
+static pthread_mutex_t process_global_mutex = PTHREAD_MUTEX_INITIALIZER;
+#define PROCESS_MUTEX_LOCK rpc_mutex_lock(&process_global_mutex)
+#define PROCESS_MUTEX_UNLOCK rpc_mutex_unlock(&process_global_mutex)
+
+static void *RpcThreadMain(void *ptr);
+static void NotifyMainThread(RpcThreadInfo *th);
+
+static void KillRpcThread(void);
+static void NotifyAddServer(RpcThreadInfo *th);
+static void NotifyRemoveServer(RpcThreadInfo *th);
+
+static RPC_Result RpcRegistSockName(RpcIdInfo *idinfo, char *client_sock_name, const struct ucred *cr, int wd);
+static RPC_Result RpcCheckSockName(RpcIdInfo *idinfo, RPC_ID client_id);
+static RPC_Result RpcDeleteSockName(RpcIdInfo *idinfo, int wd);
+static RPC_Result RpcAllDeleteSockName(RpcIdInfo *idinfo, int inotify_fd);
+static RPC_Result RpcCheckClientCredential(RpcIdInfo *idinfo, const struct ucred *cr);
+
+#define RPC_SUB_THREAD_WAIT_SEC 5
+
+#define WAIT_FOR_SUB_THREAD(loop_cond, sec) \
+{ \
+ struct timeval timeout; \
+ timeout.tv_sec = sec; \
+ timeout.tv_usec = 0; \
+ \
+ int fd = RPC_pipe_sub_main(th)[PIPE_READ]; \
+ fd_set fds; \
+ \
+ while((loop_cond)) { \
+ FD_ZERO(&fds); \
+ FD_SET(fd, &fds); \
+ int sret = select(fd + 1, &fds, NULL, NULL, &timeout); \
+ if (sret < 0 && errno == EINTR) { \
+ continue; \
+ } else if (sret > 0 && FD_ISSET(fd, &fds)) { \
+ char c; \
+ read(fd, &c, sizeof(c)); \
+ } else { \
+ break; \
+ } \
+ } \
+}
+
+RUNS_IN_CALLERS_THREAD
+ RpcThreadInfo *
+RpcMyThreadInfo(void) {
+ RpcThreadInfo *ret = NULL;
+ int i;
+ pthread_t me = pthread_self();
+
+ PROCESS_MUTEX_LOCK;
+ for(i = 0; i < RPC_MAX_THREADS_IN_PROCESS ; i++) {
+ if (Thread_info[i] != NULL
+ && pthread_equal(Thread_info[i]->thread, me)) {
+ ret = Thread_info[i];
+ break;
+ }
+ }
+ PROCESS_MUTEX_UNLOCK;
+ return ret;
+}
+
+RUNS_IN_CALLERS_THREAD
+ RpcThreadInfo *
+RpcCreateThreadInfo(void) {
+ int i;
+ pthread_t me = pthread_self();
+
+ PROCESS_MUTEX_LOCK;
+ /* Look for a free slot to store the thread info pointer */
+ for(i = 0; i < RPC_MAX_THREADS_IN_PROCESS ; i++) {
+ if (Thread_info[i] != NULL) {
+ if (pthread_equal(Thread_info[i]->thread, me)) { // LCOV_EXCL_BR_LINE 6: double check
+ PROCESS_MUTEX_UNLOCK; // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return Thread_info[i];
+ } // LCOV_EXCL_STOP
+ } else {
+ break;
+ }
+ }
+
+ if (i == RPC_MAX_THREADS_IN_PROCESS) {
+ PROCESS_MUTEX_UNLOCK;
+ //CONFIG_ASSERT("Must increase RPC_MAX_THREADS_IN_PROCESS");
+ RPC_LOG_ERR("Must increase RPC_MAX_THREADS_IN_PROCESS");
+ return NULL;
+ }
+
+ /* Allocate area for thread info */
+ // Because there is a timing when the server sub-thread is accessed without being initialized,
+ // corrected so as to fill up to 0 in the MUTEX.
+ RpcThreadInfo *th = rpc_malloc(sizeof(*th));
+ if (th != NULL) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ memset(th, 0, sizeof(*th));
+ Thread_info[i] = th;
+ th->magic = RPC_MAGIC_ID;
+ Num_thread_info++;
+ }
+ PROCESS_MUTEX_UNLOCK;
+
+ if (th == NULL) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("Can't alloc thread_info.");
+ return NULL;
+ } // LCOV_EXCL_STOP
+
+ /* Initializing Thread Info */
+ th->thread = me;
+ pthread_mutex_init(&(th->th_mtx), NULL);
+ th->sequence_number = RPC_SEQ_NUM_START;
+
+ return th;
+}
+
+/*
+ * check if the allocated client ID conflicts with the server ID
+ * of the same thread
+ */
+ static int
+RpcCheckIdConflict(RpcThreadInfo *th, RPC_ID id) {
+ RpcIdInfo *idinfo;
+ idinfo = RPC_srvr_idinfo(th);
+ if (idinfo != NULL && RPC_my_id(idinfo) == id) { // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 1;
+ } // LCOV_EXCL_STOP
+ return 0;
+}
+
+/** Adding IDs with RPC_start()
+ *
+ * - Main: Create and initialize structures and tell sub-threads to add
+ * - Sub: Add pointer to thread info (RpcThreadInfo) and notify it to the main process
+ * - The main process waits for this procedure to finish.
+ * Use id_info->thread_info to determine completion (completed if not NULL)
+ */
+RUNS_IN_CALLERS_THREAD
+ int
+RpcCreateIdInfo(RpcThreadInfo *th,
+ RPC_ID id, RPC_dispatch_func_t dispatch, INT32 secure_check) {
+ RpcIdInfo *id_info = rpc_malloc(sizeof(*id_info));
+ if (id_info == NULL) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ } // LCOV_EXCL_STOP
+ memset(id_info, 0, sizeof(*id_info));
+
+ /*
+ * Creates a Unix domain socket based on a given number of ports
+ */
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ int sock_un = -1, secure_sock_un = -1;
+ socklen_t sa_len;
+ struct sockaddr_un sa_un;
+
+get_id_retry:
+ sock_un = socket(PF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0); /* Datagram socket for receiving API requests */
+ if (sock_un < 0) {
+ RPC_LOG_PERROR("socket");
+ goto error;
+ }
+ SET_NONBLOCK(sock_un);
+ SET_CLOSE_ON_EXEC(sock_un);
+
+ /*
+ * Naming Rules for Unix domain Sockets
+ * Server:(ID=50000-59999)
+ * sa_un.sun_path[0] = 0x00;
+ * sa_un.sun_path[1] = 'S';
+ * sa_un.sun_path[2-5] = sprintf("%04x", ID);
+ *
+ * Client:(ID=1-0xfffff)
+ * sa_un.sun_path[0] = 0x00;
+ * sa_un.sun_path[1-5] = sprintf("%05x", ID);
+ * ID is autobind by kernel during bind(see linux/net/unix/af_unix.c)
+ * ! Since it depends on the unix socket implementations of Linux, be careful when porting to other operating systems.
+ *
+ * ID=50000-59999 is duplicated in Server and Client,
+ * but generated it according to the above rules when sent in the RPClib (see rpc_udp.c)
+ *
+ * Because file deletion is leaked when the system is forcibly terminated and abnormal process termination
+ * by a traditional way to create and bind files under /tmp/RPC/,
+ * change to the above method(2009.02.04,2012.01.21)
+ */
+ memset(&sa_un, 0, sizeof(sa_un));
+ sa_un.sun_family = AF_UNIX;
+ if (dispatch != NULL) { // server
+ RpcSetServerName(sa_un.sun_path, id);
+ sa_len = sizeof(sa_un.sun_family) + SOCK_NAME_LEN;
+ } else { // client
+ // Automatically assign name (ID) by unix_autobind()
+ sa_len = sizeof(sa_un.sun_family);
+ }
+
+#else /* !AUTOBIND */
+ int sock_un = -1;
+ struct sockaddr_un sa_un;
+ sa_un.sun_family = AF_UNIX;
+ rpc_set_socket_name(sa_un.sun_path, id);
+ sock_un = socket(PF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
+ if (sock_un < 0) {
+ RPC_LOG_PERROR("socket(unix)");
+ goto error;
+ }
+ SET_NONBLOCK(sock_un);
+ SET_CLOSE_ON_EXEC(sock_un);
+ unlink(sa_un.sun_path);
+ sa_len = sizeof(sa_un);
+#endif /* !AUTOBIND */
+ if (bind(sock_un, (struct sockaddr *)&sa_un, sa_len) < 0) {
+ RPC_LOG_PERROR("DGRAM : bind(unix), ID:%#x", id);
+ goto error;
+ }
+
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ if (dispatch == NULL) { // client
+ // Retrieves the assigned name (ID)
+ socklen_t len = sizeof(sa_un);
+ if (getsockname(sock_un, (struct sockaddr *)&sa_un, &len) < 0) {
+ perror("getsockname");
+ goto error;
+ }
+ RpcGetClientName(sa_un.sun_path, &id);
+ if (RpcCheckIdConflict(th, id)) { // LCOV_EXCL_BR_LINE 8: dead code, RpcCheckIdConflict always is false
+ // LCOV_EXCL_START 8: dead code, RpcCheckIdConflict always is false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_STATE("ID %d conflicts with server -- get next one", id);
+ close(sock_un);
+ goto get_id_retry;
+ } // LCOV_EXCL_STOP
+ RPC_LOG_DEBUG("client %s", sa_un.sun_path + 1);
+ }
+#endif /* AUTOBIND */
+
+ id_info->port = id;
+ id_info->sock = sock_un;
+
+ if (dispatch != NULL) { /* server */
+ rpc_assert(th->srvr_id == NULL); // LCOV_EXCL_BR_LINE 6: double check
+ RpcApicallInfo *apicall = rpc_malloc(sizeof(*apicall));
+ if (apicall == NULL) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto error;
+ } // LCOV_EXCL_STOP
+
+ /* Create Socket for Authentication */
+ socklen_t secure_sa_len;
+ struct sockaddr_un secure_sa_un;
+
+ secure_sock_un = socket(PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0); /* stream socket for authentication */
+ if (secure_sock_un < 0) {
+ RPC_LOG_PERROR("socket");
+ rpc_free(apicall);
+ apicall = NULL;
+ goto error;
+ }
+ SET_NONBLOCK(secure_sock_un);
+ SET_CLOSE_ON_EXEC(secure_sock_un);
+
+ memset(&secure_sa_un, 0, sizeof(secure_sa_un));
+ secure_sa_un.sun_family = AF_UNIX;
+ RpcSetServerSecureName(secure_sa_un.sun_path, id);
+ secure_sa_len = sizeof(secure_sa_un.sun_family) + SECURE_SOCK_NAME_LEN;
+
+ /* Bind socket for authentication */
+ if (bind(secure_sock_un, (struct sockaddr *)&secure_sa_un, secure_sa_len) < 0) {
+ RPC_LOG_PERROR("STREAM : bind(unix), ID:%#x", id);
+ rpc_free(apicall);
+ apicall = NULL;
+ goto error;
+ }
+
+ id_info->secure_sock = secure_sock_un;
+
+ memset(apicall, 0, sizeof(*apicall));
+ apicall->dispatch_func = dispatch;
+ apicall->pipe_sub_main[PIPE_READ] = -1;
+ apicall->pipe_sub_main[PIPE_WRITE] = -1;
+ apicall->timeout_sec = 30; /* Server API processing timeout */
+ apicall->secure_check = secure_check; /* Authentication check by UID list */
+ if (NEED_SECURE_CHECK == secure_check) { /* Initializes the UID list with not-registered if secured given. */
+ apicall->regist_credential_info = NO_REGISTERED;
+ }
+ apicall->sock_info_head = NULL; /* Leading Node of Source Client Socket Info */
+ apicall->client_sock_name_num = 0; /* Number of elements in the source client's socket name list */
+ apicall->in_process_client = RPC_NO_PORT; /* Client RPC_ID during API processing */
+
+ id_info->apicall = apicall;
+ th->srvr_id = id_info;
+
+ /* Creating a pipe for communication pipe from sub-thread to main-thread direction */
+ if (pipe(apicall->pipe_sub_main) != 0) {
+ RPC_LOG_PERROR("pipe");
+ goto error;
+ }
+ SET_NONBLOCK(apicall->pipe_sub_main[PIPE_READ]);
+ SET_CLOSE_ON_EXEC(apicall->pipe_sub_main[PIPE_READ]);
+ SET_NONBLOCK(apicall->pipe_sub_main[PIPE_WRITE]);
+ SET_CLOSE_ON_EXEC(apicall->pipe_sub_main[PIPE_WRITE]);
+
+ PROCESS_MUTEX_LOCK;
+ if (g_rpc_thread == RPC_NO_THREAD) { /* There are no sub-threads. */
+ /* Creating a pipe for communication from main-thread to sub-thread direction */
+ if (pipe(g_rpc_pipe_main_sub) != 0) {
+ RPC_LOG_PERROR("pipe");
+ PROCESS_MUTEX_UNLOCK;
+ goto error;
+ }
+
+ SET_NONBLOCK(g_rpc_pipe_main_sub[PIPE_READ]);
+ SET_CLOSE_ON_EXEC(g_rpc_pipe_main_sub[PIPE_READ]);
+ SET_NONBLOCK(g_rpc_pipe_main_sub[PIPE_WRITE]);
+ SET_CLOSE_ON_EXEC(g_rpc_pipe_main_sub[PIPE_WRITE]);
+
+ /* Creating sub-thread */
+ pthread_t read_th;
+ if (pthread_create(&read_th, NULL, RpcThreadMain, 0) != 0) {
+ RPC_LOG_PERROR("pthread_create");
+ PROCESS_MUTEX_UNLOCK;
+ goto error;
+ }
+ g_rpc_thread = read_th;
+ }
+ PROCESS_MUTEX_UNLOCK;
+
+ /* Instruct a sub-thread to add and wait for completion */
+ NotifyAddServer(th);
+ // LCOV_EXCL_BR_START 15: macro define in rpc_thread.c
+ WAIT_FOR_SUB_THREAD((th->srvr_id->thread_info == NULL),
+ RPC_SUB_THREAD_WAIT_SEC);
+ // LCOV_EXCL_BR_STOP
+ rpc_assert(th->srvr_id->thread_info != NULL); // LCOV_EXCL_BR_LINE 6: double check
+
+ } else { /* dispatch == NULL => client */
+ id_info->count = 1;
+ id_info->thread_info = th;
+ th->clnt_id = id_info;
+ }
+ return 0; /* pgr0524 */
+
+error:
+ if (g_rpc_pipe_main_sub[PIPE_READ] >= 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc socket
+ close(g_rpc_pipe_main_sub[PIPE_READ]);
+ }
+ if (g_rpc_pipe_main_sub[PIPE_WRITE] >= 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc socket
+ close(g_rpc_pipe_main_sub[PIPE_WRITE]);
+ }
+ if (id_info->apicall != NULL) {
+ if (id_info->apicall->pipe_sub_main[PIPE_READ] >= 0) {
+ close(id_info->apicall->pipe_sub_main[PIPE_READ]);
+ }
+ if (id_info->apicall->pipe_sub_main[PIPE_WRITE] >= 0) {
+ close(id_info->apicall->pipe_sub_main[PIPE_WRITE]);
+ }
+ rpc_free(id_info->apicall);
+ }
+ if (sock_un != -1) {
+ close(sock_un);
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+ unlink(sa_un.sun_path);
+#endif /* !AUTOBIND */
+ }
+ if (secure_sock_un != -1) {
+ close(secure_sock_un);
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+ unlink(secure_sa_un.sun_path);
+#endif /* !AUTOBIND */
+ }
+ rpc_free(id_info);
+ th->srvr_id = NULL;
+ return -1; /* pgr0524 */
+}
+
+/*
+ * Notify an unfinished request of an error at server termination (RPC_end).
+ */
+ static void
+RpcSendErrorToPendingRequest(RpcThreadInfo *th, RpcIdInfo *idinfo) {
+ UINT16 api_num;
+ RPC_ID client;
+ char *args_string;
+ unsigned int args_size;
+ rpc_send_buf sendbuf;
+ char retcode[10];
+
+ do {
+ api_num = RpcGetAPIRequest(idinfo, &client,
+ &args_string, &args_size);
+ if (api_num > 0) { /* API calls are queued */
+
+ sprintf(retcode, "%08x ", RPC_ERR_Fatal);
+ sendbuf.buf = retcode;
+ sendbuf.bytes = sizeof(retcode) - 1;
+ RpcSendUdp2(idinfo, client, RPC_SEND_TO_CLIENT,
+ RPC_PACKET_APIRETURN, 1, &sendbuf);
+ RPC_LOG_STATE("sent error result to pending client %05x", client);
+ RpcFreeAPIArgsString(args_string);
+ }
+ } while(api_num > 0);
+}
+
+/*
+ * Notify unfinished request of deadlock when deadlock of the server is detected.
+ */
+ static void
+RpcSendDeadlockToPendingRequest(RpcThreadInfo *th, RpcIdInfo *idinfo) {
+ UINT16 api_num;
+ RPC_ID client;
+ char *args_string;
+ unsigned int args_size;
+ rpc_send_buf sendbuf;
+ char retcode[10];
+
+ do {
+ api_num = RpcGetAPIRequest(idinfo, &client,
+ &args_string, &args_size);
+ if (api_num > 0) { /* API calls are queued */
+
+ sprintf(retcode, "%08x ", RPC_ERR_Server_DeadLock);
+ sendbuf.buf = retcode;
+ sendbuf.bytes = sizeof(retcode) - 1;
+ RpcSendUdp2(idinfo, client, RPC_SEND_TO_CLIENT,
+ RPC_PACKET_APIRETURN, 1, &sendbuf);
+ RPC_LOG_STATE("sent deadlock result to pending client %05x", client);
+ RpcFreeAPIArgsString(args_string);
+ }
+ } while(api_num > 0);
+
+ if (RPC_NO_PORT != RPC_apicall_in_process_client(idinfo)) {
+ sprintf(retcode, "%08x ", RPC_ERR_Server_DeadLock);
+ sendbuf.buf = retcode;
+ sendbuf.bytes = sizeof(retcode) - 1;
+ RpcSendUdp2(idinfo, RPC_apicall_in_process_client(idinfo), RPC_SEND_TO_CLIENT,
+ RPC_PACKET_APIRETURN, 1, &sendbuf);
+ RPC_LOG_STATE("sent deadlock result to pending client %05x", RPC_apicall_in_process_client(idinfo));
+ RPC_apicall_in_process_client(idinfo) = RPC_NO_PORT;
+ }
+}
+
+/** Delete RPC_ID Info by RPC_end()
+ *
+ * - Main: Notify sub of deletion of RPC_ID info.
+ * - Sub: Delete a pointer from thread info (RpcThreadInfo) and notify main of that.
+ * - Main waits for this procedure to finish.
+ * Use id_info->thread_info to determine completion (completed if NULL).
+ * Then, release the memory related to RPC_ID info and close the socket.
+ */
+RUNS_IN_CALLERS_THREAD
+ void
+RpcDestroyIdInfo(RpcThreadInfo *th, RpcIdInfo *id_info) {
+ rpc_assert(id_info->count == 0); // LCOV_EXCL_BR_LINE 6: double check
+ if (id_info->apicall) {
+ if (g_rpc_thread_alive != 0) {
+ NotifyRemoveServer(th);
+ /* Wait for a sub-thread to recognize IDinfo deletion */
+ // LCOV_EXCL_BR_LINE 15: macro define in rpc_thread.c
+ WAIT_FOR_SUB_THREAD((th->srvr_id->thread_info != NULL),
+ RPC_SUB_THREAD_WAIT_SEC);
+ // LCOV_EXCL_BR_STOP
+ rpc_assert(th->srvr_id->thread_info == NULL); /* not recognized yet */ // LCOV_EXCL_BR_LINE 6: double check
+ }
+
+ if (id_info->apicall->pipe_sub_main[PIPE_READ] >= 0) {
+ close(id_info->apicall->pipe_sub_main[PIPE_READ]);
+ }
+ if (id_info->apicall->pipe_sub_main[PIPE_WRITE] >= 0) {
+ close(id_info->apicall->pipe_sub_main[PIPE_WRITE]);
+ }
+ if (id_info->secure_sock >= 0) {
+ close(id_info->secure_sock);
+ }
+ rpc_free(id_info->apicall);
+ th->srvr_id = NULL;
+ } else {
+ th->clnt_id = NULL;
+ }
+ rpc_free(id_info);
+}
+
+RUNS_IN_CALLERS_THREAD
+ void
+RpcDestroyThreadInfo(void) {
+ unsigned int i;
+ RpcThreadInfo *th = RpcMyThreadInfo();
+ if (th == NULL) {
+ return;
+ }
+
+ RPC_THREAD_MUTEX_LOCK(th);
+ if (th->thread == RPC_NO_THREAD) { // LCOV_EXCL_BR_LINE 6: double check
+ RPC_THREAD_MUTEX_UNLOCK(th); // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return;
+ } // LCOV_EXCL_STOP
+ th->thread = RPC_NO_THREAD;
+ RPC_THREAD_MUTEX_UNLOCK(th);
+
+ PROCESS_MUTEX_LOCK;
+ /*
+ * Remove the pointer from the global variable.
+ * Subsequent calls to RpcMyThreadInfo() return NULL
+ */
+ for(i = 0; i < RPC_MAX_THREADS_IN_PROCESS ; i++) {
+ if (th == Thread_info[i]) {
+ Thread_info[i] = NULL;
+ Num_thread_info--;
+ break;
+ }
+ }
+ PROCESS_MUTEX_UNLOCK;
+ BUG_ASSERT(i < RPC_MAX_THREADS_IN_PROCESS, "No info in Thread_info[]"); // LCOV_EXCL_BR_LINE 15: marco defined in rpc_internal.h
+
+ if (Num_thread_info == 0 && g_rpc_thread_alive != 0) {
+ KillRpcThread();
+ char name[32];
+ prctl(PR_GET_NAME, name);
+ RPC_LOG_DEBUG("[%s]waiting for sub thread to join...", name);
+ pthread_join(g_rpc_thread, NULL);
+ RPC_LOG_DEBUG("[%s]sub thread joined.", name);
+ g_rpc_thread = RPC_NO_THREAD; /* bug fix */
+ rpc_assert(g_rpc_thread_alive == 0); // LCOV_EXCL_BR_LINE 6: double check
+ close(g_rpc_pipe_main_sub[PIPE_READ]);
+ close(g_rpc_pipe_main_sub[PIPE_WRITE]);
+ }
+
+ if (th->srvr_id != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ RpcDestroyIdInfo(th, th->srvr_id); // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ th->srvr_id = NULL;
+ } // LCOV_EXCL_STOP
+ if (th->clnt_id != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ RpcDestroyIdInfo(th, th->clnt_id); // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ th->clnt_id = NULL;
+ } // LCOV_EXCL_STOP
+
+ pthread_mutex_destroy(&(th->th_mtx));
+ rpc_free(th);
+}
+
+#if !defined(RPC_USE_UNIX_AUTOBIND)
+/**
+ * Sub-function of RPC_end_all()
+ *
+ * Assuming releasing memory and closing the socket are processing at immediately after the end of the process,
+ * Suppress socket file leaks by only deleting socket files because to avoid deadlocks and shorten the time
+ * by exclusive processing.
+ */
+ void
+RpcUnlinkSocketFiles(void) {
+ int i;
+ char sock_name[16];
+
+ for(i = 0; i < RPC_MAX_THREADS_IN_PROCESS ; i++) {
+ RpcThreadInfo *th = Thread_info[i];
+ if (th != NULL) {
+ if (th->srvr_id != NULL) {
+ rpc_set_socket_name(sock_name, RPC_port(th->srvr_id));
+ RPC_LOG_STATE("unlink srvr %s", sock_name);
+ unlink(sock_name);
+ }
+ if (th->clnt_id != NULL) {
+ rpc_set_socket_name(sock_name, RPC_port(th->clnt_id));
+ RPC_LOG_STATE("unlink clnt %s", sock_name);
+ unlink(sock_name);
+ }
+ }
+ }
+}
+#endif /* !AUTOBIND */
+
+/*
+ * Deadlock detection check for servers in the thread
+ */
+ static void
+RpcDeadlockCheck(RpcThreadInfo** thread_info, unsigned int num_thread_info) {
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+
+ unsigned int i = 0;
+ for(i = 0 ; i < num_thread_info ; i++) {
+ RpcThreadInfo *th = thread_info[i];
+ RpcIdInfo *idinfo = th->srvr_id;
+ CL_MonitorEntry_t entry;
+
+ if (0 == CL_MonitorGetEntry(CL_MONITOR_TYPE_RPC, RPC_port(idinfo), &entry)) {
+ if (entry.state == CL_MONITOR_STATE_RUN && entry.timeout <= ts.tv_sec) {
+ RPC_LOG_ERR("Time Out : RPC_ID = %#x API_NUM = %#x", entry.id, entry.user_data);
+ fprintf(stderr, "Time Out : RPC_ID = %#x API_NUM = %#x\n", entry.id, entry.user_data);
+ RpcSendDeadlockToPendingRequest(th, idinfo);
+ }
+ }
+ }
+}
+/** Main functions of the sub-threads (READING THREAD)
+*/
+RUNS_IN_READING_THREAD
+ static void *
+RpcThreadMain(void *ptr __attribute__((unused))) {
+ struct pollfd wait_files[RPC_MAX_FD_IN_PROCESS];
+ RpcThreadInfo *thread_info[RPC_MAX_THREADS_IN_PROCESS];
+ unsigned int num_thread_info = 0;
+
+ unsigned int poll_num;
+ int need_reset_sockfd = 1;
+ int normal_exit = 0;
+ RPC_Result result;
+ unsigned int i, j;
+
+ /* Monitoring for clients process with inotify() *//* Monitoring target filename */
+ const int inotify_fd = inotify_init1(IN_CLOEXEC); /* fd for process monitoring with inotify() */
+
+ UINT8 readbuf[RPC_UDP_PACKET_SIZE];
+ memset(readbuf, 0, sizeof(UINT8) * RPC_UDP_PACKET_SIZE);
+
+ g_rpc_thread_alive = 1;
+
+ CL_MonitorInit(CL_MONITOR_INIT_USER); /* Using the API for Error Monitoring */
+
+ // Name the thread created in the RPClib (append "_R")
+#define RPC_APPEND_NAME "_R"
+#ifndef PRF_SIZE_PROCESSNAME
+#define PRF_SIZE_PROCESSNAME 8 /* Limit name length for Profiler Analysis Tools */
+#endif
+ {
+ char *p, name[32];
+ prctl(PR_GET_NAME, name);
+ name[PRF_SIZE_PROCESSNAME] = '\0';
+ if (strlen(name) + strlen(RPC_APPEND_NAME) > PRF_SIZE_PROCESSNAME) {
+ p = name + PRF_SIZE_PROCESSNAME - strlen(RPC_APPEND_NAME);
+ } else {
+ p = name + strlen(name);
+ }
+ strcpy(p, RPC_APPEND_NAME);
+ prctl(PR_SET_NAME, name);
+ }
+
+ /* Set the communication pipe with the main thread to poll fd */
+ poll_num = 1;
+ wait_files[0].fd = g_rpc_pipe_main_sub[PIPE_READ];
+ wait_files[0].events = POLLIN;
+
+restart:
+ for( ; ; ) {
+ if (need_reset_sockfd) {
+ /* Set the UDP socket of each RPC_ID to poll fd */
+ PROCESS_MUTEX_LOCK;
+ for(i = 0, j = 0 ; i < RPC_MAX_THREADS_IN_PROCESS ; i++) {
+ if (Thread_info[i] != NULL) {
+ if (Thread_info[i]->magic != RPC_MAGIC_ID) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("Someone(me?) destroyed my area!"); // LCOV_EXCL_LINE 6: double check
+ }
+ if (Thread_info[i]->srvr_id != NULL
+ && Thread_info[i]->srvr_id->thread_info != NULL) {
+ thread_info[j] = Thread_info[i];
+ j++;
+ }
+ }
+ }
+ PROCESS_MUTEX_UNLOCK;
+ num_thread_info = j;
+
+ poll_num = 1;
+ /* Register fd for monitoring with inotify() in poll() */
+ wait_files[1].fd = inotify_fd;
+ wait_files[1].events = POLLIN;
+
+ poll_num = 2;
+ for(i = 0 ; i < num_thread_info ; i++) {
+ /* Datagram socket for API request */
+ wait_files[poll_num].fd = thread_info[i]->srvr_id->sock; /* pgr0000 */
+ wait_files[poll_num].events = POLLIN;
+ poll_num++;
+ // LCOV_EXCL_BR_START 5: fail safe for libc listen
+ /* Authentication stream socket */
+ if (0 != listen(thread_info[i]->srvr_id->secure_sock, 10)) { /* Number of queues */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_PERROR("listen(unix)"); // LCOV_EXCL_LINE 5: fail safe for libc listen
+ }
+ // LCOV_EXCL_BR_STOP
+ wait_files[poll_num].fd = thread_info[i]->srvr_id->secure_sock;
+ wait_files[poll_num].events = POLLIN;
+ poll_num++;
+ }
+ need_reset_sockfd = 0;
+ }
+
+ int pollret;
+ pollret = poll(wait_files, poll_num, TIMEOUT_FOR_DEADLOCK_CHECK);
+
+ int save_errno = errno;
+
+ RpcDeadlockCheck(thread_info, num_thread_info);
+ if (pollret < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc poll
+ if (save_errno == EINTR) { // LCOV_EXCL_START 5: fail safe for libc poll
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue;
+ } else {
+ rpc_assert(pollret > 0);
+ goto exit_read_thread;
+ } // LCOV_EXCL_STOP
+ }
+
+ /* Commands from the main thread (via pipe) */
+ if ((wait_files[0].revents & POLLIN) == POLLIN) {
+ char buf[RPC_MAIN_SUB_COMMAND_SIZE];
+ long ret, arg;
+ int cmd;
+ RpcThreadInfo *th;
+ ret = read(wait_files[0].fd, buf, sizeof(buf));
+ if (ret == sizeof(buf)) {
+ sscanf(buf, RPC_MAIN_SUB_COMMANDs, &cmd, &arg);
+ switch(cmd) {
+ case RPC_COMMAND_ADD_SERVER:
+ th = (RpcThreadInfo *)arg;
+ th->srvr_id->thread_info = th; /* Indicate the completion of the processing */
+ NotifyMainThread(th);
+ need_reset_sockfd = 1;
+ goto restart;
+ break;
+
+ case RPC_COMMAND_REMOVE_SERVER:
+ th = (RpcThreadInfo *)arg;
+ RpcSendErrorToPendingRequest(th, th->srvr_id);
+
+ RpcAllDeleteSockName(th->srvr_id, inotify_fd); /* delete client_sock_name_list */
+ rpc_free((th->srvr_id)->apicall->uid_list); /* delete uid_list */
+ rpc_free((th->srvr_id)->apicall->gid_list); /* delete gid_list */
+
+ th->srvr_id->thread_info = NULL;/* Indicate the completion of the processing */
+ NotifyMainThread(th);
+ need_reset_sockfd = 1;
+ goto restart;
+ break;
+
+ case RPC_COMMAND_EXIT:
+ /************ Termination request from the parent thread *************/
+ RPC_LOG_DEBUG("Received exit command from main thread.");
+ normal_exit = 1;
+ goto exit_read_thread;
+ break;
+ } /* switch */
+ } /* if (ret == sizeof(buf)) */
+ } /* Complete the processing of commands from the main thread */
+
+ /* Client Monitoring Events with inotify() */
+ if ((wait_files[1].revents & POLLIN) == POLLIN) {
+ UINT32 read_len = 0;
+ int length = 0;
+ char *buffer;
+ buffer = (char *)rpc_malloc(BUF_LEN);
+ if (NULL == buffer) {// LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("rpc_malloc() ERROR.");
+ goto exit_read_thread;
+ } // LCOV_EXCL_STOP
+
+ if( (length = (int)read( inotify_fd, buffer, BUF_LEN ) ) < 0 ) { // LCOV_EXCL_START 5: fail safe for libc read
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_PERROR("inotify read() ERROR.");
+ rpc_free(buffer);
+ buffer = NULL;
+ goto exit_read_thread;
+ } // LCOV_EXCL_STOP
+ while ( read_len < length ) {
+ struct inotify_event *event = ( struct inotify_event * )&buffer[read_len];
+
+ if ( event->mask & IN_DELETE_SELF ) {/* Terminating a Client Process */
+ int i; /* Looping variable */
+
+ /* Delete the source socket name from all RpcThreadInfo in the received thread */
+ for(i = 0 ; i < num_thread_info ; i++) {
+ RpcThreadInfo *th = thread_info[i];
+ RpcDeleteSockName(th->srvr_id, event->wd);
+ }
+ }
+ read_len += (UINT32)(EVENT_SIZE + event->len); /* Size of the inotify_event structure */
+ }
+ rpc_free(buffer);
+ goto restart;
+ } /* Client Monitoring Events Completed with inotify() */
+
+ for(i = 2 ; i < poll_num ; i++) {
+ /* Event to the API request datagram socket */
+ if ((i % 2 == 0) && ((wait_files[i].revents & POLLIN) == POLLIN)) {
+ unsigned int thread_info_num = ((i/2) - 1); /* Compute thread_info[thread_info_num] with events */
+ RpcThreadInfo *th = thread_info[thread_info_num]; /* pgr0000 */
+ RpcIdInfo *idinfo = th->srvr_id;
+ for(;;) {
+ /* RPClib packet received */
+ int readret = RpcReadUdpPacket(idinfo, readbuf);
+ if (readret < 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc recvfrom
+ rpc_assert(readret >= 0); // LCOV_EXCL_START 5: fail safe for libc recvfrom
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto exit_read_thread;
+ // LCOV_EXCL_STOP
+ } else if (readret == 0) {
+ break;
+ }
+ /* successfully read udp packets */
+ /* parse the packet and queue events */
+ RPC_ID sender = RPC_NO_ID;
+ UINT32 seq_num = 0;
+ UINT32 size = 0;
+ RPC_packet_type command = RPC_PACKET_NONE;
+ if (RpcParsePacketHeader((const char *)readbuf, &command, &sender, &seq_num, &size) != RPC_OK) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ goto exit_read_thread;
+ }
+
+ long int api_num;
+ char *buff;
+
+ switch(command) {
+ case RPC_PACKET_APICALL:
+ if (RPC_DEBUG != NULL) { // LCOV_EXCL_BR_LINE 7: debug
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("RPC[%s]: received APIcall\n", RPC_DEBUG); // LCOV_EXCL_LINE 7: debug
+ }
+ // Return response without queuing for ALIVE query
+ api_num = strtol((const char *)(readbuf + RPC_PACKET_HEADER_LEN), NULL, 10);
+ if (api_num == RPC_API_NUM_RPC_ALIVE) {
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "OK", sizeof("OK"));
+ break;
+ }
+
+ /* Return BUSY if secure and unregistered in UID-list */
+ if ((NEED_SECURE_CHECK == RPC_secure_check(idinfo))
+ && (NO_REGISTERED == RPC_regist_credential_info(idinfo))) {
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "BUSY", sizeof("BUSY"));
+ RPC_LOG_ERR("Need UID list register.");
+ break;
+ }
+
+ result = RpcQueueAPIRequestBefore(idinfo, size, (char**)&buff);
+ if (result == RPC_OK) {
+ /* Check whether the source has been authenticated */
+ if(RPC_OK == RpcCheckSockName(idinfo, sender)) { /* Registerd the name of the source socket */
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "OK", sizeof("OK"));
+ RpcQueueAPIRequestAfter(idinfo, sender,
+ (const char *)(readbuf + RPC_PACKET_HEADER_LEN),
+ size, buff);
+ } else { /* Not registered (in other words, first communication with the source client) */
+ /* Authentication request to the client */
+ RPC_THREAD_MUTEX_UNLOCK(idinfo->thread_info);
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "CERT", sizeof("CERT"));
+ rpc_free(buff);
+ break;
+ }
+ } else if (result == RPC_ERR_Busy) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "BUSY", sizeof("BUSY"));
+ } else { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RpcSendUdpResponse(idinfo, sender, RPC_SEND_TO_CLIENT,
+ RPC_RESPONSE_APICALL,
+ seq_num, "ERR", sizeof("ERR"));
+ RPC_LOG_ERR("queueing APIcall failed.(%d)", result);
+ goto exit_read_thread;
+ } // LCOV_EXCL_STOP
+ NotifyMainThread(th);
+ if (RPC_DEBUG != NULL) { // LCOV_EXCL_BR_LINE 7: debug
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("RPC[%s]: notified APIcall\n", RPC_DEBUG); // LCOV_EXCL_LINE 7: debug
+ }
+ break;
+
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BUG_ASSERT(0, "Unknown UDP packet type"); // LCOV_EXCL_LINE 15: marco defined in rpc_internal.h
+ goto exit_read_thread;
+ break;
+ } /* switch(command) */
+ }/* for(;;) */
+
+ /* Event to the stream socket for authentication */
+ } else if ((i % 2 != 0) && ((wait_files[i].revents & POLLIN) == POLLIN)) {
+ unsigned int thread_info_num = ((i-1)/2 - 1); /* Compute thread_info[thread_info_num] with events */
+ struct sockaddr_un client_sa_un;
+ socklen_t client_len = sizeof(struct sockaddr_un);
+ struct ucred cr; /* Structure of client credit info */
+ RpcCertifyResult send_ret; /* Authentication result to pass to the client */
+ RpcThreadInfo *th = thread_info[thread_info_num];
+ RpcIdInfo *idinfo = th->srvr_id;
+
+ send_ret.certify_res = CERTIFY_NG;
+ send_ret.srvr_pid = 0;
+
+ /* Obtain client credit info from a connected socket */
+ int accept_sock = accept4(wait_files[i].fd, (struct sockaddr *)&client_sa_un, &client_len, SOCK_CLOEXEC);
+ int ret = getsockopt(accept_sock, SOL_SOCKET, SO_PEERCRED, &cr, &client_len);
+ if (ret == 0) { // LCOV_EXCL_BR_LINE 5: fail safe for libc getsockopt
+ client_sa_un = (struct sockaddr_un )client_sa_un;
+ /* Check if UID of client is allowed to communicate */
+ if (RPC_OK == RpcCheckClientCredential(idinfo, &cr)) {
+
+ /* Obtain the socket name associated with the RPC_ID of the client from the socket info */
+ char client_sock_name[SOCK_NAME_LEN];
+ RpcGetClientNameFromSock(client_sa_un.sun_path, client_sock_name);
+
+ /* Monitoring client processes with inotify */
+ char intfy_fname[32];
+ snprintf(intfy_fname, sizeof(intfy_fname), CL_INTFY_FILENAME_FORMAT, cr.pid);
+ int wd = inotify_add_watch(inotify_fd, intfy_fname, IN_DELETE_SELF);
+ if (0 > wd) { // LCOV_EXCL_BR_LINE 5: fail safe for libc inotify_add_watch
+ RPC_LOG_STATE("intfy_fname is Not Found [%s].", intfy_fname);
+ }
+
+ /* Register the source socket name in the management table */
+ RpcRegistSockName(idinfo, client_sock_name, &cr, wd);
+
+ /* Send server credit info to the client */
+ send_ret.certify_res = CERTIFY_OK;
+ send_ret.srvr_pid = getpid();
+ }
+ }
+
+ /* Send authentication result to client */
+ send(accept_sock, (char*)&send_ret, sizeof(RpcCertifyResult), 0);
+ close(accept_sock);
+
+ goto restart;
+
+ } else if ((wait_files[i].revents & ~POLLIN) != 0) { // LCOV_EXCL_START 5: fail safe for libc poll
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // POLLERR, etc. on UDP port
+ RPC_LOG_STATE("poll error %x", wait_files[i].revents);
+
+ if ((wait_files[i].revents & POLLNVAL) == POLLNVAL) {
+ need_reset_sockfd = 1;
+ goto restart;
+ }
+ } /* if ((wait_files[i].revents & POLLIN) == POLLIN) */ // LCOV_EXCL_STOP
+
+ } /* processing UDP packets finished */
+
+ } /* end of forever loop */
+
+exit_read_thread:
+
+ g_rpc_thread_alive = 0;
+ for(i = 0 ; i < num_thread_info ; i++) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NotifyMainThread(thread_info[i]); /* pgr0000 */ // LCOV_EXCL_LINE 6: double check
+ }
+
+ close(inotify_fd);
+
+ if (normal_exit == 0) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_CRIT("sub thread ABNORMALLY exited."); // LCOV_EXCL_LINE 6: double check
+ } else {
+ RPC_LOG_DEBUG("sub thread normally exited.");
+ }
+ return NULL;
+}
+
+/* Notification of sub-thread -> main-thread (via pipe) */
+RUNS_IN_READING_THREAD
+ static void
+NotifyMainThread(RpcThreadInfo *th) {
+ rpc_assert(th->srvr_id->apicall != NULL); // LCOV_EXCL_BR_LINE 6: double check
+ char c = 0;
+ write(th->srvr_id->apicall->pipe_sub_main[PIPE_WRITE], &c, sizeof(c));
+}
+
+/* Notification of main-thread -> sub-thread(via pipe) */
+/* Termination instruction */
+RUNS_IN_CALLERS_THREAD
+ static void
+KillRpcThread(void) {
+ char buf[RPC_MAIN_SUB_COMMAND_SIZE];
+ sprintf(buf, RPC_MAIN_SUB_COMMAND, RPC_COMMAND_EXIT, (unsigned long)0);
+ write(g_rpc_pipe_main_sub[PIPE_WRITE], buf, sizeof(buf));
+}
+
+/* AddRPC_ID */
+RUNS_IN_CALLERS_THREAD
+ static void
+NotifyAddServer(RpcThreadInfo *th) {
+ char buf[RPC_MAIN_SUB_COMMAND_SIZE];
+ sprintf(buf, RPC_MAIN_SUB_COMMAND, RPC_COMMAND_ADD_SERVER,
+ (unsigned long)th);
+ write(g_rpc_pipe_main_sub[PIPE_WRITE], buf, sizeof(buf));
+}
+
+/* Remove RPC_ID */
+RUNS_IN_CALLERS_THREAD
+ static void
+NotifyRemoveServer(RpcThreadInfo *th) {
+ char buf[RPC_MAIN_SUB_COMMAND_SIZE];
+ sprintf(buf, RPC_MAIN_SUB_COMMAND, RPC_COMMAND_REMOVE_SERVER,
+ (unsigned long)th);
+ write(g_rpc_pipe_main_sub[PIPE_WRITE], buf, sizeof(buf));
+}
+
+/* Register the socket name of the source client in the management table. */
+ static RPC_Result
+RpcRegistSockName(RpcIdInfo *idinfo, char *client_sock_name, const struct ucred *cr, int wd) {
+ if ((NULL == idinfo) || (NULL == client_sock_name) || (NULL == cr) || (0 > cr->pid)) { // LCOV_EXCL_BR_LINE 6: void *RpcThreadMain(void *ptr)
+ RPC_LOG_ERR("RpcRegistSockName() : Invalid Param."); // LCOV_EXCL_START 6: void *RpcThreadMain(void *ptr)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RpcClientSockNameInfo *sock_name_buf, *current;
+
+ sock_name_buf = rpc_malloc(sizeof(RpcClientSockNameInfo));
+ // LCOV_EXCL_BR_START 5: fail safe for libc malloc
+ if( sock_name_buf == NULL ){
+ return RPC_ERR_Fatal;
+ }
+ // LCOV_EXCL_BR_STOP
+ strcpy(sock_name_buf->client_sock_name, client_sock_name); /* Socket name */
+ sock_name_buf->pid = cr->pid; /* PID */
+ sock_name_buf->uid = cr->uid; /* UID */
+ sock_name_buf->gid = cr->gid; /* GID */
+ sock_name_buf->wd = wd; /* Non-negative inotify monitored descriptors */
+ sock_name_buf->next = NULL; /* Pointer to next node (NULL since last node) */
+
+ if (0 == RPC_client_sock_name_num(idinfo)) {
+ RPC_sock_info_head(idinfo) = sock_name_buf;
+ } else {
+ for (current = RPC_sock_info_head(idinfo); current->next != NULL; current = current->next)
+ ;
+ current->next = sock_name_buf;
+ }
+ RPC_client_sock_name_num_inc(idinfo);
+ return RPC_OK;
+}
+
+/* Check if the socket name of the source client is registered in the management table */
+ static RPC_Result
+RpcCheckSockName(RpcIdInfo *idinfo, RPC_ID client_id) {
+ if ((NULL == idinfo) || (client_id == RPC_NO_ID)) { // LCOV_EXCL_BR_LINE 6: void *RpcThreadMain(void *ptr)
+ RPC_LOG_ERR("RpcCheckSockName() : Invalid Param."); // LCOV_EXCL_START 6: void *RpcThreadMain(void *ptr)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ char buf[7], client_path_name[SOCK_NAME_LEN]; /* Client socket name */
+
+ /* Converting client_id to the socket name associated with RPC_ID */
+ RpcSetClientName(buf, client_id);
+ memcpy(client_path_name, buf + 1, 5);
+ client_path_name[5] = '\0';
+ RpcClientSockNameInfo *current = RPC_sock_info_head(idinfo);
+
+ /* Search source socket name in management table */
+ while (NULL != current) {
+ if (0 == strcmp(current->client_sock_name, client_path_name)) { /* Registered socket name (authenticated) */
+ return RPC_OK;
+ }
+ current = current->next;
+ }
+ return RPC_ERR_Fatal; /* Not registerd socket name (unauthenticated) */
+}
+
+/* Remove source client socket name from management table */
+ static RPC_Result
+RpcDeleteSockName(RpcIdInfo *idinfo, int wd) {
+ if ((NULL == idinfo) || (0 > wd)) {
+ RPC_LOG_ERR("RpcDeleteSockName() : Invalid Param.");
+ return RPC_ERR_Fatal;
+ }
+
+ RpcClientSockNameInfo *current, *previous;
+ current = RPC_sock_info_head(idinfo);
+ previous = current;
+ int cnt = 0;
+
+ /* Remove Source Socket Name in Management Table */
+ while (NULL != current) {
+ if (wd == current->wd) { /* Delete element */
+ if (0 == cnt) { /* Delete the start element in the management table */
+ RPC_sock_info_head(idinfo) = RPC_sock_info_head(idinfo)->next;
+ rpc_free(current);
+ current = RPC_sock_info_head(idinfo);
+ cnt = -1;
+ } else { /* Delete other than the start element in the management table */
+ previous->next = current->next;
+ rpc_free(current);
+ current = previous->next;
+ }
+ RPC_client_sock_name_num_dec(idinfo);
+ } else { /* Refer to the next node without deleting */
+ previous = current;
+ current = current->next;
+ }
+ cnt ++;
+ }
+
+ return RPC_OK;
+}
+
+/* Remove all source client socket names in the management table */
+ static RPC_Result
+RpcAllDeleteSockName(RpcIdInfo *idinfo, int inotify_fd) {
+ if (NULL == idinfo) { // LCOV_EXCL_BR_LINE 6: double check in void RpcDestroyThreadInfo(void)
+ RPC_LOG_ERR("RpcAllDeleteSockName() : Invalid Param."); // LCOV_EXCL_START 6: void RpcDestroyThreadInfo(void)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ RpcClientSockNameInfo *current = RPC_sock_info_head(idinfo);
+
+ while (NULL != current) {
+ RpcClientSockNameInfo *previous = current;
+ current = current->next;
+
+ if (0 <= previous->wd) {
+ inotify_rm_watch(inotify_fd, previous->wd);
+ }
+
+ rpc_free(previous);
+ previous = NULL;
+ RPC_client_sock_name_num_dec(idinfo);
+ }
+
+ return RPC_OK;
+}
+
+
+/* Check if client is allowed to communicate */
+ static RPC_Result
+RpcCheckClientCredential(RpcIdInfo *idinfo, const struct ucred *cr) {
+ if ((NULL == idinfo) || (NULL == cr)) { // LCOV_EXCL_BR_LINE 6: double check in void *RpcThreadMain(void *ptr)
+ RPC_LOG_ERR("RpcCheckClientCredential() : Invalid Param."); // LCOV_EXCL_START 6: void *RpcThreadMain(void *ptr)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+
+ /* Retern RPC_OK if authentication is not required */
+ if (NO_SECURE_CHECK == RPC_secure_check(idinfo)) {
+ return RPC_OK;
+ }
+
+ INT32 i = 0; /* Loop counter */
+
+ /* Search client UID in registered UID list */
+ for(i = 0; i < RPC_uid_num(idinfo); i++) {
+ if(RPC_uid_list(idinfo, i) == cr->uid) { /* Found UID in registered UID list */
+ return RPC_OK;
+ }
+ }
+
+ /* Search client GID in registered GID list */
+ for(i = 0; i < RPC_gid_num(idinfo); i++) {
+ if(RPC_gid_list(idinfo, i) == cr->gid) { /* Found GID in registered GID list. */
+ return RPC_OK;
+ }
+ }
+
+ RPC_LOG_ERR("[Client isn't authenticated!!!!]");
+ return RPC_ERR_Fatal; /* Not found UID in registered UID list */
+}
diff --git a/video_in_hal/otherservice/rpc_library/library/src/rpc_udp.c b/video_in_hal/otherservice/rpc_library/library/src/rpc_udp.c
new file mode 100755
index 0000000..0d4d59f
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/library/src/rpc_udp.c
@@ -0,0 +1,473 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file rpc_udp.c
+ * @brief RPC Library Internal Implementation--UDP Communication
+ *
+ */
+/** @addtogroup RPClib_in */
+/** @{ */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/poll.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h> // for usleep
+
+#include <fcntl.h>
+#include <sys/un.h>
+
+#include <sys/inotify.h>
+
+#include <other_service/rpc.h>
+#include "rpc_internal.h"
+
+static /*inline*/ UINT32
+RpcGetSequenceNumber(RpcThreadInfo *th) {
+ RPC_THREAD_MUTEX_LOCK(th);
+ UINT32 ret = th->sequence_number;
+ (th->sequence_number)++;
+ if (th->sequence_number == RPC_SEQ_NUM_INVALID) { // LCOV_EXCL_BR_LINE 200: overflow check, but test time is too long
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ th->sequence_number = RPC_SEQ_NUM_START; // LCOV_EXCL_LINE 200: overflow check, but test time is too long
+ }
+ RPC_THREAD_MUTEX_UNLOCK(th);
+ return ret;
+}
+
+/**
+ */
+int
+RpcReadUdpPacket(const RpcIdInfo *id, UINT8 *buf) {
+ struct sockaddr_un sa;
+ socklen_t sa_len = sizeof(sa);
+ // sa passed to recvfrom does not require initialization
+
+ for(;;) {
+
+ ssize_t ret = recvfrom(RPC_my_sock(id), buf, RPC_UDP_PACKET_SIZE,
+ 0, (struct sockaddr *)&sa, &sa_len);
+
+ if (ret < 0) {
+ if (errno == EAGAIN) { // LCOV_EXCL_BR_LINE 5: fail safe for libc recvfrom
+ //RPC_LOG_PERROR("recvfrom port %d", RPC_port(id));
+ return 0;
+ } else if (errno == EINTR) { // LCOV_EXCL_START 5: fail safe for libc recvfrom
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue;
+ } else {
+ RPC_LOG_PERROR("recvfrom port %d", RPC_port(id));
+ return -1;
+ } // LCOV_EXCL_STOP
+ } else if (ret == 0) {
+ RPC_LOG_STATE("*** recvfrom ret 0");
+ return 0;
+ } else {
+ return (int)ret;
+ }
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ } // LCOV_EXCL_LINE 10: final line
+}
+
+/** Number of sendto retries */
+#define RPC_SENDTO_RETRY 5
+
+RUNS_IN_CALLERS_THREAD
+RUNS_IN_READING_THREAD
+/**
+ */
+static int
+RpcSendUdpPacket(RpcIdInfo *id,
+ struct sockaddr_un *to, int do_retry,
+ void *mesg, unsigned int bytes) {
+ int nretry = 0;
+ ssize_t ret;
+ int myerr;
+ retry:
+ ret = sendto(RPC_my_sock(id), mesg, bytes, 0,
+ (struct sockaddr *)to, RPC_SOCKET_ADDR_LEN);
+ myerr = errno;
+
+ if (ret < 0) {
+ RPC_LOG_STATE("*** sendto %s ***", to->sun_path + 1);
+ if (myerr == EAGAIN || (do_retry && myerr==ECONNREFUSED && ++nretry <= RPC_SENDTO_RETRY)) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ usleep(100000);
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ RPC_LOG_DEBUG("*** sendto %s ***", to->sun_path + 1);
+#else /* AUTOBIND */
+ RPC_LOG_DEBUG("**************** sendto retry *********************");
+#endif /* !AUTOBIND */
+ goto retry;
+ }
+ errno = myerr;
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ if (do_retry) {
+ RPC_LOG_PERROR("sendto %s", to->sun_path + 1);
+ }
+#endif /* !AUTOBIND */
+ return -1;
+ } else if ((unsigned int)ret != bytes) {
+ RPC_LOG_STATE("can't send all");
+ return -1;
+ }
+ return 0;
+}
+
+RUNS_IN_CALLERS_THREAD
+RUNS_IN_READING_THREAD
+/**
+ */
+int
+RpcSendUdp(RpcIdInfo *id, const RPC_ID receiver, int direction, RPC_packet_type type, const void *mesg, unsigned int bytes) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rpc_send_buf sendbuf;
+ sendbuf.buf = mesg;
+ sendbuf.bytes = bytes;
+
+ return RpcSendUdp2(id, receiver, direction, type, 1, &sendbuf);
+} // LCOV_EXCL_STOP
+RUNS_IN_CALLERS_THREAD
+RUNS_IN_READING_THREAD
+/** UDP packet transmission process
+ *
+ * UDP packet format
+ * @verbatim
++--------------+--------------+
+|*1|*2|*3|*4|*5| PAYLOAD |
++--------------+--------------+
+@endverbatim
+ *
+ * *1 to *5 indicate the header. @see RPC_PACKET_HEADER
+ *
+ * - *1: [@%-2d] Type of packet
+ * - @see RPC_packet_type
+ * - *2: [@%-5x] Source RPC_ID
+ * - *3: [@%-8x] Sequence number
+ * - Set the value incremented from 1. This value must be unique for each source thread.
+ * - In the case of response packets, this field contains the sequence number of the packet from which the response was received.
+ * - *4: [@%-4u] Size of send data
+ * - In the case of sending data consists of single packet in PAYLOAD, this field contains number of the packet.
+ * - For a multipacket, the first packet contains the sum of the PAYLOAD of all packets,
+ * the last packet contains the PAYLOAD bytes of the packet.
+ * All other intermediate packets are filled with 0.(With up to two packets in the current constraint,
+ * there are no intermediate packets.)
+ * - *5: [@%1d] Position of packet
+ * - @see rpc_packet_position
+ */
+int
+RpcSendUdp2(struct RpcIdInfo *id, RPC_ID receiver, int direction,
+ RPC_packet_type type, unsigned int num, rpc_send_buf *sendbuf) {
+ unsigned char buf[RPC_UDP_PACKET_SIZE];
+ UINT32 seq_num = RpcGetSequenceNumber(id->thread_info);
+ unsigned int bytes = 0;
+ rpc_send_buf *sendbufp = sendbuf;
+ int i, do_retry = 1;
+ for(i = 0 ; i < num ; i++) {
+ bytes += sendbufp->bytes;
+ sendbufp++;
+ }
+ rpc_assert(bytes <= RPC_UDP_PAYLOAD); // LCOV_EXCL_BR_LINE 6: double check
+
+ struct sockaddr_un to;
+ memset(&to, 0, sizeof(to));
+ to.sun_family = AF_UNIX;
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ if (direction != RPC_SEND_TO_CLIENT) {
+ RpcSetServerName(to.sun_path, receiver);
+ if (direction == RPC_SEND_TO_SERVER_NO_RETRY) {
+ do_retry = 0;
+ }
+ } else {
+ RpcSetClientName(to.sun_path, receiver);
+ }
+#else /* !AUTOBIND */
+ rpc_set_socket_name(to.sun_path, rpc_get_port(receiver));
+#endif /* !AUTOBIND */
+
+ sprintf((char *)buf, RPC_PACKET_HEADER,
+ (int)type, RPC_my_id(id), seq_num, bytes,
+ RPC_PACKET_POS_ONEANDONLY);
+
+ unsigned char *bufp = buf + RPC_PACKET_HEADER_LEN;
+ for(i = 0 ; i < num ; i++) {
+ memcpy(bufp, sendbuf->buf, sendbuf->bytes);
+ bufp += sendbuf->bytes;
+ sendbuf++;
+ }
+ if (RpcSendUdpPacket(id, &to, do_retry,
+ buf, RPC_PACKET_HEADER_LEN + bytes) < 0) {
+ return -1;
+ }
+ return (int)seq_num;
+}
+
+RUNS_IN_READING_THREAD
+/**
+ */
+RPC_Result
+RpcSendUdpResponse(RpcIdInfo *id, const RPC_ID receiver, int direction,
+ RPC_packet_type type, UINT32 seq_num,
+ char *mesg, UINT32 bytes) {
+ rpc_assert(bytes <= RPC_MAX_RESPONSE_MESSAGE_SIZE); // LCOV_EXCL_BR_LINE 6: double check
+ char buf[RPC_PACKET_HEADER_LEN + RPC_MAX_RESPONSE_MESSAGE_SIZE];
+ sprintf(buf, RPC_PACKET_HEADER,
+ (int)type, RPC_my_id(id), seq_num, bytes,
+ (int)RPC_PACKET_POS_ONEANDONLY);
+ memcpy(buf + RPC_PACKET_HEADER_LEN, mesg, bytes);
+
+ struct sockaddr_un sa;
+ memset(&sa, 0, sizeof(sa));
+ sa.sun_family = AF_UNIX;
+#if defined(RPC_USE_UNIX_AUTOBIND)
+ if (direction != RPC_SEND_TO_CLIENT) {
+ RpcSetServerName(sa.sun_path, receiver);
+ } else {
+ RpcSetClientName(sa.sun_path, receiver);
+ }
+#else /* !AUTOBIND */
+ rpc_set_socket_name(sa.sun_path, rpc_get_port(receiver));
+#endif /* !AUTOBIND */
+ return RpcSendUdpPacket(id, &sa, 0, buf, RPC_PACKET_HEADER_LEN + bytes);
+}
+
+/**
+ */
+RPC_Result
+RpcParsePacketHeader(const char *str, RPC_packet_type *command,
+ RPC_ID_p id, UINT32 *seq_num, UINT32 *size) {
+ // LCOV_EXCL_BR_START 6: double check
+ rpc_assert(str != NULL && command != NULL && id != NULL
+ && seq_num != NULL && size != NULL);
+ // LCOV_EXCL_BR_STOP
+
+ if (sscanf(str, RPC_PACKET_HEADER_scanf, (int *)command, id, seq_num, size) != 4) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ *command = RPC_PACKET_NONE; // LCOV_EXCL_START 5: fail safe for libc sscanf
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BUG_ASSERT(0, "Parsing packet failed");
+ // LCOV_EXCL_STOP
+ return RPC_ERR_Fatal;
+ }
+ return RPC_OK;
+}
+
+#include <sys/time.h>
+
+RPC_Result
+RpcClientWaitResponse(RpcIdInfo *idinfo, UINT32 seq_num,
+ UINT32 timeout_msec, UINT16 *response) {
+ unsigned char readbuf[RPC_UDP_PACKET_SIZE];
+ fd_set fds;
+ int fd = idinfo->sock;
+
+ struct timeval timeout;
+ timeout.tv_sec = (__time_t)(timeout_msec / 1000);
+ timeout.tv_usec = (__suseconds_t)((timeout_msec % 1000) * 1000);
+
+ *response = RPC_RESPONSE_NONE;
+
+ for(;;) {
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ int sret = select(fd + 1, &fds, NULL, NULL, &timeout);
+ if (sret < 0 && errno == EINTR) { /* signal interrupt */ // LCOV_EXCL_START 5: fail safe for libc select
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue;
+ // LCOV_EXCL_STOP
+ } else if (sret == 0) { /* timeout */
+ RPC_LOG_ERR("server response timeout");
+ return RPC_ERR_No_Response;
+ } else if (sret > 0 && FD_ISSET(fd, &fds)) { // LCOV_EXCL_BR_LINE 5: fail safe for libc select
+ RPC_ID sender;
+ UINT32 seq;
+ UINT32 size;
+ RPC_packet_type command;
+ int readret = RpcReadUdpPacket(idinfo, readbuf);
+ if (readret <= 0) { // LCOV_EXCL_START 5: fail safe for libc recvfrom
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* debug code to see socket status */
+ /* why recvfrom() returned 0 ? */
+ struct pollfd pfd;
+ pfd.fd = fd;
+ pfd.events = POLLIN|POLLHUP|POLLERR;
+ sret = poll(&pfd, 1, 0/* timeout 0 */);
+ RPC_LOG_STATE("** poll revents=%x", pfd.revents);
+ return RPC_ERR_Fatal;
+ } // LCOV_EXCL_STOP
+ if (RpcParsePacketHeader((const char *)readbuf, &command, &sender, &seq, &size) != RPC_OK) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ return RPC_ERR_Fatal;
+ }
+ unsigned char c;
+ if (seq == seq_num) {
+ switch(command) {
+ case RPC_RESPONSE_APICALL:
+ c = readbuf[RPC_PACKET_HEADER_LEN];
+ switch(c) {
+ case 'O':
+ *response = RPC_RESPONSE_API_OK;
+ goto exit_loop_ok;
+ break;
+ case 'B':
+ *response = RPC_RESPONSE_API_BUSY;
+ goto exit_loop_ok;
+ break;
+ case 'E':
+ *response = RPC_RESPONSE_API_ERR;
+ goto exit_loop_ok;
+ break;
+ case 'D':
+ *response = RPC_RESPONSE_API_DEADLOCK;
+ goto exit_loop_ok;
+ break;
+ case 'C':
+ *response = RPC_RESPONSE_API_CERTIFY;
+ goto exit_loop_ok;
+ break;
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BUG_ASSERT(0, "illegal response\n"); // LCOV_EXCL_LINE 15: marco defined in rpc_internal.h
+ return RPC_ERR_Fatal;
+ break;
+ }
+ break;
+
+ default:
+ RPC_LOG_STATE("Unknown packet command=%d", command);
+ return RPC_ERR_Fatal;
+ break;
+ }
+ } else { /* sequence number mismatch == response to other request */
+ RPC_LOG_DEBUG("unwanted response received(delayed response?)");
+ continue;
+ }
+ } else { /* poll error */
+ RPC_LOG_PERROR("select in wait response");
+ return RPC_ERR_Fatal;
+ }
+ }
+ exit_loop_ok:
+ return RPC_OK;
+}
+
+RPC_Result
+RpcClientWaitResult(RpcIdInfo *idinfo, RPC_ID srvr_id) {
+ unsigned char readbuf[RPC_UDP_PACKET_SIZE];
+ fd_set fds;
+ int fd = idinfo->sock;
+ int inotify_fd = RPC_clnt_inotify_fd(idinfo);
+ int maxfd;
+ RPC_Result result = RPC_OK;
+
+ for(;;) {
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ FD_SET(inotify_fd, &fds);
+
+ /* Determine the maximum value of fd to wait */
+ if (fd > inotify_fd) {
+ maxfd = fd;
+ } else {
+ maxfd = inotify_fd;
+ }
+
+ int sret = select(maxfd + 1, &fds, NULL, NULL, NULL);
+ if (sret < 0 && errno == EINTR) { /* signal interrupt */ // LCOV_EXCL_START 5: fail safe for libc select
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue;
+ // LCOV_EXCL_STOP
+ } else if (sret > 0 && FD_ISSET(fd, &fds)) { /* success */ // LCOV_EXCL_BR_LINE 5: fail safe for libc select
+ RPC_ID sender;
+ UINT32 seq;
+ UINT32 size;
+ RPC_packet_type command;
+ int readret = RpcReadUdpPacket(idinfo, readbuf);
+ if (readret <= 0) { // LCOV_EXCL_START 5: fail safe for libc recvfrom
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rpc_assert(readret >= 0);
+ result = RPC_ERR_Fatal;
+ goto exit_loop_ok;
+ } // LCOV_EXCL_STOP
+ if (RpcParsePacketHeader((const char *)readbuf, &command, &sender, &seq, &size) != RPC_OK) { // LCOV_EXCL_BR_LINE 11: Unexpected branch // NOLINT(readability/nolint)
+ // LCOV_EXCL_START 5: fail safe for libc sscanf
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ result = RPC_ERR_Fatal;
+ goto exit_loop_ok;
+ } // LCOV_EXCL_STOP
+ switch(command) {
+ case RPC_PACKET_APIRETURN:
+ result = RpcSetAPIcallReturn(idinfo,
+ (const char *)(readbuf + RPC_PACKET_HEADER_LEN),
+ size);
+ if(result == RPC_OK) { // LCOV_EXCL_BR_LINE 5: fail safe for libc malloc
+ if (sscanf((const char *)(readbuf + RPC_PACKET_HEADER_LEN), "%08x ", (unsigned int *)&result) != 1) { // LCOV_EXCL_BR_LINE 5: fail safe for libc sscanf
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BUG_ASSERT(0, "Parsing packet failed"); // LCOV_EXCL_LINE 15: marco defined in rpc_internal.h
+ return RPC_ERR_Fatal;
+ }
+ }
+ goto exit_loop_ok;
+ default:
+ RPC_LOG_STATE("unwanted packet received while waiting for API return");
+ continue;
+ break;
+ }
+ } else if (sret > 0 && FD_ISSET(inotify_fd, &fds)) { /* server process is terminate. */
+ UINT32 read_len = 0;
+ int length = 0;
+ char *buffer;
+ buffer = (char *)rpc_malloc(BUF_LEN);
+ if (NULL == buffer) { // LCOV_EXCL_START 5: fail safe for libc malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_ERR("rpc_malloc() ERROR.");
+ } // LCOV_EXCL_STOP
+
+ if((length = (int)read( inotify_fd, buffer, BUF_LEN )) < 0 ) { // LCOV_EXCL_START 5: fail safe for libc read
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_PERROR("inotify read() ERROR.");
+ } // LCOV_EXCL_STOP
+ while (read_len < length) {
+ struct inotify_event *event = ( struct inotify_event * )&buffer[read_len];
+
+ if (event->mask & IN_DELETE_SELF) { /* Terminating a Server Process */
+ if (RPC_ERR_Server_Finish == RpcDeleteSrvrPid(idinfo, srvr_id, event->wd)) {
+ RPC_LOG_PERROR("server process is terminate. : srvr_ID = %x", srvr_id);
+ result = RPC_ERR_Fatal;
+ }
+ }
+ read_len += (UINT32)(EVENT_SIZE + event->len); /* Size of the inotify_event structure */
+ }
+ rpc_free(buffer);
+ if (RPC_OK != result) {
+ goto exit_loop_ok;
+ }
+
+ } else { /* poll error */ // LCOV_EXCL_START 5: fail safe for libc select
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RPC_LOG_PERROR("select in wait result");
+ result = RPC_ERR_Fatal;
+ goto exit_loop_ok;
+ // LCOV_EXCL_STOP
+ }
+ }
+exit_loop_ok:
+
+ return result;
+}
+
+/** @} */
diff --git a/video_in_hal/otherservice/rpc_library/tool/Makefile b/video_in_hal/otherservice/rpc_library/tool/Makefile
new file mode 100755
index 0000000..8ffd816
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/tool/Makefile
@@ -0,0 +1,62 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+all: rpc_apidef
+
+clean:
+ rm -rf $(CLEAN_FILES)
+
+YACC := bison
+YFLAGS := -d -t
+LEX := flex
+LFLAGS := -d
+
+CPPFLAGS := -I../library/include -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+CFLAGS := -Wall -Wno-unused-function -Wno-unused-variable -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+rpc_apidef: apidef.tab.o lex.yy.o apidef.o
+ $(CXX) $(CPPFLAGS) -o $@ $^
+
+apidef.tab.o: apidef.tab.h apidef.tab.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c $^
+
+lex.yy.o: lex.yy.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c $^
+
+apidef.o: apidef.cc
+ $(CXX) $(CPPFLAGS) $(CFLAGS) -c $^
+
+apidef.tab.h apidef.tab.c: apidef.y
+ $(YACC) $(YFLAGS) $<
+
+lex.yy.c: apidef.l apidef.tab.h
+ $(LEX) $(LFLAGS) $<
+
+CLEAN_FILES := rpc_apidef *.o apidef.tab.h apidef.tab.c lex.yy.c
+
+CLEAN_TARGET := clean-all clean-all-sub clean-sub
+INSTALL_TARGET := install-header
+EMPTY_TARGET := install-prog install-data install-lib install-arlib install-shlib
+.PHONY: all install clean $(CLEAN_TARGET) $(INSTALL_TARGET) $(EMPTY_TARGET)
+
+$(CLEAN_TARGET): clean
+
+$(INSTALL_TARGET): install
+
+$(EMPTY_TARGET):
+
+include ../../other_service.mk
+
diff --git a/video_in_hal/otherservice/rpc_library/tool/apidef.cc b/video_in_hal/otherservice/rpc_library/tool/apidef.cc
new file mode 100755
index 0000000..ec0a489
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/tool/apidef.cc
@@ -0,0 +1,1104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file apidef.cc
+ * @brief RPC tools--Main processing(Implementations of APIDef classes)
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h>
+
+#include <other_service/rpc.h>
+
+#include "apidef.h"
+#include "apidef.tab.h"
+
+static APIDef *API_Def;
+
+extern "C" { // C interface functions
+
+void
+ApidefDefineId(const char *id) {
+ if (id != NULL) {
+ if (API_Def == NULL) {
+ API_Def = new APIDef();
+ }
+ API_Def->DefineId(id);
+ }
+}
+
+void
+ApidefAddHeader(const char *filename) {
+ if (filename != NULL) {
+ if (API_Def == NULL) {
+ API_Def = new APIDef();
+ }
+ API_Def->AddHeader(filename);
+ }
+}
+
+int
+ApidefPushFunctionArg(int arg_code, int buffer_bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out,
+ const char *var_name) {
+ if (API_Def == NULL) {
+ API_Def = new APIDef();
+ }
+ return API_Def->AddFunctionArg(arg_code, buffer_bytes, is_pointer,
+ is_vararray, is_array_size,
+ var_type_name, in_out, var_name);
+}
+
+void
+ApidefProcessFunction(const char *name) {
+ if (API_Def == NULL) {
+ API_Def = new APIDef();
+ }
+ API_Def->NameFunction(name);
+}
+
+void
+ApidefListFunctions(int with_args) {
+ if (API_Def != NULL) {
+ API_Def->Print(with_args);
+ }
+}
+
+void
+ApidefFreeAllocation(void) {
+ if (API_Def != NULL) {
+ delete API_Def;
+ API_Def = NULL;
+ }
+}
+
+int
+ApidefMakeStubs(void) {
+ if (API_Def != NULL) {
+ API_Def->MakeStubs();
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+} // extern "C"
+
+/*
+ * Retrieving Argument Names Without Decorators
+ */
+void
+Arg::GetUndecolatedName(string& name /* OUT */, int num) {
+ name = "v";
+ if (num > 0) {
+ /* Making Variable Names Sequential Numbers */
+ char num_str[5];
+ sprintf(num_str, "%d", num);
+ name += num_str;
+ } else {
+ /* Use a user-supplied pseudo-variable name */
+ name = m_name;
+ }
+}
+
+int
+Arg::PrintUndecoratedName(fstream& out, int num) {
+ /* Pointer argument */
+ if (m_is_pointer) {
+ out << "*";
+ }
+
+ if (num > 0) {
+ /* Making Variable Names Sequential Numbers */
+ out << "v" << num;
+ } else {
+ /* Use a user-supplied pseudo-variable name */
+ out << m_name;
+ }
+
+ return 0;
+}
+
+/*
+ * Outputs one argument in a function prototype declaration
+ * out: Destination file
+ * num: Handling of Formal Argument Names
+ * 0 :Formal argument name specified in the API definition file
+ * Non-zero: Use "v" + specified number(Examples: v1, v2, ...)
+ */
+int
+Arg::PrintPrototype(fstream& out, int num) {
+ const char *type = TypeCodeString(m_code);
+ if (type == NULL) {
+ type = m_type_name.c_str();
+ }
+ if (type == NULL) {
+ cout << "Internal Error Occurrence!!\n";
+ return 1;
+ }
+
+ /* Const non-output pointers */
+ if ((m_in_out & RPC_OUT_ARG) == 0 && (m_bytes != 0 || m_is_pointer != 0)) {
+ out << "const ";
+ }
+ out << type << " ";
+ if (m_is_pointer && m_bytes == 0) {/* Non-string pointer arguments */
+ out << "*";
+ }
+
+ if (num > 0) {/* Making variable names sequential numbers */
+ out << "v" << num;
+ } else {/* Use a user-supplied pseudo-variable name */
+ out << m_name;
+ }
+
+ /* Variable-length arrays */
+ if (m_is_vararray != 0) {
+ out << "/* VAR_ARRAY */";
+ }
+
+ /* Variable-length arrays length */
+ if (m_is_array_size != 0) {
+ out << "/* VAR_SIZE */";
+ }
+
+ /*
+ * Commenting on OUT/INOUT Arguments
+ * Maximum number of bytes of a string argument added to a comment
+ */
+ if ((m_in_out & RPC_OUT_ARG) != 0 || m_bytes != 0) {
+ out << "/* ";
+ if ((m_in_out & RPC_OUT_ARG) != 0) {
+ if ((m_in_out & RPC_IN_ARG) != 0) {
+ out << "IN";
+ }
+ out << "OUT ";
+ }
+ if (m_bytes) {
+ out << m_bytes << "Byte ";
+ }
+ out << "*/";
+ }
+
+ return 0;
+}
+
+int
+Arg::CreateMarshallArgs(fstream& out, int num) {
+ return CreateMarshallArgs(out, num, (RPC_IN_ARG|RPC_OUT_ARG));
+}
+
+int
+Arg::CreateMarshallArgs(fstream& out, int num, string &array_size_name) {
+ return CreateMarshallArgs(out, num, (RPC_IN_ARG|RPC_OUT_ARG), array_size_name);
+}
+
+int
+Arg::CreateMarshallArgs(fstream& out, int num, int in_out) {
+ string dummy = "";
+ return CreateMarshallArgs(out, num, in_out, dummy);
+}
+
+/*
+ * The arguments to rpc_marshall_args() are generated for each API argument.
+ * for each API argument.
+ * out: Destination file
+ * num: Number given to the variable name of the argument (Examples: 1 for v1)
+ * in_out: Specifying the IN or OUT Attributes
+ * Output only if the argument has the specified attribute
+ */
+int
+Arg::CreateMarshallArgs(fstream& out, int num, int in_out, string &array_size_name) {
+ if ((m_in_out & in_out) != 0) {
+ /*
+ * Collectively passes the argument type, pointer/non-pointer, IN/OUT attribute,
+ * and the maximum number of bytes of the argument type to one integer.
+ */
+ RPC_marshall_flag flag;
+ flag.bits.code = m_code & ((1<<RPC_MARSHALL_FLAG_BITS_CODE)-1);
+ flag.bits.is_vararray = ((array_size_name.size() != 0) ? 1: 0) &
+ ((1<<RPC_MARSHALL_FLAG_BITS_IS_VARARRAY)-1);
+ flag.bits.is_pointer = m_is_pointer & ((1<<RPC_MARSHALL_FLAG_BITS_IS_POINTER)-1);
+ flag.bits.in_out = m_in_out & ((1<<RPC_MARSHALL_FLAG_BITS_IN_OUT)-1);
+ flag.bits.bytes = (UINT16)(m_bytes);
+ char str[11];
+ sprintf(str, "0x%x", htonl(flag.all));
+ out << "\t\t\t" << str;
+
+ /*
+ * Add size of user-defined type to argument
+ */
+ if (m_code == rpc_USER_DEFINED) {
+ if (array_size_name.size() != 0) {
+ out << " + ntohs(sizeof(" << m_type_name << ") * " << array_size_name << ")";
+ } else {
+ out << " + ntohs(sizeof(" << m_type_name << "))";
+ }
+ } else if (array_size_name.size() != 0) {
+ out << " + ntohs(sizeof(" << TypeCodeString(m_code) << ") * " << array_size_name << ")";
+ }
+
+ out << ", v" << num;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+int
+Arg::CreateDemarshallArgs(fstream& out, int deliver_pointer, int num) {
+ return CreateDemarshallArgs(out, deliver_pointer, num, (RPC_IN_ARG|RPC_OUT_ARG));
+}
+
+int
+Arg::CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, string &array_size_name) {
+ return CreateDemarshallArgs(out, deliver_pointer, num, (RPC_IN_ARG|RPC_OUT_ARG), array_size_name);
+}
+
+int
+Arg::CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, int in_out) {
+ string dummy = "";
+ return CreateDemarshallArgs(out, deliver_pointer, num, in_out, dummy);
+}
+
+/*
+ * The arguments to rpc_demarshall_args() are generated for each API argument.
+ * for each API argument.
+ * out: Destination file
+ * deliver_pointer: Passing a Variable Pointer(non-0)
+ * num: Number given to the variable name of the argument (Examples: 1 for v1)
+ * in_out: Specifying the IN or OUT Attributes
+ * Output only if the argument has the specified attribute
+ */
+int
+Arg::CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, int in_out, string &array_size_name) {
+ if ((m_in_out & in_out) != 0) {
+ /*
+ * Collectively passes the argument type, pointer/non-pointer, IN/OUT attribute,
+ * and the maximum number of bytes of the argument type to one integer.
+ */
+ RPC_marshall_flag flag;
+ flag.bits.code = m_code & ((1<<RPC_MARSHALL_FLAG_BITS_CODE)-1);
+ flag.bits.is_vararray = ((array_size_name.size() != 0) ? 1: 0) &
+ ((1<<RPC_MARSHALL_FLAG_BITS_IS_VARARRAY)-1);
+ flag.bits.is_pointer = m_is_pointer & ((1<<RPC_MARSHALL_FLAG_BITS_IS_POINTER)-1);
+ flag.bits.in_out = m_in_out & ((1<<RPC_MARSHALL_FLAG_BITS_IN_OUT)-1);
+ flag.bits.bytes = (UINT16)(m_bytes);
+ char str[11];
+ sprintf(str, "0x%x", htonl(flag.all));
+ out << "\t\t\t" << str;
+
+ /*
+ * Add size of user-defined type to argument
+ */
+ if (m_code == rpc_USER_DEFINED) {
+ out << " + ntohs(sizeof(" << m_type_name << "))";
+ }
+
+ out << ", ";
+ if (deliver_pointer) {
+ /* Pass a pointer */
+ out << "&";
+ }
+ out << "v" << num;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+int
+Function::AppendArg(int code, int bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out, const char *var_name) {
+ if (NumOfArgs() >= RPC_MAX_API_ARG_NUM) {
+ cout << "Too many API function arguments.\n";
+ return -1;
+ }
+ Arg *a = new Arg(code, bytes, is_pointer, is_vararray, is_array_size,
+ var_type_name, in_out, var_name);
+ m_args.push_back(*a);
+ delete a;
+ return 0;
+}
+
+/*
+ * Generate prototype declarations for a single API function
+ * out: Destination file
+ */
+int
+Function::PrintPrototype(fstream& out, int server) {
+ int ret = 0;
+
+ const char *return_type
+ = server ? RPC_API_SERVER_RETURN : RPC_API_CLIENT_RETURN;
+#ifdef DBG_ENABLE
+ if ((server) || (!rpc_log_enable)) {
+ out << return_type << " " << m_name << "(";
+ } else {
+ out << return_type << " __" << m_name << "(";
+ }
+#else
+ out << return_type << " " << m_name << "(";
+#endif
+
+ list<Arg>::size_type num_args = m_args.size();
+ if (num_args > 0) {
+ list<Arg>::iterator a;
+ a = m_args.begin();
+ for (list<Arg>::size_type i = 1; i <= num_args; ++i, ++a) {
+ a->PrintPrototype(out);
+#ifdef DBG_ENABLE
+ if ((server) || (!rpc_log_enable)) {
+ if (i != num_args) {
+ out << ", ";
+ }
+ } else {
+ out << ", ";
+ }
+#else
+ if (i != num_args) {
+ out << ", ";
+ }
+#endif
+ }
+ } else {
+#ifdef DBG_ENABLE
+ if ((server) || (!rpc_log_enable)) {
+ out << "void";
+ }
+#else
+ out << "void";
+#endif
+ }
+#ifdef DBG_ENABLE
+ /* Debug information */
+ if ((!server) && (rpc_log_enable)) {
+ out << "const char *filename, const char *funcname, int line ";
+ }
+#endif
+ out << ");\n";
+ return ret;
+}
+
+#ifdef DBG_ENABLE
+int
+Function::PrintMacro(fstream& out) {
+ int ret = 0;
+ out << "#define " << m_name << "(";
+
+ int num_args = m_args.size();
+ if (num_args > 0) {
+ int i;
+ char c;
+ for (i = 1, c = 'a'; i <= num_args; i++, c++) {
+ out << c;
+ if (i != num_args) {
+ out << ", ";
+ }
+ }
+ out << ") \\\n\t";
+
+ /* Entity */
+ out << "__" << m_name << "(";
+ for (i = 1, c = 'a'; i <= num_args; i++, c++) {
+ out << c << ", ";
+ }
+ out << "__FILE__, __func__, __LINE__)\n";
+ } else { /* Without arguments */
+ out << ") " << "__" << m_name << "(__FILE__, __func__, __LINE__)\n";
+ }
+
+ return ret;
+}
+#endif
+
+int
+APIDef::MakeHeaderFiles(int server) {
+ char filename[MAX_FILENAME_LEN+1];
+ sprintf(filename, "%s%s", m_lowerid.c_str(),
+ (server ? SERVER_HEADER_FILE : CLIENT_HEADER_FILE));
+ int ret = 0;
+
+ fstream out(filename, ios::out);
+ if (!out.is_open()) {
+ cout << "ERROR: File " << filename << " Could not open.\n";
+ return 1;
+ }
+ cout << "info: Header file " << filename << " Creating.\n";
+
+ const char *define_str =
+ server ? SERVER_HEADER_DEFINE : CLIENT_HEADER_DEFINE;
+ const char *title = server ? SERVER_HEADER_TITLE : CLIENT_HEADER_TITLE;
+
+ out << "#ifndef _" << m_lowerid << define_str << "\n";
+ out << "#define _" << m_lowerid << define_str << "\n";
+ out << "/*\n";
+ out << " * " << m_id << " " << title << " " << filename << "\n";
+ out << " *\n";
+ out << RPCTOOL_WARNING_STRING << "\n";
+ out << " */\n\n";
+
+ list<string>::iterator i;
+ for (i = m_headers.begin(); i != m_headers.end(); ++i) {
+ out << "#include <" << *i << ">\n";
+ }
+ out << "\n";
+
+ if (server) {
+
+ out << EXTERN_C_START << "\n";
+
+ out << RPC_API_DISPATCH_RETURN << " "
+ << m_id << RPC_API_DISPATCH_FUNC_FULL << ";\n";
+
+ out << "#ifdef RPC_DISPATCH_FUNC\n"
+ << "#undef RPC_DISPATCH_FUNC\n"
+ << "#define RPC_DISPATCH_FUNC " << m_id << RPC_API_DISPATCH_FUNC_NAME
+ << "\n#else /* !RPC_DISPATCH_FUNC */\n"
+ << "#error \"Please include <rpc.h> first!!\"\n"
+ << "#endif /* !RPC_DISPATCH_FUNC */\n\n";
+
+ out << EXTERN_C_END << "\n";
+
+ }
+#ifdef DBG_ENABLE
+ else if (rpc_log_enable) {
+ /* DEBUG INFORMATION EMBEDDED MACRO */
+ out << "/* Debug information embedded macro definition */\n";
+ list<Function>::iterator f;
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ if (f->PrintMacro(out) != 0) {
+ ret = 1;
+ break;
+ }
+ }
+ out << "\n";
+ }
+#endif
+
+ out << EXTERN_C_START << "\n";
+
+ out << "/* API definitions */\n";
+ list<Function>::iterator f;
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ if (f->PrintPrototype(out, server) != 0) {
+ ret = 1;
+ break;
+ }
+ }
+ out << "\n";
+
+ out << EXTERN_C_END << "\n";
+
+ out << "#endif /* _" << m_lowerid << define_str << " */\n";
+ out.close();
+ return ret;
+}
+
+int
+Function::PrintServerStub(fstream& out) {
+ int num_args = NumOfArgs();
+
+ out << "\tcase " << RPC_API_NUM_PREFIX << m_name << ": {\n";
+
+ list<Arg>::iterator a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ const char *type = TypeCodeString(a->Code());
+ if (type == NULL) {
+ type = (a->TypeName()).c_str();
+ }
+ if (type == NULL) {
+ return 1;
+ }
+ out << "\t\t" << type << " ";
+ if (a->Bytes() > 0 || a->IsPointer()) {/* Pointer-passing argument */
+ if (a->Bytes() > 0) {
+ out << "v" << i << " = NULL;\n";
+ } else if (a->IsPointer()) {
+ out << "*v" << i << " = NULL;\n";
+ }
+ } else {/* Pass-by-value argument */
+ out << "v" << i << ";\n";
+ }
+ }
+ if (num_args > 0) {
+ out << "\t\tif (" << RPC_DEMARSHALL_FUNCTION
+ << " (args_string, args_size, 1, " << num_args << ",\n";
+ /* In the STUB of servers for all pre-call demarshall */
+ /* Passing Pointers to Local Variables in Server STUB */
+ /* Pointer/ Buffer will alloc the required space in demarshall_arguments() */
+
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->IsVararray() != 0) { /* Variable-length arrays */
+ a->CreateDemarshallArgs(out, 1, i, m_array_size_name);
+ } else {
+ a->CreateDemarshallArgs(out, 1, i);
+ }
+ if (i < num_args) {
+ out << ",";
+ }
+ out << "\n";
+ }
+ out << "\t\t ) < 0) {\n";
+ out << "\t\t\tgoto _" << m_name << "_Error;\n";
+ out << "\t\t}\n";
+ }
+
+ out << "\t\tresult = " << m_name << "(";
+ for (int i = 1; i <= num_args; i++) {
+ out << "v" << i;
+ if (i < num_args) {
+ out << ", ";
+ }
+ }
+ out << ");\n";
+
+ int to_process = NumOfInOutArgs(RPC_OUT_ARG);
+ if (to_process > 0) {
+ /* Only OUT-arguments marshall after the server stub is called. */
+ out << "\t\t/*if (result == RPC_OK) {*/\n";
+ out << "\t\t *ret_string = " << RPC_MARSHALL_FUNCTION
+ << "(ret_size, 0, " << to_process << ",\n";
+
+ a = m_args.begin();
+ int processed = 0;
+ int ret;
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->IsVararray() != 0) { /* Variable-length arrays */
+ ret = a->CreateMarshallArgs(out, i, RPC_OUT_ARG, m_array_size_name);
+ } else {
+ ret = a->CreateMarshallArgs(out, i, RPC_OUT_ARG);
+ }
+ if (ret) {
+ processed++;
+ if (processed < to_process) {
+ out << ",";
+ }
+ out << "\n";
+ }
+ }
+ out << "\t\t );\n"
+ << "\t\t if (*ret_string == NULL) {\n"
+ << "\t\t\tresult = " << RPC_API_SERVER_ERROR << ";\n"
+ << "\t\t }\n"
+ << "\t\t/*}*/\n";
+ }
+
+ if (num_args > 0) {
+ out << "_" << m_name << "_Error:\n";
+ }
+ int num_pointer_args = 0;
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->Bytes() || a->IsPointer()) {
+ num_pointer_args++;
+ }
+ }
+ if (num_pointer_args > 0) {
+ int processed = 0;
+ out << "\t\t" << RPC_MARSHALL_FREE_FUNCTION
+ << "(" << num_pointer_args << ", ";
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->Bytes() || a->IsPointer()) {
+ out << "v" << i;
+ processed++;
+ if (processed < num_pointer_args) {
+ out << ", ";
+ }
+ }
+ }
+ out << ");\n";
+ }
+ out << "\t\tbreak;\n\t}\n";
+ return 0;
+}
+
+int
+APIDef::MakeServerStub(void) {
+ char filename[MAX_FILENAME_LEN+1];
+ sprintf(filename, "%s%s", m_lowerid.c_str(), SERVER_STUB_FILE);
+ int ret = 0;
+
+ fstream out(filename, ios::out);
+ if (!out.is_open()) {
+ cout << "File " << filename << " Could not open.\n";
+ return 1;
+ }
+ cout << "info: Stub file " << filename << " Creating.\n";
+
+ const char *title = SERVER_STUB_TITLE;
+
+ out << "/*\n";
+ out << " * " << m_id << " " << title << " " << filename << "\n";
+ out << " *\n";
+ out << RPCTOOL_WARNING_STRING << "\n";
+ out << " */\n";
+ out << "#include <" RPC_GLOBAL_HEADER_FILE << ">\n";
+ out << "#include \"" << m_lowerid << SERVER_HEADER_FILE << "\"\n";
+ out << "#include <netinet/in.h> /* for ntohs() */\n\n";
+
+ int api_num = 1;
+ list<Function>::iterator f;
+
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f, ++api_num) {
+ if (api_num >= (1<<16)) {
+ cout << "Too many API functions.(Up to 65535)\n";
+ return 1;
+ }
+ out << "#define " << RPC_API_NUM_PREFIX << f->Name()
+ << " " << api_num << "\n";
+ }
+ out << "\n";
+
+ out << "RPC_Result\n";
+ out << m_id << RPC_API_DISPATCH_FUNC_FULL << "\n";
+ out << "{\n";
+ out << "\tRPC_Result result = " << RPC_API_SERVER_ERROR << ";\n";
+ out << "\t*ret_string = NULL;\n";
+ out << "\tswitch(api_num) {\n";
+
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ if (f->PrintServerStub(out) != 0) {
+ ret = 1;
+ break;
+ }
+ }
+
+ if (ret != 0) {
+ return ret;
+ }
+
+ out << "\tdefault:\n\t\tbreak;\n\t}\n";
+ out << "\treturn result;\n";
+ out << "}\n";
+
+ return ret;
+}
+
+int
+Function::PrintClientStub(const char *moduleid, fstream& out) {
+ int ret = 0;
+
+ list<Arg>::iterator a;
+ /* Function Names and Arguments */
+ out << RPC_API_CLIENT_RETURN << "\n";
+#ifdef DBG_ENABLE
+ if (rpc_log_enable) {
+ out << "__" << m_name << "(";
+ } else {
+ out << m_name << "(";
+ }
+#else
+ out << m_name << "(";
+#endif
+ int num_args = (int)(m_args.size());
+ if (num_args > 0) {
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->PrintPrototype(out, i)) {
+ return 1;
+ }
+#ifdef DBG_ENABLE
+ if (rpc_log_enable) {
+ out << ", ";
+ } else {
+ if (i < num_args) {
+ out << ", ";
+ }
+ }
+#else
+ if (i < num_args) {
+ out << ", ";
+ }
+#endif
+ }
+ } else {
+#ifndef DBG_ENABLE
+ out << "void";
+#else
+ if (!rpc_log_enable) {
+ out << "void";
+ }
+#endif
+ }
+#ifdef DBG_ENABLE
+ if (rpc_log_enable) {
+ out << "const char *filename, const char *funcname, int line ";
+ }
+#endif
+ out << ")\n";
+
+ out << "{\n";
+
+ /* Contents of stub functions */
+
+ /* If the argument is present and the variable-length array does not exist */
+ if ((num_args > 0) && (m_array_size_pos == 0)) {
+ int is_exist_mytype = 0;
+ /* Restricted specifications */
+ out << "#ifdef RPC_STATIC_ASSERT\n";
+ out << "\tchar RPC_TOTAL_ARGSIZE_ERROR_in_" << m_name << "[\n";
+ out << "\t(((";
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (i > 1) {
+ out << " + ";
+ }
+ out << "sizeof(";
+ a->PrintUndecoratedName(out, i);
+ out << ")";
+ /* For user types */
+ if ((!is_exist_mytype) && (NULL == TypeCodeString(a->Code()))) {
+ is_exist_mytype = 1;
+ }
+ }
+ out << ") > RPC_MAX_API_ARG_TOTAL_SIZE) ? -1: 1)\n";
+ out << "\t]__attribute__((unused));\n";
+
+ /* Have a user type */
+ if (is_exist_mytype) {
+ char c[3];
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (NULL == TypeCodeString(a->Code())) {
+ sprintf(c, "%d", i);
+ out << "\tchar RPC_ARGSIZE_ERROR_in_" << m_name << "_arg" << c;
+ out << "[\n\t(sizeof(";
+ a->PrintUndecoratedName(out, i);
+ out << ") > RPC_MAX_API_ARG_SIZE) ? -1: 1\n";
+ out << "\t]__attribute__((unused));\n";
+ }
+ }
+ }
+
+ out << "#endif /* RPC_STATIC_ASSERT */\n";
+
+ }
+
+ out << "\tRPC_Result result = " << RPC_API_CLIENT_ERROR << ";\n";
+ out << "\tunsigned int args_size = 0, ret_size;\n";
+ out << "\tchar retcode[9];\n";
+
+ if (num_args > 0) {
+ /* Advance preparation==Marshalling of arguments */
+ out << "\tchar *args_string = " << RPC_MARSHALL_FUNCTION
+ << "(&args_size, 1, " << num_args << ",\n";
+ /* In the clients STUB for all pre-call marshall */
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->IsVararray() != 0) { /* Variable-length arrays */
+ a->CreateMarshallArgs(out, i, m_array_size_name);
+ } else {
+ a->CreateMarshallArgs(out, i);
+ }
+ if (i < num_args) {
+ out << ",";
+ }
+ out << "\n";
+ }
+ out << "\t);\n";
+ out << "\tif (args_string == NULL) {\n"
+ << "\t\tgoto _" << m_name << "_Error;\n\t}\n";
+ } else {
+ out << "\tchar *args_string = NULL;\n";
+ }
+
+#ifdef DBG_ENABLE
+ if (rpc_log_enable) {
+ out << "\tif (" << moduleid << "_record_dbg_log(filename, funcname, line, \"";
+ out << m_name << "\") != 0) {\n";
+ out << "\t\tgoto _" << m_name << "_Error;\n\t}\n";
+ }
+#endif
+
+ /* RPC API call */
+ out << "\tchar *ret_string = NULL; /* pgr0431 */\n";
+#ifdef RPC_STRING_ID
+ out << "\tresult=RPC_API_call(\"" << moduleid << "\", ";
+#else
+ out << "\tresult=RPC_API_call(" << moduleid << "_RPC_ID, ";
+#endif
+ out << RPC_API_NUM_PREFIX << m_name;
+ out << ", args_string, args_size, &ret_string, &ret_size);\n";
+
+ // 2007.08.25 To avoid over run within the sscanf
+ // Locally copies strings needed for determining return values and uses strtol instead of sscanf
+ // (Since there is no guarantee that the byte sequence to be grabbed by communication is 0-terminated)
+ out << "\n"
+ << "\tif (result == RPC_OK && ret_string != NULL) {\n"
+ << "\t strncpy(retcode, ret_string, 8);\n"
+ << "\t retcode[8] = '\\0';\n"
+ << "\t result = (RPC_Result)strtoul(retcode, NULL, 16);\n";
+
+ /* Post-processing==Arguments de-marshalling, free() */
+ int num_of_out_args = NumOfInOutArgs(RPC_OUT_ARG);
+ if (num_of_out_args > 0) {
+ out << "\t if (" << RPC_DEMARSHALL_FUNCTION
+ << "(ret_string + RPC_RETCODE_LEN, ret_size - RPC_RETCODE_LEN, 0, "
+ << num_of_out_args << ",\n";
+
+ a = m_args.begin();
+ int processed = 0;
+ int ret;
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ if (a->IsVararray() != 0) { /* Variable-length arrays */
+ ret = a->CreateDemarshallArgs(out, 0, i, RPC_OUT_ARG, m_array_size_name);
+ } else {
+ ret = a->CreateDemarshallArgs(out, 0, i, RPC_OUT_ARG);
+ }
+ if (ret) {
+ processed++;
+ if (processed < num_of_out_args) {
+ out << ",";
+ }
+ out << "\n";
+ }
+ }
+ out << "\t ) < 0) {\n"
+ << "\t\tresult = " << RPC_API_CLIENT_ERROR << ";\n"
+ << "\t }\n";
+ }
+
+ out << "\t} else {\n\t //result = " << RPC_API_CLIENT_ERROR << ";\n"
+ << "\t}\n";
+
+ out << "\t" << RPC_RETURN_FREE_FUNCTION << "(ret_string);\n";
+ out << "\t" << RPC_MARSHALL_FREE_FUNCTION << "(1, args_string);\n";
+
+ /* END, RETURN */
+#ifndef DBG_ENABLE
+ if (num_args)
+#else
+ if ((num_args)||(rpc_log_enable))
+#endif
+ {
+ out << "_" << m_name << "_Error:\n";
+ }
+
+ out << "\treturn result;\n}\n";
+
+ return ret;
+}
+
+int
+APIDef::MakeClientStub(void) {
+ char filename[MAX_FILENAME_LEN+1];
+ sprintf(filename, "%s%s", m_lowerid.c_str(), CLIENT_STUB_FILE);
+ int ret = 0;
+
+ fstream out(filename, ios::out);
+ if (!out.is_open()) {
+ cout << "File " << filename << " Could not open.\n";
+ return 1;
+ }
+ cout << "info: Stub file " << filename << " Creating.\n";
+
+ const char *title = CLIENT_STUB_TITLE;
+
+ out << "/*\n";
+ out << " * " << m_id << " " << title << " " << filename << "\n";
+ out << " *\n";
+ out << RPCTOOL_WARNING_STRING << "\n";
+ out << " */\n";
+ out << "#include <" RPC_GLOBAL_HEADER_FILE << ">\n";
+ out << "#include <" << m_lowerid << CLIENT_HEADER_FILE << ">\n\n";
+ out << "#include <stdio.h> /* for sscanf() */\n";
+ out << "#include <stdlib.h> /* for getenv() */\n";
+ out << "#include <string.h> /* for strncpy() */\n";
+ out << "#include <netinet/in.h> /* for ntohs() */\n\n";
+
+ int api_num = 1;
+ list<Function>::iterator f;
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f, ++api_num) {
+ if (api_num >= (1<<16)) {
+ cout << "Too many API functions.(Up to 65535)\n";
+ return 1;
+ }
+ out << "#define " << RPC_API_NUM_PREFIX << f->Name()
+ << " " << api_num << "\n";
+ }
+ out << "\n";
+
+ /* Specification Restriction Debug Constants */
+ out << "/*#define RPC_STATIC_ASSERT*/\n";
+ out << "\n";
+
+#ifdef DBG_ENABLE
+ if (rpc_log_enable) {
+ int m_id_work_cnt;
+ string m_id_work = m_id;
+ for (m_id_work_cnt = 0; m_id_work_cnt < m_id_work.length(); m_id_work_cnt++) {
+ m_id_work[m_id_work_cnt] = toupper(m_id_work[m_id_work_cnt]);
+ }
+ out << "int\n" << m_id << "_record_dbg_log(const char *filename, " <<
+ "const char *funcname, int line, const char *apiname)\n";
+ out << "{\n\t";
+ out << "if (getenv(\"" << m_id_work << "_RPC_LOG\") != NULL) {\n\t\t";
+ out << "return RPC_record_dbg_log(filename, funcname, line, apiname);\n\t";
+ out << "}\n\t";
+ out << "return 0;\n";
+ out << "}\n\n";
+ }
+#endif
+
+ /* API definitions */
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ if (f->PrintClientStub(m_id.c_str(), out) != 0) {
+ ret = 1;
+ break;
+ }
+ }
+ return ret;
+}
+
+int
+Arg::IsArraySize(void) {
+ if (m_is_array_size != 0) {
+ if (IsTypeCodeNumeric(m_code) == 1) {
+ return 1;
+ } else {
+ cout << "Variable-length array length specification variables must be integers.\n";
+ return -1;
+ }
+ }
+ return 0;
+}
+
+int
+Function::CheckFuncArraySize(void) {
+ int num_args = (int)(m_args.size());
+ list<Arg>::iterator a;
+ a = m_args.begin();
+ for (int i = 1; i <= num_args; ++i, ++a) {
+ int ret = a->IsArraySize();
+ if (ret > 0) {
+ if (m_array_size_pos != 0)
+ {
+ cout << "Two or more variable array length specification arguments exist.\n";
+ return 1;
+ }
+ m_array_size_pos = i;
+ a->GetUndecolatedName(m_array_size_name, i);
+ } else if (ret < 0) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int
+APIDef::CheckAllArraySize(void) {
+ list<Function>::iterator f;
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ if (f->CheckFuncArraySize() != 0) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int
+APIDef::MakeStubs(void) {
+ if (m_id.size() == 0) {
+ cout << "The module name is not specified.\n";
+ return 1;
+ }
+
+ if (m_id.size() > MAX_FILENAME_LEN - strlen(SERVER_STUB_FILE)) {
+ cout << "The module name is too long.\n";
+ return 1;
+ }
+
+ /* Pre-examine the ARRAYSIZE specification */
+ //cout << "<check_all_array_size>\n";
+ if (CheckAllArraySize() != 0) {
+ return 1;
+ }
+
+ //cout << "<MakeHeaderFiles(0)>\n";
+ if (MakeHeaderFiles(1) != 0) {
+ return 1;
+ }
+
+ //cout << "<MakeHeaderFiles(1)>\n";
+ if (MakeHeaderFiles(0) != 0) {
+ return 1;
+ }
+
+ if (MakeServerStub() != 0) {
+ return 1;
+ }
+
+ if (MakeClientStub() != 0) {
+ return 1;
+ }
+
+ return 0;
+}
+
+void
+Arg::Print(void) {
+ cout << "\t";
+ if (m_name.size() > 0) {
+ cout << "Variable name=" << m_name << " ";
+ }
+ cout << "Type=" << TypeCodeString(m_code) << "In bytes=" << m_bytes << " ";
+ if (m_is_pointer) {
+ cout << "Pointer ";
+ }
+ if ((m_in_out & RPC_OUT_ARG) != 0) {
+ cout << "Output ";
+ }
+ cout << "\n";
+}
+
+void
+Function::Print(int with_args) {
+ printf("Function name=%s\n", m_name.c_str());
+ if (with_args) {
+ list<Arg>::iterator a;
+ for (a = m_args.begin(); a != m_args.end(); ++a) {
+ a->Print();
+ }
+ }
+}
+
+void
+APIDef::Print(int with_args) {
+ list<Function>::iterator f;
+ for (f = m_funcs.begin(); f != m_funcs.end(); ++f) {
+ f->Print(with_args);
+ }
+}
+
+void
+APIDef::IdTolower(void) {
+ char *lower = new char[m_id.size() + 1];
+ strcpy(lower, m_id.c_str());
+ char *p;
+ for (p = lower; *p; p++) {
+ *p = (char)(tolower(*p));
+ }
+ m_lowerid = lower;
+ delete[] lower;
+}
diff --git a/video_in_hal/otherservice/rpc_library/tool/apidef.h b/video_in_hal/otherservice/rpc_library/tool/apidef.h
new file mode 100755
index 0000000..b042a90
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/tool/apidef.h
@@ -0,0 +1,333 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file apidef.h
+ * @brief RPC tools--Function/macro definitions and APIDef class definitions
+ */
+/** @addtogroup RPCtool
+ *
+ * @brief Using the RPC Tool (rpc_apidef)
+ *
+ * rpc_apidef [CPP option...] API definition file name
+ *
+ * - CPP option
+ * The RPC tool calls the C preprocessor (CPP) internally
+ * for processing comments and #if directives.
+ * Here, you can specify options to be given to the CPP, such as symbol definitions
+ * for conditional branch descriptions in the API definition file.
+ * - API definition file name
+ * Pathname to the API definition file.
+ * The file name must be thread ID + ".api".
+ *
+ * The output file is as follows.
+ * "*" is a lowercase version of the API definition file name preceding ".api".
+ * - *_api.h(Client header files)
+ * - *_api_stub.c(Client stub file)
+ * - *_srvr.h(Server header file)
+ * - *_srvr_stub.c(Server stub file)
+ *
+ * Examples:
+ * - Examples1: rpc_apidef -DTEST XXX.api
+ * - Examples2: rpc_apidef XXX.api
+ * - => Xxx_api.h, xxx_api_stub.c, ... To the output
+ */
+#ifndef RPC_LIBRARY_TOOL_APIDEF_H_
+#define RPC_LIBRARY_TOOL_APIDEF_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef DBG_ENABLE
+extern char rpc_log_enable;
+#endif
+
+/* C++ to C I/F functions */
+const char *TypeCodeString(const int code);
+int IsTypeCodeNumeric(const int code);
+
+/*
+ * C to C++ I/F functions (APIDef class)
+ */
+void ApidefDefineId(const char *id);
+void ApidefAddHeader(const char *filename);
+int ApidefPushFunctionArg(int arg_code, int buffer_bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out,
+ const char *var_name);
+void ApidefProcessFunction(const char *funcname);
+void ApidefListFunctions(int with_args);
+void ApidefFreeAllocation(void);
+int ApidefMakeStubs(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#define RPC_IN_ARG 0x01
+#define RPC_OUT_ARG 0x02
+#define RPC_INOUT_ARG (RPC_IN_ARG|RPC_OUT_ARG)
+
+#define MAX_FILENAME_LEN 63
+#define SERVER_HEADER_FILE "_srvr.h"
+#define CLIENT_HEADER_FILE "_api.h"
+#define SERVER_STUB_FILE "_srvr_stub.c"
+#define CLIENT_STUB_FILE "_api_stub.c"
+#define SERVER_HEADER_DEFINE "_srvr_h_"
+#define CLIENT_HEADER_DEFINE "_api_h_"
+
+#define SERVER_HEADER_TITLE "Server header files"
+#define CLIENT_HEADER_TITLE "Client header files"
+#define SERVER_STUB_TITLE "Server stub file"
+#define CLIENT_STUB_TITLE "Client stub file"
+
+#define RPC_MARSHALL_FUNCTION "RPC_marshall_arguments"
+#define RPC_DEMARSHALL_FUNCTION "RPC_demarshall_arguments"
+#define RPC_MARSHALL_FREE_FUNCTION "RPC_marshall_free"
+#define RPC_RETURN_FREE_FUNCTION "RPC_free_return_string"
+
+#define RPC_API_SERVER_RETURN "RPC_Result"
+#define RPC_API_SERVER_ERROR "RPC_ERR_Fatal"
+#define RPC_API_CLIENT_RETURN "RPC_Result"
+#define RPC_API_CLIENT_ERROR "RPC_ERR_Fatal"
+#define RPC_API_DISPATCH_TYPE "RPC_dispatch_func_t"
+#define RPC_API_DISPATCH_RETURN "RPC_Result"
+#define RPC_API_DISPATCH_FUNC_FULL "_API_dispatch(UINT16 api_num, const char *args_string, unsigned int args_size, char **ret_string, unsigned int *ret_size)" // NOLINT (readability/nolint)
+#define RPC_API_DISPATCH_FUNC_NAME "_API_dispatch"
+#define RPC_API_NUM_PREFIX "RPC_API_NUM_"
+#define RPC_GLOBAL_HEADER_FILE "other_service/rpc.h"
+
+#define RPCTOOL_WARNING_STRING \
+" * The file created by the RPC tool.This file should not be edited."
+
+#define EXTERN_C_START \
+"#ifdef __cplusplus\n" \
+"extern \"C\" {\n" \
+"#endif\n"
+
+#define EXTERN_C_END \
+"#ifdef __cplusplus\n" \
+"}\n" \
+"#endif /* __cplusplus */\n"
+
+#ifdef __cplusplus
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <list>
+
+using namespace std; // NOLINT (readability/nolint)
+
+/** @ingroup RPCtool
+ * @class Arg
+ * @brief Class that stores and processes the arguments of functions read from the API definition file
+ */
+class Arg {
+ protected:
+ int m_code;
+ int m_bytes;
+ int m_is_pointer;
+ int m_in_out; /* Bit OR of _IN_ARG and _OUT_ARG */
+ int m_is_vararray;
+ int m_is_array_size;
+ string m_type_name;
+ string m_name;
+
+ public:
+ Arg() {
+ m_code = m_bytes = m_is_pointer = m_in_out = m_is_vararray = m_is_array_size = 0;
+ }
+ Arg(int code, int bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *type_name, int in_out,
+ const char *var_name) {
+ m_code = code;
+ m_bytes = bytes;
+ m_is_pointer = is_pointer;
+ m_is_vararray = is_vararray;
+ m_is_array_size = is_array_size;
+ m_in_out = in_out;
+ if (type_name) {
+ m_type_name = type_name;
+ }
+ if (var_name) {
+ m_name = var_name;
+ }
+ }
+ ~Arg() {}
+
+ int Code(void) { return m_code; }
+ int Bytes(void) { return m_bytes; }
+ int IsPointer(void) { return m_is_pointer; }
+ int InOut(void) { return m_in_out; }
+ string& TypeName(void) { return m_type_name; }
+ void GetUndecolatedName(string& name, int num); // NOLINT (readability/nolint)
+
+ int PrintUndecoratedName(fstream& out, int num);
+ int PrintPrototype(fstream& out, int num);
+ int PrintPrototype(fstream& out) { return PrintPrototype(out, 0); }
+
+ int CreateMarshallArgs(fstream& out, int num);
+ int CreateMarshallArgs(fstream& out, int num, string &array_size_name); // NOLINT (readability/nolint)
+ int CreateMarshallArgs(fstream& out, int num, int in_out);
+ int CreateMarshallArgs(fstream& out, int num, int in_out, string &array_size_name); // NOLINT (readability/nolint)
+ int CreateDemarshallArgs(fstream& out, int deliver_pointer, int num);
+ int CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, string &array_size_name); // NOLINT (readability/nolint)
+ int CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, int in_out);
+ int CreateDemarshallArgs(fstream& out, int deliver_pointer, int num, int in_out, string &array_size_name); // NOLINT (readability/nolint)
+
+ int IsVararray(void) { return m_is_vararray; }
+ int IsArraySize(void);
+ void Print(void);
+};
+
+/** @ingroup RPCtool
+ * @class Function
+ * @brief Class that stores and processes function definitions read from the API definition file
+ */
+class Function {
+ protected:
+ string m_name;
+ list<Arg> m_args;
+ int m_array_size_pos;
+ string m_array_size_name;
+
+ public:
+ Function():m_array_size_name("") { m_array_size_pos = 0; }
+ ~Function() {
+ list<Arg>::size_type size = m_args.size();
+ for (list<Arg>::size_type i = 0 ; i < size ; i++) {
+ m_args.begin();
+ m_args.pop_front();
+ }
+ }
+
+ const char *Name(void) { return m_name.c_str(); }
+ void SetName(const char *funcname) {
+ m_name = funcname;
+ }
+
+ int NumOfArgs(void) {
+ return (int)(m_args.size()); // NOLINT (readability/nolint)
+ }
+ int NumOfInOutArgs(int in_out) {
+ int count = 0;
+ list<Arg>::iterator a;
+ for (a = m_args.begin(); a != m_args.end(); ++a) {
+ if ((a->InOut() & in_out) != 0) {
+ ++count;
+ }
+ }
+ return count;
+ }
+
+ int AppendArg(int code, int bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out, const char *var_name);
+
+ int PrintPrototype(fstream& out);
+ int PrintPrototype(fstream& out, int server);
+#ifdef DBG_ENABLE
+ int PrintMacro(fstream& out);
+#endif
+
+ int PrintServerStub(fstream& out);
+ int PrintClientStub(const char *moduleid, fstream& out);
+
+ int CheckFuncArraySize(void);
+ void Print(int with_args);
+};
+
+/** @ingroup RPCtool
+ * @class APIDef
+ * @brief Class that stores and processes the result of reading the API definition file
+ */
+class APIDef {
+ protected:
+ list<Function> m_funcs;
+ Function *m_work;
+ string m_id;
+ string m_lowerid;
+ list<string> m_headers;
+
+ public:
+ APIDef() { m_work = 0; }
+ ~APIDef() {
+ list<Function>::size_type size = m_funcs.size();
+ for (list<Function>::size_type i = 0; i < size; i++) {
+ m_funcs.begin();
+ m_funcs.pop_front();
+ }
+ if (m_work != NULL) {
+ delete m_work;
+ }
+ size = m_headers.size();
+ for (list<Function>::size_type i = 0; i < size; i++) {
+ m_headers.begin();
+ m_headers.pop_front();
+ }
+ }
+
+ void IdTolower(void);
+ void DefineId(const char *id) {
+ m_id = id;
+ IdTolower();
+ }
+ void AddHeader(const char *filename) {
+ string str = filename;
+ m_headers.push_back(str);
+ }
+
+ int AddFunctionArg(int arg_code, int buffer_bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out,
+ const char *var_name) {
+ if (m_work == NULL) {
+ m_work = new Function();
+ }
+ return m_work->AppendArg(arg_code, buffer_bytes, is_pointer,
+ is_vararray, is_array_size,
+ var_type_name, in_out, var_name);
+ }
+ void NameFunction(const char *funcname) {
+ if (m_work == NULL) {
+ m_work = new Function();
+ }
+ m_work->SetName(funcname);
+
+ AppendFunction(m_work);
+ delete m_work;
+ m_work = NULL;
+ }
+
+ void AppendFunction(Function *pfunc) {
+ m_funcs.push_back(*pfunc);
+ }
+
+ int CheckAllArraySize(void);
+
+ int MakeStubs(void);
+ void Print(int with_args);
+
+ private:
+ int MakeHeaderFiles(int server);
+ int MakeServerStub(void);
+ int MakeClientStub(void);
+};
+#endif /* __cplusplus */
+
+#endif // RPC_LIBRARY_TOOL_APIDEF_H_
diff --git a/video_in_hal/otherservice/rpc_library/tool/apidef.l b/video_in_hal/otherservice/rpc_library/tool/apidef.l
new file mode 100755
index 0000000..c2f246a
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/tool/apidef.l
@@ -0,0 +1,136 @@
+/**
+ * @file apidef.l
+ * @brief RPC tools--Defining lexical analysis rules for API definition files
+ *
+ */
+/** @ingroup RPCtool
+ * Defining Lexical Analysis Rules for Use with RPC Tools (apidef)
+ */
+%{
+#include <string.h>
+#include <stdlib.h>
+#include "apidef.tab.h"
+%}
+
+ALPHA [A-Za-z_]
+ALPHANUM [0-9\-A-Za-z_]
+ALPHANUMDOT [0-9.\-A-Za-z_/]
+
+%x include
+%s apidef
+%x str_num
+
+%%
+INCLUDE { BEGIN(include); return rpc_INCLUDE; }
+<include>\< { return '<'; }
+<include>{ALPHANUMDOT}+ {
+ yylval.strval = malloc(strlen(yytext)+1);
+ strcpy(yylval.strval, yytext);
+ return rpc_NAME_DOT;
+ }
+<include>\> { BEGIN(INITIAL); return '>'; }
+<include>. /* ignore */
+
+RPC_Result { BEGIN(apidef); return RPC_RESULT; }
+
+<apidef>STRING/[0-9]+ { BEGIN(str_num);
+ yylval.ival = rpc_STRING; return rpc_STRING; }
+<str_num>[0-9]+ {
+ BEGIN(apidef);
+ sscanf(yytext, "%d", &yylval.ival);
+ return rpc_NUM;
+ }
+<str_num>. /* ignore */
+
+<apidef>{
+char { yylval.ival = rpc_CHAR; return rpc_CHAR; }
+int { yylval.ival = rpc_INT; return rpc_INT; }
+signed[ \t\n]+int { yylval.ival = rpc_SINT; return rpc_SINT; }
+unsigned[ \t\n]+int { yylval.ival = rpc_UINT; return rpc_UINT; }
+INT8 { yylval.ival = rpc_INT8; return rpc_INT8; }
+INT16 { yylval.ival = rpc_INT16; return rpc_INT16; }
+INT32 { yylval.ival = rpc_INT32; return rpc_INT32; }
+INT64 { yylval.ival = rpc_INT64; return rpc_INT64; }
+UINT8 { yylval.ival = rpc_UINT8; return rpc_UINT8; }
+UINT16 { yylval.ival = rpc_UINT16; return rpc_UINT16; }
+UINT32 { yylval.ival = rpc_UINT32; return rpc_UINT32; }
+UINT64 { yylval.ival = rpc_UINT64; return rpc_UINT64; }
+float { yylval.ival = rpc_FLOAT; return rpc_FLOAT; }
+double { yylval.ival = rpc_DOUBLE; return rpc_DOUBLE; }
+void { yylval.ival = rpc_VOID; return rpc_VOID; }
+IN {
+ fprintf(stderr,
+ "Specification change: IN Pointer argument needs to be prefixed \"const\" instead of \"IN\".\n"
+ );
+ return rpc_UNKNOWN;
+ }
+OUT {
+ fprintf(stderr,
+ "Specification change: OUT argument no longer needs to be prefixed with \"OUT\".\n"
+ );
+ /* ignore */
+ }
+INOUT { yylval.ival = rpc_INOUT; return rpc_INOUT; }
+const { yylval.ival = rpc_CONST; return rpc_CONST; }
+VARARRAY { yylval.ival = rpc_VARARRAY; return rpc_VARARRAY; }
+ARRAYSIZE { yylval.ival = rpc_ARRAYSIZE; return rpc_ARRAYSIZE; }
+
+{ALPHA}+{ALPHANUM}* {
+ yylval.strval = malloc(strlen(yytext)+1);
+ strcpy(yylval.strval, yytext);
+ return rpc_NAME;
+ }
+
+\( { return '('; }
+\) { return ')'; }
+\* { return '*'; }
+, { return ','; }
+\; { BEGIN(INITIAL); return ';'; }
+
+} /* end of <apidef> */
+
+#.*\n /* ignore CPP directives */
+
+{ALPHANUMDOT}+ {
+ fprintf(stderr, "Unknown keyword %s\n", yytext);
+ return rpc_UNKNOWN;
+ }
+
+[ \t\n]+ /* eat up whitespace */
+
+%%
+#ifdef OLD_STUFFS
+%x portdef
+%x addr_num
+PORT { BEGIN(portdef); return DEFINE_PORT; }
+<portdef>[0-9]+ {
+ BEGIN(INITIAL);
+ sscanf(yytext, "%d", &yylval.ival);
+ return NUM;
+ }
+
+<apidef>ADDR/[0-9]+ { BEGIN(addr_num); yylval.ival = _ADDR; return _ADDR; }
+<addr_num>[0-9]+ {
+ BEGIN(apidef);
+ sscanf(yytext, "%d", &yylval.ival);
+ return NUM;
+ }
+#endif
+
+/*
+ * function to free the buffer which flex allocates but not frees
+ */
+void
+free_flex_buffer(void)
+{
+ yy_delete_buffer(YY_CURRENT_BUFFER);
+}
+
+/*
+ * dummy function to avoid a warning of not using 'yyunput'
+ */
+void
+dummy(void)
+{
+ yyunput(0, 0);
+}
diff --git a/video_in_hal/otherservice/rpc_library/tool/apidef.y b/video_in_hal/otherservice/rpc_library/tool/apidef.y
new file mode 100755
index 0000000..ce20c9c
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/tool/apidef.y
@@ -0,0 +1,615 @@
+/**
+ * @file apidef.y
+ * @brief RPC tools--API definition file syntax definition and read/front-end processing
+ *
+ */
+
+/*---------------------------------------------------------------------------*/
+/* C declarative statement */
+/*---------------------------------------------------------------------------*/
+%{
+#define YYDEBUG 1
+#define YYERROR_VERBOSE 1
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/*
+ * YACC to C I/F functions
+ */
+extern int yylex(void); /* LEX I/F */
+extern int yyerror(const char *); /* dummy */
+
+#include "apidef.h"
+
+/* YACC to C I/F functions */
+static void AddHeader(const char *header_file);
+static int push_function_arg(int arg_type, int num_of_bytes,
+ int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name,
+ int is_out, const char *var_name);
+static void process_function(const char *funcname);
+static void free_string(char *funcname);
+
+static int var_type;
+static int num_of_bytes;
+static int is_pointer;
+static int in_out;
+static int is_vararray;
+static int is_array_size;
+static char *var_type_name = NULL;
+
+%}
+
+/*---------------------------------------------------------------------------*/
+/* Bison declarations */
+/*---------------------------------------------------------------------------*/
+%union {
+ int ival;
+ char *strval;
+}
+
+%token '"'
+%left ','
+%left '('
+%right ')'
+%left '*'
+%token '{'
+%token '}'
+%token ';'
+%token '\n'
+%token <strval> rpc_INCLUDE 257
+%token <strval> RPC_RESULT 258
+%token <strval> rpc_NAME_DOT 259
+%token <strval> rpc_NAME 260
+%type <strval> funcdefs funcdef args
+%type <strval> nonvoid_args arg var_type
+%type <strval> var_primitive_type var_string_type var_user_defined_type
+/*
+%token <strval> rpc_OUT
+*/
+%token <strval> rpc_INOUT 261
+%token <strval> rpc_CONST 262
+%token <strval> rpc_VARARRAY 263
+%token <strval> rpc_ARRAYSIZE 264
+%token <ival> rpc_NUM 265
+%token <strval> rpc_VOID 266
+%token <ival> rpc_CHAR 267
+%token <ival> rpc_INT 268
+%token <ival> rpc_SINT 269
+%token <ival> rpc_UINT 270
+%token <ival> rpc_INT8 271
+%token <ival> rpc_INT16 272
+%token <ival> rpc_INT32 273
+%token <ival> rpc_INT64 274
+%token <ival> rpc_UINT8 275
+%token <ival> rpc_UINT16 276
+%token <ival> rpc_UINT32 277
+%token <ival> rpc_UINT64 278
+%token <ival> rpc_FLOAT 279
+%token <ival> rpc_DOUBLE 280
+%token <ival> rpc_STRING 281
+%token <ival> rpc_USER_DEFINED 282
+%token <ival> rpc_UNKNOWN 283
+
+/*---------------------------------------------------------------------------*/
+/* Grammar rule */
+/*---------------------------------------------------------------------------*/
+%%
+input: includes funcdefs
+;
+
+includes: /* empty input */
+ | includes include
+;
+
+include: rpc_INCLUDE '<' rpc_NAME_DOT '>'
+ { AddHeader($3); free_string($3); }
+;
+
+funcdefs: funcdef
+ | funcdefs funcdef
+;
+
+funcdef: RPC_RESULT rpc_NAME '(' args ')' ';'
+ { process_function($2); free_string($2);}
+;
+
+args: rpc_VOID
+ | nonvoid_args
+;
+
+nonvoid_args: arg
+ | nonvoid_args ',' arg
+;
+
+arg: var_type rpc_NAME
+ {
+ if (push_function_arg(var_type, num_of_bytes, is_pointer,
+ is_vararray, is_array_size,
+ var_type_name, in_out, $2) < 0) {
+ YYERROR;
+ }
+ if (var_type_name) { free_string(var_type_name); }
+ var_type_name = NULL;
+ free_string($2);
+ }
+ | var_type
+ {
+ if (push_function_arg(var_type, num_of_bytes, is_pointer,
+ is_vararray, is_array_size,
+ var_type_name, in_out, NULL) < 0) {
+ YYERROR;
+ }
+ if (var_type_name) { free_string(var_type_name); }
+ var_type_name = NULL;
+ }
+;
+
+/*
+ * Standard IN pointers are not allowed.
+ * When used as an array address, it is not clear how many bytes to copy.
+ * ->You are asked to declare the type and pass the address.
+ * Otherwise, you can simply pass it by value.
+ */
+var_type: var_primitive_type /* INT8, .. DOUBLE */
+ { is_pointer = 0; is_vararray = 0; is_array_size = 0; in_out =RPC_IN_ARG; }
+ | var_primitive_type '*' /* OUT INT8 *, ... OUT DOUBLE * */
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_OUT_ARG; }
+ /* if allow primitive IN pointer
+ | rpc_CONST var_primitive_type '*'
+ { is_pointer = 1; in_out = RPC_IN_ARG; }
+ */
+ | var_string_type
+ /* OUT STRING128, ... */
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_OUT_ARG; }
+ | rpc_CONST var_string_type
+ /* IN STRING128, ... */
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_IN_ARG; }
+ | var_user_defined_type
+ { is_pointer = 0; is_vararray = 0; is_array_size = 0; in_out = RPC_IN_ARG; }
+ | var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_OUT_ARG; }
+ | rpc_CONST var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_IN_ARG; }
+
+ /* INOUT specification */
+ | rpc_INOUT var_string_type
+ /* IN STRING128, ... */
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_INOUT_ARG; }
+ | rpc_INOUT var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 0; is_array_size = 0; in_out = RPC_INOUT_ARG; }
+
+ /* Variable-length arrays */
+ | rpc_CONST rpc_VARARRAY var_primitive_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_IN_ARG; }
+ | rpc_VARARRAY var_primitive_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_OUT_ARG; }
+ | rpc_INOUT rpc_VARARRAY var_primitive_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_INOUT_ARG; }
+ | rpc_CONST rpc_VARARRAY var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_IN_ARG; }
+ | rpc_VARARRAY var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_OUT_ARG; }
+ | rpc_INOUT rpc_VARARRAY var_user_defined_type '*'
+ { is_pointer = 1; is_vararray = 1; is_array_size = 0; in_out = RPC_INOUT_ARG; }
+
+ /* Variable length array size */
+ | rpc_ARRAYSIZE var_primitive_type
+ { is_pointer = 0; is_vararray = 0; is_array_size = 1; in_out = RPC_IN_ARG; }
+;
+
+var_primitive_type:
+ rpc_CHAR { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_INT { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_SINT { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_UINT { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_INT8 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_UINT8 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_INT16 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_UINT16 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_INT32 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_UINT32 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_INT64 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_UINT64 { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_FLOAT { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+ | rpc_DOUBLE { var_type = $1; num_of_bytes = 0; var_type_name = NULL; }
+;
+
+var_string_type: rpc_STRING rpc_NUM
+ { var_type = $1; num_of_bytes = $2; var_type_name = NULL; }
+;
+
+var_user_defined_type: rpc_NAME
+ { var_type = rpc_USER_DEFINED; num_of_bytes = 0; var_type_name = $1; }
+;
+
+%%
+
+/*---------------------------------------------------------------------------*/
+/* C additional code */
+/*---------------------------------------------------------------------------*/
+/* Including an older bison results in an error */
+/*#include "apidef.tab.h"*/
+
+#include <unistd.h>
+#include <assert.h>
+#include <string.h>
+/*
+ * YACC/Lex interface functions/variables
+ */
+extern int yydebug; /* for YACC debug */
+extern int yyparse(void);
+extern FILE *yyin;
+extern int yy_flex_debug; /* for FLEX debug */
+/* my own function to free the buffer flex allocates */
+extern void free_flex_buffer(void);
+
+#ifdef DBG_ENABLE
+char rpc_log_enable;
+#endif
+
+/**/
+static void
+AddHeader(const char *filename)
+{
+ ApidefAddHeader(filename);
+}
+
+static int
+push_function_arg(int arg_type, int num_of_bytes, int is_pointer,
+ int is_vararray, int is_array_size,
+ const char *var_type_name, int in_out, const char *var_name)
+{
+ switch(arg_type) {
+ case rpc_CHAR:
+ case rpc_INT:
+ case rpc_SINT:
+ case rpc_UINT:
+ case rpc_INT8:
+ case rpc_INT16:
+ case rpc_INT32:
+ case rpc_INT64:
+ case rpc_UINT8:
+ case rpc_UINT16:
+ case rpc_UINT32:
+ case rpc_UINT64:
+ case rpc_FLOAT:
+ case rpc_DOUBLE:
+ case rpc_STRING:
+ case rpc_USER_DEFINED:
+ return ApidefPushFunctionArg(arg_type, num_of_bytes, is_pointer,
+ is_vararray, is_array_size,
+ var_type_name, in_out, var_name);
+ break;
+
+ default:
+ return -1;
+ break;
+ }
+}
+
+static void
+process_function(const char *funcname)
+{
+ ApidefProcessFunction(funcname);
+}
+
+static void
+free_string(char *s)
+{
+#ifdef DEBUG
+ fprintf(stderr, "freed %s\n", s);
+#endif
+ free(s);
+}
+
+static void
+extract_id(const char *filename, char **id)
+{
+ char *dotapi;
+ char *slash;
+ const char *start;
+
+ if (id == NULL) {
+ return;
+ }
+ dotapi = strrchr(filename, '.');
+ if (dotapi == NULL) {
+ return;
+ }
+ if (strcmp(dotapi, ".api")) {
+ return;
+ }
+
+ slash = strrchr(filename, '/');
+ start = filename;
+ if (slash != NULL) {
+ start = slash + 1;
+ }
+
+ *id = malloc((size_t)(dotapi - start + 1));
+ if (*id == NULL) {
+ return;
+ }
+ strncpy(*id, start, (size_t)(dotapi - start));
+ (*id)[dotapi - start] = '\0';
+}
+
+static void
+usage(const char *prog)
+{
+ fprintf(stdout,
+ "How to use: %s [CPPFLAGS] ... API definition file name\n",
+ prog);
+ fprintf(stdout, "Examples1: %s XXX.api\n", prog);
+ fprintf(stdout, "Examples2: %s -DSOME_DEFINES XXX.api\n", prog);
+}
+
+#define CPP_PROG "cpp"
+static void free_cpp_argv(char **argv);
+
+static char **
+prepare_cpp_argv(int argc, char *argv[])
+{
+ char **cpp_argv;
+ char **ret;
+
+ cpp_argv = malloc(sizeof(char *) * (long unsigned int)(argc+1));
+ if (cpp_argv == NULL) {
+ return NULL;
+ }
+ memset(cpp_argv, 0, sizeof(char *) * (long unsigned int)(argc+1));
+ ret = cpp_argv;
+
+ cpp_argv[0] = malloc(strlen(CPP_PROG)+1);
+ if (cpp_argv[0] == NULL) {
+ free_cpp_argv(ret);
+ return NULL;
+ }
+ strcpy(cpp_argv[0], CPP_PROG);
+ cpp_argv++;
+
+ for( ; *argv != NULL ; argv++, cpp_argv++) {
+ *cpp_argv = malloc(strlen(*argv)+1);
+ if (*cpp_argv == NULL) {
+ free_cpp_argv(ret);
+ return NULL;
+ }
+ strcpy(*cpp_argv, *argv);
+ }
+ *cpp_argv = NULL;
+ return ret;
+}
+
+static void
+free_cpp_argv(char **argv)
+{
+ char **orig; orig = argv;
+ while(*argv != NULL) {
+ free(*argv);
+ argv++;
+ }
+ free(orig);
+}
+
+/** @ingroup RPCtool
+ * @brief RPCtool main functions
+ *
+ * Perform the following processing.
+ *
+ * - Lexical context analysis of the API definition file(See apidef.y and apidef.l)
+ * - The API function definition read from the definition file is stored in the APIDef class.
+ * - Outputs stub and header files from function definitions stored in APIDef after a successful read
+ */
+int
+main(int argc, char *argv[])
+{
+ int start;
+ char **cpp_argv;
+ int pipefd[2];
+ int pid;
+ int ret;
+
+ if (argc < 2) {
+ usage(argv[0]);
+ return 1;
+ }
+
+ start = 1;
+ yy_flex_debug = 0;
+
+ if (!strcmp(argv[1], "-d")) {
+ yydebug=1;
+ yy_flex_debug = 1;
+ if (argc > 2) {
+ start++;
+ } else {
+ usage(argv[0]);
+ return 1;
+ }
+ }
+
+#ifdef DBG_ENABLE
+ /*
+ * If the second-to-last argument is a log specification
+ */
+ if ( ( argc >= 2 ) && (!strcmp(argv[argc-2], "-log")) ) {
+ rpc_log_enable = 1;
+ } else {
+ rpc_log_enable = 0;
+ }
+#endif
+
+ /*
+ * Extract ID from last argument (API definition file name)
+ */
+ {
+ char *moduleid;
+ moduleid = NULL;
+ extract_id(argv[argc-1], &moduleid);
+ if (moduleid == NULL) {
+ fprintf(stdout, "%s: The API definition file name is invalid.\n", argv[0]);
+ usage(argv[0]);
+ return 1;
+ }
+ ApidefDefineId(moduleid);
+ free(moduleid);
+ }
+
+ /*
+ * Preparing options to exec CPPs
+ */
+ cpp_argv = prepare_cpp_argv(argc, argv + start);
+ if (cpp_argv == NULL) {
+ printf("No Memory!\n");
+ return 1;
+ }
+
+#define PIPE_READ 0
+#define PIPE_WRITE 1
+
+ if (pipe(pipefd) != 0) {
+ perror("pipe");
+ return 1;
+ }
+
+ pid = fork();
+ if (pid < 0) {/* fork error */
+ close(pipefd[PIPE_READ]);
+ close(pipefd[PIPE_WRITE]);
+ perror("fork");
+ return 1;
+ }
+ if (pid == 0) {/* child process */
+ int must_be_1;
+ /*
+ * force stdout to be pipefd[PIPE_WRITE]
+ */
+ close(pipefd[PIPE_READ]);
+ close(1);
+ must_be_1 = dup(pipefd[PIPE_WRITE]);
+ assert(must_be_1 == 1);
+ close(pipefd[PIPE_WRITE]);
+ /*
+ * invoke C preprocessor with flags
+ */
+ execvp(CPP_PROG, cpp_argv);
+ perror("execvp");
+ exit(0);
+ } else {
+ /*
+ * parent process
+ */
+ int must_be_0;
+ free_cpp_argv(cpp_argv);
+
+ /*
+ * force stdin to be pipefd[PIPE_READ]
+ */
+ close(pipefd[PIPE_WRITE]);
+ close(0);
+ must_be_0 = dup(pipefd[PIPE_READ]);
+ assert(must_be_0 == 0);
+ close(pipefd[PIPE_READ]);
+ }
+
+ ret = yyparse();
+
+ free_flex_buffer();
+
+ if (ret == 0) {/* Parsed successfully */
+ //ApidefListFunctions(1);
+ ApidefMakeStubs();
+ } else {/* Parse error occurred */
+ fputs("The APIs that have been analyzed so far are as follows.\n", stdout);
+ fputs("-----start-----\n", stdout);
+ ApidefListFunctions(0);
+ fputs("------end------\n", stdout);
+ fputs("Check this API definition\n", stdout);
+ }
+ ApidefFreeAllocation();
+
+ return ret;
+}
+
+int
+yyerror(const char *s)
+{
+ printf("\nError: %s\n", s);
+ return 0;
+}
+
+int
+yywrap()
+{
+ return 1;
+}
+
+static char const *Types[] = {
+ "char",
+ "int",
+ "signed int",
+ "unsigned int",
+ "INT8",
+ "INT16",
+ "INT32",
+ "INT64",
+ "UINT8",
+ "UINT16",
+ "UINT32",
+ "UINT64",
+ "float",
+ "double",
+ "char *",
+};
+
+static const int TypeCodes[] = {
+ rpc_CHAR,
+ rpc_INT,
+ rpc_SINT,
+ rpc_UINT,
+ rpc_INT8,
+ rpc_INT16,
+ rpc_INT32,
+ rpc_INT64,
+ rpc_UINT8,
+ rpc_UINT16,
+ rpc_UINT32,
+ rpc_UINT64,
+ rpc_FLOAT,
+ rpc_DOUBLE,
+ rpc_STRING,
+};
+
+const char *
+TypeCodeString(const int code)
+{
+ int i;
+ int num;
+ num = sizeof(TypeCodes) / sizeof(int);
+
+ for(i = 0 ; i < num ; i++) {
+ if (code == TypeCodes[i]) {
+ return Types[i];
+ }
+ }
+ return NULL;
+}
+
+int
+IsTypeCodeNumeric( const int code )
+{
+ int i;
+
+ for(i = 0 ; i < sizeof(TypeCodes) / sizeof(TypeCodes[0]) ; i++) {
+ if (TypeCodes[i] == rpc_FLOAT) {
+ break;
+ }
+ if (code == TypeCodes[i]) {
+ return 1;
+ }
+ }
+ return 0;
+}
diff --git a/video_in_hal/otherservice/rpc_library/tool_for_arm/Makefile b/video_in_hal/otherservice/rpc_library/tool_for_arm/Makefile
new file mode 100755
index 0000000..67121b4
--- /dev/null
+++ b/video_in_hal/otherservice/rpc_library/tool_for_arm/Makefile
@@ -0,0 +1,50 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+all test: apidef.tab.h
+
+clean:
+ rm -rf $(CLEAN_FILES)
+
+YACC := bison
+YFLAGS := -d -t
+
+VPATH += ../tool
+CPPFLAGS += -I../tool
+OUTPUTDIR += ../tool
+
+apidef.tab.h apidef.tab.c: apidef.y
+ cd ../tool; $(YACC) $(YFLAGS) $<
+
+CLEAN_FILES := ../tool/apidef.tab.h ../tool/apidef.tab.c
+
+CLEAN_TARGET := clean-test clean-all clean-all-test \
+clean-self clean-self-test clean-all-sub clean-self-sub #comment out for make clean errorclean-sub
+
+EMPTY_TARGET := install-test build-lib build-prog build-shlib build-arlib \
+build-test-mock-lib build-test-mock-arlib build-test-mock-shlib build-cfg \
+install install-header install-test-mock-header install-test-casename install-lib \
+install-shlib install-arlib install-prog install-data install-cfg install-preload
+
+
+.PHONY: all install test clean $(CLEAN_TARGET) $(EMPTY_TARGET)
+
+$(CLEAN_TARGET): clean
+
+$(EMPTY_TARGET):
+
+
+include ../../other_service.mk
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/LICENSE b/video_in_hal/otherservice/vehicle_parameter_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/Makefile.client b/video_in_hal/otherservice/vehicle_parameter_library/Makefile.client
new file mode 100755
index 0000000..172da8f
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/Makefile.client
@@ -0,0 +1,18 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+SUBDIRS := library
+
+include ../other_service.mk
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/Makefile b/video_in_hal/otherservice/vehicle_parameter_library/library/Makefile
new file mode 100755
index 0000000..ae99cfa
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/Makefile
@@ -0,0 +1,40 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+INST_SHLIBS = libvp
+
+VPATH = ./src ./include/$(COMPONENT_NAME)
+
+INST_HEADERS = VP_GetEnv.h env_vehicle.h \
+ env_vehicleparameterlibrary.h env_vehicleparameterlibrary_serial.h env_ext.h \
+ VP_FuncCheck_CanRcv.h vehicle_parameter_library.h
+
+libvp_SRCS = VP_FuncCheck_CanRcv.c VP_GetEnv.c
+
+LDLIBS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lns_backup
+
+CPPFLAGS += -I./include
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wpointer-to-int-cast
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+CPPFLAGS += -DVP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE
+
+include ../../other_service.mk
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h b/video_in_hal/otherservice/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h
new file mode 100755
index 0000000..193e54a
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h
@@ -0,0 +1,90 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* ====================================================================== */
+/**
+ * @file VP_FuncCheck_CanRcv_private.h
+ * @brief Get function existence API internal header file
+ * @attention Cannot be included from external functions
+ *
+ * Exported because it will be inconvenient at MT
+ */
+/* ====================================================================== */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_VP_FUNCCHECK_CANRCV_PRIVATE_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_VP_FUNCCHECK_CANRCV_PRIVATE_H_
+
+/* ====================================================================== */
+/* Include public headers */
+/* ====================================================================== */
+#include <other_service/VP_FuncCheck_CanRcv.h>
+
+/* ====================================================================== */
+/* Internal definitions for debugging */
+/* ====================================================================== */
+#ifdef DEBUG_MT
+ #include <stdio.h>
+
+ #define MT_STATIC /**< Static definitions - Remove the static in order to remove the file scope at MT. */
+
+ /**< Debugging output function - Compile the entity at MT */
+ #define DEBUG_PRINT(msg) {printf("%s\n", (msg) ) ;}
+ /**< Debugging output function - Compile the entity at MT */
+ #define DEBUG_PRINTF(format, msg) {printf((format), (msg) ) ;}
+
+ /**< Static assertion */
+ #define VP_DEBUG_STATIC_ASSERT(expr) do { int static_assert[ (expr)? 1:-1 ]; }while(0);
+#else
+ /**< Static definitions. The scope shall be limited by static at the time of releasing.
+ * Remove the static in order to remove the file scope at MT.
+ */
+ #define MT_STATIC static
+
+ /**< Static definitions. The scope shall be limited by static at the time of releasing.
+ * Remove the static in order to remove the file scope at MT.
+ */
+ #define DEBUG_PRINT(msg)
+
+ /**< Static definitions. The scope shall be limited by static at the time of releasing.
+ * Remove the static in order to remove the file scope at MT.
+ */
+ #define DEBUG_PRINTF(format, msg)
+
+ /**< Static definitions. The scope shall be limited by static at the time of releasing.
+ * Remove the static in order to remove the file scope at MT.
+ */
+ #define VP_DEBUG_STATIC_ASSERT(expr)
+#endif
+
+/* ====================================================================== */
+/* General-purpose type definition - Redifined for internal use */
+/* ====================================================================== */
+/**< Internal boolean type - sys/type.h has no type definitions, so defined it here. FCCR: "F"unc"C"heck_"C"an"R"cv */
+typedef enum VP_FCCR_BOOL_Tag {
+ B_FALSE, /**< FALSE */
+ B_TRUE /**< TRUE */
+} VP_FCCR_BOOL;
+
+
+/* ====================================================================== */
+/* Structure */
+/* ====================================================================== */
+typedef struct TABLE_INDEX_INFO_tag {
+ char* code_str; /**< String that can be gotten from vehicle parameters */
+ unsigned int index; /**< Index for function existence */
+} TABLE_INDEX_INFO;
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_VP_FUNCCHECK_CANRCV_PRIVATE_H_
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h
new file mode 100755
index 0000000..17b4503
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h
@@ -0,0 +1,133 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* ====================================================================== */
+/**
+ * @file VP_FuncCheck_CanRcv.h
+ * @brief \~english Get function existence API header file
+ */
+/* ====================================================================== */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_FUNCCHECK_CANRCV_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_FUNCCHECK_CANRCV_H_
+
+#include <sys/types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+
+// typedef unsigned char u_int8;
+
+
+/**
+* @~english XM Audio
+*/
+#define XM_AUDIO ((u_int8_t)1)
+/**
+* @~english _CWORD76_
+*/
+#define _CWORD76_ ((u_int8_t)2)
+
+#define VP_CANRCV__CWORD27_ ((u_int8_t)3) /**< _CWORD27_ */
+/**
+* @~english WiFi HotSpot
+*/
+#define WIFI_HOTSPOT ((u_int8_t)4)
+/**
+* @~english standard driving rregulation of AREA1
+*/
+#define AREA1_STD_TRAF_LIMIT ((u_int8_t)5)
+/**
+* @~english HD Data (Include traffic)
+*/
+#define HD_DATA ((u_int8_t)6)
+/**
+* @~english WiFi 5G
+*/
+#define WIFI_5G ((u_int8_t)7)
+
+/**
+* @~english definiton of return value of API(VP_FuncCheck_CanRcv),which is used to get status of function implemention
+*/
+#define FUNCTION_CHECK_RESULT_OK ((u_int8_t)0)
+/**
+* @~english this function is invalid
+*/
+#define FUNCTION_CHECK_RESULT_NG ((u_int8_t)1)
+/**
+* @~english this function does not exist
+*/
+#define FUNCTION_CHECK_RESULT_UNKNOWN ((u_int8_t)2)
+/**
+* @~english reference out of AREA1
+*/
+#define FUNCTION_CHECK_RESULT_OUT_OF_AREA1 ((u_int8_t)3)
+
+/* Function prototype declaration */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup VP_FuncCheck_CanRcv
+/// \~english @par Brief
+/// VP_FuncCheck_CanRcv
+/// \~english @param [in] FunctionName
+/// function name
+/// \~english @retval FUNCTION_CHECK_RESULT_OK: This function is available
+/// \~english @retval FUNCTION_CHECK_RESULT_NG: This function is unavailable
+/// \~english @retval FUNCTION_CHECK_RESULT_UNKNOWN: This function does not exist
+/// \~english @retval FUNCTION_CHECK_RESULT_OUT_OF_AREA1: reference out of Area1
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - To get the function check result from
+/// - vehicle parameter:CAN info judge
+/// - vehicle parameter:country ID
+/// - country ID and function judge info in API
+/// - When vehicle parameter:CAN info judge
+/// is [CAN_judge] or [country_ID],
+/// and if country_ID is unacquainted or undefined, the API returns [available].
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+u_int8_t VP_FuncCheck_CanRcv(u_int8_t FunctionName);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_FUNCCHECK_CANRCV_H_
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h
new file mode 100755
index 0000000..69f6df2
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h
@@ -0,0 +1,114 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* ====================================================================== */
+/**
+ * @file VP_GetEnv.h
+ * @brief \~english Get vehicle parameter environment variable API header file
+ */
+/* ====================================================================== */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_GETENV_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_GETENV_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+#include <other_service/env_ext.h>
+
+/**
+* @~english the max length of vehicle parameter environment viarable
+*/
+
+#define VP_MAX_LENGTH 128
+
+/**
+* @~english definition of parameter environment viarable such as destination
+* destination diff
+*/
+
+#define VEHICLEPARAMETERLIBRARY_AREA "VEHICLEPARAMETERLIBRARY_AREA"
+
+/**
+* @~english brand diff
+*/
+#define VEHICLEPARAMETERLIBRARY_BRAND "VEHICLEPARAMETERLIBRARY_BRAND"
+
+/**
+* @~english definition of _CWORD31_ vehicle parameter environment viarable
+*/
+#include <other_service/env_vehicle.h>
+
+/**
+* @~english definition of vehicle parameter environment viarable
+*/
+#include <other_service/env_vehicleparameterlibrary.h>
+
+/**
+* @~english definition of Serial vehicle parameter environment viarable
+*/
+#include <other_service/env_vehicleparameterlibrary_serial.h>
+
+/* Function prototype declaration */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup VP_GetEnv
+/// \~english @par Brief
+/// VP_GetEnv
+/// \~english @param [in] pEnvStr
+/// The pointer of environment variable name string
+/// \~english @param [out] pEnvBuff
+/// The head address of saving environment variable value
+/// \~english @retval None
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync Only
+/// \~english @par Detail
+/// - To get the environment variable value by the environment variable name,
+/// and save it in pEnvBuff.
+/// - When environment variable name is NULL or an undefined value,
+/// a blank string shall be saved in pEnvBuff.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+void VP_GetEnv(const char *pEnvStr, char *pEnvBuff);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_GETENV_H_
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_ext.h b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_ext.h
new file mode 100755
index 0000000..266e510
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_ext.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file env_ext.h
+ * @brief \~english Define of supplier vehicle parameter environment variable.
+ */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_EXT_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_EXT_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+
+//
+// Please describe supplier-specific definitions of the vehicle parameters.
+//
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_EXT_H_
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicle.h b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicle.h
new file mode 100755
index 0000000..a0eaaf9
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicle.h
@@ -0,0 +1,331 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file env_vehicle.h
+ * @brief \~english Define of _CWORD31_ vehicle parameter environment variable
+ */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLE_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLE_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+
+/**
+* @~english _CWORD31_ version
+*/
+#define VP__CWORD31__VERSION "VP__CWORD31__version"
+/**
+* @~english _CWORD31_ class type of LAN
+*/
+
+#define VP__CWORD31__CLASS_TYPE_OF_LAN "VP__CWORD31__class_type_of_LAN"
+/**
+* @~english _CWORD31_ reverse signal
+*/
+
+#define VP__CWORD31__REVERSE "VP__CWORD31__reverse"
+/**
+* @~english _CWORD31_ PKB signal
+*/
+
+#define VP__CWORD31__PKB "VP__CWORD31__PKB"
+/**
+* @~english _CWORD31_ ADIM signal of _CWORD62_
+*/
+
+#define VP__CWORD31__ADIM__CWORD62_ "VP__CWORD31__ADIM__CWORD62_"
+/**
+* @~english _CWORD31_ telematics function
+*/
+
+#define VP__CWORD31__TELEMATICS_FUNCTION "VP__CWORD31__telematics_function"
+/**
+* @~english _CWORD31_ opening picture
+*/
+
+#define VP__CWORD31__OPENING_PICTURE "VP__CWORD31__opening_picture"
+/**
+* @~english _CWORD31_ theme color
+*/
+
+#define VP__CWORD31__THEME_COLOR "VP__CWORD31__theme_color"
+/**
+* @~english _CWORD31_ vehicle design vehicle body
+*/
+#define VP__CWORD31__VEHICLE_BODY "VP__CWORD31__vehicle_body"
+/**
+* @~english _CWORD31_ air conditioner on screen
+*/
+#define VP__CWORD31__AC_ONSCREEN "VP__CWORD31__AC_onscreen"
+/**
+* @~english _CWORD31_ air conditioner screen operation
+*/
+#define VP__CWORD31__AC_SCREEN_OPERATION "VP__CWORD31__AC_screen_operation"
+/**
+* @~english _CWORD31_ air conditioner home screen
+*/
+#define VP__CWORD31__AC_SCREEN_HOME "VP__CWORD31__AC_screen_home"
+/**
+* @~english _CWORD31_ air conditioner switch concierge
+*/
+#define VP__CWORD31__AC_SWITCH_CONCIERGE "VP__CWORD31__AC_switch_concierge"
+/**
+* @~english _CWORD31_ _CWORD113_
+*/
+#define VP__CWORD31___CWORD11_ "VP__CWORD31___CWORD11_"
+/**
+* @~english _CWORD31_ EF home screen
+*/
+#define VP__CWORD31___CWORD11__HOME "VP__CWORD31___CWORD11__home"
+/**
+* @~english _CWORD31_ drive wheel of _CWORD113_
+*/
+#define VP__CWORD31___CWORD11__DRIVE_WHEEL "VP__CWORD31___CWORD11__drive_wheel"
+/**
+* @~english _CWORD31_ drive type of _CWORD113_
+*/
+#define VP__CWORD31___CWORD11__DRIVE_TYPE "VP__CWORD31___CWORD11__drive_type"
+/**
+* @~english _CWORD31_ battery position of _CWORD113_
+*/
+#define VP__CWORD31___CWORD11__BATTERY_POSITION "VP__CWORD31___CWORD11__battery_position"
+/**
+* @~english _CWORD31_ _CWORD112_ trip
+*/
+#define VP__CWORD31___CWORD9__TRIP "VP__CWORD31___CWORD9__trip"
+/**
+* @~english _CWORD31_ FC home screen trip
+*/
+#define VP__CWORD31___CWORD9__HOME_TRIP "VP__CWORD31___CWORD9__home_trip"
+/**
+* @~english _CWORD31_ _CWORD112_ fuel
+*/
+#define VP__CWORD31___CWORD9__FUEL "VP__CWORD31___CWORD9__fuel"
+/**
+* @~english _CWORD31_ FC home screen fuel
+*/
+#define VP__CWORD31___CWORD9__HOME_FUEL "VP__CWORD31___CWORD9__home_fuel"
+/**
+* @~english _CWORD31_ FC eco safety point service
+*/
+#define VP__CWORD31__FC_ECO_SAFETY_POINT_SERVICE "VP__CWORD31__FC_eco_safety_point_service"
+/**
+* @~english _CWORD31_ FC GAS scale
+*/
+#define VP__CWORD31__FC_SCALE_GAS "VP__CWORD31__FC_scale_GAS"
+/**
+* @~english _CWORD31_ FC HV scale
+*/
+#define VP__CWORD31__FC_SCALE_HV "VP__CWORD31__FC_scale_HV"
+/**
+* @~english _CWORD31_ fuel consumption display function scale of fuel consumption (ForFC)
+*/
+#define VP__CWORD31__FC_SCALE_FC "VP__CWORD31__FC_scale_FC"
+/**
+* @~english _CWORD31_ fuel consumption display function scale of fuel consumption (ForEV)
+*/
+#define VP__CWORD31__FC_SCALE_EV "VP__CWORD31__FC_scale_EV"
+/**
+* @~english _CWORD31_ FC energy mark
+*/
+#define VP__CWORD31__FC_ENERGY_MARK "VP__CWORD31__FC_energy_mark"
+/**
+* @~english _CWORD31_ _CWORD112_ type
+*/
+#define VP__CWORD31___CWORD9__TYPE "VP__CWORD31___CWORD9__type"
+/**
+* @~english _CWORD31_ FC signal
+*/
+#define VP__CWORD31__FC_SIGNAL "VP__CWORD31__FC_SIGNAL"
+/**
+* @~english _CWORD31_ display setting screen
+*/
+#define VP__CWORD31__DISPLAY_SETTING_SCREEN "VP__CWORD31__display_setting_screen"
+/**
+* @~english _CWORD31_ clock type
+*/
+#define VP__CWORD31__CLOCK_TYPE "VP__CWORD31__clock_type"
+/**
+* @~english _CWORD31_ start up BGM
+*/
+#define VP__CWORD31__START_UP_BGM "VP__CWORD31__start_up_BGM"
+/**
+* @~english _CWORD31_ start up BGM type
+*/
+#define VP__CWORD31__START_UP_BGM_TYPE "VP__CWORD31__start_up_BGM_type"
+/**
+* @~english _CWORD31_ font left DTV antenna
+*/
+#define VP__CWORD31__DTV_ANTENNA_FL "VP__CWORD31__DTV_antenna_FL"
+/**
+* @~english _CWORD31_ font right DTV antenna
+*/
+#define VP__CWORD31__DTV_ANTENNA_FR "VP__CWORD31__DTV_antenna_FR"
+/**
+* @~english _CWORD31_ rear left DTV antenna
+*/
+#define VP__CWORD31__DTV_ANTENNA_RL "VP__CWORD31__DTV_antenna_RL"
+/**
+* @~english _CWORD31_ rear right DTV antenna
+*/
+#define VP__CWORD31__DTV_ANTENNA_RR "VP__CWORD31__DTV_antenna_RR"
+/**
+* @~english _CWORD31_ DTV antenna
+*/
+#define VP__CWORD31__DTV_ANTENNA "VP__CWORD31__DTV_antenna"
+/**
+* @~english _CWORD31_ antenna info antenna available / unavailable
+*/
+#define VP__CWORD31__BEACON_ANTENNA "VP__CWORD31__beacon_antenna"
+/**
+* @~english _CWORD31_ HF voice quality type
+*/
+#define VP__CWORD31__HF_VOICE_QUALITY_TYPE "VP__CWORD31__HF_voice_quality_type"
+/**
+* @~english _CWORD31_ DAB antenna
+*/
+#define VP__CWORD31__DAB_ANTENNA "VP__CWORD31__DAB_antenna"
+/**
+* @~english _CWORD31_ DAB screen display
+*/
+#define VP__CWORD31__DAB_SCREEN "VP__CWORD31__DAB_screen"
+/**
+* @~english _CWORD31_ hard switch beep
+*/
+#define VP__CWORD31__HARD_SWITCH_BEEP "VP__CWORD31__hard_switch_beep"
+/**
+* @~english _CWORD31_ beep while hard SW being pressed
+*/
+#define VP__CWORD31__SCREEN_SWITCH_BEEP "VP__CWORD31__screen_switch_beep"
+/**
+* @~english _CWORD31_ steering SW type of steering SW
+*/
+#define VP__CWORD31__STEERING_SWITCH_TYPE "VP__CWORD31__steering_switch_type"
+/**
+* @~english _CWORD31_ TEL switch of steering
+*/
+#define VP__CWORD31__STEERING_SWITCH_TEL "VP__CWORD31__steering_switch_tel"
+/**
+* @~english _CWORD31_ class circuit mode
+*/
+#define VP__CWORD31__CLASS_CIRCUIT_MODE "VP__CWORD31__class_circuit_mode"
+/**
+* @~english _CWORD31_ panel microcomputer
+*/
+#define VP__CWORD31__PANEL_MICROCOMPUTER "VP__CWORD31__panel_microcomputer"
+/**
+* @~english _CWORD31_ class watch at brake hold
+*/
+#define VP__CWORD31__CLASS_WATCH_AT_BRAKE_HOLD "VP__CWORD31__class_watch_at_brake_hold"
+/**
+* @~english _CWORD31_ GPS antenna
+*/
+#define VP__CWORD31__GPS_ANTENNA "VP__CWORD31__GPS_antenna"
+/**
+* @~english _CWORD31_ ILL- available / unavailable
+*/
+#define VP__CWORD31__ILL_SIGNAL "VP__CWORD31__ILL_signal"
+/**
+* @~english _CWORD31_ switch trigger
+*/
+#define VP__CWORD31__SWITCH_TRIGGER "VP__CWORD31__switch_trigger"
+/**
+* @~english _CWORD31_ sensitivity level
+*/
+#define VP__CWORD31__SENSITIVITY_LEVEL "VP__CWORD31__sensitivity_level"
+/**
+* @~english _CWORD31_ hadsfree bluetooth device name / WiFi AP name selection
+*/
+#define VP__CWORD31__BT_DEVICE_AP_NAME "VP__CWORD31__BT_device_AP_name"
+/**
+* @~english _CWORD31_ Eco drive max vol setting in D4 model
+*/
+#define VP__CWORD31__ECO_RUN_D4_VOL_MAX "VP__CWORD31__eco_run_D4_VOL_max"
+/**
+* @~english _CWORD31_ thumbnail type
+*/
+#define VP__CWORD31__THUMBNAIL_TYPE "VP__CWORD31__thumbnail_type"
+/**
+* @~english _CWORD31_ EOM function
+*/
+#define VP__CWORD31__EOM_FUNCTION "VP__CWORD31__EOM_function"
+/**
+* @~english _CWORD31_ Microphone Type
+*/
+#define VP__CWORD31__MICROPHONE_TYPE "VP__CWORD31__Microphone_Type"
+/**
+* @~english _CWORD31_ Microphone Location
+*/
+#define VP__CWORD31__MICROPHONE_LOCATION "VP__CWORD31__Microphone_Location"
+/**
+* @~english _CWORD31_ VR microphone parameter vehicle noize level
+*/
+#define VP__CWORD31__VEHICLE_NOIZE_LEVEL "VP__CWORD31__vehicle_noize_level"
+
+/**
+* @~english _CWORD31_ wide band FM
+*/
+#define VP__CWORD31__WIDE_BAND_FM "VP__CWORD31__Wide_band_FM"
+/**
+* @~english _CWORD31_ map color
+*/
+#define VP__CWORD31__MAP_COLOR "VP__CWORD31__map_color"
+/**
+* @~english _CWORD31_ cloud eco
+*/
+#define VP__CWORD31__CLOUD_ECO "VP__CWORD31__cloud_eco"
+/**
+* @~english _CWORD31_ eg type
+*/
+#define VP__CWORD31__EG_TYPE "VP__CWORD31__EG_type"
+
+/**
+* @~english _CWORD31_ display type
+*/
+#define VP__CWORD31__DISPLAY_TYPE "VP__CWORD31__display_type"
+/**
+* @~english _CWORD31_ clock display
+*/
+#define VP__CWORD31__CLOCK_DISPLAY "VP__CWORD31__clock_display"
+/**
+* @~english _CWORD31_ destination
+*/
+#define VP__CWORD31__DESTINATION "VP__CWORD31__destination"
+/**
+* @~english _CWORD31_ class operation
+*/
+#define VP__CWORD31__CLASS_OPERATION "VP__CWORD31__class_operation"
+/**
+* @~english _CWORD31_ DES function
+*/
+#define VP__CWORD31__DES_FUNCTION "VP__CWORD31__DES_function"
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLE_H_
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h
new file mode 100755
index 0000000..1c0020c
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h
@@ -0,0 +1,138 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file env_vehicleparameterlibrary.h
+ * @brief \~english Define of vehicle parameter environment variable
+ */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+
+/**
+* @~english version
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_VERSION "VP_VEHICLEPARAMETERLIBRARY_version"
+/**
+* @~english maker ID
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_MAKER_ID "VP_VEHICLEPARAMETERLIBRARY_maker_ID"
+/**
+* @~english area
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_AREA "VP_VEHICLEPARAMETERLIBRARY_area"
+/**
+* @~english grade
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_GRADE "VP_VEHICLEPARAMETERLIBRARY_grade"
+/**
+* @~english destination country code
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE "VP_VEHICLEPARAMETERLIBRARY_dest_c_code"
+/**
+* @~english DAB tuner number
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_DAB_TUNER_NUM "VP_VEHICLEPARAMETERLIBRARY_DAB_tuner_num"
+/**
+* @~english AM radio
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_AM_RADIO "VP_VEHICLEPARAMETERLIBRARY_AM_Radio"
+/**
+* @~english amp type
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_AMP_TYPE "VP_VEHICLEPARAMETERLIBRARY_AMP_type"
+/**
+* @~english display
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_DISPLAY "VP_VEHICLEPARAMETERLIBRARY_DISPLAY"
+/**
+* @~english touch panel
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_TOUCHPANEL "VP_VEHICLEPARAMETERLIBRARY_TOUCHPANEL"
+/**
+* @~english DECK
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_DECK "VP_VEHICLEPARAMETERLIBRARY_DECK"
+/**
+* @~english JP traffic information show
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_JPTRAFFICINFO_SHOW "VP_VEHICLEPARAMETERLIBRARY_JPTrafficInfo_show"
+/**
+* @~english connection server
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_CONNECTION_SERVER "VP_VEHICLEPARAMETERLIBRARY_CONNECTION_SERVER"
+/**
+* @~english _CWORD40_ generation
+*/
+#define VP_VEHICLEPARAMETERLIBRARY__CWORD40_ "VP_VEHICLEPARAMETERLIBRARY__CWORD40_"
+
+/**
+* @~english Radio reception level
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_RADIO_LV_DIAG "VP_VEHICLEPARAMETERLIBRARY_RADIO_LV_DIAG"
+
+/**
+* @~english Navigation model
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_NAVI "VP_VEHICLEPARAMETERLIBRARY_NAVI"
+
+/**
+* @~english Map update service
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_MAP_UPDATE "VP_VEHICLEPARAMETERLIBRARY_MAP_UPDATE"
+
+/**
+* @~english Headunit identification
+*/
+#define VP_HEAD_UNIT_ID "VP_HEAD_UNIT_ID"
+
+/**
+* @~english Serius raido
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_SDARS "VP_VEHICLEPARAMETERLIBRARY_SDARS"
+
+/**
+* @~english optional amp
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_ACCESSORY_AMP "VP_VEHICLEPARAMETERLIBRARY_ACCESSORY_AMP"
+
+/**
+* @~english Key trace
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_KEY_TRACE "VP_VEHICLEPARAMETERLIBRARY_KEY_TRACE"
+
+/**
+* @~english diatal TV
+*/
+#define VP_VEHICLEPARAMETERLIBRARY_DTV "VP_VEHICLEPARAMETERLIBRARY_DTV"
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_H_
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h
new file mode 100755
index 0000000..04ae10e
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file env_vehicleparameterlibrary_serial.h
+ * @brief \~english Define of Serial vehicle parameter environment variable
+ */
+
+#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_SERIAL_H_
+#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_SERIAL_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+
+/**
+ * \~english Enviroment variable _CWORD49__ID
+ */
+#define VP_VEHICLEPARAMETERLIBRARY_SER__CWORD49__ID "VP_VEHICLEPARAMETERLIBRARY_SER__CWORD49__ID"
+
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_SERIAL_H_
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h
new file mode 100755
index 0000000..151bae5
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file vehicle_parameter_library.h
+ * @brief \~english include all vehicle_parameter_library head files
+ */
+
+#ifndef OTHERSERVICE_VEHICLEPARAMETERLIBRARY_H_ // NOLINT(build/header_guard)
+#define OTHERSERVICE_VEHICLEPARAMETERLIBRARY_H_ // NOLINT(build/header_guard)
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup other_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_parameter_library
+ * @ingroup other_service
+ * @{
+ */
+#include <other_service/VP_FuncCheck_CanRcv.h>
+#include <other_service/VP_GetEnv.h>
+#include <other_service/env_vehicleparameterlibrary.h>
+#include <other_service/env_vehicleparameterlibrary_serial.h>
+#include <other_service/env_vehicle.h>
+#include <other_service/env_ext.h>
+/** @}*/ // end of vehicle_parameter_library
+/** @}*/ // end of other_service
+/** @}*/ // end of BaseSystem
+
+#endif // OTHERSERVICE_VEHICLEPARAMETERLIBRARY_H_
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c b/video_in_hal/otherservice/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c
new file mode 100755
index 0000000..938ea7f
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c
@@ -0,0 +1,732 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file VP_FuncCheck_CanRcv.c
+ * @brief Get function existence API
+ */
+
+
+/* ====================================================================== */
+/* Header */
+/* ====================================================================== */
+#include <assert.h>
+#include <string.h>
+#include <regex.h>
+
+#include <other_service/VP_GetEnv.h>
+#include "VP_FuncCheck_CanRcv_private.h"
+
+/* ====================================================================== */
+/* Enumeration types */
+/* ====================================================================== */
+typedef enum VPFuncTableDestIndexTag{
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ VP_FUNC_TABLE_DEST_INDEX_A ,
+ VP_FUNC_TABLE_DEST_INDEX_B ,
+
+ VP_FUNC_TABLE_DEST_INDEX_MAX /**< Number of choices (index maximum value: 1) */
+} VP_FUNC_TABLE_DEST_INDEX;
+
+typedef enum VPFuncTableBrandTag{
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ VP_FUNC_TABLE_BRAND_A,
+ VP_FUNC_TABLE_BRAND_B,
+
+ VP_FUNC_TABLE_BRAND_INDEX_MAX /**< Number of choices (index maximum value: 1) */
+} VP_FUNC_TABLE_BRAND;
+
+typedef enum VPFuncTableGradeLTag{
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ VP_FUNC_TABLE_GRADE_A1,
+ VP_FUNC_TABLE_GRADE_A2,
+
+ VP_FUNC_TABLE_GRADE_A_INDEX_MAX /**< Number of choices (index maximum value: 1) */
+} VP_FUNC_TABLE_GRADE_A;
+
+typedef enum VPFuncTableGradeTTag{
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ VP_FUNC_TABLE_GRADE_B1,
+ VP_FUNC_TABLE_GRADE_B2,
+
+ VP_FUNC_TABLE_GRADE_B_INDEX_MAX /**< Number of choices (index maximum value: 1) */
+} VP_FUNC_TABLE_GRADE_B;
+
+typedef enum VPFuncTableFuncTypeIndexTag{
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN , /**< Unknown function */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_XM_AUDIO , /**< XM Audio */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_VP_CANRCV__CWORD27_ , /**< _CWORD27_ */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_HOTSPOT , /**< Wifi Hotspot */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_RESTRICT_FUNCTION , /**< Travel Restriction */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_HD_DATA , /**< HD Data */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_5G , /**< Wifi 5G */
+
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_MAX /**< Number of choices (index maximum value: 1) */
+} VP_FUNC_TABLE_FUNC_TYPE;
+
+/** Processing definitions for CAN information availability */
+typedef enum CANFuncCheckSwitchTag{
+ CAN_FUNC_CHEK_AVAILABLE ,
+ CAN_FUNC_CHEK_UNAVAILABLE ,
+ CAN_FUNC_CHEK_COUNTRY_CODE
+} CAN_FUNC_CHEK_SWITCH;
+
+
+
+/**< Definition of number of functions (required for initial definition of function availability table) */
+
+#define VP_FUNC_TABLE_FUNCTION_INDEX_MAX ((unsigned int)7)
+
+/* ====================================================================== */
+/* Macro definitions */
+/* ====================================================================== */
+/* Definition for return value from string functions */
+#define RET_STD_LIB_STRING_STR_CMP_OK ((int)0) /**< The return value of the strncmp. this value is returned when matched. */
+
+/* Default index values */
+#define DEFAULT_TABLE_INDEX_DEST (VP_FUNC_TABLE_DEST_INDEX_A) /* Initial value changed by the specification which returns the setting of the belonging property when the undefined country code is gotten. */
+#define DEFAULT_TABLE_INDEX_BRAND (VP_FUNC_TABLE_BRAND_A)
+#define DEFAULT_TABLE_INDEX_GRADE_A (VP_FUNC_TABLE_GRADE_A1)
+#define DEFAULT_TABLE_INDEX_GRADE_B (VP_FUNC_TABLE_GRADE_B1)
+#define DEFAULT_CAN_JUDGE_STATUS (CAN_FUNC_CHEK_COUNTRY_CODE)
+
+/* ====================================================================== */
+/* Constant definitions */
+/* ====================================================================== */
+
+/* ====================================================================== */
+/* Structures */
+/* ====================================================================== */
+
+/* ====================================================================== */
+/* Internal function prototype declarations */
+/* ====================================================================== */
+#ifdef VP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE
+MT_STATIC u_int8_t getResult_CanJudge( unsigned int idx_func );
+MT_STATIC unsigned int getIndexOfFunc( u_int8_t func );
+MT_STATIC unsigned int getIndexOfTable( const char vp_param_str[] , const TABLE_INDEX_INFO table_index_info[] , unsigned int info_size, unsigned int default_index );
+MT_STATIC VP_FCCR_BOOL hasMultipleCoutnry( const char dest_str[] , const char multiple_country_code_desig[] );
+#endif
+/* ====================================================================== */
+/* Public function definitions */
+/* ====================================================================== */
+/**
+ * @fn
+ * u_int8_t VP_FuncCheck_CanRcv( u_int8_t FunctionName )
+ * @brief Get function existence API(Public)
+ * @param[in] (FunctionName) Function Name (Number)
+ * @return FUNCTION_CHECK_RESULT_OK :This function is available
+ * FUNCTION_CHECK_RESULT_NG :This function is unavailable
+ * FUNCTION_CHECK_RESULT_UNKNOWN :This function does not exist
+ * @details Read the function name as feature name specified in the argument, then return one of the
+ * "This function is available"/"This function is unavailable"/"This function does not exist"
+ * of the feature as the following check-result:
+ * - vehicle parameter:CAN information availability(destination package) judge
+ * - vehicle parameter:country code
+ * - Whether or not supported the features corresponding to the country code in this API
+ *
+ * When CAN information availability (destination package) in vehicle parameters is
+ * "Control ON/OFF according to CAN information" or "Country code", return "This function is available"
+ * if this function is called when the country code from CAN is unacquired or undetermined country code.
+ */
+/* ====================================================================== */
+u_int8_t VP_FuncCheck_CanRcv( u_int8_t FunctionName )
+{
+#ifndef VP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE
+ u_int8_t result;
+
+ switch(FunctionName) {
+ case XM_AUDIO:
+ result = FUNCTION_CHECK_RESULT_NG;
+ break;
+
+ case VP_CANRCV__CWORD27_:
+ case WIFI_HOTSPOT:
+ case AREA1_STD_TRAF_LIMIT:
+ case HD_DATA:
+ case WIFI_5G:
+ result = FUNCTION_CHECK_RESULT_OK;
+ break;
+ default:
+ result = FUNCTION_CHECK_RESULT_UNKNOWN;
+ break;
+ }
+
+ return result;
+#else
+
+ /* ====================================================================== */
+ /* Internal table definition */
+ /* ====================================================================== */
+ /** Vehicle Parameter "CAN information Support/Not Support"- processing selector translation table */
+ const TABLE_INDEX_INFO TABLE_STATUS_INFO_CAN_JUDGE[] =
+ {
+ { "available" , CAN_FUNC_CHEK_AVAILABLE }, // Yes
+ { "unavailable" , CAN_FUNC_CHEK_UNAVAILABLE }, // None
+ { "CAN_judge" , CAN_FUNC_CHEK_COUNTRY_CODE }, // Control ON/OFF according to CAN information
+ { "country_ID" , CAN_FUNC_CHEK_COUNTRY_CODE } // Country code
+ };
+
+ /* ====================================================================== */
+ /* Table Size Definition */
+ /* ====================================================================== */
+ const unsigned int LENGTHOF_TABLE_INDEX_INFO_CAN_JUDGE = ( sizeof(TABLE_STATUS_INFO_CAN_JUDGE ) / sizeof( TABLE_INDEX_INFO ) );
+
+ /* ====================================================================== */
+ /* Internal variable declarations */
+ /* ====================================================================== */
+ u_int8_t result = FUNCTION_CHECK_RESULT_UNKNOWN;
+
+ unsigned int idx_func = 0;
+
+ unsigned int can_judge_status = CAN_FUNC_CHEK_COUNTRY_CODE;
+ char VP_canjudge[ VP_MAX_LENGTH ];
+ char VP_area[ VP_MAX_LENGTH ];
+
+ /* ====================================================================== */
+ /* Process */
+ /* ====================================================================== */
+ /* Get vehicle parameter */
+ VP_GetEnv( VEHICLEPARAMETERLIBRARY_AREA , &(VP_area[0]) );
+
+ DEBUG_PRINTF( "AREA = %s; " , VP_area )
+
+ /* Get feature name index */
+ idx_func = getIndexOfFunc( FunctionName );
+
+ DEBUG_PRINTF( "Function = %d; " , FunctionName )
+ DEBUG_PRINTF( "idx_func = %d\n" , idx_func )
+
+ /* Judge as other than area1 because it is not a area1 */
+ if ( strncmp( VP_area, "AREA1", VP_MAX_LENGTH ) != RET_STD_LIB_STRING_STR_CMP_OK )
+ {
+ result = FUNCTION_CHECK_RESULT_OUT_OF_AREA1;
+ }
+ else
+ {
+ /* If the feature is unknown, it is judged to be unknown before checking CAN information. */
+ if ( VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN == idx_func )
+ {
+ result = FUNCTION_CHECK_RESULT_UNKNOWN;
+ }
+ else
+ {
+ /* Get vehicle parameter */ /* It is unnecessary to get the parameter every time, but because there is no process to check the change, it is gotten every time as a precaution. */
+ VP_GetEnv( VP__CWORD31__TELEMATICS_FUNCTION , &(VP_canjudge[0]) );
+
+ /* Choose processing according to CAN information Support/Not Support. */
+ can_judge_status = getIndexOfTable(
+ &(VP_canjudge[0]),
+ &(TABLE_STATUS_INFO_CAN_JUDGE[0]),
+ LENGTHOF_TABLE_INDEX_INFO_CAN_JUDGE,
+ DEFAULT_CAN_JUDGE_STATUS
+ );
+
+ DEBUG_PRINTF( "VP_canjudge = %s; ", VP_canjudge )
+
+ /* When judging from CAN information or country code */
+ if ( CAN_FUNC_CHEK_COUNTRY_CODE == can_judge_status )
+ {
+ DEBUG_PRINT( "CAN judge : C_CODE or CAN_JUDGE" )
+ result = getResult_CanJudge( idx_func );
+ }
+ else
+ {
+ /* For available/unavailable */
+ /* Standard travel restriction of AREA1 */
+ if ( AREA1_STD_TRAF_LIMIT == idx_func )
+ {
+ result = FUNCTION_CHECK_RESULT_OK;
+ }
+ else
+ {
+ switch( can_judge_status )
+ {
+ case CAN_FUNC_CHEK_UNAVAILABLE:
+ DEBUG_PRINT( "CAN judge : UNAVAILABLE" )
+ result = FUNCTION_CHECK_RESULT_NG;
+ break;
+
+ case CAN_FUNC_CHEK_AVAILABLE:
+ default: /* If the default value of canjudge_status are set correctly, the default cannot be selected */
+ DEBUG_PRINT( "CAN judge : AVAILABLE" )
+ result = FUNCTION_CHECK_RESULT_OK;
+ break;
+ }
+ }
+ }
+ }
+ }
+ DEBUG_PRINTF( "RESULT = %d\n", result )
+
+ return result;
+
+#endif
+}
+
+/* ====================================================================== */
+/* Internal function definitions */
+/* ====================================================================== */
+#ifdef VP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE
+/* ====================================================================== */
+/**
+ * @brief Get function existence in consideration of country code
+ * @detials Internal-use functions - Processing when CAN information availability is "Country Code"
+ * @param[in] idx_func Table index corresponding to the feature (takes as its argument the value after conversion to a table index, not the feature name)
+ * @return Availability of the feature in current vehicle parameters
+ */
+/* ====================================================================== */
+MT_STATIC u_int8_t getResult_CanJudge( unsigned int idx_func )
+{
+ /* ====================================================================== */
+ /* Internal constant definition */
+ /* ====================================================================== */
+ static const char MULTIPLE_COUNTRY_CODE_DESIG[] = "^[0-9]{3}(;[0-9]{3})+;{0,1}"; /**< Regular Expression String for Multiple Countries (Attributes). Make sure at least two country codes are stored / delimited */
+
+ /* ====================================================================== */
+ /* Internal table definitions */
+ /* ====================================================================== */
+ /** Feature table index conversion table (country code) */
+ const TABLE_INDEX_INFO TABLE_INDEX_INFO_DESTINATION[] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ { "101" , VP_FUNC_TABLE_DEST_INDEX_A }, // Detination A
+ { "102" , VP_FUNC_TABLE_DEST_INDEX_B } // Detination B
+ };
+
+ /** @todo The consideration. For the feature table by country code, if it can be summarized the GRADE A1/GRADE A2 and GRADE B1/GRADE B2,
+ It can be also summarized the translation table.
+ However, it must be able to guarantee that there are no differences in the table format in L/T. */
+ /** Index Ttranslation Table for feature availability table (for grade A) */
+ const TABLE_INDEX_INFO TABLE_INDEX_INFO_GRADE_A[] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ { "A1" , VP_FUNC_TABLE_GRADE_A1 }, // GRADE A1
+ { "A2" , VP_FUNC_TABLE_GRADE_A2 } // GRADE A2
+ };
+
+ /** Index Translation Table for feature availability table (for grade B) */
+ const TABLE_INDEX_INFO TABLE_INDEX_INFO_GRADE_B[] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ { "B1" , VP_FUNC_TABLE_GRADE_B1 }, // GRADE B1
+ { "B2" , VP_FUNC_TABLE_GRADE_B2 }, // GRADE B2
+ };
+
+ /** Index Translation Table for feature availability table (brand) */
+ const TABLE_INDEX_INFO TABLE_INDEX_INFO_BRAND[] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ { "A" , VP_FUNC_TABLE_BRAND_A }, // BRAND A
+ { "B" , VP_FUNC_TABLE_BRAND_B } // BRAND B
+ };
+
+ /* ====================================================================== */
+ /**
+ * @brief Feature availability table for BRAND A
+ * @details Array of type u_int8_t accessed by the following index
+ */
+ /* ====================================================================== */
+ const u_int8_t VP_FUNC_CHECK_CANRCV_TABLE_A[ VP_FUNC_TABLE_DEST_INDEX_MAX ]
+ [ VP_FUNC_TABLE_GRADE_A_INDEX_MAX ]
+ [ VP_FUNC_TABLE_FUNCTION_INDEX_MAX ] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ /* Destination A */
+ {
+ // Unknown , XM Audio , _CWORD27_ , Wifi HotSpot , Travel Restriction , HD Data Wifi 5G
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE A1
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK } // GRADE A2
+ },
+
+ /* Destination B */
+ {
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE A1
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_NG } // GRADE A2
+ }
+ };
+
+ /* ====================================================================== */
+ /**
+ * @brief Feature availability table for BRAND B
+ */
+ /* ====================================================================== */
+ const u_int8_t VP_FUNC_CHECK_CANRCV_TABLE_B[ VP_FUNC_TABLE_DEST_INDEX_MAX ]
+ [ VP_FUNC_TABLE_GRADE_B_INDEX_MAX ]
+ [ VP_FUNC_TABLE_FUNCTION_INDEX_MAX ] =
+ {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ /* Destination A */
+ {
+ // Unknown , XM Audio , _CWORD27_ , Wifi HotSpot , Travel Restriction , HD Data , Wifi 5G
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE B1
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK }, // GRADE B2
+ },
+
+ /* Detination B */
+ {
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE B1
+ { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_NG }, // GRADE B2
+ }
+ };
+
+ /* ====================================================================== */
+ /* Table Size Definitions */
+ /* ====================================================================== */
+ const unsigned int SIZE_TABLE_INDEX_INFO_BRAND = ( sizeof(TABLE_INDEX_INFO_BRAND ) / sizeof( TABLE_INDEX_INFO ) );
+ const unsigned int SIZE_TABLE_INDEX_INFO_GRADE_A = ( sizeof(TABLE_INDEX_INFO_GRADE_A ) / sizeof( TABLE_INDEX_INFO ) );
+ const unsigned int SIZE_TABLE_INDEX_INFO_GRADE_B = ( sizeof(TABLE_INDEX_INFO_GRADE_B ) / sizeof( TABLE_INDEX_INFO ) );
+ const unsigned int SIZE_TABLE_INDEX_INFO_DESTINATION = ( sizeof(TABLE_INDEX_INFO_DESTINATION) / sizeof( TABLE_INDEX_INFO ) );
+
+ /* ====================================================================== */
+ /* Variable declarations */
+ /* ====================================================================== */
+ u_int8_t result = FUNCTION_CHECK_RESULT_UNKNOWN;
+
+ VP_FCCR_BOOL isMultipleCountry = B_FALSE;
+
+ unsigned int idx_dest = 0;
+ unsigned int idx_brand = 0;
+ unsigned int idx_grade = 0;
+
+ char VP_destination[ VP_MAX_LENGTH ];
+ char VP_brand[ VP_MAX_LENGTH ];
+ char VP_grade[ VP_MAX_LENGTH ];
+
+ /* ====================================================================== */
+ /* Static assertion */
+ /* ====================================================================== */
+ /* The following are expected to be identical */
+ VP_DEBUG_STATIC_ASSERT( SIZE_TABLE_INDEX_INFO_BRAND == VP_FUNC_TABLE_BRAND_INDEX_MAX )
+ VP_DEBUG_STATIC_ASSERT( SIZE_TABLE_INDEX_INFO_GRADE_A == VP_FUNC_TABLE_GRADE_A_INDEX_MAX )
+
+ /* Country code does not match because there are multiple countries. */
+ VP_DEBUG_STATIC_ASSERT( VP_FUNC_TABLE_DEST_INDEX_MAX > SIZE_TABLE_INDEX_INFO_DESTINATION )
+
+ /* ====================================================================== */
+ /* Process */
+ /* ====================================================================== */
+
+ /* Argument check */
+ if ( VP_FUNC_TABLE_FUNC_TYPE_INDEX_MAX <= idx_func )
+ {
+ DEBUG_PRINTF( "ERROR : tebale index overed idx_func = %d\n", idx_func )
+
+ // Return unknown if the table size is exceeded. (However, this function can be called only from the API at the moment.)
+ result = FUNCTION_CHECK_RESULT_UNKNOWN;
+ }
+ else
+ {
+
+ /* Get vehicle parameter */
+ VP_GetEnv( VP__CWORD31__DESTINATION, &(VP_destination[0]) );
+ VP_GetEnv( VEHICLEPARAMETERLIBRARY_BRAND , &(VP_brand[0]) );
+ VP_GetEnv( VP_VEHICLEPARAMETERLIBRARY_GRADE , &(VP_grade[0]) );
+
+ DEBUG_PRINTF( "VP_destination = %s\n", VP_destination )
+
+ /* Append NULL at the end just in case. (so as not to cause any problems using the strlen or regcomp later) */
+ VP_destination[ VP_MAX_LENGTH - 1 ] = '\0';
+ VP_brand[ VP_MAX_LENGTH - 1 ] = '\0';
+ VP_grade[ VP_MAX_LENGTH - 1 ] = '\0';
+
+ /* Check if the country code is NULL */
+ if ( VP_destination[0] == '\0' )
+ {
+ /* If NULL, set the index for the country code of the US. */
+ idx_dest = VP_FUNC_TABLE_DEST_INDEX_A;
+ DEBUG_PRINTF( "[debug]idx_dest = %d\n", idx_dest )
+ }
+ else
+ {
+ /* Check whether it is a member (multiple countries) */
+ isMultipleCountry = hasMultipleCoutnry( &(VP_destination[0]), &(MULTIPLE_COUNTRY_CODE_DESIG[0]) );
+
+ /* Get the index for a country code */
+ if ( B_TRUE == isMultipleCountry )
+ {
+ /* If it is dependent (multiple countries), set the index for the country code of the dependent */
+ DEBUG_PRINT( "isMultipleCountry = TRUE" )
+
+ idx_dest = VP_FUNC_TABLE_DEST_INDEX_B;
+ }
+ else
+ {
+ /* If it is not dependent (multiple countries), it searches the translation table and sets the index. */
+ DEBUG_PRINT( "isMultipleCountry = FALSE" )
+
+ idx_dest = getIndexOfTable( &(VP_destination[0]), &(TABLE_INDEX_INFO_DESTINATION[0]), SIZE_TABLE_INDEX_INFO_DESTINATION, DEFAULT_TABLE_INDEX_DEST );
+ }
+ }
+ DEBUG_PRINTF( "idx_dest = %d\n", idx_dest )
+
+ /* Get brand index */
+ idx_brand = getIndexOfTable( &(VP_brand[0]) , &(TABLE_INDEX_INFO_BRAND[0]) , SIZE_TABLE_INDEX_INFO_BRAND , DEFAULT_TABLE_INDEX_BRAND );
+
+ /*
+ * Get grade index
+ * Setting Defaults for each brand
+ * e.g. The default is A, so if it is not B, it is determined to be A.
+ */
+ if ( VP_FUNC_TABLE_BRAND_B == idx_brand )
+ {
+ DEBUG_PRINT( "idx_brand = B")
+
+ idx_grade = getIndexOfTable( &(VP_grade[0]) , &(TABLE_INDEX_INFO_GRADE_B[0]) , SIZE_TABLE_INDEX_INFO_GRADE_B , DEFAULT_TABLE_INDEX_GRADE_B );
+
+ /* Table access */
+ result = VP_FUNC_CHECK_CANRCV_TABLE_B[idx_dest][idx_grade][idx_func];
+
+ }
+ else
+ {
+ DEBUG_PRINT( "idx_brand = A")
+
+ idx_grade = getIndexOfTable( &(VP_grade[0]) , &(TABLE_INDEX_INFO_GRADE_A[0]) , SIZE_TABLE_INDEX_INFO_GRADE_A , DEFAULT_TABLE_INDEX_GRADE_A );
+
+ /* Table access */
+ result = VP_FUNC_CHECK_CANRCV_TABLE_A[idx_dest][idx_grade][idx_func];
+
+ }
+
+ //DEBUG_PRINTF( "RESULT = %d\n", result )
+ }
+
+ return result;
+}
+
+
+/* ====================================================================== */
+/**
+ * @brief Feature-Table Index Translation Function
+ * @detials Internal-use functions. It is translate the feature definition number to an index for the table.
+ * @param[in] Feature name defined by the func define
+ * @return The table index corresponding to the feature. If the given country code is invalid, return the index given by default_idx
+ */
+ /* ====================================================================== */
+MT_STATIC unsigned int getIndexOfFunc( u_int8_t func )
+{
+ /* ====================================================================== */
+ /* Internal table definitions */
+ /* ====================================================================== */
+ /** Index translation table for feature table (Features) */
+ const VP_FUNC_TABLE_FUNC_TYPE GET_INDEX_OF_FUNC[] = {
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN , //#define VP_FUNCCHECK_CANRCV_UNKNOWN ((u_int8_t)0) /* Unknown Features */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_XM_AUDIO , //#define XM_AUDIO ((u_int8_t)1) /* XM Audio */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_VP_CANRCV__CWORD27_ , //#define _CWORD27_ ((u_int8_t)3) /* _CWORD27_ */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_HOTSPOT , //#define WIFI_HOTSPOT ((u_int8_t)4) /* WiFi HotSpot */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_RESTRICT_FUNCTION , //#define AREA1_STD_TRAF_LIMIT ((u_int8_t)5) /* Standard Travel Restriction of AREA1 */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_HD_DATA , //#define HD_DATA ((u_int8_t)6) /* HD Data (Include traffic) */
+ VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_5G //#define WIFI_5G ((u_int8_t)7) /* WiFi 5G */
+
+ };
+
+
+ /* ====================================================================== */
+ /* Variable declarations */
+ /* ====================================================================== */
+ const unsigned int index_table_size = sizeof( GET_INDEX_OF_FUNC ) / sizeof( VP_FUNC_TABLE_FUNC_TYPE );
+
+ u_int8_t table_index = VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN;
+
+ /* ====================================================================== */
+ /* Static assertions */
+ /* ====================================================================== */
+ /* In the current configuration, the feature's defined value and index match, so the translation table size should also match (remove this assertion if there is no match) */
+ VP_DEBUG_STATIC_ASSERT( index_table_size == VP_FUNC_TABLE_FUNCTION_INDEX_MAX )
+
+ /* Translation tables or the enumeration pair (VP_FUNC_TABLE_FUNC_TYPE) must also be modified when the definition value changes.
+ It may also be changed, added, or deleted following asserts as appropriate according to the defined value. */
+ VP_DEBUG_STATIC_ASSERT( XM_AUDIO == VP_FUNC_TABLE_FUNC_TYPE_INDEX_XM_AUDIO )
+
+ VP_DEBUG_STATIC_ASSERT( VP_CANRCV__CWORD27_ == VP_FUNC_TABLE_FUNC_TYPE_INDEX_VP_CANRCV__CWORD27_ )
+ VP_DEBUG_STATIC_ASSERT( WIFI_HOTSPOT == VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_HOTSPOT )
+ VP_DEBUG_STATIC_ASSERT( AREA1_STD_TRAF_LIMIT == VP_FUNC_TABLE_FUNC_TYPE_INDEX_RESTRICT_FUNCTION )
+ VP_DEBUG_STATIC_ASSERT( HD_DATA == VP_FUNC_TABLE_FUNC_TYPE_INDEX_HD_DATA )
+ VP_DEBUG_STATIC_ASSERT( WIFI_5G == VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_5G )
+
+
+ /* ====================================================================== */
+ /* Process */
+ /* ====================================================================== */
+
+ /* Argument check: Treat as unknown feature if it is larger than index translation table */
+ if ( index_table_size <= func )
+ {
+ table_index = VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN;
+ }
+ else
+ {
+ table_index = (u_int8_t)(GET_INDEX_OF_FUNC[func]);
+ }
+
+ return table_index;
+
+}
+
+/* ====================================================================== */
+/**
+ * @brief Vehicle parameter string to integer conversion function
+ * @detials Internal-use function. Convert the given string (vehicle parameter) into an index for the table.
+ * The value gotten using VP_GetEnv() is assumed. Thus, the maximum length is VP_MAX_LENGTH.
+ * Return the value set in default_index if the conversion is failed.
+ * @param[in] vp_param_str String as source of convetion to the table index
+ * @param[in] table_index_info String corresponding to table index and an array of structs with table indexes set
+ * @param[in] info_size Size of the table_index_info array
+ * @param[in] default_index Default index. Return this value if none of table_index_info matches
+ * @return The table index corresponding to the vehicle parameter string given by the argument. Return the value given by the default_index argument if the given country code is invalid.
+ */
+ /* ====================================================================== */
+MT_STATIC unsigned int getIndexOfTable( const char vp_param_str[], const TABLE_INDEX_INFO table_index_info[], unsigned int info_size, unsigned int default_index )
+{
+ unsigned int table_index = 0;
+
+ table_index = default_index; /* Set as initial value so that it can return the set default if it is unknown */
+
+ //DEBUG_PRINTF("info_size = %d\n", info_size)
+
+ /* NULL checking */
+ if ( NULL != vp_param_str )
+ {
+ if ( NULL != table_index_info )
+ {
+ unsigned int i = 0;
+
+ for ( i = 0; i < info_size; i++ )
+ {
+ if ( RET_STD_LIB_STRING_STR_CMP_OK == strncmp( &(vp_param_str[0]), &((table_index_info[i]).code_str[0]), VP_MAX_LENGTH ) )
+ {
+ table_index = (table_index_info[i]).index;
+
+ break;
+ }
+ }
+ }
+ else
+ {
+ DEBUG_PRINT( "ERROR!! the Bad Teble overd." )
+ }
+ }
+
+ return table_index;
+}
+
+/* ====================================================================== */
+/**
+ * @brief Function to check whether country code is multiple countries or not
+ * @detials Internal-use functions. Check if the country code given in the argument contains more than one country.
+ * The determination whether multiple country code or not shall be true if it exactly matches the specified
+ * regular expression which is a characteristic of multiple countries.
+ * The exact match determination shall be the exact match if the length of the matched character matches
+ * the length of the character passed in the argument.
+ * @param[in] dest_str Country code string. The value gotten using VP_GetEnv() is assumed. Therefore, the maximum length is VP_MAX_LENGTH.
+ * @param[in] multiple_country_code_desig String for determining multiple country codes. Regular expression strings if a regular expression library is used. Otherwise, a single-character string representing the delimiter.
+ * If it gets trapped inside a function, it will have to stub the regcomp during function unit tests, which is very cumbersome and can be removed as arguments.
+ * @return True if country code indicates multiple countries, otherwise false
+ */
+/* ====================================================================== */
+MT_STATIC VP_FCCR_BOOL hasMultipleCoutnry( const char dest_str[], const char multiple_country_code_desig[] )
+{
+ /* ====================================================================== */
+ /* Variable declarations */
+ /* ====================================================================== */
+ VP_FCCR_BOOL isMultiple = B_FALSE;
+
+ /* ====================================================================== */
+ /* Processing */
+ /* ====================================================================== */
+
+ /* NULL checking for arguments */
+ if ( ( NULL != dest_str ) && ( NULL != multiple_country_code_desig ) )
+ {
+ regex_t preg;
+
+ if ( 0 == regcomp( &preg, multiple_country_code_desig, REG_EXTENDED ) )
+ {
+ regmatch_t pmatch = { 0, 0 };
+
+ if ( REG_NOMATCH != regexec( &preg, &(dest_str[0]), 1, &pmatch, 0) )
+ {
+ /** @note Exactly match is considered if the end-of-match offset matches the string length.
+ * Assumed that it should not be used as the end-of-line character so that "$" is not included in the C base character set.
+ */
+ if ( (strnlen( dest_str, VP_MAX_LENGTH ) == (unsigned int)(pmatch.rm_eo) ) )
+ {
+ isMultiple = B_TRUE;
+ }
+ else
+ {
+ isMultiple = B_FALSE;
+ }
+
+ DEBUG_PRINT( "FOUND" )
+ }
+ else
+ {
+ isMultiple = B_FALSE;
+
+ DEBUG_PRINT( "NOT FOUND" )
+ }
+
+ regfree( &preg );
+ }
+ else
+ {
+ /* In the case of a library error,
+ * return false so that the default value that is set by high layer works.
+ */
+
+ /** @todo Should output using FRAMEWORKUNIFIEDLOG for library errors? */
+ isMultiple = B_FALSE;
+
+ DEBUG_PRINT( "FOUND" )
+ }
+ }
+
+ return isMultiple;
+
+}
+#endif
diff --git a/video_in_hal/otherservice/vehicle_parameter_library/library/src/VP_GetEnv.c b/video_in_hal/otherservice/vehicle_parameter_library/library/src/VP_GetEnv.c
new file mode 100755
index 0000000..c6cd6a7
--- /dev/null
+++ b/video_in_hal/otherservice/vehicle_parameter_library/library/src/VP_GetEnv.c
@@ -0,0 +1,291 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* ====================================================================== */
+/**
+ * @file VP_GetEnv.c
+ * @brief API to get vehicle parameter environment variable
+ */
+/* ====================================================================== */
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+#include <other_service/VP_GetEnv.h>
+#include <native_service/ns_backup.h>
+#include <native_service/ns_backup_id.h>
+
+#include "VP_FuncCheck_CanRcv_private.h"
+
+// copy from vpsvc.h
+#define VPSVC_COUNTRY_MAX (0x10) // Maximal number of country codes for 1 destination
+
+// copy from VehicleSens_Vpupdate.cpp
+
+#define VP_VEHICLEPARAMETERLIBRARY_DEST_LEN_MIN 5 // At least 5 characters for 1 destination(e.g. "I:104")
+#define VP_VEHICLEPARAMETERLIBRARY_DEST_NUM_MAX (VP_MAX_LENGTH/VP_VEHICLEPARAMETERLIBRARY_DEST_LEN_MIN)
+#define DS_PACK2_LEN_MAX 2+1 // Max. digits of destination package 2(+\0)
+
+typedef struct {
+ char dest_bdb[2]; // Destination symbol
+ char ds_pack2[DS_PACK2_LEN_MAX]; // Destination package 2
+ uint8_t coutry_num; // Number of Country Codes
+ uint16_t country_no[VPSVC_COUNTRY_MAX]; // Country Code
+} VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE_t;
+
+VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE_t g_vp_vehicleparameterlibrary_dest[VP_VEHICLEPARAMETERLIBRARY_DEST_NUM_MAX]; // Destination information get from environment variables
+static uint32_t g_vp_vehicleparameterlibrary_dest_num; // Number of destination information get from environment variables
+
+static void AnalyzeVpVehicleparameterlibraryDestEnv(void) {
+ char p_env_variable[VP_MAX_LENGTH] = {};
+ char dest_buf[VP_MAX_LENGTH] = { 0 }; // Destination data for environment variables
+ char *c_code_ascii; // Country Code(ASCII)
+ char *dest_bdb_buf; // Destination symbol
+ uint32_t dest_num = 0; // Number of destinations
+ int country_num = 0; // Number of Country Codes per Destination
+ char *token1, *saveptr1; // Destination break token
+ char *token2, *saveptr2; // Delimiter tokens in each destination
+ VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE_t *p_dest;
+ uint16_t *p_country;
+
+ g_vp_vehicleparameterlibrary_dest_num = 0;
+ memset(&g_vp_vehicleparameterlibrary_dest, 0x00, sizeof(VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE_t));
+
+ // Get environment variables
+ VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE, p_env_variable);
+ if (0 == strncmp(p_env_variable, "", VP_MAX_LENGTH)) {
+ DEBUG_PRINT("VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE is NULL");
+ return;
+ }
+
+ DEBUG_PRINTF("VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE=[%s]\n", p_env_variable);
+
+ // Begin analysis First, separate with ","
+ token1 = strtok_r(p_env_variable, ",", &saveptr1);
+ while (token1 != NULL) {
+ snprintf(dest_buf, VP_MAX_LENGTH, "%s", token1);
+ DEBUG_PRINTF("dest_buf\t[%s]", dest_buf);
+ p_dest = &g_vp_vehicleparameterlibrary_dest[dest_num];
+
+ // Get the country code 000-999
+ country_num = 0;
+ c_code_ascii = strchr(dest_buf, (int32_t)(':'));
+ if (c_code_ascii != NULL) {
+ c_code_ascii += 1;
+ token2 = strtok_r(c_code_ascii, "/", &saveptr2);
+ while (token2 != NULL) {
+ p_country = &(p_dest->country_no[country_num]);
+ errno = 0;
+ long int val = strtol(token2, (char **)NULL, 10);
+ if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN))
+ || (errno != 0 && val == 0)) {
+ DEBUG_PRINTF("country No format error [%s]", token2);
+ return;
+ }
+ *p_country = (uint16_t)val;
+
+ if (country_num >= VPSVC_COUNTRY_MAX) {
+ DEBUG_PRINTF("country num over [%s]", token2);
+ return;
+ }
+ country_num++;
+ token2 = strtok_r(NULL, "/", &saveptr2);
+ }
+ p_dest->coutry_num = (uint8_t)(country_num);
+ DEBUG_PRINTF("country_num\t[%d]", country_num);
+ }
+
+ // Get destination symbol (may not be available)
+ dest_bdb_buf = strchr(dest_buf, (int32_t)('&'));
+ if (dest_bdb_buf != NULL) {
+ p_dest->dest_bdb[0] = *(dest_bdb_buf + 1);
+ DEBUG_PRINTF("dest_bdb\t[%s]", p_dest->dest_bdb);
+ } else {
+ DEBUG_PRINT("dest_bdb is noting");
+ }
+
+ // Get destination packages
+ token2 = strtok_r(dest_buf, "&:", &saveptr2);
+ snprintf(p_dest->ds_pack2, DS_PACK2_LEN_MAX, "%s", token2);
+ DEBUG_PRINTF("ds_pack2\t[%s]\n", p_dest->ds_pack2);
+
+ dest_num++;
+ token1 = strtok_r(NULL, ",", &saveptr1);
+ }
+
+ g_vp_vehicleparameterlibrary_dest_num = dest_num;
+}
+
+// based VP_DspackToCountryCode
+// dest [in] Destination codes read from the bkup_manager
+// country_code [out] Country code string, separated by ";" for multi-country codes
+static BOOL VP_DspackToCountryCode(uint8_t* dest, char *country_code) {
+ BOOL ret = FALSE;
+ VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE_t *p;
+ typedef struct {
+ char dest_bdb[2]; // Destination symbol
+ char ds_pack2[DS_PACK2_LEN_MAX]; // Destination package 2
+ } VEHICLE_CAN_DEST_t;
+ VEHICLE_CAN_DEST_t can_dest = {};
+
+ AnalyzeVpVehicleparameterlibraryDestEnv();
+
+ // Setting CAN data
+ can_dest.dest_bdb[0] = (int8_t)dest[0]; // Get destination symbol
+
+ if (isalpha(dest[2]) != 0) { // Get destination packages
+ can_dest.ds_pack2[0] = (int8_t)dest[2];
+ } else {
+ DEBUG_PRINTF("ds_pack2 is neither Alpha character[%c]", (int32_t)dest[2]);
+ return ret;
+ }
+
+ // Comparison with vehicle parameter
+ for (uint32_t i = 0; i < g_vp_vehicleparameterlibrary_dest_num; i++) {
+ p = &g_vp_vehicleparameterlibrary_dest[i];
+ // Determination of destination packages
+ if (strncmp(p->ds_pack2, can_dest.ds_pack2, sizeof(can_dest.ds_pack2)) != 0) {
+ continue;
+ }
+
+ // Determination of destination symbol
+ if (p->dest_bdb[0] == 0) {
+ ret = TRUE; // When the destination code judgment is not required
+ break;
+ }
+
+ if (strncmp(p->dest_bdb, can_dest.dest_bdb, sizeof(can_dest.dest_bdb)) == 0) {
+ ret = TRUE;
+ break;
+ }
+ }
+
+ // Returned as a country code string
+ if (ret == TRUE) {
+ snprintf(country_code, VP_MAX_LENGTH, "%03d", p->country_no[0]);
+ for (uint32_t i = 1; i < p->coutry_num; i++) {
+ char buf[VP_MAX_LENGTH] = {};
+ snprintf(buf, VP_MAX_LENGTH, "%s;%03d", country_code, p->country_no[i]);
+ strncpy(country_code, buf, VP_MAX_LENGTH);
+ }
+ }
+ return ret;
+}
+// end of copy from VehicleSens_Vpupdate.cpp
+
+// copy from vehicle unit
+typedef struct {
+ uint8_t uc_hv; /* hv */
+ uint8_t uc_hv_status; /* hv status */
+ uint8_t uc_2wd4wd; /* 2wd4wd */
+ uint8_t uc_2wd4wd_status; /* 2wd4wd status */
+ uint8_t uc_dest[3]; /* Destination */
+ uint8_t uc_dest_status; /* Destination status */
+ uint8_t uc_stwheel; /* STEERING_WHEEL */
+ uint8_t uc_stwheel_status; /* STEERING_WHEEL status */
+ uint8_t uc_reserve[6]; /* Reserve */
+} VEHICLESENS_NON_VOLATILE_DATA;
+
+/* ====================================================================== */
+/**
+ * @fn
+ * void VP_GetVp_CWORD31_Destination(char *pEnvBuff)
+ * @breaf Get environment variables
+ * @param[out] (pEnvBuff) Start address of the area to store the get environment variable value
+ * @return None
+ * @detail Read and analyze D_BK_ID_VEHICLE_STABLE_DATA from BackupManager.
+ * The country code string is stored in the argument and returned.
+ */
+/* ====================================================================== */
+static void VP_GetVp_CWORD31_Destination(char *pEnvBuff)
+{
+ int32_t ret_api = BKUP_RET_NORMAL;
+ VEHICLESENS_NON_VOLATILE_DATA pstback_up_data;
+ memset(&pstback_up_data, 0x00, sizeof(VEHICLESENS_NON_VOLATILE_DATA));
+ char env_string[VP_MAX_LENGTH];
+
+ VP_GetEnv(VP__CWORD31__TELEMATICS_FUNCTION, env_string);
+
+ if ('\0' == env_string[0]) {
+ *pEnvBuff = '\0';
+ return;
+ } else {
+ // read from backup
+ ret_api = Backup_DataRd(D_BK_ID_VEHICLE_STABLE_DATA,
+ 0,
+ &pstback_up_data,
+ sizeof(VEHICLESENS_NON_VOLATILE_DATA));
+ if (BKUP_RET_NORMAL != ret_api) {
+ *pEnvBuff = '\0';
+ return;
+ }
+ }
+
+ if (0 == strncmp(env_string, "country_ID", strlen("country_ID"))) {
+ uint32_t country_code = 0;
+ country_code += (pstback_up_data.uc_dest[1]); // countory_code 3rd and 2nd digit
+ country_code = (country_code << 4); // shift
+ country_code += (pstback_up_data.uc_dest[2] >> 4); // countory_code 1st digit
+ snprintf(pEnvBuff, VP_MAX_LENGTH, "%x", country_code);
+ } else if(0 == strncmp(env_string, "CAN_judge", strlen("CAN_judge"))) {
+ VP_DspackToCountryCode(pstback_up_data.uc_dest, pEnvBuff);
+ } else {
+ *pEnvBuff = '\0';
+ }
+}
+
+/* ====================================================================== */
+/**
+ * @fn
+ * void VP_GetEnv(char *pEnvStr, char *pEnvBuff )
+ * @breaf Get Environment Variable
+ * @param[in] (pEnvStr) Pointer to the string of the environment variable name to be gotten
+ * @param[out] (pEnvBuff) Start address of the area to store the gotten value of the environment variable
+ * @return None
+ * @detail Read the value (string) of the environment variable specified by the argument and stores it in the specified address.
+ */
+/* ====================================================================== */
+void VP_GetEnv(const char *pEnvStr, char *pEnvBuff )
+{
+ const char *env_string;
+ size_t length;
+
+ if ((pEnvStr != NULL) && (pEnvBuff != NULL)) {
+ if (0 == strncmp(pEnvStr, VP__CWORD31__DESTINATION, strlen(VP__CWORD31__DESTINATION))) {
+ VP_GetVp_CWORD31_Destination(pEnvBuff);
+ } else {
+ env_string = getenv(pEnvStr);
+
+ if (env_string == NULL) {
+ *pEnvBuff = '\0';
+ } else {
+ length = strlen( env_string );
+ if (length < ((size_t)VP_MAX_LENGTH)) {
+ (void)strcpy(pEnvBuff, env_string);
+ } else {
+ (void)strncpy(pEnvBuff, env_string, (VP_MAX_LENGTH - 1));
+ pEnvBuff[ VP_MAX_LENGTH - 1 ] = '\0';
+ }
+ }
+ }
+ } else {
+ if(pEnvBuff != NULL) {
+ *pEnvBuff = '\0';
+ }
+ }
+}
diff --git a/video_in_hal/peripheralservice/.gitattributes b/video_in_hal/peripheralservice/.gitattributes
new file mode 100755
index 0000000..445b3c2
--- /dev/null
+++ b/video_in_hal/peripheralservice/.gitattributes
@@ -0,0 +1,128 @@
+*.doc filter=lfs diff=lfs merge=lfs -text
+*.docx filter=lfs diff=lfs merge=lfs -text
+*.pdf filter=lfs diff=lfs merge=lfs -text
+*.ppt filter=lfs diff=lfs merge=lfs -text
+*.pptx filter=lfs diff=lfs merge=lfs -text
+*.vsd filter=lfs diff=lfs merge=lfs -text
+*.xls filter=lfs diff=lfs merge=lfs -text
+*.xlsm filter=lfs diff=lfs merge=lfs -text
+*.xlsx filter=lfs diff=lfs merge=lfs -text
+*.doC filter=lfs diff=lfs merge=lfs -text
+*.dOc filter=lfs diff=lfs merge=lfs -text
+*.dOC filter=lfs diff=lfs merge=lfs -text
+*.Doc filter=lfs diff=lfs merge=lfs -text
+*.DoC filter=lfs diff=lfs merge=lfs -text
+*.DOc filter=lfs diff=lfs merge=lfs -text
+*.DOC filter=lfs diff=lfs merge=lfs -text
+*.docX filter=lfs diff=lfs merge=lfs -text
+*.doCx filter=lfs diff=lfs merge=lfs -text
+*.doCX filter=lfs diff=lfs merge=lfs -text
+*.dOcx filter=lfs diff=lfs merge=lfs -text
+*.dOcX filter=lfs diff=lfs merge=lfs -text
+*.dOCx filter=lfs diff=lfs merge=lfs -text
+*.dOCX filter=lfs diff=lfs merge=lfs -text
+*.Docx filter=lfs diff=lfs merge=lfs -text
+*.DocX filter=lfs diff=lfs merge=lfs -text
+*.DoCx filter=lfs diff=lfs merge=lfs -text
+*.DoCX filter=lfs diff=lfs merge=lfs -text
+*.DOcx filter=lfs diff=lfs merge=lfs -text
+*.DOcX filter=lfs diff=lfs merge=lfs -text
+*.DOCx filter=lfs diff=lfs merge=lfs -text
+*.DOCX filter=lfs diff=lfs merge=lfs -text
+*.pdF filter=lfs diff=lfs merge=lfs -text
+*.pDf filter=lfs diff=lfs merge=lfs -text
+*.pDF filter=lfs diff=lfs merge=lfs -text
+*.Pdf filter=lfs diff=lfs merge=lfs -text
+*.PdF filter=lfs diff=lfs merge=lfs -text
+*.PDf filter=lfs diff=lfs merge=lfs -text
+*.PDF filter=lfs diff=lfs merge=lfs -text
+*.ppT filter=lfs diff=lfs merge=lfs -text
+*.pPt filter=lfs diff=lfs merge=lfs -text
+*.pPT filter=lfs diff=lfs merge=lfs -text
+*.Ppt filter=lfs diff=lfs merge=lfs -text
+*.PpT filter=lfs diff=lfs merge=lfs -text
+*.PPt filter=lfs diff=lfs merge=lfs -text
+*.PPT filter=lfs diff=lfs merge=lfs -text
+*.pptX filter=lfs diff=lfs merge=lfs -text
+*.ppTx filter=lfs diff=lfs merge=lfs -text
+*.ppTX filter=lfs diff=lfs merge=lfs -text
+*.pPtx filter=lfs diff=lfs merge=lfs -text
+*.pPtX filter=lfs diff=lfs merge=lfs -text
+*.pPTx filter=lfs diff=lfs merge=lfs -text
+*.pPTX filter=lfs diff=lfs merge=lfs -text
+*.Pptx filter=lfs diff=lfs merge=lfs -text
+*.PptX filter=lfs diff=lfs merge=lfs -text
+*.PpTx filter=lfs diff=lfs merge=lfs -text
+*.PpTX filter=lfs diff=lfs merge=lfs -text
+*.PPtx filter=lfs diff=lfs merge=lfs -text
+*.PPtX filter=lfs diff=lfs merge=lfs -text
+*.PPTx filter=lfs diff=lfs merge=lfs -text
+*.PPTX filter=lfs diff=lfs merge=lfs -text
+*.vsD filter=lfs diff=lfs merge=lfs -text
+*.vSd filter=lfs diff=lfs merge=lfs -text
+*.vSD filter=lfs diff=lfs merge=lfs -text
+*.Vsd filter=lfs diff=lfs merge=lfs -text
+*.VsD filter=lfs diff=lfs merge=lfs -text
+*.VSd filter=lfs diff=lfs merge=lfs -text
+*.VSD filter=lfs diff=lfs merge=lfs -text
+*.xlS filter=lfs diff=lfs merge=lfs -text
+*.xLs filter=lfs diff=lfs merge=lfs -text
+*.xLS filter=lfs diff=lfs merge=lfs -text
+*.Xls filter=lfs diff=lfs merge=lfs -text
+*.XlS filter=lfs diff=lfs merge=lfs -text
+*.XLs filter=lfs diff=lfs merge=lfs -text
+*.XLS filter=lfs diff=lfs merge=lfs -text
+*.xlsM filter=lfs diff=lfs merge=lfs -text
+*.xlSm filter=lfs diff=lfs merge=lfs -text
+*.xlSM filter=lfs diff=lfs merge=lfs -text
+*.xLsm filter=lfs diff=lfs merge=lfs -text
+*.xLsM filter=lfs diff=lfs merge=lfs -text
+*.xLSm filter=lfs diff=lfs merge=lfs -text
+*.xLSM filter=lfs diff=lfs merge=lfs -text
+*.Xlsm filter=lfs diff=lfs merge=lfs -text
+*.XlsM filter=lfs diff=lfs merge=lfs -text
+*.XlSm filter=lfs diff=lfs merge=lfs -text
+*.XlSM filter=lfs diff=lfs merge=lfs -text
+*.XLsm filter=lfs diff=lfs merge=lfs -text
+*.XLsM filter=lfs diff=lfs merge=lfs -text
+*.XLSm filter=lfs diff=lfs merge=lfs -text
+*.XLSM filter=lfs diff=lfs merge=lfs -text
+*.xlsX filter=lfs diff=lfs merge=lfs -text
+*.xlSx filter=lfs diff=lfs merge=lfs -text
+*.xlSX filter=lfs diff=lfs merge=lfs -text
+*.xLsx filter=lfs diff=lfs merge=lfs -text
+*.xLsX filter=lfs diff=lfs merge=lfs -text
+*.xLSx filter=lfs diff=lfs merge=lfs -text
+*.xLSX filter=lfs diff=lfs merge=lfs -text
+*.Xlsx filter=lfs diff=lfs merge=lfs -text
+*.XlsX filter=lfs diff=lfs merge=lfs -text
+*.XlSx filter=lfs diff=lfs merge=lfs -text
+*.XlSX filter=lfs diff=lfs merge=lfs -text
+*.XLsx filter=lfs diff=lfs merge=lfs -text
+*.XLsX filter=lfs diff=lfs merge=lfs -text
+*.XLSx filter=lfs diff=lfs merge=lfs -text
+*.XLSX filter=lfs diff=lfs merge=lfs -text
+*.json filter=lfs diff=lfs merge=lfs -text
+*.jsoN filter=lfs diff=lfs merge=lfs -text
+*.jsOn filter=lfs diff=lfs merge=lfs -text
+*.jsON filter=lfs diff=lfs merge=lfs -text
+*.jSon filter=lfs diff=lfs merge=lfs -text
+*.jSoN filter=lfs diff=lfs merge=lfs -text
+*.jSOn filter=lfs diff=lfs merge=lfs -text
+*.jSON filter=lfs diff=lfs merge=lfs -text
+*.Json filter=lfs diff=lfs merge=lfs -text
+*.JsoN filter=lfs diff=lfs merge=lfs -text
+*.JsOn filter=lfs diff=lfs merge=lfs -text
+*.JsON filter=lfs diff=lfs merge=lfs -text
+*.JSon filter=lfs diff=lfs merge=lfs -text
+*.JSoN filter=lfs diff=lfs merge=lfs -text
+*.JSOn filter=lfs diff=lfs merge=lfs -text
+*.JSON filter=lfs diff=lfs merge=lfs -text
+*.ods filter=lfs diff=lfs merge=lfs -text
+*.odS filter=lfs diff=lfs merge=lfs -text
+*.oDs filter=lfs diff=lfs merge=lfs -text
+*.oDS filter=lfs diff=lfs merge=lfs -text
+*.Ods filter=lfs diff=lfs merge=lfs -text
+*.OdS filter=lfs diff=lfs merge=lfs -text
+*.ODs filter=lfs diff=lfs merge=lfs -text
+*.ODS filter=lfs diff=lfs merge=lfs -text
diff --git a/video_in_hal/peripheralservice/communication/LICENSE b/video_in_hal/peripheralservice/communication/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/peripheralservice/communication/Makefile.client b/video_in_hal/peripheralservice/communication/Makefile.client
new file mode 100755
index 0000000..8d25486
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/Makefile.client
@@ -0,0 +1,18 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+SUBDIRS = client_can
+
+include ../peripheral_service.mk
diff --git a/video_in_hal/peripheralservice/communication/Makefile.server b/video_in_hal/peripheralservice/communication/Makefile.server
new file mode 100755
index 0000000..6ebcc1a
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/Makefile.server
@@ -0,0 +1,18 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+SUBDIRS = server
+
+include ../peripheral_service.mk
diff --git a/video_in_hal/peripheralservice/communication/client_can/Makefile b/video_in_hal/peripheralservice/communication/client_can/Makefile
new file mode 100755
index 0000000..49d5708
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/client_can/Makefile
@@ -0,0 +1,72 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+#INST_PROGS =
+
+######### installed library(*.a) #############
+#INST_LIBS =
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libCAN_API
+
+######### install unit representative headers(*.h) #############
+VPATH += ../server/include/$(COMPONENT_NAME)
+INST_HEADERS += communication_notifications.h communication.h ps_services.h
+
+######### install headers(*.h) #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += Canif_API.h communication_can.h
+
+######### compiled sources #############
+libCAN_API_SRCS += Canif_API.cpp
+
+######### add source path #############
+VPATH += ./src
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./../client_lan/include/
+CPPFLAGS += -I./../server/include
+CPPFLAGS += -I./../server/include/private
+CPPFLAGS += -I./../server/include/CAN/TxMsg
+CPPFLAGS += -I./../server/include/CAN/main
+CPPFLAGS += -I./../server/include/main
+CPPFLAGS += -I./../server/include/threads
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC -fdata-sections -ffunction-sections -DFLG_CORE
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### add library path #############
+LDFLAGS += -Wl,-M -Wl,--gc-sections
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### linked library (static) #############
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lrt
+
+include ../../peripheral_service.mk
diff --git a/video_in_hal/peripheralservice/communication/client_can/include/API_Local_Common.h b/video_in_hal/peripheralservice/communication/client_can/include/API_Local_Common.h
new file mode 100755
index 0000000..c5e3f78
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/client_can/include/API_Local_Common.h
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_API_LOCAL_COMMON_H_
+#define COMMUNICATION_CLIENT_CAN_INCLUDE_API_LOCAL_COMMON_H_
+#include <string.h>
+enum CANIF_PROTOCOL_IDX {
+ CANIF_CAN = 0,
+ NUM_OF_CANIF_PROTOCOL
+};
+
+static inline const char *Canif_PidxTosname(enum CANIF_PROTOCOL_IDX idx) {
+ switch (idx) {
+ case CANIF_CAN:
+ return LAN_SERVICE_CAN;
+ break;
+ default:
+ return "Unknown";
+ break;
+ }
+}
+
+#define CANIF_NOTIFY_NAME_MAX_SIZE 15
+static inline bool Canif_CheckNotifyName(PCSTR notify_name) {
+ size_t n = CANIF_NOTIFY_NAME_MAX_SIZE + 1;
+
+ if (!notify_name)
+ return false;
+
+ return (strnlen(notify_name, n) < n);
+}
+
+static inline bool Canif_CheckNotifyNameWithoutNullCheck(PCSTR notify_name) {
+ size_t n = CANIF_NOTIFY_NAME_MAX_SIZE + 1;
+ return (strnlen(notify_name, n) < n);
+}
+
+static inline void Canif_CopyNotifyName(char *dest, PCSTR notify_name) {
+ strncpy(dest, notify_name,
+ strnlen(notify_name, CANIF_NOTIFY_NAME_MAX_SIZE));
+}
+#endif
diff --git a/video_in_hal/peripheralservice/communication/client_can/include/Canif_API_Local.h b/video_in_hal/peripheralservice/communication/client_can/include/Canif_API_Local.h
new file mode 100755
index 0000000..d17fcc5
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/client_can/include/Canif_API_Local.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_
+#define COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_
+
+#define CAN_ID_MASK_CODE 0xE0000000UL // CAN ID Mask Codes
+static inline bool Canif_CheckCanID(CANID id) {
+ if (id == 0)
+ return false;
+
+ // upper 3 bit from MSB should be 0x0
+ if ((CAN_ID_MASK_CODE & id) != 0x0)
+ return false;
+
+ return true;
+}
+
+static inline bool Canif_IsCommand(uint32_t cmd_id) {
+ switch (cmd_id) {
+ case CAN_CMDID_FUELCALC_RST_REQ_DELIVERY:
+ case CAN_CMDID_STARTUP_FIN_REQ_TX:
+ case CAN_CMDID_MRST_INFO_REQ_TX:
+ case CAN_CMDID_VERSION_REQ_TX:
+ case CAN_CMDID_CONNECTION_NODE_REQ_TX:
+ case CAN_CMDID_FUELCALC_REQ_TX:
+ return true;
+ default:
+ return false;
+ }
+}
+
+#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_
diff --git a/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData.h b/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData.h
new file mode 100755
index 0000000..e9f82ac
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_TRANSMISSIONDATA_H_
+#define COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_TRANSMISSIONDATA_H_
+
+#define LAN_TYPE_21PF "CAN_21PF"
+
+typedef struct {
+ uint8_t dlc;
+ CAN_DATA_BIT dat;
+} CAN_TRANS_START_TABLE_VAL;
+
+typedef struct {
+ CANID canid;
+ CAN_TRANS_START_TABLE_VAL val;
+} CAN_INIT_TABLE;
+
+#include "Canif_TransmissionData21PF.h"
+
+static inline bool Canif_InitDataIsDefined21PF(CANID id) {
+ int32_t count;
+ int i;
+
+ count = sizeof(Can_TransInitData_21PF) /
+ sizeof(Can_TransInitData_21PF[0]);
+ for (i = 0; i < count; i++) {
+ if (id == Can_TransInitData_21PF[i].canid)
+ return true;
+ }
+
+ return false;
+}
+
+#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_TRANSMISSIONDATA_H_
diff --git a/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData21PF.h b/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData21PF.h
new file mode 100755
index 0000000..e608ca5
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData21PF.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Following table could not be const because server will use this as R/W.
+static CAN_INIT_TABLE Can_TransInitData_21PF[] __attribute__((unused)) =
+{
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+ { 0x0000, 1, { 0x00 } },
+ { 0x0001, 1, { 0x00 } },
+ { 0x0002, 8, { 0x00 } },
+ { 0x0100, 1, { 0x00 } },
+ { 0x0101, 8, { 0x00 } },
+ { 0x0102, 8, { 0x00 } }
+};
diff --git a/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/Canif_API.h b/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/Canif_API.h
new file mode 100755
index 0000000..a68783c
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/Canif_API.h
@@ -0,0 +1,1158 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+ * FILE Canif_API.h
+ * TITLE :Data header files needed to use the CAN I/F API
+ ****************************************************************************/
+
+#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_
+#define COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_
+
+/**
+ * @file Canif_API.h
+ * @~english
+ * @brief Canif API header
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup communication
+ * @ingroup peripheral_service
+ * @{
+ */
+/** @addtogroup CAN
+ * @ingroup communication
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <asm/unistd.h>
+#include <stub/com_message_header.h>
+
+/**
+ * \~english Defination of Service name
+ */
+#define LAN_SERVICE_CAN "CAN_COM_PROT"
+
+/**
+ * \~english Availability notification of CAN
+ */
+#define NTFY_Communication_CAN_ISAVAILABLE "Communication/CanIsAvailable"
+
+/*********************************************************************
+* Defining Return Values
+***********************************************************************/
+/* Normal system */
+/**
+ * \~english Suceess
+ */
+#define CANIF_RET_NORMAL 1
+/* Abnormal system */
+/**
+ * \~english Parameter error
+ */
+#define CANIF_RET_ERROR_PARAM 2
+/**
+ * \~english Buffer Full
+ */
+#define CANIF_RET_ERROR_BUFFULL 3
+/**
+ * \~english CAN ID FULL
+ */
+#define CANIF_RET_ERROR_CANIDFULL 4
+/**
+ * \~english ID unregister
+ */
+#define CANIF_RET_ERROR_UNDEF 5
+/**
+ * \~english Thread ID unmatched
+ */
+#define CANIF_RET_ERROR_PID 6
+/**
+ * \~english Timer error
+ */
+#define CANIF_RET_ERROR_TIMER 7
+/**
+ * \~english Event Creat Error
+ */
+#define CANIF_RET_ERROR_CREATE_EVENT 8
+/**
+ * \~english Error Cancel
+ */
+#define CANIF_RET_ERROR_CANCEL 9
+/**
+ * \~english Null Pointer
+ */
+#define CANIF_RET_ERROR_NULL 10
+
+/**
+ * \~english Flags for specifiy Delivery is echoback or not.
+ */
+enum CanIfEchoBackFlags {
+ /**
+ * \~english Delivery is recv data
+ */
+ CANIF_PURERECV = 0,
+ /**
+ * \~english Delivery is echo data
+ */
+ CANIF_ECHOBACK = 1
+};
+
+/**
+ * \~english Defination of Command ID ( CAN -> user )
+ */
+typedef enum _PS_CommunicationProtocol {
+ /**
+ * \~english Delivery CAN Data
+ */
+ CID_CAN_DATA_DELIVERY = 0x0401,
+ /**
+ * \~english CAN communication stop
+ */
+ CID_CAN_COMM_STOP,
+ /**
+ * \~english CAN communication restore
+ */
+ CID_CAN_COMM_RESTORE,
+ /**
+ * \~english CAN transmission result
+ */
+ CID_CAN_TX_RESULT,
+ /**
+ * \~english Delivery CAN command
+ */
+ CID_CAN_CMD_DELIVERY,
+ /**
+ * \~english CAN command transmission result
+ */
+ CID_CAN_CMD_TX_RESULT,
+ /**
+ * \~english Delivery CAN data to CANGW
+ */
+ CID_CAN_CANGW_DELIVERY,
+} PS_CommunicationProtocol;
+
+/**
+ * \~english Defination of Command ID ( CANIF -> CAN )
+ */
+typedef enum _PS_Communication_InternalProtocol {
+ /**
+ * \~english Delivery registration of CAN data
+ */
+ CID_CANIF_DELIVERY_ENTRY = 0x0501,
+ /**
+ * \~english Delivery deregistration of CAN data
+ */
+ CID_CANIF_DELIVERY_ERASE,
+ /**
+ * \~english CAN data transmission start
+ */
+ CID_CANIF_TX_START,
+ /**
+ * \~english CAN data communication stop watching
+ */
+ CID_CANIF_COMM_WATCH,
+ /**
+ * \~english CAN command control
+ */
+ CID_CANIF_CMD_CTRL,
+ /**
+ * \~english CAN data transmission start
+ */
+ CID_CANIF_TX_BIT_START,
+} PS_Communication_InternalProtocol;
+
+/*********************************************************************
+* Definitions of CAN command IDs
+***********************************************************************/
+/**
+* \~english Request CAN fuel calculator reset
+*/
+#define CAN_CMDID_FUELCALC_RST_REQ_DELIVERY 0x00
+/**
+* \~english Request CAN startup finished notification
+*/
+#define CAN_CMDID_STARTUP_FIN_REQ_TX 0x01
+/**
+* \~english Request CAN Master reset notification
+*/
+#define CAN_CMDID_MRST_INFO_REQ_TX 0x02
+/**
+* \~english Request CAN version
+*/
+#define CAN_CMDID_VERSION_REQ_TX 0x03
+/**
+* \~english Request CAN connected node notification
+*/
+#define CAN_CMDID_CONNECTION_NODE_REQ_TX 0x04
+/**
+* \~english Request CAN BUS status notification
+* ToDo@Bus error I/F is not required when CanGetBusStatus() is deleted, so it is scheduled to be deleted.
+*/
+#define CAN_CMDID_BUS_STATUS_REQ_TX 0x05
+/**
+* \~english Response of CAN fuel calculator reset
+*/
+#define CAN_CMDID_FUELCALC_REQ_TX 0x06
+/**
+* \~english Receive CAN fuel calculator reset request
+*/
+#define CAN_CMDID_FUELCALC_RST_REQ_RX 0x07
+/**
+* \~english Receive CAN startup finished notification
+*/
+#define CAN_CMDID_STARTUP_FIN_RESP_RX 0x08
+/**
+* \~english Receive CAN Master reset notification
+*/
+#define CAN_CMDID_MRST_INFO_RESP_RX 0x09
+/**
+* \~english Response of CAN version receive
+*/
+#define CAN_CMDID_VERSION_RESP_RX 0x0A
+/**
+* \~english Response of CAN connection node receive
+*/
+#define CAN_CMDID_CONNECTION_NODE_RESP_RX 0x0B
+/**
+* \~english Response of CAN bus status receive
+* ToDo@Bus error I/F is not required when CanGetBusStatus() is deleted, so it is scheduled to be deleted.
+*/
+#define CAN_CMDID_BUS_STATUS_RESP_RX 0x0C
+
+/*********************************************************************
+* Control Flag/Status Definition
+***********************************************************************/
+/* CANData Delivery control flag */
+/**
+* \~english Delivery stop
+*/
+#define CAN_DELIVERY_STOP 0
+/**
+* \~english Delivery restart
+*/
+#define CAN_DELIVARY_RESTART 1
+
+/* CANData Transmission result notification status */
+/**
+* \~english Success
+*/
+#define CAN_SUCCESS 0
+/**
+* \~english Retryout
+*/
+#define CAN_RETRYOUT 1
+/**
+* \~english Send buffer full
+*/
+#define CAN_BUFFERFUL 2
+
+/* IG linkage type */
+/**
+* \~english IG cooperation off
+*/
+#define CAN_IG_COOPERATION_OFF 0
+/**
+* \~english IG cooperation on
+*/
+#define CAN_IG_COOPERATION_ON 1
+
+/* N_TA */
+/**
+* \~english Invalid target address
+*/
+#define CAN_NTA_INVALID 0xFF
+
+/* Others */
+/**
+* \~english The code of resource ID which is not used
+*/
+#define CAN_RID_NOTUSE_CODE 0xFF
+
+/*********************************************************************
+* Data size definition
+***********************************************************************/
+/**
+* \~english MAX CAN data size used to send/receive message
+*/
+#define CAN_DATA_SIZE 63
+/**
+* \~english MAX CAN data size used to send message
+*/
+#define CAN_TXDATA_SIZE 8
+
+/* Data size relationship */
+/**
+* \~english MAX number of delivery entry
+* \~english ((528-16)-12)/4 = 125 12:event ID etc. , 4:size of CAN ID
+*/
+#define CAN_DELIVERY_CANID_ENTRY_MAX 125
+
+/**
+* \~english OPC MAX number of delivery entry
+*/
+#define CAN_DELIVERY_OPC_ENTRY_MAX 255
+
+/* Message size relationship */
+/**
+* \~english MAX size of message buffer
+*/
+#define CAN_MSGBUF_MAX_SIZE 528
+/**
+* \~english Size of message buffer header
+*/
+#define CAN_MSGBUF_HEADER_SIZE 16
+/**
+* \~english MAX size of message buffer header
+*/
+#define CAN_MSGBUF_DATAMAX_SIZE (CAN_MSGBUF_MAX_SIZE - CAN_MSGBUF_HEADER_SIZE)
+
+/**
+* \~english MAX size of CAN command data
+*/
+#define CANCMD_DAT_MAX 68
+
+/**
+* \~english MAX number of CANGW transmission data
+*/
+#define CANGW_SND_NUM_MAX 0x16
+/**
+* \~english MAX length of CANGW DLC
+*/
+#define CANGW_DLC_MAX_SIZE 0x08
+
+/*********************************************************************
+* Type definition
+***********************************************************************/
+/**
+* \~english CAN I/F API return code
+*/
+typedef int32_t CANIF_RET_API;
+/**
+* \~english define of CAN ID type
+*/
+typedef uint32_t CANID;
+
+/**
+* \~english data ID
+*/
+typedef uint32_t DID;
+
+/**
+* \~english Data struct used to transfer CAN data
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID can_id;
+ /**
+ * \~english Data Length
+ */
+ uint8_t dlc;
+ /**
+ * \~english reserve
+ */
+ uint8_t reserve[3];
+ /**
+ * \~english DATA[0] ~ DATA[N]
+ */
+ uint8_t data[CAN_DATA_SIZE];
+ /**
+ * \~english reserve
+ */
+ uint8_t reserve2;
+} CAN_MSG_CANDATA_DAT;
+
+/**
+* \~english Data struct used to transfer CAN message
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english data
+ */
+ CAN_MSG_CANDATA_DAT data;
+ /**
+ * \~english echoback flag
+ */
+ enum CanIfEchoBackFlags echoback;
+} CAN_MSG_CANDATA;
+
+/**
+* \~english Data struct used to transfer CAN data to CANGW
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID (upper byte)
+ */
+ uint8_t can_id_high;
+ /**
+ * \~english CAN ID (lower byte)
+ */
+ uint8_t can_id_low;
+ /**
+ * \~english Data Length
+ */
+ uint8_t dlc;
+ /**
+ * \~english data
+ */
+ uint8_t data[CANGW_DLC_MAX_SIZE];
+} CAN_MSG_CANGWDATA_DAT;
+
+/**
+* \~english Message struct used to transfer CAN data to CANGW
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN data
+ */
+ CAN_MSG_CANGWDATA_DAT data[CANGW_SND_NUM_MAX];
+ /**
+ * \~english Number of CAN data(max 22)
+ */
+ uint8_t num;
+} CAN_MSG_CANGWDATA;
+
+/**
+* \~english Data struct used to transfer CAN data
+* \~english (transfer data from user to CANIF API)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID can_id;
+ /**
+ * \~english Data Length
+ */
+ uint8_t dlc;
+ /**
+ * \~english reserve
+ */
+ uint8_t reserve[3];
+ /**
+ * \~english DATA
+ */
+ uint8_t data[CAN_DATA_SIZE + 1];
+} CAN_DATA;
+
+/**
+* \~english Data struct used to transfer CAN data
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ /**
+ * \~english Thread ID used by _CWORD64_
+ */
+ uint32_t ulEventId;
+ /**
+ * \~english Resource ID
+ */
+ uint8_t ucRid; /* Resources ID */
+ /**
+ * \~english Cycle of send message(Unit of 100ms)
+ */
+ uint16_t usFreq;
+ /**
+ * \~english CAN DATA
+ */
+ CAN_DATA stCandata;
+} CAN_TRANSMISSION_START_MSG_DAT;
+
+/**
+* \~english Data struct used to notify transmission result
+* \~english (transfer data from CAN API to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+ /**
+ * \~english Transmission result status
+ */
+ uint8_t ucStatus;
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve[3];
+} CAN_MSG_SENDSTS_DAT;
+
+/**
+* \~english Message struct used to notify transmission result
+* \~english (transfer message from CAN API to user)
+*/
+typedef struct {
+ /**
+ * \~english header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_MSG_SENDSTS_DAT data;
+} CAN_MSG_SENDSTS;
+
+/**
+* \~english Data struct used for regular transmission stop
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ /**
+ * \~english Event ID that use for _CWORD64_
+ */
+ uint32_t ulEventId;
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+} CAN_FREQ_TRANS_STOP_MSG_DAT;
+
+/**
+* \~english Data struct used for communication stop/restore
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Data ID
+ */
+ DID ulDid;
+} CAN_MSG_COMM_WATCHSTS_DAT;
+
+/**
+* \~english Data struct used for communication stop/restore
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_MSG_COMM_WATCHSTS_DAT data;
+} CAN_MSG_COMM_WATCHSTS;
+
+/**
+* \~english Data struct used for delivery entry
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ /**
+ * \~english Event ID use for _CWORD64_
+ */
+ uint32_t ulEventId;
+ /**
+ * \~english Number of CAN ID entry
+ */
+ uint16_t usCanNum;
+ /**
+ * \~english CAN ID entry array
+ */
+ CANID ulCanid[CAN_DELIVERY_CANID_ENTRY_MAX];
+} CAN_DELIVERY_ENTRY;
+
+/**
+* \~english Data struct used for communication stop
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP]; /* Destination thread name */
+ /**
+ * \~english Event ID
+ */
+ uint32_t ulEvtId;
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+ /**
+ * \~english Data ID
+ */
+ DID ulDid;
+ /**
+ * \~english Watch time for commuication stop (Unit of 100ms)
+ */
+ uint16_t usWatchTime;
+} CAN_COMM_WATCH_MSG_DAT;
+
+/**
+* \~english Data struct used for CAN command control
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Transfer to: ID */
+ /**
+ * \~english Event ID
+ */
+ uint32_t ulEvtId;
+ /**
+ * \~english Resource ID
+ */
+ uint8_t ucRid;
+ /**
+ * \~english CAN command ID
+ */
+ uint8_t ucCmdid;
+} CAN_CMD_CTRL_MSG_DAT;
+
+/**
+* \~english Data struct used for CAN command delivery
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN command ID
+ */
+ uint8_t cmd_id;
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve[3];
+ /**
+ * \~english Data
+ */
+ uint8_t data[CANCMD_DAT_MAX];
+} CAN_MSG_CANCMD_DAT;
+
+/**
+* \~english Message struct used for CAN command delivery
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_MSG_CANCMD_DAT data;
+} CAN_MSG_CANCMD;
+
+/**
+* \~english Data struct used for CAN command transmission result
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN command ID(same as delivery format)
+ */
+ uint32_t cmd_id;
+ /**
+ * \~english Delivery result status
+ */
+ uint8_t status;
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve[3];
+} CAN_CMD_MSG_SENDSTS_DAT;
+
+/**
+* \~english Data struct used for CAN command transmission result
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_CMD_MSG_SENDSTS_DAT data;
+} CAN_CMD_MSG_SENDSTS;
+
+/**
+* \~english Data struct for receiving message(work data)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+ T_APIMSG_MSGBUF_HEADER_COMM stHead;
+ /**
+ * \~english Data
+ */
+ uint8_t ucData[CAN_MSGBUF_DATAMAX_SIZE];
+} CAN_MSG_DATA;
+
+/**
+* \~english CAN data struct of communication stop registration
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ /**
+ * \~english Event ID for _CWORD64_
+ */
+ uint32_t ulEvtId;
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+ /**
+ * \~english Data ID
+ */
+ DID ulDid;
+ /**
+ * \~english Watch time for communication stop(Unit of 100ms)
+ */
+ uint16_t usWatchTime;
+ /**
+ * \~english has IG coopration or not
+ */
+ uint8_t ucIg;
+} CAN_COMM_WATCHEXT_MSG_DAT;
+
+/**
+* \~english Mask data struct for CAN data
+*/
+typedef struct {
+ /**
+ * \~english Mask data
+ */
+ uint8_t dat[CAN_TXDATA_SIZE];
+} CAN_DATA_MASK;
+
+/**
+* \~english Data struct used for CAN data transmission
+*/
+typedef struct {
+ /**
+ * \~english Transmission data
+ */
+ uint8_t dat[CAN_TXDATA_SIZE];
+} CAN_DATA_BIT;
+
+/**
+* \~english Data struct used for CAN data transmission registration
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID id;
+ /**
+ * \~english Mask data
+ */
+ CAN_DATA_MASK mask;
+ /**
+ * \~english Transmission data
+ */
+ CAN_DATA_BIT dat;
+ /**
+ * \~english Cycle of regular transmission
+ */
+ uint32_t freq;
+} CAN_TRANS_START_MSG_DAT;
+
+/***********************************************************************
+* CANIF API Functions Prototypes *
+************************************************************************/
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*******************************************************************************
+ * MODULE : Canif_DeliveryEntry
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_DeliveryEntry
+/// \~english @par Brief
+/// Delivery registration of CAN data
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] can_num
+/// uint8_t - Number of delivery registration CAN ID
+/// \~english @param [in] p_can_id
+/// CANID* - Pointer of delivery registration CAN ID array
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - can_num is 0 or bigger than 125.[CANIF_RET_ERROR_PARAM]
+/// - CAN ID pointer is null.[CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Delivery registration of CAN data. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_DeliveryEntry(HANDLE h_app, PCSTR notify_name,
+ uint8_t can_num, CANID *p_can_id);
+
+/*******************************************************************************
+ * MODULE : Canif_TransmissionStart
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_TransmissionStart
+/// \~english @par Brief
+/// CAN data transmission starting
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] rid
+/// uint8_t - Resource ID for CAN data transmission result notification
+/// \~english @param [in] freq
+/// uint16_t - Cycle of regular transmission
+/// \~english @param [in] p_data
+/// CAN_DATA* - Pointer of transmission data
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - Transmission data pointer is null.[CANIF_RET_ERROR_PARAM]
+/// - DLC size is bigger than 8 bytes.[CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - CAN ID is not defined in the _CWORD108_ bit asignment table
+/// [CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - The transmission of the CAN data starts(Regular/One). \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_TransmissionStart(HANDLE h_app, PCSTR notify_name,
+ uint8_t rid, uint16_t freq, CAN_DATA *p_data);
+
+/*******************************************************************************
+ * MODULE : Canif_CommandCtrl
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_CommandCtrl
+/// \~english @par Brief
+/// CAN command control
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] rid
+/// uint8_t - Resource ID
+/// \~english @param [in] cmd_id
+/// uint32_t - CAN command ID(32bit)
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - CAN command ID is invalid.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - Transmission control of CAN command. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_CommandCtrl(HANDLE h_app, PCSTR notify_name, uint8_t rid,
+ uint32_t cmd_id);
+
+/*******************************************************************************
+ * MODULE : Canif_CommWatch
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_CommWatch
+/// \~english @par Brief
+/// CAN data regular transmission stop
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] can_id
+/// CANID - CAN ID
+/// \~english @param [in] did
+/// DID - Data ID
+/// \~english @param [in] watch_time
+/// uint16_t - Communication watch suspension time(Unit of 100ms)
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - CAN data regular transmission stop. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_CommWatch(HANDLE h_app, PCSTR notify_name, CANID can_id,
+ DID did, uint16_t watch_time);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_TransStart
+/// \~english @par Brief
+/// Transmission CAN Command
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] can_id
+/// CANID - CAN ID
+/// \~english @param [in] mask
+/// CAN_DATA_MASK* - Mask Data
+/// \~english @param [in] dat
+/// CAN_DATA_BIT* - Transmission Data
+/// \~english @param [in] freq
+/// uint32_t - Transmission Cycle
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Transmission Cycle is bigger than 0xFFFF.[CANIF_RET_ERROR_PARAM]
+/// - CAN ID is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Mask Data is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Transmission Data is NULL.[CANIF_RET_ERROR_PARAM]
+/// - CAN ID is not defined in the _CWORD108_ bit asignment table
+/// [CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - Start Transmission CAN Command API. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_TransStart(HANDLE h_app, CANID can_id, CAN_DATA_MASK *mask,
+ CAN_DATA_BIT *dat, uint32_t freq);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_DeliveryEraseAll
+/// \~english @par Brief
+/// Delete all delivery entry
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Delete all delivery entry. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_DeliveryEraseAll(HANDLE h_app, PCSTR notify_name);
+
+/** @}*/ // end of CAN
+/** @}*/ // end of communication
+/** @}*/ // end of peripheral_service
+/** @}*/ // end of BaseSystem
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_
diff --git a/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/communication_can.h b/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/communication_can.h
new file mode 100755
index 0000000..8b6119a
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/communication_can.h
@@ -0,0 +1,28 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef PERIPHERALSERVICE_COMMUNICATIONCAN_H_ // NOLINT(build/header_guard)
+#define PERIPHERALSERVICE_COMMUNICATIONCAN_H_ // NOLINT(build/header_guard)
+
+/**
+ * @file communication_can.h
+ * @~english
+ * @brief communication_can unit header
+ */
+
+#include <peripheral_service/Canif_API.h>
+
+#endif // PERIPHERALSERVICE_COMMUNICATIONCAN_H_
diff --git a/video_in_hal/peripheralservice/communication/client_can/libCAN_API.ver b/video_in_hal/peripheralservice/communication/client_can/libCAN_API.ver
new file mode 100755
index 0000000..47e5e86
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/client_can/libCAN_API.ver
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#########################
+# lib_CWORD83_ version script #
+#########################
+{
+ global:
+ ### .text section ###
+ Canif_DeliveryEntry;
+ Canif_DeliveryEraseAll;
+ Canif_TransmissionStart;
+ Canif_TransmissionStop;
+ Canif_CommandCtrl;
+ Canif_CommWatch;
+ Canif_TransStart;
+ Canif_TransStop;
+ Canif_Send;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/video_in_hal/peripheralservice/communication/client_can/src/Canif_API.cpp b/video_in_hal/peripheralservice/communication/client_can/src/Canif_API.cpp
new file mode 100755
index 0000000..499d187
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/client_can/src/Canif_API.cpp
@@ -0,0 +1,301 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <peripheral_service/Canif_API.h>
+
+#include "API_Local_Common.h"
+#include "Canif_API_Local.h"
+#include "Canif_TransmissionData.h"
+#include "com_error_type.h"
+
+static __thread HANDLE g_sender = NULL;
+
+static EFrameworkunifiedStatus CanifMsgToSrv(HANDLE h, UI_32 cmd, size_t len, PCVOID data) {
+ if (data == NULL)
+ return eFrameworkunifiedStatusFail;
+
+ if (len > UINT32_MAX)
+ return eFrameworkunifiedStatusFail;
+
+ if (g_sender == NULL) {
+ g_sender = FrameworkunifiedMcOpenSender(h, LAN_SERVICE_CAN);
+ if (g_sender == NULL)
+ return eFrameworkunifiedStatusFail;
+ }
+ return FrameworkunifiedSendMsg(g_sender, cmd, (UI_32)len, data);
+}
+
+CANIF_RET_API Canif_DeliveryEntry(HANDLE h_app, PCSTR notify_name,
+ uint8_t can_num, CANID *p_can_id) {
+
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ CAN_DELIVERY_ENTRY pst_delivery_entry;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ PS_Communication_InternalProtocol cmd = CID_CANIF_DELIVERY_ENTRY;
+ void *tx = reinterpret_cast<void *>(&pst_delivery_entry);
+ size_t len = sizeof(pst_delivery_entry);
+ memset(tx, 0x0, len);
+ int32_t i;
+
+ if (NULL == h_app)
+ goto cleanup;
+
+ if (NULL == p_can_id)
+ goto cleanup;
+
+ if (!Canif_CheckNotifyName(notify_name))
+ goto cleanup;
+
+ if (0 == can_num)
+ goto cleanup;
+
+ if (CAN_DELIVERY_CANID_ENTRY_MAX < can_num)
+ goto cleanup;
+
+ for (i = 0; i < (int32_t)can_num; i++) {
+ if (!Canif_CheckCanID(p_can_id[i]))
+ goto cleanup;
+ }
+
+ Canif_CopyNotifyName(pst_delivery_entry.notifyName, notify_name);
+ pst_delivery_entry.usCanNum = (uint16_t)can_num;
+ memcpy(pst_delivery_entry.ulCanid, p_can_id, sizeof(CANID) * can_num);
+
+ e_status = CanifMsgToSrv(h_app, cmd, len, tx);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ return l_ret;
+}
+
+CANIF_RET_API Canif_TransmissionStart(HANDLE h_app, PCSTR notify_name,
+ uint8_t rid, uint16_t freq, CAN_DATA *p_data) {
+
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ CAN_TRANSMISSION_START_MSG_DAT pst_transmission_start;
+ PS_Communication_InternalProtocol cmd = CID_CANIF_TX_START;
+ void *tx = reinterpret_cast<void *>(&pst_transmission_start);
+ size_t len = sizeof(pst_transmission_start);
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ PCSTR _notify_name = notify_name;
+ memset(tx, 0x0, len);
+
+ if (h_app == NULL)
+ goto cleanup;
+
+ if (p_data == NULL)
+ goto cleanup;
+
+ if (rid == 0xFF) {
+ _notify_name = ""; // using dummy name;
+ }
+
+ if (!Canif_CheckNotifyName(_notify_name))
+ goto cleanup;
+
+ if (CAN_TXDATA_SIZE < (p_data->dlc))
+ goto cleanup;
+
+ if (!Canif_CheckCanID(p_data->can_id))
+ goto cleanup;
+
+ if (!Canif_InitDataIsDefined21PF(p_data->can_id))
+ goto cleanup;
+
+ Canif_CopyNotifyName(pst_transmission_start.notifyName, _notify_name);
+ pst_transmission_start.ucRid = rid;
+ pst_transmission_start.usFreq = freq;
+ memcpy(reinterpret_cast<void *>(&pst_transmission_start.stCandata),
+ reinterpret_cast<int8_t *>(p_data), (size_t)sizeof(CAN_DATA));
+ e_status = CanifMsgToSrv(h_app, cmd, len, tx);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ return l_ret;
+}
+
+CANIF_RET_API Canif_CommandCtrl(HANDLE h_app, PCSTR notify_name, uint8_t rid,
+ uint32_t cmd_id) {
+
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ CAN_CMD_CTRL_MSG_DAT pst_cmd_ctrl_msg;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ PS_Communication_InternalProtocol cmd = CID_CANIF_CMD_CTRL;
+ void *tx = reinterpret_cast<void *>(&pst_cmd_ctrl_msg);
+ size_t len = sizeof(pst_cmd_ctrl_msg);
+ PCSTR _notify_name = notify_name;
+ memset(tx, 0x0, len);
+
+ if (!Canif_IsCommand(cmd_id))
+ goto cleanup;
+
+ if (h_app == NULL)
+ goto cleanup;
+
+ if (rid == 0xFF) {
+ _notify_name = ""; // using dummy name;
+ }
+
+ if (!Canif_CheckNotifyName(_notify_name))
+ goto cleanup;
+
+ Canif_CopyNotifyName(pst_cmd_ctrl_msg.notifyName, _notify_name);
+ pst_cmd_ctrl_msg.ucRid = rid;
+ pst_cmd_ctrl_msg.ucCmdid = (uint8_t)cmd_id;
+
+ e_status = CanifMsgToSrv(h_app, cmd, len, tx);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ return l_ret;
+}
+
+CANIF_RET_API Canif_CommWatch(HANDLE h_app, PCSTR notify_name, CANID can_id,
+ DID did, uint16_t watch_time) {
+
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ CAN_COMM_WATCHEXT_MSG_DAT pst_comm_watch_msg;
+ PS_Communication_InternalProtocol cmd = CID_CANIF_COMM_WATCH;
+ void *tx = reinterpret_cast<void *>(&pst_comm_watch_msg);
+ size_t len = sizeof(pst_comm_watch_msg);
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ memset(tx, 0x0, len);
+
+ if (h_app == NULL)
+ goto cleanup;
+
+ if (!Canif_CheckNotifyName(notify_name))
+ goto cleanup;
+
+ if (!Canif_CheckCanID(can_id))
+ goto cleanup;
+
+ Canif_CopyNotifyName(pst_comm_watch_msg.notifyName, notify_name);
+ pst_comm_watch_msg.ulCanid = can_id;
+ pst_comm_watch_msg.ulDid = did;
+ pst_comm_watch_msg.ucIg = CAN_IG_COOPERATION_OFF;
+ pst_comm_watch_msg.usWatchTime = watch_time;
+
+ e_status = CanifMsgToSrv(h_app, cmd, len, tx);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ return l_ret;
+}
+
+CANIF_RET_API Canif_TransStart(HANDLE h_app, CANID can_id,
+ CAN_DATA_MASK *mask, CAN_DATA_BIT *dat, uint32_t freq) {
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ CAN_TRANS_START_MSG_DAT pst_trans_start;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ PS_Communication_InternalProtocol cmd = CID_CANIF_TX_BIT_START;
+ void *tx = reinterpret_cast<void *>(&pst_trans_start);
+ size_t len = sizeof(pst_trans_start);
+ memset(tx, 0x0, len);
+
+ if (h_app == NULL)
+ goto cleanup;
+
+ if (!Canif_CheckCanID(can_id))
+ goto cleanup;
+
+ if (!Canif_InitDataIsDefined21PF(can_id))
+ goto cleanup;
+
+ if (mask == NULL)
+ goto cleanup;
+
+ if (dat == NULL)
+ goto cleanup;
+
+ if (0xFFFF < freq)
+ goto cleanup;
+
+ pst_trans_start.id = can_id;
+ pst_trans_start.freq = freq;
+ memcpy(&pst_trans_start.mask.dat, mask->dat, sizeof(mask->dat));
+ memcpy(&pst_trans_start.dat.dat, dat->dat, sizeof(dat->dat));
+
+ e_status = CanifMsgToSrv(h_app, cmd, len, tx);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ return l_ret;
+}
+
+CANIF_RET_API Canif_DeliveryEraseAll(HANDLE h_app, PCSTR notify_name) {
+ CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ HANDLE handle[NUM_OF_CANIF_PROTOCOL];
+ int i = 0;
+
+ for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) {
+ handle[i] = NULL;
+ }
+
+ if (NULL == h_app)
+ goto cleanup;
+
+ if (!Canif_CheckNotifyName(notify_name))
+ goto cleanup;
+
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) {
+ handle[i] = FrameworkunifiedMcOpenSender(h_app,
+ Canif_PidxTosname((enum CANIF_PROTOCOL_IDX)i));
+ if (!handle[i])
+ goto cleanup;
+ }
+
+ for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) {
+ e_status = FrameworkunifiedSendMsg(handle[i], CID_CANIF_DELIVERY_ERASE,
+ CANIF_NOTIFY_NAME_MAX_SIZE, (PCVOID)notify_name);
+ if (e_status != eFrameworkunifiedStatusOK)
+ goto cleanup;
+ }
+
+ l_ret = CANIF_RET_NORMAL;
+cleanup:
+ for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) {
+ if (handle[i] != NULL)
+ FrameworkunifiedMcClose(handle[i]);
+ }
+ return l_ret;
+}
+
diff --git a/video_in_hal/peripheralservice/communication/server/Makefile b/video_in_hal/peripheralservice/communication/server/Makefile
new file mode 100755
index 0000000..069c333
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/Makefile
@@ -0,0 +1,96 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### add source path #############
+
+######### installed program #############
+INST_PROGS = communication
+
+######### installed library(*.a) #############
+
+######### installed shared library(*.so) #############
+
+######### compiled sources #############
+
+## from ./src/main
+communication_SRCS += ./src/main/communication_main.cpp
+communication_SRCS += ./src/main/communication_application.cpp
+
+## from ./src/threads
+communication_SRCS += ./src/threads/CAN_Thread.cpp
+communication_SRCS += ./src/threads/Thread_Common.cpp
+
+## from ./src/CAN/CommWatch/
+communication_SRCS += ./src/CAN/CommWatch/CAN_CommWatch.cpp
+
+## from ./src/CAN/Delivery/
+communication_SRCS += ./src/CAN/Delivery/CAN_Delivery.cpp
+
+## from ./src/CAN/TxMsg/
+communication_SRCS += ./src/CAN/TxMsg/CAN_TxMsg.cpp
+
+######### add source path #############
+VPATH += \
+ ./src/CAN/Command \
+ ./src/CAN/CommWatch \
+ ./src/CAN/Delivery \
+ ./src/CAN/main \
+ ./src/CAN/TxMsg \
+ ./src/main \
+
+
+######### add include path #############
+CPPFLAGS += \
+ -I./../client_can/include \
+ -I./include \
+ -I./include/CAN/Command \
+ -I./include/CAN/CommWatch \
+ -I./include/CAN/Delivery \
+ -I./include/CAN/main \
+ -I./include/CAN/TimerCtrl \
+ -I./include/CAN/TxMsg \
+ -I./include/main \
+ -I./include/threads \
+ -I./include/private
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fdata-sections -ffunction-sections -DFLG_CORE
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+######### add library path #############
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--gc-sections
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+LDLIBS += -Wl,-Bdynamic -lrt
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lcan_hal
+
+include ../../peripheral_service.mk
diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h b/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h
new file mode 100755
index 0000000..16aa54f
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_
+#include <native_service/frameworkunified_types.h>
+#include <peripheral_service/Canif_API.h>
+#include <vector>
+#include <map>
+#include <string>
+#include "CommWatchCommon.h"
+
+typedef struct {
+ char notify_name[MAX_NAME_SIZE_APP];
+ uint32_t data_id;
+ uint8_t comm_watch_flag;
+ uint16_t set_time;
+ uint16_t timer_cnt;
+} CAN_COMM_WATCH_VAL;
+
+typedef std::multimap<CANID, CAN_COMM_WATCH_VAL> CAN_CommWatchTable;
+typedef std::pair<const CANID, CAN_COMM_WATCH_VAL> CAN_CommWatchTablePair;
+typedef CAN_CommWatchTable::iterator CAN_CommWatchTableIt;
+
+void CANCommWatchInit(void);
+EFrameworkunifiedStatus CANCommWatch(HANDLE h_app);
+EFrameworkunifiedStatus CANCommWatchTimeout(HANDLE h_app);
+void CANCommWatchClear(HANDLE h_app, CANID id);
+#endif // COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h b/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h
new file mode 100755
index 0000000..7306214
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h
@@ -0,0 +1,22 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_COMMWATCH_COMMON_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_COMMWATCH_COMMON_H_
+#define CAN_COMM_OFF 0x00
+#define CAN_COMM_NORMAL 0x01
+#define CAN_COMM_STOP 0x02
+#endif
diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/Command/CAN_Command.h b/video_in_hal/peripheralservice/communication/server/include/CAN/Command/CAN_Command.h
new file mode 100755
index 0000000..43abcdc
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/CAN/Command/CAN_Command.h
@@ -0,0 +1,21 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_
+EFrameworkunifiedStatus CANCommandTransmission(HANDLE h_app);
+RET_CAN CANCommandTxRslt(HANDLE h_app, CAN_MSG_DATA*);
+#endif // COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h b/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h
new file mode 100755
index 0000000..01f2e2f
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_
+#include <native_service/frameworkunified_types.h>
+#include "CAN_Thread.h"
+#include <vector>
+#include <map>
+#include <string>
+#include <can_hal.h>
+
+typedef std::multimap<CANID, std::string> CAN_DeliveryEntryList;
+typedef CAN_DeliveryEntryList::iterator CAN_DeliveryEntryListIt;
+typedef std::pair<const CANID, std::string> CAN_DeliveryEntryListPair;
+
+void CANDeliveryInit(void);
+bool CANDeliveryInsert(CANID canid, std::string s);
+EFrameworkunifiedStatus CANDeliveryRcvProcess(HANDLE h_app, CanMessage *msg);
+EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app);
+EFrameworkunifiedStatus CANClearEntry(HANDLE h_app);
+EFrameworkunifiedStatus CANDeliverySndMsg(HANDLE h_app, CANID ul_canid, uint8_t n_ta,
+ uint8_t uc_dlc, const uint8_t *puc_data,
+ PS_CommunicationProtocol cid, enum CanIfEchoBackFlags flag = CANIF_PURERECV);
+EFrameworkunifiedStatus CANCommandDeliveryRcvProcess(HANDLE h_app,
+ CanMessage *msg, uint8_t cmd);
+#endif // COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h b/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h
new file mode 100755
index 0000000..ae0302c
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h
@@ -0,0 +1,137 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERYDATA_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERYDATA_H_
+/******************************************************************************
+ * FILE :CAN_DeliveryData.h
+ * SYSTEM :_CWORD107_
+ * SUBSYSTEM :
+-----------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <peripheral_service/Canif_API.h>
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/* Data size relationship */
+#define CAN_DELIVERY_LIST_NUM 400 /* Maximum number of delivery destination management tables */
+#define CAN_DELIVERY_CANID_LIST_NUM 150 /* Delivery CAN ID control table max. */
+
+#define CAN_EXRCV_DATA_NUM 22 /* CAN Extended Reception Notification CAN Maximum Number of Data */
+#define CAN_EXRCV_DATA_SIZE 11 /* CAN Extended Reception Notification CAN Data Size */
+#define CAN_EXRCV_CANNUM_SIZE 1 /* CAN Extended Reception Notification CAN Data Number Size */
+#define CAN_EXRCV_DLC_MIN 1 /* CAN Extended Reception Notification DLC Minimum Value */
+#define CAN_EXRCV_DLC_MAX 8 /* CAN Extended Reception Notification DLC Maximum Value */
+
+/* Flag relationship */
+#define CAN_DELIVERY_OFF 0 /* Stopping data delivery */
+#define CAN_DELIVERY_ON 1 /* Data delivery in progress */
+
+/* CANDataControl code relationship used in the delivery relationship */
+#define CAN_DELIVERYLIST_STOP_CODE 0xFFFF /* Shipping Destination Management Table Stop Code */
+
+#define CAN_CANIDLIST_EMPTY 0xFFFF /* Availability of CAN ID control table */
+/************************************************************************
+* Struct definitions
+************************************************************************/
+/***************************************************
+* TAG : CAN_DELIVERY_DAT
+* ABSTRACT : Destination management table structure (1 item)
+* (CAN internal data management table)
+****************************************************/
+typedef struct { /* Type definition of delivery destination management data (1 item) */
+ CANID ul_canid; /* CAN ID */
+ char notify_name[MAX_NAME_SIZE_APP]; /* Destination thread name */
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ uint8_t uc_delivery_on; /* Delivery operation */
+ uint8_t reserve1; /* Reserved */
+ uint16_t us_link_id; /* Link ID */
+ uint8_t reserve2[2]; /* Reserved */
+} CAN_DELIVERY_DAT;
+
+/***************************************************
+* TAG : CAN_DELIVERY_LIST_DAT
+* ABSTRACT : Destination management table structure (all)
+* (CAN internal data management table)
+****************************************************/
+typedef struct { /* Type definition of the shipping management table */
+ uint16_t us_entry_num; /* Registered number */
+ uint8_t reserve[2]; /* Reserved */
+ CAN_DELIVERY_DAT st_list[CAN_DELIVERY_LIST_NUM]; /* Delivery destination management data */
+} CAN_DELIVERY_LIST_DAT;
+
+/***************************************************
+* TAG : CAN_DELIVERY_SPACE_DAT
+* ABSTRACT : Free space management structure in the destination management table (all)
+* (CAN internal data management table free space management table)
+****************************************************/
+typedef struct { /* Type definitions for free space management tables */
+ uint16_t space_num; /* Number of free spaces */
+ uint16_t index_list[CAN_DELIVERY_LIST_NUM]; /* Free space index list */
+} CAN_DELIVERY_SPACE_DAT;
+
+/***************************************************
+* TAG : CAN_CANID_DAT
+* ABSTRACT : Transport CAN ID control table structures (1 item)
+* (CAN internal data management table)
+****************************************************/
+typedef struct { /* Defining the type of delivery destination CAN ID (1 item) */
+ CANID ul_canid; /* CAN ID */
+ uint16_t us_start_id; /* Start ID */
+ uint16_t us_end_id; /* End ID */
+ uint16_t us_data_num; /* Number of data items */
+ uint8_t reserve[2]; /* Reserved */
+} CAN_CANID_DAT;
+
+/***************************************************
+* TAG : CAN_CANID_LIST_DAT
+* ABSTRACT : Delivery CAN ID control table structures (all)
+* (CAN internal data management table)
+****************************************************/
+typedef struct { /* Type definitions for the target CAN ID administration table */
+ uint16_t us_entry_num; /* Registered number */
+ uint8_t reserve[2]; /* Reserved */
+ CAN_CANID_DAT st_list[CAN_DELIVERY_CANID_LIST_NUM]; /* Shipping CAN ID */
+} CAN_CANID_LIST_DAT;
+
+/***************************************************
+* TAG : CAN_DELIVERY_SND_DAT
+* ABSTRACT : Destination thread name for sending a message of delivery data
+* (CAN-internal Work)
+****************************************************/
+/* Type definition of the target thread name list data to which the message is sent */
+typedef struct {
+ int32_t i_num; /* Number of messages sent */
+ char notify_name[CAN_DELIVERY_LIST_NUM][MAX_NAME_SIZE_APP]; /* Destination thread name */
+} CAN_DELIVERY_SND_DAT;
+
+typedef struct {
+ CAN_DELIVERY_LIST_DAT* p_dlvry_list;
+ CAN_DELIVERY_SPACE_DAT* p_dlvry_space;
+ CAN_CANID_LIST_DAT* p_canid_list;
+ CAN_DELIVERY_SND_DAT* p_dlvry_snd;
+} CAN_STRUCT_PTR;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void CANDeliveryDataInit(void); /* CANDataDelivery Management Data Initialization Process */
+EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app); /* CANDataDelivery registration process */
+void CANDeliveryBufferOut(FILE* fp_log); /* CAN shipping table log output processing */
+EFrameworkunifiedStatus CANClearEntry(HANDLE h_app);
+
+#endif // COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERYDATA_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h b/video_in_hal/peripheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h
new file mode 100755
index 0000000..dc4f6e8
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_
+#define COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_
+#include <vector>
+#include <map>
+#include <string>
+#include <can_hal.h>
+#include "CAN_Thread.h"
+#include "API_Local_Common.h"
+#include "Canif_API_Local.h"
+
+
+#define CAN_OPC_PAC_RX 0x00
+#define CAN_OPC_COMMAND_STARTUP_FIN_REQ_TX 0x00 // CAN start completion notification request transmission
+#define CAN_OPC_COMMAND_MRST_INFO_REQ_TX 0x01 // CAN master reset information notification request transmission
+#define CAN_OPC_COMMAND_VERSION_REQ_TX 0x02 // CAN Version Request Send
+#define CAN_OPC_COMMAND_CONNECTION_NODE_REQ_TX 0x03 // CAN connection node notification request transmission
+#define CAN_OPC_COMMAND_BUS_STATUS_REQ_TX 0x04 // CAN bus status notification request transmission
+#define CAN_OPC_COMMAND_FUELCALC_REQ_TX 0x05 // CAN section flame reset response transmission
+#define CAN_OPC_COMMAND_STARTUP_FIN_RESP_RX 0x06 // CAN startup completion notice received
+#define CAN_OPC_COMMAND_MRST_INFO_RESP_RX 0x07 // CAN Master Reset Information Notification Reception
+#define CAN_OPC_COMMAND_VERSION_RESP_RX 0x08 // CAN Version Response Reception
+#define CAN_OPC_COMMAND_CONNECTION_NODE_RESP_RX 0x09 // Receive CAN Connection Node Notification Response
+#define CAN_OPC_COMMAND_BUS_STATUS_RESP_RX 0x10 // CAN Bus Status Notification Response Reception
+#define CAN_OPC_COMMAND_FUELCALC_RST_REQ_RX 0x11 // RECEIVE REQUEST FREE OF CAN SECTION
+
+typedef struct {
+ uint8_t rid;
+ char notify_name[CANIF_NOTIFY_NAME_MAX_SIZE + 1];
+} CAN_SEND_STATUS_DAT;
+
+void CANTxMsgInit(void);
+EFrameworkunifiedStatus CANTxMsg(HANDLE h_app);
+EFrameworkunifiedStatus CANTxMsgBit(HANDLE h_app);
+void CANCommandSetFuelCalcRstReq(void);
+EFrameworkunifiedStatus CANTxMsgCommand(HANDLE h_app);
+EFrameworkunifiedStatus CANSndStsProcess(HANDLE h_app, CanSendResult *rcv_msg,
+ PS_CommunicationProtocol cid);
+#endif // COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/com_error_type.h b/video_in_hal/peripheralservice/communication/server/include/com_error_type.h
new file mode 100755
index 0000000..4d15f82
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/com_error_type.h
@@ -0,0 +1,21 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_
+#define COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_
+const int32_t RET_NORMAL = 0;
+const int32_t RET_ERROR = -1;
+#endif // COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/main/communication_cid.h b/video_in_hal/peripheralservice/communication/server/include/main/communication_cid.h
new file mode 100755
index 0000000..d817624
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/main/communication_cid.h
@@ -0,0 +1,33 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file has been generated automatically.
+ * User hand written code entry is not allowed. Do not modify the file content.
+ *
+ */
+#ifndef COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_
+#define COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_
+
+#define LAN_SERVICE_MAIN "Communication"
+
+typedef enum PSCommunicationServiceProtocol {
+ CID_COMMSYS_MSG_BASE = PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD, // Base command id.
+ CID_COMMSYS_CAN_READY, // CAN_COM_PROT->Communication
+ CID_COMMSYS_TIMEOUT, // Communication->CAN
+} PS_CommunicationServiceProtocol;
+
+#endif // COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/main/communication_communicationlog.h b/video_in_hal/peripheralservice/communication/server/include/main/communication_communicationlog.h
new file mode 100755
index 0000000..37016ad
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/main/communication_communicationlog.h
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+/// \brief
+///
+///
+///
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ * This file has been generated automatically.
+ * User hand written code entry is not allowed. Do not modify the file content.
+ *
+ */
+#ifndef COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_COMMUNICATIONLOG_H_
+#define COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_COMMUNICATIONLOG_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_APP ZONEMASK(13)
+#define ZONE__CWORD83__DEBUG ZONEMASK(14)
+#define ZONE_CAN_DEBUG ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_COMMSYS ZONEMASK(17)
+#define ZONE_ICR ZONEMASK(18)
+#define ZONE_ICR_TABLE ZONEMASK(19)
+#define ZONE_TRANSLOG ZONEMASK(20)
+#define ZONE_LOOPBACK ZONEMASK(22)
+#define ZONE_ENTRY ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_DEBUG ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ZONE_COMM_SYS_STS ZONEMASK(107)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "StateMachine Example"
+#define ZONE_TEXT_14 "_CWORD83_"
+#define ZONE_TEXT_15 "CAN"
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 "COMSYS"
+#define ZONE_TEXT_18 "ICR"
+#define ZONE_TEXT_19 "ICR_TABLE"
+#define ZONE_TEXT_20 "TRANSLOG"
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 "Debug"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_APP, ZONE_ERR, ZONE_WARN, ZONE_INFO, ZONE_COMM_SYS, ZONE_CAN_FILTER, ZONE_COMM_SYS_STS
+#endif
+
+#endif // COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_COMMUNICATIONLOG_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/main/communication_version.h b/video_in_hal/peripheralservice/communication/server/include/main/communication_version.h
new file mode 100755
index 0000000..7cd2c3b
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/main/communication_version.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file version.h
+/// \ingroup
+/// \version 0.1.0
+/// \brief
+///
+/// \todo
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+// File name : version.h
+// Module : Communication
+// Description : TODO INSERT
+// Scope : < example:Legacy Architecture>
+// Platform : _CWORD3_002 Platform
+//
+// Customer :
+// System :
+// Reference :
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_VERSION_H_
+#define COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_VERSION_H_
+
+#define MAJORNO 0x01
+#define MINORNO 0x00
+#define REVISION 0x00
+
+#endif // COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_VERSION_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication.h b/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication.h
new file mode 100755
index 0000000..94f5544
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication.h
@@ -0,0 +1,29 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file communication.h
+ * @~english
+ * @brief communication unit header
+ */
+
+#ifndef PERIPHERALSERVICE_COMMUNICATION_H_ // NOLINT(build/header_guard)
+#define PERIPHERALSERVICE_COMMUNICATION_H_ // NOLINT(build/header_guard)
+
+#include <peripheral_service/communication_notifications.h>
+#include <peripheral_service/communication_can.h>
+
+#endif // PERIPHERALSERVICE_COMMUNICATION_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication_notifications.h b/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication_notifications.h
new file mode 100755
index 0000000..9c207f3
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication_notifications.h
@@ -0,0 +1,28 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file communication_notifications.h
+ * @~english
+ * @brief Defination of communication notification
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_PERIPHERAL_SERVICE_COMMUNICATION_NOTIFICATIONS_H_
+#define COMMUNICATION_SERVER_INCLUDE_PERIPHERAL_SERVICE_COMMUNICATION_NOTIFICATIONS_H_
+
+/*! @~english Defination of communication notification */
+#define NTFY_Communication_Availability "Communication/Availability"
+
+#endif // COMMUNICATION_SERVER_INCLUDE_PERIPHERAL_SERVICE_COMMUNICATION_NOTIFICATIONS_H_
diff --git a/video_in_hal/peripheralservice/communication/server/include/peripheral_service/ps_services.h b/video_in_hal/peripheralservice/communication/server/include/peripheral_service/ps_services.h
new file mode 100755
index 0000000..fd556d6
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/peripheral_service/ps_services.h
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!------------------------------------------------------------------------------------------------
+ * @file ps_services.h
+ * @~english
+ * @brief Defines the names of the available peripheral services.
+ */
+
+#ifndef PERIPHERALSERVICE__CWORD121_SHADOW_CLIENT_INCLUDE_PERIPHERAL_SERVICE_PS_SERVICES_H_ // NOLINT(build/header_guard)
+#define PERIPHERALSERVICE__CWORD121_SHADOW_CLIENT_INCLUDE_PERIPHERAL_SERVICE_PS_SERVICES_H_ // NOLINT(build/header_guard)
+
+/**
+ * @file ps_services.h
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+
+/*------------------------------------------------------------------------------
+ * define
+ *----------------------------------------------------------------------------*/
+#define SERVICE_PSMSHADOW "PS_PSMShadow"
+/*!< @~english Define the name of SERVICE_PSMSHADOW */
+
+#define SERVICE_IPC "PS_IPC_DISP"
+/*!< @~english Define the name of SERVICE_IPC */
+
+#define SERVICE_IPC_DISP "PS_IPC"
+/*!< @~english Define the name of SERVICE_IPC_DISP */
+
+#define SERVICE_IPCTESTAPP "PS_IPC_TestApp"
+/*!< @~english Define the name of SERVICE_IPCTESTAPP */
+
+#define SERVICE_HMIKEYHANDLER "PS_KeyHandler"
+/*!< @~english PS_KeyHandler name SERVICE_HMIKEYHANDLER */
+
+#define SERVICE_MP_SHADOW "PS_IPC_MP_Shadow"
+/*!< @~english Define the name of SERVICE_MP_SHADOW */
+
+#define SERVICE_SENSORSHADOW "PS_SensorShadow"
+/*!< @~english Define the name of SERVICE_SENSORSHADOW */
+
+#define SERVICE_COMMUNICATIONDEBUGDUMPTEST "PS_COMMUNICATIONDebugDumpTest"
+/*!< @~english Define the name of SERVICE_COMMUNICATIONDEBUGDUMPTEST */
+
+#define SERVICE_PSMSHADOWTEST "PS_TEST_PSMShadow"
+/*!< @~english Define the name of SERVICE_PSMSHADOWTEST */
+
+#define SERVICE_LOGGERSHADOW "PS_LoggerShadow"
+/*!< @~english Define the name of SERVICE_LOGGERSHADOW */
+
+#define SERVICE_SOFTWAREUPDATESHADOW "PS_SoftwareUpdateShadow"
+/*!< @~english Define the name of SERVICE_SOFTWAREUPDATESHADOW */
+
+// #define SERVICE_LINSHADOW "LINShadowService"
+///*!< @~english Define the name of SERVICE_LINSHADOW */
+
+// #define SERVICE_RTCSHADOW "RTCShadowService"
+///*!< @~english Define the name of SERVICE_RTCSHADOW */
+
+// #define SERVICE_HBSHADOW "HBShadowService"
+///*!< @~english Define the name of SERVICE_HBSHADOW */
+
+// #define SERVICE_HBDUMMY "HBDummyService"
+///*!< @~english Define the name of SERVICE_HBDUMMY */
+
+// #define SERVICE_DISPLAYSHADOW "DisplayShadowService"
+///*!< @~english Define the name of SERVICE_DISPLAYSHADOW */
+
+// #define SERVICE_HMIALDUMMY "HMIALDummyService"
+///*!< @~english Define the name of SERVICE_HMIALDUMMY */
+
+/** @}*/ // end of peripheral_service
+/** @}*/ // end of BaseSystem
+
+#endif // PERIPHERALSERVICE__CWORD121_SHADOW_CLIENT_INCLUDE_PERIPHERAL_SERVICE_PS_SERVICES_H_ // NOLINT(build/header_guard)
diff --git a/video_in_hal/peripheralservice/communication/server/include/threads/CAN_Thread.h b/video_in_hal/peripheralservice/communication/server/include/threads/CAN_Thread.h
new file mode 100755
index 0000000..b6960ef
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/threads/CAN_Thread.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_
+#define COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_
+#include <peripheral_service/Canif_API.h>
+#include <stdlib.h>
+
+#include "com_error_type.h"
+#include "communication_communicationlog.h"
+
+#if 0
+#define CAN_TX_COMMAND_SIZE (CAN_TRX_HEADER_SIZE + CAN_TX_OPERAND_SIZE)
+
+#define CAN_RX_CANDATA_SIZE CAN_DATA_SIZE /* Receive CANData(DATA#1 ~ #x)size */
+/* Reserve the structure if it is not a multiple of 4. */
+#define CAN_TX_CANDATA_SIZE CAN_DATA_SIZE /* Send CANData(DATA#1 ~ #x)size */
+/* Reserve the structure if it is not a multiple of 4. */
+#define CAN_RX_OPERAND_SIZE (CAN_TRX_CANID_SIZE + CAN_TRX_DLC_SIZE + CAN_RX_CANDATA_SIZE)
+#define CAN_TX_OPERAND_SIZE (CAN_TRX_CANID_SIZE + CAN_TRX_DLC_SIZE + CAN_TX_CANDATA_SIZE) // NOLINT(whitespace/line_length)
+/* Send operand size */
+
+#endif
+
+#define CAN_CMDSND_DATA_SIZE 0 /* Command transmission data section size (CAN command control) */
+
+#define CAN_TX_CMD_DELIVERY_SIZE 4 /* Transmitting CAN Command Delivery Data Size Common Block */
+#define CAN_TX_CMD_FUELCALC_RST_SIZE 0 /* Transmit CAN Command Delivery Data Size CAN Section Burn Cost Reset Request Receive Data */
+#define CAN_TX_CMD_STARTUP_FIN_SIZE 3 /* Transmit CAN Command Delivery Data Size CAN Startup Completion Notification Data */
+#define CAN_TX_CMD_MRST_INFO_SIZE 33 /* Transmit CAN Command Delivery Data Size CAN Master Reset Information Notification Receive Data */
+#define CAN_TX_CMD_VERSION_SIZE 4 /* Transmit CAN Command Delivery Data Size CAN Version Response Receive Data */
+
+#define CAN_TRX_HEADER_SIZE 7 /* Size of send/receive header section (data length excluding operands) */
+#define CAN_TRX_CANID_SIZE 4 /* Transmit/Receive CAN ID Size */
+#define CAN_TRX_DLC_SIZE 1 /* Transmit/Receive DLC Data Size */
+typedef CANIF_RET_API RET_CAN;
+EFrameworkunifiedStatus CANCallbackForTimeOut(HANDLE);
+#endif // COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_ \ No newline at end of file
diff --git a/video_in_hal/peripheralservice/communication/server/include/threads/Thread_Common.h b/video_in_hal/peripheralservice/communication/server/include/threads/Thread_Common.h
new file mode 100755
index 0000000..6cda5aa
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/include/threads/Thread_Common.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef COMMUNICATION_SERVER_INCLUDE_THREADS_THREAD_COMMON_H_
+#define COMMUNICATION_SERVER_INCLUDE_THREADS_THREAD_COMMON_H_
+#include <stdint.h>
+#include <can_hal.h>
+#include <string>
+#include <sstream>
+#include <iostream>
+
+const int32_t CAN_AVAILABILITY = 0x1;
+
+void CommonInit(void);
+HANDLE CommonFindSender(HANDLE h_app, std::string s);
+BOOL CommGetAvailabilityCurrent(int32_t current);
+void CommSetAvailabilityCurrent(int32_t current);
+void CommClrAvailabilityCurrent(int32_t current);
+EFrameworkunifiedStatus CommonStartNotify(HANDLE h_app, PCSTR cmd);
+EFrameworkunifiedStatus CommonThreadStart(HANDLE h_app, const FrameworkunifiedProtocolCallbackHandler *cb,
+ UI_32 count, PCSTR cmd, EFrameworkunifiedStatus (*open_func)(HANDLE));
+EFrameworkunifiedStatus CommonThreadStop(HANDLE h_app, const PUI_32 cb, UI_32 count,
+ PCSTR cmd, EFrameworkunifiedStatus (*close_func)(HANDLE));
+EFrameworkunifiedStatus CommonCanHalErrorNotify(HANDLE h_app);
+
+static inline EFrameworkunifiedStatus ConvRet(CANHAL_RET_API ret) {
+ return ((ret != CANHAL_RET_NORMAL) ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK);
+}
+std::string MessageDataOutputLog(uint8_t *msg_data, uint32_t len);
+#endif \ No newline at end of file
diff --git a/video_in_hal/peripheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp b/video_in_hal/peripheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp
new file mode 100755
index 0000000..2ece107
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp
@@ -0,0 +1,240 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "CAN_CommWatch.h"
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <peripheral_service/Canif_API.h>
+#include <utility>
+#include <map>
+#include <string>
+#include "CAN_Thread.h"
+#include "Thread_Common.h"
+
+static CAN_CommWatchTable g_map_comm_watch_list_can;
+
+void CANCommWatchInit(void) {
+ g_map_comm_watch_list_can.clear();
+ return;
+}
+
+static CAN_CommWatchTableIt CANCommWatchFind(CANID k, CAN_COMM_WATCH_VAL *val) {
+ std::pair<CAN_CommWatchTableIt, CAN_CommWatchTableIt> range;
+ CAN_CommWatchTableIt it;
+ bool found = false;
+
+ range = g_map_comm_watch_list_can.equal_range(k);
+ for (it = range.first; it != range.second; it++) {
+ if (!memcmp(&(it->second.notify_name),
+ val->notify_name, sizeof(val->notify_name))) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ it = g_map_comm_watch_list_can.end();
+
+ return it;
+}
+
+static bool CANCommWatchInsert(CANID k, CAN_COMM_WATCH_VAL *val) {
+ CAN_CommWatchTableIt it = CANCommWatchFind(k, val);
+ CAN_CommWatchTablePair p = std::make_pair((const CANID)k, *val);
+ bool inserted = false;
+
+ if (it == g_map_comm_watch_list_can.end()) {
+ g_map_comm_watch_list_can.insert(p);
+ inserted = true;
+ }
+ return inserted;
+}
+
+static void CANCommWatchUpdate(HANDLE h_app, CANID key,
+ CAN_COMM_WATCH_VAL *val) {
+ if (CANCommWatchInsert(key, val)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch : "
+ "Entry (CANID=%x, DataID=%x, dst=%s, time=%d, cnt=%lu)",
+ key, val->data_id,
+ val->notify_name, val->set_time,
+ g_map_comm_watch_list_can.size());
+ } else {
+ CAN_CommWatchTableIt it = CANCommWatchFind(key, val);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch : Update the time "
+ "(CANID=%x, DataID=%x, dst=%s, time:%d -> %d, cnt =%lu)",
+ key, val->data_id, val->notify_name,
+ it->second.set_time, val->set_time,
+ g_map_comm_watch_list_can.size());
+ it->second.comm_watch_flag = val->comm_watch_flag;
+ it->second.set_time = val->set_time;
+ it->second.timer_cnt = val->timer_cnt;
+ it->second.data_id = val->data_id;
+ }
+
+ return;
+}
+
+static void CANCommWatchStop(HANDLE h_app, CANID key,
+ CAN_COMM_WATCH_VAL *val) {
+ CAN_CommWatchTableIt it = CANCommWatchFind(key, val);
+ if (it != g_map_comm_watch_list_can.end()) {
+ g_map_comm_watch_list_can.erase(it);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch : Stop the commwatch"
+ "(CANID=%x, dst=%s, cnt=%lu)",
+ key, val->notify_name, g_map_comm_watch_list_can.size());
+ }
+
+ return;
+}
+
+EFrameworkunifiedStatus CANCommWatch(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanCommWatch");
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_COMM_WATCHEXT_MSG_DAT rcv_msg;
+ CANID key;
+ CAN_COMM_WATCH_VAL val;
+ CAN_CommWatchTableIt it;
+
+ memset(&rcv_msg, 0, sizeof(rcv_msg));
+ memset(&val, 0, sizeof(val));
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ }
+ goto cleanup;
+ }
+
+ // Create search data
+ key = rcv_msg.ulCanid;
+ snprintf(val.notify_name, sizeof(val.notify_name), "%s", rcv_msg.notifyName);
+ val.data_id = rcv_msg.ulDid;
+ val.comm_watch_flag = CAN_COMM_NORMAL;
+ val.set_time = rcv_msg.usWatchTime;
+ val.timer_cnt = rcv_msg.usWatchTime;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "CAN CommWatch : dst=%s, CANID=%x, dataID=%x, time=%d",
+ rcv_msg.notifyName,
+ rcv_msg.ulCanid,
+ rcv_msg.ulDid, rcv_msg.usWatchTime);
+
+ if (0 == rcv_msg.usWatchTime) {
+ CANCommWatchStop(h_app, key, &val);
+ } else {
+ CANCommWatchUpdate(h_app, key, &val);
+ }
+ e_status = eFrameworkunifiedStatusOK;
+cleanup:
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANCommWatchSndMsg(HANDLE h_app,
+ CAN_COMM_WATCH_VAL *v, uint32_t cid) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_MSG_COMM_WATCHSTS msg;
+ HANDLE h_client = NULL;
+
+ memset(&msg, 0, sizeof(msg));
+ msg.hdr.hdr.cid = (uint16_t)cid;
+ msg.hdr.hdr.msgbodysize = sizeof(CAN_MSG_COMM_WATCHSTS_DAT);
+ msg.hdr.hdr.rid = 0;
+ msg.data.ulDid = v->data_id;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%x ulDid=%x",
+ msg.hdr.hdr.cid, msg.hdr.hdr.msgbodysize, msg.data.ulDid);
+
+ h_client = CommonFindSender(h_app, v->notify_name);
+ if (!h_client){
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CommonFindSender failed");
+ goto cleanup;
+ }
+
+ e_status = FrameworkunifiedSendMsg(h_client, cid, sizeof(msg), &msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__,
+ "FrameworkunifiedSendMSg Error(e_status:%d to %s)",
+ e_status, v->notify_name);
+ goto cleanup;
+ }
+
+ e_status = eFrameworkunifiedStatusOK;
+cleanup:
+ return e_status;
+}
+
+static void CANCommWatchTimeoutCore(HANDLE h_app, CAN_COMM_WATCH_VAL *v) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+
+ if (CAN_COMM_NORMAL != v->comm_watch_flag)
+ return;
+
+ if (v->timer_cnt != 0)
+ v->timer_cnt--;
+
+ if (v->timer_cnt != 0)
+ return;
+
+ e_status = CANCommWatchSndMsg(h_app, v, CID_CAN_COMM_STOP);
+ if (eFrameworkunifiedStatusOK == e_status) {
+ v->comm_watch_flag = CAN_COMM_STOP;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CANCommWatchSndMsg failed");
+ // retry at next timeout.
+ }
+}
+
+EFrameworkunifiedStatus CANCommWatchTimeout(HANDLE h_app) {
+ CAN_CommWatchTableIt it;
+
+ for (it = g_map_comm_watch_list_can.begin();
+ it != g_map_comm_watch_list_can.end(); it++) {
+ CANCommWatchTimeoutCore(h_app, &(it->second));
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static void CANCommWatchClearCore(HANDLE h_app, CANID id,
+ CAN_COMM_WATCH_VAL *v) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+
+ v->timer_cnt = v->set_time;
+
+ if (CAN_COMM_STOP != v->comm_watch_flag)
+ return;
+
+ e_status = CANCommWatchSndMsg(h_app, v, CID_CAN_COMM_RESTORE);
+ if (eFrameworkunifiedStatusOK == e_status) {
+ v->comm_watch_flag = CAN_COMM_NORMAL;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch Clear : CANID=%x", id);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CANCommWatchSndMsg failed");
+ // retry at next timeout.
+ }
+}
+
+void CANCommWatchClear(HANDLE h_app, CANID id) {
+ std::pair<CAN_CommWatchTableIt, CAN_CommWatchTableIt> range;
+ CAN_CommWatchTableIt it;
+
+ range = g_map_comm_watch_list_can.equal_range(id);
+ for (it = range.first; it != range.second; it++) {
+ CANCommWatchClearCore(h_app, id, &(it->second));
+ }
+}
diff --git a/video_in_hal/peripheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp b/video_in_hal/peripheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp
new file mode 100755
index 0000000..b991431
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp
@@ -0,0 +1,405 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "CAN_Delivery.h"
+
+#include <can_hal.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <peripheral_service/Canif_API.h>
+#include <can_hal.h>
+#include <utility>
+#include <map>
+#include <string>
+#include "CAN_TxMsg.h"
+#include "CAN_CommWatch.h"
+#include "Canif_API_Local.h"
+#include "API_Local_Common.h"
+#include "Thread_Common.h"
+
+static CAN_DeliveryEntryList g_map_delivery_list_can;
+// Member of g_msg_rx_msg exist as long as communication exists.
+static std::map<CANID, CanMessage *> g_can_rx_msg;
+
+void CANDeliveryInit(void) {
+ g_map_delivery_list_can.clear();
+ return;
+}
+
+static CanMessage *CANMsgFind(CANID k) {
+ std::map<CANID, CanMessage *>::iterator it;
+
+ it = g_can_rx_msg.find(k);
+ if (it == g_can_rx_msg.end())
+ return NULL;
+ return it->second;
+}
+
+static void CANMsgInsert(CANID k, CanMessage *msg) {
+ CanMessage *latest = CANMsgFind(k);
+ if (!latest) {
+ latest = new CanMessage();
+ }
+ g_can_rx_msg[k] = latest;
+ memcpy(latest, msg, sizeof(CanMessage));
+}
+
+static CAN_DeliveryEntryListIt CANDeliveryFind(CANID canid, std::string s) {
+ std::pair<CAN_DeliveryEntryListIt, CAN_DeliveryEntryListIt> range;
+ CAN_DeliveryEntryListPair p = std::make_pair(canid, s);
+ CAN_DeliveryEntryListIt it;
+ bool found = false;
+ range = g_map_delivery_list_can.equal_range(canid);
+ for (it = range.first; it != range.second; ++it) {
+ if (*it == p) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ it = g_map_delivery_list_can.end();
+
+ return it;
+}
+
+bool CANDeliveryInsert(CANID canid, std::string s) {
+ CAN_DeliveryEntryListIt it = CANDeliveryFind(canid, s);
+ CAN_DeliveryEntryListPair p = std::make_pair(canid, s);
+ bool inserted = false;
+
+ if (it == g_map_delivery_list_can.end()) {
+ g_map_delivery_list_can.insert(p);
+ inserted = true;
+ }
+
+ return inserted;
+}
+
+static EFrameworkunifiedStatus CANDeliverySndCmdSingle(HANDLE h_app, CANID cmd,
+ CanMessage *msg, std::string dest) {
+ CAN_MSG_CANCMD st_delivery_msg;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ HANDLE h_client;
+ uint16_t len = 0;
+
+ // Create delivery data
+ memset(&st_delivery_msg, 0, sizeof(st_delivery_msg));
+ switch (cmd) {
+ case CAN_CMDID_FUELCALC_RST_REQ_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_FUELCALC_RST_SIZE;
+ break;
+ case CAN_CMDID_STARTUP_FIN_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_STARTUP_FIN_SIZE;
+ break;
+ case CAN_CMDID_MRST_INFO_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_MRST_INFO_SIZE;
+ break;
+ case CAN_CMDID_VERSION_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_VERSION_SIZE;
+ break;
+ case CAN_CMDID_CONNECTION_NODE_RESP_RX:
+ len = (uint16_t)(CAN_TX_CMD_DELIVERY_SIZE + msg->data[0] + 1);
+ break;
+ default:
+ return e_status;
+ }
+ st_delivery_msg.hdr.hdr.rid = 0;
+ st_delivery_msg.hdr.hdr.cid = (uint16_t)CID_CAN_CMD_DELIVERY;
+ st_delivery_msg.hdr.hdr.msgbodysize = len;
+ st_delivery_msg.data.cmd_id = (uint8_t)cmd;
+ memcpy(&st_delivery_msg.data.data, msg->data,
+ (size_t)(len - CAN_TX_CMD_DELIVERY_SIZE));
+
+ h_client = CommonFindSender(h_app, dest);
+ if (!h_client) {
+ return e_status;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%x cmd_id=%x",
+ st_delivery_msg.hdr.hdr.cid, st_delivery_msg.hdr.hdr.msgbodysize,
+ st_delivery_msg.data.cmd_id);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(st_delivery_msg.data.data, len).c_str());
+
+ e_status = FrameworkunifiedSendMsg(h_client, CID_CAN_CMD_DELIVERY,
+ sizeof(st_delivery_msg), &st_delivery_msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)",
+ e_status, dest.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "CAN Delivery : dst = %s, CMD = %x, DLC = %x",
+ dest.c_str(), cmd, msg->dlc);
+ }
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANDeliverySndMsgSingle(HANDLE h_app, CANID ul_canid,
+ uint8_t uc_dlc, const uint8_t *puc_data,
+ enum CanIfEchoBackFlags flag, std::string dest) {
+ CAN_MSG_CANDATA st_delivery_msg;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ HANDLE h_client;
+ uint8_t uc_size = uc_dlc;
+
+ // Create delivery data
+ memset(&st_delivery_msg, 0, sizeof(st_delivery_msg));
+ st_delivery_msg.hdr.hdr.cid = CID_CAN_DATA_DELIVERY;
+ st_delivery_msg.hdr.hdr.msgbodysize = (uint16_t)(CAN_TRX_CANID_SIZE +
+ CAN_TRX_DLC_SIZE +
+ (uint32_t)uc_size);
+ st_delivery_msg.hdr.hdr.rid = 0;
+ st_delivery_msg.data.can_id = ul_canid;
+ st_delivery_msg.data.dlc = uc_size;
+ st_delivery_msg.echoback = flag;
+ if (uc_size > (uint8_t)CAN_DATA_SIZE)
+ uc_size = CAN_DATA_SIZE;
+ memcpy(st_delivery_msg.data.data, puc_data, (size_t)uc_size);
+
+ h_client = CommonFindSender(h_app, dest);
+ if (!h_client) {
+ return e_status;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "can_id=%x dlc=%x echoback=%d",
+ st_delivery_msg.data.can_id, st_delivery_msg.data.dlc,
+ st_delivery_msg.echoback);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(st_delivery_msg.data.data, uc_size).c_str());
+
+ e_status = FrameworkunifiedSendMsg(h_client, CID_CAN_DATA_DELIVERY,
+ sizeof(st_delivery_msg), &st_delivery_msg);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)",
+ e_status, dest.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "CAN Delivery : dst = %s, CANID = %x, DLC = %x",
+ dest.c_str(), ul_canid, uc_dlc);
+ }
+ return e_status;
+}
+
+EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanRecv");
+
+ uint16_t i;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ CAN_DELIVERY_ENTRY rcv_msg;
+ CAN_DeliveryEntryListIt it;
+ bool fail = false;
+
+ memset(&rcv_msg, 0, sizeof(rcv_msg));
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg,
+ sizeof(rcv_msg), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__,
+ "CAN DeliveryEntry FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ }
+ goto cleanup;
+ }
+
+ for (i = 0; i < rcv_msg.usCanNum; i++) {
+ CANID canid = rcv_msg.ulCanid[i];
+ CanMessage *latest = CANMsgFind(canid);
+
+ if (CANDeliveryInsert(canid, rcv_msg.notifyName)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "(cnd:%lu) : CANID=0x%x, dst=%s",
+ g_map_delivery_list_can.size(), canid, rcv_msg.notifyName);
+ }
+
+ if (latest) {
+ switch (canid) {
+ case CAN_CMDID_FUELCALC_RST_REQ_RX:
+ case CAN_CMDID_STARTUP_FIN_RESP_RX:
+ case CAN_CMDID_MRST_INFO_RESP_RX:
+ case CAN_CMDID_VERSION_RESP_RX:
+ case CAN_CMDID_CONNECTION_NODE_RESP_RX:
+ if (eFrameworkunifiedStatusOK != CANDeliverySndCmdSingle(h_app, canid,
+ latest, rcv_msg.notifyName)) {
+ fail = true;
+ }
+ break;
+ default:
+ if (eFrameworkunifiedStatusOK != CANDeliverySndMsgSingle(h_app, canid,
+ static_cast<uint8_t>(latest->dlc),
+ latest->data, CANIF_PURERECV, rcv_msg.notifyName)) {
+ fail = true;
+ }
+ break;
+ }
+ }
+ }
+
+ if (fail)
+ e_status = eFrameworkunifiedStatusFail;
+
+cleanup:
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANDeliverySndMsgToClient(HANDLE h_app, CANID ul_canid,
+ void *data, size_t size, PS_CommunicationProtocol cid) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ HANDLE h_client = NULL;
+ CAN_DeliveryEntryListIt it;
+ std::pair<CAN_DeliveryEntryListIt, CAN_DeliveryEntryListIt> range;
+ bool fail = false;
+
+ it = g_map_delivery_list_can.find(ul_canid);
+ range = g_map_delivery_list_can.equal_range(ul_canid);
+ for (it = range.first; it != range.second; ++it) {
+ h_client = CommonFindSender(h_app, it->second);
+ if (!h_client) {
+ continue;
+ }
+
+ e_status = FrameworkunifiedSendMsg(h_client, cid, (UI_32)size, data);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)",
+ e_status, it->second.c_str());
+ fail = true;
+ }
+ }
+ return fail ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CANDeliverySndMsg(HANDLE h_app, CANID ul_canid, uint8_t n_ta,
+ uint8_t uc_dlc, const uint8_t *puc_data,
+ PS_CommunicationProtocol cid, enum CanIfEchoBackFlags flag) {
+ CAN_MSG_CANDATA st_delivery_msg;
+ uint8_t uc_size = uc_dlc;
+
+ // Create delivery data
+ memset(&st_delivery_msg, 0, sizeof(st_delivery_msg));
+ st_delivery_msg.hdr.hdr.cid = cid;
+ st_delivery_msg.hdr.hdr.msgbodysize = (uint16_t)(CAN_TRX_CANID_SIZE +
+ CAN_TRX_DLC_SIZE +
+ (uint32_t)uc_size);
+ st_delivery_msg.hdr.hdr.rid = 0;
+ st_delivery_msg.data.can_id = ul_canid;
+ st_delivery_msg.data.dlc = uc_size;
+ st_delivery_msg.echoback = flag;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "can_id=%x dlc=%x echoback=%d",
+ st_delivery_msg.data.can_id, st_delivery_msg.data.dlc,
+ st_delivery_msg.echoback);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(st_delivery_msg.data.data, uc_size).c_str());
+
+
+ if (uc_size > (uint8_t)CAN_DATA_SIZE)
+ uc_size = CAN_DATA_SIZE;
+ memcpy(st_delivery_msg.data.data, puc_data, (size_t)uc_size);
+
+ return CANDeliverySndMsgToClient(h_app, ul_canid, &st_delivery_msg,
+ sizeof(st_delivery_msg), cid);
+}
+
+EFrameworkunifiedStatus CANCommandDeliveryRcvProcess(HANDLE h_app,
+ CanMessage *msg, uint8_t cmd) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_MSG_CANCMD st_delivery_msg;
+ uint16_t len = 0;
+
+ memset(&st_delivery_msg, 0, sizeof(st_delivery_msg));
+ switch (cmd) {
+ case CAN_CMDID_FUELCALC_RST_REQ_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_FUELCALC_RST_SIZE;
+ break;
+ case CAN_CMDID_STARTUP_FIN_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_STARTUP_FIN_SIZE;
+ break;
+ case CAN_CMDID_MRST_INFO_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_MRST_INFO_SIZE;
+ break;
+ case CAN_CMDID_VERSION_RESP_RX:
+ len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_VERSION_SIZE;
+ break;
+ case CAN_CMDID_CONNECTION_NODE_RESP_RX:
+ len = (uint16_t)(CAN_TX_CMD_DELIVERY_SIZE + msg->data[0] + 1);
+ break;
+ default:
+ return e_status;
+ }
+ st_delivery_msg.hdr.hdr.rid = 0;
+ st_delivery_msg.hdr.hdr.cid = (uint16_t)CID_CAN_CMD_DELIVERY;
+ st_delivery_msg.hdr.hdr.msgbodysize = len;
+ st_delivery_msg.data.cmd_id = cmd;
+ memcpy(&st_delivery_msg.data.data, msg->data,
+ (size_t)(len - CAN_TX_CMD_DELIVERY_SIZE));
+ CANMsgInsert(cmd, msg);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%x cmd_id=%x",
+ st_delivery_msg.hdr.hdr.cid, st_delivery_msg.hdr.hdr.msgbodysize,
+ st_delivery_msg.data.cmd_id);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(st_delivery_msg.data.data, len).c_str());
+
+ return CANDeliverySndMsgToClient(h_app, msg->can_id, &st_delivery_msg,
+ sizeof(st_delivery_msg), CID_CAN_CMD_DELIVERY);
+}
+
+EFrameworkunifiedStatus CANDeliveryRcvProcess(HANDLE h_app, CanMessage *msg) {
+ if (!Canif_CheckCanID(msg->can_id)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CANID is invalid (%x)", msg->can_id);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ CANCommWatchClear(h_app, msg->can_id);
+ CANMsgInsert(msg->can_id, msg);
+ if (eFrameworkunifiedStatusOK != CANDeliverySndMsg(h_app, msg->can_id, CAN_NTA_INVALID,
+ (uint8_t)msg->dlc, msg->data, CID_CAN_DATA_DELIVERY)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CAN Delivery Error");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CANClearEntry(HANDLE h_app) {
+ char notify_name[CANIF_NOTIFY_NAME_MAX_SIZE + 1] = {0};
+ CAN_DeliveryEntryListIt it;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &notify_name,
+ CANIF_NOTIFY_NAME_MAX_SIZE, eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__,
+ "#CAN thread# FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ }
+ return e_status;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "notify_name=%s", notify_name);
+
+ // To avoid destruction of iterator.
+ it = g_map_delivery_list_can.begin();
+ while (it != g_map_delivery_list_can.end()) {
+ size_t n = strnlen(it->second.c_str(), CANIF_NOTIFY_NAME_MAX_SIZE);
+ if (!strncmp(it->second.c_str(), notify_name, n)) {
+ g_map_delivery_list_can.erase(it++);
+ } else {
+ ++it;
+ }
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/peripheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp b/video_in_hal/peripheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp
new file mode 100755
index 0000000..fa5d61d
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp
@@ -0,0 +1,416 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "CAN_TxMsg.h"
+#include "CAN_Delivery.h"
+#include <string.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <peripheral_service/Canif_API.h>
+#include <can_hal.h>
+#include <map>
+#include <string>
+#include "CAN_Thread.h"
+#include "Thread_Common.h"
+#include "Canif_API_Local.h"
+#include "CAN_TxMsg.h"
+#include "Canif_TransmissionData.h"
+
+static std::map<CANID, CAN_SEND_STATUS_DAT> g_m_send_sts;
+static bool can_cmd_rst_rcv = false;
+static std::map<CANID, CAN_TRANS_START_TABLE_VAL *> g_map_trans_data;
+
+void CANTxMsgInit(void) {
+ g_m_send_sts.clear();
+ uint32_t i;
+
+ for (i = 0; i < _countof(Can_TransInitData_21PF); i++) {
+ CANID canid = Can_TransInitData_21PF[i].canid;
+ CAN_TRANS_START_TABLE_VAL *val = &(Can_TransInitData_21PF[i].val);
+ g_map_trans_data[canid] = val;
+ }
+
+ return;
+}
+
+static bool CANCommandFuelCalcRstReqCheck(void) {
+ return can_cmd_rst_rcv;
+}
+
+void CANCommandSetFuelCalcRstReq(void) {
+ can_cmd_rst_rcv = true;
+}
+
+static void CANTxMsgErrorLog(const char *reason, const char *func,
+ CANID id, uint16_t len, HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, func, "%s Frame(0x%x) length=%hu from %s is ignored.",
+ reason, id, len, FrameworkunifiedGetMsgSrc(h_app));
+}
+
+static EFrameworkunifiedStatus CANCommandResponse(HANDLE h_app, CAN_MSG_CANCMD *msg,
+ size_t len, char *notifyName) {
+ HANDLE h_client = NULL;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+
+ h_client = CommonFindSender(h_app, notifyName);
+ if (!h_client) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Cannot open sender handle.");
+ return e_status;
+ }
+
+ msg->hdr.hdr.cid = (uint16_t)CID_CAN_CMD_DELIVERY;
+ e_status = FrameworkunifiedSendMsg(h_client, CID_CAN_CMD_DELIVERY, (uint32_t)len, msg);
+ if (e_status != eFrameworkunifiedStatusOK)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg is failed.");
+
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANCommandVersionReq(HANDLE h_app, char *notifyName) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CANHAL_RET_API ret = CANHAL_RET_NORMAL;
+ std::string version_info;
+ CAN_MSG_CANCMD msg;
+
+ memset(&msg, 0, sizeof(msg));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "@@@ Call CanGetVersion for can_hal");
+ ret = CanGetVersion(h_app, &version_info);
+ if (ret != CANHAL_RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Cannot get version from can_hal.");
+ return e_status;
+ }
+
+ if (CAN_TX_CMD_VERSION_SIZE != version_info.length()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid length of version.");
+ return e_status;
+ }
+
+ msg.hdr.hdr.rid = 0;
+ msg.hdr.hdr.msgbodysize = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_VERSION_SIZE;
+ msg.data.cmd_id = CAN_CMDID_VERSION_RESP_RX;
+ strncpy((char *)msg.data.data, version_info.c_str(), CAN_TX_CMD_VERSION_SIZE);
+ return CANCommandResponse(h_app, &msg, sizeof(msg), notifyName);
+}
+
+static EFrameworkunifiedStatus CANCommandFuelcalcRstReq(HANDLE h_app, char *notifyName) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ if (CANCommandFuelCalcRstReqCheck()) {
+ // CAN_CMDID_FUELCALC_RST_REQ_RX is already received from can_hal.
+ // so response it in direct.
+ CAN_MSG_CANCMD msg;
+ memset(&msg, 0, sizeof(msg));
+ msg.hdr.hdr.rid = 0;
+ msg.hdr.hdr.msgbodysize = CAN_TX_CMD_DELIVERY_SIZE +
+ CAN_TX_CMD_FUELCALC_RST_SIZE;
+ msg.data.cmd_id = CAN_CMDID_FUELCALC_RST_REQ_RX;
+ e_status = CANCommandResponse(h_app, &msg, sizeof(msg), notifyName);
+ } else {
+ CANDeliveryInsert(CAN_CMDID_FUELCALC_RST_REQ_RX, notifyName);
+ e_status = eFrameworkunifiedStatusOK;
+ }
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANCommandOther(HANDLE h_app, char *notifyName,
+ uint8_t cmd, uint8_t rid) {
+ CanMessage msg;
+ CANID wait = 0;
+ CANID can_id = (CANID)cmd;
+
+ memset(&msg, 0, sizeof(msg));
+ switch (cmd) {
+ case CAN_CMDID_STARTUP_FIN_REQ_TX:
+ wait = CAN_CMDID_STARTUP_FIN_RESP_RX;
+ break;
+ case CAN_CMDID_MRST_INFO_REQ_TX:
+ wait = CAN_CMDID_MRST_INFO_RESP_RX;
+ break;
+ case CAN_CMDID_CONNECTION_NODE_REQ_TX:
+ wait = CAN_CMDID_CONNECTION_NODE_RESP_RX;
+ break;
+ case CAN_CMDID_FUELCALC_REQ_TX:
+ wait = CAN_CMDID_FUELCALC_RST_REQ_RX;
+ break;
+ default:
+ CANTxMsgErrorLog("Unsupported cmd requested", __func__, cmd, 0, h_app);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (cmd != CAN_CMDID_FUELCALC_REQ_TX) {
+ CANDeliveryInsert(wait, notifyName);
+ }
+
+ if (rid != CAN_RID_NOTUSE_CODE) {
+ // cmd can be assumed same as can_id.
+ if (0 < g_m_send_sts.count(can_id)) {
+ if (g_m_send_sts[can_id].notify_name[0] != 0x00) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "Not yet deliver SendSts but updated(SendID=%x, CAN ID=%x, Nane=%s)",
+ g_m_send_sts[can_id].rid, can_id, g_m_send_sts[can_id].notify_name);
+ }
+ }
+ g_m_send_sts[can_id].rid = rid;
+ memcpy(g_m_send_sts[can_id].notify_name, notifyName,
+ sizeof(g_m_send_sts[can_id].notify_name));
+ }
+
+ msg.can_id = (CANID)cmd;
+ msg.rid = rid;
+ msg.dlc = (uint8_t)CAN_CMDSND_DATA_SIZE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "@@@ Call CanSend for can_hal");
+ if (CANHAL_RET_NORMAL != CanSend(h_app, &msg, CAN_HAL_TYPE_CAN)) {
+ CANTxMsgErrorLog("CAN CanSend failed", __func__, msg.can_id,
+ (uint16_t)msg.dlc, h_app);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CANTxMsgCommand(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanCommandCtl");
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_CMD_CTRL_MSG_DAT rcv_msg;
+
+ memset(&rcv_msg, 0, sizeof(rcv_msg));
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize)
+ FrameworkunifiedClearMsgData(h_app);
+ return e_status;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "notify_name=%s ulEvtId=%x ucRid=%x ucCmdid=%x",
+ rcv_msg.notifyName, rcv_msg.ulEvtId, rcv_msg.ucRid, rcv_msg.ucCmdid);
+
+ switch (rcv_msg.ucCmdid) {
+ case CAN_CMDID_VERSION_REQ_TX:
+ e_status = CANCommandVersionReq(h_app, rcv_msg.notifyName);
+ break;
+ case CAN_CMDID_FUELCALC_RST_REQ_DELIVERY:
+ e_status = CANCommandFuelcalcRstReq(h_app, rcv_msg.notifyName);
+ break;
+ default:
+ e_status = CANCommandOther(h_app,
+ rcv_msg.notifyName, rcv_msg.ucCmdid, rcv_msg.ucRid);
+ break;
+ }
+ return e_status;
+}
+
+static CAN_TRANS_START_TABLE_VAL *CANTxMsgFindMap(CAN_TRANS_START_MSG_DAT *msg) {
+ std::map<CANID, CAN_TRANS_START_TABLE_VAL *>::iterator it;
+ it = g_map_trans_data.find(msg->id);
+ if (it == g_map_trans_data.end())
+ return NULL;
+ return it->second;
+}
+
+static CAN_TRANS_START_TABLE_VAL *CanSendFind(CAN_TRANS_START_MSG_DAT *msg) {
+ return CANTxMsgFindMap(msg);
+}
+
+EFrameworkunifiedStatus CANTxMsgBit(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanSend(bit)");
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_TRANS_START_MSG_DAT rcv_msg;
+ CanMessage snd_msg;
+ CAN_TRANS_START_TABLE_VAL *store;
+ int32_t i = 0;
+ uint8_t *store_p;
+ uint8_t *data_p;
+ uint8_t *mask_p;
+
+ memset(&rcv_msg, 0, sizeof(rcv_msg));
+ memset(&snd_msg, 0, sizeof(snd_msg));
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize)
+ FrameworkunifiedClearMsgData(h_app);
+ goto cleanup;
+ }
+
+ e_status = eFrameworkunifiedStatusFail;
+
+ if (TRUE != CommGetAvailabilityCurrent(CAN_AVAILABILITY)) {
+ CANTxMsgErrorLog("CAN is not ready", __func__, 0, 0, h_app);
+ goto cleanup;
+ }
+
+ store = CanSendFind(&rcv_msg);
+ if (!store) {
+ CANTxMsgErrorLog("No initial value", __func__,
+ rcv_msg.id, sizeof(rcv_msg.dat), h_app);
+ goto cleanup;
+ }
+
+ store_p = store->dat.dat;
+ data_p = rcv_msg.dat.dat;
+ mask_p = rcv_msg.mask.dat;
+ for (i = 0; i < store->dlc; i++) {
+ *store_p &= (uint8_t)(~(*mask_p));
+ *store_p |= ((*mask_p) & (*data_p));
+ ++store_p;
+ ++data_p;
+ ++mask_p;
+ }
+
+ snd_msg.can_id = rcv_msg.id;
+ snd_msg.dlc = store->dlc;
+ snd_msg.rid = CAN_RID_NOTUSE_CODE;
+ memcpy(snd_msg.data, store->dat.dat, snd_msg.dlc);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "@@@ Call CanSend for can_hal : "
+ "can_id=%x dlc=%d rid=%x", snd_msg.can_id, snd_msg.dlc, snd_msg.rid);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(snd_msg.data, snd_msg.dlc).c_str());
+
+ if (CANHAL_RET_NORMAL != CanSend(h_app, &snd_msg, CAN_HAL_TYPE_CAN)) {
+ CANTxMsgErrorLog("CAN CanSend failed", __func__, snd_msg.can_id,
+ (uint16_t)snd_msg.dlc, h_app);
+ goto cleanup;
+ }
+
+ // echoback
+ e_status = CANDeliverySndMsg(h_app, snd_msg.can_id, 0, (uint8_t)snd_msg.dlc,
+ (const uint8_t *)snd_msg.data,
+ CID_CAN_DATA_DELIVERY, CANIF_ECHOBACK);
+cleanup:
+ return e_status;
+}
+
+EFrameworkunifiedStatus CANTxMsg(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanSend");
+
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ CAN_TRANSMISSION_START_MSG_DAT rcv_msg;
+ CanMessage snd_msg;
+ memset(&rcv_msg, 0, sizeof(rcv_msg));
+ memset(&snd_msg, 0, sizeof(snd_msg));
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status);
+ if (e_status == eFrameworkunifiedStatusInvldBufSize)
+ FrameworkunifiedClearMsgData(h_app);
+ goto cleanup;
+ }
+
+ e_status = eFrameworkunifiedStatusFail;
+
+ if (TRUE != CommGetAvailabilityCurrent(CAN_AVAILABILITY)) {
+ CANTxMsgErrorLog("CAN is not ready", __func__, 0, 0, h_app);
+ goto cleanup;
+ }
+
+ snd_msg.can_id = rcv_msg.stCandata.can_id;
+ snd_msg.dlc = rcv_msg.stCandata.dlc;
+ snd_msg.rid = rcv_msg.ucRid;
+ memcpy(snd_msg.data, rcv_msg.stCandata.data, snd_msg.dlc);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "@@@ Call CanSend for can_hal : "
+ "can_id=%x dlc=%d rid=%x", snd_msg.can_id, snd_msg.dlc, snd_msg.rid);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(snd_msg.data, snd_msg.dlc).c_str());
+
+ if (CANHAL_RET_NORMAL != CanSend(h_app, &snd_msg, CAN_HAL_TYPE_CAN)) {
+ CANTxMsgErrorLog("CAN CanSend failed", __func__, snd_msg.can_id,
+ (uint16_t)snd_msg.dlc, h_app);
+ goto cleanup;
+ }
+
+ // echoback
+ e_status = CANDeliverySndMsg(h_app, snd_msg.can_id, 0, (uint8_t)snd_msg.dlc,
+ (const uint8_t *)snd_msg.data,
+ CID_CAN_DATA_DELIVERY, CANIF_ECHOBACK);
+ if (rcv_msg.ucRid == (uint8_t)CAN_RID_NOTUSE_CODE)
+ goto cleanup;
+
+ if (0 < g_m_send_sts.count(snd_msg.can_id)) {
+ if (g_m_send_sts[snd_msg.can_id].notify_name[0] != 0x00) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__,
+ "Not yet deliver SendSts but updated(SendID=%x, CAN ID=%x, Nane=%s)",
+ g_m_send_sts[snd_msg.can_id].rid, snd_msg.can_id,
+ g_m_send_sts[snd_msg.can_id].notify_name);
+ }
+ }
+
+ g_m_send_sts[snd_msg.can_id].rid = rcv_msg.ucRid;
+ memcpy(g_m_send_sts[snd_msg.can_id].notify_name,
+ rcv_msg.notifyName,
+ sizeof(g_m_send_sts[snd_msg.can_id].notify_name));
+cleanup:
+ return e_status;
+}
+
+EFrameworkunifiedStatus CANSndStsProcess(HANDLE h_app, CanSendResult *rcv_msg,
+ PS_CommunicationProtocol cid) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ CAN_MSG_SENDSTS snd_msg;
+ CANID can_id = rcv_msg->can_id;
+ HANDLE sender = NULL;
+ memset(&snd_msg, 0, sizeof(snd_msg));
+
+ if (0 == g_m_send_sts.count(can_id))
+ goto cleanup;
+
+ if (0x00 == (g_m_send_sts[can_id].notify_name[0]))
+ goto cleanup;
+
+ if (rcv_msg->rid != g_m_send_sts[can_id].rid)
+ goto cleanup;
+
+ snd_msg.hdr.hdr.cid = (uint16_t)cid;
+ snd_msg.hdr.hdr.msgbodysize = (uint16_t)(sizeof(snd_msg.data));
+ snd_msg.hdr.hdr.rid = rcv_msg->rid;
+ snd_msg.data.ulCanid = can_id;
+ snd_msg.data.ucStatus =
+ (CAN_SEND_RESULT_SUCCESS == rcv_msg->result) ? CAN_SUCCESS : CAN_RETRYOUT;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%d rid=%x can_id=%x ucStatus=%x",
+ snd_msg.hdr.hdr.cid, snd_msg.hdr.hdr.msgbodysize, snd_msg.hdr.hdr.rid,
+ snd_msg.data.ulCanid, snd_msg.data.ucStatus);
+
+ sender = CommonFindSender(h_app, g_m_send_sts[can_id].notify_name);
+ if (!sender) {
+ CANTxMsgErrorLog("Could not open sender.", __func__, can_id,
+ sizeof(snd_msg), h_app);
+ goto cleanup;
+ }
+
+ e_status = FrameworkunifiedSendMsg(sender, cid, sizeof(snd_msg), &snd_msg);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)",
+ e_status, g_m_send_sts[can_id].notify_name);
+ g_m_send_sts[can_id].notify_name[0] = 0x00;
+ g_m_send_sts[can_id].rid = 0x00;
+ goto cleanup;
+ }
+ g_m_send_sts[can_id].notify_name[0] = 0x00;
+ g_m_send_sts[can_id].rid = 0x00;
+
+ e_status = eFrameworkunifiedStatusOK;
+cleanup:
+ return e_status;
+}
diff --git a/video_in_hal/peripheralservice/communication/server/src/main/communication_application.cpp b/video_in_hal/peripheralservice/communication/server/src/main/communication_application.cpp
new file mode 100755
index 0000000..7240cdb
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/src/main/communication_application.cpp
@@ -0,0 +1,226 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file has been generated automatically.
+ * User hand written code entry is allowed only inside protected zones.
+ */
+
+/*
+ * This file has been generated automatically.
+ * User hand written code entry is allowed only inside protected zones.
+ */
+
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <peripheral_service/communication_notifications.h>
+#include <peripheral_service/Canif_API.h>
+#include <stdio.h>
+#include <signal.h>
+#include <string>
+#include <sstream>
+#include <iostream>
+#include "communication_cid.h"
+#include "communication_communicationlog.h"
+#include "Thread_Common.h"
+
+extern EFrameworkunifiedStatus CANThreadStart(HANDLE h_app);
+extern EFrameworkunifiedStatus CANThreadStop(HANDLE h_app);
+
+HANDLE g_can_thread = NULL;
+
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ CommonInit();
+
+ // API to Register Notification for Service Availability.
+ e_status = FrameworkunifiedRegisterServiceAvailabilityNotification(h_app,
+ NTFY_Communication_Availability);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to Register Service Availability Notification.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "Service Availability Notification registered successfully.");
+ }
+
+ // API to Publish Service Availability Notification.
+ e_status = FrameworkunifiedPublishServiceAvailability(h_app, FALSE);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to Publish Service Availability Notification.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "Service Availability Notification published successfully.");
+ }
+
+ g_can_thread = FrameworkunifiedCreateChildThread(h_app, LAN_SERVICE_CAN,
+ CANThreadStart, CANThreadStop);
+ if (g_can_thread == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to create CAN");
+ }
+
+ // API to Publish Service Availability Notification.
+ e_status = FrameworkunifiedPublishServiceAvailability(h_app, TRUE);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to Publish Service Availability Notification.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "Service Availability Notification published successfully.");
+ }
+
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnWakeup(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CommThreadCheckAndStart(HANDLE p, HANDLE c,
+ UI_32 len, PCVOID data, BOOL current) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ if (TRUE != current) {
+ e_status = FrameworkunifiedStartChildThread(p, c, len, data);
+ }
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CommThreadCheckAndStop(HANDLE p, HANDLE c,
+ UI_32 len, PCVOID data, BOOL current) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ if (TRUE == current) {
+ e_status = FrameworkunifiedStopChildThread(p, c, len, data);
+ }
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]");
+
+ e_status = CommThreadCheckAndStart(h_app, g_can_thread,
+ 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY));
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Fail to Start CAN Thread. Status:%#x", e_status);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]");
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ e_status = CommThreadCheckAndStop(h_app, g_can_thread,
+ 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY));
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Fail to Stop CAN Thread. Status:%#x", e_status);
+ } else {
+ g_can_thread = NULL;
+ }
+
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]");
+
+ e_status = CommThreadCheckAndStart(h_app, g_can_thread,
+ 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY));
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Fail to Start CAN Thread. Status:%#x", e_status);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]");
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]");
+
+ e_status = CommThreadCheckAndStart(h_app, g_can_thread,
+ 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY));
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Fail to Start CAN Thread. Status:%#x", e_status);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]");
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]");
+ return e_status;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]");
+ return e_status;
+}
+
+std::string MessageDataOutputLog(uint8_t *msg_data, uint32_t len){
+ std::string data_log;
+ int data_buf;
+ for(uint32_t i = 0; i < len; i++){
+ std::ostringstream ss;
+ data_buf = (int)msg_data[i];
+ ss << std::hex << data_buf;
+ data_log = ss.str() + " " + data_log;
+ }
+ return data_log;
+}
diff --git a/video_in_hal/peripheralservice/communication/server/src/main/communication_main.cpp b/video_in_hal/peripheralservice/communication/server/src/main/communication_main.cpp
new file mode 100755
index 0000000..39daae1
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/src/main/communication_main.cpp
@@ -0,0 +1,154 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <errno.h>
+#include <sys/timerfd.h>
+#include <unistd.h>
+#include <poll.h>
+
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_multithreading.h>
+
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_system_if.h>
+#include <system_service/ss_sm_client_if.h>
+#include "communication_communicationlog.h"
+#include "communication_version.h"
+#include "communication_cid.h"
+
+#include "CAN_Thread.h"
+#include "Thread_Common.h"
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31},
+ FRAMEWORKUNIFIEDLOGZONES};
+
+extern HANDLE g_can_thread;
+static bool capture_log_flg = FALSE;
+
+#define COMMSYS_SND_ERR_CNT_MAX 10
+
+static void MessageHandler(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ e_status = FrameworkunifiedDispatchProcessWithoutLoop(h_app);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ // Ignore Error. Logging only.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedDispatchProcessWithoutLoop: %d", e_status);
+ }
+}
+
+static void TimeoutHandlerCAN(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ uint32_t dummy = 0;
+ static uint32_t snd_err_cnt_can = 0;
+
+ if (CommGetAvailabilityCurrent(CAN_AVAILABILITY)) {
+ e_status = FrameworkunifiedSendChild(h_app, g_can_thread,
+ CID_COMMSYS_TIMEOUT, 0, &dummy);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ snd_err_cnt_can++;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__,
+ "FrameworkunifiedSendChild(timeout for can) faild: %d", e_status);
+
+ if (capture_log_flg)
+ return;
+
+ if (snd_err_cnt_can < COMMSYS_SND_ERR_CNT_MAX)
+ return;
+
+ SendUserInvokedLoggingRequestToSystemManager(
+ e_SS_SM_CAPTURE_DTC_LOGS, "Send CAN TimeoutNtfy Error");
+ capture_log_flg = true;
+ } else {
+ snd_err_cnt_can = 0;
+ }
+ }
+}
+
+int main(int argc, char *argv[]) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FrameworkunifiedDefaultCallbackHandler cb_funcs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cb_funcs);
+ HANDLE h_app;
+ FRAMEWORKUNIFIED_SET_ZONES();
+ struct pollfd fds[2];
+ int ret;
+
+ e_status = FrameworkunifiedCreateDispatcherWithoutLoop(LAN_SERVICE_MAIN,
+ h_app, argc, argv, &cb_funcs, TRUE);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedCreateDispatcherWithoutLoop: %d", e_status);
+ return EXIT_FAILURE;
+ }
+
+ e_status = FrameworkunifiedGetDispatcherFD(h_app, &fds[0].fd);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetDispatcherFD: %d", e_status);
+ return EXIT_FAILURE;
+ }
+
+ if ((fds[1].fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_create: %d", errno);
+ return EXIT_FAILURE;
+ }
+
+ struct itimerspec tm;
+ tm.it_value.tv_sec = 0;
+ tm.it_value.tv_nsec = 100 * 1000 * 1000;
+ tm.it_interval.tv_sec = 0;
+ tm.it_interval.tv_nsec = 100 * 1000 * 1000;
+ if (timerfd_settime(fds[1].fd, 0, &tm, NULL) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_settime: %d", errno);
+ return EXIT_FAILURE;
+ }
+ fds[0].events = POLLIN;
+ fds[1].events = POLLIN;
+
+ while (1) {
+ ret = poll(fds, sizeof(fds) / sizeof(struct pollfd), -1);
+ if (ret < 0) {
+ if (errno == EINTR) {
+ continue;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "poll errno:%d", errno);
+ continue;
+ }
+
+ if ((fds[0].revents & POLLIN) != 0) {
+ MessageHandler(h_app);
+ continue;
+ }
+
+ if ((fds[1].revents & POLLIN) != 0) {
+ uint64_t exp;
+ read(fds[1].fd, &exp, sizeof(uint64_t));
+ TimeoutHandlerCAN(h_app);
+ continue;
+ }
+ }
+ return EXIT_SUCCESS;
+} \ No newline at end of file
diff --git a/video_in_hal/peripheralservice/communication/server/src/threads/CAN_Thread.cpp b/video_in_hal/peripheralservice/communication/server/src/threads/CAN_Thread.cpp
new file mode 100755
index 0000000..1b327e7
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/src/threads/CAN_Thread.cpp
@@ -0,0 +1,238 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "CAN_Thread.h"
+
+extern "C" {
+#include <poll.h>
+#include <sys/timerfd.h>
+}
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_timer.h>
+#include <peripheral_service/Canif_API.h>
+#include <peripheral_service/communication_notifications.h>
+#include <can_hal.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <agl_thread.h>
+#include <string>
+#include "CAN_Delivery.h"
+#include "CAN_CommWatch.h"
+#include "CAN_TxMsg.h"
+
+#include "communication_communicationlog.h"
+#include "communication_cid.h"
+#include "Thread_Common.h"
+
+static EFrameworkunifiedStatus CANStateCallback(HANDLE h_app);
+static EFrameworkunifiedStatus CANHalRcvProcess(HANDLE h_app);
+static EFrameworkunifiedStatus CANHalSndStsProcess(HANDLE h_app);
+
+static const FrameworkunifiedProtocolCallbackHandler kCanPcbhs[] = {
+ {CID_CANIF_DELIVERY_ENTRY, CANDeliveryEntry},
+ {CID_CANIF_DELIVERY_ERASE, CANClearEntry},
+ {CID_COMMSYS_TIMEOUT, CANCallbackForTimeOut},
+ {CID_CANIF_TX_START, CANTxMsg},
+ {CID_CANIF_TX_BIT_START, CANTxMsgBit},
+ {CID_CANIF_COMM_WATCH, CANCommWatch},
+ {CID_CANIF_CMD_CTRL, CANTxMsgCommand},
+ {CID_CANHAL_CMD_CAN_READY, CANStateCallback},
+ {CID_CANHAL_CMD_ERROR_NOTIFY, CommonCanHalErrorNotify},
+ {CID_CANHAL_CMD_CAN_RECV, CANHalRcvProcess},
+ {CID_CANHAL_CMD_CAN_SEND_STATUS, CANHalSndStsProcess},
+};
+
+static UI_32 kCanPcbhsD[] = {
+ CID_CANIF_DELIVERY_ENTRY,
+ CID_CANIF_DELIVERY_ERASE,
+ CID_COMMSYS_TIMEOUT,
+ CID_CANIF_TX_START,
+ CID_CANIF_TX_BIT_START,
+ CID_CANIF_COMM_WATCH,
+ CID_CANIF_CMD_CTRL,
+ CID_CANHAL_CMD_CAN_READY,
+ CID_CANHAL_CMD_ERROR_NOTIFY,
+ CID_CANHAL_CMD_CAN_RECV,
+ CID_CANHAL_CMD_CAN_SEND_STATUS
+};
+
+static EFrameworkunifiedStatus CANStateCallback(HANDLE h_app) {
+ bool result;
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+
+ err = FrameworkunifiedGetMsgDataOfSize(h_app, &result, sizeof(result), eSMRRelease);
+ if (err != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize failed");
+ }
+ if (err == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ return eFrameworkunifiedStatusFail;
+ } else if (err != eFrameworkunifiedStatusOK) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ CommSetAvailabilityCurrent(CAN_AVAILABILITY);
+ return CommonStartNotify(h_app, NTFY_Communication_CAN_ISAVAILABLE);
+}
+
+static EFrameworkunifiedStatus CANThreadCanOpen(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ const char *result = "Unknown";
+ const char *called = "Unknown";
+ UI_16 z = ZONE_ERR;
+
+ e_status = ConvRet(CanOpen(h_app, CAN_HAL_TYPE_CAN));
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "CanOpen";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s", called, result);
+ return e_status;
+}
+
+EFrameworkunifiedStatus CANThreadStart(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ CommClrAvailabilityCurrent(CAN_AVAILABILITY);
+ CANDeliveryInit();
+ CANCommWatchInit();
+ CANTxMsgInit();
+
+ e_status = CommonThreadStart(h_app, kCanPcbhs, _countof(kCanPcbhs),
+ NTFY_Communication_CAN_ISAVAILABLE, CANThreadCanOpen);
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANThreadCanClose(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ const char *result = "Unknown";
+ const char *called = "Unknown";
+ UI_16 z = ZONE_ERR;
+
+ e_status = ConvRet(CanClose(h_app, CAN_HAL_TYPE_CAN));
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "CanClose";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s", called, result);
+ return e_status;
+}
+
+EFrameworkunifiedStatus CANThreadStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ CommClrAvailabilityCurrent(CAN_AVAILABILITY);
+ e_status = CommonThreadStop(h_app, kCanPcbhsD, _countof(kCanPcbhsD),
+ NTFY_Communication_CAN_ISAVAILABLE,
+ CANThreadCanClose);
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANHalRcvProcess(HANDLE h_app) {
+ CanMessage canhal_recv_data;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail;
+ uint8_t cmd = 0;
+
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &canhal_recv_data,
+ sizeof(canhal_recv_data), eSMRRelease);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : FrameworkunifiedGetMsgDataOfSize is failed, e_status=%d", e_status);
+ }
+
+ if (e_status == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ goto cleanup;
+ } else if (e_status != eFrameworkunifiedStatusOK) {
+ goto cleanup;
+ }
+
+ if (canhal_recv_data.dlc > CAN_MESSAGE_LEN) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : Invalid data length, dlc=%d", canhal_recv_data.dlc);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "can_id=%x dlc=%d rid=%x",
+ canhal_recv_data.can_id, canhal_recv_data.dlc, canhal_recv_data.rid);
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s",
+ MessageDataOutputLog(canhal_recv_data.data, canhal_recv_data.dlc).c_str());
+
+ cmd = (uint8_t)(canhal_recv_data.can_id & 0xFF);
+ switch (canhal_recv_data.can_id) {
+ case CAN_CMDID_STARTUP_FIN_RESP_RX:
+ e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd);
+ break;
+ case CAN_CMDID_MRST_INFO_RESP_RX:
+ e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd);
+ break;
+ case CAN_CMDID_VERSION_RESP_RX:
+ e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd);
+ break;
+ case CAN_CMDID_CONNECTION_NODE_RESP_RX:
+ e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd);
+ break;
+ case CAN_CMDID_FUELCALC_RST_REQ_RX:
+ CANCommandSetFuelCalcRstReq();
+ e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd);
+ break;
+ default:
+ e_status = CANDeliveryRcvProcess(h_app, &canhal_recv_data);
+ }
+cleanup:
+ return e_status;
+}
+
+static EFrameworkunifiedStatus CANHalSndStsProcess(HANDLE h_app) {
+ CanSendResult canhal_recv_data;
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+ uint8_t ui_can_rid;
+ PS_CommunicationProtocol cid;
+
+ err = FrameworkunifiedGetMsgDataOfSize(h_app, &canhal_recv_data,
+ sizeof(canhal_recv_data), eSMRRelease);
+ if (err != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : FrameworkunifiedGetMsgDataOfSize is failed, err=%d", err);
+ }
+
+ if (err == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ return eFrameworkunifiedStatusFail;
+ } else if (err != eFrameworkunifiedStatusOK) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ ui_can_rid = canhal_recv_data.rid;
+ if (CAN_RID_NOTUSE_CODE == ui_can_rid) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ switch (canhal_recv_data.can_id) {
+ case CAN_CMDID_MRST_INFO_REQ_TX:
+ case CAN_CMDID_CONNECTION_NODE_REQ_TX:
+ case CAN_CMDID_FUELCALC_REQ_TX:
+ cid = CID_CAN_CMD_TX_RESULT;
+ break;
+ default:
+ cid = CID_CAN_TX_RESULT;
+ break;
+ }
+
+ return CANSndStsProcess(h_app, &canhal_recv_data, cid);
+}
+
+EFrameworkunifiedStatus CANCallbackForTimeOut(HANDLE h_app) {
+ CANCommWatchTimeout(h_app);
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/peripheralservice/communication/server/src/threads/Thread_Common.cpp b/video_in_hal/peripheralservice/communication/server/src/threads/Thread_Common.cpp
new file mode 100755
index 0000000..718d948
--- /dev/null
+++ b/video_in_hal/peripheralservice/communication/server/src/threads/Thread_Common.cpp
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdint.h>
+#include <boost/atomic.hpp>
+#include <pthread.h>
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_timer.h>
+#include <agl_thread.h>
+#include <can_hal.h>
+#include "communication_communicationlog.h"
+#include "communication_cid.h"
+#include "Thread_Common.h"
+
+static std::map<std::string, HANDLE> g_map_sender;
+static pthread_mutex_t g_sender_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+static boost::atomic<int32_t> availabilityCurrent;
+
+void CommonInit(void) {
+ pthread_mutex_lock(&g_sender_mutex);
+ g_map_sender.clear();
+ pthread_mutex_unlock(&g_sender_mutex);
+}
+
+HANDLE CommonFindSender(HANDLE h_app, std::string s) {
+ HANDLE ret = NULL;
+ std::string app(FrameworkunifiedGetAppName(h_app));
+ std::string key = s + app;
+ std::map<std::string, HANDLE>::iterator it = g_map_sender.find(key);
+
+ pthread_mutex_lock(&g_sender_mutex);
+
+ if (it != g_map_sender.end()) {
+ ret = g_map_sender[key];
+ goto cleanup;
+ }
+
+ ret = FrameworkunifiedMcOpenSender(h_app, s.c_str());
+ if (ret) {
+ g_map_sender[key] = ret;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedMcOpenSender Error(to:%s)", s.c_str());
+ }
+
+cleanup:
+ pthread_mutex_unlock(&g_sender_mutex);
+ return ret;
+}
+
+void CommSetAvailabilityCurrent(int32_t current) {
+ availabilityCurrent |= current;
+}
+
+void CommClrAvailabilityCurrent(int32_t current) {
+ availabilityCurrent &= (~current);
+}
+
+BOOL CommGetAvailabilityCurrent(int32_t current) {
+ return !(!(availabilityCurrent & current));
+}
+
+EFrameworkunifiedStatus CommonStartNotify(HANDLE h_app, PCSTR cmd) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ const char *result = "Unknown";
+ const char *called = "Unknown";
+ const BOOL avail = TRUE;
+ UI_16 z = ZONE_ERR;
+
+ e_status = FrameworkunifiedNPPublishNotification(h_app, cmd, &avail , sizeof(avail));
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedNPPublishNotification";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status);
+ return e_status;
+}
+
+EFrameworkunifiedStatus CommonCanHalErrorNotify(HANDLE h_app) {
+ char msg[CANHAL_ERROR_MESSAGE_LEN] = {0};
+ EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK;
+
+ err = FrameworkunifiedGetMsgDataOfSize(h_app, &msg, sizeof(msg), eSMRRelease);
+ if (err != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize is failed, err=%d", err);
+ }
+
+ if (err == eFrameworkunifiedStatusInvldBufSize) {
+ FrameworkunifiedClearMsgData(h_app);
+ return eFrameworkunifiedStatusFail;
+ } else if (err != eFrameworkunifiedStatusOK) {
+ return eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "can_hal error : %s", msg);
+ return err;
+}
+
+EFrameworkunifiedStatus CommonThreadStart(HANDLE h_app, const FrameworkunifiedProtocolCallbackHandler *cb,
+ UI_32 count, PCSTR cmd, EFrameworkunifiedStatus (*open_func)(HANDLE)) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ const char *result = "Unknown";
+ const char *called = "Unknown";
+ UI_16 z = ZONE_ERR;
+
+ e_status = FrameworkunifiedAttachCallbacksToDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, cb, count);
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedAttachCallbacksFromDispatcher";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s(%d)", called, result, e_status);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ e_status = open_func(h_app);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ e_status = FrameworkunifiedNPRegisterNotification(h_app, cmd,
+ sizeof(EFrameworkunifiedStatus), eFrameworkunifiedStateVar);
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedNPRegisterNotification";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ return e_status;
+}
+
+EFrameworkunifiedStatus CommonThreadStop(HANDLE h_app, const PUI_32 cb,
+ UI_32 count, PCSTR cmd, EFrameworkunifiedStatus (*close_func)(HANDLE)) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ const BOOL avail = FALSE;
+ const char *result = "Unknown";
+ const char *called = "Unknown";
+ UI_16 z = ZONE_ERR;
+
+ e_status = FrameworkunifiedNPPublishNotification(h_app, cmd, &avail , sizeof(avail));
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedNPPublishNotification";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ e_status = FrameworkunifiedNPUnRegisterNotification(h_app, cmd);
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedNPUnRegisterNotification";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ e_status = FrameworkunifiedDetachCallbacksFromDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, cb, count);
+ result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success";
+ z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR;
+ called = "FrameworkunifiedDetachCallbacksFromDispatcher";
+ FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s(%d)", called, result, e_status);
+ if (e_status != eFrameworkunifiedStatusOK)
+ return e_status;
+
+ e_status = close_func(h_app);
+ if (e_status != eFrameworkunifiedStatusOK){
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: close_func() failed");
+ return e_status;
+ }
+
+ return e_status;
+}
+
diff --git a/video_in_hal/peripheralservice/peripheral_service.mk b/video_in_hal/peripheralservice/peripheral_service.mk
new file mode 100755
index 0000000..c054722
--- /dev/null
+++ b/video_in_hal/peripheralservice/peripheral_service.mk
@@ -0,0 +1,44 @@
+#############################################################
+#
+# Common Makefile for peripheral_service
+# Copyright (C) 2017-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := peripheral_service
+
+#############################################################
+
+
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/video_in_hal/positioning_hal/LICENSE b/video_in_hal/positioning_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/positioning_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/positioning_hal/Makefile b/video_in_hal/positioning_hal/Makefile
new file mode 100755
index 0000000..0b5a74d
--- /dev/null
+++ b/video_in_hal/positioning_hal/Makefile
@@ -0,0 +1,91 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libpositioning_hal.so
+
+HEADER := hal_api/gps_hal.h hal_api/positioning_hal.h
+
+######### include paths/files ###################
+CXXFLAGS += -I.
+CXXFLAGS += -I./inc/Common
+CXXFLAGS += -I./inc/GpsCommon
+CXXFLAGS += -I./inc/LineSensDrv
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include/
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+CXXFLAGS += -DLINUX -D__CWORD71__VEHICLE_ -D__CWORD71_
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH := /usr/lib
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+#LIBS += -Wl,-Bdynamic -lgps_mng
+LIBS += -Wl,-Bdynamic -lPOS_base_API
+LIBS += -Wl,-Bdynamic -lns_backup
+
+######### source files ##########################
+VPATH := src/Common
+VPATH += src/GpsCommon
+VPATH += src/LineSensDrv
+
+OBJS += positioning_common.o
+OBJS += positioning_hal.o
+OBJS += MDev_Gps_API.o
+OBJS += MDev_Gps_Main.o
+OBJS += MDev_GpsRecv.o
+OBJS += MDev_Gps_Nmea.o
+OBJS += MDev_Gps_Common.o
+OBJS += MDev_Gps_Mtrx.o
+OBJS += MDev_Gps_TimerCtrl.o
+OBJS += LineSensDrv_Sensor.o
+OBJS += LineSensDrv_Thread.o
+OBJS += LineSensDrv_Api.o
+OBJS += MDev_GpsRollOver.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=:$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
+
+
diff --git a/video_in_hal/positioning_hal/README.md b/video_in_hal/positioning_hal/README.md
new file mode 100755
index 0000000..2d46d42
--- /dev/null
+++ b/video_in_hal/positioning_hal/README.md
@@ -0,0 +1,3 @@
+positioning_hal library
+==================
+Positioning HAL implementation library for AGL Reference Board.
diff --git a/video_in_hal/positioning_hal/hal_api/gps_hal.h b/video_in_hal/positioning_hal/hal_api/gps_hal.h
new file mode 100755
index 0000000..3321275
--- /dev/null
+++ b/video_in_hal/positioning_hal/hal_api/gps_hal.h
@@ -0,0 +1,932 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_GPS_HAL_H_
+#define HAL_API_GPS_HAL_H_
+
+/**
+ * @file gps_hal.h
+ */
+
+/** @addtogroup positioning
+ * @{
+ */
+/** @addtogroup positioning_hal
+ * @ingroup positioning
+ * @{
+ */
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include <native_service/frameworkunified_types.h>
+#include <vehicle_service/pos_message_header.h>
+#include <vehicle_service/std_types.h>
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+typedef int32 RET_API;
+typedef uint32_t DID;
+
+/*************************************************************************
+ * RET_API define
+ *************************************************************************/
+/*--- for message ---*/
+#define POS_TIMESTS_NG 0x00
+//!< \~english time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+#define POS_TIMESTS_RTC 0x01
+//!< \~english time output from RTC Backup(have time adjustment)
+#define POS_TIMESTS_OK 0x02 //!< \~english time adjustment completed
+
+/* command ID */
+#define CID_POSIF_REGISTER_LISTENER_GPS_TIME 0x0201
+//!< \~english GPS time delivery command ID
+
+#define POS_DID_GPS__CWORD82__SETINITIAL 0x80000033
+//!< \~english data ID of setting initial location and time to GPS
+
+#define POS_DID_GPS__CWORD82__SETRMODEEX 0x80000035
+//!< \~english data ID of setting GPS receiver mode(pull extension sentence)
+
+#define POS_DID_GPS__CWORD82__SELSENT 0x80000036
+//!< \~english data ID of setting command to GPS that output any sentence
+
+/* NAVIINFO_RET_API */
+#define NAVIINFO_RET_NORMAL (0) //!< \~english normal finish
+#define NAVIINFO_RET_ERROR_PARAM (-1) //!< \~english parameter error
+#define NAVIINFO_RET_ERROR_INNER (-2) //!< \~english internal error
+#define NAVIINFO_RET_ERROR_BUFFULL (-3) //!< \~english buffer full
+#define NAVIINFO_RET_ERROR_NOSUPPORT (-4) //!< \~english no support
+#define NAVIINFO_RET_ERROR_RESOURCE (-5) //!< \~english lack of resource
+
+/* Positioning Level/GPS Information Positioning Status Information Definition */
+#define NAVIINFO_DIAG_GPS_FIX_STS_NON (0) //!< \~english position not fix
+#define NAVIINFO_DIAG_GPS_FIX_STS_2D (1) //!< \~english 2D position fix
+#define NAVIINFO_DIAG_GPS_FIX_STS_3D (2) //!< \~english 3D position fix
+
+/* Reception status definition */
+#define NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE (0) //!< \~english not used
+#define NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING (1) //!< \~english searching
+#define NAVIINFO_DIAG_GPS_RCV_STS_TRACHING (2) //!< \~english tracking
+#define NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX (3) //!< \~english not used for position fix
+#define NAVIINFO_DIAG_GPS_RCV_STS_USEFIX (4) //!< \~english used for position fix
+
+/* GPS Response Status Definition */
+#define GPS_SENDOK 0 //!< \~english send result OK
+#define GPS_SENDNG 1 //!< \~english send result NG
+
+/* GPS reset request mode definition */
+#define GPS_RST_COLDSTART 0xff
+//!< \~english GPS reset request(cold start)
+
+#define RET_NORMAL 0 //!< \~english normally end
+
+#define RET_RCVMSG 1 //!< \~english receive message only
+#define RET_RCVSIG 2 //!< \~english receive signal only
+#define RET_RCVBOTH 3 //!< \~english receive message and signal
+#define RET_NOMSG 4 //!< \~english receive no message
+
+#define RET_QUE 5 //!< \~english insert signal
+#define RET_NOTQUE 6 //!< \~english do not insert signal
+#define RET_PROCDOWN 7 //!< \~english sub process down found
+#define RET_SLEEP 100 //!< \~english sleep time
+
+
+#define RET_OSERROR (-127) //!< \~english OS system call error
+
+#define RET_ERROR (-1)
+//!< \~english abnormally end(do not know reason)
+#define RET_ERRPARAM (-2) //!< \~english parameter error
+#define RET_ERRNOTRDY (-3)
+//!< \~english port or semphore ID is not created
+#define RET_ERRPROC (-4) //!< \~english error occurs in API process
+#define RET_ERRTIMEOUT (-5)
+//!< \~english timeout occurs but process unfinished
+#define RET_ERRMSGFULL (-6) //!< \~english message table full
+
+
+#define RET_ERROVERFLW (-7)
+//!< \~english message size exceeds receive buffer size
+
+#define RET_ERRINIT (-8) //!< \~english abnormally initialization
+
+#define RET_EV_NONE (-20) //!< \~english event does not exist
+#define RET_EV_MAX (-21) //!< \~english event value exceeds max value
+#define RET_EV_MIN (-22)
+//!< \~english event value is lower than min value
+
+/* POS_RET_API */
+#define POS_RET_NORMAL 0 //!< \~english normal finish
+#define POS_RET_ERROR (-1) //!< \~english error occured
+#define POS_RET_ERROR_DID (-2) //!< \~english data ID error
+#define POS_RET_ERROR_INNER (-3) //!< \~english internal error
+#define POS_RET_ERROR_PARAM (-4) //!< \~english parameter error
+#define POS_RET_ERROR_BUFFULL (-5) //!< \~english buffer full error
+#define POS_RET_ERROR_CREATE_EVENT (-6) //!< \~english create event error
+#define POS_RET_ERROR_OUTOF_MEMORY (-8)
+//!< \~english share memory allocation size error
+
+#define POS_RET_ERROR_SIZE (-9) //!< \~english memory size error
+#define POS_RET_ERROR_TIMEOUT (-10) //!< \~english timeout error
+#define POS_RET_ERROR_NOSUPPORT (-11) //!< \~english no support
+#define POS_RET_ERROR_BUSY (-12) //!< \~english busy
+#define POS_RET_ERROR_RESOURCE (-13) //!< \~english lack of resources
+#define POS_RET_ERROR_MIN (-13) //!< \~english min value of error
+
+
+#define NUM_OF_100msData (10)
+//!< \~english number of gyro data every 100ms
+
+
+#define CID_GPS_SERIAL1 (CID)0x0101
+//!< \~english Defination of notification about Gps Data has been receiced
+
+#define CID_GPS_SERIAL2 (CID)0x0102 //!< \~english notification about 1PPS interupt
+
+
+#define CID_GPS_SERIAL3 (CID)0x0103
+//!< \~english Defination of SIF2 Data
+
+#define CID_GPS_SERIAL4 (CID)0x0104
+//!< \~english Defination of _CWORD82_ command send
+
+#define CID_GPS_SERIAL5 (CID)0x0105
+//!< \~english Defination of _CWORD82_ command send
+
+#define CID_GPS_SERIAL6 (CID)0x0106
+//!< \~english Defination of u-blox request data
+
+#define CID_GPS_SERIAL7 (CID)0x0107
+//!< \~english Defination of u-blox ack data
+
+#define CID_GPS_RECVDATA (CID)(CID_GPS_BASE | CID_GPS_SERIAL1)
+//!< \~english gps data receiced CID
+
+#define CID_GPS_1PPSINT (CID)(CID_GPS_BASE | CID_GPS_SERIAL2)
+//!< \~english 1PPS interupt CID
+
+#define CID_GPS_SIF2DATA (CID)(CID_GPS_BASE | CID_GPS_SERIAL3)
+//!< \~english SIF2 Data CID
+
+/**
+ * \~english @brief _CWORD82_ command send CID
+ * \~english @brief Message structure\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message main structure @ref TgGpsSndData\n
+ * \~english @brief Message data(Vehicle sensor information setting message) structure @ref VEHICLE_MSG_SEND_DAT\n
+ */
+#define CID_GPS__CWORD82__REQUEST (CID)(CID_GPS_BASE | CID_GPS_SERIAL4)
+
+#define CID_GPS_CYCLEDATA_PROV (CID)(CID_GPS_BASE | CID_GPS_SERIAL5)
+//!< \~english Gps cycle data CID
+
+#define CID_GPS_RCV_REQUESTDATA (CID)(CID_GPS_BASE | CID_GPS_SERIAL6)
+//!< \~english u-blox request data CID
+
+#define CID_GPS_RCV_ACKDATA (CID)(CID_GPS_BASE | CID_GPS_SERIAL7)
+//!< \~english u-blox ack data CID
+
+#define CID_GPS_SERIAL8 (CID)0x0108
+//!< \~english Defination of Time Setting request
+
+#define CID_GPS_SERIAL9 (CID)0x0109
+//!< \~english Defination of Time Setting ack
+
+#define CID_GPS_SERIAL10 (CID)0x010A
+//!< \~english Defination of back up data read request
+
+#define CID_GPS_SERIAL11 (CID)0x010B
+//!< \~english Defination gps of week count request
+
+/**
+ * \~english @brief Defination of Time Setting request
+ * \~english @brief Message structure\n
+ * \~english @brief Message header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message body structure @ref TgGpsSndData\n
+ * \~english @brief Positioning information structure @ref POS_MSGINFO\n
+ * */
+#define CID_GPS_TIMESETTING (CID)(CID_GPS_BASE | CID_GPS_SERIAL8)
+
+/**
+ * \~english @brief Defination of Time Setting ack
+ * \~english @brief Message structure\n
+ * \~english @brief Message body structure @ref TG_GPS_RET_TIMESET_MSG\n
+ */
+#define CID_GPS_RETTIMESETTING (CID)(CID_GPS_BASE | CID_GPS_SERIAL9)
+
+/**
+ * \~english @brief Read backup data request CID
+ * \~english @brief When this command is received, the backup data is read.\n
+ * \~english @brief Message-Related Structures\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER
+ */
+#define CID_GPS_BACKUPDATA_LOAD (CID)(CID_GPS_BASE | CID_GPS_SERIAL10)
+
+/**
+ * \~english @brief Gps Week count request CID
+ * \~english @brief Message structure\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message data(Gps Week correction count notify message) structure @ref GpsWeekCorCntMsg\n
+ */
+#define CID_GPSWEEKCOR_CNT_NOTIFICATION (CID)(CID_GPS_BASE | CID_GPS_SERIAL11)
+
+
+
+/**
+ * \~english @brief GPS reset result delivery command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hThread, TN_POSITIONING_GPS, CID_POSIF_REQ_GPS_RESET, OnRecivePosResetMsg);
+ * @endcode
+ */
+#define CID_POSIF_REQ_GPS_RESET 0x0784
+
+#define POSHAL_DID_GPS_CONNECT_ERROR 0x800000B5U
+//!< \~english GPS receive error DID
+
+#define GPS_READ_LEN 316
+//!< \~english Gps NMEA FULLBINARY max length
+
+#define GPS_CMD_NMEA_GGA_SZ (71U) //!< \~english GGA
+#define GPS_CMD_NMEA_DGGA_SZ (75U) //!< \~english double precison GGA
+#define GPS_CMD_NMEA_VTG_SZ (37U) //!< \~english VTG
+#define GPS_CMD_NMEA_RMC_SZ (61U) //!< \~english RMC
+#define GPS_CMD_NMEA_DRMC_SZ (67U) //!< \~english double precison RMC
+#define GPS_CMD_NMEA_GLL_SZ (44U) //!< \~english GLL
+#define GPS_CMD_NMEA_DGLL_SZ (50U) //!< \~english double precison GLL
+#define GPS_CMD_NMEA_GSA_SZ (66U) //!< \~english GSA
+#define GPS_CMD_NMEA_GSV_SZ (70U) //!< \~english GSV
+#define GPS_CMD_NMEA__CWORD44__GP_3_SZ (78U) //!< \~english _CWORD44_,GP,3
+#define GPS_CMD_NMEA__CWORD44__GP_4_SZ (25U) //!< \~english _CWORD44_,GP,4
+#define GPS_CMD_NMEA_P_CWORD82_F_GP_0_SZ (50U) //!< \~english _CWORD44_,GP,0
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_1_SZ (31U) //!< \~english _CWORD44_,GP,1
+#define GPS_CMD_NMEA_P_CWORD82_I_GP_SZ (71U) //!< \~english P_CWORD82_I,GP
+#define GPS_CMD_NMEA_P_CWORD82_E_GP_0_SZ (50U) //!< \~english P_CWORD82_E,GP,0
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_0_SZ (63U) //!< \~english P_CWORD82_J,GP,0
+#define GPS_CMD_NMEA_P_CWORD82_E_GP_2_SZ (21U) //!< \~english P_CWORD82_E,GP,2
+#define GPS_CMD_NMEA_P_CWORD82_G_GP_0_SZ (34U) //!< \~english P_CWORD82_G,GP,0
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_7_SZ (37U) //!< \~english P_CWORD82_J,GP,7
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_8_SZ (45U) //!< \~english P_CWORD82_J,GP,8
+#define GPS_CMD_BINARY_SZ (81U) //!< \~english standard binary
+
+#define GPS_CMD_FULLBIN_SZ (316U)
+//!< \~english FULL binary(GPS10 format)
+
+#define GPS_CMD_FULLBIN_VINFO (30U + 160U + 25U + 8U)
+//!< \~english FULL bianry version
+
+#define GPS_NMEA_MAX_SZ (255U) //!< \~english NMEA max size
+#define GPS_DATASIZE_RTC (13U) //!< \~english RTC Data size
+#define GPS_NMEARCVSTS_SZ (1U) //!< \~english received NMEA size
+
+#define GPS_GPSANT_SZ (1U) //!< \~english gps antenna status size
+#define GPS_SNSCNT_SZ (1U) //!< \~english Sensor Count value size
+
+
+#define GPS_CMD_NMEA_PROV_SZ (GPS_CMD_NMEA_DRMC_SZ + GPS_CMD_NMEA_GSA_SZ + \
+ (GPS_CMD_NMEA_GSV_SZ*3) + GPS_CMD_NMEA__CWORD44__GP_3_SZ)
+//!< \~english NMEA size
+
+#define GPS_NMEA_SZ (GPS_NMEARCVSTS_SZ + GPS_GPSANT_SZ + GPS_SNSCNT_SZ + GPS_CMD_NMEA_PROV_SZ)
+//!< \~english NEMA size
+
+#define GPS_FULLBIN_SZ (GPS_GPSANT_SZ + GPS_SNSCNT_SZ + GPS_CMD_FULLBIN_SZ)
+//!< \~english FULLBIN size
+
+#define GPS__CWORD44_GP4_SZ (GPS_GPSANT_SZ + GPS_SNSCNT_SZ + GPS_CMD_NMEA__CWORD44__GP_4_SZ)
+//!< \~english _CWORD44_GP4 size
+
+#define GPS_MSGDATA_SZ_MAX (512U) //!< \~english message maximum data size
+#define GPS_TLGRM_LEN 253 //!< \~english message data length
+#define GPS_MSG_VSINFO_DSIZE 1904 //!< \~english message body size
+
+#define POS_MSG_INFO_DSIZE 1028 //!< \~english message body maximum size
+
+/**
+ * @enum MdevGpsDataKind
+ * \~english enumeration of gps data kind
+ */
+typedef enum MdevGpsDataKind {
+ MDEV_GPS_DATA_RAWDATA_NMEA = 0, //!< \~english raw NMEA data of GPS
+ MDEV_GPS_DATA_RAWDATA_FULLBIN, //!< \~english raw binary data of GPS
+ MDEV_GPS_DATA_RAWDATA__CWORD44_GP4, //!< \~english raw _CWORD44_ data of GPS
+ MDEV_GPS_DATA_NAVISPEED, //!< \~english speed data
+ MDEV_GPS_DATA_CUSTOMDATA, //!< \~english position information
+ MDEV_GPS_DATA_GPSTIME, //!< \~english GPS time
+ MDEV_GPS_DATA_GPSTIME_RAW, //!< \~english raw time of GPS
+ MDEV_GPS_DATA_INITIAL //!< \~english initialize data
+} MDEV_GPS_DATA_KIND;
+
+/**
+ * @struct NAVIINFO_UTCTIME
+ * \~english UTC time information structure
+ */
+typedef struct {
+ uint16_t year; //!< \~english year
+ uint8_t month; //!< \~english month
+ uint8_t date; //!< \~english day
+ uint8_t hour; //!< \~english hour
+ uint8_t minute; //!< \~english minute
+ uint8_t second; //!< \~english second
+ uint8_t reserved; //!< \~english reserve
+} NAVIINFO_UTCTIME;
+
+/**
+ * @struct SENSORLOCATION_LONLATINFO_DAT
+ * \~english longitude and latitude information data
+ * - Get method(getMethod)
+ * - SENSOR_GET_METHOD_GPS - longitude and latitude from GPS
+ * - SENSOR_GET_METHOD_NAVI - longitude and latitude from Navigation
+ * - Synchrony count(SyncCnt)
+ * - Count for position data synchronous \n
+ * When delivery altitude and heading data, position data can be synchronized by SyncCnt.\n
+ * But the data of different method can not be synchronized by SyncCnt.\n
+ * Example 1: [LonLat from GPS] and [Heading from GPS] can be synchronized by SyncCnt.\n
+ * Example 2: [LonLat from GPS] and [LonLat from Navi] can not be synchronized by SyncCnt.\n
+ * Caution: The sensor count in sensor data delivery is another data.
+ * - Enable or not(isEnable) \n
+ * To describe this delivery message is whether can be used or not
+ * - 0 - not avaliable
+ * - not 0 - avaliable
+ * - when GPS data is specified,longitude and latitude is invalid at following condition:\n
+ * so [not avaliable] provieded
+ * - After system start, GPS unit has not received current location data and GPS unit \n
+ * status is not positioning fixed.
+ * - If it is not initialized status, certainly provide [avaliable] when Navigation data specified
+ * - If the status is [not avaliable], data following can not be guaranteed.
+ * - Position status(posSts)
+ * - It is valid only when "Get method is Navigation" and "evironment is _CWORD80_".(otherwise it will be set as 0)
+ * - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+ * - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+ * - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
+ * maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+ * - Position accuracy(posAcc)
+ * - Detected accruray of current position:1LSB=1m \n
+ * - It is valid only when "Get method is Navigation" and "evironment is _CWORD80_".(otherwise it will be set as 0)\n
+ * 0000H:0m \n
+ * 0001H:1m \n
+ * :\n
+ * FFFDH:65533m \n
+ * FFFEH:65534m and larger than 65534m \n
+ * FFFFH:no data
+ * - Longitude : (WGS-84)(10^ -7degree as 1) \n
+ * East longitude is positive value and west longitude is negative value.
+ * - Latitude : (WGS-84)(10^ -7degree as 1) \n
+ * North latitude positive value and south latitude is negative value.
+ */
+typedef struct {
+ uint8_t getMethod; //!< \~english get method
+ uint8_t SyncCnt; //!< \~english Synchrony count
+ uint8_t isEnable; //!< \~english enable or not
+ uint8_t posSts; //!< \~english position status
+ uint16_t posAcc; //!< \~english position accuracy
+ int32_t Longitude; //!< \~english longitude(10^-7degree)
+ //!< \~english max: +180.0000000degree[east longitude]
+ //!< \~english min: -170.9999999degree[west longitude]
+ int32_t Latitude; //!< \~english latitude(10^-7degree)
+ //!< \~english max: +90.0000000degree[north Latitude]
+ //!< \~english min: -90.0000000degree[south Latitude]
+} SENSORLOCATION_LONLATINFO_DAT;
+
+
+/**
+ * @struct SENSORLOCATION_ALTITUDEINFO_DAT
+ * \~english altitude information data
+ * - Get method(getMethod)
+ * - SENSOR_GET_METHOD_GPS - altitude from GPS
+ * - SENSOR_GET_METHOD_NAVI - altitude from Navigation
+ * - Synchrony count(SyncCnt)
+ * - Count for position data synchronous \n
+ * When delivery altitude and heading data, position data can be synchronized by SyncCnt. \n
+ * But the data of different method can not be synchronized by SyncCnt.\n
+ * example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by SyncCnt.\n
+ * example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be
+ * synchronized by SyncCnt. \n
+ * Caution: The sensor count in sensor data delivery is another data.
+ * - Enable or not(isEnable) \n
+ * To describe this delivery message is whether can be used or not.
+ * - 0 - not avaliable
+ * - not 0 - avaliable
+ * - when GPS data specified, Altitude is invalid at following condition(so [not avaliable] provieded):
+ * - Immediately after system start, GPS unit has not received current location data and GPS unit status \n
+ * is not positioning fix
+ * - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+ * - If the status is [not avaliable], data following can not be guaranteed.
+ * - Altitude
+ * - altitude data(unit 0.01m)
+ */
+typedef struct {
+ uint8_t getMethod; //!< \~english get method
+ uint8_t SyncCnt; //!< \~english Synchrony count
+ uint8_t isEnable; //!< \~english enable or not
+ uint8_t Reserved[3]; //!< \~english reserve
+ int32_t Altitude; //!< \~english altitude(0.01m)
+} SENSORLOCATION_ALTITUDEINFO_DAT;
+
+
+/**
+ * @struct SENSORMOTION_HEADINGINFO_DAT
+ * \~english heading information data
+ * - Get method(getMethod)
+ * - SENSOR_GET_METHOD_GPS - Heading from GPS
+ * - SENSOR_GET_METHOD_NAVI - Heading from Navi
+ * - Synchrony count(SyncCnt)
+ * - Count for position data synchronous \n
+ * When delivery altitude and heading data, position data can be synchronized by this count. \n
+ * But the data of different method can not be synchronized by this count.\n
+ * example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n
+ * example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be \n
+ * synchronized by the count. \n
+ * Caution: The sensor count in sensor data delivery is another data.
+ * - Enable or not(isEnable) \n
+ * To describe this data is whether enable or not
+ * - 0 - not avaliable
+ * - not 0 - avaliable
+ * - Heading is invalid at following condition when GPS data specified, so [not avaliable] provieded \n
+ * - Immediately after system start, GPS unit has not received current location data and GPS unit status \n
+ * is not positioning fix
+ * - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+ * - If the status is [not avaliable], data following can not be guaranteed.
+ * - Position status(posSts)
+ * - It is valid only when "Get method is Navi" and "evironment is _CWORD80_".(otherwise it will be set as 0)
+ * - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+ * - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+ * - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
+ * maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+ * - Heading
+ * - Heading data(0.01degree as 1, based on north and clockwise count)\n
+ * But in environment _CWORD95_/_CWORD101___CWORD84_,the heading from Navi is a approximate that separate 360 degree \n
+ * into 16 part. \n
+ * example: 0, 2300, 4500, ..., 31500, 33800
+ */
+typedef struct {
+ uint8_t getMethod; //!< \~english get method
+ uint8_t SyncCnt; //!< \~english Synchrony count
+ uint8_t isEnable; //!< \~english enable or not
+ uint8_t posSts; //!< \~english position status
+ uint8_t Reserved1[2]; //!< \~english reserve
+ uint16_t Heading; //!< \~english heading(0.01degree)
+ //!< \~english max: 359.99 degree
+ //!< \~english min: 0.00 degree
+ uint8_t Reserved2[2]; //!< \~english reserve
+} SENSORMOTION_HEADINGINFO_DAT;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS_FIX_CNT
+ * \~english position fix count data structure
+ */
+typedef struct {
+ uint32_t ulCnt3d; //!< \~english position fix count:3D
+ uint32_t ulCnt2d; //!< \~english position fix count:2D
+ uint32_t ulCntElse; //!< \~english position fix count:not fix
+} NAVIINFO_DIAG_GPS_FIX_CNT;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS_FIX_XYZ
+ * \~english longitude and latitude data structure
+ */
+typedef struct {
+ int32_t lLat; //!< \~english GPS latitude
+ int32_t lLon; //!< \~english GPS longitude
+} NAVIINFO_DIAG_GPS_FIX_XYZ;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS_FIX
+ * \~english position fix information structure
+ */
+typedef struct {
+ uint8_t ucFixSts; //!< \~english fix status
+ uint8_t ucReserve[3]; //!< \~english reserve
+ NAVIINFO_DIAG_GPS_FIX_CNT stCnt; //!< \~english fix count data
+ NAVIINFO_DIAG_GPS_FIX_XYZ stWgs84; //!< \~english longitude and latitude data
+} NAVIINFO_DIAG_GPS_FIX;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS_PRN
+ * \~english satellite information structure
+ * - reception status(ucRcvSts)
+ * - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE : not used
+ * - NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING : searching
+ * - NAVIINFO_DIAG_GPS_RCV_STS_TRACHING : tracking
+ * - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX : not used for position fix
+ * - NAVIINFO_DIAG_GPS_RCV_STS_USEFIX : used for position fix
+ */
+typedef struct {
+ uint8_t ucRcvSts; //!< \~english reception status
+ uint8_t ucPrn; //!< \~english satellite No.
+ uint8_t ucelv; //!< \~english satellite dramatic angle
+ uint8_t ucLv; //!< \~english satellite signal level
+ uint16_t usAzm; //!< \~english satellite azimuth
+ uint8_t ucReserve[2]; //!< \~english reserve
+} NAVIINFO_DIAG_GPS_PRN;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS_SAT
+ * \~english all satellite information structure
+ */
+typedef struct {
+ NAVIINFO_DIAG_GPS_PRN stPrn[12]; //!< \~english all satellite information
+} NAVIINFO_DIAG_GPS_SAT;
+
+/**
+ * @struct NAVIINFO_DIAG_GPS
+ * \~english position fixed and satellite information structure
+ */
+typedef struct {
+ NAVIINFO_DIAG_GPS_FIX stFix; //!< \~english position fixed information
+ NAVIINFO_DIAG_GPS_SAT stSat; //!< \~english all satellite information
+} NAVIINFO_DIAG_GPS;
+
+/**
+ * @struct NAVIINFO_NAVI_GPS
+ * \~english other GPS related information structure
+ * - altitude(altitude) \n
+ * As the altitude is used as unit [0.01m] in internal, \n
+ * the altitude data range is (-21,474,839~21,474,839).
+ * - UTC(utc)
+ * - The time set after rollover.
+ * - date and time status(tdsts)
+ * - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+ * - 1= time output from RTC Backup(have time adjustment result)
+ * - 2= time adjustment completed
+ */
+typedef struct {
+ int32_t altitude; //!< \~english altitude
+ uint16_t speed; //!< \~english speed
+ uint16_t heading; //!< \~english heading
+ NAVIINFO_UTCTIME utc; //!< \~english UTC time
+ uint8_t tdsts; //!< \~english date and time status
+ uint8_t reserve[3]; //!< \~english reserve
+} NAVIINFO_NAVI_GPS;
+
+/**
+ * @struct NAVIINFO_ALL
+ * \~english Navi data structure
+ */
+typedef struct {
+ uint8_t ucSensorCnt; //!< \~english sensor count
+ uint8_t reserve[3]; //!< \~english reserve
+ NAVIINFO_DIAG_GPS stDiagGps; //!< \~english position fix related information
+ NAVIINFO_NAVI_GPS stNaviGps; //!< \~english other GPS related information
+} NAVIINFO_ALL;
+
+/**
+ * @struct POS_MSGINFO
+ * \~english message delivery positioning sensor information
+ */
+typedef struct {
+ DID did; //!< \~english data ID
+ PNO pno; //!< \~english delivery destination PNO
+ uint16_t size; //!< \~english data body size
+ uint8_t rcv_flag; //!< \~english received flag
+ uint8_t reserve; //!< \~english reserve
+ uint8_t data[POS_MSG_INFO_DSIZE]; //!< \~english data body
+} POS_MSGINFO;
+
+/**
+ * @struct SENSOR_GPSTIME
+ * \~english GPS time information
+ * - date amd time status(tdsts)
+ * - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+ * - 1= time output from RTC Backup(have time adjustment result)
+ * - 2= time adjustment completed
+ */
+typedef struct {
+ NAVIINFO_UTCTIME utc; //!< \~english UTC time
+ uint8_t tdsts; //!< \~english time status
+ uint8_t reserve[3]; //!< \~english reserve
+} SENSOR_GPSTIME;
+
+#define SENSOR_MSG_GPSTIME SENSOR_GPSTIME //!< \~english GPS time information
+#define SENSOR_GPSTIME_RAW SENSOR_GPSTIME //!< \~english GPS time information
+
+/**
+ * @struct MdevGpsCustomData
+ * \~english Struct of Gps custom data
+ */
+typedef struct MdevGpsCustomData {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ SENSORLOCATION_LONLATINFO_DAT st_lonlat; //!< \~english longtitude,latitude
+ SENSORLOCATION_ALTITUDEINFO_DAT st_altitude; //!< \~english altitude
+ SENSORMOTION_HEADINGINFO_DAT st_heading; //!< \~english headings
+ SENSOR_MSG_GPSTIME st_gps_time; //!< \~english Gps Time
+ NAVIINFO_DIAG_GPS st_diag_gps; //!< \~english Gps data from diag
+} MDEV_GPS_CUSTOMDATA;
+
+/**
+ * @struct MdevGpsCustomDataMgs
+ * \~english Struct of Gps custom data message
+ */
+typedef struct MdevGpsCustomDataMgs {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_CUSTOMDATA st_data; //!< \~english Gps Custom Data
+} MDEV_GPS_CUSTOMDATA_MGS;
+
+/**
+ * @struct MdevGpsRtc
+ * \~english Struct of Gps RTC data
+ */
+typedef struct MdevGpsRtc {
+ u_int32 ul_retsts; //!< \~english return status
+ u_int8 uc_datalen; //!< \~english data length
+ u_int8 uc_ctrlcode; //!< \~english control code
+ u_int8 uc_bcd_year; //!< \~english year
+ u_int8 uc_bcd_month; //!< \~english month
+ u_int8 uc_bcd_day; //!< \~english day
+ u_int8 uc_bcd_hour; //!< \~english hour
+ u_int8 uc_bcd_min; //!< \~english minute
+ u_int8 uc_bcd_sec; //!< \~english second
+ u_int8 uc_status; //!< \~english status
+ u_int8 u_reserve[3]; //!< \~english reserve
+} MDEV_GPS_RTC;
+
+/**
+ * @struct MdevGpsGpsTime
+ * \~english Struct of Gps Time
+ */
+typedef struct MdevGpsGpsTime {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ MDEV_GPS_RTC st_rtc_data; //!< \~english Gps Time
+} MDEV_GPS_GPSTIME;
+
+/**
+ * @struct MdevGpsGpsTimeMgs
+ * \~english Struct of Gps Time message
+ */
+typedef struct MdevGpsGpsTimeMgs {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_GPSTIME st_data; //!< \~english Gps Time Data
+} MDEV_GPS_GPSTIME_MGS;
+
+/**
+ * @struct DevGpsUtcTime
+ * \~english Struct of Gps UTC time
+ */
+typedef struct DevGpsUtcTime {
+ u_int16 us_year; //!< \~english Year
+ u_int8 uc_month; //!< \~english month
+ u_int8 uc_date; //!< \~english day
+ u_int8 uc_hour; //!< \~english hour
+ u_int8 uc_minute; //!< \~english minute
+ u_int8 uc_second; //!< \~english second
+ u_int8 u_reserved; //!< \~english reserve
+} DEV_GPS_UTCTIME;
+
+/**
+ * @enum MdevGpsFixSts
+ * \~english enumeration of gps fix status
+ */
+typedef enum MdevGpsFixSts {
+ MDEV_GPS_NOTFIX = 0, //!< \~english not fix
+ MDEV_GPS_FIX //!< \~english fix
+} MDEV_GPS_FIX_STS;
+
+/**
+ * @struct MdevGpsNmea
+ * \~english Struct of gps NMEA Data
+ */
+typedef struct MdevGpsNmea {
+ u_int8 uc_nmea_data[GPS_MSG_VSINFO_DSIZE]; //!< \~english NMEA Data
+} MDEV_GPS_NMEA;
+
+/**
+ * @struct MdevGpsFullbin
+ * \~english Struct of Gps full bin data
+ */
+typedef struct MdevGpsFullbin {
+ u_int8 uc_fullbin_data[GPS_FULLBIN_SZ]; //!< \~english gps full bin data
+ u_int8 u_reserve[3]; //!< \~english reserve
+} MDEV_GPS_FULLBIN;
+
+/**
+ * @struct MdevGps_CWORD44_gp4
+ * \~english Struct of Gps _CWORD44_GP4 data
+ */
+typedef struct MdevGps_CWORD44_gp4 {
+ u_int8 uc__CWORD44_gp4_data[GPS__CWORD44_GP4_SZ]; //!< \~english gps _CWORD44_GP4 data
+ u_int8 u_reserve; //!< \~english reserve
+} MDEV_GPS__CWORD44_GP4;
+
+/**
+ * @struct MdevGpsCycledata
+ * \~english Struct of Gps cycle data
+ */
+typedef struct MdevGpsCycledata {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ u_int8 uc_data[GPS_MSGDATA_SZ_MAX - sizeof(MDEV_GPS_DATA_KIND)]; //!< \~english data
+} MDEV_GPS_CYCLEDATA;
+
+/**
+ * @struct MdevGpsCycledataMsg
+ * \~english Struct of Gps cycle data message
+ */
+typedef struct MdevGpsCycledataMsg {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_CYCLEDATA st_data; //!< \~english data
+} MDEV_GPS_CYCLEDATA_MSG;
+
+/**
+ * @struct MdevGpsRawdataNmea
+ * \~english Struct of Gps NMEA Raw Data
+ */
+typedef struct MdevGpsRawdataNmea {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ MDEV_GPS_NMEA st_nmea_data; //!< \~english NMEA Data
+} MDEV_GPS_RAWDATA_NMEA;
+
+/**
+ * @struct MdevGpsRawdataNmeaMsg
+ * \~english Struct of Gps NMEA Raw Data message
+ */
+typedef struct MdevGpsRawdataNmeaMsg {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header(see vs-positioning-base-library)
+ MDEV_GPS_RAWDATA_NMEA st_data; //!< \~english data
+} MDEV_GPS_RAWDATA_NMEA_MSG;
+
+/**
+ * @struct MdevGpsRawdataFullbin
+ * \~english Struct of Gps Full Bin Raw Data
+ */
+typedef struct MdevGpsRawdataFullbin {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ MDEV_GPS_FULLBIN st_fullbin_data; //!< \~english Full Binary Data
+} MDEV_GPS_RAWDATA_FULLBIN;
+
+/**
+ * @struct MdevGpsRawdataFullbinMsg
+ * \~english Struct of Gps Full Bin Raw Data message
+ */
+typedef struct MdevGpsRawdataFullbinMsg {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_RAWDATA_FULLBIN st_data; //!< \~english Gps Full Bin Data
+} MDEV_GPS_RAWDATA_FULLBIN_MSG;
+
+/**
+ * @struct MdevGpsRawdata_CWORD44_gp4
+ * \~english Struct of Gps _CWORD44_GP4 Raw Data
+ */
+typedef struct MdevGpsRawdata_CWORD44_gp4 {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ MDEV_GPS__CWORD44_GP4 st__CWORD44_gp4; //!< \~english Gps _CWORD44_GP4 Data
+} MDEV_GPS_RAWDATA__CWORD44_GP4;
+
+/**
+ * @struct MdevGpsRawdata_CWORD44_gp4Msg
+ * \~english Struct of Gps _CWORD44_GP4 Raw Data message
+ */
+typedef struct MdevGpsRawdata_CWORD44_gp4Msg {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_RAWDATA__CWORD44_GP4 st_data; //!< \~english Gps _CWORD44_GP4 Raw Data
+} MDEV_GPS_RAWDATA__CWORD44_GP4_MSG;
+
+/**
+ * @struct SENSORMOTION_SPEEDINFO_DAT
+ * \~english speed information data
+ * - Get method(getMethod)
+ * - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
+ * - SENSOR_GET_METHOD_NAVI - speed from Navi
+ * - Synchrony count(SyncCnt)
+ * - 0 (not change).
+ * - Enable or not(isEnable) \n
+ * To describe this data is whether enable or not
+ * - 0 - not avaliable
+ * - not 0 - avaliable
+ * - Speed is invalid at following condition when speed pulse specified, so [not avaliable] provieded
+ * - Immediately after system start, the sensor data have not been received from SYS micon
+ * - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+ * - If the status is [not avaliable], data following can not be guaranteed.
+ * - Speed
+ * - speed data(unit 0.01m/sec)
+ */
+typedef struct {
+ uint8_t getMethod; //!< \~english get method
+ uint8_t SyncCnt; //!< \~english Synchrony count
+ uint8_t isEnable; //!< \~english enable or not
+ uint8_t Reserved1[3]; //!< \~english reserve
+ uint16_t Speed; //!< \~english speed(0.01m/sec)
+ uint8_t Reserved2[2]; //!< \~english reserve
+} SENSORMOTION_SPEEDINFO_DAT;
+
+/**
+ * @struct MdevGpsNavispeed
+ * \~english Struct of Gps speed data
+ */
+typedef struct MdevGpsNavispeed {
+ MDEV_GPS_DATA_KIND e_kind; //!< \~english kind
+ u_int16 us_speed_kmph; //!< \~english Speed(km/h)
+ u_int8 u_reserve[2]; //!< \~english reserve
+ SENSORMOTION_SPEEDINFO_DAT st_speed; //!< \~english speed data
+} MDEV_GPS_NAVISPEED;
+
+/**
+ * @struct MdevGpsNavispeedMsg
+ * \~english Struct of Gps speed data message
+ */
+typedef struct MdevGpsNavispeedMsg {
+ T_APIMSG_MSGBUF_HEADER h_dr; //!< \~english header
+ MDEV_GPS_NAVISPEED st_data; //!< \~english Gps Speed Data
+} MDEV_GPS_NAVISPEED_MSG;
+
+/**
+ * @struct TgGpsSndData
+ * \~english Struct of _CWORD82_ Gps send data
+ */
+typedef struct TgGpsSndData {
+ uint8_t reserve[4]; //!< \~english reserve
+ u_int16 us_size; //!< \~english send data length
+ u_int8 ub_data[502]; //!< \~english send data
+} TG_GPS_SND_DATA;
+
+/**
+ * @struct TgGpsRetPram
+ * \~english Gps Response data
+ */
+typedef struct TgGpsRetPram {
+ unsigned int ret_status; //!< \~english response flag
+ unsigned char data_len; //!< \~english data size
+ unsigned char ctrl_code; //!< \~english control code
+ unsigned char gps_data[GPS_TLGRM_LEN]; //!< \~english data contents
+} TG_GPS_RET_PRAM;
+
+/**
+ * @struct SensorWknRollOverHal
+ * \~english Struct of GPS week number
+ */
+typedef struct SensorWknRollOverHal {
+ uint16_t us_wkn; //!< \~english GPS week number
+} SENSOR_WKN_ROLLOVER_HAL;
+
+/**
+ * @struct POS_DATETIME
+ * \~english GPS time information structure
+ */
+typedef struct {
+ uint16_t year; //!< \~english year
+ uint8_t month; //!< \~english month
+ uint8_t date; //!< \~english day
+ uint8_t hour; //!< \~english hour
+ uint8_t minute; //!< \~english minute
+ uint8_t second; //!< \~english second
+ uint8_t reserved; //!< \~english reserve
+} POS_DATETIME;
+
+/**
+ * @struct TG_GPS_RET_RESET
+ * \~english GPS reset status
+ */
+typedef struct {
+ unsigned long ret_rst_status; //!< \~english response GPS reset status
+} TG_GPS_RET_RESET;
+
+/**
+ * @struct TG_GPS_RET_RESET_MSG
+ * \~english GPS reset information message
+ */
+typedef struct {
+ TG_GPS_RET_RESET data; //!< \~english GPS reset status data
+} TG_GPS_RET_RESET_MSG;
+
+/**
+ * @struct VEHICLE_MSG_SEND_DAT
+ * \~english Vehicle information setting message structure
+ */
+typedef struct {
+ DID did; //!< \~english Data ID
+ u_int16 size; //!< \~english Data size
+ u_int8 data[502]; //!< \~english Data
+} VEHICLE_MSG_SEND_DAT;
+
+/**
+ * @struct GpsWeekCorCntMsg
+ * \~english Gps Week correction count notify message structure
+ */
+typedef struct GpsWeekCorCntMsg {
+ T_APIMSG_MSGBUF_HEADER stHead; //!< \~english Message header
+ u_int8 gpsweekcorcnt; //!< \~english Gps Week correction count
+ int8 dummy[3]; //!< \~english Alignment adjustment
+} CLOCKGPS_GPSWEEKCOR_CNT_MSG;
+
+/** @}*/ // end of positioning_hal
+/** @}*/ // end of positioning
+
+/*---------------------------------------------------------------------------*/
+#endif // HAL_API_GPS_HAL_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/hal_api/positioning_hal.h b/video_in_hal/positioning_hal/hal_api/positioning_hal.h
new file mode 100755
index 0000000..8a74b81
--- /dev/null
+++ b/video_in_hal/positioning_hal/hal_api/positioning_hal.h
@@ -0,0 +1,872 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_POSITIONING_HAL_H_
+#define HAL_API_POSITIONING_HAL_H_
+
+/**
+ * @file positioning_hal.h
+ */
+
+/** @addtogroup positioning
+ * @{
+ */
+/** @addtogroup positioning_hal
+ * @ingroup positioning
+ * @{
+ */
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include <native_service/frameworkunified_types.h>
+#include <vehicle_service/pos_message_header.h>
+#include <vehicle_service/std_types.h>
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define POSHAL_THREAD_NAME_SENS "POS_Sens"
+//!< \~english Thread name for receive sensor
+#define POSHAL_THREAD_NAME_GPS_MAIN "POS_Gps"
+//!< \~english Thread name for GPS NMEA analysis and delivery message
+#define POSHAL_THREAD_NAME_GPS_RECV "POS_Gps_Recv"
+//!< \~english Thread name for receive GPS
+#define POSHAL_THREAD_NAME_GPS_ROLOVR "POS_Gps_Rolovr"
+//!< \~english Thread name for monitoring GPS rollover
+
+#define POSHAL_DID_SNS_COUNTER 0x8000001A
+//!< \~english Data ID of sensor counter
+#define POSHAL_DID_SPEED_PULSE 0x80000012
+//!< \~english Data ID of speed pulse
+#define POSHAL_DID_SPEED_PULSE_FLAG 0x80000076
+//!< \~english Data ID of speed pulse flag
+#define POSHAL_DID_SPEED_PULSE_FST 0x80000028
+//!< \~english Data ID of first time speed pulse
+#define POSHAL_DID_SPEED_PULSE_FLAG_FST 0x8000007D
+//!< \~english Data ID of first time speed pulse flag
+#define POSHAL_DID_SPEED_KMPH 0x80000013
+//!< \~english Data ID of KMPH speed
+#define POSHAL_DID_PULSE_TIME 0x8000003A
+//!< \~english Data ID of pulse time
+#define POSHAL_DID_GYRO_X 0x80000014
+//!< \~english Data ID of X axis of gyro
+#define POSHAL_DID_GYRO_Y 0x80000085
+//!< \~english Data ID of Y axis of gyro
+#define POSHAL_DID_GYRO_Z 0x80000086
+//!< \~english Data ID of Z axis ofgyro
+#define POSHAL_DID_GYRO POSHAL_DID_GYRO_X
+//!< \~english Data ID of gyro
+#define POSHAL_DID_GYRO_X_FST 0x80000029
+//!< \~english Data ID of first time X axis gyro
+#define POSHAL_DID_GYRO_Y_FST 0x80000043
+//!< \~english Data ID of first time Y axis gyro
+#define POSHAL_DID_GYRO_Z_FST 0x80000023
+//!< \~english Data ID of first time Z axis gyro
+#define POSHAL_DID_GYRO_FST POSHAL_DID_GYRO_X_FST
+//!< \~english Data ID of first time gyro
+#define POSHAL_DID_GYRO_EXT 0x80000027
+//!< \~english Data ID of extend gyro
+#define POSHAL_DID_GYRO_TEMP 0x80000090
+//!< \~english Data ID of gyro temperature
+#define POSHAL_DID_GYRO_TEMP_FST 0x80000091
+//!< \~english Data ID of first time gyro temperature
+#define POSHAL_DID_REV 0x80000017
+//!< \~english Data ID of reverse signal
+#define POSHAL_DID_REV_FST 0x8000007E
+//!< \~english Data ID of first time reverse signal
+#define POSHAL_DID_GSNS_X 0x80000015
+//!< \~english Data ID of x axis gsensor
+#define POSHAL_DID_GSNS_Y 0x80000016
+//!< \~english Data ID of Y axis gsensor
+#define POSHAL_DID_GSNS_Z 0x80000026
+//!< \~english Data ID of Z axis gsensor
+#define POSHAL_DID_GSNS_X_FST 0x80000087
+//!< \~english Data ID of first time x axis gsensor
+#define POSHAL_DID_GSNS_Y_FST 0x80000088
+//!< \~english Data ID of first time Y axis gsensor
+#define POSHAL_DID_GSNS_Z_FST 0x80000089
+//!< \~english Data ID of first time Z axis gsensor
+#define POSHAL_DID_GPS_NMEA 0x8000009AU
+//!< \~english Data ID of GPS NMEA sentence
+#define POSHAL_DID_GPS_ANTENNA 0x80000019
+//!< \~english Data ID of GPS antenna status
+#define POSHAL_DID_GPS_CUSTOMDATA 0x80000094U
+//!< \~english Data ID of GPS custom data
+#define POSHAL_DID_GPS_CUSTOMDATA_NAVI 0x800000A0
+//!< \~english Data ID of GPS custom data for navi
+#define POSHAL_DID_GPS_TIME 0x80000098
+//!< \~english Data ID of GPS time
+#define POSHAL_DID_GPS_TIME_RAW 0x800000B1U
+//!< \~english Data ID of GPS raw time
+#define POSHAL_DID_GPS_VERSION 0x8000001E
+//!< \~english Data ID of GPS version
+#define POSHAL_DID_GPS__CWORD82___CWORD44_GP4 0x80000031U
+//!< \~english Data ID of _CWORD82_ GPS _CWORD44_GP4 data
+#define POSHAL_DID_GPS__CWORD82__FULLBINARY 0x80000032U
+//!< \~english Data ID of _CWORD82_ GPS full binary data
+#define POSHAL_DID_GPS_WKNROLLOVER 0x800000B2U
+//!< \~english Data ID of GPS week counter
+#define POSHAL_DID_GPS_CLOCK_DRIFT 0x800000B3U
+//!< \~english Data ID of GPS time drift data
+#define POSHAL_DID_GPS_CLOCK_FREQ 0x800000B4U
+//!< \~english Data ID of GPS time frequency data
+#define POSHAL_DID_GPS_INTERRUPT_FLAG 0x80000077
+//!< \~english Data ID of GPS interrupt flag
+
+#define CONFIG_SENSOR_EXT_VALID 1 //!< \~english for first sensor
+
+#define CID_LINESENS_VEHICLE_DATA 0x0300 //!< \~english vehicle notify ID
+
+/**
+ * \~english @brief LineSensor Vehicle Signal Notification
+ * \~english @brief This command is sent when LineSensor vehicle signals are notified when sensor data is received.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataG\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatG\n
+ * \~english @brief Message body (vehicle signal notification message information) structure @ref LsdrvLsdataG\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_G 0x0303
+
+/**
+ * \~english @brief Gyro Failure Status Notification
+ * \~english @brief This command is sent when giro failure status is notified.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataGyroTrouble\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatGyroTrouble\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_GYRO_TROUBLE 0x0304
+
+/**
+ * \~english @brief Get SYS GPS Interrupt Signals
+ * \~english @brief This command is sent when SYS GPS interrupt signal is acquired.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataGpsInterruptSignal\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatGpsInterruptSignal\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_SYS_GPS_INTERRUPT_SIGNAL 0x0305
+
+
+/**
+ * \~english @brief Gyro Connection Status Notification
+ * \~english @brief This command is sent when giro connection status is notified.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataGyroConnectStatus\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatGyroConnectStatus\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_GYRO_CONNECT_STATUS 0x0306
+
+
+/**
+ * \~english @brief GPS Antenna Connection Status Notification
+ * \~english @brief This command is sent when the GPS antenna connection status is notified.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataGpsAntennaStatus\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatGpsAntennaStatus\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_GPS_ANTENNA_STATUS 0x0307
+
+
+/**
+ * \~english @brief LineSensor Vehicle Signal Notification(Initial Sensor)
+ * \~english @brief This command is sent when LineSensor vehicle signals (initial sensor) are notified.\n
+ * \~english @brief Message related structure @ref LsdrvMsgLsdataFst\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref LsdrvMsgLsdataDatFst\n
+ * \~english @brief Gyro X-axis @ref LsdrvLsdataFstGyroX\n
+ * \~english @brief Gyro Y-axis @ref LsdrvLsdataFstGyroY\n
+ * \~english @brief Gyro Z-axis @ref LsdrvLsdataFstGyroZ\n
+ * \~english @brief Velocity information @ref LsdrvLsdataFstSpeed\n
+ * \~english @brief Vehicle speed pulse @ref LsdrvLsdataFstSpeedPulseFlag\n
+ * \~english @brief REV flag @ref LsdrvLsdataFstRev\n
+ * \~english @brief Gyro Temperature @ref LsdrvLsdataFstGyroTemp\n
+ * \~english @brief G-sensor X-axis @ref LsdrvLsdataFstGsensorX\n
+ * \~english @brief G-sensor Y-axis @ref LsdrvLsdataFstGsensorY\n
+ * \~english @brief G-sensor Z-axis @ref LsdrvLsdataFstGsensorZ\n
+ */
+#define CID_LINESENS_VEHICLE_DATA_FST 0x0302
+
+/**
+ * \~english @brief GPS data notification
+ * \~english @brief This command is used to notify the data input from the GPS receiver device.\n
+ * \~english @brief Message related structure @ref SensorMsgGpsdata\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
+ * \~english @brief Message body structure @ref SensorMsgGpsdataDat\n
+ */
+#define CID_GPS_DATA 0x0301
+
+/**
+ * \~english @brief Notification of effective ephemeris number at shutdown
+ * \~english @brief This command is sent to notify the effective ephemeris number at shutdown.\n
+ * \~english @brief Message related structure @ref SensorMsgGpsdata\n
+ * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
+ * \~english @brief Message body structure @ref SensorMsgGpsdata\n
+ */
+#define CID_EPH_NUM_NOTIFICATION 0x0310
+
+
+#define LSDRV_FSTSNS_SENSOR_FIRST_SAVE_NUM 50
+//!< \~english number of save first sensor
+
+#define LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM 30
+//!< \~english number of send first sensor
+
+#define LSDRV_FSTSNS_DETAILED_DATA_GYRO_NUM 10
+//!< \~english number of gyro including detail data
+
+#define LSDRV_FSTSNS_DETAILED_DATA_GSENSOR_NUM 10
+//!< \~english number of Gsns includeing detail data
+
+#define LSDRV_FSTSNS_DSIZE_GYRO_X (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GYRO_NUM * 2)
+//!< \~english data size of X axis of gyro
+#define LSDRV_FSTSNS_DSIZE_GYRO_Y (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GYRO_NUM * 2)
+//!< \~english data size of Y axis of gyro
+#define LSDRV_FSTSNS_DSIZE_GYRO_Z (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GYRO_NUM * 2)
+//!< \~english data size of Z axis of gyro
+#define LSDRV_FSTSNS_DSIZE_SPEED (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * 2)
+//!< \~english data size of speed
+#define LSDRV_FSTSNS_DSIZE_SPEED_FLG LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM
+//!< \~english data size of speed pulse
+#define LSDRV_FSTSNS_DSIZE_REV LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM
+//!< \~english data size of reverse
+#define LSDRV_FSTSNS_DSIZE_GYRO_TEMP (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * 2)
+//!< \~english data size of gyro temperature
+#define LSDRV_FSTSNS_DSIZE_GSENSOR_X (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GSENSOR_NUM * 2)
+//!< \~english data size of X axis of Gsns
+
+#define LSDRV_FSTSNS_DSIZE_GSENSOR_Y (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GSENSOR_NUM * 2)
+ //!< \~english data size of Y axis of Gsns
+#define LSDRV_FSTSNS_DSIZE_GSENSOR_Z (LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM * LSDRV_FSTSNS_DETAILED_DATA_GSENSOR_NUM * 2)
+//!< \~english data size of Z axis of Gsns
+
+#define SENSOR_MSG_VSINFO_DSIZE 1904 //!< \~english message body max size
+
+
+// Thread control Command ID
+#define CID_THREAD_CREATE_COMP (0x0001) //!< \~english Thread Start Complete Notify Command ID
+#define CID_THREAD_STOP_REQ (0x0002) //!< \~english Thread Stop Request Command ID
+#define CID_THREAD_STOP_COMP (0x0003) //!< \~english Thread Stop Complete Notify Command ID
+
+// A vehicle signal of data size
+#define LSDRV_SNDMSG_DTSIZE_1 1 //!< \~english SndMSG data size 1Byte
+#define LSDRV_SNDMSG_DTSIZE_2 2 //!< \~english SndMSG data size 2Byte
+#define LSDRV_SNDMSG_DTSIZE_20 20 //!< \~english SndMSG data size 20Byte
+#define LSDRV_SNDMSG_DTSIZE_132 132 //!< \~english SndMSG data size 132Byte
+
+// NMEA receive flag
+#define POS_SNS_GPS_NMEA_GGA (0x00000001U) //!< \~english GGA sentence
+#define POS_SNS_GPS_NMEA_GLL (0x00000002U) //!< \~english GLL sentence
+#define POS_SNS_GPS_NMEA_GSA1 (0x00000004U) //!< \~english GSA1 sentence
+#define POS_SNS_GPS_NMEA_GSA2 (0x00000008U) //!< \~english GSA2 sentence
+#define POS_SNS_GPS_NMEA_GSA3 (0x00000010U) //!< \~english GSA3 sentence
+#define POS_SNS_GPS_NMEA_GSA4 (0x00000020U) //!< \~english GSA4 sentence
+#define POS_SNS_GPS_NMEA_GST (0x00000040U) //!< \~english GST sentence
+#define POS_SNS_GPS_NMEA_RMC (0x00000080U) //!< \~english RMC sentence
+#define POS_SNS_GPS_NMEA_VTG (0x00000100U) //!< \~english VTG sentence
+#define POS_SNS_GPS_NMEA_GSV1 (0x00000200U) //!< \~english GSV1 sentence
+#define POS_SNS_GPS_NMEA_GSV2 (0x00000400U) //!< \~english GSV2 sentence
+#define POS_SNS_GPS_NMEA_GSV3 (0x00000800U) //!< \~english GSV3 sentence
+#define POS_SNS_GPS_NMEA_GSV4 (0x00001000U) //!< \~english GSV4 sentence
+#define POS_SNS_GPS_NMEA_GSV5 (0x00002000U) //!< \~english GSV5 sentence
+#define POS_SNS_GPS_NMEA_GSV6 (0x00004000U) //!< \~english GSV6 sentence
+#define POS_SNS_GPS_NMEA_GSV7 (0x00008000U) //!< \~english GSV7 sentence
+#define POS_SNS_GPS_NMEA_GSV8 (0x00010000U) //!< \~english GSV8 sentence
+#define POS_SNS_GPS_NMEA_GSV9 (0x00020000U) //!< \~english GSV9 sentence
+#define POS_SNS_GPS_NMEA_GSV10 (0x00040000U) //!< \~english GSV10 sentence
+#define POS_SNS_GPS_NMEA_GSV11 (0x00080000U) //!< \~english GSV11 sentence
+#define POS_SNS_GPS_NMEA_GSV12 (0x00100000U) //!< \~english GSV12 sentence
+#define POS_SNS_GPS_NMEA_GSV13 (0x00200000U) //!< \~english GSV13 sentence
+#define POS_SNS_GPS_NMEA_RESERVE1 (0x00400000U) //!< \~english Reserved
+#define POS_SNS_GPS_NMEA_RESERVE2 (0x00800000U) //!< \~english Reserved
+
+
+/**
+ * @enum POS_SNS_GPS_NMEA_SNO
+ * \~english type of NMEA
+ */
+typedef enum {
+ POS_SNS_GPS_NMEA_SNO_GGA = 0, //!< \~english GGA sentence
+ POS_SNS_GPS_NMEA_SNO_GLL, //!< \~english GLL sentence
+ POS_SNS_GPS_NMEA_SNO_GSA1, //!< \~english GSA1 sentence
+ POS_SNS_GPS_NMEA_SNO_GSA2, //!< \~english GSA2 sentence
+ POS_SNS_GPS_NMEA_SNO_GSA3, //!< \~english GSA3 sentence
+ POS_SNS_GPS_NMEA_SNO_GSA4, //!< \~english GSA4 sentence
+ POS_SNS_GPS_NMEA_SNO_GST, //!< \~english GST sentence
+ POS_SNS_GPS_NMEA_SNO_RMC, //!< \~english RMC sentence
+ POS_SNS_GPS_NMEA_SNO_VTG, //!< \~english VTG sentence
+ POS_SNS_GPS_NMEA_SNO_GSV1, //!< \~english GSV1 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV2, //!< \~english GSV2 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV3, //!< \~english GSV3 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV4, //!< \~english GSV4 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV5, //!< \~english GSV5 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV6, //!< \~english GSV6 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV7, //!< \~english GSV7 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV8, //!< \~english GSV8 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV9, //!< \~english GSV9 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV10, //!< \~english GSV10 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV11, //!< \~english GSV11 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV12, //!< \~english GSV12 sentence
+ POS_SNS_GPS_NMEA_SNO_GSV13, //!< \~english GSV13 sentence
+ POS_SNS_GPS_NMEA_SNO_RESERVE1, //!< \~english Reserved
+ POS_SNS_GPS_NMEA_SNO_RESERVE2, //!< \~english Reserved
+
+ POS_SNS_GPS_NMEA_SNO_MAX //!< \~english MAX sentence(invalid)
+} POS_SNS_GPS_NMEA_SNO;
+
+/**
+ * @enum LsDrvKind
+ * \~english type of Sensor
+ */
+typedef enum {
+ LSDRV_GYRO_X, //!< \~english Gyro X-Axis
+ LSDRV_GYRO_Y, //!< \~english Gyro Y-Axis
+ LSDRV_GYRO_Z, //!< \~english Gyro Z-Axis
+ LSDRV_SPEED_PULSE, //!< \~english Speed pulse
+ LSDRV_SPEED_PULSE_FLAG, //!< \~english Speed pulse Flag
+ LSDRV_SPEED_KMPH, //!< \~english Speed km/h
+ LSDRV_GYRO_EXT, //!< \~english extend Gyro
+ LSDRV_REV, //!< \~english Reverse
+ LSDRV_GYRO_TEMP, //!< \~english Gyro temperature
+ LSDRV_GSENSOR_X, //!< \~english G-sensor X-Axis
+ LSDRV_GSENSOR_Y, //!< \~english G-sensor Y-Axis
+ LSDRV_GSENSOR_Z, //!< \~english G-sensor Z-Axis
+ LSDRV_PULSE_TIME, //!< \~english Pulse time
+ LSDRV_SNS_COUNTER, //!< \~english Sensor counter
+ LSDRV_GPS_INTERRUPT_FLAG, //!< \~english GPS Interrupt Flag
+ LSDRV_KINDS_MAX //!< \~english MAX
+} LsDrvKind;
+
+
+/**
+ * @enum EnumTidPos
+ * \~english Thread id notified to positioning when starting or terminating each thread is completed.
+ */
+typedef enum EnumTidPos {
+ ETID_POS_MAIN = 0,
+ //!< \~english Thread for vehicle sensor(unused in hal)
+ ETID_POS_SENS,
+ //!< \~english Thread for receive sensor
+ ETID_POS_GPS,
+ //!< \~english Thread for GPS NMEA analysis and delivery message
+ ETID_POS_GPS_RECV,
+ //!< \~english Thread for receive GPS
+ ETID_POS_GPS_ROLLOVER,
+ //!< \~english Thread for monitoring GPS rollover
+ ETID_POS_MAX
+ //!< \~english Max thread id
+} EnumTID_POS;
+
+/**
+ * @struct LsdrvLsdata
+ * \~english Struct of LineSensor message
+ */
+typedef struct LsdrvLsdata {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 uc_rcvflag; //!< \~english receive flag
+ u_int8 uc_sns_cnt; //!< \~english sensor count
+ u_int8 u_reserve; //!< \~english reserve
+ u_int8 uc_data[132]; //!< \~english data contents
+} LSDRV_LSDATA;
+
+/**
+ * @struct LsdrvLsdataG
+ * \~english Struct of LineSensorG message
+ */
+typedef struct LsdrvLsdataG {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 uc_rcv_flag; //!< \~english receive flag
+ u_int8 uc_sns_cnt; //!< \~english sensor count
+ u_int8 reserve; //!< \~english reserve
+ u_int8 uc_data[132]; //!< \~english data content
+} LSDRV_LSDATA_G;
+
+/**
+ * @struct LsdrvLsdataFstGyroX
+ * \~english Struct of X axis of of gyro data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGyroX {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GYRO_X]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GYRO_X;
+
+/**
+ * @struct LsdrvLsdataFstGyroY
+ * \~english Struct of Y axis of of gyro data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGyroY {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GYRO_Y]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GYRO_Y;
+
+/**
+ * @struct LsdrvLsdataFstGyroZ
+ * \~english Struct of Z axis of of gyro data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGyroZ {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GYRO_Z]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GYRO_Z;
+
+/**
+ * @struct LsdrvLsdataFstSpeed
+ * \~english Struct of speed data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstSpeed {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_SPEED]; //!< \~english data contents
+} LSDRV_LSDATA_FST_SPEED;
+
+/**
+ * @struct LsdrvLsdataFstSpeedPulseFlag
+ * \~english Struct of speed pulse data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstSpeedPulseFlag {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_SPEED_FLG]; //!< \~english data contents
+} LSDRV_LSDATA_FST_SPEED_PULSE_FLAG;
+
+/**
+ * @struct LsdrvLsdataFstRev
+ * \~english Struct of reverse data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstRev {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_REV]; //!< \~english data contents
+} LSDRV_LSDATA_FST_REV;
+
+/**
+ * @struct LsdrvLsdataFstGyroTemp
+ * \~english Struct of gyro temperature data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGyroTemp {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GYRO_TEMP]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GYRO_TEMP;
+
+/**
+ * @struct LsdrvLsdataFstGsensorX
+ * \~english Struct of X axis of Gsns data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGsensorX {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GSENSOR_X]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GSENSOR_X;
+
+/**
+ * @struct LsdrvLsdataFstGsensorY
+ * \~english Struct of Y axis of Gsns data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGsensorY {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GSENSOR_Y]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GSENSOR_Y;
+
+/**
+ * @struct LsdrvLsdataFstGsensorZ
+ * \~english Struct of Z axis of Gsns data(first sensor message)
+ */
+typedef struct LsdrvLsdataFstGsensorZ {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[LSDRV_FSTSNS_DSIZE_GSENSOR_Z]; //!< \~english data contents
+} LSDRV_LSDATA_FST_GSENSOR_Z;
+
+/**
+ * @struct LsdrvMsgLsdataDatFst
+ * \~english Struct of LineSensor data (first sensor message)
+ */
+typedef struct LsdrvMsgLsdataDatFst {
+ LSDRV_LSDATA_FST_GYRO_X st_gyro_x; //!< \~english data of X axis of gyro
+ LSDRV_LSDATA_FST_GYRO_Y st_gyro_y; //!< \~english data of Y axis of gyro
+ LSDRV_LSDATA_FST_GYRO_Z st_gyro_z; //!< \~english data of Z axis of gyro
+ LSDRV_LSDATA_FST_SPEED st_speed; //!< \~english data of speed
+ LSDRV_LSDATA_FST_SPEED_PULSE_FLAG st_spd_pulse_flg; //!< \~english data of speed pulse
+ LSDRV_LSDATA_FST_REV st_rev; //!< \~english data of reverse
+ LSDRV_LSDATA_FST_GYRO_TEMP st_gyro_temp; //!< \~english data of gyro temperature
+ LSDRV_LSDATA_FST_GSENSOR_X st_gsns_x; //!< \~english data of X axis of Gsns
+ LSDRV_LSDATA_FST_GSENSOR_Y st_gsns_y; //!< \~english data of Y axis of Gsns
+ LSDRV_LSDATA_FST_GSENSOR_Z st_gsns_z; //!< \~english data of Z axis of Gsns
+} LSDRV_MSG_LSDATA_DAT_FST;
+
+/**
+ * @struct LsdrvMsgLsdataDat
+ * \~english Struct of LineSensor package data
+ */
+typedef struct LsdrvMsgLsdataDat {
+ u_int8 uc_data_num; //!< \~english data number
+ u_int8 reserve[3]; //!< \~english reserve
+ LSDRV_LSDATA st_data[12]; //!< \~english data
+} LSDRV_MSG_LSDATA_DAT;
+
+/**
+ * @struct LsdrvMsgLsdata
+ * \~english Struct of LineSensor message data
+ */
+typedef struct LsdrvMsgLsdata {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT st_para; //!< \~english data of gyro
+} LSDRV_MSG_LSDATA;
+
+/**
+ * @struct LsdrvMsgLsdataDatG
+ * \~english Struct of LineSensorG package data
+ */
+typedef struct LsdrvMsgLsdataDatG {
+ u_int8 uc_data_num; //!< \~english data number
+ u_int8 reserve[3]; //!< \~english reserve
+ LSDRV_LSDATA_G st_data[15]; //!< \~english data
+} LSDRV_MSG_LSDATA_DAT_G;
+
+/**
+ * @struct LsdrvMsgLsdataG
+ * \~english Struct of LineSensorG message data
+ */
+typedef struct LsdrvMsgLsdataG {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_G st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_G;
+
+/**
+ * @struct LsdrvMsgLsdataDatGyroTrouble
+ * \~english Struct of Gyro trouble
+ */
+typedef struct LsdrvMsgLsdataDatGyroTrouble {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 reserve; //!< \~english reserve
+ u_int8 uc_data; //!< \~english data content
+ u_int8 reserve2; //!< \~english reserve
+} LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE;
+
+/**
+ * @struct LsdrvMsgLsdataGyroTrouble
+ * \~english Struct of message about Gyro trouble
+ */
+typedef struct LsdrvMsgLsdataGyroTrouble {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_GYRO_TROUBLE;
+
+/**
+ * @struct LsdrvMsgLsdataDatGpsInterruptSignal
+ * \~english Struct of Gps interrupt signal data
+ */
+typedef struct LsdrvMsgLsdataDatGpsInterruptSignal {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 reserve; //!< \~english reserve
+ u_int8 uc_data; //!< \~english data content
+ u_int8 reserve2; //!< \~english reserve
+} LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL;
+
+/**
+ * @struct LsdrvMsgLsdataGpsInterruptSignal
+ * \~english Struct of message about Gps interrupt signal
+ */
+typedef struct LsdrvMsgLsdataGpsInterruptSignal {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_GPS_INTERRUPT_SIGNAL;
+
+/**
+ * @struct LsdrvMsgLsdataDatGyroConnectStatus
+ * \~english Struct of Gyro connect status
+ */
+typedef struct LsdrvMsgLsdataDatGyroConnectStatus {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 reserve; //!< \~english reserve
+ u_int8 uc_data; //!< \~english data content
+ u_int8 reserve2; //!< \~english reserve
+} LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS;
+
+/**
+ * @struct LsdrvMsgLsdataGyroConnectStatus
+ * \~english Struct of message about Gyro connect status
+ */
+typedef struct LsdrvMsgLsdataGyroConnectStatus {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_GYRO_CONNECT_STATUS;
+
+/**
+ * @struct LsdrvMsgLsdataDatGpsAntennaStatus
+ * \~english Struct of Gps Antenna Status
+ */
+typedef struct LsdrvMsgLsdataDatGpsAntennaStatus {
+ u_int32 ul_did; //!< \~english data ID
+ u_int8 uc_size; //!< \~english data size
+ u_int8 uc_rcv_flag; //!< \~english receive flag
+ u_int8 uc_sns_cnt; //!< \~english sensor count
+ u_int8 uc_data; //!< \~english data content
+} LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS;
+
+/**
+ * @struct LsdrvMsgLsdataGpsAntennaStatus
+ * \~english Struct of message about Gps Antenna Status
+ */
+typedef struct LsdrvMsgLsdataGpsAntennaStatus {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_GPS_ANTENNA_STATUS;
+
+/**
+ * @struct LsdrvLsdataFst
+ * \~english Struct of sensor data (first sensor message)
+ */
+typedef struct LsdrvLsdataFst {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 uc_size; //!< \~english data size
+ u_int8 uc_partition_max; //!< \~english total of partition
+ u_int8 uc_partition_num; //!< \~english data number
+ u_int8 uc_data[60]; //!< \~english data contents
+} LSDRV_LSDATA_FST;
+
+/**
+ * @struct LsdrvMsgLsdataFst
+ * \~english Struct of message about sensor data (first sensor message)
+ */
+typedef struct LsdrvMsgLsdataFst {
+ T_APIMSG_MSGBUF_HEADER st_head; //!< \~english message header
+ LSDRV_MSG_LSDATA_DAT_FST st_para; //!< \~english data of message
+} LSDRV_MSG_LSDATA_FST;
+
+/**
+ * @struct SensorMsgGpsdataDat
+ * \~english Struct of Gps data
+ * \~english @par Detail
+ * This data structure can have 7 types of data that identified by data ID.\n
+ * The contents are as follows.\n
+ * | data ID | content | data format |
+ * |:----------------------------------|:------------------------------------------|:------------------------------|
+ * | @ref POSHAL_DID_GPS_NMEA | NMEA data | @ref MdevGpsNmea "MDEV_GPS_NMEA" |
+ * | @ref POSHAL_DID_GPS_CUSTOMDATA | GPS custom data | @ref MdevGpsCustomDataMgs "MDEV_GPS_CUSTOMDATA" |
+ * | @ref POSHAL_DID_GPS_CLOCK_DRIFT | clock drift | @ref int32_t |
+ * | @ref POSHAL_DID_GPS_CLOCK_FREQ | clock frequency | @ref int32_t |
+ * | @ref POSHAL_DID_GPS_WKNROLLOVER | GPS week number | @ref SensorWknRollOverHal |
+ * | @ref POSHAL_DID_GPS_CONNECT_ERROR | GPS signal error(TRUE:Error, FALSE:Normal)| @ref BOOL |
+ * | @ref POSHAL_DID_GPS_TIME (_RAW) | GPS time information | @ref SENSOR_GPSTIME |
+ */
+typedef struct SensorMsgGpsdataDat {
+ u_int32 ul_did; //!< \~english data ID
+ u_int16 us_size; //!< \~english data size
+ u_int8 uc_rcv_flag; //!< \~english receive flag
+ u_int8 uc_sns_cnt; //!< \~english sensor count
+ u_int8 uc_gps_cnt_flag; //!< \~english GPS count
+ u_int8 reserve[3]; //!< \~english reserve
+ u_int8 uc_data[SENSOR_MSG_VSINFO_DSIZE]; //!< \~english data contents
+} SENSOR_MSG_GPSDATA_DAT;
+
+/**
+ * @struct SensorMsgGpsdata
+ * \~english Struct of message about GPS data
+ */
+typedef struct SensorMsgGpsdata {
+ T_APIMSG_MSGBUF_HEADER st_head;
+ //!< \~english message header(see vs-positioning-base-library)
+ SENSOR_MSG_GPSDATA_DAT st_para;
+ //!< \~english data of message
+} SENSOR_MSG_GPSDATA;
+
+/**
+ * @struct TG_GPS_RET_TIMESET_MSG
+ * \~english Struct of message about GPS time set response
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER header; //!< \~english message header
+ uint64_t status; //!< \~english response status
+} TG_GPS_RET_TIMESET_MSG;
+
+/**
+ * @struct TG_GPS_NMEA_SENTENCE_INFO
+ * \~english Struct of GPS NMEA sentence info
+ */
+typedef struct {
+ uint8_t uc_size; //!< \~english sentence size
+ uint8_t reserve; //!< \~english reserve
+ uint16_t us_offset; //!< \~english sentence start offset
+} TG_GPS_NMEA_SENTENCE_INFO;
+
+/**
+ * @struct TG_GPS_NMEA_INFO
+ * \~english Struct of GPS NMEA info
+ */
+typedef struct {
+ uint32_t ul_rcvsts; //!< \~english NMEA receive info
+ uint8_t reserve[4]; //!< \~english reserve
+ TG_GPS_NMEA_SENTENCE_INFO st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_MAX];
+ //!< \~english sentence infomation
+} TG_GPS_NMEA_INFO;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_hal
+/// \~english @par Brief
+/// - start thread of NMEA analysis and delivery message
+/// \~english @param [in] h_app
+/// HANDLE - handle
+///
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - This API can not change internal state
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// - start thread of NMEA analysis and delivery message
+/// - the API can only be used by 1 process
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus StartGpsMainThreadPositioning(HANDLE h_app);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_hal
+/// \~english @par Brief
+/// - start thread for receive GPS manager
+/// \~english @param [in] h_app
+/// HANDLE - handle
+///
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - This API can not change internal state.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// - start model for receive GPS manager
+/// - the API can only be used by 1 process
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus StartGpsRecvThreadPositioning(HANDLE h_app);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_hal
+/// \~english @par Brief
+/// - start thread for receive sensor
+/// \~english @param [in] h_app
+/// HANDLE - handle
+///
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - This API can not change internal state.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Detail
+/// - start thread for receive sensor
+/// - the API can only be used by 1 process
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus StartLineSensorThreadPositioning(HANDLE h_app);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_hal
+/// \~english @par Brief
+/// - start monitoring thread of GPS rollover
+/// \~english @param [in] h_app
+/// HANDLE - handle
+///
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+///
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - This API can not change internal state.
+/// \~english @par Conditions of processing failure
+/// - The parameter hApp is NULL [eFrameworkunifiedStatusFail]
+/// - When fail to start thread. [return value of FrameworkunifiedStartChildThread]
+/// \~english @par Detail
+/// - start monitoring thread of GPS rollover
+/// - the API can only be used by 1 process
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @see
+/// FrameworkunifiedCreateChildThread, FrameworkunifiedStartChildThread
+/////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus StartGpsRolloverThreadPositioning(HANDLE h_app);
+
+/** @}*/ // end of positioning_hal
+/** @}*/ // end of positioning
+
+/*---------------------------------------------------------------------------*/
+#endif // HAL_API_POSITIONING_HAL_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/Common/LineSensDrv_Api.h b/video_in_hal/positioning_hal/inc/Common/LineSensDrv_Api.h
new file mode 100755
index 0000000..24c7f55
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/Common/LineSensDrv_Api.h
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Api.h
+*/
+
+#ifndef INC_COMMON_LINESENSDRV_API_H_
+#define INC_COMMON_LINESENSDRV_API_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Define
+
+#define MUTEX_GPS_IRQ_FLG "MUTEX_GPS_IRQ_FLG"
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DeliveryLineSensorDataPositioning(LSDRV_MSG_LSDATA_G*, u_int8);
+BOOL LineSensDrvApiInitialize(void);
+void LineSensDrvApiInitEstGpsCnt(void);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_COMMON_LINESENSDRV_API_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/Common/MDev_Gps_API.h b/video_in_hal/positioning_hal/inc/Common/MDev_Gps_API.h
new file mode 100755
index 0000000..d165a1e
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/Common/MDev_Gps_API.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_API.h
+*/
+
+#ifndef INC_COMMON_MDEV_GPS_API_H_
+#define INC_COMMON_MDEV_GPS_API_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+RET_API SendNmeaGps(const MDEV_GPS_NMEA* p_nmea_data);
+RET_API SendCustomGps(const SENSOR_MSG_GPSTIME* p_gps_time,
+ const SENSORLOCATION_LONLATINFO_DAT* p_lonlat,
+ const SENSORLOCATION_ALTITUDEINFO_DAT* p_altitude,
+ const SENSORMOTION_HEADINGINFO_DAT* p_heading,
+ const NAVIINFO_DIAG_GPS* p_diag_data);
+RET_API SendSpeedGps(const SENSORMOTION_SPEEDINFO_DAT* p_seed, u_int16 us_peed);
+RET_API SendTimeGps(const MDEV_GPS_RTC* p_rtc);
+RET_API SendClockDriftGps(int32_t drift);
+RET_API SendClockFrequencyGps(uint32_t freq);
+RET_API DevGpsSndWknRollover(const SensorWknRollOverHal* p_week_rollover);
+int32 DevGpsRstAnsSend(PNO u_pno, RID uc_rid, u_int32 ul_rst_sts);
+int32 DevGpsTimesetAnsSend(PNO u_pno, RID uc_rid, u_int32 ul_rst_sts);
+RET_API DevSendGpsConnectError(BOOL);
+RET_API SndGpsTimeRaw(const SENSOR_GPSTIME_RAW* pst_gpstime_raw);
+/*---------------------------------------------------------------------------*/
+#endif // INC_COMMON_MDEV_GPS_API_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/Common/positioning_common.h b/video_in_hal/positioning_hal/inc/Common/positioning_common.h
new file mode 100755
index 0000000..dad0272
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/Common/positioning_common.h
@@ -0,0 +1,63 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file positioning_common.h
+*/
+
+#ifndef INC_COMMON_POSITIONING_COMMON_H_
+#define INC_COMMON_POSITIONING_COMMON_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Definition
+
+/*---------------------------------------------------------------------------*/
+// ENUMERATION
+
+/*---------------------------------------------------------------------------*/
+// STRUCTURE
+
+typedef struct PosResetinfo {
+ uint8_t mode; // Reset mode
+ uint8_t reserve[3]; // reserve
+ PNO sndpno; // Caller PNO
+ PNO respno; // Destination PNO
+} POS_RESETINFO;
+
+/*!
+ @brief Thread activation information
+*/
+typedef struct StThreadSetupInfo {
+ EnumSetupMode_POS mode; // Thread activation mode
+} ST_THREAD_SETUP_INFO;
+
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+EFrameworkunifiedStatus PosInitialize(HANDLE h_app);
+EnumSetupMode_POS PosSetupThread(HANDLE h_app, EnumTID_POS e_tid);
+void PosTeardownThread(EnumTID_POS e_tid);
+EFrameworkunifiedStatus PosCreateThread(HANDLE h_app, int8_t index);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_COMMON_POSITIONING_COMMON_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/Common/positioning_def.h b/video_in_hal/positioning_hal/inc/Common/positioning_def.h
new file mode 100755
index 0000000..df95cb3
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/Common/positioning_def.h
@@ -0,0 +1,307 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file positioning_def.h
+*/
+
+#ifndef INC_COMMON_POSITIONING_DEF_H_
+#define INC_COMMON_POSITIONING_DEF_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include <string.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <vehicle_service/std_types.h>
+#include <vehicle_service/pos_message_header.h>
+#include <vehicle_service/sys_timerapi.h>
+#include <vehicle_service/WPF_STD.h>
+
+#include "gps_hal.h"
+#include "positioning_hal.h"
+
+#include "positioning_log.h"
+
+/*---------------------------------------------------------------------------*/
+// Definition
+
+#define POS_THREAD_NAME "Positioning"
+
+/**
+ * @enum ENUM_GPS_NMEA_INDEX
+ * \~english NMEA index
+ */
+typedef enum {
+ GPS_NMEA_INDEX_GGA = 0, //!< \~english GGA
+ GPS_NMEA_INDEX_DGGA, //!< \~english DGGA
+ GPS_NMEA_INDEX_VTG, //!< \~english VTG
+ GPS_NMEA_INDEX_RMC, //!< \~english RMC
+ GPS_NMEA_INDEX_DRMC, //!< \~english DRMC
+ GPS_NMEA_INDEX_GLL, //!< \~english GLL
+ GPS_NMEA_INDEX_DGLL, //!< \~english DGLL
+ GPS_NMEA_INDEX_GSA, //!< \~english GSA
+ GPS_NMEA_INDEX_GSV1, //!< \~english GSV1
+ GPS_NMEA_INDEX_GSV2, //!< \~english GSV2
+ GPS_NMEA_INDEX_GSV3, //!< \~english GSV3
+ GPS_NMEA_INDEX_GSV4, //!< \~english GSV4
+ GPS_NMEA_INDEX_GSV5, //!< \~english GSV5
+ GPS_NMEA_INDEX_GST, //!< \~english GST
+ GPS_NMEA_INDEX__CWORD44__GP_3, //!< \~english _CWORD44_,GP,3
+ GPS_NMEA_INDEX__CWORD44__GP_4, //!< \~english _CWORD44_,GP,4
+ GPS_NMEA_INDEX_P_CWORD82_F_GP_0, //!< \~english _CWORD44_,GP,0
+ GPS_NMEA_INDEX_P_CWORD82_J_GP_1, //!< \~english _CWORD44_,GP,1
+ GPS_NMEA_INDEX_MAX //!< \~english GGA
+} ENUM_GPS_NMEA_INDEX;
+
+//!< \~english Gps cycle Data Event
+#define GPS_EVT_CYCLEDATA_PROV ("GPS_EVT_CYCLEDATA_PROV")
+//!< \~english Event value: Waiting.
+#define GPS_EVT_PROV_WAIT (0x00000000)
+//!< \~english Event value: Clear Waiting status.
+#define GPS_EVT_PROV_RELEASE (0x00000001)
+
+//!< \~english Gps received
+#define GPS_CYCLECMD_NOTRCV (0x00)
+//!< \~english Gps no received
+#define GPS_CYCLECMD_RCV (0x01)
+
+//!< \~english store position of Hour data
+#define GPSCMD_DRMC_HOUR_POS (7)
+//!< \~english store position of minute data
+#define GPSCMD_DRMC_MIN_POS (9)
+//!< \~english store position of second data
+#define GPSCMD_DRMC_SEC_POS (11)
+//!< \~english store position of status
+#define GPSCMD_DRMC_STATUS_POS (14)
+//!< \~english store position of day data
+#define GPSCMD_DRMC_DAY_POS (54)
+//!< \~english store position of month data
+#define GPSCMD_DRMC_MONTH_POS (56)
+//!< \~english store position of year data
+#define GPSCMD_DRMC_YEAR_POS (58)
+
+//!< \~english store position of control code
+#define GPSCMD_RTC_CTRLCODE_POS (0)
+//!< \~english store position of year data (BCD)
+#define GPSCMD_RTC_BCD_YEAR_POS (1)
+//!< \~english store position of month data(BCD)
+#define GPSCMD_RTC_BCD_MONTH_POS (2)
+//!< \~english store position of day data(BCD)
+#define GPSCMD_RTC_BCD_DAY_POS (3)
+//!< \~english store position of hour data(BCD)
+#define GPSCMD_RTC_BCD_HOUR_POS (4)
+//!< \~english store position of minute data(BCD)
+#define GPSCMD_RTC_BCD_MIN_POS (5)
+//!< \~english store position of second data(BCD)
+#define GPSCMD_RTC_BCD_SEC_POS (6)
+//!< \~english store position of status
+#define GPSCMD_RTC_STATUS_POS (7)
+
+#define GPSCMD_RTC_CTRLCODE (0xA4) //!< \~english control code (RTC)
+#define GPSCMD_RTC_STATUS_UTCTIME (0x00) //!< \~english Normal
+#define GPSCMD_RTC_STATUS_ERRTIME (0x03) //!< \~english AbNormal
+
+// Internal thread activation status determination
+#define THREAD_STS_MSK_POS_MAIN (0x01)
+#define THREAD_STS_MSK_POS_SENS (0x02)
+#define THREAD_STS_MSK_POS_GPS (0x04)
+#define THREAD_STS_MSK_POS_GPS_RECV (0x08)
+#define THREAD_STS_MSK_POS_GPS_ROLLOVER (0x10)
+#define POS_DID_GPS_NMEA 0x8000009AU /* QAC 1281 */
+#define POS_DID_GPS_CLOCK_DRIFT 0x800000B3U /* QAC 1281 */
+#define POS_DID_GPS_CLOCK_FREQ 0x800000B4U /* QAC 1281 */
+#define VEHICLE_DID_GPS_CUSTOMDATA 0x80000094U
+#define VEHICLE_DID_GPS_CLOCK_DRIFT POS_DID_GPS_CLOCK_DRIFT
+#define VEHICLE_DID_GPS_CLOCK_FREQ POS_DID_GPS_CLOCK_FREQ
+#define CID_NAVIINFO_DELIVER (0x0205) /* Navigation information setting CID */
+#define CID_NAVIINFO_SPEED_DELIVER (0x0206) /* Vehicle speed setting CID */
+#define VEHICLE_DID_GPS_WKNROLLOVER 0x800000B2U
+#define VEHICLE_DID_GPS_TIME_RAW 0x800000B1
+#define POS_DID_GYRO_TEMP 0x80000090
+#define VEHICLE_DID_SPEED_PULSE 0x80000012
+#define VEHICLE_DID_GYRO_X 0x80000014
+#define VEHICLE_DID_GYRO_Y 0x80000020
+#define VEHICLE_DID_GYRO_Z 0x80000021
+#define VEHICLE_DID_GYRO VEHICLE_DID_GYRO_X
+#define VEHICLE_DID_REV 0x80000017
+#define VEHICLE_DID_SNS_COUNTER 0x8000001A
+#define VEHICLE_DID_GPS_COUNTER 0x8000001B
+#define VEHICLE_DID_GYRO_EXT 0x80000027 /* 3 ~ 14bit A/D value,0bit:REV */
+#define VEHICLE_DID_SPEED_PULSE_FST 0x80000028 /* Pulse(Number) */
+#define VEHICLE_DID_GYRO_FST_X 0x80000029
+#define VEHICLE_DID_GYRO_FST_Y 0x80000022
+#define VEHICLE_DID_GYRO_FST_Z 0x80000023
+#define VEHICLE_DID_GYRO_FST VEHICLE_DID_GYRO_FST
+#define VEHICLE_DID_GYRO_TEMP POS_DID_GYRO_TEMP
+#define VEHICLE_DID_SPEED_KMPH 0x80000013
+#define VEHICLE_DID_GSNS_X 0x80000015
+#define VEHICLE_DID_GSNS_Y 0x80000016
+#define VEHICLE_DID_GSNS_Z 0x80000024
+#define VEHICLE_DID_PULSE_TIME 0x8000003A
+#define CID__CWORD83__CMD_RCV 0x0103
+#define CID__CWORD83__CMD_SND_STS 0x0104
+#define CID_GPS_SERIAL0 (CID)0x0100
+#define CID_GPS_REQRESET (CID)(CID_GPS_BASE | CID_GPS_SERIAL0)
+
+#define VEHICLE_CONFIG_GPS_UNITSET_NOGPS (0x00U) //!< \~english no Gps
+#define VEHICLE_CONFIG_GPS_UNITSET__CWORD82_ (0x01U) //!< \~english _CWORD82_ Gps
+#define VEHICLE_CONFIG_GPS_UNITSET_EXTBOX (0x02U) //!< \~english extern u-blox
+
+//!< \~english no Navi
+#define VEHICLE_CONFIG_NAVI_FUNCTION_NONAVI (0x00U)
+//!< \~english Navi has AW navi
+#define VEHICLE_CONFIG_NAVI_FUNCTION_AWNAVI (0x01U)
+
+#define VEHICLE_GPS_SYSTIME_YEAR_MAX (2085U) //!< \~english Gps Time allowed max year
+#define VEHICLE_GPS_SYSTIME_MONTH_MAX (12U) //!< \~english Gps Time allowed max month
+#define VEHICLE_GPS_SYSTIME_DAY_MAX (31U) //!< \~english Gps Time allowed max day
+#define VEHICLE_GPS_SYSTIME_HOUR_MAX (23U) //!< \~english Gps Time allowed max hour
+#define VEHICLE_GPS_SYSTIME_MINUTE_MAX (59U) //!< \~english Gps Time allowed max minute
+#define VEHICLE_GPS_SYSTIME_SECOND_MAX (59U) //!< \~english Gps Time allowed max second
+
+#define VEHICLE_GPS_SYSTIME_YEAR_MIN (1986U) //!< \~english Gps Time allowed min year
+#define VEHICLE_GPS_SYSTIME_MONTH_MIN (1U) //!< \~english Gps Time allowed min month
+#define VEHICLE_GPS_SYSTIME_DAY_MIN (1U) //!< \~english Gps Time allowed min day
+#define VEHICLE_GPS_SYSTIME_HOUR_MIN (0U) //!< \~english Gps Time allowed min hour
+#define VEHICLE_GPS_SYSTIME_MINUTE_MIN (0U) //!< \~english Gps Time allowed min minute
+#define VEHICLE_GPS_SYSTIME_SECOND_MIN (0U) //!< \~english Gps Time allowed min second
+#define VEHICLE_EVENT_VAL_INIT (-14) /* Event initial value */
+//!< \~english check OK (value not change)
+#define MDEV_GPS_SRAM_CHK_OK (0)
+//!< \~english check OK(vaule change)
+#define MDEV_GPS_SRAM_CHK_CHG (1)
+//!< \~english check NG
+#define MDEV_GPS_SRAM_CHK_NG (-1)
+
+/*---------------------------------------------------------------------------*/
+// ENUMERATION
+
+/*!
+ @brief Positioning operating status definitions
+*/
+typedef enum EnumExeStsPos {
+ EPOS_EXE_STS_STOP = 0, /* Stopped */
+ EPOS_EXE_STS_RUNNING, /* Running (from FrameworkunifiedOnStart to FrameworkunifiedOnStop) */
+ EPOS_EXE_STS_RUNNING_COLDSTART /* Running after cold start */
+} EnumExeSts_POS;
+
+/*!
+ @brief Positioning Thread Startup Modes
+*/
+typedef enum EnumSetupModePos {
+ EPOS_SETUP_MODE_NORMAL = 0, /* Normal start */
+ EPOS_SETUP_MODE_DATA_RESET /* Data reset start */ /* QAC 930 */
+} EnumSetupMode_POS;
+
+/**
+ * @struct TG_GPS_RCV_DATA
+ * \~english Struct of Gps receive data for VehicleSens
+ */
+typedef struct TgGpsRcvData {
+ uint32_t dwret_status; //!< \~english return status
+ uint16_t bydata_len; //!< \~english data length
+ uint8_t bygps_data[GPS_READ_LEN]; //!< \~english receive data
+ uint8_t u_reserve2[2]; //!< \~english reserve
+} TG_GPS_RCV_DATA;
+
+/**
+ * @struct TG_GPS_NMEA_DAT
+ * \~english Struct of NMEA data
+ */
+typedef struct TgGpsNmeaDat {
+ u_int8 uc_data[GPS_NMEA_MAX_SZ]; //!< \~english NMEA data
+} TG_GPS_NMEA_DAT;
+
+/**
+ * @struct TG_GPS_CYCLEDATA_NMEA
+ * \~english Struct of NMEA cycle data
+ */
+typedef struct TgGpsCycledataNmea {
+ //!< \~english receive flag
+ u_int8 uc_rcvflag[GPS_NMEA_INDEX_MAX];
+ //!< \~english reserve
+ u_int8 u_reserve[3];
+ //!< \~english structure of NMEA data
+ TG_GPS_NMEA_DAT st_nmea[GPS_NMEA_INDEX_MAX];
+} TG_GPS_CYCLEDATA_NMEA;
+
+/**
+ * @struct TG_GPS_CYCLEDATA_BINARY
+ * \~english Struct of binary cycle data
+ */
+typedef struct TgGpsCycledataBinary {
+ u_int8 uc_rcvflag; //!< \~english receive flag
+ u_int8 u_reserve[3]; //!< \~english reserve
+ u_int8 uc_data[GPS_CMD_BINARY_SZ]; //!< \~english binary data
+ u_int8 u_reserve2[3]; //!< \~english reserve flag
+} TG_GPS_CYCLEDATA_BINARY;
+
+/**
+ * @struct TG_GPS_CYCLEDATA_FULLBIN
+ * \~english Struct of full bin cycle data
+ */
+typedef struct TgGpsCycledataFullbin {
+ u_int8 uc_rcvflag; //!< \~english receive flag
+ u_int8 u_reserve[3]; //!< \~english reserve
+ u_int8 uc_data[GPS_CMD_FULLBIN_SZ]; //!< \~english fullbin data
+ u_int8 u_reserve2; //!< \~english reserve
+} TG_GPS_CYCLEDATA_FULLBIN;
+
+/**
+ * @struct TG_GPS_CYCLEDATA_RTC
+ * \~english Struct of RTC cycle data
+ */
+typedef struct TgGpsCycledataRtc {
+ u_int8 uc_rcvflag; //!< \~english receive flag
+ u_int8 u_reserve[3]; //!< \~english reserve
+ u_int8 uc_data[GPS_DATASIZE_RTC]; //!< \~english Rtc data
+} TG_GPS_CYCLEDATA_RTC;
+
+/**
+ * @struct TG_GPS_CYCLEDATA
+ * \~english Struct of Gps cycle data
+ */
+typedef struct TgGpsCycledata {
+ u_int8 uc_sesncnt; //!< \~english count value
+ u_int8 u_reserve[3]; //!< \~english reserve
+ TG_GPS_CYCLEDATA_NMEA st_nmea_data; //!< \~english NMEA Data
+ TG_GPS_CYCLEDATA_BINARY st_binary_data; //!< \~english binary Data
+ TG_GPS_CYCLEDATA_FULLBIN st_fullbin_data; //!< \~english Full Bin Data
+ TG_GPS_CYCLEDATA_RTC st_rtc_data; //!< \~english RTC Data
+} TG_GPS_CYCLEDATA;
+
+typedef struct {
+ u_int16 year; /* YEAR */
+ u_int8 month; /* MONTH */
+ u_int8 date; /* DAY */
+ u_int8 hour; /* HOUR */
+ u_int8 minute;/* MINUTE */
+ u_int8 second;/* SECOND */
+ u_int8 flag; /* Whether or not the time is set */
+} ST_GPS_SET_TIME;
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_COMMON_POSITIONING_DEF_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/Common/positioning_log.h b/video_in_hal/positioning_hal/inc/Common/positioning_log.h
new file mode 100755
index 0000000..6ca4c96
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/Common/positioning_log.h
@@ -0,0 +1,43 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file positioning_log.h
+*/
+
+#ifndef INC_COMMON_POSITIONING_LOG_H_
+#define INC_COMMON_POSITIONING_LOG_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include <stdio.h>
+
+/*---------------------------------------------------------------------------*/
+// Definition
+
+// #define POSITIONING_DEBUG
+
+#ifdef POSITIONING_DEBUG
+#define POSITIONING_LOG(...) printf(__VA_ARGS__)
+#else
+#define POSITIONING_LOG(...)
+#endif
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_COMMON_POSITIONING_LOG_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h
new file mode 100755
index 0000000..6ea4787
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h
@@ -0,0 +1,170 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_GpsRecv.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPSRECV_H_
+#define INC_GPSCOMMON_MDEV_GPSRECV_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Define
+
+/* ++ GPS _CWORD82_ support */
+#define GPS__CWORD82__CMD_LEN_MAX 200
+/* -- GPS _CWORD82_ support */
+
+/* ++ GPS _CWORD82_ support */
+#define GPS__CWORD82__RET_START_SEQ_NONE 0 /* _CWORD82_ Start Sequence Determination Result = None */
+#define GPS__CWORD82__RET_START_SEQ_NMEA 1 /* _CWORD82_ Start Sequence Determination Result = NMEA */
+#define GPS__CWORD82__RET_START_SEQ_FULL 2 /* _CWORD82_ Start Sequence Determination Result = Full customization */
+#define GPS__CWORD82__RET_START_SEQ_BIN 3 /* _CWORD82_ Start Sequence Determination Result = Standard binary #GPF_60_024 */
+
+#define GPS_UBLOX_RET_START_SEQ_UBX 4 /* Ublox Start Sequence Decision Result = UBX Protocol (binary) */
+#define GPS__CWORD82__FULLBINARY_LEN GPS_CMD_FULLBIN_SZ /* _CWORD82_ Full Customization Instruction Length */
+
+#define GPS__CWORD82__NORMALBINARY_LEN 81 /* _CWORD82_ standard binary instruction length #GPF_60_024 */
+/* -- GPS _CWORD82_ support */
+
+/* Maximum size of serial data read */
+#define GPS_RCV_MAXREADSIZE (2048) /* Changed from 256 -> 2048 #01 */
+
+/* Receive data storage buffer size */
+#define GPS_RCV_RCVBUFSIZE 512 /* Maximum size of the command to be received must be larger than the maximum size */
+
+/* Max-size receive commands ID4:(188+8)byte */
+/* Analysis data buffer size */
+#define GPS_RCV_ANADATABUFSIZE (GPS_RCV_MAXREADSIZE + GPS_RCV_RCVBUFSIZE)
+
+/* Receive frame buffer size */
+#define GPS_RCV_RCVFRAMEBUFSIZE GPS_RCV_RCVBUFSIZE /* Maximum size of the command to be received must be larger than the maximum size */
+
+/* Reception notification data buffer size */
+#define GPS_RCV_SNDCMD_SIZE_MAX
+
+/* Common return values */
+#define GPS_RCV_RET_ERR_EXT (-4) /* External cause error */
+#define GPS_RCV_RET_ERR_SYSTEM (-3) /* System error */
+#define GPS_RCV_RET_ERR (-1) /* Abnormality */
+#define GPS_RCV_RET_NML 0 /* Normal */
+
+// Reception thread reception frame detection result
+#define GPS_RCV_FRMSRCH_ERR_FORMAT (-1) /* Frame format error */
+#define GPS_RCV_FRMSRCH_FIXED 0 /* Frame determination */
+#define GPS_RCV_FRMSRCH_NOT_FIXED 1 /* Frame undetermined */
+#define GPS_RCV_FRMSRCH_NO_DATA 2 /* No analysis data */
+
+// Result of receive thread receive frame analysis
+#define GPS_RCV_FRMANA_ERR_PRM (-3) /* Parameter error */
+#define GPS_RCV_FRMANA_ERR_FORMAT (-2) /* Frame format error */
+#define GPS_RCV_FRMANA_ERR_CS (-1) /* Sumcheck error */
+#define GPS_RCV_FRMANA_OK 0 /* Normal data */
+
+/* Serial reception event determination result */
+enum GpsRcvRet {
+ GPS_RCV_REVT_NML = 0, /* Receiving(Normal) */
+ GPS_RCV_REVT_ERR, /* Receiving(Error) */
+ GPS_RCV_REVT_NUM /* Number of events received */
+};
+
+// Error logging
+#define ERLG_SER_FRAMEERR "Serial Framing Error"
+#define ERLG_SER_OVERRUNERR "Serial Overrun Error"
+#define ERLG_SER_PARITYERR "Serial Parity Error"
+#define ERLG_RCVEV_JDGERR "DEV_Gps_Recv_JdgSerEvt error"
+#define ERLG_RCVDATA_SNDERR "DEV_Gps_Recv_SndRcvData error"
+#define ERLG_COMEVNT_WAITERR "WaitCommEvent error"
+
+/*---------------------------------------------------------------------------*/
+// Struct
+
+// Serial receive buffer structure
+typedef struct GPSRecvData {
+ u_int16 us_read_size; /* Serial data read data size */
+ u_int8 uc_reserve[2]; /* Preliminary */
+ u_int8 uc_read_data[GPS_RCV_MAXREADSIZE]; /* Serial read data */
+} TG_GPS_RECV_RcvData;
+
+// Receive data storage buffer structure
+typedef struct GPSRecvBuf {
+ u_int16 r_size; /* Received size */
+ u_int8 rsv[2]; /* Reserved */
+ u_int8 r_buf[GPS_RCV_RCVBUFSIZE]; /* Receive command data */
+} TG_GPS_RECV_RcvBuf;
+
+// Data analysis buffer
+typedef struct GPSRecvAnaDataBuf {
+ u_int16 datsize; /* Size of the data */
+ u_int16 offset; /* Analysis start offset */
+ u_int8 datbuf[GPS_RCV_ANADATABUFSIZE]; /* Analysis data */
+} TG_GPS_RECV_AnaDataBuf;
+
+// Receive frame buffer
+typedef struct GPSRecvFrameBuf {
+ u_int16 size; /* Frame-size */
+ u_int8 rsv[2]; /* Reserved */
+ u_int8 buf[GPS_RCV_RCVFRAMEBUFSIZE]; /* Command data */
+} TG_GPS_RECV_RcvFrameBuf;
+
+/*---------------------------------------------------------------------------*/
+// External variable
+
+extern TG_GPS_RECV_RcvData g_gps_rcvdata; /* Serial receive buffer */
+extern TG_GPS_RECV_RcvBuf g_gps_rcvbuf; /* Receive data storage buffer */
+extern TG_GPS_RECV_AnaDataBuf g_gps_ana_databuf; /* Analysis data buffer */
+extern TG_GPS_RECV_RcvFrameBuf g_gps_rcv_framebuf; /* Receive frame buffer */
+extern u_int16 g_wrecv_err; /* Number of reception errors */
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+/* Initializing process */
+void DevGpsRecvInit(void);
+
+/* Buffer clear processing */
+void DevGpsRecvClrRcvBuf(void);
+
+/* Receive (normal) receive processing */
+void DevGpsRecvRcvNormal(void);
+
+/* Data reception processing */
+int32 DevGpsRecvReadRcvData(TG_GPS_RECV_RcvData* pst_rcv_data);
+
+/* Frame detection processing */
+int32 DevGpsRecvSearchFrameData(const TG_GPS_RECV_AnaDataBuf *adbuf_p, u_int16 *ana_size);
+
+/* Receive data transmission processing */
+void DevGpsRecvSndRcvData(const TG_GPS_RECV_RcvFrameBuf *p_frame_buf);
+
+/* Acknowledgement */
+RET_API DevRcvData(const TG_GPS_RCV_DATA* ptg_rcv_data);
+
+/* Pos_Gps_Recv Thread Stop Processing */
+void DevGpsRecvThreadStopProcess(void);
+
+EFrameworkunifiedStatus DevGpsRecvThread(HANDLE h_app);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPSRECV_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h
new file mode 100755
index 0000000..22da3c9
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_GpsRollOver.h
+*/
+#ifndef INC_GPSCOMMON_MDEV_GPSROLLOVER_H_
+#define INC_GPSCOMMON_MDEV_GPSROLLOVER_H_
+
+#include <vehicle_service/WPF_STD.h>
+
+typedef struct TimRolovrYMD {
+ u_int16 year;
+ u_int16 month;
+ u_int16 day;
+ u_int8 dummy[2];
+} TG_TIM_ROLOVR_YMD;
+
+
+void GPSRollOverConvTime(TG_TIM_ROLOVR_YMD* base_ymd, TG_TIM_ROLOVR_YMD* conv_ymd, u_int8 gpsweekcorcnt);
+
+#endif // INC_GPSCOMMON_MDEV_GPSROLLOVER_H_
diff --git a/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h
new file mode 100755
index 0000000..7812858
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h
@@ -0,0 +1,187 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Common.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_COMMON_H_
+#define INC_GPSCOMMON_MDEV_GPS_COMMON_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+#include "MDev_Gps_Main.h"
+
+/*---------------------------------------------------------------------------*/
+// Define
+
+#define NMEA_CHECKSUM_CHAR '*' /* *## (HEX) */
+#define NMEA_DATA_SEPARATOR ','
+
+#define GPS_NMEA_FIELD_LEN_MAX (GPS_NMEA_MAX_SZ)
+
+// NMEA GGA Sentence
+/* Fix Status */
+#define GPS_NMEA_GGA_FIX_STATUS_NON 0 /* invalid */
+#define GPS_NMEA_GGA_FIX_STATUS_GPS 1 /* GPS SPS Mode, Fix valid */
+#define GPS_NMEA_GGA_FIX_STATUS_DGPS 2 /* DGPS SPS Mode, Fix valid */
+#define GPS_NMEA_GGA_FIX_STATUS_DR 6 /* Estimated/Dead Reckoning */
+/* Field No */
+#define GPS_NMEA_FNO_GGA_FS 6
+#define GPS_NMEA_FNO_GGA_MSL 9
+
+/* number of SV Fields */
+#define GPS_NMEA_NUM_GSA_SV 12
+/* Fix Status */
+#define GPS_NMEA_GSA_FIX_STS_NON 1
+#define GPS_NMEA_GSA_FIX_STS_2D 2
+#define GPS_NMEA_GSA_FIX_STS_3D 3
+/* Field No */
+#define GPS_NMEA_FNO_GSA_FS 2
+#define GPS_NMEA_FNO_GSA_SV 3
+
+/* number of Satellite Infomation Fields (sv+elv+az+cno) */
+#define GPS_NMEA_NUM_GSV_SINFO 4
+ /* Field No */
+#define GPS_NMEA_FNO_GSV_NOSV 3
+#define GPS_NMEA_FNO_GSV_SV 4
+#define GPS_NMEA_FNO_GSV_ELV 5
+#define GPS_NMEA_FNO_GSV_AZ 6
+#define GPS_NMEA_FNO_GSV_CNO 7
+
+#define GPS_NMEA_RMC_STS_INVALID 'V'
+#define GPS_NMEA_RMC_STS_VALID 'A'
+#define GPS_NMEA_RMC_IND_NORTH 'N'
+#define GPS_NMEA_RMC_IND_EAST 'E'
+
+/* Field No */
+#define GPS_NMEA_FNO_RMC_UTC 1
+#define GPS_NMEA_FNO_RMC_STATUS 2
+#define GPS_NMEA_FNO_RMC_LATITUDE 3
+#define GPS_NMEA_FNO_RMC_NS 4
+#define GPS_NMEA_FNO_RMC_LONGITUDE 5
+#define GPS_NMEA_FNO_RMC_EW 6
+#define GPS_NMEA_FNO_RMC_SPEED 7
+#define GPS_NMEA_FNO_RMC_COG 8
+#define GPS_NMEA_FNO_RMC_DATE 9
+
+// Diag Fix Count
+#define GPS_DIAG_FIX_COUNT_3D (0x01)
+#define GPS_DIAG_FIX_COUNT_2D (0x02)
+#define GPS_DIAG_FIX_COUNT_ELSE (0x04)
+
+/* GPS time setting related */
+#define GPS_SETTIME_RANGE 5 /* 5 seconds : Valid range of GPS time setting */
+#define GPS_TIME_RANGE 10 /* 10 seconds : GPS time change range */
+
+/* NAV-SVINFO logging status */
+#define GPS_NAVSVINFO_STS_INIT 0
+#define GPS_NAVSVINFO_STS_READY 1
+#define GPS_NAVSVINFO_STS_DONE 2
+#define GPS_NAVSVINFO_STS_SETTING 3
+
+/* Time setting information */
+#define GPS_TIME_RX 0 /* Time not set */
+#define GPS_TIME_ROLOVR 1 /* First GPS reception(for rollover) */
+#define GPS_TIME_SET 2 /* Time setting in progress */
+
+/*!
+ @brief Satellite position information
+*/
+typedef struct GpsSatelliteInfoStr {
+ uint8_t sv; /* Satellite number */
+ uint8_t elv; /* Height 0-99 */
+ uint16_t az; /* Orientation 0-359 */
+ uint8_t cno; /* Signal strength */
+ uint8_t sts; /* Reception status */
+} GpsSatelliteInfo;
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+extern BOOL g_gps_rcv_thread_stop;
+extern uint8_t g_is_gpstime_sts;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void ChangeStatusGpsCommon(u_int32 sts);
+void RtyResetGpsCommon(void);
+void SendRtyResetGpsCommon(void);
+void SendReqGpsCommon(void);
+void GPSResetReqGpsCommon(void);
+void CyclDataTimeOutGpsCommon(void);
+RET_API CheckFrontStringPartGpsCommon(const u_char *p_tartget, const u_char *p_start);
+int32 JudgeFormatGpsCommon(u_char *p_send_data, u_int32 ul_length, TG_GPS_OUTPUT_FORMAT *p_format);
+RET_API CheckSumGpsCommon(const u_int8 p_uc_data[], u_int32 ul_length, TG_GPS_OUTPUT_FORMAT e_cmd_info);
+u_int8 AtoHGpsCommon(u_int8 ascii);
+RET_API DevGpsSaveCmd(TG_GPS_SAVECMD *p_send_data);
+void SendSaveCmdGpsCommon(void);
+void DeleteSaveCmdGpsCommon(void);
+void DeleteAllSaveCmdGpsCommon(void);
+void RcvCyclCmdNmeaGpsCommon(u_int8 *p_uc_data, u_int32 ul_len, TG_GPS_OUTPUT_FORMAT s_output_format);
+int32 CheckSendCmdGpsCommon(const u_char *p_rcv_data, u_int32 ul_length, TG_GPS_OUTPUT_FORMAT *p_format);
+int32_t GetStringFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, char* p_dst, size_t size);
+double GetNumericFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+int32 GetIntegerFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src);
+int32 GetLonLatFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+u_int16 GetHeadingFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+int32 GetAltitudeFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+u_int16 GetSpeedFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+void StopThreadGpsCommon(void);
+uint8_t JudgeFormatOrderGpsCommon(TG_GPS_OUTPUT_FORMAT s_format_1, TG_GPS_OUTPUT_FORMAT s_format_2);
+ENUM_GPS_NMEA_INDEX GetNmeaIdxGpsCommon(TG_GPS_OUTPUT_FORMAT s_output_format);
+void SendResetReqGpsCommon(void);
+
+
+void WriteGpsTimeToBackup(uint8_t flag, POS_DATETIME* pst_datetime);
+void DevGpsCommSettingTime(void);
+RET_API GpsSetPosBaseEvent(uint16_t snd_pno, int32_t event_val);
+uint8_t HardResetChkGpsCommon(void);
+void RcvCyclCmdExtGpsCommon(u_int8 *p_data, u_int32 len, TG_GPS_OUTPUT_FORMAT format);
+
+BOOL DevGpsRcvProcGpsResetResp(TG_GPS_RCV_DATA*);
+void DevGpsRcvProcTimeSetResp(TG_GPS_RCV_DATA*);
+void DevGpsRcvProcWknRolloverGetResp(TG_GPS_RCV_DATA* p_data);
+void DevGpsRcvProcNavSvinfoAddResp(TG_GPS_RCV_DATA* p_data);
+void DevGpsReadGpsTime(POS_DATETIME* p_st_datetime);
+RET_API DevGpsRcvProcCmnResp(TG_GPS_RCV_DATA* p_data, uint8_t cmd);
+RET_API DevGpsResetReq(PNO us_pno, RID uc_rid);
+void DevGpsSettingTime(POS_DATETIME* p_st_datetime);
+int DevGpsYMD2JD(int y, int m, int d);
+BOOL DevGpsYMD2GPSTIME(const int32 y, const int32 m, const int32 d,
+ const int32 hh, const int32 mm, const int32 ss,
+ u_int16* gpsw, u_int32* gpsws);
+void DevGpsSetChkSum(u_int8* uc_buffer, u_int32 ul_length);
+RET_API DevGpsCatPollReq(uint8_t *p_ublox_data, uint16_t kind);
+void DevGpsSetGpsweekcorcnt(void);
+RET_API DevGpsNavTimeUTCAddReq(void);
+RET_API DevGpsWknRolloverGetReq(void);
+BOOL DevGpsCheckGpsTime(uint16_t set_gpsw, uint32_t set_gpsws,
+ uint16_t rcv_gpsw, uint32_t rcv_gpsws, int32_t offset_range);
+
+void DevGpsCnvLonLatNavi(SENSORLOCATION_LONLATINFO_DAT* p_lonlat,
+ u_int8 fix_sts, int32 lon, int32 lat);
+void DevGpsCnvAltitudeNavi(SENSORLOCATION_ALTITUDEINFO_DAT* p_altitude,
+ u_int8 fix_sts, int32 alt);
+void DevGpsCnvHeadingNavi(SENSORMOTION_HEADINGINFO_DAT* p_heading,
+ u_int8 fix_sts, u_int16 heading);
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_COMMON_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h
new file mode 100755
index 0000000..d40cb0c
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h
@@ -0,0 +1,311 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Main.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_MAIN_H_
+#define INC_GPSCOMMON_MDEV_GPS_MAIN_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+// #include "gps_hal.h"
+// #include "MDev_Gps_Nmea.h"
+// #include "LineSensDrv_Api.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define OFF 0 /* OFF */
+#define ON 1 /* ON */
+#define OK 0 /* Normal */
+#define NG (-1L) /* Abnormality */
+#define DAT_END 0xff /* Exit code */
+
+// State
+typedef enum GpsMatrixSts {
+ GPS_STS_STARTUP = 0, /* Startup confirmation */
+ GPS_STS_NORMAL, /* In operation */
+ GPS_STS_SENT, /* Command sent status */
+ GPS_STS_NUM
+}TG_GPS_MATRIX_STS;
+
+// Event
+typedef enum GpsMatrixEvt {
+ GPS_EVT_SENDREQ = 0, /* Transmission request */
+ GPS_EVT_RESETREQ, /* GPS reset request */
+ GPS_EVT_RECVCYCLDAT, /* Cyclic reception command reception */
+ GPS_EVT_RECVRSPDAT, /* Receive response command */
+ GPS_EVT_TIMEOUT_RSPDAT, /* Response monitoring timeout */
+ GPS_EVT_TIMEOUT_CYCLDAT, /* Periodic reception data monitoring timeout */
+ GPS_EVT_TIMEOUT_NAVI, /* Navigation providing data monitoring timeout */
+ GPS_EVT_TIMEOUT_DIAGCLKGUARD, /* Diagnosis provision time guard monitoring timeout*/
+ GPS_EVT_ACC_OFF, /* In-function ACC-OFF instructions */
+ GPS_EVT_NAVI_LOCATIONINFO, /* Providing navigation information */
+ GPS_EVT_NAVI_SPEEDINFO, /* Navigation speed information service */
+ GPS_EVT_TIMESETTING, /* GPS time setting instruction */
+ GPS_EVT_TIMEOUT_NMEADATAGUARD, /* NMEA data-providing guard monitoring timeout*/
+ GPS_EVT_BACKUPDATA_LOAD, /* Backup data read request */
+ GPS_EVT_STOPREQ, /* Thread stop request */
+ GPS_EVT_WEEKCOR_CNT_NOTIFICATIO, /* GPS Week Adjustment Counter Notification */
+ GPS_EVT_TIMEOUT_RECOVERY, /* GPS error monitoring reset timer */
+ GPS_EVT_TIMEOUT_RECEIVERERR, /* GPS receiver anomaly detection timeout */
+ GPS_EVT_NUM
+} TG_GPS_MATRIX_EVT;
+
+typedef enum GpsOutputFormat {
+ GPS_FORMAT_MIN = -1, /* Minimum Receive Format(Initialization) */
+ GPS_FORMAT_BINARY, /* Standard binary */
+ GPS_FORMAT_FULLBIN, /* Full binary */
+ GPS_FORMAT_GGA, /* GGA */
+ GPS_FORMAT_DGGA, /* DGGA */
+ GPS_FORMAT_VTG, /* VTG */
+ GPS_FORMAT_RMC, /* RMC */
+ GPS_FORMAT_DRMC, /* DRMC */
+ GPS_FORMAT_GLL, /* GLL */
+ GPS_FORMAT_DGLL, /* DGLL */
+ GPS_FORMAT_GSA, /* GSA */
+ GPS_FORMAT_GSV1, /* GSV(1) */
+ GPS_FORMAT_GSV2, /* GSV(2) */
+ GPS_FORMAT_GSV3, /* GSV(3) */
+ GPS_FORMAT_GSV4, /* GSV(4) */
+ GPS_FORMAT_GSV5, /* GSV(5) */
+ GPS_FORMAT_GST, /* GST */
+ GPS_FORMAT__CWORD44__GP3, /* _CWORD44_,GP,3 */
+ GPS_FORMAT__CWORD44__GP4, /* _CWORD44_,GP,4 */
+ GPS_FORMAT_P_CWORD82_F_GP0, /* P_CWORD82_F,GP,0 */
+ GPS_FORMAT_P_CWORD82_J_GP1, /* P_CWORD82_J,GP,1 */
+ GPS_FORMAT_P_CWORD82_I_GP, /* P_CWORD82_I,GP */
+ GPS_FORMAT_P_CWORD82_E_GP0, /* P_CWORD82_E,GP,0 */
+ GPS_FORMAT_P_CWORD82_J_GP0, /* P_CWORD82_J,GP,0 */
+ GPS_FORMAT_P_CWORD82_E_GP2, /* P_CWORD82_E,GP,2 */
+ GPS_FORMAT_P_CWORD82_G_GP0, /* P_CWORD82_G,GP,0 */
+ GPS_FORMAT_P_CWORD82_J_GP7, /* P_CWORD82_J,GP,7 */
+ GPS_FORMAT_P_CWORD82_J_GP8, /* P_CWORD82_J,GP,8 */
+ GPS_FORMAT_MON_VER, /* MON-VER */
+ GPS_FORMAT_AID_INI, /* AID-INI */
+ GPS_FORMAT_ACK_ACKNACK, /* ACK-ACKNACK */
+ GPS_FORMAT_NAV_TIMEUTC, /* NAV-TIMEUTC */
+ GPS_FORMAT_NAV_CLOCK, /* NAV-CLOCK */
+ GPS_FORMAT_RXM_RTC5, /* RXM-RTC5 */
+ GPS_FORMAT_NAV_SVINFO, /* NAV-SVINFO */
+ GPS_FORMAT_CFG_NAVX5, /* CFG-NAVX5 */
+ GPS_FORMAT_NMEA, /* NMEA (Sentence unspecified) */
+ GPS_FORMAT_UBX, /* UBX Protocol (binary) */
+ GPS_FORMAT_MAX /* Maximum Receive Format */
+} TG_GPS_OUTPUT_FORMAT;
+
+// Return value
+#define RETRY_OFF 0 /* No retry */
+#define RETRY_ON 1 /* Retry exists */
+#define RETRY_OUT 2 /* Retry out */
+#define NG_RETRYOUT 4 /* Transmission failure retry out */
+
+#define GPSRET_NOPCMD (0) /* Non notification target command #GPF_60_024 */
+#define GPSRET_SNDCMD (1) /* Notification target command #GPF_60_024 */
+#define GPSRET_CMDERR (-1) /* No applicable command #GPF_60_024 */
+
+// Number of Retries
+#define SRSET_MAX 4 /* Maximum serial reset retry value */
+#define HRSET_MAX 3 /* Maximum value of hard reset retry */
+#define SNDNG_MAX 4 /* Maximum retry value of transmission failure */
+
+/* The actual number of retries is SNDNG_MAX-1. */
+#define GPS_RECV_ERR_MAX 5 /* Maximum number of reception errors #GPF_60_024 */
+
+// Others
+#define SAV_MAX 11
+#define GPS_ALTITUDE_INVALID_VAL (-1000000) /* Value when fix altitude is invalid */
+#define GPS_HEADING_INVALID_VAL 36100 /* Value when measurement orientation is invalid */
+
+#define GPS_RECVOK 0 /* Normal reception #13 */
+#define GPS_RECVNG 1 /* Reception error #13 */
+#define GPS_OVERRUN 2 /* Overrun detection #13 */
+#define GPS_PARITY 3 /* Parity detection #13 */
+#define GPS_FRAMING 4 /* Framing detection #13 */
+
+// For the communication management thread
+#define GPS_NON_RECV 0 /* Not received */
+#define GPS_RECV_ACK 1 /* ACK received */
+#define GPS_RECV_DATA 2 /* Receive response command */
+
+#define GPS_SEND_ERR_MAX 5 /* Maximum number of transmission errors */
+#define GPS_CNCT_ERR_MAX 5 /* Maximum number of connection errors */
+
+#define GPS_START_EVT "GPS_EVT" /* Interthread synchronization events */
+#define GPS_EVT_VAL 99 /* Event settings */
+#define GPS_MSGDAT_BUF_SZ 500 /* Receive message buffer size */
+
+// Definition for receive command analysis table #GPF_60_024
+#define SENTENCE_STR_MAX 12 /* Maximum string for judging sentence */
+
+#define SENSOR_MSG_VSINFO_DSIZE 1904 //!< \~english message body max size
+
+/*---------------------------------------------------------------------------*/
+// Structure
+
+/********************************************************************************
+ * TAG :TG_GPS_MNG
+ * ABSTRACT :GPS process management information
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsMng {
+ u_int32 sts; /* Matrix state */
+ u_int32 event; /* Matrix event code */
+ u_int32 rcvsts; /* Response reception status */
+ u_int32 sndcnt; /* Number of transmission attempts */
+ u_int32 hrsetcnt; /* Number of tries before hard reset */
+ u_int32 sndngcnt; /* Number of failed-to-send attempts */
+ TG_GPS_OUTPUT_FORMAT rcv_cmd; /* Types of received GPS commands */
+ TG_GPS_OUTPUT_FORMAT resp_cmd; /* Types of GPS commands during response monitoring */
+ PNO resp_pno; /* Destination PNO */
+ RID resp_rid; /* RID to be notified when responding */
+ u_int8 resp_rst_flag; /* Response command reset flag */
+ BOOL rcv_err_flag; /* GPS receiver error detection flag */
+} TG_GPS_MNG;
+
+/********************************************************************************
+ * TAG :TG_GPS_SAVECMD
+ * ABSTRACT :GPS process pending command
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsSaveCmd {
+ TG_GPS_SND_DATA sndcmd; /* Sending commands(_CWORD82_ command) */
+ PNO us_pno; /* Result notification destination process number(Unused) */
+ RID uc_rid; /* Result Notification Resource ID(Unused) */
+ u_int8 uc_rst; /* Reset flag */
+ TG_GPS_OUTPUT_FORMAT e_cmd_info; /* Command information */
+} TG_GPS_SAVECMD;
+
+/********************************************************************************
+ * TAG :TG_GPS_SAVEBUF
+ * ABSTRACT :GPS process pending buffer management information
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsSaveBuf {
+ u_int32 saveno; /* Current pending index number */
+ u_int32 sendno; /* Current send index number */
+ u_int32 bufsav; /* Number of pending buffers used */
+ TG_GPS_SAVECMD savebuf[SAV_MAX]; /* Pending buffer */
+} TG_GPS_SAVEBUF;
+
+/********************************************************************************
+ * TAG :TG_GPS_MSGRCV
+ * ABSTRACT :Receive message
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsMsgRcv {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ u_int8 msgdat[SENSOR_MSG_VSINFO_DSIZE + 12];
+} TG_GPS_MSGRCV;
+
+/********************************************************************************
+ * TAG :TG_GPS_MSGEVTCHNG
+ * ABSTRACT :GPS message event translation table
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsMsgEvtChng {
+ u_int32 cid; /* Matrix state */
+ u_int32 event; /* Matrix event code */
+} TG_GPS_MSGEVTCHNG;
+
+/********************************************************************************
+ * TAG :TG_GPS_TIMEVTCHNG
+ * ABSTRACT :GPS timer ID and event translation table
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsTimEvtChng {
+ u_int16 tim_id; /* Timer ID information */
+ u_int16 reserve; /* Reserved */
+ u_int32 event; /* Matrix event code */
+} TG_GPS_TIMEVTCHNG;
+
+/********************************************************************************
+ * TAG :Gps_Jmp_Tbl
+ * ABSTRACT :GPS jump table
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsJmpTbl {
+ void (*func)( void ); /* Jump-to module */
+} TG_GPS_JMP_TBL;
+
+/********************************************************************************
+ * TAG :TG_GPS_CMD_ANA_TBL
+ * ABSTRACT :Receive command analysis table structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct TgGpsCmdAnaTbl {
+ u_char c_sentence[SENTENCE_STR_MAX]; /* Sentence identifier */
+ u_int32 ul_length; /* Length of the command */
+ u_int32 ul_rcv_kind; /* Receiving type */
+ BOOL b_snd_cmd_flg; /* Command notification flag */
+ TG_GPS_OUTPUT_FORMAT e_rcv_format; /* Receive Format */
+} TG_GPS_CMD_ANA_TBL;
+
+/********************************************************************************
+ * TAG :TG_GPS_TIME_BCD
+ * ABSTRACT :Time information (BCD) structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsTimeBCD {
+ u_int8 uc_year; /* Year information */
+ u_int8 uc_month; /* Month information */
+ u_int8 uc_day; /* Day information */
+ u_int8 uc_hour; /* Time information */
+ u_int8 uc_min; /* Minute information */
+ u_int8 uc_sec; /* Second information */
+} TG_GPS_TIME_BCD;
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+#define MDEV_GPSMSGCHKC_MAX 10
+#define MDEV_PSTIMCHKC_MAX 11
+extern const TG_GPS_MSGEVTCHNG kGpsMsgchkC[MDEV_GPSMSGCHKC_MAX]; /* Ignore -> MISRA-C:2004 Rule 8.12 */
+extern const TG_GPS_TIMEVTCHNG kGpsTimchkC[MDEV_PSTIMCHKC_MAX]; /* Ignore -> MISRA-C:2004 Rule 8.12 */
+extern const TG_GPS_JMP_TBL kGpsMatxC[GPS_STS_NUM][GPS_EVT_NUM];
+
+#define MDEV_GPSCMDANATBLNMEA_MAX 20
+extern const TG_GPS_CMD_ANA_TBL* kGpsCmdAnaTbl;
+extern const TG_GPS_CMD_ANA_TBL kGpsCmdAnaTblUblox[MDEV_GPSCMDANATBLNMEA_MAX];
+
+extern TG_GPS_SAVEBUF g_gps_save_cmdr;
+extern TG_GPS_MSGRCV g_gps_msg_rcvr;
+extern TG_GPS_MNG g_gps_mngr;
+
+extern u_int16 g_wsend_err; /* Number of transmission errors */
+extern u_int16 g_wcnct_err; /* Number of connection errors */
+extern TG_GPS_OUTPUT_FORMAT g_rcv_format; /* Receive Format */
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+EFrameworkunifiedStatus DevGpsMainThread(HANDLE h_app);
+BOOL DevGpsInit(void);
+void DevGpsRcvMsg(void);
+void DevGpsMsgEventCheck(void);
+void DevGpsTimEventCheck(void);
+void DevGpsGpsVersionCheck(void);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_MAIN_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h
new file mode 100755
index 0000000..610b8d4
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h
@@ -0,0 +1,90 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Mtrx.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_MTRX_H_
+#define INC_GPSCOMMON_MDEV_GPS_MTRX_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DevGpsNop(void);
+void DevGpsInitStartSendReq(void);
+void DevGpsInitStartGPSResetReq(void);
+void DevGpsInitStartRcvCyclCmd(void);
+void DevGpsInitStartCyclDataTimeOut(void);
+void DevGpsInitStartNaviDataTimeOut(void); /* #GPF_60_077 */
+void DevGpsInitStartDiagClkGuardTimeOut(void); /* #GPF_60_077 */
+void DevGpsInitStartAccOffStart(void); /* #GPF_60_024 */
+void DevGpsInitStartNaviInfoDeliver(void); /* #GPF_60_077 */
+void DevGpsInitStartNaviSpeedDeliver(void); /* #GPF_60_077 */
+void DevGpsInitStartSettingTime(void); /* #GPF_60_077 */
+void DevGpsInitStartNmeaDataGuardTimeOut(void); /* #GPF_60_109 */
+
+void DevGpsInitStartBackupDataLoadReq(void);
+void DevGpsInitStartStopReq(void);
+void DevGpsInitStartGpsweekcorcntNtf(void);
+void DevGpsInitStartRecoveryTimeOut(void);
+void DevGpsInitStartGpsReceiverErrTimeOut(void);
+
+void DevGpsNormalSendReq(void);
+void DevGpsNormalGPSResetReq(void);
+void DevGpsNormalRcvCyclCmd(void);
+void DevGpsNormalCyclDataTimeOut(void);
+void DevGpsNormalNaviDataTimeOut(void); /* #GPF_60_077 */
+void DevGpsNormalDiagClkGuardTimeOut(void); /* #GPF_60_077 */
+void DevGpsNormalAccOffStart(void); /* #GPF_60_024 */
+void DevGpsNormalNaviInfoDeliver(void); /* #GPF_60_077 */
+void DevGpsNormalNaviSpeedDeliver(void); /* #GPF_60_077 */
+void DevGpsNormalSettingTime(void); /* #GPF_60_077 */
+void DevGpsNormalNmeaDataGuardTimeOut(void); /* #GPF_60_109 */
+
+void DevGpsNormalBackupDataLoadReq(void);
+void DevGpsNormalStopReq(void);
+void DevGpsNormalGpsweekcorcntNtf(void);
+void DevGpsNormalRecoveryTimeOut(void);
+void DevGpsNormalGpsReceiverErrTimeOut(void);
+
+void DevGpsSendSendReq(void);
+void DevGpsSendGPSResetReq(void);
+void DevGpsSendRcvCyclCmd(void);
+void DevGpsSendRcvRspCmd(void); /* #GPF_60_040 */
+void DevGpsSendRspDataTimeOut(void); /* #GPF_60_040 */
+void DevGpsSendCyclDataTimeOut(void);
+void DevGpsSendNaviDataTimeOut(void); /* #GPF_60_077 */
+void DevGpsSendDiagClkGuardTimeOut(void); /* #GPF_60_077 */
+void DevGpsSendAccOffStart(void); /* #GPF_60_040 */
+void DevGpsSendNaviInfoDeliver(void); /* #GPF_60_077 */
+void DevGpsSendNaviSpeedDeliver(void); /* #GPF_60_077 */
+void DevGpsSendSettingTime(void); /* #GPF_60_077 */
+void DevGpsSendNmeaDataGuardTimeOut(void); /* #GPF_60_109 */
+
+void DevGpsSendBackupDataLoadReq(void);
+void DevGpsSendStopReq(void);
+void DevGpsSendGpsweekcorcntNtf(void);
+void DevGpsSendRecoveryTimeOut(void);
+void DevGpsSendGpsReceiverErrTimeOut(void);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_MTRX_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h
new file mode 100755
index 0000000..a19e3d9
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h
@@ -0,0 +1,313 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_GpsUblox.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_NMEA_H_
+#define INC_GPSCOMMON_MDEV_GPS_NMEA_H_
+
+/*---------------------------------------------------------------------------*/
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define TEST_NMEA (0) /* 0:Normal mode 1:Testing mode */
+
+#define GPS_MAX_NUM_VISIBLE_SATELLITES (20) /* Maximum Number of Visible Satellites *Assume the GSV1~GSV5 */
+
+/* UBX command *****************************/
+
+/* CFG */
+#define UBX_CMD_SIZE_CFG_RST (12) /* size of CFG-RST of UBX sentences */
+#define UBX_CMD_SIZE_CFG_MSG (11) /* size of CFG-MSG of UBX sentences */
+#define UBX_CMD_SIZE_CFG_NAV5 (44) /* size of CFG-NAV5 of UBX sentences */
+#define UBX_CMD_SIZE_CFG_NAV5_POLL (8)
+#define UBX_CMD_SIZE_CFG_NAV5_PLUS_POLL (UBX_CMD_SIZE_CFG_NAV5 + UBX_CMD_SIZE_CFG_NAV5_POLL)
+#define UBX_CMD_SIZE_CFG_NAVX5_POLL (8)
+#define UBX_CMD_OFFSET_WKNROLLOVER (18) /* offset from the top of 'payload' */
+
+/* MON */
+#define UBX_CMD_SIZE_MON_VER (108) /* size of MON-VER of UBX sentences */
+#define UBX_CMD_SIZE_MON_VER_POLL (8)
+#define UBX_CMD_SIZE_MON_VER_SW_VER (30)
+
+/* AID */
+#define UBX_CMD_SIZE_AID_INI (56) /* size of AID-INI of UBX sentences */
+#define UBX_CMD_SIZE_AID_INI_POLL (8)
+#define UBX_CMD_SIZE_AID_INI_PLUS_POLL (UBX_CMD_SIZE_AID_INI + UBX_CMD_SIZE_AID_INI_POLL)
+
+/* ACK */
+#define UBX_CMD_OFFSET_ACKNAK (3) /* offset to Ack/Nack Infomation */
+
+/* NAV */
+#define UBX_CMD_MSK_NAV_TIMEUTC_VALID_TOW (1) /* mask bit for 'validTow' of NAV-TIMEUTC */
+#define UBX_CMD_MSK_NAV_TIMEUTC_VALID_WKN (2) /* mask bit for 'validKwn' of NAV-TIMEUTC */
+#define UBX_CMD_MSK_NAV_TIMEUTC_VALID_UTC (4) /* mask bit for 'validUtc' of NAV-TIMEUTC */
+
+/* Common */
+#define UBX_CMD_SIZE_HDR (2) /* size of 'header' of UBX sentence */
+#define UBX_CMD_SIZE_ID (2) /* size of 'id' of UBX sentence */
+#define UBX_CMD_SIZE_LEN (2) /* size of 'length' of UBX sentence */
+#define UBX_CMD_SIZE_MAX (400) /* size of NAV-SVINFO (numCh=32) */
+#define UBX_CMD_OFFSET_PAYLOAD (UBX_CMD_SIZE_HDR + UBX_CMD_SIZE_ID + UBX_CMD_SIZE_LEN)
+ /* offset to 'payload' of UBX sentence */
+
+/* Types of UBX Poll Request Commands ************/
+#define UBX_POLL_CMD_KIND_AID_INI (1)
+#define UBX_POLL_CMD_KIND_CFG_NAV5 (2)
+
+// GPS-command (_CWORD82_ NMEA) related definitions #GPF_60_024
+/* Command identification character string */
+#define GPS_CMD_NMEA_GGA ("$GPGGA") /* GGA/double precision GGAs */
+#define GPS_CMD_NMEA_VTG ("$GPVTG") /* VTG */
+#define GPS_CMD_NMEA_RMC ("$GPRMC") /* RMC/double precision RMCs */
+#define GPS_CMD_NMEA_GLL ("$GPGLL") /* GLL/double precision GLL */
+#define GPS_CMD_NMEA_GSA ("$GPGSA") /* GSA */
+#define GPS_CMD_NMEA_GSV_1 ("$GPGSV,*,1") /* GSV(1) */
+#define GPS_CMD_NMEA_GSV_2 ("$GPGSV,*,2") /* GSV(2) */
+#define GPS_CMD_NMEA_GSV_3 ("$GPGSV,*,3") /* GSV(3) */
+#define GPS_CMD_NMEA__CWORD44__GP_3 ("$_CWORD44_,GP,3") /* _CWORD44_,GP,3 */
+#define GPS_CMD_NMEA__CWORD44__GP_4 ("$_CWORD44_,GP,4") /* _CWORD44_,GP,4 */
+#define GPS_CMD_NMEA_P_CWORD82_F_GP_0 ("$P_CWORD82_F,GP,0") /* P_CWORD82_F,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_1 ("$P_CWORD82_J,GP,1") /* P_CWORD82_J,GP,1 */
+#define GPS_CMD_NMEA_P_CWORD82_I_GP ("$P_CWORD82_I,GP") /* P_CWORD82_I,GP */
+#define GPS_CMD_NMEA_P_CWORD82_E_GP_0 ("$P_CWORD82_E,GP,0") /* P_CWORD82_E,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_0 ("$P_CWORD82_J,GP,0") /* P_CWORD82_J,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_E_GP_2 ("$P_CWORD82_E,GP,2") /* P_CWORD82_E,GP,2 */
+#define GPS_CMD_NMEA_P_CWORD82_G_GP_0 ("$P_CWORD82_G,GP,0") /* P_CWORD82_G,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_7 ("$P_CWORD82_J,GP,7") /* P_CWORD82_J,GP,7 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_8 ("$P_CWORD82_J,GP,8") /* P_CWORD82_J,GP,8 */
+#define GPS_CMD_NMEA_GST ("$GPGST") /* GST */
+#define GPS_CMD_NMEA_GSV_4 ("$GPGSV,*,4") /* GSV(4) */
+#define GPS_CMD_NMEA_GSV_5 ("$GPGSV,*,5") /* GSV(5) */
+
+/*-------------------------------------------------------------------------------
+ * GPS-command (_CWORD82_ Binary) related definitions #GPF_60_024
+ -------------------------------------------------------------------------------*/
+#define GPS_CMD_BINARY (0xC6) /* Standard binary */
+#define GPS_CMD_FULLBIN (0xB0) /* FULL binaries */
+
+#define ENDMARK "ENDENDEND" /* Table termination */
+#define GPSCMDANATBL_MAX 25 /* Maximum number of elements in table */
+#define RCV_CYCLE 0x01 /* Reception type cycle reception command*/
+#define RCV_RESP 0x02 /* Reception type response command */
+
+// Length of FULLBINARY commands
+#define GPS_CMD_FULLBIN1_SZ 30
+#define GPS_CMD_FULLBIN2_SZ 160
+#define GPS_CMD_FULLBIN3_SZ 25
+#define GPS_CMD_FULLBIN4_SZ 26
+#define GPS_CMD_FULLBIN5_SZ 14
+#define GPS_CMD_FULLBIN6_SZ 61
+
+/* Start offset of FULLBINARY command */
+#define GPS_CMD_FULLBIN1_OFFSET 0
+#define GPS_CMD_FULLBIN2_OFFSET (GPS_CMD_FULLBIN1_OFFSET + GPS_CMD_FULLBIN1_SZ)
+#define GPS_CMD_FULLBIN3_OFFSET (GPS_CMD_FULLBIN2_OFFSET + GPS_CMD_FULLBIN2_SZ)
+#define GPS_CMD_FULLBIN4_OFFSET (GPS_CMD_FULLBIN3_OFFSET + GPS_CMD_FULLBIN3_SZ)
+#define GPS_CMD_FULLBIN5_OFFSET (GPS_CMD_FULLBIN4_OFFSET + GPS_CMD_FULLBIN4_SZ)
+#define GPS_CMD_FULLBIN6_OFFSET (GPS_CMD_FULLBIN5_OFFSET + GPS_CMD_FULLBIN6_SZ)
+
+
+/* SUM value offset of FULLBINARY commands */
+#define GPS_CMD_FULLBIN1_SUMOFFSET (GPS_CMD_FULLBIN1_OFFSET + GPS_CMD_FULLBIN1_SZ - 2)
+#define GPS_CMD_FULLBIN2_SUMOFFSET (GPS_CMD_FULLBIN2_OFFSET + GPS_CMD_FULLBIN2_SZ - 2)
+#define GPS_CMD_FULLBIN3_SUMOFFSET (GPS_CMD_FULLBIN3_OFFSET + GPS_CMD_FULLBIN3_SZ - 2)
+#define GPS_CMD_FULLBIN4_SUMOFFSET (GPS_CMD_FULLBIN4_OFFSET + GPS_CMD_FULLBIN4_SZ - 2)
+#define GPS_CMD_FULLBIN5_SUMOFFSET (GPS_CMD_FULLBIN5_OFFSET + GPS_CMD_FULLBIN5_SZ - 2)
+#define GPS_CMD_FULLBIN6_SUMOFFSET (GPS_CMD_FULLBIN6_OFFSET + GPS_CMD_FULLBIN6_SZ - 2)
+#define GPS_CMD_FULLBIN_MASK 0x8F
+
+#define GPS_CMD_RESET 1 /* Reset request command */
+#define GPS_CMD_TIMESET 2 /* Time setting request command */
+#define GPS_CMD_VERSION 3 /* GPS version request command */
+#define GPS_CMD_SENTENCEADD_NMEAGST 4 /* Add sentence command NMEA GST */
+#define GPS_CMD_SENTENCEADD_NAVTIMEUTC 5 /* Add sentence command NAV-TIMEUTC */
+#define GPS_CMD_SENTENCEADD_NAVCLOCK 6 /* Add sentence command NAV-CLOCK */
+#define GPS_CMD_SENTENCEADD_RXMRTC5 7 /* Add sentence command RXM-RTC5 */
+#define GPS_CMD_SENTENCEADD_NAVSVINFO 8 /* Add sentence command NAV-SVINFO */
+#define GPS_CMD_AUTOMOTIVEMODE 9 /* Automatic mode request command */
+#define GPS_CMD_WKNROLLOVER 10 /* GPS rollover standard week number request command */
+#define GPS_CMD_NOTRST 0 /* Other request command */
+
+/*---------------------------------------------------------------------------*/
+// Struct
+
+/*!
+ @brief UBX command headers
+*/
+typedef struct GpsUbxPacketHeader {
+ u_int8 uc_sync_char1; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_sync_char2; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_class; /* Class */
+ u_int8 uc_id; /* ID */
+ u_int16 us_length; /* Length */
+} TG_GPS_UBX_PACKET_HEADER;
+
+/*!
+ @brief Command-structure without UBX data
+*/
+typedef struct GpsUbxCmdNoData {
+ TG_GPS_UBX_PACKET_HEADER header;
+ u_int8 uc_cka; /* Checksum_A */
+ u_int8 uc_ckb; /* Checksum_B */
+} TG_GPS_UBX_COMMAND_NO_DATA;
+
+/*!
+ @brief
+*/
+typedef struct GpsUbxAidIniPolled {
+ u_int8 uc_sync_char1; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_sync_char2; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_class; /* Class */
+ u_int8 uc_id; /* ID */
+ u_int8 uc_length[2]; /* Length */
+ u_int8 uc_ecefx_or_lat[4]; /* WGS84 ECEF X coordinate or latitude */
+ u_int8 uc_ecefy_or_lon[4]; /* WGS84 ECEF Y coordinate or longitude */
+ u_int8 uc_ecefz_or_alt[4]; /* WGS84 ECEF Z coordinate or altitude */
+ u_int8 uc_pos_acc[4]; /* Position accuracy (stddev) */
+ u_int8 uc_tm_cfg[2]; /* Time mark configuration */
+ u_int8 wn[2]; /* Actual week number */
+ u_int8 tow[4]; /* Actual time of week */
+ u_int8 uc_tow_ns[4]; /* Sub-millisecond part of time of week */
+ u_int8 uc_tacc_ms[4]; /* Milliseconds part of time accuracy */
+ u_int8 uc_tacc_ns[4]; /* Nanoseconds part of time accuracy */
+ u_int8 uc_clk_d_or_freq[4]; /* Clock drift or frequency */
+ u_int8 uc_clk_dacc_or_freqacc[4]; /* Accuracy of clock drift or frequency */
+ u_int8 uc_flags[4]; /* Bitmask with the following flags */
+ u_int8 uc_cka; /* Checksum_A */
+ u_int8 uc_ckb; /* Checksum_B */
+} TG_GPS_UBX_AID_INI_POLLED;
+
+/*!
+ @brief UBX ACK command data structures
+*/
+typedef struct GpsUbxAckData {
+ uint8_t uc_msg_class; /* Message Class */
+ uint8_t uc_msg_id; /* Message Identifier */
+} TG_GPS_UBX_ACK_DATA;
+
+/*!
+ @brief UBX NAV-TIMEUTC command data structures
+*/
+typedef struct GpsUbxNavUTC {
+ uint32_t ul_itow; /* GPS time of week */
+ uint32_t ul_tacc; /* Time accuracy estimate (UTC) */
+ int32_t nano; /* Fraction of second */
+ uint16_t year; /* Year, range 1999..2099 (UTC) */
+ uint8_t month; /* Month, range 1..12 (UTC) */
+ uint8_t day; /* Day of month, range 1..31 (UTC) */
+ uint8_t hour; /* Hour of day, range 0..23 (UTC) */
+ uint8_t min; /* Minute of hour, range 0..59 (UTC) */
+ uint8_t sec; /* Seconds of minute, range 0..60 (UTC) */
+ uint8_t valid; /* Validity Flags */
+} TG_GPS_UBX_NAV_TIMEUTC_DATA;
+
+/*!
+ @brief USB NAV-CLOCK command data structures
+*/
+typedef struct GpsUbxNavClock {
+ uint32_t ul_itow; /**< GPS Time of week */
+ int32_t l_clkb; /**< Clock bias */
+ int32_t l_clkd; /**< Clock drift */
+ uint32_t ul_tacc; /**< Time accuaracy estimate */
+ uint32_t ul_facc; /**< Frequency accuracy estimate */
+} TG_GPS_UBX_NAV_CLOCK;
+
+/*!
+ @brief GPS RXM-RTC5 command data structures
+*/
+typedef struct GpsUbxRxmRtc5 {
+ uint32_t ul_rtag_hw; /**< RTAG high word */
+ uint32_t ul_rtag_lw; /**< RTAG low word */
+ uint32_t freq; /**< Clock frequency */
+ uint32_t ul_freq_frac; /**< Clock frequency fractional part */
+ uint32_t ul_tow_frac; /**< Time of week fractional part */
+ uint32_t tow; /**< Time of week */
+ uint16_t wno; /**< GPS week number */
+ uint8_t uc_tow_valid; /**< TOW is valid flag */
+ uint8_t uc_freq_valid; /**< Frequency is valid flag */
+} TG_GPS_UBX_RXM_RTC5;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA_NMEA
+ * ABSTRACT :Cyclic data (NMEA) area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvDataNMEA {
+ u_int8 uc_rcv_flag[GPS_NMEA_INDEX_MAX]; /* Receive flag */
+ u_int8 u_reserve[3]; /* Reserved */
+ TG_GPS_NMEA_DAT st_nmea[GPS_NMEA_INDEX_MAX]; /* NMEA data area */
+} TG_GPS_RCVDATA_NMEA;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA_BINARY
+ * ABSTRACT :Cyclic data (standard binary) area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvDataBinary {
+ u_int8 uc_rcv_flag; /* Receive flag */
+ u_int8 u_reserve[3]; /* Reserved */
+ u_int8 uc_data[GPS_CMD_BINARY_SZ]; /* Standard binary data area */
+ u_int8 u_reserve2[3]; /* Reserved */
+} TG_GPS_RCVDATA_BINARY;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA_FULLBIN
+ * ABSTRACT :Cyclic data (full binary) area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvDataFullbin {
+ u_int8 uc_rcv_flag; /* Receive flag */
+ u_int8 u_reserve[3]; /* Reserved */
+ u_int8 uc_data[GPS_CMD_FULLBIN_SZ]; /* Full binary data area */
+ u_int8 u_reserve2; /* Reserved */
+} TG_GPS_RCVDATA_FULLBIN;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA
+ * ABSTRACT :Cyclic data storage area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvData {
+ u_int8 uc_sns_cnt; /* Sensor counter value */
+ u_int8 u_reserve[3]; /* Reserved */
+ TG_GPS_RCVDATA_NMEA st_nmea_data; /* NMEA data area */
+ TG_GPS_RCVDATA_BINARY st_binary_data; /* Standard binary region */
+ TG_GPS_RCVDATA_FULLBIN st_fullbin_data; /* Full binary data area */
+} TG_GPS_RCVDATA;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DevGpsSndCycleDataNmea(void);
+void DevGpsRcvCyclCmd(void);
+u_int8 DevGpsGetGpsRcvSts(u_int8 sv);
+void DevGpsAnalyzeNmea(NAVIINFO_ALL* navilocinfo);
+void DevGpsCycleDataClear(void);
+void DevGpsCycleDataSetNmea(const u_int8*, u_int32, ENUM_GPS_NMEA_INDEX);
+BOOL DevGpsCycleDataGetNmea(u_int8*, u_int32, ENUM_GPS_NMEA_INDEX);
+void DevGpsCmdEventCheckNmea(void);
+void DevGpsSetChkSum(u_int8* buffer, u_int32 length);
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_NMEA_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h
new file mode 100755
index 0000000..96616ef
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h
@@ -0,0 +1,113 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_TimerCtrl.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
+#define INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+/* GPS-related timer value */
+#define TIMVAL_GPS_STARTUP 500 /* 5Sec Start confirmation monitoring timer */
+#define TIMVAL_GPS_RCVCYCLDAT 500 /* 5Sec Periodic reception data monitoring timer */
+#define TIMVAL_GPS_RCVACK 500 /* 5Sec ACK reception monitoring timer */
+#define TIMVAL_GPS_RCVDAT 500 /* 5Sec Data reception monitoring timer(Unused) */
+#define TIMVAL_GPS_NAVIFST 3000 /* 30sec Initial navigation monitoring timer */
+#define TIMVAL_GPS_NAVICYCLE 300 /* 3sec Navigation monitoring timer */
+#define TIMVAL_GPS_NAVIDISRPT 1000 /* 10Sec Navigation monitoring disruption log output timer */
+#define TIMVAL_GPS_DIAGCLKGUARD 1000 /* 10sec Diagnosis provision time guard monitoring timer */
+#define TIMVAL_GPS_NMEADATAGUARD 1000 /* 10sec NMEA data-providing guard monitoring timer */
+#define TIMVAL_GPS_RECOVERY 60000 /* 600sec GPS recovery timer */
+#define TIMVAL_GPS_RECEIVERERR 60000 /* 600sec GPS receiver anomaly detection timer */
+
+/* Sensor-related timer value */
+#define TIMVAL_SNS_RCVFSTDAT 3000 /* 30Sec Initial sensor data reception monitoring timer */
+#define TIMVAL_SNS_RCVCYCLDAT 300 /* 3Sec Cyclic sensor data reception monitoring timer */
+#define TIMVAL_SNS_RCVDISRPT 1000 /* 10Sec Cyclic sensor data interruption log output timer */
+
+/* Timer management table */
+#define TIM_NON 0x00 /* Timer counter initial value */
+#define TIM_CNTMIN 0x01 /* Timer counter minimum value */
+#define TIM_CNTMAX 0xff /* Maximum value of timer counter */
+#define TIMER_OFF 0 /* Timer enable flag OFF */
+#define TIMER_ON 1 /* Timer enable flag ON */
+
+/*!
+ @brief Timer type
+ */
+typedef enum GpsTimKind {
+ GPS_STARTUP_TIMER = 0, /* 0 Start confirmation monitoring timer */
+ GPS_CYCL_TIMER, /* 1 Cyclic GPS data reception monitoring timer */
+ GPS_RECV_ACK_TIMER, /* 2 ACK reception monitoring timer */
+ GPS_NAVIFST_TIMER, /* 3 Initial navigation monitoring timer */
+ GPS_NAVICYCLE_TIMER, /* 4 Navigation monitoring timer */
+ GPS_NAVIDISRPT_TIMER, /* 5 Navigation monitoring disruption log output timer */
+ GPS_DIAGCLK_GUARDTIMER, /* 6 Diagnosis provision time guard monitoring timer */
+ GPS_NMEADATA_GUARDTIMER, /* 7 NMEA data-providing guard monitoring timer */
+ GPS_RECOVERY_TIMER, /* 8 GPS recovery timer */
+ GPS_RECEIVERERR_TIMER, /* 9 GPS receiver anomaly detection timer */
+ SNS_FST_TIMER, /* 10 Initial sensor data reception monitoring timer */
+ SNS_CYCLE_TIMER, /* 11 Cyclic sensor data reception monitoring timer */
+ SNS_DISRPT_TIMER, /* 12 Cyclic sensor data interruption log output timer */
+ TIM_NUM /* 13 Number of timer types */
+} GPS_TIM_KIND;
+
+/*!
+ @brief Timer status
+*/
+typedef struct GpsTimSts {
+ u_int8 flag; /**< Timer flag OFF:Stop,ON:Start */
+ u_int8 cnt; /**< Start counter */
+ int8 rsv[2]; /**< Reserved */
+} GPS_TIM_STS;
+
+/*!
+ @brief Timer status management table
+ */
+typedef struct GpsTimMng {
+ GPS_TIM_STS sts[TIM_NUM]; /**< Timer status */
+} GPS_TIM_MNG;
+
+/*!
+ @brief Timer setting information table
+*/
+typedef struct GpsTimInfo {
+ uint32_t timer_val; /**< Timer value */
+ PNO pno; /**< Event notification destination process number */
+} GPS_TIM_INFO;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DevGpsTimInit(void);
+BOOL DevGpsTimeSet(GPS_TIM_KIND tim_kind);
+BOOL DevGpsTimeStop(GPS_TIM_KIND tim_kind);
+u_int16 DevGpsTimeMakSeqNo(GPS_TIM_KIND tim_kind);
+BOOL DevGpsTimeJdgKind(u_int16 seqno);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/LineSensDrv/LineSensDrv_Sensor.h b/video_in_hal/positioning_hal/inc/LineSensDrv/LineSensDrv_Sensor.h
new file mode 100755
index 0000000..1b996b7
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/LineSensDrv/LineSensDrv_Sensor.h
@@ -0,0 +1,183 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Sensor.h
+*/
+
+#ifndef INC_LINESENSDRV_LINESENSDRV_SENSOR_H_
+#define INC_LINESENSDRV_LINESENSDRV_SENSOR_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Macro definitions
+
+/* Message related */
+/* Message identification number definition received from the ICR */
+#define LSDRV_RCVMSG_INVALID 0x00 /* Not applicable */
+#define LSDRV_RCVMSG_SENSOR 0x12 /* Sensor data */
+
+/* LineSensor vehicle signal notification */
+
+#define LSDRV_SENS_MASK 0xFFF /* Sensor data MASK */
+#define LSDRV_PLSMAX 65536 /* Maximum vehicle speed pulse number */
+/* #011 start */
+#define LSDRV_SENS_COEFFICIENT 14.1287284284144427 /* Vehicle speed calculation factor */
+#define LSDRV_SPKMPH_METHOD_FST 0 /* Vehicle speed calculation method(Initial Sensor Data) */
+#define LSDRV_SPKMPH_METHOD_NML 1 /* Vehicle speed calculation method(Sensor data) */
+#define LSDRV_SPKMPH_AVE_TIME 29 /* Effective time for average calculation data(in units of 100ms) */ /* #013 */
+#define LSDRV_SPKMPH_NOISE_TIME (LSDRV_SPKMPH_AVE_TIME + 2) /* Effective Time for Noise Detection(in units of 100ms) */ /* #017 */
+#define LSDRV_SPKMPH_INVALID 1 /* No pulse of previous vehicle speed */
+#define LSDRV_SPKMPH_VALID 0 /* Last vehicle speed pulse */
+#define LSDRV_SENSCNT_BRW_ADD 256 /* Measures for borrow occurrence during search of sensor counters */
+/* #011 end */
+#define LSDRV_FSENS_NRCV 0 /* Not received */
+#define LSDRV_FSENS_RCV 1 /* Receiving */
+#define LSDRV_FSENS_RCVCOMP 2 /* Reception completion */
+#define LSDRV_FSENS_NORMAL 0 /* Receive data normal */ /* #001 */
+#define LSDRV_FSENS_ERROR 1 /* Receive data anomaly */ /* #001 */
+/* #016 start */
+#define LSDRV_PLSDATA_NRCV 0 /* Not received */
+#define LSDRV_PLSDATA_RCV 1 /* Received */
+#define LSDRV_SENSCNT_MAX 255 /* Maximum value of sensor counter */
+#define LSDRV_SPKMPH_MIN_DATA_N 6 /* Number of data required for vehicle speed calculation */
+#define LSDRV_FSPDPLS_NUM 3 /* Number of cumulative pulses registered for the first time */
+/* #016 end */
+#define LSDRV_REV_MASK 0x0040 /* REV-data MASK(Before endian conversion) */
+#define LSDRV_BITSHIFT_REV 6 /* REV data bit shift */
+#define LSDRV_TEMP_MASK 0x07FF /* Gyro temperature data MASK(after endian conversion) */
+#define LSDRV_PLSTIME_LEN 232 /* Data length when inter-pulse time exists */
+
+
+#define LSDRV_DETAILED_DATA_MULTI_ENABLE TRUE /* Detailed data multiplexing of initial sensor data Enabled/Disabled */
+
+#if LSDRV_DETAILED_DATA_MULTI_ENABLE
+#define LSDRV_DETAILED_DATA_MULTI_MAX_NUM 2 /* Detailed data multiplexing of initial sensor data Maximum number */
+#else
+#define LSDRV_DETAILED_DATA_MULTI_MAX_NUM 1 /* Detailed data multiplexing of initial sensor data Maximum number */
+#endif
+
+/* Total number of partitions of initial sensor data : Maximum value */
+#define LSDRV_FSENS_TOTAL_NUM_MAX LSDRV_FSTSNS_SENSOR_FIRST_SEND_NUM
+
+/* Detailed data of initial sensor data : Maximum number of acquisitions */
+#define LSDRV_DETAILED_DATA_MAX_NUM (LSDRV_FSENS_TOTAL_NUM_MAX * LSDRV_DETAILED_DATA_MULTI_MAX_NUM)
+
+/* Initial sensor data : Maximum number of saved messages */
+#define LSDRV_FSENS_SAVE_MSG_NUM (LSDRV_FSENS_TOTAL_NUM_MAX + 1)
+
+/* Initial sensor data : Maximum number of data stored */
+#define LSDRV_FSENS_SAVE_DATA_NUM (LSDRV_FSENS_SAVE_MSG_NUM * LSDRV_DETAILED_DATA_MULTI_MAX_NUM)
+
+#define LSDRV_DETAILED_DATA_GYRO_NUM LSDRV_FSTSNS_DETAILED_DATA_GYRO_NUM
+#define LSDRV_DETAILED_DATA_GSENSOR_NUM LSDRV_FSTSNS_DETAILED_DATA_GSENSOR_NUM
+#define LSDRV_DETAILED_DATA_GSENSOR_X_OFFSET 0 /* G-Sensor data X-axis offset included in detail data */
+#define LSDRV_DETAILED_DATA_GSENSOR_Y_OFFSET 1 /* G-Sensor data Y-axis offsets included in the detail data */
+#define LSDRV_DETAILED_DATA_GSENSOR_OFFSET 3 /* G-Sensor data access offset included in the detail data */
+
+/* Gyro Output Specifications:11500 ~ 54036LSB */
+#define GYRO_OUTPUPT_SPEC_LOWER_LIMIT 11500U
+#define GYRO_OUTPUPT_SPEC_UPPER_LIMIT 54036U
+
+/* Gyro Failure Status : How many normal status continues should be made to Gyro Failure Status normal when it is judged to be "error -> normal" */
+#define GYRO_TROUBLE_NORMAL_COUNTER_THRESHOLD 10U /* 10 ms (Gyro data acquisition interval) * 10 times = 100ms */
+
+/* Gyro Failure Status : How many error status continues should be made to Gyro Failure Status error when it is judged to be "normal -> error" */
+#define GYRO_TROUBLE_ERROR_COUNTER_THRESHOLD 3000U /* 10 ms (Gyro data acquisition interval) * 3000 times = 30s */
+
+/* SYS GPS Interrupt Signal : How many disable continues should be made to SYS GPS Interrupt Signal disable when it is judged to be "enable -> disable" */
+#define SYS_GPS_INTERRUPT_SIGNAL_INVALID_COUNTER_THRESHOLD 10U
+
+/* Gyro Failure Status : Match values with SENSORMOTION_NORMAL and ERROR,UNFIXED in SensorMotion_API.h */
+#define GYRO_NORMAL (0U)
+#define GYRO_ERROR (1U)
+#define GYRO_UNFIXED (2U)
+
+/* Gyro connection status : Match values with SENSOR_CONNECT and SENSOR_DISCONNECT in Sensor_API.h */
+#define GYRO_DISCONNECT (0U)
+#define GYRO_CONNECT (1U)
+
+/*** Data table for calculating vehicle speed *****************************************/
+#define LSDRV_SPKMPH_TBL_NUM 32 /* Number of data tables */ /* #50836 */
+#define LSDRV_SPKMPH_DATA_EN 0x01 /* Data storage flag valid */
+#define LSDRV_SPKMPH_DATA_DIS 0x00 /* Data storage flag invalid */
+
+/*** Operation code *********************************************/
+#define LSDRV_OPC_WILDCARD 0xFF /* Wildcarded #012 */
+
+#define LSDRV_OPC_EXTTERM_R 0x89 /* External pin status request */
+#define LSDRV_OPC_EXTTERM_A 0x99 /* External pin status notification */
+#define LSDRV_OPC_SENSOR 0xC1 /* Sensor data */
+#define LSDRV_OPC_FSENS_R 0xE4 /* Initial sensor data request */
+#define LSDRV_OPC_FSENS_A 0xF4 /* Initial sensor data response */
+
+/*---------------------------------------------------------------------------*/
+// Enum
+
+/*---------------------------------------------------------------------------*/
+// Struct
+
+typedef struct {
+ u_int16 uc_sensor_x; /* G-Sensor X data */
+ u_int16 uc_sensor_y; /* G-Sensor Y data */
+ u_int16 uc_sensor_z; /* G-Sensor Z data */
+} SENSORINPUT_INFO_DAT_GSENS;
+
+// TAG : LSDRV_SPEEDKMPH_DAT
+// ABSTRACT : Data Table Structure for Vehicle Speed Calculation
+typedef struct LsDrvSpeedKmph {
+ u_int8 uc_flag; /* Data storage flag */
+ u_int8 uc_sens_cnt; /* Sensor counter */
+ u_int16 us_speed_pulse; /* Vehicle speed pulse */
+ u_int8 uc_noise_flag; /* Noise flag */ /* #017 */
+ u_int8 u_reserve[3]; /* Reserved */ /* #017 */
+} LSDRV_SPEEDKMPH_DAT_DAT;
+
+typedef struct LsDrvSpeedKmphLast {
+ u_int8 uc_flag; /* Data storage flag */
+ u_int8 uc_sens_cnt; /* Sensor counter */
+ u_int16 us_speed_pulse; /* Vehicle speed pulse */
+} LSDRV_SPEEDKMPH_LAST_DAT;
+
+typedef struct LsDrvSpeedKmphDat {
+ u_int8 uc_ptr; /* Data storage pointer */
+ u_int8 uc_fstsns_rcv; /* Initial sensor data reception status */ /* #016 */
+ u_int8 uc_sns_rcv; /* Sensor data reception status */ /* #016 */
+ u_int8 uc_calc_start; /* Vehicle speed calculation start flag */ /* #016 */
+ LSDRV_SPEEDKMPH_LAST_DAT st_last_data; /* Previous vehicle speed pulse information */
+ LSDRV_SPEEDKMPH_DAT_DAT st_data[LSDRV_SPKMPH_TBL_NUM]; /* Data portion */
+} LSDRV_SPEEDKMPH_DAT;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void LineSensDrvSensor(u_int8*);
+u_int16 LineSensDrvSpeedCalc(u_int8);
+void LineSensDrvSpeedKmphDataInit(void);
+void LineSensDrvSpeedPulseSave(u_int16, u_int16, u_int8);
+u_int8 LineSensDrvCheckNoise(u_int8);
+
+u_int8 LineSensDrvGetLastSpeedPulse(u_int16*, u_int16, u_int8);
+void LineSensDrvSetLastSpeedPulse(u_int16, u_int8);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_LINESENSDRV_LINESENSDRV_SENSOR_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/inc/LineSensDrv/LineSensDrv_Thread.h b/video_in_hal/positioning_hal/inc/LineSensDrv/LineSensDrv_Thread.h
new file mode 100755
index 0000000..54a01dc
--- /dev/null
+++ b/video_in_hal/positioning_hal/inc/LineSensDrv/LineSensDrv_Thread.h
@@ -0,0 +1,66 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Thread.h
+*/
+
+#ifndef INC_LINESENSDRV_LINESENSDRV_THREAD_H_
+#define INC_LINESENSDRV_LINESENSDRV_THREAD_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "LineSensDrv_Api.h"
+#include "LineSensDrv_Sensor.h"
+
+/*---------------------------------------------------------------------------*/
+// Define
+
+// Return value
+#define RET_LSDRV_SUCCESS RET_NORMAL // API processing success
+#define RET_LSDRV_ERROR RET_ERROR // API processing failed
+
+/*---------------------------------------------------------------------------*/
+// Rcv Message Related
+
+// Size of data section
+#define LSDRV_RCVMSG_MSGBUF 512 // Byte count of RcvMSG data section
+
+/*---------------------------------------------------------------------------*/
+// Struct
+
+// TAG : LSDRV_RCVDATA
+// ABSTRACT : Message receive buffer structure
+typedef struct LsDrvRcvData {
+ T_APIMSG_MSGBUF_HEADER st_head; // Message header
+ u_int8 uc_data[LSDRV_RCVMSG_MSGBUF]; // Data portion
+} LSDRV_RCVDATA;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+int32 LineSensDrvMainThreadInit(HANDLE);
+void LineSensDrvParamInit(void);
+
+EFrameworkunifiedStatus LineSensDrvThread(HANDLE);
+void LineSensDrvThreadStopProcess(void);
+u_int8 LineSensDrvGetSysRecvFlag(void);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_LINESENSDRV_LINESENSDRV_THREAD_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/Common/positioning_common.cpp b/video_in_hal/positioning_hal/src/Common/positioning_common.cpp
new file mode 100755
index 0000000..00b3a8b
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/Common/positioning_common.cpp
@@ -0,0 +1,388 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file positioning_common.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_common.h"
+#include "MDev_Gps_Common.h"
+#include "MDev_GpsRecv.h"
+#include "LineSensDrv_Thread.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define DATMOD_RETRY (3) /* Number of shared memory generation retries */
+#define DATMOD_PREINIT (0) /* Shared Memory State [Before initialization] */
+#define PRIM_NAME_MAX (32) /* Maximum Name Size */
+#define VEHICLE_SHARE_NAME ("POS_VEHICLE_SHARE_MEMORY") /* Shared memory name */
+
+/* Mask for managing various notification reception conditions */
+#define NTFY_MSK_NONE (0x00)
+/* Service availability notification */
+#define NTFY_MSK_COMMUNICATION_AVAILABILITY (0x01)
+#define NTFY_MSK_PS_COMMUSB_AVAILABILITY (0x02)
+#define NTFY_MSK_PS_PSMSHADOW_AVAILABILITY (0x04)
+#define NTFY_MSK_CLOCK_AVAILABILITY (0x08)
+#define NTFY_MSK_NS_BACKUPMGR_AVAILABILITY (0x10)
+#define NTFY_MSK_SS_DEVDETSRV_AVAILABILITY (0x20)
+/* Other Notices */
+#define NTFY_MSK_PS_PSMSHADOW_INIT_COMP (0x01) /* PSMShadow startup completion notice */
+#define NTFY_MSK_PS_LANSERVER_DEVICE_UPDATE (0x02) /* LanServer device configuration change notification */
+#define NTFY_MSK_PS_LANSERVER_WAKEUP_COMP (0x04) /* LanServer start completion notice */
+
+/* Thread state */
+#define THREAD_STS_NOEXIST (0x00)
+#define THREAD_STS_CREATING (0x01)
+#define THREAD_STS_CREATED (0x02)
+
+/*---------------------------------------------------------------------------*/
+// ENUMERATION
+
+/*---------------------------------------------------------------------------*/
+// STRUCTURE
+
+typedef struct StThreadInfo {
+ EnumTID_POS e_id; /**< Thread ID */
+ const int8_t* p_name; /**< Thread name */
+ PNO p_no; /**< Process number */
+ CbFuncPtr cb_routine; /**< Start routine */
+ uint8_t msk_available; /**< Dependent services Availability */
+ uint8_t msk_ntfy; /**< Dependent notification */
+ uint8_t msk_thread; /**< Dependent threads */
+ BOOL b_is_depended; /**< Positioning/Availability->TRUE change dependency */
+ uint8_t uc_status; /**< Thread activation state */
+ uint8_t uc_order; /**< Boot Sequence(Performance) */
+ uint8_t u_reserve[2];
+} ST_THREAD_CREATE_INFO;
+
+typedef struct {
+ char share_data_name[PRIM_NAME_MAX]; /**< Shared data name */
+ u_int32 data_size; /**< Shared data size */
+} ST_SHAREDATA;
+
+static const int8_t kThreadNamePosMain[15] = "POS_Main";
+static const int8_t kThreadNamePosSens[15] = "POS_Sens";
+static const int8_t kThreadNamePosGps[15] = "POS_Gps";
+static const int8_t kThreadNamePosGpsRecv[15] = "POS_Gps_Recv";
+static const int8_t kThreadNamePosGpsRollover[15] = "POS_Gps_Rolovr";
+
+static ST_THREAD_CREATE_INFO g_pos_thread_create_info[] = {
+ { /* POS_Main */
+ ETID_POS_MAIN, /* (1) */
+ NULL, /* (2) */
+ 0, /* (3) */
+ NULL, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ 0, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* POS_sens */
+ ETID_POS_SENS, /* (1) */
+ kThreadNamePosSens, /* (2) */
+ PNO_LINE_SENS_DRV, /* (3) */
+ &LineSensDrvThread, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ 0, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* POS_Gps */
+ ETID_POS_GPS, /* (1) */
+ kThreadNamePosGps, /* (2) */
+ PNO_NAVI_GPS_MAIN, /* (3) */
+ &DevGpsMainThread, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ 0, /* (7) */
+ TRUE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* POS_Gps_Recv */
+ ETID_POS_GPS_RECV, /* (1) */
+ kThreadNamePosGpsRecv, /* (2) */
+ PNO_NAVI_GPS_RCV, /* (3) */
+ &DevGpsRecvThread, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ THREAD_STS_MSK_POS_GPS, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* POS_Gps_Rolovr */
+ ETID_POS_GPS_ROLLOVER, /* (1) */
+ NULL, /* (2) */
+ 0, /* (3) */
+ NULL, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ 0, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Termination */
+ ETID_POS_MAX, /* (1) */
+ NULL, /* (2) */
+ 0, /* (3) */
+ NULL, /* (4) */
+ NTFY_MSK_NONE, /* (5) */
+ NTFY_MSK_NONE, /* (6) */
+ 0, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+};
+
+static ST_SHAREDATA g_sharedata_tbl[] = {
+ /* Shared data name to be generated, Shared data size */
+ { {VEHICLE_SHARE_NAME}, 512 * 11 }, /* Vehicle sensor information acquisition */
+#if 0 /* Not used in _CWORD71_ below */
+ { {"SENSOR_SHARE_MEMORY"}, 512 * 11 }, /* Vehicle sensor information Pkg acquisition */
+ { {"GPS_INT_SIGNAL_SHARE_MEMORY"}, 4 }, /* GPS interrupt signal acquisition */
+ { {"LOG_SETTING_SHARE_MEMORY"}, 36 }, /* DR feature log acquisition */
+ { {"GYRO_CONNECT_STTS_SHARE_MEMORY"}, 4 }, /* Gyro connection status acquisition */
+ { {"EPHEMERIS_NUM_SHARE_MEMORY"}, 4 }, /* Effective ephemeris count acquisition at shutdown */
+ { {"LOCALTIME_SHARE_MEMORY"}, 12 }, /* Local time acquisition at shutdown */
+ { {"LONLAT_SHARE_MEMORY"}, 8 }, /* Location acquisition at shutdown */
+#endif
+ { {(int8)NULL}, 0 } /* Termination */
+};
+
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+static EFrameworkunifiedStatus PosStopThreadDummy(HANDLE h_app) {
+ return eFrameworkunifiedStatusOK;
+}
+
+static uint32_t PosGetMsg(HANDLE h_app, void** p_buf, uint32_t ul_size) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ uint32_t tmp_size = 0;
+ void* p_rev_buf = NULL;
+
+ if ((h_app == NULL) || (p_buf == NULL)) {
+ POSITIONING_LOG("Argument ERROR!! [h_app = %p, pBuf = %p]", h_app , p_buf);
+ } else {
+ /* Check the size of received data */
+ tmp_size = FrameworkunifiedGetMsgLength(h_app);
+ if (tmp_size > ul_size) {
+ POSITIONING_LOG("Message ul_size ERROR!! [tmp_size = %d, maxsize = %d]", tmp_size, ul_size);
+ tmp_size = 0;
+ } else {
+ /* Obtain data */
+ e_status = FrameworkunifiedGetDataPointer(h_app, &p_rev_buf);
+
+ if (e_status == eFrameworkunifiedStatusOK) {
+ *p_buf = p_rev_buf;
+ } else if (e_status == eFrameworkunifiedStatusInvldBufSize) {
+ e_status = FrameworkunifiedGetMsgDataOfSize(h_app, *p_buf, tmp_size);
+
+ if (e_status != eFrameworkunifiedStatusOK) {
+ POSITIONING_LOG("FrameworkunifiedGetMsgDataOfSize ERROR [e_status:%d]", e_status);
+ tmp_size = 0;
+ }
+ } else {
+ POSITIONING_LOG("FrameworkunifiedGetDataPointer ERROR [e_status:%d]", e_status);
+ tmp_size = 0;
+ }
+ }
+ }
+
+ return tmp_size;
+}
+
+static void PosCreateSharedMemory(void) {
+ RET_API ret_api = RET_NORMAL;
+ void *mod_exec_dmy; /* Module data pointer(dummy) */
+ int retry; /* Retry counter */
+ ST_SHAREDATA *p_shm_tbl;
+
+ /* Configure Shared Data Generating Tables */
+ p_shm_tbl = g_sharedata_tbl;
+
+ while (*(p_shm_tbl->share_data_name) != (int8)NULL) {
+ for (retry = 0; retry < DATMOD_RETRY; retry++) {
+ /* Shared Memory Generation */
+ ret_api = _pb_CreateShareData(p_shm_tbl->share_data_name, p_shm_tbl->data_size, &mod_exec_dmy);
+ if (ret_api == RET_NORMAL) {
+ /* Set the shared memory status flag to "Before initialization (0)" */
+ *reinterpret_cast<u_int32 *>(mod_exec_dmy) = DATMOD_PREINIT;
+ break;
+ } else {
+ /* Error Handling */
+ POSITIONING_LOG("_pb_CreateShareData ERROR [ret_api:%d]", ret_api);
+ }
+ }
+
+ if (retry >= DATMOD_RETRY) {
+ POSITIONING_LOG("_pb_CreateShareData failed more %d times.", DATMOD_RETRY);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ /* Next shared memory generation */
+ p_shm_tbl++;
+ }
+ return;
+}
+
+EFrameworkunifiedStatus PosInitialize(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ RET_API ret_api;
+ ret_api = _pb_Setup_CWORD64_API(h_app);
+ if (ret_api != RET_NORMAL) {
+ POSITIONING_LOG("_pb_Setup_CWORD64_API ERROR!! [ret_api = %d]", ret_api);
+
+ e_status = eFrameworkunifiedStatusFail;
+ } else {
+ PosCreateSharedMemory();
+ }
+ return e_status;
+}
+
+/**
+ * @brief
+ * Common processing after thread startup
+ *
+ * Thread naming, message queue creation, thread startup response
+ *
+ * @param[in] h_app Application handle
+ * @param[in] eTid Thread ID
+ *
+ * @return Thread startup mode
+ */
+EnumSetupMode_POS PosSetupThread(HANDLE h_app, EnumTID_POS e_tid) {
+ RET_API ret = RET_NORMAL;
+ ST_THREAD_CREATE_INFO* p_thread_info = g_pos_thread_create_info;
+ ST_THREAD_CREATE_INFO* p_info = p_thread_info + e_tid;
+ ST_THREAD_SETUP_INFO st_setup_info;
+ ST_THREAD_SETUP_INFO* pst_setup_info = &st_setup_info;
+ /* Application handle setting */
+ _pb_SetAppHandle(h_app);
+ /* Create Message Queue */
+ _pb_CreateMsg(p_info->p_no);
+ /* Get thread startup information */
+ pst_setup_info->mode = EPOS_SETUP_MODE_NORMAL;
+ (void)PosGetMsg(h_app, reinterpret_cast<void**>(&pst_setup_info), sizeof(ST_THREAD_SETUP_INFO));
+
+ POSITIONING_LOG("[mode = %d]", pst_setup_info->mode);
+
+ /* Issue thread creation completion notice */
+ ret = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_THREAD_CREATE_COMP,
+ sizeof(EnumTID_POS),
+ reinterpret_cast<const void*>(&e_tid),
+ 0);
+
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("_pb_SndMsg_Ext ERROR!! [ret = %d]", ret);
+ }
+
+ return pst_setup_info->mode;
+}
+
+/**
+ * @brief
+ * Common processing at thread stop
+ *
+ * Thread stop response, thread destruction
+ *
+ * @param[in] e_tid Thread ID
+ */
+void PosTeardownThread(EnumTID_POS e_tid) {
+ RET_API e_ret = RET_NORMAL;
+ ST_THREAD_CREATE_INFO* p_thread_info = g_pos_thread_create_info;
+
+ (p_thread_info + e_tid)->uc_status = THREAD_STS_NOEXIST;
+ /* Issue thread stop completion notice */
+ e_ret = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_THREAD_STOP_COMP,
+ sizeof(EnumTID_POS),
+ reinterpret_cast<const void*>(&e_tid),
+ 0);
+
+ if (e_ret != RET_NORMAL) {
+ POSITIONING_LOG("_pb_SndMsg_Ext ERROR!! [e_ret = %d]", e_ret);
+ }
+
+ /* Thread destruction */
+ _pb_ExitThread((DWORD)0);
+
+ return;
+}
+
+/**
+ * @brief
+ * Positioning in-process thread creation
+ *
+ * @param[in] hApp Application handle
+ */
+EFrameworkunifiedStatus PosCreateThread(HANDLE h_app, int8_t index) {
+ HANDLE thread_handle;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ ST_THREAD_CREATE_INFO* p_thread_info = g_pos_thread_create_info;
+
+ p_thread_info += index;
+
+ static EnumSetupMode_POS g_setup_mode;
+
+ if (NULL == h_app) {
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ if (index < ETID_POS_MAX) {
+ if ((p_thread_info->uc_status == THREAD_STS_NOEXIST) && (p_thread_info->cb_routine != NULL)) {
+ /* Thread creation */
+ thread_handle = FrameworkunifiedCreateChildThread(h_app,
+ (PCSTR)(p_thread_info->p_name),
+ p_thread_info->cb_routine,
+ &PosStopThreadDummy);
+
+ if (thread_handle == NULL) {
+ POSITIONING_LOG("FrameworkunifiedCreateChildThread ERROR!! [tHandle=%p]", thread_handle);
+ } else {
+ e_status = FrameworkunifiedStartChildThread(h_app,
+ thread_handle,
+ sizeof(EnumSetupMode_POS),
+ &g_setup_mode);
+
+ if (e_status != eFrameworkunifiedStatusOK) {
+ POSITIONING_LOG("FrameworkunifiedStartChildThread ERROR!! [e_status=%d, name=%s]", e_status, p_thread_info->p_name);
+ } else {
+ p_thread_info->uc_status = THREAD_STS_CREATING;
+ POSITIONING_LOG("name=%s\n", p_thread_info->p_name);
+ }
+ }
+ }
+ }
+ return e_status;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/Common/positioning_hal.cpp b/video_in_hal/positioning_hal/src/Common/positioning_hal.cpp
new file mode 100755
index 0000000..94f79c4
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/Common/positioning_hal.cpp
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file positioning_hal.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include <stdio.h>
+
+#include "positioning_hal.h"
+#include "positioning_def.h"
+#include "positioning_common.h"
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+EFrameworkunifiedStatus StartGpsMainThreadPositioning(HANDLE h_app) {
+ return PosCreateThread(h_app, ETID_POS_GPS);
+}
+
+EFrameworkunifiedStatus StartGpsRecvThreadPositioning(HANDLE h_app) {
+ return PosCreateThread(h_app, ETID_POS_GPS_RECV);
+}
+
+EFrameworkunifiedStatus StartLineSensorThreadPositioning(HANDLE h_app) {
+ return PosCreateThread(h_app, ETID_POS_SENS);
+}
+
+EFrameworkunifiedStatus StartGpsRolloverThreadPositioning(HANDLE h_app) {
+ return eFrameworkunifiedStatusErrOther;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/GpsCommon/MDev_GpsRecv.cpp b/video_in_hal/positioning_hal/src/GpsCommon/MDev_GpsRecv.cpp
new file mode 100755
index 0000000..13159b4
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/GpsCommon/MDev_GpsRecv.cpp
@@ -0,0 +1,608 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_GpsRecv.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "MDev_GpsRecv.h"
+#include "MDev_Gps_Common.h"
+#include "positioning_common.h"
+#include "MDev_Gps_API.h"
+//extern "C" {
+//#include <stub/gps_mng_api.h>
+//}
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+#define FTEN_DRIVER 0
+#define TEST_HAL2
+
+#if FTEN_DRIVER
+static GpsMngApiObj g_gps_mng_obj;
+#endif
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_RecvThread
+ * ABSTRACT : GPS communication management reception thread
+ * FUNCTION : GPS communication management reception thread main
+ * ARGUMENT : PVOID pv....Thread creation arguments
+ * NOTE : -
+ * RETURN : TRUE
+ ******************************************************************************/
+EFrameworkunifiedStatus DevGpsRecvThread(HANDLE h_app) {
+ int32 ret = GPS_RCV_RET_NML;
+ int32 gps_ret = 0;
+ BOOL* p_thread_stop_req = &g_gps_rcv_thread_stop;
+
+ (void)PosSetupThread(h_app, ETID_POS_GPS_RECV);
+
+ /* Initializing process */
+ DevGpsRecvInit();
+
+#if FTEN_DRIVER
+ gps_ret = GpsMngApiOpen(&g_gps_mng_obj);
+ if (gps_ret != GPS_CTL_RET_SUCCESS) {
+ printf("[For test] GpsMngApiOpen open failed\n");
+ }
+#endif
+
+ while (1) {
+ /* Thread stop request is received */
+ if (TRUE == *p_thread_stop_req) {
+ /* Thread stop processing */
+ DevGpsRecvThreadStopProcess();
+ }
+
+ ret = DevGpsRecvReadRcvData(&g_gps_rcvdata);
+
+ if (GPS_RCV_RET_NML == ret) {
+ /* For reception (normal) */
+ DevGpsRecvRcvNormal();
+ }
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Recv_Init
+ * ABSTRACT : Receive thread initialization processing
+ * FUNCTION : Initialize the receive thread
+ * ARGUMENT : -
+ * NOTE : -
+ * RETURN : -
+ ******************************************************************************/
+void DevGpsRecvInit(void) {
+ /* Clears the receive buffer */
+ DevGpsRecvClrRcvBuf();
+
+ /* Clear receive error count */
+ g_wrecv_err = 0;
+
+ return;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Recv_ClrRcvBuf
+ * ABSTRACT : Buffer clear processing
+ * FUNCTION : Clears the receive buffer for serial reception.
+ * ARGUMENT : -
+ * NOTE : -
+ * RETURN : -
+ ******************************************************************************/
+void DevGpsRecvClrRcvBuf(void) {
+ /*-----------------------------------------------------------------------*/
+ /* Clear serial receive data storage buffer */
+ /*-----------------------------------------------------------------------*/
+ memset(&g_gps_rcvdata, 0, sizeof(TG_GPS_RECV_RcvData));
+
+ /*-----------------------------------------------------------------------*/
+ /* Clear receive data storage buffer */
+ /*-----------------------------------------------------------------------*/
+ memset(&g_gps_rcvbuf, 0, sizeof(TG_GPS_RECV_RcvBuf));
+
+ /*-----------------------------------------------------------------------*/
+ /* Clear analysis data buffer */
+ /*-----------------------------------------------------------------------*/
+ memset(&g_gps_ana_databuf, 0, sizeof(TG_GPS_RECV_AnaDataBuf));
+
+ /*-----------------------------------------------------------------------*/
+ /* Clear receive frame buffer */
+ /*-----------------------------------------------------------------------*/
+ memset(&g_gps_rcv_framebuf, 0, sizeof(TG_GPS_RECV_RcvFrameBuf));
+}
+
+/*******************************************************************************
+ * MODULE : DevGpsRecvJudgeStartSeqence
+ * ABSTRACT : Start sequence determination process
+ * FUNCTION : Determine whether or not the beginning of the data is the start sequence of the _CWORD82_ command
+ * ARGUMENT : const u_char *buf_p ... Pointer to analysis data
+ * u_int16 ana_size ... Size of data to be analyzed
+ * NOTE :
+ * RETURN : GPS__CWORD82__RET_START_SEQ_NONE ... No start sequence
+ * GPS__CWORD82__RET_START_SEQ_NMEA ... NMEA Start Sequences
+ * GPS__CWORD82__RET_START_SEQ_FULL ... Full Customization Start Sequence
+ ******************************************************************************/
+static int32 DevGpsRecvJudgeStartSeqence(const u_char *buf_p, u_int16 ana_size) {
+ int32 ret = GPS__CWORD82__RET_START_SEQ_NONE;
+
+ if ((ana_size >= 1) && (buf_p[0] == 0x24u)) {
+ /* Ignore -> No applicable rules for MISRA-C */ /* 0x24: '$' QAC 285 */
+ ret = GPS__CWORD82__RET_START_SEQ_NMEA;
+ } else if ((ana_size >= 1) && (buf_p[0] == 0xB0)) {
+ ret = GPS__CWORD82__RET_START_SEQ_FULL;
+ } else if ((ana_size >= 1) && (buf_p[0] == 0xC6)) {
+ /* #GPF_60_024 */
+ ret = GPS__CWORD82__RET_START_SEQ_BIN;
+ } else if ((ana_size >= 1) && (buf_p[0] == 0xB5)) {
+ /* #GPF_60_024 */
+ ret = GPS_UBLOX_RET_START_SEQ_UBX;
+ } else {
+ ret = GPS__CWORD82__RET_START_SEQ_NONE;
+ }
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Recv_SearchFrameData
+ * ABSTRACT : Frame detection processing
+ * FUNCTION : Find if a frame exists in the data
+ * ARGUMENT : TG_GPS_RECV_AnaDataBuf *adbuf_p ... Pointer to the analysis data storage buffer
+ * u_int16 *ana_size; ... Analysis completion data size
+ * NOTE : Since it is assumed that the beginning of the frame is stored in the analysis start offset,
+ * when the beginning of the frame is detected in the middle of the buffer,
+ * the processing is terminated with the data up to that point as abnormal format data.
+ * RETURN : GPS_RCV_FRMSRCH_ERR_FORMAT ... Frame format error
+ * GPS_RCV_FRMSRCH_FIXED ... Frame determination
+ * GPS_RCV_FRMSRCH_NOT_FIXED ... Frame undetermined
+ * GPS_RCV_FRMSRCH_NO_DATA ... No analysis data
+ ******************************************************************************/
+int32 DevGpsRecvSearchFrameData(const TG_GPS_RECV_AnaDataBuf *adbuf_p, u_int16 *ana_size) {
+ int32 ret = GPS_RCV_FRMSRCH_ERR_FORMAT; /* Return value(Frame format error) */
+ /* ++ GPS _CWORD82_ support */
+ int32 start_seq_type = GPS__CWORD82__RET_START_SEQ_NONE; /* Fully customized or NMEA */
+ /* -- GPS _CWORD82_ support */
+ u_int16 start_offset = 0; /* Analysis start offset */
+ u_int16 i = 0;
+ u_int16 d_size = 0; /* Unanalyzed data size */
+
+ /* Offset Initialization */
+ start_offset = adbuf_p->offset; /* Start of analysis */ /* Ignore -> No applicable rules for MISRA-C */
+
+ /* Setting of unanalyzed data size */
+ d_size = adbuf_p->datsize - start_offset;
+
+ /* For size 0 */
+ if (d_size == 0) {
+ /* No analysis data */
+ ret = GPS_RCV_FRMSRCH_NO_DATA;
+ /* Set the analysis completion size to 0. */
+ *ana_size = 0; /* Ignore -> No applicable rules for MISRA-C */
+ } else {
+ /* Since it is assumed that beginning of the frame is stored in the analysis start offset, */
+ /* determine if the start sequence is the first one. */
+
+ /* ++ GPS _CWORD82_ support */
+ start_seq_type = DevGpsRecvJudgeStartSeqence(&(adbuf_p->datbuf[start_offset]), d_size);
+
+ if (start_seq_type != GPS__CWORD82__RET_START_SEQ_NONE) {
+ /* -- GPS _CWORD82_ support */
+ /* Set the frame as undetermined */
+ ret = GPS_RCV_FRMSRCH_NOT_FIXED;
+
+ /* ++ GPS _CWORD82_ support */
+ /* Find end sequence */
+ if (start_seq_type == GPS__CWORD82__RET_START_SEQ_NMEA) {
+ for (i = 0; i < d_size; i++) {
+ if (adbuf_p->datbuf[(start_offset + i)] == 0x0A) {
+ /* If the end sequence is found, */
+ /* end as frame fix. */
+ ret = GPS_RCV_FRMSRCH_FIXED;
+
+ /* Set the frame size for the analysis completion size. */
+ *ana_size = i + 1;
+
+ break;
+ }
+ }
+
+ if (i == d_size) {
+ if (i >= GPS__CWORD82__CMD_LEN_MAX) {
+ /* If no end sequence is found, */
+ /* frame format error. */
+ ret = GPS_RCV_FRMSRCH_ERR_FORMAT;
+ /* After that, searching for start sequence. */
+ } else {
+ /* Because the end sequence cannot be analyzed, */
+ /* frame undetermined. */
+ ret = GPS_RCV_FRMSRCH_NOT_FIXED;
+
+ /* Set the size of unanalyzed data for the analysis completion size. */
+ *ana_size = d_size;
+ }
+ }
+ } else if (start_seq_type == GPS__CWORD82__RET_START_SEQ_FULL) {
+ /* #GPF_60_024 */
+ /* Is there one frame of data for full customization information? */
+ if (d_size >= GPS__CWORD82__FULLBINARY_LEN) {
+ /* Is there an end sequence? */
+ if (adbuf_p->datbuf[( (start_offset + GPS__CWORD82__FULLBINARY_LEN) - 1)] == 0xDA) {
+ /* Ignore -> MISRA-C:2004 Rule 12.1 */
+ /* If an end sequence is found, */
+ /* end as frame fix. */
+ ret = GPS_RCV_FRMSRCH_FIXED;
+
+ /* Set the frame size for the analysis completion size. */
+ *ana_size = GPS__CWORD82__FULLBINARY_LEN;
+ } else {
+ /* If it is not an end sequence, */
+ /* frame format error. */
+ ret = GPS_RCV_FRMSRCH_ERR_FORMAT;
+ /* Searching for Start Sequence */
+ }
+ } else {
+ /* Because the end sequence cannot be analyzed, */
+ /* frame undetermined. */
+ ret = GPS_RCV_FRMSRCH_NOT_FIXED;
+
+ /* Set the size of unanalyzed data for the analysis completion size. */
+ *ana_size = d_size;
+ }
+ } else if (start_seq_type == GPS__CWORD82__RET_START_SEQ_BIN) {
+ /* Is there data for one standard binary frame? */
+ if (d_size >= GPS__CWORD82__NORMALBINARY_LEN) {
+ /* Is there an end sequence? */
+ if (adbuf_p->datbuf[((start_offset + GPS__CWORD82__NORMALBINARY_LEN) - 1)] == 0xDA) {
+ /* Ignore -> MISRA-C:2004 Rule 12.1 */
+ /* If an end sequence is found, */
+ /* end as frame fix. */
+ ret = GPS_RCV_FRMSRCH_FIXED;
+
+ /* Set the frame size for the analysis completion size. */
+ *ana_size = GPS__CWORD82__NORMALBINARY_LEN;
+ } else {
+ /* If it is not an end sequence, */
+ /* frame format error. */
+ ret = GPS_RCV_FRMSRCH_ERR_FORMAT;
+ /* Searching for Start Sequence */
+ }
+ } else {
+ /* Because the end sequence cannot be analyzed, */
+ /* frame undetermined. */
+ ret = GPS_RCV_FRMSRCH_NOT_FIXED;
+
+ /* Set the size of unanalyzed data for the analysis completion size. */
+ *ana_size = d_size;
+ }
+ } else if (start_seq_type == GPS_UBLOX_RET_START_SEQ_UBX) {
+ /* TODO Checksum calculation using data from start_offset to d_size */
+ /* TODO Check that the checksum is correct. (See test code.) */
+ /* If the if checksums match, */
+ /* end as frame fix. */
+ ret = GPS_RCV_FRMSRCH_FIXED;
+
+ /* Set the frame size for the analysis completion size. */
+ *ana_size = d_size;
+ } else {
+ }
+ /* -- #GPF_60_024 */
+ } else {
+ /* It is not a start sequence, so it is regarded as a frame format error. */
+ ret = GPS_RCV_FRMSRCH_ERR_FORMAT;
+
+ /* After that, searching for Start Sequence. */
+ }
+
+ /* If the frame format is abnormal, search for the start sequence. */
+ if (ret == GPS_RCV_FRMSRCH_ERR_FORMAT) {
+ POSITIONING_LOG("FORMAT ERROR [start_seq_type:%d]\n", start_seq_type);
+
+ /* Assuming that the start sequence has not been found until the end, */
+ /* the size of the analysis completed is set as the size of the unanalyzed data. */
+ *ana_size = d_size;
+
+ /* ++ GPS _CWORD82_ support (Search from the second byte for safety (at least the first byte is checked at the beginning of the function)))*/
+ for (i = start_offset + 1; i < (u_int32)(start_offset + d_size); i++) {
+ /* for( i = (start_offset + 2); i < (u_int32)(start_offset + d_size); i++ ) */
+ /* -- GPS _CWORD82_ support */
+ /* Start Sequence? */
+ /* ++ GPS _CWORD82_ support */
+ if (DevGpsRecvJudgeStartSeqence(&(adbuf_p->datbuf[i]), d_size) != GPS__CWORD82__RET_START_SEQ_NONE) {
+ /* if( (adbuf_p->datbuf[(i-1)] == GPS_CODE_START_SQ_HI) && */
+ /* (adbuf_p->datbuf[i] == GPS_CODE_START_SQ_LOW) ) */
+ /* -- GPS _CWORD82_ support */
+ /* In the case of a start sequence, the analysis is completed before that. #01 */
+ *ana_size = (i - start_offset - 1);
+
+ break;
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Recv_ReadRcvData
+ * ABSTRACT : Data reception processing
+ * FUNCTION : Read serial data
+ * ARGUMENT : TG_GPS_RECV_RcvData* pst_rcv_data : Receive data read buffer
+ * NOTE : -
+ * RETURN : T_ErrCodes Error code
+ * MCSUB_NML Normal
+ * MCCOM_ERR_SYSTEM Abnormality
+ ******************************************************************************/
+int32 DevGpsRecvReadRcvData(TG_GPS_RECV_RcvData* pst_rcv_data) {
+ int32 ret = GPS_RCV_RET_ERR;
+ INT32 gps_ret = 0;
+
+#if FTEN_DRIVER
+ static int msg_kind = GPS_RCV_NMEA_GGA;
+
+ // Serial data capture
+ GpsMngApiDat gps_mng_data;
+
+ memset(&gps_mng_data, 0, sizeof(gps_mng_data));
+#ifdef TEST_HAL2
+ if (msg_kind > GPS_RCV_NMEA_RMC) {
+ msg_kind = GPS_RCV_NMEA_GGA;
+ }
+#else
+ if (msg_kind == GPS_RCV_NMEA_GGA) {
+ msg_kind = GPS_RCV_NMEA_RMC;
+ } else if (msg_kind == GPS_RCV_NMEA_RMC) {
+ msg_kind = GPS_RCV_NMEA_GGA;
+ } else {
+ msg_kind = GPS_RCV_NMEA_GGA;
+ }
+#endif
+
+ gps_ret = GpsMngApiGetRcvMsg(&g_gps_mng_obj, msg_kind, &gps_mng_data);
+
+#ifdef TEST_HAL2
+ msg_kind++;
+#endif
+
+ pst_rcv_data->us_read_size = (u_int16)gps_mng_data.dataLength;
+
+ if (pst_rcv_data->us_read_size >= GPS_RCV_MAXREADSIZE) {
+ return GPS_RCV_RET_ERR_SYSTEM;
+ }
+
+ memcpy(pst_rcv_data->uc_read_data, gps_mng_data.data, pst_rcv_data->us_read_size);
+
+ // Add '\0'
+ pst_rcv_data->uc_read_data[pst_rcv_data->us_read_size] = '\0';
+
+ if (GPS_CTL_RET_SUCCESS != gps_ret) {
+ ret = GPS_RCV_RET_ERR_SYSTEM;
+ } else {
+ ret = GPS_RCV_RET_NML;
+ }
+#endif
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Recv_RcvNormal
+ * ABSTRACT : Receive (normal) Receive processing
+ * FUNCTION : Receive (normal) Processing at event reception
+ * ARGUMENT : -
+ * NOTE :
+ * RETURN : -
+ ******************************************************************************/
+void DevGpsRecvRcvNormal(void) {
+ TG_GPS_RECV_RcvData* pst_rcv_data = NULL; /* Buffer for reading serial data */
+ TG_GPS_RECV_RcvBuf* pst_rcv_buf = NULL; /* Receive data storage buffer */
+ TG_GPS_RECV_AnaDataBuf* pst_ana_data_buf = NULL; /* Analysis data storage buffer */
+ TG_GPS_RECV_RcvFrameBuf* pst_rcv_frame_buf = NULL; /* Receive frame buffer */
+ int32 i_ret = 0; /* Frame Detection Result */
+ u_int16 ana_size = 0; /* Data analysis size storage */
+
+ /* Initializing process */
+ pst_ana_data_buf = &g_gps_ana_databuf;
+
+ /* Fast _CWORD71_ processing(memset fix) */
+ /* Initializes the offset that needs initialization in the receive data storage buffer. */
+ pst_ana_data_buf->offset = 0;
+
+ /* Serial continuous reception data analysis processing */
+ pst_rcv_data = &g_gps_rcvdata;
+ pst_rcv_buf = &g_gps_rcvbuf;
+ memcpy(&(pst_ana_data_buf->datbuf[0]), &(pst_rcv_buf->r_buf[0]), pst_rcv_buf->r_size);
+ memcpy(&(pst_ana_data_buf->datbuf[pst_rcv_buf->r_size]),
+ &(pst_rcv_data->uc_read_data[0]),
+ pst_rcv_data->us_read_size);
+
+ pst_ana_data_buf->datsize = pst_rcv_buf->r_size + pst_rcv_data->us_read_size;
+
+ /* Serial receive data analysis process */
+ do {
+ /* Frame detection processing */
+ i_ret = DevGpsRecvSearchFrameData(pst_ana_data_buf, &ana_size);
+
+ /* For frame determination */
+ if (i_ret == GPS_RCV_FRMSRCH_FIXED) {
+ /* Frames are stored in the receive frame buffer. */
+ pst_rcv_frame_buf = &g_gps_rcv_framebuf;
+ memset(pst_rcv_frame_buf, 0, sizeof(TG_GPS_RECV_RcvFrameBuf)); /* Ignore -> No applicable rules for MISRA-C */
+ /* Ignore -> No applicable rules for MISRA-C */ /* QAC 3200 */
+ memcpy(& (pst_rcv_frame_buf->buf[0]),
+ &(pst_ana_data_buf->datbuf[pst_ana_data_buf->offset]),
+ ana_size);
+ pst_rcv_frame_buf->size = ana_size;
+
+ /* Reception of the command */
+ /* Send receipt notice (command) to main thread */
+ /* Send Received Data to Main Thread */
+ DevGpsRecvSndRcvData(pst_rcv_frame_buf);
+ } else if (i_ret == GPS_RCV_FRMSRCH_NOT_FIXED) {
+ /* Store unconfirmed data in the received data storage buffer, */
+ /* and leave no unanalyzed data. */
+ memset(pst_rcv_buf, 0, sizeof(TG_GPS_RECV_RcvBuf)); /* Ignore -> No applicable rules for MISRA-C */
+ memcpy(& (pst_rcv_buf->r_buf[0]),
+ &(pst_ana_data_buf->datbuf[pst_ana_data_buf->offset]),
+ ana_size);
+ pst_rcv_buf->r_size = ana_size;
+ i_ret = GPS_RCV_FRMSRCH_NO_DATA;
+ } else if (i_ret == GPS_RCV_FRMSRCH_ERR_FORMAT) {
+ /* [Measures against resetting with 1S + _CWORD82_]From here */
+ /* Clears the unanalyzed data stored in the receive data storage buffer, */
+ /* and flag is set to "No Unparsed Data" so that data can be parsed from the beginning of the next. */
+ memset(&(pst_rcv_buf->r_buf[0]), 0, pst_rcv_buf->r_size);
+ pst_rcv_buf->r_size = 0;
+ i_ret = GPS_RCV_FRMSRCH_NO_DATA;
+ /* [Measures against resetting with 1S + _CWORD82_]Up to this point */
+ /* Since this section discards garbage data, */
+ /* not subject to diagnosis registration. */
+ /* Diagnosis registration check */
+ } else if (i_ret == GPS_RCV_FRMSRCH_NO_DATA) {
+ /* Ignore -> No applicable rules for MISRA-C */
+ memset(pst_rcv_buf, 0, sizeof(TG_GPS_RECV_RcvBuf));
+ /* Termination */
+ } else {
+ /* No unanalyzed data is assumed because it is impossible. */
+ i_ret = GPS_RCV_FRMSRCH_NO_DATA;
+
+ /* Ignore -> No applicable rules for MISRA-C */
+ memset(pst_rcv_buf, 0, sizeof(TG_GPS_RECV_RcvBuf));
+ }
+
+ /* Update analysis data offset */
+ pst_ana_data_buf->offset += ana_size;
+
+ /* Repeat until no unanalyzed data is found. */
+ } while (i_ret != GPS_RCV_FRMSRCH_NO_DATA);
+}
+
+/********************************************************************************
+ * MODULE : DEV_RcvDATA
+ * ABSTRACT : Acknowledgement
+ * FUNCTION : Send message notifications to the communication management thread
+ * ARGUMENT : TG_GPS_RCV_DATA *ptg_rcv_data....I/F information between the receiving thread
+ * and the communication management thread
+ * NOTE :
+ * RETURN : RET_API :RET_NORMAL:Normal completion
+ * :RET_ERROR:ABENDs
+ ********************************************************************************/
+RET_API DevRcvData(const TG_GPS_RCV_DATA* ptg_rcv_data) {
+ RET_API ret = RET_NORMAL; /* Return value */
+ u_int16 w_size = 0; /* Data length setting */
+ u_int16 w_all_len = 0; /* Sent message length */
+ u_int16 w_mode = 0; /* Mode information */
+ RID req_id = 0; /* Resources ID */
+ T_APIMSG_MSGBUF_HEADER tg_header; /* Message header */
+
+ // Initialzie struct
+ memset(&tg_header, 0, sizeof(tg_header));
+
+ /* Transmitting buffer */
+ u_int8 by_snd_buf[(sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(TG_GPS_RCV_DATA))];
+
+ /* Calculation of transmission data length */
+ w_size = ptg_rcv_data->bydata_len + sizeof(ptg_rcv_data->dwret_status) + sizeof(ptg_rcv_data->bydata_len);
+
+ /* <<Creation of message header section>>>> */
+ tg_header.signo = 0; /* Signal information setting */
+ tg_header.hdr.sndpno = PNO_NAVI_GPS_RCV; /* Source thread No. setting */
+ tg_header.hdr.respno = 0; /* Destination process No. */
+ tg_header.hdr.cid = CID_GPS_RECVDATA; /* Command ID setting */
+ tg_header.hdr.msgbodysize = w_size; /* Message data length setting */
+ tg_header.hdr.rid = req_id; /* Resource ID Setting */
+ tg_header.hdr.reserve = 0; /* Reserved area clear */
+
+ memcpy(&by_snd_buf[ 0 ], &tg_header, sizeof(T_APIMSG_MSGBUF_HEADER));
+ /* <<Creation of data section>> */
+ /* Copy data to send buffer */
+ memcpy(&by_snd_buf[ sizeof(T_APIMSG_MSGBUF_HEADER)], ptg_rcv_data, w_size);
+
+ /* <<Messaging>> */
+ /* Calculation of Sent Message Length */
+ w_all_len = w_size + sizeof(T_APIMSG_MSGBUF_HEADER);
+
+ /* Mode information(Reserved) */
+ w_mode = 0;
+
+ /* Message transmission request */
+ ret = _pb_SndMsg(PNO_NAVI_GPS_MAIN, w_all_len, reinterpret_cast<void*>(by_snd_buf), w_mode);
+
+ /* End of the process */
+ return ret;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Recv_SndRcvData
+ * ABSTRACT : Receive data transmission processing
+ * FUNCTION : Transmit received data
+ * ARGUMENT : TG_GPS_RECV_RcvFrameBuf *frame_baf Receive frame buffer pointer
+ * NOTE : Fetches a command from the receive frame buffer and
+ * issue received data notifications to the main thread
+ * RETURN : None
+ ********************************************************************************/
+void DevGpsRecvSndRcvData(const TG_GPS_RECV_RcvFrameBuf* p_frame_buf) {
+ TG_GPS_RCV_DATA tg_rcv_data;
+ u_int16 w_cmd_len = 0;
+
+ // Initialzie struct
+ memset(&tg_rcv_data, 0, sizeof(tg_rcv_data));
+
+ if (p_frame_buf != NULL) {
+ w_cmd_len = p_frame_buf->size;
+
+ if (w_cmd_len <= GPS_READ_LEN) {
+ /* Ignore -> No applicable rules for MISRA-C */
+ memset(&tg_rcv_data, 0, sizeof(TG_GPS_RCV_DATA));
+
+ /* Status Settings */
+ tg_rcv_data.dwret_status = GPS_RECVOK;
+
+ /* Command length setting */
+ tg_rcv_data.bydata_len = w_cmd_len;
+
+ /* Receive data setting */
+ /* Sending from the Beginning of the Sirf Binary #03 */
+ memcpy(&tg_rcv_data.bygps_data[0], &p_frame_buf->buf[0], w_cmd_len);
+
+ /* Issuance of reception notice */
+ DevRcvData(&tg_rcv_data); /* Ignore -> No applicable rules for MISRA-C */
+ }
+ }
+}
+
+/**
+ * @brief
+ * Pos_Gps_Recv Thread Stop Processing
+ */
+void DevGpsRecvThreadStopProcess(void) {
+#if FTEN_DRIVER
+ GpsMngApiClose(&g_gps_mng_obj);
+#endif
+ PosTeardownThread(ETID_POS_GPS_RECV);
+ return;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/GpsCommon/MDev_GpsRollOver.cpp b/video_in_hal/positioning_hal/src/GpsCommon/MDev_GpsRollOver.cpp
new file mode 100755
index 0000000..62227c2
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/GpsCommon/MDev_GpsRollOver.cpp
@@ -0,0 +1,275 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_GpsRollOver.cpp
+*/
+
+#include "MDev_GpsRollOver.h"
+
+#define TIM_ROLOVR_CALCORCNT_DAYS (1024 * 7) /*1024 weeks * 7 days */
+
+#define TMT_OK (1) /* Definition indicating normal status */
+#define TMT_NG (0) /* Definitions indicating abnormal status */
+#define TMT_TRUE (1) /* Definitions indicating the status for which the condition is true */
+#define TMT_FALSE (0) /* Definitions indicating a status in which the condition is false */
+
+#define TIM_ROLOVR_LEAPYEARDAYS (366) /*Number of days in the leap year */
+#define TIM_ROLOVR_NOTLEAPYEARDAYS (365) /*Year days in non-leap years */
+
+static const WORD kMonth[2][12] = {
+ {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, /* Number of days per month(For non-leap year) */
+ {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} /* Number of days per month(For leap years) */
+};
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : ChkLeapYear
+ * Function : Leap year determination processing
+ * Feature Overview : Determine whether it is a leap year
+ * Input : u_int16 year
+ * Output : None
+ * Return value : u_int32
+ TMT_TRUE Leap year
+ TMT_FALSE Non-leap year
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static u_int32 ChkLeapYear(u_int16 year) {
+ int32 leap_year;
+
+ /* Leap year determination processing (select subscripts in the [LEAP YEAR] table) *The processing that matches the time correction processing after time difference value addition/subtraction is used. */
+ leap_year = TMT_FALSE;
+ if ((year % 4) == 0) {
+ leap_year = TMT_TRUE;
+ }
+ if ((year % 100) == 0) {
+ leap_year = TMT_FALSE;
+ }
+
+ if ((year % 400) == 0) {
+ leap_year = TMT_TRUE;
+ }
+
+ return (leap_year);
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : RollOverFormerLaterDays
+ * Function : Calculation of the number of days before and after
+ * Feature Overview : The number of days from the beginning of the month to the previous day of the specified date,
+ and calculates the number of days after a given date, up to the end of the month
+ * Input : TG_TIM_ROLOVR_YMD* base_ymd Reference date
+ * Output : u_int32* former_days Number of days before (number of days before the specified date from the beginning of the month)
+ u_int32* later_days Number of days after(Number of days following the specified date until the end of the month)
+ * Return value : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void RollOverFormerLaterDays(TG_TIM_ROLOVR_YMD* base_ymd, u_int32* former_days, u_int32* later_days) {
+ int32 leap_year;
+
+ leap_year = ChkLeapYear(base_ymd->year);
+
+ *former_days = base_ymd->day - 1;
+
+ *later_days = kMonth[leap_year][base_ymd->month - 1] - base_ymd->day;
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : RollOverCalDaysWithinBY
+ * Function : Calculation of the difference in the number of days in the base year
+ * Feature Overview : Calculate the difference in the number of days between the base date and the conversion target date.
+ [Restriction]If the base date > conversion target date, the number of days difference is 0.
+ * Input : TG_TIM_ROLOVR_YMD* base_ymd Reference date
+ TG_TIM_ROLOVR_YMD* conv_ymd Conversion Date
+ * Output : None
+ * Return value : u_int32 Difference in the number of days(positive only)
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static u_int32 RollOverCalDaysWithinBY(TG_TIM_ROLOVR_YMD* base_ymd, TG_TIM_ROLOVR_YMD* conv_ymd) {
+ int32 leap_year; /* Subscripts in the [LEAP YEAR] table */
+ u_int32 days; /* Day Difference Calculation Result */
+ u_int32 l_days; /* Number of days after the reference month */
+ u_int32 f_days; /* Number of days before the conversion target month */
+ u_int32 dmy_days; /* Dummy days(For storing unnecessary number of days in this function) */
+ u_int32 m_days; /* Sum of the number of days in the month between the base month and the month to be converted */
+ int32 cnt; /* A counter that sums the number of days in a month between the base month and the month to be converted */
+ u_int16 diff_month; /* Difference between the conversion target month and the base month */
+ u_int16 chk_month; /* Number of days of month to be acquired */
+
+ days = 0;
+
+ if (base_ymd->month == conv_ymd->month) {
+ if (base_ymd->day <= conv_ymd->day) {
+ days = conv_ymd->day - base_ymd->day;
+ } else {
+ days = 0; /* Set the difference to 0(Negative difference in number of days is not calculated.) */
+ }
+ } else if (base_ymd->month < conv_ymd->month) {
+ RollOverFormerLaterDays(base_ymd, &dmy_days, &l_days);
+
+ m_days = 0;
+ diff_month = conv_ymd->month - base_ymd->month;
+
+ leap_year = ChkLeapYear(base_ymd->year);
+
+ /* Calculate the sum of the number of days in the month between the base month and the conversion target month B */
+ chk_month = base_ymd->month + 1;
+ for (cnt = 0; cnt < (diff_month - 1); cnt++) {
+ m_days += kMonth[leap_year][chk_month - 1];
+ chk_month++;
+ }
+
+ RollOverFormerLaterDays(conv_ymd, &f_days, &dmy_days);
+
+ days = l_days + m_days + f_days + 1; /* Calculate the difference in number of days as A+B+C+1 */
+
+ } else {
+ days = 0; /* Set the difference to 0(Negative difference in number of days is not calculated.) */
+ }
+
+ return days;
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : RollOverGetAYearDays
+ * Function : Process of obtaining the number of days per year
+ * Feature Overview : Get the number of days in a given year
+ * Input : u_int16 base_year Year
+ * Output : None
+ * Return value : u_int32 Number of days
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static u_int32 RollOverGetAYearDays(u_int16 base_year) {
+ int32 leap_year; /* Subscripts in the [LEAP YEAR] table */
+ u_int32 days;
+
+ leap_year = ChkLeapYear(base_year); /* Leap year determination processing */
+
+ if (leap_year == TMT_TRUE) {
+ days = TIM_ROLOVR_LEAPYEARDAYS;
+ } else {
+ days = TIM_ROLOVR_NOTLEAPYEARDAYS;
+ }
+
+ return days;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : RollOverConvYMDWithoutBY
+ * Function : Date conversion processing outside the base year, month, and day
+ * Feature Overview : Calculate the date shifted by the specified number of days from the specified date.
+ *If less than (1024 weeks x 7 days) is specified as the number of days difference, the calculation result is
+ returns the specified date(No correction)
+ * Input : TG_TIM_ROLOVR_YMD* base_ymd Reference date
+ u_int32 days Difference in the number of days
+ u_int32 days_by Number of days after + number of days after month
+ * Output : TG_TIM_ROLOVR_YMD* conv_ymd Date of the conversion result
+ * Return value : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void RollOverConvYMDWithoutBY(TG_TIM_ROLOVR_YMD* base_ymd, u_int32 days,
+ u_int32 days_by, TG_TIM_ROLOVR_YMD* conv_ymd) {
+ int32 leap_year; /* Subscripts in the [LEAP YEAR] table */
+ u_int32 rest_days; /* Remaining number of days */
+ u_int16 cal_year; /* For year calculation */
+ u_int16 cal_month; /* For monthly calculation */
+ u_int32 cal_days; /* To calculate the number of days */
+
+ rest_days = days - days_by; /* Remaining number of days is different from the number of initialization days.-(Number of days after + Number of days after month) */
+ cal_year = base_ymd->year + 1; /* The year is set to the year following the year of the initialization reference date. */ /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+
+ cal_days = RollOverGetAYearDays(cal_year); /* Process of obtaining the number of days per year */
+
+ while (rest_days > cal_days) {
+ rest_days -= cal_days; /* Remaining Days = Remaining Days-Updated as Days of Year */
+
+ cal_year++; /* Increment Year */
+
+ cal_days = RollOverGetAYearDays(cal_year); /* Process of obtaining the number of days per year */
+ }
+
+ /* Year Finalization */
+ conv_ymd->year = cal_year; /* Year Calculated */
+
+ cal_month = 1; /* Initialize Month January */
+
+ leap_year = ChkLeapYear(conv_ymd->year); /* Leap year determination processing */
+
+ cal_days = kMonth[leap_year][cal_month - 1]; /* Acquisition processing of the number of days/month */ /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+
+ while (rest_days > cal_days) {
+ rest_days -= cal_days; /* Remaining Days = Remaining Days-Updated as Days of Month */
+
+ cal_month++; /* Increment month */
+
+ cal_days = kMonth[leap_year][cal_month - 1]; /* Acquisition processing of the number of days/month */ /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Fix month */
+ conv_ymd->month = cal_month; /* Month Calculated */
+
+ /* Date set */
+ conv_ymd->day = (u_int16)rest_days; /* Day calculated Remaining number of days */
+}
+
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * FUNCTION : RollOverConvYMD
+ * Function : Date conversion processing
+ * Feature Overview : Calculate the date shifted by the specified number of days from the specified date.
+ *If the base date is shifted by the number of days but the year is the same as the base date, the result returns the base date
+ * Input : TG_TIM_ROLOVR_YMD* base_ymd Reference date
+ u_int32 days Difference in the number of days
+ * Output : TG_TIM_ROLOVR_YMD* conv_ymd Date of the conversion result
+ * Return value : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void RollOverConvYMD(TG_TIM_ROLOVR_YMD* base_ymd, u_int32 days, TG_TIM_ROLOVR_YMD* conv_ymd) {
+ u_int32 days_by; /* Number of days after + number of days after month(=difference in number of days from the base date to the end of the year) */
+ TG_TIM_ROLOVR_YMD tmp_ymd;
+
+
+ /* (number of days after + number of days after)Set calculation date( 12/31 ) */
+ tmp_ymd.year = base_ymd->year;
+ tmp_ymd.month = 12;
+ tmp_ymd.day = 31;
+
+ days_by = RollOverCalDaysWithinBY(base_ymd, &tmp_ymd); /* Calculation of the difference in the number of days in the base year */
+
+ if (days_by >= days) {
+ memcpy(conv_ymd, base_ymd, sizeof(TG_TIM_ROLOVR_YMD)); /* Returns the base date regardless of the number of days difference */
+
+ } else {
+ RollOverConvYMDWithoutBY(base_ymd, days, days_by, conv_ymd);
+ }
+}
+
+
+
+/**
+ * @brief
+ * Conversion to a time that takes the GPS week correction counter into account
+ *
+ * Converting the GPS Week Correction Counter to a Considered Time
+ *
+ * @param[in] TG_TIM_ROLOVR_YMD* base_ymd Reference date
+ * @param[in] u_int8 gpsweekcorcnt GPS weekly correction counter
+ * @param[out] TG_TIM_ROLOVR_YMD* conv_ymd Correction Date
+ * @return none
+ * @retval none
+ */
+void GPSRollOverConvTime(TG_TIM_ROLOVR_YMD* base_ymd, TG_TIM_ROLOVR_YMD* conv_ymd, u_int8 gpsweekcorcnt) {
+ u_int32 days; /* Difference in the number of days */
+
+ days = TIM_ROLOVR_CALCORCNT_DAYS * gpsweekcorcnt; /* (1024 weeks x 7 days) x GPS week correction counter to calculate the difference in the number of days */
+
+ RollOverConvYMD(base_ymd, days, conv_ymd); /* Date conversion processing */
+}
diff --git a/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_API.cpp b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_API.cpp
new file mode 100755
index 0000000..35f5201
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_API.cpp
@@ -0,0 +1,491 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_API.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "MDev_Gps_API.h"
+#include "positioning_hal.h"
+#include "positioning_def.h"
+#include "MDev_Gps_Nmea.h"
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+/******************************************************************************
+@brief SendNmeaGps<BR>
+ NMEA transmission process
+@outline Send NMEA to VehicleSensor Thread
+@param[in] TG_GPS_NMEA* : pstNmeaData ... NMEA data
+@param[out] none
+@return RET_API
+@retval RET_NORMAL : Normal completion
+@retval RET_ERROR : ABENDs
+*******************************************************************************/
+RET_API SendNmeaGps(const MDEV_GPS_NMEA* p_nmea_data) {
+ MDEV_GPS_RAWDATA_NMEA_MSG s_send_msg;
+ SENSOR_MSG_GPSDATA s_msg_buf;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /* Create GPS Data Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /* Message header */
+ s_send_msg.h_dr.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.h_dr.hdr.respno = 0x0000;
+ s_send_msg.h_dr.hdr.cid = CID_GPS_DATA;
+ s_send_msg.h_dr.hdr.msgbodysize = sizeof(MDEV_GPS_RAWDATA_NMEA);
+ s_send_msg.h_dr.hdr.rid = 0x00;
+
+ /* Message data */
+ s_send_msg.st_data.e_kind = MDEV_GPS_DATA_RAWDATA_NMEA;
+ (void)memcpy(&(s_send_msg.st_data.st_nmea_data), p_nmea_data, sizeof(s_send_msg.st_data.st_nmea_data));
+
+ /* Create message buffer */
+ (void)memset(&s_msg_buf, 0, sizeof(s_msg_buf));
+ (void)memcpy(&(s_msg_buf.st_head.hdr), &(s_send_msg.h_dr.hdr), sizeof(T_APIMSG_HEADER));
+
+ s_msg_buf.st_para.ul_did = POS_DID_GPS_NMEA;
+ s_msg_buf.st_para.us_size = GPS_NMEA_SZ;
+
+ (void)memcpy(&(s_msg_buf.st_para.uc_data), &(s_send_msg.st_data.st_nmea_data), s_msg_buf.st_para.us_size);
+
+ ret = _pb_SndMsg(u_pno, sizeof(s_msg_buf), &s_msg_buf, 0);
+
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("_pb_SndMsg ERROR!! [ret=%d]\n", ret);
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS processing data transmission process
+ *
+ * @param[in] pstGpsTime SENSOR_MSG_GPSTIME - GPS time information
+ * @param[in] p_lonlat SENSORLOCATION_LONLATINFO - Latitude and longitude information
+ * @param[in] p_altitude SENSOR_LOCATION_ALTITUDEINFO - Altitude information
+ * @param[in] p_heading SENSORMOTION_HEADINGINFO_DAT - Bearing information
+ *
+ * @return RET_NORMAL Normal completion
+ * RET_ERROR ABENDs
+ */
+RET_API SendCustomGps(const SENSOR_MSG_GPSTIME* p_gps_time,
+ const SENSORLOCATION_LONLATINFO_DAT* p_lonlat,
+ const SENSORLOCATION_ALTITUDEINFO_DAT* p_altitude,
+ const SENSORMOTION_HEADINGINFO_DAT* p_heading,
+ const NAVIINFO_DIAG_GPS* p_diag_data) {
+ SENSOR_MSG_GPSDATA s_send_msg = {0};
+ MDEV_GPS_CUSTOMDATA* p_custom_data = NULL;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ /* Fast _CWORD71_ processing(memset fix) */
+ /* Initializes an area whose value is undefined in the message buffer. */
+ (void)memset(&s_send_msg.st_head, 0x00, sizeof(s_send_msg.st_head));
+
+ /** Message header */
+ s_send_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.st_head.hdr.respno = 0x0000;
+ s_send_msg.st_head.hdr.cid = CID_GPS_DATA;
+ s_send_msg.st_head.hdr.msgbodysize = sizeof(MDEV_GPS_CUSTOMDATA);
+ s_send_msg.st_head.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_para.ul_did = VEHICLE_DID_GPS_CUSTOMDATA;
+ s_send_msg.st_para.us_size = sizeof(MDEV_GPS_CUSTOMDATA);
+ p_custom_data = reinterpret_cast<MDEV_GPS_CUSTOMDATA *>(&(s_send_msg.st_para.uc_data));
+
+ (void)memcpy(&(p_custom_data->st_lonlat), p_lonlat, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+ (void)memcpy(&(p_custom_data->st_altitude), p_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+ (void)memcpy(&(p_custom_data->st_heading), p_heading, sizeof(SENSORMOTION_HEADINGINFO_DAT));
+ (void)memcpy(&(p_custom_data->st_diag_gps), p_diag_data, sizeof(NAVIINFO_DIAG_GPS));
+ (void)memcpy(&(p_custom_data->st_gps_time), p_gps_time, sizeof(SENSOR_MSG_GPSTIME));
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, sizeof(s_send_msg), reinterpret_cast<void*>(&s_send_msg), 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/******************************************************************************
+@brief SendSpeedGps<BR>
+ Rate information transmission processing
+@outline Sending speed information to vehicle sensor thread
+@param[in] SENSORMOTION_SPEEDINFO_DAT* : p_seed ... Velocity information
+@param[in] u_int16 : us_peed ... Vehicle speed(km/h)
+@param[out] none
+@return RET_API
+@retval RET_NORMAL : Normal completion
+@retval RET_ERROR : ABENDs
+*******************************************************************************/
+RET_API SendSpeedGps(const SENSORMOTION_SPEEDINFO_DAT* p_seed, u_int16 us_peed) {
+ MDEV_GPS_NAVISPEED_MSG s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message header */
+ s_send_msg.h_dr.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.h_dr.hdr.respno = 0x0000;
+ s_send_msg.h_dr.hdr.cid = CID_GPS_DATA;
+ s_send_msg.h_dr.hdr.msgbodysize = sizeof(MDEV_GPS_NAVISPEED);
+ s_send_msg.h_dr.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_data.e_kind = MDEV_GPS_DATA_NAVISPEED;
+ s_send_msg.st_data.us_speed_kmph = us_peed;
+
+ (void)memcpy( &s_send_msg.st_data.st_speed, p_seed, sizeof(s_send_msg.st_data.st_speed) );
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, (sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(MDEV_GPS_NAVISPEED)), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/* ++ #GPF_60_103 */
+/******************************************************************************
+@brief SendTimeGps<BR>
+ Time information transmission processing
+@outline Send GPS time information to vehicle sensor thread
+@param[in] MDEV_GPS_RTC* : p_rtc ... GPS time information
+@param[out] none
+@return RET_API
+@retval RET_NORMAL : Normal completion
+@retval RET_ERROR : ABENDs
+*******************************************************************************/
+RET_API SendTimeGps(const MDEV_GPS_RTC* p_rtc) {
+ MDEV_GPS_GPSTIME_MGS s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS data notification message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message header */
+ s_send_msg.h_dr.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.h_dr.hdr.respno = 0x0000;
+ s_send_msg.h_dr.hdr.cid = CID_GPS_DATA;
+ s_send_msg.h_dr.hdr.msgbodysize = sizeof(MDEV_GPS_GPSTIME);
+ s_send_msg.h_dr.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_data.e_kind = MDEV_GPS_DATA_GPSTIME;
+
+ (void)memcpy(&s_send_msg.st_data.st_rtc_data, p_rtc, sizeof(s_send_msg.st_data.st_rtc_data));
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, (sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(MDEV_GPS_GPSTIME)), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS clock drift transmit process
+ *
+ * @param[in] drift Clock drift
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABENDs
+ */
+RET_API SendClockDriftGps(int32_t drift) {
+ SENSOR_MSG_GPSDATA s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message header */
+ s_send_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.st_head.hdr.respno = 0x0000;
+ s_send_msg.st_head.hdr.cid = CID_GPS_DATA;
+ s_send_msg.st_head.hdr.msgbodysize = sizeof(SENSOR_MSG_GPSDATA_DAT);
+ s_send_msg.st_head.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_para.ul_did = VEHICLE_DID_GPS_CLOCK_DRIFT;
+ s_send_msg.st_para.us_size = sizeof(int32_t);
+
+ (void)memcpy(&(s_send_msg.st_para.uc_data), &drift, s_send_msg.st_para.us_size);
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, sizeof(s_send_msg), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS clock-frequency transmit process
+ *
+ * @param[in] Freq Clocking frequencies
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABENDs
+ */
+RET_API SendClockFrequencyGps(uint32_t freq) {
+ SENSOR_MSG_GPSDATA s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message header */
+ s_send_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.st_head.hdr.respno = 0x0000;
+ s_send_msg.st_head.hdr.cid = CID_GPS_DATA;
+ s_send_msg.st_head.hdr.msgbodysize = sizeof(SENSOR_MSG_GPSDATA_DAT);
+ s_send_msg.st_head.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_para.ul_did = VEHICLE_DID_GPS_CLOCK_FREQ;
+ s_send_msg.st_para.us_size = sizeof(uint32_t);
+
+ (void)memcpy(&(s_send_msg.st_para.uc_data), &freq, s_send_msg.st_para.us_size);
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, sizeof(s_send_msg), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return(ret);
+}
+
+/**
+ * @brief
+ * GPS rollover standard week number transmission processing
+ *
+ * @param[in] *p_week_rollover GPS rollover base week number
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABENDs
+ */
+RET_API DevGpsSndWknRollover(const SensorWknRollOverHal* p_week_rollover) {
+ SENSOR_MSG_GPSDATA s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset( &s_send_msg, 0x00, sizeof(s_send_msg) );
+
+ /** Message header */
+ s_send_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.st_head.hdr.respno = 0x0000;
+ s_send_msg.st_head.hdr.cid = CID_GPS_DATA;
+ s_send_msg.st_head.hdr.msgbodysize = sizeof(SensorWknRollOverHal);
+ s_send_msg.st_head.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_para.ul_did = VEHICLE_DID_GPS_WKNROLLOVER;
+ s_send_msg.st_para.us_size = sizeof(SensorWknRollOverHal);
+
+ (void)memcpy(&(s_send_msg.st_para.uc_data), p_week_rollover, s_send_msg.st_para.us_size);
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, sizeof(s_send_msg), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/******************************************************************************
+@brief DevGpsRstAnsSend<BR>
+ Reset response issuance processing
+@outline Issue a reset response
+@param[in] PNO : u_pno ... Notify-To Process No.
+@param[in] RID : uc_rid ... Response resource ID
+@param[in] u_int32 : ul_rst_sts ... Response result
+@param[out] none
+@return int32
+@retval RET_NORMAL : Normal
+@retval RET_ERROR : Abnormality
+*******************************************************************************/
+int32 DevGpsRstAnsSend(PNO u_pno, RID uc_rid, u_int32 ul_rst_sts) {
+ TG_GPS_RET_RESET_MSG s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PCSTR l_thread_name;
+
+ if (u_pno != PNO_NONE) {
+ /** Create GPS Reset Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message data */
+ s_send_msg.data.ret_rst_status = ul_rst_sts;
+
+ /* Messaging */
+ l_thread_name = _pb_CnvPno2Name(u_pno);
+ /* External Process Transmission and Reception Messages */
+ ret = _pb_SndMsg_Ext(l_thread_name,
+ CID_POSIF_REQ_GPS_RESET,
+ sizeof(s_send_msg.data),
+ reinterpret_cast<void *>(&(s_send_msg.data)),
+ 0);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("GpsCommCtl # DevGpsRstAnsSend SndMsg Error ret[%d] pno[%03X]\n", ret, u_pno);
+ ret = RET_ERROR;
+ }
+ }
+
+ return ret;
+}
+
+
+/**
+ * @brief Time setting response issuance processing
+ *
+ * @param[in] us_pno Notify-To Process No.
+ * @param[in] uc_rid Response resource ID
+ * @param[in] ul_rst_sts Response result
+ *
+ * @return Processing result
+ * @retval RET_NORMAL : Normal
+ * @retval RET_ERROR : Abnormality
+ */
+int32 DevGpsTimesetAnsSend(PNO us_pno, RID uc_rid, u_int32 ul_rst_sts) {
+ TG_GPS_RET_TIMESET_MSG st_snd_msg;
+ RET_API ret = RET_NORMAL;
+
+ /** Create GPS Reset Notification Message */
+ memset( &st_snd_msg, 0x00, sizeof(st_snd_msg) ); /* QAC 3200 */
+ /** Message header */
+ st_snd_msg.header.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ st_snd_msg.header.hdr.respno = 0x0000;
+ st_snd_msg.header.hdr.cid = CID_GPS_RETTIMESETTING;
+ st_snd_msg.header.hdr.msgbodysize = sizeof(st_snd_msg.status);
+ st_snd_msg.header.hdr.rid = uc_rid;
+ /** Message data */
+ st_snd_msg.status = ul_rst_sts;
+
+ /* Messaging */
+ if (us_pno != PNO_NONE) {
+ ret = _pb_SndMsg(us_pno, sizeof(st_snd_msg), &st_snd_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("DevGpsTimesetAnsSend SndMsg Error ret[%d] pno[%03X] \r\n", ret, us_pno);
+
+ ret = RET_ERROR;
+ }
+ }
+
+ return(ret);
+}
+
+
+/**
+ * @brief
+ * GPS clock drift transmit process
+ *
+ * @param[in] drift Clock drift
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABENDs
+ *
+ */
+RET_API DevSendGpsConnectError(BOOL is_err) {
+ SENSOR_MSG_GPSDATA s_send_msg;
+ RET_API ret = RET_NORMAL;
+ PNO u_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset(&s_send_msg, 0x00, sizeof(s_send_msg));
+
+ /** Message header */
+ s_send_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ s_send_msg.st_head.hdr.respno = 0x0000;
+ s_send_msg.st_head.hdr.cid = CID_GPS_DATA;
+ s_send_msg.st_head.hdr.msgbodysize = sizeof(SENSOR_MSG_GPSDATA_DAT);
+ s_send_msg.st_head.hdr.rid = 0x00;
+
+ /** Message data */
+ s_send_msg.st_para.ul_did = POSHAL_DID_GPS_CONNECT_ERROR;
+ s_send_msg.st_para.us_size = sizeof(uint32_t);
+
+ (void)memcpy(&(s_send_msg.st_para.uc_data), &is_err, s_send_msg.st_para.us_size);
+
+ /* Messaging */
+ ret = _pb_SndMsg(u_pno, sizeof(s_send_msg), &s_send_msg, 0);
+
+ if (ret != RET_NORMAL) {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+
+RET_API SndGpsTimeRaw(const SENSOR_GPSTIME_RAW* ps_gpstime_raw) {
+ SENSOR_MSG_GPSDATA st_snd_msg;
+ RET_API ret;
+ PNO _us_pno = PNO_VEHICLE_SENSOR;
+
+ /** Create GPS Data Notification Message */
+ (void)memset( &st_snd_msg, 0x00, sizeof(st_snd_msg) ); /* QAC 3200 */
+ /** Message header */
+ st_snd_msg.st_head.hdr.sndpno = PNO_NAVI_GPS_MAIN;
+ st_snd_msg.st_head.hdr.respno = 0x0000;
+ st_snd_msg.st_head.hdr.cid = CID_GPS_DATA;
+ st_snd_msg.st_head.hdr.msgbodysize = sizeof(SENSOR_MSG_GPSDATA_DAT);
+ st_snd_msg.st_head.hdr.rid = 0x00;
+ /** Message data */
+ st_snd_msg.st_para.ul_did = VEHICLE_DID_GPS_TIME_RAW;
+ st_snd_msg.st_para.us_size = sizeof(SENSOR_GPSTIME_RAW);
+ (void)memcpy(&(st_snd_msg.st_para.uc_data), ps_gpstime_raw, st_snd_msg.st_para.us_size); /* QAC 3200 */
+
+ /* Messaging */
+ ret = _pb_SndMsg( _us_pno, sizeof(st_snd_msg), &st_snd_msg, 0 );
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("_pb_SndMsg ERROR!! [ret=%d]\n", ret);
+ ret = RET_ERROR;
+ }
+
+ return(ret);
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Common.cpp b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Common.cpp
new file mode 100755
index 0000000..c8b5c9a
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Common.cpp
@@ -0,0 +1,2105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Common.h
+*/
+
+/*---------------------------------------------------------------------------*/
+
+#include "MDev_Gps_Common.h"
+
+#include <native_service/ns_backup.h>
+#include <native_service/ns_backup_id.h>
+#include "positioning_common.h"
+#include "MDev_Gps_API.h"
+#include "MDev_Gps_TimerCtrl.h"
+#include "MDev_Gps_Nmea.h"
+#include "MDev_GpsRecv.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define BK_ID_POS_GPS_TD_STS_SZ 1 /* Datetime Status-Size */
+#define BK_GPSFIXCNT_OFFSET_CHK 12 /* Fix Count-Offset-Check SRAM */
+#define BK_GPSFIXCNT_RAM_OK 0 /* Fix Count RAM Status OK */
+#define BK_GPSFIXCNT_RAM_FILE_NG 1 /* Fix Count RAM Status FILE NG */
+#define BK_GPSFIXCNT_RAM_NG 2 /* Fix Count RAM Status NG */
+
+#define JULIAN_DAY (-32044.0f) /* Be based on March 1, 4800 BC */
+#define MODIFIED_JULIAN_DAY_OFFSET (2400000.5f)
+#define GPS_WS_MAX (7 * 24 * 60 * 60) /* GPS time(Weekly seconds)*/
+#define GET_METHOD_GPS (1) //!< \~english GPS
+
+/* Presence information definitions DR */
+#define SENSORLOCATION_EXISTDR_NODR (0) /* Without DR */
+#define SENSORLOCATION_EXISTDR_DR (1) /* There DR */
+/* DR state definition */
+#define SENSORLOCATION_DRSTATUS_INVALID (0) /* Invalid */
+#define SENSORLOCATION_DRSTATUS_GPS_NODR (1) /* Information use GPS, not yet implemented DR */
+#define SENSORLOCATION_DRSTATUS_NOGPS_DR (2) /* No information available GPS, DR implementation */
+#define SENSORLOCATION_DRSTATUS_GPS_DR (3) /* Information use GPS, DR implementation */
+
+#define SENSORLOCATION_STATUS_DISABLE (0) //!< \~english Not available
+#define SENSORLOCATION_STATUS_ENABLE (1) //!< \~english Available
+/*---------------------------------------------------------------------------*/
+// Global values
+
+uint8_t g_gps_reset_cmd_sending = FALSE; /* Reset command transmission in progress judgment flag */
+uint8_t g_is_gpstime_sts = FALSE; /* Date/Time Status Fixed Value Setting Indication Flag */
+uint8_t g_gpstime_raw_tdsts = 0;
+extern u_int8 g_gps_week_cor_cnt;
+/*---------------------------------------------------------------------------*/
+// Functions
+void WriteGpsTimeToBackup(uint8_t flag, POS_DATETIME* pst_datetime) {
+ int32_t ret;
+ ST_GPS_SET_TIME buf;
+
+ memset(reinterpret_cast<void *>(&buf), 0, (size_t)sizeof(buf));
+
+ buf.flag = flag;
+ buf.year = pst_datetime->year;
+ buf.month = pst_datetime->month;
+ buf.date = pst_datetime->date;
+ buf.hour = pst_datetime->hour;
+ buf.minute = pst_datetime->minute;
+ buf.second = pst_datetime->second;
+
+ ret = Backup_DataWt(D_BK_ID_POS_GPS_TIME_SET_INFO, &buf, 0, sizeof(ST_GPS_SET_TIME));
+ if (ret != BKUP_RET_NORMAL) {
+ POSITIONING_LOG("Backup_DataWt ERROR!! [ret=%d]", ret);
+ }
+
+ return;
+}
+
+
+
+/********************************************************************************
+ * MODULE : ChangeStatusGpsCommon
+ * ABSTRACT : State transition processing
+ * FUNCTION : Changes the state of the GPS communication management process to the specified state
+ * ARGUMENT : u_int32 sts : State of the transition destination
+ * NOTE :
+ * RETURN : None
+ ********************************************************************************/
+void ChangeStatusGpsCommon(u_int32 sts ) {
+ /* Set the transition destination state in the management information state */
+ g_gps_mngr.sts = sts;
+}
+
+/********************************************************************************
+ * MODULE : RtyResetGpsCommon
+ * ABSTRACT : Reset retry counter(Periodic reception)
+ * FUNCTION : Reset the retry counter
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ********************************************************************************/
+void RtyResetGpsCommon(void) {
+ g_gps_mngr.hrsetcnt = 0; /* Initialization of the number of tries until a hard reset */
+ g_gps_mngr.sndngcnt = 0; /* Initialization of the number of tries until serial reset */
+}
+
+/******************************************************************************
+@brief SendRtyResetGpsCommon<BR>
+ Reset retry counter(ACK response)
+@outline Reset the retry counter
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void SendRtyResetGpsCommon(void) {
+ g_gps_mngr.sndcnt = 0; /* Initialization of the number of transmission retries */
+}
+
+uint8_t HardResetChkGpsCommon(void) {
+ uint8_t ret = RETRY_OFF; /* Return value */
+ static uint8_t uc_hardreset_cnt = 0; /* Number of hard resets */
+
+ g_gps_mngr.hrsetcnt++; /* Add number of tries until hard reset */
+
+ if (g_gps_mngr.hrsetcnt >= HRSET_MAX) {
+ // Todo For test don't have hardReset Method.
+ // DEV_Gps_HardReset();
+
+ g_gps_mngr.hrsetcnt = 0; /* Initialization of the number of tries until a hard reset */
+ /* Discard all pending commands */
+ DeleteAllSaveCmdGpsCommon();
+ /* Determination of the number of hard reset executions */
+ uc_hardreset_cnt++;
+ if (uc_hardreset_cnt >= 3) {
+ ret = RETRY_OFF; /* Set the return value (No retry: Specified number of hard resets completed) */
+ uc_hardreset_cnt = 0; /* Clear the number of hard resets */
+ } else {
+ ret = RETRY_OUT; /* Set the return value (retry out: hardware reset) */
+ }
+ } else { /* When the number of tries until the hard reset is less than the maximum value */
+ ret = RETRY_ON; /* Set return value (with retry) */
+ }
+
+ return (ret); /* End of the process */
+}
+
+
+/******************************************************************************
+@brief SendReqGpsCommon<BR>
+ Common-Transmit Request Reception Matrix Function
+@outline Common processing when receiving a transmission request
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void SendReqGpsCommon(void) {
+ RET_API ret = RET_NORMAL;
+ TG_GPS_SND_DATA* p_rcv_data = NULL;
+ TG_GPS_SAVECMD s_send_data;
+ TG_GPS_OUTPUT_FORMAT s_output_format;
+
+ p_rcv_data = reinterpret_cast<TG_GPS_SND_DATA*>(&(g_gps_msg_rcvr.msgdat[0])); /* Incoming message structure */
+
+ /** Transmit Data Format Check */
+ ret = CheckSendCmdGpsCommon(p_rcv_data->ub_data, p_rcv_data->us_size, &s_output_format);
+
+ /** Normal format */
+ if (ret == RET_NORMAL) {
+ memset( &s_send_data, 0x00, sizeof(s_send_data) ); /* Ignore -> MISRA-C:2004 Rule 16.10 */
+
+ s_send_data.us_pno = 0; /* Result notification destination process number */
+ s_send_data.uc_rid = 0; /* Result Notification Resource ID */
+ s_send_data.uc_rst = GPS_CMD_NOTRST; /* Reset flag */
+ s_send_data.e_cmd_info = s_output_format; /* Command information */
+ memcpy( &s_send_data.sndcmd, p_rcv_data, sizeof(TG_GPS_SND_DATA) ); /* Sending commands */
+
+ /* Command is suspended and terminated. */
+ ret = DevGpsSaveCmd(&s_send_data); /* #GPF_60_040 */
+
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("GPS Command Reserve bufferFull ! \r\n");
+ }
+ } else {
+ POSITIONING_LOG("# GpsCommCtl # GPS Command Format Error!! \r\n");
+ }
+
+ return;
+}
+
+/******************************************************************************
+@brief GPSResetReqGpsCommon<BR>
+ Common-GPS reset request reception matrix function
+@outline Common processing at GPS reset reception
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void GPSResetReqGpsCommon(void) {
+ RET_API ret = RET_NORMAL;
+ POS_RESETINFO st_rcv_msg;
+
+ memset(&st_rcv_msg, 0x00, sizeof(st_rcv_msg)); /* 2015/03/31 Coverity CID: 21530 support */
+
+ if (g_gps_reset_cmd_sending == FALSE) {
+ memcpy(&st_rcv_msg, reinterpret_cast<POS_RESETINFO *>(&(g_gps_msg_rcvr.msgdat)),
+ sizeof(POS_RESETINFO));
+ ret = DevGpsResetReq(st_rcv_msg.respno, 0);
+ if (ret == RET_NORMAL) {
+ /* Set the reset command transmission judgment flag to transmission in progress */
+ g_gps_reset_cmd_sending = TRUE;
+ /* Send reset command(Normal response transmission)*/
+ GpsSetPosBaseEvent(st_rcv_msg.sndpno, POS_RET_NORMAL);
+ } else if (ret == RET_EV_NONE) {
+ /* nop */
+ } else {
+ /* Send reset command(Internal Processing Error Response Transmission)*/
+ GpsSetPosBaseEvent(st_rcv_msg.sndpno, POS_RET_ERROR_INNER);
+ }
+ } else {
+ memcpy(&st_rcv_msg, reinterpret_cast<POS_RESETINFO*>(&(g_gps_msg_rcvr.msgdat)), sizeof(POS_RESETINFO));
+ GpsSetPosBaseEvent(st_rcv_msg.sndpno, POS_RET_ERROR_BUSY);
+ }
+ return;
+}
+
+/******************************************************************************
+@brief CyclDataTimeOutGpsCommon<BR>
+ Common-Receive data monitoring timeout matrix function
+@outline Common processing at reception cycle data monitoring timeout
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void CyclDataTimeOutGpsCommon(void) {
+ g_wcnct_err++; /* Count number of connection errors */
+
+ /* Stop all timers */
+ DevGpsTimeStop(GPS_STARTUP_TIMER); /* Start confirmation monitoring timer */ /* Ignore -> MISRA-C:2004 Rule 16.10 */
+ DevGpsTimeStop(GPS_RECV_ACK_TIMER); /* ACK reception monitoring timer */ /* Ignore -> MISRA-C:2004 Rule 16.10 */
+
+ /* Clear cyclic receive data up to now */
+ DevGpsCycleDataClear();
+
+ /* Start confirmation monitoring timer setting */
+ DevGpsTimeSet(GPS_STARTUP_TIMER); /* Ignore -> MISRA-C:2004 Rule 16.10 */
+
+ /* State-transition(Start Confirmation Monitor) */
+ ChangeStatusGpsCommon(GPS_STS_STARTUP);
+
+ return;
+}
+
+/********************************************************************************
+ * MODULE : CheckFrontStringPartGpsCommon
+ * ABSTRACT : Message start character string determination processing
+ * FUNCTION : Check that the message starts with the specified string
+ * ARGUMENT : pubTarget : Message
+ * : pubStart : Character string
+ * NOTE : When target is equal to start, it is also judged to be TRUE.
+ * : "*" in the start is treated as a single-character wildcard.
+ * RETURN : RET_NORMAL : Decision success
+ * : RET_ERROR : Decision failure
+ ********************************************************************************/
+RET_API CheckFrontStringPartGpsCommon(const u_char *p_tartget, const u_char *p_start) {
+ RET_API ret = RET_ERROR;
+
+ while (((*p_tartget == *p_start)
+ || ('*' == *p_start)) /* #GPF_60_024 */ /* Ignore -> No applicable rules for MISRA-C */
+ && (*p_tartget != '\0')
+ && (*p_start != '\0')) {
+ p_tartget++; /* Ignore -> MISRA-C:2004 Rule 17.4 */
+ p_start++; /* Ignore -> MISRA-C:2004 Rule 17.4 */
+ }
+
+ if (*p_start == '\0') {
+ ret = RET_NORMAL;
+ } else {
+ ret = RET_ERROR;
+ }
+
+ return ret;
+}
+
+/******************************************************************************
+@brief JudgeFormatGpsCommon<BR>
+ Format determination processing
+@outline Determine the format of the received GPS data
+@param[in] pubSndData : Message to be judged
+@param[in] ul_length : Message length
+@param[out] peFormat : Where to Return the Format
+@input none
+@return int32
+@retval GPSRET_SNDCMD : Commands to be notified
+@retval GPSRET_NOPCMD : User unset command
+@retval GPSRET_CMDERR : No applicable command
+*******************************************************************************/
+int32 JudgeFormatGpsCommon(u_char *p_send_data, u_int32 ul_length, TG_GPS_OUTPUT_FORMAT *p_format) {
+ int32 ret = GPSRET_NOPCMD; /* Return value */
+ u_int32 cnt = 0; /* Ignore -> MISRA-C:2004 Rule 5.6 */
+
+ for (cnt = 0; cnt < (u_int32)GPSCMDANATBL_MAX; cnt++) {
+ /** End-of-table decision */
+ if (CheckFrontStringPartGpsCommon((const u_char*)ENDMARK, kGpsCmdAnaTbl[cnt].c_sentence) == RET_NORMAL) {
+ /** When there is no matching sentence, */
+ /** set return value. */
+ ret = GPSRET_NOPCMD; /* Ignore -> MISRA-C:2004 Rule 3.1 */
+ break;
+ }
+
+ /* ++ #GPF_60_040 */
+ /* Sentence determination of received command */
+
+ if (kGpsCmdAnaTbl[cnt].e_rcv_format == g_gps_mngr.rcv_cmd) {
+ /* Format set */
+ (*p_format) = g_gps_mngr.rcv_cmd;
+
+ /* Notification judgment */
+ if (kGpsCmdAnaTbl[cnt].b_snd_cmd_flg == TRUE) {
+ /* Checksum implementation */
+ if (CheckSumGpsCommon(reinterpret_cast<u_int8*>(p_send_data),
+ ul_length,
+ kGpsCmdAnaTbl[cnt].e_rcv_format) != RET_NORMAL) {
+ /* Receive data anomaly */
+ POSITIONING_LOG("# GpsCommCtl # GPS Data SUM ERROR! \r\n");
+
+ g_wrecv_err++;
+
+ /* Set data error in return value */
+ ret = GPSRET_CMDERR;
+ } else {
+ /* Notification to vehicle sensor */
+ ret = GPSRET_SNDCMD;
+ g_wrecv_err = 0;
+ }
+ }
+
+ break;
+ }
+ }
+
+ return ret;
+}
+
+
+/******************************************************************************
+@brief CheckSumGpsCommon<BR>
+ Checksum processing
+@outline Checking the integrity of GPS commands
+@param[in] none
+@param[out] none
+@input u_int8 : p_uc_data[] ... Receive data pointer
+@input u_int32 : ul_length ... Data length
+@input u_int32 : e_cmd_info ... Command information<BR>
+ -FORMAT_NMEA NMEA data<BR>
+ -FORMAT_BIN Standard binary<BR>
+ -FORMAT_FULLBIN FULL binaries
+@return RET_API
+@retval RET_NORMAL : Normal completion
+@retval RET_ERROR : ABENDs
+*******************************************************************************/
+RET_API CheckSumGpsCommon(const u_int8 p_uc_data[], u_int32 ul_length, TG_GPS_OUTPUT_FORMAT e_cmd_info) {
+ RET_API l_ret = RET_ERROR;
+ u_int32 i = 0;
+ u_int8 uc_char = 0;
+ u_int8 uc_sum = 0;
+ u_int8 uc_cmp = 0;
+ int32_t ret = 0;
+
+ static u_int8 uc_work[UBX_CMD_SIZE_MAX];
+
+ if ((GPS_FORMAT_MON_VER == e_cmd_info)
+ || (GPS_FORMAT_AID_INI == e_cmd_info)
+ || (GPS_FORMAT_ACK_ACKNACK == e_cmd_info)
+ || (GPS_FORMAT_NAV_TIMEUTC == e_cmd_info)
+ || (GPS_FORMAT_NAV_CLOCK == e_cmd_info)
+ || (GPS_FORMAT_RXM_RTC5 == e_cmd_info)
+ || (GPS_FORMAT_NAV_SVINFO == e_cmd_info)
+ || (GPS_FORMAT_CFG_NAVX5 == e_cmd_info)) {
+ (void)memcpy(uc_work, p_uc_data, ul_length - 2);
+ DevGpsSetChkSum(uc_work, ul_length);
+
+ ret = memcmp(uc_work, p_uc_data, ul_length);
+
+ if (ret == 0) {
+ l_ret = RET_NORMAL;
+ } else {
+ }
+ } else {
+ /** XOR each character between '$' and '*' */
+ for ( i = 1; i < ul_length; i++ ) {
+ if (p_uc_data[i] == (u_int8)'*') {
+ /** '*'Detection */
+ l_ret = RET_NORMAL; /* #GPF_60_111 */
+ break;
+ } else {
+ /** '*'Not detected */
+ uc_char = p_uc_data[i];
+ uc_sum ^= uc_char;
+ }
+ }
+
+ /** When the position of '*' is within two characters following '*' (access check of the receive buffer range) */
+ if ( (l_ret == RET_NORMAL) && ((GPS_READ_LEN - 2) > i) ) {
+ /** Convert two characters following '*' to two hexadecimal digits */
+ uc_cmp = (AtoHGpsCommon(p_uc_data[i + 1]) * 16) + AtoHGpsCommon(p_uc_data[i + 2]);
+
+ /** Checksum result determination */
+ if ( uc_cmp != uc_sum ) {
+ /** Abnormality */
+ l_ret = RET_ERROR;
+ }
+ } else {
+ /** '*' Not detected, data length invalid */
+ /** Abnormality */
+ l_ret = RET_ERROR;
+ }
+ }
+
+ return l_ret;
+}
+
+/******************************************************************************
+@brief AtoHGpsCommon<BR>
+ ASCII-> hexadecimal conversions
+@outline Convert ASCII codes to hexadecimal
+@param[in] none
+@param[out] none
+@input u_int8 : ascii ... ASCII code('0' ~ '9', 'a' ~ 'f', 'A' ~ 'F')
+@return u_int8
+@retval Hexadecimal number
+*******************************************************************************/
+u_int8 AtoHGpsCommon(u_int8 ascii) {
+ u_int8 hex = 0;
+ if ((ascii >= '0') && (ascii <= '9')) {
+ hex = ascii - '0';
+ } else if ((ascii >= 'a') && (ascii <= 'f')) {
+ hex = (ascii - 'a') + 0xa; /* Ignore -> MISRA-C:2004 Rule 12.1 */
+ } else if ( (ascii >= 'A') && (ascii <= 'F') ) {
+ hex = (ascii - 'A') + 0xa; /* Ignore -> MISRA-C:2004 Rule 12.1 */
+ } else {
+ /* nop */
+ }
+
+ return hex;
+}
+
+/******************************************************************************
+@brief DevGpsSaveCmd<BR>
+ Command pending processing
+@outline Temporarily save commands to be sent to GPS
+@param[in] TG_GPS_SND_DATA* pstSndMsg : Sending commands
+@param[out] none
+@return RET_API
+@retval RET_NORMAL : Normal completion
+@retval RET_ERROR : ABENDs(buffer full)
+*******************************************************************************/
+RET_API DevGpsSaveCmd(TG_GPS_SAVECMD *p_send_data) {
+ RET_API ret = RET_NORMAL;
+ u_int32 savp = 0; /* Holding buffer location storage */
+
+ /* Pending buffer full */
+ if ( g_gps_save_cmdr.bufsav >= SAV_MAX ) {
+ /* Return an abend */
+ ret = RET_ERROR;
+ } else {
+ savp = g_gps_save_cmdr.saveno; /* Get pending buffer position */
+
+ /* Copy data to pending buffer */
+ memset(&g_gps_save_cmdr.savebuf[savp], 0x00, sizeof(g_gps_save_cmdr.savebuf[savp]));
+ memcpy(&g_gps_save_cmdr.savebuf[savp], p_send_data, sizeof(TG_GPS_SAVECMD));
+
+ g_gps_save_cmdr.saveno++; /* Pending index addition */
+
+ if (g_gps_save_cmdr.saveno >= SAV_MAX) {
+ g_gps_save_cmdr.saveno = 0; /* Reset Pending Index */
+ }
+
+ g_gps_save_cmdr.bufsav++; /* Number of pending buffers added */
+ }
+
+ return ret;
+}
+
+/******************************************************************************
+@brief SendSaveCmdGpsCommon<BR>
+ Pending command transmission processing
+@outline Send Pending Commands to GPS
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void SendSaveCmdGpsCommon(void) {
+ u_int32 sndp = 0; /* Holding buffer location storage */
+ // TG_GPS_SND_DATA* p_send_data = NULL; /* Pointer to the pending command */
+ BOOL b_ret = FALSE; /* Command send return value */
+
+ /** Retrieves one pending command, if any, and sends it. */
+ if (g_gps_save_cmdr.bufsav != 0) {
+ /** Send position acquisition */
+ sndp = g_gps_save_cmdr.sendno;
+ // p_send_data = reinterpret_cast<TG_GPS_SND_DATA*>(&(g_gps_save_cmdr.savebuf[sndp]));
+
+ // todo For test No Uart
+ // b_ret = DEV_Gps_CmdWrite( p_send_data->us_size, &(p_send_data->uc_data[0]) );/* #GPF_60_106 */
+ if ( b_ret != TRUE ) {
+ POSITIONING_LOG("DEV_Gps_CmdWrite fail. ret=[%d]\n", b_ret);
+ // ucResult = SENSLOG_RES_FAIL;
+ }
+
+ /* ++ #GPF_60_040 */
+ /** Configure Monitored Commands */
+ g_gps_mngr.resp_cmd = g_gps_save_cmdr.savebuf[ sndp ].e_cmd_info;
+ g_gps_mngr.resp_pno = g_gps_save_cmdr.savebuf[ sndp ].us_pno;
+ g_gps_mngr.resp_rid = g_gps_save_cmdr.savebuf[ sndp ].uc_rid;
+ g_gps_mngr.resp_rst_flag = g_gps_save_cmdr.savebuf[ sndp ].uc_rst;
+
+ /** Perform response monitoring */
+ DevGpsTimeSet(GPS_RECV_ACK_TIMER); /* Ignore -> MISRA-C:2004 Rule 16.10 */
+ /* State transition processing(sending) */
+ ChangeStatusGpsCommon(GPS_STS_SENT);
+ } else {
+ /** No monitored commands */
+ g_gps_mngr.resp_cmd = GPS_FORMAT_MIN;
+ g_gps_mngr.resp_pno = 0x0000;
+ g_gps_mngr.resp_rid = 0x00;
+ g_gps_mngr.resp_rst_flag = GPS_CMD_NOTRST;
+ }
+
+ return;
+}
+
+/* ++ #GPF_60_040 */
+/******************************************************************************
+@brief DeleteSaveCmdGpsCommon<BR>
+ Pending command deletion processing
+@outline Deleting a Pending Command
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DeleteSaveCmdGpsCommon(void) {
+ u_int32 sndp = 0; /* Holding buffer location storage */
+
+ /** Delete one pending command, if any. */
+ if (g_gps_save_cmdr.bufsav != 0) {
+ /** Send position acquisition */
+ sndp = g_gps_save_cmdr.sendno;
+
+ /** Clear Stored Data */
+ memset(&g_gps_save_cmdr.savebuf[sndp], 0x00, sizeof(g_gps_save_cmdr.savebuf[sndp]));
+
+ /** Transmit index addition */
+ g_gps_save_cmdr.sendno++;
+ if ( g_gps_save_cmdr.sendno >= SAV_MAX ) {
+ /** Transmit index MAX or higher */
+ /** Initialize transmission index */
+ g_gps_save_cmdr.sendno = 0;
+ }
+
+ /** Subtract pending buffers */
+ g_gps_save_cmdr.bufsav--;
+ }
+
+ return;
+}
+
+/******************************************************************************
+@brief DeleteAllSaveCmdGpsCommon<BR>
+ Hold command abort processing
+@outline Discards all pending commands and returns a reset response
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DeleteAllSaveCmdGpsCommon(void) {
+ u_int32 sndp = 0; /* Holding buffer location storage */
+ PNO us_pno = 0; /* Ignore -> MISRA-C:2004 Rule 5.6 */
+ RID uc_rid = 0; /* Ignore -> MISRA-C:2004 Rule 5.6 */
+
+ while (g_gps_save_cmdr.bufsav != 0) {
+ /** Determine whether it is a pending command that requires a response. */
+ sndp = g_gps_save_cmdr.sendno;
+
+ if (g_gps_save_cmdr.savebuf[ sndp ].uc_rst == GPS_CMD_RESET) {
+ /** In the case of a reset request, a reset response (communication error) is notified. */
+ us_pno = g_gps_save_cmdr.savebuf[ sndp ].us_pno;
+ uc_rid = g_gps_save_cmdr.savebuf[ sndp ].uc_rid;
+ DevGpsRstAnsSend(us_pno, uc_rid, GPS_SENDNG); /* Ignore -> MISRA-C:2004 Rule 16.10 */
+ }
+
+ /** Delete */
+ DeleteSaveCmdGpsCommon();
+ }
+
+ return;
+}
+/******************************************************************************
+@brief RcvCyclCmdNmeaGpsCommon<BR>
+ Cyclic data (NMEA) notification process
+@outline Notifying VehicleSensor of Cyclic Data (NMEA) Reception
+@param[in] u_int8 : *p_uc_data ... Receive data pointer
+@param[in] u_int32 : ul_len ... Received data length
+@param[in] TG_GPS_OUTPUT_FORMAT : s_output_format ... Receive Format
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void RcvCyclCmdNmeaGpsCommon(u_int8 *p_uc_data, u_int32 ul_len, TG_GPS_OUTPUT_FORMAT s_output_format) {
+ NAVIINFO_ALL navilocinfo; /* Navigation information */
+ BOOL bcycle_rcv_flag = FALSE; /* Cyclic reception judgment result */
+
+ if (JudgeFormatOrderGpsCommon(s_output_format, g_rcv_format) == 0) {
+ /** If a sentence is received before the last received sentence, */
+ /** determine as the beginning of cyclic data. */
+ bcycle_rcv_flag = TRUE;
+ }
+
+ if (bcycle_rcv_flag == TRUE) {
+ DevGpsSndCycleDataNmea();
+
+ /* Reset navigation information */
+ memset(&navilocinfo, 0x00, sizeof(NAVIINFO_ALL));
+
+ /* NMEA data analysis */
+ DevGpsAnalyzeNmea(&navilocinfo);
+
+ /** Clear Buffer */
+ // DevGpsCycleDataClear();
+ }
+
+ DevGpsCycleDataSetNmea(p_uc_data, (u_int32)ul_len, GetNmeaIdxGpsCommon(s_output_format));
+
+ /** Update receive format */
+ g_rcv_format = s_output_format;
+
+ return;
+}
+
+
+/**
+ * @brief
+ * Cyclic data (UBX) notification processing
+ *
+ * Notify vehicle sensor of reception of cyclic data (UBX)
+ *
+ * @param[in] u_int8 : *p_uc_data ... Receive data pointer
+ * @param[in] u_int32 : ul_len ... Received data length
+ * @param[in] TG_GPS_OUTPUT_FORMAT : eFormat ... Receive Format
+ */
+void RcvCyclCmdExtGpsCommon(u_int8 *p_uc_data, u_int32 ul_len, TG_GPS_OUTPUT_FORMAT e_format) {
+ SENSOR_GPSTIME_RAW st_gpstime_raw;
+ TG_GPS_UBX_NAV_TIMEUTC_DATA *pst_navtime_utc;
+ BOOL b_validtow; /* Valid Time of Week */
+ BOOL b_validwkn; /* Valid Week of Number */
+ BOOL b_validutc; /* Valid UTC Time */
+
+ /* For NAV-TIMEUTC */
+ if (e_format == GPS_FORMAT_NAV_TIMEUTC) {
+ memset(&st_gpstime_raw, 0x00, sizeof(st_gpstime_raw));
+
+ /* NAV-TIMEUTC analysis */
+ pst_navtime_utc = reinterpret_cast<TG_GPS_UBX_NAV_TIMEUTC_DATA*>(p_uc_data + UBX_CMD_OFFSET_PAYLOAD);
+
+ st_gpstime_raw.utc.year = pst_navtime_utc->year;
+ st_gpstime_raw.utc.month = pst_navtime_utc->month;
+ st_gpstime_raw.utc.date = pst_navtime_utc->day;
+ st_gpstime_raw.utc.hour = pst_navtime_utc->hour;
+ st_gpstime_raw.utc.minute = pst_navtime_utc->min;
+ st_gpstime_raw.utc.second = pst_navtime_utc->sec;
+ b_validtow = (BOOL)(((pst_navtime_utc->valid) & UBX_CMD_MSK_NAV_TIMEUTC_VALID_TOW)
+ >> (uint8_t)(UBX_CMD_MSK_NAV_TIMEUTC_VALID_TOW / 2));
+ b_validwkn = (BOOL)(((pst_navtime_utc->valid) & UBX_CMD_MSK_NAV_TIMEUTC_VALID_WKN)
+ >> (uint8_t)(UBX_CMD_MSK_NAV_TIMEUTC_VALID_WKN / 2));
+ b_validutc = (BOOL)(((pst_navtime_utc->valid) & UBX_CMD_MSK_NAV_TIMEUTC_VALID_UTC)
+ >> (uint8_t)(UBX_CMD_MSK_NAV_TIMEUTC_VALID_UTC / 2));
+
+ if ((b_validtow == TRUE) && (b_validwkn == TRUE)) {
+ st_gpstime_raw.tdsts = 2; /* Calibrated */
+ g_gpstime_raw_tdsts = 2;
+ } else {
+ st_gpstime_raw.tdsts = 0; /* Uncalibrated */
+ g_gpstime_raw_tdsts = 0;
+ }
+
+ b_validutc = b_validutc;
+ POSITIONING_LOG("year=%04d, month=%02d, date=%02d, hour=%02d, minute=%02d,"
+ " second=%02d, validTow=%d, validWkn=%d, validUtc=%d",
+ st_gpstime_raw.utc.year, st_gpstime_raw.utc.month, st_gpstime_raw.utc.date,
+ st_gpstime_raw.utc.hour, st_gpstime_raw.utc.minute, st_gpstime_raw.utc.second,
+ b_validtow, b_validwkn, b_validutc);
+ /* Notify GPS time to vehicle sensor */
+ SndGpsTimeRaw((const SENSOR_GPSTIME_RAW*)&st_gpstime_raw);
+ } else {
+ POSITIONING_LOG("Forbidden ERROR!![e_format=%d]", e_format);
+ }
+
+ /** Update Receive Format */
+ g_rcv_format = e_format;
+
+ return;
+}
+
+/******************************************************************************
+@brief CheckSendCmdGpsCommon<BR>
+ Send command check processing
+@outline Check the format of the send command
+@param[in] const u_char* pubRcvData : Receive command
+@param[in] u_int32 ul_length : Length of the command
+@param[out] TG_GPS_OUTPUT_FORMAT* peFormat : Command format information
+@return int32
+@retval RET_NORMAL : Normal
+@retval RET_ERROR : Abnormality
+*******************************************************************************/
+int32 CheckSendCmdGpsCommon(const u_char *p_rcv_data, u_int32 ul_length, TG_GPS_OUTPUT_FORMAT *p_format) {
+ u_int32 ret = RET_NORMAL;
+ u_int32 cnt = 0; /* Ignore -> MISRA-C:2004 Rule 5.6 */
+
+ /** Analysis of received commands */
+ for (cnt = 0; cnt < (u_int32)GPSCMDANATBL_MAX; cnt++) {
+ /** End-of-table decision */
+ if (CheckFrontStringPartGpsCommon((const u_char*)ENDMARK, kGpsCmdAnaTbl[cnt].c_sentence) == RET_NORMAL) {
+ /** When there is no matching sentence */
+
+ /** Return value setting */
+ ret = RET_ERROR; /* Ignore -> MISRA-C:2004 Rule 3.1 */
+ break;
+ }
+
+ /** Sentence determination of received command */
+ if (CheckFrontStringPartGpsCommon(p_rcv_data, kGpsCmdAnaTbl[cnt].c_sentence) == RET_NORMAL) {
+ if (ul_length == kGpsCmdAnaTbl[cnt].ul_length) {
+ /** When the sentences match */
+
+ /** Reception type determination */
+ if ( kGpsCmdAnaTbl[cnt].ul_rcv_kind == RCV_RESP ) {
+ /** Response monitor format setting */
+ *p_format = kGpsCmdAnaTbl[cnt].e_rcv_format;
+ } else {
+ /** Return value setting */
+ ret = RET_ERROR; /* Ignore -> MISRA-C:2004 Rule 3.1 */
+ }
+
+ break; /* Ignore -> MISRA-C:2004 Rule 14.6 */
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+/**
+ * @brief
+ * Get a string of fields from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_dst Pointer to the output area
+ * @param[in] size Maximum output size
+ *
+ * @return Size
+ */
+int32_t GetStringFromNmeaGpsCommon(u_int8 field_number, u_int8* p_src, char* p_dst, size_t size ) {
+ uint8_t* ptr = NULL;
+ /* int32_t numeric; */
+ uint32_t i = 0;
+ int32_t cnt = 0;
+ int8_t buf[GPS_NMEA_FIELD_LEN_MAX] = {0};
+
+ /* Null check */
+ if ((p_src == NULL) || (p_dst == NULL)) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p, p_dst=%p]", p_src, p_dst);
+ return 0;
+ }
+
+ ptr = p_src;
+
+ for (i = 0; i <= GPS_NMEA_MAX_SZ; i++) {
+ if (cnt == field_number) {
+ break;
+ }
+
+ if (*ptr == NMEA_DATA_SEPARATOR) {
+ cnt++;
+ }
+
+ ptr++;
+ }
+
+ i = 0;
+ if (*ptr != NMEA_DATA_SEPARATOR) {
+ for (i = 0; i < (GPS_NMEA_FIELD_LEN_MAX - 1); i++) {
+ buf[i] = *ptr;
+ ptr++;
+
+ if ((*ptr == NMEA_DATA_SEPARATOR) || (*ptr == NMEA_CHECKSUM_CHAR)) {
+ i++;
+ break;
+ }
+ }
+ }
+
+ buf[i] = '\0';
+ strncpy(p_dst, (const char *)buf, size);
+
+ return i;
+}
+
+/**
+ * @brief
+ * Get the number (real type) of a field from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_valid Validity of numerical data
+ *
+ * @return Real-number - double
+ */
+double_t GetNumericFromNmeaGpsCommon(u_int8 field_number, u_int8* p_src, BOOL* p_valid) {
+ double_t numeric = 0;
+ char buf[GPS_NMEA_FIELD_LEN_MAX] = {0};
+ int32_t ret = 0;
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ ret = GetStringFromNmeaGpsCommon(field_number, p_src, buf, GPS_NMEA_FIELD_LEN_MAX);
+
+ if (ret > 0) {
+ numeric = atof((const char *)buf);
+ *p_valid = TRUE;
+ } else {
+ *p_valid = FALSE;
+ }
+
+ return numeric;
+}
+
+/**
+ * @brief
+ * Get the integer value (integer type) of a field from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ *
+ * @return Integer - int32
+ */
+int32 GetIntegerFromNmeaGpsCommon(u_int8 field_number, u_int8* p_src) {
+ int32_t integer = 0;
+ char buf[GPS_NMEA_FIELD_LEN_MAX] = {0};
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ GetStringFromNmeaGpsCommon(field_number, p_src, buf, GPS_NMEA_FIELD_LEN_MAX);
+ integer = atoi((const char *)buf);
+
+ return integer;
+}
+
+/**
+ * @brief
+ * Get the latitude/longitude of the given fi eld from the NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_valid Validity of the data
+ *
+ * @return Latitude and longitude [1/256 sec]
+ */
+int32_t GetLonLatFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid) {
+ int32_t result = 0;
+ double_t value = 0.0;
+ int32_t deg = 0;
+ double_t min = 0.0;
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ value = GetNumericFromNmeaGpsCommon(field_number, p_src, p_valid);
+
+ if ((value < 0.0) || (value > 0.0)) {
+ deg = (int32_t)(value / 100.0f);
+ min = (double_t)(value - (deg * 100.0f));
+ result = (int32_t)(((60.0f * 60.0f * 256.0f) * deg) + ((60.0f * 256.0f) * min));
+ }
+
+ return result;
+}
+
+/**
+ * @brief
+ * Get the orientation of any fields from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_valid Validity of the data
+ *
+ * @return Orientation[0.01 degree]
+ */
+u_int16 GetHeadingFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid) {
+ u_int16 result = 0;
+ double_t value = 0.0;
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ value = GetNumericFromNmeaGpsCommon(field_number, p_src, p_valid);
+
+ result = (u_int16)((value + 0.005f) * 100.0f);
+
+ return result;
+}
+
+
+/**
+ * @brief
+ * Get the orientation of any fields from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_valid Validity of the data
+ *
+ * @return speed[0.01m/s]
+ */
+u_int16 GetSpeedFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid) {
+ u_int16 result = 0;
+ double_t value = 0.0;
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ value = GetNumericFromNmeaGpsCommon(field_number, p_src, p_valid);
+
+ // speed[0.01m/s]
+ result = static_cast<u_int16>(value * 1.852 * 100 / 3.6);
+
+ return result;
+}
+
+/**
+ * @brief
+ * Get the altitude of certain fields from a NMEA sentence
+ *
+ * Operation is not guaranteed if a pointer other than a pointer to the NMEA sentence is specified.
+ *
+ * @param[in] field_number Field No.
+ * @param[in] p_src Pointers to NMEA sentences
+ * @param[out] p_valid Validity of the data
+ *
+ * @return Altitude [0.01m]
+ */
+int32 GetAltitudeFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid) {
+ int32 result = 0;
+ double_t value = 0.0;
+
+ /* Null check */
+ if (p_src == NULL) {
+ POSITIONING_LOG("Argument ERROR [p_src=%p]", p_src);
+ }
+
+ value = GetNumericFromNmeaGpsCommon(field_number, p_src, p_valid);
+
+ result = static_cast<int32>((value + 0.005f) * 100.0f);
+
+ return result;
+}
+
+/**
+ * @brief
+ * GPS Control Thread Stop Processing
+ */
+void StopThreadGpsCommon(void) {
+ /** Stop the start confirmation monitoring timer */
+ (void)DevGpsTimeStop(GPS_STARTUP_TIMER); /* Start confirmation monitoring timer */
+
+ /** Stop the periodic reception data monitoring timer */
+ (void)DevGpsTimeStop(GPS_CYCL_TIMER); /* Periodic reception data monitoring timer */
+
+ /** Stop the ACK reception monitoring timer */
+ (void)DevGpsTimeStop(GPS_RECV_ACK_TIMER); /* ACK reception monitoring timer */
+
+ /** Stop the Navigation Providing Monitor Timer */
+ (void)DevGpsTimeStop(GPS_NAVIFST_TIMER); /* Initial Navigation Monitoring Timer */
+
+ /** Stop the Navigation Providing Monitor Timer */
+ (void)DevGpsTimeStop(GPS_NAVICYCLE_TIMER); /* Navi monitoring timer */
+
+ /** Stop the Navigation Providing Monitor Timer */
+ (void)DevGpsTimeStop(GPS_NAVIDISRPT_TIMER); /* Navigation Monitoring Disruption Log Output Timer */
+
+ /** Stop Time Offering Monitor Timer */
+ /* (void)DevGpsTimeStop(GPS_DIAGCLK_GUARDTIMER); */ /* Time Offering Monitoring Timer */
+
+ PosTeardownThread(ETID_POS_GPS);
+
+ /* don't arrive here */
+ return;
+}
+
+/**
+ * @brief
+ * GPS format order determination process
+ *
+ * @param[in] s_format_1 GPS format1
+ * @param[in] s_format_2 GPS format2
+ * @return 0 Format 1 first<br>
+ * 1 Format 2 first<br>
+ * 2 Same as<br>
+ * 3 Unable to determine
+ */
+uint8_t JudgeFormatOrderGpsCommon(TG_GPS_OUTPUT_FORMAT s_format_1, TG_GPS_OUTPUT_FORMAT s_format_2) {
+ uint8_t ret = 3;
+ u_int32 cnt = 0;
+
+ if (s_format_1 == s_format_2) {
+ ret = 2;
+ } else if ((s_format_1 == GPS_FORMAT_MAX) || (s_format_2 == GPS_FORMAT_MIN)) {
+ ret = 1;
+ } else {
+ for (cnt = 0; cnt < static_cast<u_int32>(GPSCMDANATBL_MAX); cnt++) {
+ /** End-of-table decision */
+ if (CheckFrontStringPartGpsCommon((const u_char*)ENDMARK, kGpsCmdAnaTbl[cnt].c_sentence) == RET_NORMAL) {
+ /** There is no matching sentence */
+ ret = 3;
+ break;
+ }
+
+ if (kGpsCmdAnaTbl[cnt].e_rcv_format == s_format_1) {
+ ret = 0;
+ break;
+ } else if (kGpsCmdAnaTbl[cnt].e_rcv_format == s_format_2) {
+ ret = 1;
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Get NMEA index process
+ *
+ * @param[in] iFmt GPS formats
+ * @return NMEA indexes
+ */
+ENUM_GPS_NMEA_INDEX GetNmeaIdxGpsCommon(TG_GPS_OUTPUT_FORMAT s_output_format) {
+ ENUM_GPS_NMEA_INDEX ret = GPS_NMEA_INDEX_MAX;
+
+ switch (s_output_format) {
+ case GPS_FORMAT_GGA:
+ /* GGA */
+ ret = GPS_NMEA_INDEX_GGA;
+ break;
+ case GPS_FORMAT_DGGA:
+ /* DGGA */
+ ret = GPS_NMEA_INDEX_DGGA;
+ break;
+ case GPS_FORMAT_VTG:
+ /* VTG */
+ ret = GPS_NMEA_INDEX_VTG;
+ break;
+ case GPS_FORMAT_RMC:
+ /* RMC */
+ ret = GPS_NMEA_INDEX_RMC;
+ break;
+ case GPS_FORMAT_DRMC:
+ /* DRMC */
+ ret = GPS_NMEA_INDEX_DRMC;
+ break;
+ case GPS_FORMAT_GLL:
+ /* GLL */
+ ret = GPS_NMEA_INDEX_GLL;
+ break;
+ case GPS_FORMAT_DGLL:
+ /* DGLL */
+ ret = GPS_NMEA_INDEX_DGLL;
+ break;
+ case GPS_FORMAT_GSA:
+ /* GSA */
+ ret = GPS_NMEA_INDEX_GSA;
+ break;
+ case GPS_FORMAT_GSV1:
+ /* GSV(1) */
+ ret = GPS_NMEA_INDEX_GSV1;
+ break;
+ case GPS_FORMAT_GSV2:
+ /* GSV(2) */
+ ret = GPS_NMEA_INDEX_GSV2;
+ break;
+ case GPS_FORMAT_GSV3:
+ /* GSV(3) */
+ ret = GPS_NMEA_INDEX_GSV3;
+ break;
+ case GPS_FORMAT_GSV4:
+ /* GSV(4) */
+ ret = GPS_NMEA_INDEX_GSV4;
+ break;
+ case GPS_FORMAT_GSV5:
+ /* GSV(5) */
+ ret = GPS_NMEA_INDEX_GSV5;
+ break;
+ case GPS_FORMAT_GST:
+ /* GST */
+ ret = GPS_NMEA_INDEX_GST;
+ break;
+ case GPS_FORMAT__CWORD44__GP3:
+ /* _CWORD44_,GP,3 */
+ ret = GPS_NMEA_INDEX__CWORD44__GP_3;
+ break;
+ case GPS_FORMAT__CWORD44__GP4:
+ /* _CWORD44_,GP,4 */
+ ret = GPS_NMEA_INDEX__CWORD44__GP_4;
+ break;
+ case GPS_FORMAT_P_CWORD82_F_GP0:
+ /* P_CWORD82_F,GP,0 */
+ ret = GPS_NMEA_INDEX_P_CWORD82_F_GP_0;
+ break;
+ case GPS_FORMAT_P_CWORD82_J_GP1:
+ /* P_CWORD82_J,GP,1 */
+ ret = GPS_NMEA_INDEX_P_CWORD82_J_GP_1;
+ break;
+ default:
+ /* nop */
+ break;
+ }
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS reset request command transmission processing
+ */
+void SendResetReqGpsCommon(void) {
+ T_APIMSG_MSGBUF_HEADER s_msg_header; /* Message header */
+ POS_RESETINFO s_send_msg; /* Reset information */
+ u_int8 uc_send_buf[(sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(POS_RESETINFO))]; /* Transmitting buffer */
+ RET_API ret = RET_NORMAL;
+
+ /* Send reset request */
+ POSITIONING_LOG("GPS Reset Request");
+
+ /* <<Creation of message header section>>>> */
+ s_msg_header.signo = 0; /* Signal information setting */
+ s_msg_header.hdr.sndpno = PNO_NAVI_GPS_MAIN; /* Source thread No. setting */
+ s_msg_header.hdr.respno = PNO_NAVI_GPS_MAIN; /* Destination process No. */
+ s_msg_header.hdr.cid = CID_GPS_REQRESET; /* Command ID setting */
+ s_msg_header.hdr.msgbodysize = sizeof(POS_RESETINFO); /* Message data length setting */
+ s_msg_header.hdr.rid = 0; /* Resource ID Setting */
+ s_msg_header.hdr.reserve = 0; /* Reserved area clear */
+
+ (void)memcpy(&uc_send_buf[ 0 ], &s_msg_header, sizeof(T_APIMSG_MSGBUF_HEADER));
+
+ /* <<Creation of data section>> */
+ s_send_msg.mode = GPS_RST_COLDSTART; /* Reset mode */
+ s_send_msg.sndpno = PNO_NAVI_GPS_MAIN; /* Caller PNo. */
+ s_send_msg.respno = PNO_NAVI_GPS_MAIN; /* Destination PNo. */
+ s_send_msg.reserve[0] = 0;
+ s_send_msg.reserve[1] = 0;
+ s_send_msg.reserve[2] = 0;
+
+ /* Copy data to send buffer */
+ (void)memcpy( &uc_send_buf[ sizeof( T_APIMSG_MSGBUF_HEADER ) ], &s_send_msg, sizeof(POS_RESETINFO) );
+
+ /* <<Messaging>> */
+ ret = _pb_SndMsg(PNO_NAVI_GPS_MAIN, sizeof(uc_send_buf), reinterpret_cast<void *>(uc_send_buf), 0);
+
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("GPS Reset Request Error[ret = %d]", ret);
+ }
+}
+
+
+
+void DevGpsCommSettingTime(void) {
+ TG_GPS_SND_DATA *pst_rcv_data;
+ RET_API ret = RET_NORMAL;
+
+ pst_rcv_data = reinterpret_cast<TG_GPS_SND_DATA*>(&(g_gps_msg_rcvr.msgdat[0]));
+
+ ret = DevGpsResetReq(PNO_NONE, 0);
+ if (RET_NORMAL != ret) {
+ POSITIONING_LOG("DevGpsResetReq failed.");
+ } else {
+ /* Time setting(u-blox) */
+ DevGpsSettingTime(reinterpret_cast<POS_DATETIME *>(pst_rcv_data->ub_data));
+ }
+ return;
+}
+
+void DevGpsReadGpsTime(POS_DATETIME* pst_datetime) {
+ int32_t ret;
+ ST_GPS_SET_TIME buf;
+ POS_DATETIME st_datetime;
+ memset(&st_datetime, 0, sizeof(st_datetime));
+
+ // if (isGpsTimeStatusProof == TRUE) {
+ /* Clear the flag if the date and time status has already been calibrated. */
+ // WriteGpsTimeToBackup(FALSE, &st_datetime);
+ // POSITIONING_LOG("D_BK_ID_POS_GPS_TIME_SET_INFO:W:Clear");
+ // } else {
+ /* Read from backup RAM */
+ ret = Backup_DataRd(D_BK_ID_POS_GPS_TIME_SET_INFO, 0, &buf, sizeof(ST_GPS_SET_TIME));
+ if (ret == BKUP_RET_NORMAL) {
+ pst_datetime->year = buf.year;
+ pst_datetime->month = buf.month;
+ pst_datetime->date = buf.date;
+ pst_datetime->hour = buf.hour;
+ pst_datetime->minute = buf.minute;
+ pst_datetime->second = buf.second;
+
+ /* Update of the date/time status fixed value setting indication flag */
+ if (buf.flag == TRUE) {
+ g_is_gpstime_sts = TRUE;
+ POSITIONING_LOG("g_is_gpstime_sts = TRUE");
+ POSITIONING_LOG("%d/%d/%d %d:%d:%d", buf.year,
+ buf.month,
+ buf.date,
+ buf.hour,
+ buf.minute,
+ buf.second);
+ } else {
+ g_is_gpstime_sts = FALSE;
+ POSITIONING_LOG("g_is_gpstime_sts = FALSE");
+ }
+ } else {
+ POSITIONING_LOG("Backup_DataRd ERROR!! [ret=%d]", ret);
+ }
+ // }
+ return;
+}
+
+RET_API GpsSetPosBaseEvent(uint16_t ul_snd_pno, int32_t event_val) {
+ RET_API ret = RET_ERROR; /* Return value */
+ EventID ul_eventid = 0; /* Event ID */
+ char event_name[32]; /* Event name character string buffer */
+
+ memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name));
+ snprintf(event_name, sizeof(event_name), "VEHICLE_%X", ul_snd_pno);
+ /* Event Generation */
+ ul_eventid = _pb_CreateEvent(FALSE, 0, event_name);
+
+ // initialize EventID
+ if (0 != ul_eventid) {
+ ret = _pb_SetEvent(ul_eventid, SAPI_EVSET_ABSOLUTE, VEHICLE_EVENT_VAL_INIT);
+ if (RET_NORMAL != ret) {
+ /* Delete event and return event generation failed */
+ ret = _pb_DeleteEvent(ul_eventid);
+ ul_eventid = 0;
+ }
+ }
+
+ if (0 != ul_eventid) {
+ /* Event publishing(Event wait release) */
+ ret = _pb_SetEvent(ul_eventid, SAPI_EVSET_ABSOLUTE, event_val);
+ if (RET_NORMAL != ret) {
+ /* Event issuance failure */
+ POSITIONING_LOG("set Event failed.");
+ }
+ /* Event deletion */
+ _pb_DeleteEvent(ul_eventid);
+ } else {
+ /* Event generation failure */
+ POSITIONING_LOG("create Event failed.");
+ }
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS reset response command reception processing
+ *
+ * @param[in] p_data Pointer to the received GPS command
+ */
+BOOL DevGpsRcvProcGpsResetResp(TG_GPS_RCV_DATA* p_data) {
+ RET_API ret;
+ u_int32 ul_reset_sts = GPS_SENDNG;
+ BOOL b_snd_flag = TRUE;
+ uint8_t *p_gps_data;
+ char date[6]; /* ddmmyy */
+ char work[8]; /* Work buffer for converting String data */
+
+ if (p_data == NULL) {
+ POSITIONING_LOG("Argument ERROR!! [p_data = %p]", p_data);
+ } else {
+ p_gps_data = p_data->bygps_data;
+
+ /* Checksum determination */
+ ret = CheckSumGpsCommon(p_gps_data, p_data->bydata_len, GPS_FORMAT_RMC);
+ if (ret == RET_NORMAL) {
+ /* Get Date information */
+ GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_DATE, p_gps_data, date, 6);
+
+ strncpy(work, &date[4], 2);
+
+ if (atoi(work) == 0) {
+ ul_reset_sts = GPS_SENDOK; /* Reset Successful */
+ /* Reissuing commands to a GPS device from here */
+ /* Send NAV-TIMEUTC sentence addition requests */
+ DevGpsNavTimeUTCAddReq();
+ }
+ POSITIONING_LOG("reset flag = %d, year after reset = %s", ul_reset_sts, work);
+ } else {
+ b_snd_flag = FALSE; /* If the checksum is NG, wait for the next reply message without sending a callback. */
+ POSITIONING_LOG("wrong checksum [ret = %d]", ret);
+ }
+
+ if (b_snd_flag == TRUE) {
+ /** Drop the time status to an abnormal time */
+ // Todo Suntec MACRO __CWORD71_ Disable, This Functions do nothing actrually.
+ // DEV_Gps_SetTimeStatus_NG();
+
+ /** Send Reset Response(Successful transmission) */
+ DevGpsRstAnsSend(g_gps_mngr.resp_pno, g_gps_mngr.resp_rid, ul_reset_sts);
+
+ POSITIONING_LOG("DEV_Gps_RstAndSend CALL!! [ul_reset_sts = %d]", ul_reset_sts);
+
+ /** Clear reset command sending judgment flag */
+ g_gps_reset_cmd_sending = FALSE;
+ }
+ }
+ return b_snd_flag;
+}
+
+/**
+ * @brief
+ * GPS time setting response command reception processing
+ *
+ * @param[in] p_data Pointer to the received GPS command
+ */
+void DevGpsRcvProcTimeSetResp(TG_GPS_RCV_DATA* p_data) {
+ u_int32 ul_reset_sts = GPS_SENDNG;
+ BOOL b_snd_flag = TRUE;
+ POS_DATETIME st_datetime; /* Setting time */
+ uint16_t set_gpsw;
+ uint32_t set_gpsws;
+ uint16_t rcv_gpsw;
+ uint32_t rcv_gpsws;
+ BOOL ret = FALSE;
+ int32_t status;
+
+ if (p_data == NULL) {
+ POSITIONING_LOG("Argument ERROR!! [p_data = %p]", p_data);
+ } else {
+ /* Read from backup RAM */
+ status = Backup_DataRd(D_BK_ID_POS_GPS_TIME_SET_INFO, 0, &st_datetime, sizeof(ST_GPS_SET_TIME));
+ if (status == BKUP_RET_NORMAL) {
+ /* Convert to GSP week number, GPS week second */
+ DevGpsYMD2GPSTIME(static_cast<int32>(st_datetime.year),
+ static_cast<int32>(st_datetime.month),
+ static_cast<int32>(st_datetime.date), static_cast<int32>(st_datetime.hour),
+ static_cast<int32>(st_datetime.minute),
+ static_cast<int32>(st_datetime.second), &set_gpsw, &set_gpsws);
+
+ memcpy(&rcv_gpsw, &(p_data->bygps_data[24]), sizeof(uint16_t));
+ memcpy(&rcv_gpsws, &(p_data->bygps_data[26]), sizeof(uint32_t));
+ rcv_gpsws /= 1000; /* Convert week (ms) to week (s) */
+ POSITIONING_LOG("recived gpsw[%d] gpsws[%d]\n", rcv_gpsw, rcv_gpsws);
+
+ /* Check if GPS week number and GPS week second are within valid range */
+ ret = DevGpsCheckGpsTime(set_gpsw, set_gpsws, rcv_gpsw, rcv_gpsws, GPS_SETTIME_RANGE);
+ if (ret == TRUE) {
+ /* Date/Time Status Fixed Value Setting Indication Flag ON */
+ g_is_gpstime_sts = TRUE;
+ POSITIONING_LOG("g_is_gpstime_sts = TRUE");
+
+ /* Time Setting Successful : Update backup RAM time */
+ ul_reset_sts = GPS_SENDOK;
+ WriteGpsTimeToBackup(TRUE, &st_datetime);
+ POSITIONING_LOG("SetGpsTime Success");
+ POSITIONING_LOG("D_BK_ID_POS_GPS_TIME_SET_INFO:W:%d/%d/%d %d:%d:%d",
+ st_datetime.year,
+ st_datetime.month,
+ st_datetime.date,
+ st_datetime.hour,
+ st_datetime.minute,
+ st_datetime.second);
+ } else {
+ /* Time setting error (Difference in set time): Time deletion of backup RAM */
+ memset(&st_datetime, 0, sizeof(st_datetime));
+ WriteGpsTimeToBackup(FALSE, &st_datetime);
+ POSITIONING_LOG("SetGpsTime failed\n");
+ POSITIONING_LOG("D_BK_ID_POS_GPS_TIME_SET_INFO:W:Clear\n");
+ }
+ } else {
+ /* Backup RAM read failed */
+ b_snd_flag = FALSE;
+ POSITIONING_LOG("Backup_DataRd ERROR!! [status=%d", status);
+ }
+
+ if (b_snd_flag == TRUE) {
+ /** Send Time Set Response */
+ DevGpsTimesetAnsSend(g_gps_mngr.resp_pno, g_gps_mngr.resp_rid, ul_reset_sts);
+
+ POSITIONING_LOG("DEV_Gps_TimesetAndSend CALL!! [ul_reset_sts = %d]", ul_reset_sts);
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+ * GPS rollover standard week number acquisition response reception processing
+ *
+ * @param[in] p_data Pointer to the received GPS command
+ */
+void DevGpsRcvProcWknRolloverGetResp(TG_GPS_RCV_DATA* p_data) {
+ RET_API ret;
+ SENSOR_WKN_ROLLOVER_HAL st_wkn_rollover;
+
+ if (p_data == NULL) {
+ POSITIONING_LOG("Argument ERROR!! [p_data = %p]", p_data);
+ } else {
+ /* Checksum determination */
+ ret = CheckSumGpsCommon(p_data->bygps_data, p_data->bydata_len, GPS_FORMAT_CFG_NAVX5);
+ if (ret == RET_NORMAL) {
+ /* Version information extraction */
+ (void)memcpy(&(st_wkn_rollover.us_wkn),
+ &(p_data->bygps_data[UBX_CMD_OFFSET_PAYLOAD + UBX_CMD_OFFSET_WKNROLLOVER]),
+ sizeof(st_wkn_rollover.us_wkn));
+ POSITIONING_LOG("wknRollover=%d", st_wkn_rollover.us_wkn);
+
+ // gwknRollover = st_wkn_rollover.us_wkn;
+
+ /* Send reference week number to vehicle sensor */
+ ret = DevGpsSndWknRollover(&st_wkn_rollover);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("VehicleUtility_pb_SndMsg ERROR!! [ret=%d]", ret);
+ }
+ } else {
+ POSITIONING_LOG("CheckSumGpsCommon ERROR!! [ret = %d]", ret);
+ }
+
+ if (ret != RET_NORMAL) {
+ /* GPS rollover standard week number acquisition request retransmission */
+ ret = DevGpsWknRolloverGetReq();
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("DevGpsWknRolloverGetReq ERROR!! [ret=%d]", ret);
+ }
+ }
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Receiving additional responses to NAV-SVINFO commands
+ *
+ * @param[in] p_data Pointer to the received GPS command
+ */
+void DevGpsRcvProcNavSvinfoAddResp(TG_GPS_RCV_DATA* p_data) {
+ RET_API ret;
+ /* Common Response Command Reception Processing */
+ ret = DevGpsRcvProcCmnResp(p_data, GPS_CMD_SENTENCEADD_NAVSVINFO);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("DEV_Gps_RcvProcCmnResp(ADD_NAVSVINFO) ERROR!!");
+ /* Retransmission of requests to add NAV-SVINFO commands */
+ (void)DevGpsNavTimeUTCAddReq();
+ }
+ return;
+}
+
+
+/**
+ * @brief
+ * Common processing when a GPS receiver error is detected
+ */
+void GpsReceiverErrGpsCommon(void) {
+ BOOL *pb_rcv_err = &(g_gps_mngr.rcv_err_flag); /* GSP receiver error detection status */
+
+ /* Update GPS receiver anomaly detection flag */
+ *pb_rcv_err = TRUE;
+
+ DevSendGpsConnectError(TRUE);
+
+ return;
+}
+
+
+/**
+ * @brief
+ * GPS device setting response reception processing
+ *
+ * @param[in] p_data Pointer to the received GPS command
+ * @param[in] cmd Command in the configuration request
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR ABENDs
+ */
+RET_API DevGpsRcvProcCmnResp(TG_GPS_RCV_DATA* p_data, uint8_t cmd) {
+ RET_API ret = RET_ERROR;
+ uint8_t is_ack; /* 1=ACK, 0=NACK */
+ TG_GPS_UBX_ACK_DATA st_ack;
+ uint8_t *puc_msg_class = &(st_ack.uc_msg_class);
+ uint8_t *puc_msg_id = &(st_ack.uc_msg_id);
+
+ if (p_data == NULL) {
+ POSITIONING_LOG("Argument ERROR!![p_data=%p]", p_data);
+ } else {
+ /* Checksum determination */
+ ret = CheckSumGpsCommon(p_data->bygps_data, p_data->bydata_len, GPS_FORMAT_ACK_ACKNACK);
+ if (ret == RET_NORMAL) {
+ is_ack = p_data->bygps_data[UBX_CMD_OFFSET_ACKNAK];
+ if (is_ack == 1) {
+ /* Response command information extraction */
+ (void)memcpy(&st_ack, &(p_data->bygps_data[UBX_CMD_OFFSET_PAYLOAD]), sizeof(st_ack));
+ POSITIONING_LOG("msgClass=0x%02x, msgID=0x%02x", *puc_msg_class, *puc_msg_id);
+
+ /* When the response wait command does not match the reception command */
+ if (((cmd == GPS_CMD_SENTENCEADD_NMEAGST) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x01))) ||
+ ((cmd == GPS_CMD_SENTENCEADD_NAVTIMEUTC) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x01))) ||
+ ((cmd == GPS_CMD_SENTENCEADD_NAVCLOCK) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x01))) ||
+ ((cmd == GPS_CMD_SENTENCEADD_RXMRTC5) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x01))) ||
+ ((cmd == GPS_CMD_SENTENCEADD_NAVSVINFO) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x01))) ||
+ ((cmd == GPS_CMD_AUTOMOTIVEMODE) && ((*puc_msg_class != 0x06) || (*puc_msg_id != 0x24)))) {
+ POSITIONING_LOG("Invalid ACK/NACK!! [cmd=%d, msgClass=0x%02x, msgID=0x%02x]\n",
+ cmd, *puc_msg_class, *puc_msg_id);
+ ret = RET_ERROR;
+ }
+ } else {
+ ret = RET_ERROR;
+ }
+ } else {
+ POSITIONING_LOG("DEV_Gps_ChkSum ERROR!![ret=%d]", ret);
+ }
+ }
+ return ret;
+}
+
+
+RET_API DevGpsResetReq(PNO us_pno, RID uc_rid) {
+ RET_API ret;
+ TG_GPS_SAVECMD st_save_cmd;
+ TG_GPS_SND_DATA* pst_snd_data;
+ uint8_t* p_ublox_data;
+
+ /* SYNC_CHAR_1_2 CLASS ID length(L/U) */
+ static const u_int8 csnd_cmd[] = { 0xB5, 0x62, 0x06, 0x04, 0x04, 0x00,
+ /* navBbrMask(L/U) resetMode/res CK_A CK_B */
+ 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00 };
+
+ pst_snd_data = &(st_save_cmd.sndcmd);
+ p_ublox_data = pst_snd_data->ub_data;
+
+ memset(&st_save_cmd, 0x00, sizeof(st_save_cmd));
+ memcpy(p_ublox_data, csnd_cmd, UBX_CMD_SIZE_CFG_RST);
+
+ /* Checksum assignment */
+ DevGpsSetChkSum(p_ublox_data, UBX_CMD_SIZE_CFG_RST);
+
+ pst_snd_data->us_size = UBX_CMD_SIZE_CFG_RST;
+ st_save_cmd.us_pno = us_pno; /* Result notification destination process number */
+ st_save_cmd.uc_rid = uc_rid; /* Result Notification Resource ID */
+ st_save_cmd.uc_rst = GPS_CMD_RESET; /* Reset flag */
+ st_save_cmd.e_cmd_info = GPS_FORMAT_RMC; /* Command information */
+
+ /* Command is suspended and terminated. */
+ ret = DevGpsSaveCmd(&st_save_cmd);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("# GpsCommCtl # GPS Command Reserve bufferFull !");
+
+ /** When the pending buffer is full, a reset response (communication error) is returned. */
+ DevGpsRstAnsSend(st_save_cmd.us_pno, st_save_cmd.uc_rid, GPS_SENDNG);
+ }
+
+ return ret;
+}
+
+void DevGpsSettingTime(POS_DATETIME* pst_datetime) {
+ RET_API ret;
+ TG_GPS_SAVECMD st_save_cmd;
+ TG_GPS_SND_DATA* pst_snd_data;
+ uint8_t* p_ublox_data;
+ TG_GPS_UBX_AID_INI_POLLED* pst_ublox_data;
+
+ uint16_t gpsw;
+ uint32_t gpsws;
+
+ if (pst_datetime == NULL) {
+ POSITIONING_LOG("Argument ERROR!! [pstDataTime = %p]", pst_datetime);
+ } else {
+ pst_snd_data = &(st_save_cmd.sndcmd);
+ p_ublox_data = pst_snd_data->ub_data;
+
+ (void)memset(&st_save_cmd, 0x00, sizeof(st_save_cmd));
+
+ /* Convert to GSP week number, GPS week second */
+ (void)DevGpsYMD2GPSTIME(static_cast<int32>(pst_datetime->year),
+ static_cast<int32>(pst_datetime->month),
+ static_cast<int32>(pst_datetime->date),
+ static_cast<int32>(pst_datetime->hour),
+ static_cast<int32>(pst_datetime->minute),
+ static_cast<int32>(pst_datetime->second), &gpsw, &gpsws);
+
+
+ /* Send command sequence generation */
+ pst_ublox_data = reinterpret_cast<TG_GPS_UBX_AID_INI_POLLED*>(reinterpret_cast<void *>(p_ublox_data));
+ pst_ublox_data->uc_sync_char1 = 0xB5;
+ pst_ublox_data->uc_sync_char2 = 0x62;
+ pst_ublox_data->uc_class = 0x0B;
+ pst_ublox_data->uc_id = 0x01;
+ pst_ublox_data->uc_length[0] = 0x30;
+ pst_ublox_data->uc_length[1] = 0x00;
+ pst_ublox_data->uc_flags[0] = 0x02; /* Time setting: The second bit from the low order is 1. */
+
+ (void)memcpy(pst_ublox_data->wn, &gpsw, sizeof(uint16_t));
+
+ gpsws *= 1000;
+ (void)memcpy(pst_ublox_data->tow, &gpsws, sizeof(uint32_t));
+
+ /* Checksum assignment */
+ DevGpsSetChkSum(reinterpret_cast<u_int8 *>(reinterpret_cast<void*>(pst_ublox_data)),
+ UBX_CMD_SIZE_AID_INI);
+
+ /* Concatenate Poll Request Command */
+ ret = DevGpsCatPollReq(p_ublox_data, UBX_POLL_CMD_KIND_AID_INI);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("DEV_Gps_CatPollReqUblox ERROR!! [ret = %d]", ret);
+ } else {
+ pst_snd_data->us_size = UBX_CMD_SIZE_AID_INI_PLUS_POLL;
+ st_save_cmd.us_pno = PNO_VEHICLE_SENSOR; /* Result notification destination process number */
+ st_save_cmd.uc_rid = 0; /* Result Notification Resource ID */
+ st_save_cmd.uc_rst = GPS_CMD_TIMESET; /* Response flag */
+ st_save_cmd.e_cmd_info = GPS_FORMAT_AID_INI;/* Command information */
+
+ /* Command is suspended and terminated. */
+ ret = DevGpsSaveCmd(&st_save_cmd);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("DevGpsSaveCmd ERROR!! [ret = %d]", ret);
+ /* Todo: retransmission by timer */
+ }
+ /* Update non-volatile of time setting */
+ WriteGpsTimeToBackup(FALSE, pst_datetime);
+ /* Waiting for a GPS device to respond */
+ g_is_gpstime_sts = FALSE;
+ POSITIONING_LOG("Start SetGpsTime\n");
+ POSITIONING_LOG("D_BK_ID_POS_GPS_TIME_SET_INFO:W:%d/%d/%d %d:%d:%d\n",
+ pst_datetime->year,
+ pst_datetime->month,
+ pst_datetime->date,
+ pst_datetime->hour,
+ pst_datetime->minute,
+ pst_datetime->second);
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Converting from the Gregorian calendar to the Julian Day of Modification
+ *
+ * @param[in] y year
+ * @param[in] m month
+ * @param[in] d day
+ *
+ * @return Modified Julian Date
+ */
+int DevGpsYMD2JD(int y, int m, int d) {
+ double jd = JULIAN_DAY;
+ double tmp;
+ int mjd = 0;
+
+ if (m <= 2) { /* In January, February in December and 14th of the previous year */
+ y--;
+ m += 12;
+ }
+ y += 4800;
+ m -= 3;
+ d -= 1;
+
+ tmp = static_cast<double>(y / 400);
+ y %= 400;
+ jd += tmp * 146097;
+
+ tmp = static_cast<double>(y / 100);
+ y %= 100;
+ jd += tmp * 36524;
+
+ tmp = static_cast<double>(y / 4);
+ y %= 4;
+ jd += tmp * 1461;
+ jd += static_cast<double>(y * 365);
+
+ tmp = static_cast<double>(m / 5);
+ m %= 5;
+ jd += tmp * 153;
+
+ tmp = static_cast<double>(m / 2);
+ m %= 2;
+ jd += tmp * 61;
+ jd += static_cast<double>(m * 31);
+ jd += static_cast<double>(d);
+
+ mjd = static_cast<int>(jd - MODIFIED_JULIAN_DAY_OFFSET); /* Julian Date-> Modified Julian Date */
+
+ return mjd;
+}
+
+/**
+ * @brief
+ * Converting from year, month, day, hour, minute and second (GPS hour) to GPS week and GPS week seconds
+ *
+ * Converting y:year, m:month, d:day, hh:hour, mm:minute, ss:second (GPS hour) to GPS week/GPS week second
+ *
+ * @param[in] y year
+ * @param[in] m month
+ * @param[in] d day
+ * @param[in] hh hour
+ * @param[in] mm munites
+ * @param[in] ss sec
+ * @param[out] gpsw
+ * @param[out] gpsws
+ *
+ * @return TRUE / FALSE
+ */
+BOOL DevGpsYMD2GPSTIME(const int32 y, const int32 m, const int32 d, const int32 hh,
+ const int32 mm, const int32 ss, u_int16* gpsw, u_int32* gpsws) {
+ /*
+ MJD :Y year M month D date modified Julian date (Convert date to modified Julian date)
+ GPSW : GPS week
+ GPSWS: GPS week second
+ */
+ int mjd = DevGpsYMD2JD(y, m, d);
+
+ *gpsw = (uint16_t)((mjd - 44244) / 7);
+ *gpsws = (uint32_t)(((mjd - 44244 - (*gpsw * 7)) * 86400) +
+ (hh * 3600) + (mm * 60) + ss + 16); /* Add leap seconds ( 16 seconds) at 2015/1/1 */
+
+ if (*gpsws >= GPS_WS_MAX) {
+ (*gpsw)++;
+ *gpsws -= GPS_WS_MAX;
+ }
+
+ POSITIONING_LOG("*gpsw = %d, *gpsws = %d", *gpsw, *gpsws);
+
+ return TRUE;
+}
+
+/**
+ * @brief
+ * Concatenating Poll Request commands to UBX commands
+ *
+ * @param[in/out] *p_ublox_data Pointer to the concatenated UBX command
+ * @param[in] kind Additional command types
+ *
+ * @return RET_NORAML / RET_ERROR
+ */
+RET_API DevGpsCatPollReq(uint8_t *p_ublox_data, uint16_t kind) {
+ RET_API ret_api = RET_NORMAL;
+ TG_GPS_UBX_PACKET_HEADER *pst_ubx_pkg_hdr;
+ TG_GPS_UBX_COMMAND_NO_DATA *pst_ubx_poll_req;
+ uint32_t length;
+
+ /* Header ID length Checksum */
+ static uint8_t c_aidini_poll_cmd[] = {0xB5, 0x62, 0x0B, 0x01, 0x00, 0x00, 0x00, 0x00};
+ static uint8_t c_cfgnav5_poll_cmd[] = {0xB5, 0x62, 0x06, 0x24, 0x00, 0x00, 0x00, 0x00};
+
+ uint8_t* p_poll_cmd;
+ uint16_t poll_cmd_length;
+
+ if (p_ublox_data == NULL) {
+ POSITIONING_LOG("Argument ERROR!! [p_ublox_data=%p]", p_ublox_data);
+ ret_api = RET_ERROR;
+ } else {
+ if (kind == UBX_POLL_CMD_KIND_AID_INI) {
+ p_poll_cmd = c_aidini_poll_cmd;
+ poll_cmd_length = UBX_CMD_SIZE_AID_INI_POLL;
+ } else if (kind == UBX_POLL_CMD_KIND_CFG_NAV5) {
+ p_poll_cmd = c_cfgnav5_poll_cmd;
+ poll_cmd_length = UBX_CMD_SIZE_CFG_NAV5_POLL;
+ } else {
+ POSITIONING_LOG("Argument ERROR!! [kind=%d]", kind);
+ ret_api = RET_ERROR;
+ }
+
+ if (ret_api != RET_ERROR) {
+ pst_ubx_pkg_hdr = reinterpret_cast<TG_GPS_UBX_PACKET_HEADER*>(reinterpret_cast<void*>(p_ublox_data));
+ length = pst_ubx_pkg_hdr->us_length;
+
+ if (length == 0) {
+ POSITIONING_LOG("pst_ubx_pkg_hdr->us_length=0 ERROR!!");
+ ret_api = RET_ERROR;
+ } else {
+ /* Add Poll Request Command */
+ pst_ubx_poll_req = reinterpret_cast<TG_GPS_UBX_COMMAND_NO_DATA*>(reinterpret_cast<void*>(p_ublox_data +
+ length +
+ sizeof(TG_GPS_UBX_COMMAND_NO_DATA)));
+
+ memcpy(reinterpret_cast<void*>(pst_ubx_poll_req), reinterpret_cast<void*>(p_poll_cmd), poll_cmd_length);
+
+ DevGpsSetChkSum(reinterpret_cast<u_int8 *>(reinterpret_cast<void*>(pst_ubx_poll_req)), poll_cmd_length);
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+void DevGpsSetGpsweekcorcnt(void) {
+ CLOCKGPS_GPSWEEKCOR_CNT_MSG gpsweekcor_cnt_msg;
+ memcpy(&gpsweekcor_cnt_msg, &g_gps_msg_rcvr, sizeof(CLOCKGPS_GPSWEEKCOR_CNT_MSG));
+ g_gps_week_cor_cnt = gpsweekcor_cnt_msg.gpsweekcorcnt;
+ return;
+}
+
+RET_API DevGpsNavTimeUTCAddReq(void) {
+ RET_API ret;
+ TG_GPS_SAVECMD st_save_cmd;
+ TG_GPS_SND_DATA* pst_snd_data;
+ uint8_t* p_ublox_data;
+
+ /* SYNC_CHAR_1_2 CLASS ID length(L/U) Payload CK_A CK_B */
+ static const u_int8 csnd_cmd[] = { 0xB5, 0x62, 0x06, 0x01, 0x03, 0x00, 0x01, 0x21, 0x01, 0x00, 0x00 };
+
+ pst_snd_data = &(st_save_cmd.sndcmd);
+ p_ublox_data = pst_snd_data->ub_data;
+
+ memset(&st_save_cmd, 0x00, sizeof(st_save_cmd));
+
+ /* Send command generation */
+ memcpy(p_ublox_data, csnd_cmd, UBX_CMD_SIZE_CFG_MSG);
+
+ /* Checksum assignment */
+ DevGpsSetChkSum(p_ublox_data, UBX_CMD_SIZE_CFG_MSG);
+
+ pst_snd_data->us_size = UBX_CMD_SIZE_CFG_MSG;
+ st_save_cmd.us_pno = PNO_VEHICLE_SENSOR; /* Result notification destination process number */
+ st_save_cmd.uc_rid = 0; /* Result notification resource ID */
+ st_save_cmd.uc_rst = GPS_CMD_SENTENCEADD_NAVTIMEUTC; /* Response flag */
+ st_save_cmd.e_cmd_info = GPS_FORMAT_ACK_ACKNACK; /* Command information */
+
+ /* Command is suspended and terminated. */
+ ret = DevGpsSaveCmd(&st_save_cmd);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("# GpsCommCtl # GPS Command Reserve bufferFull !");
+ }
+
+ return ret;
+}
+
+RET_API DevGpsWknRolloverGetReq(void) {
+ RET_API ret;
+ TG_GPS_SAVECMD st_save_cmd;
+ TG_GPS_SND_DATA* pst_snd_data;
+ uint8_t* p_ublox_data;
+
+ /* SYNC_CHAR_1_2 CLASS ID length(L/U) CK_A CK_B */
+ static const u_int8 csnd_cmd[] = { 0xB5, 0x62, 0x06, 0x23, 0x00, 0x00, 0x00, 0x00 };
+
+ pst_snd_data = &(st_save_cmd.sndcmd);
+ p_ublox_data = pst_snd_data->ub_data;
+
+ (void)memset(&st_save_cmd, 0x00, sizeof(st_save_cmd)); /* QAC 3200 */
+
+ /* Send command generation */
+ (void)memcpy(p_ublox_data, csnd_cmd, UBX_CMD_SIZE_CFG_NAVX5_POLL); /* QAC 3200 */
+
+ /* Checksum assignment */
+ DevGpsSetChkSum(p_ublox_data, UBX_CMD_SIZE_CFG_NAVX5_POLL);
+
+ pst_snd_data->us_size = UBX_CMD_SIZE_CFG_NAVX5_POLL;
+ st_save_cmd.us_pno = PNO_VEHICLE_SENSOR; /* Result notification destination process number */
+ st_save_cmd.uc_rid = 0; /* Result notification resource ID */
+ st_save_cmd.uc_rst = GPS_CMD_WKNROLLOVER; /* Response flag */
+ st_save_cmd.e_cmd_info = GPS_FORMAT_CFG_NAVX5; /* Command information */
+
+ /* Command is suspended and terminated. */
+ ret = DevGpsSaveCmd(&st_save_cmd);
+ if (ret != RET_NORMAL) {
+ POSITIONING_LOG("# GpsCommCtl # GPS Command Reserve bufferFull !");
+ /* If an error occurs at this point that is not expected due to a command queue full error, retransmission control is required. */
+ }
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS time setting validity check process
+ *
+ * @param[in] set_gpsw Set GPS week
+ * @param[in] set_gpsws Set GPS Week
+ * @param[in] rcv_gpsw Answer GPS Week
+ * @param[in] rcv_gpsws Answer GPS Weeksec
+ * @param[in] offset_range Tolerance time difference[sec]
+ * @return BOOL TRUE:Effective time / FALSE:Invalid time
+ */
+BOOL DevGpsCheckGpsTime(uint16_t set_gpsw, uint32_t set_gpsws,
+ uint16_t rcv_gpsw, uint32_t rcv_gpsws, int32_t offset_range) {
+ BOOL ret = FALSE;
+ int16_t gap_gpsw = 0;
+ int32_t gap_gpsws = 0;
+
+ /* Check if GPS week number and GPS week second are within valid range */
+ /* NG when Set Time > Receive Time */
+ gap_gpsw = (int16_t)(rcv_gpsw - set_gpsw); /* QAC 3758 */
+ if (gap_gpsw == 0) {
+ /* There is no difference between the set GPS week and the received GPS week */
+ gap_gpsws = (int32_t)(rcv_gpsws - set_gpsws); /* QAC 3771 */
+ if ((0 <= gap_gpsws) && (gap_gpsws <= offset_range)) {
+ /* Setting of GPS time succeeded if the difference between GPS week seconds is within the range. */
+ ret = TRUE;
+ }
+ } else if (gap_gpsw == 1) {
+ /* Difference between the set GPS week and the received GPS week is 1 (over 7 weeks) */
+ gap_gpsws = (int32_t)((rcv_gpsws + GPS_WS_MAX) - set_gpsws); /* QAC 3771 */
+ if ((0 <= gap_gpsws) && (gap_gpsws <= offset_range)) {
+ /* Setting of GPS time succeeded if the difference between GPS week seconds is within the range. */
+ ret = TRUE;
+ }
+ } else {
+ /* Set GPS time failed except above */
+ }
+
+ return ret;
+}
+
+
+/****************************************************************************
+@brief DevGpsCnvLonLatNavi<BR>
+ Longitude/latitude information conversion process(Navigation-provided data)
+@outline Converts the latitude/longitude information provided by the navigation system into the format provided to the vehicle sensor.
+@param[in] u_int8 : fix_sts ... Current positioning status
+@param[in] int32 : lon ... Longitude information
+@param[in] int32 : lat ... Latitude-information
+@param[out] SENSORLOCATION_LONLATINFO_DAT* : p_lonlat ... Latitude and longitude information after conversion
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsCnvLonLatNavi(SENSORLOCATION_LONLATINFO_DAT* p_lonlat, u_int8 fix_sts, int32 lon, int32 lat) {
+ int32 longtitude;
+ int32 latitude;
+ int64_t tmp;
+ BOOL b_ret_lon = TRUE;
+ BOOL b_ret_lat = TRUE;
+ BOOL b_fix_sts = TRUE;
+
+ /** Provides latitude/longitude info for positioning status (2D/3D) */
+ if ((NAVIINFO_DIAG_GPS_FIX_STS_2D == fix_sts ) ||
+ (NAVIINFO_DIAG_GPS_FIX_STS_3D == fix_sts)) {
+ /** Get longitude information */
+ tmp = (int64_t)lon * 10000000;
+ longtitude = static_cast<int32>(tmp / (int64_t)(256 * 60 * 60));
+ if (longtitude == -1800000000) {
+ /** West longitude 180 degrees -> East longitude 180 degrees */
+ longtitude = +1800000000;
+ }
+ if ((longtitude > +1800000000) ||
+ (longtitude < -1800000000)) {
+ /** Longitude range error */
+ b_ret_lon = FALSE;
+ }
+ /** Get latitude information */
+ tmp = (int64_t)lat * 10000000;
+
+ latitude = static_cast<int32>(tmp / (int64_t)(256 * 60 * 60));
+
+ if ((latitude > +900000000) ||
+ (latitude < -900000000)) {
+ /** Latitude range error */
+ b_ret_lat = FALSE;
+ }
+ } else {
+ /** Does not provide latitude/longitude information in non-positioning state. */
+ b_fix_sts = FALSE;
+ }
+
+ /** Provided data setting */
+ p_lonlat->getMethod = GET_METHOD_GPS;
+ p_lonlat->SyncCnt = 0x00; /* Synchronization counter value(fixed to 0) */ /* Ignore -> No applicable rules for MISRA-C */
+ /** Available/Unusable Decision */
+ if ((b_fix_sts == TRUE) && (b_ret_lon == TRUE) && (b_ret_lat == TRUE)) {
+ p_lonlat->isEnable = SENSORLOCATION_STATUS_ENABLE; /* Available status: Available */
+ p_lonlat->Longitude = longtitude; /* Longitude */ /* Ignore -> MISRA-C:2004 Rule 9.1 */
+ p_lonlat->Latitude = latitude; /* Latitude */ /* Ignore -> MISRA-C:2004 Rule 9.1 */
+ } else {
+ p_lonlat->isEnable = SENSORLOCATION_STATUS_DISABLE; /* Available status: Not available */
+ p_lonlat->Longitude = 0; /* Longitude 0 degree fixed */
+ p_lonlat->Latitude = 0; /* Latitude fixed to 0 degrees */
+ }
+ return;
+}
+
+
+/****************************************************************************
+@brief DevGpsCnvAltitudeNavi<BR>
+ Altitude information conversion process(Navigation-provided data)
+@outline Converts the altitude information provided by the navigation system into the format provided to the vehicle sensor.
+@param[in] u_int8 : fix_sts ... Current positioning status
+@param[in] int32 : alt ... Altitude information
+@param[out] SENSORLOCATION_ALTITUDEINFO_DAT* : p_altitude ... Converted altitude information
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsCnvAltitudeNavi(SENSORLOCATION_ALTITUDEINFO_DAT* p_altitude, u_int8 fix_sts, int32 alt) {
+ int32 altitude;
+ BOOL b_fix_sts = TRUE;
+
+ /** Provides altitude information when in Fix Status (2D/3D) */
+ if (((NAVIINFO_DIAG_GPS_FIX_STS_2D == fix_sts) ||
+ (NAVIINFO_DIAG_GPS_FIX_STS_3D == fix_sts)) &&
+ (alt != GPS_ALTITUDE_INVALID_VAL)) {
+ /* The unit of alt is [0.01m], so conversion is not necessary. */
+ altitude = alt;
+ } else {
+ /** Does not provide altitude information in the non-positioning state. */
+ b_fix_sts = FALSE;
+ }
+ /** Provided data setting */
+ p_altitude->getMethod = GET_METHOD_GPS;
+ p_altitude->SyncCnt = 0x00; /* Synchronization counter value(fixed to 0) */ /* Ignore -> No applicable rules for MISRA-C */
+ /** Available/Unusable Decision */
+ if (b_fix_sts == TRUE) {
+ p_altitude->isEnable = SENSORLOCATION_STATUS_ENABLE; /* Available status: Available */
+ p_altitude->Altitude = altitude; /* Altitude */ /* Ignore -> MISRA-C:2004 Rule 9.1 */
+ } else {
+ p_altitude->isEnable = SENSORLOCATION_STATUS_DISABLE; /* Available status: Not available */
+ p_altitude->Altitude = 0; /* Altitude 0m fixed */
+ }
+ return;
+}
+
+/****************************************************************************
+@brief DevGpsCnvHeadingNavi<BR>
+ Orientation information conversion processing(Navigation-provided data)
+@outline Converts the orientation information provided by the navigation system into the format provided to the vehicle sensor.
+@param[in] u_int8 : fix_sts ... Current positioning status
+@param[in] u_int16 : head ... Bearing information
+@param[out] SENSORMOTION_HEADINGINFO_DAT* : p_heading ... Converted backward direction information
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsCnvHeadingNavi(SENSORMOTION_HEADINGINFO_DAT* p_heading, u_int8 fix_sts, u_int16 head) {
+ u_int16 us_heading;
+ BOOL b_fix_sts = TRUE;
+
+ /** Provides orientation when in Fix Status (2D/3D) */
+ if (((NAVIINFO_DIAG_GPS_FIX_STS_2D == fix_sts ) ||
+ (NAVIINFO_DIAG_GPS_FIX_STS_3D == fix_sts)) &&
+ (head != GPS_HEADING_INVALID_VAL)) {
+ /** Orientation information conversion */
+ us_heading = head;
+ /* Units of head are [0.01 degree] so no conversion is necessary. */
+ us_heading -= (u_int16)((us_heading / 36000) * 36000);
+ } else {
+ /** Azimuth information is not provided in the non-positioning state. */
+ b_fix_sts = FALSE;
+ }
+
+ /** Provided data setting */
+ p_heading->getMethod = GET_METHOD_GPS;
+ p_heading->SyncCnt = 0x00; /* Synchronization counter value(fixed to 0) */ /* Ignore -> No applicable rules for MISRA-C */
+ /** Available/Unusable Decision */
+ if (b_fix_sts == TRUE) {
+ p_heading->isEnable = SENSORLOCATION_STATUS_ENABLE; /* Available status: Available */
+ p_heading->Heading = us_heading; /* Orientation */ /* Ignore -> MISRA-C:2004 Rule 9.1 */
+ } else {
+ p_heading->isEnable = SENSORLOCATION_STATUS_DISABLE; /* Available status: Not available */
+ p_heading->Heading = 0; /* Azimuth 0 degree fixed */
+ }
+
+ return;
+}
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Main.cpp b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Main.cpp
new file mode 100755
index 0000000..0b9a4be
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Main.cpp
@@ -0,0 +1,362 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Main.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "MDev_Gps_Main.h"
+#include "positioning_common.h"
+#include "MDev_Gps_Mtrx.h"
+#include "MDev_Gps_TimerCtrl.h"
+#include "MDev_Gps_Common.h"
+#include "MDev_Gps_Nmea.h"
+#include "MDev_GpsRecv.h"
+#include "LineSensDrv_Thread.h"
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+BOOL g_gps_rcv_thread_stop = FALSE;
+
+/********************************************************************************
+ * Matrix event translation table(Message input)
+ ********************************************************************************/
+const TG_GPS_MSGEVTCHNG kGpsMsgchkC[MDEV_GPSMSGCHKC_MAX] = {
+ /* ++ #GPF_60_024 */
+ /* Matrix Event Translation Table for _CWORD82_ NMEA */
+ {CID_GPS__CWORD82__REQUEST, GPS_EVT_SENDREQ}, /* NMEA transmission request */
+ {CID_INI_INTERNAL_ACCOFF_START, GPS_EVT_ACC_OFF}, /* In-function ACC-OFF instructions */
+ {CID_GPS_REQRESET, GPS_EVT_RESETREQ}, /* GPS reset request */
+ {CID_NAVIINFO_DELIVER, GPS_EVT_NAVI_LOCATIONINFO}, /* Providing navigation information */
+ {CID_NAVIINFO_SPEED_DELIVER, GPS_EVT_NAVI_SPEEDINFO}, /* Navigation speed information service */
+ {CID_GPS_TIMESETTING, GPS_EVT_TIMESETTING}, /* GPS time setting instruction */
+ {CID_GPS_BACKUPDATA_LOAD, GPS_EVT_BACKUPDATA_LOAD}, /* Backup memory read request */
+ {CID_THREAD_STOP_REQ, GPS_EVT_STOPREQ}, /* Thread stop request */
+ {CID_GPSWEEKCOR_CNT_NOTIFICATION, GPS_EVT_WEEKCOR_CNT_NOTIFICATIO}, /* GPS Week Adjustment Counter Notification */
+ {DAT_END, DAT_END} /* Table end */
+ /* -- #GPF_60_024 */
+};
+
+/********************************************************************************
+ * Matrix event translation table(Input Timeout [ Timer ID])
+ ********************************************************************************/
+const TG_GPS_TIMEVTCHNG kGpsTimchkC[MDEV_PSTIMCHKC_MAX] = {
+ {GPS_STARTUP_TIMER, 0, GPS_EVT_TIMEOUT_CYCLDAT}, /* Start confirmation monitoring timer */
+ {GPS_CYCL_TIMER, 0, GPS_EVT_TIMEOUT_CYCLDAT}, /* Periodic reception data monitoring timer */
+ {GPS_RECV_ACK_TIMER, 0, GPS_EVT_TIMEOUT_RSPDAT}, /* ACK reception monitoring timer */
+ {GPS_NAVIFST_TIMER, 0, GPS_EVT_TIMEOUT_NAVI}, /* Initial NAVI monitoring timer */
+ {GPS_NAVICYCLE_TIMER, 0, GPS_EVT_TIMEOUT_NAVI}, /* NAVIGATION monitoring timer */
+ {GPS_NAVIDISRPT_TIMER, 0, GPS_EVT_TIMEOUT_NAVI}, /* NAVIGATION Disruption Log Output Timer */
+ {GPS_DIAGCLK_GUARDTIMER, 0, GPS_EVT_TIMEOUT_DIAGCLKGUARD}, /* Diagnosis provision time guard monitoring timer */
+ {GPS_NMEADATA_GUARDTIMER, 0, GPS_EVT_TIMEOUT_NMEADATAGUARD}, /* NMEA data-providing guard monitoring timer */
+ {GPS_RECOVERY_TIMER, 0, GPS_EVT_TIMEOUT_RECOVERY}, /* GPS recovery timer */
+ {GPS_RECEIVERERR_TIMER, 0, GPS_EVT_TIMEOUT_RECEIVERERR}, /* GPS receiver anomaly detection timer */
+ {DAT_END, 0, DAT_END} /* Table end */
+};
+
+/********************************************************************************
+ * Processing Branch Table
+ ********************************************************************************/
+/********************************************************************************
+ * TAG : TG_GPS_JMP_TBL
+ * ABSTRACT : GPS jump table
+ * NOTE : GPS Communication Management Matrix Table
+ ********************************************************************************/
+const TG_GPS_JMP_TBL kGpsMatxC[GPS_STS_NUM][GPS_EVT_NUM] = {
+ /* - - - - - Confirming Start - - - - - */
+ {
+ {&DevGpsInitStartSendReq}, /* Transmission request */
+ {&DevGpsInitStartGPSResetReq}, /* GPS reset request */
+ {&DevGpsInitStartRcvCyclCmd}, /* Cyclic reception command reception */
+ {&DevGpsNop}, /* Receive Response Command */
+ {&DevGpsNop}, /* Response monitoring timeout */
+ {&DevGpsInitStartCyclDataTimeOut}, /* Periodic reception data monitoring timeout */
+ {&DevGpsInitStartNaviDataTimeOut}, /* Navigation providing data monitoring timeout */
+ {&DevGpsInitStartDiagClkGuardTimeOut}, /* Diagnosis provision time guard monitoring timeout */
+ {&DevGpsInitStartAccOffStart}, /* In-function ACC-OFF instructions */
+ {&DevGpsInitStartNaviInfoDeliver}, /* Providing navigation information */
+ {&DevGpsInitStartNaviSpeedDeliver}, /* Navigation speed information service */
+ {&DevGpsInitStartSettingTime}, /* GPS time setting instruction */
+ {&DevGpsInitStartNmeaDataGuardTimeOut}, /* NMEA data-providing guard monitoring timeout */
+ {&DevGpsInitStartBackupDataLoadReq}, /* Backup data read request */
+ {&DevGpsInitStartStopReq}, /* Thread stop request */
+ {&DevGpsInitStartGpsweekcorcntNtf}, /* GPS Week Adjustment Counter Notification */
+ {&DevGpsInitStartRecoveryTimeOut}, /* GPS error monitoring timer out */
+ {&DevGpsInitStartGpsReceiverErrTimeOut} /* GPS receiver anomaly detection timeout */
+ },
+ /* - - - - - - In operation - - - - - - */
+ {
+ {&DevGpsNormalSendReq}, /* Transmission request */
+ {&DevGpsNormalGPSResetReq}, /* GPS reset request */
+ {&DevGpsNormalRcvCyclCmd}, /* Cyclic reception command reception */
+ {&DevGpsNop}, /* Receive Response Command */
+ {&DevGpsNop}, /* Response monitoring timeout */
+ {&DevGpsNormalCyclDataTimeOut}, /* Periodic reception data monitoring timeout */
+ {&DevGpsNormalNaviDataTimeOut}, /* Navigation providing data monitoring timeout */
+ {&DevGpsNormalDiagClkGuardTimeOut}, /* Diagnosis provision time guard monitoring timeout */
+ {&DevGpsNormalAccOffStart}, /* In-function ACC-OFF instructions */
+ {&DevGpsNormalNaviInfoDeliver}, /* Providing navigation information */
+ {&DevGpsNormalNaviSpeedDeliver}, /* Navigation speed information service */
+ {&DevGpsNormalSettingTime}, /* GPS time setting instruction */
+ {&DevGpsNormalNmeaDataGuardTimeOut}, /* NMEA data-providing guard monitoring timeout */
+ {&DevGpsNormalBackupDataLoadReq}, /* Backup data read request */
+ {&DevGpsNormalStopReq}, /* Thread stop request */
+ {&DevGpsNormalGpsweekcorcntNtf}, /* GPS Week Adjustment Counter Notification */
+ {&DevGpsNormalRecoveryTimeOut}, /* GPS error monitoring timer out */
+ {&DevGpsNormalGpsReceiverErrTimeOut} /* GPS receiver anomaly detection timeout */
+ },
+ /* - - - - -- Sending - - - - - - */
+ {
+ {&DevGpsSendSendReq}, /* Transmission request */
+ {&DevGpsSendGPSResetReq}, /* GPS reset request */
+ {&DevGpsSendRcvCyclCmd}, /* Cyclic reception command reception */
+ {&DevGpsSendRcvRspCmd}, /* Receive Response Command */
+ {&DevGpsSendRspDataTimeOut}, /* Response monitoring timeout */
+ {&DevGpsSendCyclDataTimeOut}, /* Periodic reception data monitoring timeout */
+ {&DevGpsSendNaviDataTimeOut}, /* Navigation providing data monitoring timeout */
+ {&DevGpsSendDiagClkGuardTimeOut}, /* Diagnosis provision time guard monitoring timeout */
+ {&DevGpsSendAccOffStart}, /* In-function ACC-OFF instructions */
+ {&DevGpsSendNaviInfoDeliver}, /* Providing navigation information */
+ {&DevGpsSendNaviSpeedDeliver}, /* Navigation speed information service */
+ {&DevGpsSendSettingTime}, /* GPS time setting instruction */
+ {&DevGpsSendNmeaDataGuardTimeOut}, /* NMEA data-providing guard monitoring timeout */
+ {&DevGpsSendBackupDataLoadReq}, /* Backup data read request */
+ {&DevGpsSendStopReq}, /* Thread stop request */
+ {&DevGpsSendGpsweekcorcntNtf}, /* GPS Week Adjustment Counter Notification */
+ {&DevGpsSendRecoveryTimeOut}, /* GPS error monitoring timer out */
+ {&DevGpsSendGpsReceiverErrTimeOut} /* GPS receiver anomaly detection timeout */
+ }
+};
+
+// Receive command analysis table(NMEA format)
+const TG_GPS_CMD_ANA_TBL* kGpsCmdAnaTbl = kGpsCmdAnaTblUblox;
+
+//GPS process pending buffer management table
+TG_GPS_MSGRCV g_gps_msg_rcvr; /* Incoming message */
+TG_GPS_MNG g_gps_mngr; /* GPS process management information */
+
+// Global variable for GPS communication management
+u_int16 g_wsend_err; /* Number of transmission errors */
+u_int16 g_wcnct_err; /* Number of connection errors */
+TG_GPS_OUTPUT_FORMAT g_rcv_format; /* Receive Format */
+
+// Global variable for the receive thread
+TG_GPS_RECV_RcvData g_gps_rcvdata; /* Serial receive buffer */
+TG_GPS_RECV_RcvBuf g_gps_rcvbuf; /* Receive data storage buffer */
+TG_GPS_RECV_AnaDataBuf g_gps_ana_databuf; /* Analysis data buffer */
+TG_GPS_RECV_RcvFrameBuf g_gps_rcv_framebuf; /* Receive frame buffer */
+TG_GPS_SAVEBUF g_gps_save_cmdr; /* Command pending buffer */
+u_int16 g_wrecv_err; /* Number of reception errors */
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+/********************************************************************************
+ * MODULE : DEV_Gps_MainThread
+ * ABSTRACT : Communication Management Thread Domain Processing
+ * FUNCTION : Receive a request from the host application and send a command to the serial port.
+ * ARGUMENT : PVOID pv....Thread Creation Arguments
+ * NOTE :
+ * RETURN : TRUE :Normal completion
+ * FALSE:ABENDs
+ ********************************************************************************/
+EFrameworkunifiedStatus DevGpsMainThread(HANDLE h_app) {
+ BOOL ret = FALSE;
+
+ PosSetupThread(h_app, ETID_POS_GPS);
+
+ ret = DevGpsInit();
+
+ if (TRUE == ret) {
+ g_gps_rcv_thread_stop = FALSE;
+
+ /* Start receiving message */
+ DevGpsRcvMsg();
+ } else {
+ /* Initialization failed */
+ POSITIONING_LOG("DevGpsMainThread Init Fail \n");
+ }
+
+ return eFrameworkunifiedStatusFail;
+}
+
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Init
+ * ABSTRACT : Communication management thread initialization processing
+ * FUNCTION : Initialize internal tables and serial ports
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : TRUE :Normal completion
+ * FALSE:ABENDs
+ ********************************************************************************/
+BOOL DevGpsInit(void) {
+ BOOL ret = FALSE;
+
+ /* Global variable initialization(GPS Communication Management Thread Internal Use Variable) */
+ /* Clear process management information */
+ memset(&g_gps_mngr, 0x00, sizeof(g_gps_mngr)); /* #05 */
+
+ /* Clear the message receive buffer */
+ memset(&g_gps_msg_rcvr, 0x00, sizeof(g_gps_msg_rcvr)); /* #05 */
+
+ /* Clear the pending buffer */
+ memset(&g_gps_save_cmdr, 0x00, sizeof(g_gps_save_cmdr)); /* #05 */
+
+ /* Clear RTC backup-related data */
+ g_gps_mngr.rcv_cmd = GPS_FORMAT_MIN; /* #GPF_60_040 */
+ g_gps_mngr.resp_cmd = GPS_FORMAT_MIN; /* #GPF_60_040 */
+ g_gps_mngr.rcv_err_flag = FALSE;
+
+ g_wsend_err = 0; /* Initialization of the number of transmission errors */
+ g_wcnct_err = 0; /* Connection error count initialization */
+ g_rcv_format = GPS_FORMAT_MIN; /* Initialize Receive Format #GPF_60_024*/
+
+ /* Initialize the timer function initialization processing management table */
+ DevGpsTimInit();
+
+ /* Start confirmation monitoring timer setting(5Sec) */
+ ret = DevGpsTimeSet(GPS_STARTUP_TIMER);
+
+ /* GPS receiver anomaly detection timer setting(600Sec) */
+ ret = DevGpsTimeSet(GPS_RECEIVERERR_TIMER);
+
+ // Set command table
+ kGpsCmdAnaTbl = kGpsCmdAnaTblUblox;
+
+ /* State transition processing(Start Confirmation Monitor) */
+ ChangeStatusGpsCommon(GPS_STS_STARTUP);
+
+ return(ret);
+}
+
+/******************************************************************************
+@brief DEV_Gps_RcvMsg<BR>
+ Message reception processing
+@outline Receive a message and distribute processing into a matrix
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsRcvMsg(void) {
+ RET_API ret = RET_NORMAL;
+ void* p_rcv_msg = &g_gps_msg_rcvr;
+
+ while (1) {
+ p_rcv_msg = &g_gps_msg_rcvr;
+
+ // Receive meaasge
+ ret = _pb_RcvMsg(PNO_NAVI_GPS_MAIN, sizeof(g_gps_msg_rcvr), &p_rcv_msg, RM_WAIT);
+
+ if (RET_RCVMSG == ret) {
+ memcpy(&g_gps_msg_rcvr, p_rcv_msg, sizeof(g_gps_msg_rcvr));
+
+ /* Message Event Check Processing */
+ DevGpsMsgEventCheck();
+
+ if ((u_int32)NG != g_gps_mngr.event) {
+ /* If the event check is successful */
+ /* Start Processing by Matrix */
+ (kGpsMatxC[g_gps_mngr.sts][g_gps_mngr.event].func)();
+ }
+ } else {
+ /** MSG reception error */
+ POSITIONING_LOG("DevGpsRcvMsg error ret[%d] \n", ret);
+ }
+ }
+}
+
+static inline void SetStopFlag(void) {
+ g_gps_rcv_thread_stop = TRUE;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_MsgEventCheck
+ * ABSTRACT : Message Event Check Processing
+ * FUNCTION : Check received messages and convert them to events
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ********************************************************************************/
+void DevGpsMsgEventCheck(void) {
+ u_int32 ul_cnt = 0;
+
+ /* Set Error to Event No. */
+ g_gps_mngr.event = (u_int32)NG;
+
+ /* For timeout notification */
+ if (g_gps_msg_rcvr.header.hdr.cid == CID_TIMER_TOUT) {
+ /* Get event number from sequence number */
+ DevGpsTimEventCheck();
+ } else if (g_gps_msg_rcvr.header.hdr.cid == CID_GPS_RECVDATA) {
+ DevGpsCmdEventCheckNmea();
+ } else {
+ while (kGpsMsgchkC[ul_cnt].cid != DAT_END) {
+ if (g_gps_msg_rcvr.header.hdr.cid == kGpsMsgchkC[ul_cnt].cid) {
+ POSITIONING_LOG("DevGpsMsgEventCheck: cid = %d", g_gps_msg_rcvr.header.hdr.cid);
+
+ /* Get event number */
+ g_gps_mngr.event = kGpsMsgchkC[ul_cnt].event;
+
+ if (GPS_EVT_STOPREQ == g_gps_mngr.event) {
+ SetStopFlag();
+ LineSensDrvThreadStopProcess();
+ }
+
+ break;
+ }
+
+ ul_cnt++;
+ }
+ }
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_TimEventCheck
+ * ABSTRACT : Timeout-Event check processing
+ * FUNCTION : Check received timeout messages and convert them to events
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ********************************************************************************/
+void DevGpsTimEventCheck(void) {
+ u_int8 uc_time_kind = 0;
+ TimerToutMsg st_rcv_msg;
+ BOOL ret = FALSE;
+
+ // Set Error to Event No.
+ g_gps_mngr.event = (u_int32)NG;
+
+ // Get message
+ memcpy(&st_rcv_msg, &g_gps_msg_rcvr, sizeof(TimerToutMsg));
+
+ // Time judge kind
+ ret = DevGpsTimeJdgKind((u_int16)st_rcv_msg.TimerSeq);
+
+ if (TRUE == ret) {
+ /* If the sequence numbers match, */
+ /* Set the conversion code to the event number */
+ uc_time_kind = (u_int8)((st_rcv_msg.TimerSeq >> 8) & 0x00FF);
+ g_gps_mngr.event = kGpsTimchkC[uc_time_kind].event;
+ }
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Mtrx.cpp b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Mtrx.cpp
new file mode 100755
index 0000000..b36a617
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Mtrx.cpp
@@ -0,0 +1,866 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Mtrx.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+#include "MDev_Gps_Mtrx.h"
+#include "positioning_def.h"
+
+#include "MDev_Gps_Main.h"
+#include "MDev_Gps_API.h"
+#include "MDev_GpsRecv.h"
+#include "MDev_Gps_Common.h"
+#include "MDev_Gps_Nmea.h"
+#include "MDev_Gps_TimerCtrl.h"
+
+extern uint8_t g_gps_reset_cmd_sending;
+/*---------------------------------------------------------------------------*/
+// Functions
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Nop
+ * ABSTRACT : No processing
+ * FUNCTION : NOP processing of the matrix
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ********************************************************************************/
+void DevGpsNop(void) {
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_InitStart_SendReq
+ * ABSTRACT : Startup confirmation - Transmit request reception matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsInitStartSendReq(void) {
+ /** Send Request Receive Common Processing Call */
+ SendReqGpsCommon();
+ /* -- #GPF_60_040 */
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_InitStart_GPSResetReq
+ * ABSTRACT : Startup confirmation - GPS reset request reception matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsInitStartGPSResetReq(void) {
+ /** Reset request reception common processing call */
+ GPSResetReqGpsCommon();
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_InitStart_RcvCyclCmd
+ * ABSTRACT : Startup confirmation - Cyclic receive command receive matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsInitStartRcvCyclCmd(void) {
+ BOOL* pb_rcverr = &(g_gps_mngr.rcv_err_flag); /* GSP receiver error detection status */
+
+ /* Stop start confirmation monitoring timer */
+ (void)DevGpsTimeStop(GPS_STARTUP_TIMER); /* Ignore -> MISRA-C:2004 Rule 16.10 */ /* QAC 3200 */
+
+ /* GPS receiver anomaly detection timer stopped */
+ (void)DevGpsTimeStop(GPS_RECEIVERERR_TIMER);
+
+ /* State transition processing(in operation) */
+ ChangeStatusGpsCommon(GPS_STS_NORMAL);
+
+ // Send NAV-TIMEUTC sentence addition requests
+ DevGpsNavTimeUTCAddReq();
+
+ DevGpsWknRolloverGetReq();
+
+ /* Receive command analysis(u-blox) */
+ if (g_gps_reset_cmd_sending == FALSE) {
+ DevGpsRcvCyclCmd();
+ }
+
+ /* If a GPS receiver error is detected, the diagnosis code (current) is deleted. */
+ if (*pb_rcverr == TRUE) {
+ *pb_rcverr = FALSE;
+ DevSendGpsConnectError(FALSE);
+ }
+ // }
+ /* Reset retry counter */
+ RtyResetGpsCommon();
+
+ /* Sending pending commands */
+ SendSaveCmdGpsCommon(); /* State transition if pending commands exist( -> Sending) */
+
+ /* Cyclic reception data monitoring timer setting */
+ (void)DevGpsTimeSet(GPS_CYCL_TIMER); /* Ignore -> MISRA-C:2004 Rule 16.10 */ /* QAC 3200 */
+
+ /* GPS receiver anomaly detection timer setting */
+ (void)DevGpsTimeSet(GPS_RECEIVERERR_TIMER);
+
+ /* -- #GPF_60_024 */
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_InitStart_CyclDataTimeOut
+ * ABSTRACT : Startup confirmation - Reception cycle data monitoring timeout matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsInitStartCyclDataTimeOut(void) {
+ uint8_t ret = RETRY_OFF;
+
+ POSITIONING_LOG("DEV_Gps_InitStart_CyclDataTimeOut");
+
+ g_wcnct_err++; /* Count number of connection errors */
+
+ /* Stop all timers */
+ DevGpsTimeStop(GPS_STARTUP_TIMER);
+
+ DevGpsTimeStop(GPS_CYCL_TIMER);
+
+ DevGpsTimeStop(GPS_RECV_ACK_TIMER);
+
+ /* Hard reset judgment processing */
+ ret = HardResetChkGpsCommon();
+ if (RETRY_ON == ret) {
+ DevGpsResetReq(PNO_NONE, 0);
+
+ SendSaveCmdGpsCommon(); /* State transition if pending commands exist( -> Sending) */
+ } else if (RETRY_OFF == ret) {
+ /* Fixed number of hard resets completed */
+ } else {
+ /* Retrying(with hard reset) */
+ }
+ /* Clear cyclic receive data up to now */
+ DevGpsCycleDataClear();
+ /* Start confirmation monitoring timer setting */
+ DevGpsTimeSet(GPS_STARTUP_TIMER);
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_InitStart_NaviDataTimeOut<BR>
+ Startup confirmation - Navigation providing data monitoring timeout matrix function
+@outline Navigation providing data monitoring timeout matrix processing during startup confirmation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartNaviDataTimeOut(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_InitStart_DiagClkGuardTimeOut<BR>
+ Startup confirmation - Time guard monitoring timeout matrix functions provided by diagnosis
+@outline Diagnosis provision time guard monitoring timeout matrix process during startup checking
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartDiagClkGuardTimeOut(void) {
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_InitStart_AccOffStart
+ * ABSTRACT : Startup confirmation - Feature ACC-OFF instruction matrix functions
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsInitStartAccOffStart(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_InitStart_NaviInfoDeliver<BR>
+ Startup confirmation - Navigation information provision matrix processing
+@outline Navigation information provision matrix processing during startup confirmation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartNaviInfoDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_InitStart_NaviSpeedDeliver<BR>
+ Startup confirmation - Navigation vehicle speed information provision matrix processing
+@outline Navigation speed information provision matrix processing during startup confirmation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartNaviSpeedDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_InitStart_SettingTime<BR>
+ Startup confirmation - GPS time setting matrix processing
+@outline GPS time setting matrix process during startup confirmation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartSettingTime(void) {
+ POSITIONING_LOG("DEV_Gps_InitStart_SettingTime\n");
+ DevGpsCommSettingTime();
+ return;
+}
+
+/* start #GPF_60_109 */
+/******************************************************************************
+@brief DEV_Gps_InitStart_NmeaDataGuardTimeOut<BR>
+ Startup confirmation - NMEA monitoring timeout matrix processing
+@outline NMEA data-providing guard monitoring timeout process during startup checking
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsInitStartNmeaDataGuardTimeOut(void) {
+}
+
+/**
+ * @brief
+ * Startup confirmation - Backup memory read request matrix processing
+ */
+void DevGpsInitStartBackupDataLoadReq(void) {
+ POS_DATETIME st_date_time;
+ memset(&st_date_time, 0x00, sizeof(st_date_time));
+ /* Import GPS date and time settings */
+ DevGpsReadGpsTime(&st_date_time);
+ // Todo For Test don't need gstGpsFixCnt??
+ // DEV_Gps_ReadGpsFixCnt(); /* Read GPS fix count */
+ if (g_is_gpstime_sts == TRUE) {
+ DevGpsSettingTime(&st_date_time); /* Time setting */
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Startup confirmation - Thread stop request matrix processing
+ */
+void DevGpsInitStartStopReq(void) {
+ /* Thread stop processing */
+ StopThreadGpsCommon();
+
+ return;
+}
+
+/**
+ * @brief
+ * Startup confirmation - GPS week adjustment counter notification process
+ */
+void DevGpsInitStartGpsweekcorcntNtf(void) {
+ DevGpsSetGpsweekcorcnt();
+ return;
+}
+
+/**
+ * @brief
+ * Startup confirmation - GPS recovery timeout process
+ */
+void DevGpsInitStartRecoveryTimeOut(void) {
+ return;
+}
+
+/**
+ * @brief
+ * Startup confirmation - GPS receiver anomaly detection timeout processing
+ */
+void DevGpsInitStartGpsReceiverErrTimeOut(void) {
+ BOOL* pb_rcverr = &(g_gps_mngr.rcv_err_flag); /* GSP receiver error detection status */
+
+ *pb_rcverr = TRUE;
+ DevSendGpsConnectError(TRUE);
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Normal_SendReq
+ * ABSTRACT : In operation - Transmit request reception matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsNormalSendReq(void) {
+ /** Store in a pending buffer #GPF_60_040 */
+ SendReqGpsCommon();
+
+ /** Send the command #GPF_60_040 */
+ SendSaveCmdGpsCommon();
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Normal_GPSResetReq
+ * ABSTRACT : In operation - GPS reset request reception matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsNormalGPSResetReq(void) {
+ /** Store in a pending buffer #GPF_60_040 */
+ GPSResetReqGpsCommon();
+
+ /** Send the command #GPF_60_040 */
+ SendSaveCmdGpsCommon();
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Normal_RcvCyclCmd_Nmea
+ * ABSTRACT : In operation - Cyclic receive command receive matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsNormalRcvCyclCmd(void) {
+ /* Cyclic reception data monitoring timer stopped */
+ (void)DevGpsTimeStop(GPS_CYCL_TIMER);
+ /* GPS receiver anomaly detection timer stopped */
+ (void)DevGpsTimeStop(GPS_RECEIVERERR_TIMER);
+
+ /* Notify Vehicle Sensor */
+ if (g_gps_reset_cmd_sending == FALSE) {
+ DevGpsRcvCyclCmd();
+ }
+
+ /* Reset retry counter */
+ RtyResetGpsCommon();
+
+ /* Cyclic reception data monitoring timer setting */
+ (void)DevGpsTimeSet(GPS_CYCL_TIMER); /* Ignore -> MISRA-C:2004 Rule 16.10 */ /* QAC 3200 */
+
+ /* GPS receiver anomaly detection timer setting */
+ (void)DevGpsTimeSet(GPS_RECEIVERERR_TIMER);
+
+ return;
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Normal_CyclDataTimeOut
+ * ABSTRACT : In operation - Reception cycle data monitoring timeout matrix function
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsNormalCyclDataTimeOut(void) {
+ /* Cyclic reception timeout common processing call */
+ CyclDataTimeOutGpsCommon();
+}
+
+/******************************************************************************
+@brief DEV_Gps_Normal_NaviDataTimeOut<BR>
+ In operation - Navigation providing data monitoring timeout matrix function
+@outline Navigation providing data monitoring timeout matrix processing during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalNaviDataTimeOut(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Normal_DiagClkGuardTimeOut<BR>
+ In operation - Time guard monitoring timeout matrix functions provided by diagnosis
+@outline Diagnosis provision time guard monitoring timeout matrix process during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalDiagClkGuardTimeOut(void) {
+}
+
+/********************************************************************************
+ * MODULE : DEV_Gps_Normal_AccOffStart
+ * ABSTRACT : Startup confirmation - Feature ACC-OFF instruction matrix functions
+ * FUNCTION :
+ * ARGUMENT :
+ * NOTE :
+ * RETURN :
+ ********************************************************************************/
+void DevGpsNormalAccOffStart(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Normal_NaviInfoDeliver<BR>
+ In operation - Navigation information provision matrix processing
+@outline Navigation information provision matrix processing during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalNaviInfoDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Normal_NaviSpeedDeliver<BR>
+ In operation - Navigation vehicle speed information provision matrix processing
+@outline Navigation vehicle speed information provision matrix processing during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalNaviSpeedDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Normal_SettingTime<BR>
+ In operation - GPS time setting matrix processing
+@outline GPS time setting matrix processing during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalSettingTime(void) {
+ POSITIONING_LOG("DEV_Gps_Normal_SettingTime");
+ DevGpsCommSettingTime();
+ /** Send the command */
+ SendSaveCmdGpsCommon();
+
+ return;
+}
+
+/* start #GPF_60_109 */
+/******************************************************************************
+@brief DEV_Gps_Normal_NmeaDataGuardTimeOut<BR>
+ In operation - NMEA monitoring timeout matrix processing
+@outline NMEA data-providing guard monitoring timeout process during operation
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsNormalNmeaDataGuardTimeOut(void) {
+}
+
+/**
+ * @brief
+ * In operation - Backup memory read request matrix processing
+ */
+void DevGpsNormalBackupDataLoadReq(void) {
+ POS_DATETIME st_date_time;
+ memset(&st_date_time, 0x00, sizeof(st_date_time));
+ /* Import GPS date and time settings */
+ DevGpsReadGpsTime(&st_date_time);
+ // Todo For test don't need gstGpsFixCnt??
+ // DEV_Gps_ReadGpsFixCnt(); /* Read GPS fix count */
+ if (g_is_gpstime_sts == TRUE) {
+ DevGpsSettingTime(&st_date_time); /* Time setting */
+ }
+ return;
+}
+
+/**
+ * @brief
+ * In operation - Thread stop request matrix processing
+ */
+void DevGpsNormalStopReq(void) {
+ /* Thread stop processing */
+ StopThreadGpsCommon();
+
+ return;
+}
+
+/**
+ * @brief
+ * In operation - GPS week adjustment counter notification process
+ */
+void DevGpsNormalGpsweekcorcntNtf(void) {
+ DevGpsSetGpsweekcorcnt();
+ return;
+}
+
+/**
+ * @brief
+ * In operation - GPS recovery timeout processing
+ */
+void DevGpsNormalRecoveryTimeOut(void) {
+}
+
+/**
+ * @brief
+ * In operation - GPS receiver anomaly detection timeout processing
+ */
+void DevGpsNormalGpsReceiverErrTimeOut(void) {
+ BOOL* pb_rcverr = &(g_gps_mngr.rcv_err_flag); /* GSP receiver error detection status */
+
+ *pb_rcverr = TRUE;
+ DevSendGpsConnectError(TRUE);
+ return;
+}
+
+/* ++ #GPF_60_040 */
+/******************************************************************************
+@brief DEV_Gps_Send_SendReq<BR>
+ Sending - Transmit request reception matrix function
+@outline Processing for receiving a transmission request during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendSendReq(void) {
+ SendReqGpsCommon();
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_GPSResetReq<BR>
+ Sending - GPS reset request reception matrix function
+@outline Processing when receiving a GPS reset request during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendGPSResetReq(void) {
+ GPSResetReqGpsCommon();
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_RcvCyclCmd<BR>
+ Sending - Cyclic receive command receive matrix function
+@outline Processing at the reception of cyclic reception command during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendRcvCyclCmd(void) {
+ /* Cyclic reception data monitoring timer stopped */
+ DevGpsTimeStop(GPS_CYCL_TIMER);
+
+ /* GPS receiver anomaly detection timer stopped */
+ DevGpsTimeStop(GPS_RECEIVERERR_TIMER);
+
+ /* Notify Vehicle Sensor */
+ if (g_gps_reset_cmd_sending == FALSE) {
+ DevGpsRcvCyclCmd();
+ }
+
+ /* Reset retry counter */
+ RtyResetGpsCommon();
+
+ /* Cyclic reception data monitoring timer setting */
+ (void)DevGpsTimeSet(GPS_CYCL_TIMER);
+
+ (void)DevGpsTimeSet(GPS_RECEIVERERR_TIMER);
+
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_RcvRspCmd<BR>
+ Sending - Response command reception matrix function
+@outline Processing when receiving a response command during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendRcvRspCmd(void) {
+ TG_GPS_OUTPUT_FORMAT rcv_cmd = g_gps_mngr.rcv_cmd;
+ BOOL b_snd_flag = TRUE;
+
+ /** Check whether the command matches the command being monitored. */
+ if (rcv_cmd == g_gps_mngr.resp_cmd) {
+ /** When the command being monitored is a cold start request */
+ if (g_gps_mngr.resp_rst_flag == GPS_CMD_RESET) {
+ POSITIONING_LOG("GPS_CMD_RESET\n");
+ b_snd_flag = DevGpsRcvProcGpsResetResp(reinterpret_cast<TG_GPS_RCV_DATA*>
+ (reinterpret_cast<void*>(g_gps_msg_rcvr.msgdat)));
+ } else if (g_gps_mngr.resp_rst_flag == GPS_CMD_TIMESET) {
+ POSITIONING_LOG("GPS_CMD_TIMESET\n");
+ DevGpsRcvProcTimeSetResp(reinterpret_cast<TG_GPS_RCV_DATA*>
+ (reinterpret_cast<void*>(g_gps_msg_rcvr.msgdat)));
+ } else if (g_gps_mngr.resp_rst_flag == GPS_CMD_SENTENCEADD_NAVTIMEUTC) {
+ POSITIONING_LOG("GPS_CMD_SENTENCEADD_NAVTIMEUTC\n");
+ DevGpsRcvProcNavSvinfoAddResp(reinterpret_cast<TG_GPS_RCV_DATA*>
+ (reinterpret_cast<void*>(g_gps_msg_rcvr.msgdat)));
+ } else if ( g_gps_mngr.resp_rst_flag == GPS_CMD_WKNROLLOVER ) {
+ POSITIONING_LOG("GPS_CMD_WKNROLLOVER\n");
+ DevGpsRcvProcWknRolloverGetResp(reinterpret_cast<TG_GPS_RCV_DATA*>
+ (reinterpret_cast<void*>(g_gps_msg_rcvr.msgdat)));
+ } else {
+ POSITIONING_LOG("g_gps_mngr.resp_rst_flag INVALID!! [resp_rst_flag = %d]", g_gps_mngr.resp_rst_flag);
+ }
+
+ if (b_snd_flag == TRUE) {
+ /** Stop ACK monitoring timer */
+ DevGpsTimeStop(GPS_RECV_ACK_TIMER);
+ /* State transition processing(in operation) */
+ ChangeStatusGpsCommon(GPS_STS_NORMAL);
+ /** Reset retry counter */
+ SendRtyResetGpsCommon();
+ /** Delete command from pending buffer */
+ DeleteSaveCmdGpsCommon();
+ /* Sending pending commands */
+ SendSaveCmdGpsCommon();
+ }
+ } else {
+ }
+
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_RspDataTimeOut<BR>
+ Sending - Response monitoring timeout reception matrix function
+@outline Processing at reception of response monitoring timeout during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendRspDataTimeOut(void) {
+ DevGpsTimeStop(GPS_RECV_ACK_TIMER);
+ /** Send retry count */
+ g_gps_mngr.sndcnt++;
+
+ /** Retry judgment */
+ if (g_gps_mngr.sndcnt == SNDNG_MAX) {
+ /** At the time of retry */
+ POSITIONING_LOG("GPS Hw Reset : sndcnt[%d]", g_gps_mngr.sndcnt);
+
+ /** When the command being monitored is a cold start request */
+ if (g_gps_mngr.resp_rst_flag == GPS_CMD_RESET) {
+ POSITIONING_LOG("g_gps_mngr.sndcnt == SNDNG_MAX (GPS_CMD_RESET)");
+ /** Send Reset ResponseCommunication error */
+ DevGpsRstAnsSend(g_gps_mngr.resp_pno, g_gps_mngr.resp_rid, GPS_SENDNG);
+ g_gps_reset_cmd_sending = FALSE;
+
+ } else if (g_gps_mngr.resp_rst_flag == GPS_CMD_TIMESET) {
+ POSITIONING_LOG("g_gps_mngr.sndcnt == SNDNG_MAX (GPS_CMD_TIMESET)");
+ DevGpsTimesetAnsSend(g_gps_mngr.resp_pno, g_gps_mngr.resp_rid, GPS_SENDNG);
+ } else if (g_gps_mngr.resp_rst_flag == GPS_CMD_SENTENCEADD_NAVTIMEUTC) {
+ POSITIONING_LOG("g_gps_mngr.sndcnt == SNDNG_MAX (GPS_CMD_SENTENCEADD_NAVTIMEUTC)");
+ DevGpsNavTimeUTCAddReq(); /* Retransmission of requests to add NAV-SVINFO commands */
+ } else if (g_gps_mngr.resp_rst_flag == GPS_CMD_WKNROLLOVER) { /* GPS rollover reference date acquisition response */
+ POSITIONING_LOG("g_gps_mngr.sndcnt == SNDNG_MAX (GPS_CMD_WKNROLLOVER)");
+ DevGpsWknRolloverGetReq(); /* GPS rollover standard week number acquisition request retransmission */
+ } else {
+ POSITIONING_LOG("g_gps_mngr.resp_rst_flag INVALID!! [resp_rst_flag = %d]", g_gps_mngr.resp_rst_flag);
+ }
+
+ DeleteSaveCmdGpsCommon();
+
+ ChangeStatusGpsCommon(GPS_STS_NORMAL);
+
+ SendSaveCmdGpsCommon();
+ /** Reset retry counter */
+ SendRtyResetGpsCommon();
+ } else {
+ POSITIONING_LOG("GPS Send Retry : sndcnt[%d]", g_gps_mngr.sndcnt);
+ /** Retransmission of pending command */
+ SendSaveCmdGpsCommon();
+ }
+
+ return;
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_CyclDataTimeOut<BR>
+ Sending - Reception cycle data monitoring timeout matrix function
+@outline Processing when receiving periodic reception data monitoring timeout during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendCyclDataTimeOut(void) {
+ CyclDataTimeOutGpsCommon();
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_NaviDataTimeOut<BR>
+ Sending - Navigation providing data monitoring timeout matrix function
+@outline Navigation providing data monitoring timeout matrix processing during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendNaviDataTimeOut(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_DiagClkGuardTimeOut<BR>
+ Sending - Time guard monitoring timeout matrix functions provided by diagnosis
+@outline Diagnosis providing time guard monitoring timeout matrix process during sending
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendDiagClkGuardTimeOut(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_AccOffStart<BR>
+ Sending - Feature ACC-OFF instruction reception matrix functions
+@outline Processing when receiving ACC-OFF instruction in function being transmitted
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendAccOffStart(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_NaviInfoDeliver<BR>
+ Sending - Navigation information provision matrix processing
+@outline Navigation information provision matrix processing during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendNaviInfoDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_NaviSpeedDeliver<BR>
+ Sending - Navigation vehicle speed information provision matrix processing
+@outline Navigation vehicle speed information provision matrix processing during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendNaviSpeedDeliver(void) {
+}
+
+/******************************************************************************
+@brief DEV_Gps_Send_SettingTime<BR>
+ Sending - GPS time setting matrix processing
+@outline GPS time setting matrix processing during transmission
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendSettingTime(void) {
+ DevGpsCommSettingTime();
+ return;
+}
+
+/* start #GPF_60_109 */
+/******************************************************************************
+@brief DEV_Gps_Send_NmeaDataGuardTimeOut<BR>
+ Sending - NMEA monitoring timeout matrix processing
+@outline Sending NMEA monitoring timeouts
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsSendNmeaDataGuardTimeOut(void) {
+}
+
+/**
+ * @brief
+ * Sending - Backup memory read request matrix processing
+ */
+void DevGpsSendBackupDataLoadReq(void) {
+ POS_DATETIME st_date_time;
+
+ memset(&st_date_time, 0x00, sizeof(st_date_time));
+ /* Import GPS date and time settings */
+ DevGpsReadGpsTime(&st_date_time);
+ // Todo For test don't need gstGpsFixCnt??
+ // DEV_Gps_ReadGpsFixCnt(); /* Read GPS fix count */
+ if (g_is_gpstime_sts == TRUE) {
+ DevGpsSettingTime(&st_date_time); /* Time setting */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Sending - Thread stop request matrix processing
+ */
+void DevGpsSendStopReq(void) {
+ /* Thread stop processing */
+ StopThreadGpsCommon();
+ return;
+}
+
+/**
+ * @brief
+ * Sending - GPS week adjustment counter notification process
+ */
+void DevGpsSendGpsweekcorcntNtf(void) {
+ DevGpsSetGpsweekcorcnt();
+ return;
+}
+
+/**
+ * @brief
+ * Sending - GPS recovery timeout processing
+ */
+void DevGpsSendRecoveryTimeOut(void) {
+ return;
+}
+
+/**
+ * @brief
+ * Sending - GPS receiver anomaly detection timeout processing
+ */
+void DevGpsSendGpsReceiverErrTimeOut(void) {
+ BOOL* pb_rcverr = &(g_gps_mngr.rcv_err_flag); /* GSP receiver error detection status */
+
+ *pb_rcverr = TRUE;
+ DevSendGpsConnectError(TRUE);
+ return;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Nmea.cpp b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Nmea.cpp
new file mode 100755
index 0000000..60fa1d8
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_Nmea.cpp
@@ -0,0 +1,928 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_Nmea.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "MDev_Gps_Nmea.h"
+#include "positioning_common.h"
+#include "MDev_Gps_API.h"
+#include "MDev_Gps_Main.h"
+#include "MDev_GpsRecv.h"
+#include "MDev_Gps_Common.h"
+#include "MDev_GpsRollOver.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+#define ROLOVR_GPSWEEKCOR_NG 0xFF /* WEEK COMP. CORRECT CORRECTOR INVALUE */
+#define TMT_TGET_INI_INTERVAL (100) /* GPS time compensation interval immediately after startup (value with 10[msec] as 1) */
+#define TMT_DISCONTINUITY_TIME_TOUT_SEQ (0x5051) /* Sequence number of GPS time acquisition timeout based on date/time discontinuity */
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+static TG_GPS_RCVDATA g_st_gpscycle_data;
+u_int8 g_gps_week_cor_cnt = ROLOVR_GPSWEEKCOR_NG;
+
+extern uint8_t g_gpstime_raw_tdsts;
+
+const TG_GPS_CMD_ANA_TBL kGpsCmdAnaTblUblox[MDEV_GPSCMDANATBLNMEA_MAX] = {
+ /* Sentences Maximum length Receiving type Presence of notification Receive Format */
+ /* NMEA */
+ {{GPS_CMD_NMEA_RMC}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_RMC }, /* RMC information */
+ {{GPS_CMD_NMEA_VTG}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_VTG }, /* VTG information */
+ {{GPS_CMD_NMEA_GGA}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GGA }, /* GGA information */
+ {{GPS_CMD_NMEA_GSA}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSA }, /* GSA information */
+ {{GPS_CMD_NMEA_GSV_1}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSV1 }, /* GSV information1 */
+ {{GPS_CMD_NMEA_GSV_2}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSV2 }, /* GSV information2 */
+ {{GPS_CMD_NMEA_GSV_3}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSV3 }, /* GSV information3 */
+ {{GPS_CMD_NMEA_GSV_4}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSV4 }, /* GSV information4 */
+ {{GPS_CMD_NMEA_GSV_5}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GSV5 }, /* GSV information5 */
+ {{GPS_CMD_NMEA_GLL}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GLL }, /* GLL information */
+ {{GPS_CMD_NMEA_GST}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_GST }, /* GST information */
+ /* UBX */
+ {{0xB5, 0x62, 0x0A, 0x04}, GPS_NMEA_MAX_SZ, RCV_RESP, TRUE, GPS_FORMAT_MON_VER }, /* MON-VER */
+ {{0xB5, 0x62, 0x0B, 0x01}, GPS_NMEA_MAX_SZ, RCV_RESP, TRUE, GPS_FORMAT_AID_INI }, /* AID-INI */
+ {{0xB5, 0x62, 0x05 }, GPS_NMEA_MAX_SZ, RCV_RESP, TRUE, GPS_FORMAT_ACK_ACKNACK }, /* ACK-ACKNACK */
+ {{0xB5, 0x62, 0x01, 0x21}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_NAV_TIMEUTC }, /* NAV-TIMEUTC */
+ {{0xB5, 0x62, 0x01, 0x22}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_NAV_CLOCK }, /* NAV-CLOCK */
+ {{0xB5, 0x62, 0x02, 0x23}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_RXM_RTC5 }, /* RXM-RTC5 */
+ {{0xB5, 0x62, 0x01, 0x30}, GPS_NMEA_MAX_SZ, RCV_CYCLE, TRUE, GPS_FORMAT_NAV_SVINFO }, /* NAV-SVINFO */
+ {{0xB5, 0x62, 0x06, 0x23}, GPS_NMEA_MAX_SZ, RCV_RESP, TRUE, GPS_FORMAT_CFG_NAVX5 }, /* CFG-NAVX5 */
+ {{ENDMARK}, 0, 0, FALSE, GPS_FORMAT_MIN } /* Table termination */
+};
+
+/*---------------------------------------------------------------------------*/
+// Functions
+/**
+ * @brief
+ * Time Calculation Process Considering Rollover
+ *
+ * @param[in/out]
+ *
+ * @return none
+ * @retval none
+ */
+static BOOL DevCalcRollOverTime(TG_TIM_ROLOVR_YMD* base_ymd, TG_TIM_ROLOVR_YMD* conv_ymd) {
+ BOOL ret = TRUE;
+ static u_int16 year_old = 0;
+ static u_int16 confirm_cnt = 0;
+ u_int8 gps_week_corr = g_gps_week_cor_cnt;
+
+ if (gps_week_corr == ROLOVR_GPSWEEKCOR_NG) {
+ gps_week_corr = 0;
+ ret = FALSE;
+ } else {
+ if (year_old > base_ymd->year) {
+ confirm_cnt++;
+ if (confirm_cnt >= 10) {
+ confirm_cnt = 0;
+ year_old = base_ymd->year;
+ g_gps_week_cor_cnt = ROLOVR_GPSWEEKCOR_NG;
+ /* Starting the GPS time acquisition timer (1 second timer) based on date/time discontinuity */
+ _pb_ReqTimerStart(PNO_CLK_GPS, TMT_DISCONTINUITY_TIME_TOUT_SEQ, TIMER_TYPE_USN, TMT_TGET_INI_INTERVAL);
+ }
+ ret = FALSE;
+ } else {
+ confirm_cnt = 0;
+ year_old = base_ymd->year;
+ }
+ }
+ /* Calculate time for rollover */
+ GPSRollOverConvTime(base_ymd, conv_ymd, gps_week_corr);
+
+ return ret;
+}
+/******************************************************************************************************/
+
+
+/**
+ * @brief
+ * NMEA data notification
+ */
+void DevGpsSndCycleDataNmea(void) {
+ /* Notifying vehicle sensor of NMEA */
+
+ MDEV_GPS_NMEA st_nmea;
+ TG_GPS_NMEA_INFO st_gps_nmea_info;
+ RET_API l_ret = RET_NORMAL;
+ BOOL b_get = FALSE;
+ u_int8 uc_nmea_data[GPS_NMEA_MAX_SZ];
+ u_int32 ul_strlen = 0;
+ u_int16 us_offset = sizeof(TG_GPS_NMEA_INFO);
+
+ memset(&st_nmea, 0x00, sizeof(st_nmea) ); /* QAC 3200 */
+ memset(&st_gps_nmea_info, 0x00, sizeof(st_gps_nmea_info) ); /* QAC 3200 */
+ memset(uc_nmea_data, 0x00, sizeof(uc_nmea_data) ); /* QAC 3200 */
+
+ /* Get received NMEA data from storage area(GGA) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GGA);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GGA; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GGA].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GGA].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GLL) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GLL);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GLL; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GLL].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GLL].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSA) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GSA);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSA1; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSA1].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSA1].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GST) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GST);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GST; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GST].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GST].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(RMC) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_RMC);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_RMC; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_RMC].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_RMC].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(VTG) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_VTG);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_VTG; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_VTG].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_VTG].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSV1) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GSV1);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSV1; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV1].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV1].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSV2) */
+ b_get = DevGpsCycleDataGetNmea( uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GSV2 );
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSV2; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen); /* Data storage */
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV2].uc_size = (u_int8)ul_strlen;
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV2].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSV3) */
+ b_get = DevGpsCycleDataGetNmea( uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_GSV3 );
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSV3; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV3].uc_size = static_cast<u_int8>(ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV3].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSV4) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GSV4);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSV4; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV4].uc_size = static_cast<u_int8>(ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV4].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ /* Get received NMEA data from storage area(GSV5) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GSV5);
+ if (b_get == TRUE) {
+ /* Data present */
+ st_gps_nmea_info.ul_rcvsts |= POS_SNS_GPS_NMEA_GSV5; /* Receive flag */
+ ul_strlen = strlen(reinterpret_cast<const char *>(uc_nmea_data)); /* QAC 310 */
+ if (ul_strlen > GPS_NMEA_MAX_SZ) {
+ ul_strlen = GPS_NMEA_MAX_SZ;
+ }
+
+ if ((us_offset + ul_strlen) < SENSOR_MSG_VSINFO_DSIZE) {
+ (void)memcpy(&(st_nmea.uc_nmea_data[us_offset]), uc_nmea_data, ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV5].uc_size = static_cast<u_int8>(ul_strlen);
+ st_gps_nmea_info.st_nmea_sentence_info[POS_SNS_GPS_NMEA_SNO_GSV5].us_offset = us_offset;
+ us_offset += (u_int16)ul_strlen;
+ }
+ }
+
+ if (0 != st_gps_nmea_info.ul_rcvsts) {
+ /* Receive flag */
+ (void)memcpy(&(st_nmea.uc_nmea_data[0]), &st_gps_nmea_info, sizeof(st_gps_nmea_info));
+
+ /* Provided to vehicle sensor */
+ l_ret = SendNmeaGps(&st_nmea);
+
+ if (RET_NORMAL != l_ret) {
+ POSITIONING_LOG("SendNmeaGps SndMsg Error\n");
+ }
+ } else {
+ /* Do not provide to vehicle sensor when data acquisition fails or no data */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Analysis of the received command
+ */
+void DevGpsRcvCyclCmd(void) {
+ int32 i_ret = 0;
+ TG_GPS_OUTPUT_FORMAT e_format = GPS_FORMAT_MIN;
+
+ TG_GPS_RCV_DATA st_rcv_data; /* Pointer to the received message */
+ (void)memcpy(&st_rcv_data, &(g_gps_msg_rcvr.msgdat[0]), sizeof(st_rcv_data) ); /* QAC 3200 */
+
+ /* Analysis of received commands */
+ i_ret = JudgeFormatGpsCommon(reinterpret_cast<u_char*>(&(st_rcv_data.bygps_data[0])),
+ static_cast<u_int32>(st_rcv_data.bydata_len),
+ &e_format);
+
+ if (i_ret == GPSRET_SNDCMD) {
+ /* For NMEA formats */
+ if ((e_format == GPS_FORMAT_RMC) ||
+ (e_format == GPS_FORMAT_VTG) ||
+ (e_format == GPS_FORMAT_GGA) ||
+ (e_format == GPS_FORMAT_GSA) ||
+ (e_format == GPS_FORMAT_GSV1) ||
+ (e_format == GPS_FORMAT_GSV2) ||
+ (e_format == GPS_FORMAT_GSV3) ||
+ (e_format == GPS_FORMAT_GSV4) ||
+ (e_format == GPS_FORMAT_GSV5) ||
+ (e_format == GPS_FORMAT_GLL) ||
+ (e_format == GPS_FORMAT_GST)) {
+ /* NMEA reception process */
+ RcvCyclCmdNmeaGpsCommon(&(st_rcv_data.bygps_data[0]), (u_int32)st_rcv_data.bydata_len, e_format);
+ } else if ((e_format == GPS_FORMAT_MON_VER) ||
+ (e_format == GPS_FORMAT_AID_INI) ||
+ (e_format == GPS_FORMAT_ACK_ACKNACK) ||
+ (e_format == GPS_FORMAT_NAV_TIMEUTC) ||
+ (e_format == GPS_FORMAT_NAV_CLOCK) ||
+ (e_format == GPS_FORMAT_RXM_RTC5) ||
+ (e_format == GPS_FORMAT_NAV_SVINFO)) {
+ /* UBX reception process */
+ RcvCyclCmdExtGpsCommon(&(st_rcv_data.bygps_data[0]), (u_int32)st_rcv_data.bydata_len, e_format);
+ } else {
+ POSITIONING_LOG("Forbidden ERROR!![e_format=%d]", (int)e_format);
+ }
+ } else if (i_ret == GPSRET_CMDERR) {
+ /* Receive command error */
+
+ /* Discard previously received data */
+ DevGpsCycleDataClear();
+ /* Initialize receive format */
+ g_rcv_format = GPS_FORMAT_MIN;
+ } else {
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Check of the received command
+ */
+void DevGpsCmdEventCheckNmea(void) {
+ u_int32 ul_cnt = 0;
+ TG_GPS_RCV_DATA st_rcv_data;
+ u_char* pub_rcv_data = NULL;
+ BOOL brk_flg = FALSE;
+
+ memset(&st_rcv_data, 0, sizeof(TG_GPS_RCV_DATA));
+ memcpy( &st_rcv_data, &(g_gps_msg_rcvr.msgdat[0]), sizeof(TG_GPS_RCV_DATA) );
+ pub_rcv_data = reinterpret_cast<u_char*>(&(st_rcv_data.bygps_data[0]));
+
+ /* Analysis of received commands */
+ for (ul_cnt = 0; ul_cnt < (u_int32)GPSCMDANATBL_MAX; ul_cnt++) {
+ /* End-of-table decision */
+ if (CheckFrontStringPartGpsCommon(reinterpret_cast<const u_char*>(ENDMARK),
+ reinterpret_cast<const u_char*>(kGpsCmdAnaTbl[ul_cnt].c_sentence)) == RET_NORMAL ) {
+ g_wrecv_err++;
+
+ /* Data error is set to Event ID. */
+ g_gps_mngr.event = (u_int32)NG;
+
+ brk_flg = TRUE;
+ } else if (CheckFrontStringPartGpsCommon(pub_rcv_data, kGpsCmdAnaTbl[ul_cnt].c_sentence) == RET_NORMAL) {
+ /* Reception type determination */
+
+ /* Using $GPRMC in responses to resets */
+ if ((g_gps_mngr.sts == GPS_STS_SENT) &&
+ (g_gps_mngr.resp_cmd == GPS_FORMAT_RMC) &&
+ (kGpsCmdAnaTbl[ul_cnt].e_rcv_format == GPS_FORMAT_RMC)) {
+ POSITIONING_LOG("Received response ($GPRMC) form GPS device.\n");
+
+ /** Response command */
+ g_gps_mngr.event = GPS_EVT_RECVRSPDAT;
+
+ /** Receive format setting */
+ g_gps_mngr.rcv_cmd = kGpsCmdAnaTbl[ul_cnt].e_rcv_format;
+ } else if (kGpsCmdAnaTbl[ul_cnt].ul_rcv_kind == RCV_CYCLE) {
+ /* Cyclic receive command */
+ g_gps_mngr.event = GPS_EVT_RECVCYCLDAT;
+
+ /* Receive format setting */
+ g_gps_mngr.rcv_cmd = kGpsCmdAnaTbl[ul_cnt].e_rcv_format;
+ } else if (kGpsCmdAnaTbl[ul_cnt].ul_rcv_kind == RCV_RESP) {
+ /** Response command */
+ g_gps_mngr.event = GPS_EVT_RECVRSPDAT;
+
+ /** Receive format setting */
+ g_gps_mngr.rcv_cmd = kGpsCmdAnaTbl[ul_cnt].e_rcv_format;
+ } else {
+ /* Undefined value */
+ /* Data error is set to Event ID. */
+ g_gps_mngr.event = (u_int32)NG;
+ }
+
+ brk_flg = TRUE;
+ }
+
+ if (brk_flg == TRUE) {
+ break;
+ }
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get GPS reception status
+ *
+ * By analyzing the last received GSA-sentence and using the satellite-number as the Satellite number
+ * Determines the reception status based on whether or not notification has been made, and returns it.
+ *
+ * @param[in] no_sv Satellite number
+ *
+ * @return NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX - Positioning not used
+ * NAVIIFNO_DIAG_GPS_RCV_STS_USEFIX - Positioning use
+ */
+u_int8 DevGpsGetGpsRcvSts(u_int8 sv) {
+ u_int8 rcv_sts = NAVIINFO_DIAG_GPS_RCV_STS_TRACHING; /* Tracking in progress */
+ u_int8 uc_nmea_data[GPS_NMEA_MAX_SZ];
+ u_int8 uc_no = 0;
+ BOOL b_get = FALSE;
+ int32 i = 0;
+
+ /* Get received NMEA data from storage area(GSA) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GSA);
+
+ if (b_get == TRUE) {
+ for (i = 0; i < GPS_NMEA_NUM_GSA_SV; i++) {
+ /* Get satellite number */
+ uc_no = (uint8_t)GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSA_SV + (u_int8)(1 * i), uc_nmea_data);
+
+ if (uc_no == sv) {
+ rcv_sts = NAVIINFO_DIAG_GPS_RCV_STS_USEFIX; /* Positioning use */
+ break;
+ }
+ }
+ }
+
+ return rcv_sts;
+}
+
+/**
+ * @brief
+ * GPS information analysis
+ *
+ * Analyzing received NMEA sentences
+ * @param[out] navilocinfo Navigation information
+ */
+void DevGpsAnalyzeNmea(NAVIINFO_ALL* navilocinfo) {
+ u_int8 uc_nmea_data[GPS_NMEA_MAX_SZ];
+ int32 no_sv = 0; /* number of Satellites in View */
+ int32 __offset = 0;
+ char utc_time[12]; /* hhmmss.sss */
+ char _date[6]; /* ddmmyy */
+ char _status = 0; /* 'V' or 'A' */
+ char indicator; /* 'N' or 'S' or 'E' or 'W' */
+ char work[8]; /* Work buffer for converting String data */
+ BOOL b_get = FALSE;
+ uint8_t fixsts = NAVIINFO_DIAG_GPS_FIX_STS_NON;
+ uint8_t fixsts_gga;
+ BOOL bvalid_lon = FALSE;
+ BOOL bvalid_lat = FALSE;
+ BOOL bvalid = FALSE;
+ TG_TIM_ROLOVR_YMD base_ymd;
+ TG_TIM_ROLOVR_YMD conv_ymd;
+ BOOL roll_over_sts;
+ u_int8 _tdsts = g_gpstime_raw_tdsts;
+
+ GpsSatelliteInfo st_visible_satellite_list[GPS_MAX_NUM_VISIBLE_SATELLITES]; /* Visible satellite list */
+ GpsSatelliteInfo st_tmp_buf;
+
+ int32 i = 0;
+ int32 j = 0;
+ int32 k = 0;
+
+ SENSORLOCATION_LONLATINFO_DAT st_lonlat;
+ SENSORLOCATION_ALTITUDEINFO_DAT st_altitude;
+ SENSORMOTION_HEADINGINFO_DAT st_heading;
+ // MDEV_GPS_RTC st_rtc;
+ SENSOR_MSG_GPSTIME st_gps_time;
+ SENSORMOTION_SPEEDINFO_DAT st_speed;
+
+ memset(&st_lonlat, 0x00, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+ memset(&st_altitude, 0x00, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+ memset(&st_heading, 0x00, sizeof(SENSORMOTION_HEADINGINFO_DAT));
+ // memset(&st_rtc, 0x00, sizeof(MDEV_GPS_RTC));
+ memset(&st_gps_time, 0x00, sizeof(SENSOR_MSG_GPSTIME));
+ memset(&st_speed, 0x00, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ /* Satellite signal strength list initialization */
+ (void)memset(st_visible_satellite_list, 0x00, sizeof(GpsSatelliteInfo) * GPS_MAX_NUM_VISIBLE_SATELLITES);
+
+ /* Get received NMEA data from storage area(GSA) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GSA);
+
+ if (b_get == TRUE) {
+ fixsts = static_cast<uint8_t>(GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSA_FS, uc_nmea_data));
+ }
+
+ /* Get received NMEA data from storage area(RMC) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data) , GPS_NMEA_INDEX_RMC);
+
+ if (b_get == TRUE) {
+ navilocinfo->stDiagGps.stFix.stWgs84.lLat =
+ GetLonLatFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_LATITUDE, uc_nmea_data, &bvalid_lat); /* GPS location information and latitude */
+
+ GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_NS, uc_nmea_data, &indicator, sizeof(indicator));
+
+ if (indicator != GPS_NMEA_RMC_IND_NORTH) {
+ navilocinfo->stDiagGps.stFix.stWgs84.lLat *= -1;
+ }
+
+ POSITIONING_LOG("lLat = %d", navilocinfo->stDiagGps.stFix.stWgs84.lLat);
+
+ navilocinfo->stDiagGps.stFix.stWgs84.lLon =
+ GetLonLatFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_LONGITUDE, uc_nmea_data, &bvalid_lon); /* GPS position information and longitude */
+
+ GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_EW, uc_nmea_data, &indicator, sizeof(indicator));
+
+ if (indicator != GPS_NMEA_RMC_IND_EAST) {
+ navilocinfo->stDiagGps.stFix.stWgs84.lLon *= -1;
+ }
+
+ st_lonlat.Longitude = navilocinfo->stDiagGps.stFix.stWgs84.lLon;
+ st_lonlat.Latitude = navilocinfo->stDiagGps.stFix.stWgs84.lLat;
+
+ POSITIONING_LOG("lLon = %d", navilocinfo->stDiagGps.stFix.stWgs84.lLon);
+
+ /* Get Date information */
+ (void)GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_DATE, uc_nmea_data, _date, 6);
+ (void)memset(&base_ymd, 0, sizeof(base_ymd)); /* QAC 3200 */
+ (void)memset(&conv_ymd, 0, sizeof(conv_ymd)); /* QAC 3200 */
+ (void)memset(work, 0, sizeof(work)); /* QAC 3200 */
+
+ (void)strncpy(work, &_date[4], 2); /* QAC 3200 */
+ base_ymd.year = (u_int16)(2000 + atoi(work)); /* YEAR */
+
+ st_gps_time.utc.year = (uint8_t)atoi(work);
+
+ (void)strncpy(work, &_date[2], 2); /* QAC 3200 */
+ base_ymd.month = (u_int16)(atoi(work)); /* MONTH */
+
+ st_gps_time.utc.month = (uint8_t)atoi(work);
+
+ (void)strncpy(work, &_date[0], 2); /* QAC 3200 */
+ base_ymd.day = (u_int16)(atoi(work)); /* DAY */
+
+ st_gps_time.utc.date = (uint8_t)atoi(work);
+
+ POSITIONING_LOG("year = %d", base_ymd.year);
+ POSITIONING_LOG("month = %d", base_ymd.month);
+ POSITIONING_LOG("date = %d", base_ymd.day);
+
+ /* UTC time information acquisition */
+ (void)GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_UTC, uc_nmea_data, utc_time, 12);
+
+ (void)strncpy(work, &utc_time[0], 2); /* QAC 3200 */
+ navilocinfo->stNaviGps.utc.hour = (uint8_t)atoi(work); /* HOUR */
+
+ st_gps_time.utc.hour = navilocinfo->stNaviGps.utc.hour;
+ POSITIONING_LOG("hour = %d", navilocinfo->stNaviGps.utc.hour);
+
+ (void)strncpy(work, &utc_time[2], 2); /* QAC 3200 */
+ navilocinfo->stNaviGps.utc.minute = (uint8_t)atoi(work); /* MINUTE */
+
+ st_gps_time.utc.minute = navilocinfo->stNaviGps.utc.minute;
+ POSITIONING_LOG("minute = %d", navilocinfo->stNaviGps.utc.minute);
+
+ (void)strncpy(work, &utc_time[4], 2); /* QAC 3200 */
+ navilocinfo->stNaviGps.utc.second = (uint8_t)atoi(work); /* SECOND */
+
+ st_gps_time.utc.second = navilocinfo->stNaviGps.utc.second;
+ POSITIONING_LOG("second = %d", navilocinfo->stNaviGps.utc.second);
+
+ /* Compass information acquisition */
+ navilocinfo->stNaviGps.heading =
+ GetHeadingFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_COG, uc_nmea_data, &bvalid);
+
+ st_heading.Heading = navilocinfo->stNaviGps.heading;
+ POSITIONING_LOG("heading = %u", navilocinfo->stNaviGps.heading);
+
+ st_speed.Speed = GetSpeedFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_SPEED, uc_nmea_data, &bvalid);
+
+ /* Fix Status/Time Status Calculation */
+ (void)GetStringFromNmeaGpsCommon(GPS_NMEA_FNO_RMC_STATUS, uc_nmea_data, &_status, sizeof(_status));
+
+ if ((_status == GPS_NMEA_RMC_STS_VALID) && (bvalid_lat == TRUE) && (bvalid_lon == TRUE)) {
+ /* Fix status information */
+ switch (fixsts) {
+ case GPS_NMEA_GSA_FIX_STS_NON:
+ navilocinfo->stDiagGps.stFix.ucFixSts = NAVIINFO_DIAG_GPS_FIX_STS_NON;
+ break;
+ case GPS_NMEA_GSA_FIX_STS_2D:
+ navilocinfo->stDiagGps.stFix.ucFixSts = NAVIINFO_DIAG_GPS_FIX_STS_2D;
+ break;
+ case GPS_NMEA_GSA_FIX_STS_3D:
+ navilocinfo->stDiagGps.stFix.ucFixSts = NAVIINFO_DIAG_GPS_FIX_STS_3D;
+ break;
+ default:
+ POSITIONING_LOG("GSA Nav Mode Error [fixsts:%d]", fixsts);
+ break;
+ }
+
+ if (_tdsts == POS_TIMESTS_OK) {
+ roll_over_sts = DevCalcRollOverTime(&base_ymd, &conv_ymd);
+ navilocinfo->stNaviGps.utc.year = conv_ymd.year; /* year (after conversion) */
+ navilocinfo->stNaviGps.utc.month = (u_int8)(conv_ymd.month); /* month (after conversion) */
+ navilocinfo->stNaviGps.utc.date = (u_int8)(conv_ymd.day); /* dat (after conversion) */
+ if (roll_over_sts == FALSE) {
+ navilocinfo->stNaviGps.tdsts = POS_TIMESTS_NG;
+ /* Reserve[0] is time setting information: anomaly time, but can be calculated by rolling over. */
+ navilocinfo->stNaviGps.reserve[0] = GPS_TIME_ROLOVR;
+ } else {
+ /* When the location information is normal, the time information is also judged to be normal. */
+ navilocinfo->stNaviGps.tdsts = POS_TIMESTS_OK; /* Time calibration completed */
+ /* Reserve[0] is time setting information: Use time status received from GPS device. */
+ navilocinfo->stNaviGps.reserve[0] = GPS_TIME_RX;
+ }
+ } else {
+ navilocinfo->stNaviGps.tdsts = POS_TIMESTS_NG; /* Time uncalibrated */
+ /* Reserve[0] is time setting information: Use time status received from GPS device. */
+ navilocinfo->stNaviGps.reserve[0] = GPS_TIME_RX;
+ navilocinfo->stNaviGps.utc.year = base_ymd.year; /* year(after conversion) */
+ navilocinfo->stNaviGps.utc.month = (u_int8)(base_ymd.month); /* month (after conversion) */
+ navilocinfo->stNaviGps.utc.date = (u_int8)(base_ymd.day); /* day (after conversion) */
+ }
+
+ if (bvalid != TRUE) {
+ /* Invalid value if measurement orientation is invalid. */
+ navilocinfo->stNaviGps.heading = GPS_HEADING_INVALID_VAL;
+ // POSITIONING_LOG("RMC Heading[cog] Invalid");
+ }
+ } else {
+ /* Fix status information: Non-position fix is set regardless of FS of GSA. */
+ navilocinfo->stDiagGps.stFix.ucFixSts = NAVIINFO_DIAG_GPS_FIX_STS_NON;
+ /* If the location information is invalid, the time information is also judged to be invalid. */
+ /* Time not calibrated after receiver reset (time entry or master reset or CSF activation) */
+ navilocinfo->stNaviGps.tdsts = POS_TIMESTS_NG;
+ /* Reserve[0] is time setting information: Use time status received from GPS device. */
+ navilocinfo->stNaviGps.reserve[0] = GPS_TIME_RX;
+ navilocinfo->stNaviGps.utc.year = base_ymd.year; /* year (after conversion) */
+ navilocinfo->stNaviGps.utc.month = (u_int8)(base_ymd.month); /* month (after conversion) */
+ navilocinfo->stNaviGps.utc.date = (u_int8)(base_ymd.day); /* day (after conversion) */
+ // POSITIONING_LOG("RMC Invalid[status:%d, bvalidLat:%d, bvalidLon:%d]", _status, bvalid_lat, bvalid_lon);
+ }
+
+ // POSITIONING_LOG("year(Fix) = %d", navilocinfo->stNaviGps.utc.year);
+ // POSITIONING_LOG("month(Fix) = %d", navilocinfo->stNaviGps.utc.month);
+ // POSITIONING_LOG("date(Fix) = %d", navilocinfo->stNaviGps.utc.date);
+ // POSITIONING_LOG("tdsts = %d", navilocinfo->stNaviGps.tdsts);
+ }
+
+ /* Get received NMEA data from storage area(GGA) */
+ b_get = DevGpsCycleDataGetNmea(uc_nmea_data, sizeof(uc_nmea_data), GPS_NMEA_INDEX_GGA);
+
+ if (b_get == TRUE) {
+ /* Data status acquisition */
+ fixsts_gga = (uint8_t)GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GGA_FS, uc_nmea_data);
+
+ /* Altitude information acquisition */
+ if (((fixsts == GPS_NMEA_GSA_FIX_STS_2D) ||
+ (fixsts == GPS_NMEA_GSA_FIX_STS_3D)) &&
+ ((fixsts_gga == GPS_NMEA_GGA_FIX_STATUS_GPS) ||
+ (fixsts_gga == GPS_NMEA_GGA_FIX_STATUS_DGPS) ||
+ (fixsts_gga == GPS_NMEA_GGA_FIX_STATUS_DR))) {
+ navilocinfo->stNaviGps.altitude =
+ GetAltitudeFromNmeaGpsCommon(GPS_NMEA_FNO_GGA_MSL, uc_nmea_data, &bvalid);
+
+ if (bvalid != TRUE) {
+ /* If the location information is invalid, set an invalid value. */
+ navilocinfo->stNaviGps.altitude = GPS_ALTITUDE_INVALID_VAL;
+ // POSITIONING_LOG("GGA Altitude[msl] Invalid");
+ }
+ } else {
+ /* If the location information is invalid, set an invalid value. */
+ navilocinfo->stNaviGps.altitude = GPS_ALTITUDE_INVALID_VAL;
+ // POSITIONING_LOG("GGA Invalid[fixsts:%d, fixstsGGA:%d]", fixsts, fixsts_gga);
+ }
+
+ st_altitude.Altitude = navilocinfo->stNaviGps.altitude;
+ // POSITIONING_LOG("altitude = %d", navilocinfo->stNaviGps.altitude);
+ }
+
+ DevGpsCnvLonLatNavi(&st_lonlat, navilocinfo->stDiagGps.stFix.ucFixSts, navilocinfo->stDiagGps.stFix.stWgs84.lLon,
+ navilocinfo->stDiagGps.stFix.stWgs84.lLat);
+
+ DevGpsCnvAltitudeNavi(&st_altitude, navilocinfo->stDiagGps.stFix.ucFixSts, navilocinfo->stNaviGps.altitude);
+
+ DevGpsCnvHeadingNavi(&st_heading, navilocinfo->stDiagGps.stFix.ucFixSts, navilocinfo->stNaviGps.heading);
+
+ SendCustomGps(&st_gps_time, &st_lonlat, &st_altitude, &st_heading, &navilocinfo->stDiagGps);
+ // For test todo don't needed
+ // SendTimeGps(&st_rtc);
+ // SendSpeedGps(&st_speed, 0);
+
+ /* Create visual satellite information list from GSV1~GSV5 and GSV */
+ for (i = 0; i < 5; i++) {
+ /* Get received NMEA data from storage area */
+ b_get = DevGpsCycleDataGetNmea( uc_nmea_data, sizeof(uc_nmea_data),
+ (ENUM_GPS_NMEA_INDEX)(GPS_NMEA_INDEX_GSV1 + i));
+
+ if (b_get == TRUE) {
+ /* Get number of Satellites in View */
+ no_sv = GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSV_NOSV, uc_nmea_data);
+
+ for (j = 0; j < GPS_NMEA_NUM_GSV_SINFO; j++) {
+ if (__offset >= no_sv) {
+ break;
+ }
+
+ st_visible_satellite_list[__offset].sv = static_cast<uint8_t>(
+ GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSV_SV + (u_int8)(4 * j), uc_nmea_data)); /* Satellite information_No */
+ st_visible_satellite_list[__offset].elv = static_cast<uint8_t>(
+ GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSV_ELV + (u_int8)(4 * j), uc_nmea_data)); /* Satellite information_elevation */
+ st_visible_satellite_list[__offset].az = static_cast<uint16_t>(
+ GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSV_AZ + (u_int8)(4 * j), uc_nmea_data)); /* Satellite Information_Azimuth */
+ st_visible_satellite_list[__offset].cno = static_cast<uint8_t>(
+ GetIntegerFromNmeaGpsCommon(GPS_NMEA_FNO_GSV_CNO + (u_int8)(4 * j), uc_nmea_data)); /* Satellite information_level */
+ st_visible_satellite_list[__offset].sts = DevGpsGetGpsRcvSts(st_visible_satellite_list[__offset].sv);
+
+ /* Sort in ascending order of status (priority to use fix) and received signal strength */
+ for (k = __offset; k > 0; k--) {
+ if (((st_visible_satellite_list[k].sts == NAVIINFO_DIAG_GPS_RCV_STS_USEFIX) &&
+ (st_visible_satellite_list[k - 1].sts == NAVIINFO_DIAG_GPS_RCV_STS_TRACHING)) ||
+ ((st_visible_satellite_list[k - 1].sts == st_visible_satellite_list[k].sts) &&
+ (st_visible_satellite_list[k].cno > st_visible_satellite_list[k - 1].cno))) {
+ (void)memcpy(&st_tmp_buf, &st_visible_satellite_list[k], sizeof(GpsSatelliteInfo));
+ (void)memcpy(&st_visible_satellite_list[k], &st_visible_satellite_list[k - 1], sizeof(GpsSatelliteInfo));
+ (void)memcpy(&st_visible_satellite_list[k - 1], &st_tmp_buf, sizeof(GpsSatelliteInfo));
+ } else {
+ break;
+ }
+ }
+
+ __offset++;
+ }
+ }
+ }
+
+ return;
+}
+
+/****************************************************************************
+@brief DevGpsCycleDataClear<BR>
+ Cyclic data storage area clear processing
+@outline Clear the cyclic data storage area
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsCycleDataClear(void) {
+ int32 i = 0;
+
+ /* Sensor counter, reception flag initialization */
+ g_st_gpscycle_data.uc_sns_cnt = 0;
+
+ for (i = 0; i < GPS_NMEA_INDEX_MAX; i++) {
+ g_st_gpscycle_data.st_nmea_data.uc_rcv_flag[i] = GPS_CYCLECMD_NOTRCV;
+ }
+
+ g_st_gpscycle_data.st_binary_data.uc_rcv_flag = GPS_CYCLECMD_NOTRCV;
+ g_st_gpscycle_data.st_fullbin_data.uc_rcv_flag = GPS_CYCLECMD_NOTRCV;
+}
+
+/******************************************************************************
+@brief DEV_Gps_CycleData_SetNmea<BR>
+ NMEA data setting process
+@outline Set NMEA data in cyclic data storage area
+@param[in] u_int8* : p_data ... NMEA data to be set
+@param[in] u_int32 : ul_length ... Data length
+@param[in] ENUM_GPS_NMEA_INDEX: e_format ... Sentence identification
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void DevGpsCycleDataSetNmea(const u_int8* p_data, u_int32 ul_length, ENUM_GPS_NMEA_INDEX e_format) {
+ u_int32 ul_copy_sz = 0;
+
+ /** Anomaly detection */
+ if (e_format >= GPS_NMEA_INDEX_MAX) {
+ POSITIONING_LOG("# GpsCommCtl_API # Set NMEA Sentence ERROR ! \r\n");
+ } else {
+ /** Storage size determination */
+ if (GPS_NMEA_MAX_SZ < ul_length) {
+ ul_copy_sz = GPS_NMEA_MAX_SZ;
+ POSITIONING_LOG("# GpsCommCtl_API # Set NMEA Cmd Size ERROR ! \r\n");
+ } else {
+ ul_copy_sz = ul_length;
+ }
+
+ /** Storing */
+ g_st_gpscycle_data.st_nmea_data.uc_rcv_flag[e_format] = GPS_CYCLECMD_RCV;
+ memset(&(g_st_gpscycle_data.st_nmea_data.st_nmea[e_format].uc_data[0]), 0x00, GPS_NMEA_MAX_SZ);
+ memcpy(&(g_st_gpscycle_data.st_nmea_data.st_nmea[e_format].uc_data[0]), p_data, ul_copy_sz);
+ }
+
+ return;
+}
+
+/******************************************************************************
+@brief DevGpsCycleDataGetNmea<BR>
+ NMEA data setting process
+@outline Set NMEA data in cyclic data storage area
+@param[in] u_int32 : ul_buf_size ... Storage destination buffer size
+@param[in] ENUM_GPS_NMEA_INDEX: e_format ... Sentence identification
+@param[out] u_int8* : p_data ... Storage destination buffer pointer
+@return BOOL
+@retval TRUE : Data present
+@retval FALSE : No data
+*******************************************************************************/
+BOOL DevGpsCycleDataGetNmea(u_int8 *p_data, u_int32 ul_buf_size, ENUM_GPS_NMEA_INDEX e_format) {
+ BOOL ret = TRUE;
+
+ /** Determining whether data exists in the cyclic data area */
+ if (GPS_CYCLECMD_RCV == g_st_gpscycle_data.st_nmea_data.uc_rcv_flag[e_format]) {
+ if (GPS_NMEA_MAX_SZ <= ul_buf_size) {
+ /** Copy to storage destination buffer */
+ memcpy(p_data, &(g_st_gpscycle_data.st_nmea_data.st_nmea[e_format].uc_data[0]), GPS_NMEA_MAX_SZ);
+ } else {
+ /** Storage destination buffer size is small */
+ ret = FALSE;
+ }
+ } else {
+ /** Not received */
+ ret = FALSE;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Setting of the check sum
+ *
+ * @param[in] buffer Pointer of data
+ * @param[in] length length of data
+ */
+void DevGpsSetChkSum(u_int8* buffer, u_int32 length) {
+ u_int16 i = 0;
+ u_int8 ck_a = 0;
+ u_int8 ck_b = 0;
+
+ if (buffer != NULL) {
+ for (i = 2; i < (length - 2); i++) {
+ ck_a = ck_a + buffer[i];
+ ck_b = ck_b + ck_a;
+ }
+
+ /* Checksum_Set */
+ buffer[length - 2] = ck_a;
+ buffer[length - 1] = ck_b;
+ } else {
+ }
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_TimerCtrl.cpp b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_TimerCtrl.cpp
new file mode 100755
index 0000000..8dbf8dc
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/GpsCommon/MDev_Gps_TimerCtrl.cpp
@@ -0,0 +1,293 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file MDev_Gps_TimerCtrl.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "MDev_Gps_TimerCtrl.h"
+
+// #include "MDev_Gps_Main.h"
+// #include "MDev_GpsRecv.h"
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+static GPS_TIM_MNG g_st_tim_mng;
+
+/** Timer setting information table */
+static const GPS_TIM_INFO kTimInfo[TIM_NUM] = {
+ /* GSP related */
+ {TIMVAL_GPS_STARTUP, PNO_NAVI_GPS_MAIN}, /* Start confirmation monitoring timer */
+ {TIMVAL_GPS_RCVCYCLDAT, PNO_NAVI_GPS_MAIN}, /* Periodic reception data monitoring timer */
+ {TIMVAL_GPS_RCVACK, PNO_NAVI_GPS_MAIN}, /* ACK reception monitoring timer */
+ {TIMVAL_GPS_NAVIFST, PNO_NAVI_GPS_MAIN}, /* Initial Navigation Monitoring Timer */
+ {TIMVAL_GPS_NAVICYCLE, PNO_NAVI_GPS_MAIN}, /* Navi monitoring timer */
+ {TIMVAL_GPS_NAVIDISRPT, PNO_NAVI_GPS_MAIN}, /* Navigation Monitoring Disruption Log Output Timer */
+ {TIMVAL_GPS_DIAGCLKGUARD, PNO_NAVI_GPS_MAIN}, /* Diagnosis provision time guard monitoring timer */
+ {TIMVAL_GPS_NMEADATAGUARD, PNO_NAVI_GPS_MAIN}, /* NMEA data providing guard monitoring timer */
+ {TIMVAL_GPS_RECOVERY, PNO_NAVI_GPS_MAIN}, /* GPS recovery timer */
+ {TIMVAL_GPS_RECEIVERERR, PNO_NAVI_GPS_MAIN}, /* GPS receiver anomaly detection timer */
+ /* Sensor related */
+ {TIMVAL_SNS_RCVFSTDAT, PNO_VEHICLE_SENSOR}, /* Initial cyclic sensor data reception monitoring timer */
+ {TIMVAL_SNS_RCVCYCLDAT, PNO_VEHICLE_SENSOR}, /* Cyclic sensor data reception monitoring timer */
+ {TIMVAL_SNS_RCVDISRPT, PNO_VEHICLE_SENSOR}, /* Cyclic sensor data interruption log output timer */
+};
+
+/*---------------------------------------------------------------------------*/
+// Functions
+
+static uint16_t TimeMakSeqNo(GPS_TIM_KIND tim_kind) {
+ GPS_TIM_MNG* pst_tim_mng = NULL;
+ u_int16 seq_no = 0; /* Timer sequence number */
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ /*------------------------------------------------------------------------*/
+ /* Definition of Sequence Number */
+ /* |------------------- Sequence number(2Byte) -----------------------| */
+ /* 15 8 7 0 */
+ /* +-------------------------------+-----------------------------------+ */
+ /* | Timer type(1Byte) | Counter(1Byte)(0x01 ? 0xFF) | */
+ /* +-------------------------------+-----------------------------------+ */
+ /* The timer type is 0x00. ? (Number of timers-1) */
+ /* counters is 0x01 ? 0xFF(Do not use 0x00) */
+ /* (Counters are counted up each time a timer is started. */
+ /* If the counter counts up when it is 0xFF, */
+ /* be counted up from the 0x01.) */
+ /*------------------------------------------------------------------------*/
+ seq_no = ((u_int16)tim_kind << 8) | (pst_tim_mng->sts[tim_kind].cnt);
+
+ return seq_no;
+}
+
+static BOOL VehicleUtilitySetTimer(GPS_TIM_KIND tim_kind) {
+ GPS_TIM_MNG* pst_tim_mng = NULL;
+ const uint32_t * p_time_val;
+ const PNO* p_pno;
+ RET_API api_ret = RET_NORMAL;
+ u_int16 seq_no = 0;
+ BOOL ret = TRUE;
+
+ // Initialize
+ pst_tim_mng = &g_st_tim_mng;
+ p_time_val = &(kTimInfo[tim_kind].timer_val); /* Timer set value */
+ p_pno = &(kTimInfo[tim_kind].pno); /* Notify party PNO */
+
+ if (pst_tim_mng->sts[tim_kind].flag == TIMER_ON) {
+ /*-----------------------------------------------------------------------*/
+ /* When the same timer has already started, */
+ /* terminate without starting the timer because the timer is set multiple times. */
+ /*-----------------------------------------------------------------------*/
+ ret = FALSE;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* Count up the timer counter of the corresponding timer by 1. */
+ /*-----------------------------------------------------------------------*/
+ if (pst_tim_mng->sts[tim_kind].cnt >= TIM_CNTMAX) {
+ /*-----------------------------------------------------------------------*/
+ /* When the count reaches the maximum number, it counts again from 1. */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].cnt = TIM_CNTMIN;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* If the count has not reached the maximum, it is counted up. */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].cnt++;
+ }
+
+ /*-----------------------------------------------------------------------*/
+ /* Creating timer sequence numbers */
+ /*-----------------------------------------------------------------------*/
+ seq_no = TimeMakSeqNo(tim_kind);
+
+ /*-----------------------------------------------------------------------*/
+ /* Start the timer */
+ /*-----------------------------------------------------------------------*/
+ api_ret = _pb_ReqTimerStart(*p_pno, seq_no, TIMER_TYPE_USN, static_cast<u_int32>(*p_time_val));
+ if (api_ret != RET_NORMAL) {
+ ret = FALSE;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* If successful timer start, */
+ /* set the start/stop flag of the corresponding timer to start (MCSUB_ON). */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].flag = TIMER_ON;
+ }
+ }
+
+ return ret;
+}
+
+static BOOL VehicleUtilityStopTimer(GPS_TIM_KIND tim_kind) {
+ GPS_TIM_MNG* pst_tim_mng = NULL;
+ const PNO* p_pno;
+ BOOL ret = TRUE;
+ RET_API api_ret = RET_NORMAL;
+ u_int16 seq_no = 0;
+
+ // Initialize
+ pst_tim_mng = &g_st_tim_mng;
+ p_pno = &(kTimInfo[tim_kind].pno); /* Notify party PNO */
+
+ /* Check timer start/stop flag */
+ if (pst_tim_mng->sts[tim_kind].flag == TIMER_OFF) {
+ /* If it is already stopped, do nothing. */
+ ret = FALSE;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* Creating timer sequence numbers */
+ /*-----------------------------------------------------------------------*/
+ seq_no = TimeMakSeqNo(tim_kind);
+
+ /*-----------------------------------------------------------------------*/
+ /* Set the corresponding timer to stop */
+ /*-----------------------------------------------------------------------*/
+ api_ret = _pb_TimerStop(*p_pno, seq_no, TIMER_TYPE_USN);
+
+ if (api_ret != RET_NORMAL) {
+ ret = FALSE;
+ }
+
+ /*-----------------------------------------------------------------------*/
+ /* Set the start/stop flag of the corresponding timer to stop (MCSUB_OFF) */
+ /* Set the ID of the corresponding timer to invalid (DEV_TED_INVALID) */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].flag = TIMER_OFF;
+ }
+
+ return ret;
+}
+
+static BOOL VehicleUtilityTimeJdgKnd(uint16_t seqno) {
+ GPS_TIM_MNG* pst_tim_mng = NULL;
+ BOOL ret = FALSE;
+ u_int8 timekind = 0;
+ u_int8 count = 0;
+
+ // Initialize
+ pst_tim_mng = &g_st_tim_mng;
+
+ timekind = (u_int8)((seqno & 0xff00) >> 8);
+ count = (u_int8)(seqno & 0x00ff);
+
+ /* Timer type is unexpected */
+ if (timekind >= TIM_NUM) {
+ ret = FALSE;
+ } else {
+ if ((pst_tim_mng->sts[timekind].cnt == count) && (pst_tim_mng->sts[timekind].flag == TIMER_ON)) {
+ /* The counter matches and the counter start/stop flag is "Start". */
+ ret = TRUE;
+ } else {
+ /* Not applicable due to differences */
+ ret = FALSE;
+ }
+ }
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : DEV_Gps_Tim_Init
+ * ABSTRACT : Timer function initialization processing
+ * FUNCTION : Initialize the timer function
+ * ARGUMENT : None
+ * NOTE : 1.Initialize timer management table
+ * RETURN : None
+ ******************************************************************************/
+void DevGpsTimInit(void) {
+ GPS_TIM_MNG* pst_tim_mng = NULL;
+ u_int32 i = 0;
+
+ // Initialie
+ pst_tim_mng = &g_st_tim_mng;
+
+ /* Initialize timer management table */
+ memset(pst_tim_mng, 0x00, sizeof(GPS_TIM_MNG));
+
+ for (i = 0; i < TIM_NUM; i++) {
+ pst_tim_mng->sts[i].flag = TIMER_OFF;
+ pst_tim_mng->sts[i].cnt = 0;
+ }
+
+ return;
+}
+
+/*******************************************************************************
+ * MODULE : DevGpsTimeSet
+ * ABSTRACT : Timer start processing
+ * FUNCTION : Starts a timer of the specified type
+ * ARGUMENT : GPS_TIM_KIND tim_kind Timer type
+ * NOTE : 1.Increment total number of timer start
+ * 2.Timer Sequence Number Creation
+ * 3.Get timeout value
+ * 4.Timer start
+ * RETURN : TRUE : Normal completion
+ * : FALSE : ABENDs
+ ******************************************************************************/
+BOOL DevGpsTimeSet(GPS_TIM_KIND tim_kind) {
+ BOOL ret = TRUE;
+
+ /* Binding of unused timer */
+ if ((tim_kind != GPS_RECV_ACK_TIMER)
+ && (tim_kind != GPS_STARTUP_TIMER)
+ && (tim_kind != GPS_CYCL_TIMER)
+ && (tim_kind != GPS_NAVIFST_TIMER)
+ && (tim_kind != GPS_NAVICYCLE_TIMER)
+ && (tim_kind != GPS_NAVIDISRPT_TIMER)
+ && (tim_kind != GPS_RECOVERY_TIMER)
+ && (tim_kind != GPS_RECEIVERERR_TIMER)) {
+ return ret;
+ }
+ ret = VehicleUtilitySetTimer(tim_kind);
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : DevGpsTimeStop
+ * ABSTRACT : Timer stop processing
+ * FUNCTION : Stops a timer of the specified type
+ * ARGUMENT : GPS_TIM_KIND tim_kind Timer type
+ * NOTE : 1.Get the sequence number of the specified type
+ * 2.Timer stop
+ * RETURN : TRUE : Normal completion
+ * : FALSE : ABENDs
+ ******************************************************************************/
+BOOL DevGpsTimeStop(GPS_TIM_KIND tim_kind) {
+ BOOL ret = TRUE;
+ ret = VehicleUtilityStopTimer(tim_kind);
+ return ret;
+}
+
+/********************************************************************************
+ * MODULE : DevGpsTimeJdgKind
+ * ABSTRACT : Timer Sequence Number Determination
+ * FUNCTION : Determine whether the timer sequence number corresponds to the one being managed
+ * ARGUMENT : Timer Sequence Number
+ * NOTE :
+ * RETURN : TRUE : Normal completion(No problem)
+ * : FALSE : ABENDs(Unusual number)
+ ********************************************************************************/
+BOOL DevGpsTimeJdgKind(u_int16 seqno) {
+ BOOL ret;
+ ret = VehicleUtilityTimeJdgKnd(seqno);
+ return ret;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Api.cpp b/video_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Api.cpp
new file mode 100755
index 0000000..d363a4b
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Api.cpp
@@ -0,0 +1,136 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Api.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "LineSensDrv_Api.h"
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Macro definitions
+
+#define LSDRV_GPS_DATA_TOP_TH 5 // Threshold for determining the beginning of GPS data
+#define LSDRV_SENS_DATA_RCV_WAIT_TIME 400 // Sensor data wait time of GPS reception flag ON(Total)
+#define LSDRV_SENS_DATA_RCV_WAIT_TERM 50 // Sensor data wait time of GPS reception flag ON(1 time)
+
+#define LSDRV_EST_GPS_CNT_ARRAY_NUM 3U // Number of arrays for holding estimated GPS counter
+#define LSDRV_EST_GPS_CNT_ENABLE_TH 5U // Estimated GPS counter enable/disable determination threshold
+#define LSDRV_EST_GPS_CNT_ADD_VALUE 10U // Estimated GPS counter update addition value
+
+// GPS data reception cycle:1sec sensor counters: 100ms
+
+// for debug
+#define LINE_SENS_DRV_API_DEBUG_SWITCH 0 // 0:OFF 1:ON
+
+/*---------------------------------------------------------------------------*/
+// Global variable
+
+static HANDLE g_gps_irq_mutex = NULL; // GPS received flag Mutex handles
+static BOOL g_rcv_pps_int = FALSE; // PPS interrupt reception flag (GPS->_CWORD102_)
+static BOOL g_rcv_gps_irq = FALSE; // GPS reception flag (GPS->_CWORD56_)
+static u_int8 g_rcv_gps_sens_cnt_tmp = 0; // Sensor counter when GPS reception flag is ON(for retention)
+static u_int8 g_rcv_gps_sens_cnt = 0; // Sensor counter when GPS reception flag is ON
+static u_int8 g_gps_sens_cnt_top = 0; // Sensor counter when first GPS data is received
+static u_int8 g_est_gps_cnt[LSDRV_EST_GPS_CNT_ARRAY_NUM]; // Array for storing estimated GPS counter values
+static BOOL g_est_gps_cnt_available = FALSE; // Estimated GPS counter value enable/disable judgment
+
+typedef struct VehicleSensDataMaster {
+ DID ul_did; // Data ID
+ u_int16 us_size; // Size of the data
+ u_int8 uc_rcv_flag; // Receive flag
+ u_int8 uc_sns_cnt; // Sensor counter
+ u_int8 uc_data[132]; // Vehicle sensor data
+} VEHICLESENS_DATA_MASTER;
+
+
+/*******************************************************************************
+ * MODULE : DeliveryLineSensorDataPositioning
+ * ABSTRACT : LineSensor vehicle signaling notification messages sending process
+ * FUNCTION : Send LineSensor vehicle signalling notification messages
+ * ARGUMENT : *pstSendBuf:Transmitted data
+ * : uc_data_num :Number of sent data
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void DeliveryLineSensorDataPositioning(LSDRV_MSG_LSDATA_G* pst_send_buf, u_int8 uc_data_num) {
+ if (pst_send_buf != NULL) {
+ /* Initializing sent messages */
+ memset(reinterpret_cast<void *>(&(pst_send_buf->st_head)), 0, sizeof(T_APIMSG_MSGBUF_HEADER));
+
+ /* Message Header Settings */
+ pst_send_buf->st_head.hdr.sndpno = PNO_LINE_SENS_DRV; /* Source process number */
+ pst_send_buf->st_head.hdr.cid = CID_LINESENS_VEHICLE_DATA_G; /* Command ID */
+ pst_send_buf->st_head.hdr.msgbodysize = sizeof(LSDRV_MSG_LSDATA_DAT_G); /* Message data body length */
+
+ /* Message data is already set */
+ pst_send_buf->st_para.uc_data_num = uc_data_num;
+
+ /* Send messages */
+ (void)_pb_ZcSndMsg(PNO_VEHICLE_SENSOR, sizeof( LSDRV_MSG_LSDATA_G ), 0);
+ }
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrvApi_Initialize
+ * ABSTRACT : LineSensDrvApi initialization process
+ * FUNCTION : LineSensDrvApi initialization process
+ * ARGUMENT : -
+ * NOTE :
+ * RETURN : -
+ ******************************************************************************/
+BOOL LineSensDrvApiInitialize(void) {
+ BOOL ret = TRUE;
+
+ g_gps_irq_mutex = _pb_CreateMutex(NULL, FALSE, MUTEX_GPS_IRQ_FLG);
+
+ if (g_gps_irq_mutex == 0) {
+ ret = FALSE;
+ } else {
+ g_rcv_gps_irq = FALSE;
+ g_rcv_gps_sens_cnt_tmp = 0;
+ LineSensDrvApiInitEstGpsCnt();
+ ret = TRUE;
+ }
+
+ return (ret);
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrvApi_InitEstGpsCnt
+ * ABSTRACT : Estimated GPS counter related parameter initialization processing
+ * FUNCTION : Estimated GPS counter related parameter initialization processing
+ * ARGUMENT : -
+ * NOTE :
+ * RETURN : -
+ ******************************************************************************/
+void LineSensDrvApiInitEstGpsCnt(void) {
+ /* Initializing process */
+ g_rcv_pps_int = FALSE;
+ g_rcv_gps_sens_cnt = 0;
+ g_gps_sens_cnt_top = 0;
+
+ (void)memset(reinterpret_cast<void *>(&g_est_gps_cnt[0]), 0, sizeof(g_est_gps_cnt));
+ g_est_gps_cnt_available = FALSE;
+
+ return;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Sensor.cpp b/video_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Sensor.cpp
new file mode 100755
index 0000000..78ae488
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Sensor.cpp
@@ -0,0 +1,622 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Snesor.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "LineSensDrv_Sensor.h"
+#include "LineSensDrv_Api.h"
+
+/*---------------------------------------------------------------------------*/
+// Value Define
+
+#define LSDRV_MASK_WORD_L 0x00FF
+#define LSDRV_MASK_WORD_U 0xFF00
+
+#define LINE_SENS_DRV_SENSOR_DEBUG_FACTORY 0
+#define LINE_SENS_DRV_SENSOR_DEBUG_DIAG 0
+
+#define VEHICLE_SNS_INFO_PULSE_NUM 32
+
+/*---------------------------------------------------------------------------*/
+// Global variable
+
+static LSDRV_SPEEDKMPH_DAT g_speed_kmph_data;
+static uint8_t g_rcv_data_len; /* Receive SYS data length */
+extern uint8_t g_uc_vehicle_reverse;
+/*---------------------------------------------------------------------------*/
+// Functions
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_Sensor
+ * ABSTRACT : Sensor data reception processing
+ * FUNCTION : Convert sensor data to delivery format
+ * ARGUMENT : *ucRcvdata : Data pointer
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void LineSensDrvSensor(u_int8* uc_rcvdata) {
+ u_int8 uc_sens_cnt = 0;
+ u_int16 us_sp_kmph = 0; /* Vehicle speed(km/h) */
+ u_int16 us_sp_pls1 = 0; /* Total vehicle speed pulse(Latest) */
+ u_int16 us_sp_pls2 = 0; /* Total vehicle speed pulse(Last time) */
+ u_int8 us_sp_ret = 0; /* Last vehicle speed information acquisition result */
+ u_int8 uc_size = 0; /* Size of the data */
+ u_int16 us_cnt = 0; /* Data counter */
+ u_int16 us_cnt2 = 0; /* Data counter */
+ u_int8* uc_data_pos = NULL; /* Data storage location */
+ LSDRV_MSG_LSDATA_G* p_snd_buf = NULL;
+ LSDRV_LSDATA_G* p_snd_data_base = NULL;
+ LSDRV_LSDATA_G* p_snd_data = NULL;
+ RET_API ret = RET_NORMAL;
+
+ /* Receive sensor data top address acquisition */
+ uc_data_pos = (uc_rcvdata);
+
+ /* Create send buffer/delivery all received data */
+ ret = _pb_GetZcSndBuf(PNO_VEHICLE_SENSOR, reinterpret_cast<void**>(&p_snd_buf));
+ if ((ret == RET_NORMAL) && (p_snd_buf != NULL)) {
+ p_snd_data_base = p_snd_buf->st_para.st_data;
+ (void)memset(p_snd_data_base, 0, LSDRV_KINDS_MAX * sizeof( LSDRV_LSDATA_G ));
+
+ /* Sensor counter */
+ p_snd_data = p_snd_data_base + LSDRV_SNS_COUNTER;
+ uc_sens_cnt = (u_int8)*(uc_data_pos);
+ p_snd_data->ul_did = VEHICLE_DID_SNS_COUNTER; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_1; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ p_snd_data->uc_data[0] = uc_sens_cnt; /* Data content */
+ uc_data_pos = (uc_data_pos + LSDRV_SNDMSG_DTSIZE_1);
+
+ /* Gyro output */
+ p_snd_data = p_snd_data_base + LSDRV_GYRO_EXT;
+ p_snd_data->ul_did = VEHICLE_DID_GYRO_EXT; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_20; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ for (us_cnt = 0; us_cnt < LSDRV_SNDMSG_DTSIZE_20; us_cnt++) {
+ /* Since [0] is older and [9] is newer, the order of received data is switched. */
+ /* Be in reverse order for endian conversion */
+ p_snd_data->uc_data[LSDRV_SNDMSG_DTSIZE_20 - (us_cnt + 1)] = (u_int8)*(uc_data_pos + us_cnt);
+ }
+ uc_data_pos = (uc_data_pos + LSDRV_SNDMSG_DTSIZE_20);
+
+ p_snd_data = p_snd_data_base + LSDRV_GYRO_X;
+ p_snd_data->ul_did = VEHICLE_DID_GYRO; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_20; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ for (us_cnt = 0; us_cnt < LSDRV_SNDMSG_DTSIZE_20; us_cnt++) {
+ /* Since [0] is older and [9] is newer, the order of received data is switched. */
+ /* Be in reverse order for endian conversion */
+ p_snd_data->uc_data[LSDRV_SNDMSG_DTSIZE_20 - (us_cnt + 1)] = (u_int8)*(uc_data_pos + us_cnt);
+ }
+ uc_data_pos = (uc_data_pos + LSDRV_SNDMSG_DTSIZE_20);
+
+ /* Reverse flag */
+ p_snd_data = p_snd_data_base + LSDRV_REV;
+ p_snd_data->ul_did = VEHICLE_DID_REV; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_1; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor Counter */
+ p_snd_data->uc_data[0] = g_uc_vehicle_reverse;
+ /* Gyro Temperature */
+ p_snd_data = p_snd_data_base + LSDRV_GYRO_TEMP;
+ p_snd_data->ul_did = VEHICLE_DID_GYRO_TEMP; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_2; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ p_snd_data->uc_data[1] = (u_int8)(*(uc_data_pos ) & (u_int8)(LSDRV_TEMP_MASK >> 8));
+ p_snd_data->uc_data[0] = (u_int8)(*(uc_data_pos + 1) & (u_int8)(LSDRV_TEMP_MASK));
+ uc_data_pos = (uc_data_pos + LSDRV_SNDMSG_DTSIZE_2);
+
+ /* Vehicle speed pulse */
+ p_snd_data = p_snd_data_base + LSDRV_SPEED_PULSE;
+ p_snd_data->ul_did = VEHICLE_DID_SPEED_PULSE; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_20; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ for (us_cnt = 0; us_cnt < LSDRV_SNDMSG_DTSIZE_20; us_cnt++) {
+ /* Since [0] is older and [9] is newer, the order of received data is switched. */
+ /* Be in reverse order for endian conversion */
+ p_snd_data->uc_data[LSDRV_SNDMSG_DTSIZE_20 - (us_cnt + 1)] = (u_int8)*(uc_data_pos + us_cnt);
+ }
+ uc_data_pos = (uc_data_pos + LSDRV_SNDMSG_DTSIZE_20);
+
+ /* Vehicle speed(km/h) */
+ p_snd_data = p_snd_data_base + LSDRV_SPEED_PULSE;
+ us_sp_kmph = 0;
+ us_sp_pls1 = (u_int16)p_snd_data->uc_data[1];
+ us_sp_pls1 = (u_int16)((us_sp_pls1 << 8) | p_snd_data->uc_data[0]);
+ us_sp_ret = LineSensDrvGetLastSpeedPulse(&us_sp_pls2, us_sp_pls1, uc_sens_cnt);
+
+ LineSensDrvSetLastSpeedPulse(us_sp_pls1, uc_sens_cnt);
+
+ p_snd_data = p_snd_data_base + LSDRV_SPEED_KMPH;
+ if (us_sp_ret != LSDRV_SPKMPH_INVALID) {
+ /* Vehicle speed pulse before 100 ms is valid */
+ LineSensDrvSpeedPulseSave(us_sp_pls1, us_sp_pls2, uc_sens_cnt);
+ us_sp_kmph = LineSensDrvSpeedCalc(uc_sens_cnt);
+ /* The size can be set only when the vehicle speed [km/h] is calculated. "0" is notified to the vehicle sensor when the size cannot be set. */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_2; /* Size of the data */
+ }
+ p_snd_data->ul_did = VEHICLE_DID_SPEED_KMPH; /* Data ID */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ p_snd_data->uc_data[0] = (u_int8)(us_sp_kmph & 0x00FF);
+ p_snd_data->uc_data[1] = (u_int8)(us_sp_kmph >> 8);
+
+ POSITIONING_LOG("[LOG, %d(cnt), %d(km/h), %d(pls1), %d(pls2)] \r\n",
+ uc_sens_cnt,
+ us_sp_kmph,
+ us_sp_pls1,
+ us_sp_pls2);
+
+ /* G-Sensor X-axes */
+ p_snd_data = p_snd_data_base + LSDRV_GSENSOR_X;
+ p_snd_data->ul_did = VEHICLE_DID_GSNS_X; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_20; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ us_cnt2 = p_snd_data->uc_size - 1;
+ for (us_cnt = 0; us_cnt < 10; us_cnt++) {
+ /* Since [0] is older and [9] is newer, the order of received data is switched. */
+ p_snd_data->uc_data[us_cnt2 ] = (u_int8)*( uc_data_pos + (sizeof(SENSORINPUT_INFO_DAT_GSENS) * us_cnt) );
+ p_snd_data->uc_data[us_cnt2 - 1] = (u_int8)*( uc_data_pos + (sizeof(SENSORINPUT_INFO_DAT_GSENS) * us_cnt) + 1);
+ us_cnt2 = us_cnt2 - 2;
+ }
+
+ /* G-Sensor Y-axes */
+ p_snd_data = p_snd_data_base + LSDRV_GSENSOR_Y;
+ p_snd_data->ul_did = VEHICLE_DID_GSNS_Y; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_20; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+ us_cnt2 = p_snd_data->uc_size - 1;
+ for (us_cnt = 0; us_cnt < 10; us_cnt++) {
+ /* Since [0] is older and [9] is newer, the order of received data is switched. */
+ p_snd_data->uc_data[us_cnt2] = (u_int8)*( (uc_data_pos + sizeof(u_int16)) \
+ + (sizeof(SENSORINPUT_INFO_DAT_GSENS) * us_cnt));
+
+ p_snd_data->uc_data[us_cnt2-1] = (u_int8)*( (uc_data_pos + sizeof(u_int16)) \
+ + (sizeof(SENSORINPUT_INFO_DAT_GSENS) * us_cnt) + 1);
+ us_cnt2 = us_cnt2 - 2;
+ }
+ uc_data_pos = ( uc_data_pos + (sizeof(SENSORINPUT_INFO_DAT_GSENS) * 10) );
+
+ /* Inter-Pulse time */
+ p_snd_data = p_snd_data_base + LSDRV_PULSE_TIME;
+ p_snd_data->ul_did = VEHICLE_DID_PULSE_TIME; /* Data ID */
+ p_snd_data->uc_size = LSDRV_SNDMSG_DTSIZE_132; /* Size of the data */
+ p_snd_data->uc_sns_cnt = uc_sens_cnt; /* Sensor counter */
+
+ /* Clear the buffer for variable length */
+ (void)memset(&p_snd_data->uc_data[0], 0x00, sizeof(p_snd_data->uc_data));
+
+ if (g_rcv_data_len == LSDRV_PLSTIME_LEN) {
+ /* Inter-Pulse time (number of items + time). The number of items is stored at the beginning. */
+ uc_size = (u_int8)*uc_data_pos;
+ if (uc_size > VEHICLE_SNS_INFO_PULSE_NUM) {
+ uc_size = VEHICLE_SNS_INFO_PULSE_NUM;
+ }
+ p_snd_data->uc_data[0] = uc_size;
+ p_snd_data->uc_data[1] = 0x00;
+ p_snd_data->uc_data[2] = 0x00;
+ p_snd_data->uc_data[3] = 0x00;
+ uc_data_pos = ( uc_data_pos + sizeof(u_int8) );
+
+ /* Since [0] is old and [31] is new in the received time, the order is changed. */
+ /* Be in reverse order for endian conversion */
+ for (us_cnt = 0; us_cnt < (uc_size * sizeof(u_int32)); us_cnt++) {
+ p_snd_data->uc_data[(uc_size * sizeof(u_int32)) - (us_cnt + 1) + 4] = (u_int8)*(uc_data_pos + us_cnt);
+ }
+ }
+
+ /* Messaging */
+ DeliveryLineSensorDataPositioning(p_snd_buf, LSDRV_KINDS_MAX);
+ }
+
+ return;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_SpeedCalc
+ * ABSTRACT : Vehicle speed calculation processing for sensor data
+ * FUNCTION : Calculate vehicle speed for sensor data
+ * ARGUMENT : uc_sens_cnt : Sensor counter
+ * NOTE :
+ * RETURN : Vehicle speed(0.01km/h)
+ ******************************************************************************/
+u_int16 LineSensDrvSpeedCalc(u_int8 uc_sens_cnt) {
+ u_int32 ul_sp_caluc = 0; /* Vehicle speed(2^-8km/h) */
+ u_int16 us_speed = 0; /* Vehicle speed(km/h) */
+ u_int8 uc_ptr = 0; /* Data storage pointer for sensor data */ /* #010 */
+ u_int8 uc_ptr2 = 0; /* Data storage pointer for sensor data */ /* #010 */
+ u_int32 ul_work = 0; /* Variables for unsigned 32-bit type calculations */ /* #010 */
+ double d_work = 0.0; /* Variables for calculating double types */ /* #010 */ /* Ignore -> MISRA-C++:2008 Rule 3-9-2 */
+ u_int16 us_sens_cnt_search = 0; /* Sensor counter to be searched */ /* #010 */
+ u_int16 us_sens_cnt_ref = 0; /* Sensor counters to be compared */ /* #010 */
+ int32 i = 0; /* Generic counters */ /* #010 */
+ int32 j = 0; /* Generic counters */ /* #010 */
+ u_int16 us_offset = 0; /* Offset value */ /* #010 */
+
+ /* #016 start */
+ /* Is the number of data that can be calculated at the vehicle speed already received? */
+ if (LSDRV_PLSDATA_NRCV == g_speed_kmph_data.uc_calc_start) {
+ /* Do not compute if there is not enough data. */
+ } else {
+ if (0 == g_speed_kmph_data.uc_ptr) {
+ uc_ptr = LSDRV_SPKMPH_TBL_NUM - 1;
+ uc_ptr2 = LSDRV_SPKMPH_TBL_NUM - 1;
+ } else {
+ uc_ptr = g_speed_kmph_data.uc_ptr - 1; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ uc_ptr2 = g_speed_kmph_data.uc_ptr - 1; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ ul_work = 0;
+ if (LSDRV_SPKMPH_AVE_TIME > uc_sens_cnt) {
+ us_offset = LSDRV_SENSCNT_BRW_ADD;
+ } else {
+ us_offset = 0;
+ }
+
+ us_sens_cnt_search = (u_int16)uc_sens_cnt + us_offset - LSDRV_SPKMPH_AVE_TIME;
+
+ for (i = 0; i < LSDRV_SPKMPH_TBL_NUM; i++) {
+ /* Invalid data is detected, and the search is completed. */
+ if (LSDRV_SPKMPH_DATA_DIS == g_speed_kmph_data.st_data[uc_ptr].uc_flag) {
+ break;
+ }
+
+ /* When the sensor counter is 29 or less, the borrow is considered. */
+ if (LSDRV_SPKMPH_AVE_TIME > g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt) {
+ us_sens_cnt_ref = g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt + us_offset;
+ } else {
+ us_sens_cnt_ref = g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt;
+ }
+
+ /* Checking the sensor counter to finish search */
+ if (us_sens_cnt_search >= us_sens_cnt_ref) {
+ break;
+ }
+
+ /* Add to calculate average value */
+ ul_work += (u_int32)g_speed_kmph_data.st_data[uc_ptr].us_speed_pulse;
+
+ if (0 == uc_ptr) {
+ uc_ptr = LSDRV_SPKMPH_TBL_NUM - 1; /* To the end of the data table */
+ } else {
+ uc_ptr--; /* To the previous data */
+ }
+ }
+
+ /* Averaging computation */
+ if (0 == i) {
+ d_work = 0;
+ } else {
+ if (ul_work == 1) {
+ for (j = 0; j < LSDRV_SPKMPH_TBL_NUM; j++) {
+ if ((g_speed_kmph_data.st_data[uc_ptr2].us_speed_pulse == 1)
+ && (g_speed_kmph_data.st_data[uc_ptr2].uc_noise_flag == 1)) {
+ ul_work = 0;
+ break;
+ } else if (g_speed_kmph_data.st_data[uc_ptr2].us_speed_pulse == 1 &&
+ g_speed_kmph_data.st_data[uc_ptr2].uc_noise_flag == 0) {
+ ul_work = 1;
+ break;
+ } else {
+ /* nop */
+ }
+
+ /* Borrow actions for pointer values */
+ if (0 == uc_ptr2) {
+ uc_ptr2 = LSDRV_SPKMPH_TBL_NUM - 1; /* To the end of the data table */
+ } else {
+ uc_ptr2--; /* To the previous data */
+ }
+ }
+ }
+
+ d_work = static_cast<double>(ul_work);
+ d_work = d_work / static_cast<double>(i);
+ d_work = d_work * static_cast<double>(LSDRV_SENS_COEFFICIENT);
+ d_work = d_work * 100; /* [1km/h] -> [0.01km/h] */
+ d_work = d_work + 0.5; /* Preparation for rounding */
+ }
+
+ ul_sp_caluc = static_cast<int32>(d_work);
+
+ /* When the vehicle speed calculation result overflows, the upper limit value is used for clipping. */
+ if (LSDRV_PLSMAX - 1 >= ul_sp_caluc) {
+ us_speed = (u_int16)ul_sp_caluc;
+ } else {
+ us_speed = (u_int16)(LSDRV_PLSMAX - 1);
+ }
+ }
+
+ return us_speed;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_SpeedKmphDataInit
+ * ABSTRACT : Data table initialization process for vehicle speed calculation
+ * FUNCTION : Initialize the data table for calculating the vehicle speed
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void LineSensDrvSpeedKmphDataInit(void) {
+ int32 i = 0;
+
+ memset(reinterpret_cast<void*>(&g_speed_kmph_data), static_cast<int32>(0), (size_t)sizeof(g_speed_kmph_data));
+
+ /* Disable all data storage flags */
+ for (i = 0; i < LSDRV_SPKMPH_TBL_NUM; i++) {
+ g_speed_kmph_data.st_data[i].uc_flag = LSDRV_SPKMPH_DATA_DIS;
+ }
+
+ return;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_SpeedPulseSave
+ * ABSTRACT : Sensor data vehicle speed pulse save processing
+ * FUNCTION : Saving the vehicle speed pulse of the sensor data to the data table for calculating the vehicle speed
+ * ARGUMENT : us_sp1 : Vehicle speed pulse of the latest information
+ * : us_sp2 : Vehicle speed pulse of the previous information
+ * : uc_sens_cnt : Sensor counter
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void LineSensDrvSpeedPulseSave(u_int16 us_sp1, u_int16 us_sp2, u_int8 uc_sens_cnt) {
+ u_int16 us_sp_diff = 0; /* Vehicle speed pulse difference */
+ u_int8 uc_ptr = 0; /* Data storage pointer for sensor data */ /* #010 */
+ u_int8 us_last_ptr = 0; /* Last pointer */ /* #010 */
+ int32 i = 0; /* Generic counters */ /* #010 */
+ u_int8 uc_fstsns_cnt = 0; /* Initial sensor data sensor counter value */ /* #016 */
+ int32 l_data_num = 0; /* Number of registered data */ /* #016 */
+ u_int8 uc_noise_flag = 0; /* Noise flag */ /* #017 */
+
+ /* Calculate the vehicle speed pulse difference between the latest and last 100ms information */
+ if (us_sp1 >= us_sp2) {
+ /* The cumulative pulse number of the latest information is larger. */
+ us_sp_diff = us_sp1 - us_sp2; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ } else {
+ /* The cumulative pulse number of the latest information is smaller (the accumulated pulse overflows) */
+ us_sp_diff = (LSDRV_PLSMAX - us_sp2) + us_sp1; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Call noise check only if us_sp_diff is 1 */
+ if (us_sp_diff == 1) {
+ uc_noise_flag = LineSensDrvCheckNoise(uc_sens_cnt);
+ }
+
+ /* Saving sensor data vehicle speed pulse in data table for vehicle speed calculation */
+ if (LSDRV_PLSDATA_NRCV == g_speed_kmph_data.uc_sns_rcv) {
+ if (LSDRV_PLSDATA_RCV == g_speed_kmph_data.uc_fstsns_rcv) {
+ /* If the sensor data has already been received for the first time, set the temporary sensor counter value when the sensor data has been saved for the first time. */
+ uc_fstsns_cnt = uc_sens_cnt;
+ for (i = (LSDRV_SPKMPH_TBL_NUM - 1); i >= 0 ; i--) {
+ if (LSDRV_SPKMPH_DATA_EN == g_speed_kmph_data.st_data[i].uc_flag) {
+ /* Data storage flag is valid */
+ if (0 != uc_fstsns_cnt) {
+ uc_fstsns_cnt--;
+ } else {
+ uc_fstsns_cnt = LSDRV_SENSCNT_MAX;
+ }
+
+ g_speed_kmph_data.st_data[i].uc_sens_cnt = uc_fstsns_cnt;
+ }
+ }
+ }
+
+ /* Sensor data reception status <- "Received" */
+ g_speed_kmph_data.uc_sns_rcv = LSDRV_PLSDATA_RCV;
+ }
+
+ uc_ptr = g_speed_kmph_data.uc_ptr;
+
+ /* If the sensor counter is the same as the previous one, overwrite update */
+ if (0 == uc_ptr) {
+ us_last_ptr = LSDRV_SPKMPH_TBL_NUM - 1;
+ } else {
+ us_last_ptr = uc_ptr - 1; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ if (g_speed_kmph_data.st_data[us_last_ptr].uc_sens_cnt == uc_sens_cnt) {
+ /* Next update of the data storage location */
+ if (0 == g_speed_kmph_data.uc_ptr) {
+ g_speed_kmph_data.uc_ptr = LSDRV_SPKMPH_TBL_NUM - 1;
+ } else {
+ g_speed_kmph_data.uc_ptr--;
+ }
+
+ uc_ptr = g_speed_kmph_data.uc_ptr;
+ }
+
+ /* Input into data table for calculation of vehicle speed */
+ g_speed_kmph_data.st_data[uc_ptr].uc_flag = LSDRV_SPKMPH_DATA_EN; /* Data validity */
+ g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt = uc_sens_cnt; /* Sensor counter input */
+ g_speed_kmph_data.st_data[uc_ptr].us_speed_pulse = us_sp_diff; /* Vehicle speed pulse difference */
+ g_speed_kmph_data.st_data[uc_ptr].uc_noise_flag = uc_noise_flag; /* Noise flag */ /* #017 */
+
+ /* Next update of the data storage location */
+ if ((LSDRV_SPKMPH_TBL_NUM - 1) <= g_speed_kmph_data.uc_ptr) {
+ g_speed_kmph_data.uc_ptr = 0;
+ } else {
+ g_speed_kmph_data.uc_ptr++;
+ }
+
+ /* Determine whether the vehicle speed can be calculated. */
+ if (g_speed_kmph_data.uc_calc_start == LSDRV_PLSDATA_NRCV) {
+ /* Data count detection */
+ l_data_num = 0;
+ for (i = 0; i < LSDRV_SPKMPH_TBL_NUM; i++) {
+ if (LSDRV_SPKMPH_DATA_EN == g_speed_kmph_data.st_data[i].uc_flag) {
+ l_data_num++;
+ }
+ }
+
+ if (LSDRV_SPKMPH_MIN_DATA_N <= l_data_num) {
+ /* Vehicle Speed Calculation Required Data Number Received */
+ g_speed_kmph_data.uc_calc_start = LSDRV_PLSDATA_RCV;
+ }
+ }
+
+ return;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_CheckNoise
+ * ABSTRACT : Sensor data noise check processing
+ * FUNCTION : The vehicle speed pulse is saved in the data table for the vehicle speed calculation.
+ * ARGUMENT : uc_sens_cnt : Sensor counter of the latest data
+ * NOTE :
+ * RETURN : Noise flag
+ ******************************************************************************/
+u_int8 LineSensDrvCheckNoise(u_int8 uc_sens_cnt) {
+ int32 i = 0; /* Generic counters */
+ u_int16 us_sens_cnt_search = 0; /* Sensor counter to be searched*/
+ u_int8 uc_ptr = 0; /* Data storage pointer */
+ u_int16 us_offset = 0; /* Offset value */
+ u_int8 noise_flag = 0; /* Noise flag */
+ u_int16 us_sens_cnt_ref = 0; /* Sensor counters to be compared */
+
+ /* If there is no point where the difference in vehicle speed pulse is 1 or more
+ between -1 and -14 of sensor counter of the latest data,
+ set the noise flag of the latest data to 1. */
+ /* Set the noise flag to 1 */
+ noise_flag = 1;
+
+ /* The Target is the one before the storage location of the latest data. */
+ if (0 == g_speed_kmph_data.uc_ptr) {
+ uc_ptr = LSDRV_SPKMPH_TBL_NUM - 1;
+ } else {
+ uc_ptr = g_speed_kmph_data.uc_ptr - 1; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ if (LSDRV_SPKMPH_NOISE_TIME > uc_sens_cnt) {
+ us_offset = LSDRV_SENSCNT_BRW_ADD;
+ } else {
+ us_offset = 0;
+ }
+
+ us_sens_cnt_search = (u_int16)uc_sens_cnt + us_offset - LSDRV_SPKMPH_NOISE_TIME;
+
+ for (i = 0; i < LSDRV_SPKMPH_NOISE_TIME; i++) {
+ /* When the sensor counter is 15 or less, the borrow is considered. */
+ if (LSDRV_SPKMPH_NOISE_TIME > g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt) {
+ us_sens_cnt_ref = g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt + us_offset;
+ } else {
+ us_sens_cnt_ref = g_speed_kmph_data.st_data[uc_ptr].uc_sens_cnt; /* Ignore -> MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Checking the sensor Counter to Finish Search */
+ if (us_sens_cnt_ref <= us_sens_cnt_search) {
+ noise_flag = 1;
+ break;
+ } else {
+ if (g_speed_kmph_data.st_data[uc_ptr].us_speed_pulse >= 1) {
+ noise_flag = 0;
+ break;
+ }
+ }
+
+ /* Borrow actions for pointer values */
+ if (0 == uc_ptr) {
+ uc_ptr = LSDRV_SPKMPH_TBL_NUM - 1; /* To the end of the data table */
+ } else {
+ uc_ptr--; /* To the previous data */
+ }
+ }
+
+ return noise_flag;
+}
+
+/**
+ * @brief
+ * Return the last (100ms ago) vehicle speed pulse
+ *
+ * @param[out] us_sp2 Last vehicle speed pulse
+ * @param[in] us_sp1 The latest vehicle speed pulse
+ * @param[in] uc_sens_cnt Latest sensor counter
+ *
+ * @return LSDRV_SPKMPH_INVALID Vehicle speed pulse information valid<br>
+ * LSDRV_SPKMPH_VALID Vehicle speed pulse information invalid
+ */
+u_int8 LineSensDrvGetLastSpeedPulse(u_int16* us_sp2, u_int16 us_sp1, u_int8 uc_sens_cnt) {
+ u_int8 ret = LSDRV_SPKMPH_INVALID; /* Return value */
+ u_int16 sp_pls_diff = 0; /* Vehicle speed pulse difference */
+ u_int16 sp_pls = 0; /* Vehicle speed pulse every 100 ms */
+ u_int8 cnt_diff = 0; /* Sensor counter difference */
+
+ /* Check if the last vehicle speed pulse has been set */
+ if (g_speed_kmph_data.st_last_data.uc_flag == LSDRV_SPKMPH_DATA_EN) {
+ /* Differential calculation of sensor counter */
+ if (uc_sens_cnt >= g_speed_kmph_data.st_last_data.uc_sens_cnt) {
+ /* Latest sensor counter is larger */
+ cnt_diff = uc_sens_cnt - g_speed_kmph_data.st_last_data.uc_sens_cnt;
+ } else {
+ /* Last sensor counter is larger(sensor counter overflows) */
+ cnt_diff = (LSDRV_SENSCNT_MAX - g_speed_kmph_data.st_last_data.uc_sens_cnt) + uc_sens_cnt + 1;
+ }
+
+ /* Check if sensor counter is continuous */
+ if (cnt_diff <= 1) {
+ /* Continuous or same as the previous one, so the previous (100ms previous) vehicle speed pulse is set as it is */
+ *us_sp2 = g_speed_kmph_data.st_last_data.us_speed_pulse;
+ } else {
+ /* Determine the vehicle speed pulse 100ms ago from the average considering the skipped portion because it is not consecutive. */
+ if (us_sp1 >= g_speed_kmph_data.st_last_data.us_speed_pulse) {
+ /* Larger latest cumulative vehicle speed pulse */
+ sp_pls_diff = us_sp1 - g_speed_kmph_data.st_last_data.us_speed_pulse;
+ } else {
+ /* Last cumulative vehicle speed pulse is larger(Cumulative vehicle speed pulse overflows) */
+ sp_pls_diff = (LSDRV_PLSMAX - g_speed_kmph_data.st_last_data.us_speed_pulse) + us_sp1;
+ }
+
+ /* Calculate average vehicle speed pulse including skip period */
+ sp_pls = (u_int16)(sp_pls_diff / cnt_diff);
+
+ /* Calculate the vehicle speed pulse 100ms ahead from the vehicle speed average */
+ if (us_sp1 >= sp_pls) {
+ /* Does not overflow even if the 100ms vehicle speed pulse is pulled from the latest one. */
+ *us_sp2 = us_sp1 - sp_pls;
+ } else {
+ /* Subtracting a 100ms vehicle speed pulse from the latest one overflows */
+ *us_sp2 = LSDRV_PLSMAX - (sp_pls - us_sp1);
+ }
+ }
+
+ ret = LSDRV_SPKMPH_VALID;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Return the last (100ms ago) vehicle speed pulse
+ *
+ * @param[in] us_sp Vehicle speed pulse
+ * @param[in] uc_sens_cnt Sensor counter
+ */
+void LineSensDrvSetLastSpeedPulse(u_int16 us_sp, u_int8 uc_sens_cnt) {
+ /* Vehicle speed pulse information valid setting */
+ g_speed_kmph_data.st_last_data.uc_flag = LSDRV_SPKMPH_DATA_EN;
+ /* Sensor counter setting */
+ g_speed_kmph_data.st_last_data.uc_sens_cnt = uc_sens_cnt;
+ /* Vehicle speed pulse setting */
+ g_speed_kmph_data.st_last_data.us_speed_pulse = us_sp;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Thread.cpp b/video_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Thread.cpp
new file mode 100755
index 0000000..9fb1c29
--- /dev/null
+++ b/video_in_hal/positioning_hal/src/LineSensDrv/LineSensDrv_Thread.cpp
@@ -0,0 +1,125 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+* @file LineSensDrv_Thread.cpp
+*/
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "LineSensDrv_Thread.h"
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include "positioning_def.h"
+#include "positioning_common.h"
+/*---------------------------------------------------------------------------*/
+// Global variable
+
+static u_int8 g_sys_recv_flg = 0; // For debugging
+char g_threadname[] = "POS_Sens";
+uint8_t g_uc_vehicle_reverse = 0;
+uint8_t g_uc_reverse_state = 0;
+static BOOL g_line_sens_thread_stop = FALSE;
+
+#define POS_REV_STATE_PROCESSING 0
+#define POS_REV_STATE_IDLE 1
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_Thread
+ * ABSTRACT : LineSensor driver thread main process
+ * FUNCTION : Main processing
+ * ARGUMENT : lpvPara :
+ * NOTE :
+ * RETURN :
+ ******************************************************************************/
+EFrameworkunifiedStatus LineSensDrvThread(HANDLE h_app) {
+ int32 l_ret = RET_LSDRV_SUCCESS;
+ EFrameworkunifiedStatus l_status = eFrameworkunifiedStatusOK;
+
+
+ (void)PosSetupThread(h_app, ETID_POS_SENS);
+
+ /* Execute the initialization processes */
+ l_ret = LineSensDrvMainThreadInit(h_app);
+ if (RET_LSDRV_SUCCESS != l_ret) {
+ l_status = eFrameworkunifiedStatusFail;
+ }
+
+ return l_status;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_MainThread_Init
+ * ABSTRACT : Thread initialization process
+ * FUNCTION : Initialize thread
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : RET_LSDRV_SUCCESS:Success in initialization
+ * RET_LSDRV_ERROR :Initialization failed
+ ******************************************************************************/
+int32 LineSensDrvMainThreadInit(HANDLE h_app) {
+ int32 l_ret = RET_LSDRV_SUCCESS;
+ BOOL b_ret = TRUE;
+
+ /****** Global variable initialization **********/
+ LineSensDrvParamInit();
+
+ /****** LineSensDrvApi initialization **********/
+ b_ret = LineSensDrvApiInitialize();
+
+ if (TRUE != b_ret) {
+ l_ret = RET_LSDRV_ERROR;
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+ * MODULE : LineSensDrv_Param_Init
+ * ABSTRACT : Global variable initialization processing
+ * FUNCTION : Initialize global variables
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void LineSensDrvParamInit(void) {
+ LineSensDrvSpeedKmphDataInit(); // Data table initialization process for vehicle speed calculation
+}
+
+/**
+ * @brief
+ * Pos_Sens thread stop processing
+ */
+void LineSensDrvThreadStopProcess(void) {
+ g_line_sens_thread_stop = TRUE;
+
+ if (POS_REV_STATE_IDLE == g_uc_reverse_state) {
+ PosTeardownThread(ETID_POS_SENS);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get initial sensor data reception flag
+ */
+u_int8 LineSensDrvGetSysRecvFlag(void) {
+ return g_sys_recv_flg;
+}
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/video_in_hal/power_hal/LICENSE b/video_in_hal/power_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/power_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/power_hal/Makefile b/video_in_hal/power_hal/Makefile
new file mode 100755
index 0000000..b0a0c28
--- /dev/null
+++ b/video_in_hal/power_hal/Makefile
@@ -0,0 +1,66 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libpower_hal.so
+
+HEADER := hal_api/power_hal.h
+
+######### include paths/files ###################
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+#CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include/stub
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH := /usr/agl/lib
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+#LIBS += -Wl,-Bdynamic -lCommUSB
+
+######### source files ##########################
+VPATH := src
+OBJS := power_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/video_in_hal/power_hal/README.md b/video_in_hal/power_hal/README.md
new file mode 100755
index 0000000..6841186
--- /dev/null
+++ b/video_in_hal/power_hal/README.md
@@ -0,0 +1,3 @@
+power_hal library
+==================
+Power HAL implementation library for AGL Reference Board.
diff --git a/video_in_hal/power_hal/hal_api/power_hal.h b/video_in_hal/power_hal/hal_api/power_hal.h
new file mode 100755
index 0000000..f1acc42
--- /dev/null
+++ b/video_in_hal/power_hal/hal_api/power_hal.h
@@ -0,0 +1,572 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file power_hal.h
+ * @brief Interface and struct define for power_hal
+ */
+
+#ifndef HAL_API_POWER_HAL_H_
+#define HAL_API_POWER_HAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup system_manager
+ * @{
+ */
+/** @addtogroup power_hal
+ * @ingroup system_manager
+ * @{
+ */
+/** @}*/ // end of power_hal
+/** @}*/ // end of system_manager
+
+/** @addtogroup power_supply_manager_shadow
+ * @{
+ */
+/** @addtogroup power_hal
+ * @ingroup power_supply_manager_shadow
+ * @{
+ */
+
+/**
+ * \~english Definition of program update is not occured
+ */
+#define PWR_PROGUPDATE_STATE_NONE (0x0)
+
+/**
+ * \~english Bit position of program update
+ */
+#define PWR_PROGUPDATE_STATE_UPDATED (0x01)
+
+/**
+ * \~english Bit position of map update
+ */
+#define PWR_PROGUPDATE_STATE_MAP_UPDATED (0x02)
+
+/**
+ * \~english Bit position of map difference update
+ */
+#define PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED (0x04)
+
+/**
+ * \~english None reset state
+ */
+#define PWR_DATA_RESET_STATE_NONE 0
+
+/**
+ * \~english Reset state for initialization of user information
+ */
+#define PWR_DATA_RESET_STATE_USER 1
+
+/**
+ * \~english Reset state for factory initialization
+ */
+#define PWR_DATA_RESET_STATE_FACTORY 2
+
+/*
+ * @~english
+ * @brief Command ID power_hal -> User
+ */
+/*! @~english power_hal command receive notification */
+#define CID_PWR_CMD_RCV 0x0103
+
+/*! @~english power_hal command send result notification */
+#define CID_PWR_CMD_SND_STS 0x0104
+
+/**
+ * \~english DRAM backup status
+ */
+enum PsmSysupDramT {
+ /**
+ * \~english normal value
+ */
+ PSM_SYSUP_DRAM_NORMAL,
+
+ /**
+ * \~english abnormal Soft Reset(software abnormality)
+ */
+ PSM_SYSUP_DRAM_SFTERRSR,
+
+ /**
+ * \~english need to discard backup dram
+ */
+ PSM_SYSUP_DRAM_DISCARD,
+
+ /**
+ * \~english max value
+ */
+ PSM_SYSUP_DRAM_MAX,
+};
+
+/**
+ * \~english Start Status
+ */
+enum PsmStartStatusT {
+ /**
+ * \~english cold start
+ */
+ PSM_START_STATUS_FACTRESET,
+
+ /**
+ * \~english hot start
+ */
+ PSM_START_STATUS_NORMAL,
+
+ /**
+ * \~english max value
+ */
+ PSM_START_STATUS_MAX,
+};
+
+/**
+ * \~english Communication state
+ */
+enum PsmComStsT {
+ /**
+ * \~english Communication normal
+ */
+ PSM_COM_STS_NORMAL,
+
+ /**
+ * \~english Communication abnormal
+ */
+ PSM_COM_STS_ABNORMAL,
+
+ /**
+ * \~english max value
+ */
+ PSM_COM_STS_MAX,
+};
+
+/**
+ * \~english DRAM power supply abnormality check result
+ */
+enum PsmDramStsT {
+ /**
+ * \~english DRAM power supply abnormality check result normal
+ */
+ PSM_DRAM_STS_NORMAL,
+
+ /**
+ * \~english DRAM power supply abnormality check result abnormal
+ */
+ PSM_DRAM_STS_ABNORMAL,
+
+ /**
+ * \~english max value
+ */
+ PSM_DRAM_STS_MAX,
+};
+
+/**
+ * \~english ACC customize setting.
+ */
+enum PsmAccCustomizeT {
+ /**
+ * \~english ACC customize setting OFF.
+ */
+ PSM_ACC_CUSTOMIZE_OFF,
+ /**
+ * \~english ACC customize setting ON.
+ */
+ PSM_ACC_CUSTOMIZE_ON
+};
+
+/**
+ * \~english Reset history recording flag.
+ */
+#define PSM_RESET_HISTORY (0x10000000)
+
+/**
+ * \~english Reset(Start-up) factor.
+ */
+enum PsmFactorT {
+ /**
+ * \~english none
+ */
+ PSM_FACTOR_NONE,
+ /**
+ * \~english Restart due to AGL.
+ */
+ PSM_FACTOR_AGL,
+ /**
+ * \~english Restart due to Tier1.
+ */
+ PSM_FACTOR_TIER1,
+ /**
+ * \~english Restart due to user.
+ */
+ PSM_FACTOR_USER,
+ /**
+ * \~english Restart due to AGL(Need to record reset history).
+ */
+ PSM_FACTOR_AGL_WITH_HISTORY = (PSM_RESET_HISTORY | PSM_FACTOR_AGL),
+ /**
+ * \~english Restart due to Tier1(Need to record reset history).
+ */
+ PSM_FACTOR_TIER1_WITH_HISTORY = (PSM_RESET_HISTORY | PSM_FACTOR_TIER1),
+ /**
+ * \~english Restart due to user(Need to record reset history).
+ */
+ PSM_FACTOR_USER_WITH_HISTORY = (PSM_RESET_HISTORY | PSM_FACTOR_USER)
+};
+
+/**
+ * \~english Reset information type.
+ */
+enum PowerHalResetInfoId {
+ /**
+ * \~english Count of error log.
+ */
+ AGL_ERRLOG_COUNTER = 0,
+ /**
+ * \~english Abnormal reset count detected by AGL.
+ */
+ AGL_RESET_COUNTER,
+ /**
+ * \~english State of program update.
+ */
+ AGL_PROGUPDATE_STATE,
+ /**
+ * \~english Data reset state.
+ */
+ AGL_DATARESET_STATE,
+ /**
+ * \~english Flag of abnormal reset.
+ */
+ AGL_ILLRESET_FLAG,
+ /**
+ * \~english Max of reset information type.
+ */
+ AGL_RESERVED_LIMIT = 32
+};
+
+/**
+ * \ingroup PsmNaviResetPower
+ * \~english @par Brief
+ * API to do navi reset that is forced reset if end sequence of MainSoC is not completed.
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [in] reset_factor Reset factor
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do navi reset process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmNaviResetPower(HANDLE h_app, PsmFactorT reset_factor);
+
+/**
+ * \ingroup PsmClrRamJudgeFlgPower
+ * \~english @par Brief
+ * API to do ram judge flag clear
+ * \~english @param [in] h_app Handle for Application
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do ram judge flag clear process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmClrRamJudgeFlgPower(HANDLE h_app);
+
+/**
+ * \ingroup PsmGetDramBackupStatusPower
+ * \~english @par Brief
+ * API to do get dram backup status
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_dram1 DRAM1 BackUp Status
+ * \~english @param [out] p_dram2 DRAM2 BackUp Status
+ * \~english @param [out] p_dram3 DRAM3 BackUp Status
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get dram backup status process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetDramBackupStatusPower(HANDLE h_app, PsmSysupDramT *p_dram1, PsmSysupDramT *p_dram2, PsmSysupDramT *p_dram3);
+
+/**
+ * \ingroup PsmGetStartStatusPower
+ * \~english @par Brief
+ * API to do get start status
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_start_sts start status
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get startup state process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetStartStatusPower(HANDLE h_app, PsmStartStatusT *p_start_sts);
+
+/**
+ * \ingroup PsmGetSyscomStatusPower
+ * \~english @par Brief
+ * API to do get communication status between mainsoc-sys
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_com_sts communication status between mainsoc-sys
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get communication status between mainsoc-sys process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetSyscomStatusPower(HANDLE h_app, PsmComStsT *p_com_sts);
+
+/**
+ * \ingroup PsmGetDramPowerSupplyAbnormalityCheckResultPower
+ * \~english @par Brief
+ * API to do get dram power supply abnormality check result
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_dram_sts DRAM power supply abnormality check result
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get dram power supply abnormality check result process.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetDramPowerSupplyAbnormalityCheckResultPower(HANDLE h_app, PsmDramStsT *p_dram_sts);
+
+/**
+ * \ingroup PsmGetAccCustomizeSetting
+ * \~english @par Brief
+ * API to do get ACC customize setting
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_acc_customize ACC customize Setting
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get ACC customize setting.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT* p_acc_customize);
+
+/**
+ * \ingroup PsmChgAccCustomizeSetting
+ * \~english @par Brief
+ * API to do change ACC customize setting
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [in] acc_customize ACC customize Setting
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do set ACC customize setting.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmChgAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT acc_customize);
+
+/**
+ * \ingroup PsmGetStartupFactor
+ * \~english @par Brief
+ * API to do get start-up factor.
+ * \~english @param [in] h_app Handle for Application
+ * \~english @param [out] p_startup_factor Start-up factor
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * \~english @par Detail
+ * - do get Start-up factor.
+ * - After the API call, start-up factor is clear.
+ * - The API can only be used by 1 process
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+int PsmGetStartupFactor(HANDLE h_app, PsmFactorT* p_startup_factor);
+
+/**
+ * \ingroup PowerHalSetResetInfo
+ * \~english @par Brief
+ * API to do set reset information.
+ * \~english @param [in] id Reset information type.
+ * \~english @param [in] val setting value.
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * - Save error to non-volatile memory. [-1]
+ * \~english @par Detail
+ * - Do set value to Reset information type(\ref PowerHalResetInfoId). \n
+ * \ref AGL_PROGUPDATE_STATE is not applicable(Only get value used by \ref PowerHalGetResetInfo). \n
+ * Domains of each reset information type are as below. \n
+ * \ref AGL_ERRLOG_COUNTER : 0 <= val <= UINT32_MAX \n
+ * \ref AGL_RESET_COUNTER : 0 <= val <= UINT32_MAX \n
+ * \ref AGL_DATARESET_STATE : It is set as below in each state of data reset. \n
+ * None reset state == \ref PWR_DATA_RESET_STATE_NONE \n
+ * Reset state for initialization of user information == \ref PWR_DATA_RESET_STATE_USER \n
+ * Reset state for factory initialization == \ref PWR_DATA_RESET_STATE_FACTORY \n
+ * \ref AGL_ILLRESET_FLAG : val = 0 or 1 (Abnormal reset is 1)
+ * - When the API is success, setting value is saved as non-volatile data.
+ * - Non-volatile memory is allocated \ref AGL_RESERVED_LIMIT for extendability.
+ * - Values setting by the API are saved when it is cold start(is_batterydiscon is true of PsmSysMcEVSysResUpChkPrmT notified from power_hal).
+ * - The API is completed within 1msec after the API is called.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * PowerHalGetResetInfo
+ */
+int PowerHalSetResetInfo(enum PowerHalResetInfoId id, uint32_t val);
+
+/**
+ * \ingroup PowerHalGetResetInfo
+ * \~english @par Brief
+ * API to do get setting value of reset information .
+ * \~english @param [in] id Reset information type.
+ * \~english @param [out] val Buffer of value.
+ * \~english @retval 0 : Ok
+ * \~english @retval -1 : Failed
+ * \~english @par Prerequisite
+ * - None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Internal IO error. [-1]
+ * - Read fail of value. [-1]
+ * \~english @par Detail
+ * - Do get value from each reset information type(\ref PowerHalResetInfoId).
+ * - Value of \ref AGL_PROGUPDATE_STATE, low 3bits are assigned as below, \n
+ * and corresponding bit is set if state is updating. \n
+ * Low 1bit(\ref PWR_PROGUPDATE_STATE_UPDATED) : Program update \n
+ * Low 2bit(\ref PWR_PROGUPDATE_STATE_MAP_UPDATED) : Map update \n
+ * Low 3bit(\ref PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED) : Map difference update \n
+ * - The API is completed within 1msec after the API is called.
+ * - Completeness of data getting by the API is assured by lower layer than power_hal, \n
+ * and return -1 as internal IO error when it is occurred abnormal error.
+ * - The API can only be used by 1 process.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * PowerHalSetResetInfo
+ */
+int PowerHalGetResetInfo(enum PowerHalResetInfoId id, uint32_t *val);
+
+/** @}*/ // end of power_hal
+/** @}*/ // end of power_supply_manager_shadow
+
+#endif // HAL_API_POWER_HAL_H_
diff --git a/video_in_hal/power_hal/src/power_hal.cpp b/video_in_hal/power_hal/src/power_hal.cpp
new file mode 100755
index 0000000..aba2d1e
--- /dev/null
+++ b/video_in_hal/power_hal/src/power_hal.cpp
@@ -0,0 +1,97 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "power_hal.h"
+
+int PsmNaviResetPower(HANDLE h_app, PsmFactorT reset_factor) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmClrRamJudgeFlgPower(HANDLE h_app) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetDramBackupStatusPower(HANDLE h_app, PsmSysupDramT *p_dram1, PsmSysupDramT *p_dram2, PsmSysupDramT *p_dram3) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetStartStatusPower(HANDLE h_app, PsmStartStatusT *p_start_sts) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetSyscomStatusPower(HANDLE h_app, PsmComStsT *p_com_sts) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetDramPowerSupplyAbnormalityCheckResultPower(HANDLE h_app, PsmDramStsT *p_dram_sts) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT* p_acc_customize) {
+ if (NULL == h_app) {
+ return -1;
+ }
+ *p_acc_customize = PSM_ACC_CUSTOMIZE_ON;
+ return 0;
+}
+
+int PsmChgAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT acc_customize) {
+ if (NULL == h_app) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int PsmGetStartupFactor(HANDLE h_app, PsmFactorT* p_startup_factor) {
+ if (NULL == h_app) {
+ return -1;
+ }
+ *p_startup_factor = PSM_FACTOR_NONE;
+ return 0;
+}
+
+int PowerHalSetResetInfo(enum PowerHalResetInfoId id, uint32_t val) {
+ return 0;
+}
+
+int PowerHalGetResetInfo(enum PowerHalResetInfoId id, uint32_t *val) {
+ return 0;
+}
diff --git a/video_in_hal/security_hal/LICENSE b/video_in_hal/security_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/security_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/security_hal/Makefile b/video_in_hal/security_hal/Makefile
new file mode 100755
index 0000000..5435be7
--- /dev/null
+++ b/video_in_hal/security_hal/Makefile
@@ -0,0 +1,67 @@
+#
+# @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libsecurity_hal.so
+
+HEADER := hal_api/security_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := security_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
+
diff --git a/video_in_hal/security_hal/hal_api/security_hal.h b/video_in_hal/security_hal/hal_api/security_hal.h
new file mode 100755
index 0000000..5d2bf90
--- /dev/null
+++ b/video_in_hal/security_hal/hal_api/security_hal.h
@@ -0,0 +1,1131 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_SECURITY_HAL_H_
+#define HAL_API_SECURITY_HAL_H_
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * @file security_hal.h
+ */
+
+/** @addtogroup update_service
+ * @{
+ */
+/** @addtogroup security_hal
+ * @ingroup update_service
+ * @{
+ */
+
+/**
+ * \~english The max size of RSA modulus
+ */
+#define RSA_MODULUS_MAX_SIZE 2048
+/**
+ * \~english The max size of RSA public exponent
+ */
+#define RSA_PUBLIC_EXPONENT_MAX_SIZE 2048
+/**
+ * \~english The max size of RSA private exponent
+ */
+#define RSA_PRIVATE_EXPONENT_MAX_SIZE 2048
+/**
+ * \~english The minimum size of RSA padding
+ */
+#define RSA_PADDING_MINIMUM_SIZE 11
+
+/**
+ * \~english Cipher type
+ */
+enum CipherType {
+ /**
+ * \~english AES symmetric cipher
+ */
+ SYMMETRIC_CIPHER_AES = 1,
+ /**
+ * \~english BLOWFISH symmetric cipher
+ */
+ SYMMETRIC_CIPHER_BLOWFISH,
+ /**
+ * \~english CAST5 symmetric cipher
+ */
+ SYMMETRIC_CIPHER_CAST5,
+ /**
+ * \~english DES symmetric cipher
+ */
+ SYMMETRIC_CIPHER_DES,
+ /**
+ * \~english DESEDA symmetric cipher
+ */
+ SYMMETRIC_CIPHER_DESEDA,
+ /**
+ * \~english DESEDA3 symmetric cipher
+ */
+ SYMMETRIC_CIPHER_DESEDA3,
+ /**
+ * \~english IDEA symmetric cipher
+ */
+ SYMMETRIC_CIPHER_IDEA,
+ /**
+ * \~english RC2 symmetric cipher
+ */
+ SYMMETRIC_CIPHER_RC2,
+ /**
+ * \~english RC4 symmetric cipher
+ */
+ SYMMETRIC_CIPHER_RC4,
+ /**
+ * \~english RC5 symmetric cipher
+ */
+ SYMMETRIC_CIPHER_RC5,
+ /**
+ * \~english RSA asymmetric cipher
+ */
+ ASYMMETRIC_CIPHER_RSA,
+ /**
+ * \~english DSA asymmetric cipher
+ */
+ ASYMMETRIC_CIPHER_DSA,
+ /**
+ * \~english ECDSA asymmetric cipher
+ */
+ ASYMMETRIC_CIPHER_ECDSA
+};
+
+/**
+ * \~english Symmetric Cipher Mode
+ */
+enum SymmetricCipherMode {
+ /**
+ * \~english Stream symmetric cipher mode
+ */
+ SYMMETRIC_CIPHER_MODE_STREAM = 0x00000001,
+ /**
+ * \~english ECB symmetric cipher mode
+ */
+ SYMMETRIC_CIPHER_MODE_BLOCK_ECB = 0x00000002,
+ /**
+ * \~english CBC symmetric cipher mode
+ */
+ SYMMETRIC_CIPHER_MODE_BLOCK_CBC = 0x00000004,
+ /**
+ * \~english CFB symmetric cipher mode
+ */
+ SYMMETRIC_CIPHER_MODE_BLOCK_CFB = 0x00000008,
+ /**
+ * \~english OFB symmetric cipher mode
+ */
+ SYMMETRIC_CIPHER_MODE_BLOCK_OFB = 0x00000010
+};
+
+/**
+ * \~english Symmetric cipher Block Size
+ */
+enum SymmetricCipherBlockSize {
+ /**
+ * \~english Symmetric cipher block size is 4 bytes
+ */
+ SYMMETRIC_CIPHER_BLOCK_SIZE_4 = 0x00000001,
+ /**
+ * \~english Symmetric cipher block size is 8 bytes
+ */
+ SYMMETRIC_CIPHER_BLOCK_SIZE_8 = 0x00000002,
+ /**
+ * \~english Symmetric cipher block size is 16 bytes
+ */
+ SYMMETRIC_CIPHER_BLOCK_SIZE_16 = 0x00000004,
+ /**
+ * \~english Symmetric cipher block size is 32 bytes
+ */
+ SYMMETRIC_CIPHER_BLOCK_SIZE_32 = 0x00000008
+};
+
+/**
+ * \~english Symmetric Cipher Round
+ */
+enum SymmetricCipherRound {
+ /**
+ * \~english Symmetric cipher round is 1
+ */
+ SYMMETRIC_CIPHER_ROUND_1 = 0x00000001,
+ /**
+ * \~english Symmetric cipher round is 2
+ */
+ SYMMETRIC_CIPHER_ROUND_2 = 0x00000002,
+ /**
+ * \~english Symmetric cipher round is 8.5
+ */
+ SYMMETRIC_CIPHER_ROUND_8_5 = 0x00000004,
+ /**
+ * \~english Symmetric cipher round is 10
+ */
+ SYMMETRIC_CIPHER_ROUND_10 = 0x00000008,
+ /**
+ * \~english Symmetric cipher round is 12
+ */
+ SYMMETRIC_CIPHER_ROUND_12 = 0x00000010,
+ /**
+ * \~english Symmetric cipher round is 14
+ */
+ SYMMETRIC_CIPHER_ROUND_14 = 0x00000020,
+ /**
+ * \~english Symmetric cipher round is 16
+ */
+ SYMMETRIC_CIPHER_ROUND_16 = 0x00000040
+};
+
+/**
+ * \~english Asymmetric Padding Mode
+ */
+enum AsymmetricPaddingMode {
+ /**
+ * \~english RSA PKCS1 asymmetric padding mode
+ */
+ ASYMMETRIC_PADDING_MODE_RSA_PKCS1 = 1,
+ /**
+ * \~english RSA SSLV23 asymmetric padding mode
+ */
+ ASYMMETRIC_PADDING_MODE_RSA_SSLV23,
+ /**
+ * \~english RSA NOPADDING asymmetric padding mode
+ */
+ ASYMMETRIC_PADDING_MODE_RSA_NOPADDING,
+ /**
+ * \~english RSA OAEP asymmetric padding mode
+ */
+ ASYMMETRIC_PADDING_MODE_RSA_OAEP,
+ /**
+ * \~english RSA PSS asymmetric padding mode
+ */
+ ASYMMETRIC_PADDING_MODE_RSA_PSS
+};
+
+/**
+ * @union CipherParameter
+ * \~english @par Brief
+ * Union of cipher parameter
+ */
+union CipherParameter {
+ /**
+ * \~english Struct of symmetric cipher parameter
+ */
+ struct SymmetricCipherParameter {
+ /**
+ * \~english Symmetric cipher mode
+ */
+ enum SymmetricCipherMode mode;
+ /**
+ * \~english Symmetric cipher block size
+ */
+ enum SymmetricCipherBlockSize block_size;
+ /**
+ * \~english Symmetric cipher round
+ */
+ enum SymmetricCipherRound round;
+ /**
+ * \~english Padding ON/OFF. Only used in CBC mode and ECB mode.
+ * Padding ON :
+ * Encrypt:
+ * 1.If plaintext length isn't aligned with block size, the
+ * ciphertext length is aligned with block size.
+ * 2.If plaintext length is aligned with block size, the
+ * ciphertext length is equal to plaintext length + 1 block size.
+ * Decrypt:
+ * 1.If ciphertext length isn't aligned with block size, return error.
+ * 2.If ciphertext length is aligned with block size, plaintext length
+ * is equal to ciphertext length minus padding length. Padding length
+ * is greater than 0 and not greater than block size.
+ * Padding OFF:
+ * Encrypt:
+ * 1.If plaintext length isn't aligned with block size, return error.
+ * 2.If plaintext length is aligned with block size, the
+ * ciphertext length is equal to plaintext length.
+ * Decrypt:
+ * 1.If ciphertext length isn't aligned with block size, return error.
+ * 2.If ciphertext length is aligned with block size, the
+ * plaintext length is equal to ciphertext length.
+ */
+ bool to_pad;
+ } symmetric;
+
+ /**
+ * \~english Struct of asymmetric cipher parameter
+ */
+ struct AsymmetricCipherParameter {
+ /**
+ * \~english Asymmetric padding mode
+ */
+ enum AsymmetricPaddingMode mode;
+ } asymmetric;
+};
+
+
+/**
+ * \~english Symmetric cipher key type
+ */
+enum SymmetricCipherKeyType {
+ /**
+ * \~english Key is managed by hardware/chip
+ */
+ SYMMETRIC_CIPHER_KEY_TYPE_MANAGED,
+ /**
+ * \~english Key is provided by user
+ */
+ SYMMETRIC_CIPHER_KEY_TYPE_USER
+};
+
+/**
+ * @struct RsaPrivateKey
+ * \~english @par Brief
+ * Struct of RSA private key
+ */
+struct RsaPrivateKey {
+ /**
+ * \~english Private exponent
+ */
+ uint8_t d[RSA_PRIVATE_EXPONENT_MAX_SIZE];
+ /**
+ * \~english Modulus
+ */
+ uint8_t n[RSA_MODULUS_MAX_SIZE];
+ /**
+ * \~english The length of private exponent
+ */
+ uint32_t d_length;
+ /**
+ * \~english The length of modulus
+ */
+ uint32_t n_length;
+};
+
+/**
+ * @union PrivateKey
+ * \~english @par Brief
+ * Union of private key
+ */
+union PrivateKey {
+ /**
+ * \~english Rsa private key
+ */
+ struct RsaPrivateKey rsa;
+};
+
+/**
+ * @struct RsaPublicKey
+ * \~english @par Brief
+ * Union of RSA public key
+ */
+struct RsaPublicKey {
+ /**
+ * \~english Public exponent
+ */
+ uint8_t e[RSA_PUBLIC_EXPONENT_MAX_SIZE];
+ /**
+ * \~english Modulus
+ */
+ uint8_t n[RSA_MODULUS_MAX_SIZE];
+ /**
+ * \~english The length of public exponent
+ */
+ uint32_t e_length;
+ /**
+ * \~english The length of modulus
+ */
+ uint32_t n_length;
+};
+
+/**
+ * @union PublicKey
+ * \~english @par Brief
+ * Union of public key
+ */
+union PublicKey {
+ /**
+ * \~english Struct of rsa public key
+ */
+ struct RsaPublicKey rsa;
+};
+
+/**
+ * \~english Asymmetric cipher key type
+ */
+enum AsymmetricCipherKeyType {
+ /**
+ * \~english Key is managed by hardware/chip
+ */
+ ASYMMETRIC_CIPHER_KEY_TYPE_MANAGED,
+ /**
+ * \~english Public key is provided by user
+ */
+ ASYMMETRIC_CIPHER_KEY_TYPE_USER_PUBLIC,
+ /**
+ * \~english Private key is provided by user
+ */
+ ASYMMETRIC_CIPHER_KEY_TYPE_USER_PRIVATE
+};
+
+/**
+ * @union KeyParam
+ * \~english @par Brief
+ * Union of key parameter
+ */
+union KeyParam {
+ /**
+ * \~english Struct of symmetric key paramater
+ */
+ struct SymmetricKeyParam {
+ /**
+ * \~english Symmetric cipher key type
+ */
+ enum SymmetricCipherKeyType key_type;
+ /**
+ * \~english Union of symmetric key parameter
+ */
+ union {
+ /**
+ * \~english The symmetric key index
+ */
+ uint32_t managed_key_index;
+ /**
+ * \~english Struct of user key
+ */
+ struct {
+ /**
+ * \~english Key source
+ */
+ uint8_t* key;
+ /**
+ * \~english Key length
+ */
+ uint32_t key_len;
+ /**
+ * \~english Key Initialization vector.
+ */
+ uint8_t* iv;
+ /**
+ * \~english Initialization vector length.The length should be
+ * equal to block size, otherwise return error.
+ */
+ uint32_t iv_len;
+ } user_key;
+ } key_param;
+ } symmetric;
+ /**
+ * \~english Struct of asymmetric key parameter
+ */
+ struct AsymmetricKeyParam {
+ /**
+ * \~english Asymmetric cipher key type
+ */
+ enum AsymmetricCipherKeyType key_type;
+ /**
+ * \~english Union of asymmetric key parameter
+ */
+ union {
+ /**
+ * \~english The asymmetric key index
+ */
+ uint32_t managed_key_index;
+ /**
+ * \~english Union of user key
+ */
+ union {
+ /**
+ * \~english Public key
+ */
+ union PublicKey* public_key;
+ /**
+ * \~english Private key
+ */
+ union PrivateKey* private_key;
+ } user_key;
+ } key_param;
+ } asymmetric;
+};
+
+/**
+ * \~english hash type
+ */
+enum HashType {
+ /**
+ * \~english hash type is md5
+ */
+ HASH_TYPE_MD5 = 1,
+ /**
+ * \~english hash type is sha1
+ */
+ HASH_TYPE_SHA1,
+ /**
+ * \~english hash type is sha224
+ */
+ HASH_TYPE_SHA224,
+ /**
+ * \~english hash type is sha256
+ */
+ HASH_TYPE_SHA256,
+ /**
+ * \~english hash type is sha384
+ */
+ HASH_TYPE_SHA384,
+ /**
+ * \~english hash type is sha512
+ */
+ HASH_TYPE_SHA512
+};
+
+/**
+ * \ingroup EncryptStart
+ * \~english @par Brief
+ * Initialize the encrypt context information.
+ * \~english @param [in] cipher_type
+ * enum CipherType - Cipher type.
+ * \~english @param [in] param
+ * union CipherParameter* - Cipher parameter
+ * \~english @param [in] key
+ * union KeyParam* - Key parameter
+ * \~english @param [out] ctx
+ * void** - The encrypt information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize
+ * fail or hardware I/O operation fail or
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter "cipher_type" is less than SYMMETRIC_CIPHER_AES
+ * or greater than ASYMMETRIC_CIPHER_ECDSA [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "param" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "key" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle initialize failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Initialize the encrypt context information according to cipher type,
+ * cipher parameter and key parameter.
+ * - If EncryptStart() was called successfully, EncryptCleanup() should
+ * be called to clean up encrypt context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * EncryptUpdate, EncryptFinish, EncryptCleanup
+ */
+EFrameworkunifiedStatus EncryptStart(enum CipherType cipher_type, union CipherParameter* param,
+ union KeyParam* key, void** ctx);
+
+/**
+ * \ingroup EncryptUpdate
+ * \~english @par Brief
+ * Encrypt plaintext information.
+ * \~english @param [in] ctx
+ * void* - The encrypt information context handle.
+ * \~english @param [in] in
+ * const uint8_t* - The plaintext to be encrypted.
+ * \~english @param [in] in_len
+ * uint32_t - The input buffer length
+ * in_len shall be greater than 0 for symmetric encrypt.
+ * in_len shall be greater than 0 and not greater than
+ * RSA_PRIVATE_EXPONENT_MAX_SIZE/8 - RSA_PADDING_MINIMUM_SIZE
+ * for RSA asymmetric encrypt.
+ * \~english @param [out] out
+ * uint8_t* - The ciphertext after plaintext had been encrypted.
+ * \~english @param [in] out_len
+ * uint32_t - The output buffer length.
+ * out_len shall not be less than in_len + 1 block size for symmetric encrypt.
+ * out_len shall not be less than RSA_PRIVATE_EXPONENT_MAX_SIZE/8 for RSA asymmetric encrypt.
+ * \~english @param [out] true_length
+ * uint32_t* - The ciphertext length.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - EncryptStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in_len" is 0 for symmetric encrypt[eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in_len" is 0 or greater than
+ * RSA_PRIVATE_EXPONENT_MAX_SIZE/8 - RSA_PADDING_MINIMUM_SIZE for RSA asymmetric encrypt[eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than in_len + 1 block size
+ * for symmetric encrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than RSA_PRIVATE_EXPONENT_MAX_SIZE/8
+ * for RSA asymmetric encrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusFail]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Update the plaintext to ciphertext by symmetric or asymmetric encrypt algorithm.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * EncryptStart, EncryptFinish, EncryptCleanup
+ */
+EFrameworkunifiedStatus EncryptUpdate(void* ctx, const uint8_t* in, uint32_t in_len,
+ uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup EncryptFinish
+ * \~english @par Brief
+ * Encrypt the final plaintext information.
+ * \~english @param [in] ctx
+ * void* - The encrypt information context handle.
+ * \~english @param [out] out
+ * uint8_t* - The ciphertext after plaintext had been encrypted.
+ * out is useless for RSA asymmetric encrypt.
+ * \~english @param [in] out_len
+ * uint32_t - The final output buffer length.
+ * out_len shall not be less than 1 block size for symmetric encrypt.
+ * out_len is useless for RSA asymmetric encrypt.
+ * \~english @param [out] true_length
+ * uint32_t* - The ciphertext length.
+ * true_length is useless for RSA asymmetric encrypt.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - EncryptStart() and EncryptUpdate() were called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than 1 block size
+ * for symmetric encrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Update the final plaintext to ciphertext for symmetric encrypt and do nothing for asymmetric encrypt.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * EncryptStart, EncryptUpdate, EncryptCleanup
+ */
+EFrameworkunifiedStatus EncryptFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup EncryptCleanup
+ * \~english @par Brief
+ * Clean up encrypt context information.
+ * \~english @param [in] ctx
+ * void* - The encrypt information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - EncryptStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * \~english @par Detail
+ * - Clean up encrypt context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * EncryptStart, EncryptUpdate, EncryptFinish
+ */
+EFrameworkunifiedStatus EncryptCleanup(void* ctx);
+
+/**
+ * \ingroup DecryptStart
+ * \~english @par Brief
+ * Initialize the decrypt context information.
+ * \~english @param [in] cipher_type
+ * enum CipherType - Cipher type.
+ * \~english @param [in] param
+ * union CipherParameter* - Cipher parameter
+ * \~english @param [in] key
+ * union KeyParam* - Key parameter
+ * \~english @param [out] ctx
+ * void** - The decrypt information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail or hardware I/O
+ * operation fail or hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter "cipher_type" is less than SYMMETRIC_CIPHER_AES
+ * or greater than ASYMMETRIC_CIPHER_ECDSA [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "param" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "key" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle initialize failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Initialize the decrypt context information according to cipher type, cipher parameter and key parameter.
+ * - If DecryptStart() was called successfully, DecryptCleanup() should be called
+ * to clean up decrypt context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * DecryptUpdate, DecryptFinish, DecryptCleanup
+ */
+EFrameworkunifiedStatus DecryptStart(enum CipherType cipher_type, union CipherParameter* param,
+ union KeyParam *key, void** ctx);
+
+/**
+ * \ingroup DecryptUpdate
+ * \~english @par Brief
+ * Decrypt ciphertext information.
+ * \~english @param [in] ctx
+ * void* - The decrypt information context handle.
+ * \~english @param [in] in
+ * const uint8_t* - The ciphertext to be decrypted.
+ * \~english @param [in] in_len
+ * uint32_t - The input buffer length
+ * in_len shall be greater than 0 for symmetric decrypt.
+ * in_len shall be equal to RSA_PRIVATE_EXPONENT_MAX_SIZE/8
+ * for RSA asymmetric decrypt.
+ * \~english @param [out] out
+ * uint8_t* - The plaintext after ciphertext had been decrypted.
+ * \~english @param [in] out_len
+ * uint32_t - The output buffer length.
+ * out_len shall not be less than in_len + 1 block size for symmetric decrypt.
+ * out_len shall not be less than RSA_PRIVATE_EXPONENT_MAX_SIZE/8 - RSA_PADDING_MINIMUM_SIZE
+ * for RSA asymmetric decrypt.
+ * \~english @param [out] true_length
+ * uint32_t* - The plaintext length.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - DecryptStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in_len" is 0 for symmetric decrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in_len" isn't equal to
+ * RSA_PRIVATE_EXPONENT_MAX_SIZE/8 for RSA asymmetric decrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than in_len
+ * for symmetric decrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than RSA_PRIVATE_EXPONENT_MAX_SIZE/8 - RSA_PADDING_MINIMUM_SIZE
+ * for RSA asymmetric decrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Update the ciphertext to plaintext by symmetric or asymmetric decrypt algorithm.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * DecryptStart, DecryptFinish, DecryptCleanup
+ */
+EFrameworkunifiedStatus DecryptUpdate(void* ctx, const uint8_t* in, uint32_t in_len,
+ uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup DecryptFinish
+ * \~english @par Brief
+ * Decrypt the final ciphertext information.
+ * \~english @param [in] ctx
+ * void* - The decrypt information context handle.
+ * \~english @param [out] out
+ * uint8_t* - The plaintext after ciphertext had been decrypted.
+ * out is useless for RSA asymmetric decrypt.
+ * \~english @param [in] out_len
+ * uint32_t - The final output buffer length.
+ * out_len shall not be less than 1 block size for symmetric decrypt.
+ * out_len is useless for RSA asymmetric decrypt.
+ * \~english @param [out] true_length
+ * uint32_t* - The plaintext length.
+ * true_length is useless for RSA asymmetric decrypt.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - DecryptStart() and DecryptUpdate() were called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is less than 1 block size
+ * for symmetric decrypt [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Update the final ciphertext to plaintext for symmetric decrypt and do nothing for asymmetric decrypt.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * DecryptStart, DecryptUpdate, DecryptCleanup
+ */
+EFrameworkunifiedStatus DecryptFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup DecryptCleanup
+ * \~english @par Brief
+ * Clean up decrypt context information.
+ * \~english @param [in] ctx
+ * void* - The decrypt information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+
+ * \~english @par Prerequisite
+ * - DecryptStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * \~english @par Detail
+ * - Clean up decrypt context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * DecryptStart, DecryptUpdate, DecryptFinish
+ */
+EFrameworkunifiedStatus DecryptCleanup(void* ctx);
+
+/**
+ * \ingroup HashStart
+ * \~english @par Brief
+ * Initialize hash context information.
+ * \~english @param [in] hash_type
+ * enum HashType - Hash type.
+ * \~english @param [out] ctx
+ * void** - The hash information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail or hardware I/O operation
+ * fail or hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter "hash_type" less than HASH_TYPE_MD5
+ * or greater than HASH_TYPE_SHA512 [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle initialize failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Initialize hash context information according to hash type.
+ * - If HashStart() was called successfully, HashCleanup() should be called
+ * to clean up hash context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * HashUpdate, HashFinish, HashCleanup
+ */
+EFrameworkunifiedStatus HashStart(enum HashType hash_type, void** ctx);
+
+/**
+ * \ingroup HashUpdate
+ * \~english @par Brief
+ * Caculate hash value of input data.
+ * \~english @param [in] ctx
+ * void* - The hash information context handle.
+ * \~english @param [in] in
+ * const uint8_t* - The input data to be hashed.
+ * \~english @param [in] in_len
+ * uint32_t - The input buffer length
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - HashStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "in_len" is 0 [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Caculate hash value of input data.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * HashStart, HashFinish, HashCleanup
+ */
+EFrameworkunifiedStatus HashUpdate(void* ctx, const uint8_t* in, uint32_t in_len);
+
+/**
+ * \ingroup HashFinish
+ * \~english @par Brief
+ * Caculate final message digest.
+ * \~english @param [in] ctx
+ * void* - The hash information context handle.
+ * \~english @param [out] out
+ * uint8_t* - The message digest after all input data had been hashed.
+ * \~english @param [in] out_len
+ * uint32_t - The output buffer length.
+ * \~english @param [out] true_length
+ * uint32_t* - The message digest length.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - HashStart() and HashUpdate() were called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is 0 [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Caculate final message digest.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * HashStart, HashUpdate, HashCleanup
+ */
+EFrameworkunifiedStatus HashFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup HashCleanup
+ * \~english @par Brief
+ * Clean up hash context information.
+ * \~english @param [in] ctx
+ * void* - The hash information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - HashStart() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * \~english @par Detail
+ * - Clean up hash context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * HashStart, HashUpdate, HashFinish
+ */
+EFrameworkunifiedStatus HashCleanup(void* ctx);
+
+/**
+ * \ingroup RandomInit
+ * \~english @par Brief
+ * Initialize random number context information.
+ * \~english @param [out] ctx
+ * void** - The random number information context handle.
+ * \~english @param [in] seed_buffer
+ * uint8_t* - The random number seed buffer.
+ * \~english @param [in] buffer_len
+ * uint32_t - The random number seed buffer length.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail or hardware I/O operation
+ * fail or hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "seed_buffer" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "buffer_len" is 0 [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle initialize failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Initialize random number context information according to random number seed.
+ * - If RandomInit() was called successfully, RandomCleanup() should be called to
+ * clean up random number context information. If RandomInit() was called faild,
+ * RandomCleanup() must not be called.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * RandomGet, RandomCleanup
+ */
+EFrameworkunifiedStatus RandomInit(void** ctx, uint8_t* seed_buffer, uint32_t buffer_len);
+
+/**
+ * \ingroup RandomGet
+ * \~english @par Brief
+ * Get random number.
+ * \~english @param [in] ctx
+ * void* - The random number information context handle.
+ * \~english @param [out] out
+ * uint8_t* - The random number that caculated by random number seed.
+ * \~english @param [in] out_len
+ * uint32_t - The output buffer length.
+ * \~english @param [out] true_length
+ * uint32_t* - The random number length.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware/handle initialize fail, hardware I/O operation fail,
+ * hardware device busy or allocate context handle fail.
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - RandomInit() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "out_len" is 0 [eFrameworkunifiedStatusInvldParam]
+ * - If the parameter "true_length" is NULL [eFrameworkunifiedStatusInvldParam]
+ * - If the hardware/handle init failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * - If ctx can not be allocated [eFrameworkunifiedStatusFail]
+ * \~english @par Detail
+ * - Get random number.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * RandomInit, RandomCleanup
+ */
+EFrameworkunifiedStatus RandomGet(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length);
+
+/**
+ * \ingroup RandomCleanup
+ * \~english @par Brief
+ * Clean up random number context information.
+ * \~english @param [in] ctx
+ * void* - The random number information context handle.
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusInvldParam : indicates parameter error.
+ * \~english @par Prerequisite
+ * - RandomInit() was called successfully.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the parameter "ctx" is NULL [eFrameworkunifiedStatusInvldParam]
+ * \~english @par Detail
+ * - Clean up random number context information.
+ * - The API can be used by multiple processes.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * RandomInit, RandomGet
+ */
+EFrameworkunifiedStatus RandomCleanup(void* ctx);
+
+/**
+ * \ingroup ResetSecurityIC
+ * \~english @par Brief
+ * Security IC Reset.
+ * \~english @param none
+ * \~english @retval eFrameworkunifiedStatusOK : indicates success
+ * \~english @retval eFrameworkunifiedStatusFail : indicates the hardware initialize fail, hardware I/O operation fail,
+ * hardware device busy.
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - If the hardware initialize failed [eFrameworkunifiedStatusFail]
+ * - If the hardware I/O operation failed [eFrameworkunifiedStatusFail]
+ * - If the hardware device is busy [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Security IC Reset.
+ * - The API can be used by multiple processes.
+ * - This API does not cleanup context information when EncryptStart(), DecryptStart() or HashStart() is successfull.
+ * Use EncryptCleanup(), DecryptCleanup() or RandomCleanup() to cleanup context information.
+ * \~english @see
+ * None
+ */
+EFrameworkunifiedStatus ResetSecurityIC(void);
+
+/** @}*/ // end of security_hal
+/** @}*/ // end of update_service
+
+#endif // HAL_API_SECURITY_HAL_H_
diff --git a/video_in_hal/security_hal/inc/security_hal_securityhallog.h b/video_in_hal/security_hal/inc/security_hal_securityhallog.h
new file mode 100755
index 0000000..44de2ac
--- /dev/null
+++ b/video_in_hal/security_hal/inc/security_hal_securityhallog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_SECURITY_HAL_SECURITYHALLOG_H_
+#define INC_SECURITY_HAL_SECURITYHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_SECURITY_HAL_SECURITYHALLOG_H_
diff --git a/video_in_hal/security_hal/src/security_hal.cpp b/video_in_hal/security_hal/src/security_hal.cpp
new file mode 100755
index 0000000..ee9f7ea
--- /dev/null
+++ b/video_in_hal/security_hal/src/security_hal.cpp
@@ -0,0 +1,615 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "security_hal.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "security_hal_securityhallog.h"
+
+#define MD5_DIGEST_LENGTH 16 // md5 digest length
+#define SHA1_DIGEST_LENGTH 20 // sha1 digest length
+#define SHA224_DIGEST_LENGTH 28 // sha224 digest length
+#define SHA256_DIGEST_LENGTH 32 // sha256 digest length
+#define SHA384_DIGEST_LENGTH 48 // sha384 digest length
+#define SHA512_DIGEST_LENGTH 64 // sha512 digest length
+#define BITS_PER_BYTE 8 // the number of bits per byte
+#define KEY_SOURCE_SIZE_128 16 // the size of key source is 128 bits
+#define KEY_SOURCE_SIZE_192 24 // the size of key source is 192 bits
+#define KEY_SOURCE_SIZE_256 32 // the size of key source is 256 bits
+
+/**
+ * the max length of input buffer for RSA asymmetric encrypt or
+ * the minimum length of output buffer for RSA asymmetric decrypt
+ */
+#define RSA_PRIVATE_MAX_SIZE_BYTE \
+ (RSA_PRIVATE_EXPONENT_MAX_SIZE/BITS_PER_BYTE - RSA_PADDING_MINIMUM_SIZE)
+
+/**
+ * cipher context information
+ */
+struct CipherContext {
+ enum CipherType cipher_type;
+ union CipherParameter cipher_parameter;
+ union KeyParam key_param;
+};
+
+/**
+ * hash context information
+ */
+struct HashContext {
+ enum HashType hash_type;
+};
+
+/**
+ * random number context information
+ */
+struct RandomContext {
+ uint8_t* seed_buffer;
+ uint32_t buffer_len;
+};
+
+bool CheckParameterVaildity(enum CipherType cipher_type,
+ union CipherParameter* param, union KeyParam* key) {
+ if (SYMMETRIC_CIPHER_AES == cipher_type) {
+ // check cipher mode for symmetric encrypt/decrypt
+ if (SYMMETRIC_CIPHER_MODE_BLOCK_ECB != param->symmetric.mode &&
+ SYMMETRIC_CIPHER_MODE_BLOCK_CBC != param->symmetric.mode &&
+ SYMMETRIC_CIPHER_MODE_BLOCK_CFB != param->symmetric.mode &&
+ SYMMETRIC_CIPHER_MODE_BLOCK_OFB != param->symmetric.mode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the cipher mode for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ // check cipher block size for AES symmetric encrypt/decrypt
+ if (SYMMETRIC_CIPHER_BLOCK_SIZE_16 != param->symmetric.block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the block size for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ // check cipher key type for AES symmetric encrypt/decrypt
+ if (SYMMETRIC_CIPHER_KEY_TYPE_MANAGED != key->symmetric.key_type &&
+ SYMMETRIC_CIPHER_KEY_TYPE_USER != key->symmetric.key_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the cipher key type for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ if (SYMMETRIC_CIPHER_KEY_TYPE_MANAGED == key->symmetric.key_type) {
+ // check cipher rounds for AES symmetric encrypt/decrypt
+ if (SYMMETRIC_CIPHER_ROUND_10 != param->symmetric.round &&
+ SYMMETRIC_CIPHER_ROUND_12 != param->symmetric.round &&
+ SYMMETRIC_CIPHER_ROUND_14 != param->symmetric.round) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the cipher round for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ } else {
+ // check parameter of key provided by user for AES symmetric encrypt/decrypt
+ if (NULL == key->symmetric.key_param.user_key.key) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "user_key.key is NULL");
+ return false;
+ }
+ if (KEY_SOURCE_SIZE_128 == key->symmetric.key_param.user_key.key_len) {
+ if (SYMMETRIC_CIPHER_ROUND_10 != param->symmetric.round) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "cipher round should be 10 if key len is 128 bits");
+ return false;
+ }
+ } else if (KEY_SOURCE_SIZE_192 == key->symmetric.key_param.user_key.key_len) {
+ if (SYMMETRIC_CIPHER_ROUND_12 != param->symmetric.round) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "cipher round should be 12 if key len is 192 bits");
+ return false;
+ }
+ } else if (KEY_SOURCE_SIZE_256 == key->symmetric.key_param.user_key.key_len) {
+ if (SYMMETRIC_CIPHER_ROUND_14 != param->symmetric.round) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "cipher round should be 14 if key len is 256 bits");
+ return false;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "key len should be 128, 192 or 256 bits for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ if (SYMMETRIC_CIPHER_MODE_BLOCK_ECB != param->symmetric.mode) {
+ if (NULL == key->symmetric.key_param.user_key.iv) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "user_key.iv is NULL");
+ return false;
+ }
+ if (key->symmetric.key_param.user_key.iv_len != param->symmetric.block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "user_key.iv_len is not equal to block size for AES symmetric encrypt/decrypt");
+ return false;
+ }
+ }
+ }
+ } else if (ASYMMETRIC_CIPHER_RSA == cipher_type) {
+ // check the padding mode for RSA asymmetric encrypt/decrypt
+ if (ASYMMETRIC_PADDING_MODE_RSA_PKCS1 != param->asymmetric.mode &&
+ ASYMMETRIC_PADDING_MODE_RSA_SSLV23 != param->asymmetric.mode &&
+ ASYMMETRIC_PADDING_MODE_RSA_NOPADDING != param->asymmetric.mode &&
+ ASYMMETRIC_PADDING_MODE_RSA_OAEP != param->asymmetric.mode &&
+ ASYMMETRIC_PADDING_MODE_RSA_PSS != param->asymmetric.mode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the cipher mode for asymmetric encrypt/decrypt");
+ return false;
+ }
+ // check cipher key type for RSA asymmetric encrypt/decrypt
+ if (ASYMMETRIC_CIPHER_KEY_TYPE_MANAGED != key->asymmetric.key_type &&
+ ASYMMETRIC_CIPHER_KEY_TYPE_USER_PUBLIC != key->asymmetric.key_type &&
+ ASYMMETRIC_CIPHER_KEY_TYPE_USER_PRIVATE != key->asymmetric.key_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "don't support the cipher key type for asymmetric encrypt/decrypt");
+ return false;
+ }
+ if (ASYMMETRIC_CIPHER_KEY_TYPE_USER_PUBLIC == key->asymmetric.key_type) {
+ // check parameter of public key provided by user for RSA asymmetric encrypt/decrypt
+ if (NULL == key->asymmetric.key_param.user_key.public_key) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "public_key is NULL");
+ return false;
+ }
+ if (RSA_PUBLIC_EXPONENT_MAX_SIZE <
+ key->asymmetric.key_param.user_key.public_key->rsa.e_length ||
+ RSA_MODULUS_MAX_SIZE <
+ key->asymmetric.key_param.user_key.public_key->rsa.n_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "e_length or n_length is too large, e_length:%d, n_length:%d",
+ key->asymmetric.key_param.user_key.public_key->rsa.e_length,
+ key->asymmetric.key_param.user_key.public_key->rsa.n_length);
+ return false;
+ }
+ } else if (ASYMMETRIC_CIPHER_KEY_TYPE_USER_PRIVATE == key->asymmetric.key_type) {
+ // check parameter of key provided by user for RSA asymmetric encrypt/decrypt
+ if (NULL == key->asymmetric.key_param.user_key.private_key) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "private_key is NULL");
+ return false;
+ }
+ if (RSA_PRIVATE_EXPONENT_MAX_SIZE <
+ key->asymmetric.key_param.user_key.private_key->rsa.d_length ||
+ RSA_MODULUS_MAX_SIZE <
+ key->asymmetric.key_param.user_key.private_key->rsa.n_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "d_length or n_length is too large, d_length:%d, n_length:%d",
+ key->asymmetric.key_param.user_key.private_key->rsa.d_length,
+ key->asymmetric.key_param.user_key.private_key->rsa.n_length);
+ return false;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "the cipher_type isn't support");
+ return false;
+ }
+ return true;
+}
+
+// Initialize the encrypt context information
+EFrameworkunifiedStatus EncryptStart(enum CipherType cipher_type, union CipherParameter* param,
+ union KeyParam* key, void** ctx) {
+ if (SYMMETRIC_CIPHER_AES != cipher_type && ASYMMETRIC_CIPHER_RSA != cipher_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "the cipher_type isn't support");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == param || NULL == key || NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "param, key or ctx is NULL, param:%p key:%p ctx:%p", param, key, ctx);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ bool ret = CheckParameterVaildity(cipher_type, param, key);
+ if (true != ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "parameter error");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ void* ctx_temp = malloc(sizeof(CipherContext));
+ if (NULL == ctx_temp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to malloc %lu byte for ctx, errno=%d",
+ sizeof(CipherContext), errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ memset(ctx_temp, 0, sizeof(CipherContext));
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx_temp);
+ pcipher_context->cipher_type = cipher_type;
+ pcipher_context->cipher_parameter = *param;
+ pcipher_context->key_param = *key;
+ *ctx = ctx_temp;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Encrypt plaintext information
+EFrameworkunifiedStatus EncryptUpdate(void* ctx, const uint8_t* in, uint32_t in_len,
+ uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx || NULL == in || NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ctx, in, out or true_length is NULL, ctx:%p in:%p out:%p true_length:%p",
+ ctx, in, out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == in_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "in_len is equal to 0");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx);
+ if (SYMMETRIC_CIPHER_AES == pcipher_context->cipher_type) { // symmetric encrypt
+ uint32_t block_size = pcipher_context->cipher_parameter.symmetric.block_size;
+ if (out_len < in_len + block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is less than in_len plus block_size");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memcpy(out, in, in_len);
+ *true_length = in_len;
+ } else if (ASYMMETRIC_CIPHER_RSA == pcipher_context->cipher_type) { // asymmetric encrypt
+ if (RSA_PRIVATE_MAX_SIZE_BYTE < in_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "in_len is greater than RSA_PRIVATE_MAX_SIZE_BYTE");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (RSA_PRIVATE_EXPONENT_MAX_SIZE/BITS_PER_BYTE > out_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "out_len is less than RSA_PRIVATE_EXPONENT_MAX_SIZE/BITS_PER_BYTE");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ // out_len is greater than in_len
+ memcpy(out, in, in_len);
+ *true_length = in_len;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "the cipher_type isn't support, cipher_type:%d", pcipher_context->cipher_type);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+// Encrypt the final plaintext information
+EFrameworkunifiedStatus EncryptFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx);
+ if (SYMMETRIC_CIPHER_AES == pcipher_context->cipher_type) { // symmetric encrypt
+ if (NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "out or true_length is NULL, out:%p true_length:%p", out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ uint32_t block_size = pcipher_context->cipher_parameter.symmetric.block_size;
+ if (out_len < block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is less than block_size");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (true == pcipher_context->cipher_parameter.symmetric.to_pad) {
+ // Padding on, the true_length is equal to block_size.
+ *true_length = block_size;
+ } else {
+ // Padding off, true_length is equal to 0.
+ *true_length = 0;
+ }
+ } else if (ASYMMETRIC_CIPHER_RSA == pcipher_context->cipher_type) {
+ // EncryptFinish is useless for RSA asymmetric encrypt. So do nothing.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "the cipher_type isn't support, cipher_type:%d", pcipher_context->cipher_type);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+// Clean up encrypt context information
+EFrameworkunifiedStatus EncryptCleanup(void* ctx) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memset(ctx, 0, sizeof(CipherContext));
+ free(ctx);
+ return eFrameworkunifiedStatusOK;
+}
+
+// Initialize the decrypt context information
+EFrameworkunifiedStatus DecryptStart(enum CipherType cipher_type, union CipherParameter* param,
+ union KeyParam *key, void** ctx) {
+ if (SYMMETRIC_CIPHER_AES != cipher_type && ASYMMETRIC_CIPHER_RSA != cipher_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "the cipher_type isn't support");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == param || NULL == key || NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "param, key or ctx is NULL, param:%p key:%p ctx:%p", param, key, ctx);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ bool ret = CheckParameterVaildity(cipher_type, param, key);
+ if (true != ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "parameter error");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ void* ctx_temp = malloc(sizeof(CipherContext));
+ if (NULL == ctx_temp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to malloc %lu byte for ctx, errno=%d",
+ sizeof(CipherContext), errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ memset(ctx_temp, 0, sizeof(CipherContext));
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx_temp);
+ pcipher_context->cipher_type = cipher_type;
+ pcipher_context->cipher_parameter = *param;
+ pcipher_context->key_param = *key;
+ *ctx = ctx_temp;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Decrypt ciphertext information
+EFrameworkunifiedStatus DecryptUpdate(void* ctx, const uint8_t* in, uint32_t in_len,
+ uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx || NULL == in || NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ctx, in, out or true_length is NULL, ctx:%p in:%p out:%p true_length:%p",
+ ctx, in, out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx);
+ if (SYMMETRIC_CIPHER_AES == pcipher_context->cipher_type) { // symmetric decrypt
+ if (0 == in_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "in_len is equal to 0");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ uint32_t block_size = pcipher_context->cipher_parameter.symmetric.block_size;
+ if (out_len < in_len + block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is less than in_len plus block_size");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memcpy(out, in, in_len);
+ *true_length = in_len;
+ } else if (ASYMMETRIC_CIPHER_RSA == pcipher_context->cipher_type) { // asymmetric decrypt
+ if (RSA_PRIVATE_EXPONENT_MAX_SIZE/BITS_PER_BYTE != in_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "in_len isn't equal to RSA_PRIVATE_EXPONENT_MAX_SIZE/BITS_PER_BYTE");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (SHA256_DIGEST_LENGTH > out_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "out_len is less than SHA256_DIGEST_LENGTH");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memcpy(out, in, SHA256_DIGEST_LENGTH);
+ *true_length = SHA256_DIGEST_LENGTH;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "the cipher_type isn't support, cipher_type:%d", pcipher_context->cipher_type);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+// Decrypt the final ciphertext information
+EFrameworkunifiedStatus DecryptFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ CipherContext* pcipher_context = reinterpret_cast<CipherContext*>(ctx);
+ if (SYMMETRIC_CIPHER_AES == pcipher_context->cipher_type) { // symmetric encrypt
+ if (NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "out or true_length is NULL, out:%p true_length:%p", out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ uint32_t block_size = pcipher_context->cipher_parameter.symmetric.block_size;
+ if (out_len < block_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is less than block_size");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (true == pcipher_context->cipher_parameter.symmetric.to_pad) {
+ // Padding on, the true_length is equal to block_size - padding_length. Because security_hal
+ // is stub implement, padding_length is unknown. Set true_length to 0.
+ *true_length = 0;
+ } else {
+ // Padding off, true_length is equal to 0.
+ *true_length = 0;
+ }
+ } else if (ASYMMETRIC_CIPHER_RSA == pcipher_context->cipher_type) {
+ // EncryptFinish is useless for RSA asymmetric decrypt. So do nothing.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "the cipher_type isn't support, cipher_type:%d", pcipher_context->cipher_type);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+// Clean up decrypt context information
+EFrameworkunifiedStatus DecryptCleanup(void* ctx) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memset(ctx, 0, sizeof(CipherContext));
+ free(ctx);
+ return eFrameworkunifiedStatusOK;
+}
+
+// Initialize hash context information
+EFrameworkunifiedStatus HashStart(enum HashType hash_type, void** ctx) {
+ if (HASH_TYPE_MD5 > hash_type || HASH_TYPE_SHA512 < hash_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "the hash_type isn't support");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ void* ctx_temp = malloc(sizeof(HashContext));
+ if (NULL == ctx_temp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to malloc %lu byte for ctx, errno=%d",
+ sizeof(HashContext), errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ memset(ctx_temp, 0, sizeof(HashContext));
+ HashContext* phash_context = reinterpret_cast<HashContext*>(ctx_temp);
+ phash_context->hash_type = hash_type;
+ *ctx = ctx_temp;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Caculate hash value of input data
+EFrameworkunifiedStatus HashUpdate(void* ctx, const uint8_t* in, uint32_t in_len) {
+ if (NULL == ctx || NULL == in) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx or in is NULL, ctx:%p in:%p", ctx, in);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == in_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "in_len is equal to 0");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+// Caculate final message digest
+EFrameworkunifiedStatus HashFinish(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx || NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ctx, out or true_length is NULL, ctx:%p out:%p true_length:%p",
+ ctx, out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ HashContext* phash_context = reinterpret_cast<HashContext*>(ctx);
+ uint32_t digest_length = 0;
+ switch (phash_context->hash_type) {
+ case HASH_TYPE_MD5:
+ digest_length = HASH_TYPE_MD5;
+ break;
+ case HASH_TYPE_SHA1:
+ digest_length = SHA1_DIGEST_LENGTH;
+ break;
+ case HASH_TYPE_SHA224:
+ digest_length = SHA224_DIGEST_LENGTH;
+ break;
+ case HASH_TYPE_SHA256:
+ digest_length = SHA256_DIGEST_LENGTH;
+ break;
+ case HASH_TYPE_SHA384:
+ digest_length = SHA384_DIGEST_LENGTH;
+ break;
+ case HASH_TYPE_SHA512:
+ digest_length = SHA512_DIGEST_LENGTH;
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "the hash_type isn't support, hash_type:%d", phash_context->hash_type);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (out_len < digest_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is less than %u", digest_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memset(out, 0x00, digest_length);
+ *true_length = digest_length;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Clean up hash context information
+EFrameworkunifiedStatus HashCleanup(void* ctx) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ memset(ctx, 0, sizeof(HashContext));
+ free(ctx);
+ return eFrameworkunifiedStatusOK;
+}
+
+// Initialize random number context information
+EFrameworkunifiedStatus RandomInit(void** ctx, uint8_t* seed_buffer, uint32_t buffer_len) {
+ if (NULL == ctx || NULL == seed_buffer) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ctx or seed_buffer is NULL, ctx:%p seed_buffer:%p", ctx, seed_buffer);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == buffer_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "buffer_len is equal to 0");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ void* ctx_temp = malloc(sizeof(RandomContext));
+ if (NULL == ctx_temp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to malloc %lu byte for ctx, errno=%d",
+ sizeof(RandomContext), errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ memset(ctx_temp, 0, sizeof(RandomContext));
+ RandomContext* prandom_context = reinterpret_cast<RandomContext*>(ctx_temp);
+ prandom_context->seed_buffer = reinterpret_cast<uint8_t*>(malloc(buffer_len));
+ if (NULL == prandom_context->seed_buffer) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to malloc %d byte for seed_buffer, errno=%d",
+ buffer_len, errno);
+ free(ctx_temp);
+ ctx_temp = NULL;
+ return eFrameworkunifiedStatusFail;
+ }
+ memcpy(prandom_context->seed_buffer, seed_buffer, buffer_len);
+ prandom_context->buffer_len = buffer_len;
+ *ctx = ctx_temp;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Get random number
+EFrameworkunifiedStatus RandomGet(void* ctx, uint8_t* out, uint32_t out_len, uint32_t* true_length) {
+ if (NULL == ctx || NULL == out || NULL == true_length) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ctx, out or true_length is NULL, ctx:%p out:%p true_length:%p",
+ ctx, out, true_length);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ if (0 == out_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "out_len is equal to 0");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ // Because security_hal is stub implement, don't assignment value to out or true_length.
+ return eFrameworkunifiedStatusOK;
+}
+
+// Clean up random number context information
+EFrameworkunifiedStatus RandomCleanup(void* ctx) {
+ if (NULL == ctx) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ctx is NULL");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ RandomContext* prandom_context;
+ prandom_context = reinterpret_cast<RandomContext*>(ctx);
+ if (NULL != prandom_context->seed_buffer) {
+ memset(prandom_context->seed_buffer, 0, prandom_context->buffer_len);
+ free(prandom_context->seed_buffer);
+ prandom_context->seed_buffer = NULL;
+ }
+ memset(prandom_context, 0, sizeof(RandomContext));
+ free(prandom_context);
+ prandom_context = NULL;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Reset Security IC
+EFrameworkunifiedStatus ResetSecurityIC(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/soc_temperature_hal/LICENSE b/video_in_hal/soc_temperature_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/soc_temperature_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/soc_temperature_hal/Makefile b/video_in_hal/soc_temperature_hal/Makefile
new file mode 100755
index 0000000..fa30b35
--- /dev/null
+++ b/video_in_hal/soc_temperature_hal/Makefile
@@ -0,0 +1,66 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libsoc_temperature_hal.so
+
+HEADER := hal_api/soc_temperature_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := soc_temperature_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/video_in_hal/soc_temperature_hal/hal_api/soc_temperature_hal.h b/video_in_hal/soc_temperature_hal/hal_api/soc_temperature_hal.h
new file mode 100755
index 0000000..16c5f6d
--- /dev/null
+++ b/video_in_hal/soc_temperature_hal/hal_api/soc_temperature_hal.h
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file soc_temperature_hal.h
+ */
+
+#ifndef HAL_API_SOC_TEMPERATURE_HAL_H_
+#define HAL_API_SOC_TEMPERATURE_HAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup soc_temperature_hal
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/**
+ * \ingroup GetSoCTemperature
+ * \~english @par Brief
+ * Get SoC temperature value(unit:celsius).
+ * \~english @param [out] temperature
+ * float* - degree celsius
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error (system error)
+ * \~english @par Prerequisite
+ * - The SoC has temperature sensor, and the thermal driver is available.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Parameter temperature is NULL[eFrameworkunifiedStatusNullPointer]
+ * - System error(open/read/close failed)[eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Get SoC temperature value.
+ * - On success eFrameworkunifiedStatusOK is returned and the parameter temperature is set.
+ * - Not eFrameworkunifiedStatusOK is returned if an error occurred.
+ * - Return value shall be checked before temperature is refered.
+ * - Sample code:
+ * @code
+ * #include <stdio.h>
+ * #include <stdlib.h>
+ * #include <soc_temperature_hal.h>
+ * #include <native_service/frameworkunified_types.h>
+ *
+ * int main(int argc, char *argv[]) {
+ * float temperature = 0.0f;
+ * EFrameworkunifiedStatus status = GetSoCTemperature(&temperature);
+ * if (status != eFrameworkunifiedStatusOK) {
+ * printf("Get SoC temperature failed\n");
+ * exit(EXIT_FAILURE);
+ * }
+ * printf("SoC temperature: %f\n", temperature);
+ * exit(EXIT_SUCCESS);
+ * }
+ * @endcode
+ * \~english @see
+ * - None
+ */
+EFrameworkunifiedStatus GetSoCTemperature(float* temperature);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+/** @}*/ // end of soc_temperature_hal
+
+#endif // HAL_API_SOC_TEMPERATURE_HAL_H_
+
diff --git a/video_in_hal/soc_temperature_hal/inc/soc_temperature_hal_soctemperaturehallog.h b/video_in_hal/soc_temperature_hal/inc/soc_temperature_hal_soctemperaturehallog.h
new file mode 100755
index 0000000..6e256e8
--- /dev/null
+++ b/video_in_hal/soc_temperature_hal/inc/soc_temperature_hal_soctemperaturehallog.h
@@ -0,0 +1,75 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef INC_SOC_TEMPERATURE_HAL_SOCTEMPERATUREHALLOG_H_
+#define INC_SOC_TEMPERATURE_HAL_SOCTEMPERATUREHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+#endif // INC_SOC_TEMPERATURE_HAL_SOCTEMPERATUREHALLOG_H_
diff --git a/video_in_hal/soc_temperature_hal/src/soc_temperature_hal.cpp b/video_in_hal/soc_temperature_hal/src/soc_temperature_hal.cpp
new file mode 100755
index 0000000..33b96ee
--- /dev/null
+++ b/video_in_hal/soc_temperature_hal/src/soc_temperature_hal.cpp
@@ -0,0 +1,106 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "soc_temperature_hal.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "soc_temperature_hal_soctemperaturehallog.h"
+
+#define MAX_TEMPERATURE_FROM_DRIVER_LENGTH (9) // 9bytes can content -999999\n\0 - 9999999\n\0 (unit:millicelsius)
+#define DECIMAL (10)
+#define THERMAL_ZONE0_TEMPERATURE_PATH "/sys/class/thermal/thermal_zone0/temp"
+#define THERMAL_ZONE1_TEMPERATURE_PATH "/sys/class/thermal/thermal_zone1/temp"
+#define THERMAL_ZONE2_TEMPERATURE_PATH "/sys/class/thermal/thermal_zone2/temp"
+
+EFrameworkunifiedStatus GetCoreTemperature(int64_t* temperature, const char* node_path) {
+ if ((NULL == temperature) || (NULL == node_path)) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ char sz_temperature[MAX_TEMPERATURE_FROM_DRIVER_LENGTH] = { 0 };
+
+ // read temperature
+ int fd = open(node_path, O_RDONLY);
+ if (0 > fd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open error(%d,%s)", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ ssize_t ret = read(fd, sz_temperature, MAX_TEMPERATURE_FROM_DRIVER_LENGTH - 1);
+ int read_error = errno;
+ close(fd);
+ if (-1 == ret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read error(%d,%s)", read_error, strerror(read_error));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ errno = 0;
+ int64_t temp = strtol(sz_temperature, NULL, DECIMAL);
+ if (errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "strtol error(%d,%s)", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ *temperature = temp;
+ return eFrameworkunifiedStatusOK;
+}
+
+// Get SoC temperature value.
+EFrameworkunifiedStatus GetSoCTemperature(float *temperature) {
+ if (NULL == temperature) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "parameter *temperature is null");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ // Get temperature from thermal_zone0
+ int64_t temperature0 = 0;
+ EFrameworkunifiedStatus e_status = GetCoreTemperature(&temperature0, THERMAL_ZONE0_TEMPERATURE_PATH);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "get temperature0 failed");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // Get temperature from thermal_zone1
+ int64_t temperature1 = 0;
+ e_status = GetCoreTemperature(&temperature1, THERMAL_ZONE1_TEMPERATURE_PATH);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "get temperature1 failed");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // Get temperature from thermal_zone2
+ int64_t temperature2 = 0;
+ e_status = GetCoreTemperature(&temperature2, THERMAL_ZONE2_TEMPERATURE_PATH);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "get temperature2 failed");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // get max temperature
+ int64_t max_temperature = temperature0;
+ if (max_temperature < temperature1) {
+ max_temperature = temperature1;
+ }
+ if (max_temperature < temperature2) {
+ max_temperature = temperature2;
+ }
+
+ *temperature = max_temperature / 1000.0f;
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/src/video_in_hal.c b/video_in_hal/src/video_in_hal.c
new file mode 100755
index 0000000..b639a83
--- /dev/null
+++ b/video_in_hal/src/video_in_hal.c
@@ -0,0 +1,50 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "video_in_hal.h"
+
+VIH_RET InitVideo(SendDiagCodeCallBack call_back)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return VIH_RET_SUCCESS;
+}
+
+VIH_RET ControlVideo(VIH_DISPMNGCTX* pctx, VIH_EVENTID event_id, VIH_CONTROLID control_id)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return VIH_RET_SUCCESS;
+}
+
+VIH_RET TerminateVideo()
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return VIH_RET_SUCCESS;
+}
diff --git a/video_in_hal/stub/clock/LICENSE b/video_in_hal/stub/clock/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/stub/clock/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/stub/clock/Makefile.client b/video_in_hal/stub/clock/Makefile.client
new file mode 100755
index 0000000..e469633
--- /dev/null
+++ b/video_in_hal/stub/clock/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client_clock client_display_time
+
+include ../stub.mk
diff --git a/video_in_hal/stub/clock/client_clock/Makefile b/video_in_hal/stub/clock/client_clock/Makefile
new file mode 100755
index 0000000..9124b7d
--- /dev/null
+++ b/video_in_hal/stub/clock/client_clock/Makefile
@@ -0,0 +1,45 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libClock_API
+
+######### install headers(*.h) #############
+INST_HEADERS = Clock_API.h clock_clock.h
+
+######### compiled sources #############
+libClock_API_SRCS = Clock_API.cpp
+
+######### add source path #############
+VPATH += ./src ./include/stub
+
+######### add include path #############
+CPPFLAGS += -I./include
+
+######### add compile option #############
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+
+include ../../stub.mk
diff --git a/video_in_hal/stub/clock/client_clock/include/stub/Clock_API.h b/video_in_hal/stub/clock/client_clock/include/stub/Clock_API.h
new file mode 100755
index 0000000..375354e
--- /dev/null
+++ b/video_in_hal/stub/clock/client_clock/include/stub/Clock_API.h
@@ -0,0 +1,503 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file Clock_API.h
+ * @brief System community functions header file.
+ */
+
+/*******************************************************************************
+* $Header:: $
+* $Revision:: $
+*******************************************************************************/
+
+ /******************************************************************************
+ * file name : Clock_API.h
+ * system name : PND-A
+ * sub system name : system common function group header file
+ * program name :
+****************************************************************************/
+#ifndef CLOCK_CLIENT_CLOCK_INCLUDE_VEHICLE_SERVICE_CLOCK_API_H_
+#define CLOCK_CLIENT_CLOCK_INCLUDE_VEHICLE_SERVICE_CLOCK_API_H_
+
+#include <time.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup clock
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english The time corrected by GPS.
+ */
+#define CLOCK_CORRECTED_TIME (0U)
+
+/**
+ * \~english The time not corrected by GPS.
+ */
+#define CLOCK_NOT_CORRECTED_TIME (1U)
+
+/**
+ * \~english The time synchronized by GPS RTC.
+ */
+#define CLOCK_RTC_TIME (2U)
+
+/**
+ * \~english GPS time error.
+ */
+#define CLOCK_INVALID_TIME (3U)
+
+/**
+ * \~english The max size memory for time zone.
+ */
+#define TIME_ZONE_MAX_SIZE 256
+
+/**
+ * \~english Return value define.
+ */
+typedef enum tagCLOCK_RETURN {
+ CLOCK_OK, //!< \~english Return successful
+ CLOCK_ERROR, //!< \~english Return failed
+ CLOCK_ERROR_ARGUMENTS //!< \~english Arguments error
+} CLOCK_RETURN;
+/*
+ data type definition
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ \~english API function prototype defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * \ingroup Clock_getSystemTime
+ * \~english @par Brief
+ * - Get the system time.
+ * \~english @param [out] time Store system time data
+ * \~english @param [out] status Store time data status\n
+ * Time status:\n
+ * Valid time : CLOCK_CORRECTED_TIME\n
+ * Invalid time: CLOCK_INVALID_TIME\n
+ * NOTE:When can't communication with Clock service, return "CLOCK_INVALID_TIME"
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The argument used for store system time data is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The argument used for store time data status is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - Get system time error. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return after call end), please check it when used the API.
+ * - Call this API to get the system time and status.
+ * - NOTE:Local time can be got by calling Clock_getLocalTime which parameter is the result of this API.
+ * - The time returned by calling this API is UTC time, its range is from\n
+ * "1970-01-01 00:00:00" to "2038-01-19 03:14:07".
+ * - Clock_getSystemTimeY2K38 can be used to get time later than "2038-01-19 03:14:08".
+ * - Result : "System time and time status" to "System time and status" will be stored in arguments.
+ * \~english @see Clock_getLocalTime, Clock_getSystemTimeY2K38, McOpenSender,\n
+ * McCreateInvokerName, McOpenSyncReceiver, McInvokeSync
+ */
+CLOCK_RETURN Clock_getSystemTime(struct timespec* time, uint8_t* status);
+
+/**
+ * \ingroup Clock_getLocalTime
+ * \~english @par Brief
+ * - Get the local time.
+ * \~english @param [in] base_time Pointer to store base time(seconds)
+ * \~english @param [out] local_time Pointer to store local time
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The argument used to store base time(seconds) is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The argument used to store local time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - Get local time failed. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to get local time.
+ * - The time returned by calling this API is UTC time, its range is from\n
+ * "1970-01-01 00:00:00" to "2038-01-19 03:14:07".
+ * - Clock_getSystemTimeY2K38 can be used to get time later than "2038-01-19 03:14:08".
+ * - Result : Local time will be stored in arguments.
+ * - tm which is changed base on base_time will be returned when the timezone is not set.
+ * \~english @see Clock_getSystemTime, Clock_getSystemTimeY2K38
+ */
+CLOCK_RETURN Clock_getLocalTime(const time_t* base_time, struct tm* local_time);
+
+/**
+ * \ingroup Clock_CnvSecToDate
+ * \~english @par Brief
+ * - Convert specified elapsed seconds to date and time.\n
+ * The specified elapsed seconds are regarded as elapsed time from 1970/01/01 00:00:00.
+ * \~english @param [in] timep The pointer to store the seconds
+ * \~english @param [out] result The pointer to store date time
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The pointer used to store the seconds from base date time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The pointer used to store the date time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - Convert the seconds from base date time to date time failed. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to convert the seconds which is "1970-01-01 00:00:00" to date time.
+ * - The time returned by calling this API is UTC time, its range is from\n
+ * "1970-01-01 00:00:00" to "2038-01-19 03:14:07".
+ * - Clock_getSystemTimeY2K38 can be used to get time later than "2038-01-19 03:14:08".
+ * - Result :Convert the seconds to date time. The seconds is from "1970-01-01 00:00:00".
+ * \~english @see Clock_CnvDateToSec, Clock_CnvSecToDateY2K38
+ */
+CLOCK_RETURN Clock_CnvSecToDate(const time_t* timep, struct tm *result);
+
+/**
+ * \ingroup Clock_CnvDateToSec
+ * \~english @par Brief
+ * - Convert specified date and time to elapsed seconds from 1970/01/01 00:00:00.
+ * \~english @param [in] tm The pointer to store date time to convert
+ * \~english @param [out] result The pointer to store seconds from base time
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The pointer used to store the date time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The pointer used to store the seconds from base date time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to convert the seconds which from "1970-01-01 00:00:00" to date time.
+ * - The API is used when UTC time is in the range from "1970-01-01 00:00:00" to "2038-01-19 03:14:07".
+ * - For more then "2038-01-19 03:14:08", please use Clock_CnvDateToSecY2K38.
+ * - Result : Convert date time to seconds from "1970-01-01 00:00:00".
+ * \~english @see Clock_CnvSecToDate, Clock_CnvDateToSecY2K38
+ */
+CLOCK_RETURN Clock_CnvDateToSec(const struct tm* tm, time_t* result);
+
+/**
+ * \ingroup Clock_setUserTime
+ * \~english @par Brief
+ * - Set the display time when GPS synchronization setting is off.
+ * \~english @param [in] user_time The pointer to store the time(second from base time)
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The pointer used to store the time from base date time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - Get thread name of caller failed. [CLOCK_ERROR]
+ * - Get handle of Clock service message queue failed. [CLOCK_ERROR]
+ * - Generate message queue name for sync call failed. [CLOCK_ERROR]
+ * - Generate message queue for receiving failed. [CLOCK_ERROR]
+ * - Message sync communicate failed. [CLOCK_ERROR]
+ * - Message buffer received sync communicate message is error. [CLOCK_ERROR]
+ * - Clock service handle failed. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - This API called for user set time to user time when GPS corrected off.
+ * - Result : Set user time when GPS corrected off.
+ * \~english @see Clock_getUserTime, Clock_addUserTimeOffset, McOpenSender,\n
+ * McCreateInvokerName, McOpenSyncReceiver, McInvokeSync
+ */
+CLOCK_RETURN Clock_setUserTime(const time_t* user_time);
+
+/**
+ * \ingroup Clock_getUserTime
+ * \~english @par Brief
+ * - Get the display time when GPS synchronization setting is off.
+ * \~english @param [out] user_time The pointer to store the time(second from base time)
+ * \~english @param [out] status The pointer to store time status\n
+ * time status\n
+ * Valid time: CLOCK_CORRECTED_TIME\n
+ * Invalid time: CLOCK_INVALID_TIME\n
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When GPS corrected off, the pointer to store user time date is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The pointer to store time status is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The caller thread name get failed. [CLOCK_ERROR]
+ * - Get Clock service message queue handle failed. [CLOCK_ERROR]
+ * - Generate message queue name for sync call failed. [CLOCK_ERROR]
+ * - Generate message queue handle for sync call failed. [CLOCK_ERROR]
+ * - Message sync communicate failed. [CLOCK_ERROR]
+ * - Message buffer received sync communicate message is error. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call the API, can get the status for user time invalid or valid, when GPS corrected off.
+ * - Note : Get local time, use Clock_getLocalTIme with arguments.\n
+ * The API used to get user time when GPS corrected off.
+ * - Result : Get user time when GPS corrected off.
+ * \~english @see Clock_setUserTime, Clock_addUserTimeOffset, Clock_getLocalTime,\n
+ * McOpenSender, McCreateInvokerName, McOpenSyncReceiver, McInvokeSync
+ */
+CLOCK_RETURN Clock_getUserTime(time_t* user_time, uint8_t* status);
+
+/**
+ * \ingroup Clock_addUserTimeOffset
+ * \~english @par Brief
+ * - Adjust the display time when GPS synchronization setting is off.
+ * \~english @param [in] offset The pointer to store offset for add(sub) user time.\n
+ * Note : Member has limit as follow. \n
+ * int tm_hour: hour(-12 to 12)\n
+ * int tm_min : minute(-59 to 59)\n
+ * year, month, day, second and so on not used, please set 0.
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The pointer to store offset for add(sub) user time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_sec set second not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_mday set day not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_mon set month not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_year set year not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_wday set day in week not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_yday set day in year not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_isdst set daylight save time not 0. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_hour set hour bigger then 12. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_hour set hour smaller then -12. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_min set minute bigger then 59. [CLOCK_ERROR_ARGUMENTS]
+ * - The parameter offset->tm_min set minute smaller then -59. [CLOCK_ERROR_ARGUMENTS]
+ * - The caller thread name get failed. [CLOCK_ERROR]
+ * - Get Clock service message queue handle failed. [CLOCK_ERROR]
+ * - Generate message queue name for sync call failed. [CLOCK_ERROR]
+ * - Generate message queue handle for sync call failed. [CLOCK_ERROR]
+ * - Message sync communicate failed. [CLOCK_ERROR]
+ * - Clock service handle failed. [CLOCK_ERROR]
+ * - Message buffer received sync communicate message is error. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - The API used for add(sub) user time when user set GPS correct off.
+ * - Result : User time add(sub) offset when GPS correct off.
+ * \~english @see Clock_setUserTime, Clock_getUserTime, McOpenSender, McCreateInvokerName,\n
+ * McOpenSyncReceiver, McInvokeSync
+ */
+CLOCK_RETURN Clock_addUserTimeOffset(const struct tm* offset);
+
+/* Clock_getSystemTimeY2K38 can be used to get time later than "2038-01-19 03:14:08"(UTC). */
+/**
+ * \ingroup Clock_getSystemTimeY2K38
+ * \~english @par Brief
+ * - Get the system time(2038 issue fixed).
+ * \~english @param [out] time Store system time data
+ * \~english @param [out] status Store time data status\n
+ * Time status:\n
+ * Valid time : CLOCK_CORRECTED_TIME\n
+ * Invalid time: CLOCK_INVALID_TIME\n
+ * Note : When can't communication with Clock service, return "CLOCK_INVALID_TIME".
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the storage area of the system time data is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - When the time data status storage area is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - In case of system time acquisition failure. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call the API, can get the status for system time invalid or valid.
+ * - Get local time, use Clock_getLocalTIme with arguments. The API used to get system time.
+ * - The API is used when UTC time is in the range from "1970-01-01 00:00:00" to "2016-01-19 03:14:07".
+ * - Result : System time and time status will be stored in arguments.
+ * \~english @see Clock_getSystemTime, Clock_getLocalTimeY2K38, McOpenSender,\n
+ * McCreateInvokerName, McOpenSyncReceiver, McInvokeSync
+ */
+CLOCK_RETURN Clock_getSystemTimeY2K38(uint32_t* time, uint8_t* status);
+
+/**
+ * \ingroup Clock_getLocalTimeY2K38
+ * \~english @par Brief
+ * - Get the local time(2038 issue fixed).
+ * \~english @param [in] base_time Pointer to store base time(seconds)
+ * \~english @param [out] local_time Pointer to store local time
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - The argument used to store base time(seconds) is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The argument used to store local time is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - The argument named base_time bigger then up limit(4293400447) of fixed 2038 issue. [CLOCK_ERROR_ARGUMENTS]
+ * - Get local time failed. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to get local time.
+ * - Return local time by add time zone information to base time.
+ * - The API is used when UTC time is in the range from "1970-01-01 00:00:00" to "2106-01-19 03:14:07".
+ * - The parameter base_time bigger then up limit(4293400447), convert error.
+ * - Also, this API does not support day of the week (Member tm_wday acquired always stores -1.)\n
+ * what the caller sought from year/nomth/data information.
+ * - Result : Local time will be stored in arguments.
+ * - If time zone not set, it will return change base_time type to tm
+ * \~english @see Clock_getLocalTime, Clock_getSystemTimeY2K38
+ */
+CLOCK_RETURN Clock_getLocalTimeY2K38(const uint32_t* base_time, struct tm* local_time);
+
+/**
+ * \ingroup Clock_CnvSecToDateY2K38
+ * \~english @par Brief
+ * - Convert specified elapsed seconds to date and time(2038 issue fixed).\n
+ * The specified elapsed seconds are regarded as elapsed time from 1970/01/01 00:00:00.
+ * \~english @param [in] time Pointer to the storage destination
+ * \~english @param [out] result Pointer to storage location of converted date/time
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR fail
+ * \~english @retval CLOCK_ERROR_ARGUMENTS arguments error
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the accumulated second storage area from the date conuting point to be converted is NULL.\n
+ * [CLOCK_ERROR_ARGUMENTS]
+ * - When the converted date/time storage area is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - When the regerence time (seconds) specified by the argument time is greater than\n
+ * the conuntermeasure upper limit value (4293400447) of the 2038 root problem. [CLOCK_ERROR_ARGUMENTS]
+ * - In case of a date/time conversion failure as a cumulative second from the specified date\n
+ * in the specified integration seconds. [CLOCK_ERROR]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to convert the specified integration seconds to the date and\n
+ * time as the integration seconds from "1970-01-01 00:00:00" at the date conuting point.
+ * - The API is used when UTC time is in the range from "1970-01-01 00:00:00" to "2106-01-19 03:14:07".
+ * - If the argument time exceeds the above upper limit(4293400447), it can not be converted properly.
+ * - Also, this API does not support day of the week (Member tm_wday acquired always stores -1.)\n
+ * what the caller sought from year/nomth/data information.
+ * - Result: Converts the specified integration seconds to the date and time\n
+ * as the integration seconds from "1970-01-01 00:00:00" at the date conuting point.
+ * \~english @see Clock_CnvSecToDate, Clock_CnvDateToSecY2K38
+ */
+CLOCK_RETURN Clock_CnvSecToDateY2K38(const uint32_t* time, struct tm *result);
+
+/**
+ * \ingroup Clock_CnvDateToSecY2K38
+ * \~english @par Brief
+ * - Convert specified date and time to elapsed seconds from 1970/01/01 00:00:00.(2038 issue fixed)
+ * \~english @param [in] tm Pointer to the storage location of the date and time to be converted.
+ * \~english @param [out] result Pointer to storage detination of accumulated seconds from date counting point.
+ * \~english @retval CLOCK_OK success
+ * \~english @retval CLOCK_ERROR_ARGUMENTS Invalide parameter
+ * \~english @par Prerequisite
+ * - Clock service's availability is TRUE.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the date time storage area to be converted is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - When the accumulated second storage area from the date conuting point is NULL. [CLOCK_ERROR_ARGUMENTS]
+ * - When the conversion result (result) is greater than the conuntermeasure upper\n
+ * limit value (4293400447) of the 2038 root problem. [CLOCK_ERROR_ARGUMENTS]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - The API is sync(return before call end), please check it when used the API.
+ * - Call this API to convert the specified time to integration seconds from "1970-01-01 00:00:00"\n
+ * (date conuting point).
+ * - The API is used when UTC time is in the range from "1970-01-01 00:00:00" to "2106-01-19 03:14:07".
+ * - The maximum value of result that can be obtained is 4293400447(sec).
+ * - Result: Converts the specified date and time to integration seconds from "1970-01-01 00:00:00"\n
+ * (date counting point).
+ * \~english @see Clock_CnvDateToSec, Clock_CnvSecToDateY2K38
+ */
+CLOCK_RETURN Clock_CnvDateToSecY2K38(const struct tm* tm, uint32_t* result);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+/** @}*/ // end of clock
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // CLOCK_CLIENT_CLOCK_INCLUDE_VEHICLE_SERVICE_CLOCK_API_H_
diff --git a/video_in_hal/stub/clock/client_clock/include/stub/clock_clock.h b/video_in_hal/stub/clock/client_clock/include/stub/clock_clock.h
new file mode 100755
index 0000000..b1a1c99
--- /dev/null
+++ b/video_in_hal/stub/clock/client_clock/include/stub/clock_clock.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file clock_clock.h
+ * @brief clock module of clock unit common header file.
+ */
+#ifndef VEHICLESERVICE_CLOCKCLOCK_H_ // NOLINT(build/header_guard) unit common special
+#define VEHICLESERVICE_CLOCKCLOCK_H_ // NOLINT(build/header_guard) unit common special
+
+#include <stub/Clock_API.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup clock
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/** @}*/ // end of clock
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLESERVICE_CLOCKCLOCK_H_
diff --git a/video_in_hal/stub/clock/client_clock/libClock_API.ver b/video_in_hal/stub/clock/client_clock/libClock_API.ver
new file mode 100755
index 0000000..b26c9cf
--- /dev/null
+++ b/video_in_hal/stub/clock/client_clock/libClock_API.ver
@@ -0,0 +1,29 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#########################
+# libClock_API version script #
+#########################
+{
+ global:
+ ### .text section ###
+ Clock_*;
+ ### .data section ###
+ *clock_msg_handle;
+ local:
+ *;
+};
+
diff --git a/video_in_hal/stub/clock/client_clock/src/Clock_API.cpp b/video_in_hal/stub/clock/client_clock/src/Clock_API.cpp
new file mode 100755
index 0000000..360c7bf
--- /dev/null
+++ b/video_in_hal/stub/clock/client_clock/src/Clock_API.cpp
@@ -0,0 +1,118 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <stub/Clock_API.h>
+
+/* static variable definition */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ function prototype
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+CLOCK_RETURN Clock_getSystemTime(struct timespec* time, uint8_t* status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_getLocalTime(const time_t* base_time, struct tm* local_time) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_CnvSecToDate(const time_t* timep, struct tm *result) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_CnvDateToSec(const struct tm* tm, time_t* result) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_setUserTime(const time_t* user_time) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_getUserTime(time_t* user_time, uint8_t* status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_addUserTimeOffset(const struct tm* offset) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_getSystemTimeY2K38(uint32_t* time, uint8_t* status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_getLocalTimeY2K38(const uint32_t* base_time, struct tm* local_time) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_CnvSecToDateY2K38(const uint32_t* time, struct tm *result) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
+
+CLOCK_RETURN Clock_CnvDateToSecY2K38(const struct tm* tm, uint32_t* result) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return CLOCK_OK;
+}
diff --git a/video_in_hal/stub/clock/client_display_time/Makefile b/video_in_hal/stub/clock/client_display_time/Makefile
new file mode 100755
index 0000000..48b2261
--- /dev/null
+++ b/video_in_hal/stub/clock/client_display_time/Makefile
@@ -0,0 +1,47 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libDTime_Api
+
+######### install headers(*.h) #############
+INST_HEADERS = DTime_Api.h clock_notifications.h clock_display_time.h
+
+######### compiled sources #############
+libDTime_Api_SRCS = DTime_Api.cpp
+
+######### add source path #############
+VPATH += ./src ./include/stub
+
+######### add include path #############
+CPPFLAGS += -I./include
+
+######### add compile option #############
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += -Wl,--no-as-needed
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+
+include ../../stub.mk
diff --git a/video_in_hal/stub/clock/client_display_time/include/stub/DTime_Api.h b/video_in_hal/stub/clock/client_display_time/include/stub/DTime_Api.h
new file mode 100755
index 0000000..7a07d19
--- /dev/null
+++ b/video_in_hal/stub/clock/client_display_time/include/stub/DTime_Api.h
@@ -0,0 +1,916 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file DTime_Api.h
+ * @brief display time middle API header file.
+ */
+#ifndef CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_DTIME_API_H_
+#define CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_DTIME_API_H_
+
+/****************************************************************************
+ * File name : DTime_Api.h
+ * System name :
+ * Sub system name : Display time middle API header
+ * Title : Data Header Files Required for Using Display Time Middle
+ ****************************************************************************/
+#include <native_service/frameworkunified_types.h>
+#include <stub/clock_notifications.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup clock
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/**
+ * \~english commod ID (from display time middle)
+ */
+typedef enum _ClockServiceProtocol {
+ CID_DTIME_NOTIFY = 0x00000712, //!< \~english Display time notice
+} ClockServiceProtocol;
+
+/******************************************************************************
+* Structure : T_TimeData
+* Function : Time structure
+* Note : Stores the system/user time obtained from the Clock
+ *******************************************************************************/
+/**
+ * \~english Time structure T_TimeData, store system time/user time acquired from clock.
+ */
+typedef struct _tag_T_TimeData {
+ uint16_t Year; //!< \~english Year
+ uint8_t Month; //!< \~english Month
+ uint8_t Day; //!< \~english Day
+ uint8_t Hour; //!< \~english Hour
+ uint8_t Minute; //!< \~english Minute
+ uint8_t Second; //!< \~english Second
+ uint8_t rsv; //!< \~english Reserve
+} T_TimeData;
+
+/**
+ * \~english +(plus)
+ */
+#define DTIME_TIMEDIFF_SIGN_PLUSE FALSE
+/**
+ * \~english -(minus)
+ */
+#define DTIME_TIMEDIFF_SIGN_MINUS TRUE
+
+/**
+ * \~english Time zone structure.
+ */
+typedef struct _tag_T_TimeDiff {
+ BOOL Sign; //!< \~english Sign
+ uint8_t Hour_Diff; //!< \~english Time difference (hour)
+ uint8_t Minute_Diff; //!< \~english Time difference (minutes)
+ uint8_t rsv[2]; //!< \~english Reserve
+} T_TimeDiff;
+
+/**
+ * \~english Time offset setting structure.
+ */
+typedef struct _tag_T_TimeOffset {
+ int8_t Hour_Offset; //!< \~english Time difference (hour)
+ int8_t Minute_Offset; //!< \~english Time difference (minutes)
+ int8_t rsv[2]; //!< \~english Reserve
+} T_TimeOffset;
+
+/**
+ * \~english GPS automatic adjustment OFF (use system time).
+ */
+#define DTIME_SETTING_GPS_MANUAL FALSE
+
+/**
+ * \~english GPS automatic adjustment Auto (use display time when GPS correction OFF).
+ */
+#define DTIME_SETTING_GPS_AUTO TRUE
+
+/**
+ * \~english Notation in 12H.
+ */
+#define DTIME_SETTING_FORMAT_12H FALSE
+
+/**
+ * \~english Notation in 24H.
+ */
+#define DTIME_SETTING_FORMAT_24H TRUE
+
+/**
+ * \~english DST manual setting.
+ */
+#define DTIME_SETTING_DST_MANUAL FALSE
+
+/**
+ * \~english DST automatic setting.
+ */
+#define DTIME_SETTING_DST_AUTO TRUE
+
+/**
+ * \~english DST OFF
+ */
+#define DTIME_SETTING_DST_OFF FALSE
+
+/**
+ * \~english DST ON
+ */
+#define DTIME_SETTING_DST_ON TRUE
+
+/**
+ * \~english Time zone manual setting.
+ */
+#define DTIME_SETTING_TIMEZONE_MANUAL FALSE
+
+/**
+ * \~english Time zone automatic setting.
+ */
+#define DTIME_SETTING_TIMEZONE_AUTO TRUE
+
+/**
+ * \~english Display setting structure.
+ */
+typedef struct _tag_T_DisplaySetting {
+ BOOL GPS_Auto; //!< \~english GPS automatic setting
+ BOOL Format; //!< \~english 12H/24H display setting
+ BOOL DST_Auto; //!< \~english DST automatic settting
+ BOOL DST_Setting; //!< \~english DST_ON/OFF setting
+ BOOL TimeZone_Auto; //!< \~english Time zone automatic setting
+ T_TimeDiff TimeZone_Setting; //!< \~english Time zone time difference setting
+ T_TimeOffset TimeOffset; //!< \~english Time offset
+} T_DisplaySetting;
+
+/**
+ * \~english Display time invalid.
+ */
+#define DTIME_DISP_TIME_INVALID FALSE
+
+/**
+ * \~english Display time valid.
+ */
+#define DTIME_DISP_TIME_VALID TRUE
+
+/**
+ * \~english Invalid AM/PM.
+ */
+#define DTIME_DISP_MERIDIEM_INVALID 0
+
+/**
+ * \~english AM
+ */
+#define DTIME_DISP_MERIDIEM_AM 1
+
+/**
+ * \~english PM
+ */
+#define DTIME_DISP_MERIDIEM_PM 2
+
+/**
+ * \~english AM/PM unidentified in 12H display.
+ */
+#define DTIME_DISP_MERIDIEM_12H_INVALID 3
+
+/**
+ * \~english Display time structure.
+ */
+typedef struct _tag_T_DTimeData {
+ BOOL TimeValidity; //!< \~english Validity of time display
+ uint8_t Meridiem; //!< \~english AM/PM
+ uint16_t DYear; //!< \~english Display date(year)
+ uint8_t DMonth; //!< \~english Display date(month)
+ uint8_t DDay; //!< \~english Display date(day)
+ uint8_t DHour; //!< \~english Display time(hour)
+ uint8_t DMinute; //!< \~english Display time(minute)
+ uint8_t rsv; //!< \~english Reserve
+} T_DTimeData;
+
+/******************************************************************************
+* Structure : T_DTIME_MSG_NOTIFY_DTIME
+* Function : Display time notification transmission data structure
+* Note :
+ ******************************************************************************/
+/**
+ * \~english Display time notification transmission data structure T_DTIME_MSG_NOTIFY_DTIME.
+ */
+typedef struct _tag_T_DTIME_MSG_NOTIFY_DTIME {
+ T_DTimeData disp_time; //!< \~english Display time
+ T_DisplaySetting disp_setting; //!< \~english Display setting
+ T_TimeData org_time; //!< \~english Time(origin data)
+} T_DTIME_MSG_NOTIFY_DTIME;
+
+/******************************************************************************
+* Structure : T_DTIME_MSG_GPSTIME
+* Function : GPS time setting data structure
+* Note :
+ ******************************************************************************/
+/**
+ * \~english GPS UTC time setting structure.
+ */
+typedef struct _tag_T_DTIME_GPSTIME {
+ uint16_t year; //!< \~english Year
+ uint8_t month; //!< \~english Month
+ uint8_t date; //!< \~english Day
+ uint8_t hour; //!< \~english Hour
+ uint8_t minute; //!< \~english Minute
+ uint8_t second; //!< \~english Second
+ uint8_t reserved; //!< \~english Reserve
+} T_DTIME_GPSTIME;
+
+/**
+ * \~english Time uncalibrated after receiver reset.
+ */
+#define DTIME_GPS_STATUS_INVALID 0x00
+
+/**
+ * \~english Time output by RTC backup (with time calibration results).
+ */
+#define DTIME_GPS_STATUS_RTC 0x01
+
+/**
+ * \~english Time calibration completed.
+ */
+#define DTIME_GPS_STATUS_CORRECT 0x02
+
+/**
+ * \~english GPS time setting data structure.
+ */
+typedef struct _tag_T_DTIME_MSG_GPSTIME {
+ T_DTIME_GPSTIME utc; //!< \~english GPS UTC time
+ uint8_t tdsts; //!< \~english Date and time status
+ uint8_t reserve[3]; //!< \~english Reserve
+} T_DTIME_MSG_GPSTIME;
+
+/** Other definitions *********************************/
+/**
+ * \~english AM
+ */
+#define DTIME_SET_MERIDIEM_AM TRUE
+
+/**
+ * \~english PM
+ */
+#define DTIME_SET_MERIDIEM_PM FALSE
+
+/* Displayed Time Middle API Prototypes *************/
+/**
+ * \ingroup DTime_loadDisplaySetting
+ * \~english @par Brief
+ * - Load display settings.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Setting Display setting
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Display time is available after this API is called by SettingService.\n
+ * (It is assumed to call it only once at startup)
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When storage area of the display setting is NULL [eFrameworkunifiedStatusFail]
+ * - When the time difference(hour)specified by the argument Setting->TimeZone_Setting.Hour_Diff\n
+ * is greater than the time difference(hour)upper limit(13)[eFrameworkunifiedStatusFail]
+ * - Incorrect time difference(minutes)specified by argument Setting->TimeZone_Setting.Minute_Diff\n
+ * (when the value is not 0, 15, 30, 45). [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage synchronization communication fails. [eFrameworkunifiedStatusFail]
+ * - When processing of loading display setting fails in clock service. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - Since this API is synchronous processing(completion recovery),\n
+ * it should be used in consideration of this.
+ * - When display time is used before this API is called by SettingService,\n
+ * even if DTime_registListener_DisplayTime() is used, display time notification can not be received.
+ * - (Since clock service does not publish display time notification.)
+ * - With this API, the following is information necessary for calculation of\n
+ * display time can be collectively set to Clock service.
+ * - GPS automatic setting, 12H/24H display setting, DST setting, time zone setting, time offset.
+ * - Set the time offset to 0 when GPS correction is OFF.
+ * - If the display time distribution has already been regitered,\n
+ * the Clock service will publish the display time notification immediately when this API is called.
+ * \~english @see DTime_getDisplaySetting, DTime_regist_Listener_DisplayTime, FrameworkunifiedMcOpenSender, FrameworkunifiedInvokeSync
+ */
+EFrameworkunifiedStatus DTime_loadDisplaySetting(HANDLE h_app, T_DisplaySetting *setting); /* Load display setting */
+
+/**
+ * \ingroup DTime_getDisplaySetting
+ * \~english @par Brief
+ * - Load display settings.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Setting Display setting
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - This API should be called after DTime_loadDisplaySetting() is called.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When storage area of the display setting is NULL [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage synchronization communication fails. [eFrameworkunifiedStatusFail]
+ * - When message length received by synchronous communication\n
+ * and length of storage buffer are different. [eFrameworkunifiedStatusFail]
+ * - When display setting on Clock service side is not loaded. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Detail
+ * - Since this API is synchronous processing(completion recovery),\n
+ * it should be used in consideration of this.
+ * - This API assumes that the Diag service will use it to acquire time difference information etc.
+ * - With this API, you can acquire the information on the right set at display time.\n
+ * GPS automatic setiting, 12H/24H display setting, DST setting, time zone setting, time offse.
+ * \~english @see DTime_loadDisplaySetting, FrameworkunifiedMcOpenSender, FrameworkunifiedInvokeSync
+ */
+EFrameworkunifiedStatus DTime_getDisplaySetting(HANDLE h_app, T_DisplaySetting *setting); /* Get display setting */
+
+/**
+ * \ingroup DTime_setGpsTime
+ * \~english @par Brief
+ * - Set the GPS time on the clock.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] gps_time GPS data setting
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the setting of storage area set by the GPS data/time setting is NULL. [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called when the positioning service acquires/updates the GPS time.
+ * - Note : Do not use POS_RegisterListenerGPStime() from Clock service.
+ * - The GPS time notification command to the external clock is transmitted\n
+ * when this API is called.
+ * - With this API, GPS time can be set to clock function.
+ * GPS date and time (year, month, day, hour, minute, second)\n
+ * GPS date and time status\n
+ * 0 = Time not correct after receiver reset(time input or manager reset or CSF startup),\n
+ * 1 = RTC backup according to time output(actual result of time correction),\n
+ * 2 = Time correct done.
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setGpsTime(HANDLE h_app, T_DTIME_MSG_GPSTIME *gps_time); /* GPS time setting */
+
+/**
+ * \ingroup DTime_registerListener_DTime
+ * \~english @par Brief
+ * - Register delivery of display time notification.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] notifyName Delivery destination thread name. Note : Set it to 15 characters or less.
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the storage area specified by the destination thread name is NULL. [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - The maximum number of registered listeners is 20.
+ * - If listeners are registered more than once from the same thread, count as one listener.\n
+ * however, in this case, the display time notification is immediately issued.
+ * - With this API, delivery of this display time notification to the thread\n
+ * designated as the argument is started.
+ * - When this API call is called, if the display setting is not loaded,\n
+ * you can not calculate the display time, so do not deliver the display time notification.
+ * - When this API is called, if the display setting has already been loaded,\n
+ * the Clock service immediately issues a display time notification.
+ * - A message is notified with a command "CID_DTIME_NOTIFY" when display time is deliveried.
+ * - The client receives the data of the T_DTIME_MSG_NOTIFY_DTIME structure in the above delivery message.
+ * - Message communication uses interprocess communication by NSFW.
+ * - Specify ClockMng thread (TN_CLOCK_MNG) as the sender when registering callback for receiving display time.
+ * - Display time is not delivered until SettingService calls DTime_loadDisplaySetting.
+ * \~english @see DTime_UnregisterListener_DTime, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_registerListener_DTime(HANDLE h_app, PCSTR notify_name); /* Display time delivery registration */
+
+/**
+ * \ingroup DTime_UnregisterListener_DTime
+ * \~english @par Brief
+ * - Release delivery of display time notification.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] notifyName Delivery destination thread name. Note : Set it to 15 characters or less.
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the storage area specified by the destination thread name is NULL. [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - With this API, releasing delivery registration of display time notification\n
+ * to the thread specified as argument is canceled.
+ * - Especially when the nonresident service is registering for delivery,\n
+ * be sure to cancel registration with this API in termination processing.
+ * \~english @see DTime_registerListener_DTime, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_UnregisterListener_DTime(HANDLE h_app, PCSTR notify_name); /* Release display time delivery registration */
+
+/**
+ * \ingroup DTime_setAutoAdjust
+ * \~english @par Brief
+ * - Set GPS automatic adjustment.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Setting Display setting.\n
+ * DTIME_SETTING_GPS_AUTO: GPS automatic adjust AUTO(use display time when GPS correction OFF)\n
+ * DTIME_SETTING_GPS_MANUAL: GPS automatic adjust OFF(use of system time)
+ * \~english @param [in] Offset Time offset.\n
+ * GPS correction is ON: User set hour offset, minute offset.\n
+ * GPS correction is OFF: set zero
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the storage area of the time offset is NULL. [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, it is possible to switch the absolute time\n
+ * (GPS time or display time in the case of GPS correction off) which is the source of display time.
+ * - When GPS correction is OFF, count from the default time (2017/1/1 1:00).
+ * - When GPS correction OFF, set the time offset to zero and set the time\n
+ * offset with this API when GPS correction is ON.
+ * - When this API is called, if the display time distribution has already been refistered,\n
+ * the Clock service immediately issues a display time notification.
+ * - However, when an external clock is connected, the display time is not issued immediately\n
+ * and the display time is delivered at the timing of receiving the "Time notification".
+ * - When an external clock is connected, since the data master at the offset time\n
+ * becomes an external clock, the following processing is performed.
+ * - If the received time offset is
+ * - 1) When it is more than 1 hour ahead of the offset of the external clock \n
+ * -> Set to add 1 hour offsets to external clock.
+ * - 2) If it is less than 1 hour, 1 minute or more after the offset of the external clock \n
+ * -> Set to add 1 minute offsets to external clock.
+ * - 3) When it is more than -1 hour earlier of the offset of the external clock \n
+ * -> Set the external clock to subtract 1 hour offsets.
+ * - 4) When it is less than 1 hour or more than -1 minute from the offset of the external clock \n
+ * -> Set the external clock to subtract 1 minute offsets.
+ * - 5) When both hours and minutes are zero\n
+ * -> Set the external clock to clear zero.
+ * - Do not reflect changes in offset when GPS correction OFF<-->ON is switched.
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setAutoAdjust(HANDLE h_app, BOOL setting, T_TimeOffset *off_set); /* GPS automatic adjustment */
+
+/**
+ * \ingroup DTime_increaseHour
+ * \~english @par Brief
+ * - Adjust the time.
+ * \~english @param [in] hApp Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, display time can be increased by one hour. Set the display\n
+ * time in the case of GPS correction off used when GPS correction OFF is set.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered at\n
+ * the timing of receiving the "time notification".
+ * - When an external clock is connected, set the absolute time hour (+) instruction to\n
+ * the external clock with the "setting SW information notification" command.
+ * \~english @see DTime_decreaseHour, DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_increaseHour(HANDLE h_app); /* Adjust the time (hour increaase) */
+
+/**
+ * \ingroup DTime_decreaseHour
+ * \~english @par Brief
+ * - Adjust time (decrease hour by 1 hour).
+ * \~english @param [in] hApp Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, display time can be reduced by 1 hour. Set the display time\n
+ * in the case of GPS correction off used when GPS correction OFF is set.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - When an external clock is connected, set the absolute time hour (-) instruction\n
+ * with the "setting SW information notification" command to the external clock.
+ * \~english @see DTime_increaseHour, DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_decreaseHour(HANDLE h_app); /* Adjust the time (hour decrease) */
+
+/**
+ * \ingroup DTime_increaseMinute
+ * \~english @par Brief
+ * - Adjust the time (increase time by 1 minute).
+ * \~english @param [in] hApp Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, display time can be increased by one minute. Set the display time\n
+ * in the case of GPS correction off used when GPS correction OFF is set.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - When an external clock is connected, set the absolute time minute (+) instruction\n
+ * to the external clock with the "setting SW information notification" command.
+ * \~english @see DTime_decreaseMinute, DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_increaseMinute(HANDLE h_app); /* Adjust the time (minute increaase) */
+
+/**
+ * \ingroup DTime_decreaseMinute
+ * \~english @par Brief
+ * - Adjust the time (decrease time by 1 minute).
+ * \~english @param [in] hApp Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, display time can be reduced by 1 minute. Set the display time\n
+ * in the case of GPS correction off used when GPS correction OFF is set.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - When an external clock is connected, set the absolute time minute (-) instruction\n
+ * with the "setting SW information notification" command to the external clock.
+ * \~english @see DTime_increaseMinute, DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_decreaseMinute(HANDLE h_app); /* Adjust the time (minute decrease) */
+
+/**
+ * \ingroup DTime_clearMinute
+ * \~english @par Brief
+ * - Adjust the time (set the time to 0 minute).
+ * \~english @param [in] hApp Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, the display time can be set to 0 minutes.
+ * - When the display time is 30 to 59 minutes, increase the display time by one hour\n
+ * and then set the display time to 0 minutes.
+ * - If the display time is 0 to 29 minutes, set the dispaly time to 0 minutes only.
+ * - Set the internal offset to be used when GPS correction OFF.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - When an external clock is connected, set the absolute time minute (-) instruction\n
+ * with the "setting SW information notification" command to the external clock.
+ * \~english @see DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_clearMinute(HANDLE h_app); /* Adjust the time (minute clear) */
+
+/**
+ * \ingroup DTime_setAMPM
+ * \~english @par Brief
+ * - Set AM/PM.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Meridiem AM/PM setting\n
+ * AM : DTIME_SET_MERIDIEM_AM(TRUE)\n
+ * PM : DTIME_SET_MERIDIEM_PM(FALSE)
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When message asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, AM/PM of display time can be switched.
+ * - When PM is selected with the display time (Hour of T_DTimeData) set to\n
+ * AM (0 to 11 o'clock), the display time is +12h.
+ * - When AM is selected at the display time (Hour of T_DTimeData) at PM (12 to 23 o'clock),\n
+ * it makes -12h at display time.
+ * - Set the internal offset to be used when GPS correction OFF.
+ * - Note : The time offset when GPS correction ON is set by DTime_setAutoAdjust.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * \~english @see DTime_setAutoAdjust, FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setAMPM(HANDLE h_app, BOOL meridiem); /* AM/PM setting */
+
+/**
+ * \ingroup DTime_setFormat
+ * \~english @par Brief
+ * - 12h/24h sets the display format.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Setting Display setting\n
+ * DTIME_SETTING_FORMAT_12H(FALSE): Notation in 12H\n
+ * DTIME_SETTING_FORMAT_24H(TRUE): Notation in 24H
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, it is possible to switch the display time 12H notation/24H notation.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setFormat(HANDLE h_app, BOOL setting); /* format setting */
+
+/**
+ * \ingroup DTime_setTimeZone
+ * \~english @par Brief
+ * - Set the time zone.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Auto Time zone automatic setting\n
+ * DTIME_SETTING_TIMEZONE_AUTO (TRUE): Time zone automatic setting\n
+ * DTIME_SETTING_TIMEZONE_MANUAL (FALSE): Time zone manual setting
+ * \~english @param [in] Diff Time zone time difference setting
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the time zone time time difference setting storage area is NULL. [eFrameworkunifiedStatusFail]
+ * - When the time difference(hour)specified by the argument Diff->Hour_Diff\n
+ * is greater than the time difference(hour)upper limit value(13)[eFrameworkunifiedStatusFail]
+ * - When the time difference(minutes)specified by the argument Diff->Minute_Diff\n
+ * is incorrect (When the time difference (minutes) specified by the argument\n
+ * Diff->Minute_Diff is not 0, 15, 30, 45). [eFrameworkunifiedStatusFail]
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, you can set time zone automatic switching and time zone setting.
+ * - When this API is called, if the display time distribution has already been registered,\n
+ * the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - Depending on the time zone automatic setting of the second argument, set the third argument as follows.
+ * - MANUAL: User's setting value.
+ * - MANUAL/AUTO Time zones update each time the time zone setting changes.
+ * - Note : When MANUAL, it is not necessary to call this API each time "TZ status notification" is received.
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setTimeZone(HANDLE h_app, BOOL b_auto, T_TimeDiff *diff); /* time zone setting */
+
+/**
+ * \ingroup DTime_setDST
+ * \~english @par Brief
+ * - Set DST.
+ * \~english @param [in] hApp Application handle
+ * \~english @param [in] Auto Time zone automatic setting\n
+ * DTIME_SETTING_DST_AUTO (TRUE): DST automatic setting\n
+ * DTIME_SETTING_DST_MANUAL (FALSE): DST manual setting
+ * \~english @param [in] Setting Time zone time difference setting
+ * DTIME_SETTING_DST_ON (TRUE)\n
+ * DTIME_SETTING_DST_OFF (FALSE)
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, you can compete for automatic switching of DST, and can set ON/OFF.
+ * - When this API is called, the Clock service immediately issues a display time notification.
+ * - Note : However, when there is an external clock, and after receiving the time notification command,\n
+ * the display time notification is not issued immediately, and the display time is delivered\n
+ * at the timing of receiving the "time notification".
+ * - Depending on the DST automatic setting of the second argument, set the third argument as follows.
+ * - MANUAL: User's setting value.
+ * - MANUAL/AUTO update each DST ON/OFF setting if there is a change.
+ * - Note : When MANUAL, it is not necessary to call this API each time "DST status notification" is received.
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_setDST(HANDLE h_app, BOOL b_auto, BOOL setting); /* DST setting */
+
+/**
+ * \ingroup DTime_notifySwOff
+ * \~english @par Brief
+ * - Notify SW OFF information.
+ * \~english @param [in] h_app Application handle
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusFail fail(including parameter error)
+ * \~english @par Prerequisite
+ * - The availability of Clock service is TRUE.
+ * - Dispatcher for application is genereted/initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.).
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - When the generation of the message queue handle for transmission with\n
+ * the Clock service has failed. [eFrameworkunifiedStatusFail]
+ * - When messsage asynchronous communication fails. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Fire and Forget
+ * \~english @par Detail
+ * - This API is assumed to be called by SettingService.
+ * - With this API, you can notify SW OFF informations of image operations to Extern clock(Meter Device).
+ * - Note : Do nothing while Extern clock doesn't exist.
+ * - After calling this API,the SW OFF will not be notified immediately,it will be notified while Meter exists.
+ * - while error occurs(API return eFrameworkunifiedStatusFail),need to recall this API.\n
+ * \n
+ * - Switch ON notification should be executed among the corresponding API of operations as followed.
+ * <table>
+ * <tr><th>API name(Switch ON notification) </th><th>OFF notification neccessary/unneccessary </th><th>note(reason of unneccessary)</th></tr>
+ * <tr><td>DTime_loadDisplaySetting </td><td>unneccessary </td><td>apart from button operation</td></tr>
+ * <tr><td>DTime_getDisplaySetting </td><td>unneccessary </td><td>apart from button operation</td></tr>
+ * <tr><td>DTime_setGpsTime </td><td>unneccessary </td><td>apart from button operation</td></tr>
+ * <tr><td>DTime_registerListener_DTime </td><td>unneccessary </td><td>apart from button operation</td></tr>
+ * <tr><td>DTime_UnregisterListener_DTime </td><td>unneccessary </td><td>apart from button operation</td></tr>
+ * <tr><td>DTime_setAutoAdjust </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_increaseHour </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_decreaseHour </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_increaseMinute </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_decreaseMinute </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_clearMinute </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_setAMPM </td><td>unneccessary </td><td>extern clock is unneccessary</td></tr>
+ * <tr><td>DTime_setFormat </td><td>neccessary </td><td></td></tr>
+ * <tr><td>DTime_setTimeZone </td><td>unneccessary </td><td>there is no extern clock SW ON/OFF notification</td></tr>
+ * <tr><td>DTime_setDST </td><td>unneccessary </td><td>there is no extern clock SW ON/OFF notification</td></tr>
+ * </table>
+ * \n
+ * \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedSendMsg
+ */
+EFrameworkunifiedStatus DTime_notifySwOff(HANDLE h_app); /* SW OFF notification */
+
+/** @}*/ // end of clock
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_DTIME_API_H_
diff --git a/video_in_hal/stub/clock/client_display_time/include/stub/clock_display_time.h b/video_in_hal/stub/clock/client_display_time/include/stub/clock_display_time.h
new file mode 100755
index 0000000..1cf19db
--- /dev/null
+++ b/video_in_hal/stub/clock/client_display_time/include/stub/clock_display_time.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file clock_display_time.h
+ * @brief display time module of clock unit common header file.
+ */
+#ifndef VEHICLESERVICE_CLOCKDISPLAYTIME_H_ // NOLINT(build/header_guard) unit common special
+#define VEHICLESERVICE_CLOCKDISPLAYTIME_H_ // NOLINT(build/header_guard) unit common special
+
+#include <stub/DTime_Api.h>
+#include <stub/clock_notifications.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup clock
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/** @}*/ // end of clock
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLESERVICE_CLOCKDISPLAYTIME_H_
diff --git a/video_in_hal/stub/clock/client_display_time/include/stub/clock_notifications.h b/video_in_hal/stub/clock/client_display_time/include/stub/clock_notifications.h
new file mode 100755
index 0000000..29eb836
--- /dev/null
+++ b/video_in_hal/stub/clock/client_display_time/include/stub/clock_notifications.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file clock_notifications.h
+ * @brief Notification names defined in the file.
+ */
+#ifndef CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_CLOCK_NOTIFICATIONS_H_
+#define CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_CLOCK_NOTIFICATIONS_H_
+
+#include <agl_thread.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup clock
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/**
+ * \~english clock service availability notify.
+ */
+#define NTFY_Clock_Availability MN_CLOCK"/Availability"
+
+/** @}*/ // end of clock
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // CLOCK_CLIENT_DISPLAY_TIME_INCLUDE_VEHICLE_SERVICE_CLOCK_NOTIFICATIONS_H_
diff --git a/video_in_hal/stub/clock/client_display_time/libDTime_Api.ver b/video_in_hal/stub/clock/client_display_time/libDTime_Api.ver
new file mode 100755
index 0000000..47e22d4
--- /dev/null
+++ b/video_in_hal/stub/clock/client_display_time/libDTime_Api.ver
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#########################
+# libDTime_Api version script #
+#########################
+{
+ global:
+ ### .text section ###
+ extern "C++" {
+ DTime_*;
+ };
+ ### .data section ###
+ *s_clock_hApp;
+ local:
+ *;
+};
+
diff --git a/video_in_hal/stub/clock/client_display_time/src/DTime_Api.cpp b/video_in_hal/stub/clock/client_display_time/src/DTime_Api.cpp
new file mode 100755
index 0000000..cf1f96b
--- /dev/null
+++ b/video_in_hal/stub/clock/client_display_time/src/DTime_Api.cpp
@@ -0,0 +1,246 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <stub/DTime_Api.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#define DTIME_PARAM_NG FALSE
+#define DTIME_PARAM_OK TRUE
+
+/******************************************************************************
+ * API name : DTime_loadDisplaySetting
+ * Function : Load display setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_loadDisplaySetting(HANDLE h_app, T_DisplaySetting *setting ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_getDisplaySetting
+ * Function : Get display setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_getDisplaySetting(HANDLE h_app, T_DisplaySetting *setting ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setGpsTime
+ * Function : GPS time setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setGpsTime(HANDLE h_app, T_DTIME_MSG_GPSTIME *gps_time ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_registerListener_DTime
+ * Function : Display time delivery registration
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_registerListener_DTime(HANDLE h_app, PCSTR notify_name) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_UnregisterListener_DTime
+ * Function : Release time delivery registration
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_UnregisterListener_DTime(HANDLE h_app, PCSTR notify_name) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setAutoAdjust
+ * Function : GPS auto adjust setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setAutoAdjust(HANDLE h_app, BOOL setting, T_TimeOffset *offset) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_increaseHour
+ * Function : Adjust the time (hour increaase)
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_increaseHour(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_decreaseHour
+ * Function : Adjust the time (hour decrease)
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_decreaseHour(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_increaseMinute
+ * Function : Adjust the time (minute increaase)
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_increaseMinute(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_decreaseMinute
+ * Function : Adjust the time (minute decrease)
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_decreaseMinute(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_clearMinute
+ * Function : Adjust the time (minute clear)
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_clearMinute(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setAMPM
+ * Function : AM/PM setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setAMPM(HANDLE h_app, BOOL meridiem) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setFormat
+ * Function : Format setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setFormat(HANDLE h_app, BOOL setting ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setTimeZone
+ * Function : Time zone setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setTimeZone(HANDLE h_app, BOOL b_auto, T_TimeDiff *diff ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/******************************************************************************
+ * API name : DTime_setDST
+ * Function : DST setting
+ * Outline :
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_setDST(HANDLE h_app, BOOL b_auto, BOOL setting ) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+
+/******************************************************************************
+ * API name : DTime_notifySwOff
+ * Function : SW OFF notification
+ * Outline :
+ * Note : Used to notify the SW OFF of on-screen operations.
+ ******************************************************************************/
+EFrameworkunifiedStatus DTime_notifySwOff(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+/** Parameter check functions **/
+BOOL CheckParamTimeZone(T_TimeDiff *diff) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DTIME_PARAM_OK;
+}
diff --git a/video_in_hal/stub/clock/localtime/Makefile b/video_in_hal/stub/clock/localtime/Makefile
new file mode 100755
index 0000000..fc75dd8
--- /dev/null
+++ b/video_in_hal/stub/clock/localtime/Makefile
@@ -0,0 +1,49 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##
+## Makefile - Makefile for TimeZone file
+##
+
+ZONEINFDIR = $(DESTDIR)/usr/share/zoneinfo/
+ZONEINFLNK = /etc/
+ZONEINFDIR2 = $(DESTDIR)/etc/
+ZONEINFLNK2 = /tmp/bs/clock/
+ZONEINFFILE= localtime
+DSTDIR = $(ZONEINFDIR)DST
+CLEAN_DIRS = $(ZONEINFDIR)
+
+LDFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+install-data:
+ rm -rf $(ZONEINFDIR) ;\
+ mkdir -p $(DSTDIR) ;\
+ mkdir -p $(ZONEINFDIR2) ;
+
+## /usr/sbin/zic -d $(ZONEINFDIR) zoneinfo_base;
+ zic -d $(ZONEINFDIR) zoneinfo_base;
+
+ ln -f -s $(ZONEINFLNK)$(ZONEINFFILE) $(ZONEINFDIR)$(ZONEINFFILE); \
+ ln -f -s $(ZONEINFLNK2)$(ZONEINFFILE) $(ZONEINFDIR2)$(ZONEINFFILE)
+
+include ../../stub.mk
diff --git a/video_in_hal/stub/clock/localtime/zoneinfo_base b/video_in_hal/stub/clock/localtime/zoneinfo_base
new file mode 100755
index 0000000..944eabd
--- /dev/null
+++ b/video_in_hal/stub/clock/localtime/zoneinfo_base
@@ -0,0 +1,232 @@
+# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
+Rule DST min max - Jan 1 0:00u 1:00 -
+
+# DST OFF
+# Zone NAME UTCOFF RULES FORMAT [UNTIL]
+Zone UTC-1345 -13:45 - UTC-13
+Zone UTC-1330 -13:30 - UTC-13
+Zone UTC-1315 -13:15 - UTC-13
+Zone UTC-1300 -13 - UTC-13
+Zone UTC-1245 -12:45 - UTC-12
+Zone UTC-1230 -12:30 - UTC-12
+Zone UTC-1215 -12:15 - UTC-12
+Zone UTC-1200 -12 - UTC-12
+Zone UTC-1145 -11:45 - UTC-11
+Zone UTC-1130 -11:30 - UTC-11
+Zone UTC-1115 -11:15 - UTC-11
+Zone UTC-1100 -11 - UTC-11
+Zone UTC-1045 -10:45 - UTC-10
+Zone UTC-1030 -10:30 - UTC-10
+Zone UTC-1015 -10:15 - UTC-10
+Zone UTC-1000 -10 - UTC-10
+Zone UTC-0945 -9:45 - UTC-9
+Zone UTC-0930 -9:30 - UTC-9
+Zone UTC-0915 -9:15 - UTC-9
+Zone UTC-0900 -9 - UTC-9
+Zone UTC-0845 -8:45 - UTC-8
+Zone UTC-0830 -8:30 - UTC-8
+Zone UTC-0815 -8:15 - UTC-8
+Zone UTC-0800 -8 - UTC-8
+Zone UTC-0745 -7:45 - UTC-7
+Zone UTC-0730 -7:30 - UTC-7
+Zone UTC-0715 -7:15 - UTC-7
+Zone UTC-0700 -7 - UTC-7
+Zone UTC-0645 -6:45 - UTC-6
+Zone UTC-0630 -6:30 - UTC-6
+Zone UTC-0615 -6:15 - UTC-6
+Zone UTC-0600 -6 - UTC-6
+Zone UTC-0545 -5:45 - UTC-5
+Zone UTC-0530 -5:30 - UTC-5
+Zone UTC-0515 -5:15 - UTC-5
+Zone UTC-0500 -5 - UTC-5
+Zone UTC-0445 -4:45 - UTC-4
+Zone UTC-0430 -4:30 - UTC-4
+Zone UTC-0415 -4:15 - UTC-4
+Zone UTC-0400 -4 - UTC-4
+Zone UTC-0345 -3:45 - UTC-3
+Zone UTC-0330 -3:30 - UTC-3
+Zone UTC-0315 -3:15 - UTC-3
+Zone UTC-0300 -3 - UTC-3
+Zone UTC-0245 -2:45 - UTC-2
+Zone UTC-0230 -2:30 - UTC-2
+Zone UTC-0215 -2:15 - UTC-2
+Zone UTC-0200 -2 - UTC-2
+Zone UTC-0145 -1:45 - UTC-1
+Zone UTC-0130 -1:30 - UTC-1
+Zone UTC-0115 -1:15 - UTC-1
+Zone UTC-0100 -1 - UTC-1
+Zone UTC-0045 -0:45 - UTC-0
+Zone UTC-0030 -0:30 - UTC-0
+Zone UTC-0015 -0:15 - UTC-0
+Zone UTC+0000 0 - UTC+0
+Zone UTC+0015 0:15 - UTC+0
+Zone UTC+0030 0:30 - UTC+0
+Zone UTC+0045 0:45 - UTC+0
+Zone UTC+0100 1 - UTC+1
+Zone UTC+0115 1:15 - UTC+1
+Zone UTC+0130 1:30 - UTC+1
+Zone UTC+0145 1:45 - UTC+1
+Zone UTC+0200 2 - UTC+2
+Zone UTC+0215 2:15 - UTC+2
+Zone UTC+0230 2:30 - UTC+2
+Zone UTC+0245 2:45 - UTC+2
+Zone UTC+0300 3 - UTC+3
+Zone UTC+0315 3:15 - UTC+3
+Zone UTC+0330 3:30 - UTC+3
+Zone UTC+0345 3:45 - UTC+3
+Zone UTC+0400 4 - UTC+4
+Zone UTC+0415 4:15 - UTC+4
+Zone UTC+0430 4:30 - UTC+4
+Zone UTC+0445 4:45 - UTC+4
+Zone UTC+0500 5 - UTC+5
+Zone UTC+0515 5:15 - UTC+5
+Zone UTC+0530 5:30 - UTC+5
+Zone UTC+0545 5:45 - UTC+5
+Zone UTC+0600 6 - UTC+6
+Zone UTC+0615 6:15 - UTC+6
+Zone UTC+0630 6:30 - UTC+6
+Zone UTC+0645 6:45 - UTC+6
+Zone UTC+0700 7 - UTC+7
+Zone UTC+0715 7:15 - UTC+7
+Zone UTC+0730 7:30 - UTC+7
+Zone UTC+0745 7:45 - UTC+7
+Zone UTC+0800 8 - UTC+8
+Zone UTC+0815 8:15 - UTC+8
+Zone UTC+0830 8:30 - UTC+8
+Zone UTC+0845 8:45 - UTC+8
+Zone UTC+0900 9 - UTC+9
+Zone UTC+0915 9:15 - UTC+9
+Zone UTC+0930 9:30 - UTC+9
+Zone UTC+0945 9:45 - UTC+9
+Zone UTC+1000 10 - UTC+10
+Zone UTC+1015 10:15 - UTC+10
+Zone UTC+1030 10:30 - UTC+10
+Zone UTC+1045 10:45 - UTC+10
+Zone UTC+1100 11 - UTC+11
+Zone UTC+1115 11:15 - UTC+11
+Zone UTC+1130 11:30 - UTC+11
+Zone UTC+1145 11:45 - UTC+11
+Zone UTC+1200 12 - UTC+12
+Zone UTC+1215 12:15 - UTC+12
+Zone UTC+1230 12:30 - UTC+12
+Zone UTC+1245 12:45 - UTC+12
+Zone UTC+1300 13 - UTC+13
+Zone UTC+1315 13:15 - UTC+13
+Zone UTC+1330 13:30 - UTC+13
+Zone UTC+1345 13:45 - UTC+13
+
+# DST ON
+# Zone NAME UTCOFF RULES FORMAT [UNTIL]
+Zone DST/UTC-1345 -13:45 DST UTC-13
+Zone DST/UTC-1330 -13:30 DST UTC-13
+Zone DST/UTC-1315 -13:15 DST UTC-13
+Zone DST/UTC-1300 -13 DST UTC-13
+Zone DST/UTC-1245 -12:45 DST UTC-12
+Zone DST/UTC-1230 -12:30 DST UTC-12
+Zone DST/UTC-1215 -12:15 DST UTC-12
+Zone DST/UTC-1200 -12 DST UTC-12
+Zone DST/UTC-1145 -11:45 DST UTC-11
+Zone DST/UTC-1130 -11:30 DST UTC-11
+Zone DST/UTC-1115 -11:15 DST UTC-11
+Zone DST/UTC-1100 -11 DST UTC-11
+Zone DST/UTC-1045 -10:45 DST UTC-10
+Zone DST/UTC-1030 -10:30 DST UTC-10
+Zone DST/UTC-1015 -10:15 DST UTC-10
+Zone DST/UTC-1000 -10 DST UTC-10
+Zone DST/UTC-0945 -9:45 DST UTC-9
+Zone DST/UTC-0930 -9:30 DST UTC-9
+Zone DST/UTC-0915 -9:15 DST UTC-9
+Zone DST/UTC-0900 -9 DST UTC-9
+Zone DST/UTC-0845 -8:45 DST UTC-8
+Zone DST/UTC-0830 -8:30 DST UTC-8
+Zone DST/UTC-0815 -8:15 DST UTC-8
+Zone DST/UTC-0800 -8 DST UTC-8
+Zone DST/UTC-0745 -7:45 DST UTC-7
+Zone DST/UTC-0730 -7:30 DST UTC-7
+Zone DST/UTC-0715 -7:15 DST UTC-7
+Zone DST/UTC-0700 -7 DST UTC-7
+Zone DST/UTC-0645 -6:45 DST UTC-6
+Zone DST/UTC-0630 -6:30 DST UTC-6
+Zone DST/UTC-0615 -6:15 DST UTC-6
+Zone DST/UTC-0600 -6 DST UTC-6
+Zone DST/UTC-0545 -5:45 DST UTC-5
+Zone DST/UTC-0530 -5:30 DST UTC-5
+Zone DST/UTC-0515 -5:15 DST UTC-5
+Zone DST/UTC-0500 -5 DST UTC-5
+Zone DST/UTC-0445 -4:45 DST UTC-4
+Zone DST/UTC-0430 -4:30 DST UTC-4
+Zone DST/UTC-0415 -4:15 DST UTC-4
+Zone DST/UTC-0400 -4 DST UTC-4
+Zone DST/UTC-0345 -3:45 DST UTC-3
+Zone DST/UTC-0330 -3:30 DST UTC-3
+Zone DST/UTC-0315 -3:15 DST UTC-3
+Zone DST/UTC-0300 -3 DST UTC-3
+Zone DST/UTC-0245 -2:45 DST UTC-2
+Zone DST/UTC-0230 -2:30 DST UTC-2
+Zone DST/UTC-0215 -2:15 DST UTC-2
+Zone DST/UTC-0200 -2 DST UTC-2
+Zone DST/UTC-0145 -1:45 DST UTC-1
+Zone DST/UTC-0130 -1:30 DST UTC-1
+Zone DST/UTC-0115 -1:15 DST UTC-1
+Zone DST/UTC-0100 -1 DST UTC-1
+Zone DST/UTC-0045 -0:45 DST UTC-0
+Zone DST/UTC-0030 -0:30 DST UTC-0
+Zone DST/UTC-0015 -0:15 DST UTC-0
+Zone DST/UTC+0000 0 DST UTC+0
+Zone DST/UTC+0015 0:15 DST UTC+0
+Zone DST/UTC+0030 0:30 DST UTC+0
+Zone DST/UTC+0045 0:45 DST UTC+0
+Zone DST/UTC+0100 1 DST UTC+1
+Zone DST/UTC+0115 1:15 DST UTC+1
+Zone DST/UTC+0130 1:30 DST UTC+1
+Zone DST/UTC+0145 1:45 DST UTC+1
+Zone DST/UTC+0200 2 DST UTC+2
+Zone DST/UTC+0215 2:15 DST UTC+2
+Zone DST/UTC+0230 2:30 DST UTC+2
+Zone DST/UTC+0245 2:45 DST UTC+2
+Zone DST/UTC+0300 3 DST UTC+3
+Zone DST/UTC+0315 3:15 DST UTC+3
+Zone DST/UTC+0330 3:30 DST UTC+3
+Zone DST/UTC+0345 3:45 DST UTC+3
+Zone DST/UTC+0400 4 DST UTC+4
+Zone DST/UTC+0415 4:15 DST UTC+4
+Zone DST/UTC+0430 4:30 DST UTC+4
+Zone DST/UTC+0445 4:45 DST UTC+4
+Zone DST/UTC+0500 5 DST UTC+5
+Zone DST/UTC+0515 5:15 DST UTC+5
+Zone DST/UTC+0530 5:30 DST UTC+5
+Zone DST/UTC+0545 5:45 DST UTC+5
+Zone DST/UTC+0600 6 DST UTC+6
+Zone DST/UTC+0615 6:15 DST UTC+6
+Zone DST/UTC+0630 6:30 DST UTC+6
+Zone DST/UTC+0645 6:45 DST UTC+6
+Zone DST/UTC+0700 7 DST UTC+7
+Zone DST/UTC+0715 7:15 DST UTC+7
+Zone DST/UTC+0730 7:30 DST UTC+7
+Zone DST/UTC+0745 7:45 DST UTC+7
+Zone DST/UTC+0800 8 DST UTC+8
+Zone DST/UTC+0815 8:15 DST UTC+8
+Zone DST/UTC+0830 8:30 DST UTC+8
+Zone DST/UTC+0845 8:45 DST UTC+8
+Zone DST/UTC+0900 9 DST UTC+9
+Zone DST/UTC+0915 9:15 DST UTC+9
+Zone DST/UTC+0930 9:30 DST UTC+9
+Zone DST/UTC+0945 9:45 DST UTC+9
+Zone DST/UTC+1000 10 DST UTC+10
+Zone DST/UTC+1015 10:15 DST UTC+10
+Zone DST/UTC+1030 10:30 DST UTC+10
+Zone DST/UTC+1045 10:45 DST UTC+10
+Zone DST/UTC+1100 11 DST UTC+11
+Zone DST/UTC+1115 11:15 DST UTC+11
+Zone DST/UTC+1130 11:30 DST UTC+11
+Zone DST/UTC+1145 11:45 DST UTC+11
+Zone DST/UTC+1200 12 DST UTC+12
+Zone DST/UTC+1215 12:15 DST UTC+12
+Zone DST/UTC+1230 12:30 DST UTC+12
+Zone DST/UTC+1245 12:45 DST UTC+12
+Zone DST/UTC+1300 13 DST UTC+13
+Zone DST/UTC+1315 13:15 DST UTC+13
+Zone DST/UTC+1330 13:30 DST UTC+13
+Zone DST/UTC+1345 13:45 DST UTC+13
+
+Link UTC+0000 UTC
diff --git a/video_in_hal/stub/communication_subcpu/LICENSE b/video_in_hal/stub/communication_subcpu/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/stub/communication_subcpu/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/stub/communication_subcpu/Makefile b/video_in_hal/stub/communication_subcpu/Makefile
new file mode 100755
index 0000000..80a31b7
--- /dev/null
+++ b/video_in_hal/stub/communication_subcpu/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../stub.mk
diff --git a/video_in_hal/stub/communication_subcpu/client/Makefile b/video_in_hal/stub/communication_subcpu/client/Makefile
new file mode 100755
index 0000000..b232f9c
--- /dev/null
+++ b/video_in_hal/stub/communication_subcpu/client/Makefile
@@ -0,0 +1,43 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libCommSubCpu
+
+######### install headers(*.h) #############
+INST_HEADERS = CommSubCpu_API.h com_message_header.h
+
+######### compiled sources #############
+libCommSubCpu_SRCS += ./src/CommSubCpu_API.cpp
+
+######### add source path #############
+VPATH += src
+VPATH += include/stub
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/$(COMPONENT_NAME)
+
+######### add compile option #############
+
+######### linked library #############
+
+######### linked library (dynamic) #############
+
+######### add library path #############
+
+
+include ../../stub.mk
diff --git a/video_in_hal/stub/communication_subcpu/client/include/stub/CommSubCpu_API.h b/video_in_hal/stub/communication_subcpu/client/include/stub/CommSubCpu_API.h
new file mode 100755
index 0000000..020c361
--- /dev/null
+++ b/video_in_hal/stub/communication_subcpu/client/include/stub/CommSubCpu_API.h
@@ -0,0 +1,266 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMSUBCPU_API_H_
+#define COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMSUBCPU_API_H_
+
+/**
+ * @file CommSubCpu_API.h
+ * @~english
+ * @brief communication_subcpu API header
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup communication_subcpu
+ * @ingroup peripheral_service
+ * @{
+ */
+
+#include <sys/types.h>
+#include <native_service/frameworkunified_types.h>
+#include <agldd/moduleid.h>
+#include <stub/com_message_header.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /*__cplusplus*/
+
+/*! @~english CommSubCpu I/F API return code */
+typedef int32_t COMMSUBCPU_RET_API;
+
+/*! @~english Thread name */
+#define LAN_SERVICE_SYSCOM_MAIN "DEV_SYSCOM_MAIN"
+
+/**
+ * \~english The ICR command receive notification
+ */
+#define CID_ICR_CMD_RCV (0x0A00)
+
+/**
+ * \~english The ICR command send result notification
+ */
+#define CID_ICR_CMD_SND_CNF (0x0A01)
+
+/*! @~english The MAX length of send command */
+#define ICRCMD_OPELAND_SND_MAX (2048)
+/*! @~english The MAX length of send ICR command */
+#define ICRCMD_OPELAND_MAX (252)
+
+/**
+ * \~english ICR command format
+ */
+typedef struct {
+ uint16_t phyadr_from; //!< \~english Physical address
+ uint8_t service_type; //!< \~english Communication type
+ uint8_t lgadr_from; //!< \~english Source logical address
+ uint8_t lgadr_to; //!< \~english Forwarding destination logical address
+ uint8_t opc; //!< \~english Operation code
+ uint8_t d_length; //!< \~english Data size
+ uint8_t data[ICRCMD_OPELAND_MAX]; //!< \~english Command data
+ uint8_t reserve; //!< \~english Reserve
+} T_ICR_CMD_DATA;
+
+/**
+ * \~english Send command structure
+ */
+typedef struct {
+ uint16_t phyadr_from; //!< \~english Physical address
+ uint8_t service_type; //!< \~english Communication type
+ uint8_t lgadr_from; //!< \~english Source logical address
+ uint8_t lgadr_to; //!< \~english Forwarding destination logical address
+ uint8_t opc; //!< \~english Operation code
+ uint16_t d_length; //!< \~english Data size
+ uint8_t data[ICRCMD_OPELAND_SND_MAX]; //!< \~english Command data
+} T_ICR_CMD_SND_DATA;
+
+/**
+ * \~english ICR command data
+ */
+typedef struct {
+ T_ICR_CMD_SND_DATA cmd_data; //!< \~english Command information
+} T_ICR_CMD;
+
+/**
+ * \~english The message of command receive notification
+ */
+typedef struct {
+ /*! @~english The header of message */
+ T_APIMSG_MSGBUF_HEADER_COMM msg_hdr;
+ /*! @~english The message data for send result */
+ T_ICR_CMD_DATA cmd_data;
+} T_ICR_CMD_RCV;
+
+/*!
+ * @~english Status of message send result
+ */
+typedef enum {
+ /*! @~english Send success */
+ ICR_SND_SUCCESS = 0,
+ /*! @~english Initialize error */
+ ICR_SND_ERR_INIT,
+ /*! @~english Send error */
+ ICR_SND_ERR,
+ /*! @~english Send error(retry out) */
+ ICR_SND_ERR_RETRYOUT,
+ /*! @~english Send error(buffer full) */
+ ICR_SND_ERR_BUFFERFULL,
+ /*! @~english Send error(micon abnormal) */
+ ICR_SND_ERR_MC,
+ /*! @~english The MAX */
+ ICR_SND_ERR_MAX
+} ICR_ERROR_CODE;
+
+/*!
+ * @~english Structure for message send status data
+ */
+typedef struct {
+ /*! @~english Result of send message */
+ ICR_ERROR_CODE cnf_sts;
+} T_ICR_CMDSNDCNF_STS;
+
+
+ /**
+ * \~english The send result notification
+ */
+typedef struct {
+ /*! @~english The header of message */
+ T_APIMSG_MSGBUF_HEADER_COMM msg_hdr;
+ /*! @~english The message data for send result */
+ T_ICR_CMDSNDCNF_STS sts;
+} T_ICR_CMDSNDCNF;
+
+
+#define COMMSUBCPU_RET_NORMAL 0 //!< \~english Normal termination
+#define COMMSUBCPU_RET_ERROR_CANCEL 1 //!< \~english Abnormal termination
+#define COMMSUBCPU_RET_ERROR_PARAM 2 //!< \~english Abnormality of parameter
+#define COMMSUBCPU_RET_ERROR_BUFFULL 3 //!< \~english Buffer FULL
+#define COMMSUBCPU_RET_ERROR_OVERLAPPED 4 //!< \~english Entry overlapped
+#define COMMSUBCPU_RET_ERROR_CREATE_EVENT 5 //!< \~english Event generation failure
+
+/**
+ * \ingroup CommSubCpu
+ * \~english @par Brief
+ * CommSubCpu moudle init
+ * \~english @retval COMMSUBCPU_RET_NORMAL : Success
+ * \~english @par Prerequisite
+ * None
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * None
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+COMMSUBCPU_RET_API CommSubCpu_Init();
+
+/**
+ * \ingroup CommSubCpu
+ * \~english @par Brief
+ * CommSubCpu moudle deinitializes
+ * \~english @retval COMMSUBCPU_RET_NORMAL : Success
+ * \~english @par Prerequisite
+ * CommSubCpu moudle init completely
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * None
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @see
+ * None
+ */
+COMMSUBCPU_RET_API CommSubCpu_DeInit();
+
+/**
+ * \ingroup CommSubCpu
+ * \~english @par Brief
+ * Delivery registration of CommSubCpu command
+ * \~english @param [in] name
+ * PCSTR - Receiver thread name
+ * \~english @param [in] from
+ * uint8_t - Sender logical address
+ * \~english @param [in] to
+ * uint8_t - Receiver logical address
+ * \~english @param [in] opc
+ * uint8_t - Operation code
+ * \~english @param [in] callback_id
+ * uint8_t - callback ID
+ * \~english @param [in] cid
+ * uint16_t - CID
+ * \~english @retval COMMSUBCPU_RET_NORMAL : Success
+ * \~english @retval COMMSUBCPU_RET_ERROR_PARAM : Paramter error
+ * \~english @par Prerequisite
+ * Availability of Communication is TRUE
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - COMMSUBCPU_RET_ERROR_PARAM
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Async
+ * \~english @see
+ * None
+ */
+COMMSUBCPU_RET_API CommSubCpu_DeliveryMsgEntry(PCSTR name, uint8_t from, uint8_t to, uint8_t opc,
+ uint8_t callback_id, uint16_t cid);
+
+/**
+ * \ingroup CommSubCpu
+ * \~english @par Brief
+ * CommSubCpu command transmission request
+ * \~english @param [in] name
+ * PCSTR - Sender thread name
+ * \~english @param [in] snd_cmd
+ * T_ICR_CMD* - Pointer to send command
+ * \~english @param [in] req_id
+ * uint8_t - RID of the results
+ * \~english @retval COMMSUBCPU_RET_NORMAL : Success
+ * \~english @retval COMMSUBCPU_RET_ERROR_PARAM : Paramter error
+ * \~english @par Prerequisite
+ * Availability of Communication is TRUE
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - COMMSUBCPU_RET_ERROR_PARAM
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Async
+ * \~english @see
+ * None
+ */
+COMMSUBCPU_RET_API CommSubCpu_Transmission(PCSTR name, T_ICR_CMD *snd_cmd, uint8_t req_id);
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus */
+
+#endif // COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMSUBCPU_API_H_
diff --git a/video_in_hal/stub/communication_subcpu/client/include/stub/com_message_header.h b/video_in_hal/stub/communication_subcpu/client/include/stub/com_message_header.h
new file mode 100755
index 0000000..707cca5
--- /dev/null
+++ b/video_in_hal/stub/communication_subcpu/client/include/stub/com_message_header.h
@@ -0,0 +1,65 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COM_MESSAGE_HEADER_H_
+#define COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COM_MESSAGE_HEADER_H_
+
+/**
+ * @file com_message_header.h
+ * @~english
+ * @brief Defination of structure for message header
+ */
+
+#include <sys/types.h>
+
+/****************************************************************************
+ * TAG : typedef T_APIMSG_HEADER
+ * ABSTRACT : _CWORD64_API message header structure
+ * NOTE :
+ ****************************************************************************/
+/*!
+ * @~english
+ * @brief Structure for message header
+ */
+typedef struct {
+ uint16_t replyid; //!< \~english Send Result ID
+ uint16_t sndpno; //!< \~english Send process No
+ uint16_t respno; //!< \~english Response No
+ uint16_t cid; //!< \~english Command ID
+ uint16_t msgbodysize; //!< \~english Message body size
+ uint8_t rid; //!< \~english Resource ID
+ uint8_t reserve; //!< \~english Reserve
+ uint8_t filler[2]; //!< \~english filler
+} T_APIMSG_HEADER_COMM;
+
+/*!
+ * @~english
+ * @brief Structure for buffer message header
+ */
+typedef struct {
+ uint32_t signo; //!< \~english Signal No
+ T_APIMSG_HEADER_COMM hdr; //!< \~english Message Header
+} T_APIMSG_MSGBUF_HEADER_COMM;
+
+/*!
+ * @~english @brief Check for assert do not overflow buffer when Re-arrangement was cast to another structure
+ */
+#define assert_static(e) \
+ do { \
+ enum { assert_static__ = 1 / (e) }; \
+ } while (0)
+
+#endif // COMMUNICATION_SUBCPU_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COM_MESSAGE_HEADER_H_
diff --git a/video_in_hal/stub/communication_subcpu/client/src/CommSubCpu_API.cpp b/video_in_hal/stub/communication_subcpu/client/src/CommSubCpu_API.cpp
new file mode 100755
index 0000000..69e06e3
--- /dev/null
+++ b/video_in_hal/stub/communication_subcpu/client/src/CommSubCpu_API.cpp
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <stub/CommSubCpu_API.h>
+
+COMMSUBCPU_RET_API CommSubCpu_Init() {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return COMMSUBCPU_RET_NORMAL;
+}
+
+COMMSUBCPU_RET_API CommSubCpu_DeInit() {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return COMMSUBCPU_RET_NORMAL;
+}
+
+COMMSUBCPU_RET_API CommSubCpu_DeliveryMsgEntry(PCSTR name, uint8_t from, uint8_t to, uint8_t opc,
+ uint8_t callback_id, uint16_t cid) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return COMMSUBCPU_RET_NORMAL;
+}
+
+
+COMMSUBCPU_RET_API CommSubCpu_Transmission(PCSTR name, T_ICR_CMD *snd_cmd, uint8_t req_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return COMMSUBCPU_RET_NORMAL;
+}
diff --git a/video_in_hal/stub/communication_usb/LICENSE b/video_in_hal/stub/communication_usb/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/stub/communication_usb/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/stub/communication_usb/Makefile b/video_in_hal/stub/communication_usb/Makefile
new file mode 100755
index 0000000..80a31b7
--- /dev/null
+++ b/video_in_hal/stub/communication_usb/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../stub.mk
diff --git a/video_in_hal/stub/communication_usb/client/Makefile b/video_in_hal/stub/communication_usb/client/Makefile
new file mode 100755
index 0000000..fbefaed
--- /dev/null
+++ b/video_in_hal/stub/communication_usb/client/Makefile
@@ -0,0 +1,43 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libCommUSB
+
+######### install headers(*.h) #############
+INST_HEADERS = commusb_api.h commusb_notifications.h
+
+######### compiled sources #############
+libCommUSB_SRCS += src/commusb_api.cpp
+
+######### add source path #############
+VPATH += src
+VPATH += include/stub
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/$(COMPONENT_NAME)
+
+######### add compile option #############
+
+######### linked library #############
+
+######### linked library (dynamic) #############
+
+######### add library path #############
+
+
+include ../../stub.mk
diff --git a/video_in_hal/stub/communication_usb/client/include/stub/commusb_api.h b/video_in_hal/stub/communication_usb/client/include/stub/commusb_api.h
new file mode 100755
index 0000000..f602faa
--- /dev/null
+++ b/video_in_hal/stub/communication_usb/client/include/stub/commusb_api.h
@@ -0,0 +1,186 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!-----------------------------------------------------------------------------
+ * @file commusb_api.h
+ * @~english
+ * @brief CommUSB I/F
+ */
+#ifndef COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_API_H_
+#define COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_API_H_
+
+#include <sys/types.h>
+#include <native_service/frameworkunified_types.h>
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup communication_usb
+ * @ingroup peripheral_service
+ * @{
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/**
+ * @~english Service Name of PS_CommUSB Thread
+ */
+#define LAN_SERVICE_COMMUSB_MAIN "PS_CommUSB"
+
+/**
+ * @~english The maximum number of delivery entry
+ */
+#define COMMUSB_DELIVERY_DATA_MAX 0xFF
+
+/**
+ * @~english Authentication info
+ */
+typedef enum {
+ /**
+ *@~english Authentication is NG
+ */
+ COMMUSB_AUTH_NG = 0x00,
+
+ /**
+ *@~english Authentication is OK
+ */
+ COMMUSB_AUTH_OK
+} COMMUSB_AUTH_INFO;
+
+/**
+ * @~english Transmit class
+ */
+typedef enum {
+ /**
+ *@~english Individual transmission
+ */
+ COMMUSB_TRANS_INDIVIDUAL = 0x00,
+
+ /**
+ *@~english Group broadcast transmission
+ */
+ COMMUSB_TRANS_GROUP,
+
+ /**
+ *@~english Simultaneous broadcast transmission
+ */
+ COMMUSB_TRANS_ALL
+} COMMUSB_TRANS_CLASS;
+
+/**
+ * @~english Clear type of DeliveryEntry table (for debug)
+ */
+typedef enum {
+ /**
+ * @~english Clear all
+ */
+ USB_CLEAR_TYPE_ALL = 0,
+
+ /**
+ * @~english Clear only table without wild card
+ */
+ USB_CLEAR_TYPE_WITHOUT_WILDCARD,
+
+ /**
+ * @~english Clear only table with wild card
+ */
+ USB_CLEAR_TYPE_WITH_WILDCARD,
+} USB_CLEAR_TYPE;
+
+/**
+ * \ingroup USB_Auth_Info
+ * \~english @par Brief
+ * Set the authentication status of the service PS_CommUSB.
+ * \~english @param [in] h_app
+ * HANDLE - handle for application
+ * \~english @param [in] auth_info
+ * uint8_t - Authentication status,refer to @ref COMMUSB_AUTH_INFO
+ * \~english @retval eFrameworkunifiedStatusOK success
+ * \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ * \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ * \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ * \~english @retval eFrameworkunifiedStatusErrNoEINTR
+ * An interrupt is generated by the system call (signal)
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ * \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ * \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+ * \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * (System error, Avaiability is FALSE, internal status error)
+ * \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ * \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
+ * \~english @retval eFrameworkunifiedStatusErrOther
+ * Other error has occurred(Cannot access shared memory, etc.)
+ * \~english @par Preconditons
+ * - Availability of PS_CommUSB is TRUE and Authentication state is TRUE.
+ * \~english @par Change of internal status
+ * - Change of internal state according to the API does not occur
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - Parameter h_app is null
+ * - eFrameworkunifiedStatusInvldHandle
+ * - Parameter auth_info is invalid
+ * - eFrameworkunifiedStatusInvldParam
+ * - Internal process error
+ * - Availability of PS_CommUSB is not TRUE
+ * - The size of the message received by PS_CommUSB is illegal
+ * - eFrameworkunifiedStatusFail
+ * - Execute the process name is not ExtUnitAuth
+ * - eFrameworkunifiedStatusMsgNotProcessed
+ * - Internal process error(ns_framework error)
+ * - eFrameworkunifiedStatusInvldHandle
+ * - eFrameworkunifiedStatusMsgQFull
+ * - eFrameworkunifiedStatusErrNoEBADF
+ * - eFrameworkunifiedStatusErrNoEINTR
+ * - eFrameworkunifiedStatusNullPointer
+ * - eFrameworkunifiedStatusInvldBufSize
+ * - eFrameworkunifiedStatusInvldBuf
+ * - eFrameworkunifiedStatusBadConnection
+ * - eFrameworkunifiedStatusFail
+ * - eFrameworkunifiedStatusInvldHndlType
+ * - eFrameworkunifiedStatusInvldQName
+ * - eFrameworkunifiedStatusErrOther
+ * \~english @par classification
+ * Public
+ * \~english @par Type
+ * Method only
+ * \~english @par Details
+ * Set the authentication status for PS_CommUSB.
+ * \~english @par
+ * when using this API,please note the following points:
+ * - The status of service PS_CommUSB and the availability of this
+ * API, refer to PS_CommUSB available function list of BaseSystem
+ * external specification.
+ * - This API is designed for the ExtUnitAuth process, If it is used by
+ * other process, return eFrameworkunifiedStatusMsgNotProcessed.
+ * \~english @see None
+ */
+EFrameworkunifiedStatus USB_Auth_Info(HANDLE h_app, uint8_t auth_info);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+/** @}*/ // end of communication_usb
+/** @}*/ // end of peripheral_service
+/** @}*/ // end of BaseSystem
+#endif // COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_API_H_
diff --git a/video_in_hal/stub/communication_usb/client/include/stub/commusb_notifications.h b/video_in_hal/stub/communication_usb/client/include/stub/commusb_notifications.h
new file mode 100755
index 0000000..9a75cbb
--- /dev/null
+++ b/video_in_hal/stub/communication_usb/client/include/stub/commusb_notifications.h
@@ -0,0 +1,56 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file commusb_notifications.h
+ * @~english
+ * @brief commusb_notifications I/F
+ */
+#ifndef COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_NOTIFICATIONS_H_
+#define COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_NOTIFICATIONS_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup communication_usb
+ * @ingroup peripheral_service
+ * @{
+ */
+
+/**
+ * \~english PS_CommUSB service availability notify.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_CommUSB_Availability, OnRcvAvailable_USBEx);
+ * @endcode
+ */
+#define NTFY_CommUSB_Availability "PS_CommUSB/Availability"
+
+/**
+ * \~english USB Device Enumeration complete notify.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_CommUSB_DeviceValidity, OnRcvDeviceValidity);
+ * @endcode
+ */
+#define NTFY_CommUSB_DeviceValidity "PS_CommUSB/DeviceValidity"
+
+/** @}*/ // end of communication_usb
+/** @}*/ // end of peripheral_service
+/** @}*/ // end of BaseSystem
+#endif // COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_NOTIFICATIONS_H_
diff --git a/video_in_hal/stub/communication_usb/client/src/commusb_api.cpp b/video_in_hal/stub/communication_usb/client/src/commusb_api.cpp
new file mode 100755
index 0000000..c0aa021
--- /dev/null
+++ b/video_in_hal/stub/communication_usb/client/src/commusb_api.cpp
@@ -0,0 +1,33 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <stub/commusb_api.h>
+
+EFrameworkunifiedStatus USB_Auth_Info(HANDLE h_app, uint8_t auth_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
diff --git a/video_in_hal/stub/diag_code/LICENSE b/video_in_hal/stub/diag_code/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/stub/diag_code/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/stub/diag_code/Makefile b/video_in_hal/stub/diag_code/Makefile
new file mode 100755
index 0000000..5d374f8
--- /dev/null
+++ b/video_in_hal/stub/diag_code/Makefile
@@ -0,0 +1,18 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SUBDIRS := library library_dummy_dccc
+
+include ../stub.mk
diff --git a/video_in_hal/stub/diag_code/library/Makefile b/video_in_hal/stub/diag_code/library/Makefile
new file mode 100755
index 0000000..274f147
--- /dev/null
+++ b/video_in_hal/stub/diag_code/library/Makefile
@@ -0,0 +1,51 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+######### installed program #############
+
+######### installed library(*.a) #############
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libDiagCodeAPI
+
+######### install headers(*.h) #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += DiagCodeAPI.h DIAGCODE.h ss_diag.h
+
+######### compiled sources #############
+libDiagCodeAPI_SRCS += DiagCodeAPI.cpp
+
+######### add source path #############
+VPATH += ./src
+
+######### add include path #############
+CPPFLAGS += -I./include/stub
+CPPFLAGS += -I./../library_dummy_dccc/include/
+
+######### add compile option #############
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+######### dynamic linked library path #############
+
+######### add library path #############
+
+
+include ../../stub.mk
diff --git a/video_in_hal/stub/diag_code/library/include/stub/DIAGCODE.h b/video_in_hal/stub/diag_code/library/include/stub/DIAGCODE.h
new file mode 100755
index 0000000..5cbcfad
--- /dev/null
+++ b/video_in_hal/stub/diag_code/library/include/stub/DIAGCODE.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file DIAGCODE.h
+ */
+/****************************************************************************
+ * FILE : DIAGCODE.h
+ * SYSTEM : Integrated PF middleware system
+ * SUBSYSTEM : ommon system
+ * TITLE : DiagCode
+ ****************************************************************************/
+#ifndef DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODE_H_
+#define DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODE_H_
+
+/*************************************************************************
+ * DiagCode difinition
+ *************************************************************************/
+
+/*************************************************************************
+ * DiagCode code definition name
+ *************************************************************************/
+
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+#define DIAGCODE_DIAGCODEEX_DEFAULT 0x0000U /* - */
+#define DIAGCODE_DIAGCODEEX_EEPROM__CWORD84_ 0x0000U /* - */
+#define DIAGCODE_DIAGCODEEX_STORAGE_ERR__CWORD84_ 0x0000U /* - */
+#define DIAGCODE_DIAGCODEEX_TEL_ECU_ERR 0x0000U /* - */
+
+#endif /* DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODE_H_ */
diff --git a/video_in_hal/stub/diag_code/library/include/stub/DiagCodeAPI.h b/video_in_hal/stub/diag_code/library/include/stub/DiagCodeAPI.h
new file mode 100755
index 0000000..de831eb
--- /dev/null
+++ b/video_in_hal/stub/diag_code/library/include/stub/DiagCodeAPI.h
@@ -0,0 +1,1226 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file DiagCodeAPI.h
+ */
+/*******************************************************************************
+ * FILE : DiagCodeAPI.h
+ * SYSTEM : LinuxPF
+ * SUBSYSTEM :
+ * TITLE : DiagCode management function include definition
+ ******************************************************************************/
+
+#ifndef DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODEAPI_H_
+#define DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODEAPI_H_
+
+/**
+ * @file DiagCodeAPI.h
+ * @~english
+ * @brief Diag code API header
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup diag_code
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! @~english API return value */
+typedef int DGCODE_RET_API;
+
+/**
+ * \~english The definition of diag code processing result
+ */
+/*! @~english Success */
+#define DGCODE_RET_NORMAL (0)
+/*! @~english Fail */
+#define DGCODE_RET_ERROR (-1)
+/*! @~english Illegal parameter */
+#define DGCODE_RET_PARA_ERR (-2)
+
+/**
+ * \~english Category ID definition
+ */
+
+/*! @~english none device */
+#define DGCODE_DIV_UNIT_NONE (0x00)
+/*! @~english device base */
+#define DGCODE_DIV_UNIT_BASE (0x10)
+/*! @~english Your own device */
+#define DGCODE_DIV_UNIT__CWORD92_ (DGCODE_DIV_UNIT_BASE + 0x00)
+/*! @~english Other devices */
+#define DGCODE_DIV_UNIT_OTHER (DGCODE_DIV_UNIT_BASE + 0x01)
+/*! @~english device maximum number definition */
+#define DGCODE_DIV_UNIT_MAX (DGCODE_DIV_UNIT_OTHER)
+
+/*! @~english proto base */
+#define DGCODE_DIV_PROT_BASE (0x20)
+/*! @~english _CWORD43_ */
+#define DGCODE_DIV_PROT__CWORD43_ (DGCODE_DIV_PROT_BASE + 0x00)
+/*! @~english USB */
+#define DGCODE_DIV_PROT_USB (DGCODE_DIV_PROT_BASE + 0x02)
+/*! @~english _CWORD119_ */
+#define DGCODE_DIV_PROT__CWORD119_ (DGCODE_DIV_PROT_BASE + 0x03)
+/*! @~english proto device maximum number definition */
+#define DGCODE_DIV_PROT_MAX (DGCODE_DIV_PROT_USB)
+/*! @~english Communication full selection */
+#define DGCODE_DIV_PROT_ALL (DGCODE_DIV_PROT_BASE + 0x0F)
+/*! @~english All select */
+#define DGCODE_DIV_ALL (DGCODE_DIV_UNIT_BASE + DGCODE_DIV_PROT_BASE)
+/*! \~english Public RoB selection */
+#define DGCODE_DIV_ROB_PUBLIC (1)
+/*! \~english Private Rob selection */
+#define DGCODE_DIV_ROB_PRIVATE (2)
+/*! \~english RoB All select selection*/
+#define DGCODE_DIV_ROB_ALL (DGCODE_DIV_ROB_PUBLIC + DGCODE_DIV_ROB_PRIVATE)
+
+/**
+ * \~english Past present registered flag definition
+ */
+/*! @~english Past and present */
+#define DGCODE_TYPE_PAST_PRES (0)
+/*! @~english Present only */
+#define DGCODE_TYPE_PAST (1)
+/*! @~english Past only */
+#define DGCODE_TYPE_PRES (2)
+/*! @~english Unspecified */
+#define DGCODE_TYPE_NOTSPECIFIED (3)
+
+/**
+ * \~english FF data registration flag definition
+ */
+/*! @~english Do not register FF data */
+#define DGCODE_FFDATA_REG_OFF (0)
+/*! @~english FF data registered */
+#define DGCODE_FFDATA_REG_ON (1)
+/*! @~english Unspecified */
+#define DGCODE_FFDATA_REG_NOTSPECIFIED (2)
+
+/**
+ * \~english Validity invalid time definition
+ */
+/*! @~english Time information invalid */
+#define DGCODE_TIME_INVALID (0)
+/*! @~english Time information valid */
+#define DGCODE_TIME_VALID (1)
+/*! @~english Unspecified */
+#define DGCODE_TIME_NOTSPECIFIED (2)
+
+/**
+ * \~english Diag code existence check result definition
+ */
+/*! @~english Diag code not registered */
+#define DGCODE_CHECK_NOT_EXIST (0)
+/*! @~english Diag code registered */
+#define DGCODE_CHECK_EXIST (1)
+
+/**
+ * \~english Diag code type definition
+ */
+/*! @~english Development diag code */
+#define DGCODE_KIND_DEVELOPMENT (0)
+/*! @~english Service diag code */
+#define DGCODE_KIND_SERVICE (1)
+/*! @~english Communication diag code */
+#define DGCODE_KIND_COMMUNICATION (2)
+/*! @~english Manufacturer diag code */
+#define DGCODE_KIND_MAKER (3)
+
+/**
+ * \~english RoB code type definition
+ */
+/*! \~english Public(service use) */
+#define DGCODE_ROB_KIND_PUBLIC (0)
+/*! \~english Private(only design) */
+#define DGCODE_ROB_KIND_PRIVATE (1)
+
+/**
+ * \~english type of rob_code specification
+ */
+/*! \~english Specify all RoB codes. */
+#define DGCODE_GET_ALL_ROB_CODE (0xFFFF)
+
+/**
+ * \~english Logical unit number definition
+ */
+/*! @~english Unit number 0X */
+#define DGCODE_MAKER_UNIT_0 (0x00)
+/*! @~english Unit number 1X */
+#define DGCODE_MAKER_UNIT_1 (0x01)
+/*! @~english Unit number 2X */
+#define DGCODE_MAKER_UNIT_2 (0x02)
+/*! @~english Unit number 3X */
+#define DGCODE_MAKER_UNIT_3 (0x03)
+/*! @~english Unit number 4X */
+#define DGCODE_MAKER_UNIT_4 (0x04)
+/*! @~english Unit number 5X */
+#define DGCODE_MAKER_UNIT_5 (0x05)
+/*! @~english Unit number 6X */
+#define DGCODE_MAKER_UNIT_6 (0x06)
+/*! @~english Unit number 7X */
+#define DGCODE_MAKER_UNIT_7 (0x07)
+/*! @~english Unit number 8X */
+#define DGCODE_MAKER_UNIT_8 (0x08)
+/*! @~english Unit number 9X */
+#define DGCODE_MAKER_UNIT_9 (0x09)
+/*! @~english Unit number AX */
+#define DGCODE_MAKER_UNIT_A (0x0A)
+/*! @~english Unit number BX */
+#define DGCODE_MAKER_UNIT_B (0x0B)
+/*! @~english Unit number CX */
+#define DGCODE_MAKER_UNIT_C (0x0C)
+/*! @~english Unit number DX */
+#define DGCODE_MAKER_UNIT_D (0x0D)
+/*! @~english Unit number EX */
+#define DGCODE_MAKER_UNIT_E (0x0E)
+/*! @~english Unit number FX */
+#define DGCODE_MAKER_UNIT_F (0x0F)
+/*! @~english All above */
+#define DGCODE_MAKER_UNIT_ALL (0x10)
+
+/**
+ * \~english All designation definitions of registered devices
+ */
+/*! @~english Error designation of all registered devices */
+#define DGCODE_PHYSADR_ALL (0xFFFF)
+
+/**
+ * \~english Diag code registration / deletion notification type definition
+ */
+/*! @~english Diag code registration */
+#define DGCODE_NOTIFY_PUT (0)
+/*! @~english Diag code clear */
+#define DGCODE_NOTIFY_DELETE (1)
+/*! \~english DTC registration */
+#define DGCODE_NOTIFY_DTC_PUT (2)
+/*! \~english RoB registration */
+#define DGCODE_NOTIFY_ROB_PUT (3)
+/*! \~english DTC clear */
+#define DGCODE_NOTIFY_DTC_DELETE (4)
+/*! \~english RoB clear */
+#define DGCODE_NOTIFY_ROB_DELETE (5)
+
+/**
+ * \~english Type of activation definition
+ */
+/*! @~english Hot start */
+#define DGCODE_START_KIND_HOT (0)
+/*! @~english Cold start */
+#define DGCODE_START_KIND_COLD (1)
+
+/**
+ * \~english Analysis support log saved DTC event presence / absence flag definition
+ */
+
+/*!
+ @~english The unnecessary diag code of saving analysis support log
+*/
+#define DGCODE_DTC_EVENT_LOG_OFF (0)
+/*!
+ @~english The necessary diag code of saving analysis support Log
+*/
+#define DGCODE_DTC_EVENT_LOG_ON (1)
+
+/**
+ * \~english Diag code registration mask setting definition
+ */
+/*! @~english Diag code registration mask OFF */
+#define DGCODE_PUT_MASK_OFF (0)
+/*! @~english Diag code registration mask ON */
+#define DGCODE_PUT_MASK_ON (1)
+
+/**
+ * \~english Diag code unique count value definition
+ */
+/*! @~english Normal count */
+#define DGC_TIMESTAMP_NORMAL 0U
+/*! @~english Original count */
+#define DGC_TIMESTAMP_INDIPENDENT 1U
+
+/**
+ * \~english Availability register id define.
+ */
+/*! @~english Backup manager register id */
+#define DGC_REG_AVAILABILITY_BACKUP 0x01
+/*! @~english Clock register id */
+#define DGC_REG_AVAILABILITY_CLOCK 0x02
+/*! @~english diag_record register id */
+#define DGC_REG_AVAILABILITY_PFDRECTHREAD 0x04
+/*! @~english Vehicle register id */
+#define DGC_REG_AVAILABILITY_VEHICLE 0x08
+/*! @~english Postion register id */
+#define DGC_REG_AVAILABILITY_POSITION 0x10
+
+/**
+ * \~english Diag code registration / erasing detailed setting structure
+ */
+typedef struct _DGCODE_MEMINFO_CUSTOM {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_MEMINFO_CUSTOM;
+
+/**
+ * \~english Time information for SSR information
+ */
+typedef struct _DGCODE_SSR_INFO_TIME_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_SSR_INFO_TIME_INFO;
+
+/**
+ * \~english DTC SSR information
+ */
+typedef struct _DGCODE_DTC_SSR_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DTC_SSR_INFO;
+
+/**
+ * \~english RoB SSR information
+ */
+typedef struct _DGCODE_ROB_SSR_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_ROB_SSR_INFO;
+
+/**
+ * \~english Diag code list acquisition setting structure
+ */
+typedef struct _DGCODE_GET_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_GET_LIST_INFO;
+
+/**
+ * \~english Diag code list information structure
+ */
+typedef struct _DGCODE_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_LIST_INFO;
+
+/**
+ * \~english DTC list acquisition setting structure
+ */
+typedef struct _DGCODE_GET_DTC_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_GET_DTC_LIST_INFO;
+
+/**
+ * \~english DTC list information structure
+ */
+typedef struct _DGCODE_DTC_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DTC_LIST_INFO;
+
+
+/**
+ * \~english RoB list acquisition setting structure
+ */
+typedef struct _DGCODE_GET_ROB_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_GET_ROB_LIST_INFO;
+
+/**
+ * \~english RoB list information structure
+ */
+typedef struct _DGCODE_ROB_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_ROB_LIST_INFO;
+
+/**
+ * \~english FF data list information structure
+ */
+typedef struct _DGCODE_FFDATA_LIST_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_FFDATA_LIST_INFO;
+
+/**
+ * \~english Diag code list delete setting structure
+ */
+typedef struct _DGCODE_DELETE_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DELETE_INFO;
+
+/**
+ * \~english DTC list delete setting structure
+ */
+typedef struct _DGCODE_DELETE_DTC_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DELETE_DTC_INFO;
+
+/**
+ * \~english RoB list delete setting structure
+ */
+typedef struct _DGCODE_DELETE_ROB_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DELETE_ROB_INFO;
+
+/**
+ * \~english DID change structure
+ */
+typedef struct _DGCODE_DID_LIST {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} DGCODE_DID_LIST;
+
+/****************************************/
+/* DiagCodeAPI */
+/****************************************/
+/// \~english Subscribe the availability of the external module
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_SubscribeAvailability
+/// \~english @par Overview
+/// - Notify the availability status of the external module
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] availabilityId The availability id(refer to DGC_REG_AVAILABILITY_XXX)
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - None
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Subscribe the availability callback to NSFW failed [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - Subscribe the availability of the external module
+/// - Use "|" to subscribe the availability of the multiply modules
+/// example: Use the follow way to subscribe the availability of the backup manager and the clock
+/// Diag_SubscribeAvailability(hApp, DGC_REG_AVAILABILITY_BACKUP | DGC_REG_AVAILABILITY_CLOCK)
+/// \~english @see Diag_NotifyAvailability
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_SubscribeAvailability(HANDLE hApp, uint8_t availabilityId);
+
+/// \~english Notify the availability of external module
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_NotifyAvailability
+/// \~english @par Overview
+/// - Notify the availability status of the external module
+/// \~english @param [in] availabilityId The availability id(refer to DGC_REG_AVAILABILITY_XXX)
+/// \~english @param [in] bAvailability Availability status(TRUE: Available, FALSE: Unavailable)
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @par Precondition
+/// - None
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - Notify the available status of external module
+/// - Use "|" to notify the availability status of the multiply modules
+/// example: Use the follow way to notify that the backup manager and the clock are available
+/// Diag_NotifyAvailability(DGC_REG_AVAILABILITY_BACKUP | DGC_REG_AVAILABILITY_CLOCK, TRUE)
+/// \~english @see Diag_SubscribeAvailability
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_NotifyAvailability(uint8_t availabilityId, BOOL bAvailability);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_InitDiagCode
+/// \~english @par Overview
+/// - Perform initialization processing of diag code management.
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] start_kind activation type
+/// \~english @param [in] fpOnCmd fpOnCmd callback definition
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - PFDRECThread is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - When activation type is invalid [DGCODE_RET_PARA_ERR]
+/// - When diag work memory allocation fails [DGCODE_RET_ERROR]
+/// - Failure occurs when read data from the backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when write data to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when write data to the backup area. [DGCODE_RET_ERROR]
+/// - In case acquisition of application name from argument hApp failed [DGCODE_RET_ERROR]
+/// - Failed to register callback information specified by argument fpOnCmd [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - The API should be called only by DiagService
+/// - Call this API, before registering, deleting, checking and acquiring the code.
+/// - Call this API, before registering, deleting, checking and acquiring the DTC information.
+/// - Call this API, before registering, deleting, checking and acquiring the RoB information.
+/// - Call this API, before update all StatusOfDTC.
+/// - This API is a process that is called only once at system startup and should be called with NS_BackupMgr with
+/// Avalability set to TRUE.
+/// - Calls the specified callback function when diag code registration / deletion is executed.
+/// - Calls the specified callback function when DTC information registration / deletion is executed.
+/// - Calls the specified callback function when RoB information registration / deletion is executed.
+/// - You can get message data by calling FrameworkunifiedGetMsgDataOfSize in the callback function.
+/// - message data, a diag code registration / erasure notification structure is set.
+/// \~english @see none
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_InitDiagCode(HANDLE hApp, uint8_t start_kind, CbFuncPtr fpOnCmd);
+
+/// \~english Setting of diag code registration mask information
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_SetDiagCodeMask
+/// \~english @par Overview
+/// - Perform diag code registration mask setting.
+/// \~english @param [in] onoff Diag code registration mask setting
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Diag code registration mask setting is invalid [DGCODE_RET_ERROR]
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - Failure occurs when write data to the backup area [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - The API should be called only by DiagService
+/// - Set the registration mask of the diag code. If + B OFF, the setting information is held. (Initial state,
+/// registration mask OFF)
+/// - If diag code registration mask setting is ON, when Diag_PutDiagCode,
+/// Diag_PutDiagCode_Custom of the diag code registration API is called,
+/// do not register diag code and register FF data.
+/// \~english @see Diag_PutDiagCode, Diag_PutDiagCode_Custom
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_SetDiagCodeMask(uint8_t onoff);
+
+/// \~english Synchronization of time stamp information
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_SyncTimeStamp
+/// \~english @par Overview
+/// - Synchronize time stamp information.
+/// \~english @param [in] time_cnt time counter
+/// \~english @param [in] trip_cnt Trip counter
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - Failure occurs when export data from backup area [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - The API should be called only by DiagService
+/// - Updates the time stamp information held by the library with the value of the specified time counter and
+/// Trip counter.
+/// - The diagnosis service should synchronize the time counter and Trip counter with this API when time
+/// information from the time master is received.
+/// - However, if any of the time counter and Trip counter specified in the argument is Fail value,
+/// do not perform synchronization processing and and update the time stamp information with Fail value.
+/// \~english @see DGC_TIMESTAMP_GETTIME
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_SyncTimeStamp(uint32_t time_cnt, uint16_t trip_cnt);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_SyncDcmTime
+/// \~english @par Brief
+/// - Synchronize Hour information.
+/// \~english @param [in] hour_info Hour information
+/// - #DGCODE_SSR_INFO_TIME_INFO : SSR infomation (Time infomation for SSR, Time infomation for RoB)
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The pointer of Hour information is NULL [#DGCODE_RET_PARA_ERR]
+/// - Initialization of diagcode management information is fail [#DGCODE_RET_ERROR]
+/// - Get mutex failed [#DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Detail
+/// - This API should be called only by DiagService.
+/// - Updates the Hour information held by the library with the value of the specified Hour information.
+/// - DiagService should synchronize Hour information with this API,
+/// when DiagService received the Hour information from the DCM.
+/// - If any of Hour information specified is Fail value,
+/// do not perform synchronization processing, and update the Hour information with Fail value(0xFF).
+/// \~english @see None
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_SyncDcmTime(const DGCODE_SSR_INFO_TIME_INFO * const hour_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_SyncOdometer
+/// \~english @par Overview
+/// - Synchronize odo meter information.
+/// \~english @param [in] mileage accumulative mileage
+/// \~english @param [in] unit odo unit
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The accumulative mileage is invalid (mileage > 999,999) [\ref DGCODE_RET_PARA_ERR]
+/// - Initialization of diagcode management information is fail [\ref DGCODE_RET_ERROR]
+/// - Failure occurs when export data from backup area [\ref DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - The API should be called only by DiagService
+/// - Updates the odo meter information held by the library with the value of the specified accumulative mileage
+/// and odo unit.
+/// - The diagnosis service should synchronize the accumulative mileage and odo unit with this API when time
+/// information from the odo meter is received.
+/// \~english @see None
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_SyncOdometer(const uint32_t mileage, const uint8_t unit);
+
+/// \~english Inhibit diag code register
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_InhibitPutDiagCode
+/// \~english @par Overview
+/// - Inhibit diag code register.
+/// \~english @param none
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - The initialization of diag memory is finished.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - Get mutex failed [DGCODE_RET_ERROR]
+/// - The diag code's inhibit flag has not been initialized [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - The API should be called only by DiagService
+/// - Diag code register inhibit.
+/// \~english @see none
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_InhibitPutDiagCode(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_PutDTCInfo
+/// \~english @par Overview
+/// - Register of DTC info.
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] dtc_id DTC ID\n
+/// Use diag code definition defined in DIAGCODE.h.\n
+/// \~english @param [in] test_result StatusOfDTC\n
+/// testFailed(bit0 not Failed:0 Failed:1)\n
+/// \~english @param [in] ssr_info SSR data info
+/// \~english @param [in] spply_code Supplementary code
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - Diagcode mask is unset.
+/// - BackupMgr is available
+/// - PFDRECThread is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of DTC management information is fail [DGCODE_RET_ERROR]
+/// - DTC ID does not match the defination of DTC ROM table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the DTC ROM table is invalid [DGCODE_RET_ERROR]
+/// - The communication unit ID(division) in the DTC ROM table is
+/// none device(#DGCODE_DIV_UNIT_NONE) [DGCODE_RET_ERROR]
+/// - Allocation of work memory fails when writing the DTC. [DGCODE_RET_ERROR]
+/// - Failure occurs when reading data from backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when writing to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when writing to the backup area [DGCODE_RET_ERROR]
+/// - Communication unit is not _CWORD92_ or other device when registering individual Diag Code. [DGCODE_RET_PARA_ERR]
+/// - The pointer of DTC inhibit info is NULL [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync x Sync
+/// \~english @par Details
+/// - Register DTC info.
+/// - When register development diag code for supplier, set the DTC ID assigned to supplier.
+/// - Register MM DiagRecord, too.
+/// - But if the register mask of DTC is set ON, this API returns DGCODE_RET_NORMAL
+/// not registering the DTC info.
+/// - diag_code sets the following bit of StatusOfDTC.\n
+/// bit1:testFailedThisOperationCycle\n
+/// bit2:pendingDTC\n
+/// bit3:confirmedDTC\n
+/// bit4:testNotCompletedSinceLastClear\n
+/// bit5:testFailedSinceLastClear\n
+/// bit6:testNotCompletedThisOperationCycle\n
+/// - diag_code sets TimeStamp, Odometer and clock time of SSR.
+/// - Treat current position longitude and current latitude of SSR as all 0 in this API.
+/// - Set supplementary code if it is need.
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_PutDTCInfo(const HANDLE hApp, const uint64_t dtc_id, const uint8_t test_result,
+ const DGCODE_DTC_SSR_INFO* ssr_info,
+ const uint16_t spply_code);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_PutRoBInfo
+/// \~english @par Overview
+/// - Register of RoB info.
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] rob_id RoB ID\n
+/// Use diag code definition defined in DIAGCODE.h.\n
+/// \~english @param [in] ssr_info SSR data info
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - Diagcode mask is unset.
+/// - BackupMgr is available
+/// - PFDRECThread is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of RoB management information is fail [DGCODE_RET_ERROR]
+/// - RoB ID does not match the defination of RoB ROM table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the RoB ROM table is invalid [DGCODE_RET_ERROR]
+/// - The communication unit ID(division) in the RoB ROM table is
+/// none device(#DGCODE_DIV_UNIT_NONE) [DGCODE_RET_ERROR]
+/// - Allocation of work memory fails when writing the diag code. [DGCODE_RET_ERROR]
+/// - Failure occurs when read data from backup area [DGCODE_RET_ERROR]
+/// - Failure occur when write to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when write to the backup area [DGCODE_RET_ERROR]
+/// - The pointer of RoB inhibit info is NULL [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync x Sync
+/// \~english @par Details
+/// - Register RoB info.
+/// - When register development diag code for supplier, set the RoB ID assigned to supplier.
+/// - Register MM DiagRecord, too.
+/// - But if the register mask of Diag Code is set ON, this API returns DGCODE_RET_NORMAL
+/// not registering the RoB info.
+/// - Set SSR info related RoB ID to SSR data info(SSR info not related RoB ID is unnecessary).\n
+/// diag_code sets TimeStamp, Odometer and clock time of SSR.
+/// - Treat current position longitude and current latitude of SSR as all 0 in this API.
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_PutRoBInfo(const HANDLE hApp, const uint64_t rob_id, const DGCODE_ROB_SSR_INFO* ssr_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_DeleteDTCInfo
+/// \~english @par Overview
+/// - Delete specified DTC.
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] err_id DTC detail info
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - PFDRECThread is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - The param[err_id] do not match the defination in the diagcode ROM table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the diagcode ROM table is invalid [DGCODE_RET_ERROR]
+/// - If the communication unit ID(division) is other in the diagcode ROM table,
+/// and failure occur when getting unit number. [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Fire and Forget only
+/// \~english @par Details
+/// - For the latest diag which has been registered, do the erase procedure due to the fact that the DTC is initialized.
+/// - If diagcode which specified is not registered, return DGCODE_RET_NORMAL.
+/// - Register removal DTC to MM Diag Record.
+/// - Delete SSR information,too.
+/// - Delete status of DTC, too.
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_DeleteDTCInfo(const HANDLE hApp, const uint64_t err_id);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_GetDTCInfoList_CWORD29_
+/// \~english @par Overview
+/// - Get the List of specified DTC
+/// \~english @param [in] get_info Get info of DTC list
+/// - #DGCODE_GET_DTC_LIST_INFO : DTC list acquisition setting structure
+/// \~english @param [out] list_info List info of DTC
+/// - #DGCODE_DTC_LIST_INFO : DTC list information structure
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - The initialization of diag memory is finished.
+/// - BackupMgr is available
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The pointer get_info of acquisition setting is NULL [DGCODE_RET_PARA_ERR]
+/// - The pointer list_info of storage area is NULL [DGCODE_RET_PARA_ERR]
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - The flag of diag registration start is not OK yet(The function of diagcode is not prepared yet).
+/// [DGCODE_RET_ERROR]
+/// - The acquirement kind(diagcode) is invalid [DGCODE_RET_PARA_ERR]
+/// - Common Diagnosis When the Diag code definition Name acquired from the memory
+/// error table do not match the definition of the diagcode ROM Table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the diag code ROM talble is not valid [DGCODE_RET_ERROR]
+/// - If the acquisition type is development or service and the division ID is other than the self device and
+/// other devices [DGCODE_RET_PARA_ERR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - Get the DTC list of conditions specified by get_info.
+/// - Acquisition type must be set to diag code type definition value.
+/// - StatusOfDTC information must be set to StatusOfDTC of getting DTC.\n
+/// Targeting bit of StatusOfDTC information that is 1, this API gets DTC
+/// that every target bit of StatusOfDTC is also 1.\n
+/// Examples of getting DTC, when StatusOfDTC information is set 0b00100111 : 0b00101111、0b00100111
+/// - Category ID must be set to category ID definition.
+/// - If category ID is other than DGCODE_DIV_UNIT__CWORD92_, error registered device physical address must be set.
+/// - If category ID is DGCODE_DIV_UNIT__CWORD92_, error registered device physical address is not used,
+/// and thus an arbitary value may be set.
+/// - Logic unit number for maker diag must be set DGCODE_MAKER_UNIT_ALL.
+/// - All DTC that matches above condition store in list_info(list_info is variable length).
+/// - The maximum number of DTC that can be acquired at a time is 64.
+/// - By setting any value from 0 to 255 as the DTC acquisition start index position,
+/// 64 DTC can be acquired from that position.\n
+/// To acquire from Nth DTC, N-1 should be set.\n
+/// example : If the number of previous acquisitions is 64 and "DTC acquisition start index position" is
+/// set to 64, DTC from 65th to 128th can be acquired.
+/// - When the number of items remaining from DTC acquisition start index position to set
+/// the last registered DTC is less than 64, only the remaining items are acquired.
+/// example : If the case where 100 items of DTC are registered , when 64 is set
+/// as the "DTC acquisition start index position", 36 items from 65th to 100th can be acquired.
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_GetDTCInfoList_CWORD29_(const DGCODE_GET_DTC_LIST_INFO* const get_info,
+ DGCODE_DTC_LIST_INFO* const list_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_DeleteDTCInfoList
+/// \~english @par Overview
+/// - Delete the list of specified DTC.
+/// \~english @param [in] del_info Deletion info of DTC list
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available.
+/// - The initialization of diag memory is finished.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The pointer del_info of acquisition setting is NULL [DGCODE_RET_PARA_ERR]
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - The flag of diag registration start is not OK yet(The function of diagcode is not prepared yet).
+/// [DGCODE_RET_ERROR]
+/// - Failure occurs when read data from the backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when write data to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when export data from backup area. [DGCODE_RET_ERROR]
+/// - When the Category ID is invalid [DGCODE_RET_PARA_ERR]
+/// - Register error of own device at all deletion Device physical address is invalid [DGCODE_RET_PARA_ERR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - Delete the list of specified DTC by Category ID.
+/// - Delete SSR information,too.
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_DeleteDTCInfoList(const DGCODE_DELETE_DTC_INFO* const del_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_DeleteRoBInfo
+/// \~english @par Overview
+/// - Set the diagcode detail info and delete the diagcode.
+/// \~english @param [in] hApp Application handle
+/// \~english @param [in] rob_id RoB detail info
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// - PFDRECThread is available
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - The param[rob_id] do not match the defination in the diagcode ROM table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the diagcode ROM table is invalid [DGCODE_RET_ERROR]
+/// - If the communication unit ID(division) is other in the diagcode ROM table,
+/// and failure occur when getting unit number. [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Fire and Forget only
+/// \~english @par Details
+/// - For the RoB which has been registered, do the erase procedure due to the fact that the RoB is initialized.
+/// - If diagcode which specified is not registered, return DGCODE_RET_NORMAL.
+/// - Delete SSR information,too.
+///
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_DeleteRoBInfo(const HANDLE hApp, const uint64_t rob_id);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_GetRoBInfoList
+/// \~english @par Overview
+/// - Get the List of specified RoB
+/// \~english @param [in] get_info Get info of RoB list
+/// \~english @param [out] list_info List info of RoB
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - The initialization of diag memory is finished.
+/// - BackupMgr is available
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The pointer get_info of acquisition setting is NULL [DGCODE_RET_PARA_ERR]
+/// - The pointer list_info of storage area is NULL [DGCODE_RET_PARA_ERR]
+/// - Initialization of RoB code management information is fail [DGCODE_RET_ERROR]
+/// - The flag of diag registration start is not OK yet(The function of RoB code is not prepared yet).
+/// [DGCODE_RET_ERROR]
+/// - When the acquisition type is other than "RoB code type definition" [DGCODE_RET_PARA_ERR]
+/// - Common Diagnosis When the RoB code definition Name acquired from the memory
+/// error table do not match the definition of the RoB code ROM Table [DGCODE_RET_PARA_ERR]
+/// - The communication unit ID(division) in the RoB code ROM table is not valid [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - Get the RoB list of conditions specified by get_info.
+/// - Acquisition type must be set to RoB code type definition value.
+/// - Category ID must be set DGCODE_DIV_UNIT__CWORD92_.
+/// - Error registered device physical address is not used, and thus an arbitary value may be set.
+/// - Logic unit number for maker diag must be set DGCODE_MAKER_UNIT_ALL.
+/// - For the RoB code, set the "RoB code" described in the diag code generation tool of the RoB
+/// to be acquired.
+/// - When the RoB code is #DGCODE_GET_ALL_ROB_CODE, the latest RoB is acquired one of the registered RoB
+/// for each RoB define.
+/// - When th RoB code is other than #DGCODE_GET_ALL_ROB_CODE,
+/// the list of RoB matching the RoB code is acquired.
+/// - All DTC that matches above conditions store in list_info(list_info is variable length).
+/// - The maximum number of RoB that can be acquired at a time is 64.
+/// - By setting any value from 0 to 255 as the RoB acquisition start index position,
+/// 64 RoB can be acquired from that position.\n
+/// To acquire from Nth RoB, N-1 should be set.\n
+/// example : If the number of previous acquisitions is 64 and "RoB acquisition start index position" is
+/// set to 64, RoB from 65th to 128th can be acquired.
+/// - When the number of items remaining from RoB acquisition start index position to set
+/// the last registered RoB is less than 64, only the remaining items are acquired.
+/// example : If the case where 100 items of RoB are registered , when 64 is set
+/// as the "RoB acquisition start index position", 36 items from 65th to 100th can be acquired.
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_GetRoBInfoList(const DGCODE_GET_ROB_LIST_INFO* const get_info,
+ DGCODE_ROB_LIST_INFO* const list_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_GetDIDList
+/// \~english @par Overview
+/// - Get DID list which relates DTC/RoB code.
+/// \~english @param [in] code DTC or RoB
+/// \~english @param [out] list structure of DID list
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - None.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - Parameter of list is NULL. [\ref DGCODE_RET_PARA_ERR]
+/// - DTC or RoB is associated parameter of code is not exist. [\ref DGCODE_RET_ERROR]
+/// - Initialization of diagcode management information is fail [\ref DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - Return DID list which is associated parameter of DTC or RoB.
+/// \~english @see None
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_GetDIDList(const uint64_t code, DGCODE_DID_LIST* const list);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_DeleteRoBInfoList
+/// \~english @par Overview
+/// - Delete the list of specified RoB.
+/// \~english @param [in] del_info Deletion info of RoB code list
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @retval DGCODE_RET_PARA_ERR Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available.
+/// - The initialization of diag memory is finished.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - The pointer del_info of acquisition setting is NULL [DGCODE_RET_PARA_ERR]
+/// - Initialization of diagcode management information is fail [DGCODE_RET_ERROR]
+/// - The flag of diag registration start is not OK yet(The function of diagcode is not prepared yet).
+/// [DGCODE_RET_ERROR]
+/// - Failure occurs when read data from the backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when write data to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when export data from backup area. [DGCODE_RET_ERROR]
+/// - When the Category ID is invalid [DGCODE_RET_PARA_ERR]
+/// - Register error of own device at all deletion Device physical address is invalid [DGCODE_RET_PARA_ERR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - Delete the list of specified RoB by Category ID.
+/// - Delete SSR information,too.
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_DeleteRoBInfoList(const DGCODE_DELETE_ROB_INFO* const del_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_StartupAllStatusOfDTC
+/// \~english @par Overview
+/// - Update all StatusOfDTC for startup of OperationCycle.
+/// \~english @param none
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - DTC ID does not match the defination of DTC ROM table [DGCODE_RET_ERROR]
+/// - Allocation of work memory fails when update the StatusOfDTC. [DGCODE_RET_ERROR]
+/// - Failure occurs when reading data from backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when writing to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when writing to the backup area [DGCODE_RET_ERROR]
+/// - The pointer of DTC inhibit info is NULL [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - This API should be called only by SystemManager.
+/// - Update all StatusOfDTC for startup of OperationCycle.
+/// - This API sets the following bit of StatusOfDTC.\n
+/// bit0:testFailed is set to '0'.\n
+/// bit1:testFailedThisOperationCycle is set to '0'.\n
+/// bit2:pendingDTC is set to '0' only when bit1 and bit6 (before update) are both '0'.\n
+/// bit6:testNotCompletedThisOperationCycle is set to '1'.
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_StartupAllStatusOfDTC(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Diag_ClearAllStatusOfDTC
+/// \~english @par Overview
+/// - Update all StatusOfDTC when receiving ClearDiagnosticInformation.
+/// \~english @param none
+/// \~english @retval DGCODE_RET_NORMAL Success
+/// \~english @retval DGCODE_RET_ERROR Failure
+/// \~english @par Precondition
+/// - BackupMgr is available
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - DTC ID does not match the defination of DTC ROM table [DGCODE_RET_ERROR]
+/// - Allocation of work memory fails when update the StatusOfDTC. [DGCODE_RET_ERROR]
+/// - Failure occurs when reading data from backup area [DGCODE_RET_ERROR]
+/// - Failure occurs when writing to the backup area [DGCODE_RET_ERROR]
+/// - The sum value is invalid when writing to the backup area [DGCODE_RET_ERROR]
+/// - The pointer of DTC inhibit info is NULL [DGCODE_RET_ERROR]
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync only(None communication)
+/// \~english @par Details
+/// - This API should be called only by DiagService.
+/// - Update all StatusOfDTC for startup of OperationCycle.
+/// - This API sets the following bit of StatusOfDTC.\n
+/// bit0:testFailed is set to '0'.\n
+/// bit1:testFailedThisOperationCycle is set to '0'.\n
+/// bit2:pendingDTC is set to '0'.\n
+/// bit3:confirmedDTC is set to '0'.\n
+/// bit4:testNotCompletedSinceLastClear is set to '1'.\n
+/// bit5:testFailedSinceLastClear is set to '0'.\n
+/// bit6:testNotCompletedThisOperationCycle is set to '1'.
+/// \~english @ref DIAGCODE.h
+///
+/////////////////////////////////////////////////////////////////////////////////////
+DGCODE_RET_API Diag_ClearAllStatusOfDTC(void);
+
+/// \~english Acquire time counter value
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DGC_TIMESTAMP_GETTIME
+/// \~english @par Overview
+/// - This is a macro definition for extracting the time counter value included in the time counter information.
+/// \~english @param [in] x time counter information
+/// \~english @retval time counter value
+/// \~english @par Precondition
+/// - None.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - None.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - Mask the unique count identification value and return only the time counter value.
+/// \~english @see Diag_SyncTimeStamp
+///
+/////////////////////////////////////////////////////////////////////////////////////
+#define DGC_TIMESTAMP_GETTIME(x) ((x) & (0x00FFFFFFU))
+
+/// \~english Get unique count value
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DGC_TIMESTAMP_GETFLAG
+/// \~english @par Overview
+/// - This is a macro definition for extracting the unique counter identification value included in the time
+/// counter information.
+/// \~english @param [in] x time counter information
+/// \~english @retval unique counter identification value
+/// \~english @par Precondition
+/// - None.
+/// \~english @par Changing internal state
+/// - No change of internal state by this API occurs.
+/// \~english @par Processing failure condition
+/// - None.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @par Details
+/// - Mask the time counter value and return only the unique count identification value.
+/// \~english @see Diag_SyncTimeStamp
+///
+/////////////////////////////////////////////////////////////////////////////////////
+#define DGC_TIMESTAMP_GETFLAG(x) (((x) & (0xE0000000U)) >> (29U))
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of diag_code
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_DIAGCODEAPI_H_
diff --git a/video_in_hal/stub/diag_code/library/include/stub/ss_diag.h b/video_in_hal/stub/diag_code/library/include/stub/ss_diag.h
new file mode 100755
index 0000000..0ba9b74
--- /dev/null
+++ b/video_in_hal/stub/diag_code/library/include/stub/ss_diag.h
@@ -0,0 +1,24 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_SS_DIAG_H_
+#define DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_SS_DIAG_H_
+
+#include <stub/DiagCodeAPI.h>
+
+#define SS_PUTDIAG(hApp, code)
+
+#endif // DIAG_CODE_LIBRARY_INCLUDE_VEHICLE_SERVICE_SS_DIAG_H_
diff --git a/video_in_hal/stub/diag_code/library/libDiagCodeAPI.ver b/video_in_hal/stub/diag_code/library/libDiagCodeAPI.ver
new file mode 100755
index 0000000..ca53e88
--- /dev/null
+++ b/video_in_hal/stub/diag_code/library/libDiagCodeAPI.ver
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# DiagCodeAPILib version script
+#
+{
+ global:
+ ### .text section ###
+ Diag_PutDiagCode;
+ Diag_DeleteDiagCode;
+ Diag_PutDiagCode_Custom;
+ Diag_PutDiagCodeWithSSR_Custom;
+ Diag_DeleteDiagCode_Custom;
+ Diag_DeleteDiagCodeWithSSR_Custom;
+ Diag_CheckExistDiagCode;
+ Diag_GetDiagCodeList;
+ Diag_GetDiagCodeListWithSSR;
+ Diag_DeleteDiagCodeList;
+ Diag_DeleteDiagCodeListWithSSR;
+ Diag_DeleteMakerDiagCodeList;
+ Diag_CheckExistFFData;
+ Diag_GetFFDataList;
+ Diag_DeleteFFDataList;
+
+ Diag_GetServiceCodeNum;
+ Diag_InitDiagCode;
+ Diag_SetDiagCodeMask;
+ Diag_SyncTimeStamp;
+
+ Diag_InhibitPutDiagCode;
+
+ Diag_SubscribeAvailability;
+ Diag_NotifyAvailability;
+ Diag_PutDTCInfo;
+ Diag_PutRoBInfo;
+ Diag_DeleteDTCInfo;
+ Diag_DeleteRoBInfo;
+ Diag_GetDTCInfoList;
+ Diag_GetRoBInfoList;
+ Diag_DeleteDTCInfoList;
+ Diag_DeleteRoBInfoList;
+ Diag_SyncOdometer;
+ Diag_GetDIDList;
+ Diag_StartupAllStatusOfDTC;
+ Diag_ClearAllStatusOfDTC;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/video_in_hal/stub/diag_code/library/src/DiagCodeAPI.cpp b/video_in_hal/stub/diag_code/library/src/DiagCodeAPI.cpp
new file mode 100755
index 0000000..95d9047
--- /dev/null
+++ b/video_in_hal/stub/diag_code/library/src/DiagCodeAPI.cpp
@@ -0,0 +1,202 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <DiagCodeAPI.h>
+
+DGCODE_RET_API Diag_SubscribeAvailability(HANDLE hApp, uint8_t availabilityId) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_NotifyAvailability(uint8_t availabilityId, BOOL bAvailability) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_PutDiagCode(HANDLE hApp, uint64_t err_id, uint16_t diagcode_code) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_DeleteDiagCode(HANDLE hApp, uint64_t err_id, uint16_t diagcode_code) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_PutDiagCode_Custom(HANDLE hApp, DGCODE_MEMINFO_CUSTOM* err_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_PutDTCInfo(const HANDLE hApp, const uint64_t dtc_id, const uint8_t test_result,
+ const DGCODE_DTC_SSR_INFO &ssr_info,
+ const uint16_t spply_code) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_PutRoBInfo(const HANDLE hApp, const uint64_t rob_id, const DGCODE_ROB_SSR_INFO* ssr_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_DeleteDTCInfo(const HANDLE hApp, const uint64_t err_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_DeleteRoBInfo(const HANDLE hApp, const uint64_t rob_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_GetDTCInfoList_CWORD29_(const DGCODE_GET_DTC_LIST_INFO* const get_info,
+ DGCODE_DTC_LIST_INFO* const list_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_GetRoBInfoList(const DGCODE_GET_ROB_LIST_INFO* const get_info,
+ DGCODE_ROB_LIST_INFO* const list_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_DeleteDTCInfoList(const DGCODE_DELETE_DTC_INFO* const del_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_DeleteRoBInfoList(const DGCODE_DELETE_ROB_INFO* const del_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_InitDiagCode(HANDLE hApp, uint8_t start_kind, CbFuncPtr fpOnCmd) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_SetDiagCodeMask(uint8_t onoff) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_SyncTimeStamp(uint32_t time_cnt, uint16_t trip_cnt) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_SyncDcmTime(const DGCODE_SSR_INFO_TIME_INFO * const hour_info) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_SyncOdometer(const uint32_t mileage, const uint8_t unit) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_InhibitPutDiagCode(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_GetDIDList(const uint64_t code, DGCODE_DID_LIST* const list) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_StartupAllStatusOfDTC(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
+
+DGCODE_RET_API Diag_ClearAllStatusOfDTC(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return DGCODE_RET_NORMAL;
+}
diff --git a/video_in_hal/stub/diag_code/library_dummy_dccc/Makefile b/video_in_hal/stub/diag_code/library_dummy_dccc/Makefile
new file mode 100755
index 0000000..6e818df
--- /dev/null
+++ b/video_in_hal/stub/diag_code/library_dummy_dccc/Makefile
@@ -0,0 +1,46 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_SHLIBS = libDiagApiDccc
+
+######### install headers #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += DIAG_API_DCCC.h
+
+######### compiled sources #############
+libDiagApiDccc_SRCS = src/DIAG_API_DCCC.cpp
+
+######### compile switch #############
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+######### add include path #############
+CPPFLAGS += -I./include/stub
+
+######### dynamic linked library path #############
+
+######## CXX Link ###############
+
+######### compiled options #############
+
+######### common mk #############
+include ../../stub.mk
diff --git a/video_in_hal/stub/diag_code/library_dummy_dccc/include/stub/DIAG_API_DCCC.h b/video_in_hal/stub/diag_code/library_dummy_dccc/include/stub/DIAG_API_DCCC.h
new file mode 100755
index 0000000..dc92190
--- /dev/null
+++ b/video_in_hal/stub/diag_code/library_dummy_dccc/include/stub/DIAG_API_DCCC.h
@@ -0,0 +1,109 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*****************************************************************************
+ * @file DIAG_API_DCCC.h
+ * @brief Diagcode feature API defined
+*****************************************************************************/
+
+
+/*****************************************************************************
+ * *********************************
+ * * Diagcode feature API defined *
+ * *********************************
+ *
+ * ** Creation and release considerations **
+ * -Because DiagCode API depends on product specifications, it is created at the product level.
+ *
+ * -Submit and request the created headers and dummy Lib(empty functions defined only for I/F)
+ * from DiagService to BaseSystem and build them from BaseSystem.
+ *
+ * -The century Lib created(not dummy Lib) is built from DiagService.
+ *
+ * ->Since this API is also used in BaseSystem,
+ * the API must be inserted from the BaseSystem built to avoid errors in JointBuild.
+ *
+ * ** Notes on change **
+ * -When modifying a header without cahnging the I/F,
+ * only the header should be submitted to the BaseSystem and requested.
+ *
+ * -Submit header and source code for dummy Lib when the header is modified due to an I/F change.
+ *
+ * -When the legitimate Lib is changed without changing headers and I/F,
+ * no need to submit or request to BaseSystem.
+ *
+*****************************************************************************/
+
+
+#ifndef DIAG_CODE_LIBRARY_DUMMY_DCCC_INCLUDE_VEHICLE_SERVICE_DIAG_API_DCCC_H_
+#define DIAG_CODE_LIBRARY_DUMMY_DCCC_INCLUDE_VEHICLE_SERVICE_DIAG_API_DCCC_H_
+
+#include <native_service/frameworkunified_framework_if.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#define NTFY_DiagService_Availability_DCCC ("DiagService/Availability")
+
+/***********************************************************
+ Enumerated type
+***********************************************************/
+/*! @brief Return value for DiagCode re-checking and clearing feature APIs */
+typedef enum {
+ RET_DIAG_API_DCCC_NORMAL = 0, //!<Success
+ RET_DIAG_API_DCCC_ERROR //!<Error
+} RET_DIAG_API_DCCC;
+
+/***********************************************************
+ Constant
+***********************************************************/
+// Common
+/*! @brief message ID */
+#define MSGID_DIAG_API_DCCC_DELIVERY_ENTRY (0xFF000001) // Delivery registration notice
+#define MSGID_DIAG_API_DCCC_SND_RECHECK (0xFF000002) // Re-assay instruction
+#define MSGID_DIAG_API_DCCC_RET_RECHECK (0xFF000003) // Re-assay completion notice
+#define MSGID_DIAG_API_DCCC_SND_DIAGCODECLR (0xFF000004) // Diag deletion instruction
+#define MSGID_DIAG_API_DCCC_RET_DIAGCODECLR (0xFF000005) // Daig deletion completion notice
+
+/*! @brief Delivery features */
+#define DIAG_API_DCCC_DELIVERY_RECHECK (0x00000001) // Recheck
+#define DIAG_API_DCCC_DELIVERY_DIAGCODECLR (0x00000002) // Diag delete
+#define DIAG_API_DCCC_DELIVERY_ALL (0xFFFFFFFF) // All function
+
+/*! @brief Result of re-assay execution */
+#define DIAG_API_DCCC_RET_RECHECK_SUCCESS (0x00000000) // Recheck successed
+#define DIAG_API_DCCC_RET_RECHECK_ERROR (0x00000001) // Recheck failed
+
+
+/*! @brief Diag deletion result */
+#define DIAG_API_DCCC_RET_DIAGCODECLR_SUCCESS (0x00000000) // Diag deleion successed
+#define DIAG_API_DCCC_RET_DIAGCODECLR_ERROR (0x00000001) // Diag deleion failed
+
+/***********************************************************
+ API
+***********************************************************/
+extern RET_DIAG_API_DCCC DIAG_API_DCCC_DeliveryEntry(HANDLE hApp, PCSTR notifyName, u_int32_t delivery);
+extern RET_DIAG_API_DCCC DIAG_API_DCCC_SND_ReCheck(HANDLE hApp, PCSTR notifyName);
+extern RET_DIAG_API_DCCC DIAG_API_DCCC_RET_ReCheck(HANDLE hApp, PCSTR notifyName, u_int32_t status);
+extern RET_DIAG_API_DCCC DIAG_API_DCCC_SND_DiagCodeCLR(HANDLE hApp, PCSTR notifyName);
+extern RET_DIAG_API_DCCC DIAG_API_DCCC_RET_DiagCodeCLR(HANDLE hApp, PCSTR notifyName, u_int32_t status);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // DIAG_CODE_LIBRARY_DUMMY_DCCC_INCLUDE_VEHICLE_SERVICE_DIAG_API_DCCC_H_
diff --git a/video_in_hal/stub/diag_code/library_dummy_dccc/src/DIAG_API_DCCC.cpp b/video_in_hal/stub/diag_code/library_dummy_dccc/src/DIAG_API_DCCC.cpp
new file mode 100755
index 0000000..f1da82b
--- /dev/null
+++ b/video_in_hal/stub/diag_code/library_dummy_dccc/src/DIAG_API_DCCC.cpp
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include <DIAG_API_DCCC.h>
+
+RET_DIAG_API_DCCC DIAG_API_DCCC_DeliveryEntry(HANDLE hApp, PCSTR notifyName, u_int32_t delivery) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DIAG_API_DCCC_NORMAL;
+}
+
+RET_DIAG_API_DCCC DIAG_API_DCCC_SND_ReCheck(HANDLE hApp, PCSTR notifyName) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DIAG_API_DCCC_NORMAL;
+}
+
+RET_DIAG_API_DCCC DIAG_API_DCCC_RET_ReCheck(HANDLE hApp, PCSTR notifyName, u_int32_t status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DIAG_API_DCCC_NORMAL;
+}
+
+RET_DIAG_API_DCCC DIAG_API_DCCC_SND_DiagCodeCLR(HANDLE hApp, PCSTR notifyName) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DIAG_API_DCCC_NORMAL;
+}
+
+RET_DIAG_API_DCCC DIAG_API_DCCC_RET_DiagCodeCLR(HANDLE hApp, PCSTR notifyName, u_int32_t status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DIAG_API_DCCC_NORMAL;
+}
+
diff --git a/video_in_hal/stub/diag_record/LICENSE b/video_in_hal/stub/diag_record/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/stub/diag_record/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/stub/diag_record/Makefile b/video_in_hal/stub/diag_record/Makefile
new file mode 100755
index 0000000..8b85cd9
--- /dev/null
+++ b/video_in_hal/stub/diag_record/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := library_record_api library_dummy_drec library_record_thread
+
+include ../stub.mk
diff --git a/video_in_hal/stub/diag_record/library_dummy_drec/Makefile b/video_in_hal/stub/diag_record/library_dummy_drec/Makefile
new file mode 100755
index 0000000..e96152c
--- /dev/null
+++ b/video_in_hal/stub/diag_record/library_dummy_drec/Makefile
@@ -0,0 +1,48 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_SHLIBS = libMM_DREC_API
+
+######### install headers #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += MM_DREC_API.h
+
+######### compiled sources #############
+libMM_DREC_API_SRCS = src/MM_DREC_API.cpp
+
+######### compile switch #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/stub
+CPPFLAGS += -I./../library_record_api/include
+
+LDFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######## CXX Link ###############
+LINK_SHLIB=Y
+
+######### compiled options #############
+LDFLAGS += -Wl,--no-as-needed
+
+######### common mk #############
+include ../../stub.mk
diff --git a/video_in_hal/stub/diag_record/library_dummy_drec/include/stub/MM_DREC_API.h b/video_in_hal/stub/diag_record/library_dummy_drec/include/stub/MM_DREC_API.h
new file mode 100755
index 0000000..7d0568c
--- /dev/null
+++ b/video_in_hal/stub/diag_record/library_dummy_drec/include/stub/MM_DREC_API.h
@@ -0,0 +1,2203 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/////////////////////////////////////////////////////////////////////////////
+/// \file MM_DREC_API.h
+/////////////////////////////////////////////////////////////////////////////
+
+/*****************************************************************************
+ * @file MM_DREC_API.h
+ * @brief MM diag recorder function API definition
+*****************************************************************************/
+
+
+/*****************************************************************************
+ * ---------------
+ * - Die-Record Function API Operation -
+ * ---------------
+ *
+ * $$ Notes on Creation and Release $$
+ * - Submit and request the created headers and dummy libs (empty functions defined only for I/F)
+ * from DiagService to BaseSystem and build them from BaseSystem.
+ *
+ * - The created regular Lib (not dummy Lib) is built from DiagService.
+ *
+ * -> Since this API is also used in BaseSystem, the API must be inserted
+ * from the BaseSystem build to avoid errors in JointBuild.
+ *
+ * $$ Notes on change $$
+ * - When modifying a header without changing the I/F, submit and request only the header to the BaseSystem.
+ *
+ * - Submit header and source code for dummy Lib when the header is modified due to an I/F change.
+ *
+ * - When the legitimate lib is changed without changing headers and I/F, no need to submit or request to BaseSystem.
+ *
+ *****************************************************************************/
+
+#if !defined( __MM_DREC_API_H__ )
+#define __MM_DREC_API_H__
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <stub/PFDREC_API.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/***********************************************************
+ Macro Functions
+***********************************************************/
+#define ENDIAN16(val) \
+ (((val << 8) & 0xFF00) | ((val >> 8) & 0x00FF)) //!< \~english ENDIAN conversion(16bit)
+
+#define ENDIAN32(val) \
+ ((val << 24) & 0xFF000000) | ((val << 8) & 0x00FF0000) | ((val >> 8) & 0x0000FF00) | ((val >> 24) & 0x000000FF) //!< \~english ENDIAN conversion(32bit)
+
+/***********************************************************
+ Data Frame/Size Definition
+***********************************************************/
+
+/***********************************************************
+ Data Frame Related/Structure (Common)
+***********************************************************/
+/**
+ * \~english ACC OFF information
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_ACC;
+
+/**
+ * \~english GPS time information
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_GPS;
+
+/**
+ * \~english Frame for searching recording stop and start
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_REC;
+
+/**
+ * \~english Common data frame
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_COMMON_DATAFRAME;
+
+/***********************************************************
+ Data Frame/Structure Definition
+***********************************************************/
+
+/**
+ * \~english Power trace data frame
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCPWR;
+
+/**
+ * \~english Power trace data frame_system time attached
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCPWR_WITHSYSTIME;
+
+/**
+ * \~english Mode control/vehicle signal trace (mode control)
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCMODE;
+
+/**
+ * \~english Mode control/vehicle signal trace (vehicle signal)
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCVEHICLESIGNAL;
+
+/**
+ * \~english Key trace
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCKEY;
+
+/**
+ * \~english Key trace (key information for 23byte)
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCKEY_EXP;
+
+/**
+ * \~english Key trace(voice operation)
+ */
+typedef struct _T_DREC_TRCKEY_VOICE {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCKEY_VOICE;
+
+/**
+ * \~english Error trace
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCERR;
+
+/**
+ * \~english CAN communication trace
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCCAN;
+
+/**
+ * \~english AW Trace data (trace output of the own car position difference/ Monitoring trace log output of the distributed application PF/ Usage trace log output of the distributed application PF/ Trace output of DSRC/ETC communication)
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCAWDATA;
+
+/**
+ * \~english Bluetooth trace
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCBTCONNECT;
+
+/**
+ * \~english Bluetooth trace
+ */
+typedef struct _T_DREC_TRCBTINTERNAL {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCBTINTERNAL;
+
+/**
+ * \~english Bluetooth trace
+ */
+typedef struct _T_DREC_TRCBT {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCBT;
+
+/**
+ * \~english SSID information
+ */
+typedef struct _T_DREC_TRCWIFI_SSID_INFO {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCWIFI_SSID_INFO;
+
+/**
+ * \~english WiFi trace
+ */
+typedef struct _T_DREC_TRCWIFI {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCWIFI;
+
+/**
+ * \~english Trace data of the version information
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCVERSION;
+
+/**
+ * \~english Trace of the radio wave receipt
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCWAVE;
+
+/**
+ * \~english GPS information
+ */
+typedef struct {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCGPS;
+
+/**
+ * \~english ETC watch log trace
+ */
+typedef struct _T_DREC_TRCETCWATCH {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCETCWATCH;
+
+/**
+ * \~english ROB log trace
+ */
+typedef struct _T_DREC_TRCROB {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCROB;
+
+/**
+ * \~english Optical beacon down-link information trace
+ */
+typedef struct _T_DREC_TRCOPTBEACON_DOWN_LINK {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCOPTBEACON_DOWN_LINK;
+
+/**
+ * \~english Optical beacon up-link information trace
+ */
+typedef struct _T_DREC_TRCOPTBEACON_UP_LINK {
+ /*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+} T_DREC_TRCOPTBEACON_UP_LINK;
+
+/***********************************************************
+ Enumeration definitions
+***********************************************************/
+
+/**
+ * \~english Diag record API return value
+ */
+typedef enum {
+ RET_DREC_NORMAL = 0, //!< \~english Normal end
+ RET_DREC_ERROR, //!< \~english Abnormal end
+ RET_DREC_ERR_ARGUMENTS, //!< \~english Incorrect argument
+} RET_DREC_API;
+
+/**
+ * \~english Diag record ACC state
+ */
+typedef enum {
+ E_DREC_ACC_OFF = 0, //!< \~english ACC OFF
+ E_DREC_ACC_ON, //!< \~english ACC ON
+} E_DREC_ACC;
+
+/**
+ * \~english Diag recording function state
+ */
+typedef enum {
+ E_DREC_REC_OFF = 0, //!< \~english Recording stop
+ E_DREC_REC_ON //!< \~english Recording start
+} E_DREC_REC;
+
+/**
+ * \~english Maker peculiarity trace output state
+ */
+typedef enum {
+ DREC_OUTPUT_STATE_START = 1, //!< \~english Output start
+ DREC_OUTPUT_STATE_END, //!< \~english Output end
+} DREC_OUTPUT_STATE;
+
+/**
+ * \~english Maker peculiarity trace output result
+ */
+typedef enum {
+ DREC_OUTPUT_NOTIFY_OK = 0, //!< \~english OK
+ DREC_OUTPUT_NOTIFY_NG, //!< \~english NG
+} DREC_OUTPUT_RESULT;
+
+/**
+ * \~english Maker peculiarity trace function state
+ */
+typedef enum {
+ DREC_OUTPUT_FUNC_ON = 0, //!< \~english Function ON
+ DREC_OUTPUT_FUNC_OFF, //!< \~english Function OFF
+} DREC_OUTPUT_FUNC;
+
+/**
+ * \~english Maker peculiarity trace notification restrict
+ */
+typedef enum {
+ DREC_NOTIFY_RESTRICT_API, //!< \~english restrict API
+ DREC_NOTIFY_RESTRICT_CAN, //!< \~english restrict CAN
+ DREC_NOTIFY_RESTRICT_NONE, //!< \~english non-restrict
+} DREC_NOTIFY_RESTRICT;
+
+/***********************************************************
+ Constant
+***********************************************************/
+#define DREC_COM_GPS_ID_CORD 0xF0 //!< \~english GPS time information identification code
+#define DREC_COM_RECORD_STOP 0xF1 //!< \~english Recording stop
+#define DREC_COM_RECORD_START 0xF2 //!< \~english Recording start
+
+/***********************************************************
+ API
+***********************************************************/
+/** @addtogroup ApplicationManagement
+ * @{
+ */
+/** @addtogroup Vehicle
+ * @ingroup ApplicationManagement
+ * @{
+ */
+/** @addtogroup Diag
+ * @ingroup Vehicle
+ * @{
+ */
+/** @addtogroup Diag_DrecOperate
+ * @ingroup Diag
+ * @{
+ */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_ChangeRecording
+/// \~english @par Brief
+/// Instruct the record function start/stop and write the start/stop information.
+/// \~english @param [in] state
+/// \ref E_DREC_REC - Function start/stop state
+/// \~english @par
+/// - Set either in the following "Diag recording function states" for the argument (state) (Function start/stop state)
+/// \~english @code
+/// Diag recording function states
+/// E_DREC_REC_OFF : Recording stop
+/// E_DREC_REC_ON : Recording start
+/// @endcode
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @par Prerequisite
+/// - \ref PFDREC_OpenSession must be called prior to calling this API.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// The log output of Diag Record is output in the following format by calling this API.\n
+/// \n
+/// < Function ON >\n
+/// Record "Recording start information" in each trace data. Notify the function start of the recording function to BaseSystem.\n
+/// Register GPS time information from Diag service by \ref DREC_WriteTrcGPS.\n
+/// \n
+/// < Function OFF >\n
+/// Record "Recording stop information" in each trace data. Notify the function stop of the recording function to BaseSystem.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_ChangeRecording(E_DREC_REC state);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_AccOffOn
+/// \~english @par Brief
+/// Write ACCOFF time information to the memory at ACC OFF.
+/// \~english @param [in] state
+/// \ref E_DREC_ACC - ACCOFFON (reset) state
+/// \~english @par
+/// - Set either in the following "Diag record ACC state" for the argument (state) (ACCOFFON (reset) state)
+/// \~english @code
+/// Diag record ACC state
+/// E_DREC_ACC_OFF : ACC OFF
+/// E_DREC_ACC_ON : ACC ON
+/// @endcode
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Wrapper executes the following processes by calling this API. \n
+/// This API must be called when this Diag service detects FrameworkunifiedOnStop. (Called only by the service having Diag recorder function.) \n
+/// Wrapper writes ACCOFF information in each trace file. \n
+/// Wrapper writes #power OFF state by the power trace output based on the notification from SYS. \n
+/// Wrapper writes GPS time at Function OFF and at ACCOFF (reset) in preparation for a case that GPS time information cannot be acquired at the start up. \n
+/// Wrapper does not reaquire GPS time if valid GPS time cannot be acquired at the startup. \n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_AccOffOn(E_DREC_ACC state);
+/** @}*/ // end of Diag_DrecOperate
+/** @addtogroup Diag_DrecWriteTrc
+ * @ingroup Diag
+ * @{
+ */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcPwr
+/// \~english @par Brief
+/// Write the power trace output information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCPWR* - Pointer to the power trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the power trace output information to the memory.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcPwr(T_DREC_TRCPWR* data, u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcPwr_Tick
+/// \~english @par Brief
+/// Write the power trace output information to the memory (tick specification exists).
+/// \~english @param [in] data
+/// \ref T_DREC_TRCPWR_WITHSYSTIME* - Pointer to the power trace data (with the system time)
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @param [in] tick
+/// u_int32_t - TICK value of the current SYS internal
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the power trace output information to the memory (tick specification exists).
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcPwr_Tick(T_DREC_TRCPWR_WITHSYSTIME* data,
+ u_int32_t num, u_int32_t tick);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcMode
+/// \~english @par Brief
+/// Write the mode control parts of the mode control/vehicle signal trace output information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCMODE* - The pointer to mode management trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the mode control parts of the mode control/vehicle signal trace output information to the memory.\n
+/// The system time is gotten by wrapper library and added.\n
+/// This API adds the vehicle signal state fixed at 0xFF.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcMode(T_DREC_TRCMODE* data, u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcVehicleSignal
+/// \~english @par Brief
+/// Write the vehicle signal parts of the mode control/vehicle signal trace output information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCVEHICLESIGNAL* - Pointer to the vehicle signal trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the vehicle signal parts of the mode control/vehicle signal trace output information to the memory.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcVehicleSignal(T_DREC_TRCVEHICLESIGNAL* data,
+ u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcKey
+/// \~english @par Brief
+/// Write the key trace output information to the memory (for 11byte key information).
+/// \~english @param [in] data
+/// \ref T_DREC_TRCKEY* - The pointer to key trace data (Key information for 11 bytes)
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the key trace output information to the memory (for 11byte key information).\n
+/// (The caller uses only when size of the key information is 11 bytes. For data which it is 27 bytes, the caller uses \ref DREC_WriteTrcKey_Exp .)\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcKey_Exp
+/// \~english @par Brief
+/// Write the key trace output information to the memory (for 23byte key information).
+/// \~english @param [in] data
+/// \ref T_DREC_TRCKEY_EXP* - The pointer to key trace data (Key information for 23 bytes)
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 50)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the key trace output information to the memory (for 23byte key information).\n
+/// (For data which key information is 11 bytes, the caller uses \ref DREC_WriteTrcKey .)\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcKey_Exp(T_DREC_TRCKEY_EXP* data,
+ u_int32_t num);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcKey_Voice
+/// \~english @par Brief
+/// Write the voice trace output information to the memory(for voice operation).
+/// \~english @param[in] data
+/// T_DREC_TRCKEY_VOICE* - The pointer to key trace data()
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @par
+/// Number of written frames (1 to 50)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the voice trace output information to the memory(for voice operation).
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcKey_Voice(T_DREC_TRCKEY_VOICE* data,
+ u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcErr
+/// \~english @par Brief
+/// Write the error trace output information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCERR* - The pointer to error trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DIAG_API_DCCC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the error trace output information to the memory.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcErr(T_DREC_TRCERR* data, u_int32_t num);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcCan
+/// \~english @par Brief
+/// Write CAN communication trace output information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCCAN* - Pointer to CAN communication trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @param [in] tick
+/// u_int32_t - TICK value of the current SYS internal
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DIAG_API_DCCC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write CAN communication trace output information to the memory.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcCan(T_DREC_TRCCAN* data, u_int32_t num,
+ u_int32_t tick);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcDeliveryPFWatchLog
+/// \~english @par Brief
+/// Write the monitoring trace log output information of the distributed application PF to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCAWDATA* - The pointer to monitoring log data of the distribution application PF
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the monitoring trace log output information of the distributed application PF to the memory.\n
+/// The library side adds the system time. The caller must call for each segment of data.\n
+/// The library side adds the system time to the beginning of the data and ALL 0 to from the head of the remaining data to 3 bytes.\n
+/// This API adds the system time to the beginning with a single call and regarding data exceeding one frame, divides and registers it.\n
+/// The caller must not call some headers and data record parts together. (Because system time can not be added for each section.)\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcDeliveryPFWatchLog(T_DREC_TRCAWDATA* data);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcDeliveryPFUseLog
+/// \~english @par Brief
+/// Write the usage trace log output information of the distributed application PF to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCAWDATA* - The pointer to usage log data of the distribution application PF
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the usage trace log output information of the distributed application PF to the memory.\n
+/// The library side adds the system time. The caller must call for each segment of data.\n
+/// The library side adds the system time to the beginning of the data and ALL 0 to from the head of the remaining data to 3 bytes.\n
+/// This API adds the system time to the beginning with a single call and regarding data exceeding one frame, divides and registers it.\n
+/// The caller must not call some headers and data record parts together. (Because system time can not be added for each section.)\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcDeliveryPFUseLog(T_DREC_TRCAWDATA* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcBT
+/// \~english @par Brief
+/// Write the trace output information of Bluetooth to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCBT* - The pointer to write data
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of Bluetooth to the memory.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcBT(T_DREC_TRCBT* data, u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcBTInternal
+/// \~english @par Brief
+/// (Only in the specific Supplier) Write the trace output information of Bluetooth internal to the memory.
+/// \~english @param [in] data
+/// u_int8_t* - The pointer to write data
+/// \~english @param [in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// This API is API for specific supplier.(TECHWG-443)\n
+/// Write the trace output information of Bluetooth internal to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcBTInternal(u_int8_t* data,
+ u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcWiFi
+/// \~english @par Brief
+/// Write the trace output information of WiFi to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCWIFI* - The pointer to write data
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of WiFi to the memory.\n
+/// \ref T_DREC_TRCWIFI Structure\n
+/// Data frame format are different by setting value of WiFi setting state.\n
+/// WiFi Setting state( \ref T_DREC_TRCWIFI.processing )\n
+/// - Connection(0x00), Auto connection(0x01) and Disconnection(0x02) data format definition \ref notinitialdata used.\n
+/// - Creation Mode(0x03) and Deletion Mode((0x04)) data format definition \ref modedata used.\n
+/// - Initial is activation(0x10) format definition \ref initialdata used.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcWiFi(T_DREC_TRCWIFI* data, u_int32_t num);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcWiFiInternal
+/// \~english @par Brief
+/// (Only in the specific Supplier) Write the trace output information of WiFi internal to the memory.
+/// \~english @param [in] data
+/// u_int8_t* - The pointer to write data
+/// \~english @param [in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// This API is API for specific supplier.(TECHWG-443)\n
+/// Write the trace output information of WiFi internal to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcWiFiInternal(u_int8_t* data, u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcCenter
+/// \~english @par Brief
+/// Write the trace output information of the communication with the center to the memory.
+/// \~english @param [in] data
+/// u_int8_t* - The pointer to write data
+/// \~english @param [in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of the communication with the center to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcCenter(u_int8_t* data, u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcVersion
+/// \~english @par Brief
+/// Write the trace output information of the version information to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCVERSION* - Pointer to the Trace data of the version information
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 25)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of the version information to the memory.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcVersion(T_DREC_TRCVERSION* data,
+ u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcDCM
+/// \~english @par Brief
+/// Write the trace output information of DCM communication to the memory.
+/// \~english @param [in] data
+/// u_int8_t* - The pointer to write data
+/// \~english @param [in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of DCM communication to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcDCM(u_int8_t* data, u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcDSRC
+/// \~english @par Brief
+/// Write the trace output information of DSRC/ETC communication to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCAWDATA* - The pointer to DSRC/ETC communication trace data
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of DSRC/ETC communication to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcDSRC(T_DREC_TRCAWDATA* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrc_CWORD17_
+/// \~english @par Brief
+/// Write the trace output information of _CWORD5_ communication to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCCAN* - Pointer to the _CWORD5_ communication trace data
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @param [in] tick
+/// u_int32_t - TICK value of the current SYS internal
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of _CWORD5_ communication to the memory.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrc_CWORD17_(T_DREC_TRCCAN* data, u_int32_t num,
+ u_int32_t tick);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcWave
+/// \~english @par Brief
+/// Write the trace output information of the radio wave receipt to the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCWAVE* - The pointer to trace data of the electric wave reception
+/// \~english @param [in] num
+/// u_int32_t - Number of written frames (1 to 100)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of the radio wave receipt to the memory.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcWave(T_DREC_TRCWAVE* data, u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcUSB
+/// \~english @par Brief
+/// Write the trace output information of USB I/F connected application internal to the memory.
+/// \~english @param [in] data
+/// u_int8_t* - The pointer to wrire data
+/// \~english @param [in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of USB I/F connected application internal to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcUSB(u_int8_t* data, u_int32_t size);
+
+
+/** @}*/ // end of Diag_DrecWriteTrc
+/** @addtogroup Diag_DrecOperate
+ * @ingroup Diag
+ * @{
+ */
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_GetRecordSize
+/// \~english @par Brief
+/// Acquire the number of Diag record registration whose type is specified.
+/// \~english @param [in] type
+/// \ref E_PFDREC_CATEGORY_TYPE - Type to acquire the record size
+/// \~english @param [out] num
+/// u_int32_t * - Pointer to the number of registered records.
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - \ref PFDREC_OpenSession must be called prior to calling this API.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (num) is NULL. [RET_DREC_ERROR]
+/// - The argument (type) is not the defined value. [RET_DREC_ERROR]
+/// - The caller is not calling \ref PFDREC_OpenSession in advance. [RET_DREC_ERROR]
+/// - Message synchronous communication (FrameworkunifiedInvokeSync) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Acquire the number of record registration whose type is specified.\n
+/// In BaseSystem, returns the number of records of the specified type. \n
+/// The caller determines the total size with the number of records and each record length.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_GetRecordSize(E_PFDREC_CATEGORY_TYPE type,
+ u_int32_t *num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_GetRecordData
+/// \~english @par Brief
+/// Acquire the registered Diag record whose type is specified.
+/// \~english @param [in] type
+/// \ref E_PFDREC_CATEGORY_TYPE - Type to acquire the record size (\ref E_PFDREC_CATEGORY_TRC_PWR - ref E_PFDREC_CATEGORY_TRC_TRAF )
+/// \~english @param [in] num
+/// u_int32_t - The number of records to acquire (1 to 100)
+/// \~english @param [in] record_ptr
+/// u_int32_t - The start point of the record to acquire
+/// \~english @param [out] data
+/// u_int8_t *- Pointer to the storage area for the record to acquire
+/// \~english @param [out] out_num
+/// u_int32_t *- Pointer to the size of the stored record
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - \ref PFDREC_OpenSession must be called prior to calling this API.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (data) is NULL [RET_DREC_ERROR]
+/// - The argument (out_num) is NULL [RET_DREC_ERROR]
+/// - The argument (type) is not the defined value [RET_DREC_ERROR]
+/// - The argument (num) is 0 or greater than 100. [RET_DREC_ERROR]
+/// - The caller is not calling \ref PFDREC_OpenSession in advance. [RET_DREC_ERROR]
+/// - Message synchronous communication (FrameworkunifiedInvokeSync) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Acquire the record whose type is specified. \n
+/// In BaseSystem, acquire the records of the specified type and the specified number. In this case, the caller specifies from which number of record is acquired.\n
+/// The caller is supposed to acquire data in order from the beginning in several batches.\n
+/// When the number of record requested to acquire is more than that of registered records, acquire the registered number only and returns it. \n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_GetRecordData(E_PFDREC_CATEGORY_TYPE type,
+ u_int32_t num, u_int32_t record_ptr,
+ u_int8_t *data, u_int32_t *out_num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_GetRecordState
+/// \~english @par Brief
+/// Acquire the start/stop state of the record function.
+/// \~english @param [out] state
+/// \ref E_DREC_REC* - Pointer to the start/stop state of the record function.
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - \ref PFDREC_OpenSession must be called prior to calling this API.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (state) is NULL [RET_DREC_ERROR]
+/// - The caller is not calling \ref PFDREC_OpenSession in advance. [RET_DREC_ERROR]
+/// - Message synchronous communication (FrameworkunifiedInvokeSync) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Acquire the start/stop state of the record function.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_GetRecordState(E_DREC_REC* state);
+/** @}*/ // end of Diag_DrecOperate
+/** @addtogroup Diag_DrecOperate
+ * @ingroup Diag
+ * @{
+ */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_SetSysemTimeDifference
+/// \~english @par Brief
+/// Set the system time difference.
+/// \~english @param [in] data
+/// u_int32_t - System time difference
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Store the system time difference in the shared memory.\n
+/// Reflect the stored value in the addition process of the system time.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_SetSysemTimeDifference(u_int32_t data);
+/** @}*/ // end of Diag_DrecOperate
+/** @addtogroup Diag_DrecWriteTrc
+ * @ingroup Diag
+ * @{
+ */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcGPS
+/// \~english @par Brief
+/// Set GPS time information to each trace data.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCGPS* - Pointer to the GPS information
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Set the GPS time information \n
+/// The target is all trace outputs belonging to the unit in which this API is called. \n
+/// When registering the trace data in BaseSystem, regarding the key trace, GPS information is separately passed as the argument (The second argument of PFDREC_ComDataBuckup).\n
+/// After Function ON, when a valid GPS time can be acquired after ACCON, the Diag service must register it.\n
+/// During Function ON, when a valid GPS time cannot be acquired, retry must be performed until the acquired time is registered.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcGPS(T_DREC_TRCGPS* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcUSBETC
+/// \~english @par Brief
+/// Write USB log information of DSRC/ETC communication trace output into the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCAWDATA* - The pointer to DSRC/ETC communication trace data
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write USB log information of DSRC/ETC communication trace output into the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcUSBETC(T_DREC_TRCAWDATA* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcUplink
+/// \~english @par Brief
+/// Write the uplink log information of DSRC/ETC communication trace output into the memory.
+/// \~english @param [in] data
+/// \ref T_DREC_TRCAWDATA* - The pointer to DSRC/ETC communication trace data
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the uplink log information of DSRC/ETC communication trace output into the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcUplink(T_DREC_TRCAWDATA* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcETCWatch
+/// \~english @par Brief
+/// Write trace output of the ETC watch to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCETCWATCH* - Pointer to the trace data of the ETC watch.
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the monitoring trace output information of the ETC to the memory.\n
+/// \ref T_DREC_TRCETCWATCH structure\n
+/// Data format is different by device type / frame type( \ref T_DREC_TRCETCWATCH.frameType )\n
+/// 0:ETC status notification log \n
+/// 1:ETC latest charge notification log \n
+/// 2:ETC operation response log \n
+/// Use the \ref T_DREC_TRCETCWATCH.command format destination.\n
+/// 3:ETC communication log \n
+/// Use the \ref T_DREC_TRCETCWATCH.com_command format destination.\n
+/// 4:Diag Clear event log \n
+/// 5:Diagnosis detection event log \n
+/// 6:Diagnosis recovery event log \n
+/// Use the \ref T_DREC_TRCETCWATCH.diag format destination.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcETCWatch(T_DREC_TRCETCWATCH* data,
+ u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcRoB
+/// \~english @par Brief
+/// Write the trace output information of RoB log to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCROB* - The pointer to write data
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the trace output information of RoB log to the memory.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcRoB(T_DREC_TRCROB* data,
+ u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcEvaluation
+/// \~english @par Brief
+/// Write the evaluation trace output information to the memory.
+/// \~english @param[in] data
+/// u_int8_t* - The pointer to write data
+/// \~english @param[in] size
+/// u_int32_t - Data size (1 to 1200bytes)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the evaluation trace output information to the memory.\n
+/// The log output of Diag Record is output in the following format.\n
+/// This API registers system time from Byte1 to 3.\n
+/// As there is data reserved for each format, this API registers the value defined in the wrapper layer at Byte4\n
+/// so that it does not overlap with that data.\n
+/// This API registers specified data after Byte5.\n
+/// Regarding data exceeding 12 bytes at a time, this API divides records and registers it.\n
+/// Regarding data after Byte13, this API registers 0x00 from Byte1 to 4 and registers the specified data after Byte5.\n
+/// It is filled with 0x00 if the data is less than 16 bytes.\n
+/// This API adds the system time to the beginning with a single call.\n
+/// Regarding data exceeding one frame, this API divides and registers it.\n
+/// The caller must not call some data by connecting them. (Because system time can not be added for each section.)\n
+/// (The format is optional for the manufacturer.)
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcEvaluation(u_int8_t* data,
+ u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_DeleteTrcDeliveryPFUseLog
+/// \~english @par Brief
+/// Delete the trace of distribution application PF usage log.
+/// \~english @param None
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - \ref PFDREC_OpenSession must be called prior to calling this API.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (func) is NULL [RET_DREC_ERROR]
+/// - The caller is not calling \ref PFDREC_OpenSession in advance. [RET_DREC_ERROR]
+/// - Message synchronous communication (FrameworkunifiedInvokeSync) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Delete the trace of distribution application PF usage log.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_DeleteTrcDeliveryPFUseLog(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_DeleteTrcDeliveryPFUseLog_inSession
+/// \~english @par Brief
+/// Delete the trace of distribution application PF usage log.
+/// - Execute "Session start(\ref PFDREC_OpenSession)" before the deletion.
+/// - Execute "Session termination(\ ref PFDREC_CloseSession)" after the deletion.
+/// \~english @param None
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - \ref PFDREC_OpenSession failed. [RET_DREC_ERROR]
+/// - \ref PFDREC_CloseSession failed. [RET_DREC_ERROR]
+/// - Message synchronous communication (FrameworkunifiedInvokeSync) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Execute "Session starti(\ref PFDREC_OpenSession)" before the deletion.\n
+/// Delete the trace of distribution application PF usage log \n
+/// Execute "Session termination(\ref PFDREC_CloseSession)" after the deletion. \n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_DeleteTrcDeliveryPFUseLog_inSession(HANDLE hThread);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcOptBeaconDownLink
+/// \~english @par Brief
+/// Write Optical beacon down-link information trace to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCOPTBEACON_DOWN_LINK* - Pointer to the trace data of the Optical beacon down-link information.
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the Optical beacon down-link information trace to the memory.\n
+/// \ref T_DREC_TRCOPTBEACON_DOWN_LINK structure\n
+/// Data format is different by rcv type( \ref T_DREC_TRCOPTBEACON_DOWN_LINK.rcvkind )\n
+/// 01h : Route signal information \n
+/// Use the \ref T_DREC_TRCOPTBEACON_DOWN_LINK.downlinkinfo format destination.\n
+/// 02h : Lack route signal information\n
+/// 03h : No route signal information \n
+/// Use the \ref T_DREC_TRCOPTBEACON_DOWN_LINK.rcvgpspositioningdata format destination.\n
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcOptBeaconDownLink(
+ T_DREC_TRCOPTBEACON_DOWN_LINK* data, u_int32_t num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_WriteTrcOptBeaconUpLink
+/// \~english @par Brief
+/// Write Optical beacon up-link information trace to the memory.
+/// \~english @param[in] data
+/// T_DREC_TRCOPTBEACON_UP_LINK* - Pointer to the trace data of the Optical beacon up-link information.
+/// \~english @param[in] num
+/// u_int32_t - Number of written frames
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of PFDRECThread is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Write the Optical beacon up-link information trace to the memory.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_WriteTrcOptBeaconUpLink(T_DREC_TRCOPTBEACON_UP_LINK* data,
+ u_int32_t num);
+
+/** @}*/ // end of Diag_DrecWriteTrc
+/** @addtogroup Diag_Drec_MakerTrace
+ * @ingroup Diag
+ * @{
+ */
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_DeliveryEntry
+/// \~english @par Brief
+/// Register the delivery destination application for Maker peculiarity trace
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Registers the handle and thread name for the delivery destination application in the delivery registration table.\n
+/// The client must call this API on a thread that needs to receive that are related to the Maker peculiarity trace in advance.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_DeliveryEntry(HANDLE hApp,
+ PCSTR notifyName);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_SizeRequest
+/// \~english @par Brief
+/// Request to get record size of Maker peculiarity trace.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Private
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Request to get record size of Maker peculiarity trace to the registered application for delivery.\n
+/// Message ID sended by DiagService is as follows\n
+/// MSGID_DREC_MAKERTRACE_SIZEREQUEST
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_SizeRequest(HANDLE hApp,
+ PCSTR notifyName);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_SizeResponce
+/// \~english @par Brief
+/// Send record size of Maker peculiarity trace to DiagService.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] size
+/// u_int32_t - Data size (Unit: Byte)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Send record size of Maker peculiarity trace to DiagService.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_SizeResponce(HANDLE hApp,
+ PCSTR notifyName,
+ u_int32_t size);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_OutputRequest
+/// \~english @par Brief
+/// Request to output of Maker peculiarity trace.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] output
+/// PCSTR - Output destination
+/// \~english @param[in] state
+/// DREC_OUTPUT_STATE - Status (output start or output stop)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Private
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Request to output of Maker peculiarity trace to the registered application for delivery.\n
+/// Message ID sended by DiagService is as follows\n
+/// MSGID_DREC_MAKERTRACE_OUTPUTREQUEST
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_OutputRequest(HANDLE hApp,
+ PCSTR notifyName,
+ PCSTR output,
+ DREC_OUTPUT_STATE state);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_OutputResponce
+/// \~english @par Brief
+/// Send output status of Maker peculiarity trace to DiagService.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] progress
+/// u_int8_t - Progress rate (0 to 100)
+/// \~english @param[in] state
+/// DREC_OUTPUT_RESULT - Status (OK or NG)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Send output status of Maker peculiarity trace to DiagService.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_OutputResponce(HANDLE hApp,
+ PCSTR notifyName,
+ u_int8_t progress,
+ DREC_OUTPUT_RESULT state);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_DeleteRequest
+/// \~english @par Brief
+/// Request to delete of Maker peculiarity trace.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Private
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Request to delete of Maker peculiarity trace to the registered application for delivery.\n
+/// Message ID sended by DiagService is as follows\n
+/// MSGID_DREC_MAKERTRACE_DELETEREQUEST
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_DeleteRequest(HANDLE hApp,
+ PCSTR notifyName);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_DeleteResponce
+/// \~english @par Brief
+/// Send result of delete Maker peculiarity trace to DiagService.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] state
+/// DREC_OUTPUT_RESULT - Status (OK or NG)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Send result of delete Maker peculiarity trace to DiagService.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_DeleteResponce(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_RESULT state);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_FuncStatusRequest
+/// \~english @par Brief
+/// Request to change function status of Maker peculiarity trace.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] func
+/// DREC_OUTPUT_FUNC - Function status (function ON or ffunction OFF)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Private
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Request to change function status of Maker peculiarity trace to the registered application for delivery.\n
+/// Message ID sended by DiagService is as follows\n
+/// MSGID_DREC_MAKERTRACE_FUNCSTATUSREQUEST
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_FuncStatusRequest(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_FUNC func);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_FuncStatusResponce
+/// \~english @par Brief
+/// Send result of change function status of Maker peculiarity trace to DiagService.
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] state
+/// DREC_OUTPUT_RESULT - Status (OK or NG)
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Send result of change function status of Maker peculiarity trace to DiagService.
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// None
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_FuncStatusResponce(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_RESULT state);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DREC_MakerTrace_NotifyRestrict
+/// \~english @par Brief
+/// Restrict notify of Maker peculiarity trace
+/// \~english @param[in] hApp
+/// HANDLE - The handle for the delivery source application
+/// \~english @param[in] notifyName
+/// PCSTR - The thread name of the delivery source
+/// \~english @param[in] notifyRestrict
+/// DREC_NOTIFY_RESTRICT - Restrict kind of Maker peculiarity trace
+/// \~english @retval RET_DREC_NORMAL Normal end
+/// \~english @retval RET_DREC_ERROR Abnormal end
+/// \~english @retval RET_DREC_ERR_ARGUMENTS Incorrect argument
+/// \~english @par Prerequisite
+/// - This API must be called only when Availability of Diag Service is TRUE.
+/// \~english @par Change of internal state
+/// - The internal state is not changed.
+/// \~english @par Conditions of processing failure
+/// - The argument (notifyName) is NULL. [RET_DREC_ERR_ARGUMENTS]
+/// - Opening the sending message queue (McOpenSender) failed. [RET_DREC_ERROR]
+/// - Sending asynchronous data (McSend) failed. [RET_DREC_ERROR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// Restrict trace notifications triggered by the specified notifyRestrict.
+/// Restrict notification(MessageID) are as follows.
+/// - MSGID_DREC_MAKERTRACE_SIZEREQUEST
+/// - MSGID_DREC_MAKERTRACE_OUTPUTREQUEST
+/// - MSGID_DREC_MAKERTRACE_DELETEREQUEST
+/// - MSGID_DREC_MAKERTRACE_FUNCSTATUSREQUEST
+/// \n
+/// if this API is not called, not restrict(Status is DREC_NOTIFY_RESTRICT_NONE).
+/// \~english @par
+/// - include MM_DREC_API.h
+/// - Library libMM_DREC_API.so
+/// \~english @see
+/// DREC_MakerTrace_FuncStatusRequest, DREC_MakerTrace_DeleteRequest,
+/// DREC_MakerTrace_OutputRequest, DREC_MakerTrace_SizeRequest
+/////////////////////////////////////////////////////////////////////////////////////
+extern RET_DREC_API DREC_MakerTrace_NotifyRestrict(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_NOTIFY_RESTRICT notifyRestrict);
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+/** @}*/ // end of Diag_Drec_MakerTrace
+/** @}*/ // end of Diag
+/** @}*/ // end of Vehicle
+/** @}*/ // end of ApplicationManagement
+#endif // __MM_DREC_API_H__
+
diff --git a/video_in_hal/stub/diag_record/library_dummy_drec/src/MM_DREC_API.cpp b/video_in_hal/stub/diag_record/library_dummy_drec/src/MM_DREC_API.cpp
new file mode 100755
index 0000000..5ecd943
--- /dev/null
+++ b/video_in_hal/stub/diag_record/library_dummy_drec/src/MM_DREC_API.cpp
@@ -0,0 +1,450 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "MM_DREC_API.h"
+
+RET_DREC_API DREC_ChangeRecording(E_DREC_REC state) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_AccOffOn(E_DREC_ACC state) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcPwr(T_DREC_TRCPWR* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcPwr_Tick(T_DREC_TRCPWR_WITHSYSTIME* data, u_int32_t num, u_int32_t tick) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcMode(T_DREC_TRCMODE* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcVehicleSignal(T_DREC_TRCVEHICLESIGNAL* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcKey(T_DREC_TRCKEY* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcKey_Exp(T_DREC_TRCKEY_EXP* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcKey_Voice(T_DREC_TRCKEY_VOICE* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcErr(T_DREC_TRCERR* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcCan(T_DREC_TRCCAN* data, u_int32_t num, u_int32_t tick) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcOwnCarPosition(T_DREC_TRCAWDATA* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcDeliveryPFWatchLog(T_DREC_TRCAWDATA* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcDeliveryPFUseLog(T_DREC_TRCAWDATA* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcBT(T_DREC_TRCBT* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcBTInternal(u_int8_t* data, u_int32_t size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcWiFiInternal(u_int8_t* data, u_int32_t size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcWiFi(T_DREC_TRCWIFI* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcCenter(u_int8_t* data, u_int32_t size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcVersion(T_DREC_TRCVERSION* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcDCM(u_int8_t* data, u_int32_t size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcDSRC(T_DREC_TRCAWDATA* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrc_CWORD17_(T_DREC_TRCCAN* data, u_int32_t num, u_int32_t tick) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcWave(T_DREC_TRCWAVE* data, u_int32_t num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcUSB(u_int8_t* data, u_int32_t size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_GetRecordSize(E_PFDREC_CATEGORY_TYPE type, u_int32_t *num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_GetRecordData(E_PFDREC_CATEGORY_TYPE type, u_int32_t num,
+ u_int32_t record_ptr, u_int8_t *data, u_int32_t *out_num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_GetRecordState(E_DREC_REC* state) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_SetSysemTimeDifference(u_int32_t data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcGPS(T_DREC_TRCGPS* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+
+RET_DREC_API DREC_WriteTrcUSBETC(T_DREC_TRCAWDATA* data)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcUplink(T_DREC_TRCAWDATA* data)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcETCWatch(T_DREC_TRCETCWATCH* data, u_int32_t num)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcRoB(T_DREC_TRCROB* data, u_int32_t num)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcEvaluation(u_int8_t* data, u_int32_t size)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_DeleteTrcDeliveryPFUseLog(void)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_DeleteTrcDeliveryPFUseLog_inSession(HANDLE hThread)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcOptBeaconDownLink(T_DREC_TRCOPTBEACON_DOWN_LINK* data, u_int32_t num)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_WriteTrcOptBeaconUpLink(T_DREC_TRCOPTBEACON_UP_LINK* data, u_int32_t num)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_DeliveryEntry(HANDLE hApp,
+ PCSTR notifyName)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_SizeRequest(HANDLE hApp,
+ PCSTR notifyName)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_SizeResponce(HANDLE hApp,
+ PCSTR notifyName,
+ u_int32_t size)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_OutputRequest(HANDLE hApp,
+ PCSTR notifyName,
+ PCSTR output,
+ DREC_OUTPUT_STATE state)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_OutputResponce(HANDLE hApp,
+ PCSTR notifyName,
+ u_int8_t progress,
+ DREC_OUTPUT_RESULT state)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_DeleteRequest(HANDLE hApp,
+ PCSTR notifyName)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_DeleteResponce(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_RESULT state)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_FuncStatusRequest(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_FUNC func)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_FuncStatusResponce(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_OUTPUT_RESULT state)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
+RET_DREC_API DREC_MakerTrace_NotifyRestrict(HANDLE hApp,
+ PCSTR notifyName,
+ DREC_NOTIFY_RESTRICT notifyRestrict)
+{
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_DREC_NORMAL;
+}
+
diff --git a/video_in_hal/stub/diag_record/library_record_api/Makefile b/video_in_hal/stub/diag_record/library_record_api/Makefile
new file mode 100755
index 0000000..9efbd4f
--- /dev/null
+++ b/video_in_hal/stub/diag_record/library_record_api/Makefile
@@ -0,0 +1,47 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libDiagRecordAPI
+
+######### install headers(*.h) #############
+INST_HEADERS += PFDREC_API.h
+
+######### compiled sources #############
+libDiagRecordAPI_SRCS = DiagRecordAPI.cpp
+
+######### add source path #############
+VPATH += ./include/$(COMPONENT_NAME) ./src
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/stub
+
+######### add compile option #############
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lstdc++
+
+include ../../stub.mk
diff --git a/video_in_hal/stub/diag_record/library_record_api/include/stub/PFDREC_API.h b/video_in_hal/stub/diag_record/library_record_api/include/stub/PFDREC_API.h
new file mode 100755
index 0000000..b4ad71c
--- /dev/null
+++ b/video_in_hal/stub/diag_record/library_record_api/include/stub/PFDREC_API.h
@@ -0,0 +1,975 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file PFDREC_API.h
+ * @brief diag_record API header file
+ */
+/*******************************************************************************
+ * FILE : PFDREC_API.h
+ * SYSTEM : LinuxPF
+ * SUBSYSTEM :
+ * TITLE : Diag record managementfeature include definition
+ ******************************************************************************/
+
+#ifndef DIAG_RECORD_LIBRARY_RECORD_API_INCLUDE_VEHICLE_SERVICE_PFDREC_API_H_
+#define DIAG_RECORD_LIBRARY_RECORD_API_INCLUDE_VEHICLE_SERVICE_PFDREC_API_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup diag_record
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <time.h>
+#include <agl_thread.h>
+#include <native_service/frameworkunified_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english The definition of the processing result value
+ */
+typedef int RET_PFDREC_API;
+
+/**
+ * \~english The definition of the diag_record thread
+ */
+#ifndef TN_PFDRECTHREAD
+#define TN_PFDRECTHREAD "PFDRECThread"
+#endif
+
+/**
+ * \~english The definition of the diag_record thread availability.
+ */
+#define NTFY_PFDRECThread_Availability "PFDRECThread/Availability"
+
+/**
+ * \~english The definition of the processing normal result.
+ */
+#define RET_PFDREC_NORMAL (0)
+/**
+ * \~english The definition of the processing abnormal result.
+ */
+#define RET_PFDREC_ERROR (-1)
+/**
+ * \~english The definition of the invalid arguments result.
+ */
+#define RET_PFDREC_ERR_ARGUMENTS (-2)
+/**
+ * \~english The definition of the stop status result.
+ */
+#define RET_PFDREC_STOP (-3)
+
+/**
+ * \~english The definition of the invalid time information
+ */
+#define PFDREC_TIME_INFO_INVALID (0)
+
+/**
+ * \~english The definition of the invalid unique ID
+ */
+#define PFDREC_UNIQUE_INVALID (0xFFFFFFFFFFFFFFFF)
+
+
+/*! @~english The size of the record frame of PWR */
+#define PFDREC_FRAME_SIZE_TRC_PWR (16)
+/*! @~english The size of the record frame of MODE */
+#define PFDREC_FRAME_SIZE_TRC_MODE (16)
+/*! @~english The size of the record frame of KEY */
+#define PFDREC_FRAME_SIZE_TRC_KEY (16)
+/*! @~english The size of the record frame of ERR */
+#define PFDREC_FRAME_SIZE_TRC_ERR (16)
+/*! @~english The size of the record frame of CAN */
+#define PFDREC_FRAME_SIZE_TRC_CAN (16)
+/*! @~english The size of the record frame of DAPS */
+#define PFDREC_FRAME_SIZE_TRC_DAPS (16)
+/*! @~english The size of the record frame of DAPU */
+#define PFDREC_FRAME_SIZE_TRC_DAPU (16)
+/*! @~english The size of the record frame of BT */
+#define PFDREC_FRAME_SIZE_TRC_BT (16)
+/*! @~english The size of the record frame of BT_INTERNAL */
+#define PFDREC_FRAME_SIZE_TRC_BT_INTERNAL (16)
+/*! @~english The size of the record frame of WIFI */
+#define PFDREC_FRAME_SIZE_TRC_WIFI (16)
+/*! @~english The size of the record frame of WIFI_INTERNAL */
+#define PFDREC_FRAME_SIZE_TRC_WIFI_INTERNAL (16)
+/*! @~english The size of the record frame of CENTER */
+#define PFDREC_FRAME_SIZE_TRC_CENTER (16)
+/*! @~english The size of the record frame of VERSION */
+#define PFDREC_FRAME_SIZE_TRC_VERSION (16)
+/*! @~english The size of the record frame of DCM */
+#define PFDREC_FRAME_SIZE_TRC_DCM (16)
+/*! @~english The size of the record frame of ETC */
+#define PFDREC_FRAME_SIZE_TRC_ETC (16)
+
+/*! @~english The size of the record frame of USB_ETC */
+#define PFDREC_FRAME_SIZE_TRC_USB_ETC (16)
+/*! @~english The size of the record frame of DSRC_UPLINK */
+#define PFDREC_FRAME_SIZE_TRC_DSRC_UPLINK (16)
+
+/*! @~english The size of the record frame of _CWORD119_ */
+#define PFDREC_FRAME_SIZE_TRC__CWORD119_ (16)
+/*! @~english The size of the record frame of RADIO */
+#define PFDREC_FRAME_SIZE_TRC_RADIO (16)
+/*! @~english The size of the record frame of USB_UNIT */
+#define PFDREC_FRAME_SIZE_TRC_USB_UNIT (16)
+/*! @~english The size of the record frame of USB_API */
+#define PFDREC_FRAME_SIZE_TRC_USB_API (16)
+/*! @~english The size of the record frame of ETH */
+#define PFDREC_FRAME_SIZE_TRC_ETH (16)
+/*! @~english The size of the record frame of ETC_WATCH */
+#define PFDREC_FRAME_SIZE_TRC_ETC_WATCH (16)
+/*! @~english The size of the record frame of ROB */
+#define PFDREC_FRAME_SIZE_TRC_ROB (16)
+/*! @~english The size of the record frame of EVAL */
+#define PFDREC_FRAME_SIZE_TRC_EVAL (16)
+/*! @~english The size of the record frame of OPT_BEACON_DOWN */
+#define PFDREC_FRAME_SIZE_TRC_OPT_BEACON_DOWN (16)
+/*! @~english The size of the record frame of OPT_BEACON_UP */
+#define PFDREC_FRAME_SIZE_TRC_OPT_BEACON_UP (16)
+
+/**
+ * \~english The definition of the callback function.
+ */
+typedef void (*PFDREC_CALLBACK_FUNC)(RET_PFDREC_API result);
+
+/**
+ * \~english The definition of the record function status
+ */
+typedef enum _E_PFDREC_FUNC {
+ /*! @~english The record function is ON */
+ E_PFDREC_FUNC_ON = 0,
+ /*! @~english The record function is OFF */
+ E_PFDREC_FUNC_OFF
+}E_PFDREC_FUNC;
+
+/**
+ * \~english The definition of the category
+ */
+typedef enum _E_PFDREC_CATEGORY_TYPE {
+ /*! @~english The defination of PWR trace*/
+ E_PFDREC_CATEGORY_TRC_PWR = 0,
+ /*! @~english The defination of MODE trace */
+ E_PFDREC_CATEGORY_TRC_MODE,
+ /*! @~english The defination of KEY trace */
+ E_PFDREC_CATEGORY_TRC_KEY,
+ /*! @~english The defination of ERR trace */
+ E_PFDREC_CATEGORY_TRC_ERR,
+ /*! @~english The defination of CAN trace */
+ E_PFDREC_CATEGORY_TRC_CAN,
+ /*! @~english The defination of DAPS trace */
+ E_PFDREC_CATEGORY_TRC_DAPS,
+ /*! @~english The defination of DAPU trace */
+ E_PFDREC_CATEGORY_TRC_DAPU,
+ /*! @~english The defination of BT trace */
+ E_PFDREC_CATEGORY_TRC_BT,
+ /*! @~english The defination of BT_INTERNAL trace */
+ E_PFDREC_CATEGORY_TRC_BT_INTERNAL,
+ /*! @~english The defination of WIFI trace */
+ E_PFDREC_CATEGORY_TRC_WIFI,
+ /*! @~english The defination of WIFI_INTERNAL trace */
+ E_PFDREC_CATEGORY_TRC_WIFI_INTERNAL,
+ /*! @~english The defination of CENTER trace */
+ E_PFDREC_CATEGORY_TRC_CENTER,
+ /*! @~english The defination of VERSION trace */
+ E_PFDREC_CATEGORY_TRC_VERSION,
+ /*! @~english The defination of DCM trace */
+ E_PFDREC_CATEGORY_TRC_DCM,
+ /*! @~english The defination of ETC trace */
+ E_PFDREC_CATEGORY_TRC_ETC,
+
+ /*! @~english The defination of USB_ETC trace */
+ E_PFDREC_CATEGORY_TRC_USB_ETC,
+ /*! @~english The defination of DSRC_UPLINK trace */
+ E_PFDREC_CATEGORY_TRC_DSRC_UPLINK,
+
+ /*! @~english The defination of _CWORD119_ trace */
+ E_PFDREC_CATEGORY_TRC__CWORD119_,
+ /*! @~english The defination of RADIO trace */
+ E_PFDREC_CATEGORY_TRC_RADIO,
+ /*! @~english The defination of USB_UNIT trace */
+ E_PFDREC_CATEGORY_TRC_USB_UNIT,
+ /*! @~english The defination of USB_API trace */
+ E_PFDREC_CATEGORY_TRC_USB_API,
+ /*! @~english The defination of ETH trace*/
+ E_PFDREC_CATEGORY_TRC_ETH,
+ /*! @~english The defination of ETC_WATCH trace */
+ E_PFDREC_CATEGORY_TRC_ETC_WATCH,
+ /*! @~english The defination of ROB trace */
+ E_PFDREC_CATEGORY_TRC_ROB,
+ /*! @~english The defination of EVAL trace */
+ E_PFDREC_CATEGORY_TRC_EVAL,
+ /*! @~english The defination of OPT_BEACON_DOWN trace */
+ E_PFDREC_CATEGORY_TRC_OPT_BEACON_DOWN,
+ /*! @~english The defination of OPT_BEACON_UP trace */
+ E_PFDREC_CATEGORY_TRC_OPT_BEACON_UP,
+
+ /*! @~english The defination of max value */
+ E_PFDREC_CATEGORY_TRC_MAX
+}E_PFDREC_CATEGORY_TYPE;
+
+/**
+ * \~english The definition of the trace data extraction mode
+ */
+typedef enum _E_PFDREC_EXTRACT_MODE {
+ /*! @~english The extraction mode is OFF */
+ E_PFDREC_EXTRACT_MODE_OFF = 0,
+ /*! @~english The extraction mode is ON */
+ E_PFDREC_EXTRACT_MODE_ON
+}E_PFDREC_EXTRACT_MODE;
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_FuncStartStop
+/// \~english @par Summary
+/// - Switch the ON/OFF status of the record function
+/// \~english @param [in] status The ON/OFF status of the record function\n
+/// Set the one of the following values.\n
+/// E_PFDREC_FUNC_ON(The record function is ON)\n
+/// E_PFDREC_FUNC_OFF(The record function is OFF)\n
+/// See E_PFDREC_FUNC.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - BackupMgr is available.
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument ON/OFF status is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to transmit synchronous message to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When MM Diag Recorder failed to switch the function ON/OFF status. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Start or stop the transmission of record.
+/// - When the function is OFF, no data is executed even if the data recording API is called,
+/// and RET_PFDREC_NORMAL is returned.
+/// - Record the ON/OFF information into the backup memory.
+/// - Restore the retained value to the default E_PFDREC_FUNC_ON at +B OFF / factory shipment.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_FuncStartStop(E_PFDREC_FUNC status);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_DeleteData
+/// \~english @par Summary
+/// - Delete the recorded data.
+/// \~english @param [in] func callback function\n
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument callback function is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the session with the MM Diag Recorder has not been established yet. [RET_PFDREC_ERROR]
+/// - When the callback function of deletion end was already setted. [RET_PFDREC_ERROR]
+/// - When failed to regist the callback information to the dispatcher. [RET_PFDREC_ERROR]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to transmit asynchronous message to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - To delete the data recorded in the temporary buffer and nonvolatile memory.
+/// - The callback function specified by argument will be called when data deletion end.
+/// - typedef void (*DERC_CALLBACK_FUNC)( RET_PFDREC_API result);\n
+/// The deletion result is stored in the argument result when the callback function is called.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Method
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedSendMsg
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_DeleteData(PFDREC_CALLBACK_FUNC func);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_DeleteIndividual
+/// \~english @par Summary
+/// - Delete the individual recorded data.
+/// \~english @param [in] category The category information of the trace data to record\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When the argument category is invalid in MM Diag recorder management information table. [RET_PFDREC_ERROR]
+/// - When the MM Diag Recorder failed to allocate memory for writting the recorded data. [RET_PFDREC_ERROR]
+/// - When failed to write the initialization date to ROM. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - To delete the individual data recorded in the temporary buffer and nonvolatile memory.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_DeleteIndividual(E_PFDREC_CATEGORY_TYPE category);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_ComDataBackup
+/// \~english @par Summary
+/// - Record the trace data.
+/// \~english @param [in] category The category information of the trace data to record\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] time_info The time information.
+/// \~english @param [in] frame_num The number of frames of the trace data to record.
+/// \~english @param [in] data The trace data to record\n
+/// The size of the data buffer is the number of frames * 1 frame size,\n
+/// and should be secured by the caller.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument frame_num is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument frame_num exceeds the upper limit value (100). [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When failed to get the message queue handle for transmission to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// - When failed to the transmit asynchronous message. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Record the trace data into the buffer temporarily, and when the size of data in buffer reaches the maximum,
+/// move the data to ROM firstly.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Fire and Forget
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedAttachCallbackToDispatcher, FrameworkunifiedSendMsg
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_ComDataBackup(E_PFDREC_CATEGORY_TYPE category,
+ time_t time_info,
+ uint32_t frame_num,
+ uint8_t* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_ReadMemData
+/// \~english @par Summary
+/// - Read memory data.
+/// \~english @param [in] category The category information of the trace data to read\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] offset The start position of the frame to read\n
+/// The offset is 0, which means the earliest recorded data.
+/// \~english @param [in] read_num The number of the frames to read.
+/// \~english @param [out] data The readed trace data\n
+/// The size of the data buffer is the number of frames * 1 frame size,\n
+/// and should be secured by the caller.
+/// \~english @param [out] out_num The number of readed trace data.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - The argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - The argument read_num is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument read_num is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument read_num exceeds the upper limit value (100). [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0 [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message. [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When the argument category is invalid in the record management information table of MM Diag recorder.
+/// [RET_PFDREC_ERROR]
+/// - When the MM Diag Recorder failed to allocate memory for reading out the recorded data. [RET_PFDREC_ERROR]
+/// - When the MM Diag Recorder failed in the process of reading the recorded data. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed from the diagnosis service and the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - Read the number of recorded data from the position specified by offset.
+/// - When the end of the recorded data is reached, stop reading and return the number of readed data.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_ReadMemData(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t offset,
+ uint32_t read_num,
+ uint8_t* data,
+ uint32_t* out_num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_GetDataInfo
+/// \~english @par Summary
+/// - Get the information of the recorded data.
+/// \~english @param [in] category The category information\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [out] frame_num The number of the recorded frames.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument frame_num is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message. [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When the argument category is invalid in the record management information table of MM Diag recorder.
+/// [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed from the diagnosis service and the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - Return the number of frames recorded in the record data area of the specified category.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_GetDataInfo(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t* frame_num);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_GetFuncStartStop
+/// \~english @par Summary
+/// - Get the ON/OFF status of the record function.
+/// \~english @param [out] status The ON/OFF status of the record function\n
+/// Set the one of the following values.\n
+/// E_PFDREC_FUNC_ON(The record function is ON)\n
+/// E_PFDREC_FUNC_OFF(The record function is OFF)\n
+/// See E_PFDREC_FUNC.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument ON/OFF status is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to transmit synchronous message to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_GetFuncStartStop(E_PFDREC_FUNC* status);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_OutputData
+/// \~english @par Summary
+/// - Move the recorded data to ROM.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When MM Diag Recorder failed to move the recorded data to ROM. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Move the data recorded in the temporary buffer to the ROM.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_OutputData(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_ReadData
+/// \~english @par Summary
+/// - Read the recorded data from the specified position.
+/// \~english @param [in] category The category information of the trace data to read\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] unique_id The unique ID of the frame to start reading\n
+/// If the unique_id is invalid, return error and do not read.
+/// \~english @param [in] read_num The number of frames to read.
+/// \~english @param [out] data The readed data.\n
+/// The size of the data buffer is the number of frames * 1 frame size,\n
+/// and should be secured by the caller.
+/// \~english @param [out] out_num The number of the readed frames.
+/// \~english @param [out] end_unique_id The unique ID of the end of the readed data.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument out_num is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument end_unique_id is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument unique_id is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument read_num is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument read_num exceeds the upper limit value (100). [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0 [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When the MM Diag Recorder failed in the process of reading the recorded data. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed from the diagnosis service and the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - When the end of the recorded data is reached, stop reading and return the number of readed data.
+/// - Read the number of recorded data from the position specified by unique ID.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_ReadData(E_PFDREC_CATEGORY_TYPE category,
+ uint64_t unique_id,
+ uint32_t read_num,
+ uint8_t* data,
+ uint32_t* out_num,
+ uint64_t* end_unique_id);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_SearchData
+/// \~english @par Summary
+/// - Search the recorded data by the specified time information.
+/// \~english @param [in] category The information of category\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] time_info The time information is used to search in recorded data.\n
+/// If the time information is invalid, to return error and do not search.
+/// \~english @param [out] unique_id The unique ID
+/// \~english @param [out] data The result obtained by searching for the time information.\n
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument unique_id is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When setting search time information is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to trasmite the synchronization message. [RET_PFDREC_ERROR]
+/// - When the length of synchronous communication received is different from the already set length.
+/// [RET_PFDREC_ERROR]
+/// - When the argument category is invalid in MM Diag recorder management information table. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed from the diagnosis service and the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - When the end of the recorded data is reached, stop reading and return the number of readed data.
+/// - If the recorded time information is invalid, to skip searching.\n
+/// Also, to make sure that the input argument time_info(note) is available for searching.\n
+/// (note)"1"(from 1970/1/1/0:00.01) or more.
+/// - The frame data more than the specified time could not be found, or \n
+/// If time_info is invalid, RET_PFDREC_ERROR will be returned.
+/// - For the categories which can be searched by time, see the searchable trace.
+/// - If the specified category is not searchable, RET_PFDREC_ERROR will be returned.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_SearchData(E_PFDREC_CATEGORY_TYPE category,
+ time_t time_info,
+ uint64_t* unique_id,
+ uint8_t* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_OpenSession
+/// \~english @par Summary
+/// - Establish a session with the MM Diag Recorder.
+/// \~english @param [in] h_app The application handle
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument h_app is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - If the message queue handle for transmission is not NULL\n
+/// (when the PFDREC_OpenSession has already been called) [RET_PFDREC_ERROR]
+/// - When failed to generate a message queue handle for transmission. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Establish a session with the MM Diag Recorder.
+/// - The API should be called before calling the following APIs of the MM Diag Record function.\n
+/// PFDREC_FuncStartStop\n
+/// PFDREC_DeleteData\n
+/// PFDREC_ReadMemData\n
+/// PFDREC_GetDataInfo\n
+/// PFDREC_GetFuncStartStop\n
+/// PFDREC_OutputData\n
+/// PFDREC_ReadData\n
+/// PFDREC_SearchData\n
+/// PFDREC_SetExtractionMode\n
+/// PFDREC_SetExtractionMode_Exp\n
+/// PFDREC_SearchDataY2K38\n
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_FuncStartStop, PFDREC_DeleteData, PFDREC_ReadMemData, PFDREC_GetDataInfo, \n
+/// PFDREC_GetFuncStartStop, PFDREC_OutputData, PFDREC_ReadData, PFDREC_SearchData, \n
+/// PFDREC_SetExtractionMode, PFDREC_SetExtractionMode_Exp, PFDREC_SearchDataY2K38, \n
+/// PFDREC_CloseSession, FrameworkunifiedMcOpenSender
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_OpenSession(HANDLE h_app);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_CloseSession
+/// \~english @par Summary
+/// - Release the session with the MM Diag Recorder.
+/// \~english @param [in] h_app The application handle
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - When the session with MM Diag Recorder becomes unnecessary.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument h_app is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to close the message queue transmission handle. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Release the session with the MM Diag Recorder.
+/// - To call the API When the session with MM Diag Recorder becomes unnecessary.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedMcClose
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_CloseSession(HANDLE h_app);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_OverwriteData
+/// \~english @par Summary
+/// - Overwrite and record the data of one frame to the specified offset.
+/// \~english @param [in] category The category information\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] offset The position to overwrite the frame data.\n
+/// The offset is 0, which means the earliest recorded data.
+/// \~english @param [in] data The frame data to be overwrite.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - Whe argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When failed to get the message queue handle for transmission to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// - When failed to the transmit asynchronous message. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Overwrite and record the data of one frame to the specified offset.
+/// - When the frame data specified by offset is not exist, RET_PFDREC_ERROR will be returned.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Fire and Forget
+/// \~english @see McOpenSender, McSend
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_OverwriteData(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t offset,
+ uint8_t* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_SetExtractionMode
+/// \~english @par Summary
+/// - Switch the trace data extraction mode.
+/// \~english @param [in] category The category information\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] mode The information of the trace data extraction mode.\n
+/// See E_PFDREC_EXTRACT_MODE.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument mode is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When MM Diag Recorder failed to switch the trace data extraction mode. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - Switch the trace data extraction mode.
+/// - Save the trace data to the extraction area during the extraction mode is ON.\n
+/// - When the size of the recorded extraction data reaches the maximum,\n
+/// to discard the next data.
+/// - And when the extraction mode switched from ON to OFF, write the data to the temporary buffer are.
+/// - For the categories which the trace data extraction mode is effective,\n
+/// See 3.4.1.2.8 The switchable trace in trace data extraction mode.
+/// - If you specify something other than a valid category, RET_PFDREC_ERROR will be returned.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_SetExtractionMode(const E_PFDREC_CATEGORY_TYPE category,
+ const E_PFDREC_EXTRACT_MODE mode);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_SetExtractionMode_Exp
+/// \~english @par Summary
+/// - Switch the trace data extraction mode.(The AppDataReporting service, which is a supplier-specific service)
+/// \~english @param [in] category The category information\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] mode The information of the trace data extraction mode.\n
+/// See E_PFDREC_EXTRACT_MODE.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument mode is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to the transmit synchronous message [RET_PFDREC_ERROR]
+/// - When the length of the recieved synchronous message is different from the length of the buffer.
+/// [RET_PFDREC_ERROR]
+/// - When MM Diag Recorder failed to switch the trace data extraction mode. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - Switch the trace data extraction mode.
+/// - Save the trace data to the extraction area during the extraction mode is ON.\n
+/// - When the size of the recorded extraction data reaches the maximum,\n
+/// to discard the next data.
+/// - And when the extraction mode switched from ON to OFF, write the data to the temporary buffer are.
+/// - For the categories which the trace data extraction mode is effective,\n
+/// See 3.4.1.2.8 The switchable trace in trace data extraction mode.
+/// - If you specify something other than a valid category, RET_PFDREC_ERROR will be returned.
+/// - If the data recorded is deleted from the diagnosis service, the request data recorded may not be obtained\n
+/// from the AppDataReporting service, which is a supplier-specific service.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_SetExtractionMode_Exp(const E_PFDREC_CATEGORY_TYPE category,
+ const E_PFDREC_EXTRACT_MODE mode);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_ComDataBackupY2K38
+/// \~english @par Summary
+/// - Record the trace data.
+/// \~english @param [in] category The category information of the trace data to record\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] time_info The time information.
+/// \~english @param [in] frame_num The number of frames of the trace data to record.
+/// \~english @param [in] data The trace data to record\n
+/// The size of the data buffer is the number of frames * 1 frame size,\n
+/// and should be secured by the caller.
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument frame_num is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument frame_num exceeds the upper limit value (100). [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When failed to get the message queue handle for transmission to MM Diag Recorder. [RET_PFDREC_ERROR]
+/// - When failed to the transmit asynchronous message. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed only from the diagnosis service.
+/// - The API is used to fix the problem of time beyond 2038, and the function is the same as the
+/// PFDREC_ComDataBackup function
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Fire and Forget
+/// \~english @see PFDREC_OpenSession, McOpenSender, McSend
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_ComDataBackupY2K38(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t time_info,
+ uint32_t frame_num,
+ uint8_t* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PFDREC_SearchDataY2K38
+/// \~english @par Summary
+/// - Search the recorded data by the specified time information
+/// \~english @param [in] category The information of category\n
+/// See E_PFDREC_CATEGORY_TYPE.
+/// \~english @param [in] time_info The time information is used to search in recorded data.\n
+/// If the time information is invalid, to return error and do not search.
+/// \~english @param [out] unique_id The unique ID
+/// \~english @param [out] data The result obtained by searching for the time information.\n
+/// \~english @retval RET_PFDREC_NORMAL Success
+/// \~english @retval RET_PFDREC_ERROR Failure
+/// \~english @retval RET_PFDREC_ERR_ARGUMENTS Invalid parameter
+/// \~english @par Precondition
+/// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+/// - The session with the MM Diag Recorder has been established.
+/// - The availablity of the NTFY_PFDRECThread_Availability is already TRUE.
+/// \~english @par Changes in internal status
+/// - There is no changes in internal status when the API is called.
+/// \~english @par Conditions of processing failure
+/// - When the argument data is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument unique_id is NULL. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When setting search time information is invalid. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the argument category is invalid [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the frame size of the argument category is 0. [RET_PFDREC_ERR_ARGUMENTS]
+/// - When the message queue handle for transmission is NULL. [RET_PFDREC_ERROR]
+/// - When failed to trasmite the synchronization message. [RET_PFDREC_ERROR]
+/// - When the length of synchronous communication received is different from the already set length.
+/// [RET_PFDREC_ERROR]
+/// - When the argument category is invalid in MM Diag recorder management information table. [RET_PFDREC_ERROR]
+/// \~english @par Details
+/// - The API is assumed to be executed from the diagnosis service and the AppDataReporting service,\n
+/// which is a supplier-specific service.
+/// - The API is used to fix the problem that the time more than 2038, \n
+/// and the function is same as the PFDREC_SearchData function.
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - Sync
+/// \~english @see PFDREC_OpenSession, FrameworkunifiedInvokeSync
+///
+/////////////////////////////////////////////////////////////////////////////////////
+RET_PFDREC_API PFDREC_SearchDataY2K38(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t time_info,
+ uint64_t* unique_id,
+ uint8_t* data);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of diag_record
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // DIAG_RECORD_LIBRARY_RECORD_API_INCLUDE_VEHICLE_SERVICE_PFDREC_API_H_
diff --git a/video_in_hal/stub/diag_record/library_record_api/libDiagRecordAPI.ver b/video_in_hal/stub/diag_record/library_record_api/libDiagRecordAPI.ver
new file mode 100755
index 0000000..6ce89fc
--- /dev/null
+++ b/video_in_hal/stub/diag_record/library_record_api/libDiagRecordAPI.ver
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# DiagRecordAPILib version script
+#
+{
+ global:
+ ### .text section ###
+ PFDREC_FuncStartStop;
+ PFDREC_DeleteData;
+
+ PFDREC_DeleteIndividual;
+ PFDREC_ComDataBackup;
+ PFDREC_ReadMemData;
+ PFDREC_GetDataInfo;
+ PFDREC_GetFuncStartStop;
+ PFDREC_OutputData;
+ PFDREC_ReadData;
+ PFDREC_SearchData;
+ PFDREC_OpenSession;
+ PFDREC_CloseSession;
+ PFDREC_OverwriteData;
+ PFDREC_SetExtractionMode;
+ PFDREC_ComDataBackupY2K38;
+ PFDREC_SearchDataY2K38;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/video_in_hal/stub/diag_record/library_record_api/src/DiagRecordAPI.cpp b/video_in_hal/stub/diag_record/library_record_api/src/DiagRecordAPI.cpp
new file mode 100755
index 0000000..b2c5363
--- /dev/null
+++ b/video_in_hal/stub/diag_record/library_record_api/src/DiagRecordAPI.cpp
@@ -0,0 +1,178 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "PFDREC_API.h"
+
+RET_PFDREC_API PFDREC_FuncStartStop(E_PFDREC_FUNC status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_DeleteData(PFDREC_CALLBACK_FUNC func) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_DeleteIndividual(E_PFDREC_CATEGORY_TYPE category) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_ComDataBackup(E_PFDREC_CATEGORY_TYPE category,
+ time_t time_info,
+ uint32_t frame_num,
+ uint8_t* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_ReadMemData(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t offset,
+ uint32_t read_num,
+ uint8_t* data,
+ uint32_t* out_num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_GetDataInfo(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t* frame_num) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_GetFuncStartStop(E_PFDREC_FUNC* status) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_OutputData(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_ReadData(E_PFDREC_CATEGORY_TYPE category,
+ uint64_t unique_id,
+ uint32_t read_num,
+ uint8_t* data,
+ uint32_t* out_num,
+ uint64_t* end_unique_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_SearchData(E_PFDREC_CATEGORY_TYPE category,
+ time_t time_info,
+ uint64_t* unique_id,
+ uint8_t* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+RET_PFDREC_API PFDREC_OpenSession(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_CloseSession(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_OverwriteData(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t offset,
+ uint8_t* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_SetExtractionMode(const E_PFDREC_CATEGORY_TYPE category,
+ const E_PFDREC_EXTRACT_MODE mode) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_SetExtractionMode_Exp(const E_PFDREC_CATEGORY_TYPE category,
+ const E_PFDREC_EXTRACT_MODE mode) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_ComDataBackupY2K38(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t time_info,
+ uint32_t frame_num,
+ uint8_t* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
+
+RET_PFDREC_API PFDREC_SearchDataY2K38(E_PFDREC_CATEGORY_TYPE category,
+ uint32_t time_info,
+ uint64_t* unique_id,
+ uint8_t* data) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return RET_PFDREC_NORMAL;
+}
diff --git a/video_in_hal/stub/diag_record/library_record_thread/Makefile b/video_in_hal/stub/diag_record/library_record_thread/Makefile
new file mode 100755
index 0000000..350cd90
--- /dev/null
+++ b/video_in_hal/stub/diag_record/library_record_thread/Makefile
@@ -0,0 +1,47 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed library(*.a) #############
+INST_LIBS = libPFDRECThread
+
+######### install headers(*.h) #############
+INST_HEADERS += pfdrec_thread_ifc.h
+
+######### compiled sources #############
+libPFDRECThread_SRCS += pfdrec_thread.cpp
+
+######### add source path #############
+VPATH += ./src ./include/$(COMPONENT_NAME)
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/stub
+CPPFLAGS += -I./../library_record_api/include
+
+######### add compile option #############
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lstdc++
+
+include ../../stub.mk
diff --git a/video_in_hal/stub/diag_record/library_record_thread/include/stub/pfdrec_thread_ifc.h b/video_in_hal/stub/diag_record/library_record_thread/include/stub/pfdrec_thread_ifc.h
new file mode 100755
index 0000000..9592939
--- /dev/null
+++ b/video_in_hal/stub/diag_record/library_record_thread/include/stub/pfdrec_thread_ifc.h
@@ -0,0 +1,168 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef DIAG_RECORD_LIBRARY_RECORD_THREAD_INCLUDE_VEHICLE_SERVICE_PFDREC_THREAD_IFC_H_
+#define DIAG_RECORD_LIBRARY_RECORD_THREAD_INCLUDE_VEHICLE_SERVICE_PFDREC_THREAD_IFC_H_
+
+/**
+ * @file pfdrec_thread_ifc.h
+ * @brief diag_record thread header file
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup diag_record
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * @class CPFDRECThread
+ * \~english @brief diag_record thread
+ * \~english @par Brief Introduction
+ * Class to provide the trace data record function
+ *
+ */
+class CPFDRECThread {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CPFDRECThread
+ /// \~english @par Summary
+ /// Constructor of CPFDRECThread class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a CPFDRECThread class. \n
+ /// Member variables initialize. \n
+ /// After the constructor, be sure to call Initialize method.
+ /// \~english @see ~CPFDRECThread, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ CPFDRECThread();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~CPFDRECThread
+ /// \~english @par Summary
+ /// Destructor of CPFDRECThread class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a CPFDRECThread class.
+ /// \~english @see CPFDRECThread
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CPFDRECThread();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Initialize
+ /// \~english @par Summary
+ /// - Initialize diag_record thread.
+ /// \~english @param [in] h_app The application handle
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusFail Failure
+ /// \~english @par Precondition
+ /// - BackupMgr is available.
+ /// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+ /// \~english @par Changes in internal status
+ /// - There is no changes in internal status when the API is called.
+ /// \~english @par Conditions of processing failure
+ /// - When fail to create TN_PFDRECTHREAD. [eFrameworkunifiedStatusFail]
+ /// \~english @par Details
+ /// - The API is assumed to be executed only from the SS_LoggerService.
+ /// - Initialize diag_record thread.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync
+ /// \~english @see FrameworkunifiedCreateChildThread, FrameworkunifiedStartChildThread
+ /////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Initialize(HANDLE h_app);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Finalize
+ /// \~english @par Summary
+ /// - Finalize diag_record thread.
+ /// \~english @param [in] h_app The application handle
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @par Precondition
+ /// - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+ /// - The diag_record thread is running.
+ /// \~english @par Changes in internal status
+ /// - There is no changes in internal status when the API is called.
+ /// \~english @par Conditions of processing failure
+ /// - None
+ /// \~english @par Details
+ /// - The API is assumed to be executed only from the SS_LoggerService.
+ /// - Finalize diag_record thread.
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Sync
+ /// \~english @see FrameworkunifiedStopChildThread
+ /////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Finalize(HANDLE h_app);
+
+ private:
+ EFrameworkunifiedStatus Start(HANDLE h_thread);
+ EFrameworkunifiedStatus Stop(HANDLE h_thread);
+
+ EFrameworkunifiedStatus SetFuncOnOff(HANDLE h_thread);
+ EFrameworkunifiedStatus GetFuncOnOff(HANDLE h_thread);
+ EFrameworkunifiedStatus DeleteData(HANDLE h_thread);
+
+ EFrameworkunifiedStatus DeleteIndividual(HANDLE f_hThread);
+ EFrameworkunifiedStatus ComDataBackup(HANDLE h_thread);
+ EFrameworkunifiedStatus ReadMemData(HANDLE h_thread);
+ EFrameworkunifiedStatus GetDataInfo(HANDLE h_thread);
+ EFrameworkunifiedStatus OutputData(HANDLE h_thread);
+ EFrameworkunifiedStatus ReadData(HANDLE h_thread);
+ EFrameworkunifiedStatus SearchData(HANDLE h_thread);
+ EFrameworkunifiedStatus OverwriteData(HANDLE h_thread);
+ EFrameworkunifiedStatus SetExtractMode(HANDLE h_thread);
+
+ HANDLE m_thread;
+};
+
+/** @}*/ // end of diag_record
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+
+#endif // DIAG_RECORD_LIBRARY_RECORD_THREAD_INCLUDE_VEHICLE_SERVICE_PFDREC_THREAD_IFC_H_
diff --git a/video_in_hal/stub/diag_record/library_record_thread/src/pfdrec_thread.cpp b/video_in_hal/stub/diag_record/library_record_thread/src/pfdrec_thread.cpp
new file mode 100755
index 0000000..164fcfb
--- /dev/null
+++ b/video_in_hal/stub/diag_record/library_record_thread/src/pfdrec_thread.cpp
@@ -0,0 +1,162 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "pfdrec_thread_ifc.h"
+
+CPFDRECThread::CPFDRECThread()
+: m_thread(NULL) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+}
+
+CPFDRECThread::~CPFDRECThread() {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+}
+
+EFrameworkunifiedStatus CPFDRECThread::Initialize(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+
+EFrameworkunifiedStatus CPFDRECThread::Finalize(HANDLE h_app) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+
+EFrameworkunifiedStatus CPFDRECThread::Start(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::Stop(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::SetFuncOnOff(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::GetFuncOnOff(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::DeleteData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::DeleteIndividual(HANDLE hThread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+
+EFrameworkunifiedStatus CPFDRECThread::ComDataBackup(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::ReadMemData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::GetDataInfo(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::OutputData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::ReadData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::SearchData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::OverwriteData(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CPFDRECThread::SetExtractMode(HANDLE h_thread) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/stub/memory_gpio_access_library/LICENSE b/video_in_hal/stub/memory_gpio_access_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/stub/memory_gpio_access_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/stub/memory_gpio_access_library/Makefile b/video_in_hal/stub/memory_gpio_access_library/Makefile
new file mode 100755
index 0000000..f30423a
--- /dev/null
+++ b/video_in_hal/stub/memory_gpio_access_library/Makefile
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+SUBDIRS := client
+
+include ../stub.mk
diff --git a/video_in_hal/stub/memory_gpio_access_library/client/Makefile b/video_in_hal/stub/memory_gpio_access_library/client/Makefile
new file mode 100755
index 0000000..202fce9
--- /dev/null
+++ b/video_in_hal/stub/memory_gpio_access_library/client/Makefile
@@ -0,0 +1,44 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS += libextension
+
+######### install headers(*.h) #############
+INST_HEADERS += el_gpio.h el_mem.h
+
+######### compiled sources #############
+libextension_SRCS += el_gpio.c el_mem.c
+
+######### add source path #############
+VPATH += src
+VPATH += include/stub
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/$(COMPONENT_NAME)
+
+######### add compile option #############
+CPPFLAGS += -std=c++11
+
+######### linked library #############
+
+######### linked library (dynamic) #############
+
+######### add library path #############
+
+
+include ../../stub.mk
diff --git a/video_in_hal/stub/memory_gpio_access_library/client/include/stub/el_gpio.h b/video_in_hal/stub/memory_gpio_access_library/client/include/stub/el_gpio.h
new file mode 100755
index 0000000..a9d5639
--- /dev/null
+++ b/video_in_hal/stub/memory_gpio_access_library/client/include/stub/el_gpio.h
@@ -0,0 +1,802 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file el_gpio.h
+ * @brief el_gpio function header file
+ */
+
+#ifndef MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_GPIO_H_
+#define MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_GPIO_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup memory_gpio_access_library
+ * @ingroup native_service
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stdbool.h>
+
+/**
+ * \~english Definitions of the GPIO Control Symbol
+ */
+enum {
+ EL_GPO_SUB_RST_N = 0 ,
+ EL_GPO_NAVI_DET,
+ EL_GPI_ILG_RST_N,
+ EL_GPI_GPS_INT,
+ EL_GPO_GPS_P_OFF,
+ EL_GPO_CP_RST_N,
+ EL_GPO_TP_RST_N,
+ EL_GPI_SEC_ST1,
+ EL_GPI_SEC_ST0,
+ EL_GPO__CWORD52__RST,
+ EL_GPI__CWORD32__INT,
+ EL_GPO__CWORD32__RST,
+ EL_GPO_XM_RST,
+ EL_GPO_NFC_RST,
+ EL_GPO_USB1_PWEN,
+ EL_GPI_USB1_OVC,
+ EL_GPO__CWORD52__VUP,
+ EL_GPO_WL_EN,
+ EL_GPO_BT_EN,
+ EL_GPO_AVB_RST_N,
+ EL_GPO_SEC_RST_N,
+ EL_SPI_NAVI_REQ,
+ EL_SPI_NAVI_RDY,
+ EL_GPI_USB0_QVC,
+ EL_GPO_USB0_PWE,
+ EL_GPO_GVIFTX1_RST_N,
+ EL_GPO_GVIFTX0_RST_N,
+ EL_GPO_EMMC_ON_N,
+ EL_SPI_GVIF_D_UCS,
+ EL_GPO__CWORD65__RST_N,
+ EL_GPO_GVIFRX_RST_N,
+ EL_GPI_IOEX_INT,
+ EL_GPO_FBRQ,
+ EL_GPO_IOEX_RST_N,
+ EL_GPI_GVIFTX1_GPIO3,
+ EL_GPI_DARC_INT,
+ EL_GPI_GVIFTX0_GPIO3,
+ EL_GPI_GVIF_REQ_INT,
+ EL_GPI_ACC_DET_OUT,
+ EL_GPI_GVIFRX_GPIO3,
+ EL_GPO_DTCP_RST_N,
+ EL_NAVI_NMI_N,
+ EL_GPI_SDPCHK,
+ EL_GPO_XM_SHDN,
+ EL_GPI_GVIF_D_REQ_INT,
+ EL_SPI_GVIF_D_DCS,
+ EL_GPO_EMMC_PU_ON,
+ EL_GPIO_GVIFRX_GPIO0,
+ EL_GPI_GVIFRX_GPIO2,
+ EL_GPI_GVIFRX_LOS,
+ EL_GPIO_GVIFTX0_GPIO0,
+ EL_GPI_GVIFTX0_GPIO2,
+ EL_GPIO_GVIFTX1_GPIO0,
+ EL_GPI_GVIFTX1_GPIO2,
+ EL_GPO_USBHUB_RST,
+ EL_GPI__CWORD65__BOOT_ERR,
+ EL_GPO_CKECNT,
+ EL_GPO_SDPCLR,
+ EL_GPO_SENSOR_RST,
+ EL_GPI_SENSOR_INT,
+ EL_GPO_DAC_MUTE,
+ EL_GPO_DSRC_PON,
+ EL_GPI_2PULSE_REV,
+ EL_GPI_ILL_DET,
+ EL_GPI_DAB_DET,
+ EL_GPI_FAN_DET,
+
+ EL_GPO_SOC_DIAG_OUT,
+ EL_GPI_SOC_DIAG_IN,
+
+ EL_GPIO_SYMBOL_MAX,
+};
+
+/**
+ * \~english Rising level trigger
+ */
+#define EL_GPIO_IRQ_TRIGGER_RISING (0x01)
+
+/**
+ * \~english Falling level trigger
+ */
+#define EL_GPIO_IRQ_TRIGGER_FALLING (0x02)
+
+/**
+ * \~english High level trigger
+ */
+#define EL_GPIO_IRQ_TRIGGER_HIGH (0x04)
+
+/**
+ * \~english Low level trigger
+ */
+#define EL_GPIO_IRQ_TRIGGER_LOW (0x08)
+
+/**
+ * \~english Trigger mask
+ */
+#define EL_GPIO_IRQ_TRIGGER_MASK (EL_GPIO_IRQ_TRIGGER_RISING | \
+ EL_GPIO_IRQ_TRIGGER_FALLING | \
+ EL_GPIO_IRQ_TRIGGER_HIGH | \
+ EL_GPIO_IRQ_TRIGGER_LOW)
+
+/**
+ * \~english None timeout
+ */
+#define EL_GPIO_IRQ_NO_TIMEOUT (-1)
+
+/**\ingroup EL_Gpio_write
+* \~english @par Brief
+* Write data to specified GPIO.
+* \~english @param [in] symbol
+* int - symbol(Definitions of the GPIO Control Symbol)
+* \~english @param [in] value
+* bool - setting value(0 or 1)
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @retval 0 Success
+* \~english @retval -1 Error:Set errno according to error type when error occurs.
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - There is authority to access the specified GPIO, writing data is possiable only\n
+* when GPIO port is an output port.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_read
+*/
+int EL_Gpio_write(int symbol , bool value); // NOLINT[readability/naming]
+
+/** \ingroup EL_Gpio_read
+* \~english @par Brief
+* Read data from specified GPIO.
+* \~english @param [in] symbol
+* int - symbol(Definitions of the GPIO Control Symbol)
+* \~english @param [out] value
+* bool * - setting value
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @retval 0 Success
+* \~english @retval -1 Error:Set errno according to error type when error occurs.
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - Reading data is possiable when there is authority to access the specified GPIO.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_write
+*/
+int EL_Gpio_read(int symbol , bool *value); // NOLINT[readability/naming]
+
+/** \ingroup EL_Gpio_attachInterruptControl
+* \~english @par Brief
+* Register interruption control of specified GPIO.
+* \~english @param [in] symbol
+* int - symbol(Definitions of the GPIO Control Symbol)
+* \~english @param [in] irq_flags
+* unsigned long - Interruption control flag of GPIO.
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @par
+* Interruption control flag of GPIO
+* - EL_GPIO_IRQ_TRIGGER_RISING :Rising level trigger
+* - EL_GPIO_IRQ_TRIGGER_FALLING :Falling level trigger
+* - EL_GPIO_IRQ_TRIGGER_HIGH :High level trigger
+* - EL_GPIO_IRQ_TRIGGER_LOW :Low level trigger
+* \~english @retval 0 Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Flag specified by irq_flags is not defined flag. [-1]
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - Register interruption control of specified GPIO.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_detachInterruptControl
+*/
+int EL_Gpio_attachInterruptControl(int symbol , unsigned long irq_flags); // NOLINT [readability/nolint]
+
+/** \ingroup EL_Gpio_detachInterruptControl
+* \~english @par Brief
+* Detach interruption control of specified GPIO.
+* \~english @param [in] symbol
+* int - symbol(Definitions of the GPIO Control Symbol)
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @retval 0 Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - Detach interruption control of specified GPIO.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_attachInterruptControl
+*/
+int EL_Gpio_detachInterruptControl(int symbol); // NOLINT[readability/naming]
+
+/** \ingroup EL_Gpio_waitInterrupt
+* \~english @par Brief
+* Waiting interruption of specified GPIO occured without timeout.
+* \~english @param [in] symbol
+* int - symbol(Definitions of the GPIO Control Symbol)
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @retval 0 Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - Interruption of specified GPIO was registered by \ref EL_Gpio_attachInterruptControl.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - Waiting interruption of specified GPIO occured without timeout.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_waitInterrupt_timeout
+*/
+int EL_Gpio_waitInterrupt(int symbol); // NOLINT[readability/naming]
+
+/** \ingroup EL_Gpio_waitInterrupt_timeout
+* \~english @par Brief
+* Waiting interruption of specified GPIO with timeout.
+* \~english @param [in] symbol
+* int - Symbol(Definitions of the GPIO Control Symbol)
+* \~english @param [in] timeout
+* int - Timeout of time(unit: jiffies)
+* \~english @par
+* Definitions of the GPIO Control Symbol
+* \~english @code
+* enum {
+* EL_GPO_SUB_RST_N = 0 ,
+* EL_GPO_NAVI_DET,
+* EL_GPI_ILG_RST_N,
+* EL_GPI_GPS_INT,
+* EL_GPO_GPS_P_OFF,
+* EL_GPO_CP_RST_N,
+* EL_GPO_TP_RST_N,
+* EL_GPI_SEC_ST1,
+* EL_GPI_SEC_ST0,
+* EL_GPO__CWORD52__RST,
+* EL_GPI__CWORD32__INT,
+* EL_GPO__CWORD32__RST,
+* EL_GPO_XM_RST,
+* EL_GPO_NFC_RST,
+* EL_GPO_USB1_PWEN,
+* EL_GPI_USB1_OVC,
+* EL_GPO__CWORD52__VUP,
+* EL_GPO_WL_EN,
+* EL_GPO_BT_EN,
+* EL_GPO_AVB_RST_N,
+* EL_GPO_SEC_RST_N,
+* EL_SPI_NAVI_REQ,
+* EL_SPI_NAVI_RDY,
+* EL_GPI_USB0_QVC,
+* EL_GPO_USB0_PWE,
+* EL_GPO_GVIFTX1_RST_N,
+* EL_GPO_GVIFTX0_RST_N,
+* EL_GPO_EMMC_ON_N,
+* EL_SPI_GVIF_D_UCS,
+* EL_GPO__CWORD65__RST_N,
+* EL_GPO_GVIFRX_RST_N,
+* EL_GPI_IOEX_INT,
+* EL_GPO_FBRQ,
+* EL_GPO_IOEX_RST_N,
+* EL_GPI_GVIFTX1_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_DARC_INT,
+* EL_GPI_GVIFTX0_GPIO3,
+* EL_GPI_GVIF_REQ_INT,
+* EL_GPI_ACC_DET_OUT,
+* EL_GPI_GVIFRX_GPIO3,
+* EL_GPO_DTCP_RST_N,
+* EL_NAVI_NMI_N,
+* EL_GPI_SDPCHK,
+* EL_GPO_XM_SHDN,
+* EL_GPI_GVIF_D_REQ_INT,
+* EL_SPI_GVIF_D_DCS,
+* EL_GPO_EMMC_PU_ON,
+* EL_GPIO_GVIFRX_GPIO0,
+* EL_GPI_GVIFRX_GPIO2,
+* EL_GPI_GVIFRX_LOS,
+* EL_GPIO_GVIFTX0_GPIO0,
+* EL_GPI_GVIFTX0_GPIO2,
+* EL_GPIO_GVIFTX1_GPIO0,
+* EL_GPI_GVIFTX1_GPIO2,
+* EL_GPO_USBHUB_RST,
+* EL_GPI__CWORD65__BOOT_ERR,
+* EL_GPO_CKECNT,
+* EL_GPO_SDPCLR,
+* EL_GPO_SENSOR_RST,
+* EL_GPI_SENSOR_INT,
+* EL_GPO_DAC_MUTE,
+* EL_GPO_DSRC_PON,
+* EL_GPI_2PULSE_REV,
+* EL_GPI_ILL_DET,
+* EL_GPI_DAB_DET,
+* EL_GPI_FAN_DET,
+* EL_GPO_SOC_DIAG_OUT,
+* EL_GPI_SOC_DIAG_IN,
+* EL_GPIO_SYMBOL_MAX,
+* };
+* @endcode
+* \~english @retval 0 Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - Interruption of specified GPIO was registered by \ref EL_Gpio_attachInterruptControl .
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - The value of symbol is less than 0 or greater than EL_GPIO_SYMBOL_MAX-1. [-1]
+* - syscall error(open(), ioctl()). [-1]
+* \~english @par Detail
+* - Waiting interruption of specified GPIO with timeout.
+* - If the value of timeout is not greater than 0, timeout will not happened.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see none
+*/
+int EL_Gpio_waitInterrupt_timeout(int symbol, int timeout); // NOLINT[readability/naming]
+
+/** \ingroup EL_Gpio_finalize
+* \~english @par Brief
+* End processing.
+* \~english @retval 0 Return 0
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - none
+* \~english @par Detail
+* - Change IO-Expander device to reset status.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_Gpio_write, EL_Gpio_read
+*/
+int EL_Gpio_finalize(void); // NOLINT[readability/naming]
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+/** @}*/ // end of memory_gpio_access_library
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+#endif // MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_GPIO_H_
diff --git a/video_in_hal/stub/memory_gpio_access_library/client/include/stub/el_mem.h b/video_in_hal/stub/memory_gpio_access_library/client/include/stub/el_mem.h
new file mode 100755
index 0000000..b6f6855
--- /dev/null
+++ b/video_in_hal/stub/memory_gpio_access_library/client/include/stub/el_mem.h
@@ -0,0 +1,396 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file el_mem.h
+ * @brief el_mem function header file
+ */
+
+#ifndef MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_MEM_H_
+#define MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_MEM_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup memory_gpio_access_library
+ * @ingroup native_service
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stdbool.h>
+#include <sys/types.h>
+
+/**
+* \~english Definitions of the Parametar of type
+*/
+enum {
+ EL_MEM_TYPE_REGION_SYS, //!< \~english SYS region
+ EL_MEM_TYPE_REGION_LOG, //!< \~english LOG region
+ EL_MEM_TYPE_REGION_COM, //!< \~english COMMUNICATION region
+ EL_MEM_TYPE_REGION_NAVI, //!< \~english NAVI region
+ EL_MEM_TYPE_REGION_SH4A, //!< \~english SH4A region
+ EL_MEM_TYPE_REGION_PRAMFS, //!< \~english PRAMFS region
+ EL_MEM_TYPE_REGION_STARTUPBGM, //!< \~english STARTUPBGM region
+ EL_MEM_TYPE_REGION_NAVI_IR, //!< \~english NAVI picture recognition region
+ EL_MEM_TYPE_REGION_MAX //!< \~english (internal use)
+};
+
+/**
+* \~english Definitions of the Parametar of memory id
+*/
+enum {
+ // SYS region
+ EL_MEM_ID_SYS_ALL = 0x0001, //!< \~english all SYS region
+ EL_MEM_ID_SYS_BOOT, //!< \~english particular: BOOT region
+
+ // LOG region
+ EL_MEM_ID_LOG_ALL = 0x1001, //!< \~english all LOG region
+
+ // COM region
+ EL_MEM_ID_COM_ALL = 0x2001, //!< \~english all COMMUNICATION region
+ EL_MEM_ID_COM_SH4A, //!< \~english particular: SH4A abnornal observation
+
+ // NAVI region
+ EL_MEM_ID_NAVI_ALL = 0x3001, //!< \~english NAVI region
+ EL_MEM_ID_NAVI_LOG, //!< \~english particular: NAVI(AW) LOG region
+
+ // SH4A region
+ EL_MEM_ID_SH4A_ALL = 0x4001, //!< \~english SH4A region
+ EL_MEM_ID_SH4A_SHM, //!< \~english particular: SH4A SH share memory region
+
+ // PRAMFS region NOTE:Can be used only when ROM operation
+ EL_MEM_ID_PRAMFS_ALL = 0x5001, //!< \~english all PRAMFS region
+
+ // STARTUPBGM region
+ EL_MEM_ID_STARTUPBGM_ALL = 0x6001, //!< \~english all STARTUPBGM region
+
+ // NAVI region (Picture Recognition: For Image Recognition)
+ EL_MEM_ID_NAVI_IR_ALL = 0x7001, //!< \~english all NAVI picture recognition region
+};
+
+/**
+ * \~english Valid cache_flag
+ */
+#define EL_MEM_CACHE_VALID 1
+
+/**
+ * \~english Invalid cache_flag
+ */
+#define EL_MEM_CACHE_INVALID 0
+
+/**\ingroup EL_mem_getOffset
+* \~english @par Brief
+* Get offset of function region according to mem_id.
+* \~english @param [in] mem_id
+* int - memory id
+* \~english @par
+* Defined memory id as follows.
+* \~english @code
+* enum {
+* // SYS
+* EL_MEM_ID_SYS_ALL = 0x0001, // all SYS region
+* EL_MEM_ID_SYS_BOOT, // particular: BOOT region
+* // COM
+* EL_MEM_ID_COM_ALL = 0x2001, // all COMMUNICATION region
+* EL_MEM_ID_COM_SH4A, // particular: SH4A abnornal observation
+* // NAVI
+* EL_MEM_ID_NAVI_ALL = 0x3001, // NAVI region
+* EL_MEM_ID_NAVI_LOG, // particular: NAVI(AW) LOG region
+* // SH4A
+* EL_MEM_ID_SH4A_ALL = 0x4001, // SH4A region
+* EL_MEM_ID_SH4A_SHM, // particular: SH4A SH share memory region
+* // PRAMFS NOTE:ROM only
+* EL_MEM_ID_PRAMFS_ALL = 0x5001, // all PRAMFS region
+* // STARTUPBGM
+* EL_MEM_ID_STARTUPBGM_ALL = 0x6001, // all STARTUPBGM region
+* // NAVI (Image Recognition)
+* EL_MEM_ID_NAVI_IR_ALL = 0x7001, // all NAVI picture recognition region
+* };
+* @endcode
+* \~english @retval offset Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Parameter mem_id is not defined.[-1]
+* \~english @par Detail
+* - Get offset of function region according to mem_id.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see none
+*/
+off_t EL_mem_getOffset(int mem_id); // NOLINT [readability/naming]
+
+/**\ingroup EL_mem_getLength
+* \~english @par Brief
+* Get length of function region according to mem_id.
+* \~english @param [in] mem_id
+* int - memory id
+* \~english @par
+* Defined memory id as follows.
+* \~english @code
+* enum {
+* // SYS
+* EL_MEM_ID_SYS_ALL = 0x0001, // all SYS region
+* EL_MEM_ID_SYS_BOOT, // particular: BOOT region
+* // COM
+* EL_MEM_ID_COM_ALL = 0x2001, // all COMMUNICATION region
+* EL_MEM_ID_COM_SH4A, // particular: SH4A abnornal observation
+* // NAVI
+* EL_MEM_ID_NAVI_ALL = 0x3001, // NAVI region
+* EL_MEM_ID_NAVI_LOG, // particular: NAVI(AW) LOG region
+* // SH4A
+* EL_MEM_ID_SH4A_ALL = 0x4001, // SH4A region
+* EL_MEM_ID_SH4A_SHM, // particular: SH4A SH share memory region
+* // PRAMFS NOTE:ROM only
+* EL_MEM_ID_PRAMFS_ALL = 0x5001, // all PRAMFS region
+* // STARTUPBGM
+* EL_MEM_ID_STARTUPBGM_ALL = 0x6001, // all STARTUPBGM region
+* // NAVI (Image Recognition)
+* EL_MEM_ID_NAVI_IR_ALL = 0x7001, // all NAVI picture recognition region
+* };
+* @endcode
+* \~english @retval length Success
+* \~english @retval 0 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Parameter mem_id is not defined.[0]
+* - syscall error(open(), ioctl()).[0]
+* \~english @par Detail
+* - Get length of function region according to mem_id.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see none
+*/
+size_t EL_mem_getLength(int mem_id); // NOLINT [readability/naming]
+
+/**\ingroup EL_mem_exram_mmap_simple
+* \~english @par Brief
+* Map device file to memory.(simple)
+* \~english @param [in] mem_id
+* int - memory id
+* \~english @param [in] prot
+* int - Linux standard (same to mmap() of /dev/mem)
+* \~english @param [in] flags
+* int - Linux standard (same to mmap() of /dev/mem)
+* \~english @param [in] cache_flag
+* int - cache flag valid/invalid
+* \~english @par
+* Defined memory id as follows.
+* \~english @code
+* enum {
+* // SYS
+* EL_MEM_ID_SYS_ALL = 0x0001, // all SYS region
+* EL_MEM_ID_SYS_BOOT, // particular: BOOT region
+* // COM
+* EL_MEM_ID_COM_ALL = 0x2001, // all COMMUNICATION region
+* EL_MEM_ID_COM_SH4A, // particular: SH4A abnornal observation
+* // NAVI
+* EL_MEM_ID_NAVI_ALL = 0x3001, // NAVI region
+* EL_MEM_ID_NAVI_LOG, // particular: NAVI(AW) LOG region
+* // SH4A
+* EL_MEM_ID_SH4A_ALL = 0x4001, // SH4A region
+* EL_MEM_ID_SH4A_SHM, // particular: SH4A SH share memory region
+* // PRAMFS NOTE:ROM only
+* EL_MEM_ID_PRAMFS_ALL = 0x5001, // all PRAMFS region
+* // STARTUPBGM
+* EL_MEM_ID_STARTUPBGM_ALL = 0x6001, // all STARTUPBGM region
+* // NAVI (Image Recognition)
+* EL_MEM_ID_NAVI_IR_ALL = 0x7001, // all NAVI picture recognition region
+* };
+* @endcode
+* \~english @par
+* Cache flag as follows.
+* \~english @code
+* #define EL_MEM_CACHE_VALID 1 // valid cache
+* #define EL_MEM_CACHE_INVALID 0 // invalid cache
+* @endcode
+* \~english @retval address Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Parameter mem_id is not defined.[-1]
+* - Open device file failed.[-1]
+* - Map device file to memory error.[-1]
+* \~english @par Detail
+* - Get type, offset and length from internal table specified by mem_id, then\n
+* call \ref EL_mem_exram_mmap.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_mem_getLength, EL_mem_exram_mmap, EL_mem_exram_munmap
+*/
+void *EL_mem_exram_mmap_simple(int mem_id , int prot, int flags , int cache_flag); // NOLINT [readability/naming]
+
+/**\ingroup EL_mem_exram_mmap
+* \~english @par Brief
+* Map device file to memory.
+* \~english @param [in] type
+* int - memory type
+* \~english @param [in] offset
+* off_t - offset(From 0\ref EL_mem_getOffset)
+* \~english @param [in] length
+* size_t - length(From 1\ref EL_mem_getLength)
+* \~english @param [in] prot
+* int - Linux standard (same to mmap() of /dev/mem)
+* \~english @param [in] flags
+* int - Linux standard (same to mmap() of /dev/mem)
+* \~english @param [in] cache_flag
+* int - cache flag valid/invalid
+* \~english @par
+* Defined memory type as follows.
+* \~english @code
+* enum {
+* EL_MEM_TYPE_REGION_SYS, // SYS
+* EL_MEM_TYPE_REGION_COM, // COMMUNICATION
+* EL_MEM_TYPE_REGION_NAVI, // NAVI
+* EL_MEM_TYPE_REGION_SH4A, // SH4A
+* EL_MEM_TYPE_REGION_PRAMFS, // PRAMFS
+* EL_MEM_TYPE_REGION_STARTUPBGM, // STARTUPBGM
+* EL_MEM_TYPE_REGION_NAVI_IR, // NAVI IMAGE
+* };
+* @endcode
+* \~english @par
+* Cache flag as follows.
+* \~english @code
+* #define EL_MEM_CACHE_VALID 1 // valid cache
+* #define EL_MEM_CACHE_INVALID 0 // invalid cache
+* @endcode
+* \~english @retval address Success
+* \~english @retval -1 Error
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Open device file failed.[-1]
+* - Map device file to memory error.[-1]
+* \~english @par Detail
+* - Access device file specified by memory type, map function region to user space.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_mem_exram_munmap
+*/
+void *EL_mem_exram_mmap(int type, off_t offset , size_t length , int prot, int flags , int cache_flag); // NOLINT [readability/naming]
+
+/**\ingroup EL_mem_exram_munmap
+* \~english @par Brief
+* Unmap device file from memory.
+* \~english @param [in] addr
+* void * - address
+* \~english @param [in] length
+* size_t - size (1 ~ \ref EL_mem_getLength)
+* \~english @retval 0 Success
+* \~english @retval -1 Error:Set errno according to error type when error occurs.
+* \~english @par Prerequisite
+* - Map device file to memory(\ref EL_mem_exram_mmap,
+* \ref EL_mem_exram_mmap_simple).
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Unmap device file from memory error.[-1]
+* \~english @par Detail
+* - Unmap specified address.Error occurs when refer to this memory after unmap.
+* - Automatic unmap when process ends.
+* - The memory will not be unmap even the file descriptor is closed.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see EL_mem_exram_mmap, EL_mem_exram_mmap_simple
+*/
+int EL_mem_exram_munmap(void *addr, size_t length); // NOLINT [readability/naming]
+
+/**\ingroup EL_mem_getPhysicalAddress
+* \~english @par Brief
+* Get physical address.
+* \~english @param [in] mem_id
+* int - memory id
+* \~english @par
+* Defined memory id as follows.
+* \~english @code
+* enum {
+* // SYS
+* EL_MEM_ID_SYS_ALL = 0x0001, // all SYS region
+* EL_MEM_ID_SYS_BOOT, // particular: BOOT region
+* // COM
+* EL_MEM_ID_COM_ALL = 0x2001, // all COMMUNICATION region
+* EL_MEM_ID_COM_SH4A, // particular: SH4A abnornal observation
+* // NAVI
+* EL_MEM_ID_NAVI_ALL = 0x3001, // NAVI region
+* EL_MEM_ID_NAVI_LOG, // particular: NAVI(AW) LOG region
+* // SH4A
+* EL_MEM_ID_SH4A_ALL = 0x4001, // SH4A region
+* EL_MEM_ID_SH4A_SHM, // particular: SH4A SH share memory region
+* // PRAMFS NOTE:ROM only
+* EL_MEM_ID_PRAMFS_ALL = 0x5001, // all PRAMFS region
+* // STARTUPBGM
+* EL_MEM_ID_STARTUPBGM_ALL = 0x6001, // all STARTUPBGM region
+* // NAVI (Image Recognition)
+* EL_MEM_ID_NAVI_IR_ALL = 0x7001, // all NAVI picture recognition region
+* };
+* @endcode
+* \~english @retval physical address Success
+* \~english @retval 0 Error: Failed to open device file or get physical address(ioctl)
+* \~english @retval -1 Error: Parameter mem_id is not defined.
+* \~english @par Prerequisite
+* - None.
+* \~english @par Change of internal state
+* - Change of internal state according to the API does not occur.
+* \~english @par Conditions of processing failure
+* - Parameter mem_id is not defined.[-1]
+* - Get physical address error.[0]
+* \~english @par Detail
+* - Get physical address from dummy-memory driver according to device file specified by mem_id.
+* - Return the sum value of physical address and offset specified by mem_id.
+* \~english @par Classification
+* Public
+* \~english @par Type
+* Sync
+* \~english @see none
+*/
+u_int64_t EL_mem_getPhysicalAddress(int mem_id); // NOLINT [readability/naming]
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+/** @}*/ // end of memory_gpio_access_library
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
+#endif // MEMORY_GPIO_ACCESS_LIBRARY_CLIENT_INCLUDE_NATIVE_SERVICE_EL_MEM_H_
diff --git a/video_in_hal/stub/memory_gpio_access_library/client/src/el_gpio.c b/video_in_hal/stub/memory_gpio_access_library/client/src/el_gpio.c
new file mode 100755
index 0000000..c6f76ca
--- /dev/null
+++ b/video_in_hal/stub/memory_gpio_access_library/client/src/el_gpio.c
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "stub/el_gpio.h"
+
+int EL_Gpio_write(int symbol , bool value) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_read(int symbol , bool *value) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_attachInterruptControl(int symbol , unsigned long irq_flags) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_detachInterruptControl(int symbol) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_waitInterrupt(int symbol) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_waitInterrupt_timeout(int symbol, int timeout) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+int EL_Gpio_finalize(void) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
diff --git a/video_in_hal/stub/memory_gpio_access_library/client/src/el_mem.c b/video_in_hal/stub/memory_gpio_access_library/client/src/el_mem.c
new file mode 100755
index 0000000..0b1e2f9
--- /dev/null
+++ b/video_in_hal/stub/memory_gpio_access_library/client/src/el_mem.c
@@ -0,0 +1,73 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "stub/el_mem.h"
+
+off_t EL_mem_getOffset(int mem_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+size_t EL_mem_getLength(int mem_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 1;
+}
+
+int dummy[1] = {0}; /* dummy area for mmap() */
+
+void *EL_mem_exram_mmap(int type, off_t offset , size_t length , int prot, int flags , int cache_flag) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return ((void *)dummy);
+}
+
+void *EL_mem_exram_mmap_simple(int mem_id , int prot, int flags , int cache_flag) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return ((void *)dummy);
+}
+
+int EL_mem_exram_munmap(void *addr, size_t length) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
+
+u_int64_t EL_mem_getPhysicalAddress(int mem_id) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 0;
+}
diff --git a/video_in_hal/stub/stub.mk b/video_in_hal/stub/stub.mk
new file mode 100755
index 0000000..44fb1e3
--- /dev/null
+++ b/video_in_hal/stub/stub.mk
@@ -0,0 +1,42 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := stub
+
+#############################################################
+
+
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
+
diff --git a/video_in_hal/stub/vehicle/LICENSE b/video_in_hal/stub/vehicle/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/stub/vehicle/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/stub/vehicle/Makefile b/video_in_hal/stub/vehicle/Makefile
new file mode 100755
index 0000000..3fb575e
--- /dev/null
+++ b/video_in_hal/stub/vehicle/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../stub.mk
diff --git a/video_in_hal/stub/vehicle/client/Makefile b/video_in_hal/stub/vehicle/client/Makefile
new file mode 100755
index 0000000..f9e6b09
--- /dev/null
+++ b/video_in_hal/stub/vehicle/client/Makefile
@@ -0,0 +1,60 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libVehicle_API
+
+
+######### installed static library(*.a) #############
+INST_LIBS = libVehicle_API
+
+
+######### install headers(*.h) #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS = Vehicle_API.h vehicle_notifications.h Vehicle_Sensor_Common_API.h
+
+######### compiled sources #############
+libVehicle_API_SRCS = Vehicle_API.cpp
+
+######### add source path #############
+VPATH += ./src
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/stub
+
+######### add compile option #############
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+#### FOR DEBUG OPTIONS
+
+######### add library path #############
+LDFLAGS += -Wl,--gc-sections
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+include ../../stub.mk
diff --git a/video_in_hal/stub/vehicle/client/include/stub/Vehicle_API.h b/video_in_hal/stub/vehicle/client/include/stub/Vehicle_API.h
new file mode 100755
index 0000000..43fd066
--- /dev/null
+++ b/video_in_hal/stub/vehicle/client/include/stub/Vehicle_API.h
@@ -0,0 +1,298 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_API_H_
+#define VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_API_H_
+/**
+ * @file Vehicle_API.h
+ * @brief vehicle api header file
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/******************************************************************************
+ * Fine name :Vehicle_API.h
+ * System name :GPF
+ * Subsystem name :Vehicle I/F library
+ ******************************************************************************/
+#include <peripheral_service/Canif_API.h>
+#include <stub/Vehicle_Sensor_Common_API.h>
+#include <stub/vehicle_notifications.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+/************************************************************************
+ * Macro definition *
+ ************************************************************************/
+/*----------------------------------------------------------------------*
+ * VECHILE_RET_API definition *
+ *----------------------------------------------------------------------*/
+/* Normal */
+/**
+ * \~english Sucess
+ */
+#define VEHICLE_RET_NORMAL 0
+
+/**
+ * \~english No register data ID
+ */
+#define VEHICLE_RET_ERROR_DID (-2)
+
+/**
+ * \~english Input parameter error
+ */
+#define VEHICLE_RET_ERROR_PARAM (-4)
+
+/**
+ * \~english Create event error
+ */
+#define VEHICLE_RET_ERROR_CREATE_EVENT (-6)
+
+/*----------------------------------------------------------------------*
+ * Vehicle sensor information delivery registration API related *
+ *----------------------------------------------------------------------*/
+/* Delivery control */
+/**
+ * \~english Register delivery
+ */
+#define VEHICLE_DELIVERY_REGIST 0x01
+
+#if 0
+/**
+ * \~english Stop delivery
+ */
+#define VEHICLE_DELIVERY_STOP 0x02
+
+/**
+ * \~english Restart delivery
+ */
+#define VEHICLE_DELIVERY_RESTART 0x03
+#endif
+
+/* Delivery opportunities */
+/**
+ * \~english Delivery timing(update)
+ */
+#define VEHICLE_DELIVERY_TIMING_UPDATE 0x01
+
+/**
+ * \~english Delivery timing(change)
+ */
+#define VEHICLE_DELIVERY_TIMING_CHANGE 0x02
+
+/* Drive mode switching */
+/**
+ * \~english TAB mode
+ */
+#define VEHICLE_DRIVE_MODE_TAB 0
+
+/**
+ * \~english AIAPI mode(USB)
+ */
+#define VEHICLE_DRIVE_MODE_ATAPI 1
+
+/*----------------------------------------------------------------------*
+ * Message related *
+ *----------------------------------------------------------------------*/
+/* Command ID */
+/* Since it is defined in #define the commodity code, the public CID is defined in #define */
+/**
+ * \~english Vehicle sensor information notify commandID
+ */
+#define CID_VEHICLESENS_VEHICLE_INFO 0x00000200
+
+/* Message body size(byte) */
+/**
+ * \~english Vehicle sensor information data max size
+ */
+#define VEHICLE_VSINFO_DSIZE 80
+
+/************************************************************************
+ * typedef definition *
+ ************************************************************************/
+/**
+ * \~english API return value
+ */
+typedef int32_t VEHICLE_RET_API;
+
+/************************************************************************
+ * struct definition *
+ ************************************************************************/
+
+/************************************************************************
+ * TAG : VEHICLE_MSG_VSINFO_DAT
+ * ABSTRACT : Vehicle sensor information notification message(->User)
+ ************************************************************************/
+/** \~english Vehicle sensor information notification message */
+/**
+ * \~english Vehicle sensor information notify message data
+ */
+typedef struct {
+ /**
+ * \~english Vehicle sensor information data ID
+ */
+ uint32_t did;
+
+ /**
+ * \~english Vehicle sensor information data size
+ */
+ uint16_t size;
+
+ /**
+ * \~english Vehicle sensor information receive flag
+ */
+ uint8_t rcvFlag;
+
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve;
+
+ /**
+ * \~english Vehicle sensor information data
+ */
+ uint8_t data[VEHICLE_VSINFO_DSIZE];
+} VEHICLE_MSG_VSINFO_DAT;
+
+/**
+ * \~english Vehicle sensor information notify message
+ */
+typedef struct {
+ /**
+ * \~english Vehicle sensor information data struct
+ */
+ VEHICLE_MSG_VSINFO_DAT data;
+} VEHICLE_MSG_VSINFO;
+
+/************************************************************************
+ * Function prototype *
+ ************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*[VEHICLE_API Public API]*/
+/* Display time middle API prototype *************/
+
+/**
+ * \ingroup Vehicle_DeliveryEntry
+ * \~english @par Overview
+ * - Register delivery of vehicle information.
+ * \~english @param [in] h_app
+ * HANDLE - The application handle of the calling thread
+ * \~english @param [in] notify_name
+ * PCSTR - Vehicle information notification destination threa name
+ * \~english @param [in] ul_did
+ * uint32_t - Vehicle Data ID
+ * \~english @param [in] uc_ctrl_flg
+ * uint8_t - Register delivery
+ * \~english @param [in] uc_delivery_timing
+ * uint8_t - Delivery timing(change/update)
+ * \~english @retval VEHICLE_RET_NORMAL : Success(register successful)
+ * \~english @retval VEHICLE_RET_ERROR_CREATE_EVENT : Failure(event generation failure)
+ * \~english @retval VEHICLE_RET_ERROR_PARAM : Invalid parameter
+ * \~english @par Precondition
+ * - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+ * - The availability of the vehicle process is TRUE.
+ * \~english @par Changing internal state
+ * - No change of internal state by this API occurs.
+ * \~english @par Processing failure condition
+ * - Delivery control flag(uc_ctrl_flg) is not VEHICLE_DELIVERRY_REGIST [VEHICLE_RET_ERROR_PARAM]
+ * - Delivery timing is invalid(not change/update) [VEHICLE_RET_ERROR_PARAM]
+ * - Failed to generate a message queue handle for transmission with
+ * the vehicle process [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * - Synchronous communication received on the vehicle process side failed to
+ * get data [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * - The data ID does not exit in the management list on the vehicle process [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * - The number of delivery registrations has reached the max number [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Details
+ * - By calling this API, we request to register delivery specified vehicle information.
+ * - It returns from this API by returning the delivery registration result by the Return value.
+ * - The specified vehicle information is notified after delivery registration.
+ * - Data delivery/reception is performed by asynchronous communication,
+ * and the receiving side acquires with command"CID_VEHICLESENS_VEHICLE_INFO".
+ * - An example in which a process using NSFW registers"CID_VEHICLESENS_VEHICLE_INFO" is shown below.
+ * - Example) when above CID received, callback function(SampleCallBackFunc) is executed.
+ * - FrameworkunifiedAttachCallbackToDispatcher(hApp, TN_VEHICLE_SENS, CID_VEHICLESENS_VEHICLE_INFO, SampleCallBackFunc).
+ * \~english @see Vehicle_GetVehicleData, FrameworkunifiedMcOpenSender, FrameworkunifiedInvokeSync
+ */
+VEHICLE_RET_API Vehicle_DeliveryEntry(HANDLE h_app, PCSTR notify_name,
+ uint32_t ul_did, uint8_t uc_ctrl_flg,
+ uint8_t uc_delivery_timing);
+
+/**
+ * \ingroup Vehicle_GetVehicleData
+ * \~english @par Overview
+ * - Get vehicle information data(arbitrary data).
+ * \~english @param [in] h_app
+ * HANDLE - The application handle of the calling thread
+ * \~english @param [in] ul_did
+ * uint32_t - Vehicle Data ID
+ * \~english @param [out] p_dest_data
+ * void * - Data buffer
+ * \~english @param [in] us_dest_size
+ * uint16_t - Data buffer size(byte)
+ * \~english @retval Integer(>0) : The stored data size
+ * \~english @retval VEHICLE_RET_ERROR_CREATE_EVENT : Failure(event generation failure)
+ * \~english @retval VEHICLE_RET_ERROR_PARAM : Invalid parameter
+ * \~english @par Precondition
+ * - The generation/initialization of dispatcher for application(PadCreateDispatcherWithoutLoop etc.) is done.
+ * - The availability of the vehicle process is TRUE.
+ * \~english @par Changing internal state
+ * - No change of internal state by this API occurs.
+ * \~english @par Processing failure condition
+ * - Failed to generate a message queue handle for transmission with
+ * the vehicle process [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * - Input data buffer size(us_dest_size) is zero [VEHICLE_RET_ERROR_PARAM]
+ * - Input data buffer(p_dest_data) is NULL [VEHICLE_RET_ERROR_PARAM]
+ * - Synchronous communication received on the vehicle process side failed to
+ * get data [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * - The data ID does not exit in the management list on the vehicle process [VEHICLE_RET_ERROR_CREATE_EVENT]
+ * \~english @par Classification
+ * - Public
+ * \~english @par Type
+ * - Sync
+ * \~english @par Details
+ * - By calling this API, we obtain specified vehicle information.
+ * - The vehicle data will be written to parameter(pDestData).
+ * - Data delivery/reception is performed by asynchronous communication,
+ * and the receiving side acquires with command"CID_VEHICLESENS_VEHICLE_INFO".
+ * \~english @see Vehicle_DeliveryEntry, FrameworkunifiedMcOpenSender, FrameworkunifiedInvokeSync
+ */
+int32_t Vehicle_GetVehicleData(HANDLE h_app, uint32_t ul_did, void *p_dest_data,
+ uint16_t us_dest_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of vehicle
+/** @}*/ // end of VehicleService
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_API_H_
diff --git a/video_in_hal/stub/vehicle/client/include/stub/Vehicle_Sensor_Common_API.h b/video_in_hal/stub/vehicle/client/include/stub/Vehicle_Sensor_Common_API.h
new file mode 100755
index 0000000..810e46a
--- /dev/null
+++ b/video_in_hal/stub/vehicle/client/include/stub/Vehicle_Sensor_Common_API.h
@@ -0,0 +1,502 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_SENSOR_COMMON_API_H_
+#define VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_SENSOR_COMMON_API_H_
+
+/**
+ * @file Vehicle_Sensor_Common_API.h
+ * @brief vehicle common id defined header file
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/******************************************************************************
+ * File name :Vehicle_Sensor_Common_API.h
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle I/F library, Sensor I/F library
+ ******************************************************************************/
+
+/************************************************************************
+ * Macro definition *
+ ************************************************************************/
+
+#if 1 // Ignore -> MISRA-C++ Rules 16-1-2, 16-2-2
+/* #GPF_60_023 For testing */
+#ifndef CONFIG_EXTTERM_INPUT_DAB2BIT // Ignore -> MISRA-C++ Rules 16-1-2, 16-2-2
+/**
+ * \~english DAB data 2 bits macro
+ */
+#define CONFIG_EXTTERM_INPUT_DAB2BIT 1 // Ignore -> MISRA-C++ Rules 16-2-2
+#endif
+#ifndef CONFIG_EXTTERM_INPUT_GPS2BIT // Ignore -> MISRA-C++ Rules 16-1-2, 16-2-2
+/**
+ * \~english GPS data 2 bits macro
+ */
+#define CONFIG_EXTTERM_INPUT_GPS2BIT 1 // Ignore -> MISRA-C++ Rules 16-2-2
+#endif
+#ifndef CONFIG_EXTTERM_INPUT_IMAGETERMINAL // Ignore -> MISRA-C++ Rules 16-1-2, 16-2-2
+/**
+ * \~english Image terminal macro
+ */
+#define CONFIG_EXTTERM_INPUT_IMAGETERMINAL 1 // Ignore -> MISRA-C++ Rules 16-2-2
+#endif
+#endif
+/* The above definition is a remnant of the external terminal processing part inside *
+ * the sennsor that was enabled or disabled, and is not originally required at all. *
+ * Enable all sensor internal processing and then delete. */
+
+/*----------------------------------------------------------------------*
+ * Data ID corresponding to vehicle sensor information *
+ *----------------------------------------------------------------------*/
+/*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+
+/**
+ * \~english Destination information
+ */
+#define VEHICLE_DID_DESTINATION (0x00000001UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Hybrid electric vehicle information
+ */
+#define VEHICLE_DID_HV (0x00000002UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Steering wheel information
+ */
+#define VEHICLE_DID_STEERING_WHEEL (0x00000003UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Voltage
+ */
+#define VEHICLE_DID_VB (0x00000004UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english IG information
+ */
+#define VEHICLE_DID_IG (0x00000005UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Microphone information
+ */
+#define VEHICLE_DID_MIC (0x00000006UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Back door information
+ */
+#define VEHICLE_DID_BACKDOOR (0x00000007UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Parking brake information
+ */
+#define VEHICLE_DID_PKB (0x00000008UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ADIM information
+ */
+#define VEHICLE_DID_ADIM (0x00000009UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Illumination information
+ */
+#define VEHICLE_DID_ILL (0x0000000AUL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english RHEOSTAT information
+ */
+#define VEHICLE_DID_RHEOSTAT (0x0000000BUL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english System temperature information
+ */
+#define VEHICLE_DID_SYSTEMP (0x0000000CUL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Reverse information
+ */
+#define VEHICLE_DID_REV (0x00000017UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Reverse information(line sensor)
+ */
+#define VEHICLE_DID_REV_LINE (0x0000000EUL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Reverse CAN information
+ */
+#define VEHICLE_DID_REV_CAN (0x0000000FUL) // Ignore -> MISRA-C++ Rule 16-2-2
+/**
+ * \~english SPEED information
+ */
+#define VEHICLE_DID_SPEED (0x00000010UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english SPEED PULSE information
+ */
+#define VEHICLE_DID_SPEED_PULSE (0x00000011UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english VB information
+ */
+#define VEHICLE_DID_VBLOW (0x00000012UL) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Drive information(2WD/4WD)
+ */
+#define VEHICLE_DID_DVINF (0x00000013UL)
+
+/**
+ * \~english Transmission information
+ */
+#define VEHICLE_DID_VARTRM1 (0x00000014UL)
+
+/**
+ * \~english Shift position signal(R, P, N, D)
+ */
+#define VEHICLE_DID_SHIFT (0x00000015UL)
+
+/**
+ * \~english Direct line sensor(PKB)
+ */
+#define VEHICLE_DID_PKB_LINE (0x00000016UL)
+
+/**
+ * \~english D seat door signal switch
+ */
+#define VEHICLE_DID_DSEAT_DOOR (0x0000000DUL)
+
+/**
+ * \~english P seat door signal switch
+ */
+#define VEHICLE_DID_PSEAT_DOOR (0x00000018UL)
+
+/**
+ * \~english RR seat door signal switch
+ */
+#define VEHICLE_DID_RRSEAT_DOOR (0x00000019UL)
+
+/**
+ * \~english RL seat door signal switch
+ */
+#define VEHICLE_DID_RLSEAT_DOOR (0x0000001AUL)
+
+/**
+ * \~english IGP information
+ */
+#define VEHICLE_DID_IGP (0x0000001BUL)
+
+/**
+ * \~english HV information status
+ */
+#define VEHICLE_DID_HV_STS (0x0000001CUL)
+
+/**
+ * \~english Shift position signal(Unspecified)
+ */
+#define VEHICLE_DID_SHIFT_U (0x0000001DUL)
+
+/**
+ * \~english USB power supply
+ */
+#define VEHICLE_DID_USBPOWERSUPPLY (0x800000A0UL)
+
+/**
+ * \~english Analog Microphone Connect information
+ */
+#define VEHICLE_DID_ANALOG_MIC (0x800000B0UL)
+
+/**
+ * \~english MultiMic Connect information
+ */
+#define VEHICLE_DID_MULTI_MIC (0x800000B1UL)
+
+/*----------------------------------------------------------------------*
+ * Vehicle sensor information data *
+ *----------------------------------------------------------------------*/
+/**
+ * \~english OFF
+ */
+#define VEHICLE_SNS_OFF (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ON
+ */
+#define VEHICLE_SNS_ON (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+#define VEHICLE_SNS_BLACKOUT (0x02U) // Disruptions
+/**
+ * \~english Undefined
+ */
+#define VEHICLE_SNS_UNDEF (0x03U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Disconnection
+ */
+#define VEHICLE_SNS_UNCONNECTION (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Connection
+ */
+#define VEHICLE_SNS_CONNECTION (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Uncertainty
+ */
+#define VEHICLE_SNS_BW_UNCERTAINTY (0x02U)
+
+/**
+ * \~english Unspecified
+ */
+#define VEHICLE_SNS_UNSPECIFIED (0x03U) // Ignore -> MISRA-C++ Rule 16-2-2
+/* #GPF_60_023 ADD START */
+#if (CONFIG_EXTTERM_INPUT_DAB2BIT | CONFIG_EXTTERM_INPUT_GPS2BIT) // Ignore -> MISRA-C++ Rules 16-1-2, 16-2-2
+/**
+ * \~english Short
+ */
+#define VEHICLE_SNS_SHORT (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+#endif
+/* #GPF_60_023 ADD END */
+
+/**
+ * \~english Hybrid electric vehicle
+ */
+#define VEHICLE_SNS_HV (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Plug-in hybrid electric vehicle
+ */
+#define VEHICLE_SNS_PHV (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Electric vehicle
+ */
+#define VEHICLE_SNS_EV (0x03U)
+
+/**
+ * \~english Fuel Cell vehicle
+ */
+#define VEHICLE_SNS_FCV (0x04U)
+
+/**
+ * \~english 1 motor vehicle
+ */
+#define VEHICLE_SNS_1MOT (0x05U)
+
+/**
+ * \~english Conventional(48V) vehicle
+ */
+#define VEHICLE_SNS_48V (0x06U)
+
+/**
+ * \~english S&S vehicle
+ */
+#define VEHICLE_SNS_SANDS (0x07U)
+
+/**
+ * \~english Conventional vehicle
+ */
+#define VEHICLE_SNS_NONHV (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Two wheel drive
+ */
+#define VEHICLE_SNS_2WD (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**gb
+ * \~english Four wheel drive
+ */
+#define VEHICLE_SNS_4WD (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Left handle
+ */
+#define VEHICLE_SNS_LH (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Right handle
+ */
+#define VEHICLE_SNS_RH (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Close
+ */
+#define VEHICLE_SNS_CLOSE (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Open
+ */
+#define VEHICLE_SNS_OPEN (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Back door uncertainty
+ */
+#define VEHICLE_SNS_BD_UNCERTAINTY (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ADIM uncertainty
+ */
+#define VEHICLE_SNS_ADIM_UNCERTAINTY (0x00U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ADIM undefined
+ */
+#define VEHICLE_SNS_ADIM_UNDEF (0x01U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ADIM off
+ */
+#define VEHICLE_SNS_ADIM_OFF (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english ADIM on
+ */
+#define VEHICLE_SNS_ADIM_ON (0x03U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Drive information(2WD)
+ */
+#define VEHICLE_SNS_DVINF_2WD (0x00U)
+
+/**
+ * \~english Drive information(4WD)
+ */
+#define VEHICLE_SNS_DVINF_4WD (0x01U)
+
+/**
+ * \~english Drive information uncertainty
+ */
+#define VEHICLE_SNS_DVINF_UNCERTAINTY (0x03U)
+
+/**
+ * \~english Transmission information(MT)
+ */
+#define VEHICLE_SNS_VARTRM1_MT (0x00U)
+
+/**
+ * \~english Transmission information(AT)
+ */
+#define VEHICLE_SNS_VARTRM1_AT (0x01U)
+
+/**
+ * \~english Transmission information(CVT)
+ */
+#define VEHICLE_SNS_VARTRM1_CVT (0x02U)
+
+/**
+ * \~english Transmission information(MMT)
+ */
+#define VEHICLE_SNS_VARTRM1_MMT (0x03U)
+
+/**
+ * \~english Transmission information(SMT)
+ */
+#define VEHICLE_SNS_VARTRM1_SMT (0x04U)
+
+/**
+ * \~english Transmission information(HV_AT)
+ */
+#define VEHICLE_SNS_VARTRM1_HV_AT (0x05U)
+
+/**
+ * \~english Transmission information uncertainty
+ */
+#define VEHICLE_SNS_VARTRM1_UNCERTAINTY (0x0FU)
+
+/**
+ * \~english D seat door uncertainty
+ */
+#define VEHICLE_SNS_DS_UNCERTAINTY (0x02U)
+
+/**
+ * \~english P seat door uncertainty
+ */
+#define VEHICLE_SNS_PS_UNCERTAINTY (0x02U)
+
+/**
+ * \~english RR seat door uncertainty
+ */
+#define VEHICLE_SNS_RRS_UNCERTAINTY (0x02U)
+
+/**
+ * \~english RL seat door uncertainty
+ */
+#define VEHICLE_SNS_RLS_UNCERTAINTY (0x02U)
+
+/**
+ * \~english HV information not decision
+ */
+#define VEHICLE_SNS_HV_NOT_DECISION (0x00U)
+
+/**
+ * \~english HV information decision
+ */
+#define VEHICLE_SNS_HV_DECISION (0x01U)
+
+/**
+ * @enum VehicleSnsAnlogMicBit
+ * \~english ANALOGMIC connect bit information
+ */
+enum VehicleSnsAnlogMicBit {
+ VEHICLE_SNS_ANALOG_MIC1_BIT = 0x02, //!< \~english ANALOGMIC1 connect
+ VEHICLE_SNS_ANALOG_MIC2_BIT = 0x04, //!< \~english ANALOGMIC2 connect
+};
+
+/**
+ * @enum VehicleSnsMultiMicBit
+ * \~english MULTI MIC connect bit information
+ */
+enum VehicleSnsMultiMicBit {
+ VEHICLE_SNS_A2B_HUB_BIT = 0x01, //!< \~english A2BHUB connect
+ VEHICLE_SNS_MULTI_MIC1_BIT = 0x02, //!< \~english MULTIMIC1 connect
+ VEHICLE_SNS_MULTI_MIC2_BIT = 0x04, //!< \~english MULTIMIC2 connect
+ VEHICLE_SNS_MULTI_MIC3_BIT = 0x08, //!< \~english MULTIMIC3 connect
+ VEHICLE_SNS_MULTI_MIC4_BIT = 0x10, //!< \~english MULTIMIC4 connect
+ VEHICLE_SNS_MULTI_MIC5_BIT = 0x20, //!< \~english MULTIMIC5 connect
+ VEHICLE_SNS_MULTI_MIC6_BIT = 0x40, //!< \~english MULTIMIC6 connect
+ VEHICLE_SNS_ANC_BIT = 0x80, //!< \~english ANC connect
+};
+
+/*-------------------------------------------------------------------------------
+ * Time status return value
+ -------------------------------------------------------------------------------*/
+/**
+ * \~english Real time clock
+ */
+#define GPS_TIMESTS_RTC (0x02U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/**
+ * \~english Exception time
+ */
+#define GPS_TIMESTS_NG (0x03U) // Ignore -> MISRA-C++ Rule 16-2-2
+
+/** @}*/ // end of vehicle
+/** @}*/ // end of VehicleService
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_SENSOR_COMMON_API_H_
diff --git a/video_in_hal/stub/vehicle/client/include/stub/vehicle_notifications.h b/video_in_hal/stub/vehicle/client/include/stub/vehicle_notifications.h
new file mode 100755
index 0000000..8348147
--- /dev/null
+++ b/video_in_hal/stub/vehicle/client/include/stub/vehicle_notifications.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_NOTIFICATIONS_H_
+#define VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_NOTIFICATIONS_H_
+
+/**
+ * @file vehicle_notifications.h
+ * @brief vehicle notification name define header file
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <agl_thread.h>
+
+/**
+ * \~english Vehicle notification availability
+ */
+#define NTFY_Vehicle_Availability MN_VEHICLE"/Availability"
+
+/** @}*/ // end of vehicle
+/** @}*/ // end of VehicleService
+/** @}*/ // end of BaseSystem
+
+#endif // VEHICLE_CLIENT_INCLUDE_VEHICLE_SERVICE_VEHICLE_NOTIFICATIONS_H_
diff --git a/video_in_hal/stub/vehicle/client/libVehicle_API.ver b/video_in_hal/stub/vehicle/client/libVehicle_API.ver
new file mode 100755
index 0000000..14be907
--- /dev/null
+++ b/video_in_hal/stub/vehicle/client/libVehicle_API.ver
@@ -0,0 +1,28 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#########################
+# libVehicle_API version script #
+#########################
+{
+ global:
+ ### .text section ###
+ Vehicle_*;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/video_in_hal/stub/vehicle/client/src/Vehicle_API.cpp b/video_in_hal/stub/vehicle/client/src/Vehicle_API.cpp
new file mode 100755
index 0000000..cefee01
--- /dev/null
+++ b/video_in_hal/stub/vehicle/client/src/Vehicle_API.cpp
@@ -0,0 +1,43 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "Vehicle_API.h"
+
+VEHICLE_RET_API Vehicle_DeliveryEntry(HANDLE h_app, PCSTR notify_name,
+ uint32_t ul_did, uint8_t uc_ctrl_flg,
+ uint8_t uc_delivery_timing) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return VEHICLE_RET_NORMAL;
+}
+
+int32_t Vehicle_GetVehicleData(HANDLE h_app, uint32_t ul_did, void *p_dest_data,
+ uint16_t us_dest_size) {
+ /*
+ * Note.
+ * This feature needs to be implemented by the vendor.
+ */
+ return 1;
+}
+
diff --git a/video_in_hal/systemservice/config/LICENSE b/video_in_hal/systemservice/config/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/systemservice/config/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/systemservice/config/Makefile.client b/video_in_hal/systemservice/config/Makefile.client
new file mode 100755
index 0000000..0a186c5
--- /dev/null
+++ b/video_in_hal/systemservice/config/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := library
+
+include ../system_service.mk
diff --git a/video_in_hal/systemservice/config/library/Makefile b/video_in_hal/systemservice/config/library/Makefile
new file mode 100755
index 0000000..f326127
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := system_manager_config
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/Makefile b/video_in_hal/systemservice/config/library/system_manager_config/Makefile
new file mode 100755
index 0000000..fbb09d7
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/Makefile
@@ -0,0 +1,21 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+SUBDIRS := src
+
+include ../../../system_service.mk
+
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_access_if_private.h b/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_access_if_private.h
new file mode 100755
index 0000000..1753bf0
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_access_if_private.h
@@ -0,0 +1,80 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_access_if_private.h
+ * @brief \~english This file contains declaration of structures RAM_AccessPrivate and ROM_AccessPrivate
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup config
+ * @ingroup system_service
+ * @{
+ */
+#ifndef CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_ACCESS_IF_PRIVATE_H_
+#define CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_ACCESS_IF_PRIVATE_H_
+
+#include <system_service/ss_sm_rom_access.h>
+#include <system_service/ss_sm_ram_access.h>
+
+// Should be design the data so that the default value is 0.
+
+// Product private area for DRAM BACKUP
+
+/**
+ * @struct RAM_AccessPrivate
+ * @brief \~english RAM Access Private data define
+ */
+typedef struct {
+ union {
+ //! \~english _CWORD80_ error define
+ struct {
+ /*
+ * Note.
+ * This feature needs to be defined depending on the product specification by the vendor.
+ */
+ };
+ //! \~english RAM product private max
+ uint8_t max[RAM_PRODUCT_PRIVATE_MAX];
+ };
+} RAM_AccessPrivate;
+
+/**
+ * @struct ROM_AccessPrivate
+ * @brief \~english ROM Access Private data define
+ */
+typedef struct {
+ union {
+ // Since data is accessed with 32 bit width at the low level, data must be allocated using 32 bits algin
+ struct {
+ /*
+ * Note.
+ * This feature needs to be defined depending on the product specification by the vendor.
+ */
+ };
+ //! \~english ROM product private max
+ uint8_t max[ROM_PRODUCT_PRIVATE_MAX];
+ };
+} ROM_AccessPrivate;
+
+#endif // CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_ACCESS_IF_PRIVATE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_package.h b/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_package.h
new file mode 100755
index 0000000..788fd2c
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_package.h
@@ -0,0 +1,65 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_package.h
+ * @brief \~english This file contains declaration of common package values
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_PACKAGE_H_
+#define CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_PACKAGE_H_
+
+// _CWORD71_ package name list
+#define SS_PKG_MAIN_EMMC "MAIN_EMMC" // define MAIN_EMMC for main_emmc
+#define SS_PKG_MAIN_PRODUCT_SI "MAIN_PRODUCT_SI" // define MAIN_PRODUCT_SI for main_product_si
+#define SS_PKG_TARGETBOARD "TARGETBOARD" // define TARGETBOARD for target boar
+#define SS_PKG_MAIN_LPF_SI "MAIN_LPF_SI" // define MAIN_LPF_SI for main_lpf_si
+
+#define SS_PKG_NAVI_GPS _Pragma ("GCC warning \"'SS_NAVI_GPS' macro is deprecated\"") "NAVI_GPS"
+#define SS_PKG_SERIES_INFO _Pragma ("GCC warning \"'SS_PKG_SERIES_INFO' macro is deprecated\"") "SERIES_INFO"
+
+#define MSG_PSM_REBOOT_NOTIFY 0x11 // define ps_psmshadow reboot notice id
+
+// AGL reserved version list.
+#define SS_PKG_DIAG_CPU_INFO_001 "DIAG_CPU_INFO_001"
+#define SS_PKG_DIAG_CPU_INFO_002 "DIAG_CPU_INFO_002"
+#define SS_PKG_DIAG_CPU_INFO_003 "DIAG_CPU_INFO_003"
+#define SS_PKG_DIAG_CPU_INFO_004 "DIAG_CPU_INFO_004"
+#define SS_PKG_DIAG_CPU_INFO_005 "DIAG_CPU_INFO_005"
+#define SS_PKG_DIAG_CPU_INFO_006 "DIAG_CPU_INFO_006"
+#define SS_PKG_DIAG_CPU_INFO_007 "DIAG_CPU_INFO_007"
+#define SS_PKG_DIAG_CPU_INFO_008 "DIAG_CPU_INFO_008"
+#define SS_PKG_DIAG_CPU_INFO_009 "DIAG_CPU_INFO_009"
+#define SS_PKG_DIAG_CPU_INFO_010 "DIAG_CPU_INFO_010"
+#define SS_PKG_DIAG_CPU_INFO_011 "DIAG_CPU_INFO_011"
+#define SS_PKG_DIAG_CPU_INFO_012 "DIAG_CPU_INFO_012"
+#define SS_PKG_DIAG_CPU_INFO_013 "DIAG_CPU_INFO_013"
+#define SS_PKG_DIAG_CPU_INFO_014 "DIAG_CPU_INFO_014"
+#define SS_PKG_DIAG_CPU_INFO_015 "DIAG_CPU_INFO_015"
+
+#endif // CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_PACKAGE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_system_manager_conf.h b/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_system_manager_conf.h
new file mode 100755
index 0000000..5354da8
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/ss_system_manager_conf.h
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_system_manager_conf.h
+ * @brief \~english This file contains declaration of structures T_SS_SM_INIT_HOOK_IN_PARAM, T_SS_SM_INIT_HOOK_OUT_PARAM and api initial Hook
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup config
+ * @ingroup system_service
+ * @{
+ */
+#ifndef CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_SYSTEM_MANAGER_CONF_H_
+#define CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_SYSTEM_MANAGER_CONF_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <vector>
+#include <string>
+
+/**
+ * @struct T_SS_SM_INIT_HOOK
+ * @brief \~english Version up mode, Callback function
+ */
+typedef struct T_SS_SM_INIT_HOOK {
+ //! \~english Version up mode
+ BOOL bIsVupMode;
+ //! \~english Call back function
+ EFrameworkunifiedStatus (*cbRebootNoticeFunc)(HANDLE hApp);
+
+ T_SS_SM_INIT_HOOK()
+ : bIsVupMode(FALSE),
+ cbRebootNoticeFunc(NULL) {
+ }
+} T_SS_SM_INIT_HOOK_IN_PARAM;
+
+
+/**
+ * @struct T_SS_SM_INIT_HOOK_OUT_PARAM
+ * @brief \~english Not in OOM Killer's service object, Group Relaunch service.
+ */
+typedef struct {
+ std::vector<std::string> protectedSvcs;
+ //! \~english Not in OOM Killer's service object.
+ std::vector<std::string> groupRelaunchSvcs;
+ //! \~english Group Relaunch service.
+} T_SS_SM_INIT_HOOK_OUT_PARAM;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ss_sm_initHook
+/// \~english @par Summary
+///
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE Application
+/// \~english @param [in] inPrm
+/// T_SS_SM_INIT_HOOK_IN_PARAM -
+/// \~english @param [in] outPrm
+/// T_SS_SM_INIT_HOOK_OUT_PARAM -
+/// \~english @par
+/// T_SS_SM_INIT_HOOK_IN_PARAM struct
+/// \~english @code
+/// typedef struct T_SS_SM_INIT_HOOK {
+/// BOOL bIsVupMode; /* version up model */
+/// EFrameworkunifiedStatus (*cbRebootNoticeFunc)(HANDLE hApp); /* call back function */
+/// T_SS_SM_INIT_HOOK()
+/// : bIsVupMode(FALSE),
+/// cbRebootNoticeFunc(NULL) {
+/// } /* constructor */
+/// } T_SS_SM_INIT_HOOK_IN_PARAM;
+/// @endcode
+/// \~english @par
+/// T_SS_SM_INIT_HOOK_IN_PARAM struct
+/// \~english @code
+/// typedef struct {
+/// std::vector<std::string> protectedSvcs; /* OOM Killer's protected service */
+/// std::vector<std::string> groupRelaunchSvcs; /* group relunch service */
+/// } T_SS_SM_INIT_HOOK_OUT_PARAM;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - None
+/// \~english @par Change of the internal state
+/// - save inPrm->cbRebootNoticeFunc to s_confCtx.cbRebootNoticeFunc.
+/// \~english @par Causes of failures
+/// -
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid. \n
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of \n
+/// the System Manager message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid. \n
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session. \n
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. \n
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// get env val from application,and write these to Launch Config file.
+/// \~english @par
+/// eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Fail
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus ss_sm_initHook(HANDLE hApp, const T_SS_SM_INIT_HOOK_IN_PARAM *inPrm,
+ T_SS_SM_INIT_HOOK_OUT_PARAM *outPrm);
+
+#endif // CONFIG_LIBRARY_SYSTEM_MANAGER_CONFIG_INCLUDE_SYSTEM_SERVICE_SS_SYSTEM_MANAGER_CONF_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/system_manager_config.h b/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/system_manager_config.h
new file mode 100755
index 0000000..2f44f98
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/include/system_service/system_manager_config.h
@@ -0,0 +1,26 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ */
+#ifndef SYSTEMSERVICE_SYSTEMMANAGERCONFIG_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_SYSTEMMANAGERCONFIG_H_ // NOLINT(build/header_guard)
+
+#include <system_service/ss_access_if_private.h>
+#include <system_service/ss_package.h>
+#include <system_service/ss_system_manager_conf.h>
+
+#endif // SYSTEMSERVICE_SYSTEMMANAGERCONFIG_H_
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/last2order/Makefile b/video_in_hal/systemservice/config/library/system_manager_config/last2order/Makefile
new file mode 100755
index 0000000..f38ee77
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/last2order/Makefile
@@ -0,0 +1,71 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# ==== Customization ================
+#Directory path located XMLs for conversion
+CONFXML_DIR_PATH ?= $(SDKTARGETSYSROOT)/usr/agl/conf/sm_last2order
+
+#path to order file
+ORDER_DEF_PATH ?= $(SDKTARGETSYSROOT)/usr/agl/include/agl_wakeup_order.h
+
+#path to be installed CFO file
+CONF_INSTALL_DIR ?= $(SDKTARGETSYSROOT)/usr/agl/conf/systemmanager
+
+# ==================================
+
+HOST_CPP = cpp
+MKL_LAST2ORDER = mklast2ordertbl.pl
+
+#path located last2order tools
+TOOLPATH = ./tool
+
+VPATH = $(CONFXML_DIR_PATH) $(TOOLPATH)
+
+XMLFILES = $(shell cd $(CONFXML_DIR_PATH); ls *.xml)
+XMLTMPFILES = $(XMLFILES:%.xml=%.xml.pped)
+CFOFILES = $(XMLFILES:%.xml=%.cfo)
+
+_all:$(CFOFILES)
+
+install:install-pre install-cfo
+
+install-pre:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/sm_last2order;\
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/systemmanager sm_last2order.cfo
+
+install-cfo:_all
+ set -e ;\
+ install -d -m 775 $(CONF_INSTALL_DIR) ;\
+ for cfofile in $(CFOFILES); do \
+ install -m 644 -t $(CONF_INSTALL_DIR) $$cfofile; \
+ done
+
+%.cfo:%.xml.pped $(MKL_LAST2ORDER)
+ ln -fs $(TOOLPATH)/$(MKL_LAST2ORDER)
+ ./$(MKL_LAST2ORDER) $< $@
+
+%.xml.pped:%.xml
+ $(HOST_CPP) -P -include $(ORDER_DEF_PATH) $< > $@
+
+clean:clean_local
+clean-sub:clean_local
+
+clean_local:
+ rm -f *.cfo *.pped *.pl
+
+.PHONY:install-cfo _all
+
+include ../../../../system_service.mk
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/last2order/sm_last2order.cfo b/video_in_hal/systemservice/config/library/system_manager_config/last2order/sm_last2order.cfo
new file mode 100755
index 0000000..2463eec
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/last2order/sm_last2order.cfo
Binary files differ
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/last2order/tool/mklast2ordertbl.pl b/video_in_hal/systemservice/config/library/system_manager_config/last2order/tool/mklast2ordertbl.pl
new file mode 100755
index 0000000..9b7dcab
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/last2order/tool/mklast2ordertbl.pl
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+use strict;
+
+use XML::XPath;
+
+my $LOCAL_XML = "./last2order.xml.tmp";
+my $LOCAL_DTD = "./last2order.dtd";
+
+my $DTD = <<'EODTD';
+<!ELEMENT last2order_tbl (last2order*) >
+
+<!ELEMENT last2order EMPTY>
+<!ATTLIST last2order
+ front_video CDATA "EMPTY"
+ front_sub_video CDATA "EMPTY"
+ front_audio CDATA "EMPTY"
+ rear_video CDATA "EMPTY"
+ rear_audio CDATA "EMPTY"
+ ordername CDATA #REQUIRED
+>
+EODTD
+
+sub usage(){
+ print STDERR "USAGE:$0 *.xml *.cfo\n";
+}
+
+#==== MAIN ====
+my $ret=system("which xmllint > /dev/null");
+if($ret != 0){
+ die("xmllint is not installed \n");
+}
+
+if(2 != @ARGV){
+ usage();
+ exit 1;
+}
+
+my $inXmlFile= $ARGV[0];
+my $outCfgXmlFile= $ARGV[1];
+
+
+#ARG CHECK
+if(! -e $inXmlFile){
+ die("$inXmlFile not found");
+}
+
+
+system("cp $inXmlFile $LOCAL_XML");
+
+open FOUT,'>',$LOCAL_DTD or die("can't open $LOCAL_DTD");
+print FOUT $DTD;
+close FOUT;
+
+$ret=system("xmllint --noout --valid $LOCAL_XML ");
+if($ret != 0){
+ die("$inXmlFile is NOT VAILD");
+}
+
+my $xml = XML::XPath->new(filename=>$LOCAL_XML);
+
+my $last2order_tbl = $xml->find('/last2order_tbl/last2order');
+
+my @nodelist = $last2order_tbl->get_nodelist;
+my $numOfElement = @nodelist;
+
+printf("num of element :$numOfElement\n");
+
+my $writeValue;
+open FOUT,'+>',$outCfgXmlFile or die("can't open $outCfgXmlFile");
+binmode(FOUT);
+
+$writeValue = pack("A4","CTOO"); print FOUT $writeValue;
+$writeValue = pack("L",$numOfElement); print FOUT $writeValue;
+
+foreach my $last2order( @nodelist ) {
+ $writeValue = $last2order->findvalue('@front_video');
+ printf("FV:$writeValue ");
+ $writeValue = pack("a128",$writeValue); print FOUT $writeValue;
+
+ $writeValue = $last2order->findvalue('@front_sub_video');
+ printf("FSV:$writeValue ");
+ $writeValue = pack("a128",$writeValue); print FOUT $writeValue;
+
+ $writeValue = $last2order->findvalue('@front_audio');
+ printf("FA:$writeValue ");
+ $writeValue = pack("a128",$writeValue); print FOUT $writeValue;
+
+ $writeValue = $last2order->findvalue('@rear_video');
+ printf("RV:$writeValue ");
+ $writeValue = pack("a128",$writeValue); print FOUT $writeValue;
+
+ $writeValue = $last2order->findvalue('@rear_audio');
+ printf("RA:$writeValue ");
+ $writeValue = pack("a128",$writeValue); print FOUT $writeValue;
+
+ $writeValue = $last2order->findvalue('@ordername');
+ printf("ON:$writeValue ");
+ $writeValue = pack("a64",$writeValue); print FOUT $writeValue;
+
+ printf("\n");
+}
+
+close(FOUT);
+
+system("rm $LOCAL_XML $LOCAL_DTD");
+
+
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/order/Makefile b/video_in_hal/systemservice/config/library/system_manager_config/order/Makefile
new file mode 100755
index 0000000..38af0ee
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/order/Makefile
@@ -0,0 +1,64 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#HOST TOOLS
+HOST_CPP = cpp
+HOST_ORDER_XML2CFG = ./launch_order_xml2cfg.pl
+
+CONF_DIR = $(SDKTARGETSYSROOT)/usr/agl/conf
+CONF_WON_H = $(SDKTARGETSYSROOT)/usr/agl/include/agl_wakeup_order.h
+
+LAUNCH_XMLFILES = $(shell cd $(CONF_DIR)/sm_launch; ls *.xml)
+ORDER_XMLFILES = $(LAUNCH_XMLFILES:%.xml=%.order)
+ORDER_CFGFILES = $(ORDER_XMLFILES:%.order=%.order.cfg)
+
+INST_CONFDIR = $(SDKTARGETSYSROOT)/usr/agl/conf/systemmanager
+
+CLEAN_FILES = launch_order_body.xml $(ORDER_CFGFILES)
+
+VPATH = $(CONF_DIR)/sm_launch
+VPATH += ../xml
+
+install:install-pre install-cfg
+
+install-pre:
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/sm_launch system_launcher_main.xml
+
+install-cfg:$(ORDER_CFGFILES)
+ set -e ;\
+ install -d -m 775 $(INST_CONFDIR) ;\
+ for cfgfile in $(ORDER_CFGFILES);do \
+ install -m 644 -t $(INST_CONFDIR) $$cfgfile;\
+ done ;\
+
+#Create CFG file
+%.order.cfg:%.order %.cfg
+ echo $@
+ set -e; \
+ $(HOST_CPP) $(CPPFLAGS) -P -include $(CONF_WON_H) $< > launch_in.order; \
+ $(HOST_ORDER_XML2CFG) launch_in.order $(filter %.cfg,$+) > $@ ; \
+ rm -fr launch_in.order;
+
+%.order:
+ echo $@
+ set -e; \
+ if [ ! -e $@ ] ; then \
+ touch $@ ; \
+ fi
+
+PHONY:install-cfg
+
+include ../../../../system_service.mk
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/order/launch_order_body.xml b/video_in_hal/systemservice/config/library/system_manager_config/order/launch_order_body.xml
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/order/launch_order_body.xml
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/order/launch_order_main.xml b/video_in_hal/systemservice/config/library/system_manager_config/order/launch_order_main.xml
new file mode 100755
index 0000000..ee22646
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/order/launch_order_main.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" ?>
+
+<!DOCTYPE launch_order [
+ <!ELEMENT launch_order (order*) >
+
+ <!ELEMENT order (group+) >
+ <!ATTLIST order
+ oname ID #REQUIRED
+ fixed_group CDATA "NULL"
+ >
+
+ <!ELEMENT group EMPTY >
+ <!ATTLIST group
+ gname CDATA #REQUIRED
+ waittime CDATA "0"
+ >
+
+ <!ENTITY launch_order_body SYSTEM "launch_order_body.xml">
+]>
+
+<launch_order>
+ &launch_order_body;
+</launch_order>
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/order/launch_order_xml2cfg.pl b/video_in_hal/systemservice/config/library/system_manager_config/order/launch_order_xml2cfg.pl
new file mode 100755
index 0000000..1060107
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/order/launch_order_xml2cfg.pl
@@ -0,0 +1,171 @@
+#!/usr/bin/perl -w
+use strict;
+
+use XML::XPath;
+use File::Copy;
+
+my $main_file="launch_order_main.xml";
+my $body_file="launch_order_body.xml";
+
+
+sub usage(){
+ print STDERR "USAGE:$0 *.order *.cfg\n"
+}
+
+
+
+
+#=== MAIN ===
+my $ret=system("which xmllint > /dev/null");
+if($ret != 0){
+ print STDERR "It need xmllint. Please install it.\n";
+ exit 1;
+}
+
+if(2 != @ARGV){
+ usage();
+ exit 1;
+}
+
+my $infile=$ARGV[0];
+my $launchfile=$ARGV[1];
+
+
+#ARG CHECK
+if($infile !~ /.+\.order$/){
+ print STDERR "$infile is not *.order\n";
+ exit 1;
+}elsif(! -e $infile){
+ print "$infile not found\n";
+ usage();
+ exit 1;
+}
+
+if($launchfile !~ /.+\.cfg$/){
+ print STDERR "$launchfile is not *.cfg\n";
+ exit 1;
+}elsif(! -e $launchfile){
+ print "$launchfile not found\n";
+ usage();
+ exit 1;
+}
+
+
+system("cp -f $infile $body_file");
+
+#check xml vaild
+$ret=system("xmllint --noout --valid $main_file");
+if($ret != 0){
+ print STDERR "XML is Invalid. \n";
+ exit 1;
+}
+
+my $date=`LANG=en date`;
+print "# This file is created from $infile and $launchfile\n";
+print "# created date : $date\n";
+
+my %gnamemap;
+my %gidmap;
+
+open(FIN,"<$launchfile") or die("error :$!");
+while (my $line = <FIN>){
+ if($line =~ /^Launch/){
+ $line =~ s/^[^|]+=//g;
+ my @args = split(/\|/,$line);
+ $gnamemap{$args[0]}=$args[1];
+ $gidmap{$args[1]}=$args[0];
+ }
+}
+close(FIN);
+
+foreach my $key (sort{$a <=> $b} keys(%gidmap)){
+ print "#$key:$gidmap{$key}\n";
+}
+
+
+my $xml = XML::XPath->new(filename=>$main_file);
+
+my $orders = $xml->find('/launch_order/order');
+foreach my $order ($orders->get_nodelist) {
+ my $groups = $order->find('./group');
+
+ my $oname=$order->findvalue('@oname');
+ my $fixed_group=$order->findvalue('@fixed_group');
+
+ print "[$oname]\n";
+ print "order=";
+
+ my %l_gidmap = %gidmap;
+ my $sep="";
+ #fix groups
+ if($fixed_group ne "NULL"){
+ if(! exists $gnamemap{$fixed_group}){
+ die("$fixed_group not found");
+ }
+ foreach my $gid (sort{$a <=> $b} keys(%l_gidmap)){
+ print "$sep$gid";
+ $sep="|";
+ my $str=$l_gidmap{$gid};
+ delete $l_gidmap{$gid};
+ if($str eq $fixed_group){
+ last;
+ }
+ }
+ }
+
+ # re-order group via *.order
+ my %waitow;
+ foreach my $group ($groups->get_nodelist) {
+ my $gname=$group->findvalue('@gname');
+ my $waittime=XML::XPath::Number::value($group->findvalue('@waittime'));
+
+ my $gid=$gnamemap{$gname};
+
+ if(! exists $gnamemap{$gname}){
+ die("$oname:$gname is not defined");
+ }
+
+ if(! exists $l_gidmap{$gid}){
+ die("$oname:$gname is multiple defined");
+ }
+
+ print "$sep$gid";
+ $sep="|";
+ delete $l_gidmap{$gid};
+
+ if($waittime > 0){
+ $waitow{$gname} = $waittime;
+ }
+ }
+
+# Output waittime configuration
+
+ #out rest groups
+ foreach my $gid (sort{$a <=> $b} keys(%l_gidmap)){
+ print "$sep$gid";
+ $sep="|";
+ }
+
+ print "\n";
+ if(keys(%waitow) > 0 ){
+ print "owlist=";
+ $sep="";
+ foreach my $owgroup ( keys(%waitow)) {
+ print "${sep}oww_${owgroup}";
+ $sep="|";
+ }
+ print "\n";
+
+ foreach my $owgroup ( keys(%waitow)) {
+ print "oww_${owgroup}=$waitow{$owgroup}\n";
+ }
+
+
+ }
+ print "\n";
+}
+
+
+
+
+
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/order/system_launcher_main.order.cfg b/video_in_hal/systemservice/config/library/system_manager_config/order/system_launcher_main.order.cfg
new file mode 100755
index 0000000..dc49cd7
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/order/system_launcher_main.order.cfg
@@ -0,0 +1,3 @@
+# This file is created from launch_in.order and system_launcher_main.cfg
+# created date : Tue Aug 29 13:45:54 JST 2017
+
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/order/system_launcher_main.xml b/video_in_hal/systemservice/config/library/system_manager_config/order/system_launcher_main.xml
new file mode 100755
index 0000000..2dd97d9
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/order/system_launcher_main.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" ?>
+
+<!DOCTYPE system_launcher [
+ <!ELEMENT system_launcher (group+) >
+
+ <!ELEMENT group (launch+) >
+ <!ATTLIST group
+ name CDATA #REQUIRED
+ wait_time CDATA #REQUIRED
+ trigger (True|False) #REQUIRED
+ >
+
+ <!ELEMENT launch EMPTY >
+ <!ATTLIST launch
+ name CDATA #REQUIRED
+ path CDATA #REQUIRED
+ priority CDATA #REQUIRED
+ critical CDATA #REQUIRED
+ retry_cnt CDATA #REQUIRED
+ arguments CDATA #REQUIRED
+ logging_mask CDATA "NULL"
+ restart (me|NULL) #REQUIRED
+ is_start_required (True|False) #REQUIRED
+ shutdown_critical CDATA #REQUIRED
+ shutdown_wait_time CDATA #REQUIRED
+ fast_shutdown_wait_time CDATA #REQUIRED
+ user_name CDATA #REQUIRED
+ env_cond CDATA #IMPLIED
+ >
+
+ <!ENTITY system_launcher_body SYSTEM "system_launcher_body.xml">
+]>
+
+<system_launcher>
+ &system_launcher_body;
+</system_launcher>
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/src/Makefile b/video_in_hal/systemservice/config/library/system_manager_config/src/Makefile
new file mode 100755
index 0000000..9fbc9cc
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/src/Makefile
@@ -0,0 +1,45 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#HOST TOOLS
+INST_SHLIBS = libsssmcfg
+
+VPATH = ./ ../include/$(COMPONENT_NAME)
+
+INST_HEADERS = ss_system_manager_conf.h
+INST_HEADERS += ss_package.h
+INST_HEADERS += ss_access_if_private.h
+INST_HEADERS += system_manager_config.h
+
+libsssmcfg_SRCS = ss_system_manager_conf.cpp
+
+
+
+CPPFLAGS += -I../include
+
+LDFLAGS += -Wl,--no-as-needed
+
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lSS_RomAccessIf
+LDLIBS += -Wl,-Bdynamic -lssver
+
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lvp
+
+DUMMY_SHLIB += libSS_RomAccessIf.so
+DUMMY_SHLIB += libSS_SystemIfUnified.so
+
+include ../../../../system_service.mk
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/src/libsssmcfg.ver b/video_in_hal/systemservice/config/library/system_manager_config/src/libsssmcfg.ver
new file mode 100755
index 0000000..4d61996
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/src/libsssmcfg.ver
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libsssmcfg version script
+#
+{
+ global:
+ ### .text section ###
+ extern "C++" {
+ ss_sm_initHook*;
+ ss_sm_avilavbilityHook*;
+ };
+ local:
+ *;
+};
+
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/src/ss_system_manager_conf.cpp b/video_in_hal/systemservice/config/library/system_manager_config/src/ss_system_manager_conf.cpp
new file mode 100755
index 0000000..16ec02a
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/src/ss_system_manager_conf.cpp
@@ -0,0 +1,489 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fstream>
+#include <string.h>
+#include <agl_thread.h>
+#include <other_service/VP_GetEnv.h>
+
+#include <system_service/ss_templates.h>
+#include <system_service/ss_sm_ram_access.h>
+#include <system_service/ss_ver.h>
+
+#include "system_service/ss_package.h"
+#include "system_service/ss_access_if_private.h"
+#include "system_service/ss_system_manager_conf.h"
+
+#ifndef ZONE_WARN
+#define ZONE_WARN ZONEMASK(30)
+#endif
+#ifndef ZONE_INFO
+#define ZONE_INFO ZONEMASK(29)
+#endif
+
+/* Environment variable name */
+const CHAR LaunchConfigFileNameEnvVariable[] = "APPS_CONFIG_FILENAME";
+const CHAR AreaTypeEnvVariable[] = "VEHICLEPARAMETERLIBRARY_AREA";
+const CHAR BrandTypeEnvVariable[] = "VEHICLEPARAMETERLIBRARY_BRAND";
+const CHAR GradeEnvVariable[] = "VP_VEHICLEPARAMETERLIBRARY_grade";
+
+/* Environment variable value */
+const CHAR EnvValueYes[] = "y";
+const CHAR EnvValueNo[] = "n";
+
+const CHAR EnvValueAvailable[] = "available";
+const CHAR EnvValueUnavailable[] = "unavailable";
+
+/*
+ * Note.
+ * Define areas, brands, and grades by the vendor.
+ * For example, an area is a destination of a product.
+ * Examples of areas : JP(Japan), EU, etc.
+ */
+const CHAR EnvValueArea1[] = "Area1";
+const CHAR EnvValueArea2[] = "Area2";
+const CHAR EnvValueArea3[] = "Area3";
+const CHAR EnvValueArea4[] = "Area4";
+const CHAR EnvValueBrand1[] = "Brand1";
+const CHAR EnvValueBrand2[] = "Brand2";
+const CHAR EnvValueGrade1[] = "Grade1";
+const CHAR EnvValueGrade2[] = "Grade2";
+const CHAR EnvValueGrade3[] = "Grade3";
+
+/* Package information */
+const CHAR PkgInfoGen2[] = "Gen2";
+
+
+typedef struct T_SS_SM_CONF_CTX {
+ EFrameworkunifiedStatus (*cbRebootNoticeFunc)(HANDLE hApp);
+ T_SS_SM_CONF_CTX()
+ : cbRebootNoticeFunc(NULL) {
+ }
+} T_SS_SM_CONF_CTX_INFO;
+
+static T_SS_SM_CONF_CTX_INFO s_confCtx;
+
+/***********************************************************************
+ * registProtectSvcs
+ ***********************************************************************/
+static void registProtectSvcs(std::vector<std::string> & protectedSvcs) {
+ protectedSvcs.push_back(MN_NS_SHAREDMEM);
+ protectedSvcs.push_back(MN_NS_NPPSERVICE);
+ protectedSvcs.push_back(MN_NS_BACKUPMGR);
+ protectedSvcs.push_back(MN_SS_LOGGERSRV);
+ protectedSvcs.push_back(MN_COMMUNICATION);
+ protectedSvcs.push_back(MN_PS_PSMSHADOW);
+ protectedSvcs.push_back(MN_SS_POWERSERVICE);
+}
+
+/***********************************************************************
+ * registGroupRelaunchSvcs
+ ***********************************************************************/
+static void registGroupRelaunchSvcs(
+ std::vector<std::string> & groupRelaunchSvcs) {
+ groupRelaunchSvcs.push_back(MN_ENFORMSERVICE);
+ groupRelaunchSvcs.push_back(MN_NAVIPROXY);
+ groupRelaunchSvcs.push_back(MN_AWBPROXY);
+ groupRelaunchSvcs.push_back(MN_TFFPROXY);
+ groupRelaunchSvcs.push_back(MN_AWNPRIMARY);
+ groupRelaunchSvcs.push_back(MN_AWMPRIMARY);
+ groupRelaunchSvcs.push_back(MN_AWBPRIMARY);
+ groupRelaunchSvcs.push_back(MN_AWTPRIMARY);
+}
+
+/***********************************************************************
+ * setEvnVariableForLaunchConfigFile
+ ***********************************************************************/
+static EFrameworkunifiedStatus setEvnVariableForLaunchConfigFile(std::string f_sEnvFile,
+ std::string f_sEnvBrand,
+ std::string f_sEnvGrade,
+ BOOL f_bIsVup) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ const CHAR VupLaunchConfigFileName[] = "sm_launch_vup.cfg";
+ const CHAR LaunchConfigFileName1[] = "sm_launch.cfg";
+ const CHAR LaunchConfigFileName2[] = "sm_launch.cfg";
+
+ // If an environment variable is set, that value is used, so set only when it is not set
+ if (f_sEnvFile.empty()) {
+ const CHAR *l_pLaunchConfigFile = NULL;
+
+ if (f_bIsVup) {
+ l_pLaunchConfigFile = VupLaunchConfigFileName;
+ } else {
+ // Change the file read by Brand and Grade
+ if ((f_sEnvBrand == EnvValueBrand2) && (f_sEnvGrade != EnvValueGrade1)) {
+ l_pLaunchConfigFile = LaunchConfigFileName1;
+ } else {
+ l_pLaunchConfigFile = LaunchConfigFileName2;
+ }
+
+ std::string cnfPath = "/usr/agl/conf/BS/ss/system_manager/rwdata/";
+ cnfPath += l_pLaunchConfigFile;
+ if (access(cnfPath.c_str(), F_OK) != 0) {
+ l_pLaunchConfigFile = LaunchConfigFileName1;
+ }
+ }
+
+ if (0 != setenv(LaunchConfigFileNameEnvVariable, l_pLaunchConfigFile, 1)) {
+ SS_ASERT_ERRNO(0);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ return l_eStatus;
+}
+
+/***********************************************************************
+ * setEvnVariableForLaunchCus
+ ***********************************************************************/
+static EFrameworkunifiedStatus setEvnVariableForLaunchCus(std::string f_sEnvArea) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ const CHAR LaunchCusEnvVariable[] = "SM_CONF_LAUNCH_CUS";
+
+ const CHAR *l_pSetValue =
+ (EnvValueArea1 == f_sEnvArea || EnvValueArea2 == f_sEnvArea) ?
+ EnvValueYes : EnvValueNo;
+
+ if (0 != setenv(LaunchCusEnvVariable, l_pSetValue, 1)) {
+ SS_ASERT_ERRNO(0);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+/***********************************************************************
+ * setEvnVariableForLaunchTFF
+ ***********************************************************************/
+static EFrameworkunifiedStatus setEvnVariableForLaunchTFF(std::string f_sEnvArea) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ const CHAR LaunchTFFEnvVariable[] = "SM_CONF_LAUNCH_TFF";
+
+ const CHAR *l_pSetValue = EnvValueNo;
+
+ BOOL l_bArea1 = (f_sEnvArea == EnvValueArea1) ? TRUE : FALSE;
+ BOOL l_bArea2 = (f_sEnvArea == EnvValueArea2) ? TRUE : FALSE;
+
+ if (l_bArea1 || l_bArea2) {
+ l_pSetValue = EnvValueYes;
+ } else {
+ l_pSetValue = EnvValueNo;
+ }
+
+ if (0 != setenv(LaunchTFFEnvVariable, l_pSetValue, 1)) {
+ SS_ASERT_ERRNO(0);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+/***********************************************************************
+ * getEnvValiavleWithDefault
+ ***********************************************************************/
+static std::string getEnvValiavleWithDefault(const CHAR *f_pEnvName,
+ const CHAR *f_pDefault) {
+ std::string l_sReturnValue;
+ char buf[VP_MAX_LENGTH];
+
+ VP_GetEnv(f_pEnvName, buf);
+ if (buf[0] == '\0') {
+ l_sReturnValue = (NULL != f_pDefault) ? f_pDefault : "";
+ } else {
+ l_sReturnValue = buf;
+ }
+ return l_sReturnValue;
+}
+
+
+/***********************************************************************
+ * getPkgInfoWithDefault
+ ***********************************************************************/
+static std::string
+getPkgInfoWithDefault(const CHAR *f_pPkgName, const CHAR *f_pDefault){
+ std::string l_sReturnValue = (NULL != f_pDefault) ? f_pDefault : "";
+
+ try {
+ SSVER_PkgInfo pkgInfo = {0};
+ CSSVer cVersion;
+
+ if(!cVersion.empty()){
+ EFrameworkunifiedStatus ret = cVersion.getPkgInfo(f_pPkgName, &pkgInfo);
+ if((ret == eFrameworkunifiedStatusOK) && ('\0' != pkgInfo.version[0])){
+ l_sReturnValue = pkgInfo.version;
+ }
+ }
+ } catch(EFrameworkunifiedStatus ee){
+ SS_ASERT(0);
+ }
+
+ return l_sReturnValue;
+}
+
+/***********************************************************************
+ * setEvnVariableForPkgSeriesInfo
+ ***********************************************************************/
+static EFrameworkunifiedStatus
+setEvnVariableForPkgSeriesInfo(std::string f_sPkgSeriesInfo){
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ const CHAR PkgSeriesEnvVariable[] = "SM_CONF_PKG_SERIES";
+
+ if (f_sPkgSeriesInfo.empty()) {
+ SS_ASERT(0);
+ }
+
+ if (0 != setenv(PkgSeriesEnvVariable, f_sPkgSeriesInfo.c_str(), 1)) {
+ SS_ASERT_ERRNO(0);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+/***********************************************************************
+ * setVersionInfo subfunction(version,date settings)
+ ***********************************************************************/
+static EFrameworkunifiedStatus setVerInfo_version_date(const char* VerPath) {
+ EFrameworkunifiedStatus configRet = eFrameworkunifiedStatusOK;
+ CSSVer ver;
+ SSVER_PkgInfo pkgInfo;
+
+ bzero(&pkgInfo, sizeof(pkgInfo));
+ std::string line;
+ std::ifstream verFin(VerPath);
+ if (verFin) {
+ if (std::getline(verFin, line)) {
+ snprintf(pkgInfo.version, sizeof(pkgInfo.version), "%s",
+ line.c_str());
+ }
+
+ if (std::getline(verFin, line)) {
+ snprintf(pkgInfo.date, sizeof(pkgInfo.date), "%s", line.c_str());
+ }
+
+ configRet = ver.setPkgInfo(SS_PKG_MAIN_LPF_SI, pkgInfo);
+ SS_ASERT(configRet == eFrameworkunifiedStatusOK);
+ } else {
+ SS_ASERT_ERRNO(0);
+ }
+ return configRet;
+}
+
+/***********************************************************************
+ * Set version information
+ ***********************************************************************/
+static EFrameworkunifiedStatus setVersionInfo(void) {
+ EFrameworkunifiedStatus configRet = eFrameworkunifiedStatusOK;
+
+ try {
+ CSSVer ver;
+ SSVER_PkgInfo pkgInfo;
+ const char targetEnv[] = "TARGET_BOARD";
+
+ // HARDWARE
+ snprintf(pkgInfo.version, sizeof(pkgInfo.version), "%s",
+ getEnvValiavleWithDefault(targetEnv, NULL).c_str());
+ pkgInfo.date[0] = '\0';
+ configRet = ver.setPkgInfo(SS_PKG_TARGETBOARD, pkgInfo);
+ SS_ASERT(configRet == eFrameworkunifiedStatusOK);
+
+ // Set PRODUCT version information
+ const char prdVersion[] = "/usr/agl/share/BS/ss/system_manager/rodata/version.txt";
+ {
+ std::string line;
+ std::ifstream prdFin(prdVersion);
+ if (prdFin) {
+ bzero(&pkgInfo, sizeof(pkgInfo));
+ if (std::getline(prdFin, line)) {
+ snprintf(pkgInfo.version, sizeof(pkgInfo.version), "%s",
+ line.c_str());
+ }
+ configRet = ver.setPkgInfo(SS_PKG_MAIN_EMMC, pkgInfo);
+ SS_ASERT(configRet == eFrameworkunifiedStatusOK);
+
+ bzero(&pkgInfo, sizeof(pkgInfo));
+ if (std::getline(prdFin, line)) {
+ snprintf(pkgInfo.version, sizeof(pkgInfo.version), "%s",
+ line.c_str());
+ }
+ configRet = ver.setPkgInfo(SS_PKG_MAIN_PRODUCT_SI, pkgInfo);
+ SS_ASERT(configRet == eFrameworkunifiedStatusOK);
+ } else {
+ SS_ASERT_ERRNO(0);
+ }
+ }
+
+ // PHASE_INFO
+ const char phaseVersion[] = "/usr/agl/share/BS/ss/system_manager/rodata/PhaseInfo.txt";
+ {
+ configRet = setVerInfo_version_date(phaseVersion);
+ }
+
+ } catch (EFrameworkunifiedStatus ee) {
+ SS_ASERT(0);
+ configRet = ee;
+ }
+ return configRet;
+}
+
+// If _CWORD83_ common header is added, replace with century definition
+#define NTFY_PSMShadowService_Availability MN_PS_PSMSHADOW"/Availability"
+
+EFrameworkunifiedStatus cbPsmNotificationFunc(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (MSG_PSM_REBOOT_NOTIFY != FrameworkunifiedGetMsgProtocol(hApp)) {
+ SS_ASERT(0);
+ goto ERROR;
+ }
+
+ if (NULL != s_confCtx.cbRebootNoticeFunc) {
+ l_eStatus = s_confCtx.cbRebootNoticeFunc(hApp);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ SS_ASERT(0);
+ goto ERROR;
+ }
+ } else {
+ SS_ASERT(0);
+ goto ERROR;
+ }
+
+ERROR:
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus cbServiceNotificationFunc(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ PCSTR l_availabilityName;
+ BOOL l_serviceAvailability;
+
+ l_availabilityName = FrameworkunifiedGetLastNotification(hApp);
+ if (l_availabilityName == NULL) {
+ SS_ASERT(0);
+ goto ERROR;
+ }
+ l_serviceAvailability = FrameworkunifiedIsServiceAvailable(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s : %s", l_availabilityName,
+ l_serviceAvailability ? "TRUE" : "FALSE");
+
+ // Since it is necessary to guarantee SYNC of RAMD at _CWORD71_
+ // within 200msec after receiving reboot notice from SYS mcu,
+ // do UMOUNT RAMD immediately after receiving reboot notice by SystemManager.
+ if ((strcmp(NTFY_PSMShadowService_Availability, l_availabilityName) == 0)
+ && (l_serviceAvailability)) {
+ l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE,
+ MSG_PSM_REBOOT_NOTIFY,
+ cbPsmNotificationFunc);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ SS_ASERT(0);
+ goto ERROR;
+ }
+ }
+
+ERROR:
+ return l_eStatus;
+}
+
+/***********************************************************************
+ * ss_sm_initHook
+ ***********************************************************************/
+EFrameworkunifiedStatus ss_sm_initHook(HANDLE hApp, const T_SS_SM_INIT_HOOK_IN_PARAM *inPrm,
+ T_SS_SM_INIT_HOOK_OUT_PARAM *outPrm) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_sEnvFile;
+ std::string l_sEnvArea;
+ std::string l_sEnvBrand;
+ std::string l_sEnvGrade;
+
+ std::string l_sPkgSeriesInfo;
+
+ // Register non-recoverable services for OOM Killer
+ registProtectSvcs(outPrm->protectedSvcs);
+
+ // Register services for Group Relaunch
+ registGroupRelaunchSvcs(outPrm->groupRelaunchSvcs);
+
+ if (NULL == inPrm->cbRebootNoticeFunc) {
+ SS_ASERT(0);
+ } else {
+ s_confCtx.cbRebootNoticeFunc = inPrm->cbRebootNoticeFunc;
+ }
+
+ /** Set Version information **/
+ if (eFrameworkunifiedStatusOK != setVersionInfo()) {
+ SS_ASERT(0);
+ }
+
+ /** Get environment variable **/
+
+ // APPS_CONFIG_FILENAME (not set by default)
+ l_sEnvFile = getEnvValiavleWithDefault(LaunchConfigFileNameEnvVariable, NULL);
+
+ // VEHICLEPARAMETERLIBRARY_AREA
+ l_sEnvArea = getEnvValiavleWithDefault(AreaTypeEnvVariable, EnvValueArea1);
+
+ // VEHICLEPARAMETERLIBRARY_BRAND
+ l_sEnvBrand = getEnvValiavleWithDefault(BrandTypeEnvVariable, NULL);
+
+ // VEHICLEPARAMETERLIBRARY_grade
+ l_sEnvGrade = getEnvValiavleWithDefault(GradeEnvVariable, NULL);
+
+
+ /** Get Package information **/
+
+ // SERIES_INFO
+ l_sPkgSeriesInfo = getPkgInfoWithDefault(SS_PKG_SERIES_INFO, NULL);
+
+
+ /** Set environment variable **/
+ // APPS_CONFIG_FILENAME
+ if (eFrameworkunifiedStatusOK
+ != setEvnVariableForLaunchConfigFile(l_sEnvFile, l_sEnvBrand,
+ l_sEnvGrade, inPrm->bIsVupMode)) {
+ SS_ASERT(0);
+ }
+
+ // SM_CONF_PKG_SERIES
+ if (eFrameworkunifiedStatusOK != setEvnVariableForPkgSeriesInfo(l_sPkgSeriesInfo)) {
+ SS_ASERT(0);
+ }
+
+
+ // SM_CONF_LAUNCH_CUS
+ if (eFrameworkunifiedStatusOK != setEvnVariableForLaunchCus(l_sEnvArea)) {
+ SS_ASERT(0);
+ }
+
+ // SM_CONF_LAUNCH_TFF
+ if (eFrameworkunifiedStatusOK
+ != setEvnVariableForLaunchTFF(l_sEnvArea)) {
+ SS_ASERT(0);
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(
+ hApp, NTFY_PSMShadowService_Availability, cbServiceNotificationFunc))) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error: FrameworkunifiedSubscribeNotificationWithCallback(" "hApp, %s) errored: %d/'%s'",
+ NTFY_PSMShadowService_Availability, l_eStatus, GetStr(l_eStatus).c_str());
+ }
+
+ return l_eStatus;
+}
+
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/xml/Makefile b/video_in_hal/systemservice/config/library/system_manager_config/xml/Makefile
new file mode 100755
index 0000000..e11288c
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/xml/Makefile
@@ -0,0 +1,53 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#HOST TOOLS
+HOST_CPP = cpp
+HOST_LAUNCH_XML2CFG = ./launch_xml2cfg.sh
+
+CONF_DIR = $(SDKTARGETSYSROOT)/usr/agl/conf
+CONF_THREAD_H = $(SDKTARGETSYSROOT)/usr/agl/include/agl_thread.h
+
+LAUNCH_XMLFILES = $(shell cd $(CONF_DIR)/sm_launch; ls *.xml)
+LAUNCH_CFGFILES = $(LAUNCH_XMLFILES:%.xml=%.cfg)
+
+INST_CONFDIR = $(SDKTARGETSYSROOT)/usr/agl/conf/systemmanager
+
+CLEAN_FILES = system_launcher_body.xml $(LAUNCH_CFGFILES)
+
+VPATH = $(CONF_DIR)/sm_launch
+
+install:install-pre install-cfg
+
+install-pre:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf;\
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/sm_launch;\
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/systemmanager;\
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/sm_launch sm_launch_agl.xml
+
+install-cfg:$(LAUNCH_CFGFILES)
+ set -e ;\
+ install -d -m 775 $(INST_CONFDIR) ;\
+ for cfgfile in $(LAUNCH_CFGFILES);do \
+ install -m 644 -t $(INST_CONFDIR) $$cfgfile;\
+ done ;\
+
+#Create CFG file
+# %.cfg:%.xml # defined in agl.mk
+
+PHONY:install-cfg
+
+include ../../../../system_service.mk
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh b/video_in_hal/systemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh
new file mode 100755
index 0000000..57b6ee2
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+#
+# Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+export infile=$1
+export g_group=1
+
+if ! [[ "$infile" =~ .+\.cfg ]] ;then
+ echo "$infile is not *.cfg"
+ exit 1
+elif ! [ -e $infile ];then
+ echo "$infile not found"
+ exit 1
+fi
+
+#GROUP extraction
+cat ${infile} | while read line
+do
+ if ! [[ "${line}" =~ ^[#\[] ]]; then #Remove first #[
+ echo $line | sed 's/Launch[0-9]\+=//g' | cut -d '|' -f1-4
+ fi
+done | uniq | while read line
+do
+ echo "<!-- group_id=$g_group -->"
+ echo "<group name=\"`echo $line | cut -d '|' -f1`\" wait_time=\"`echo $line | cut -d '|' -f3`\" trigger=\"`echo $line | cut -d '|' -f4`\" >"
+
+ cat ${infile} | while read line
+ do
+ if ! [[ "${line}" =~ ^[#\[] ]]; then #Remove first #[
+ l_group=`echo $line | sed 's/Launch[0-9]\+=//g' | cut -d '|' -f2`
+
+ #Extract only LAUNCH applicable to g_group
+ if [ ${l_group} = ${g_group} ]; then
+ echo $line | sed 's/Launch[0-9]\+=//g' | cut -d '|' -f5-
+ fi
+ fi
+ done | while read line
+ do
+ echo " <launch "
+ echo " name=\"`echo $line | cut -d '|' -f1`\" path=\"`echo $line | cut -d '|' -f2`\" priority=\"`echo $line | cut -d '|' -f3`\""
+ echo " critical=\"`echo $line | cut -d '|' -f4`\" retry_cnt=\"`echo $line | cut -d '|' -f5`\" arguments=\"`echo $line | cut -d '|' -f6`\""
+ echo " logging_mask=\"`echo $line | cut -d '|' -f7`\" restart=\"`echo $line | cut -d '|' -f8`\" is_start_required=\"`echo $line | cut -d '|' -f9`\""
+ echo " shutdown_critical=\"`echo $line | cut -d '|' -f10`\" shutdown_wait_time=\"`echo $line | cut -d '|' -f11`\" fast_shutdown_wait_time=\"`echo $line | cut -d '|' -f12`\""
+ echo " user_name=\"`echo $line | cut -d '|' -f13`\""
+ echo " />"
+ done
+
+ echo "</group>"
+
+ g_group=$(($g_group + 1))
+done
+
+
+
+
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh b/video_in_hal/systemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh
new file mode 100755
index 0000000..20fa097
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh
@@ -0,0 +1,116 @@
+#!/bin/bash
+
+#
+# Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#xpath is slow, so use sed as much as possible
+
+infile=$1
+
+main_file=system_launcher_main.xml
+body_file=system_launcher_body.xml
+
+
+#check xmllint is exist
+if ! which xmllint > /dev/null ; then
+ echo "It need xmllint. Please install it."
+ exit 1;
+fi
+
+#check xpath is exist
+if ! which xpath > /dev/null ; then
+ echo "It need xpath Please install it."
+ exit 1;
+fi
+
+#arg check
+if ! [[ "$infile" =~ .+\.xml ]] ;then
+ echo "$infile is not *.xml"
+ exit 1
+elif ! [ -e $infile ];then
+ echo "$infile not found"
+ exit 1
+fi
+
+cp -f $infile $body_file
+
+#check xml vaild
+if ! xmllint --noout --valid $main_file ;then
+ echo "XML is Invalid. "
+ exit 1;
+fi
+
+#Read into memory after shaping with xpath
+xmem=`xpath -q -e /system_launcher $main_file`
+
+echo "# This file is created from $infile."
+echo "# created date : `LANG=en date`"
+echo "[ModulesLaunchConfig]"
+
+#GROUP LOOP
+group_num=`echo $xmem | xpath -e /system_launcher/group 2>&1 | grep Found | cut -d ' ' -f2`
+
+l_idx=1
+cur_group=1
+until [ $cur_group -gt $group_num ];
+do
+ #LAUNCH LOOP
+ group_text=`echo $xmem | xpath -q -e /system_launcher/group[$cur_group]` #group full XML text
+ group_attr=`echo $group_text | sed 's/\(<group[^>]\+>\)\(.*\)/\1/g'`
+
+ g_name=`echo $group_attr | sed 's/\(.* name="\)\([^"]*\)\(.*\)/\2/g'`
+ g_wait_time=`echo $group_attr | sed 's/\(.* wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ g_trigger=`echo $group_attr | sed 's/\(.* trigger="\)\([^"]*\)\(.*\)/\2/g'`
+
+# echo $g_name $g_wait_time $g_trigger
+ l_launch_num=`echo $xmem | xpath -e /system_launcher/group[$cur_group]/launch 2>&1 | grep Found | cut -d ' ' -f2`
+
+ cur_launch=1;
+ until [ $cur_launch -gt $l_launch_num ]; do
+ launch_text=`echo $xmem | xpath -q -e /system_launcher/group[$cur_group]/launch[$cur_launch]`
+
+ l_attr="Launch${l_idx}=$g_name|$cur_group|$g_wait_time|$g_trigger"
+ l_attr+="|"`echo $launch_text | sed 's/\(.* name="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* path="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* priority="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* critical="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* retry_cnt="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* arguments="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* logging_mask="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* restart="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* is_start_required="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* shutdown_critical="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* shutdown_wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* fast_shutdown_wait_time="\)\([^"]*\)\(.*\)/\2/g'`
+ l_attr+="|"`echo $launch_text | sed 's/\(.* user_name="\)\([^"]*\)\(.*\)/\2/g'`
+ if echo "$launch_text" | grep -sq 'env_cond=' ; then
+ l_attr+="|"`echo $launch_text | sed 's/\(.* env_cond="\)\([^"]*\)\(.*\)/\2/g'`
+ else
+ l_attr+="|"
+ fi
+
+ echo $l_attr
+
+ cur_launch=$(($cur_launch+1))
+ l_idx=$(($l_idx+1))
+ done
+
+ cur_group=$(($cur_group+1))
+done
+
+
+
+
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg b/video_in_hal/systemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg
new file mode 100755
index 0000000..876ab41
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg
@@ -0,0 +1,7 @@
+# This file is created from sm_launch_agl.xml.tmp.
+# created date : Tue Aug 29 13:31:32 JST 2017
+[ModulesLaunchConfig]
+Launch1=CoreModules|1|0|False|NS_NPPService|/usr/agl/bin/NS_NPPService|25|True|0|-a SS_SysManager -r output=0x2|NULL|NULL|False|True|20|1000||
+Launch2=CoreModules|1|0|False|NS_BackupMgr|/usr/agl/bin/NS_BackupMgr|25|True|0|-l console|NULL|NULL|True|True|15|1000||
+Launch3=SS_Logger|2|0|False|SS_DevDetectSrv|/tmp/SS_DeviceDetectionService|20|True|0|-l console|NULL|NULL|True|False|1|1000||
+Launch4=SS_Logger|2|0|False|SS_LoggerSrv|/usr/agl/bin/SS_LoggerService|0|True|0|-l console -p thrd=pdg.LogQueReader:30,thrd=pdg.TransmitQueReader:30,thrd=pdg.DumpQueReader:11,thrd=pdg.PerformanceQueReader:11,thrd=pdg.LogQueWriter:30,thrd=pdg.TransmitQueWriter:30,thrd=pdg.EvntLogQue:8,thrd=pdg.UdpQueWriter:10|NULL|NULL|True|True|10|1000||
diff --git a/video_in_hal/systemservice/config/library/system_manager_config/xml/sm_launch_agl.xml b/video_in_hal/systemservice/config/library/system_manager_config/xml/sm_launch_agl.xml
new file mode 100755
index 0000000..a433be3
--- /dev/null
+++ b/video_in_hal/systemservice/config/library/system_manager_config/xml/sm_launch_agl.xml
@@ -0,0 +1,35 @@
+<!-- group_id=1 -->
+<group name="CoreModules" wait_time="0" trigger="False" >
+ <launch
+ name="NS_NPPService" path="/usr/agl/bin/NS_NPPService" priority="25"
+ critical="True" retry_cnt="0" arguments="-a SS_SysManager -r output=0x2"
+ logging_mask="NULL" restart="NULL" is_start_required="False"
+ shutdown_critical="True" shutdown_wait_time="20" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+ <launch
+ name="NS_BackupMgr" path="/usr/agl/bin/NS_BackupMgr" priority="25"
+ critical="True" retry_cnt="0" arguments="-l console"
+ logging_mask="NULL" restart="NULL" is_start_required="True"
+ shutdown_critical="True" shutdown_wait_time="15" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+<!-- group_id=2 -->
+<group name="SS_Logger" wait_time="0" trigger="False" >
+ <launch
+ name="SS_DevDetectSrv" path="/tmp/SS_DeviceDetectionService" priority="20"
+ critical="True" retry_cnt="0" arguments="-l console"
+ logging_mask="NULL" restart="NULL" is_start_required="True"
+ shutdown_critical="False" shutdown_wait_time="1" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+ <launch
+ name="SS_LoggerSrv" path="/usr/agl/bin/SS_LoggerService" priority="0"
+ critical="True" retry_cnt="0" arguments="-l console -p thrd=pdg.LogQueReader:30,thrd=pdg.TransmitQueReader:30,thrd=pdg.DumpQueReader:11,thrd=pdg.PerformanceQueReader:11,thrd=pdg.LogQueWriter:30,thrd=pdg.TransmitQueWriter:30,thrd=pdg.EvntLogQue:8,thrd=pdg.UdpQueWriter:10"
+ logging_mask="NULL" restart="NULL" is_start_required="True"
+ shutdown_critical="True" shutdown_wait_time="10" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+
diff --git a/video_in_hal/systemservice/interface_unified/LICENSE b/video_in_hal/systemservice/interface_unified/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/systemservice/interface_unified/Makefile.client b/video_in_hal/systemservice/interface_unified/Makefile.client
new file mode 100755
index 0000000..de16e15
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/Makefile.client
@@ -0,0 +1,33 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := library
+
+install:install_cfg install_cfg_pram
+
+install_cfg_pram:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ss/system_manager/rwdata
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ss/system_manager/rwdata scfg_pram/gpf_ss_sm_config_data.cfg
+
+install_cfg:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ss/power_service/rodata
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ss/power_service/rodata scfg/gpf_ss_ps_config.cfg
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ss/logger_service/rodata
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ss/logger_service/rodata scfg/ss_logger.cfg
+
+include ../system_service.mk
+
+.PHONY:install_cfg install_cfg_pram
diff --git a/video_in_hal/systemservice/interface_unified/library/Makefile b/video_in_hal/systemservice/interface_unified/library/Makefile
new file mode 100755
index 0000000..e784550
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/Makefile
@@ -0,0 +1,127 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# installed shared library(.so)
+INST_SHLIBS := libSS_SystemIfUnified
+
+# compiled sources
+libSS_SystemIfUnified_SRCS := ss_framework_if.cpp \
+ ss_heartbeat_client.cpp \
+ ss_sm_client.cpp \
+ ss_string_maps.cpp \
+ ss_system_process.cpp \
+ ss_system_timer.cpp \
+ ss_last_to_order.cpp
+libSS_SystemIfUnified_SRCS += ss_devicedetection_service_ifc.cpp
+libSS_SystemIfUnified_SRCS += ss_logger_service_ifc.cpp
+libSS_SystemIfUnified_SRCS += ss_power_client.cpp \
+ ss_pwrsvc_if.cpp
+
+# additional source path
+VPATH += ./src
+VPATH += ./include/$(COMPONENT_NAME)
+
+# installed headers
+INST_HEADERS = interface_unified.h
+INST_HEADERS += interfaceunified_system_application.h \
+ interfaceunified_system_types.h \
+ ss_client_names.h \
+ ss_devicedetection_service.h \
+ ss_devicedetection_service_ifc.h \
+ ss_devicedetection_service_notifications.h \
+ ss_devicedetection_service_protocol.h \
+ ss_devicedetection_service_types.h \
+ ss_error_event_common.h \
+ ss_error_message.h \
+ ss_heartbeat_if.h \
+ ss_heartbeat_notifications.h \
+ ss_heartbeat_service_protocol.h \
+ ss_logger_service.h \
+ ss_logger_service_ifc.h \
+ ss_logger_service_notifications.h \
+ ss_logger_service_protocol.h \
+ ss_power_service_if.h \
+ ss_power_service_notifications.h \
+ ss_power_service_protocol.h \
+ ss_power_service.h \
+ ss_services.h \
+ ss_sm_client_if.h \
+ ss_sys_boot_area_map.h \
+ ss_sm_thread_names.h \
+ ss_string_maps.h \
+ ss_system_if.h \
+ ss_system_manager_if.h \
+ ss_system_manager_notifications.h \
+ ss_system_manager_protocol.h \
+ ss_system_process.h \
+ ss_system_timer.h \
+ ss_system_types.h \
+ ss_boot_map.h \
+ ss_templates.h \
+ ss_test_clients.h \
+ ss_version.h \
+ ss_last_to_order.h
+INST_HEADERS += ss_logger_store_logs.h
+INST_HEADERS += ss_devicedetection_service_local.h \
+ ss_devicedetection_service_protocol_local.h \
+ ss_devicedetection_service_types_local.h \
+ ss_error_event_common_local.h \
+ ss_sm_client_if_local.h \
+ ss_sm_thread_names_local.h \
+ ss_system_manager_if_local.h \
+ ss_system_manager_notifications_local.h \
+ ss_system_manager_protocol_local.h \
+ ss_logger_service_local.h \
+ ss_power_service_local.h \
+ ss_power_service_notifications_local.h
+
+
+
+# additional include path
+CPPFLAGS += -I./include/
+CPPFLAGS += -I../../rom_access_library/library/include/
+
+# additional compile option
+CPPFLAGS += -DLINUX -fdata-sections -ffunction-sections
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+
+CPPFLAGS_ss_devicedetection_service_ifc.os = -fno-exceptions
+CPPFLAGS_ss_logger_service_ifc.os = -fno-exceptions
+CPPFLAGS_ss_system_timer.os = -fno-exceptions
+CPPFLAGS_ss_string_maps.os = -fno-exceptions
+CPPFLAGS_ss_client_session.os = -fno-exceptions
+CPPFLAGS_ss_framework_if.os = -fno-exceptions
+CPPFLAGS_ss_ss_heartbeat_client.os = -fno-exceptions
+CPPFLAGS_ss_parameter.os = -fno-exceptions
+CPPFLAGS_ss_parameter_map.os = -fno-exceptions
+CPPFLAGS_ss_str_stream.os = -fno-exceptions
+CPPFLAGS_ss_system_config_reader.os = -fno-exceptions
+CPPFLAGS_ss_system_shared_memory.os = -fno-exceptions
+CPPFLAGS_ss_plm_if.os = -fno-exceptions
+CPPFLAGS_ss_power_client.os = -fno-exceptions
+CPPFLAGS_ss_pwrsvc_if.os = -fno-exceptions
+
+LDFLAGS += -Wl,--no-as-needed
+
+# linked libraries
+LDLIBS += -Wl,-Bdynamic
+LDLIBS += -Wl,-Bdynamic
+LDLIBS += -Wl,-Bdynamic -lstdc++
+
+LDFLAGS += -g -Wl,--gc-sections -shared
+
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h b/video_in_hal/systemservice/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h
new file mode 100755
index 0000000..62f32b9
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/ss_devicedetection_service_if_interfaceunifiedlog.h
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_DeviceDetection
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_DEVICEDETECTION_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_DEVICEDETECTION_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR
+#endif // FRAMEWORKUNIFIEDLOGAPPZONES
+
+extern const CHAR AppName[];
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_DEVICEDETECTION_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
diff --git a/video_in_hal/systemservice/interface_unified/library/include/ss_last_to_order_local.h b/video_in_hal/systemservice/interface_unified/library/include/ss_last_to_order_local.h
new file mode 100755
index 0000000..889a733
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/ss_last_to_order_local.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_last_to_order_local.h
+ * @brief \~english This file contains declaration of SS_LAST_TO_ORDER_CONF_PATH
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LAST_TO_ORDER_LOCAL_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LAST_TO_ORDER_LOCAL_H_
+
+#include <string>
+
+#define SS_LAST_TO_ORDER_CONF_PATH "/usr/agl/conf/BS/ss/system_manager/rodata/sm_last2order.cfo"
+
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LAST_TO_ORDER_LOCAL_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h b/video_in_hal/systemservice/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h
new file mode 100755
index 0000000..8989bf6
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/ss_logger_service_if_interfaceunifiedlog.h
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_Logger
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LOGGER_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LOGGER_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR
+#endif
+
+extern const CHAR AppName[];
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_LOGGER_SERVICE_IF_INTERFACEUNIFIEDLOG_H_
diff --git a/video_in_hal/systemservice/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h b/video_in_hal/systemservice/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h
new file mode 100755
index 0000000..d198030
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/ss_power_if_interfaceunifiedlog.h
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerServiceIf
+/// \brief This file supports 002 application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_POWER_IF_INTERFACEUNIFIEDLOG_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_POWER_IF_INTERFACEUNIFIEDLOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT, LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern const CHAR AppName[];
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_POWER_IF_INTERFACEUNIFIEDLOG_H_
diff --git a/video_in_hal/systemservice/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h b/video_in_hal/systemservice/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h
new file mode 100755
index 0000000..81ef016
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/ss_system_if_interfaceunifiedlog.h
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_IF_INTERFACEUNIFIEDLOG_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_IF_INTERFACEUNIFIEDLOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern const CHAR AppName[];
+
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_IF_INTERFACEUNIFIEDLOG_H_
diff --git a/video_in_hal/systemservice/interface_unified/library/include/ss_system_timer_local.h b/video_in_hal/systemservice/interface_unified/library/include/ss_system_timer_local.h
new file mode 100755
index 0000000..d694bdd
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/ss_system_timer_local.h
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_system_timer_local.h
+ * @brief \~english This file supports a generic timer abstraction.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_TIMER_LOCAL_H_
+#define INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_TIMER_LOCAL_H_
+
+enum {
+ NS_PER_MS = 1000000,
+ DEFAULT_TIMERID = 1000,
+ DEFAULT_NTIMERS = 10,
+};
+
+#endif // INTERFACE_UNIFIED_LIBRARY_INCLUDE_SS_SYSTEM_TIMER_LOCAL_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/interface_unified.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/interface_unified.h
new file mode 100755
index 0000000..a25423a
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/interface_unified.h
@@ -0,0 +1,100 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file interface_unified.h
+ * @brief \~english include all interface_unified head files
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+// include guard
+#ifndef SYSTEMSERVICE_INTERFACEUNIFIED_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_INTERFACEUNIFIED_H_
+
+#include "system_service/interfaceunified_system_application.h"
+#include "system_service/interfaceunified_system_types.h"
+#include "system_service/ss_boot_map.h"
+#include "system_service/ss_client_names.h"
+#include "system_service/ss_devicedetection_service.h"
+#include "system_service/ss_devicedetection_service_ifc.h"
+#include "system_service/ss_devicedetection_service_notifications.h"
+#include "system_service/ss_devicedetection_service_protocol.h"
+#include "system_service/ss_devicedetection_service_types.h"
+#include "system_service/ss_error_event_common.h"
+#include "system_service/ss_error_message.h"
+#include "system_service/ss_heartbeat_if.h"
+#include "system_service/ss_heartbeat_notifications.h"
+#include "system_service/ss_heartbeat_service_protocol.h"
+#include "system_service/ss_last_to_order.h"
+#include "system_service/ss_logger_service.h"
+#include "system_service/ss_logger_service_ifc.h"
+#include "system_service/ss_logger_service_notifications.h"
+#include "system_service/ss_logger_service_protocol.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_sm_client_if.h"
+#include "system_service/ss_sm_thread_names.h"
+#include "system_service/ss_string_maps.h"
+#include "system_service/ss_sys_boot_area_map.h"
+#include "system_service/ss_system_if.h"
+#include "system_service/ss_system_manager_if.h"
+#include "system_service/ss_system_manager_notifications.h"
+#include "system_service/ss_system_manager_protocol.h"
+#include "system_service/ss_system_process.h"
+#include "system_service/ss_system_timer.h"
+#include "system_service/ss_system_types.h"
+#include "system_service/ss_templates.h"
+#include "system_service/ss_test_clients.h"
+#include "system_service/ss_version.h"
+
+// reference from logger_store_logs
+#include "system_service/ss_logger_store_logs.h"
+
+// files with local
+// reference from device_detection_service
+#include "system_service/ss_devicedetection_service_local.h"
+#include "system_service/ss_devicedetection_service_protocol_local.h"
+#include "system_service/ss_devicedetection_service_types_local.h"
+// reference from system_manager
+#include "system_service/ss_error_event_common_local.h"
+#include "system_service/ss_sm_client_if_local.h"
+#include "system_service/ss_sm_thread_names_local.h"
+#include "system_service/ss_system_manager_if_local.h"
+#include "system_service/ss_system_manager_notifications_local.h"
+
+#include "system_service/ss_system_manager_protocol_local.h"
+// reference from logger_service
+#include "system_service/ss_logger_service_local.h"
+
+// reference from power_service
+#include "system_service/ss_power_service_if.h"
+#include "system_service/ss_power_service_notifications.h"
+#include "system_service/ss_power_service_protocol.h"
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_power_service_local.h"
+#include "system_service/ss_power_service_notifications_local.h"
+
+#endif // SYSTEMSERVICE_INTERFACEUNIFIED_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/interfaceunified_system_application.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/interfaceunified_system_application.h
new file mode 100755
index 0000000..fe5224e
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/interfaceunified_system_application.h
@@ -0,0 +1,219 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file interfaceunified_system_application.h
+ * @brief This file supports the System Manager AGL framework client
+ * interface.
+ */
+
+#ifndef INTERFACEUNIFIED_SYSTEM_APPLICATION_H_ // NOLINT (build/header_guard)
+#define INTERFACEUNIFIED_SYSTEM_APPLICATION_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#include <native_service/frameworkunified_types.h>
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup InterfaceunifiedSystemConnectToPowerSerivce
+ /// \~english @par Summary
+ /// Subscribe and attach call backs to notifications, to PowerSerivce!
+ /// \~english @param [in] hApp
+ /// HANDLE - App handle
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument.
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded
+ /// the maximum number of Notification.[eFrameworkunifiedStatusFail]
+ /// - The acquisition of the buffer for storing a plurality of information of
+ /// Notification Handler specified by the argument has failed. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue name of HANDLE specified in the argument (hApp)
+ /// is not appropriate(The name is NULL, more than 20byte) [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to the NPP Service.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message
+ /// for the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for the NPP Service.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Subscribe and attach call backs to notifications, to PowerSerivce! \n
+ /// if callback has not subscribe,resubscribe! \n
+ /// if callback has been subscribed,initialize!
+ /// \~english @see FrameworkunifiedGetAppName FrameworkunifiedSubscribeNotificationsWithCallback
+ ////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToPowerSerivce(HANDLE hApp);
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup InterfaceunifiedSystemConnectToPowerSerivce
+ /// \~english @par Summary
+ /// Called from framework for every app to start connection to HeartBeat
+ /// \~english @param [in] hApp
+ /// HANDLE - App handle, Handle to message queue of HeartBeat Service.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified
+ /// in the argument. [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded
+ /// the maximum number of Notification. [eFrameworkunifiedStatusFail]
+ /// - The acquisition of the buffer for storing a plurality of information of
+ /// Notification Handler specified by the argument has failed. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue name of HANDLE specified in the argument (hApp)
+ /// is not appropriate(The name is NULL, more than 20byte) [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+ // [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to the NPP Service.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of
+ /// the session message for the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to the NPP Service.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to the NPP Service.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message
+ /// for the NPP Service. [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Called from framework for every app to start connection to HeartBeat \n
+ /// if app has not connection,reconnection! \n
+ /// if app has been connectioned,initialize it!
+ /// \~english @see FrameworkunifiedGetAppName FrameworkunifiedAttachCallbacksToDispatcher
+ ////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToHeartBeatService(HANDLE hApp);
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup InterfaceunifiedSystemConnectToPowerSerivce
+ /// \~english @par Summary
+ /// Subscribe and attach callbacks to System Manager Service!
+ /// \~english @param [in] hApp
+ /// HANDLE - App handle.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - Pointer (pNtfyHandler) is NULL to the structure of
+ /// the Notification Handler specified in the argument. [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount)
+ /// has exceeded the maximum number of Notification. [eFrameworkunifiedStatusFail]
+ /// - The acquisition of the buffer for storing a plurality of information of
+ /// Notification Handler specified by the argument has failed. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of
+ /// the message for transmission (malloc). [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument message queue HANDLE in (hApp)
+ /// is not appropriate (which is invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue name of HANDLE specified in the argument (hApp)
+ /// is not appropriate(The name is NULL, more than 20byte) [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue type of HANDLE specified in the argument (hApp)
+ /// is not a transmission. [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to the NPP Service.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of
+ /// the session message for the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for
+ /// the NPP Service. [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Subscribe and attach callbacks to System Manager Service! \n
+ /// if app has not Subscribed,resubscribe!
+ /// \~english @see FrameworkunifiedGetAppName SystemManagerOpenSender
+ ////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToSystemManagerService(HANDLE hApp);
+
+/** @}*/
+/** @}*/
+/** @}*/
+
+
+#endif /* INTERFACEUNIFIED_SYSTEM_APPLICATION_H_ */ // NOLINT (build/header_guard)
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/interfaceunified_system_types.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/interfaceunified_system_types.h
new file mode 100755
index 0000000..d3d3abd
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/interfaceunified_system_types.h
@@ -0,0 +1,165 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file interfaceunified_system_types.h
+ * @brief \~english This file supports the System Manager audio source types.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef INTERFACEUNIFIED_SYSTEM_TYPES_H_ // NOLINT (build/header_guard)
+#define INTERFACEUNIFIED_SYSTEM_TYPES_H_
+
+
+typedef enum _SS_Sources {
+ SS_SOURCE_NA = 0,
+ SS_SOURCE_FM = 1, //## To be integrated into SS_SOURCE_AMFM for _CWORD71_
+ SS_SOURCE_AM = 2, //## To be integrated into SS_SOURCE_AMFM for _CWORD71_
+
+ SS_SOURCE_CD = 3, // For Audio CDs
+ SS_SOURCE_AUX = 4,
+
+ SS_SOURCE_PHONE = 5, // Will be deprecated soon, use specific Incoming or Outgoing call.
+ SS_SOURCE_TA = 6, // ## To be integrated into SS_SOURCE_AMFM for _CWORD71_
+ SS_SOURCE_CHIMES = 7,
+ SS_SOURCE_NAVI = 8,
+
+ SS_SOURCE_MSC = 9, ///< Any mass storage device (USB-MSC, SD, HDD etc.,)
+ SS_SOURCE_MTP = 10, ///< _CWORD104_, MTP protocol devices(like _CWORD28_ over USB)
+
+ SS_SOURCE__CWORD57_ = 11, // ## To be integrated into SS_SOURCE_USB and SS_SOURCE_USB2 for _CWORD71_
+
+ SS_SOURCE__CWORD73__APP = 12, ///< _CWORD73_ based audio application (_CWORD74_ over BT/USB) - _CWORD22_, _CWORD13_ etc.,
+ SS_SOURCE__CWORD73__VIDEO_MODE = 13, ///< _CWORD73_ Video Mode (_CWORD57_ playback)
+
+ SS_SOURCE_STREAMING = 14, ///< Streaming over Wi-fi
+ SS_SOURCE_BT_AUDIO = 15, ///< Bluetooth Audio
+ SS_SOURCE_BT_SPP = 16, ///< Bluetooth SPP based audio application (_CWORD28_/BB etc.,)
+
+ SS_SOURCE_SPEECH = 17, ///< Speech audio playback
+
+ SS_SOURCE_USB = SS_SOURCE_MSC, ///< will be deprecated soon
+
+ SS_SOURCE__CWORD59_ = 18,
+ SS_SOURCE_ADRM = 19,
+ SS_SOURCE__CWORD60_ = 20,
+ SS_SOURCE_ADRA = 21,
+
+
+ SS_SOURCE_INCOMING_CALL = SS_SOURCE_PHONE,
+
+ SS_SOURCE_PRIVATE_MODE_CALL = 24,
+
+ SS_SOURCE_HANDSFREE_SPEAKING = 25,
+
+ SS_SOURCE_FM_DAB = 29,
+ SS_SOURCE_SD_CARD = 30,
+ SS_SOURCE_SDARS = 31,
+ SS_SOURCE_BROWSER_ENT = 32,
+ SS_SOURCE_ML_ENT = 33,
+ SS_SOURCE_ML_INFO = 34,
+
+ SS_SOURCE_DATA_CD = 35, // For Data CDs
+
+ SS_SOURCE_TAS = 40, // TA on same frequency
+
+ SS_SOURCE_DTV = 41,
+ SS_SOURCE_DVD = 42,
+ SS_SOURCE_BD = 43,
+ SS_SOURCE_DELIVERY_APP = 44,
+ SS_SOURCE_ENTUNE_ENT = 45,
+ SS_SOURCE_HDD_AUDIO = 46,
+ SS_SOURCE_JOYFUL_TALK = 47,
+ SS_SOURCE_CLEARANCE_SONAR = 48, // Not used, To be deleted
+ SS_SOURCE_DSRC = 49,
+ SS_SOURCE_ENTUNE_INFO = 50, // Not used, To be deleted
+ SS_SOURCE_HELPNET = 51,
+ SS_SOURCE_OTV = 52,
+ SS_SOURCE_MIRACAST = 53,
+ SS_SOURCE_RSE = 54,
+ SS_SOURCE_INSIDER = 55,
+ SS_SOURCE_MAIL = 56,
+ SS_SOURCE_MAIL_RINGTONE = 57,
+ SS_SOURCE_BD_REAR = 58,
+ SS_SOURCE_HDMI_REAR = 59,
+ SS_SOURCE_SD_CARD_REAR = 60,
+ SS_SOURCE_MIRACAST_REAR = 61,
+ SS_SOURCE_USB_REAR = 62, // Not used, To be deleted
+ SS_SOURCE_DLNA_REAR = 63,
+ SS_SOURCE_BROWSER_INFO = 64,
+ SS_SOURCE_DSRC_ENT = 65,
+ SS_SOURCE_RECDATA_PLAY = 66,
+// add Source ##
+ SS_SOURCE_AMFM = SS_SOURCE_FM,
+ SS_SOURCE_DLNA = 67,
+ SS_SOURCE_USB2 = 68,
+// add interrupt audio source ##
+ SS_SOURCE_VDSP = 69,
+ SS_SOURCE_NAVI_VR = 70,
+ SS_SOURCE_STARTUPBGM = 71,
+ SS_SOURCE_STARTUPBGM_INIT = 72,
+ SS_SOURCE_MAIL_INFO = 73,
+
+ SS_SOURCE_DIAG = 74,
+ SS_SOURCE_MAYDAY = 75,
+ SS_SOURCE_DCM = 76,
+ SS_SOURCE_SD_VIDEO = 77,
+
+ SS_SOURCE_DELIVERY_APP_INFO = 78,
+
+ SS_SOURCE__CWORD27__INFO = 86,
+
+ // Declaration of special sources starting from 100
+ SS_SOURCE_POWER_OFF = 100 // Being used by Mode
+}SS_SOURCE, *PSS_SOURCE;
+
+
+typedef enum _SS_Zones {
+ SS_ZONE_NA = 0,
+ SS_ZONE_DRIVER = 1, ///< Zero/Driver zone
+ SS_ZONE_REAR1,
+ SS_ZONE_REAR2,
+ SS_ZONE_REAR3,
+ SS_ZONE_ALL
+}SS_ZONE, *PSS_ZONE;
+
+
+typedef enum E_AUDIO_PORT {
+ SS_AUDIO_INPUT_PORT_1 = 0x01, ///< Enum representing MCASP2
+ SS_AUDIO_INPUT_PORT_2 = 0x02, ///< Enum representing MCBSP
+ SS_AUDIO_INPUT_PORT_3 = 0x03, ///< Enum representing MCASP3
+ SS_AUDIO_INPUT_PORT_4 = 0x04, ///< Enum representing MCASP3
+ SS_AUDIO_INPUT_PORT_5 = 0x05 ///< Enum representing other port
+}SS_AUDIO_INPUT_PORT, *PSS_AUDIO_INPUT_PORT;
+
+typedef enum _SS_Device_Context {
+ SINGLE_CONTEXT = 0,
+ MULTI_CONTEXT = 1
+}SS_DEVICE_CONTEXT, *PSS_DEVICE_CONTEXT;
+
+#endif /* INTERFACEUNIFIED_SYSTEM_TYPES_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_boot_map.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_boot_map.h
new file mode 100755
index 0000000..364d5ed
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_boot_map.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ */
+#ifndef _SS_BOOT_MAP_H_ // NOLINT (build/header_guard)
+#define _SS_BOOT_MAP_H_
+
+#include <system_service/ss_sm_boot_access.h>
+
+#endif //_SS_BOOT_MAP_H_ // NOLINT (build/header_guard)
+
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_client_names.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_client_names.h
new file mode 100755
index 0000000..23604a1
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_client_names.h
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_client_names.h
+ * @brief This file supports contains the queue names of the client
+ * services that System Services needs to know about.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_CLIENT_NAMES_H_ // NOLINT (build/header_guard)
+#define SS_CLIENT_NAMES_H_
+
+#define SERVICE__CWORD69_ "_CWORD69_"
+#define SERVICE_AS_AUDIO "AS_AudioService"
+#define SERVICE_AS_MODE "AS_ModeService"
+#define SERVICE_BR_BROWSER "BR_BrowserService"
+#define SERVICE_CAN_SHADOW "VS_CANShadow"
+#define SERVICE__CWORD51__BT "_CWORD51__BT"
+#define SERVICE__CWORD51__DR "_CWORD51__DR"
+#define SERVICE_DAB "RS_Master_Tuner"
+#define SERVICE_HMI "HMI"
+#define SERVICE_HMI__CWORD46_ "HMI__CWORD46_Service"
+#define SERVICE_HMI__CWORD77_ "HMI__CWORD77_Service"
+#define SERVICE_IPC_MP_SHADOW "PS_IPC_MP_Shadow"
+#define SERVICE_KEY_HANDLER "PS_KeyHandler"
+#define SERVICE_MM_ICD "MM_ICDService"
+#define SERVICE_MM_MEDIA "MM_MediaService"
+#define SERVICE_MM__CWORD21_ "MM__CWORD21_Service"
+#define SERVICE_NAV "NAV_NavigationService"
+#define SERVICE_NAV_LOC "NAV_LocationService"
+#define SERVICE_NS_NPP "NS_NPPService"
+#define SERVICE_NS_SHARED_MEM "NS_SharedMem"
+#define SERVICE_NW_BT "NW_BluetoothService"
+#define SERVICE_NW_CONNECTION "NW_ConnectionService"
+#define SERVICE_NW_MESSAGING "NW_MessagingService"
+#define SERVICE_NW_PHONE "NW_PhoneService"
+#define SERVICE_NW_PHONE_BOOK "NW_PhoneBookService"
+#define SERVICE_PSM_SHADOW "PS_PSMShadow"
+#define SERVICE_PS_IPC "PS_IPC"
+#define SERVICE_PS_SWDL_SHADOW "PS_SoftwareUpdateShadow"
+#define SERVICE_SDARS "RS_XSDARSService"
+#define SERVICE_TUNER "RS_Radio"
+#define SERVICE_VS__CWORD85_ "VS__CWORD85_Service"
+#define SERVICE_VS_DIAG "VS_DiagService"
+#define SERVICE_VS_DIAG_DISP "DiagDispatcherService"
+#define SERVICE_VS_RVC "VS_RVCService"
+#define SERVICE_VS_VEHICLE "VS_VehicleService"
+
+#endif /* SS_CLIENT_NAMES_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service.h
new file mode 100755
index 0000000..134ab1f
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service.h
@@ -0,0 +1,640 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_devicedetection_service.h
+ * @brief This file supports the Device Detection service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup device_detection_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef _SS_DEVICEDETECTION_SERVER_H_ // NOLINT (build/header_guard)
+#define _SS_DEVICEDETECTION_SERVER_H_
+
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "system_service/ss_devicedetection_service_types.h"
+
+/**
+ * \~english The max size of the file path.
+ */
+#define FILEPATH_SIZE (256)
+
+/**
+ * \~english The max size of URL.
+ */
+#define URL_SIZE (256)
+
+/**
+ * \~english The max size of the device name.
+ */
+#define SS_DEV_DEVICE_NAME_SIZE (64)
+
+/**
+ * \~english The max size of the name.
+ */
+#define SS_DEV_NAME_SIZE (256)
+
+
+/**
+ * \~english Structure for FuseDAV info.
+ */
+typedef struct _FuseDAVInfo {
+ /**
+ * \~english FuseDAV server address
+ */
+ int8_t url[URL_SIZE]; // FuseDAV server address
+}SS_FuseDAVInfo;
+
+/**
+ * \~english Structure for USB device info.
+ */
+typedef struct _UsbInfo {
+ /**
+ * \~english Bus Number
+ */
+ uint8_t bus_no; // Bus Number
+ /**
+ * \~english Device Number
+ */
+ uint8_t dev_no; // Device Number
+ /**
+ * \~english Vendor ID
+ */
+ uint16_t idVendor; // Vendor ID
+ /**
+ * \~english Product ID
+ */
+ uint16_t idProduct; // Product ID
+ /**
+ * \~english reserved area
+ */
+ uint8_t reserved[2];
+ /**
+ * \~english Manufacturer Name
+ */
+ CHAR manufacturerName[SS_DEV_NAME_SIZE]; // Manufacturer Name
+ /**
+ * \~english Product Name
+ */
+ CHAR productName[SS_DEV_NAME_SIZE]; // Product Name
+ /**
+ * \~english Serial Number
+ */
+ CHAR serial_no[SS_DEV_NAME_SIZE]; // Serial Number
+ /**
+ * \~english Device file path
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Device file path
+}SS_UsbInfo;
+
+/**
+ * \~english CID(Card Identification Register Data)of SD/MMC card
+ */
+typedef struct _CID {
+ /**
+ * \~english Manufacturer ID
+ */
+ uint8_t manufacturerID; /* Manufacturer ID */
+ /**
+ * \~english Application ID
+ */
+ uint16_t applicationID; /* Application ID */
+ /**
+ * \~english Product Revision (PRV)
+ */
+ uint8_t revision; /* Product Revision (PRV) */
+ /**
+ * \~english Product Serial Number (PSN)
+ */
+ uint32_t serialNumber; /* Product Serial Number (PSN) */
+ /**
+ * \~english Product Name (PNM)
+ */
+ uint8_t productName[6]; /* Product Name (PNM) */
+ /**
+ * \~english Reserved area
+ */
+ uint8_t reserve[2]; /* Reserve */
+ /**
+ * \~english Manufacture date (MDT)
+ */
+ uint16_t manufactureDate; /* Manufacture date (MDT) */
+}SS_CID;
+
+// CSD(Card Specification Register Data)of SD/MMC card
+/**
+ * \~english CSD(Card Specification Register Data)of SD/MMC card
+ */
+typedef struct _CSD {
+ /**
+ * \~english CSD structure
+ */
+ uint8_t csd_structure; /* CSD structure */
+ /**
+ * \~english data read access-time-1
+ */
+ uint8_t taac; /* data read access-time-1 */
+ /**
+ * \~english data read access-time-2 in CLK cycles (NSAC*100)
+ */
+ uint8_t nsac; /* data read access-time-2 in CLK cycles (NSAC*100) */
+ /**
+ * \~english max. data transfer rate
+ */
+ uint8_t tran_speed; /* max. data transfer rate */
+ /**
+ * \~english card command classes
+ */
+ uint16_t ccc; /* card command classes */
+ /**
+ * \~english max. read data block length
+ */
+ uint8_t read_bl_len; /* max. read data block length */
+ /**
+ * \~english partial blocks for read allowed
+ */
+ uint8_t read_bl_partial; /* partial blocks for read allowed */
+ /**
+ * \~english write block misalignment
+ */
+ uint8_t write_blk_misalign; /* write block misalignment */
+ /**
+ * \~english read block misalignment
+ */
+ uint8_t read_blk_misalign; /* read block misalignment */
+ /**
+ * \~english DSR implemented
+ */
+ uint8_t dsr_imp; /* DSR implemented */
+ /**
+ * \~english Reserve area 1
+ */
+ uint8_t reserve1; /* Reserve 1 */
+ /**
+ * \~english device size
+ */
+ uint32_t c_size; /* device size */
+ /**
+ * \~english max. read current -VDD min
+ */
+ uint8_t vdd_r_curr_min; /* max. read current @VDD min */
+ /**
+ * \~english max. read current -VDD max
+ */
+ uint8_t vdd_r_curr_max; /* max. read current @VDD max */
+ /**
+ * \~english max. write current -VDD min
+ */
+ uint8_t vdd_w_curr_min; /* max. write current @VDD min */
+ /**
+ * \~english max. write current -VDD max
+ */
+ uint8_t vdd_w_curr_max; /* max. write current @VDD max */
+ /**
+ * \~english device size multiplier
+ */
+ uint8_t c_size_mult; /* device size multiplier */
+ /**
+ * \~english erase single block enable
+ */
+ uint8_t erase_blk_en; /* erase single block enable */
+ /**
+ * \~english erase sector size
+ */
+ uint8_t sector_size; /* erase sector size */
+ /**
+ * \~english write protect group size
+ */
+ uint8_t wp_grp_size; /* write protect group size */
+ /**
+ * \~english write protect group enable
+ */
+ uint8_t wp_grp_enable; /* write protect group enable */
+ /**
+ * \~english write speed factor
+ */
+ uint8_t r2w_factor; /* write speed factor */
+ /**
+ * \~english max. write data block length
+ */
+ uint8_t write_bl_len; /* max. write data block length */
+ /**
+ * \~english partial blocks for write allowed
+ */
+ uint8_t write_bl_partial; /* partial blocks for write allowed */
+ /**
+ * \~english File format group
+ */
+ uint8_t file_format_grp; /* File format group */
+ /**
+ * \~english copy flag
+ */
+ uint8_t copy; /* copy flag */
+ /**
+ * \~english permanent write protection
+ */
+ uint8_t perm_write_protect; /* permanent write protection */
+ /**
+ * \~english temporary write protection
+ */
+ uint8_t tmp_write_protect; /* temporary write protection */
+ /**
+ * \~english File format
+ */
+ uint8_t file_format; /* File format */
+ /**
+ * \~english Reserve area 2
+ */
+ uint8_t reserve2[3]; /* Reserve 2 */
+} SS_CSD;
+
+// Structure for SD device info.
+/**
+ * \~english Structure for SD device info.
+ */
+typedef struct _SdInfo {
+ /**
+ * \~english CID
+ */
+ SS_CID cid; // CID
+ /**
+ * \~english CSD
+ */
+ SS_CSD csd; // CSD
+ /**
+ * \~english Device file path
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Device file path
+ /**
+ * \~english Current Partion No
+ */
+ int32_t part_num; // Current Partion No
+ /**
+ * \~english Number of partions
+ */
+ int32_t nparts; // Number of partions
+}SS_SdInfo;
+
+// Structure for DISC info.
+/**
+ * \~english Structure for DISC info.
+ */
+typedef struct _DiscInfo {
+ /**
+ * \~english Device file path
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Device file path
+ /**
+ * \~english Disc Type(eCD, eDVD, eBD)
+ */
+ EDISC_TYPE disc_type; // Disc Type(eCD, eDVD, eBD)
+}SS_DiscInfo;
+
+// Structure that is available when SS_DEV_ANY_USB_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_ANY_USB_EV is published.
+ */
+typedef struct _UsbDeviceInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+}SS_UsbDeviceInfo;
+
+// Structure for device info.
+/**
+ * \~english Structure for device info.
+ */
+typedef union _DeviceInfo {
+ /**
+ * \~english usb device info
+ */
+ SS_UsbInfo usb_info; // usb device info
+ /**
+ * \~english sd info
+ */
+ SS_SdInfo sd_info; // sd info
+ /**
+ * \~english disc info
+ */
+ SS_DiscInfo disc_info; // disc info
+ /**
+ * \~english fusedav info
+ */
+ SS_FuseDAVInfo fusedav_info; // fusedav info
+}SS_DeviceInfo;
+
+// Structure for volume label infomation.
+/**
+ * \~english Structure for volume label infomation.
+ */
+typedef struct _VolumeInfo {
+ /**
+ * \~english volume label's availability
+ */
+ BOOL volume_label_availability; // volume label's availability
+ /**
+ * \~english volume label
+ */
+ CHAR volume_label[SS_DEV_NAME_SIZE]; // volume label
+}SS_VolumeInfo;
+
+// Structure that is available when SS_DEV_DETECT*_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT*_EV is published.
+ */
+typedef struct _MediaDetectInfo {
+ /**
+ * \~english Deive type(eUSB,eSD...)
+ */
+ EDEVICE_TYPE dev_type; // Deive type(eUSB,eSD...)
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english Device Infomation
+ */
+ SS_DeviceInfo dev_info; // Device Infomation
+ /**
+ * \~english Mount path
+ */
+ CHAR deviceMountpath[FILEPATH_SIZE]; // Mount path
+ /**
+ * \~english Do Not Used.(This member is for compatibility)
+ */
+ CHAR filepathName[FILEPATH_SIZE]; // Do Not Used.(This menber is for compatibility)
+ /**
+ * \~english FuseDav:TRUE, Not FuseDav:FALSE
+ */
+ BOOL bIsFuseDav;
+ /**
+ * \~english result of mount NORMAL:SS_DEV_OK, ERR:SS_DEV_ERR_MOUNT
+ */
+ SS_DEV_ERROR err_code; // result of mount NORMAL:SS_DEV_OK, ERR:SS_DEV_ERR_MOUNT
+ /**
+ * \~english volume infomation (USB mass storage only support)
+ */
+ SS_VolumeInfo volume_info; // volume infomation (USB mass storage only support)
+}SS_MediaDetectInfo, *PSS_MediaDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_NCM_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_NCM_EV is published.
+ */
+typedef struct _NcmDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Network Name
+ */
+ int8_t networkName[SS_DEV_DEVICE_NAME_SIZE]; // Network Name
+}SS_NcmDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB__CWORD57__EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB__CWORD57__EV is published.
+ */
+typedef struct __CWORD57_DetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+}SS__CWORD57_DetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_ACM_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_ACM_EV is published.
+ */
+typedef struct _AcmDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english ACM device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // ACM device file
+}SS_AcmDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_DEV_MNG_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_DEV_MNG_EV is published.
+ */
+typedef struct _DevMngDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Device Manager device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Device Manager device file
+}SS_DevMngDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_DEV_VEHICLE_CTRL_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_DEV_VEHICLE_CTRL_EV is published.
+ */
+typedef struct _VehicleCtrlDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Vehicle control device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Vehicle control device file
+}SS_VehicleCtrlDetectInfo;
+
+// Structure for audio detect info.
+/**
+ * \~english Structure for audio detect info.
+ */
+typedef struct _AudioDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable;
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info;
+ /**
+ * \~english Audio control device file
+ */
+ int8_t audio_ctrl[FILEPATH_SIZE];
+ /**
+ * \~english Audio Playback device file
+ */
+ int8_t audio_play[FILEPATH_SIZE];
+ /**
+ * \~english Audio Capture device file
+ */
+ int8_t audio_capture[FILEPATH_SIZE];
+}SS_AudioDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_DSRC_APP_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_DSRC_APP_EV is published.
+ */
+typedef struct _DsrcAppDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Dsrc Application device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Dsrc Application device file
+}SS_DsrcAppDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_DSRC_CTRL_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_DSRC_CTRL_EV is published.
+ */
+typedef struct _DsrcCtrlDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Dsrc Control device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Dsrc Control device file
+}SS_DsrcCtrlDetectInfo;
+
+// Structure that is available when SS_DEV_DETECT_USB_IR_VICS_DATA_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_USB_IR_VICS_DATA_EV is published.
+ */
+typedef struct _IrVicsDataDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+ /**
+ * \~english USB Infomation
+ */
+ SS_UsbInfo usb_info; // USB Infomation
+ /**
+ * \~english Ir Vics Data device file
+ */
+ int8_t deviceFile[FILEPATH_SIZE]; // Ir Vics Data device file
+}SS_IrVicsDataDetectInfo;
+
+/**
+ * \~english USB overcurrent error info.
+ */
+typedef struct _UsbOverCurrentErrInfo {
+ /**
+ * \~english error port no
+ */
+ uint8_t portNo; // error port no
+} SS_UsbOverCurrentErrInfo;
+
+// Structure that is available when SS_DEV_INFO_USB_NOTIFY_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_INFO_USB_NOTIFY_EV is published.
+ */
+typedef struct _UsbNotifyInfo {
+ /**
+ * \~english notify code
+ */
+ SS_NOTIFY_CODE nofity_code; // notify code
+ /**
+ * \~english USB device information's availability
+ */
+ BOOL usb_info_availability; // USB device information's availability
+ /**
+ * \~english USB device information
+ */
+ SS_UsbInfo usb_info; // USB device information
+} SS_UsbNotifyInfo;
+
+// Structure that is available when SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV is published.
+ */
+typedef struct __CWORD57_RoleDetectInfo {
+ /**
+ * \~english Insert:TURE, Remove:FALSE
+ */
+ BOOL bIsDeviceAvailable; // Insert:TURE, Remove:FALSE
+} SS__CWORD57_RoleDetectInfo;
+
+// Structure that is available when SS_DEV_INFO_SD_FORMAT_COMP_EV is published.
+/**
+ * \~english Structure that is available when SS_DEV_INFO_SD_FORMAT_COMP_EV is published.
+ */
+typedef struct _SDFormatInfo {
+ /**
+ * \~english Result of SD Format.
+ */
+ SS_DEV_ERROR result; // Result of SD Format.
+} SS_SDFormatInfo;
+
+#endif /* _SS_DEVICEDETECTION_SERVER_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of device_detection_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h
new file mode 100755
index 0000000..1ad7e67
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_ifc.h
@@ -0,0 +1,1118 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_devicedetection_service_ifc.h
+ * @brief This file supports the Device Detection service interface.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup device_detection_service
+ * @ingroup system_service
+ * @{
+ */
+/** @addtogroup device_manager
+ * @ingroup device_detection_service
+ * @{
+ */
+
+#ifndef SS_DEVICE_DETECTION_SERVICE_IFC_H_ // NOLINT (build/header_guard)
+#define SS_DEVICE_DETECTION_SERVICE_IFC_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include "system_service/ss_devicedetection_service_protocol.h"
+
+// CID(Card Identification Register Data)of SD/MMC card
+typedef struct T_cid {
+ UI_8 mid; // Manufacture ID
+ UI_8 oid[3]; // OEM/Application ID
+ UI_8 pnm[6]; // Product name
+ UI_8 prv; // Product revision
+ UI_32 psn; // Product serial number
+ UI_16 mdt; // Manufacture date code
+ UI_8 cr7cs; // CRC7 Check sum
+} Tcid;
+
+/**
+ * @class DeviceDetectionServiceIf
+ * \~english @brief Device detection
+ * \~english @par Brief Introduction
+ * Class to provide the device detection function
+ *
+ */
+class DeviceDetectionServiceIf {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DeviceDetectionServiceIf
+ /// \~english @par Summary
+ /// Constructor of DeviceDetectionServiceIf class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a DeviceDetectionServiceIf class. \n
+ /// Member variables (m_hApp, m_hService, m_hSession) to be NULL initialization. \n
+ /// After the constructor, be sure to call Initialize method.
+ /// \~english @see ~DeviceDetectionServiceIf, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ DeviceDetectionServiceIf();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~DeviceDetectionServiceIf
+ /// \~english @par Summary
+ /// Destructor of DeviceDetectionServiceIf class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a DeviceDetectionServiceIf class. \n
+ /// Session is the case still open, to close the session.\n
+ /// Service is the case still open, to close the service.
+ /// Member variables (m_hApp, m_hService, m_hSession) to be NULL initialization.
+ /// \~english @see DeviceDetectionServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~DeviceDetectionServiceIf();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Initialize
+ /// \~english @par Summary
+ /// API to initialize the DeviceDetectionServiceIf class.
+ /// \~english @param [in] hApp
+ /// HANDLE - HANDLE for Application
+ /// \~english @retval TRUE Success
+ /// \~english @retval FALSE Failure
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// Conditions for return FALSE is as follows.
+ /// - NULL handle specified in the argument
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Application to use the services of device_detection_service is, after generating a \n
+ /// DeviceDetectionServiceIf class, which is a method to be executed first. \n
+ /// Member variable(m_hApp) of DeviceDetectionServiceIf class initialized with hApp \n
+ /// that has been specified by the argument.
+ /// \~english @see DeviceDetectionServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Initialize(HANDLE hApp);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnDeviceDetectionAvailability
+ /// \~english @par Summary
+ /// API to set the Callback function for Availability notification of Device Detection Service.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Pointer to function callback for Device Detection Service Availability Notification
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Can not get the App/Thread name from HANDLE in the class member variables (m_hApp).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - The acquisition of the buffer that stores the Callback information specified in the argument failed.
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hApp). [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue HANDLE in HANDLE (m_hApp) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - It is not appropriate message queue name of HANDLE (m_hApp) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hApp) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to register a Callback function for the initialization of the \n
+ /// device_detection_service receives the timing at which the start (open) is possible \n
+ /// of completed service.\n
+ /// (Native Service of API: Use the FrameworkunifiedSubscribeNotificationsWithCallback, to register \n
+ /// a Callback function for Availability notification of Device Detection Service.)
+ /// \~english @see DetachDeviceDetectionAvailabilityCb
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnDeviceDetectionAvailability(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnOpenSessionAck
+ /// \~english @par Summary
+ /// API to set the Callback function for OpenSessionRequest response from the Device Detection Service.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for receiving the response of OpenSessionRequest
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To register the Callback function for receiving a response of completion of OpenSessionRequest to
+ /// Dispatcher. \n
+ /// (Native Service of API: Use the FrameworkunifiedAttachCallbackToDispatcher, to register a Callback function for receiving
+ /// \n
+ /// a response of completion of OpenSessionRequest to Dispatcher.) \n
+ /// On successful session establishment, the client can register for device information.
+ /// \~english @see DetachOpenSessionAckCb
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnOpenSessionAck(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnCloseSessionAck
+ /// \~english @par Summary
+ /// API to set the Callback function for CloseSessionRequest response from the Device Detection Service.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for receiving the response of CloseSessionRequest
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To register the Callback function for receiving a response of completion of CloseSessionRequest to
+ /// Dispatcher. \n
+ /// (Native Service of API: Use the FrameworkunifiedAttachCallbackToDispatcher, to register a Callback function for receiving
+ /// \n
+ /// a response of completion of CloseSessionRequest to Dispatcher.) \n
+ /// \~english @see DetachCloseSessionAckCb
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnCloseSessionAck(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup OpenSessionRequest
+ /// \~english @par Summary
+ /// API to perform the generation of the service/session of Device Detection Service
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Service of Device Detection Service is not Availability state. [eFrameworkunifiedStatusFail]
+ /// - Service of Device Detection Service can not be opened (can not start). [eFrameworkunifiedStatusFail]
+ /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Pub-Sub
+ /// \~english @par Detail
+ /// And generate the service of device_detection_service, which is a method for generating a session.\n
+ /// (To send the command of PROTOCOL_OPEN_SESSION_REQ to device_detection_service.)\n
+ /// If you already service has been created, once to close the service.
+ /// \~english @see CloseSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenSessionRequest();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DecodeOpenSessionResponse
+ /// \~english @par Summary
+ /// API to perform the generation of the service/session of Device Detection Service
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Incorrect PROTOCOL_OPEN_SESSION_ACK message length of Device Detection Service. [eFrameworkunifiedStatusFail]
+ /// - PROTOCOL_OPEN_SESSION_ACK message of Device Detection Service can not be acquired. [eFrameworkunifiedStatusFail]
+ /// - Can not session generation of message transmission to Device Detection Service. [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Get the session initiation response message(PROTOCOL_OPEN_SESSION_ACK) of Device Detection \n
+ /// Service, and get the session ID from the message. \n
+ /// Acquired session ID, (after opening the message transmission queue) created after a session \n
+ /// of message transmission, hold as the session information in the session HANDLE (m_hSession).\n
+ /// of the class member variable.
+ /// \~english @see OpenSessionRequest, CloseSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DecodeOpenSessionResponse();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RegisterForDeviceDetectionEvent
+ /// \~english @par Summary
+ /// API to register a Callback function for receiving the timing of when an event occurs in the device.
+ /// \~english @param [in] f_eDevDetectEvent
+ /// SS_DeviceDetectionServerEvents - Event type (USB/SD/...etc event)
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Pointer to a callback function that corresponds to the event
+ /// \~english @param [in] pfilepath
+ /// PCSTR - Pointer to the file path name(Non-support:Be NULL)
+ /// \~english @par
+ /// Event type (enum values of SS_DeviceDetectionServerEvents)
+ /// - SS_DEV_DETECT_ANY_USB_EV : Notify the insertion and mount path of USB MassStorage class(USB
+ /// mass storage is subject)
+ /// - SS_DEV_DETECT_ANY_SD_EV : Notify the insertion and mount path of SD card
+ /// - SS_DEV_INFO_ANY_USB_EV : Notify the USB device insertion and removal detection(All USB
+ /// devices are subject)
+ /// - SS_DEV_DETECT_ANY_DISC_EV : Notify the insertion of DISC(BD, DVD, CD) and mount path of block
+ /// devices
+ /// - SS_DEV_DETECT_ANY_USB_NCM_EV : Notify the insertion and network IF name of the USB NCM class
+ /// device(for MirrorLink)
+ /// - SS_DEV_DETECT_ANY_USB__CWORD57__EV : Notify the insertion and removal and the device file name of the
+ /// _CWORD57_ device(Rather than the _CWORD57_ only class, the device is subject)
+ /// - SS_DEV_DETECT_ANY_USB_ACM_EV : Notify the insertion and removal and device file name of the USB
+ /// ACM class device(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_DEV_MNG_EV : Notify the insertion and removal and device file name of the USB
+ /// DeviceManagementModel class(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV : Notify the insertion and removal and device file name of the USB
+ /// Vehicle Control class(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_DSRC_APP_EV : Notify the insertion and removal and device file name of the USB
+ /// DSRC Application class(for DSRC device)
+ /// - SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV : Notify the insertion and removal and device file name of the USB
+ /// DSRC Control class(for DSRC device)
+ /// - SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV : Notify the insertion and removal and device file name of the USB
+ /// IR-VICS Data class(for DSRC device)
+ /// - SS_DEV_ERR_USB_OVER_CURRENT_EV : Notify the overcurrent detection error of USB
+ /// - SS_DEV_DETECT_ANY_USB_MTP_EV : Notify the insertion and mount path of USB MTP class device
+ /// - SS_DEV_INFO_ANY_USB_NOTIFY_EV : Notify the connection of non-compliant USB device
+ /// - SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV : Notify the insertion and removal of the _CWORD57_ device after
+ /// RoleSW(Rather than the _CWORD57_ only class, the device is subject)
+ /// - SS_DEV_INFO_SD_FORMAT_COMP_EV : Notify the SD format results
+ /// - SS_DEV_DETECT_ANY_USB_DCM_NCM_EV : Notify the insertion and removal and network IF name of the USB
+ /// NCM class device(for DCM)
+ /// - SS_DEV_INFO_ANY_USB_DVDP_EV : Notify the insertion and removal of the DVD-P device
+ /// \~english @par
+ /// For SS_DEV_INFO_ANY_USB_NOTIFY_EV, it is also notified in the event the following conditions.
+ /// - When the enumeration failed.
+ /// - When it detects the current excess of the USB device connected to the bus power HUB.
+ /// - When it is detected that the number of the USB device has exceeded the number of support.
+ /// - When it is detected that the HUB is connected beyond the HUB number that supports.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE in the class member variables (m_hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_DeviceDetectionService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to register a callback function for receiving the timing of the \n
+ /// occurrence of an event in the device. \n
+ /// \~english @see UnRegisterForDeviceDetectionEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterForDeviceDetectionEvent(
+ SS_DeviceDetectionServerEvents f_eDevDetectEvent, CbFuncPtr f_pCallBackFn,
+ PCSTR pfilepath = NULL);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup UnRegisterForDeviceDetectionEvent
+ /// \~english @par Summary
+ /// API to release a Callback function that corresponds to the event notification from the device
+ /// \~english @param [in] f_eDevDetectEvent
+ /// SS_DeviceDetectionServerEvents - Event notification type (USB/SD/...etc event)
+ /// \~english @par
+ /// Releasable event notification type (enum values of SS_DeviceDetectionServerEvents)
+ /// - SS_DEV_DETECT_ANY_USB_EV : Notify the insertion and mount path of USB MassStorage class(USB
+ /// mass storage is subject)
+ /// - SS_DEV_DETECT_ANY_SD_EV : Notify the insertion and mount path of SD card
+ /// - SS_DEV_INFO_ANY_USB_EV : Notify the USB device insertion and removal detection(All USB
+ /// devices are subject)
+ /// - SS_DEV_DETECT_ANY_DISC_EV : Notify the insertion of DISC(BD, DVD, CD) and mount path of block
+ /// devices
+ /// - SS_DEV_DETECT_ANY_USB_NCM_EV : Notify the insertion and network IF name of the USB NCM class
+ /// device(for MirrorLink)
+ /// - SS_DEV_DETECT_ANY_USB__CWORD57__EV : Notify the insertion and removal and the device file name of the
+ /// _CWORD57_ device(Rather than the _CWORD57_ only class, the device is subject)
+ /// - SS_DEV_DETECT_ANY_USB_ACM_EV : Notify the insertion and removal and device file name of the USB
+ /// ACM class device(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_DEV_MNG_EV : Notify the insertion and removal and device file name of the USB
+ /// DeviceManagementModel class(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV : Notify the insertion and removal and device file name of the USB
+ /// Vehicle Control class(for DCM device)
+ /// - SS_DEV_DETECT_ANY_USB_DSRC_APP_EV : Notify the insertion and removal and device file name of the USB
+ /// DSRC Application class(for DSRC device)
+ /// - SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV : Notify the insertion and removal and device file name of the USB
+ /// DSRC Control class(for DSRC device)
+ /// - SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV : Notify the insertion and removal and device file name of the USB
+ /// IR-VICS Data class(for DSRC device)
+ /// - SS_DEV_ERR_USB_OVER_CURRENT_EV : Notify the overcurrent detection error of USB
+ /// - SS_DEV_DETECT_ANY_USB_MTP_EV : Notify the insertion and mount path of USB MTP class device
+ /// - SS_DEV_INFO_ANY_USB_NOTIFY_EV : Notify the connection of non-compliant USB device
+ /// - SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV : Notify the insertion and removal of the _CWORD57_ device after
+ /// RoleSW(Rather than the _CWORD57_ only class, the device is subject)
+ /// - SS_DEV_INFO_SD_FORMAT_COMP_EV : Notify the SD format results
+ /// - SS_DEV_DETECT_FILEPATHNAME_EV : Notify the specified file access in pfilepath
+ /// - SS_DEV_DETECT_ANY_USB_DCM_NCM_EV : Notify the insertion and removal and network IF name of the USB
+ /// NCM class device(for DCM)
+ /// - SS_DEV_INFO_ANY_USB_DVDP_EV : Notify the insertion and removal of the DVD-P device
+ /// \~english @par
+ /// For SS_DEV_INFO_ANY_USB_NOTIFY_EV, it is also notified in the event the following conditions.
+ /// - When the enumeration failed.
+ /// - When it detects the current excess of the USB device connected to the bus power HUB.
+ /// - When it is detected that the number of the USB device has exceeded the number of support.
+ /// - When it is detected that the HUB is connected beyond the HUB number that supports.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE in the class member variables (m_hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam]
+ /// - The service can not be determined from the HANDLE in the class member variables (m_hApp). [eFrameworkunifiedStatusFail]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_DeviceDetectionService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_DeviceDetectionService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to release a callback function for receiving the timing of the \n
+ /// occurrence of an event in the device. \n
+ /// \~english @see RegisterForDeviceDetectionEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnRegisterForDeviceDetectionEvent(
+ SS_DeviceDetectionServerEvents f_eDevDetectEvent);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CloseSessionRequest
+ /// \~english @par Summary
+ /// API to perform the destruction of services/session of Device Detection Service
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - SS_DeviceDetectionService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Method
+ /// \~english @par Detail
+ /// And destruct the service of device_detection_service, which is a method for destructing a session.\n
+ /// (To send the command of PROTOCOL_CLOSE_SESSION_REQ to device_detection_service.)\n
+ /// \~english @see OpenSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseSessionRequest();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DetachDeviceDetectionAvailabilityCb
+ /// \~english @par Summary
+ /// API to release the Callback function for Availability notification of Device Detection Service.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// - The call-back function for Availability notification has been registered.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Can not get the App/Thread name from HANDLE in the class member variables (m_hApp).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hApp). [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue HANDLE in HANDLE (m_hApp) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - It is not appropriate message queue name of HANDLE (m_hApp) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hApp) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Callback function for Availability notification is not registered. [eFrameworkunifiedStatusFail]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Is a method for releasing a Callback function registered to receive the timing \n
+ /// initialization is completed device_detection_service
+ /// (Native Service of API: Use the FrameworkunifiedUnsubscribeNotificationWithCallback, to release \n
+ /// a Callback function for Availability notification of Device Detection Service.)
+ /// \~english @see NotifyOnDeviceDetectionAvailability
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DetachDeviceDetectionAvailabilityCb();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DetachOpenSessionAckCb
+ /// \~english @par Summary
+ /// API to release the Callback function for OpenSessionRequest response from the Device Detection Service.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Not Callback function information of the release target is present. [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To cancel the Callback function for receiving a response of completion of OpenSessionRequest from
+ /// Dispatcher. \n
+ /// (Native Service of API: Use the FrameworkunifiedDetachCallbackFromDispatcher, to cancel a Callback function for receiving
+ /// \n
+ /// a response of completion of OpenSessionRequest from Dispatcher.) \n
+ /// \~english @see NotifyOnOpenSessionAck
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DetachOpenSessionAckCb();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DetachCloseSessionAckCb
+ /// \~english @par Summary
+ /// API to release the Callback function for CloseSessionRequest response from the Device Detection Service.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Not Callback function information of the release target is present. [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To cancel the Callback function for receiving a response of completion of CloseSessionRequest from
+ /// Dispatcher. \n
+ /// (Native Service of API: Use the FrameworkunifiedDetachCallbackFromDispatcher, to cancel a Callback function for receiving
+ /// \n
+ /// a response of completion of CloseSessionRequest from Dispatcher.) \n
+ /// \~english @see NotifyOnCloseSessionAck
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DetachCloseSessionAckCb();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup MountSD
+ /// \~english @par Summary
+ /// API to mount the specified SD partition
+ /// \~english @param [in] part_num
+ /// uint8_t - Partition number of SD card(From 0 to 3)
+ /// \~english @param [out] already_mounted
+ /// BOOL* - Mount existence result
+ /// \~english @par
+ /// - TRUE : Already mount
+ /// - FALSE : Mount request is accepted. Wait for mount notification.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusAccessError Access error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - SD card partition number (part_num) exceeds the 3 specified by the argument. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not have access to the device file for the SD. [eFrameworkunifiedStatusAccessError]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL.
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method only
+ /// \~english @par Detail
+ /// The API is a method used to mount the specified partition (area).\n
+ /// The target device is an SD card.
+ /// Service(Thread) to call this method is not limited. Therefore, \n
+ /// to be utilized as a mismatch does not occur between the service \n
+ /// to use the SD card. \n
+ /// SD card in the specified partition, already returned eFrameworkunifiedStatusOK \n
+ /// if mount existence results (already_mounted) in the TRUE that is mounted.\n
+ /// If it is not already mounted mount existence results (already_mounted) \n
+ /// and to FALSE, then carry out the SD of the mount request to Device \n
+ /// Detection Service.
+ /// \~english @see UmountSD, RegisterForDeviceDetectionEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus MountSD(uint8_t part_num, BOOL *already_mounted);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup UmountSD
+ /// \~english @par Summary
+ /// API to mount the specified SD partition
+ /// \~english @param [in] part_num
+ /// uint8_t - Partition number of SD card(From 0 to 3)
+ /// \~english @param [out] already_umounted
+ /// BOOL* - Mount existence result
+ /// \~english @par
+ /// - TRUE : Already umount
+ /// - FALSE : Umount request is accepted. Wait for umount notification.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusAccessError Access error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - SD card partition number (part_num) exceeds the 3 specified by the argument. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not have access to the device file for the SD. [eFrameworkunifiedStatusAccessError]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL.
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method only
+ /// \~english @par Detail
+ /// The API is a method used to mount the specified partition (area).\n
+ /// The target device is an SD card.
+ /// Service(Thread) to call this method is not limited. Therefore, \n
+ /// to be utilized as a mismatch does not occur between the service \n
+ /// to use the SD card. \n
+ /// SD card in the specified partition, already returned eFrameworkunifiedStatusOK \n
+ /// if unmount existence results (already_unmounted) in the TRUE that is unmounted.
+ /// If it is not already unmounted unmount existence results (already_unmounted) \n
+ /// and to FALSE, then carry out the SD of the unmount request to Device \n
+ /// Detection Service. \n
+ /// That all of the services specifically, to call this API after the close \n
+ /// completion of the directory and file of the SD card. \n
+ /// Also, do not call this API in a state in which a directory on the SD card \n
+ /// in the current directory. (At SD drive processing threads in SS_DeviceDetectionService, \n
+ /// umount fails, error of SS_DEV_ERR_BUSY is returned as an asynchronous notification \n
+ /// events.)
+ /// \~english @see MountSD, RegisterForDeviceDetectionEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UmountSD(uint8_t part_num, BOOL *already_umounted);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup UsbVBusReset
+ /// \~english @par Summary
+ /// API to reset the VBUS of the specified USB port
+ /// \~english @param [in] port
+ /// uint8_t - USB port number
+ /// \~english @param [in] inteval
+ /// uint8_t - interval (interval * 100 [msec])
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// - Checking USB port number should be done before calling this API.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Environment variable (TARGET_BOARD) is not defined. [eFrameworkunifiedStatusFail]
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Name of the target board in the environment variable (TARGET_BOARD) is not correct. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL.
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget only
+ /// \~english @par Detail
+ /// The API is a method for resetting the VBUS of the specified USB port.\n
+ /// Environment variable (TARGET_BOARD) is defined in the configure options \n
+ /// specified at the time of build. \n
+ /// (Example. TARGET_BOARD:_CWORD71__CWORD91__e2_na_t__CWORD84_2__CWORD71_) \n
+ /// Before reset USB port for DCM, the device files(dcm_acm, dcm_vc, dcm_wdm) \n
+ /// related to DCM-related must be closed. \n
+ /// *) Device file may not be created correctly when the process of Disconnect/Connect \n
+ /// without closing to work.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UsbVBusReset(int8_t port);
+ EFrameworkunifiedStatus UsbVBusReset(int8_t port, uint8_t interval);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RoleSwStateNotify
+ /// \~english @par Summary
+ /// API to notify RoleSW state
+ /// \~english @param [in] state
+ /// SS_DEV_ROLE_SW_STATE - RoleSW state
+ /// \~english @par
+ /// enum variable SS_DEV_ROLE_SW_STATE
+ /// - SS_DEV_ROLE_SW_START : Start
+ /// - SS_DEV_ROLE_SW_BEGIN_END : Beginning of End
+ /// - SS_DEV_ROLE_SW_END : End
+ /// - SS_DEV_ROLE_SW_RESTART : Restart
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusInvldQName Invalid Message Queue Name
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - It failed to open the message queue for messages received from SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - It failed to buffer acquisition for messages received from SS_DeviceDetectionService(malloc failure).
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to create a sequence ID of the message to be sent to the SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL.
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE name in the HANDLE (m_hSession) in the class member variables is NULL.
+ /// [eFrameworkunifiedStatusInvldQName]
+ /// - Message queue HANDLE name in the HANDLE (hService) in the class member variables exceeds 20byte.
+ /// [eFrameworkunifiedStatusInvldQName]
+ /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid send and receive file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the send and receive of the session message
+ /// for SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the send and receive buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the send and receive of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for send and receive of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrOther]
+ /// - It failed to connect to the socket for the response message to be received from SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to wait control of the response message received from SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - Interruption by the system call (signal) has occurred in wait in the response message received from
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusFail]
+ /// - After the failure at the time of the response message received from SS_DeviceDetectionService, it failed
+ /// to re-connection of the Socket. [eFrameworkunifiedStatusBadConnection]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync x Method
+ /// \~english @par Detail
+ /// By executing this API, Device Detection Service recognizes the state \n
+ /// has been switched from the USB Host due to RoleSW to USB Function. \n
+ /// The initial state of Detection is a state(SS_DEV_ROLE_SW_END:End state) \n
+ /// that has not been RoleSW. \n
+ /// (It is a state that accepts a SS_DEV_ROLE_SW_START:Start.)
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RoleSwStateNotify(SS_DEV_ROLE_SW_STATE state);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup FormatSD
+ /// \~english @par Summary
+ /// API to Format SD
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusAccessError Access error occurred
+ /// \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_DeviceDetectionService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) \n
+ /// has been done, and Availability of Device Detection Service is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Can not have access to the device file for the SD. [eFrameworkunifiedStatusAccessError]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hSession).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) in the message queue name is NULL.
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE in HANDLE (m_hSession) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of HANDLE (m_hSession) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hSession) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_DeviceDetectionService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_DeviceDetectionService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_DeviceDetectionService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Detail
+ /// The SD card inserted into the _CWORD84_ side in this API is formatted in compliance with the SD standard.\n
+ /// A result of format implementation is notified by SS_DEV_INFO_SD_FORMAT_COMP_EV events.\n
+ /// String pickled notification content and the result is as follows.\n
+ /// - SS_DEV_OK : Format success \n
+ /// - SS_DEV_ERR_BUSY : For unmount unexecuted, format failure \n
+ /// - SS_DEV_ERR : Format fails for any other factors
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Method
+ /// \~english @par
+ /// This API is able to call after the SD card umount completion and the device file close of \n
+ /// SD card is complete.\n
+ /// If the SD card umount of has not been completed, SS_DEV_ERR_BUSY is notified.\n
+ /// If the device file of the SD card has not been close, although it is the format becomes \n
+ /// the operation completed, there can be no assurance of the operation.
+ /// \~english @see MountSD, UmountSD, RegisterForDeviceDetectionEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FormatSD(void);
+
+ private:
+ HANDLE OpenService();
+ UI_8 Crc7Checksum(UI_8 *data, UI_8 sz);
+ HANDLE m_hApp;
+ HANDLE m_hService;
+ HANDLE m_hSession;
+ BOOL CheckDetectEvent(SS_DeviceDetectionServerEvents f_eDevDetectEvent);
+};
+
+#endif /* SS_DEVICE_DETECTION_SERVICE_IFC_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of device_manager
+/** @}*/ // end of device_detection_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_local.h
new file mode 100755
index 0000000..c85e6b3
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_local.h
@@ -0,0 +1,37 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief This is local header file of Device Detection service.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServicesIf
+/// \brief This file supports the Device Detection service.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _SS_DEVICEDETECTION_SERVER_LOCAL_H_ // NOLINT (build/header_guard)
+#define _SS_DEVICEDETECTION_SERVER_LOCAL_H_
+
+
+// Structure for SS_DEV_REMOUNT_PARTITION
+typedef struct _RemountPatitionInfo {
+ unsigned long mountflags; // NOLINT (runtime/int)
+ CHAR deviceMountpath[FILEPATH_SIZE]; // Mount path
+} SS_RemountPatitionInfo;
+
+#endif /* _SS_DEVICEDETECTION_SERVER_LOCAL_H_ */ // NOLINT (build/header_guard)
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h
new file mode 100755
index 0000000..7de03b9
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_notifications.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_devicedetection_service_notifications.h
+ * @brief This file supports the Device Detection service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup device_detection_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_DEVICE_DETECTION_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define SS_DEVICE_DETECTION_SERVICE_NOTIFICATIONS_H_
+
+#include "system_service/ss_services.h"
+
+/**
+ * \~english SS_DeviceDetection service availability notification.
+ */
+#define NTFY_SS_Device_Detection_Service_Availability SS_DEV_DETECT_SRV"/Availability"
+
+/**
+ * \~english SS_DeviceDetection service USB error notification.
+ */
+#define NTFY_SS_Device_Detection_USB_Error SS_DEV_DETECT_SRV"/USBError"
+
+/**
+ * \~english SS_DeviceDetection service MMCSD error notification.
+ */
+#define NTFY_SS_Device_Detection_MMCSD_Error SS_DEV_DETECT_SRV"/MMCSDError"
+
+#endif /* SS_DEVICE_DETECTION_SERVICE_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of device_detection_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h
new file mode 100755
index 0000000..cb54ee5
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol.h
@@ -0,0 +1,143 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_devicedetection_service_protocol.h
+ * @brief This file supports the Device Detection service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup device_detection_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard)
+#define _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include "system_service/ss_devicedetection_service.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \~english Event type (USB/SD/...etc event)
+ */
+typedef enum _DeviceDetectionServerEvents {
+ /**
+ * \~english Notify whenever a USB MassStorage device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_USB_EV = 121,
+ /**
+ * \~english Notify whenever a SD device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_SD_EV = 122,
+ /**
+ * \~english Notify all events for all devices
+ */
+ SS_DEV_DETECT_FILEPATHNAME_EV = 123,
+ /**
+ * \~english Notify whenever a Navi Emmc device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_EMMC_NAV_EV = 124,
+ /**
+ * \~english Notify whenever a USB device is connected/removed
+ */
+ SS_DEV_INFO_ANY_USB_EV = 125,
+ /**
+ * \~english Notify whenever a DISC(block) device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_DISC_EV = 126,
+ /**
+ * \~english Notify whenever a USB NCM device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_USB_NCM_EV = 127,
+ /**
+ * \~english Notify whenever a USB _CWORD57_ device is connected/removed
+ */
+ SS_DEV_DETECT_ANY_USB__CWORD57__EV = 128,
+ /**
+ * \~english Notify whenever a USB ACM device is connected/removed (for DCM)
+ */
+ SS_DEV_DETECT_ANY_USB_ACM_EV = 129,
+ /**
+ * \~english Notify whenever a USB Device Management device is connected/removed (for DCM)
+ */
+ SS_DEV_DETECT_ANY_USB_DEV_MNG_EV = 130,
+ /**
+ * \~english Notify whenever a USB Vics Control device is connected/removed (for DCM)
+ */
+ SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV = 131,
+ /**
+ * \~english Notify whenever a USB DSRC Application device is connected/removed (for DSRC)
+ */
+ SS_DEV_DETECT_ANY_USB_DSRC_APP_EV = 132,
+ /**
+ * \~english Notify whenever a USB DSRC Control device is connected/removed (for DSRC)
+ */
+ SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV = 133,
+ /**
+ * \~english Notify whenever a USB IR Vics Data device is connected/removed (for DSRC)
+ */
+ SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV = 134,
+ /**
+ * \~english Notify whenever USB Over Current is Detected
+ */
+ SS_DEV_ERR_USB_OVER_CURRENT_EV = 135,
+ /**
+ * \~english Notify whenever USB MTP Device is Detected
+ */
+ SS_DEV_DETECT_ANY_USB_MTP_EV = 136,
+ /**
+ * \~english Notify whenever USB Authentication Error Notify
+ */
+ SS_DEV_INFO_ANY_USB_NOTIFY_EV = 137,
+ /**
+ * \~english Notify whenever a USB _CWORD57_ device is connected/removed after RoleSW.
+ */
+ SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV = 138,
+ /**
+ * \~english Notify whenever SD is formated.
+ */
+ SS_DEV_INFO_SD_FORMAT_COMP_EV = 139,
+ /**
+ * \~english Notify whenever a USB NCM device is connected/removed (for DCM)
+ */
+ SS_DEV_DETECT_ANY_USB_DCM_NCM_EV = 140,
+ /**
+ * \~english Notify whenever a DVD-P device is connected/removed
+ */
+ SS_DEV_INFO_ANY_USB_DVDP_EV = 141,
+} SS_DeviceDetectionServerEvents;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of device_detection_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h
new file mode 100755
index 0000000..4b7be37
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_protocol_local.h
@@ -0,0 +1,69 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServicesIf
+/// \brief This file supports the Device Detection service.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef _SS_DEVICEDETECTION_SERVICE_PROTOCOL_LOCAL_H_ // NOLINT (build/header_guard)
+#define _SS_DEVICEDETECTION_SERVICE_PROTOCOL_LOCAL_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum _DeviceDetectionServerProtocol {
+ SS_DEV_DETECT_GET_APP_INFO = 0x10, /// client to service: not really needed
+ SS_DEV_DETECT_RETURN_APP_INFO = 0x11, /// service to client: not really needed
+ SS_UDEV_DEV_DETECT_INFO = 0x12, /// UDEV to service: device detect info sent to service
+ SS_UDEV_DEV_DETECT_FILEPATHNAME_INFO = 0x13, /// File pathname info cmd
+ SS_REGISTER_FILEPATHNAME = 0x14, /// Register file pathname cmd
+ SS_BSP_DEV_DETECT_ERR_INFO = 0x15, /// BSP / MCD device insert/removal/mount error report.
+ SS_REGISTER_DETECT_EVENT = 0x16, /// Register DeviceDetection Event
+ SS_UDEV_DEV_DEVICE_INFO = 0x17, /// UDEV to service: device info sent to service
+ SS_UDEV_DEV_DETECT_NCM_INFO = 0x18, /// UDEV to service: detect ncm sent to service
+ SS_UDEV_DEV_DETECT__CWORD57__INFO = 0x19, /// UDEV to service: detect _CWORD57_ sent to service
+ SS_UDEV_DEV_DETECT_ACM_INFO = 0x1a, /// UDEV to service: detect ACM sent to service
+ SS_UDEV_DEV_DETECT_MNG_INFO = 0x1b, /// UDEV to service: detect DeviceManagementModel sent to service
+ SS_UDEV_DEV_DETECT_VEHICLE_CTRL_INFO = 0x1c, /// UDEV to service: detect Vehicle Control sent to service
+ SS_UDEV_DEV_DETECT_DSRCCTL_INFO = 0x1d, /// UDEV to service: detect DSRC Application sent to service
+ SS_UDEV_DEV_DETECT_DSRCAPP_INFO = 0x1e, /// UDEV to service: detect DSRC Control sent to service
+ SS_UDEV_DEV_DETECT_IRVICS_DATA_INFO = 0x1f, /// UDEV to service: detect IR-VICS Data sent to service
+ SS_DETECT_USB_OVC_ERR = 0x20, /// USB Monitor OVC to service: detect OverCurrent Error
+ SS_UDEV_DEV_DETECT_MTP_INFO = 0x21, /// UDEV to service: detect MTP Device
+ SS_DEV_MOUNT_SD = 0x22, /// client to service: mount SD partion
+ SS_DEV_UMOUNT_SD = 0x23, /// client to service: umount SD partion
+ SS_DEV_REMOUNT_PARTITION = 0x24, /// client to service: Remount partion
+ SS_UNREGISTER_DETECT_EVENT = 0x25, /// UnRegister DeviceDetection event
+ SS_USB_VBUS_RESET = 0x26, /// client to service: USB Vbus Reset
+ SS_UDEV_USB_AUTHENTICATION_ERR_INFO = 0x27, /// USB Monitor to service: USB Authentication Error Notify
+ SS_UDEV_DEV_DETECT_USB_FUNC_INFO = 0x28, /// USB Monitor to service: detect USB Func to service
+ SS_DEV_ROLE_SW_STATE_NOTIFY = 0x29, /// client to service: notify RoleSw state
+ SS_DEV_FORMAT_SD = 0x2a, /// client to service: Format SD
+ SS_INFO_FORMAT_SD = 0x2b, /// SDDRV to service: Infomation Format SD result
+}SS_DeviceDetectionServerProtocol;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SS_DEVICEDETECTION_SERVICE_PROTOCOL_LOCAL_H_ */ // NOLINT (build/header_guard)
+
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types.h
new file mode 100755
index 0000000..c5ab1c3
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types.h
@@ -0,0 +1,186 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_devicedetection_service_types.h
+ * @brief This file supports the Device Detection service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup device_detection_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_DEVDETECT_TYPES_H_ // NOLINT (build/header_guard)
+#define SS_DEVDETECT_TYPES_H_
+
+/**
+ * \~english Deive type(eUSB,eSD...)
+ */
+typedef enum _DeviceType {
+ /**
+ * \~english USB
+ */
+ eUSB,
+ /**
+ * \~english SD
+ */
+ eSD,
+ /**
+ * \~english EMMC
+ */
+ eMMC,
+ /**
+ * \~english DISC
+ */
+ eDISC,
+ /**
+ * \~english MTP
+ */
+ eMTP
+} EDEVICE_TYPE;
+
+/**
+ * \~english Action result
+ */
+typedef enum _SsDevError {
+ /**
+ * \~english success
+ */
+ SS_DEV_OK,
+ /**
+ * \~english error
+ */
+ SS_DEV_ERR,
+ /**
+ * \~english mount error
+ */
+ SS_DEV_ERR_MOUNT,
+ /**
+ * \~english device busy
+ */
+ SS_DEV_ERR_BUSY,
+} SS_DEV_ERROR;
+
+/**
+ * \~english USB port
+ */
+typedef enum _USBPort {
+ /**
+ * \~english USB0(IF-BOX)
+ */
+ SS_DEV_USB_PORT0, // IF-BOX
+ /**
+ * \~english USB1(DCM)
+ */
+ SS_DEV_USB_PORT1, // DCM
+ /**
+ * \~english USB2(DSRC/ETC)
+ */
+ SS_DEV_USB_PORT2, // DSRC/ETC
+ /**
+ * \~english USB3(External deck)
+ */
+ SS_DEV_USB_PORT3, // External DECK
+ /**
+ * \~english USB4(Drive recorder)
+ */
+ SS_DEV_USB_PORT4, // Supplies drive recorder
+ /**
+ * \~english USB number max.
+ */
+ SS_DEV_USB_MAX // MAX
+} SS_DEV_USBPORT;
+
+/**
+ * \~english notify code
+ */
+typedef enum SsNotifyCode {
+ /**
+ * \~english Unsupport USB device
+ */
+ SS_DEV_UNSUPPORT_USB, // Un support USB device
+ /**
+ * \~english The connected device has no response.
+ */
+ SS_DEV_NON_RESPONSE_USB, // Enemuration Error
+ /**
+ * \~english It detects a USB device of current excess that has been connected to the bus power HUB.
+ */
+ SS_DEV_HIGH_POWER_USB, // It detects a USB device of current excess that
+ // has been connected to the bus power HUB.
+ /**
+ * \~english Over support USB(3 or more units)
+ */
+ SS_DEV_OVER_SUPPORT_USB, // Over support USB(3 or more units)
+ /**
+ * \~english Over number of USB HUB(2 or more units)
+ */
+ SS_DEV_OVER_NUM_USB_HUB, // Over number of USB HUB(2 or more units)
+} SS_NOTIFY_CODE;
+
+/**
+ * \~english RoleSw state
+ */
+typedef enum _SsDevRoleSwState {
+ /**
+ * \~english start
+ */
+ SS_DEV_ROLE_SW_START,
+ /**
+ * \~english begin end
+ */
+ SS_DEV_ROLE_SW_BEGIN_END,
+ /**
+ * \~english end
+ */
+ SS_DEV_ROLE_SW_END,
+ /**
+ * \~english restart
+ */
+ SS_DEV_ROLE_SW_RESTART,
+} SS_DEV_ROLE_SW_STATE;
+
+/**
+ * \~english Disc Type(eCD, eDVD, eBD)
+ */
+typedef enum _DiscType {
+ /**
+ * \~english CD
+ */
+ eCD,
+ /**
+ * \~english DVD
+ */
+ eDVD,
+ /**
+ * \~english BD
+ */
+ eBD,
+} EDISC_TYPE;
+
+#endif /* SS_DEVDETECT_TYPES_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of device_detection_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h
new file mode 100755
index 0000000..dafd4d4
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service_types_local.h
@@ -0,0 +1,44 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServicesIf
+/// \brief This file supports the Device Detection service.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef SS_DEVDETECT_TYPES_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_DEVDETECT_TYPES_LOCAL_H_
+
+/**
+ * \~english Service state.
+ */
+typedef enum _ServiceStatus {
+ eInit, //!< \~english Initialize.
+ ePre, //!< \~english In-vehicle.
+ eBackground, //!< \~english Background boot.
+ eStart, //!< \~english Normal boot.
+ eStop, //!< \~english Stop.
+} ESERVICESTATUS;
+
+typedef enum _USBMount {
+ SS_DEV_RO, // Read Only
+ SS_DEV_RW // Read/Write
+} SS_DEV_USB_REMOUNT;
+
+#endif /* SS_DEVDETECT_TYPES_LOCAL_H_ */ // NOLINT (build/header_guard)
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_event_common.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_event_common.h
new file mode 100755
index 0000000..ce7677f
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_event_common.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_error_event_common.h
+ * @brief This file supports SM logging.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef __SS_ERROR_EVENT_COMMON_H__ // NOLINT (build/header_guard)
+#define __SS_ERROR_EVENT_COMMON_H__
+
+#include <native_service/frameworkunified_types.h> // added for test build
+
+
+// Do not change enumeration order.
+// HMI hard codes error event square
+// colors based on expected enum order.
+enum EErrorEventType {
+ eErrorEventTypeProcessCrash = 0,
+ eErrorEventTypeHeartBeatFailure,
+ eErrorEventTypeSystemLowMemory,
+ eErrorEventTypeReserved1, // Formerly SS_SM_EVENT_ERROR_HIGH_CPU_LOAD, now HMI enum place holder.
+ eErrorEventTypeUserInvokedUserForceReset,
+ eErrorEventTypeReserved2,
+ eErrorEventTypeReserved3,
+ eErrorEventTypeUserInvokedCollectAllLogs,
+ eErrorEventTypeBootMicroReset,
+ eErrorEventTypeProcessExit,
+ eErrorEventTypeUserInvokedCollectScreenShot,
+ eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs,
+ eErrorEventTypeEelExport,
+ eErrorEventTypeInterfaceunifiedEmmcLogs,
+ eErrorEventTypeDiagEvent,
+ eErrorEventTypeCanEvent,
+ eErrorEventTypeDtcEvent,
+ eErrorEventTypeModConnFailed,
+ eErrorEventTypeStartRespFailed,
+ eErrorEventTypeUserInvokedCollectDevLogs,
+ eErrorEventTypeModuleInvokedResetRequest,
+ eErrorEventTypeModuleInvokedCollectDebugLogs,
+ eErrorEventTypeUserInvokedClearLogs,
+ eErrorEventTypeUserInvokedCollectNaviLog,
+ eErrorEventTypeGroupRelaunch,
+ eErrorEventTypeMaxValue
+};
+
+/* Value range of EArtifactId must be defined within 32, */
+/* because of it's definition is used by 4byte bitmask. */
+enum EArtifactId {
+ eArtifactIdInterfaceunifiedDebugLog = 0,
+ eArtifactIdTransmitLog,
+ eArtifactIdPerformanceLog,
+ eArtifactIdBootMicroLog,
+ eArtifactIdSystemDataCsv,
+ eArtifactIdShowMemTxt, // << ID 5
+ eArtifactIdProcessCore,
+ eArtifactIdDebugDumpLog,
+ eArtifactIdKernelLog,
+ eArtifactIdDRInitialLog,
+ eArtifactIdDRLocationLog, // << ID 10
+ eArtifactIdCpuHighLoadMonteCarloLogs,
+ eArtifactIdMetaCoreLogs,
+ eArtifactIdCmsLogs,
+ eArtifactIDInternalDTC,
+ eArtifactIdComDebugLog, // << ID 15
+ eArtifactIdKernelBootLog,
+ eArtifactIdPstoreLog,
+ eArtifactIdClearAllLog,
+ eArtifactIdNaviLog,
+ eArtifactIdScreenShot, // These three Log entries have to remain
+ eArtifactIdDebugFolder2Content, // at the end of the list
+ eArtifactIdDebugFolderContent,
+ eArtifactIdMaxValue // << 23
+};
+
+struct ARTIFACT_RESPONSE {
+ EArtifactId ArtifactId;
+ CHAR FilePathAndName[MAX_PATH_LENGTH];
+};
+
+
+#endif /* __SS_ERROR_EVENT_COMMON_H___ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_event_common_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_event_common_local.h
new file mode 100755
index 0000000..47da0d3
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_event_common_local.h
@@ -0,0 +1,63 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_error_event_common_local.h
+ * @brief This file supports SM logging.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef __SS_ERROR_EVENT_COMMON_LOCAL_H__ // NOLINT (build/header_guard)
+#define __SS_ERROR_EVENT_COMMON_LOCAL_H__
+
+#define SS_ERROR_EVENT_START_REQ_TO_SEC (5)
+#define SS_ERROR_EVENT_DEBUG_DUMP_RSPN_TO_SEC (1)
+#define SS_ERROR_EVENT_BOOT_MICRO_LOG_RESPONSE_TO_SEC (2)
+#define SS_ERROR_EVENT_CORE_FILE_POLL_TO_MS (100)
+
+// Do not change enumeration order.
+// HMI hard codes error event square
+// colors based on expected enum order.
+enum EErrorEventPrio { /* Higher number = higher priority. */
+ eErrorEventPrioDiagLogRequest = 8,
+ eErrorEventPrioUserInvokedCollectAllLogs = 7,
+ eErrorEventPrioUserInvokedCollectScreenShot = 6,
+ eErrorEventPrioUserInvokedCollectInterfaceunifiedLogs = 5,
+ eErrorEventPrioModuleInvokedCollectDebugLogs = 4,
+ eErrorEventPrioUserInvokedUserForceReset = 3,
+ eErrorEventPrioEelStorageFilePresent = 2,
+ eErrorEventPrioEmmcLogsFilePresent = 1,
+ eErrorEventPrioDefault = 0
+};
+
+
+#endif /* __SS_ERROR_EVENT_COMMON_LOCAL_H__ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
+
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_message.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_message.h
new file mode 100755
index 0000000..e810d7b
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_error_message.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_error_message.h
+ * @brief \~english This file contains declaration of system error message
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef _SS_ERROR_MESSAGE_H_ // NOLINT (build/header_guard)
+#define _SS_ERROR_MESSAGE_H_
+
+#define SS_ERROR_MSG_USB_DISCON "UsbDisconnected"
+#define SS_ERROR_MSG__CWORD84__ABNORMAL_SHUTDOWN "_CWORD84_AbnormalShutdown"
+
+#endif // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_if.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_if.h
new file mode 100755
index 0000000..e5a94e5
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_if.h
@@ -0,0 +1,165 @@
+/**
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_heartbeat_if.h
+ * @brief \~english This file supports the System Manager Heartbeat Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_HEARTBEAT_IF_H_ // NOLINT (build/header_guard)
+#define SS_HEARTBEAT_IF_H_
+
+#include <string>
+
+typedef struct {
+ BOOL fAvailable;
+ HANDLE hService;
+ std::string szServiceName;
+}THeartBeatSession;
+
+
+class CHeartBeatServiceIf {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Constructor of CHeartBeatServiceIf class.
+ /// \~english @param [in] avail
+ /// BOOL avail - default value of HBSession available
+ /// \~english @param [in] service
+ /// HANDLE service - set default value of Service handle
+ /// \~english @param [in] name
+ /// PSTR name - set application name used by client
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Constructor of CHeartBeatServiceIf class. \n
+ /// variables (g_tHeartBeatSession) to be initialization.
+ /// \~english @see ~CHeartBeatServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ CHeartBeatServiceIf(BOOL avail, HANDLE service, PCSTR name);
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Destructor of CHeartBeatServiceIf class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a CHeartBeatServiceIf class. \n
+ /// pHeartBeatServiceIf is not NULL, to delete it.\n
+ /// \~english @see CHeartBeatServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CHeartBeatServiceIf();
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Subscribe hApp to message queue of the HeartBeat client application.
+ /// \~english @param [in] f_hApp
+ /// HANDLE - Handle to message queue of the HeartBeat client application.
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// \~english @par Change of the internal state
+ /// - Change of internal state according to the API does not occur.
+ /// \~english @par Conditions of processing failure
+ /// - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument.
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - Notification Handler number specified in the argument (uiHandlerCount) has exceeded the maximum number of
+ /// Notification. [eFrameworkunifiedStatusFail]
+ /// - The acquisition of the buffer for storing a plurality of information of Notification Handler specified by
+ /// the argument has failed. [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more
+ /// than 20byte) [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to the NPP Service.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for the NPP Service.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Subscribe hApp to message queue of the HeartBeat client application. \n
+ /// if service hApp is NULL and hApp is not be Subscribed,return eFrameworkunifiedStatusNullPointer.\n
+ /// if service hApp is Subscribe to Heartbeat Serivceand hApp is not NULL,then subscribe hApp to message
+ /// queue of the HeartBeat client application.
+ /// \~english @see FrameworkunifiedGetAppName FrameworkunifiedSubscribeNotificationsWithCallback
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnHeartBeatRequest(HANDLE hApp);
+
+ private:
+ THeartBeatSession g_tHeartBeatSession;
+
+
+ friend EFrameworkunifiedStatus DBG_CloseHeatBeat(HANDLE hApp);
+};
+
+#endif /* SS_HEARTBEAT_IF_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_notifications.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_notifications.h
new file mode 100755
index 0000000..8b25fe1
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_notifications.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_heartbeat_notifications.h
+ * @brief This file supports the System Manager Heartbeat Service.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_HEARTBEAT_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define SS_HEARTBEAT_NOTIFICATIONS_H_
+
+#include "system_service/ss_services.h"
+
+/// Indicates if HeartBeat is available or unavailable
+#define NTFY_HeartBeatAvailability SERVICE_HEARTBEAT"/Availability"
+
+#endif /* SS_HEARTBEAT_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h
new file mode 100755
index 0000000..6d31d04
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_heartbeat_service_protocol.h
@@ -0,0 +1,72 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// Handle HeartBeat Module Start and Stop notifications.
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ss_heartbeat_service_protocol.h
+ * @brief API Header for HeartBeat messages used by senders and receivers.
+ *
+ * Declares the external Protocol messages to the HeartBeat.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_HEARTBEAT_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard)
+#define SS_HEARTBEAT_SERVICE_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+
+/// \brief HeatBeat Protocol Command
+/// heartbeat service protocol --> define all protocol messages in and out of heart beat thread
+/// that are pertinent to the functionality offered by heart beat thread.
+typedef enum T_SMHBProtocolMessages {
+ // Diagnostic Protocol
+ SS_HEARTBEAT_PRINT_CONNECTIONS = 0x32, ///< client to hb thread
+ SS_HEARTBEAT_PRINT_STACK = 0x33, ///< client to hb thread
+ SS_HEARTBEAT_PERIODIC_STATUS_REQ = 0xD0, ///< sysmgr to hb thread
+ SS_HEARTBEAT_PERIODIC_RESP = 0xD1, ///< hb thread to sysmgr
+ SS_HEARTBEAT_START = 0xD2, ///< sysmgr to hb thread
+ SS_HEARTBEAT_STOP = 0xD3, ///< sysmgr to hb thread
+ SS_HEARTBEAT_DELETE_MODULE_ENTRY = 0xD5, ///< sysmgr to hb thread
+ SS_HEARTBEAT_MSG_CATEGORY_REPORT = 0xD6, ///< report message
+ SS_HEARTBEAT_ERROR_DETECTED = 0xD8, ///< hb thread to sysmgr
+ SS_HEARTBEAT_APPEND_MODULE_ENTRY = 0xD9, ///< sysmgr to hb thread
+ SS_HEARTBEAT_AVAIL_CHECK_REQ = 0xDA, ///< sysmgr to hb thread
+ SS_HEARTBEAT_AVAIL_CHECK_RESP = 0xDB, ///< sysmgr to hb thread
+ SS_HEARTBEAT_RESPONSE = 0xE0, ///< client to hb thread
+ SS_HEARTBEAT_REQUEST = 0xE1 ///< hb thread to client
+}EHBProtocolMessages;
+
+#endif /* SS_HEARTBEAT_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_last_to_order.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_last_to_order.h
new file mode 100755
index 0000000..5a3b8b0
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_last_to_order.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_last_to_order.h
+ * @brief \~english This file contains declaration of enum SS_CONT_CATEGORY_t and api convert lastinfo to order
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef _SS_CONTID_TO_ORDER_H_ // NOLINT (build/header_guard)
+#define _SS_CONTID_TO_ORDER_H_
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include <string>
+
+typedef enum {
+ SS_CCAT_F_VIDEO,
+ SS_CCAT_F_SUB_VIDEO,
+ SS_CCAT_F_AUDIO,
+ SS_CCAT_R_VIDEO,
+ SS_CCAT_R_AUDIO,
+ SS_CCAT_MAX,
+}SS_CONT_CATEGORY_t;
+
+typedef std::string SS_CONTENT_NAME_t;
+
+typedef std::map<SS_CONT_CATEGORY_t, SS_CONTENT_NAME_t> SS_LAST_INFO_t;
+
+EFrameworkunifiedStatus SS_ConvLastInfoToOrder(SS_LAST_INFO_t &curLastMode, std::string &order, const char* p_cfgPath = NULL); //NOLINT (runtime/references)
+
+
+#endif // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service.h
new file mode 100755
index 0000000..67ecb08
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service.h
@@ -0,0 +1,255 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_service.h
+ * @brief \~english This file supports the the Logger Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_LOGGER_SERVICE_H_ // NOLINT (build/header_guard)
+#define SS_LOGGER_SERVICE_H_
+
+
+#include <native_service/frameworkunified_types.h>
+
+#define MAX_STATISTICAL_BUFFER 240
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Shared Memory names
+///////////////////////////////////////////////////////////////////////////////
+#define SHMEM_DRLOCATIONLOG "/DRLocationLog"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Shared Memory names
+///////////////////////////////////////////////////////////////////////////////
+#define SHMEM_DRINITIALLOG "/DRInitialLog"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief VIN numbers
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _TVINnumber {
+ static const UI_8 VIN_LEN = 18;
+ CHAR VINstr[VIN_LEN];
+} STVIN_NUMBER;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief CAN Diagnostic status data
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _TInterfaceunifiedCANMileageInfo {
+ UI_8 DidA_ExtTest_Pres;
+ UI_8 EngRun_Stat;
+ UI_8 Odo_MSB_H;
+ UI_8 Odo_MSB_L;
+ UI_8 Odo_LSB_H;
+ UI_8 Odo_LSB_L;
+ UI_8 PN14_SupBat_Volt;
+} STLOGGER_CANDIAGSTAT;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief CAN current date and time
+///////////////////////////////////////////////////////////////////////////////
+/**
+* @struct __CWORD62_DateAndTime
+* @brief \~english CAN current date and time
+*/
+typedef struct __CWORD62_DateAndTime {
+ UI_8 DateTime_Stat; /*!< \~english Date time status*/
+ UI_8 DateTimeDay; /*!< \~english Date*/
+ UI_8 DateTimeHour; /*!< \~english Hour*/
+ UI_8 DateTimeMinute; /*!< \~english Minute*/
+ UI_8 DateTimeMonth; /*!< \~english Month*/
+ UI_8 DateTimeSecond; /*!< \~english Second*/
+ UI_8 DateTimeYear; /*!< \~english Year*/
+ UI_8 TimeFormat; /*!< \~english Format*/
+}STCanCurrentDateTime;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger Device Type
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _ELoggerDeviceTypes {
+ eDevUSB1,
+ eDevUSB2,
+ eDevSD,
+ eTotalDevicesTypes,
+ eInvalid_DevType
+}EDEV_TYPE;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger State
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _ELoggerState {
+ eDeactivate,
+ eActivate,
+ eInvalid_LoggerState
+}ELOGGER_STAT;
+
+typedef enum _ELoggerErrorCodes {
+ eSelectedDeviceNotFound = 0x0001,
+ eWriteToDeviceFailed = 0x0002,
+ eScreenCaptureFailed = 0x0003,
+ eScreenCaptureSaveTimeExpired = 0x0004,
+ eScreenCaptureStoreTimeExpired = 0x0005,
+ eNoLogToStore = 0x0006,
+}ELOGGERERR_CODES;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Screen Capture Event data
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _TInterfaceunifiedScreenCaptureEvt {
+ static const UI_16 STR_BUFF_LEN = 64;
+ BOOL fSucessful;
+ UI_32 uiSceenShotId;
+ CHAR strNameAndLocation[STR_BUFF_LEN];
+ UI_32 uiFaultReasonCode;
+}STScreenCaptureEvt;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief USB source number to store event logs.
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _EEventLoggerUSBDeviceNumber {
+ USB0 = 0,
+ USB1 = 1,
+ SD = 2
+}EEvtLogUSBDevNumber;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief USB source number to store emergency error logs.
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _EDevNumber {
+ eEEL_USB1 = 1,
+ eEEL_USB2 = 2,
+ eEEL_SD = 3
+}EDevNumber;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Counter group ID.
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _ECounterGroupID {
+ STARTUP_SHUTDOWN_COUNTER_GROUP = 0x01,
+ APP_USAGE_COUNTER_GROUP,
+ F_BLK_STABILITY_COUNTER_GROUP,
+ MAX_COUNTER_GROUP
+}EStatCounterGroupID;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Statistical counter.
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _SStatisticalCounter {
+ UI_16 u16StartupCounterLength; ///< No of Counter from startup phase
+ UI_16 u16NormalCounterLength; ///< No of Counter from Normal phase
+ UI_16 u16ShutDownCounterLength; ///< No of Counter from Shut down phase
+ UI_8 StatisticalCountBuffer[MAX_STATISTICAL_BUFFER]; ///< Counter values for startup,normal and shutsown phases
+}SStatisticalCounter;
+
+typedef enum _EEventLoggerSuccessCode {
+ COPY_EVT_USB_SUCCESS = 0x20,
+ CLEAR_EVENT_LOG_SUCCESS = 0x21,
+ STATISTICAL_COUNTER_READ_SUCCESS = 0x22
+}EEvtLoggerSuccessCode;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event Logger error code
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _EEventLoggerErrorCode {
+ USB_DEVICE_NOT_AVAILABLE = 0x10,
+ USB_DEVICE_WRITE_ERROR = 0x11,
+ CLEAR_EVENT_LOG_FAILED = 0x12,
+ STATISTICAL_COUNTER_READ_FAILED = 0x13,
+ NO_ERROR_INFO = 0x14
+}EEvtLoggerErrorCode;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Emergency Log error code
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _EEmergencyLogErrorCode {
+ eDEVICE_NOT_AVAILABLE = 0x10,
+ eDEVICE_WRITE_ERROR = 0x11,
+ eNO_ERROR_INFO = 0x12
+}EELL_ErrorCode;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event logger common information
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _SEventLoggerCommonInfo {
+ UI_8 BodyCAN_Stat:4;
+ UI_8 HeadUnitCAN_Stat:4;
+ UI_8 HMIInteraction:4;
+ UI_8 IGN_Status:4;
+ UI_8 FOT_Temp:2;
+ UI_8 SystemVoltage:6;
+}STEventLoggerCommonInfo;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event logger resets counter information
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _SEventLoggerResetInfo {
+ UI_8 _CWORD56__ResetInfo;
+ UI_8 _CWORD102__ResetInfo;
+}STEventLoggerResetInfo;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event logger _CWORD56_ events information
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _SEventLoggerEventInfo {
+ UI_8 NumberOfEvents;
+ UI_8 EventGroup;
+ UI_8 EventIdentifier;
+ UI_8 EventData[4];
+}STEventLoggerEventInfo;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event logger CAN events information
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _SEventCANLoggerEventInfo {
+ BOOL success;
+ BOOL valid;
+ UI_32 triggerNumber;
+ STCanCurrentDateTime dateAndTime;
+}STEventCANLoggerEventInfo;
+
+#endif /* SS_LOGGER_SERVICE_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_ifc.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_ifc.h
new file mode 100755
index 0000000..2646c73
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_ifc.h
@@ -0,0 +1,1865 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_service_ifc.h
+ * @brief \~english This file supports the the Logger Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup logger_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_LOGGER_SERVICE_IFC_H_ // NOLINT (build/header_guard)
+#define SS_LOGGER_SERVICE_IFC_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include "system_service/ss_logger_service.h"
+#include "system_service/ss_logger_service_protocol.h"
+
+/**
+ * @class LoggerServiceIf
+ * \~english @brief logger_service
+ * \~english @par Brief Introduction
+ * Class to provide LoggerServiceIf
+ *
+ */
+class LoggerServiceIf {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerServiceIf
+ /// \~english @par Summary
+ /// Constructor of LoggerServiceIf class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a LoggerServiceIf class, and initialize member variables(m_hApp, m_hService, m_hSession) to be
+ /// NULL. \n
+ /// After the constructor, be sure to call the Initialize.
+ /// \~english @see ~LoggerServiceIf, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ LoggerServiceIf();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~LoggerServiceIf
+ /// \~english @par Summary
+ /// Destructor of LoggerServiceIf class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a LoggerServiceIf class. \n
+ /// If the service and the session is started (open) state, causing the end (closed).
+ /// \~english @see LoggerServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~LoggerServiceIf();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Initialize
+ /// \~english @par Summary
+ /// API to initialize the LoggerServiceIf class.
+ /// \~english @param [in] hApp
+ /// HANDLE - HANDLE for Application
+ /// \~english @retval TRUE Success
+ /// \~english @retval FALSE Failure
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLE(hApp) specified in the argument is NULL. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Application to use the services of SS_LoggerService is, after generating a LoggerServiceIf class, which is a
+ /// method to be executed first. \n
+ /// Member variable(m_hApp) of LoggerServiceIf class initialized with hApp that has been specified by the
+ /// argument.
+ /// \~english @see LoggerServiceIf
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Initialize(HANDLE hApp);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnLoggerServiceAvailability
+ /// \~english @par Summary
+ /// API to set the Callback function for Availability notification of SS_LoggerService.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Pointer to function callback for SS_LoggerService Availability Notification
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Can not get the App/Thread name from HANDLE in the class member variables (m_hApp).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - The acquisition of the buffer that stores the Callback information specified in the argument failed.
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
+ /// [eFrameworkunifiedStatusFail]
+ /// - Message queue HANDLE is NULL in the HANDLE of the class member variables (m_hApp). [eFrameworkunifiedStatusInvldParam]
+ /// - Message queue HANDLE in HANDLE (m_hApp) of the class member variables are not appropriate(which is
+ /// invalid). [eFrameworkunifiedStatusInvldParam]
+ /// - It is not appropriate message queue name of HANDLE (m_hApp) in the class member variables(The name is
+ /// NULL, more than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of HANDLE (m_hApp) in the class member variables.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_LoggerService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_LoggerService. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_LoggerService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to register a Callback function for the initialization of the SS_LoggerService receives
+ /// the timing at which the start (open) is possible of completed service.\n
+ /// (Using API:FrameworkunifiedSubscribeNotificationsWithCallback of Native Service, to register a Callback function for
+ /// Availability notification of SS_LoggerService.)
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnLoggerServiceAvailability(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnOpenSessionAck
+ /// \~english @par Summary
+ /// API to set the Callback function for OpenSessionRequest response from SS_LoggerService.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for receiving the response of OpenSessionRequest
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To register the Callback function for receiving a response of completion of OpenSessionRequest to
+ /// Dispatcher. \n
+ /// (Using API:FrameworkunifiedAttachCallbackToDispatcher of Native Service, to register a Callback function for receiving a
+ /// response of completion of OpenSessionRequest to Dispatcher.)
+ /// \~english @see NotifyOnCloseSessionAck
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnOpenSessionAck(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup NotifyOnCloseSessionAck
+ /// \~english @par Summary
+ /// API to set the Callback function for CloseSessionRequest response from SS_LoggerService.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for receiving the response of OpenSessionRequest
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To register the Callback function for receiving a response of completion of CloseSessionRequest to
+ /// Dispatcher. \n
+ /// (Using API:FrameworkunifiedAttachCallbackToDispatcher of Native Service, to register a Callback function for receiving a
+ /// response of completion of CloseSessionRequest to Dispatcher.) \n
+ /// \~english @see NotifyOnOpenSessionAck
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotifyOnCloseSessionAck(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup OpenSessionRequest
+ /// \~english @par Summary
+ /// API to generate service/session of SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Availability of SS_LoggerService is TRUE.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// - Use the NotifyOnOpenSessionAck(), that you register a callback function for receiving a completion
+ /// response of OpenSessionRequest to Dispatcher
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - SS_LoggerService is not Availability state. [eFrameworkunifiedStatusFail]
+ /// - SS_LoggerService can not be opened (can not start). [eFrameworkunifiedStatusFail]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method for generating service/session of SS_LoggerService.\n
+ /// (To send the command of PROTOCOL_OPEN_SESSION_REQ to SS_LoggerService.)\n
+ /// If you already service has been created, once to close the service, and to re-open.
+ /// \~english @see CloseSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenSessionRequest();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DecodeOpenSessionResponse
+ /// \~english @par Summary
+ /// API to hold the session ID in SS_LoggerServiceIf class
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Incorrect PROTOCOL_OPEN_SESSION_ACK message length of SS_LoggerService. [eFrameworkunifiedStatusFail]
+ /// - PROTOCOL_OPEN_SESSION_ACK message of SS_LoggerService can not be acquired. [eFrameworkunifiedStatusFail]
+ /// - Can not session generation of message transmission to SS_LoggerService. [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Get the session initiation response message(PROTOCOL_OPEN_SESSION_ACK) of SS_LoggerService, and get the
+ /// session ID from the message. \n
+ /// Acquired session ID, (after opening the message transmission queue) created after a session of message
+ /// transmission, hold as the session information in the session HANDLE(m_hSession) of the class member
+ /// variable.
+ /// \~english @see OpenSessionRequest, CloseSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DecodeOpenSessionResponse();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CloseSessionRequest
+ /// \~english @par Summary
+ /// API to discard service/session of SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// - Use the NotifyOnCloseSessionAck(), that you register a callback function for receiving a completion
+ /// response of CloseSessionRequest to Dispatcher
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// which is a method for discarding service/session of SS_LoggerService.\n
+ /// (To send the command of PROTOCOL_CLOSE_SESSION_REQ to SS_LoggerService.)
+ /// \~english @see OpenSessionRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CloseSessionRequest();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RegisterForLoggerEvent
+ /// \~english @par Summary
+ /// API to register a Callback function for SS_LoggerService.
+ /// \~english @param [in] f_eLoggerEvent
+ /// SS_LoggerServerEvents - Event type
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Pointer to a callback function that corresponds to the event
+ /// \~english @par
+ /// SS_LoggerServerEvents enum value
+ /// \~english @code
+ /// typedef enum _LoggerServerEvents
+ /// {
+ /// SS_LOGGER_SCREENCAPTURE_EVT = 0xA0, /* Event notification of the Screen Capture */
+ /// SS_LOGGER_ERRORINFO_EVT, /* Event notification of error log information */
+ /// SS_LOGGER_LOGINFO_EVT, /* Event notification of log information */
+ /// SS_LOGGER_LOGSTARTED_EVT /* Event notification at the time of log start */
+ /// }SS_LoggerServerEvents;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hApp) is not appropriate (which is invalid) [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Which is a method to register a callback function for receiving the timing of the occurrence of an event in
+ /// the SS_LoggerService to the Dispatcher. \n
+ /// (To send the command of PROTOCOL_REGISTER_EVENTS to SS_LoggerService.)
+ /// \~english @see UnRegisterForLoggerEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterForLoggerEvent(SS_LoggerServerEvents f_eLoggerEvent, CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup UnRegisterForLoggerEvent
+ /// \~english @par Summary
+ /// API to cancel a Callback function for SS_LoggerService.
+ /// \~english @param [in] f_eLoggerEvent
+ /// SS_LoggerServerEvents - Event type
+ /// \~english @par
+ /// SS_LoggerServerEvents enum value
+ /// \~english @code
+ /// typedef enum _LoggerServerEvents
+ /// {
+ /// SS_LOGGER_SCREENCAPTURE_EVT = 0xA0, /* Event notification of the Screen Capture */
+ /// SS_LOGGER_ERRORINFO_EVT, /* Event notification of error log information */
+ /// SS_LOGGER_LOGINFO_EVT, /* Event notification of log information */
+ /// SS_LOGGER_LOGSTARTED_EVT /* Event notification at the time of log start */
+ /// }SS_LoggerServerEvents;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Which is a method to cancel a callback function for receiving the timing of the occurrence of an event in
+ /// the SS_LoggerService. \n
+ /// \~english @see RegisterForLoggerEvent
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnRegisterForLoggerEvent(SS_LoggerServerEvents f_eLoggerEvent);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SendDiagStat
+ /// \~english @par Summary
+ /// API to send CAN Diagnostic status data(it has mileage information) to SS_LoggerService.
+ /// \~english @param [in] pCanDiagStat_t
+ /// STLOGGER_CANDIAGSTAT - Pointer to structure of CAN Diagnostic state data
+ /// \~english @par
+ /// STLOGGER_CANDIAGSTAT Structure
+ /// \~english @code
+ /// typedef struct _TInterfaceunifiedCANMileageInfo
+ /// {
+ /// UI_8 DidA_ExtTest_Pres; /* For extended test(unused) */
+ /// UI_8 EngRun_Stat; /* Engine run state(unused) */
+ /// UI_8 Odo_MSB_H; /* Mileage information(MSB:High) */
+ /// UI_8 Odo_MSB_L; /* Mileage information(MSB:Low) */
+ /// UI_8 Odo_LSB_H; /* Mileage information(LSB:High) */
+ /// UI_8 Odo_LSB_L; /* Mileage information(LSB:Low) */
+ /// UI_8 PN14_SupBat_Volt; /* Battery voltage(unused) */
+ /// }STLOGGER_CANDIAGSTAT;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send the mileage information in the CAN diagnostic state data to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_MILEAGE_DATA to SS_LoggerService. \n
+ /// SS_LoggerService uses the log write thread, to output a log of the mileage information.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SendDiagStat(STLOGGER_CANDIAGSTAT *pCanDiagStat_t);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_CANGetCurrentDateAndTime
+ /// \~english @par Summary
+ /// API to send the current date and time of the CAN to SS_LoggerService.
+ /// \~english @param [in] stDateAndTime
+ /// STCanCurrentDateTime - Structure of CAN current date and time
+ /// \~english @par
+ /// STCanCurrentDateTime Structure
+ /// \~english @code
+ /// typedef struct __CWORD62_DateAndTime
+ /// {
+ /// UI_8 DateTime_Stat; /* Date and Time State */
+ /// UI_8 DateTimeDay; /* Day */
+ /// UI_8 DateTimeHour; /* Hour */
+ /// UI_8 DateTimeMinute; /* Minute */
+ /// UI_8 DateTimeMonth; /* Month */
+ /// UI_8 DateTimeSecond; /* Second */
+ /// UI_8 DateTimeYear; /* Year */
+ /// UI_8 TimeFormat; /* Time display format */
+ /// }STCanCurrentDateTime;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send current date and time of the CAN to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_SET_DATETIME to SS_LoggerService.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_CANGetCurrentDateAndTime(STCanCurrentDateTime stDateAndTime);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_CANSetVIN
+ /// \~english @par Summary
+ /// API to send the Vehicle Identification Number(VIN) to SS_LoggerService.
+ /// \~english @param [in] stVinNumber
+ /// STVIN_NUMBER& - Structure of Vehicle Identification Number(VIN)
+ /// \~english @par
+ /// STVIN_NUMBER Structure
+ /// \~english @code
+ /// typedef struct _TVINnumber
+ /// {
+ /// static const UI_8 VIN_LEN = 18;
+ /// CHAR VINstr[VIN_LEN]; /* Vehicle Identification Number(VIN) */
+ /// }STVIN_NUMBER;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send the Vehicle Identification Number(VIN) to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_SET_VIN to Logger Service. \n
+ /// SS_LoggerService uses the log write thread, to output a log of the Vehicle Identification Number(VIN).
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_CANSetVIN(STVIN_NUMBER& stVinNumber); // NOLINT (runtime/references)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_SetLoggerParams
+ /// \~english @par Summary
+ /// API to send the logging propriety information of the selected device to SS_LoggerService.
+ /// \~english @param [in] eLoggerStatus
+ /// ELOGGER_STAT - Logging propriety information
+ /// \~english @param [in] eDevType
+ /// EDEV_TYPE - Device type
+ /// \~english @par
+ /// ELOGGER_STAT enum value
+ /// \~english @code
+ /// typedef enum _ELoggerState
+ /// {
+ /// eDeactivate, /* Logging impossible(Deativate) */
+ /// eActivate, /* Logging possible(Activate) */
+ /// eInvalid_LoggerState /* Invalid logging state */
+ /// }ELOGGER_STAT;
+ /// @endcode
+ /// \~english @par
+ /// EDEV_TYPE enum value
+ /// \~english @code
+ /// typedef enum _ELoggerDeviceTypes
+ /// {
+ /// eDevUSB1, /* USB1 */
+ /// eDevUSB2, /* USB2 */
+ /// eDevSD, /* SD */
+ /// eTotalDevicesTypes, /* Total device types */
+ /// eInvalid_DevType /* Invalid device type */
+ /// }EDEV_TYPE;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send the logging propriety information of the selected device to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_SET_PARAMS to SS_LoggerService. \n
+ /// SS_LoggerService is based on the logging propriety information of the transmission selection device, and
+ /// update as a member variable of the class.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_SetLoggerParams(ELOGGER_STAT eLoggerStatus, EDEV_TYPE eDevType);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_UDPLogging
+ /// \~english @par Summary
+ /// API to send the logging propriety information of UDP to SS_LoggerService.
+ /// \~english @param [in] eLoggerStatus
+ /// ELOGGER_STAT - Logging propriety information
+ /// \~english @par
+ /// ELOGGER_STAT enum value
+ /// \~english @code
+ /// typedef enum _ELoggerState
+ /// {
+ /// eDeactivate, /* Logging impossible(Deativate) */
+ /// eActivate, /* Logging possible(Activate) */
+ /// eInvalid_LoggerState /* Invalid logging state */
+ /// }ELOGGER_STAT;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send the logging propriety information of UDP to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_UDP_LOGGING to SS_LoggerService. \n
+ /// SS_LoggerService is based on the logging propriety information of the transmission UDP, and update as a
+ /// member variable of the class.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_UDPLogging(ELOGGER_STAT eLoggerStatus);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_ScreenCaptureEventACK
+ /// \~english @par Summary
+ /// API to send the event response of screen capture to SS_LoggerService.
+ /// \~english @param [in] stScreenCaptureInfo
+ /// STScreenCaptureEvt - Structure of event data of screen capture
+ /// \~english @par
+ /// STScreenCaptureEvt Structure
+ /// \~english @code
+ /// typedef struct _TInterfaceunifiedScreenCaptureEvt
+ /// {
+ /// static const UI_16 STR_BUFF_LEN = 64;
+ /// BOOL fSucessful; /* Success propriety flag */
+ /// UI_32 uiSceenShotId; /* Screen capture ID */
+ /// CHAR strNameAndLocation[STR_BUFF_LEN]; /* Screen capture save file name */
+ /// UI_32 uiFaultReasonCode; /* Failure reason code */
+ /// }STScreenCaptureEvt;
+ /// @endcode
+ /// \~english @par
+ /// uiFaultReasonCode : Failure reason code (plm::screen_shot::status List)
+ /// - ok : Success
+ /// - invalid_window_handle : Invalid window handle
+ /// - invalid_context_handle : Invalid context handle
+ /// - display_count_error : Display count error
+ /// - rgb_display_not_found : RGB display not found
+ /// - create_pixmap_error : Create error of PIXMAP
+ /// - usage_pixmap_property_error : Usage error of PIXMAP property
+ /// - format_pixmap_property_error : Format error of PIXMAP property
+ /// - buffer_pixmap_property_error : Buffer error of PIXMAP property
+ /// - create_pixmap_buffer_error : Create error of PIXMAP buffer
+ /// - render_pixmap_property_error : Render error of PIXMAP property
+ /// - pointer_pixmap_property_error : Pointer error of PIXMAP property
+ /// - stride_pixmap_property_error : Stride error of PIXMAP property
+ /// - window_read_error : Window read error
+ /// - write_bitmap_file_error : Writing error of bitmap files
+ /// - window_post_error : Window post error
+ /// - window_property_error : Window property error
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// As the data in the event the response of the screen capture to SS_LoggerService, which is a method for
+ /// transmitting the information of the screen capture ID and screen capture save file name.\n
+ /// Send a message in the command ID of SS_LOGGER_SCREENCAPTURE_EVT_ACK to SS_LoggerService. \n
+ /// This API is an API for screen capture in PLM(Physical Layer Management) function support. In PLM
+ /// non-support, to prohibit the use.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_ScreenCaptureEventACK(STScreenCaptureEvt stScreenCaptureInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_EventLoggingCommonInfo
+ /// \~english @par Summary
+ /// API to send the event information of the common log in SS_LoggerService.
+ /// \~english @param [in] stEventCommonInfo
+ /// STEventLoggerCommonInfo - Event information structure of the common log
+ /// \~english @par
+ /// STEventLoggerCommonInfo Structure
+ /// \~english @code
+ /// typedef struct _SEventLoggerCommonInfo
+ /// {
+ /// UI_8 BodyCAN_Stat:4; /* CAN state of the body */
+ /// UI_8 HeadUnitCAN_Stat:4; /* CAN state of the Head Unit */
+ /// UI_8 HMIInteraction:4; /* HMI Interaction */
+ /// UI_8 IGN_Status:4; /* Ignition state */
+ /// UI_8 FOT_Temp:2; /* Field Operation Tests Temporary */
+ /// UI_8 SystemVoltage:6; /* System Voltage */
+ /// }STEventLoggerCommonInfo;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// It is a method to send the event information of the common log to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_EVENT_COMMONINFO to SS_LoggerService. \n
+ /// Using the log write thread, SS_LoggerService outputs the following log information.
+ /// - CAN state of the body
+ /// - CAN state of the Head Unit
+ /// - HMI Interaction
+ /// - Ignition state
+ /// - System Voltage
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_EventLoggingCommonInfo(STEventLoggerCommonInfo stEventCommonInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_EventLoggingEventInfo
+ /// \~english @par Summary
+ /// API to send the event information of the _CWORD56_ log to SS_LoggerService.
+ /// \~english @param [in] stEventInfo
+ /// STEventLoggerEventInfo - Event information structure of _CWORD56_ log
+ /// \~english @par
+ /// STEventLoggerEventInfo Structure
+ /// \~english @code
+ /// typedef struct _SEventLoggerCommonInfo
+ /// {
+ /// UI_8 NumberOfEvents; /* Event count */
+ /// UI_8 EventGroup; /* Event group */
+ /// UI_8 EventIdentifier; /* Event identifier */
+ /// UI_8 EventData[4]; /* Event data */
+ /// }STEventLoggerEventInfo;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// It is a method to send the event information of _CWORD56_ log to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER__CWORD56__EVENT_INFO to SS_LoggerService.\n
+ /// Using the log write thread, SS_LoggerService outputs the following log information.
+ /// - Event count
+ /// - Event group
+ /// - Event identifier
+ /// - Event data
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_EventLoggingEventInfo(STEventLoggerEventInfo stEventInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_EventLoggingResetInfo
+ /// \~english @par Summary
+ /// API to send the event information of _CWORD56_ reset count to SS_LoggerService.
+ /// \~english @param [in] stResetInfo
+ /// STEventLoggerResetInfo - Event information structure of _CWORD56_ reset counter
+ /// \~english @par
+ /// STEventLoggerResetInfo Structure
+ /// \~english @code
+ /// typedef struct _SEventLoggerResetInfo
+ /// {
+ /// UI_8 _CWORD56__ResetInfo; /* Reset counter information of _CWORD56_ */
+ /// UI_8 _CWORD102__ResetInfo; /* Reset counter information of _CWORD102_ */
+ /// }STEventLoggerResetInfo;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// It is a method to send the event information of _CWORD56_ reset counter to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER__CWORD56__RESET_INFO to SS_LoggerService. \n
+ /// Using the log write thread, SS_LoggerService outputs the following log information.
+ /// - Reset counter information of _CWORD56_
+ /// - Reset counter information of _CWORD102_
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_EventLoggingResetInfo(STEventLoggerResetInfo stResetInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_PersistEventLogOnActiveDTC
+ /// \~english @par Summary
+ /// API to persist the event log on the DTC to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// Which is a method to send a message of the order to immediately persist the event log on the DTC(Diagnostic
+ /// Trouble Code) to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_DIAGDTC_ACTIVE to SS_LoggerService.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_PersistEventLogOnActiveDTC(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_Shutdown_Complete
+ /// \~english @par Summary
+ /// API to send a shutdown completion message to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to send a shutdown completion message to SS_LoggerService.\n
+ /// Send a message in the command ID of SS_LOGGER_SHUTDOWN_COMPLETE to SS_LoggerService.\n
+ /// SS_LoggerService stops the thread for the log writing, and the Availability of self-service is set to FALSE,
+ /// to disable the service.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_Shutdown_Complete(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StoreEventLogsToUSB
+ /// \~english @par Summary
+ /// API to request an event log output to USB/SD to SS_LoggerService.
+ /// \~english @param [in] eUSBDevNumber
+ /// EEvtLogUSBDevNumber - Event Log output destination USB/SD device number
+ /// \~english @par
+ /// EEvtLogUSBDevNumber enum value
+ /// \~english @code
+ /// typedef enum _EEventLoggerUSBDeviceNumber
+ /// {
+ /// USB0=0, /* USB0 */
+ /// USB1=1, /* USB1 */
+ /// SD=2 /* SD */
+ /// }EEvtLogUSBDevNumber;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to request the event log output to USB/SD to SS_LoggerService.\n
+ /// To send a message in the command ID of SS_LOGGERCOPYEVENTUSB against SS_LoggerService. \n
+ /// Using the event log writing thread, SS_LoggerService output the event log to the specified device (USB/SD).
+ /// \n
+ /// As a result of the event output, the message is notified to the caller of the API in the command ID below.
+ /// - Success: SS_LOGGERCOPYEVENTUSB_SUCCESS_RESP
+ /// - Failure: SS_LOGGERCOPYEVENTUSB_ERROR_RESP
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus StoreEventLogsToUSB(EEvtLogUSBDevNumber eUSBDevNumber);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StoreEmergencyErrorLogsToUSB
+ /// \~english @par Summary
+ /// API to request the emergency error log output to USB/SD to SS_LoggerService.
+ /// \~english @param [in] eDevNumber
+ /// EDevNumber - Emergency error log output destination USB/SD device number
+ /// \~english @par
+ /// EDevNumber value of enum
+ /// \~english @code
+ /// typedef enum _EDevNumber
+ /// {
+ /// eEEL_USB1=1, /* USB0 */
+ /// eEEL_USB2=2, /* USB1 */
+ /// eEEL_SD=3 /* SD */
+ /// }EDevNumber ;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to request the emergency error log output to USB/SD to SS_LoggerService.\n
+ /// To send a message in the command ID of SS_LOGGERCOPYEMERGENCYLOGS against SS_LoggerService. \n
+ /// Using the diagnostic log output function of System Manager, SS_LoggerService output the emergency error log
+ /// to the specified device(USB/SD). \n
+ /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the
+ /// command ID below.
+ /// - Success: SS_LOGGERCOPYEMERGENCYLOGS_SUCCESS_RESP
+ /// - Failure: SS_LOGGERCOPYEMERGENCYLOGS_ERROR_RESP
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus StoreEmergencyErrorLogsToUSB(EDevNumber eDevNumber);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StartCANLogging
+ /// \~english @par Summary
+ /// API to request the start of CAN logging to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to request the start of CAN logging against SS_LoggerService. \n
+ /// This function is called by CAN to trigger Logging to USB. \n
+ /// Progress is published by notifications eSSLoggerCANEventStart, eSSLoggerCANEventError and
+ /// eSSLoggerCANEventFinished. \n
+ /// To send a message in the command ID of eSSLoggerCANProtocolIDCANTrigger against SS_LoggerService. \n
+ /// SS_LoggerService requests the logging start of CAN to the System Manager.
+ /// \~english @see RegisterLoggingStartNotification, RegisterLoggingFinishNotification
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus StartCANLogging(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RegisterLoggingStartNotification
+ /// \~english @par Summary
+ /// API to set a callback function for CAN logging start notification.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for CAN logging start notification
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Handle name of the session message queue is NULL to SS_LoggerService. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE of the session message to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE of the session message to SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of the session message to SS_LoggerService(The name is NULL, more
+ /// than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_LoggerService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_LoggerService. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_LoggerService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// Use the StartCANLogging, after the request of the start of the CAN logging operation, which is a method to
+ /// register a callback function to receive a notification of the start of the logging operation.\n
+ /// (Using API:FrameworkunifiedSubscribeToSessionEventWithCallback of Native Service, to register a Callback function for CAN
+ /// logging start notification.) \n
+ /// SS_LoggerService publish the logging start of CAN in the notification of eSSLoggerCANEventStart to
+ /// Subscribers.
+ /// \~english @see StartCANLogging, RegisterLoggingFinishNotification
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterLoggingStartNotification(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup RegisterLoggingFinishNotification
+ /// \~english @par Summary
+ /// API to set a callback function for CAN logging finish notification.
+ /// \~english @param [in] f_pCallBackFn
+ /// CbFuncPtr - Callback function pointer for CAN logging finish notification
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc.) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hApp) is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - Callback function pointer specified by the argument is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - HANDLE (m_hApp) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldParam]
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE (m_hSession) in the class member variables are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Handle name of the session message queue is NULL to SS_LoggerService. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE of the session message to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message queue HANDLE of the session message to SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - It is not appropriate message queue name of the session message to SS_LoggerService(The name is NULL, more
+ /// than 20byte). [eFrameworkunifiedStatusInvldHandle]
+ /// - Is not a transmission type message queue type of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldHndlType]
+ /// - Session message queue is full to SS_LoggerService. [eFrameworkunifiedStatusMsgQFull]
+ /// - It is invalid transmission file descriptor of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message for
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - Incorrect size of the transmit buffer of the session message to SS_LoggerService. [eFrameworkunifiedStatusInvldBufSize]
+ /// - Any errors occur during the transmission of a session message to SS_LoggerService. [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message for SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Pub-Sub x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to register a callback function to receive a notification of the finish of the logging
+ /// operation.\n
+ /// (Using API:FrameworkunifiedSubscribeToSessionEventWithCallback of Native Service, to register a Callback function for CAN
+ /// logging finish notification.) \n
+ /// SS_LoggerService publish the logging finish of CAN in the notification of eSSLoggerCANEventFinished to
+ /// Subscribers.
+ /// \~english @see StartCANLogging, RegisterLoggingStartNotification
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterLoggingFinishNotification(CbFuncPtr f_pCallBackFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StartDTCLoggingToEmmc
+ /// \~english @par Summary
+ /// API to request the start of CAN logging to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to request the start of CAN logging to SS_LoggerService. \n
+ /// This function is called by CAN at the time of the trigger of the error that occurred in the DTC. \n
+ /// Progress is published by notifications eSSLoggerCANEventStart, eSSLoggerCANEventError and
+ /// eSSLoggerCANEventFinished. \n
+ /// To send a message in the command ID of eSSLoggerCANProtocolIDDTCTrigger against SS_LoggerService. \n
+ /// SS_LoggerService sends a message in the command ID of eThrdCmdImmPersistEvtLog against the event log writing
+ /// thread. \n
+ /// Event log writing thread will immediately start with respect to the event log for Persistent.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus StartDTCLoggingToEmmc(UI_32 f_dtc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ClearEventLogs
+ /// \~english @par Summary
+ /// API to request to clear the event log to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Pub-Sub
+ /// \~english @par Detail
+ /// Which is a method to request to clear the event log to SS_LoggerService. \n
+ /// To send a message in the command ID of SS_LOGGERCLEAREVENT against SS_LoggerService. \n
+ /// SS_LoggerService sends a message in the command ID of eThrdCmdClearEvntLogs against the event log writing
+ /// thread. \n
+ /// Event log write thread, delete all the event logs that are queued in the log write waiting. \n
+ /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the
+ /// command ID below.
+ /// - Success: SS_LOGGERCLEAREVENT_SUCCESS_RESP
+ /// - Failure: SS_LOGGERCLEAREVENT_ERROR_RESP
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearEventLogs(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ReadStatisticalCounter
+ /// \~english @par Summary
+ /// API to request a statistics counter reading of the event log to SS_LoggerService.
+ /// \~english @param [in] eCounterGroup
+ /// EStatCounterGroupID - Group ID of the statistics counter
+ /// \~english @par
+ /// EStatCounterGroupID enum value
+ /// \~english @code
+ /// typedef enum _ECounterGroupID
+ /// {
+ /// STARTUP_SHUTDOWN_COUNTER_GROUP =0x01, /* Statistics counter group for StartUp/Shutdown */
+ /// APP_USAGE_COUNTER_GROUP, /* Statistics counter group for application usage */
+ /// F_BLK_STABILITY_COUNTER_GROUP, /* Do not use : Statistics counter for flash access */
+ /// MAX_COUNTER_GROUP /* Max value of statistics counter group */
+ /// }EStatCounterGroupID ;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Fire and Forget
+ /// \~english @par Detail
+ /// Against SS_LoggerService, which is a method that requires a reading of the statistics counter corresponding
+ /// to the statistics counter groups in the event log. \n
+ /// To send a message in the command ID of SS_LOGGER_READ_STATL_COUNTER against SS_LoggerService. \n
+ /// SS_LoggerService sends a message in the command ID of eThrdCmdStatisticalCounter against the event log
+ /// writing thread. \n
+ /// Event log write thread read the statistics counter corresponding to the statistics counter groups in the
+ /// event log. \n
+ /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the
+ /// command ID below.
+ /// - Success: SS_LOGGER_READ_STATL_COUNTER_SUCCESS_RESP
+ /// - Failure: SS_LOGGER_READ_STATL_COUNTER_ERROR_RESP
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ReadStatisticalCounter(EStatCounterGroupID eCounterGroup);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ResetStatisticalCounter
+ /// \~english @par Summary
+ /// API to request the reset of statistics counters of the event log to SS_LoggerService.
+ /// \~english @param [in] eCounterGroup
+ /// EStatCounterGroupID - Group ID of the statistics counter
+ /// \~english @par
+ /// EStatCounterGroupID enum value
+ /// \~english @code
+ /// typedef enum _ECounterGroupID
+ /// {
+ /// STARTUP_SHUTDOWN_COUNTER_GROUP =0x01, /* Statistics counter group for StartUp/Shutdown */
+ /// APP_USAGE_COUNTER_GROUP, /* Statistics counter group for application usage */
+ /// F_BLK_STABILITY_COUNTER_GROUP, /* Do not use : Statistics counter for flash access */
+ /// MAX_COUNTER_GROUP /* Max value of statistics counter group */
+ /// }EStatCounterGroupID ;
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hSession) is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Fire and Forget
+ /// \~english @par Detail
+ /// Against SS_LoggerService, which is a method to reset the statistics counters corresponding to the statistics
+ /// counter groups in the event log. \n
+ /// To send a message in the command ID of SS_LOGGER_READ_STATL_COUNTER against SS_LoggerService. \n
+ /// SS_LoggerService sends a message in the command ID of eThrdCmdStatisticalCounter against the event log
+ /// writing thread. \n
+ /// Event log write thread reset the statistics counter corresponding to the statistics counter groups in the
+ /// event log. \n
+ /// As a result of the clearing process of the event log, the message is notified to the caller of the API in the
+ /// command ID below.
+ /// - Success: SS_LOGGER_RESET_STATL_COUNTER_SUCCESS_RESP
+ /// - Failure: SS_LOGGER_RESET_STATL_COUNTER_ERROR_RESP
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ResetStatisticalCounter(EStatCounterGroupID eCounterGroup);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_SetDiagID
+ /// \~english @par Summary
+ /// API to send the diagnosis ID to SS_LoggerService.
+ /// \~english @param [in] f_u16DiagID
+ /// UI_16 - Diagnosis ID
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Fire and Forget x Sync
+ /// \~english @par Detail
+ /// It is a method to send the diagnosis ID to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_SET_DIAGID to SS_LoggerService. \n
+ /// SS_LoggerService sets the diagnosis ID as a part of the suffix name of the event log storage file name.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_SetDiagID(UI_16 f_u16DiagID);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup LoggerIf_UploadEventLog
+ /// \~english @par Summary
+ /// API to request the upload of the event log to SS_LoggerService.
+ /// \~english @param None
+ /// \~english @retval eFrameworkunifiedStatusOK Success
+ /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+ /// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+ /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+ /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+ /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+ /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+ /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+ /// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+ /// \~english @par Preconditions
+ /// - SS_LoggerService process has been started.
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop) has been
+ /// done, and Availability of SS_LoggerService is TRUE.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - HANDLES in the class member variables (m_hService/m_hSession) is NULL. [eFrameworkunifiedStatusNullPointer]
+ /// - HANDLE in the class member variables (m_hSession) is not appropriate. (which is invalid)
+ /// [eFrameworkunifiedStatusNullPointer]
+ /// - SS_LoggerService message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+ /// - Message Queue HANDLE for the session for SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Message Queue HANDLE for the session for SS_LoggerService are not appropriate(which is invalid).
+ /// [eFrameworkunifiedStatusInvldHandle]
+ /// - Session message queue name to SS_LoggerService is NULL. [eFrameworkunifiedStatusInvldHandle]
+ /// - Is invalid transmission file descriptor of the session message to SS_LoggerService. [eFrameworkunifiedStatusErrNoEBADF]
+ /// - Interruption by the system call (signal) has occurred during the transmission of the session message to
+ /// SS_LoggerService. [eFrameworkunifiedStatusErrNoEINTR]
+ /// - It is an incorrect size of the transmit buffer of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusInvldBufSize]
+ /// - Some sort of error has occurred at the time of transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusFail]
+ /// - It failed to shared memory access for transmission of the session message to SS_LoggerService.
+ /// [eFrameworkunifiedStatusErrOther]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method x Fire and Forget
+ /// \~english @par Detail
+ /// Which is a method to request the upload of the event log to SS_LoggerService. \n
+ /// Send a message in the command ID of SS_LOGGER_UPLOAD_EVENTLOG to SS_LoggerService. \n
+ /// SS_LoggerService sends a message in the command ID of eThrdCmdUploadEventLog against the event log writing
+ /// thread. \n
+ /// Event log write thread upload the event log in the interior of the buffer. \n
+ /// Upload a result, the message is notified in the command ID of SS_LOGGER_UPLOAD_EVENTLOG_RES to the caller of
+ /// the API.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus LoggerIf_UploadEventLog();
+
+ private:
+ HANDLE OpenService();
+ EFrameworkunifiedStatus SendMessage(UI_32 f_cmdID, UI_32 f_size, void* f_pData);
+
+ HANDLE m_hApp;
+ HANDLE m_hService;
+ HANDLE m_hSession;
+};
+
+#endif /* SS_LOGGER_SERVICE_IFC_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of logger_service
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_local.h
new file mode 100755
index 0000000..0261f2e
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_local.h
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_service_local.h
+ * @brief \~english This file supports the the Logger Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup logger_service
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_LOGGER_SERVICE_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_LOGGER_SERVICE_LOCAL_H_
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Screen Capture Event data
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _TInterfaceunifiedSetLoggerParams {
+ ELOGGER_STAT Logger_State;
+ EDEV_TYPE Device_Type;
+}STLoggerSetParams;
+
+typedef struct _TInterfaceunifiedSetLoggerAllParams {
+ ELOGGER_STAT Logger_State;
+ EDEV_TYPE Device_Type;
+ ELOGGER_STAT Logger_UDPState;
+ UI_32 Log_FolderCnt;
+}STLoggerSetAllParams;
+
+typedef struct _TErrorLogger_FolderInfo {
+ static const UI_16 STR_BUFF_LEN = 64;
+ CHAR FoldernameAndLogname[STR_BUFF_LEN];
+ CHAR StorageTarget[STR_BUFF_LEN];
+}STLoggerFolderInfo;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Event logger resets counter information
+///////////////////////////////////////////////////////////////////////////////
+typedef union _uEvtLoggerCommonInfo {
+ STEventLoggerCommonInfo u_stEvtLoggerCommonInfo;
+ UI_8 CommonData[4];
+}UEvtLoggerCommonInfo;
+
+#pragma pack(1)
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger Event information
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _stLogEventss_ {
+ UI_32 ts;
+ UI_8 grp_ID;
+ UI_8 event_id;
+ UI_8 data[4];
+}st_LogEvent_ss;
+#pragma pack(0)
+
+/// Macros definition for the Event Logs
+#define MAX_EVT_RECORDS 20000
+#define MAX_EVENTLOG_SIZE 10*MAX_EVT_RECORDS ///< Max size for event logging
+
+typedef struct _TInterfaceunifiedEventLogPersistBuffer {
+ static const UI_16 EVT_BUFMAXSIZE = MAX_EVT_RECORDS;
+ st_LogEvent_ss EvtLog_Buffer[EVT_BUFMAXSIZE];
+ UI_16 Current_Log_Size;
+}STEventLogPersistBuffer;
+
+#endif /* SS_LOGGER_SERVICE_LOCAL_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+
+
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_notifications.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_notifications.h
new file mode 100755
index 0000000..7a5fc3d
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_notifications.h
@@ -0,0 +1,47 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_service_notifications.h
+ * @brief \~english This file supports the the Logger Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup logger_service
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_LOGGER_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define SS_LOGGER_SERVICE_NOTIFICATIONS_H_
+
+#include "system_service/ss_services.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger Service Availability Notification
+///////////////////////////////////////////////////////////////////////////////
+#define NTFY_SS_LoggerService_Availability SERVICE_LOGGER"/Availability"
+
+#endif /* SS_LOGGER_SERVICE_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
+
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_protocol.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_protocol.h
new file mode 100755
index 0000000..36c602c
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_service_protocol.h
@@ -0,0 +1,146 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_service_protocol.h
+ * @brief \~english This file supports the the Logger Service.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef _SS_LOGGER_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard)
+#define _SS_LOGGER_SERVICE_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger service event IDs
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _LoggerServiceProtocol {
+ SS_LOGGER_MILEAGE_DATA = 0x60,
+ SS_LOGGER_SET_PARAMS,
+ SS_LOGGER_STORE_SCREENCAPTURE_AND_LOG, // CLR+1+3
+ SS_LOGGER_STORE_SCREENCAPTURE, // CLR+1+2
+ SS_LOGGER_STORE_LOG, // ONHOOK+7+9
+ SS_LOGGER_SCREENCAPTURE_EVT_ACK, // Screen shot response (filename)
+ SS_LOGGER_EVENT_COMMONINFO,
+ SS_LOGGER__CWORD56__EVENT_INFO,
+ SS_LOGGER__CWORD56__RESET_INFO,
+ SS_LOGGER_SET_DATETIME,
+ SS_LOGGER_SET_VIN,
+ SS_LOGGER_UDP_LOGGING,
+ SS_LOGGER_ERROR_EVENT_ARTIFACT_REQ,
+ SS_LOGGER_ERROR_EVENT_ARTIFACT_RESP,
+ SS_LOGGER_SHUTDOWN_COMPLETE,
+ SS_LOGGER_DIAGDTC_ACTIVE,
+ SS_LOGGER_SET_DIAGID,
+ // Timer protocol IDs
+ SS_LOGGER_ERROR_EVENT_TIMER_ID_LOGGING_START_RSPN,
+ SS_LOGGER_ERROR_EVENT_TIMER_ID_ARTIFACT_RESPONSE,
+ SS_LOGGER_ERROR_EVENT_TIMER_ID_SCREEN_CAPTURE_RSPN,
+}SS_LoggerServiceProtocol;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Logger service event IDs
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _SS_LOGGERSERVICEPROTOCOL {
+ SS_LOGGERCOPYEVENTUSB = 0x80, // HMI to Dispatcher
+ SS_LOGGERCOPYEVENTUSB_SUCCESS_RESP,
+ SS_LOGGERCOPYEVENTUSB_ERROR_RESP,
+ SS_LOGGERCOPYEMERGENCYLOGS,
+ SS_LOGGERCOPYEMERGENCYLOGS_SUCCESS_RESP,
+ SS_LOGGERCOPYEMERGENCYLOGS_ERROR_RESP,
+ SS_LOGGERCLEAREVENT, // HMI to Dispatcher
+ SS_LOGGERCLEAREVENT_SUCCESS_RESP,
+ SS_LOGGERCLEAREVENT_ERROR_RESP,
+ SS_LOGGER_READ_STATL_COUNTER,
+ SS_LOGGER_READ_STATL_COUNTER_SUCCESS_RESP,
+ SS_LOGGER_READ_STATL_COUNTER_ERROR_RESP,
+ SS_LOGGER_RESET_STATL_COUNTER,
+ SS_LOGGER_RESET_STATL_COUNTER_SUCCESS_RESP,
+ SS_LOGGER_RESET_STATL_COUNTER_ERROR_RESP,
+ SS_LOGGER_ENG_READ_NUMOFEVENTS,
+ SS_LOGGER_ENG_READ_NUMOFEVENTS_RESP,
+ SS_LOGGER_ENG_READ_STATISTICAL_COUNTERS,
+ SS_LOGGER_ENG_READ_STATISTICAL_COUNTERS_RESP,
+ SS_LOGGER_UPLOAD_EVENTLOG,
+ SS_LOGGER_UPLOAD_EVENTLOG_RESP
+}SS_loggerserviceprotocol;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+/// \brief Private events for the following categories of devices
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _LoggerServerEvents {
+ SS_LOGGER_SCREENCAPTURE_EVT = 0xA0, // Screen shot request from PLM.
+ SS_LOGGER_ERRORINFO_EVT,
+ SS_LOGGER_LOGINFO_EVT,
+ SS_LOGGER_LOGSTARTED_EVT
+}SS_LoggerServerEvents;
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \brief eSSLoggerCANProtocolID
+///
+/// \note These IDs depict the possible events coming from CAN to logger_service
+///
+/////////////////////////////////////////////////////////////////////////////////////
+enum eSSLoggerCANProtocolID {
+ eSSLoggerCANProtocolIDCANTrigger = 0x10000000, /// Start logging to USB
+ eSSLoggerCANProtocolIDDTCTrigger /// Start logging of DTC to emmc
+};
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \brief eSSLoggerCANEvent
+///
+/// \note Events that are published to CAN for HK and CAN logging. Data structures
+/// attached to the single events can be found in below table
+/// | EventId | Return type |
+/// | :------------------------ | :------------------------ |
+/// | eSSLoggerCANEventStart | None |
+/// | eSSLoggerCANEventError | STEventCANLoggerEventInfo |
+/// | eSSLoggerCANEventFinished | STEventCANLoggerEventInfo |
+///
+/////////////////////////////////////////////////////////////////////////////////////
+enum eSSLoggerCANEvent {
+ eSSLoggerCANEventStart = 0x10001000, /// Logging has started for HK and CAN events
+ eSSLoggerCANEventError, /// Logging has aborted with an error
+ eSSLoggerCANEventFinished /// Logging has finished succesfully
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SS_DEVICEDETECTION_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_store_logs.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_store_logs.h
new file mode 100755
index 0000000..7c68fd9
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_logger_store_logs.h
@@ -0,0 +1,81 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_logger_store_logs.h
+ * @brief This file supports the logger service interface for SystemManager.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_LOGGER_STORE_LOGS_H_ // NOLINT (build/header_guard)
+#define SS_LOGGER_STORE_LOGS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include "system_service/interfaceunified_system_types.h"
+
+#include <string>
+#include <vector>
+
+
+#ifdef _cplusplus
+extern "C" {
+#endif
+#define SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG"
+
+typedef enum {
+ SS_STORELOGS_INTERFACEUNIFIEDLOG = 0,
+ SS_STORELOGS_ILLEGAL,
+ SS_STORELOGS_ACCOFFON,
+
+ SS_STORELOGS_SYS_ILLEGAL,
+ SS_STORELOGS_ACCOFFON_PRESS,
+
+ SS_STORELOGS_MAX
+} SS_STORELOGS_OPE_TYPE;
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup logger_service
+///
+/// \brief SSLoggerSrvIfWriteDebugLogs
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SS_LoggerStoreLogs(SS_STORELOGS_OPE_TYPE type);
+
+EFrameworkunifiedStatus SS_LoggerStoreLogs_deleteOldLogAbnrm(const std::string& log_path, std::vector<std::string>& l_vector,
+ const std::string& f_archive_destination, SI_32 max_num,
+ UI_32 abnrm_total);
+
+EFrameworkunifiedStatus StartRtUsbLogThread(HANDLE hApp);
+EFrameworkunifiedStatus StopRtUsbLogThread(HANDLE hApp);
+
+#ifdef _cplusplus
+}
+#endif
+
+#endif /* SS_LOGGER_STORE_LOGS_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service.h
new file mode 100755
index 0000000..15ba033
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service.h
@@ -0,0 +1,535 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service.h
+ * @brief \~english This file supports the Power Service interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup power_service
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_POWER_SERVICE_H_ // NOLINT (build/header_guard)
+#define SS_POWER_SERVICE_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include "system_service/ss_system_types.h"
+
+
+
+typedef enum _PwLevelTypes {
+ epspltUNKNOWN,
+ epspltWAKEUP = 0x99,
+ epspltNORMAL,
+ epspltSHUTDOWN,
+ epspltEMERGENCY,
+} PowerSrvLevelType, EPWR_LEVEL_TYPE;
+
+
+typedef enum {
+ epsstUNKNOWN,
+ epsstBASIC,
+ epsstSUPERVISOR,
+ epsstSYSTEM,
+} PowerSrvSessionType, EPWR_SESSION_TYPE;
+
+
+typedef enum {
+ epscnINVALID = 0xFF,
+ epscnCANWAKEUP = 0x07, //< All modules up with Display Off and Audio Muted
+ epscnCANSLEEP = 0x08, //< Communication and all modules shut down
+} ePowerSrvCANStates, EPWR_CAN_STATE_TYPE;
+
+
+
+// Not in use for PastModel003*1. Can be used for Platform
+typedef enum {
+ epswlINVALID = 0xFF,
+ epswlFULLRUN = 0x0A, //< Normal ignition on and full wakeup
+ epswlLOCALWAKEUP = 0x0B, //< Only certain modules are up.
+} ePowerSrvWakeupLevels, EPWR_WAKEUP_LEVEL_TYPE;
+
+typedef EPWR_WAKEUP_LEVEL_TYPE * PEPWR_WAKEUP_LEVEL_TYPE;
+
+typedef enum {
+ epswsINVALID = 0xFF,
+ epswsPWRON = 0x00, //< Enable Display and Audio
+ epswsPWROFF = 0x01, //< Disable Audio and HMI
+} ePowerSrvPowerStates, EPWR_POWER_STATE_TYPE;
+
+
+typedef enum {
+ epsvsINVALID = 0xFF,
+ epsvsNORMAL = 0x20,
+ epsvsLVI1 = 0x22,
+ epsvsLVI2 = 0x24,
+} ePowerSrvVoltageStates, EPWR_VOLTAGE_STATE_TYPE;
+
+typedef EPWR_VOLTAGE_STATE_TYPE * PEPWR_VOLTAGE_STATE_TYPE;
+
+typedef enum {
+ epscsINVALID = 0xFF,
+ epscsENTRY = 0xA0,
+ epscsEXIT = 0xA2,
+} ePowerSrvCrankStates, EPWR_CRANK_STATE_TYPE;
+
+
+//******************************************************************************
+// Startup Reason / EPWR_WAKEUP_FACTOR_TYPE typedefs *
+// *
+/**
+ * \~english
+ */
+typedef enum {
+ epswfINVALID = 0xFF, //!< \~english
+ epswfTESTACC = 0x00, //!< \~english
+ epswfON_KEY = 0x01, //!< \~english
+ epswfIGN_ACC = 0x02, //!< \~english
+ epswfDR_OPEN_CLOSE = 0x03, //!< \~english
+ epswfDX_ACTIVATION = 0x04, //!< \~english
+ epswfPASS_ACTIVATION = 0x05, //!< \~english
+ epswfSPVACTIVATION = 0x06, //!< \~english
+ epswfUSER_DATA_RESET = 0x07 //!< \~english
+//
+// Carry-over enums from CCR
+//
+// epswfPWRBUTTONON = 0x0C,
+// epswfIGNON = 0x0D,
+// epswfDISCEJECT = 0x0F,
+// epswfSHOWTIME = 0x11,
+// epswfPHONECALL = 0x12,
+//
+// End of Carry-over enums from CCR
+//
+} ePowerSrvWakeupFactors, EPWR_WAKEUP_FACTOR_TYPE;
+typedef EPWR_WAKEUP_FACTOR_TYPE * PEPWR_WAKEUP_FACTOR_TYPE;
+// *
+// End of Startup Reason / EPWR_WAKEUP_FACTOR_TYPE *
+//******************************************************************************
+
+//****************************************************************************
+// Shutdown Popup Protocol enums & typedefs *
+// *
+typedef enum { // *
+ epsspPowerSave1 = 0x00, // *
+ epsspPowerSave2 = 0x01, // *
+ epsspPowerSave3 = 0x02, // *
+ epsspPowerSaveClr = 0x03, // *
+ epsspLowVoltage1 = 0x04, // *
+ epsspLowVoltage2 = 0x05, // *
+ epsspLowVoltage3 = 0x06, // *
+ epsspLowVoltageClr = 0x07, // *
+ epsspBattCouplingSW1 = 0x08, // *
+ epsspBattCouplingSW2 = 0x09, // *
+ epsspBattCouplingSW3 = 0x0A, // *
+ epsspBattCouplingSWClr = 0x0B, // *
+ epsspAbnormalTemp_1st = 0x0C, // *
+ epsspAbnormalTemp_Clr = 0x0D, // *
+ epsspLimpHome_1st = 0x0E, // *
+ epsspLimpHome_2nd = 0x0F, // *
+ epsspLimpHome_3rd = 0x10, // *
+ epsspLimpHome_Clr = 0x11, // *
+ epsspProdMd_1st = 0x12, // *
+ epsspProdMd_Clr = 0x13, // *
+ epsspTransMd_1st = 0x14, // *
+ epsspTransMd_Clr = 0x15, // *
+ epsspAllClr = 0xFF // *
+} ePwrServiceShutdownPopupType, EPWR_SHUTDOWN_POPUP_TYPE; // *
+ // *
+// *
+// End of Shutdown Condition Protocol enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// CPMShowPowerPopup Protocol enums & typedefs *
+// *
+typedef enum { // *
+ epssppNormal = 0x00, // *
+ epssppCritical = 0x01, // *
+ epssppAppCritical = 0x02, // *
+ epssppAllClr = 0xFF // *
+} ePwrServicePowerPopupType, EPWR_POWER_POPUP_TYPE; // *
+ // *
+// *
+// End of CPMShowPowerPopup Protocol enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Limp Home Cutoff Protocol enums & typedefs *
+// *
+typedef enum { // *
+ epslhcINVALID = 0xFF, // *
+ epslhcDISABLED = 0x00, // *
+ epslhcENABLED = 0x01 // *
+} ePwrServiceLHCType, EPWR_LHC_TYPE; // *
+ // *
+// *
+// End of Limp Home Cutoff Protocol enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Production Mode Protocol enums & typedefs *
+// *
+typedef enum { // *
+ epspmINVALID = 0xFF, // *
+ epspmDISABLED = 0x00, // *
+ epspmENABLED = 0x01 // *
+} ePwrServiceProdModeType, EPWR_PROD_MODE_TYPE; // *
+ // *
+// *
+// End of Production Mode Protocol enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Transport Mode Protocol enums & typedefs *
+// *
+typedef enum { // *
+ epstmINVALID = 0xFF, // *
+ epstmDISABLED = 0x00, // *
+ epstmENABLED = 0x01 // *
+} ePwrServiceTransportModeType, EPWR_TRANSPORT_MODE_TYPE; // *
+ // *
+// *
+// End of Transport Mode Protocol enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Last User Mode, User Mode , User Mode Change Reason Protocol enums & *
+// typedefs *
+// *
+/**
+ * \~english
+ */
+typedef enum {
+ epsumINVALID = 0xFF, //!< \~english
+ epsumOFF = 0x00, //!< \~english
+ epsumON = 0x01 //!< \~english
+} ePwrServiceUserModeType, EPWR_USER_MODE_TYPE;
+
+/**
+ * \~english State transition reason.
+ */
+typedef enum {
+ epsumcrNOT_AVAILABLE = 0x00, //!< \~english Not available.
+ epsumcrON_KEY = 0x01, //!< \~english
+ epsumcrPARKING_B, //!< \~english Parking(+B) Power state transition.
+ epsumcrPRE_BA, //!< \~english Pre-boot(+BA) Power state transition.
+ epsumcrNORMAL, //!< \~english Normal-boot Power state transition.
+ epsumcrBACKGROUND_BA, //!< \~english Background-boot(+BA) Power state transition.
+} ePwrServiceUserModeChangeReasonType, EPWR_USER_MODE_CHANGE_REASON_TYPE;
+ // *
+// *
+// End of Last User Mode, User Mode Protocol enums & typedefs *
+//****************************************************************************
+
+/**
+ * \~english
+ */
+typedef struct _upinfo {
+ EPWR_WAKEUP_LEVEL_TYPE level; //!< \~english
+ EPWR_WAKEUP_FACTOR_TYPE factor; //!< \~english
+ EPWR_USER_MODE_CHANGE_REASON_TYPE userModeChangeReason; //!< \~english State transition reason.
+} upInfo;
+
+/**
+ * \~english
+ */
+typedef struct _wakeinfo {
+ EPWR_POWER_STATE_TYPE powerupType; //!< \~english
+ upInfo up; //!< \~english
+} wakeInfo;
+
+//****************************************************************************
+// System Mode Info enums & typedefs *
+// *
+typedef enum { // *
+ epssinfINVALID = 0xFF, // *
+ epssinfNORMAL = 0x00, // *
+ epssinfPROGRAMMING = 0x08, // *
+}ePowerSrvSystemModeInfo, EPWR_SYSTEM_MODE_INFO; // *
+ // *
+typedef enum { // *
+ epssusfINVALID = 0xFF, // *
+ epssusSYSTEM_SERVICES_STARTED = 0x00, // *
+ epssusALL_SERVICES_LAUNCHED = 0x01 // *
+}ePowerSrvStartupStageType, EPWR_STARTUP_STAGE_TYPE; // *
+ // *
+typedef struct _SystemModeInfo { // *
+ EPWR_USER_MODE_TYPE lastUserMode; // NOTE: Don't use this. just only remained for backward compatibility.
+ EPWR_LHC_TYPE limpHomeCutoff; // *
+ EPWR_PROD_MODE_TYPE productionMode; // *
+ EPWR_TRANSPORT_MODE_TYPE transportMode; // *
+ EPWR_SYSTEM_MODE_INFO systemMode; // *
+ EPWR_STARTUP_STAGE_TYPE startupStage; // *
+} SystemModeInfo; // *
+// *
+// End of System Mode Info enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Startup Confirmation enums & typedefs *
+// *
+typedef enum { // *
+ eps_CWORD56_bmINVALID = 0xFF, // *
+ eps_CWORD56_bmAPPLICATION_MODE = 0x00, // *
+ eps_CWORD56_bmPROGRAMMING_MODE = 0x08 // *
+} EPWR_SC__CWORD56__BOOT_MODE_TYPE; // *
+ // *
+typedef enum { // *
+ epsstINVALID = 0xFF, // *
+ epsstWARMSTART = 0x00, // *
+ epsstCOLDSTART = 0x01 // *
+} EPWR_SC_WAKEUP_TYPE; // *
+ // *
+typedef enum { // *
+ epsscrtINVALID = 0xFF, // *
+ epsscrtNOT_REQUIRED = 0x00, // *
+ epsscrtREQUIRED = 0x01 // *
+} EPWR_SC_COLD_START_REQ_TYPE; // *
+ // *
+typedef enum { // *
+ epsssINVALID = 0xFF, // *
+ epsssUNLOCK = 0x00, // *
+ epsssLOCK = 0x01 // *
+} EPWR_SC_SECURITY_STATUS; // *
+ // *
+typedef struct { // *
+ EPWR_SC__CWORD56__BOOT_MODE_TYPE _CWORD56_BootMode; // *
+ EPWR_SC_WAKEUP_TYPE wakeupType; // *
+ EPWR_SC_COLD_START_REQ_TYPE coldStartRequest; // *
+ EPWR_SC_SECURITY_STATUS securityStatus; // *
+ UI_32 HWVersion; // *
+ UI_32 matchedHardwareType; // *
+ UI_32 softwareType; // *
+ UI_32 imageType; // *
+ UI_32 majorVersion; // *
+ UI_32 minorVersion; // *
+ UI_32 SWVersionYear; // *
+ UI_32 SWVersionWeek; // *
+ UI_32 SWVersionPatchLevel; // *
+} StartupConfirmationMsgStrut, EPWR_SC_MSG_STRUCT; // *
+// *
+// End of Startup Confirmation enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// Power Request Message enums & typedefs *
+// *
+/**
+ * _CWORD102_ Startup Information
+ */
+typedef enum {
+ epsprm_CWORD102_siINVALID = 0xFF, //!< \~english
+ epsprm_CWORD102_si_CWORD102__STARTUP_NORMAL = 0x00, //!< Normal Startup
+ epsprm_CWORD102_si_CWORD102__STARTUP_AFTER_RESET = 0x01 //!< Startup after Irregular Reset
+}ePowerSrv_CWORD102_StartupInfoType, EPWR__CWORD102__STARTUP_INFO_TYPE;
+/**
+ * Opening Type
+ */
+typedef enum {
+ epsprmotINVALID = 0xFF, //!< \~english
+ epsprmotTIMING_TYPE_1 = 0x00, //!< CI/DI Show timing type1
+ epsprmotTIMING_TYPE_2 = 0x01 //!< CI/DI Show timing type2
+} ePowerSrvPwrReqMsgCIDIOpeningType, EPWR_OPENING_TYPE;
+/**
+ * Manual Reset Information
+ */
+typedef enum {
+ epsprmriINVALID = 0xFF, //!< \~english
+ epsprmriNORMAL = 0x00, //!< \~english
+ epsprmriWAKEUP_AFTER_RESET = 0x01 //!< \~english
+} ePowerSrvPwrManResetInfoType, EPWR_MAN_RESET_INFO_TYPE;
+/**
+ * Last System Retention Request
+ */
+typedef enum {
+ epsprlsrrINVALID = 0xFF, //!< \~english
+ epsprlsrrLAST_SYSTEM_OFF = 0x00, //!< \~english
+ epsprlsrrLAST_SYSTEM_ON = 0x01 //!< \~english
+} ePowerSrvTypeLastSysRetReq, EPWR_LAST_SYS_RET_REQ_TYPE;
+
+// *
+typedef struct { // *
+ EPWR__CWORD102__STARTUP_INFO_TYPE startupType; // *
+ EPWR_OPENING_TYPE openingType; // *
+ EPWR_WAKEUP_FACTOR_TYPE startupReason; // *
+ EPWR_USER_MODE_TYPE lastUserMode; // *
+ EPWR_MAN_RESET_INFO_TYPE manResetInfo; // *
+ EPWR_LAST_SYS_RET_REQ_TYPE lastSystemRetentionReq; // *
+ EPWR_USER_MODE_TYPE userMode; // *
+} PowerRequestMsgStrut, EPWR_POWER_REQUEST_MSG_STRUCT; // *
+
+/**
+ * \~english structure for power request message
+ */
+typedef struct {
+ EPWR__CWORD102__STARTUP_INFO_TYPE startupType; //!< \~english
+ EPWR_OPENING_TYPE openingType; //!< \~english
+ EPWR_WAKEUP_FACTOR_TYPE startupReason; //!< \~english
+ EPWR_USER_MODE_TYPE lastUserMode; //!< \~english
+ EPWR_MAN_RESET_INFO_TYPE manResetInfo; //!< \~english
+ EPWR_LAST_SYS_RET_REQ_TYPE lastSystemRetentionReq; //!< \~english
+ EPWR_USER_MODE_TYPE userMode; //!< \~english
+ EPWR_USER_MODE_CHANGE_REASON_TYPE userModeChangeReason; //!< \~english State transition reason.
+} PowerRequestMsgStrutWithUMCR, EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR;
+// *
+// End of Power Request Message enums & typedefs *
+//****************************************************************************
+
+
+
+//****************************************************************************
+// Shutdown Request Message enums & typedefs *
+// *
+// ONS *
+// *
+typedef enum { // *
+ epssdmonsINVALID = 0xFF, // *
+ epssdmonsNO_ONS = 0x00, // *
+ epssdmonsONS = 0x01 // *
+} ePowerSrvONSType, EPWR_ONS_TYPE; // *
+// *
+// Shutdown Trigger *
+// *
+typedef enum { // *
+ epssdmsdtINVALID = 0xFF, // *
+ epssdmsdtTESTACC_OFF = 0x00, // *
+ epssdmsdtON_KEY = 0x01, // *
+ epssdmsdtIGN_LOCK = 0x02, // *
+ epssdmsdtPWR_SAVE = 0x03, // *
+ epssdmsdtTMP_STARTUP = 0x04, // *
+ epssdmsdtDIAG_DEACTIVATION = 0x05, // *
+ epssdmsdtABNORMAL_VOLTAGE = 0x06, // *
+ epssdmsdtABNORMAL_TEMP = 0x07, // *
+ epssdmsdtBATTERYCUTOFF = 0x08, // *
+ epssdmsdtLIMPHOME = 0x09, // *
+ epssdmsdtHU_CAN_ERROR = 0x0A, // *
+ epssdmsdtBODY_CAN_ERROR = 0x0B, // *
+ epssdmsdtTRANSPORT_MODE = 0x0C, // *
+ epssdmsdtPRODUCTION_MODE = 0x0D, // *
+ epssdmsdtIGN_OFF = 0x0E, // *
+ epssdmsdtGENERIC_ERROR_RESET = 0x0F, // *
+ epssdmsdtFATAL_ERROR_RESET = 0x10, // *
+ epssdmsdtUSER_DATA_RESET = 0x11, // *
+ epssdmsdtFACTORY_DATA_RESET = 0x12, // *
+ epssdmsdtFAST_SLEEP_MODE = 0x13, // *
+ epssdmsdtNORMAL_RESET = 0x14, // *
+ epssdmsdtPROGUPDATE_RESET = 0x15, // cannot use this
+ // *
+ // Note to self: Make sure to update all enum-to-enum and *
+ // enum-to-string maps when changing these enums ! *
+} ePowerSrvPwrShutdownTriggerType, EPWR_SHUTDOWN_TRIGGER_TYPE; // *
+// *
+typedef struct { // *
+ EPWR_ONS_TYPE ONS_Type; // *
+ EPWR_SHUTDOWN_TRIGGER_TYPE shutdownTrigger; // *
+ EPWR_USER_MODE_TYPE lastUserMode; // *
+ EPWR_TRANSPORT_MODE_TYPE transportMode; // *
+ EPWR_PROD_MODE_TYPE productionMode; // *
+ EPWR_LHC_TYPE limpHomeCutoffRequest; // *
+} ShutdownRequestMsgStrut, EPWR_SHUTDOWN_REQUEST_MSG_STRUCT; // *
+// *
+// End of Shutdown Request Message enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// HeartBeat enums & typedefs *
+// *
+// HeartBeat Request Message *
+typedef struct { // *
+ UI_8 IntervalSec; // *
+} EPWR_HB_REQ_MSG_STRUCT; // *
+// *
+// HeartBeat Response Message *
+// Zero byte data message returned. *
+// End of HeartBeat enums & typedefs *
+//****************************************************************************
+
+//****************************************************************************
+// CPU Reset Reason enums & typedefs *
+typedef enum { // *
+ epsCpuResetReasonGeneric = 0 // *
+ , epsCpuResetReasonFatalError // *
+ , epsCpuResetReasonUserDataReset // *
+ , epsCpuResetReasonFactoryDataReset // *
+ , epsCpuResetReasonUserForceReset // *
+ , epsCpuResetReasonShipmentModeReset // *
+ , epsCpuResetReasonHeadUnitReset // *
+ , epsCpuResetReasonNormalReset // *
+ , epsCpuResetReasonProgupdateReset // cannot use this
+} epsCpuResetReason; // *
+//
+typedef struct {
+#define PWR_RESET_MSG_STR_SIZE 32
+ epsCpuResetReason resetReason; // *
+ CHAR messageStr[PWR_RESET_MSG_STR_SIZE]; // *
+} SS_Pwr_CpuResetMsgStruct;
+// *
+// End of CPU Reset Reason enums & typedefs *
+//****************************************************************************
+
+typedef struct {
+ union _data {
+ wakeInfo wake;
+
+ struct _crank {
+ EPWR_CRANK_STATE_TYPE state;
+ }crank;
+
+ struct _voltage {
+ EPWR_VOLTAGE_STATE_TYPE state;
+ }voltage;
+
+ struct _ws_complete {
+ EPWR_WAKEUP_LEVEL_TYPE level;
+ EPWR_WAKEUP_FACTOR_TYPE factor;
+ }wk_shdwn_complete;
+
+ struct _commwake {
+ EPWR_CAN_STATE_TYPE state;
+ }commwake;
+
+ struct _UserMode {
+ EPWR_USER_MODE_TYPE mode;
+ } user_mode;
+
+ struct _ShutdownPopup {
+ EPWR_SHUTDOWN_POPUP_TYPE shutdownPopupEvent;
+ } shutdownPopup;
+
+ struct _PowerPopup {
+ EPWR_POWER_POPUP_TYPE powerPopupEvent;
+ } powerPopup;
+
+ StartupConfirmationMsgStrut startupConfirmationMsg;
+ PowerRequestMsgStrutWithUMCR powerRequestMsg;
+ ShutdownRequestMsgStrut shutdownRequestMsg;
+ }data;
+} Pwr_ServiceSetInterface;
+
+#endif /* SS_POWER_SERVICE_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/ // end of power_service
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_if.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_if.h
new file mode 100755
index 0000000..d0ace60
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_if.h
@@ -0,0 +1,606 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service_if.h
+ * @brief \~english This file supports the Power Service client interface.
+ */
+/**
+ * @file
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup power_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_IF_H_ // NOLINT (build/header_guard)
+#define POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_IF_H_
+
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_power_service_protocol.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup OpenPowerService
+/// \~english @par Summary
+/// Obtain a handle for using the PowerService.
+/// \~english @param [in] f_hApp
+/// HANDLE - Application handle
+/// \~english @retval Handle Success
+/// \~english @retval NULL Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// - The API creates a communication resource between
+/// the user service and the PowerService
+/// and returns a handle for using the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE OpenPowerService(HANDLE f_hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ClosePowerService
+/// \~english @par Summary
+/// Free a handle for using PowerService.
+/// \~english @param [in] f_hApp
+/// HANDLE - Application handle
+/// \~english @param [in] f_hService
+/// HANDLE - PowerService handle
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail
+/// - The API terminates the communication resource between
+/// the user service and the PowerServiceand frees the given handle. \n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus ClosePowerService(HANDLE f_hApp, HANDLE f_hService);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceOpenSessionRequest
+/// \~english @par Summary
+/// Make the PowerService available.
+/// \~english @param [in] f_hService
+/// HANDLE - PowerService handle
+/// \~english @param [in] f_eSessionType
+/// EPWR_SESSION_TYPE - Session type
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget x Method
+/// \~english @par Detail
+/// - The API opens a session between the user service
+/// and the PowerService and makes the PowerService available. \n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceOpenSessionRequest(HANDLE f_hService,
+ EPWR_SESSION_TYPE f_eSessionType);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceCloseSessionRequest
+/// \~english @par Summary
+/// End using the PowerService.
+/// \~english @param [in] f_hService
+/// HANDLE - PowerService handle
+/// \~english @param [in] f_hSession
+/// HANDLE - Session type
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget x Method
+/// \~english @par Detail
+/// - The API closes the session between the user service
+/// and the PowerService and terminatesthe PowerSerivce use. \n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceCloseSessionRequest(HANDLE f_hService, HANDLE f_hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceDecodeOpenSessionResponse
+/// \~english @par Summary
+/// Obtain a handle for OpenSessionRequest response message.
+/// \~english @param [in] f_hApp
+/// HANDLE - Application handle
+/// \~english @param [in] f_hSession
+/// HANDLE& - Address of storing session handle
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// - The API obtains a handle for OpenSessionRequest
+/// response message using the given application handle.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceDecodeOpenSessionResponse(HANDLE f_hApp,
+ HANDLE& f_hSession); // NOLINT (runtime/references)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSetVoltageState
+/// \~english @par Summary
+/// Set power supply state.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eVoltage_state
+/// EPWR_VOLTAGE_STATE_TYPE - Power supply status value
+/// \~english @par
+/// - Power supply status value
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epsvsINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epsvsNORMAL</td><td>0x20</td></tr>
+/// <tr><td>epsvsLVI1</td><td>0x22</td></tr>
+/// <tr><td>epsvsLVI2</td><td>0x24</td></tr>
+/// </table>
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail
+/// - The API sets power supply state to the PowerService. \n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSetVoltageState(HANDLE f_hSession,
+ EPWR_VOLTAGE_STATE_TYPE f_eVoltage_state);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSetCrankState
+/// \~english @par Summary
+/// Set crank state.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eCrank_state
+/// EPWR_CRANK_STATE_TYPE - Crank state value
+/// \~english @par
+/// - Crank state value
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epscsINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epscsENTRY</td><td>0xA0</td></tr>
+/// <tr><td>epscsEXIT</td><td>0xA2</td></tr>
+/// </table>
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// - The API sets crank state to the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSetCrankState(HANDLE f_hSession,
+ EPWR_CRANK_STATE_TYPE f_eCrank_state);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSystemModeInfoRequest
+/// \~english @par Summary
+/// Request to obtain the system mode information.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method x Method
+/// \~english @par Detail
+/// - The API requests the PowerService to obtain
+/// the system mode information.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSystemModeInfoRequest(HANDLE f_hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendInitCompReport
+/// \~english @par Summary
+/// Send an initialize complete response.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forgeat x Fire and Forget
+/// \~english @par Detail
+/// - The API sends an initialize complete response to the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendInitCompReport(HANDLE f_hSession);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendSetShutdownPopupRequest
+/// \~english @par Summary
+/// Obtain shutdown state.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eShutdownPopup
+/// EPWR_SHUTDOWN_POPUP_TYPE - Shutdown state
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail
+/// - The API obtains the shutdown state from the PowerService. \n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendSetShutdownPopupRequest(HANDLE f_hSession,
+ EPWR_SHUTDOWN_POPUP_TYPE f_eShutdownPopup);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendStartupConfirmationMsgRequest
+/// \~english @par Summary
+/// Send startup confirmation request.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eState
+/// EPWR_SC_MSG_STRUCT
+/// - Address of the structure for startup confirmation request message
+/// \~english @par
+/// - Structure for startup confirmation request message
+/// \~english @code
+/// typedef struct {
+/// EPWR_SC__CWORD56__BOOT_MODE_TYPE _CWORD56_BootMode;
+/// EPWR_SC_WAKEUP_TYPE wakeupType;
+/// EPWR_SC_COLD_START_REQ_TYPE coldStartRequest;
+/// EPWR_SC_SECURITY_STATUS securityStatus;
+/// UI_32 HWVersion;
+/// UI_32 matchedHardwareType;
+/// UI_32 softwareType;
+/// UI_32 imageType;
+/// UI_32 majorVersion;
+/// UI_32 minorVersion;
+/// UI_32 SWVersionYear;
+/// UI_32 SWVersionWeek;
+/// UI_32 SWVersionPatchLevel;
+/// } StartupConfirmationMsgStrut, EPWR_SC_MSG_STRUCT;
+/// @endcode\n
+/// \n
+/// - EPWR_SC__CWORD56__BOOT_MODE_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>eps_CWORD56_bmINVALID</td><td>0xFF</td></tr>
+/// <tr><td>eps_CWORD56_bmAPPLICATION_MODE</td><td>0x00</td></tr>
+/// <tr><td>eps_CWORD56_bmPROGRAMMING_MODE</td><td>0x08</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_SC_WAKEUP_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epsstINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epsstWARMSTART</td><td>0x00</td></tr>
+/// <tr><td>epsstCOLDSTART</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_SC_COLD_START_REQ_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epsscrtINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epsscrtNOT_REQUIRED</td><td>0x00</td></tr>
+/// <tr><td>epsscrtREQUIRED</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_SC_SECURITY_STATUS
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epsssINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epsssUNLOCK</td><td>0x00</td></tr>
+/// <tr><td>epsssLOCK</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget x Fire and Forget
+/// \~english @par Detail
+/// - The API sends a startup confirmation request to the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendStartupConfirmationMsgRequest(HANDLE f_hSession
+ , EPWR_SC_MSG_STRUCT f_eState);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendPowerRequest
+/// \~english @par Brief
+/// Send power request.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eState
+/// \ref PowerRequestMsgStrutWithUMCR "EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR&" - Address of the structure for power request message
+/// \~english @par
+/// \n
+/// Of the eight elements of the \ref PowerRequestMsgStrutWithUMCR "EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR" structure, five elements set fixed values.\n
+/// startupType = \ref epsprm_CWORD102_si_CWORD102__STARTUP_NORMAL\n
+/// openingType = \ref epsprmotTIMING_TYPE_1\n
+/// lastUserMode = \ref epsumON\n
+/// manResetInfo = \ref epsprmriNORMAL\n
+/// lastSystemRetentionReq = \ref epsprlsrrLAST_SYSTEM_OFF\n
+/// \n
+/// For the following, set different values at system startup and shutdown.\n
+/// (Element name) = (Startup settings or Shutdown settings)\n
+/// startupReason = (\ref epswfIGN_ACC or \ref epswfINVALID)\n
+/// userMode = (\ref epsumON or \ref epsumOFF)\n
+/// \n
+/// For the following, set different values at power state transition.\n
+/// <table>
+/// <tr bgcolor="black"><th>Element name</th><th>Power state</th><th>Value</th></tr>
+/// <tr><td rowspan=7>userModeChangeReason</td><tr><td>Not Available</td><td>\ref epsumcrNOT_AVAILABLE</td></tr>
+/// <tr><td> </td><td>\ref epsumcrON_KEY</td></tr>
+/// <tr><td>Parking(+B)</td><td>\ref epsumcrPARKING_B</td></tr>
+/// <tr><td>Pre-boot(+BA)</td> <td>\ref epsumcrPRE_BA</td></tr>
+/// <tr><td>Normal-boot</td> <td>\ref epsumcrNORMAL</td></tr>
+/// <tr><td>Background-boot(+BA)</td> <td>\ref epsumcrBACKGROUND_BA</td></tr>
+/// </table>
+/// \n
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// None
+/// \~english @par Conditions of processing failure
+/// - When the session handle (f_hSession) specified by the argument is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - The process fails for some reason. [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail
+/// - The API send a power request to the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendPowerRequest(HANDLE f_hSession,
+ EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR& f_eState);
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendShutdownRequest
+/// \~english @par Summary
+/// Send shutdown request.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eState
+/// EPWR_SHUTDOWN_REQUEST_MSG_STRUCT&
+/// - Address of the structure for shutdown request message
+/// \~english @par
+/// - Structure for shutdown request message
+/// \~english @code
+/// typedef struct {
+/// EPWR_ONS_TYPE ONS_Type;
+/// EPWR_SHUTDOWN_TRIGGER_TYPE shutdownTrigger;
+/// EPWR_USER_MODE_TYPE lastUserMode;
+/// EPWR_TRANSPORT_MODE_TYPE transportMode;
+/// EPWR_PROD_MODE_TYPE productionMode;
+/// EPWR_LHC_TYPE limpHomeCutoffRequest;
+/// } ShutdownRequestMsgStrut, EPWR_SHUTDOWN_REQUEST_MSG_STRUCT
+/// @endcode\n
+/// \n
+/// - EPWR_ONS_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epssdmonsINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epssdmonsNO_ONS</td><td>0x00</td></tr>
+/// <tr><td>epssdmonsONS</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_SHUTDOWN_TRIGGER_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epssdmsdtINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epssdmsdtTESTACC_OFF</td><td>0x00</td></tr>
+/// <tr><td>epssdmsdtON_KEY</td><td>0x01</td></tr>
+/// <tr><td>epssdmsdtIGN_LOCK</td><td>0x02</td></tr>
+/// <tr><td>epssdmsdtPWR_SAVE</td><td>0x03</td></tr>
+/// <tr><td>epssdmsdtTMP_STARTUP</td><td>0x04</td></tr>
+/// <tr><td>epssdmsdtDIAG_DEACTIVATION</td><td>0x05</td></tr>
+/// <tr><td>epssdmsdtABNORMAL_VOLTAGE</td><td>0x06</td></tr>
+/// <tr><td>epssdmsdtABNORMAL_TEMP</td><td>0x07</td></tr>
+/// <tr><td>epssdmsdtBATTERYCUTOFF</td><td>0x08</td></tr>
+/// <tr><td>epssdmsdtLIMPHOME</td><td>0x09</td></tr>
+/// <tr><td>epssdmsdtHU_CAN_ERROR</td><td>0x0A</td></tr>
+/// <tr><td>epssdmsdtBODY_CAN_ERROR</td><td>0x0B</td></tr>
+/// <tr><td>epssdmsdtTRANSPORT_MODE</td><td>0x0C</td></tr>
+/// <tr><td>epssdmsdtPRODUCTION_MODE</td><td>0x0D</td></tr>
+/// <tr><td>epssdmsdtIGN_OFF</td><td>0x0E</td></tr>
+/// <tr><td>epssdmsdtGENERIC_ERROR_RESET</td><td>0x0F</td></tr>
+/// <tr><td>epssdmsdtFATAL_ERROR_RESET</td><td>0x10</td></tr>
+/// <tr><td>epssdmsdtUSER_DATA_RESET</td><td>0x11</td></tr>
+/// <tr><td>epssdmsdtFACTORY_DATA_RESET</td><td>0x12</td></tr>
+/// <tr><td>epssdmsdtFAST_SLEEP_MODE</td><td>0x13</td></tr>
+/// <tr><td>epssdmsdtNORMAL_RESET</td><td>0x14</td></tr>
+/// <tr><td>epssdmsdtPROGUPDATE_RESET</td><td>0x15</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_USER_MODE_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epsumINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epsumOFF</td><td>0x00</td></tr>
+/// <tr><td>epsumON</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_TRANSPORT_MODE_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epstmINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epstmDISABLED</td><td>0x00</td></tr>
+/// <tr><td>epstmENABLED</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_PROD_MODE_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epspmINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epspmDISABLED</td><td>0x00</td></tr>
+/// <tr><td>epspmENABLED</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// - EPWR_LHC_TYPE
+/// <table>
+/// <tr bgcolor="black"><th>Name</th><th>Value</th></tr>
+/// <tr><td>epslhcINVALID</td><td>0xFF</td></tr>
+/// <tr><td>epslhcDISABLED</td><td>0x00</td></tr>
+/// <tr><td>epslhcENABLED</td><td>0x01</td></tr>
+/// </table>\n
+/// \n
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method x Method
+/// \~english @par Detail
+/// - The API sends shutdown request to the PowerService.\n
+/// \n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendShutdownRequest(
+ HANDLE f_hSession
+ , EPWR_SHUTDOWN_REQUEST_MSG_STRUCT &f_eState); // NOLINT (runtime/references)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup PwrServiceSendHeartBeatRequest
+/// \~english @par Summary
+/// Send a request for HeartBeat monitoring start.
+/// \~english @param [in] f_hSession
+/// HANDLE - Session handle
+/// \~english @param [in] f_eHbReqMsg
+/// EPWR_HB_REQ_MSG_STRUCT*
+/// - Address of the structure for HeartBeat monitoring start request message
+/// \~english @par
+/// - Structure for HeartBeat monitoring start request message
+/// \~english @code
+/// typedef struct {
+/// UI_8 IntervalSec;
+/// } EPWR_HB_REQ_MSG_STRUCT;
+/// @endcode\n
+/// \n
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusFail Failed
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method x Method
+/// \~english @par Detail
+/// - The API sends HeartBeat monitoring start\n
+/// request to the PowerService\n
+/// - Include ss_power_service_ifc.h
+/// - Library libSS_PowerServiceIf.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PwrServiceSendHeartBeatRequest(
+ HANDLE f_hSession,
+ EPWR_HB_REQ_MSG_STRUCT *f_eHbReqMsg);
+
+#endif // POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_IF_H_ // NOLINT (build/header_guard)
+
+/** @}*/ // end of PowerService
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_local.h
new file mode 100755
index 0000000..51a284a
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_local.h
@@ -0,0 +1,66 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service_local.h
+ * @brief \~english This file supports the Power Service interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_POWER_SERVICE_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_POWER_SERVICE_LOCAL_H_
+
+
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include "system_service/ss_system_types.h"
+
+
+
+
+
+const UI_32 MaxTestCaseName = 128;
+const UI_32 MaxRespMsg = 2048;
+
+typedef enum _PwLVIStatus {
+ ePwSrvLVI_Status_InActive,
+ ePwSrvLVI_Status_Active
+} PowerSrvLVIStatus, EPWER_LVI_STATUS;
+
+typedef struct _PwCompleteAck {
+ UI_16 unSessionId;
+ CHAR szServiceName[MAX_QUEUE_NAME_SIZE];
+} StartCompleteAck;
+
+typedef struct _SS_PSCurrentState {
+ CHAR testCaseId[MaxTestCaseName];
+ CHAR printRespmsg[MaxRespMsg];
+}SS_PSCurrentState;
+
+
+#endif /* SS_POWER_SERVICE_LOCAL_H_ */ // NOLINT (build/header_guard)
+/** @}*/ // end of power_service
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications.h
new file mode 100755
index 0000000..b25172d
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service_notifications.h
+ * @brief \~english This file supports the Power Service interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup power_service
+ * @ingroup system_service
+ * @{
+ */
+#ifndef POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_NOTIFICATIONS_H_
+
+#include "system_service/ss_services.h"
+
+
+
+
+/// Indicated if Power Service is available or not portion of this message is BOOL
+#define szNTFY_PowerAvailability SERVICE_POWER"/Availability"
+
+/// @}
+
+#endif // POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+/** @}*/ // end of power_service
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications_local.h
new file mode 100755
index 0000000..a06c030
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_notifications_local.h
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service_notifications_local.h
+ * @brief \~english This file supports the Power Service interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_POWER_SERVICE_NOTIFICATIONS_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_POWER_SERVICE_NOTIFICATIONS_LOCAL_H_
+
+#include "system_service/ss_services.h"
+
+
+/// \addtogroup system_manager
+/// @{
+
+/// Depreciated !!
+#define szNTFY_PowerLVI1 SERVICE_POWER"/LVI1"
+/// Depreciated !!
+#define szNTFY_PowerLVI2 SERVICE_POWER"/LVI2"
+/// Indicates the current power level state
+#define szNTFY_PowerLevel SERVICE_POWER"/Level"
+
+/// Notification that Power Service publishes for subscribers ( ie, HMI ) to
+/// display a popup indicating the type of shutdown condition.
+/// 1. Power Save
+/// 2. BatteryCut
+/// 3. Low Voltage
+#define szNTFY_ShutdownPopup SERVICE_POWER"/ShutdownPopup"
+
+/// Notification that Power Service publishes for subscribers ( ie, HMI ) to
+/// display a popup indicating the type of CPMShowPowerPopup.
+/// 1. Normal
+/// 2. Critical
+/// 3. Application Critical
+#define szNTFY_PowerPopup SERVICE_POWER"/PowerPopup"
+
+/// @}
+
+#endif /* SS_POWER_SERVICE_NOTIFICATIONS_LOCAL_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_protocol.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_protocol.h
new file mode 100755
index 0000000..92860e8
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_power_service_protocol.h
@@ -0,0 +1,201 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_power_service_protocol.h
+ * @brief \~english This file supports the Power Service interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_PROTOCOL_H_ // NOLINT (build/header_guard)
+#define POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_PROTOCOL_H_
+
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include "system_service/ss_power_service.h"
+
+/// \ingroup PSM_Local
+/**
+ * power service protocol --> define all protocol messages in and out of power that are pertinent to the functionality offered by power.
+ */
+typedef enum _SS_PowerServiceProtocol {
+ // Diagnostic Protocol
+ SS_POWER_PRINT_CONNECTIONS = 0x32, //!< client to service
+ SS_POWER_PRINT_STACK = 0x33, //!< client to service
+
+ SS_POWER_WAKEUP_COMPLETE = 0x41, //!< service to client // used by power state machine
+ SS_POWER_SHUTDOWN_COMPLETE = 0x42, //!< service to client // used by power state machine
+ SS_POWER_VOLTAGE_STATE = 0x43, //!< client to service
+ SS_POWER_LVI2_SHUTDOWN_COMPLETE = 0x44, //!< service to client
+ SS_POWER_CRANK_STATE = 0x45, //!< client to service
+
+
+ // System Manager commands
+ SS_POWER_WAKEUP_MODULES_CMPL_RSPN = 0x51, //!< service to shadow
+ SS_POWER_SYSTEM_LAUNCH_COMPLETE = 0x56, //!< client to service
+
+
+ // SSM Service commands
+ SS_POWER_STATE_CHANGE_REQ = 0x40, //!< client to service : send wakeup to System Manager
+ SS_POWER_STATE_CHANGE_RESP = 0x46, //!< \~english Response to request of power state transition to power_supply_manager_shadow.
+
+ SS_POWER_COMM_WAKEUP = 0x58, //!< client to service : Power On expected
+
+ SS_POWER_SHUTDOWN_REQ = 0x59, //!< client to service : Comm Sleep from Shadow
+ SS_POWER_SHUTDOWN_RESP = 0x57, //!< service to shadow : Shutdown complete from System Manager
+
+ SS_POWER_CRNT_STATE_QUERY = 0x60, //!< client to service
+ SS_POWER_CRNT_STATE_QUERY_RSPN = 0x61, //!< service to client
+
+ SS_POWER_SYSTEM_MODE_INFO_REQ = 0x63, //!< Client (Shadow) to Service (Power Service)
+ SS_POWER_SYSTEM_MODE_INFO_RESP = 0x64, //!< Service to client *****
+
+ SS_POWER_INITCOMP_REP = 0x70, //!< Client (Shadow) to Service (Power Service)
+
+ //*************************************************************************
+ // CPMShowPowerPopup Notification Protocol: *
+ // *
+ // Request by the Power Shadow to the Power Service to publish a *
+ // 'Voltage State' notification. *
+ // *
+ // The Request message carries the requested notification. *
+ // The Response message carries the EFrameworkunifiedStatus of the request. *
+ SS_POWER_PUBLISH_POWER_POPUP_REQ, //!< Shadow to Pwr Svc
+ SS_POWER_PUBLISH_POWER_POPUP_RESP, //!< Pwr Svc to Shadow
+ // *
+ // End of CPMShowPowerPopup Notification Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Shutdown Condition Notification Protocol: *
+ // *
+ // Request by the Power Shadow to the Power Service to publish the *
+ // 'Shutdown Condition' notification. *
+ // *
+ // The Request message carries the requested PowerPopup. *
+ // The Response message carries the EFrameworkunifiedStatus of the request. *
+ SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ, //!< Shadow to Pwr Svc
+ SS_POWER_PUBLISH_SHUTDOWN_CONDITION_RESP, //!< Pwr Svc to Shadow
+ // *
+ // End of Shutdown Condition Notification Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Startup Confirmation Protocol: *
+ // *
+ // Request by the Power Shadow to the Power Service to forward to the *
+ // System Manager the Startup Confirmation message. *
+ // *
+ // The Request message carries the Startup Confirmation message. *
+ // The Response message carries the EFrameworkunifiedStatus of the request. *
+ SS_POWER_FWD_START_CONFIRMATION_MSG_REQ, //!< Shadow to Pwr Svc
+ SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, //!< Pwr Svc to Shadow
+ // *
+ // End of Startup Confirmation Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Power Request Protocol: *
+ // *
+ // Power Request message from the Power Shadow to the Power Service with *
+ // _CWORD56_'s "Power_Request" IPC_Command data. *
+ // *
+ // The Request message carries the _CWORD56_'s data. *
+ // The Response message will use the SS_POWER_STATE_CHANGE_RESP protocol *
+ // ID. *
+ SS_POWER_POWER_REQUEST_MSG, //!< Shadow to Pwr Svc
+ // *
+ // End of Power Request Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Shutdown Request Protocol: *
+ // *
+ // Shutdown Request message from the Power Shadow to the Power Service *
+ // with _CWORD56_'s "Shutdown_Request" IPC_Command data. *
+ // *
+ // The Request message carries the _CWORD56_'s data. *
+ // The Response message will use the SS_POWER_STATE_CHANGE_RESP protocol *
+ // ID. *
+ SS_POWER_SHUTDOWN_REQUEST_MSG, //!< Shadow to Pwr Svc
+ // *
+ // End of Shutdown Request Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // User Mode Protocol: *
+ // *
+ // Request by the Power Service to the System Manager, originally from *
+ // the Power Shadow, to turn on or off the video & audio output of HMI *
+ // and Audio services. *
+ // User Mode 'On' => turn video & audio output on *
+ // User Mode 'Off' => turn video & audio output off *
+ // *
+ // The Request message carries the requested User Mode state. *
+ // The Response message carries the actual User Mode state. *
+ SS_POWER_USER_MODE_SET_RESP, //!< Power Service to Shadow
+ // *
+ // Note: See the corresponding Power Service / System Manager *
+ // 'SS_SystemManagerProtocol' enums in /SystemServices/inc/ *
+ // ss_system_manager_protocol.h *
+ // *
+ // End of User Mode Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Heartbeat Protocol: *
+ // *
+ // Request by the Power Service to the System Manager, originally from *
+ // the Power Shadow, to support the heartbeat request response system. *
+ // *
+ // The Request message carries the expected application processor *
+ // heartbeat response interval in units of seconds. *
+ // The Response message has a data length of zero and serves as a *
+ // periodic heartbeat message to the boot micro. *
+ SS_POWER_HEARTBEAT_REQ, //!< Shadow to Power Service
+ SS_POWER_HEARTBEAT_RESP, //!< Power Service to Shadow
+ // *
+ // End of Heartbeat Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Hard Reset Request Protocol : *
+ // *
+ // Request by the Power Service to the Shadow to support the sending of *
+ // a reset request with type argument to the boot micro. *
+ // *
+ // The Request message carries epsCpuResetReason as data payload. *
+ SS_POWER_HARD_RESET_REQ, //!< Power Service to Shadow
+ // *
+ // End of Hard Reset Request Protocol *
+ //*************************************************************************
+}SS_PowerServiceProtocol;
+
+#endif /* POWER_SERVICE_CLIENT_INCLUDE_SYSTEM_SERVICE_SS_POWER_SERVICE_PROTOCOL_H_ */ // NOLINT (build/header_guard)
+/** @}*/ // end of interface_unified
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
+// EOF
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_services.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_services.h
new file mode 100755
index 0000000..d414670
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_services.h
@@ -0,0 +1,63 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_services.h
+ * @brief \~english This file supports contains the queue names of all System Services processes.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_SERVICES_H_ // NOLINT (build/header_guard)
+#define SS_SERVICES_H_
+
+#include <agl_thread.h>
+
+
+// Caution:ServiceName length mas is 15
+// System_Services domain services 0123456789ABCDE
+#define SS_DEV_DETECT_THD "SS_Dev_Detect_Thd"
+#define SS_DEV_DETECT_SRV MN_SS_DEVDETECTSRV
+#define SS_DEV_DETECT_BSP_THD "SS_DeviceDetectErr"
+#define SS_GROUP_LAUNCH_TRIGGER "SS_GroupLaunchTrigger"
+#define SERVICE_HEARTBEAT "SS_HeartBeatService"
+#define SERVICE_LOGGER MN_SS_LOGGERSRV
+#define SS_UDEV_DEV_DETECT_DLL "SS_UDEV_DeviceDetect"
+#define SS_PLM_SERVICE "SS_PLMService"
+#define SERVICE_POWER MN_SS_POWERSERVICE
+#define SS_RESOURCE_MONITOR_SERVICE "SS_ResourceMonitorService"
+#define SERVICE_SOFTWAREUPDATE "SS_SofUpdateSrv"
+#define SERVICE_SYSMANAGER MN_SS_SYSMANAGER
+#define SS_WINSYS MN_SS_WINSYS
+#define SS_RESOURCE_MANAGER MN_SS_RESOURCEMGR
+#define SS_TASK_MANAGER MN_SS_TASKMANAGER
+#define SERVICE_VUP MN_VUPSERVICE
+#define SS_UPDATESERVICE MN_SS_UPDATESERVICE
+
+/// @}
+
+#endif /* SS_SERVICES_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_client_if.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_client_if.h
new file mode 100755
index 0000000..70b9425
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_client_if.h
@@ -0,0 +1,1064 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_client_if.h
+ * @brief \~english This file supports the AGL framework client interface to System manager.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+
+
+#ifndef __SS_SYSTEM_MANAGER_CLIENT_IF_H__ // NOLINT (build/header_guard)
+#define __SS_SYSTEM_MANAGER_CLIENT_IF_H__
+
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/ns_logger_if.h>
+#include <string>
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_system_manager_if.h"
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RegisterSMSessionAckCallback
+/// \~english @par Summary
+/// API for setting the FrameworkunifiedOnStop response
+/// \~english @param [in] CallbackPtr
+/// EFrameworkunifiedStatus - Pointer to a callback function
+/// \~english @par
+/// - TRUE : Not carried out in the automatic response.
+/// - FALSE : Carry out the response in automatic. (Default)
+/// \~english @retval VOID None
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// In the case of is_start_required = TURE, Client Services of System Manager, automatically \n
+/// System Manager and the session at the same time is building and start-up. \n
+/// It is possible to receive a call back at the timing when the session establishment is completed \n
+/// by this API. \n
+/// is_start_required is, as a Launch Configuration information, have the following meanings.
+/// \~english @par
+/// is_start_required \n
+/// - True: Create a session with the System Manager.(Service to use the Dispatcher.) \n
+/// - False: Not create a session with the System Manager.(Do not use the Dispatcher Service.)
+/// OnStart/Stop/DebugDump Callback is not called. HeartBeat function does not apply.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus RegisterSMSessionAckCallback(EFrameworkunifiedStatus (*CallbackPtr)(HANDLE));
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SetDataResetModeToSystemManager
+/// \~english @par Summary
+/// API to record the data reset mode of the next boot in a non-volatile area.
+/// \~english @param [in] dataResetMode
+/// ESMDataResetModeInfo - Data reset mode information
+/// \~english @par
+/// - e_SS_SM_DATA_RESET_MODE_NONE : Do not initialize
+/// - e_SS_SM_DATA_RESET_MODE_USER : User data initialization
+/// - e_SS_SM_DATA_RESET_MODE_FACTORY : Factory initialization
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusBadConnection Socket connection error
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - Specified log type is invalid(In the case of value which does not correspond to enum eSMUserLogType).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a send and receive type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Send and receive for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the send and receive of the System
+/// Manager message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the send and receive buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Send and receive and reception of System Manager message for the session fails to socket connection.
+/// [eFrameworkunifiedStatusBadConnection]
+/// - Any error has occurred at the time of send and receive of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Send and receive of System Manager message for the session fails to shared memory access.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget x Method
+/// \~english @par Detail
+/// The data reset mode to save in a non-volatile area, the function return.\n
+/// System Manager is to expand the resident service data reset mode of the non-volatile area as\n
+/// an argument of FrameworkunifiedOnStart.\n
+/// Task Manager is Callback data initialization interface of the same information as an argument.\n
+/// All of, the completion of the FrameworkunifiedOnStart processing of all resident services (System Manager) \n
+/// and, at the timing when the Callback of data initialization interface of all non-resident \n
+/// service has been completed (Task Manager), a data reset mode, initialized to e_SS_SM_DATA_RESET_ NONE. \n
+/// In other words, when the reset until initialization occurs, the same data reset mode again to \n
+/// the argument, FrameworkunifiedOnStart or, Callback of data initialization interface is performed.
+/// \~english @see SetProgUpdateStateToSystemManager
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SetDataResetModeToSystemManager(ESMDataResetModeInfo dataResetMode);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SetProgUpdateStateToSystemManager
+/// \~english @par Summary
+/// API to record the program update state in the non-volatile information.
+/// \~english @param [in] updateState
+/// SMProgUpdateState - Program update status
+/// \~english @par
+/// - SS_SM_PROG_UPDATE_STATE_UPDATED : Program update
+/// - SS_SM_PROG_UPDATE_STATE_MAP_UPDATED : Map update
+/// - SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED : Map difference updating
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusBadConnection Socket connection error
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - Specified program update status information is invalid (in the case of a value that does not correspond to
+/// the enum SMProgUpdateState). [eFrameworkunifiedStatusInvldParam]
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a send and receive type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Send and receive for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the send and receive of the System
+/// Manager message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the send and receive buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Send and receive and reception of System Manager message for the session fails to socket connection.
+/// [eFrameworkunifiedStatusBadConnection]
+/// - Any error has occurred at the time of send and receive of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Send and receive of System Manager message for the session fails to shared memory access.
+/// [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// The program update state to save in a non-volatile area, the function return.\n
+/// updateState is it is possible to specify more than one by setting the OR.\n
+/// Based on the setting state, to determine isProgUpdated, isMapUpdated, the value \n
+/// of the isMapDiffUpdated provided in GetInterfaceunifiedOnStartExtInfo and GetInterfaceunifiedOnStopExtInfo.\n
+/// Task Manager is provided in data initialization interface, the same information to the non-resident service.\n
+/// Set state is initialized with the same timing as data reset mode.\n
+/// (See SetDataResetModeToSystemManager)
+/// \~english @see SetDataResetModeToSystemManager, GetInterfaceunifiedOnStartExtInfo, GetInterfaceunifiedOnStopExtInfo
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SetProgUpdateStateToSystemManager(SMProgUpdateState progUpdateState);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendCpuResetRequestToSystemManager
+/// \~english @par Summary
+/// API to request LOG saved to the internal non-volatile area
+/// \~english @param [in] l_eCpuResetReason
+/// ESMCpuResetReason - Reset factor
+/// \~english @param [in] f_messageStr
+/// std::string - Abnormal message string
+/// \~english @param [in] f_suffixStr
+/// std::string - Suffix string of abnormal LOG file
+/// \~english @par
+/// enum ESMCpuResetReason Variable
+/// - e_SS_SM_CPU_RESET_REASON_NORMAL : Normal Reset
+/// - e_SS_SM_CPU_RESET_REASON_DATA_RESET : Data Reset
+/// - e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET : User forced reset
+/// - e_SS_SM_CPU_RESET_REASON_GENERIC_ERR : Generic Error reset
+/// - e_SS_SM_CPU_RESET_REASON_DSP_ERR : DSP Error
+/// - e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL : Reset immediately
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Collect the LOG information and stores it in the built-in non-volatile area.\n
+/// String specified in f_suffixStr is added as a suffix to the end of the abnormal LOG file name.
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendCpuResetRequestToSystemManager(ESMCpuResetReason l_eCpuResetReason,
+ std::string f_messageStr = "", std::string f_suffixStr = "");
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SetNextWakeupTypeToSystemManager
+/// \~english @par Summary
+/// Set the next wakeup type.
+/// \~english @param [in] f_wakeupType
+/// ESMNextWakeupType - Wakeup type
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail
+/// - The API sets the next wakeup type (COLD/HOT/Not specified).
+/// \n
+/// - Include ss_sm_client_if.h
+/// - Library libSS_SystemIfUnified.so
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SetNextWakeupTypeToSystemManager(ESMNextWakeupType f_wakeupType);
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar
+/// \~english @par Summary
+/// API for setting the FrameworkunifiedOnStop response
+/// \~english @param [in] f_setTrue
+/// BOOL - Response presence or absence of specified
+/// \~english @par
+/// - TRUE : Not carried out in the automatic response.
+/// - FALSE : Carry out the response in automatic. (Default)
+/// \~english @retval VOID None
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// In case you can not return the response in the synchronized by FrameworkunifiedOnStop, by setting to \n
+/// TRUE in this API, it is possible to implement the completion notice to the system_manager \n
+/// the service side.
+/// At this time, the service is by to Publish the Notification of "service name/StopComp", \n
+/// you are possible to notify the STOP completion to system_manager.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+VOID Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar(BOOL f_SetTrue);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendUserInvokedLoggingRequestToSystemManager
+/// \~english @par Summary
+/// API to request LOG saved to the internal non-volatile area
+/// \~english @param [in] f_userInvokedLogType
+/// \ref eSMUserLogType - User invoked log type.
+/// \~english @param [in] f_messageStr
+/// std::string - Abnormal message string
+/// \~english @param [in] f_suffixStr
+/// std::string - Suffix string of abnormal LOG file
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - Log type is invalid(In the case of value which does not correspond to enum eSMUserLogType).
+/// [eFrameworkunifiedStatusInvldParam]
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Collect the LOG information and stores it in the built-in non-volatile area.\n
+/// String specified in f_suffixStr is added as a suffix to the end of the abnormal LOG file name.
+/// \~english @see SendClearLogsRequestToSystemManager
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendUserInvokedLoggingRequestToSystemManager(eSMUserLogType f_userInvokedLogType,
+ std::string f_messageStr = "", std::string f_suffixStr = "");
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendInterfaceunifiedOnStopResponseToSystemManager
+/// \~english @par Summary
+/// API to send a FrameworkunifiedOnStop response
+/// \~english @param [in] f_eStatus
+/// EFrameworkunifiedStatus - End status
+/// \~english @par
+/// - eFrameworkunifiedStatusOK : End processing completion
+/// - eFrameworkunifiedStatusFail : End processing uncompleted
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// In case you can not return the response in the synchronized by FrameworkunifiedOnStop, by setting to \n
+/// TRUE in this API, it is possible to implement the completion notice to the system_manager \n
+/// the service side.
+/// At this time, the service is by to Publish the Notification of "service name/StopComp", \n
+/// you are possible to notify the STOP completion to system_manager.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInterfaceunifiedOnStopResponseToSystemManager(EFrameworkunifiedStatus f_eStatus);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetInterfaceunifiedOnStartExtInfo
+/// \~english @par Summary
+/// API to get the extended information of the start-up parameters.
+/// \~english @param [out] f_info
+/// T_SS_SM_START_ExtDataStructType - Startup parameters extended information
+/// \~english @par
+/// T_SS_SM_START_ExtDataStructType Structure
+/// \~english @code
+/// typedef struct {
+/// {
+/// BOOL isProgUpdated;
+/// EMRelaunchStatus relaunchStatus;
+/// BOOL isMapUpdated;
+/// BOOL isMapDiffUpdated;
+/// uint8_t reserved[];
+/// }T_SS_SM_START_ExtDataStructType;
+/// @endcode
+/// \~english @par
+/// isProgUpdated:Presence or absence of a program update
+/// - TRUE : Yes program update
+/// - FALSE : No program update
+/// \~english @par
+/// relaunchStatus:Relaunch state of self-service
+/// - e_SS_SM_RELAUNCH_STATUS_NONE : Relaunch non-occurrence (first start)
+/// - e_SS_SM_RELAUNCH_STATUS_SAFE : Normal Relaunch
+/// - e_SS_SM_RELAUNCH_STATUS_ERR : Abnormal Relaunch
+/// \~english @par
+/// isMapUpdated:Presence or absence of a map update
+/// - TRUE : Yes map update
+/// - FALSE : No map update
+/// \~english @par
+/// isMapDiffUpdated:The presence or absence of the map difference updating
+/// - TRUE : Yes map difference update
+/// - FALSE : No map difference update
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusBadConnection Failure to socket connection
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred(Socket Connection/Memory Allocation/Event Control)
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Transmission and reception of System Manager message for the session fails to socket connection.
+/// [eFrameworkunifiedStatusBadConnection]
+/// - In the case of the message queue open error for reception of System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - System Manager message for the session fails to acquire the message buffer for reception. [eFrameworkunifiedStatusFail]
+/// - System Manager message for the session fails in the event control for the reception. [eFrameworkunifiedStatusFail]
+/// - Any error has occurred at the time of transmission and receive of the System Manager message for the
+/// session. [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Returns the extended information of the parameters of FrameworkunifiedOnStart(). \n
+/// It is assumed that that will be called in the FrameworkunifiedOnStart (), return the correct value when it is called prior
+/// \n
+/// to the issuance FrameworkunifiedOnStart() is not guaranteed.\n
+/// System startup to relaunchStatus is e_SS_SM_RELAUNCH_STATUS_NONE, the service is a case that has been Relaunch
+/// \n
+/// by the exit (SS_SM_EXIT_RELAUNCH) _SS_SM_RELAUNCH_STATUS_SAFE, if the Relaunch due to the abnormality occurs
+/// to \n
+/// set the e_SS_SM_RELAUNCH_STATUS_ERR.
+/// \~english @see GetInterfaceunifiedOnStopExtInfo, FrameworkunifiedOnStart
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetInterfaceunifiedOnStartExtInfo(T_SS_SM_START_ExtDataStructType &f_info); // NOLINT (runtime/references)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetInterfaceunifiedOnStopExtInfo
+/// \~english @par Summary
+/// API to get the extended information of the end parameter.
+/// \~english @param [out] f_info
+/// T_SS_SM_STOP_ExtDataStructType - Exit extended parameter information
+/// \~english @par
+/// T_SS_SM_STOP_ExtDataStructType Structure
+/// \~english @code
+/// typedef struct {
+/// {
+/// BOOL isProgUpdated;
+/// uint8_t reserved[];
+/// }T_SS_SM_START_ExtDataStructType;
+/// @endcode
+/// \~english @par
+/// isProgUpdated:Presence or absence of a program update
+/// - TRUE : Yes program update
+/// - FALSE : No program update
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusBadConnection Failure to socket connection
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred(Socket Connection/Memory Allocation/Event Control)
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a send and receive type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - File descriptor not for the transmission and reception of the System Manager of the session message.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Interruption by the system call (signal) occurs during the transmission and reception of the System Manager
+/// of the session message. [eFrameworkunifiedStatusErrNoEINTR]
+/// - The size of the transmit and receive buffer of the System Manager of the session message is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - It failed to socket connection for transmission and reception of the System Manager of the session message.
+/// [eFrameworkunifiedStatusBadConnection]
+/// - Open error of the message queue for the reception of the System Manager of the session message.
+/// [eFrameworkunifiedStatusFail]
+/// - And fail to acquire the message buffer for reception of the System Manager of the session message.
+/// [eFrameworkunifiedStatusFail]
+/// - It failed in the event control for the reception of the System Manager of the session message.
+/// [eFrameworkunifiedStatusFail]
+/// - It failed during transmission and reception of the System Manager of the session message. [eFrameworkunifiedStatusFail]
+/// - It failed to shared memory access for transmission and reception of the System Manager of the session
+/// message. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only(None communication)
+/// \~english @par Detail
+/// Returns the extended information of the parameters of FrameworkunifiedOnStop(). \n
+/// It is assumed that that will be called in the FrameworkunifiedOnStop (), return of the correct value in the case \n
+/// that has been called before FrameworkunifiedOnStop() entry into force is not guaranteed.
+/// \~english @see GetInterfaceunifiedOnStartExtInfo, FrameworkunifiedOnStop
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetInterfaceunifiedOnStopExtInfo(T_SS_SM_STOP_ExtDataStructType &f_info); // NOLINT (runtime/references)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendDebugDumpResponseToSystemManager
+/// \~english @par Summary
+/// Send a debug dump response to system_manager
+/// \~english @param [in] f_bFormatStrRequired
+/// BOOL - Specify whether to dump the application name or not
+/// \~english @param [in] f_cFormat
+/// PCSTR - Display format for the dump (the same character strings format as the printf format)
+/// \~english @param [in] arg_list
+/// ... - Dump data in line with f_cFormat format
+/// \~english @par
+/// f_bFormatStrRequired
+/// - true Dump the application name
+/// - false Do not dump the application name
+/// \~english @retval None
+/// \~english @par Precondition
+/// - None
+/// \~english @par Change in the internal status
+/// - The change in the internal status does not occur by this API.
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget only
+/// \~english @par Detail
+/// When f_bFormatStrRequired is true, write the application name to the buffer for dump. \n
+/// Write the data to the buffer for dump in line with f_cFormat. \n
+/// Send OnDebugDumpResponseReceived to the SystemManger in order to request the SystemManger to
+/// write the contents in the buffer for dump to the log file for debug. \n
+/// The maximum size of the buffer for dump is 4Kbyte and the string size of the application name
+/// is deducted when the application name is dumped. \n
+/// When dumping a string which exceeds 4Kbyte, drop what exceeds the buffer.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////////////
+void SendDebugDumpResponseToSystemManager(BOOL f_bFormatStrRequired, PCSTR f_cFormat, ...)
+#ifdef __GNUC__
+ __attribute__((format(printf, 2, 3)));
+#endif
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendInterfaceunifiedEmmcLogsRequestToSystemManager
+/// \~english @par Summary
+/// API to request a copy to the specified path of the LOG file of the built-in non-volatile area.
+/// \~english @param [in] f_path
+/// std::string - LOG destination file PATH
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - LOG destination file PATH is NULL(If f_path.c_str() is NULL). [eFrameworkunifiedStatusInvldBuf]
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail
+/// To copy all of the files that exist in LOG storage area of the built-in non-volatile area in \n
+/// the path specified in the f_path. \n
+/// If you do not have a copy target, asynchronous response command: Returns the eFrameworkunifiedStatusOK as \n
+/// the message data of SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN.
+/// \~english @see SendClearLogsRequestToSystemManager
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInterfaceunifiedEmmcLogsRequestToSystemManager(std::string f_path);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendClearLogsRequestToSystemManager
+/// \~english @par Summary
+/// API to clear the stored in the built-in non-volatile area log.
+/// \~english @param [in] f_info
+/// TSystemManagerClearLogsInfo - A pointer to the LOG clear information
+/// \~english @par
+/// TSystemManagerClearLogsInfo Structure
+/// \~english @code
+/// typedef struct T_SystemManagerClearLogsInfo{
+/// {
+/// void *rsv;
+/// }TSystemManagerClearLogsInfo;
+/// @endcode
+/// \~english @par
+/// rsv : Reserve area
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @retval eFrameworkunifiedStatusNullPointer Invalid pointer
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
+/// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
+/// \~english @retval eFrameworkunifiedStatusErrOther Other error(It failed to open/allocation of shared memory)
+/// \~english @par Preconditions
+/// - Dispatcher for the System Manager is generated, and Availability of the service is TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - Pointer to the LOG clear information (f_info) is NULL [eFrameworkunifiedStatusInvldParam]
+/// - System Manager of the session does not exist. [eFrameworkunifiedStatusNullPointer]
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - System Manager handle type for the session is not a transmission type. [eFrameworkunifiedStatusInvldHndlType]
+/// - System Manager message queue for the session is full. [eFrameworkunifiedStatusMsgQFull]
+/// - Transmission for the file descriptor of System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusErrNoEBADF]
+/// - Place to interrupt by the system call (signal) has occurred during the transmission of the System Manager
+/// message for the session. [eFrameworkunifiedStatusErrNoEINTR]
+/// - Size of the transmission buffer of the System Manager message for the session is invalid.
+/// [eFrameworkunifiedStatusInvldBufSize]
+/// - Any error has occurred at the time of transmission of the System Manager message for the session.
+/// [eFrameworkunifiedStatusFail]
+/// - Transmission of System Manager message for the session fails to shared memory access. [eFrameworkunifiedStatusErrOther]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Fire and Forget x Sync
+/// \~english @par Detail
+/// To delete a LOG stored in the built-in non-volatile area.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendClearLogsRequestToSystemManager(TSystemManagerClearLogsInfo *f_info);
+
+/** @}*/ // end of SystemIf
+/** @}*/ // end of interface_unified
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief AttachCallbackToSystemManager
+///
+/// \note This function is called by System Manager session clients to attach
+/// a callback function to the client application with System Manager
+/// configured as the specified sender of the specified protocol message.
+///
+/// \param [in] f_hApp
+/// HANDLE - Handle to message queue of the System Manager attached client.
+/// \param [in] iCmd
+/// UI_32 iCmd - Command ID
+/// \param [in] fpOnCmd
+/// CbFuncPtr fpOnCmd - Function pointer to be called in the form upon
+/// the invokation of the specified command ID. The callback function
+/// must have the following signature : void (*)(HANDLE).
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus AttachCallbackToSystemManager(HANDLE hApp, UI_32 iCmd, CbFuncPtr fpOnCmd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief Set of complementary detach functions that accept same arguments
+/// as the InterfaceunifiedAttach_XYZ_ToDispatcher() functions do.
+///
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus DetachCallbacksFromInterfaceunifiedDispatcher(HANDLE hApp,
+ PCSTR pServiceName,
+ const FrameworkunifiedProtocolCallbackHandler* pMsgHandler,
+ UI_32 uiHandlerCount,
+ HANDLE hSession = NULL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+/// \brief
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus DetachParentCallbacksFromInterfaceunifiedDispatcher(HANDLE hChildApp,
+ const FrameworkunifiedProtocolCallbackHandler* pMsgHandler,
+ UI_32 uiHandlerCount);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief GetSystemManagerSessionHandle
+///
+/// \note This function returns the session handle with System Manager
+///
+/// \return HANDLE - A session handle with System Manager
+/////////////////////////////////////////////////////////////////////////////////////
+extern HANDLE GetSystemManagerSessionHandle(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendShutdownToSystemManager
+///
+/// \note This function is called to send Shutdown command to System Manager
+///
+/// \param [in] pData
+/// Pwr_ServiceSetInterface *pData - Pointer to Shutdown Command data
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendShutdownToSystemManager(Pwr_ServiceSetInterface *pData);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendSystemModeRequestToSystemManager
+///
+/// \note This function is called to send system mode request to System Manager
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendSystemModeRequestToSystemManager(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendInitCompReportToSystemManager
+///
+/// \note This function is called to send init comp report to System Manager
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendInitCompReportToSystemManager(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendWakeUpToSystemManager
+///
+/// \note This function is called to send the Wakeup command to System Manager
+///
+/// \param [in] pData
+/// wakeInfo *pData - Pointer to Wakeup Command data
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendWakeUpToSystemManager(wakeInfo *pData);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendStartupConfirmationToSystemManager
+///
+/// \note This function is called to send the startup confirmation information
+/// to System Manager
+///
+/// \param [in] l_startupConfirmationMsg
+/// StartupConfirmationMsgStrut &l_startupConfirmationMsg - startup confirmation
+/// data
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SendStartupConfirmationToSystemManager(StartupConfirmationMsgStrut
+ &l_startupConfirmationMsg);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendSystemErrorToSystemManager
+///
+/// \note This function is called by an application via Native Services to send
+/// notice of a critical error to System Manager when a non recoverable
+/// run-time error is encountered.
+///
+/// \param [in]
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendSystemErrorToSystemManager(EFrameworkunifiedSystemError f_systemError);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief Send_CWORD56_HeartBeatRequestToSystemManager
+///
+/// \note This function forwards a _CWORD56_ heartbeat request received by power
+/// services from the power shadow to System Manager.
+///
+/// \param [in]
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Send_CWORD56_HeartBeatRequestToSystemManager(EPWR_HB_REQ_MSG_STRUCT f_HbReq);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendBootMicroResetNotificationToSystemManager
+///
+/// \param ResetReason Enumerated boot micro reset reason.
+///
+/// This function is called by Logging Shadow to inform System Manager of a
+/// boot micro reset condition.
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendBootMicroResetNotificationToSystemManager(eSMBootMicroResetReason ResetReason);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendDiagLogEventRequestToSystemManager
+///
+/// \note This function is called by logger to initiate log artifact collection
+/// and storage on behalf of diagnostic services.
+///
+/// \param f_copyDestPathStr
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendDiagLoggingRequestToSystemManager(std::string f_copyDestPathStr);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendCANLoggingRequestToSystemManager
+///
+/// \note This function is called by logger to initiate log artifact collection
+/// and storage when signaled via CAN.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendCANLoggingRequestToSystemManager(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendDTCLoggingRequestToSystemManager
+///
+/// \note This function is called by logger to initiate log artifact collection
+/// and storage when signaled via diagnostic command.
+///
+/// \param f_dtc Diagnostic trouble code.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendDTCLoggingRequestToSystemManager(UI_32 f_dtc);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief RegisterBootMicroLogRequestCb
+///
+/// This function is called by Logging Shadow to register a callback function for
+/// the boot micro log request that may be generated by System Manager when an
+/// error event occurs.
+///
+/// \param [in] hApp AGL Framework Application Handle
+///
+/// \param [in] fpOnCmd Call back function with the signature:
+/// EFrameworkunifiedStatus fnct(HANDLE hApp);
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RegisterBootMicroLogRequestCb(HANDLE hApp, CbFuncPtr fpOnCmd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendBootMicroLogResponseToSystemManager
+///
+/// This function is called by Logging Shadow to provide a string representation of
+/// the binary boot-micro log data.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendBootMicroLogResponseToSystemManager(std::string f_logString);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+/// \brief Redirect either formatted, or unformatted response output to System Manager.
+///
+/// \see SendDebugDumpResponseToSystemManager
+////////////////////////////////////////////////////////////////////////////////////////////
+#define SSDEBUGDUMP(args...) (SendDebugDumpResponseToSystemManager(TRUE, ## args))
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup SM_Deletable
+////////////////////////////////////////////////////////////////////////////////////////////
+#define SSDEBUGDUMP_RAW(args...) (SendDebugDumpResponseToSystemManager(FALSE, ## args))
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendLogStartRequestToSystemManager
+///
+/// \note This function is call by SS_Logger when the logging process has
+/// completed and no additional request for artifacts will be generated.
+///
+/// \param none.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogStartRequestToSystemManager(EErrorEventType f_errorEventType);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendLogArtifactRequestToSystemManager
+///
+/// \note This function is call by SS_Logger to request SM to acquire and
+// return by reference (filename), the specified logging artifact.
+///
+/// \param [in] f_artifactId, enumerated artifact number.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogArtifactRequestToSystemManager(EArtifactId f_artifactId);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendLogCompleteRequestToSystemManager
+///
+/// \note This function is call by SS_Logger when the logging process has
+/// completed and no additional request for artifacts will be generated.
+///
+/// \param none.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogCompleteRequestToSystemManager(EFrameworkunifiedStatus f_eStatus = eFrameworkunifiedStatusOK);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief SendEelExportRequestToSystemManager
+///
+/// \note This function forwards the Device Detection EEL_export trigger
+/// received by SS Logger to System Manager.
+///
+/// \param f_path Destination path for the trigger artifacts.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendEelExportRequestToSystemManager(std::string f_path);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup interface_unified
+///
+/// \brief DebugDump request callback function.
+///
+/// \note This function is called when System Manager requests the receiving
+/// application to generate their debugdump.
+///
+/// \param hApp
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnSystemManagerDebugDump(HANDLE hApp);
+
+#endif // __SS_SYSTEM_MANAGER_CLIENT_IF_H__ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_client_if_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_client_if_local.h
new file mode 100755
index 0000000..a4d0fa9
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_client_if_local.h
@@ -0,0 +1,66 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_sm_client_if_local.h
+ * @brief \~english This file supports the api of debug dump response to System Manager
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef __SS_SYSTEM_MANAGER_CLIENT_IF_LOCAL_H__ // NOLINT (build/header_guard)
+#define __SS_SYSTEM_MANAGER_CLIENT_IF_LOCAL_H__
+
+#include <native_service/frameworkunified_framework_types.h>
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \~english @par Summary:
+/// Responds to SystemManager that debug dump output has finished
+/// \~english @param [in] f_messageStr
+/// std::string & - Dump data
+/// \~english @retval
+/// - None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Change of the internal state:
+/// - No change of internal state by this API occurs
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Detail:
+/// Send OnDebugDumpResponseReceived to SystemManager and request
+/// to write the contents of dump data to /tmp/systemmanager_debugdump.log.\n
+/// The maximum size of the dump buffer is 4KByte.\n
+/// When dumping more than 4KBytes, the overflow from the buffer is discarded.
+///
+/// \~english @par Classification:
+/// - Public
+/// \~english @see
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+
+VOID SendDebugDumpResponseToSystemManager(std::string & f_messageStr); // NOLINT (runtime/references)
+
+#endif /*__SS_SYSTEM_MANAGER_CLIENT_IF_LOCAL_H__*/ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names.h
new file mode 100755
index 0000000..61ee275
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_thread_names.h
+ * @brief This file supports System Manager thread naming.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_SM_THREAD_NAMES_H_ // NOLINT (build/header_guard)
+#define SS_SM_THREAD_NAMES_H_
+
+// thread name max length is 15
+// 0123456789ABCDE
+#define SS_SMHeartbeat "SM.Heartbeat"
+
+#endif /* SS_SM_THREAD_NAMES_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names_local.h
new file mode 100755
index 0000000..36dda06
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sm_thread_names_local.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_thread_names_local.h
+ * @brief This file supports System Manager thread naming.
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SS_SM_THREAD_NAMES_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_SM_THREAD_NAMES_LOCAL_H_
+
+// thread name max length is 15
+// 0123456789ABCDE
+#define SS_SMLauncher "SM.ProcLaunch"
+#define SS_SMLowMemMonitor "SM.LowMemMon"
+
+#endif /* SS_SM_THREAD_NAMES_LOCAL_H_ */ // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_string_maps.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_string_maps.h
new file mode 100755
index 0000000..4001ed4
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_string_maps.h
@@ -0,0 +1,680 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_string_maps.h
+ * @brief \~english This file supports the a generic std::map<std::string> wrapper.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_STRING_MAPS_H_ // NOLINT (build/header_guard)
+#define SS_STRING_MAPS_H_
+
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_system_manager_if.h"
+#include "system_service/ss_system_manager_protocol.h"
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from BOOL type to string
+/// \~english @param [in] f_enum
+/// BOOL - the member what will convert farm BOOL type to string type
+/// \~english @code
+/// typedef int BOOL;
+/// #define TRUE (1==1)
+/// #define true (1==1)
+/// #define FALSE (0==1)
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from BOOL type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(BOOL f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EErrorEventType type to string
+/// \~english @param [in] f_enum
+/// EErrorEventType - the member what will convert farm EErrorEventType type to string type.error event type.
+/// \~english @code
+/// enum EErrorEventType {
+/// eErrorEventTypeProcessCrash = 0,
+/// eErrorEventTypeHeartBeatFailure,
+/// eErrorEventTypeSystemLowMemory,
+/// eErrorEventTypeReserved1, // Formerly SS_SM_EVENT_ERROR_HIGH_CPU_LOAD, now HMI enum place holder.
+/// eErrorEventTypeUserInvokedUserForceReset,
+/// eErrorEventTypeReserved2,
+/// eErrorEventTypeReserved3,
+/// eErrorEventTypeUserInvokedCollectAllLogs,
+/// eErrorEventTypeBootMicroReset,
+/// eErrorEventTypeProcessExit,
+/// eErrorEventTypeUserInvokedCollectScreenShot,
+/// eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs,
+/// eErrorEventTypeEelExport,
+/// eErrorEventTypeInterfaceunifiedEmmcLogs,
+/// eErrorEventTypeDiagEvent,
+/// eErrorEventTypeCanEvent,
+/// eErrorEventTypeDtcEvent,
+/// eErrorEventTypeModConnFailed,
+/// eErrorEventTypeStartRespFailed,
+/// eErrorEventTypeUserInvokedCollectDevLogs,
+/// eErrorEventTypeModuleInvokedResetRequest,
+/// eErrorEventTypeModuleInvokedCollectDebugLogs,
+/// eErrorEventTypeUserInvokedClearLogs,
+/// eErrorEventTypeUserInvokedCollectNaviLog,
+/// eErrorEventTypeGroupRelaunch,
+/// eErrorEventTypeMaxValue
+/// };
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EErrorEventType type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EErrorEventType f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EFrameworkunifiedSystemError type to string
+/// \~english @param [in] f_enum
+/// EFrameworkunifiedSystemError - the member what will convert farm EFrameworkunifiedSystemError type to string type.The type of system
+/// error.
+/// \~english @codes
+/// typedef enum _EFrameworkunifiedSystemError {
+/// eFrameworkunifiedSystemErrorNone = 0,
+/// eFrameworkunifiedDSPHardwareReset = 1
+/// } EFrameworkunifiedSystemError;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EFrameworkunifiedSystemError type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EFrameworkunifiedSystemError f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_LHC_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_LHC_TYPE - the member what will convert farm EPWR_LHC_TYPE type to string type.Limp home cutoff
+/// protocol type.
+/// \~english @codes
+/// typedef enum {
+/// epslhcINVALID = 0xFF,
+/// epslhcDISABLED = 0x00,
+/// epslhcENABLED = 0x01
+/// } ePwrServiceLHCType, EPWR_LHC_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_LHC_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_LHC_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_PROD_MODE_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_PROD_MODE_TYPE - the member what will convert farm EPWR_PROD_MODE_TYPE type to string type.The type of
+/// production mode protocol.
+/// \~english @codes
+/// typedef enum {
+/// epspmINVALID = 0xFF,
+/// epspmDISABLED = 0x00,
+/// epspmENABLED = 0x01
+/// } ePwrServiceProdModeType, EPWR_PROD_MODE_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_PROD_MODE_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_PROD_MODE_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_SC_COLD_START_REQ_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_SC_COLD_START_REQ_TYPE - the member what will convert farm EFrameworkunifiedSystemError type to string type.The type
+/// of cold start.
+/// \~english @codes
+/// typedef enum {
+/// epsscrtINVALID = 0xFF,
+/// epsscrtNOT_REQUIRED = 0x00,
+/// epsscrtREQUIRED = 0x01
+/// } EPWR_SC_COLD_START_REQ_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_SC_COLD_START_REQ_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_SC_COLD_START_REQ_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_SC__CWORD56__BOOT_MODE_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_SC__CWORD56__BOOT_MODE_TYPE - the member what will convert farm EPWR_SC__CWORD56__BOOT_MODE_TYPE type to string
+/// type.The type of startup confirmation.
+/// \~english @codes
+/// typedef enum {
+/// eps_CWORD56_bmINVALID = 0xFF,
+/// eps_CWORD56_bmAPPLICATION_MODE = 0x00,
+/// eps_CWORD56_bmPROGRAMMING_MODE = 0x08
+/// } EPWR_SC__CWORD56__BOOT_MODE_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_SC__CWORD56__BOOT_MODE_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_SC__CWORD56__BOOT_MODE_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_SHUTDOWN_TRIGGER_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_SHUTDOWN_TRIGGER_TYPE - the member what will convert farm EPWR_SHUTDOWN_TRIGGER_TYPE type to string
+/// type.The type of shutdown trigger.
+/// \~english @codes
+/// typedef enum {
+/// epssdmsdtINVALID = 0xFF,
+/// epssdmsdtTESTACC_OFF = 0x00,
+/// epssdmsdtON_KEY = 0x01,
+/// epssdmsdtIGN_LOCK = 0x02,
+/// epssdmsdtPWR_SAVE = 0x03,
+/// epssdmsdtTMP_STARTUP = 0x04,
+/// epssdmsdtDIAG_DEACTIVATION = 0x05,
+/// epssdmsdtABNORMAL_VOLTAGE = 0x06,
+/// epssdmsdtABNORMAL_TEMP = 0x07,
+/// epssdmsdtBATTERYCUTOFF = 0x08,
+/// epssdmsdtLIMPHOME = 0x09,
+/// epssdmsdtHU_CAN_ERROR = 0x0A,
+/// epssdmsdtBODY_CAN_ERROR = 0x0B,
+/// epssdmsdtTRANSPORT_MODE = 0x0C,
+/// epssdmsdtPRODUCTION_MODE = 0x0D,
+/// epssdmsdtIGN_OFF = 0x0E,
+/// epssdmsdtGENERIC_ERROR_RESET = 0x0F,
+/// epssdmsdtFATAL_ERROR_RESET = 0x10,
+/// epssdmsdtUSER_DATA_RESET = 0x11,
+/// epssdmsdtFACTORY_DATA_RESET = 0x12,
+/// epssdmsdtFAST_SLEEP_MODE = 0x13,
+/// epssdmsdtNORMAL_RESET = 0x14,
+/// epssdmsdtPROGUPDATE_RESET = 0x15,
+/// } ePowerSrvPwrShutdownTriggerType, EPWR_SHUTDOWN_TRIGGER_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_SHUTDOWN_TRIGGER_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_SHUTDOWN_TRIGGER_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_STARTUP_STAGE_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_STARTUP_STAGE_TYPE - the member what will convert farm EPWR_STARTUP_STAGE_TYPE type to string type.The
+/// type of startup stage.
+/// \~english @codes
+/// typedef enum {
+/// epssusfINVALID = 0xFF,
+/// epssusSYSTEM_SERVICES_STARTED = 0x00,
+/// epssusALL_SERVICES_LAUNCHED = 0x01
+/// }ePowerSrvStartupStageType, EPWR_STARTUP_STAGE_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_STARTUP_STAGE_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_STARTUP_STAGE_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_SYSTEM_MODE_INFO type to string
+/// \~english @param [in] f_enum
+/// EPWR_SYSTEM_MODE_INFO - the member what will convert farm EPWR_SYSTEM_MODE_INFO type to string type.The type
+/// of system mode info.
+/// \~english @codes
+/// typedef enum {
+/// epssinfINVALID = 0xFF,
+/// epssinfNORMAL = 0x00,
+/// epssinfPROGRAMMING = 0x08,
+/// }ePowerSrvSystemModeInfo, EPWR_SYSTEM_MODE_INFO;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_SYSTEM_MODE_INFO type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_SYSTEM_MODE_INFO f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_TRANSPORT_MODE_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_TRANSPORT_MODE_TYPE - the member what will convert farm EPWR_TRANSPORT_MODE_TYPE type to string
+/// type.The type of transport mode protocol.
+/// \~english @codes
+/// typedef enum {
+/// epstmINVALID = 0xFF,
+/// epstmDISABLED = 0x00,
+/// epstmENABLED = 0x01
+/// } ePwrServiceTransportModeType, EPWR_TRANSPORT_MODE_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_TRANSPORT_MODE_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_TRANSPORT_MODE_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" type to string
+/// \~english @param [in] f_enum
+/// \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" - the member what will convert farm \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" type
+/// to string type.The type of user mode change reason.
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from type \ref ePwrServiceUserModeChangeReasonType "EPWR_USER_MODE_CHANGE_REASON_TYPE" to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_USER_MODE_CHANGE_REASON_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_USER_MODE_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_USER_MODE_TYPE - the member what will convert farm EPWR_USER_MODE_TYPE type to string type.The type of
+/// user mode.
+/// \~english @codes
+/// typedef enum {
+/// epsumINVALID = 0xFF,
+/// epsumOFF = 0x00,
+/// epsumON = 0x01,
+/// } ePwrServiceUserModeType, EPWR_USER_MODE_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_USER_MODE_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_USER_MODE_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from EPWR_WAKEUP_FACTOR_TYPE type to string
+/// \~english @param [in] f_enum
+/// EPWR_WAKEUP_FACTOR_TYPE - the member what will convert farm EPWR_WAKEUP_FACTOR_TYPE type to string type.The
+/// type of startup reason.
+/// \~english @codes
+/// typedef enum {
+/// epswfINVALID = 0xFF,
+/// epswfTESTACC = 0x00,
+/// epswfON_KEY = 0x01,
+/// epswfIGN_ACC = 0x02,
+/// epswfDR_OPEN_CLOSE = 0x03,
+/// epswfDX_ACTIVATION = 0x04,
+/// epswfPASS_ACTIVATION = 0x05,
+/// epswfSPVACTIVATION = 0x06,
+/// epswfUSER_DATA_RESET = 0x07
+/// } ePowerSrvWakeupFactors, EPWR_WAKEUP_FACTOR_TYPE;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EPWR_WAKEUP_FACTOR_TYPE type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EPWR_WAKEUP_FACTOR_TYPE f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr JP_ZPT
+/// \~english @par Summary
+/// change member from EFrameworkunifiedStatus type to string
+/// \~english @param [in] f_enum
+/// EFrameworkunifiedStatus - the member what will convert farm EFrameworkunifiedStatus type to string type.Status and return types.
+/// \~english @codes
+/// typedef enum eFrameworkunifiedStatus {
+/// eFrameworkunifiedStatusEmptyMediaList = -10, ///< Empty media list
+/// eFrameworkunifiedStatusSessionLimitMaxedOut = -9, ///< Maximum session limit reached
+/// eFrameworkunifiedStatusDbRecNotFound = -8, ///< Database record not found
+/// eFrameworkunifiedStatusDbResultError = -7, ///< Database result error
+/// eFrameworkunifiedStatusDbExecuteFail = -6, ///< Database execute fail
+/// eFrameworkunifiedStatusSemCloseFail = -5, ///< Semaphore close failed
+/// eFrameworkunifiedStatusSemUnlockFail = -4, ///< Semaphore unlock failed
+/// eFrameworkunifiedStatusSemLockFail = -3, ///< Semaphore lock failed
+/// eFrameworkunifiedStatusFail = -2, ///< Failed
+/// eFrameworkunifiedStatusErrOther = -1, ///< Unknown error
+/// eFrameworkunifiedStatusOK = 0, ///< Success / Pass / OK
+/// eFrameworkunifiedStatusInvldBuf = 1, ///< Invalid buffer
+/// eFrameworkunifiedStatusInvldHandle = 2, ///< Invalid handle
+/// eFrameworkunifiedStatusInvldHndlType = 3, ///< Invalid handle type
+/// eFrameworkunifiedStatusInvldQName = 4, ///< Invalid messasge queue name
+/// eFrameworkunifiedStatusMsgQFull = 5, ///< Message queue full
+/// eFrameworkunifiedStatusInvldNotification = 6,///< The Notification event not present
+/// eFrameworkunifiedStatusInvldParam = 7, ///< Invalid parameter
+/// eFrameworkunifiedStatusInvldBufSize = 8, ///< Buf size too small
+/// eFrameworkunifiedStatusInvldID = 9, ///< Unrecognized ID
+/// eFrameworkunifiedStatusCannotRelease = 10, ///< Cannot release resource
+/// eFrameworkunifiedStatusBadConnection = 11, ///< Could not locate resource
+/// eFrameworkunifiedStatusExit = 12, ///< Normal application termination
+/// eFrameworkunifiedStatusNotImplemented = 13, ///< incomplete feature
+/// eFrameworkunifiedStatusThreadBusy = 14, ///< Joined thread is already being joined
+/// eFrameworkunifiedStatusThreadSelfJoin = 15, ///< Thread is joining itself
+/// eFrameworkunifiedStatusThreadInvalidVal = 16, ///< Invalid value passed
+/// eFrameworkunifiedStatusThreadNotExist = 17, ///< The thread does not exist
+/// eFrameworkunifiedStatusFault = 18, ///< A fault occurred while attempting to make call
+/// eFrameworkunifiedStatusServNotFound = 19, ///< Service not present in serv dir
+/// eFrameworkunifiedStatusServerInUse = 20, ///< Service already processing 1 client request
+/// eFrameworkunifiedStatusDbIndexing = 21, ///< Database Indexing in progress
+/// eFrameworkunifiedStatusNullPointer = 22,
+/// eFrameworkunifiedStatusMsgNotProcessed = 23,
+/// eFrameworkunifiedStatusFileLoadSuccess = 24, ///< File Load Success
+/// eFrameworkunifiedStatusFileLoadError = 25, ///< File Load Error
+/// eFrameworkunifiedStatusAccessError = 26, ///< Error when accessing resource
+/// eFrameworkunifiedStatusDuplicate = 27, ///< Duplicate entry
+/// eFrameworkunifiedStatusMsgQEmpty = 28, ///< Message queue empty
+/// eFrameworkunifiedStatusThreadAlreadyRunning = 29,
+/// eFrameworkunifiedStatusErrNoEBADF = 30, ///< Bad file descriptor
+/// eFrameworkunifiedStatusErrNoEAGAIN = 31, ///< Resource unavailable, try again
+/// eFrameworkunifiedStatusErrNoEINTR = 32, ///< Interrupted system call
+/// eFrameworkunifiedStatusSessionErr = 33, ///< Error in session handling
+/// eFrameworkunifiedStatusDBCorrupt = 34, ///< Database corrupt
+/// eFrameworkunifiedStatusDBFileNotFound = 35 ///< Database file not found
+/// } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from EFrameworkunifiedStatus type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(EFrameworkunifiedStatus f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from ESMBootModeInfo type to string
+/// \~english @param [in] f_enum
+/// ESMBootModeInfo - the member what will convert farm ESMBootModeInfo type to string type.The type of boot
+/// mode information.
+/// \~english @codes
+/// typedef enum {
+/// e_SS_SM_BOOT_MODE_INVALID = -1
+/// , e_SS_SM_BOOT_MODE_APPLICATION
+/// , e_SS_SM_BOOT_MODE_PROGRAMMING
+/// }ESMBootModeInfo;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from ESMBootModeInfo type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(ESMBootModeInfo f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from ESMCpuResetReason type to string
+/// \~english @param [in] f_enum
+/// ESMCpuResetReason - the member what will convert farm ESMCpuResetReason type to string type.The type of CPU
+/// reset reason.
+/// \~english @codes
+/// typedef enum {
+/// e_SS_SM_CPU_RESET_REASON_INVALID = -1
+/// , e_SS_SM_CPU_RESET_REASON_NORMAL = 0
+/// , e_SS_SM_CPU_RESET_REASON_DATA_RESET
+/// , e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET
+/// , e_SS_SM_CPU_RESET_REASON_GENERIC
+/// , e_SS_SM_CPU_RESET_REASON_GENERIC_ERR = e_SS_SM_CPU_RESET_REASON_GENERIC
+/// , e_SS_SM_CPU_RESET_REASON_DSP_ERR
+/// , e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL
+/// , e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR
+/// }ESMCpuResetReason;
+/// @endcode
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from ESMCpuResetReason type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(ESMCpuResetReason f_enum);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetStr
+/// \~english @par Summary
+/// change member from \ref _SS_SystemManagerProtocol "SS_SystemManagerProtocol" type to string
+/// \~english @param [in] f_enum
+/// \ref _SS_SystemManagerProtocol "SS_SystemManagerProtocol" - the member what will convert farm \ref SS_SystemManagerProtocol "SS_SystemManagerProtocol" type to string
+/// type.The type of system manager protocol.
+/// \~english @retval SS_String
+/// \~english @par Preconditions
+/// - None.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// sync only
+/// \~english @par Detail
+/// change member from \ref _SS_SystemManagerProtocol) "SS_SystemManagerProtocol" type to string. \n
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+extern SS_String GetStr(SS_SystemManagerProtocol f_enum);
+
+#endif /* SS_STRING_MAPS_H_ */ // NOLINT (build/header_guard)
+// EOF ss_string_maps.h
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sys_boot_area_map.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sys_boot_area_map.h
new file mode 100755
index 0000000..7df0c88
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_sys_boot_area_map.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file ss_sys_boot_area_map.h
+ * @brief \~english This file supports system area type definitions
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef __SS_SYS_BOOT_AREA_MAP_H__ // NOLINT (build/header_guard)
+#define __SS_SYS_BOOT_AREA_MAP_H__
+
+#include <system_service/ss_sm_boot_access.h>
+
+#endif /* __SS_SYS_BOOT_AREA_MAP_H__ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_if.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_if.h
new file mode 100755
index 0000000..1e3ef14
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_if.h
@@ -0,0 +1,119 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_system_if.h
+ * @brief \~english This file contains api build the session of heartbeat observation system manager
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_SYSTEM_IF_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_IF_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_sm_framework_if.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \~english @par Summary:
+/// Establish SystemManger and HeartBeat monitoring session
+/// \~english @param [in] hApp
+/// HANDLE - Handle for application
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusNullPointer Handle error
+/// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue error
+/// \~english @retval eFrameworkunifiedStatusErrNoEBADF File descriptor error
+/// \~english @retval eFrameworkunifiedStatusErrNoEINTR System call error
+/// \~english @retval eFrameworkunifiedStatusInvldBufSize Message buffer error
+/// \~english @retval eFrameworkunifiedStatusErrOther Session establishment failure
+/// \~english @retval eFrameworkunifiedStatusFail Message sharing memory error
+
+/// \~english @par Preconditions:
+/// - Dispather for application is created / initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.)
+/// \~english @par Change of the internal state:
+/// - No change of internal state by this API occurs
+/// \~english @par Causes of failures:
+/// - Handle(hApp) specified in the argument is not appropriate(invalid) [eFrameworkunifiedStatusNullPointer]
+/// - Management information area acquisition(malloc) failed [eFrameworkunifiedStatusNullPointer]
+/// - Message queue for session for service is full [eFrameworkunifiedStatusMsgQFull]
+/// - Invalid file descriptor for sending session messages for service [eFrameworkunifiedStatusErrNoEBADF]
+/// - System call(signal) interrupt occurs
+/// while sending a session message for a service [eFrameworkunifiedStatusErrNoEINTR]
+/// - The size of the message transmission buffer for service is incorrect [eFrameworkunifiedStatusInvldBufSize]
+/// - Some error occurred when sending session message for service [eFrameworkunifiedStatusFail]
+/// - Failed to access shared memory for sending session messages for service [eFrameworkunifiedStatusErrOther]
+/// \~english @par Detail:
+/// Establish HeartBeat monitoring and SystemManager session.\n
+///
+/// \~english @par Classification:
+/// Public
+/// \~english @see FrameworkunifiedMcOpenSender, FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedSendMsg
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(IMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND)
+#define FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(x) \
+ x.onInitilization = FrameworkunifiedOnInitialization; \
+ x.onDestroy = FrameworkunifiedOnDestroy; \
+ x.onStart = FrameworkunifiedOnStart; \
+ x.onStop = FrameworkunifiedOnStop; \
+ x.onDebugDump = FrameworkunifiedOnDebugDump; \
+ x.createStateMachine = FrameworkunifiedCreateStateMachine; \
+ x.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface; \
+ x.onPreStart = FrameworkunifiedOnDummy; \
+ x.onPreStop = FrameworkunifiedOnDummy; \
+ x.onBackgroundStart = FrameworkunifiedOnDummy; \
+ x.onBackgroundStop = FrameworkunifiedOnDummy;
+#else
+#define FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(x) \
+ x.onInitilization = FrameworkunifiedOnInitialization; \
+ x.onDestroy = FrameworkunifiedOnDestroy; \
+ x.onStart = FrameworkunifiedOnStart; \
+ x.onStop = FrameworkunifiedOnStop; \
+ x.onDebugDump = FrameworkunifiedOnDebugDump; \
+ x.createStateMachine = FrameworkunifiedCreateStateMachine; \
+ x.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface; \
+ x.onPreStart = FrameworkunifiedOnPreStart; \
+ x.onPreStop = FrameworkunifiedOnPreStop; \
+ x.onBackgroundStart = FrameworkunifiedOnBackgroundStart; \
+ x.onBackgroundStop = FrameworkunifiedOnBackgroundStop;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* SS_SYSTEM_IF_H_ */ // NOLINT (build/header_guard)
+/** @}*/ // end of interface_unified
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_if.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_if.h
new file mode 100755
index 0000000..e6b4f8d
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_if.h
@@ -0,0 +1,335 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_system_manager_if.h
+/// \brief This file supports the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_MANAGER_IF_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_MANAGER_IF_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_sm_ram_access.h>
+#include "system_service/ss_system_if.h"
+#include "system_service/ss_error_event_common.h"
+#include "system_service/ss_power_service.h"
+
+/// \ingroup system_manager
+/// \brief Boot mode information
+typedef enum {
+ e_SS_SM_BOOT_MODE_INVALID = -1
+ , e_SS_SM_BOOT_MODE_APPLICATION
+ , e_SS_SM_BOOT_MODE_PROGRAMMING
+}ESMBootModeInfo;
+
+/// \ingroup system_manager
+/// \brief Data reset mode information
+typedef enum {
+ e_SS_SM_DATA_RESET_MODE_NONE
+ , e_SS_SM_DATA_RESET_MODE_USER
+ , e_SS_SM_DATA_RESET_MODE_FACTORY
+ , e_SS_SM_DATA_RESET_MODE_PROGUPDATE // cannot use this
+}ESMDataResetModeInfo;
+
+/// \ingroup system_manager
+/// \brief Program update status
+typedef UI_32 SMProgUpdateState;
+#define SS_SM_PROG_UPDATE_STATE_NONE 0x0000
+#define SS_SM_PROG_UPDATE_STATE_UPDATED 0x0001
+#define SS_SM_PROG_UPDATE_STATE_MAP_UPDATED 0x0002
+#define SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED 0x0004
+
+/// Set Next Wakeup type information
+typedef enum {
+ e_SS_SM_NEXT_WAKEUP_TYPE_NONE = 0
+ , e_SS_SM_NEXT_WAKEUP_TYPE_COLD
+ , e_SS_SM_NEXT_WAKEUP_TYPE_HOT
+}ESMNextWakeupType;
+
+/// \ingroup system_manager
+/// \brief DRAM backup status
+typedef enum {
+ e_SS_SM_DRAM_BACKUP_UNSET = -1
+ , e_SS_SM_DRAM_BACKUP_OK
+ , e_SS_SM_DRAM_BACKUP_NG
+}ESMDramBackupStatus;
+
+/// \ingroup system_manager
+/// \brief Reset status
+typedef enum {
+ e_SS_SM_RESET_STATUS_UNSET = -1
+ , e_SS_SM_RESET_STATUS_NONE
+ , e_SS_SM_RESET_STATUS_NG
+ , e_SS_SM_RESET_STATUS_IMMEDIATE
+}ESMResetStatus;
+
+/// \ingroup system_manager
+/// \brief Relaunch status
+typedef enum {
+ e_SS_SM_RELAUNCH_STATUS_NONE
+ , e_SS_SM_RELAUNCH_STATUS_SAFE
+ , e_SS_SM_RELAUNCH_STATUS_ERR
+}EMRelaunchStatus;
+
+
+/// \ingroup system_manager
+/// \brief CPU Reset Reason
+typedef enum {
+ e_SS_SM_CPU_RESET_REASON_INVALID = -1
+ , e_SS_SM_CPU_RESET_REASON_NORMAL = 0
+ , e_SS_SM_CPU_RESET_REASON_DATA_RESET
+ , e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET
+ , e_SS_SM_CPU_RESET_REASON_GENERIC
+ , e_SS_SM_CPU_RESET_REASON_GENERIC_ERR = e_SS_SM_CPU_RESET_REASON_GENERIC
+ , e_SS_SM_CPU_RESET_REASON_DSP_ERR
+ , e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL
+ , e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR // DRAM backup will be discarded after reset
+}ESMCpuResetReason;
+
+/// \ingroup system_manager
+/// \brief CPU Reset Info
+typedef struct T_SystemManagerCpuResetInfo {
+#define SS_SM_RESET_MSG_STR_SIZE 64
+#define SS_SM_SUFFIX_STR_SIZE 32
+ ESMCpuResetReason resetReason;
+ CHAR messageStr[SS_SM_RESET_MSG_STR_SIZE];
+ CHAR suffixStr[SS_SM_SUFFIX_STR_SIZE];
+ T_SystemManagerCpuResetInfo
+ () : resetReason(e_SS_SM_CPU_RESET_REASON_INVALID) {
+ }
+}TSystemManagerCpuResetInfo;
+
+
+/// \ingroup system_manager
+/// \brief Data Reset Reason
+typedef enum {
+ e_SS_SM_DATA_RESET_TYPE_USER = 0
+ , e_SS_SM_DATA_RESET_TYPE_FACTORY // AKA Shipment Mode
+ , e_SS_SM_DATA_RESET_TYPE_CONFIGURATION
+ , e_SS_SM_DATA_RESET_TYPE_PROGUPDATE // cannot use this
+}ESMDataResetType;
+
+typedef enum {
+ e_SS_SM_SVC_WAKEUP_STATUS_COMPLETE = 0x01
+}ESMServiceWakeupStatus;
+
+/// \ingroup system_manager
+/// \brief Data Reset Reason
+typedef struct T_SS_BootModeListStruct {
+ ESMBootModeInfo hostBootMode;
+ EPWR_SC__CWORD56__BOOT_MODE_TYPE _CWORD56_BootMode;
+} TSS_BootModeListStruct;
+
+//****************************************************************************
+/// \ingroup system_manager *
+/// Data passed in the NTFY_SSSystemMgrPowerOnOff and *
+/// NTFY_SSSystemMgrUserMode notification messages *
+
+/// \ingroup system_manager
+typedef struct T_SS_SM_UserModeOnOffNotification_Struct { // *
+ BOOL isUserModeOn; // *
+ EPWR_WAKEUP_FACTOR_TYPE startupReason; // *
+ EPWR_USER_MODE_CHANGE_REASON_TYPE userModeChangeReason; // *
+ T_SS_SM_UserModeOnOffNotification_Struct // *
+ () : isUserModeOn(FALSE), // *
+ startupReason(epswfINVALID), // *
+ userModeChangeReason(epsumcrNOT_AVAILABLE) { // *
+ } // *
+ T_SS_SM_UserModeOnOffNotification_Struct // *
+ (BOOL f_bUserMode, // *
+ EPWR_WAKEUP_FACTOR_TYPE f_startupReason, // *
+ EPWR_USER_MODE_CHANGE_REASON_TYPE f_changeReason) // *
+ : isUserModeOn(f_bUserMode), // *
+ startupReason(f_startupReason), // *
+ userModeChangeReason(f_changeReason) { // *
+ } // *
+ // *
+} T_SS_SM_UserModeOnOffNotification_StructType; // *
+// *
+// End of Data passed as part of NTFY_SSSystemMgrPowerOnOff notification ... *
+//****************************************************************************
+
+
+//****************************************************************************
+/// \ingroup system_manager
+/**
+ * \~english Parameters of the following message. \n
+ * SS_SM_START 'FrameworkunifiedOnStart'/'evStart' \n
+ * SS_SM_PRE_START 'FrameworkunifiedOnPreStart'/'evPreStart' \n
+ * SS_SM_BACKGROUND_START 'FrameworkunifiedOnBackgroundStart'/'evBackgroundStart' \n
+ */
+typedef struct T_SS_SM_START_DataStruct {
+ EPWR_WAKEUP_FACTOR_TYPE startupReason; //!< \~english
+ BOOL isUserModeOn; //!< \~english
+ ESMDataResetModeInfo dataResetMode; //!< \~english
+ EPWR_SC_SECURITY_STATUS securityStatus; //!< \~english
+ EPWR_SC_WAKEUP_TYPE wakeupType; //!< \~english
+ ESMDramBackupStatus dramBackupStatus; //!< \~english
+ ESMResetStatus resetStatus; //!< \~english
+ UI_32 errResetCount; //!< \~english
+ /**
+ * \~english Constructor
+ */
+ T_SS_SM_START_DataStruct
+ () : startupReason(epswfINVALID),
+ isUserModeOn(FALSE),
+ dataResetMode(e_SS_SM_DATA_RESET_MODE_NONE),
+ securityStatus(epsssINVALID),
+ wakeupType(epsstINVALID),
+ dramBackupStatus(e_SS_SM_DRAM_BACKUP_UNSET),
+ resetStatus(e_SS_SM_RESET_STATUS_UNSET),
+ errResetCount(0) {}
+ /**
+ * \~english Constructor
+ */
+ T_SS_SM_START_DataStruct
+ (EPWR_WAKEUP_FACTOR_TYPE f_startupReason,
+ BOOL f_isUserModeOn,
+ ESMDataResetModeInfo f_dataResetMode,
+ EPWR_SC_SECURITY_STATUS f_securityStatus,
+ EPWR_SC_WAKEUP_TYPE f_wakeupType,
+ ESMDramBackupStatus f_dramBackupStatus,
+ ESMResetStatus f_resetStatus,
+ UI_32 f_resetCount)
+ : startupReason(f_startupReason),
+ isUserModeOn(f_isUserModeOn),
+ dataResetMode(f_dataResetMode),
+ securityStatus(f_securityStatus),
+ wakeupType(f_wakeupType),
+ dramBackupStatus(f_dramBackupStatus),
+ resetStatus(f_resetStatus),
+ errResetCount(f_resetCount) {}
+} T_SS_SM_START_DataStructType;
+// *
+// End of Data passed as part of SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message *
+//****************************************************************************
+
+//****************************************************************************
+/// \ingroup system_manager
+/// Data passed as part of SS_SM_STOP 'FrameworkunifiedOnStop'/'evStop' message *
+typedef struct T_SS_SM_STOP_DataStruct { // *
+ EPWR_SHUTDOWN_TRIGGER_TYPE shutdownTrigger; // *
+ EPWR_USER_MODE_TYPE lastUserMode; // *
+} T_SS_SM_STOP_DataStructType; // *
+// *
+// End of Data passed as part of SS_SM_STOP 'FrameworkunifiedOnStop'/'evStop' message // *
+//****************************************************************************
+
+//****************************************************************************
+/// \ingroup system_manager
+/// Extended Parameter for FrameworkunifiedOnStart *
+typedef struct { // *
+#define SS_SM_START_EXT_INFO_SIZE 64 // *
+#define SS_SM_START_EXT_BODY_SIZE ( sizeof(BOOL) \
+ + sizeof(EMRelaunchStatus) \
+ + sizeof(BOOL) \
+ + sizeof(BOOL) \
+ )
+
+#define SS_SM_START_EXT_RSV_SIZE SS_SM_START_EXT_INFO_SIZE \
+ - SS_SM_START_EXT_BODY_SIZE // *
+ BOOL isProgUpdated; // *
+ EMRelaunchStatus relaunchStatus; // *
+ BOOL isMapUpdated; // *
+ BOOL isMapDiffUpdated; // *
+ uint8_t reserved[SS_SM_START_EXT_RSV_SIZE]; // *
+} T_SS_SM_START_ExtDataStructType; // *
+// *
+// End of Extended Parameter for FrameworkunifiedOnStart *
+//****************************************************************************
+
+//****************************************************************************
+/// \ingroup system_manager
+/// Extended Parameter for FrameworkunifiedOnStop *
+typedef struct { // *
+#define SS_SM_STOP_EXT_INFO_SIZE 64 // *
+#define SS_SM_STOP_EXT_BODY_SIZE (sizeof(BOOL)) // *
+#define SS_SM_STOP_EXT_RSV_SIZE SS_SM_STOP_EXT_INFO_SIZE \
+ - SS_SM_STOP_EXT_BODY_SIZE // *
+ BOOL isProgUpdated; // *
+ uint8_t reserved[SS_SM_STOP_EXT_RSV_SIZE]; // *
+}T_SS_SM_STOP_ExtDataStructType; // *
+// *
+// End of Extended Parameter for FrameworkunifiedOnStop *
+//****************************************************************************
+
+struct SMErrorEventNtfData {
+#define SM_MODULE_NAME_SIZE 64
+ EErrorEventType EventType;
+ CHAR ModuleName[SM_MODULE_NAME_SIZE];
+ BOOL isNeedReboot;
+};
+
+//*************************************************************************
+// Boot Micro Logging Protocol *
+// *
+enum eSMBootMicroResetReason {
+ SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET = 0,
+ SS_SM_BOOT_MICRO_RESET_REASON_USER_FORCE_RESET,
+ SS_SM_BOOT_MICRO_RESET_REASON_DSP_RESET,
+ SS_SM_BOOT_MICRO_RESET_REASON_HB_TIMEOUT
+};
+// *
+// End of Boot Micro Logging Protocol *
+//*************************************************************************
+
+
+//****************************************************************************
+/// \ingroup system_manager *
+/// Error Event Logging enumerations *
+///
+enum eSMUserLogType {
+ e_SS_SM_CAPTURE_ALL_LOGS = 1, //!< \~english Capture all logs
+ e_SS_SM_SCREEN_CAPTURE, //!< \~english Capture screenshot
+ e_SS_SM_CAPTURE_INTERFACEUNIFIED_LOGS, //!< \~english Capture application log
+ e_SS_SM_USER_FORCE_RESET, //!< \~english Capture logs are forcibily reset
+ e_SS_SM_CAPTURE_DEV_LOGS, //!< \~english Capture device log
+ e_SS_SM_CAPTURE_MODULE_LOGS, //!< \~english Capture debug log
+ e_SS_SM_CAPTURE_DTC_LOGS, //!< \~english Capture DTC event log
+ e_SS_SM_CAPTURE_NAVI_LOGS, //!< \~english Capture Navi event log
+ e_SS_SM_CAPTURE_GROUP_RELAUNCH //!< \~english Capture log by Group Relaunch
+};
+// *
+// Error Event Logging enumerations *
+//****************************************************************************
+
+//****************************************************************************
+/// \ingroup system_manager *
+/// \brief Error Event Logging Info *
+typedef struct T_SystemManagerLoggingRequestInfo {
+#define SS_SM_LOG_MSG_STR_SIZE 64
+ eSMUserLogType logType;
+ CHAR messageStr[SS_SM_LOG_MSG_STR_SIZE];
+ CHAR suffixStr[SS_SM_SUFFIX_STR_SIZE];
+}TSystemManagerLoggingRequestInfo;
+//
+// Error Event Logging Info *
+//****************************************************************************
+
+//****************************************************************************
+/// \ingroup system_manager *
+/// \brief Error Event Clear Logs Info *
+typedef struct T_SystemManagerClearLogsInfo {
+ void *rsv;
+}TSystemManagerClearLogsInfo;
+//
+// Error Event Clear Logs Info *
+//****************************************************************************
+
+#endif /* SS_SYSTEM_MANAGER_IF_H_ */ // NOLINT (build/header_guard)
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_if_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_if_local.h
new file mode 100755
index 0000000..5c67aa6
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_if_local.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_system_manager_if_local.h
+/// \brief This file supports the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_MANAGER_IF_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_MANAGER_IF_LOCAL_H_
+
+#define SS_MAX_NUM_MODULES (128)
+
+// EXIT_SUCCESS exit succeccfully
+// EXIT_FAILURE exit with failure
+// SS_SM_EXIT_RELAUNCH exit for relaunch request
+#define SS_SM_EXIT_RELAUNCH (2)
+
+/// \ingroup system_manager
+/// Message data payload structure from system manager to heartbeat
+typedef struct T_SMRequestMsg {
+ CHAR pstModuleName[MAX_QUEUE_NAME_SIZE];
+}TSMRequestMessage;
+
+#endif /* SS_SYSTEM_MANAGER_IF_LOCAL_H_ */ // NOLINT (build/header_guard)
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications.h
new file mode 100755
index 0000000..008d4f3
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications.h
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_system_manager_notifications.h
+/// \brief This file supports the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_MANAGER_NOTIFICATIONS_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_MANAGER_NOTIFICATIONS_H_
+
+#include "system_service/ss_services.h"
+
+/// \addtogroup system_manager
+/// @{
+
+#define NTFY_SSSystemMgrAvailability SERVICE_SYSMANAGER"/Availability" ///< System Manager availability -
+ // eFrameworkunifiedServiceAvailable or eInterfaceunifiedServiceUnavailable
+#define NTFY_SSSystemMgrState SERVICE_SYSMANAGER"/State" ///< System Manager state - Init,
+ // Connecting, Disconnecting and Ready
+#define NTFY_SSSystemMgrPowerOnOff SERVICE_SYSMANAGER"/PowerOnOffState" ///< Power ON notification for
+ // Audio & Display
+#define NTFY_SSSystemMgrStartUpType SERVICE_SYSMANAGER"/StartUpType" ///< Notification for start up type
+#define NTFY_SSServiceWakeupStatus SERVICE_SYSMANAGER"/ServiceWakeupStatus" ///< Service Wakeup state
+#define NTFY_SSNeedAplRestart SERVICE_SYSMANAGER"/NeedAplRestart" ///< Notification for Need APL Restart
+
+
+/// Notification used by HMI to know when a Shutdown Request has been received
+/// from the _CWORD56_
+#define NTFY_SSSystemMgrShutdownStarted SERVICE_SYSMANAGER"/ShutdownStarted"
+
+/// @}
+
+#endif /* SS_SYSTEM_MANAGER_NOTIFICATIONS_H_ */ // NOLINT (build/header_guard)
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h
new file mode 100755
index 0000000..cbb743f
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_notifications_local.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_system_manager_notifications_local.h
+ * @brief \~english This file supports the System Manager client interface.
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SS_SYSTEM_MANAGER_NOTIFICATIONS_LOCAL_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_MANAGER_NOTIFICATIONS_LOCAL_H_
+
+
+/// TRUE : UserMode is UserOn
+/// FALSE : UserMode is UserOff
+/// Notification for User Mode
+#define NTFY_SSSystemMgrUserMode SERVICE_SYSMANAGER"/UserMode"
+
+/// Notification for data reset
+#define NTFY_SSSystemMgrDataReset SERVICE_SYSMANAGER"/DataReset"
+
+/// Notification used by Audio and System Services for Dynamic Launch
+#define NTFY_SSLastSourceType SERVICE_SYSMANAGER"/LastSourceType"
+
+
+#endif /* SS_SYSTEM_MANAGER_NOTIFICATIONS_LOCAL_H_ */ // NOLINT (build/header_guard)
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol.h
new file mode 100755
index 0000000..99d7e13
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol.h
@@ -0,0 +1,329 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_system_manager_protocol.h
+/// \brief This file supports the System Manager client interface.
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SYSTEM_MANAGER_PROTOCOL_H__ // NOLINT (build/header_guard)
+#define __SS_SYSTEM_MANAGER_PROTOCOL_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+/// \addtogroup system_manager
+/// @{
+
+#define SS_SM_MAX_MODULE_NAME_LENGTH (256)
+#define SS_SM_MAX_TEST_CASE_NAME_SIZE (128)
+#define SS_SM_MAX_RESP_MSG_SIZE (2048)
+
+// system manager protocol --> define all protocol messages in and out of system manager
+// that are pertinent to the functionality offered by system manager.
+/**
+ * \~english System control protocol type.
+ */
+typedef enum _SS_SystemManagerProtocol {
+ // System Manager - command Protocol
+ SS_SYSTEM_MANAGER_PROTOCOL_BEGINNING_INDEX = 0x800, //!< \~english
+ SS_SM_NOTIFY_SYSTEM_LAUNCH_COMPLETE = SS_SYSTEM_MANAGER_PROTOCOL_BEGINNING_INDEX //!< System Manager to Power manager
+ , SS_SM_PROTOCOL_INTERFACE_END //!< \~english
+
+ // SystemManager-command Protocol
+ , SS_SM_START //!< \~english Normal-boot start request.
+ , SS_SM_START_COMPL_RSPN //!< \~english Normal-boot start completion notification.
+ , SS_SM_STOP //!< \~english Shutdown request.
+ , SS_SM_STOP_COMPL_RSPN //!< \~english Shutdown completion notification.
+ // SystemManager-command Protocol
+ , SS_SM_WAKEUP_MODULES_CMPL_RSPN //!< \~english Response to request of power state transition to power_service.(message format to use: \ref _wakeinfo "wakeInfo")
+ , SS_SM_SHUTDOWN_MODULES_CMPL_RSPN //!< SM to power
+
+ , SS_SM_WAKEUP_MODULES //!< client to service
+ , SS_SM_POWER_OFF_MODULES //!< client to service
+ , SS_SM_SHUTDOWN_MODULES //!< client to service
+
+ , SS_SM_CRNT_STATE_QUERY //!< client to service
+ , SS_SM_CRNT_STATE_QUERY_RSPN //!< service to client
+ , SS_SM_SYSTEM_MODE_INFO_REQ //!< client to service
+ , SS_SM_SYSTEM_MODE_INFO_RSPN //!< service to client
+ , SS_SM_INITCOMP_REP //!< client to service
+
+ , SS_SM_PROTOCOL_OPEN_SESSION_REQ //!< \~english
+ , SS_SM_PROTOCOL_OPEN_SESSION_ACK //!< \~english
+
+ //*************************************************************************
+ // Get Extended Parameter Protocol *
+ // *
+ // Protocol between applications and SM *
+ , SS_SM_GET_START_EXT_INFO //!< FrameworkunifiedOnStart Extended Parameter
+ , SS_SM_GET_STOP_EXT_INFO //!< FrameworkunifiedOnStop Extended Parameter
+ // End of Get Extended Parameter Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Reset Mode Protocol: *
+ // *
+ // Request by Privileged clients to set the data reset mode: *
+ // None, UserData Reset or *
+ // Factory Reset *
+ // *
+ // The Set Request message carries the requested reset Mode. *
+ // Set Result message is not defined, because the Set Request is send by *
+ // FrameworkunifiedInvokeSync() *
+ , SS_SM_DATA_RESET_MODE_SET_REQ //!< Client to Service (Sys Mgr)
+ // *
+ // End of Reset Mode Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Program Update Status Protocol: *
+ // *
+ // Request by Privileged clients to set the program update status: *
+ // None or Program Updated *
+ // *
+ // The Set Request message carries the requested program update status. *
+ // Set Result message is not defined, because the Set Request is send by *
+ // FrameworkunifiedInvokeSync() *
+ , SS_SM_PROG_UPDATE_STATE_SET_REQ //!< Client to Service (Sys Mgr)
+ // *
+ // End of Reset Mode Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // 'CPU Reset' Protocol: *
+ // *
+ // CPU Reset request from applications to SM and SM to PS *
+ // /// < Client to Service when *
+ // /// message originating from *
+ // /// Application to SS\SM. *
+ // /// < Service to Client when *
+ // /// message originating from *
+ // /// SS\SM to SS\PS. *
+ , SS_SM_CPU_RESET_REQ //!< \~english
+ // *
+ // End of CPU Reset Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // 'Local Data Reset' Protocol: *
+ // *
+ // Local Data Reset request from applications to SM. *
+ // /// < Client to Service when *
+ // /// message originating from *
+ // /// Application to SS\SM. *
+ , SS_SM_LOCAL_DATA_RESET_REQ //!< \~english
+ // *
+ // End of Local Data Reset Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // 'Remote Data Reset' Protocol: *
+ // *
+ // Remote Data Reset request from SM to PS *
+ // /// < Service to Client when *
+ // /// message originating from *
+ // /// SS\SM to SS\PS. *
+ , SS_SM_REMOTE_DATA_RESET_REQ //!< \~english
+ // *
+ // End of Remote Data Reset Protocol *
+ //*************************************************************************
+
+
+ //*************************************************************************
+ // Startup Confirmation Protocol: *
+ // *
+ // Request by the Power Shadow to the Power Service to forward to the *
+ // System Manager the Startup Confirmation message. *
+ // *
+ // The Request message carries the Startup Confirmation message. *
+ // The Response message carries the EFrameworkunifiedStatus of the request. *
+ , SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ //!< Pwr Svc to Sys Mgr
+ , SS_SM_FWD_START_CONFIRMATION_MSG_RESP //!< Sys Mgr to Pwr Svc
+ // *
+ // End of Startup Confirmation Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Power Request Protocol: *
+ // *
+ // Power Request message from the Power Shadow to the System Manager with *
+ // _CWORD56_'s "Power_Request" IPC_Command data. *
+ // *
+ // The Request message carries the _CWORD56_'s data. *
+ // The Response message carries the EFrameworkunifiedStatus of the request. *
+ , SS_SM_POWER_REQUEST_MSG //!< \~english Startup process start request from power_service.
+ , SS_SM_POWER_REQUEST_MSG_RESP //!< Sys Mgr to Pwr Svc
+ // *
+ // End of Power Request Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // User Mode Protocol: *
+ // *
+ // Request from the Power Service to the System Manager, originally from *
+ // the Power Shadow, to turn on or off the video & audio output of HMI *
+ // and Audio services. *
+ // User Mode 'On' => turn video & audio output on *
+ // User Mode 'Off' => turn video & audio output off *
+ // *
+ // The Request message carries the requested User Mode state. *
+ // The Response message carries the actual User Mode state. *
+ , SS_SM_USER_MODE_SET_RESP //!< Service (Sys Mgr) to Client (Pwr Svc)
+ // *
+ // Note: See the corresponding Power Shadow / Power Service *
+ // 'SS_PowerServiceProtocol' enums in *
+ // /SystemServices/inc/ss_power_service_protocol.h *
+ // End of User Mode Protocol *
+ //*************************************************************************
+
+ , SS_SM_NEXT_WAKEUP_TYPE_SET_REQ //!< \~english
+
+ //*************************************************************************
+ // Error Event Protocol *
+ //
+ , SS_SM_EVENT_ERROR //!< SM to HMI(_CWORD77_)
+ , SS_SM_EVENT_ERROR_TO_SSL //!< SM to SSL
+ , SS_SM_ERROR_EVENT_LOGGING_START_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_LOGGING_START_RSPN //!< SM to SSL
+ , SS_SM_ERROR_EVENT_ARTIFACT_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_ARTIFACT_RSPN //!< SM to SSL
+ , SS_SM_ERROR_EVENT_LOGGING_COMPLETE //!< SSL to SM
+ , SS_SM_ERROR_EVENT_LOGGING_COMPLETE_RSPN //!< SM to SSL
+
+ , SS_SM_ERROR_EVENT_TIMER_ID_LOGGER_START_REQ //!< \~english
+ , SS_SM_ERROR_EVENT_TIMER_ID_DEBUG_DUMP_RSPN //!< \~english
+ , SS_SM_ERROR_EVENT_TIMER_ID_BOOT_MICRO_LOG_RSPN //!< \~english
+ , SS_SM_ERROR_EVENT_TIMER_ID_CORE_FILE_POLL //!< \~english
+
+ , SS_SM_USER_INVOKED_LOG_REQ //!< Key Shadow to SM
+
+ , SS_SM_ERROR_EVENT_EEL_EXPORT_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN //!< SM to SVC
+ , SS_SM_ERROR_EVENT_CLR_LOGS_REQ //!< SVC to SM
+ , SS_SM_ERROR_EVENT_PROCESS_EXIT //!< SM\CD to SM
+ , SS_SM_ERROR_EVENT_DIAG_LOG_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_CAN_LOG_REQ //!< SSL to SM
+ , SS_SM_ERROR_EVENT_DTC_LOG_REQ //!< SSL to SM
+ //
+ // End of Error Event Protocol *
+ //*************************************************************************
+
+ , SS_SM_GROUP_LAUNCH_TRIGGER //!< \~english
+
+ //*************************************************************************
+ // Debug Dump Protocol *
+ // *
+ // Protocol between applications and SM *
+ , SS_SM_DEBUG_DUMP //!< SM to client
+ , SS_SM_DEBUG_DUMP_RSPN //!< client to SM
+ // *
+ // End of Debug Dump Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // IAT Propagate Error (Module Relaunch Request) *
+ // *
+ // Protocol between applications and SM *
+ , SS_SM_MODULE_RELAUNCH_REQ //!< client to SM
+ // *
+ // End of IAT Propagate Error (Module Relaunch Request) *
+ //*************************************************************************
+
+ //*************************************************************************
+ // CPU High Load *
+ // *
+ // Protocol between SS_CPU_Monitor and SM *
+ , SS_SM_CPU_HIGH_LOAD_DETECTED //!< client to SM
+ // *
+ // End of CPU High Load *
+ //*************************************************************************
+
+ //*************************************************************************
+ // IAT Propagate Error (System Error) *
+ // *
+ // Protocol between application and SM *
+ , SS_SM_PROPAGATE_SYSTEM_ERROR //!< client to SM
+ // *
+ // End of IAT Propagate Error (System Error) *
+ //*************************************************************************
+
+ //*************************************************************************
+ // _CWORD56_ HeartBeat Request Protocol *
+ // *
+ // Protocol between Power Services and SM *
+ , SS_SM__CWORD56__HEARTBEAT_REQ //!< PS to SM
+ , SS_SM__CWORD56__HEARTBEAT_RSPN //!< SM to PS
+ // *
+ // End of _CWORD56_ HeartBeat Request Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // User Data Reset Event Protocol *
+ // *
+ // Protocol between SM and Service *
+ , SS_SM_EVENT_USER_DATA_RESET //!< SM to MS
+ // *
+ // End of User Data Reset Event Protocol *
+ //*************************************************************************
+
+ //*************************************************************************
+ // Boot Micro Logging Protocol *
+ // *
+ // Protocol between SS_Logger and SM. *
+ , SS_SM_BOOT_MICRO_RESET_NTF //!< Logging Shadow to SM
+ , SS_SM_BOOT_MICRO_LOG_REQ //!< SM to Logging Shadow
+ , SS_SM_BOOT_MICRO_LOG_RSP //!< Logging Shadow to SM aka ENDING_INDEX
+ // *
+ // End Boot Micro Logging Protocol *
+ //*************************************************************************
+
+ // SystemManager-command Protocol
+ , SS_SM_PRE_START //!< \~english Pre-boot(+BA) start request.
+ , SS_SM_PRE_START_COMPL_RSPN //!< \~english Pre-boot(+BA) start completion notification.
+ , SS_SM_PRE_STOP //!< \~english Pre-boot(+BA) stop request.
+ , SS_SM_PRE_STOP_COMPL_RSPN //!< \~english Pre-boot(+BA) stop completion notification.
+ , SS_SM_BACKGROUND_START //!< \~english Background-boot(+BA) start request.
+ , SS_SM_BACKGROUND_START_COMPL_RSPN //!< \~english Background-boot(+BA) start completion notification.
+ , SS_SM_BACKGROUND_STOP //!< \~english Background-boot(+BA) stop request.
+ , SS_SM_BACKGROUND_STOP_COMPL_RSPN //!< \~english Background-boot(+BA) stop completion notification.
+
+ // UPDATE IF ANOTHER 'LAST' ENUMERATION IS ADDED !
+ , SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX = SS_SM_BACKGROUND_STOP_COMPL_RSPN //!< \~english
+} SS_SystemManagerProtocol;
+
+typedef struct _SS_SMCurrentState {
+ CHAR testCaseIdString[SS_SM_MAX_TEST_CASE_NAME_SIZE];
+ CHAR respMsgString[SS_SM_MAX_RESP_MSG_SIZE];
+}SS_SMCurrentState;
+
+typedef struct _SMCompleteAck {
+ UI_16 unSessionId;
+ CHAR szServiceName[MAX_QUEUE_NAME_SIZE];
+} SMStopCompleteAck;
+
+typedef struct _SMGroupLaunchTrigger {
+ UI_32 NextGroupId;
+}SMGroupLaunchTrigger;
+//*************************************************************************
+
+
+/// @}
+
+#endif /* __SS_SYSTEM_MANAGER_PROTOCOL_H__ */ // NOLINT (build/header_guard)
+// EOF
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h
new file mode 100755
index 0000000..5f86820
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_manager_protocol_local.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_system_manager_protocol_local.h
+/// \brief This file supports the System Manager client interface.
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SYSTEM_MANAGER_PROTOCOL_LOCAL_H__ // NOLINT (build/header_guard)
+#define __SS_SYSTEM_MANAGER_PROTOCOL_LOCAL_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+/// \addtogroup system_manager
+/// @{
+
+#define SS_SM_MAX_MODULE_LOG_MASK_LENGTH (50)
+#define SS_SM_MAX_MODULE_PATH_LENGTH (256)
+#define SS_SM_MAX_MODULE_ARGS_LENGTH (512)
+
+//*************************************************************************
+// Version Number Structure Specification: *
+typedef UI_64 SS_VersionNumberType;
+// End of Version Number Structure Specification *
+//*************************************************************************
+
+/// @}
+
+#endif /* __SS_SYSTEM_MANAGER_PROTOCOL_LOCAL_H__ */ // NOLINT (build/header_guard)
+// EOF
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_process.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_process.h
new file mode 100755
index 0000000..a4ae743
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_process.h
@@ -0,0 +1,1118 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServicesIf
+/// \brief This file supports the System Manager OS process abstraction.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ss_system_process.h
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup interface_unified
+ * @ingroup system_service
+ * @{
+ */
+#ifndef __Process_H__ // NOLINT (build/header_guard)
+#define __Process_H__
+
+#include <spawn.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/cl_process.h>
+#include <system_service/ss_system_types.h>
+#include <signal.h>
+#include <vector>
+#include <string>
+#include <map>
+
+const long lProcess_VALIDATION_VALUE = 2198645; // NOLINT (runtime/int)
+// Used to define a unique value that represents this class.
+// This value is stored in the object when the object is created,
+// and cleared when the object is destroyed.
+
+const int iProcess_DEFAULT_PROCESS_PRIORITY = 10;
+// This is the default process priority that all new processes will use.
+
+const int iProcess_MAXIMUM_PROCESS_PRIORITY = 60;
+// This is the maximum priority a process can have
+
+const long iProcess_DEFAULT_PROCESS_FLAGS = POSIX_SPAWN_SETSCHEDULER // NOLINT (runtime/int)
+ | POSIX_SPAWN_SETSCHEDPARAM;
+
+// This flag field is a bit wise OR of spawning options to use when a process
+// is created.
+
+const int iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS = 25;
+// This is the maximum number of command line (i.e. argv[]) arguments we can
+// send to a process. This includes; exectuable file name + process arguments + NULL
+
+const int iProcess_MAXIMUM_PROCESS_NAME_LENGTH = 32;
+// This is the maximum number of characters that a process name can be in bytes.
+
+class Process;
+
+typedef std::map<SS_String, Process *> ProcessMap;
+
+/**
+ * @class TimerCtrl
+ * \~english @brief OS process
+ * \~english @par Brief Introduction
+ * This class is the System Manager OS process abstraction.
+ *
+ */
+class Process {
+ public:
+ enum eProcessLoadMode {
+ WAIT, // The invoked program is loaded into available memory, is executed,
+ // and then the original program resumes execution.
+ NOWAIT, // Causes the current program to execute concurrently with the new child process.
+ };
+
+ enum eProcessSchedulingPolicy {
+ FIFO, // A fixed priority scheduler in which the highest ready process runs until it
+ // blocks or is preempted by a higher priority process.
+ ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice.
+ OTHER // A general time sharing scheduler in which a process decays in priority if it
+ // consumes too much processor before blocking. It reverts to its default priority
+ // when it blocks. Should it fail to run over a 2 second period and it has decayed
+ // then it's boosted one priority level up to a maximum of its default priority.
+ };
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Process
+ /// \~english @par Summary
+ /// - Default Constructor, called when the class is instantiated.
+ /// \~english @param [in] - cpu_assign
+ /// - Assignment information of CPU.
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - initialize all var
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - initialize all var in class as default value
+ /// \~english @see ~Process
+ ////////////////////////////////////////////////////////////////////////////////////
+ Process(int cpu_assign = 0x0);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Process
+ /// \~english @par Summary
+ /// - Copy Constructor
+ /// \~english @param [in] - p_rhs_i
+ /// - Process - Reference to a Process that you want to copy.
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Used to create an object and copy another object to the new object.
+ /// \~english @see ~Process
+ ////////////////////////////////////////////////////////////////////////////////////
+ Process(const Process& p_rhs_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~Process
+ /// \~english @par Summary
+ /// - Destructor function
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - set m_lValidationTag with 0
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Destructor, called when the object is destroyed.\n
+ /// set m_lValidationTag with 0 and kill process.
+ /// \~english @see Process
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~Process();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup operator=
+ /// \~english @par Summary
+ /// - Assignment Operator
+ /// \~english @param [in]
+ /// \~english @retval Process - New Process object
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Assignment Operator, called when one object is assigned to another object.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ Process& operator=(const Process& p_rhs_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetProcessId
+ /// \~english @par Summary
+ /// - get process id
+ /// \~english @param None
+ /// \~english @retval process pid - the process pid of the process running.
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - This method will return to the caller the PosixBasedOS001 Specific Process ID.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ int const GetProcessId(void) {
+ return static_cast<int>(m_tProcessId);
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetCallingArgumentList
+ /// \~english @par Summary
+ /// - This method will set the calling argument list that this object represents
+ /// \~english @param [in] p_pcArgv_i
+ /// - const char *[] - Pointer to array of null terminated parameter list.
+ /// \~english @param [in] p_iArgc_i
+ /// - const int - - Number of arguments in the array passed.
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - put the new arguments into m_strlstArgv
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Set the executable filename first. This is always the 1st argument
+ /// - in the argument list. Then set the argument list for the process
+ /// - which is held in m_strlstArgv.
+ /// - First make sure that the argument list is empty.
+ /// - Once empty, put the new arguments into the list
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetCallingArgumentList(const char *p_pcArgv_i[], const int p_iArgc_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetCallingArgumentList
+ /// \~english @par Summary
+ /// - This method will set the calling argument list that this object represents.
+ /// \~english @param [in] p_strlstParameters_i
+ /// - const StringList& - String list of arguments that will be used to start.
+ /// \~english @retval None.
+ /// \~english @par Preconditions
+ /// - no preconditions.
+ /// \~english @par Change of the internal state
+ /// - set m_strlstArgv with p_strlstParameters_i.
+ /// \~english @par Causes of failures
+ /// - None.
+ /// \~english @par Classification
+ /// - Public.
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - if p_strlstParameters_i is not empty,then clear m_strlstArgv \n
+ /// - and set m_strlstArgv with p_strlstParameters_i.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetCallingArgumentList(const StringList& p_strlstParameters_i);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetExecutableFileName
+/// \~english @par Summary
+/// - Get executable file name
+/// \~english @param None
+/// \~english @retval Pointer
+/// - Points to SS_String object that holds the path and executable file name for this process
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will return a pointer to the executable filename that this object represents
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ const char * const GetExecutableFileName() {
+ return m_strFile.c_str();
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetProcessReturnCode
+ /// \~english @par Summary
+ /// - This function will return the processes exit/return code.
+ /// \~english @param None
+ /// \~english @retval process exit code - Code for the last process to execute
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - set m_iReturnCode with WEXITSTATUS(iProcessReturn)
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - This function will return the processes exit/return code.\n
+ /// This is not the value of ERRNO as returned by GetLastPosixBasedOS001ErrorCode().
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ int GetProcessReturnCode(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetSchedulingPolicy
+ /// \~english @par Summary
+ /// - This method will change the scheduling policy for the process this object represents.
+ /// \~english @param [in] p_eSchedulingPolicy_i
+ /// - const eProcessSchedulingPolicy - Scheduling Policy for this process
+ /// \~english @par
+ /// - eProcessSchedulingPolicy
+ /// \~english @code
+ /// - enum eProcessSchedulingPolicy {
+ /// FIFO, A fixed priority scheduler in which the highest ready process runs until it\n
+ /// blocks or is preempted by a higher priority process.
+ /// ROUND_ROBIN, The same as FIFO, except processes at the same priority level time-slice.
+ /// OTHER A general time sharing scheduler in which a process decays in priority if it\n
+ /// consumes too much processor before blocking. It reverts to its default priority\n
+ /// when it blocks. Should it fail to run over a 2 second period and it has decayed\n
+ /// then it's boosted one priority level up to a maximum of its default priority.
+ /// };
+ /// @endcode
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// -If the result of function is not 0,then set m_iErrorCode with errno
+ /// - else set m_iErrorCode with 0.
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Attempt to change the scheduling policy for the process that this object
+ /// represents. If the change fails, restore the previous settings.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetSchedulingPolicy(
+ const eProcessSchedulingPolicy p_eSchedulingPolicy_i);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup GetSchedulingPolicy
+/// \~english @par Summary
+/// - Get currently configured scheduling policy
+/// \~english @param None
+/// \~english @retval FIFO - A fixed priority scheduler in which the highest ready process runs until it\n
+/// blocks or is preempted by a higher priority process.
+/// \~english @retval ROUND_ROBIN - The same as FIFO, except processes at the same priority level time-slice.
+/// \~english @retval OTHER - A general time sharing scheduler in which a process decays in priority if it\n
+/// consumes too much processor before blocking. It reverts to its default priority\n
+/// when it blocks. Should it fail to run over a 2 second period and it has decayed\n
+/// then it's boosted one priority level up to a maximum of its default priority.
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - If the result of calling function sched_getscheduler(m_tProcessId) is -1
+/// then set m_iErrorCode with errno
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will return to the caller the currently configured process scheduling policy.
+/// If the result of calling function sched_getscheduler(m_tProcessId) is -1,
+/// then return ROUND_ROBIN.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ eProcessSchedulingPolicy const GetSchedulingPolicy(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetPriority
+ /// \~english @par Summary
+ /// - This method will change the priority for the process this object represents.
+ /// \~english @param [in] p_iPriority_i
+ /// - int - Priority of the process
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - If the result of function sched_setparam(m_tProcessId, &cur_sch_params)\n
+ /// is -1,then set m_iErrorCode with errno, else set m_iErrorCode with 0.
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Using p_iPriority_i to change the priority for the process\n
+ /// this object represents,if the result of function \n
+ /// sched_setparam(m_tProcessId, &cur_sch_params) is -1
+ /// m_iErrorCode will be seted with errno,else be seted with 0
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetPriority(const int p_iPriority_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetPriority Notice:Can't find the body of this function
+ /// \~english @par Summary
+ /// - This method will change the priority for the specified process ID.
+ /// \~english @param [in] p_iPid_i
+ /// - pid_t - PID of the process to change the priority
+ /// \~english @param [in] p_iPriority_i
+ /// - int - Priority of the process
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// -
+ /// \~english @par Causes of failures
+ /// -
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// -none
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetPriority(const pid_t p_iPid_i, const int p_iPriority_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup IncreasePriorityByOne
+ /// \~english @par Summary
+ /// - This method will increase the priority for the process this\n
+ /// object represents by one.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Retrieve the current priority of the process. Check to see if already at max.\n
+ /// If so just return. Otherwise increase by one and set the priority...
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void IncreasePriorityByOne(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DecreasePriorityByOne
+ /// \~english @par Summary
+ /// - This method will decrease the priority for the process this object represents by one.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no precondition
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - Retrieve the current priority of the process. Check to see if already at minimum.
+ /// If so just return. Otherwise decrease by one and set the priority...
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void DecreasePriorityByOne(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetPriority
+ /// \~english @par Summary
+ /// - This method will return to the caller the currently configured process priority.
+ /// \~english @param None
+ /// \~english @retval int priority - process priority
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - If the result of function sched_getparam(m_tProcessId, &cur_sch_params) is less than -1,\n
+ /// then m_iErrorCode will be seted with errno.
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - If the result of function sched_getparam(m_tProcessId, &cur_sch_params)\n
+ /// is less than -1,will be return -1,else return Currently configured process priority.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ int const GetPriority(void);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetProcessName
+ /// \~english @par Summary
+ /// - This method will set this objects process name member variable to the provided string value.
+ /// \~english @param [in] p_strProcessName_i
+ /// - SS_String - Process Name to set the m_strProcessName member variable to
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - Using p_strProcessName_i to set m_strProcessName
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - This method will set this objects process name member variable to the provided string value.\n
+ /// If the user of this object wishes to register the name with PosixBasedOS001 OS,\n
+ /// the AttachName() method should be called.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void SetProcessName(const SS_String& p_strProcessName_i);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup GetProcessName
+ /// \~english @par Summary
+ /// - Get process name
+ /// \~english @param None
+ /// \~english @retval SS_String - Process Name
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - This method will return to the caller the registered name of this process.\n
+ /// been registered with the OS, a NULL string will be returned. If a name has not
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ SS_String GetProcessName(void) const {
+ return m_strProcessName;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateProcess
+ /// \~english @par Summary
+ /// - This method will create a process with the executable provided and \n
+ /// mode as a calling parameter.The caller can also provide a list of arguments \n
+ /// that will be provided to the executable at startup.
+ /// \~english @param [in] p_strFile_i
+ /// - SS_String - Path and Filename of executable to create process for
+ /// \~english @param [in] p_strlstArgv_i
+ /// - StringList - List of ARGV values for new process
+ /// \~english @param [in] p_eMode_i
+ /// - eProcessLoadMode - Mode to create and load new process
+ /// \~english @param [in] p_strProcessName_i
+ /// - SS_String - This is the name that will be registered to the OS for this process
+ /// \~english @param [in] p_eSchedulingPolicy_i
+ /// - eProcessSchedulingPolicy
+ /// \~english @param [in] p_iPriority_i
+ /// - int - Priority for this process
+ /// \~english @param [in] unix_user_name
+ /// - char* - unix user name
+ /// \~english @param [in] p_lSpawnFlags_i
+ /// - long - Spawning flags. These are PosixBasedOS001 specific....
+ /// \~english @par
+ /// eProcessLoadMode enum
+ /// \~english @code
+ /// - enum eProcessLoadMode {
+ /// WAIT, //The invoked program is loaded into available memory, is executed,
+ /// //and then the original program resumes execution.
+ /// NOWAIT, // Causes the current program to execute concurrently with the new child process.
+ /// };
+ /// @endcode
+ /// \~english @par
+ /// eProcessSchedulingPolicy enum
+ /// \~english @code
+ /// - enum eProcessSchedulingPolicy {
+ /// FIFO, // A fixed priority scheduler in which the highest ready process runs until it
+ /// // blocks or is preempted by a higher priority process.
+ /// ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice.
+ /// OTHER // A general time sharing scheduler in which a process decays in priority if it
+ /// // consumes too much processor before blocking. It reverts to its default priority
+ /// // when it blocks. Should it fail to run over a 2 second period and it has decayed
+ /// // then it's boosted one priority level up to a maximum of its default priority.
+ /// };
+ /// @endcode
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - set m_iErrorCode with 0
+ /// set m_iReturnCode with 0
+ /// set m_eProcessLoadMode with p_eMode_i;
+ /// set m_strFile with p_strFile_i;
+ /// set m_strProcessName with p_strProcessName_i;
+ /// use the result of function CL_ProcessCreate() to set m_tProcessId
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// -This method will create a PosixBasedOS001 process with the executable provided\n
+ /// and mode as a calling parameter.The caller can also provide a list of arguments\n
+ /// that will be provided to the executable at startup.The calling p_strProcessName \m
+ /// parameter is a textual name that will be associated with the newly created process\n
+ /// by the OS. The process state information will be maintained by this object.\n
+ /// Upon successful creation of the process, the scheduling policy and priority\n
+ /// of the process will be set to the provided values. The user can change these\n
+ /// values through the SetSchedulingPolicy() and SetPriority() method calls.\n
+ /// Using unix_user_name to get uid and gid,set uid and gid when calling\n
+ /// CL_ProcessCreateAttrSetUid() and CL_ProcessCreateAttrSetGid\n
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const StringList& p_strlstArgv_i, // List of ARGV values for new process
+ const eProcessLoadMode p_eMode_i, // Mode to create and load new process
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const eProcessSchedulingPolicy p_eSchedulingPolicy_i, // Scheduling Policy for this process
+ const int p_iPriority_i, // Priority for this process
+ const char* unix_user_name, const long p_lSpawnFlags_i); // Spawning flags. These are PosixBasedOS001 specific.... // NOLINT (runtime/int)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateProcess
+ /// \~english @par Summary
+ /// - This method will create a PosixBasedOS001 process with the executable\n
+ /// provided and mode as a calling parameter.
+ /// \~english @param [in] p_strFile_i
+ /// - SS_String - Path and Filename of executable to create process for
+ /// \~english @param [in] p_strProcessName_i
+ /// - SS_String - This is the name that will be registered to the OS for this process
+ /// \~english @param [in] unix_user_name
+ /// - char* - unix user name
+ /// \~english @param [in] p_lSpawnFlags_i
+ /// - long - Posix Spawning flags. These are PosixBasedOS001 specific
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - The caller can also provide a list of arguments that will be provided\n
+ /// to the executable at startup.The calling p_strProcessName parameter is a textual name\n
+ /// that will be associated with the newly created process by the OS.\n
+ /// The process state information will be maintained by this object.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int)
+ iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags.
+ // These are PosixBasedOS001 specific....
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateProcess
+ /// \~english @par Summary
+ /// - This method will create a process with the executable
+ /// provided and mode as a calling parameter.
+ /// \~english @param [in] p_strFile_i
+ /// - SS_String - Path and Filename of executable to create
+ /// process for
+ /// \~english @param [in] p_strProcessName_i
+ /// - SS_String - This is the name that will be registered to the
+ /// OS for this process
+ /// \~english @param [in] p_iPriority_i
+ /// - int - Priority of process
+ /// \~english @param [in] unix_user_name
+ /// - char* - unix user name
+ /// \~english @param [in] p_lSpawnFlags_i
+ /// - long - Posix Spawning flags. These are PosixBasedOS001
+ /// specific
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - The caller can also provide a list of arguments that will be
+ /// provided\n
+ /// to the executable at startup.The calling p_strProcessName
+ /// parameter is a textual name\n
+ /// that will be associated with the newly created process by
+ /// the OS.\n
+ /// The process state information will be maintained by this
+ /// object.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const int p_iPriority_i, // Priority of this process
+ const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int)
+ iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags.
+ // These are PosixBasedOS001 specific....
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CreateProcess
+/// \~english @par Summary
+/// - This method will create a process with the executable provided and mode as a calling parameter.
+/// \~english @param [in] p_strFile_i
+/// - SS_String - p_strFile_i Path and Filename of executable to create process for
+/// \~english @param [in] unix_user_name
+/// - char* - unix user name
+/// \~english @param [in] p_lSpawnFlags_i
+/// - long - Spawning flags. These are PosixBasedOS001 specific.
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - The caller can also provide a list of arguments that will be provided\n
+/// to the executable at startup.The calling p_strProcessName parameter is a textual name\n
+/// that will be associated with the newly created process by the OS.\n
+/// The process state information will be maintained by this object.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int)
+ iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags.
+ // These are PosixBasedOS001 specific....
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CreateProcess
+/// \~english @par Summary
+/// - This method will create a process with the executable provided and mode as a calling parameter.
+/// \~english @param [in] p_strFile_i
+/// - SS_String - p_strFile_i Path and Filename of executable to create process for
+/// \~english @param [in] p_strProcessName_i
+/// - SS_String - This is the name that will be registered to the OS for this process
+/// \~english @param [in] p_strlstArgv_i
+/// - StringList - List of ARGV values for new process
+/// \~english @param [in] unix_user_name
+/// - char* - unix user name
+/// \~english @param [in] p_lSpawnFlags_i
+/// - long - Spawning flags. These are PosixBasedOS001 specific.
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - The caller can also provide a list of arguments that will be provided\n
+/// to the executable at startup.The calling p_strProcessName parameter is a textual name\n
+/// that will be associated with the newly created process by the OS.\n
+/// The process state information will be maintained by this object.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const StringList& p_strlstArgv_i, // List of ARGV values for new process
+ const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int)
+ iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags.
+ // These are PosixBasedOS001 specific....
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CreateProcess
+/// \~english @par Summary
+/// - This method will create a process with the executable provided and mode as a calling parameter.
+/// \~english @param [in] p_strFile_i
+/// - SS_String - Path and Filename of executable to create process for
+/// \~english @param [in] p_strProcessName_i
+/// - SS_String - This is the name that will be registered to the OS for this process
+/// \~english @param [in] p_iPriority_i
+/// - int - Priority for this process
+/// \~english @param [in] p_strlstArgv_i
+/// - StringList - List of ARGV values for new process
+/// \~english @param [in] unix_user_name
+/// - char* - unix user name
+/// \~english @param [in] p_lSpawnFlags_i
+/// - long - Spawning flags.These are PosixBasedOS001 specific.
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - The caller can also provide a list of arguments that will be provided\n
+/// to the executable at startup.The calling p_strProcessName parameter is a textual name\n
+/// that will be associated with the newly created process by the OS.\n
+/// The process state information will be maintained by this object.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const int p_iPriority_i, // Priority for this process
+ const StringList& p_strlstArgv_i, // List of ARGV values for new process
+ const char* unix_user_name = NULL, const long p_lSpawnFlags_i = // NOLINT (runtime/int)
+ iProcess_DEFAULT_PROCESS_FLAGS); // Spawning flags.
+ // These are PosixBasedOS001 specific....
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateProcess
+ /// \~english @par Summary
+ /// - This method will create a process with the executable provided and mode as a calling parameter.
+ /// \~english @param [in] p_strFile_i
+ /// - SS_String - Path and Filename of executable to create process for
+ /// \~english @param [in] c_argv
+ /// - char - This is the argument that will be registered to the OS for this process
+ /// \~english @param [in] environment_string
+ /// - char - enviroment for this process
+ /// \~english @param [in] cl_attr
+ /// - CL_ProcessAttr_t - List of ARGV values for new process
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// -no preconditions
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// - The caller can also provide a list of arguments that will be provided\n
+ /// that will be associated with the newly created process by the OS.\n
+ /// The process state information will be maintained by this object.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcess(const SS_String* p_str_file, char* const * c_argv,
+ char* environment_string, const CL_ProcessAttr_t *cl_attr);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CreateProcessWait
+/// \~english @par Summary
+/// - This method will create a process with the executable provided.
+/// \~english @param [in] p_strFile_i
+/// - SS_String - Path and Filename of executable to create process for
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will create a process with the executable provided.\n
+/// The process state information will be maintained by this object.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcessWait(const SS_String& p_strFile_i); // Path and Filename of executable to create process for
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup CreateProcessWait
+/// \~english @par Summary
+/// - This method will create a PosixBasedOS001 process with the executable provided.
+/// \~english @param [in] p_strFile_i
+/// - SS_String - Path and Filename of executable to create process for
+/// \~english @param [in] p_strlstArguments_i
+/// - StringList - List of process calling arguments
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - None
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will create a PosixBasedOS001 process with the executable provided.\n
+/// The process state information will be maintained by this object.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void CreateProcessWait(const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const StringList& p_strlstArguments_i); // List of process calling arguments
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup KillProcess
+/// \~english @par Summary
+/// - This method will send the specified signal to the process represented by this object
+/// \~english @param [in] signal
+/// - int - signal
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - Intialize the objects m_iErrorCode member variable to 0
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will send the specified signal to the process represented by this object.\n
+/// All variables associated with this object will be initialized to a know value.\n
+/// If this process has a name registered with the OS, that name will be removed.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void KillProcess(int signal = SIGKILL);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DoesProcessExist
+/// \~english @par Summary
+/// -Check if the process existed
+/// \~english @param None
+/// \~english @retval TRUE - Process Exists
+/// \~english @retval FALSE - Process does not exist
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// -None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will return a BOOLean indicating whether this process exists.
+/// \~english @see
+////////////////////////////////////////////////////////////////////////////////////
+ BOOL DoesProcessExist(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup DisableAutoKill
+/// \~english @par Summary
+/// -none
+/// \~english @param None
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - set m_fAutoKill as FALSE
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will disable the Auto Kill function in the destructor,\n
+/// thus letting the process whom this object represents continue running.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void DisableAutoKill(void) {
+ m_fAutoKill = FALSE;
+ }
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup EnableAutoKill
+/// \~english @par Summary
+/// - Enable the Auto Kill
+/// \~english @param None
+/// \~english @retval None
+/// \~english @par Preconditions
+/// -no preconditions
+/// \~english @par Change of the internal state
+/// - set m_fAutoKill as TRUE
+/// \~english @par Causes of failures
+/// - None
+/// \~english @par Classification
+/// - Public
+/// \~english @par Type
+/// - sync only
+/// \~english @par Detail
+/// - This method will Enable the Auto Kill function in the destructor,\n
+/// thus killing the process whom this object represents.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+ void EnableAutoKill(void) {
+ m_fAutoKill = TRUE;
+ }
+
+ private:
+ // Class Data Members
+ //---------------------------------------------
+
+ long m_lValidationTag; // Used to check if this is a valid // NOLINT (runtime/int)
+ // object or not.
+
+ int m_cpu_assign;
+ pid_t m_tProcessId; // This is the process ID for this process. All command, control,
+ // and status gathering will use this ID.
+ eProcessLoadMode m_eProcessLoadMode; // This is the process load mode provided by the caller when this
+ // process was created.
+ SS_String m_strFile; // This is the executable path and file name of this process
+ StringList m_strlstArgv; // This is the calling parameter Argv list provided by the caller.
+ SS_String m_strProcessName; // This is the name that was registered to the OS for process identification
+
+ int m_iErrorCode; // This was the returned PosixBasedOS001 error code for the last call. The programmer
+ // can look at this error code if an error was detected and an
+ // exception was thrown.
+ BOOL m_fAutoKill; // Used to indicate to destructor to kill the process whom this object
+ // represents on exit.
+ int m_iReturnCode;
+
+ //////////////////////////////////////////////////////////////////////
+ /// Copy
+ ///
+ /// Copies data members from the specified object to this object.
+ /// No attempt is made to free dynamically allocated objects within
+ /// this object (you must do that before calling this function).
+ ///
+ ///////////////////////////////////////////////////////////////////////
+ void Copy(const Process& p_rhs_i);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ConvertToPosixBasedOS001SchedularPolicy
+ /// This method will return to the caller the equivalent PosixBasedOS001 schedular policy for the process
+ /// that this object represents
+ ///
+ ///
+ /// Calling Arguments:
+ /// Scheduling Policy
+ ///
+ /// \return policy
+ /// FIFO, A fixed priority scheduler in which the highest ready process runs until it
+ /// blocks or is preempted by a higher priority process.
+ /// ROUND_ROBIN, The same as FIFO, except processes at the same priority level time-slice.
+ /// OTHER A general time sharing scheduler in which a process decays in priority if it
+ /// consumes too much processor before blocking. It reverts to its default priority
+ /// when it blocks. Should it fail to run over a 2 second period and it has decayed
+ /// then it's boosted one priority level up to a maximum of its default priority.
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////
+ int const ConvertToPosixBasedOS001SchedularPolicy(
+ const eProcessSchedulingPolicy p_eSchedulingPolicy_i);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ConvertFromPosixBasedOS001SchedularPolicy
+ ///
+ /// This method will return to the caller the eProcessSchedulingPolicy based on the PosixBasedOS001 schedular
+ /// policy for the process that this object represents
+ ///
+ ///
+ /// Calling Arguments:
+ /// PosixBasedOS001 Scheduling Policy
+ ///
+ /// \return policy
+ /// FIFO, A fixed priority scheduler in which the highest ready process runs until it
+ /// blocks or is preempted by a higher priority process.
+ /// ROUND_ROBIN, The same as FIFO, except processes at the same priority level time-slice.
+ /// OTHER A general time sharing scheduler in which a process decays in priority if it
+ /// consumes too much processor before blocking. It reverts to its default priority
+ /// when it blocks. Should it fail to run over a 2 second period and it has decayed
+ /// then it's boosted one priority level up to a maximum of its default priority.
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////
+ eProcessSchedulingPolicy const ConvertFromPosixBasedOS001SchedularPolicy(
+ const int p_iPosixBasedOS001chedulingPolicy_i);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemServicesIf
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \brief Check environment variable MOCK_LIBRARY where Mock Library Name to set in LD_PRELOAD is set
+ /// and output character string to set in LD_PRELOAD if there is setting.
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void CheckLdPreLoad(SS_String *process_path, char *environment_string);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemServicesIf
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// \brief Acquire the character string of the environment variable and set it in String Vector
+ /// and return in a pointer of Vector.
+ /// \return vector<SS_String> pointer
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ std::vector<SS_String> *GetEnvironVector(void);
+// ----------------------------------------
+// ---------------- End -------------------
+};
+#endif // NOLINT (build/header_guard)
+
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_timer.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_timer.h
new file mode 100755
index 0000000..f95d1f9
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_timer.h
@@ -0,0 +1,670 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// brief This file supports a generic timer abstraction.
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file ss_system_timer.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_manager
+ * @ingroup system_service
+ * @{
+ */
+
+
+#ifndef SS_SYSTEM_TIMER_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_TIMER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <list>
+#include <map>
+
+
+const PCSTR TIMER_SERVICE_NAME = "TIMER";
+
+
+/**
+ * @class Timer
+ * \~english @brief Timer
+ * \~english @par Brief Introduction
+ * Class to provide Timer function
+ *
+ */
+class Timer {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Timer
+ /// \~english @par Summary
+ /// Default constructor of Timer class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// To generate a Timer class, and initialize member variables. \n
+ /// After the constructor, be sure to call the Initialize. \n
+ /// \~english @see ~Timer, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ Timer();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Timer
+ /// \~english @par Summary
+ /// Constructor of Timer class.
+ /// \~english @param [in] hdl
+ /// HANDLE - HANDLE for Application
+ /// \~english @param [in] id
+ /// UI_32 - Timer ID corresponding to the callback function
+ /// \~english @param [in] CbFn
+ /// CbFuncPtr - Pointer to a callback function to be called when the timer expires
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a Timer class. \n
+ /// To initialize timer information structure of the member variables. \n
+ /// To initialize the member variables of the class with an argument. Therefore, there is no need to call the
+ /// Initialize() function when using this constructor.
+ /// \~english @see ~Timer, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ Timer(HANDLE hdl, UI_32 id, CbFuncPtr CbFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~Timer
+ /// \~english @par Summary
+ /// Destructor of Timer class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a Timer class. \n
+ /// If the initialization is complete state, to end by calling the Shutdown().
+ /// \~english @see Timer
+ ////////////////////////////////////////////////////////////////////////////////////
+ virtual ~Timer();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Initialize
+ /// \~english @par Summary
+ /// Initialization of the Timer class.
+ /// \~english @param [in] hApp
+ /// HANDLE - HANDLE for Application
+ /// \~english @param [in] id
+ /// UI_32 - Timer ID corresponding to the callback function
+ /// \~english @param [in] CbFn
+ /// CbFuncPtr - Pointer to a callback function to be called when the timer expires
+ /// \~english @retval TRUE Initialization success
+ /// \~english @retval FALSE Initialization failed
+ /// \~english @par Preconditions
+ /// - Generation/initialization of Dispatcher for the Application (FrameworkunifiedCreateDispatcherWithoutLoop etc) has been
+ /// done.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Handle(hApp) that has been specified by the argument is NULL. [FALSE]
+ /// - Timer ID(id) that has been specified by the argument is 0. [FALSE]
+ /// - Pointer to a callback function that has been specified by the argument is NULL. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// To initialize the member variables of the following.
+ /// - HANDLE for Application
+ /// - Timer information structure
+ /// - Pointer to a callback function
+ /// - HANDLE of message queue
+ /// - Timer Object
+ /// \~english @par
+ /// A timer class to initialization completion state.
+ /// \~english @see ~Timer, Shutdown
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Initialize(HANDLE hApp, UI_32 id, CbFuncPtr CbFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Reinitialize
+ /// \~english @par Summary
+ /// - Reinitialize the timer by specifying a timer value information
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to reinitialize
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - set m_tTi.iCmd with id
+ /// - using the result of function McOpenSender(FrameworkunifiedGetAppName(m_hApp)) to set m_hSnd
+ /// - create a timer and give the handle to m_hTmr
+ /// - set m_bInit with TRUE
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// - Public
+ /// \~english @par Type
+ /// - Method only
+ /// \~english @par Detail
+ /// Reinitialize the timer by specifying a timer value information, \n
+ /// create a new timer if it is not initialize.
+ /// \~english @see Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ void Reinitialize(UI_32 id);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Shutdown
+ /// \~english @par Summary
+ /// The end of the Timer class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// In the case of initialization completion state, it is completed by the following process.\n
+ /// - Stop the Timer
+ /// - Delete Timer Object
+ /// - Set NULL to a timer object variable
+ /// - Close message queue
+ /// - Set NULL to a message queue HANDLE variable
+ /// - The timer class to uninitialized.
+ /// \~english @par
+ /// \nIf you want to re-use this timer, call again Initialize() function.
+ /// \~english @see Timer, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ void Shutdown();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetTime
+ /// \~english @par Summary
+ /// Set the timer value information.
+ /// \~english @param [in] ss
+ /// UI_32 - Timeout expiration time(sec)
+ /// \~english @param [in] sms
+ /// UI_32 - Timeout expiration time(nano sec)
+ /// \~english @param [in] rs
+ /// UI_32 - Timeout expiration time at the time of repeat(sec)
+ /// \~english @param [in] rms
+ /// UI_32 - Timeout expiration time at the time of repeat(nano sec)
+ /// \~english @retval TRUE Setting success
+ /// \~english @retval FALSE Setting failed
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Not been initialized. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Set a timer value information specified by the argument to the timer information structure.
+ /// \~english @see Timer
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL SetTime(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Start
+ /// \~english @par Summary
+ /// The start of the timer by specifying a timer value information.
+ /// \~english @param [in] ss
+ /// UI_32 - Timeout expiration time(sec)
+ /// \~english @param [in] sms
+ /// UI_32 - Timeout expiration time(nano sec)
+ /// \~english @param [in] rs
+ /// UI_32 - Timeout expiration time at the time of repeat(sec)
+ /// \~english @param [in] rms
+ /// UI_32 - Timeout expiration time at the time of repeat(nano sec)
+ /// \~english @retval TRUE Stop success
+ /// \~english @retval FALSE Stop failed
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Not been initialized. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method only
+ /// \~english @par Detail
+ /// In the case of initialization completion state, start the timer. \n
+ /// After timer start, again, if you start the timer, it does not work guarantee.
+ /// \~english @see Stop
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Start(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Start
+ /// \~english @par Summary
+ /// Stop the timer.
+ /// \~english @param None
+ /// \~english @retval TRUE Stop success
+ /// \~english @retval FALSE Stop failed
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// - Set the timeout value in SetTime().
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Not been initialized. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method only
+ /// \~english @par Detail
+ /// In the case of initialization completion state, start the timer. \n
+ /// After timer start, again, if you start the timer, it does not work guarantee.
+ /// \~english @see SetTime, Stop
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Start();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Stop
+ /// \~english @par Summary
+ /// Stop the timer.
+ /// \~english @param None
+ /// \~english @retval TRUE Stop success
+ /// \~english @retval FALSE Stop failed
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// - The timer has been started
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Not been initialized. [FALSE]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Method only
+ /// \~english @par Detail
+ /// In the case of initialization completion state, stop the timer. \n
+ /// After the timer has stopped, again, if you stop the timer, it does not do anything to just processing
+ /// Internal error occurs.
+ /// \~english @see Start
+ ////////////////////////////////////////////////////////////////////////////////////
+ BOOL Stop();
+
+ private:
+ BOOL m_bInit; /// flag that indicated if the class has been initialized or not
+ HANDLE m_hApp; /// refs to an applications hApp handle
+ HANDLE m_hSnd; /// refs to applications message queue
+ HANDLE m_hTmr; /// refs to a timer handle
+ NSTimerInfo m_tTi; /// timer parameters
+ CbFuncPtr m_CbFn; /// pointer to the callback method
+};
+
+/** @}*/ // end of Timer
+/** @}*/ // end of system_manager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
+
+/**
+ * @class TimerCtrl
+ * \~english @brief TimerCtrl
+ * \~english @par Brief Introduction
+ * Class to provide TimerCtrl function
+ *
+ */
+class TimerCtrl {
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup TimerCtrl
+ /// \~english @par Summary
+ /// Default Constructor, called when the class is instantiated.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ ///
+ /// \~english @par Change of the internal state
+ /// - set m_hApp as NULL,m_nTimersMax as DEFAULT_NTIMERS
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// To generate a TimerCtrl class. \n
+ /// After the constructor, be sure to call the Initialize. \n
+ /// \~english @see ~TimerCtrl, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ TimerCtrl();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup TimerCtrl
+ /// \~english @par Summary
+ /// Constructor, called when the class is instantiated.
+ /// \~english @param [in] ntimers
+ /// UI_32 - number of timers objects in the pool
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ ///
+ /// \~english @par Change of the internal state
+ /// - initialize var m_hApp and m_nTimersMax
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// To generate a TimerCtrl class. \n
+ /// After the constructor, be sure to call the Initialize. \n
+ /// \~english @see ~TimerCtrl, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ TimerCtrl(UI_32 ntimers); // NOLINT (runtime/explicit)
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Initialize
+ /// \~english @par Summary
+ /// Initialize the class after instantiation.
+ /// \~english @param [in] hApp
+ /// HANDLE - HANDLE to you applications hApp.
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ ///
+ /// \~english @par Change of the internal state
+ /// - initialize var m_hApp and m_aTimers
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// The function is to initialize the member val of the class with param hApp,\n
+ /// if hApp is not null, then set m_hApp with hApp and initialize m_aTimers.
+ /// \~english @see ~TimerCtrl, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ VOID Initialize(HANDLE hApp);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup Shutdown
+ /// \~english @par Summary
+ /// handle something when shut down timer control.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize()..
+ /// \~english @par Change of the internal state
+ /// - Clear m_aTimer,shut down timer in m_rTimer and delete it.clear m_rTimer.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Completely shuts down the timer control, this method calls Stop, cleans up. You must call
+ /// Initialize again if you want reuse this class.
+ /// \~english @see ~TimerCtrl, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ VOID Shutdown();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup CreateTimer
+ /// \~english @par Summary
+ /// get a timer control from pool
+ /// \~english @param [in] CbFn
+ /// CbFn - Pointer to a callback function to be called when the timer expires
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - insert one Timer to m_rTimers
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// gets a the first id from m_aTimers if m_aTimer is not empty, using this id to create a timer,\n
+ /// put this timer into m_rTimers,and return the id.
+ /// \~english @see DeleteTimer
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 CreateTimer(CbFuncPtr CbFn);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup DeleteTimer
+ /// \~english @par Summary
+ /// delete a timer from m_rTimers using the param.
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to delete
+ /// \~english @retval Timer id -If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - delete one Timer to m_rTimers that id is the param.\n
+ /// and put id of the timer into m_aTimers.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// delete your timer and returns it's id to the pool of timers.
+ /// \~english @see CreateTimer
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 DeleteTimer(UI_32 id);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SetTimer
+ /// \~english @par Summary
+ /// Sets the timer timeout values
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to set
+ /// \~english @param [in] ss
+ /// UI_32 - Start time in seconds
+ /// \~english @param [in] sms
+ /// UI_32 - Start time in milliseconds
+ /// \~english @param [in] rs
+ /// UI_32 - Repeat time in seconds
+ /// \~english @param [in] rms
+ /// UI_32 - Repeat time in milliseconds
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - set the timer infomation in m_rTimers with ss, sms, rs, rms
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// using ss, sms, rs, rms to set the timer infomation, timer'is is param.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 SetTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StartTimer
+ /// \~english @par Summary
+ /// Sets the timer timeout values and starts the timer.
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to start
+ /// \~english @param [in] ss
+ /// UI_32 - Timeout expiration time(sec)
+ /// \~english @param [in] sms
+ /// UI_32 - Timeout expiration time(nano sec)
+ /// \~english @param [in] rs
+ /// UI_32 - Timeout expiration time at the time of repeat(sec)
+ /// \~english @param [in] rms
+ /// UI_32 - Timeout expiration time at the time of repeat(nano sec)
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// In the case of initialization completion state, start the timer that id is the first param. \n
+ /// After timer start, again, if you start the timer, it does not work guarantee.
+ /// \~english @see Stop
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 StartTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StartTimerMulti
+ /// \~english @par Summary
+ /// The start of the timer by specifying a timer value information and reinitialize timer id.
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to start
+ /// \~english @param [in] ss
+ /// UI_32 - Timeout expiration time(sec)
+ /// \~english @param [in] sms
+ /// UI_32 - Timeout expiration time(nano sec)
+ /// \~english @param [in] rs
+ /// UI_32 - Timeout expiration time at the time of repeat(sec)
+ /// \~english @param [in] rms
+ /// UI_32 - Timeout expiration time at the time of repeat(nano sec)
+ /// \~english @param [in] subId
+ /// UI_32 - using subId to reinitialize timer id
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// Finds the timer by specifying, shut down the timer, \n
+ /// and reinitialize it using new id of this timer and starts the timer
+ /// \~english @see Stop
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 StartTimerMulti(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms, UI_32 subId);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StartTimer
+ /// \~english @par Summary
+ /// Start the timer.
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to start
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is in not m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// - Set the timeout value in SetTimer().
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// In the case of initialization completion state, \n
+ /// start of the timer by specifying a timer value information.
+ /// \~english @see SetTime, Stop
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 StartTimer(UI_32 id);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup StopTimer
+ /// \~english @par Summary
+ /// Stop the timer.
+ /// \~english @param [in] id
+ /// UI_32 - timer id that you want to stop
+ /// \~english @retval Timer id - If id is in m_aTimers
+ /// \~english @retval 0 - If id is not in m_aTimers
+ /// \~english @par Preconditions
+ /// - That has been initialized in the Initialize().
+ /// - Set the timeout value in SetTimer().
+ /// \~english @par Change of the internal state
+ /// - None
+ /// \~english @par Causes of failures
+ /// - None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// sync only
+ /// \~english @par Detail
+ /// In the case of start completion state, \n
+ /// stop of the timer by specifying a timer value information
+ /// \~english @see SetTimer, StartTimer
+ ////////////////////////////////////////////////////////////////////////////////////
+ UI_32 StopTimer(UI_32 id);
+
+ private:
+ HANDLE m_hApp; ///
+ UI_32 m_nTimersMax; ///
+ std::list<UI_32> m_aTimers; ///
+ std::map<UI_32, Timer*> m_rTimers; ///
+};
+
+
+#endif /* SS_SYSTEM_TIMER_H_ */ // NOLINT (build/header_guard)
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_types.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_types.h
new file mode 100755
index 0000000..adcaf2b
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_system_types.h
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServicesIf
+/// \brief This file supports string vector type definitions.
+///
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ */
+#ifndef SS_SYSTEM_TYPES_H_ // NOLINT (build/header_guard)
+#define SS_SYSTEM_TYPES_H_
+
+#include <vector>
+#include <string>
+
+
+typedef std::string SS_String;
+typedef std::vector< std::string > StringList;
+typedef std::vector< std::string >::iterator StringListIter;
+
+#endif /* SS_SYSTEM_TYPES_H_ */ // NOLINT (build/header_guard)
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_templates.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_templates.h
new file mode 100755
index 0000000..581e616
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_templates.h
@@ -0,0 +1,303 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// This file supports templates for high use common tasks.
+///////////////////////////////////////////////////////////////////////////////
+/**
+ * @file ss_templates.h
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef __SS_TEMPLATES_H__ // NOLINT (build/header_guard)
+#define __SS_TEMPLATES_H__
+
+#include <stdio.h>
+#include <errno.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <map>
+#include "system_service/ss_system_types.h"
+#include "system_service/ss_string_maps.h"
+
+#ifndef ZONE_ERR
+#define ZONE_ERR ZONEMASK(31)
+#endif
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup ReadMsg
+/// \~english @par Summary
+/// check the data information of msg.
+/// \~english @param [in] hApp
+/// HANDLE - HANDLE Application
+/// \~english @param [in] Data
+/// T - The reference to the Data memory location
+/// \~english @param [in] f_eRetrieveMethod
+/// ESMRetrieveTypes - The msg retrieval method ( release or retain )
+/// \~english @par
+/// T template type
+/// \~english @retval eFrameworkunifiedStatusOK Success
+/// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
+/// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
+/// \~english @par Preconditions
+/// -
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - System Manager handle for the session is NULL. [eFrameworkunifiedStatusInvldHandle]
+/// - data'size is not corruct. [eFrameworkunifiedStatusInvldParam]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail
+/// Check hApp ptr, msg size, msg reception, read msg if all ok
+/// \~english @par
+/// eFrameworkunifiedStatus:Result
+/// - eFrameworkunifiedStatusOK:Success
+/// - Except eFrameworkunifiedStatusOK:Fail
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+template <typename T> EFrameworkunifiedStatus ReadMsg(
+ HANDLE hApp,
+ T &Data, // NOLINT (runtime/references)
+ ESMRetrieveTypes f_eRetrieveMethod = eSMRRelease) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if ( NULL == hApp ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: NULL = hApp");
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ } else if (sizeof(Data) != FrameworkunifiedGetMsgLength(hApp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__
+ , " Error: message buffer sizes mismatch: expected %ld, received %d"
+ , sizeof(Data), FrameworkunifiedGetMsgLength(hApp));
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else if ( eFrameworkunifiedStatusOK != (l_eStatus =
+ FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID)&Data, sizeof(Data), f_eRetrieveMethod))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__
+ , " Error: FrameworkunifiedGetMsgDataOfSize() errored: 0x%x", l_eStatus);
+ }
+ return l_eStatus;
+} // End of template <typename T> EFrameworkunifiedStatus ReadMsg ()
+ /* Copy & paste easy-to-use little 't' template
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if ( eFrameworkunifiedStatusOK != ( l_eStatus = ReadMsg<T>
+ ( hApp
+ , Data )))
+ {
+ LOG_ERROR("ReadMsg()");
+ }
+ else
+ */
+
+//****************************************************************************
+/*!
+ \def LOG_ERROR(pStr)
+ Log pStr and l_eStatus
+ */
+#define LOG_ERROR(pStr) \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__ \
+ , " Error: %s errored: %d/'%s'" \
+ , pStr \
+ , l_eStatus \
+ , GetStr(static_cast<EFrameworkunifiedStatus>(l_eStatus)).c_str());
+
+//****************************************************************************
+/*!
+ \def LOG_ERROR(pStr)
+ Log pStr and l_eStatus
+ */
+#define LOG_SUCCESS(pStr) \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s successful", pStr);
+
+//****************************************************************************
+/*!
+ \def LOG_STATUS(l_eStatus,pStr)
+ Log pStr and success or failure. Include l_eStatus when not successful.
+ */
+#define LOG_STATUS(l_eStatus, pStr) \
+ if ( eFrameworkunifiedStatusOK != l_eStatus ) \
+ { \
+ LOG_ERROR(pStr); \
+ } \
+ else \
+ { \
+ LOG_SUCCESS(pStr); \
+ } // End of #define LOG_STATUS(l_eStatus,pStr)
+
+//****************************************************************************
+/*!
+ \def CALL_AND_LOG_STATUS(fnc)
+ Call the function and log the returned EFrameworkunifiedStatus.
+ */
+#define CALL_AND_LOG_STATUS(fnc) \
+ l_eStatus = (fnc); \
+ LOG_STATUS(l_eStatus, #fnc)
+ // End of #define CALL_AND_LOG_STATUS(fnc)
+
+//****************************************************************************
+/*!
+ \def LOG_STATUS_IF_ERRORED(l_eStatus, pStr)
+ Log pStr on failure, including EFrameworkunifiedStatus.
+ */
+#define LOG_STATUS_IF_ERRORED(l_eStatus, pStr) \
+ if ( eFrameworkunifiedStatusOK != l_eStatus ) \
+ { \
+ LOG_ERROR(pStr); \
+ } // End of #define LOG_STATUS_IF_ERRORED(l_eStatus,pStr)
+
+//****************************************************************************
+/*!
+ \def CALL_AND_LOG_STATUS_IF_ERRORED(fnc)
+ Call the function and log the returned EFrameworkunifiedStatus on failure.
+ */
+#define CALL_AND_LOG_STATUS_IF_ERRORED(fnc) \
+ l_eStatus = (fnc); \
+ LOG_STATUS_IF_ERRORED(l_eStatus, #fnc)
+ // End of #define CALL_AND_LOG_STATUS_IF_ERRORED(fnc)
+
+//****************************************************************************
+/*!
+ \def MAP_ENTRY( f_map, f_enum )
+ Simplify initializing string map entry.
+
+ Use to set a map entry's key and value to the specified enum and the enum's
+ literal text ( i.e., stringified ) equivalent.
+ */
+#define MAP_ENTRY(f_map, f_enum) \
+ f_map[ f_enum ] = #f_enum
+
+//****************************************************************************
+/*!
+ \def INTERFACEUNIFIEDLOG_RECEIVED_FROM
+ Log whom we received message or notification from.
+
+ Use this macro to ensure that the string "Received from" is uniformly
+ logged; this string can be grepped on to find when/where callback functions
+ were invoked.
+ */
+#define INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp) \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from %s", FrameworkunifiedGetMsgSrc(hApp))
+
+//****************************************************************************
+/*!
+ \def INTERFACEUNIFIEDLOG_WHEN_COMPILED
+ Log when this file was compiled.
+
+ Useful when overlaying a delivered object file ( from an official build ) with
+ a debug-built obj file - verifies that the debug file did indeed get loaded.
+ */
+#define INTERFACEUNIFIEDLOG_WHEN_COMPILED \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s was compiled at %s @ %s", \
+ __FILE__, __DATE__, __TIME__);
+
+
+#define SS_ASERT(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT"); \
+ }
+
+#define SS_ASERT_ERRNO(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT %d:%s", errno, strerror(errno)); \
+ }
+
+#define SS_ASERT_LOG(x, fmt, ...) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT " fmt, ## __VA_ARGS__); \
+ }
+
+#define SS_STATIC_ASERT(expr) \
+ { \
+ char STATIC_ASSERTION_FAILED[(expr) ? 1 : -1]; \
+ (void)STATIC_ASSERTION_FAILED; \
+ }
+
+/**
+ * @class EnumStringMap
+ * \~english @brief EnumStringMap
+ * \~english @par Brief Introduction
+ * Class to provide EnumStringMap template function
+ *
+ */
+template <typename enumT, void(*fp)(std::map<enumT, SS_String> & m_strMap)> class EnumStringMap { // NOLINT (runtime/references)
+public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup EnumStringMap
+ /// \~english @par Summary
+ /// Default constructor of EnumStringMap class.
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To generate a EnumStringMap class, and initialize member variables. \n
+ /// After the constructor, be sure to call the Initialize. \n
+ /// \~english @see ~EnumStringMap, Initialize
+ ////////////////////////////////////////////////////////////////////////////////////
+ EnumStringMap() {
+ (*fp)(m_strMap);
+ }
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup ~EnumStringMap
+ /// \~english @par Summary
+ ///
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None.
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// To delete a EnumStringMap object. \n
+ /// \~english @see EnumStringMap
+ ////////////////////////////////////////////////////////////////////////////////////
+ ~EnumStringMap() {}
+ SS_String GetStr( enumT f_enum) { return m_strMap[ f_enum ];}
+private:
+ std::map<enumT, SS_String> m_strMap;
+};
+// End of template <typename enumT, void(*fp)(std::map<enumT, SS_String> & m_strMap)> class EnumStringMap
+
+#endif /* __SS_TEMPLATES_H__ */ // NOLINT (build/header_guard)
+
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_test_clients.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_test_clients.h
new file mode 100755
index 0000000..a50e61f
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_test_clients.h
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup system_manager
+/// \file ss_test_clients.h
+/// \brief This file supports test client queue names.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_TC_SERVICES_H_ // NOLINT (build/header_guard)
+#define SS_TC_SERVICES_H_
+
+
+#define TC_Power "PwrTestClient"
+#define TC_SysManager "SMTestClient"
+
+#endif /* SS_TC_SERVICES_H_ */ // NOLINT (build/header_guard)
diff --git a/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_version.h b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_version.h
new file mode 100755
index 0000000..856f334
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/include/system_service/ss_version.h
@@ -0,0 +1,33 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup sys_resource
+/// \file ss_version.h
+/// \brief This file supports System Manager version number management.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_VERSION_H__ // NOLINT (build/header_guard)
+#define SS_VERSION_H__
+
+#define MAJORNO 0x01
+#define MINORNO 0x00
+#define REVISION 0x01
+
+#endif // SS_VERSION_H__ // NOLINT (build/header_guard)
+
+
diff --git a/video_in_hal/systemservice/interface_unified/library/src/libSS_SystemIfUnified.ver b/video_in_hal/systemservice/interface_unified/library/src/libSS_SystemIfUnified.ver
new file mode 100755
index 0000000..7a646f2
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/libSS_SystemIfUnified.ver
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libNS_FrameworkUnified version script
+#
+{
+ global:
+ ### .text section ###
+ extern "C++" {
+ AttachCallbackToSystemManager*;
+ DetachCallbacksFromInterfaceunifiedDispatcher*;
+ DetachParentCallbacksFromInterfaceunifiedDispatcher*;
+ GetStr*;
+ GetSystemManagerSessionHandle*;
+ SendInterfaceunifiedOnStopResponseToSystemManager*;
+ GetInterfaceunifiedOnStartExtInfo*;
+ GetInterfaceunifiedOnStopExtInfo*;
+ OnSystemManagerDebugDump*;
+ FrameworkunifiedSSFrameworkInterface*;
+ RegisterSMSessionAckCallback*;
+ RemountPartition*;
+ SendBootModeSetRequestToSystemManager*;
+ SetDataResetModeToSystemManager*;
+ SetProgUpdateStateToSystemManager*;
+ SendCANLoggingRequestToSystemManager*;
+ SendCpuResetRequestToSystemManager*;
+ SendDTCLoggingRequestToSystemManager*;
+ SendDebugDumpResponseToSystemManager*;
+ SendDiagLoggingRequestToSystemManager*;
+ SendEelExportRequestToSystemManager*;
+ SendLogArtifactRequestToSystemManager*;
+ SendLogCompleteRequestToSystemManager*;
+ SendLogStartRequestToSystemManager*;
+ SendInterfaceunifiedEmmcLogsRequestToSystemManager*;
+ SendClearLogsRequestToSystemManager*;
+ SendShutdownToSystemManager*;
+ SendStartupConfirmationToSystemManager*;
+ SendSystemModeRequestToSystemManager*;
+ SendInitCompReportToSystemManager*;
+ Send_CWORD56_HeartBeatRequestToSystemManager*;
+ SendVarCodeDataToSystemManager*;
+ SendWakeUpToSystemManager*;
+ SetBootLoaderInfoRequestToSystemManager*;
+
+ GetBootLoaderInfoRequestToSystemManager*;
+
+ SetWakeupOrderToSystemManager*;
+ SetNextWakeupTypeToSystemManager*;
+ Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar*;
+ SendUserInvokedLoggingRequestToSystemManager*;
+ RegisterBootMicroLogRequestCb*;
+ SendBootMicroResetNotificationToSystemManager*;
+ SendBootMicroLogResponseToSystemManager*;
+ SS_ConvLastInfoToOrder*;
+ DeviceDetectionServiceIf::*;
+ LoggerServiceIf::*;
+ Process::*;
+ Timer::*;
+ TimerCtrl::*;
+ };
+ local:
+ *;
+};
+
diff --git a/video_in_hal/systemservice/interface_unified/library/src/makefile_PosixBasedOS001 b/video_in_hal/systemservice/interface_unified/library/src/makefile_PosixBasedOS001
new file mode 100755
index 0000000..68fa52e
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/makefile_PosixBasedOS001
@@ -0,0 +1,180 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Standard Module Makefile version 2.0
+#
+
+# Name of the componet (team/domain prefix '_' component name)
+COMPONENT_NAME = SS_PowerServiceIf
+
+ifndef PRJ_ROOT
+export PRJ_ROOT = $(CURDIR)/../
+endif
+include $(PRJ_ROOT)cfg/depends.mk
+
+# Additive Compile Flags (Flags from initiating make process will still apply)
+DEFS +=
+
+# Set local includes and then the reference includes (priority order determines search path)
+# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
+# dependencies includes (other teams)
+# Local (current component references should be in the form of
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
+# Example your public include directory would be
+# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+# Team references should only be to other's public includes such as
+# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
+# Global (non-team) references should be only to other's public includes such
+# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
+INCLUDES = \
+ $(CFG_INCS) \
+ $(CC_IFLAG)./ \
+ $(DEPENDS_INCLUDES) \
+ $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
+
+
+# Define binary outputs. These can be libraries or executables.
+# Name a variable for each deliverable. Suffixes should be
+# EXEC - For Executables -> output to the bin directory
+#TIME_EXEC = $(BIN_PATH)time
+# LIB - For Static Libraries -> output to lib directory with specific naming
+#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
+# SLIB - For Shared Objects
+#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
+# LIB - Define the static library for Message Queue
+#
+#
+##COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+ifdef DYNAMIC_OFF
+ COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
+else
+ COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
+endif
+
+## Sources Section
+# Define Library & Executable Sources (on a per deliverable basis)
+# This includes sources located in subdirectories.
+# Define generic line that pulls all c, cc, cpp files
+# since your in the src folder is pull only files from there
+COMPONENT_SRCS = \
+ $(wildcard *.c) \
+ $(wildcard *.cpp)
+
+# Define sources that my not be local to your component
+# here, you can define indivial files or wildcard from
+# a different folder.
+NON_LOCAL_SRCS = \
+
+
+# List of all sources to be built. Can be assembled from the other defintitions.
+# This only defines sources for the current directory, so if there are subdirectories
+# those are not included. (Those are found in simple subdirectory makefiles that only
+# direct the building of sources, but no linking into a binary)
+SOURCES = \
+ $(COMPONENT_SRCS) \
+ $(NON_LOCAL_SRCS) \
+
+
+
+#
+# Convert the source files to object files with correct folder location.
+#
+#
+C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
+CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
+
+
+# List of all sources to be generated. Can be assembled from the other defintitions.
+OBJECTS = \
+ $(C_LANG_OBJECTS) \
+ $(CPP_LANG_OBJECTS)
+
+
+
+# All headers that are dependencies. Wildcard is easy to pickup local headers.
+# This is only to automate the rebuilding, all builds on the servers are cleans
+# So this is not a huge deal when building on a component level.
+HEADERS = \
+ $(wildcard *.h) \
+ $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
+
+
+LIBRARIES = \
+ $(COMPONENT_LIB) \
+
+
+# Make targets
+# Standard
+all: banner module_dirs subdirs local library binary
+
+debug:
+ $(MAKE) TARGET=arm DEBUG=TRUE all
+
+base: banner module_dirs subdirs local
+
+# Standard Building of Source Files (Default builds for all objects defined above)
+$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CC_CMD)
+
+$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
+ $(CPP_CMD)
+
+local: $(OBJECTS)
+
+# Defines specific for each deliverable
+
+# For a static library
+$(COMPONENT_LIB): $(OBJECTS)
+ifdef DYNAMIC_OFF
+# For a dynamic library
+ $(SLIB_CMD)
+else
+# For a static library
+ $(AR_CMD)
+endif
+
+# Standard set of derived targets
+library: base \
+ $(LIBRARIES)
+ @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
+
+binary: base \
+ $(BINARIES)
+
+# Subdirs should be to jump to subdirectories
+# standard form is of
+# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
+subdirs:
+
+clean:
+ -rm -f $(BINARIES)
+ -rm -f $(LIBRARIES)
+ -rm -f $(OBJECTS)
+ -rm -f $(COMPONENT_LIB).map
+ -rm -f $(COMPONENT_LIB).debug
+
+-v:
+ @echo "objs: --> $(OBJECTS)"
+ @echo "sources: --> $(SOURCES)"
+ @echo "headers: --> $(HEADERS)"
+ @echo "includes: --> $(INCLUDES)"
+ @echo "lib: --> $(LIBRARIES)"
+ @echo "bin: --> $(BINARIES)"
+
+
+module_dirs: build_dirs
+
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_devicedetection_service_ifc.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_devicedetection_service_ifc.cpp
new file mode 100755
index 0000000..1f68df6
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_devicedetection_service_ifc.cpp
@@ -0,0 +1,673 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_DeviceDetection
+/// \brief This file contains service interface functions.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_devicedetection_service_ifc.h"
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <string.h>
+
+#ifdef AGL_STUB
+#else
+#include "dcmd_sim_mmcsd.h"
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#ifdef AGL_STUB
+#else
+#include <sys/dcmd_cam.h>
+#endif
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <linux/cdrom.h>
+#include <asm-generic/param.h>
+
+#include "system_service/ss_services.h"
+#include "system_service/ss_devicedetection_service_protocol.h"
+#include "system_service/ss_devicedetection_service_protocol_local.h"
+#include "system_service/ss_devicedetection_service_notifications.h"
+#include "system_service/ss_devicedetection_service_local.h"
+#include "system_service/ss_devicedetection_service_types_local.h"
+#include "ss_devicedetection_service_if_interfaceunifiedlog.h"
+
+DeviceDetectionServiceIf::DeviceDetectionServiceIf()
+ : m_hApp(NULL),
+ m_hService(NULL),
+ m_hSession(NULL) {
+}
+
+DeviceDetectionServiceIf::~DeviceDetectionServiceIf() {
+ CloseSessionRequest(); // if the session is still connected
+ if ((NULL != m_hApp) && (NULL != m_hService)) {
+ FrameworkunifiedCloseService(m_hApp, m_hService);
+ }
+ m_hService = NULL;
+ m_hSession = NULL;
+ m_hApp = NULL;
+} // LCOV_EXCL_BR_LINE 10:Because destructor
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::NotifyOnDeviceDetectionAvailability(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ // Subscriptions
+ FrameworkunifiedNotificationCallbackHandler
+ g_aryDeviceDetect_Notif_Cbs[] = {
+ // Notifications name, Call back function
+ { NTFY_SS_Device_Detection_Service_Availability, f_pCallBackFn},
+ };
+
+ if (0 != strcmp(SS_DEV_DETECT_SRV, FrameworkunifiedGetAppName(m_hApp))) {
+ // Subscribe and attach call backs to notifications
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedSubscribeNotificationsWithCallback(
+ m_hApp, g_aryDeviceDetect_Notif_Cbs,
+ _countof(g_aryDeviceDetect_Notif_Cbs)))) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error: FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::DetachDeviceDetectionAvailabilityCb() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp) {
+ if (0 != strcmp(SS_DEV_DETECT_SRV, FrameworkunifiedGetAppName(m_hApp))) {
+ // Unsubscribe and detach call backs to notifications
+ if (eFrameworkunifiedStatusOK != (eStatus =
+ FrameworkunifiedUnsubscribeNotificationWithCallback(m_hApp, NTFY_SS_Device_Detection_Service_Availability))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: InterfaceunifiedDetachNotificationCallback Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::NotifyOnOpenSessionAck(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ PROTOCOL_OPEN_SESSION_ACK,
+ f_pCallBackFn))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::DetachOpenSessionAckCb() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ PROTOCOL_OPEN_SESSION_ACK))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedDetachCallbackFromDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::NotifyOnCloseSessionAck(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ PROTOCOL_CLOSE_SESSION_ACK,
+ f_pCallBackFn))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::DetachCloseSessionAckCb() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hApp) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(
+ m_hApp,
+ SS_DEV_DETECT_SRV,
+ PROTOCOL_CLOSE_SESSION_ACK))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedDetachCallbackFromDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::RegisterForDeviceDetectionEvent(
+ SS_DeviceDetectionServerEvents f_eDevDetectEvent, CbFuncPtr f_pCallBackFn,
+ PCSTR pFilepath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ char l_filepathname[FILEPATH_SIZE] = { '\0' };
+ int len = 0;
+
+ if (NULL != pFilepath) {
+ len = strlen(pFilepath);
+ strcpy(l_filepathname, pFilepath); // NOLINT (runtime/printf)
+ }
+
+ if (NULL != m_hSession && NULL != f_pCallBackFn) {
+ if (CheckDetectEvent(f_eDevDetectEvent)) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ f_eDevDetectEvent,
+ f_pCallBackFn, m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+
+ eStatus = FrameworkunifiedSendMsg(m_hSession, SS_REGISTER_DETECT_EVENT,
+ sizeof(SS_DeviceDetectionServerEvents),
+ &f_eDevDetectEvent);
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ f_eDevDetectEvent,
+ f_pCallBackFn, m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+
+ // client registers for the event
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedRegisterEvent(m_hSession, f_eDevDetectEvent))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedRegisterEvents Failed Status:0x%x", eStatus);
+ }
+
+ if (NULL != pFilepath) {
+ eStatus = FrameworkunifiedSendMsg(m_hSession, SS_REGISTER_FILEPATHNAME, len,
+ l_filepathname);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::UnRegisterForDeviceDetectionEvent(
+ SS_DeviceDetectionServerEvents f_eDevDetectEvent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(m_hApp,
+ SS_DEV_DETECT_SRV,
+ f_eDevDetectEvent,
+ m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: InterfaceunifiedDetachCallbackToDispatcher Failed Status:0x%x ", eStatus);
+ }
+
+ // client registers for the event
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedUnRegisterEvent(m_hSession, f_eDevDetectEvent))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedUnRegisterEvents Failed Status:0x%x", eStatus);
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(m_hSession, SS_UNREGISTER_DETECT_EVENT,
+ sizeof(SS_DeviceDetectionServerEvents),
+ &f_eDevDetectEvent))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "UnRegister Detect Event[0x%x] Send Error[0x%x]", f_eDevDetectEvent, eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+BOOL DeviceDetectionServiceIf::Initialize(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_eStatus = TRUE;
+
+ if (NULL != hApp) {
+ m_hApp = hApp;
+ } else {
+ l_eStatus = FALSE; // eFrameworkunifiedStatusInvldHandle;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::OpenSessionRequest() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp) {
+ // if the session is there then we need to close it first!
+ if (NULL != m_hService) {
+ CloseSessionRequest();
+ FrameworkunifiedCloseService(m_hApp, m_hService);
+ m_hService = NULL;
+ }
+ BOOL l_bServiceAvailable = FrameworkunifiedIsServiceAvailable(m_hApp);
+ if (FALSE == l_bServiceAvailable) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "DeviceError: Service is unavailable");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // Now open the service.
+ if (l_bServiceAvailable
+ && (NULL != (m_hService = OpenService()))) { // LCOV_EXCL_BR_LINE 8:Because l_bServiceAvailable is always TRUE
+ // [DM: TODO] Check if we need to open a session with some data sent to Server.
+ UI_32 l_pTestData = 1;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedOpenSessionWithData(m_hService,
+ (PVOID) &l_pTestData,
+ sizeof(UI_32)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: FrameworkunifiedOpenSessionWithData Failed");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: FrameworkunifiedOpenService Failed");
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: OpenSessionRequest Failed %X",
+ l_eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+HANDLE DeviceDetectionServiceIf::OpenService() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ HANDLE l_hService = NULL;
+
+ if (NULL == (l_hService = FrameworkunifiedOpenService(m_hApp, SS_DEV_DETECT_SRV))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: FrameworkunifiedOpenService : Failed to open Device Detection Service");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_hService;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::DecodeOpenSessionResponse() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hApp) { // LCOV_EXCL_BR_LINE 8:Because when m_hApp is NULL, m_hService is NULL
+ if (NULL == (m_hSession = FrameworkunifiedGetOpenSessionHandle(m_hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error: Error in extracting OpenSessionAck response.");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Logger Session Name: %s, Session Id: %d",
+ FrameworkunifiedGetSessionName(m_hSession), FrameworkunifiedGetSessionId(m_hSession));
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error. m_hService: %p, m_hApp: %p is NULL. Open session handle not acquired,"
+ " l_eStatus: eFrameworkunifiedStatusInvldHandle.", m_hService, m_hApp);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::CloseSessionRequest() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseSession(m_hService, m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedCloseSession Failed");
+ }
+ m_hSession = NULL; // clear our session handle
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+BOOL DeviceDetectionServiceIf::CheckDetectEvent(
+ SS_DeviceDetectionServerEvents f_eDevDetectEvent) {
+ BOOL chkevt = FALSE;
+
+ switch (f_eDevDetectEvent) {
+ case SS_DEV_INFO_ANY_USB_EV:
+ case SS_DEV_DETECT_ANY_USB_EV:
+ case SS_DEV_DETECT_ANY_SD_EV:
+ case SS_DEV_DETECT_ANY_DISC_EV:
+ case SS_DEV_DETECT_ANY_USB_NCM_EV:
+
+ case SS_DEV_DETECT_ANY_USB_DCM_NCM_EV:
+ case SS_DEV_DETECT_ANY_USB__CWORD57__EV:
+ case SS_DEV_DETECT_ANY_USB_ACM_EV:
+ case SS_DEV_DETECT_ANY_USB_DEV_MNG_EV:
+ case SS_DEV_DETECT_ANY_USB_VEHICLE_CTRL_EV:
+ case SS_DEV_DETECT_ANY_USB_DSRC_APP_EV:
+ case SS_DEV_DETECT_ANY_USB_DSRC_CTRL_EV:
+ case SS_DEV_DETECT_ANY_USB_IR_VICS_DATA_EV:
+ case SS_DEV_ERR_USB_OVER_CURRENT_EV:
+ case SS_DEV_DETECT_ANY_USB_MTP_EV:
+ case SS_DEV_INFO_ANY_USB_NOTIFY_EV:
+ case SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV:
+ case SS_DEV_INFO_SD_FORMAT_COMP_EV:
+ case SS_DEV_INFO_ANY_USB_DVDP_EV:
+ chkevt = TRUE;
+ break;
+ default:
+ break;
+ }
+ return chkevt;
+}
+
+static void ReadString(const char *file, char *buf, int len) {
+ int fd;
+ ssize_t r;
+ char *tmp;
+
+ if (file == NULL) { // LCOV_EXCL_BR_LINE 8:Because file is not NULL
+ // LCOV_EXCL_START 8:Because file is not NULL
+ buf[0] = '\0';
+ return;
+ // LCOV_EXCL_STOP
+ }
+
+ fd = open(file, O_RDONLY);
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 6:Because the sequence at the time of open failure cannot be passed
+ // LCOV_EXCL_START 6:Because the sequence at the time of open failure cannot be passed
+ buf[0] = '\0';
+ return;
+ // LCOV_EXCL_STOP
+ }
+
+ r = read(fd, buf, len);
+ close(fd);
+ if (r > 0 && r < len) {
+ buf[r] = '\0';
+ r--;
+ /* If there is a line feed code'\n' at the end of the acquired data, replace it with '\0' */
+ while (buf[r] == '\n') {
+ buf[r] = '\0';
+ if (r == 0)
+ break;
+ r--;
+ }
+ /* If there is a line feed code'\n' in the middle of the acquired data, replace with '\0' */
+ tmp = buf;
+ while ((tmp = strchr(tmp, '\n')) != NULL) {
+ *tmp = ' ';
+ tmp++;
+ }
+ return;
+ } else {
+ buf[0] = '\0';
+ }
+}
+
+static bool isMounttedDir(char* pMountDir) {
+ char buf[4096];
+
+ if (!pMountDir) { // LCOV_EXCL_BR_LINE 8:Because pMountDir is not NULL
+ // LCOV_EXCL_START 8:Because pMountDir is not NULL
+ return false;
+ // LCOV_EXCL_STOP
+ }
+
+ ReadString("/proc/mounts", buf, sizeof(buf));
+ if (strstr(buf, pMountDir)) { // The mount folder is already in use as a mount point
+ return true;
+ }
+
+ return false;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::MountSD(uint8_t part_num,
+ BOOL *already_mounted) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "part_num %d", part_num);
+
+ if (NULL == m_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_hSession is NULL");
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ if (part_num > 3) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ char mount_dir[256];
+ if (part_num != 0) {
+ sprintf(mount_dir, "/mnt/mmcblk1p%d", part_num); // NOLINT (runtime/printf)
+ } else {
+ sprintf(mount_dir, "/mnt/mmcblk1"); // NOLINT (runtime/printf)
+ }
+ if (isMounttedDir(mount_dir)) {
+ *already_mounted = TRUE;
+ return eFrameworkunifiedStatusOK;
+ } else {
+ *already_mounted = FALSE;
+ }
+
+ char filename[256];
+ struct stat st;
+ if (part_num != 0) {
+ sprintf(filename, "/dev/mmcblk1p%d", part_num); // NOLINT (runtime/printf)
+ } else {
+ sprintf(filename, "/dev/mmcblk1"); // NOLINT (runtime/printf)
+ }
+ if (stat(filename, &st) != 0) {
+ return eFrameworkunifiedStatusAccessError;
+ }
+
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedSendMsg(m_hSession, SS_DEV_MOUNT_SD, sizeof(uint8_t),
+ &part_num))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Send MountSD msg Sucessfully");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::UmountSD(uint8_t part_num,
+ BOOL *already_umounted) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "part_num %d", part_num);
+
+ if (NULL == m_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_hSession is NULL");
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ if (part_num > 3) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ char mount_dir[256];
+ if (part_num != 0) {
+ sprintf(mount_dir, "/mnt/mmcblk1p%d", part_num); // NOLINT (runtime/printf)
+ } else {
+ sprintf(mount_dir, "/mnt/mmcblk1"); // NOLINT (runtime/printf)
+ }
+
+ if (isMounttedDir(mount_dir)) {
+ *already_umounted = FALSE;
+ } else {
+ *already_umounted = TRUE;
+ return eFrameworkunifiedStatusOK;
+ }
+
+ char filename[256];
+ struct stat st;
+
+ if (part_num != 0) {
+ sprintf(filename, "/dev/mmcblk1p%d", part_num); // NOLINT (runtime/printf)
+ } else {
+ sprintf(filename, "/dev/mmcblk1"); // NOLINT (runtime/printf)
+ }
+ if (stat(filename, &st) != 0) {
+ return eFrameworkunifiedStatusAccessError;
+ }
+
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedSendMsg(m_hSession, SS_DEV_UMOUNT_SD, sizeof(uint8_t),
+ &part_num))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Send UmountSD msg Sucessfully");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
+
+static const uint8_t VBUS_RESET_INTERVAL_MIN = 11;
+
+static EFrameworkunifiedStatus SendUsbVBusResetMsg(HANDLE handle, int8_t port, uint8_t interval) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == handle) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __func__, "Invalid Handle.");
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ int16_t data[] = {port, interval};
+ eStatus = FrameworkunifiedSendMsg(handle, SS_USB_VBUS_RESET, sizeof(data), data);
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Send Error[0x%x]", eStatus);
+ return eStatus;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::UsbVBusReset(int8_t port, uint8_t interval) {
+ return SendUsbVBusResetMsg(m_hSession, port, interval);
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::UsbVBusReset(int8_t port) {
+ return SendUsbVBusResetMsg(m_hSession, port, VBUS_RESET_INTERVAL_MIN);
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::RoleSwStateNotify(
+ SS_DEV_ROLE_SW_STATE state) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ EFrameworkunifiedStatus result = eFrameworkunifiedStatusFail;
+ UI_32 rcvlength = 0;
+ UI_32 bufflength;
+
+ if (NULL == m_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "No Session");
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ bufflength = sizeof(EFrameworkunifiedStatus);
+ eStatus = FrameworkunifiedInvokeSync(m_hSession, SS_DEV_ROLE_SW_STATE_NOTIFY,
+ sizeof(SS_DEV_ROLE_SW_STATE), &state, bufflength,
+ &result, &rcvlength);
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Send Error[0x%x]", eStatus);
+ return eStatus;
+ }
+
+ if (bufflength != rcvlength) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedInvokeSync Response Error. bufflen[%d], rcvlen[%d]", bufflength,
+ rcvlength);
+ return eStatus;
+ }
+
+ eStatus = result;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus DeviceDetectionServiceIf::FormatSD(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == m_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid Handle.");
+ return eFrameworkunifiedStatusInvldHandle;
+ }
+
+ if (access("/dev/mmcblk1", F_OK) != 0) {
+ return eFrameworkunifiedStatusAccessError;
+ }
+
+ eStatus = FrameworkunifiedSendMsg(m_hSession, SS_DEV_FORMAT_SD, 0, NULL);
+
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Send Error[0x%x]", eStatus);
+ return eStatus;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+} // LCOV_EXCL_BR_LINE 10:Because the last line
+
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_framework_if.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_framework_if.cpp
new file mode 100755
index 0000000..91d323a
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_framework_if.cpp
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager AGL framework
+/// interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <string.h>
+#include "system_service/ss_system_if.h"
+#include "system_service/interfaceunified_system_application.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_test_clients.h"
+#include "system_service/ss_templates.h"
+#include "ss_system_if_interfaceunifiedlog.h"
+
+HANDLE g_SystemIf_hApp = NULL;
+
+EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ g_SystemIf_hApp = hApp;
+ PCSTR pAppNameStr = FrameworkunifiedGetAppName(hApp);
+
+ if (0 != strcmp(SERVICE_SYSMANAGER, pAppNameStr) &&
+ 0 != strcmp(TC_Power, pAppNameStr)) {
+ l_eStatus = InterfaceunifiedSystemConnectToSystemManagerService(hApp);
+ LOG_STATUS(l_eStatus, "InterfaceunifiedSystemConnectToSystemManagerService()");
+
+ if (0 != strcmp(TC_SysManager, pAppNameStr)) {
+ l_eStatus = InterfaceunifiedSystemConnectToHeartBeatService(hApp);
+ LOG_STATUS(l_eStatus, "InterfaceunifiedSystemConnectToHeartBeatService()");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // LCOV_EXCL_BR_LINE 10:Because the last line
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_heartbeat_client.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_heartbeat_client.cpp
new file mode 100755
index 0000000..a080e9a
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_heartbeat_client.cpp
@@ -0,0 +1,156 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager client
+/// heartbeat service interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <new>
+#include "system_service/ss_heartbeat_service_protocol.h"
+#include "system_service/ss_heartbeat_notifications.h"
+#include "system_service/ss_heartbeat_if.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_sm_thread_names.h"
+#include "system_service/ss_templates.h"
+#include "ss_system_if_interfaceunifiedlog.h"
+
+CHeartBeatServiceIf * pHeartBeatServiceIf = NULL;
+
+template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)>
+
+// LCOV_EXCL_START 6:Because process initialization
+EFrameworkunifiedStatus HeartBeatIfCallback(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNullPointer;
+ C * pObj = static_cast<C *>(pHeartBeatServiceIf);
+ if (pObj) {
+ l_eStatus = (pObj->*M)(hApp);
+ }
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: InterfaceunifiedSystemConnectToHeartBeatService
+ @note: . Called from framework for every app to start connection to HeartBeat
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+*****************************************************************************/
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToHeartBeatService(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ /// Avoid opening a session to the HeartBeat
+ /// service Since it uses the framework as well
+ /// Avoid opening a session to System Manager For testing
+ // TODO(my_username): Remove system manager check
+ if ((0 != strcmp(SERVICE_SYSMANAGER, FrameworkunifiedGetAppName(hApp)))) {
+ FrameworkunifiedProtocolCallbackHandler g_aryHeartBeat_Protocol_Cbs[] = {
+ // Command ID, Call back functions
+ { SS_HEARTBEAT_REQUEST, HeartBeatIfCallback<CHeartBeatServiceIf, &CHeartBeatServiceIf::OnHeartBeatRequest>}
+ }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ /// Attach the valid callback for this service
+ if ( eFrameworkunifiedStatusOK != // LCOV_EXCL_BR_LINE 6:Because process initialization
+ (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hApp,
+ SS_SMHeartbeat,
+ g_aryHeartBeat_Protocol_Cbs,
+ _countof(g_aryHeartBeat_Protocol_Cbs)))) {
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher()");
+ } else {
+ // LCOV_EXCL_BR_LINE 5:Because constructor
+ pHeartBeatServiceIf =
+ new(std::nothrow) CHeartBeatServiceIf(FALSE, NULL, FrameworkunifiedGetAppName(hApp));
+ } // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Heartbeat service name duplicated.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_eStatus; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: CHeartBeatServiceIf constructor
+ @param -
+*****************************************************************************/
+CHeartBeatServiceIf::CHeartBeatServiceIf(BOOL avail, HANDLE service, PCSTR name) {
+ g_tHeartBeatSession.szServiceName = name; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ g_tHeartBeatSession.fAvailable = avail;
+ g_tHeartBeatSession.hService = service;
+}
+
+// LCOV_EXCL_START 10:Because destructor
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: CHeartBeatServiceIf destructor
+*****************************************************************************/
+CHeartBeatServiceIf::~CHeartBeatServiceIf() {
+ if (pHeartBeatServiceIf != NULL) {
+ delete pHeartBeatServiceIf;
+ pHeartBeatServiceIf = NULL;
+ }
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 6:Because process initialization
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: OnHeartBeatRequest
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatServiceIf::OnHeartBeatRequest(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_availability;
+
+ if (g_tHeartBeatSession.hService == NULL) {
+ if ( NULL == (g_tHeartBeatSession.hService = FrameworkunifiedMcOpenSender(hApp, SS_SMHeartbeat)) ) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedMcOpenSender(%s) returned NULL",
+ SS_SMHeartbeat);
+ return l_eStatus;
+ }
+ }
+
+ if ( (0 == strcmp(SS_SMHeartbeat, FrameworkunifiedGetMsgSrc(hApp))) ) {
+ if (NULL != g_tHeartBeatSession.hService) {
+ l_availability = FrameworkunifiedGetSelfAvailability(hApp);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(g_tHeartBeatSession.hService, SS_HEARTBEAT_RESPONSE,
+ sizeof(l_availability), &l_availability))) {
+ LOG_ERROR("FrameworkunifiedSendMsg");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid handle[_g_hHeartBeatSessionHandle = :NULL]");
+ }
+ }
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_last_to_order.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_last_to_order.cpp
new file mode 100755
index 0000000..140101f
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_last_to_order.cpp
@@ -0,0 +1,186 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <agl_wakeup_order.h>
+#include <list>
+#include <fstream>
+#include <iostream>
+#include <stdexcept>
+#include <string>
+#include "system_service/ss_last_to_order.h"
+#include "ss_last_to_order_local.h"
+
+#include "system_service/ss_templates.h"
+#include "ss_system_if_interfaceunifiedlog.h"
+#define SCO_STATE_LOG(...) FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, __VA_ARGS__);
+#define SCO_ERROR_LOG(...) FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, __VA_ARGS__);
+#define SCO_ASSERT(x) SS_ASERT(x);
+
+//************* CONFIG FILE Format ****************
+#define ORDERNAME_MAX 64
+#define CONTENT_NAME_MAX 128
+#pragma pack(push, 1)
+typedef struct {
+ char lastinfo[SS_CCAT_MAX][CONTENT_NAME_MAX];
+ char orderName[ORDERNAME_MAX];
+}SS_LASTINFO_TO_OEDER_PACKED_t;
+#pragma pack(pop)
+//*************************************************
+
+
+typedef struct {
+ SS_LAST_INFO_t lastinfo;
+ std::string orderName;
+}SS_LASTINFO_TO_OEDER_t;
+
+
+
+//****************************
+// load configuration file
+//****************************
+static int
+loadConfig(std::string &cfgPath, std::list<SS_LASTINFO_TO_OEDER_t> *p_cfgList) throw() { // NOLINT (runtime/references)
+ int ret = 0;
+
+ try {
+ std::ifstream fin(cfgPath.c_str(), std::ios::in | std::ios::binary);
+ if (!fin) {
+ SCO_ERROR_LOG("cfg file error %s", cfgPath.c_str());
+ throw std::domain_error("open error");
+ }
+ char magic[4];
+
+ fin.read(reinterpret_cast<char*>(&magic), sizeof(magic));
+ if (fin.fail()) {
+ throw std::domain_error("read magic");
+ }
+
+ if (memcmp(magic, "CTOO", sizeof(magic)) != 0) {
+ throw std::domain_error("magic error");
+ }
+
+ uint32_t numOfElement = 0;
+ fin.read(reinterpret_cast<char*>(&numOfElement), sizeof(numOfElement));
+ if ( fin.fail() ) {
+ throw std::domain_error("read numOfElement");
+ }
+
+ for (uint32_t ii = 0; ii < numOfElement; ii++) {
+ SS_LASTINFO_TO_OEDER_PACKED_t element;
+ fin.read(reinterpret_cast<char*>(&element), sizeof(element));
+ if ( fin.fail() ) {
+ throw std::domain_error("read element");
+ }
+ SS_LASTINFO_TO_OEDER_t tmp;
+ tmp.lastinfo[SS_CCAT_F_VIDEO] = element.lastinfo[SS_CCAT_F_VIDEO];
+ tmp.lastinfo[SS_CCAT_F_SUB_VIDEO] = element.lastinfo[SS_CCAT_F_SUB_VIDEO];
+ tmp.lastinfo[SS_CCAT_F_AUDIO] = element.lastinfo[SS_CCAT_F_AUDIO];
+ tmp.lastinfo[SS_CCAT_R_VIDEO] = element.lastinfo[SS_CCAT_R_VIDEO];
+ tmp.lastinfo[SS_CCAT_R_AUDIO] = element.lastinfo[SS_CCAT_R_AUDIO];
+ tmp.orderName = element.orderName;
+ p_cfgList->push_back(tmp);
+ }
+ SCO_STATE_LOG("%s is loaded", cfgPath.c_str());
+ } catch (std::exception &e) {
+ if (ret == 0) ret = -1;
+ SCO_ERROR_LOG("%s", e.what());
+ SCO_ASSERT(0);
+ } catch (...) {
+ SCO_ASSERT(0);
+ ret = -1;
+ }
+ return ret;
+}
+
+
+
+static
+bool
+isPassCondition(SS_CONT_CATEGORY_t cat, SS_LAST_INFO_t &lastInfo, SS_LASTINFO_TO_OEDER_t &tblElement) { // NOLINT (runtime/references)
+ std::string &tblStr = tblElement.lastinfo[cat];
+
+ if (tblStr != "EMPTY") {
+ //Category with content specification
+ SS_LAST_INFO_t::iterator iteCont = lastInfo.find(cat);
+ if (iteCont == lastInfo.end() || iteCont->second != tblStr) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
+
+//****************************
+// SS_ConvLastInfoToOrder
+//****************************
+EFrameworkunifiedStatus
+SS_ConvLastInfoToOrder(SS_LAST_INFO_t &curInfo, std::string &order, const char* p_cfgPath/* = NULL*/) { // NOLINT (runtime/references)
+ std::string cfgPath = (p_cfgPath) ? p_cfgPath : SS_LAST_TO_ORDER_CONF_PATH;
+
+ static std::list<SS_LASTINFO_TO_OEDER_t> s_convList;
+ static std::string s_readCfgPath = "__default__";
+ bool isHit = false;
+
+ // If the same CONFIG, do not READ after the second.
+ if (s_readCfgPath != cfgPath) {
+ int ret;
+ s_convList.clear();
+
+ ret = loadConfig(cfgPath, &s_convList);
+ if (ret != 0) { goto ERROR; }
+ s_readCfgPath = cfgPath;
+
+#if 0 // DEBUG
+ for (std::list<SS_LASTINFO_TO_OEDER_PACKED_t>::iterator tblElt = s_convList.begin();
+ tblElt != s_convList.end();
+ tblElt++) {
+ SCO_STATE_LOG("FV:%s FSV:%s FA:%s RV:%s RA:%s O:%s",
+ tblElt->lastinfo[SS_CCAT_F_VIDEO], tblElt->lastinfo[SS_CCAT_F_SUB_VIDEO], tblElt->lastinfo[SS_CCAT_F_AUDIO],
+ tblElt->lastinfo[SS_CCAT_R_VIDEO], tblElt->lastinfo[SS_CCAT_R_AUDIO], tblElt->orderName);
+ }
+#endif
+ }
+
+ for (std::list<SS_LASTINFO_TO_OEDER_t>::iterator tblElt = s_convList.begin();
+ tblElt != s_convList.end();
+ tblElt++) {
+ if (isPassCondition(SS_CCAT_F_VIDEO , curInfo, *tblElt) == false) {
+ continue;
+ } else if (isPassCondition(SS_CCAT_F_SUB_VIDEO, curInfo, *tblElt) == false) {
+ continue;
+ } else if (isPassCondition(SS_CCAT_F_AUDIO , curInfo, *tblElt) == false) {
+ continue;
+ } else if (isPassCondition(SS_CCAT_R_VIDEO , curInfo, *tblElt) == false) {
+ continue;
+ } else if (isPassCondition(SS_CCAT_R_AUDIO , curInfo, *tblElt) == false) {
+ continue;
+ }
+
+ isHit = true;
+ order = tblElt->orderName;
+ break;
+ }
+ if (!isHit) {
+ order = WON_DEFAULT;
+ }
+ return eFrameworkunifiedStatusOK;
+ERROR:
+ return eFrameworkunifiedStatusFail;
+}
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_logger_service_ifc.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_logger_service_ifc.cpp
new file mode 100755
index 0000000..1766bfa
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_logger_service_ifc.cpp
@@ -0,0 +1,781 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_Logger
+/// \brief This file supports the _CWORD77_ logger service.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_logger_service_ifc.h"
+#include <string.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <string>
+#include "system_service/ss_logger_service_protocol.h"
+#include "system_service/ss_logger_service_notifications.h"
+#include "system_service/ss_logger_service.h"
+#include "system_service/ss_logger_service_local.h"
+#include "system_service/ss_services.h"
+#include "ss_logger_service_if_interfaceunifiedlog.h"
+
+LoggerServiceIf::LoggerServiceIf()
+ : m_hApp(NULL),
+ m_hService(NULL),
+ m_hSession(NULL) {
+}
+
+LoggerServiceIf::~LoggerServiceIf() {
+ CloseSessionRequest(); // if the session is still connected
+
+ m_hService = NULL;
+ m_hSession = NULL;
+ m_hApp = NULL;
+} // LCOV_EXCL_BR_LINE 10:Because destructor
+
+EFrameworkunifiedStatus LoggerServiceIf::NotifyOnLoggerServiceAvailability(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ // Subscriptions
+ FrameworkunifiedNotificationCallbackHandler g_aryLogger_Notif_Cbs[] = {
+ // Notifications name, Call back function
+ { NTFY_SS_LoggerService_Availability, f_pCallBackFn }, };
+
+ if (0 != strcmp(SERVICE_LOGGER, FrameworkunifiedGetAppName(m_hApp))) {
+ // Subscribe and attach call backs to notifications
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedSubscribeNotificationsWithCallback(
+ m_hApp, g_aryLogger_Notif_Cbs, _countof(g_aryLogger_Notif_Cbs)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::NotifyOnOpenSessionAck(CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SERVICE_LOGGER,
+ PROTOCOL_OPEN_SESSION_ACK,
+ f_pCallBackFn))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::NotifyOnCloseSessionAck(CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hApp && NULL != f_pCallBackFn) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SERVICE_LOGGER,
+ PROTOCOL_CLOSE_SESSION_ACK,
+ f_pCallBackFn))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+BOOL LoggerServiceIf::Initialize(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_eStatus = TRUE;
+
+ if (NULL != hApp) {
+ m_hApp = hApp;
+ } else {
+ l_eStatus = FALSE; // eFrameworkunifiedStatusInvldHandle;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::OpenSessionRequest() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ if (NULL != m_hApp) {
+ // if the session is there then we need to close it first!
+ if (NULL != m_hService) {
+ CloseSessionRequest();
+ m_hService = NULL;
+ }
+ BOOL l_bServiceAvailable = FrameworkunifiedIsServiceAvailable(m_hApp);
+ if (FALSE == l_bServiceAvailable) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Service is unavailable");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // Now open the service.
+ if (l_bServiceAvailable
+ && (NULL != (m_hService = OpenService()))) { // LCOV_EXCL_BR_LINE 8:Because bServiceAvailable is always TRUE
+ // [DM: TODO] Check if we need to open a session with some data sent to Server.
+ UI_32 l_pTestData = 1;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedOpenSessionWithData(m_hService,
+ (PVOID) &l_pTestData,
+ sizeof(UI_32)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "FrameworkunifiedOpenSessionWithData Failed, errval :%d", l_eStatus);
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "FrameworkunifiedOpenService Failed, errval :%d", l_eStatus);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+HANDLE LoggerServiceIf::OpenService() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ HANDLE l_hService = NULL;
+
+ if (NULL == (l_hService = FrameworkunifiedOpenService(m_hApp, SERVICE_LOGGER))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "FrameworkunifiedOpenService : Failed to open Logger Service");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_hService;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::DecodeOpenSessionResponse() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ std::string l_strSessionName;
+ if (NULL != m_hService
+ && NULL != m_hApp) { // LCOV_EXCL_BR_LINE 8:Because there is no case where m_hApp is NULL and m_hService is not NULL
+ if (NULL == (m_hSession = FrameworkunifiedGetOpenSessionHandle(m_hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "Error in extracting OpenSessionAck response.");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ l_strSessionName = FrameworkunifiedGetSessionName(m_hSession);
+ if (l_strSessionName.empty()) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SessionName is empty");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (FrameworkunifiedSetSessionHandle(m_hApp, l_strSessionName.c_str(), m_hSession))) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSetSessionHandle() failed");
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::CloseSessionRequest() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseSession(m_hService, m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedCloseSession Failed");
+ }
+ m_hSession = NULL; // clear our session handle
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::RegisterForLoggerEvent(
+ SS_LoggerServerEvents f_eLoggerEvent, CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hSession && NULL != f_pCallBackFn) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
+ SERVICE_LOGGER,
+ f_eLoggerEvent,
+ f_pCallBackFn, m_hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus);
+ }
+
+ // client registers for the event
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedRegisterEvent(m_hSession, f_eLoggerEvent))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedRegisterEvents Failed Status:0x%x",
+ eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedRegisterEvents Status:0x%x", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::UnRegisterForLoggerEvent(
+ SS_LoggerServerEvents f_eLoggerEvent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hSession) {
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// SendDiagStat
+/// API to send CAN Diagnostic status data(it has mileage info) to Logger Service
+/// (Command: SS_LOGGER_MILEAGE_DATA)
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus LoggerServiceIf::SendDiagStat(STLOGGER_CANDIAGSTAT *pCanDiagStat_t) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ STLOGGER_CANDIAGSTAT l_candiagstat;
+
+ memcpy(&l_candiagstat, pCanDiagStat_t, sizeof(STLOGGER_CANDIAGSTAT));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Before Valid Session");
+ if (NULL != m_hService && NULL != m_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Entered Valid Session");
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_MILEAGE_DATA,
+ sizeof(STLOGGER_CANDIAGSTAT), &l_candiagstat))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Msg Send Successfully");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_CANGetCurrentDateAndTime
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_CANGetCurrentDateAndTime(
+ STCanCurrentDateTime stDateAndTime) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_DATETIME,
+ sizeof(stDateAndTime), &stDateAndTime))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_CANSetVIN
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_CANSetVIN(STVIN_NUMBER& stVinNumber) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ stVinNumber.VINstr[stVinNumber.VIN_LEN - 1] = '\0';
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_VIN,
+ sizeof(STVIN_NUMBER), &stVinNumber))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg() Failed with error: %X",
+ l_eStatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Service or Session Handle NULL");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// LoggerIf_SetLoggerParams
+/// API is to inform Logger Service about the device selected to store the logs
+/// and about Enable/Disable Logging.
+/// (Command: SS_LOGGER_SET_PARAMS)
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_SetLoggerParams(ELOGGER_STAT eLoggerStatus,
+ EDEV_TYPE eDevType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ STLoggerSetParams l_stLoggerParams;
+
+ l_stLoggerParams.Logger_State = eLoggerStatus;
+ l_stLoggerParams.Device_Type = eDevType;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_PARAMS,
+ sizeof(STLoggerSetParams), &l_stLoggerParams))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// LoggerIf_UDPLogging
+/// API is to inform Logger Service about UDP logging
+/// and about Enable/Disable Logging.
+/// (Command: SS_LOGGER_UDP_LOGGING)
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_UDPLogging(ELOGGER_STAT eLoggerStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_UDP_LOGGING,
+ sizeof(ELOGGER_STAT), &eLoggerStatus))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_ScreenCaptureEventACK(
+ STScreenCaptureEvt stScreenCaptureInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SCREENCAPTURE_EVT_ACK,
+ sizeof(stScreenCaptureInfo),
+ &stScreenCaptureInfo))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Screen shot ACK sent successfully.");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. m_hSession is NULL. Screen shot capture ACK not sent.");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_EventLoggingCommonInfo
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingCommonInfo(
+ STEventLoggerCommonInfo stEventCommonInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_EVENT_COMMONINFO,
+ sizeof(stEventCommonInfo),
+ &stEventCommonInfo))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_EventLoggingEventInfo
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingEventInfo(
+ STEventLoggerEventInfo stEventInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER__CWORD56__EVENT_INFO,
+ sizeof(stEventInfo), &stEventInfo))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_EventLoggingResetInfo
+/// (Command: SS_LOGGER__CWORD56__RESET_INFO)
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingResetInfo(
+ STEventLoggerResetInfo stResetInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER__CWORD56__RESET_INFO,
+ sizeof(stResetInfo), &stResetInfo))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_EventLoggingResetInfo
+/// (Command: SS_LOGGER_DIAGDTC_ACTIVE)
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_PersistEventLogOnActiveDTC(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_DIAGDTC_ACTIVE, 0x00,
+ NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_EventLoggingResetInfo
+/// (Command: SS_LOGGER_SHUTDOWN_COMPLETE)
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_Shutdown_Complete(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if (NULL != m_hService && NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SHUTDOWN_COMPLETE,
+ 0x00, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :StoreEventLogsToUSB
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::StoreEventLogsToUSB(
+ EEvtLogUSBDevNumber eUSBDevNumber) {
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Copy the Event logs in to USB command received:%X", eUSBDevNumber);
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCOPYEVENTUSB,
+ sizeof(EEvtLogUSBDevNumber), &eUSBDevNumber))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :StoreEmergencyErrorLogsToUSB
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::StoreEmergencyErrorLogsToUSB(
+ EDevNumber eDevNumber) {
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO, __FUNCTION__,
+ "Copy the Emergency Error logs in to External Device command received:%X",
+ eDevNumber);
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCOPYEMERGENCYLOGS,
+ sizeof(EDevNumber), &eDevNumber))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :ClearEventLogs
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::ClearEventLogs(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request for clearing the event logs");
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCLEAREVENT, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :ReadStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::ReadStatisticalCounter(
+ EStatCounterGroupID eCounterGroup) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Request to read the statistical counter for group ID:%X",
+ eCounterGroup);
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_READ_STATL_COUNTER,
+ sizeof(EStatCounterGroupID), &eCounterGroup))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :ReadStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::ResetStatisticalCounter(
+ EStatCounterGroupID eCounterGroup) {
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Request to reset the statistical counter for group ID:%X",
+ eCounterGroup);
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_RESET_STATL_COUNTER,
+ sizeof(EStatCounterGroupID), &eCounterGroup))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function LoggerServiceIf::StartDTCLoggingToEmmc
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::StartDTCLoggingToEmmc(UI_32 f_dtc) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request to start logging for DTC:0x%4X",
+ f_dtc);
+ l_eStatus = this->SendMessage(eSSLoggerCANProtocolIDDTCTrigger,
+ (UI_32) sizeof(f_dtc), &f_dtc);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function LoggerServiceIf::StartCANLogging
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::StartCANLogging(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request to start CAN logging.");
+ l_eStatus = this->SendMessage(eSSLoggerCANProtocolIDCANTrigger, 0, NULL);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function LoggerServiceIf::RegisterLoggingStartNotification
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::RegisterLoggingStartNotification(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == this->m_hApp) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == this->m_hApp)");
+ } else if (NULL == f_pCallBackFn) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == f_pCallBackFn)");
+ } else {
+ l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback(this->m_hApp,
+ eSSLoggerCANEventStart,
+ f_pCallBackFn,
+ this->m_hSession);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "FrameworkunifiedSubscribeToSessionEventWithCallback(eSSLoggerCANEventStart) returned %X",
+ l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function LoggerServiceIf::RegisterLoggingStartNotification
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::RegisterLoggingFinishNotification(
+ CbFuncPtr f_pCallBackFn) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == this->m_hApp) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == this->m_hApp)");
+ } else if (NULL == f_pCallBackFn) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == f_pCallBackFn)");
+ } else {
+ l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback(
+ this->m_hApp, eSSLoggerCANEventFinished, f_pCallBackFn,
+ this->m_hSession);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "FrameworkunifiedSubscribeToSessionEventWithCallback(eSSLoggerCANEventFinished) returned %X",
+ l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :SendMessage
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::SendMessage(UI_32 f_cmdID, UI_32 f_size,
+ void* f_pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
+
+ if ((NULL != m_hSession)
+ && ((f_pData != NULL) || (f_size == 0))) { // LCOV_EXCL_BR_LINE 8:Because there is no case where f_pData is NULL and f_size is not 0
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, f_cmdID, f_size, f_pData))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_SetDiagID
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_SetDiagID(UI_16 f_u16DiagID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_DIAGID,
+ sizeof(UI_16), &f_u16DiagID))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed %d", l_eStatus);
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerIf_UploadEventLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_UploadEventLog() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL != m_hSession) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_UPLOAD_EVENTLOG, 0x00,
+ NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed %d", l_eStatus);
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // LCOV_EXCL_BR_LINE 10:Because the last line
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_power_client.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_power_client.cpp
new file mode 100755
index 0000000..30bdbaa
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_power_client.cpp
@@ -0,0 +1,254 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerServiceIf
+/// \brief This file supports Power Service client management.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <inttypes.h>
+#include <string.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <string>
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_power_service_protocol.h"
+#include "system_service/ss_power_service_notifications.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_system_if.h"
+#include "system_service/ss_templates.h"
+#include "ss_power_if_interfaceunifiedlog.h"
+
+typedef struct {
+ BOOL fAvailable;
+ HANDLE hSession;
+ HANDLE hService;
+ std::string szServiceName;
+} TPowerSession;
+
+static EFrameworkunifiedStatus OnPowerCloseSesionAck(HANDLE hApp);
+static EFrameworkunifiedStatus OnPowerOpenSessionAck(HANDLE hApp);
+static EFrameworkunifiedStatus OnPowerAvailability(HANDLE hApp);
+static EFrameworkunifiedStatus OnPowerAvailable(HANDLE hApp);
+static EFrameworkunifiedStatus OnPowerUnavailable(HANDLE hApp);
+static TPowerSession g_tPowerSession = { };
+
+/// Base on the a user group affiliation we will call there start and stop methods
+/// Note: there group and subgroup strings are empty we will call start on the every
+/// first case of
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToPowerSerivce(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Subscriptions
+ FrameworkunifiedNotificationCallbackHandler g_aryPower_Notif_Cbs[] = {
+ // Notifications name, Call back function
+ { szNTFY_PowerAvailability, OnPowerAvailability }, };
+
+ /// Avoid opening a session to the Power
+ /// service Since it uses the framework as well
+ if (0 != strcmp(SERVICE_POWER, FrameworkunifiedGetAppName(hApp))) {
+ // Subscribe and attach call backs to notifications, to Notification Service!
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedSubscribeNotificationsWithCallback(
+ hApp, g_aryPower_Notif_Cbs, _countof(g_aryPower_Notif_Cbs)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ",
+ eStatus);
+ } else {
+ /// Need to save the Group and Subgroup values
+ g_tPowerSession.szServiceName = FrameworkunifiedGetAppName(hApp);
+
+ /// Cleanup any other data members
+ g_tPowerSession.fAvailable = FALSE;
+ g_tPowerSession.hService = NULL;
+ g_tPowerSession.hSession = NULL;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
+
+EFrameworkunifiedStatus OnPowerAvailability(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Power Service Availability notification received ****");
+
+ if (sizeof(BOOL) == FrameworkunifiedGetMsgLength(hApp)) {
+ BOOL avalibility = FALSE;
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &avalibility, sizeof(BOOL)))) {
+ if (TRUE == avalibility) {
+ eStatus = OnPowerAvailable(hApp);
+ } else {
+ eStatus = OnPowerUnavailable(hApp);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ",
+ eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus OnPowerAvailable(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ // if the service is available before the close happens then close the session and service first.
+ if (NULL != g_tPowerSession.hService && NULL != g_tPowerSession.hSession) {
+ EFrameworkunifiedStatus interfaceunifiedRet = FrameworkunifiedCloseSession(g_tPowerSession.hService,
+ g_tPowerSession.hSession);
+ SS_ASERT(interfaceunifiedRet == eFrameworkunifiedStatusOK);
+ g_tPowerSession.hSession = NULL;
+ g_tPowerSession.hService = NULL;
+ }
+
+ PCSTR power_name = FrameworkunifiedGetMsgSrc(hApp);
+
+ // opening the service
+ if (NULL == (g_tPowerSession.hService = FrameworkunifiedOpenService(hApp, power_name))) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_ERR, __FUNCTION__, "Power: Failed to open service");
+ } else {
+ FrameworkunifiedProtocolCallbackHandler g_aryPower_Protocol_Cbs[] = {
+ // Command ID, Call back functions
+ { PROTOCOL_OPEN_SESSION_ACK, OnPowerOpenSessionAck },
+ { PROTOCOL_CLOSE_SESSION_ACK, OnPowerCloseSesionAck }, };
+
+ /// Attach the valid callback for this service
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hApp, power_name, g_aryPower_Protocol_Cbs,
+ _countof(g_aryPower_Protocol_Cbs)))) {
+ EPWR_SESSION_TYPE tOpenSessionReq = epsstBASIC;
+ /// opening the session with service
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedOpenSessionWithData(g_tPowerSession.hService,
+ &tOpenSessionReq,
+ sizeof(tOpenSessionReq)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedOpenSession Failed Status:0x%x ",
+ eStatus);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "%s has received PowerService Available.",
+ FrameworkunifiedGetAppName(hApp));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher Failed Status:0x%x ", eStatus);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus OnPowerUnavailable(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ if (0 == strcmp(SERVICE_POWER, FrameworkunifiedGetAppName(hApp))) {
+ if ((g_tPowerSession.hSession != NULL)
+ && (g_tPowerSession.hService != NULL)) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedCloseSession(g_tPowerSession.hService,
+ g_tPowerSession.hSession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedCloseSession Failed Status:0x%x",
+ eStatus);
+ }
+ g_tPowerSession.hSession = NULL;
+ g_tPowerSession.hService = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "%s has received PowerService Unavailable.", FrameworkunifiedGetAppName(hApp));
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error INVALID HANDLE [g_tPowerSession.hSession :0x%" PRIxPTR "]; [g_tPowerSession.hService :0x%" PRIxPTR "] ", // NOLINT (whitespace/line_length)
+ (uintptr_t) g_tPowerSession.hSession, (uintptr_t) g_tPowerSession.hService);
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: OnHeartBeatClientOpenSessionAck
+/// HeartBeat Service OpenSession callback
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnPowerOpenSessionAck(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ g_tPowerSession.hSession = FrameworkunifiedGetOpenSessionHandle(hApp);
+ if (NULL != g_tPowerSession.hSession) {
+ g_tPowerSession.fAvailable = TRUE;
+ eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "%s Session to PowerService has been successfully opened.",
+ FrameworkunifiedGetAppName(hApp));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetOpenSessionHandle returned : %" PRIxPTR "",
+ (uintptr_t) g_tPowerSession.hSession);
+ g_tPowerSession.hSession = NULL;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: OnHeartBeatClientCloseSessionAck
+/// HeartBeat Service CloseSession callback
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnPowerCloseSesionAck(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Close Service
+ if (NULL != g_tPowerSession.hService) {
+ eStatus = FrameworkunifiedCloseService(hApp, g_tPowerSession.hService);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: FrameworkunifiedCloseService() errored %d/'%s",
+ eStatus, GetStr(eStatus).c_str());
+ }
+ g_tPowerSession.hService = NULL;
+ g_tPowerSession.hSession = NULL;
+ }
+ g_tPowerSession.fAvailable = FALSE;
+ eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "%s Session to PowerService has been successfully closed.",
+ FrameworkunifiedGetAppName(hApp));
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_pwrsvc_if.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_pwrsvc_if.cpp
new file mode 100755
index 0000000..86d8ebb
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_pwrsvc_if.cpp
@@ -0,0 +1,343 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerServiceIf
+/// \brief This file supports the Power Service module interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_power_service_if.h"
+#include <string.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_power_service_protocol.h"
+#include "system_service/ss_power_service_notifications.h"
+#include "system_service/ss_system_if.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_string_maps.h"
+#include "system_service/ss_templates.h"
+#include "ss_power_if_interfaceunifiedlog.h"
+
+HANDLE OpenPowerService(HANDLE f_hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ HANDLE l_hService = NULL;
+ if (NULL == f_hApp) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_App");
+ } else if (NULL == (l_hService = FrameworkunifiedOpenService(f_hApp, SERVICE_POWER))) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedOpenService(f_hApp, SERVICE_POWER)");
+ }
+ return l_hService;
+}
+
+EFrameworkunifiedStatus ClosePowerService(HANDLE f_hApp, HANDLE f_hService) {
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hApp) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_App");
+ } else if (NULL == f_hService) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hService");
+ } else {
+ l_eStatus = FrameworkunifiedCloseService(f_hApp, f_hService);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedCloseService(f_hApp, f_hService)");
+ f_hService = NULL;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/// Session Related Requests
+/// Any client can also use FrameworkunifiedOpenSession and FrameworkunifiedOpenSessionWithData.
+/// In that case, the PVOID data passed as a parameter should be MM_OpenSessionRequestIf
+/// to open a session with the Power Service.
+/// The client can also use the below API for Opening a session with Power Service.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus PwrServiceOpenSessionRequest(HANDLE f_hService,
+ EPWR_SESSION_TYPE f_eSessionType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == f_hService) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hService");
+ } else if (epsstUNKNOWN == f_eSessionType) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("epsstUNKNOWN == f_eSessionType");
+ } else {
+ l_eStatus = FrameworkunifiedOpenSessionWithData(f_hService, &f_eSessionType,
+ sizeof(f_eSessionType));
+ LOG_STATUS(l_eStatus, "FrameworkunifiedOpenSessionWithData()");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceCloseSessionRequest(HANDLE f_hService, HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == f_hService) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hService");
+ } else if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ CALL_AND_LOG_STATUS(FrameworkunifiedCloseSession(f_hService, f_hSession));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceDecodeOpenSessionResponse(HANDLE f_hApp,
+ HANDLE& f_hSession) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == f_hApp) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_App");
+ } else {
+ if (NULL == (f_hSession = FrameworkunifiedGetOpenSessionHandle(f_hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedGetOpenSessionHandle('%s') returned NULL",
+ FrameworkunifiedGetAppName(f_hApp));
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceSetVoltageState(HANDLE f_hSession,
+ EPWR_VOLTAGE_STATE_TYPE f_eVoltage_state) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else if (epsvsINVALID == f_eVoltage_state) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("epsvsINVALID == f_eVoltage_state");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ l_tServiceSetIf.data.voltage.state = f_eVoltage_state;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_VOLTAGE_STATE,
+ sizeof(l_tServiceSetIf), (PVOID) &l_tServiceSetIf);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_VOLTAGE_STATE)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceSetCrankState(HANDLE f_hSession,
+ EPWR_CRANK_STATE_TYPE f_eCrank_state) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else if (epscsINVALID == f_eCrank_state) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("epsvsINVALID == f_eCrank_state");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ l_tServiceSetIf.data.crank.state = f_eCrank_state;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_CRANK_STATE,
+ sizeof(l_tServiceSetIf), (PVOID) &l_tServiceSetIf);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_CRANK_STATE)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceSendShutdownRequest(
+ HANDLE f_hSession, EPWR_SHUTDOWN_REQUEST_MSG_STRUCT &f_eState) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ l_tServiceSetIf.data.shutdownRequestMsg = f_eState;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_SHUTDOWN_REQUEST_MSG,
+ sizeof(l_tServiceSetIf), &l_tServiceSetIf);
+
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_SHUTDOWN_REQUEST_MSG)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus PwrServiceSendShutdownRequest(
+
+EFrameworkunifiedStatus PwrServiceSendSetShutdownPopupRequest(
+ HANDLE f_hSession, EPWR_SHUTDOWN_POPUP_TYPE f_eShutdownPopup) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ switch (f_eShutdownPopup) {
+ case epsspPowerSave1:
+ case epsspPowerSave2:
+ case epsspPowerSave3:
+ case epsspPowerSaveClr:
+ case epsspLowVoltage1:
+ case epsspLowVoltage2:
+ case epsspLowVoltage3:
+ case epsspLowVoltageClr:
+ case epsspBattCouplingSW1:
+ case epsspBattCouplingSW2:
+ case epsspBattCouplingSW3:
+ case epsspBattCouplingSWClr:
+ case epsspAbnormalTemp_1st:
+ case epsspAbnormalTemp_Clr:
+ case epsspLimpHome_1st:
+ case epsspLimpHome_2nd:
+ case epsspLimpHome_3rd:
+ case epsspLimpHome_Clr:
+ case epsspProdMd_1st:
+ case epsspProdMd_Clr:
+ case epsspTransMd_1st:
+ case epsspTransMd_Clr:
+ case epsspAllClr:
+ l_tServiceSetIf.data.shutdownPopup.shutdownPopupEvent =
+ f_eShutdownPopup;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession,
+ SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ,
+ sizeof(l_tServiceSetIf), &l_tServiceSetIf);
+ LOG_STATUS(l_eStatus,
+ "FrameworkunifiedSendMsg(SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ)");
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Unknown 'ShutdownPopup' value: 0x%X/%d",
+ f_eShutdownPopup, f_eShutdownPopup);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus PwrServiceSendSetShutdownPopupRequest( HANDLE f_hSession,
+
+EFrameworkunifiedStatus PwrServiceSendStartupConfirmationMsgRequest(
+ HANDLE f_hSession, EPWR_SC_MSG_STRUCT f_eState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ l_tServiceSetIf.data.startupConfirmationMsg = f_eState;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_FWD_START_CONFIRMATION_MSG_REQ,
+ sizeof(l_tServiceSetIf), &l_tServiceSetIf);
+
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_FWD_START_CONFIRMATION_MSG_REQ)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus PwrServiceSendStartupConfirmationMsgRequest ( HANDLE f_hSession,
+
+EFrameworkunifiedStatus PwrServiceSystemModeInfoRequest(HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_SYSTEM_MODE_INFO_REQ, 0, NULL);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_SYSTEM_MODE_INFO_REQ)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceSendInitCompReport(HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_INITCOMP_REP, 0, NULL);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_INITCOMP_REP)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PwrServiceSendPowerRequest(
+ HANDLE f_hSession, EPWR_POWER_REQUEST_MSG_STRUCT_WITH_UMCR &f_eState) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ std::memset(&l_tServiceSetIf, 0, sizeof(l_tServiceSetIf));
+ l_tServiceSetIf.data.powerRequestMsg = f_eState;
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_POWER_REQUEST_MSG,
+ sizeof(l_tServiceSetIf), (PVOID) &l_tServiceSetIf);
+
+ char l_cBuf[200] = { 0 };
+ snprintf(
+ l_cBuf,
+ sizeof(l_cBuf),
+ "FrameworkunifiedSendMsg(SS_POWER_POWER_REQUEST_MSG(%s, %s))",
+ GetStr(l_tServiceSetIf.data.powerRequestMsg.userMode).c_str(),
+ GetStr(l_tServiceSetIf.data.powerRequestMsg.userModeChangeReason).c_str());
+ LOG_STATUS(l_eStatus, l_cBuf);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus PwrServiceSendPowerRequest( HANDLE f_hSession
+
+EFrameworkunifiedStatus PwrServiceSendHeartBeatRequest(HANDLE f_hSession,
+ EPWR_HB_REQ_MSG_STRUCT *f_eHbReqMsg) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == f_hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("NULL == f_hSession");
+ } else {
+ l_eStatus = FrameworkunifiedSendMsg(f_hSession, SS_POWER_HEARTBEAT_REQ,
+ sizeof(EPWR_HB_REQ_MSG_STRUCT),
+ reinterpret_cast<void *>(f_eHbReqMsg));
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_HEARTBEAT_REQ)");
+ }
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // LCOV_EXCL_BR_LINE 10:Because the last line
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_sm_client.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_sm_client.cpp
new file mode 100755
index 0000000..664a98d
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_sm_client.cpp
@@ -0,0 +1,1509 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_sm_client_if.h"
+#include <sys/mount.h>
+#include <errno.h>
+#include <string.h>
+#include <fcntl.h>
+
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_sm_framework_dispatch.h>
+#include <native_service/frameworkunified_sm_hsmframework.h>
+
+#include <string>
+
+#include "system_service/ss_system_manager_if.h"
+#include "system_service/ss_system_manager_protocol.h"
+#include "system_service/ss_system_manager_notifications.h"
+#include "system_service/ss_system_if.h"
+#include "system_service/ss_services.h"
+#include "system_service/ss_power_service_protocol.h"
+#include "system_service/ss_templates.h"
+#include "system_service/ss_string_maps.h"
+#include "system_service/ss_error_message.h"
+#include "system_service/ss_sm_client_if_local.h"
+
+#include "system_service/ss_boot_map.h"
+#include "ss_system_if_interfaceunifiedlog.h"
+
+typedef struct {
+ BOOL fAvailable;
+ HANDLE hService;
+ std::string szServiceName;
+ std::string strIAm;
+} TSystemManagerSession; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+typedef enum {
+ MODULE_STATE_INVALID = 0, /// Initial state of all modules
+ MODULE_STATE_CONNECTING, /// Attempting to established a session connection
+ MODULE_STATE_CONNECTED, /// A session connection has been established
+ MODULE_STATE_STARTING, /// Received a START from System Manager,
+ /// called FrameworkunifiedOnStart or enqueued evStart
+ MODULE_STATE_START_FAILED, /// Application returned error from FrameworkunifiedOnStart
+ MODULE_STATE_STARTED, /// Sent Start Response to System Manager
+ MODULE_STATE_STOPPING, /// Received a Stop Request from System Manager,
+ /// called FrameworkunifiedOnStop or enqueued evStop
+ MODULE_STATE_STOP_FAILED, /// Application returned error from FrameworkunifiedOnStop
+ MODULE_STATE_STOPPED, /// Sent Start Response to System Manager
+ MODULE_STATE_DEBUG_DUMPING,
+ MODULE_STATE_STARTED_PRE, //!< Sent Pre-Start Response to System Manager
+ MODULE_STATE_START_PRE_FAILED, //!< Application returned error from FrameworkunifiedOnPreStart
+ MODULE_STATE_STOPPED_PRE, //!< Sent Pre-Stop Response to System Manager
+ MODULE_STATE_STOP_PRE_FAILED, //!< Application returned error from FrameworkunifiedOnPreStop
+ MODULE_STATE_STARTED_BACKGROUND, //!< Sent Background-Start Response to System Manager
+ MODULE_STATE_START_BACKGROUND_FAILED, //!< Application returned error from FrameworkunifiedOnBackgroundStart
+ MODULE_STATE_STOPPED_BACKGROUND, //!< Sent Background-Stop Response to System Manager
+ MODULE_STATE_STOP_BACKGROUND_FAILED //!< Application returned error from FrameworkunifiedOnBackgroundStop
+} ModuleStateType;
+
+static SMStopCompleteAck g_responseCompleteAck;
+
+static EFrameworkunifiedStatus OnSystemManagerStart(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerStop(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerPreStart(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerPreStop(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerBackgroundStart(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerBackgroundStop(HANDLE hApp);
+static EFrameworkunifiedStatus OnSystemManagerOpenSessionAck(HANDLE hApp);
+static EFrameworkunifiedStatus DebugDumpAppCbStatistics(HANDLE hApp);
+static EFrameworkunifiedStatus DebugDumpMemoryMap(HANDLE hApp);
+static EFrameworkunifiedStatus SystemManagerOpenSender(HANDLE hApp);
+
+static TSystemManagerSession g_tSystemManagerSession = { }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+static pthread_mutex_t gMutexObj = PTHREAD_MUTEX_INITIALIZER;
+
+static EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, UI_32 uiLength,
+ PCVOID pData);
+static EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName,
+ UI_32 uiLength, PCVOID pData);
+
+static EFrameworkunifiedStatus InvokeSyncRequestToSystemManager(UI_32 uiCmd,
+ PCSTR f_pCmdName,
+ UI_32 uiLength, PCVOID pData,
+ UI_32 uiResLength,
+ PVOID pResData);
+
+static EFrameworkunifiedStatus CommonSystemManagerStartStopCallbackProcessing(
+ HANDLE hApp, UI_32 f_InterfaceunifiedEvID, SS_String f_pInterfaceunifiedEvName, CbFuncPtr f_InterfaceunifiedFncCb,
+ PCSTR f_pInterfaceunifiedFncName, ModuleStateType f_moduleSuccessState,
+ ModuleStateType f_moduleFailureState, BOOL f_bUseNotificationVsFncFlag,
+ PCSTR f_pUseNotificationText, SS_SystemManagerProtocol f_ProtocolId,
+ PCSTR f_pProtocolName);
+
+static EFrameworkunifiedStatus SendInterfaceunifiedOnResponseToSystemManager(
+ SS_SystemManagerProtocol f_ProtocolID, PCSTR f_pProtocolName,
+ PCSTR f_InterfaceunifiedOnFncName, ModuleStateType f_moduleSuccessState,
+ ModuleStateType f_moduleFailureState, EFrameworkunifiedStatus f_eStatus);
+
+// Pointer of function which is called when SM OpenSession Ack is received.
+// client can register this function pointer using RegisterSMSessionAckCallback() API
+static CbFuncPtr CallbackFnPtr = NULL;
+
+static BOOL UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc = FALSE;
+
+static VOID LoadCbHandlerCmdIDsIntoDetachCbIDsArray(
+ const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, UI_32 * puiCmdIdArray,
+ UI_32 uiHandlerCount);
+
+static VOID SetModuleState(ModuleStateType f_moduleState, BOOL f_bLog = TRUE);
+
+static ModuleStateType g_moduleState = MODULE_STATE_INVALID;
+extern HANDLE g_SystemIf_hApp;
+
+//******************************************************************************
+void Init_SS_IF_ModuleState_StrMap(
+ std::map<ModuleStateType, SS_String> & m_strMap) { // NOLINT (runtime/references)
+// LCOV_EXCL_BR_START 11:Unexpected branch
+ MAP_ENTRY(m_strMap, MODULE_STATE_INVALID);
+ MAP_ENTRY(m_strMap, MODULE_STATE_CONNECTING);
+ MAP_ENTRY(m_strMap, MODULE_STATE_CONNECTED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STARTING);
+ MAP_ENTRY(m_strMap, MODULE_STATE_START_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STARTED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOPPING);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOP_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOPPED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STARTED_PRE);
+ MAP_ENTRY(m_strMap, MODULE_STATE_START_PRE_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOPPED_PRE);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOP_PRE_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STARTED_BACKGROUND);
+ MAP_ENTRY(m_strMap, MODULE_STATE_START_BACKGROUND_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOPPED_BACKGROUND);
+ MAP_ENTRY(m_strMap, MODULE_STATE_STOP_BACKGROUND_FAILED);
+ MAP_ENTRY(m_strMap, MODULE_STATE_DEBUG_DUMPING);
+// LCOV_EXCL_BR_STOP
+} // End of void Init_SS_IF_ModuleState_StrMap(std::map<ModuleStateType, SS_String> & m_strMap)
+
+class EnumStringMap<ModuleStateType, Init_SS_IF_ModuleState_StrMap> g_oSS_IF_ModuleStateStrMap;
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(ModuleStateType f_enum) {
+ return g_oSS_IF_ModuleStateStrMap.GetStr(f_enum);
+}
+
+HANDLE GetSystemManagerSessionHandle(void) {
+ return g_tSystemManagerSession.hService;
+} // End of HANDLE GetSystemManagerSessionHandle(void)
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus InterfaceunifiedSystemConnectToSystemManagerService(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CallbackFnPtr = NULL;
+
+ /// Avoid opening a session to the SystemManager
+ /// service Since it uses the framework as well
+ if (0 != strcmp(SERVICE_SYSMANAGER, FrameworkunifiedGetAppName(hApp))) {
+ // LCOV_EXCL_BR_LINE 6:Duplicate check(AppName has been checked by the caller)
+ memset(&g_responseCompleteAck, 0, sizeof(g_responseCompleteAck));
+ g_responseCompleteAck.unSessionId = 0;
+ strcpy(g_responseCompleteAck.szServiceName, SERVICE_SYSMANAGER); // NOLINT (runtime/printf)
+
+ pthread_mutex_lock(&gMutexObj);
+
+ /// Need to save the Group and Subgroup values
+ g_tSystemManagerSession.szServiceName = SERVICE_SYSMANAGER;
+ g_tSystemManagerSession.strIAm = FrameworkunifiedGetAppName(hApp);
+
+ /// Cleanup any other data members
+ g_tSystemManagerSession.fAvailable = FALSE;
+ g_tSystemManagerSession.hService = NULL;
+
+ pthread_mutex_unlock(&gMutexObj);
+
+ l_eStatus = SystemManagerOpenSender(hApp);
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SystemManagerOpenSender()");
+ } else {
+ // LCOV_EXCL_START 6:Duplicate check(AppName has been checked by the caller)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " I am SystemManager ! Not registering for '%s' notification",
+ NTFY_SSSystemMgrAvailability);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SystemManagerOpenSender
+///
+///////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus SystemManagerOpenSender(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ pthread_mutex_lock(&gMutexObj);
+
+ // LCOV_EXCL_START 6:Duplicate check(hService is NULL only)
+ if (g_tSystemManagerSession.hService != NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warn: hService != NULL");
+ pthread_mutex_unlock(&gMutexObj);
+ return eFrameworkunifiedStatusFail;
+ }
+ // LCOV_EXCL_STOP
+
+ // opening the service
+ if (NULL
+ == (g_tSystemManagerSession.hService = FrameworkunifiedMcOpenSender(hApp,
+ SERVICE_SYSMANAGER))) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedMcOpenSender(SERVICE_SYSMANAGER)");
+ } else {
+ FrameworkunifiedProtocolCallbackHandler l_SystemManager_Protocol_Cbs[] = {
+ // Command ID, Call back functions
+ { SS_SM_PROTOCOL_OPEN_SESSION_ACK, OnSystemManagerOpenSessionAck },
+ { SS_SM_START, OnSystemManagerStart },
+ { SS_SM_STOP, OnSystemManagerStop },
+ { SS_SM_PRE_START, OnSystemManagerPreStart },
+ { SS_SM_PRE_STOP, OnSystemManagerPreStop },
+ { SS_SM_BACKGROUND_START, OnSystemManagerBackgroundStart },
+ { SS_SM_BACKGROUND_STOP, OnSystemManagerBackgroundStop },
+ { SS_SM_DEBUG_DUMP, OnSystemManagerDebugDump },
+ }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ /// Attach the valid callback for this service
+ if (eFrameworkunifiedStatusOK != // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hApp, SERVICE_SYSMANAGER, l_SystemManager_Protocol_Cbs,
+ _countof(l_SystemManager_Protocol_Cbs)))) {
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher()");
+ } else if (eFrameworkunifiedStatusOK != // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ (l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService,
+ SS_SM_PROTOCOL_OPEN_SESSION_REQ, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: FrameworkunifiedSendMsg(%s) errored: 0x%X/%s",
+ g_tSystemManagerSession.szServiceName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ } // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ pthread_mutex_unlock(&gMutexObj);
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ g_moduleState = MODULE_STATE_CONNECTING;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+}
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerOpenSessionAck
+/// Service Manager OpenSession callback
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnSystemManagerOpenSessionAck(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL == hApp) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("NULL == hApp");
+ } else {
+ pthread_mutex_lock(&gMutexObj);
+ if (NULL == g_tSystemManagerSession.hService) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetOpenSessionHandle()");
+ g_tSystemManagerSession.fAvailable = FALSE;
+ } else {
+ LOG_SUCCESS("FrameworkunifiedGetOpenSessionHandle(hApp)");
+ g_tSystemManagerSession.fAvailable = TRUE;
+ g_moduleState = MODULE_STATE_CONNECTED;
+ }
+ pthread_mutex_unlock(&gMutexObj);
+
+ if ((eFrameworkunifiedStatusOK == l_eStatus) && (CallbackFnPtr != NULL)) {
+ // Call the RegisterSMSessionAckCallback()-registered function
+ if (eFrameworkunifiedStatusOK != (l_eStatus = (CallbackFnPtr)(hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: The 'CallbackFnPtr' function as set by "
+ "the RegisterSMSessionAckCallback() function "
+ "errored: 0x%x/%s",
+ l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // EFrameworkunifiedStatus OnSystemManagerOpenSessionAck( HANDLE hApp )
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////
+/// Macro:
+///
+///////////////////////////////////////////////////////////
+#define SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING( \
+ hApp, evInterfaceunifiedId, InterfaceunifiedFnc, ModStateSuccess, ModStateFailure, \
+ NotifFlag, NotifText, ProtocolId) \
+ l_eStatus = CommonSystemManagerStartStopCallbackProcessing( \
+ hApp, \
+ evInterfaceunifiedId, \
+ #evInterfaceunifiedId, \
+ InterfaceunifiedFnc, \
+ #InterfaceunifiedFnc "()", \
+ ModStateSuccess, \
+ ModStateFailure, \
+ NotifFlag, \
+ NotifText, \
+ ProtocolId, \
+ #ProtocolId); \
+ LOG_STATUS(l_eStatus, \
+ "CommonSystemManagerStartStopCallbackProcessing(" #InterfaceunifiedFnc "())");
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerStart
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnSystemManagerStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStart), cbFuncs.onStart, MODULE_STATE_STARTED,
+ MODULE_STATE_START_FAILED, FALSE, "", SS_SM_START_COMPL_RSPN);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerStart( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerStop
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnSystemManagerStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp, FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedStop), cbFuncs.onStop, MODULE_STATE_STOPPED,
+ MODULE_STATE_STOP_FAILED, UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc,
+ " 'UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc' is 'True': "
+ "setting 'l_eStatus' to 'eFrameworkunifiedStatusFail'",
+ SS_SM_STOP_COMPL_RSPN);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerStop( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerPreStart
+///
+///////////////////////////////////////////////////////////
+static EFrameworkunifiedStatus OnSystemManagerPreStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedPreStart),
+ cbFuncs.onPreStart,
+ MODULE_STATE_STARTED_PRE,
+ MODULE_STATE_START_PRE_FAILED,
+ FALSE,
+ "",
+ SS_SM_PRE_START_COMPL_RSPN);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerPreStart( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerPreStop
+///
+///////////////////////////////////////////////////////////
+static EFrameworkunifiedStatus OnSystemManagerPreStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedPreStop),
+ cbFuncs.onPreStop,
+ MODULE_STATE_STOPPED_PRE,
+ MODULE_STATE_STOP_PRE_FAILED,
+ FALSE,
+ "",
+ SS_SM_PRE_STOP_COMPL_RSPN);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerPreStop( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerBackgroundStart
+///
+///////////////////////////////////////////////////////////
+static EFrameworkunifiedStatus OnSystemManagerBackgroundStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedBackgroundStart),
+ cbFuncs.onBackgroundStart,
+ MODULE_STATE_STARTED_BACKGROUND,
+ MODULE_STATE_START_BACKGROUND_FAILED,
+ FALSE,
+ "",
+ SS_SM_BACKGROUND_START_COMPL_RSPN);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerBackgroundStart( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerBackgroundStop
+///
+///////////////////////////////////////////////////////////
+static EFrameworkunifiedStatus OnSystemManagerBackgroundStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs); // LCOV_EXCL_BR_LINE 11:Excluded due to gcov restrictions(others)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ // Call CommonSystemManagerStartStopCallbackProcessing(), & log status
+ SETUP_AND_CALL_COMMON_SYSTEM_MANAGER_START_STOP_PROCESSING(
+ hApp,
+ FRAMEWORKUNIFIED_EVENT(evFrameworkunifiedBackgroundStop),
+ cbFuncs.onBackgroundStop,
+ MODULE_STATE_STOPPED_BACKGROUND,
+ MODULE_STATE_STOP_BACKGROUND_FAILED,
+ FALSE,
+ "",
+ SS_SM_BACKGROUND_STOP_COMPL_RSPN);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); // LCOV_EXCL_BR_LINE 15:Excluded for function that are expanded inline
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerBackgroundStop( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: CommonSystemManagerStartStopCallbackProcessing
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CommonSystemManagerStartStopCallbackProcessing(
+ HANDLE hApp, UI_32 f_InterfaceunifiedEvID, SS_String f_pInterfaceunifiedEvName, CbFuncPtr f_InterfaceunifiedFncCb,
+ PCSTR f_pInterfaceunifiedFncName, ModuleStateType f_moduleSuccessState,
+ ModuleStateType f_moduleFailureState, BOOL f_bUseNotificationVsFncFlag,
+ PCSTR f_pUseNotificationText, SS_SystemManagerProtocol f_ProtocolId,
+ PCSTR f_pProtocolName) {
+ EFrameworkunifiedStatus l_eStatus;
+ EFrameworkunifiedStatus l_StatusFncReturned;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SS_String l_pInterfaceunifiedFncName;
+
+ if (f_moduleSuccessState == g_moduleState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Module state already is '%s', just "
+ "returning '%s' to System Manager",
+ GetStr(g_moduleState).c_str(), f_pProtocolName);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ l_StatusFncReturned = l_eStatus;
+ } else {
+ // If client application is a state machine, post an Event instead of calling
+ // InterfaceunifiedOnXYZ()
+ if (FrameworkunifiedIsStateMachineApp(hApp)) {
+ l_pInterfaceunifiedFncName = "FrameworkunifiedPostEvent(FRAMEWORKUNIFIED_EVENT(" + f_pInterfaceunifiedEvName + " ))";
+ CFrameworkunifiedHSMFramework* l_pStateMachine = FrameworkunifiedGetStateMachine(hApp);
+ if (NULL == l_pStateMachine) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetStateMachine()");
+ l_StatusFncReturned = l_eStatus;
+ } else {
+ l_eStatus = l_pStateMachine->FrameworkunifiedPostEvent(f_InterfaceunifiedEvID);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: l_pStateMachine->FrameworkunifiedPostEvent(%s) "
+ "errored: %d/'%s'",
+ f_pInterfaceunifiedEvName.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+ l_StatusFncReturned = l_eStatus;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " f_bUseNotificationVsFncFlag is '%s'",
+ GetStr(f_bUseNotificationVsFncFlag).c_str());
+ if (f_bUseNotificationVsFncFlag) {
+ //
+ // DON'T send an 'Ok' back to the SendInterfaceunifiedOnResponse function: if
+ // it detects a 'Ok' it will send a SS_SM_<protocol>_RSPN back
+ // to System Manager, telling System Manager that the request
+ // has been completely serviced.
+ l_StatusFncReturned = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", f_pUseNotificationText);
+ } else {
+ //
+ // Always send an 'Ok' back for the evInterfaceunified<protocol> version
+ // of InterfaceunifiedOn<protocol>; the l_eStatus applies to the
+ // FrameworkunifiedPostEvent() function, not the actual <protocol> event
+ // handler.
+ l_StatusFncReturned = eFrameworkunifiedStatusOK;
+ }
+ } // End else successful FrameworkunifiedPostEvent()
+ } // End else valid FrameworkunifiedGetStateMachine()
+ } else { // End if FrameworkunifiedIsStateMachineApp() is TRUE
+ l_pInterfaceunifiedFncName = f_pInterfaceunifiedFncName;
+ if (f_InterfaceunifiedFncCb) {
+ l_eStatus = (f_InterfaceunifiedFncCb)(hApp);
+ LOG_STATUS(l_eStatus, f_pInterfaceunifiedFncName);
+ l_StatusFncReturned = l_eStatus;
+ } else {
+ SS_ASERT(0);
+ l_StatusFncReturned = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+
+ l_eStatus = SendInterfaceunifiedOnResponseToSystemManager(f_ProtocolId, f_pProtocolName,
+ l_pInterfaceunifiedFncName.c_str(),
+ f_moduleSuccessState,
+ f_moduleFailureState,
+ l_StatusFncReturned);
+ const char l_cFormat[] = "SendInterfaceunifiedOnResponseToSystemManager(%s)";
+ char l_cBuf[sizeof(l_cFormat) + strlen(f_pProtocolName) + 1]; // NOLINT (runtime/arrays)
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, f_pProtocolName);
+ LOG_STATUS_IF_ERRORED(l_eStatus, l_cBuf);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of CommonSystemManagerStartStopCallbackProcessing(
+
+
+///////////////////////////////////////////////////////////
+/// Function: SendInterfaceunifiedOnStopResponseToSystemManager()
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInterfaceunifiedOnStopResponseToSystemManager(EFrameworkunifiedStatus f_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendInterfaceunifiedOnResponseToSystemManager(
+ SS_SM_STOP_COMPL_RSPN, "SS_SM_STOP_COMPL_RSPN", "FrameworkunifiedOnStop()",
+ MODULE_STATE_STOPPED, MODULE_STATE_STOP_FAILED, f_eStatus);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendInterfaceunifiedOnResponseToSystemManager("
+ "SS_SM_STOP_COMPL_RSPN");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendInterfaceunifiedOnStopResponseToSystemManager(EFrameworkunifiedStatus f_eStatus)
+
+///////////////////////////////////////////////////////////
+/// Function: GetInterfaceunifiedOnStartExtInfo()
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetInterfaceunifiedOnStartExtInfo(T_SS_SM_START_ExtDataStructType &f_info) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = InvokeSyncRequestToSystemManager(
+ SS_SM_GET_START_EXT_INFO, "SS_SM_GET_START_EXT_INFO", 0, NULL,
+ sizeof(T_SS_SM_START_ExtDataStructType), (PVOID) & f_info);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: GetInterfaceunifiedOnStopExtInfo()
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus GetInterfaceunifiedOnStopExtInfo(T_SS_SM_STOP_ExtDataStructType &f_info) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = InvokeSyncRequestToSystemManager(
+ SS_SM_GET_STOP_EXT_INFO, "SS_SM_GET_STOP_EXT_INFO", 0, NULL,
+ sizeof(T_SS_SM_STOP_ExtDataStructType), (PVOID) & f_info);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: OnSystemManagerDebugDump
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus OnSystemManagerDebugDump(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+
+ g_moduleState = MODULE_STATE_DEBUG_DUMPING;
+ l_eStatus = FrameworkunifiedGetDefaultCbHandler(&cbFuncs);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedGetDefaultCbHandler()");
+
+ if (cbFuncs.onDebugDump) {
+ l_eStatus = cbFuncs.onDebugDump(hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedOnDebugDump()");
+ } else {
+ SS_ASERT(0);
+ }
+
+ l_eStatus = DebugDumpAppCbStatistics(hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "DebugDumpAppCbStatistics()");
+
+ l_eStatus = DebugDumpMemoryMap(hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "DebugDumpMemoryMap()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus OnSystemManagerDebugDump( HANDLE hApp )
+
+///////////////////////////////////////////////////////////
+/// Function: DebugDumpAppCbStatistics
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DebugDumpAppCbStatistics(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+l_eStatus = eFrameworkunifiedStatusOK;
+
+FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: DebugDumpMemoryMap
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DebugDumpMemoryMap(HANDLE hApp) {
+#define MEM_MAP_READ_SIZE 4096
+#define DUMP_MAX_SIZE 131072 // 128KB
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ char buf[MEM_MAP_READ_SIZE];
+ std::string bufString;
+ int fd, ret;
+
+ fd = open("/proc/self/maps", O_RDONLY);
+ if (fd != -1) {
+ while ((ret = read(fd, buf, MEM_MAP_READ_SIZE)) > 0) {
+ if ((bufString.size() + ret) > DUMP_MAX_SIZE) {
+ // If read it again, it will break because it overflows
+ break;
+ }
+ bufString.append(buf, ret);
+ }
+ close(fd);
+ if (ret >= 0) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ SendDebugDumpResponseToSystemManager(bufString);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// SendDebugDumpResponseToSystemManager
+//////////////////////////////////////////
+VOID SendDebugDumpResponseToSystemManager(BOOL f_bFormatStrRequired,
+ PCSTR f_cFormat, ...) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ va_list l_argList;
+ const UI_32 l_maxDebugDumpMsgSize = (1024 * 4);
+ CHAR l_cMsg[l_maxDebugDumpMsgSize] = { 0 };
+ PCSTR l_pAppName;
+
+ pthread_mutex_lock(&gMutexObj);
+
+ l_pAppName = FrameworkunifiedGetAppName(g_SystemIf_hApp); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ if (f_bFormatStrRequired) {
+ // build a format string
+ // Format: AppName/debugdump_data
+ snprintf(l_cMsg, l_maxDebugDumpMsgSize, "%s/", l_pAppName);
+ }
+
+ va_start(l_argList, f_cFormat);
+ vsnprintf(&l_cMsg[strlen(l_cMsg)], l_maxDebugDumpMsgSize - strlen(l_cMsg),
+ f_cFormat, l_argList);
+ va_end(l_argList);
+
+ if (0 == strcmp(SERVICE_SYSMANAGER, l_pAppName)) {
+ l_eStatus = FrameworkunifiedSendSelf(g_SystemIf_hApp, SS_SM_DEBUG_DUMP_RSPN,
+ strlen(l_cMsg) + 1, l_cMsg); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendSelf(SS_SM_DEBUG_DUMP_RSPN)");
+ } else if (NULL != g_tSystemManagerSession.hService) {
+ l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService,
+ SS_SM_DEBUG_DUMP_RSPN, strlen(l_cMsg) + 1, l_cMsg); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg(SS_SM_DEBUG_DUMP_RSPN)");
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Invalid handle[g_tSystemManagerSession.hService == NULL]");
+ }
+
+ pthread_mutex_unlock(&gMutexObj);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // End of EFrameworkunifiedStatus SendDebugDumpResponseToSystemManager( HANDLE hApp )
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+//////////////////////////////////////////
+// SendDebugDumpResponseToSystemManager
+//////////////////////////////////////////
+VOID SendDebugDumpResponseToSystemManager(std::string & f_messageStr) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ pthread_mutex_lock(&gMutexObj);
+
+ if (0 == strcmp(SERVICE_SYSMANAGER, FrameworkunifiedGetAppName(g_SystemIf_hApp))) {
+ l_eStatus = FrameworkunifiedSendSelf(g_SystemIf_hApp, SS_SM_DEBUG_DUMP_RSPN,
+ f_messageStr.size() + 1, f_messageStr.c_str());
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendSelf(SS_SM_DEBUG_DUMP_RSPN)");
+ } else if (NULL != g_tSystemManagerSession.hService) {
+ l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService,
+ SS_SM_DEBUG_DUMP_RSPN, f_messageStr.size() + 1,
+ f_messageStr.c_str());
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg(SS_SM_DEBUG_DUMP_RSPN)");
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: hService = NULL");
+ }
+
+ pthread_mutex_unlock(&gMutexObj);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // End of EFrameworkunifiedStatus SendDebugDumpResponseToSystemManager(std::string & f_messageStr)
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////
+/// Function: SendInterfaceunifiedOnResponseToSystemManager()
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInterfaceunifiedOnResponseToSystemManager(
+ SS_SystemManagerProtocol f_ProtocolID, PCSTR f_pProtocolName,
+ PCSTR f_InterfaceunifiedOnFncName, ModuleStateType f_moduleSuccessState,
+ ModuleStateType f_moduleFailureState, EFrameworkunifiedStatus f_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (eFrameworkunifiedStatusOK != f_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: '%s' returned %d/%s, NOT sending '%s' to System Manager",
+ f_InterfaceunifiedOnFncName, f_eStatus, GetStr(f_eStatus).c_str(),
+ f_pProtocolName);
+ l_eStatus = f_eStatus;
+ SetModuleState(f_moduleFailureState);
+ } else {
+ if (f_moduleSuccessState == g_moduleState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Module state already is '%s', just "
+ "returning '%s' to System Manager",
+ GetStr(g_moduleState).c_str(), f_pProtocolName);
+ }
+
+ l_eStatus = SendMsgToSystemManager(static_cast<UI_32>(f_ProtocolID),
+ f_pProtocolName,
+ sizeof(g_responseCompleteAck),
+ &g_responseCompleteAck); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ const char l_cFormat[] = "SendMsgToSystemManager(%s)";
+ char l_cBuf[sizeof(l_cFormat) + strlen(f_pProtocolName) + 1]; // NOLINT (runtime/arrays)
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, f_pProtocolName);
+ LOG_STATUS(l_eStatus, l_cBuf);
+ SetModuleState(f_moduleSuccessState);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of SendInterfaceunifiedOnResponseToSystemManager(
+
+///////////////////////////////////////////////////////////
+/// Function: SendMsgToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName, UI_32 uiLength,
+ PCVOID pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Sending %s", f_pCmdName);
+
+ return SendMsgToSystemManager(uiCmd, uiLength, pData);
+} // End of EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName, UI_32 uiLength, PCVOID pData)
+
+///////////////////////////////////////////////////////////
+/// Function: SendMsgToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, UI_32 uiLength, PCVOID pData) {
+ EFrameworkunifiedStatus l_eStatus;
+ if (NULL == g_tSystemManagerSession.hService) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("NULL == g_tSystemManagerSession.hService");
+ } else {
+ pthread_mutex_lock(&gMutexObj);
+ l_eStatus = FrameworkunifiedSendMsg(g_tSystemManagerSession.hService, uiCmd, uiLength,
+ pData);
+ pthread_mutex_unlock(&gMutexObj);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg()");
+ }
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendMsgToSystemManager(UI_32 uiCmd, UI_32 uiLength, PCVOID pData)
+
+///////////////////////////////////////////////////////////
+/// Function: InvokeSyncRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus InvokeSyncRequestToSystemManager(UI_32 uiCmd, PCSTR f_pCmdName,
+ UI_32 uiLength, PCVOID pData,
+ UI_32 uiResLength, PVOID pResData) {
+ EFrameworkunifiedStatus l_eStatus;
+ UI_32 uiRcvLength = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Sending %s", f_pCmdName);
+
+ if (NULL == g_tSystemManagerSession.hService) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("NULL == g_tSystemManagerSession.hService");
+ } else {
+ pthread_mutex_lock(&gMutexObj);
+ l_eStatus = FrameworkunifiedInvokeSync(g_tSystemManagerSession.hService, uiCmd, uiLength,
+ pData, uiResLength, pResData, &uiRcvLength); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (uiResLength != uiRcvLength) {
+ LOG_ERROR("uiResLength != uiRcvLength");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ pthread_mutex_unlock(&gMutexObj);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedInvokeSync()");
+ }
+ return l_eStatus;
+} // End of Function
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: SendWakeUpToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendWakeUpToSystemManager(wakeInfo *pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_WAKEUP_MODULES,
+ "SS_SM_WAKEUP_MODULES",
+ sizeof(wakeInfo),
+ (PCVOID) pData);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendWakeUpToSystemManager(wakeInfo *pData)
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: SendShutdownToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendShutdownToSystemManager(Pwr_ServiceSetInterface *pData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_SHUTDOWN_MODULES,
+ "SS_SM_SHUTDOWN_MODULES",
+ sizeof(Pwr_ServiceSetInterface),
+ (PCVOID) pData);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendShutdownToSystemManager(Pwr_ServiceSetInterface *pData)
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////
+/// Function: RegisterSMSessionAckCallback
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus RegisterSMSessionAckCallback(EFrameworkunifiedStatus (*CallbackPtr)(HANDLE)) {
+ CallbackFnPtr = CallbackPtr;
+ return eFrameworkunifiedStatusOK;
+} // End of EFrameworkunifiedStatus RegisterSMSessionAckCallback(EFrameworkunifiedStatus (*CallbackPtr)(HANDLE))
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+///////////////////////////////////////////////////////////
+/// Function: SendSystemModeRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendSystemModeRequestToSystemManager(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_SYSTEM_MODE_INFO_REQ,
+ "SS_SM_SYSTEM_MODE_INFO_REQ", 0,
+ NULL);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendSystemModeRequestToSystemManager(void)
+
+///////////////////////////////////////////////////////////
+/// Function: SendInitCompReportToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInitCompReportToSystemManager(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_INITCOMP_REP,
+ "SS_SM_INITCOMP_REP", 0, NULL);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendInitCompReportToSystemManager(void)
+
+
+///////////////////////////////////////////////////////////
+/// Function: AttachCallbackToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus AttachCallbackToSystemManager(HANDLE hApp, UI_32 iCmd,
+ CbFuncPtr fpOnCmd) {
+ return FrameworkunifiedAttachCallbackToDispatcher(
+ hApp, g_tSystemManagerSession.szServiceName.c_str(), iCmd, fpOnCmd);
+} // End of EFrameworkunifiedStatus AttachCallbackToSystemManager( HANDLE hApp, UI_32 iCmd, CbFuncPtr fpOnCmd )
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////
+/// Function: SetDataResetModeToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetDataResetModeToSystemManager(ESMDataResetModeInfo dataResetMode) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_resData;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ switch (dataResetMode) {
+ case e_SS_SM_DATA_RESET_MODE_NONE:
+ case e_SS_SM_DATA_RESET_MODE_USER:
+ case e_SS_SM_DATA_RESET_MODE_FACTORY:
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "dataResetMode %d", dataResetMode);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ l_eStatus = InvokeSyncRequestToSystemManager(SS_SM_DATA_RESET_MODE_SET_REQ,
+ "SS_SM_DATA_RESET_MODE_SET_REQ",
+ sizeof(dataResetMode),
+ (PVOID) & dataResetMode,
+ sizeof(l_resData),
+ (PVOID) & l_resData); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()");
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (eFrameworkunifiedStatusOK != l_resData) {
+ l_eStatus = l_resData;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " l_eStatus %d", l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SetDataResetModeToSystemManager(ESMDataResetModeInfo dataResetMode)
+
+///////////////////////////////////////////////////////////
+/// Function: SetProgUpdateStateToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetProgUpdateStateToSystemManager(
+ SMProgUpdateState progUpdateState) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_resData;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (progUpdateState & SS_SM_PROG_UPDATE_STATE_UPDATED) {
+ } else if (progUpdateState & SS_SM_PROG_UPDATE_STATE_MAP_UPDATED) {
+ } else if (progUpdateState & SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED) {
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "unknown %#x", progUpdateState);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ l_eStatus = InvokeSyncRequestToSystemManager(
+ SS_SM_PROG_UPDATE_STATE_SET_REQ, "SS_SM_PROG_UPDATE_STATE_SET_REQ",
+ sizeof(progUpdateState), (PVOID) & progUpdateState, sizeof(l_resData),
+ (PVOID) & l_resData); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()");
+
+ if ((eFrameworkunifiedStatusOK == l_eStatus) && (eFrameworkunifiedStatusOK != l_resData)) {
+ l_eStatus = l_resData;
+ LOG_ERROR("SM RESP");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SetProgUpdateStateToSystemManager(SMProgUpdateState progUpdateState)
+
+///////////////////////////////////////////////////////////
+/// Function: SetNextWakeupTypeToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetNextWakeupTypeToSystemManager(ESMNextWakeupType f_wakeupType) {
+ EFrameworkunifiedStatus l_eStatus;
+ EFrameworkunifiedStatus l_resData;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ switch (f_wakeupType) {
+ case e_SS_SM_NEXT_WAKEUP_TYPE_NONE:
+ case e_SS_SM_NEXT_WAKEUP_TYPE_COLD:
+ case e_SS_SM_NEXT_WAKEUP_TYPE_HOT:
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "unknown type(%d)", f_wakeupType);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ l_eStatus = InvokeSyncRequestToSystemManager(SS_SM_NEXT_WAKEUP_TYPE_SET_REQ,
+ "SS_SM_NEXT_WAKEUP_TYPE_SET_REQ",
+ sizeof(f_wakeupType),
+ (PVOID) & f_wakeupType,
+ sizeof(l_resData),
+ (PVOID) & l_resData); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "InvokeSyncRequestToSystemManager()");
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (eFrameworkunifiedStatusOK != l_resData) {
+ l_eStatus = l_resData;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " l_eStatus %d", l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SendCpuResetRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendCpuResetRequestToSystemManager(
+ ESMCpuResetReason l_eCpuResetReason, std::string f_messageStr/* = "" */,
+ std::string f_suffixStr/* = "" */) {
+ TSystemManagerCpuResetInfo l_resetInfo; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_resetInfo.resetReason = l_eCpuResetReason;
+ snprintf(l_resetInfo.messageStr, SS_SM_RESET_MSG_STR_SIZE, "%s",
+ f_messageStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ snprintf(l_resetInfo.suffixStr, SS_SM_SUFFIX_STR_SIZE, "%s",
+ f_suffixStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_CPU_RESET_REQ, "SS_SM_CPU_RESET_REQ",
+ sizeof(l_resetInfo),
+ (PVOID) & l_resetInfo); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of SendCpuResetRequestToSystemManager
+
+///////////////////////////////////////////////////////////
+/// Function: SendStartupConfirmationToSystemManager
+///
+///////////////////////////////////////////////////////////
+// LCOV_EXCL_START 6:Because the condition cannot be set
+EFrameworkunifiedStatus SendStartupConfirmationToSystemManager(
+ StartupConfirmationMsgStrut &f_startupConfirmationMsg) { //NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ Pwr_ServiceSetInterface tServiceSetIf;
+ tServiceSetIf.data.startupConfirmationMsg = f_startupConfirmationMsg;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ,
+ "SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ",
+ sizeof(Pwr_ServiceSetInterface),
+ (PCVOID) & tServiceSetIf);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus SendStartupConfirmationToSystemManager(
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+EFrameworkunifiedStatus SendSystemErrorToSystemManager(EFrameworkunifiedSystemError f_systemError) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM_PROPAGATE_SYSTEM_ERROR,
+ sizeof(f_systemError),
+ reinterpret_cast<void*>(&f_systemError));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus Send_CWORD56_HeartBeatRequestToSystemManager(
+ EPWR_HB_REQ_MSG_STRUCT f_HbReq) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = SendMsgToSystemManager(SS_SM__CWORD56__HEARTBEAT_REQ,
+ sizeof(f_HbReq),
+ reinterpret_cast<void*>(&f_HbReq));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendMsgToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+VOID Set_UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc_StateVar(BOOL f_SetTrue) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc = f_SetTrue;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc set '%s'",
+ UseStopCompleteNotificationVsInterfaceunifiedOnStopFnc ? "True" : "False");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus SendBootMicroResetNotificationToSystemManager(
+ eSMBootMicroResetReason f_ResetReason) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_BOOT_MICRO_RESET_NTF,
+ "SS_SM_BOOT_MICRO_RESET_NTF",
+ sizeof(f_ResetReason), &f_ResetReason);
+
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendMsgToSystemManager(SS_SM_BOOT_MICRO_RESET_NTF)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus SendUserInvokedLoggingRequestToSystemManager(
+ eSMUserLogType f_userInvokedLogType, std::string f_messageStr/* = "" */,
+ std::string f_suffixStr/* = "" */) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ try {
+ switch (f_userInvokedLogType) {
+ case e_SS_SM_CAPTURE_ALL_LOGS:
+ case e_SS_SM_SCREEN_CAPTURE:
+ case e_SS_SM_CAPTURE_INTERFACEUNIFIED_LOGS:
+ case e_SS_SM_CAPTURE_DEV_LOGS:
+ case e_SS_SM_CAPTURE_MODULE_LOGS:
+ case e_SS_SM_CAPTURE_DTC_LOGS:
+ case e_SS_SM_CAPTURE_NAVI_LOGS:
+ case e_SS_SM_CAPTURE_GROUP_RELAUNCH:
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Unknown key ID '%d'",
+ f_userInvokedLogType);
+ throw eFrameworkunifiedStatusInvldParam;
+ break;
+ }
+
+ TSystemManagerLoggingRequestInfo l_logInfo = { };
+
+ snprintf(l_logInfo.messageStr, SS_SM_LOG_MSG_STR_SIZE, "%s",
+ f_messageStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ snprintf(l_logInfo.suffixStr, SS_SM_SUFFIX_STR_SIZE, "%s",
+ f_suffixStr.c_str()); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ l_logInfo.logType = f_userInvokedLogType;
+ l_eStatus = SendMsgToSystemManager(SS_SM_USER_INVOKED_LOG_REQ,
+ "SS_SM_USER_INVOKED_LOG_REQ",
+ sizeof(l_logInfo), &l_logInfo); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendMsgToSystemManager(SS_SM_USER_INVOKED_LOG_REQ)");
+ } catch (EFrameworkunifiedStatus e) {
+ l_eStatus = e;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+}
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+EFrameworkunifiedStatus SendDiagLoggingRequestToSystemManager(
+ std::string f_copyDestPathStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_DIAG_LOG_REQ,
+ "SS_SM_ERROR_EVENT_DIAG_LOG_REQ",
+ f_copyDestPathStr.length() + 1,
+ f_copyDestPathStr.c_str());
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_DIAG_LOG_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus SendCANLoggingRequestToSystemManager(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_CAN_LOG_REQ,
+ "SS_SM_ERROR_EVENT_CAN_LOG_REQ", 0, NULL);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_CAN_LOG_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus SendDTCLoggingRequestToSystemManager(UI_32 f_dtc) {
+ SS_ASERT(0);
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus RegisterBootMicroLogRequestCb(HANDLE hApp, CbFuncPtr fpOnCmd) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (NULL == hApp) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("(NULL == hApp)");
+ } else if (NULL == fpOnCmd) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("(NULL == fpOnCmd)");
+ } else {
+ l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback(
+ hApp, SS_SM_BOOT_MICRO_LOG_REQ, fpOnCmd,
+ g_tSystemManagerSession.hService); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "FrameworkunifiedSubscribeToSessionEventWithCallback(SS_SM_BOOT_MICRO_LOG_REQ)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus SendBootMicroLogResponseToSystemManager(std::string f_logString) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_BOOT_MICRO_LOG_RSP,
+ "SS_SM_BOOT_MICRO_LOG_RSP",
+ f_logString.size() + 1,
+ f_logString.c_str());
+
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendMsgToSystemManager(SS_SM_BOOT_MICRO_LOG_RSP)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+EFrameworkunifiedStatus DetachCallbacksFromInterfaceunifiedDispatcher(
+ HANDLE hApp, PCSTR pServiceName,
+ const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, UI_32 uiHandlerCount,
+ HANDLE hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ PUI_32 l_puiCmdIdArray;
+
+ if (NULL == pServiceName) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("NULL == pServiceName");
+ } else if (NULL == pMsgHandler) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("NULL == pMsgHandler");
+ } else if (0 == uiHandlerCount) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("0 == uiHandlerCount");
+ } else if (NULL == hSession) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("NULL == hSession");
+ } else if (NULL
+ == (l_puiCmdIdArray = new (std::nothrow) UI_32[uiHandlerCount])) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("new (std::nothrow)UI_32[ uiHandlerCount ]");
+ } else {
+ LoadCbHandlerCmdIDsIntoDetachCbIDsArray(pMsgHandler, l_puiCmdIdArray,
+ uiHandlerCount);
+
+ l_eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hApp, pServiceName,
+ l_puiCmdIdArray,
+ uiHandlerCount, hSession);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedDetachCallbacksFromDispatcher()");
+ delete[] l_puiCmdIdArray;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus DetachCallbacksFromInterfaceunifiedDispatcher(HANDLE hApp,
+
+EFrameworkunifiedStatus DetachParentCallbacksFromInterfaceunifiedDispatcher(
+ HANDLE hApp, const FrameworkunifiedProtocolCallbackHandler* pMsgHandler,
+ UI_32 uiHandlerCount) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ PUI_32 l_puiCmdIdArray;
+
+ if (NULL == pMsgHandler) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("NULL == pMsgHandler");
+ } else if (0 == uiHandlerCount) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("0 == uiHandlerCount");
+ } else if (NULL
+ == (l_puiCmdIdArray = new (std::nothrow) UI_32[uiHandlerCount])) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("new (std::nothrow)UI_32[ uiHandlerCount ]");
+ } else {
+ LoadCbHandlerCmdIDsIntoDetachCbIDsArray(pMsgHandler, l_puiCmdIdArray,
+ uiHandlerCount);
+
+ l_eStatus = FrameworkunifiedDetachParentCallbacksFromDispatcher(hApp, l_puiCmdIdArray,
+ uiHandlerCount);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedDetachParentCallbacksFromDispatcher()");
+ delete[] l_puiCmdIdArray;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus DetachParentCallbacksFromInterfaceunifiedDispatcher(HANDLE hApp,
+
+VOID LoadCbHandlerCmdIDsIntoDetachCbIDsArray(
+ const FrameworkunifiedProtocolCallbackHandler* pMsgHandler, UI_32 * puiCmdIdArray,
+ UI_32 uiHandlerCount) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ for (UI_32 i = 0; i < uiHandlerCount; i++) {
+ puiCmdIdArray[i] = pMsgHandler[i].iCmd;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // End of VOID LoadCbHandlerCmdIDsIntoDetachCbIDsArray(const FrameworkunifiedProtocolCallbackHandler* pMsgHandler,
+
+///////////////////////////////////////////////////////////
+/// Function: SendLogStartRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogStartRequestToSystemManager(EErrorEventType f_errorEvent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_START_REQ,
+ "SS_SM_ERROR_EVENT_LOGGING_START_REQ",
+ sizeof(f_errorEvent), &f_errorEvent);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_START_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SendLogArtifactRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogArtifactRequestToSystemManager(EArtifactId f_artifactId) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_ARTIFACT_REQ,
+ "SS_SM_ERROR_EVENT_ARTIFACT_REQ",
+ sizeof(f_artifactId), &f_artifactId);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_ARTIFACT_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SendLogCompleteRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendLogCompleteRequestToSystemManager(EFrameworkunifiedStatus f_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (eFrameworkunifiedStatusOK != f_eStatus) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_eStatus = f_eStatus;
+ }
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_COMPLETE,
+ "SS_SM_ERROR_EVENT_LOGGING_COMPLETE",
+ sizeof(l_eStatus), &l_eStatus);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_LOGGING_COMPLETE)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SendEelExportRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendEelExportRequestToSystemManager(std::string f_path) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_EEL_EXPORT_REQ,
+ "SS_SM_ERROR_EVENT_EEL_EXPORT_REQ",
+ f_path.length() + 1, f_path.c_str());
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_EEL_EXPORT_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////
+/// Function: SendInterfaceunifiedEmmcLogsRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendInterfaceunifiedEmmcLogsRequestToSystemManager(std::string f_path) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ,
+ "SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ",
+ f_path.length() + 1, f_path.c_str());
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////
+/// Function: SendClearLogsRequestToSystemManager
+///
+///////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SendClearLogsRequestToSystemManager(
+ TSystemManagerClearLogsInfo *f_info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (!f_info) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ l_eStatus = SendMsgToSystemManager(SS_SM_ERROR_EVENT_CLR_LOGS_REQ,
+ "SS_SM_ERROR_EVENT_CLR_LOGS_REQ", 0,
+ NULL);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendMsgToSystemManager(SS_SM_ERROR_EVENT_CLR_LOGS_REQ)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+VOID SetModuleState(ModuleStateType f_moduleState, BOOL f_bLog) {
+ if (f_bLog) { // LCOV_EXCL_BR_LINE 8:f_bLog is true only
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Changing SM_IF state from '%s' to '%s'",
+ GetStr(g_moduleState).c_str(), GetStr(f_moduleState).c_str());
+ }
+ g_moduleState = f_moduleState;
+} // LCOV_EXCL_BR_LINE 10:Because the last line
+// End of VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState )
+
+// EOF /SS_SystemIf/src/ss_sm_client.cpp
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_string_maps.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_string_maps.cpp
new file mode 100755
index 0000000..629043a
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_string_maps.cpp
@@ -0,0 +1,462 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "system_service/ss_string_maps.h"
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_logger_if.h>
+#include <map>
+#include "system_service/ss_power_service.h"
+#include "system_service/ss_templates.h"
+#include "system_service/ss_system_manager_if.h"
+#include "system_service/ss_system_manager_protocol.h"
+#include "ss_system_if_interfaceunifiedlog.h"
+
+/*
+ * 't'emplate for string-map initialization functions
+void Init_SS_xyz_StrMap(std::map<SS_xyz, SS_String> &m_strMap)
+{
+ MAP_ENTRY( m_strMap, );
+ MAP_ENTRY( m_strMap, );
+} // End of void Init_SS_xyz_StrMap(std::map<SS_xyz, SS_String> &m_strMap)
+*/
+
+
+//******************************************************************************
+void Init_eSMBootMicroResetReason_StrMap(std::map<eSMBootMicroResetReason,
+ SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_USER_FORCE_RESET);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_DSP_RESET);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_REASON_HB_TIMEOUT);
+}
+class EnumStringMap< eSMBootMicroResetReason,
+ Init_eSMBootMicroResetReason_StrMap>
+ m_oeSMBootMicroResetReasonMap;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(eSMBootMicroResetReason f_enum) {
+ return m_oeSMBootMicroResetReasonMap.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_EInterfaceunifiedSystemError_StrMap(std::map<EFrameworkunifiedSystemError, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, eFrameworkunifiedSystemErrorNone);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedDSPHardwareReset);
+}
+class EnumStringMap< EFrameworkunifiedSystemError, Init_EInterfaceunifiedSystemError_StrMap> m_oEInterfaceunifiedSystemErrorMap;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(EFrameworkunifiedSystemError f_enum) {
+ return m_oEInterfaceunifiedSystemErrorMap.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_EErrorEventType_StrMap(std::map<EErrorEventType, SS_String> & m_strMap); // NOLINT (runtime/references)
+class EnumStringMap< EErrorEventType, Init_EErrorEventType_StrMap> m_oEErrorEventTypeMap;
+SS_String GetStr(EErrorEventType f_enum) {
+ return m_oEErrorEventTypeMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_BOOL_StrMap(std::map<BOOL, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, TRUE);
+ MAP_ENTRY(m_strMap, FALSE);
+} // End of void Init_BOOL_StrMap(std::map<BOOL, SS_String> & m_strMap)
+class EnumStringMap< BOOL, Init_BOOL_StrMap> m_oBOOLMap;
+SS_String GetStr(BOOL f_enum) {
+ return m_oBOOLMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_LimpHomeCutoff_StrMap(std::map<EPWR_LHC_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epslhcINVALID);
+ MAP_ENTRY(m_strMap, epslhcDISABLED);
+ MAP_ENTRY(m_strMap, epslhcENABLED);
+} // End of void Init_SS_LimpHomeCutoff_StrMap(std::map<EPWR_LHC_TYPE, SS_String> & m_strMap)
+class EnumStringMap< EPWR_LHC_TYPE, Init_SS_LimpHomeCutoff_StrMap> m_oSS_LimpHomeCutoffMap;
+SS_String GetStr(EPWR_LHC_TYPE f_enum) {
+ return m_oSS_LimpHomeCutoffMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_ProductionMode_StrMap(std::map<EPWR_PROD_MODE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epspmINVALID);
+ MAP_ENTRY(m_strMap, epspmDISABLED);
+ MAP_ENTRY(m_strMap, epspmENABLED);
+} // End of void Init_SS_ProductionMode_StrMap(std::map<EPWR_PROD_MODE_TYPE, SS_String> & m_strMap)
+class EnumStringMap< EPWR_PROD_MODE_TYPE, Init_SS_ProductionMode_StrMap>
+ m_oSS_ProductionModeMap;
+SS_String GetStr(EPWR_PROD_MODE_TYPE f_enum) {
+ return m_oSS_ProductionModeMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_StartupStage_StrMap(std::map<EPWR_STARTUP_STAGE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epssusfINVALID);
+ MAP_ENTRY(m_strMap, epssusSYSTEM_SERVICES_STARTED);
+ MAP_ENTRY(m_strMap, epssusALL_SERVICES_LAUNCHED);
+} // End of void Init_SS_StartupStage_StrMap(std::map<EPWR_STARTUP_STAGE_TYPE, SS_String> & m_strMap)
+class EnumStringMap< EPWR_STARTUP_STAGE_TYPE, Init_SS_StartupStage_StrMap>
+ m_oSS_StartupStageMap;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(EPWR_STARTUP_STAGE_TYPE f_enum) {
+ return m_oSS_StartupStageMap.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_SS_SystemMode_StrMap(std::map<EPWR_SYSTEM_MODE_INFO, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epssinfINVALID);
+ MAP_ENTRY(m_strMap, epssinfNORMAL);
+ MAP_ENTRY(m_strMap, epssinfPROGRAMMING);
+} // End of void Init_SS_SystemMode_StrMap(std::map<EPWR_SYSTEM_MODE_INFO, SS_String> & m_strMap)
+class EnumStringMap< EPWR_SYSTEM_MODE_INFO, Init_SS_SystemMode_StrMap>
+ m_oSS_SystemModeMap;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(EPWR_SYSTEM_MODE_INFO f_enum) {
+ return m_oSS_SystemModeMap.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_SS_TransportMode_StrMap(std::map<EPWR_TRANSPORT_MODE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epstmINVALID);
+ MAP_ENTRY(m_strMap, epstmDISABLED);
+ MAP_ENTRY(m_strMap, epstmENABLED);
+} // End of void Init_SS_TransportMode_StrMap(std::map<EPWR_TRANSPORT_MODE_TYPE, SS_String> & m_strMap)
+class EnumStringMap< EPWR_TRANSPORT_MODE_TYPE, Init_SS_TransportMode_StrMap>
+ m_oSS_TransportModeMap;
+SS_String GetStr(EPWR_TRANSPORT_MODE_TYPE f_enum) {
+ return m_oSS_TransportModeMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_EInterfaceunifiedStatus_StrMap(std::map<EFrameworkunifiedStatus, SS_String> & m_strMap); // NOLINT (runtime/references)
+class EnumStringMap< EFrameworkunifiedStatus, Init_EInterfaceunifiedStatus_StrMap> m_oEInterfaceunifiedStatusMap;
+SS_String GetStr(EFrameworkunifiedStatus f_enum) {
+ return m_oEInterfaceunifiedStatusMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_SystemManagerProtocol_StrMap(std::map<SS_SystemManagerProtocol,
+ SS_String> & m_strMap); // NOLINT (runtime/references)
+class EnumStringMap< SS_SystemManagerProtocol,
+ Init_SS_SystemManagerProtocol_StrMap> m_oSSSMProtocolMap;
+SS_String GetStr(SS_SystemManagerProtocol f_enum) {
+ return m_oSSSMProtocolMap.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_ColdStart_StrMap(std::map<EPWR_SC_COLD_START_REQ_TYPE,
+ SS_String> &m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epsscrtINVALID);
+ MAP_ENTRY(m_strMap, epsscrtNOT_REQUIRED);
+ MAP_ENTRY(m_strMap, epsscrtREQUIRED);
+}
+class EnumStringMap< EPWR_SC_COLD_START_REQ_TYPE,
+ Init_SS_ColdStart_StrMap> m_oSSColdStart_Map;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(EPWR_SC_COLD_START_REQ_TYPE f_enum) {
+ return m_oSSColdStart_Map.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_SS__CWORD56__BootMode_StrMap(std::map<EPWR_SC__CWORD56__BOOT_MODE_TYPE, SS_String> &m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, eps_CWORD56_bmINVALID);
+ MAP_ENTRY(m_strMap, eps_CWORD56_bmAPPLICATION_MODE);
+ MAP_ENTRY(m_strMap, eps_CWORD56_bmPROGRAMMING_MODE);
+} // End of void Init_SS__CWORD56__BootMode_StrMap(std::map<EPWR_SC__CWORD56__BOOT_MODE_TYPE, SS_String> &m_strMap)
+class EnumStringMap< EPWR_SC__CWORD56__BOOT_MODE_TYPE,
+ Init_SS__CWORD56__BootMode_StrMap> m_oSS_CWORD56_BootMode_Map;
+SS_String GetStr(EPWR_SC__CWORD56__BOOT_MODE_TYPE f_enum) {
+ return m_oSS_CWORD56_BootMode_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS__CWORD102__BootMode_StrMap(std::map<ESMBootModeInfo, SS_String> &m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, e_SS_SM_BOOT_MODE_INVALID);
+ MAP_ENTRY(m_strMap, e_SS_SM_BOOT_MODE_APPLICATION);
+ MAP_ENTRY(m_strMap, e_SS_SM_BOOT_MODE_PROGRAMMING);
+} // End of void Init_SS__CWORD102__BootMode_StrMap(std::map<ESMBootModeInfo, SS_String> &m_strMap)
+
+class EnumStringMap< ESMBootModeInfo,
+ Init_SS__CWORD102__BootMode_StrMap> m_oSS_CWORD102_BootMode_Map;
+SS_String GetStr(ESMBootModeInfo f_enum) {
+ return m_oSS_CWORD102_BootMode_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_ShutdownTrigger_StrMap(std::map<EPWR_SHUTDOWN_TRIGGER_TYPE,
+ SS_String> & m_strMap); // NOLINT (runtime/references)
+class EnumStringMap< EPWR_SHUTDOWN_TRIGGER_TYPE,
+ Init_SS_ShutdownTrigger_StrMap> m_oSSShutdownTrigger_Map;
+SS_String GetStr(EPWR_SHUTDOWN_TRIGGER_TYPE f_enum) {
+ return m_oSSShutdownTrigger_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_UserMode_StrMap(std::map<EPWR_USER_MODE_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ // Map of System Services User Mode enum values to string description
+ MAP_ENTRY(m_strMap, epsumINVALID);
+ MAP_ENTRY(m_strMap, epsumOFF);
+ MAP_ENTRY(m_strMap, epsumON);
+} // End of void Init_SS_UserMode_StrMap(std::map<EPWR_USER_MODE_TYPE, SS_String> & m_strMap)
+
+class EnumStringMap< EPWR_USER_MODE_TYPE,
+ Init_SS_UserMode_StrMap> m_oSSUserMode_Map;
+SS_String GetStr(EPWR_USER_MODE_TYPE f_enum) {
+ return m_oSSUserMode_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_CpuResetReason_StrMap(std::map<ESMCpuResetReason, SS_String> &m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_NORMAL);
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_DATA_RESET);
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET);
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_GENERIC_ERR);
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_DSP_ERR);
+ MAP_ENTRY(m_strMap, e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR);
+} // End of void Init_SS_CpuResetReason_StrMap(std::map<ESMCpuResetReason, SS_String> &m_strMap)
+class EnumStringMap< ESMCpuResetReason,
+ Init_SS_CpuResetReason_StrMap> m_oSS_CpuResetReason_Map;
+// LCOV_EXCL_START 6:Because the condition cannot be set
+SS_String GetStr(ESMCpuResetReason f_enum) {
+ return m_oSS_CpuResetReason_Map.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_SS_UserModeChangeReason_StrMap(std::map<ePwrServiceUserModeChangeReasonType, SS_String> &m_strMap) { // NOLINT (runtime/references)
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov restrictions(other)
+ MAP_ENTRY(m_strMap, epsumcrNOT_AVAILABLE);
+ MAP_ENTRY(m_strMap, epsumcrON_KEY);
+ MAP_ENTRY(m_strMap, epsumcrPARKING_B);
+ MAP_ENTRY(m_strMap, epsumcrPRE_BA);
+ MAP_ENTRY(m_strMap, epsumcrNORMAL);
+ MAP_ENTRY(m_strMap, epsumcrBACKGROUND_BA);
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov restrictions(other)
+}
+class EnumStringMap< EPWR_USER_MODE_CHANGE_REASON_TYPE,
+ Init_SS_UserModeChangeReason_StrMap> m_oSS_UMCR_Map;
+SS_String GetStr(EPWR_USER_MODE_CHANGE_REASON_TYPE f_enum) {
+ return m_oSS_UMCR_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_SS_StartupReason_StrMap(std::map<EPWR_WAKEUP_FACTOR_TYPE,
+ SS_String> & m_strMap); // NOLINT (runtime/references)
+class EnumStringMap< EPWR_WAKEUP_FACTOR_TYPE ,
+ Init_SS_StartupReason_StrMap> m_oSSStartupReason_Map;
+SS_String GetStr(EPWR_WAKEUP_FACTOR_TYPE f_enum) {
+ return m_oSSStartupReason_Map.GetStr(f_enum);
+}
+
+//******************************************************************************
+void Init_EErrorEventType_StrMap(std::map<EErrorEventType, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, eErrorEventTypeProcessCrash);
+ MAP_ENTRY(m_strMap, eErrorEventTypeHeartBeatFailure);
+ MAP_ENTRY(m_strMap, eErrorEventTypeSystemLowMemory);
+ MAP_ENTRY(m_strMap, eErrorEventTypeReserved1);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedUserForceReset);
+ MAP_ENTRY(m_strMap, eErrorEventTypeReserved2);
+ MAP_ENTRY(m_strMap, eErrorEventTypeReserved3);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectAllLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeBootMicroReset);
+ MAP_ENTRY(m_strMap, eErrorEventTypeProcessExit);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectScreenShot);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeEelExport);
+ MAP_ENTRY(m_strMap, eErrorEventTypeInterfaceunifiedEmmcLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeDiagEvent);
+ MAP_ENTRY(m_strMap, eErrorEventTypeCanEvent);
+ MAP_ENTRY(m_strMap, eErrorEventTypeDtcEvent);
+ MAP_ENTRY(m_strMap, eErrorEventTypeModConnFailed);
+ MAP_ENTRY(m_strMap, eErrorEventTypeStartRespFailed);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedCollectDevLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeModuleInvokedResetRequest);
+ MAP_ENTRY(m_strMap, eErrorEventTypeModuleInvokedCollectDebugLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeUserInvokedClearLogs);
+ MAP_ENTRY(m_strMap, eErrorEventTypeGroupRelaunch);
+ MAP_ENTRY(m_strMap, eErrorEventTypeMaxValue);
+} // End of void Init_EErrorEventType_StrMap(std::map<EErrorEventType, SS_String> & m_strMap)
+
+void Init_SS_SystemManagerProtocol_StrMap(std::map<SS_SystemManagerProtocol, SS_String> &m_strMap) { // NOLINT (runtime/references)
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov restrictions(other)
+ MAP_ENTRY(m_strMap, SS_SM_NOTIFY_SYSTEM_LAUNCH_COMPLETE);
+ MAP_ENTRY(m_strMap, SS_SM_PROTOCOL_INTERFACE_END);
+ MAP_ENTRY(m_strMap, SS_SM_START);
+ MAP_ENTRY(m_strMap, SS_SM_START_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_STOP);
+ MAP_ENTRY(m_strMap, SS_SM_STOP_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_PRE_START);
+ MAP_ENTRY(m_strMap, SS_SM_PRE_START_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_PRE_STOP);
+ MAP_ENTRY(m_strMap, SS_SM_PRE_STOP_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_START);
+ MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_START_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_STOP);
+ MAP_ENTRY(m_strMap, SS_SM_BACKGROUND_STOP_COMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_GET_START_EXT_INFO);
+ MAP_ENTRY(m_strMap, SS_SM_GET_STOP_EXT_INFO);
+ MAP_ENTRY(m_strMap, SS_SM_WAKEUP_MODULES_CMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_SHUTDOWN_MODULES_CMPL_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_WAKEUP_MODULES);
+ MAP_ENTRY(m_strMap, SS_SM_SHUTDOWN_MODULES);
+ MAP_ENTRY(m_strMap, SS_SM_CRNT_STATE_QUERY);
+ MAP_ENTRY(m_strMap, SS_SM_CRNT_STATE_QUERY_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_SYSTEM_MODE_INFO_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_SYSTEM_MODE_INFO_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_INITCOMP_REP);
+ MAP_ENTRY(m_strMap, SS_SM_DATA_RESET_MODE_SET_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_PROG_UPDATE_STATE_SET_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_CPU_RESET_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_REMOTE_DATA_RESET_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_FWD_START_CONFIRMATION_MSG_RESP);
+ MAP_ENTRY(m_strMap, SS_SM_POWER_REQUEST_MSG);
+ MAP_ENTRY(m_strMap, SS_SM_POWER_REQUEST_MSG_RESP);
+ MAP_ENTRY(m_strMap, SS_SM_USER_MODE_SET_RESP);
+
+ MAP_ENTRY(m_strMap, SS_SM_EVENT_ERROR);
+ MAP_ENTRY(m_strMap, SS_SM_EVENT_ERROR_TO_SSL);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_START_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_START_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_ARTIFACT_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_ARTIFACT_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_COMPLETE);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_LOGGING_COMPLETE_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_LOGGER_START_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_DEBUG_DUMP_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_BOOT_MICRO_LOG_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_TIMER_ID_CORE_FILE_POLL);
+ MAP_ENTRY(m_strMap, SS_SM_USER_INVOKED_LOG_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_EEL_EXPORT_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_CLR_LOGS_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_PROCESS_EXIT);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_DIAG_LOG_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_ERROR_EVENT_CAN_LOG_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_GROUP_LAUNCH_TRIGGER);
+ MAP_ENTRY(m_strMap, SS_SM_DEBUG_DUMP);
+ MAP_ENTRY(m_strMap, SS_SM_DEBUG_DUMP_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_CPU_HIGH_LOAD_DETECTED);
+ MAP_ENTRY(m_strMap, SS_SM_PROPAGATE_SYSTEM_ERROR);
+ MAP_ENTRY(m_strMap, SS_SM__CWORD56__HEARTBEAT_REQ);
+ MAP_ENTRY(m_strMap, SS_SM__CWORD56__HEARTBEAT_RSPN);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_RESET_NTF);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_LOG_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_BOOT_MICRO_LOG_RSP);
+ MAP_ENTRY(m_strMap, SS_SM_NEXT_WAKEUP_TYPE_SET_REQ);
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov restrictions(other)
+} // End of void Init_SS_SystemManagerProtocol_StrMap(std::map<SS_SystemManagerProtocol, SS_String> &m_strMap)
+
+
+
+void Init_EInterfaceunifiedStatus_StrMap(std::map<EFrameworkunifiedStatus, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusEmptyMediaList);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSessionLimitMaxedOut);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbRecNotFound);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbResultError);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbExecuteFail);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSemCloseFail);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSemUnlockFail);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusSemLockFail);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFail);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrOther);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusOK);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldBuf);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldHandle);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldHndlType);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldQName);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusMsgQFull);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldNotification);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldParam);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldBufSize);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusInvldID);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusCannotRelease);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusBadConnection);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusExit);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusNotImplemented);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadBusy);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadSelfJoin);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadInvalidVal);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadNotExist);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFault);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusServNotFound);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusServerInUse);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDbIndexing);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusNullPointer);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusMsgNotProcessed);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFileLoadSuccess);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusFileLoadError);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusAccessError);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusDuplicate);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusMsgQEmpty);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusThreadAlreadyRunning);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrNoEBADF);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrNoEAGAIN);
+ MAP_ENTRY(m_strMap, eFrameworkunifiedStatusErrNoEINTR);
+} // End of void Init_EInterfaceunifiedStatus_StrMap(std::map<EFrameworkunifiedStatus, SS_String> & m_strMap){
+
+void Init_SS_ShutdownTrigger_StrMap(std::map<EPWR_SHUTDOWN_TRIGGER_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epssdmsdtINVALID);
+ MAP_ENTRY(m_strMap, epssdmsdtTESTACC_OFF);
+ MAP_ENTRY(m_strMap, epssdmsdtON_KEY);
+ MAP_ENTRY(m_strMap, epssdmsdtIGN_LOCK);
+ MAP_ENTRY(m_strMap, epssdmsdtPWR_SAVE);
+ MAP_ENTRY(m_strMap, epssdmsdtTMP_STARTUP);
+ MAP_ENTRY(m_strMap, epssdmsdtDIAG_DEACTIVATION);
+ MAP_ENTRY(m_strMap, epssdmsdtABNORMAL_VOLTAGE);
+ MAP_ENTRY(m_strMap, epssdmsdtABNORMAL_TEMP);
+ MAP_ENTRY(m_strMap, epssdmsdtBATTERYCUTOFF);
+ MAP_ENTRY(m_strMap, epssdmsdtLIMPHOME);
+ MAP_ENTRY(m_strMap, epssdmsdtHU_CAN_ERROR);
+ MAP_ENTRY(m_strMap, epssdmsdtBODY_CAN_ERROR);
+ MAP_ENTRY(m_strMap, epssdmsdtTRANSPORT_MODE);
+ MAP_ENTRY(m_strMap, epssdmsdtPRODUCTION_MODE);
+ MAP_ENTRY(m_strMap, epssdmsdtIGN_OFF);
+ MAP_ENTRY(m_strMap, epssdmsdtGENERIC_ERROR_RESET);
+ MAP_ENTRY(m_strMap, epssdmsdtFATAL_ERROR_RESET);
+ MAP_ENTRY(m_strMap, epssdmsdtUSER_DATA_RESET);
+ MAP_ENTRY(m_strMap, epssdmsdtFACTORY_DATA_RESET);
+ MAP_ENTRY(m_strMap, epssdmsdtFAST_SLEEP_MODE);
+ MAP_ENTRY(m_strMap, epssdmsdtNORMAL_RESET);
+} // End of void Init_SS_ShutdownTrigger_StrMap(std::map<EPWR_SHUTDOWN_TRIGGER_TYPE, SS_String> & m_strMap)
+
+void Init_SS_StartupReason_StrMap(std::map<EPWR_WAKEUP_FACTOR_TYPE, SS_String> & m_strMap) { // NOLINT (runtime/references)
+ MAP_ENTRY(m_strMap, epswfINVALID);
+ MAP_ENTRY(m_strMap, epswfTESTACC);
+ MAP_ENTRY(m_strMap, epswfON_KEY);
+ MAP_ENTRY(m_strMap, epswfIGN_ACC);
+ MAP_ENTRY(m_strMap, epswfDR_OPEN_CLOSE);
+ MAP_ENTRY(m_strMap, epswfDX_ACTIVATION);
+ MAP_ENTRY(m_strMap, epswfPASS_ACTIVATION);
+ MAP_ENTRY(m_strMap, epswfSPVACTIVATION);
+ MAP_ENTRY(m_strMap, epswfUSER_DATA_RESET);
+} // LCOV_EXCL_BR_LINE 10:Because the last line
+// End of void Init_SS_WakeupFactor_StrMap(std::map<EPWR_WAKEUP_FACTOR_TYPE, SS_String> & m_strMap)
+
+// EOF ss_string_maps.cpp
+
+
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_system_process.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_system_process.cpp
new file mode 100755
index 0000000..71a969a
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_system_process.cpp
@@ -0,0 +1,1147 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "system_service/ss_system_process.h"
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <limits.h>
+#include <pwd.h>
+#include <grp.h>
+#include <elfio/elfio_dump.hpp>
+
+#include <string.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <assert.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <vector>
+#include "ss_system_if_interfaceunifiedlog.h"
+
+const char* iProcess_DEFAULT_PROCESS_USER_NAME = "default_user";
+uid_t iProcess_DEFAULT_PROCESS_USER = 4999;
+gid_t iPrpocess_DEFAULT_PROCESS_GROUP = 4999;
+
+/**
+ * Process: Called when the class is instantiated.
+ *
+ * @return
+ */
+Process::Process(int cpu_assign) :
+ m_lValidationTag(lProcess_VALIDATION_VALUE),
+ m_cpu_assign(cpu_assign),
+ m_tProcessId(-1),
+ m_eProcessLoadMode(NOWAIT),
+ m_strFile(""),
+ m_strProcessName(""),
+ m_iErrorCode(0),
+ m_fAutoKill(TRUE),
+ m_iReturnCode(0) {
+}
+
+
+/**
+ * ~Process: Called when the object is destroyed.
+ *
+ * @return
+ */
+Process::~Process() {
+ // ASSERT_VALID (this);
+
+ //
+ // Set the validation tag to NOT valid
+ m_lValidationTag = 0;
+
+ //
+ // Cleanup after ourselves...
+ //
+ if ((m_fAutoKill) && (m_tProcessId != -1) && (m_tProcessId != getpid())) {
+ KillProcess(); // Then remove the process from PosixBasedOS001
+ }
+}
+
+/**
+ * Process: Used to create an object and copy another
+ * object to the new object.
+ *
+ * @param p_rhs_i Reference to the class being copied from.
+ * @return Process( const
+ */
+Process::Process(const Process& p_rhs_i) {
+ // Copy data from the specified object to this object.
+ Copy(p_rhs_i);
+}
+
+
+/**
+ * operator=: Called when one object is assigned
+ * to another object.
+ *
+ * @param p_rhs_i Reference to the class being copied from.
+ * @return Process&
+ */
+Process& Process::operator= (const Process& p_rhs_i) {
+ // Don't do anything if we're being copied on to ourselves.
+ if (this == &p_rhs_i) return (*this);
+
+ // Copy data from the specified object to this object.
+ Copy(p_rhs_i);
+
+ return (*this);
+}
+
+
+/**
+ * Copy: Copies data members from the specified object to this object.
+ * No attempt is made to free dynamically allocated objects within
+ * this object (you must do that before calling this function).
+ *
+ * @param p_rhs_i
+ * @return void
+ */
+void Process::Copy(const Process& p_rhs_i) {
+ // Copy data from the specified object to this object.
+ m_lValidationTag = p_rhs_i.m_lValidationTag;
+
+ m_tProcessId = p_rhs_i.m_tProcessId;
+ m_eProcessLoadMode = p_rhs_i.m_eProcessLoadMode;
+ m_strFile = p_rhs_i.m_strFile;
+ m_strlstArgv = p_rhs_i.m_strlstArgv;
+ m_strProcessName = p_rhs_i.m_strProcessName;
+ m_iErrorCode = p_rhs_i.m_iErrorCode;
+ m_fAutoKill = p_rhs_i.m_fAutoKill;
+ m_iReturnCode = p_rhs_i.m_iReturnCode;
+}
+
+/**
+ * GetProcessReturnCode: This function will return the processes
+ * exit/return code. This is not the value of ERRNO as returned by
+ * GetLastPosixBasedOS001ErrorCode().
+ *
+ * @return code from the process
+ */
+int Process::GetProcessReturnCode() {
+ int iProcessReturn = 0;
+ if (waitpid(m_tProcessId, &iProcessReturn, WNOHANG) > 0) {
+ m_iReturnCode = WEXITSTATUS(iProcessReturn);
+ }
+
+ return m_iReturnCode;
+}
+
+static int getIdsFromUserName(const char* user_name, uid_t *uid, gid_t *gid) {
+ int ret = -1;
+
+ try {
+ if (NULL == user_name) {
+ *uid = geteuid();
+ *gid = getegid();
+ } else {
+ static __thread size_t bufSize = 0;
+ static __thread char *buf = NULL;
+ struct passwd pwd;
+ struct passwd *result;
+
+ if (0 == bufSize) {
+ struct stat statInfo;
+
+ bufSize = -1;
+
+ if (0 != stat("/etc/passwd", &statInfo) || 0 >= statInfo.st_size) {
+ throw "/etc/passwd is not exist";
+ }
+
+ bufSize = statInfo.st_size * 2;
+
+ // Since SystemManager is a resident service,
+ // the area secured here is not explicity released by free()
+ // in anticipation of release at the end of the process
+ buf = reinterpret_cast<char *>(malloc(sizeof(char) * bufSize));
+ if (NULL == buf) {
+ throw "malloc()";
+ }
+ }
+
+ if (NULL == buf) {
+ throw "buf = NULL";
+ }
+
+ ret = getpwnam_r(user_name, &pwd, buf, bufSize, &result);
+ if (ret == 0 && result != NULL) {
+ *uid = pwd.pw_uid;
+ *gid = pwd.pw_gid;
+ } else {
+ throw "getpwnam_r()";
+ }
+ }
+
+ ret = 0;
+ }
+
+ catch (const char *e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "ERROR:%s", e);
+ }
+
+ return ret;
+}
+
+/**
+ * CreateProcess: This method will create a PosixBasedOS001 process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ * Upon successful creation of the process, the scheduling policy and priority
+ * of the process will be set to the provided values. The user can change these
+ * values through the SetSchedulingPolicy() and SetPriority() method calls.
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_strlstArgv_i List of ARGV values for new process
+ * @param p_eMode_i Mode to create and load new process
+ * WAIT - The invoked program is loaded into available memory, is executed,
+ * and then the original program resumes execution.
+ * NOWAIT - Causes the current program to execute concurrently with the new child process.
+ * @param p_strProcessName_i This is the name that will be registered to the OS for this process
+ * @param p_eSchedulingPolicy_i Scheduling Policy for this process
+ * FIFO - A fixed priority scheduler in which the highest ready process runs until it
+ * blocks or is preempted by a higher priority process.
+ * ROUND_ROBIN - The same as FIFO, except processes at the same priority level time-slice.
+ * OTHER - A general time sharing scheduler in which a process decays in priority if it
+ * consumes too much processor before blocking. It reverts to its default priority
+ * when it blocks. Should it fail to run over a 2 second period and it has decayed
+ * then it's boosted one priority level up to a maximum of its default priority.
+ * @param p_iPriority_i Priority for this process
+ * @param p_lSpawnFlags_i Spawning flags. These are PosixBasedOS001 specific....
+ * @return void
+ */
+void Process::CreateProcess(
+ const SS_String& p_strFile_i, // Path and Filename of executable to create process for
+ const StringList& p_strlstArgv_i, // List of ARGV values for new process
+ const eProcessLoadMode p_eMode_i, // Mode to create and load new process
+ const SS_String& p_strProcessName_i, // This is the name that will be registered to the OS for this process
+ const eProcessSchedulingPolicy p_eSchedulingPolicy_i, // Scheduling Policy for this process
+ const int p_iPriority_i, // Priority for this process
+ const char* unix_user_name,
+ const long p_lSpawnFlags_i // Posix Spawning flags. These are PosixBasedOS001 specific.... // NOLINT (runtime/int)
+) {
+ //========================================================================================
+ // Perform some idiot checking of the parameters that are passed in.
+ // Check the priority level that is being set to make sure it is in bounds.
+ // Then save off the calling parameters into the objects member variables.
+ // Also check the number of valid calling (argv[]) parameters passed in
+ //========================================================================================
+ m_iErrorCode = 0; // Initialize to NO ERROR
+ m_iReturnCode = 0; // Initialize value (0 usually means good in unix/PosixBasedOS001)
+
+ //
+ // Process filename os provided
+ //
+ if (p_strFile_i.empty()) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+
+ //
+ // Save off process calling arguments
+ //
+ m_eProcessLoadMode = p_eMode_i;
+
+ m_strFile = p_strFile_i;
+
+ if (!p_strProcessName_i.empty())
+ m_strProcessName = p_strProcessName_i;
+
+ //
+ // Copy Argument List...
+ //
+ SetCallingArgumentList(p_strlstArgv_i);
+
+ //
+ // Valid number of calling arguments
+ //
+ int iNumberElements = m_strlstArgv.size();
+ if (iNumberElements > (iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS - 3)) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+
+
+ //========================================================================================
+ // Initialize to the beginning of the provided argument list.
+ // Allocate an array of buffer pointers that will be used for the ARGV calling parameters
+ // for the specified process.
+ // Set the ARGV[0] equal to the process name being created
+ // Set the ARGV[1] equal to the process name to be registered with the OS.
+ // If p_strProcessName_is NULL, do not set the cArgv[1] parameter
+ // Populate the array that will hold the argument list for the new process we are creating.
+ //========================================================================================
+ //
+
+ int iLoop = 1;
+ char * cArgv[iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS];
+
+ cArgv[0] = basename(const_cast<char *>(p_strFile_i.c_str())); // Set the executable filename
+
+ // Go through the list of provided argv calling parameters to the CreateProcess
+ // function, and copy the arguments to the ARGV[] calling argument which will be passed
+ // into the process being created.
+ StringListIter at = m_strlstArgv.begin();
+ for (; at != m_strlstArgv.end(); at++, iLoop++) {
+ cArgv[iLoop] = const_cast<char *>(at->c_str());
+ }
+
+ cArgv[iLoop] = NULL;
+
+ try {
+ CL_ProcessAttr_t clAttr;
+ CL_ProcessSchedPolicy_t clPolicy = CL_PROCESS_SCHED_POLICY_OTHER;
+ int clPriority = 0;
+
+ if (0 != CL_ProcessCreateAttrInit(&clAttr)) {
+ throw "CL_ProcessCreateAttrInit()";
+ }
+
+
+ // In order to collect even the child processes of the service, all are group leaders.
+ if (0 != CL_ProcessCreateAttrSetGroup(&clAttr, 1)) {
+ throw "CL_ProcessCreateAttrInit()";
+ }
+
+ if (0 != CL_ProcessCreateAttrSetCpuAssign(&clAttr, m_cpu_assign)) {
+ throw "CL_ProcessCreateAttrSetCpuAssign()";
+ }
+
+ switch (p_eSchedulingPolicy_i) {
+ case FIFO:
+ clPolicy = CL_PROCESS_SCHED_POLICY_FIFO;
+ break;
+ case ROUND_ROBIN:
+ clPolicy = CL_PROCESS_SCHED_POLICY_RR;
+ break;
+ case OTHER:
+ clPolicy = CL_PROCESS_SCHED_POLICY_OTHER;
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "p_eSchedulingPolicy_i = %d", p_eSchedulingPolicy_i);
+ break;
+ }
+
+ switch (p_eSchedulingPolicy_i) {
+ case FIFO:
+ case ROUND_ROBIN:
+ if ((1 > p_iPriority_i) || (p_iPriority_i > 99)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "p_eSchedulingPolicy_i = %d", p_eSchedulingPolicy_i);
+ } else {
+ clPriority = p_iPriority_i;
+ }
+ break;
+ case OTHER:
+ default:
+ if ((-20 > p_iPriority_i) || (p_iPriority_i > 19)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "p_eSchedulingPolicy_i = %d", p_eSchedulingPolicy_i);
+ } else {
+ clPriority = p_iPriority_i;
+ }
+ break;
+ }
+
+ if (0 != CL_ProcessCreateAttrSetSchedule(&clAttr, clPolicy, clPriority)) {
+ throw "CL_ProcessCreateAttrSetSchedule()";
+ }
+
+ uid_t uid = 0;
+ gid_t gid = 0;
+
+ if (0 != getIdsFromUserName(unix_user_name, &uid, &gid)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "unexpected unix_user_name [%s]", unix_user_name);
+ uid = geteuid();
+ gid = getegid();
+ }
+ if (uid == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "!! uid=root %s", m_strFile.c_str());
+ uid = UINT_MAX;
+ }
+ if (0 != CL_ProcessCreateAttrSetUid(&clAttr, uid)) {
+ throw "CL_ProcessCreateAttrSetUid()";
+ }
+
+ if (0 != CL_ProcessCreateAttrSetGid(&clAttr, gid)) {
+ throw "CL_ProcessCreateAttrSetGid()";
+ }
+
+ if (0 != CL_ProcessCreateAttrSetDisableCloseFds(&clAttr)) {
+ throw "CL_ProcessCreateAttrSetDisableCloseFds()";
+ }
+ char environment_string[2048] = {0}; // Size is provisional
+ fprintf(stderr, "[%s](%d)Process Create Target : %s \n", __func__, __LINE__, m_strFile.c_str());
+
+ CheckLdPreLoad(&m_strFile, environment_string);
+
+ CreateProcess(&m_strFile, const_cast<char* const*>(cArgv), environment_string, &clAttr);
+ }
+
+ catch(const char *e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "%s", e);
+ }
+}
+
+/**
+ * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ * @param p_str_file Path and Filename of executable to create process for
+ * @param c_argv use process arguments
+ * @param environment_string Set LD_PRELOAD string
+ * @param cl_attr CL_ProcessAttr_t
+ * @return void
+ */
+void Process::CreateProcess(const SS_String *p_str_file, char* const*c_argv, char* environment_string,
+ const CL_ProcessAttr_t *cl_attr) {
+ try {
+ if ((p_str_file == NULL) || (c_argv == NULL) || (cl_attr == NULL)) {
+ throw "CreateProcess() Invaild Param";
+ }
+
+ int process_id = -1;
+ if (environment_string[0] == '\0') {
+ // If there is no LD_PRELOAD setting, set envp to NULL
+ process_id = CL_ProcessCreate(p_str_file->c_str(), c_argv, NULL, cl_attr);
+ } else {
+ // vector holding preferences
+ std::vector<SS_String> *vec_environ = GetEnvironVector();
+
+ // Set LD_PRELOAD string as the last element
+ SS_String ld_preload_string = SS_String(environment_string);
+ vec_environ->push_back(environment_string);
+
+ // Number of acquired environment variables + 1(For terminal) memory allocation
+ size_t env_num = sizeof(char*) * (vec_environ->size() + 1);
+ char **p_environment = static_cast<char **>(malloc(env_num));
+ memset(p_environment, 0x00, env_num);
+
+ // Create environment variable list
+ int i = 0;
+ char **p_environment_tmp = p_environment;
+ for (std::vector<SS_String>::iterator itr = vec_environ->begin(); itr != vec_environ->end(); itr++, i++) {
+ p_environment_tmp[i] = static_cast<char *>(malloc(sizeof(char) * (itr->length() + 1)));
+
+ snprintf(p_environment_tmp[i], itr->length() + 1, "%s", itr->c_str());
+ }
+
+ // Set envp for environment variable
+ process_id = CL_ProcessCreate(p_str_file->c_str(), c_argv, p_environment, cl_attr);
+
+ // Free memory
+ i = 0;
+ p_environment_tmp = p_environment;
+ for (std::vector<SS_String>::iterator itr = vec_environ->begin(); itr != vec_environ->end(); itr++, i++) {
+ free(p_environment_tmp[i]);
+ }
+
+ free(p_environment);
+ delete(vec_environ);
+ }
+
+ if (process_id == -1) {
+ throw "CL_ProcessCreate()";
+ }
+
+ m_tProcessId = process_id;
+ }
+ catch (const char *e) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "%s", e);
+ }
+}
+/**
+ * CreateProcess: This method will create a PosixBasedOS001 process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_strProcessName This is the name that will be registered to the OS for this process
+ * @return void
+ */
+void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName,
+ const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int)
+ StringList strlstArgv;
+
+ try {
+ CreateProcess(p_strFile_i,
+ strlstArgv,
+ NOWAIT,
+ p_strProcessName,
+ FIFO,
+ iProcess_DEFAULT_PROCESS_PRIORITY,
+ unix_user_name,
+ p_lSpawnFlags_i);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+/**
+ * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_strProcessName This is the name that will be registered to the OS for this process
+ * @param p_iPriority_i Priority of process
+ * @return void
+ */
+void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName, const int p_iPriority_i,
+ const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int)
+ StringList strlstArgv;
+
+ try {
+ eProcessSchedulingPolicy policy;
+
+ if (0 < p_iPriority_i) {
+ policy = FIFO;
+ } else {
+ policy = OTHER;
+ }
+
+ CreateProcess(p_strFile_i,
+ strlstArgv,
+ NOWAIT,
+ p_strProcessName,
+ policy,
+ p_iPriority_i,
+ unix_user_name,
+ p_lSpawnFlags_i);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+/**
+ * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_lSpawnFlags_i Spawning flags. These are PosixBasedOS001 specific.
+ * @return void
+ */
+void Process::CreateProcess(const SS_String& p_strFile_i, const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int)
+ StringList strlstArgv;
+
+ try {
+ CreateProcess(p_strFile_i,
+ strlstArgv,
+ NOWAIT,
+ basename(const_cast<char *>(p_strFile_i.c_str())),
+ FIFO,
+ iProcess_DEFAULT_PROCESS_PRIORITY,
+ unix_user_name,
+ p_lSpawnFlags_i);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+
+/**
+ * CreateProcess: This method will create a process with the executable provided and mode as a calling parameter.
+ * The caller can also provide a list of arguments that will be provided to the executable at startup.
+ * The calling p_strProcessName parameter is a textual name that will be
+ * associated with the newly created process by the OS. The process state information
+ * will be maintained by this object.
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_strProcessName This is the name that will be registered to the OS for this process
+ * @param p_strlstArgv_i List of ARGV values for new process
+ * @param p_lSpawnFlags_i Spawning flags. These are PosixBasedOS001 specific.
+ * @return void
+ */
+void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName_i,
+ const StringList& p_strlstArgv_i, const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int)
+ try {
+ CreateProcess(p_strFile_i,
+ p_strlstArgv_i,
+ NOWAIT,
+ p_strProcessName_i,
+ FIFO,
+ iProcess_DEFAULT_PROCESS_PRIORITY,
+ unix_user_name,
+ p_lSpawnFlags_i);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+void Process::CreateProcess(const SS_String& p_strFile_i, const SS_String& p_strProcessName_i, const int p_iPriority_i,
+ const StringList& p_strlstArgv_i, const char* unix_user_name, const long p_lSpawnFlags_i) { // NOLINT (runtime/int)
+ try {
+ eProcessSchedulingPolicy policy;
+
+ if (0 < p_iPriority_i) {
+ policy = FIFO;
+ } else {
+ policy = OTHER;
+ }
+
+ CreateProcess(p_strFile_i,
+ p_strlstArgv_i,
+ NOWAIT,
+ p_strProcessName_i,
+ policy,
+ p_iPriority_i,
+ unix_user_name,
+ p_lSpawnFlags_i);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+/**
+ * CreateProcessWait: This method will create a process with the executable provided.
+ * The process state information will be maintained by this object.
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @return void
+ */
+void Process::CreateProcessWait(const SS_String& p_strFile_i) {
+ StringList strlstArgv;
+
+ try {
+ CreateProcess(p_strFile_i,
+ strlstArgv,
+ WAIT,
+ basename(const_cast<char *>(p_strFile_i.c_str())),
+ FIFO,
+ iProcess_DEFAULT_PROCESS_PRIORITY,
+ iProcess_DEFAULT_PROCESS_USER_NAME,
+ iProcess_DEFAULT_PROCESS_FLAGS);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+/**
+ * CreateProcessWait: This method will create a PosixBasedOS001 process with the executable provided.
+ * The process state information will be maintained by this object.
+ *
+ *
+ * @param p_strFile_i Path and Filename of executable to create process for
+ * @param p_strlstArguments_i List of process calling arguments
+ * @return void
+ */
+void Process::CreateProcessWait(const SS_String& p_strFile_i, const StringList& p_strlstArguments_i) {
+ try {
+ CreateProcess(p_strFile_i,
+ p_strlstArguments_i,
+ WAIT,
+ basename(const_cast<char *>(p_strFile_i.c_str())),
+ FIFO,
+ iProcess_DEFAULT_PROCESS_PRIORITY,
+ iProcess_DEFAULT_PROCESS_USER_NAME,
+ iProcess_DEFAULT_PROCESS_FLAGS);
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+
+/**
+ * KillProcess: This method will delete the process represented by this object. All variables associated
+ * with this object will be initialized to a know value.
+ *
+ * @param
+ * @return void
+ */
+void Process::KillProcess(int signal) {
+ //=====================================================================================
+ // Intialize the objects m_iErrorCode member variable to 0 (no error).
+ // Then try to delete the process that this object represents.
+ m_iErrorCode = 0;
+
+ if (DoesProcessExist()) {
+ if (-1 == killpg(m_tProcessId, signal)) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+ }
+
+ //
+ // If no errors, clear out any process specific member variables for this object
+ //
+ m_tProcessId = -1;
+ m_strProcessName = "";
+}
+
+/**
+ * SetSchedulingPolicy: This method will change the scheduling policy for the process this
+ * object represents.
+ *
+ * @param p_eSchedulingPolicy_i Scheduling policy
+ * @return void
+ */
+void Process::SetSchedulingPolicy(
+ const eProcessSchedulingPolicy p_eSchedulingPolicy_i // Scheduling policy
+) {
+ //=======================================================================================
+ // Attempt to change the scheduling policy for the process that this object
+ // represents. If the change fails, restore the previous settings.
+ //
+ m_iErrorCode = 0;
+ struct sched_param cur_sch_params;
+ sched_getparam(m_tProcessId, &cur_sch_params);
+ if (0 != sched_setscheduler(m_tProcessId, ConvertToPosixBasedOS001SchedularPolicy(p_eSchedulingPolicy_i),
+ &cur_sch_params)) {
+ m_iErrorCode = errno;
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+/**
+ * SetPriority: This method will change the priority for the process this
+ * object represents.
+ *
+ * @param p_iPriority_i Scheduling Policy for this process
+ * @return void
+ */
+void Process::SetPriority(const int p_iPriority_i) {
+ //=======================================================================================
+ // Attempt to change the priority for the process that this object
+ // represents. If the change fails, restore the previous settings.
+ //
+ m_iErrorCode = 0;
+ struct sched_param cur_sch_params;
+ sched_getparam(m_tProcessId, &cur_sch_params);
+ cur_sch_params.sched_priority = p_iPriority_i;
+
+ if (-1 == sched_setparam(m_tProcessId, &cur_sch_params)) {
+ m_iErrorCode = errno;
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+/**
+ * IncreasePriorityByOne: This method will increase the priority for the process this
+ * object represents by one.
+ *
+ * @param
+ * @return void
+ */
+void Process::IncreasePriorityByOne(void) {
+ //================================================================================
+ // Retrieve the current priority of the process. Check to see if already at max.
+ // If so just return. Otherwise increase by one and set the priority...
+ //
+ try {
+ int iCurrentPriority = GetPriority();
+ if (iCurrentPriority < iProcess_MAXIMUM_PROCESS_PRIORITY) {
+ SetPriority(iCurrentPriority + 1);
+ }
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+/**
+ * DecreasePriorityByOne: This method will decrease the priority for the process this
+ * object represents by one.
+ *
+ *
+ * @return void
+ */
+void Process::DecreasePriorityByOne(void) {
+ //================================================================================
+ // Retrieve the current priority of the process. Check to see if already at minimum.
+ // If so just return. Otherwise decrease by one and set the priority...
+ //
+ try {
+ int iCurrentPriority = GetPriority();
+ if (iCurrentPriority > 1) {
+ SetPriority(iCurrentPriority - 1);
+ }
+ }
+ catch (...) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+}
+
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// ConvertToPosixBasedOS001SchedularPolicy
+//
+// This method will return to the caller the equivalent PosixBasedOS001 schedular policy for the process
+// that this object represents
+//
+//
+// Calling Arguments:
+// NONE
+//
+// Return Argument:
+// FIFO, // A fixed priority scheduler in which the highest ready process runs until it
+// // blocks or is preempted by a higher priority process.
+// ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice.
+// OTHER // A general time sharing scheduler in which a process decays in priority if it
+// // consumes too much processor before blocking. It reverts to its default priority
+// // when it blocks. Should it fail to run over a 2 second period and it has decayed
+// // then it's boosted one priority level up to a maximum of its default priority.
+//
+int const Process::ConvertToPosixBasedOS001SchedularPolicy(const eProcessSchedulingPolicy p_eSchedulingPolicy_i) {
+ int iReturnValue = SCHED_RR; // Default is RR
+ switch (p_eSchedulingPolicy_i) {
+ case FIFO:
+ {
+ iReturnValue = SCHED_FIFO;
+ break;
+ }
+
+ case ROUND_ROBIN:
+ {
+ iReturnValue = SCHED_RR;
+ break;
+ }
+
+ case OTHER:
+ {
+ iReturnValue = SCHED_OTHER;
+ break;
+ }
+ }
+
+ return iReturnValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// ConvertFromPosixBasedOS001SchedularPolicy
+//
+// This method will return to the caller the eProcessSchedulingPolicy based on the PosixBasedOS001 schedular
+// policy for the process that this object represents
+//
+//
+// Calling Arguments:
+// PosixBasedOS001 Scheduling Policy
+//
+// Return Argument:
+// FIFO, // A fixed priority scheduler in which the highest ready process runs until it
+// // blocks or is preempted by a higher priority process.
+// ROUND_ROBIN, // The same as FIFO, except processes at the same priority level time-slice.
+// OTHER // A general time sharing scheduler in which a process decays in priority if it
+// // consumes too much processor before blocking. It reverts to its default priority
+// // when it blocks. Should it fail to run over a 2 second period and it has decayed
+// // then it's boosted one priority level up to a maximum of its default priority.
+//
+Process::eProcessSchedulingPolicy const Process::ConvertFromPosixBasedOS001SchedularPolicy
+ (const int p_iPosixBasedOS001chedulingPolicy_i) {
+ eProcessSchedulingPolicy ePolicy = ROUND_ROBIN; // Default is RR
+ switch (p_iPosixBasedOS001chedulingPolicy_i) {
+ case SCHED_FIFO:
+ {
+ ePolicy = FIFO;
+ break;
+ }
+
+ case SCHED_RR:
+ {
+ ePolicy = ROUND_ROBIN;
+ break;
+ }
+ case SCHED_OTHER:
+ {
+ ePolicy = OTHER;
+ break;
+ }
+ } // Switch
+
+ return ePolicy;
+}
+
+
+/**
+ * DoesProcessExist: This method will return a BOOLean indicating whether this
+ * process exists.
+ *
+ * @return BOOL TRUE - Process Exists, FALSE - Process does not exist
+ */
+BOOL Process::DoesProcessExist(void) {
+ struct sched_param cur_sch_params;
+ if (-1 >= sched_getparam(m_tProcessId, &cur_sch_params)) { // or the segment data
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+
+/**
+ * SetProcessName: This method will set this objects process name member variable to the
+ * provided string value.
+ *
+ * @param p_strProcessName_i Process Name to set the m_strProcessName member variable to
+ * @return void
+ */
+void Process::SetProcessName(const SS_String& p_strProcessName_i) {
+ //
+ // Idiot checking
+ //
+ assert(!p_strProcessName_i.empty());
+
+ m_strProcessName = p_strProcessName_i;
+}
+
+/**
+ * GetSchedulingPolicy: This method will return to the caller the
+ * currently configured process scheduling policy.
+ *
+ * @return Process::eProcessSchedulingPolicy const
+ */
+Process::eProcessSchedulingPolicy const Process::GetSchedulingPolicy(void) {
+ int policy = 0;
+ if (-1 == (policy = sched_getscheduler(m_tProcessId))) {
+ m_iErrorCode = errno;
+ return ROUND_ROBIN; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+
+ return (ConvertFromPosixBasedOS001SchedularPolicy (policy));
+}
+
+
+
+/**
+ * GetPriority: This method will return to the caller the currently configured
+ * process priority.
+ *
+ * @return int const
+ */
+int const Process::GetPriority(void) {
+ struct sched_param cur_sch_params;
+ if (-1 >= sched_getparam(m_tProcessId, &cur_sch_params)) {
+ m_iErrorCode = errno;
+ return -1; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+
+ return (cur_sch_params.sched_priority);
+}
+
+
+
+/**
+ * SetCallingArgumentList: This method will set the calling argument list
+ * that this object represents.
+ *
+ * @param p_pcArgv_i Pointer to NULL terminated argument list.
+ * @param p_iArgc_i Number of parameters
+ * @return void
+ */
+void Process::SetCallingArgumentList(const char *p_pcArgv_i[], const int p_iArgc_i) {
+ ////////////////////////////////////////////////////////////////////////
+ // Set the executable filename first. This is always the 1st argument
+ // in the argument list. Then set the argument list for the process
+ // which is held in m_strlstArgv.
+ //
+ if (p_iArgc_i > (iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS - 3)) {
+ return; // PAD THIS IS BAD!!! TODO: Change this to something meaningful
+ }
+
+ //
+ // First make sure that the argument list is empty.
+ //
+ if (!m_strlstArgv.empty()) {
+ m_strlstArgv.clear(); // Remove all elements from the current list
+ } // Process Argument list is NOT empty
+
+ //
+ // Once empty, put the new arguments into the list
+ //
+ StringListIter at = m_strlstArgv.begin();
+ int iLoop;
+ for (iLoop = 0; iLoop < p_iArgc_i; iLoop ++) {
+ at = m_strlstArgv.insert(at, p_pcArgv_i[iLoop]);
+ }
+}
+
+
+/**
+ * SetCallingArgumentList: This method will set the calling argument
+ * list that this object represents.
+ *
+ * @param p_strlstParameters_i List of parameters
+ * @return void
+ */
+void Process::SetCallingArgumentList(const StringList& p_strlstParameters_i) {
+ if (p_strlstParameters_i.size()) {
+ m_strlstArgv.clear(); // Empty the current list.
+ m_strlstArgv = p_strlstParameters_i;
+ }
+}
+
+/**
+ * Search if libTestFwCommon.so is dynamically linked.
+ *
+ * @param process_path Search target binary path
+ * @return bool
+ */
+static bool CheckLinkedTestfwLibrary(SS_String *process_path) {
+ if (NULL == process_path) {
+ fprintf(stderr, "[%s](%d)Invaild Param.\n", __func__, __LINE__);
+ return false;
+ }
+
+ ELFIO::elfio reader;
+ if (!reader.load(process_path->c_str())) {
+ fprintf(stderr, "[%s](%d)%s is not ELF!\n", __func__, __LINE__, process_path->c_str());
+ return false;
+ }
+
+ ELFIO::Elf_Half n = reader.sections.size();
+ for ( ELFIO::Elf_Half i = 0; i < n; ++i ) {
+ ELFIO::section* sec = reader.sections[i];
+ if ( SHT_DYNAMIC == sec->get_type() ) {
+ ELFIO::dynamic_section_accessor dynamic(reader, sec);
+
+ ELFIO::Elf_Xword dynamic_num = dynamic.get_entries_num();
+ if ( dynamic_num > 0 ) {
+ for ( ELFIO::Elf_Xword i = 0; i < dynamic_num; ++i ) {
+ ELFIO::Elf_Xword dynamic_tag = 0;
+ ELFIO::Elf_Xword dynamic_value = 0;
+ SS_String dynamic_str;
+ dynamic.get_entry(i, dynamic_tag, dynamic_value, dynamic_str);
+
+ // Search if the acquired dynamic section string contains libTestFwCommon.so
+ if (SS_String::npos != dynamic_str.find("libTestFwCommon.so")) {
+ fprintf(stderr, "[%s](%d)libTestFwCommon is linked.\n", __func__, __LINE__);
+ return true;
+ }
+
+ // Check for continuation of dynamic section element
+ if ( DT_NULL == dynamic_tag ) {
+ break;
+ }
+ }
+ } else {
+ // If dynamic section is not found
+ fprintf(stderr, "[%s](%d)dynamic symbol is not find.\n", __func__, __LINE__);
+ }
+ }
+ }
+
+ fprintf(stderr, "[%s](%d)libTestFwCommon is not find. \n", __func__, __LINE__);
+ return false;
+}
+
+/**
+ * This method is a private method to be called from CreateProcess func.
+ * Check environment variable MOCK_LIBRARY where Mock Library Name to set in LD_PRELOAD is set
+ * and output character string to set in LD_PRELOAD if there is setting.
+ *
+ * @param process_path,environment_string
+ * @return void
+ */
+void Process::CheckLdPreLoad(SS_String *process_path, char *environment_string) {
+ if ((process_path == NULL || environment_string == NULL)) {
+ fprintf(stderr, "[%s](%d)Invaild Param.\n", __func__, __LINE__);
+ return;
+ }
+
+ // Check if environment variable MOCK_LIBRARY for LD_PRELOAD setting is set
+ char *value_mock_library = getenv("MOCK_LIBRARY");
+
+ if (value_mock_library != NULL) {
+ // When MOCK_LIBRARY is set
+ fprintf(stderr, "[%s](%d)MOCK_LIBRARY = %s \n", __func__, __LINE__, value_mock_library);
+
+ // Check whether the process to be started is a core unit or TestFW, and execute LD_PRELOAD if libTestFwCommon.so is linked
+ if (CheckLinkedTestfwLibrary(process_path)) {
+ SS_String key_value;
+ SS_String key_ld_preload = "LD_PRELOAD=";
+
+ // Create LD_PRELOAD setting string
+ // LD_PRELOAD is enabled when the string is an envp argument in the form "LD_PRELOAD=hoge_mock.so hoge_mock.so ..."
+ key_value = key_ld_preload + value_mock_library;
+ strncpy(environment_string, key_value.c_str(), key_value.length());
+ fprintf(stderr, "[%s](%d)Set envp: %s \n", __func__, __LINE__, environment_string);
+ return;
+ } else {
+ // If the unit does not require LD_PRELOAD setting, set envairoment_string to NULL.
+ fprintf(stderr, "[%s](%d)Core Unit is not setting LD_PRELOAD\n", __func__, __LINE__);
+ return;
+ }
+ } else {
+ // If it is not set to MOCK_LIBRARY, it is not necessary to set LD_PRELOAD, so set envairoment_string to NULL.
+ fprintf(stderr, "[%s](%d)The MOCK_LIBRARY variable was unestablished.\n", __func__, __LINE__);
+ return;
+ }
+}
+
+/**
+ * Acquire the character string of the environment variable and set it in String Vector
+ * and return in a pointer of Vector.
+ *
+ * @param process_path,environment_string
+ * @return vector<SS_String> pointer
+ */
+extern char ** environ;
+std::vector<SS_String> *Process::GetEnvironVector(void) {
+ // If LD_PRELOAD is set, copy existing environment settings and set to environment_pointer
+
+ std::vector<SS_String>* vector_environ = new std::vector<SS_String>;
+
+ char **environ_tmp = environ;
+
+ // Insert environ_string into the vector table
+ int i = 0;
+ while (environ_tmp[i] != NULL) {
+ SS_String str_env(environ_tmp[i]);
+ vector_environ->push_back(str_env);
+ i++;
+ }
+
+ return vector_environ;
+}
+// ----------------------------------------
diff --git a/video_in_hal/systemservice/interface_unified/library/src/ss_system_timer.cpp b/video_in_hal/systemservice/interface_unified/library/src/ss_system_timer.cpp
new file mode 100755
index 0000000..24209fb
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/library/src/ss_system_timer.cpp
@@ -0,0 +1,228 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManagerIf
+/// \brief This file provides support for the System Manager client interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "system_service/ss_system_timer.h"
+#include <native_service/ns_timer_if.h>
+#include <native_service/ns_message_center_if.h>
+#include <utility>
+#include "ss_system_timer_local.h"
+
+Timer::Timer() :
+ m_bInit(FALSE), m_hApp(NULL), m_hSnd(NULL), m_hTmr(NULL) {
+ bzero(&m_tTi, sizeof(m_tTi));
+}
+
+Timer::Timer(HANDLE hdl, UI_32 id, CbFuncPtr CbFn):
+ m_bInit(FALSE), m_hApp(NULL), m_hSnd(NULL), m_hTmr(NULL) {
+ bzero(&m_tTi, sizeof(m_tTi));
+ Initialize(hdl, id, CbFn);
+}
+
+Timer::~Timer() {
+ if (m_bInit) {
+ Shutdown();
+ }
+} // LCOV_EXCL_BR_LINE 10:Because destructor
+
+BOOL Timer::Initialize(HANDLE hApp, UI_32 id, CbFuncPtr CbFn) {
+ if (!m_bInit && hApp && id && CbFn) {
+ m_hApp = hApp;
+ m_tTi.iCmd = id;
+ m_tTi.t_sec = 0;
+ m_tTi.t_nsec = 0;
+ m_tTi.rpt_sec = 0;
+ m_tTi.rpt_nsec = 0;
+ m_CbFn = CbFn;
+ m_hSnd = McOpenSender(FrameworkunifiedGetAppName(m_hApp));
+ m_hTmr = NS_TimerCreate(m_tTi, CALLBACK_MESSAGE, m_hSnd);
+ m_bInit = TRUE;
+ }
+ return m_bInit;
+}
+
+void Timer::Reinitialize(UI_32 id) {
+ if (!m_bInit && id) {
+ m_tTi.iCmd = id;
+
+ m_tTi.t_sec = 0;
+ m_tTi.t_nsec = 0;
+ m_tTi.rpt_sec = 0;
+ m_tTi.rpt_nsec = 0;
+
+ m_hSnd = McOpenSender(FrameworkunifiedGetAppName(m_hApp));
+ m_hTmr = NS_TimerCreate(m_tTi, CALLBACK_MESSAGE, m_hSnd);
+ m_bInit = TRUE;
+ }
+ return;
+}
+
+void Timer::Shutdown() {
+ if (m_bInit) {
+ Stop();
+ NS_TimerDelete(m_hTmr);
+ m_hTmr = NULL;
+ McClose(m_hSnd);
+ m_hSnd = NULL;
+ m_bInit = FALSE;
+ }
+}
+
+BOOL Timer::SetTime(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) {
+ if (m_bInit) {
+ m_tTi.t_sec = ss;
+ m_tTi.t_nsec = (ss || sms) ? sms*NS_PER_MS : 1; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ m_tTi.rpt_sec = rs;
+ m_tTi.rpt_nsec = rms*NS_PER_MS;
+ }
+ return m_bInit;
+}
+
+BOOL Timer::Start(UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) {
+ if (m_bInit) {
+ SetTime(ss, sms, rs, rms);
+ FrameworkunifiedAttachCallbackToDispatcher(m_hApp, TIMER_SERVICE_NAME, m_tTi.iCmd, m_CbFn);
+ NS_TimerSetTime(m_hTmr, m_tTi);
+ }
+ return m_bInit;
+}
+
+BOOL Timer::Start() {
+ if (m_bInit) {
+ FrameworkunifiedAttachCallbackToDispatcher(m_hApp, TIMER_SERVICE_NAME, m_tTi.iCmd, m_CbFn);
+ m_tTi.t_nsec = (m_tTi.t_sec || m_tTi.t_nsec) ? m_tTi.t_nsec : 1; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ NS_TimerSetTime(m_hTmr, m_tTi);
+ }
+ return m_bInit;
+}
+
+BOOL Timer::Stop() {
+ if (m_bInit) {
+ NSTimerInfo ti = m_tTi;
+ ti.t_sec = 0;
+ ti.t_nsec = 0;
+ ti.rpt_sec = 0;
+ ti.rpt_nsec = 0;
+ NS_TimerSetTime(m_hTmr, ti);
+ FrameworkunifiedDetachCallbackFromDispatcher(m_hApp, TIMER_SERVICE_NAME, ti.iCmd);
+ }
+ return m_bInit;
+}
+
+// LCOV_EXCL_START 6:Because the condition cannot be set
+TimerCtrl::TimerCtrl()
+ : m_hApp(NULL), m_nTimersMax(DEFAULT_NTIMERS) {
+}
+
+TimerCtrl::TimerCtrl(UI_32 ntimers)
+ : m_hApp(NULL), m_nTimersMax(ntimers) {
+}
+
+void TimerCtrl::Initialize(HANDLE hApp) {
+ if ( NULL != hApp ) {
+ m_hApp = hApp;
+ if (m_aTimers.empty() && m_rTimers.empty()) {
+ for (UI_32 i = DEFAULT_TIMERID; i < DEFAULT_TIMERID+m_nTimersMax; ++i) {
+ m_aTimers.push_back(i);
+ }
+ }
+ }
+}
+
+void TimerCtrl::Shutdown() {
+ m_aTimers.clear();
+ while (m_rTimers.begin() != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.begin()->second;
+ p_timer->Shutdown();
+ delete p_timer;
+ m_rTimers.erase(m_rTimers.begin());
+ }
+}
+
+UI_32 TimerCtrl::CreateTimer(CbFuncPtr CbFn) {
+ if (!m_aTimers.empty()) {
+ UI_32 id = m_aTimers.front();
+ m_aTimers.pop_front();
+ Timer* p_timer = new Timer(m_hApp, id, CbFn);
+ m_rTimers.insert(std::pair<UI_32, Timer*>(id, p_timer));
+ return id;
+ }
+ return 0;
+}
+
+UI_32 TimerCtrl::DeleteTimer(UI_32 id) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->Shutdown();
+ delete p_timer;
+ m_rTimers.erase(m_rTimers.find(id));
+ m_aTimers.push_back(id);
+ return id;
+ }
+ return 0;
+}
+
+UI_32 TimerCtrl::SetTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->SetTime(ss, sms, rs, rms);
+ return id;
+ }
+ return 0;
+}
+UI_32 TimerCtrl::StartTimer(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->Start(ss, sms, rs, rms);
+ return id;
+ }
+ return 0;
+}
+
+UI_32 TimerCtrl::StartTimerMulti(UI_32 id, UI_32 ss, UI_32 sms, UI_32 rs, UI_32 rms, UI_32 subId) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->Shutdown();
+ p_timer->Reinitialize(id + subId);
+ p_timer->Start(ss, sms, rs, rms);
+ return id;
+ }
+ return 0;
+}
+
+UI_32 TimerCtrl::StartTimer(UI_32 id) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->Start();
+ return id;
+ }
+ return 0;
+}
+
+UI_32 TimerCtrl::StopTimer(UI_32 id) {
+ if (m_rTimers.find(id) != m_rTimers.end()) {
+ Timer* p_timer = m_rTimers.find(id)->second;
+ p_timer->Stop();
+ return id;
+ }
+ return 0;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/systemservice/interface_unified/scfg/gpf_ss_cpu_mon_config.cfg b/video_in_hal/systemservice/interface_unified/scfg/gpf_ss_cpu_mon_config.cfg
new file mode 100755
index 0000000..dcf4d02
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/scfg/gpf_ss_cpu_mon_config.cfg
@@ -0,0 +1,14 @@
+# CPU Monitor Group Configuration File
+
+[Monitor]
+StartupDelayMs=20000
+SamplePeriodMs=1000
+HistoryLengthMs=10000
+
+[Trigger]
+IdleThresholdBelowPercent=10
+IdleThresholdTimeToExceedMs=3000
+PostDetectNextSampleTimeMs=3000
+
+[MonteCarlo]
+Enabled=FALSE
diff --git a/video_in_hal/systemservice/interface_unified/scfg/gpf_ss_ps_config.cfg b/video_in_hal/systemservice/interface_unified/scfg/gpf_ss_ps_config.cfg
new file mode 100755
index 0000000..4d30809
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/scfg/gpf_ss_ps_config.cfg
@@ -0,0 +1,20 @@
+[PowerLogicPlugin]
+dll=ss_powerlogic.dll
+
+[LVI1]
+Hysteresis_Enabled=TRUE
+Hysteresis_Tries=1
+Hysteresis_Timeout=200
+Timeouts_Timeout=200
+
+[LVI2]
+Hysteresis_Enabled=TRUE
+Hysteresis_Tries=1
+Hysteresis_Timeout=200
+Timeouts_Timeout=200
+
+[Shutdown]
+Hysteresis_Enabled=TRUE
+Hysteresis_Tries=1
+Hysteresis_Timeout=200
+Timeouts_Timeout=200
diff --git a/video_in_hal/systemservice/interface_unified/scfg/gpf_ss_showmem.cfg b/video_in_hal/systemservice/interface_unified/scfg/gpf_ss_showmem.cfg
new file mode 100755
index 0000000..0067483
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/scfg/gpf_ss_showmem.cfg
@@ -0,0 +1,6 @@
+# CPU Monitor, Show Memory Configuration File
+
+[Monitor]
+Enabled=TRUE
+StartupDelayMs=0
+SamplePeriodMs=1000
diff --git a/video_in_hal/systemservice/interface_unified/scfg/ss_cpu_high_load_monitor.cfg b/video_in_hal/systemservice/interface_unified/scfg/ss_cpu_high_load_monitor.cfg
new file mode 100755
index 0000000..9ae63d6
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/scfg/ss_cpu_high_load_monitor.cfg
@@ -0,0 +1,85 @@
+# CPU High Load Monitor Configuration File
+
+[Monitor]
+Enabled=TRUE
+
+[MonteCarlo]
+Enabled=TRUE
+SamplingTimeSec=3
+SamplingIntervalMicroSec=500
+InitiationTimingSec=15
+AnlysisProcessCount=3
+SleepTimeMSec=100
+LogCount=5
+
+[TopCalculation]
+Count=10
+TimeDivisionModuloArg=1000
+SleepTimeMilliSec=50
+
+# ClearThreadPrio is 1 and CountUpThreadPrio is 11.
+[WDT0]
+PrioMin=1
+PrioMax=10
+TriggerCount=10
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
+
+# ClearThreadPrio is 11 and CountUpThreadPrio is 17
+[WDT1]
+PrioMin=11
+PrioMax=16
+TriggerCount=10
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
+
+# ClearThreadPrio is 17 and CountUpThreadPrio is 19.
+# GtfStartup (Prio18) and _CWORD77_(Prio17) tend to occupy CPU, so I created dedicated group.
+[WDT2]
+PrioMin=17
+PrioMax=18
+TriggerCount=10
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
+
+# ClearThreadPrio is 19 and CountUpThreadPrio is 31
+[WDT3]
+PrioMin=19
+PrioMax=30
+TriggerCount=10
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
+
+# ClearThreadPrio is 31 and CountUpThreadPrio is 49
+[WDT4]
+PrioMin=31
+PrioMax=48
+TriggerCount=5
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
+
+# ClearThreadPrio is 49 and CountUpThreadPrio is 255
+[WDT5]
+PrioMin=49
+PrioMax=254
+TriggerCount=5
+CountIncPeriodMs=1000
+CountClrPeriodMs=1000
+SupplementalConsoleLoggingEnabled=FALSE
+SupplementalRamFilePhysAddrStart=0x00000000
+SupplementalRamFileLen=0x00032000
diff --git a/video_in_hal/systemservice/interface_unified/scfg/ss_logger.cfg b/video_in_hal/systemservice/interface_unified/scfg/ss_logger.cfg
new file mode 100755
index 0000000..ffb4c50
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/scfg/ss_logger.cfg
@@ -0,0 +1,133 @@
+[LOGGING]
+LogMaxFileSize=5242880
+PerformanceLogSize=262144
+EmmcOutputPath=/nv/BS/ss/logger_service/rwdata/frameworkunifiedlog
+EmmcOutputNaviLogPath=/nv/BS/ss/logger_service/rwdata/log2/awlog
+Usb0MountPath=/mnt/sda1
+Usb1MountPath=/mnt/sdb1
+SdMountPath=/fs/sd0
+EmmcOutputMax=56
+#Value of EmmcOutputErrMax is related to SM function of logging or not,
+#caused by error-reboot, illegal-reset.
+#So,check to influece upon each other in case of changing this value.
+EmmcOutputErrMax=10
+EmmcOutputGrpRelaunchMax=5
+EmmcOutputNaviLogMax=10
+EmmcOutputNaviLogNmlMax=20
+EmmcOutputNaviLogErrMax=10
+ExternalLogNum=6
+ExternalLogMax=20
+
+# "[EXTERNAL_X]" have to start from "1" to ExternalLogNum
+# "ExtLogPath" is file or directory path of External log
+# "OutputPath" is file or directory path in Archive file
+# "Remove" is removed or not after it is archived
+
+[EXTERNAL_1]
+ExtLogPath=/ramd/log/frameworkunifiedlog/radio
+OutputPath=radio
+Remove=false
+
+[EXTERNAL_2]
+ExtLogPath=/ramd/log/frameworkunifiedlog/connectivity
+OutputPath=connectivity
+Remove=false
+
+[EXTERNAL_3]
+ExtLogPath=/ramd/log/frameworkunifiedlog/graphics.log
+OutputPath=graphics.log
+Remove=false
+
+[EXTERNAL_4]
+ExtLogPath=/ramd/log/frameworkunifiedlog/winsys.log
+OutputPath=winsys.log
+Remove=false
+
+[EXTERNAL_5]
+ExtLogPath=/ramd/log/frameworkunifiedlog/appfw
+OutputPath=appfw
+Remove=false
+
+[EXTERNAL_6]
+ExtLogPath=/nv/ptdata/sec/tomoyo
+OutputPath=tomoyo
+Remove=true
+
+[SETLOGMASK]
+MASK0=0xDC000000
+MASK1=0x00000000
+MASK2=0x00000000
+MASK3=0x00000000
+MASK4=0x00000000
+MASK5=0x00000000
+MASK6=0x00000000
+MASK7=0x00000000
+MASK8=0x00000000
+MASK9=0x00000000
+MASK10=0x00000000
+MASK11=0x00000000
+MASK12=0x00000000
+MASK13=0x00000000
+MASK14=0x00000000
+MASK15=0x00000000
+
+[STORAGE]
+ThreadName=/SSLoggerStrage
+Priority=34
+Timeout=50000
+TimeoutAfter=5
+
+
+# Reader types
+# 0 : eReaderWriterTypeFile : not valid for reading
+# 1 : eReaderWriterTypeQueue : reading from a queue
+# 2 : eReaderWriterTypeUdp : not valid for reading
+# 3 : eReaderWriterTypeUdpAndFile : not valid for reading
+# 4 : eReaderWriterTypeInvalid : invalid type
+
+# Writer types
+# 0 : eReaderWriterTypeFile : Writing to file only
+# 1 : eReaderWriterTypeQueue : not implemented yet
+# 2 : eReaderWriterTypeUdp : writing to UDP only
+# 3 : eReaderWriterTypeUdpAndFile : writing to File and UDP
+# 4 : eReaderWriterTypeInvalid : invalid type
+
+[READERWRITER]
+Count=3
+
+[READERWRITER_00]
+ThreadName=pdg.LogQueR
+Priority=30
+ReaderType=1
+ReaderName=/NSLog
+WriterType=3
+WriterName1=/tmp/frameworkunified_debug.log
+WriterSize1=5242880
+WriterName2=169.254.80.9
+WriterSize2=0
+
+
+[READERWRITER_01]
+ThreadName=pdg.TranQueR
+Priority=30
+ReaderType=1
+ReaderName=/TRANSMIT
+WriterType=3
+WriterName1=/tmp/interfaceunified_transmit.log
+WriterSize1=5242880
+WriterName2=169.254.80.9
+WriterSize2=0
+
+
+[READERWRITER_02]
+ThreadName=pdg.PerformQueR
+Priority=11
+ReaderType=1
+ReaderName=/NSplog
+WriterType=0
+WriterName1=/tmp/frameworkunified_performance.log
+WriterSize1=262144
+WriterName2=
+WriterSize2=0
+
+
diff --git a/video_in_hal/systemservice/interface_unified/scfg/system_launch_flashloader.cfg b/video_in_hal/systemservice/interface_unified/scfg/system_launch_flashloader.cfg
new file mode 100755
index 0000000..49012de
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/scfg/system_launch_flashloader.cfg
@@ -0,0 +1,8 @@
+# Version:1.0.0v Service queue names changed and updated Lancher-FL sheet - FL
+# Region:FL
+# Generated on Tuesday, July 23, 2013 6:57:49 PM
+# Launch#|GroupName|Group#|Group Launch Wait Time|GroupTrigger|name|path| priority| critical| retry_cnt| arguments|logging_mask| restart| is_start_required| shutdown_critical| shutdown_wait_time
+[ModulesLaunchConfig]
+Launch1=CoreModules|1|100000|False|NS_NPPService|/agl/bin/NS_NPPService|51|True|1|--a SS_SystemManager|NULL|me|False|True|15
+Launch2=CoreModules|1|100000|False|SS_LoggerService|/agl/bin/SS_LoggerService|10|False|3|-p thrd=pdg.LogQueReader:30,thrd=pdg.TransmitQueReader:30,thrd=pdg.DumpQueReader:11,thrd=pdg.PerformanceQueReader:11,thrd=pdg.LogQueWriter:30,thrd=pdg.TransmitQueWriter:30,thrd=pdg.EvntLogQue:8,thrd=pdg.UdpQueWriter:10|NULL|me|True|True|4
+Launch3=SystemModules|2|100000|False|SS_PowerService|/agl/bin/SS_PowerService|12|True|3|NULL|NULL|me|True|False|0
diff --git a/video_in_hal/systemservice/interface_unified/scfg_pram/gpf_ss_sm_config_data.cfg b/video_in_hal/systemservice/interface_unified/scfg_pram/gpf_ss_sm_config_data.cfg
new file mode 100755
index 0000000..9aef5b8
--- /dev/null
+++ b/video_in_hal/systemservice/interface_unified/scfg_pram/gpf_ss_sm_config_data.cfg
@@ -0,0 +1,26 @@
+[Heartbeat]
+MaxHeartBeatRetryCount=4
+AppHeartBeatIntervalInitial=40
+AppHeartBeatIntervalRepeat=30
+
+[CrashDetector]
+Enabled=TRUE
+
+[SysLowMemory]
+TimerValue=5000
+MaxRetryCount=6
+ThresholdValue=5242880
+InterfaceunifiedLogIntervalMs=30000
+
+[UserModeNotification]
+IsBoolean=FALSE
+
+[Module]
+# Set 'ModuleConnectionNumTimesToCheck' to '0' to disable Module Connection checking
+ModuleConnectionNumTimesToCheck=3
+ModuleConnectionTimeOutSec=40
+ModuleStartRespTimeOutSec=120
+
+[CriticalApps]
+CriticalAppsMaxShutdownTimeFastSleep=2;
+CriticalAppsMaxShutdownTimeNormalReset=15; \ No newline at end of file
diff --git a/video_in_hal/systemservice/logger_service/LICENSE b/video_in_hal/systemservice/logger_service/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/systemservice/logger_service/Makefile.server b/video_in_hal/systemservice/logger_service/Makefile.server
new file mode 100755
index 0000000..13612f8
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/Makefile.server
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := server
+
+include ../system_service.mk
diff --git a/video_in_hal/systemservice/logger_service/server/Makefile b/video_in_hal/systemservice/logger_service/server/Makefile
new file mode 100755
index 0000000..5292a18
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/Makefile
@@ -0,0 +1,28 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS += lib work
+
+SUBDIRS += realtimeUsbLog
+
+all:
+
+install-data:install_data
+
+install_data:
+ install -d -m 755 $(DESTDIR)/nv/BS/ss/logger_service/rwdata/frameworkunifiedlog
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/logger_service/server/SS_LoggerService.conf_bin b/video_in_hal/systemservice/logger_service/server/SS_LoggerService.conf_bin
new file mode 100755
index 0000000..440d361
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/SS_LoggerService.conf_bin
@@ -0,0 +1,4 @@
+/usr/agl/bin|${OSW_reldbg}
+debug|dbg
+release|rel
+product|rel
diff --git a/video_in_hal/systemservice/logger_service/server/include/loggerservicedebug_loggerservicelog.h b/video_in_hal/systemservice/logger_service/server/include/loggerservicedebug_loggerservicelog.h
new file mode 100755
index 0000000..5a2f56e
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/loggerservicedebug_loggerservicelog.h
@@ -0,0 +1,81 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_LogTraceSender
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_LOGGERSERVICELOG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_LOGGERSERVICELOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_PRD_INFO3 ZONEMASK(26)
+#define ZONE_PRD_INFO2 ZONEMASK(27)
+#define ZONE_PRD_INFO1 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 "Product Info3"
+#define ZONE_TEXT_27 "Product Info2"
+#define ZONE_TEXT_28 "Product Info1"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS(LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INFO, ZONE_FUNC, ZONE_ERR, ZONE_WARN, ZONE_PRD_INFO1, ZONE_PRD_INFO2, ZONE_PRD_INFO3
+#endif
+
+extern const CHAR AppName[];
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_LOGGERSERVICELOG_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/loggerservicedebug_thread_if.h b/video_in_hal/systemservice/logger_service/server/include/loggerservicedebug_thread_if.h
new file mode 100755
index 0000000..8a43511
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/loggerservicedebug_thread_if.h
@@ -0,0 +1,319 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_LogTraceSender
+/// \brief This file supports the logging thread interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_THREAD_IF_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_THREAD_IF_H_
+
+#include <pthread.h>
+#ifdef AGL_STUB
+#else
+#include <sys/neutrino.h>
+#include <sys/dispatch.h>
+#endif
+#include <errno.h>
+#include <sched.h>
+#include <stdio.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_logger_service_local.h>
+#include <string>
+#include "loggerservicedebug_loggerservicelog.h"
+
+typedef std::string ThreadName; //< service name
+
+typedef enum _EThreadCommandIds {
+ eThrdCmdUsbEject = 5463, ///< USB eject --> frameworkunifieddebug
+ eThrdCmdUsbCaptureLogs, ///< USB Capture log --> frameworkunifieddebug
+ eThrdCmdUsbStoreLogs, ///< USB Store log --> frameworkunifieddebug
+ eThrdCmdWriteFilesToUsb, ///< frameworkunifieddebug --> Writer
+ eThrdCmdWriteDataToFile, ///< Reader --> Writer
+ eThrdCmdWriterStop, ///< frameworkunifieddebug --> Writer (Stop writing to the file)
+ eThrdCmdWriterResume, ///< frameworkunifieddebug --> Writer (Continue writing to the file)
+ eThrdCmdCaptureLogScriptExit, ///< LogCaptureScript - > frameworkunifieddebug
+ eThrdCmdWriteEvntFilesToUsb, ///< Wreite Event files to USB
+ eThrdCmdcopytofile,
+ eThrdCmdClearEvntLogs, ///< Clear event logs
+ eThrdCmdStatisticalCounter, ///< Read statistical counter
+ eThrdCmdStatisticalCounterSuccessResp, ///< Statistical counter positiv Response from child thread
+ eThrdCmdStatisticalCounterErrorResp, ///< Statistical counter Negative Response from child thread
+ eThrdCmdResetStatisticalCntrs,
+ eThrdCmdCopyEventLogUSBResponse, ///< Copy event logs to usb response from child thread
+ eThrdCmdClearEventLogResponse, ///< Clear event logs response fromchild thread
+ eThrdCmdPersistLogs, ///< Statistical counter Response fromchild thread
+ eThrdCmdSetVINnumber,
+ eThrdCmdImmPersistEvtLog,
+ eThrdCmdMileageData,
+ eThrdCmdGetNumberOfEventsLogged,
+ eThrdCmdNumberOfEventsLoggedResponse,
+ eThrdCmdUploadEventLog,
+ eThrdCmdUploadEventLogResponse,
+ eThrdCmdCopyEvntLogToTmp,
+ eThrdCmdCopyEvntLogToTmpResponse
+} EThreadCommandIds;
+
+typedef struct _TThrdWriteDataToFileEvt {
+ static const UI_32 LN_LEN = 1024;
+ CHAR line[LN_LEN];
+ UI_32 length;
+} TThrdWriteLogDataToFileEvt, TThrdWriteTransmitDataToFileEvt;
+
+typedef struct _TThrdWriteFilesToUsbEvt {
+ static const UI_32 LOC_PATH_LEN = 256;
+ CHAR location[LOC_PATH_LEN]; ///< full path where files should be copied too
+ UI_32 loc_len;
+} TThrdWriteLogFilesToUsbEvt, TThrdWriteTransmitFilesToUsbEvt;
+
+typedef struct _TThrdCaptureLogsEvt {
+ static const UI_32 FN_LEN = 256;
+ CHAR location[FN_LEN];
+ CHAR parse_fn[FN_LEN]; ///< full path an name of the file that should be parsed for event actions.
+} TThrdCaptureLogsEvt;
+
+// Structure to hold the USB device informaton
+typedef struct _TThrdEvtLogStore {
+ BOOL IsDeviceAvailable;
+ static const UI_32 FN_LEN = 256;
+ CHAR location[FN_LEN];
+ CHAR parse_fn[FN_LEN]; ///< full path an name of the file that should be parsed for event actions.
+} TThrdEvtLogStore;
+
+typedef struct _TInitFlag {
+ UI_8 mileage_flagbit :1;
+ UI_8 statcounter_flagbit :1;
+ UI_8 eventlog_flagbit :1;
+ UI_8 reghandlers_flagbit :1;
+} TInitFlag;
+
+typedef struct _TSessionData {
+ std::string strSrcName;
+ UI_32 session_id;
+} TSessionData;
+
+typedef struct _TEvntNumber {
+ TSessionData stSessiondata;
+ UI_16 u16numberofeventslogged;
+} TEvntsLogged;
+
+typedef struct _TWriteFilesToUsbCmdData {
+ TSessionData stSessiondata;
+ EEvtLogUSBDevNumber eDevId;
+} TWriteFilesToUsbCmdData;
+
+typedef struct _TWriteFilesToUsbCmdResponse {
+ TSessionData stSessiondata;
+ UI_8 u8Response;
+} TWriteFilesToUsbCmdResponse;
+
+typedef struct _TClearEvntLogCmdResponse {
+ TSessionData stSessiondata;
+ UI_8 u8Response;
+} TClearEvntLogCmdResponse;
+
+typedef struct _TStatisticalCountersCmd {
+ TSessionData stSessiondata;
+ EStatCounterGroupID eGroupId;
+} TStatisticalCountersCmd;
+
+typedef struct _TStatisticalCntCmdSuccessResp {
+ TSessionData stSessiondata;
+ SStatisticalCounter stBuffer;
+} TStatisticalCntCmdSuccessResp;
+
+typedef struct _TUploadEventLogResp {
+ TSessionData stSessiondata;
+ STEventLogPersistBuffer stEventLogBuffer;
+} TUploadEventLogResp;
+
+typedef struct _TEventLogCopyStatus {
+ static const UI_8 FilePathSize = 64;
+ CHAR EventLogFilePath[FilePathSize];
+ UI_8 status;
+} TEventLogCopyStatus;
+
+typedef enum _ECaptureLogScriptResp {
+ ekCLSStatusCompleteSuccessful,
+ ekCLSStatusInitError,
+ ekCLSStatusExecuteError,
+ ekCLSStatusCopyError,
+ ekCLSStatusChmodError,
+} ECaptureLogScriptResp;
+
+class ThreadWrapper {
+ public:
+
+ ThreadWrapper(const char* t_name, void* (*routine)(void*), void* arg) { // LCOV_EXCL_START 8:ThreadWrapper class is never used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ pthread_attr_t attr;
+ struct sched_param params;
+
+ if (EOK != pthread_attr_init(&attr)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_init failed errno: %d", errno);
+ }
+ if (EOK != pthread_attr_getschedparam(&attr, &params)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_getschedparam failed errno: %d", errno);
+ }
+ SI_32 prio = frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(
+ std::string(t_name));
+ if (-1 != prio) {
+ params.sched_priority = prio;
+ if (EOK != pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_setinheritsched failed errno: %d", errno);
+ }
+ if (EOK != pthread_attr_setschedparam(&attr, &params)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_setschedparam failed errno: %d", errno);
+ }
+ }
+
+ if (EOK != pthread_create(&m_thread, &attr, routine, arg)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: pthread_create failed errno: %d",
+ errno);
+ }
+ }
+ // LCOV_EXCL_STOP
+
+
+ ~ThreadWrapper() { // LCOV_EXCL_START 8:ThreadWrapper class is never used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+// todo: Need a clean way to cleanup thread in case class closes
+ }
+ // LCOV_EXCL_STOP
+
+
+ operator pthread_t() const { // LCOV_EXCL_START 8:ThreadWrapper class is never used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_thread;
+ }
+ // LCOV_EXCL_STOP
+
+ private:
+ pthread_t m_thread;
+};
+
+
+class CChild {
+ public:
+ CChild(const char* parentsName, const char * sendDataToQue,
+ const char * clientsName, void* (*routine)(void*),
+ const char * sendToUdpQue = "")
+ : m_clientName(clientsName),
+ m_parentName(parentsName),
+ m_sendDataToQueuName(sendDataToQue),
+ m_sendDataToUdpQueName(sendToUdpQue),
+ m_barInit(InitBarrier()),
+ m_thread(clientsName, routine, reinterpret_cast<void*>(this)) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP
+
+ void Join() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (EOK != pthread_join(m_thread, NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: pthread_join failed errno: %d",
+ errno);
+ }
+ }
+ // LCOV_EXCL_STOP
+
+ const char * ParentName() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_parentName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ const char * ClientName() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_clientName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ const char * SendDataToQue() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_sendDataToQueuName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ const char * SendDataToUdpQueue() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_sendDataToUdpQueName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ bool IsValidWaitBarrier() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (m_barInit) {
+ int wbret = pthread_barrier_wait(&m_barrier);
+ return ( PTHREAD_BARRIER_SERIAL_THREAD == wbret) || (0 == wbret);
+ }
+
+ return false;
+ }
+ // LCOV_EXCL_STOP
+
+ private:
+ bool InitBarrier() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /// Note: the count value should match the number of threads that are readers and usb notifiers
+ return (EOK == pthread_barrier_init(&m_barrier, NULL, 2) ? true : false);
+ }
+ // LCOV_EXCL_STOP
+
+ private:
+ ThreadName m_clientName;
+ ThreadName m_parentName;
+ ThreadName m_sendDataToQueuName;
+ ThreadName m_sendDataToUdpQueName;
+ bool m_barInit;
+ ThreadWrapper m_thread;
+ pthread_barrier_t m_barrier;
+};
+
+class LoggerserviceDebugChildThread {
+ public:
+ typedef enum e {
+ kLoggerserviceDebugLogQueReader,
+ kLoggerserviceDebugTransmitQueReader,
+ kLoggerservicePerformanceLogQueReader,
+ kLoggerserviceDebugCaptureLogScript,
+ kLoggerserviceDebugEventLogque,
+ kLoggerserviceDebugMax
+ } ELoggerserviceDebugThreads;
+
+ LoggerserviceDebugChildThread();
+ virtual ~LoggerserviceDebugChildThread();
+ BOOL Start(ELoggerserviceDebugThreads id, const char* parentsName,
+ const char * sendDataToQue, void* (*routine)(void*),
+ const char * sendToUdpQue = "");
+ void Stop(ELoggerserviceDebugThreads id);
+ void StopAll();
+ const char * Name(ELoggerserviceDebugThreads id);
+ void LiftWaitBarrier(ELoggerserviceDebugThreads id);
+ BOOL Running(ELoggerserviceDebugThreads id) const;
+ private:
+ ThreadName names[kLoggerserviceDebugMax];
+ CChild * threads[kLoggerserviceDebugMax];
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_THREAD_IF_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/loggerservicedebug_writer_Evntworker.h b/video_in_hal/systemservice/logger_service/server/include/loggerservicedebug_writer_Evntworker.h
new file mode 100755
index 0000000..cef5c18
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/loggerservicedebug_writer_Evntworker.h
@@ -0,0 +1,211 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_LogTraceSender
+/// \brief frameworkunifieddebug writer thread class, handles writing a log file
+/// all really done by my_writer class.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_WRITER_EVNTWORKER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_WRITER_EVNTWORKER_H_
+
+#include <stdlib.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_eventlogger.h>
+#include <map>
+#include <iostream>
+#include <deque>
+#include "loggerservicedebug_thread_if.h"
+
+
+// File path names for Evnet and counter logs
+extern const CHAR DEBUG_EVNTLOG_PATH_FN[];
+extern const CHAR g_strEvntLogQueWorkerName[];
+extern const CHAR DEBUG_LOG_PATH_FN[];
+extern const CHAR Counter_LOG_PATH_FN[];
+extern const CHAR Counter_LOG_PATH_STARTFN[];
+extern const CHAR Counter_LOG_PATH_SHUTFN[];
+extern const CHAR Mileage_LOG_PATH_FN[];
+
+typedef struct _TevntWriterInfo {
+ static const UI_32 FN_LEN = 256;
+ UI_32 max_filelen;
+ CHAR base_cnt_filename[FN_LEN];
+ CHAR mileage_filename[FN_LEN];
+} TEvntWriterInfo;
+
+typedef enum _eDatatype_ {
+ COMMON_DATA,
+ EVENT_SPECIFIC_DATA
+} EDatatype_SS;
+
+typedef enum _eSystemPhase_ {
+ STARTUP_SS = 0x21,
+ NORMAL_SS = 0x22,
+ SHUTDOWN_SS = 0x23
+} ESystemPhase_SS;
+
+#pragma pack(1)
+typedef struct _stLogEventFull_ {
+ UI_32 ts;
+ UI_8 grp_ID;
+ UI_8 event_id;
+ UI_8 data[4];
+ ESystemPhase_SS phase;
+ UI_16 cnt_ID;
+ EDatatype_SS typeofdata;
+} st_LogEvent_full;
+#pragma pack(0)
+
+// Deque to hold the Event information
+typedef std::deque<st_LogEvent_ss> DEQUE_Event_Type;
+
+// Map to hold the Counter information on phase
+typedef std::map<UI_16, UI_32> Counter;
+
+/*Map to hold the all the counter information */
+typedef std::map<EStatCounterGroupID, Counter> CounterInformation;
+
+class CEvntWriterWorker {
+ public:
+ CEvntWriterWorker();
+ CEvntWriterWorker(TEvntWriterInfo & wi); // NOLINT (runtime/references)
+ virtual ~CEvntWriterWorker();
+ // initialize the object
+ EFrameworkunifiedStatus Initialize(HANDLE hThread);
+
+ /// Copy event logs to USB request from parent thread
+ EFrameworkunifiedStatus OnCmdWriteEventFilesToUsb(HANDLE hThread);
+
+ /// Event logging request from NS logger
+ EFrameworkunifiedStatus OnCmdEventLog(UI_8* pbuf);
+
+ /// Clear event logs request from parent thread
+ EFrameworkunifiedStatus OnCmdClearEventLogs(HANDLE hThread);
+
+ /// Read statistical counter request from parent thread
+ EFrameworkunifiedStatus OnCmdReadStatisticalCounter(HANDLE hThread);
+
+ /// Read statistical counter based on counter group ID
+ EFrameworkunifiedStatus ReadStatisticalCounter(EStatCounterGroupID eStatCounterGroupID,
+ SStatisticalCounter& buffer); // NOLINT (runtime/references)
+
+ /// Reset statistical counter request from parent thread
+ EFrameworkunifiedStatus OnCmdResetStatisticalCounter(HANDLE hThread);
+
+ /// Reset statistical counter based on counter group ID
+ EFrameworkunifiedStatus ResetStatisticalCounter(EStatCounterGroupID eStatCounterGroupID);
+
+ EFrameworkunifiedStatus OnCmdStop(HANDLE hThread);
+
+ EFrameworkunifiedStatus OnCmdStart(HANDLE hThread);
+
+ /// Counter logging request from NS logger
+ EFrameworkunifiedStatus OnCmdIncrcount(UI_8* pbuf);
+
+ /// Event and Counter logging request from NS logger
+ EFrameworkunifiedStatus OnCmdIncrwriteevent(UI_8* pbuf);
+
+ /// Reading counter value from file based on phase
+ EFrameworkunifiedStatus readCountFromFile(PCSTR filename);
+
+ /// Writing counter value from file based on phase
+ EFrameworkunifiedStatus writeCountToFile(PCSTR filename);
+
+ /// Writing event value from file based on phase
+ EFrameworkunifiedStatus write_event_to_file(const CHAR* filename);
+
+ /// Copy event files to USB based onUSB device number
+ UI_8 copy_event_files_to_usb(TThrdEvtLogStore *pStUSBIndo);
+
+ /// Functioncall to populate the counter value to map
+ VOID OnCmdIncrcount_phase(st_LogCount *cnt);
+
+ /// Function call to populate the event value to deque
+ VOID OnCmdWriteEventLogs(st_LogEvent_ss *ev);
+
+ /// Set the VIN number
+ EFrameworkunifiedStatus OnCmdSetVIN(HANDLE hThread);
+
+ /// Get the VIN number
+ VOID OnCmdGetVIN(STVIN_NUMBER& f_stVIN_Number); // NOLINT (runtime/references)
+
+ /// Functional call to write events from deque to local buffer
+ VOID write_events_to_buffer(STEventLogPersistBuffer* f_stEvtLogBuf);
+
+ /// Functional call to read events from buffer to deque
+ VOID read_events_from_buffer(STEventLogPersistBuffer* f_stEvtLogBuf);
+
+ /// Functional call to immediate persist event log
+ EFrameworkunifiedStatus immediate_persist_event_log(HANDLE hThread);
+
+ /// Functional call to set mileage information in Evt thread space
+ EFrameworkunifiedStatus EvtThd_SetMileage(HANDLE hThread);
+
+ /// Functional call to write mileage data to file for persisting
+ EFrameworkunifiedStatus write_mileage_to_file(const CHAR* filename);
+
+ /// Functional call to read mileage data from persistent file during startup
+ EFrameworkunifiedStatus read_mileage_from_file(const CHAR* filename);
+
+ EFrameworkunifiedStatus OnCmdReadNumberOfEventsLogged(HANDLE hThread);
+
+ EFrameworkunifiedStatus EventLogRegisterCbHandlers(HANDLE hThread);
+
+ EFrameworkunifiedStatus OnCmdUploadEventLog(HANDLE hThread);
+
+ EFrameworkunifiedStatus OnCmdCopyEvntLogToTmp(HANDLE hThread);
+ /// Static Members for Event and counter logging
+ static CounterInformation counter;
+ static DEQUE_Event_Type deque_event_info;
+
+ private:
+ STVIN_NUMBER m_stVINnumber;
+ UI_32 m_u32MileageData;
+ UI_32 m_u32NumberEventsLogged;
+ TUploadEventLogResp m_stUploadEventLogResp;
+ EFrameworkunifiedStatus counterIncrementByValue(EStatCounterGroupID group, UI_16 id,
+ UI_32 value);
+ EFrameworkunifiedStatus writeGroupToFile(FILE *fp, EStatCounterGroupID group);
+};
+
+/// Event logging Child thread start and shut down functions
+EFrameworkunifiedStatus EvntWriterWorkerOnStart(HANDLE hThread);
+EFrameworkunifiedStatus EvntWriterWorkerOnStop(HANDLE hThread);
+
+/// USBdevice detectioncall backs
+EFrameworkunifiedStatus DD_USBSrvDetectionCallBack(HANDLE hApp);
+EFrameworkunifiedStatus DD_USBServiceAvailabilityCallBack(HANDLE hThread);
+EFrameworkunifiedStatus DD_USBOpenSessionAckCallBack(HANDLE hThread);
+EFrameworkunifiedStatus DD_USBCloseSessionAckCallBack(HANDLE hApp);
+
+inline void u16copy(PUI_8 pDest, UI_16 Source) {
+ *(pDest++) = (UI_8) (Source & 0x00FF);
+ *(pDest++) = (UI_8) ((Source & 0xFF00) >> 8);
+}
+inline void u32copy(PUI_8 pDest, UI_32 Source) {
+ *(pDest++) = (UI_8) (Source & 0x000000FF);
+ *(pDest++) = (UI_8) ((Source & 0x0000FF00) >> 8);
+ *(pDest++) = (UI_8) ((Source & 0x00FF0000) >> 16);
+ *(pDest++) = (UI_8) ((Source & 0xFF000000) >> 24);
+}
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_WRITER_EVNTWORKER_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader/mem_reader.h b/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader/mem_reader.h
new file mode 100755
index 0000000..a5c65ec
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader/mem_reader.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * mem_reader.h
+ *
+ * Created on: Oct 22, 2013
+ */
+
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_MEM_READER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_MEM_READER_H_
+
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_reader.h>
+#include <string>
+#include "reader.h"
+
+namespace ReaderWriter {
+class CMemReader : public ReaderWriter::CReader {
+ public:
+ CMemReader();
+ virtual ~CMemReader();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize);
+ EFrameworkunifiedStatus Read(UI_8* f_data, UI_32 f_length, SI_32& f_bytesRead); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus ReadToFile(std::string f_fileName, UI_32& f_Written); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus Open(void);
+ BOOL IsOpen(void);
+ void Close();
+ EFrameworkunifiedStatus ResetPosition(void);
+
+ private:
+ CNSSharedMemReader* m_pSharedBuf;
+ UI_32 m_sharedBufSize;
+};
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_MEM_READER_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader/queue_reader.h b/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader/queue_reader.h
new file mode 100755
index 0000000..139796a
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader/queue_reader.h
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_QUEUE_READER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_QUEUE_READER_H_
+
+#include <mqueue.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "reader.h"
+
+namespace ReaderWriter {
+
+class CQueueReader : public CReader {
+ public:
+ CQueueReader();
+ virtual ~CQueueReader();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize);
+ EFrameworkunifiedStatus Read(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesRead); // NOLINT (runtime/references)
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ void Close();
+ private:
+ mqd_t m_handle;
+ std::string m_queName;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_QUEUE_READER_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader/reader.h b/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader/reader.h
new file mode 100755
index 0000000..7b0141d
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader/reader.h
@@ -0,0 +1,52 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_READER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_READER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer_cfg.h"
+#include "ss_logger_cfg.h"
+
+namespace ReaderWriter {
+
+class CReader {
+ public:
+ CReader();
+ virtual ~CReader();
+
+ static CReader* OpenReader(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
+ std::string f_name, UI_32 f_maxSize);
+ virtual EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize) = 0;
+ virtual BOOL IsOpen(void) = 0;
+ virtual EFrameworkunifiedStatus Open(void) = 0;
+ virtual EFrameworkunifiedStatus Read(UI_8* f_data, UI_32 f_length, SI_32& f_bytesRead) = 0; // NOLINT (runtime/references)
+ virtual EFrameworkunifiedStatus ReadToFile(std::string f_fileName, UI_32& f_Written); // NOLINT (runtime/references)
+
+ virtual void Close() = 0;
+ virtual EFrameworkunifiedStatus ResetPosition(void);
+
+ protected:
+ CLoggerCfg * m_pLoggerCfg;
+};
+} // namespace ReaderWriter
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_READER_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader_writer.h b/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader_writer.h
new file mode 100755
index 0000000..b075472
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader_writer.h
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_H_
+
+#include <pthread.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer_cfg.h"
+#include "readerWriter/reader/reader.h"
+#include "readerWriter/writer/writer.h"
+
+namespace ReaderWriter {
+
+class CReaderWriter {
+ public:
+ CReaderWriter();
+ virtual ~CReaderWriter();
+
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, EReaderType f_readerType,
+ std::string f_readerName, UI_32 f_readerMaxSize,
+ EWriterType f_writerType, std::string f_writer1Name,
+ UI_32 f_writer1MaxSize);
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, EReaderType f_readerType,
+ std::string f_readerName, UI_32 f_readerMaxSize,
+ EWriterType f_writerType, std::string f_writer1Name,
+ UI_32 f_writer1MaxSize, std::string f_writer2Name,
+ UI_32 f_writer2MaxSize);
+ EFrameworkunifiedStatus Start(std::string f_readerName);
+ EFrameworkunifiedStatus Stop();
+ void ThreadFunction(CReaderWriter* l_pObj);
+ void Cleanup(CReaderWriter* l_pObj);
+ EFrameworkunifiedStatus FlushCache(std::string f_filename);
+ EFrameworkunifiedStatus UpdateLoggingParameters(void);
+
+ private:
+ void Pause(void);
+ void Resume(void);
+ static void* ThreadFunctionWrapper(void* param);
+
+ static void CleanupWrapper(void* param);
+ CLoggerCfg* m_pLoggerCfg;
+ CReader* m_reader;
+ CWriter* m_writer;
+ BOOL m_running;
+ pthread_t m_thread;
+ pthread_barrier_t m_barrier;
+ std::string m_readerName;
+
+ pthread_mutex_t m_writeMutex;
+ pthread_mutex_t m_pauseMutex;
+ pthread_cond_t m_condVariable;
+ BOOL m_paused;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader_writer_cfg.h b/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader_writer_cfg.h
new file mode 100755
index 0000000..b39353b
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/readerWriter/reader_writer_cfg.h
@@ -0,0 +1,35 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_CFG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_CFG_H_
+namespace ReaderWriter {
+typedef enum _ERWType {
+ eReaderWriterTypeFile,
+ eReaderWriterTypeQueue,
+ eReaderWriterTypeUdp,
+ eReaderWriterTypeUdpAndFile, // Only for writer | pass filename and queueName
+ eReaderWriterTypeMem,
+ eReaderWriterTypeInvalid
+} EReaderType, EWriterType;
+}
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_CFG_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/cached_file_writer.h b/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/cached_file_writer.h
new file mode 100755
index 0000000..ad28658
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/cached_file_writer.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_CACHED_FILE_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_CACHED_FILE_WRITER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include "file_writer.h"
+
+#define CACHED_BLOCK_SIZE (UI_32)(4*1024)
+
+namespace ReaderWriter {
+
+class CCachedFileWriter : public CFileWriter {
+ public:
+ CCachedFileWriter();
+ virtual ~CCachedFileWriter();
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus FlushCache(void);
+ private:
+ UI_8 m_buffer[CACHED_BLOCK_SIZE ];
+ UI_32 m_index;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_CACHED_FILE_WRITER_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/file_writer.h b/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/file_writer.h
new file mode 100755
index 0000000..caf81c9
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/file_writer.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_FILE_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_FILE_WRITER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "writer.h"
+
+namespace ReaderWriter {
+
+class CFileWriter : public CWriter {
+ public:
+ CFileWriter();
+ virtual ~CFileWriter();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2, UI_32 f_size2);
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ void Close();
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ protected:
+ EFrameworkunifiedStatus WriteData(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ private:
+ int m_FileHandle;
+ off_t m_fileposn;
+ UI_32 m_maxFileSize;
+ std::string m_filename;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_FILE_WRITER_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/udp_file_writer.h b/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/udp_file_writer.h
new file mode 100755
index 0000000..65e58e0
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/udp_file_writer.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_FILE_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_FILE_WRITER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "writer.h"
+#include "udp_writer.h"
+#include "file_writer.h"
+
+namespace ReaderWriter {
+
+class CUdpFileWriter : public CWriter {
+ public:
+ CUdpFileWriter();
+ virtual ~CUdpFileWriter();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2, UI_32 f_size2);
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ void Close();
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ EFrameworkunifiedStatus FlushCache(void);
+ EFrameworkunifiedStatus UpdateLoggingParameters(void);
+ private:
+ CUdpWriter *m_pUdpWriter;
+ CFileWriter *m_pFileWriter;
+ CLoggerCfg* m_pLoggerCfg;
+ std::string m_ipAddress;
+ UI_32 m_port;
+ std::string m_FileName;
+ UI_32 m_FileSize;
+};
+} // namespace ReaderWriter
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_FILE_WRITER_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/udp_writer.h b/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/udp_writer.h
new file mode 100755
index 0000000..cf0944a
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/udp_writer.h
@@ -0,0 +1,63 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_WRITER_H_
+
+#include <netinet/in.h>
+#include <string>
+#include "writer.h"
+
+#define REMOTE_IP_PORT 3500
+namespace ReaderWriter {
+#define UDP_MAX_LENGTH (UI_32)1024*4
+#define UDP_CACHED_BLOCK_SIZE (UI_32)1024*4
+#define SEND_RETRY_VALUE (UI_8) 5
+
+#define OWN_ADDRESS "169.254.80.8"
+class CUdpWriter : public CWriter {
+ public:
+ CUdpWriter();
+ virtual ~CUdpWriter();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2, UI_32 f_size2);
+
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ void Close();
+ EFrameworkunifiedStatus UpdateLoggingParameters(void);
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ EFrameworkunifiedStatus FlushCache(void);
+ private:
+ EFrameworkunifiedStatus WriteData(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+
+ int m_SocketHandle;
+ sockaddr_in m_oSAInfo;
+ std::string m_IPAddress;
+ UI_32 m_index;
+ UI_32 m_port;
+ BOOL m_InitialTimeElapsed;
+ UI_8 m_buffer[UDP_CACHED_BLOCK_SIZE];
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_WRITER_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/writer.h b/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/writer.h
new file mode 100755
index 0000000..15d93aa
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/readerWriter/writer/writer.h
@@ -0,0 +1,56 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_WRITER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer_cfg.h"
+#include "ss_logger_cfg.h"
+
+namespace ReaderWriter {
+
+class CWriter {
+ public:
+ CWriter();
+ virtual ~CWriter();
+
+ static CWriter* OpenWriter(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
+ std::string f_Name1, UI_32 f_size1,
+ std::string f_Name2, UI_32 f_size2);
+ virtual EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2,
+ UI_32 f_size2) = 0;
+ virtual EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length,
+ SI_32 &f_bytesWritten) = 0; // NOLINT (runtime/references)
+ virtual void Close() = 0;
+ virtual EFrameworkunifiedStatus FlushCache(void);
+ virtual EFrameworkunifiedStatus UpdateLoggingParameters(void);
+ virtual BOOL IsOpen(void) = 0;
+ virtual EFrameworkunifiedStatus Open(void) = 0;
+
+ protected:
+ CLoggerCfg * m_pLoggerCfg;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_WRITER_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_cfg.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_cfg.h
new file mode 100755
index 0000000..93aaef9
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_cfg.h
@@ -0,0 +1,185 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief Provide support for SS Logger module configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
+
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_logger_if.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_logger_service_local.h>
+#include <string>
+#include <vector>
+#include "loggerservicedebug_loggerservicelog.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// CONFIGURATION CLASS DEFINITION
+///////////////////////////////////////////////////////////////////////////////
+/*Default values for the storage thread*/
+#define ERROR_EVENT_STORAGE_QUEUE_NAME "/SSLoggerStrage"
+#define ERROR_EVENT_STORAGE_PRIORITY (UI_8)30
+#define ERROR_EVENT_STORAGE_SLEEP_TIME (useconds_t)50000
+#define ERROR_EVENT_STORAGE_SLEEP_AFTER (UI_8)5
+
+#if ENABLE_PRODUCTION_BUILD == 1
+#define SS_LOGGER_DEFAULT_VALUE eDeactivate
+#else
+#define SS_LOGGER_DEFAULT_VALUE eActivate
+#endif
+
+#define LOGGERSERVICELOG_EMMC_COUNTER_MAX 99999u
+
+struct SLoggerStorageInfo {
+ SLoggerStorageInfo()
+ : Name(ERROR_EVENT_STORAGE_QUEUE_NAME),
+ Priority(ERROR_EVENT_STORAGE_PRIORITY),
+ Timeout(ERROR_EVENT_STORAGE_SLEEP_TIME),
+ TimeoutAfter(ERROR_EVENT_STORAGE_SLEEP_AFTER) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ std::string Name;
+ SI_32 Priority;
+ SI_32 Timeout;
+ SI_32 TimeoutAfter;
+};
+
+enum EInsertEventType {
+ eInsertEventEELStorage,
+ eInsertEventEELActive,
+ eInsertEventLoggerserviceEmmcLogs,
+ eInsertEventInvalid
+};
+
+struct ExternalLogInfo {
+ std::string dirname;
+ std::string path;
+ BOOL remove;
+};
+
+struct ExternalLogList {
+ SI_32 num;
+ SI_32 max;
+ ExternalLogInfo* p_info;
+};
+
+class CLoggerCfg {
+ public:
+ CLoggerCfg(void);
+ ~CLoggerCfg(void);
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus Load(const std::string &f_filePathAndName);
+ EFrameworkunifiedStatus Validate(void);
+ void Print(void);
+
+ EFrameworkunifiedStatus SetLoggingParams(HANDLE f_hApp,
+ STLoggerSetParams f_stLoggerSetParams);
+
+ EFrameworkunifiedStatus SetUDPLogging(HANDLE f_hApp, const ELOGGER_STAT f_eUDPLoggingStatus);
+
+ EFrameworkunifiedStatus PersistLoggingParam(HANDLE f_hApp);
+ std::string getEmmcOutputPath(void);
+ std::string getEmmcOutputNaviLogPath(void);
+ std::string getUsb0MountPath(void);
+ std::string getUsb1MountPath(void);
+ std::string getSdMountPath(void);
+ std::string getDeviceName(void);
+ void setUsb0MountPath(std::string &f_deviceMountpath); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus GetUserInvokedDestination(std::string &f_dest); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus GetEmmcDestination(std::string &f_dest); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus GetEmmcNaviLogDestination(std::string &f_dest); // NOLINT (runtime/references)
+
+ UI_32 GetUserInvokedCounter(void);
+ EFrameworkunifiedStatus GetIncrementAndPersistUserInvokedCounter(HANDLE f_hApp,
+ UI_32 &f_counter); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus GetAndIncrementEmmcCounter(UI_32 &f_counter); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus RefreshEmmcCounter(UI_32 &f_counter) const; // NOLINT (runtime/references)
+
+ void ResetEmmcCounter(void);
+
+ SI_32 m_logMaxFileSize;
+ UI_32 m_logMask[ZONE_MASK_ARRAY_ELTS];
+ SI_32 m_performanceLogMaxFileSize;
+ SI_32 m_emmcOutputMax;
+ SI_32 m_emmcOutputErrMax;
+ SI_32 m_emmcOutputGrpRelaunchMax;
+ SI_32 m_emmcOutputNaviLogMax;
+ SI_32 m_emmcOutputNaviLogNmlMax;
+ SI_32 m_emmcOutputNaviLogErrMax;
+ ExternalLogList m_ExternalLogList;
+
+ std::string m_emmcOutputPath;
+ std::string m_emmcOutputNaviLogPath;
+ std::string m_usb0MountPath;
+ std::string m_usb1MountPath;
+ std::string m_sdMountPath;
+
+ EDEV_TYPE GetConnectedDevice(std::string f_devPath);
+ EInsertEventType GetInsertEventType(std::string f_relPath);
+
+ std::string GetEELActivateRelPath(void);
+ std::string GetDebugFolderContentRelPath(void);
+ std::string GetEELExportRelPath(void);
+
+ BOOL IsUDPLoggingEnabled(void);
+ void AddLoggingParamCB(CbFuncPtr f_fp);
+
+ EFrameworkunifiedStatus GetLoggerStorageInfo(SLoggerStorageInfo &f_info); // NOLINT (runtime/references)
+ BOOL IsLoggingEnabled(void);
+ EFrameworkunifiedStatus EelActivateLogging(HANDLE f_hApp);
+ ExternalLogList GetExternalLogList(void);
+
+ private:
+ void UpdateLoggingStatus(void);
+ std::vector<CbFuncPtr> m_LoggingCallBack;
+ void GetHighestEmmcCounterValue(UI_32 &f_counter); // NOLINT (runtime/references)
+
+ EDEV_TYPE m_eDevType;
+ UI_32 m_UserInvokedLoggingNumber;
+ UI_32 m_EmmcCounter;
+ ELOGGER_STAT m_eLoggerUDPLoggingStatus;
+ BOOL m_udpEnvFlag;
+ ELOGGER_STAT m_eLoggerStatus;
+
+ std::string m_EELStorageRelPath;
+
+ std::string m_EELActivateRelPath;
+
+ std::string m_LoggerserviceEmmcLogsRelPath;
+
+ EFrameworkunifiedStatus SetandPersistLoggingParams(HANDLE f_hApp,
+ STLoggerSetAllParams f_Params,
+ BOOL f_InitCall);
+ SLoggerStorageInfo m_loggerStorageInfo;
+
+ void RemoveCarriageReturn(std::string &f_str); // NOLINT (runtime/references)
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
+
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_common.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_common.h
new file mode 100755
index 0000000..80a56af
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_common.h
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains the callback for Notifications and Protocol
+/// commands.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup logger_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_COMMON_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_COMMON_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+const CHAR DEBUG_LOG_PATH_DIR[] = "/tmp/frameworkunifiedlog";
+const CHAR DEBUG_LOG_PATH_FN[] = "/tmp/frameworkunified_debug.log";
+const CHAR TRANSMIT_LOG_PATH_FN[] = "/tmp/interfaceunified_transmit.log";
+const CHAR PERFORMANCE_LOG_PATH_FN[] = "/tmp/frameworkunified_performance.log";
+const CHAR DRINITIAL_LOG_PATH_FN[] = "/tmp/loggerservice_drinitial.log";
+const CHAR DRLOCATION_LOG_PATH_FN[] = "/tmp/loggerservice_drlocation.log";
+const CHAR KERNEL_LOG_PATH_FN[] = "/tmp/kernel.log";
+const CHAR KERNEL_BOOT_LOG_PATH_FN[] = "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/kernelboot.log";
+
+const UI_32 PERFORMANCELOG_FILE_SZ = 256 * 1024;
+
+#define CLEAR_LOG_PATH_FN "/nv/BS/ss/logger_service/rwdata/frameworkunifiedlog/"
+#define NULLCHAR '\0'
+
+#define DEBUG_USB_PATH "/mnt/sda1"
+#define KERNEL_LOG_PATH_DIR "kernellog"
+
+template<typename C, EFrameworkunifiedStatus (C::*M)(HANDLE)>
+class cpp_callback {
+ public:
+ static CallbackFunctionPtr set(void* pInst) {
+ if (pInst == NULL)
+ throw;
+ ms_pInst = pInst;
+ return &cpp_callback::call;
+ }
+ static EFrameworkunifiedStatus call(HANDLE y) {
+ if (ms_pInst == NULL)
+ return eFrameworkunifiedStatusFault;
+ C* c = static_cast<C*>(ms_pInst);
+ return (c->*M)(y);
+ }
+ private:
+ static void* ms_pInst;
+};
+
+template<typename C, EFrameworkunifiedStatus (C::*M)(HANDLE)>
+void* cpp_callback<C, M>::ms_pInst = NULL;
+
+typedef enum _LoggerServiceStatus {
+ eLSInit,
+ eLSStart,
+ eLSStop,
+} ELOGGERSERVICESTATUS;
+
+typedef enum {
+ SS_LOGGER_KLOG_GET, /* type : get kernel.log */
+ SS_LOGGER_KBOOTLOG_CREATE /* type : create kernelboot.log */
+} SS_LOGGER_KLOG_OPE_TYPE;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StopLoggingFunction
+/// \~english @par Summary
+/// Stop the logging function.
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @retval
+/// None
+/// \~english @par Detail
+/// - The API stops the logging function.\n
+/// \n
+/// - Include ss_logger_common.h
+/// - Library libSS_SystemIfUnified.so
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+void StopLoggingFunction(HANDLE hApp);
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_COMMON_H_
+
+/** @}*/ // end of LoggerService
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_device_detection.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_device_detection.h
new file mode 100755
index 0000000..5ee67c0
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_device_detection.h
@@ -0,0 +1,66 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief This file supports USB logging threads.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_DEVICE_DETECTION_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_DEVICE_DETECTION_H_
+
+#include <system_service/ss_devicedetection_service_notifications.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include "ss_logger_cfg.h"
+#include "ss_logger_util.h"
+
+extern const char * USB_INSERTED_RULE;
+
+// USB device is ejected
+extern const CHAR USB_EJECTED_RULE[];
+
+// The trigger event file (/log/retrievelog.evt) file is found on USB
+extern const CHAR USB_CAPTURE_LOG_EVENT_RULE[];
+
+// When the command to update system with script is executed all the console
+// output will be redirected to this file on /tmp folder. later it will be
+// moved to USB stick
+extern const CHAR CAPTURE_LOG_FILENAME[];
+
+//
+extern const SI_32 INVALID_FD;
+class CLoggerDeviceDetection {
+ public:
+ CLoggerDeviceDetection();
+ ~CLoggerDeviceDetection();
+
+ EFrameworkunifiedStatus Initialize(HANDLE hApp, CLoggerCfg *f_pLoggerCfg);
+ EFrameworkunifiedStatus DD_ServiceAvailabilityCallBack(HANDLE hApp);
+ EFrameworkunifiedStatus DD_OpenSessionAckCallBack(HANDLE hApp);
+ EFrameworkunifiedStatus DD_CloseSessionAckCallBack(HANDLE hApp);
+ EFrameworkunifiedStatus DD_CloseSessionWithDevDetectionSrv(HANDLE hApp);
+ EFrameworkunifiedStatus DD_MediaDetectCallBack(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnStop(void);
+ private:
+ CLoggerCfg *m_pLoggerCfg;
+
+ /// Device Detection Class Instance
+ DeviceDetectionServiceIf m_devDetect;
+
+ CLoggerUtil *m_loggerUtil;
+};
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_DEVICE_DETECTION_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event.h
new file mode 100755
index 0000000..177c074
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event.h
@@ -0,0 +1,156 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_H_
+
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_system_types.h>
+#include <system_service/ss_system_timer.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <string>
+#include <vector>
+#include "ss_logger_popups.h"
+#include "ss_logger_common.h"
+#include "ss_logger_reader_writer_control.h"
+#include "ss_logger_error_event_cfg.h"
+#include "ss_logger_cfg.h"
+#include "ss_logger_util.h"
+#include "readerWriter/reader_writer.h"
+#include "readerWriter/reader_writer_cfg.h"
+#include "ss_logger_error_event_storage.h"
+#include "ss_logger_error_event_can_evt_reply.h"
+
+class CErrorEvent {
+ public:
+ CErrorEvent();
+ ~CErrorEvent();
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp, CLoggerCfg *f_pLoggerCfg,
+ CReaderWriterControl *f_pReaderWriterControl,
+ HANDLE f_thrdEvntLogWriter,
+ std::string f_strEvntLogQueWorkerName);
+
+ EFrameworkunifiedStatus RegisterSessionErrorEvent(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnOpenSession(HANDLE f_hApp, PCSTR f_pRequesterName,
+ HANDLE f_hSession);
+
+ EFrameworkunifiedStatus OnCloseSession(HANDLE f_hApp, PCSTR f_pRequesterName,
+ HANDLE f_hSession);
+
+ EFrameworkunifiedStatus StartLogging(HANDLE f_hApp, EErrorEventType f_eventType);
+
+ EFrameworkunifiedStatus sendDiagEventErrorResponse(EELL_ErrorCode f_errCode);
+
+ EFrameworkunifiedStatus sendDiagEventErrorResponse(EELL_ErrorCode f_errCode,
+ std::string f_destName);
+
+ EFrameworkunifiedStatus sendDiagEventResponse(void);
+
+ EFrameworkunifiedStatus SetDiagEventSourceName(std::string f_serviceName);
+
+ void SetMileage(UI_32 f_mileage);
+
+ void SetDiagSessionHandle(HANDLE hSession);
+
+ EFrameworkunifiedStatus SaveNaviLog(EPWR_SHUTDOWN_TRIGGER_TYPE errorType);
+ EFrameworkunifiedStatus CreateKernelLog(HANDLE f_hApp, SS_LOGGER_KLOG_OPE_TYPE type);
+
+ private:
+ typedef enum {
+ kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN,
+ kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN,
+ kSSL_ERROR_EVENT_TIMER_END
+ } ESSLErrorEventTimers;
+
+ // Logging Protocol Function Prototypes
+ EFrameworkunifiedStatus OnStartLogging(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnLogStartResponse(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnLogStartResponseTimeout(HANDLE f_hApp);
+ EFrameworkunifiedStatus RequestNextArtifact(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnArtifactResponse(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnArtifactResponseTimeout(HANDLE f_hApp);
+
+ // Protocol functions sent to self.
+ EFrameworkunifiedStatus OnArtifactRequest(HANDLE f_hApp);
+
+ // Error Event Artifact Request Function Prototypes
+ EFrameworkunifiedStatus SendLogArtifactResponseToSelf(
+ HANDLE f_hApp, EArtifactId f_artifactId,
+ std::string f_artifactFilePathAndName);
+
+ EFrameworkunifiedStatus OnObtainLoggerserviceLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainTransmitLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainPerformanceLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainScreenShotRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainScreenShotResponse(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainKernelLogInfoRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainDRInitialLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainDRLocationLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseOk(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseWriteFailed(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseNotFound(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseNoWritten(HANDLE f_hApp);
+ EFrameworkunifiedStatus CheckPathForArtifact(HANDLE f_hApp, TLoggingArtifact f_artifact);
+ EFrameworkunifiedStatus OnClearAllLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnNaviLogRequest(HANDLE f_hApp);
+
+ // verify function for external storage
+ EFrameworkunifiedStatus VerifyExtStorage(TLoggerErrorEvent event);
+ bool IsNeedVerify(EErrorEventType type);
+
+ HANDLE m_hApp;
+ bool m_bIsPrevEventCompleted;
+ CErrorEventCfg m_errorEventCfg;
+ TLoggerErrorEvent m_errorEventNtfData;
+ Timer m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_END];
+ std::vector<TLoggingArtifact> m_artifactRequestVec;
+ TArtifactResponseVec m_artifactResponseVec;
+ std::vector<FrameworkunifiedProtocolCallbackHandler> m_requesterCallbacksVec;
+ std::string m_archiveDestination;
+ CLoggerUtil m_loggerUtil;
+ CLoggerPopups m_loggerPopups;
+ CLoggerCfg* m_pLoggerCfg;
+ CLoggerErrorEventStorage m_loggerStorage;
+ CLoggerErrorEventCANEvtReply m_loggerCanEvent;
+ static const UI_32 m_loggingStartRspnToSec = 1;
+ static const UI_32 m_screenShotRspnToSec = 2;
+ CReaderWriterControl* m_pReaderWriterControl;
+
+ std::string m_ServiceName;
+ uint32_t m_time;
+ UI_32 m_currentEventTriggerNumber;
+ HANDLE m_diagsessionhandle;
+
+ HANDLE m_thrdEvntLogWriter;
+
+ public:
+ int m_sfd;
+};
+
+EFrameworkunifiedStatus SSLogger_SendtoSM(HANDLE f_hApp, TLoggingArtifact f_artifact);
+EFrameworkunifiedStatus SSLogger_SendtoSelf(HANDLE f_hApp, TLoggingArtifact f_artifact);
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_H_
+
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_archive.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_archive.h
new file mode 100755
index 0000000..2b5212d
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_archive.h
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_ARCHIVE_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_ARCHIVE_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <libtar_listhash.h>
+#include <libtar.h>
+
+#include <system_service/ss_system_types.h>
+#include <string>
+#include <vector>
+
+class CErrorEventArchive {
+ public:
+ CErrorEventArchive();
+ ~CErrorEventArchive();
+
+ EFrameworkunifiedStatus openArchive(std::string f_pathAndName);
+
+ EFrameworkunifiedStatus addToArchive(std::vector<std::string> f_filePathAndNameList);
+
+ EFrameworkunifiedStatus addToArchive(std::string f_filePathAndName,
+ std::string f_destinationName, UI_8 f_depth =
+ CErrorEventArchive::MAX_DIRECTORY_DEPTH);
+
+ EFrameworkunifiedStatus closeArchive(void);
+
+ static SI_32 gzOpenArchive(PCHAR f_pcPathname, SI_32 f_siOflags,
+ SI_32 f_siMode);
+
+ static SI_32 gzCloseArchive();
+
+ static ssize_t gzWriteArchive(int fd, const void* buf, size_t count);
+
+ static ssize_t gzReadArchive(int fd, void* buf, size_t count);
+
+ static const UI_8 MAX_DIRECTORY_DEPTH = 4;
+
+ private:
+ EFrameworkunifiedStatus addFileToArchive(std::string f_filename,
+ std::string f_destinationName);
+
+ EFrameworkunifiedStatus addDirectoryToArchive(std::string f_path,
+ std::string f_destinationName, UI_8 f_depth =
+ CErrorEventArchive::MAX_DIRECTORY_DEPTH);
+
+ tartype_t m_gztype;
+ TAR *m_pTarInfo;
+ std::string m_pathAndName;
+ std::string m_tmpName;
+
+ static const UI_32 TARMODE = 0644;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_ARCHIVE_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_can_evt_reply.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_can_evt_reply.h
new file mode 100755
index 0000000..b976cdb
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_can_evt_reply.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports notifying CAN abou HK and CAN error events
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CAN_EVT_REPLY_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CAN_EVT_REPLY_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_logger_service_protocol.h>
+
+#include "ss_logger_cfg.h"
+#include "ss_logger_error_event_cfg.h"
+#include "ss_logger_common.h"
+class CLoggerErrorEventCANEvtReply {
+ public:
+ CLoggerErrorEventCANEvtReply();
+ virtual ~CLoggerErrorEventCANEvtReply();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg);
+
+ BOOL IsEventNeeded(TLoggerErrorEvent f_event);
+ EFrameworkunifiedStatus PublishStartEvent(HANDLE f_hApp, TLoggerErrorEvent f_event);
+ EFrameworkunifiedStatus PublishEndEvent(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ UI_32 f_triggerNumber, uint32_t f_time);
+
+ EFrameworkunifiedStatus PublishErrorEvent(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ BOOL f_isValid, UI_32 f_triggerNumber,
+ uint32_t f_time);
+ private:
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CAN_EVT_REPLY_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_cfg.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_cfg.h
new file mode 100755
index 0000000..1a0e39e
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_cfg.h
@@ -0,0 +1,135 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
+#include <system_service/ss_system_manager_if.h>
+#include <vector>
+#include <map>
+#include <string>
+
+#include "ss_logger_cfg.h"
+
+typedef UI_32 ARTIFACT_BIT_MASK;
+typedef UI_32 EVENT_BIT_MASK;
+
+#define NBR_ARTIFACT_BITS (sizeof(ARTIFACT_BIT_MASK) * 8)
+
+enum EVENT_BIT {
+ EVENT_BIT_NONE = 0x00000000,
+ EVENT_BIT_POPUP = 1 << (UI_32) 1,
+ EVENT_BIT_CAN_NOTIFICATION = 1 << (UI_32) 2,
+ EVENT_BIT_DIAG = 1 << (UI_32) 3,
+};
+
+struct TLoggingErrorEventInformation {
+ ARTIFACT_BIT_MASK ArtifactBitMask;
+ EVENT_BIT_MASK EventBitMask;
+};
+struct TLoggingArtifactCfg {
+ EErrorEventType ErrorType;
+ TLoggingErrorEventInformation Information;
+};
+struct TLoggerErrorEvent {
+ TLoggerErrorEvent()
+ : EventType(eErrorEventTypeMaxValue),
+ ModuleName(""),
+ isNeedReboot(FALSE),
+ EventBitMask(EVENT_BIT_NONE) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ TLoggerErrorEvent(SMErrorEventNtfData l_SMErrorEvent) { // NOLINT (runtime/explicit)
+ EventType = l_SMErrorEvent.EventType;
+ ModuleName = l_SMErrorEvent.ModuleName;
+ isNeedReboot = l_SMErrorEvent.isNeedReboot;
+ EventBitMask = EVENT_BIT_NONE;
+ }
+ EErrorEventType EventType;
+ std::string ModuleName;
+ BOOL isNeedReboot;
+ EVENT_BIT_MASK EventBitMask;
+};
+struct TLoggingArtifact;
+
+typedef EFrameworkunifiedStatus (*TLoggingCbFunction)(HANDLE, TLoggingArtifact);
+
+enum ECallbackType {
+ eCbTypePath = 0,
+ eCbTypeFunction,
+ eCbTypeInvalid
+};
+
+struct TLoggingArtifactCallback {
+ ECallbackType Type;
+ std::string Path;
+ TLoggingCbFunction Function;
+};
+
+struct TLoggingArtifactInformation {
+ std::string OwnerServiceName;
+ UI_32 RequestTimeoutMs;
+ TLoggingArtifactCallback Cb;
+ BOOL Remove;
+};
+struct TLoggingArtifact {
+ EArtifactId ArtifactId;
+ TLoggingArtifactInformation Information;
+};
+
+struct TLoggingArtifactResponse {
+ EArtifactId ArtifactId;
+ std::string Filepath;
+ BOOL Remove;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////
+///// External function definition for Logger callbacks
+//////////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SSLogger_SendtoSM(HANDLE f_hApp, TLoggingArtifact f_artifact);
+extern EFrameworkunifiedStatus SSLogger_SendtoSelf(HANDLE f_hApp,
+ TLoggingArtifact f_artifact);
+
+typedef std::map<EErrorEventType, TLoggingErrorEventInformation> TArtifactBitMaskMap;
+typedef std::map<EArtifactId, TLoggingArtifactInformation> TArtifactMap;
+typedef std::vector<TLoggingArtifactResponse> TArtifactResponseVec;
+
+class CErrorEventCfg {
+ public:
+ CErrorEventCfg(void);
+
+ ~CErrorEventCfg(void);
+
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* p_logger_cfg);
+
+ void GetArtifactRequestVec(
+ EErrorEventType f_eventType,
+ std::vector<TLoggingArtifact> &f_refArtifactRequestVec); // NOLINT (runtime/references)
+ EVENT_BIT_MASK GetEventsForErrorEvent(EErrorEventType f_eventType);
+ private:
+ UI_32 ValidateConfiguration();
+ TArtifactBitMaskMap m_errorEventTypeToArtifactBitMaskMap;
+ TArtifactMap m_errorArtifactMap;
+ UI_32 m_ext_log_num;
+
+ static TLoggingArtifactCfg m_loggerErrorEventCfgTbl[eErrorEventTypeMaxValue];
+ static TLoggingArtifact m_loggerErrorArtifactCfgTbl[eArtifactIdMaxValue];
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_storage.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_storage.h
new file mode 100755
index 0000000..8a2cbd4
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_error_event_storage.h
@@ -0,0 +1,82 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_STORAGE_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_STORAGE_H_
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <mqueue.h>
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <ss_logger_error_event_cfg.h>
+#include <stub/Clock_API.h>
+#include <string>
+#include "ss_logger_cfg.h"
+
+enum ELoggerStorageThreadCommands {
+ eLoggerStorageThreadCmdOK = 0xAFFE,
+ eLoggerStorageThreadCmdWriteFailed,
+ eLoggerStorageThreadCmdNotFound,
+ eLoggerStorageThreadCmdNoWritten
+};
+
+class CLoggerErrorEventStorage {
+ public:
+ CLoggerErrorEventStorage();
+ virtual ~CLoggerErrorEventStorage();
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp, std::string f_ParentName,
+ CLoggerCfg *f_pLoggerCfg);
+
+ EFrameworkunifiedStatus Start(std::string f_target, TArtifactResponseVec f_responseVector,
+ uint32_t f_time);
+
+ void ThreadFunction(void);
+ void Cleanup(void);
+
+ private:
+ static void* ThreadFunctionWrapper(void* param);
+ static void CleanupWrapper(void* param);
+
+ EFrameworkunifiedStatus PackageAndPlaceArtifacts(std::string f_archiveDestination,
+ TArtifactResponseVec &f_responseVector, // NOLINT (runtime/references)
+ uint32_t l_logTime);
+
+ SI_32 CopyFiles(std::string f_archiveDestination,
+ TArtifactResponseVec &f_responseVector, BOOL isDeleteFiles); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus RemoveDeprecatedArtifacts(TArtifactResponseVec &f_responseVector); // NOLINT (runtime/references)
+ HANDLE m_parentMcQueue;
+ pthread_t m_thread;
+ pthread_mutex_t m_mutex;
+ mqd_t m_sendQueue;
+ mqd_t m_receiveQueue;
+ std::string m_destination;
+ TArtifactResponseVec m_responseVec;
+ struct mq_attr m_mqattr;
+ SI_32 m_mutexInit;
+ CLoggerCfg *m_pLoggerCfg;
+ SLoggerStorageInfo m_loggerStorageInfo;
+ uint32_t m_logTime;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_STORAGE_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_fs_directory.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_fs_directory.h
new file mode 100755
index 0000000..7e8da15
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_fs_directory.h
@@ -0,0 +1,108 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file contains declaration of class CFSDirectory.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_FS_DIRECTORY_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_FS_DIRECTORY_H_
+#include <native_service/frameworkunified_types.h>
+#include<string>
+
+// Class to provide file system directory operations like create,delete etc.
+class CFSDirectory {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFSDirectory
+ /// Constructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFSDirectory
+ /// Destructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to check if the directory exists.
+ ///
+ /// \param [in] f_cDirPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL DoesDirectoryExist(std::string &f_cDirPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to create a directory.
+ ///
+ /// \param [in] f_cDirPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus CreateDirectory(std::string &f_cDirPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to verify directory.
+ ///
+ /// \param [in] f_cPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL IsDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to delete directory.
+ ///
+ /// \param [in] f_cPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL RemoveDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to delete file in direcotry.
+ ///
+ /// \param [in] f_cPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL RemoveSubDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_FS_DIRECTORY_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_popups.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_popups.h
new file mode 100755
index 0000000..b5b50e8
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_popups.h
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_POPUPS_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_POPUPS_H_
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <string>
+#include <vector>
+
+#include "ss_logger_cfg.h"
+#include "ss_logger_error_event_cfg.h"
+class CLoggerPopups {
+ public:
+ CLoggerPopups();
+ virtual ~CLoggerPopups();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg);
+ BOOL IsPopupNeeded(TLoggerErrorEvent f_event);
+ BOOL CanShowStartPopup(std::vector<TLoggingArtifact>* f_remainingArtifact);
+ EFrameworkunifiedStatus ShowStartPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ std::vector<TLoggingArtifact>* f_remainingArtifact,
+ std::string f_dest);
+ EFrameworkunifiedStatus ShowEndPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ std::string f_dest);
+ EFrameworkunifiedStatus ShowErrorPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ UI_16 f_errCode);
+ std::string getDeviceName(std::string f_dest);
+ private:
+ CLoggerCfg *m_pLoggerCfg;
+ BOOL m_startShown;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_POPUPS_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_reader_writer_control.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_reader_writer_control.h
new file mode 100755
index 0000000..04d1937
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_reader_writer_control.h
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * ss_logger_reader_writer_control.h
+ */
+
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_READER_WRITER_CONTROL_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_READER_WRITER_CONTROL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer.h"
+#include "ss_logger_cfg.h"
+
+enum EReaderWriterType {
+ eReaderWriterLogDebug,
+ eReaderWriterLogTransmit,
+ eReaderWriterLogPerformance,
+ eReaderWriterLogInvalid
+};
+class CReaderWriterControl {
+ public:
+ CReaderWriterControl();
+ virtual ~CReaderWriterControl();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg);
+ EFrameworkunifiedStatus UpdateLoggingParams(void* param);
+ EFrameworkunifiedStatus FlushCache(EReaderWriterType f_type);
+ private:
+ CLoggerCfg * m_pLoggerCfg;
+ ReaderWriter::CReaderWriter m_debugReaderWriter;
+ ReaderWriter::CReaderWriter m_transmitReaderWriter;
+ ReaderWriter::CReaderWriter m_performanceReaderWriter;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_READER_WRITER_CONTROL_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_scrshot.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_scrshot.h
new file mode 100755
index 0000000..5cc9dd9
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_scrshot.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_
+
+#define JPEG_PATH_CH0 "/nv/BS/ss/logger_service/rwdata/screenShot/screen_shot_Ch0.jpeg"
+#define JPEG_PATH_CH1 "/nv/BS/ss/logger_service/rwdata/screenShot/screen_shot_Ch1.jpeg"
+#define SCRSHOT_EXE_PATH "/usr/agl/bin/SS_ScrShot"
+#define SCREEN_SHOT_PATH "/nv/BS/ss/logger_service/rwdata/screenShot"
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_service_callbacks.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_service_callbacks.h
new file mode 100755
index 0000000..786054c
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_service_callbacks.h
@@ -0,0 +1,96 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file contains the callback for Notifications and Protocol
+/// commands.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SERVICE_CALLBACKS_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SERVICE_CALLBACKS_H_
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <system_service/ss_error_event_common.h>
+#include "ss_logger_error_event.h"
+#include "ss_logger_reader_writer_control.h"
+#include "ss_logger_cfg.h"
+
+class CLoggerServiceCallbacks {
+ private:
+ static const UI_32 kNUMBER_PROTOCOL_HANDLERS = 17u;
+ FrameworkunifiedProtocolCallbackHandler m_protocolHandlers[kNUMBER_PROTOCOL_HANDLERS];
+ CLoggerCfg *m_pLoggerCfg;
+ CErrorEvent *m_pErrorEvent;
+
+ public:
+ CLoggerServiceCallbacks();
+ ~CLoggerServiceCallbacks();
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp, CLoggerCfg *f_pLoggerCfg,
+ CErrorEvent *f_pErrorEvent);
+
+ EFrameworkunifiedStatus LoggerServerOnOpenSession(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServerOnCloseSession(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_SetMileageData(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_SetLoggerParams(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_UDPLogging(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_SetCurrentDateTime(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_UpdateCommonInfo(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_Handle_CWORD56_Events(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_LogResetEvents(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnCopyEmergencyLog(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnCANTrigger(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnDTCTrigger(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus LoggerServer_On_SHTDWN_Complete(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnSetVIN(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnCopyEvntLog(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnClearEvntLog(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnReadNumberOfEvents(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnReadStatCounter(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnResetStatCounter(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnSetDiagID(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_UploadEventLog(HANDLE hApp);
+
+ HANDLE RetrieveRegisteredClientHandle(HANDLE hApp, PCSTR pRequester);
+};
+
+EFrameworkunifiedStatus LoggerService_OnStop(HANDLE hApp);
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SERVICE_CALLBACKS_H_
+
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_types.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_types.h
new file mode 100755
index 0000000..11542a5
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_types.h
@@ -0,0 +1,52 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports shared internal logger module data types.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_TYPES_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_TYPES_H_
+
+#include <native_service/frameworkunified_sm_eventdata.h>
+
+typedef enum _ENPS_Archivetype {
+ ARCHTYPE_COMPRESSION = 0, // Compression
+ ARCHTYPE_DECOMPRESSION = 1 // DeCompression
+} ENPS_Archivetype;
+
+typedef CHAR CopyInfoStr[MAX_PATH_LENGTH]; ///< Information passed via the framework
+
+typedef enum _LOGGERSERVICE_COMPRESSION_TYPE {
+ eLoggerserviceNone = 0, // No Compression before file persistence
+ eLoggerserviceDefaultCompression, // Compress file before persistence using default compression method
+ eLoggerserviceCompressUsingLibz // Compress file before persistence using libz
+} LOGGERSERVICE_COMPRESSION_TYPE;
+
+typedef struct _NPS_CopyInfoMsg {
+ CopyInfoStr m_cSourcePath; // Source path
+ CopyInfoStr m_cDestinationPath; // Destination path
+ ENPS_Archivetype m_eArchiveType; // Compression or DeCompression
+ LOGGERSERVICE_COMPRESSION_TYPE m_eCompressionType; // Check for Compression of the file
+} NSP_CopyInfoCmd;
+
+typedef struct _NPS_CopyStatus {
+ BOOL m_bPersistenceChk; // Persistence Success or Failure
+ LOGGERSERVICE_COMPRESSION_TYPE m_eCompressionType; // Check for Compression of the file
+} NSP_CopyStatusResponse, NSP_CopyCancel;
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_TYPES_H_
diff --git a/video_in_hal/systemservice/logger_service/server/include/ss_logger_util.h b/video_in_hal/systemservice/logger_service/server/include/ss_logger_util.h
new file mode 100755
index 0000000..a49e022
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/include/ss_logger_util.h
@@ -0,0 +1,127 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief Provide support for SS Logger module utility functions.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_UTIL_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_UTIL_H_
+
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_system_manager_if.h>
+#include <string>
+#include <vector>
+#include "ss_logger_error_event_cfg.h"
+#include "loggerservicedebug_loggerservicelog.h"
+#include "ss_logger_cfg.h"
+///////////////////////////////////////////////////////////////////////////////
+// DEFINE
+///////////////////////////////////////////////////////////////////////////////
+// If you changed BUF_MAX_SIZE, To contact the secure team.
+// Because There is impact for decrypt tool.
+#define BUF_MAX_SIZE (1024*8)
+#define USB_PATH_SIZE 64
+#ifdef RELEASE_BUILD
+#define DEV_ENC_EXTENSION ".enc1"
+#define REL_ENC_EXTENSION ".enc2"
+#define ALIGNMENT_SIZE 4
+#endif // RELEASE_BUILD
+#define LOGGER_TMP_FN "__LOGGER.tmp"
+
+///////////////////////////////////////////////////////////////////////////////
+// CONFIGURATION CLASS DEFINITION
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _ELoggerserviceLogType {
+ eLoggerservicelogTypeNormal,
+ eLoggerservicelogTypeAbnormal,
+ eLoggerservicelogTypeGrpRelaunch,
+ eLoggerservicelogTypeOther,
+} ELOGGERSERVICELOGTYPE;
+
+class CLoggerUtil {
+ public:
+ CLoggerUtil(void);
+
+ ~CLoggerUtil(void);
+
+ EFrameworkunifiedStatus Initialize(CLoggerCfg *f_pLoggerCfg);
+
+ EFrameworkunifiedStatus checkDestinationAvailable(TLoggerErrorEvent &f_eventNtfData); // NOLINT (runtime/references)
+ std::string getDestination(TLoggerErrorEvent &f_eventNtfData); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus getFilePathAndName(HANDLE f_hApp,
+ TLoggerErrorEvent &f_eventNtfData, // NOLINT (runtime/references)
+ uint32_t f_time, std::string &f_pathAndName); // NOLINT (runtime/references)
+ void SetMilage(UI_32 f_milage);
+
+ EFrameworkunifiedStatus getEmmcNaviLogParams(uint32_t f_time,
+ EPWR_SHUTDOWN_TRIGGER_TYPE errorType,
+ std::string &f_pathAndName, UI_32 &f_logMax); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus deleteOldLog(std::string log_path,
+ std::vector<std::string> &l_vector, // NOLINT (runtime/references)
+ std::string &f_archive_destination, UI_32 max_num); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus deleteOldEmmcLog(std::string &f_archive_destination, // NOLINT (runtime/references)
+ EErrorEventType type);
+ static EFrameworkunifiedStatus forceDeleteOldLog(std::string f_archive_destination,
+ size_t f_req_size);
+ static size_t deleteRequestLogs(std::string f_emmcpath, ELOGGERSERVICELOGTYPE f_reqtype,
+ size_t f_reqsize, ELOGGERSERVICELOGTYPE f_deltype);
+ static EFrameworkunifiedStatus CopyFile(std::string f_source, std::string f_destination);
+ static EFrameworkunifiedStatus CopyUntyped(std::string f_source,
+ std::string f_destination);
+ static EFrameworkunifiedStatus CopyDirectory(std::string f_source,
+ std::string f_destination);
+
+ static EFrameworkunifiedStatus MoveFile(std::string f_source, std::string f_destination);
+ static EFrameworkunifiedStatus MoveUntyped(std::string f_source,
+ std::string f_destination);
+ static EFrameworkunifiedStatus MoveDirectory(std::string f_source,
+ std::string f_destination);
+
+ static ELOGGERSERVICELOGTYPE QueryLoggerservicelogType(std::string f_logname);
+ static void SyncDir(std::string f_dir_path);
+#ifdef RELEASE_BUILD
+ static EFrameworkunifiedStatus PathCheckAndCopyFile(std::string f_source,
+ std::string f_destination);
+#endif // RELEASE_BUILD
+ void SetUsbMountPath(std::string usbpath);
+
+ private:
+ std::string GetUserInvokedFilename(HANDLE f_hApp, uint32_t f_time);
+ std::string GetEmmcFilename(uint32_t f_time);
+ std::string GetEmmcErrorFilename(uint32_t f_time);
+ std::string GetEmmcNaviLogFilename(uint32_t f_time);
+ std::string GetTimeString(uint32_t f_time);
+
+ EFrameworkunifiedStatus getNaviLogFilePathAndName(std::string &f_prefix, uint32_t f_time, // NOLINT (runtime/references)
+ std::string &f_pathAndName); // NOLINT (runtime/references)
+
+ CLoggerCfg *m_pCfg;
+ UI_32 m_Milage;
+ UI_32 m_bootCount;
+ static char m_usbpath[USB_PATH_SIZE];
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_UTIL_H_
+
diff --git a/video_in_hal/systemservice/logger_service/server/lib/Makefile b/video_in_hal/systemservice/logger_service/server/lib/Makefile
new file mode 100755
index 0000000..fff8c36
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/lib/Makefile
@@ -0,0 +1,62 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+
+
+######### installed library(*.a) #############
+INST_LIBS = libSS_LoggerStoreLogs
+
+######### installed shared library(*.so) #############
+
+
+######### install headers(*.h) #############
+
+
+######### compiled sources #############
+libSS_LoggerStoreLogs_SRCS += ss_logger_store_logs.cpp
+
+######### add source path #############
+
+
+######### add include path #############
+CPPFLAGS += -I./
+CPPFLAGS += -I../include
+
+CPPFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30
+CPPFLAGS += -fno-exceptions
+
+######### linked library #############
+
+
+######### linked library (dynamic) #############
+
+
+######### add library path #############
+LDFLAGS += -g -shared
+LDFLAGS += -Wl,--no-as-needed
+include ../../../system_service.mk
diff --git a/video_in_hal/systemservice/logger_service/server/lib/ss_logger_store_logs.cpp b/video_in_hal/systemservice/logger_service/server/lib/ss_logger_store_logs.cpp
new file mode 100755
index 0000000..2bd8b79
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/lib/ss_logger_store_logs.cpp
@@ -0,0 +1,2233 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_Logger
+/// \brief This file supports the logger service interface for SystemManager.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_logger_store_logs.h"
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <libtar_listhash.h>
+#include <libtar.h>
+#include <zlib.h>
+#include <sys/klog.h>
+
+#include <stdlib.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_system_types.h>
+#include <native_service/ns_ringbuffer.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/cl_lockid.h>
+#include <stub/Clock_API.h>
+#include <vector>
+#include <sstream>
+#include <iomanip>
+#include <string>
+#include <algorithm>
+#include "ss_logger_store_logs_loggerservicelog.h"
+#include "ss_logger_cfg.h"
+
+#define LOGGERSERVICELOG_CONFIG_PATH "/usr/agl/conf/BS/ss/logger_service/rodata/ss_logger.cfg"
+#define LOGGER_TMP_FN "__LOGGER.tmp"
+#define LOGGERSERVICELOG_TMP_OUTPUT_PATH "/tmp"
+#define PSTORE_DIR_PATH "/dev/pstore"
+#define KERNEL_BOOT_LOG_FN "kernelboot.log"
+#define KERNEL_LOG_FN "kernel.log"
+#define COMMUNICATION_DIR_NAME "communication"
+#define ACCOFFON_DIR_NAME "accoffon"
+
+#define PATHNAME_SEPARATOR '/'
+#define PATHNAME_SEPARATOR_STR "/"
+#define SS_STORE_FILENAME_SYSILG_TERM "_SYS_ILG_RESET.tar.gz"
+#define SS_STORE_FILENAME__CWORD52__TERM "__CWORD52_.log"
+#define LOGARCHIVE_FILENAME_STORE_ARCHIVE "/tmp/ss_logger_ilgfilenum"
+#define TMPFILE_MODE 0640
+#define SSLOGGER_PATHNAME (255 + 1)
+#define FILENUMBER_UPPER_LIMIT_OVER 100000u
+#define FILENUMBER_LOWER_LIMIT 1u
+#define FILENUMBER_DIGIT_NUM 5
+#define INVALID_FILENUMBER (FILENUMBER_UPPER_LIMIT_OVER)
+
+
+/* Read all messages remaining in the ring buffer. (allowed for non-root) */
+#define SYSLOG_ACTION_READ_ALL 3
+/* Return size of the log buffer */
+#define SYSLOG_ACTION_SIZE_BUFFER 10
+
+#define ENABLE_DEBUG_LOG 0
+#if ENABLE_DEBUG_LOG
+#define DEB_LOGGERSERVICELOG(zone,funcname,print_fmt, ...) if(zone!=ZONE_FUNC) \
+fprintf(stderr,"%d/%s/%d:="print_fmt"\n", zone, funcname, __LINE__,##__VA_ARGS__)
+#else
+#define DEB_LOGGERSERVICELOG(zone,funcname,print_fmt, ...)
+#endif
+
+typedef struct {
+ std::string output_path;
+ SI_32 output_max;
+ SI_32 output_errmax;
+ SI_32 external_log_num;
+ SI_32 external_log_max;
+} CfgInfo;
+
+typedef struct {
+ std::string file_path;
+ std::string dest_name;
+ BOOL tmp_file_delete;
+} LogInfo;
+
+typedef struct {
+ std::string path;
+ int index;
+} LoggerservicelogInfo;
+
+
+static const char* sys_illegal_log[] = {
+ "frameworkunified_sys.log",
+ };
+
+
+typedef enum {
+ SS_STORELOGS_KERNEL_LOG = 0,
+ SS_STORELOGS_KERNEL_BOOT_LOG
+} SS_STORELOGS_KERNEL_LOG_TYPE;
+
+typedef void (*GetLogFileFunc)(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list); // NOLINT (runtime/references)
+
+static const UI_8 MAX_DIRECTORY_DEPTH = 4;
+static const UI_32 TARMODE = 0644;
+
+static EFrameworkunifiedStatus addToArchive(TAR* f_pTarInfo, std::string f_filePathAndName,
+ std::string f_destinationName, UI_8 f_depth =
+ MAX_DIRECTORY_DEPTH);
+static EFrameworkunifiedStatus addDirectoryToArchive(TAR* f_pTarInfo, std::string f_path,
+ std::string f_destinationName,
+ UI_8 f_depth = MAX_DIRECTORY_DEPTH);
+static SI_32 gzOpenArchive(PCHAR f_pcPathname, SI_32 f_siOflags,
+ SI_32 f_siMode);
+static SI_32 gzCloseArchive();
+static ssize_t gzWriteArchive(int fd, const void* buf, size_t count);
+static ssize_t gzReadArchive(int fd, void* buf, size_t count);
+static EFrameworkunifiedStatus addFileToArchive(TAR* f_pTarInfo, std::string f_filename,
+ std::string f_destinationName);
+static EFrameworkunifiedStatus addAllFileToArchive (TAR* f_pTarInfo, std::string collectDir);
+static EFrameworkunifiedStatus copyFile(std::string f_source, std::string f_destination);
+static EFrameworkunifiedStatus copyDirectory (std::string f_source, std::string f_destination);
+static EFrameworkunifiedStatus copyUntyped (std::string f_source, std::string f_destination);
+static EFrameworkunifiedStatus copyFileToAccOffOnDir(std::vector<LogInfo>& list, SS_STORELOGS_OPE_TYPE type);
+static void getLoggerservicelogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list, // NOLINT (runtime/references)
+ std::vector<LoggerservicelogInfo> &loggerservicelogList); // NOLINT (runtime/references)
+static void getKernellogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list); // NOLINT (runtime/references)
+static void getLastKernelLog(std::vector<LogInfo>& list); // NOLINT (runtime/references)
+static void getKernelLog(std::vector<LogInfo>& list); // NOLINT (runtime/references)
+static void getKernelBootLog(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list); // NOLINT (runtime/references)
+static void getCommunicationlogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list); // NOLINT (runtime/references)
+static void getExternallogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list); // NOLINT (runtime/references)
+
+//static std::string getFileName(std::string &path, uint32_t f_time, // NOLINT (runtime/references)
+// SS_STORELOGS_OPE_TYPE type);
+static std::string getFileName(std::string &path, uint32_t f_time, // NOLINT (runtime/references)
+ SS_STORELOGS_OPE_TYPE type, UI_32 l_counter);
+
+static void getEmmcCounter(std::string &path, UI_32& f_counter); // NOLINT (runtime/references)
+static void getConfigInfo(CfgInfo& f_cfginfo); // NOLINT (runtime/references)
+static EFrameworkunifiedStatus deleteOldEmmcLog(CfgInfo& f_cfginfo, // NOLINT (runtime/references)
+ std::string& f_archive_destination, // NOLINT (runtime/references)
+ SS_STORELOGS_OPE_TYPE type);
+static EFrameworkunifiedStatus storeLogs(SS_STORELOGS_OPE_TYPE type);
+static EFrameworkunifiedStatus deleteOldLog(std::string log_path,
+ std::vector<std::string>& l_vector, // NOLINT (runtime/references)
+ std::string& f_archive_destination, // NOLINT (runtime/references)
+ UI_32 max_num);
+static size_t deleteRequestLogs(std::string f_emmcpath, ELOGGERSERVICELOGTYPE f_reqtype,
+ size_t f_reqsize, ELOGGERSERVICELOGTYPE f_deltype);
+static EFrameworkunifiedStatus forceDeleteOldLog(std::string f_archive_destination,
+ size_t f_req_size);
+static ELOGGERSERVICELOGTYPE QueryLoggerservicelogType(std::string f_logname);
+static void SyncDir(std::string f_dir_path);
+static BOOL RemoveSubDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+static void CreateSaveFinFlag(SS_STORELOGS_OPE_TYPE type);
+static void ClearLoggerservicelogBuffer(std::vector<LoggerservicelogInfo> &loggerservicelogList); // NOLINT (runtime/references)
+static void copyLoggerservicelogFile(std::string distPath);
+static void deleteTmpAccOffOn(std::string accOffOnDir);
+static void deleteAccOffOnDir(std::string deletePath);
+static void deleteAccOffOnUntyped(std::string deletePath);
+
+static EFrameworkunifiedStatus getFileNumber(const std::string &filename,UI_32 &number);
+static bool compareFileNumber(UI_32 filename1_number,const std::string &filename2);
+static EFrameworkunifiedStatus removeFiles(const std::string &log_path, std::vector<std::string> &l_vector,
+ size_t begin_pos, size_t end_pos);
+static EFrameworkunifiedStatus removeSameNumFiles(std::vector<std::string>::iterator &itr, const std::string &log_path,
+ std::vector<std::string> &l_vector);
+static EFrameworkunifiedStatus deleteOldLogAbnrm(const std::string& log_path, std::vector<std::string>& l_vector,
+ const std::string& f_archive_destination, SI_32 max_num, UI_32 abnrm_total);
+static EFrameworkunifiedStatus storeTempArchive(const std::string &real_name);
+static EFrameworkunifiedStatus getFileNumberFromTempArchive(UI_32 &filenumber);
+
+
+static std::string m_pathAndName; // NOLINT (runtime/string)
+static std::string m_tmpName; // NOLINT (runtime/string)
+
+const GetLogFileFunc GetLogFuncTbl[] = { getKernellogFile,
+ getCommunicationlogFile,
+ getExternallogFile
+ };
+// GZF save variables
+static gzFile g_gztype;
+
+// ->Bus-Error avoidance
+static tartype_t l_gztype;
+
+static EFrameworkunifiedStatus openArchive(TAR** f_pTarInfo, std::string f_pathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+// ->Bus-Error avoidance (because of local variables, content becomes indeterminate when functions exit)
+// tartype_t l_gztype;
+
+ *f_pTarInfo = NULL;
+ g_gztype = NULL;
+ l_gztype.openfunc = (openfunc_t) &gzOpenArchive;
+ l_gztype.closefunc = (closefunc_t) &gzCloseArchive;
+ l_gztype.readfunc = (readfunc_t) &gzReadArchive;
+ l_gztype.writefunc = (writefunc_t) &gzWriteArchive;
+
+ m_pathAndName = f_pathAndName;
+
+ /* check if directory exists */
+ size_t l_found = f_pathAndName.find_last_of('/');
+ std::string l_path = f_pathAndName.substr(0, l_found);
+
+ if (0 != access(l_path.c_str(), F_OK)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory does not exist. Creating...");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ /* create archive in tmp */
+ m_tmpName = "/tmp/log.tar.gz";
+
+ int l_tarRetVal = tar_open(f_pTarInfo, const_cast<char*>(m_tmpName.c_str()), &l_gztype,
+ O_WRONLY | O_CREAT, TARMODE, TAR_GNU);
+
+ if ((l_tarRetVal != 0) || (*f_pTarInfo == NULL) || g_gztype == NULL) { // LCOV_EXCL_BR_LINE 6: tar_open must return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: tar_open must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open TAR-Archive!");
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+static EFrameworkunifiedStatus addToArchive(TAR* f_pTarInfo, std::string f_filePathAndName,
+ std::string f_destinationName, UI_8 f_depth) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFileLoadError;
+ struct stat l_stat;
+ int l_statRetVal;
+
+ if (0 != access(f_filePathAndName.c_str(), F_OK)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. The specified file path and name does not exist: %s",
+ f_filePathAndName.c_str());
+ } else if (0 != (l_statRetVal = stat(f_filePathAndName.c_str(), &l_stat))) { // LCOV_EXCL_BR_LINE 5: stat's error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5: stat's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. stat() for file or directory returned error: %s -> %d",
+ f_filePathAndName.c_str(), l_statRetVal);
+ // LCOV_EXCL_STOP
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ if (0 < f_depth) { // LCOV_EXCL_BR_LINE 6: f_depth must be greater than 0
+ l_eFrameworkunifiedStatus = addDirectoryToArchive(f_pTarInfo, f_filePathAndName,
+ f_destinationName, f_depth);
+ } else {
+ // LCOV_EXCL_START 6: f_depth must be greater than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Maximum recursive depth reached! File %s not added to archive.",
+ f_filePathAndName.c_str());
+ // LCOV_EXCL_STOP
+ }
+ } else if (0 != S_ISREG(l_stat.st_mode)) {
+ char path[PATH_MAX];
+ if (realpath(f_filePathAndName.c_str(), path) != NULL) {
+ f_filePathAndName = path;
+ l_eFrameworkunifiedStatus = addFileToArchive(f_pTarInfo, f_filePathAndName,
+ f_destinationName);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Archive not opened or could not access file: \"%s\"",
+ f_filePathAndName.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. specified file may be a symbolic link or other non 'regular' type. File: %s, mode: 0x%04X.",
+ f_filePathAndName.c_str(), l_stat.st_mode);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+
+static EFrameworkunifiedStatus getFileNumberFromTempArchive(UI_32 &filenumber)
+{
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ char buf[FILENUMBER_DIGIT_NUM + 1];
+ int fd;
+ int result;
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ fd = open(LOGARCHIVE_FILENAME_STORE_ARCHIVE, O_RDONLY);
+ if (fd == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. open(). path = %s ,errno = %d", LOGARCHIVE_FILENAME_STORE_ARCHIVE, errno);
+ return eFrameworkunifiedStatusAccessError;
+ }
+
+ result = read(fd, buf, FILENUMBER_DIGIT_NUM);
+ if (result != FILENUMBER_DIGIT_NUM) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. read(). path = %s ,result = %d, errno = %d",
+ LOGARCHIVE_FILENAME_STORE_ARCHIVE, result, errno);
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ } else {
+ char *endptr;
+ int error_number;
+ int temp_value;
+ buf[FILENUMBER_DIGIT_NUM] = '\x0';
+ errno = EOK;
+ temp_value = strtol(buf, &endptr, 10);
+ error_number = errno;
+ if ((error_number != EOK) || (*endptr != '\x0')) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. Failed to comvert string. source = %s ,errno = %d", buf, errno);
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ filenumber = temp_value;
+ }
+ }
+ result = close(fd);
+ if (result != 0) { // LCOV_EXCL_BR_LINE 6: close() must return ok
+ // LCOV_EXCL_START 6: close() must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. close(). path = %s ,errno = %d", LOGARCHIVE_FILENAME_STORE_ARCHIVE, errno);
+ // LCOV_EXCL_STOP
+ }
+ result = remove(LOGARCHIVE_FILENAME_STORE_ARCHIVE);
+ if (result != 0) { // LCOV_EXCL_BR_LINE 6: remove() must return ok
+ // LCOV_EXCL_START 6: remove() must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. remove(). path = %s ,errno = %d", LOGARCHIVE_FILENAME_STORE_ARCHIVE, errno);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eFrameworkunifiedStatus;
+}
+
+static EFrameworkunifiedStatus storeTempArchive(const std::string &real_name)
+{
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string filename;
+ size_t pos;
+ int fd;
+ int result;
+ const char *p_real_filename;
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ fd = open(LOGARCHIVE_FILENAME_STORE_ARCHIVE, O_CREAT | O_WRONLY, TMPFILE_MODE);
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: open's error case
+ // LCOV_EXCL_START 5: open's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. open(). path = %s ,errno = %d", LOGARCHIVE_FILENAME_STORE_ARCHIVE, errno);
+ return eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+
+ pos = real_name.find_last_of(PATHNAME_SEPARATOR);
+ if (pos == std::string::npos) { // LCOV_EXCL_BR_LINE 6: there must be '/' in string real_name
+ // LCOV_EXCL_START 6: there must be '/' in string real_name
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ p_real_filename = real_name.c_str();
+ // LCOV_EXCL_STOP
+ } else {
+ p_real_filename = &real_name[pos + 1];
+ }
+
+ result = write(fd, p_real_filename, FILENUMBER_DIGIT_NUM);
+ if (result != FILENUMBER_DIGIT_NUM) { // LCOV_EXCL_BR_LINE 5: write's error case
+ // LCOV_EXCL_START 5: write's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. write(). path = %s ,result = %d, errno = %d",
+ LOGARCHIVE_FILENAME_STORE_ARCHIVE, result, errno);
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+
+ result = close(fd);
+ if (result != 0) { // LCOV_EXCL_BR_LINE 5: close's error case
+ // LCOV_EXCL_START 5: close's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__," Error. close(). path = %s ,errno = %d", LOGARCHIVE_FILENAME_STORE_ARCHIVE, errno);
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eFrameworkunifiedStatus;
+}
+
+
+
+//static EFrameworkunifiedStatus closeArchive(TAR* f_pTarInfo) {
+static EFrameworkunifiedStatus closeArchive(TAR* f_pTarInfo, SS_STORELOGS_OPE_TYPE type) {
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (0 != tar_append_eof(f_pTarInfo)) { // LCOV_EXCL_BR_LINE 5: tar_append_eof's error case
+ // LCOV_EXCL_START 5: tar_append_eof's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_append_eof()");
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ if (0 != tar_close(f_pTarInfo)) { // LCOV_EXCL_BR_LINE 5: tar_close's error case
+ // LCOV_EXCL_START 5: tar_close's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not close archive");
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eFrameworkunifiedStatus) { // LCOV_EXCL_BR_LINE 6: l_eFrameworkunifiedStatus must be eFrameworkunifiedStatusOK
+ l_eFrameworkunifiedStatus = copyFile(m_tmpName, m_pathAndName);
+ if (eFrameworkunifiedStatusOK == l_eFrameworkunifiedStatus) {
+
+ if (type == SS_STORELOGS_ILLEGAL) {
+ l_eFrameworkunifiedStatus = storeTempArchive(m_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eFrameworkunifiedStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error. Failed to store temporary file.");
+ }
+ }
+
+ l_eFrameworkunifiedStatus =
+ (0 == remove(m_tmpName.c_str())) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFault;
+ if (eFrameworkunifiedStatusOK != l_eFrameworkunifiedStatus) { // LCOV_EXCL_BR_LINE 5: remove's error case
+ // LCOV_EXCL_START 5: remove's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_WARN,
+ __FUNCTION__,
+ " Warning. Failed to remove temporary archive. Will overwrite on next event");
+ // LCOV_EXCL_STOP
+ }
+ } else if (eFrameworkunifiedStatusErrNoEAGAIN == l_eFrameworkunifiedStatus) { // LCOV_EXCL_BR_LINE 4: no space error case
+ // LCOV_EXCL_START 4: no space error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // disk space full
+ struct stat st_buf;
+ size_t req_size;
+ if (stat(m_tmpName.c_str(), &st_buf) != -1) {
+ req_size = st_buf.st_size;
+ if (eFrameworkunifiedStatusOK == forceDeleteOldLog(m_pathAndName, req_size)) {
+ l_eFrameworkunifiedStatus = copyFile(m_tmpName, m_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eFrameworkunifiedStatus) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Try Again but Error. Failed to copy to destination.%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. force delete failed.%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " emmc full: dest=%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Warning. Failed to get tmp log file stat. dest=%s",
+ m_pathAndName.c_str());
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ /* should we copy lost archive to emmc?? */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Failed to copy to destination. %s", m_pathAndName.c_str());
+ }
+ remove(m_tmpName.c_str());
+ m_tmpName = "";
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+static EFrameworkunifiedStatus addFileToArchive(TAR* f_pTarInfo, std::string f_filename,
+ std::string f_destinationName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK; /* check if Tar is open and if file can be read */
+
+ if ((NULL != f_pTarInfo) && (0 == access(f_filename.c_str(), R_OK))
+ && (0 != f_destinationName.length())) {
+ int l_tarRetVal = tar_append_file(f_pTarInfo, const_cast<char*>(f_filename.c_str()),
+ const_cast<char*>(f_destinationName.c_str()));
+ if (0 != l_tarRetVal) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not add file \'%s\' to tar archive.", f_filename.c_str());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Archive not opened or could not access file: \"%s\"",
+ f_filename.c_str());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+static EFrameworkunifiedStatus addAllFileToArchive (TAR* f_pTarInfo, std::string collectDir)
+{
+ struct dirent l_pDirent;
+ struct dirent* next;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR * l_pDir = opendir(collectDir.c_str());
+ if (l_pDir == NULL) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s", collectDir.c_str());
+ } else {
+ while (0 == readdir_r(l_pDir,&l_pDirent,&next) && next != NULL) {
+ if ( ( 0 != strcmp( l_pDirent.d_name, "." ) ) &&
+ ( 0 != strcmp( l_pDirent.d_name, ".." )) &&
+ ( 0 != strcmp( l_pDirent.d_name, "lost+found" )) &&
+ ( '.' != l_pDirent.d_name[0] ) ) {
+ std::string l_fileSource = collectDir;
+ l_fileSource.append("/");
+ l_fileSource.append(l_pDirent.d_name);
+ std::string l_fileDestination = l_pDirent.d_name;
+ l_eStatus = addToArchive(f_pTarInfo,l_fileSource,l_fileDestination);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ break;
+ }
+ }
+ }
+ closedir (l_pDir);
+ }
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus addDirectoryToArchive(TAR* f_pTarInfo, std::string f_path,
+ std::string f_destinationName,
+ UI_8 f_depth) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ DIR *l_pDir = opendir(f_path.c_str());
+ if (l_pDir != NULL) {
+ struct dirent* l_pDirent;
+ while ((l_pDirent = readdir(l_pDir)) != NULL) {
+ if ((0 != strcmp(l_pDirent->d_name, ".")) && /* Ignore special . directory. */
+ (0 != strcmp(l_pDirent->d_name, "..")) && /* Ignore special .. directory. */
+ ('.' != l_pDirent->d_name[0])) { /* Ignore hidden files */
+ std::string l_extension = "/";
+ std::string l_fileName = f_path;
+ std::string l_destName = f_destinationName;
+ l_extension.append(l_pDirent->d_name);
+ l_fileName.append(l_extension);
+ l_destName.append(l_extension);
+ l_eFrameworkunifiedStatus = addToArchive(f_pTarInfo, l_fileName, l_destName,
+ static_cast<UI_8>(f_depth - 1));
+ }
+ }
+ closedir(l_pDir);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+static SI_32 gzOpenArchive(PCHAR f_pcPathname, SI_32 f_siOflags,
+ SI_32 f_siMode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SI_32 l_siFileDescriptor = -1;
+
+ if (f_pcPathname) {
+ PCHAR l_pcGzoflags;
+
+ switch (f_siOflags & O_ACCMODE) { // LCOV_EXCL_BR_LINE 200: only O_WRONLY be set
+ case O_WRONLY:
+ l_pcGzoflags = (PCHAR) "wb";
+ break;
+ // LCOV_EXCL_START 200: only O_WRONLY be set
+ case O_RDONLY:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_pcGzoflags = (PCHAR) "rb";
+ break;
+ // LCOV_EXCL_STOP
+ case O_RDWR:
+ default:
+ return -1;
+ }
+ if (-1 == (l_siFileDescriptor = open(f_pcPathname, f_siOflags, f_siMode))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ }
+
+ if ((f_siOflags & O_CREAT) && fchmod(l_siFileDescriptor, f_siMode)) {
+ close(l_siFileDescriptor);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ }
+
+ g_gztype = gzdopen(l_siFileDescriptor, l_pcGzoflags);
+ if (!g_gztype) {
+ close(l_siFileDescriptor);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path empty.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (SI_32) l_siFileDescriptor;
+}
+
+static SI_32 gzCloseArchive() {
+ return gzclose(g_gztype);
+}
+
+static ssize_t gzWriteArchive(int fd, const void* buf, size_t count) {
+ return gzwrite(g_gztype, const_cast<void*>(buf), (unsigned int) count);
+}
+
+static ssize_t gzReadArchive(int fd, void* buf, size_t count) {
+ return gzread(g_gztype, buf, (unsigned int) count);
+}
+
+static EFrameworkunifiedStatus copyFile(std::string f_source, std::string f_destination) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ssize_t l_nrd;
+ ssize_t l_nwr;
+ char l_buf[1024];
+
+ int l_if = open(f_source.c_str(), O_RDONLY | O_CLOEXEC);
+ if (-1 == l_if) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to open file: %s for reading.", f_source.c_str());
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ std::string l_tmpDest;
+ size_t l_pos = f_destination.find_last_of('/');
+
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 6: there must be '/' in string f_destination
+ l_tmpDest = f_destination.substr(0, l_pos);
+ l_tmpDest.append("/");
+ l_tmpDest.append(LOGGER_TMP_FN);
+ if (unlink(l_tmpDest.c_str()) != 0) {
+ // always delete tmpLog, and create new tmpLog.
+ }
+ } else {
+ // LCOV_EXCL_START 6: there must be '/' in string f_destination
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_tmpDest = f_destination;
+ // LCOV_EXCL_STOP
+ }
+
+ int l_of = open(l_tmpDest.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC,
+ 0640);
+ if (-1 == l_of) { // LCOV_EXCL_BR_LINE 5: open's error case
+ // LCOV_EXCL_START 5: open's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "dest open fail:%s,errno:%d,msg:%s",
+ l_tmpDest.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ do {
+ l_nrd = read(l_if, l_buf, sizeof(l_buf));
+ if (l_nrd == -1) { // LCOV_EXCL_BR_LINE 5: read's error case
+ // LCOV_EXCL_START 5: read's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail:%s,errno:%d,msg:%s",
+ f_source.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ l_nwr = write(l_of, l_buf, l_nrd);
+ if (l_nwr == -1) { // LCOV_EXCL_BR_LINE 5: write's error case
+ // LCOV_EXCL_START 5: write's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (ENOSPC == errno) { // LCOV_EXCL_BR_LINE 4: no space error case
+ // LCOV_EXCL_START 4: no space error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "write fail(ENOSPC):%s,errno:%d,msg:%s", l_tmpDest.c_str(),
+ errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusErrNoEAGAIN;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail:%s,errno:%d,msg%s",
+ l_tmpDest.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ } while (l_nrd > 0);
+ fsync(l_of);
+ close(l_of);
+ }
+ close(l_if);
+
+ if (rename(l_tmpDest.c_str(), f_destination.c_str()) != 0) { // LCOV_EXCL_BR_LINE 5: rename's error case
+ // LCOV_EXCL_START 5: rename's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "rename %s to %s fail,errno:%d,msg:%s",
+ l_tmpDest.c_str(), f_destination.c_str(), errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 6: there must be '/' in string f_destination
+ std::string l_destPath = f_destination.substr(0, l_pos);
+ SyncDir(l_destPath);
+ } else {
+ // LCOV_EXCL_START 6: there must be '/' in string f_destination
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "dest invalid:%s", f_destination.c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+static EFrameworkunifiedStatus copyDirectory (std::string f_source, std::string f_destination)
+{
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ DIR * l_pDir = opendir(f_source.c_str());
+ if (l_pDir == NULL) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s", f_source.c_str());
+ } else {
+ if (mkdir(f_destination.c_str(),0775) == -1) {
+ if (errno == EEXIST) {
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "Directory: %s already exists.", f_destination.c_str());
+ } else {
+ DEB_LOGGERSERVICELOG(ZONE_ERR, __FUNCTION__, "Could not create directory: %s. Errno: %s", f_destination.c_str(),strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ SyncDir(f_destination);
+ size_t l_pos = f_destination.find_last_of('/');
+ if (l_pos != std::string::npos) {
+ std::string l_destPath = f_destination.substr(0, l_pos);
+ SyncDir(l_destPath);
+ }
+ }
+
+ struct dirent l_pDirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_pDir,&l_pDirent,&next) && next != NULL) {
+ if ( ( 0 != strcmp( l_pDirent.d_name, "." ) ) &&
+ ( 0 != strcmp( l_pDirent.d_name, ".." )) &&
+ ( 0 != strcmp( l_pDirent.d_name, "lost+found" )) &&
+ ( '.' != l_pDirent.d_name[0] ) ) {
+ std::string l_fileSource = f_source;
+ std::string l_fileDestination = f_destination;
+ l_fileSource.append("/");
+ l_fileSource.append(l_pDirent.d_name);
+ l_fileDestination.append("/");
+ l_fileDestination.append(l_pDirent.d_name);
+ l_eStatus = copyUntyped(l_fileSource,l_fileDestination);
+ }
+ }
+ closedir (l_pDir);
+ }
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus copyUntyped (std::string f_source, std::string f_destination)
+{
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ struct stat l_stat;
+ SI_8 l_statRetVal;
+ if (0 != access(f_source.c_str(), F_OK)) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR,__FUNCTION__," Error. The specified file path and name does not exist: %s", f_source.c_str());
+ } else if (0 != (l_statRetVal = lstat(f_source.c_str(), &l_stat))) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR,__FUNCTION__," Error. stat() for file or directory returned error: %s -> %d", f_source.c_str(), l_statRetVal);
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ l_eStatus = copyDirectory(f_source, f_destination);
+ } else if (0 != S_ISLNK(l_stat.st_mode)) {
+ l_eStatus = copyDirectory(f_source, f_destination);
+ } else if (0 != S_ISREG(l_stat.st_mode)) {
+ l_eStatus = copyFile(f_source, f_destination);
+ } else {
+ DEB_LOGGERSERVICELOG(ZONE_ERR,__FUNCTION__," Error. specified file may be a symbolic link or other non 'regular' type. File: %s, mode: 0x%04X.",f_source.c_str(),l_stat.st_mode);
+ }
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus copyFileToAccOffOnDir(std::vector<LogInfo>& list, SS_STORELOGS_OPE_TYPE type)
+{
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ std::string f_destination = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ f_destination.append("/");
+ f_destination.append(ACCOFFON_DIR_NAME);
+ DIR * l_pDir = opendir(LOGGERSERVICELOG_TMP_OUTPUT_PATH);
+ if (l_pDir == NULL) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s", LOGGERSERVICELOG_TMP_OUTPUT_PATH);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ return l_eStatus;
+ } else {
+ closedir (l_pDir);
+ if (mkdir(f_destination.c_str(), 0775) == -1) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR, __FUNCTION__, "Could not create directory: %s. Errno: %s", f_destination.c_str(),strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ return l_eStatus;
+ }
+ } if (list.size() != 0) {
+ for (UI_32 j = 0; j < list.size(); j++) {
+ std::string dest_name = f_destination;
+ dest_name.append("/");
+ dest_name.append(list.at(j).dest_name);
+ l_eFrameworkunifiedStatus = copyUntyped(list.at(j).file_path, dest_name);
+ if (l_eFrameworkunifiedStatus != eFrameworkunifiedStatusOK) {
+ DEB_LOGGERSERVICELOG(ZONE_WARN, __FUNCTION__, " Error. File %s failed to archive.", list.at(j).file_path.c_str());
+ l_eStatus = l_eFrameworkunifiedStatus;
+ }
+ }
+ copyLoggerservicelogFile(f_destination);
+ }
+ return l_eStatus;
+}
+
+ELOGGERSERVICELOGTYPE QueryLoggerservicelogType(std::string f_logname) {
+// if (f_logname.find("_ILG_RESET.tar.gz") != std::string::npos
+ if (f_logname.find(SS_STORE_FILENAME_SYSILG_TERM) != std::string::npos) {
+ return eLoggerservicelogTypeSysAbnormal;
+ } else if (f_logname.find(SS_STORE_FILENAME__CWORD52__TERM) != std::string::npos) {
+ return eLoggerservicelogType_CWORD52_;
+ } else if (f_logname.find("_ILG_RESET.tar.gz") != std::string::npos
+
+ || f_logname.find("_ERR.tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeAbnormal;
+ } else if (f_logname.find("_GRP_RELAUNCH.tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeGrpRelaunch;
+ } else if (f_logname.find(".tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeNormal;
+ } else {
+ return eLoggerservicelogTypeOther;
+ }
+}
+
+void SyncDir(std::string f_dir_path) {
+ int fd = open(f_dir_path.c_str(), O_RDONLY | O_DIRECTORY | O_CLOEXEC);
+#define OPE_ERR_MSG "%s %s failed. errno:%d,msg:%s"
+ if (fd == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "open",
+ errno, strerror(errno));
+ } else {
+ if (fsync(fd) == -1) { // LCOV_EXCL_BR_LINE 5: fsync's error case
+ // LCOV_EXCL_START 5: fsync's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "fsync",
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ if (close(fd) == -1) { // LCOV_EXCL_BR_LINE 5: close's error case
+ // LCOV_EXCL_START 5: close's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "close",
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+#undef OPE_ERR_MSG
+}
+
+// LCOV_EXCL_START 4: no space error case
+size_t deleteRequestLogs(std::string f_emmcpath, ELOGGERSERVICELOGTYPE f_reqtype,
+ size_t f_reqsize, ELOGGERSERVICELOGTYPE f_deltype) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR* l_dirp = NULL;
+ std::vector<std::string> vect;
+ std::vector<std::string>::iterator it;
+ UI_32 l_count = 0;
+ size_t l_totalsize = 0;
+
+ ELOGGERSERVICELOGTYPE filetype;
+
+
+ // create saved file list on eMMC
+ l_dirp = opendir(f_emmcpath.c_str());
+ if (l_dirp != NULL) {
+ struct dirent l_dirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_dirp, &l_dirent, &next) && next != NULL) {
+ std::string l_filename = l_dirent.d_name;
+
+// if (QueryLoggerservicelogType(l_filename) == f_deltype) {
+// vect.push_back(l_filename);
+// }
+ if ((l_filename == ".") && (l_filename == "..")) {
+ continue;
+ }
+ filetype = QueryLoggerservicelogType(l_filename);
+ if (f_deltype == eLoggerservicelogTypeAbnormal) {
+ if ((filetype == eLoggerservicelogTypeAbnormal) || (filetype == eLoggerservicelogTypeSysAbnormal) ||
+ (filetype == eLoggerservicelogType_CWORD52_)) {
+ vect.push_back(l_filename);
+ }
+ } else if (filetype == f_deltype) {
+ vect.push_back(l_filename);
+ }
+
+ }
+ closedir(l_dirp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " open failed eMMC path: %s",
+ f_emmcpath.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return 0;
+ }
+
+ // get num of delete logs
+ std::sort(vect.begin(), vect.end());
+ for (it = vect.begin(); it != vect.end(); it++) {
+ l_count++;
+
+ std::string l_filename = *it;
+ struct stat st_buf;
+ std::string l_tmpstr = f_emmcpath;
+ l_tmpstr.append(l_filename.c_str());
+ if (stat(l_tmpstr.c_str(), &st_buf) != -1) {
+ l_totalsize += st_buf.st_size;
+ }
+
+ if (l_totalsize > f_reqsize) {
+ break;
+ }
+ }
+
+ // start delete logs
+ if ((l_totalsize > f_reqsize) || (f_reqtype == eLoggerservicelogTypeAbnormal)
+ || (f_reqtype == eLoggerservicelogTypeGrpRelaunch)) {
+ for (it = vect.begin(); it != vect.end() && l_count > 0; it++) {
+ l_count--;
+
+ std::string l_filename = *it;
+ std::string l_tmpstr = f_emmcpath;
+ l_tmpstr.append(l_filename.c_str());
+ if (unlink(l_tmpstr.c_str()) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " unlink failed %s:%d,msg:%s",
+ l_tmpstr.c_str(), errno, strerror(errno));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " del-file=%s total=%d", l_tmpstr.c_str(),
+ l_totalsize);
+ }
+
+ if (f_reqtype == eLoggerservicelogTypeAbnormal) {
+ removeSameNumFiles(it, f_emmcpath, vect);
+ }
+
+ SyncDir(f_emmcpath);
+ } else {
+ l_totalsize = 0;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ " nothing to delete logs req-type=%d del-logtype=%d total=%d, log_count=%d",
+ f_reqtype, f_deltype, l_totalsize, l_count);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_totalsize;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 4: no space error case
+EFrameworkunifiedStatus forceDeleteOldLog(std::string f_archive_destination,
+ size_t f_req_size) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string l_emmc_path;
+ size_t l_delsize = 0;
+ ELOGGERSERVICELOGTYPE l_logtype = eLoggerservicelogTypeOther;
+
+ size_t l_pos = f_archive_destination.find_last_of('/');
+ if (std::string::npos != l_pos) {
+ l_emmc_path = f_archive_destination.substr(0, l_pos);
+ l_emmc_path.append("/");
+ l_logtype = QueryLoggerservicelogType(
+ f_archive_destination.substr(l_pos + 1,
+ f_archive_destination.size() - l_pos + 1));
+
+ if ((l_logtype == eLoggerservicelogTypeSysAbnormal) || (l_logtype == eLoggerservicelogType_CWORD52_)) {
+ l_logtype = eLoggerservicelogTypeAbnormal;
+ }
+
+ }
+
+ if (l_logtype == eLoggerservicelogTypeOther) {
+ // not found
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Invalid Parameter. dest=%s",
+ f_archive_destination.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // remove dirty-file if exist
+ if (unlink(f_archive_destination.c_str()) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " unlink failed %s:%d.",
+ f_archive_destination.c_str(), errno);
+ }
+
+ // delete normal log
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, f_req_size,
+ eLoggerservicelogTypeNormal);
+ if (l_delsize >= f_req_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete normal logs success: req-size=%d, del-size=%d", f_req_size,
+ l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (l_logtype == eLoggerservicelogTypeAbnormal) {
+ // delete abnormal log if request type is abnormal
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " continue delete abnormal logs: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ size_t l_tmpsize = f_req_size;
+ l_tmpsize -= l_delsize;
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, l_tmpsize,
+ eLoggerservicelogTypeAbnormal);
+ if (l_delsize >= l_tmpsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete abnormal logs success: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " abnormal log delete not complete. req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ }
+ } else if (l_logtype == eLoggerservicelogTypeGrpRelaunch) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " continue delete group relaunch logs: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ size_t l_tmpsize = f_req_size;
+ l_tmpsize -= l_delsize;
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, l_tmpsize,
+ eLoggerservicelogTypeGrpRelaunch);
+ if (l_delsize >= l_tmpsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete group relaunch logs success: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " group relaunch log delete not complete. req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " normal log del not complete. req-size=%d, del-size=%d", f_req_size,
+ l_delsize);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function SS_LoggerStoreDebugLogs
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SS_LoggerStoreLogs(SS_STORELOGS_OPE_TYPE type) {
+ if (type < SS_STORELOGS_MAX) {
+ return storeLogs(type);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error. Bad enum number %d", type);
+ return eFrameworkunifiedStatusFail;
+ }
+}
+
+
+EFrameworkunifiedStatus SS_LoggerStoreLogs_deleteOldLogAbnrm(const std::string& log_path,
+ std::vector<std::string>& l_vector,
+ const std::string& f_archive_destination,
+ SI_32 max_num,
+ UI_32 abnrm_total) {
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus;
+ l_eFrameworkunifiedStatus = deleteOldLogAbnrm(log_path, l_vector, f_archive_destination, max_num, abnrm_total);
+ return l_eFrameworkunifiedStatus;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsDirectory
+/// Method to check if the entity is a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+static BOOL IsDirectory(std::string &f_cPath) { // NOLINT (runtime/references)
+ BOOL l_bReturn = FALSE;
+ struct stat st_buf;
+
+ if (-1 == stat(f_cPath.c_str(), &st_buf)) { // LCOV_EXCL_BR_LINE 5: stat's error case // NOLINT (runtime/references) // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5: stat's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: stat failed for path/file %s, errno %d", f_cPath.c_str(),
+ errno);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ // LCOV_EXCL_STOP
+ } else if (S_ISDIR(st_buf.st_mode)) {
+ l_bReturn = TRUE; // return true if f_cPath is a directory
+ }
+ return l_bReturn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveDirectory
+/// Method to remove a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+static BOOL RemoveDirectory(std::string &f_cPath) { // NOLINT (runtime/references)
+ BOOL l_bReturn = FALSE;
+
+ if (RemoveSubDirectory(f_cPath)) { // LCOV_EXCL_BR_LINE 6: RemoveSubDirectory always return true
+ // delete the parent directory
+ if (0 == rmdir(f_cPath.c_str())) { // LCOV_EXCL_BR_LINE 5: rmdir's error case
+ l_bReturn = TRUE;
+ }
+ }
+ return l_bReturn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveSubDirectory
+/// Method to remove a sub directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+static BOOL RemoveSubDirectory(std::string &f_cPath) { // NOLINT (runtime/references)
+ BOOL l_bReturn = TRUE;
+
+ if (!f_cPath.empty()) { // LCOV_EXCL_BR_LINE 6: f_cPath can't be empty
+ std::string l_cFilePath = "";
+ struct dirent l_Dirent;
+ struct dirent* next;
+ DIR *l_pDir = NULL;
+
+ l_pDir = opendir(f_cPath.c_str());
+ if (NULL != l_pDir) { // LCOV_EXCL_BR_LINE 5: opendir's error case
+ if ('/' != f_cPath[f_cPath.length() - 1]) { // LCOV_EXCL_BR_LINE 6: there must be no '/'
+ f_cPath.append("/");
+ }
+
+ while (0 == readdir_r(l_pDir, &l_Dirent, &next) && next != NULL) {
+ if (0 != std::strcmp(l_Dirent.d_name, ".")
+ && 0 != std::strcmp(l_Dirent.d_name, "..")
+ && 0 != std::strcmp(l_Dirent.d_name, "lost+found")) {
+ l_cFilePath.assign(f_cPath);
+ l_cFilePath.append(l_Dirent.d_name); // concatenate the strings to get the complete f_cPath
+ if (TRUE == IsDirectory(l_cFilePath)) {
+ l_bReturn = RemoveDirectory(l_cFilePath);
+ } else {
+ // it's a file, we can use unlink
+ if (unlink(l_cFilePath.c_str()) == -1) { // LCOV_EXCL_BR_LINE 5: unlink's error case
+ // LCOV_EXCL_START 5: unlink's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_bReturn = FALSE;
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+ closedir(l_pDir); // close the directory
+ SyncDir(f_cPath);
+ } else {
+ // LCOV_EXCL_START 5: opendir's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pDir is NULL");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_cPath can't be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Pathname empty.");
+ l_bReturn = FALSE;
+ // LCOV_EXCL_STOP
+ }
+ return l_bReturn;
+}
+
+static void CreateSaveFinFlag(SS_STORELOGS_OPE_TYPE type) {
+ if (type == SS_STORELOGS_INTERFACEUNIFIEDLOG) {
+ int fd;
+ fd = open(SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG,
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0640);
+ if (fd == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error. Create %s. errno %d msg :%s",
+ SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG, errno, strerror(errno));
+ } else {
+ fsync(fd);
+ close(fd);
+ std::string l_flagPath = SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG;
+ size_t l_pos = l_flagPath.find_last_of('/');
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 6: there must be '/' in l_flagPath
+ std::string l_dirPath = l_flagPath.substr(0, l_pos);
+ SyncDir(l_dirPath);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "create saveflag finish.");
+ fprintf(stderr, "%s:Completed\n", __FUNCTION__);
+ }
+ }
+ }
+}
+
+static void deleteAccOffOnUntyped(std::string deletePath)
+{
+ struct stat l_stat;
+ SI_8 l_statRetVal;
+ if (0 != access(deletePath.c_str(), F_OK)) {
+ DEB_LOGGERSERVICELOG(ZONE_WARN, __FUNCTION__, "access error (%s)", deletePath.c_str());
+ } else if (0 != (l_statRetVal = lstat(deletePath.c_str(), &l_stat))) {
+ DEB_LOGGERSERVICELOG(ZONE_WARN, __FUNCTION__, "get stat error (%s)", deletePath.c_str());
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ deleteAccOffOnDir(deletePath);
+ } else if (0 != S_ISREG(l_stat.st_mode)) {
+ unlink(deletePath.c_str());
+ }
+}
+
+static void deleteAccOffOnDir(std::string deletePath)
+{
+ DIR * l_pDir = opendir(deletePath.c_str());
+ if (l_pDir != NULL) {
+ struct dirent l_pDirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_pDir,&l_pDirent,&next) && next != NULL) {
+ if ( ( 0 != strcmp( l_pDirent.d_name, "." ) ) &&
+ ( 0 != strcmp( l_pDirent.d_name, ".." )) &&
+ ( 0 != strcmp( l_pDirent.d_name, "lost+found" )) &&
+ ( '.' != l_pDirent.d_name[0] ) ) {
+ std::string l_deletePath = deletePath;
+ l_deletePath.append("/");
+ l_deletePath.append(l_pDirent.d_name);
+ deleteAccOffOnUntyped(l_deletePath);
+ }
+ }
+ closedir (l_pDir);
+ }
+ RemoveDirectory(deletePath);
+}
+
+static EFrameworkunifiedStatus storeLogs(SS_STORELOGS_OPE_TYPE type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ std::string file_name;
+ std::vector<LogInfo> list;
+ std::vector<LoggerservicelogInfo> loggerservicelogList;
+ TAR* tar_info = NULL;
+ uint32_t time_info;
+ uint8_t status;
+ CfgInfo cfginfo;
+
+ UI_32 l_counter = INVALID_FILENUMBER;
+
+
+ // load ss_logger configuration file.
+ getConfigInfo(cfginfo);
+
+
+ if (type == SS_STORELOGS_SYS_ILLEGAL) {
+ if (getFileNumberFromTempArchive(l_counter) != eFrameworkunifiedStatusOK) {
+ // ------------------------------------ //
+ // no made ILG_RESET.tar.gz //
+ // when is abnormal logging count over. //
+ // ------------------------------------ //
+ return eFrameworkunifiedStatusOK;
+ }
+ }
+
+
+// Clock_getSystemTimeY2K38(&time_info, &status);
+
+// file_name = getFileName(cfginfo.output_path, time_info, type);
+//
+// // prepare log files for collectting
+// for (UI_32 i = 0; i < _countof(GetLogFuncTbl); i++) {
+// GetLogFuncTbl[i](type, list);
+// }
+ file_name = getFileName(cfginfo.output_path, time_info, type, l_counter);
+
+ if (type != SS_STORELOGS_SYS_ILLEGAL) {
+ // prepare log files for collectting
+ for (UI_32 i = 0; i < _countof(GetLogFuncTbl); i++) {
+ GetLogFuncTbl[i](type, list);
+ }
+ }
+
+ if (type == SS_STORELOGS_ACCOFFON) {
+ copyFileToAccOffOnDir(list, type);
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "- : FrameworkunifiedStatus = %d", l_eFrameworkunifiedStatus);
+ return l_eFrameworkunifiedStatus;
+ } else if (type != SS_STORELOGS_ACCOFFON_PRESS) {
+ // loggerservicelogList used with clear buffer
+ getLoggerservicelogFile(type, list, loggerservicelogList);
+ }
+
+ // ---------------------------------------------------------------- //
+ // Warning!!! Logs by using FRAMEWORKUNIFIEDLOG macro, are not saved from here!! //
+ // You can saved logs by FRAMEWORKUNIFIEDLOG after finished to clear buffer. //
+ // ---------------------------------------------------------------- //
+
+ if (list.size() != 0) {
+ // delete old archive before create new one.
+ deleteOldEmmcLog(cfginfo, file_name, type);
+
+ l_eFrameworkunifiedStatus = openArchive(&tar_info, file_name);
+ if (l_eFrameworkunifiedStatus == eFrameworkunifiedStatusOK) {
+ if (type == SS_STORELOGS_ACCOFFON_PRESS) {
+ std::string collectPath;
+ collectPath = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ collectPath.append("/");
+ collectPath.append(ACCOFFON_DIR_NAME);
+ if (0 != access(collectPath.c_str(), F_OK)) {
+ DEB_LOGGERSERVICELOG(ZONE_ERR,__FUNCTION__," Error. The specified file path and name does not exist: %s", collectPath.c_str());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ return l_eFrameworkunifiedStatus;
+ } else {
+ l_eFrameworkunifiedStatus = addAllFileToArchive(tar_info,collectPath);
+ }
+ } else {
+ for (UI_32 j = 0; j < list.size(); j++) {
+ l_eFrameworkunifiedStatus = addToArchive(tar_info, list.at(j).file_path, list.at(j).dest_name);
+ if(l_eFrameworkunifiedStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Error. File %s failed to archive.", list.at(j).file_path.c_str());
+ }
+ }
+ }
+
+// l_eFrameworkunifiedStatus = closeArchive(tar_info);
+ l_eFrameworkunifiedStatus = closeArchive(tar_info, type);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "finish archiving logs(%d)", type);
+
+ // when finish archiving, clear frameworkunifiedlog buffer.
+ if (type == SS_STORELOGS_ACCOFFON_PRESS) {
+ deleteTmpAccOffOn((std::string)ACCOFFON_DIR_NAME);
+ DEB_LOGGERSERVICELOG(ZONE_FUNC, __FUNCTION__, "- : FrameworkunifiedStatus = %d", l_eFrameworkunifiedStatus);
+ return (l_eFrameworkunifiedStatus);
+ } else {
+ ClearLoggerservicelogBuffer(loggerservicelogList);
+ }
+
+ // create flag of archiving completed
+ CreateSaveFinFlag(type);
+
+ // -------------------------------------------- //
+ // You can save logs by FRAMEWORKUNIFIEDLOG macro from here. //
+ // -------------------------------------------- //
+ }
+
+ // remove temporary or unnecessary files.
+ for (UI_32 k = 0; k < list.size(); k++) {
+ if (list.at(k).tmp_file_delete == TRUE) {
+ struct stat l_stat;
+ if (0 != stat(list.at(k).file_path.c_str(), &l_stat)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error. stat(%s) errno. %d",
+ list.at(k).file_path.c_str(), errno);
+ } else if (S_ISDIR(l_stat.st_mode)) {
+ RemoveDirectory(list.at(k).file_path);
+ } else {
+ if (0 != unlink(list.at(k).file_path.c_str())) { // LCOV_EXCL_BR_LINE 5: unlink's error case
+ // LCOV_EXCL_START 5: unlink's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Error. unlink(%s) errno. %d",
+ list.at(k).file_path.c_str(), errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : FrameworkunifiedStatus = %d", l_eFrameworkunifiedStatus);
+ return (l_eFrameworkunifiedStatus);
+}
+
+static void getCommunicationlogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+
+ LogInfo log_info;
+
+ log_info.file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ log_info.file_path.append("/");
+ log_info.file_path.append(COMMUNICATION_DIR_NAME);
+ log_info.dest_name = COMMUNICATION_DIR_NAME;
+ log_info.tmp_file_delete = FALSE;
+ list.push_back(log_info);
+}
+
+static void getExternallogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ExternalLogList ext_log;
+ memset(&ext_log, 0, sizeof(&ext_log));
+
+ CNSConfigReader *l_pReaderCfg = new CNSConfigReader();
+
+ if (NULL == l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5: new's error case
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Unable to allocate CNSConfigReader object.");
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(LOGGERSERVICELOG_CONFIG_PATH))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->Parse(%s) returned: 0x%X", LOGGERSERVICELOG_CONFIG_PATH);
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogNum", ext_log.num))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetInt(LOGGING.ExternalLogNum)");
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogMax", ext_log.max))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetInt(LOGGING.EmmcOutputMax)");
+ } else {
+ if (ext_log.num > 0) {
+ std::string str = "EXTERNAL_";
+ UI_32 num = 0;
+
+ if (ext_log.num <= ext_log.max) {
+ num = ext_log.num;
+ } else {
+ num = ext_log.max;
+ }
+
+ ext_log.p_info = new ExternalLogInfo[num];
+
+ // Load external log info
+ for (UI_32 i = 0; i < num; i++) {
+ std::string query = str + std::to_string(i+1);
+ if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetString((query+".OutputPath"), ext_log.p_info[i].dirname))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetString(EXTERNAL.OutputPath)");
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetString((query+".ExtLogPath"), ext_log.p_info[i].path))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetString(EXTERNAL.ExtLogPath)");
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetBool((query+".Remove"), ext_log.p_info[i].remove))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_pReaderCfg->GetBool(EXTERNAL.Remove)");
+ } else {
+ LogInfo log_info;
+ log_info.file_path = ext_log.p_info[i].path;
+ log_info.dest_name = ext_log.p_info[i].dirname;
+ log_info.tmp_file_delete = ext_log.p_info[i].remove;
+
+ list.push_back(log_info);
+ }
+ }
+
+ delete[] ext_log.p_info;
+
+ } else {
+ // None external log
+ }
+ }
+ delete l_pReaderCfg;
+ }
+}
+
+
+
+
+static void getLoggerservicelogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list, // NOLINT (runtime/references)
+ std::vector<LoggerservicelogInfo>& loggerservicelogList) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_DumpSize = 0;
+ std::string src_file_path;
+ std::string dst_file_path;
+ PCSTR file_name;
+ UI_32 file_num;
+ LogInfo log_info;
+ LoggerservicelogInfo loggerservicelog_info;
+
+ file_num = NSLogGetFrameworkunifiedlogFileTotalNum();
+ for (UI_32 cont = 0; cont < file_num; cont++) {
+ file_name = NSLogGetFrameworkunifiedlogFileName(cont);
+ if (file_name == NULL) {
+ break;
+ }
+ src_file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ src_file_path.append("/");
+ src_file_path.append(file_name);
+ dst_file_path = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ dst_file_path.append("/");
+ dst_file_path.append(file_name);
+
+ int index;
+ index = NSLogGetFrameworkunifiedlogIndex(src_file_path.c_str());
+ CNSRingBuffer* l_pLoggerservicelog = new (std::nothrow) CNSRingBuffer(
+ src_file_path, 0, index + LOCK_NSLOG_ACCES_IF_1);
+ if (l_pLoggerservicelog == NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer handle is NULL %s",
+ src_file_path.c_str());
+ continue;
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer Open failed %s %d",
+ src_file_path.c_str(), l_eStatus);
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pLoggerservicelog->DumpToFile(dst_file_path.c_str(),
+ &l_DumpSize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer DumpToFile failed %s %d",
+ src_file_path.c_str(), l_eStatus);
+ } else {
+ log_info.file_path = dst_file_path;
+ log_info.dest_name = file_name;
+ log_info.tmp_file_delete = TRUE;
+ list.push_back(log_info);
+ // save frameworkunifiedlog-info for using clear frameworkunifiedlog buffer
+ loggerservicelog_info.path = src_file_path;
+ loggerservicelog_info.index = index;
+ loggerservicelogList.push_back(loggerservicelog_info);
+ }
+ (void) l_pLoggerservicelog->Close();
+ }
+ delete l_pLoggerservicelog;
+ }
+}
+
+static void copyLoggerservicelogFile(std::string distPath)
+{
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_DumpSize = 0;
+ std::string src_file_path;
+ std::string dst_file_path;
+ PCSTR file_name;
+ UI_32 file_num;
+
+ file_num = NSLogGetFrameworkunifiedlogFileTotalNum();
+
+ for (UI_32 cont = 0; cont < file_num; cont++) {
+ file_name = NSLogGetFrameworkunifiedlogFileName(cont);
+
+ if (file_name == NULL) {
+ break;
+ }
+
+ src_file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ src_file_path.append("/");
+ src_file_path.append(file_name);
+
+ dst_file_path = distPath;
+ dst_file_path.append("/");
+ dst_file_path.append(file_name);
+
+ int index;
+ index = NSLogGetFrameworkunifiedlogIndex(src_file_path.c_str());
+ CNSRingBuffer* l_pLoggerservicelog = new (std::nothrow)CNSRingBuffer(src_file_path,0,index+LOCK_NSLOG_ACCES_IF_1);
+ if (l_pLoggerservicelog == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FRAMEWORKUNIFIEDLOG RingBuffer handle is NULL %s", src_file_path.c_str());
+ continue;
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,"Error: FRAMEWORKUNIFIEDLOG RingBuffer Open failed %s %d", src_file_path.c_str(), l_eStatus);
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->DumpToFile(dst_file_path.c_str(), &l_DumpSize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,"Error: FRAMEWORKUNIFIEDLOG RingBuffer DumpToFile failed %s %d", src_file_path.c_str(), l_eStatus);
+ }
+ (void)l_pLoggerservicelog->Close();
+ }
+ delete l_pLoggerservicelog;
+ }
+}
+
+static void deleteTmpAccOffOn(std::string accOffOnDir)
+{
+ std::string l_tmpAccOffOnPath = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ l_tmpAccOffOnPath.append("/");
+ l_tmpAccOffOnPath.append(accOffOnDir.c_str());
+ DIR * l_pDir = opendir(l_tmpAccOffOnPath.c_str());
+ if (l_pDir != NULL) {
+ struct dirent l_pDirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_pDir,&l_pDirent,&next) && next != NULL) {
+ if ( ( 0 != strcmp( l_pDirent.d_name, "." ) ) &&
+ ( 0 != strcmp( l_pDirent.d_name, ".." )) &&
+ ( 0 != strcmp( l_pDirent.d_name, "lost+found" )) &&
+ ( '.' != l_pDirent.d_name[0] ) ) {
+ std::string l_deletePath = l_tmpAccOffOnPath;
+ l_deletePath.append("/");
+ l_deletePath.append(l_pDirent.d_name);
+ deleteAccOffOnUntyped(l_deletePath);
+ }
+ }
+ closedir (l_pDir);
+ }
+ RemoveDirectory(l_tmpAccOffOnPath);
+}
+
+static void ClearLoggerservicelogBuffer(std::vector<LoggerservicelogInfo> &loggerservicelogList) { // NOLINT (runtime/references)
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::vector<LoggerservicelogInfo>::iterator ite = loggerservicelogList.begin();
+
+ if (ite == loggerservicelogList.end()) {
+ // target not found...
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "nothing to clear");
+ } else {
+ for (ite = loggerservicelogList.begin(); ite != loggerservicelogList.end(); ite++) {
+ CNSRingBuffer* l_pLoggerservicelog = new (std::nothrow) CNSRingBuffer(
+ ite->path.c_str(), 0, ite->index + LOCK_NSLOG_ACCES_IF_1);
+ if (l_pLoggerservicelog == NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer handle is NULL %s", ite->path.c_str());
+ continue;
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer Open failed %s %d", ite->path.c_str(),
+ l_eStatus);
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->ClearBuf())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer ClearBuf failed %s %d",
+ ite->path.c_str(), l_eStatus);
+ }
+ (void) l_pLoggerservicelog->Close();
+ }
+ delete l_pLoggerservicelog;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Completed");
+ fprintf(stderr, "%s:Completed\n", __FUNCTION__);
+}
+
+static void createKernelLog(SS_STORELOGS_KERNEL_LOG_TYPE type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ int len;
+ int fd;
+ char* buf;
+ ssize_t wr_len;
+
+ len = klogctl(SYSLOG_ACTION_SIZE_BUFFER, NULL, 0);
+ if (len < 0) { // LCOV_EXCL_BR_LINE 5: klogctl's error case
+ // LCOV_EXCL_START 5: klogctl's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to get syslog buffer size: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ buf = reinterpret_cast<char*>(malloc(len));
+ if (buf != NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+ len = klogctl(SYSLOG_ACTION_READ_ALL, buf, len);
+ if ((len < 0) || (len == 0)) { // LCOV_EXCL_BR_LINE 5: klogctl's error case
+ // LCOV_EXCL_START 5: klogctl's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to read syslog buffer: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ std::string file_put_path = "";
+
+ switch (type) {
+ case SS_STORELOGS_KERNEL_LOG:
+ file_put_path = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ file_put_path.append("/");
+ file_put_path.append(KERNEL_LOG_FN);
+ fd = open(file_put_path.c_str(),
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
+ break;
+ case SS_STORELOGS_KERNEL_BOOT_LOG:
+ file_put_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ file_put_path.append("/");
+ file_put_path.append(KERNEL_BOOT_LOG_FN);
+ fd = open(file_put_path.c_str(),
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
+ break;
+ default:
+ fd = -1;
+ break;
+ }
+
+ if (fd == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to open file: %s: %d, %s",
+ file_put_path.c_str(), errno, strerror(errno));
+ } else {
+ wr_len = write(fd, buf, len);
+ if (wr_len == -1) { // LCOV_EXCL_BR_LINE 5: write's error case
+ // LCOV_EXCL_START 5: write's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. File write failed. errno: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ fsync(fd);
+ close(fd);
+ }
+ }
+ free(buf);
+ } else {
+ // LCOV_EXCL_START 5: malloc's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation Failed %s",
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+static void getKernellogFile(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+ getLastKernelLog(list);
+
+ getKernelLog(list);
+
+ if (type != SS_STORELOGS_ACCOFFON) {
+ getKernelBootLog(type, list);
+ }
+}
+
+static void getLastKernelLog(std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+ LogInfo log_info;
+
+ log_info.file_path = PSTORE_DIR_PATH;
+ log_info.dest_name = "kernellog";
+ log_info.tmp_file_delete = FALSE;
+ list.push_back(log_info);
+}
+
+static void getKernelLog(std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+ createKernelLog(SS_STORELOGS_KERNEL_LOG);
+
+ LogInfo log_info;
+
+ std::string klog_path = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ klog_path.append("/");
+ klog_path.append(KERNEL_LOG_FN);
+
+ if (0 == access(klog_path.c_str(), F_OK)) {
+ log_info.file_path = klog_path;
+ log_info.dest_name = KERNEL_LOG_FN;
+ log_info.tmp_file_delete = TRUE;
+ list.push_back(log_info);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Info: %s not found.", klog_path.c_str());
+ }
+}
+
+static void getKernelBootLog(SS_STORELOGS_OPE_TYPE type,
+ std::vector<LogInfo>& list) { // NOLINT (runtime/references)
+ createKernelLog(SS_STORELOGS_KERNEL_BOOT_LOG);
+
+ LogInfo log_info;
+
+ std::string klog_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ klog_path.append("/");
+ klog_path.append(KERNEL_BOOT_LOG_FN);
+
+ if (0 == access(klog_path.c_str(), F_OK)) {
+ std::string klog_out_path = LOGGERSERVICELOG_TMP_OUTPUT_PATH;
+ klog_out_path.append("/");
+ klog_out_path.append(KERNEL_BOOT_LOG_FN);
+
+ if (eFrameworkunifiedStatusOK == copyFile(klog_path.c_str(), klog_out_path.c_str())) { // LCOV_EXCL_BR_LINE 6: copyFile must return ok // NOLINT[whitespace/line_length]
+ log_info.file_path = klog_out_path;
+ log_info.dest_name = KERNEL_BOOT_LOG_FN;
+ log_info.tmp_file_delete = TRUE;
+ list.push_back(log_info);
+ } else {
+ // LCOV_EXCL_START 6: copyFile must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Info: copyFile src:%s dest:%s failed.",
+ klog_path.c_str(), klog_out_path.c_str());
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Info: %s not found.", klog_path.c_str());
+ }
+}
+
+
+//static std::string getFileName(std::string &path, uint32_t f_time, // NOLINT (runtime/references)
+// SS_STORELOGS_OPE_TYPE type) {
+static std::string getFileName(std::string &path, uint32_t f_time,
+ SS_STORELOGS_OPE_TYPE type, UI_32 l_counter) {
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::stringstream l_nameStream;
+
+// UI_32 l_counter = 0;
+ std::string l_time_str = "00000000_000000";
+ std::string l_ret;
+ char buffer[20];
+ struct tm l_time_tmp;
+
+
+// getEmmcCounter(path, l_counter);
+ if (l_counter == INVALID_FILENUMBER) {
+ l_counter = 0;
+ getEmmcCounter(path, l_counter);
+ }
+
+
+// CLOCK_RETURN clock_ret = Clock_getLocalTimeY2K38(&f_time, &l_time_tmp);
+// if (clock_ret == CLOCK_OK) {
+// if (0 != strftime(buffer, sizeof(buffer), "%Y%m%d_%H%M%S", &l_time_tmp)) {
+// l_time_str = buffer;
+// }
+// }
+
+// l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec
+// << l_counter << '_';
+ l_nameStream << std::setw(FILENUMBER_DIGIT_NUM) << std::setfill('0') << std::right << std::dec
+ << l_counter << '_';
+
+
+ switch (type) {
+ case SS_STORELOGS_ILLEGAL:
+ l_nameStream << std::setw(15) << l_time_str << "_ILG_RESET.tar.gz";
+ break;
+ case SS_STORELOGS_INTERFACEUNIFIEDLOG:
+ l_nameStream << std::setw(15) << l_time_str << "_ACCOFF.tar.gz";
+ break;
+ case SS_STORELOGS_ACCOFFON:
+ case SS_STORELOGS_ACCOFFON_PRESS:
+ l_nameStream << std::setw(15) << l_time_str << "_ACCOFFON.tar.gz";
+ break;
+
+ case SS_STORELOGS_SYS_ILLEGAL:
+ l_nameStream << std::setw(15) << l_time_str << SS_STORE_FILENAME_SYSILG_TERM;
+ break;
+
+ default:
+ //Set the file name as usual for cases other than the anomaly log specification.
+ l_nameStream << std::setw(15) << l_time_str << ".tar.gz";
+ break;
+ }
+
+ l_ret = path;
+ l_ret.append("/");
+ l_ret.append(l_nameStream.str());
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+static void getEmmcCounter(std::string &path, UI_32& f_counter) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_checkFileName;
+ std::vector<UI_32> l_vector;
+ DIR *l_dirp;
+ struct dirent *l_direntp;
+ size_t l_pos;
+ UI_32 l_count;
+ UI_32 l_maxCount = 0;
+
+ l_dirp = opendir(path.c_str());
+ if (l_dirp != NULL) {
+ for (;;) {
+ l_direntp = readdir(l_dirp);
+ if (l_direntp == NULL) {
+ break;
+ }
+ l_checkFileName = l_direntp->d_name;
+ l_pos = l_checkFileName.find(".tar.gz");
+ if (std::string::npos != l_pos) {
+ l_pos = l_checkFileName.find("_");
+ if (std::string::npos != l_pos) {
+ std::string l_numberString = l_checkFileName.substr(0, l_pos);
+ l_count = static_cast<UI_32>(strtoul(l_numberString.c_str(), NULL, 10));
+ l_vector.push_back(l_count);
+ l_maxCount = std::max(l_count, l_maxCount);
+ }
+ }
+ }
+ closedir(l_dirp);
+ }
+ l_maxCount++;
+
+// if (l_maxCount >= 100000u) {
+// l_maxCount = 1;
+ if (l_maxCount >= FILENUMBER_UPPER_LIMIT_OVER) {
+ l_maxCount = FILENUMBER_LOWER_LIMIT;
+
+ for (;;) {
+ std::vector<UI_32>::iterator find_itr = std::find(l_vector.begin(),
+ l_vector.end(),
+ l_maxCount);
+ if (find_itr == l_vector.end()) {
+ break;
+ }
+ l_maxCount++;
+ }
+ }
+ f_counter = l_maxCount;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+static void getConfigInfo(CfgInfo& f_cfginfo) { // NOLINT (runtime/references)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ f_cfginfo.output_path = "";
+ f_cfginfo.output_max = 0;
+
+ CNSConfigReader *l_pReaderCfg = new CNSConfigReader();
+
+ if (NULL == l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5: new's error case
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Unable to allocate CNSConfigReader object.");
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(LOGGERSERVICELOG_CONFIG_PATH))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->Parse(%s) returned: 0x%X",
+ LOGGERSERVICELOG_CONFIG_PATH, l_eStatus);
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetString("LOGGING.EmmcOutputPath",
+ f_cfginfo.output_path))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->GetString(LOGGING.EmmcOutputPath)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputMax",
+ f_cfginfo.output_max))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->GetInt(LOGGING.EmmcOutputMax)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputErrMax",
+ f_cfginfo.output_errmax))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->GetInt(LOGGING.EmmcOutputErrMax)");
+ }
+ delete l_pReaderCfg;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+static EFrameworkunifiedStatus deleteOldLog(std::string log_path,
+ std::vector<std::string>& l_vector, // NOLINT (runtime/references)
+ std::string& f_archive_destination, // NOLINT (runtime/references)
+ UI_32 max_num) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ size_t l_pos = f_archive_destination.find_last_of('/');
+
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 6: '/' must exist in f_archive_destination
+ std::sort(l_vector.begin(), l_vector.end());
+ std::vector<std::string>::iterator itr = l_vector.begin();
+ for (UI_32 i = static_cast<UI_32>(l_vector.size()); (max_num - 1) < i; i--, itr++) {
+ if (itr == l_vector.end()) { // LCOV_EXCL_BR_LINE 6: itr can't be l_vector.end()
+ // LCOV_EXCL_START 6: itr can't be l_vector.end()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break;
+ // LCOV_EXCL_STOP
+ }
+ std::string l_FilePath = log_path;
+ std::string l_FileName = *itr;
+ l_FilePath.append("/");
+ l_FilePath.append(l_FileName.c_str());
+ if (0 != unlink(l_FilePath.c_str())) {
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete old log file %s:%d.",
+ l_FilePath.c_str(), errno);
+ }
+ }
+ SyncDir(log_path);
+ } else {
+ // LCOV_EXCL_START 6: '/' must exist in f_archive_destination
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete target not found. %s",
+ f_archive_destination.c_str());
+ // LCOV_EXCL_STOP
+ }
+ return l_eStatus;
+}
+
+
+static EFrameworkunifiedStatus getFileNumber(const std::string &filename,UI_32 &number) {
+ char buf[16];
+ size_t pos;
+ size_t offset;
+ size_t length;
+ UI_32 temp_value;
+
+ offset = filename.find_last_of(PATHNAME_SEPARATOR) + 1;
+ pos = filename.find_first_of('_', offset);
+ length = pos-offset;
+ if (std::string::npos == pos) {
+ return eFrameworkunifiedStatusInvldParam;
+ } else if (sizeof(buf) <= length) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ char *endptr;
+ int error_number;
+
+ memcpy(buf, filename.c_str() + offset, length);
+ buf[length] = '\x0';
+
+ errno = EOK;
+ temp_value = strtol(buf, &endptr, 10);
+ error_number = errno;
+ if ((error_number != EOK) || (*endptr != '\x0')) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ number = temp_value;
+ return eFrameworkunifiedStatusOK;
+}
+
+static bool compareFileNumber(UI_32 filename1_number, const std::string &filename2) {
+ EFrameworkunifiedStatus l_eStatus;
+ bool result;
+ UI_32 filename2_number;
+
+ l_eStatus = getFileNumber(filename2, filename2_number);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ return false;
+ }
+ result = (filename1_number == filename2_number);
+ return result;
+}
+
+static EFrameworkunifiedStatus removeFiles(const std::string &log_path, std::vector<std::string> &l_vector,
+ size_t begin_pos, size_t end_pos) {
+ std::string l_FilePath;
+ size_t i;
+ int result;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_ePartStatus = eFrameworkunifiedStatusOK;
+ l_FilePath.reserve(SSLOGGER_PATHNAME);
+ for (i = begin_pos; i < end_pos; i++) {
+ l_FilePath = log_path + PATHNAME_SEPARATOR_STR + l_vector[i];
+ result = unlink(l_FilePath.c_str());
+ if (0 != result) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. unlink() filename = %s ,errno = %d.", l_FilePath.c_str(), errno);
+ l_ePartStatus = eFrameworkunifiedStatusAccessError;
+ if (l_ePartStatus != eFrameworkunifiedStatusOK) {
+ l_eStatus = l_ePartStatus;
+ }
+ }
+ }
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus removeSameNumFiles(std::vector<std::string>::iterator &itr, const std::string &log_path,
+ std::vector<std::string> &l_vector) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (l_vector.begin() == itr) { // LCOV_EXCL_BR_LINE 4: itr is l_vector.begin() only when no space error case
+ // LCOV_EXCL_START 4: itr is l_vector.begin() only when no space error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+ std::string &removed_filename = *(itr - 1);
+ UI_32 removed_filenumber;
+ if (getFileNumber(removed_filename, removed_filenumber) != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 6: double check, must return ok // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 6: double check, must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warning. Type mismatch filename. = %s", removed_filename.c_str());
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+
+ std::string l_FilePath;
+ EFrameworkunifiedStatus l_ePartStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int result;
+ for (;itr < l_vector.end(); itr++) {
+ const std::string &exist_filename = (*itr);
+ if (compareFileNumber(removed_filenumber, exist_filename) == true) {
+ l_FilePath = log_path + PATHNAME_SEPARATOR_STR + exist_filename;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Remove file = %s.", l_FilePath.c_str());
+ result = unlink(l_FilePath.c_str());
+ if (0 != result) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. unlink() filename = %s , errno = %d.", l_FilePath.c_str(), errno);
+ l_ePartStatus = eFrameworkunifiedStatusAccessError;
+ if (l_ePartStatus != eFrameworkunifiedStatusOK) {
+ l_eStatus = l_ePartStatus;
+ }
+ }
+ } else {
+ break;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus deleteOldLogAbnrm(const std::string& log_path, std::vector<std::string>& l_vector,
+ const std::string& f_archive_destination, SI_32 max_num, UI_32 abnrm_total) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ size_t l_pos = f_archive_destination.find_last_of(PATHNAME_SEPARATOR);
+ if (std::string::npos == l_pos) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete target not found. %s", f_archive_destination.c_str());
+ return eFrameworkunifiedStatusFail;
+ }
+ if (l_vector.size() == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. empty array.");
+ return eFrameworkunifiedStatusFail;
+ }
+ //FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " max_num = %d , vect_abnrm.size() = %d", max_num, vect_abnrm.size());
+
+ size_t i;
+ EFrameworkunifiedStatus l_ePartStatus = eFrameworkunifiedStatusOK;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t end_pos = l_vector.size();
+ SI_32 abnrm_count = 0;
+ UI_32 exist_filenumber;
+ ELOGGERSERVICELOGTYPE filetype;
+
+ max_num = abnrm_total - max_num + 1;
+ std::sort(l_vector.begin(), l_vector.end());
+ for (i = 0; i < end_pos; i++) {
+ const std::string &exist_filename = l_vector[i];
+ if (getFileNumber(exist_filename, exist_filenumber) != eFrameworkunifiedStatusOK) {
+ continue;
+ }
+ filetype = QueryLoggerservicelogType(exist_filename);
+ if (filetype == eLoggerservicelogTypeAbnormal) {
+ abnrm_count++;
+ if (max_num <= abnrm_count) {
+ end_pos = i + 1;
+ break;
+ }
+ }
+ }
+ l_ePartStatus = removeFiles(log_path, l_vector, 0, end_pos);
+ if (l_ePartStatus != eFrameworkunifiedStatusOK) {
+ l_eStatus = l_ePartStatus;
+ }
+ if (end_pos < l_vector.size()) {
+ std::vector<std::string>::iterator itr = l_vector.begin() + end_pos;
+ l_ePartStatus = removeSameNumFiles(itr, log_path, l_vector);
+ if (l_ePartStatus != eFrameworkunifiedStatusOK) {
+ l_eStatus = l_ePartStatus;
+ }
+ }
+ SyncDir(log_path);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+
+static EFrameworkunifiedStatus deleteOldEmmcLog(CfgInfo& f_cfginfo, // NOLINT (runtime/references)
+ std::string& f_archive_destination, // NOLINT (runtime/references)
+ SS_STORELOGS_OPE_TYPE type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR *l_dirp = NULL;
+ struct dirent *l_direntp = NULL;
+ std::vector<std::string> vect_abnrm;
+ std::vector<std::string> vect_nrm;
+ std::vector<std::string> vect_rlnc;
+ std::string l_emmc_path = f_cfginfo.output_path;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ UI_32 abnrm_count = 0;
+
+ if (SS_STORELOGS_SYS_ILLEGAL == type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+ }
+
+
+ l_dirp = opendir(l_emmc_path.c_str());
+ if (l_dirp != NULL) {
+ while ((l_direntp = readdir(l_dirp)) != NULL) {
+ std::string l_findFileName = l_direntp->d_name;
+
+// if ((std::string::npos != l_findFileName.find("_ILG_RESET.tar.gz"))
+// || (std::string::npos != l_findFileName.find("_ERR.tar.gz"))) {
+ if ((l_findFileName == ".") || (l_findFileName == "..")) {
+ continue;
+ } else if (std::string::npos != l_findFileName.find(SS_STORE_FILENAME_SYSILG_TERM)) {
+ vect_abnrm.push_back(l_findFileName);
+ } else if (std::string::npos != l_findFileName.find(SS_STORE_FILENAME__CWORD52__TERM)) {
+ vect_abnrm.push_back(l_findFileName);
+ } else if((std::string::npos != l_findFileName.find("_ILG_RESET.tar.gz")) ||
+ (std::string::npos != l_findFileName.find("_ERR.tar.gz"))) {
+
+ vect_abnrm.push_back(l_findFileName);
+
+ abnrm_count++;
+
+ } else if (std::string::npos
+ != l_findFileName.find("_GRP_RELAUNCH.tar.gz")) {
+ vect_rlnc.push_back(l_findFileName);
+ } else if (std::string::npos != l_findFileName.find(".tar.gz")) {
+ vect_nrm.push_back(l_findFileName);
+ }
+ }
+ closedir(l_dirp);
+ }
+
+ if (SS_STORELOGS_ILLEGAL == type) {
+ if ((UI_32) f_cfginfo.output_errmax <= vect_abnrm.size()) {
+ l_eStatus = deleteOldLog(l_emmc_path, vect_abnrm, f_archive_destination,
+ (UI_32) f_cfginfo.output_errmax);
+ }
+ } else {
+ if ((UI_32) f_cfginfo.output_max <= vect_nrm.size()) {
+ l_eStatus = deleteOldLog(l_emmc_path, vect_nrm, f_archive_destination,
+ (UI_32) f_cfginfo.output_max);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/video_in_hal/systemservice/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h b/video_in_hal/systemservice/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h
new file mode 100755
index 0000000..31d1caa
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/lib/ss_logger_store_logs_loggerservicelog.h
@@ -0,0 +1,96 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemServices_Logger
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_LIB_SS_LOGGER_STORE_LOGS_LOGGERSERVICELOG_H_
+#define LOGGER_SERVICE_SERVER_LIB_SS_LOGGER_STORE_LOGS_LOGGERSERVICELOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_FUNC
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern const CHAR AppName[];
+
+typedef enum _ELoggerserviceLogType {
+ eLoggerservicelogTypeNormal,
+ eLoggerservicelogTypeAbnormal,
+
+ eLoggerservicelogTypeSysAbnormal,
+ eLoggerservicelogType_CWORD52_,
+
+ eLoggerservicelogTypeGrpRelaunch,
+ eLoggerservicelogTypeOther,
+} ELOGGERSERVICELOGTYPE;
+
+#endif // LOGGER_SERVICE_SERVER_LIB_SS_LOGGER_STORE_LOGS_LOGGERSERVICELOG_H_
diff --git a/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/Makefile b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/Makefile
new file mode 100755
index 0000000..420c13e
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/Makefile
@@ -0,0 +1,22 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+SUBDIRS += work
+
+
+
+include ../../../system_service.mk
diff --git a/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/realtimeUsbLog.conf_bin b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/realtimeUsbLog.conf_bin
new file mode 100755
index 0000000..440d361
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/realtimeUsbLog.conf_bin
@@ -0,0 +1,4 @@
+/usr/agl/bin|${OSW_reldbg}
+debug|dbg
+release|rel
+product|rel
diff --git a/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/Makefile b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/Makefile
new file mode 100755
index 0000000..c3733b3
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/Makefile
@@ -0,0 +1,74 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = realtimeUsbLog
+
+######### installed library(*.a) #############
+
+
+######### installed shared library(*.so) #############
+
+
+######### install headers(*.h) #############
+
+
+######### compiled sources #############
+realtimeUsbLog_SRCS += ss_logger_realtime_usb.cpp
+realtimeUsbLog_SRCS += loggerservice_main.cpp
+######### add source path #############
+VPATH += ../src
+
+######### add include path #############
+CPPFLAGS += -I./
+
+#CPPFLAGS += -I../inc
+#CPPFLAGS += -I../../inc
+CPPFLAGS += -I../../include
+CPPFLAGS += -I../../../../system_manager/server/include
+CPPFLAGS += -I../../../../system_manager/server/include/processlauncher
+
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30
+######### linked library #############
+
+
+######### linked library (dynamic) #############
+#LDLIBS += -Wl,-Bdynamic -lxxx
+LDLIBS += -Wl,-Bdynamic -lcommon
+#LDLIBS += -Wl,-Bdynamic -lextension
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+
+LDLIBS += -Wl,-Bdynamic -lsssmcfg
+LDLIBS += -Wl,-Bdynamic -lresm
+LDLIBS += -Wl,-Bdynamic -lssver
+LDLIBS += -Wl,-Bdynamic -lSS_RomAccessIf
+#LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI
+LDLIBS += -Wl,-Bdynamic -ltar -lz
+LDLIBS += -Wl,-Bdynamic -lrt
+
+
+######### add library path #############
+
+LDFLAGS += -g -Wl,--gc-sections
+
+LINK_CXX=Y
+include ../../../../system_service.mk
diff --git a/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp
new file mode 100755
index 0000000..d5dfd00
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/loggerservice_main.cpp
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief Application entry point.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <errno.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <system_service/ss_system_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_version.h>
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_system_types.h>
+#include <system_service/ss_logger_store_logs.h>
+#include <fstream>
+#include <cstdlib>
+
+BOOL g_isExec = FALSE;
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnInitialization
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ eStatus = StartRtUsbLogThread(hApp);
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnDestroy
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) {
+ return eFrameworkunifiedStatusOK;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnDummy
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDummy(HANDLE hApp) {
+ return eFrameworkunifiedStatusOK;
+}
+
+//////////////////////////////////////////
+// Function : main
+//////////////////////////////////////////
+int main(int argc, char *argv[]) {
+ HANDLE hApp;
+ int nsFd;
+ char clientName[16] = "realtimeUsbLog";
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+
+ cbFuncs.onInitilization = FrameworkunifiedOnInitialization;
+ cbFuncs.onDestroy = FrameworkunifiedOnDestroy;
+
+ cbFuncs.onStart = FrameworkunifiedOnDummy;
+ cbFuncs.onStop = FrameworkunifiedOnDummy;
+ cbFuncs.onDebugDump = FrameworkunifiedOnDummy;
+ cbFuncs.createStateMachine = FrameworkunifiedOnDummy;
+ cbFuncs.ssFrameworkInterface = FrameworkunifiedOnDummy;
+
+ FrameworkunifiedCreateDispatcherWithoutLoop(clientName, hApp, argc, argv, &cbFuncs, FALSE);
+
+ FrameworkunifiedGetDispatcherFD(hApp, &nsFd);
+
+ g_isExec = TRUE;
+ while (g_isExec) {
+ fd_set fds;
+ int maxFd = 0;
+
+ FD_ZERO(&fds);
+
+ FD_SET(nsFd, &fds);
+ maxFd = nsFd;
+
+ select(maxFd + 1, &fds, NULL, NULL, NULL);
+
+ if (FD_ISSET(nsFd, &fds)) {
+ FrameworkunifiedDispatchProcessWithoutLoop(hApp);
+ }
+ }
+
+ FrameworkunifiedDestroyDispatcherWithoutLoop(hApp);
+ return 0;
+}
diff --git a/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp
new file mode 100755
index 0000000..c318f1a
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/src/ss_logger_realtime_usb.cpp
@@ -0,0 +1,722 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief This file contains the standard set functions called by the NS
+// dispatcher on application initialization, cleanup and wakeup.
+///
+///////////////////////////////////////////////////////////////////////////////
+// System Headers
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <mqueue.h>
+#include <errno.h>
+#include <string.h>
+#include <dirent.h>
+#include <time.h>
+#include <loggerservicedebug_loggerservicelog.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <native_service/frameworkunified_timer.h>
+#include <system_service/ss_devicedetection_service_notifications.h>
+#include <system_service/ss_devicedetection_service.h>
+#include <system_service/ss_devicedetection_service_protocol.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_types.h>
+#include <queue>
+#include <string>
+
+// System definition
+#ifndef TN_LOGGERRTIME
+#define TN_LOGGERRTIME "LoggerRtime"
+#define PR_LOGGERRTIME_S PR_TSS_S
+#define PR_LOGGERRTIME PR_TSS
+#endif // TN_LOGGERRTIME
+// Queue resource
+#define USB_REALTIME_MSGMAX 256
+#define USB_REALTIME_SIZMAX 4096
+#define USB_REALTIME_QNAME "/PlRtLogger"
+// Folder path
+#define USB_RT_FOLDERPATH_ "/REALTIME_"
+
+// older path
+#define USB_RT_TMP_PATH "/tmp"
+// File name
+#define USB_RT_LOGNAME_TMP "usbrt_tmp.log"
+#define ENC_BUF_MAX_SIZE (1024*8)
+
+#ifdef RELEASE_BUILD
+// encrypt values
+#define DEV_ENC_EXTENSION ".enc1"
+#define REL_ENC_EXTENSION ".enc2"
+#define ALIGNMENT_SIZE 4
+#endif // RELEASE_BUILD
+
+// File path
+#define USB_RT_LOGNAME_ "loggerservice_usb__realtime"
+// Max size of each log file
+#define USB_RT_FILE_SIZE (1024*1024)
+// Num of logs to write in std::queue at one time
+#define QUELOG_WRITE_BLOCK_NUM 300
+// Max of logs to save in std::queue
+#define QUELOG_SAVE_MAX 12000
+#define QUELOG_DELNUM (QUELOG_WRITE_BLOCK_NUM*2) // num of deletion at one time
+// TIMER ID
+#define USB_RT_TIMER_EV 0x89
+#define USB_RT_TIMER_SYNC 1 // kind
+#define USB_RT_TIMER_CYCLE 10000 // cycle of timeout(msec)
+
+static HANDLE g_rt_tid = NULL;
+static int g_wfd = -1;
+static mqd_t g_qid = (mqd_t) - 1;
+static int g_num_of_file = 1;
+static char g_mnt_path[MAXPATHLEN];
+static char g_fld_path[MAXPATHLEN];
+static char g_log_path[MAXPATHLEN];
+static char *g_log_name;
+static bool g_need_sync = false;
+static size_t g_filesize = 0;
+
+//static queue<string> g_saveq;
+static std::queue<std::string> g_saveq;
+
+static DeviceDetectionServiceIf g_devDetect;
+static bool g_usb_available = false;
+
+static char g_log_tmp_path[MAXPATHLEN];
+
+EFrameworkunifiedStatus rtUsbLogThread(HANDLE hApp);
+EFrameworkunifiedStatus rtUsbLogTShutdown(HANDLE hApp);
+EFrameworkunifiedStatus OnPowerOnOffNotification(HANDLE hApp);
+
+EFrameworkunifiedStatus StartTimer(HANDLE hApp, const UI_32 timeout);
+EFrameworkunifiedStatus CancelTimer(void);
+
+// DeviceDetection Related funcs
+EFrameworkunifiedStatus OnDeviceDetectionAvailability(HANDLE hApp);
+EFrameworkunifiedStatus OnDeviceDetectionOpenSessionACK(HANDLE hApp);
+EFrameworkunifiedStatus onDeviceDetectionCloseSessionACK(HANDLE hApp);
+EFrameworkunifiedStatus onUsbDetectCallback(HANDLE hApp);
+
+EFrameworkunifiedStatus EncryptAndCopyFile(void);
+
+EFrameworkunifiedStatus StartRtUsbLogThread(HANDLE hApp) {
+ FrameworkunifiedChildThreadAttr attr;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (g_rt_tid != NULL) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ // Create Realtime USB Logging Thread and start
+ memset(&attr, 0, sizeof(FrameworkunifiedChildThreadAttr));
+ // One time while to break on Error
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedCreateChildThreadAttrSetSched(&attr,
+ eFrameworkunifiedSchedPolicyTSS,
+ PR_LOGGERRTIME))) {
+ return l_eStatus;
+ }
+ g_rt_tid = FrameworkunifiedCreateChildThreadWithAttribute(hApp, TN_LOGGERRTIME,
+ rtUsbLogThread,
+ rtUsbLogTShutdown, &attr);
+ if (g_rt_tid == NULL) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_eStatus = FrameworkunifiedStartChildThread(hApp, g_rt_tid, 0, (PVOID) NULL);
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus StopRtUsbLogThread(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // Close fd to sync
+ if (g_wfd != -1) {
+ if (0 != close(g_wfd)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ EncryptAndCopyFile();
+ }
+ // Close message queue
+ if (g_qid != (mqd_t) - 1) {
+ if (0 != mq_close(g_qid)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ // Terminate Thread
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedStopChildThread(hApp, g_rt_tid, 0, NULL)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedDestroyChildThread(hApp, g_rt_tid)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus OnPowerOnOffNotification(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ T_SS_SM_UserModeOnOffNotification_StructType onoff_mode;
+
+ l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID) &onoff_mode,
+ sizeof(onoff_mode));
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ fprintf(stderr, "%s: Failed to fetch OnOff Mode\n", __FUNCTION__);
+ return l_eStatus;
+ }
+ if (!onoff_mode.isUserModeOn) { // ACC-OFF
+ // Close fd to sync
+ if (g_wfd >= 0) {
+ syncfs(g_wfd);
+ if (0 != close(g_wfd)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ EncryptAndCopyFile();
+ g_wfd = -2; // ACC-OFF detected
+ }
+ }
+ return l_eStatus;
+}
+
+static int getStartFileNum(void) {
+ int start = 0;
+ int num;
+ DIR *dirp;
+ struct dirent entry;
+ struct dirent *next;
+
+ if ((dirp = opendir(g_fld_path)) == NULL) {
+ fprintf(stderr, "%s: Failed in opendir, errno=%d\n", __FUNCTION__, errno);
+ return -1;
+ }
+ for (;;) {
+ if (readdir_r(dirp, &entry, &next) != 0) {
+ fprintf(stderr, "%s: Failed in readdir_r, errno=%d\n", __FUNCTION__,
+ errno);
+ closedir(dirp);
+ return -1;
+ }
+ if (next == NULL) { // NO more
+ break;
+ }
+ if (strncmp(entry.d_name, g_log_name, strlen(g_log_name)) != 0) {
+ continue;
+ }
+ num = atoi(entry.d_name + strlen(g_log_name));
+ if (num > start) {
+ start = num;
+ }
+ }
+ closedir(dirp);
+ start++;
+
+ return start;
+}
+
+EFrameworkunifiedStatus WriteAndSwitchLogFile(const char* data, ssize_t size) {
+ ssize_t wrotelen;
+ char logpath[MAXPATHLEN];
+
+ wrotelen = write(g_wfd, data, size);
+ if (wrotelen != size) {
+ close(g_wfd);
+ g_wfd = -1;
+ g_filesize = 0;
+ EncryptAndCopyFile();
+ fprintf(stderr, "%s: Failed to write, size=%d, wrotelen=%d, errno=%d\n",
+
+// __FUNCTION__, static_cast<int32_t>size, static_cast<int32_t>wrotelen, errno);
+ __FUNCTION__, static_cast<int32_t>(size), static_cast<int32_t>(wrotelen), errno);
+
+ return eFrameworkunifiedStatusFail;
+ } else {
+ g_filesize += wrotelen;
+ g_need_sync = true;
+ if (static_cast<int>(g_filesize) >= USB_RT_FILE_SIZE) {
+ g_filesize = 0;
+ close(g_wfd);
+ EncryptAndCopyFile();
+ g_num_of_file++;
+
+
+// snprintf(logpath, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+ snprintf(logpath, MAXPATHLEN, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+
+ if ((g_wfd = open(logpath, O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0644))
+ == -1) {
+ fprintf(stderr, "%s: Failed to open file %s, errno=%d\n", __FUNCTION__,
+ logpath, errno);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus OnMessageQueueReceived(HANDLE hApp) {
+ ssize_t len, len2;
+ char msg[USB_REALTIME_SIZMAX], msg2[USB_REALTIME_SIZMAX];
+ char logpath[MAXPATHLEN];
+ unsigned int prior;
+ struct stat stbuf;
+
+// string work_str;
+ std::string work_str;
+
+ bool pushed = false;
+ const struct timespec tspec = { 0, 0 };
+
+ // write loop
+ while (1) {
+ pushed = false;
+ if (g_qid == (mqd_t) - 1) { // Already ACC-OFFed
+ return eFrameworkunifiedStatusOK;
+ }
+ len = mq_timedreceive(g_qid, msg, sizeof(msg), &prior, &tspec);
+ if (len == (ssize_t) - 1) { // NO more data
+ if (errno != ETIMEDOUT) {
+ fprintf(stderr, "%s: Unexpected error %d\n", __FUNCTION__, errno);
+ }
+ break;
+ }
+ // Remove overflowed log
+ if (g_saveq.size() > QUELOG_SAVE_MAX) {
+ int delnum = g_saveq.size() - QUELOG_SAVE_MAX + QUELOG_DELNUM;
+ for (int i = 0; i < delnum; i++) {
+ g_saveq.pop();
+ }
+ }
+ // check if file is opened
+ if (g_wfd == -1) {
+ /*
+ * Make folder and open log file
+ */
+ // save dequeued log
+
+// g_saveq.push(string((const char*) msg, len));
+ g_saveq.push(std::string((const char*) msg, len));
+
+ pushed = true; // request pushed or NON-log message -> NO NEED to write this data to log file
+ // Check USB mounted
+ if (!g_usb_available) {
+ // No mount event is received
+ continue;
+ }
+ // Check USB mounted
+ if (stat(g_mnt_path, &stbuf) != 0) {
+ // No mount path found
+ continue;
+ }
+ // Check and make subfolder
+ int mkdres = mkdir(g_fld_path, 0666);
+ if (mkdres == 0) {
+ g_num_of_file = 1;
+ } else if (mkdres == -1 && errno == EEXIST) {
+ // Decide file number to start(Check current log files)
+ g_num_of_file = getStartFileNum();
+ if (g_num_of_file <= 0) {
+ fprintf(stderr, "%s: Failed in getStartFileNum\n", __FUNCTION__);
+ continue;
+ }
+ } else {
+ fprintf(stderr, "%s: Failed to mkdir %s, errno=%d\n", __FUNCTION__,
+ g_fld_path, errno);
+ continue;
+ }
+
+ // Open File
+ g_filesize = 0;
+
+
+// snprintf(logpath, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+ snprintf(logpath, MAXPATHLEN, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+
+ if ((g_wfd = open(logpath, O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0644))
+ == -1) {
+ fprintf(stderr, "%s: Failed to open file %s, errno=%d\n", __FUNCTION__,
+ logpath, errno);
+ continue;
+ }
+ } else if (g_wfd == -2) {
+ // Already ACC-OFF, Just throw the logs away
+ continue;
+ }
+ // Write out saved log if any
+ int written_once = QUELOG_WRITE_BLOCK_NUM; // num of written at once
+ while (1) {
+ if (g_saveq.empty()) {
+ break;
+ }
+ if (written_once >= QUELOG_WRITE_BLOCK_NUM) {
+ written_once = 0;
+ while (1) {
+ // read request queue
+ len2 = mq_timedreceive(g_qid, msg2, sizeof(msg2), &prior, &tspec);
+ if (len2 == (ssize_t) - 1) { // NO MORE data
+ if (errno != ETIMEDOUT) {
+ fprintf(stderr, "%s: Unexpected error %d\n", __FUNCTION__, errno);
+ }
+ break;
+ }
+
+// g_saveq.push(string((const char*) msg2, len2));
+ g_saveq.push(std::string((const char*) msg2, len2));
+
+ }
+ }
+ work_str = g_saveq.front();
+ if (eFrameworkunifiedStatusOK
+ != WriteAndSwitchLogFile(work_str.data(), work_str.length())) {
+ fprintf(stderr, "%s: Failed in write Saved data, errno=%d\n",
+ __FUNCTION__, errno);
+ break;
+ } else {
+ written_once++;
+ g_saveq.pop();
+ }
+ }
+ if (pushed || g_wfd == -1) {
+ continue;
+ }
+ // write data
+ if (eFrameworkunifiedStatusOK != WriteAndSwitchLogFile(msg, len)) {
+ fprintf(stderr, "%s: Failed in write Saved data-2, errno=%d\n",
+ __FUNCTION__, errno);
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus OnSyncTimeout(HANDLE hApp) {
+ if (g_need_sync) {
+ if (g_wfd != -1 && g_wfd != -2) {
+ char logpath[MAXPATHLEN];
+ fsync(g_wfd);
+ close(g_wfd);
+ g_wfd = -1;
+ EncryptAndCopyFile();
+
+// snprintf(logpath, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+ snprintf(logpath, MAXPATHLEN, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+
+ if ((g_wfd = open(logpath, O_RDWR | O_CREAT | O_APPEND | O_CLOEXEC, 0644))
+ == -1) {
+ fprintf(stderr, "%s: Failed to open file %s, errno=%d (%s)\n",
+ __FUNCTION__, logpath, errno, strerror(errno));
+ // because in order to continue to obtain logs.
+ return eFrameworkunifiedStatusOK;
+ }
+ g_need_sync = false;
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus rtUsbLogThread(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ struct mq_attr qattr;
+ const struct timespec idle_time = { 1, 0 }; // 1sec
+ HANDLE timer_handle = NULL;
+
+ // Subscribe Boot Mode Notifcation to SysMgr
+ l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp,
+ NTFY_SSSystemMgrPowerOnOff,
+ OnPowerOnOffNotification);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ fprintf(stderr, "%s: Subscribe PowerOnOff failed, status=%d\n",
+ __FUNCTION__, l_eStatus);
+ }
+ // Subscribe Device Detection Availability
+ while (1) {
+ if (g_devDetect.Initialize(hApp)) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = g_devDetect.NotifyOnDeviceDetectionAvailability(
+ OnDeviceDetectionAvailability))) {
+ fprintf(stderr,
+ "%s: DevDetec AvailabilityCallback registration failed\n",
+ __FUNCTION__);
+ }
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = g_devDetect.NotifyOnOpenSessionAck(
+ OnDeviceDetectionOpenSessionACK))) {
+ fprintf(stderr, "%s: DevDetec OpenSession ACK registration failed\n",
+ __FUNCTION__);
+ }
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = g_devDetect.NotifyOnCloseSessionAck(
+ onDeviceDetectionCloseSessionACK))) {
+ fprintf(stderr, "%s: DevDetec CloseSession ACK registration failed\n",
+ __FUNCTION__);
+ }
+ break;
+ } else {
+ fprintf(stderr, "%s: Device Detection Object Initialization failed\n",
+ __FUNCTION__);
+ nanosleep(&idle_time, NULL);
+ }
+ }
+
+ // open message queue
+ while (1) {
+ qattr.mq_flags = 0;
+ qattr.mq_maxmsg = USB_REALTIME_MSGMAX;
+ qattr.mq_msgsize = USB_REALTIME_SIZMAX;
+ qattr.mq_curmsgs = 0;
+ if ((g_qid = mq_open(USB_REALTIME_QNAME, O_RDWR | O_CREAT, 0666, &qattr))
+ >= (mqd_t) 0) {
+ break;
+ }
+ fprintf(stderr, "%s: Failed in mq_open, errno=%d\n", __FUNCTION__, errno);
+ nanosleep(&idle_time, NULL);
+ }
+
+ // Attach callback func to message queue fd
+ l_eStatus = FrameworkunifiedAttachCallbackToDispatcherWithFd(hApp, static_cast<int>(g_qid),
+ OnMessageQueueReceived);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ fprintf(
+ stderr,
+ "%s: Error in FrameworkunifiedAttachCallbackToDispatcherWithFd with mq_fd, status=%d\n",
+ __FUNCTION__, l_eStatus);
+ return l_eStatus;
+ }
+ // Start Cyclic Timer
+ timer_handle = FrameworkunifiedAttachTimerCallback(hApp, USB_RT_TIMER_CYCLE,
+ USB_RT_TIMER_CYCLE,
+ OnSyncTimeout);
+ if (timer_handle == NULL) {
+ fprintf(stderr, "%s: Error in FrameworkunifiedAttachTimerCallback\n", __FUNCTION__);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // Enter dispatcher ==> Just return
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus rtUsbLogTShutdown(HANDLE hApp) {
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus OnDeviceDetectionAvailability(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (FrameworkunifiedIsServiceAvailable(hApp)) {
+ if (eFrameworkunifiedStatusOK != (eStatus = g_devDetect.OpenSessionRequest())) {
+ fprintf(stderr, "%s: Open session request failed\n", __FUNCTION__);
+ }
+ } else {
+ if (eFrameworkunifiedStatusOK != (eStatus = g_devDetect.CloseSessionRequest())) {
+ fprintf(stderr, "%s: Close session request failed\n", __FUNCTION__);
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus OnDeviceDetectionOpenSessionACK(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = g_devDetect.DecodeOpenSessionResponse())) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = g_devDetect.RegisterForDeviceDetectionEvent(
+ SS_DEV_DETECT_ANY_USB_EV, onUsbDetectCallback))) {
+ fprintf(stderr, "%s: Registration for SS_DEV_DETECT_ANY_USB_EV failed\n",
+ __FUNCTION__);
+ }
+ } else {
+ fprintf(stderr, "%s: Decode open session response failed\n", __FUNCTION__);
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus onDeviceDetectionCloseSessionACK(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CloseSessionAck tCloseSessionAck;
+
+ if (hApp) {
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tCloseSessionAck,
+ sizeof(tCloseSessionAck)))) {
+ if (eFrameworkunifiedStatusOK != tCloseSessionAck.eStatus) {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ }
+ return eStatus;
+}
+
+EFrameworkunifiedStatus onUsbDetectCallback(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SS_MediaDetectInfo l_tMediaDetectInfo;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_tMediaDetectInfo,
+ sizeof(l_tMediaDetectInfo)))) {
+ fprintf(stderr, "%s: FrameworkunifiedGetMsgDataOfSize Failed Status:0x%x\n",
+ __FUNCTION__, l_eStatus);
+ } else {
+ if (l_tMediaDetectInfo.dev_type != eUSB) { // NOT mass storage device
+ return l_eStatus;
+ }
+ if (l_tMediaDetectInfo.bIsDeviceAvailable) {
+ if (g_usb_available) { // Already mounted
+ return l_eStatus;
+ }
+ // set USB device available
+ g_usb_available = true;
+ // Organize paths to access
+ strncpy(g_mnt_path, l_tMediaDetectInfo.deviceMountpath,
+ sizeof(g_mnt_path));
+
+ snprintf(g_fld_path, MAXPATHLEN, "%s%s", g_mnt_path, USB_RT_FOLDERPATH_);
+ snprintf(g_log_path, MAXPATHLEN, "%s/%s", g_fld_path, USB_RT_LOGNAME_);
+ g_log_name = const_cast<char*>(USB_RT_LOGNAME_);
+
+
+
+// snprintf(g_log_tmp_path, "%s", USB_RT_TMP_PATH);
+ snprintf(g_log_tmp_path, MAXPATHLEN, "%s", USB_RT_TMP_PATH);
+
+
+ } else {
+ // unset USB device available
+ if (strcmp(l_tMediaDetectInfo.deviceMountpath, g_mnt_path) == 0) {
+ g_usb_available = false;
+ g_mnt_path[0] = 0;
+ if (g_wfd != -1 && g_wfd != -2) {
+ close(g_wfd);
+ g_wfd = -1;
+ EncryptAndCopyFile();
+ }
+ }
+ }
+ }
+
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus EncryptAndCopyFile(void) {
+ char usblogpath[MAXPATHLEN];
+ char logpath[MAXPATHLEN];
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int rfd, wfd;
+ int ret;
+ struct stat istat_buf;
+
+
+// snprintf(usblogpath, "%s%05d.log", g_log_path, g_num_of_file);
+
+// snprintf(logpath, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+ snprintf(usblogpath, MAXPATHLEN, "%s%05d.log", g_log_path, g_num_of_file);
+
+ snprintf(logpath, MAXPATHLEN, "%s/%s", g_log_tmp_path, USB_RT_LOGNAME_TMP);
+
+
+ rfd = open(logpath, O_RDWR | O_CLOEXEC);
+ if (rfd == -1) {
+ fprintf(stderr, "%s: Error. Failed to open file: %s for reading.\n",
+ __FUNCTION__, logpath);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ ret = fstat(rfd, &istat_buf);
+ if (ret < 0) {
+ fprintf(stderr, "%s: Error. stat(%s). errno: %d, %s \n", __FUNCTION__,
+ logpath, errno, strerror(errno));
+ close(rfd);
+ return eFrameworkunifiedStatusFail;
+ } else {
+ BYTE *pData;
+ int total_len;
+ int read_len;
+ off_t total_size = istat_buf.st_size;
+
+ wfd = open(usblogpath, O_RDWR | O_APPEND | O_TRUNC | O_CREAT | O_CLOEXEC,
+ 0644);
+ if (wfd == -1) {
+ fprintf(stderr, "%s: Error. Failed to open file: %s for reading.\n",
+ __FUNCTION__, usblogpath);
+ close(rfd);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ pData = reinterpret_cast<BYTE*>(malloc(ENC_BUF_MAX_SIZE));
+ if (pData == NULL) {
+ fprintf(stderr, "%s: Error. Failed to malloc %d byte for dst \n",
+ __FUNCTION__, ENC_BUF_MAX_SIZE);
+ close(rfd);
+ close(wfd);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ total_len = static_cast<int>(total_size);
+ do {
+ read_len = read(rfd, pData, ENC_BUF_MAX_SIZE);
+ if (read_len == -1) {
+ fprintf(stderr, "%s: Error. File read failed. errno: %d, %s \n",
+ __FUNCTION__, errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ ret = write(wfd, pData, read_len);
+ if (ret == -1) {
+ fprintf(stderr, "%s: Error. length(%d) no space to write: %d, %s \n",
+ __FUNCTION__, ret, errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ total_len -= read_len;
+ } while (total_len > 0);
+
+ fsync(wfd);
+ free(pData);
+ close(wfd);
+ close(rfd);
+
+ if (l_eStatus == eFrameworkunifiedStatusFail) {
+ return l_eStatus;
+ }
+ {
+ // Synchronization security
+ struct stat ostat_buf;
+ while (1) {
+ ret = stat(usblogpath, &ostat_buf);
+ if (ret < 0) {
+ fprintf(stderr, "%s: Error. stat(%s). errno: %d, %s", __FUNCTION__,
+ usblogpath, errno, strerror(errno));
+ break;
+ }
+ if (ostat_buf.st_size >= total_size) {
+ break;
+ }
+ usleep(1000); // interval
+ }
+ }
+ }
+ return l_eStatus;
+}
diff --git a/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/work/Makefile b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/work/Makefile
new file mode 100755
index 0000000..ee9c7e8
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/work/Makefile
@@ -0,0 +1,23 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#ADD_EXT:=rel
+
+
+LDLIBS += -Wl,-Bdynamic -lcrypto
+CPPFLAGS += -DRELEASE_BUILD
+
+include ../src/Makefile
diff --git a/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/work_debug/Makefile b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/work_debug/Makefile
new file mode 100755
index 0000000..8ad806a
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/realtimeUsbLog/work_debug/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ADD_EXT:=dbg
+
+include ../src/Makefile
diff --git a/video_in_hal/systemservice/logger_service/server/screenShot/Makefile b/video_in_hal/systemservice/logger_service/server/screenShot/Makefile
new file mode 100755
index 0000000..f52e40c
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/screenShot/Makefile
@@ -0,0 +1,52 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = SS_ScrShot
+
+######### installed library(*.a) #############
+
+
+######### installed shared library(*.so) #############
+
+
+######### install headers(*.h) #############
+
+
+######### compiled sources #############
+SS_ScrShot_SRCS = ss_logger_scrshot.cpp
+
+######### add source path #############
+
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -fno-exceptions
+
+######### linked library #############
+
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -ldu
+LDLIBS += -Wl,-Bdynamic -ljpeg
+#LDLIBS += -Wl,-Bdynamic -lextension
+LDLIBS += -Wl,-Bdynamic -ldrm
+
+######### add library path #############
+LDFLAGS += -Wl,--gc-sections
+
+LINK_CXX=Y
+include ../../../system_service.mk
diff --git a/video_in_hal/systemservice/logger_service/server/screenShot/ss_logger_scrshot.cpp b/video_in_hal/systemservice/logger_service/server/screenShot/ss_logger_scrshot.cpp
new file mode 100755
index 0000000..db5bcba
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/screenShot/ss_logger_scrshot.cpp
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <jpeglib.h>
+#include <du.h>
+
+#define MAX_IMAGE_WIDTH 1280
+#define MAX_IMAGE_HEIGHT 480
+#define COLOR_COMPONENT 4
+
+int SS_Logger_SaveScreenShot(const char* filename, int type) {
+ FILE *outfile;
+ struct SCRSHOT_capture_arg stSCR;
+ struct jpeg_compress_struct cinfo;
+ struct jpeg_error_mgr jerr;
+ unsigned char *work_buf;
+
+ stSCR.du = type; // 0:E2 1:M2
+ stSCR.fmt = SCRSHOT_FMT_ARGB8888;
+ stSCR.buff = malloc(MAX_IMAGE_WIDTH * MAX_IMAGE_HEIGHT * COLOR_COMPONENT);
+ stSCR.buff_len = MAX_IMAGE_WIDTH * MAX_IMAGE_HEIGHT * COLOR_COMPONENT;
+ stSCR.ev_handler = NULL; // sync mode
+
+ if (stSCR.buff == NULL) {
+ exit(1);
+ }
+
+ if (SCRSHOT_RET_SUCCESS != SCRSHOT_capture(&stSCR)) {
+ exit(1);
+ }
+
+ cinfo.err = jpeg_std_error(&jerr);
+ jpeg_create_compress(&cinfo);
+
+ if ((outfile = fopen(filename, "wb")) == NULL) {
+ exit(1);
+ }
+ jpeg_stdio_dest(&cinfo, outfile);
+ cinfo.image_width = stSCR.width;
+ cinfo.image_height = stSCR.height;
+ cinfo.input_components = COLOR_COMPONENT;
+ cinfo.in_color_space = JCS_EXT_BGRA;
+ jpeg_set_defaults(&cinfo);
+ jpeg_start_compress(&cinfo, TRUE);
+
+ work_buf = (unsigned char*) stSCR.buff;
+ for (unsigned int i = 0; i < stSCR.height; i++) {
+ jpeg_write_scanlines(&cinfo, (JSAMPARRAY) & (work_buf), 1);
+ work_buf += stSCR.width * COLOR_COMPONENT;
+ }
+
+ jpeg_finish_compress(&cinfo);
+ jpeg_destroy_compress(&cinfo);
+ free(stSCR.buff);
+ fclose(outfile);
+ exit(0);
+}
+
+int main(int argc, char *argv[]) {
+ if (argc < 3) {
+ exit(1);
+ }
+ int chType = atoi(argv[2]);
+ SS_Logger_SaveScreenShot(argv[1], chType);
+
+ return 0;
+}
diff --git a/video_in_hal/systemservice/logger_service/server/src/cached_file_writer.cpp b/video_in_hal/systemservice/logger_service/server/src/cached_file_writer.cpp
new file mode 100755
index 0000000..92c02f5
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/cached_file_writer.cpp
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/writer/cached_file_writer.h"
+#include <native_service/frameworkunified_types.h>
+
+namespace ReaderWriter {
+
+CCachedFileWriter::CCachedFileWriter() {
+ std::memset(this->m_buffer, 0, CACHED_BLOCK_SIZE);
+ m_index = 0u;
+}
+
+CCachedFileWriter::~CCachedFileWriter() {
+}
+
+EFrameworkunifiedStatus CCachedFileWriter::Write(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesWritten) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // length check
+ if (f_data != NULL) { // LCOV_EXCL_BR_LINE 200: f_data can not be null
+ if ((this->m_index + f_length) > CACHED_BLOCK_SIZE) { // LCOV_EXCL_BR_LINE 200: data size can not over 4*1024
+ l_eStatus = this->FlushCache();
+ }
+ if (f_length > CACHED_BLOCK_SIZE) { // LCOV_EXCL_BR_LINE 200: data size can not over 4*1024
+ // LCOV_EXCL_START 200: data size can not over 4*1024
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Possible memory corruption.");
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Length(%d) bigger than cache. Will dump memory to core and ignore data. ",
+ f_length);
+ // LCOV_EXCL_STOP
+ } else {
+ (void) std::memcpy(&this->m_buffer[this->m_index], f_data, f_length);
+ this->m_index += f_length;
+ f_bytesWritten = f_length;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CCachedFileWriter::FlushCache(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SI_32 l_written = 0;
+ SI_32 l_writtenTotal = 0;
+ while (((l_writtenTotal >= 0) && ((UI_32) l_writtenTotal < this->m_index))
+ && (eFrameworkunifiedStatusOK == l_eStatus)) {
+ l_eStatus = this->WriteData(&this->m_buffer[l_writtenTotal],
+ this->m_index - l_writtenTotal, l_written);
+ l_writtenTotal += l_written;
+ l_written = 0;
+ }
+ this->m_index = 0;
+ return l_eStatus;
+}
+} // namespace ReaderWriter
diff --git a/video_in_hal/systemservice/logger_service/server/src/file_writer.cpp b/video_in_hal/systemservice/logger_service/server/src/file_writer.cpp
new file mode 100755
index 0000000..221a1d4
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/file_writer.cpp
@@ -0,0 +1,122 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/writer/file_writer.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string>
+
+namespace ReaderWriter {
+CFileWriter::CFileWriter()
+ : m_FileHandle(-1),
+ m_fileposn(-1),
+ m_maxFileSize(0) {
+}
+
+CFileWriter::~CFileWriter() {
+ if (this->m_FileHandle != -1) { // LCOV_EXCL_BR_LINE 200: it aways open, so m_FileHandle can not be -1
+ this->Close();
+ this->m_FileHandle = -1;
+ }
+}
+
+EFrameworkunifiedStatus CFileWriter::Initialize(CLoggerCfg* f_pLoggerCfg,
+ std::string f_Name1, UI_32 f_size1,
+ std::string f_Name2, UI_32 f_size2) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ this->m_pLoggerCfg = f_pLoggerCfg;
+ this->m_maxFileSize = f_size1;
+ if ((f_Name1.length() != 0) && (this->m_FileHandle == -1)) { // LCOV_EXCL_BR_LINE 6:Due to the initial status
+ m_filename = f_Name1;
+ l_eStatus = this->Open();
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CFileWriter::Open(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if (this->m_FileHandle != -1) { // LCOV_EXCL_BR_LINE 6:Due to the initial status
+ // File already opened, no action required.
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (m_filename.length() != 0) { // LCOV_EXCL_BR_LINE 6:Because the applicable variable cannot be changed from the external API
+ this->m_FileHandle = open(m_filename.c_str(),
+ O_WRONLY | O_CREAT | O_TRUNC,
+ 0644);
+ if (-1 != this->m_FileHandle) { // LCOV_EXCL_BR_LINE 5:The open cannot pass because it cannot be mock
+ l_eStatus = eFrameworkunifiedStatusOK;
+ m_fileposn = lseek(m_FileHandle, 0L, SEEK_CUR);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+BOOL CFileWriter::IsOpen(void) {
+ return (-1 == m_FileHandle) ? FALSE : TRUE;
+}
+
+EFrameworkunifiedStatus CFileWriter::Write(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesWritten) {
+ return (this->WriteData(f_data, f_length, f_bytesWritten));
+}
+
+EFrameworkunifiedStatus CFileWriter::WriteData(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesWritten) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ f_bytesWritten = 0;
+ if (-1 == m_FileHandle) { // LCOV_EXCL_BR_LINE 200: m_FileHandle can not be null
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ while ((eFrameworkunifiedStatusOK == l_eStatus)
+ && ((f_bytesWritten >= 0) && ((UI_32) f_bytesWritten < f_length))) {
+ SI_32 l_bytesWritten = -1;
+ m_fileposn = lseek(m_FileHandle, 0L, SEEK_CUR);
+ if ((m_fileposn + (UI_32) f_length) >= this->m_maxFileSize) {
+ SI_32 l_deltaLength = static_cast<SI_32>(this->m_maxFileSize - m_fileposn);
+ l_bytesWritten = static_cast<SI_32>(write(m_FileHandle, &f_data[f_bytesWritten],
+ l_deltaLength));
+ f_bytesWritten += l_bytesWritten;
+ if ((l_bytesWritten >= 0) && (l_deltaLength == l_bytesWritten)) {
+ m_fileposn = lseek(m_FileHandle, 0L, SEEK_SET);
+ }
+ } else {
+ l_bytesWritten = static_cast<SI_32>(write(m_FileHandle, &f_data[f_bytesWritten],
+ f_length - f_bytesWritten));
+ f_bytesWritten += l_bytesWritten;
+ }
+ l_eStatus = (l_bytesWritten > -1) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
+ }
+
+ return (l_eStatus);
+}
+
+void CFileWriter::Close() { // LCOV_EXCL_START 6:Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (this->m_FileHandle != -1) {
+ (void) close(this->m_FileHandle);
+ this->m_FileHandle = -1;
+ }
+}
+// LCOV_EXCL_STOP
+} // namespace ReaderWriter
diff --git a/video_in_hal/systemservice/logger_service/server/src/loggerservice_application.cpp b/video_in_hal/systemservice/logger_service/server/src/loggerservice_application.cpp
new file mode 100755
index 0000000..2d39fb2
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/loggerservice_application.cpp
@@ -0,0 +1,952 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief This file contains the standard set functions called by the NS
+// dispatcher on application initialization, cleanup and wakeup.
+///
+///////////////////////////////////////////////////////////////////////////////
+// System Headers
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/cl_process.h>
+
+#include <native_service/nslogutil_cmd_if.h>
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_protocol.h>
+
+#include <loggerservicedebug_loggerservicelog.h>
+#include <loggerservicedebug_thread_if.h>
+#include <loggerservicedebug_writer_Evntworker.h>
+
+#include <native_service/frameworkunified_timer.h>
+#include <ss_logger_device_detection.h>
+
+#include <ss_logger_cfg.h>
+#include <system_service/ss_logger_service_notifications.h>
+#include <system_service/ss_logger_service.h>
+#include <ss_logger_service_callbacks.h>
+
+#include <system_service/ss_sm_client_if.h>
+
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_system_manager_notifications.h>
+
+#include <system_service/ss_devicedetection_service_notifications.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <system_service/ss_services.h>
+#include <ss_logger_error_event.h>
+#include <ss_logger_reader_writer_control.h>
+#include <ss_logger_common.h>
+#include <stub/pfdrec_thread_ifc.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_logger_store_logs.h>
+#include <queue>
+#include <string>
+
+// const definitions
+#define TMPFS_PATH "/tmp"
+
+#define SYS_ILLEGAL_LOG_DELAY_TIME ( 20 * 1000 )
+const CHAR LOGGERSERVICELOGGER_SETPARAMS[] = TMPFS_PATH "/loggerservicelogger_setparams.log";
+const CHAR Counter_LOG_PATH_FN[] = TMPFS_PATH "/loggerservice_counter.log";
+const CHAR Mileage_LOG_PATH_FN[] = TMPFS_PATH "/loggerservice_mileage.log";
+
+const CHAR g_strLogQueWriterWorkerName[] = "pdg.LogQueWriter";
+const CHAR g_strTransmitQueWriterWorkerName[] = "pdg.TransmitQueWriter";
+const CHAR g_strUdpQueWriterWorkerName[] = "pdg.UdpQueWriter";
+const CHAR g_strEvntLogQueWorkerName[] = "pdg.EvntLogQue";
+
+// handles to writer threads
+static HANDLE g_thrdLogWriter = NULL; // Var. that holds the child handle to the Log Writer thread
+static HANDLE g_thrdTxWriter = NULL; // Var. that holds the child handle to the Tx Writer thread
+
+/// Event_logger
+HANDLE g_thrdEvntLogWriter = NULL; // Var. that holds the child handle to the EVNTLOGGER Writer thread
+static TEvntWriterInfo Evntlog_wi = { };
+TUploadEventLogResp g_stUploadEventLogResp;
+
+// global variable to store the service status
+ELOGGERSERVICESTATUS g_eLoggerServiceStatus = eLSInit;
+
+// class to usb and reader threads
+LoggerserviceDebugChildThread g_loggerservicedebug_threads;
+
+/// Device Detection Class Instance
+DeviceDetectionServiceIf g_devDetect_t;
+
+CLoggerCfg g_loggerCfg;
+CErrorEvent g_errorEventHandler;
+CLoggerServiceCallbacks g_serviceCallbacks;
+CLoggerDeviceDetection g_deviceDetection;
+CReaderWriterControl g_ReaderWriterControl;
+CPFDRECThread g_PFDRECThread;
+
+/// Decide the function NormalStartupProcess execution
+static bool g_normal_startup_status = false;
+
+/// Callbacks for messages that will be received and processed by this module
+static EFrameworkunifiedStatus OnUsbEject(HANDLE hApp);
+
+static EFrameworkunifiedStatus OnUsbStoreLogs(HANDLE hApp);
+
+static EFrameworkunifiedStatus SMSessionAckCb(HANDLE hApp);
+
+/// Positive Response Call backs from child thread for statistical counter read
+static EFrameworkunifiedStatus cbStatisticalCounterSuccessResp(HANDLE hApp);
+
+/// Error Response Call backs from child thread for statistical counter read
+static EFrameworkunifiedStatus cbStatisticalCounterErrorResp(HANDLE hApp);
+
+/// Response Call backs from child thread for clear event logs
+static EFrameworkunifiedStatus cbClearEventLogsResponse(HANDLE hApp);
+
+/// Response Call backs from child thread for copying event logs to USB
+static EFrameworkunifiedStatus cbCopyEventLogsUSBResponse(HANDLE hApp);
+
+/// Response Call backs from child thread for Reading number of events logged
+static EFrameworkunifiedStatus cbReadNumbOfEventsResponse(HANDLE hApp);
+
+/// Response Call backs from child thread for Upload eventlog
+static EFrameworkunifiedStatus cbUploadEventLogResponse(HANDLE hApp);
+
+/// Notificatin from SystemManager when All Services wakeup completed
+static EFrameworkunifiedStatus cbServiceWakeupStatus(HANDLE hApp);
+
+
+/// generate SYS_ILG_LOG
+static EFrameworkunifiedStatus SysIllegalLogTimer_OnInterval(HANDLE hApp);
+
+
+/// Call back tables for response from event logger child thread
+FrameworkunifiedProtocolCallbackHandler evtLogChildThread_handler[] = { { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ eThrdCmdStatisticalCounterSuccessResp, cbStatisticalCounterSuccessResp }, {
+ eThrdCmdStatisticalCounterErrorResp, cbStatisticalCounterErrorResp }, {
+ eThrdCmdCopyEventLogUSBResponse, cbCopyEventLogsUSBResponse }, {
+ eThrdCmdClearEventLogResponse, cbClearEventLogsResponse }, {
+ eThrdCmdNumberOfEventsLoggedResponse, cbReadNumbOfEventsResponse }, {
+ eThrdCmdUploadEventLogResponse, cbUploadEventLogResponse } };
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnInitialization
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // 1. Register Srv Availability Notification
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hApp, NTFY_SS_LoggerService_Availability))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:0x%x ", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ // 2. Publish Service not available
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:%d ", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = g_loggerCfg.Initialize(hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_loggerCfg.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ std::string l_cfgFilePathAndName =
+ "/usr/agl/conf/BS/ss/logger_service/rodata/ss_logger.cfg";
+ if (eFrameworkunifiedStatusOK != (l_eStatus = g_loggerCfg.Load(l_cfgFilePathAndName))) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " Error. Failed to load SS_Logger configuration from %s with error: %d",
+ l_cfgFilePathAndName.c_str(), l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = g_loggerCfg.Validate())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Configuration validation failed with error: %d.",
+ l_eStatus);
+ }
+
+ g_loggerCfg.Print(); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ l_eStatus = g_deviceDetection.Initialize(hApp, &g_loggerCfg); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_deviceDetection.Initialize"); // LCOV_EXCL_BR_LINE 15: macro
+
+ l_eStatus = g_ReaderWriterControl.Initialize(&g_loggerCfg); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_ReaderWriterControl.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ if (NULL == (g_thrdEvntLogWriter = FrameworkunifiedCreateChildThreadWithPriority( hApp, g_strEvntLogQueWorkerName, EvntWriterWorkerOnStart, EvntWriterWorkerOnStop, frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(std::string(g_strEvntLogQueWorkerName))))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "FrameworkunifiedCreateChildThreadWithPriority Failed Status:0x%x for thread create of %s",
+ l_eStatus, g_strEvntLogQueWorkerName);
+ return (l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG( // LCOV_EXCL_BR_LINE 15: macro
+ ZONE_INFO,
+ __FUNCTION__,
+ "FrameworkunifiedCreateChildThreadWithPriority Success Status: for thread create of %s",
+ g_strEvntLogQueWorkerName); // LCOV_EXCL_BR_LINE 15: macro
+ }
+
+ l_eStatus = g_errorEventHandler.Initialize(hApp, &g_loggerCfg, // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ &g_ReaderWriterControl,
+ g_thrdEvntLogWriter,
+ g_strEvntLogQueWorkerName); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. g_errorEventHandler.Initialize() returned: %d.", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+ l_eStatus = g_serviceCallbacks.Initialize(hApp, &g_loggerCfg,
+ &g_errorEventHandler); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_serviceCallbacks.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ // Callback to Event log child Thread
+ l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hApp, g_strEvntLogQueWorkerName, evtLogChildThread_handler,
+ _countof(evtLogChildThread_handler)); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, // LCOV_EXCL_BR_LINE 15: macro
+ "Status of callback for child thread attach:%X", l_eStatus); // LCOV_EXCL_BR_LINE 15: macro
+
+ // setup call backs for my children
+ FrameworkunifiedAttachCallbackToDispatcher(hApp, AppName, eThrdCmdUsbEject, OnUsbEject); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ FrameworkunifiedAttachCallbackToDispatcher(hApp, AppName, eThrdCmdUsbStoreLogs,
+ OnUsbStoreLogs);
+
+ // Publications
+ FrameworkunifiedNotificationsList publish_notifs[] = {
+ // Notifications name,length, state
+ { NTFY_LOGGER_SETCONTROLMASK, sizeof(CHANGELOGPARAMS), eFrameworkunifiedStateVar } };
+
+ // Indicate to Notification Service what I will be Publishing!
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedNPRegisterNotifications(hApp, publish_notifs, _countof(publish_notifs)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedNPRegisterNotifications Failed Status:0x%x ", l_eStatus);
+ return (l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ /// Start the Writer threads
+ strncpy(Evntlog_wi.mileage_filename, Mileage_LOG_PATH_FN,
+ Evntlog_wi.FN_LEN - 1);
+ Evntlog_wi.mileage_filename[Evntlog_wi.FN_LEN - 1] = '\0';
+ strncpy(Evntlog_wi.base_cnt_filename, Counter_LOG_PATH_FN,
+ Evntlog_wi.FN_LEN - 1);
+ Evntlog_wi.base_cnt_filename[Evntlog_wi.FN_LEN - 1] = '\0';
+ Evntlog_wi.max_filelen = g_loggerCfg.m_logMaxFileSize;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(hApp, g_thrdEvntLogWriter, sizeof(Evntlog_wi), &Evntlog_wi))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "Fail to Start Writer Worker thread. Status:0x%x", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = RegisterSMSessionAckCallback(SMSessionAckCb); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "RegisterSMSessionAckCallback()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ l_eStatus = g_PFDRECThread.Initialize(hApp); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_PFDRECThread.Initialize()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, TRUE))) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:0x%x ", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_SSServiceWakeupStatus, cbServiceWakeupStatus); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSubscribeNotificationWithCallback()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ // Set Service status to init
+ g_eLoggerServiceStatus = eLSInit;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+static void *accOffOnCollect(void* param) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SS_LoggerStoreLogs(SS_STORELOGS_ACCOFFON_PRESS);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return NULL;
+}
+
+// Normal startup process
+static EFrameworkunifiedStatus NormalStartupProcess(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (false == g_normal_startup_status) {
+ T_SS_SM_START_DataStructType prm;
+
+ l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &prm, sizeof(T_SS_SM_START_DataStructType), eSMRRetain);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Failed PasGetMsgDataOfSize() [%d]", l_eStatus);
+ }
+
+ if (prm.resetStatus == e_SS_SM_RESET_STATUS_NG) {
+ HANDLE timer =
+ FrameworkunifiedAttachTimerCallback(hApp, SYS_ILLEGAL_LOG_DELAY_TIME, 0, SysIllegalLogTimer_OnInterval);
+ if (timer == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, " Failed to register timer.");
+ }
+ }
+
+ if (0 == access("/tmp/accoffon", F_OK)) {
+ pthread_t threadAccOffOn;
+ pthread_create( &threadAccOffOn, NULL, accOffOnCollect, NULL);
+ }
+
+ if (g_eLoggerServiceStatus == eLSStop) {
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, TRUE))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:0x%x ",
+ l_eStatus);
+ }
+
+ // Start the Writer threads
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedStartChildThread(hApp, g_thrdEvntLogWriter,
+ sizeof(Evntlog_wi), &Evntlog_wi))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "Fail to Start Writer Worker thread. Status:0x%x", l_eStatus);
+ }
+ }
+ // Set Service status to init
+ g_eLoggerServiceStatus = eLSStart;
+
+ // Set normal_startup_status flag (true)
+ g_normal_startup_status = true;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = NormalStartupProcess(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = NormalStartupProcess(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = NormalStartupProcess(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+static EFrameworkunifiedStatus SysIllegalLogTimer_OnInterval(HANDLE hApp) { // LCOV_EXCL_START 200: There is no SUBCP_STS_COMNG case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = SS_LoggerStoreLogs(SS_STORELOGS_SYS_ILLEGAL);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, " Failed SS_LoggerStoreLogs()");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ /*Get stop factor form hApp*/
+ T_SS_SM_STOP_DataStructType errorType;
+
+ // LCOV_EXCL_BR_START 4: NSFW error
+ if (eFrameworkunifiedStatusOK
+ != FrameworkunifiedGetMsgDataOfSize(hApp, (PVOID) &errorType, sizeof(errorType),
+ eSMRRelease)) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ " FrameworkunifiedGetMsgDataOfSize failed with error");
+ // LCOV_EXCL_STOP
+ } else {
+ EFrameworkunifiedStatus loggerserviceRet = SS_LoggerStoreLogs(SS_STORELOGS_INTERFACEUNIFIEDLOG);
+ LOG_STATUS_IF_ERRORED(loggerserviceRet, "Fail to save Loggerservice Log");
+ EFrameworkunifiedStatus naviLog_status = g_errorEventHandler.SaveNaviLog(
+ errorType.shutdownTrigger);
+ LOG_STATUS_IF_ERRORED(naviLog_status, "Fail to save Navi Log");
+ }
+ StopLoggingFunction(hApp);
+
+ if (g_eLoggerServiceStatus == eLSStart) { // LCOV_EXCL_BR_LINE 200: g_eLoggerServiceStatus must be eLSStart on ACC-OFF
+ LoggerService_OnStop(hApp);
+ }
+
+ // Set normal_startup_status flag (false)
+ g_normal_startup_status = false;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * EFrameworkunifiedStatus LoggerService_OnStop(HANDLE hApp)
+ * @brief Logger Stop is called on Shutdown complete cmd
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus LoggerService_OnStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Set Service status to init
+ g_eLoggerServiceStatus = eLSStop;
+
+ /// Start the Writer threads
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStopChildThread(hApp, g_thrdEvntLogWriter, sizeof(Evntlog_wi), &Evntlog_wi))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "Fail to Start Writer Worker thread. Status:0x%x", l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "Successful in Sending Stop to ChildThread");
+ }
+
+ // Publish Service available this can also be published from FrameworkunifiedOnStart callback
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:0x%x ", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus SMSessionAckCb(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ HANDLE l_hSession;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: macro
+
+ l_hSession = FrameworkunifiedGetOpenSessionHandle(hApp);
+
+ if (NULL == l_hSession) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " Error. FrameworkunifiedGetSessionHandle() returned a NULL session handle. "
+ "Error events originating from System Manager will not be detected.");
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = FrameworkunifiedSetSessionHandle(hApp, FrameworkunifiedGetMsgSrc(hApp), l_hSession);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSessionHandle()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ l_eStatus = g_errorEventHandler.RegisterSessionErrorEvent(l_hSession);
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: macro
+ "g_errorEventHandler.RegisterSessionErrorEvent()");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnWakeup(HANDLE hApp) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnShutdown
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE hApp) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnEShutdown
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE hApp) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnDebugDump
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// HACK! mb20100701
+/// \todo Add behavior to this function
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) { // LCOV_EXCL_START 14:For process termination processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusNotImplemented;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus OnUsbEject(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ if (g_loggerservicedebug_threads.Running(
+ LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript)) {
+ g_loggerservicedebug_threads.Stop(LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript);
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Stopped Thread: %s",
+ g_loggerservicedebug_threads.Name(
+ LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus OnUsbStoreLogs(HANDLE hApp) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ TThrdCaptureLogsEvt evt = { };
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &evt, sizeof(evt)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize Failed Status:0x%x ",
+ l_eStatus);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return l_eStatus;
+ }
+
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdLogWriter, eThrdCmdWriterStop, 0, NULL);
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdTxWriter, eThrdCmdWriterStop, 0, NULL);
+
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdLogWriter, eThrdCmdWriteFilesToUsb,
+ sizeof(evt), &evt);
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdTxWriter, eThrdCmdWriteFilesToUsb,
+ sizeof(evt), &evt);
+
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdLogWriter, eThrdCmdWriterResume, 0,
+ NULL);
+ l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdTxWriter, eThrdCmdWriterResume, 0, NULL);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :cbStatisticalCounterPosResponse
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbStatisticalCounterSuccessResp(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ TStatisticalCntCmdSuccessResp l_stCmdSuccessResp;
+ SS_loggerserviceprotocol l_eResponseCmd;
+ HANDLE l_hSession = NULL;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TStatisticalCntCmdSuccessResp>(hApp,
+ l_stCmdSuccessResp))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (NULL
+ != (l_hSession = FrameworkunifiedGetSessionHandle(
+ hApp, l_stCmdSuccessResp.stSessiondata.strSrcName.c_str(),
+ l_stCmdSuccessResp.stSessiondata.session_id))) {
+ l_eResponseCmd = SS_LOGGER_READ_STATL_COUNTER_SUCCESS_RESP;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hSession, l_eResponseCmd,
+ sizeof(SStatisticalCounter),
+ &l_stCmdSuccessResp.stBuffer))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :cbStatisticalCounterErrResponse
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbStatisticalCounterErrorResp(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ TSessionData l_stSessiondata;
+ SS_loggerserviceprotocol l_eResponseCmd;
+ HANDLE l_hSession = NULL;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TSessionData>(hApp, l_stSessiondata))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (NULL
+ != (l_hSession = FrameworkunifiedGetSessionHandle(hApp,
+ l_stSessiondata.strSrcName.c_str(),
+ l_stSessiondata.session_id))) {
+ l_eResponseCmd = SS_LOGGER_READ_STATL_COUNTER_ERROR_RESP;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hSession, l_eResponseCmd, 0x00, NULL))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :cbClearEventLogsResponse
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbClearEventLogsResponse(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TClearEvntLogCmdResponse l_stCmdResponse;
+ HANDLE l_hSession = NULL;
+ SS_loggerserviceprotocol l_eResponseCmd;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TClearEvntLogCmdResponse>(hApp, l_stCmdResponse))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (NULL
+ != (l_hSession = FrameworkunifiedGetSessionHandle(
+ hApp, l_stCmdResponse.stSessiondata.strSrcName.c_str(),
+ l_stCmdResponse.stSessiondata.session_id))) {
+ if (l_stCmdResponse.u8Response == (UI_8) CLEAR_EVENT_LOG_SUCCESS) {
+ l_eResponseCmd = SS_LOGGERCLEAREVENT_SUCCESS_RESP;
+ } else {
+ l_eResponseCmd = SS_LOGGERCLEAREVENT_ERROR_RESP;
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hSession, l_eResponseCmd, 0x00, NULL))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :cbCopyEventLogsUSBResponse
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbCopyEventLogsUSBResponse(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TWriteFilesToUsbCmdResponse l_stCmdResponse;
+ HANDLE l_hSession = NULL;
+ SS_loggerserviceprotocol l_eResponseCmd;
+ EEvtLoggerErrorCode l_eResponseCode;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TWriteFilesToUsbCmdResponse>(hApp,
+ l_stCmdResponse))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (NULL
+ != (l_hSession = FrameworkunifiedGetSessionHandle(
+ hApp, l_stCmdResponse.stSessiondata.strSrcName.c_str(),
+ l_stCmdResponse.stSessiondata.session_id))) {
+ if (l_stCmdResponse.u8Response == (UI_8) COPY_EVT_USB_SUCCESS) {
+ l_eResponseCmd = SS_LOGGERCOPYEVENTUSB_SUCCESS_RESP;
+ l_eResponseCode = NO_ERROR_INFO;
+ } else {
+ l_eResponseCmd = SS_LOGGERCOPYEVENTUSB_ERROR_RESP;
+ l_eResponseCode = (EEvtLoggerErrorCode) l_stCmdResponse.u8Response;
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hSession, l_eResponseCmd,
+ sizeof(EEvtLoggerErrorCode),
+ &l_eResponseCode))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbReadNumbOfEventsResponse(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_16 l_NumOfEvents = 0;
+ TEvntsLogged l_stNumberOfEvtsLogged;
+ HANDLE l_hsession = NULL;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TEvntsLogged>(hApp, l_stNumberOfEvtsLogged))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ l_NumOfEvents = l_stNumberOfEvtsLogged.u16numberofeventslogged;
+ if (NULL
+ != (l_hsession = FrameworkunifiedGetSessionHandle(
+ hApp, l_stNumberOfEvtsLogged.stSessiondata.strSrcName.c_str(),
+ l_stNumberOfEvtsLogged.stSessiondata.session_id))) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hsession,
+ SS_LOGGER_ENG_READ_NUMOFEVENTS_RESP,
+ sizeof(UI_16), &l_NumOfEvents))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus cbUploadEventLogResponse(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ HANDLE l_hsession = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "UploadEventLog Response Msg Len = %d",
+ FrameworkunifiedGetMsgLength(hApp));
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TUploadEventLogResp>(hApp, g_stUploadEventLogResp))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (NULL
+ != (l_hsession = FrameworkunifiedGetSessionHandle(
+ hApp, g_stUploadEventLogResp.stSessiondata.strSrcName.c_str(),
+ g_stUploadEventLogResp.stSessiondata.session_id))) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_hsession, SS_LOGGER_UPLOAD_EVENTLOG_RESP,
+ sizeof(STEventLogPersistBuffer),
+ &g_stUploadEventLogResp.stEventLogBuffer))) {
+ LOG_ERROR("FrameworkunifiedSendMsg()");
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetSessionHandle()");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus cbServiceWakeupStatus(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = g_errorEventHandler.CreateKernelLog(hApp,
+ SS_LOGGER_KBOOTLOG_CREATE);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "CreateKernelLog(SS_LOGGER_KBOOTLOG_CREATE)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+void StopLoggingFunction(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // PFDRECThread Stop
+ EFrameworkunifiedStatus l_eStatus = g_PFDRECThread.Finalize(hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "g_PFDRECThread.Finalize()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
diff --git a/video_in_hal/systemservice/logger_service/server/src/loggerservice_main.cpp b/video_in_hal/systemservice/logger_service/server/src/loggerservice_main.cpp
new file mode 100755
index 0000000..a7ee212
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/loggerservice_main.cpp
@@ -0,0 +1,59 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief Application entry point.
+///
+///////////////////////////////////////////////////////////////////////////////
+// System Headers
+#include <pthread.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_application.h>
+#include <system_service/ss_system_if.h>
+#include <loggerservicedebug_loggerservicelog.h>
+#include <system_service/ss_version.h>
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_services.h>
+#include <cstdlib>
+#include <iostream>
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { FRAMEWORKUNIFIEDLOGOPTIONS, {
+ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ZONE_TEXT_31 }, FRAMEWORKUNIFIEDLOGZONES };
+
+const CHAR AppName[] = SERVICE_LOGGER;
+
+//////////////////////////////////////////
+// Function : main
+//////////////////////////////////////////
+int main(int argc, char *argv[]) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cbFuncs); // LCOV_EXCL_BR_LINE 15: macro
+ FRAMEWORKUNIFIED_SET_ZONES(); // LCOV_EXCL_BR_LINE 15: macro
+
+ eStatus = FrameworkunifiedDispatcherWithArguments(AppName, argc, argv, &cbFuncs); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ return eStatus;
+} // LCOV_EXCL_BR_LINE 10:the last line
diff --git a/video_in_hal/systemservice/logger_service/server/src/loggerservicedebug_child_thread.cpp b/video_in_hal/systemservice/logger_service/server/src/loggerservicedebug_child_thread.cpp
new file mode 100755
index 0000000..4a8668f
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/loggerservicedebug_child_thread.cpp
@@ -0,0 +1,134 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief Class that threads for usb, and readers use to AGL and get
+/// information from the parent.
+///
+///////////////////////////////////////////////////////////////////////////////
+// System Headers
+#include <loggerservicedebug_thread_if.h>
+#include <new>
+
+const CHAR g_strLogQueReaderWorkerName[] = "pdg.LogQueR";
+const CHAR g_strTransmitQueReaderWorkerName[] = "pdg.TransQueR";
+const CHAR g_strPerformanceQueReaderWorkerName[] = "pdg.PerformQueR";
+const CHAR g_strUsbEjectWorkerName[] = "pdg.UsbEject";
+const CHAR g_strUsbLogCaptureWorkerName[] = "pdg.UsbLogCapt";
+const CHAR g_strCaptureLogScriptExeName[] = "pdg.CaptLogScri";
+
+LoggerserviceDebugChildThread::LoggerserviceDebugChildThread() {
+ names[LoggerserviceDebugChildThread::kLoggerserviceDebugLogQueReader] =
+ g_strLogQueReaderWorkerName;
+ names[LoggerserviceDebugChildThread::kLoggerserviceDebugTransmitQueReader] =
+ g_strTransmitQueReaderWorkerName;
+ names[LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript] =
+ g_strCaptureLogScriptExeName;
+ names[LoggerserviceDebugChildThread::kLoggerservicePerformanceLogQueReader] =
+ g_strPerformanceQueReaderWorkerName;
+
+ threads[LoggerserviceDebugChildThread::kLoggerserviceDebugLogQueReader] = NULL;
+ threads[LoggerserviceDebugChildThread::kLoggerserviceDebugTransmitQueReader] = NULL;
+ threads[LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript] = NULL;
+ threads[LoggerserviceDebugChildThread::kLoggerservicePerformanceLogQueReader] = NULL;
+} // LCOV_EXCL_BR_LINE 10:the last line
+
+LoggerserviceDebugChildThread::~LoggerserviceDebugChildThread() { // LCOV_EXCL_START 14:global instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+BOOL LoggerserviceDebugChildThread::Start(ELoggerserviceDebugThreads id, const char* parentsName,
+ const char * sendDataToQue,
+ void* (*routine)(void*),
+ const char * sendToUdpQue) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL rtn = FALSE;
+ if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
+ if (threads[id] == NULL) {
+ if ( NULL
+ != (threads[id] = new (std::nothrow) CChild(parentsName,
+ sendDataToQue,
+ names[id].c_str(),
+ routine, sendToUdpQue))) {
+ rtn = TRUE;
+ }
+ } else {
+ rtn = TRUE;
+ }
+ }
+
+ return rtn;
+}
+// LCOV_EXCL_STOP
+
+void LoggerserviceDebugChildThread::Stop(ELoggerserviceDebugThreads id) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
+ if (threads[id] != NULL) {
+ delete threads[id];
+ threads[id] = NULL;
+ }
+ }
+}
+// LCOV_EXCL_STOP
+
+BOOL LoggerserviceDebugChildThread::Running(ELoggerserviceDebugThreads id) const { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL rtn = FALSE;
+ if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
+ if (threads[id] != NULL) {
+ rtn = TRUE;
+ }
+ }
+
+ return rtn;
+}
+// LCOV_EXCL_STOP
+
+void LoggerserviceDebugChildThread::StopAll() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ for (int id = kLoggerserviceDebugLogQueReader; id < kLoggerserviceDebugMax; id++) {
+ if (threads[id] != NULL) {
+ threads[id]->Join();
+ delete threads[id];
+ threads[id] = NULL;
+ }
+ }
+}
+// LCOV_EXCL_STOP
+
+const char * LoggerserviceDebugChildThread::Name(ELoggerserviceDebugThreads id) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
+ return names[id].c_str();
+ }
+
+ return NULL;
+}
+// LCOV_EXCL_STOP
+
+void LoggerserviceDebugChildThread::LiftWaitBarrier(ELoggerserviceDebugThreads id) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
+ if (threads[id] != NULL) {
+ threads[id]->IsValidWaitBarrier();
+ }
+ }
+}
+// LCOV_EXCL_STOP
+
diff --git a/video_in_hal/systemservice/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp b/video_in_hal/systemservice/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp
new file mode 100755
index 0000000..5d29a58
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/loggerservicedebug_writer_Evntworker.cpp
@@ -0,0 +1,1362 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_LogTraceSender
+/// \brief frameworkunifieddebug writer thread class, handles writing a log file
+/// all really done by my_writer class.
+///
+///////////////////////////////////////////////////////////////////////////////
+// System Headers
+#include "loggerservicedebug_writer_Evntworker.h"
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/timeb.h>
+#include <boost/bind.hpp>
+#include <errno.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <native_service/frameworkunified_timer.h>
+#include <loggerservicedebug_thread_if.h>
+#include <loggerservicedebug_loggerservicelog.h>
+#include <system_service/ss_logger_service_notifications.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_templates.h>
+#include <stub/Clock_API.h>
+#include <new>
+#include <utility>
+#include <string>
+
+/// Macros definition for the constants
+#define SIZE_0 (size_t)0
+#define SIZE_1 (size_t)1
+#define COUNTER_SIZE 6 ///< Counter ID 2 bytes and Counter Value is 4 bytes
+#define SINGLE_EVENT_INFO_SIZE 10 ///< Event log size
+#define INITIAL_CNT_VALUE 0x00000001 ///< Init count value for counter logging
+#define MAX_CNT_VALUE 0xFFFFFFFF ///< Max count calue for counter logging
+#define MAX_USB_DEVICE 2 ///< Max USB devices
+
+// Temp path for event logs that used for copying to USB
+const CHAR TMP_DEBUG_EVNTLOG_PATH_FN[] = "/tmp/loggerservice_Evntdebug.dat";
+
+// Structure to hold the USB device information
+TThrdEvtLogStore gSUSBDevInfo[MAX_USB_DEVICE] = { };
+
+// Structure to hold the SD card device information
+TThrdEvtLogStore gSSDCardevInfo = { };
+
+// Object for device detection class
+DeviceDetectionServiceIf m_device_detector_obj;
+
+// Map container for startup phase counter
+CounterInformation CEvntWriterWorker::counter;
+
+// Deque container for event logging
+DEQUE_Event_Type CEvntWriterWorker::deque_event_info;
+
+static CEvntWriterWorker * pObj = new (std::nothrow) CEvntWriterWorker(); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+static TEvntWriterInfo wi = { };
+
+// Event Common Info global structure
+extern UEvtLoggerCommonInfo g_uEvtLoggerCommonInfo;
+extern UI_16 g_u16DiagId;
+static EFrameworkunifiedStatus ReadEventLogQueue(HANDLE hThread);
+// created global variables as they are used in non member function
+HANDLE g_hReceive = NULL;
+HANDLE g_hEvtLogTimer = NULL;
+
+CEvntWriterWorker::CEvntWriterWorker()
+ : m_u32MileageData(0),
+ m_u32NumberEventsLogged(0) {
+ memset(m_stVINnumber.VINstr, 0, m_stVINnumber.VIN_LEN);
+}
+
+CEvntWriterWorker::~CEvntWriterWorker() { // LCOV_EXCL_START 14:global instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CEvntWriterWorker::Initialize(HANDLE hThread) {
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :EventLogRegisterCbHandlers
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::EventLogRegisterCbHandlers(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FrameworkunifiedProtocolCallbackHandler aParentHandlers[] = { {
+ eThrdCmdWriteEvntFilesToUsb, boost::bind(
+ &CEvntWriterWorker::OnCmdWriteEventFilesToUsb, this, _1) }, {
+ eThrdCmdClearEvntLogs, boost::bind(
+ &CEvntWriterWorker::OnCmdClearEventLogs, this, _1) }, {
+ eThrdCmdStatisticalCounter, boost::bind(
+ &CEvntWriterWorker::OnCmdReadStatisticalCounter, this, _1) }, {
+ eThrdCmdResetStatisticalCntrs, boost::bind(
+ &CEvntWriterWorker::OnCmdResetStatisticalCounter, this, _1) }, {
+ eThrdCmdSetVINnumber, boost::bind(&CEvntWriterWorker::OnCmdSetVIN, this,
+ _1) }, { eThrdCmdImmPersistEvtLog,
+ boost::bind(&CEvntWriterWorker::immediate_persist_event_log, this, _1) },
+ { eThrdCmdMileageData, boost::bind(&CEvntWriterWorker::EvtThd_SetMileage,
+ this, _1) }, {
+ eThrdCmdGetNumberOfEventsLogged, boost::bind(
+ &CEvntWriterWorker::OnCmdReadNumberOfEventsLogged, this, _1) }, {
+ eThrdCmdUploadEventLog, boost::bind(
+ &CEvntWriterWorker::OnCmdUploadEventLog, this, _1) } };
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedAttachParentCallbacksToDispatcher(
+ hThread, aParentHandlers, _countof(aParentHandlers)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: parent call backs attach failed , err code: %d", l_eStatus);
+ }
+
+ // TO DO replace the queue name with macro EVENTLOG_MSGQ_NAME, after NS delivers it.
+ if (NULL != (g_hReceive = McOpenReceiverNotBlocked("/EvntLogQue"))) {
+ if (NULL
+ == (g_hEvtLogTimer = FrameworkunifiedAttachTimerCallback(hThread, 100, 1000,
+ ReadEventLogQueue))) {
+ LOG_ERROR("FrameworkunifiedAttachTimerCallback()");
+ }
+ } else {
+ LOG_ERROR("McOpenReceiverNotBlocked");
+ }
+
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus ReadEventLogQueue(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ CHAR source[MAX_QUEUE_NAME_SIZE];
+ UI_32 l_cmd = 0;
+ UI_8 pbuf[MAX_QUEUE_MSG_SIZE];
+
+ if (NULL != g_hReceive) { // LCOV_EXCL_BR_LINE 6: g_hReceive is always null
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ while (1) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = McReceive(g_hReceive, source, &l_cmd,
+ MAX_QUEUE_MSG_SIZE,
+ pbuf))) {
+ break;
+ } else {
+ switch (l_cmd) {
+ case SS_MSG_EVTLOG:
+ if (pObj) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = pObj->OnCmdEventLog(pbuf))) {
+ LOG_ERROR("OnCmdEventLog()");
+ }
+ } else {
+ LOG_ERROR("pObj NULL");
+ }
+ break;
+
+ case SS_MSG_LOGGERCNT:
+ if (pObj) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = pObj->OnCmdIncrcount(pbuf))) {
+ LOG_ERROR("OnCmdIncrcount()");
+ }
+ } else {
+ LOG_ERROR("pObj NULL");
+ }
+ break;
+
+ case SS_MSG_LOGGER_CNT_EVTLOG:
+ if (pObj) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = pObj->OnCmdIncrwriteevent(pbuf))) {
+ LOG_ERROR("OnCmdIncrwriteevent()");
+ }
+ } else {
+ LOG_ERROR("pObj NULL");
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ LOG_ERROR("Receive Handle NULL"); // LCOV_EXCL_BR_LINE 15:macro
+ }
+
+ if (eFrameworkunifiedStatusErrNoEAGAIN == l_eStatus) { // LCOV_EXCL_BR_LINE 6: l_eStatus is always eFrameworkunifiedStatusOK
+ l_eStatus = eFrameworkunifiedStatusOK; // LCOV_EXCL_LINE 6: l_eStatus is always eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////
+/// Function :EvntWriterWorkerOnStart
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus EvntWriterWorkerOnStart(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hThread, (PVOID) &wi, sizeof(wi), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Unable to read handle from FrameWork Thread.%d", eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Successfully read handle from FrameWork Thread.\n"); // LCOV_EXCL_BR_LINE 15:macro
+ }
+
+ // Device Detection Obj initialization
+ if (m_device_detector_obj.Initialize(hThread)) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ memset(&gSUSBDevInfo, 0, sizeof(gSUSBDevInfo));
+ memset(&gSSDCardevInfo, 0, sizeof(gSSDCardevInfo));
+
+ if (eFrameworkunifiedStatusOK != (eStatus = m_device_detector_obj.NotifyOnDeviceDetectionAvailability( DD_USBServiceAvailabilityCallBack))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: ServiceAvailabilityCallback registration failed");
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = m_device_detector_obj.NotifyOnOpenSessionAck( DD_USBOpenSessionAckCallBack))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: OpenSessionAckCallback registration failed");
+ }
+
+ if (eFrameworkunifiedStatusOK != (eStatus = m_device_detector_obj.NotifyOnCloseSessionAck( DD_USBCloseSessionAckCallBack))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: CloseSessionCallback registration failed");
+ }
+ } else {
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Device Detection Object Initialization failed!");
+ // LCOV_EXCL_STOP
+ }
+
+ if (pObj) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ FrameworkunifiedSetThreadSpecificData(hThread, pObj);
+ if (eFrameworkunifiedStatusOK != (eStatus = pObj->Initialize(hThread))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: CEvntWriterWorker Initialize Failed");
+ }
+ } else {
+ // LCOV_EXCL_START 200:As it is always TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pObj is NULL");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :EvntWriterWorkerOnStop
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus EvntWriterWorkerOnStop(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ if (pObj) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ if (NULL != g_hEvtLogTimer) { // LCOV_EXCL_BR_LINE 200:As it is always NULL
+ // LCOV_EXCL_START 200:As it is always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CALL_AND_LOG_STATUS(FrameworkunifiedDetachTimerCallback(hThread, g_hEvtLogTimer));
+ g_hEvtLogTimer = NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ /// To Read all msgs of EventLog queue on shutdown
+ CALL_AND_LOG_STATUS(ReadEventLogQueue(hThread)); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ /// Close ReadEventLog Queue receive handle
+ if (NULL != g_hReceive) { // LCOV_EXCL_BR_LINE 200:As it is always NULL
+ // LCOV_EXCL_START 200:As it is always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CALL_AND_LOG_STATUS(McClose(g_hReceive));
+ g_hReceive = NULL;
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdIncrcount_phase
+///////////////////////////////////////////////////////////////////////
+VOID CEvntWriterWorker::OnCmdIncrcount_phase(st_LogCount *cnt) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ if (NULL != cnt) {
+ EStatCounterGroupID group;
+ UI_16 counterID = ((*cnt).cnt_id);
+ group = static_cast<EStatCounterGroupID>((counterID >> 8) & 0x00FF);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,
+ "Increment counter(%04X) for group(%02X) by one", counterID, group);
+ counterIncrementByValue(group, counterID, 0x01u);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "Function call without parameter");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdIncrcount
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdIncrcount(UI_8 *pbuf) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ st_LogCount cnt;
+
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = McGetDataOfSize(pbuf, (PVOID) &cnt, sizeof(cnt)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "call increment function cnt.phase=%x,cnt.ID=%x", cnt.phase,
+ cnt.cnt_id);
+ OnCmdIncrcount_phase(&cnt);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "Not recieved data from q");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdIncrwriteevent
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdIncrwriteevent(UI_8* pbuf) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ st_LogEvent EC;
+ st_LogEvent_ss ev = { };
+ st_LogCount C;
+
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = McGetDataOfSize(pbuf, (PVOID) &EC, sizeof(EC)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "Successful increment");
+ ev.event_id = EC.event_id;
+ ev.data[0] = EC.data[0];
+ ev.data[1] = EC.data[1];
+ ev.data[2] = EC.data[2];
+ ev.data[3] = EC.data[3];
+ OnCmdWriteEventLogs(&ev);
+ C.phase = (SystemPhase) (EC.phase);
+ C.cnt_id = EC.cnt_ID;
+ OnCmdIncrcount_phase(&C);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "Not recieved data from q");
+ }
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdWriteEventLogs
+///////////////////////////////////////////////////////////////////////
+VOID CEvntWriterWorker::OnCmdWriteEventLogs(st_LogEvent_ss *ev) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ UI_32 u32deque_size = 0;
+ u32deque_size = static_cast<UI_32>(deque_event_info.size());
+ u32deque_size = u32deque_size * SINGLE_EVENT_INFO_SIZE; // Existing Event Info size
+ u32deque_size += SINGLE_EVENT_INFO_SIZE;
+ // FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Deque size before write:%X ",u32deque_size);
+
+ if (u32deque_size > MAX_EVENTLOG_SIZE) {
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Deque size will be exceeded after new event:%X ",u32deque_size);
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Removed the oldest event and add latest event in the the end");
+ deque_event_info.pop_front();
+ u32deque_size = static_cast<UI_32>(deque_event_info.size());
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Deque size after pop:%X ",(u32deque_size*SINGLE_EVENT_INFO_SIZE));
+ }
+ deque_event_info.push_back(*ev);
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Deque size after write:%X ",
+// (deque_event_info.size()*SINGLE_EVENT_INFO_SIZE));
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+UI_32 LS_ConvertEndian(UI_32 * pvar) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ UI_32 retVal = (UI_32) 0;
+ UI_32 var = *pvar;
+ retVal = (((var & 0xFF000000) >> 24) | ((var & 0x00FF0000) >> 8)
+ | ((var & 0x0000FF00) << 8) | ((var & 0x000000FF) << 24));
+ return (retVal);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdEventLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdEventLog(UI_8* pbuf) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+ st_LogEvent_ss ev = { };
+ st_LogEvent_full ev_full = { };
+ UI_32 l_mileage;
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = McGetDataOfSize(pbuf, &ev_full, sizeof(ev_full)))) {
+ if (0 != ev_full.grp_ID) {
+ if (0x01 == ev_full.grp_ID) {
+ // copied to local var as m_u32MileageData value is persisted
+ l_mileage = m_u32MileageData;
+ ev.ts = LS_ConvertEndian(&l_mileage);
+ } else {
+ ev.ts = ev_full.ts;
+ }
+ ev.grp_ID = ev_full.grp_ID;
+ ev.event_id = ev_full.event_id;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "TS %u, GRPID %d, EVTID %d", ev.ts,
+ ev.grp_ID, ev.event_id);
+ // FRAMEWORKUNIFIEDLOG_EVT(Zone,EventId,4,data0,data1,data2,data3)
+ // Data in tool should be represented in Little Endian format means data3(MSB)..data0(LSB)
+ // In the COMMON_DATA, 1st element of structure u_stEvtLoggerCommonInfo is stored in the CommonData[0],
+ // ie BodayCAN_Stat,
+ // in the data array, byte0=>MSB, byte3=>LSB in the tool
+ if (ev_full.typeofdata == COMMON_DATA) {
+ for (UI_8 j = 0; j < 3; j++) {
+ ev.data[j] = g_uEvtLoggerCommonInfo.CommonData[j];
+ }
+ // byte0 param
+ ev.data[3] = ev_full.data[0];
+ } else {
+ // in array data[0] => MSB in tool, data[3] => LSB in the tool
+ for (UI_8 i = 4, j = 0; i > 0 && j < 4; i--, j++) {
+ ev.data[i - 1] = ev_full.data[j];
+ }
+ }
+ OnCmdWriteEventLogs(&ev);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Invalid event");
+ }
+ }
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdStop
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdStop(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdStart(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :read_count_from_file
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::readCountFromFile(PCSTR filename) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_32 counter_ID = 0;
+ UI_32 counter_val = 0;
+ FILE* fp;
+ if (filename != NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Open counter file:%s", filename);
+ if (NULL != (fp = ::fopen(filename, "r"))) {
+ while (!feof(fp)) {
+ EStatCounterGroupID group;
+ UI_8 groupID;
+ UI_8 count = static_cast<UI_8>(::fscanf(fp, "%04X%08X", &counter_ID, &counter_val));
+ groupID = (counter_ID >> 8) & 0xFF;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Read: 0x%04X 0x%08X", counter_ID,
+ counter_val);
+ if ((count == 2u)
+ && (groupID >= static_cast<UI_8>(STARTUP_SHUTDOWN_COUNTER_GROUP))
+ && (groupID <= static_cast<UI_8>(APP_USAGE_COUNTER_GROUP))) {
+ // Check if group is valid before casting it o EStatCounterGroup
+ group = static_cast<EStatCounterGroupID>(groupID);
+ counterIncrementByValue(group, static_cast<UI_16>(counter_ID), counter_val);
+ }
+ }
+ ::fclose(fp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Normal File failed to open");
+ eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Filename is NULL-pointer");
+ eStatus = eFrameworkunifiedStatusAccessError;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus CEvntWriterWorker::writeGroupToFile(FILE *fp,
+ EStatCounterGroupID group) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ if (fp != NULL) {
+ CounterInformation::iterator countInfIt = counter.find(group);
+ if (countInfIt != counter.end()) {
+ Counter count = countInfIt->second;
+ if (!count.empty()) {
+ Counter::iterator countIt;
+ for (countIt = count.begin(); countIt != count.end(); ++countIt) {
+ ::fprintf(fp, "%04X%08X\n", countIt->first, countIt->second);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Written %d entries for Group 0x%02X",
+ (UI_8)count.size(), (UI_8)group);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Group 0x%02X is empty", (UI_8)group);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Group not found in map");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Parameter fp is NULL-pointer");
+ eStatus = eFrameworkunifiedStatusAccessError;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :writeCountToFile
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::writeCountToFile(PCSTR filename) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FILE *fp;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CounterInformation::iterator countInfIt;
+ if (0 == strcmp(filename, Counter_LOG_PATH_FN)) {
+ if (NULL != (fp = ::fopen(filename, "w"))) {
+ for (countInfIt = counter.begin(); countInfIt != counter.end();
+ ++countInfIt) {
+ (void) writeGroupToFile(fp, countInfIt->first);
+ }
+ ::fclose(fp);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Not valid file");
+ eStatus = eFrameworkunifiedStatusErrNoEBADF;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :read_events_from_buffer
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+VOID CEvntWriterWorker::read_events_from_buffer(
+ STEventLogPersistBuffer* f_pstEvtLogBuf) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ deque_event_info.clear();
+ for (int i = 0; i < (f_pstEvtLogBuf->Current_Log_Size); i++) {
+ if (i < f_pstEvtLogBuf->EVT_BUFMAXSIZE) {
+ deque_event_info.push_back(f_pstEvtLogBuf->EvtLog_Buffer[i]);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: EventLog buffer size greater than EVT_BUFMAXSIZE");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Size of DEQUE event is :%d",
+ static_cast<int>(deque_event_info.size()));
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :write_events_to_buffer
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+VOID CEvntWriterWorker::write_events_to_buffer(
+ STEventLogPersistBuffer* f_pstEvtLogBuf) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ st_LogEvent_ss l_event_info;
+ DEQUE_Event_Type::iterator deque_it;
+ deque_it = deque_event_info.begin();
+ int i = 0;
+
+ memset(f_pstEvtLogBuf, 0x00, sizeof(STEventLogPersistBuffer));
+ while (deque_it != deque_event_info.end()) {
+ if (0x00 != deque_it->grp_ID) {
+ l_event_info.ts = deque_it->ts;
+ l_event_info.grp_ID = deque_it->grp_ID;
+ l_event_info.event_id = deque_it->event_id;
+ memcpy(l_event_info.data, deque_it->data, sizeof(l_event_info.data));
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__,"Event record is:%X ",++EventRecordCnt);
+ if (i < f_pstEvtLogBuf->EVT_BUFMAXSIZE) {
+ memcpy(&f_pstEvtLogBuf->EvtLog_Buffer[i], &l_event_info,
+ sizeof(l_event_info));
+ }
+ }
+ deque_it++;
+ i++;
+ }
+ f_pstEvtLogBuf->Current_Log_Size = static_cast<UI_16>(deque_event_info.size());
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Size of DEQUE event is :%d",
+ static_cast<int>(deque_event_info.size()));
+// FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :write_event_to_file
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::write_event_to_file(const CHAR* filename) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_32 u32File_Size;
+ st_LogEvent_ss Sevent_Info;
+ DEQUE_Event_Type::iterator deque_it;
+ FILE *fp;
+
+ if (NULL != (fp = ::fopen(filename, "wb"))) {
+ deque_it = deque_event_info.begin();
+ while (deque_it != deque_event_info.end()) {
+ Sevent_Info.ts = deque_it->ts;
+ Sevent_Info.grp_ID = deque_it->grp_ID;
+ Sevent_Info.event_id = deque_it->event_id;
+ memcpy(Sevent_Info.data, deque_it->data, sizeof(Sevent_Info.data));
+
+ if (0x00 != deque_it->grp_ID) {
+ if (SIZE_1
+ != (u32File_Size = static_cast<UI_32>(::fwrite(&Sevent_Info, sizeof(Sevent_Info), 1,
+ fp)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Writing in to file is failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ }
+ deque_it++;
+ }
+ ::fclose(fp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: File failed to open");
+ eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdClearEventLogs
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdClearEventLogs(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSessionData l_stSessionData;
+ TClearEvntLogCmdResponse l_stCmdResponse;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TSessionData>(hThread,
+ l_stCmdResponse.stSessiondata))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ deque_event_info.clear();
+ if (eFrameworkunifiedStatusOK != (l_eStatus = immediate_persist_event_log(hThread))) {
+ l_stCmdResponse.u8Response = (UI_8) CLEAR_EVENT_LOG_FAILED;
+ } else {
+ l_stCmdResponse.u8Response = (UI_8) CLEAR_EVENT_LOG_SUCCESS;
+ }
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread, eThrdCmdClearEventLogResponse,
+ sizeof(TClearEvntLogCmdResponse),
+ &l_stCmdResponse))) {
+ LOG_ERROR("FrameworkunifiedSendParent()");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP 8
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdSetVIN
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdSetVIN(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ STVIN_NUMBER l_stVIN_Number;
+
+ if (eFrameworkunifiedStatusOK
+ == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hThread, &l_stVIN_Number,
+ sizeof(l_stVIN_Number), eSMRRelease))) {
+ memcpy(&m_stVINnumber, &l_stVIN_Number, sizeof(STVIN_NUMBER));
+ }
+
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdGetVIN
+///////////////////////////////////////////////////////////////////////
+VOID CEvntWriterWorker::OnCmdGetVIN(STVIN_NUMBER& f_stVIN_Number) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memcpy(&f_stVIN_Number, &m_stVINnumber, sizeof(STVIN_NUMBER));
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdWriteEventFilesToUsb
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdWriteEventFilesToUsb(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TWriteFilesToUsbCmdData l_stCmdData;
+ TWriteFilesToUsbCmdResponse l_stCmdResponse;
+
+ TThrdEvtLogStore evt = { };
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TWriteFilesToUsbCmdData>(hThread, l_stCmdData))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if ((USB0 == l_stCmdData.eDevId) || (USB1 == l_stCmdData.eDevId)) {
+ memcpy(&evt, &gSUSBDevInfo[l_stCmdData.eDevId], sizeof(TThrdEvtLogStore));
+ } else if (SD == l_stCmdData.eDevId) {
+ memcpy(&evt, &gSSDCardevInfo, sizeof(TThrdEvtLogStore));
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ LOG_ERROR("Invalid DeviceId()");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "USB dev info:Available %d, Location %s, Parse %s ",
+ evt.IsDeviceAvailable, evt.parse_fn, evt.location);
+ l_stCmdResponse.u8Response = copy_event_files_to_usb(&evt);
+ l_stCmdResponse.stSessiondata.strSrcName = l_stCmdData.stSessiondata.strSrcName;
+ l_stCmdResponse.stSessiondata.session_id = l_stCmdData.stSessiondata.session_id;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread, eThrdCmdCopyEventLogUSBResponse,
+ sizeof(TWriteFilesToUsbCmdResponse),
+ &l_stCmdResponse))) {
+ LOG_ERROR("FrameworkunifiedSendParent()");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdReadStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdReadStatisticalCounter(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SStatisticalCounter buffer = { 0 };
+ TStatisticalCntCmdSuccessResp l_stCmdSuccessResp;
+
+ if (hThread != NULL) {
+ TStatisticalCountersCmd l_stCmdData;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TStatisticalCountersCmd>(hThread, l_stCmdData))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadStatisticalCounter(l_stCmdData.eGroupId, buffer))) {
+ LOG_ERROR("ReadStatisticalCounter()");
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread,
+ eThrdCmdStatisticalCounterErrorResp,
+ sizeof(TSessionData),
+ &l_stCmdData.stSessiondata))) {
+ LOG_ERROR("FrameworkunifiedSendParent()");
+ }
+ } else {
+ (VOID) memcpy(&l_stCmdSuccessResp.stBuffer, &buffer,
+ sizeof(SStatisticalCounter));
+ (VOID) memcpy(&l_stCmdSuccessResp.stSessiondata,
+ &l_stCmdData.stSessiondata, sizeof(TSessionData));
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread,
+ eThrdCmdStatisticalCounterSuccessResp,
+ sizeof(TStatisticalCntCmdSuccessResp),
+ &l_stCmdSuccessResp))) {
+ LOG_ERROR("FrameworkunifiedSendParent()");
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :ReadStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus CEvntWriterWorker::ReadStatisticalCounter(
+ EStatCounterGroupID eCounterGroup, SStatisticalCounter& buffer) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_32 size = 0u;
+
+ CounterInformation::iterator countInfIt = counter.find(eCounterGroup);
+ if (counter.end() != countInfIt) {
+ Counter count = countInfIt->second;
+ Counter::iterator countIt;
+ if (((UI_16) count.size()) <= 40) {
+ for (countIt = count.begin(); countIt != count.end(); ++countIt) {
+ UI_16 counterID = countIt->first;
+ UI_32 counterVal = countIt->second;
+ u16copy(&buffer.StatisticalCountBuffer[size], counterID);
+ size += static_cast<UI_16>( sizeof(counterID));
+
+ counterVal = countIt->second;
+ u32copy(&buffer.StatisticalCountBuffer[size], counterVal);
+ size += static_cast<UI_16>( sizeof(counterVal));
+ }
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldBuf;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Too many counter elements %02d > 42 ", static_cast<int>(count.size()));
+ }
+ } else {
+ /*OK, here: empty buffer will be returned*/
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdResetStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdResetStatisticalCounter(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TStatisticalCountersCmd l_stCmdData;
+
+ if (hThread != NULL) {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TStatisticalCountersCmd>(hThread, l_stCmdData))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ResetStatisticalCounter(l_stCmdData.eGroupId))) {
+ LOG_ERROR("ResetStatisticalCounter()");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+///////////////////////////////////////////////////////////////////////
+/// Function :ResetStatisticalCounter
+///////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus CEvntWriterWorker::ResetStatisticalCounter(
+ EStatCounterGroupID eCounterGroup) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ CounterInformation::iterator countInfIt;
+ countInfIt = counter.find(eCounterGroup);
+ if (counter.end() != countInfIt) {
+ countInfIt->second.clear();
+ counter.erase(countInfIt->first);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Erased group: 0x%02X from map",
+ (UI_8)eCounterGroup);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldID;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :_GetCurrentTimeString
+///////////////////////////////////////////////////////////////////////
+PSTR _GetCurrentTimeString(PCHAR TempFileName, PSTR f_pstrVIN) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ uint32_t rawtime;
+ uint8_t status;
+ struct tm local_time;
+ CHAR tbuf[30];
+ UI_8 l_len = 0;
+ std::string l_strVIN = f_pstrVIN;
+
+ // Time string is based on current date and time. Time string format is <year-mon-dayThhmm>.
+ Clock_getSystemTimeY2K38(&rawtime, &status);
+ Clock_getLocalTimeY2K38(&rawtime, &local_time);
+ if (0
+ != (l_len = static_cast<UI_8>(strftime(tbuf, sizeof(tbuf), "%Y-%m-%dT%H%M",
+ &local_time)))) {
+ sprintf(TempFileName, "%s_%s_%04X.dat", l_strVIN.c_str(), tbuf, // NOLINT (runtime/printf)
+ g_u16DiagId);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "EventLog File Name :%s, tbuf_len = %d",
+ TempFileName, l_len);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return TempFileName;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :copy_event_files_to_usb
+///////////////////////////////////////////////////////////////////////
+UI_8 CEvntWriterWorker::copy_event_files_to_usb(TThrdEvtLogStore *pStUSBIndo) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ CHAR buffer[10];
+ CHAR TempFileName[MAX_SYS_INFO_SIZE];
+ STVIN_NUMBER l_stVIN_Number;
+ std::string _filename("");
+ UI_8 u8Result = COPY_EVT_USB_SUCCESS;
+
+ // Initializing all Char arrays.
+ memset(buffer, 0, 10);
+ memset(TempFileName, 0, MAX_SYS_INFO_SIZE);
+
+ if (pStUSBIndo->IsDeviceAvailable == TRUE) {
+ _filename = pStUSBIndo->location;
+ OnCmdGetVIN(l_stVIN_Number);
+ _filename += _GetCurrentTimeString(TempFileName, l_stVIN_Number.VINstr);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = write_event_to_file(_filename.c_str()))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Write to file failed:%d",
+ l_eStatus);
+ u8Result = (UI_8) USB_DEVICE_WRITE_ERROR;
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Device not available, so event logs can not be copied");
+ u8Result = (UI_8) USB_DEVICE_NOT_AVAILABLE;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+ return u8Result;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :DD_USBSrvDetectionCallBack
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus DD_USBSrvDetectionCallBack(HANDLE hApp) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
+
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ SS_MediaDetectInfo tMediaDetectInfo = { };
+ std::string FilePathStr;
+ UI_8 u8Pos = 0;
+
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tMediaDetectInfo,
+ sizeof(tMediaDetectInfo)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "MediaDetectCallBack FrameworkunifiedGetMsgDataOfSize Failed Status:0x%x ",
+ eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Device = %d", tMediaDetectInfo.dev_type);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Availability = %d",
+ tMediaDetectInfo.bIsDeviceAvailable);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " device path = %s",
+ tMediaDetectInfo.deviceMountpath);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " File path = %s",
+ tMediaDetectInfo.filepathName);
+
+ FilePathStr.append(tMediaDetectInfo.deviceMountpath);
+
+ if (tMediaDetectInfo.dev_type == eUSB) {
+ if (tMediaDetectInfo.bIsDeviceAvailable == TRUE) {
+ u8Pos = static_cast<UI_8>(FilePathStr.find_last_of("/\\"));
+
+ if (FilePathStr.compare(u8Pos + 1, 12, "usb-00-d0-p0") == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB1 Detected ");
+ gSUSBDevInfo[0].IsDeviceAvailable = TRUE;
+ snprintf(gSUSBDevInfo[0].parse_fn, gSUSBDevInfo[0].FN_LEN, "%s/",
+ FilePathStr.c_str());
+ snprintf(gSUSBDevInfo[0].location, gSUSBDevInfo[0].FN_LEN, "%s/",
+ FilePathStr.c_str());
+ } else if (FilePathStr.compare(u8Pos + 1, 12, "usb-01-d0-p0") == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB2 Detected ");
+ gSUSBDevInfo[1].IsDeviceAvailable = TRUE;
+ snprintf(gSUSBDevInfo[1].parse_fn, gSUSBDevInfo[1].FN_LEN, "%s/",
+ FilePathStr.c_str());
+ snprintf(gSUSBDevInfo[1].location, gSUSBDevInfo[1].FN_LEN, "%s/",
+ FilePathStr.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB Detected :%s", FilePathStr.c_str());
+ }
+ } else {
+ u8Pos = static_cast<UI_8>(FilePathStr.find_last_of("/\\"));
+
+ if (FilePathStr.compare(u8Pos + 1, 12, "usb-00-d0-p0") == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB1 Ejected ");
+ gSUSBDevInfo[0].IsDeviceAvailable = FALSE;
+ } else if (FilePathStr.compare(u8Pos + 1, 12, "usb-01-d0-p0") == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB2 Ejected ");
+ gSUSBDevInfo[1].IsDeviceAvailable = FALSE;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "USB Ejected :%s", FilePathStr.c_str());
+ }
+ }
+
+ } else if (tMediaDetectInfo.dev_type == eSD) {
+ if (tMediaDetectInfo.bIsDeviceAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SD card Detected ");
+ gSSDCardevInfo.IsDeviceAvailable = TRUE;
+ snprintf(gSSDCardevInfo.parse_fn, gSSDCardevInfo.FN_LEN, "%s/",
+ FilePathStr.c_str());
+ snprintf(gSSDCardevInfo.location, gSSDCardevInfo.FN_LEN, "%s/",
+ FilePathStr.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SD card Ejected ");
+ gSSDCardevInfo.IsDeviceAvailable = FALSE;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
+
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+//////////////////////////////////////////
+// Function : DD_USBServiceAvailabilityCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus DD_USBServiceAvailabilityCallBack(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (FrameworkunifiedIsServiceAvailable(hThread)) {
+ if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE:200 Because the IF of DetectionService is guaranteed to be successful
+ != (eStatus = m_device_detector_obj.OpenSessionRequest())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Open session request failed");
+ }
+ } else {
+ if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE:200 Because the IF of DetectionService is guaranteed to be successful
+ != (eStatus = m_device_detector_obj.CloseSessionRequest())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Close session request failed");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : DD_USBOpenSessionAckCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus DD_USBOpenSessionAckCallBack(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = // LCOV_EXCL_BR_LINE:200 Because the IF of DetectionService is guaranteed to be successful
+ m_device_detector_obj.DecodeOpenSessionResponse())) {
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = m_device_detector_obj.RegisterForDeviceDetectionEvent( // LCOV_EXCL_BR_LINE:200 Because the IF of DetectionService is guaranteed to be successful // NOLINT[whitespace/line_length]
+ SS_DEV_DETECT_ANY_USB_EV, DD_USBSrvDetectionCallBack))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Registration for SS_DEV_DETECT_ANY_USB_EV failed");
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = m_device_detector_obj.RegisterForDeviceDetectionEvent( // LCOV_EXCL_BR_LINE:200 Because the IF of DetectionService is guaranteed to be successful // NOLINT[whitespace/line_length]
+ SS_DEV_DETECT_ANY_SD_EV, DD_USBSrvDetectionCallBack))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Registration for SS_DEV_DETECT_ANY_SD_EV failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Decode open session response failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+//////////////////////////////////////////
+// Function : DD_USBCloseSessionAckCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus DD_USBCloseSessionAckCallBack(HANDLE hApp) { // LCOV_EXCL_START 200: CloseSessionRequest can not be called // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CloseSessionAck tCloseSessionAck = { };
+
+ if (hApp) {
+ if (eFrameworkunifiedStatusOK
+ == (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tCloseSessionAck,
+ sizeof(tCloseSessionAck)))) {
+ if (eFrameworkunifiedStatusOK == tCloseSessionAck.eStatus) {
+ UI_32 l_uiSessionId = tCloseSessionAck.sessionId;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "session %d closed successfully",
+ l_uiSessionId);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: dead code
+EFrameworkunifiedStatus CEvntWriterWorker::counterIncrementByValue(EStatCounterGroupID group,
+ UI_16 id, UI_32 value) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus result = eFrameworkunifiedStatusFail;
+ CounterInformation::iterator count_inf_it;
+ count_inf_it = counter.find(group);
+ if (counter.end() == count_inf_it) {
+ Counter newCounter;
+ newCounter.insert(std::pair<UI_16, UI_32>(id, value));
+ counter.insert(std::pair<EStatCounterGroupID, Counter>(group, newCounter));
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "Added new Counter for group %d, id: 0x%04X, value: 0x%08X",
+ (UI_8)group, id, value);
+ } else {
+ Counter::iterator count_it;
+ count_it = count_inf_it->second.find(id);
+ if (count_inf_it->second.end() == count_it) {
+ count_inf_it->second.insert(std::pair<UI_16, UI_32>(id, value));
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "Added new Entry for group %d, id: 0x%04X, value: 0x%08X",
+ (UI_8)group, id, value);
+ } else {
+ if (count_it->second != MAX_CNT_VALUE) {
+ count_it->second += value;
+ }
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_FUNC,
+ __FUNCTION__,
+ "Modified Entry for group %d, id: 0x%04X, by value: 0x%08X, new value: 0x%08X",
+ (UI_8)group, id, value, count_it->second);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return result;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CEvntWriterWorker::immediate_persist_event_log(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ STEventLogPersistBuffer* l_evtlogbuf;
+ l_evtlogbuf = new (std::nothrow) STEventLogPersistBuffer;
+
+ if (NULL != l_evtlogbuf) {
+ if (pObj) {
+ pObj->write_events_to_buffer(l_evtlogbuf);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: CEvntWriterWorker Object handle is NULL");
+ }
+ delete l_evtlogbuf;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: New failed to allocate memory, err: %s", strerror(errno));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CEvntWriterWorker::EvtThd_SetMileage(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_u32mileage;
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hThread, &l_u32mileage,
+ sizeof(l_u32mileage)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize Failed Status:%d ",
+ l_eStatus);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ m_u32MileageData = l_u32mileage;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :write_mileage_to_file
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::write_mileage_to_file(const CHAR* filename) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ UI_32 u32File_Size;
+ SI_32 fd = -1;
+
+ if (-1 != (fd = ::open(filename, O_WRONLY | O_CREAT | O_TRUNC,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP))) {
+ if (SIZE_0
+ >= (u32File_Size = static_cast<UI_32>(::write(fd, &m_u32MileageData, sizeof(UI_32))))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Writing in to file is failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+ ::close(fd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: File failed to open");
+ eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :read_mileage_from_file
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::read_mileage_from_file(const CHAR* filename) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+// UI_32 u32File_Size;
+ SI_32 fd = -1;
+
+ if (NULL != filename) {
+ if (-1 != (fd = ::open(filename, O_RDONLY, S_IRUSR))) {
+ if (-1 == ::read(fd, &m_u32MileageData, sizeof(UI_32))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Reading file failed, %s",
+ strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "m_u32MileageData = %d",
+ m_u32MileageData);
+ }
+ ::close(fd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: File failed to open");
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Filename is NULL");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdReadNumberOfEventsLogged
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdReadNumberOfEventsLogged(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TEvntsLogged l_stEventsLogged;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TSessionData>(hThread,
+ l_stEventsLogged.stSessiondata))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ l_stEventsLogged.u16numberofeventslogged = (UI_16) deque_event_info.size();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Number of Events Read: %d",
+ l_stEventsLogged.u16numberofeventslogged);
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread,
+ eThrdCmdNumberOfEventsLoggedResponse,
+ sizeof(TEvntsLogged), &l_stEventsLogged))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Error: FrameworkunifiedSendMsg failed %d", l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdUploadEventLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdUploadEventLog(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<TSessionData>(
+ hThread, m_stUploadEventLogResp.stSessiondata))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (pObj) {
+ pObj->write_events_to_buffer(&m_stUploadEventLogResp.stEventLogBuffer);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendParent(hThread, eThrdCmdUploadEventLogResponse,
+ sizeof(TUploadEventLogResp),
+ &m_stUploadEventLogResp))) {
+ LOG_ERROR("FrameworkunifiedSendParent()");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: CEvntWriterWorker Object handle is NULL");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////
+/// Function :OnCmdCopyEvntLogToTmp
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CEvntWriterWorker::OnCmdCopyEvntLogToTmp(HANDLE hThread) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/systemservice/logger_service/server/src/mem_reader.cpp b/video_in_hal/systemservice/logger_service/server/src/mem_reader.cpp
new file mode 100755
index 0000000..5ad6a6c
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/mem_reader.cpp
@@ -0,0 +1,125 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports reading from a shared mem area.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/reader/mem_reader.h"
+#include <string>
+
+namespace ReaderWriter {
+
+CMemReader::CMemReader()
+ : m_pSharedBuf(NULL),
+ m_sharedBufSize(0) {
+}
+
+CMemReader::~CMemReader() {
+ this->Close();
+}
+
+EFrameworkunifiedStatus CMemReader::Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+ m_sharedBufSize = f_maxSize;
+ m_pSharedBuf = new (std::nothrow) CNSSharedMemReader(f_name, TRUE); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ if (NULL != m_pSharedBuf) { // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ l_eStatus = this->Open();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CMemReader::Open(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+ if (NULL != m_pSharedBuf) { // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_pSharedBuf will noe be null
+ if (!m_pSharedBuf->IsOpen()) {
+ // maps the shared memory buffer
+ l_eStatus = m_pSharedBuf->Open();
+ } else {
+ // Already opened no action required
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return l_eStatus;
+}
+
+BOOL CMemReader::IsOpen(void) {
+ return this->m_pSharedBuf->IsOpen();
+}
+
+EFrameworkunifiedStatus CMemReader::Read(UI_8* f_data, UI_32 f_length, SI_32& f_bytesRead) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (this->m_pSharedBuf != NULL) {
+ if (TRUE != this->m_pSharedBuf->IsOpen()) {
+ l_eStatus = m_pSharedBuf->Open();
+ }
+ if (l_eStatus == eFrameworkunifiedStatusOK) {
+ f_bytesRead = m_pSharedBuf->Read(reinterpret_cast<char *>(f_data), f_length);
+ if (NS_SHM_ERROR != f_bytesRead) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CMemReader::ReadToFile(std::string f_fileName, UI_32& f_Written) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ if ((NULL != m_pSharedBuf) && // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_pSharedBuf will noe be null
+ (f_fileName.length() != 0)) {
+ l_eStatus = m_pSharedBuf->DumpToFile(f_fileName.c_str(), &f_Written);
+ }
+
+ return l_eStatus;
+}
+
+void CMemReader::Close(void) {
+ if (NULL != m_pSharedBuf) { // LCOV_EXCL_BR_LINE 6: m_pSharedBuf can not be null
+ // un-map the shared memory object
+ (void) m_pSharedBuf->Close();
+
+ delete m_pSharedBuf;
+ m_pSharedBuf = NULL;
+ }
+}
+
+EFrameworkunifiedStatus CMemReader::ResetPosition(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNullPointer;
+ if (NULL != m_pSharedBuf) { // LCOV_EXCL_BR_LINE 6:Because m_pSharedBuf is always NULL
+ // un-map the shared memory object
+ l_eStatus = m_pSharedBuf->SetReadPtrToWritePtr();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_pSharedBuf->SetReadPtrToWritePtr();"); // LCOV_EXCL_BR_LINE 15:Macro
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+} // namespace ReaderWriter
diff --git a/video_in_hal/systemservice/logger_service/server/src/mod_version.c b/video_in_hal/systemservice/logger_service/server/src/mod_version.c
new file mode 100755
index 0000000..0594b74
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/mod_version.c
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_LogTraceSender
+/// \brief This file supports logging module version identification.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <native_service/frameworkunified_types.h>
+
+#define MOD_VERSION_LENGTH 12
+
+static CHAR s_ModVersion[MOD_VERSION_LENGTH + 1] = "0.0.0";
+
+SI_8 GetModuleVersion (CHAR* pRetBuf, UI_8 nBufLen)
+{ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ UI_8 CopyLen = 0;
+ SI_8 RetVal = -1;
+
+ if (NULL != pRetBuf)
+ {
+ CopyLen = MIN_VAL(nBufLen, MOD_VERSION_LENGTH);
+ strncpy(pRetBuf, s_ModVersion, CopyLen);
+ pRetBuf[CopyLen] = '\0';
+ RetVal = 0;
+ }
+ return RetVal;
+}
+// LCOV_EXCL_STOP 8: dead code
+
diff --git a/video_in_hal/systemservice/logger_service/server/src/queue_reader.cpp b/video_in_hal/systemservice/logger_service/server/src/queue_reader.cpp
new file mode 100755
index 0000000..6c056c3
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/queue_reader.cpp
@@ -0,0 +1,101 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/reader/queue_reader.h"
+#include <string>
+
+namespace ReaderWriter {
+CQueueReader::CQueueReader()
+ : m_handle(-1),
+ m_queName("") { // LCOV_EXCL_BR_LINE 11:except,C++ STL
+}
+
+CQueueReader::~CQueueReader() {
+ if (this->IsOpen()) {
+ this->Close();
+ }
+}
+
+EFrameworkunifiedStatus CQueueReader::Initialize(CLoggerCfg* f_pLoggerCfg,
+ std::string f_name, UI_32 f_maxSize) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+ if (f_pLoggerCfg != NULL) { // LCOV_EXCL_BR_LINE 6:Because the applicable variable cannot be changed from the external API
+ this->m_pLoggerCfg = f_pLoggerCfg;
+ // Check for invalid name
+ if (f_name.length() != 0) { // LCOV_EXCL_BR_LINE 6:it can not be 0
+ m_queName = f_name;
+ l_eStatus = this->Open();
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CQueueReader::Open(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+
+ if (-1 != m_handle) { // LCOV_EXCL_BR_LINE 6:Because m_handle is always -1
+ // Queue already opened, no action required.
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (m_queName.length() != 0) { // LCOV_EXCL_BR_LINE 6:Because m_queName is not always an empty string
+ const UI_32 MAX_MESSAGES_STORED_IN_QUEUE = 512;
+ struct mq_attr mqattr;
+ mqattr.mq_flags = 0;
+ mqattr.mq_maxmsg = MAX_MESSAGES_STORED_IN_QUEUE;
+ mqattr.mq_msgsize = MAX_QUEUE_MSG_SIZE;
+
+ this->m_handle = mq_open(m_queName.c_str(), O_RDONLY | O_CREAT, 0666,
+ &mqattr);
+ if (-1 != m_handle) { // LCOV_EXCL_BR_LINE 5:mq_open cannot be passed because it cannot be turned mock
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+BOOL CQueueReader::IsOpen(void) {
+ return (-1 != m_handle) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 6:Because the condition cannot be set
+}
+
+EFrameworkunifiedStatus CQueueReader::Read(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesRead) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ if (this->m_handle != -1) { // LCOV_EXCL_BR_LINE 6:Because the condition cannot be set
+ if (f_length <= MAX_QUEUE_MSG_SIZE) { // LCOV_EXCL_BR_LINE 6:Because the applicable variable cannot be changed from the external API
+ f_bytesRead = static_cast<SI_32>(mq_receive(this->m_handle, reinterpret_cast<char *>(f_data),
+ (size_t) MAX_QUEUE_MSG_SIZE, NULL));
+
+ if ((0 <= f_bytesRead) && ((UI_32) f_bytesRead <= f_length)) { // LCOV_EXCL_BR_LINE 6:Because the condition cannot be set
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ return (l_eStatus);
+}
+
+void CQueueReader::Close(void) {
+ if (this->m_handle != -1) { // LCOV_EXCL_BR_LINE 200: m_handle is aways not -1
+ (void) mq_close(this->m_handle);
+ }
+}
+} // namespace ReaderWriter
diff --git a/video_in_hal/systemservice/logger_service/server/src/reader.cpp b/video_in_hal/systemservice/logger_service/server/src/reader.cpp
new file mode 100755
index 0000000..04880f0
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/reader.cpp
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/reader/reader.h"
+#include <string>
+#include <new>
+#include <iostream>
+#include "readerWriter/reader/queue_reader.h"
+#include "readerWriter/reader/mem_reader.h"
+#include "ss_logger_cfg.h"
+namespace ReaderWriter {
+CReader::CReader()
+ : m_pLoggerCfg(NULL) {
+}
+
+CReader::~CReader() {
+}
+
+CReader* CReader::OpenReader(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
+ std::string f_name, UI_32 f_maxSize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CReader* l_ret = NULL;
+ if (f_pLoggerCfg != NULL) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ if (f_name.length() != 0) { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
+ switch (f_type) { // LCOV_EXCL_BR_LINE 200:As it must be eReaderWriterTypeQueue or eReaderWriterTypeMem
+ case eReaderWriterTypeFile:
+ break;
+
+ case eReaderWriterTypeQueue:
+ l_ret = new (std::nothrow) CQueueReader(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ break;
+
+ case eReaderWriterTypeMem:
+ l_ret = new (std::nothrow) CMemReader(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ break;
+
+ default:
+ break;
+ }
+ }
+ if (NULL != l_ret) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ if (eFrameworkunifiedStatusOK != l_ret->Initialize(f_pLoggerCfg, f_name, f_maxSize)) {
+ delete (l_ret);
+ l_ret = NULL;
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_ret;
+}
+
+
+EFrameworkunifiedStatus CReader::ReadToFile(std::string f_fileName, UI_32& f_Written) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNotImplemented;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CReader::ResetPosition(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNotImplemented;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+} // namespace ReaderWriter
diff --git a/video_in_hal/systemservice/logger_service/server/src/reader_writer.cpp b/video_in_hal/systemservice/logger_service/server/src/reader_writer.cpp
new file mode 100755
index 0000000..ef32384
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/reader_writer.cpp
@@ -0,0 +1,282 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/reader_writer.h"
+#include <errno.h>
+#include <loggerservicedebug_loggerservicelog.h>
+#include <system_service/ss_templates.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <string>
+
+namespace ReaderWriter {
+
+CReaderWriter::CReaderWriter()
+ : m_pLoggerCfg(NULL),
+ m_reader(NULL),
+ m_writer(NULL),
+ m_running(FALSE),
+ m_thread(-1),
+ m_readerName(""),
+ m_paused(FALSE) {
+
+ pthread_cond_init(&m_condVariable, NULL);
+}
+
+CReaderWriter::~CReaderWriter() { // LCOV_EXCL_START 14:global instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (NULL != this->m_reader) {
+ delete (this->m_reader);
+ this->m_reader = NULL;
+ }
+
+ if (NULL != this->m_writer) {
+ delete (this->m_writer);
+ this->m_writer = NULL;
+ }
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CReaderWriter::Initialize(CLoggerCfg* f_pLoggerCfg,
+ EReaderType f_readerType,
+ std::string f_readerName,
+ UI_32 f_readerMaxSize,
+ EWriterType f_writerType,
+ std::string f_writer1Name,
+ UI_32 f_writer1MaxSize,
+ std::string f_writer2Name,
+ UI_32 f_writer2MaxSize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (NULL == (this->m_pLoggerCfg = f_pLoggerCfg)) { // LCOV_EXCL_BR_LINE 6:Because the applicable variable cannot be changed from the external API
+ // FRAMEWORKUNIFIEDLOG not needed... If this starts we won't be able to print loggerservicelogs anyways.
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ } else {
+ this->m_reader = CReader::OpenReader(f_pLoggerCfg, f_readerType, // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ f_readerName, f_readerMaxSize);
+ this->m_writer = CWriter::OpenWriter(f_pLoggerCfg, f_writerType, // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ f_writer1Name, f_writer1MaxSize,
+ f_writer2Name, f_writer2MaxSize);
+
+ if ((NULL == this->m_reader) || (NULL == this->m_writer)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+
+ this->Cleanup(this);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CReaderWriter::Start(std::string f_readerName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNullPointer;
+ if (this->m_running == FALSE) { // LCOV_EXCL_BR_LINE 6:Because m_running is always FALSE
+ this->m_readerName = f_readerName;
+ BOOL l_barInit =
+ // LCOV_EXCL_BR_START 5:pthread cannot be passed because it cannot be turned mock
+ (EOK == pthread_barrier_init(&m_barrier, NULL, 2)) ? TRUE : FALSE;
+ if (l_barInit) {
+ // LCOV_EXCL_BR_STOP
+ pthread_attr_t attr;
+ struct sched_param params;
+ pthread_attr_init(&attr);
+ pthread_attr_getschedparam(&attr, &params);
+ SI_32 prio = frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(
+ f_readerName);
+ if (-1 != prio) { // LCOV_EXCL_BR_LINE 6:Because prio is always -1
+ // LCOV_EXCL_START 6:Because the prio is not always -1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ params.sched_priority = prio;
+ pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
+ pthread_attr_setschedparam(&attr, &params);
+ // LCOV_EXCL_STOP
+ }
+
+ if (EOK == pthread_create(&m_thread, &attr, &CReaderWriter::ThreadFunctionWrapper, this)) { // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock // NOLINT[whitespace/line_length]
+ this->m_running = TRUE;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ pthread_barrier_wait(&this->m_barrier); /* Wait for thread to take off*/
+ }
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+void* CReaderWriter::ThreadFunctionWrapper(void* param) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CReaderWriter* l_pObj = reinterpret_cast<CReaderWriter *>(param);
+
+ l_pObj->ThreadFunction(l_pObj);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. ThreadFunction has exited");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return NULL;
+}
+
+void CReaderWriter::ThreadFunction(CReaderWriter* l_pObj) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int l_oldState;
+
+ pthread_setname_np(pthread_self(), this->m_readerName.c_str());
+ pthread_cleanup_push(&CReaderWriter::CleanupWrapper, this);
+ pthread_mutex_init(&m_writeMutex, NULL);
+ pthread_mutex_init(&m_pauseMutex, NULL);
+ int l_wait = pthread_barrier_wait(&m_barrier);
+
+ if ((eFrameworkunifiedStatusOK == l_eStatus)
+ // LCOV_EXCL_BR_START 5:pthread cannot be passed because it cannot be turned mock
+ && (((PTHREAD_BARRIER_SERIAL_THREAD == l_wait) || (0 == l_wait)))) {
+ // LCOV_EXCL_BR_STOP
+ UI_8 data[MAX_QUEUE_MSG_SIZE + 1];
+ while (TRUE) {
+ if (TRUE == this->m_paused) {
+ if (EOK == pthread_mutex_lock(&this->m_pauseMutex)) { // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock
+ (void)pthread_cond_wait(&m_condVariable, &m_pauseMutex); // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock
+ (void) pthread_mutex_unlock(&this->m_pauseMutex); // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock
+ }
+ }
+ if (!this->m_reader->IsOpen() || !this->m_writer->IsOpen()) { // LCOV_EXCL_BR_LINE 6:As it is not always open
+ (void)this->m_reader->Open(); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ (void)this->m_writer->Open(); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+
+ if (!this->m_reader->IsOpen() || !this->m_writer->IsOpen()) {
+
+// ->Reduced frequency of accesses to IsOpen()
+ usleep(1000*1000); // LCOV_EXCL_BR_LINE 5:C function
+ } else {
+ while ((eFrameworkunifiedStatusOK == l_eStatus) && (FALSE == this->m_paused)) {
+ SI_32 l_bytesRead = -1;
+ SI_32 l_bytesWritten = -1;
+ l_eStatus = this->m_reader->Read(data,
+ MAX_QUEUE_MSG_SIZE,
+ l_bytesRead); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
+ &l_oldState);
+ if (EOK == pthread_mutex_lock(&this->m_writeMutex)) { // LCOV_EXCL_BR_LINE 5: c code error case
+ l_eStatus = this->m_writer->Write(data,
+ (UI_32) l_bytesRead,
+ l_bytesWritten);
+ (void) pthread_mutex_unlock(&this->m_writeMutex);
+ }
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,
+ &l_oldState);
+ }
+ }
+ l_eStatus = eFrameworkunifiedStatusOK; // Reset l_eStatus
+ }
+ }
+ }
+
+ pthread_cleanup_pop(1);
+}
+
+
+void CReaderWriter::CleanupWrapper(void* param) {
+ CReaderWriter* l_pObj = reinterpret_cast<CReaderWriter *>(param);
+
+ l_pObj->Cleanup(l_pObj);
+}
+
+void CReaderWriter::Cleanup(CReaderWriter* l_pObj) {
+
+// (void) pthread_mutex_unlock(&this->m_pauseMutex);
+// (void) pthread_mutex_unlock(&this->m_writeMutex);
+
+
+ if (this->m_reader != NULL) { // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_reader can not be null
+ delete (this->m_reader);
+ this->m_reader = NULL;
+ }
+ if (this->m_writer != NULL) { // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_writer can not be null
+ delete (this->m_writer);
+ this->m_writer = NULL;
+ }
+ this->m_running = FALSE;
+}
+
+EFrameworkunifiedStatus CReaderWriter::FlushCache(std::string f_filename) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (TRUE == this->m_pLoggerCfg->IsLoggingEnabled()) { // LCOV_EXCL_BR_LINE 6: it can not be false
+ if (EOK == pthread_mutex_lock(&this->m_writeMutex)) { // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock
+ if (this->m_writer != NULL) { // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_writer can not be null
+ l_eStatus = this->m_writer->FlushCache();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "this->m_writer->FlushCache()")
+ }
+ (void) pthread_mutex_unlock(&this->m_writeMutex);
+ }
+
+ UI_32 l_written;
+ if (NULL != this->m_reader) { // LCOV_EXCL_BR_LINE 6:Because it depends on the startup process
+ l_eStatus = this->m_reader->ReadToFile(f_filename, l_written);
+ /*Don't output error, if function not implemented*/
+ l_eStatus =
+ (l_eStatus == eFrameworkunifiedStatusNotImplemented) ? eFrameworkunifiedStatusOK : l_eStatus;
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "this->m_reader->ReadToFile(f_filename, l_written)");
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CReaderWriter::UpdateLoggingParameters(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (EOK == pthread_mutex_lock(&this->m_writeMutex)) { // LCOV_EXCL_BR_LINE 5:pthread cannot be passed because it cannot be turned mock
+ if (this->m_writer != NULL) {
+ l_eStatus = this->m_writer->UpdateLoggingParameters();
+ }
+ (void) pthread_mutex_unlock(&this->m_writeMutex);
+ }
+ BOOL l_enabled = this->m_pLoggerCfg->IsLoggingEnabled();
+ if ((this->m_paused == FALSE) && (FALSE == l_enabled)) {
+ this->Pause();
+ } else if ((this->m_paused == TRUE) && (TRUE == l_enabled)) {
+ this->Resume();
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : %d", l_eStatus);
+ return (l_eStatus);
+}
+
+void CReaderWriter::Pause(void) {
+ (void) pthread_mutex_lock(&this->m_pauseMutex);
+ this->m_paused = TRUE;
+
+ (void) pthread_mutex_unlock(&this->m_pauseMutex);
+}
+
+void CReaderWriter::Resume(void) {
+ (void) pthread_mutex_lock(&this->m_pauseMutex);
+ if (this->m_reader != NULL) { // LCOV_EXCL_BR_LINE 5: new will aways sucess, so m_reader can not be null
+ (void) this->m_reader->ResetPosition();
+ }
+ pthread_cond_signal(&m_condVariable);
+ this->m_paused = FALSE;
+ (void) pthread_mutex_unlock(&this->m_pauseMutex);
+}
+} // namespace ReaderWriter
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_cfg.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_cfg.cpp
new file mode 100755
index 0000000..b353bbe
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_cfg.cpp
@@ -0,0 +1,754 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief Provide support for CPU high load monitor configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_cfg.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <boost/bind.hpp>
+#include <native_service/nslogutil_cmd_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <system_service/ss_logger_service_notifications.h>
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <string>
+#include <algorithm>
+#include <vector>
+
+const static UI_32 cMAX_EMMC_COUNTER_VALUE = 100000u; // NOLINT (build/storage_class)
+///////////////////////////////////////////////////////////////////////////////
+// CLASS METHODS
+///////////////////////////////////////////////////////////////////////////////
+
+CLoggerCfg::CLoggerCfg()
+ : m_logMaxFileSize(0),
+ m_performanceLogMaxFileSize(0),
+ m_emmcOutputMax(0),
+ m_emmcOutputErrMax(0),
+ m_emmcOutputGrpRelaunchMax(0),
+ m_emmcOutputNaviLogMax(0),
+ m_emmcOutputNaviLogNmlMax(0),
+ m_emmcOutputNaviLogErrMax(0),
+ m_emmcOutputPath(""),
+ m_emmcOutputNaviLogPath(""),
+ m_usb0MountPath(""),
+ m_usb1MountPath(""),
+ m_sdMountPath(""),
+ m_eDevType(eDevUSB1),
+ m_UserInvokedLoggingNumber(1u),
+ m_EmmcCounter(0u),
+ m_eLoggerUDPLoggingStatus(eDeactivate),
+ m_eLoggerStatus(SS_LOGGER_DEFAULT_VALUE) {
+ m_udpEnvFlag = FALSE;
+ std::memset(m_logMask, 0, sizeof(m_logMask));
+ std::memset(&m_ExternalLogList, 0, sizeof(&m_ExternalLogList));
+ }
+
+CLoggerCfg::~CLoggerCfg(void) { // LCOV_EXCL_START 14:global instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ if (m_ExternalLogList.p_info != NULL) {
+ delete[] m_ExternalLogList.p_info;
+ m_ExternalLogList.p_info = NULL;
+ }
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerCfg::Initialize(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ char* l_udp_env = getenv("UDPLOGS_ON");
+ m_udpEnvFlag = (
+ l_udp_env == NULL ?
+ FALSE : (strcmp("TRUE", l_udp_env) == 0 ? TRUE : FALSE));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+EFrameworkunifiedStatus CLoggerCfg::SetandPersistLoggingParams(HANDLE f_hApp,
+ STLoggerSetAllParams f_Params,
+ BOOL f_InitCall) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_paramChanged = f_InitCall;
+ BOOL l_updateLoggerState = f_InitCall;
+
+ if ((TRUE == l_paramChanged) // LCOV_EXCL_BR_LINE 200:l_paramChanged is never TRUE
+ ||
+ (m_eLoggerStatus != f_Params.Logger_State)
+ || // LCOV_EXCL_BR_LINE 200:Because m_UserInvokedLoggingNumber != f_Params.Log_FolderCnt is never false
+ (m_UserInvokedLoggingNumber != f_Params.Log_FolderCnt)
+ || (m_eLoggerUDPLoggingStatus != f_Params.Logger_UDPState)
+ || (m_eDevType != f_Params.Device_Type)) {
+ l_paramChanged = TRUE;
+ } else {
+ l_paramChanged = FALSE;
+ }
+
+ l_updateLoggerState =
+ ((l_updateLoggerState == TRUE)
+ || (m_eLoggerStatus != f_Params.Logger_State)) ? TRUE : FALSE;
+
+ // After startup Logging will be set to default value
+ if (TRUE == f_InitCall) { // LCOV_EXCL_BR_LINE 200:f_InitCall is never TRUE
+ // LCOV_EXCL_START 200:f_InitCall is never TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ m_eLoggerStatus = SS_LOGGER_DEFAULT_VALUE;
+ // LCOV_EXCL_STOP
+ } else {
+ m_eLoggerStatus = f_Params.Logger_State;
+ }
+ m_eLoggerUDPLoggingStatus = f_Params.Logger_UDPState;
+ m_UserInvokedLoggingNumber = f_Params.Log_FolderCnt;
+ m_eDevType = f_Params.Device_Type;
+
+ if (TRUE == l_paramChanged) {
+ l_eStatus = PersistLoggingParam(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: macro
+ "PersistLoggingParam()");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::SetLoggingParams(HANDLE f_hApp,
+ const STLoggerSetParams f_stLoggerSetParams) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ STLoggerSetAllParams l_Params;
+
+ l_Params.Logger_UDPState = m_eLoggerUDPLoggingStatus;
+ l_Params.Log_FolderCnt = m_UserInvokedLoggingNumber;
+ l_Params.Logger_State = f_stLoggerSetParams.Logger_State;
+ l_Params.Device_Type = f_stLoggerSetParams.Device_Type;
+
+ l_eStatus = SetandPersistLoggingParams(f_hApp, l_Params, FALSE);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SetandPersistLoggingParams()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::SetUDPLogging(HANDLE f_hApp,
+ const ELOGGER_STAT f_eUDPLoggingStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ STLoggerSetAllParams l_Params;
+
+ l_Params.Logger_UDPState = f_eUDPLoggingStatus;
+ l_Params.Log_FolderCnt = m_UserInvokedLoggingNumber;
+ l_Params.Logger_State = m_eLoggerStatus;
+ l_Params.Device_Type = m_eDevType;
+
+ l_eStatus = SetandPersistLoggingParams(f_hApp, l_Params, FALSE);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SetandPersistLoggingParams()"); // LCOV_EXCL_BR_LINE 15: macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::PersistLoggingParam(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO, __FUNCTION__,
+ "LoggerState = %d, Device_Type = %d,UDPLogging = %d, TriggerNumber = %d",
+ m_eLoggerStatus, m_eDevType, m_eLoggerUDPLoggingStatus,
+ m_UserInvokedLoggingNumber); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ this->UpdateLoggingStatus();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+void CLoggerCfg::RemoveCarriageReturn(std::string &f_str) {
+ if (f_str.empty()) { // LCOV_EXCL_BR_LINE 8: Because there is no empty string case
+ return;
+ }
+
+ if ('\r' == f_str.at(f_str.size() - 1)) {
+ f_str.erase(f_str.size() - 1, 1);
+ }
+}
+EFrameworkunifiedStatus CLoggerCfg::Load(const std::string &f_filePathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+
+ if ("" == f_filePathAndName) { // LCOV_EXCL_BR_LINE 200: Because there is no empty string case
+ // LCOV_EXCL_START 200: Because there is no empty string case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Invalid configuration file name detected.");
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Reading Configuration Data from %s", f_filePathAndName.c_str());
+
+ CNSConfigReader *l_pReaderCfg = new CNSConfigReader(); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (NULL == l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5:new error
+ // LCOV_EXCL_START 5:new error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Unable to allocate CNSConfigReader object.");
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(f_filePathAndName))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->Parse(%s) returned: 0x%X",
+ f_filePathAndName.c_str(), l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.LogMaxFileSize", m_logMaxFileSize))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(LOGGING.LogMaxFileSize)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.PerformanceLogSize", m_performanceLogMaxFileSize))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(LOGGING.LogMaxFileSize)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("LOGGING.EmmcOutputPath", m_emmcOutputPath))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.EmmcOutputPath)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("LOGGING.EmmcOutputNaviLogPath", m_emmcOutputNaviLogPath))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputNaviLogPath)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("LOGGING.Usb0MountPath", m_usb0MountPath))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.Usb0MountPath)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("LOGGING.Usb1MountPath", m_usb1MountPath))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.Usb1MountPath)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("LOGGING.SdMountPath", m_sdMountPath))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.SdMountPath)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputMax", m_emmcOutputMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.EmmcOutputMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputErrMax", m_emmcOutputErrMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputErrMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputGrpRelaunchMax", m_emmcOutputGrpRelaunchMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputGrpRelaunchMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputNaviLogMax", m_emmcOutputNaviLogMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputNaviLogMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputNaviLogNmlMax", m_emmcOutputNaviLogNmlMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputNaviLogNmlMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.EmmcOutputNaviLogErrMax", m_emmcOutputNaviLogErrMax))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus,
+ "l_pReaderCfg->GetString(LOGGING.EmmcOutputNaviLogErrMax)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetString("STORAGE.ThreadName", m_loggerStorageInfo.Name))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(STORAGE.ThreadName)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("STORAGE.Priority", m_loggerStorageInfo.Priority))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(STORAGE.Priority)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("STORAGE.Timeout", m_loggerStorageInfo.Timeout))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(STORAGE.Timeout)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("STORAGE.TimeoutAfter", m_loggerStorageInfo.TimeoutAfter))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetInt(STORAGE.TimeoutAfter)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogNum", m_ExternalLogList.num))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.ExternalLogNum)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt("LOGGING.ExternalLogMax", m_ExternalLogList.max))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(LOGGING.ExternalLogMax)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ } else {
+ RemoveCarriageReturn(m_emmcOutputPath);
+ RemoveCarriageReturn(m_emmcOutputNaviLogPath);
+ RemoveCarriageReturn(m_usb0MountPath);
+ RemoveCarriageReturn(m_usb1MountPath);
+ RemoveCarriageReturn(m_sdMountPath);
+ RemoveCarriageReturn(m_loggerStorageInfo.Name);
+
+ for (UI_32 i = 0; i < ZONE_MASK_ARRAY_ELTS; i++) {
+ SI_32 l_logMaskTemp;
+ std::stringstream l_cfgParamName;
+
+ l_cfgParamName << "SETLOGMASK.MASK" << i;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->GetInt(l_cfgParamName.str(), l_logMaskTemp))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->GetInt(%s) failed with error: %d.",
+ l_cfgParamName.str().c_str(), l_eStatus);
+
+ break;
+ // LCOV_EXCL_STOP
+ } else {
+ m_logMask[i] = (UI_32) l_logMaskTemp;
+ }
+ }
+
+ m_EELStorageRelPath = "/EEL_export";
+ m_EELActivateRelPath = "/EEL_activate";
+ m_LoggerserviceEmmcLogsRelPath = "/LOGGERSERVICE_EMMC_LOGS";
+
+ if (m_ExternalLogList.num > 0) {
+ std::string str = "EXTERNAL_"; // LCOV_EXCL_BR_LINE 11:Excluded due to gcov constraints (others)
+ UI_32 num = 0;
+
+ if (m_ExternalLogList.num <= m_ExternalLogList.max) {
+ num = m_ExternalLogList.num;
+ } else {
+ num = m_ExternalLogList.max;
+ }
+
+ // LCOV_EXCL_BR_START 11:Excluded due to gcov constraints (others)
+ m_ExternalLogList.p_info = new ExternalLogInfo[num];
+
+ // Load external log info
+ for (UI_32 i = 0; i < num; i++) {
+ std::string query = str + std::to_string(i+1);
+ if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetString((query+".OutputPath"), m_ExternalLogList.p_info[i].dirname))) {
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(EXTERNAL.OutputPath)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetString((query+".ExtLogPath"), m_ExternalLogList.p_info[i].path))) {
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetString(EXTERNAL.ExtLogPath)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ } else if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = l_pReaderCfg->GetBool((query+".Remove"), m_ExternalLogList.p_info[i].remove))) {
+ LOG_STATUS(l_eStatus, "l_pReaderCfg->GetBool(EXTERNAL.Remove)"); // LCOV_EXCL_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ } else {
+ RemoveCarriageReturn(m_ExternalLogList.p_info[i].dirname);
+ RemoveCarriageReturn(m_ExternalLogList.p_info[i].path);
+ }
+ }
+ // LCOV_EXCL_BR_STOP 11:Excluded due to gcov constraints (others)
+ } else {
+ // None external log
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Configuration successfully loaded."); // LCOV_EXCL_BR_LINE 15: macro
+ }
+ }
+
+ delete l_pReaderCfg; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::Validate(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+
+ if (m_logMaxFileSize == 0) { // LCOV_EXCL_BR_LINE 200:Because the size is never 0
+ // LCOV_EXCL_START 200:Because the size is never 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected. LogMaxFileSize: %d Must be > 0.",
+ m_logMaxFileSize);
+ // LCOV_EXCL_STOP
+ } else if (m_emmcOutputPath == "") {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected."
+ " EmmcOutputPath: %s Must be a valid path containing a trailing backslash.",
+ m_emmcOutputPath.c_str());
+ } else if (m_emmcOutputNaviLogPath == "") { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
+ // LCOV_EXCL_START 200:Because it is not always an empty string
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected."
+ " EmmcOutputNaviLogPath: %s Must be a valid path containing a trailing backslash.",
+ m_emmcOutputNaviLogPath.c_str());
+ // LCOV_EXCL_STOP
+ } else if (m_usb0MountPath == "") { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
+ // LCOV_EXCL_START 200:Because it is not always an empty string
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected."
+ " Usb0MountPath: %s Must be a valid path containing a trailing backslash.",
+ m_usb0MountPath.c_str());
+ // LCOV_EXCL_STOP
+ } else if (m_usb1MountPath == "") { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
+ // LCOV_EXCL_START 200:Because it is not always an empty string
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected."
+ " Usb1MountPath: %s Must be a valid path containing a trailing backslash.",
+ m_usb1MountPath.c_str());
+ // LCOV_EXCL_STOP
+ } else if (m_sdMountPath == "") { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
+ // LCOV_EXCL_START 200:Because it is not always an empty string
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Invalid configuration detected. SdMountPath: %s Must be a valid path containing a trailing backslash.",
+ m_sdMountPath.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+void CLoggerCfg::Print(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+std::string CLoggerCfg::getEmmcOutputPath(void) {
+ return (m_emmcOutputPath);
+}
+
+std::string CLoggerCfg::getEmmcOutputNaviLogPath(void) {
+ return (m_emmcOutputNaviLogPath);
+}
+
+std::string CLoggerCfg::getUsb0MountPath(void) {
+ return (m_usb0MountPath);
+}
+void CLoggerCfg::setUsb0MountPath(std::string& f_deviceMountpath) {
+ m_usb0MountPath = f_deviceMountpath;
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetUserInvokedDestination(std::string& f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ f_dest = "";
+ switch (m_eDevType) {
+ case eDevUSB1:
+ f_dest = m_usb0MountPath;
+ break;
+
+ case eDevUSB2:
+ f_dest = m_usb1MountPath;
+ break;
+
+ case eDevSD:
+ f_dest = m_sdMountPath;
+ break;
+
+ case eTotalDevicesTypes:
+ case eInvalid_DevType:
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Unknown device type: %d",
+ m_eDevType);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetEmmcDestination(std::string& f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ f_dest = m_emmcOutputPath;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetEmmcNaviLogDestination(std::string& f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ f_dest = m_emmcOutputNaviLogPath;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+UI_32 CLoggerCfg::GetUserInvokedCounter(void) {
+ return m_UserInvokedLoggingNumber;
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetIncrementAndPersistUserInvokedCounter(
+ HANDLE f_hApp, UI_32 &f_counter) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ f_counter = m_UserInvokedLoggingNumber;
+ m_UserInvokedLoggingNumber++;
+ l_eStatus = PersistLoggingParam(f_hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetAndIncrementEmmcCounter(UI_32 &f_counter) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_checkFileName;
+ std::vector<UI_32> l_vector;
+ DIR *l_dirp;
+ struct dirent l_dirent;
+ struct dirent* next = NULL;
+ size_t l_pos;
+ UI_32 l_count;
+ UI_32 l_maxCount;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (m_EmmcCounter == 0u) {
+ l_maxCount = 0;
+ l_dirp = opendir(m_emmcOutputPath.c_str());
+ if (l_dirp != NULL) { // LCOV_EXCL_BR_LINE 5: m_emmcOutputPath is not null, opendir is C code, always ok
+ for (;;) {
+ int l_ret = readdir_r(l_dirp, &l_dirent, &next);
+ if (((l_ret == 0) && (next == NULL))
+ || (l_ret > 0)) {
+ break;
+ }
+ l_checkFileName = l_dirent.d_name;
+ l_pos = l_checkFileName.find(".tar.gz");
+ if (std::string::npos != l_pos) {
+ l_pos = l_checkFileName.find("_");
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 200: tar.gz file is aways has "_"
+ std::string l_numberString = l_checkFileName.substr(0, l_pos);
+ l_count = static_cast<UI_32>(strtoul(l_numberString.c_str(), NULL, 10));
+ l_vector.push_back(l_count);
+ l_maxCount = std::max(l_count, l_maxCount);
+ }
+ }
+ }
+ closedir(l_dirp);
+ } else {
+ // LCOV_EXCL_START 5: m_emmcOutputPath is not null, opendir is C code, always ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ f_counter = 1;
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+
+ // reach at max number
+ if (l_maxCount >= LOGGERSERVICELOG_EMMC_COUNTER_MAX) {
+ RefreshEmmcCounter(m_EmmcCounter);
+ } else {
+ m_EmmcCounter = l_maxCount + 1;
+ }
+ } else if (m_EmmcCounter >= LOGGERSERVICELOG_EMMC_COUNTER_MAX) {
+ // reach at max number
+ RefreshEmmcCounter(m_EmmcCounter);
+ } else {
+ m_EmmcCounter++;
+ }
+
+ f_counter = m_EmmcCounter;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerCfg::RefreshEmmcCounter(UI_32& f_counter) const {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_checkFileName;
+ std::vector<std::string> l_vector;
+ DIR *l_dirp;
+ struct dirent l_dirent;
+ struct dirent* next = NULL;
+ size_t l_pos;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // get filename saved frameworkunifiedlog on eMMC Device
+ l_dirp = opendir(m_emmcOutputPath.c_str());
+ if (l_dirp != NULL) { // LCOV_EXCL_BR_LINE 5: m_emmcOutputPath is not null, opendir is C code, always ok
+ for (;;) {
+ int l_ret = readdir_r(l_dirp, &l_dirent, &next);
+ if (((l_ret == 0) && (next == NULL)) || (l_ret > 0)) {
+ break;
+ }
+ l_checkFileName = l_dirent.d_name;
+ l_pos = l_checkFileName.find(".tar.gz");
+ if (std::string::npos != l_pos) {
+ l_pos = l_checkFileName.find("_");
+ if (std::string::npos != l_pos) {
+ l_vector.push_back(l_checkFileName);
+ }
+ }
+ }
+ closedir(l_dirp);
+ } else {
+ // LCOV_EXCL_START 5: m_emmcOutputPath is not null, opendir is C code, always ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // ignore opendir failure. this means saved frameworkunifiedlog is nothing on eMMC Device
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open dir error path=%s errno=%s.",
+ m_emmcOutputPath.c_str(), strerror(errno));
+ f_counter = 1;
+ return eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+
+ // sort at log count
+ std::sort(l_vector.begin(), l_vector.end());
+
+ std::vector<std::string>::iterator it;
+ std::string l_orgFilePath;
+ std::string l_renameFilePath;
+ UI_32 l_wpt = 0;
+ UI_32 l_count;
+
+ it = l_vector.begin();
+ while (it != l_vector.end()) {
+ std::stringstream l_nameStream;
+ // get log counter parts
+ l_wpt++;
+ l_checkFileName = *it;
+ l_pos = l_checkFileName.find("_");
+ std::string l_numberString = l_checkFileName.substr(0, l_pos);
+ l_count = static_cast<UI_32>(strtoul(l_numberString.c_str(), NULL, 10));
+
+ // rename file if necessary
+ if (l_count != l_wpt) {
+ l_renameFilePath = l_orgFilePath = m_emmcOutputPath.c_str();
+ l_renameFilePath.append("/");
+ l_orgFilePath.append("/");
+ l_orgFilePath.append(l_checkFileName);
+
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right
+ << std::dec << l_wpt;
+ l_checkFileName.replace(0, l_pos, l_nameStream.str());
+
+ l_renameFilePath.append(l_checkFileName);
+
+ if (rename(l_orgFilePath.c_str(), l_renameFilePath.c_str()) != 0) { // LCOV_EXCL_BR_LINE 5: rename is C code
+ // LCOV_EXCL_START 5: rename is C code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // rename failed but continue reamin log rename because new log need to be saved.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "log file[%s]->[%s] rename failed: err=%s.",
+ l_orgFilePath.c_str(), l_renameFilePath.c_str(), strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+ it++;
+ }
+
+ f_counter = l_wpt + 1;
+
+ // set return value as next log counter
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+BOOL CLoggerCfg::IsUDPLoggingEnabled(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_ret =
+ ((this->m_eLoggerUDPLoggingStatus == eActivate)
+ || (this->m_udpEnvFlag == TRUE)) ? TRUE : FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : %s", (TRUE == l_ret)?"TRUE":"FALSE");
+ return (l_ret);
+}
+
+void CLoggerCfg::AddLoggingParamCB(CbFuncPtr f_fp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (f_fp != NULL) { // LCOV_EXCL_BR_LINE 6: it aways not be null
+ this->m_LoggingCallBack.push_back(f_fp);
+ (void) f_fp(NULL);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+void CLoggerCfg::UpdateLoggingStatus(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::vector<CbFuncPtr>::iterator l_iter;
+ for (l_iter = m_LoggingCallBack.begin(); l_iter != m_LoggingCallBack.end(); l_iter++) { // LCOV_EXCL_BR_LINE 11:Unexpected branch // NOLINT[whitespace/line_length]
+ (void) (*l_iter)(NULL);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus CLoggerCfg::GetLoggerStorageInfo(SLoggerStorageInfo &f_info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ f_info = m_loggerStorageInfo;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+BOOL CLoggerCfg::IsLoggingEnabled(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ return (this->m_eLoggerStatus == eActivate) ? TRUE : FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+ExternalLogList CLoggerCfg::GetExternalLogList(void) {
+ return (m_ExternalLogList);
+} // LCOV_EXCL_BR_LINE 10:the last line
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_device_detection.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_device_detection.cpp
new file mode 100755
index 0000000..04bc4b5
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_device_detection.cpp
@@ -0,0 +1,209 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_InterfaceunifiedLogCapture
+/// \brief This file supports USB logging threads.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+// System Headers
+#include <errno.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#ifdef AGL_STUB
+#else
+#include <sys/usbdi.h>
+#endif
+#include <limits.h>
+#include <string.h>
+#include <native_service/ns_message_center_if.h>
+#include <ss_logger_fs_directory.h>
+#include <boost/bind.hpp>
+
+// Pasa Logs
+#include <loggerservicedebug_loggerservicelog.h>
+#include <ss_logger_device_detection.h>
+#include <loggerservicedebug_thread_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_devicedetection_service_notifications.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <system_service/ss_sm_client_if.h>
+#include <string>
+#include "ss_logger_common.h"
+
+//
+const SI_32 INVALID_FD = -1;
+
+// Max command line length
+const UI_32 MAX_SYS_CMD_LN_LENGTH = 120;
+
+CLoggerDeviceDetection::CLoggerDeviceDetection() :
+ m_pLoggerCfg(NULL),
+ m_loggerUtil(NULL) {
+}
+
+CLoggerDeviceDetection::~CLoggerDeviceDetection() { // LCOV_EXCL_START 14:global instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerDeviceDetection::Initialize(HANDLE f_hApp, CLoggerCfg * f_pLoggerCfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ m_pLoggerCfg = f_pLoggerCfg;
+ // Device Detection Obj initialization
+ if (m_devDetect.Initialize(f_hApp)) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ if (eFrameworkunifiedStatusOK != (l_eStatus = m_devDetect.NotifyOnDeviceDetectionAvailability(
+ boost::bind(&CLoggerDeviceDetection::DD_ServiceAvailabilityCallBack, this, _1) ))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ServiceAvailabilityCallback registration failed");
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = m_devDetect.NotifyOnOpenSessionAck(
+ boost::bind(&CLoggerDeviceDetection::DD_OpenSessionAckCallBack, this, _1) ))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "OpenSessionAckCallback registration failed");
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = m_devDetect.NotifyOnCloseSessionAck(
+ boost::bind(&CLoggerDeviceDetection::DD_CloseSessionAckCallBack, this, _1) ))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CloseSessionCallback registration failed");
+ }
+ } else {
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Device Detection Object Initialization failed!");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+// Function : ServiceAvailabilityCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerDeviceDetection::DD_ServiceAvailabilityCallBack(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (FrameworkunifiedIsServiceAvailable(hApp)) {
+ if (eFrameworkunifiedStatusOK != (eStatus = m_devDetect.OpenSessionRequest())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Open session request failed");
+ }
+ } else {
+ if (eFrameworkunifiedStatusOK != (eStatus = m_devDetect.CloseSessionRequest())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Close session request failed");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : OpenSessionAckCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerDeviceDetection::DD_OpenSessionAckCallBack(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = m_devDetect.DecodeOpenSessionResponse())) {
+ if (eFrameworkunifiedStatusOK != (eStatus = m_devDetect.RegisterForDeviceDetectionEvent(SS_DEV_DETECT_ANY_USB_EV,
+ boost::bind(&CLoggerDeviceDetection::DD_MediaDetectCallBack, this, _1)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Registration for SS_DEV_DETECT_ANY_USB_EV failed");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Decode open session response failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+//////////////////////////////////////////
+// Function : OpenSessionAckCallBack
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerDeviceDetection::DD_CloseSessionAckCallBack(HANDLE hApp) { // LCOV_EXCL_START 200: can not called from devicedetection_service // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CloseSessionAck tCloseSessionAck;
+
+ if (hApp) {
+ if (eFrameworkunifiedStatusOK == (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tCloseSessionAck, sizeof (tCloseSessionAck)))) {
+ if (eFrameworkunifiedStatusOK == tCloseSessionAck.eStatus) {
+ UI_32 l_uiSessionId = tCloseSessionAck.sessionId;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "session %d closed successfully", l_uiSessionId);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerDeviceDetection::DD_CloseSessionWithDevDetectionSrv(HANDLE hApp) { // LCOV_EXCL_START 200: can not called from devicedetection_service // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK == (eStatus = m_devDetect.
+ NotifyOnCloseSessionAck(boost::bind(&CLoggerDeviceDetection::DD_CloseSessionAckCallBack, this, _1)))) {
+ if (eFrameworkunifiedStatusOK != (eStatus = m_devDetect.CloseSessionRequest())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to send CloseSessionRequest");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to register closeSessionAckCallback");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerDeviceDetection::DD_MediaDetectCallBack(HANDLE hApp) { // LCOV_EXCL_START 200: can not called from devicedetection_service // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_devstr;
+ std::string l_filePathStr;
+ SS_MediaDetectInfo l_tMediaDetectInfo;
+
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_tMediaDetectInfo, sizeof (l_tMediaDetectInfo)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "FrameworkunifiedGetMsgDataOfSize Failed Status:0x%x ", l_eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Device = %d", l_tMediaDetectInfo.dev_type);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Availability = %d", l_tMediaDetectInfo.bIsDeviceAvailable);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " device path = %s", l_tMediaDetectInfo.deviceMountpath);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " File path = %s", l_tMediaDetectInfo.filepathName);
+
+ if (l_tMediaDetectInfo.dev_type == eUSB) {
+ if (l_tMediaDetectInfo.bIsDeviceAvailable == TRUE && m_pLoggerCfg != NULL) {
+ std::string l_usbMountPath;
+ l_usbMountPath = l_tMediaDetectInfo.deviceMountpath;
+ m_pLoggerCfg->setUsb0MountPath(l_usbMountPath);
+ m_loggerUtil->SetUsbMountPath(l_usbMountPath);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event.cpp
new file mode 100755
index 0000000..6e82da7
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event.cpp
@@ -0,0 +1,1047 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_error_event.h"
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <boost/bind.hpp>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_client_names.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <stub/el_mem.h>
+#include <native_service/cl_process.h>
+#include <stub/Clock_API.h>
+#include <string>
+#include "loggerservicedebug_loggerservicelog.h"
+#include "loggerservicedebug_thread_if.h"
+#include "ss_logger_service_callbacks.h"
+#include "ss_logger_error_event_archive.h"
+#include "ss_logger_common.h"
+#include "ss_logger_types.h"
+#include "ss_logger_fs_directory.h"
+
+CErrorEvent::CErrorEvent()
+ : m_hApp(NULL),
+ m_bIsPrevEventCompleted(true),
+ m_errorEventNtfData(),
+ m_pLoggerCfg(NULL),
+ m_pReaderWriterControl(NULL),
+ m_ServiceName(""),
+ m_time(0),
+ m_currentEventTriggerNumber(0),
+ m_diagsessionhandle(NULL),
+ m_thrdEvntLogWriter(NULL),
+ m_sfd(-1) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+CErrorEvent::~CErrorEvent() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CErrorEvent::Initialize(HANDLE f_hApp, CLoggerCfg *f_pLoggerCfg,
+ CReaderWriterControl *f_pReaderWriterControl,
+ HANDLE f_thrdEvntLogWriter,
+ std::string f_strEvntLogQueWorkerName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ Timer *l_pTimer;
+
+ m_sfd = CL_ProcessInit();
+ if (m_sfd == -1) { // LCOV_EXCL_BR_LINE 8:Because the process initialization is guaranteed to be successful
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. m_sfd CL_ProcessInit() failed \n."); // LCOV_EXCL_LINE 8:Because the process initialization is guaranteed to be successful
+ }
+
+ SS_LoggerServerEvents l_errorEventStateEvents[] = {
+ SS_LOGGER_SCREENCAPTURE_EVT };
+
+ FrameworkunifiedProtocolCallbackHandler l_smCallbacks[] = {
+ // Logging Protocol Callbacks
+ { SS_SM_EVENT_ERROR_TO_SSL, boost::bind(&CErrorEvent::OnStartLogging,
+ this, _1) }, {
+ SS_SM_ERROR_EVENT_LOGGING_START_RSPN, boost::bind(
+ &CErrorEvent::OnLogStartResponse, this, _1) }, {
+ SS_SM_ERROR_EVENT_ARTIFACT_RSPN, boost::bind(
+ &CErrorEvent::OnArtifactResponse, this, _1) } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ FrameworkunifiedProtocolCallbackHandler l_selfCallbacks[] = {
+ // Logging Protocol Callbacks
+ { SS_LOGGER_ERROR_EVENT_ARTIFACT_REQ, boost::bind(
+ &CErrorEvent::OnArtifactRequest, this, _1) }, {
+ SS_SM_ERROR_EVENT_ARTIFACT_RSPN, boost::bind(
+ &CErrorEvent::OnArtifactResponse, this, _1) } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ FrameworkunifiedProtocolCallbackHandler l_requesterCallbacks[] = { {
+ SS_LOGGER_SCREENCAPTURE_EVT_ACK, boost::bind(
+ &CErrorEvent::OnObtainScreenShotResponse, this, _1) } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ FrameworkunifiedProtocolCallbackHandler l_storageThreadCallbacks[] = { {
+ eLoggerStorageThreadCmdOK, boost::bind(&CErrorEvent::OnStorageResponseOk,
+ this, _1) }, {
+ eLoggerStorageThreadCmdWriteFailed, boost::bind(
+ &CErrorEvent::OnStorageResponseWriteFailed, this, _1) }, {
+ eLoggerStorageThreadCmdNotFound, boost::bind(
+ &CErrorEvent::OnStorageResponseNotFound, this, _1) }, {
+ eLoggerStorageThreadCmdNoWritten, boost::bind(
+ &CErrorEvent::OnStorageResponseNoWritten, this, _1) } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ for (UI_32 i = 0; i < _countof(l_requesterCallbacks); i++) {
+ m_requesterCallbacksVec.push_back(l_requesterCallbacks[i]); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+
+ if (NULL == f_hApp) { // LCOV_EXCL_BR_LINE 6:As it is not always NULL
+ // LCOV_EXCL_START 6:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " Error. Argument f_hApp passed NULL pointer. Initialization failed.");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (m_thrdEvntLogWriter = f_thrdEvntLogWriter)) { // LCOV_EXCL_BR_LINE 6:As it is not always NULL
+ // LCOV_EXCL_START 6:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " Error. Argument f_hApp passed NULL pointer. Initialization failed.");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_errorEventCfg.Initialize(f_pLoggerCfg))) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_errorEventCfg.Initialize() returned: %d.", l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(f_hApp, SERVICE_LOGGER, l_selfCallbacks, _countof(l_selfCallbacks)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. FrameworkunifiedAttachCallbacksToDispatcher(SERVICE_SYSMANAGER) returned: %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(f_hApp, SERVICE_SYSMANAGER, l_smCallbacks, _countof(l_smCallbacks)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. FrameworkunifiedAttachCallbacksToDispatcher(SERVICE_SYSMANAGER) returned: %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedDefineStateEvents(f_hApp, &l_errorEventStateEvents, static_cast<UI_32>(_countof(l_errorEventStateEvents))))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. FrameworkunifiedDefineStateEvents(SS_LOGGER_SCREENCAPTURE_EVT) returned: %d",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (NULL == f_pLoggerCfg) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ // LCOV_EXCL_START 200:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. f_pLoggerCfg passed NULL pointer.");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_loggerPopups.Initialize(f_pLoggerCfg))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_loggerPopups.Initialize(f_pLoggerCfg) returned: %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (NULL == f_pReaderWriterControl) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ // LCOV_EXCL_START 200:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Argument f_pReaderWriterControl passed NULL pointer.");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_loggerStorage.Initialize(f_hApp, AppName, f_pLoggerCfg))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_loggerPopups.Initialize(f_pLoggerCfg) returned: %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher( f_hApp, ERROR_EVENT_STORAGE_QUEUE_NAME, l_storageThreadCallbacks, _countof(l_storageThreadCallbacks)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. FrameworkunifiedAttachCallbacksToDispatcher(ERROR_EVENT_STORAGE_QUEUE_NAME) returned: %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_loggerCanEvent.Initialize(f_pLoggerCfg))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_loggerCanEvent.Initialize() returned: %d.", l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ m_hApp = f_hApp;
+ m_pLoggerCfg = f_pLoggerCfg;
+ m_pReaderWriterControl = f_pReaderWriterControl;
+ l_eStatus = m_loggerUtil.Initialize(m_pLoggerCfg); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 5:macro
+ "CLoggerUtil::m_loggerUtil.Initialize(m_pLoggerCfg)");
+
+ l_pTimer = &m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN];
+ l_pTimer->Initialize(
+ f_hApp, SS_LOGGER_ERROR_EVENT_TIMER_ID_LOGGING_START_RSPN,
+ boost::bind(&CErrorEvent::OnLogStartResponseTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ l_pTimer = &m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN];
+ l_pTimer->Initialize(
+ f_hApp, SS_LOGGER_ERROR_EVENT_TIMER_ID_ARTIFACT_RESPONSE,
+ boost::bind(&CErrorEvent::OnArtifactResponseTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ m_ServiceName = "";
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : RegisterSessionErrorEvent
+// brief : Register session event. This function is called within the
+// context of the System Manager session acknowledgment handler.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::RegisterSessionErrorEvent(HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = FrameworkunifiedRegisterEvent(f_hSession, SS_SM_EVENT_ERROR_TO_SSL);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedRegisterEvent(SS_SM_EVENT_ERROR_TO_SSL)"); // LCOV_EXCL_BR_LINE 5:macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnOpenSession
+// brief : Called when a requester opens a session with SS_Logger
+// service. This function attaches error event callbacks
+// to the dispatcher with the source set to the requester.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnOpenSession(HANDLE f_hApp, PCSTR f_pRequesterName,
+ HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(f_hApp, f_pRequesterName,
+ &m_requesterCallbacksVec[0],
+ static_cast<UI_32>(m_requesterCallbacksVec.size()),
+ f_hSession);
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedAttachCallbacksToDispatcher(f_hSession)"); // LCOV_EXCL_BR_LINE 5:macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnOpenSession
+// brief : Called when a requester opens a session with SS_Logger
+// service. This function attaches error event callbacks
+// to the dispatcher with the source set to the requester.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnCloseSession(HANDLE f_hApp, PCSTR f_pRequesterName,
+ HANDLE f_hSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_cmdIdArr[m_requesterCallbacksVec.size()]; // NOLINT (runtime/arrays)
+
+ for (UI_32 i = 0; i < m_requesterCallbacksVec.size(); i++) {
+ l_cmdIdArr[i] = m_requesterCallbacksVec[i].iCmd;
+ }
+
+ l_eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(f_hApp, f_pRequesterName,
+ l_cmdIdArr,
+ static_cast<UI_32>(m_requesterCallbacksVec.size()),
+ f_hSession);
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedAttachCallbacksToDispatcher()"); // LCOV_EXCL_BR_LINE 5:macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnStartLogging
+// brief : Called by SS_Logger and external services to begin logging
+// artifact collection. This function sends a logging request
+// to System Manager. See SS_SM_EVENT_ERROR_TO_SSL.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnStartLogging(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SMErrorEventNtfData l_eventErrorNtfData;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 5:macro
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<SMErrorEventNtfData>(f_hApp, l_eventErrorNtfData))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // when failed to ReadMsg, we can't know event-type for action, so nothing is able to do.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 200:To ensure success
+ } else {
+ if (TRUE == this->m_pLoggerCfg->IsLoggingEnabled()) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ if (TRUE == m_bIsPrevEventCompleted) {
+ TLoggerErrorEvent l_eventData = l_eventErrorNtfData;
+
+ if (IsNeedVerify(l_eventData.EventType)) {
+ // if need output log to external storage, check whether device is authenticated or not.
+ VerifyExtStorage(l_eventData);
+ }
+
+ uint8_t status;
+ Clock_getSystemTimeY2K38(&m_time, &status);
+ m_currentEventTriggerNumber = m_pLoggerCfg->GetUserInvokedCounter();
+ l_eStatus = m_loggerUtil.checkDestinationAvailable(l_eventData);
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ m_bIsPrevEventCompleted = false; /* See timer start / timeout handler below. */
+
+ m_artifactResponseVec.clear();
+
+ m_errorEventNtfData = l_eventErrorNtfData; /* Overwrite m_eventErrorNtfData when logging complete. */
+ m_errorEventNtfData.EventBitMask = m_errorEventCfg
+ .GetEventsForErrorEvent(l_eventErrorNtfData.EventType);
+ l_eStatus = SendLogStartRequestToSystemManager(
+ m_errorEventNtfData.EventType);
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendLogStartRequestToSystemManager()");
+ l_eStatus = m_loggerCanEvent.PublishStartEvent(f_hApp,
+ m_errorEventNtfData);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerCanEvent.PublishStartEvent(f_hApp,m_errorEventNtfData);");
+
+ bool result =
+ m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN]
+ .Start(m_loggingStartRspnToSec, 0, 0, 0);
+ if (FALSE == result) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ // LCOV_EXCL_START 200:As it is always TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Failed to start timer kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN.");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. Destination not available. ");
+ m_errorEventNtfData = l_eventErrorNtfData; /* Overwrite m_eventErrorNtfData when logging complete. */
+ m_errorEventNtfData.EventBitMask = m_errorEventCfg
+ .GetEventsForErrorEvent(l_eventErrorNtfData.EventType);
+ l_eStatus = OnStorageResponseNotFound(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnStorageResponseNotFound(f_hApp)");
+ }
+ } else {
+ // Not-Need Resp to SM, because of keep logging sequance.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Logging already in progress. Event dropped.");
+ }
+ } else {
+ // LCOV_EXCL_START 200:As it is always TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (l_eventErrorNtfData.isNeedReboot == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "System will reboot soon, so stop logging function.");
+ StopLoggingFunction(f_hApp);
+ }
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Logging is disabled! Dropping Event. Sending Complete to SS_SystemManager");
+ l_eStatus = SendLogCompleteRequestToSystemManager(eFrameworkunifiedStatusFail);
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendLogCompleteRequestToSystemManager()");
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnLogStartResponse
+// brief : Called by System Manager after the acknowledgment of the
+// logging session start request. This function starts the
+// artifact collection process. See
+// SS_SM_ERROR_EVENT_LOGGING_START_RSPN.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnLogStartResponse(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN].Stop();
+ m_errorEventCfg.GetArtifactRequestVec(m_errorEventNtfData.EventType,
+ m_artifactRequestVec);
+
+ l_eStatus = RequestNextArtifact(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "RequestNextArtifact()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnLogStartResponseTimeout
+// brief : Called when / if SM fails to respond to a logging start
+// request and the logging star response timer expires.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnLogStartResponseTimeout(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. SM failed to respond to a logging start request in the required amount of time.");
+
+ m_bIsPrevEventCompleted = TRUE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : RequestNextArtifact
+// brief : This function requests the next artifact from the service
+// that owns the artifact. If no artifacts remain, this
+// function performs initiates artifact post processing.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::RequestNextArtifact(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_timeoutSec;
+ UI_32 l_timeoutMs;
+
+ if (0 != m_artifactRequestVec.size()) {
+ TLoggingArtifact &l_nextArtifact = m_artifactRequestVec.back();
+ l_eStatus = m_loggerPopups.ShowStartPopup(
+ f_hApp, m_errorEventNtfData, &m_artifactRequestVec,
+ m_loggerUtil.getDestination(m_errorEventNtfData));
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerPopups.ShowStartPopup(f_hApp,m_errorEventNtfData,&m_artifactRequestVec )");
+
+ TEXT(__FUNCTION__,
+ "Requesting next artifact ID:%d from:%s, with timeout:%d ms.",
+ l_nextArtifact.ArtifactId,
+ l_nextArtifact.Information.OwnerServiceName.c_str(),
+ l_nextArtifact.Information.RequestTimeoutMs);
+
+ l_timeoutSec = l_nextArtifact.Information.RequestTimeoutMs / 1000;
+ l_timeoutMs = l_nextArtifact.Information.RequestTimeoutMs % 1000;
+ bool result =
+ m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN].Start(
+ l_timeoutSec, l_timeoutMs, 0, 0);
+ if (FALSE == result) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ // LCOV_EXCL_START 200:As it is always TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to start timer kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN.");
+ // LCOV_EXCL_STOP
+ }
+ switch (l_nextArtifact.Information.Cb.Type) {
+ case eCbTypePath: {
+ l_eStatus = CheckPathForArtifact(f_hApp, l_nextArtifact);
+ }
+ break;
+
+ case eCbTypeFunction: {
+ if (l_nextArtifact.Information.Cb.Function == NULL) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 200:As it is not always NULL
+ } else {
+ l_eStatus = l_nextArtifact.Information.Cb.Function(f_hApp,
+ l_nextArtifact);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "l_nextArtifact.Information.Cb.Function(f_hApp, l_nextArtifact)");
+ }
+ }
+ break;
+
+ case eCbTypeInvalid:
+ default:
+ {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Unknown artifact or artifact owner for artifact ID:"
+ " %d. Invalid logging artifact configuration likely.",
+ l_nextArtifact.ArtifactId);
+ }
+ break;
+ }
+ } else {
+ if ((m_errorEventNtfData.EventType == eErrorEventTypeUserInvokedClearLogs)
+ || (m_errorEventNtfData.EventType
+ == eErrorEventTypeUserInvokedCollectNaviLog)) {
+ l_eStatus = this->OnStorageResponseOk(f_hApp);
+ return (l_eStatus);
+ }
+ uint8_t status;
+ Clock_getSystemTimeY2K38(&m_time, &status);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. All logging error event artifacts have been collected.");
+ l_eStatus = m_loggerUtil.checkDestinationAvailable(m_errorEventNtfData);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerUtil.checkDestinationAvailable(m_errorEventNtfData)");
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ /* Check one last time after all logs have been collected */
+ /* if we should show popup for archiving and writing to USB */
+ l_eStatus = m_loggerPopups.ShowStartPopup(
+ f_hApp, m_errorEventNtfData, &m_artifactRequestVec,
+ m_loggerUtil.getDestination(m_errorEventNtfData));
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerPopups.ShowStartPopup(f_hApp,m_errorEventNtfData,&m_artifactRequestVec )");
+
+ l_eStatus = m_loggerUtil.getFilePathAndName(f_hApp, m_errorEventNtfData,
+ m_time, m_archiveDestination);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerUtil.getFilePathAndName()");
+
+ std::string destination_path = m_loggerUtil.getDestination(
+ m_errorEventNtfData);
+ if (destination_path.compare(m_pLoggerCfg->m_emmcOutputPath) == 0) {
+ if (eFrameworkunifiedStatusOK
+ != m_loggerUtil.deleteOldEmmcLog(m_archiveDestination,
+ m_errorEventNtfData.EventType)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_loggerUtil.deleteOldEmmcLog()");
+ }
+ }
+
+ l_eStatus = this->m_loggerStorage.Start(m_archiveDestination,
+ this->m_artifactResponseVec,
+ m_time);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerStorage.Start()");
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ l_eStatus = this->OnStorageResponseWriteFailed(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "this->OnStorageResponseWriteFailed(f_hApp)");
+ }
+ } else {
+ l_eStatus = this->OnStorageResponseNotFound(f_hApp);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "this->OnStorageResponseNotFound(f_hApp)");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnArtifactResponse
+// brief : This function is called when an artifact has been made ready
+// by the owning service.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnArtifactResponse(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ARTIFACT_RESPONSE l_artifactResponse;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<ARTIFACT_RESPONSE>(f_hApp, l_artifactResponse))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 200:To ensure success
+ } else {
+ m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN].Stop();
+
+ // Prevent processing of artifacts that arrive after the error event logging session has completed.
+ if (m_artifactRequestVec.size() > 0) {
+ TEXT(__FUNCTION__, "Artifact ID:%d received.",
+ l_artifactResponse.ArtifactId);
+
+ TLoggingArtifact &l_artifactCurr = m_artifactRequestVec.back();
+ if (l_artifactCurr.ArtifactId != l_artifactResponse.ArtifactId) {
+ TEXT(
+ __FUNCTION__,
+ "Failure collecting current artifact. Expected artifact ID:%d, received artifact ID:%d."
+ " Ignoring received artifact.",
+ l_artifactCurr.ArtifactId, l_artifactResponse.ArtifactId);
+ } else {
+ TLoggingArtifactResponse l_response;
+ l_response.ArtifactId = l_artifactResponse.ArtifactId;
+ l_response.Filepath = l_artifactResponse.FilePathAndName;
+ l_response.Remove = l_artifactCurr.Information.Remove;
+ m_artifactResponseVec.push_back(l_response);
+ m_artifactRequestVec.pop_back(); // Remove received artifact from request vector.
+ l_eStatus = RequestNextArtifact(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "RequestNextArtifact()");
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Received spurious artifact ID: %d. No error event logging session active.",
+ l_artifactResponse.ArtifactId); // LCOV_EXCL_BR_LINE 5:macro
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnArtifactResponseTimeout
+// brief : This function is called when a requested artifact response
+// fails to arrive in the required amount of time.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnArtifactResponseTimeout(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (m_artifactRequestVec.size() > 0) { // LCOV_EXCL_BR_LINE 200:As it cannot always be 0
+ TLoggingArtifact &l_artifactCurr = m_artifactRequestVec.back();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Artifact response timer expired for artifact ID: %d.",
+ l_artifactCurr.ArtifactId);
+
+ // Remove artifact from request vector.
+ m_artifactRequestVec.pop_back();
+
+ RequestNextArtifact(f_hApp);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnArtifactRequest
+// brief : This function services an artifact request generated by
+// the error event sub system. The requested artifact will
+// be one of the artifacts owned by SSL.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnArtifactRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EArtifactId l_requestedArtifactId;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<EArtifactId>(f_hApp, l_requestedArtifactId))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ switch (l_requestedArtifactId) {
+ case eArtifactIdInterfaceunifiedDebugLog:
+ l_eStatus = OnObtainLoggerserviceLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainLoggerserviceLogRequest()");
+ break;
+
+ case eArtifactIdTransmitLog:
+ l_eStatus = OnObtainTransmitLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainTransmitLogRequest()");
+ break;
+
+ case eArtifactIdPerformanceLog:
+ l_eStatus = OnObtainPerformanceLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainPerformanceLogRequest()");
+ break;
+
+ case eArtifactIdScreenShot:
+ l_eStatus = OnObtainScreenShotRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainScreenShotRequest()");
+ break;
+
+ case eArtifactIdKernelLog:
+ l_eStatus = OnObtainKernelLogInfoRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainKernelLogInfoRequest()");
+ break;
+
+ case eArtifactIdDRInitialLog:
+ l_eStatus = OnObtainDRInitialLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainDRInitialLogRequest()");
+ break;
+
+ case eArtifactIdDRLocationLog:
+ l_eStatus = OnObtainDRLocationLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnObtainDRLocationLogRequest()");
+ break;
+
+ case eArtifactIdClearAllLog:
+ l_eStatus = OnClearAllLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnClearAllLogRequest()");
+ break;
+
+ case eArtifactIdNaviLog:
+ l_eStatus = OnNaviLogRequest(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "OnNaviLogRequest()");
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Unsupported logging artifact requested: %d.",
+ l_requestedArtifactId);
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnStorageResponseOk
+// brief : This function services response from the storage thread. It
+// is called when the logs have been stored successfully.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnStorageResponseOk(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = this->m_loggerPopups.ShowEndPopup(f_hApp, m_errorEventNtfData,
+ m_archiveDestination);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "this->m_loggerPopups.ShowEndPopup(f_hApp,m_errorEventNtfData,m_archiveDestination)");
+
+ if (m_errorEventNtfData.EventType == eErrorEventTypeDiagEvent) {
+ l_eStatus = sendDiagEventResponse();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "sendDiagEventResponse()");
+ }
+ if (m_errorEventNtfData.isNeedReboot == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "System will reboot soon, so stop logging function.");
+ StopLoggingFunction(f_hApp);
+ }
+ m_bIsPrevEventCompleted = true;
+ l_eStatus = SendLogCompleteRequestToSystemManager(eFrameworkunifiedStatusOK);
+
+ l_eStatus = m_loggerCanEvent.PublishEndEvent(f_hApp, m_errorEventNtfData,
+ m_currentEventTriggerNumber,
+ m_time);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_loggerCanEvent.PublishEndEvent();");
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendLogCompleteRequestToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnStorageResponseWriteFailed
+// brief : This function services response from the storage thread. It
+// is called when the logs failed to be written to the target
+// destination.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnStorageResponseWriteFailed(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = m_loggerPopups.ShowErrorPopup(f_hApp, m_errorEventNtfData,
+ (UI_16) eWriteToDeviceFailed);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "m_loggerPopups.ShowErrorPopup(f_hApp, eWriteToDeviceFailed)");
+
+ if (m_errorEventNtfData.EventType == eErrorEventTypeDiagEvent) {
+ sendDiagEventErrorResponse(eDEVICE_WRITE_ERROR);
+ }
+ if (m_errorEventNtfData.isNeedReboot == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "System will reboot soon, so stop logging function.");
+ StopLoggingFunction(f_hApp);
+ }
+ m_bIsPrevEventCompleted = true;
+ l_eStatus = SendLogCompleteRequestToSystemManager(eFrameworkunifiedStatusFail);
+
+ l_eStatus = m_loggerCanEvent.PublishErrorEvent(f_hApp, m_errorEventNtfData,
+ TRUE,
+ m_currentEventTriggerNumber,
+ m_time);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_loggerCanEvent.PublishErrorEvent();");
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendLogCompleteRequestToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnStorageResponseNotFound
+// brief : This function services response from the storage thread. It
+// is called when the logs failed to be written to the target
+// destination because the target was not found
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnStorageResponseNotFound(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = m_loggerPopups.ShowErrorPopup(f_hApp, m_errorEventNtfData,
+ (UI_16) eSelectedDeviceNotFound);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_loggerPopups.ShowErrorPopup(f_hApp, eSelectedDeviceNotFound)");
+
+ if (m_errorEventNtfData.EventType == eErrorEventTypeDiagEvent) {
+ l_eStatus = sendDiagEventErrorResponse(eDEVICE_NOT_AVAILABLE);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "sendDiagEventErrorResponse(eDEVICE_NOT_AVAILABLE)");
+ }
+ if (m_errorEventNtfData.isNeedReboot == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "System will reboot soon, so stop logging function.");
+ StopLoggingFunction(f_hApp);
+ }
+ m_bIsPrevEventCompleted = true;
+ l_eStatus = SendLogCompleteRequestToSystemManager(eFrameworkunifiedStatusFail);
+
+ l_eStatus = m_loggerCanEvent.PublishErrorEvent(f_hApp, m_errorEventNtfData,
+ TRUE,
+ m_currentEventTriggerNumber,
+ m_time);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_loggerCanEvent.PublishErrorEvent();");
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendLogCompleteRequestToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnStorageResponseNoWritten
+// brief : This function services response from the storage thread. It
+// is called when no logs where found.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnStorageResponseNoWritten(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = m_loggerPopups.ShowErrorPopup(f_hApp, m_errorEventNtfData,
+ (UI_16) eNoLogToStore);
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "m_loggerPopups.ShowErrorPopup(f_hApp, eNoLogToStore)");
+
+ if (m_errorEventNtfData.EventType == eErrorEventTypeDiagEvent) {
+ l_eStatus = sendDiagEventErrorResponse(eNO_ERROR_INFO);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "sendDiagEventErrorResponse(eNO_ERROR_INFO)");
+ }
+ if (m_errorEventNtfData.isNeedReboot == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "System will reboot soon, so stop logging function.");
+ StopLoggingFunction(f_hApp);
+ }
+ m_bIsPrevEventCompleted = true;
+ l_eStatus = SendLogCompleteRequestToSystemManager(eFrameworkunifiedStatusOK);
+
+ l_eStatus = m_loggerCanEvent.PublishErrorEvent(f_hApp, m_errorEventNtfData,
+ TRUE,
+ m_currentEventTriggerNumber,
+ m_time);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_loggerCanEvent.PublishErrorEvent();");
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendLogCompleteRequestToSystemManager()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEvent::sendDiagEventErrorResponse(EELL_ErrorCode f_errCode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (this->m_ServiceName.length() > 0) {
+ l_eStatus = sendDiagEventErrorResponse(f_errCode, this->m_ServiceName);
+ this->m_ServiceName = "";
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEvent::sendDiagEventErrorResponse(EELL_ErrorCode f_errCode,
+ std::string f_destName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(m_diagsessionhandle, SS_LOGGERCOPYEMERGENCYLOGS_ERROR_RESP, sizeof(EELL_ErrorCode), &f_errCode))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SS_LOGGERCOPYEMERGENCYLOGS_ERROR_RESP Msg send failed = %x",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEvent::sendDiagEventResponse(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(m_diagsessionhandle, SS_LOGGERCOPYEMERGENCYLOGS_SUCCESS_RESP, 0, NULL))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SS_LOGGERCOPYEMERGENCYLOGS_SUCCESS_RESP Msg send failed = %x",
+ l_eStatus);
+ }
+
+ m_ServiceName = "";
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEvent::SetDiagEventSourceName(std::string f_serviceName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if ((f_serviceName.length() > 0)
+ && (this->m_ServiceName.length() == 0)) {
+ this->m_ServiceName = f_serviceName;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. f_serviceName(%s), m_serviceName(%s)",
+ f_serviceName.c_str(), m_ServiceName.c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+void CErrorEvent::SetDiagSessionHandle(HANDLE f_sessionhandle) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_diagsessionhandle = f_sessionhandle;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+void CErrorEvent::SetMileage(UI_32 f_mileage) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ this->m_loggerUtil.SetMilage(f_mileage);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+// LCOV_EXCL_START 200:
+EFrameworkunifiedStatus CErrorEvent::SaveNaviLog(EPWR_SHUTDOWN_TRIGGER_TYPE errType) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_logMaxNum = 0;
+ std::string l_Filename = "";
+
+ uint32_t l_time;
+ uint8_t status;
+ Clock_getSystemTimeY2K38(&l_time, &status);
+ l_eStatus = m_loggerUtil.getEmmcNaviLogParams(l_time, errType, l_Filename,
+ l_logMaxNum);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: getEmmcNaviLogParams NaviLog update failed %d", l_eStatus);
+ } else {
+ if (l_logMaxNum == 0) {
+ /*OutputNaviLogNmlMax or OutputNaviLogErrMax = 0. */
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_WARN,
+ __FUNCTION__,
+ " Warning: Not update NaviLog. OutputNaviLogNmlMax or OutputNaviLogErrMax = 0");
+ } else {
+ FILE *fp;
+ void *p;
+ p = EL_mem_exram_mmap_simple(EL_MEM_ID_NAVI_LOG, PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+ EL_MEM_CACHE_INVALID);
+ if (p == MAP_FAILED) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error : EL_mem_exram_mmap_simple MAP_FAILD");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ fp = fopen(l_Filename.c_str(), "wb");
+ if (fp == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open file %s",
+ l_Filename.c_str());
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ } else {
+ fwrite(p, sizeof(unsigned char), EL_mem_getLength(EL_MEM_ID_NAVI_LOG),
+ fp);
+ fclose(fp);
+ }
+ if (0 != EL_mem_exram_munmap(p, EL_mem_getLength(EL_MEM_ID_NAVI_LOG))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : EL_mem_exram_munmap");
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CErrorEvent::VerifyExtStorage(TLoggerErrorEvent event) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string f_path;
+
+ f_path = m_pLoggerCfg->getUsb0MountPath();
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+
+ if (eFrameworkunifiedStatusFail == l_eStatus) {
+ // timeout or error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : get secure log failed or timeout");
+ }
+ } else {
+ // timeout
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : ticket verify timeout.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+bool CErrorEvent::IsNeedVerify(EErrorEventType type) {
+ bool ret = false;
+ switch (type) {
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeInterfaceunifiedEmmcLogs:
+ case eErrorEventTypeEelExport:
+ case eErrorEventTypeDiagEvent:
+ case eErrorEventTypeCanEvent:
+ ret = true;
+ break;
+ default:
+ break;
+ }
+ return ret;
+}
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_archive.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_archive.cpp
new file mode 100755
index 0000000..b718705
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_archive.cpp
@@ -0,0 +1,413 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_error_event_archive.h"
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <libtar_listhash.h>
+#include <libtar.h>
+#include <zlib.h>
+#include <stdio.h>
+#include <boost/bind.hpp>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include "ss_logger_util.h"
+#include "loggerservicedebug_loggerservicelog.h"
+#include "ss_logger_fs_directory.h"
+
+// GZF save variables
+static gzFile g_gzFile;
+
+CErrorEventArchive::CErrorEventArchive(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_pTarInfo = NULL;
+ g_gzFile = NULL;
+ m_gztype.openfunc = (openfunc_t) &CErrorEventArchive::gzOpenArchive;
+ m_gztype.closefunc = (closefunc_t) &CErrorEventArchive::gzCloseArchive;
+ m_gztype.readfunc = (readfunc_t) &CErrorEventArchive::gzReadArchive;
+ m_gztype.writefunc = (writefunc_t) &CErrorEventArchive::gzWriteArchive;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+CErrorEventArchive::~CErrorEventArchive(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (NULL != m_pTarInfo) { // LCOV_EXCL_BR_LINE 6: it will close after close
+ // LCOV_EXCL_START 6: it will close after close
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void) closeArchive();
+ m_pTarInfo = NULL;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus CErrorEventArchive::openArchive(std::string f_pathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == m_pTarInfo) { // LCOV_EXCL_BR_LINE 6: closeArchive will be set to null
+ m_pathAndName = f_pathAndName;
+
+ /* check if directory exists */
+ size_t l_found = f_pathAndName.find_last_of('/');
+ std::string l_path = f_pathAndName.substr(0, l_found);
+
+ if (0 != access(l_path.c_str(), F_OK)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Directory does not exist. Creating...");
+ l_eFrameworkunifiedStatus = CFSDirectory::CreateDirectory(l_path);
+ }
+
+ /* create archive in tmp */
+ m_tmpName = "/tmp/log.tar.gz";
+
+ int l_tarRetVal = tar_open(&m_pTarInfo, const_cast<char*>(m_tmpName.c_str()),
+ &m_gztype,
+ O_WRONLY | O_CREAT,
+ TARMODE,
+ TAR_GNU);
+
+ if ((l_tarRetVal != 0) || (m_pTarInfo == NULL) || (g_gzFile == NULL)) { // LCOV_EXCL_BR_LINE 5: tar_open's error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5: tar_open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open TAR-Archive!");
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: closeArchive will be set to null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Tar is still open");
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+EFrameworkunifiedStatus CErrorEventArchive::addToArchive(std::string f_filePathAndName,
+ std::string f_destinationName,
+ UI_8 f_depth) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusFileLoadError;
+ struct stat l_stat;
+ int l_statRetVal;
+
+ if (0 != access(f_filePathAndName.c_str(), F_OK)) { // LCOV_EXCL_BR_LINE 200: file is aways exist
+ // LCOV_EXCL_START 200: file is aways exist
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. The specified file path and name does not exist: %s",
+ f_filePathAndName.c_str());
+ // LCOV_EXCL_STOP
+ } else if (0 != (l_statRetVal = stat(f_filePathAndName.c_str(), &l_stat))) { // LCOV_EXCL_BR_LINE 5: stat's error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5: stat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. stat() for file or directory returned error: %s -> %d",
+ f_filePathAndName.c_str(), l_statRetVal);
+ // LCOV_EXCL_STOP
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ if (0 < f_depth) { // LCOV_EXCL_BR_LINE 6: it aways 4
+ l_eFrameworkunifiedStatus = addDirectoryToArchive(f_filePathAndName, f_destinationName,
+ f_depth);
+ } else {
+ // LCOV_EXCL_START 6: it aways 4
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Maximum recursive depth reached! File %s not added to archive.",
+ f_filePathAndName.c_str());
+ // LCOV_EXCL_STOP
+ }
+ } else if (0 != S_ISREG(l_stat.st_mode)) { // LCOV_EXCL_BR_LINE 200: it can not be a symbolic link
+ l_eFrameworkunifiedStatus = addFileToArchive(f_filePathAndName, f_destinationName);
+ } else {
+ // LCOV_EXCL_START 200: it can not be a symbolic link
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. specified file may be a symbolic link or other non 'regular' type. File: %s, mode: 0x%04X.",
+ f_filePathAndName.c_str(), l_stat.st_mode);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CErrorEventArchive::addToArchive(
+ std::vector<std::string> f_filePathAndNameList) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+
+ std::vector<std::string>::iterator l_vIter = f_filePathAndNameList.begin();
+ while ((eFrameworkunifiedStatusOK == l_eFrameworkunifiedStatus)
+ && (l_vIter != f_filePathAndNameList.end())) {
+ l_eFrameworkunifiedStatus = addToArchive(*l_vIter, *l_vIter);
+ l_vIter++;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CErrorEventArchive::closeArchive(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (0 != tar_append_eof(m_pTarInfo)) { // LCOV_EXCL_BR_LINE 5: tar_append_eof's error case.
+ // LCOV_EXCL_START 5: tar_append_eof's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_append_eof()");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ if (0 != tar_close(m_pTarInfo)) { // LCOV_EXCL_BR_LINE 5: tar_close's error case.
+ // LCOV_EXCL_START 5: tar_close's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not close archive");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ m_pTarInfo = NULL;
+ g_gzFile = NULL;
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 6: it aways be ok
+#ifdef RELEASE_BUILD
+ l_eStatus = CLoggerUtil::PathCheckAndCopyFile(m_tmpName, m_pathAndName);
+#else
+ l_eStatus = CLoggerUtil::CopyFile(m_tmpName, m_pathAndName);
+#endif // RELEASE_BUILD
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ l_eStatus =
+ (0 == remove(m_tmpName.c_str())) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFault;
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 5: remove's error case.
+ // LCOV_EXCL_START 5: remove's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_WARN,
+ __FUNCTION__,
+ " Warning. Failed to remove temporary archive. Will overwrite on next event");
+ // LCOV_EXCL_STOP
+ }
+ } else if (eFrameworkunifiedStatusErrNoEAGAIN == l_eStatus) { // LCOV_EXCL_BR_LINE 200: write can not be ErrNoEAGAIN
+ // LCOV_EXCL_START 200: write can not be ErrNoEAGAIN
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // disk space full
+ struct stat st_buf;
+ size_t req_size;
+ if (stat(m_tmpName.c_str(), &st_buf) != -1) { // LCOV_EXCL_BR_LINE 5: stat's error case.
+ req_size = st_buf.st_size;
+ if (eFrameworkunifiedStatusOK
+ == CLoggerUtil::forceDeleteOldLog(m_pathAndName, req_size)) {
+#ifdef RELEASE_BUILD
+ l_eStatus = CLoggerUtil::PathCheckAndCopyFile(m_tmpName, m_pathAndName);
+#else
+ l_eStatus = CLoggerUtil::CopyFile(m_tmpName, m_pathAndName);
+#endif // RELEASE_BUILD
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200: PathCheckAndCopyFile can not be fail
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Try Again but Error. Failed to copy to destination.%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. force delete failed.%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " emmc full: dest=%s, size=%d",
+ m_pathAndName.c_str(), req_size);
+ } else {
+ // LCOV_EXCL_START 5: stat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Warning. Failed to get tmp log file stat. dest=%s",
+ m_pathAndName.c_str());
+ // LCOV_EXCL_STOP
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ /*should we copy lost archive to emmc??*/
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Failed to copy to destination. %s", m_pathAndName.c_str());
+ }
+ remove(m_tmpName.c_str());
+ m_tmpName = "";
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEventArchive::addFileToArchive(std::string f_filename,
+ std::string f_destinationName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK; /*check if Tar is open and if file can be read */
+
+ char path[PATH_MAX];
+
+ if ((NULL != m_pTarInfo) && (0 != f_destinationName.length()) // LCOV_EXCL_BR_LINE 200: it will awalys be true
+ && (realpath(f_filename.c_str(), path) != NULL)) {
+ int l_tarRetVal = tar_append_file(m_pTarInfo, path,
+ const_cast<char*>(f_destinationName. c_str()));
+ if (0 != l_tarRetVal) { // LCOV_EXCL_BR_LINE 5: tar_append_file's error case.
+ // LCOV_EXCL_START 5: tar_append_file's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not add file \'%s\' to tar archive.", f_filename.c_str());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusAccessError;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: it will awalys be true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Archive not opened or could not access file: \"%s\"",
+ f_filename.c_str());
+ l_eFrameworkunifiedStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+EFrameworkunifiedStatus CErrorEventArchive::addDirectoryToArchive(
+ std::string f_path, std::string f_destinationName, UI_8 f_depth) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eFrameworkunifiedStatus = eFrameworkunifiedStatusOK;
+ struct dirent l_pDirent;
+ struct dirent* next;
+
+ DIR *l_pDir = opendir(f_path.c_str());
+ if (l_pDir != NULL) { // LCOV_EXCL_BR_LINE 5: opendir's error case.
+ while (0 == readdir_r(l_pDir, &l_pDirent, &next) && next != NULL) {
+ if ((0 != strcmp(l_pDirent.d_name, ".")) && /* Ignore special . directory. */
+ (0 != strcmp(l_pDirent.d_name, "..")) && /* Ignore special .. directory. */
+ (0 != strcmp(l_pDirent.d_name, "lost+found")) && /* Ignore lost+found. */
+ ('.' != l_pDirent.d_name[0])) { /* Ignore hidden files */
+ std::string l_extension = "/";
+ std::string l_fileName = f_path;
+ std::string l_destName = f_destinationName;
+ l_extension.append(l_pDirent.d_name);
+ l_fileName.append(l_extension);
+ l_destName.append(l_extension);
+ l_eFrameworkunifiedStatus = addToArchive(l_fileName, l_destName, static_cast<UI_8>(f_depth - 1));
+ }
+ }
+
+ closedir(l_pDir);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eFrameworkunifiedStatus);
+}
+
+SI_32 CErrorEventArchive::gzOpenArchive(PCHAR f_pcPathname, SI_32 f_siOflags,
+ SI_32 f_siMode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SI_32 l_siFileDescriptor = -1;
+
+ if (f_pcPathname) { // LCOV_EXCL_BR_LINE 6: Pathname is awalys be set
+ PCHAR l_pcGzoflags;
+
+ switch (f_siOflags & O_ACCMODE) { // LCOV_EXCL_BR_LINE 6: only O_WRONLY be set
+ case O_WRONLY: {
+ l_pcGzoflags = (PCHAR) "wb";
+ break;
+ }
+ // LCOV_EXCL_START 6: only O_WRONLY be set
+ case O_RDONLY: {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_pcGzoflags = (PCHAR) "rb";
+ break;
+ }
+ // LCOV_EXCL_STOP
+ case O_RDWR:
+ default: {
+ return -1;
+ }
+ }
+
+ if (-1 == (l_siFileDescriptor = // LCOV_EXCL_BR_LINE 5: open's error case.
+ open(f_pcPathname, f_siOflags, f_siMode))) {
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ if ((f_siOflags & O_CREAT) // LCOV_EXCL_BR_LINE 5: fchmod's error case.
+ && fchmod(l_siFileDescriptor, f_siMode)) {
+ // LCOV_EXCL_START 5: fchmod's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(l_siFileDescriptor);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+
+ g_gzFile = gzdopen(l_siFileDescriptor, l_pcGzoflags);
+ if (!g_gzFile) { // LCOV_EXCL_BR_LINE 5: gzdopen's error case.
+ // LCOV_EXCL_START 5: gzdopen's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(l_siFileDescriptor);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path empty.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (SI_32) l_siFileDescriptor;
+}
+SI_32 CErrorEventArchive::gzCloseArchive() {
+ return gzclose(g_gzFile);
+}
+
+ssize_t CErrorEventArchive::gzWriteArchive(int fd, const void* buf,
+ size_t count) {
+ return gzwrite(g_gzFile, const_cast<void*>(buf), (unsigned int) count);
+}
+
+ssize_t CErrorEventArchive::gzReadArchive(int fd, void* buf, size_t count) {
+ return gzread(g_gzFile, buf, (unsigned int) count);
+}
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp
new file mode 100755
index 0000000..f400e83
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_can_evt_reply.cpp
@@ -0,0 +1,147 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports notifying CAN abou HK and CAN error events
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
+#include <time.h>
+#include <stub/Clock_API.h>
+#include "ss_logger_error_event_can_evt_reply.h"
+CLoggerErrorEventCANEvtReply::CLoggerErrorEventCANEvtReply() {
+}
+
+CLoggerErrorEventCANEvtReply::~CLoggerErrorEventCANEvtReply() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerErrorEventCANEvtReply::Initialize(CLoggerCfg* f_pLoggerCfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+BOOL CLoggerErrorEventCANEvtReply::IsEventNeeded(TLoggerErrorEvent f_event) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_ret =
+ ((f_event.EventBitMask & EVENT_BIT_CAN_NOTIFICATION) != 0) ? TRUE : FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+EFrameworkunifiedStatus CLoggerErrorEventCANEvtReply::PublishStartEvent(
+ HANDLE f_hApp, TLoggerErrorEvent f_event) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (TRUE == IsEventNeeded(f_event)) {
+ l_eStatus = FrameworkunifiedPublishPublicEvent(f_hApp, eSSLoggerCANEventStart, NULL, 0);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "FrameworkunifiedPublishPublicEvent(f_hApp,eSSLoggerCANEventStart,NULL,0)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerErrorEventCANEvtReply::PublishEndEvent(
+ HANDLE f_hApp, TLoggerErrorEvent f_event, UI_32 f_triggerNumber,
+ uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (TRUE == IsEventNeeded(f_event)) {
+ STEventCANLoggerEventInfo l_info;
+ struct tm l_tm;
+ CLOCK_RETURN clock_ret = Clock_getLocalTimeY2K38(&f_time, &l_tm);
+ if (CLOCK_OK == clock_ret) {
+ l_info.valid = TRUE;
+ l_info.success = TRUE;
+ l_info.triggerNumber = f_triggerNumber;
+ l_info.dateAndTime.DateTime_Stat = 0;
+ l_info.dateAndTime.DateTimeDay = static_cast<UI_8>(l_tm.tm_mday);
+ l_info.dateAndTime.DateTimeHour = static_cast<UI_8>(l_tm.tm_hour);
+ l_info.dateAndTime.DateTimeMinute = static_cast<UI_8>(l_tm.tm_min);
+ l_info.dateAndTime.DateTimeMonth = static_cast<UI_8>(l_tm.tm_mon + 1);
+ l_info.dateAndTime.DateTimeSecond = static_cast<UI_8>(l_tm.tm_sec);
+ l_info.dateAndTime.DateTimeYear = static_cast<UI_8>(l_tm.tm_year % 100);
+ l_info.dateAndTime.TimeFormat = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Time sent to CAN is: 20%2d/%2d/%2d %2d:%2d:%2d",
+ l_info.dateAndTime.DateTimeYear, l_info.dateAndTime.DateTimeMonth,
+ l_info.dateAndTime.DateTimeDay, l_info.dateAndTime.DateTimeHour,
+ l_info.dateAndTime.DateTimeMinute,
+ l_info.dateAndTime.DateTimeSecond);
+
+ } else {
+ l_info.success = TRUE;
+ l_info.valid = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Passed time is invalid.");
+ }
+ l_eStatus = FrameworkunifiedPublishPublicEvent(f_hApp, eSSLoggerCANEventFinished,
+ &l_info, sizeof(l_info));
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "FrameworkunifiedPublishPublicEvent(f_hApp,eSSLoggerCANEventFinished,NULL,0)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerErrorEventCANEvtReply::PublishErrorEvent(
+ HANDLE f_hApp, TLoggerErrorEvent f_event, BOOL f_isValid,
+ UI_32 f_triggerNumber, uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (TRUE == IsEventNeeded(f_event)) {
+ STEventCANLoggerEventInfo l_info;
+ struct tm l_tm;
+ CLOCK_RETURN clock_ret = Clock_getLocalTimeY2K38(&f_time, &l_tm);
+ l_info.valid = f_isValid;
+ l_info.success = FALSE;
+ if (CLOCK_OK == clock_ret) {
+ l_info.triggerNumber = f_triggerNumber;
+ l_info.dateAndTime.DateTime_Stat = 0;
+ l_info.dateAndTime.DateTimeDay = static_cast<UI_8>(l_tm.tm_mday);
+ l_info.dateAndTime.DateTimeHour = static_cast<UI_8>(l_tm.tm_hour);
+ l_info.dateAndTime.DateTimeMinute = static_cast<UI_8>(l_tm.tm_min);
+ l_info.dateAndTime.DateTimeMonth = static_cast<UI_8>(l_tm.tm_mon + 1);
+ l_info.dateAndTime.DateTimeSecond = static_cast<UI_8>(l_tm.tm_sec);
+ l_info.dateAndTime.DateTimeYear = static_cast<UI_8>(l_tm.tm_year % 100);
+ l_info.dateAndTime.TimeFormat = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Time sent to CAN is: 20%2d/%2d/%2d %2d:%2d:%2d",
+ l_info.dateAndTime.DateTimeYear, l_info.dateAndTime.DateTimeMonth,
+ l_info.dateAndTime.DateTimeDay, l_info.dateAndTime.DateTimeHour,
+ l_info.dateAndTime.DateTimeMinute,
+ l_info.dateAndTime.DateTimeSecond);
+
+ } else {
+ l_info.valid = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Passed time is invalid.");
+ }
+ l_eStatus = FrameworkunifiedPublishPublicEvent(f_hApp, eSSLoggerCANEventFinished,
+ &l_info, sizeof(l_info));
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: macro
+ l_eStatus,
+ "FrameworkunifiedPublishPublicEvent(f_hApp,eSSLoggerCANEventFinished,NULL,0)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_cfg.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_cfg.cpp
new file mode 100755
index 0000000..fcd733e
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_cfg.cpp
@@ -0,0 +1,335 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <vector>
+#include "loggerservicedebug_loggerservicelog.h"
+#include "ss_logger_error_event_cfg.h"
+
+enum ARTIFACT_BIT {
+ ARTIFACT_BIT_NONE = 0x00000000,
+ ARTIFACT_BIT_LOGGERSERVICE_DEBUG_LOG = 1 << (UI_32) eArtifactIdInterfaceunifiedDebugLog,
+ ARTIFACT_BIT_TRANSMIT_LOG = 1 << (UI_32) eArtifactIdTransmitLog,
+ ARTIFACT_BIT_PERFORMANCE_LOG = 1 << (UI_32) eArtifactIdPerformanceLog,
+ ARTIFACT_BIT_BOOT_MICRO_LOG = 1 << (UI_32) eArtifactIdBootMicroLog,
+ ARTIFACT_BIT_SYSTEM_DATA_LOG = 1 << (UI_32) eArtifactIdSystemDataCsv,
+ ARTIFACT_BIT_SHOW_MEM_TXT = 1 << (UI_32) eArtifactIdShowMemTxt,
+ ARTIFACT_BIT_PROCESS_CORE = 1 << (UI_32) eArtifactIdProcessCore,
+ ARTIFACT_BIT_DEBUG_DUMP_LOG = 1 << (UI_32) eArtifactIdDebugDumpLog,
+ ARTIFACT_BIT_KERNEL_LOG = 1 << (UI_32) eArtifactIdKernelLog,
+ ARTIFACT_BIT_KERNEL_BOOT_LOG = 1 << (UI_32) eArtifactIdKernelBootLog,
+ ARTIFACT_BIT_DRINITIAL_LOG = 1 << (UI_32) eArtifactIdDRInitialLog,
+ ARTIFACT_BIT_DRLOCATION_LOG = 1 << (UI_32) eArtifactIdDRLocationLog,
+ ARTIFACT_BIT_CHLM_MC_LOGS = 1 << (UI_32) eArtifactIdCpuHighLoadMonteCarloLogs,
+ ARTIFACT_BIT_METACORE_LOGS = 1 << (UI_32) eArtifactIdMetaCoreLogs,
+ ARTIFACT_BIT_SCREEN_SHOT = 1 << (UI_32) eArtifactIdScreenShot,
+ ARTIFACT_BIT_CMS_LOGS = 1 << (UI_32) eArtifactIdCmsLogs,
+ ARTIFACT_BIT_INTERNAL_DTC_LOG = 1 << (UI_32) eArtifactIDInternalDTC,
+ ARTIFACT_BIT_CLEAR_ALL_LOG = 1 << (UI_32) eArtifactIdClearAllLog,
+ ARTIFACT_BIT_NAVI_LOG = 1 << (UI_32) eArtifactIdNaviLog,
+ ARTIFACT_BIT_DEBUG_FOLDER_CONTENT = 1
+ << (UI_32) eArtifactIdDebugFolderContent,
+ ARTIFACT_BIT_DEBUG_FOLDER2_CONTENT = 1
+ << (UI_32) eArtifactIdDebugFolder2Content,
+ ARTIFACT_BIT_COM_LOG = 1 << (UI_32) eArtifactIdComDebugLog,
+ ARTIFACT_BIT_PSTORE_LOG = 1 << (UI_32) eArtifactIdPstoreLog
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////
+///// Definition for Logging Artifact Filepaths
+//////////////////////////////////////////////////////////////////////////////////////////
+const char LAF_DEBUG_FOLDER[] = "/nv/BS/ss/logger_service/rwdata";
+const char LAF_DEBUG_FOLDER2[] = "/nv/BS/ss/logger_service/rwdata/log2";
+const char LAF_MONTECARLO_FN[] = "/tmp/MonteCarlo";
+const char LAF_METACORE_FN[] = "/tmp/MetaCore";
+const char LAF_CMS_FN[] = "/tmp/cms";
+const char LAF_INT_DTC_FN[] = "/tmp/dtc_error.log";
+const char LAF_LOGGERSERVICELOG_COM[] = "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/communication";
+const char LAF_KERNEL_BOOT_FN[] = "/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/kernelboot.log";
+const char LAF_PSTORELOG[] = "/dev/pstore";
+
+#define ARTIFACT_BIT_ALL_OUTPUT_LOG (ARTIFACT_BIT_LOGGERSERVICE_DEBUG_LOG | \
+ ARTIFACT_BIT_DEBUG_DUMP_LOG | \
+ ARTIFACT_BIT_SYSTEM_DATA_LOG | \
+ ARTIFACT_BIT_SHOW_MEM_TXT | \
+ ARTIFACT_BIT_COM_LOG | \
+ ARTIFACT_BIT_KERNEL_LOG | \
+ ARTIFACT_BIT_KERNEL_BOOT_LOG | \
+ ARTIFACT_BIT_SCREEN_SHOT | \
+ ARTIFACT_BIT_TRANSMIT_LOG | \
+ ARTIFACT_BIT_PERFORMANCE_LOG | \
+ ARTIFACT_BIT_DRINITIAL_LOG | \
+ ARTIFACT_BIT_DRLOCATION_LOG | \
+ ARTIFACT_BIT_CHLM_MC_LOGS | \
+ ARTIFACT_BIT_INTERNAL_DTC_LOG | \
+ ARTIFACT_BIT_METACORE_LOGS | \
+ ARTIFACT_BIT_PSTORE_LOG)
+
+TLoggingArtifactCfg CErrorEventCfg::m_loggerErrorEventCfgTbl[eErrorEventTypeMaxValue] = {
+ { eErrorEventTypeProcessCrash, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeProcessExit, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeHeartBeatFailure, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeSystemLowMemory, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeUserInvokedUserForceReset, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeUserInvokedCollectAllLogs, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_POPUP | EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeUserInvokedCollectScreenShot, { (ARTIFACT_BIT_NONE
+ | ARTIFACT_BIT_SCREEN_SHOT),
+
+ (EVENT_BIT_POPUP | EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_POPUP | EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeUserInvokedCollectDevLogs, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_NONE) }
+ },
+
+ { eErrorEventTypeBootMicroReset, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeEelExport, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_POPUP | EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeInterfaceunifiedEmmcLogs, { (ARTIFACT_BIT_DEBUG_FOLDER_CONTENT
+ | ARTIFACT_BIT_DEBUG_FOLDER2_CONTENT),
+
+ (EVENT_BIT_POPUP | EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeDiagEvent, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_DIAG) } },
+
+ { eErrorEventTypeCanEvent, { ARTIFACT_BIT_ALL_OUTPUT_LOG,
+ (EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeDtcEvent, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG),
+
+ (EVENT_BIT_CAN_NOTIFICATION) } },
+
+ { eErrorEventTypeModConnFailed, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeStartRespFailed, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeModuleInvokedResetRequest, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeModuleInvokedCollectDebugLogs,
+ { (ARTIFACT_BIT_ALL_OUTPUT_LOG | ARTIFACT_BIT_NAVI_LOG),
+ (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeUserInvokedClearLogs, { (ARTIFACT_BIT_NONE
+ | ARTIFACT_BIT_CLEAR_ALL_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeUserInvokedCollectNaviLog, { (ARTIFACT_BIT_NONE
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeGroupRelaunch, { (ARTIFACT_BIT_ALL_OUTPUT_LOG
+ | ARTIFACT_BIT_NAVI_LOG), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeReserved1, { (ARTIFACT_BIT_NONE), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeReserved2, { (ARTIFACT_BIT_NONE), (EVENT_BIT_NONE) } },
+
+ { eErrorEventTypeReserved3, { (ARTIFACT_BIT_NONE), (EVENT_BIT_NONE) } } };
+
+TLoggingArtifact CErrorEventCfg::m_loggerErrorArtifactCfgTbl[eArtifactIdMaxValue] = { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ /*Artifact ID Owner Timeout Callback Type Path CallBack Function Delete tmp artifact*/
+ { eArtifactIdInterfaceunifiedDebugLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdTransmitLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdPerformanceLog, { SERVICE_LOGGER, 5, { eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } },
+ { eArtifactIdBootMicroLog, { SERVICE_SYSMANAGER, 1000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } },
+ { eArtifactIdSystemDataCsv, { SERVICE_SYSMANAGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } },
+ { eArtifactIdShowMemTxt, { SERVICE_SYSMANAGER, 8000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } },
+ { eArtifactIdProcessCore, { SERVICE_SYSMANAGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } },
+ { eArtifactIdDebugDumpLog, { SERVICE_SYSMANAGER, 4000, { eCbTypeFunction, "", SSLogger_SendtoSM }, TRUE } },
+ { eArtifactIdScreenShot, { SERVICE_LOGGER, 1100, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdDebugFolderContent, { SERVICE_LOGGER, 50000, { eCbTypePath, LAF_DEBUG_FOLDER, NULL }, FALSE } },
+ { eArtifactIdDebugFolder2Content, { SERVICE_LOGGER, 50000, { eCbTypePath, LAF_DEBUG_FOLDER2, NULL }, FALSE } },
+ { eArtifactIdKernelLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdKernelBootLog, { SERVICE_LOGGER, 5000, { eCbTypePath, LAF_KERNEL_BOOT_FN, NULL }, FALSE } },
+ { eArtifactIdDRInitialLog, { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdDRLocationLog, { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, TRUE } },
+ { eArtifactIdCpuHighLoadMonteCarloLogs, { SERVICE_LOGGER, 50, { eCbTypePath, LAF_MONTECARLO_FN, NULL }, TRUE } },
+ { eArtifactIdMetaCoreLogs, { SERVICE_LOGGER, 50, { eCbTypePath, LAF_METACORE_FN, NULL }, TRUE } },
+ { eArtifactIdCmsLogs, { SERVICE_LOGGER, 500, { eCbTypePath, LAF_CMS_FN, NULL }, TRUE } },
+ { eArtifactIDInternalDTC, { SERVICE_LOGGER, 500, { eCbTypePath, LAF_INT_DTC_FN, NULL }, TRUE } },
+ { eArtifactIdComDebugLog, { SERVICE_LOGGER, 500, { eCbTypePath, LAF_LOGGERSERVICELOG_COM, NULL }, FALSE } },
+ { eArtifactIdPstoreLog, { SERVICE_LOGGER, 50, { eCbTypePath, LAF_PSTORELOG, NULL }, FALSE } },
+ { eArtifactIdClearAllLog, { SERVICE_LOGGER, 500, { eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } },
+ { eArtifactIdNaviLog, { SERVICE_LOGGER, 5000, { eCbTypeFunction, "", SSLogger_SendtoSelf }, FALSE } },
+}; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+CErrorEventCfg::CErrorEventCfg() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+CErrorEventCfg::~CErrorEventCfg() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CErrorEventCfg::Initialize(CLoggerCfg* p_logger_cfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_cnt;
+
+ m_ext_log_num = 0;
+ ExternalLogList ext_log = p_logger_cfg->GetExternalLogList();
+
+ for (l_cnt = 0; l_cnt < eArtifactIdMaxValue; l_cnt++) {
+ EArtifactId l_artifactId = m_loggerErrorArtifactCfgTbl[l_cnt].ArtifactId;
+ TLoggingArtifactInformation l_artifactInformation =
+ m_loggerErrorArtifactCfgTbl[l_cnt].Information;
+ m_errorArtifactMap[l_artifactId] = l_artifactInformation; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ for (l_cnt = 0; l_cnt < eErrorEventTypeMaxValue; l_cnt++) {
+ EErrorEventType l_eventType = m_loggerErrorEventCfgTbl[l_cnt].ErrorType;
+ TLoggingErrorEventInformation l_errorEvtInformation =
+ m_loggerErrorEventCfgTbl[l_cnt].Information;
+ m_errorEventTypeToArtifactBitMaskMap[l_eventType] = l_errorEvtInformation;
+ }
+
+ // Set external log info
+ if (ext_log.num > 0) {
+ if (ext_log.num <= ext_log.max) {
+ m_ext_log_num = ext_log.num;
+ } else {
+ m_ext_log_num = ext_log.max;
+ }
+
+ for (UI_32 i = 0; i < m_ext_log_num; i++) {
+ EArtifactId l_artifactId = (EArtifactId) (eArtifactIdMaxValue + i);
+ TLoggingArtifactInformation artifact_info;
+ artifact_info.Cb.Function = NULL;
+ artifact_info.Cb.Path = ext_log.p_info[i].path;
+ artifact_info.Cb.Type = eCbTypePath;
+ artifact_info.OwnerServiceName = SERVICE_LOGGER;
+ artifact_info.Remove = ext_log.p_info[i].remove;
+ artifact_info.RequestTimeoutMs = 5000;
+ m_errorArtifactMap[l_artifactId] = artifact_info;
+ }
+ }
+
+ l_eStatus = (EFrameworkunifiedStatus) ValidateConfiguration();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "ValidateConfiguration()"); // LCOV_EXCL_BR_LINE 5:macro
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+UI_32 CErrorEventCfg::ValidateConfiguration(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ UI_32 l_return = 0;
+
+ if ((eArtifactIdMaxValue + m_ext_log_num) != m_errorArtifactMap.size()) { // LCOV_EXCL_BR_LINE 6:Be sure not to exceed the eArtifactIdMaxValue
+ // LCOV_EXCL_START 6:Be sure not to exceed the eArtifactIdMaxValue
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Artifact map size mismatch: Expected: %d, Found: %d",
+ (eArtifactIdMaxValue + m_ext_log_num), m_errorArtifactMap.size());
+ l_return |= 1;
+ // LCOV_EXCL_STOP
+ }
+ if (eErrorEventTypeMaxValue != m_errorEventTypeToArtifactBitMaskMap.size()) { // LCOV_EXCL_BR_LINE 6:Be sure not to exceed the eErrorEventTypeMaxValue
+ // LCOV_EXCL_START 6:Be sure not to exceed the eErrorEventTypeMaxValue
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error event map size mismatch: Expected: %d, Found: %d",
+ eErrorEventTypeMaxValue, m_errorEventTypeToArtifactBitMaskMap.size());
+ l_return |= 4;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_return);
+}
+
+void CErrorEventCfg::GetArtifactRequestVec(
+ EErrorEventType f_eventType,
+ std::vector<TLoggingArtifact> &f_refArtifactRequestVec) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ ARTIFACT_BIT_MASK l_artifactRequestBits = 0;
+ ARTIFACT_BIT l_artifactBit;
+ TLoggingArtifact l_artifact;
+ UI_32 l_artifactId;
+
+ f_refArtifactRequestVec.clear();
+
+ if (f_eventType < eErrorEventTypeMaxValue) {
+ l_artifactRequestBits = m_errorEventTypeToArtifactBitMaskMap[f_eventType]
+ .ArtifactBitMask;
+ }
+
+ if (l_artifactRequestBits > 0) {
+ for (l_artifactId = 0; l_artifactId < eArtifactIdMaxValue; l_artifactId++) {
+ l_artifactBit = (ARTIFACT_BIT) (1 << l_artifactId);
+ if ((l_artifactRequestBits & l_artifactBit) > 0) {
+ l_artifact.ArtifactId = (EArtifactId) l_artifactId;
+ l_artifact.Information = m_errorArtifactMap[l_artifact.ArtifactId];
+ f_refArtifactRequestVec.push_back(l_artifact);
+ }
+ }
+
+ // Set external log info
+ if (m_ext_log_num > 0) {
+ for (l_artifactId = 0; l_artifactId < m_ext_log_num; l_artifactId++) {
+ l_artifact.ArtifactId = (EArtifactId) (eArtifactIdMaxValue + l_artifactId);
+ l_artifact.Information = m_errorArtifactMap[l_artifact.ArtifactId];
+ f_refArtifactRequestVec.push_back(l_artifact);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EVENT_BIT_MASK CErrorEventCfg::GetEventsForErrorEvent(
+ EErrorEventType f_eventType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EVENT_BIT_MASK l_events = EVENT_BIT_NONE;
+ if (f_eventType < eErrorEventTypeMaxValue) { // LCOV_EXCL_BR_LINE 6:Be sure not to exceed the eErrorEventTypeMaxValue
+ l_events = m_errorEventTypeToArtifactBitMaskMap[f_eventType].EventBitMask;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_events);
+} // LCOV_EXCL_BR_LINE 10:the last line
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_responses.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_responses.cpp
new file mode 100755
index 0000000..dc23d8b
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_responses.cpp
@@ -0,0 +1,625 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <boost/bind.hpp>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/klog.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_reader.h>
+#include <native_service/ns_ringbuffer.h>
+#include <native_service/ns_logger_if.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <native_service/cl_process.h>
+#include <native_service/cl_lockid.h>
+#include <sstream>
+#include <string>
+#include "loggerservicedebug_loggerservicelog.h"
+#include "loggerservicedebug_thread_if.h"
+#include "ss_logger_error_event.h"
+#include "ss_logger_service_callbacks.h"
+#include "ss_logger_scrshot.h"
+#include "ss_logger_fs_directory.h"
+#include "ss_logger_common.h"
+#include "ss_logger_types.h"
+
+EFrameworkunifiedStatus SSLogger_SendtoSM(HANDLE f_hApp, TLoggingArtifact f_artifact) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = SendLogArtifactRequestToSystemManager(f_artifact.ArtifactId);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. SendLogArtifactRequestToSystemManager returned: %d for artifact ID: %d",
+ l_eStatus, f_artifact.ArtifactId);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus SSLogger_SendtoSelf(HANDLE f_hApp, TLoggingArtifact f_artifact) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNullPointer;
+ if (NULL != f_hApp) { // LCOV_EXCL_BR_LINE 6: double check
+ l_eStatus = FrameworkunifiedSendSelf(f_hApp, SS_LOGGER_ERROR_EVENT_ARTIFACT_REQ,
+ sizeof(f_artifact.ArtifactId),
+ &f_artifact.ArtifactId);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. FrameworkunifiedSendSelf(SS_LOGGER_ERROR_EVENT_ARTIFACT_REQ) returned error: %d for artifact ID: %d.",
+ l_eStatus, f_artifact.ArtifactId);
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+///////////////////////////////////////////////////////////////////////////
+// Function : SendLogArtifactResponseToSelf
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::SendLogArtifactResponseToSelf(
+ HANDLE f_hApp, EArtifactId f_artifactId,
+ std::string f_artifactFilePathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ARTIFACT_RESPONSE l_artifactResponse;
+
+ l_artifactResponse.ArtifactId = f_artifactId;
+
+ strncpy(l_artifactResponse.FilePathAndName, f_artifactFilePathAndName.c_str(),
+ sizeof(l_artifactResponse.FilePathAndName) - 1);
+
+ l_eStatus = FrameworkunifiedSendSelf(f_hApp, SS_SM_ERROR_EVENT_ARTIFACT_RSPN,
+ sizeof(l_artifactResponse), &l_artifactResponse);
+
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedSendSelf(SS_SM_ERROR_EVENT_ARTIFACT_RSPN)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainLoggerserviceLogRequest
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainLoggerserviceLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string dir_path = DEBUG_LOG_PATH_DIR;
+
+ l_eStatus = CFSDirectory::CreateDirectory(dir_path);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Create FRAMEWORKUNIFIEDLOG tmp directory %d",
+ l_eStatus);
+ } else {
+ UI_32 l_DumpSize = 0;
+ std::string src_file_path;
+ std::string dst_file_path;
+ PCSTR file_name;
+ UI_32 num;
+ bool log_clear = true;
+
+ switch (m_errorEventNtfData.EventType) {
+ // _DIAG
+ case eErrorEventTypeUserInvokedUserForceReset:
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeDiagEvent:
+ case eErrorEventTypeCanEvent:
+ case eErrorEventTypeDtcEvent:
+ case eErrorEventTypeModuleInvokedCollectDebugLogs:
+ // _DEBUG
+ case eErrorEventTypeUserInvokedCollectDevLogs:
+ log_clear = false;
+ break;
+ default:
+ break;
+ }
+
+ num = NSLogGetFrameworkunifiedlogFileTotalNum();
+ for (UI_32 cont = 0; cont < num; cont++) {
+ file_name = NSLogGetFrameworkunifiedlogFileName(cont);
+ if (file_name == NULL) {
+ break;
+ }
+ src_file_path = FRAMEWORKUNIFIEDLOG_RAMDISC_PATH;
+ src_file_path.append("/");
+ src_file_path.append(file_name);
+ dst_file_path = DEBUG_LOG_PATH_DIR;
+ dst_file_path.append("/");
+ dst_file_path.append(file_name);
+ CNSRingBuffer* l_pLoggerservicelog;
+ int index;
+ index = NSLogGetFrameworkunifiedlogIndex(src_file_path.c_str());
+ l_pLoggerservicelog = new (std::nothrow) CNSRingBuffer(
+ src_file_path, 0, index + LOCK_NSLOG_ACCES_IF_1);
+ if (l_pLoggerservicelog == NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer handle is NULL %s",
+ src_file_path.c_str());
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer Open failed %s %d",
+ src_file_path.c_str(), l_eStatus);
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pLoggerservicelog->DumpToFile(dst_file_path.c_str(),
+ &l_DumpSize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer DumpToFile failed %s %d",
+ src_file_path.c_str(), l_eStatus);
+ }
+ if (NULL != l_pLoggerservicelog) { // LCOV_EXCL_BR_LINE 5: new's error case
+ if (log_clear) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pLoggerservicelog->ClearBuf())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FRAMEWORKUNIFIEDLOG RingBuffer ClearBuf failed %s %d",
+ src_file_path.c_str(), l_eStatus);
+ }
+ }
+ (void) l_pLoggerservicelog->Close();
+ delete l_pLoggerservicelog;
+ }
+ }
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdInterfaceunifiedDebugLog,
+ DEBUG_LOG_PATH_DIR);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdInterfaceunifiedDebugLog)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainLoggerserviceLogRequest
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainTransmitLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_RootPath;
+
+ l_eStatus = m_pReaderWriterControl->FlushCache(eReaderWriterLogTransmit);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_pReaderWriterControl->FlushCache(eReaderWriterLogTransmit)");
+ l_RootPath = TRANSMIT_LOG_PATH_FN;
+ if (access(l_RootPath.c_str(), R_OK) != 0) {
+ l_RootPath = "";
+ }
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdTransmitLog,
+ l_RootPath.c_str());
+
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendLogArtifactResponseToSelf(eArtifactIdTransmitLog)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainLoggerserviceLogRequest
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainPerformanceLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = m_pReaderWriterControl->FlushCache(eReaderWriterLogPerformance);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "m_pReaderWriterControl->FlushCache(eReaderWriterLogPerformance)");
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdPerformanceLog,
+ PERFORMANCE_LOG_PATH_FN);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdPerformanceLog)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainScreenShotRequest
+// brief : Collect screen shot artifact from PLM and return a response
+// to SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainScreenShotRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdScreenShot,
+ SCREEN_SHOT_PATH);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdScreenShot)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainScreenShotResponse
+// brief : Callback from PLM when the screen shot file has been written
+// to storage. The data received contains the file path and
+// name to the written screen shot file. See
+// SS_LOGGER_SCREENCAPTURE_EVT_ACK.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainScreenShotResponse(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ STScreenCaptureEvt l_ScreenCaptureEvtAck;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<STScreenCaptureEvt>(f_hApp, l_ScreenCaptureEvtAck))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP
+ } else {
+ if (FALSE == l_ScreenCaptureEvtAck.fSucessful) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Screen shot acquisition failed. l_ScreenCaptureEvtAck.fSucessful == FALSE.");
+ l_ScreenCaptureEvtAck.strNameAndLocation[0] = '\0';
+ }
+
+ l_eStatus = SendLogArtifactResponseToSelf(
+ f_hApp, eArtifactIdScreenShot,
+ l_ScreenCaptureEvtAck.strNameAndLocation); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 5:macro
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdScreenShot)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainKernelLogInfoRequest
+// brief : Collect kernel log artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainKernelLogInfoRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = CreateKernelLog(f_hApp, SS_LOGGER_KLOG_GET);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainDRInitialLogRequest
+// brief : Collect DRInitialLog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainDRInitialLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_DumpSize = 0;
+
+ CNSSharedMemReader* l_pDRInitial = new (std::nothrow) CNSSharedMemReader(
+ SHMEM_DRINITIALLOG, FALSE);
+
+ if (NULL == l_pDRInitial) { // LCOV_EXCL_BR_LINE 5: new's error case
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRInitial SharedMem handle is NULL");
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pDRInitial->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRInitial Open failed %d", l_eStatus);
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pDRInitial->DumpToFile(DRINITIAL_LOG_PATH_FN,
+ &l_DumpSize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRInitial DumpToFile failed %d",
+ l_eStatus);
+ } else {
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdDRInitialLog,
+ DRINITIAL_LOG_PATH_FN);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdDRInitialLog)");
+ }
+
+ if (NULL != l_pDRInitial) { // LCOV_EXCL_BR_LINE 5: new's error case
+ (void) l_pDRInitial->Close();
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainDRLocationLogRequest
+// brief : Collect DRLocationLog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnObtainDRLocationLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_DumpSize = 0;
+
+ CNSSharedMemReader* l_pDRLocation = new (std::nothrow) CNSSharedMemReader(
+ SHMEM_DRLOCATIONLOG, FALSE);
+
+ if (NULL == l_pDRLocation) { // LCOV_EXCL_BR_LINE 5: new's error case
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRInitial SharedMem handle is NULL");
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = l_pDRLocation->Open())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRLocation Open failed %d",
+ l_eStatus);
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pDRLocation->DumpToFile(DRLOCATION_LOG_PATH_FN,
+ &l_DumpSize))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: DRLocation DumpToFile failed %d",
+ l_eStatus);
+ } else {
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdDRLocationLog,
+ DRLOCATION_LOG_PATH_FN);
+
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "SendLogArtifactResponseToSelf(eArtifactIdDRLocationLog)");
+ }
+
+ if (NULL != l_pDRLocation) { // LCOV_EXCL_BR_LINE 5: new's error case
+ (void) l_pDRLocation->Close();
+ delete l_pDRLocation;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnClearAllLogRequest
+// brief : Callback from LoggerService when the event log file has been delete
+// from storage. The data received contains the file path.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnClearAllLogRequest(HANDLE f_hApp) {
+ std::string clear_file_path = CLEAR_LOG_PATH_FN;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (CFSDirectory::RemoveSubDirectory(clear_file_path)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "SS_Logger Clear %s directory delete successful.",
+ clear_file_path.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SS_Logger Clear %s directory delete failed.",
+ clear_file_path.c_str());
+ }
+
+ clear_file_path = "/nv/BS/ss/logger_service/rwdata/log2/awlog/";
+ if (CFSDirectory::RemoveSubDirectory(clear_file_path)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "SS_Logger Clear %s directory delete successful.",
+ clear_file_path.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SS_Logger Clear %s directory delete failed.",
+ clear_file_path.c_str());
+ }
+
+ clear_file_path = "/nv/BS/ss/logger_service/rwdata/log2/core/";
+ if (CFSDirectory::RemoveSubDirectory(clear_file_path)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "SS_Logger Clear %s directory delete successful.",
+ clear_file_path.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SS_Logger Clear %s directory delete failed.",
+ clear_file_path.c_str());
+ }
+
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdClearAllLog,
+ clear_file_path.c_str());
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendLogArtifactResponseToSelf(eArtifactIdClearAllLog)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnNaviLogRequest
+// brief : Callback from LoggerService when the event log file has been xxxxxx BUGBUG
+// from storage. The data received contains the file path.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CErrorEvent::OnNaviLogRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ EFrameworkunifiedStatus naviLog_status;
+ switch (m_errorEventNtfData.EventType) {
+ case eErrorEventTypeProcessCrash:
+ case eErrorEventTypeProcessExit:
+ case eErrorEventTypeHeartBeatFailure:
+ case eErrorEventTypeSystemLowMemory:
+ case eErrorEventTypeBootMicroReset:
+ case eErrorEventTypeModConnFailed:
+ case eErrorEventTypeStartRespFailed:
+ case eErrorEventTypeModuleInvokedResetRequest:
+ case eErrorEventTypeGroupRelaunch:
+ naviLog_status = SaveNaviLog(epssdmsdtGENERIC_ERROR_RESET);
+ break;
+ default:
+ naviLog_status = SaveNaviLog(epssdmsdtNORMAL_RESET);
+ break;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Fail to save Navi Log %d",
+ naviLog_status);
+
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, eArtifactIdNaviLog, "");
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "SendLogArtifactResponseToSelf(eArtifactIdNaviLog)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CErrorEvent::CheckPathForArtifact(HANDLE f_hApp,
+ TLoggingArtifact f_artifact) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+ std::string l_Path;
+
+ if (f_artifact.Information.Cb.Type == eCbTypePath) {
+ l_Path = f_artifact.Information.Cb.Path;
+ if (access(l_Path.c_str(), R_OK) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "File/Directory %s not found. Returning empty string.",
+ l_Path.c_str());
+ l_Path = "";
+ }
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, f_artifact.ArtifactId,
+ l_Path.c_str());
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendLogArtifactResponseToSelf()");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+/* Read all messages remaining in the ring buffer. (allowed for non-root) */
+#define SYSLOG_ACTION_READ_ALL 3
+/* Return size of the log buffer */
+#define SYSLOG_ACTION_SIZE_BUFFER 10
+
+EFrameworkunifiedStatus CErrorEvent::CreateKernelLog(HANDLE f_hApp,
+ SS_LOGGER_KLOG_OPE_TYPE type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int len;
+ int fd;
+ char* buf;
+ ssize_t wr_len;
+
+ len = klogctl(SYSLOG_ACTION_SIZE_BUFFER, NULL, 0);
+ if (len < 0) { // LCOV_EXCL_BR_LINE 5: klogctl's error case
+ // LCOV_EXCL_START 5: klogctl's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to get syslog buffer size: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ buf = reinterpret_cast<char*>(malloc(len));
+ if (buf != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
+ len = klogctl(SYSLOG_ACTION_READ_ALL, buf, len);
+ if ((len < 0) || (len == 0)) { // LCOV_EXCL_BR_LINE 5: klogctl's error case
+ // LCOV_EXCL_START 5: klogctl's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to read syslog buffer: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ std::string file_put_path = "";
+ EArtifactId artifact_id = eArtifactIdMaxValue;
+ switch (type) {
+ case SS_LOGGER_KLOG_GET:
+ file_put_path = KERNEL_LOG_PATH_FN;
+ artifact_id = eArtifactIdKernelLog;
+ fd = open(file_put_path.c_str(),
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
+ break;
+ case SS_LOGGER_KBOOTLOG_CREATE:
+ file_put_path = KERNEL_BOOT_LOG_PATH_FN;
+ artifact_id = eArtifactIdKernelBootLog;
+ fd = open(file_put_path.c_str(),
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
+ break;
+ default:
+ fd = -1;
+ break;
+ }
+
+ if (fd == -1) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error. Failed to open file: %s: %d, %s",
+ file_put_path.c_str(), errno, strerror(errno));
+ } else {
+ wr_len = write(fd, buf, len);
+ if (wr_len == -1) { // LCOV_EXCL_BR_LINE 5: write's error case
+ // LCOV_EXCL_START 5: write's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. File write failed. errno: %d, %s", errno,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ fsync(fd);
+ close(fd);
+
+ if (SS_LOGGER_KLOG_GET == type) {
+ l_eStatus = SendLogArtifactResponseToSelf(f_hApp, artifact_id,
+ file_put_path.c_str());
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "SendLogArtifactResponseToSelf failed. EFrameworkunifiedStatus:%d, ArtifactID:%d, Path:%s",
+ l_eStatus, artifact_id, file_put_path.c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+ free(buf);
+ } else {
+ // LCOV_EXCL_START 5: new's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation Failed %s",
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_storage.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_storage.cpp
new file mode 100755
index 0000000..ffdebe7
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_error_event_storage.cpp
@@ -0,0 +1,628 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_error_event_storage.h"
+#include <stdlib.h>
+#include <sched.h>
+#include <string.h>
+#include <errno.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <string>
+#include "ss_logger_util.h"
+#include "ss_logger_error_event_archive.h"
+#include "ss_logger_fs_directory.h"
+#include "ss_logger_common.h"
+
+CLoggerErrorEventStorage::CLoggerErrorEventStorage()
+ : m_parentMcQueue(NULL),
+ m_thread(-1),
+ m_sendQueue(-1),
+ m_receiveQueue(-1),
+ m_destination(""),
+ m_mutexInit(-1),
+ m_pLoggerCfg(NULL),
+ m_logTime(0) {
+ m_responseVec.clear();
+ m_mqattr.mq_flags = 0;
+ m_mqattr.mq_maxmsg = 1;
+ m_mqattr.mq_msgsize = 32;
+ m_mqattr.mq_curmsgs = 0;
+}
+
+CLoggerErrorEventStorage::~CLoggerErrorEventStorage() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ this->Cleanup();
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerErrorEventStorage::Initialize(HANDLE f_hApp,
+ std::string f_ParentName,
+ CLoggerCfg *f_pLoggerCfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ pthread_attr_t l_attr;
+ struct sched_param l_params;
+
+ /* Open the queue */
+ if (NULL == (m_pLoggerCfg = f_pLoggerCfg)) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ // LCOV_EXCL_START 200:As it is not always NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Parameter f_pLoggerCfg is NULL.");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = m_pLoggerCfg->GetLoggerStorageInfo(m_loggerStorageInfo))) { // LCOV_EXCL_BR_LINE 200:To ensure success // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetLoggerStorageInfo(m_loggerStorageInfo)");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (m_parentMcQueue = McOpenSender(f_ParentName.c_str()))) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. McOpenSender(f_ParentName)");
+ // LCOV_EXCL_STOP
+ } else if (-1 == (this->m_sendQueue = mq_open(m_loggerStorageInfo.Name.c_str(), O_CREAT | O_WRONLY, 0666, &m_mqattr))) { // LCOV_EXCL_BR_LINE 5:C code eror // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. mq_open(ERROR_EVENT_STORAGE_QUEUE_NAME,O_CREAT | O_WRONLY, 0666, NULL)");
+ // LCOV_EXCL_STOP
+ } else if (-1 == (this->m_receiveQueue = mq_open(m_loggerStorageInfo.Name.c_str(), O_RDONLY))) { // LCOV_EXCL_BR_LINE 5:C code eror // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusSessionLimitMaxedOut;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. mq_open(ERROR_EVENT_STORAGE_QUEUE_NAME,O_RDONLY)");
+ // LCOV_EXCL_STOP
+ } else if (EOK != (m_mutexInit = pthread_mutex_init(&this->m_mutex, NULL))) { // LCOV_EXCL_BR_LINE 5:C code eror
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. pthread_mutex_init(&this->m_mutex, NULL)");
+ // LCOV_EXCL_STOP
+ } else if (EOK != pthread_attr_init(&l_attr)) { // LCOV_EXCL_BR_LINE 5:C code eror
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusSemUnlockFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. pthread_attr_init()");
+ // LCOV_EXCL_STOP
+ } else if (EOK != pthread_attr_getschedparam(&l_attr, &l_params)) { // LCOV_EXCL_BR_LINE 5:C code eror
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusSemCloseFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. pthread_attr_getschedparam()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_params.sched_priority = m_loggerStorageInfo.Priority;
+ if (EOK != pthread_attr_setinheritsched(&l_attr, PTHREAD_EXPLICIT_SCHED)) { // LCOV_EXCL_BR_LINE 5:C code eror
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. pthread_attr_setinheritsched()");
+ // LCOV_EXCL_STOP
+ } else if (EOK != pthread_attr_setschedparam(&l_attr, &l_params)) { // LCOV_EXCL_BR_LINE 5:C code eror
+ l_eStatus = eFrameworkunifiedStatusDbResultError;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error but continue. pthread_attr_setschedparam(), priority = %d: %s",
+ m_loggerStorageInfo.Priority, strerror(errno)); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ if (EOK != pthread_create(&this->m_thread, &l_attr, &CLoggerErrorEventStorage::ThreadFunctionWrapper, this)) { // LCOV_EXCL_BR_LINE 5:C code eror // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 5:C code eror
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. pthread_create()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ this->Cleanup(); // LCOV_EXCL_LINE 200:To ensure success
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerErrorEventStorage::Start(
+ std::string f_target, TArtifactResponseVec f_responseVector,
+ uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ /* Start the thread*/
+ if (EOK == pthread_mutex_lock(&this->m_mutex)) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ this->m_destination = f_target;
+ this->m_responseVec = f_responseVector;
+ this->m_logTime = f_time;
+ (void) pthread_mutex_unlock(&this->m_mutex);
+ }
+ UI_8 l_cmd[MAX_QUEUE_MSG_SIZE];
+ l_cmd[0] = 1;
+ if (-1 == mq_send(this->m_sendQueue, reinterpret_cast<CHAR*>(l_cmd), m_mqattr.mq_msgsize, 0)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. mq_send(this->m_sendQueue %d) return %s", m_sendQueue,
+ strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+void CLoggerErrorEventStorage::ThreadFunction(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ char l_data[MAX_QUEUE_MSG_SIZE] = { };
+ SI_32 l_bytesRead = -1;
+ SI_32 l_oldState;
+ ELoggerStorageThreadCommands l_cmdId = eLoggerStorageThreadCmdWriteFailed;
+ EFrameworkunifiedStatus l_eStatus;
+
+ (void) pthread_setname_np(pthread_self(), ERROR_EVENT_STORAGE_QUEUE_NAME);
+
+ pthread_cleanup_push(&CLoggerErrorEventStorage::CleanupWrapper, this);
+ while (-1 // LCOV_EXCL_BR_LINE 200: mq_send can not send size of -1
+ != (l_bytesRead =
+ static_cast<SI_32>(mq_receive(this->m_receiveQueue, reinterpret_cast<char *>(l_data),
+ (size_t) m_mqattr.mq_msgsize, NULL)))) {
+ std::string l_target;
+ TArtifactResponseVec l_responseVec;
+ uint32_t l_logTime;
+ uint8_t status;
+ Clock_getSystemTimeY2K38(&l_logTime, &status);
+ (void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &l_oldState);
+ if (EOK == pthread_mutex_lock(&this->m_mutex)) { // LCOV_EXCL_BR_LINE 5: pthread_mutex_lock's error case.
+ l_target = this->m_destination;
+ l_responseVec = this->m_responseVec;
+ l_logTime = this->m_logTime;
+ this->m_responseVec.clear();
+ this->m_destination = "";
+
+ (void) pthread_mutex_unlock(&this->m_mutex);
+ }
+ (void) pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &l_oldState);
+ if (access(l_target.c_str(), F_OK) == 0) {
+ if (CFSDirectory::IsDirectory(l_target)) { // LCOV_EXCL_BR_LINE 6: can not be a dir
+ // LCOV_EXCL_START 6: new file create, it can not be find
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL isDeleteFiles = FALSE;
+ SI_32 l_filesCopied = this->CopyFiles(l_target, l_responseVec,
+ isDeleteFiles);
+
+ switch (l_filesCopied) {
+ case -1:
+ /*Error while moving files*/
+ l_cmdId = eLoggerStorageThreadCmdWriteFailed;
+ break;
+ case 0:
+ /*No files where moved*/
+ l_cmdId = eLoggerStorageThreadCmdNoWritten;
+ break;
+ default:
+ if (l_filesCopied > 0) {
+ l_cmdId = eLoggerStorageThreadCmdOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. %d files successfully copied.", l_filesCopied);
+ }
+ break;
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = this->PackageAndPlaceArtifacts(l_target,
+ l_responseVec,
+ l_logTime))) {
+ /*Write Error.*/
+ l_cmdId = eLoggerStorageThreadCmdWriteFailed;
+ } else {
+ l_cmdId = eLoggerStorageThreadCmdOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Archive successfully written.");
+ }
+ if (eFrameworkunifiedStatusOK != RemoveDeprecatedArtifacts(l_responseVec)) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_WARN, __FUNCTION__,
+ " Warning. Wasn't able to delete all deprecated log artifacts.");
+ }
+ }
+
+ std::string l_usb_path;
+ size_t l_usb_path_length = 0;
+ if (m_pLoggerCfg != NULL) { // LCOV_EXCL_BR_LINE 6: m_pLoggerCfg can not be null
+ l_usb_path = m_pLoggerCfg->getUsb0MountPath();
+ l_usb_path_length = l_usb_path.length();
+ if ((l_usb_path_length > 1)
+ && (l_usb_path[l_usb_path.length() - 1] == '/')) {
+ l_usb_path_length--;
+ }
+ }
+ if ((l_usb_path_length > 0)
+ && (l_target.compare(0, l_usb_path_length, l_usb_path, 0,
+ l_usb_path_length) != 0)) {
+ l_usb_path_length = 0;
+ }
+ if ((l_usb_path_length == 0)
+ && (l_target.compare(0, sizeof(DEBUG_USB_PATH) - 1, DEBUG_USB_PATH, 0,
+ sizeof(DEBUG_USB_PATH) - 1) == 0)) {
+ l_usb_path = DEBUG_USB_PATH;
+ l_usb_path_length = sizeof(DEBUG_USB_PATH) - 1;
+ }
+ if (l_usb_path_length > 1) { // if USB path is '/' only, length is 1.
+ // So conditions to be syncfs is greater than 1
+ // sync usb device
+ DIR* l_dirp = opendir(l_usb_path.c_str());
+ if (l_dirp != NULL) { // LCOV_EXCL_BR_LINE 5: c code error case
+ int fd = dirfd(l_dirp);
+ if (fd != -1) { // LCOV_EXCL_BR_LINE 5: c code error case
+ if (syncfs(fd) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. syncfs failed path=%s [%s]", l_usb_path.c_str(),
+ strerror(errno));
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. syncfs get fd failed path=%s, [%s]",
+ l_usb_path.c_str(), strerror(errno));
+ }
+ closedir(l_dirp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. syncfs opendir failed path=%s, [%s]",
+ l_usb_path.c_str(), strerror(errno));
+ }
+ {
+#define USB_MEMORY_SYNC_WAITTIME 8 // 8 sec
+ const struct timespec intval = { USB_MEMORY_SYNC_WAITTIME, 0 };
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "%d sec:Waiting for USB Memory Synchronization.(%s)",
+ USB_MEMORY_SYNC_WAITTIME, l_usb_path.c_str());
+ nanosleep(&intval, NULL);
+ }
+ }
+ if (eFrameworkunifiedStatusOK
+ != McSend(this->m_parentMcQueue, m_loggerStorageInfo.Name.c_str(),
+ l_cmdId, 0, NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. McSend(this->m_parentMcQueue)");
+ }
+ }
+ pthread_cleanup_pop(1);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+void CLoggerErrorEventStorage::Cleanup(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (-1 != this->m_receiveQueue) { // LCOV_EXCL_BR_LINE 200: m_receiveQueue cam not be -1
+ if (-1 == mq_close(this->m_receiveQueue)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. mq_close()");
+ }
+ this->m_receiveQueue = -1;
+ }
+ if (-1 != this->m_sendQueue) { // LCOV_EXCL_BR_LINE 200: m_sendQueue cam not be -1
+ if (-1 == mq_close(this->m_sendQueue)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. mq_close()");
+ }
+ this->m_sendQueue = -1;
+ if (-1 == mq_unlink(m_loggerStorageInfo.Name.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. mq_unlink()");
+ }
+ }
+
+ if (-1 != m_mutexInit) { // LCOV_EXCL_BR_LINE 200: m_mutexInit cam not be -1
+ if (EOK != pthread_mutex_destroy(&this->m_mutex)) { // LCOV_EXCL_BR_LINE 5: c code error case
+ // LCOV_EXCL_START 5: c code error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. mq_unlink()");
+ // LCOV_EXCL_STOP
+ }
+ m_mutexInit = -1;
+ }
+
+ if (NULL != m_parentMcQueue) { // LCOV_EXCL_BR_LINE 200: m_parentMcQueue cam not be null
+ if (eFrameworkunifiedStatusOK != McClose(m_parentMcQueue)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. McClose()");
+ }
+ this->m_parentMcQueue = NULL;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+void* CLoggerErrorEventStorage::ThreadFunctionWrapper(void* param) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CLoggerErrorEventStorage* l_pObj =
+ reinterpret_cast<CLoggerErrorEventStorage *>(param);
+
+ l_pObj->ThreadFunction();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return NULL;
+}
+
+void CLoggerErrorEventStorage::CleanupWrapper(void* param) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CLoggerErrorEventStorage* l_pObj =
+ reinterpret_cast<CLoggerErrorEventStorage *>(param);
+
+ l_pObj->Cleanup();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : PackageAndPlaceArtifacts
+// brief : This function creates an archive for all collected artifacts
+// and places the archive in the required location depending
+// on the event type and required naming criteria.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerErrorEventStorage::PackageAndPlaceArtifacts(
+ std::string f_archiveDestination, TArtifactResponseVec &f_responseVector,
+ uint32_t f_logTime) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_coreFileName = "";
+ SI_32 l_ret = 0;
+
+ if (f_archiveDestination.size() == 0) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Unknown package file path and name. Logging artifacts not stored!");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ CErrorEventArchive l_archiver;
+ l_eStatus = l_archiver.openArchive(f_archiveDestination);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: it can not be fail
+ // LCOV_EXCL_START 6: it can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Failed to create logging archive: %s. Log archive will not be stored!",
+ f_archiveDestination.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ for (UI_32 i = 0; (i < f_responseVector.size()); i++) {
+ if (f_responseVector[i].Filepath != std::string("")) {
+ std::string l_destName = f_responseVector[i].Filepath;
+
+ if ((f_responseVector[i].Filepath.find(".bmp") // LCOV_EXCL_BR_LINE 200: no bmp file be set
+ == f_responseVector[i].Filepath.find_last_of('.'))
+ && (f_responseVector[i].Filepath.find(".bmp")
+ != std::string::npos)) {
+ // LCOV_EXCL_START 200: no bmp file be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ char buffer[20];
+ struct tm local_time;
+ Clock_getLocalTimeY2K38(&f_logTime, &local_time);
+ if (0
+ != strftime(buffer, sizeof(buffer), "%Y%m%d%H%M%S.bmp",
+ &local_time)) {
+ l_destName = buffer;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ l_destName = f_responseVector[i].Filepath.substr(
+ f_responseVector[i].Filepath.find_last_of('/') + 1);
+ }
+ if (f_responseVector[i].ArtifactId == eArtifactIdPstoreLog) { // LCOV_EXCL_BR_LINE 200: can not be eArtifactIdPstoreLog // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_destName = KERNEL_LOG_PATH_DIR; // LCOV_EXCL_LINE 200: can not be eArtifactIdPstoreLog
+ }
+ l_eStatus = l_archiver.addToArchive(f_responseVector[i].Filepath,
+ l_destName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200: can not be fail
+ // LCOV_EXCL_START 200: can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. Failed to add artifact: %s to archive %s. Continuing with next artifact.",
+ f_responseVector[i].Filepath.c_str(),
+ f_archiveDestination.c_str());
+ // LCOV_EXCL_STOP
+ }
+ l_ret++;
+ if ((l_ret % m_loggerStorageInfo.TimeoutAfter) == 0) {
+ usleep(m_loggerStorageInfo.Timeout);
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != l_archiver.closeArchive()) { // LCOV_EXCL_BR_LINE 200: closeArchive can not be fail
+ // LCOV_EXCL_START 200: closeArchive can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. l_archiver.closeArchive()");
+ // LCOV_EXCL_STOP
+ } else {
+ // Cleanup artifacts that are no longer required.
+ int rc = access(f_archiveDestination.c_str(), F_OK);
+ if (0 != rc) { // LCOV_EXCL_BR_LINE 5: f_archiveDestination is aways exist
+ // LCOV_EXCL_START 5: f_archiveDestination is aways exist
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Archive verification failed. Errno: %d, %s.", errno,
+ strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ TEXT(__FUNCTION__,
+ " Error Event: A archive successfully written to: %s.",
+ f_archiveDestination.c_str());
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////
+/// File Copy
+/// arg:
+/// isDeleteFiles : TRUE - delete original files after copy.
+/// FALSE - not delete after copy.
+/// returns:
+/// -1: error while writing
+/// else, number of files written
+///////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 8: can not be called
+SI_32 CLoggerErrorEventStorage::CopyFiles(
+ std::string f_destination, TArtifactResponseVec &f_responseVector,
+ BOOL isDeleteFiles) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SI_32 l_ret = 0;
+ BOOL l_isFaile = FALSE;
+ for (UI_32 i = 0; i < f_responseVector.size(); i++) {
+ if (f_responseVector[i].Filepath != "") {
+ if (CFSDirectory::IsDirectory(f_responseVector[i].Filepath)) {
+ DIR * l_pDir = opendir(f_responseVector[i].Filepath.c_str());
+ if (l_pDir == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s",
+ f_responseVector[i].Filepath.c_str());
+ } else {
+ struct dirent l_pDirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_pDir, &l_pDirent, &next) && next != NULL) {
+ if ((0 != strcmp(l_pDirent.d_name, ".")) && /* Ignore special . directory. */
+ (0 != strcmp(l_pDirent.d_name, "..")) && /* Ignore special .. directory. */
+ (0 != strcmp(l_pDirent.d_name, "lost+found")) && /* Ignore lost+found. */
+ ('.' != l_pDirent.d_name[0])) { /* Ignore hidden files */
+ std::string l_fileSource = f_responseVector[i].Filepath;
+ std::string l_fileDestination = f_destination;
+ l_fileSource.append("/");
+ l_fileSource.append(l_pDirent.d_name);
+ l_fileDestination.append("/");
+ l_fileDestination.append(l_pDirent.d_name);
+ EFrameworkunifiedStatus loggerserviceRet = eFrameworkunifiedStatusOK;
+ if (isDeleteFiles == TRUE) {
+ loggerserviceRet = CLoggerUtil::MoveUntyped(l_fileSource,
+ l_fileDestination);
+ } else {
+ loggerserviceRet = CLoggerUtil::CopyUntyped(l_fileSource,
+ l_fileDestination);
+ }
+
+ if (eFrameworkunifiedStatusOK == loggerserviceRet) {
+ l_ret++;
+ if ((l_ret % m_loggerStorageInfo.TimeoutAfter) == 0) {
+ usleep(m_loggerStorageInfo.Timeout);
+ }
+ } else {
+ l_isFaile = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not move: %s",
+ l_fileSource.c_str());
+ }
+ }
+ }
+ (void) closedir(l_pDir);
+ }
+ } else {
+ std::string l_filename = f_responseVector[i].Filepath.substr(
+ f_responseVector[i].Filepath.find_last_of('/'));
+ std::string l_destination = std::string(f_destination).append(
+ l_filename);
+ if (eFrameworkunifiedStatusOK
+ == CLoggerUtil::MoveUntyped(f_responseVector[i].Filepath,
+ l_destination)) {
+ l_ret++;
+ if ((l_ret % m_loggerStorageInfo.TimeoutAfter) == 0) {
+ usleep(m_loggerStorageInfo.Timeout);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not move: %s",
+ f_responseVector[i].Filepath.c_str());
+ l_isFaile = TRUE;
+ }
+ }
+ }
+ }
+ if (l_isFaile)
+ l_ret = -1;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerErrorEventStorage::RemoveDeprecatedArtifacts(
+ TArtifactResponseVec &f_responseVector) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_success = TRUE;
+ for (UI_32 i = 0; i < f_responseVector.size(); i++) {
+ if ((f_responseVector[i].Filepath != "")
+ && (TRUE == f_responseVector[i].Remove)) {
+ if (CFSDirectory::IsDirectory(f_responseVector[i].Filepath)) {
+ if (TRUE
+ != CFSDirectory::RemoveDirectory(f_responseVector[i].Filepath)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. Directory %s failed to be deleted.",
+ f_responseVector[i].Filepath.c_str());
+ l_success &= FALSE;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Directory %s has been successfully deleted.",
+ f_responseVector[i].Filepath.c_str());
+ }
+
+ } else {
+ errno = 0;
+ if (0 != remove(f_responseVector[i].Filepath.c_str())) { // LCOV_EXCL_BR_LINE 5: c code error case
+ // LCOV_EXCL_START 5: c code error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == ENOENT) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. %s not available. Skipping file deletion.",
+ f_responseVector[i].Filepath.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. File %s failed to be deleted.",
+ f_responseVector[i].Filepath.c_str());
+ l_success &= FALSE;
+ }
+ errno = 0;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. File %s has been successfully deleted.",
+ f_responseVector[i].Filepath.c_str());
+ }
+ }
+ }
+ }
+ l_eStatus = (l_success == TRUE) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_fs_directory.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_fs_directory.cpp
new file mode 100755
index 0000000..4cb3996
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_fs_directory.cpp
@@ -0,0 +1,236 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file contains declaration of class CFSDirectory.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_fs_directory.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string>
+#include "loggerservicedebug_loggerservicelog.h"
+#include "ss_logger_types.h"
+#include "ss_logger_util.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFSDirectory
+/// Constructor of CFSDirectory class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFSDirectory::CFSDirectory() { // LCOV_EXCL_START 14:static instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CFSDirectory
+/// Destructor of CFSDirectory class
+////////////////////////////////////////////////////////////////////////////////////////////////////
+CFSDirectory::~CFSDirectory() { // LCOV_EXCL_START 14:static instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// CreateDirectory
+/// Method to create a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CFSDirectory::CreateDirectory(std::string &f_cDirPath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (!f_cDirPath.empty()) { // LCOV_EXCL_BR_LINE 6: f_cDirPath is aways not empty
+ PSTR l_cTempDirPath;
+ PSTR l_cParsedDirPath;
+ PCSTR l_cCopypath = f_cDirPath.c_str();
+
+ l_cTempDirPath = const_cast<PSTR>(f_cDirPath.c_str());
+ while (l_eStatus == eFrameworkunifiedStatusOK
+ && (l_cParsedDirPath = std::strchr(l_cTempDirPath, '/')) != 0) {
+ if (l_cParsedDirPath != l_cTempDirPath) {
+ /* Neither root nor double slash in path */
+ *l_cParsedDirPath = '\0';
+ if (0
+ != mkdir(l_cCopypath,
+ S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+ if (EEXIST != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Cannot Create directory %s",
+ l_cCopypath);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // file already exist
+ }
+ }
+ *l_cParsedDirPath = '/';
+ }
+ l_cTempDirPath = l_cParsedDirPath + 1;
+ }
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (0
+ != mkdir(l_cCopypath,
+ S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+ if (EEXIST != errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Cannot Create directory %s",
+ l_cCopypath);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ // file already exist
+ }
+ }
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_cDirPath is aways not empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "String Empty.");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// DoesDirectoryExist
+/// Method to check if a directory exists.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::DoesDirectoryExist(std::string &f_cDirPath) {
+ DIR* l_pDirDescriptor = opendir(f_cDirPath.c_str());
+ if (NULL != l_pDirDescriptor) {
+ closedir(l_pDirDescriptor);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// IsDirectory
+/// Method to check if the entity is a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::IsDirectory(std::string &f_cPath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReturn = FALSE;
+
+ if (!f_cPath.empty()) { // LCOV_EXCL_BR_LINE 6: f_cPath can not be empty
+ struct stat st_buf;
+ if (-1 == stat(f_cPath.c_str(), &st_buf)) { // LCOV_EXCL_BR_LINE 5: c code.
+ // LCOV_EXCL_START 5: c code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: stat failed for path/file %s, errno %d", f_cPath.c_str(),
+ errno);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ l_bReturn = FALSE;
+ return l_bReturn;
+ // LCOV_EXCL_STOP
+ }
+
+ // Get the status of the file
+ if (S_ISREG(st_buf.st_mode)) {
+ l_bReturn = FALSE; // return false if f_cPath is a regular file
+ }
+ if (S_ISDIR(st_buf.st_mode)) {
+ l_bReturn = TRUE; // return true if f_cPath is a directory
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_cPath can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Pathname empty.");
+ l_bReturn = FALSE;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReturn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveDirectory
+/// Method to remove a directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::RemoveDirectory(std::string &f_cPath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReturn = FALSE;
+
+ if (RemoveSubDirectory(f_cPath)) {
+ // delete the parent directory
+ if (0 == rmdir(f_cPath.c_str())) { // LCOV_EXCL_BR_LINE 5: c code error case
+ l_bReturn = TRUE;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReturn;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// RemoveSubDirectory
+/// Method to remove a sub directory.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+BOOL CFSDirectory::RemoveSubDirectory(std::string &f_cPath) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bReturn = TRUE;
+
+ if (!f_cPath.empty()) { // LCOV_EXCL_BR_LINE 6: f_cPath can not be empty
+ std::string l_cFilePath = "";
+
+ struct dirent l_Dirent;
+ struct dirent* next;
+ DIR *l_pDir = NULL;
+
+ l_pDir = opendir(f_cPath.c_str());
+ if (NULL != l_pDir) { // LCOV_EXCL_BR_LINE 5: c code.
+ if ('/' != f_cPath[f_cPath.length() - 1]) {
+ f_cPath.append("/");
+ }
+
+ while (0 == readdir_r(l_pDir, &l_Dirent, &next) && next != NULL) {
+ if (0 != std::strcmp(l_Dirent.d_name, ".")
+ && 0 != std::strcmp(l_Dirent.d_name, "..")
+ && 0 != std::strcmp(l_Dirent.d_name, "lost+found")) {
+ l_cFilePath.assign(f_cPath);
+ l_cFilePath.append(l_Dirent.d_name); // concatenate the strings to get the complete f_cPath
+
+ if (TRUE == IsDirectory(l_cFilePath)) {
+ l_bReturn = RemoveDirectory(l_cFilePath);
+ } else {
+ // it's a file, we can use unlink
+ if (unlink(l_cFilePath.c_str()) == -1) {
+ l_bReturn = FALSE;
+ }
+ }
+ }
+ }
+ closedir(l_pDir); // close the directory
+ CLoggerUtil::SyncDir(f_cPath);
+ } else {
+ // LCOV_EXCL_START 5: c code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pDir is NULL");
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 6: f_cPath can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Pathname empty.");
+ l_bReturn = FALSE;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bReturn;
+}
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_popups.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_popups.cpp
new file mode 100755
index 0000000..92a5737
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_popups.cpp
@@ -0,0 +1,176 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_popups.h"
+#include <string>
+#include <vector>
+CLoggerPopups::CLoggerPopups()
+ : m_pLoggerCfg(NULL),
+ m_startShown(FALSE) {
+}
+
+CLoggerPopups::~CLoggerPopups() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerPopups::Initialize(CLoggerCfg* f_pLoggerCfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ this->m_pLoggerCfg = f_pLoggerCfg;
+ l_eStatus = (m_pLoggerCfg == NULL) ? eFrameworkunifiedStatusNullPointer : eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+BOOL CLoggerPopups::IsPopupNeeded(TLoggerErrorEvent f_event) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_ret = ((f_event.EventBitMask & EVENT_BIT_POPUP) != 0) ? TRUE : FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+BOOL CLoggerPopups::CanShowStartPopup(
+ std::vector<TLoggingArtifact>* f_remainingArtifact) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_ret = FALSE;
+ if (f_remainingArtifact != NULL) {
+ l_ret = TRUE;
+ std::vector<TLoggingArtifact>::iterator l_iter;
+ for (l_iter = f_remainingArtifact->begin();
+ f_remainingArtifact->end() != l_iter; l_iter++) {
+ if (l_iter->ArtifactId == eArtifactIdScreenShot) {
+ l_ret = FALSE;
+ break;
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+std::string CLoggerPopups::getDeviceName(std::string f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "";
+ if (f_dest.length() == 0) {
+ } else if (f_dest.find(this->m_pLoggerCfg->m_usb0MountPath) != std::string::npos) {
+ l_ret = "USB 1";
+ } else if (f_dest.find(this->m_pLoggerCfg->m_usb1MountPath) != std::string::npos) {
+ l_ret = "USB 2";
+ } else if (f_dest.find(this->m_pLoggerCfg->m_sdMountPath) != std::string::npos) {
+ l_ret = "SD card";
+ } else if (f_dest.find(this->m_pLoggerCfg->m_emmcOutputPath)
+ != std::string::npos) {
+ l_ret = "Emmc";
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. No matching Path found for %s",
+ f_dest.c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %s", l_ret.c_str());
+ return (l_ret);
+}
+
+EFrameworkunifiedStatus CLoggerPopups::ShowStartPopup(
+ HANDLE f_hApp, TLoggerErrorEvent f_event,
+ std::vector<TLoggingArtifact>* f_remainingArtifact, std::string f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (this->m_startShown != FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Pop up already shown");
+ } else if (TRUE != IsPopupNeeded(f_event)) {
+ this->m_startShown = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Start pop up not needed for event %d.",
+ f_event.EventType);
+ } else if (TRUE != CanShowStartPopup(f_remainingArtifact)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Screenshot still in artifact vector.");
+ } else {
+ this->m_startShown = TRUE;
+ STLoggerFolderInfo l_folderInfo;
+ l_folderInfo.FoldernameAndLogname[0] = '\0';
+ std::string l_dest = this->getDeviceName(f_dest);
+ std::size_t l_len = l_dest.copy(l_folderInfo.StorageTarget,
+ sizeof(l_folderInfo.StorageTarget) - 1u, 0);
+ l_folderInfo.StorageTarget[l_len] = '\0';
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. Show start pop up. Destination: %s",
+ l_folderInfo.StorageTarget);
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, SS_LOGGER_LOGSTARTED_EVT,
+ NULL,
+ &l_folderInfo, sizeof(l_folderInfo));
+
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedPublishEvent(SS_LOGGER_LOGSTARTED_EVT)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerPopups::ShowEndPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ std::string f_dest) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ this->m_startShown = FALSE;
+ if (TRUE != IsPopupNeeded(f_event)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. No pop up needed at end of Logging.");
+ } else {
+ STLoggerFolderInfo l_folderInfo;
+ std::size_t l_len = f_dest.copy(
+ l_folderInfo.FoldernameAndLogname,
+ sizeof(l_folderInfo.FoldernameAndLogname) - 1u,
+ f_dest.find_last_of('/') + 1);
+ l_folderInfo.FoldernameAndLogname[l_len] = '\0';
+
+ std::string l_dest = this->getDeviceName(f_dest);
+ l_len = l_dest.copy(l_folderInfo.StorageTarget,
+ sizeof(l_folderInfo.StorageTarget) - 1, 0);
+ l_folderInfo.StorageTarget[l_len] = '\0';
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Show end pop up. Filepath: %s, Device: %s",
+ l_folderInfo.FoldernameAndLogname, l_folderInfo.StorageTarget);
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, SS_LOGGER_LOGINFO_EVT,
+ NULL,
+ &l_folderInfo, sizeof(l_folderInfo));
+
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedPublishEvent(SS_LOGGER_LOGINFO_EVT)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerPopups::ShowErrorPopup(HANDLE f_hApp,
+ TLoggerErrorEvent f_event,
+ UI_16 f_errCode) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_16 l_errorcode = (UI_16) f_errCode;
+ this->m_startShown = FALSE;
+ if (IsPopupNeeded(f_event) == TRUE) {
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, SS_LOGGER_ERRORINFO_EVT,
+ NULL,
+ &l_errorcode, sizeof(l_errorcode));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedPublishEvent(SS_LOGGER_ERRORINFO_EVT)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_reader_writer_control.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_reader_writer_control.cpp
new file mode 100755
index 0000000..692cab8
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_reader_writer_control.cpp
@@ -0,0 +1,151 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * ss_logger_reader_writer_control.cpp
+ */
+#include "ss_logger_reader_writer_control.h"
+#include <boost/bind.hpp>
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_transmit_log.h>
+#include <native_service/ns_logger_if.h>
+#include <string>
+#include "ss_logger_common.h"
+
+#define LOGGERSERVICELOG_REMOTE_IP_PORT 3500
+#define TRANSMIT_REMOTE_IP_PORT 3500
+
+CReaderWriterControl::CReaderWriterControl()
+ : m_pLoggerCfg(NULL) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+}
+
+CReaderWriterControl::~CReaderWriterControl() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CReaderWriterControl::Initialize(CLoggerCfg * f_pLoggerCfg) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (NULL != f_pLoggerCfg) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ this->m_pLoggerCfg = f_pLoggerCfg;
+
+ l_eStatus = m_debugReaderWriter.Initialize( // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ f_pLoggerCfg, ReaderWriter::eReaderWriterTypeMem, std::string(FRAMEWORKUNIFIEDLOG_SHAREDMEM_NAME),
+ FRAMEWORKUNIFIEDLOG_SHAREDMEM_SIZE, ReaderWriter::eReaderWriterTypeUdp,
+ std::string("169.254.80.9"), LOGGERSERVICELOG_REMOTE_IP_PORT, "", 0); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ l_eStatus = m_debugReaderWriter.Start(std::string("pdg.LogQueR"));
+ }
+
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus, "m_debugReaderWriter.Start(std::string(pdg.TransQueR)");
+
+
+ l_eStatus = m_transmitReaderWriter.Initialize( // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ f_pLoggerCfg, ReaderWriter::eReaderWriterTypeMem,
+ std::string(TRANSMIT_LOG_SHAREDMEM_NAME), TRANSMIT_LOG_SHAREDMEM_SIZE,
+ ReaderWriter::eReaderWriterTypeUdp, std::string("169.254.80.9"),
+ TRANSMIT_REMOTE_IP_PORT, "", 0); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 6:it can not be fail
+ l_eStatus = m_transmitReaderWriter.Start(std::string("pdg.TransQueR")); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus, "m_transmitReaderWriter.Start(std::string(pdg.TransQueR)");
+
+
+ l_eStatus = m_performanceReaderWriter.Initialize( // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ f_pLoggerCfg, ReaderWriter::eReaderWriterTypeQueue, std::string("/NSplog"), 0,
+ ReaderWriter::eReaderWriterTypeFile, std::string(PERFORMANCE_LOG_PATH_FN),
+ f_pLoggerCfg->m_performanceLogMaxFileSize, std::string("169.254.80.9"),
+ 0); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 6:it can not be fail
+ l_eStatus = m_performanceReaderWriter.Start(
+ std::string("pdg.PerformQueR")); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus,
+ "m_performanceReaderWriter.Start(std::string(pdg.PerformQueR)");
+
+
+ this->m_pLoggerCfg->AddLoggingParamCB(
+ boost::bind(&CReaderWriterControl::UpdateLoggingParams, this, _1));
+ }
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CReaderWriterControl::UpdateLoggingParams(void* param) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = this->m_debugReaderWriter.UpdateLoggingParameters();
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15:macro
+ "this->m_debugReaderWriter.UpdateLoggingParameters()");
+
+ l_eStatus = this->m_transmitReaderWriter.UpdateLoggingParameters();
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus, "this->m_transmitReaderWriter.UpdateLoggingParameters()");
+
+ l_eStatus = this->m_performanceReaderWriter.UpdateLoggingParameters();
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus,
+ "this->m_performanceReaderWriter."
+ "UpdateLoggingParameters()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CReaderWriterControl::FlushCache(EReaderWriterType f_type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldParam;
+ switch (f_type) { // LCOV_EXCL_BR_LINE 8: eReaderWriterLogDebug and eReaderWriterLogInvalid can not be called
+ // LCOV_EXCL_START 8: dead code
+ case eReaderWriterLogDebug:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = this->m_debugReaderWriter.FlushCache(
+ std::string(DEBUG_LOG_PATH_FN));
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "this->m_debugReaderWriter.FlushCache(DEBUG_LOG_PATH_FN)");
+ break;
+ // LCOV_EXCL_STOP
+ case eReaderWriterLogTransmit:
+ l_eStatus = this->m_transmitReaderWriter.FlushCache(
+ std::string(TRANSMIT_LOG_PATH_FN));
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "this->m_debugReaderWriter.FlushCache(TRANSMIT_LOG_PATH_FN)");
+ break;
+
+ case eReaderWriterLogPerformance:
+ l_eStatus = this->m_performanceReaderWriter.FlushCache(
+ std::string(PERFORMANCE_LOG_PATH_FN));
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "this->m_debugReaderWriter.FlushCache(PERFORMANCE_LOG_PATH_FN)");
+ break;
+ // LCOV_EXCL_START 8: dead code
+ case eReaderWriterLogInvalid:
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : %d", l_eStatus);
+ return (l_eStatus);
+}
+
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_server_callbacks.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_server_callbacks.cpp
new file mode 100755
index 0000000..82a677b
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_server_callbacks.cpp
@@ -0,0 +1,900 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief This file contains the callback for Notifications and Protocol
+/// commands.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_service_callbacks.h"
+#include <string.h>
+#include <boost/bind.hpp>
+#include <errno.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_logger_service.h>
+#include <ss_logger_common.h>
+#include <system_service/ss_logger_service_notifications.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/nslogutil_cmd_if.h>
+#include <system_service/ss_sm_client_if.h>
+#include <queue>
+#include <new>
+#include <string>
+#include "ss_logger_error_event.h"
+#include "loggerservicedebug_loggerservicelog.h"
+#include "loggerservicedebug_thread_if.h"
+extern CErrorEvent g_errorEventHandler;
+extern HANDLE g_thrdEvntLogWriter;
+
+// Global variables
+STCanCurrentDateTime g_stDateAndTime = { 0 };
+UEvtLoggerCommonInfo g_uEvtLoggerCommonInfo;
+UI_16 g_u16DiagId = 0;
+
+CLoggerServiceCallbacks::CLoggerServiceCallbacks()
+ : m_pLoggerCfg(NULL),
+ m_pErrorEvent(NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FrameworkunifiedProtocolCallbackHandler l_protocolHandlers[kNUMBER_PROTOCOL_HANDLERS] =
+ { { SS_LOGGER_MILEAGE_DATA, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_SetMileageData, this, _1) },
+ { SS_LOGGER_SET_PARAMS, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_SetLoggerParams, this, _1) },
+ { SS_LOGGER_UDP_LOGGING, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_UDPLogging, this, _1) },
+ { SS_LOGGERCOPYEVENTUSB, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnCopyEvntLog, this,_1) },
+ { SS_LOGGERCLEAREVENT, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnClearEvntLog, this, _1) },
+ { SS_LOGGER_READ_STATL_COUNTER, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnReadStatCounter, this, _1) },
+ { SS_LOGGER_EVENT_COMMONINFO, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_UpdateCommonInfo, this, _1) },
+ { SS_LOGGER__CWORD56__EVENT_INFO, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_Handle_CWORD56_Events, this, _1) },
+ { SS_LOGGER_RESET_STATL_COUNTER, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnResetStatCounter, this, _1) },
+ { SS_LOGGER_SET_VIN, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnSetVIN, this, _1) },
+ { SS_LOGGERCOPYEMERGENCYLOGS, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnCopyEmergencyLog, this, _1) },
+ { eSSLoggerCANProtocolIDCANTrigger, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnCANTrigger, this, _1) },
+ { eSSLoggerCANProtocolIDDTCTrigger, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnDTCTrigger, this, _1) },
+ { SS_LOGGER_SHUTDOWN_COMPLETE, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_On_SHTDWN_Complete, this, _1) },
+ { SS_LOGGER_ENG_READ_NUMOFEVENTS, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnReadNumberOfEvents, this, _1) },
+ { SS_LOGGER_SET_DIAGID, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_OnSetDiagID, this, _1) },
+ { SS_LOGGER_UPLOAD_EVENTLOG, boost::bind(
+ &CLoggerServiceCallbacks::LoggerServer_UploadEventLog, this, _1) } }; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+
+ for (UI_8 i = 0u; i < kNUMBER_PROTOCOL_HANDLERS; i++) {
+ m_protocolHandlers[i].iCmd = l_protocolHandlers[i].iCmd;
+ m_protocolHandlers[i].callBack = l_protocolHandlers[i].callBack; // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+CLoggerServiceCallbacks::~CLoggerServiceCallbacks() { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::Initialize(HANDLE f_hApp,
+ CLoggerCfg *f_pLoggerCfg,
+ CErrorEvent* f_pErrorEvent) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ m_pLoggerCfg = f_pLoggerCfg;
+ m_pErrorEvent = f_pErrorEvent;
+
+ if ((NULL == m_pLoggerCfg) || (NULL == m_pErrorEvent)) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ // LCOV_EXCL_START 200:As it is always TRUE
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "NULL pointer passed to Initialize function!!!!!");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ } else {
+ // Attach callback : Open Session Request
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(f_hApp, FRAMEWORKUNIFIED_ANY_SOURCE, PROTOCOL_OPEN_SESSION_REQ, boost::bind(&CLoggerServiceCallbacks::LoggerServerOnOpenSession, this, _1)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher PROTOCOL_OPEN_SESSION_REQ (FRAMEWORKUNIFIED_ANY_SOURCE) Failed Status:0x%x ",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else if ( eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(f_hApp, NTFY_SS_LoggerService_Availability))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set service availability notification:0x%x ", l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+//////////////////////////////////////////
+// Function : DevDetectionServerOnOpenSession
+// Callback for PROTOCOL_OPEN_SESSION_REQ
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServerOnOpenSession(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ HANDLE l_hClientService = NULL;
+ HANDLE l_hSession = NULL;
+
+ // Get the requester name
+ PCSTR pRequester = FrameworkunifiedGetMsgSrc(hApp);
+ OpenSessionAck tOpenAck;
+
+ if (pRequester) { // LCOV_EXCL_BR_LINE 4:NSFW
+ l_hClientService = FrameworkunifiedMcOpenSender(hApp, pRequester);
+
+ if (l_hClientService) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // Create a session
+ l_hSession = FrameworkunifiedCreateSession(hApp, pRequester);
+ UI_32 l_nSessionId = 0;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher( hApp, pRequester, m_protocolHandlers, kNUMBER_PROTOCOL_HANDLERS, l_hSession))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __PRETTY_FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher ss_logger_server_protocol_handlers Failed Status:0x%x ",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = this->m_pErrorEvent->OnOpenSession(hApp, pRequester,
+ l_hSession);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_pErrorEvent->OnOpenSession(%s, %p) returned: %d.",
+ pRequester, l_hSession, l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ // Attach callback : close Session Request
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, pRequester, PROTOCOL_CLOSE_SESSION_REQ, boost::bind(&CLoggerServiceCallbacks::LoggerServerOnCloseSession, this, _1)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "FrameworkunifiedAttachCallbackToDispatcher " "PROTOCOL_CLOSE_SESSION_REQ (FRAMEWORKUNIFIED_ANY_SOURCE) Failed Status:0x%x ",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ l_nSessionId = FrameworkunifiedGetSessionId(l_hSession);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Session id is %d", l_nSessionId); // LCOV_EXCL_BR_LINE 15:macro
+ // sending the session open
+ tOpenAck.eStatus = eFrameworkunifiedStatusOK;
+ tOpenAck.sessionId = l_nSessionId;
+ tOpenAck.sessionType = 1;
+
+ // Copy session name to data structure
+ strncpy(tOpenAck.cSessionName, FrameworkunifiedGetAppName(hApp),
+ MAX_QUEUE_NAME_SIZE - 1);
+ tOpenAck.cSessionName[MAX_QUEUE_NAME_SIZE - 1] = '\0';
+
+ // send OpenSession ACK
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(l_hClientService, PROTOCOL_OPEN_SESSION_ACK, sizeof(OpenSessionAck), (PVOID) &tOpenAck))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "FrameworkunifiedSendMsg PROTOCOL_OPEN_SESSION_ACK Failed Status:0x%x ",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = FrameworkunifiedSetSessionHandle(hApp, FrameworkunifiedGetMsgSrc(hApp), l_hSession);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSessionHandle()"); // LCOV_EXCL_BR_LINE 15:macro
+ }
+ }
+ l_eStatus = FrameworkunifiedMcClose(l_hClientService);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedMcClose()"); // LCOV_EXCL_BR_LINE 15:macro
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+// Function : DevDetectionServerOnCloseSession
+// Callback for PROTOCOL_CLOSE_SESSION_REQ
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServerOnCloseSession(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ HANDLE hSession = NULL;
+ HANDLE l_hClientService = NULL;
+ // Get the requester name
+ PCSTR pRequester = FrameworkunifiedGetMsgSrc(hApp);
+ CloseSessionAck tCloseAck;
+ CloseSessionReq tClose;
+
+ if (pRequester) { // LCOV_EXCL_BR_LINE 4:NSFW
+ l_hClientService = FrameworkunifiedMcOpenSender(hApp, pRequester);
+ if (l_hClientService) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // Read the data from the message
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tClose, sizeof(tClose), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize Failed");
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(l_hClientService))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedMcClose failed");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+ // LCOV_EXCL_STOP
+ }
+
+ hSession = FrameworkunifiedGetSessionHandle(hApp, pRequester, tClose.sessionId);
+
+ // Create a list of commands to be detached from the dispatcher
+ UI_32 cmd_array[kNUMBER_PROTOCOL_HANDLERS] = { 0 };
+ for (UI_32 i = 0; i < kNUMBER_PROTOCOL_HANDLERS; i++) {
+ cmd_array[i] = m_protocolHandlers[i].iCmd;
+ }
+
+ if (NULL != hSession) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // Detach callbacks associated with client
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hApp, pRequester, cmd_array, kNUMBER_PROTOCOL_HANDLERS, hSession))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __PRETTY_FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher ss_logger_server_protocol_handlers Failed Status:0x%x ",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ eStatus = m_pErrorEvent->OnCloseSession(hApp, pRequester, hSession);
+ if (eFrameworkunifiedStatusOK != eStatus) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_pErrorEvent->OnCloseSession(%s, %p) returned: %d.",
+ pRequester, hSession, eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ // API to destroy the session handle and remove it from the Application Framework.
+ // LCOV_EXCL_BR_START 4:NSFW
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroySession(hApp, // Application Handle
+ hSession))) { // Session Handle
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session destroy failed");
+ // LCOV_EXCL_STOP
+ }
+ }
+ // sending the session close ack
+ tCloseAck.eStatus = eFrameworkunifiedStatusOK;
+ tCloseAck.sessionId = tClose.sessionId;
+
+ // send CloseSession ACK
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(l_hClientService, PROTOCOL_CLOSE_SESSION_ACK, sizeof(CloseSessionAck), (PVOID) &tCloseAck))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "FrameworkunifiedSendMsg PROTOCOL_CLOSE_SESSION_ACK Failed Status:0x%x ",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(l_hClientService))) { // LCOV_EXCL_BR_LINE 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedMcClose failed"); // LCOV_EXCL_LINE 15:macro
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : LoggerServer_SetMileageData
+// Callback for SS_LOGGER_MILEAGE_DATA
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_SetMileageData(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ STLOGGER_CANDIAGSTAT MileageInfo_t;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ memset(&MileageInfo_t, 0x00, sizeof(STLOGGER_CANDIAGSTAT));
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &MileageInfo_t, sizeof(MileageInfo_t), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ UI_32 l_mileage = (MileageInfo_t.Odo_MSB_H << 24
+ | MileageInfo_t.Odo_MSB_L << 16 | MileageInfo_t.Odo_LSB_H << 8
+ | MileageInfo_t.Odo_LSB_L);
+ // if value set to SNA
+ if (0xFFFFFFFF != l_mileage) {
+ this->m_pErrorEvent->SetMileage(l_mileage);
+ // Immediate Persist Event Log
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, eThrdCmdMileageData, sizeof(UI_32), &l_mileage))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendChild msg failed:%d", l_eStatus); // LCOV_EXCL_LINE 15:macro
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+//////////////////////////////////////////
+// Function : LoggerServer_SetLoggerParams
+// Callback for SS_LOGGER_SET_PARAMS
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_SetLoggerParams(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ STLoggerSetParams l_stLoggerSetParams = { eInvalid_LoggerState, eDevUSB1 };
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_stLoggerSetParams, sizeof(l_stLoggerSetParams), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize Failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+ // LCOV_EXCL_STOP
+ } else {
+ eStatus = m_pLoggerCfg->SetLoggingParams(hApp, l_stLoggerSetParams);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : LoggerServer_SetLoggerParams
+// Callback for SS_LOGGER_SET_PARAMS
+//////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_UDPLogging(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ELOGGER_STAT l_eUDPLoggingStatus = eInvalid_LoggerState;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_eUDPLoggingStatus, sizeof(l_eUDPLoggingStatus), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize Failed");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = m_pLoggerCfg->SetUDPLogging(hApp, l_eUDPLoggingStatus);
+ LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15:macro
+ l_eStatus,
+ "m_pLoggerCfg->SetUDPLogging()");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_UpdateCommonInfo(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &g_uEvtLoggerCommonInfo.u_stEvtLoggerCommonInfo, sizeof(g_uEvtLoggerCommonInfo.u_stEvtLoggerCommonInfo), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_Handle_CWORD56_Events(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ STEventLoggerEventInfo l_stEventLoggingEventInfo;
+ UI_16 l_evtid = 0;
+
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_stEventLoggingEventInfo, sizeof(l_stEventLoggingEventInfo), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
+ eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+ l_evtid = static_cast<UI_16>(((l_stEventLoggingEventInfo.EventGroup & 0x00FF) << 8)
+ | (l_stEventLoggingEventInfo.EventIdentifier & 0x00FF));
+ FRAMEWORKUNIFIEDLOG_EVT(ZONE_INFO, l_evtid, 4, l_stEventLoggingEventInfo.EventData[3],
+ l_stEventLoggingEventInfo.EventData[2],
+ l_stEventLoggingEventInfo.EventData[1],
+ l_stEventLoggingEventInfo.EventData[0]);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnCopyEmergencyLog(
+ HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EDevNumber l_eDevNumber;
+ std::string l_path = "";
+ std::string l_srcName = "";
+
+ if (NULL != f_hApp) { // LCOV_EXCL_BR_LINE 6: it can't be null.
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(f_hApp);
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 6: it can't be null.
+ l_srcName = l_tmp_srcname;
+ }
+
+ if (eFrameworkunifiedStatusOK
+ == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_eDevNumber,
+ sizeof(l_eDevNumber), eSMRRelease))) {
+ switch (l_eDevNumber) {
+ case eEEL_USB1:
+ l_path = m_pLoggerCfg->m_usb0MountPath;
+ break;
+
+ case eEEL_USB2:
+ l_path = m_pLoggerCfg->m_usb1MountPath;
+ break;
+
+ case eEEL_SD:
+ l_path = m_pLoggerCfg->m_sdMountPath;
+ break;
+
+ default:
+ /*send back error response wrong param*/
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Could not get msg Data.");
+ }
+
+ HANDLE l_hSession = NULL;
+ if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(f_hApp))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ m_pErrorEvent->SetDiagSessionHandle(l_hSession);
+ }
+ if (0 == l_srcName.length()) { // LCOV_EXCL_BR_LINE 6: it can't be 0.
+ // LCOV_EXCL_START 6: it can't be 0.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Could not get name of source service.");
+ // LCOV_EXCL_STOP
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ } else if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Invalid parameter l_eDevNumber(%d).", l_eDevNumber);
+ l_eStatus = m_pErrorEvent->sendDiagEventErrorResponse(eNO_ERROR_INFO,
+ l_srcName);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_pErrorEvent->sendDiagEventErrorResponse(l_srcName)");
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = m_pErrorEvent->SetDiagEventSourceName(l_srcName))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. m_pErrorEvent->SetDiagEventSourceName() returned %d.", l_eStatus);
+ l_eStatus = m_pErrorEvent->sendDiagEventErrorResponse(eNO_ERROR_INFO,
+ l_srcName);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_pErrorEvent->sendDiagEventErrorResponse(l_srcName)");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus =
+ SendDiagLoggingRequestToSystemManager(l_path))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* call System Manager interface*/
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. SendDiagLoggingRequestToSystemManager() returned %d.", l_eStatus);
+ l_eStatus = m_pErrorEvent->sendDiagEventErrorResponse(eNO_ERROR_INFO);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_pErrorEvent->sendDiagEventErrorResponse()");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Log Request passed to SystemManager.");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnCANTrigger(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = SendCANLoggingRequestToSystemManager();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendCANLoggingRequestToSystemManager()"); // LCOV_EXCL_BR_LINE 15:macro
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnDTCTrigger(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_dtc;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_dtc, sizeof(l_dtc), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Could not get msg Data.");
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = SendDTCLoggingRequestToSystemManager(l_dtc);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "SendDTCLoggingRequestToSystemManager(dtc)"); // LCOV_EXCL_BR_LINE 15:macro
+ // Immediate Persist Event Log
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(f_hApp, g_thrdEvntLogWriter, eThrdCmdImmPersistEvtLog, 0x00, NULL))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendChild msg failed:%X", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_On_SHTDWN_Complete(
+ HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ l_eStatus = LoggerService_OnStop(f_hApp);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "LoggerService_OnStop()"); // LCOV_EXCL_BR_LINE 15:macro
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnSetVIN
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnSetVIN(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ STVIN_NUMBER l_stVIN_Number;
+
+ if (eFrameworkunifiedStatusOK == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_stVIN_Number, sizeof(l_stVIN_Number), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, eThrdCmdSetVINnumber, sizeof(STVIN_NUMBER), &l_stVIN_Number))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendChild msg failed:%X", l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize failed errval: %X",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnCopyEvntLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnCopyEvntLog(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ TWriteFilesToUsbCmdData l_stCmdData;
+ HANDLE l_hSession = NULL;
+
+ if (hApp != NULL) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ l_stCmdData.stSessiondata.strSrcName = l_tmp_srcname;
+ }
+ if (l_stCmdData.stSessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ // LCOV_EXCL_START 6: it can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_stCmdData.stSessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<EEvtLogUSBDevNumber>(hApp, l_stCmdData.eDevId))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, // LCOV_EXCL_BR_LINE 4:NSFW
+ eThrdCmdWriteEvntFilesToUsb,
+ sizeof(TWriteFilesToUsbCmdData),
+ &l_stCmdData))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()"); // LCOV_EXCL_LINE 4:NSFW
+ }
+ }
+ }
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid App handler"); // LCOV_EXCL_LINE 6: it can not be null
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnClearEvntLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnClearEvntLog(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (hApp != NULL) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ TSessionData l_sessiondata;
+ HANDLE l_hSession = NULL;
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 4:NSFW
+ l_sessiondata.strSrcName = l_tmp_srcname;
+ }
+ if (l_sessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 4:As it is guaranteed by NSFW and is not always an empty string
+ // LCOV_EXCL_START 4:As it is guaranteed by NSFW and is not always an empty string
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_sessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, eThrdCmdClearEvntLogs, sizeof(TSessionData), &l_sessiondata))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()");
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnReadStatCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnReadStatCounter(
+ HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (hApp != NULL) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ TStatisticalCountersCmd l_stCmdData;
+ HANDLE l_hSession = NULL;
+
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ l_stCmdData.stSessiondata.strSrcName = l_tmp_srcname;
+ }
+ if (l_stCmdData.stSessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_stCmdData.stSessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<EStatCounterGroupID>(hApp,
+ l_stCmdData.eGroupId))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, // LCOV_EXCL_BR_LINE 4:NSFW
+ eThrdCmdStatisticalCounter,
+ sizeof(TStatisticalCountersCmd),
+ &l_stCmdData))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()");// LCOV_EXCL_LINE 4:NSFW
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnResetStatCounter
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnResetStatCounter(
+ HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (hApp != NULL) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ TStatisticalCountersCmd l_stCmdData;
+ HANDLE l_hSession = NULL;
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ l_stCmdData.stSessiondata.strSrcName = l_tmp_srcname;
+ }
+ if (l_stCmdData.stSessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_stCmdData.stSessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg<EStatCounterGroupID>(hApp,
+ l_stCmdData.eGroupId))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, // LCOV_EXCL_BR_LINE 4:NSFW
+ eThrdCmdResetStatisticalCntrs,
+ sizeof(TStatisticalCountersCmd),
+ &l_stCmdData))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()"); // LCOV_EXCL_LINE 4:NSFW
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnReadNumberOfEvents
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnReadNumberOfEvents(
+ HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSessionData l_sessiondata;
+ HANDLE l_hSession = NULL;
+
+ l_sessiondata.strSrcName = FrameworkunifiedGetMsgSrc(hApp);
+ if (l_sessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_sessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, // LCOV_EXCL_BR_LINE 4:NSFW
+ eThrdCmdGetNumberOfEventsLogged,
+ sizeof(TSessionData), &l_sessiondata))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()"); // LCOV_EXCL_LINE 4:NSFW
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_OnSetDiagID
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnSetDiagID(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_16 l_DiagId = 0;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<UI_16>(hApp, l_DiagId))) { // LCOV_EXCL_BR_LINE 200:To ensure success
+ // LCOV_EXCL_START 200:To ensure success
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP
+ } else {
+ g_u16DiagId = l_DiagId;
+ }
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Function :LoggerServer_UploadEventLog
+///////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_UploadEventLog(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSessionData l_sessiondata;
+ HANDLE l_hSession = NULL;
+
+ PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
+ if (NULL != l_tmp_srcname) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ l_sessiondata.strSrcName = l_tmp_srcname;
+ }
+ if (l_sessiondata.strSrcName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ // LCOV_EXCL_START 6: it can not be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetMsgSrc()");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) { // LCOV_EXCL_BR_LINE 6: it can not be null
+ // LCOV_EXCL_START 6: it can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
+ // LCOV_EXCL_STOP
+ } else {
+ l_sessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, // LCOV_EXCL_BR_LINE 4:NSFW
+ eThrdCmdUploadEventLog,
+ sizeof(TSessionData), &l_sessiondata))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()"); // LCOV_EXCL_LINE 4:NSFW
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
diff --git a/video_in_hal/systemservice/logger_service/server/src/ss_logger_util.cpp b/video_in_hal/systemservice/logger_service/server/src/ss_logger_util.cpp
new file mode 100755
index 0000000..6ac7225
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/ss_logger_util.cpp
@@ -0,0 +1,1273 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief Provide support for SS Logger module utility functions.
+///
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_logger_util.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stub/Clock_API.h>
+#include <iomanip>
+#include <sstream>
+#include <string>
+#include <algorithm>
+#include <vector>
+#include "ss_logger_common.h"
+
+#include <system_service/ss_logger_store_logs.h>
+
+#define SS_STORE_FILENAME_SYSILG_TERM "_SYS_ILG_RESET.tar.gz"
+#define SS_STORE_FILENAME__CWORD52__TERM "__CWORD52_.log"
+
+
+char CLoggerUtil::m_usbpath[USB_PATH_SIZE];
+
+///////////////////////////////////////////////////////////////////////////////
+// CLASS METHODS
+///////////////////////////////////////////////////////////////////////////////
+CLoggerUtil::CLoggerUtil(void)
+ : m_pCfg(NULL),
+ m_Milage(0),
+ m_bootCount(0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_usbpath[0] = '\0';
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+CLoggerUtil::~CLoggerUtil(void) { // LCOV_EXCL_START 14:globle instance
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerUtil::Initialize(CLoggerCfg *f_pLoggerCfg) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ m_pCfg = f_pLoggerCfg;
+ l_eStatus = (NULL != f_pLoggerCfg) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusInvldParam;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+std::string CLoggerUtil::getDestination(TLoggerErrorEvent &f_eventNtfData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+: %d ", f_eventNtfData.EventType);
+ std::string l_path = "";
+ EFrameworkunifiedStatus l_eStatus;
+
+ switch (f_eventNtfData.EventType) {
+ case eErrorEventTypeProcessCrash:
+ case eErrorEventTypeHeartBeatFailure:
+ case eErrorEventTypeSystemLowMemory:
+ case eErrorEventTypeBootMicroReset:
+ case eErrorEventTypeProcessExit:
+ case eErrorEventTypeUserInvokedUserForceReset:
+ case eErrorEventTypeModConnFailed:
+ case eErrorEventTypeStartRespFailed:
+ case eErrorEventTypeUserInvokedCollectDevLogs:
+ case eErrorEventTypeModuleInvokedResetRequest:
+ case eErrorEventTypeModuleInvokedCollectDebugLogs:
+ case eErrorEventTypeDtcEvent:
+ case eErrorEventTypeUserInvokedClearLogs:
+ case eErrorEventTypeGroupRelaunch:
+ l_eStatus = m_pCfg->GetEmmcDestination(l_path);
+ break;
+
+ case eErrorEventTypeUserInvokedCollectNaviLog:
+ l_eStatus = m_pCfg->GetEmmcNaviLogDestination(l_path);
+ break;
+
+ case eErrorEventTypeEelExport:
+ l_path = f_eventNtfData.ModuleName;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ case eErrorEventTypeInterfaceunifiedEmmcLogs:
+ l_path = f_eventNtfData.ModuleName;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeCanEvent:
+ l_eStatus = m_pCfg->GetUserInvokedDestination(l_path);
+ break;
+
+ case eErrorEventTypeDiagEvent:
+ l_path = f_eventNtfData.ModuleName;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ default:
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Could not get filepath ");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %s", l_path.c_str());
+ return (l_path);
+}
+EFrameworkunifiedStatus CLoggerUtil::checkDestinationAvailable(
+ TLoggerErrorEvent &f_eventNtfData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string l_path = CLoggerUtil::getDestination(f_eventNtfData);
+ std::string::size_type ret;
+
+ if (l_path.length() > 0) {
+ ret = l_path.find(DEBUG_USB_PATH);
+ if (ret != std::string::npos && ret == 0) {
+ if (0 == access(m_usbpath, W_OK)) { // LCOV_EXCL_BR_LINE 5:C code
+ // LCOV_EXCL_START 5:C code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::string path = l_path.substr(sizeof(DEBUG_USB_PATH) - 1);
+ f_eventNtfData.ModuleName = m_usbpath;
+ f_eventNtfData.ModuleName.append(path);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ if (0 == access(l_path.c_str(), W_OK)) { // LCOV_EXCL_BR_LINE 5:C code
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Failed the check path: l_eStatus(%d), l_path(%s)",
+ l_eStatus, l_path.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+static void SetSuffixFromType(std::string &pathAndName, EErrorEventType type) { // NOLINT (runtime/references)
+ switch (type) {
+ case eErrorEventTypeProcessCrash:
+ case eErrorEventTypeHeartBeatFailure:
+ case eErrorEventTypeSystemLowMemory:
+ case eErrorEventTypeBootMicroReset:
+ case eErrorEventTypeProcessExit:
+ case eErrorEventTypeModConnFailed:
+ case eErrorEventTypeStartRespFailed:
+ case eErrorEventTypeModuleInvokedResetRequest:
+ pathAndName.insert(pathAndName.find(".tar.gz"), "_ERR");
+ break;
+ case eErrorEventTypeUserInvokedUserForceReset:
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeDiagEvent:
+ case eErrorEventTypeCanEvent:
+ case eErrorEventTypeDtcEvent:
+ case eErrorEventTypeModuleInvokedCollectDebugLogs:
+ pathAndName.insert(pathAndName.find(".tar.gz"), "_DIAG");
+ break;
+ case eErrorEventTypeUserInvokedCollectDevLogs:
+ pathAndName.insert(pathAndName.find(".tar.gz"), "_DEBUG");
+ break;
+ case eErrorEventTypeGroupRelaunch:
+ pathAndName.insert(pathAndName.find(".tar.gz"), "_GRP_RELAUNCH");
+ break;
+ default:
+ break;
+ }
+}
+
+EFrameworkunifiedStatus CLoggerUtil::getFilePathAndName(HANDLE f_hApp,
+ TLoggerErrorEvent &f_eventNtfData,
+ uint32_t f_time,
+ std::string &f_pathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ f_pathAndName = "";
+
+ switch (f_eventNtfData.EventType) { // LCOV_EXCL_BR_LINE 200: eErrorEventTypeEelExport ex. can not be run
+ case eErrorEventTypeProcessCrash:
+ case eErrorEventTypeProcessExit:
+ case eErrorEventTypeHeartBeatFailure:
+ case eErrorEventTypeSystemLowMemory:
+ case eErrorEventTypeBootMicroReset:
+ case eErrorEventTypeModConnFailed:
+ case eErrorEventTypeStartRespFailed:
+ case eErrorEventTypeGroupRelaunch:
+ l_eStatus = m_pCfg->GetEmmcDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6:it will aways return ok
+ // LCOV_EXCL_START 6:it will aways return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetEmmcDestination() returned %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetEmmcFilename(f_time));
+ }
+ break;
+
+ case eErrorEventTypeUserInvokedUserForceReset:
+ case eErrorEventTypeUserInvokedCollectDevLogs:
+ l_eStatus = m_pCfg->GetEmmcDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6:it will aways return ok
+ // LCOV_EXCL_START 6:it will aways return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetEmmcDestination() returned %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetEmmcFilename(f_time));
+ }
+ break;
+ case eErrorEventTypeModuleInvokedResetRequest:
+ case eErrorEventTypeModuleInvokedCollectDebugLogs:
+ case eErrorEventTypeDtcEvent:
+ l_eStatus = m_pCfg->GetEmmcDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6:it will aways return ok
+ // LCOV_EXCL_START 6:it will aways return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetEmmcDestination() returned %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetEmmcFilename(f_time));
+ if (!f_eventNtfData.ModuleName.empty()) { // LCOV_EXCL_BR_LINE 6: ModuleName can not be empty
+ size_t l_pos = f_pathAndName.find(".tar.gz");
+ if (l_pos != std::string::npos) { // LCOV_EXCL_BR_LINE 6: ".tar.gz" is aways exist
+ f_pathAndName.insert(l_pos, f_eventNtfData.ModuleName);
+ }
+ }
+ }
+ break;
+ case eErrorEventTypeEelExport: // LCOV_EXCL_START 6: impossible to confirm because it can not get in
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ f_pathAndName = f_eventNtfData.ModuleName;
+ f_pathAndName.append("/");
+ f_pathAndName.append("loggerservicelogs_export_");
+ f_pathAndName.append(GetTimeString(f_time));
+ f_pathAndName.append(".tar.gz");
+ break;
+ // LCOV_EXCL_STOP
+ case eErrorEventTypeInterfaceunifiedEmmcLogs: // LCOV_EXCL_START 6: impossible to confirm because it can not get in
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // store the target location on event trigger
+ f_pathAndName = f_eventNtfData.ModuleName;
+ break;
+ // LCOV_EXCL_STOP
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ l_eStatus = m_pCfg->GetUserInvokedDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: impossible to confirm because it can not be fail
+ // LCOV_EXCL_START 6: impossible to confirm because it can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetUserInvokedDestination() returned %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ std::string l_emmc_path = m_pCfg->getEmmcOutputPath();
+ f_pathAndName.append(l_emmc_path);
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetUserInvokedFilename(f_hApp, f_time));
+ if (!f_eventNtfData.ModuleName.empty()) { // LCOV_EXCL_BR_LINE 6: it can not be empty
+ size_t l_pos = f_pathAndName.find(".tar.gz");
+ if (l_pos != std::string::npos) { // LCOV_EXCL_BR_LINE 6: ".tar.gz" is aways exist
+ f_pathAndName.insert(l_pos, f_eventNtfData.ModuleName);
+ }
+ }
+ }
+ break;
+
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeCanEvent:
+ l_eStatus = m_pCfg->GetUserInvokedDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: impossible to confirm because it can not be fail
+ // LCOV_EXCL_START 6: impossible to confirm because it can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetUserInvokedDestination() returned %d.",
+ l_eStatus);
+ // LCOV_EXCL_STOP
+ } else {
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetUserInvokedFilename(f_hApp, f_time));
+ }
+ break;
+
+ case eErrorEventTypeDiagEvent: // LCOV_EXCL_START 6: impossible to confirm because it can not get in
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ f_pathAndName = f_eventNtfData.ModuleName;
+ f_pathAndName.append("/");
+ f_pathAndName.append(GetUserInvokedFilename(f_hApp, f_time));
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+ // LCOV_EXCL_STOP
+ case eErrorEventTypeUserInvokedClearLogs:
+ case eErrorEventTypeUserInvokedCollectNaviLog:
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Unknown event type: %d.",
+ f_eventNtfData.EventType);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+
+ SetSuffixFromType(f_pathAndName, f_eventNtfData.EventType);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+// LCOV_EXCL_START 13:
+EFrameworkunifiedStatus CLoggerUtil::getNaviLogFilePathAndName(std::string &f_prefix,
+ uint32_t f_time,
+ std::string &f_pathAndName) { // LCOV_EXCL_BR_LINE 13:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = m_pCfg->GetEmmcNaviLogDestination(f_pathAndName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. GetEmmNaviLogDestination() returned %d.",
+ l_eStatus);
+ } else {
+ f_pathAndName.append("/");
+ f_pathAndName.append(f_prefix);
+ f_pathAndName.append(GetEmmcNaviLogFilename(f_time));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 200:
+EFrameworkunifiedStatus CLoggerUtil::getEmmcNaviLogParams(
+ uint32_t f_time, EPWR_SHUTDOWN_TRIGGER_TYPE errorType,
+ std::string &f_pathName, UI_32 &f_logMax) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR *l_dirp = NULL;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_prefix = "";
+
+ std::vector<std::string> l_vector;
+ std::string l_path = m_pCfg->getEmmcOutputNaviLogPath();
+
+ if ((errorType == epssdmsdtGENERIC_ERROR_RESET)
+ || (errorType == epssdmsdtFATAL_ERROR_RESET)) {
+ /*When reset occured !!*/
+ f_logMax = m_pCfg->m_emmcOutputNaviLogErrMax;
+ l_prefix = "ERR_";
+ } else {
+ /* ACC OFF occured*/
+ f_logMax = m_pCfg->m_emmcOutputNaviLogNmlMax;
+ l_prefix = "NML_";
+ }
+
+ if (f_logMax == 0) {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ return l_eStatus;
+ }
+
+ l_dirp = opendir(l_path.c_str());
+ if (l_dirp != NULL) {
+ struct dirent l_dirent;
+ struct dirent* next;
+
+ while (0 == readdir_r(l_dirp, &l_dirent, &next) && next != NULL) {
+ std::string l_findFileName = l_dirent.d_name;
+ size_t l_find_pos_top = l_findFileName.find(l_prefix.c_str());
+ size_t l_find_pos = l_findFileName.find(".log");
+ if (std::string::npos != l_find_pos
+ && std::string::npos != l_find_pos_top) {
+ l_vector.push_back(l_findFileName);
+ }
+ }
+ closedir(l_dirp);
+ }
+ std::sort(l_vector.begin(), l_vector.end());
+
+ for (UI_32 i = static_cast<UI_32>(l_vector.size()); i != 0; i--) {
+ std::string l_FilePath = l_path;
+ std::string l_FileName = l_vector.at(i - 1);
+ l_FilePath.append("/");
+ l_FilePath.append(l_FileName.c_str());
+
+ if (i < f_logMax) {
+ size_t l_pos = l_FileName.find("_", l_prefix.size());
+ if (std::string::npos != l_pos) {
+ std::string l_renameFilePath = l_path;
+ std::stringstream l_numStream;
+ l_numStream << std::setw(5) << std::setfill('0') << std::right << std::dec << (i + 1);
+ l_renameFilePath.append("/");
+ l_renameFilePath.append(l_prefix);
+ l_renameFilePath.append(l_numStream.str());
+ l_renameFilePath.append(l_FileName, l_pos, (l_FileName.size() - l_pos));
+ if (0 != rename(l_FilePath.c_str(), l_renameFilePath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. rename navilog file %s:%d.",
+ l_FilePath.c_str(), errno);
+ }
+ }
+ } else {
+ if (0 != unlink(l_FilePath.c_str())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete navilog file %s:%d.",
+ l_FilePath.c_str(), errno);
+ }
+ }
+ }
+ // sync parent directory
+ SyncDir(l_path);
+
+ l_eStatus = getNaviLogFilePathAndName(l_prefix, f_time, f_pathName);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 200: can not be called
+size_t CLoggerUtil::deleteRequestLogs(std::string f_emmcpath,
+ ELOGGERSERVICELOGTYPE f_reqtype, size_t f_reqsize,
+ ELOGGERSERVICELOGTYPE f_deltype) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR* l_dirp = NULL;
+ std::vector<std::string> vect;
+ std::vector<std::string>::iterator it;
+ UI_32 l_count = 0;
+ size_t l_totalsize = 0;
+
+ // create saved file list on eMMC
+ l_dirp = opendir(f_emmcpath.c_str());
+ if (l_dirp != NULL) {
+ struct dirent l_dirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_dirp, &l_dirent, &next) && next != NULL) {
+ std::string l_filename = l_dirent.d_name;
+ if (CLoggerUtil::QueryLoggerservicelogType(l_filename) == f_deltype) {
+ vect.push_back(l_filename);
+ }
+ }
+ closedir(l_dirp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " open failed eMMC path: %s",
+ f_emmcpath.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return 0;
+ }
+
+ // get num of delete logs
+ std::sort(vect.begin(), vect.end());
+ for (it = vect.begin(); it != vect.end(); it++) {
+ l_count++;
+
+ std::string l_filename = *it;
+ struct stat st_buf;
+ std::string l_tmpstr = f_emmcpath;
+ l_tmpstr.append(l_filename.c_str());
+ if (stat(l_tmpstr.c_str(), &st_buf) != -1) {
+ l_totalsize += st_buf.st_size;
+ }
+
+ if (l_totalsize > f_reqsize) {
+ break;
+ }
+ }
+
+ // start delete logs
+ if ((l_totalsize > f_reqsize) || (f_reqtype == eLoggerservicelogTypeAbnormal)
+ || (f_reqtype == eLoggerservicelogTypeGrpRelaunch)) {
+ for (it = vect.begin(); it != vect.end() && l_count > 0; it++) {
+ l_count--;
+
+ std::string l_filename = *it;
+ std::string l_tmpstr = f_emmcpath;
+ l_tmpstr.append(l_filename.c_str());
+ if (unlink(l_tmpstr.c_str()) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " unlink failed %s:%d.",
+ l_tmpstr.c_str(), errno);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " del-file=%s total=%d", l_tmpstr.c_str(),
+ l_totalsize);
+ }
+ SyncDir(f_emmcpath);
+ } else {
+ l_totalsize = 0;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ " nothing to delete logs req-type=%d del-logtype=%d total=%d, log_count=%d",
+ f_reqtype, f_deltype, l_totalsize, l_count);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_totalsize;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 200: can not be called
+EFrameworkunifiedStatus CLoggerUtil::forceDeleteOldLog(std::string f_archive_destination,
+ size_t f_req_size) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string l_emmc_path;
+ size_t l_delsize = 0;
+ ELOGGERSERVICELOGTYPE l_logtype = eLoggerservicelogTypeOther;
+
+ size_t l_pos = f_archive_destination.find_last_of('/');
+ if (std::string::npos != l_pos) {
+ l_emmc_path = f_archive_destination.substr(0, l_pos);
+ l_emmc_path.append("/");
+ l_logtype = CLoggerUtil::QueryLoggerservicelogType(
+ f_archive_destination.substr(l_pos + 1,
+ f_archive_destination.size() - l_pos + 1));
+ }
+
+ if (l_logtype == eLoggerservicelogTypeOther) {
+ // not found
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Invalid Parameter. dest=%s",
+ f_archive_destination.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // remove dirty-file if exist
+ if (unlink(f_archive_destination.c_str()) != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " unlink failed %s:%d.",
+ f_archive_destination.c_str(), errno);
+ }
+
+ // delete normal log
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, f_req_size,
+ eLoggerservicelogTypeNormal);
+ if (l_delsize >= f_req_size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete normal logs success: req-size=%d, del-size=%d", f_req_size,
+ l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (l_logtype == eLoggerservicelogTypeAbnormal) {
+ // delete abnormal log if request type is abnormal
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " continue delete abnormal logs: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ size_t l_tmpsize = f_req_size;
+ l_tmpsize -= l_delsize;
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, l_tmpsize,
+ eLoggerservicelogTypeAbnormal);
+ if (l_delsize >= l_tmpsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete abnormal logs success: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " abnormal log delete not complete. req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ }
+ } else if (l_logtype == eLoggerservicelogTypeGrpRelaunch) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " continue delete group relaunch logs: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ size_t l_tmpsize = f_req_size;
+ l_tmpsize -= l_delsize;
+ l_delsize = deleteRequestLogs(l_emmc_path, l_logtype, l_tmpsize,
+ eLoggerservicelogTypeGrpRelaunch);
+ if (l_delsize >= l_tmpsize) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " delete group relaunch logs success: req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " group relaunch log delete not complete. req-size=%d, del-size=%d",
+ f_req_size, l_delsize);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " normal log del not complete. req-size=%d, del-size=%d", f_req_size,
+ l_delsize);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CLoggerUtil::deleteOldLog(std::string log_path,
+ std::vector<std::string>& l_vector,
+ std::string& f_archive_destination,
+ UI_32 max_num) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ size_t l_pos = f_archive_destination.find_last_of('/');
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 200: there is always '/' in f_destination
+ std::sort(l_vector.begin(), l_vector.end());
+ std::vector<std::string>::iterator itr = l_vector.begin();
+ for (UI_32 i = static_cast<UI_32>(l_vector.size()); (max_num - 1) < i; i--, itr++) {
+ if (itr == l_vector.end()) { // LCOV_EXCL_BR_LINE 200: (max_num - 1) can not be -1.
+ break;
+ }
+ std::string l_FilePath = log_path;
+ std::string l_FileName = *itr;
+ l_FilePath.append("/");
+ l_FilePath.append(l_FileName.c_str());
+ if (0 != unlink(l_FilePath.c_str())) {
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete old log file %s:%d.",
+ l_FilePath.c_str(), errno);
+ }
+ }
+ SyncDir(log_path);
+ } else {
+ // LCOV_EXCL_START 200: there is always '/' in f_destination
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. delete target not found. %s",
+ f_archive_destination.c_str());
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CLoggerUtil::deleteOldEmmcLog(std::string& f_archive_destination,
+ EErrorEventType type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ DIR *l_dirp = NULL;
+ std::vector<std::string> vect_abnrm; /* ILLEGAL RESET LOG INFO or ERROR EXIT LOG INFO */
+ std::vector<std::string> vect_nrm; /* NORMAL LOG INFO */
+ std::vector<std::string> vect_rlnc; /* RELAUNCH LOG INFO */
+ std::string l_emmc_path = m_pCfg->getEmmcOutputPath();
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ UI_32 abnrm_count = 0;
+
+ l_dirp = opendir(l_emmc_path.c_str());
+ if (l_dirp != NULL) { // LCOV_EXCL_BR_LINE 5: opendir's error case.
+ struct dirent l_dirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_dirp, &l_dirent, &next) && next != NULL) {
+ std::string l_findFileName = l_dirent.d_name;
+
+// if ((std::string::npos != l_findFileName.find("_ILG_RESET.tar.gz"))
+// || (std::string::npos != l_findFileName.find("_ERR.tar.gz"))) {
+// vect_abnrm.push_back(l_findFileName);
+ if ((l_findFileName == ".") || (l_findFileName == "..")) {
+ continue;
+ } else if (std::string::npos != l_findFileName.find(SS_STORE_FILENAME_SYSILG_TERM)) {
+ vect_abnrm.push_back(l_findFileName);
+ } else if(std::string::npos != l_findFileName.find(SS_STORE_FILENAME__CWORD52__TERM)) { // LCOV_EXCL_BR_LINE 8: SS_STORE_FILENAME__CWORD52__TERM can not be set // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ vect_abnrm.push_back(l_findFileName); // LCOV_EXCL_LINE 8: SS_STORE_FILENAME_SYSILG_TERM can not be set // NOLINT[whitespace/line_length]
+ } else if((std::string::npos != l_findFileName.find("_ILG_RESET.tar.gz")) ||
+ (std::string::npos != l_findFileName.find("_ERR.tar.gz"))) {
+ vect_abnrm.push_back(l_findFileName);
+ abnrm_count++;
+
+ } else if (std::string::npos
+ != l_findFileName.find("_GRP_RELAUNCH.tar.gz")) {
+ vect_rlnc.push_back(l_findFileName);
+ } else if (std::string::npos != l_findFileName.find(".tar.gz")) {
+ vect_nrm.push_back(l_findFileName);
+ }
+ }
+ closedir(l_dirp);
+ }
+
+ switch (type) {
+ case eErrorEventTypeProcessCrash:
+ case eErrorEventTypeProcessExit:
+ case eErrorEventTypeHeartBeatFailure:
+ case eErrorEventTypeSystemLowMemory:
+ case eErrorEventTypeBootMicroReset:
+ case eErrorEventTypeModConnFailed:
+ case eErrorEventTypeStartRespFailed:
+ case eErrorEventTypeModuleInvokedResetRequest:
+
+// if ((UI_32) m_pCfg->m_emmcOutputErrMax <= vect_abnrm.size()) {
+// l_eStatus = deleteOldLog(l_emmc_path, vect_abnrm, f_archive_destination,
+// (UI_32) m_pCfg->m_emmcOutputErrMax);
+ if ((UI_32)m_pCfg->m_emmcOutputErrMax <= abnrm_count) {
+ l_eStatus = SS_LoggerStoreLogs_deleteOldLogAbnrm(l_emmc_path, vect_abnrm, f_archive_destination,
+ (UI_32)m_pCfg->m_emmcOutputErrMax, abnrm_count);
+
+ }
+ break;
+ case eErrorEventTypeGroupRelaunch:
+ if ((UI_32) m_pCfg->m_emmcOutputGrpRelaunchMax <= vect_rlnc.size()) {
+ l_eStatus = deleteOldLog(l_emmc_path, vect_rlnc, f_archive_destination,
+ (UI_32) m_pCfg->m_emmcOutputGrpRelaunchMax);
+ }
+ break;
+ default:
+ if ((UI_32) m_pCfg->m_emmcOutputMax <= vect_nrm.size()) {
+ l_eStatus = deleteOldLog(l_emmc_path, vect_nrm, f_archive_destination,
+ (UI_32) m_pCfg->m_emmcOutputMax);
+ }
+ break;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+void CLoggerUtil::SetMilage(UI_32 f_Milage) {
+ m_Milage = f_Milage;
+}
+
+std::string CLoggerUtil::GetUserInvokedFilename(HANDLE f_hApp, uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "";
+ std::stringstream l_nameStream;
+ UI_32 l_seqNumber = 0;
+
+ EFrameworkunifiedStatus l_eStatus = m_pCfg->GetIncrementAndPersistUserInvokedCounter(
+ f_hApp, l_seqNumber);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "GetIncrementAndPersistUserInvokedCounter()");
+
+ /* new counter value was not persisted if l_eStatus != eFrameworkunifiedStatusOK */
+
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec << l_seqNumber << '_';
+ l_nameStream << std::setw(8) << std::setfill('0') << std::right << std::dec << m_Milage << '_';
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec << m_bootCount << '_';
+ l_nameStream << std::setw(15) << GetTimeString(f_time) << ".tar.gz";
+
+ l_ret = l_nameStream.str();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+std::string CLoggerUtil::GetEmmcFilename(uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "";
+ std::stringstream l_nameStream;
+ UI_32 l_counter = 0;
+
+ m_pCfg->GetAndIncrementEmmcCounter(l_counter);
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec << l_counter << '_';
+ l_nameStream << std::setw(15) << this->GetTimeString(f_time) << ".tar.gz";
+
+ l_ret = l_nameStream.str();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+// LCOV_EXCL_START 8: dead code
+std::string CLoggerUtil::GetEmmcErrorFilename(uint32_t f_time) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "";
+ std::stringstream l_nameStream;
+ UI_32 l_counter = 0;
+
+ m_pCfg->GetAndIncrementEmmcCounter(l_counter);
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec << l_counter << '_';
+ l_nameStream << std::setw(15) << this->GetTimeString(f_time) << "_ERR.tar.gz";
+
+ l_ret = l_nameStream.str();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 13:
+std::string CLoggerUtil::GetEmmcNaviLogFilename(uint32_t f_time) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "";
+ std::stringstream l_nameStream;
+ UI_32 l_counter = 1;
+
+ l_nameStream << std::setw(5) << std::setfill('0') << std::right << std::dec << l_counter << '_';
+ l_nameStream << std::setw(15) << this->GetTimeString(f_time) << ".log";
+
+ l_ret = l_nameStream.str();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+// LCOV_EXCL_STOP
+
+std::string CLoggerUtil::GetTimeString(uint32_t f_time) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_ret = "00000000_000000";
+ struct tm local_time;
+ Clock_getLocalTimeY2K38(&f_time, &local_time);
+ char buffer[20];
+ if (0
+ != strftime(buffer, sizeof(buffer), "%Y%m%d_%H%M%S", // LCOV_EXCL_BR_LINE 5: c code
+ &local_time)) {
+ l_ret = buffer;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_ret);
+}
+
+void CLoggerUtil::SetUsbMountPath(std::string usbpath) {
+ strncpy(m_usbpath, usbpath.c_str(), USB_PATH_SIZE - 1);
+ m_usbpath[USB_PATH_SIZE - 1] = '\0';
+}
+#ifdef RELEASE_BUILD
+EFrameworkunifiedStatus CLoggerUtil::PathCheckAndCopyFile(std::string f_source,
+ std::string f_destination) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string::size_type ret;
+
+ ret = f_destination.find(m_usbpath);
+ l_eStatus = CopyFile(f_source, f_destination);
+
+ return l_eStatus;
+}
+#endif // RELEASE_BUILD
+/////////////////////////////////////////////////////////////////////////
+///// Static Functions
+/////////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus CLoggerUtil::CopyFile(std::string f_source,
+ std::string f_destination) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ssize_t l_nrd;
+ ssize_t l_nwr;
+ char l_buf[BUF_MAX_SIZE];
+
+ int l_if = open(f_source.c_str(), O_RDONLY | O_CLOEXEC, 0);
+ if (-1 == l_if) { // LCOV_EXCL_BR_LINE 5: open's error case.
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "src open fail:%s,errno:%d,msg:%s",
+ f_source.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ bool isWebdav = false;
+ std::string l_tmpDest;
+ size_t l_pos = f_destination.find_last_of('/');
+
+ l_tmpDest = f_destination;
+ if (f_destination.find("/mnt/import") != std::string::npos) { // LCOV_EXCL_BR_LINE 13:
+ // if output to webdav's directory, don't create temporary file.
+ // because of being unable to rename the file on it.
+ isWebdav = true;
+ }
+
+ int l_of = open(l_tmpDest.c_str(), O_WRONLY | O_CREAT | O_CLOEXEC, 0640);
+ if (-1 == l_of) { // LCOV_EXCL_BR_LINE 5: open's error case.
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "dest open fail:%s,errno:%d,msg:%s",
+ l_tmpDest.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ do {
+ l_nrd = read(l_if, l_buf, sizeof(l_buf));
+ if (l_nrd == -1) { // LCOV_EXCL_BR_LINE 5: read's error case.
+ // LCOV_EXCL_START 5: read's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail:%s,errno:%d,msg:%s",
+ f_source.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ l_nwr = write(l_of, l_buf, l_nrd);
+ if (l_nwr == -1) { // LCOV_EXCL_BR_LINE 5: write's error case.
+ // LCOV_EXCL_START 5: write's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (ENOSPC == errno) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "write fail(ENOSPC):%s,errno:%d,msg:%s", l_tmpDest.c_str(),
+ errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusErrNoEAGAIN;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail:%s,errno:%d,msg%s",
+ l_tmpDest.c_str(), errno, strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ } while (l_nrd > 0);
+
+ fsync(l_of);
+ close(l_of);
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 6: can not be fail
+ // LCOV_EXCL_START 6: can not be fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(l_if);
+ return l_eStatus;
+ // LCOV_EXCL_STOP
+ }
+
+ {
+ struct stat istat_buf, ostat_buf;
+ int ret;
+ ret = fstat(l_if, &istat_buf);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case.
+ // LCOV_EXCL_START 5: fstat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. stat(%s). errno: %d, %s",
+ f_source.c_str(), errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ while (1) {
+ ret = stat(l_tmpDest.c_str(), &ostat_buf);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: stat's error case.
+ // LCOV_EXCL_START 5: stat's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. stat(%s). errno: %d, %s",
+ l_tmpDest.c_str(), errno, strerror(errno));
+ break;
+ // LCOV_EXCL_STOP
+ }
+ if (ostat_buf.st_size >= istat_buf.st_size) { // LCOV_EXCL_BR_LINE 5: read and write can not fail, so the size is same // NOLINT[whitespace/line_length]
+ break;
+ }
+ usleep(10000); // interval
+ }
+ }
+ }
+ }
+ close(l_if);
+
+ if (!isWebdav) { // LCOV_EXCL_BR_LINE 6: isWebdav is aways false
+ if (rename(l_tmpDest.c_str(), f_destination.c_str()) != 0) { // LCOV_EXCL_BR_LINE 5: rename's error case.
+ // LCOV_EXCL_START 5: rename's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "rename %s to %s fail,errno:%d,msg:%s",
+ l_tmpDest.c_str(), f_destination.c_str(), errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (std::string::npos != l_pos) { // LCOV_EXCL_BR_LINE 200: there is always '/' in f_destination
+ std::string l_destPath = f_destination.substr(0, l_pos);
+ SyncDir(l_destPath);
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "dest invalid:%s", f_destination.c_str()); // LCOV_EXCL_LINE 200: there is always '/' in f_destination // NOLINT[whitespace/line_length]
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CLoggerUtil::CopyUntyped(std::string f_source,
+ std::string f_destination) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ struct stat l_stat;
+ int l_statRetVal;
+ if (0 != access(f_source.c_str(), F_OK)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. The specified file path and name does not exist: %s",
+ f_source.c_str());
+ } else if (0 != (l_statRetVal = lstat(f_source.c_str(), &l_stat))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. stat() for file or directory returned error: %s -> %d",
+ f_source.c_str(), l_statRetVal);
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ l_eStatus = CopyDirectory(f_source, f_destination);
+ } else if (0 != S_ISLNK(l_stat.st_mode)) {
+ // avoid duplicate copy for eErrorEventTypeInterfaceunifiedEmmcLogs: /nv/log/awlog -> /nv/BS/ss/logger_service/rwdata/log2/awlog
+ if (f_source.find("/nv/BS/ss/logger_service/rwdata/awlog") == std::string::npos) {
+ l_eStatus = CopyDirectory(f_source, f_destination);
+ }
+ } else if (0 != S_ISREG(l_stat.st_mode)) {
+#ifdef RELEASE_BUILD
+ l_eStatus = PathCheckAndCopyFile(f_source, f_destination);
+#else
+ l_eStatus = CopyFile(f_source, f_destination);
+#endif // RELEASE_BUILD
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. specified file may be a symbolic link or other non 'regular' type. File: %s, mode: 0x%04X.",
+ f_source.c_str(), l_stat.st_mode);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CLoggerUtil::CopyDirectory(std::string f_source,
+ std::string f_destination) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ DIR * l_pDir = opendir(f_source.c_str());
+
+ if (l_pDir == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s",
+ f_source.c_str());
+ } else {
+ if (mkdir(f_destination.c_str(), 0775) == -1) {
+ if (errno == EEXIST) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Directory: %s already exists.",
+ f_destination.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not create directory: %s. Errno: %s",
+ f_destination.c_str(), strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ } else {
+ SyncDir(f_destination);
+ size_t l_pos = f_destination.find_last_of('/');
+ if (l_pos != std::string::npos) {
+ std::string l_destPath = f_destination.substr(0, l_pos);
+ SyncDir(l_destPath);
+ }
+ }
+
+ struct dirent l_pDirent;
+ struct dirent* next;
+ while (0 == readdir_r(l_pDir, &l_pDirent, &next) && next != NULL) {
+ if ((0 != strcmp(l_pDirent.d_name, ".")) && /* Ignore special . directory. */
+ (0 != strcmp(l_pDirent.d_name, "..")) && /* Ignore special .. directory. */
+ (0 != strcmp(l_pDirent.d_name, "lost+found")) && /* Ignore lost+found. */
+ ('.' != l_pDirent.d_name[0])) { /* Ignore hidden files */
+ std::string l_fileSource = f_source;
+ std::string l_fileDestination = f_destination;
+ l_fileSource.append("/");
+ l_fileSource.append(l_pDirent.d_name);
+ l_fileDestination.append("/");
+ l_fileDestination.append(l_pDirent.d_name);
+ l_eStatus = CopyUntyped(l_fileSource, l_fileDestination);
+ }
+ }
+
+ closedir(l_pDir);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CLoggerUtil::MoveFile(std::string f_source,
+ std::string f_destination) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+#ifdef RELEASE_BUILD
+ l_eStatus = CLoggerUtil::PathCheckAndCopyFile(f_source, f_destination);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "CLoggerUtil::PathCheckAndCopyFile()");
+#else
+ l_eStatus = CLoggerUtil::CopyFile(f_source, f_destination);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "CLoggerUtil::CopyFile()");
+#endif // RELEASE_BUILD
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ l_eStatus = (0 == remove(f_source.c_str())) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
+ if (l_eStatus == eFrameworkunifiedStatusOK) {
+ size_t l_pos = f_source.find_last_of('/');
+ if (std::string::npos != l_pos) {
+ std::string l_emmc_path = f_source.substr(0, l_pos);
+ SyncDir(l_emmc_path);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CLoggerUtil::MoveUntyped(std::string f_source,
+ std::string f_destination) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ struct stat l_stat;
+ int l_statRetVal;
+ if (0 != access(f_source.c_str(), F_OK)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. The specified file path and name does not exist: %s",
+ f_source.c_str());
+ } else if (0 != (l_statRetVal = stat(f_source.c_str(), &l_stat))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. stat() for file or directory returned error: %s -> %d",
+ f_source.c_str(), l_statRetVal);
+ } else if (0 != S_ISDIR(l_stat.st_mode)) {
+ l_eStatus = CLoggerUtil::MoveDirectory(f_source, f_destination);
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus, "CLoggerUtil::MoveDirectory(f_source, f_destination);");
+ } else if (0 != S_ISREG(l_stat.st_mode)) {
+ l_eStatus = CLoggerUtil::MoveFile(f_source, f_destination);
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "CLoggerUtil::MoveFile(f_source, f_destination)");
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error. specified file may be a symbolic link or other non 'regular' type. File: %s, mode: 0x%04X.",
+ f_source.c_str(), l_stat.st_mode);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: can not be called
+EFrameworkunifiedStatus CLoggerUtil::MoveDirectory(std::string f_source,
+ std::string f_destination) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ DIR * l_pDir = opendir(f_source.c_str());
+
+ if (l_pDir == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not open directory: %s",
+ f_source.c_str());
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ errno = 0;
+ if (mkdir(f_destination.c_str(), 0666) == -1) {
+ if (errno == EEXIST) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Directory: %s already exists.",
+ f_destination.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not create directory: %s. Errno: %s",
+ f_destination.c_str(), strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ errno = 0;
+ } else {
+ SyncDir(f_destination);
+ size_t l_pos = f_destination.find_last_of('/');
+ if (l_pos != std::string::npos) {
+ std::string l_destPath = f_destination.substr(0, l_pos);
+ SyncDir(l_destPath);
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) { /* if directory already exists or has been newly created */
+ struct dirent l_pDirent;
+ struct dirent* next;
+
+ while (0 == readdir_r(l_pDir, &l_pDirent, &next) && next != NULL) {
+ if ((0 != strcmp(l_pDirent.d_name, ".")) && /* Ignore special . directory. */
+ (0 != strcmp(l_pDirent.d_name, "..")) && /* Ignore special .. directory. */
+ (0 != strcmp(l_pDirent.d_name, "lost+found")) && /* Ignore lost+found. */
+ ('.' != l_pDirent.d_name[0])) { /* Ignore hidden files */
+ std::string l_fileSource = f_source;
+ std::string l_fileDestination = f_destination;
+ l_fileSource.append("/");
+ l_fileSource.append(l_pDirent.d_name);
+ l_fileDestination.append("/");
+ l_fileDestination.append(l_pDirent.d_name);
+ l_eStatus = MoveUntyped(l_fileSource, l_fileDestination);
+ }
+ }
+ } else {
+ }
+ closedir(l_pDir);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 200: can not be called
+ELOGGERSERVICELOGTYPE CLoggerUtil::QueryLoggerservicelogType(std::string f_logname) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+// if (f_logname.find("_ILG_RESET.tar.gz") != std::string::npos
+ if (f_logname.find(SS_STORE_FILENAME_SYSILG_TERM) != std::string::npos) {
+ return eLoggerservicelogTypeAbnormal;
+ } else if (f_logname.find(SS_STORE_FILENAME__CWORD52__TERM) != std::string::npos) {
+ return eLoggerservicelogTypeAbnormal;
+ } else if (f_logname.find("_ILG_RESET.tar.gz") != std::string::npos
+
+ || f_logname.find("_ERR.tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeAbnormal;
+ } else if (f_logname.find("_GRP_RELAUNCH.tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeGrpRelaunch;
+ } else if (f_logname.find(".tar.gz") != std::string::npos) {
+ return eLoggerservicelogTypeNormal;
+ } else {
+ return eLoggerservicelogTypeOther;
+ }
+}
+// LCOV_EXCL_STOP
+
+void CLoggerUtil::SyncDir(std::string f_dir_path) {
+ int fd = open(f_dir_path.c_str(), O_RDONLY | O_DIRECTORY | O_CLOEXEC);
+#define OPE_ERR_MSG "%s %s failed. errno:%d,msg:%s"
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: open's error case.
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "open",
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ if (fsync(fd) == -1) { // LCOV_EXCL_BR_LINE 5: open's error case.
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "fsync",
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ if (close(fd) == -1) { // LCOV_EXCL_BR_LINE 5: open's error case.
+ // LCOV_EXCL_START 5: open's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, OPE_ERR_MSG, f_dir_path.c_str(), "close",
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+#undef OPE_ERR_MSG
+}
+
diff --git a/video_in_hal/systemservice/logger_service/server/src/testapps/fopen b/video_in_hal/systemservice/logger_service/server/src/testapps/fopen
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/testapps/fopen
diff --git a/video_in_hal/systemservice/logger_service/server/src/testapps/testapps.log b/video_in_hal/systemservice/logger_service/server/src/testapps/testapps.log
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/testapps/testapps.log
diff --git a/video_in_hal/systemservice/logger_service/server/src/testapps/testapps.tar.gz b/video_in_hal/systemservice/logger_service/server/src/testapps/testapps.tar.gz
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/testapps/testapps.tar.gz
diff --git a/video_in_hal/systemservice/logger_service/server/src/udp_file_writer.cpp b/video_in_hal/systemservice/logger_service/server/src/udp_file_writer.cpp
new file mode 100755
index 0000000..c07db07
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/udp_file_writer.cpp
@@ -0,0 +1,161 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/writer/udp_file_writer.h"
+#include "readerWriter/writer/file_writer.h"
+#include "readerWriter/writer/cached_file_writer.h"
+
+namespace ReaderWriter {
+
+// LCOV_EXCL_START 8:dead code
+CUdpFileWriter::CUdpFileWriter()
+ : m_pUdpWriter(NULL),
+ m_pFileWriter(NULL),
+ m_pLoggerCfg(NULL),
+ m_ipAddress(""),
+ m_port(0),
+ m_FileName(""),
+ m_FileSize(0) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+CUdpFileWriter::~CUdpFileWriter() { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (this->m_pFileWriter != NULL) {
+ delete (this->m_pFileWriter);
+ this->m_pFileWriter = NULL;
+ }
+ if (this->m_pUdpWriter != NULL) {
+ delete (this->m_pUdpWriter);
+ this->m_pUdpWriter = NULL;
+ }
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus CUdpFileWriter::Initialize(CLoggerCfg* f_pLoggerCfg,
+ std::string f_Name1, UI_32 f_size1,
+ std::string f_Name2, UI_32 f_size2) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if ((NULL == this->m_pFileWriter) && (NULL == this->m_pUdpWriter)
+ && (NULL != f_pLoggerCfg)) {
+ this->m_pFileWriter = new (std::nothrow) CCachedFileWriter();
+ this->m_pUdpWriter = new (std::nothrow) CUdpWriter();
+ m_pLoggerCfg = f_pLoggerCfg;
+ m_ipAddress = f_Name2;
+ m_port = f_size2;
+ m_FileName = f_Name1;
+ m_FileSize = f_size1;
+ EFrameworkunifiedStatus l_eStatus1 = this->m_pUdpWriter->Initialize(m_pLoggerCfg,
+ m_ipAddress, m_port,
+ "", 0);
+ EFrameworkunifiedStatus l_eStatus2 = this->m_pFileWriter->Initialize(m_pLoggerCfg,
+ m_FileName,
+ m_FileSize, "", 0);
+ l_eStatus =
+ ((l_eStatus1 != eFrameworkunifiedStatusOK) || (eFrameworkunifiedStatusOK != l_eStatus2)) ?
+ eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+ if (l_eStatus == eFrameworkunifiedStatusOK) {
+ l_eStatus = this->Open();
+ }
+ } else {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CUdpFileWriter::Open(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if ((NULL != this->m_pFileWriter) && (NULL != this->m_pUdpWriter)) {
+ EFrameworkunifiedStatus l_eStatus1 = this->m_pUdpWriter->Open();
+ EFrameworkunifiedStatus l_eStatus2 = this->m_pFileWriter->Open();
+ l_eStatus =
+ ((l_eStatus1 != eFrameworkunifiedStatusOK) || (eFrameworkunifiedStatusOK != l_eStatus2)) ?
+ eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK;
+ }
+
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+BOOL CUdpFileWriter::IsOpen(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL l_ret = FALSE;
+ if ((this->m_pUdpWriter != NULL) && (this->m_pFileWriter != NULL)) {
+ l_ret = (m_pUdpWriter->IsOpen() && m_pFileWriter->IsOpen());
+ }
+ return l_ret;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8:dead code
+EFrameworkunifiedStatus CUdpFileWriter::Write(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesWritten) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if ((NULL != this->m_pUdpWriter)) {
+ l_eStatus = this->m_pUdpWriter->Write(f_data, f_length, f_bytesWritten);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "this->m_pUdpWriter->Write() failed.");
+ }
+
+ if ((NULL != this->m_pFileWriter)) {
+ l_eStatus = this->m_pFileWriter->Write(f_data, f_length, f_bytesWritten);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "this->m_pFileWriter->Write() failed.");
+ } else {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+void CUdpFileWriter::Close() { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (this->m_pFileWriter != NULL) {
+ this->m_pFileWriter->Close();
+ delete (this->m_pFileWriter);
+ this->m_pFileWriter = NULL;
+ }
+ if (this->m_pUdpWriter != NULL) {
+ this->m_pUdpWriter->Close();
+ delete (this->m_pUdpWriter);
+ this->m_pUdpWriter = NULL;
+ }
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CUdpFileWriter::FlushCache(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (this->m_pFileWriter->FlushCache());
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CUdpFileWriter::UpdateLoggingParameters(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (this->m_pUdpWriter->UpdateLoggingParameters());
+}
+} // namespace ReaderWriter
+
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/systemservice/logger_service/server/src/udp_writer.cpp b/video_in_hal/systemservice/logger_service/server/src/udp_writer.cpp
new file mode 100755
index 0000000..8fc4d84
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/udp_writer.cpp
@@ -0,0 +1,295 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "readerWriter/writer/udp_writer.h"
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <string.h>
+#include <inttypes.h>
+#ifdef AGL_STUB
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#else
+#include <sys/syspage.h>
+#include <sys/neutrino.h>
+#endif
+#include <native_service/ns_logger_if.h>
+#include <string>
+#include <algorithm>
+
+#define TIME_UNTIL_UDP_START (UI_32)25
+
+namespace ReaderWriter {
+
+CUdpWriter::CUdpWriter()
+ : m_SocketHandle(-1),
+ m_IPAddress(""),
+ m_index(0),
+ m_port(REMOTE_IP_PORT),
+ m_InitialTimeElapsed(FALSE) {
+ std::memset(&m_oSAInfo, 0, sizeof(sockaddr_in));
+ std::memset(&m_buffer[0], 0, UDP_CACHED_BLOCK_SIZE);
+}
+
+CUdpWriter::~CUdpWriter() {
+ if (m_SocketHandle != -1) {
+ this->Close();
+ }
+}
+
+EFrameworkunifiedStatus CUdpWriter::Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2,
+ UI_32 f_size2) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ this->m_pLoggerCfg = f_pLoggerCfg;
+ this->m_IPAddress = f_Name1;
+ if (NULL == f_pLoggerCfg) { // LCOV_EXCL_BR_LINE 200: f_pLoggerCfg can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 200: f_pLoggerCfg can not be null
+ } else if ((f_pLoggerCfg->IsUDPLoggingEnabled())) {
+ if (m_IPAddress.length() > 0) {
+ this->m_port = f_size1;
+ l_eStatus = this->Open();
+ LOG_STATUS_IF_ERRORED(
+ l_eStatus,
+ "this->Open() failed. UDP logging disabled. Enable via Engineering Menu.");
+ // Continue without UDP Logging;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else {
+ this->m_SocketHandle = -1;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-: %d", l_eStatus);
+ return (l_eStatus);
+}
+
+BOOL CUdpWriter::IsOpen(void) {
+ BOOL l_ret = (-1 != m_SocketHandle) ? TRUE : FALSE;
+ if (TRUE == l_ret) {
+#ifdef AGL_STUB
+ UI_32 l_elapsed = ((UI_32)((F_64)ClockCycle()/1000000));
+#else
+ UI_32 l_elapsed = ((UI_32) ((F_64) ClockCycle()
+ / (F_64) (SYSPAGE_ENTRY(qtime)->cycles_per_sec)));
+#endif
+ // check if 20 Seconds have elapsed since startup
+ if (TIME_UNTIL_UDP_START <= l_elapsed) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "%d seconds elapsed. Starting UDP logging", l_elapsed);
+ m_InitialTimeElapsed = TRUE;
+ l_ret = TRUE;
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Time before starting UDP not yet elapsed. Waiting for %d more seconds",
+ (TIME_UNTIL_UDP_START - l_elapsed));
+ usleep((TIME_UNTIL_UDP_START - l_elapsed)*1000);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Starting UDP now!");
+ }
+ }
+ return l_ret;
+}
+
+EFrameworkunifiedStatus CUdpWriter::Open() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ if ((m_IPAddress.length() > 0)) {
+ int l_SocketOption = 1;
+ // Set the domain using the classes domain value.
+ m_oSAInfo.sin_family = AF_INET;
+ m_oSAInfo.sin_addr.s_addr = inet_addr(OWN_ADDRESS); // m_IPAddress.c_str()); // "192.168.1.2");//htonl(INADDR_ANY);
+ m_oSAInfo.sin_port = htons(this->m_port);
+ if (FALSE == this->m_pLoggerCfg->IsUDPLoggingEnabled()) {
+ this->Close();
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else if (this->m_SocketHandle != -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. socket already opened. No action required");
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (-1 == (this->m_SocketHandle = socket(AF_INET, SOCK_DGRAM, 0))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. socket(AF_INET, SOCK_DGRAM, 0) returned -1. errno: %s",
+ strerror(errno));
+ errno = 0;
+ l_eStatus = eFrameworkunifiedStatusDbExecuteFail;
+ } else if (setsockopt(m_SocketHandle, SOL_SOCKET, SO_REUSEADDR,
+ &l_SocketOption, sizeof(l_SocketOption)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "setsockopt(SO_REUSEADDR) failed.errno: %s", strerror(errno));
+ errno = 0;
+ l_eStatus = eFrameworkunifiedStatusDbResultError;
+ }
+#ifdef AGL_STUB
+ else if (setsockopt(m_SocketHandle, SOL_SOCKET, SO_REUSEADDR , // LCOV_EXCL_BR_LINE 6: the same calls will get the same return // NOLINT (readability/braces)
+ &l_SocketOption, sizeof(l_SocketOption)) == -1)
+#else
+ else if (setsockopt(m_SocketHandle, SOL_SOCKET, SO_REUSEPORT, // NOLINT (readability/braces)
+ &l_SocketOption, sizeof(l_SocketOption)) == -1)
+#endif
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "setsockopt(SO_REUSEPORT) failed. errno: %s", strerror(errno));
+ errno = 0;
+ l_eStatus = eFrameworkunifiedStatusDbResultError;
+ } else if (setsockopt(m_SocketHandle, SOL_SOCKET, SO_DONTROUTE,
+ &l_SocketOption, sizeof(l_SocketOption)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "setsockopt(SO_DONTROUTE) failed. errno: %s", strerror(errno));
+ errno = 0;
+ l_eStatus = eFrameworkunifiedStatusDbResultError;
+ } else if (INADDR_NONE == m_oSAInfo.sin_addr.s_addr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Invalid local address.");
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ } else if (0
+ != bind(this->m_SocketHandle, (const struct sockaddr *) &m_oSAInfo,
+ sizeof(m_oSAInfo))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. bind() returned not zero. errno: %s", strerror(errno));
+ errno = 0;
+ l_eStatus = eFrameworkunifiedStatusSemUnlockFail;
+ } else {
+ m_oSAInfo.sin_addr.s_addr = inet_addr(m_IPAddress.c_str());
+ if (INADDR_NONE == m_oSAInfo.sin_addr.s_addr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Invalid target address.");
+ l_eStatus = eFrameworkunifiedStatusFault;
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ this->Close();
+ m_SocketHandle = -1;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- : %d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CUdpWriter::WriteData(UI_8 *f_data, UI_32 f_length,
+ SI_32 &f_bytesWritten) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_8 l_retry = SEND_RETRY_VALUE;
+ if (this->m_SocketHandle == -1) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ while ((0 != l_retry)
+ && ((f_bytesWritten >= 0) && ((UI_32) f_bytesWritten != f_length))) {
+ SI_32 l_bytesWritten = (SI_32)(sendto(m_SocketHandle, &f_data[f_bytesWritten],
+ f_length - f_bytesWritten, 0,
+ (const struct sockaddr *) &m_oSAInfo,
+ sizeof(m_oSAInfo)));
+ f_bytesWritten += l_bytesWritten;
+ l_eStatus = (l_bytesWritten >= 0) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "l_retry: %d, errno: %s", l_retry,
+ strerror(errno));
+ errno = 0;
+ l_retry--;
+ usleep(100);
+ } else {
+ l_retry = SEND_RETRY_VALUE;
+ }
+ }
+ }
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CUdpWriter::Write(UI_8* f_data, UI_32 f_length,
+ SI_32& f_bytesWritten) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ f_bytesWritten = 0;
+ if ((f_data == NULL)) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ } else if ((-1 == m_SocketHandle)) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (f_length > UDP_MAX_LENGTH) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Possible memory corruption.");
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Length(%d) bigger than cache. ",
+ f_length);
+ } else {
+ UI_32 l_remainingIndex = 0;
+
+ while (l_remainingIndex != f_length) {
+ UI_32 l_offset = (UDP_CACHED_BLOCK_SIZE - this->m_index);
+ l_offset = std::min(l_offset, (f_length - l_remainingIndex));
+ (void) std::memcpy(&this->m_buffer[this->m_index],
+ &f_data[l_remainingIndex], l_offset);
+ l_remainingIndex += l_offset;
+ this->m_index += l_offset;
+ if (this->m_index == UDP_CACHED_BLOCK_SIZE) {
+ (void) this->FlushCache();
+ this->m_index = 0;
+ }
+ }
+ f_bytesWritten = f_length;
+ }
+ }
+ return (l_eStatus);
+}
+void CUdpWriter::Close() {
+ if (m_SocketHandle != -1) {
+ (void) close(m_SocketHandle);
+ m_SocketHandle = -1;
+ }
+}
+
+EFrameworkunifiedStatus CUdpWriter::UpdateLoggingParameters(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (this->m_pLoggerCfg != NULL) {
+ BOOL l_enabled = this->m_pLoggerCfg->IsUDPLoggingEnabled();
+ if ((TRUE == l_enabled) && (m_SocketHandle == -1)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. Opening UDP.");
+ l_eStatus = this->Open();
+ } else if (((FALSE == l_enabled) && (m_SocketHandle != -1))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. Closing UDP.");
+ l_eStatus = eFrameworkunifiedStatusOK;
+ this->Close();
+ } else {
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- :%d", l_eStatus);
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CUdpWriter::FlushCache(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SI_32 l_written = 0;
+ SI_32 l_writtenTotal = 0;
+ while (((l_writtenTotal >= 0) && ((UI_32) l_writtenTotal < this->m_index))
+ && (eFrameworkunifiedStatusOK == l_eStatus)) {
+ l_eStatus = this->WriteData(&this->m_buffer[l_writtenTotal],
+ this->m_index - l_writtenTotal, l_written);
+ l_writtenTotal += l_written;
+ l_written = 0;
+ }
+ this->m_index = 0;
+ return l_eStatus;
+}
+} // namespace ReaderWriter
diff --git a/video_in_hal/systemservice/logger_service/server/src/writer.cpp b/video_in_hal/systemservice/logger_service/server/src/writer.cpp
new file mode 100755
index 0000000..907b202
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/src/writer.cpp
@@ -0,0 +1,86 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_LoggerService
+/// \brief TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include <new>
+#include <iostream>
+#include "readerWriter/writer/writer.h"
+#include "readerWriter/writer/file_writer.h"
+#include "readerWriter/writer/udp_writer.h"
+#include "readerWriter/writer/udp_file_writer.h"
+#include "readerWriter/writer/cached_file_writer.h"
+
+namespace ReaderWriter {
+
+CWriter::CWriter()
+ : m_pLoggerCfg(NULL) {
+}
+
+CWriter::~CWriter() {
+}
+
+CWriter* CWriter::OpenWriter(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
+ std::string f_Name1, UI_32 f_size1,
+ std::string f_Name2, UI_32 f_size2) {
+ CWriter* l_ret = NULL;
+ if ((f_Name1.length() != 0) && (f_pLoggerCfg != NULL)) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
+ switch (f_type) {// LCOV_EXCL_BR_LINE 200:As it must be eReaderWriterTypeQueue or eReaderWriterTypeMem
+ case eReaderWriterTypeFile:
+ l_ret = new (std::nothrow) CCachedFileWriter(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ break;
+
+ case eReaderWriterTypeUdp:
+ l_ret = new (std::nothrow) CUdpWriter(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
+ break;
+ case eReaderWriterTypeUdpAndFile: // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (f_Name2.length() != 0) {
+ l_ret = new (std::nothrow) CUdpFileWriter();
+ }
+ // LCOV_EXCL_STOP
+ default:
+ break;
+ }
+ }
+ if (NULL != l_ret) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
+ if (eFrameworkunifiedStatusOK != l_ret->Initialize(f_pLoggerCfg, f_Name1, f_size1, f_Name2, f_size2)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Open Writer Failed");
+ delete (l_ret);
+ l_ret = NULL;
+ }
+ }
+
+ return l_ret;
+}
+
+EFrameworkunifiedStatus CWriter::FlushCache(void) { // LCOV_EXCL_START 8:Base class virtual functions
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Default function called!");
+ return (eFrameworkunifiedStatusOK);
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CWriter::UpdateLoggingParameters(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Default function called!");
+ return (eFrameworkunifiedStatusOK);
+}
+} // namespace ReaderWriter
+
diff --git a/video_in_hal/systemservice/logger_service/server/work/Makefile b/video_in_hal/systemservice/logger_service/server/work/Makefile
new file mode 100755
index 0000000..79cef35
--- /dev/null
+++ b/video_in_hal/systemservice/logger_service/server/work/Makefile
@@ -0,0 +1,126 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = SS_LoggerService
+
+
+######### compiled sources #############
+SS_LoggerService_SRCS += mod_version.c
+SS_LoggerService_SRCS += cached_file_writer.cpp
+SS_LoggerService_SRCS += file_writer.cpp
+SS_LoggerService_SRCS += mem_reader.cpp
+SS_LoggerService_SRCS += loggerservice_application.cpp
+SS_LoggerService_SRCS += loggerservice_main.cpp
+SS_LoggerService_SRCS += loggerservicedebug_child_thread.cpp
+SS_LoggerService_SRCS += loggerservicedebug_writer_Evntworker.cpp
+SS_LoggerService_SRCS += queue_reader.cpp
+SS_LoggerService_SRCS += reader.cpp
+SS_LoggerService_SRCS += reader_writer.cpp
+SS_LoggerService_SRCS += ss_logger_cfg.cpp
+SS_LoggerService_SRCS += ss_logger_device_detection.cpp
+SS_LoggerService_SRCS += ss_logger_error_event.cpp
+SS_LoggerService_SRCS += ss_logger_error_event_archive.cpp
+SS_LoggerService_SRCS += ss_logger_error_event_can_evt_reply.cpp
+SS_LoggerService_SRCS += ss_logger_error_event_cfg.cpp
+SS_LoggerService_SRCS += ss_logger_error_event_responses.cpp
+SS_LoggerService_SRCS += ss_logger_error_event_storage.cpp
+SS_LoggerService_SRCS += ss_logger_fs_directory.cpp
+SS_LoggerService_SRCS += ss_logger_popups.cpp
+SS_LoggerService_SRCS += ss_logger_reader_writer_control.cpp
+SS_LoggerService_SRCS += ss_logger_server_callbacks.cpp
+SS_LoggerService_SRCS += ss_logger_util.cpp
+SS_LoggerService_SRCS += udp_writer.cpp
+SS_LoggerService_SRCS += writer.cpp
+SS_LoggerService_SRCS += udp_file_writer.cpp
+
+######## add source path #############
+VPATH += ../src
+VPATH += ../include/$(COMPONENT_NAME)
+VPATH += -I../include/readerWriter/reader
+VPATH += -I../include/readerWriter/writer
+
+
+######### add include path #############
+CPPFLAGS += -I./
+CPPFLAGS += -I../include
+CPPFLAGS += -I../include/readerWriter
+CPPFLAGS += -I../include/readerWriter/reader
+CPPFLAGS += -I../include/readerWriter/writer
+CPPFLAGS += -Wl,--no-undefined
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+######### add compile option #############
+CPPFLAGS += -DRELEASE_BUILD
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+CPPFLAGS_mem_reader.o = -fno-exceptions
+CPPFLAGS_reader.o = -fno-exceptions
+CPPFLAGS_reader_writer.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event_archive.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event_can_evt_reply.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event_cfg.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event_responses.o = -fno-exceptions
+CPPFLAGS_ss_logger_error_event_storage.o = -fno-exceptions
+CPPFLAGS_ss_logger_fs_directory.o = -fno-exceptions
+CPPFLAGS_ss_logger_popups.o = -fno-exceptions
+CPPFLAGS_ss_logger_reader_writer_control.o = -fno-exceptions
+CPPFLAGS_ss_logger_server_callbacks.o = -fno-exceptions
+CPPFLAGS_ss_logger_util.o = -fno-exceptions
+CPPFLAGS_writer.o = -fno-exceptions
+CPPFLAGS_mod_version.o = -fno-exceptions
+CPPFLAGS_cashed_file_writer.o = -fno-exceptions
+CPPFLAGS_file_writer.o = -fno-exceptions
+CPPFLAGS_loggerservice_application.o = -fno-exceptions
+CPPFLAGS_loggerservice_main.o = -fno-exceptions
+CPPFLAGS_loggerservicedebug_child_thread.o = -fno-exceptions
+CPPFLAGS_loggerservicedebug_writer_Evntworker.o = -fno-exceptions
+CPPFLAGS_queue_reader.o = -fno-exceptions
+CPPFLAGS_ss_logger_device_detection.o = -fno-exceptions
+CPPFLAGS_udp_file_writer.o = -fno-exceptions
+CPPFLAGS_udp_writer.o = -fno-exceptions
+
+######### linked library #############
+LDFLAGS += -L../lib/
+LDLIBS += -Wl,-Bstatic -lSS_LoggerStoreLogs
+LDLIBS += -Wl,-Bstatic -lPFDRECThread
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lc #Substitute for libsocket
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lrt # for mq_xxx
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -ltar
+LDLIBS += -Wl,-Bdynamic -lz
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+LDLIBS += -Wl,-Bdynamic -lns_backup #for PFDRECTread
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lcrypto
+LDLIBS += -Wl,-Bdynamic -lextension
+LDLIBS += -Wl,-Bdynamic -lClock_API
+
+
+LINK_CXX=Y
+include ../../../system_service.mk
diff --git a/video_in_hal/systemservice/power_service/LICENSE b/video_in_hal/systemservice/power_service/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/systemservice/power_service/Makefile.server b/video_in_hal/systemservice/power_service/Makefile.server
new file mode 100755
index 0000000..b11e0d8
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/Makefile.server
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS = server
+
+include ../system_service.mk
diff --git a/video_in_hal/systemservice/power_service/server/Makefile b/video_in_hal/systemservice/power_service/server/Makefile
new file mode 100755
index 0000000..f81d2ba
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/Makefile
@@ -0,0 +1,51 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = SS_PowerService
+
+
+######### compiled sources #############
+SS_PowerService_SRCS += ./src/powerservice_application.cpp
+SS_PowerService_SRCS += ./src/powerservice_main.cpp
+SS_PowerService_SRCS += ./src/ss_power.cpp
+SS_PowerService_SRCS += ./src/ss_power_config.cpp
+SS_PowerService_SRCS += ./src/ss_power_session.cpp
+SS_PowerService_SRCS += ./src/ss_power_state_machine.cpp
+SS_PowerService_SRCS += ./src/ss_pwr_test_client_handlers.cpp
+SS_PowerService_SRCS += ./src/ss_supervisor_handlers.cpp
+SS_PowerService_SRCS += ./src/ss_system_handlers.cpp
+
+
+######### add include path #############
+CPPFLAGS += -I./include
+
+
+######### add compile option #############
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x09 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,13,9,8,3 ## open log-tag
+CPPFLAGS += -DTARGET_SOC_$(TARGET_SOC)
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+
+######### add library path #############
+LDFLAGS += -g -Wl,--gc-sections
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/power_service/server/include/ss_power.h b/video_in_hal/systemservice/power_service/server/include/ss_power.h
new file mode 100755
index 0000000..b1e3de5
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/include/ss_power.h
@@ -0,0 +1,318 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief Handles Power Service Business logic
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_H_
+
+#include <system_service/ss_power_service.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_templates.h>
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include <vector>
+#include <string>
+#include <exception>
+
+#include "ss_power_session.h"
+#include "ss_power_config.h"
+#include "ss_power_state_machine.h"
+#include "ss_power_powerservicelog.h"
+
+typedef enum _SS_PSState {
+ SS_PS_READY_TO_WAKEUP = 0x01,
+ SS_PS_WAKEUP_INITIATED,
+ SS_PS_WAKEUP_COMPLETE,
+ SS_PS_POWER_ON_COMPLETE,
+ SS_PS_POWER_OFF_INITIATED,
+ SS_PS_POWER_OFF_COMPLETE,
+ SS_PS_SHUTDOWN_INITIATED,
+ SS_PS_SHUTDOWN_COMPLETE
+ // This is not real state, used only to know total states
+ ,
+ SS_PS_STATE_MAX
+} SS_PSState;
+
+typedef struct {
+ std::string m_cmd;
+ UI_64 m_time;
+ std::string m_sender;
+} Ts_cmdHist;
+
+typedef std::vector<Ts_cmdHist> cmdHist;
+typedef cmdHist::iterator cmdHistIter;
+
+class Power {
+ public:
+ Power();
+ virtual ~Power();
+ EFrameworkunifiedStatus Initialize(HANDLE h_app);
+ static Power & GetInstance();
+
+ /// Session Request Handlers
+ EFrameworkunifiedStatus OnOpenSession(HANDLE h_app);
+ EFrameworkunifiedStatus OnCloseSession(HANDLE h_app);
+
+ /// Session Response\Ack Handlers
+ EFrameworkunifiedStatus OnWakeUpComplete(HANDLE h_app);
+ EFrameworkunifiedStatus OnShutdownComplete(HANDLE h_app);
+ EFrameworkunifiedStatus OnPrintConnections(HANDLE h_app);
+ EFrameworkunifiedStatus OnPrintStack(HANDLE h_app);
+
+ /// SSM Handlers
+
+ /// Supervisor Handlers
+ EFrameworkunifiedStatus OnPowerRequestMsg(HANDLE h_app);
+ EFrameworkunifiedStatus OnSetPowerState(HANDLE h_app);
+ EFrameworkunifiedStatus OnSetCommWakeUp(HANDLE h_app);
+ EFrameworkunifiedStatus OnSetCommSleep(HANDLE h_app);
+ EFrameworkunifiedStatus OnShutdownRequestMsg(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnPowerOnOffNotification(HANDLE h_app);
+ EFrameworkunifiedStatus OnStartModules(HANDLE h_app);
+ EFrameworkunifiedStatus OnShutdownModules(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnHysteresisTimeout(HANDLE h_app);
+
+ // System Handlers
+ EFrameworkunifiedStatus OnSystemLaunchComplete(HANDLE h_app);
+ EFrameworkunifiedStatus OnSystemShutdownComplete(HANDLE h_app);
+ EFrameworkunifiedStatus OnWakeUpTimeout(HANDLE h_app);
+ EFrameworkunifiedStatus OnShutdownTimeout(HANDLE h_app);
+
+ // Get Result query from power test client
+ EFrameworkunifiedStatus OnCurrentPowerStateQuery(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnSetVoltageState(HANDLE h_app);
+ EFrameworkunifiedStatus OnSetCrankState(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnSystemModeInfoRequest(HANDLE h_app);
+ EFrameworkunifiedStatus OnSystemModeInfoResponse(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnInitCompReport(HANDLE h_app);
+
+ EFrameworkunifiedStatus OnSystemMgrConnectionEstablished(HANDLE h_app);
+
+ //
+ // Start Confirmation callback functions
+ //
+ EFrameworkunifiedStatus OnSendStartupConfirmationRequest(HANDLE h_app);
+ EFrameworkunifiedStatus OnSendStartupConfirmationResponse(HANDLE h_app);
+
+ //
+ // User Mode Protocol callback functions
+ //
+ EFrameworkunifiedStatus OnUserModeResponse(HANDLE h_app);
+
+ //
+ // Shutdown Condition Notification Protocol function
+ //
+ EFrameworkunifiedStatus OnPublishShutdownPopupRequest(HANDLE h_app);
+
+ //
+ // Power Popup Notification Protocol function
+ //
+ EFrameworkunifiedStatus OnPublishPowerPopupRequest(HANDLE h_app);
+
+ //
+ // HeartBeat Protocol callback functions
+ //
+ EFrameworkunifiedStatus On_CWORD56_HeartBeatRequest(HANDLE h_app);
+ EFrameworkunifiedStatus OnSM_CWORD56_HeartBeatResponse(HANDLE h_app);
+
+ //
+ // Hard Reset Protocol callback functions
+ //
+ EFrameworkunifiedStatus OnCpuResetRequest(HANDLE h_app);
+
+ //
+ // Remote Data Reset Protocol callback functions
+ //
+ EFrameworkunifiedStatus OnRemoteDataResetRequest(HANDLE h_app);
+ EFrameworkunifiedStatus OnRemoteDataResetResponse(HANDLE h_app);
+
+ cmdHist m__CWORD56_RepHist;
+ cmdHistIter m__CWORD56_RepIter;
+ cmdHist m_PubCmdHist;
+ cmdHistIter m_PubHistIter;
+ cmdHist m_ErrHist;
+ cmdHistIter m_ErrHistIter;
+ cmdHist m_VCmdHist;
+ cmdHistIter m_VHistIter;
+
+ void SSPowerDebugDump(HANDLE h_app);
+
+ private:
+#define LOG_POWERSERVICELOG_CNT(caseid, Cnt) \
+ FRAMEWORKUNIFIEDLOG_CNT(ZONE_INFO, Cnt, 0); \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " case " #caseid \
+ ": FRAMEWORKUNIFIEDLOG_CNT(ZONE_INFO, " #Cnt ", 0)");
+
+#define LOG_POWERSERVICELOG_EVT(caseid, Evt, Data0) \
+ FRAMEWORKUNIFIEDLOG_EVT(ZONE_INFO, Evt, 1, Data0); \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " case " #caseid \
+ ": FRAMEWORKUNIFIEDLOG_EVT(ZONE_INFO, " #Evt ", " #Data0 ")");
+
+#define LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(l_eStatus, pStr) \
+ if (eFrameworkunifiedStatusOK != l_eStatus) { \
+ LOG_ERROR(pStr); \
+ SetCmdHist(pStr, m_ErrHist, m_ErrHistIter, GetStr(static_cast<EFrameworkunifiedStatus>(l_eStatus)).c_str()); \
+ } // End of #define LOG_STATUS_IF_ERRORED(l_eStatus,pStr)
+
+#define SS_PWR_LOG_HIST(cmd, hist, it, sender, l_eStatus) \
+ if (eFrameworkunifiedStatusOK == l_eStatus) { \
+ SetCmdHist((static_cast< std::string> (cmd)), (static_cast<cmdHist&> (hist)), \
+ (static_cast<cmdHistIter&> (it)), (static_cast< std::string> (sender))); \
+ }
+ //**************************************************************************
+ // Counter Logging enums & typedefs *
+ // *
+ // Counter Event IDs *
+ typedef enum { // *
+ CT_Startup_CanSignal = 0x0114, // *
+ CT_Startup_DiagMsg = 0x0118, // *
+ // *
+ CT_Shutdown_CanSignal = 0x0121, // *
+ CT_Shutdown_Timeout = 0x0124, // *
+ CT_Shutdown_Temperature = 0x0125, // *
+ CT_Shutdown_Error = 0x0126, // *
+ CT_Shutdown_Voltage = 0x0127 // *
+ } EPWR_COUNTER_EVENT_ID_TYPE; // *
+ // *
+ // End of Counter Logging enums & typedefs *
+ //**************************************************************************
+
+ //**************************************************************************
+ // Event Logging enums & typedefs *
+ // *
+ // Event ID *
+ typedef enum { // *
+ // Startup Event IDs *
+ Ei_StartUp_Cansignal = 0x0101, // *
+ Ei_StartUp_HK_On = 0x0102, // *
+ // 0x0103 not specified // *
+ // 0x0104 not specified // *
+ // 0x0105 System Svcs not responsible// *
+ // 0x0106 not specified // *
+ Ei_StartUp_ActivationLine = 0x0107, // *
+ Ei_StartUp_DiagMsg = 0x0108, // *
+ // *
+ // Shutdown Event IDs *
+ Ei_shutdown_CANsignal = 0x0201, // *
+ Ei_shutdown_HkOFF = 0x0202, // *
+ // 0x0203 not specified // *
+ // 0x0204 not specified // *
+ Ei_shutdown_Temperature = 0x0205, // *
+ Ei_shutdown_NetworkError = 0x0206, // *
+ Ei_shutdown_Voltage = 0x0207 // *
+ } EPWR_LOGGING_EVENT_ID_TYPE; // *
+ // *
+ // Ei_StartUp_CanSignal byte0 Event Detail *
+ typedef enum { // *
+ epseisuedIGNITION = 0x00, // *
+ epseisuedHK_ON = 0x01, // *
+ epseisuedDOOR_MODULES = 0x02, // *
+ // 0x03 not specified // *
+ // 0x04 not specified // *
+ epseisuedPASS = 0x05, // *
+ epseisuedIHTM = 0x06, // *
+ epseisuedMPM = 0x07, // *
+ epseisuedSNA = 0xFF // *
+ } EPWR_LOGGING_EVT_DETAIL_SU_CAN_TYPE; // *
+
+ //
+ // Ei_StartUp_HkOn
+ typedef enum {
+ epseisuedHK_ON_Key = 0x00
+ } EPWR_LOGGING_EVT_DETAIL_SU_KEY_TYPE;
+
+ //
+ // Ei_StartUp_ActivationLine
+ typedef enum {
+ epseisuedACV_LINE = 0x00
+ } EPWR_LOGGING_EVT_DETAIL_SU_LINE_TYPE;
+
+ // *
+ // Ei_StartUp_DiagMsg byte0 Event Detail *
+ typedef enum { // *
+ epseisuedHU = 0x01, // *
+ epseisuedCAN = 0x02, // *
+ } EPWR_LOGGING_EVT_DETAIL_SU_DIAG_TYPE; // *
+ // *
+ // Ei_ShutDown_CanSignal byte0 Event Detail *
+ typedef enum { // *
+ epseisdcsIGN_STATE = 0x00, // *
+ epseisdcsHK_ON = 0x01 // *
+ } EPWR_LOGGING_EVT_DETAIL_SD_CAN_TYPE; // *
+ // *
+ // Ei_ShutDown_Temperature byte0 Event Detail *
+ typedef enum { // *
+ epseisdtempECU_LOW = 0x00, // *
+ epseisdtempECU_HIGH = 0x01, // *
+ } EPWR_LOGGING_EVT_DETAIL_SD_TEMP_TYPE; // *
+ // *
+ // Ei_ShutDown_NetworkError byte0 Event Detail *
+ typedef enum { // *
+ epseisdneHMI_CAN = 0x00, // *
+ epseisdneHU_CAN = 0x01 // *
+ } EPWR_LOGGING_EVT_DETAIL_SD_NETWORK_ERROR_TYPE; // *
+ // *
+ // Ei_ShutDown_Voltage byte0 Event Detail *
+ typedef enum { // *
+ epseisdnvoltBATTERY_CUT_OFF = 0x00, // *
+ epseisdnvoltLIMP_HOME = 0x01, // *
+ epseisdnvoltUNKNOWN = 0xFF // *
+ } EPWR_LOGGING_EVT_DETAIL_SD_VOLTAGE_TYPE; // *
+ // *
+ // End of Event Logging enums & typedefs *
+ //**************************************************************************
+
+ PowerSessionHandler m_oSessionHandler;
+ PowerConfigParams m_tConfigData;
+ PowerStateMachine m_oStateMachine;
+ UI_32 m_aTimerIDs[15];
+ wakeInfo m_WakeUpData; /// WakeUp data received from SPM
+ SS_PSState m_PowerState;
+ ePowerSrvVoltageStates m_VoltageState;
+ ePowerSrvCrankStates m_CrankState;
+ UI_32 m_MaxShutdownTimeout;
+ std::map<SS_PSState, std::string> m_PPStateStrMap;
+
+ // Notify Module on Voltage change detected.
+ EFrameworkunifiedStatus PublishVoltageStateChange(HANDLE h_app);
+ EFrameworkunifiedStatus ConstructPwrStateResponse(CHAR *f_MessageResponse);
+ EFrameworkunifiedStatus AddStateInformationToResponse(CHAR *f_MessageResponse);
+ EFrameworkunifiedStatus AddVoltageInformationToResponse(CHAR *f_MessageResponse);
+ EFrameworkunifiedStatus AddCrankInformationToResponse(CHAR *f_MessageResponse);
+ EFrameworkunifiedStatus RegisterAllCallbacksAndNofitications(HANDLE h_app);
+ VOID SetPowerServiceState(SS_PSState f_NewState);
+ EFrameworkunifiedStatus ValidateUserModeMessage(HANDLE h_app,
+ EPWR_USER_MODE_TYPE &l_eUserModeState); // NOLINT (runtime/references)
+
+ pthread_mutex_t pwr_hist_mutex;
+
+ void SetCmdHist(std::string cmd,
+ cmdHist &hist, // NOLINT (runtime/references)
+ cmdHistIter &it, // NOLINT (runtime/references)
+ std::string sender);
+};
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_H_
diff --git a/video_in_hal/systemservice/power_service/server/include/ss_power_config.h b/video_in_hal/systemservice/power_service/server/include/ss_power_config.h
new file mode 100755
index 0000000..09ca70d
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/include/ss_power_config.h
@@ -0,0 +1,147 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports power service configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_
+
+
+#include <system_service/ss_system_types.h>
+#include <system_service/ss_templates.h>
+#include <native_service/ns_config_parser_if.h>
+#include <list>
+#include <string>
+#include "ss_power_powerservicelog.h"
+
+typedef std::list<SS_String> RequiredModuleList;
+typedef RequiredModuleList::iterator RequiredModuleListIter;
+
+#define SS_PWR__CWORD56__REP_HIST_SIZE (10u)
+#define SS_PWR_PUB_CMD_HIST_SIZE (5u)
+#define SS_PWR_ERR_HIST_SIZE (5u)
+#define SS_PWR_V_HIST_SIZE (10u)
+#define SS_PWR_DEBUG_DUMP_MAX_SIZE (4096u)
+
+typedef struct _PowerConfigParams { // NOLINT (readability/naming) // LCOV_EXCL_BR_LINE 14:it will be called when poweron
+ typedef struct {
+ SI_32 timeout;
+ struct {
+ BOOL enabled;
+ SI_32 timeout;
+ SI_32 tries;
+ } hysteresis;
+ } PowerOffInfo;
+
+ SS_String power_logic_plugin;
+ PowerOffInfo lvi1;
+ PowerOffInfo lvi2;
+ PowerOffInfo shutdown;
+ RequiredModuleList wakeup_modules;
+ RequiredModuleList shutdown_modules;
+ RequiredModuleList lvi2_modules;
+} PowerConfigParams;
+
+class PowerConfiguration {
+ public:
+ // define all the configuration parmeters that will be used to get data
+ static const char * kPowerLogicPlugin;
+ static const char * kLVI1Timeout;
+ static const char * kLVI1HysteresisTimeout;
+ static const char * kLVI1HysteresisEnabled;
+ static const char * kLVI1HysteresisTries;
+ static const char * kLVI2Timeout;
+ static const char * kLVI2HysteresisTimeout;
+ static const char * kLVI2HysteresisEnabled;
+ static const char * kLVI2HysteresisTries;
+ static const char * kShutdownTimeout;
+ static const char * kShutdownHysteresisTimeout;
+ static const char * kShutdownHysteresisEnabled;
+ static const char * kShutdownHysteresisTries;
+
+ /// < defines the names in the xml file that are used to get required modules names
+ static const char * kRequiredWakeupModules; /// < once all the modules have been wakened up send wake-up complete
+ static const char * kRequiredShutdownModules; /// < once all the modules have been shutdown send shutdown complete
+ static const char * kRequiredLvi2Modules; /// < once all the modules have been wakened up send wake-up complete
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PowerConfiguration
+ /// \brief Here it is checked whether the new connection is to be connected or not, if yes then whether the old
+ /// connection is to be disconnected or to be paused or to be played simultaneously.
+ ///
+ /// \param [in] f_configFileName Configuration file name.
+ ///
+ /// \return NA
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ explicit PowerConfiguration(std::string f_configfilename);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~PowerConfiguration
+ /// \brief Here it is checked whether the new connection is to be connected or not, if yes then whether the old
+ /// connection is to be disconnected or to be paused or to be played simultaneously.
+ ///
+ /// \param [in] pRequestingSrc
+ /// Source* - Pointer to the requesting source.
+ ///
+ /// \return bool
+ /// bool - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~PowerConfiguration();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// LoadParameters
+ /// \brief Load module parameters from configuration file.
+ ///
+ /// \param [in] params - Ref to variable which to store the loaded module parameters.
+ ///
+ /// \return bool
+ /// bool - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL LoadParameters(PowerConfigParams & params); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// LoadDefaultParameters
+ /// \brief Laod default power services parameters.
+ ///
+ /// \param [in] params - Ref to variable for which to store the default module parameters.
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void LoadDefaultParameters(PowerConfigParams & params); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintConfigInfo
+ /// \brief Print configuration information.
+ ///
+ /// \param [in] params - Ref to variable containing the configuration parameters to load.params
+ ///
+ /// \return none.
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ void PrintConfigInfo(PowerConfigParams & f_params); // NOLINT (runtime/references)
+
+ protected:
+ PowerConfiguration(const PowerConfiguration &);
+ PowerConfiguration & operator =(const PowerConfiguration &); // NOLINT (runtime/references)
+
+ private:
+ std::string m_ConfigFileName;
+};
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_
diff --git a/video_in_hal/systemservice/power_service/server/include/ss_power_powerservicelog.h b/video_in_hal/systemservice/power_service/server/include/ss_power_powerservicelog.h
new file mode 100755
index 0000000..3d912fa
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/include/ss_power_powerservicelog.h
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports 002 application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_POWERSERVICELOG_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_POWERSERVICELOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_FUNC_IPC ZONEMASK(13)
+#define ZONE_POWER_MONITOR ZONEMASK(14)
+#define ZONE_POWER_STATEMACHINE ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_INFO_IPC ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "Ipc Function"
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 "Power StateMachine"
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 "Ipc Info"
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR //, ZONE_INFO,ZONE_POWER_STATEMACHINE, ZONE_DEBUG_DUMP, ZONE_FUNC
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern const CHAR AppName[]; // NOLINT (readability/naming)
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_POWERSERVICELOG_H_
diff --git a/video_in_hal/systemservice/power_service/server/include/ss_power_session.h b/video_in_hal/systemservice/power_service/server/include/ss_power_session.h
new file mode 100755
index 0000000..47a4a4a
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/include/ss_power_session.h
@@ -0,0 +1,70 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports power service session management.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_SESSION_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_SESSION_H_
+
+#include <system_service/ss_power_service.h>
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include <string>
+#include "ss_power_config.h"
+
+typedef std::string SubscriberName; // The name of the module that is trying to open a session with Power
+
+/*
+ *
+ */
+class PowerSessionHandler {
+ public:
+ PowerSessionHandler();
+ virtual ~PowerSessionHandler();
+ EFrameworkunifiedStatus OpenSesion(HANDLE h_app);
+ EFrameworkunifiedStatus CloseSession(HANDLE h_app);
+ EFrameworkunifiedStatus StartComplete(HANDLE h_app);
+ EFrameworkunifiedStatus StopComplete(HANDLE h_app);
+
+ VOID Print();
+
+ // Methods that do the heavy lifting
+ BOOL WakeupComplete(RequiredModuleList & wakeup_modules); // NOLINT (runtime/references)
+ BOOL ShutdownComplete(RequiredModuleList & shutdown_modules); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus SendToSupervisor(UI_32 cmd, UI_32 length, PVOID data);
+ BOOL AllClientsInGroupStarted(UI_32 f_ungrpid);
+ BOOL ClientPresent(PCSTR f_sclientname);
+
+ private:
+ struct PwSessionInfo {
+ std::string sz_name;
+ std::string sz_servicename;
+ HANDLE hsession;
+ BOOL frunning;
+ EPWR_SESSION_TYPE esessiontype;
+ UI_32 ui_groupid;
+ };
+
+ typedef std::map<SubscriberName, PwSessionInfo> PwSessionMap;
+ typedef PwSessionMap::iterator PwSessionIter;
+
+ PwSessionMap m_mapSessions;
+};
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_SESSION_H_
diff --git a/video_in_hal/systemservice/power_service/server/include/ss_power_state_hysteresis.h b/video_in_hal/systemservice/power_service/server/include/ss_power_state_hysteresis.h
new file mode 100755
index 0000000..c136630
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/include/ss_power_state_hysteresis.h
@@ -0,0 +1,74 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports power service hysteresis management.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_HYSTERESIS_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_HYSTERESIS_H_
+
+#include "ss_power_config.h"
+
+class PowerStateHysteresis {
+ public:
+ PowerStateHysteresis()
+ : m_unTries(0) {
+ bzero(&m_tHysteresisInfo, sizeof(m_tHysteresisInfo));
+ }
+
+ virtual ~PowerStateHysteresis() { // LCOV_EXCL_START 14: do it when power off
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ m_unTries = 0;
+ }
+ // LCOV_EXCL_STOP 14: do it when power off
+ explicit PowerStateHysteresis(PowerConfigParams::PowerOffInfo & info) // NOLINT (runtime/references)
+ : m_unTries(0),
+ m_tHysteresisInfo(info) {
+ }
+ void set(PowerConfigParams::PowerOffInfo & info) { // NOLINT (runtime/references)
+ m_tHysteresisInfo = info;
+ }
+ BOOL getEnabled() const {
+ return m_tHysteresisInfo.hysteresis.enabled;
+ }
+ UI_32 getTimeout() const {
+ return m_tHysteresisInfo.hysteresis.timeout;
+ }
+ UI_32 getTries() const {
+ return m_tHysteresisInfo.hysteresis.tries;
+ }
+
+ void clearTryCounter() {
+ m_unTries = 0;
+ }
+ void bumbTryCounter() {
+ m_unTries++;
+ }
+ BOOL maxTries() const {
+ if (m_unTries < getTries())
+ return FALSE;
+ else
+ return TRUE;
+ }
+
+ private:
+ UI_32 m_unTries;
+ PowerConfigParams::PowerOffInfo m_tHysteresisInfo;
+};
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_HYSTERESIS_H_
diff --git a/video_in_hal/systemservice/power_service/server/include/ss_power_state_machine.h b/video_in_hal/systemservice/power_service/server/include/ss_power_state_machine.h
new file mode 100755
index 0000000..086f36c
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/include/ss_power_state_machine.h
@@ -0,0 +1,414 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports the power service state machine.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_MACHINE_H_
+#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_MACHINE_H_
+
+#include <system_service/ss_power_service.h>
+#include "ss_power_state_hysteresis.h"
+
+class PowerSessionHandler;
+
+class PowerStateMachine {
+ class Base_State {
+ public:
+ virtual void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ virtual void onStartComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ virtual void onLaunchComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+ virtual void onStopComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ virtual void onShutdownComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onSoftwareUpdate(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onHysteresisAborted(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onHysteresisTimeout(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+ virtual PCSTR name() = 0;
+
+ /// State Entry and Exit methods
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+
+ // LCOV_EXCL_START 200: virtual function
+ virtual void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 200: virtual function
+ };
+
+ friend class Base_State;
+
+ class Wakeup : public Base_State {
+ public:
+ void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onSoftwareUpdate(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ virtual PCSTR name();
+
+ // LCOV_EXCL_START 8: fist status, no entry
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP 8: fist status, no entry
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ };
+
+ friend class Wakeup;
+
+ class WakeupActive : public Wakeup {
+ public:
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ };
+
+ friend class WakeupActive;
+
+ class WakeupPending : public Wakeup {
+ public:
+ void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onStartComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLaunchComplete(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ };
+
+ friend class WakeupPending;
+
+ class Shutdown : public Base_State {
+ public:
+ void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession) { // NOLINT (runtime/references)
+ }
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisAborted(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisTimeout(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class Shutdown;
+
+ class ShutdownActive : public Base_State {
+ public:
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class ShutdownActive;
+
+ class LowVoltage1 : public Base_State {
+ public:
+ void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisAborted(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisTimeout(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class LowVoltage1;
+
+ class LowVoltage1Active : public Base_State {
+ public:
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class LowVoltage1Active;
+
+ class LowVoltage2 : public Base_State {
+ public:
+ void onWakeup(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisAborted(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onHysteresisTimeout(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class LowVoltage2;
+
+ class LowVoltage2Active : public Base_State {
+ public:
+ void onNormalVoltageEncountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class LowVoltage2Active;
+
+ class NormalVoltage : public Base_State {
+ public:
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onSoftwareUpdate(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class NormalVoltage;
+
+ class SoftwareUpdate : public Base_State {
+ public:
+ void onShutdown(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage1Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onLowVoltage2Encountered(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ PCSTR name();
+
+ void onEntry(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void onExit(PowerStateMachine &u, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ };
+
+ friend class SoftwareUpdate;
+
+ public:
+ typedef enum _Power_State_Machine_Events {
+ epsmeWAKEUP = epswsPWRON,
+ epsmeSHUTDOWN = epscnCANSLEEP,
+ epsmeLVI1_ENCOUNTERED = epsvsLVI1,
+ epsmeLVI2_ENCOUNTERED = epsvsLVI2,
+ epsmeNORMAL_VOLTAGE_ENCOUNTERED = epsvsNORMAL,
+ epsmeSTART_COMPLETE = 0xD1,
+ epsmeSTOP_COMPLETE = 0xD2,
+ epsmeSOFTWARE_UPDATE = 0xE1,
+ epsmeSHUTDOWN_HYSTERESIS_ABORTED = 0xF1,
+ epsmeLVI1_HYSTERESIS_ABORTED = 0xF2,
+ epsmeLVI2_HYSTERESIS_ABORTED = 0xF3,
+ epsmeSHUTDOWN_HYSTERESIS_TM_OUT = 0xFA,
+ epsmeLVI1_HYSTERESIS_TM_OUT = 0xFB,
+ epsmeLVI2_HYSTERESIS_TM_OUT = 0xFC,
+ } ePowerStateMachineEvents;
+
+ PowerStateMachine();
+ virtual ~PowerStateMachine();
+ void onEvent(HANDLE h_app, PowerSessionHandler & oSession, // NOLINT (runtime/references)
+ ePowerStateMachineEvents evt);
+ EFrameworkunifiedStatus initialize(HANDLE h_app, PowerConfigParams & refConfigParms); // NOLINT (runtime/references)
+ PCSTR name();
+
+ private:
+ static Wakeup WakeupState;
+ static WakeupActive WakeupActiveState;
+ static WakeupPending WakeupPendingState;
+ static LowVoltage1 LowVoltage1State;
+ static LowVoltage1Active LowVoltage1ActiveState;
+ static LowVoltage2 LowVoltage2State;
+ static LowVoltage2Active LowVoltage2ActiveState;
+ static Shutdown ShutdownState;
+ static ShutdownActive ShutdownActiveState;
+ static NormalVoltage NormalVoltageState;
+ static SoftwareUpdate SoftwareUpdateState;
+
+ Base_State *m_pCurrentState;
+ Base_State *m_pPreviousState;
+ Base_State *m_pOnHysteresisTimeoutState;
+ PowerStateHysteresis m_oShutdownHysteresis;
+ PowerStateHysteresis m_oLowVoltage1Hysteresis;
+ PowerStateHysteresis m_oLowVoltage2Hysteresis;
+ RequiredModuleList m_lstWakeupModules;
+ RequiredModuleList m_lstShutdownModules;
+ RequiredModuleList m_lstLvi2Modules;
+ HANDLE m_hHysteresisTimer;
+
+ typedef struct _state_info {
+ EPWR_POWER_STATE_TYPE wake;
+ EPWR_VOLTAGE_STATE_TYPE voltage;
+ EPWR_WAKEUP_LEVEL_TYPE level;
+ EPWR_WAKEUP_FACTOR_TYPE factor;
+ EPWR_CRANK_STATE_TYPE crank;
+ } Pwr_StateInfo;
+
+ Pwr_StateInfo m_tStateInfo;
+
+ PowerStateMachine(PowerStateMachine&);
+ PowerStateMachine & operator=(PowerStateMachine &);
+
+ /// Helper methods
+ void NextState(Base_State & refState, HANDLE h_app, // NOLINT (runtime/references)
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+ void GotoStateOnHysteresisTimeout(Base_State & refState); // NOLINT (runtime/references)
+ void startHysteresisTimer(PowerStateHysteresis & hys_info); // NOLINT (runtime/references)
+ void reStartHysteresisTimer(PowerStateHysteresis & hys_info); // NOLINT (runtime/references)
+ void stopHysteresisTimer(PowerStateHysteresis & hys_info); // NOLINT (runtime/references)
+ void publishPowerLVIStatus(HANDLE h_app, PCSTR nNotifNm, UI_32 value);
+ void publishPowerLevelType(HANDLE h_app, UI_32 value);
+
+ void OnVoltage(Base_State * pState, HANDLE h_app,
+ PowerSessionHandler & oSession); // NOLINT (runtime/references)
+};
+
+#endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_MACHINE_H_
diff --git a/video_in_hal/systemservice/power_service/server/src/powerservice_application.cpp b/video_in_hal/systemservice/power_service/server/src/powerservice_application.cpp
new file mode 100755
index 0000000..4c44459
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/src/powerservice_application.cpp
@@ -0,0 +1,236 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file contains the standard set functions called by the NS
+// dispatcher on application initialization, cleanup and wakeup.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <system_service/ss_services.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+#include "ss_power_powerservicelog.h"
+#include "ss_power.h"
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app)
+ * @brief Handles setup for SS_Power subsystem, registers with
+ * NP_Service and indicates that its ready.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ eStatus = Power::GetInstance().Initialize(h_app);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+/**
+ * EFrameworkunifiedStatus PowerserviceOnWakepup(HANDLE h_app)
+ * @brief This is not handled by the Power Subsystem since send out the
+ * notifications that indicated Wakeup.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus PowerserviceOnWakepup(HANDLE h_app) { // LCOV_EXCL_START 200: not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 200: not called by NSFW
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE h_app)
+ * @brief This is not handled by the Power Subsystem since send out the
+ * notifications that indicated Shutdown.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE h_app) { // LCOV_EXCL_START 200: not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 200: not called by NSFW
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE h_app)
+ * @brief This is not handled by the Power Subsystem since send out the
+ * notifications that indicated Emergency Shutdown.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE h_app) { // LCOV_EXCL_START 200: not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 200: not called by NSFW
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app)
+ * @brief SS_Power will exit when this method is invoked,
+ * return value will always be invalid.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app) { // LCOV_EXCL_START 200: not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__,
+ " This method is not valid for %s, returning "
+ "eFrameworkunifiedStatusNotImplemented",
+ SERVICE_POWER);
+ return eFrameworkunifiedStatusNotImplemented;
+}
+// LCOV_EXCL_STOP 200: not called by NSFW
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app)
+ * @brief Used to ask SS_Power to dump its vital information about the subsystem.
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app) { // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ Power* l_instance = &Power::GetInstance();
+
+ if (l_instance != NULL) {
+ l_instance->SSPowerDebugDump(h_app);
+
+ } else {
+ eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ return eStatus;
+}
+// LCOV_EXCL_STOP 7: debug code
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app)
+ * @brief Used to .
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app)
+ * @brief Used to .
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app)
+ * @brief Used to .
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app) { // LCOV_EXCL_START 200: not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP 200: not called by NSFW
+// EOF
+
diff --git a/video_in_hal/systemservice/power_service/server/src/powerservice_main.cpp b/video_in_hal/systemservice/power_service/server/src/powerservice_main.cpp
new file mode 100755
index 0000000..0b1ccfe
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/src/powerservice_main.cpp
@@ -0,0 +1,70 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief Application entry point.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <system_service/ss_services.h>
+#include <system_service/ss_version.h>
+#include <system_service/ss_system_if.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/ns_message_center_if.h>
+
+#include "ss_power_powerservicelog.h"
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+
+/// \brief: Name of the Queue that will be
+/// used to read data from.
+const CHAR AppName[] = SERVICE_POWER;
+
+/// \brief: public structure that is used
+/// for logging by NSLogger.
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+FRAMEWORKUNIFIEDLOGOPTIONS, {
+ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ZONE_TEXT_31 }, FRAMEWORKUNIFIEDLOGZONES };
+
+/**
+ *int main(int argc, char *argv[])
+ * @brief Main function for SS_Power subsystem.
+ *
+ * @param argc number of arguments passed to SS_Power
+ * @param argv array of arguments passed to SS_Power
+ *
+ * @return int status of applications exit.
+ */
+int main(int argc, char *argv[]) {
+ FRAMEWORKUNIFIED_SET_ZONES();
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cbFuncs);
+
+ EFrameworkunifiedStatus eStatus = FrameworkunifiedDispatcherWithArguments(AppName, argc, argv,
+ &cbFuncs);
+ return eStatus;
+}
+
diff --git a/video_in_hal/systemservice/power_service/server/src/ss_power.cpp b/video_in_hal/systemservice/power_service/server/src/ss_power.cpp
new file mode 100755
index 0000000..26e8881
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/src/ss_power.cpp
@@ -0,0 +1,1672 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief Handles Power Service Business logic
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "ss_power.h"
+#include <inttypes.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service.h>
+#include <system_service/ss_power_service_notifications_local.h>
+#include <system_service/ss_power_service_local.h>
+#include <native_service/frameworkunified_timer.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <utility>
+#include <string>
+
+#include "ss_power_powerservicelog.h"
+
+using namespace std; // NOLINT (build/namespaces)
+
+static Power g_PowerSubsystem;
+
+/**
+ * @brief
+ *
+ * @param
+ * @param
+ *
+ * @return
+ */
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus PowerCallback(
+ HANDLE h_app) {
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ C * pObj = static_cast<C *>(&g_PowerSubsystem);
+
+ if (pObj) {
+ l_eStatus = (pObj->*M)(h_app);
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// GetInstance
+/// Return global instance of Power object. Power is singleton class
+///
+//////////////////////////////////////////////////////////////////////
+Power & Power::GetInstance() {
+ return g_PowerSubsystem;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// Power
+/// Constructor of Power class
+///
+//////////////////////////////////////////////////////////////////////
+Power::Power()
+ : m__CWORD56_RepHist(SS_PWR__CWORD56__REP_HIST_SIZE),
+ m_PubCmdHist(SS_PWR_PUB_CMD_HIST_SIZE),
+ m_ErrHist(SS_PWR_ERR_HIST_SIZE),
+ m_VCmdHist(SS_PWR_V_HIST_SIZE),
+ m_PowerState(SS_PS_READY_TO_WAKEUP),
+ m_VoltageState(epsvsINVALID),
+ m_CrankState(epscsINVALID),
+ m_MaxShutdownTimeout(0) {
+ m_PPStateStrMap[SS_PS_READY_TO_WAKEUP] = "SS_PS_READY_TO_WAKEUP";
+ m_PPStateStrMap[SS_PS_WAKEUP_INITIATED] = "SS_PS_WAKEUP_INITIATED";
+ m_PPStateStrMap[SS_PS_WAKEUP_COMPLETE] = "SS_PS_WAKEUP_COMPLETE";
+ m_PPStateStrMap[SS_PS_POWER_ON_COMPLETE] = "SS_PS_POWER_ON_COMPLETE";
+ m_PPStateStrMap[SS_PS_POWER_OFF_INITIATED] = "SS_PS_POWER_OFF_INITIATED";
+ m_PPStateStrMap[SS_PS_POWER_OFF_COMPLETE] = "SS_PS_POWER_OFF_COMPLETE";
+ m_PPStateStrMap[SS_PS_SHUTDOWN_INITIATED] = "SS_PS_SHUTDOWN_INITIATED";
+ m_PPStateStrMap[SS_PS_SHUTDOWN_COMPLETE] = "SS_PS_SHUTDOWN_COMPLETE";
+ m_PPStateStrMap[SS_PS_STATE_MAX] = "SS_PS_STATE_MAX";
+
+ m__CWORD56_RepIter = m__CWORD56_RepHist.begin();
+ m_PubHistIter = m_PubCmdHist.begin();
+ m_ErrHistIter = m_ErrHist.begin();
+ m_VHistIter = m_VCmdHist.begin();
+ bzero(&m_WakeUpData, sizeof(m_WakeUpData));
+}
+
+///////////////////////////////////////////////////////////////////////
+/// ~Power
+/// Destructor of Power class
+///
+//////////////////////////////////////////////////////////////////////
+Power::~Power() { // LCOV_EXCL_START 14 Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP 14 Resident process, not called by NSFW
+
+///////////////////////////////////////////////////////////////////////
+/// Initialize
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::Initialize(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ BOOL l_SpecifiedCfgLoaded;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ SetPowerServiceState(SS_PS_READY_TO_WAKEUP);
+
+ pthread_mutex_init(&pwr_hist_mutex, NULL);
+
+ /// Open and parse the configuration data for Power
+ const CHAR configFileName[] = "/usr/agl/conf/BS/ss/power_service/rodata/gpf_ss_ps_config.cfg";
+
+ PowerConfiguration config(configFileName);
+ l_SpecifiedCfgLoaded = config.LoadParameters(m_tConfigData);
+ if (FALSE == l_SpecifiedCfgLoaded) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ "Reading configuration from file: %s failed. Using default parameters.",
+ configFileName);
+ config.LoadDefaultParameters(m_tConfigData);
+ }
+
+ config.PrintConfigInfo(m_tConfigData);
+
+ /// init PowerStateMachine
+ m_oStateMachine.initialize(h_app, m_tConfigData);
+
+ // Register all callbacks to dispatcher and notifications
+ l_eStatus = RegisterAllCallbacksAndNofitications(h_app);
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus, "RegisterAllCallbacksAndNofitications()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// RegisterAllCallbacksAndNofitications
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::RegisterAllCallbacksAndNofitications(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(h_app, szNTFY_PowerAvailability))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(
+ "FrameworkunifiedRegisterServiceAvailabilityNotification( "szNTFY_PowerAvailability" )");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_eStatus = FrameworkunifiedPublishServiceAvailability(h_app, FALSE);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedPublishServiceAvailability()");
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ SS_PWR_LOG_HIST("FrameworkunifiedPublishServiceAvailability()", m_PubCmdHist,
+ m_PubHistIter, "", l_eStatus);
+ }
+
+ // Attach Notification callbacks to dispatcher
+ FrameworkunifiedNotificationsList
+ ss_power_notifications[] = {
+ { szNTFY_PowerLVI1, sizeof(PowerSrvLVIStatus), eFrameworkunifiedStateVar}
+ , {szNTFY_PowerLVI2, sizeof(PowerSrvLVIStatus), eFrameworkunifiedStateVar}
+ , {szNTFY_PowerLevel, sizeof(PowerSrvLevelType), eFrameworkunifiedStateVar}
+ , {szNTFY_ShutdownPopup, sizeof(EPWR_SHUTDOWN_POPUP_TYPE), eFrameworkunifiedStateVar}
+ , {szNTFY_PowerPopup, sizeof(EPWR_POWER_POPUP_TYPE), eFrameworkunifiedStateVar}
+ };
+ // Register Notifications
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedNPRegisterNotifications(h_app, ss_power_notifications, _countof(ss_power_notifications)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedNPRegisterNotifications(ss_power_notifications)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ // Subscribe and attach call back for notification
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(h_app, NTFY_SSSystemMgrPowerOnOff, PowerCallback<Power, &Power::OnPowerOnOffNotification>))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSubscribeNotificationWithCallback()");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+//*************************
+
+/// < Attach to the following session handles.
+ FrameworkunifiedProtocolCallbackHandler ss_power_session_req_handlers[] = {
+ /// session handles.
+ { PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
+ &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
+ PowerCallback<Power, &Power::OnCloseSession> }, {
+ SS_POWER_STATE_CHANGE_REQ, PowerCallback<Power,
+ &Power::OnSetPowerState> }, { SS_POWER_POWER_REQUEST_MSG,
+ PowerCallback<Power, &Power::OnPowerRequestMsg> }, {
+ SS_POWER_COMM_WAKEUP,
+ PowerCallback<Power, &Power::OnSetCommWakeUp> }, {
+ SS_POWER_SHUTDOWN_REQ,
+ PowerCallback<Power, &Power::OnSetCommSleep> }, {
+ SS_POWER_SHUTDOWN_REQUEST_MSG, PowerCallback<Power,
+ &Power::OnShutdownRequestMsg> }
+
+ /// Wake-up / Shutdown Protocol commands for System Manager.
+ , { SS_SM_WAKEUP_MODULES_CMPL_RSPN, PowerCallback<Power,
+ &Power::OnWakeUpComplete> }, { SS_SM_SHUTDOWN_MODULES_CMPL_RSPN,
+ PowerCallback<Power, &Power::OnShutdownComplete> }
+ //
+ , { SS_POWER_PRINT_CONNECTIONS, PowerCallback<Power,
+ &Power::OnPrintConnections> }, { SS_POWER_PRINT_STACK,
+ PowerCallback<Power, &Power::OnPrintStack> }
+ /// Set Voltage & Crank states from shadow?
+ , { SS_POWER_VOLTAGE_STATE, PowerCallback<Power,
+ &Power::OnSetVoltageState> }, { SS_POWER_CRANK_STATE,
+ PowerCallback<Power, &Power::OnSetCrankState> }
+ /// Current Power Service State inquiry from Test Client
+ , { SS_POWER_CRNT_STATE_QUERY, PowerCallback<Power,
+ &Power::OnCurrentPowerStateQuery> }, {
+ SS_POWER_SYSTEM_MODE_INFO_REQ, PowerCallback<Power,
+ &Power::OnSystemModeInfoRequest> }, {
+ SS_SM_SYSTEM_MODE_INFO_RSPN, PowerCallback<Power,
+ &Power::OnSystemModeInfoResponse> }
+ /// InitComp report to SystemManager
+ , { SS_POWER_INITCOMP_REP, PowerCallback<Power,
+ &Power::OnInitCompReport> }
+ //
+ // Startup Confirmation Request ( from Power Shadow ) and
+ // Startup Confirmation Response ( from System Manager )
+ , { SS_POWER_FWD_START_CONFIRMATION_MSG_REQ, PowerCallback<Power,
+ &Power::OnSendStartupConfirmationRequest> }, {
+ SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, PowerCallback<Power,
+ &Power::OnSendStartupConfirmationResponse> }
+ //
+ // User Mode Request ( from Power Shadow ) and
+ // User Mode Response ( from System Manager )
+ , { SS_SM_USER_MODE_SET_RESP, PowerCallback<Power,
+ &Power::OnUserModeResponse> }
+
+ //
+ // Heartbeat Request ( from Power Shadow )
+ , { SS_POWER_HEARTBEAT_REQ, PowerCallback<Power,
+ &Power::On_CWORD56_HeartBeatRequest> }, { SS_SM__CWORD56__HEARTBEAT_RSPN,
+ PowerCallback<Power, &Power::OnSM_CWORD56_HeartBeatResponse> }
+
+ // System Manager to Power Services
+ , { SS_SM_CPU_RESET_REQ, PowerCallback<Power,
+ &Power::OnCpuResetRequest> }, { SS_SM_REMOTE_DATA_RESET_REQ,
+ PowerCallback<Power, &Power::OnRemoteDataResetRequest> } };
+
+ // Attach callback
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, ss_power_session_req_handlers, _countof(ss_power_session_req_handlers)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher( ss_power_session_req_handlers )");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ //*************************
+
+ // Publish szNTFY_PowerAvailable so that other services can start connecting via sessions.
+
+ l_eStatus = RegisterSMSessionAckCallback(
+ PowerCallback<Power, &Power::OnSystemMgrConnectionEstablished>);
+ LOG_STATUS(l_eStatus, "RegisterSMSessionAckCallback()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnSetCommWakeUp
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSetCommWakeUp(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ Pwr_ServiceSetInterface l_CanStatesData;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_CanStatesData))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else if (l_CanStatesData.data.commwake.state == epscnCANWAKEUP) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Received WakeUp from %s, Processing Ignored !!",
+ FrameworkunifiedGetMsgSrc(h_app));
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnSetCommSleep
+///
+///
+//////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_START 200: can not be called from power class
+EFrameworkunifiedStatus Power::OnSetCommSleep(HANDLE h_app) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ Pwr_ServiceSetInterface l_CanStatesData;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_CanStatesData))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else if (l_CanStatesData.data.commwake.state != epscnCANSLEEP) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: %s: l_CanStatesData.data.commwake.state != epscnCANSLEEP",
+ FrameworkunifiedGetMsgSrc(h_app));
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Received Sleep from %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+
+ // Send to System Manager to WakeUp Modules
+ l_eStatus = SendShutdownToSystemManager(&l_CanStatesData);
+ if (l_eStatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("SendShutdownToSystemManager()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ SetPowerServiceState(SS_PS_SHUTDOWN_INITIATED);
+ LOG_SUCCESS("SendShutdownToSystemManager()");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP 200: can not be called from power class
+
+///////////////////////////////////////////////////////////////////////
+/// SetPowerServiceState
+///
+///
+//////////////////////////////////////////////////////////////////////
+VOID Power::SetPowerServiceState(SS_PSState f_NewState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Changing State from '%s' to '%s'",
+ m_PPStateStrMap[m_PowerState].c_str(),
+ m_PPStateStrMap[f_NewState].c_str());
+
+ m_PowerState = f_NewState;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnPowerOnOffNotification
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnPowerOnOffNotification(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ T_SS_SM_UserModeOnOffNotification_StructType l_userModeOnOffStruct;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<T_SS_SM_UserModeOnOffNotification_StructType>(h_app, l_userModeOnOffStruct))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " User Mode is '%s', User Mode Change Reason is '%s'",
+ GetStr(l_userModeOnOffStruct.isUserModeOn).c_str(),
+ GetStr(l_userModeOnOffStruct.userModeChangeReason).c_str());
+ SetPowerServiceState(
+ l_userModeOnOffStruct.isUserModeOn ?
+ SS_PS_POWER_ON_COMPLETE : SS_PS_POWER_OFF_COMPLETE);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// ProcessSystemWakeUp
+/// On receipt of this notification send wake up notification to
+/// System Manager to wake up (START) all modules
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSetPowerState(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ Pwr_ServiceSetInterface l_serviceSetIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_serviceSetIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ switch (l_serviceSetIf.data.wake.powerupType) {
+ case epswsPWRON:
+ case epswsPWROFF:
+ m_WakeUpData = l_serviceSetIf.data.wake;
+
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO, __FUNCTION__, " Received Power %s from %s, level 0x%X",
+ l_serviceSetIf.data.wake.powerupType == epswsPWRON ? "On" : "Off",
+ FrameworkunifiedGetMsgSrc(h_app), m_WakeUpData.up.level);
+ // Send to System Manager to WakeUp Modules
+ l_eStatus = SendWakeUpToSystemManager(&m_WakeUpData);
+ if (l_eStatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ SetPowerServiceState(SS_PS_WAKEUP_INITIATED);
+ LOG_SUCCESS("SendWakeUpToSystemManager()");
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("SendWakeUpToSystemManager()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ break;
+ default:
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Invalid PowerOnOff State received: 0x%X",
+ l_serviceSetIf.data.wake.powerupType);
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+/// Session Request Handlers
+///
+//////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus Power::OnOpenSession(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
+ l_eStatus = m_oSessionHandler.OpenSesion(h_app);
+
+ /// < Test Code TODO: Remove ME!!!
+ // m_oSessionHandler.Print();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnCloseSession(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
+ l_eStatus = m_oSessionHandler.CloseSession(h_app);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnWakeUpComplete(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ wakeInfo l_Wake;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<wakeInfo>(h_app, l_Wake))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else if (l_Wake.up.level == m_WakeUpData.up.level) {
+ SetPowerServiceState(SS_PS_WAKEUP_COMPLETE);
+
+ /// < send the state machine a wakeup event.
+ m_oStateMachine.onEvent(h_app, m_oSessionHandler,
+ PowerStateMachine::epsmeWAKEUP);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Sending SS_POWER_STATE_CHANGE_RESP(%s) to PSM",
+ l_Wake.powerupType == epswsPWRON ? "User_On" : "User_Off");
+
+ // send Wake-up complete response to Supervisor
+ m_oSessionHandler.SendToSupervisor(SS_POWER_STATE_CHANGE_RESP,
+ sizeof(l_Wake), (PVOID) &l_Wake);
+ SS_PWR_LOG_HIST("SS_POWER_STATE_CHANGE_RESP", m__CWORD56_RepHist, m__CWORD56_RepIter,
+ "SS_PS_WAKEUP_COMPLETE", l_eStatus);
+
+ /// < Test Code TODO: Remove ME!!!
+ // m_oSessionHandler.Print();
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error: Power WakeUp Threshold (%d) and SM WakeUp Threshold (%d) Mismatch",
+ m_WakeUpData.up.level, l_Wake.up.level);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnShutdownComplete(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ SetPowerServiceState(SS_PS_SHUTDOWN_COMPLETE);
+
+ m_oStateMachine.onEvent(h_app, m_oSessionHandler,
+ PowerStateMachine::epsmeSHUTDOWN);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending SS_POWER_SHUTDOWN_RESP to PSM");
+ // send Shutdown complete response to Power Shadow / Supervisor
+ m_oSessionHandler.SendToSupervisor(SS_POWER_SHUTDOWN_RESP, 0, (PVOID) NULL);
+
+ SS_PWR_LOG_HIST("SS_POWER_SHUTDOWN_RESP", m__CWORD56_RepHist, m__CWORD56_RepIter,
+ "SS_PS_SHUTDOWN_COMPLETE", l_eStatus);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnShutdownComplete(HANDLE h_app)
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnPrintConnections(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_oSessionHandler.Print();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnPrintStack(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_oSessionHandler.Print();
+ // m_oStateMachine.Print();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnHysteresisTimeout(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_oStateMachine.onEvent(h_app, m_oSessionHandler,
+ PowerStateMachine::epsmeLVI1_HYSTERESIS_TM_OUT);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+
+EFrameworkunifiedStatus PowerStateMachine::initialize(HANDLE h_app,
+ PowerConfigParams & refConfigParms) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ /// Set all hysteresis objects with the configuration data obtained from PowerService.xml
+ m_oShutdownHysteresis.set(refConfigParms.shutdown);
+ m_oLowVoltage1Hysteresis.set(refConfigParms.lvi1);
+ m_oLowVoltage2Hysteresis.set(refConfigParms.lvi2);
+
+ /// Copy the list of required modules.
+ m_lstWakeupModules = refConfigParms.wakeup_modules;
+ m_lstShutdownModules = refConfigParms.shutdown_modules;
+ m_lstLvi2Modules = refConfigParms.lvi2_modules;
+
+ m_hHysteresisTimer = FrameworkunifiedAttachTimerCallback(
+ h_app, 0, 0, PowerCallback<Power, &Power::OnHysteresisTimeout>);
+ if (NULL == m_hHysteresisTimer) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: FrameworkunifiedAttachTimerCallback() returned NULL");
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PowerSessionHandler::OpenSesion(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // check if the subscriber is already in map
+ PwSessionIter iter = m_mapSessions.find(FrameworkunifiedGetMsgSrc(h_app));
+
+ // the iter is set to the end then the subscriber is not in the map
+ if (m_mapSessions.end() == iter) {
+ string subscriber(FrameworkunifiedGetMsgSrc(h_app));
+ PwSessionInfo newEntry;
+ newEntry.frunning = FALSE;
+ newEntry.hsession = FrameworkunifiedMcOpenSender(h_app, subscriber.c_str());
+ newEntry.sz_name = subscriber;
+ newEntry.sz_servicename = ""; // we will get this on the start complete.
+ newEntry.esessiontype = epsstBASIC;
+ newEntry.ui_groupid = 0;
+
+ if (NULL != newEntry.hsession) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ //
+ // Set the Session Handle for Framework so FrameworkunifiedSendResponse won't error due to a null
+ // session handle.
+ //
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK
+ // [in] PCSTR - Name of the associated service name
+ // [in] HANDLE - Session handle
+ != (l_eStatus = FrameworkunifiedSetSessionHandle(h_app, subscriber.c_str(), newEntry.hsession))) { // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error case.
+ LOG_ERROR("FrameworkunifiedSetSessionHandle()");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ OpenSessionAck openSessionAck;
+ memset(&openSessionAck, 0, sizeof(openSessionAck));
+ strcpy(openSessionAck.cSessionName, SERVICE_POWER); // NOLINT (runtime/printf)
+ openSessionAck.eStatus = eFrameworkunifiedStatusOK;
+ openSessionAck.sessionId = 0; /// Only one session handles all the heartbeat clients
+
+ // Send Ack to subscriber
+ l_eStatus = FrameworkunifiedSendMsg(newEntry.hsession, PROTOCOL_OPEN_SESSION_ACK,
+ sizeof(OpenSessionAck), (PVOID) &openSessionAck);
+ char l_cBuf[100];
+ snprintf(l_cBuf, sizeof(l_cBuf),
+ "FrameworkunifiedSendMsg(%s, PROTOCOL_OPEN_SESSION_ACK)", subscriber.c_str());
+ LOG_STATUS(l_eStatus, l_cBuf);
+ }
+
+ // If this is not a basic module then we will need to register some other protocols
+ if (0 != FrameworkunifiedGetMsgLength(h_app)) {
+ EPWR_SESSION_TYPE tOpenSessionReq;
+ if (sizeof(EPWR_SESSION_TYPE) == FrameworkunifiedGetMsgLength(h_app)) {
+ if (eFrameworkunifiedStatusOK
+ == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tOpenSessionReq,
+ sizeof(EPWR_SESSION_TYPE)))) {
+ switch (tOpenSessionReq) {
+ case epsstBASIC: {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Subscriber : %s , open a session using type: BASIC",
+ subscriber.c_str());
+ FrameworkunifiedProtocolCallbackHandler ss_power_session_basic_handlers[] = { {
+ PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
+ &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
+ PowerCallback<Power, &Power::OnCloseSession> } };
+
+ // Attach callback : Power Session Requests
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, subscriber.c_str(), ss_power_session_basic_handlers, _countof(ss_power_session_basic_handlers)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(
+ "FrameworkunifiedAttachCallbacksToDispatcher(ss_power_session_basic_handlers)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Subscriber '%s' opened a type 'BASIC' session",
+ subscriber.c_str());
+ }
+ break;
+ case epsstSUPERVISOR: {
+ FrameworkunifiedProtocolCallbackHandler ss_power_sprv_session_handlers[] = { {
+ PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
+ &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
+ PowerCallback<Power, &Power::OnCloseSession> }, {
+ SS_POWER_FWD_START_CONFIRMATION_MSG_REQ, PowerCallback<Power,
+ &Power::OnSendStartupConfirmationRequest> }, {
+ SS_POWER_STATE_CHANGE_REQ, PowerCallback<Power,
+ &Power::OnSetPowerState> }, { SS_POWER_SHUTDOWN_REQ,
+ PowerCallback<Power, &Power::OnShutdownRequestMsg> }
+ , { SS_POWER_SYSTEM_MODE_INFO_REQ, PowerCallback<Power,
+ &Power::OnSystemModeInfoRequest> }, {
+ SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ, PowerCallback<
+ Power, &Power::OnPublishShutdownPopupRequest> }, {
+ SS_POWER_PUBLISH_POWER_POPUP_REQ, PowerCallback<Power,
+ &Power::OnPublishPowerPopupRequest> }, {
+ SS_POWER_POWER_REQUEST_MSG, PowerCallback<Power,
+ &Power::OnPowerRequestMsg> } };
+
+ // Attach callback : Power Supervisor Session Requests
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, subscriber.c_str(), ss_power_sprv_session_handlers, _countof(ss_power_sprv_session_handlers)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(
+ "FrameworkunifiedAttachCallbacksToDispatcher(ss_power_sprv_session_handlers)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Subscriber '%s' opened a 'SUPERVISOR' session",
+ subscriber.c_str());
+ newEntry.esessiontype = tOpenSessionReq;
+
+ static BOOL first_supervisor = TRUE;
+ if (first_supervisor) {
+ AttachCallbackToSystemManager( // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ h_app, SS_SM_SYSTEM_MODE_INFO_RSPN,
+ PowerCallback<Power, &Power::OnSystemModeInfoResponse>);
+ first_supervisor = FALSE;
+ }
+ }
+ break;
+ case epsstSYSTEM: {
+ FrameworkunifiedProtocolCallbackHandler ss_power_system_session_handlers[] = {
+ { PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
+ &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
+ PowerCallback<Power, &Power::OnCloseSession> }, {
+ SS_POWER_SYSTEM_LAUNCH_COMPLETE, PowerCallback<Power,
+ &Power::OnSystemLaunchComplete> }, {
+ SS_POWER_SHUTDOWN_RESP, PowerCallback<Power,
+ &Power::OnSystemShutdownComplete> } };
+
+ // Attach callback : Power System Session Requests
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, subscriber.c_str(), ss_power_system_session_handlers, _countof(ss_power_system_session_handlers)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(
+ "FrameworkunifiedAttachCallbacksToDispatcher(ss_power_session_handlers)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+ // LCOV_EXCL_STOP 4: NSFW error case.
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Subscriber '%s' opened a 'SYSTEM' session",
+ subscriber.c_str());
+ newEntry.esessiontype = tOpenSessionReq;
+ }
+ break;
+ case epsstUNKNOWN: {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Subscriber '%s' tried to open a type 'UNKNOWN' session",
+ subscriber.c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ // insert this newEntry into the map
+ m_mapSessions.insert(make_pair(subscriber, newEntry));
+ } else {
+ // This Subscriber is already in our map, just send and ack to keep them quote.
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO, __FUNCTION__,
+ "Subscriber : %s , is already in the map, will Just send back an ACK",
+ iter->second.sz_name.c_str());
+ if (NULL != iter->second.hsession) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ OpenSessionAck openSessionAck;
+ memset(&openSessionAck, 0, sizeof(openSessionAck));
+ strcpy(openSessionAck.cSessionName, SERVICE_POWER); // NOLINT (runtime/printf)
+ openSessionAck.eStatus = eFrameworkunifiedStatusOK;
+ // I can't think of a reason why we would need more that one session per subscriber.
+ openSessionAck.sessionId = 0;
+
+ // Send Ack to subscriber
+ l_eStatus = FrameworkunifiedSendMsg(iter->second.hsession, PROTOCOL_OPEN_SESSION_ACK,
+ sizeof(OpenSessionAck), (PVOID) &openSessionAck);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "FrameworkunifiedSendMsg Success to : %s , status: 0x%x",
+ iter->second.sz_name.c_str(), l_eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
+ "What! NULL == iter->second.hsession TODO: Need to handle this!");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+///
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus PowerSessionHandler::StopComplete(HANDLE h_app) { // LCOV_EXCL_START 8: can not be called
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // ToDo Jay 2012 November 02 Can this be deleted ?
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " No-op function - It's here, but it doesn't do anything");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP 8: can not be called
+
+///////////////////////////////////////////////////////////////////////
+/// ProcessVoltageNotifyRequest
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::PublishVoltageStateChange(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ PowerSrvLVIStatus l_LVIStatus;
+ PowerSrvLevelType l_PowerLevel;
+
+ switch (m_VoltageState) { // LCOV_EXCL_BR_LINE 6: double check
+ case epsvsNORMAL:
+ l_PowerLevel = epspltNORMAL;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLevel, &l_PowerLevel, sizeof(PowerSrvLevelType));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLevel ", epspltNORMAL)");
+
+ l_LVIStatus = ePwSrvLVI_Status_InActive;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI1, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI1 ", ePwSrvLVI_Status_InActive)");
+
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI2, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI2 ", ePwSrvLVI_Status_InActive)");
+ break;
+
+ case epsvsLVI1:
+ l_PowerLevel = epspltEMERGENCY;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLevel, &l_PowerLevel, sizeof(PowerSrvLevelType));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLevel ", epspltEMERGENCY)");
+
+ l_LVIStatus = ePwSrvLVI_Status_Active;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI1, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI1 ", ePwSrvLVI_Status_Active)");
+
+ l_LVIStatus = ePwSrvLVI_Status_InActive;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI2, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI2 ", ePwSrvLVI_Status_InActive)");
+ break;
+
+ case epsvsLVI2:
+ l_PowerLevel = epspltEMERGENCY;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLevel, &l_PowerLevel, sizeof(PowerSrvLevelType));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLevel ", epspltEMERGENCY)");
+
+ l_LVIStatus = ePwSrvLVI_Status_InActive;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI1, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI1 ", ePwSrvLVI_Status_InActive)");
+
+ l_LVIStatus = ePwSrvLVI_Status_Active;
+l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI2, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus,
+ "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI2 ", ePwSrvLVI_Status_Active)");
+ break;
+
+ case epsvsINVALID:
+ // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR(" epsvsINVALID == m_VoltageState");
+ break;
+ // LCOV_EXCL_STOP 6: double check
+
+ default:
+ // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Invalid 'm_VoltageState' value detected: 0x%X/%d",
+ m_VoltageState, m_VoltageState);
+ break;
+ // LCOV_EXCL_STOP 6: double check
+ }
+
+ SS_PWR_LOG_HIST("PublishVoltageStateChange()", m_PubCmdHist, m_PubHistIter,
+ "", l_eStatus);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////
+/// OnSystemModeInfoResponse
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSystemModeInfoResponse(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SystemModeInfo l_SystemModeInfo;
+
+ std::memset(&l_SystemModeInfo, 0, sizeof(SystemModeInfo));
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<SystemModeInfo>(h_app, l_SystemModeInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Sending SS_POWER_SYSTEM_MODE_INFO_RESP to PSM");
+ // send Wake-up complete response to System Power Manager
+ l_eStatus = m_oSessionHandler.SendToSupervisor(
+ SS_POWER_SYSTEM_MODE_INFO_RESP, sizeof(SystemModeInfo),
+ (PVOID) &l_SystemModeInfo);
+
+ SS_PWR_LOG_HIST("SS_POWER_SYSTEM_MODE_INFO_RESP", m__CWORD56_RepHist,
+ m__CWORD56_RepIter, "", l_eStatus);
+
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus, "m_oSessionHandler.SendToSupervisor( "
+ "SS_POWER_SYSTEM_MODE_INFO_RESP)");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnSystemModeInfoRequest
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSystemModeInfoRequest(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = SendSystemModeRequestToSystemManager())) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("SendSystemModeRequestToSystemManager()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnInitCompReport
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnInitCompReport(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = SendInitCompReportToSystemManager())) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("SendInitCompReportToSystemManager()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnCurrentPowerStateQuery
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnCurrentPowerStateQuery(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SS_PSCurrentState l_CurrentState;
+ std::memset(&l_CurrentState, 0, sizeof(SS_PSCurrentState));
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<SS_PSCurrentState>(h_app, l_CurrentState))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = ConstructPwrStateResponse(l_CurrentState.printRespmsg))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ConstructPwrStateResponse(l_CurrentState.printRespmsg)");
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Response is %s",
+ l_CurrentState.printRespmsg);
+ // Send Power State to client
+
+ HANDLE l_handle = FrameworkunifiedOpenService(h_app, FrameworkunifiedGetMsgSrc(h_app));
+ if (NULL != l_handle) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ l_eStatus = FrameworkunifiedSendMsg(l_handle, SS_POWER_CRNT_STATE_QUERY_RSPN,
+ sizeof(SS_PSCurrentState),
+ (PVOID) &l_CurrentState);
+
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_CRNT_STATE_QUERY_RSPN)");
+
+ l_eStatus = FrameworkunifiedCloseService(h_app, l_handle);
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(l_eStatus,
+ "FrameworkunifiedCloseService()");
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error. FrameworkunifiedOpenService(%s) returned NULL",
+ FrameworkunifiedGetMsgSrc(h_app));
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnSetVoltageState
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSetVoltageState(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string stLvl = "INVALID";
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ Pwr_ServiceSetInterface l_VoltageState;
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_VoltageState))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ m_VoltageState = static_cast<ePowerSrvVoltageStates>(l_VoltageState.data
+ .voltage.state);
+ if (eFrameworkunifiedStatusOK != (l_eStatus = PublishVoltageStateChange(h_app))) { // LCOV_EXCL_BR_LINE 4:NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("PublishVoltageStateChange()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ SS_PWR_LOG_HIST("OnSetVoltageState", m_PubCmdHist, m_PubHistIter,
+ "PublishVoltageStateChange()", l_eStatus);
+
+ switch (l_VoltageState.data.voltage.state) {
+ case epsvsINVALID: {
+ stLvl = "INVALID";
+ }
+ break;
+
+ case epsvsNORMAL: {
+ stLvl = "NORMAL";
+ }
+ break;
+
+ case epsvsLVI1: {
+ stLvl = "LVI1";
+ }
+ break;
+
+ case epsvsLVI2: {
+ stLvl = "LVI2";
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ SS_PWR_LOG_HIST("OnSetVoltageState()", m_VCmdHist, m_VHistIter, stLvl,
+ l_eStatus);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnSetCrankState
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::OnSetCrankState(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ Pwr_ServiceSetInterface l_CrankState;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_CrankState))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ m_CrankState = static_cast<ePowerSrvCrankStates>(l_CrankState.data.crank
+ .state);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus Power::OnSystemMgrConnectionEstablished(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = FrameworkunifiedPublishServiceAvailability(h_app, TRUE);
+
+ SS_PWR_LOG_HIST("FrameworkunifiedPublishServiceAvailability()", m_PubCmdHist,
+ m_PubHistIter, "", l_eStatus);
+
+ LOG_STATUS(l_eStatus,
+ "FrameworkunifiedPublishServiceAvailability(" szNTFY_PowerAvailability ",TRUE)");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus Power::OnUserModeResponse(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ EPWR_USER_MODE_TYPE l_eUserModeState = epsumINVALID;
+ Pwr_ServiceSetInterface tServiceSetIf;
+
+ l_eStatus = ValidateUserModeMessage(h_app, l_eUserModeState);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("ValidateUserModeMessage(&l_eUserModeState)");
+ } else {
+ PCSTR p_sStateName = l_eUserModeState == epsumON ? "epsumON" : "epsumOFF";
+ tServiceSetIf.data.user_mode.mode = l_eUserModeState;
+
+ l_eStatus = m_oSessionHandler.SendToSupervisor(
+ SS_POWER_USER_MODE_SET_RESP, sizeof(Pwr_ServiceSetInterface),
+ (PVOID) &tServiceSetIf);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error: m_oSessionHandler.SendToSupervisor(" " SS_POWER_USER_MODE_SET_RESP, %s) errored: %d/'%s'",
+ p_sStateName, l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ SS_PWR_LOG_HIST("SS_POWER_USER_MODE_SET_RESP", m__CWORD56_RepHist,
+ m__CWORD56_RepIter, p_sStateName, l_eStatus);
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ " m_oSessionHandler.SendToSupervisor(" " SS_POWER_USER_MODE_SET_RESP, %s) successful ",
+ p_sStateName);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnUserModeResponse( HANDLE h_app )
+
+EFrameworkunifiedStatus Power::ValidateUserModeMessage(
+ HANDLE h_app, EPWR_USER_MODE_TYPE &l_eUserModeState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ Pwr_ServiceSetInterface tServiceSetIf;
+ EPWR_USER_MODE_TYPE l_my_eUserModeState;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceSetIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_my_eUserModeState = tServiceSetIf.data.user_mode.mode;
+ switch (l_my_eUserModeState) {
+ case epsumINVALID:
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("l_eUserModeState == epsumINVALID");
+ break;
+
+ case epsumOFF:
+ case epsumON:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Validated '%s'",
+ l_my_eUserModeState == epsumON ? "epsumON" : "epsumOFF");
+ l_eUserModeState = l_my_eUserModeState;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Unknown 'l_my_eUserModeState' value: 0x%x",
+ l_my_eUserModeState);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ } // End switch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::ValidateUserModeMessage( HANDLE h_app, EPWR_USER_MODE_TYPE &l_eUserModeState )
+
+//*****************************************************************************
+// Start Confirmation Protocol callback functions
+//
+EFrameworkunifiedStatus Power::OnSendStartupConfirmationRequest(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ EFrameworkunifiedStatus l_responseStatus = eFrameworkunifiedStatusOK;
+ Pwr_ServiceSetInterface tServiceSetIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceSetIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ StartupConfirmationMsgStrut l_startupConfirmationMsg = tServiceSetIf.data
+ .startupConfirmationMsg;
+ l_eStatus = SendStartupConfirmationToSystemManager(
+ l_startupConfirmationMsg);
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus, "SendStartupConfirmationToSystemManager()");
+ }
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:interface_unified if can not be error.
+ // LCOV_EXCL_START 200:interface_unified if can not be error.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_responseStatus = l_eStatus; // Save the current status as-is to
+ // send in the message response to the
+ // requester.
+ l_eStatus = m_oSessionHandler.SendToSupervisor(
+ SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, sizeof(EFrameworkunifiedStatus),
+ (PVOID) &l_responseStatus);
+
+ SS_PWR_LOG_HIST("SS_POWER_FWD_START_CONFIRMATION_MSG_RESP", m__CWORD56_RepHist,
+ m__CWORD56_RepIter, "", l_eStatus);
+
+ LOG_STATUS(
+ l_eStatus,
+ "m_oSessionHandler.SendToSupervisor( " "SS_POWER_FWD_START_CONFIRMATION_MSG_RESP)");
+ // LCOV_EXCL_STOP 200:interface_unified if can not be error.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " SendStartupConfirmationToSystemManager() successful");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnSendStartupConfirmationRequest( HANDLE h_app )
+
+EFrameworkunifiedStatus Power::OnSendStartupConfirmationResponse(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ EFrameworkunifiedStatus l_responseStatus;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<EFrameworkunifiedStatus>(h_app, l_responseStatus))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_eStatus = m_oSessionHandler.SendToSupervisor(
+ SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, sizeof(EFrameworkunifiedStatus),
+ (PVOID) &l_responseStatus);
+
+ SS_PWR_LOG_HIST("SS_POWER_FWD_START_CONFIRMATION_MSG_RESP", m__CWORD56_RepHist,
+ m__CWORD56_RepIter, "", l_eStatus);
+
+ LOG_STATUS(
+ l_eStatus,
+ "m_oSessionHandler.SendToSupervisor(" " SS_POWER_FWD_START_CONFIRMATION_MSG_RESP)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnSendStartupConfirmationResponse( HANDLE h_app )
+//
+// End of Start Confirmation Protocol callback functions
+//*****************************************************************************
+
+//*****************************************************************************
+// Start HeartBeat Protocol callback functions
+// Theory of operation: Forward HB request to SM. If SM crashes, then the HB
+// will cease between SM and the _CWORD56_. Consequently, the _CWORD56_ will reset the
+// system.
+EFrameworkunifiedStatus Power::On_CWORD56_HeartBeatRequest(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ EPWR_HB_REQ_MSG_STRUCT l_HbReq;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_CWORD56_ HeartBeat Request received.");
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<EPWR_HB_REQ_MSG_STRUCT>(h_app, l_HbReq))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = Send_CWORD56_HeartBeatRequestToSystemManager(l_HbReq))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("Send_CWORD56_HeartBeatRequestToSystemManager()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus Power::OnSM_CWORD56_HeartBeatResponse(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from SM.");
+
+ l_eStatus = m_oSessionHandler.SendToSupervisor(SS_POWER_HEARTBEAT_RESP, 0,
+ NULL);
+
+ SS_PWR_LOG_HIST("SS_POWER_HEARTBEAT_RESP", m__CWORD56_RepHist, m__CWORD56_RepIter, "",
+ l_eStatus);
+
+ LOG_STATUS(l_eStatus,
+ "m_oSessionHandler.SendToSupervisor( SS_POWER_HEARTBEAT_RESP)");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+//
+// End of Heartbeat Protocol callback functions
+//*****************************************************************************
+
+//*****************************************************************************
+// Start CPU Reset Request Protocol callback functions
+//
+EFrameworkunifiedStatus Power::OnCpuResetRequest(HANDLE h_app) { // SS_SM_CPU_RESET_REQ
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSystemManagerCpuResetInfo l_SmCpuResetInfo; // SS Type
+ SS_Pwr_CpuResetMsgStruct l_PsCpuResetInfo; // SS Type translated to PSM type.
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<TSystemManagerCpuResetInfo>(h_app, l_SmCpuResetInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CPU Reset Type: %d",
+ l_SmCpuResetInfo.resetReason);
+
+ switch (l_SmCpuResetInfo.resetReason) {
+ case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR:
+ case e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR:
+ l_PsCpuResetInfo.resetReason = epsCpuResetReasonGeneric;
+ break;
+
+ case e_SS_SM_CPU_RESET_REASON_DSP_ERR:
+ l_PsCpuResetInfo.resetReason = epsCpuResetReasonFatalError;
+ break;
+
+ case e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET:
+ l_PsCpuResetInfo.resetReason = epsCpuResetReasonUserForceReset;
+ break;
+
+ case e_SS_SM_CPU_RESET_REASON_NORMAL:
+ l_PsCpuResetInfo.resetReason = epsCpuResetReasonNormalReset;
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Reset reason '%d' not defined",
+ l_SmCpuResetInfo.resetReason);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (eFrameworkunifiedStatusInvldParam);
+ }
+
+ snprintf(l_PsCpuResetInfo.messageStr, PWR_RESET_MSG_STR_SIZE, "%s",
+ l_SmCpuResetInfo.messageStr);
+
+ l_eStatus = m_oSessionHandler.SendToSupervisor(SS_POWER_HARD_RESET_REQ,
+ sizeof(l_PsCpuResetInfo),
+ (PVOID) &l_PsCpuResetInfo);
+
+ SS_PWR_LOG_HIST("SS_POWER_HARD_RESET_REQ", m__CWORD56_RepHist, m__CWORD56_RepIter, "",
+ l_eStatus);
+
+ LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
+ l_eStatus, "m_oSessionHandler.SendToSupervisor( "
+ "SS_POWER_HARD_RESET_REQ)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//
+// End of CPU Reset Request Protocol callback functions
+//*****************************************************************************
+
+///////////////////////////////////////////////////////////////////////
+/// SetCmdHist
+///
+///
+//////////////////////////////////////////////////////////////////////
+void Power::SetCmdHist(std::string cmd, cmdHist &hist, cmdHistIter &it,
+ std::string sender) {
+ pthread_mutex_lock(&pwr_hist_mutex);
+
+ UI_64 l_clkcycles = ClockCycle();
+ /* find out how many cycles per millisecond */
+ UI_64 l_totalmsec = l_clkcycles / 1000;
+
+ it->m_time = l_totalmsec;
+ it->m_cmd = cmd;
+ it->m_sender = sender;
+ it++;
+
+ if (it == hist.end()) {
+ it = hist.begin();
+ }
+
+ pthread_mutex_unlock(&pwr_hist_mutex);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SSPowerDebugDump
+/// implement post mortem function
+///
+/// \param
+///
+/// \return void
+///////////////////////////////////////////////////////////////////////////////
+VOID Power::SSPowerDebugDump(HANDLE h_app) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ char l_debugDumpData[SS_PWR_DEBUG_DUMP_MAX_SIZE];
+ UI_16 l_byteCount = 0;
+ cmdHistIter i;
+ memset((void*) l_debugDumpData, 0x00, sizeof(l_debugDumpData)); // NOLINT (readability/casting)
+
+ l_byteCount = snprintf(l_debugDumpData, SS_PWR_DEBUG_DUMP_MAX_SIZE,
+ ("\n <SS POWER DUMP DATA> \n"));
+
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n ***Error history***\n");
+
+ for (i = m_ErrHist.begin(); i != m_ErrHist.end(); ++i) {
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n %s @ %llums EC:%s \n", i->m_cmd.c_str(),
+ i->m_time, i->m_sender.c_str());
+ }
+
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n ***_CWORD56_ Reply history***\n");
+
+ for (i = m__CWORD56_RepHist.begin(); i != m__CWORD56_RepHist.end(); ++i) {
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n %s @ %llums\n", i->m_cmd.c_str(), i->m_time);
+ }
+
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n ***Voltage history***\n");
+
+ for (i = m_VCmdHist.begin(); i != m_VCmdHist.end(); ++i) {
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n %s @ %llums %s \n", i->m_cmd.c_str(), i->m_time,
+ i->m_sender.c_str());
+ }
+
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n ***Publishshing history***\n");
+
+ for (i = m_PubCmdHist.begin(); i != m_PubCmdHist.end(); ++i) {
+ l_byteCount += snprintf(l_debugDumpData + l_byteCount,
+ SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
+ "\n %s @ %llums \n", i->m_cmd.c_str(), i->m_time);
+ }
+
+ SSDEBUGDUMP("%s", (const char *) &l_debugDumpData);
+}
+// LCOV_EXCL_STOP 7:debug code
+
+//*****************************************************************************
+// Start Remote Data Reset Protocol callback functions
+// From SM to PS
+EFrameworkunifiedStatus Power::OnRemoteDataResetRequest(HANDLE h_app) { // SS_SM_REMOTE_DATA_RESET_REQ
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ESMDataResetType l_eSmDataResetType; // SS Type
+ epsCpuResetReason l_ePsCpuResetReason; // SS Type translated to PSM CPU reset reason.
+ BOOL l_bResetRequired;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<ESMDataResetType>(h_app, l_eSmDataResetType))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Remote Data Reset Type: %d",
+ l_eSmDataResetType);
+ l_bResetRequired = FALSE;
+ switch (l_eSmDataResetType) {
+ case e_SS_SM_DATA_RESET_TYPE_USER:
+ l_ePsCpuResetReason = epsCpuResetReasonUserDataReset;
+ l_bResetRequired = TRUE;
+ break;
+
+ case e_SS_SM_DATA_RESET_TYPE_FACTORY:
+ l_ePsCpuResetReason = epsCpuResetReasonFactoryDataReset;
+ l_bResetRequired = TRUE;
+ break;
+
+ case e_SS_SM_DATA_RESET_TYPE_CONFIGURATION: // No reset action required.
+ l_bResetRequired = FALSE;
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: Remote Reset Data type : %d not defined",
+ l_eSmDataResetType);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (eFrameworkunifiedStatusInvldParam);
+ }
+
+ if (TRUE == l_bResetRequired) {
+ SS_Pwr_CpuResetMsgStruct l_PsCpuResetInfo = { };
+ l_PsCpuResetInfo.resetReason = l_ePsCpuResetReason;
+ l_eStatus = m_oSessionHandler.SendToSupervisor(SS_POWER_HARD_RESET_REQ,
+ sizeof(l_PsCpuResetInfo),
+ (PVOID) &l_PsCpuResetInfo);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Error: m_oSessionHandler.SendToSupervisor( " "SS_POWER_HARD_RESET_REQ, Reason '%d') errored:%d/'%s'",
+ l_ePsCpuResetReason, l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "SS_POWER_HARD_RESET_REQ Reason '%d' sent to PSMShadow",
+ l_ePsCpuResetReason);
+ }
+ SS_PWR_LOG_HIST("SS_POWER_HARD_RESET_REQ", m__CWORD56_RepHist, m__CWORD56_RepIter,
+ "", l_eStatus);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//
+// End of Remote Data Reset Protocol callback functions
+//*****************************************************************************
+
+// EOF of /SS_PowerService/src/ss_power.cpp
+
diff --git a/video_in_hal/systemservice/power_service/server/src/ss_power_config.cpp b/video_in_hal/systemservice/power_service/server/src/ss_power_config.cpp
new file mode 100755
index 0000000..3975b56
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/src/ss_power_config.cpp
@@ -0,0 +1,188 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports power service configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ss_power_config.h"
+
+// define all the configuration parmeters that will be used to get data
+const char * PowerConfiguration::kPowerLogicPlugin = "PowerLogicPlugin.dll";
+const char * PowerConfiguration::kLVI1Timeout = "LVI1.Timeouts_Timeout";
+const char * PowerConfiguration::kLVI1HysteresisTimeout =
+ "LVI1.Hysteresis_Timeout";
+const char * PowerConfiguration::kLVI1HysteresisEnabled =
+ "LVI1.Hysteresis_Enabled";
+const char * PowerConfiguration::kLVI1HysteresisTries = "LVI1.Hysteresis_Tries";
+const char * PowerConfiguration::kLVI2Timeout = "LVI2.Timeouts_Timeout";
+const char * PowerConfiguration::kLVI2HysteresisTimeout =
+ "LVI2.Hysteresis_Timeout";
+const char * PowerConfiguration::kLVI2HysteresisEnabled =
+ "LVI2.Hysteresis_Enabled";
+const char * PowerConfiguration::kLVI2HysteresisTries = "LVI2.Hysteresis_Tries";
+const char * PowerConfiguration::kShutdownTimeout = "Shutdown.Timeouts_Timeout";
+const char * PowerConfiguration::kShutdownHysteresisTimeout =
+ "Shutdown.Hysteresis_Timeout";
+const char * PowerConfiguration::kShutdownHysteresisEnabled =
+ "Shutdown.Hysteresis_Enabled";
+const char * PowerConfiguration::kShutdownHysteresisTries =
+ "Shutdown.Hysteresis_Tries";
+/// < defines the names in the cfg file that are used to get required modules names
+const char * PowerConfiguration::kRequiredWakeupModules =
+ "Wakeup.RequiredModules."; /// < once all the modules have been wakened up send wake-up complete
+const char * PowerConfiguration::kRequiredShutdownModules =
+ "Shutdown.RequiredModules."; /// < once all the modules have been shutdown send shutdown complete
+const char * PowerConfiguration::kRequiredLvi2Modules =
+ "LVI2.RequiredModules."; /// < once all the modules have been wakened up send wake-up complete
+
+PowerConfiguration::PowerConfiguration(std::string f_configfilename)
+ : m_ConfigFileName(f_configfilename) {
+}
+
+PowerConfiguration::~PowerConfiguration() {
+}
+
+BOOL PowerConfiguration::LoadParameters(PowerConfigParams & params) {
+ EFrameworkunifiedStatus l_eStatus;
+ BOOL l_rtnCode = FALSE;
+
+ CNSConfigReader *l_pReaderCfg = new CNSConfigReader();
+ if (NULL == l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5:new error case
+ // LCOV_EXCL_START 5:new error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. new CNSConfigReader() returned NULL pointer.");
+ // LCOV_EXCL_STOP 5:new error case
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(m_ConfigFileName))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->Open(%s) returned NULL pointer.",
+ m_ConfigFileName.c_str());
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kShutdownTimeout,
+ params.shutdown.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus, "l_pReaderCfg->GetInt(ShutdownTimeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI1Timeout, params.lvi1.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus, "l_pReaderCfg->GetInt(LVI1Timeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI2Timeout, params.lvi2.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus, "l_pReaderCfg->GetInt(LVI2Timeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kShutdownHysteresisTimeout,
+ params.shutdown.hysteresis.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(ShutdownHysteresisTimeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI1HysteresisTimeout,
+ params.lvi1.hysteresis.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI1HysteresisTimeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI2HysteresisTimeout,
+ params.lvi2.hysteresis.timeout))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI2HysteresisTimeout)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kShutdownHysteresisTries,
+ params.shutdown.hysteresis.tries))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(ShutdownHysteresisTries)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI1HysteresisTries,
+ params.lvi1.hysteresis.tries))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI1HysteresisTries)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(kLVI2HysteresisTries,
+ params.lvi2.hysteresis.tries))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI2HysteresisTries)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetBool(
+ kShutdownHysteresisEnabled, params.shutdown.hysteresis.enabled))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(ShutdownHysteresisEnabled)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetBool(kLVI1HysteresisEnabled,
+ params.lvi1.hysteresis.enabled))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI1HysteresisEnabled)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetBool(kLVI2HysteresisEnabled,
+ params.lvi2.hysteresis.enabled))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus,
+ "l_pReaderCfg->GetInt(LVI2HysteresisEnabled)");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetString(kPowerLogicPlugin,
+ params.power_logic_plugin))) {
+ LOG_STATUS_IF_ERRORED(l_eStatus, "l_pReaderCfg->GetInt(PowerLogicPlugin)");
+ } else {
+ l_rtnCode = TRUE;
+ }
+
+ delete l_pReaderCfg;
+ }
+
+ return (l_rtnCode);
+}
+
+void PowerConfiguration::LoadDefaultParameters(PowerConfigParams & params) {
+ params.power_logic_plugin = "ss_powerlogic.dll";
+ params.shutdown.timeout = 600; // thats 5mins
+ params.shutdown.hysteresis.enabled = FALSE; // There should be hysteresis for Shutdown
+ params.shutdown.hysteresis.timeout = 0; // Don't Care since disabled.
+ params.shutdown.hysteresis.tries = 0; // Don't Care since disabled.
+ params.lvi1.timeout = 2; // thats 2secs
+ params.lvi1.hysteresis.enabled = TRUE; // Enable LVI1 hysteresis
+ params.lvi1.hysteresis.tries = 2; // check twice before switching to LVI1
+ params.lvi1.hysteresis.timeout = 500; // thats 500 msecs
+ params.lvi2.timeout = 2; // thats 2secs
+ params.lvi2.hysteresis.enabled = TRUE; // Enable LVI2 hysteresis
+ params.lvi2.hysteresis.tries = 2; // check twice before switching to LVI2
+ params.lvi2.hysteresis.timeout = 100; // thats 100 msecs
+}
+
+void PowerConfiguration::PrintConfigInfo(PowerConfigParams & f_params) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown.timeout: %d",
+ f_params.shutdown.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi1.timeout: %d", f_params.lvi1.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi2.timeout: %d", f_params.lvi2.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown.hysteresis.timeout: %d",
+ f_params.shutdown.hysteresis.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi1.hysteresis.timeout: %d",
+ f_params.lvi1.hysteresis.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi2.hysteresis.timeout: %d",
+ f_params.lvi2.hysteresis.timeout);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown.hysteresis.tries: %d",
+ f_params.shutdown.hysteresis.tries);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi1.hysteresis.tries: %d",
+ f_params.lvi1.hysteresis.tries);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi1.hysteresis.tries: %d",
+ f_params.lvi1.hysteresis.tries);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown.hysteresis.enabled: %d",
+ f_params.shutdown.hysteresis.enabled);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi1.hysteresis.enabled: %d",
+ f_params.lvi1.hysteresis.enabled);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "lvi2.hysteresis.enabled: %d",
+ f_params.lvi2.hysteresis.enabled);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "power_logic_plugin: %s",
+ f_params.power_logic_plugin.c_str());
+ return;
+}
diff --git a/video_in_hal/systemservice/power_service/server/src/ss_power_session.cpp b/video_in_hal/systemservice/power_service/server/src/ss_power_session.cpp
new file mode 100755
index 0000000..20db4a9
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/src/ss_power_session.cpp
@@ -0,0 +1,276 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Power
+/// \brief This file supports power service session management.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_power_session.h"
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_power_service.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_power_service_local.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+#include "ss_power_powerservicelog.h"
+
+
+PowerSessionHandler::PowerSessionHandler() {
+ // TODO(my_username) Auto-generated constructor stub
+}
+
+PowerSessionHandler::~PowerSessionHandler() { // LCOV_EXCL_START 14 Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // TODO(my_username) Auto-generated destructor stub
+}
+// LCOV_EXCL_STOP 14 Resident process, not called by NSFW
+
+EFrameworkunifiedStatus PowerSessionHandler::CloseSession(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
+
+ // find the subscriber...
+ PwSessionIter iter = m_mapSessions.find(FrameworkunifiedGetMsgSrc(h_app));
+
+ // the iter is set to the end then the subscriber is not in the map
+ if (m_mapSessions.end() == iter) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error: Subscriber '%s' was not found in the map; the Close " "Session Request is being ignored!",
+ FrameworkunifiedGetMsgSrc(h_app));
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ } else if (NULL == iter->second.hsession) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_ERROR("Client's PwSessionInfo handle");
+ // LCOV_EXCL_STOP 11:unexpected branch
+ } else {
+ CloseSessionAck closeSessionAck;
+ closeSessionAck.sessionId = FrameworkunifiedGetSessionId(iter->second.hsession);
+ closeSessionAck.eStatus = eFrameworkunifiedStatusOK;
+
+ // Send Ack to subscriber
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(iter->second.hsession, PROTOCOL_CLOSE_SESSION_ACK, sizeof(CloseSessionAck), (PVOID) &closeSessionAck))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error: FrameworkunifiedSendMsg(%s, PROTOCOL_CLOSE_SESSION_ACK) " "errored: %d/'%s'",
+ iter->second.sz_name.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " FrameworkunifiedSendMsg(%s, PROTOCOL_CLOSE_SESSION_ACK) successful",
+ iter->second.sz_name.c_str());
+ iter->second.frunning = FALSE;
+
+ //
+ // ToDo Jay 2012 November 05 1) Can't detach just basic callbacks;
+ // client could be Supervisor or System. This has been solved
+ // in another Power Service Change Set. Need to get all
+ // Change Sets merged and delivered.
+ UI_32 ss_power_basic_session_ids[] = { PROTOCOL_CLOSE_SESSION_REQ };
+
+ // Detach callback : Power System Session Requests
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(h_app, iter->second.sz_name.c_str(), ss_power_basic_session_ids, _countof(ss_power_basic_session_ids)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedDetachCallbacksFromDispatcher()");
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " FrameworkunifiedDetachCallbacksFromDispatcher() successful");
+ }
+
+ CALL_AND_LOG_STATUS(FrameworkunifiedDestroySession(h_app, iter->second.hsession));
+ iter->second.hsession = NULL;
+ m_mapSessions.erase(iter);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus PowerSessionHandler::StartComplete(HANDLE h_app) { // LCOV_EXCL_START 8: can not be called
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ StartCompleteAck ack;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<StartCompleteAck>(h_app, ack))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()");
+ } else {
+ // find the subscriber...
+ PwSessionIter iter = m_mapSessions.find(FrameworkunifiedGetMsgSrc(h_app));
+
+ // the iter is set to the end then the subscriber is not in the map
+ if (m_mapSessions.end() != iter) {
+ iter->second.sz_servicename = ack.szServiceName;
+ iter->second.frunning = TRUE;
+
+ if (AllClientsInGroupStarted(iter->second.ui_groupid)) {
+ // NOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Subscriber: %s , was not found in the map, the close session is being ignored!",
+ FrameworkunifiedGetMsgSrc(h_app));
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP 8: can not be called
+VOID PowerSessionHandler::Print() {
+ // find the subscriber...
+ PwSessionIter iter = m_mapSessions.begin();
+ for (; iter != m_mapSessions.end(); iter++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG_DUMP, __FUNCTION__,
+ " Power Service is session-connected to '%s'; running: %s",
+ iter->second.sz_name.data(), (iter->second.frunning ? "YES" : "NO"));
+ }
+}
+
+// LCOV_EXCL_START 8: can not be called
+BOOL PowerSessionHandler::WakeupComplete(RequiredModuleList & wakeup_modules) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL rtn = TRUE; // set the return TRUE until we find a missing module
+ RequiredModuleListIter iter = wakeup_modules.begin();
+ for (; iter != wakeup_modules.end(); iter++) {
+ PwSessionIter psi = m_mapSessions.find(*iter);
+ if (m_mapSessions.end() == psi) {
+ rtn = FALSE; // Module Not Found in Power Service Session Handler
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Required Wakeup: %s has not connected to Power Service, Wakeup NOT COMPLETE!",
+ iter->data());
+ } else if (FALSE == psi->second.frunning) {
+ rtn = FALSE; // Module Found in Power Service Session Handler but hasn't started yet
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Required Wakeup: %s has connected to Power Service but is not running (FrameworkunifiedStart Response missing),"
+ " Wakeup NOT COMPLETE!",
+ iter->data());
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return rtn;
+}
+// LCOV_EXCL_STOP 8: can not be called
+
+BOOL PowerSessionHandler::ShutdownComplete(
+ RequiredModuleList & shutdown_modules) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL rtn = TRUE; // set the return TRUE until we find a missing module
+ RequiredModuleListIter iter = shutdown_modules.begin();
+ for (; iter != shutdown_modules.end(); iter++) {
+ PwSessionIter psi = m_mapSessions.find(*iter);
+ if (m_mapSessions.end() == psi) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Required Shutdown: %s is not in Power Service session list, Shutdown pending!",
+ iter->data());
+ } else if (TRUE == psi->second.frunning) {
+ rtn = FALSE; // Module Found in Power Service Session Handler but hasn't stopped yet
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "Required Shutdown: %s is connected to Power Service but is running (Stop Response missing),"
+ " Shutdown NOT COMPLETE!",
+ iter->data());
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return rtn;
+}
+
+EFrameworkunifiedStatus PowerSessionHandler::SendToSupervisor(UI_32 cmd, UI_32 length,
+ PVOID data) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (NULL == data && length > 0) { // LCOV_EXCL_BR_LINE 6: it will not be true at the other place
+ // LCOV_EXCL_START 6: it will not be true at the other place
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("NULL == data && length > 0");
+ l_eStatus = eFrameworkunifiedStatusInvldBuf;
+ // LCOV_EXCL_STOP 6: it will not be true at the other place
+ } else {
+ // get first client from the map...
+ PwSessionIter iter = m_mapSessions.begin();
+ BOOL l_bFoundSupervisor = FALSE;
+
+ for (; iter != m_mapSessions.end() && !l_bFoundSupervisor; iter++) {
+ l_bFoundSupervisor = (epsstSUPERVISOR == iter->second.esessiontype);
+ if (l_bFoundSupervisor) {
+ l_eStatus = FrameworkunifiedSendMsg(iter->second.hsession, cmd, length, data);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg()");
+ }
+ }
+ if (!l_bFoundSupervisor) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ "Error: Did not find a Supervisor session; did not " "send cmd %d !",
+ cmd);
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+BOOL PowerSessionHandler::AllClientsInGroupStarted(UI_32 f_ungrpid) { // LCOV_EXCL_START 8: can not be called
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL fStatus = TRUE;
+ BOOL fGrpFnd = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ PwSessionIter iter = m_mapSessions.begin();
+
+ if (iter == m_mapSessions.end())
+ fStatus = TRUE;
+
+ for (; iter != m_mapSessions.end() && fStatus; iter++) {
+ if (f_ungrpid == iter->second.ui_groupid) {
+ fGrpFnd = TRUE;
+ if (FALSE == iter->second.frunning) {
+ fStatus = FALSE;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- return flag: %s",
+ ((fStatus && fGrpFnd) ? "TRUE" : "FALSE"));
+ return (fStatus && fGrpFnd);
+}
+// LCOV_EXCL_STOP 8: can not be called
diff --git a/video_in_hal/systemservice/power_service/server/src/ss_power_state_machine.cpp b/video_in_hal/systemservice/power_service/server/src/ss_power_state_machine.cpp
new file mode 100755
index 0000000..28291e5
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/src/ss_power_state_machine.cpp
@@ -0,0 +1,924 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports the power service state machine.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "ss_power_state_machine.h"
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_power_service.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service_local.h>
+#include <system_service/ss_power_service_notifications_local.h>
+#include <system_service/ss_services.h>
+#include <native_service/ns_timer_if.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+
+#include "ss_power_session.h"
+#include "ss_power_powerservicelog.h"
+
+/// Define static members of the class.
+PowerStateMachine::Wakeup PowerStateMachine::WakeupState;
+PowerStateMachine::WakeupActive PowerStateMachine::WakeupActiveState;
+PowerStateMachine::WakeupPending PowerStateMachine::WakeupPendingState;
+PowerStateMachine::LowVoltage1 PowerStateMachine::LowVoltage1State;
+PowerStateMachine::LowVoltage1Active PowerStateMachine::LowVoltage1ActiveState;
+PowerStateMachine::LowVoltage2 PowerStateMachine::LowVoltage2State;
+PowerStateMachine::LowVoltage2Active PowerStateMachine::LowVoltage2ActiveState;
+PowerStateMachine::Shutdown PowerStateMachine::ShutdownState;
+PowerStateMachine::ShutdownActive PowerStateMachine::ShutdownActiveState;
+PowerStateMachine::NormalVoltage PowerStateMachine::NormalVoltageState;
+PowerStateMachine::SoftwareUpdate PowerStateMachine::SoftwareUpdateState;
+
+/// Constructor
+PowerStateMachine::PowerStateMachine()
+ : m_pCurrentState(&WakeupState),
+ m_pPreviousState(NULL),
+ m_pOnHysteresisTimeoutState(NULL),
+ m_oShutdownHysteresis(),
+ m_oLowVoltage1Hysteresis(),
+ m_oLowVoltage2Hysteresis(),
+ m_hHysteresisTimer(NULL),
+ m_tStateInfo() {
+}
+
+/// Deconstructor
+PowerStateMachine::~PowerStateMachine() { // LCOV_EXCL_START 14 Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP 14 Resident process, not called by NSFW
+
+void PowerStateMachine::onEvent(HANDLE h_app, PowerSessionHandler & oSession,
+ ePowerStateMachineEvents evt) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "(ENTRY) Power StateMachine Current State: %s, Previous State: %s",
+ m_pCurrentState->name(),
+ (m_pPreviousState == NULL ? "Ivalid" : m_pPreviousState->name()));
+
+ switch (evt) { // LCOV_EXCL_BR_LINE 8: dead code
+ case PowerStateMachine::epsmeWAKEUP:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeWAKEUP");
+ m_pCurrentState->onWakeup(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeSTART_COMPLETE: // LCOV_EXCL_START 8: no one send the event
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSTART_COMPLETE");
+ m_pCurrentState->onStartComplete(*this, h_app, oSession);
+ break;
+ // LCOV_EXCL_STOP 8: no one send the event
+ case PowerStateMachine::epsmeSHUTDOWN:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSHUTDOWN");
+ m_pCurrentState->onShutdown(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeSTOP_COMPLETE: // LCOV_EXCL_START 8: no one send the event
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSTOP_COMPLETE");
+ m_pCurrentState->onStopComplete(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeLVI1_ENCOUNTERED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_ENCOUNTERED");
+ m_pCurrentState->onLowVoltage1Encountered(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeLVI2_ENCOUNTERED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_ENCOUNTERED");
+ m_pCurrentState->onLowVoltage2Encountered(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeNORMAL_VOLTAGE_ENCOUNTERED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "Power StateMachine Event Received: epsmeNORMAL_VOLTAGE_ENCOUNTERED");
+ m_pCurrentState->onNormalVoltageEncountered(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeSOFTWARE_UPDATE:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSOFTWARE_UPDATE");
+ m_pCurrentState->onSoftwareUpdate(*this, h_app, oSession);
+ break;
+ case PowerStateMachine::epsmeSHUTDOWN_HYSTERESIS_ABORTED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "Power StateMachine Event Received: epsmeSHUTDOWN_HYSTERESIS_ABORTED");
+ case PowerStateMachine::epsmeLVI1_HYSTERESIS_ABORTED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_HYSTERESIS_ABORTED");
+ case PowerStateMachine::epsmeLVI2_HYSTERESIS_ABORTED:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_HYSTERESIS_ABORTED");
+ m_pCurrentState->onHysteresisAborted(*this, h_app, oSession);
+ break;
+ // LCOV_EXCL_STOP 8: no one send the event
+ case PowerStateMachine::epsmeSHUTDOWN_HYSTERESIS_TM_OUT:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ "Power StateMachine Event Received: epsmeSHUTDOWN_HYSTERESIS_TM_OUT"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ case PowerStateMachine::epsmeLVI1_HYSTERESIS_TM_OUT:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_HYSTERESIS_TM_OUT"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ case PowerStateMachine::epsmeLVI2_HYSTERESIS_TM_OUT:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_HYSTERESIS_TM_OUT"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ m_pCurrentState->onHysteresisTimeout(*this, h_app, oSession);
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: WAS INVALID"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ break;
+ } // ZONE_POWER_STATEMACHINE
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "(EXIT) Power StateMachine Current State: %s, Previous State: %s",
+ m_pCurrentState->name(),
+ (m_pPreviousState == NULL ? "Ivalid" : m_pPreviousState->name()));
+}
+
+PCSTR PowerStateMachine::name() { // LCOV_EXCL_START 8: do not be called
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (NULL != m_pCurrentState) {
+ return m_pCurrentState->name();
+ }
+
+ return "Invalid Current State is NULL...";
+}
+// LCOV_EXCL_STOP 8: do not be called
+
+/// Switch to the next State and save the previous state.
+void PowerStateMachine::NextState(Base_State & refState, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ m_pPreviousState = m_pCurrentState;
+ m_pPreviousState->onExit(*this, h_app, oSession);
+ m_pCurrentState = &refState;
+ m_pCurrentState->onEntry(*this, h_app, oSession);
+}
+
+// LCOV_EXCL_START 8: do not be called
+void PowerStateMachine::OnVoltage(Base_State * pState, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (sizeof(Pwr_ServiceSetInterface) == FrameworkunifiedGetMsgLength(h_app)) {
+ Pwr_ServiceSetInterface tServiceIf;
+
+ if (eFrameworkunifiedStatusOK
+ == FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tServiceIf,
+ sizeof(Pwr_ServiceSetInterface))) {
+ /// Need to store the voltage information
+ m_tStateInfo.voltage = tServiceIf.data.voltage.state;
+
+ if (NULL != pState) {
+ NextState(*pState, h_app, oSession);
+ }
+ }
+ }
+}
+// LCOV_EXCL_STOP 8: do not be called
+void PowerStateMachine::GotoStateOnHysteresisTimeout(Base_State & refState) {
+ m_pOnHysteresisTimeoutState = &refState;
+}
+
+void PowerStateMachine::startHysteresisTimer(PowerStateHysteresis & hys_info) {
+ /// clear the try counter.
+ hys_info.clearTryCounter();
+
+ /// bump the hysteresis try counter (prime the counter).
+ hys_info.bumbTryCounter();
+
+ /// setup the hysteresis timer
+ NSTimerInfo turn_on_hysteresis = { WholeSeconds(hys_info.getTimeout()),
+ MSToNS(RemainderMs(hys_info.getTimeout())), 0, 0, 0 };
+
+ /// start the hysteresis timer
+ NS_TimerSetTime(m_hHysteresisTimer, turn_on_hysteresis);
+}
+
+void PowerStateMachine::reStartHysteresisTimer(
+ PowerStateHysteresis & hys_info) {
+ /// bump the hysteresis try counter.
+ hys_info.bumbTryCounter();
+
+ /// setup the hysteresis timer (one shot)
+ NSTimerInfo turn_on_hysteresis = { WholeSeconds(hys_info.getTimeout()),
+ MSToNS(RemainderMs(hys_info.getTimeout())), 0, 0, 0 };
+ /// start the hysteresis timer
+ NS_TimerSetTime(m_hHysteresisTimer, turn_on_hysteresis);
+}
+
+void PowerStateMachine::stopHysteresisTimer(PowerStateHysteresis & hys_info) {
+ NSTimerInfo turn_off_hysteresis = { 0, 0, 0, 0, 0 };
+ NS_TimerSetTime(m_hHysteresisTimer, turn_off_hysteresis);
+ /// clear the try counter.
+ hys_info.clearTryCounter();
+}
+
+// LCOV_EXCL_START 8: can not be called
+void PowerStateMachine::publishPowerLVIStatus(HANDLE h_app, PCSTR nNotifNm,
+ UI_32 value) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ PowerSrvLVIStatus eLviStatus = static_cast<PowerSrvLVIStatus>(value);
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = FrameworkunifiedNPPublishNotification(h_app, nNotifNm, &eLviStatus,
+ sizeof(eLviStatus)))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedNPPublishNotification( %s ) errored: 0x%X", nNotifNm,
+ eStatus);
+ }
+}
+// LCOV_EXCL_STOP 8: can not be called
+void PowerStateMachine::publishPowerLevelType(HANDLE h_app, UI_32 value) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ PowerSrvLevelType eLevelType = static_cast<PowerSrvLevelType>(value);
+ if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedNPPublishNotification (h_app, szNTFY_PowerLevel, &eLevelType, sizeof (eLevelType)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedNPPublishNotification %s Failed Status:0x%x ",
+ szNTFY_PowerLevel, eStatus);
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Base_State::onStartComplete(
+ PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ oSession.StartComplete(h_app);
+}
+// LCOV_EXCL_STOP 8: do not be called
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Base_State::onStopComplete(
+ PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ oSession.StopComplete(h_app);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: no one call this function
+void PowerStateMachine::Base_State::onLaunchComplete(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FrameworkunifiedDeferMessage(h_app);
+}
+// LCOV_EXCL_STOP 8: do not be called
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Base_State::onShutdownComplete(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FrameworkunifiedDeferMessage(h_app);
+}
+// LCOV_EXCL_STOP 8: no one call this function
+PCSTR PowerStateMachine::Wakeup::name() {
+ return "Wakeup";
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Wakeup::onLowVoltage1Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage1State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: do not be called
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Wakeup::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage2State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::Wakeup::onNormalVoltageEncountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "NORMAL ENCOUNTERED %s (no switch)", FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+void PowerStateMachine::Wakeup::onShutdown(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ u.NextState(ShutdownState, h_app, oSession);
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Wakeup::onSoftwareUpdate(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.NextState(SoftwareUpdateState, h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Wakeup::onWakeup(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ Pwr_ServiceSetInterface tServiceIf;
+ if (sizeof(Pwr_ServiceSetInterface) == FrameworkunifiedGetMsgLength(h_app)) {
+ if (eFrameworkunifiedStatusOK
+ == FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tServiceIf,
+ sizeof(Pwr_ServiceSetInterface))) {
+ if (epswsPWRON == tServiceIf.data.wake.powerupType) {
+ /// Need to store the wakeup \ shutdown information
+ u.m_tStateInfo.wake = tServiceIf.data.wake.powerupType;
+ u.m_tStateInfo.level = tServiceIf.data.wake.up.level;
+ u.m_tStateInfo.factor = tServiceIf.data.wake.up.factor;
+
+ u.NextState(WakeupPendingState, h_app, oSession);
+ }
+ }
+ }
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+PCSTR PowerStateMachine::WakeupActive::name() {
+ return "Wakeup Active";
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::WakeupActive::onLowVoltage1Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage1State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::WakeupActive::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage2State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+void PowerStateMachine::WakeupActive::onShutdown(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ u.NextState(ShutdownState, h_app, oSession);
+}
+
+PCSTR PowerStateMachine::WakeupPending::name() {
+ return "Wakeup Pending";
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::WakeupPending::onNormalVoltageEncountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&NormalVoltageState, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::WakeupPending::onStartComplete(
+ PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ oSession.StartComplete(h_app);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: no one call this function
+void PowerStateMachine::WakeupPending::onLaunchComplete(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ oSession.SendToSupervisor(SS_POWER_WAKEUP_COMPLETE, 0, NULL);
+ if (epsvsNORMAL == u.m_tStateInfo.voltage) {
+ u.NextState(NormalVoltageState, h_app, oSession);
+ }
+}
+// LCOV_EXCL_STOP 8: no one call this function
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::WakeupPending::onWakeup(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (oSession.WakeupComplete(u.m_lstWakeupModules)) {
+ oSession.SendToSupervisor(SS_POWER_WAKEUP_COMPLETE, 0, NULL);
+ }
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+void PowerStateMachine::WakeupPending::onEntry(PowerStateMachine &u,
+ HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ if (!FrameworkunifiedIsDeferQueueEmpty(h_app)) {
+ FrameworkunifiedRetrieveDeferMessage(h_app);
+ }
+}
+
+PCSTR PowerStateMachine::Shutdown::name() {
+ return "Shutdown";
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Shutdown::onLowVoltage1Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(LowVoltage1State);
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW VOLTAGE 1 ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::Shutdown::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(LowVoltage2State);
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW VOLTAGE 2 ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::Shutdown::onHysteresisAborted(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.NextState(*(u.m_pPreviousState), h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+void PowerStateMachine::Shutdown::onHysteresisTimeout(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ if (!u.m_oShutdownHysteresis.maxTries()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "epsmeSHUTDOWN_TM_OUT tries: %d", u.m_oShutdownHysteresis.getTries());
+
+ u.reStartHysteresisTimer(u.m_oShutdownHysteresis);
+ } else {
+ // Move directorly to next state.
+ u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
+ }
+}
+
+void PowerStateMachine::Shutdown::onEntry(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ if (u.m_oShutdownHysteresis.getEnabled()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "Starting epsmeSHUTDOWN_HYSTERESIS_TM_OUT timeout: %d tries: %d",
+ u.m_oShutdownHysteresis.getTimeout(),
+ u.m_oShutdownHysteresis.getTries());
+ // Set the goto state state.
+ u.GotoStateOnHysteresisTimeout(ShutdownActiveState);
+ // Start the hysteresis timer for low voltage 2
+ u.startHysteresisTimer(u.m_oShutdownHysteresis);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "SHUTDOWN_HYSTERESIS is not enabled. Going directly to ShutdownActiveState");
+ // Move directly to next state.
+ u.NextState(ShutdownActiveState, h_app, oSession);
+ }
+}
+
+void PowerStateMachine::Shutdown::onExit(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ u.stopHysteresisTimer(u.m_oShutdownHysteresis);
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) Shutdown State");
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::Shutdown::onWakeup(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(WakeupPendingState);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+PCSTR PowerStateMachine::ShutdownActive::name() {
+ return "Shutdown Active";
+}
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::ShutdownActive::onLowVoltage1Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage1State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::ShutdownActive::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage2State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+void PowerStateMachine::ShutdownActive::onEntry(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ u.publishPowerLevelType(h_app, epspltSHUTDOWN);
+
+ if (oSession.ShutdownComplete(u.m_lstShutdownModules)) {
+ oSession.SendToSupervisor(SS_POWER_SHUTDOWN_COMPLETE, 0, NULL);
+ }
+}
+
+void PowerStateMachine::ShutdownActive::onShutdown(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ if (oSession.ShutdownComplete(u.m_lstShutdownModules)) {
+ oSession.SendToSupervisor(SS_POWER_SHUTDOWN_COMPLETE, 0, NULL);
+ }
+}
+
+PCSTR PowerStateMachine::LowVoltage1::name() { // LCOV_EXCL_START 8: can not be LowVoltage1status
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "Low Voltage I";
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage1status
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage1::onHysteresisAborted(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.NextState(*(u.m_pPreviousState), h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be LowVoltage1status
+void PowerStateMachine::LowVoltage1::onHysteresisTimeout(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (!u.m_oLowVoltage1Hysteresis.maxTries()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT tries: %d",
+ u.m_oLowVoltage1Hysteresis.getTries());
+
+ u.reStartHysteresisTimer(u.m_oLowVoltage1Hysteresis);
+ } else {
+ // Move directorly to next state.
+ u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
+ }
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage1::onWakeup(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(NormalVoltageState);
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage1status
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage1::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(LowVoltage2State);
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW VOLTAGE 2 ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage1::onNormalVoltageEncountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.GotoStateOnHysteresisTimeout(NormalVoltageState);
+ u.OnVoltage(NULL, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be LowVoltage1status
+void PowerStateMachine::LowVoltage1::onEntry(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (u.m_oLowVoltage1Hysteresis.getEnabled()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "Starting epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT timeout: %d tries: %d",
+ u.m_oLowVoltage1Hysteresis.getTimeout(),
+ u.m_oLowVoltage1Hysteresis.getTries());
+ // Set the goto state state.
+ u.GotoStateOnHysteresisTimeout(LowVoltage1ActiveState);
+ // Start the hysteresis timer for low voltage 1
+ u.startHysteresisTimer(u.m_oLowVoltage1Hysteresis);
+ } else {
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW_VOLTAGE_HYSTERESIS is not enabled. Going directly to LowVoltage1ActiveState");
+ // Move directly to next state.
+ u.NextState(LowVoltage1ActiveState, h_app, oSession);
+ }
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage1::onExit(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.stopHysteresisTimer(u.m_oLowVoltage1Hysteresis);
+ FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) LowVoltage1 State");
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+PCSTR PowerStateMachine::LowVoltage1Active::name() {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "Low Voltage I Active";
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage1status
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage1Active::onLowVoltage2Encountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&LowVoltage2State, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage1Active::onNormalVoltageEncountered(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.OnVoltage(&NormalVoltageState, h_app, oSession);
+ FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL VOLTAGE ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be LowVoltage1Activestatus
+void PowerStateMachine::LowVoltage1Active::onEntry(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u.publishPowerLevelType(h_app, epspltEMERGENCY);
+u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI1, ePwSrvLVI_Status_Active);
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage1Active::onExit(
+ PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI1, ePwSrvLVI_Status_InActive);
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage1Activestatus
+
+PCSTR PowerStateMachine::LowVoltage2::name() { // LCOV_EXCL_START 8: can not be LowVoltage2status
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+return "Low Voltage II";
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage2status
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage2::onHysteresisAborted(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.NextState(*(u.m_pPreviousState), h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be LowVoltage2status
+void PowerStateMachine::LowVoltage2::onHysteresisTimeout(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+if (!u.m_oLowVoltage2Hysteresis.maxTries()) {
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "epsmeLOW_VOLTAGE2_HYSTERESIS_TM_OUT tries: %d",
+ u.m_oLowVoltage2Hysteresis.getTries());
+
+u.reStartHysteresisTimer(u.m_oLowVoltage2Hysteresis);
+} else {
+// Move directorly to next state.
+u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
+}
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2::onEntry(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+if (u.m_oLowVoltage2Hysteresis.getEnabled()) {
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "Starting epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT timeout: %d tries: %d",
+ u.m_oLowVoltage2Hysteresis.getTimeout(),
+ u.m_oLowVoltage2Hysteresis.getTries());
+// Set the goto state state.
+u.GotoStateOnHysteresisTimeout(LowVoltage2ActiveState);
+// Start the hysteresis timer for low voltage 2
+u.startHysteresisTimer(u.m_oLowVoltage2Hysteresis);
+} else {
+FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW_VOLTAGE2_HYSTERESIS is not enabled. Going directly to LowVoltage2ActiveState");
+// Move directly to next state.
+u.NextState(LowVoltage2ActiveState, h_app, oSession);
+}
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2::onExit(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.stopHysteresisTimer(u.m_oLowVoltage2Hysteresis);
+FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) LowVoltage2 State");
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2::onWakeup(PowerStateMachine &u, HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.GotoStateOnHysteresisTimeout(WakeupPendingState);
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage2status
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage2::onLowVoltage1Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.GotoStateOnHysteresisTimeout(LowVoltage1State);
+u.OnVoltage(NULL, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "LOW VOLTAGE 1 ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2::onNormalVoltageEncountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.GotoStateOnHysteresisTimeout(NormalVoltageState);
+u.OnVoltage(NULL, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
+ "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+PCSTR PowerStateMachine::LowVoltage2Active::name() { // LCOV_EXCL_START 8: can not be LowVoltage2Activestatus
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+return "Low Voltage II Active";
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage2Activestatus
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::LowVoltage2Active::onLowVoltage1Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&LowVoltage1State, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2Active::onNormalVoltageEncountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&NormalVoltageState, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL VOLTAGE ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be LowVoltage2Activestatus
+void PowerStateMachine::LowVoltage2Active::onEntry(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.publishPowerLevelType(h_app, epspltEMERGENCY);
+u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI2, ePwSrvLVI_Status_Active);
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::LowVoltage2Active::onExit(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI2, ePwSrvLVI_Status_InActive);
+oSession.SendToSupervisor(SS_POWER_LVI2_SHUTDOWN_COMPLETE, 0, NULL);
+}
+// LCOV_EXCL_STOP 8: can not be LowVoltage2Activestatus
+
+PCSTR PowerStateMachine::NormalVoltage::name() { // LCOV_EXCL_START 8: can not be NormalVoltageState
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+return "Normal Voltage";
+}
+// LCOV_EXCL_STOP 8: can not be NormalVoltageState
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::NormalVoltage::onLowVoltage1Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&LowVoltage1State, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::NormalVoltage::onLowVoltage2Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&LowVoltage2State, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be NormalVoltageState
+void PowerStateMachine::NormalVoltage::onShutdown(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.NextState(ShutdownState, h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: can not be NormalVoltageState
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::NormalVoltage::onSoftwareUpdate(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.NextState(SoftwareUpdateState, h_app, oSession);
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be NormalVoltageState
+void PowerStateMachine::NormalVoltage::onEntry(PowerStateMachine &u,
+ HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.publishPowerLevelType(h_app, epspltNORMAL);
+}
+// LCOV_EXCL_STOP 8: can not be NormalVoltageState
+
+PCSTR PowerStateMachine::SoftwareUpdate::name() { // LCOV_EXCL_START 8: can not be SoftwareUpdatestatus
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+return "Software Update";
+}
+// LCOV_EXCL_STOP 8: can not be SoftwareUpdatestatus
+
+// LCOV_EXCL_START 8: no one send the event
+void PowerStateMachine::SoftwareUpdate::onLowVoltage1Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&LowVoltage1State, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::SoftwareUpdate::onLowVoltage2Encountered(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+u.OnVoltage(&LowVoltage2State, h_app, oSession);
+FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+}
+// LCOV_EXCL_STOP 8: no one send the event
+
+// LCOV_EXCL_START 8: can not be SoftwareUpdatestatus
+void PowerStateMachine::SoftwareUpdate::onShutdown(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::SoftwareUpdate::onEntry(
+PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP 8: no one send the event to call this function
+
+// LCOV_EXCL_START 8: no one send the event to call this function
+void PowerStateMachine::SoftwareUpdate::onExit(PowerStateMachine &u,
+ HANDLE h_app,
+ PowerSessionHandler & oSession) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP 8: can not be SoftwareUpdatestatus
diff --git a/video_in_hal/systemservice/power_service/server/src/ss_pwr_test_client_handlers.cpp b/video_in_hal/systemservice/power_service/server/src/ss_pwr_test_client_handlers.cpp
new file mode 100755
index 0000000..1542281
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/src/ss_pwr_test_client_handlers.cpp
@@ -0,0 +1,204 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief This file supports the power service test client.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "ss_power.h"
+#include <system_service/ss_power_service_local.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <other_service/itoa.h>
+#include <map>
+#include <string>
+#include "ss_power_powerservicelog.h"
+
+using namespace std; // NOLINT (build/namespaces)
+
+#define SS_CRANK_STATE_STRING_LENGTH 5
+#define SS_VOLTAGE_STATE_STRING_LENGTH 5
+#define SS_MODULE_STATE_STRING_LENGTH 5
+#define SS_HEX_BASE_VALUE 16
+
+const CHAR ReeadyToWakeUpDescription[] = "_READY_TO_WAKEUP:";
+const CHAR WakeUpInitiatedDescription[] = "_WAKEUP_INITIATED:";
+const CHAR WakeUpCompletedDescription[] = "_WAKEUP_COMPLETED:";
+const CHAR PowerOnCompletedDescription[] = "_POWER_ON_COMPLETED:";
+const CHAR PowerOffInitiatedDescription[] = "_POWER_OFF_INITIATED:";
+const CHAR PowerOffCompletedDescription[] = "_POWER_OFF_COMPLETED:";
+const CHAR ShutdownInitiatedDescription[] = "_SHUTDOWN_INITIATED:";
+const CHAR ShutdownCompletedDescription[] = "_SHUTDOWN_COMPLETED:";
+
+const CHAR CrankInvalidDescription[] = "_INVALID:";
+const CHAR CrankEntryDescription[] = "_ENTRY:";
+const CHAR CrankExitDescription[] = "_EXIT:";
+
+const CHAR VoltageInvalidDescription[] = "_INVALID:";
+const CHAR VoltageNormalDescription[] = "_NORMAL:";
+const CHAR VoltageLVI1Description[] = "_LVI1:";
+const CHAR VoltageLVI2Description[] = "_LVI2:";
+
+///////////////////////////////////////////////////////////////////////
+/// AddCrankInformationToResponse
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::AddCrankInformationToResponse(CHAR *f_MessageResponse) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR l_Buffer[SS_CRANK_STATE_STRING_LENGTH] = { 0 };
+ UI_32 l_Index = 0;
+
+ std::map<ePowerSrvCrankStates, std::string> CrankMap;
+ CrankMap[epscsINVALID] = CrankInvalidDescription;
+ CrankMap[epscsENTRY] = CrankEntryDescription;
+ CrankMap[epscsEXIT] = CrankExitDescription;
+
+ // confirm that CrankState value would fit in buffer array
+ if (m_CrankState < 0xFFFF) { // LCOV_EXCL_BR_LINE 8: dead code
+ itoa(m_CrankState, l_Buffer, SS_HEX_BASE_VALUE);
+ while (l_Buffer[l_Index]) {
+ l_Buffer[l_Index] = toupper(l_Buffer[l_Index]);
+ l_Index++;
+ }
+ }
+
+ if (MaxRespMsg > (strlen(f_MessageResponse) + strlen(CrankMap[m_CrankState].c_str()) + strlen(l_Buffer))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ strcat(f_MessageResponse, l_Buffer); // NOLINT (runtime/printf)
+ strcat(f_MessageResponse, CrankMap[m_CrankState].c_str()); // NOLINT (runtime/printf)
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Buffer Overrun Condition : Failed to add Crank State description to response");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////
+/// AddVoltageInformationToResponse
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::AddVoltageInformationToResponse(CHAR *f_MessageResponse) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR l_Buffer[SS_VOLTAGE_STATE_STRING_LENGTH] = { 0 };
+ UI_32 l_Index = 0;
+
+ std::map<ePowerSrvVoltageStates, std::string> VoltageMap;
+ VoltageMap[epsvsINVALID] = VoltageInvalidDescription;
+ VoltageMap[epsvsNORMAL] = VoltageNormalDescription;
+ VoltageMap[epsvsLVI1] = VoltageLVI1Description;
+ VoltageMap[epsvsLVI2] = VoltageLVI2Description;
+
+ // confirm that VoltageState value would fit in buffer array
+ if (m_VoltageState < 0xFFFF) { // LCOV_EXCL_BR_LINE 8: dead code
+ itoa(m_VoltageState, l_Buffer, SS_HEX_BASE_VALUE);
+ while (l_Buffer[l_Index]) {
+ l_Buffer[l_Index] = toupper(l_Buffer[l_Index]);
+ l_Index++;
+ }
+ }
+
+ if (MaxRespMsg > (strlen(f_MessageResponse) + strlen(VoltageMap[m_VoltageState].c_str()) + strlen(l_Buffer))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ strcat(f_MessageResponse, l_Buffer); // NOLINT (runtime/printf)
+ strcat(f_MessageResponse, VoltageMap[m_VoltageState].c_str()); // NOLINT (runtime/printf)
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Buffer Overrun Condition : Failed to add Voltage State description to response");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////
+/// AddStateInformationToResponse
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::AddStateInformationToResponse(CHAR *f_MessageResponse) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR l_Buffer[SS_MODULE_STATE_STRING_LENGTH] = { 0 };
+ UI_32 l_Index = 0;
+
+ std::map<SS_PSState, std::string> StateMap; // State Map
+ StateMap[SS_PS_READY_TO_WAKEUP] = ReeadyToWakeUpDescription;
+ StateMap[SS_PS_WAKEUP_INITIATED] = WakeUpInitiatedDescription;
+ StateMap[SS_PS_WAKEUP_COMPLETE] = WakeUpCompletedDescription;
+ StateMap[SS_PS_POWER_ON_COMPLETE] = PowerOnCompletedDescription;
+ StateMap[SS_PS_POWER_OFF_INITIATED] = PowerOffInitiatedDescription;
+ StateMap[SS_PS_POWER_OFF_COMPLETE] = PowerOffCompletedDescription;
+ StateMap[SS_PS_SHUTDOWN_INITIATED] = ShutdownInitiatedDescription;
+ StateMap[SS_PS_SHUTDOWN_COMPLETE] = ShutdownCompletedDescription;
+
+ // confirm that PowerState value would fit in buffer array
+ if (m_PowerState < 0xFFFF) { // LCOV_EXCL_BR_LINE 8: dead code
+ itoa(m_PowerState, l_Buffer, SS_HEX_BASE_VALUE);
+ while (l_Buffer[l_Index]) {
+ l_Buffer[l_Index] = toupper(l_Buffer[l_Index]);
+ l_Index++;
+ }
+ }
+
+ if (MaxRespMsg > (strlen(f_MessageResponse) + strlen(StateMap[m_PowerState].c_str()) + strlen(l_Buffer))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ strcat(f_MessageResponse, l_Buffer); // NOLINT (runtime/printf)
+ strcat(f_MessageResponse, StateMap[m_PowerState].c_str()); // NOLINT (runtime/printf)
+ } else {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ "Buffer Overrun Condition : Failed to add Module State description to response");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// ConstructPwrStateResponse
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus Power::ConstructPwrStateResponse(CHAR *f_MessageResponse) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (f_MessageResponse == NULL) { // LCOV_EXCL_BR_LINE 8: dead code
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (eFrameworkunifiedStatusOK == (l_eStatus = AddStateInformationToResponse(f_MessageResponse))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_eStatus = AddVoltageInformationToResponse(f_MessageResponse))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ if (eFrameworkunifiedStatusOK == (l_eStatus = AddCrankInformationToResponse(f_MessageResponse))) { // LCOV_EXCL_BR_LINE 8: dead code // NOLINT[whitespace/line_length]
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Response Constructed");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/video_in_hal/systemservice/power_service/server/src/ss_supervisor_handlers.cpp b/video_in_hal/systemservice/power_service/server/src/ss_supervisor_handlers.cpp
new file mode 100755
index 0000000..4bd88d9
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/src/ss_supervisor_handlers.cpp
@@ -0,0 +1,498 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief Handles SSM message for Wakeup State, Crank State, and Voltage
+/// State.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "ss_power.h"
+#include <stdio.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service.h>
+#include <system_service/ss_power_service_notifications_local.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_services.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <map>
+
+#include "ss_power_powerservicelog.h"
+
+
+EFrameworkunifiedStatus Power::OnPowerRequestMsg(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // ToDo Jay 2012 December 05 Would like to provide better general overall
+ // solution then this local hack - but, for the time being...
+ std::map<EPWR_USER_MODE_TYPE, EPWR_POWER_STATE_TYPE> UserModeToPowerTypeMap;
+ UserModeToPowerTypeMap[epsumON] = epswsPWRON;
+ UserModeToPowerTypeMap[epsumOFF] = epswsPWROFF;
+ // End of ToDo Jay 2012 December 05 Would like to provide better general
+
+ Pwr_ServiceSetInterface tServiceIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ BOOL b_isValid = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "StartupReason is '%s'",
+ GetStr(tServiceIf.data.powerRequestMsg.startupReason).c_str());
+
+ switch (tServiceIf.data.powerRequestMsg.startupReason) {
+ case epswfINVALID:
+ case epswfTESTACC:
+ case epswfUSER_DATA_RESET:
+ // Not startup conditions; don't log
+ b_isValid = TRUE;
+ break;
+
+ case epswfON_KEY:
+ LOG_POWERSERVICELOG_EVT(epswfON_KEY, Ei_StartUp_HK_On, epseisuedHK_ON_Key);
+ b_isValid = TRUE;
+ break;
+
+ case epswfIGN_ACC:
+ LOG_POWERSERVICELOG_EVT(epswfIGN_ACC, Ei_StartUp_Cansignal, epseisuedIGNITION);
+ LOG_POWERSERVICELOG_CNT(epswfIGN_ACC, CT_Startup_CanSignal);
+ b_isValid = TRUE;
+ break;
+
+ case epswfDR_OPEN_CLOSE:
+ LOG_POWERSERVICELOG_EVT(epswfDR_OPEN_CLOSE, Ei_StartUp_Cansignal,
+ epseisuedDOOR_MODULES);
+ LOG_POWERSERVICELOG_CNT(epswfDR_OPEN_CLOSE, CT_Startup_CanSignal);
+ b_isValid = TRUE;
+ break;
+
+ case epswfDX_ACTIVATION:
+ LOG_POWERSERVICELOG_EVT(epswfDX_ACTIVATION, Ei_StartUp_DiagMsg, epseisuedHU);
+ LOG_POWERSERVICELOG_CNT(epswfDX_ACTIVATION, CT_Startup_DiagMsg);
+ b_isValid = TRUE;
+ break;
+
+ case epswfPASS_ACTIVATION:
+ LOG_POWERSERVICELOG_EVT(epswfPASS_ACTIVATION, Ei_StartUp_Cansignal,
+ epseisuedPASS);
+ LOG_POWERSERVICELOG_CNT(epswfPASS_ACTIVATION, CT_Startup_CanSignal);
+ b_isValid = TRUE;
+ break;
+
+ case epswfSPVACTIVATION:
+ LOG_POWERSERVICELOG_EVT(epswfSPVACTIVATION, Ei_StartUp_Cansignal, epseisuedSNA);
+ LOG_POWERSERVICELOG_CNT(epswfSPVACTIVATION, CT_Startup_CanSignal);
+ b_isValid = TRUE;
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ } // End switch(tServiceIf.data.powerRequestMsg.startupReason)
+
+ if (FALSE == b_isValid) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ " Error: Unknown 'powerRequestMsg.startupReason' value: " "0x%X / %d",
+ tServiceIf.data.powerRequestMsg.startupReason,
+ tServiceIf.data.powerRequestMsg.startupReason);
+ // LCOV_EXCL_STOP 11:unexpected branch
+ } else {
+ m_WakeUpData.powerupType = UserModeToPowerTypeMap[tServiceIf.data
+ .powerRequestMsg.userMode];
+ m_WakeUpData.up.factor = tServiceIf.data.powerRequestMsg.startupReason;
+ m_WakeUpData.up.level = epswlFULLRUN;
+ m_WakeUpData.up.userModeChangeReason = tServiceIf.data.powerRequestMsg.userModeChangeReason;
+
+ l_eStatus = FrameworkunifiedSendMsg(GetSystemManagerSessionHandle(),
+ SS_SM_POWER_REQUEST_MSG, sizeof(tServiceIf),
+ &tServiceIf);
+ char l_cBuf[200];
+ snprintf(
+ l_cBuf, sizeof(l_cBuf),
+ "FrameworkunifiedSendMsg( SS_SM_POWER_REQUEST_MSG, %s, %s)",
+ GetStr(tServiceIf.data.powerRequestMsg.userMode).c_str(),
+ GetStr(tServiceIf.data.powerRequestMsg.userModeChangeReason).c_str());
+ LOG_STATUS(l_eStatus, l_cBuf);
+ }
+ } // End else a good ReadMsg()
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnpowerRequestMsg( HANDLE h_app )
+
+EFrameworkunifiedStatus Power::OnShutdownRequestMsg(HANDLE h_app) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ Pwr_ServiceSetInterface tServiceIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ BOOL b_isValid = FALSE;
+ EPWR_SHUTDOWN_TRIGGER_TYPE l_shutdownTrigger = tServiceIf.data
+ .shutdownRequestMsg.shutdownTrigger;
+ switch (l_shutdownTrigger) {
+ case epssdmsdtINVALID:
+ case epssdmsdtTESTACC_OFF:
+ // Not shutdown conditions; don't log
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtON_KEY:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtON_KEY, Ei_shutdown_HkOFF, 0x00);
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtIGN_LOCK:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtIGN_LOCK, Ei_shutdown_CANsignal,
+ epseisdcsIGN_STATE);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtIGN_LOCK, CT_Shutdown_CanSignal);
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtPWR_SAVE: // test from peripheralservice/power_supply_manager_shadow
+ LOG_POWERSERVICELOG_CNT(epssdmsdtPWR_SAVE, CT_Shutdown_Timeout); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtTMP_STARTUP:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtTMP_STARTUP, CT_Shutdown_Timeout); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtDIAG_DEACTIVATION:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtDIAG_DEACTIVATION, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtABNORMAL_VOLTAGE:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtABNORMAL_VOLTAGE, Ei_shutdown_Voltage, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ epseisdnvoltUNKNOWN);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtABNORMAL_VOLTAGE, CT_Shutdown_Voltage); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtABNORMAL_TEMP:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtABNORMAL_TEMP, Ei_shutdown_Temperature, 0x00); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ LOG_POWERSERVICELOG_CNT(epssdmsdtABNORMAL_TEMP, CT_Shutdown_Temperature); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtBATTERYCUTOFF:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtBATTERYCUTOFF, Ei_shutdown_Voltage, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ epseisdnvoltBATTERY_CUT_OFF);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtBATTERYCUTOFF, CT_Shutdown_Voltage); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtLIMPHOME:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtLIMPHOME, Ei_shutdown_Voltage, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ epseisdnvoltLIMP_HOME);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtLIMPHOME, CT_Shutdown_Voltage); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtHU_CAN_ERROR:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtHU_CAN_ERROR, Ei_shutdown_NetworkError, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ epseisdneHU_CAN);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtHU_CAN_ERROR, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtBODY_CAN_ERROR:
+ LOG_POWERSERVICELOG_EVT(epssdmsdtBODY_CAN_ERROR, Ei_shutdown_NetworkError, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ epseisdneHMI_CAN);
+ LOG_POWERSERVICELOG_CNT(epssdmsdtBODY_CAN_ERROR, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtTRANSPORT_MODE:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtTRANSPORT_MODE, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtPRODUCTION_MODE:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtPRODUCTION_MODE, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtIGN_OFF:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtIGN_OFF, CT_Shutdown_CanSignal); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtGENERIC_ERROR_RESET:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtGENERIC_ERROR_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtFATAL_ERROR_RESET:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtFATAL_ERROR_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtUSER_DATA_RESET:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtUSER_DATA_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtFACTORY_DATA_RESET:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtFACTORY_DATA_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtFAST_SLEEP_MODE:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtFAST_SLEEP_MODE, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtNORMAL_RESET:
+ LOG_POWERSERVICELOG_CNT(epssdmsdtNORMAL_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+
+ case epssdmsdtPROGUPDATE_RESET: // this is dead code
+ LOG_POWERSERVICELOG_CNT(epssdmsdtPROGUPDATE_RESET, CT_Shutdown_Error); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ b_isValid = TRUE;
+ break;
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ } // End switch(l_shutdownTrigger)
+ if (FALSE == b_isValid) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error: Unknown 'shutdownRequestMsg.shutdownTrigger' " "value: 0x%X/%d",
+ l_shutdownTrigger, l_shutdownTrigger);
+ // LCOV_EXCL_STOP 11:unexpected branch
+ } else {
+ l_eStatus = SendShutdownToSystemManager(&tServiceIf);
+ LOG_STATUS(l_eStatus, "SendShutdownToSystemManager()");
+ if (l_eStatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ SetPowerServiceState(SS_PS_SHUTDOWN_INITIATED);
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnShutdownRequestMsg( HANDLE h_app )
+
+//*****************************************************************************
+// Shutdown Condition Notification Protocol function
+//
+EFrameworkunifiedStatus Power::OnPublishShutdownPopupRequest(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ Pwr_ServiceSetInterface tServiceIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ BOOL b_isValid = FALSE;
+ EPWR_SHUTDOWN_POPUP_TYPE l_eShutdownPopup = tServiceIf.data.shutdownPopup
+ .shutdownPopupEvent;
+ switch (l_eShutdownPopup) {
+ case epsspPowerSave1:
+ case epsspPowerSave2:
+ case epsspPowerSave3:
+ case epsspPowerSaveClr:
+ case epsspLowVoltage1:
+ case epsspLowVoltage2:
+ case epsspLowVoltage3:
+ case epsspLowVoltageClr:
+ case epsspBattCouplingSW1:
+ case epsspBattCouplingSW2:
+ case epsspBattCouplingSW3:
+ case epsspBattCouplingSWClr:
+ case epsspAbnormalTemp_1st:
+ case epsspAbnormalTemp_Clr:
+ case epsspLimpHome_1st:
+ case epsspLimpHome_2nd:
+ case epsspLimpHome_3rd:
+ case epsspLimpHome_Clr:
+ case epsspProdMd_1st:
+ case epsspProdMd_Clr:
+ case epsspTransMd_1st:
+ case epsspTransMd_Clr:
+ case epsspAllClr:
+ l_eStatus = FrameworkunifiedNPPublishNotification(h_app
+ , szNTFY_ShutdownPopup
+ , &l_eShutdownPopup
+ , sizeof(EPWR_SHUTDOWN_POPUP_TYPE));
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedNPPublishNotification(%s, %d) errored: %d/'%s'",
+ szNTFY_ShutdownPopup, l_eShutdownPopup, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ SS_PWR_LOG_HIST("szNTFY_ShutdownPopup()", m_PubCmdHist, m_PubHistIter,
+ "", l_eStatus);
+
+ b_isValid = TRUE;
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ } // End switch
+
+ if (FALSE == b_isValid) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Unknown 'l_eShutdownPopup' value: 0x%X / %d",
+ l_eShutdownPopup, l_eShutdownPopup);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP 11:unexpected branch
+ } else {
+ EFrameworkunifiedStatus l_responseStatus = l_eStatus; // Save the current status as-is to
+ // send in the message response to the
+ // requester.
+ l_eStatus = FrameworkunifiedSendResponse(h_app,
+ SS_POWER_PUBLISH_SHUTDOWN_CONDITION_RESP,
+ sizeof(EFrameworkunifiedStatus),
+ (PVOID) &l_responseStatus);
+
+ char l_cBuf[200];
+ snprintf(l_cBuf, sizeof(l_cBuf),
+ "FrameworkunifiedSendResponse(%s, %s, status: %d/'%s')", FrameworkunifiedGetMsgSrc(h_app),
+ "SS_POWER_PUBLISH_SHUTDOWN_CONDITION_RESP", l_responseStatus,
+ GetStr(l_responseStatus).c_str());
+ LOG_STATUS(l_eStatus, l_cBuf);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnPublishShutdownPopupRequest( HANDLE h_app )
+//
+// End of Shutdown Condition Notification Protocol function
+//*****************************************************************************
+
+//*****************************************************************************
+// Power Popup Notification Protocol function
+//
+EFrameworkunifiedStatus Power::OnPublishPowerPopupRequest(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ Pwr_ServiceSetInterface tServiceIf;
+
+ // ReadMsg(): *
+ // Check h_app ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceIf))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ BOOL b_isValid = FALSE;
+ EPWR_POWER_POPUP_TYPE l_ePowerPopup = tServiceIf.data.powerPopup
+ .powerPopupEvent;
+ switch (l_ePowerPopup) {
+ case epssppNormal:
+ case epssppCritical:
+ case epssppAppCritical:
+ case epssppAllClr:
+ l_eStatus = FrameworkunifiedNPPublishNotification(h_app
+ , szNTFY_PowerPopup
+ , &l_ePowerPopup
+ , sizeof(EPWR_POWER_POPUP_TYPE));
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedNPPublishNotification(%s, %d) errored: %d/'%s'",
+ szNTFY_PowerPopup, l_ePowerPopup, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ SS_PWR_LOG_HIST("OnPublishPowerPopupRequest()", m_PubCmdHist,
+ m_PubHistIter, "", l_eStatus);
+
+ b_isValid = TRUE;
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ } // End switch
+
+ if (FALSE == b_isValid) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Unknown 'l_ePowerPopup' value: 0x%X/%d", l_ePowerPopup,
+ l_ePowerPopup);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP 11:unexpected branch
+ } else {
+ EFrameworkunifiedStatus l_responseStatus = l_eStatus; // Save the current status as-is to
+ // send in the message response to the
+ // requester.
+ l_eStatus = FrameworkunifiedSendResponse(h_app, SS_POWER_PUBLISH_POWER_POPUP_RESP,
+ sizeof(EFrameworkunifiedStatus),
+ (PVOID) &l_responseStatus);
+ char l_cBuf[200];
+ snprintf(l_cBuf, sizeof(l_cBuf),
+ "FrameworkunifiedSendResponse(%s, %s, status: %d/'%s')", FrameworkunifiedGetMsgSrc(h_app),
+ "SS_POWER_PUBLISH_POWER_POPUP_RESP", l_responseStatus,
+ GetStr(l_responseStatus).c_str());
+ LOG_STATUS(l_eStatus, l_cBuf);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus Power::OnPublishPowerPopupRequest( HANDLE h_app )
+//
+// End of Power Popup Notification Protocol function
+//*****************************************************************************
+
+// EOF of /SS_PowerService/src/ss_supervisor_handlers.cpp
diff --git a/video_in_hal/systemservice/power_service/server/src/ss_system_handlers.cpp b/video_in_hal/systemservice/power_service/server/src/ss_system_handlers.cpp
new file mode 100755
index 0000000..60a9980
--- /dev/null
+++ b/video_in_hal/systemservice/power_service/server/src/ss_system_handlers.cpp
@@ -0,0 +1,52 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_PowerService
+/// \brief Handles Power Service Business logic
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "ss_power.h"
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_power_service.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include "ss_power_powerservicelog.h"
+
+EFrameworkunifiedStatus Power::OnSystemLaunchComplete(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Power Service received SS_POWER_SYSTEM_LAUNCH_COMPLETE from: %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- return EFrameworkunifiedStatus: 0x%X", eStatus);
+ return eStatus;
+}
+
+// test from peripheralservice/power_supply_manager_shadow
+EFrameworkunifiedStatus Power::OnSystemShutdownComplete(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Power Service received SS_POWER_SYSTEM_SHUTDOWN_COMPLETE from: %s",
+ FrameworkunifiedGetMsgSrc(h_app));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- return EFrameworkunifiedStatus: 0x%X", eStatus);
+ return eStatus;
+}
diff --git a/video_in_hal/systemservice/resource_manager/LICENSE b/video_in_hal/systemservice/resource_manager/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/systemservice/resource_manager/Makefile.client b/video_in_hal/systemservice/resource_manager/Makefile.client
new file mode 100755
index 0000000..2f9b64b
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/Makefile.client
@@ -0,0 +1,21 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+MODULE_NAME=resmgr
+
+SUBDIRS := client mock
+
+include ../system_service.mk
diff --git a/video_in_hal/systemservice/resource_manager/Makefile.server b/video_in_hal/systemservice/resource_manager/Makefile.server
new file mode 100755
index 0000000..2257507
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/Makefile.server
@@ -0,0 +1,23 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+MODULE_NAME=resmgr
+
+SUBDIRS := server
+
+SUBDIRS += drop_caches
+
+include ../system_service.mk
diff --git a/video_in_hal/systemservice/resource_manager/client/Makefile b/video_in_hal/systemservice/resource_manager/client/Makefile
new file mode 100755
index 0000000..a2bde46
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/client/Makefile
@@ -0,0 +1,58 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### add source path #############
+VPATH += ./
+VPATH += ./src
+VPATH += ./include
+VPATH += ../server/include
+VPATH += ../server/include/system_service
+
+######### install headers(*.h) #############
+INST_HEADERS += resm.h
+INST_HEADERS += resm_type.h
+INST_HEADERS += resource_manager.h
+
+######### installed program #############
+
+
+######### installed library(*.a) #############
+INST_LIBS =
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libresm
+RPC_API := RESMGR
+
+######### compiled sources #############
+libresm_SRCS += resmgr_api_stub.c
+libresm_SRCS += resmgr_api_lib.c
+
+######### add include path #############
+CPPFLAGS += -I./
+CPPFLAGS += -I./include
+CPPFLAGS += -I../server/include
+
+######## add compile option ########
+
+######### add library path #############
+LDFLAGS += -Wl,--no-as-needed
+
+######### linked library (dynamic) #############
+LDLIBS += -lrpc
+LDLIBS += -Wl,-Bdynamic -lev
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/resource_manager/client/RESMGR.api b/video_in_hal/systemservice/resource_manager/client/RESMGR.api
new file mode 100755
index 0000000..7bd9734
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/client/RESMGR.api
@@ -0,0 +1,12 @@
+/*
+ * Resource Manager API
+ */
+
+INCLUDE <system_service/resm.h>
+
+RPC_Result RESM_ReqEvent(uint32_t ssnld, const RESM_REQ_EVENT_t* p_reqEvent);
+RPC_Result RESM_GetStatus(uint32_t ssnld, RESM_STATUS_t* p_status);
+RPC_Result RESM_SV_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnld);
+RPC_Result RESM_SV_Close(uint32_t ssnld);
+RPC_Result RESM_SV_ChkSsnId(uint32_t ssnld);
+
diff --git a/video_in_hal/systemservice/resource_manager/client/include/resmgr_api_resourcemanagerlog.h b/video_in_hal/systemservice/resource_manager/client/include/resmgr_api_resourcemanagerlog.h
new file mode 100755
index 0000000..b9d66fa
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/client/include/resmgr_api_resourcemanagerlog.h
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _resmgr_api_resourcemanagerlog_h_ // NOLINT
+#define _resmgr_api_resourcemanagerlog_h_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10) // LIB common definition
+#define ZONE_FUNC ZONEMASK(11) // LIB common definition
+#define ZONE_MEM ZONEMASK(12) // LIB common definition
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29) // LIB common definition
+#define ZONE_WARN ZONEMASK(30) // LIB common definition
+#define ZONE_ERR ZONEMASK(31) // LIB common definition
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT, LSHAREDMEM
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_INFO
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+#endif /* !_resmgr_api_resourcemanagerlog_h_ */ // NOLINT
diff --git a/video_in_hal/systemservice/resource_manager/client/libresm.ver b/video_in_hal/systemservice/resource_manager/client/libresm.ver
new file mode 100755
index 0000000..fc56632
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/client/libresm.ver
@@ -0,0 +1,28 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libresm version script
+#
+{
+ global:
+ ### .text section ###
+ RESM_*;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/video_in_hal/systemservice/resource_manager/client/src/#resmgr_api_lib.c# b/video_in_hal/systemservice/resource_manager/client/src/#resmgr_api_lib.c#
new file mode 100755
index 0000000..02e84e4
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/client/src/#resmgr_api_lib.c#
@@ -0,0 +1,142 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <other_service/rpc.h>
+#include "resm_internal.h"
+#include "resmgr_api.h"
+#include "resmgr_api_resourcemanagerlog.h"
+
+/**********************************************
+ * External variable definitions
+ **********************************************/
+RPC_ID __thread rpcId;
+
+/*******************************************************************************
+ * RPC public API
+ *******************************************************************************/
+/* Connection */
+RESM_ERR_t
+RESM_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnId)
+{
+
+ RESM_ERR_t resmRet;
+ EV_ERR evRet;
+
+ // Argument check
+ if( p_ssnId == NULL ) {
+ return RESM_E_PAR;
+ }
+
+ // RPC resources
+ if( RPC_OK != RPC_START_CLIENT(&rpcId) ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: RPC_START Error"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return RESM_E_NG;
+ }
+
+
+ // Session connection
+ resmRet = RESM_SV_Open(p_prim, p_ssnId);
+ if( resmRet != RESM_E_OK ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: Open Session Error. ret[%d]", resmRet); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return RESM_E_NG;
+ }
+
+ // Create Event Flag
+ evRet = EV_create_flag(Resm_Flag_ID_Base + *p_ssnId);
+ if( evRet != EV_OK ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: create_flag Error. ret[%d]", evRet);
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/* Disconnection */
+RESM_ERR_t
+RESM_Close(uint32_t ssnId)
+{
+
+ RESM_ERR_t resmRet;
+
+ // Disconnect session
+ resmRet = RESM_SV_Close(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return resmRet;
+ }
+
+ // Destroy RPC Resources
+ RPC_end(rpcId);
+
+ return RESM_E_OK;
+}
+
+/* Get event FD */
+RESM_ERR_t
+RESM_GetEventFd(uint32_t ssnId, int32_t* p_fd)
+{
+
+ RESM_ERR_t resmRet;
+
+ // Argument check
+ if( p_fd == NULL ) {
+ return RESM_E_PAR;
+ }
+ // Session ID check
+ resmRet = RESM_SV_ChkSsnId(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return RESM_E_PAR;
+ }
+
+ if( EV_OK != EV_get_flag_fd(Resm_Flag_ID_Base + ssnId, p_fd) ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr GetEventFd Error");
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/* Get event */
+RESM_ERR_t
+RESM_GetEvent(uint32_t ssnId, RESM_EV_t* p_evFlag)
+{
+
+ RESM_ERR_t resmRet;
+ EV_Flag flag;
+
+ // Argument check
+ if( p_evFlag == NULL ) {
+ return RESM_E_PAR;
+ }
+ // Session ID Check
+ resmRet = RESM_SV_ChkSsnId(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return RESM_E_PAR;
+ }
+
+ if( EV_OK != EV_get_flag(Resm_Flag_ID_Base + ssnId, &flag)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr GetEvent(get_flag) Error");
+ return RESM_E_NG;
+ }
+
+ if( flag.bits == 0 ) {
+ // No event
+ return RESM_E_NG;
+ }
+
+ *p_evFlag = flag.bits;
+
+ return RESM_E_OK;
+}
diff --git a/video_in_hal/systemservice/resource_manager/client/src/resmgr_api_lib.c b/video_in_hal/systemservice/resource_manager/client/src/resmgr_api_lib.c
new file mode 100755
index 0000000..02e84e4
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/client/src/resmgr_api_lib.c
@@ -0,0 +1,142 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <other_service/rpc.h>
+#include "resm_internal.h"
+#include "resmgr_api.h"
+#include "resmgr_api_resourcemanagerlog.h"
+
+/**********************************************
+ * External variable definitions
+ **********************************************/
+RPC_ID __thread rpcId;
+
+/*******************************************************************************
+ * RPC public API
+ *******************************************************************************/
+/* Connection */
+RESM_ERR_t
+RESM_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnId)
+{
+
+ RESM_ERR_t resmRet;
+ EV_ERR evRet;
+
+ // Argument check
+ if( p_ssnId == NULL ) {
+ return RESM_E_PAR;
+ }
+
+ // RPC resources
+ if( RPC_OK != RPC_START_CLIENT(&rpcId) ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: RPC_START Error"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return RESM_E_NG;
+ }
+
+
+ // Session connection
+ resmRet = RESM_SV_Open(p_prim, p_ssnId);
+ if( resmRet != RESM_E_OK ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: Open Session Error. ret[%d]", resmRet); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
+ return RESM_E_NG;
+ }
+
+ // Create Event Flag
+ evRet = EV_create_flag(Resm_Flag_ID_Base + *p_ssnId);
+ if( evRet != EV_OK ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Open: create_flag Error. ret[%d]", evRet);
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/* Disconnection */
+RESM_ERR_t
+RESM_Close(uint32_t ssnId)
+{
+
+ RESM_ERR_t resmRet;
+
+ // Disconnect session
+ resmRet = RESM_SV_Close(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return resmRet;
+ }
+
+ // Destroy RPC Resources
+ RPC_end(rpcId);
+
+ return RESM_E_OK;
+}
+
+/* Get event FD */
+RESM_ERR_t
+RESM_GetEventFd(uint32_t ssnId, int32_t* p_fd)
+{
+
+ RESM_ERR_t resmRet;
+
+ // Argument check
+ if( p_fd == NULL ) {
+ return RESM_E_PAR;
+ }
+ // Session ID check
+ resmRet = RESM_SV_ChkSsnId(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return RESM_E_PAR;
+ }
+
+ if( EV_OK != EV_get_flag_fd(Resm_Flag_ID_Base + ssnId, p_fd) ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr GetEventFd Error");
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/* Get event */
+RESM_ERR_t
+RESM_GetEvent(uint32_t ssnId, RESM_EV_t* p_evFlag)
+{
+
+ RESM_ERR_t resmRet;
+ EV_Flag flag;
+
+ // Argument check
+ if( p_evFlag == NULL ) {
+ return RESM_E_PAR;
+ }
+ // Session ID Check
+ resmRet = RESM_SV_ChkSsnId(ssnId);
+ if( resmRet != RESM_E_OK ) {
+ return RESM_E_PAR;
+ }
+
+ if( EV_OK != EV_get_flag(Resm_Flag_ID_Base + ssnId, &flag)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "[RESM_ERR]ResMgr GetEvent(get_flag) Error");
+ return RESM_E_NG;
+ }
+
+ if( flag.bits == 0 ) {
+ // No event
+ return RESM_E_NG;
+ }
+
+ *p_evFlag = flag.bits;
+
+ return RESM_E_OK;
+}
diff --git a/video_in_hal/systemservice/resource_manager/drop_caches/Makefile b/video_in_hal/systemservice/resource_manager/drop_caches/Makefile
new file mode 100755
index 0000000..03b31cf
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/drop_caches/Makefile
@@ -0,0 +1,38 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = drop_caches
+
+######### install headers(*.h) #############
+INST_HEADERS =
+
+######### compiled sources #############
+drop_caches_SRCS = ./src/drop_caches.cpp
+
+######### add include path #############
+CPPFLAGS = -I../server/include
+
+######## define options ########
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 \
+ -DFRAMEWORKUNIFIEDLOGAPPZONES=31
+CPPFLAGS += -fno-exceptions
+LDFLAGS += -Wl,--no-as-needed
+######### linked library (dynamic) #############
+LDLIBS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/resource_manager/drop_caches/src/drop_caches.cpp b/video_in_hal/systemservice/resource_manager/drop_caches/src/drop_caches.cpp
new file mode 100755
index 0000000..d192705
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/drop_caches/src/drop_caches.cpp
@@ -0,0 +1,183 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "ss_resm_resourcemanagerlog.h"
+
+#define DROP_CACHES "/proc/sys/vm/drop_caches"
+
+// FRAMEWORKUNIFIEDLOG
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+// echo 1 > /proc/sys/vm/drop_caches
+#define DROP_CACHES_INTVAL_TIMESEC (1 * 10) // 10 sec
+
+#define MEMINFO_FILE "/proc/meminfo"
+
+/* memFree threshold */
+#define MEMFREE_THRETHOLD (100*1024)
+/* LowFree - CmaFree threshold */
+#define LOWFREE_THRETHOLD (50*1024)
+
+static uint32_t mainFree_kib;
+static uint32_t lowFree_kib;
+static uint32_t cmaFree_kib;
+// meminfo table
+typedef struct {
+ const char* name;
+ uint32_t* value;
+} meminfo_tbl;
+
+static int32_t get_meminfo(void);
+static int32_t comp_meminfo_tbl(const void* data1, const void* data2);
+static bool judge_cachedrop(void);
+
+static void
+exec_drop_caches(void) {
+ int fd;
+
+ fd = open(DROP_CACHES, O_RDWR);
+ if (fd >= 0) {
+ write(fd, (const void *)"1", 1);
+ close(fd);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "%s open error (fd:%d, errno:%d)", DROP_CACHES, fd, errno);
+ }
+}
+
+int
+main(int argc, char* argv[]) {
+ const struct timespec drop_caches_intval = {DROP_CACHES_INTVAL_TIMESEC, 0};
+
+ FRAMEWORKUNIFIED_SET_ZONES();
+
+ while (1) {
+ /* Get meminfo */
+ get_meminfo();
+ if (judge_cachedrop()) {
+ exec_drop_caches();
+ }
+ nanosleep(&drop_caches_intval, NULL);
+ }
+
+ return 0;
+}
+
+/* Compare memory information */
+static int32_t
+comp_meminfo_tbl(const void* data1, const void* data2) {
+ return strcmp(((const meminfo_tbl*)data1)->name,
+ ((const meminfo_tbl*)data2)->name);
+}
+
+/* Get memory information */
+static int32_t
+get_meminfo(void) {
+ int32_t meminfo_fd = -1;
+ char srch_name[16];
+ char buf[2048];
+ meminfo_tbl target = {srch_name, NULL};
+ meminfo_tbl* found;
+ char* head;
+ char* tail;
+ int32_t read_byte;
+ /* Strings must be in ascending order when adding entries to this table (for bsearch) */
+ static const meminfo_tbl mem_table[] = {
+ {"CmaFree", &cmaFree_kib},
+ {"LowFree", &lowFree_kib},
+ {"MemFree", &mainFree_kib},
+ };
+ const int32_t mem_table_count = sizeof(mem_table)/sizeof(meminfo_tbl);
+
+ if (meminfo_fd == -1) {
+ meminfo_fd = open(MEMINFO_FILE, O_RDONLY);
+ if (meminfo_fd == -1) {
+ fflush(NULL);
+ return -1;
+ }
+ }
+
+ lseek(meminfo_fd, 0L, SEEK_SET);
+ read_byte = read (meminfo_fd, buf, sizeof(buf) - 1);
+ if (read_byte < 0) {
+ fflush(NULL);
+ close(meminfo_fd);
+ return -1;
+ }
+ buf[read_byte] = '\0';
+
+ head = buf;
+ while (1) {
+ tail = strchr(head, ':');
+ if (!tail) {
+ break;
+ }
+ *tail = '\0';
+ if (strlen (head) >= sizeof(srch_name)) {
+ head = tail + 1;
+ } else {
+ strcpy(srch_name, head); // NOLINT
+ found = reinterpret_cast<meminfo_tbl *>(bsearch(&target, mem_table, mem_table_count,
+ sizeof(meminfo_tbl), comp_meminfo_tbl));
+ head = tail + 1;
+ if (found) {
+ *(found->value) = strtoul(head, &tail, 10);
+ }
+ }
+ tail = strchr(head, '\n');
+ if (!tail)
+ break;
+ head = tail + 1;
+ }
+ close(meminfo_fd);
+
+ return 0;
+}
+
+static bool
+judge_cachedrop(void) {
+ if (mainFree_kib < MEMFREE_THRETHOLD) {
+ return true;
+ }
+
+ if ((lowFree_kib - cmaFree_kib) < LOWFREE_THRETHOLD) {
+ return true;
+ }
+
+ return false;
+}
diff --git a/video_in_hal/systemservice/resource_manager/server/Makefile b/video_in_hal/systemservice/resource_manager/server/Makefile
new file mode 100755
index 0000000..cae9191
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/Makefile
@@ -0,0 +1,55 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = resm
+
+######### compiled sources #############
+resm_SRCS += resm.cpp
+resm_SRCS += proc_watch.cpp
+resm_SRCS += resourcemanager_application.cpp
+resm_SRCS += cpuload_custom.cpp
+resm_SRCS += resmgr_srvr_stub.cpp
+
+######### add source path #############
+VPATH += ./src
+VPATH += ./include/$(COMPONENT_NAME)
+VPATH += ../client
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I../client
+
+######## add compile option ########
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGAPPZONES=104,64,31,30,29,28
+CPPFLAGS += -DTARGET_SOC_$(TARGET_SOC)
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+CPPFLAGS += -fno-exceptions
+
+######### linked library (dynamic) #############
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lsoc_temperature_hal
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lrpc
+
+LDLIBS += -Wl,-Bdynamic -lev
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/resource_manager/server/include/proc_watch.h b/video_in_hal/systemservice/resource_manager/server/include/proc_watch.h
new file mode 100755
index 0000000..8a98afd
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/include/proc_watch.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_PROC_WATCH_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_PROC_WATCH_H_
+
+/**********************************************
+ * Prototype declaration
+ **********************************************/
+void *PRCW_main(void *p);
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_PROC_WATCH_H_
diff --git a/video_in_hal/systemservice/resource_manager/server/include/resm_cfg.h b/video_in_hal/systemservice/resource_manager/server/include/resm_cfg.h
new file mode 100755
index 0000000..e48cdce
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/include/resm_cfg.h
@@ -0,0 +1,132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+File name : resm_cfg.h
+******************************************************************************/
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_RESM_CFG_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_RESM_CFG_H_
+
+/******************************************************************************
+Configuration
+******************************************************************************/
+/*************************************************
+ * Delay time from process start to monitoring start (sec)
+ * def:60 max:- min:0
+ * (0: stop timer)
+ *************************************************/
+#define MONITORING_START_DELAT_TIME (60)
+
+
+/*************************************************
+ * Delay time until authentication service monitoring start (sec)
+ * def:30 max:- min:0
+ * (0: stop timer)
+ * MONITORING_START_DELAT_TIME > set to this value
+ *************************************************/
+#define EUA_MONITORING_START_DELAT_TIME (30)
+
+
+/*************************************************
+ * Delay from drop_caches process startup (sec)
+ * def:20 max:- min:0
+ * (0: stop timer)
+ *************************************************/
+#define DROP_CACHES_START_DELAT_TIME (20)
+
+
+///*************************************************
+// * CPU load threshold (%)
+// * def:70 max:100 min:0
+// *************************************************/
+//#define CPU_LOAD_THRESHOLD (70)
+/*************************************************
+ * CPU load threshold(%:XX.X)
+ * threshold:875 max:1000 min:0
+ *************************************************/
+#define CPU_LOAD_THRESHOLD (875)
+
+
+/*************************************************
+ * Number of CPU overload processes to be logged (rows)
+ * def:5 max:- min:0
+ *************************************************/
+#define CPU_HIGH_LOAD_P_LOG_NUM (5)
+
+
+///*************************************************
+// * Log output frequency during CPU overload continuation (sec)
+// * def:30 max:- min:0
+// *
+// * Specify as a multiple of the polling interval(WTC_CPU_INTERVAL) for CPU load monitoring
+// *************************************************/
+//#define CPU_HIGH_LOAD_LOG_FREQ (30)
+/*************************************************
+ * Log output frequency during CPU overload continuation (sec)
+ * def:60 max:- min:0
+ *
+ * Specify as a multiple of the polling interval(WTC_CPU_INTERVAL) for CPU load monitoring
+ *************************************************/
+#define CPU_HIGH_LOAD_LOG_FREQ (60)
+
+
+/*************************************************
+ * perf Profiling/Measurement Processes
+ * def:1 max:- min:1
+ *************************************************/
+#define PERF_MAX_PROCS (1)
+
+/*************************************************
+ * perf profiling/Output rows (functions)
+ * def:5 max:- min:1
+ *************************************************/
+#define PERF_MAX_LINES (5)
+
+/*************************************************
+ * perf pofiling/perf-record running time (sec)
+ * def:1 max:- min:1
+ *************************************************/
+#define PERF_RECORD_SPAN (1)
+
+#define TOP_TIMEOUT (60)
+
+#define RESET_SEC (60)
+
+
+#define WTC_CPU_INTERVAL (6)
+
+#define TASK_STAT_THRESHOLD (70)
+#define FIFO_TIMER_LIMIT (6)
+#define TSS_TIMER_LIMIT (60)
+
+#define CPU_TASK_INIT (1)
+#define CPU_TASK_SHOW_BF (2)
+#define CPU_TASK_SHOW_AF (3)
+#define FIFO_TASK_SHOW (4)
+#define TSS_TASK_SHOW (5)
+#define CPU_FIFO_TASK_GET_ID (6)
+#define CPU_TSS_TASK_GET_ID (7)
+#define CPU_FIFO_TASK_GET_OCCUPANCY (8)
+#define CPU_TSS_TASK_GET_OCCUPANCY (9)
+
+#define STATUS_IDOL (1)
+#define STATUS_CHECK_CPU (2)
+#define STATUS_WATCH_PROCESS (3)
+
+#define TASK_STAT_RANK_NUM (5)
+
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_RESM_CFG_H_
diff --git a/video_in_hal/systemservice/resource_manager/server/include/resm_internal.h b/video_in_hal/systemservice/resource_manager/server/include/resm_internal.h
new file mode 100755
index 0000000..090814e
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/include/resm_internal.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_RESM_INTERNAL_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_RESM_INTERNAL_H_
+
+#include <agldd/moduleid.h>
+#include <agldd/ev_common.h>
+
+#include <other_service/ev_lib.h>
+#include "system_service/resm_type.h"
+
+#define Resm_Flag_ID_Base EV_Flag_ID_Base(RESMGR_MID)
+
+/*******************************************************************************
+ * User defined
+ *******************************************************************************/
+#define MY_MAX(a, b) ((a) > (b) ? (a) : (b))
+
+/***********************************************************
+ * Internal API definitions
+ ***********************************************************/
+RESM_ERR_t RESM_SV_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnld);
+RESM_ERR_t RESM_SV_Close(uint32_t ssnld);
+RESM_ERR_t RESM_SV_ChkSsnId(uint32_t ssnld);
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_RESM_INTERNAL_H_
diff --git a/video_in_hal/systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h b/video_in_hal/systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h
new file mode 100755
index 0000000..94c16b3
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h
@@ -0,0 +1,82 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SS_RESM_RESOURCEMANAGERLOG_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SS_RESM_RESOURCEMANAGERLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10) // LIB common definition
+#define ZONE_FUNC ZONEMASK(11) // LIB common definition
+#define ZONE_MEM ZONEMASK(12) // LIB common definition
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_RESM_DEBUG ZONEMASK(28) // DEBUG
+#define ZONE_INFO ZONEMASK(29) // LIB common definition
+#define ZONE_WARN ZONEMASK(30) // LIB common definition
+#define ZONE_ERR ZONEMASK(31) // LIB common definition
+
+#define ZONE_SOC_TEMP ZONEMASK(104)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 "ResmDebug"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT,LSHAREDMEM
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_INFO
+// #define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN,ZONE_ERR,ZONE_INFO,ZONE_RESM_DEBUG //DEBUG
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SS_RESM_RESOURCEMANAGERLOG_H_
diff --git a/video_in_hal/systemservice/resource_manager/server/include/system_service/resm.h b/video_in_hal/systemservice/resource_manager/server/include/system_service/resm.h
new file mode 100755
index 0000000..d3b8850
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/include/system_service/resm.h
@@ -0,0 +1,325 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file resm.h
+ * @brief \~english This file contains declaration of APIs for resm library
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup resource_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_H_
+
+#include "system_service/resm_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_Open
+/// \~english @par Summary
+/// Opens the session with resource manager.
+/// \~english @param [in] p_prim
+/// RESM_RSV_t* - Unused, NULL
+/// \~english @param [out] p_ssnId
+/// uint32_t* - Pointer to session ID
+/// \~english @par
+/// RESM_RSV_t Variables
+/// \~english @code
+/// #define RESM_RSV_t int32_t
+/// #define RESM_RSV_NULL (0x00) // NULL
+/// @endcode
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - Availability of ResourceManager must be TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_ssnId is NULL. [RESM_E_PAR]
+/// - The global variable for getting RPC_ID of program (rpcId) is NULL. [RESM_E_NG]
+/// - The area for RPC ID(rpcId) is not gotten. [RESM_E_NG]
+/// - The number of the thread able to register in a process exceeds limit. [RESM_E_NG]
+/// - It failed to get the area for thread information. [RESM_E_NG]
+/// - It failed to get the area for ID information storage. [RESM_E_NG]
+/// - It failed to generate the datagram socket for API request receiving. [RESM_E_NG]
+/// - It failed to bind a socket. [RESM_E_NG]
+/// - It failed to get a socket name. [RESM_E_NG]
+/// - The number of sessions exceeds the maximum value. [RESM_E_NG]
+/// - There is no space in the thread information area for event registration. [RESM_E_NG]
+/// - It failed to get the thread information area for event registration. [RESM_E_NG]
+/// - The file descriptor for getting an event is created. [RESM_E_NG]
+/// - The generated session ID exists (EEXIST error at ioctl). [RESM_E_NG]
+/// - Any error occurred during registering an event flag (EEXIST error at ioctl). [RESM_E_NG]
+/// - Any error occurred during processing poling setting (error at ioctl). [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Opens a session. \n
+/// An application can use another API by using the gotten ssnID.
+/// \~english @see RESM_Close
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnld);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_Close
+/// \~english @par Summary
+/// Closes the session with resource manager.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Closes a session.
+/// \~english @see RESM_Open
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_Close(uint32_t ssnld);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_ReqEvent
+/// \~english @par Summary
+/// Requests to issue an event.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [in] p_reqEvent
+/// RESM_REQ_EVENT_t* - Pointer to event
+/// \~english @par
+/// RESM_REQ_EVENT_t Structure
+/// \~english @code
+/// typedef struct {
+/// RESM_EV_t reqEvent; /* Event flag necessary to report */
+/// struct {
+/// uint32_t restMemThresh; /* Threshold of the remaining capacity of system memory */
+/// } prm;
+/// }RESM_REQ_EVENT_t;
+/// @endcode
+/// \~english @par
+/// RESM_EV_t Variables
+/// \~english @code
+/// #define RESM_EV_t uint32_t
+/// #define RESM_EV_NOP (0x00)
+/// #define RESM_EV_MEM (0x01)
+/// #define RESM_EV_NAND_STATUS (0x02)
+/// @endcode
+/// \~english @par
+/// - RESM_EV_NOP : No event notification
+/// - RESM_EV_MEM : Event notification for memory
+/// - RESM_EV_NAND_STATUS : Eventnotification for NAND state
+/// \~english @par
+/// Notes
+/// - restMemThresh is valid only when RESM_EV_MEM is set to reqEvent. \n
+/// ResourceManager issues RESM_EV_MEM event at the timing
+/// when the remaining capacity of system memory fell below the value (unit is BYTE)
+/// which an application specifies.
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_reqEvent is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Requests to issue an event.
+/// This API is called from the RPC library.
+/// \~english @see RESM_GetEvent
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_ReqEvent(uint32_t ssnld, const RESM_REQ_EVENT_t* p_reqEvent);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_GetEventFd
+/// \~english @par Summary
+/// Gets FD of the event to receive from resource manager.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [out] p_fd
+/// int* - Pointer to file descriptor
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_fd is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// - ssnId rewrites bit for an event flag decision by invalid values. [RESM_E_NG]
+/// - The file descriptor corresponding to ssnId is not found. [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Gets FD of the event to receive from resource manager. \n
+/// An application can do simultaneous wait of other events with the event of ResourceManager
+/// by oversighting the gotten FD by select,poll etc.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_GetEventFd(uint32_t ssnld, int* p_fd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_GetEvent
+/// \~english @par Summary
+/// Gets the event from resource manager.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [out] p_evFlag
+/// RESM_EV_t* - Pointer to event
+/// \~english @par
+/// RESM_EV_t Variables
+/// \~english @code
+/// #define RESM_EV_t uint32_t
+/// #define RESM_EV_NOP (0x00)
+/// #define RESM_EV_MEM (0x01)
+/// #define RESM_EV_NAND_STATUS (0x02)
+/// @endcode
+/// \~english @par
+/// - RESM_EV_NOP : No event notification
+/// - RESM_EV_MEM : Event notification for memory
+/// - RESM_EV_NAND_STATUS : Event notification for NAND state
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_evFlag is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// - ssnId rewrites bit for an event flag decision by invalid values. [RESM_E_NG]
+/// - The file descriptor corresponding to ssnId is not found. [RESM_E_NG]
+/// - The flag of ssnId is not registered. (The returned value of ioctl is EOENT.) [RESM_E_NG]
+/// - Any interruption occurred during getting an event. (The returned value of ioctl is EINTR.) [RESM_E_NG]
+/// - Any error occurred during getting an event. (The returned value of ioctl is the error value
+/// except for EOENT and EINTR.) [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// When an event flag is not set, this is blocked. \n
+/// If an event flag is set, this stores event contents to p_evFlag and this ends. \n
+/// If this ends, it clears all of event flags.
+/// \~english @see RESM_ReqEvent
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_GetEvent(uint32_t ssnld, RESM_EV_t* p_evFlag);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_GetStatus
+/// \~english @par Summary
+/// Gets system state.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [out] p_status
+/// RESM_STATUS_t* - Pointer to system state
+/// \~english @par
+/// RESM_STATUS_t Structure
+/// \~english @code
+/// typedef struct {
+/// uint32_t restMemSize; /* Remaining memory length (KB) */
+/// RESM_NAND_WRITE_STATUS_t nandWriteStatus; /* Access permission / Prohibition state to NAND flash */
+/// RESM_INET_STATUS_t inetStatus; /* Network IF statistical information after start */
+/// } RESM_STATUS_t;
+/// @endcode
+/// \~english @par
+/// enum RESM_NAND_WRITE_STATUS_t Variables
+/// - RESM_NAND_WRITE_ENABLE : NAND access permission
+/// - RESM_NAND_WRITE_DISABLE : NAND access prohibition
+/// \~english @par
+/// Notes
+/// - When system records in NAND flash and it influences the lifetime of a device,
+/// STATUS(nandWriteStatus) becomes RESM_NAND_WRITE_DISABLE. It is not in the state where WRITE fails. \n
+/// \~english @par
+/// RESM_INET_STATUS_t Structure
+/// \~english @code
+/// typedef struct {
+/// uint32_t ifNum; /* Valid array at the number of interface and ifInfo */
+/// struct {
+/// char name[64]; /* Interface name */
+/// uint64_t rxSize; /* Receiving data length (KiB) */
+/// uint64_t txSize; /* Transmission data length (KiB) */
+/// uint8_t hwaddr[HWADDR_LEN]; /* Hardware address (MAC address) */
+/// } ifInfo[RESM_INET_IF_MAX];
+/// }RESM_INET_STATUS_t;
+/// @endcode
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_evFlag is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// - It failed to open the device file for network. [RESM_E_NG]
+/// - The number of the gotten network IF is 0. [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Gets system state.
+/// This API is called from the RPC library.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_GetStatus(uint32_t ssnld, RESM_STATUS_t* p_status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_H_
+
+/** @}*/ // end of ResourceManager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/resource_manager/server/include/system_service/resm_type.h b/video_in_hal/systemservice/resource_manager/server/include/system_service/resm_type.h
new file mode 100755
index 0000000..1adbf37
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/include/system_service/resm_type.h
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file resm_type.h
+ * @brief \~english This file contains declaration of common enum and structures for resm library
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup resource_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_TYPE_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_TYPE_H_
+
+#include <agl_thread.h>
+
+#define NTFY_ResourceMgr_Availability MN_SS_RESOURCEMGR"/Availability"
+
+#define RESM_ERR_t int32_t
+#define RESM_E_OK (0)
+#define RESM_E_PAR (-1)
+#define RESM_E_NG (-2)
+
+// Event flags (bit pattern)
+#define RESM_EV_t uint32_t
+#define RESM_EV_NOP (0x00)
+#define RESM_EV_MEM (0x01)
+#define RESM_EV_NAND_STATUS (0x02)
+
+#define RESM_RSV_t int32_t
+
+typedef enum {
+ RESM_NAND_WRITE_ENABLE = 0,
+ RESM_NAND_WRITE_DISABLE = -1
+} RESM_NAND_WRITE_STATUS_t;
+
+typedef struct {
+ RESM_EV_t reqEvent;
+ struct {
+ uint32_t restMemThresh;
+ } prm;
+} RESM_REQ_EVENT_t;
+
+#define RESM_INET_IF_MAX 5 /* tentative */
+#define HWADDR_LEN (6)
+typedef struct {
+ uint32_t ifNum;
+ struct {
+ char name[64];
+ uint64_t rxSize;
+ uint64_t txSize;
+ uint8_t hwaddr[HWADDR_LEN];
+ } ifInfo[RESM_INET_IF_MAX];
+} RESM_INET_STATUS_t;
+
+typedef struct {
+ uint32_t restMemSize;
+ RESM_NAND_WRITE_STATUS_t nandWriteStatus;
+ RESM_INET_STATUS_t inetStatus;
+} RESM_STATUS_t;
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_TYPE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/resource_manager/server/include/system_service/resource_manager.h b/video_in_hal/systemservice/resource_manager/server/include/system_service/resource_manager.h
new file mode 100755
index 0000000..48c7a4c
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/include/system_service/resource_manager.h
@@ -0,0 +1,43 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file resource_manager.h
+ * @brief \~english include all resm_library head files
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup resource_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESOURCE_MANAGER_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESOURCE_MANAGER_H_
+
+#include "system_service/resm.h"
+#include "system_service/resm_type.h"
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESOURCE_MANAGER_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/resource_manager/server/src/cpuload_custom.cpp b/video_in_hal/systemservice/resource_manager/server/src/cpuload_custom.cpp
new file mode 100755
index 0000000..c6a8e75
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/src/cpuload_custom.cpp
@@ -0,0 +1,512 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <string.h>
+#include <errno.h>
+#include <sched.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "ss_resm_resourcemanagerlog.h"
+
+#include "resm_cfg.h"
+
+typedef struct _task_stat {
+ struct _task_stat *next;
+ char path[64];
+ pid_t pid_nr_ns;
+ char tcomm[64];
+ char state;
+ pid_t ppid;
+ pid_t pgid;
+ unsigned long utime; // NOLINT
+ unsigned long stime; // NOLINT
+ int priority;
+ int nice;
+ int task_cpu;
+ unsigned int task_rt_priority;
+ unsigned int task_policy;
+} TASK_STAT;
+
+
+typedef struct _task_rank
+{
+ pid_t pid_nr_ns;
+ char state;
+ unsigned long taskOccupancy;
+ unsigned long utime;
+ unsigned long stime;
+ int priority;
+ unsigned int task_policy;
+ int task_cpu;
+ char tcomm[64];
+} TASK_RANK;
+
+
+static TASK_STAT *g_task_stat = NULL;
+
+static int32_t g_fifo_task_pid = -1;
+static int32_t g_tss_task_pid = -1;
+static unsigned long g_fifo_task_occ = -1;
+static unsigned long g_tss_task_occ = -1;
+static int32_t g_fifo_show_timer = 0;
+static int32_t g_tss_show_timer = 0;
+static unsigned int g_startTime = 0;
+static char g_fifo_path[64];
+static char g_tss_path[64];
+static unsigned long g_fifo_utime;
+static unsigned long g_fifo_stime;
+static unsigned long g_tss_utime;
+static unsigned long g_tss_stime;
+
+
+static void cleanup_task_stat(void) {
+ TASK_STAT *p, *q;
+
+ p = g_task_stat;
+ while (p) {
+ q = p->next;
+ free(p);
+ p = q;
+ }
+ g_task_stat = NULL;
+}
+
+static int add_task_stat(TASK_STAT *tstat) {
+ TASK_STAT *p;
+
+ p = reinterpret_cast<TASK_STAT *>(malloc(sizeof(TASK_STAT)));
+ if (p == NULL) { // LCOV_EXCL_BR_LINE 5: malloc error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: malloc error case
+ }
+ memcpy(p, tstat, sizeof(TASK_STAT));
+ p->next = 0;
+
+ if (g_task_stat) {
+ p->next = g_task_stat;
+ }
+ g_task_stat = p;
+
+ return 0;
+}
+
+// No error : > 0
+static int get_task_stat(const char *path, TASK_STAT *tstat) {
+ pid_t sid;
+ int tty_nr, tty_pgrp;
+ unsigned long task_flags; // NOLINT
+ unsigned long min_flt, cmin_flt, maj_flt, cmaj_flt; // NOLINT
+ signed long cutime, cstime; // NOLINT
+ int num_threads, zero1;
+ unsigned long long start_time; // NOLINT
+ unsigned long vsize, mm_rss, rsslim, start_code, end_code, start_stack; // NOLINT
+ unsigned long esp, eip, task_pending_signal_sig, task_blocked_sig; // NOLINT
+ unsigned long sigign_sig, sigcatch_sig, wchan, zero2, zero3; // NOLINT
+ int exit_signal;
+ unsigned long long delayacct_blkio_ticks; // NOLINT
+ unsigned long guest_time; // NOLINT
+ signed long cguest_time; // NOLINT
+
+ int fd;
+ int ret = -1;
+#define READ_MAX_SIZE 4096
+ char buf[READ_MAX_SIZE];
+
+ fd = open(path, O_RDONLY);
+ if (fd != -1) {
+ if (read(fd, buf, sizeof(buf)) != -1) { // LCOV_EXCL_BR_LINE 5: read's error case
+ ret =
+ sscanf(
+ buf,
+ "%d %32s %c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %d %d %d %d %llu %lu %lu"
+ " %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld",
+ &(tstat->pid_nr_ns), tstat->tcomm, &(tstat->state),
+ &(tstat->ppid), &(tstat->pgid), &sid, &tty_nr, &tty_pgrp,
+ &task_flags, &min_flt, &cmin_flt, &maj_flt, &cmaj_flt,
+ &(tstat->utime), &(tstat->stime), &cutime, &cstime,
+ &(tstat->priority), &(tstat->nice), &num_threads, &zero1,
+ &start_time, &vsize, &mm_rss, &rsslim, &start_code, &end_code,
+ &start_stack, &esp, &eip, &task_pending_signal_sig,
+ &task_blocked_sig, &sigign_sig, &sigcatch_sig, &wchan, &zero2,
+ &zero3, &exit_signal, &(tstat->task_cpu),
+ &(tstat->task_rt_priority), &(tstat->task_policy),
+ &delayacct_blkio_ticks, &guest_time, &cguest_time);
+ }
+ close(fd);
+ }
+ return ret;
+}
+
+static void get_current_task_stat(void) {
+ TASK_STAT tstat;
+ DIR *dirp;
+ struct dirent entry;
+ struct dirent *result;
+ char path[64];
+
+ struct timespec tp;
+
+ dirp = opendir("/proc");
+ if (dirp == NULL) { // LCOV_EXCL_BR_LINE 5: opendir error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return; // LCOV_EXCL_LINE 5: opendir error case
+ }
+
+ if (clock_gettime (CLOCK_MONOTONIC, &tp) == 0) {
+ g_startTime = ((tp.tv_sec * 1000) + (tp.tv_nsec / 1000000)); // Unit is msec
+ } else {
+ g_startTime = 0;
+ }
+
+ while ((readdir_r(dirp, &entry, &result) == 0) && (result != NULL)) {
+ if ((entry.d_name[0] >= '1') && (entry.d_name[0] <= '9')) {
+ DIR *dirp2;
+ struct dirent entry2;
+ struct dirent *result2;
+
+ sprintf(path, "/proc/%s/task", entry.d_name); // NOLINT
+ dirp2 = opendir(path);
+ if (dirp2 == NULL) { // LCOV_EXCL_BR_LINE 5: opendir error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue; // LCOV_EXCL_LINE 5: opendir error case
+ }
+
+ while ((readdir_r(dirp2, &entry2, &result2) == 0) && (result2 != NULL)) {
+ if ((entry2.d_name[0] >= '1') && (entry2.d_name[0] <= '9')) {
+ char path2[64];
+ int ret;
+ struct timespec req = { 0, 1000000 }; // 1msec
+
+ sprintf(path2, "%s/%s/stat", path, entry2.d_name); // NOLINT
+ ret = get_task_stat(path2, &tstat);
+
+// if ((ret > 0) && (tstat.task_policy == SCHED_FIFO)) {
+ if (ret > 0) { // LCOV_EXCL_BR_LINE 200: ret must be bigger than 0
+
+ strcpy(tstat.path, path2); // NOLINT
+ add_task_stat(&tstat);
+ }
+ nanosleep(&req, NULL);
+ }
+ }
+ closedir(dirp2);
+ }
+ }
+ closedir(dirp);
+}
+
+static void show_cpuload(void) {
+ int ret;
+ TASK_STAT tstat;
+ TASK_STAT *p = g_task_stat;
+
+ TASK_RANK ttaskRankData[TASK_STAT_RANK_NUM+1];
+ TASK_RANK t_eva_taskRank;
+ int setRankDatanum = 0;
+ int checkCounter;
+
+ unsigned long dtime; // NOLINT
+ unsigned long dtime_urank;
+ unsigned long dtime_drank;
+ struct timespec tp;
+ unsigned int endTime = 0;
+
+// if (p) {
+// FRAMEWORKUNIFIEDLOG(
+// ZONE_INFO,
+// __FUNCTION__,
+// "[CpuHighLoad]Please check User backtrace of following processes in kernel.log");
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+// "[CpuHighLoad] PID ST PRI POLICY cpuX %%CPU (ut:st) comm");
+// }
+ if (clock_gettime (CLOCK_MONOTONIC, &tp) == 0) {
+ endTime = ((tp.tv_sec * 1000) + (tp.tv_nsec / 1000000)); // Unit is msec
+ } else {
+ endTime = (WTC_CPU_INTERVAL * 1000) + g_startTime;
+ }
+ if (endTime - g_startTime <= 0) { // LCOV_EXCL_BR_LINE 200: (endTime - g_startTime) must be bigger than 0
+ // LCOV_EXCL_START 200: (endTime - g_startTime) must be bigger than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG (ZONE_WARN, __FUNCTION__, "[CpuHighLoad] Timer abnormality.");
+ endTime = g_startTime + 1;
+ // LCOV_EXCL_STOP
+ }
+
+ while (p) {
+ ret = get_task_stat(p->path, &tstat);
+ if (ret >= 0) {
+
+#if 0
+ dtime = (tstat.utime + tstat.stime) - (p->utime + p->stime);
+ if (dtime > 0) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "[CpuHighLoad]%5d %c %3d %5s cpu%d %4lu (%lu:%lu) %s",
+ p->pid_nr_ns,
+ p->state,
+ p->priority,
+ p->task_policy == SCHED_FIFO ? "FIFO" :
+ p->task_policy == SCHED_RR ? "RR" : "OTHER",
+ p->task_cpu, dtime, tstat.utime - p->utime, tstat.stime - p->stime,
+ p->tcomm);
+ if ((dtime >= 70) // %%CPU 70% over only
+ && (getpid() != p->pid_nr_ns) // except current process
+ && (strcmp(p->tcomm, "(NS_BackupMgr)"))) { // except "BackupMgr"
+// print_backtrace_pid (p->pid_nr_ns); // backtrace in kernel.log
+ }
+ }
+ }
+ p = p->next;
+ }
+#endif
+ dtime = (((tstat.utime + tstat.stime) - (p->utime + p->stime)) * 1000) / (endTime - g_startTime);
+ if (((tstat.utime + tstat.stime) - (p->utime + p->stime)) > 0) {
+ if (setRankDatanum <= TASK_STAT_RANK_NUM) {
+ ttaskRankData[setRankDatanum].pid_nr_ns = p->pid_nr_ns;
+ ttaskRankData[setRankDatanum].state = p->state;
+ ttaskRankData[setRankDatanum].priority = p->priority;
+ ttaskRankData[setRankDatanum].task_policy = p->task_policy;
+ ttaskRankData[setRankDatanum].task_cpu = p->task_cpu;
+ ttaskRankData[setRankDatanum].taskOccupancy = dtime;
+ ttaskRankData[setRankDatanum].utime = tstat.utime - p->utime;
+ ttaskRankData[setRankDatanum].stime = tstat.stime - p->stime;
+ strcpy(ttaskRankData[setRankDatanum].tcomm, p->tcomm);
+ setRankDatanum++;
+ } else {
+ ttaskRankData[TASK_STAT_RANK_NUM].pid_nr_ns = p->pid_nr_ns;
+ ttaskRankData[TASK_STAT_RANK_NUM].state = p->state;
+ ttaskRankData[TASK_STAT_RANK_NUM].priority = p->priority;
+ ttaskRankData[TASK_STAT_RANK_NUM].task_policy = p->task_policy;
+ ttaskRankData[TASK_STAT_RANK_NUM].task_cpu = p->task_cpu;
+ ttaskRankData[TASK_STAT_RANK_NUM].taskOccupancy = dtime;
+ ttaskRankData[TASK_STAT_RANK_NUM].utime = tstat.utime - p->utime;
+ ttaskRankData[TASK_STAT_RANK_NUM].stime = tstat.stime - p->stime;
+ strcpy(ttaskRankData[TASK_STAT_RANK_NUM].tcomm, p->tcomm);
+ }
+ for (checkCounter = (setRankDatanum - 1); checkCounter > 0; checkCounter--) {
+ dtime_urank = ttaskRankData[checkCounter - 1].utime + ttaskRankData[checkCounter - 1].stime;
+ dtime_drank = ttaskRankData[checkCounter].utime + ttaskRankData[checkCounter].stime;
+ if (dtime_urank < dtime_drank) {
+ t_eva_taskRank.pid_nr_ns = ttaskRankData[checkCounter].pid_nr_ns;
+ t_eva_taskRank.state = ttaskRankData[checkCounter].state;
+ t_eva_taskRank.priority = ttaskRankData[checkCounter].priority;
+ t_eva_taskRank.task_policy = ttaskRankData[checkCounter].task_policy;
+ t_eva_taskRank.task_cpu = ttaskRankData[checkCounter].task_cpu;
+ t_eva_taskRank.taskOccupancy = ttaskRankData[checkCounter].taskOccupancy;
+ t_eva_taskRank.utime = ttaskRankData[checkCounter].utime;
+ t_eva_taskRank.stime = ttaskRankData[checkCounter].stime;
+ strcpy(t_eva_taskRank.tcomm, ttaskRankData[checkCounter].tcomm);
+
+ ttaskRankData[checkCounter].pid_nr_ns = ttaskRankData[checkCounter - 1].pid_nr_ns;
+ ttaskRankData[checkCounter].state = ttaskRankData[checkCounter - 1].state;
+ ttaskRankData[checkCounter].priority = ttaskRankData[checkCounter - 1].priority;
+ ttaskRankData[checkCounter].task_policy = ttaskRankData[checkCounter - 1].task_policy;
+ ttaskRankData[checkCounter].task_cpu = ttaskRankData[checkCounter - 1].task_cpu;
+ ttaskRankData[checkCounter].taskOccupancy = ttaskRankData[checkCounter - 1].taskOccupancy;
+ ttaskRankData[checkCounter].utime = ttaskRankData[checkCounter - 1].utime;
+ ttaskRankData[checkCounter].stime = ttaskRankData[checkCounter - 1].stime;
+ strcpy(ttaskRankData[checkCounter].tcomm, ttaskRankData[checkCounter - 1].tcomm);
+
+ ttaskRankData[checkCounter - 1].pid_nr_ns = t_eva_taskRank.pid_nr_ns;
+ ttaskRankData[checkCounter - 1].state = t_eva_taskRank.state;
+ ttaskRankData[checkCounter - 1].priority = t_eva_taskRank.priority;
+ ttaskRankData[checkCounter - 1].task_policy = t_eva_taskRank.task_policy;
+ ttaskRankData[checkCounter - 1].task_cpu = t_eva_taskRank.task_cpu;
+ ttaskRankData[checkCounter - 1].taskOccupancy = t_eva_taskRank.taskOccupancy;
+ ttaskRankData[checkCounter - 1].utime = t_eva_taskRank.utime;
+ ttaskRankData[checkCounter - 1].stime = t_eva_taskRank.stime;
+ strcpy(ttaskRankData[checkCounter - 1].tcomm, t_eva_taskRank.tcomm);
+ } else {
+ break;
+ }
+ }
+ if ((dtime >= TASK_STAT_THRESHOLD) && // %%CPU over only
+ (getpid() != p->pid_nr_ns) && // except current process
+ (strcmp (p->tcomm, "(NS_BackupMgr)"))) { // except "BackupMgr"
+ if (p->task_policy == SCHED_FIFO) {
+ if ((g_fifo_task_occ < dtime) && (g_fifo_show_timer == 0)) { // first time only
+ g_fifo_task_pid = p->pid_nr_ns;
+ g_fifo_task_occ = dtime;
+ g_fifo_utime = tstat.utime;
+ g_fifo_stime = tstat.stime;
+ strcpy(g_fifo_path,p->path);
+ } else if (g_fifo_task_pid == p->pid_nr_ns) {
+ g_fifo_task_occ = dtime;
+ g_fifo_utime = tstat.utime;
+ g_fifo_stime = tstat.stime;
+ strcpy(g_fifo_path,p->path);
+ }
+ } else {
+ if ((g_tss_task_occ < dtime) && (g_tss_show_timer == 0)) { // first time only
+ g_tss_task_pid = p->pid_nr_ns;
+ g_tss_task_occ = dtime;
+ g_tss_utime = tstat.utime;
+ g_tss_stime = tstat.stime;
+ strcpy(g_tss_path,p->path);
+ } else if (g_tss_task_pid == p->pid_nr_ns) {
+ g_tss_task_occ = dtime;
+ g_tss_utime = tstat.utime;
+ g_tss_stime = tstat.stime;
+ strcpy(g_tss_path,p->path);
+ }
+ }
+ }
+ }
+ }
+ p = p->next;
+ }
+
+ if (setRankDatanum != 0) {
+ FRAMEWORKUNIFIEDLOG (ZONE_WARN, __FUNCTION__, "[CpuHighLoad] PID ST PRI POLICY cpuX %%CPU (%%ut:%%st) comm");
+ for (checkCounter = 0;
+ checkCounter < (setRankDatanum < TASK_STAT_RANK_NUM ? setRankDatanum : TASK_STAT_RANK_NUM); checkCounter++) {
+ FRAMEWORKUNIFIEDLOG (ZONE_WARN, __FUNCTION__, "[CpuHighLoad]%5d %c %3d %5s cpu%d %4lu (%2lu.%03lu:%2lu.%03lu) %s",
+ ttaskRankData[checkCounter].pid_nr_ns,
+ ttaskRankData[checkCounter].state,
+ ttaskRankData[checkCounter].priority,
+ ttaskRankData[checkCounter].task_policy == SCHED_FIFO ? "FIFO"
+ : ttaskRankData[checkCounter].task_policy == SCHED_RR ? "RR" : "TSS",
+ ttaskRankData[checkCounter].task_cpu,
+ ttaskRankData[checkCounter].taskOccupancy,
+ ttaskRankData[checkCounter].utime * 100 / ((endTime - g_startTime)/10),
+ ttaskRankData[checkCounter].utime * 100 % ((endTime - g_startTime)/10),
+ ttaskRankData[checkCounter].stime * 100 / ((endTime - g_startTime)/10),
+ ttaskRankData[checkCounter].stime * 100 % ((endTime - g_startTime)/10),
+ ttaskRankData[checkCounter].tcomm);
+ }
+ FRAMEWORKUNIFIEDLOG (ZONE_WARN, __FUNCTION__, "[CpuHighLoad] -------------------------------------------------");
+ }
+
+}
+
+
+static void
+show_cpuload_onetask(int loadType) {
+ int ret;
+ TASK_STAT tstat;
+ unsigned long dtime;
+ struct timespec tp;
+ unsigned int endTime = 0;
+ char loadPath[64];
+ unsigned long beforeUtime;
+ unsigned long beforeStime;
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) {
+ endTime = ((tp.tv_sec * 1000) + (tp.tv_nsec / 1000000)); // Unit is msec
+ } else {
+ endTime = (WTC_CPU_INTERVAL * 1000) + g_startTime;
+ }
+ if (endTime - g_startTime <= 0) { // LCOV_EXCL_BR_LINE 200: (endTime - g_startTime) must be bigger than 0
+ // LCOV_EXCL_START 200: (endTime - g_startTime) must be bigger than 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG (ZONE_WARN, __FUNCTION__, "[CpuHighLoad] Timer abnormality.");
+ endTime = g_startTime + 1;
+ // LCOV_EXCL_STOP
+ }
+ if (loadType == FIFO_TASK_SHOW) { // LCOV_EXCL_BR_LINE 200: loadType can't be FIFO_TASK_SHOW
+ // LCOV_EXCL_START 200: loadType can't be FIFO_TASK_SHOW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ strcpy(loadPath,g_fifo_path);
+ beforeUtime = g_fifo_utime;
+ beforeStime = g_fifo_stime;
+ // LCOV_EXCL_STOP
+ } else {
+ strcpy(loadPath,g_tss_path);
+ beforeUtime = g_tss_utime;
+ beforeStime = g_tss_stime;
+ }
+ if (strlen(loadPath) > 0) {
+ ret = get_task_stat(loadPath, &tstat);
+ if (ret >= 0) {
+ dtime = (((tstat.utime + tstat.stime) - (beforeUtime + beforeStime)) * 1000) / (endTime - g_startTime);
+ if (tstat.task_policy == SCHED_FIFO) {
+ g_fifo_task_occ = dtime;
+ g_fifo_utime = tstat.utime;
+ g_fifo_stime = tstat.stime;
+ } else {
+ g_tss_task_occ = dtime;
+ g_tss_utime = tstat.utime;
+ g_tss_stime = tstat.stime;
+ }
+ }
+ }
+}
+
+
+
+//void logging_cpuload_custom(void) {
+// struct timespec req = { 1, 0 }; // 1sec
+//
+// cleanup_task_stat();
+// get_current_task_stat();
+//
+// nanosleep(&req, NULL);
+//
+// show_cpuload();
+//}
+unsigned long
+logging_cpuload_custom(int32_t tmode) {
+ int32_t res = 0;
+ if (tmode == CPU_TASK_INIT) {
+ g_fifo_task_pid = -1;
+ g_tss_task_pid = -1;
+ g_fifo_task_occ = 0;
+ g_tss_task_occ = 0;
+ g_fifo_utime = 0;
+ g_fifo_stime = 0;
+ g_tss_utime = 0;
+ g_tss_stime = 0;
+ memset(g_fifo_path, 0x00, sizeof(g_fifo_path));
+ memset(g_tss_path, 0x00, sizeof(g_tss_path));
+ cleanup_task_stat();
+ get_current_task_stat();
+ } else if (tmode == CPU_TASK_SHOW_BF) {
+ cleanup_task_stat();
+ get_current_task_stat();
+ } else if (tmode == CPU_TASK_SHOW_AF) {
+ show_cpuload();
+ } else if (tmode == FIFO_TASK_SHOW) { // LCOV_EXCL_BR_LINE 200: tmode can't be FIFO_TASK_SHOW
+ // LCOV_EXCL_START 200: tmode can't be FIFO_TASK_SHOW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ show_cpuload_onetask(FIFO_TASK_SHOW);
+ // LCOV_EXCL_STOP
+ } else if (tmode == TSS_TASK_SHOW) {
+ show_cpuload_onetask(TSS_TASK_SHOW);
+ } else if (tmode == CPU_FIFO_TASK_GET_ID) {
+ res = g_fifo_task_pid;
+ g_fifo_show_timer = 0;
+ } else if (tmode == CPU_TSS_TASK_GET_ID) {
+ res = g_tss_task_pid;
+ g_tss_show_timer = 0;
+ } else if (tmode == CPU_FIFO_TASK_GET_OCCUPANCY) {
+ g_fifo_show_timer = g_fifo_show_timer + WTC_CPU_INTERVAL;
+ res = g_fifo_task_occ;
+ g_fifo_task_occ = 0;
+ } else if (tmode == CPU_TSS_TASK_GET_OCCUPANCY) { // LCOV_EXCL_BR_LINE 200: tmode can't be other value
+ g_tss_show_timer = g_tss_show_timer + WTC_CPU_INTERVAL;
+ res = g_tss_task_occ;
+ g_tss_task_occ = 0;
+ }
+ return res;
+}
+
diff --git a/video_in_hal/systemservice/resource_manager/server/src/proc_watch.cpp b/video_in_hal/systemservice/resource_manager/server/src/proc_watch.cpp
new file mode 100755
index 0000000..c432af1
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/src/proc_watch.cpp
@@ -0,0 +1,285 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/timerfd.h>
+#include <sys/vfs.h> /* or <sys/statfs.h> */
+#include <dirent.h>
+#include <stdlib.h>
+
+#include <soc_temperature_hal.h>
+
+#include "ss_resm_resourcemanagerlog.h"
+#include "proc_watch.h"
+#include "resm_cfg.h"
+#include "resm_internal.h"
+
+#define WTC_TMPFS_INTERVAL (5)
+#define WTC_MEM_INTERVAL (5)
+#define DEBUG_INFO_OUTPUT_FREQ (1)
+
+extern int isNfs;
+extern void watchMem(void);
+extern void outputResouceInfo(void);
+extern EFrameworkunifiedStatus resourcemanagerlog_flag_check(UI_8 *mode);
+
+#define _SOC_TEMP_MONITOR_
+
+#if defined(_SOC_TEMP_MONITOR_)
+
+/*********************************************************************************
+ * Soc Temperature
+ register THSSR : T = CTEMP[5-0] x 5 - 65 [Celsius]
+ *********************************************************************************/
+#define SOC_TEMP_WATCH_INTVAL_TIMESEC (3 * 60) // 3 minutes
+// #define SOC_TEMP_WATCH_INTVAL_TIMESEC (1 * 5) // for debug
+#define THSSR_TEMP_MASK 0x0000003F
+#define TEMP_120 (120)
+
+static float last_temp;
+
+static void soc_temp_init(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_SOC_TEMP, __FUNCTION__, "start");
+ last_temp = 0.0f;
+}
+
+static void soc_temp(void) {
+ float temp = 0.0f;
+ EFrameworkunifiedStatus e_status = GetSoCTemperature(&temp);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_SOC_TEMP, __FUNCTION__,
+ "THSSR:GetSoCTemperature e_status(%d)", e_status);
+ return;
+ }
+
+ if (TEMP_120 <= temp) {
+ // FRAMEWORKUNIFIEDLOG
+ FRAMEWORKUNIFIEDLOG(ZONE_SOC_TEMP, __FUNCTION__, "%f", temp); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ } else {
+ // FRAMEWORKUNIFIEDLOG
+ if (TEMP_120 <= last_temp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_SOC_TEMP, __FUNCTION__, "%f", temp); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ }
+ }
+ last_temp = temp;
+}
+#endif // defined ( _SOC_TEMP_MONITOR_ )
+
+//
+// Monitor /tmp
+//
+#define TMP_USED_SIZE (100*1024) // 100MB
+#define TMPFS_PATH "/tmp"
+static int watch_tmpfs_enable = 1;
+
+static void printdir(const char* path) {
+ DIR *dirp;
+ struct dirent entry, *next;
+ char buf[512];
+
+ dirp = opendir(path);
+ if (dirp == NULL) { // LCOV_EXCL_BR_LINE 5: opendir's error case.
+ // LCOV_EXCL_START 5: opendir's error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "opendir(%s) error.(%d)\n", path, errno);
+ return;
+ // LCOV_EXCL_STOP 5: opendir's error case.
+ }
+ while ((readdir_r(dirp, &entry, &next) == 0) && next != NULL) {
+ if (((strlen(entry.d_name) == 1) && (strcmp(entry.d_name, ".") == 0))
+ || ((strlen(entry.d_name) == 2) && (strcmp(entry.d_name, "..") == 0))) {
+ continue;
+ }
+ if ((strlen(path) + strlen(entry.d_name) + 2) <= sizeof(buf)) {/* 2: '/','\0' */
+ struct stat stat_buf;
+
+ strcpy(buf, path); // NOLINT
+ strcat(buf, "/"); // NOLINT
+ strcat(buf, entry.d_name); // NOLINT
+ if (stat(buf, &stat_buf) == -1) { // LCOV_EXCL_BR_LINE 5: stat error case
+ // LCOV_EXCL_START 5: stat error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s stat error! (%d)\n", buf, errno);
+ // LCOV_EXCL_STOP 5: stat's error case.
+ } else if (S_ISDIR(stat_buf.st_mode)) {
+ printdir(buf);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s %ld bytes", buf, stat_buf.st_size);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "path(%s) name(%s) length over!\n", path,
+ entry.d_name);
+ }
+ }
+ closedir(dirp);
+
+ return;
+}
+
+static void watchtmpfs(void) {
+ int ret;
+ struct statfs buf;
+ long used; // NOLINT
+
+ if (!watch_tmpfs_enable) {
+ return;
+ }
+ ret = statfs(TMPFS_PATH, &buf);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: statfs error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return; // LCOV_EXCL_LINE 5: statfs error case
+ }
+ used = (buf.f_blocks - buf.f_bavail) * buf.f_bsize / 1024; // KB
+ if (used > TMP_USED_SIZE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s Used %ld KB > %d KB",
+ TMPFS_PATH,
+ used, TMP_USED_SIZE);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "----- print %s start -----", TMPFS_PATH);
+ printdir(TMPFS_PATH);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "----- print %s end -----", TMPFS_PATH);
+ watch_tmpfs_enable = 0;
+ }
+}
+
+/*********************************************************************************
+ * proc_watch thread main
+ *********************************************************************************/
+void *
+PRCW_main(void *p) {
+ fd_set fds;
+ int32_t maxFd = 0;
+ int32_t timerFd;
+ struct itimerspec tm;
+ int32_t sec = 0;
+ EFrameworkunifiedStatus flagRet;
+ uint64_t exp;
+ int ret;
+ UI_8 mode;
+#if defined(_SOC_TEMP_MONITOR_)
+ int32_t timerFd2;
+ struct itimerspec tm2;
+#endif // defined(_SOC_TEMP_MONITOR_)
+
+ /* Memory monitoring and display debug information */
+ timerFd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
+ if (timerFd == -1) { // LCOV_EXCL_BR_LINE 5: timerfd_create error case
+ // LCOV_EXCL_START 5: timerfd_create error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create timerFd Failed. errno[%d]", errno);
+ // LCOV_EXCL_STOP 5: timerfd_create error case
+ } else {
+ tm.it_value.tv_sec = MONITORING_START_DELAT_TIME;
+ tm.it_value.tv_nsec = 0;
+ tm.it_interval.tv_sec = 1;
+ tm.it_interval.tv_nsec = 0;
+ if (timerfd_settime(timerFd, 0, &tm, NULL) == -1) { // LCOV_EXCL_BR_LINE 5: timerfd_create error case
+ // LCOV_EXCL_START 5: timerfd_settime error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Set timerFd Failed. errno[%d]", errno);
+ // LCOV_EXCL_STOP 5: timerfd_settime error case
+ }
+ }
+
+#if defined(_SOC_TEMP_MONITOR_)
+ /* Soc temperature monitoring */
+ timerFd2 = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
+ if (timerFd2 == -1) { // LCOV_EXCL_BR_LINE 5: timerfd_create error case
+ // LCOV_EXCL_START 5: timerfd_create error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create timerFd2 Failed. errno[%d]", errno);
+ // LCOV_EXCL_STOP 5: timerfd_create error case
+ } else {
+ tm2.it_value.tv_sec = 1;
+ tm2.it_value.tv_nsec = 0;
+ tm2.it_interval.tv_sec = SOC_TEMP_WATCH_INTVAL_TIMESEC;
+ tm2.it_interval.tv_nsec = 0;
+ if (timerfd_settime(timerFd2, 0, &tm2, NULL) == -1) { // LCOV_EXCL_BR_LINE 5: timerfd_settime error case
+ // LCOV_EXCL_START 5: timerfd_settime error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Set timerFd2 Failed. errno[%d]", errno);
+ // LCOV_EXCL_STOP 5: timerfd_settime error case
+ }
+ soc_temp_init();
+ }
+#endif // defined(_SOC_TEMP_MONITOR_)
+
+ while (1) {
+ FD_ZERO(&fds);
+ if (timerFd != -1) { // LCOV_EXCL_BR_LINE 5: timerfd_create's error case
+ FD_SET(timerFd, &fds);
+ maxFd = MY_MAX(maxFd, timerFd);
+ }
+#if defined(_SOC_TEMP_MONITOR_)
+ if (timerFd2 != -1) { // LCOV_EXCL_BR_LINE 5: timerfd_create's error case
+ FD_SET(timerFd2, &fds);
+ maxFd = MY_MAX(maxFd, timerFd2);
+ }
+#endif // defined(_SOC_TEMP_MONITOR_)
+
+ ret = select(maxFd + 1, &fds, NULL, NULL, NULL);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: select error case
+ // LCOV_EXCL_START 5: select error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Handle Error");
+ exit(EXIT_FAILURE);
+ }
+ continue;
+ // LCOV_EXCL_STOP 5: select error case
+ }
+
+ if ((timerFd != -1) && FD_ISSET(timerFd, &fds)) {
+ read(timerFd, &exp, sizeof(uint64_t));
+ /* Memory monitoring */
+ if ((sec % WTC_MEM_INTERVAL) == 0) {
+ watchMem();
+ }
+ /* tmpfs monitoring */
+ if (!isNfs && ((sec % WTC_TMPFS_INTERVAL) == 0)) {
+ watchtmpfs();
+ }
+ /* Display debug information */
+ if ((sec % DEBUG_INFO_OUTPUT_FREQ) == 0) {
+ flagRet = resourcemanagerlog_flag_check(&mode);
+ if ((flagRet == eFrameworkunifiedStatusOK) && (mode == FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG)) {
+ outputResouceInfo();
+ }
+ }
+ if (sec >= RESET_SEC) {
+ sec = 0;
+ }
+ sec++;
+ }
+#if defined(_SOC_TEMP_MONITOR_)
+ if ((timerFd2 != -1) && FD_ISSET(timerFd2, &fds)) {
+ read(timerFd2, &exp, sizeof(uint64_t));
+ soc_temp();
+ }
+#endif // defined(_SOC_TEMP_MONITOR_)
+ }
+ return p;
+}
diff --git a/video_in_hal/systemservice/resource_manager/server/src/resm.cpp b/video_in_hal/systemservice/resource_manager/server/src/resm.cpp
new file mode 100755
index 0000000..41caa19
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/src/resm.cpp
@@ -0,0 +1,2667 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <ctype.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdint.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/timerfd.h>
+#include <sys/wait.h>
+#include <sched.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <signal.h>
+
+// NSFW
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_services.h>
+#include <native_service/frameworkunified_application.h>
+#include <system_service/ss_system_if.h>
+#include <system_service/ss_version.h>
+#include <native_service/cl_process.h>
+#include <system_service/ss_system_process.h>
+#include <other_service/rpc.h>
+#include "resmgr_srvr.h"
+#include "resm_internal.h"
+#include "resmgr_api.h"
+#include "ss_resm_resourcemanagerlog.h"
+#include "resm_cfg.h"
+#include "proc_watch.h"
+
+
+// NSFW
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+/**********************************************
+ * Constant definitions
+ **********************************************/
+#define Resm_Flag_ID_Base EV_Flag_ID_Base(RESMGR_MID)
+#define RESM_SUB_PRIORITY (0)
+
+// #define WTC_CPU_INTERVAL (3)
+
+#define CPULOAD_INVALID (-2)
+#define CPULOAD_READY (-1)
+#define CPULOG_TIMER_CLEAR (1)
+#define CPULOG_LOGGING (0)
+#define CPULOG_NO_LOGGING (-1)
+
+#define PROCNET_DEV_FILE "/proc/net/dev"
+#define MEMINFO_FILE "/proc/meminfo"
+#define PROC_STAT_FILE "/proc/stat"
+
+#define BYTE_TO_KIBIBYTE (1024)
+#define KIBIBYTE_TO_BYTE (1024)
+#define PERF_PNAME_MAX 128 // Max path name of process
+#define PERF_PATH "/usr/bin/perf"
+#define PERF_FILE "/tmp/perf"
+#define PERF_DUMP "/tmp/perf_dump"
+#define PERF_REPORT_DELAY 1 // 1 sec
+#define PERF_REPORT_RETRY 3 // retry 3 times
+#define CPULOAD_NICEVAL 10 // value of nice() to lower priority
+
+#define DEBUG_INFO_DIRPATH "/tmp/diag_analysis"
+#define DEBUG_INFO_FPATH DEBUG_INFO_DIRPATH"/dispinfo_resource.dbg"
+#define DEBUG_INFO_TMPPATH DEBUG_INFO_DIRPATH"/dispinfo_resource.tmp"
+#define DEBUG_INFO_MEM_LETTERS (25)
+#define DEBUG_INFO_CPU_TOP_LINES (10)
+#define DEBUG_INFO_CMA_MIN (160000) // in KB
+#define DEBUG_INFO_CMA_LETTERS (20)
+#define DEBUG_INFO_DSP_PG_PATH "/usr/agl/bin/bs_analysis_dispinfo_debug"
+
+#define DROP_CACHES_PG_PATH "/usr/agl/bin/drop_caches"
+
+#define READLINE_MAX_SIZE 512
+#define READ_MAX_SIZE 4096
+#define LF (0x0A)
+
+/**********************************************
+ * Structure definitions
+ **********************************************/
+// App session information
+typedef struct {
+ BOOL useFlag;
+ RESM_REQ_EVENT_t reqEv; // event request
+} SSN_INFO_t;
+
+// CPU usage information
+typedef struct {
+ char cpuname[8];
+ int32_t user;
+ int32_t nice;
+ int32_t system;
+ int32_t idle;
+ int32_t iowait;
+ int32_t irq;
+ int32_t softirq;
+ int32_t steal;
+ int32_t guest;
+ int32_t guest_nice;
+} CPU_INFO_t;
+
+//Context
+typedef struct {
+ char procName[128];
+ HANDLE hApp; // DispatcherHandle
+ int32_t nsFd; // For receiving from the NSFW
+
+ // Session information
+ SSN_INFO_t ssnInfo[EV_MAX_IDS_IN_THREAD];
+
+ // Memory information
+ uint32_t restMem; // Remaining memory information
+ BOOL restMemFlag;
+
+ // CMA information
+ uint32_t restCma;
+ BOOL restCmaFlag;
+
+
+ // CPU load information
+// int32_t cpuloadRate;
+} SVC_COMMON_t;
+
+// meminfo table
+typedef struct {
+ const char* name;
+ uint32_t* value;
+} meminfo_tbl;
+
+/**********************************************
+ * External variable definitions
+ **********************************************/
+// FRAMEWORKUNIFIEDLOG
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+ FRAMEWORKUNIFIEDLOGOPTIONS, {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31
+ }, FRAMEWORKUNIFIEDLOGZONES
+};
+
+int isNfs; // NFS env : 1
+
+static SVC_COMMON_t g_resmgr; // NOLINT (readability/nolint)
+static int32_t g_sock = -1;
+static uint32_t inactFile_kib;
+static uint32_t mainFree_kib;
+static uint32_t memTotal_kib;
+static uint32_t cmaFree_kib;
+static uint32_t cmaTotal_kib;
+static uint32_t minRestMem; // Minimum memory available
+static uint32_t minRestCma; // Minimum CMA available
+static int32_t g_cpuloadRate1000;
+static int g_cpu_num;
+static CPU_INFO_t *g_cpuload_pre;
+static CPU_INFO_t *g_cpuload;
+
+static int32_t g_fifo_status = STATUS_IDOL;
+static int32_t g_tss_status = STATUS_IDOL;
+static int32_t g_fifo_timer = 0;
+static int32_t g_tss_timer = 0;
+
+
+/**********************************************
+ * Local function definition
+ **********************************************/
+static void ctxCreate(SVC_COMMON_t* p_ctx, int32_t argc, char* argv[]);
+
+// Session related
+static int32_t get_new_id(uint32_t* ssnId);
+
+// Memory monitoring
+void watchMem(void);
+static int32_t comp_meminfo_tbl(const void* a, const void* b);
+static int32_t get_meminfo(void);
+
+// Network monitoring
+static int32_t getInetStatus(RESM_INET_STATUS_t* p_iStatus);
+static char* get_aliasName(char* name, char* line);
+static int32_t get_hwaddr(char* name, char* hwaddr);
+
+// CPU monitoring
+
+static void watchCPUStatus(void);
+static void watchCPU(void);
+static int32_t get_cpuload(CPU_INFO_t* p_cpu);
+static int32_t calc_cpuloadRate(void);
+static int32_t calc_cpuloadRate_each(int num);
+
+// static int32_t chk_logging(int32_t cpuload, int32_t timer);
+// static void logging_cpuload(void);
+
+static void trim_end(char* buf);
+
+// static void escape_percent(char* in, char* out);
+static void init_cpuload(void);
+
+// extern void logging_cpuload_custom(void);
+static void exec_perf(int32_t t_pid);
+extern unsigned long logging_cpuload_custom(int32_t tmode);
+
+
+// Debug information output
+void outputResouceInfo(void);
+static int write_meminfo_work(FILE *wfp);
+static int write_cpuinfo_work(FILE *wfp);
+static int write_cmainfo_work(FILE *wfp);
+static int write_resourcemanagerloginfo_work(void);
+
+/*******************************************************************************
+ * RPC public API
+ *******************************************************************************/
+/* Event issuance request */
+RESM_ERR_t RESM_ReqEvent(uint32_t ssnId, const RESM_REQ_EVENT_t* p_reqEvent) {
+ // Argument check
+ if (p_reqEvent == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr ReqEvent Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (ssnId >= EV_MAX_IDS_IN_THREAD) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr ReqEvent Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (!g_resmgr.ssnInfo[ssnId].useFlag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr ReqEvent Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ // Event type check
+ if (p_reqEvent->reqEvent == RESM_EV_MEM) {
+ // Record event issuance request
+ memcpy(&g_resmgr.ssnInfo[ssnId].reqEv, p_reqEvent,
+ sizeof(RESM_REQ_EVENT_t));
+ }
+
+ return RESM_E_OK;
+}
+
+/* Get system status */
+RESM_ERR_t RESM_GetStatus(uint32_t ssnId, RESM_STATUS_t* p_status) {
+ int32_t ret;
+
+ // Argument check
+ if (p_status == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr GetStatus Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (ssnId >= EV_MAX_IDS_IN_THREAD) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr GetStatus Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (!g_resmgr.ssnInfo[ssnId].useFlag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr GetStatus Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (!g_resmgr.restMemFlag) {
+ // No remaining memory information
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr GetStatus get restmem Error"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
+ return RESM_E_NG;
+ }
+ p_status->restMemSize = g_resmgr.restMem;
+ p_status->nandWriteStatus = RESM_NAND_WRITE_ENABLE; //[]Always possible
+
+ ret = getInetStatus(&p_status->inetStatus);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr GetStatus getInetStatus Error");
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/*******************************************************************************
+ * Internal API
+ *******************************************************************************/
+/* Session connection */
+RESM_ERR_t RESM_SV_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnId) {
+ int32_t ret;
+
+ ret = get_new_id(p_ssnId);
+ if (ret != 0) {
+ return RESM_E_NG;
+ }
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ResMgr Open Session:ID=[%d]", *p_ssnId);
+
+ return RESM_E_OK;
+}
+
+/* Session disconnection */
+RESM_ERR_t RESM_SV_Close(uint32_t ssnId) {
+ // Argument check
+ if (ssnId >= EV_MAX_IDS_IN_THREAD) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr Close Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ if (!g_resmgr.ssnInfo[ssnId].useFlag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr Close Invalid Arg");
+ return RESM_E_PAR;
+ }
+
+ // Turn off used flag
+ g_resmgr.ssnInfo[ssnId].useFlag = FALSE;
+
+ // Clear event request
+ memset(&g_resmgr.ssnInfo[ssnId].reqEv, 0, sizeof(RESM_REQ_EVENT_t));
+
+ return RESM_E_OK;
+}
+
+/* Session ID check */
+RESM_ERR_t RESM_SV_ChkSsnId(uint32_t ssnId) {
+ if (ssnId >= EV_MAX_IDS_IN_THREAD) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr ssnId[%d] over MAX", ssnId);
+ return RESM_E_NG;
+ }
+
+ if (!g_resmgr.ssnInfo[ssnId].useFlag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr ssnId[%d] is unidentified",
+ ssnId);
+ return RESM_E_NG;
+ }
+
+ return RESM_E_OK;
+}
+
+/**********************************************
+ * Initialization function
+ **********************************************/
+/* Context Initialization */
+static void ctxCreate(SVC_COMMON_t* p_ctx, int32_t argc, char* argv[]) {
+ EFrameworkunifiedStatus resourcemanagerRet;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cbFuncs);
+ FRAMEWORKUNIFIED_SET_ZONES();
+
+ memset(p_ctx, 0, sizeof(SVC_COMMON_t));
+ strcpy(p_ctx->procName, SS_RESOURCE_MANAGER); // NOLINT
+
+ // Create a Dispatcher
+ resourcemanagerRet = FrameworkunifiedCreateDispatcherWithoutLoop(p_ctx->procName, p_ctx->hApp, argc,
+ argv, &cbFuncs, TRUE);
+ if (resourcemanagerRet != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create Dispatcher Failed. ret[%d]", resourcemanagerRet);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ resourcemanagerRet = FrameworkunifiedGetDispatcherFD(p_ctx->hApp, &p_ctx->nsFd);
+ if (resourcemanagerRet != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Get Dispatcher FD Failed. ret[%d]", resourcemanagerRet);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+ // Initialize session
+ memset(p_ctx->ssnInfo, 0, sizeof(p_ctx->ssnInfo));
+
+
+// // Initialize CPU Information
+// g_resmgr.cpuloadRate = CPULOAD_INVALID;
+
+
+ return;
+}
+
+/**********************************************
+ * Get FRAMEWORKUNIFIEDLOG BasePF Flag
+ **********************************************/
+static EFrameworkunifiedStatus resourcemanagerlog_output_debug_info;
+#define RESOURCEMANAGERLOG_BASEPF_FLAG_ID (11)
+
+EFrameworkunifiedStatus resourcemanagerlog_flag_check(UI_8 *mode) {
+ if (resourcemanagerlog_output_debug_info != eFrameworkunifiedStatusOK)
+ return eFrameworkunifiedStatusFail;
+
+ return NsLogGetFrameworkunifiedLogFlag(RESOURCEMANAGERLOG_BASEPF_FLAG_ID, mode);
+}
+
+/* drop_caches Start update Task */
+static void start_drop_caches(void) {
+ pid_t pid = fork();
+ if (pid == 0) {
+ if (setuid(0) == -1) { // LCOV_EXCL_BR_LINE 5: setuid's error case
+ // LCOV_EXCL_START 5: setuid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to setuid(0)-1, errno=%d", errno);
+ // LCOV_EXCL_STOP
+ } else {
+ struct sched_param param;
+ // Exec drop_caches
+ param.sched_priority = 0;
+ if (sched_setscheduler(getpid(), SCHED_OTHER, &param) < 0) { // LCOV_EXCL_BR_LINE 5: sched_setscheduler's error case
+ // LCOV_EXCL_START 5: sched_setscheduler's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to sched_setscheduler errno=%d",
+ errno);
+ // LCOV_EXCL_STOP
+ } else {
+ execl(DROP_CACHES_PG_PATH, basename(DROP_CACHES_PG_PATH), NULL);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to execl %s errno=%d",
+ DROP_CACHES_PG_PATH,
+ errno);
+ }
+ }
+ exit(1);
+ }
+ if (pid == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork=-1, errno=%d", errno);
+ // LCOV_EXCL_STOP
+ }
+}
+
+/**********************************************
+ * Main Function
+ **********************************************/
+int32_t main(int32_t argc, char* argv[]) {
+ int32_t mainRet = -1;
+ int32_t rpcFd;
+ int32_t timerFd;
+ struct itimerspec tm;
+ int32_t timerFd2;
+ struct itimerspec tm2;
+ uint64_t exp;
+ int32_t maxFd = 0;
+ fd_set fds;
+ struct sched_param prcwParam;
+ pthread_t ptPRCW;
+ int32_t sec = 0;
+ int32_t ret;
+
+ int32_t cpu_ret;
+ bool fork_dsp_task = false;
+ CL_ProcessAttr_t attr;
+ const char *prName;
+ const char *args[iProcess_MAXIMUM_NUMBER_OF_PROCESS_ARGUMENTS];
+ UI_8 mode;
+ EFrameworkunifiedStatus eRet;
+ struct stat statbuf;
+
+ RPC_ID rpcId = RESMGR_RPC_ID;
+ SVC_COMMON_t* p_ctx = &g_resmgr;
+ EFrameworkunifiedStatus resourcemanagerRet = eFrameworkunifiedStatusOK;
+
+ {
+ const char* nfsenv = getenv("AGL_NFS");
+ isNfs = (nfsenv && strcmp(nfsenv, "y") == 0) ? 1 : 0;
+ }
+
+ /* Clear context */
+ ctxCreate(p_ctx, argc, argv);
+
+ /* Start debug information display task */
+ {
+ char *tmp;
+ tmp = getenv("AGL_DEVDIAG_FLAG");
+ if ((tmp == NULL) || strcmp(tmp, "ON")) { // != "ON"
+ resourcemanagerlog_output_debug_info = eFrameworkunifiedStatusFail;
+ } else {
+ resourcemanagerlog_output_debug_info = eFrameworkunifiedStatusOK;
+ }
+ }
+ eRet = resourcemanagerlog_flag_check(&mode);
+ if (eRet == eFrameworkunifiedStatusOK && mode == FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG) {
+ fork_dsp_task = true;
+ }
+ if (fork_dsp_task) {
+ // LCOV_EXCL_START 8: there is no bs_analysis_dispinfo_debug
+ if (0 == stat(DEBUG_INFO_DSP_PG_PATH, &statbuf)) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (0 != CL_ProcessCreateAttrInit(&attr)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_ProcessCreateAttrInit Error"); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ prName = basename(DEBUG_INFO_DSP_PG_PATH);
+ if (0 != CL_ProcessCreateAttrSetName(&attr, prName)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Set Name Error"); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ args[0] = prName;
+ args[1] = NULL;
+ if (CL_ProcessCreate(DEBUG_INFO_DSP_PG_PATH, (char* const *) args, NULL,
+ &attr) < 0) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_ProcessCreate Error"); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+ // LCOV_EXCL_STOP 8: there is no bs_analysis_dispinfo_debug
+ }
+
+ /* Create socket */
+ g_sock = socket(AF_INET, SOCK_DGRAM, 0);
+ if (g_sock < 0) { // LCOV_EXCL_BR_LINE 5: socket error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[RESM_ERR]ResMgr Create Socket Failed"); // LCOV_EXCL_LINE 5: socket error case
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "[%s:%d] ResMgr Wakeup", p_ctx->procName,
+ getpid());
+
+ RPC_START_SERVER(rpcId); // Start RPC Server
+ RPC_get_fd(rpcId, &rpcFd); // Event reception FD of RPC
+
+ /* Create proc_watch thread */
+ ret = pthread_create(&ptPRCW, NULL, &PRCW_main, reinterpret_cast<void*>(NULL));
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: pthread_create error case
+ // LCOV_EXCL_START 5: pthread_create error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create Thread Failed. code[%d]", ret);
+ // LCOV_EXCL_STOP 5: pthread_create error case
+ } else {
+ prcwParam.sched_priority = RESM_SUB_PRIORITY;
+ ret = pthread_setschedparam(ptPRCW, SCHED_OTHER, &prcwParam);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: pthread_setschedparam error case
+ // LCOV_EXCL_START 5: pthread_setschedparam error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Set Thread Schedparam Failed. code[%d]", ret);
+ // LCOV_EXCL_STOP 5: pthread_setschedparam error case
+ }
+ }
+
+ /* Create timer */
+ if ((timerFd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create timerFd Failed. errno[%d]", errno);
+ exit(EXIT_FAILURE);
+ }
+ // for drop_caches
+ {
+ if ((timerFd2 = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Create timerFd2 Failed. errno[%d]", errno);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ // Initialize remaining memory acquisition
+ mainFree_kib = 0;
+ inactFile_kib = 0;
+ memTotal_kib = 0;
+ cmaFree_kib = 0;
+ cmaTotal_kib = 0;
+ get_meminfo();
+ g_resmgr.restMem = mainFree_kib + inactFile_kib;
+ minRestMem = g_resmgr.restMem;
+ g_resmgr.restMemFlag = TRUE;
+ g_resmgr.restCma = cmaFree_kib;
+ minRestCma = g_resmgr.restCma;
+ g_resmgr.restCmaFlag = TRUE;
+
+ tm.it_value.tv_sec = MONITORING_START_DELAT_TIME;
+ tm.it_value.tv_nsec = 0;
+ tm.it_interval.tv_sec = 1;
+ tm.it_interval.tv_nsec = 0;
+ if (timerfd_settime(timerFd, 0, &tm, NULL) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Set timerFd Failed. errno[%d]", errno);
+ exit(EXIT_FAILURE);
+ }
+
+ tm2.it_value.tv_sec = DROP_CACHES_START_DELAT_TIME;
+ tm2.it_value.tv_nsec = 0;
+ tm2.it_interval.tv_sec = 0;
+ tm2.it_interval.tv_nsec = 0;
+ if (timerfd_settime(timerFd2, 0, &tm2, NULL) == -1) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (coverage measurement revision by DeathTest)
+ // LCOV_EXCL_START 11:Gcov constraints (coverage measurement revision by DeathTest)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM_ERR]ResMgr Set timerFd2 Failed. errno[%d]", errno);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_END 11:Gcov constraints (coverage measurement revision by DeathTest)
+ }
+
+ /* API to Publish Service Availability Notification. */
+ resourcemanagerRet = FrameworkunifiedPublishServiceAvailability(p_ctx->hApp, TRUE);
+ if (eFrameworkunifiedStatusOK != resourcemanagerRet) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to Publish Service Availability Notification:0x%x", resourcemanagerRet);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+
+
+ /* CPU Load init */
+ g_fifo_status = STATUS_CHECK_CPU;
+ g_tss_status = STATUS_CHECK_CPU;
+ g_cpuloadRate1000 = 0;
+ init_cpuload();
+ cpu_ret = get_cpuload(g_cpuload);
+ if ( cpu_ret != 0 ) { // LCOV_EXCL_BR_LINE 200: cpu_ret must be 0
+ // LCOV_EXCL_START 200: cpu_ret must be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "Get cpuload Failed");
+ g_cpuloadRate1000 = 0;
+ // LCOV_EXCL_STOP
+ }
+
+
+ while (1) {
+ FD_ZERO(&fds);
+ FD_SET(rpcFd, &fds);
+ maxFd = MY_MAX(maxFd, rpcFd);
+
+ FD_SET(p_ctx->nsFd, &fds);
+ maxFd = MY_MAX(maxFd, p_ctx->nsFd);
+
+ FD_SET(timerFd, &fds);
+ maxFd = MY_MAX(maxFd, timerFd);
+
+ if (timerFd2 != -1) {
+ FD_SET(timerFd2, &fds);
+ maxFd = MY_MAX(maxFd, timerFd2);
+ }
+ ret = select(maxFd + 1, &fds, NULL, NULL, NULL);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: select error case
+ // LCOV_EXCL_START 5: select error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "[RESM_ERR]ResMgr Handle Error");
+ exit(EXIT_FAILURE);
+ }
+ continue;
+ // LCOV_EXCL_STOP 5: select error case
+ }
+ /* API CALL from RPC */
+ if ((timerFd2 != -1) && FD_ISSET(timerFd2, &fds)) {
+ start_drop_caches();
+ timerFd2 = -1;
+ }
+
+ /* API CALL from RPC */
+ if (FD_ISSET(rpcFd, &fds)) {
+ RPC_process_API_request(rpcId);
+ }
+ /* Events from the NSFW */
+ if (FD_ISSET(p_ctx->nsFd, &fds)) {
+ FrameworkunifiedDispatchProcessWithoutLoop(p_ctx->hApp);
+ }
+
+ /* Timer expiration */
+ if (FD_ISSET(timerFd, &fds)) {
+ read(timerFd, &exp, sizeof(uint64_t));
+ /* CPU load monitoring */
+ if ((sec % WTC_CPU_INTERVAL) == 0) {
+ watchCPUStatus();
+ }
+
+ if (sec >= RESET_SEC) {
+ sec = 0;
+ }
+ sec++;
+ }
+ }
+
+ // Close socket
+ close(g_sock);
+
+ mainRet = 0;
+ RPC_end(rpcId);
+
+ return mainRet;
+}
+
+/*********************************************************************************
+ * Session Related
+ *********************************************************************************/
+/* Numbering session ID */
+static int32_t get_new_id(uint32_t* ssnId) {
+ int32_t i;
+ SSN_INFO_t* p_ssnInfo;
+
+ for (i = 0; i < EV_MAX_IDS_IN_THREAD; i++) {
+ p_ssnInfo = &g_resmgr.ssnInfo[i];
+
+ if (p_ssnInfo->useFlag) {
+ // in-use
+ continue;
+ }
+ *ssnId = i;
+ p_ssnInfo->useFlag = TRUE;
+
+ return 0;
+ }
+
+ return -1;
+}
+
+/*********************************************************************************
+ * Memory monitoring
+ *********************************************************************************/
+/* Memory monitoring */
+void watchMem(void) {
+ uint32_t restMem_b;
+ SSN_INFO_t* p_ssnInfo;
+ uint32_t ssnId;
+ int32_t i;
+ int32_t ret;
+
+ // Get remaining memory
+ mainFree_kib = 0;
+ inactFile_kib = 0;
+ memTotal_kib = 0;
+ cmaFree_kib = 0;
+ cmaTotal_kib = 0;
+ g_resmgr.restMemFlag = FALSE;
+ g_resmgr.restCmaFlag = FALSE;
+ ret = get_meminfo();
+ // KiB -> Byte
+ // [Note] Unit of the value gotten by the meminfo is KiB
+ restMem_b = (mainFree_kib + inactFile_kib) * KIBIBYTE_TO_BYTE;
+
+ if (ret != 0) {
+ // Failed to get remaining memory info
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr get_meminfo Failed");
+ return;
+ }
+ g_resmgr.restMem = mainFree_kib + inactFile_kib;
+ g_resmgr.restMemFlag = TRUE;
+ g_resmgr.restCma = cmaFree_kib;
+ g_resmgr.restCmaFlag = TRUE;
+
+ if (g_resmgr.restMem < minRestMem) {
+ // Update minimum available memory
+ minRestMem = g_resmgr.restMem;
+ }
+ if (g_resmgr.restCma < minRestCma) {
+ // Update minimum available CMA
+ minRestCma = g_resmgr.restCma;
+ }
+
+ for (i = 0; i < RESM_INET_IF_MAX; i++) {
+ p_ssnInfo = &g_resmgr.ssnInfo[i];
+ if (!p_ssnInfo->useFlag) {
+ // Unused sessions
+ continue;
+ }
+ ssnId = i;
+
+ // Check event type
+ if (p_ssnInfo->reqEv.reqEvent != RESM_EV_MEM) {
+ // Other than memory monitoring
+ continue;
+ }
+ // Check free memory
+ if (p_ssnInfo->reqEv.prm.restMemThresh > restMem_b) {
+ // Issue event
+ ret = EV_set_flag(Resm_Flag_ID_Base + ssnId, RESM_EV_MEM);
+ if (ret != EV_OK) { // LCOV_EXCL_BR_LINE 200: EV_set_flag will not return ng
+ // LCOV_EXCL_START 200: EV_set_flag will not return ng
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr EV_set_flag Failed. ssnId[%d]", ssnId);
+ // LCOV_EXCL_STOP 200: EV_set_flag will not return ng
+ }
+ }
+ }
+
+ return;
+}
+
+void FlushMemInfo(void) {
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_INFO,
+ __FUNCTION__,
+ "MEMORY Info(KB):<PEAK>REST(%d) [Memtotal(%d)] / CMA Info(KB):<PEAK>REST(%d) [CMAtotal(%d)]",
+ minRestMem, memTotal_kib, minRestCma, cmaTotal_kib);
+}
+
+/* Compare memory information */
+static int32_t comp_meminfo_tbl(const void* data1, const void* data2) {
+ return strcmp(((const meminfo_tbl*) data1)->name,
+ ((const meminfo_tbl*) data2)->name);
+}
+
+/* Get memory information */
+static int32_t get_meminfo(void) {
+ int32_t meminfo_fd = -1;
+ char srch_name[16];
+ char buf[2048];
+ meminfo_tbl target = { srch_name, NULL };
+ meminfo_tbl* found;
+ char* head;
+ char* tail;
+ int32_t read_byte;
+ /* Strings must be in ascending order when adding entries to this table (for bsearch) */
+ static const meminfo_tbl mem_table[] = {
+ { "CmaFree", &cmaFree_kib },
+ { "CmaTotal", &cmaTotal_kib },
+ { "Inactive(file)", &inactFile_kib },
+ { "MemFree", &mainFree_kib },
+ { "MemTotal", &memTotal_kib },
+ };
+ const int32_t mem_table_count = sizeof(mem_table) / sizeof(meminfo_tbl);
+
+ if (meminfo_fd == -1) {
+ meminfo_fd = open(MEMINFO_FILE, O_RDONLY);
+ if (meminfo_fd == -1) {
+ fflush(NULL);
+ return -1;
+ }
+ }
+
+ lseek(meminfo_fd, 0L, SEEK_SET);
+ read_byte = read(meminfo_fd, buf, sizeof buf - 1);
+ if (read_byte < 0) { // LCOV_EXCL_BR_LINE 200: if file exist, it will not be -1
+ // LCOV_EXCL_START 200: if file exist, it will not be -1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fflush(NULL);
+ close(meminfo_fd);
+ return -1;
+ // LCOV_EXCL_STOP 200: if file exis, it will not be -1
+ }
+ buf[read_byte] = '\0';
+
+ head = buf;
+ while (1) {
+ tail = strchr(head, ':');
+ if (!tail) {
+ break;
+ }
+
+ *tail = '\0';
+ if (strlen(head) >= sizeof(srch_name)) {
+ head = tail + 1;
+ } else {
+ strcpy(srch_name, head); // NOLINT
+ found = reinterpret_cast<meminfo_tbl *>(bsearch(&target, mem_table, mem_table_count,
+ sizeof(meminfo_tbl), comp_meminfo_tbl));
+ head = tail + 1;
+ if (found) {
+ *(found->value) = strtoul(head, &tail, 10);
+ }
+ }
+ tail = strchr(head, '\n');
+ if (!tail)
+ break;
+ head = tail + 1;
+ }
+ close(meminfo_fd);
+
+ return 0;
+}
+
+/*********************************************************************************
+ * Network monitoring
+ *********************************************************************************/
+/* Get system information */
+static int32_t getInetStatus(RESM_INET_STATUS_t* p_iStatus) {
+ FILE* fh;
+ char buf[READLINE_MAX_SIZE];
+ char* tmp;
+ char name[IFNAMSIZ];
+ char hwaddr[HWADDR_LEN];
+ uint32_t rx_b;
+ uint32_t rx_pckt;
+ uint32_t rx_err;
+ uint32_t rx_drp;
+ uint32_t rx_fifo;
+ uint32_t rx_frm;
+ uint32_t rx_mlt;
+ uint32_t tx_b;
+ uint32_t tx_pckt;
+ uint32_t tx_err;
+ uint32_t tx_drp;
+ uint32_t tx_fifo;
+ uint32_t tx_cll;
+ uint32_t tx_crr;
+ int32_t ret;
+
+ // Open file
+ fh = fopen(PROCNET_DEV_FILE, "r");
+ if (fh == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr getInetStatus() File Open Error. errno[%d]", errno);
+ return -1;
+ }
+
+ // Initialize interface count
+ p_iStatus->ifNum = 0;
+
+ while (fgets(buf, sizeof(buf), fh)) {
+ // Get Alias name
+ tmp = get_aliasName(name, buf);
+ if (tmp == NULL) {
+ // No alias name
+ continue;
+ }
+ // Get amount of receive/transmit data
+ ret = sscanf(tmp, "%u%u%u%u%u%u%u%*u%u%u%u%u%u%u%u", &rx_b, &rx_pckt,
+ &rx_err, &rx_drp, &rx_fifo, &rx_frm, &rx_mlt, &tx_b, &tx_pckt,
+ &tx_err, &tx_drp, &tx_fifo, &tx_cll, &tx_crr);
+ if (ret != 14) { // LCOV_EXCL_BR_LINE 200: ret is always 14
+ // LCOV_EXCL_START 200: ret is always 14
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr getInetStatus() GET Rx and Tx size Failed");
+ continue;
+ // LCOV_EXCL_STOP 200: ret is always 14
+ }
+ // Get hardware address
+ ret = get_hwaddr(name, hwaddr);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: get_hwaddr will not return !0
+ // LCOV_EXCL_START 5: get_hwaddr will not return !0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr getInetStatus() GET hwaddr Failed");
+ continue;
+ // LCOV_EXCL_STOP 5: get_hwaddr will not return !0
+ }
+
+ // Set values in the system information structure
+ strcpy(p_iStatus->ifInfo[p_iStatus->ifNum].name, name); // NOLINT
+ p_iStatus->ifInfo[p_iStatus->ifNum].rxSize = rx_b / BYTE_TO_KIBIBYTE;
+ p_iStatus->ifInfo[p_iStatus->ifNum].txSize = tx_b / BYTE_TO_KIBIBYTE;
+ memcpy(p_iStatus->ifInfo[p_iStatus->ifNum].hwaddr, hwaddr, HWADDR_LEN);
+
+ p_iStatus->ifNum++;
+
+ if (p_iStatus->ifNum >= RESM_INET_IF_MAX) {
+ break;
+ }
+ }
+
+ // Termination processing
+ fclose(fh);
+
+ if (p_iStatus->ifNum == 0) {
+ return -1;
+ }
+ return 0;
+}
+
+/* Get Alias name */
+static char *get_aliasName(char* name, char* line) {
+ char* dot;
+ char* dotname;
+
+ while (isspace(*line)) {
+ line++;
+ }
+ while (*line) {
+ if (isspace(*line)) {
+ *name++ = '\0';
+ return NULL;
+ }
+
+ if (*line == ':') {
+ dot = line, dotname = name;
+ *name++ = *line++;
+
+ while (isdigit(*line)) {
+ *name++ = *line++;
+ }
+ if (*line != ':') {
+ line = dot;
+ name = dotname;
+ }
+ if (*line == '\0') {
+ return NULL;
+ }
+ line++;
+ break;
+ }
+ *name++ = *line++;
+ }
+ *name++ = '\0';
+
+ return line;
+}
+
+/* Get hardware address */
+static int32_t get_hwaddr(char* name, char* hwaddr) {
+ struct ifreq ifr;
+ int32_t ret;
+
+ if (g_sock < 0) { // LCOV_EXCL_BR_LINE 6: g_sock is not -1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 6: g_sock is not -1
+ }
+ // Initialization
+ memset(&ifr, 0, sizeof(ifr));
+
+ // Set alias name
+ strncpy(ifr.ifr_name, name, (sizeof(ifr.ifr_name) - 1));
+
+ // Get hardware address
+ ret = ioctl(g_sock, SIOCGIFHWADDR, &ifr);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: ioctl error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1; // LCOV_EXCL_LINE 5: ioctl error case
+ }
+ memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, HWADDR_LEN);
+
+ return 0;
+}
+
+/*********************************************************************************
+ * CPU monitoring
+ *********************************************************************************/
+// // CPU monitoring
+// static void watchCPU() {
+// Main processing of CPU monitoring
+static void watchCPUStatus() {
+ unsigned long fifo_task_occ = 0;
+ unsigned long tss_task_occ = 0;
+ int32_t fifo_status = g_fifo_status;
+ int32_t tss_status = g_tss_status;
+ int32_t cpu_load_status = CPU_TASK_INIT;
+
+// int32_t ret;
+// static int32_t cpuLogTimer = 0;
+ if ((g_fifo_status == STATUS_CHECK_CPU) || (g_tss_status == STATUS_CHECK_CPU)) {
+ watchCPU();
+
+// if (cpuLogTimer > 0) { // LCOV_EXCL_BR_LINE 6:Because the condition cannot be set
+// // Make to progress the timer
+// cpuLogTimer -= WTC_CPU_INTERVAL; // LCOV_EXCL_LINE 6:Because the condition cannot be set
+// }
+ if (g_cpuloadRate1000 >= CPU_LOAD_THRESHOLD) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CPU TOTAL:(%d.%d%%)",g_cpuloadRate1000/10, g_cpuloadRate1000%10);
+ int i;
+ int32_t cpuloadRate1000;
+ for (i = 1; i < g_cpu_num; i++) {
+ char buf[16];
+ cpuloadRate1000 = calc_cpuloadRate_each(i);
+ sprintf (buf, "%s(%d.%d%%) ", g_cpuload[i].cpuname, cpuloadRate1000/10, cpuloadRate1000%10);
+ FRAMEWORKUNIFIEDLOG (ZONE_INFO, __FUNCTION__, "%s", buf);
+ }
+ if (g_fifo_status == STATUS_CHECK_CPU) { // LCOV_EXCL_BR_LINE 6: g_fifo_status must be STATUS_CHECK_CPU
+ fifo_status = STATUS_WATCH_PROCESS;
+ g_fifo_timer = 0;
+ }
+ if (g_tss_status == STATUS_CHECK_CPU) { // LCOV_EXCL_BR_LINE 6: g_tss_status must be STATUS_CHECK_CPU
+ tss_status = STATUS_WATCH_PROCESS;
+ g_tss_timer = 0;
+ }
+ if ((g_fifo_status != STATUS_WATCH_PROCESS ) && ( g_tss_status != STATUS_WATCH_PROCESS)) { // LCOV_EXCL_BR_LINE 6: g_fifo_status must be STATUS_CHECK_CPU and g_tss_status must be STATUS_CHECK_CPU // NOLINT[whitespace/line_length]
+ logging_cpuload_custom(CPU_TASK_INIT);
+ }
+ }
+ }
+
+#if 0
+ // Get CPU usage
+ if (g_resmgr.cpuloadRate == CPULOAD_INVALID) {
+ // First time
+ init_cpuload();
+ ret = get_cpuload(g_cpuload);
+ if (ret == 0) { // LCOV_EXCL_BR_LINE 5: get_cpuload will not return -1
+ g_resmgr.cpuloadRate = CPULOAD_READY;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "watchCPU() Get cpuload Failed"); // LCOV_EXCL_LINE 5: get_cpuload will not return -1 // NOLINT[whitespace/line_length]
+ }
+#endif
+ if ((g_fifo_status == STATUS_WATCH_PROCESS) || (g_tss_status == STATUS_WATCH_PROCESS)) {
+ if (g_fifo_status == STATUS_WATCH_PROCESS) {
+ g_fifo_timer = g_fifo_timer + WTC_CPU_INTERVAL;
+ if ((g_fifo_timer == WTC_CPU_INTERVAL) || (g_fifo_timer >= FIFO_TIMER_LIMIT)) { // LCOV_EXCL_BR_LINE 200: g_fifo_timer must be bigger than WTC_CPU_INTERVAL/FIFO_TIMER_LIMIT // NOLINT[whitespace/line_length]
+ cpu_load_status = CPU_TASK_SHOW_AF;
+ } else {
+ // LCOV_EXCL_START 200: g_fifo_timer must be bigger than WTC_CPU_INTERVAL/FIFO_TIMER_LIMIT
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ logging_cpuload_custom(FIFO_TASK_SHOW);
+ // LCOV_EXCL_STOP
+ }
+ }
+#if 0
+ return;
+ } else {
+ memcpy(g_cpuload_pre, g_cpuload, sizeof(*g_cpuload_pre)*g_cpu_num);
+ ret = get_cpuload(g_cpuload);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: get_cpuload will not return -1
+ // LCOV_EXCL_START 5: get_cpuload will not return -1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "watchCPU() Get cpuload Failed");
+ return;
+ // LCOV_EXCL_STOP 5: get_cpuload will not return -1
+#endif
+ if (g_tss_status == STATUS_WATCH_PROCESS) {
+ g_tss_timer = g_tss_timer + WTC_CPU_INTERVAL;
+ if ((g_tss_timer == WTC_CPU_INTERVAL) || (g_tss_timer >= TSS_TIMER_LIMIT)) {
+ cpu_load_status = CPU_TASK_SHOW_AF;
+ } else {
+ logging_cpuload_custom(TSS_TASK_SHOW);
+ }
+ }
+#if 0
+ }
+ // Calculate CPU usage (Notes! Return as a thousandth rate(10 times of %)
+ g_cpuloadRate1000 = calc_cpuloadRate();
+ g_resmgr.cpuloadRate = g_cpuloadRate1000 / 10;
+
+ ret = chk_logging(g_resmgr.cpuloadRate, cpuLogTimer);
+ if (ret == CPULOG_LOGGING) {
+ // Logging
+#endif
+ if (cpu_load_status == CPU_TASK_SHOW_AF) {
+#if 0
+ int i;
+ int32_t cpuloadRate1000;
+ char *cpunames = (char *) malloc( // NOLINT
+ sizeof("[CpuHighLoad]") + (sizeof("cpuXX(xxx%) ") * g_cpu_num));
+ cpuloadRate1000 = calc_cpuloadRate();
+ sprintf(cpunames, "[CpuHighLoad]%s(%d%%) ", g_cpuload[0].cpuname, cpuloadRate1000/10); // NOLINT
+ for (i = 1; i < g_cpu_num; i++) {
+ char buf[16];
+ cpuloadRate1000 = calc_cpuloadRate_each(i);
+ sprintf(buf, "%s(%d%%) ", g_cpuload[i].cpuname, cpuloadRate1000 / 10); // NOLINT
+ strcat(cpunames, buf); // NOLINT
+ }
+ free(cpunames);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", cpunames);
+ }
+#endif
+ logging_cpuload_custom(cpu_load_status);
+ }
+ if (g_fifo_status == STATUS_WATCH_PROCESS) {
+ fifo_task_occ = logging_cpuload_custom(CPU_FIFO_TASK_GET_OCCUPANCY);
+ if ((fifo_task_occ >= TASK_STAT_THRESHOLD) && (g_fifo_timer >= FIFO_TIMER_LIMIT)) {
+ fifo_status = STATUS_IDOL;
+ g_fifo_timer = 0;
+ exec_perf(logging_cpuload_custom(CPU_FIFO_TASK_GET_ID));
+ } else if (fifo_task_occ < TASK_STAT_THRESHOLD) {
+ fifo_status = STATUS_CHECK_CPU;
+ g_fifo_timer = 0;
+ logging_cpuload_custom(CPU_FIFO_TASK_GET_ID);
+ }
+ }
+ if (g_tss_status == STATUS_WATCH_PROCESS) {
+ tss_task_occ = logging_cpuload_custom(CPU_TSS_TASK_GET_OCCUPANCY);
+ if ((tss_task_occ >= TASK_STAT_THRESHOLD) && (g_tss_timer >= TSS_TIMER_LIMIT)) {
+ tss_status = STATUS_IDOL;
+ g_tss_timer = 0;
+ exec_perf(logging_cpuload_custom(CPU_TSS_TASK_GET_ID));
+ } else if(tss_task_occ < TASK_STAT_THRESHOLD) {
+ tss_status = STATUS_CHECK_CPU;
+ g_tss_timer = 0;
+ logging_cpuload_custom(CPU_TSS_TASK_GET_ID);
+ }
+ }
+#if 0
+ logging_cpuload_custom();
+ logging_cpuload();
+ // Set timer
+ cpuLogTimer = CPU_HIGH_LOAD_LOG_FREQ;
+ } else if (ret == CPULOG_TIMER_CLEAR) {
+ // Clear Timer
+ cpuLogTimer = 0;
+ }
+
+ return;
+#endif
+ logging_cpuload_custom(CPU_TASK_SHOW_BF);
+ }
+ if ((g_fifo_status == STATUS_IDOL) || (g_tss_status == STATUS_IDOL)) {
+ if (g_fifo_status == STATUS_IDOL) {
+ g_fifo_timer = g_fifo_timer + WTC_CPU_INTERVAL;
+ if (g_fifo_timer >= CPU_HIGH_LOAD_LOG_FREQ) {
+ fifo_status = STATUS_CHECK_CPU;
+ g_fifo_timer = 0;
+ }
+ }
+ if (g_tss_status == STATUS_IDOL) {
+ g_tss_timer = g_tss_timer + WTC_CPU_INTERVAL;
+ if (g_tss_timer >= CPU_HIGH_LOAD_LOG_FREQ) {
+ tss_status = STATUS_CHECK_CPU;
+ g_tss_timer = 0;
+ }
+ }
+ }
+ g_fifo_status = fifo_status;
+ g_tss_status = tss_status;
+
+ return;
+}
+
+
+
+// CPU monitoring
+static void
+watchCPU() {
+ int32_t ret;
+
+ memcpy(g_cpuload_pre, g_cpuload, sizeof(*g_cpuload_pre)*g_cpu_num);
+ ret = get_cpuload(g_cpuload);
+ if ( ret != 0 ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "watchCPU() Get cpuload Failed");
+ g_cpuloadRate1000 = 0;
+ } else {
+ // Calculate CPU usage (Notes! Return as a thousandth rate(10 times of percentage)
+ g_cpuloadRate1000 = calc_cpuloadRate();
+ }
+
+ return;
+}
+
+
+static void init_cpuload(void) {
+ int fd;
+ char buf[READ_MAX_SIZE];
+ int32_t ret;
+ CPU_INFO_t p_cpu;
+ ssize_t rsize;
+ char *p, *ep;
+ struct timespec req = { 0, 1000000 }; // 1msec
+
+ g_cpu_num = 0;
+ g_cpuload_pre = NULL;
+
+ fd = open(PROC_STAT_FILE, O_RDONLY);
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: open error case
+ // LCOV_EXCL_START 5: open error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr File Open Error. errno[%d]",
+ errno);
+ return;
+ // LCOV_EXCL_STOP 5: open error case
+ }
+ rsize = read(fd, buf, sizeof(buf));
+ if (rsize == -1) { // LCOV_EXCL_BR_LINE 5: read error case
+ // LCOV_EXCL_START 5: read error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr File Read Error. errno[%d]",
+ errno);
+ close(fd);
+ return;
+ // LCOV_EXCL_STOP 5: read error case
+ }
+ nanosleep(&req, NULL);
+ p = buf;
+ ep = buf + rsize;
+ while (p < ep) {
+ if (strncmp(p, "cpu", 3) == 0) {
+ ret = sscanf(p, "%8s %d %d %d %d %d %d %d %d %d %d", &p_cpu.cpuname[0],
+ &p_cpu.user, &p_cpu.nice, &p_cpu.system, &p_cpu.idle,
+ &p_cpu.iowait, &p_cpu.irq, &p_cpu.softirq, &p_cpu.steal,
+ &p_cpu.guest, &p_cpu.guest_nice);
+ if (ret < 11) { // LCOV_EXCL_BR_LINE 200: ret will always 11
+ // LCOV_EXCL_START 200: ret will always 11
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr get_cpuload() File Read Error");
+ close(fd);
+ return;
+ // LCOV_EXCL_STOP 200: ret will always 11
+ }
+ g_cpu_num++;
+ while (++p < ep) {
+ if (*p == LF) {
+ p++;
+ break;
+ }
+ }
+ } else {
+ break;
+ }
+ }
+ close(fd);
+
+ g_cpuload_pre = reinterpret_cast<CPU_INFO_t *>(malloc(sizeof(CPU_INFO_t) * g_cpu_num));
+ g_cpuload = reinterpret_cast<CPU_INFO_t *>(malloc(sizeof(CPU_INFO_t) * g_cpu_num));
+ if ((g_cpuload_pre == NULL) || (g_cpuload == NULL)) { // LCOV_EXCL_BR_LINE 5: malloc error case
+ // LCOV_EXCL_START 5: malloc error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr malloc Error. g_cpu_num[%d] errno[%d]", g_cpu_num, errno);
+ return;
+ // LCOV_EXCL_STOP 5: malloc error case
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr cpu_num:%d", g_cpu_num);
+
+ return;
+}
+
+// Get CPU usage
+static int32_t get_cpuload(CPU_INFO_t* p_cpu) {
+ int fd;
+ char buf[READ_MAX_SIZE];
+ int32_t ret;
+ int i = 0;
+ ssize_t rsize;
+ char *p, *ep;
+ struct timespec req = { 0, 1000000 }; // 1msec
+
+ // Open file
+ fd = open(PROC_STAT_FILE, O_RDONLY);
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: open's error case
+ // LCOV_EXCL_START 5: open's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr get_cpuload() File Open Error. errno[%d]", errno);
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+ rsize = read(fd, buf, sizeof(buf));
+ if (rsize == -1) { // LCOV_EXCL_BR_LINE 5: read error case
+ // LCOV_EXCL_START 5: read error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr File Read Error. errno[%d]",
+ errno);
+ close(fd);
+ return -1;
+ // LCOV_EXCL_STOP 5: read error case
+ }
+ nanosleep(&req, NULL);
+ p = buf;
+ ep = buf + rsize;
+ while (p < ep) {
+ if (strncmp(p, "cpu", 3) == 0) {
+ ret = sscanf(p, "%8s %d %d %d %d %d %d %d %d %d %d", &p_cpu[i].cpuname[0],
+ &p_cpu[i].user, &p_cpu[i].nice, &p_cpu[i].system,
+ &p_cpu[i].idle, &p_cpu[i].iowait, &p_cpu[i].irq,
+ &p_cpu[i].softirq, &p_cpu[i].steal, &p_cpu[i].guest,
+ &p_cpu[i].guest_nice);
+ if (ret < 11) { // LCOV_EXCL_BR_LINE 200: ret will always 11
+ // LCOV_EXCL_START 200: ret will always 11
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr get_cpuload() File Read Error");
+ close(fd);
+ return -1;
+ // LCOV_EXCL_STOP 200: ret will always 11
+ }
+ i++;
+ while (++p < ep) {
+ if (*p == LF) {
+ p++;
+ break;
+ }
+ }
+ } else {
+ break;
+ }
+ }
+ close(fd);
+
+ return 0;
+}
+
+// Calcurate CPU usage
+static int32_t calc_cpuloadRate(void) {
+ int val;
+ int val_others;
+ int total;
+ int rate;
+ CPU_INFO_t* info;
+ CPU_INFO_t* info_pre;
+
+ info = &g_cpuload[0];
+ info_pre = &g_cpuload_pre[0];
+
+ val = (info->user - info_pre->user)
+ + (info->system - info_pre->system)
+ + (info->irq - info_pre->irq)
+ + (info->softirq - info_pre->softirq);
+
+ val_others = (info->idle - info_pre->idle)
+ + (info->iowait - info_pre->iowait);
+
+ total = val + val_others;
+ rate = (total > 0) ? (val*1000 / total) : 0;
+
+ return rate;
+}
+
+// Calcurate CPU usage for each CPU
+static int32_t calc_cpuloadRate_each(int num) {
+ int val, valn;
+ int rate;
+ CPU_INFO_t* info;
+ CPU_INFO_t* info_pre;
+
+ // cpu
+ info = &g_cpuload[0];
+ info_pre = &g_cpuload_pre[0];
+ val = (info->user - info_pre->user)
+ + (info->system - info_pre->system)
+ + (info->irq - info_pre->irq)
+ + (info->softirq - info_pre->softirq);
+
+ // cpu-num
+ info = &g_cpuload[num];
+ info_pre = &g_cpuload_pre[num];
+ valn = (info->user - info_pre->user)
+ + (info->system - info_pre->system)
+ + (info->softirq - info_pre->softirq);
+
+ rate = valn * 1000 / val;
+ return rate;
+}
+
+
+//// Logging check at CPU overload
+//static int32_t chk_logging(int32_t cpuload, int32_t timer) {
+// if (cpuload >= CPU_LOAD_THRESHOLD) {
+// if (timer > 0) {
+// return CPULOG_NO_LOGGING;
+// }
+// return CPULOG_LOGGING;
+// }
+//
+// return CPULOG_TIMER_CLEAR;
+//}
+
+
+// Check if cmd to perf
+ // LCOV_EXCL_START 8: dead code
+bool valid_perf_cmd(char *buf) { // LCOV_EXCL_BR_LINE 8: dead code
+ const char *cmd2exclude[] = { "top", "init", "bash", NULL };
+ char cmdstr[64];
+
+ for (int i = 0;; i++) {
+ if (cmd2exclude[i] == NULL) {
+ break;
+ }
+ sprintf(cmdstr, " %s ", cmd2exclude[i]); // NOLINT
+ if (strstr(buf, cmdstr) == NULL) {
+ continue;
+ } else {
+ return false;
+ }
+ }
+ return true;
+}
+ // LCOV_EXCL_STOP 8: dead code
+
+//// exec perf to pids
+//static pid_t pids[PERF_MAX_PROCS];
+
+
+static bool lower_sched_priority(int niceval) {
+ struct sched_param sparam = { };
+ sparam.sched_priority = 0;
+ if (sched_setscheduler(0, SCHED_OTHER, &sparam) == -1) { // LCOV_EXCL_BR_LINE 5: sched_setscheduler's error case
+ // LCOV_EXCL_START 5: sched_setscheduler's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed change scheduler to TSS, errno=%d",
+ errno);
+ return false;
+ // LCOV_EXCL_STOP
+ }
+ if (nice(niceval) == -1) { // LCOV_EXCL_BR_LINE 5: nice's error case
+ // LCOV_EXCL_START 5: nice's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to add nice val %d, errno=%d",
+ niceval, errno);
+ return false;
+ // LCOV_EXCL_STOP
+ }
+ return true;
+}
+
+/*********************************************************************************
+ * exec_perf sub function RECORD perf data processing
+ *********************************************************************************/
+static void exec_perf_Record_Perf_Data(
+ pid_t* c_pids, char* perf_file, char* pidstr, int* status,
+
+// char pnames[PERF_MAX_PROCS][PERF_PNAME_MAX]) {
+ pid_t pids[PERF_MAX_PROCS]) {
+
+ int i;
+ int fd;
+ pid_t term_pid;
+ int waitret;
+ bool do_sigkill = false;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "+");
+
+ /* RECORD perf data */
+ for (i = 0; i < PERF_MAX_PROCS; i++) {
+ if (pids[i] <= 0) {
+ break;
+ }
+ sprintf(perf_file, PERF_FILE"%06d", pids[i]); // NOLINT
+ sprintf(pidstr, "%d", pids[i]); // NOLINT
+ if ((c_pids[i] = fork()) == 0) {
+ if (lower_sched_priority(CPULOAD_NICEVAL) == false) { // LCOV_EXCL_BR_LINE 200: lower_sched_priority() must be true
+ // LCOV_EXCL_START 200: lower_sched_priority() must be true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to lower scheduler-1");
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ if (setuid(0) == -1) { // LCOV_EXCL_BR_LINE 5: setuid's error case
+ // LCOV_EXCL_START 5: setuid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to setuid(0)-1, errno=%d",
+ errno);
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ // Redirect STDERR
+ fd = open("/dev/null", O_WRONLY);
+ if (fd > 0) { // LCOV_EXCL_BR_LINE 5: open's error case
+ dup2(fd, 2);
+ }
+ // Exec perf
+ execl(PERF_PATH, basename(PERF_PATH), "record", "-p", pidstr, "-o",
+ perf_file, NULL);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to execl %s record, errno=%d",
+ PERF_PATH,
+ errno);
+ exit(1);
+ }
+ if (c_pids[i] == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork-1, errno=%d", errno);
+ continue;
+ // LCOV_EXCL_STOP
+ }
+ // Kill perf after PERF_RECORD_SPAN sec
+ // (Killed by child process to avoid making resm process super-user with setuid.)
+ if ((term_pid = fork()) == 0) {
+ const struct timespec delay = { PERF_RECORD_SPAN, 0 };
+ if (setuid(0) == -1) { // LCOV_EXCL_BR_LINE 5: setuid's error case
+ // LCOV_EXCL_START 5: setuid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to setuid(0)-2, errno=%d",
+ errno);
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ nanosleep(&delay, NULL); // Let perf record run for a while before kill it.
+ if (kill(c_pids[i], SIGINT) == -1) { // LCOV_EXCL_BR_LINE 5: kill's error case
+ // LCOV_EXCL_START 5: kill's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to kill(SIGINT), pid=%d, errno=%d", (int) c_pids[i],
+ errno);
+ // LCOV_EXCL_STOP
+ }
+ nanosleep(&delay, NULL); // Allow perf to do ending procedure.
+ exit(0);
+ } else if (term_pid == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork-2, errno=%d", errno);
+ continue;
+ // LCOV_EXCL_STOP
+ } else {
+ if (waitpid(term_pid, status, 0) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to waitpid of killer %d, errno=%d", term_pid, errno);
+ continue;
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ // NOT block even if perf is not terminated
+ if ((waitret = waitpid(c_pids[i], status, WNOHANG)) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to waitpid of RECORD %d, errno=%d",
+ c_pids[i], errno);
+ // LCOV_EXCL_STOP
+ } else if (waitret == 0) {
+ // NOT exited
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to terminate perf record, pid=%d",
+ c_pids[i]);
+ pids[i] = -2; // Skip following sequences
+ do_sigkill = true;
+ } else if (WEXITSTATUS(*status) != 0 && WEXITSTATUS(*status) != 2) {
+
+// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+// "perf record %d exited abnormally, target=%s(%d), status=%d",
+// c_pids[i], pnames[i], pids[i], WEXITSTATUS(*status));
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "perf record %d exited abnormally, target=(%d), status=%d",
+ c_pids[i], pids[i], WEXITSTATUS(*status));
+
+ pids[i] = -2; // Skip following sequences
+ do_sigkill = false;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ if (pids[i] == -2) {
+ if ((term_pid = fork()) == 0) {
+ const struct timespec delay = { PERF_RECORD_SPAN, 0 };
+ if (setuid(0) == -1) { // LCOV_EXCL_BR_LINE 5: setuid's error case
+ // LCOV_EXCL_START 5: setuid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to setuid(0)-2B, errno=%d",
+ errno);
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ // Kill "perf record" by SIGKILL signal
+ if (do_sigkill) {
+ int sigret = kill(c_pids[i], SIGKILL);
+ if (sigret == 0) { // LCOV_EXCL_BR_LINE 5: kill case
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SIGKILL has been sent to perf record process, pid=%d",
+ c_pids[i]);
+ } else {
+ // LCOV_EXCL_START 5: kill case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "sending SIGKILL to perf record failed, pid=%d, errno=%d",
+ c_pids[i], errno);
+ // LCOV_EXCL_STOP 5: kill case
+ }
+ }
+ nanosleep(&delay, NULL);
+ // remove perf data file possibly made
+ unlink(perf_file);
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ exit(0);
+ } else if (term_pid == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork-2B, errno=%d", errno);
+ // LCOV_EXCL_STOP
+ } else {
+ if (waitpid(term_pid, status, 0) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to waitpid of killer-2 %d, errno=%d", term_pid, errno);
+ // LCOV_EXCL_STOP
+ }
+ if (do_sigkill) {
+ if ((waitret = waitpid(c_pids[i], status, WNOHANG)) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to waitpid of RECORD(2) %d, errno=%d", c_pids[i],
+ errno);
+ // LCOV_EXCL_STOP
+ } else if (waitret == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to terminate perf record by SIGKILL, pid=%d",
+ c_pids[i]);
+ }
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+}
+
+/*********************************************************************************
+ * exec_perf sub function make perf file available to default user processing
+ *********************************************************************************/
+
+//static int32_t exec_perf_Make_Perf_File(pid_t* c_pids, char* perf_file) {
+static int32_t exec_perf_Make_Perf_File(pid_t* c_pids, char* perf_file, pid_t pids[PERF_MAX_PROCS]) {
+
+ int i;
+
+ /* make perf file available to default user */
+ if ((c_pids[0] = fork()) == 0) {
+ if (setuid(0) == -1) { // LCOV_EXCL_BR_LINE 5: setuid's error case
+ // LCOV_EXCL_START 5: setuid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to setuid(0)-3, errno=%d", errno);
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ for (i = 0; i < PERF_MAX_PROCS; i++) {
+ if (pids[i] == -2) {
+ // killed by SIGKILL
+ continue;
+ }
+ if (pids[i] <= 0) {
+ break;
+ }
+ sprintf(perf_file, PERF_FILE"%06d", pids[i]); // NOLINT
+ if (chmod(perf_file, 0666) != 0) { // LCOV_EXCL_BR_LINE 5: chmod's error case
+ // LCOV_EXCL_START 5: chmod's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to chmod %s, errno=%d\n",
+ perf_file, errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ exit(0);
+ }
+ if (c_pids[0] == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork-3, errno=%d", errno);
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+ if (waitpid(c_pids[0], NULL, 0) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to waitpid of CHMOD %d, errno=%d\n",
+ c_pids[0], errno);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ return 0;
+}
+
+/*********************************************************************************
+ * exec_perf sub function REPORT perf data into dump file processing
+ *********************************************************************************/
+static void exec_perf_Report_Perf_Data(pid_t* c_pids, char* perf_file,
+
+// char* perf_dump, int* status) {
+ char* perf_dump, int* status, pid_t pids[PERF_MAX_PROCS]) {
+
+ int i;
+ int fd;
+ int waitret;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ /* REPORT perf data into dump file */
+ for (i = 0; i < PERF_MAX_PROCS; i++) {
+ const struct timespec delay = { PERF_REPORT_DELAY, 0 };
+ if (pids[i] == -2) {
+ // killed by SIGKILL
+ continue;
+ }
+ if (pids[i] <= 0) {
+ break;
+ }
+ sprintf(perf_file, PERF_FILE"%06d", pids[i]); // NOLINT
+ sprintf(perf_dump, PERF_DUMP"%06d", pids[i]); // NOLINT
+ if ((c_pids[i] = fork()) == 0) {
+ if (lower_sched_priority(CPULOAD_NICEVAL) == false) { // LCOV_EXCL_BR_LINE 200: lower_sched_priority() will not return false
+ // LCOV_EXCL_START 200: lower_sched_priority() will not return false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to lower scheduler-2");
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ if ((fd = open(perf_dump, (O_CREAT | O_WRONLY), 0666)) < 0) { // LCOV_EXCL_BR_LINE 5: open error case
+ // LCOV_EXCL_START 5: open error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open %s, errno=%d\n",
+ perf_dump, errno);
+ // LCOV_EXCL_STOP 5: open error case
+ } else {
+ // Redirect STDOUT
+ dup2(fd, 1);
+ close(fd);
+ // Redirect STDERR
+ fd = open("/dev/null", O_WRONLY);
+ if (fd > 0) { // redirect stderr // LCOV_EXCL_BR_LINE 5: open's error case
+ dup2(fd, 2);
+ close(fd);
+ }
+ // Exec perf
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "execl perf report");
+ execl(PERF_PATH, basename(PERF_PATH), "report", "-i", perf_file, NULL);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to execl %s report, errno=%d",
+ PERF_PATH,
+ errno);
+ }
+ exit(1);
+ }
+ if (c_pids[i] == (pid_t) -1) { // LCOV_EXCL_BR_LINE 5: fork's error case
+ // LCOV_EXCL_START 5: fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to fork-4, errno=%d", errno);
+ continue;
+ // LCOV_EXCL_STOP
+ }
+ int ii = 0;
+ for (; ii < PERF_REPORT_RETRY; ii++) {
+ nanosleep(&delay, NULL); // Make sure waitpid() to killer returns after perf process exited.
+ if ((waitret = waitpid(c_pids[i], status, WNOHANG)) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to waitpid for REPORT %d, errno=%d", c_pids[i], errno);
+ pids[i] = -2; // Skip FRAMEWORKUNIFIEDLOG perf data
+ break;
+ // LCOV_EXCL_STOP
+ } else if (waitret == c_pids[i]) {
+ break;
+ }
+ }
+ if (ii >= PERF_REPORT_RETRY) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "perf report Failed to exit, pid=%d",
+ c_pids[i]);
+ pids[i] = -2; // Skip FRAMEWORKUNIFIEDLOG perf data
+ }
+ if (pids[i] == -2) {
+ // Terminate perf report with SIGKILL
+ const struct timespec delay = { PERF_RECORD_SPAN, 0 };
+ int sigret = kill(c_pids[i], SIGKILL);
+ if (sigret != 0) { // LCOV_EXCL_BR_LINE 5: kill's error case
+ // LCOV_EXCL_START 5: kill's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed in sending SIGKILL to perf report, pid=%d, errno=%d",
+ c_pids[i], errno);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "SIGKILL has been sent to perf report process, pid=%d",
+ c_pids[i]);
+ }
+ nanosleep(&delay, NULL); // Make sure waitpid() to killer returns after perf process exited.
+ if ((waitret = waitpid(c_pids[i], status, WNOHANG)) == -1) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to waitpid of REPORT(2) %d, errno=%d", c_pids[i], errno);
+ // LCOV_EXCL_STOP
+ } else if (waitret == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to terminate perf report by SIGKILL, pid=%d", c_pids[i]);
+ }
+ // Cleanup
+ unlink(perf_dump);
+ unlink(perf_file);
+ }
+ }
+}
+
+/*********************************************************************************
+ * exec_perf FRAMEWORKUNIFIEDLOG perf data processing
+ *********************************************************************************/
+static void exec_perf_Resourcemanagerlog_Perf_Data(
+ char* perf_file, char* perf_dump,
+
+// char pnames[PERF_MAX_PROCS][PERF_PNAME_MAX]) {
+ pid_t pids[PERF_MAX_PROCS]) {
+
+ int i;
+ int perf_lines;
+ char buf[READLINE_MAX_SIZE];
+ FILE *rfd;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "");
+ /* FRAMEWORKUNIFIEDLOG perf data */
+ for (i = 0; i < PERF_MAX_PROCS; i++) {
+ if (pids[i] == -2) {
+ // killed by SIGKILL
+ continue;
+ }
+ if (pids[i] <= 0) {
+ break;
+ }
+ sprintf(perf_file, PERF_FILE"%06d", pids[i]); // NOLINT
+ sprintf(perf_dump, PERF_DUMP"%06d", pids[i]); // NOLINT
+ if ((rfd = fopen(perf_dump, "r")) == NULL) { // LCOV_EXCL_BR_LINE 5: fopen error case
+ // LCOV_EXCL_START 5: fopen error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open-2 %s, errno=%d\n",
+ perf_dump, errno);
+ continue;
+ // LCOV_EXCL_STOP 5: fopen error case
+ }
+ perf_lines = 0;
+ while (fgets(buf, sizeof(buf), rfd) > 0) {
+ if (perf_lines >= PERF_MAX_LINES) {
+ break;
+ }
+ /* skip header */
+ if (buf[0] == '#') {
+ continue;
+ }
+ if (buf[0] == '\n' || buf[0] == '\r') {
+ continue;
+ }
+ trim_end(buf);
+ if (perf_lines == 0) {
+
+// FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHLPerf:%s(%d)]report by result of 'perf record -p %d'",
+// pnames[i], pids[i], pids[i]);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHLPerf:(%d)]report by result of 'perf record -p %d'",
+ pids[i], pids[i]);
+
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHLPerf]%s\n", buf);
+ perf_lines++;
+ }
+ fclose(rfd);
+ // Check if no line is acquired
+ if (perf_lines == 0) {
+
+// FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHLPerf:%s(%d)] NO_DATA_acquired",
+// pnames[i], pids[i]);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHLPerf:(%d)] NO_DATA_acquired",
+ pids[i]);
+
+ }
+ // Cleanup
+ unlink(perf_dump);
+ unlink(perf_file);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "-");
+}
+
+/*********************************************************************************
+ * exec_perf Main processing
+ *********************************************************************************/
+
+//static void exec_perf(char pnames[PERF_MAX_PROCS][PERF_PNAME_MAX]) {
+static void exec_perf(int32_t t_pid) {
+
+ pid_t c_pids[PERF_MAX_PROCS]; // max process to exec perf(forked child pids)
+
+ pid_t pids[PERF_MAX_PROCS];
+ char perf_file[128];
+ char perf_dump[128];
+ char pidstr[64];
+ struct stat statbuf;
+ int status;
+
+ /* Check existance of perf exec file */
+ if (stat(PERF_PATH, &statbuf) == -1 || !(statbuf.st_mode & S_IXUSR)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "%s is not available", PERF_PATH);
+ return;
+ }
+
+ FRAMEWORKUNIFIEDLOG (ZONE_INFO, __FUNCTION__, "[CpuHighLoad]Please check User backtrace of following processes in kernel.log");
+// print_backtrace_pid(t_pid);
+ for (int i = 0; i < PERF_MAX_PROCS; i++) {
+ pids[i] = -1;
+ }
+
+ pids[0] = t_pid;
+
+
+ /* RECORD perf data */
+
+// exec_perf_Record_Perf_Data(c_pids, perf_file, pidstr, &status, pnames);
+ exec_perf_Record_Perf_Data(c_pids, perf_file, pidstr, &status, pids);
+
+
+ /* make perf file available to default user */
+
+// if (exec_perf_Make_Perf_File(c_pids, perf_file) != 0)
+ if (exec_perf_Make_Perf_File(c_pids, perf_file, pids) != 0)
+
+ return;
+
+ /* REPORT perf data into dump file */
+
+// exec_perf_Report_Perf_Data(c_pids, perf_file, perf_dump, &status);
+ exec_perf_Report_Perf_Data(c_pids, perf_file, perf_dump, &status, pids);
+
+
+ /* FRAMEWORKUNIFIEDLOG perf data */
+
+// exec_perf_Resourcemanagerlog_Perf_Data(perf_file, perf_dump, pnames);
+ exec_perf_Resourcemanagerlog_Perf_Data(perf_file, perf_dump, pids);
+
+}
+
+// Logging at CPU overload
+#define WAIT_RETRY 3 // 3sec
+
+
+#if 0
+static void logging_cpuload(void) {
+ int32_t pipe_fd[2]; // 0:stdin,1:stdout
+ pid_t c_pid;
+ char buf[READLINE_MAX_SIZE];
+ char buf2[READLINE_MAX_SIZE];
+ char tmp[READLINE_MAX_SIZE];
+ int32_t logLine = 0;
+ char* ptr;
+ int32_t ret;
+ int32_t status;
+ int32_t perfNum = 0;
+ char pnames[PERF_MAX_PROCS][PERF_PNAME_MAX] = { };
+ int save_0 = -1;
+ int kill_flag = 1;
+ int waitret;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "+");
+
+ // Create pipe
+ ret = pipe(pipe_fd);
+
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: pipe error case
+ // LCOV_EXCL_START 5: pipe error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr logging_cpuload() pipe Error");
+ return;
+ // LCOV_EXCL_STOP 5: pipe error case
+ }
+
+ // Create child process
+ c_pid = fork();
+ if (c_pid < 0) { // LCOV_EXCL_BR_LINE 5: fork error case
+ // LCOV_EXCL_START 5: fork error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__,
+ "ResMgr logging_cpuload() fork Error");
+ close(pipe_fd[0]);
+ close(pipe_fd[1]);
+
+ return;
+ // LCOV_EXCL_STOP 5: fork error case
+ }
+
+ if (c_pid == 0) {
+ /*******************************************************
+ * Child-process
+ * The use of dup() and Close() between fork()-> exec() has been
+ * confirmed no probrem.
+ *******************************************************/
+ if (lower_sched_priority(CPULOAD_NICEVAL) == false) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to lower scheduler");
+ exit(1);
+ }
+ close(pipe_fd[0]); // Unneeded pipes (close stdin)
+
+ close(1); // Close stdout
+ dup2(pipe_fd[1], 1); // Duplicate stdout to pipe_fd[1]
+ close(pipe_fd[1]);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "execl top");
+ execl("/usr/bin/top", "top", "-n", "1", "-b", NULL);
+ // error
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "ResMgr logging_cpuload() execl Error");
+ exit(1);
+ } else {
+ close(pipe_fd[1]); // Unneeded pipes(Close stdout)
+
+ save_0 = dup(0);
+ close(0); // Close stdin
+ dup2(pipe_fd[0], 0); // Duplicate stdin to pipe_fd[0]
+ close(pipe_fd[0]);
+
+ for (int i = 0; i < PERF_MAX_PROCS; i++) {
+ pids[i] = -1;
+ }
+
+ {
+ fd_set fds;
+ int32_t maxFd;
+ int ret;
+ struct timeval tmout = { TOP_TIMEOUT, 0 };
+
+ FD_ZERO(&fds);
+ FD_SET(STDIN_FILENO, &fds);
+ maxFd = STDIN_FILENO;
+ ret = select(maxFd + 1, &fds, NULL, NULL, &tmout);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: select error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "[RESM]Handle Error errno:%d", errno); // LCOV_EXCL_LINE 5: select error case
+ } else if (FD_ISSET(STDIN_FILENO, &fds)) {
+ kill_flag = 0;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM]'top': No response during %d seconds", TOP_TIMEOUT);
+ }
+ if (kill_flag) {
+ // Kill top after TOP_TIMEOUT sec
+ // (Killed by child process to avoid making resm process super-user with setuid.)
+ if (kill(c_pid, SIGKILL) == -1) { // LCOV_EXCL_BR_LINE 5: kill error case
+ // LCOV_EXCL_START 5: kill error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to kill(SIGKILL), pid=%d, errno=%d", (int) c_pid,
+ errno);
+ // LCOV_EXCL_STOP 5: kill error case
+ }
+ } else {
+ while (fgets(buf, sizeof(buf), stdin) > 0) {
+ // Save ProcessName and Process ID to exec perf
+ if (logLine >= 2 && perfNum < PERF_MAX_PROCS) {
+ buf2[0] = 0;
+ strncat(buf2, buf, sizeof(buf2) - 1);
+ buf2[sizeof(buf2) - 1] = 0;
+ if (valid_perf_cmd(buf2)) {
+ pids[perfNum] = atoi(buf2);
+ trim_end(buf2);
+ strncat(pnames[perfNum], rindex(buf2, ' ') + 1,
+ sizeof(pnames[0]) - 1);
+ if (pids[perfNum] >= 0
+ && strnlen(pnames[perfNum], sizeof(pnames[perfNum]) - 1)) {
+ perfNum++;
+ } else {
+ pids[perfNum] = -1;
+ }
+ }
+ }
+ if (logLine == 0) {
+ if ((buf[0] != 'C') && (buf[0] != '%')) {
+ continue;
+ }
+ ptr = strstr(buf, "sy");
+ if (ptr == NULL) {
+ continue;
+ }
+ while (isalpha(*ptr)) {
+ ptr++;
+ }
+ *ptr = '\0';
+ escape_percent(buf, tmp);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHighLoad]%s", tmp);
+ logLine++;
+ } else if (logLine == 1) {
+ ptr = strstr(buf, "PID");
+ if (ptr == NULL) {
+ continue;
+ }
+ trim_end(buf);
+ escape_percent(buf, tmp);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHighLoad]%s", tmp);
+ logLine++;
+ } else if (logLine < (CPU_HIGH_LOAD_P_LOG_NUM + 2)) {
+ trim_end(buf);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[CpuHighLoad]%s", buf);
+ logLine++;
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "wait pid(%d) kill_flag(%d)", c_pid, kill_flag);
+ if (kill_flag) {
+ const struct timespec delay = {1, 0};
+ int i;
+ for (i = 0; i < WAIT_RETRY; i++) {
+ nanosleep(&delay, NULL);
+ if ((waitret = waitpid(c_pid, &status, WNOHANG)) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to waitpid for top %d, errno=%d", c_pid, errno);
+ break;
+ } else if (waitret == c_pid) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "waitpid OK");
+ break;
+ }
+ }
+ if (i >= WAIT_RETRY) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "top Failed to exit, pid=%d", c_pid);
+ }
+ } else {
+ if ((waitret = waitpid(static_cast<int>(c_pid), &status, 0)) < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "waitpid(%d) Error errno(%d)", c_pid, errno);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "waitpid(%d) returned (%d) errno(%d) status=%d",
+ c_pid, waitret, errno, WEXITSTATUS(*status));
+ if (save_0 >= 0) {
+ dup2(save_0, 0); // Reset the stdin to 0
+ close(save_0);
+ }
+ if (!kill_flag) {
+ exec_perf(pnames);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "-");
+
+ return;
+}
+#endif
+
+
+// Tail adjustment
+static void trim_end(char* buf) {
+ int32_t len;
+
+ len = strlen(buf);
+ while (len > 0) {
+ if (isspace(buf[len - 1])) {
+ buf[len - 1] = '\0';
+ len--;
+ continue;
+ }
+ break;
+ }
+
+ return;
+}
+
+
+#if 0
+// Escape character "%"
+static void escape_percent(char* in, char* out) {
+ char* head;
+ char* tail;
+
+ head = in;
+
+ out[0] = '\0';
+
+ while (1) {
+ tail = strchr(head, '%');
+ if (tail == NULL) {
+ strcat(out, head); // NOLINT
+ break;
+ }
+ *tail = '\0';
+
+ strcat(out, head); // NOLINT
+ strcat(out, "%%"); // NOLINT
+
+ tail++;
+ head = tail;
+ }
+
+ return;
+}
+#endif
+
+
+/*********************************************************************************
+ * Output debug information display
+ *********************************************************************************/
+void outputResouceInfo(void) {
+ static bool madedir = false;
+ struct stat sbuf;
+ FILE *wfp;
+
+ // Create directory
+ if (!madedir) {
+ if (stat(DEBUG_INFO_DIRPATH, &sbuf) != 0) { // LCOV_EXCL_BR_LINE 5: stat's error case
+ if (mkdir(DEBUG_INFO_DIRPATH, 0777) != 0) { // LCOV_EXCL_BR_LINE 5: mkdir's error case
+ // LCOV_EXCL_START 5: mkdir's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to mkdir %s, errno=%d",
+ DEBUG_INFO_DIRPATH,
+ errno);
+ return;
+ // LCOV_EXCL_STOP
+ }
+ }
+ madedir = true;
+ }
+ // Open files to work
+ if ((wfp = fopen(DEBUG_INFO_TMPPATH, "w")) == NULL) { // LCOV_EXCL_BR_LINE 5: fopen error case
+ // LCOV_EXCL_START 5: fopen error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open %s, errno=%d",
+ DEBUG_INFO_TMPPATH,
+ errno);
+ return;
+ // LCOV_EXCL_STOP 5: fopen error case
+ }
+ // Output memory information work
+ if (write_meminfo_work(wfp) != 0) { // LCOV_EXCL_BR_LINE 6: write_meminfo_work will not be error
+ // LCOV_EXCL_START 6: write_meminfo_work will not be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to edit and output in write_meminfo_work()");
+ fclose(wfp);
+ return;
+ // LCOV_EXCL_STOP 6: write_meminfo_work will not be error
+ }
+ // Get CMA MEMORY information and output working info
+ if (write_cmainfo_work(wfp) != 0) { // LCOV_EXCL_BR_LINE 6: write_cmainfo_work will not be error
+ // LCOV_EXCL_START 6: write_cmainfo_work will not be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to edit and output in write_cmainfo_work()");
+ fclose(wfp);
+ return;
+ // LCOV_EXCL_STOP 6: write_cmainfo_work will not be error
+ }
+ // Get top information and output work info
+ if (write_cpuinfo_work(wfp) != 0) { // LCOV_EXCL_BR_LINE 6: write_cpuinfo_work will not be error
+ // LCOV_EXCL_START 6: write_cpuinfo_work will not be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to edit and output in write_cpuinfo_work()");
+ fclose(wfp);
+ return;
+ // LCOV_EXCL_STOP 6: write_cpuinfo_work will not be error
+ }
+ fclose(wfp);
+ // Create output file
+ if (rename(DEBUG_INFO_TMPPATH, DEBUG_INFO_FPATH) != 0) { // LCOV_EXCL_BR_LINE 5:rename error case
+ // LCOV_EXCL_START 5:rename error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to make output file %s, errno=%d",
+ DEBUG_INFO_FPATH,
+ errno);
+ // LCOV_EXCL_STOP 5:rename error case
+ }
+ // Write information and output FRAMEWORKUNIFIEDLOG
+ if (write_resourcemanagerloginfo_work() != 0) { // LCOV_EXCL_BR_LINE 6: write_resourcemanagerloginfo_work will not be error
+ // LCOV_EXCL_START 6: write_resourcemanagerloginfo_work will not be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to output in write_resourcemanagerloginfo_work()");
+ // LCOV_EXCL_STOP 6: write_resourcemanagerloginfo_work will not be error
+ }
+}
+
+// Output memory information work
+static int write_meminfo_work(FILE *wfp) {
+ float total;
+ float avail;
+ float used;
+ float min_remain;
+ uint32_t used_rate;
+ uint32_t used_letters;
+ // Output meminfo: Getting info from the proc/meminfo is performed at 5-second intervals in watchMem, so it is diverted.
+ avail = static_cast<float>((mainFree_kib + inactFile_kib));
+ total = static_cast<float>(memTotal_kib);
+ used = total - avail;
+ min_remain = static_cast<float>(minRestMem);
+ // "*MEMORY @@@@@@ Warning!! @@@@@"
+ fprintf(wfp, "*MEMORY");
+ if (avail * 10 < total) { // (Less than 1/10)
+ fprintf(wfp, " @@@@@@ Warning!! @@@@@\n");
+ } else {
+ fprintf(wfp, " \n");
+ }
+ // "used/avail/total/used max xxx.xMB / xxx.xMB / xxx.xMB(xx.x%) / xxx.xMB
+ used /= 1024;
+ avail /= 1024;
+ total /= 1024;
+ min_remain /= 1024;
+ if (total == 0) {
+ used_rate = 0;
+ } else {
+ used_rate = (uint32_t) (used * 1000 / total);
+ if (used_rate >= 1000) {
+ used_rate = 999;
+ }
+ }
+ fprintf(
+ wfp,
+ " used/avail/total/min remain %5.1fMB / %5.1fMB / %5.1fMB(%2d.%d%%) / %5.1fMB\n",
+ used, avail, total, used_rate / 10, used_rate % 10, min_remain);
+ if (total == 0) {
+ used_letters = 0;
+ } else {
+ used_letters = (uint32_t) (DEBUG_INFO_MEM_LETTERS * used / total);
+ if (used_letters > DEBUG_INFO_MEM_LETTERS) {
+ used_letters = DEBUG_INFO_MEM_LETTERS;
+ }
+ }
+ // "------------------*******"
+ int i;
+ for (i = 0; i < static_cast<int>(used_letters); i++) {
+ fprintf(wfp, "-");
+ }
+ for (; i < DEBUG_INFO_MEM_LETTERS; i++) {
+ fprintf(wfp, "*");
+ }
+ fprintf(wfp, "\n\n");
+
+ return 0;
+}
+// Get top information and Output work
+static int write_cpuinfo_work(FILE *wfp) {
+ int32_t pipe_fd[2]; // 0:stdin,1:stdout
+ pid_t c_pid;
+ char buf[READLINE_MAX_SIZE];
+ int32_t logLine = 0;
+ char* ptr;
+ int32_t ret;
+ int32_t status;
+ int save_0 = -1;
+ int32_t cpu_rate;
+ char fields[12][128];
+ int kill_flag = 1;
+ int waitret;
+
+ // Output CPU load
+ cpu_rate = g_cpuloadRate1000 < 0 ? 0 : g_cpuloadRate1000;
+ fprintf(wfp, "*CPU %2d.%d%%\n", cpu_rate / 10, cpu_rate % 10);
+
+ // Create pipe
+ ret = pipe(pipe_fd);
+
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: pipe error case
+ // LCOV_EXCL_START 5: pipe error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pipe Error");
+ return -1;
+ // LCOV_EXCL_STOP 5: pipe error case
+ }
+
+ // Create child process
+ c_pid = fork();
+ if (c_pid < 0) { // LCOV_EXCL_BR_LINE 5: fork error case
+ // LCOV_EXCL_START 5: fork error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fork Error");
+ close(pipe_fd[0]);
+ close(pipe_fd[1]);
+
+ return -1;
+ // LCOV_EXCL_STOP 5: fork error case
+ }
+
+ if (c_pid == 0) {
+ /*******************************************************
+ * Child process
+ *******************************************************/
+ if (lower_sched_priority(CPULOAD_NICEVAL) == false) { // LCOV_EXCL_BR_LINE 200: lower_sched_priority can't be false
+ // LCOV_EXCL_START 200: lower_sched_priority can't be false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to lower scheduler");
+ exit(1);
+ // LCOV_EXCL_STOP
+ }
+ close(pipe_fd[0]); // Unneeded pipes (close stdin)
+
+ close(1); // Close stdout
+ dup2(pipe_fd[1], 1); // Duplicate stdout to pipe_fd[1]
+ close(pipe_fd[1]);
+
+ execl("/usr/bin/top", "top", "-n", "1", "-b", NULL);
+ // error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "execl top Error");
+ exit(1);
+ } else {
+ close(pipe_fd[1]); // Unneeded pipes(Close stdout)
+
+ save_0 = dup(0);
+ close(0); // Close stdin
+ dup2(pipe_fd[0], 0); // Duplicate stdin to pipe_fd[0]
+ close(pipe_fd[0]);
+
+ {
+ fd_set fds;
+ int32_t maxFd;
+ int ret;
+ struct timeval tmout = { TOP_TIMEOUT, 0 };
+
+ FD_ZERO(&fds);
+ FD_SET(STDIN_FILENO, &fds);
+ maxFd = STDIN_FILENO;
+ ret = select(maxFd + 1, &fds, NULL, NULL, &tmout);
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: select error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "[RESM]Handle Error errno:%d", errno); // LCOV_EXCL_LINE 5: select error case
+ } else if (FD_ISSET(STDIN_FILENO, &fds)) { // LCOV_EXCL_BR_LINE 5: FD_ISSET's error case
+ kill_flag = 0;
+ } else {
+ // LCOV_EXCL_START 5: FD_ISSET's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "[RESM]'top': No response during %d seconds", TOP_TIMEOUT);
+ // LCOV_EXCL_STOP
+ }
+ if (kill_flag) { // LCOV_EXCL_BR_LINE 200: kill_flag must be 0
+ // LCOV_EXCL_START 200: kill_flag must be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // Kill top after TOP_TIMEOUT sec
+ // (Killed by child process to avoid making resm process super-user with setuid.)
+ if (kill(c_pid, SIGKILL) == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to kill(SIGKILL), pid=%d, errno=%d", (int) c_pid,
+ errno);
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ while (fgets(buf, sizeof(buf), stdin) > 0) {
+ if (logLine == 0) {
+ if (buf[0] != 'C') {
+ continue;
+ }
+ if (strstr(buf, "Cpu(s)") == NULL || strstr(buf, "sy") == NULL) {
+ continue;
+ }
+ logLine++;
+ } else if (logLine == 1) {
+ ptr = strstr(buf, "PID");
+ if (ptr == NULL) {
+ continue;
+ }
+ logLine++;
+ } else if (logLine < (DEBUG_INFO_CPU_TOP_LINES + 2)) {
+ ret = sscanf(buf, "%128s %128s %128s %128s %128s %128s %128s %128s %128s %128s %128s %128s", fields[0],
+ fields[1], fields[2], fields[3], fields[4], fields[5],
+ fields[6], fields[7], fields[8], fields[9], fields[10],
+ fields[11]);
+ fprintf(wfp, "%4s%% %s\n", fields[8], fields[11]);
+ logLine++;
+ }
+ }
+ fprintf(wfp, "\n\n");
+ }
+ }
+ ret = 0;
+ if (kill_flag) { // LCOV_EXCL_BR_LINE 200: kill_flag must be 0
+ // LCOV_EXCL_START 200: kill_flag must be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const struct timespec delay = {1, 0};
+ int i;
+ for (i = 0; i < WAIT_RETRY; i++) {
+ nanosleep(&delay, NULL);
+ if ((waitret = waitpid(c_pid, &status, WNOHANG)) == -1) {
+ ret = -1;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to waitpid for top %d, errno=%d", c_pid, errno);
+ break;
+ } else if (waitret == c_pid) {
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "waitpid OK");
+ break;
+ }
+ }
+ if (i >= WAIT_RETRY) {
+ ret = -1;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "top Failed to exit, pid=%d", c_pid);
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ if ((waitret = waitpid(static_cast<int>(c_pid), &status, 0)) < 0) { // LCOV_EXCL_BR_LINE 5: waitpid's error case
+ // LCOV_EXCL_START 5: waitpid's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = -1;
+ FRAMEWORKUNIFIEDLOG(ZONE_RESM_DEBUG, __FUNCTION__, "waitpid(%d) Error errno(%d)", c_pid, errno);
+ // LCOV_EXCL_STOP
+ }
+ }
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 200: ret must be 0
+ // LCOV_EXCL_START 200: ret must be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "wait Error");
+ if (save_0 >= 0) {
+ close(save_0);
+ }
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+ if (save_0 >= 0) {
+ dup2(save_0, 0); // Reset the stdin to 0
+ close(save_0);
+ }
+ }
+
+ return 0;
+}
+// Get CMA information and Output work
+static int write_cmainfo_work(FILE *wfp) {
+ float total;
+ float avail;
+ float used;
+ float min_remain;
+ uint32_t used_rate;
+ uint32_t used_letters;
+
+ avail = static_cast<float>(cmaFree_kib);
+ total = static_cast<float>(cmaTotal_kib);
+ used = total - avail;
+ min_remain = static_cast<float>(minRestCma);
+ // "*CMA MEMORY @@@@@@ Warning!! @@@@@"
+ fprintf(wfp, "*CMA MEMORY");
+ if (used * 5 > total * 4) { // (4/5 Or more)
+ fprintf(wfp, " @@@@@@ Warning!! @@@@@\n");
+ } else {
+ fprintf(wfp, " \n");
+ }
+ // "used/avail/total xxx.xMB / xxx.xMB / xxx.xMB(xx.x%)
+ used /= 1024;
+ avail /= 1024;
+ total /= 1024;
+ min_remain /= 1024;
+ if (total != 0) {
+ used_rate = (uint32_t) (used * 1000 / total);
+ } else {
+ used_rate = 0;
+ }
+ if (used_rate >= 1000) {
+ used_rate = 999;
+ }
+ fprintf(
+ wfp,
+ " used/avail/total/min remain %5.1fMB / %5.1fMB / %5.1fMB(%2d.%d%%) / %5.1fMB\n",
+ used, avail, total, used_rate / 10, used_rate % 10, min_remain);
+ if (total == 0) {
+ used_letters = 0;
+ } else {
+ used_letters = (uint32_t) (DEBUG_INFO_CMA_LETTERS * used / total);
+ if (used_letters > DEBUG_INFO_CMA_LETTERS) {
+ used_letters = DEBUG_INFO_CMA_LETTERS;
+ }
+ }
+ // "------------------*******"
+ int i;
+ for (i = 0; i < static_cast<int>(used_letters); i++) {
+ fprintf(wfp, "-");
+ }
+ for (; i < DEBUG_INFO_CMA_LETTERS; i++) {
+ fprintf(wfp, "*");
+ }
+ fprintf(wfp, "\n\n");
+
+ return 0;
+}
+// Write information and Output FRAMEWORKUNIFIEDLOG
+static int write_resourcemanagerloginfo_work(void) {
+ FILE *wfp;
+ char l_read[READLINE_MAX_SIZE];
+ int ret;
+
+ wfp = fopen(DEBUG_INFO_FPATH, "r");
+ if (wfp == NULL) { // LCOV_EXCL_BR_LINE 5: fopen error case
+ // LCOV_EXCL_START 5: fopen case error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open %s, errno=%d",
+ DEBUG_INFO_FPATH,
+ errno);
+ return -1;
+ // LCOV_EXCL_STOP 5: fopen case error
+ }
+ while (1) {
+ if (fgets(l_read, READLINE_MAX_SIZE, wfp) == NULL) {
+ ret = feof(wfp);
+ if (ret == 0) { // LCOV_EXCL_BR_LINE 5: feof case error
+ // LCOV_EXCL_START 5: feof case error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "Failed to fgets %s",
+ DEBUG_INFO_FPATH);
+ // LCOV_EXCL_STOP 5: feof case error
+ }
+ break;
+ } else {
+ char *line;
+ line = strchr(l_read, '\n');
+ if (line != NULL) {
+ *line = '\0';
+ }
+ if (l_read[0] != '\0') {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "%s", l_read);
+ }
+ }
+ }
+ fclose(wfp);
+ return 0;
+}
diff --git a/video_in_hal/systemservice/resource_manager/server/src/resourcemanager_application.cpp b/video_in_hal/systemservice/resource_manager/server/src/resourcemanager_application.cpp
new file mode 100755
index 0000000..225160b
--- /dev/null
+++ b/video_in_hal/systemservice/resource_manager/server/src/resourcemanager_application.cpp
@@ -0,0 +1,155 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+
+#include "ss_resm_resourcemanagerlog.h"
+#include "system_service/resm_type.h"
+
+extern void FlushMemInfo(void);
+
+// Called at process startup
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
+ *
+ * System callbacks that applications should address.
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // API to Register Notification for Service Availability.
+ eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hApp, NTFY_ResourceMgr_Availability);
+ if (eFrameworkunifiedStatusOK != eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to Register Service Availability Notification:%s",
+ NTFY_ResourceMgr_Availability);
+ return eStatus;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ // API to Publish Service Availability Notification.
+ eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE);
+ if (eFrameworkunifiedStatusOK != eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to Publish Service Availability Notification:0x%x", eStatus);
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+// Called at process termination
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnDestroy
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) { // LCOV_EXCL_START 14 Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP 14 Resident process, not called by NSFW
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnDebugDump
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp) { //LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+//LCOV_EXCL_STOP 7:debug code
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FlushMemInfo();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/********************************************************
+ * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+ ********************************************************/
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 8: not use StateMachine
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP 8: not use StateMachine
+// EOF
diff --git a/video_in_hal/systemservice/rom_access_library/LICENSE b/video_in_hal/systemservice/rom_access_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/systemservice/rom_access_library/Makefile.client b/video_in_hal/systemservice/rom_access_library/Makefile.client
new file mode 100755
index 0000000..adb1845
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS += library mock
+
+include ../system_service.mk
diff --git a/video_in_hal/systemservice/rom_access_library/library/Makefile b/video_in_hal/systemservice/rom_access_library/library/Makefile
new file mode 100755
index 0000000..e8c64b2
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/Makefile
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := nor rom
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/rom_access_library/library/include/rom_access_library_nor.h b/video_in_hal/systemservice/rom_access_library/library/include/rom_access_library_nor.h
new file mode 100755
index 0000000..417b78f
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/include/rom_access_library_nor.h
@@ -0,0 +1,43 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file rom_access_library_nor.h
+ * @brief This file include the head file of nor access
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_NOR_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_NOR_H_
+
+#include "system_service/nor_backup.h"
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_NOR_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/rom_access_library/library/include/rom_access_library_rom.h b/video_in_hal/systemservice/rom_access_library/library/include/rom_access_library_rom.h
new file mode 100755
index 0000000..1e02e6e
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/include/rom_access_library_rom.h
@@ -0,0 +1,45 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file rom_access_library_rom.h
+ * @brief This file include all head file of rom access
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_ROM_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_ROM_H_
+
+#include "system_service/ss_sm_rom_access.h"
+#include "system_service/ss_sm_boot_access.h"
+#include "system_service/ss_sm_ram_access.h"
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_ROM_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/rom_access_library/library/include/ss_rom_access_define.h b/video_in_hal/systemservice/rom_access_library/library/include/ss_rom_access_define.h
new file mode 100755
index 0000000..689fea2
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/include/ss_rom_access_define.h
@@ -0,0 +1,38 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_DEFINE_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_DEFINE_H_
+
+#include <errno.h>
+
+#define ROM_ACCESS_ASERT(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT"); \
+ }
+
+#define ROM_ACCESS_ERRNO(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT %d:%s", errno, strerror(errno)); \
+ }
+
+#define ROM_ACCESS_STATIC_ASERT(expr) \
+ { \
+ char STATIC_ASSERTION_FAILED[(expr) ? 1 : -1]; \
+ (void)STATIC_ASSERTION_FAILED; \
+ }
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_DEFINE_H_
diff --git a/video_in_hal/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h b/video_in_hal/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h
new file mode 100755
index 0000000..e62b5af
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_RomAccess
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_IF_ROMACCESSLIBRARYLOG_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_IF_ROMACCESSLIBRARYLOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+// #define ZONE_WARN ZONEMASK(30)
+// #define ZONE_ERR ZONEMASK(31)
+
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, WARN
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern const CHAR kAppName[];
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_IF_ROMACCESSLIBRARYLOG_H_
diff --git a/video_in_hal/systemservice/rom_access_library/library/include/ss_sm_checksum.h b/video_in_hal/systemservice/rom_access_library/library/include/ss_sm_checksum.h
new file mode 100755
index 0000000..271964c
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/include/ss_sm_checksum.h
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides for checksum calculation.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_SM_CHECKSUM_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_SM_CHECKSUM_H_
+
+#include <native_service/frameworkunified_types.h>
+class CSMChecksum {
+ public:
+ CSMChecksum();
+ ~CSMChecksum();
+ UI_32 cal_checksum(const void* p_buf, size_t buf_size);
+
+ private:
+};
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_SM_CHECKSUM_H_
diff --git a/video_in_hal/systemservice/rom_access_library/library/include/system_service/nor_backup.h b/video_in_hal/systemservice/rom_access_library/library/include/system_service/nor_backup.h
new file mode 100755
index 0000000..8c95a10
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/include/system_service/nor_backup.h
@@ -0,0 +1,212 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file nor_backup.h
+ * @brief This file provides API for get nor flash information
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_NOR_BACKUP_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_NOR_BACKUP_H_
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+#if defined(__cplusplus)
+extern "C" {
+#endif // __cplusplus
+
+/**
+ * \~english Common return value: Normal return value of API
+ */
+#define RET_DEV_NORMAL 0
+
+/**
+ * \~english Common return value: Parameter error return value of API
+ */
+#define RET_DEV_ERR_PARAM 3
+
+/**
+ * \~english Common return value: Error of getting device info
+ */
+#define RET_DEV_ERROR 4
+
+/**
+ * \~english Read API return value: Internal error
+ */
+#define RET_DEV_RD_ERR_OTHER 1
+
+/**
+ * \~english Read API return value: Acquire buffer error(malloc)
+ */
+#define RET_DEV_RD_ERR 2
+
+/**
+ * \~english Read API return value: error type 1
+ */
+#define RET_DEV_RD_ERR_1 -1
+
+/**
+ * \~english Read API return value: error type 2
+ */
+#define RET_DEV_RD_ERR_2 -2
+
+/**
+ * \~english Read API return value: error type 3
+ */
+#define RET_DEV_RD_ERR_3 -3
+
+/**
+ * \~english Read API return value: error type 4
+ */
+#define RET_DEV_RD_ERR_4 -4
+
+/**
+ * \~english Write API return value: Other error
+ */
+#define RET_DEV_WT_ERR_OTHER 1
+
+/**
+ * \~english Write API return value: Internal error
+ */
+#define RET_DEV_WT_ERR 2
+
+/**\ingroup mtdn_backup_Read
+ * \~english @par Brief
+ * Read data from norflash device.
+ * \~english @param [in] path_name
+ * const char* - Device path to read(such as "/dev/mtd1ro")
+ * \~english @param [in] i_id
+ * int - Main block ID(0, 2, 4, ...)
+ * \~english @param [in] i_offset
+ * int - Data offset
+ * \~english @param [in] i_size
+ * int - Data size to read
+ * \~english @param [in] p_buff
+ * Void* - Buffer for storing read data
+ * \~english @retval RET_DEV_NORMAL OK
+ * \~english @retval RET_DEV_ERROR Get device error
+ * \~english @retval RET_DEV_ERR_PARAM Parameter error
+ * \~english @retval RET_DEV_RD_ERR_OTHER Internal error
+ * \~english @retval RET_DEV_RD_ERR Acquire buffer error(malloc)
+ * \~english @retval RET_DEV_RD_ERR_1 Error type 1
+ * \~english @retval RET_DEV_RD_ERR_2 Error type 2
+ * \~english @retval RET_DEV_RD_ERR_3 Error type 3
+ * \~english @retval RET_DEV_RD_ERR_4 Error type 4
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Parameter path_name is NULL. [RET_DEV_ERR_PARAM]
+ * - Parameter p_buff is NULL. [RET_DEV_ERR_PARAM]
+ * - Value of parameter i_id is less than 0. [RET_DEV_ERR_PARAM]
+ * - Value of parameter i_offset is less than 0 or value of parameter i_size
+ * is not greater than 0. [RET_DEV_ERR_PARAM]
+ * - Device specified by path_name is invalid. [RET_DEV_ERR_PARAM]
+ * - Sum value of i_offset and i_size is greater than block size - 16byte.
+ * [RET_DEV_ERR_PARAM]
+ * - Failed to get device info. [RET_DEV_ERROR]
+ * - Failed to acquire the send/receive buffer(malloc). [RET_DEV_RD_ERR]
+ * - Internal IO error(open, read, close, ioctl, lseek, other error).
+ * [RET_DEV_RD_ERR_OTHER]
+ * - Check text error of main block and backup block. [RET_DEV_RD_ERR_1]
+ * - Check text error of main block and checksum error of backup block.
+ * [RET_DEV_RD_ERR_2]
+ * - Checksum error of main block and check text error of backup block.
+ * [RET_DEV_RD_ERR_3]
+ * - Checksum error of main block and backup block. [RET_DEV_RD_ERR_4]
+ * \~english @par Detail
+ * - This API gets data from main or backup block according to specified\n
+ * norflash device pathname and main block ID.
+ * \~english @par
+ * - When this API is executed, read data from main block first. If failed to\n
+ * read main block, return RET_DEV_RD_ERR_OTHER. If read main block success,\n
+ * but check main block data error, turn to read data from backup block which\n
+ * block ID is i_id + 1.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync Only
+ * \~english @see mtdn_backup_Write
+ */
+int mtdn_backup_Read(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff);
+
+/**\ingroup mtdn_backup_Write
+ * \~english @par Brief
+ * Write data to norflash device.
+ * \~english @param [in] path_name
+ * const char* - Device path to write(such as "/dev/mtd")
+ * \~english @param [in] i_id
+ * int - Main block ID(0, 2, 4, ...)
+ * \~english @param [in] i_offset
+ * int - Data offset
+ * \~english @param [in] i_size
+ * int - Data size to write
+ * \~english @param [in] p_buff
+ * Void* - Buffer for storing written data
+ * \~english @retval RET_DEV_NORMAL OK
+ * \~english @retval RET_DEV_ERROR Get device error
+ * \~english @retval RET_DEV_ERR_PARAM Parameter error
+ * \~english @retval RET_DEV_WT_ERR_OTHER Other error
+ * \~english @retval RET_DEV_WT_ERR Internal error
+ * \~english @par Preconditions
+ * - There is no preconditions for this API.
+ * \~english @par Change of internal state
+ * - Change of internal state according to the API does not occur.
+ * \~english @par Conditions of processing failure
+ * - Parameter path_name is NULL. [RET_DEV_ERR_PARAM]
+ * - Parameter p_buff is NULL. [RET_DEV_ERR_PARAM]
+ * - Value of parameter i_id is less than 0. [RET_DEV_ERR_PARAM]
+ * - Value of parameter i_offset is less than 0 or value of parameter i_size
+ * is not greater than 0. [RET_DEV_ERR_PARAM]
+ * - Device specified by path_name is invalid. [RET_DEV_ERR_PARAM]
+ * - Sum value of i_offset and i_size is greater than block size - 16byte.
+ * [RET_DEV_ERR_PARAM]
+ * - Failed to get device info. [RET_DEV_ERROR]
+ * - Internal processing error(Other error). [RET_DEV_WT_ERR_OTHER]
+ * - Internal IO error(open, write, close, ioctl, malloc, lseek).
+ * [RET_DEV_WT_ERR]
+ * \~english @par Detail
+ * - This API writes data to main and backup blocks according to specified\n
+ * norflash device pathname and main block ID.
+ * \~english @par
+ * - When this API is executed, p_buff data will be write to main and backup\n
+ * blocks. If failed to write any block, return RET_DEV_WT_ERR.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync Only
+ * \~english @see mtdn_backup_Read
+ */
+int mtdn_backup_Write(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff);
+
+#if defined(__cplusplus)
+}
+#endif // __cplusplus
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_NOR_BACKUP_H_
diff --git a/video_in_hal/systemservice/rom_access_library/library/include/system_service/rom_access_library.h b/video_in_hal/systemservice/rom_access_library/library/include/system_service/rom_access_library.h
new file mode 100755
index 0000000..50e44b1
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/include/system_service/rom_access_library.h
@@ -0,0 +1,47 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file rom_access_library.h
+ * @brief This file include all head file of rom and nor access library
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef SYSTEMSERVICE_ROMACCESSLIBRARY_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_ROMACCESSLIBRARY_H_
+
+#include "system_service/nor_backup.h"
+
+#include "system_service/ss_sm_rom_access.h"
+#include "system_service/ss_sm_boot_access.h"
+#include "system_service/ss_sm_ram_access.h"
+
+#endif // SYSTEMSERVICE_ROMACCESSLIBRARY_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h b/video_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h
new file mode 100755
index 0000000..bac051c
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h
@@ -0,0 +1,362 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_boot_access.h
+ * @brief This file provides API for get boot information from nor flash
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_BOOT_ACCESS_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_BOOT_ACCESS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+// Top memory map of LINUX management outside domain (SYS area)
+// Must not use it other than the model of C language specifications to refer to BOOT
+
+#define LBM_UINT32 unsigned int
+#define LBM_UINT16 uint16_t
+#define LBM_UINT8 unsigned char
+#define LBM_INT64 int64_t
+#define LBM_INT32 unsigned int
+#define LBM_INT16 uint16_t
+#define LBM_INT8 unsigned char
+
+// Each domain size
+#define LBM_NOR_MIRROR_SIZE 0x10000 // MIRROR area of NOR
+#define LBM_DRAM_SIZE 0x10000 // RAM area to share with BOOT in LINUX
+
+#define LBM_NOR_BOOT_SIZE 128
+#define LBM_NOR_TSKM_SIZE 128
+#define LBM_NOR_VUP_SIZE 1024
+#define LBM_NOR_ANA_SIZE 32
+#define LBM_NOR_VEHI_SIZE 32
+#define LBM_NOR_DEVMGR_SIZE 32
+
+
+//********* Value of the field ****************
+/* SDRAMstart identification */
+#define SYSUP_DRAM_NORMAL (LBM_UINT32)0x4E524E52 /* normal value NRNR*/
+#define SYSUP_DRAM_SFTERRSR (LBM_UINT32)0x73667366 /* abnormal Soft Reset(softwareabnormality) sfsf*/
+#define SYSUP_DRAM_DISCARD (LBM_UINT32)0x44434443 /* need to discard backup DCDC*/
+
+/* Start is in a state (navigator initial use)/System start state */
+#define SYSUP_CND_FACTRESET (LBM_UINT16)0x434c /* COLD START */
+#define SYSUP_CND_NORMAL (LBM_UINT16)0x4853 /* HOT START */
+
+/* Start mode preservation table level */
+#define SYSUP_MODE_NORMAL (LBM_UINT32)0x4E524E52 /* normal mode */
+#define SYSUP_MODE_VERUP (LBM_UINT32)0x56555655 /* versionup mode */
+
+/* Communication state between NAVI-SYS */
+#define SUBCPU_STS_NOMAL (LBM_UINT32)0x00000000 /* Communication normal */
+#define SUBCPU_STS_COMNG (LBM_UINT32)0x88888888 /* Communication abnormal */
+
+/* SDRAM power supply abnormality detection */
+#define SDRAM_STS_NOMAL (LBM_UINT32)0x11111111 /* backup power supply is normal */
+#define SDRAM_STS_BUPNG (LBM_UINT32)0x99999999 /* backup power supply is abnormal */
+
+/* HWDT Outbreak */
+#define HWDT_STS_NOMAL (LBM_UINT32)0x22222222 /* WDT normal */
+#define HWDT_STS_WDTTO (LBM_UINT32)0xAAAAAAAA /* WDT time-out outbreak */
+
+/* SWDT Outbreak */
+#define SWDT_STS_NOMAL HWDT_STS_NOMAL /* SWDT normal */
+#define SWDT_STS_WDTTO HWDT_STS_WDTTO /* SWDT time-out outbreak */
+
+/* Start side */
+#define IFS_PROG1_CODE (LBM_UINT8)0xAA /* Side PROG1 */
+#define IFS_PROG2_CODE (LBM_UINT8)0x55 /* Side PROG2 */
+
+/* Start infomation ID */
+#define UPTBLE_ID_MAX (LBM_UINT8)0x20 /* LBM_UPTBLINFO Maximum value */
+#define UPTBLE_ID_NORBOOT (LBM_UINT8)0x00 /* NOR-BOOT ID */
+#define UPTBLE_ID_SCRLDR (LBM_UINT8)0x01 /* SecureLoader ID */
+#define UPTBLE_ID_NANDBOOT (LBM_UINT8)0x02 /* NAND-BOOT ID */
+#define UPTBLE_ID_ROOTFS (LBM_UINT8)0x03 /* Rootfs1 ID */
+#define UPTBLE_ID_ROOTFS2 (LBM_UINT8)0x04 /* Rootfs2 ID */
+
+/* Start status */
+#define STUP_STS_NORMAL (LBM_UINT32)0x00000000 /* normal status */
+/* Rollback of protectionism is necessary by abnormal reset repetition */
+#define STUP_STS_ERROR_DETEC (LBM_UINT32)0x22222222
+#define STUP_STS_UPDATING (LBM_UINT32)0x33333333 /* updating status */
+/* not for use(will be removed) */
+#define STUP_STS_SIGNVRFY_ERROR (LBM_UINT32)0x11111111
+
+/* mdUpdate/sdUpdate */
+#define UPDATE_NOTI_NONE (LBM_UINT32)0x00000000 /* Notify is NOT required. */
+#define UPDATE_NOTI_EXIST (LBM_UINT32)0xEEEEEEEE /* Notify is required. */
+
+/* RAM Judge Flag */
+#define RAMJUDGE_STS_NOMAL (LBM_UINT32)0x44444444 /* RAM Judge Port is High */
+#define RAMJUDGE_STS_NG (LBM_UINT32)0xDDDDDDDD /* RAM Judge Port is Low */
+
+/* DRAM Self Refresh */
+#define SELF_REFRESH_OK (LBM_UINT32)0x55555555 /* DRAM Self Refresh is OK */
+#define SELF_REFRESH_NG (LBM_UINT32)0xCCCCCCCC /* DRAM Self Refresh is NG */
+
+/* Release ROM type */
+#define PRODUCTROM (LBM_UINT32)0x11111111
+#define RELEASEROM (LBM_UINT32)0x22222222
+#define RELEASEROM_REMAIN_USBBOOT (LBM_UINT32)0x44444444
+#define DEBUGROM (LBM_UINT32)0x88888888
+
+/* Boot write Nor */
+#define WRITE_NONE (LBM_UINT32)0x00000000
+#define WRITE_DONE (LBM_UINT32)0x11111111
+
+
+/* opdtLoadSatus */
+#define DEFAULT_OPIMAGE_DRAM_BACKUPED (LBM_UINT32)0x00000000
+#define DEFAULT_OPIMAGE_FROM_EMMC (LBM_UINT32)0xAAAAAAAA
+#define SPECIFIC_OPIMAGE_DRAM_BACKUPED (LBM_UINT32)0x11111111
+#define SPECIFIC_OPIMAGE_FROM_EMMC (LBM_UINT32)0xBBBBBBBB
+
+/* opdtLoadFactor */
+#define SPECIFIC_OPIMAGE_FLAG_NONE (LBM_UINT32)0x00000000
+#define SPECIFIC_OPIMAGE_FILE_NONE (LBM_UINT32)0x11111111
+#define SPECIFIC_OPIMAGE_FILESIZE_0 (LBM_UINT32)0x22222222
+#define SPECIFIC_OPIMAGE_FILE_EXIST (LBM_UINT32)0xEEEEEEEE
+
+
+#pragma pack(push, 4)
+
+// Memory map of the SYS area of the mem0
+
+#define SS_SYS_AREA_BOOT_MAX_SIZE (0x00010000UL)
+
+#define SS_SYS_AREA_ROM_OFFSET (0x00010000UL)
+#define SS_SYS_AREA_ROM_MAX_SIZE (0x00001000UL)
+
+#define SS_SYS_AREA_RAM_OFFSET (0x00011000UL)
+#define SS_SYS_AREA_RAM_MAX_SIZE (0x00001000UL)
+
+//********* NOR area ****************
+typedef struct LBM_boot_wpinfo_t {
+ LBM_UINT32 currentside; // IFS_PROG*_CODE
+ LBM_UINT32 stupStsA; // STUP_STS_*
+ LBM_UINT32 stupStsB; // STUP_STS_*
+}LBM_UPTBLINFO;
+
+typedef struct LBM_boot_t {
+ LBM_UINT32 sts1; // SYSUP_CND_*
+ LBM_UINT32 btmode; // SYSUP_MODE_*
+ LBM_UINT32 sts2; // SYSUP_CND_*
+ LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX];
+ LBM_UINT32 sts3; // SYSUP_CND_*
+}LBM_NOR_t;
+
+//********* DRAM area ****************
+typedef struct _tmb_ram_t {
+ LBM_UINT32 dram1; // SYSUP_DRAM_*
+ LBM_UINT32 sts; // SYSUP_CND_*
+ LBM_UINT32 upmode; // SYSUP_MODE_*
+ LBM_UINT32 dram2; // SYSUP_DRAM_*
+ LBM_UINT32 syscomSts; // SUBCPU_STS_*
+ LBM_UINT32 pwSts; // SDRAM_STS_*
+ LBM_UINT32 hwdtSts; // HWDT_STS_*
+ LBM_UINT32 dram3; // SYSUP_DRAM_*
+ LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX];
+ LBM_UINT32 sectorNo; // NOR Shared SectorNo
+ LBM_UINT32 mdUpdate; // UPDATE_NOTI_* LanServer Update Notification
+ LBM_UINT32 sdUpdate; // UPDATE_NOTI_* SettingService Update Notification
+ LBM_UINT32 ramjudgeSts; // RAMJUDGE_STS_*
+ LBM_UINT32 swdtSts; // SWDT_STS_*
+ LBM_UINT32 dram_self_refresh; // DRAM Self Refresh
+ LBM_UINT32 releaseNorType;
+ LBM_UINT32 socCpuType; // H2/E2/M2
+ LBM_UINT32 socEsNumber; // ES1x/ES2x/ES3x
+ LBM_UINT32 spiBootDevice; // NorDeviceID
+ LBM_UINT32 bootNorWrite; // uboot-api
+ LBM_UINT32 naviDetFactor;
+
+ LBM_UINT32 emmcTap; //emmcTap
+ LBM_UINT32 opdtUpdateReq;
+ LBM_UINT32 opdtLoadSatus;
+ LBM_UINT32 opdtLoadFactor;
+
+}LBM_RAM_t;
+
+#pragma pack(pop)
+
+
+/**
+* \~english Access type to the boot information
+*/
+typedef enum {
+ BAI_OPEN_RO, /* \~english Access type for the Read only*/
+ BAI_OPEN_RW /* \~english Access type for the Read and Write*/
+}BAI_OPEN_t;
+
+/**
+ * @class BOOT_AccessIf
+ * \~english @brief BOOT_AccessIf
+ * \~english @par Brief Introduction
+ * Class to provide the function of BOOT AccessIf
+ *
+ */
+class BOOT_AccessIf{
+ private:
+ static void* g_m_plock;
+ BAI_OPEN_t m_type;
+
+ public:
+ /**
+ * \ingroup BOOT_AccessIf
+ * \~english @par Summary:
+ * Obtain the access permission to the boot information (secondary storage area).
+ * \~english @param [in] type
+ * BAI_OPEN_t - Access type to the boot information\n
+ * \~english @par
+ * BAI_OPEN_t
+ * - BAI_MTD_DEV_RO Access type for the Read only \n
+ * - BAI_MTD_DEV_RW Access type for the Read and Write
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * None
+ * \~english @par Detail:
+ * Obtain the access permission to the boot information \n
+ * When the access permission is locked, the API waits for Mutex until the access permission is released. \n
+ * This API is assumed to be called by SystemManager.
+ * \~english @see ~BOOT_AccessIf, CL_LockMap, CL_LockGet
+ */
+explicit BOOT_AccessIf(BAI_OPEN_t type);
+
+ /**
+ * \ingroup ~BOOT_AccessIf
+ * \~english @par Summary:
+ * Release the access permission to the boot information (secondary storage area).
+ * \~english @param None
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * None
+ * \~english @par Detail:
+ * Release the access permission to the boot information.\n
+ * \~english @see BOOT_AccessIf, CL_LockRelease
+ */
+ ~BOOT_AccessIf();
+
+/**
+ * \ingroup getBootInfo
+ * \~english @par Summary:
+ * Read the boot information (secondary storage area).
+ * \~english @param [out] p_boot_info
+ * LBM_NOR_t * - Destination buffer to read the boot information
+ * \~english @par
+ * LBM_NOR_t Structure body
+ * \~english @code
+ * typedef struct LBM_boot_t{
+ * LBM_UINT32 sts1; //SYSUP_CND_*
+ * LBM_UINT32 btmode; //SYSUP_MODE_*
+ * LBM_UINT32 sts2; //SYSUP_CND_*
+ * LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX];
+ * LBM_UINT32 sts3; //SYSUP_CND_*
+ * }LBM_NOR_t;
+ * @endcode
+ * Refer to "ss_boot_map.h" for the parameters to be set to the member of struct LBM_NOR_t.
+ * \~english @retval eFrameworkunifiedStatusOK Reading success
+ * \~english @retval eFrameworkunifiedStatusFail Reading failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If p_boot_info is NULL [eFrameworkunifiedStatusFail]
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Copy the boot information stored in the secondary storage area to p_boot_info. \n
+ * \~english @see setBootInfo
+ */
+ EFrameworkunifiedStatus getBootInfo(LBM_NOR_t* p_boot_info);
+
+ /**
+ * \ingroup setBootInfo
+ * \~english @par Summary:
+ * Write the boot information (secondary storage area).
+ * \~english @param [in] p_boot_info
+ * LBM_NOR_t * - Original buffer to write the boot information
+ * \~english @par
+ * LBM_NOR_tStructure body
+ * \~english @code
+ * typedef struct LBM_boot_t{
+ * LBM_UINT32 sts1; //SYSUP_CND_*
+ * LBM_UINT32 btmode; //SYSUP_MODE_*
+ * LBM_UINT32 sts2; //SYSUP_CND_*
+ * LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX];
+ * LBM_UINT32 sts3; //SYSUP_CND_*
+ * }LBM_NOR_t;
+ * @endcode
+ * Refer to "ss_boot_map.h" for the parameters to be set to the member of struct LBM_NOR_t.
+ * \~english @retval eFrameworkunifiedStatusOK Write success
+ * \~english @retval eFrameworkunifiedStatusFail Write failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If p_boot_info is NULL [eFrameworkunifiedStatusFail]
+ * - BOOT_AccessIf Opened secondary storage area with BAI_MTD_DEV_RO [eFrameworkunifiedStatusFail]
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Write the boot information stored in p_boot_info to the secondary storage area. \n
+ * \~english @see getBootInfo
+ */
+ EFrameworkunifiedStatus setBootInfo(LBM_NOR_t* p_boot_info);
+};
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_BOOT_ACCESS_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h b/video_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h
new file mode 100755
index 0000000..f96966b
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h
@@ -0,0 +1,235 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_ram_access.h
+ * @brief This file provides API for get ram information from extension memory
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_RAM_ACCESS_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_RAM_ACCESS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+/**
+ * \~english max length of ram product private
+ */
+#define RAM_PRODUCT_PRIVATE_MAX (96)
+/**
+ * \~english max length of order file name
+ */
+#define SS_SM_ORDER_NAME_MAX (32)
+
+/**
+ * \~english System management information
+ */
+typedef struct {
+ char signature_in[4];
+ BOOL isImmediateReset;
+ BOOL needRenotifyStartPrm;
+ uint32_t lastWakeupType;
+ uint32_t lastDramBackupStatus;
+ uint32_t lastResetStatus;
+ char productPrivate[RAM_PRODUCT_PRIVATE_MAX];
+ char order_name[SS_SM_ORDER_NAME_MAX];
+ BOOL isErrorReset;
+ char signature_out[4];
+}RAM_SM_INFO_t;
+
+/**
+ * \~english System wakeup state type
+ */
+typedef enum {
+ RAM_WAKEUP_STATE_DONT_CARE = 0, /* \~english Don't care wakeup state*/
+ RAM_WAKEUP_STATE_BACKUP_NG, /* \~english Wakeup state is backup NG*/
+ RAM_WAKEUP_STATE_BATTERY_DOWN /* \~english Wakeup state is battery down*/
+}RAM_WAKEUP_STATE;
+
+/**
+ * @class RAM_AccessIf
+ * \~english @brief RAM_AccessIf
+ * \~english @par Brief Introduction
+ * Class to provide the function of RAM AccessIf
+ *
+ */
+class RAM_AccessIf{
+ private:
+ static void* g_m_plock;
+ static void* g_m_bakup_map;
+ static bool g_m_is_first_access;
+ RAM_SM_INFO_t m_buf;
+ bool m_dirty;
+ void initRamBackupEnable(RAM_WAKEUP_STATE wup_state);
+ void finalRamBackupEnable(void);
+
+ public:
+/**
+ * \ingroup RAM_AccessIf
+ * \~english @par Summary:
+ * Obtain the access permission to the system management information.
+ * \~english @param [in] wup_state
+ * RAM_WAKEUP_STATE - System maneger wakeup state type
+ * \~english @par
+ * RAM_WAKEUP_STATE
+ * - RAM_WAKEUP_STATE_DONT_CARE Don't care wakeup state\n
+ * - RAM_WAKEUP_STATE_BACKUP_NG Wakeup state is backup NG\n
+ * - RAM_WAKEUP_STATE_BATTERY_DOWN Wakeup state is battery down
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * None
+ * \~english @par Detail:
+ * Obtain the access permission to the system management information \n
+ * When the access permission is locked, the API waits for Mutex until the access permission is released. \n
+ * This API is supposed to be called by SystemManager.
+ * \~english @see ~RAM_AccessIf, CL_LockMap, CL_LockGet
+ */
+explicit RAM_AccessIf(RAM_WAKEUP_STATE wup_state = RAM_WAKEUP_STATE_DONT_CARE);
+
+/**
+ * \ingroup ~RAM_AccessIf
+ * \~english @par Summary:
+ * Release the access permission to the system management information.
+ * \~english @param None
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * None
+ * \~english @par Detail:
+ * Release the access permission to the system management information.\n
+ * \~english @see RAM_AccessIf, CL_LockRelease
+ */
+ ~RAM_AccessIf();
+
+/**
+ * \ingroup getRamInfo
+ * \~english @par Summary:
+ * Read the system management information.
+ * \~english @param [out] p_boot_info
+ * RAM_SM_INFO_t * - Destination buffer to read the system management information.
+ * \~english @par
+ * RAM_SM_INFO_t Structure body
+ * \~english @code
+ * typedef struct {
+ * char signature_in[4];
+ * BOOL isImmediateReset;
+ * BOOL needRenotifyStartPrm;
+ * uint32_t lastWakeupType;
+ * uint32_t lastDramBackupStatus;
+ * uint32_t lastResetStatus;
+ * char productPrivate[RAM_PRODUCT_PRIVATE_MAX];
+ * char order_name[SS_SM_ORDER_NAME_MAX];
+ * BOOL isErrorReset;
+ * char signature_out[4];
+ * }RAM_SM_INFO_t;
+ * @endcode
+ * \~english @retval eFrameworkunifiedStatusOK Reading success
+ * \~english @retval eFrameworkunifiedStatusFail Reading failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If p_boot_info is NULL [eFrameworkunifiedStatusFail]
+ * - If read data from secondary storage area or /nv/BS/ss/rom_access_library/rwdata/ramdata.dat
+ * failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Copy the system information stored in the secondary storage area or
+ * in /nv/BS/ss/rom_access_library/rwdata/ramdata.dat to p_boot_info. \n
+ * \~english @see setRamInfo
+ */
+ EFrameworkunifiedStatus getRamInfo(RAM_SM_INFO_t* p_boot_info);
+
+/**
+ * \ingroup setRamInfo
+ * \~english @par Summary:
+ * Write the system management information.
+ * \~english @param [in] p_boot_info
+ * RAM_SM_INFO_t * - Original buffer to write the system management information
+ * \~english @par
+ * RAM_SM_INFO_t Structure body
+ * \~english @code
+ * typedef struct {
+ * char signature_in[4];
+ * BOOL isImmediateReset;
+ * BOOL needRenotifyStartPrm;
+ * uint32_t lastWakeupType;
+ * uint32_t lastDramBackupStatus;
+ * uint32_t lastResetStatus;
+ * char productPrivate[RAM_PRODUCT_PRIVATE_MAX];
+ * char order_name[SS_SM_ORDER_NAME_MAX];
+ * BOOL isErrorReset;
+ * char signature_out[4];
+ * }RAM_SM_INFO_t;
+ * @endcode
+ * \~english @retval eFrameworkunifiedStatusOK Write success
+ * \~english @retval eFrameworkunifiedStatusFail Write failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If p_boot_info is NULL [eFrameworkunifiedStatusFail]
+ * - If write data to secondary storage area or /nv/BS/ss/rom_access_library/rwdata/ramdata.dat
+ * failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Write the system manegement information stored in p_boot_info to the
+ * secondary storage area or /nv/BS/ss/rom_access_library/rwdata/ramdata.dat. \n
+ * \~english @see getRamInfo
+ */
+ EFrameworkunifiedStatus setRamInfo(RAM_SM_INFO_t* p_boot_info);
+};
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_RAM_ACCESS_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h b/video_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h
new file mode 100755
index 0000000..4ba1a76
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h
@@ -0,0 +1,1010 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ss_sm_rom_access.h
+ * @brief This file provides API for get rom information from extension memory
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup rom_access_library
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_ROM_ACCESS_H_
+#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_ROM_ACCESS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+#include "system_service/ss_sm_boot_access.h"
+
+/**
+ * \~english boot mode information
+ */
+typedef enum {
+ APPLICATION_MODE = 0,
+ PROGRAMMING_MODE
+}EBOOT_MODE;
+
+/**
+ * \~english active flash load information
+ */
+typedef enum {
+ NEW_FLASHLOADER = 0,
+ OLD_FLASHLOADER
+}EACTIVE_FLASHLOADER;
+
+/**
+ * \~english user mode information
+ */
+typedef enum {
+ USER_OFF = 0,
+ USER_ON
+}EUSER_MODE;
+
+/**
+ * \~english control mode information
+ */
+typedef enum {
+ DISABLE_MODE = 0,
+ ENABLE_MODE
+}ECONTROL_MODE;
+
+/**
+ * \~english data reset mode information
+ */
+typedef enum {
+ DATARESET_NONE = 0,
+ DATARESET_USER,
+ DATARESET_FACTORY
+}EDATARESET_MODE;
+
+/**
+ * \~english last illegal reset mode information
+ */
+typedef enum {
+ LAST_ILGRESET_NORMAL = 0,
+ LAST_ILGRESET_NG
+}ELASTILGRESET_MODE;
+
+/**
+ * \~english Program update state information
+ */
+typedef uint32_t EPROGUPDATE_STATE;
+
+/**
+ * \~english next wakeup type
+ */
+typedef enum {
+ NEXT_WAKEUP_TYPE_NONE = 0,
+ NEXT_WAKEUP_TYPE_COLD,
+ NEXT_WAKEUP_TYPE_HOT,
+}ENEXT_WAKEUP_TYPE;
+
+/**
+ * \~english DRAM backup state
+ */
+typedef enum {
+ DRAM_BACKUP_STATE_OK = 0,
+ DRAM_BACKUP_STATE_NG
+}DRAM_BACKUP_STATE;
+
+/**
+ * \~english max length of rom product private
+ */
+#define ROM_PRODUCT_PRIVATE_MAX 128
+
+/**
+ * @class ROM_AccessIf
+ * \~english @brief ROM_AccessIf
+ * \~english @par Brief Introduction
+ * Class to provide the function of ROM AccessIf
+ *
+ */
+class ROM_AccessIf {
+ private:
+ BOOT_AccessIf* m_pBoot;
+ static void* g_m_plock;
+ static void* g_m_bakup_map;
+ static bool g_m_is_dram_valid;
+ LBM_NOR_t m_nor;
+ bool m_norIsDirty;
+
+ EFrameworkunifiedStatus LBA_Read(UI_32 offset, UI_32* buffer, UI_32 word_count);
+
+ EFrameworkunifiedStatus LBA_Write(UI_32 offset, UI_32 value);
+
+ EFrameworkunifiedStatus LBA_Write(UI_32 offset, UI_32* value, UI_32 size);
+
+ EFrameworkunifiedStatus GetDataResetMode_sub(EDATARESET_MODE* p_data_reset_mode);
+
+ public:
+/**
+ * \ingroup ROM_AccessIf
+ * \~english @par Summary:
+ * Obtain the access permission to SYS area (secondary storage area).
+ * \~english @param None
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * None
+ * \~english @par Detail:
+ * Obtain the access permission to SYS area. \n
+ * When the access permission is locked, the API watis for Mutex until the access permission is released. \n
+ * This API is assumed to be called by the SystemManager.
+ * \~english @see ~ROM_AccessIf, CL_LockMap, CL_LockGet
+ */
+ ROM_AccessIf();
+
+/**
+ * \ingroup ~ROM_AccessIf
+ * \~english @par Summary:
+ * Release the access permission to SYS area (secondary storage area).
+ * \~english @param None
+ * \~english @retval None
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - None
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * None
+ * \~english @par Detail:
+ * Release the access permission to SYS area.
+ * \~english @see ROM_AccessIf, CL_LockRelease
+ */
+ ~ROM_AccessIf();
+
+/**
+ * \ingroup Initialize
+ * \~english @par Summary:
+ * Synchronize SYS area (secondary storage area) and the mirror data in DRAM
+ * \~english @param None
+ * \~english @retval eFrameworkunifiedStatusOK Synchronization success
+ * \~english @retval eFrameworkunifiedStatusFail Synchronization failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If system call mmap failed. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Prepare the access to SYS area. \n
+ * \~english @see EL_mem_exram_mmap
+ */
+ EFrameworkunifiedStatus Initialize();
+
+/**
+ * \ingroup SetProductPrivate
+ * \~english @par Summary:
+ * Write data information depending on the product specification to the secondary storage area.
+ * \~english @param [in] buf[ROM_PRODUCT_PRIVATE_MAX]
+ * UI_8[] - Data information depending on the product specification
+ * \~english @par
+ * Definition of ROM_PRODUCT_PRIVATE_MAX
+ * \~english @code
+ * #define ROM_PRODUCT_PRIVATE_MAX 128
+ * @endcode
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Write data information depending on the product specification to the secondary storage area. \n
+ * \~english @see GetProductPrivate
+ */
+ EFrameworkunifiedStatus SetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]);
+
+/**
+ * \ingroup GetProductPrivate
+ * \~english @par Summary:
+ * Read the data information depending on the product specification from the secondary storage area.
+ * \~english @param [out] buf[ROM_PRODUCT_PRIVATE_MAX]
+ * UI_8[] - Storing destination of data information depending on the product specification
+ * \~english @par
+ * Definition of ROM_PRODUCT_PRIVATE_MAX
+ * \~english @code
+ * #define ROM_PRODUCT_PRIVATE_MAX 128
+ * @endcode
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Read data information depending on the product specification from the secondary storage area. \n
+ * \~english @see SetProductPrivate
+ */
+ EFrameworkunifiedStatus GetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]);
+
+/**
+ * \ingroup SystemInitialize
+ * \~english @par Summary:
+ * Initialize the handles used for ROM access.
+ * \~english @param [in] bkup_state
+ * \~english @par
+ * DRAM_BACKUP_STATE
+ * - DRAM_BACKUP_STATE_OK
+ * - DRAM_BACKUP_STATE_NG
+ * \~english @retval eFrameworkunifiedStatusOK Initialize the handles used for ROM access success
+ * \~english @retval eFrameworkunifiedStatusFail Initialize the handles used for ROM access failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If system call mmap failed. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Initialize the handles used for ROM access. \n
+ * \~english @see EL_mem_exram_mmap
+ */
+ EFrameworkunifiedStatus SystemInitialize(DRAM_BACKUP_STATE bkup_state);
+
+/**
+ * \ingroup GetBootMode
+ * \~english @par Summary:
+ * Get boot mode information.
+ * \~english @param [out] p_boot_mode
+ * EBOOT_MODE* - Destination buffer to store information of boot mode.
+ * \~english @par
+ * EBOOT_MODE
+ * - APPLICATION_MODE
+ * - PROGRAMMING_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get boot mode information from the secondary storage area. \n
+ * \~english @see SetBootMode
+ */
+ EFrameworkunifiedStatus GetBootMode(EBOOT_MODE* p_boot_mode);
+
+/**
+ * \ingroup SetBootMode
+ * \~english @par Summary:
+ * Set boot mode information.
+ * \~english @param [in] boot_mode
+ * EBOOT_MODE - Boot mode information which write to the secondary storage area.
+ * \~english @par
+ * EBOOT_MODE
+ * - APPLICATION_MODE
+ * - PROGRAMMING_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set boot mode information to the secondary storage area. \n
+ * \~english @see GetBootMode
+ */
+ EFrameworkunifiedStatus SetBootMode(EBOOT_MODE boot_mode);
+
+/**
+ * \ingroup GetSignature
+ * \~english @par Summary:
+ * Get signature information.
+ * \~english @param [out] p_sig_value
+ * UI_32 - Destination buffer to store signature information
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write signature information to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get signature information from the secondary storage area. \n
+ * \~english @see SetSignature
+ */
+ EFrameworkunifiedStatus GetSignature(UI_32* p_sig_value);
+
+/**
+ * \ingroup SetSignature
+ * \~english @par Summary:
+ * Set signature information.
+ * \~english @param [in] sig_value
+ * UI_32 - Signature information which write to the secondary storage area.
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write signature information to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set signature information to the secondary storage area. \n
+ * \~english @see GetSignature
+ */
+ EFrameworkunifiedStatus SetSignature(UI_32 sig_value);
+
+/**
+ * \ingroup SetActiveFlashloader
+ * \~english @par Summary:
+ * Set active flash loader information.
+ * \~english @param [in] active_flash_loader
+ * EACTIVE_FLASHLOADER - Active flash loader information which write to secondary storage area.
+ * \~english @par
+ * EBOOT_MODE
+ * - APPLICATION_MODE
+ * - PROGRAMMING_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set active flash loader information to the secondary storage area. \n
+ * \~english @see GetBootMode
+ */
+ EFrameworkunifiedStatus SetActiveFlashloader(EACTIVE_FLASHLOADER active_flash_loader);
+
+/**
+ * \ingroup GetLastUserMode
+ * \~english @par Summary:
+ * Get last user mode information.
+ * \~english @param [out] p_user_mode
+ * EUSER_MODE* - Destination buffer to store information of user mode.
+ * \~english @par
+ * EUSER_MODE
+ * - USER_ON
+ * - USER_OFF
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get last user mode information from the secondary storage area. \n
+ * \~english @see SetLastUserMode
+ */
+ EFrameworkunifiedStatus GetLastUserMode(EUSER_MODE* p_user_mode);
+
+/**
+ * \ingroup SetLastUserMode
+ * \~english @par Summary:
+ * Set last user mode information.
+ * \~english @param [in] user_mode
+ * EUSER_MODE - User mode information which write to the secondary storage area.
+ * \~english @par
+ * EUSER_MODE
+ * - USER_ON
+ * - USER_OFF
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set last user mode information to the secondary storage area. \n
+ * \~english @see GetLastUserMode
+ */
+ EFrameworkunifiedStatus SetLastUserMode(EUSER_MODE user_mode);
+
+/**
+ * \ingroup GetTransportMode
+ * \~english @par Summary:
+ * Get transport mode information.
+ * \~english @param [out] p_control_mode
+ * ECONTROL_MODE* - Destination buffer to store information of transport mode.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get transport mode information from the secondary storage area. \n
+ * \~english @see SetTransportMode
+ */
+ EFrameworkunifiedStatus GetTransportMode(ECONTROL_MODE* p_control_mode);
+
+/**
+ * \ingroup SetTransportMode
+ * \~english @par Summary:
+ * Set transport mode information.
+ * \~english @param [in] control_mode
+ * ECONTROL_MODE - Transport mode information which write to the secondary storage area.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set transport mode information to the secondary storage area. \n
+ * \~english @see GetTransportMode
+ */
+ EFrameworkunifiedStatus SetTransportMode(ECONTROL_MODE control_mode);
+
+/**
+ * \ingroup GetProductionMode
+ * \~english @par Summary:
+ * Get production mode information.
+ * \~english @param [out] p_control_mode
+ * ECONTROL_MODE* - Destination buffer to store information of production mode.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get production mode information from the secondary storage area. \n
+ * \~english @see SetProductionMode
+ */
+ EFrameworkunifiedStatus GetProductionMode(ECONTROL_MODE* p_control_mode);
+
+/**
+ * \ingroup SetProductionMode
+ * \~english @par Summary:
+ * Set transport mode information.
+ * \~english @param [in] control_mode
+ * ECONTROL_MODE - Production mode information which write to the secondary storage area.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set production mode information to the secondary storage area. \n
+ * \~english @see GetProductionMode
+ */
+ EFrameworkunifiedStatus SetProductionMode(ECONTROL_MODE control_mode);
+
+/**
+ * \ingroup GetLimpHomeCutOffReqMode
+ * \~english @par Summary:
+ * Get limp home cut off request mode information.
+ * \~english @param [out] p_control_mode
+ * ECONTROL_MODE* - Destination buffer to store information of limp home cut off request mode.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get limp home cut off request mode information from the secondary storage area. \n
+ * \~english @see SetLimpHomeCutOffReqMode
+ */
+ EFrameworkunifiedStatus GetLimpHomeCutOffReqMode(ECONTROL_MODE* p_control_mode);
+
+/**
+ * \ingroup SetLimpHomeCutOffReqMode
+ * \~english @par Summary:
+ * Set limp home cut off request mode information.
+ * \~english @param [in] control_mode
+ * ECONTROL_MODE - Limp home cut off request mode information which write to the secondary storage area.
+ * \~english @par
+ * ECONTROL_MODE
+ * - DISABLE_MODE
+ * - ENABLE_MODE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set limp home cut off request mode information to the secondary storage area. \n
+ * \~english @see GetLimpHomeCutOffReqMode
+ */
+ EFrameworkunifiedStatus SetLimpHomeCutOffReqMode(ECONTROL_MODE control_mode);
+
+/**
+ * \ingroup GetDataResetMode
+ * \~english @par Summary:
+ * Get reserved data reset mode information.
+ * \~english @param [out] p_data_reset_mode
+ * EDATARESET_MODE* - Destination buffer to store information of reserved data reset mode.
+ * \~english @par
+ * EDATARESET_MODE
+ * - DATARESET_NONE
+ * - DATARESET_USER
+ * - DATARESET_FACTORY
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get reserved data reset mode information from the secondary storage area. \n
+ * \~english @see SetDataResetMode
+ */
+ EFrameworkunifiedStatus GetDataResetMode(EDATARESET_MODE* p_data_reset_mode);
+
+/**
+ * \ingroup GetDataResetModeFast
+ * \~english @par Summary:
+ * Get reserved data reset mode information faster.This api can get correct value before
+ * calling SetDataResetMode.So it shoud be used only immediately after boot.
+ * \~english @param [out] p_data_reset_mode
+ * EDATARESET_MODE* - Destination buffer to store information of reserved data reset mode faster.
+ * \~english @par
+ * EDATARESET_MODE
+ * - DATARESET_NONE
+ * - DATARESET_USER
+ * - DATARESET_FACTORY
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * - If system call mmap failed. [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get reserved data reset mode information faster from the secondary storage area.This api can get
+ * correct value before calling SetDataResetMode.So it shoud be used only immediately after boot.
+ * \~english @see SetDataResetMode
+ */
+ EFrameworkunifiedStatus GetDataResetModeFast(EDATARESET_MODE* p_data_reset_mode);
+
+/**
+ * \ingroup SetDataResetMode
+ * \~english @par Summary:
+ * Set reserve data reset mode information.
+ * \~english @param [in] data_reset_mode
+ * EDATARESET_MODE - Reserve data reset mode information which write to the secondary storage area.
+ * \~english @par
+ * EDATARESET_MODE
+ * - DATARESET_NONE
+ * - DATARESET_USER
+ * - DATARESET_FACTORY
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set reserve data reset mode information to the secondary storage area. \n
+ * \~english @see GetDataResetMode
+ */
+ EFrameworkunifiedStatus SetDataResetMode(EDATARESET_MODE data_reset_mode);
+
+/**
+ * \ingroup GetResetCount
+ * \~english @par Summary:
+ * Get reset count information.
+ * \~english @param [out] p_reset_count
+ * UI_32* - Destination buffer to store information of reset count.
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get reset count from the secondary storage area. \n
+ * \~english @see SetResetCount
+ */
+ EFrameworkunifiedStatus GetResetCount(UI_32* p_reset_count);
+
+/**
+ * \ingroup SetResetCount
+ * \~english @par Summary:
+ * Set reset count information.
+ * \~english @param [in] reset_count
+ * UI_32 - Reset count information which write to the secondary storage area.
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set reset count information to the secondary storage area. \n
+ * \~english @see GetResetCount
+ */
+ EFrameworkunifiedStatus SetResetCount(UI_32 reset_count);
+
+/**
+ * \ingroup GetLastIlgReset
+ * \~english @par Summary:
+ * Get last illegal reset information.
+ * \~english @param [out] p_last_ilg_reset
+ * ELASTILGRESET_MODE* - Destination buffer to store information of last illegal reset.
+ * \~english @par
+ * ELASTILGRESET_MODE
+ * - LAST_ILGRESET_NORMAL
+ * - LAST_ILGRESET_NG
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get last illegal reset information from the secondary storage area. \n
+ * \~english @see SetLastIlgReset
+ */
+ EFrameworkunifiedStatus GetLastIlgReset(ELASTILGRESET_MODE* p_last_ilg_reset);
+
+/**
+ * \ingroup SetLastIlgReset
+ * \~english @par Summary:
+ * Set last illegal reset information.
+ * \~english @param [in] last_ilg_reset
+ * ELASTILGRESET_MODE - Last illegal reset information which write to the secondary storage area.
+ * \~english @par
+ * ELASTILGRESET_MODE
+ * - LAST_ILGRESET_NORMAL
+ * - LAST_ILGRESET_NG
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set last illegal reset information to the secondary storage area. \n
+ * \~english @see GetLastIlgReset
+ */
+ EFrameworkunifiedStatus SetLastIlgReset(ELASTILGRESET_MODE last_ilg_reset);
+
+/**
+ * \ingroup GetProgUpdateState
+ * \~english @par Summary:
+ * Get program update status information.
+ * \~english @param [out] p_prog_update_state
+ * EPROGUPDATE_STATE* - Destination buffer to store information of program update status.
+ * \~english @par
+ * typedef uint32_t EPROGUPDATE_STATE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get program update status information from the secondary storage area. \n
+ * \~english @see SetProgUpdateState
+ */
+ EFrameworkunifiedStatus GetProgUpdateState(EPROGUPDATE_STATE* p_prog_update_state);
+
+/**
+ * \ingroup SetProgUpdateState
+ * \~english @par Summary:
+ * Set program update status information.
+ * \~english @param [in] prog_update_state
+ * EPROGUPDATE_STATE - Program update status information which write to the secondary storage area.
+ * \~english @par
+ * typedef uint32_t EPROGUPDATE_STATE
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Set program update status information to the secondary storage area. \n
+ * \~english @see GetProgUpdateState
+ */
+ EFrameworkunifiedStatus SetProgUpdateState(EPROGUPDATE_STATE prog_update_state);
+
+/**
+ * \ingroup GetErrLogCount
+ * \~english @par Summary:
+ * Get error logging count information.
+ * \~english @param [out] p_err_log_count
+ * UI_32* - Destination buffer to store information of error logging count.
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get error logging count information from the secondary storage area. \n
+ * \~english @see SetErrLogCount
+ */
+ EFrameworkunifiedStatus GetErrLogCount(UI_32* p_err_log_count);
+
+/**
+ * \ingroup SetErrLogCount
+ * \~english @par Summary:
+ * Get error logging count information.
+ * \~english @param [out] err_log_count
+ * UI_32* - Destination buffer to store information of error logging count.
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get error logging count information from the secondary storage area. \n
+ * \~english @see GetErrLogCount
+ */
+ EFrameworkunifiedStatus SetErrLogCount(UI_32 err_log_count);
+
+/**
+ * \ingroup GetNextWakeupType
+ * \~english @par Summary:
+ * Get next wakeup type information.
+ * \~english @param [out] p_next_wakeup_type
+ * ENEXT_WAKEUP_TYPE* - Destination buffer to store information of next wakeup type.
+ * \~english @par
+ * ENEXT_WAKEUP_TYPE
+ * - NEXT_WAKEUP_TYPE_NONE
+ * - NEXT_WAKEUP_TYPE_COLD
+ * - NEXT_WAKEUP_TYPE_HOT
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get next wakeup type information from the secondary storage area. \n
+ * \~english @see SetNextWakeupType
+ */
+ EFrameworkunifiedStatus GetNextWakeupType(ENEXT_WAKEUP_TYPE *p_next_wakeup_type);
+
+/**
+ * \ingroup SetNextWakeupType
+ * \~english @par Summary:
+ * Get next wakeup type information.
+ * \~english @param [out] next_wakeup_type
+ * ENEXT_WAKEUP_TYPE* - Destination buffer to store information of next wakeup type.
+ * \~english @par
+ * ENEXT_WAKEUP_TYPE
+ * - NEXT_WAKEUP_TYPE_NONE
+ * - NEXT_WAKEUP_TYPE_COLD
+ * - NEXT_WAKEUP_TYPE_HOT
+ * \~english @retval eFrameworkunifiedStatusOK Success
+ * \~english @retval eFrameworkunifiedStatusFail Failed
+ * \~english @par Precondition:
+ * - None
+ * \~english @par Change in the internal status:
+ * - The change in the internal status does not occur by this API.
+ * \~english @par Conditions of processing failure
+ * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail]
+ * \~english @par Classification:
+ * Public
+ * \~ english @par Type
+ * Sync only(None communication)
+ * \~english @par Detail:
+ * Get next wakeup type information from the secondary storage area. \n
+ * \~english @see GetNextWakeupType
+ */
+ EFrameworkunifiedStatus SetNextWakeupType(ENEXT_WAKEUP_TYPE next_wakeup_type);
+};
+
+#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_ROM_ACCESS_H_
+
+/** @}*/ // end of rom_access_library
+/** @}*/ // end of system_service
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/rom_access_library/library/nor/Makefile b/video_in_hal/systemservice/rom_access_library/library/nor/Makefile
new file mode 100755
index 0000000..f30c271
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/nor/Makefile
@@ -0,0 +1,46 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### search paths #############
+VPATH += src
+VPATH += ../include/$(COMPONENT_NAME)
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libssaccess
+
+######### headers to be installed(*.h) #############
+INST_HEADERS = nor_backup.h
+
+######### compiled sources #############
+libssaccess_SRCS = nor_backup.c
+
+######### add include path #############
+CPPFLAGS += -I../include/
+
+######### frameworkunifiedlog options #############
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+
+######### add compile option #############
+LINK_SHLIB_CXX := y
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+include ../../../system_service.mk
diff --git a/video_in_hal/systemservice/rom_access_library/library/nor/libBlkDev_API.ver b/video_in_hal/systemservice/rom_access_library/library/nor/libBlkDev_API.ver
new file mode 100755
index 0000000..5ebddcb
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/nor/libBlkDev_API.ver
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# CommonLib version script
+#
+{
+ global:
+ ### .text section ###
+ blkDrv_DirectReadData;
+ blkDrv_DirectWriteData;
+ blkDrv_GetBlockInfo;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/video_in_hal/systemservice/rom_access_library/library/nor/libssaccess.ver b/video_in_hal/systemservice/rom_access_library/library/nor/libssaccess.ver
new file mode 100755
index 0000000..c4bd070
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/nor/libssaccess.ver
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# CommonLib version script
+#
+{
+ global:
+ ### .text section ###
+ mtdn_backup_GetErCnt;
+ mtdn_backup_Read;
+ mtdn_backup_Write;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/video_in_hal/systemservice/rom_access_library/library/nor/src/nor_backup.c b/video_in_hal/systemservice/rom_access_library/library/nor/src/nor_backup.c
new file mode 100755
index 0000000..8a133b0
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/nor/src/nor_backup.c
@@ -0,0 +1,807 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+* $Header:: $
+* $Revision:: $
+*******************************************************************************/
+
+/*******************************************************************************
+@file mtd_backup.c
+@system
+@process
+@detail
+ ******************************************************************************/
+#include "system_service/nor_backup.h"
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <asm/unistd.h>
+#include <mtd/mtd-user.h>
+
+#define BACKUP_RETRY_CNT 3
+
+/* Invalid Value */
+#define FLSBACKUP_SEMAPHORE_INVALID (0)
+
+
+#define BACKUP_SECTOR_SIZ 1024 // Secter Size
+
+#define BACKUP_CHECK_OFFSET 16
+#define BACKUP_CHECK_SIZE 12
+#define BACKUP_CHECK_TEXT "MTD_BACKUPDT"
+#define BACKUP_CHECK_DAT1 1 // Lower 8bit
+#define BACKUP_CHECK_DAT2 2 // Upper 8bit
+
+#define NOR_ERRLOG(fmt, args...) \
+ fprintf(stderr, "[ERR]%ld/%s/%d/= "fmt"\n", syscall(__NR_gettid), __func__, __LINE__, ##args)
+
+static pthread_mutex_t g_semid_flash = PTHREAD_MUTEX_INITIALIZER; /* Semaphore ID of dram area access */
+static int g_backup_init = FLSBACKUP_SEMAPHORE_INVALID;
+
+typedef enum {
+ RET_WT_CHK_OK = 0,
+ RET_WT_ERR_OTHER,
+ RET_WT_DEV_ERR,
+} NOR_WRITE_BLK_CHK;
+
+typedef enum {
+ RET_RD_CHK_OK = 0,
+ RET_RD_ERR_OTHER,
+ RET_RD_DEV_ERR,
+ RET_RD_ERR_1 = -1,
+ RET_RD_ERR_2 = -2,
+ RET_RD_ERR_3 = -3,
+ RET_RD_ERR_4 = -4,
+} NOR_READ_BLK_CHK;
+
+typedef enum {
+ RET_CHK_OK = 0,
+ RET_CHK_TEXT_ERR,
+ RET_CHK_BCC_ERR,
+} NOR_BLK_CHK;
+
+typedef enum {
+ NOR_IDLE = 0, // 0:Read-out of block data
+ NOR_ORG_TEXT, // 1:OrgText Error
+ NOR_ORG_BCC, // 2:OrgBcc error
+ NOR_READ_OK, // 3:Normal read-out
+ NOR_READ_END // 4:end state
+} NOR_R_STATE;
+
+typedef enum {
+ NOR_IDEL = 0, // 0:IDEL
+ NOR_READ_ERR, // 1:Read Error
+ NOR_ORG_READ, // 2:Org Read OK
+ NOR_BAK_WRT, // 3:Bak Write OK
+ NOR_BACK_READ, // 4:Bak Read OK
+ NOR_ORG_WRITE, // 5:Org Write OK
+ NOR_WRITE_END // 6:end state
+} NOR_W_STATE;
+
+NOR_READ_BLK_CHK MtdnBackupReadSub(
+ const char * path_name, int i_id, int i_offset, int i_size,
+ void *p_buff, mtd_info_t * mtd_info, int * get_state);
+NOR_WRITE_BLK_CHK MtdnBackupWriteSub(
+ const char * path_name, int i_id, int i_offset, int i_size,
+ void *p_buff, mtd_info_t * mtd_info);
+
+int MtdnBackupWriteBase(
+ const char * path_name, int i_id, int i_offset, int i_size,
+ void *p_buff, mtd_info_t * mtd_info);
+int MtdnBackupReadBase(
+ const char * path_name, int i_id, int i_offset, int i_size,
+ void *p_buff, mtd_info_t * mtd_info);
+
+int MtdBackupInfo(const char * path_name, mtd_info_t * mtd_info); // INFO Get
+
+NOR_BLK_CHK MtdBackupCheksumRead(char * p_buff, int erase_size, int * ret_sum); // check SUM
+int MtdBackupCheksumWrite(char * p_buff, int erase_size); // check SUM
+
+/***************************************************************************
+@brief mtdn_backup_Read
+@outline Read-out of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@return int
+@retval 0 : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+int mtdn_backup_Read(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff ) {
+ int ret_status = RET_DEV_NORMAL;
+
+ if (path_name == NULL) {
+ NOR_ERRLOG("invalid path:%p", path_name);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (p_buff == NULL) {
+ NOR_ERRLOG("invalid buf:%p", p_buff);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (i_id < 0) {
+ NOR_ERRLOG("invalid id:%d", i_id);
+ return RET_DEV_ERR_PARAM;
+ }
+ if ((i_offset < 0) || (i_size <= 0)) {
+ NOR_ERRLOG("invalid size:%d offset:%d", i_size, i_offset);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (g_backup_init == FLSBACKUP_SEMAPHORE_INVALID) { // LCOV_EXCL_BR_LINE 200: g_backup_init is static variable
+ pthread_mutex_init(&g_semid_flash, NULL);
+ g_backup_init = ~FLSBACKUP_SEMAPHORE_INVALID;
+ }
+ mtd_info_t mtd_info;
+ memset(&mtd_info, 0, sizeof(mtd_info_t));
+ ret_status = MtdBackupInfo((const char *)path_name, &mtd_info);
+ if (ret_status == RET_DEV_NORMAL) {
+ if (mtd_info.type != MTD_NORFLASH) {
+ NOR_ERRLOG("invalid type:%d", mtd_info.type);
+ ret_status = RET_DEV_ERR_PARAM;
+ } else {
+ if ((i_offset + i_size) > (int)(mtd_info.erasesize - BACKUP_CHECK_OFFSET)) {
+ NOR_ERRLOG("invalid size:%d offset:%d erasesize:%d", i_size, i_offset, mtd_info.erasesize);
+ ret_status = RET_DEV_ERR_PARAM;
+ }
+ }
+ if (ret_status == RET_DEV_NORMAL) {
+ /* Start Semaphore(flash) */
+ pthread_mutex_lock(&g_semid_flash);
+ int get_state; // Read status
+ ret_status = (int)MtdnBackupReadSub(path_name, i_id, i_offset, i_size,
+ p_buff, &mtd_info, &get_state);
+
+ /* End Semaphore(flash) */
+ pthread_mutex_unlock(&g_semid_flash);
+ }
+ }
+ if (ret_status != RET_DEV_NORMAL) {
+ NOR_ERRLOG("error return:%d", ret_status);
+ }
+ return ret_status;
+}
+
+/***************************************************************************
+@brief mtdn_backup_Write
+@outline Writing of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@return int
+@retval 0 : No error
+@retval Except: Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+int mtdn_backup_Write(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff) {
+ int ret_status = RET_DEV_NORMAL;
+
+ if (path_name == NULL) {
+ NOR_ERRLOG("invalid path:%p", path_name);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (p_buff == NULL) {
+ NOR_ERRLOG("invalid buf:%p", p_buff);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (i_id < 0) {
+ NOR_ERRLOG("invalid id:%d", i_id);
+ return RET_DEV_ERR_PARAM;
+ }
+ if ((i_offset < 0) || (i_size <= 0)) {
+ NOR_ERRLOG("invalid size:%d offset:%d", i_size, i_offset);
+ return RET_DEV_ERR_PARAM;
+ }
+ if (g_backup_init == FLSBACKUP_SEMAPHORE_INVALID) {
+ pthread_mutex_init(&g_semid_flash, NULL);
+ g_backup_init = ~FLSBACKUP_SEMAPHORE_INVALID;
+ }
+ mtd_info_t mtd_info;
+ memset(&mtd_info, 0, sizeof(mtd_info_t));
+ ret_status = MtdBackupInfo((const char *)path_name, &mtd_info);
+ if (ret_status == RET_DEV_NORMAL) {
+ if (mtd_info.type != MTD_NORFLASH) {
+ NOR_ERRLOG("invalid type:%d", mtd_info.type);
+ ret_status = RET_DEV_ERR_PARAM;
+ } else if (mtd_info.erasesize == 0) {
+ NOR_ERRLOG("invalid erasesize:%d", mtd_info.erasesize);
+ ret_status = RET_DEV_ERR_PARAM;
+ } else {
+ if ((i_offset + i_size) > (int)(mtd_info.erasesize - BACKUP_CHECK_OFFSET)) {
+ NOR_ERRLOG("invalid size:%d offset:%d erasesize:%d", i_size, i_offset, mtd_info.erasesize);
+ ret_status = RET_DEV_ERR_PARAM;
+ }
+ }
+ if (ret_status == RET_DEV_NORMAL) {
+ /* Start Semaphore(flash) */
+ pthread_mutex_lock(&g_semid_flash);
+ ret_status = (int)MtdnBackupWriteSub(path_name, i_id, i_offset, i_size, p_buff, &mtd_info);
+
+ /* End Semaphore(flash) */
+ pthread_mutex_unlock(&g_semid_flash);
+ }
+ }
+ if (ret_status != RET_DEV_NORMAL) {
+ NOR_ERRLOG("error return:%d", ret_status);
+ }
+ return ret_status;
+}
+
+/***************************************************************************
+@brief MtdnBackupReadSub
+@outline Read-out of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@param[in] mtd_info_t * mtd_info : info
+@param[in] int * get_state : 0:Rrg Normal 1:Bak Normal
+@return NOR_READ_BLK_CHK
+@retval RET_RD_CHK_OK : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+NOR_READ_BLK_CHK MtdnBackupReadSub(const char * path_name, int i_id, int i_offset, int i_size,
+ void *p_buff, mtd_info_t * mtd_info, int * get_state) {
+ NOR_READ_BLK_CHK ret_status = RET_RD_CHK_OK;
+ char * lp_buffer;
+
+ if (mtd_info->erasesize != 0) { // LCOV_EXCL_BR_LINE 6: double check
+ lp_buffer = (char *)malloc(mtd_info->erasesize);
+ if (lp_buffer == NULL) {
+ NOR_ERRLOG("malloc:%p", lp_buffer);
+ ret_status = RET_RD_DEV_ERR; // error
+ }
+ } else {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("invalid erasesize:%d", mtd_info->erasesize);
+ ret_status = RET_RD_DEV_ERR; // error
+ // LCOV_EXCL_STOP
+ }
+ if (ret_status == RET_RD_CHK_OK) {
+ memset(lp_buffer, 0x00, mtd_info->erasesize);
+ NOR_R_STATE cycle_state = NOR_IDLE;
+ int block_check_mode = 0;
+ int ret_sum = 0;
+ while ((cycle_state < NOR_READ_END)
+ &&(ret_status == RET_RD_CHK_OK)) {
+ switch (cycle_state) {
+ case NOR_IDLE:
+ // Read-out of block data
+ if (0 != MtdnBackupReadBase((const char *)path_name, i_id, 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ ret_status = RET_RD_ERR_OTHER; // Other abnormalities
+ } else {
+ NOR_BLK_CHK ret = MtdBackupCheksumRead(lp_buffer, (int)mtd_info->erasesize, (int *)&ret_sum);
+ if (ret == RET_CHK_TEXT_ERR) { // Text character sequence Abnormalities
+ cycle_state = NOR_ORG_TEXT;
+ } else if (ret == RET_CHK_BCC_ERR) { // (BCC)error
+ cycle_state = NOR_ORG_BCC;
+ } else {
+ block_check_mode = 0; // Org Normal
+ cycle_state = NOR_READ_OK;
+ }
+ }
+ break;
+ case NOR_ORG_TEXT: // OrgText Error
+ // Read-out of block data
+ if (0 != MtdnBackupReadBase((const char *)path_name, (i_id+1), 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ // other error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = RET_RD_ERR_OTHER; // LCOV_EXCL_LINE 5: c API error case.
+ } else {
+ NOR_BLK_CHK ret = MtdBackupCheksumRead(lp_buffer, (int)mtd_info->erasesize,
+ (int *)&ret_sum); // check SUM
+ if (ret == RET_CHK_TEXT_ERR) { // Text character sequence Abnormalities
+ ret_status = RET_RD_ERR_1; // Uninitialized.
+ } else if (ret == RET_CHK_BCC_ERR) { // BCC error
+ ret_status = RET_RD_ERR_2; // write error
+ }
+ block_check_mode = 1; // Bak Normal
+ cycle_state = NOR_READ_OK;
+ }
+ break;
+ case NOR_ORG_BCC: // OrgBcc error
+ // Read-out of block data
+ if (0 != MtdnBackupReadBase((const char *)path_name, (i_id+1), 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ // other error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = RET_RD_ERR_OTHER; // LCOV_EXCL_LINE 5: c API error case.
+ } else {
+ NOR_BLK_CHK ret = MtdBackupCheksumRead(lp_buffer, (int)mtd_info->erasesize,
+ (int *)&ret_sum); // check SUM
+ if (ret == RET_CHK_TEXT_ERR) { // Text character sequence Abnormalities
+ ret_status = RET_RD_ERR_3; // write error
+ } else if (ret == RET_CHK_BCC_ERR) { // BCC error
+ ret_status = RET_RD_ERR_4; // write error
+ }
+ block_check_mode = 1; // Bak Normal
+ cycle_state = NOR_READ_OK;
+ }
+ break;
+ case NOR_READ_OK: // Normal read-out
+ // The pickup of the read data
+ memcpy(p_buff, &lp_buffer[i_offset], (size_t)i_size);
+ cycle_state = NOR_READ_END;
+ break;
+ default:
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("invalid state:%d", cycle_state);
+ // other error
+ ret_status = RET_RD_ERR_OTHER;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+ *get_state = block_check_mode; // 0:OrgNormal 1:BakNormal
+ free(lp_buffer);
+ }
+ return ret_status; // Normal
+}
+
+static inline NOR_WRITE_BLK_CHK MtdnBackupWriteRetryCount(int *count, NOR_WRITE_BLK_CHK cur_state) {
+ NOR_WRITE_BLK_CHK ret_state = cur_state;
+ (*count)++;
+ if (*count > BACKUP_RETRY_CNT) {
+ NOR_ERRLOG("retry over!! state:%d count:%d", ret_state, *count);
+ ret_state = RET_WT_DEV_ERR;
+ }
+ return ret_state;
+}
+
+/***************************************************************************
+@brief MtdnBackupWriteSub
+@outline Writing of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@param[in] mtd_info_t * mtd_info : info
+@return NOR_WRITE_BLK_CHK
+@retval RET_WT_CHK_OK : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+NOR_WRITE_BLK_CHK MtdnBackupWriteSub(const char * path_name, int i_id, int i_offset,
+ int i_size, void *p_buff, mtd_info_t * mtd_info) {
+ NOR_WRITE_BLK_CHK ret_status = RET_WT_CHK_OK;
+ char* lp_buffer;
+
+ lp_buffer = (char *)malloc(mtd_info->erasesize);
+ if (lp_buffer == NULL) {
+ NOR_ERRLOG("malloc:%p", lp_buffer);
+ ret_status = RET_WT_DEV_ERR; // error
+ } else {
+ memset(lp_buffer, 0x00, mtd_info->erasesize);
+ NOR_W_STATE cycle_state = NOR_IDEL;
+ int retry_cnt = 0;
+ int get_state = 0; // Read status
+
+ while ((cycle_state < NOR_WRITE_END)
+ &&(ret_status == RET_WT_CHK_OK)) {
+ switch (cycle_state) {
+ case NOR_IDEL: // IDLE
+ if (RET_RD_CHK_OK != MtdnBackupReadSub((const char *)path_name, i_id, 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info, &get_state)) {
+ cycle_state = NOR_READ_ERR; // read error
+ } else {
+ // write data set
+ memcpy(&lp_buffer[i_offset], p_buff, (size_t)i_size);
+ if (get_state == 0) {
+ cycle_state = NOR_ORG_READ; // Org read Normal
+ } else {
+ // Bakread Normal
+ cycle_state = NOR_BACK_READ;
+ }
+ // Embedding of write-in data
+ memcpy(&lp_buffer[i_offset], p_buff, (size_t)i_size);
+ }
+ break;
+ case NOR_READ_ERR: // read error
+ memset((char *)lp_buffer, 0x00, mtd_info->erasesize);
+ // Embedding of write-in data
+ memcpy(&lp_buffer[i_offset], p_buff, (size_t)i_size);
+ cycle_state = NOR_ORG_READ; // Org read Normal
+ break;
+ case NOR_ORG_READ: // Orgread Normal
+ // LCOV_EXCL_BR_START 6: double check
+ if (0 != MtdBackupCheksumWrite(lp_buffer, (int)mtd_info->erasesize )) { // check SUM
+ // LCOV_EXCL_BR_STOP
+ // error(It does not generate.)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = RET_WT_DEV_ERR; // LCOV_EXCL_LINE 8: dead code
+ } else {
+ // data write
+ if (0 == MtdnBackupWriteBase((const char *)path_name, (i_id+1), 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ cycle_state = NOR_BAK_WRT; // Bakwrite Success
+ retry_cnt = 0;
+ } else {
+ ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status);
+ }
+ }
+ break;
+ case NOR_BAK_WRT: // BakWriteSuccess
+ // Data write
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (0 == MtdnBackupWriteBase((const char *)path_name, i_id, 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ // LCOV_EXCL_BR_STOP
+ cycle_state = NOR_WRITE_END; // Normal end
+ } else {
+ // LCOV_EXCL_START 5: c API error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status);
+ // LCOV_EXCL_STOP
+ }
+ break;
+ case NOR_BACK_READ: // Bak read normal
+ // LCOV_EXCL_BR_START 6: double check
+ if (0 != MtdBackupCheksumWrite(lp_buffer, (int)mtd_info->erasesize )) { // check SUM
+ // LCOV_EXCL_BR_STOP
+ // Retry over
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = RET_WT_DEV_ERR; // LCOV_EXCL_LINE 8: dead code
+ } else {
+ // data write
+ if (0 == MtdnBackupWriteBase((const char *)path_name, i_id, 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ // Org write Succses
+ cycle_state = NOR_ORG_WRITE;
+ retry_cnt = 0;
+ } else {
+ // LCOV_EXCL_START 5: c API error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status);
+ // LCOV_EXCL_STOP
+ }
+ }
+ break;
+ case NOR_ORG_WRITE: // Org write Succses
+ // data write
+ if (0 == MtdnBackupWriteBase((const char *)path_name, (i_id+1), 0,
+ (int)mtd_info->erasesize, lp_buffer, mtd_info)) {
+ // Normal end
+ cycle_state = NOR_WRITE_END;
+ } else {
+ // LCOV_EXCL_START 5: c API error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status);
+ // LCOV_EXCL_STOP
+ }
+ break;
+ default:
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("invalid state:%d", cycle_state);
+ // other error
+ ret_status = RET_WT_ERR_OTHER;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+ free(lp_buffer);
+ }
+ return ret_status; // Normal
+}
+
+/***************************************************************************
+@brief MtdnBackupReadBase
+@outline Read-out of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@param[in] mtd_info_t * mtd_info :
+@return int
+@retval 0 : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+int MtdnBackupReadBase(const char * path_name, int i_id, int i_offset,
+ int i_size, void *p_buff, mtd_info_t * mtd_info) {
+ int ret_status = RET_DEV_NORMAL;
+
+ int mtd_fd = open(path_name, O_RDONLY|O_CLOEXEC);
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (mtd_fd == -1) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 5:It's impossible to mock open() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("open(%s):%s", path_name, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ int seek_top = i_id * (int)mtd_info->erasesize + i_offset;
+ int sector_size = BACKUP_SECTOR_SIZ;
+ int block_size = (int)mtd_info->erasesize / sector_size; // Division number
+ int llpi;
+ int buff_top = 0;
+ int get_size = i_size;
+ char * work_buff = (char *)p_buff;
+ ssize_t read_size;
+
+ // It reads several sector minutes.
+ for (llpi=0; llpi < block_size; llpi++) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // It moves to a head.
+ if (-1 == (off_t)lseek(mtd_fd, seek_top, SEEK_SET)) {
+ NOR_ERRLOG("lseek():%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+ if (get_size >= sector_size) { // LCOV_EXCL_BR_LINE 6:double check
+ read_size = read(mtd_fd, &work_buff[buff_top], (size_t)sector_size);
+ if (read_size < 0) {
+ NOR_ERRLOG("read():%zd %s", read_size, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+
+ get_size -= sector_size;
+ if (get_size <= 0) {
+ break;
+ }
+ } else {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ read_size = read(mtd_fd, &work_buff[buff_top], (size_t)get_size);
+ if (read_size < 0) {
+ NOR_ERRLOG("read():%zd %s", read_size, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ seek_top += (int)read_size;
+ buff_top += (int)read_size;
+ }
+ // LCOV_EXCL_BR_START 5:It's impossible to mock close() function,so this line can not be passed.
+ if (0 != close(mtd_fd)) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 5:It's impossible to mock close() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("close():%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+ return ret_status;
+}
+
+/***************************************************************************
+@brief MtdnBackupWriteBase
+@outline Writing of specified block ID
+@type Completion return type
+@param[in] const char * path_name : (/dev/mtd Device)
+@param[in] int i_id : ID...0~
+@param[in] int i_offset : ( i_offset >= 0)
+@param[in] int i_size : ( i_size > 0)
+@param[in] void *p_buff : (p_buff != NULL)
+@param[in] mtd_info_t * mtd_info :
+@return int
+@retval 0 : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+int MtdnBackupWriteBase(const char * path_name, int i_id, int i_offset,
+ int i_size, void *p_buff, mtd_info_t * mtd_info) {
+ int ret_status = RET_DEV_NORMAL;
+
+ int mtd_fd = open(path_name, O_RDWR|O_CLOEXEC);
+ if (mtd_fd == -1) {
+ NOR_ERRLOG("open(%s):%s", path_name, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ } else {
+ erase_info_t s_mtd_erase;
+ s_mtd_erase.start = (__u32)i_id * mtd_info->erasesize;
+ s_mtd_erase.length = mtd_info->erasesize;
+ // erase
+ if (ioctl(mtd_fd, MEMERASE, &s_mtd_erase) < 0) {
+ NOR_ERRLOG("ioctl(MEMERASE):%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ } else {
+ // write
+ int seek_top = i_id * (int)mtd_info->erasesize + i_offset;
+ int sector_size = BACKUP_SECTOR_SIZ; //
+ int block_size = (int)mtd_info->erasesize/sector_size;
+ int llpi;
+ int buff_top = 0;
+ int put_size = i_size;
+ char * work_buff = (char *)p_buff;
+ ssize_t write_size;
+
+ for (llpi=0; llpi < block_size; llpi++) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (-1 == (off_t)lseek(mtd_fd, seek_top, SEEK_SET)) {
+ NOR_ERRLOG("lseek():%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+ if (put_size >= sector_size) { // LCOV_EXCL_BR_LINE 6:double check
+ write_size = write(mtd_fd, &work_buff[buff_top], (size_t)sector_size);
+ if (write_size < 0) {
+ NOR_ERRLOG("write():%zd %s", write_size, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+ put_size -= sector_size;
+ if (put_size <= 0) {
+ break;
+ }
+ } else {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ write_size = write(mtd_fd, &work_buff[buff_top], (size_t)put_size);
+ if (write_size < 0) {
+ NOR_ERRLOG("write():%zd %s", write_size, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ break;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ seek_top += (int)write_size;
+ buff_top += (int)write_size;
+ }
+ }
+ // LCOV_EXCL_BR_START 5:It's impossible to mock close() function,so this line can not be passed.
+ if (0 != close(mtd_fd)) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 5:It's impossible to mock close() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("close():%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+ return ret_status;
+}
+
+/***************************************************************************
+int backup_cheksum_read(char * p_buff, int erase_size ,int * ret_sum)
+ * A text character sequence and a sum value are checked.
+ IN: char * p_buff ...top address
+ int erase_size ...erase size
+ int * ret_sum ...return sum
+
+ OUT: NOR_BLK_CHK RET_CHK_OK:Normal
+ RET_CHK_TEXT_ERR:test error
+ RET_CHK_BCC_ERR:sum error Except:other error
+ Remarks:
+*****************************************************************************/
+NOR_BLK_CHK MtdBackupCheksumRead(char * p_buff, int erase_size, int * ret_sum) {
+ if (erase_size > BACKUP_CHECK_OFFSET) { // LCOV_EXCL_BR_LINE 6: double check
+ // The check of the compatibility of block data
+ if (0 != memcmp(&p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_TEXT, BACKUP_CHECK_SIZE)) {
+ char tmp[BACKUP_CHECK_SIZE + 1];
+ memcpy(tmp, &p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_SIZE);
+ tmp[BACKUP_CHECK_SIZE] = '\0';
+ NOR_ERRLOG("invalid check_text:%s", tmp);
+ return RET_CHK_TEXT_ERR;
+ }
+ // The check of the compatibility of block data
+ int llpi;
+ int get_sum;
+ int work_sum = 0;
+ get_sum = ((int)p_buff[(erase_size-BACKUP_CHECK_DAT2)] & 0xff) +
+ (((int)p_buff[(erase_size-BACKUP_CHECK_DAT1)]) << 8 & 0xff00);
+
+ for (llpi=0; llpi < (erase_size-BACKUP_CHECK_OFFSET); llpi++) {
+ work_sum += p_buff[llpi];
+ }
+ work_sum = (work_sum & 0xffff);
+ if (work_sum != get_sum) {
+ NOR_ERRLOG("invalid checksum: work:%d get:%d", work_sum, get_sum);
+ return RET_CHK_BCC_ERR; // checksum error
+ }
+ if (ret_sum != NULL) { // LCOV_EXCL_BR_LINE 6: double check
+ *ret_sum = work_sum; // chesum Storing
+ }
+ } else {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ NOR_ERRLOG("invalid erase_size:%d", erase_size);
+ // checksum error
+ return RET_CHK_BCC_ERR;
+ // LCOV_EXCL_STOP
+ }
+ return RET_CHK_OK;
+}
+
+/***************************************************************************
+int backup_cheksum_write(char * p_buff, int erase_size )
+ * A text character sequence and a sum value are written in a buffer.
+ IN: char * p_buff ...top address
+ int erase_size ...erase size
+
+ OUT: int 0:normal Except:error
+ Remarks:
+*****************************************************************************/
+int MtdBackupCheksumWrite(char * p_buff, int erase_size ) {
+ int sum_add = 0;
+
+ if (erase_size > BACKUP_CHECK_OFFSET) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ int ret_status;
+ // The check of the compatibility of block data
+ ret_status = memcmp(&p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_TEXT, BACKUP_CHECK_SIZE);
+ if (ret_status != 0) {
+ memcpy(&p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_TEXT, BACKUP_CHECK_SIZE);
+ }
+ int llpi;
+ for (llpi=0; llpi < (erase_size-BACKUP_CHECK_OFFSET); llpi++) {
+ sum_add += p_buff[llpi];
+ }
+ }
+ p_buff[(erase_size-BACKUP_CHECK_DAT2)] = (char)(sum_add & 0xff);
+ p_buff[(erase_size-BACKUP_CHECK_DAT1)] = (char)((sum_add>>8) & 0xff);
+ return RET_DEV_NORMAL;
+}
+
+/***************************************************************************
+@brief MtdBackupInfo( mtd_info_t * mtd_info)
+@outline The information to obtain is obtained.
+@type Completion return type
+@param[in] mtd_info_t * mtd_info
+@return int
+@retval 0 : No error
+@retval Except : Error
+@usage It is Backup API of data read.
+*****************************************************************************/
+int MtdBackupInfo(const char * path_name, mtd_info_t * mtd_info) {
+ int ret_status = RET_DEV_NORMAL;
+
+ int mtd_fd = open(path_name, O_RDONLY|O_CLOEXEC);
+ if (mtd_fd == -1) {
+ NOR_ERRLOG("open(%s):%s", path_name, strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ } else {
+ // device control mtdchar_ioctl of mtdchar.c
+ if (ioctl(mtd_fd, MEMGETINFO, mtd_info) < 0) {
+ NOR_ERRLOG("ioctl(MEMGETINFO):%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ }
+ if (0 != close(mtd_fd)) {
+ NOR_ERRLOG("close():%s", strerror(errno));
+ ret_status = RET_DEV_ERROR;
+ }
+ }
+ return ret_status;
+}
+
+/**************************************************************
+ End Of Files
+**************************************************************/
diff --git a/video_in_hal/systemservice/rom_access_library/library/rom/Makefile b/video_in_hal/systemservice/rom_access_library/library/rom/Makefile
new file mode 100755
index 0000000..81acd8a
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/rom/Makefile
@@ -0,0 +1,62 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### search paths #############
+VPATH += src
+VPATH += ../include/$(COMPONENT_NAME)
+
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libSS_RomAccessIf
+
+######### headers to be installed(*.h) #############
+INST_HEADERS = rom_access_library.h ss_sm_boot_access.h ss_sm_ram_access.h ss_sm_rom_access.h
+
+######### compiled sources #############
+libSS_RomAccessIf_SRCS += ss_sm_rom_access.cpp ss_sm_boot_access.cpp ss_sm_ram_access.cpp ss_sm_checksum.cpp
+
+######### add include path #############
+CPPFLAGS += -I./../include
+
+######### frameworkunifiedlog options #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### add compile option #############
+LDFLAGS += -L./../nor/
+LINK_SHLIB_CXX := y
+LDFLAGS += -g -Wl,--gc-sections -shared
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lssaccess
+LDLIBS += -Wl,-Bdynamic -lextension
+
+CPPFLAGS_ss_sm_checksum.o += -fno-exceptions
+CPPFLAGS_ss_sm_checksum.os += -fno-exceptions
+CPPFLAGS_ss_sm_ram_access.o += -fno-exceptions
+CPPFLAGS_ss_sm_ram_access.os += -fno-exceptions
+
+include ../../../system_service.mk
diff --git a/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp b/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp
new file mode 100755
index 0000000..44e8a53
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp
@@ -0,0 +1,122 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "system_service/ss_sm_boot_access.h"
+#include <stdio.h>
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+#include "system_service/nor_backup.h"
+#include "ss_rom_access_if_romaccesslibrarylog.h"
+#include "ss_rom_access_define.h"
+
+#define BAI_MTD_DEV_RO "/dev/mtd1ro" // NOR device for RO
+#define BAI_MTD_DEV_RW "/dev/mtd1" // NOR device for RW
+
+#define BAI_SERCTOR_OFFSET 0
+#define BAI_DATA_OFFSET 0
+
+void* BOOT_AccessIf::g_m_plock = NULL;
+
+BOOT_AccessIf::BOOT_AccessIf(BAI_OPEN_t type)
+ : m_type(type) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!(m_type == BAI_OPEN_RO // LCOV_EXCL_BR_LINE 6: double check
+ || m_type == BAI_OPEN_RW)) { // LCOV_EXCL_BR_LINE 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ throw __LINE__; // LCOV_EXCL_LINE 6: double check
+ }
+
+ if (g_m_plock == NULL) {
+ g_m_plock = CL_LockMap(LOCK_BOOT_ACCESS_IF);
+
+ if (g_m_plock == MAP_FAILED) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ "CL_LockMap Error, please check whether you call CL_LockProcessInit");
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+
+ if (g_m_plock) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ ROM_ACCESS_ASERT(0 == CL_LockGet(g_m_plock)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+BOOT_AccessIf::~BOOT_AccessIf() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (g_m_plock) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ ROM_ACCESS_ASERT(0 == CL_LockRelease(g_m_plock)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus BOOT_AccessIf::getBootInfo(LBM_NOR_t* p_bootInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eRet = eFrameworkunifiedStatusOK;
+ try {
+ int ret;
+ if (p_bootInfo == NULL) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw __LINE__;
+ }
+ ret = mtdn_backup_Read((const char *) BAI_MTD_DEV_RO, BAI_SERCTOR_OFFSET,
+ BAI_DATA_OFFSET, sizeof(LBM_NOR_t), p_bootInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ if (ret != 0) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw __LINE__;
+ }
+ } catch (...) {
+ eRet = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eRet;
+}
+
+EFrameworkunifiedStatus BOOT_AccessIf::setBootInfo(LBM_NOR_t* p_bootInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus eRet = eFrameworkunifiedStatusOK;
+ try {
+ int ret;
+ if (p_bootInfo == NULL) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw __LINE__;
+ }
+ if (m_type != BAI_OPEN_RW) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw __LINE__;
+ }
+ ret = mtdn_backup_Write((const char *) BAI_MTD_DEV_RW, BAI_SERCTOR_OFFSET,
+ BAI_DATA_OFFSET, sizeof(LBM_NOR_t), p_bootInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5:c API error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_LINE 5:c API error case
+ throw __LINE__; // LCOV_EXCL_LINE 5:c API error case
+ }
+ } catch (...) {
+ eRet = eFrameworkunifiedStatusFail;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eRet;
+}
+
diff --git a/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp b/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp
new file mode 100755
index 0000000..52cb114
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp
@@ -0,0 +1,37 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides for checksum calculation.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "ss_sm_checksum.h"
+
+CSMChecksum::CSMChecksum() {}
+CSMChecksum::~CSMChecksum() {}
+UI_32 CSMChecksum::cal_checksum(const void* p_buf, size_t bufSize) {
+ size_t num;
+ UI_32 sum = 0;
+ const UI_32 *p_calcBuf = reinterpret_cast<const UI_32 *>(p_buf);
+ num = bufSize / sizeof(UI_32);
+
+ for (size_t i = 0; i < num; i++) {
+ sum += p_calcBuf[i];
+ }
+ return sum;
+}
+
diff --git a/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp b/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp
new file mode 100755
index 0000000..b5cf244
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp
@@ -0,0 +1,215 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "system_service/ss_sm_ram_access.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+#include <stub/el_mem.h>
+#include "system_service/ss_sm_boot_access.h"
+#include "ss_rom_access_if_romaccesslibrarylog.h"
+#include "ss_sm_checksum.h"
+#include "ss_rom_access_define.h"
+
+
+
+#define RAM_PATH "/nv/BS/ss/rom_access_library/rwdata/ramdata.dat"
+#define RAM_OLD_PATH RAM_PATH".old"
+static const uint8_t kSigNature[] = { 0xDE, 0xAD, 0xBE, 0xEF };
+static const uint8_t kMagic[] = { 0xDE, 0xAD, 0xBE, 0xEF };
+
+void* RAM_AccessIf::g_m_plock = NULL;
+void* RAM_AccessIf::g_m_bakup_map = MAP_FAILED;
+bool RAM_AccessIf::g_m_is_first_access = false;
+
+typedef struct {
+ char magic_in[4];
+ RAM_SM_INFO_t data0;
+ uint32_t checksum0;
+ RAM_SM_INFO_t data1;
+ uint32_t checksum1;
+ char magic_out[4];
+} RAM_SM_DRAM_INFO_t;
+
+void RAM_AccessIf::initRamBackupEnable(RAM_WAKEUP_STATE wupState) {
+ RAM_SM_DRAM_INFO_t* p_buf;
+ CSMChecksum l_checksum;
+
+ ROM_ACCESS_STATIC_ASERT(sizeof(RAM_SM_DRAM_INFO_t) <= SS_SYS_AREA_RAM_MAX_SIZE);
+ // Checking sizes because checksum calculations expect 4 bytes alignments
+ ROM_ACCESS_STATIC_ASERT((sizeof(RAM_SM_DRAM_INFO_t) % sizeof(UI_32)) == 0);
+
+ if (g_m_bakup_map == MAP_FAILED) {
+ g_m_bakup_map = EL_mem_exram_mmap( // LCOV_EXCL_BR_LINE 11:unexpected branch
+ EL_MEM_TYPE_REGION_SYS,
+ EL_mem_getOffset(EL_MEM_ID_SYS_BOOT) + SS_SYS_AREA_RAM_OFFSET, // LCOV_EXCL_BR_LINE 11:unexpected branch
+ SS_SYS_AREA_RAM_MAX_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
+ EL_MEM_CACHE_INVALID);
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed
+ if (g_m_bakup_map == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0); // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed
+ return; // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed
+ }
+ }
+ p_buf = static_cast<RAM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+
+ // LCOV_EXCL_BR_START 6:impossible to confirm because wupState can not be changed
+ if ((RAM_WAKEUP_STATE_BACKUP_NG == wupState) ||
+ (RAM_WAKEUP_STATE_BATTERY_DOWN == wupState) ||
+ (memcmp(p_buf->magic_out, kMagic, sizeof(kMagic)) != 0) ||
+ (memcmp(p_buf->magic_in, p_buf->magic_out, sizeof(p_buf->magic_in)) != 0)) {
+ // LCOV_EXCL_BR_STOP
+ // BACKUP NG
+ g_m_is_first_access = false;
+ bzero(p_buf, sizeof(RAM_SM_DRAM_INFO_t));
+ }
+
+ if (!g_m_is_first_access) {
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if ((memcmp(p_buf->data0.signature_in, kSigNature, sizeof(kSigNature)) == 0)
+ && (memcmp(p_buf->data0.signature_out, kSigNature,
+ sizeof(kSigNature)) == 0)
+ && (l_checksum.cal_checksum(&(p_buf->data0), sizeof(p_buf->data0)) == p_buf->checksum0)) {
+ // LCOV_EXCL_BR_STOP
+ // Use data0 content
+ memcpy(&(p_buf->data1), &(p_buf->data0), sizeof(p_buf->data1));
+ p_buf->checksum1 = p_buf->checksum0;
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ } else if ((memcmp(p_buf->data1.signature_in, kSigNature, sizeof(kSigNature)) == 0)
+ && (memcmp(p_buf->data1.signature_out, kSigNature,
+ sizeof(kSigNature)) == 0)
+ && (l_checksum.cal_checksum(&(p_buf->data1), sizeof(p_buf->data1)) == p_buf->checksum1)) {
+ // LCOV_EXCL_BR_STOP
+ // Use data1 content
+ memcpy(&(p_buf->data0), &(p_buf->data1), sizeof(p_buf->data0));
+ p_buf->checksum0 = p_buf->checksum1;
+ } else {
+ // BACKUP NG or SIGNATURE CHECK or CHECK SUM NG
+ bzero(p_buf, sizeof(RAM_SM_DRAM_INFO_t));
+ memcpy(p_buf->magic_in, kMagic, sizeof(kMagic));
+ // data0
+ memcpy(p_buf->data0.signature_in, kSigNature, sizeof(kSigNature));
+ memcpy(p_buf->data0.signature_out, kSigNature, sizeof(kSigNature));
+ p_buf->checksum0 =
+ l_checksum.cal_checksum(&(p_buf->data0), sizeof(p_buf->data0)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // data1
+ memcpy(p_buf->data1.signature_in, kSigNature, sizeof(kSigNature));
+ memcpy(p_buf->data1.signature_out, kSigNature, sizeof(kSigNature));
+ p_buf->checksum1 =
+ l_checksum.cal_checksum(&(p_buf->data1), sizeof(p_buf->data1)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ memcpy(p_buf->magic_out, kMagic, sizeof(kMagic));
+ }
+ }
+ memcpy(&m_buf, &(p_buf->data0), sizeof(p_buf->data0));
+}
+
+void RAM_AccessIf::finalRamBackupEnable(void) {
+ RAM_SM_DRAM_INFO_t* p_buf;
+ CSMChecksum l_checksum;
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed
+ if (g_m_bakup_map == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed
+ return; // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed
+ }
+
+ p_buf = static_cast<RAM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+
+ // kSigNature is cleared during writing
+ bzero(m_buf.signature_in, sizeof(kSigNature));
+
+ // data0
+ memcpy(&(p_buf->data0), &m_buf, sizeof(p_buf->data0));
+ memcpy(p_buf->data0.signature_in, kSigNature, sizeof(kSigNature));
+ p_buf->checksum0 = l_checksum.cal_checksum(&(p_buf->data0), // LCOV_EXCL_BR_LINE 11:unexpected branch
+ sizeof(p_buf->data0));
+
+ // data1
+ memcpy(&(p_buf->data1), &m_buf, sizeof(p_buf->data1));
+ memcpy(p_buf->data1.signature_in, kSigNature, sizeof(kSigNature));
+ p_buf->checksum1 = l_checksum.cal_checksum(&(p_buf->data1), // LCOV_EXCL_BR_LINE 11:unexpected branch
+ sizeof(p_buf->data1));
+
+ // Set kSigNature
+ memcpy(m_buf.signature_in, kSigNature,
+ sizeof(kSigNature));
+}
+
+RAM_AccessIf::RAM_AccessIf(
+ RAM_WAKEUP_STATE wupState /* = RAM_WAKEUP_STATE_DONT_CARE */)
+ : m_buf(),
+ m_dirty(false) {
+
+ if (g_m_plock == NULL) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ g_m_plock = CL_LockMap(LOCK_RAM_ACCESS_IF);
+ if (g_m_plock == MAP_FAILED) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ "CL_LockMap Error, please check whether you call CL_LockProcessInit");
+ // LCOV_EXCL_BR_STOP
+ g_m_plock = NULL;
+ }
+ }
+ if (g_m_plock) {
+ if (0 != CL_LockGet(g_m_plock)) {
+ ROM_ACCESS_ASERT(0);
+ }
+ }
+
+ if (RAM_WAKEUP_STATE_BATTERY_DOWN == wupState) { // LCOV_EXCL_BR_LINE 13:
+ // Models without DRAM backups are initialized when +B is down.
+ // Deletes files because models with DRAM backups are also backwards compatible
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ unlink(RAM_PATH); // LCOV_EXCL_LINE 13:
+ unlink(RAM_OLD_PATH); // LCOV_EXCL_LINE 13:
+ }
+
+ initRamBackupEnable(wupState);
+ g_m_is_first_access = true;
+}
+
+RAM_AccessIf::~RAM_AccessIf() {
+ if (m_dirty) {
+ finalRamBackupEnable();
+ }
+ if (g_m_plock) {
+ ROM_ACCESS_ASERT(0 == CL_LockRelease(g_m_plock));
+ }
+
+ return;
+}
+
+EFrameworkunifiedStatus RAM_AccessIf::getRamInfo(RAM_SM_INFO_t* p_bootInfo) {
+ *p_bootInfo = m_buf;
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus RAM_AccessIf::setRamInfo(RAM_SM_INFO_t* p_bootInfo) {
+ if (0 != memcmp(&m_buf, p_bootInfo, sizeof(m_buf))) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ m_buf = *p_bootInfo;
+ m_dirty = true;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp b/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp
new file mode 100755
index 0000000..53589c2
--- /dev/null
+++ b/video_in_hal/systemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp
@@ -0,0 +1,969 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SS_RomAccess
+/// \brief This file supports ROM Access.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include "system_service/ss_sm_rom_access.h"
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+#include <stub/el_mem.h>
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+
+#include "ss_rom_access_if_romaccesslibrarylog.h"
+#include "ss_sm_checksum.h"
+#include "ss_rom_access_define.h"
+
+#define ROM_ACCESS_DIR "/nv/BS/ss/rom_access_library/rwdata"
+#define ROM_ACCESS_FILE "romdata.dat"
+const CHAR kDefaultRomDevice[] = ROM_ACCESS_DIR"/"ROM_ACCESS_FILE;
+const CHAR kRecoveryRomDevice[] = ROM_ACCESS_DIR"/"ROM_ACCESS_FILE".old";
+static const uint8_t kMagic[] = { 0xDE, 0xAD, 0xBE, 0xEF };
+
+typedef enum {
+ INDEX_BOOTFLAG = 0,
+ INDEX_ACTIVE_FLASHLOADER,
+ INDEX_PARTITIONS_RW_FLAG,
+ INDEX_LAST_USER_MODE,
+ INDEX_TRANSPORT_MODE,
+ INDEX_PRODUCTION_MODE,
+ INDEX_LIMP_HOME_CUT_OFF_REQUEST,
+ INDEX_DATARESET_MODE,
+ INDEX_RESET_COUNT,
+ INDEX_LAST_ILGRESET,
+ INDEX_PROGUPDATE_STATE,
+ INDEX_ERR_LOG_COUNT,
+ INDEX_NEXT_WAKEUP_TYPE,
+ INDEX_SIGNATURE = 15, // As far as possible, do not modify this index value!!!!!
+ INDEX_PROG_STATE = 20,
+ INDEX_PROG_STATE_END = 63,
+ INDEX_PRODUCT_PRIVATE, // 64
+ INDEX_PRODUCT_PRIVATE_END = (INDEX_PRODUCT_PRIVATE + ROM_PRODUCT_PRIVATE_MAX
+ - 1),
+ INDEX_MAX
+} eRomIndices;
+
+void* ROM_AccessIf::g_m_plock = NULL;
+void* ROM_AccessIf::g_m_bakup_map = MAP_FAILED;
+bool ROM_AccessIf::g_m_is_dram_valid = false;
+
+typedef struct {
+ char magic_in[4];
+ bool is_dirty;
+ UI_32 data[INDEX_MAX];
+ uint32_t checksum;
+ char magic_out[4];
+} ROM_SM_DRAM_INFO_t;
+
+ROM_AccessIf::ROM_AccessIf()
+ : m_pBoot(NULL),
+ m_norIsDirty(false) {
+ bzero(&m_nor, sizeof(m_nor));
+
+ if (g_m_plock == NULL) {
+ g_m_plock = CL_LockMap(LOCK_ROM_ACCESS_IF);
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ if (g_m_plock == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR, __FUNCTION__,
+ "CL_LockMap Error, please check whether you call CL_LockProcessInit");
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ if (g_m_plock) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ if (0 != CL_LockGet(g_m_plock)) {
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed
+ }
+ }
+}
+
+ROM_AccessIf::~ROM_AccessIf() {
+ if (m_pBoot) {
+ if (m_norIsDirty) {
+ ROM_ACCESS_ASERT(eFrameworkunifiedStatusOK == m_pBoot->setBootInfo(&m_nor)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ delete m_pBoot; // LCOV_EXCL_BR_LINE 11:unexpected branch
+ m_pBoot = NULL;
+ }
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed
+ if (g_m_plock) {
+ ROM_ACCESS_ASERT(0 == CL_LockRelease(g_m_plock));
+ } // LCOV_EXCL_BR_STOP
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::LBA_Read(UI_32 offset, UI_32* buffer,
+ UI_32 word_count) {
+ ROM_SM_DRAM_INFO_t* p_buf;
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed
+ if (g_m_bakup_map == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " g_m_bakup_map uninitialize");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+ memcpy(buffer, &p_buf->data[offset], word_count * sizeof(UI_32));
+
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::LBA_Write(UI_32 offset, UI_32 value) {
+ UI_32 l_value = value;
+ return LBA_Write(offset, &l_value, sizeof(UI_32));
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::LBA_Write(UI_32 offset, UI_32* value, UI_32 size) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ const CHAR *l_file = kDefaultRomDevice;
+ SI_32 fd = -1;
+ ROM_SM_DRAM_INFO_t* p_buf;
+ if (g_m_bakup_map == MAP_FAILED) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " g_m_bakup_map uninitialize");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+
+ if (memcmp(&p_buf->data[offset], value, size) == 0) {
+ // Not Write when the value does not change
+ return eFrameworkunifiedStatusOK;
+ }
+
+ p_buf->is_dirty = true;
+ memcpy(&p_buf->data[offset], value, size);
+
+ CSMChecksum l_checksum;
+ p_buf->checksum = l_checksum.cal_checksum(&(p_buf->data), // LCOV_EXCL_BR_LINE 11:unexpected branch
+ sizeof(p_buf->data)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ if (0 != rename(kDefaultRomDevice, kRecoveryRomDevice)) {
+ ROM_ACCESS_ERRNO(0);
+ } else {
+ int sync_fd;
+ sync_fd = open(kRecoveryRomDevice, O_RDWR | O_DSYNC | O_CLOEXEC); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (sync_fd != -1) {
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ERRNO(0 == fsync(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ROM_ACCESS_ERRNO(0 == close(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0); // LCOV_EXCL_LINE 5:It's impossible to mock open() function,so this line can not be passed.
+ }
+ }
+ fd = open(l_file, O_CREAT | O_TRUNC | O_RDWR | O_DSYNC | O_CLOEXEC, 00664); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (fd == -1) {
+ ROM_ACCESS_ERRNO(0);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: open(%s) returned -1", l_file);
+ eStatus = eFrameworkunifiedStatusFail;
+ goto ERROR;
+ }
+
+ /** Write the value of 32-bits at offset location */
+ if (sizeof(p_buf->data) != write(fd, p_buf->data, sizeof(p_buf->data))) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 5:It's impossible to mock write() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: write(%s) returned -1", l_file);
+ eStatus = eFrameworkunifiedStatusFail;
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ ROM_ACCESS_ERRNO(0 == close(fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ fd = -1;
+
+ if (0 != unlink(kRecoveryRomDevice)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_START 5:It's impossible to mock unlink() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0);
+ // LCOV_EXCL_STOP
+ }
+
+ int sync_fd;
+ sync_fd = open(ROM_ACCESS_DIR, O_RDONLY); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (sync_fd != -1) {
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ERRNO(0 == fsync(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ROM_ACCESS_ERRNO(0 == close(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0); // LCOV_EXCL_LINE 5:It's impossible to mock open() function,so this line can not be passed.
+ }
+ }
+ p_buf->is_dirty = false;
+ ERROR: if (fd != -1) { // LCOV_EXCL_BR_LINE 5:It's impossible to mock open() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ close(fd); // LCOV_EXCL_LINE 5:It's impossible to mock write() function,so this line can not be passed.
+ }
+ // @todo memory value is not restored if non-volatile area writing fails after writing to memory
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetDataResetMode_sub(EDATARESET_MODE* pDataResetMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_DATARESET_MODE,
+ reinterpret_cast<UI_32 *>(pDataResetMode), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+// This function may be called in duplicate,
+// so it is necessary to operate normally even if it is called in duplicate.
+EFrameworkunifiedStatus ROM_AccessIf::SystemInitialize(DRAM_BACKUP_STATE bkupState) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ ROM_ACCESS_STATIC_ASERT(sizeof(ROM_SM_DRAM_INFO_t) <= SS_SYS_AREA_ROM_MAX_SIZE);
+
+ // Checksum calculations expect 4-bytes alignments
+ ROM_ACCESS_STATIC_ASERT((sizeof(ROM_SM_DRAM_INFO_t) % sizeof(UI_32)) == 0);
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed
+ if (g_m_bakup_map == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ g_m_bakup_map = EL_mem_exram_mmap(
+ EL_MEM_TYPE_REGION_SYS,
+ EL_mem_getOffset(EL_MEM_ID_SYS_BOOT) + SS_SYS_AREA_ROM_OFFSET,
+ SS_SYS_AREA_ROM_MAX_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
+ EL_MEM_CACHE_INVALID);
+ if (g_m_bakup_map == MAP_FAILED) {
+ ROM_ACCESS_ERRNO(0);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+
+ if (bkupState
+ == DRAM_BACKUP_STATE_NG) {
+ // BACKUP NG
+ ROM_SM_DRAM_INFO_t* p_buf;
+ CSMChecksum l_checksum;
+
+ p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+ bzero(&(p_buf->magic_in), sizeof(p_buf->magic_in));
+ bzero(&(p_buf->magic_out), sizeof(p_buf->magic_out));
+ g_m_is_dram_valid = false;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::Initialize() {
+ const CHAR *l_file = kDefaultRomDevice;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ CSMChecksum l_checksum;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (g_m_bakup_map == MAP_FAILED) {
+ g_m_bakup_map = EL_mem_exram_mmap( // LCOV_EXCL_BR_LINE 11:unexpected branch
+ EL_MEM_TYPE_REGION_SYS,
+ EL_mem_getOffset(EL_MEM_ID_SYS_BOOT) + SS_SYS_AREA_ROM_OFFSET, // LCOV_EXCL_BR_LINE 11:unexpected branch
+ SS_SYS_AREA_ROM_MAX_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
+ EL_MEM_CACHE_INVALID);
+ // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed
+ if (g_m_bakup_map == MAP_FAILED) {
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ERRNO(0);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+ if (!g_m_is_dram_valid) {
+ SI_32 fd = -1;
+ ROM_SM_DRAM_INFO_t* p_buf;
+ p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map);
+ if ((p_buf->is_dirty)
+ || (memcmp(kMagic, p_buf->magic_in, sizeof(kMagic)) != 0)
+ || (memcmp(kMagic, p_buf->magic_out, sizeof(kMagic)) != 0)
+ || ((l_checksum.cal_checksum(&(p_buf->data), sizeof(p_buf->data)) != p_buf->checksum))) {
+ // Need to synchronize the NVs with the data on the DRAM
+ struct stat stutInfo;
+ if (0 != stat(ROM_ACCESS_DIR, &stutInfo)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock stat() function,so this line can not be passed.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s not found", ROM_ACCESS_DIR);
+ // LCOV_EXCL_BR_STOP
+ ROM_ACCESS_ASERT(0 == mkdir(ROM_ACCESS_DIR, 0775)); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ int expectSize = (INT32)(INDEX_MAX * sizeof(UI_32));
+ int sigSize = (INT32)((INDEX_SIGNATURE + 1) * sizeof(UI_32));
+
+ if (access(kRecoveryRomDevice, F_OK) == 0) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock access() function,so this line can not be passed.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s is found", kRecoveryRomDevice);
+ // LCOV_EXCL_BR_STOP
+ if (0 != unlink(kDefaultRomDevice)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock unlink() function,so this line can not be passed.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error:unlink(%s)", kDefaultRomDevice);
+ // LCOV_EXCL_BR_STOP
+ }
+ if (0 != rename(kRecoveryRomDevice, kDefaultRomDevice)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ROM_ACCESS_ERRNO(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ }
+ if (0 == stat(kDefaultRomDevice, &stutInfo) // LCOV_EXCL_BR_LINE 11:unexpected branch
+ && stutInfo.st_size >= sigSize) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // Use this value if there are more sizes than SIGNITURE
+ #define ROM_ACCESS_INFO_SIZE (sizeof(ROM_SM_DRAM_INFO_t) - (sizeof(UI_32)*INDEX_MAX))
+ #define ROM_ACCESS_MAX_SIZE (INT32)(SS_SYS_AREA_ROM_MAX_SIZE - ROM_ACCESS_INFO_SIZE)
+ // Maximum size of RAM area - An upper size limit of the management info size
+ if (stutInfo.st_size > ROM_ACCESS_MAX_SIZE) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ stutInfo.st_size = ROM_ACCESS_MAX_SIZE;
+ }
+ fd = open(l_file, // LCOV_EXCL_BR_LINE 11:unexpected branch
+ O_RDWR | O_DSYNC | O_CLOEXEC); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (fd != -1) {
+ int ret;
+ if (stutInfo.st_size < expectSize) {
+ // If the files are large, APPEND them
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "PADDING");
+ ret = ftruncate(fd, expectSize);
+ ROM_ACCESS_ERRNO(ret == 0);
+ fsync(fd);
+ } else if (stutInfo.st_size > expectSize) {
+ // If the files are small, TRANC them
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "CUT");
+ ret = ftruncate(fd, expectSize);
+ ROM_ACCESS_ERRNO(ret == 0);
+ fsync(fd);
+ }
+ }
+ // LCOV_EXCL_BR_STOP
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s size is not crrect",
+ kDefaultRomDevice);
+ // LCOV_EXCL_BR_STOP
+ fd = open(l_file, O_CREAT | O_TRUNC | O_RDWR | O_DSYNC | O_CLOEXEC,
+ 00664); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (fd != -1) {
+ UI_32 buf[INDEX_MAX];
+ bzero(buf, sizeof(buf));
+ ROM_ACCESS_ASERT(sizeof(buf) == write(fd, buf, sizeof(buf)))
+ fsync(fd);
+ }
+ // LCOV_EXCL_BR_STOP
+ }
+ // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed.
+ if (fd != -1) {
+ // LCOV_EXCL_BR_STOP
+ UI_32 read_buf[INDEX_MAX];
+ if (-1 == lseek(fd, 0, SEEK_SET)) {
+ // LCOV_EXCL_START 5:It's impossible to mock lseek() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0);
+ // LCOV_EXCL_STOP
+ } else {
+ if (-1 == read(fd, read_buf, sizeof(read_buf))) {
+ // LCOV_EXCL_START 5:It's impossible to mock read() function,so this line can not be passed.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ERRNO(0);
+ // LCOV_EXCL_STOP
+ } else {
+ memcpy(p_buf->magic_in, kMagic, sizeof(kMagic));
+ memcpy(&p_buf->data, read_buf, sizeof(p_buf->data));
+ p_buf->checksum = l_checksum.cal_checksum(&(p_buf->data),
+ sizeof(p_buf->data));
+ memcpy(p_buf->magic_out, kMagic, sizeof(kMagic));
+ p_buf->is_dirty = false;
+
+ // Synchronization of NV data with data on the DRAM completed
+ g_m_is_dram_valid = true;
+ }
+ }
+ close(fd);
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:open(%s)", l_file);
+ // LCOV_EXCL_BR_STOP
+ }
+ } else {
+ // No need to synchronize NV data with data on the DRAM
+ g_m_is_dram_valid = true;
+ }
+ } else {
+ // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h"
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " alreay initialized");
+ // LCOV_EXCL_BR_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetSignature(UI_32* pSigValue) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_SIGNATURE,
+ reinterpret_cast<UI_32 *>(pSigValue), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetSignature(UI_32 sigValue) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_SIGNATURE,
+ sigValue))) {
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(0x%X) errored: 0x%X",
+ sigValue, eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetBootMode(EBOOT_MODE* pBootMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_BOOTFLAG,
+ reinterpret_cast<UI_32 *>(pBootMode), 1))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: LBA_Read() errored: 0x%X", eStatus);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetBootMode(EBOOT_MODE bootMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_BOOTFLAG, bootMode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%d) errored: 0x%X",
+ bootMode, eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetLastUserMode(EUSER_MODE* pUserMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_LAST_USER_MODE,
+ reinterpret_cast<UI_32 *>(pUserMode), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetLastUserMode(EUSER_MODE userMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_LAST_USER_MODE, userMode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X",
+ userMode == USER_OFF ? "USER_OFF" : "USER_ON", eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetTransportMode(ECONTROL_MODE* pControlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_TRANSPORT_MODE,
+ reinterpret_cast<UI_32 *>(pControlMode), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetTransportMode(ECONTROL_MODE controlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_TRANSPORT_MODE, controlMode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X",
+ controlMode == DISABLE_MODE ? "DISABLE_MODE" : "ENABLE_MODE",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+
+EFrameworkunifiedStatus ROM_AccessIf::GetProductionMode(ECONTROL_MODE* pControlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_PRODUCTION_MODE,
+ reinterpret_cast<UI_32 *>(pControlMode), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetProductionMode(ECONTROL_MODE controlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_PRODUCTION_MODE, controlMode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X",
+ controlMode == DISABLE_MODE ? "DISABLE_MODE" : "ENABLE_MODE",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetLimpHomeCutOffReqMode(ECONTROL_MODE* pControlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_LIMP_HOME_CUT_OFF_REQUEST,
+ reinterpret_cast<UI_32 *>(pControlMode), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetLimpHomeCutOffReqMode(ECONTROL_MODE controlMode) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_LIMP_HOME_CUT_OFF_REQUEST, controlMode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X",
+ controlMode == DISABLE_MODE ? "DISABLE_MODE" : "ENABLE_MODE",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetDataResetMode(EDATARESET_MODE* pDataResetMode) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ try {
+ UI_32 sts;
+ if (m_pBoot == NULL) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because m_pBoot can not be changed
+ m_pBoot = new BOOT_AccessIf(BAI_OPEN_RW); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != m_pBoot->getBootInfo(&m_nor)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw eFrameworkunifiedStatusFail;
+ }
+ }
+
+ if ((m_nor.sts1 == m_nor.sts2) || (m_nor.sts1 == m_nor.sts3)) {
+ sts = m_nor.sts1;
+ } else if (m_nor.sts2 == m_nor.sts3) {
+ sts = m_nor.sts2;
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ } else {
+ sts = SYSUP_CND_NORMAL;
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+
+ if (sts == SYSUP_CND_FACTRESET) {
+ *pDataResetMode = DATARESET_FACTORY;
+ } else {
+ eStatus = GetDataResetMode_sub(pDataResetMode); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ } catch (const EFrameworkunifiedStatus& e) {
+ eStatus = e;
+ } catch (...) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ eStatus = eFrameworkunifiedStatusFail;
+ } // LCOV_EXCL_STOP
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetDataResetModeFast(EDATARESET_MODE* pDataResetMode) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ void* p_map = MAP_FAILED;
+ size_t mapSize = 0;
+ try {
+ LBM_RAM_t* p_lbm = NULL;
+ mapSize = SS_SYS_AREA_BOOT_MAX_SIZE;
+
+ if (EL_mem_getLength(EL_MEM_ID_SYS_BOOT) < SS_SYS_AREA_BOOT_MAX_SIZE) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ mapSize = EL_mem_getLength(EL_MEM_ID_SYS_BOOT); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ p_map = reinterpret_cast<LBM_RAM_t*>(EL_mem_exram_mmap(EL_MEM_TYPE_REGION_SYS,
+ EL_mem_getOffset(EL_MEM_ID_SYS_BOOT),
+ mapSize, PROT_READ | PROT_WRITE,
+ MAP_SHARED, EL_MEM_CACHE_INVALID));
+ // LCOV_EXCL_BR_STOP
+ if (p_map == MAP_FAILED) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because p_map can not be changed
+ ROM_ACCESS_ERRNO(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because p_map can not be changed
+ throw eFrameworkunifiedStatusFail;
+ }
+ p_lbm = static_cast<LBM_RAM_t*>(p_map);
+ if (p_lbm->sts == SYSUP_CND_FACTRESET) {
+ *pDataResetMode = DATARESET_FACTORY;
+ } else {
+ eStatus = GetDataResetMode_sub(pDataResetMode); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ }
+ } catch (const EFrameworkunifiedStatus& e) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ eStatus = e;
+ } catch (...) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ASERT(0);
+ eStatus = eFrameworkunifiedStatusFail;
+ } // LCOV_EXCL_STOP
+
+ if (p_map != MAP_FAILED) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because p_map can not be changed
+ ROM_ACCESS_ERRNO(0 == EL_mem_exram_munmap(p_map, // LCOV_EXCL_BR_LINE 11:unexpected branch
+ mapSize));
+ }
+ return eStatus; // LCOV_EXCL_BR_LINE 11:unexpected branch
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetDataResetMode(EDATARESET_MODE dataResetMode) {
+ EFrameworkunifiedStatus eStatus;
+ EDATARESET_MODE l_mode = dataResetMode;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ try {
+ if (m_pBoot == NULL) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because m_pBoot can not be changed
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ m_pBoot = new BOOT_AccessIf(BAI_OPEN_RW);
+ // LCOV_EXCL_BR_STOP
+ if (eFrameworkunifiedStatusOK != m_pBoot->getBootInfo(&m_nor)) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ throw eFrameworkunifiedStatusFail;
+ }
+ }
+ m_norIsDirty = true;
+ if (dataResetMode == DATARESET_FACTORY) {
+ m_nor.sts1 = m_nor.sts2 = m_nor.sts3 = SYSUP_CND_FACTRESET;
+ l_mode = DATARESET_NONE;
+ } else {
+ m_nor.sts1 = m_nor.sts2 = m_nor.sts3 = SYSUP_CND_NORMAL;
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_DATARESET_MODE, l_mode))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ } catch (const EFrameworkunifiedStatus& e) {
+ ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch
+ eStatus = e;
+ } catch (...) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ROM_ACCESS_ASERT(0);
+ eStatus = eFrameworkunifiedStatusFail;
+ } // LCOV_EXCL_STOP
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetResetCount(UI_32* pResetCount) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_RESET_COUNT, reinterpret_cast<UI_32 *>(pResetCount),
+ 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+EFrameworkunifiedStatus ROM_AccessIf::SetResetCount(UI_32 resetCount) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (eFrameworkunifiedStatusOK != (eStatus = // LCOV_EXCL_BR_LINE 11:unexpected branch
+ LBA_Write(INDEX_RESET_COUNT, resetCount))) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch
+ eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+EFrameworkunifiedStatus ROM_AccessIf::GetLastIlgReset(ELASTILGRESET_MODE* pLastIlgReset) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_LAST_ILGRESET,
+ reinterpret_cast<UI_32 *>(pLastIlgReset), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetLastIlgReset(ELASTILGRESET_MODE lastIlgReset) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_LAST_ILGRESET, lastIlgReset))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch
+ eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetProgUpdateState(
+ EPROGUPDATE_STATE* pProgUpdateState) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_PROGUPDATE_STATE,
+ reinterpret_cast<UI_32 *>(pProgUpdateState), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetProgUpdateState(EPROGUPDATE_STATE progUpdateState) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_PROGUPDATE_STATE, progUpdateState))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch
+ eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetErrLogCount(UI_32* pErrLogCount) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_ERR_LOG_COUNT,
+ reinterpret_cast<UI_32 *>(pErrLogCount), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetErrLogCount(UI_32 errLogCount) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK != (eStatus = // LCOV_EXCL_BR_LINE 11:unexpected branch
+ LBA_Write(INDEX_ERR_LOG_COUNT, errLogCount))) { // LCOV_EXCL_BR_LINE 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch
+ eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetNextWakeupType(ENEXT_WAKEUP_TYPE *pNextWakeupType) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_NEXT_WAKEUP_TYPE,
+ reinterpret_cast<UI_32 *>(pNextWakeupType), 1))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetNextWakeupType(ENEXT_WAKEUP_TYPE nextWakeupType) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_NEXT_WAKEUP_TYPE, nextWakeupType))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch
+ " Error: LBA_Write() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetActiveFlashloader(
+ EACTIVE_FLASHLOADER activeFlashloader) {
+ EFrameworkunifiedStatus eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_ACTIVE_FLASHLOADER, activeFlashloader))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(
+ ZONE_ERR,
+ __FUNCTION__,
+ " Error: LBA_Write(%s) errored: 0x%X",
+ activeFlashloader == NEW_FLASHLOADER ?
+ "NEW_FLASHLOADER" : "OLD_FLASHLOADER",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::SetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Write(INDEX_PRODUCT_PRIVATE, reinterpret_cast<UI_32*>(buf),
+ ROM_PRODUCT_PRIVATE_MAX / sizeof(UI_32)))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X",
+ eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus ROM_AccessIf::GetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:unexpected branch
+ if (eFrameworkunifiedStatusOK
+ != (eStatus = LBA_Read(INDEX_PRODUCT_PRIVATE, reinterpret_cast<UI_32 *>(buf),
+ ROM_PRODUCT_PRIVATE_MAX / sizeof(UI_32)))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 11:unexpected branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Read() errored: 0x%X", eStatus);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return eStatus;
+}
diff --git a/video_in_hal/systemservice/system_manager/LICENSE b/video_in_hal/systemservice/system_manager/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/systemservice/system_manager/Makefile.server b/video_in_hal/systemservice/system_manager/Makefile.server
new file mode 100755
index 0000000..83bc39b
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/Makefile.server
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS += server
+
+include ../system_service.mk
diff --git a/video_in_hal/systemservice/system_manager/server/Makefile b/video_in_hal/systemservice/system_manager/server/Makefile
new file mode 100755
index 0000000..04185f9
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/Makefile
@@ -0,0 +1,118 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = SS_SystemManager
+
+######### installed library(*.a) #############
+
+
+######### installed shared library(*.so) #############
+
+
+######### install headers(*.h) #############
+
+
+######### compiled sources #############
+SS_SystemManager_SRCS += ./src/processlauncher/ProcessLauncher.cpp
+SS_SystemManager_SRCS += ./src/processlauncher/ProcessLauncher_if.cpp
+SS_SystemManager_SRCS += ./src/heartbeat/ss_hb_if.cpp
+SS_SystemManager_SRCS += ./src/heartbeat/ss_hb_service_protocol.cpp
+SS_SystemManager_SRCS += ./src/heartbeat/ss_hb_session.cpp
+SS_SystemManager_SRCS += ./src/heartbeat/ss_hb_thread.cpp
+SS_SystemManager_SRCS += ./src/systemmanager_application.cpp
+SS_SystemManager_SRCS += ./src/systemmanager_main.cpp
+SS_SystemManager_SRCS += ./src/ss_sm_config.cpp
+SS_SystemManager_SRCS += ./src/ss_sm_dynamic_launcher.cpp
+SS_SystemManager_SRCS += ./src/ss_sm_version.cpp
+SS_SystemManager_SRCS += ./src/ss_system_manager.cpp
+SS_SystemManager_SRCS += ./src/ss_system_manager_callbacks.cpp
+SS_SystemManager_SRCS += ./src/ss_system_manager_error_event.cpp
+SS_SystemManager_SRCS += ./src/ss_system_manager_error_event_responses.cpp
+SS_SystemManager_SRCS += ./src/ss_system_manager_error_event_triggers.cpp
+SS_SystemManager_SRCS += ./src/ss_system_memory_monitor.cpp
+
+######### add source path #############
+
+
+######### add include path #############
+CPPFLAGS += -I./
+CPPFLAGS += -I./include
+CPPFLAGS += -I./include/heartbeat
+CPPFLAGS += -I./include/processlauncher
+CPPFLAGS += -I./../../interface_unified/library/include
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+
+CPPFLAGS_ProcessLauncher.o = -fno-exceptions
+CPPFLAGS_ProcessLauncher_if.o = -fno-exceptions
+CPPFLAGS_ss_hb_if.o = -fno-exceptions
+CPPFLAGS_ss_hb_thread.o = -fno-exceptions
+CPPFLAGS_systemmanager_application.o = -fno-exceptions
+CPPFLAGS_systemmanager_main.o = -fno-exceptions
+CPPFLAGS_ss_system_memory_monitor.o = -fno-exceptions
+CPPFLAGS_ss_hb_service_protocol.o = -fno-exceptions
+CPPFLAGS_ss_hb_session.o = -fno-exceptions
+CPPFLAGS_ss_sm_dynamic_launcher.o = -fno-exceptions
+CPPFLAGS_ss_sm_version.o = -fno-exceptions
+CPPFLAGS_ss_system_manager.o = -fno-exceptions
+CPPFLAGS_ss_system_manager_error_event.o = -fno-exceptions
+
+######### linked library #############
+#LDLIBS += -Wl,-Bstatic -lxxx
+LDLIBS += -Wl,-Bstatic -lSS_LoggerStoreLogs
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lrt # for mq_xxx
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lssver
+
+LDLIBS += -Wl,-Bdynamic -lresm
+LDLIBS += -Wl,-Bdynamic -lsssmcfg
+LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI
+LDLIBS += -Wl,-Bdynamic -lClock_API
+LDLIBS += -Wl,-Bdynamic -lpower_hal
+
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+LDLIBS += -Wl,-Bdynamic -lvp
+LDLIBS += -Wl,-Bdynamic -ltar -lz
+LDLIBS += -Wl,-Bdynamic -lrpc -lev
+
+######### add library path #############
+LDFLAGS += -g -Wl,--gc-sections
+LDFLAGS += -Wl,--warn-unresolved-symbols
+LDFLAGS += -Wl,--no-as-needed
+
+LINK_CXX=Y
+
+install-data: install_data
+
+install_data:
+ cpp -P -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_thread.h ./sm_launch__CWORD84_.xml ./sm_launch.tmp.xml
+ $(SDKTARGETSYSROOT)/usr/agl/share/launch_xml2cfg.sh ./sm_launch.tmp.xml > ./sm_launch.cfg
+ install -d -m 755 $(DESTDIR)/usr/agl/conf/BS/ss/system_manager/rwdata
+ install -m 644 ./sm_launch.cfg $(DESTDIR)/usr/agl/conf/BS/ss/system_manager/rwdata
+ install -d -m 755 $(DESTDIR)/nv/BS/ss/system_manager/rwdata
+ install -d -m 755 $(DESTDIR)/usr/agl/share/BS/ss/system_manager/rodata
+ install -m 644 ./version.txt $(DESTDIR)/usr/agl/share/BS/ss/system_manager/rodata
+ install -m 644 ./PhaseInfo.txt $(DESTDIR)/usr/agl/share/BS/ss/system_manager/rodata
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/system_manager/server/PhaseInfo.txt b/video_in_hal/systemservice/system_manager/server/PhaseInfo.txt
new file mode 100755
index 0000000..7ed792b
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/PhaseInfo.txt
@@ -0,0 +1,2 @@
+Unknown
+20191026
diff --git a/video_in_hal/systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h b/video_in_hal/systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h
new file mode 100755
index 0000000..ae05af4
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for child process exit detection.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_CRASH_DETECTOR_H_ // NOLINT
+#define SS_CRASH_DETECTOR_H_
+
+#include <string>
+
+class CCrashDetector {
+ public:
+ CCrashDetector();
+ virtual ~CCrashDetector();
+ EFrameworkunifiedStatus CrashDetectorInitialize(HANDLE hApp);
+ PCSTR CrashDetectorGetThreadName();
+
+ HANDLE m_hSmQueue;
+
+ private:
+ SI_32 CrashDetectorGetThreadPriority();
+
+ HANDLE m_hApp;
+ pthread_t m_ThreadId;
+ std::string m_ThreadName;
+ SI_32 m_siPriority;
+};
+
+#endif // SS_CRASH_DETECTOR_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_if.h b/video_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_if.h
new file mode 100755
index 0000000..8d6618f
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_if.h
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef HEARTBEAT_INTERFACE_H_ // NOLINT
+#define HEARTBEAT_INTERFACE_H_
+
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+
+/**
+ * Enumeration: message category
+ */
+typedef enum HB_STATUS {
+ HB_STATUS_INVALID
+ , HB_STATUS_REGISTERED
+ , HB_STATUS_GOOD
+ , HB_STATUS_FAILED
+ , HB_STATUS_TIMEOUT
+} EHBStatus;
+
+/*
+ * Structure: report message data
+ */
+typedef struct MODULE_INFO {
+#define SS_SM_HB_MAX_PROC_NAME_SIZE 16
+ EHBStatus ProcHBState;
+ UI_32 HeartBeatRetryCount;
+ // "ProcQueueName" is limited 16 bytes (included terminal-character NULL), so that the size of "THbReportData" will be lower than 4K Bytes.
+ CHAR ProcQueueName[SS_SM_HB_MAX_PROC_NAME_SIZE];
+} TSmModuleInfo;
+
+typedef struct HB_REPORT_DATA {
+ EHBStatus eEntireState; ///< entire state for a request.
+ ///< if all modules are success, it's success, otherwise failed.
+ UI_32 nNumOfModules; ///< number of modules
+ TSmModuleInfo tModuleList[SS_MAX_NUM_MODULES]; ///< module information list, which include module IDs and states
+} THbReportData;
+
+typedef struct HB_AVAIL_CHECK {
+ BOOL isOk;
+ CHAR serviceName[SS_SM_HB_MAX_PROC_NAME_SIZE];
+} THbAvailCheck;
+
+
+EFrameworkunifiedStatus HBThreadStart(HANDLE hThread);
+EFrameworkunifiedStatus HBThreadStop(HANDLE hThread);
+
+#endif // HEARTBEAT_INTERFACE_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_session.h b/video_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_session.h
new file mode 100755
index 0000000..5414f09
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_session.h
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_HEARTBEAT_SESSION_H_ // NOLINT
+#define SS_HEARTBEAT_SESSION_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+#include <map>
+#include <string>
+
+#include "ss_hb_if.h"
+
+// The name of the module that is trying to open a session with Heart Beat
+typedef std::string SubscriberName;
+
+/*
+ *
+ */
+class CHeartBeatSessionHandler {
+ public:
+ CHeartBeatSessionHandler();
+ virtual ~CHeartBeatSessionHandler();
+
+ EFrameworkunifiedStatus HBProcessClientResponse(HANDLE hApp);
+
+ EFrameworkunifiedStatus HBEntrySubscriber(SubscriberName &f_Subscriber); // NOLINT
+ EFrameworkunifiedStatus HBSendRequest(HANDLE hApp, SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex);
+ EFrameworkunifiedStatus HBCheckResponses(THbReportData &f_tReportData, UI_32 f_MaxHeartBeatRetryCount, // NOLINT
+ SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex);
+
+ EFrameworkunifiedStatus HBDeleteRegisteredClientEntry(HANDLE f_hThread, PSTR pQueueName);
+ EFrameworkunifiedStatus HBAvailableCheck(THbAvailCheck &check); // NOLINT
+
+ VOID HBPrintConnection();
+ VOID HBPrintStack(UI_32 f_MaxHeartBeatRetryCount);
+
+ private:
+ class HbSessionInfo {
+ public:
+ std::string szName;
+ HANDLE hSession;
+ BOOL fRunning;
+ BOOL fHeartBeatRequestSent;
+ BOOL fHeartBeatResponseReceived;
+ UI_8 HeartBeatRetryCount;
+ BOOL fHeartBeatTimedOut;
+ BOOL fisAvailability;
+
+ // Copy constructor
+ HbSessionInfo(const HbSessionInfo &f_SessionInfo) {
+ szName = f_SessionInfo.szName;
+ hSession = f_SessionInfo.hSession;
+ fRunning = f_SessionInfo.fRunning;
+ fHeartBeatRequestSent = f_SessionInfo.fHeartBeatRequestSent;
+ fHeartBeatResponseReceived = f_SessionInfo.fHeartBeatResponseReceived;
+ HeartBeatRetryCount = f_SessionInfo.HeartBeatRetryCount;
+ fHeartBeatTimedOut = f_SessionInfo.fHeartBeatTimedOut;
+ fisAvailability = f_SessionInfo.fisAvailability;
+ }
+
+ explicit HbSessionInfo(SubscriberName f_Subscriber);
+ };
+
+ typedef std::map<SubscriberName, HbSessionInfo> HbSessionMap;
+ typedef HbSessionMap::iterator HbSessionIter;
+
+ HbSessionMap m_mapHbSessions;
+};
+#endif // SS_HEARTBEAT_SESSION_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h b/video_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h
new file mode 100755
index 0000000..7ca8e17
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h
@@ -0,0 +1,206 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef HEARTBEAT_WORKER_H_ // NOLINT
+#define HEARTBEAT_WORKER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_system_timer.h>
+
+#include "ss_hb_session.h"
+#include "ss_sm_config.h"
+
+
+class CHeartBeatThread {
+ public:
+ explicit CHeartBeatThread(HANDLE f_hThread);
+ virtual ~CHeartBeatThread();
+
+ ///////////////////////////
+ /// HBPublishAvailabilityStatus
+ /// At HeartBeat sends NTFY_Availability with availability
+ /// notification to alert client that HeartBeat is available/not available.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBPublishAvailabilityStatus(HANDLE hThread, BOOL f_AvailabiltyStatus);
+
+ ///////////////////////////
+ /// HBOnStartThread
+ /// Creates and starts the HeartBeat timer
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnStartThread(HANDLE hThread);
+
+
+ ///////////////////////////
+ /// HBOnStopThread
+ /// Stops and deletes the HeartBeat timer
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnStopThread(HANDLE hThread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HBOnPrintConnections
+ /// Prints all active sessions connected to HeartBeat
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnPrintConnections(HANDLE hThread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HBOnPrintStack
+ /// Prints all sessions connected to HeartBeat
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnPrintStack(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnTimerExpiry
+ /// When APP timer expires, this method sends the HeartBeat request to the client.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnTimerExpiry(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnClientResponse
+ /// When the response from a client is received, this method updates the map
+ /// containing client status to indicate the response.
+ ///
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnClientResponse(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnPeriodicStatusRequest
+ /// Reply to Status request from System Manager
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnPeriodicStatusRequest(HANDLE hThread);
+
+
+ ///////////////////////////
+ /// HBOnAvailCheckRequest
+ /// Reply to service's availability condition request from System Manager
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnAvailCheckRequest(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnRemoveModule
+ /// Upon receiving delete module notification from sysmgr, this method removes
+ /// a client from the client session map.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnRemoveModule(HANDLE hApp);
+
+ ///////////////////////////
+ /// HBOnAppendModule
+ /// Upon receiving append module notification from sysmgr, this method append
+ /// a client from the client session map.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnAppendModule(HANDLE hApp);
+
+ // Service notification handlers
+ EFrameworkunifiedStatus HBSendRequest(HANDLE hApp);
+ EFrameworkunifiedStatus HBCheckHeartBeatResponses(HANDLE hThread);
+ EFrameworkunifiedStatus HBDeleteRegisteredClientEntry(PSTR pModuleName);
+
+ EFrameworkunifiedStatus HeartBeatTimerInit(HANDLE hThread);
+ EFrameworkunifiedStatus HeartBeatTimersDelete(void);
+
+ private:
+ CHeartBeatSessionHandler m_oSessionHandler;
+ TimerCtrl m_oTimerCtrl;
+ UI_32 m_HBTimerID;
+ HBConfigParameters m_HBConfigParams;
+ SI_32 m_NextChkIndex;
+ HANDLE m_hThread;
+};
+#endif // HEARTBEAT_WORKER_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h b/video_in_hal/systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h
new file mode 100755
index 0000000..409524f
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef CPROCESSLAUNCHER_H_ // NOLINT
+#define CPROCESSLAUNCHER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_process.h>
+#include <string>
+#include "ss_system_manager.h"
+#include "ss_sm_process_launcher.h"
+
+/*
+ *
+ */
+class CProcessLauncher {
+ public:
+ CProcessLauncher();
+ explicit CProcessLauncher(void *);
+ virtual ~CProcessLauncher();
+
+ EFrameworkunifiedStatus PLOnCmdTerminateModule(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdModuleStatus(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdLaunchModule(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdRelaunchModule(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdHeartbeatStatusReq(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdStop(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdStart(HANDLE hThread);
+ protected:
+ ProcessMap m_mapOfProcesses;
+
+ private:
+ EFrameworkunifiedStatus PLCmdLaunchModule(HANDLE hThread,
+ UI_32 f_protocol_ID,
+ std::string f_protocol_str);
+ EFrameworkunifiedStatus PLLaunchModule(HANDLE hThread, T_ProcessLaunchResp &f_LaunchRespData); // NOLINT
+ EFrameworkunifiedStatus PLTerminateModule(HANDLE hThread, T_ProcessLauncherTerminationResp *f_pTerminateRespData = NULL);
+};
+#endif // CPROCESSLAUNCHER_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h b/video_in_hal/systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h
new file mode 100755
index 0000000..f8d047a
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef PROCESSLAUNCHER_IF_H_ // NOLINT
+#define PROCESSLAUNCHER_IF_H_
+
+EFrameworkunifiedStatus ProcessLauncherOnStart(HANDLE hThread);
+EFrameworkunifiedStatus ProcessLauncherOnStop(HANDLE hThread);
+
+#endif // NOLINT
+
diff --git a/video_in_hal/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h b/video_in_hal/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h
new file mode 100755
index 0000000..1ca177c
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_PROCESS_LAUNCHER_H_ // NOLINT
+#define SS_SM_PROCESS_LAUNCHER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+
+#include "ss_sm_config.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// System manager launches the modules using the process launcher.
+/// The system manager launches the modules by sending the data about the process to be launched by
+/// the message ePLThrdCmd_LAUNCH_MODULE_REQST.
+/// SM => PL
+///////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ CHAR name[SS_SM_MAX_MODULE_NAME_LENGTH];
+ CHAR path[SS_SM_MAX_MODULE_PATH_LENGTH];
+ CHAR args[SS_SM_MAX_MODULE_ARGS_LENGTH];
+ UI_32 priority;
+ CHAR logging_mask[SS_SM_MAX_MODULE_LOG_MASK_LENGTH];
+ GroupLaunchMapIter groupIterator;
+ ModuleLaunchListIter moduleIterator;
+ int cpu_assign;
+} T_ProcessLauncherLaunchReq;
+
+///////////////////////////////////////////////////////////////////////////////
+/// After successfully launching an module, the process launcher sends the
+/// pid of the launched process along with the process name and arguments
+/// by the message ePLThrdCmd_LAUNCH_MODULE_RESP.
+/// System manager will verify the process name and the arguments and update
+/// the pid in its process table.
+///
+/// This message will be sent for every module that is launched by process launcher.
+/// Launch success returns a number > 0 for ProcessID, which is the PID of the
+/// newly created process.
+/// Launch failure returns -1 for ProcessID.
+/// PL => SM
+///////////////////////////////////////////////////////////////////////////////
+/// The response of the module relaunch message from process launcher to system
+/// manager ePLThrdCmd_RELAUNCH_MODULE_RESP is defined by the below structure
+/// A process ID value of > 0 indicates the success of the operation.
+/// The process name and args are used to ensure correct mapping of requests
+/// and responses.
+/// PL => SM
+///////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ SI_32 pid;
+ CHAR name[SS_SM_MAX_MODULE_NAME_LENGTH];
+ CHAR path[SS_SM_MAX_MODULE_PATH_LENGTH];
+ CHAR args[SS_SM_MAX_MODULE_ARGS_LENGTH];
+ UI_32 priority;
+ GroupLaunchMapIter groupIterator;
+ ModuleLaunchListIter moduleIterator;
+} T_ProcessLaunchResp;
+
+///////////////////////////////////////////////////////////////////////////////
+/// System manager terminates the process when it detects there is something
+/// wrong with the process. The system manager send the message
+/// ePLThrdCmd_TERMINATE_MODULE_REQST to process launcher as required.
+/// The request data is defined as below
+/// SM => PL
+///////////////////////////////////////////////////////////////////////////////
+typedef T_ProcessLauncherLaunchReq T_ProcessLauncherTerminationReq;
+
+///////////////////////////////////////////////////////////////////////////////
+/// The response of the module termination response message from process
+/// launcher to system manager
+/// ePLThrdCmd_TERMINATE_MODULE_RESP is defined by the below structure
+/// A ProcessID value of 0 indicates the success of the operation.
+/// The process name and args are used to ensure correct mapping of requests
+/// and responses.
+/// PL => SM
+///////////////////////////////////////////////////////////////////////////////
+typedef T_ProcessLaunchResp T_ProcessLauncherTerminationResp;
+
+///////////////////////////////////////////////////////////////////////////////
+/// The system manager requests a module relaunch by the message
+/// ePLThrdCmd_RELAUNCH_MODULE_REQST.
+/// The message data is described by the below structure
+/// The old process ID is passed sent in the request and a new process ID is
+/// expected in the response.
+/// The process launcher launches the module and does internal retries for this
+/// kind of request in case of failure.
+/// SM => PL
+///////////////////////////////////////////////////////////////////////////////
+typedef T_ProcessLauncherLaunchReq T_ProcessLauncherRelaunchReq;
+
+#endif // SS_SM_PROCESS_LAUNCHER_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h b/video_in_hal/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h
new file mode 100755
index 0000000..cd69832
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h
@@ -0,0 +1,62 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_PROCESS_LAUNCHER_PROTOCOL_H_ // NOLINT
+#define SS_SM_PROCESS_LAUNCHER_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+#include <system_service/ss_system_manager_protocol.h>
+
+typedef enum _ESMPLThreadCommandIds {
+ //// <
+ ePLThrdCmd_LAUNCH_MODULE_REQST = 0x543, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_LAUNCH_MODULE_RESP, ///< SM.ProcessLauncher --> SM
+
+ //// <
+ ePLThrdCmd_TERMINATE_MODULE_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_TERMINATE_MODULE_RESP, ///< SM.ProcessLauncher --> SM
+
+ //// <
+ ePLThrdCmd_RELAUNCH_MODULE_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_RELAUNCH_MODULE_RESP, ///< SM.ProcessLauncher --> SM
+
+ //// <
+ ePLThrdCmd_MODULE_STATUS_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_THREAD_STATUS_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_THREAD_STATUS_RESP, ///< SM.ProcessLauncher --> SM
+
+ ePLThrdCmd_NONE, ///< Not sent. Used for initialization.
+} ESMPLThreadCommandIds;
+
+
+#endif // SS_SM_PROCESS_LAUNCHER_PROTOCOL_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_sm_config.h b/video_in_hal/systemservice/system_manager/server/include/ss_sm_config.h
new file mode 100755
index 0000000..19736f6
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_sm_config.h
@@ -0,0 +1,543 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_CONFIG_H_ // NOLINT
+#define SS_SM_CONFIG_H_
+
+#include <native_service/ns_config_parser_if.h>
+#include <system_service/ss_system_types.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_string_maps.h>
+#include <list>
+#include <map>
+#include <string>
+#include <vector>
+#include "ss_sm_process_launcher_protocol.h"
+
+
+/// All timer values are **position-dependent** in the timer calls ! These
+/// defines are currently all used as Start and Restart Seconds parameters.
+/// \param [in] id
+/// UI_32 - timer id that you want to start
+/// \param [in] ss
+/// UI_32 - Start time in seconds
+/// \param [in] sms
+/// UI_32 - Start time in milliseconds
+/// \param [in] rs
+/// UI_32 - Repeat time in seconds
+/// \param [in] rms
+/// UI_32 - Repeat time in milliseconds
+#define SS_GROUP_LAUNCH_TIMER_CONFIG (3)
+#define SS_HEARTBEAT_MONITOR_TIMER_CONFIG (10)
+#define SS_PROCESSLAUNCHER_MONITOR_TIMER_CONFIG (10)
+#define SS_CLIENT_START_MONITOR_TIMER_CONFIG (3)
+#define SS_CLIENT_STOP_MONITOR_TIMER_CONFIG (1)
+#define SS_NPP_STATUS_CHECK_MONITOR_TIME_SEC (5)
+#define SS_LAUNCH_GROUP_TRIGGER_TIMER_CONFIG (10)
+// size of the internal debug dump buffer
+#define SS_SM_DEBUG_DUMP_MAX_SIZE (12288u)
+// number of _CWORD56_ command history log entries for the debug dump
+#define SS_SM__CWORD56__CMD_HIST_SIZE (10u)
+// number of timer history log entries for the debug dump
+#define SS_SM_TIMER_CMD_HIST_SIZE (10u)
+// number of message history log entries for the debug dump
+#define SS_SM_CMD_HIST_SIZE (20u)
+// number of publishing history log entries for the debug dump
+#define SS_SM_PUB_CMD_HIST_SIZE (5u)
+// number of error history log entries for the debug dump
+#define SS_SM_ERR_HIST_SIZE (5u)
+
+// When occurs repeat to abnormal rebooting, logging cause of error at first time and next time.
+// When it occurs "ILG_RESET", Maximum number of log is 4 so that the log will be stored at the just after the startup.
+// Need reconsideration if maximum number of abnormal logging is less than 4 using SSL.
+#define SS_SM_ERR_LOGGING_LIMIT (8)
+
+// Maximum number of continuous processing of "NaviReset" by errors.
+// It try to recover by NaviDet when it exceeds this limit.
+#define SS_SM_ERR_NAVI_RESET_LIMIT (5)
+
+typedef enum {
+ MODULE_STATE_INVALID = 0 /// Initial state of all modules
+ , MODULE_STATE_SKIPPED /// Non-critical module has crossed max re-launch limit
+ /// or hSession was null when attempted to start
+ , MODULE_STATE_LAUNCHING /// Module launch has been requested
+ , MODULE_STATE_LAUNCHED /// Module has been launched but a session
+ /// connection has NOT been established
+ , MODULE_STATE_LAUNCH_FAILED /// Oops
+ , MODULE_STATE_CONNECTED /// A session connection has been established
+ , MODULE_STATE_START_SENT /// SM has sent START to the module
+ , MODULE_STATE_START_FAILED /// FrameworkunifiedSendMsg(SS_SM_START) failed
+ , MODULE_STATE_STARTED /// Module has replied START Complete to SM
+ , MODULE_STATE_STOP_SENT /// SM has sent STOP to the module
+ , MODULE_STATE_STOP_FAILED /// FrameworkunifiedSendMsg(SS_SM_STOP) failed
+ , MODULE_STATE_STOPPED /// Module has replied STOP Complete to SM
+ , MODULE_STATE_START_PRE_SENT //!< SM has sent Pre-boot start to the module
+ , MODULE_STATE_START_PRE_FAILED //!< FrameworkunifiedSendMsg(SS_SM_PRE_START) failed
+ , MODULE_STATE_STARTED_PRE //!< Module has replied Pre-boot start Complete to SM
+ , MODULE_STATE_STOP_PRE_SENT //!< SM has sent Pre-boot stop to the module
+ , MODULE_STATE_STOP_PRE_FAILED //!< FrameworkunifiedSendMsg(SS_SM_PRE_STOP) failed
+ , MODULE_STATE_STOPPED_PRE //!< Module has replied Pre-boot stopComplete to SM
+ , MODULE_STATE_START_BACKGROUND_SENT //!< SM has sent Background-boot start to the module
+ , MODULE_STATE_START_BACKGROUND_FAILED //!< FrameworkunifiedSendMsg(SS_SM_BACKGROUND_START) failed
+ , MODULE_STATE_STARTED_BACKGROUND //!< Module has replied Background-boot start Complete to SM
+ , MODULE_STATE_STOP_BACKGROUND_SENT //!< SM has sent Background-boot stop to the module
+ , MODULE_STATE_STOP_BACKGROUND_FAILED //!< FrameworkunifiedSendMsg(SS_SM_BACKGROUND_STOP) failed
+ , MODULE_STATE_STOPPED_BACKGROUND //!< Module has replied Background-boot stop Complete to SM
+} SMModuleState;
+//
+// Module State string map type
+typedef std::map<SMModuleState, std::string> SMModuleStateStrMapType;
+
+typedef enum {
+ MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED = 0
+ , MODULE_DEBUG_DUMP_STATE_REQUEST_SENT
+ , MODULE_DEBUG_DUMP_STATE_RESPONSE_RECEIVED
+} SMModuleDebugDumpState;
+
+typedef std::map<SMModuleDebugDumpState, std::string> SMModuleDebugDumpStateStrMapType;
+
+/*
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration>
+ <!-- System Service Launch control elements -->
+ <SystemManager>
+ <Launch>
+ <Group1>
+ <group_name>CoreModules</group_name>
+ <group_id>1</group_id>
+ <Member1>
+ <name>TRUE</name>
+ <path>1</path>
+ <priority>200</priority>
+ <critical>TRUE</critical>
+ <retry_cnt>1</retry_cnt>
+ <arguments></arguments>
+ <logging_mask></logging_msk>
+ <restart>group</restart>
+ <shudown_critical></shudown_critical>
+ <shudown_wait_time></shudown_wait_time>
+ </Member1>
+ <Member2>
+ <name>TRUE</name>
+ <path>1</path>
+ <priority>200</priority>
+ <critical>TRUE</critical>
+ <retry_cnt>1</retry_cnt>
+ <arguments></arguments>
+ <logging_mask></logging_msk>
+ <restart>me</restart>
+ <shudown_critical></shudown_critical>
+ <shudown_wait_time></shudown_wait_time>
+ </Member2>
+ </Group1>
+ </Launch>
+ </SystemManager>
+</Configuration>
+*/
+
+//******************************************************************************
+//* CTimeSpan class *
+//* *
+class CTimeSpan {
+ public:
+ CTimeSpan(): initial(0), final(0), delta(0) {}
+ CTimeSpan(UI_64 f_initial) // NOLINT
+ : initial(f_initial), final(0), delta(0) {}
+ ~CTimeSpan() {}
+ /*
+ * Set Initial time, reset Final and Delta to zero, return time
+ */
+ UI_64 Begin();
+ /*
+ * Set Final time, calculate Delta time, return time
+ */
+ UI_64 End();
+ UI_64 GetInitial();
+ UI_64 GetFinal();
+ UI_64 GetDelta();
+ UI_64 GetTimeMilliseconds();
+
+ private:
+ UI_64 initial;
+ UI_64 final;
+ UI_64 delta;
+}; // End of class CTimeSpan
+//******************************************************************************
+
+
+typedef enum {
+ NotStopped,
+ StoppedByModuleStopComplete,
+ StoppedByModuleStopFail,
+ StoppedByGroupStopTimeout,
+ StoppedByCriticalAppsTimeout,
+ StoppedByModulePreStopComplete,
+ StoppedByModulePreStopFail,
+ StoppedByModuleBackgroundStopComplete,
+ StoppedByModuleBackgroundStopFail
+} EStopReasonType;
+
+typedef enum {
+ NotStarted,
+ StartedByModuleStartComplete,
+ StartedByModuleStartFail,
+ StartedByModulePreStartComplete,
+ StartedByModulePreStartFail,
+ StartedByModuleBackgroundStartComplete,
+ StartedByModuleBackgroundStartFail
+} EStartReasonType;
+
+//******************************************************************************
+//* CTimeEvent class *
+//* *
+template <typename EEventType>
+class CTimeEvent : public CTimeSpan {
+ public:
+ CTimeEvent() {
+ bzero(&m_eventReason, sizeof(m_eventReason));
+ }
+ ~CTimeEvent() {}
+
+ VOID SetReason(EEventType f_eventReason)
+ { m_eventReason = f_eventReason; }
+ private:
+ EEventType m_eventReason;
+}; // End of class CTimeEvent
+//******************************************************************************
+
+typedef enum {
+ NotRelaunched,
+ RelaunchSafe,
+ RelaunchErr
+} ERelaunchStatusType;
+
+
+typedef CTimeEvent<EStartReasonType> CStartReason;
+typedef CTimeEvent<EStopReasonType> CStopReason;
+typedef CHAR TUserNameBuffer[128]; // TODO(yaomingwu): Stuff. Does Posix define a useful
+ // constant representing max length of user id?
+
+class ModuleLaunchParams {
+ public:
+ // Move to private to prevent direct access
+ // SMModuleState module_state;
+ //
+ SS_String name;
+ SS_String path;
+ SS_String arguments;
+ SS_String restart;
+ UI_32 configuration_priority;
+ int cpu_assign;
+ UI_32 previous_priority;
+ UI_32 current_priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ SS_String logging_msk_str;
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+ UI_32 fast_shutdown_wait_time;
+ SI_32 pid;
+ HANDLE hsession;
+ UI_32 relaunch_count;
+ ERelaunchStatusType relaunch_status;
+ UI_32 group_id;
+ TUserNameBuffer unix_user_name;
+
+ BOOL m_serviceAvailability; // Not set because it does not watch Availability for speeding up start up process.
+
+ CStartReason m_startReason;
+ CStopReason m_stopReason;
+
+ ModuleLaunchParams();
+ ~ModuleLaunchParams();
+ SMModuleState GetModuleState(void);
+ BOOL IsModuleState(SMModuleState f_moduleState);
+ BOOL IsModuleConnected() const;
+ VOID SetModuleState(SMModuleState f_moduleState, BOOL f_bLog = TRUE);
+ std::string ModuleStateStr(void);
+
+ SMModuleDebugDumpState GetModuleDebugDumpState(void);
+ std::string GetModuleDebugDumpStateStr(void);
+ VOID SetModuleDebugDumpState(SMModuleDebugDumpState f_moduleDebugDumpState, BOOL f_bLog = TRUE);
+ EFrameworkunifiedStatus SendMsgAndUpdateState(
+ const UI_32 f_iCmd, const T_SS_SM_START_DataStructType* const f_startData);
+ EFrameworkunifiedStatus SendMsgAndUpdateState(T_SS_SM_STOP_DataStruct const* f_stopData);
+
+ EFrameworkunifiedStatus GetPriority(UI_32& f_Priority); // NOLINT
+ EFrameworkunifiedStatus SetPriority(UI_32 f_Priority);
+
+ BOOL IsAGLUnit(void) const { return is_agl_unit; }
+ BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; }
+ BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; }
+ void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; }
+ void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) {
+ disable_agl_resethistory = f_disable_agl_resethistory;
+ }
+ void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) {
+ disable_nonagl_resethistory = f_disable_nonagl_resethistory;
+ }
+
+ private:
+ SMModuleState m_moduleState;
+ SMModuleStateStrMapType m_ModuleStateStrMap;
+ SMModuleDebugDumpState m_ModuleDebugDumpState;
+ SMModuleDebugDumpStateStrMapType m_ModuleDebugDumpStateStrMap;
+ BOOL is_agl_unit;
+ BOOL disable_agl_resethistory;
+ BOOL disable_nonagl_resethistory;
+};
+
+typedef std::list<ModuleLaunchParams> ModuleLaunchList;
+typedef ModuleLaunchList::iterator ModuleLaunchListIter;
+
+typedef struct _GroupLaunchInfo { // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ BOOL launch_complete;
+ BOOL start_complete;
+ BOOL stop_complete;
+ SS_String name;
+ UI_32 id;
+ UI_32 grp_launch_wait;
+ UI_32 grp_wait_for_trigger;
+ ModuleLaunchList modules;
+} GroupLaunchInfo;
+
+typedef std::list<GroupLaunchInfo> GroupLaunchList;
+typedef GroupLaunchList::iterator GroupLaunchListIter;
+
+typedef std::map<UI_32, GroupLaunchInfo> GroupLaunchMap;
+typedef GroupLaunchMap::iterator GroupLaunchMapIter;
+
+typedef std::list<GroupLaunchList> GroupList;
+typedef GroupList::iterator GroupListIter;
+
+// Process Binary Name (key) to ModuleLaunchList iterator (ModuleLaunchParams).
+typedef std::map<std::string, ModuleLaunchListIter>ProcessNameMap;
+typedef ProcessNameMap::iterator ProcessNameMapIter;
+
+// Config Parameters specific to Heart Beat Thread
+typedef struct _HBConfigParams {
+ SI_32 MaxHeartBeatRetryCount; /// Retry heart beat check before error report is sent to SM
+ SI_32 ApplicationHeartBeatIntervalInitial; /// Initial Timer interval
+ /// between two heart beat requests & response check
+ SI_32 ApplicationHeartBeatIntervalRepeat; /// Repeat Timer interval between two heart beat requests & response check
+} HBConfigParameters;
+
+typedef struct _CDConfigParams {
+ BOOL CrashDetectorEnabled;
+} CDConfigParameters;
+
+typedef struct _SLMConfigParams { // SLM - System Low Memory
+ SI_32 SLMTimerValue;
+ SI_32 SLMMaxRetryCount;
+ SI_32 SLMThresholdValue;
+ SI_32 SLMSystemmanagerLogIntervalMs;
+} SLMConfigParameters;
+
+typedef struct _UserMModeConfigParams {
+ BOOL IsUserModeNotificationABOOL;
+} UserModeConfigParameters;
+
+typedef struct _ModuleConnectTimeConfigParams {
+ SI_32 ModuleConnectionNumTimesToCheck;
+ SI_32 ModuleConnectionTimeOutSec;
+ SI_32 ModuleStartRespTimeOutSec;
+} ModuleConfigParams;
+
+typedef struct _CriticalAppsMaxShutdownTime {
+ SI_32 CriticalAppsMaxShutdownTimeFastSleep;
+ SI_32 CriticalAppsMaxShutdownTimeNormalReset;
+} CriticalAppsMaxShutdownTime;
+
+typedef struct _ConfigurationData {
+ // Parameters specific to System Manager
+
+ // Parameters specific to Heart Beat Thread
+ HBConfigParameters HBConfig;
+
+ // Parameters specific to Launcher Thread
+
+ // Parameters specific to Crash Detector Thread
+ CDConfigParameters CDConfig;
+
+ // Parameters specific to System Low Memory
+
+ // Parameters specific to Sys Low Memory Thread
+ SLMConfigParameters SLMConfig;
+
+ // Parameters specific to User Mode Notification Data Structure
+ UserModeConfigParameters UMConfig;
+
+ // Parameters specific to Module connection timeout with SM
+ ModuleConfigParams MCConfig;
+
+ // Parameters specific to Critical Apps Max shutdown time
+ CriticalAppsMaxShutdownTime CAMSTConfig;
+} ConfigurationData;
+
+typedef std::vector<UI_32> LaunchOrderedVector;
+typedef LaunchOrderedVector::iterator LaunchOrderedIter;
+
+class SMConfigParams {
+ public:
+ SMConfigParams();
+ virtual ~SMConfigParams();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// LoadSMConfigParameters
+ /// \brief Read System Manager configuration parameters from cfg file or
+ /// use defaults values in case cfg file is not available
+ ///
+ /// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
+ /// \param [in] f_FileName - Configuration file name.
+ ///
+ /// \return BOOL
+ /// BOOL - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL LoadSMConfigParameters(ConfigurationData& f_ConfigParams, // NOLINT
+ SS_String f_FileName);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSMConfigInformation
+ /// \brief Read config data from cfg file and populate the configuration data structure
+ ///
+ /// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
+ /// \param [in] f_FileName - Configuration file name.
+ ///
+ /// \return BOOL
+ /// BOOL - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL GetSMConfigInformation(ConfigurationData& f_ConfigParams, // NOLINT
+ SS_String f_FileName);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintConfigInfo
+ /// \brief Print the configuration data stored in config structure
+ ///
+ /// \param [in] configata
+ /// ConfigurationData & - Ref to structure that get populated.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintConfigInfo(ConfigurationData const& f_ConfigParams);
+};
+
+class SysMgrConfiguration {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SysMgrConfiguration
+ /// \brief
+ ///
+ /// \return NA
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ SysMgrConfiguration();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~SysMgrConfiguration
+ /// \brief
+ ///
+ /// \return NA
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~SysMgrConfiguration();
+
+// ////////////////////////////////////////////////////////////////////////////////////////////
+// /// LoadParameters
+// /// \brief
+// ///
+// /// \param [in] groups
+// /// GroupLaunchList & - Ref to GroupLaunchList that get populated.
+// ///
+// /// \return BOOL
+// /// BOOL - TRUE or FALSE
+// ////////////////////////////////////////////////////////////////////////////////////////////
+// BOOL LoadParameters(GroupLaunchMap & groups_map);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// LoadParametersCfg
+ /// \brief
+ ///
+ /// \param [in] groups
+ /// GroupLaunchList & - Ref to GroupLaunchList that gets populated.
+ /// ProcessNameMap & - Ref to ProcessNameMap that gets populated.
+ /// LaunchOrderedVector & - Ref to LaunchOrderedVector that gets populated.
+ ///
+ /// \param [in] f_launchOrderName - launch order name.
+ ///
+ /// \return BOOL
+ /// BOOL - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL LoadParametersCfg(GroupLaunchMap& groups_map, // NOLINT
+ ProcessNameMap& f_processNameMap, // NOLINT
+ LaunchOrderedVector& f_OrderList, // NOLINT
+ SS_String& f_launchOrderName, // NOLINT
+ SS_String& f_launchCfgFn); // NOLINT
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintGroupInfo
+ /// \brief Print method for GroupLaunchInfo only prints the group info not the module info
+ ///
+ /// \param [in] refGrpInfo
+ /// GroupLaunchInfo & - Ref to a GroupLaunchInfo object that will be printed.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintGroupInfo(GroupLaunchInfo& refGrpInfo); // NOLINT
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintModuleInfo
+ /// \brief Print method for a Module's Params.
+ ///
+ /// \param [in] refMbrInfo
+ /// ModuleLaunchParams & - Ref to ModuleLaunchParams object that will be printed.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintModuleInfo(ModuleLaunchParams& refMbrInfo); // NOLINT
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintAllInfo
+ /// \brief Print all the information in the GroupLaunchList.
+ ///
+ /// \param [in] refGrpList
+ /// GroupLaunchList & - Ref to GroupLaunchList object that will be printed.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintAllInfo(GroupLaunchMap& refGrpMap); // NOLINT
+
+ protected:
+ // define all the configuration parameters that will be used to get data
+
+ CNSConfigReader * l_pReaderCfg;
+
+ SysMgrConfiguration(const SysMgrConfiguration&) : l_pReaderCfg(NULL) {}
+ SysMgrConfiguration & operator = (const SysMgrConfiguration &);
+
+ private:
+ BOOL ParseBoolParameter(PCSTR f_value, BOOL f_default = FALSE) const;
+};
+
+#endif // SS_SM_CONFIG_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_sm_default_paths.h b/video_in_hal/systemservice/system_manager/server/include/ss_sm_default_paths.h
new file mode 100755
index 0000000..8ffafd9
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_sm_default_paths.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for default path names.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef SYSTEM_MANAGER_SERVER_INCLUDE_SS_SM_DEFAULT_PATHS_H_
+#define SYSTEM_MANAGER_SERVER_INCLUDE_SS_SM_DEFAULT_PATHS_H_
+/*
+ * Environment variables
+ */
+const CHAR BaseDirPathEnvVariable[] = "BASE_DIR";
+const CHAR LaunchConfigFileNameEnvVariable[] = "APPS_CONFIG_FILENAME";
+const CHAR SMConfigDataFileNameEnvVariable[] = "SM_CONFIG_DATA_FILENAME";
+const CHAR UsingVMPlayerVariable[] = "USING_VM_PLAYER";
+
+/*
+ * Default paths to be used in case Environment variables are not set
+ */
+const CHAR DefaultBasePath[] = "";
+const CHAR DefaultBinaryPath[] = "/agl/bin/";
+const CHAR DefaultConfigFilesPath[] = "/usr/agl/conf/BS/ss/system_manager/rwdata/";
+const CHAR DefaultLaunchConfigFileName[] = "sm_launch.cfg";
+const CHAR DefaultSMConfigFileName[] = "gpf_ss_sm_config_data.cfg";
+
+#endif // SYSTEM_MANAGER_SERVER_INCLUDE_SS_SM_DEFAULT_PATHS_H_
+
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h b/video_in_hal/systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h
new file mode 100755
index 0000000..685b43b
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h
@@ -0,0 +1,72 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_DYNAMIC_LAUNCH_TABLE_H_ // NOLINT
+#define SS_SM_DYNAMIC_LAUNCH_TABLE_H_
+
+#include "ss_sm_dynamic_launcher.h"
+
+DynamicLaunchInfo g_arrDynamicLaunchTableCfg[] = {
+ // TUNER
+ { SS_SOURCE_FM,
+ (const PCHAR)"FM", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ { SS_SOURCE_AM,
+ (const PCHAR)"AM", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ { SS_SOURCE_FM_DAB,
+ (const PCHAR)"FM_DAB", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ { SS_SOURCE_SDARS,
+ (const PCHAR)"SDARS", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ // MEDIA
+ { SS_SOURCE_SD_CARD,
+ (const PCHAR)"SDCard", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_MSC,
+ (const PCHAR)"MCS", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_MTP, (const PCHAR)"MTP",
+ (const PCHAR)"Audio", (const PCHAR)"Multimedia", (const PCHAR)"HMI",
+ (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE__CWORD57_,
+ (const PCHAR)"_CWORD57_", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE__CWORD73__APP,
+ (const PCHAR)"_CWORD57__APP", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE__CWORD73__VIDEO_MODE,
+ (const PCHAR)"_CWORD57__VM", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_USB,
+ (const PCHAR)"USB", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_DATA_CD,
+ (const PCHAR)"DATA_CD", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_CD,
+ (const PCHAR)"AUDIO_CD", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+};
+
+#endif // SS_SM_DYNAMIC_LAUNCH_TABLE_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h b/video_in_hal/systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h
new file mode 100755
index 0000000..a6efb1f
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_DYNAMIC_LAUNCHER_H_ // NOLINT
+#define SS_SM_DYNAMIC_LAUNCHER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/interfaceunified_system_types.h>
+#include <vector>
+
+#include "ss_sm_config.h"
+
+using std::vector;
+
+
+typedef struct _tDynamicLaunchParams {
+ SS_SOURCE source;
+ const PCHAR source_name;
+ const PCHAR before_group_name;
+ const PCHAR start_group_name;
+ const PCHAR after_group_name;
+ const PCHAR aviage_trigger_name;
+ BOOL group_trigger;
+} DynamicLaunchInfo;
+
+
+class DynamicLaunchBase {
+ public:
+ DynamicLaunchBase();
+ virtual ~DynamicLaunchBase();
+ UI_32 get_id() const;
+ UI_32 advance_id();
+ UI_32 decrement_id();
+ BOOL is_begin();
+ BOOL is_end();
+ VOID to_begin();
+ VOID to_end();
+ VOID print_info();
+
+ protected:
+ typedef std::vector<UI_32> DynamicOrderedVector;
+ typedef DynamicOrderedVector::iterator DynamicOrderedIter;
+ DynamicOrderedVector m_vOrderedGroup;
+ DynamicOrderedIter m_iterOrderedGroup;
+};
+
+class DynamicModuleStart;
+
+class DynamicLauncher: public DynamicLaunchBase {
+ public:
+ DynamicLauncher();
+ virtual ~DynamicLauncher();
+ BOOL dynamic_launch_enabled() const;
+ VOID configure_dynamic_launch(const SS_SOURCE & source_type, // NOLINT
+ GroupLaunchMap & group_info, LaunchOrderedVector & order_info); // NOLINT
+ VOID copyDynOrderedVector(DynamicModuleStart &);
+
+ private:
+ // Disable class copy constructors
+ explicit DynamicLauncher(const DynamicLauncher& f_source)
+ : m_nLaunchGroupId(f_source.m_nLaunchGroupId)
+ , m_nLaunchBeforeGroupId(f_source.m_nLaunchBeforeGroupId)
+ , m_nLaunchAfterGroupId(f_source.m_nLaunchAfterGroupId)
+ , m_nAviageTriggerId(f_source.m_nAviageTriggerId)
+ , m_bDynamicLaunchEnabled(f_source.m_bDynamicLaunchEnabled)
+ , m_eSourceType(f_source.m_eSourceType) {}
+ DynamicLauncher & operator = (const DynamicLauncher &);
+
+ // helper methods..
+ DynamicLaunchInfo* get_dynamic_source_info(const SS_SOURCE& source_type, // NOLINT
+ BOOL& source_trigger, BOOL &is_aviage_required); // NOLINT
+ UI_32 get_id_using_group_name(PCSTR group_name, GroupLaunchMap& group_info); // NOLINT
+ VOID create_normal_launch_vector(GroupLaunchMap& group_info, LaunchOrderedVector& order_info); // NOLINT
+ BOOL is_inGroupLaunchMap(UI_32& id, GroupLaunchMap& group_info); // NOLINT
+
+ // Data Members
+ UI_32 m_nLaunchGroupId;
+ UI_32 m_nLaunchBeforeGroupId;
+ UI_32 m_nLaunchAfterGroupId;
+ UI_32 m_nAviageTriggerId;
+ BOOL m_bDynamicLaunchEnabled;
+ SS_SOURCE m_eSourceType;
+};
+
+class DynamicModuleStart: public DynamicLaunchBase {
+ public:
+ DynamicModuleStart();
+ virtual ~DynamicModuleStart();
+ VOID setGroupVector(DynamicOrderedVector&);
+};
+
+#endif // SS_SM_DYNAMIC_LAUNCHER_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_sm_launch_configuration.h b/video_in_hal/systemservice/system_manager/server/include/ss_sm_launch_configuration.h
new file mode 100755
index 0000000..7296714
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_sm_launch_configuration.h
@@ -0,0 +1,191 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_LAUNCH_CONFIGURATION_H_ // NOLINT
+#define SS_SM_LAUNCH_CONFIGURATION_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_client_names.h>
+
+typedef struct _DefaultModuleLaunchParams {
+ const PCHAR name;
+ const PCHAR binary_name;
+ const PCHAR arguments;
+ const PCHAR restart;
+ UI_32 priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ const PCHAR logging_msk_str;
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+} DefaultModuleLaunchParams;
+
+typedef struct _DefaultGroupLaunchInfo {
+ const PCHAR name;
+ UI_32 id;
+ DefaultModuleLaunchParams *modules;
+} DefaultGroupLaunchInfo;
+
+
+#define prefix
+
+prefix DefaultModuleLaunchParams CoreModulesGroup[] = {
+ // Queue name binary_name arguments
+ {(const PCHAR)SERVICE_NS_SHARED_MEM,
+ (const PCHAR)"NS_SharedMem", (const PCHAR)"", (const PCHAR)"me",
+ 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE_NS_NPP, (const PCHAR)"NS_NPPService",
+ (const PCHAR)"", (const PCHAR)"me", 20, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, TRUE, 15},
+ {(const PCHAR)SERVICE_LOGGER, (const PCHAR)SERVICE_LOGGER,
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE__CWORD69_, (const PCHAR)"_CWORD69_.exe",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams ShadowModulesGroup[] = {
+ // Queue name binary_name arguments
+ {(const PCHAR)SERVICE_PS_IPC, (const PCHAR)"PS_IPC",
+ (const PCHAR)"", (const PCHAR)"group", 50, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE_PSM_SHADOW, (const PCHAR)"PS_PSMShadow",
+ (const PCHAR)"", (const PCHAR)"group", 12, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_KEY_HANDLER, (const PCHAR)"PS_KeyHandler",
+ (const PCHAR)"", (const PCHAR)"group", 12, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_IPC_MP_SHADOW, (const PCHAR)"PS_IPC_MP_Shadow",
+ (const PCHAR)"", (const PCHAR)"group", 20, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams SystemModulesGroup[] = {
+ {(const PCHAR)SERVICE_POWER, (const PCHAR)SERVICE_POWER,
+ (const PCHAR)"", (const PCHAR)"me", 12, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SS_DEV_DETECT_SRV, (const PCHAR)SS_DEV_DETECT_SRV,
+ (const PCHAR)"", (const PCHAR)"me", 12, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SS_PLM_SERVICE, (const PCHAR)SS_PLM_SERVICE,
+ (const PCHAR)"", (const PCHAR)"me", 12, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams AudioModulesGroup[] = {
+ {(const PCHAR)SERVICE_AS_AUDIO, (const PCHAR)"AS_AudioService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_AS_MODE, (const PCHAR)"AS_ModeService",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams RadioModulesGroup[] = {
+ {(const PCHAR)SERVICE_TUNER, (const PCHAR)"Radio",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_DAB, (const PCHAR)"Master_Tuner",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_SDARS, (const PCHAR)"Ext_SDARS_Service",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3,
+ (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams MultimediaModulesGroup[] = {
+ {(const PCHAR)SERVICE_MM_ICD, (const PCHAR)"MM_ICDService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_MM_MEDIA, (const PCHAR)"MediaService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams HMIModulesGroup[] = {
+ {(const PCHAR)SERVICE_HMI, (const PCHAR)"GtfStartup",
+ (const PCHAR)"/eb/gtf_5.2.1/models/PastModel004/gtfStartup.cfg", (const PCHAR)"me",
+ 13, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE_HMI__CWORD77_, (const PCHAR)"HMI__CWORD77_",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_HMI__CWORD46_, (const PCHAR)"HMI__CWORD46_Service", (const PCHAR)"",
+ (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams NavigationModulesGroup[] = {
+ {(const PCHAR)SERVICE_NAV_LOC, (const PCHAR)"NAV_LocationService", (const PCHAR)"", (const PCHAR)"me",
+ 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NAV, (const PCHAR)"NAV_NavigationService", (const PCHAR)"", (const PCHAR)"me",
+ 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0, (const PCHAR)0, (const PCHAR)0,
+ 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams SoftwareUpdateModulesGroup[] = {
+ {(const PCHAR)SERVICE_SOFTWAREUPDATE, (const PCHAR)"SS_SoftwareUpdateService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_PS_SWDL_SHADOW, (const PCHAR)"PS_SoftwareUpdateShadow",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams NetworkingModulesGroup[] = {
+ {(const PCHAR)SERVICE__CWORD51__BT, (const PCHAR)"_CWORD51__BT.exe",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_BT, (const PCHAR)"NW_BluetoothService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_CONNECTION, (const PCHAR)"NW_ConnectionService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_PHONE, (const PCHAR)"NW_PhoneService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_PHONE_BOOK, (const PCHAR)"NW_PhoneBookService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_MESSAGING, (const PCHAR)"NW_MessagingService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams BrowserModulesGroup[] = {
+ {(const PCHAR)SERVICE_BR_BROWSER, (const PCHAR)"BR_BrowserService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultGroupLaunchInfo g_arrLaunchTable[] = {
+ {(const PCHAR)"CoreModules", 1, CoreModulesGroup },
+ {(const PCHAR)"ShadowModules", 2, ShadowModulesGroup },
+ {(const PCHAR)"SystemModules", 3, SystemModulesGroup },
+ {(const PCHAR)"Audio", 4, AudioModulesGroup },
+ {(const PCHAR)"Radio", 5, RadioModulesGroup },
+ {(const PCHAR)"Multimedia", 6, MultimediaModulesGroup },
+ {(const PCHAR)"HMI", 7, HMIModulesGroup },
+ {(const PCHAR)"Navigation", 8, NavigationModulesGroup },
+ {(const PCHAR)"SoftwareUpdate", 9, SoftwareUpdateModulesGroup },
+ {(const PCHAR)"Networking", 10, NetworkingModulesGroup },
+ {(const PCHAR)"Browser", 11, BrowserModulesGroup },
+};
+
+#endif // SS_SM_LAUNCH_CONFIGURATION_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_sm_signals.h b/video_in_hal/systemservice/system_manager/server/include/ss_sm_signals.h
new file mode 100755
index 0000000..4c52b32
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_sm_signals.h
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file supports process termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_SIGNALS_H_ // NOLINT
+#define SS_SM_SIGNALS_H_
+
+#include <signal.h>
+
+#define SS_SM_ABORT_SIGNAL (SIGABRT)
+#define SS_SM_KILL_SIGNAL (SIGKILL)
+#define SS_SM_TERMINATE_SIGNAL (SIGTERM)
+
+#endif // SS_SM_SIGNALS_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h b/video_in_hal/systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h
new file mode 100755
index 0000000..0499751
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file supports agl application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SM_SYSTEMMANAGERLOG_H__ // NOLINT
+#define __SS_SM_SYSTEMMANAGERLOG_H__
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_FUNC_IPC ZONEMASK(13)
+#define ZONE_APP_LAUNCH ZONEMASK(14)
+#define ZONE_ACTIVE_INDEX ZONEMASK(15)
+#define ZONE_CONFIG_TABLE ZONEMASK(16)
+#define ZONE_FUNC_ARGS ZONEMASK(17)
+#define ZONE_LOG_FILE ZONEMASK(18)
+#define ZONE_MSG ZONEMASK(19)
+#define ZONE_TIMER ZONEMASK(20)
+#define ZONE_LAUNCH_TIME ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_UNUSED ZONEMASK(23)
+#define ZONE_PERIODIC_FUNC ZONEMASK(24)
+#define ZONE_PERIODIC_INFO ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_DYNAMIC_LNCH ZONEMASK(27)
+#define ZONE_STATE ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_SYSLOG ZONE_SYSTEMDATA
+#define ZONE_PERFORM ZONE_PERFORMANCE
+#define ZONE_PROC_LAUNCH_INFO ZONE_FUNC
+
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "Ipc Function"
+#define ZONE_TEXT_14 "Active Index"
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 "Config Table"
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 "Ipc Info"
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_STATE, ZONE_SYSLOG, ZONE_PERFORM, ZONE_NS_WAR, ZONE_NS_ERR
+#endif // FRAMEWORKUNIFIEDLOGAPPZONES
+
+#endif // __SS_SM_SYSTEMMANAGERLOG_H__ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_sm_version.h b/video_in_hal/systemservice/system_manager/server/include/ss_sm_version.h
new file mode 100755
index 0000000..ea0a775
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_sm_version.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for module version management.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_VERSION_H_ // NOLINT
+#define SS_SM_VERSION_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include "ss_sm_process_launcher_protocol.h"
+
+class CSMVersion {
+ public:
+ CSMVersion();
+ ~CSMVersion();
+ EFrameworkunifiedStatus get_version(SS_VersionNumberType& f_VersionNumber); // NOLINT
+ EFrameworkunifiedStatus get_build_info(std::string& f_buildInfoStr); // NOLINT
+
+ private:
+};
+#endif // SS_SM_VERSION_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_system_manager.h b/video_in_hal/systemservice/system_manager/server/include/ss_system_manager.h
new file mode 100755
index 0000000..12d5bad
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_system_manager.h
@@ -0,0 +1,760 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager business logic.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SYSTEM_MANAGER_H__ // NOLINT
+#define __SS_SYSTEM_MANAGER_H__
+
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_error_event_common_local.h>
+#include <system_service/ss_system_timer.h>
+#include <crashdetector/ss_crashdetector.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <heartbeat/ss_hb_if.h>
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_system_manager_conf.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+#include <system_service/ss_logger_store_logs.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <power_hal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <inttypes.h>
+#include <map>
+#include <string>
+#include <vector>
+#include <queue>
+#include <sstream>
+#include <set>
+#include <list>
+#include <utility>
+
+#include "ss_sm_config.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_system_thread_info.h"
+#include "ss_system_memory_monitor.h"
+#include "ss_sm_dynamic_launcher.h"
+
+static_assert((SS_SM_PROG_UPDATE_STATE_NONE == PWR_PROGUPDATE_STATE_NONE),
+ "SS_SM_PROG_UPDATE_STATE_NONE should be equal to "
+ "PWR_PROGUPDATE_STATE_NONE");
+static_assert((SS_SM_PROG_UPDATE_STATE_UPDATED == PWR_PROGUPDATE_STATE_UPDATED),
+ "SS_SM_PROG_UPDATE_STATE_UPDATED should be equal to "
+ "PWR_PROGUPDATE_STATE_UPDATED");
+static_assert((SS_SM_PROG_UPDATE_STATE_MAP_UPDATED ==
+ PWR_PROGUPDATE_STATE_MAP_UPDATED),
+ "SS_SM_PROG_UPDATE_STATE_MAP_UPDATED should be equal to "
+ "PWR_PROGUPDATE_STATE_MAP_UPDATED");
+static_assert((SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED ==
+ PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED),
+ "SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED should be equal to "
+ "PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED");
+
+#define SM_SHUTDOWN_COMPLETE_MONITOR_TIMEOUT 60
+
+typedef enum {
+ eSM_TIMER_GROUP_MONITOR = 0x00
+ , eSM_TIMER_PROCESS_LAUNCH_MONITOR
+ , eSM_TIMER_HEARTBEAT_MONITOR
+ , eSM_TIMER_PROCESSLAUNCHER_MONITOR
+ , eSM_TIMER_CLIENT_START_MONITOR
+ , eSM_TIMER_NPP_STATUS_CHECK_MONITOR
+ , eSM_TIMER__CWORD56__HEARTBEAT_RESPONSE
+ , eSM_TIMER_LAUNCH_GROUP_TRIGGER_PROC_RESP_TIMER
+ , eSM_TIMER_GROUP_LAUNCH_WAIT_TIMER
+ , eSM_TIMER_MODULE_CONNECT_WAIT_TIMER
+ , eSM_TIMER_START_RESP_MONITOR_WAIT_TIMER
+ , eSM_TIMER_SHUTDOWN_COMPLETE_MONITOR
+ , eSM_TIMER_CLIENT_STOP_MONITOR
+ , eSM_TIMERS_END
+} ESMTimerIDs;
+
+typedef enum {
+ eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ
+ , eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN
+ , eSM_ERROR_EVENT_TIMER_BOOT_MICRO_LOG_RSPN
+ , eSM_ERROR_EVENT_TIMER_CORE_FILE_POLL
+ , eSM_ERROR_EVENT_TIMER_END
+} ESMErrorEventTimers;
+
+typedef enum {
+ eErrorEventResetTypeNone = 0,
+ eErrorEventResetTypeHard
+} EErrorEventResetType;
+
+typedef enum _ESMInternalProtocol {
+ SS_SM_SendTriggerToSelf = SS_SM_PROTOCOL_INTERFACE_END ///< System Manager to System Manager
+} ESMInternalProtocol;
+
+typedef enum _SS_SMGroupHirarchy {
+ SS_SM_INVALID_GROUP = 0
+ , SS_SM_INITIAL_GROUP
+ , SS_SM_SECOND_GROUP
+ , SS_SM_THIRD_GROUP
+} SS_SMGroupHirarchy;
+
+typedef enum _SS_SMModuleState {
+ SS_SM_READY_TO_LAUNCH_APP = 0x00
+ , SS_SM_APPS_LAUNCH_IN_PROGRESS
+ , SS_SM_APPS_LAUNCHED_READY_TO_START
+ , SS_SM_APPS_START_IN_PROGRESS
+ , SS_SM_APPS_START_COMPLETE
+ , SS_SM_APPS_STOPPING_AT__CWORD56__REQ
+ , SS_SM_APPS_STOPPING_AT_INTERNAL_REQ
+ , SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ
+ , SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ
+ , SS_SM_APPS_PRE_START_IN_PROGRESS
+ , SS_SM_APPS_PRE_STOP_IN_PROGRESS
+ , SS_SM_APPS_PRE_RUN_COMPLETE
+ , SS_SM_APPS_BACKGROUND_START_IN_PROGRESS
+ , SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS
+ , SS_SM_APPS_BACKGROUND_RUN_COMPLETE
+} SS_SMModuleState;
+
+typedef struct _SMProcessExitInfo {
+ _SMProcessExitInfo() {
+ this->pid = 0;
+ this->exitValue = 0;
+ this->signalNumber = 0;
+ this->binaryFileName[0] = '\0';
+ }
+
+ UI_32 pid;
+ SI_32 exitValue;
+ SI_32 signalNumber;
+ CHAR binaryFileName[MAX_PATH_LENGTH];
+} SMProcessExitInfo;
+
+typedef struct _SMLoggingInfo { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ _SMLoggingInfo() {
+ this->pid = 0;
+ this->exitValue = 0;
+ this->signalNumber = 0;
+ this->binaryFileName[0] = '\0';
+ this->messageStr = "";
+ this->suffixStr = "";
+ this->path = "";
+ this->resetReason = e_SS_SM_CPU_RESET_REASON_INVALID;
+ }
+
+ UI_32 pid;
+ SI_32 exitValue;
+ SI_32 signalNumber;
+ CHAR binaryFileName[MAX_PATH_LENGTH];
+ std::string messageStr;
+ std::string suffixStr;
+ std::string path;
+ ESMCpuResetReason resetReason;
+} SMLoggingInfo;
+
+struct ERROR_EVENT_INFO { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ERROR_EVENT_INFO() :
+ m_eventEnqueueTimeStamp(""),
+ m_moduleQueueName(""),
+ m_eventType(eErrorEventTypeMaxValue),
+ m_prio(eErrorEventPrioDefault),
+ m_uniqueCycles(ClockCycle()), // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_errorEventResetType(eErrorEventResetTypeNone) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ std::string m_eventEnqueueTimeStamp;
+ std::string m_moduleQueueName;
+ EErrorEventType m_eventType;
+ SMLoggingInfo m_loggingInfo;
+ EErrorEventPrio m_prio;
+ UI_64 m_uniqueCycles;
+ EErrorEventResetType m_errorEventResetType;
+};
+
+struct ERROR_EVENT_COMPARE {
+ bool operator() (const ERROR_EVENT_INFO& lhs,
+ const ERROR_EVENT_INFO& rhs) const {
+ if ((eErrorEventPrioDefault == lhs.m_prio) &&
+ (eErrorEventPrioDefault == rhs.m_prio)) {
+ return (lhs.m_uniqueCycles < rhs.m_uniqueCycles);
+ } else {
+ return (lhs.m_prio > rhs.m_prio);
+ }
+ }
+};
+
+typedef std::set<ERROR_EVENT_INFO, ERROR_EVENT_COMPARE> ERROR_EVENT_QUEUE;
+typedef ERROR_EVENT_QUEUE::iterator ERROR_EVENT_QUEUE_ITER;
+typedef std::pair<ERROR_EVENT_QUEUE_ITER, BOOL> ERROR_EVENT_QUEUE_RET;
+
+typedef EFrameworkunifiedStatus (*HndlrCb)(HANDLE hApp);
+typedef EFrameworkunifiedStatus (*FncCbType2)(HANDLE hApp, UI_32 f_UI_32);
+typedef BOOL (*FncCbType3)(UI_32 f_UI_32);
+
+typedef std::pair<SS_SystemManagerProtocol, Pwr_ServiceSetInterface> SM_POWER_EVENT_INFO;
+typedef std::queue<SM_POWER_EVENT_INFO> SM_POWER_EVENT_QUEUE;
+
+typedef struct {
+ std::string m_cmd;
+ UI_64 m_time;
+ std::string m_sender;
+} Ts_cmdHist;
+
+typedef std::list<std::string> ErrorGroupList;
+typedef ErrorGroupList::iterator ErrorGroupListIter;
+
+typedef std::vector<Ts_cmdHist> cmdHist;
+typedef cmdHist::iterator cmdHistIter;
+
+typedef std::vector<std::string> HBList;
+typedef HBList::iterator HBListIter;
+
+class CVersionNumInfo {
+ public:
+ CVersionNumInfo() : m_VersionNumber(0), m_eSystemmanagerStatus(eFrameworkunifiedStatusErrOther) {}
+ CVersionNumInfo(SS_VersionNumberType f_vn, EFrameworkunifiedStatus f_eStatus)
+ : m_VersionNumber(f_vn), m_eSystemmanagerStatus(f_eStatus) {}
+
+ // System Manager's local data store; write once on initialization,
+ // read as needed at clients' request
+ SS_VersionNumberType m_VersionNumber;
+ EFrameworkunifiedStatus m_eSystemmanagerStatus; // Validity / status of version number
+};
+
+#define SS_SM_RELAUNCH_NO_LIMIT -1
+typedef struct _PreLaunchModuleParams {
+ _PreLaunchModuleParams() {
+ this->LaunchFunc = NULL;
+ this->name = "";
+ this->binaryFileName = "";
+ this->critical = FALSE;
+ this->relaunchLimit = 0;
+ this->pid = -1;
+ this->relaunchCount = 0;
+ }
+
+ int (*LaunchFunc)(); // Launching function
+ std::string name; // Process name
+ std::string binaryFileName; // Binary file name
+ BOOL critical; // Reboot attribute
+ int relaunchLimit; // Maximum number of Relaunch
+ int pid; // pid
+ int relaunchCount; // Count of Relaunching
+} PreLaunchModuleParams;
+
+typedef std::list<PreLaunchModuleParams> PreLaunchModuleList;
+typedef PreLaunchModuleList::iterator PreLaunchModuleListIter;
+
+typedef struct _GroupRelaunchModuleParams {
+ _GroupRelaunchModuleParams() {
+ this->name = "";
+ this->bIsKilled = FALSE;
+ }
+
+ std::string name; // Process name
+ BOOL bIsKilled; // Flag indicates while forced quit process
+} GroupRelaunchModuleParams;
+
+typedef std::list<GroupRelaunchModuleParams> GroupRelaunchModuleList;
+typedef GroupRelaunchModuleList::iterator GroupRelaunchModuleListIter;
+
+
+class CSystemManager {
+ public:
+ static std::string m_bootOpt; // BOOT OPTION
+
+ CSystemManager();
+ virtual ~CSystemManager();
+
+ static CSystemManager & GetInstance();
+ EFrameworkunifiedStatus Initialize(HANDLE hApp);
+ void Initialize_memory(HANDLE hApp, bool* l_isInitFail, EFrameworkunifiedStatus* l_eStatus, BOOL isIllReset);
+ void Initialize_callbacks(HANDLE hApp, bool *l_isInitFail, EFrameworkunifiedStatus *l_eStatus);
+ /// < Process Launcher Thread Callbacks
+ EFrameworkunifiedStatus OnModuleLaunchResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnTerminateModuleResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnReLaunchModuleResponse(HANDLE hApp);
+ EFrameworkunifiedStatus PerformModuleLaunchRespProcessing(HANDLE hApp,
+ GroupLaunchMapIter & f_GroupIter, // NOLINT
+ ModuleLaunchListIter & f_ModuleIter, // NOLINT
+ PCSTR p_sPPD_tag);
+ EFrameworkunifiedStatus OnModuleStatusResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnGroupLaunchTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnLaunchGroup(HANDLE hApp);
+ EFrameworkunifiedStatus OnLaunchGroupSelfTrigger(HANDLE hApp);
+ EFrameworkunifiedStatus OnProcessLaunchTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnHeartBeatMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnProcessLaunchMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnHeartBeatThreadHeartbeatResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnCheckAvailResponse(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnProcessLauncherThreadHeartbeatResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnClientStartMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnClientStopMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnNPPStatusCheckMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnPowerServiceAvailableNotify(HANDLE hApp);
+ EFrameworkunifiedStatus OnLVI1Notify(HANDLE hApp);
+ EFrameworkunifiedStatus OnLVI2Notify(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnModuleStartCompleteResponse(HANDLE hApp); /// Process start complete from client
+ EFrameworkunifiedStatus OnModuleStopCompleteResponse(HANDLE hApp); /// Process stop Complete from client
+ EFrameworkunifiedStatus OnGetStartExtInfo(HANDLE hApp);
+ EFrameworkunifiedStatus OnGetStopExtInfo(HANDLE hApp);
+ EFrameworkunifiedStatus OnModuleStopCompleteNotification(HANDLE hApp);
+ EFrameworkunifiedStatus ProcessModuleStopCompleteResponse(HANDLE hApp,
+ PCSTR f_moduleName);
+ EFrameworkunifiedStatus ModuleCompleteResponse(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleListIter,
+ SMModuleState f_moduleState,
+ FncCbType3 f_isGroupDoneFnc,
+ FncCbType2 f_groupDoneFnc,
+ PCSTR f_sCompleteTypeText);
+
+ EFrameworkunifiedStatus ProcessGroupOnModuleStopResponse(HANDLE hApp, UI_32 f_groupID);
+
+
+
+ EFrameworkunifiedStatus OnLaunchGroupTriggerProcessResponseTimerExpiry(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnNppStopComplete(HANDLE hApp); /// Process stop Complete from NPPService
+ EFrameworkunifiedStatus OnOpenSession(HANDLE hApp); /// Process open session request
+ EFrameworkunifiedStatus OnCloseSession(HANDLE hApp); /// Process close session acknowledgment
+
+ EFrameworkunifiedStatus CloseApplication(HANDLE hApp);
+ EFrameworkunifiedStatus OnGetAppInfo(HANDLE hApp);
+
+ /// < Heartbeat Thread Callbacks
+ EFrameworkunifiedStatus OnHeartBeatErrorReport(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnCurrentSMStateQuery(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnNPPReadyStatusCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnNPPReadyEventCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnWakeupCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnPowerRequestCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnBackupMgrAvailCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnShutdownModulesRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnSystemModeInfoRequest(HANDLE hApp);
+ EFrameworkunifiedStatus ClearDramBackupInfo(HANDLE hApp);
+ EFrameworkunifiedStatus OnInitCompReportCallback(HANDLE hApp);
+ EFrameworkunifiedStatus SetEnvVariableForVupMode(BOOL bIsVupMode);
+ static int CreateRtUsb();
+ EFrameworkunifiedStatus SecureChipOff();
+ EFrameworkunifiedStatus CallStopCompleteHandler(HANDLE hApp, BOOL bISDetectTimeout = FALSE);
+
+ EFrameworkunifiedStatus On_CWORD56_HeartBeatRequest(HANDLE hApp);
+ EFrameworkunifiedStatus On_CWORD56_HeartBeatResponseIntervalTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnGroupLaunchWaitTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus OnModuleConnectWaitTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus OnStartRespMonitorTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus OnShutdownCompleteMonitorTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus PerformCpuReset(HANDLE hApp, ESMCpuResetReason f_eSmCpuResetReason, std::string f_messageStr = ""); // NOLINT
+ EFrameworkunifiedStatus OnCpuResetRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnSetDataResetModeRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnSetProgUpdateStateRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnLaunchGroupTriggerProcessResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnSetNextWakeupTypeRequest(HANDLE hApp);
+
+ bool GetDramPowerStatusInfo(const HANDLE h_app);
+ bool GetDramStoreStatusInfo(const HANDLE h_app);
+ bool GetSyscomPowerStatusInfo(const HANDLE h_app);
+ //
+ // Start Confirmation, Get _CWORD56_ Version callback functions
+ EFrameworkunifiedStatus OnSetStartupConfirmationDataRequest(HANDLE hApp);
+
+ void SystemManagerDebugDump(HANDLE hApp);
+
+
+ private:
+ CThreadInfo m_hHeartbeatThread; // Handle to Heartbeat Thread
+ CThreadInfo m_hProcLauncherThread; // Handle to Process Launcher Thread
+ UI_32 m_SystemLaunchProgress; // Launch Progress of system
+ TimerCtrl * m_GroupLaunchTimer; // Launch Monitor Timer
+ UI_32 m_aTimerIDs[eSM_TIMERS_END]; // TimerIDs returned by create timer
+ PreLaunchModuleList m_PreLaunchModuleList; // List of modules that shuuld be launched preliminarily.
+ GroupRelaunchModuleList m_GroupRelaunchModuleList; // List of modules that need to relaunch
+ UI_32 m_GroupRelaunchCount; // Count for group relaunch
+ UI_32 m_GroupRelaunchLimit; // Limit for group relaunch
+ GroupLaunchMap m_MapProclaunchGrps; // Map of modules that should be launched.
+ ProcessNameMap m_MapProcNames; // Map of module binary names to queue names.
+ HANDLE m_hPowerServiceSession;
+ UI_32 m_ActiveGroupId; // Modules of Group to whom START/STOP has been sent
+ wakeInfo m_Wake; // WakeUp data from power
+ EPWR_WAKEUP_FACTOR_TYPE m_StartUpReason; // System Manager preserve start up reason
+ ESMDataResetModeInfo m_DataResetMode; // Data Reset Mode
+ SMProgUpdateState m_ProgUpdateState; // ProgUpdate State
+ ESMNextWakeupType m_NextWakeupType; // Next Progupdate State
+ ESMDramBackupStatus m_DramBackupStatus; // Dram Backup Status
+ BOOL m_isIlgReset; // Error Detected by SYS-ucon
+ ESMResetStatus m_ResetStatus; // Reset Status
+ UI_32 m_ResetCount; // Reset Count
+ T_SS_SM_INIT_HOOK_OUT_PARAM m_productCustomPrm; // Product customized parameters
+
+ SS_SMModuleState m_SMCurrentState; // Current state of System Manager
+ UI_32 m_MaxShutdownTime; // Calculate Max shutdown time based on info from xml
+ UI_32 m_NbrDebugDumpRspnRecv; // Total number of debug dump responses received.
+ BOOL m_isRcvModeInfo;
+ SystemModeInfo m_SystemModeInfo; // System Mode Info, SM to read data from persistent file at start
+ SS_String m_BinaryFilesPath; // Store binary files path
+ SS_String m_ConfigFilesPath; // Store config files path
+ ConfigurationData m_SMConfig; // Configuration Data of System Manager and its threads
+ HndlrCb m_pfStopCompleteHandler;
+ CVersionNumInfo m_VersionNumberStruct;
+ SS_String m_BuildInfoStr;
+
+ BOOL m_isRstPending;
+ TSystemManagerCpuResetInfo m_rstPendingInfo;
+
+ SM_POWER_EVENT_QUEUE m_dqDeferMsg;
+ BOOL m_UsingVMPlayer; // Running on a VMPlayer ?
+ UI_32 NVM_VALID_SIGNATURE;
+ StartupConfirmationMsgStrut m_startUpConfirmationMsg;
+ EPWR_USER_MODE_TYPE m_lastUserMode;
+ EPWR_SHUTDOWN_TRIGGER_TYPE m_shutdownTrigger; // Set from Shutdown_Request
+ // msg from _CWORD56_, sent to
+ // all modules as part of
+ // SS_SM_STOP msg.
+ BOOL m_isImmediateReset;
+ BOOL m_isImmResetReq;
+ BOOL m_needReNotifyStartPrm;
+ CHAR *m_pVarCodeStr;
+ GroupLaunchMapIter m_SSLGroupLaunchMapIterator;
+ ModuleLaunchListIter m_ModuleLaunchListIter;
+ BOOL m_bIsNPP_ServicesStarted;
+ BOOL m_bIsBackupAvail;
+ //
+ DynamicLauncher m_oSystemLauncher;
+ DynamicModuleStart m_SystemStarter;
+ //
+ BOOL m_NPPStopSent;
+ ePwrServiceUserModeChangeReasonType m_userModeChangeReason;
+
+ HBList m_HBList;
+
+ cmdHist m__CWORD56_CmdHist;
+ cmdHistIter m__CWORD56_HistIter;
+ cmdHist m_SMCmdHist;
+ cmdHistIter m_SMHistIter;
+ cmdHist m_TimerCmdHist;
+ cmdHistIter m_TimerHistIter;
+ cmdHist m_PubCmdHist;
+ cmdHistIter m_PubHistIter;
+ cmdHist m_ErrHist;
+ cmdHistIter m_ErrHistIter;
+
+ pthread_mutex_t sm_hist_mutex;
+
+ bool m_InitialBoot;
+
+ PsmFactorT m_ResetFactor; // reset(start-up) factor.
+
+ void SetCmdHist(std::string cmd, cmdHist &hist, cmdHistIter &it, std::string sender); // NOLINT
+
+ // ILGRST or ACCOFFON Logging
+ bool StoreDebugLogs(const HANDLE h_app, SS_STORELOGS_OPE_TYPE);
+
+ UI_32 InProgressStateToSendMsg() const;
+ SMModuleState InProgressStateToState() const;
+
+ //************************************************************************
+ // Error Event Logging *
+ //
+ int m_ClProcessSigFd;
+ CSysMemoryMonitor m_SysMemMonitor;
+
+ UI_32 m_FreeMemAvailable;
+ off_t m_coreFileSizeBytes;
+ THbReportData m_HBReport;
+ eSMBootMicroResetReason m_BootMicroResetReason;
+ BOOL m_errorEventQueueLocked;
+ ERROR_EVENT_QUEUE m_errorEventQueue;
+ Timer m_errorEventTimers[eSM_ERROR_EVENT_TIMER_END];
+ BOOL m_isPrevErrEventCompleted;
+ EFrameworkunifiedStatus m_errorEventResult;
+ EArtifactId m_requestedArtifactId;
+ ERROR_EVENT_QUEUE_ITER m_errorEventCurrentIter;
+ // *
+ // End of Error Event Logging *
+ //************************************************************************
+
+
+ ////******************************************************************////
+ //// enum<=>enum maps ////
+ //
+ //
+ // EPWR_POWER_STATE_TYPE <=> BOOL
+ std::map<EPWR_POWER_STATE_TYPE, BOOL> m_PowerType_to_SSBoolEnumMap;
+ std::map<EPWR_POWER_STATE_TYPE, EPWR_USER_MODE_TYPE>
+ m_PowerType_to_SSUserModeEnumMap;
+ std::map<BOOL, EPWR_POWER_STATE_TYPE> m_SSBool_to_PowerTypeEnumMap;
+ //
+ // User Mode
+ std::map<EPWR_USER_MODE_TYPE, BOOL> m_SSUserMode_to_SSBoolEnumMap;
+ std::map<BOOL, EPWR_USER_MODE_TYPE> m_SSBool_to_SSUserModeEnumMap;
+
+ //
+ //// End of enum<=>enum maps ////
+ ////******************************************************************////
+
+ EFrameworkunifiedStatus init_process_launcher(HANDLE hApp);
+ EFrameworkunifiedStatus start_process_launching(HANDLE hApp);
+ EFrameworkunifiedStatus init_Heartbeat(HANDLE hApp);
+ EFrameworkunifiedStatus init_crash_detector(HANDLE hApp);
+ EFrameworkunifiedStatus init_sysmem_monitor(HANDLE hApp);
+ EFrameworkunifiedStatus SendRequestToHeartBeat(HANDLE hAPP, EHBProtocolMessages, VOID *, UI_32);
+ EFrameworkunifiedStatus send_launch_status(HANDLE hApp, UI_32 u32LaunchState);
+
+ EFrameworkunifiedStatus register_all_notification_callbacks(HANDLE hApp);
+ VOID SMStateStartCompleteEntry(HANDLE hApp);
+ VOID SMStateEntry(HANDLE hApp, SS_SMModuleState l_SMState);
+ VOID SMStateExit(HANDLE hApp, SS_SMModuleState l_SMState);
+ VOID SMSetState(HANDLE hApp, SS_SMModuleState l_SMState);
+
+ // Wakeup from Power
+ EFrameworkunifiedStatus BeginStartup(HANDLE hApp);
+ EFrameworkunifiedStatus start_all_modules_of_group(HANDLE hApp, UI_32 f_ui32GroupNumber);
+ EFrameworkunifiedStatus send_power_request_complete_response(HANDLE hApp,
+ std::string pStr);
+ BOOL have_all_services_start_completed(const SMModuleState f_moduleState);
+
+ // Power Off from Power
+ EFrameworkunifiedStatus PublishPowerOnOffNotification(HANDLE hApp);
+
+ // Shutdown from Power
+ EFrameworkunifiedStatus stop_all_modules_of_group(HANDLE hApp);
+ UI_32 calculate_max_shutdown_time();
+ BOOL is_service_shutdown_ready(ModuleLaunchListIter &modIte); // NOLINT
+ BOOL have_critical_services_stopped();
+ VOID check_all_groups_have_stopped(HANDLE hApp);
+ EFrameworkunifiedStatus perform_force_reset(HANDLE hApp);
+ EFrameworkunifiedStatus send_shutdown_complete_response(HANDLE hApp);
+ EFrameworkunifiedStatus SendShutdownResponseMessage(HANDLE hApp);
+
+ PsmFactorT GetResetFactor(PCSTR f_module_name, BOOL f_user_reset);
+ PsmFactorT GetResetFactor(const ModuleLaunchListIter f_module_iter, BOOL f_user_reset);
+
+ EFrameworkunifiedStatus ValidateUserModeMessage(HANDLE hApp, EPWR_USER_MODE_TYPE &l_eUserModeState); // NOLINT
+
+ VOID SetStartGroup();
+
+ VOID ReadPathFromEnvironmentVariables();
+ SS_String ReadConfigDataFileNameFromEnvironmentVariable();
+ SS_String ReadLaunchConfigFileNameFromEnvironmentVariable();
+
+
+ VOID ReadUsingVMPlayerEnvironmentVariable();
+
+ VOID InitiateAllGroupsShutdown(HANDLE hApp);
+ VOID SendDeferMsg(HANDLE hApp);
+ EFrameworkunifiedStatus GetVersionNumber(SS_VersionNumberType &f_VersionNumber); // NOLINT
+ EFrameworkunifiedStatus GetBuildInfo(std::string &f_BuildInfoStr); // NOLINT
+ EFrameworkunifiedStatus RegisterCallbacksForRequester(HANDLE hApp, PCSTR pRequester);
+ EFrameworkunifiedStatus SetSystemModeInfoStruct();
+
+ EFrameworkunifiedStatus PerformLaunchProcedure(HANDLE hApp
+ , ModuleLaunchListIter f_ModuleIterator
+ , SS_String & f_stopCompName); // NOLINT
+
+ EFrameworkunifiedStatus PerformTerminateProcedure(HANDLE hApp
+ , ModuleLaunchListIter f_ModuleIterator
+ , SS_String & f_availabilityName
+ , SS_String & f_stopCompName); // NOLINT
+
+ EFrameworkunifiedStatus SendRequestToLauncher(HANDLE hApp
+ , ModuleLaunchListIter f_ModuleIterator
+ , ESMPLThreadCommandIds f_CommandId
+ , SS_String f_CommandIdStr);
+
+ EFrameworkunifiedStatus FindNameOfTerminatedProcess(SI_32 pid, SS_String &f_ModuleName); // NOLINT
+
+ EFrameworkunifiedStatus GetBinaryNameOfProcess(SS_String f_ModuleQueueName,
+ SS_String &f_ModuleBinaryName); // NOLINT
+
+ EFrameworkunifiedStatus RemoveModuleEntryFromHB(HANDLE hApp, const CHAR *f_ModuleName);
+
+ EFrameworkunifiedStatus PublishUserModeNotification(HANDLE hApp);
+ EFrameworkunifiedStatus PerformPowerOnOffUserModePublication(
+ HANDLE hApp,
+ const char * p_NotificationStr);
+ EFrameworkunifiedStatus SendSystemModeInfoResponse(
+ HANDLE hApp,
+ EPWR_STARTUP_STAGE_TYPE f_startupStage);
+
+ VOID SYSTEMMANAGERLOG_StartupConfirmationMsg(EPWR_SC_MSG_STRUCT & f_scMsg); // NOLINT
+ VOID LogGroupModulesState(UI_32 f_groupId, std::string pStr);
+ VOID LogAllGroupModulesState(std::string pStr);
+
+ EFrameworkunifiedStatus ProcessGroupAsStarted(HANDLE hApp
+ , GroupLaunchMapIter f_GroupIterator);
+ EFrameworkunifiedStatus ProcessGroupAsStarted(HANDLE hApp
+ , UI_32 f_groupId);
+ EFrameworkunifiedStatus GetModuleIterator(PCSTR f_moduleName, ModuleLaunchListIter & f_moduleIter); // NOLINT
+ BOOL IsGroupStarted(UI_32 f_groupId);
+ BOOL IsGroupStopped(UI_32 f_groupId);
+ EFrameworkunifiedStatus ResetModulesStateToConnected(HANDLE hApp);
+
+ EFrameworkunifiedStatus GetTimeStamp(std::string& TimeStamp); // NOLINT
+ std::string GetErrorEventInString(UI_32 &ErrorEventType); // NOLINT
+ EFrameworkunifiedStatus GetLastSourceInfo(SS_SOURCE &source_type); // NOLINT
+ //
+ // Return True when Module is in correct / appropriate state wrt SM state
+ // return false otherwise
+ BOOL GetModuleCondition(ModuleLaunchListIter & f_ModuleIter); // NOLINT
+
+ VOID LogESystemmanagerStatusEnums();
+ VOID LogProtocolIDs();
+
+ VOID SystemmanagerLogString(TFrameworkunifiedZone f_zone,
+ PCSTR f_func,
+ std::string &f_text); // NOLINT
+
+ inline BOOL is_current_state(SS_SMModuleState SMState) {
+ return (m_SMCurrentState == SMState);
+ }
+
+ //**************************************************************************
+ // Get results from TestClient *
+ // *
+ EFrameworkunifiedStatus add_state_information_to_response(CHAR *f_MessageResponse) const;
+ EFrameworkunifiedStatus construct_get_result_response(CHAR *f_MessageResponse); // *
+ EFrameworkunifiedStatus open_session_with_sm_test_client(HANDLE hApp, // *
+ PCSTR pRequester); // *
+ // *
+ // End of 'Get results from TestClient' *
+ //**************************************************************************
+
+ //************************************************************************
+ // Error Event Logging *
+ // *
+ EFrameworkunifiedStatus ErrorEventInit(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnHeartBeatErrorDetected(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnProcessTermDetected(HANDLE f_hApp);
+ BOOL isPreLaunchedProcess(int f_pid);
+ EFrameworkunifiedStatus OnPreLaunchedProcessTermDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo, // NOLINT
+ BOOL f_bIsExited);
+ EFrameworkunifiedStatus OnProcessCrashDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo); // NOLINT
+ EFrameworkunifiedStatus OnProcessExitDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo); // NOLINT
+
+ EFrameworkunifiedStatus OnUserInvokedLoggingRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnEelExportRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnSystemmanagerEmmcLogsRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnSystemmanagerClearLogsRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnDiagLoggingRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnCANLoggingRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnPropagateSystemError(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnCaptureAllLogsRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnCaptureScreenShotRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnCaptureSystemmanagerLogsRequest(HANDLE f_hApp);
+
+
+ EFrameworkunifiedStatus OnBootMicroResetNotification(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnObtainBootMicroLog(HANDLE f_hApp);
+ EFrameworkunifiedStatus RequestBootMicroLog(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnBootMicroLogResponse(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnErrorEventBootMicroLogResponseTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnLowSystemMemory(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainSystemmanagerSystemDataCsv(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainShowMemTxt(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnErrorEventCoreFilePollTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnObtainDebugDumpLog(HANDLE f_hApp);
+ EFrameworkunifiedStatus SendDebugDumpRequestToAllModules(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnDebugDumpResponseReceived(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnDebugDumpCompleteTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus ErrorEventEnqueue(HANDLE f_hApp,
+ EErrorEventType f_eventType,
+ std::string &f_moduleQueueName, // NOLINT
+ EErrorEventResetType f_resetType = eErrorEventResetTypeNone,
+ const SMLoggingInfo &f_loggingInfo = SMLoggingInfo());
+
+ EFrameworkunifiedStatus PerformResetAfterLogging(HANDLE f_hApp,
+ ESMCpuResetReason f_eCpuResetReason,
+ std::string f_messageStr = "");
+
+ EFrameworkunifiedStatus ErrorEventProcessNext(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnLoggingStartRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnErrorEventLoggerStartRequestTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnErrorEventArtifactRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus SendLogArtifactResponseToLogger(HANDLE f_hApp,
+ EArtifactId f_artifactId,
+ std::string f_artifactFilePathAndName);
+
+ EFrameworkunifiedStatus OnErrorEventLoggingComplete(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus ActOnModuleFailure(HANDLE f_hApp,
+ SS_String f_moduleName,
+ BOOL &f_refResetRequired); // NOLINT
+ std::string ErrorEventCreateHmiDisplayString(void);
+
+ // *
+ // End of Error Event Logging *
+ //************************************************************************
+
+ UI_32 m_SystemManagerPriority;
+};
+#define REC_HIST(pStrCmd, hist, it, pStrSender) \
+ SetCmdHist(pStrCmd, hist, it, pStrSender);
+
+#define REC_HIST_IF_SUCCESSFUL(pStr, hist, it, sender, l_eStatus) \
+ if (eFrameworkunifiedStatusOK == l_eStatus) { \
+ REC_HIST(pStr, hist, it, sender) \
+ }
+
+#define LOG_ERROR_REC_HIST(l_eStatus, pStr) { \
+ LOG_ERROR(pStr); \
+ REC_HIST(pStr, m_ErrHist, m_ErrHistIter, GetStr(l_eStatus).c_str()); \
+ }
+#define LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, pStr) \
+ if (eFrameworkunifiedStatusOK != l_eStatus) { \
+ LOG_ERROR(pStr); \
+ REC_HIST(pStr, m_ErrHist, m_ErrHistIter, GetStr(l_eStatus).c_str()); \
+ } else { \
+ LOG_SUCCESS(pStr); \
+ } // End of #define LOG_STATUS(l_eStatus,pStr)
+
+#define LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, pStr) \
+ if (eFrameworkunifiedStatusOK != l_eStatus) { \
+ LOG_ERROR(pStr); \
+ REC_HIST(pStr, m_ErrHist, m_ErrHistIter, GetStr(l_eStatus).c_str()); \
+ } // End of #define LOG_STATUS_IF_ERRORED(l_eStatus,pStr)
+
+#endif // __SS_SYSTEM_MANAGER_H__ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_system_manager_callbacks.h b/video_in_hal/systemservice/system_manager/server/include/ss_system_manager_callbacks.h
new file mode 100755
index 0000000..e9d5938
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_system_manager_callbacks.h
@@ -0,0 +1,29 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager business logic.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_MANAGER_CALLBACKS_H_ // NOLINT
+#define SS_SYSTEM_MANAGER_CALLBACKS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#endif // SS_SYSTEM_MANAGER_CALLBACK_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_system_memory_monitor.h b/video_in_hal/systemservice/system_manager/server/include/ss_system_memory_monitor.h
new file mode 100755
index 0000000..50cf857
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_system_memory_monitor.h
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager System Low Memory
+/// detection.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SYSTEM_MEMORY_MONITOR_H__ // NOLINT
+#define __SS_SYSTEM_MEMORY_MONITOR_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/resm.h>
+#include <system_service/ss_system_timer.h>
+#include <iostream>
+#include <string>
+#include "ss_sm_config.h"
+
+
+typedef enum _ESMSysMemThreadCommandIds {
+ eSysMemThrdCmd_SYS_LOW_MEMORY = 0x744, ///< SM.CrashDetector --> SM
+} ESMSysMemThreadCommandIds;
+
+struct SysMem {
+ UI_32 FreeMemoryBytes;
+ UI_32 TotalMemoryBytes;
+};
+
+const UI_32 SS_SLM_MEM_MONITOR_TIMER_ID = 3000;
+const UI_32 SS_SLM_SYSTEMMANAGERLOG_TIMER_ID = 3001;
+const UI_32 SS_MEMORY_TIMER_CONFIG_MS = 1000;
+const UI_32 SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS = 30000;
+
+class CSysMemoryMonitor {
+ public:
+ CSysMemoryMonitor(void);
+
+ virtual ~CSysMemoryMonitor(void);
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp);
+ EFrameworkunifiedStatus StopAndFreeObjects(HANDLE f_hApp);
+
+ const std::string GetThreadName(void);
+ void SetSLMConfigData(SLMConfigParameters &f_ConfigData); // NOLINT
+
+ private:
+ EFrameworkunifiedStatus CPUMemThreadStart(HANDLE f_hThread);
+ EFrameworkunifiedStatus CPUMemThreadStop(HANDLE f_hThread);
+ EFrameworkunifiedStatus StopTimers(void);
+ EFrameworkunifiedStatus OnMemoryTimerExpiry(HANDLE f_hThread);
+ EFrameworkunifiedStatus OnSystemmanagerlogTimerExpiry(HANDLE f_hThread);
+ EFrameworkunifiedStatus OnAvailability(HANDLE f_hThread);
+
+ UI_32 GetSystemRamSize(void);
+ UI_32 BitReverse32(UI_32 f_val);
+
+ HANDLE m_hThread;
+ HANDLE m_hParentApp;
+ Timer m_memMonitorTimer;
+ Timer m_systemmanagerlogTimer;
+ SLMConfigParameters m_SLMConfig;
+ SI_32 m_SLMCheckCounter;
+ SI_32 m_siPriority;
+ UI_32 m_NbrSamplesBeforeSystemmanagerlog;
+ SysMem m_sysMemInfoLast;
+ std::string m_memMonitorThreadName;
+ uint32_t m_resmSession;
+};
+
+#endif // __SS_SYSTEM_MEMORY_MONITOR_H__ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/ss_system_thread_info.h b/video_in_hal/systemservice/system_manager/server/include/ss_system_thread_info.h
new file mode 100755
index 0000000..f21ad5a
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/ss_system_thread_info.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager thread management.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_THREAD_INFO_H_ // NOLINT
+#define SS_SYSTEM_THREAD_INFO_H_
+
+#include <native_service/frameworkunified_types.h>
+
+typedef enum {
+ eSM_ThreadNotExist
+ , eSM_ThreadCreated
+ , eSMThreadIsFine
+ , eSMWaitForHeartbeat
+ , eSM_ThreadError
+} ESMThreadInfo;
+
+class CThreadInfo {
+ public:
+ CThreadInfo() : m_ThreadHdl(INVALID_HANDLE), m_ThreadState(eSM_ThreadNotExist) {}
+ CThreadInfo(HANDLE hdl, ESMThreadInfo State) : m_ThreadHdl(hdl), m_ThreadState(State) {}
+ public:
+ HANDLE m_ThreadHdl;
+ ESMThreadInfo m_ThreadState;
+};
+
+#endif // SS_SYSTEM_THREAD_INFO_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/include/system_launcher_cfg_format.h b/video_in_hal/systemservice/system_manager/server/include/system_launcher_cfg_format.h
new file mode 100755
index 0000000..b30b21f
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/include/system_launcher_cfg_format.h
@@ -0,0 +1,66 @@
+
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_LAUNCH_CONFIG_H_ // NOLINT
+#define SS_SM_LAUNCH_CONFIG_H_
+
+#include <native_service/frameworkunified_types.h>
+
+typedef struct _tLaunchParams {
+ const PCHAR group_name;
+ UI_32 group_id;
+ UI_32 group_launch_wait;
+ const PCHAR name;
+ const PCHAR binary_name;
+ UI_32 priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ const PCHAR arguments;
+ const PCHAR logging_msk_str;
+ const PCHAR restart;
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+ UI_32 fast_shutdown_wait_time;
+
+ public:
+ BOOL IsAGLUnit(void) const { return is_agl_unit; }
+ BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; }
+ BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; }
+ void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; }
+ void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) {
+ disable_agl_resethistory = f_disable_agl_resethistory;
+ }
+ void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) {
+ disable_nonagl_resethistory = f_disable_nonagl_resethistory;
+ }
+
+ private:
+ BOOL is_agl_unit;
+ BOOL disable_agl_resethistory;
+ BOOL disable_nonagl_resethistory;
+} LaunchInfo;
+
+LaunchInfo g_arrLaunchTableCfg[] = {
+};
+#endif // SS_SM_LAUNCH_CONFIG_H_ // NOLINT
diff --git a/video_in_hal/systemservice/system_manager/server/sm_launch__CWORD84_.xml b/video_in_hal/systemservice/system_manager/server/sm_launch__CWORD84_.xml
new file mode 100755
index 0000000..1392bbb
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/sm_launch__CWORD84_.xml
@@ -0,0 +1,116 @@
+<!-- group_id=1 -->
+<group name="CoreModules" wait_time="0" trigger="False" >
+ <launch
+ name=MN_NS_NPPSERVICE path="/usr/agl/bin/NS_NPPService" priority=PR_NS_NPPSERVICE_S
+ critical="True" retry_cnt="0" arguments="-a SS_SysManager -r output=0x2"
+ restart="NULL" is_start_required="False"
+ shutdown_critical="True" shutdown_wait_time="20" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+ <launch
+ name=MN_NS_BACKUPMGR path="/usr/agl/bin/NS_BackupMgr" priority=PR_NS_BACKUPMGR_S
+ critical="True" retry_cnt="0" arguments="-l console"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="True" shutdown_wait_time="15" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+<!-- group_id=2 -->
+<group name="SS_Logger" wait_time="0" trigger="False" >
+ <launch
+ name=MN_SS_LOGGERSRV path="/usr/agl/bin/SS_LoggerService" priority=PR_SS_LOGGERSRV_S
+ critical="True" retry_cnt="0" arguments="-l console -p thrd=pdg.LogQueReader:30,thrd=pdg.TransmitQueReader:30,thrd=pdg.DumpQueReader:11,thrd=pdg.PerformanceQueReader:11,thrd=pdg.LogQueWriter:30,thrd=pdg.TransmitQueWriter:30,thrd=pdg.EvntLogQue:8,thrd=pdg.UdpQueWriter:10"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="True" shutdown_wait_time="10" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+<!-- group_id=3 -->
+<group name="ShadowModules" wait_time="0" trigger="False" >
+ <!--
+ In order to excute the termination process promptly, the shutdown_wait_time of GROUP4~ sha be a;; set tp 0,
+ and FrameworkunifiedOnStop shall be issued to the servies of GROUP~ at almost the same time upon termination.
+ Setting shutdown_wait_time in the COMMUNICATION of GROUP3 makes GROUP3 wait for GROUP4~ to terminate service (wait for FrameworkunifiedOnStop responses) all at once.
+ The reason for batch wait by GROUP3 is to save the LOG of tge ternubatuib processing at the time of ACC-OFF of services
+ because the LOG save processing is performed by the GROUP2 termination processing of SS_LoggerService.
+ -->
+ <launch
+ name=MN_COMMUNICATION path="/usr/agl/bin/communication" priority=PR_COMMUNICATION_S
+ critical="True" retry_cnt="0" arguments="-l console"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="False" shutdown_wait_time="20" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+
+<!-- group_id=4 -->
+<group name="VehicleModules" wait_time="0" trigger="False" >
+ <launch
+ name=MN_POSITIONING path="/usr/agl/bin/Positioning" priority=PR_POSITIONING_S
+ critical="True" retry_cnt="0" arguments="NULL"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="False" shutdown_wait_time="0" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+
+<!-- group_id=5 -->
+<group name="SystemModules" wait_time="0" trigger="False" >
+ <launch
+ name=MN_SS_POWERSERVICE path="/usr/agl/bin/SS_PowerService" priority=PR_SS_POWERSERVICE_S
+ critical="True" retry_cnt="0" arguments="-l console"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="False" shutdown_wait_time="0" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+ <launch
+ name=MN_SS_TASKMANAGER path="/usr/agl/bin/tskmgr" priority=PR_SS_TASKMANAGER_S
+ critical="True" retry_cnt="0" arguments="-l console"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="True" shutdown_wait_time="0" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+ <launch
+ name=MN_SS_RESOURCEMGR path="/usr/agl/bin/resm" priority=PR_SS_RESOURCEMGR_S
+ critical="True" retry_cnt="0" arguments="-l console"
+ restart="NULL" is_start_required="True"
+ shutdown_critical="False" shutdown_wait_time="0" fast_shutdown_wait_time="1000"
+ user_name=""
+ />
+</group>
+<!-- group_id=6 -->
+<!-- group_id=7 -->
+<!-- group_id=8 -->
+<!-- group_id=9 -->
+<!-- group_id=10 -->
+<!-- group_id=11 -->
+<!-- group_id=12 -->
+<!-- group_id=13 -->
+<!-- group_id=14 -->
+<!-- group_id=15 -->
+<!-- group_id=16 -->
+<!-- group_id=17 -->
+<!-- group_id=18 -->
+<!-- group_id=19 -->
+<!-- group_id=20 -->
+<!-- group_id=21 -->
+<!-- group_id=22 -->
+<!-- group_id=23 -->
+<!-- group_id=24 -->
+<!-- group_id=25 -->
+<!-- group_id=26 -->
+<!-- group_id=28 -->
+<!-- group_id=29 -->
+<!-- group_id=30 -->
+<!-- group_id=31 -->
+<!-- group_id=32 -->
+<!-- group_id=33 -->
+<!-- group_id=34 -->
+<!-- group_id=35 -->
+<!-- group_id=36 -->
+<!-- group_id=37 -->
+<!-- group_id=38 -->
+<!-- group_id=39 -->
+<!-- group_id=40 -->
+<!-- group_id=41 -->
+<!-- group_id=42 -->
diff --git a/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_if.cpp b/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_if.cpp
new file mode 100755
index 0000000..a3c2777
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_if.cpp
@@ -0,0 +1,201 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <ss_hb_thread.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_heartbeat_notifications.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_templates.h>
+#include <new>
+#include "ss_sm_systemmanagerlog.h"
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus HBThreadCallback(HANDLE hThread) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusNullPointer;
+ C * pObj = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hThread));
+ if (pObj) { // LCOV_EXCL_BR_LINE 4:pObj must not be NULL
+ eStatus = (pObj->*M)(hThread);
+ }
+ return eStatus;
+}
+
+static VOID DeletePObj(CHeartBeatThread * pObj) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ delete pObj;
+}
+// LCOV_EXCL_STOP
+
+static VOID DeleteHBTimer(CHeartBeatThread * pObj) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = pObj->HeartBeatTimersDelete();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "pObj->HeartBeatTimersDelete()");
+}
+// LCOV_EXCL_STOP
+
+#define DetachParentCbThreadProtocols(hThread, handler) \
+{ \
+ EFrameworkunifiedStatus l_eStatus = DetachParentCallbacksFromInterfaceunifiedDispatcher( \
+ hThread, \
+ handler, \
+ static_cast<UI_32>(_countof(handler))); \
+ LOG_STATUS_IF_ERRORED(l_eStatus, "DetachParentCallbacksFromInterfaceunifiedDispatcher()") \
+}
+
+#define DetachCbProtocols(hThread, f_pStr, f_protocolHandlers, hSession) \
+{ \
+ EFrameworkunifiedStatus l_eStatus = \
+ DetachCallbacksFromInterfaceunifiedDispatcher( \
+ hThread, \
+ f_pStr, \
+ f_protocolHandlers, \
+ static_cast<UI_32>(_countof(f_protocolHandlers)), \
+ hSession); \
+ LOG_STATUS_IF_ERRORED(l_eStatus, "DetachCallbacksFromInterfaceunifiedDispatcher()") \
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: SS_SystemManager
+ @brief: HBThreadStart: function would be called at the time of starting of the thread
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+ */
+/*****************************************************************************/
+EFrameworkunifiedStatus HBThreadStart(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ FrameworkunifiedProtocolCallbackHandler HBThreadCommonHandlers[] = {
+ // Command ID, Call back functions
+ { SS_HEARTBEAT_RESPONSE, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnClientResponse> },
+ { SS_HEARTBEAT_PRINT_CONNECTIONS, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnPrintConnections> },
+ { SS_HEARTBEAT_PRINT_STACK, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnPrintStack> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FrameworkunifiedProtocolCallbackHandler HBThreadProtocolHandlers[] = {
+ // Command ID, Call back functions
+ { SS_HEARTBEAT_START, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnStartThread> },
+ { SS_HEARTBEAT_STOP, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnStopThread> },
+ { SS_HEARTBEAT_DELETE_MODULE_ENTRY, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnRemoveModule> },
+ { SS_HEARTBEAT_APPEND_MODULE_ENTRY, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnAppendModule> },
+ { SS_HEARTBEAT_PERIODIC_STATUS_REQ, HBThreadCallback<CHeartBeatThread,
+ &CHeartBeatThread::HBOnPeriodicStatusRequest> },
+ { SS_HEARTBEAT_AVAIL_CHECK_REQ, HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnAvailCheckRequest> }
+ }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ CHeartBeatThread * pObj = new (std::nothrow) CHeartBeatThread(hThread); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (NULL == pObj) { // LCOV_EXCL_BR_LINE 5: Standard lib
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 5: Standard lib
+ LOG_ERROR("new(std::nothrow) CHeartBeatThread(hThread)"); // LCOV_EXCL_LINE 5: Standard lib
+ // LCOV_EXCL_BR_START 6:always return eFrameworkunifiedStatusOK
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = pObj->HeartBeatTimerInit(hThread))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("pObj->HeartBeatTimerInit(hThread)"); // LCOV_EXCL_LINE 6:always return eFrameworkunifiedStatusOK
+ DeletePObj(pObj); // LCOV_EXCL_LINE 6:always return eFrameworkunifiedStatusOK
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachParentCallbacksToDispatcher(hThread,
+ HBThreadProtocolHandlers, static_cast<UI_32>(_countof(HBThreadProtocolHandlers))))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachParentCallbacksToDispatcher(HBThreadProtocolHandlers)");
+ DeleteHBTimer(pObj);
+ DeletePObj(pObj);
+ // LCOV_EXCL_STOP
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachParentCallbacksToDispatcher(hThread,
+ HBThreadCommonHandlers, static_cast<UI_32>(_countof(HBThreadCommonHandlers))))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachParentCallbacksToDispatcher(HBThreadCommonHandlers)");
+ DetachParentCbThreadProtocols(hThread, HBThreadProtocolHandlers);
+ DeleteHBTimer(pObj);
+ DeletePObj(pObj);
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hThread, FRAMEWORKUNIFIED_ANY_SOURCE, HBThreadCommonHandlers, static_cast<UI_32>(_countof(HBThreadCommonHandlers)), NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher("
+ "FRAMEWORKUNIFIED_ANY_SOURCE, HBThreadCommonHandlers)");
+ DetachParentCbThreadProtocols(hThread, HBThreadCommonHandlers);
+ DetachParentCbThreadProtocols(hThread, HBThreadProtocolHandlers);
+ DeleteHBTimer(pObj);
+ DeletePObj(pObj);
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = FrameworkunifiedSetThreadSpecificData(hThread, pObj); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSetThreadSpecificData(hThread, pObj)");
+ DetachCbProtocols(hThread, FRAMEWORKUNIFIED_ANY_SOURCE, HBThreadCommonHandlers,
+ NULL);
+ DetachParentCbThreadProtocols(hThread, HBThreadCommonHandlers);
+ DetachParentCbThreadProtocols(hThread, HBThreadProtocolHandlers);
+ DeleteHBTimer(pObj);
+ DeletePObj(pObj);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Successful");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: SS_SystemManager
+ @brief: HBThreadStop: function would be called at the time of stopping of the thread
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+ */
+/*****************************************************************************/
+EFrameworkunifiedStatus HBThreadStop(HANDLE hThread) { // LCOV_EXCL_START 14: Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
+
+ CHeartBeatThread * pObj = static_cast<CHeartBeatThread *>(FrameworkunifiedGetThreadSpecificData(hThread));
+ if (NULL == pObj) {
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("FrameworkunifiedGetThreadSpecificData(hThread)");
+ } else {
+ // delete timers
+ CALL_AND_LOG_STATUS_IF_ERRORED(pObj->HeartBeatTimersDelete());
+ CALL_AND_LOG_STATUS_IF_ERRORED(pObj->HBPublishAvailabilityStatus(hThread, FALSE));
+ DeletePObj(pObj);
+ }
+
+ FrameworkunifiedSetThreadSpecificData(hThread, NULL);
+ CALL_AND_LOG_STATUS_IF_ERRORED(FrameworkunifiedDetachServiceFromDispatcher(hThread, FrameworkunifiedGetAppName(hThread)));
+
+ FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_eStatus;
+}// LCOV_EXCL_STOP
diff --git a/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp b/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp
new file mode 100755
index 0000000..5fb4e00
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp
@@ -0,0 +1,184 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+#include <stdlib.h>
+#include <string.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+
+#include "ss_hb_thread.h"
+#include "ss_sm_systemmanagerlog.h"
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnTimerExpiry
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnTimerExpiry(HANDLE f_hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ // check heart beat replies received from clients.
+ l_eStatus = HBCheckHeartBeatResponses(f_hThread);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "HBCheckHeartBeatResponses()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // send heart beat requests to clients
+ l_eStatus = HBSendRequest(f_hThread);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "HBSendRequest()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnClientResponse
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnClientResponse(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ l_eStatus = m_oSessionHandler.HBProcessClientResponse(f_hThread);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_oSessionHandler.HBProcessClientResponse(f_hThread)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnPeriodicStatusRequest
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnPeriodicStatusRequest(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendParent(f_hThread, SS_HEARTBEAT_PERIODIC_RESP, 0, NULL))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendParent(SS_HEARTBEAT_PERIODIC_RESP)"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "Successful");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnPeriodicStatusRequest
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnAvailCheckRequest(HANDLE f_hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "+");
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ THbAvailCheck check;
+ l_eStatus = m_oSessionHandler.HBAvailableCheck(check);
+ SS_ASERT(l_eStatus == eFrameworkunifiedStatusOK); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendParent(f_hThread, SS_HEARTBEAT_AVAIL_CHECK_RESP, sizeof(check), &check))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendParent(SS_HEARTBEAT_AVAIL_CHECK_RESP)"); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnRemoveModule
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnRemoveModule(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ TSMRequestMessage tReqMsgData;
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg <TSMRequestMessage> (f_hThread, tReqMsgData))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s is required to be Deleted from HeartBeat Monitor List", tReqMsgData.pstModuleName);
+
+ // delete module entry from map
+ l_eStatus = m_oSessionHandler.HBDeleteRegisteredClientEntry(f_hThread, tReqMsgData.pstModuleName);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_oSessionHandler.HBDeleteRegisteredProcessEntry()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnAppendModule
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus OK or Fail
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnAppendModule(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ TSMRequestMessage tReqMsgData;
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < TSMRequestMessage > (f_hThread, tReqMsgData))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s is required to be Appended from HeartBeat Monitor List", tReqMsgData.pstModuleName);
+
+ // append module entry from map
+ SubscriberName l_Subscriber = tReqMsgData.pstModuleName;
+ l_eStatus = m_oSessionHandler.HBEntrySubscriber(l_Subscriber); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "m_oSessionHandler.HBEntrySubscriber()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// EOF
diff --git a/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_session.cpp b/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_session.cpp
new file mode 100755
index 0000000..8178e46
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_session.cpp
@@ -0,0 +1,415 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_sm_thread_names.h>
+#include <system_service/ss_templates.h>
+#include <iostream>
+#include <iomanip>
+#include <utility>
+#include <list>
+#include <string>
+
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_hb_thread.h"
+#include "ss_hb_session.h"
+#include "ss_system_manager.h"
+
+using namespace std; // NOLINT
+
+CHeartBeatSessionHandler::CHeartBeatSessionHandler() {
+}
+
+CHeartBeatSessionHandler::~CHeartBeatSessionHandler() { // LCOV_EXCL_START 14: Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HbSessionInfo
+ @note: HbSessionInfo constructor
+ @param
+ @return
+ *****************************************************************************/
+CHeartBeatSessionHandler::HbSessionInfo::HbSessionInfo(SubscriberName f_Subscriber) {
+ fRunning = FALSE;
+ fHeartBeatRequestSent = FALSE;
+ fHeartBeatResponseReceived = FALSE;
+ HeartBeatRetryCount = 0;
+ fHeartBeatTimedOut = FALSE;
+ hSession = NULL;
+ szName = f_Subscriber;
+ fisAvailability = FALSE;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBEntrySubscriber
+ @note:
+ @param
+ @return
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBEntrySubscriber(SubscriberName &f_Subscriber) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // check if the subscriber is already in map
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.find(f_Subscriber);
+
+ // the l_SessionInfoIterator is set to the end then the subscriber is not in the map
+ if (m_mapHbSessions.end() == l_SessionInfoIterator) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Entry Subscriber : %s", f_Subscriber.c_str());
+ HbSessionInfo l_NewHBClientSessionInfo(f_Subscriber.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ pair<HbSessionIter, bool> ret;
+ // insert new subscriber entry into the session map
+ ret = m_mapHbSessions.insert(std::make_pair(f_Subscriber, l_NewHBClientSessionInfo));
+ if (!ret.second) { // LCOV_EXCL_BR_LINE 6:l_NewHBClientSessionInfo must not be NULL.
+ // LCOV_EXCL_START 6:l_NewHBClientSessionInfo must not be NULL.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFail;
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Subscriber '%s' is already in the map", f_Subscriber.c_str());
+ }
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: ProcessHBClientResponse
+ @note: Process the response received from client, update relevant structure data
+ @param HANDLE
+ @return EFrameworkunifiedStatus
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBProcessClientResponse(HANDLE f_hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "+");
+ BOOL l_availability = FALSE;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<BOOL>(f_hThread, l_availability))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ // find the subscriber...
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.find(FrameworkunifiedGetMsgSrc(f_hThread));
+
+ // the l_SessionInfoIterator is set to the end then the subscriber is not in the map
+ if (m_mapHbSessions.end() != l_SessionInfoIterator) {
+ l_SessionInfoIterator->second.HeartBeatRetryCount = 0;
+ l_SessionInfoIterator->second.fHeartBeatResponseReceived = TRUE;
+ l_SessionInfoIterator->second.fHeartBeatRequestSent = FALSE;
+ l_SessionInfoIterator->second.fisAvailability = l_availability;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__,
+ "HeartBeat received from module: %s ", l_SessionInfoIterator->first.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__,
+ "Ignoring Heart Beat Response, Client: %s not found in the map!", FrameworkunifiedGetMsgSrc(f_hThread));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBPrintConnection
+ @note: .Print registered client information
+ @param VOID
+ @return VOID
+ *****************************************************************************/
+VOID CHeartBeatSessionHandler::HBPrintConnection() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // find the subscriber...
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.begin();
+ for (; l_SessionInfoIterator != m_mapHbSessions.end(); l_SessionInfoIterator++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG_DUMP, __FUNCTION__,
+ "HeartBeat Service is Connected to: %s via a Session: Running: %s ",
+ l_SessionInfoIterator->second.szName.data(),
+ (l_SessionInfoIterator->second.fRunning ? "YES" : "NO"));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBPrintStack
+ @note: .Print registered client information
+ @param VOID
+ @return VOID
+ *****************************************************************************/
+VOID CHeartBeatSessionHandler::HBPrintStack(UI_32 f_MaxHeartBeatRetryCount) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // find the subscriber...
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.begin();
+ for (; l_SessionInfoIterator != m_mapHbSessions.end(); l_SessionInfoIterator++) {
+ if (FALSE == l_SessionInfoIterator->second.fHeartBeatResponseReceived) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG_DUMP, __FUNCTION__,
+ "HeartBeat Service is Connected to: %s via a Session: Running: %s ",
+ l_SessionInfoIterator->second.szName.data(),
+ (l_SessionInfoIterator->second.fRunning ? "YES" : "NO"));
+ FRAMEWORKUNIFIEDLOG(ZONE_DEBUG_DUMP, __FUNCTION__,
+ "Retry count (%d) within limit (%d), HeartBeatTimedout = %s",
+ l_SessionInfoIterator->second.HeartBeatRetryCount,
+ f_MaxHeartBeatRetryCount,
+ (l_SessionInfoIterator->second.fHeartBeatTimedOut == TRUE ?
+ "TRUE" : "FALSE"));
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBCheckResponses
+ @note: Check if all clients have replied to heartbeat query and generate report
+ @param THbReportData Report structure to be filled
+ @param UI_32 Heartbeat max retry count
+ @return eFrameworkunifiedStatusFail if one or more modules have timed out, eFrameworkunifiedStatusOK otherwise.
+ *****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBCheckResponses(
+ THbReportData &f_tReportData, UI_32 f_MaxHeartBeatRetryCount,
+ SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.begin();
+ memset(&f_tReportData, 0, sizeof(THbReportData));
+
+ int index = 0;
+
+ while (l_SessionInfoIterator != m_mapHbSessions.end()) {
+ if (f_ChkIndex == (index % f_HeartBeatIntervalRepeat)) {
+ // check if report queue is full
+ // LCOV_EXCL_BR_START 6: f_tReportData.nNumOfModules can't more than SS_MAX_NUM_MODULES
+ if (SS_MAX_NUM_MODULES <= f_tReportData.nNumOfModules) {
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SS_MAX_NUM_MODULES '%d' <= f_tReportData.nNumOfModules '%d'. See ss_system_manager_if.h.",
+ SS_MAX_NUM_MODULES, f_tReportData.nNumOfModules);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusInvldBuf;
+ }
+
+
+ strncpy(f_tReportData.tModuleList[f_tReportData.nNumOfModules].ProcQueueName,
+ l_SessionInfoIterator->first.c_str(),
+ sizeof(f_tReportData.tModuleList[f_tReportData.nNumOfModules].ProcQueueName) - 1);
+ f_tReportData.tModuleList[f_tReportData.nNumOfModules].HeartBeatRetryCount =
+ l_SessionInfoIterator->second.HeartBeatRetryCount;
+ f_tReportData.tModuleList[f_tReportData.nNumOfModules].ProcHBState = HB_STATUS_GOOD;
+
+ if (TRUE == l_SessionInfoIterator->second.fHeartBeatResponseReceived) {
+ l_SessionInfoIterator->second.fHeartBeatResponseReceived = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__,
+ "[%s] Heart Beat Response Received !",
+ l_SessionInfoIterator->second.szName.c_str());
+ } else if (TRUE == l_SessionInfoIterator->second.fHeartBeatTimedOut) {
+ f_tReportData.tModuleList[f_tReportData.nNumOfModules].ProcHBState = HB_STATUS_TIMEOUT;
+ } else if ((TRUE == l_SessionInfoIterator->second.fHeartBeatRequestSent)
+ && (FALSE == l_SessionInfoIterator->second.fHeartBeatTimedOut)) {
+ l_SessionInfoIterator->second.HeartBeatRetryCount++;
+
+ if (l_SessionInfoIterator->second.HeartBeatRetryCount > f_MaxHeartBeatRetryCount) {
+ l_eStatus = eFrameworkunifiedStatusFail;
+ l_SessionInfoIterator->second.fHeartBeatTimedOut = TRUE;
+ l_SessionInfoIterator->second.HeartBeatRetryCount = 0;
+
+ f_tReportData.tModuleList[f_tReportData.nNumOfModules].ProcHBState = HB_STATUS_TIMEOUT;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Heart Beat Retry count of [%s] has crossed max limit (%d)."
+ "Disabling sending HeartBeat query to it",
+ l_SessionInfoIterator->second.szName.c_str(),
+ f_MaxHeartBeatRetryCount);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: [%s] has missed a Heart Beat. Retry count (%d) is within max retry limit (%d)",
+ l_SessionInfoIterator->second.szName.c_str(),
+ l_SessionInfoIterator->second.HeartBeatRetryCount,
+ f_MaxHeartBeatRetryCount);
+ }
+ }
+ }
+
+ f_tReportData.nNumOfModules++;
+ ++l_SessionInfoIterator;
+ index++;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBSendRequest
+ @note: .Sent heart beat query to the registered clients
+ @param void
+ @return EFrameworkunifiedStatus
+******************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBSendRequest(HANDLE f_hThread,
+ SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+
+ // Get session iterator
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.begin();
+
+ if (l_SessionInfoIterator == m_mapHbSessions.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "No Client has opened session with HeartBeat");
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+
+ int index = 0;
+
+ while (l_SessionInfoIterator != m_mapHbSessions.end()) {
+ if (f_ChkIndex == (index % f_HeartBeatIntervalRepeat)) {
+ if (l_SessionInfoIterator->second.hSession == NULL) { // LCOV_EXCL_BR_LINE 200:hSession must not be NULL
+ l_SessionInfoIterator->second.hSession = FrameworkunifiedMcOpenSender(f_hThread, l_SessionInfoIterator->first.c_str());
+ if (NULL == l_SessionInfoIterator->second.hSession) { // LCOV_EXCL_BR_LINE 200:hSession must not be NULL
+ // LCOV_EXCL_START 200: hSession must not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedMcOpenSender(%s) returned NULL",
+ l_SessionInfoIterator->first.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ l_SessionInfoIterator->second.fRunning = TRUE;
+ }
+ }
+
+ if ((NULL != l_SessionInfoIterator->second.hSession)
+ && (FALSE == l_SessionInfoIterator->second.fHeartBeatTimedOut)) {
+ if (eFrameworkunifiedStatusOK == (l_eStatus = FrameworkunifiedSendMsg(l_SessionInfoIterator->second.hSession, SS_HEARTBEAT_REQUEST, 0, NULL))) { // LCOV_EXCL_BR_LINE 5:NSFW's error // NOLINT(whitespace/line_length)
+ /// TODO review if we are required to return failure if sending message to one process failed.
+ l_SessionInfoIterator->second.fHeartBeatResponseReceived = FALSE;
+ l_SessionInfoIterator->second.fHeartBeatRequestSent = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__,
+ "HeartBeat Request sent to : %s", l_SessionInfoIterator->first.c_str());
+ } else {
+ // LCOV_EXCL_START 5:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSendMsg(%s, SS_HEARTBEAT_REQUEST) errored: %d/'%s'",
+ l_SessionInfoIterator->first.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__,
+ " HeartBeat Request was not sent to '%s', timeout is '%s'",
+ l_SessionInfoIterator->first.c_str(),
+ (l_SessionInfoIterator->second.fHeartBeatTimedOut == TRUE ? "TRUE" : "FALSE"));
+ }
+ }
+ ++l_SessionInfoIterator;
+ index++;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBDeleteRegisteredClientEntry
+ @note: .
+ @param
+ @return EFrameworkunifiedStatus
+******************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBDeleteRegisteredClientEntry(HANDLE f_hThread, PSTR pQueueName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ SubscriberName tQueuename(pQueueName);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Looking for %s.", tQueuename.c_str());
+
+ HbSessionIter l_SessionInfoIterator = m_mapHbSessions.find(tQueuename);
+
+ if (m_mapHbSessions.end() != l_SessionInfoIterator) {
+ // Close the session handle
+ if (NULL != l_SessionInfoIterator->second.hSession) { // LCOV_EXCL_BR_LINE 200:hSession must not be NULL when tQueuename exists. // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedMcClose(l_SessionInfoIterator->second.hSession))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedMcClose()"); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ l_SessionInfoIterator->second.hSession = NULL;
+ }
+ m_mapHbSessions.erase(tQueuename);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting '%s' Successful ", tQueuename.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "%s not found in Heart beat client list", tQueuename.c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBAvailableCheck
+ @note: .
+ @param
+ @return EFrameworkunifiedStatus
+******************************************************************************/
+EFrameworkunifiedStatus CHeartBeatSessionHandler::HBAvailableCheck(THbAvailCheck &check) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL isOk = TRUE;
+
+ std::list<std::string> ngList;
+ for (HbSessionIter ite = m_mapHbSessions.begin(); ite != m_mapHbSessions.end(); ite++) {
+ if (ite->second.fisAvailability == FALSE) {
+ ngList.push_back(ite->first);
+ // Notify Last Service as Representative
+ snprintf(check.serviceName, SS_SM_HB_MAX_PROC_NAME_SIZE, "%s", ite->first.c_str());
+ isOk = FALSE;
+ }
+ }
+
+ if (isOk == FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "********* AVAILABILITY CHECK ERROR **********");
+ fprintf(stderr, "HBOnAvailCheckRequest/********* AVAILABILITY CHECK ERROR **********\n"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "********* AVAILABILITY CHECK OK **********");
+ fprintf(stderr, "HBOnAvailCheckRequest/********* AVAILABILITY CHECK OK **********\n"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ for (std::list<std::string>::iterator ite = ngList.begin(); ite != ngList.end(); ite++) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " %s", ite->c_str());
+ fprintf(stderr, " %s\n", ite->c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ check.isOk = isOk;
+
+ return l_eStatus;
+}
diff --git a/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_thread.cpp b/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_thread.cpp
new file mode 100755
index 0000000..19d124a
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/heartbeat/ss_hb_thread.cpp
@@ -0,0 +1,355 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <system_service/ss_heartbeat_notifications.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+
+#include "ss_hb_thread.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_system_manager.h"
+
+/// Total Timers used by Heart Beat Thread
+/// This value is used for creating timers
+#define HBMaxTimers 1
+#define HBTimerInterval 1
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus HBThreadCallback(HANDLE hThread) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ C * pObj = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hThread));
+ if (pObj) { // LCOV_EXCL_BR_LINE 4:pObj must not be NULL
+ eStatus = (pObj->*M)(hThread);
+ }
+ return eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: CHeartBeatThread
+ @note: Constructor
+*****************************************************************************/
+CHeartBeatThread::CHeartBeatThread(HANDLE f_hThread) :
+ m_oTimerCtrl(HBMaxTimers)
+ , m_HBTimerID(0)
+ , m_NextChkIndex(0)
+ , m_hThread(f_hThread) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::memset(&m_HBConfigParams, 0, sizeof(m_HBConfigParams));
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: ~CHeartBeatThread
+ @note: Destructor
+*****************************************************************************/
+CHeartBeatThread::~CHeartBeatThread() { // LCOV_EXCL_START 14: Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBPublishAvailabilityStatus
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @param BOOL - The Availability Status to be published
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBPublishAvailabilityStatus(HANDLE hThread, BOOL f_bAvailabiltyStatus) {// LCOV_EXCL_START 14: Resident process, not called by NSFW
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Send availability notification to users
+ l_eStatus = FrameworkunifiedPublishServiceAvailability(hThread, f_bAvailabiltyStatus);
+ char l_cBuf[100] = { 0 };
+ snprintf(l_cBuf,
+ sizeof(l_cBuf),
+ "FrameworkunifiedPublishServiceAvailability(%s)",
+ GetStr(f_bAvailabiltyStatus).c_str());
+ LOG_STATUS(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}// LCOV_EXCL_STOP
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnStartThread
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnStartThread(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ UI_32 l_DataLen = FrameworkunifiedGetMsgLength(hThread); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if ((sizeof(UI_32) + (SS_MAX_NUM_MODULES * SS_SM_HB_MAX_PROC_NAME_SIZE) + sizeof(m_HBConfigParams)) < l_DataLen) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: message buffer sizes invalid:received %d", l_DataLen);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ CHAR l_Data[l_DataLen]; // NOLINT
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hThread, (PVOID) & l_Data, static_cast<UI_32>(sizeof(l_Data)), eSMRRelease))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedGetMsgDataOfSize() errored: 0x%x", l_eStatus);
+ return l_eStatus;
+ }
+
+ CHAR* p_Data = &l_Data[0];
+ UI_32 list_num;
+ memcpy(&m_HBConfigParams, p_Data, sizeof(m_HBConfigParams));
+ p_Data = p_Data + sizeof(m_HBConfigParams);
+ memcpy(&list_num, p_Data, sizeof(list_num));
+ p_Data = p_Data + sizeof((list_num));
+
+ for (UI_32 i = 0; i < list_num; i++) {
+ SubscriberName l_Subscriber = p_Data; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != m_oSessionHandler.HBEntrySubscriber(l_Subscriber)) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: HBEntrySubscriber");
+ }
+ p_Data = p_Data + SS_SM_HB_MAX_PROC_NAME_SIZE;
+ }
+
+ if (0 == m_HBConfigParams.ApplicationHeartBeatIntervalInitial) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Heart beat disabled via configuration file interval "
+ "parameter set to 0.");
+ } else if (0 != m_HBTimerID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Heart Beat Timer ID '%d' already created, ignoring "
+ "repeated Heart Beat Start command.", m_HBTimerID);
+ } else {
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK !=
+ (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hThread, NTFY_HeartBeatAvailability))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedRegisterServiceAvailabilityNotification(" NTFY_HeartBeatAvailability ")");
+ // LCOV_EXCL_STOP
+ }
+ else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Service availability %s Registered SOURCE : %s",
+ NTFY_HeartBeatAvailability,
+ FrameworkunifiedGetAppName(hThread));
+
+ // Publish Heart Beat Availability
+ // LCOV_EXCL_BR_START 4: NSFW error case.
+ if (eFrameworkunifiedStatusOK != (l_eStatus = HBPublishAvailabilityStatus(hThread, TRUE))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("HBPublishAvailabilityStatus(TRUE)");
+ // LCOV_EXCL_STOP
+ }
+ }
+ // Create Heart Beat app monitor
+ m_HBTimerID = m_oTimerCtrl.CreateTimer(HBThreadCallback<CHeartBeatThread, &CHeartBeatThread::HBOnTimerExpiry>); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (0 == m_HBTimerID) { // LCOV_EXCL_BR_LINE 8: m_HBTimerID can't be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Heart Beat Timer ID creation failed.");
+ // return eFrameworkunifiedStatusFail;
+ } else {
+ // Start Heart Beat app monitor
+ m_oTimerCtrl.StartTimer(m_HBTimerID,
+ m_HBConfigParams.ApplicationHeartBeatIntervalInitial,
+ 0,
+ HBTimerInterval,
+ 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Initial Heart Beat Timer created for %d seconds interval",
+ m_HBConfigParams.ApplicationHeartBeatIntervalInitial);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Repetitive Heart Beat Timer created for %d seconds interval",
+ m_HBConfigParams.ApplicationHeartBeatIntervalRepeat);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnStopThread
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnStopThread(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ if (0 != m_HBTimerID) {
+ // Stop HeartBeat timer
+ m_oTimerCtrl.StopTimer(m_HBTimerID);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Timer '%d' stopped", m_HBTimerID);
+ }
+ else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_HBTimerID' is '0'; unable to stop timer");
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HeartBeatTimerInit
+ @note:
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HeartBeatTimerInit(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_oTimerCtrl.Initialize(hThread);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HeartBeatTimersDelete
+ @note:
+ @param void
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HeartBeatTimersDelete() {// LCOV_EXCL_START 14: Resident process, not called by NSFW
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (0 == m_HBTimerID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_HBTimerID' is '0'; unable to delete timer");
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ // Delete Heart Beat timer
+ UI_32 l_TimerID = m_oTimerCtrl.DeleteTimer(m_HBTimerID);
+ if (0 == l_TimerID) {
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ LOG_ERROR("m_oTimerCtrl.DeleteTimer(m_HBTimerID)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Successful");
+ }
+ m_HBTimerID = 0;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}// LCOV_EXCL_STOP
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBCheckHeartBeatResponses
+ @note: This function checks heartbeat responses and generates a summary
+ report for System Manager if one or more modules have failed to
+ reply within the configured maximum number of heartbeat retries.
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBCheckHeartBeatResponses(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ THbReportData f_tReportData;
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = m_oSessionHandler.HBCheckResponses(f_tReportData,
+ m_HBConfigParams.MaxHeartBeatRetryCount,
+ m_HBConfigParams.ApplicationHeartBeatIntervalRepeat,
+ m_NextChkIndex);
+ if (l_eStatus == eFrameworkunifiedStatusFail) { // Send a heartbeat report ONLY if a heartbeat failure is detected.
+ // send report to system manager
+ l_eStatus = FrameworkunifiedSendParent(hThread,
+ SS_HEARTBEAT_ERROR_DETECTED,
+ sizeof(f_tReportData),
+ &f_tReportData);
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSendParent(SS_HEARTBEAT_ERROR_DETECTED)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG0(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBSendRequest
+ @note: .
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBSendRequest(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+
+ CALL_AND_LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ m_oSessionHandler.HBSendRequest(hThread, m_HBConfigParams.ApplicationHeartBeatIntervalRepeat, m_NextChkIndex)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ m_NextChkIndex++;
+ if (m_HBConfigParams.ApplicationHeartBeatIntervalRepeat <= m_NextChkIndex) {
+ m_NextChkIndex = 0;
+ }
+
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnPrintConnections
+ @note: .Prints all active sessions connected to HeartBeat
+ @param HANDLE hThread
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnPrintConnections(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_oSessionHandler.HBPrintConnection();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+/*****************************************************************************
+ @ingroup: SS_SystemManager
+ @brief: HBOnPrintStack
+ @note: . Prints all sessions connected to HeartBeat
+ @param HANDLE - Handle to message queue of HeartBeat Service.
+ @return EFrameworkunifiedStatus
+*****************************************************************************/
+EFrameworkunifiedStatus CHeartBeatThread::HBOnPrintStack(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_oSessionHandler.HBPrintStack(m_HBConfigParams.MaxHeartBeatRetryCount);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
diff --git a/video_in_hal/systemservice/system_manager/server/src/processlauncher/ProcessLauncher.cpp b/video_in_hal/systemservice/system_manager/server/src/processlauncher/ProcessLauncher.cpp
new file mode 100755
index 0000000..6b709fe
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/processlauncher/ProcessLauncher.cpp
@@ -0,0 +1,317 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_string_maps.h>
+#include <native_service/ns_plogger_if.h>
+#include <string>
+
+#include "ProcessLauncher.h"
+#include "ss_sm_process_launcher_protocol.h"
+#include "ss_sm_process_launcher.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_signals.h"
+
+CProcessLauncher::CProcessLauncher() { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+CProcessLauncher::CProcessLauncher(void *) {
+}
+
+CProcessLauncher::~CProcessLauncher() { // LCOV_EXCL_START 14: resident process end
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ m_mapOfProcesses.clear();
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CProcessLauncher::PLTerminateModule(
+ HANDLE hThread,
+ T_ProcessLauncherTerminationResp *f_pTerminateRespData) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ T_ProcessLauncherTerminationReq l_ModuleTerminateReq;
+
+ // LCOV_EXCL_BR_START 4:NSFW error case
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg < T_ProcessLauncherTerminationReq > (hThread, l_ModuleTerminateReq, eSMRRetain))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4:NSFW error case
+ } else {
+ // get pointer to the process object launched earlier
+ Process * l_pProcessPtr = m_mapOfProcesses[l_ModuleTerminateReq.path]; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // Confirm that the process pointer for the module exists in the map
+ if (NULL != l_pProcessPtr) { // LCOV_EXCL_BR_LINE 200: l_pProcessPtr must not be null
+ // check if process still exists
+ if (l_pProcessPtr->DoesProcessExist()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Terminating %s, PID: %d.", l_ModuleTerminateReq.path, l_pProcessPtr->GetProcessId());
+ // kill unresponsive process
+ l_pProcessPtr->KillProcess(SS_SM_ABORT_SIGNAL);
+
+ if (NULL != f_pTerminateRespData) { // LCOV_EXCL_BR_LINE 200: f_pTerminateRespData must not be null
+ std::strcpy(f_pTerminateRespData->name, // NOLINT
+ l_ModuleTerminateReq.name);
+ std::strcpy(f_pTerminateRespData->path, // NOLINT
+ l_ModuleTerminateReq.path);
+ std::strcpy(f_pTerminateRespData->args, // NOLINT
+ l_ModuleTerminateReq.args);
+ f_pTerminateRespData->moduleIterator =
+ l_ModuleTerminateReq.moduleIterator;
+ f_pTerminateRespData->groupIterator =
+ l_ModuleTerminateReq.groupIterator;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info: %s has already terminated.", l_ModuleTerminateReq.path);
+
+ l_eStatus = eFrameworkunifiedStatusServNotFound;
+ }
+ // remove process entry
+ m_mapOfProcesses.erase(l_ModuleTerminateReq.path);
+ // delete process object
+ delete l_pProcessPtr; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else { // LCOV_EXCL_BR_LINE 200: l_pProcessPtr will not be null
+ // LCOV_EXCL_START 200: l_pProcessPtr will not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s not in m_mapOfProcesses", l_ModuleTerminateReq.path);
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdTerminateModule(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ T_ProcessLauncherTerminationResp l_TerminateRespData;
+ if (eFrameworkunifiedStatusOK == (l_eStatus = PLTerminateModule(hThread, &l_TerminateRespData))) {
+ // reply to System Manager about successful module termination
+ l_eStatus = FrameworkunifiedSendParent(hThread,
+ ePLThrdCmd_TERMINATE_MODULE_RESP,
+ sizeof(l_TerminateRespData),
+ &l_TerminateRespData);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendParent(ePLThrdCmd_TERMINATE_MODULE_RESP"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (eFrameworkunifiedStatusServNotFound == l_eStatus) { // Already terminated
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. Module already terminated.");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: PLTerminateModule(%s) errored: %d/'%s'",
+ l_TerminateRespData.name, l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdModuleStatus(HANDLE hThread) {
+ return eFrameworkunifiedStatusOK;
+}
+
+VOID buildArgList(StringList& arg_list, PSTR args) { // NOLINT
+ arg_list.clear();
+ char * pch = NULL;
+ pch = std::strtok(args, " ");
+ while (pch != NULL) {
+ arg_list.push_back(pch);
+ pch = std::strtok(NULL, " ");
+ }
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLLaunchModule(HANDLE hThread, T_ProcessLaunchResp &f_LaunchRespData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ Process *l_pProcessPtr = NULL;
+ T_ProcessLauncherLaunchReq l_ModuleLaunchReq;
+
+ // LCOV_EXCL_BR_START 4:NSFW error case
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg < T_ProcessLauncherLaunchReq > (hThread, l_ModuleLaunchReq))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4:NSFW error case
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Sending to Launcher name: %s, path: %s, args: %s, lmsk: %s, "
+ "prio: %d ", l_ModuleLaunchReq.name,
+ l_ModuleLaunchReq.path, l_ModuleLaunchReq.args,
+ l_ModuleLaunchReq.logging_mask, l_ModuleLaunchReq.priority);
+
+ StringList args;
+ buildArgList(args, l_ModuleLaunchReq.args); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ int log_mask_str_len = static_cast<int>(std::strlen(l_ModuleLaunchReq.logging_mask));
+ if (log_mask_str_len > 0) {
+ // Create mask argument to be passed to application.
+ // The argument must be of the form "-m 0x00000000,0x00000000,...", assuming n 32-bit mask values.
+ // The storage size of the argument must include one byte for the NULL termination character.
+ args.push_back("-m");
+ args.push_back(l_ModuleLaunchReq.logging_mask);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s args: logging_mask: %s",
+ l_ModuleLaunchReq.path, l_ModuleLaunchReq.logging_mask);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PROC_LAUNCH_INFO, __FUNCTION__,
+ " '%s' has no logging_mask specified. Using compile time defaults.",
+ l_ModuleLaunchReq.path);
+ }
+
+ std::strcpy(f_LaunchRespData.name, l_ModuleLaunchReq.name); // NOLINT Module queue name
+ std::strcpy(f_LaunchRespData.path, l_ModuleLaunchReq.path); // NOLINT Module path and file name
+ std::strcpy(f_LaunchRespData.args, l_ModuleLaunchReq.args); // NOLINT
+ f_LaunchRespData.moduleIterator = l_ModuleLaunchReq.moduleIterator;
+ f_LaunchRespData.groupIterator = l_ModuleLaunchReq.groupIterator;
+
+ // Process exists? If not, re-launch the process and create a new map entry.
+ l_pProcessPtr = m_mapOfProcesses[l_ModuleLaunchReq.path]; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (NULL == l_pProcessPtr) { // LCOV_EXCL_BR_LINE 200: l_pProcessPtr must not be null
+ FRAMEWORKUNIFIEDLOG(ZONE_PROC_LAUNCH_INFO, __FUNCTION__,
+ " '%s' is not in the module map. Creating new process.",
+ l_ModuleLaunchReq.name);
+
+ SS_String sPathAndFileName = l_ModuleLaunchReq.path; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_pProcessPtr = new (std::nothrow) Process(l_ModuleLaunchReq.cpu_assign); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (NULL == l_pProcessPtr) { // LCOV_EXCL_BR_LINE 11::new operation failed
+ // LCOV_EXCL_START 11::new operation failed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Process() returned NULL");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusThreadNotExist;
+ // LCOV_EXCL_STOP 11::new operation failed
+ }
+
+ const char* uname =
+ ('\0' == f_LaunchRespData.moduleIterator->unix_user_name[0]) ?
+ NULL : &f_LaunchRespData.moduleIterator->unix_user_name[0]; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_pProcessPtr->CreateProcess(sPathAndFileName, "", l_ModuleLaunchReq.priority, args, uname); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PROC_LAUNCH_INFO, __FUNCTION__,
+ " Process Name: %s Process File: %s Pid: %d Is Alive: %s\n",
+ l_pProcessPtr->GetProcessName().data(),
+ l_pProcessPtr->GetExecutableFileName(),
+ l_pProcessPtr->GetProcessId(),
+ (l_pProcessPtr->DoesProcessExist() == FALSE) ? "No" : "Yes");
+
+ // Add the process in the map
+ m_mapOfProcesses[l_ModuleLaunchReq.path] = l_pProcessPtr; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // launch response
+ f_LaunchRespData.pid = l_pProcessPtr->GetProcessId();
+ f_LaunchRespData.priority = l_pProcessPtr->GetPriority(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ // LCOV_EXCL_START 200: l_pProcessPtr must not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_PROC_LAUNCH_INFO, __FUNCTION__,
+ " %s already in Process Map", l_ModuleLaunchReq.name);
+ // the module is already in the list. Send the response to system manager with PID 0x7FFFFFFF
+ f_LaunchRespData.pid = 0x7FFFFFFF;
+ f_LaunchRespData.priority = l_ModuleLaunchReq.priority;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdLaunchModule(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = PLCmdLaunchModule(hThread, ePLThrdCmd_LAUNCH_MODULE_RESP, "ePLThrdCmd_LAUNCH_MODULE_RESP"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_IF_ERRORED(l_eStatus, " PLCmdLaunchModule(ePLThrdCmd_LAUNCH_MODULE_RESP)"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdRelaunchModule(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Terminate unresponsive module
+ CALL_AND_LOG_STATUS(PLTerminateModule(hThread)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = PLCmdLaunchModule(hThread, ePLThrdCmd_RELAUNCH_MODULE_RESP, "ePLThrdCmd_RELAUNCH_MODULE_RESP"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_IF_ERRORED(l_eStatus, "PLCmdLaunchModule(ePLThrdCmd_RELAUNCH_MODULE_RESP)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLCmdLaunchModule(HANDLE hThread, UI_32 f_protocol_ID, std::string f_protocol_str) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ T_ProcessLaunchResp l_LaunchRespData;
+ l_LaunchRespData.pid = 0;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = PLLaunchModule(hThread, l_LaunchRespData))) { // LCOV_EXCL_BR_LINE 4:NSFW error case
+ // LCOV_EXCL_START 4:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: PLLaunchModule(%s, %s) errored: %d/'%s'",
+ l_LaunchRespData.name, f_protocol_str.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4:NSFW error case
+ } else {
+ l_eStatus = FrameworkunifiedSendParent(hThread, f_protocol_ID,
+ sizeof(T_ProcessLaunchResp), &l_LaunchRespData);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4:NSFW error case
+ // LCOV_EXCL_START 4:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSendParent( %s, %s ) errored: %d/'%s'",
+ l_LaunchRespData.name, f_protocol_str.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4:NSFW
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdStop(HANDLE hThread) { // LCOV_EXCL_START 14: resident process end
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdStart(HANDLE hThread) {
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CProcessLauncher::PLOnCmdHeartbeatStatusReq(HANDLE hThread) {
+ FrameworkunifiedSendParent(hThread, ePLThrdCmd_THREAD_STATUS_RESP, 0, NULL);
+ return eFrameworkunifiedStatusOK;
+}
+
diff --git a/video_in_hal/systemservice/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp b/video_in_hal/systemservice/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp
new file mode 100755
index 0000000..3d9b2e9
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp
@@ -0,0 +1,126 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_framework_if.h>
+
+#include "ProcessLauncher.h"
+#include "ss_sm_process_launcher_protocol.h"
+#include "ss_sm_systemmanagerlog.h"
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus ProcessLauncherCallback(HANDLE hThread) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ C * pObj = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hThread));
+
+ if (pObj) { // LCOV_EXCL_BR_LINE 5:pObj must not be NULL
+ l_eStatus = (pObj->*M)(hThread);
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus ProcessLauncherOnStart(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ CProcessLauncher * pObj = new (std::nothrow) CProcessLauncher(NULL); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (pObj) { // LCOV_EXCL_BR_LINE 5:new error
+ // LCOV_EXCL_BR_START 200:l_eStatus always return eFrameworkunifiedStatusOK
+ if (eFrameworkunifiedStatusOK != (l_eStatus = pObj->PLOnCmdStart(hThread))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 200:l_eStatus always return eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: pObj->PLOnCmdStart(hThread) errored: %d/'%s'",
+ l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ FrameworkunifiedSetThreadSpecificData(hThread, pObj);
+
+ FrameworkunifiedProtocolCallbackHandler aParentHandlers[] = { {
+ ePLThrdCmd_LAUNCH_MODULE_REQST, ProcessLauncherCallback<
+ CProcessLauncher,
+ &CProcessLauncher::PLOnCmdLaunchModule> }, {
+ ePLThrdCmd_TERMINATE_MODULE_REQST, ProcessLauncherCallback<
+ CProcessLauncher,
+ &CProcessLauncher::PLOnCmdTerminateModule> }, {
+ ePLThrdCmd_RELAUNCH_MODULE_REQST, ProcessLauncherCallback<
+ CProcessLauncher,
+ &CProcessLauncher::PLOnCmdRelaunchModule> }, {
+ ePLThrdCmd_MODULE_STATUS_REQST, ProcessLauncherCallback<
+ CProcessLauncher,
+ &CProcessLauncher::PLOnCmdModuleStatus> }, {
+ ePLThrdCmd_THREAD_STATUS_REQST, ProcessLauncherCallback<
+ CProcessLauncher,
+ &CProcessLauncher::PLOnCmdHeartbeatStatusReq> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // LCOV_EXCL_BR_START 4:NSFW error case
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedAttachParentCallbacksToDispatcher(hThread, aParentHandlers,
+ static_cast<UI_32>(_countof(aParentHandlers))))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedAttachParentCallbacksToDispatcher() errored: %d/'%s'",
+ l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ // Add other Attaches here!!!
+ }
+ }
+ } else { // LCOV_EXCL_BR_LINE 5::new operation failed
+ // LCOV_EXCL_START 5:new error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: new CProcessLauncher( NULL ) returned NULL");
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+// LCOV_EXCL_START 200:Thread which registered in init_process_launcher() is never stoppped.
+EFrameworkunifiedStatus ProcessLauncherOnStop(HANDLE hThread) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ CProcessLauncher * pObj = static_cast<CProcessLauncher *>(FrameworkunifiedGetThreadSpecificData(hThread));
+
+ if (pObj) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = pObj->PLOnCmdStop(hThread))) {
+ LOG_ERROR("PLOnCmdStop()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ delete pObj;
+ pObj = NULL;
+ }
+
+ FrameworkunifiedSetThreadSpecificData(hThread, NULL);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedDetachServiceFromDispatcher(hThread, FrameworkunifiedGetAppName(hThread)))) {
+ LOG_ERROR("FrameworkunifiedDetachServiceFromDispatcher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
diff --git a/video_in_hal/systemservice/system_manager/server/src/ss_sm_config.cpp b/video_in_hal/systemservice/system_manager/server/src/ss_sm_config.cpp
new file mode 100755
index 0000000..2a8d11e
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/ss_sm_config.cpp
@@ -0,0 +1,1528 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <boost/algorithm/string.hpp>
+
+
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <other_service/ultoa.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_templates.h>
+#include <native_service/ns_config_parser_if.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <cctype>
+#include <string>
+#include <iomanip>
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <algorithm>
+#include <functional>
+#include <list>
+#include <vector>
+#include <utility>
+
+#include "ss_sm_config.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_launch_configuration.h"
+#include "system_launcher_cfg_format.h"
+#include "ss_sm_default_paths.h"
+
+using namespace std; // NOLINT
+
+// Constants for Heart Beat configuration data
+const UI_32 HBApplicationHeartBeatIntervalInitial = 40u; // Units of seconds. 0 = HB Disabled.
+const UI_32 HBApplicationHeartBeatIntervalRepeat = 5u; // Units of seconds. 0 = HB Disabled.
+const UI_32 HBMaxHeartBeatRetryCount = 3u;
+
+// Constants for Crash Detector configuration data
+const BOOL CDEnabled = TRUE;
+
+// Constants for system low memory configuration data
+
+const UI_32 SLMTimerValue = 5000; // msec
+const UI_32 SLMThresholdValue = (1024 * 512); // bytes
+const UI_32 SLMRetryCount = 6;
+const UI_32 SLMSystemmanagerLogIntervalMs = 30000;
+
+// Constants for Module connect time and Stat Resp Time
+
+const UI_32 ModuleConnectionNumTimesToCheck = 5;
+const UI_32 ModuleConnectionTimeOutSec = 5; // sec
+const UI_32 ModuleStartRespTimeOutSec = 120; // sec
+
+// Constants for Critical Apps Max wait timeout
+
+const UI_32 CriticalAppsMaxShutdownTimeFastSleepSec = 2; // sec
+const UI_32 CriticalAppsMaxShutdownTimeNormalResetSec = 15; // sec
+
+// Constants for User Mode data structure type
+const BOOL isBoolean = TRUE;
+
+const CHAR SMConfigDataHeader[] = "SystemManager";
+const CHAR HBConfigDataHeader[] = "HeartBeat";
+const CHAR CDConfigDataHeader[] = "CrashDetector";
+const CHAR SLMConfigDataHeader[] = "SysLowMemory";
+const CHAR UserModeConfigDataHeader[] = "UserMode";
+
+struct CfgLaunchParams {
+ CfgLaunchParams() :
+ group_id(0),
+ group_launch_wait(0),
+ group_wait_for_trigger(0),
+ priority(0),
+ critical(0),
+ retry_cnt(0),
+ is_start_required(0),
+ shutdown_critical(0),
+ shutdown_wait_time(0),
+ fast_shutdown_wait_time(0),
+ cpu_assign(0x0),
+ is_agl_unit(TRUE),
+ disable_agl_resethistory(FALSE),
+ disable_nonagl_resethistory(FALSE) {
+ std::memset(&group_name[0], 0, sizeof(group_name));
+ std::memset(&name[0], 0, sizeof(name));
+ std::memset(&binary_name[0], 0, sizeof(binary_name));
+ std::memset(&arguments[0], 0, sizeof(arguments));
+ std::memset(&logging_msk_str[0], 0, sizeof(logging_msk_str));
+ std::memset(&restart[0], 0, sizeof(restart));
+ std::memset(&unix_user_name[0], 0, sizeof(unix_user_name));
+ std::memset(&env_value_condition[0], 0, sizeof(env_value_condition));
+ }
+
+ CHAR group_name[100];
+ UI_32 group_id;
+ UI_32 group_launch_wait;
+ BOOL group_wait_for_trigger;
+ CHAR name[100];
+ CHAR binary_name[MAX_PATH_LENGTH];
+ UI_32 priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ CHAR arguments[512];
+ CHAR logging_msk_str[50];
+ CHAR restart[32];
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+ UI_32 fast_shutdown_wait_time;
+ TUserNameBuffer unix_user_name; // TODO(username): Stuff.: Does Posix define a useful
+ // constant representing max length of user id?
+ CHAR env_value_condition[256];
+ int cpu_assign;
+
+ public:
+ BOOL IsAGLUnit(void) const { return is_agl_unit; }
+ BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; }
+ BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; }
+ void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; }
+ void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) {
+ disable_agl_resethistory = f_disable_agl_resethistory;
+ }
+ void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) {
+ disable_nonagl_resethistory = f_disable_nonagl_resethistory;
+ }
+
+ private:
+ BOOL is_agl_unit;
+ BOOL disable_agl_resethistory;
+ BOOL disable_nonagl_resethistory;
+};
+
+namespace ss_sm_cfg {
+class cfg_args {
+ public:
+ enum { // typedef enum _tokens
+ group_name,
+ group_id,
+ group_launch_wait,
+ group_wait_for_trigger,
+ name,
+ binary_name,
+ priority,
+ critical,
+ retry_cnt,
+ arguments,
+ logging_msk,
+ restart,
+ is_start_required,
+ shutdown_critical,
+ shutdown_wait_time,
+ fast_shutdown_wait_time,
+ unix_user_name,
+ is_agl_unit,
+ disable_agl_resethistory,
+ disable_nonagl_resethistory,
+ env_value_condition,
+ cpu_assign,
+ END
+ };
+};
+}; // namespace ss_sm_cfg
+
+static void set_grp_member_info(const LaunchInfo& launch_info, ModuleLaunchList& module_lst); // NOLINT
+static void load_parameters_order_cfg(
+ GroupLaunchMap& groups_map, LaunchOrderedVector& f_OrderList, SS_String& f_launchOrderName, SS_String& f_launchCfgFn); // NOLINT
+
+/*******************************************************************************
+ * CTimeSpan class *
+ * *
+ * Set Initial time, reset Final and Delta to zero, return time *
+ * */
+UI_64 CTimeSpan::Begin() {
+ initial = GetTimeMilliseconds();
+ final = 0;
+ delta = 0;
+ return initial;
+} // End of UI_64 CTimeSpan::Begin()
+
+/*
+ * Set Final time, calculate Delta time, return time
+ */
+UI_64 CTimeSpan::End() {
+ final = GetTimeMilliseconds();
+ delta = (final > initial) ? (final - initial) : 0; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ return final;
+} // End of UI_64 CTimeSpan::End()
+
+UI_64 CTimeSpan::GetInitial(void) {
+ return initial;
+}
+
+UI_64 CTimeSpan::GetFinal() {
+ return final;
+}
+
+UI_64 CTimeSpan::GetDelta() {
+ return delta;
+}
+
+UI_64 CTimeSpan::GetTimeMilliseconds() {
+ UI_64 l_totalmsec = 0;
+ struct timespec timeSpec;
+
+ if (0 != clock_gettime(CLOCK_MONOTONIC, &timeSpec)) {
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_totalmsec = (timeSpec.tv_sec * 1000ULL)
+ + (timeSpec.tv_nsec / 1000000);
+ }
+
+ return l_totalmsec;
+}
+
+/* *
+ * End of CTimeSpan class *
+ ******************************************************************************/
+
+ModuleLaunchParams::ModuleLaunchParams():
+ name("")
+ , path("")
+ , arguments("")
+ , restart("")
+ , configuration_priority(0)
+ , cpu_assign(0x0)
+ , previous_priority(0)
+ , current_priority(0)
+ , critical(FALSE)
+ , retry_cnt(0)
+ , logging_msk_str("")
+ , is_start_required(FALSE)
+ , shutdown_critical(FALSE)
+ , shutdown_wait_time(0)
+ , fast_shutdown_wait_time(0)
+ , pid(0)
+ , hsession(NULL)
+ , relaunch_count(0)
+ , relaunch_status(NotRelaunched)
+ , group_id(0xFFFF)
+ , m_serviceAvailability(FALSE)
+ , m_startReason()
+ , m_stopReason()
+ , m_ModuleDebugDumpState(MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED)
+ , is_agl_unit(TRUE)
+ , disable_agl_resethistory(FALSE)
+ , disable_nonagl_resethistory(FALSE) { // LCOV_EXCL_BR_START 11:Gcov constraints (because exception-handling routes are automatically generated)
+ SetModuleState(MODULE_STATE_INVALID, FALSE);
+ //
+ // Module State strings
+ m_ModuleStateStrMap[MODULE_STATE_INVALID] = "INVALID";
+ m_ModuleStateStrMap[MODULE_STATE_SKIPPED] = "SKIPPED";
+ m_ModuleStateStrMap[MODULE_STATE_LAUNCHING] = "LAUNCHING";
+ m_ModuleStateStrMap[MODULE_STATE_LAUNCHED] = "LAUNCHED";
+ m_ModuleStateStrMap[MODULE_STATE_LAUNCH_FAILED] = "LAUNCH_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_CONNECTED] = "CONNECTED";
+ m_ModuleStateStrMap[MODULE_STATE_START_SENT] = "START_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_START_FAILED] = "START_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STARTED] = "STARTED";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_FAILED] = "STOP_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_SENT] = "STOP_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_STOPPED] = "STOPPED";
+ m_ModuleStateStrMap[MODULE_STATE_START_PRE_SENT] = "PRE_START_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_START_PRE_FAILED] = "PRE_START_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STARTED_PRE] = "PRE_STARTED";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_PRE_SENT] = "PRE_STOP_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_PRE_FAILED] = "PRE_STOP_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STOPPED_PRE] = "PRE_STOPPED";
+ m_ModuleStateStrMap[MODULE_STATE_START_BACKGROUND_SENT] = "BACKGROUND_START_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_START_BACKGROUND_FAILED] = "BACKGROUND_START_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STARTED_BACKGROUND] = "BACKGROUND_STARTED";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_BACKGROUND_SENT] = "BACKGROUND_STOP_SENT";
+ m_ModuleStateStrMap[MODULE_STATE_STOP_BACKGROUND_FAILED] = "BACKGROUND_STOP_FAIL";
+ m_ModuleStateStrMap[MODULE_STATE_STOPPED_BACKGROUND] = "BACKGROUND_STOPPED";
+ // LCOV_EXCL_BR_STOP
+
+ m_startReason.SetReason(NotStarted);
+ m_stopReason.SetReason(NotStopped);
+
+ MAP_ENTRY(m_ModuleDebugDumpStateStrMap, MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ MAP_ENTRY(m_ModuleDebugDumpStateStrMap, MODULE_DEBUG_DUMP_STATE_REQUEST_SENT); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ MAP_ENTRY(m_ModuleDebugDumpStateStrMap, MODULE_DEBUG_DUMP_STATE_RESPONSE_RECEIVED); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ std::memset(&unix_user_name[0], 0, sizeof(unix_user_name));
+} // End of ModuleLaunchParams::ModuleLaunchParams() :
+
+ModuleLaunchParams::~ModuleLaunchParams() {
+} // End of ModuleLaunchParams::~ModuleLaunchParams() :
+
+SMModuleState ModuleLaunchParams::GetModuleState(void) {
+ return m_moduleState;
+} // End of SMModuleState ModuleLaunchParams::GetModuleState(void)
+
+BOOL ModuleLaunchParams::IsModuleState(SMModuleState f_moduleState) {
+ return m_moduleState == f_moduleState;
+} // End of BOOL ModuleLaunchParams::IsModuleState(SMModuleState f_moduleState )
+
+// IsModuleConnected
+// Determine if a module is in a state capable of receiving messages from System Manager.
+BOOL ModuleLaunchParams::IsModuleConnected() const {
+ BOOL l_isModuleConnected = FALSE;
+
+ switch (m_moduleState) {
+ case MODULE_STATE_CONNECTED:
+ case MODULE_STATE_START_SENT:
+ case MODULE_STATE_START_FAILED:
+ case MODULE_STATE_STARTED:
+ case MODULE_STATE_STOP_SENT:
+ case MODULE_STATE_STOP_FAILED:
+ case MODULE_STATE_STOPPED:
+ case MODULE_STATE_START_PRE_SENT:
+ case MODULE_STATE_START_PRE_FAILED:
+ case MODULE_STATE_STARTED_PRE:
+ case MODULE_STATE_STOP_PRE_SENT:
+ case MODULE_STATE_STOP_PRE_FAILED:
+ case MODULE_STATE_STOPPED_PRE:
+ case MODULE_STATE_START_BACKGROUND_SENT:
+ case MODULE_STATE_START_BACKGROUND_FAILED:
+ case MODULE_STATE_STARTED_BACKGROUND:
+ case MODULE_STATE_STOP_BACKGROUND_SENT:
+ case MODULE_STATE_STOP_BACKGROUND_FAILED:
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ l_isModuleConnected = TRUE;
+ break;
+
+ default:
+ l_isModuleConnected = FALSE;
+ break;
+ }
+
+ return (l_isModuleConnected);
+} // End of BOOL ModuleLaunchParams::IsModuleConnected(void)
+
+VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState, BOOL f_bLog) {
+ m_moduleState = f_moduleState;
+
+ switch (m_moduleState) { // Because the module status cannot be changed from the external API
+ case MODULE_STATE_INVALID:
+ case MODULE_STATE_SKIPPED:
+ case MODULE_STATE_LAUNCH_FAILED:
+ case MODULE_STATE_LAUNCHING:
+ case MODULE_STATE_LAUNCHED:
+ case MODULE_STATE_CONNECTED:
+ break;
+ case MODULE_STATE_START_SENT:
+ m_startReason.Begin();
+ break;
+ case MODULE_STATE_START_FAILED:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModuleStartFail);
+ break;
+ case MODULE_STATE_STARTED:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModuleStartComplete);
+ break;
+
+ case MODULE_STATE_STOP_SENT:
+ m_stopReason.Begin();
+ break;
+
+ case MODULE_STATE_STOP_FAILED:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModuleStopFail);
+ break;
+ case MODULE_STATE_STOPPED:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModuleStopComplete);
+ break;
+
+ case MODULE_STATE_START_PRE_SENT:
+ m_startReason.Begin();
+ break;
+ case MODULE_STATE_START_PRE_FAILED:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModulePreStartFail);
+ break;
+ case MODULE_STATE_STARTED_PRE:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModulePreStartComplete);
+ break;
+ case MODULE_STATE_STOP_PRE_SENT:
+ m_stopReason.Begin();
+ break;
+ case MODULE_STATE_STOP_PRE_FAILED:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModulePreStopFail);
+ break;
+ case MODULE_STATE_STOPPED_PRE:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModulePreStopComplete);
+ break;
+
+ case MODULE_STATE_START_BACKGROUND_SENT:
+ m_startReason.Begin();
+ break;
+ case MODULE_STATE_START_BACKGROUND_FAILED:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModuleBackgroundStartFail);
+ break;
+ case MODULE_STATE_STARTED_BACKGROUND:
+ m_startReason.End();
+ m_startReason.SetReason(StartedByModuleBackgroundStartComplete);
+ break;
+ case MODULE_STATE_STOP_BACKGROUND_SENT:
+ m_stopReason.Begin();
+ break;
+ case MODULE_STATE_STOP_BACKGROUND_FAILED:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModuleBackgroundStopFail);
+ break;
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ m_stopReason.End();
+ m_stopReason.SetReason(StoppedByModuleBackgroundStopComplete);
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ }
+
+ if (f_bLog) {
+ char buf[255];
+ char *p = buf;
+ strcpy(p, m_ModuleStateStrMap[m_moduleState].c_str()); // NOLINT
+ p += m_ModuleStateStrMap[m_moduleState].size();
+ strcpy(p, ":"); // NOLINT
+ p += sizeof(":") - 1;
+ strcpy(p, name.c_str()); // NOLINT
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, buf);
+ }
+} // End of VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState )
+
+std::string ModuleLaunchParams::ModuleStateStr(void) {
+ return m_ModuleStateStrMap[m_moduleState];
+} // End of std::string ModuleLaunchParams::ModuleStateStr(SMModuleState f_moduleState )
+
+SMModuleDebugDumpState ModuleLaunchParams::GetModuleDebugDumpState(void) { // LCOV_EXCL_START 6: Because the condition cannot be set // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_ModuleDebugDumpState;
+} // End of SMModuleDebugDumpState ModuleLaunchParams::GetModuleDebugDumpState(void)
+// LCOV_EXCL_STOP
+
+std::string ModuleLaunchParams::GetModuleDebugDumpStateStr(void) {
+ return m_ModuleDebugDumpStateStrMap[m_ModuleDebugDumpState];
+} // End of std::string ModuleLaunchParams::GetModuleDebugDumpStateStr()
+
+VOID ModuleLaunchParams::SetModuleDebugDumpState(
+ SMModuleDebugDumpState f_moduleDebugDumpState, BOOL f_bLog) {
+ m_ModuleDebugDumpState = f_moduleDebugDumpState;
+
+ if (f_bLog) { // LCOV_EXCL_BR_LINE 200:f_bLog must be TRUE
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s set for %s",
+ GetModuleDebugDumpStateStr().c_str(), name.c_str());
+ }
+} // End of VOID ModuleLaunchParams::SetModuleDebugDumpState(SMModuleDebugDumpState f_moduleDebugDumpState )
+
+EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(
+ const UI_32 f_iCmd, const T_SS_SM_START_DataStructType* const f_startData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ char l_cBuf[500] = " Error: char l_cBuf[] not built";
+ T_SS_SM_START_DataStructType l_startData;
+ SMModuleState l_SendSuccess = MODULE_STATE_START_SENT;
+ SMModuleState l_SendFailed = MODULE_STATE_START_FAILED;
+
+ memcpy(&l_startData, f_startData, sizeof(T_SS_SM_START_DataStructType));
+
+ switch (relaunch_status) { // LCOV_EXCL_BR_LINE 6: Because all conditions cannot be satisfied from the external API
+ case NotRelaunched:
+ // Setting startup information at the first startup
+ break;
+ case RelaunchSafe: // LCOV_EXCL_START 6: Because all conditions cannot be satisfied from the external API
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_startData.resetStatus = e_SS_SM_RESET_STATUS_NONE;
+ break;
+ case RelaunchErr:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_startData.resetStatus = e_SS_SM_RESET_STATUS_NG;
+ break;
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0);
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ switch (f_iCmd) {
+ case SS_SM_PRE_START:
+ l_SendSuccess = MODULE_STATE_START_PRE_SENT;
+ l_SendFailed = MODULE_STATE_START_PRE_FAILED;
+ break;
+ case SS_SM_PRE_STOP:
+ l_SendSuccess = MODULE_STATE_STOP_PRE_SENT;
+ l_SendFailed = MODULE_STATE_STOP_PRE_FAILED;
+ break;
+ case SS_SM_BACKGROUND_START:
+ l_SendSuccess = MODULE_STATE_START_BACKGROUND_SENT;
+ l_SendFailed = MODULE_STATE_START_BACKGROUND_FAILED;
+ break;
+ case SS_SM_BACKGROUND_STOP:
+ l_SendSuccess = MODULE_STATE_STOP_BACKGROUND_SENT;
+ l_SendFailed = MODULE_STATE_STOP_BACKGROUND_FAILED;
+ break;
+ case SS_SM_START:
+ default:
+ l_SendSuccess = MODULE_STATE_START_SENT;
+ l_SendFailed = MODULE_STATE_START_FAILED;
+ break;
+ }
+
+ const EFrameworkunifiedStatus l_eStatus = FrameworkunifiedSendMsg(hsession, f_iCmd,
+ sizeof(T_SS_SM_START_DataStructType),
+ static_cast<PCVOID>(&l_startData));
+
+ // LCOV_EXCL_START 6: As no TRUE is returned
+ if (IS_ZONE_SET(ZONE_ERR) || IS_ZONE_SET(ZONE_INFO)) {
+
+ snprintf(l_cBuf, sizeof(l_cBuf), "FrameworkunifiedSendMsg(%s, system_manager protocol message, %d/%s)",
+ name.c_str(), l_startData.startupReason,
+ GetStr(l_startData.startupReason).c_str());
+ }
+ // LCOV_EXCL_STOP 6:As no TRUE is returned
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4:NSFW's error
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ SetModuleState(l_SendFailed);
+ // LCOV_EXCL_STOP
+ } else {
+ LOG_SUCCESS(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ SetModuleState(l_SendSuccess);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// End of EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(T_SS_SM_START_DataStructType const * f_startData)
+
+EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(
+ T_SS_SM_STOP_DataStructType const* f_stopData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ char l_cBuf[500] = " Error: char l_cBuf[] not built";
+ EFrameworkunifiedStatus l_eStatus = FrameworkunifiedSendMsg(hsession, SS_SM_STOP,
+ sizeof(T_SS_SM_STOP_DataStructType),
+ static_cast<PCVOID>(f_stopData));
+
+ if (IS_ZONE_SET(ZONE_ERR) || IS_ZONE_SET(ZONE_INFO)) { // LCOV_EXCL_BR_LINE 200:alwasy true
+ snprintf(l_cBuf, sizeof(l_cBuf), "FrameworkunifiedSendMsg(%s, SS_SM_STOP, %d/%s, "
+ "Last User Mode: %s)", name.c_str(),
+ f_stopData->shutdownTrigger,
+ GetStr(f_stopData->shutdownTrigger).c_str(),
+ GetStr(f_stopData->lastUserMode).c_str());
+ }
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4:NSFW's error
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ SetModuleState(MODULE_STATE_STOP_FAILED);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s successful", l_cBuf);
+ SetModuleState(MODULE_STATE_STOP_SENT);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// End of EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(T_SS_SM_STOP_DataStructType const * f_stopData)
+
+EFrameworkunifiedStatus ModuleLaunchParams::GetPriority(UI_32& f_Priority) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ struct sched_param cur_sch_params;
+ errno = 0;
+ f_Priority = 0xDEAD;
+
+ if (0 == pid) { // LCOV_EXCL_BR_LINE 200: pid can not be 0
+ // LCOV_EXCL_START 200: pid can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("0 == pid"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (-1 >= sched_getparam(pid, &cur_sch_params)) { // LCOV_EXCL_BR_LINE 5: system function failed
+ // LCOV_EXCL_START 5: system function failed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFault;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: 'sched_getparam( pid %d, &cur_sch_params )' returned -1, "
+ "strerr() is '%s'", pid, strerror(errno));
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = eFrameworkunifiedStatusOK;
+ f_Priority = cur_sch_params.sched_priority;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus ModuleLaunchParams::GetPriority (UI_32 & f_Priority )
+
+EFrameworkunifiedStatus ModuleLaunchParams::SetPriority(UI_32 f_Priority) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ errno = 0;
+
+ if (99 < f_Priority) { // LCOV_EXCL_BR_LINE 200: priority can not greater than 99
+ // LCOV_EXCL_START 200: priority can not greater than 99
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Invalid 'f_Priority' %d/0x%X",
+ f_Priority, f_Priority);
+ // LCOV_EXCL_STOP
+ } else if (0 == pid) { // LCOV_EXCL_BR_LINE 200: pid can not be 0
+ // LCOV_EXCL_START 200: pid can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("0 == pid"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ int rc;
+ struct sched_param l_schedParam = { };
+ l_schedParam.sched_priority = f_Priority;
+
+ if (f_Priority == 0) { // LCOV_EXCL_BR_LINE 200: f_Priority can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rc = sched_setscheduler(pid, SCHED_OTHER, &l_schedParam); // LCOV_EXCL_LINE 200: f_Priority can not be 0
+ } else {
+ rc = sched_setscheduler(pid, SCHED_FIFO, &l_schedParam);
+ }
+ SS_ASERT_ERRNO(0 == rc); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ if (rc == 0) {
+ previous_priority = current_priority;
+ current_priority = f_Priority;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " setprio( %s, pid %d, 'previous_priority' %d -> %d ) successful",
+ name.c_str(), pid, previous_priority, f_Priority);
+ } else if (rc == -1) { // LCOV_EXCL_BR_LINE 5: system function failed
+ // LCOV_EXCL_START 5: system function failed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFault;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " setprio( %s, pid %d, 'current_priority' %d -> %d ) returned '-1', strerr() is '%s'",
+ name.c_str(), pid, current_priority, f_Priority,
+ strerror(errno));
+ // LCOV_EXCL_STOP
+ } else { // LCOV_EXCL_BR_LINE 5: can not be other value
+ // LCOV_EXCL_START 5: can not be other value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFault;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " setprio( %s, pid %d, 'current_priority' %d -> %d ) returned '%d'; "
+ "'rc' is neither original priority nor '-1': 'errno' is '%d', strerr() is '%s'",
+ name.c_str(), pid, current_priority, f_Priority, rc,
+ errno, strerror(errno));
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus ModuleLaunchParams::SetPriority( UI_32 f_Priority )
+
+SysMgrConfiguration::SysMgrConfiguration():
+l_pReaderCfg(NULL) {
+}
+
+SysMgrConfiguration::~SysMgrConfiguration() {
+}
+
+static BOOL is_satisfy_env_launch_cond(CHAR *env_cond) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL l_isSatisfy = FALSE;
+ BOOL l_isReverse = FALSE;
+ CHAR *l_pString = NULL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "env_cond [%s]", env_cond);
+
+ if (NULL != (l_pString = strstr(env_cond, "!="))) {
+ l_isReverse = TRUE;
+ } else if (NULL == (l_pString = strstr(env_cond, "=="))) {
+ SS_ASERT(0);
+ }
+
+ if (NULL != l_pString) {
+ CHAR *l_pEnv = env_cond;
+ CHAR *l_pValue = l_pString + 2;
+ *l_pString = '\0';
+
+ CHAR *l_pEnvVariable = NULL;
+
+ if (NULL != (l_pEnvVariable = std::getenv(l_pEnv))) {
+ l_isSatisfy = (0 == strcmp(l_pValue, l_pEnvVariable)) ? TRUE : FALSE;
+ if (l_isReverse) {
+ l_isSatisfy = !l_isSatisfy;
+ }
+ }
+ }
+
+ return l_isSatisfy;
+}
+
+static void set_grp_member_info(const LaunchInfo& launch_info, ModuleLaunchList& module_lst) { // NOLINT
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // Note: the
+ ModuleLaunchParams grp_member_info;
+ grp_member_info.name = launch_info.name;
+ grp_member_info.path = launch_info.binary_name;
+ grp_member_info.arguments = launch_info.arguments;
+ grp_member_info.restart = launch_info.restart;
+ grp_member_info.configuration_priority = launch_info.priority;
+ grp_member_info.retry_cnt = launch_info.retry_cnt;
+ grp_member_info.logging_msk_str = launch_info.logging_msk_str;
+ grp_member_info.critical = launch_info.critical;
+ grp_member_info.shutdown_critical = launch_info.shutdown_critical;
+ grp_member_info.shutdown_wait_time = launch_info.shutdown_wait_time;
+ grp_member_info.group_id = launch_info.group_id;
+ grp_member_info.is_start_required = launch_info.is_start_required;
+ grp_member_info.fast_shutdown_wait_time = launch_info.fast_shutdown_wait_time;
+ grp_member_info.SetAGLUnit(launch_info.IsAGLUnit());
+ grp_member_info.SetAGLResetHistoryDisable(launch_info.IsAGLResetHistoryDisable());
+ grp_member_info.SetNonAGLResetHisoryDisable(launch_info.IsNonAGLResetHistoryDisable());
+
+ module_lst.push_back(grp_member_info);
+}
+// LCOV_EXCL_STOP
+
+static ModuleLaunchListIter set_cfg_grp_member_info(
+ const CfgLaunchParams& launch_info, ModuleLaunchList& module_lst) { // NOLINT
+ ModuleLaunchParams grp_member_info;
+ ModuleLaunchListIter moduleLaunchListIter;
+
+ grp_member_info.name = launch_info.name;
+ grp_member_info.path = launch_info.binary_name;
+ grp_member_info.arguments = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::strcmp(launch_info.arguments, "NULL") == 0 ? "" : launch_info.arguments);
+ grp_member_info.restart = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::strcmp(launch_info.restart, "NULL") == 0 ? "" : launch_info.restart);
+ grp_member_info.configuration_priority = launch_info.priority;
+ grp_member_info.cpu_assign = launch_info.cpu_assign;
+ grp_member_info.retry_cnt = launch_info.retry_cnt;
+ grp_member_info.logging_msk_str = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::strcmp(launch_info.logging_msk_str, "NULL") == 0 ? "" : launch_info.logging_msk_str);
+
+ grp_member_info.critical = launch_info.critical;
+ grp_member_info.shutdown_critical = launch_info.shutdown_critical;
+ grp_member_info.shutdown_wait_time = launch_info.shutdown_wait_time;
+ grp_member_info.group_id = launch_info.group_id;
+ grp_member_info.is_start_required = launch_info.is_start_required;
+ grp_member_info.fast_shutdown_wait_time = launch_info.fast_shutdown_wait_time;
+ grp_member_info.SetAGLUnit(launch_info.IsAGLUnit());
+ grp_member_info.SetAGLResetHistoryDisable(launch_info.IsAGLResetHistoryDisable());
+ grp_member_info.SetNonAGLResetHisoryDisable(launch_info.IsNonAGLResetHistoryDisable());
+
+ strncpy(&grp_member_info.unix_user_name[0], &launch_info.unix_user_name[0],
+ sizeof(TUserNameBuffer));
+
+ moduleLaunchListIter = module_lst.insert(module_lst.end(), grp_member_info);
+ return (moduleLaunchListIter);
+}
+
+static void load_parameters_order_cfg(GroupLaunchMap& groups_map, // NOLINT
+ LaunchOrderedVector& f_OrderList, SS_String& f_launchOrderName, // NOLINT
+ SS_String& f_launchCfgFn) { // NOLINT
+ SS_String l_OrderCfgFn = f_launchCfgFn;
+ string::size_type pos = l_OrderCfgFn.find(".cfg");
+
+ if (pos == string::npos) { // LCOV_EXCL_BR_LINE 5:C error
+ // LCOV_EXCL_START 5:C error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "invalid file name:%s",
+ f_launchCfgFn.c_str());
+ return;
+ // LCOV_EXCL_STOP
+ }
+
+ l_OrderCfgFn.replace(pos, strlen(".order.cfg"), ".order.cfg");
+ CNSConfigReader *l_pReaderOrderCfg = new CNSConfigReader(l_OrderCfgFn);
+
+ if (l_pReaderOrderCfg != NULL) { // LCOV_EXCL_BR_LINE 5:new error
+ CHAR key[128];
+ std::sprintf(key, "%s.order", f_launchOrderName.c_str()); // NOLINT
+ SS_String value = l_pReaderOrderCfg->GetString(key);
+ std::vector<std::string> strList;
+ if (value.empty()) { // LCOV_EXCL_BR_LINE 200:cannot be empty
+ goto ERROR;
+ }
+// LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ boost::split(strList, value, boost::is_any_of("|"));
+ for (UI_32 i = 0; i < strList.size(); i++) {
+ char* endptr = NULL;
+ f_OrderList.push_back(
+ static_cast<UI_32>(strtoul(strList[i].c_str(), &endptr, 10)));
+ if (*endptr != '\0') {
+ // Discard boot order if invalid string is detected
+ f_OrderList.clear();
+ goto ERROR;
+ }
+ }
+ std::sprintf(key, "%s.owlist", f_launchOrderName.c_str()); // NOLINT
+ SS_String ow_list_value = l_pReaderOrderCfg->GetString(key);
+ std::vector<std::string> owList;
+
+ if (!ow_list_value.empty()) {
+ boost::split(owList, ow_list_value, boost::is_any_of("|"));
+ for (UI_32 i = 0; i < owList.size(); i++) {
+ std::sprintf(key, "%s.%s", f_launchOrderName.c_str(), // NOLINT
+ owList[i].c_str());
+ SS_String grop_ow_time = l_pReaderOrderCfg->GetString(key);
+ if (owList[i].compare(0, 4, "oww_") == 0) {
+ char* endptr = NULL;
+ SS_String group_name = owList[i].substr(strlen("oww_"));
+ UI_32 group_launch_wait = static_cast<UI_32>(strtoul(
+ grop_ow_time.c_str(), &endptr, 10));
+ if (*endptr != '\0') {
+ continue;
+ }
+ GroupLaunchMapIter grp_iter = groups_map.begin();
+ while (grp_iter != groups_map.end()) {
+ if (group_name == grp_iter->second.name) {
+ grp_iter->second.grp_launch_wait = group_launch_wait;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
+ "grp_launch_wait %s=%d", group_name.c_str(),
+ group_launch_wait);
+ break;
+ }
+ grp_iter++;
+ }
+ }
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "ConfigReader(%s) is NULL",
+ l_OrderCfgFn.c_str());
+ }
+// LCOV_EXCL_STOP
+ ERROR: if (l_pReaderOrderCfg != NULL) { // LCOV_EXCL_BR_LINE 200:cannot be null
+ delete l_pReaderOrderCfg; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ return;
+}
+
+// Given a string, splits it up on the seperator character
+// SubStringIterator( "a|b|| c |", '|' )
+// -> On each subsequent invocation of next() would return "a", "b", "", " c ", ""
+class SubStringIterator {
+ typedef std::string::const_iterator SCIter;
+
+ public:
+ SubStringIterator(const std::string& s, char c) :
+ m_position(s.begin()), m_end(s.end()), m_seperator(c), m_done(false) {
+ }
+
+ std::string next() {
+ SCIter begin = m_position;
+ while (m_position != m_end &&
+ *m_position != m_seperator) {
+ ++m_position;
+ }
+
+ const std::string ret(begin, m_position);
+ if (m_position == m_end) {
+ m_done = true;
+ } else {
+ ++m_position;
+ }
+
+ return ret;
+ }
+ bool done() const {
+ return m_done;
+ }
+
+ private:
+ SCIter m_position;
+ const SCIter m_end;
+ const char m_seperator;
+ bool m_done;
+};
+
+template<class Iter>
+static
+Iter skipPrecedingWS(Iter begin, Iter end) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return std::find_if(begin, end,
+ std::not1(std::ptr_fun((int (*)(int))std::isspace)));
+}
+
+// remove only preceding and trailing whitespace, but leave intermediate whitespace characters alone
+std::string strip(const std::string& str) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::string::const_iterator skipTo = skipPrecedingWS(str.begin(), str.end());
+ if (skipTo == str.end()) { // if string consists of ONLY whitespace
+ return std::string("");
+ } else {
+ return std::string(skipTo, skipPrecedingWS(str.rbegin(), str.rend()).base());
+ }
+}
+// LCOV_EXCL_STOP
+
+BOOL SysMgrConfiguration::LoadParametersCfg(GroupLaunchMap& groups_map,
+ ProcessNameMap& f_processNameMap, LaunchOrderedVector& f_OrderList,
+ SS_String& f_launchOrderName, SS_String& f_launchCfgFn) {
+ BOOL rtn_code = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_pReaderCfg = new (std::nothrow) CNSConfigReader(f_launchCfgFn); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (NULL != l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5:new error
+ UI_32 launch_idx = 1;
+ CHAR key[128];
+ std::sprintf(key, "ModulesLaunchConfig.Launch%d", launch_idx); // NOLINT
+ SS_String value = l_pReaderCfg->GetString(key);
+
+ if (value.empty()) { // LCOV_EXCL_BR_LINE 200:cannot be empty
+// LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: l_pReaderCfg->GetString(%s) returned empty-string; "
+ "is launch configuration file mis-configured ?",
+ key);
+ rtn_code = FALSE;
+// LCOV_EXCL_STOP
+ } else {
+ const char* nfsenv = getenv("AGL_NFS");
+ bool isNfs = (nfsenv && strcmp(nfsenv, "y") == 0) ? true : false; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ std::list<std::string> capFiles;
+ if (isNfs) {
+// LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const std::string capPath("/usr/debug/share/target/cap.lst");
+ std::ifstream fin(capPath.c_str());
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ std::list<std::string> strList;
+ boost::split(strList, line, boost::is_any_of("|"));
+ if (!strList.empty()) {
+ if (strList.front()[0] == '/') { // Only character strings beginning with '/' are considered PATH
+ capFiles.push_back(strList.front().c_str());
+ }
+ }
+ }
+ }
+// LCOV_EXCL_STOP
+ while (!value.empty()) {
+ CHAR critical[10] = { };
+ CHAR is_start_required[10] = { };
+ CHAR shutdown_critical[10] = { };
+ CHAR group_wait_for_trigger[10] = { };
+ CHAR is_agl_unit[10] = { };
+ CHAR disable_agl_resethistory[10] = { };
+ CHAR disable_nonagl_resethistory[10] = { };
+ CfgLaunchParams cfg_data;
+
+ int at = static_cast<int>(ss_sm_cfg::cfg_args::group_name);
+
+ SubStringIterator iter(value, '|');
+ while (!iter.done() && ss_sm_cfg::cfg_args::END != at) {
+ const std::string data_ = iter.next();
+ if (!data_.empty()) {
+ const char* data = data_.c_str();
+ switch (at) {
+ case ss_sm_cfg::cfg_args::group_name:
+ snprintf(cfg_data.group_name,
+ sizeof(cfg_data.group_name), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::group_id:
+ cfg_data.group_id = static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::group_launch_wait:
+ cfg_data.group_launch_wait =
+ static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::group_wait_for_trigger:
+ snprintf(group_wait_for_trigger,
+ sizeof(group_wait_for_trigger), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::name:
+ snprintf(cfg_data.name, sizeof(cfg_data.name), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::binary_name:
+ snprintf(cfg_data.binary_name,
+ sizeof(cfg_data.binary_name), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::priority:
+ cfg_data.priority = static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::critical:
+ snprintf(critical, sizeof(critical), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::retry_cnt:
+ cfg_data.retry_cnt = static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::arguments:
+ strncpy(cfg_data.arguments, data,
+ sizeof(cfg_data.arguments) - 1);
+ break;
+ case ss_sm_cfg::cfg_args::logging_msk:
+ snprintf(cfg_data.logging_msk_str,
+ sizeof(cfg_data.logging_msk_str), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::restart:
+ snprintf(cfg_data.restart, sizeof(cfg_data.restart), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::is_start_required:
+ snprintf(is_start_required,
+ sizeof(is_start_required), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::shutdown_critical:
+ snprintf(shutdown_critical,
+ sizeof(shutdown_critical), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::shutdown_wait_time:
+ cfg_data.shutdown_wait_time =
+ static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::fast_shutdown_wait_time:
+ cfg_data.fast_shutdown_wait_time =
+ static_cast<UI_32>(strtoul(data, NULL, 10));
+ break;
+ case ss_sm_cfg::cfg_args::unix_user_name:
+ strncpy(&cfg_data.unix_user_name[0],
+ strip(data_).c_str(),
+ sizeof(cfg_data.unix_user_name) - 1);
+ break;
+ case ss_sm_cfg::cfg_args::is_agl_unit:
+ strncpy(is_agl_unit, data, sizeof(is_agl_unit));
+ break;
+ case ss_sm_cfg::cfg_args::disable_agl_resethistory:
+ strncpy(disable_agl_resethistory, data, sizeof(disable_agl_resethistory));
+ break;
+ case ss_sm_cfg::cfg_args::disable_nonagl_resethistory:
+ strncpy(disable_nonagl_resethistory, data, sizeof(disable_nonagl_resethistory));
+ break;
+ case ss_sm_cfg::cfg_args::env_value_condition: // LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ snprintf(cfg_data.env_value_condition,
+ sizeof(cfg_data.env_value_condition), "%s", data);
+ break;
+ case ss_sm_cfg::cfg_args::cpu_assign:
+ cfg_data.cpu_assign =
+ static_cast<int>(strtoul(data, NULL, 16));
+ break;
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: unknown ss_sm_cfg::cfg_args::xxx/'at' "
+ "enum value '%d'", at);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+ ++at;
+ }
+ ////////////////////////////////////////////////////////////////////////////////
+// LCOV_EXCL_BR_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ if (0 != std::strlen(cfg_data.env_value_condition)
+ && FALSE
+ == is_satisfy_env_launch_cond(
+// LCOV_EXCL_BR_STOP
+ cfg_data.env_value_condition)) { // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "exclude %s from wakeup service", cfg_data.name);
+ } else {
+ if (isNfs) { // LCOV_EXCL_BR_LINE 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ // Since the NFS environment is used by copying the executable file containing the CAP to /tmp, it is read out.
+// LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::string binPath(cfg_data.binary_name);
+ for (std::list<std::string>::iterator ite =
+ capFiles.begin(); ite != capFiles.end(); ite++) {
+ if (binPath == *ite) {
+ std::list<std::string> nodes;
+ boost::split(nodes, binPath, boost::is_any_of("/"));
+ std::string newPath("/tmp/");
+ newPath += nodes.back();
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "EXCHG %s", newPath.c_str());
+ snprintf(cfg_data.binary_name,
+ sizeof(cfg_data.binary_name), "%s", newPath.c_str());
+ break;
+ }
+ }
+ }
+// LCOV_EXCL_STOP
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "is_start_required: %s", is_start_required);
+ cfg_data.is_start_required = (std::strcmp("True",
+ is_start_required) == 0);
+
+ if (std::strcmp("True", group_wait_for_trigger) == 0) {
+ cfg_data.group_wait_for_trigger = TRUE;
+ } else {
+ cfg_data.group_wait_for_trigger = FALSE;
+ }
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "critical: %s", critical);
+ cfg_data.critical = (std::strcmp("True", critical) == 0);
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown_critical: %s", shutdown_critical);
+ cfg_data.shutdown_critical = (std::strcmp("True",
+ shutdown_critical) == 0);
+
+ cfg_data.SetAGLUnit(ParseBoolParameter(is_agl_unit, TRUE));
+ cfg_data.SetAGLResetHistoryDisable(ParseBoolParameter(disable_agl_resethistory));
+ cfg_data.SetNonAGLResetHisoryDisable(ParseBoolParameter(disable_nonagl_resethistory));
+
+ GroupLaunchInfo grp_info;
+ grp_info.start_complete = FALSE;
+ grp_info.stop_complete = FALSE;
+ grp_info.launch_complete = FALSE;
+ grp_info.name = cfg_data.group_name;
+ grp_info.id = cfg_data.group_id;
+ grp_info.grp_launch_wait = cfg_data.group_launch_wait;
+ grp_info.grp_wait_for_trigger =
+ cfg_data.group_wait_for_trigger;
+ ModuleLaunchListIter l_moduleLaunchListIter;
+
+ GroupLaunchMapIter grp_iter = groups_map.find(grp_info.id);
+ if (grp_iter != groups_map.end()) {
+ l_moduleLaunchListIter = set_cfg_grp_member_info(
+ cfg_data, grp_iter->second.modules);
+ } else {
+ l_moduleLaunchListIter = set_cfg_grp_member_info(
+ cfg_data, grp_info.modules);
+
+ // add this grp info object to the list of grps
+ groups_map.insert(make_pair(grp_info.id, grp_info));
+ }
+
+ std::string l_binaryNameStr = cfg_data.binary_name;
+ size_t l_binaryNamePos = l_binaryNameStr.find_last_of("/");
+ if (std::string::npos != l_binaryNamePos) {
+ l_binaryNameStr = l_binaryNameStr.substr(l_binaryNamePos + 1);
+ f_processNameMap.insert(
+ make_pair(l_binaryNameStr, l_moduleLaunchListIter));
+ }
+ }
+
+ std::sprintf(key, "ModulesLaunchConfig.Launch%d", ++launch_idx); // NOLINT
+ value = l_pReaderCfg->GetString(key);
+ } // end while
+ }
+ } else { // LCOV_EXCL_START 6: Because new doesn't pass the failure case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // defaults use from the header file ... this is much faster then reading from an xml file.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: \"new CNSConfigReader(%s)\" returned NULL; using "
+ "constants.", f_launchCfgFn.c_str());
+ UI_32 num_of_items = static_cast<UI_32>(_countof(g_arrLaunchTableCfg));
+ for (UI_32 arr_idx = 0; arr_idx < num_of_items; arr_idx++) {
+ GroupLaunchInfo grp_info;
+ grp_info.launch_complete = FALSE;
+ grp_info.name = g_arrLaunchTableCfg[arr_idx].group_name;
+ grp_info.id = g_arrLaunchTableCfg[arr_idx].group_id;
+ grp_info.grp_launch_wait =
+ g_arrLaunchTableCfg[arr_idx].group_launch_wait;
+
+ GroupLaunchMapIter grp_iter = groups_map.find(grp_info.id);
+
+ if (grp_iter != groups_map.end()) {
+ set_grp_member_info(g_arrLaunchTableCfg[arr_idx],
+ grp_iter->second.modules);
+ } else {
+ set_grp_member_info(g_arrLaunchTableCfg[arr_idx],
+ grp_info.modules);
+ // add this grp info object to the list of grps
+ groups_map.insert(make_pair(grp_info.id, grp_info));
+ }
+ }
+ }
+ // LCOV_EXCL_STOP
+ if (rtn_code == TRUE) {
+ load_parameters_order_cfg(groups_map, f_OrderList, f_launchOrderName, f_launchCfgFn);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return rtn_code;
+}
+
+VOID SysMgrConfiguration::PrintGroupInfo(GroupLaunchInfo& refGrpInfo) {
+ std::stringstream l_logMsg;
+
+ l_logMsg << endl << "Group: " << refGrpInfo.name.data() << endl
+ << " id: " << refGrpInfo.id << endl << " wait-time: "
+ << refGrpInfo.grp_launch_wait << endl << " launch complete: "
+ << (refGrpInfo.launch_complete == TRUE ? "YES" : "NO"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ std::string l_logStr = l_logMsg.str();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str());
+}
+
+VOID SysMgrConfiguration::PrintModuleInfo(ModuleLaunchParams& refMbrInfo) {
+ std::stringstream l_logMsg;
+
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_logMsg << endl << "Module: " << refMbrInfo.name.data() << endl
+ << " path: " << refMbrInfo.path.data() << endl << " args: "
+ << refMbrInfo.arguments.data() << endl << " restart: "
+ << refMbrInfo.restart.data() << endl
+ << " configuration_priority: "
+ << refMbrInfo.configuration_priority << endl
+ << " cpu_assign: "
+ << refMbrInfo.cpu_assign << endl
+ << " current_priority: " << refMbrInfo.current_priority << endl
+ << " previous_priority: " << refMbrInfo.previous_priority << endl
+ << " critical: " << (refMbrInfo.critical == TRUE ? "YES" : "NO")
+ << endl
+ << " retry count: " << refMbrInfo.retry_cnt << endl
+ << " logging mask: " << refMbrInfo.logging_msk_str << endl
+ << " is_start_required: "
+ << (refMbrInfo.is_start_required == TRUE ? "YES" : "NO")
+ << endl
+ << " shutdown_critical: "
+ << (refMbrInfo.shutdown_critical == TRUE ? "YES" : "NO") << endl
+ << " shutdown_wait_time: " << refMbrInfo.shutdown_wait_time
+ << endl << " fast_shutdown_wait_time: "
+ << refMbrInfo.fast_shutdown_wait_time << endl << " is_agl_unit: "
+ << refMbrInfo.IsAGLUnit() << endl << " disable_agl_resethistory: "
+ << refMbrInfo.IsAGLResetHistoryDisable() << endl << " disable_nonagl_resethistory: "
+ << refMbrInfo.IsNonAGLResetHistoryDisable() << endl << " state: "
+ << refMbrInfo.ModuleStateStr() << endl << " group ID: "
+ << refMbrInfo.group_id << endl << " debug dump state: "
+ << refMbrInfo.GetModuleDebugDumpStateStr();
+ // LCOV_EXCL_BR_STOP
+ std::string l_logStr = l_logMsg.str();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str());
+}
+
+VOID SysMgrConfiguration::PrintAllInfo(GroupLaunchMap& refGrpMap) {
+ // get first client from the map...
+ GroupLaunchMapIter grp_iter = refGrpMap.begin();
+
+ for (; grp_iter != refGrpMap.end(); grp_iter++) {
+ PrintGroupInfo(grp_iter->second);
+ ModuleLaunchListIter mbr_iter = grp_iter->second.modules.begin();
+ for (; mbr_iter != grp_iter->second.modules.end(); mbr_iter++) {
+ PrintModuleInfo(*mbr_iter);
+ }
+ }
+}
+
+BOOL SysMgrConfiguration::ParseBoolParameter(PCSTR f_value, BOOL f_default) const {
+ if (FALSE == f_default) {
+ const char TRUE_VALUE[] = "True";
+ if (0 == strcmp(TRUE_VALUE, f_value)) {
+ return TRUE;
+ }
+ } else {
+ const char FALSE_VALUE[] = "False";
+ if (0 == strcmp(FALSE_VALUE, f_value)) {
+ return FALSE;
+ }
+ }
+ return f_default;
+}
+
+/*
+ * SM Configuration data constructor
+ */
+SMConfigParams::SMConfigParams() {
+}
+
+/*
+ * SM Configuration data destructor
+ */
+SMConfigParams::~SMConfigParams() {
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// PrintConfigInfo
+/// \brief Print the configuration data stored in config structure
+///
+/// \param [in] configata
+/// ConfigurationData & - Ref to structure that get populated.
+///
+/// \return VOID
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID SMConfigParams::PrintConfigInfo(ConfigurationData const & f_ConfigParams) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppHeartBeatInterval_Initial Info: %d",
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalInitial);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppHeartBeatInterval_Repeat Info: %d",
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalRepeat);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "HBMaxHeartBeatRetryCount Info: %d",
+ f_ConfigParams.HBConfig.MaxHeartBeatRetryCount);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CDEnabled: %d",
+ f_ConfigParams.CDConfig.CrashDetectorEnabled);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMTimerValue: %d",
+ f_ConfigParams.SLMConfig.SLMTimerValue);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMMaxRetryCount: %d",
+ f_ConfigParams.SLMConfig.SLMMaxRetryCount);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMThresholdValue: %d",
+ f_ConfigParams.SLMConfig.SLMThresholdValue);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMSystemmanagerLogIntervalMs: %d",
+ f_ConfigParams.SLMConfig.SLMSystemmanagerLogIntervalMs);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "UserModeStructIsBoolean: %s",
+ GetStr(f_ConfigParams.UMConfig.IsUserModeNotificationABOOL).c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ModuleConnectionNumTimesToCheck: %d",
+ f_ConfigParams.MCConfig.ModuleConnectionNumTimesToCheck);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ModuleConnectionTimeOutSec: %d",
+ f_ConfigParams.MCConfig.ModuleConnectionTimeOutSec);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ModuleStartRespTimeOutSec: %d",
+ f_ConfigParams.MCConfig.ModuleStartRespTimeOutSec);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CriticalAppsMaxShutdownTimeFastSleep: %d",
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeFastSleep);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "CriticalAppsMaxShutdownTimeNormalReset: %d",
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeNormalReset);
+ return;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// GetSMConfigInformation
+/// \brief Read config data from cfg file and populate the configuration data structure
+///
+/// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
+/// \param [in] f_FileName - Configuration file name.
+///
+/// \return BOOL
+/// BOOL - TRUE or FALSE
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL SMConfigParams::GetSMConfigInformation(ConfigurationData& f_ConfigParams, SS_String f_FileName) {
+ EFrameworkunifiedStatus l_eStatus;
+ BOOL l_rtnCode = FALSE; // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ CNSConfigReader *l_pReaderCfg = new (std::nothrow) CNSConfigReader(); // LCOV_EXCL_BR_LINE 10: As new does not fail
+// LCOV_EXCL_BR_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ if (NULL == l_pReaderCfg) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. new CNSConfigReader() returned NULL pointer.");
+ } else {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(f_FileName))) {
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. l_pReaderCfg->Open(%s) returned NULL pointer.",
+ f_FileName.c_str());
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Heartbeat.MaxHeartBeatRetryCount",
+ f_ConfigParams.HBConfig.MaxHeartBeatRetryCount))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Heartbeat.MaxHeartBeatRetryCount')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Heartbeat.AppHeartBeatIntervalInitial",
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalInitial))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Heartbeat.AppHeartBeatIntervalInitial')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Heartbeat.AppHeartBeatIntervalRepeat",
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalRepeat))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Heartbeat.AppHeartBeatIntervalRepeat')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetBool("CrashDetector.Enabled",
+ f_ConfigParams.CDConfig.CrashDetectorEnabled))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetBool('CrashDetector.Enabled')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt("SysLowMemory.TimerValue",
+ f_ConfigParams.SLMConfig.SLMTimerValue))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('SysLowMemory.TimerValue')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "SysLowMemory.MaxRetryCount",
+ f_ConfigParams.SLMConfig.SLMMaxRetryCount))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('SysLowMemory.MaxRetryCount')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "SysLowMemory.ThresholdValue",
+ f_ConfigParams.SLMConfig.SLMThresholdValue))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('SysLowMemory.ThresholdValue')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "SysLowMemory.InterfaceunifiedLogIntervalMs",
+ f_ConfigParams.SLMConfig.SLMSystemmanagerLogIntervalMs))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('SysLowMemory.InterfaceunifiedLogIntervalMs')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetBool(
+ "UserModeNotification.IsBoolean",
+ f_ConfigParams.UMConfig.IsUserModeNotificationABOOL))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetBool('UserModeNotification.IsBoolean')");
+ f_ConfigParams.UMConfig.IsUserModeNotificationABOOL = TRUE;
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Module.ModuleConnectionNumTimesToCheck",
+ f_ConfigParams.MCConfig.ModuleConnectionNumTimesToCheck))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Module.ModuleConnectionNumTimesToCheck')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Module.ModuleConnectionTimeOutSec",
+ f_ConfigParams.MCConfig.ModuleConnectionTimeOutSec))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Module.ModuleConnectionTimeOutSec')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "Module.ModuleStartRespTimeOutSec",
+ f_ConfigParams.MCConfig.ModuleStartRespTimeOutSec))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('Module.ModuleStartRespTimeOutSec')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "CriticalApps.CriticalAppsMaxShutdownTimeFastSleep",
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeFastSleep))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('CriticalApps.CriticalAppsMaxShutdownTimeFastSleep')");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = l_pReaderCfg->GetInt(
+ "CriticalApps.CriticalAppsMaxShutdownTimeNormalReset",
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeNormalReset))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ "l_pReaderCfg->GetInt('CriticalApps.CriticalAppsMaxShutdownTimeNormalReset')");
+ } else {
+ l_rtnCode = TRUE;
+ }
+
+ delete l_pReaderCfg; // LCOV_EXCL_BR_LINE 10: As the delete does not fail
+ }
+// LCOV_EXCL_BR_STOP
+
+ return (l_rtnCode);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// LoadSMConfigParameters
+/// \brief Read System Manager configuration parameters from cfg file or
+/// use defaults values in case cfg file is not available
+///
+/// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
+/// \param [in] f_FileName - Configuration file name.
+///
+/// \return BOOL
+/// BOOL - TRUE or FALSE
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL SMConfigParams::LoadSMConfigParameters(ConfigurationData& f_ConfigParams, SS_String f_FileName) {
+ BOOL rtn_code = TRUE;
+
+ rtn_code = GetSMConfigInformation(f_ConfigParams, f_FileName);
+
+ // cfg config file not found, use constants
+ if (FALSE == rtn_code) {
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: cfg config file not open, using constants");
+
+ // Heart Beat constants
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalInitial =
+ HBApplicationHeartBeatIntervalInitial;
+ f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalRepeat =
+ HBApplicationHeartBeatIntervalRepeat;
+ f_ConfigParams.HBConfig.MaxHeartBeatRetryCount = HBMaxHeartBeatRetryCount;
+
+ // Crash Detector constants
+ f_ConfigParams.CDConfig.CrashDetectorEnabled = CDEnabled;
+
+ // System Low Memory
+ f_ConfigParams.SLMConfig.SLMTimerValue = SLMTimerValue;
+ f_ConfigParams.SLMConfig.SLMMaxRetryCount = SLMRetryCount;
+ f_ConfigParams.SLMConfig.SLMThresholdValue = SLMThresholdValue;
+ f_ConfigParams.SLMConfig.SLMSystemmanagerLogIntervalMs = SLMSystemmanagerLogIntervalMs;
+
+ // Module connect and start resp
+ f_ConfigParams.MCConfig.ModuleConnectionNumTimesToCheck =
+ ModuleConnectionNumTimesToCheck;
+ f_ConfigParams.MCConfig.ModuleConnectionTimeOutSec =
+ ModuleConnectionTimeOutSec;
+ f_ConfigParams.MCConfig.ModuleStartRespTimeOutSec = ModuleStartRespTimeOutSec;
+
+ // Critical Apps shutdown time
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeFastSleep =
+ CriticalAppsMaxShutdownTimeFastSleepSec;
+ f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeNormalReset =
+ CriticalAppsMaxShutdownTimeNormalResetSec;
+
+ // USer Mode Data Structure Type
+ f_ConfigParams.UMConfig.IsUserModeNotificationABOOL = TRUE;
+ // LCOV_EXCL_STOP
+ }
+ PrintConfigInfo(f_ConfigParams);
+
+ return rtn_code;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/video_in_hal/systemservice/system_manager/server/src/ss_sm_dynamic_launcher.cpp b/video_in_hal/systemservice/system_manager/server/src/ss_sm_dynamic_launcher.cpp
new file mode 100755
index 0000000..6144fa4
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/ss_sm_dynamic_launcher.cpp
@@ -0,0 +1,221 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <string>
+#include <sstream>
+#include <iomanip>
+
+#include "ss_sm_dynamic_launch_table.h"
+#include "ss_sm_systemmanagerlog.h"
+
+DynamicLaunchBase::DynamicLaunchBase():
+m_vOrderedGroup(),
+m_iterOrderedGroup() {
+}
+
+
+DynamicLaunchBase::~DynamicLaunchBase() {
+}
+
+UI_32 DynamicLaunchBase::get_id() const {
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DLB: Active Group ID is %d", *m_iterOrderedGroup);
+ return *m_iterOrderedGroup;
+}
+
+UI_32 DynamicLaunchBase::advance_id() {
+ if (!is_end()) {
+ m_iterOrderedGroup++;
+ }
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DLB: Active Group ID is %d", *m_iterOrderedGroup);
+ return *m_iterOrderedGroup;
+}
+
+UI_32 DynamicLaunchBase::decrement_id() {
+ if (!is_begin()) { // LCOV_EXCL_BR_LINE 5: stdlib error case.
+ m_iterOrderedGroup--;
+ }
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DLB: Active Group ID is %d", *m_iterOrderedGroup);
+ return *m_iterOrderedGroup;
+}
+
+BOOL DynamicLaunchBase::is_begin() {
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DLB: Active Group ID is %d", *m_iterOrderedGroup);
+ return (m_iterOrderedGroup == m_vOrderedGroup.begin());
+}
+
+BOOL DynamicLaunchBase::is_end() {
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DLB: Active Group ID is %d", *m_iterOrderedGroup);
+ DynamicOrderedIter l_it = m_iterOrderedGroup;
+ l_it++;
+ return (l_it == m_vOrderedGroup.end());
+}
+
+VOID DynamicLaunchBase::to_begin() {
+ m_iterOrderedGroup = m_vOrderedGroup.begin();
+ return;
+}
+
+VOID DynamicLaunchBase::to_end() {
+ m_iterOrderedGroup = m_vOrderedGroup.end();
+ m_iterOrderedGroup--;
+ return;
+}
+
+VOID DynamicLaunchBase::print_info() {
+ UI_32 idx = 1;
+ std::stringstream l_logMsg;
+ DynamicOrderedIter l_dyn_iter = m_vOrderedGroup.begin();
+ for (; l_dyn_iter != m_vOrderedGroup.end(); l_dyn_iter++) {
+ l_logMsg << std::endl << "Index: " << std::setw(2) << idx
+ << " Group Id: " << std::setw(2) << *l_dyn_iter;
+
+ idx++;
+ }
+
+ std::string l_logStr = l_logMsg.str();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str());
+}
+
+DynamicLauncher::DynamicLauncher() :DynamicLaunchBase(),
+m_nLaunchGroupId(0),
+m_nLaunchBeforeGroupId(0),
+m_nLaunchAfterGroupId(0),
+m_nAviageTriggerId(0),
+m_bDynamicLaunchEnabled(FALSE), // by default until set by some one will this be disabled.
+m_eSourceType(SS_SOURCE_NA) { // invalid
+}
+
+DynamicLauncher::~DynamicLauncher() {
+}
+
+BOOL DynamicLauncher::dynamic_launch_enabled() const { // LCOV_EXCL_START 8: Dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_bDynamicLaunchEnabled;
+}
+// LCOV_EXCL_STOP
+
+VOID DynamicLauncher::configure_dynamic_launch(const SS_SOURCE& source_type,
+ GroupLaunchMap& group_info, LaunchOrderedVector& order_info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_eSourceType = source_type;
+ // "Dynamic Launch" is not used due to high dependency on a service table
+ create_normal_launch_vector(group_info, order_info);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+BOOL DynamicLauncher::is_inGroupLaunchMap(UI_32& id,
+ GroupLaunchMap& group_info) { // LCOV_EXCL_START 8: Dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL Ret = FALSE;
+ GroupLaunchMapIter l_grp_iter = group_info.find(id);
+ if (l_grp_iter != group_info.end()) {
+ Ret = TRUE;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return Ret;
+}
+// LCOV_EXCL_STOP
+
+// LCOV_EXCL_START 8: Dead code
+DynamicLaunchInfo* DynamicLauncher::get_dynamic_source_info(
+ const SS_SOURCE& source_type, BOOL& source_trigger,
+ BOOL& is_aviage_required) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ UI_32 num_of_items = static_cast<UI_32>(_countof(g_arrDynamicLaunchTableCfg));
+ DynamicLaunchInfo * point_to_this = NULL;
+ for (UI_32 arr_idx = 0; arr_idx < num_of_items; arr_idx++) {
+ if (g_arrDynamicLaunchTableCfg[arr_idx].source == source_type) {
+ source_trigger = g_arrDynamicLaunchTableCfg[arr_idx].group_trigger;
+ point_to_this = &g_arrDynamicLaunchTableCfg[arr_idx];
+ if ((SS_SOURCE_FM == source_type) || (SS_SOURCE_AM == source_type)
+ || (SS_SOURCE_FM_DAB == source_type)
+ || (SS_SOURCE_SDARS == source_type)) {
+ is_aviage_required = FALSE;
+ }
+ break;
+ }
+ }
+
+ return point_to_this;
+}
+// LCOV_EXCL_STOP
+
+UI_32 DynamicLauncher::get_id_using_group_name(PCSTR group_name,
+ GroupLaunchMap& group_info) { // LCOV_EXCL_START 8: Dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ GroupLaunchMapIter l_grp_iter = group_info.begin();
+ UI_32 rtn_grp_id = 0;
+ for (; l_grp_iter != group_info.end(); l_grp_iter++) {
+ if (0 == strcmp(group_name, l_grp_iter->second.name.c_str())) {
+ rtn_grp_id = l_grp_iter->second.id;
+ break;
+ }
+ }
+
+ return rtn_grp_id;
+}
+// LCOV_EXCL_STOP
+
+VOID DynamicLauncher::create_normal_launch_vector(GroupLaunchMap& group_info,
+ LaunchOrderedVector& order_info) {
+ m_vOrderedGroup.clear();
+
+ if (order_info.size() != 0) { // LCOV_EXCL_BR_LINE 6: To initialize conditions for launching SystemManager
+ // LCOV_EXCL_START 6: To initialize conditions for launching SystemManager
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LaunchOrderedIter l_ord_iter = order_info.begin();
+ while (l_ord_iter != order_info.end()) {
+ if (is_inGroupLaunchMap(*l_ord_iter, group_info) == TRUE) {
+ m_vOrderedGroup.push_back(*l_ord_iter);
+ }
+ l_ord_iter++;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ GroupLaunchMapIter l_grp_iter = group_info.begin();
+ while (l_grp_iter != group_info.end()) {
+ m_vOrderedGroup.push_back(l_grp_iter->second.id);
+ l_grp_iter++;
+ }
+ }
+ m_iterOrderedGroup = m_vOrderedGroup.begin();
+ m_bDynamicLaunchEnabled = TRUE;
+ print_info();
+}
+
+VOID DynamicLauncher::copyDynOrderedVector(DynamicModuleStart& Start) {
+ Start.setGroupVector(this->m_vOrderedGroup);
+}
+
+// DynamicModuleStart
+
+DynamicModuleStart::DynamicModuleStart() :DynamicLaunchBase() {
+}
+
+DynamicModuleStart::~DynamicModuleStart() {
+}
+
+VOID DynamicModuleStart::setGroupVector(DynamicOrderedVector& Vector) {
+ m_vOrderedGroup.assign(Vector.begin(), Vector.end());
+ m_iterOrderedGroup = m_vOrderedGroup.begin();
+} // LCOV_EXCL_BR_LINE 10: Final line
diff --git a/video_in_hal/systemservice/system_manager/server/src/ss_sm_version.cpp b/video_in_hal/systemservice/system_manager/server/src/ss_sm_version.cpp
new file mode 100755
index 0000000..9df970f
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/ss_sm_version.cpp
@@ -0,0 +1,79 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for module version management.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <system_service/ss_package.h>
+#include <system_service/ss_ver.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <fstream>
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_version.h"
+
+using namespace std; // NOLINT
+
+CSMVersion::CSMVersion() {
+}
+
+CSMVersion::~CSMVersion() {
+}
+
+EFrameworkunifiedStatus CSMVersion::get_version(SS_VersionNumberType& f_VersionNumber) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CSSVer ver;
+
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ f_VersionNumber = 0;
+
+ SSVER_PkgInfo info;
+ l_eStatus = ver.getPkgInfo(SS_PKG_MAIN_EMMC, &info);
+ if (l_eStatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 6: To initialize conditions for launching SystemManager
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ f_VersionNumber = strtoull(info.version, NULL, 10); // LCOV_EXCL_LINE 6: To initialize conditions for launching SystemManager
+ } else {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSMVersion::get_version(SS_VersionNumberType &f_VersionNumber)
+
+EFrameworkunifiedStatus CSMVersion::get_build_info(std::string& f_buildInfoStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string build_info_str;
+ CSSVer ver;
+ SSVER_PkgInfo info;
+ l_eStatus = ver.getPkgInfo(SS_PKG_MAIN_PRODUCT_SI, &info);
+ if (l_eStatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 6: To initialize conditions for launching SystemManager
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ build_info_str += info.version; // LCOV_EXCL_LINE 6: To initialize conditions for launching SystemManager
+ } else {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ f_buildInfoStr = build_info_str;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // LCOV_EXCL_BR_LINE 10: Final line End of EFrameworkunifiedStatus CSMVersion::get_build_info(SS_String &f_buildInfoStr)
+// EOF /SS_SystemManager/src/ss_sm_version.cpp
diff --git a/video_in_hal/systemservice/system_manager/server/src/ss_system_manager.cpp b/video_in_hal/systemservice/system_manager/server/src/ss_system_manager.cpp
new file mode 100755
index 0000000..8e26f23
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/ss_system_manager.cpp
@@ -0,0 +1,3655 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager business logic.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/cl_lock.h>
+#include <native_service/cl_process.h>
+#include <native_service/cl_monitor.h>
+
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_thread_priority.h>
+
+#include <native_service/ns_np_service_nor_persistence.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/ns_np_service_if.h>
+#include <native_service/ns_backup.h>
+
+#include <heartbeat/ss_hb_if.h>
+
+#include <processlauncher/ProcessLauncher_if.h>
+#include <processlauncher/ss_sm_process_launcher.h>
+#include <processlauncher/ss_sm_process_launcher_protocol.h>
+
+#include <system_service/ss_system_manager_conf.h>
+#include <stub/ss_diag.h>
+
+#include <system_service/ss_client_names.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_power_service_if.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_sm_thread_names.h>
+#include <system_service/ss_sm_thread_names_local.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <system_service/ss_system_manager_notifications_local.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_sm_client_if_local.h>
+#include <system_service/ss_test_clients.h>
+#include <stub/Clock_API.h>
+#include <power_hal.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <sys/resource.h>
+#include <sys/procfs.h>
+#include <sys/timeb.h>
+#include <sys/wait.h>
+#include <inttypes.h>
+#include <libgen.h>
+#include <spawn.h>
+#include <pthread.h>
+#include <linux/oom.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sched.h>
+#include <other_service/itoa.h>
+#include <iomanip>
+#include <fstream>
+#include <string>
+#include <map>
+#include <vector>
+#include "ss_sm_signals.h"
+#include "ss_sm_default_paths.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_version.h"
+#include "ss_system_manager.h"
+using namespace std; // NOLINT
+
+static CSystemManager g_oSystemManger;
+
+#define SS_SM_TEMP_FILE_FOR_STORE_LOGS "/nv/BS/ss/system_manager/rwdata/sm_tempStoreLogs"
+#define TR_USB_PATH "/usr/agl/bin/realtimeUsbLog"
+
+// \brief: public structure that is used for logging by NSLogger.
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+std::string NumberToString(int Number) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ std::ostringstream ss;
+ ss << Number;
+ return ss.str();
+}
+// LCOV_EXCL_STOP
+
+/* Check if "Mount Point" exsists as Directory */
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: No Argument Constructor.
+ @note: .
+ @param void
+ @return void
+ */
+/*****************************************************************************/
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus SysMgrCallback(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ C * pObj = static_cast<C *>(&g_oSystemManger);
+ if (pObj) {
+ l_eStatus = (pObj->*M)(hApp);
+ }
+ return l_eStatus;
+}
+
+//**************************************************************************
+// System Manager State String Map *
+// *
+void Init_SS_SMModuleState_StrMap(std::map<SS_SMModuleState, SS_String> & m_strMap) { // NOLINT
+ MAP_ENTRY(m_strMap, SS_SM_READY_TO_LAUNCH_APP);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_LAUNCH_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_LAUNCHED_READY_TO_START);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_START_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_START_COMPLETE);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_STOPPING_AT__CWORD56__REQ);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_STOPPING_AT_INTERNAL_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ);
+ MAP_ENTRY(m_strMap, SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_PRE_START_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_PRE_STOP_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_PRE_RUN_COMPLETE);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_BACKGROUND_START_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS);
+ MAP_ENTRY(m_strMap, SS_SM_APPS_BACKGROUND_RUN_COMPLETE);
+} // End of void Init_SS_SMModuleState_StrMap(std::map<SS_SMModuleState,
+
+class EnumStringMap<SS_SMModuleState, Init_SS_SMModuleState_StrMap>
+ m_oSS_SMModuleStateStrMap;
+SS_String GetStr(SS_SMModuleState f_enum) {
+ return m_oSS_SMModuleStateStrMap.GetStr(f_enum); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+} // End of SS_String :GetStr(SS_SMModuleState f_enum)
+// *
+// End of System Manager State String Map *
+//**************************************************************************
+
+std::string CSystemManager::m_bootOpt; // NOLINT
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: No Argument Constructor.
+ @note: .
+ @param void
+ @return void
+ */
+/*****************************************************************************/
+CSystemManager & CSystemManager::GetInstance() {
+ return g_oSystemManger;
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: No Argument Constructor.
+ @note: .
+ @param void
+ @return void
+ */
+/*****************************************************************************/
+CSystemManager::CSystemManager() :
+ m_hHeartbeatThread(INVALID_HANDLE, eSM_ThreadNotExist),
+ m_hProcLauncherThread(INVALID_HANDLE, eSM_ThreadNotExist),
+ m_SystemLaunchProgress(SS_SM_INITIAL_GROUP),
+ m_GroupLaunchTimer(NULL),
+ m_GroupRelaunchCount(0),
+ m_GroupRelaunchLimit(0),
+ m_hPowerServiceSession(NULL),
+ m_ActiveGroupId(SS_SM_INITIAL_GROUP),
+ m_StartUpReason(epswfINVALID),
+ m_DataResetMode(e_SS_SM_DATA_RESET_MODE_NONE),
+ m_ProgUpdateState(SS_SM_PROG_UPDATE_STATE_NONE),
+ m_NextWakeupType(e_SS_SM_NEXT_WAKEUP_TYPE_NONE),
+ m_DramBackupStatus(e_SS_SM_DRAM_BACKUP_NG),
+ m_isIlgReset(FALSE),
+ m_ResetStatus(e_SS_SM_RESET_STATUS_NONE),
+ m_ResetCount(0),
+ m_SMCurrentState(SS_SM_READY_TO_LAUNCH_APP),
+
+ m_MaxShutdownTime(0),
+ m_NbrDebugDumpRspnRecv(0),
+ m_isRcvModeInfo(FALSE),
+ m_BinaryFilesPath(""),
+ m_ConfigFilesPath(""),
+ m_pfStopCompleteHandler(
+ SysMgrCallback<CSystemManager, &CSystemManager::send_shutdown_complete_response>),
+ m_VersionNumberStruct(0, eFrameworkunifiedStatusErrOther),
+ m_BuildInfoStr(""),
+ m_isRstPending(FALSE),
+ m_rstPendingInfo(),
+ m_UsingVMPlayer(FALSE),
+ NVM_VALID_SIGNATURE(0xBA5EBA11),
+ m_lastUserMode(epsumON),
+ m_shutdownTrigger(epssdmsdtINVALID),
+ m_isImmediateReset(FALSE),
+ m_isImmResetReq(FALSE),
+ m_needReNotifyStartPrm(FALSE),
+ m_pVarCodeStr(NULL),
+ m_SSLGroupLaunchMapIterator(NULL),
+ m_ModuleLaunchListIter(NULL),
+ m_bIsNPP_ServicesStarted(FALSE),
+ m_bIsBackupAvail(FALSE),
+ m_oSystemLauncher(),
+ m_SystemStarter(),
+ m_NPPStopSent(FALSE),
+ m_userModeChangeReason(epsumcrNOT_AVAILABLE),
+ m__CWORD56_CmdHist(SS_SM__CWORD56__CMD_HIST_SIZE),
+ m_SMCmdHist(SS_SM_CMD_HIST_SIZE),
+ m_TimerCmdHist(SS_SM_TIMER_CMD_HIST_SIZE),
+ m_PubCmdHist(SS_SM_PUB_CMD_HIST_SIZE),
+ m_ErrHist(SS_SM_ERR_HIST_SIZE),
+ m_ClProcessSigFd(-1),
+ m_SysMemMonitor(),
+ m_FreeMemAvailable(0),
+ m_coreFileSizeBytes(0),
+ m_BootMicroResetReason(SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET),
+ m_errorEventQueueLocked(FALSE),
+ m_isPrevErrEventCompleted(TRUE),
+ m_errorEventResult(eFrameworkunifiedStatusOK),
+ m_requestedArtifactId(eArtifactIdInterfaceunifiedDebugLog) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_InitialBoot = true;
+
+ m_ResetFactor = PSM_FACTOR_NONE;
+
+ m_Wake.powerupType = epswsPWRON;
+ m_Wake.up.level = epswlFULLRUN;
+
+ m_SystemModeInfo.lastUserMode = m_lastUserMode;
+ m_SystemModeInfo.limpHomeCutoff = epslhcINVALID;
+ m_SystemModeInfo.productionMode = epspmINVALID;
+ m_SystemModeInfo.transportMode = epstmINVALID;
+ m_SystemModeInfo.systemMode = epssinfINVALID;
+ m_SystemModeInfo.startupStage = epssusfINVALID;
+
+ bzero(&m_SMConfig, sizeof(m_SMConfig));
+ bzero(&m_startUpConfirmationMsg, sizeof(m_startUpConfirmationMsg));
+ bzero(&m_HBReport, sizeof(m_HBReport));
+
+ m__CWORD56_HistIter = m__CWORD56_CmdHist.begin();
+ m_TimerHistIter = m_TimerCmdHist.begin();
+ m_SMHistIter = m_SMCmdHist.begin();
+ m_PubHistIter = m_PubCmdHist.begin();
+ m_ErrHistIter = m_ErrHist.begin();
+
+ ////******************************************************************////
+ //// Initialization of enum<=>enum and enum=>string maps ////
+ //// ////
+
+ //
+ // **** Initialization of powerupType enum maps ****
+ // Map of System Services powerupType to BOOL enum values
+ m_PowerType_to_SSBoolEnumMap[epswsPWRON] = TRUE;
+ m_PowerType_to_SSBoolEnumMap[epswsPWROFF] = FALSE;
+ //
+ // Map of System Services powerupType to System Services User Mode enum values
+ m_PowerType_to_SSUserModeEnumMap[epswsPWRON] = epsumON;
+ m_PowerType_to_SSUserModeEnumMap[epswsPWROFF] = epsumOFF;
+ //
+ // Map of BOOL to System Services powerupType enum values
+ m_SSBool_to_PowerTypeEnumMap[TRUE] = epswsPWRON;
+ m_SSBool_to_PowerTypeEnumMap[FALSE] = epswsPWROFF;
+ //
+ // **** Initialization of User Mode ( aka Last User Mode ) maps ****
+ // Map of BOOL to System Services User Mode enum values
+ m_SSBool_to_SSUserModeEnumMap[FALSE] = epsumOFF;
+ m_SSBool_to_SSUserModeEnumMap[TRUE] = epsumON;
+ //
+ // Map of BOOL to System Services User Mode enum values
+ m_SSUserMode_to_SSBoolEnumMap[epsumOFF] = FALSE;
+ m_SSUserMode_to_SSBoolEnumMap[epsumON] = TRUE;
+
+ // LCOV_EXCL_BR_STOP
+ //// ////
+ //// End of Initialization of enum<=>enum and enum=>string maps ////
+ ////******************************************************************////
+
+ m_startUpConfirmationMsg.wakeupType = epsstINVALID;
+ m_startUpConfirmationMsg.coldStartRequest = epsscrtINVALID;
+ m_startUpConfirmationMsg.HWVersion = UINT32_MAX;
+ m_startUpConfirmationMsg.matchedHardwareType = UINT32_MAX;
+ m_startUpConfirmationMsg.softwareType = UINT32_MAX;
+ m_startUpConfirmationMsg.imageType = UINT32_MAX;
+ m_startUpConfirmationMsg.majorVersion = UINT32_MAX;
+ m_startUpConfirmationMsg.minorVersion = UINT32_MAX;
+
+ m_SystemManagerPriority = PR_SS_SYSMANAGER;
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: Destructor
+ @note: .
+ @param void
+ @return void
+ */
+/*****************************************************************************/
+CSystemManager::~CSystemManager() { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (NULL != m_pVarCodeStr) {
+ delete[] m_pVarCodeStr; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: Initialize_memory Memory initialization processing
+ @note: .
+ @param
+ @return void
+ */
+/*****************************************************************************/
+void CSystemManager::Initialize_memory(HANDLE hApp, bool* l_isInitFail, EFrameworkunifiedStatus* l_eStatus_work, BOOL isIllReset) {
+ int ret;
+ EFrameworkunifiedStatus l_eStatus;
+
+ /// Start Process for Realtime USB Logging
+ {
+ PreLaunchModuleParams l_rtuparam;
+ l_rtuparam.LaunchFunc = CreateRtUsb;
+ l_rtuparam.relaunchLimit = 1;
+ l_rtuparam.name = "realtimeUsbLog";
+ l_rtuparam.binaryFileName = TR_USB_PATH;
+/* l_rtuparam.pid = CreateRtUsb();
+ if (l_rtuparam.pid == 1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: CreateRtUsb()");
+ } */
+ m_PreLaunchModuleList.push_back(l_rtuparam);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ int fd = open("/dev/urandom", O_RDONLY); // LCOV_EXCL_BR_LINE 5: standard lib error
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 5: standard lib error
+ } else {
+ char buf[4];
+ ret = static_cast<int>(read(fd, buf, 4)); // LCOV_EXCL_BR_LINE 5: standard lib error
+ if (-1 == ret) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 5: standard lib error
+ } else if (4 != ret) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 5: standard lib error
+ } else {
+ fprintf(stderr, "WakeupID:%X%X%X%X\n", buf[0], buf[1], buf[2], buf[3]);
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "WakeupID:%X%X%X%X", buf[0], buf[1], buf[2], buf[3]);
+ }
+ close(fd);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "bootOpt:%s", m_bootOpt.c_str());
+
+ *l_eStatus_work = FrameworkunifiedAttachCallbackToDispatcherWithFd(hApp, m_ClProcessSigFd, // LCOV_EXCL_BR_LINE 4: nsfw error
+ SysMgrCallback<CSystemManager, &CSystemManager::OnProcessTermDetected>);
+
+ if (eFrameworkunifiedStatusOK != *l_eStatus_work) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbackToDispatcherWithFd()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ pthread_mutex_init(&sm_hist_mutex, NULL);
+
+ ReadPathFromEnvironmentVariables();
+ ReadUsingVMPlayerEnvironmentVariable();
+
+ // FIXME : Dump information from power_hal by using
+
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = SetSystemModeInfoStruct())) {
+ LOG_ERROR("SetSystemModeInfoStruct()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ *l_isInitFail = true;
+ }
+
+ // Select configuration file for wakeup services
+ BOOL bIsVupMode = (m_SystemModeInfo.systemMode == epssinfPROGRAMMING) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ T_SS_SM_INIT_HOOK_IN_PARAM inPrm;
+
+ std::memset(&inPrm, 0, sizeof(inPrm));
+ inPrm.bIsVupMode = bIsVupMode;
+
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = ss_sm_initHook(hApp, &inPrm, &m_productCustomPrm))) {
+ SS_ASERT_LOG(0, "ERROR: ss_sm_initHook()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ *l_isInitFail = true;
+ }
+
+ SetEnvVariableForVupMode(bIsVupMode);
+
+ // Get the Version Number
+ // GetVersionNumber() will report any errors
+ m_VersionNumberStruct.m_eSystemmanagerStatus = GetVersionNumber(m_VersionNumberStruct.m_VersionNumber);
+
+ *l_eStatus_work = GetBuildInfo(m_BuildInfoStr);
+ l_eStatus = *l_eStatus_work;
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "GetBuildInfo()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ INTERFACEUNIFIEDLOG_WHEN_COMPILED; // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s priority is %d", SERVICE_SYSMANAGER, m_SystemManagerPriority);
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, " %s was compiled at %s @ %s", __FILE__, __DATE__, __TIME__);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, " Host Processor Software Version is '0x%016llX'",
+ m_VersionNumberStruct.m_VersionNumber);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, " Host Processor Build Version is '%s'", m_BuildInfoStr.c_str());
+
+ LogESystemmanagerStatusEnums();
+ LogProtocolIDs();
+}
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: Initialize_callbacks Callback enrollment process
+ @note: .
+ @param
+ @return void
+ */
+/*****************************************************************************/
+void CSystemManager::Initialize_callbacks(HANDLE hApp, bool *l_isInitFail, EFrameworkunifiedStatus *l_eStatus_work) {
+ EFrameworkunifiedStatus l_eStatus;
+
+ m_GroupLaunchTimer = new (std::nothrow) TimerCtrl(eSM_TIMERS_END); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (NULL == m_GroupLaunchTimer) { // LCOV_EXCL_BR_LINE 5: Because new doesn't pass the failure case
+ // LCOV_EXCL_START 5: Because new doesn't pass the failure case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *l_eStatus_work = eFrameworkunifiedStatusNullPointer;
+ LOG_ERROR("new(std::nothrow)TimerCtrl(eSM_TIMERS_END)");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_GroupLaunchTimer->Initialize(hApp);
+ m_aTimerIDs[eSM_TIMER_GROUP_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnGroupLaunchTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_PROCESS_LAUNCH_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnProcessLaunchTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_HEARTBEAT_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnHeartBeatMonitorTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_PROCESSLAUNCHER_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::OnProcessLaunchMonitorTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_CLIENT_START_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::OnClientStartMonitorTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_NPP_STATUS_CHECK_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::OnNPPStatusCheckMonitorTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER__CWORD56__HEARTBEAT_RESPONSE] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::On_CWORD56_HeartBeatResponseIntervalTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_LAUNCH_GROUP_TRIGGER_PROC_RESP_TIMER] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::OnLaunchGroupTriggerProcessResponseTimerExpiry>);
+ m_aTimerIDs[eSM_TIMER_GROUP_LAUNCH_WAIT_TIMER] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnGroupLaunchWaitTimeout>);
+ m_aTimerIDs[eSM_TIMER_MODULE_CONNECT_WAIT_TIMER] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnModuleConnectWaitTimeout>);
+ m_aTimerIDs[eSM_TIMER_START_RESP_MONITOR_WAIT_TIMER] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnStartRespMonitorTimeout>);
+ m_aTimerIDs[eSM_TIMER_SHUTDOWN_COMPLETE_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager,
+ &CSystemManager::OnShutdownCompleteMonitorTimeout>);
+ m_aTimerIDs[eSM_TIMER_CLIENT_STOP_MONITOR] =
+ m_GroupLaunchTimer->CreateTimer(SysMgrCallback<CSystemManager, &CSystemManager::OnClientStopMonitorTimerExpiry>);
+
+ FrameworkunifiedProtocolCallbackHandler l_cbArrayAnySource[] = {
+ // Command ID, Call back functions
+ { SS_SM_PROTOCOL_OPEN_SESSION_REQ, SysMgrCallback<CSystemManager, &CSystemManager::OnOpenSession> },
+ { SS_SM_CPU_RESET_REQ, SysMgrCallback<CSystemManager, &CSystemManager::OnCpuResetRequest> }
+ };
+
+ FrameworkunifiedProtocolCallbackHandler l_cbArrayGroupLaunchService[] = {
+ // Command ID, Call back functions
+ { SS_SM_GROUP_LAUNCH_TRIGGER, SysMgrCallback<CSystemManager, &CSystemManager::OnLaunchGroupTriggerProcessResponse> }
+ };
+
+ FrameworkunifiedProtocolCallbackHandler l_cbArrayNPPService[] = {
+ // Command ID, Call back functions
+ { NPS_NPP_READY_EVENT, SysMgrCallback<CSystemManager, &CSystemManager::OnNPPReadyEventCallback> },
+ { NPS_GET_READYSTATUS_ACK, SysMgrCallback<CSystemManager, &CSystemManager::OnNPPReadyStatusCallback> },
+ { NPS_NPP_STOP_ACK, SysMgrCallback<CSystemManager, &CSystemManager::OnNppStopComplete> }
+ };
+
+ FrameworkunifiedProtocolCallbackHandler l_cbArrayPowerService[] = {
+ // Command ID, Call back functions
+ { SS_SM_POWER_REQUEST_MSG, SysMgrCallback<CSystemManager, &CSystemManager::OnPowerRequestCallback> },
+ { SS_SM_WAKEUP_MODULES, SysMgrCallback<CSystemManager, &CSystemManager::OnWakeupCallback> },
+ { SS_SM_SYSTEM_MODE_INFO_REQ, SysMgrCallback<CSystemManager, &CSystemManager::OnSystemModeInfoRequest> },
+ { SS_SM_INITCOMP_REP, SysMgrCallback<CSystemManager, &CSystemManager::OnInitCompReportCallback> },
+ { SS_SM_SHUTDOWN_MODULES, SysMgrCallback<CSystemManager, &CSystemManager::OnShutdownModulesRequest> },
+ { SS_SM_FWD_STARTUP_CONFIRMATION_MSG_REQ,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnSetStartupConfirmationDataRequest> }
+ };
+
+ FrameworkunifiedProtocolCallbackHandler l_cbArraySystemManager[] = {
+ // Command ID, Call back functions
+ { SS_SM_SendTriggerToSelf, SysMgrCallback<CSystemManager, &CSystemManager::OnLaunchGroupSelfTrigger> },
+ { SS_SM_DEBUG_DUMP_RSPN, SysMgrCallback<CSystemManager, &CSystemManager::OnDebugDumpResponseReceived> }
+ };
+ // LCOV_EXCL_BR_STOP
+
+#define ATTACH_CBS_TO_DISPATCHER(L_ARRAY, CALLING_SERVICE_NAME) \
+ *l_eStatus_work = l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp, \
+ CALLING_SERVICE_NAME, \
+ L_ARRAY, \
+ static_cast<UI_32>_countof(L_ARRAY)); \
+ if (eFrameworkunifiedStatusOK != l_eStatus) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ " Error: FrameworkunifiedAttachCallbacksToDispatcher(%s) errored: %d/'%s'", \
+ #L_ARRAY, \
+ l_eStatus, \
+ GetStr(l_eStatus).c_str()); \
+ *l_isInitFail = true; \
+ }
+// End of #define ATTACH_CBS_TO_DISPATCHER( CALLING_SERVICE_NAME, L_ARRAY )
+
+ // LCOV_EXCL_BR_START 15: marco defined above
+ // Note: This macro will exit this function if the embedded fnc errors.
+ ATTACH_CBS_TO_DISPATCHER(l_cbArrayAnySource, FRAMEWORKUNIFIED_ANY_SOURCE);
+
+ // Note: This macro will exit this function if the embedded fnc errors.
+ ATTACH_CBS_TO_DISPATCHER(l_cbArrayGroupLaunchService, SS_GROUP_LAUNCH_TRIGGER);
+
+ // Note: This macro will exit this function if the embedded fnc errors.
+ ATTACH_CBS_TO_DISPATCHER(l_cbArrayNPPService, FRAMEWORKUNIFIED_NS_NPSERVICE);
+
+ // Note: This macro will exit this function if the embedded fnc errors.
+ ATTACH_CBS_TO_DISPATCHER(l_cbArrayPowerService, SERVICE_POWER);
+
+ // Note: This macro will exit this function if the embedded fnc errors.
+ ATTACH_CBS_TO_DISPATCHER(l_cbArraySystemManager, SERVICE_SYSMANAGER);
+ // LCOV_EXCL_BR_STOP
+
+ {
+ char pathBuf[128];
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ snprintf(pathBuf, sizeof(pathBuf), "/proc/%d/oom_score_adj", getpid());
+ std::ofstream fo(pathBuf);
+ fo << OOM_SCORE_ADJ_MIN << endl;
+ fo.close();
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "set OOM_SCORE_ADJ_MIN(SS_SysManager/%d)", getpid());
+ }
+
+#undef ATTACH_CBS_TO_DISPATCHER
+
+ // LCOV_EXCL_BR_START 4: nsfw error
+ *l_eStatus_work = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_BackupMgr_Availability,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnBackupMgrAvailCallback>);
+ // LCOV_EXCL_BR_STOP
+ if (eFrameworkunifiedStatusOK != *l_eStatus_work) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSubscribeNotificationWithCallback()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = ErrorEventInit(hApp))) { // LCOV_EXCL_BR_LINE 6: function do not return error
+ // LCOV_EXCL_START 6: function do not return error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ErrorEventInit()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+#ifndef SS_SM_SKIP_HEARTBEAT_INIT
+ // LCOV_EXCL_BR_START 6: function do not return error, expect nsfw error
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = init_Heartbeat(hApp))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: function do not return error, expect nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("init_HeartBeat()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+#else
+#warning Test code - NOT calling init_Heartbeat(hApp)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: NOT calling init_Heartbeat(hApp)");
+#endif
+#undef SS_SM_SKIP_HEARTBEAT_INIT
+
+ // LCOV_EXCL_BR_START 6: function do not return error, expect nsfw error
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = init_process_launcher(hApp))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: function do not return error, expect nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("init_process_launcher()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ // LCOV_EXCL_BR_START 6: function do not return error, expect init error
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = start_process_launching(hApp))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: function do not return error, expect init error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("start_process_launching()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ // LCOV_EXCL_BR_START 6: function do not return error, expect nsfw error
+ if (eFrameworkunifiedStatusOK != (*l_eStatus_work = init_sysmem_monitor(hApp))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: function do not return error, expect nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("init_sysmem_monitor()");
+ *l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ /// Internal thread monitoring start
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_GroupLaunchTimer->StartTimer(m_aTimerIDs[eSM_TIMER_HEARTBEAT_MONITOR],
+ SS_HEARTBEAT_MONITOR_TIMER_CONFIG, 0,
+ SS_HEARTBEAT_MONITOR_TIMER_CONFIG, 0);
+
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_PROCESSLAUNCHER_MONITOR],
+ SS_PROCESSLAUNCHER_MONITOR_TIMER_CONFIG, 0,
+ SS_PROCESSLAUNCHER_MONITOR_TIMER_CONFIG, 0);
+
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_NPP_STATUS_CHECK_MONITOR],
+ SS_NPP_STATUS_CHECK_MONITOR_TIME_SEC, 0,
+ SS_NPP_STATUS_CHECK_MONITOR_TIME_SEC, 0);
+ // LCOV_EXCL_BR_STOP
+}
+
+
+/*****************************************************************************/
+/**
+ @ingroup: CSystemManager
+ @brief: Initialization
+ @note: .
+ @param HANDLE hApp
+ @return void
+ */
+/*****************************************************************************/
+EFrameworkunifiedStatus CSystemManager::Initialize(HANDLE hApp) {
+ bool l_isInitFail = false;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int ret;
+ PsmFactorT l_startup_factor;
+
+ // Need to call Lock System Initialize API once in the system
+ ret = CL_LockSystemInit();
+ if (ret != 0) {
+ fprintf(stderr, "SS_SysManager/%s/Error: CL_LockSystemInit() errored: %d\n", __FUNCTION__, ret);
+ }
+
+ ret = CL_LockProcessInit();
+ if (ret != 0) {
+ fprintf(stderr, "SS_SysManager/%s/Error: CL_LockProcessInit() errored: %d\n", __FUNCTION__, ret);
+ l_isInitFail = true;
+ }
+
+ ret = PsmGetStartupFactor(hApp, &l_startup_factor);
+ if (ret == 0) {
+ if ((static_cast<UI_32>(l_startup_factor) & PSM_RESET_HISTORY) == PSM_RESET_HISTORY) {
+ DGCODE_RET_API l_ret = DGCODE_RET_ERROR;
+ uint64_t l_SystemResetRobCode = 0;
+ DGCODE_ROB_SSR_INFO l_info;
+ if (l_startup_factor == PSM_FACTOR_AGL_WITH_HISTORY) {
+ l_SystemResetRobCode = 0x2219; // AGL cause
+ } else if (l_startup_factor == PSM_FACTOR_TIER1_WITH_HISTORY) {
+ l_SystemResetRobCode = 0x221A; // Tier1 cause
+ } else if (l_startup_factor == PSM_FACTOR_USER_WITH_HISTORY) {
+ l_SystemResetRobCode = 0x8027; // USER cause
+ } else {
+ // No processing
+ }
+
+ if (l_SystemResetRobCode != 0) {
+ memset(&l_info, 0x00, sizeof(DGCODE_ROB_SSR_INFO));
+
+ l_ret = Diag_PutRoBInfo(hApp, l_SystemResetRobCode, &l_info);
+ if (l_ret == DGCODE_RET_ERROR) {
+ LOG_ERROR("Diag_PutRoBInfo()");
+ }
+ }
+ }
+ } else {
+ (void)fprintf(stderr, "SS_SysManager/%s/ERROR:start-up factor not get\n", __FUNCTION__);
+ }
+
+ m_isIlgReset = (false == GetSyscomPowerStatusInfo(hApp)) ? TRUE : FALSE;
+ if (m_isIlgReset || ("elog" == m_bootOpt)) {
+ fprintf(stderr, "SS_SysManager/%s/Error: ILGRST LOG SAVE\n", __func__);
+ StoreDebugLogs(hApp, SS_STORELOGS_ILLEGAL);
+ } else {
+ StoreDebugLogs(hApp, SS_STORELOGS_ACCOFFON);
+ }
+
+ if (m_isIlgReset == TRUE) {
+ // overwrite AGL_ILLRESET_FLAG.
+ uint32_t tmp = static_cast<uint32_t>(m_isIlgReset);
+ if (PowerHalSetResetInfo(AGL_ILLRESET_FLAG, tmp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not set AGL_ILLRESET_FLAG to power_hal");
+ }
+ } else {
+ // keep last value of AGL_ILLRESET_FLAG.
+ }
+
+ FRAMEWORKUNIFIED_SET_ZONES();
+ NsLogSetLogMethod(LPRINT | LMSGQ);
+ // FRAMEWORKUNIFIEDLOG can not be used until this line
+
+ m_ClProcessSigFd = CL_ProcessInit(); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (m_ClProcessSigFd == -1) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: CL_ProcessInit()");
+ l_isInitFail = true;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = CL_MonitorInit(CL_MONITOR_INIT_SYSTEM);
+ if(ret != 0) {
+ fprintf(stderr, "SS_SysManager/%s/Error: CL_MonitorInit() errored: %d\n", __FUNCTION__, ret);
+ l_isInitFail = true;
+ }
+
+ // Threads MUST NOT be started until this line
+// ===== Initialization No.1
+ Initialize_memory(hApp, &l_isInitFail, &l_eStatus, m_isIlgReset);
+
+// ===== Initialization No.2
+ Initialize_callbacks(hApp, &l_isInitFail, &l_eStatus);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::SetEnvVariableForVupMode(BOOL bIsVupMode) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ const CHAR SmVupModeEnvVariable[] = "SM_VUP_MODE";
+ const CHAR *l_pValue = bIsVupMode ? "y" : "n"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (0 != setenv(SmVupModeEnvVariable, l_pValue, 1)) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT_ERRNO(0);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ return l_eStatus;
+}
+
+int CSystemManager::CreateRtUsb(void) {// LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int pid = -1;
+ int ret;
+
+ ret = mkdir("/var/run", 0775);
+ if ((ret < 0) && (errno != EEXIST)) {
+ return -1;
+ }
+ pid = fork();
+ switch (pid) {
+ case 0: /* child process */
+ {
+ struct sched_param param;
+ int policy;
+ const char *exec;
+ exec = const_cast<char *>(TR_USB_PATH);
+ param.sched_priority = 0;
+ policy = SCHED_OTHER;
+ if (sched_setscheduler(getpid(), policy, &param) < 0) {
+ SS_ASERT(0);
+ _exit(-1);
+ }
+ if (setpriority(PRIO_PROCESS, getpid(), 0) < 0) {
+ SS_ASERT(0);
+ _exit(-1);
+ }
+ // exec
+ if (execlp(exec, exec, NULL) < 0) {
+ SS_ASERT(0);
+ _exit(-1);
+ }
+ _exit(0);
+ }
+ break;
+
+ case -1: /* error */
+ SS_ASERT(0);
+ goto ERROR;
+
+ default: /* parent process */
+ break;
+ }
+
+ERROR:
+ return pid;
+}// LCOV_EXCL_STOP
+
+bool CSystemManager::StoreDebugLogs(const HANDLE h_app,
+ SS_STORELOGS_OPE_TYPE type) {
+ bool isMountRamd = false;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int pid;
+
+ if (!GetDramPowerStatusInfo(h_app)) {
+ goto ERROR;
+ } else if (access(SS_SM_TEMP_FILE_FOR_STORE_LOGS, F_OK) == 0) {
+ fprintf(stderr, "SS_SysManager/%s/Error: Skip StoreDebugLogs\n", __FUNCTION__);
+ goto ERROR;
+ }
+
+ isMountRamd = true;
+
+ if (type == SS_STORELOGS_ILLEGAL) {
+ UI_32 l_ErrLogCount = 0;
+ if (PowerHalGetResetInfo(AGL_ERRLOG_COUNTER, &l_ErrLogCount)) {
+ fprintf(stderr, "SS_SysManager/%s/Error: "
+ "Could not read AGL_ERRLOG_COUNTER from power_hal\n", __FUNCTION__);
+ goto ERROR;
+ }
+
+ if (l_ErrLogCount >= SS_SM_ERR_LOGGING_LIMIT) {
+ fprintf(stderr, "SS_SysManager/%s/Error: "
+ "Skip StoreDebugLogs by continuous error l_ErrLogCount=%lu\n",
+ __FUNCTION__, l_ErrLogCount);
+ goto ERROR;
+ }
+
+ l_ErrLogCount++;
+ if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, l_ErrLogCount)) {
+ // Just logging, don't go to ERROR.
+ fprintf(stderr, "SS_SysManager/%s/Error: "
+ "Could not write AGL_ERRLOG_COUNTER to power_hal\n", __FUNCTION__);
+ }
+ } else if (type == SS_STORELOGS_ACCOFFON) {
+ if (0 != unlink(SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG)) {
+ fprintf(stderr, "SS_SysManager/%s/Error: ACCOFFON LOG SAVE\n", __FUNCTION__);
+ } else {
+ goto ERROR;
+ }
+ }
+
+ pid = fork();
+ if (pid == 0) {
+ int fd = open(SS_SM_TEMP_FILE_FOR_STORE_LOGS,
+ O_CREAT | O_TRUNC | O_RDWR, 00664);
+ if (-1 == fd) { // LCOV_EXCL_BR_LINE 5:fd must not be -1
+ fprintf(stderr, "SS_SysManager/%s/Error: Failed open %s errno: %d\n",
+ __FUNCTION__, SS_SM_TEMP_FILE_FOR_STORE_LOGS, errno);
+ } else {
+ fsync(fd);
+ close(fd);
+ }
+ FRAMEWORKUNIFIED_SET_ZONES(); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ NsLogSetLogMethod(LPRINT | LMSGQ);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = SS_LoggerStoreLogs(type))) { // LCOV_EXCL_BR_LINE 200: always return OK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fprintf(stderr, "SS_SysManager/%s/Error: SS_LoggerStoreDebugLogs() errored: %d\n", __FUNCTION__, l_eStatus); // LCOV_EXCL_LINE 200: always return OK // NOLINT(whitespace/line_length)
+ }
+ // Close accessing the RAMD by FRAMEWORKUNIFIEDLOG for RAMD initialization
+ NsForceClose();
+
+ if (0 != unlink(SS_SM_TEMP_FILE_FOR_STORE_LOGS)) {
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ exit(0);
+ } else if (pid == -1) { // LCOV_EXCL_BR_LINE 5:fork error case
+ // LCOV_EXCL_START 5:fork error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fprintf(stderr, "SS_SysManager/%s/Error: ASSERT %d\n", __FUNCTION__, __LINE__);
+ // LCOV_EXCL_STOP
+ } else {
+ if (-1 == waitpid(pid, NULL, 0)) { // LCOV_EXCL_BR_LINE 5:waitpid error case
+ // LCOV_EXCL_START 5:waitpid error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fprintf(stderr, "SS_SysManager/%s/Error: ASSERT %d\n", __FUNCTION__, __LINE__);
+ // LCOV_EXCL_STOP
+ }
+ }
+ ERROR:
+ return isMountRamd;
+}
+
+#define SS_SM_SCAC_DEVICE_NODE "/dev/scac_driver"
+#define SS_SM_SCAC_CMD_SHUTDOWN 0x3000
+
+EFrameworkunifiedStatus CSystemManager::SecureChipOff() {
+ static bool isOffDone = false;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int32_t fd;
+ int32_t res;
+
+ if (!isOffDone) {
+ fd = open(SS_SM_SCAC_DEVICE_NODE, O_RDWR);
+ if (fd < 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) ERR", SS_SM_SCAC_DEVICE_NODE);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ res = ioctl(fd, SS_SM_SCAC_CMD_SHUTDOWN);
+ if (res < 0) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ioctl(SS_SM_SCAC_CMD_SHUTDOWN) ERR");
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ close(fd);
+ }
+
+ isOffDone = true;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Skip Chip Off");
+ }
+
+ return l_eStatus;
+}
+
+UI_32 CSystemManager::InProgressStateToSendMsg() const {
+ UI_32 l_iCmd = SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX;
+ switch (m_SMCurrentState) {
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ l_iCmd = SS_SM_PRE_START;
+ break;
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ l_iCmd = SS_SM_PRE_STOP;
+ break;
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ l_iCmd = SS_SM_BACKGROUND_START;
+ break;
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ l_iCmd = SS_SM_BACKGROUND_STOP;
+ break;
+ case SS_SM_APPS_START_IN_PROGRESS:
+ l_iCmd = SS_SM_START;
+ break;
+ default:
+ break;
+ }
+ return l_iCmd;
+}
+
+SMModuleState CSystemManager::InProgressStateToState() const {
+ SMModuleState l_state = MODULE_STATE_INVALID;
+ switch (m_SMCurrentState) {
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ l_state = MODULE_STATE_STARTED_PRE;
+ break;
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ l_state = MODULE_STATE_STOPPED_PRE;
+ break;
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ l_state = MODULE_STATE_STARTED_BACKGROUND;
+ break;
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ l_state = MODULE_STATE_STOPPED_BACKGROUND;
+ break;
+ case SS_SM_APPS_START_IN_PROGRESS:
+ l_state = MODULE_STATE_STARTED;
+ break;
+ default:
+ break;
+ }
+ return l_state;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SetSystemModeInfoStruct
+/// Read ( or initialize ) NVM and set the SystemModeInfo structure
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::SetSystemModeInfoStruct() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (m_UsingVMPlayer) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " 'm_UsingVMPlayer' is True,"
+ " using default SystemModeInfo values");
+ m_SystemModeInfo.limpHomeCutoff = epslhcDISABLED;
+ m_SystemModeInfo.productionMode = epspmDISABLED;
+ m_SystemModeInfo.transportMode = epstmDISABLED;
+ m_SystemModeInfo.systemMode = epssinfNORMAL;
+ m_DataResetMode = e_SS_SM_DATA_RESET_MODE_NONE;
+ m_ResetCount = 0;
+ m_ProgUpdateState = SS_SM_PROG_UPDATE_STATE_NONE;
+ // Don't change the m_SystemModeInfo.startupStage.
+ // It is set dynamically as System Manager initializes the _CWORD102_.
+ } else {
+ uint32_t tmp = 0;
+ if (PowerHalGetResetInfo(AGL_RESET_COUNTER, &m_ResetCount)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not read AGLRESET_COUNTER from power_hal, assume to 0");
+ m_ResetCount = 0;
+ }
+
+ if (PowerHalGetResetInfo(AGL_PROGUPDATE_STATE, &m_ProgUpdateState)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not read AGL_PROGUPDATE_STATE from power_hal, "
+ "assume to SS_SM_PROG_UPDATE_STATE_NONE");
+ m_ProgUpdateState = SS_SM_PROG_UPDATE_STATE_NONE;
+ }
+
+ if (PowerHalGetResetInfo(AGL_DATARESET_STATE, &tmp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not read AGL_DATARESET_STATE from power_hal, "
+ "assume to e_SS_SM_DATA_REESET_MODE_NONE");
+ m_DataResetMode = e_SS_SM_DATA_RESET_MODE_NONE;
+ } else {
+ m_DataResetMode = static_cast<ESMDataResetModeInfo>(tmp);
+ }
+ m_SystemModeInfo.systemMode = epssinfNORMAL;
+ } // End else ! m_UsingVMPlayer
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::SetSystemModeInfoStruct()
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ClearDramBackupInfo
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ClearDramBackupInfo(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int ret;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "PsmClrRamJudgeFlgPower()");
+ ret = PsmClrRamJudgeFlgPower(hApp);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 11: Excluded due to gcov constraints (others)
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup CloseApplication
+/// Process request to close Application
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::CloseApplication(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE))) {
+ LOG_ERROR("FrameworkunifiedPublishServiceAvailability(hApp,FALSE)");
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus =
+ FrameworkunifiedUnRegisterServiceAvailabilityNotification(hApp))) {
+ LOG_ERROR("FrameworkunifiedUnRegisterServiceAvailabilityNotification(hApp)");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Successful");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::CloseApplication(HANDLE hApp)
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SMStateStartCompleteEntry
+/// entry for SM module state(SS_SM_APPS_START_COMPLETE)
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::SMStateStartCompleteEntry(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "All %d groups have been sent system_manager protocol message, sending Start Complete to _CWORD56_",
+ m_SystemStarter.get_id());
+ CALL_AND_LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ send_power_request_complete_response(hApp, "Startup")); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ CALL_AND_LOG_STATUS(PublishPowerOnOffNotification(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (m_InitialBoot == true) {
+ m_InitialBoot = false;
+
+ const ESMServiceWakeupStatus l_svcWupStatus = e_SS_SM_SVC_WAKEUP_STATUS_COMPLETE;
+
+ CALL_AND_LOG_STATUS( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FrameworkunifiedNPPublishNotification(hApp, NTFY_SSServiceWakeupStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ &l_svcWupStatus, sizeof(ESMServiceWakeupStatus))); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // If all modules are restarted, a passive warning will be issued
+ // indicating that Heartbeat is already running.
+
+ UI_32 l_list_num = static_cast<UI_32>(m_HBList.size());
+ if (SS_MAX_NUM_MODULES < l_list_num) {
+ l_list_num = SS_MAX_NUM_MODULES;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warn: SS_MAX_NUM_MODULES '%d' < m_HBList.size '%d'",
+ SS_MAX_NUM_MODULES, l_list_num);
+ }
+
+ CHAR send_data[sizeof(l_list_num)
+ + (l_list_num * SS_SM_HB_MAX_PROC_NAME_SIZE)
+ + sizeof(m_SMConfig.HBConfig)];
+ CHAR* p_prm = &send_data[0];
+
+ memcpy(p_prm, reinterpret_cast<char *>(&m_SMConfig.HBConfig), sizeof(m_SMConfig.HBConfig));
+ p_prm = p_prm + sizeof(m_SMConfig.HBConfig);
+ memcpy(p_prm, reinterpret_cast<char *>(&l_list_num), sizeof(l_list_num));
+ p_prm = p_prm + sizeof(l_list_num);
+
+ for (UI_32 i = 0; i < l_list_num; i++) {
+ snprintf(p_prm, SS_SM_HB_MAX_PROC_NAME_SIZE, "%s", m_HBList[i].c_str());
+ p_prm = p_prm + SS_SM_HB_MAX_PROC_NAME_SIZE;
+ }
+ l_eStatus = SendRequestToHeartBeat(hApp, SS_HEARTBEAT_START, &send_data, static_cast<UI_32>(sizeof(send_data))); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "SendRequestToHeartBeat()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ m_DataResetMode = e_SS_SM_DATA_RESET_MODE_NONE;
+ {
+ uint32_t tmp = static_cast<uint32_t>(m_DataResetMode);
+ if (PowerHalSetResetInfo(AGL_DATARESET_STATE, tmp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not set AGL_DATARESET_STATE to power_hal");
+ }
+ }
+
+ m_ProgUpdateState = SS_SM_PROG_UPDATE_STATE_NONE;
+ if (PowerHalSetResetInfo(AGL_PROGUPDATE_STATE, m_ProgUpdateState)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not set AGL_PROGUPDATE_STATE to power_hal");
+ }
+
+ m_isIlgReset = FALSE;
+ {
+ uint32_t tmp = static_cast<uint32_t>(m_isIlgReset);
+ if (PowerHalSetResetInfo(AGL_ILLRESET_FLAG, tmp)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not set AGL_ILLRESET_FLAG to power_hal");
+ }
+ }
+
+ if (access(SS_SM_TEMP_FILE_FOR_STORE_LOGS, F_OK) == 0) {
+ SS_ASERT_ERRNO(0 == unlink(SS_SM_TEMP_FILE_FOR_STORE_LOGS)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ for (vector<std::string>::iterator protectedSvc =
+ m_productCustomPrm.protectedSvcs.begin();
+ protectedSvc != m_productCustomPrm.protectedSvcs.end();
+ protectedSvc++) {
+ ModuleLaunchListIter l_ModuleListIter;
+ l_eStatus = GetModuleIterator(protectedSvc->c_str(), l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if ((l_ModuleListIter->IsModuleState(MODULE_STATE_STARTED))
+ || (l_ModuleListIter->IsModuleState(MODULE_STATE_LAUNCHED)
+ && !l_ModuleListIter->is_start_required)) {
+ char pathBuf[128];
+
+ snprintf(pathBuf, 128, "/proc/%d/oom_score_adj", l_ModuleListIter->pid); // NOLINT
+ std::ofstream fo(pathBuf); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ fo << OOM_SCORE_ADJ_MIN << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ fo.close(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "set OOM_SCORE_ADJ_MIN(%s/%d)",
+ l_ModuleListIter->name.c_str(), l_ModuleListIter->pid);
+ } else {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ for (vector<std::string>::iterator groupRelaunchSvc =
+ m_productCustomPrm.groupRelaunchSvcs.begin();
+ groupRelaunchSvc != m_productCustomPrm.groupRelaunchSvcs.end();
+ groupRelaunchSvc++) {
+ ModuleLaunchListIter l_ModuleListIter;
+ l_eStatus = GetModuleIterator(groupRelaunchSvc->c_str(), l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if ((l_ModuleListIter->IsModuleState(MODULE_STATE_STARTED))
+ || (l_ModuleListIter->IsModuleState(MODULE_STATE_LAUNCHED)
+ && !l_ModuleListIter->is_start_required)) {
+ GroupRelaunchModuleParams l_param; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_param.name = l_ModuleListIter->name.c_str();
+ m_GroupRelaunchModuleList.push_back(l_param);
+
+ if (l_ModuleListIter->retry_cnt > m_GroupRelaunchLimit) {
+ m_GroupRelaunchLimit = l_ModuleListIter->retry_cnt;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "GroupRelaunchSvcs:%s(%d)",
+ l_ModuleListIter->name.c_str(), l_ModuleListIter->pid);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s is not Launched", groupRelaunchSvc->c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s is not exist", groupRelaunchSvc->c_str());
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "GroupRelaunchLimit:%d", m_GroupRelaunchLimit);
+
+ SendDeferMsg(hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+} // End of VOID CSystemManager::SMStateStartCompleteEntry()
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SMStateEntry
+/// entry for SM module state
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::SMStateEntry(HANDLE hApp, SS_SMModuleState l_SMState) {
+ switch (l_SMState) {
+ case SS_SM_APPS_START_COMPLETE:
+ case SS_SM_APPS_PRE_RUN_COMPLETE:
+ case SS_SM_APPS_BACKGROUND_RUN_COMPLETE:
+ SMStateStartCompleteEntry(hApp);
+ break;
+ default:
+ break;
+ }
+} // End of VOID CSystemManager::SMStateEntry(SS_SMModuleState l_SMState)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SMStateExit
+/// exit for SM module state
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::SMStateExit(HANDLE hApp, SS_SMModuleState l_SMState) {
+ switch (l_SMState) {
+ case SS_SM_APPS_START_COMPLETE:
+ break;
+ default:
+ break;
+ }
+} // End of VOID CSystemManager::SMStateExit(SS_SMModuleState l_SMState)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SMSetState
+/// set module state
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::SMSetState(HANDLE hApp, SS_SMModuleState l_SMNewState) {
+ // FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s -> %s",
+ GetStr(m_SMCurrentState).c_str(), GetStr(l_SMNewState).c_str());
+
+ if (l_SMNewState != m_SMCurrentState) {
+ SMStateExit(hApp, m_SMCurrentState);
+
+ m_SMCurrentState = l_SMNewState;
+
+ SMStateEntry(hApp, m_SMCurrentState);
+ }
+ // FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup register_all_notification_callbacks
+/// register all notifications and callbacks with NP_NPS
+/// this function gets called when NP_NPS reply launch complete
+///
+/// \param
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::register_all_notification_callbacks(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FrameworkunifiedNotificationsList userModeNotificationsBOOL[] = { {
+ NTFY_SSSystemMgrPowerOnOff, sizeof(BOOL), eFrameworkunifiedStateVar }, {
+ NTFY_SSSystemMgrUserMode, sizeof(BOOL), eFrameworkunifiedStateVar } };
+
+ FrameworkunifiedNotificationsList userModeNotificationsStruct[] = { {
+ NTFY_SSSystemMgrPowerOnOff,
+ sizeof(T_SS_SM_UserModeOnOffNotification_Struct), eFrameworkunifiedStateVar }, {
+ NTFY_SSSystemMgrUserMode,
+ sizeof(T_SS_SM_UserModeOnOffNotification_Struct), eFrameworkunifiedStateVar } };
+
+ FrameworkunifiedNotificationsList sm_notifications[] = {
+ { NTFY_SSSystemMgrStartUpType, sizeof(EPWR_SC_WAKEUP_TYPE), eFrameworkunifiedStateVar },
+ { NTFY_SSSystemMgrDataReset, sizeof(ESMDataResetType), eFrameworkunifiedStateVar },
+ { NTFY_SSSystemMgrShutdownStarted, 0, eFrameworkunifiedStateVar },
+ { NTFY_SSServiceWakeupStatus, sizeof(ESMServiceWakeupStatus), eFrameworkunifiedStateVar },
+ { NTFY_SSNeedAplRestart, 0, eFrameworkunifiedStateVar } };
+
+ if (m_SMConfig.UMConfig.IsUserModeNotificationABOOL) {
+ l_eStatus = FrameworkunifiedNPRegisterNotifications(hApp, userModeNotificationsBOOL,
+ static_cast<UI_32>(_countof(userModeNotificationsBOOL)));
+ } else {
+ l_eStatus = FrameworkunifiedNPRegisterNotifications(hApp,
+ userModeNotificationsStruct,
+ static_cast<UI_32>(_countof(userModeNotificationsStruct)));
+ }
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("FrameworkunifiedNPRegisterNotifications(userModeNotifications)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedNPRegisterNotifications(hApp, sm_notifications, static_cast<UI_32>(_countof(sm_notifications))))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedNPRegisterNotifications(sm_notifications)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hApp, NTFY_SSSystemMgrAvailability))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedRegisterServiceAvailabilityNotification(" // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ NTFY_SSSystemMgrAvailability ")"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, TRUE))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedPublishServiceAvailability('NTFY_SSSystemMgrAvailability ', TRUE)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ LOG_SUCCESS("FrameworkunifiedPublishServiceAvailability('NTFY_SSSystemMgrAvailability ', TRUE)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ REC_HIST_IF_SUCCESSFUL(NTFY_SSSystemMgrAvailability, m_PubCmdHist, // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ m_PubHistIter, "", l_eStatus); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::init_Heartbeat(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FrameworkunifiedProtocolCallbackHandler hb_protocol_callbacks[] = { {
+ SS_HEARTBEAT_PERIODIC_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnHeartBeatThreadHeartbeatResponse> }, {
+ SS_HEARTBEAT_ERROR_DETECTED, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnHeartBeatErrorDetected> }, {
+ SS_HEARTBEAT_AVAIL_CHECK_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnCheckAvailResponse> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+ // Subscribe to Notifications (All required notifications)
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp, SS_SMHeartbeat, hb_protocol_callbacks, static_cast<UI_32>(_countof(hb_protocol_callbacks))))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher(hb_notification_handlers)");
+ // LCOV_EXCL_STOP
+ } else if (NULL == (m_hHeartbeatThread.m_ThreadHdl = FrameworkunifiedCreateChildThreadWithPriority(hApp, SS_SMHeartbeat, HBThreadStart, HBThreadStop, PR_SMHEARTBEAT))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusThreadNotExist;
+ m_hHeartbeatThread.m_ThreadState = eSM_ThreadNotExist;
+ LOG_ERROR("FrameworkunifiedCreateChildThreadWithPriority(hApp, SS_SMHeartbeat)");
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(hApp, m_hHeartbeatThread.m_ThreadHdl, 0, NULL))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ m_hHeartbeatThread.m_ThreadState = eSM_ThreadNotExist;
+ LOG_ERROR("FrameworkunifiedStartChildThread(SS_SMHeartbeat)");
+ // LCOV_EXCL_STOP
+ } else {
+ m_hHeartbeatThread.m_ThreadState = eSMThreadIsFine;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::init_sysmem_monitor(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FrameworkunifiedProtocolCallbackHandler sysmem_protocol_callbacks[] = { {
+ eSysMemThrdCmd_SYS_LOW_MEMORY, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnLowSystemMemory> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_BR_START 4: For setting the initialization conditions at SystemManager startup
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(
+ hApp,
+ m_SysMemMonitor.GetThreadName().c_str(), sysmem_protocol_callbacks,
+ static_cast<UI_32>(_countof(sysmem_protocol_callbacks))))) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher()"); // LCOV_EXCL_LINE 4: For setting the initialization conditions at SystemManager startup
+ } else {
+ m_SysMemMonitor.SetSLMConfigData(m_SMConfig.SLMConfig); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_eStatus = m_SysMemMonitor.Initialize(hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_ERROR_REC_HIST_IF_ERRORED // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ (l_eStatus, "m_SysMemMonitor.Initialize(hApp);"); // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnGroupLaunchTimerExpiry(HANDLE hThread) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_launchID = m_oSystemLauncher.get_id();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, " Received from group %d", l_launchID);
+ REC_HIST_IF_SUCCESSFUL("SM_TIMER_GROUP_MONITOR", m_TimerCmdHist,
+ m_TimerHistIter, "TIMER", l_eStatus);
+
+ LogGroupModulesState(l_launchID,
+ " Group launch timer expired, processing next group.");
+
+ if (NULL == hThread) {
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ LOG_ERROR("NULL == hThread");
+ } else {
+ // FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Timer expired for group id,%d",m_oSystemLauncher.get_id());
+ if (!m_oSystemLauncher.is_end()) {
+ l_launchID = m_oSystemLauncher.advance_id();
+ if (eFrameworkunifiedStatusOK != (l_eStatus = OnLaunchGroup(hThread))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: OnLaunchGroup(%d) errored: %d/'%s'", l_launchID,
+ l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnGroupLaunchTimerExpiry( HANDLE hThread )
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::FindNameOfTerminatedProcess(SI_32 f_pid, SS_String &f_ModuleName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ if (l_GroupIterator == m_MapProclaunchGrps.end()) { // LCOV_EXCL_BR_LINE 200: Group Map cannot be empty
+ // LCOV_EXCL_START 200: Group Map cannot be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : Group Map empty"); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ // LCOV_EXCL_STOP
+ } else {
+ BOOL l_bModuleFound = FALSE;
+ for (; (FALSE == l_bModuleFound)
+ && (l_GroupIterator != m_MapProclaunchGrps.end());
+ l_GroupIterator++) {
+ ModuleLaunchListIter l_ModuleListIterator =
+ l_GroupIterator->second.modules.begin();
+ for (; (FALSE == l_bModuleFound)
+ && (l_ModuleListIterator
+ != l_GroupIterator->second.modules.end());
+ l_ModuleListIterator++) {
+ if (l_ModuleListIterator->pid == f_pid) {
+ l_bModuleFound = TRUE;
+ f_ModuleName = l_ModuleListIterator->name;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::GetBinaryNameOfProcess(SS_String f_ModuleQueueName,
+ SS_String &f_ModuleBinaryName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ ModuleLaunchListIter l_moduleIter;
+
+ f_ModuleBinaryName = "";
+ l_eStatus = GetModuleIterator(f_ModuleQueueName.c_str(), l_moduleIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("GetModuleIterator()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ size_t l_pos = l_moduleIter->path.find_last_of("\\/");
+ if (std::string::npos == l_pos) { // LCOV_EXCL_BR_LINE 5: stdlib error case.
+ // LCOV_EXCL_START 5: stdlib error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Unable to parse binary name from path %s.",
+ l_moduleIter->path.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ f_ModuleBinaryName = l_moduleIter->path.substr(l_pos + 1);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::init_process_launcher(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ UI_32 TODO = 0;
+
+ FrameworkunifiedProtocolCallbackHandler process_launcher_protocol_callbacks[] = {
+ // Command ID, Call back functions
+ { ePLThrdCmd_LAUNCH_MODULE_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnModuleLaunchResponse> },
+ { ePLThrdCmd_TERMINATE_MODULE_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnTerminateModuleResponse> },
+ { ePLThrdCmd_RELAUNCH_MODULE_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnReLaunchModuleResponse> },
+ { ePLThrdCmd_THREAD_STATUS_RESP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnProcessLauncherThreadHeartbeatResponse> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // setup call backs for my children
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp, SS_SMLauncher, process_launcher_protocol_callbacks, static_cast<UI_32>(_countof(process_launcher_protocol_callbacks))))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher()"); // LCOV_EXCL_LINE 4: For setting the initialization conditions at SystemManager startup
+ //////// Create Writer Child Threads handles the writing of data
+ } else if (NULL == (m_hProcLauncherThread.m_ThreadHdl = FrameworkunifiedCreateChildThreadWithPriority(hApp, SS_SMLauncher, ProcessLauncherOnStart, ProcessLauncherOnStop, PR_SMPROCLAUNCH))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer;
+ m_hProcLauncherThread.m_ThreadState = eSM_ThreadNotExist;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedCreateChildThreadWithPriority(%s) errored: %d/'%s'",
+ SS_SMLauncher, l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(hApp, m_hProcLauncherThread.m_ThreadHdl, sizeof(UI_32), &TODO))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ m_hProcLauncherThread.m_ThreadState = // LCOV_EXCL_LINE 4: For setting the initialization conditions at SystemManager startup
+ eSM_ThreadNotExist; // LCOV_EXCL_LINE 4: For setting the initialization conditions at SystemManager startup
+ LOG_ERROR("FrameworkunifiedStartChildThread()"); // LCOV_EXCL_LINE 4: For setting the initialization conditions at SystemManager startup
+ } else {
+ m_hProcLauncherThread.m_ThreadState = eSMThreadIsFine;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnGroupLaunchWaitTimeout(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ SetCmdHist("SM_TIMER_GROUP_LAUNCH_WAIT_TIMER", m_TimerCmdHist, m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnModuleLaunchResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ GroupLaunchMapIter l_GroupIter;
+ ModuleLaunchListIter l_ModuleIter;
+ UI_32 l_launchID = m_oSystemLauncher.get_id();
+
+ l_eStatus = PerformModuleLaunchRespProcessing(hApp, l_GroupIter, l_ModuleIter, "ML");
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("PerformModuleLaunchRespProcessing()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (l_GroupIter->second.id == l_launchID) {
+ BOOL IsGroupLaunchComplete = TRUE;
+ // Search the group for any module that has not completed launching.
+ for (l_ModuleIter = l_GroupIter->second.modules.begin();
+ IsGroupLaunchComplete && (l_ModuleIter != l_GroupIter->second.modules.end());
+ l_ModuleIter++) {
+ IsGroupLaunchComplete = !l_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHING);
+ }
+
+ if (IsGroupLaunchComplete) {
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_GROUP_MONITOR]);
+ l_GroupIter->second.launch_complete = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Group%d LaunchComp", l_GroupIter->second.id);
+
+ if (!m_oSystemLauncher.is_end()) {
+ l_launchID = m_oSystemLauncher.advance_id();
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Next group:%d", l_launchID);
+ if (FALSE == l_GroupIter->second.grp_wait_for_trigger) {
+ UI_32 l_Sec = (l_GroupIter->second.grp_launch_wait) / (1000 * 1000);
+ UI_32 l_mSec = 0;
+ if (l_Sec > 0) {
+ l_mSec = ((l_GroupIter->second.grp_launch_wait) % (1000 * 1000)) / 1000;
+ } else {
+ l_mSec = (l_GroupIter->second.grp_launch_wait) / 1000;
+ }
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_GROUP_LAUNCH_WAIT_TIMER], l_Sec, l_mSec, 0, 0);
+ } else {
+ // Start the timer for group trigger... added for optimization
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_LAUNCH_GROUP_TRIGGER_PROC_RESP_TIMER],
+ SS_LAUNCH_GROUP_TRIGGER_TIMER_CONFIG, 0, 0, 0);
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Group %d/%s LaunchIncomp", l_launchID,
+ l_GroupIter->second.name.c_str());
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " '%s' ( Group %d/%s ) Launch Response received late - "
+ "group id is now %d", l_ModuleIter->name.c_str(),
+ l_GroupIter->second.id, l_GroupIter->second.name.c_str()
+ , l_launchID);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnReLaunchModuleResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ GroupLaunchMapIter l_GroupIter;
+ ModuleLaunchListIter l_ModuleIter;
+
+ l_eStatus = PerformModuleLaunchRespProcessing(hApp, l_GroupIter, l_ModuleIter, "RL");
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "PerformModuleLaunchRespProcessing()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnReLaunchModuleResponse( HANDLE hApp )
+
+
+EFrameworkunifiedStatus CSystemManager::PerformModuleLaunchRespProcessing(HANDLE hApp,
+ GroupLaunchMapIter & f_GroupIter, ModuleLaunchListIter & f_ModuleIter,
+ PCSTR p_sPPD_tag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ T_ProcessLaunchResp l_LaunchRespData;
+
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < T_ProcessLaunchResp > (hApp, l_LaunchRespData))) { // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ BOOL b_DidModuleLaunch = FALSE;
+ f_GroupIter = l_LaunchRespData.groupIterator;
+ f_ModuleIter = l_LaunchRespData.moduleIterator;
+ SS_String l_ModulePath = l_LaunchRespData.path;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "%s(%d)", l_LaunchRespData.name, l_LaunchRespData.pid);
+
+ if (l_LaunchRespData.pid == -1) {
+ f_ModuleIter->pid = -1;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Process launch failed: %s, %s",
+ f_ModuleIter->name.c_str(), l_ModulePath.c_str());
+
+ /// TODO
+ /// If PID is -1, launch had failed. Add logic to do necessary action.
+
+ f_ModuleIter->SetModuleState(MODULE_STATE_LAUNCH_FAILED);
+ } else if (l_LaunchRespData.pid == 0x7FFFFFFF) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warning: '%s', '%s' already launched",
+ f_ModuleIter->name.c_str(), l_ModulePath.c_str());
+
+ b_DidModuleLaunch = TRUE;
+ } else {
+ f_ModuleIter->pid = l_LaunchRespData.pid;
+ b_DidModuleLaunch = TRUE;
+ }
+
+ if (b_DidModuleLaunch) {
+ //
+ // Module state could already be MODULE_STATE_CONNECTED if
+ // module process ran before process launcher thread completed;
+ // don't overwrite/reset the MODULE_STATE_CONNECTED state.
+ if (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHING)) {
+ f_ModuleIter->SetModuleState(MODULE_STATE_LAUNCHED);
+ }
+
+ l_eStatus = f_ModuleIter->GetPriority(f_ModuleIter->current_priority);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warning: f_ModuleIter->GetPriority( "
+ "f_ModuleIter->current_priority ) returned %d/'%s'. "
+ "Setting 'current_priority' = 'configuration_priority' %d.",
+ l_eStatus, GetStr(l_eStatus).c_str(),
+ f_ModuleIter->configuration_priority);
+ f_ModuleIter->current_priority = f_ModuleIter->configuration_priority;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::PerformModuleLaunchRespProcessing(
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnTerminateModuleResponse
+///
+/// \param HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnTerminateModuleResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ T_ProcessLauncherTerminationResp l_TerminateRespData;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < T_ProcessLauncherTerminationResp
+ > (hApp, l_TerminateRespData))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ ModuleLaunchListIter l_ModuleIter = l_TerminateRespData.moduleIterator;
+
+ SS_String l_ModulePath = m_BinaryFilesPath + l_ModuleIter->path;
+
+ if ((0 == strcmp(l_ModulePath.c_str(), l_TerminateRespData.path))
+ && (0 == strcmp(l_ModuleIter->arguments.c_str(),
+ l_TerminateRespData.args))) {
+ l_ModuleIter->pid = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s Termination successful",
+ l_ModuleIter->name.c_str());
+ } else {
+ if (0 != strcmp(l_ModulePath.c_str(), l_TerminateRespData.path)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: ModuleIter->path != l_TerminateRespData.path"
+ " \" '%s' != '%s' \"", l_ModuleIter->path.c_str(),
+ l_TerminateRespData.path);
+ }
+ if (0 != strcmp(l_ModuleIter->arguments.c_str(),
+ l_TerminateRespData.args)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: ModuleIter->arguments != "
+ "l_TerminateRespData.args, \" '%s' != '%s' \"",
+ l_ModuleIter->arguments.c_str(), l_TerminateRespData.args);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnTerminateModuleResponse( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////
+/// \ingroup ReadPathAndFileNameEnvironmentVariables
+///
+/// \param
+///
+/// \return VOID
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::ReadPathFromEnvironmentVariables() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ CHAR *l_pEnvVariable = NULL;
+
+ // read Path from environment variable
+ if (NULL == (l_pEnvVariable = std::getenv(BaseDirPathEnvVariable))) {
+ // Environment variable not set, set it to default path
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Using Default path for Binary Files : %s", DefaultBasePath);
+ m_BinaryFilesPath = DefaultBasePath;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Using Default path for Config Files : %s%s",
+ DefaultBasePath, DefaultConfigFilesPath);
+ m_ConfigFilesPath = DefaultBasePath;
+ } else {
+ // set path of binary files
+ m_BinaryFilesPath = l_pEnvVariable;
+
+ // set path of configuration files
+ m_ConfigFilesPath = l_pEnvVariable;
+ }
+ // set path of configuration files
+ m_ConfigFilesPath += DefaultConfigFilesPath;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// \ingroup GetConfigDataFileNameFromEnvironmentVariable
+///
+/// \param
+///
+/// \return SS_String
+///////////////////////////////////////////////////////////////////////////////
+SS_String CSystemManager::ReadLaunchConfigFileNameFromEnvironmentVariable() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR *l_pEnvVariable = NULL;
+ SS_String l_FileName;
+
+ // read Launch Config File Name from environment variable
+ // LCOV_EXCL_BR_START 5: standard lib error
+ if (NULL == (l_pEnvVariable = std::getenv(LaunchConfigFileNameEnvVariable))) {
+ // LCOV_EXCL_BR_STOP
+ // Environment variable not set, set it to default file name
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Using Default Launch Configuration file : %s",
+ DefaultLaunchConfigFileName);
+ l_FileName = DefaultLaunchConfigFileName;
+ // LCOV_EXCL_STOP
+ } else {
+ l_FileName = l_pEnvVariable;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Using Launch Configuration file: %s", l_FileName.c_str());
+
+ SS_String retStr = m_ConfigFilesPath + l_FileName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (access(retStr.c_str(), F_OK) != 0) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "no found %s", retStr.c_str());
+ SS_ASERT(0);
+ // LCOV_EXCL_STOP
+ }
+ return retStr;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// \ingroup GetConfigDataFileNameFromEnvironmentVariable
+///
+/// \param
+///
+/// \return SS_String
+///////////////////////////////////////////////////////////////////////////////
+SS_String CSystemManager::ReadConfigDataFileNameFromEnvironmentVariable() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR *l_pEnvVariable = NULL;
+ SS_String l_FileName = "";
+
+ // read SM Config Data File Name from environment variable
+ // LCOV_EXCL_BR_START 5: standard lib error
+ if (NULL == (l_pEnvVariable = std::getenv(SMConfigDataFileNameEnvVariable))) {
+ // LCOV_EXCL_BR_STOP 5: standard lib error
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // Environment variable not set, set it to default file name
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Using Default Configuration Data file : %s", DefaultSMConfigFileName);
+ l_FileName = DefaultSMConfigFileName;
+ // LCOV_EXCL_STOP
+ } else {
+ l_FileName = l_pEnvVariable;
+ }
+
+ SS_String retStr = m_ConfigFilesPath + l_FileName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (access(retStr.c_str(), F_OK) != 0) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "no found %s", retStr.c_str());
+ SS_ASERT(0);
+ // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return retStr;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// \ingroup ReadUsingVMPlayerEnvironmentVariable
+///
+/// \param
+///
+/// \return VOID
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::ReadUsingVMPlayerEnvironmentVariable() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR *l_pEnvVariable = std::getenv(UsingVMPlayerVariable);
+ m_UsingVMPlayer = (NULL != l_pEnvVariable);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %sunning on a VMPlayer",
+ m_UsingVMPlayer ? "R" : "Not r");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return;
+} // End of VOID CSystemManager::ReadUsingVMPlayerEnvironmentVariable()
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::start_process_launching(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_bIsGoodRc;
+ SS_String l_SMConfigFile(ReadConfigDataFileNameFromEnvironmentVariable());
+ SMConfigParams SMConfigData;
+ SS_String l_LaunchConfigFile(ReadLaunchConfigFileNameFromEnvironmentVariable()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SysMgrConfiguration l_launchConfig;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Reading %s Configuration Data from %s",
+ SERVICE_SYSMANAGER, l_SMConfigFile.c_str());
+
+ l_bIsGoodRc = SMConfigData.LoadSMConfigParameters(m_SMConfig, l_SMConfigFile);
+
+ if (!l_bIsGoodRc) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SMConfigData.LoadSMConfigParameters(m_SMConfig, "
+ " %s) returned FALSE", l_SMConfigFile.c_str());
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ // LCOV_EXCL_STOP
+ } else {
+ SMSetState(hApp, SS_SM_APPS_LAUNCH_IN_PROGRESS); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Reading Launch Configuration Data from %s",
+ l_LaunchConfigFile.c_str());
+
+ SS_String l_launchOrderName = "DEFAULT"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LaunchOrderedVector l_OrderList;
+
+ l_bIsGoodRc = l_launchConfig.LoadParametersCfg(m_MapProclaunchGrps,
+ m_MapProcNames, l_OrderList, l_launchOrderName, l_LaunchConfigFile);
+
+ if (l_OrderList.size() != 0) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "wakeup order:%s",
+ l_launchOrderName.c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "wakeup order:DEFAULT");
+ }
+
+ if (!l_bIsGoodRc) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: l_launchConfig.LoadParametersCfg( "
+ "m_MapProclaunchGrps, m_MapProcNames, %s ) returned FALSE",
+ l_LaunchConfigFile.c_str());
+ l_eStatus = eFrameworkunifiedStatusFileLoadError;
+ // LCOV_EXCL_STOP
+ } else {
+ m_SystemLaunchProgress = SS_SM_INITIAL_GROUP;
+ // l_launchConfig.PrintAllInfo( m_MapProclaunchGrps );
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " System Launch Started");
+ // Don't use DynamicLaunch because its dependency on the services table is complex
+ SS_SOURCE source_type = SS_SOURCE_FM;
+
+ m_oSystemLauncher.configure_dynamic_launch(source_type, m_MapProclaunchGrps, l_OrderList);
+ m_oSystemLauncher.copyDynOrderedVector(m_SystemStarter);
+ // m_SystemStarter.print_info();
+
+ // start the timer upon successful launching of first process
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Starting Module Connection Timeout timer with %d sec period",
+ m_SMConfig.MCConfig.ModuleConnectionTimeOutSec);
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_MODULE_CONNECT_WAIT_TIMER],
+ m_SMConfig.MCConfig.ModuleConnectionTimeOutSec, 0,
+ m_SMConfig.MCConfig.ModuleConnectionTimeOutSec, 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp)); // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+
+EFrameworkunifiedStatus CSystemManager::GetLastSourceInfo(SS_SOURCE &source_type) { // LCOV_EXCL_START 8: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ CHAR LastSource[64 + 1] = { '\0' };
+ l_eStatus = NPSynchronousReadPersistentData(SERVICE_AS_MODE,
+ NTFY_SSLastSourceType, LastSource, static_cast<UI_32>(sizeof(LastSource) - 1));
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("NPSynchronousReadPersistentData("
+ SERVICE_AS_MODE "," NTFY_SSLastSourceType);
+ } else {
+ std::string tempstr(LastSource);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " String got from persistence %s", LastSource);
+ UI_32 pos = static_cast<UI_32>(tempstr.find("_"));
+ std::string tempstr2 = tempstr.substr(0, pos);
+ UI_64 value = strtoull(tempstr2.c_str(), 0, 10);
+ source_type = static_cast<SS_SOURCE>((UI_32)(value >> 32) & 0x0000FFFF);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnLaunchGroupTriggerProcessResponse(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp);
+ UI_32 l_groupID;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+ SetCmdHist("SS_SM_GROUP_LAUNCH_TRIGGER", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+ // stop group launch trigger process response timer
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_LAUNCH_GROUP_TRIGGER_PROC_RESP_TIMER]);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < UI_32 > (hApp, l_groupID))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ SS_SOURCE source_type = SS_SOURCE_NA;
+ l_eStatus = GetLastSourceInfo(source_type);
+
+ if ((SS_SOURCE_AM == source_type) || (SS_SOURCE_FM == source_type)
+ || (SS_SOURCE_FM_DAB == source_type) || (SS_SOURCE_SDARS == source_type)) {
+ if (l_groupID == m_oSystemLauncher.get_id()) {
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp));
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Received Group ID %d != Sys Mgr Group ID %d", l_groupID,
+ m_oSystemLauncher.get_id());
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ } else { // media is last source
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp));
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnLaunchGroupTriggerProcessResponseTimerExpiry(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp);
+ REC_HIST_IF_SUCCESSFUL("SM_TIMER_LAUNCH_GROUP_TRIGGER", m_TimerCmdHist,
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp), l_eStatus);
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnLaunchGroupSelfTrigger(HANDLE hApp) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ REC_HIST_IF_SUCCESSFUL("SS_SM_SendTriggerToSelf", m_SMCmdHist, m_SMHistIter,
+ FrameworkunifiedGetMsgSrc(hApp), l_eStatus);
+
+ CALL_AND_LOG_STATUS(OnLaunchGroup(hApp));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+///
+/// \param
+///
+/// \return
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnLaunchGroup(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ GroupLaunchMapIter l_GroupIter;
+ UI_32 l_launch_ID = m_oSystemLauncher.get_id();
+
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Launching group %d", l_launch_ID );
+
+ l_GroupIter = m_MapProclaunchGrps.find(l_launch_ID);
+
+ if (l_GroupIter->second.launch_complete == FALSE) { // LCOV_EXCL_BR_LINE 6: Because it is not called for a condition that results in "TRUE"
+ // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__
+ // , " m_bIsNPP_ServicesStarted ? %s, group.id: %d, Launch_Group: %d"
+ // , m_bIsNPP_ServicesStarted ? "Yes" : "No"
+ // , l_GroupIter->second.id
+ // , m_SystemLaunchProgress );
+
+ if ((m_bIsNPP_ServicesStarted && m_bIsBackupAvail) || (l_GroupIter->second.id <= 2)) { // LCOV_EXCL_BR_LINE 6: Because it is not called for the condition that results in "FALSE" // NOLINT(whitespace/line_length)
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIter->second.modules.begin();
+ if (l_ModuleListIterator != l_GroupIter->second.modules.end()) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ // FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "GRPLCH,(start),%d,%s",
+ // l_GroupIter->second.id,l_GroupIter->second.name.c_str());
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Launching Group%d/%s",
+ l_GroupIter->second.id, l_GroupIter->second.name.c_str());
+ SS_String l_ModulePath;
+ for (; l_ModuleListIterator != l_GroupIter->second.modules.end(); l_ModuleListIterator++) {
+ if (l_ModuleListIterator->IsModuleState(MODULE_STATE_INVALID)) {
+ char l_cFormat[] = "SendRequestToLauncher(%s, "
+ "ePLThrdCmd_LAUNCH_MODULE_REQST)";
+ char l_cBuf[sizeof(l_cFormat) + MAX_NAME_SIZE_APP];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat,
+ l_ModuleListIterator->name.c_str());
+
+ l_eStatus = SendRequestToLauncher(hApp, l_ModuleListIterator, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ePLThrdCmd_LAUNCH_MODULE_REQST, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ "ePLThrdCmd_LAUNCH_MODULE_REQST"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ModuleListIterator->SetModuleState(
+ MODULE_STATE_LAUNCH_FAILED);
+ SetCmdHist(l_cBuf, m_ErrHist, m_ErrHistIter,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ l_ModuleListIterator->SetModuleState(MODULE_STATE_LAUNCHING);
+ }
+ } else {
+ l_ModulePath = (m_BinaryFilesPath + l_ModuleListIterator->path); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Not launching %s: module state is %s",
+ l_ModulePath.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str());
+ }
+ }
+
+ // LCOV_EXCL_BR_START 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ if (FALSE ==
+ l_GroupIter->second.grp_wait_for_trigger) {
+ // LCOV_EXCL_BR_STOP
+ m_GroupLaunchTimer->StartTimer(m_aTimerIDs[eSM_TIMER_GROUP_MONITOR],
+ SS_GROUP_LAUNCH_TIMER_CONFIG, 0, 0, 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ if (m_oSystemLauncher.is_end()) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "System Launch Completed");
+
+ if (epssusSYSTEM_SERVICES_STARTED == m_SystemModeInfo.startupStage) {
+ // If startupStage == SYSTEM_SERVICES_STARTED, a notification is requested because there are SVCs required for notification to the _CWORD56_.
+ l_eStatus = SendSystemModeInfoResponse(hApp, epssusALL_SERVICES_LAUNCHED);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "UpdateStartupStageState_SendSystemModeInfoResponse" // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "( epssusALL_SERVICES_LAUNCHED )"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ m_SystemModeInfo.startupStage = epssusALL_SERVICES_LAUNCHED;
+
+ if (is_current_state(SS_SM_APPS_LAUNCH_IN_PROGRESS)) {
+ SMSetState(hApp, SS_SM_APPS_LAUNCHED_READY_TO_START);
+ }
+ // SysMgrConfiguration config;
+ // config.PrintAllInfo( m_MapProclaunchGrps );
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnLaunchGroup(HANDLE hApp)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessLaunchTimerExpiry
+///
+/// \param HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessLaunchTimerExpiry(HANDLE hApp) { // LCOV_EXCL_START 8: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // ToDo 2013_05_17 Jay When used ? Dead code ? Don't see a StartTimer call.
+ REC_HIST_IF_SUCCESSFUL("SM_TIMER_PROCESS_LAUNCH_MONITOR", m_TimerCmdHist,
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp), l_eStatus);
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_PROCESS_LAUNCH_MONITOR]);
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnHeartBeatMonitorTimerExpiry
+///
+/// \param HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnHeartBeatMonitorTimerExpiry(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, " Received from %s", FrameworkunifiedGetMsgSrc(hApp));
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ REC_HIST_IF_SUCCESSFUL("SM_TIMER_HEARTBEAT_MONITOR", m_TimerCmdHist, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp), l_eStatus); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ // LCOV_EXCL_BR_START 4: nsfw error
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, m_hHeartbeatThread.m_ThreadHdl,
+ SS_HEARTBEAT_PERIODIC_STATUS_REQ, 0, NULL))) {
+ // LCOV_EXCL_BR_STOP 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild(m_hHeartbeatThread.m_ThreadHdl, " // LCOV_EXCL_LINE 4: nsfw error
+ "SS_HEARTBEAT_PERIODIC_STATUS_REQ)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ m_hHeartbeatThread.m_ThreadState = eSMWaitForHeartbeat;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SystemManagerDebugDump
+/// implement post mortem function
+///
+/// \param
+///
+/// \return void
+///////////////////////////////////////////////////////////////////////////////
+
+VOID CSystemManager::SystemManagerDebugDump(HANDLE hApp) {
+ std::stringstream l_debugDumpBuf;
+ cmdHistIter i;
+
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_debugDumpBuf << FrameworkunifiedGetAppName(hApp) << "/" << endl
+ << " <SYSTEM MANAGER DUMP DATA> " << endl << endl << " ***internals*** " << endl
+ << endl << " SM state: "
+ << GetStr(m_SMCurrentState).c_str() << endl << " SM startup reason: "
+ << GetStr(m_StartUpReason).c_str() << endl << " SM shutdown reason: "
+ << GetStr(m_shutdownTrigger).c_str() << endl << " LUM: "
+ << GetStr(m_lastUserMode).c_str() << endl << " TPM: "
+ << GetStr(m_SystemModeInfo.transportMode).c_str() << endl << " LPH: "
+ << GetStr(m_SystemModeInfo.limpHomeCutoff).c_str() << endl << " PMode: "
+ << GetStr(m_SystemModeInfo.productionMode).c_str() << endl << " ActiveGroup: "
+ << m_ActiveGroupId << endl << " m_MaxShutdownTime: " << m_MaxShutdownTime
+ << endl << " NPP: " << (m_bIsNPP_ServicesStarted ? "Started" : "notStarted")
+ << endl
+ << endl << " ***Error history***" << endl;
+ // LCOV_EXCL_BR_STOP
+
+ for (i = m_ErrHist.begin(); i != m_ErrHist.end(); ++i) {
+ l_debugDumpBuf << endl << " " << i->m_cmd.c_str() << " @ " << i->m_time // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << "ms EC:" << i->m_sender.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_debugDumpBuf << endl << " ***_CWORD56_ command history***" << endl;
+
+ for (i = m__CWORD56_CmdHist.begin(); i != m__CWORD56_CmdHist.end(); ++i) {
+ l_debugDumpBuf << endl << " " << i->m_cmd.c_str() << " @ " << i->m_time << "ms" << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_debugDumpBuf << endl << " ***Timer history***" << endl;
+
+ for (i = m_TimerCmdHist.begin(); i != m_TimerCmdHist.end(); ++i) {
+ l_debugDumpBuf << endl << " " << i->m_cmd.c_str() << " @ " << i->m_time << "ms" << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_debugDumpBuf << endl << " ***SM message history***" << endl;
+
+ for (i = m_SMCmdHist.begin(); i != m_SMCmdHist.end(); ++i) {
+ l_debugDumpBuf << endl << " " << i->m_cmd.c_str() << " @ " << i->m_time << "ms " // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << i->m_sender.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_debugDumpBuf << endl << " ***Publishshing history***" << endl;
+
+ for (i = m_PubCmdHist.begin(); i != m_PubCmdHist.end(); ++i) {
+ l_debugDumpBuf << endl << " " << i->m_cmd.c_str() << " @ " << i->m_time << "ms " // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << i->m_sender.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_debugDumpBuf << endl << " ***SM start table***" << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_debugDumpBuf << endl
+ << " index | name | start required? | isOKFlag | Module state | start sent "
+ "| start resposne received |start delta | stop sent | reply received | stop delta | PID"
+ << endl;
+ // LCOV_EXCL_BR_STOP
+
+ for (UI_32 k = 1u; (k <= m_MapProclaunchGrps.size()); k++) {
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(k);
+
+ if (l_GroupIterator != m_MapProclaunchGrps.end()) {
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+
+ for (int i = 1u; l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++, i++) {
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::string sIsOKFlag = GetModuleCondition(l_ModuleListIterator) ? " " : // 'blank' means OK
+ "X"; // 'X' means state mismatch
+
+ l_debugDumpBuf << " " << std::setw(2) << std::right << i << " | "
+ << std::setw(24) << std::left << l_ModuleListIterator->name.c_str()
+ << " | " << std::setw(5) << std::left
+ << (l_ModuleListIterator->is_start_required ? "TRUE" : "FALSE")
+
+ << " | " << sIsOKFlag.c_str() << " | " << std::setw(24) << std::left
+ << l_ModuleListIterator->ModuleStateStr().c_str() << " | "
+ << l_ModuleListIterator->m_startReason.GetInitial() << " | "
+ << l_ModuleListIterator->m_startReason.GetFinal() << " | "
+ << std::setw(3) << std::right
+ << static_cast<SI_16>(l_ModuleListIterator->m_startReason.GetDelta())
+ << "ms" << " | " << l_ModuleListIterator->m_stopReason.GetInitial()
+ << " | " << l_ModuleListIterator->m_stopReason.GetFinal() << " | "
+ << std::setw(3)
+ << static_cast<SI_16>(l_ModuleListIterator->m_stopReason.GetDelta())
+ << "ms" << " | " << l_ModuleListIterator->pid << endl;
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+ }
+
+ l_debugDumpBuf << endl << " ***Heartbeat information***" << endl;
+
+ l_debugDumpBuf << endl << " Entire State:" << m_HBReport.eEntireState << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_debugDumpBuf << endl << " Number of Modules:" << m_HBReport.nNumOfModules << endl;
+
+ for (UI_32 j = 0; j < m_HBReport.nNumOfModules; j++) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (0 != m_HBReport.tModuleList[j].HeartBeatRetryCount) {
+ l_debugDumpBuf << endl << " " << m_HBReport.tModuleList[j].ProcQueueName << ","
+ << m_HBReport.tModuleList[j].ProcHBState << ", "
+ << m_HBReport.tModuleList[j].HeartBeatRetryCount << endl;
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ std::string l_debugDumpStr = l_debugDumpBuf.str();
+
+ SendDebugDumpResponseToSystemManager(l_debugDumpStr); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessLaunchMonitorTimerExpiry
+/// This sends request to launcher thread to confirm that it
+/// is still responsive.
+///
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessLaunchMonitorTimerExpiry(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from %s", FrameworkunifiedGetMsgSrc(hApp));
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ REC_HIST_IF_SUCCESSFUL("TIMER_PROCESSLAUNCHER_MONITOR", m_TimerCmdHist, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp), l_eStatus); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ // LCOV_EXCL_BR_START 4: nsfw error
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, m_hProcLauncherThread.m_ThreadHdl,
+ ePLThrdCmd_THREAD_STATUS_REQST, 0, NULL))) {
+ // LCOV_EXCL_BR_STOP 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild(m_hProcLauncherThread.m_ThreadHdl," // LCOV_EXCL_LINE 4: nsfw error
+ "ePLThrdCmd_THREAD_STATUS_REQST)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ m_hProcLauncherThread.m_ThreadState = eSMWaitForHeartbeat;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendRequestToLauncher
+/// This function is used for sending request to launcher thread from
+/// System Manager.
+///
+/// \param HANDLE hApp
+/// ModuleLaunchListIter f_ModuleListIterator => iterator node from map for the module
+/// ESMPLThreadCommandIds f_CommandId => command id to send
+/// SS_String f_ModulePath => Path of the Module
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::PerformLaunchProcedure(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleIterator, SS_String & f_stopCompName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ SS_String s_ModuleStatus2;
+
+ // Register for Stop Complete notification
+ if (!f_ModuleIterator->shutdown_critical) {
+ s_ModuleStatus2 = "is not shutdown_critical";
+ // LCOV_EXCL_BR_START 6: For setting the initialization conditions at SystemManager startup
+
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus =
+ FrameworkunifiedSubscribeNotificationWithCallback(
+ hApp,
+ f_stopCompName.c_str(),
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStopCompleteNotification>))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSubscribeNotificationWithCallback(hApp, %s) errored: %d/'%s'",
+ f_stopCompName.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+
+ s_ModuleStatus2 = "is shutdown_critical but errored";
+ // LCOV_EXCL_STOP
+ } else {
+ s_ModuleStatus2 = f_stopCompName + " is now registered"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", s_ModuleStatus2.c_str());
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup PerformTerminateProcedure
+/// Perform Procedure for Service Terminate.
+///
+/// \param HANDLE hApp
+/// ModuleLaunchListIter f_ModuleListIterator => iterator node from map for the module
+/// SS_String & f_availabilityName => Availability Name
+/// SS_String & f_stopCompName => Stop Complete Notification Name
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::PerformTerminateProcedure(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleIterator, SS_String & f_availabilityName,
+ SS_String & f_stopCompName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ // close session
+ f_ModuleIterator->SetModuleState(MODULE_STATE_INVALID);
+ f_ModuleIterator->pid = 0;
+ if (NULL != f_ModuleIterator->hsession) { // LCOV_EXCL_BR_LINE 200:hsession must not be NULL.
+ l_eStatus = FrameworkunifiedMcClose(f_ModuleIterator->hsession); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: FrameworkunifiedMcClose(%s) errored: %d/'%s'",
+ f_ModuleIterator->name.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+ f_ModuleIterator->hsession = NULL;
+ }
+
+ // Availability
+ if (f_ModuleIterator->is_start_required) {
+ // Initialize Availability
+ HANDLE pPublishMq = McOpenSender(FRAMEWORKUNIFIED_NS_NPSERVICE); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (NULL == pPublishMq) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ ServiceAvailability tServiceAvailability;
+
+ snprintf(tServiceAvailability.cServiceName, MAX_NAME_SIZE_APP, "%s",
+ f_ModuleIterator->name.c_str());
+ tServiceAvailability.eServiceAvailability = eFrameworkunifiedServiceNotAvailable;
+
+ l_eStatus = NPPublishNotification(pPublishMq, f_ModuleIterator->name.c_str(), // LCOV_EXCL_BR_LINE 4: nsfw error
+ f_availabilityName.c_str(), &tServiceAvailability, // LCOV_EXCL_BR_LINE 4: nsfw error
+ sizeof(tServiceAvailability)); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: NPPublishNotification(%s)",
+ f_availabilityName.c_str());
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = McClose(pPublishMq); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+
+ if (f_ModuleIterator->shutdown_critical) {
+ // Unregister Stop Complete notification
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedUnsubscribeNotificationWithCallback(hApp, f_stopCompName.c_str()))) { // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedUnsubscribeNotificationWithCallback(hApp, %s) errored: %d/'%s'",
+ f_stopCompName.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ SS_String s_ModuleStatus2 = f_stopCompName + " is now unregistered ";
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", s_ModuleStatus2.c_str());
+ }
+ }
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendRequestToLauncher
+/// This function is used for sending request to launcher thread from
+/// System Manager.
+///
+/// \param HANDLE hApp
+/// ModuleLaunchListIter f_ModuleListIterator => iterator node from map for the module
+/// ESMPLThreadCommandIds f_CommandId => command id to send
+/// SS_String f_ModulePath => Path of the Module
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::SendRequestToLauncher(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleIterator, ESMPLThreadCommandIds f_CommandId,
+ SS_String f_CommandIdStr) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SS_String l_ModulePath = m_BinaryFilesPath + f_ModuleIterator->path;
+
+ T_ProcessLauncherLaunchReq l_ModuleLaunchReq = { };
+ strcpy(l_ModuleLaunchReq.name, f_ModuleIterator->name.c_str()); // NOLINT
+ strcpy(l_ModuleLaunchReq.path, l_ModulePath.c_str()); // NOLINT
+ strncpy(l_ModuleLaunchReq.args, f_ModuleIterator->arguments.c_str(), // NOLINT
+ sizeof(l_ModuleLaunchReq.args) - 1);
+ strcpy(l_ModuleLaunchReq.logging_mask, // NOLINT
+ f_ModuleIterator->logging_msk_str.c_str());
+ l_ModuleLaunchReq.priority = f_ModuleIterator->configuration_priority;
+ l_ModuleLaunchReq.cpu_assign = f_ModuleIterator->cpu_assign;
+ l_ModuleLaunchReq.groupIterator = m_MapProclaunchGrps.find(
+ f_ModuleIterator->group_id);
+ l_ModuleLaunchReq.moduleIterator = f_ModuleIterator;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Queue:%s, path:%s, args:%s, lmsk:%s, prio:%d, cmd:%s", l_ModuleLaunchReq.name,
+ l_ModuleLaunchReq.path, l_ModuleLaunchReq.args, l_ModuleLaunchReq.logging_mask,
+ l_ModuleLaunchReq.priority, f_CommandIdStr.c_str());
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, m_hProcLauncherThread.m_ThreadHdl, f_CommandId, sizeof(l_ModuleLaunchReq), reinterpret_cast<void *>(&l_ModuleLaunchReq)))) { // LCOV_EXCL_BR_LINE 4: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 4: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSendChild( %s, %s ) errored: %d/'%s'", l_ModulePath.c_str(),
+ f_CommandIdStr.c_str(), l_eStatus, GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ SS_String l_availabilityName = f_ModuleIterator->name + "/Availability"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SS_String l_stopCompName = f_ModuleIterator->name + "/StopComp"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // Perform command-specific processing
+ switch (f_CommandId) { // LCOV_EXCL_BR_LINE 6: Because the case is fixed on the call from the SystemManager::Initialize
+ // LCOV_EXCL_START 6: Because the case is fixed on the call from the SystemManager::Initialize
+ case ePLThrdCmd_RELAUNCH_MODULE_REQST:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = PerformTerminateProcedure(hApp, f_ModuleIterator,
+ l_availabilityName, l_stopCompName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ SS_ASERT(0);
+ }
+
+ l_eStatus = PerformLaunchProcedure(hApp, f_ModuleIterator, l_stopCompName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ SS_ASERT(0);
+ }
+ break;
+ // LCOV_EXCL_STOP
+
+ case ePLThrdCmd_LAUNCH_MODULE_REQST:
+ l_eStatus = PerformLaunchProcedure(hApp, f_ModuleIterator, l_stopCompName);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup
+ }
+ break;
+
+ case ePLThrdCmd_TERMINATE_MODULE_REQST:
+ l_eStatus = PerformTerminateProcedure(hApp, f_ModuleIterator,
+ l_availabilityName, l_stopCompName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ break;
+
+ // LCOV_EXCL_START 6: Because the case is fixed on the call from the SystemManager::Initialize
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ case ePLThrdCmd_LAUNCH_MODULE_RESP:
+ case ePLThrdCmd_MODULE_STATUS_REQST:
+ case ePLThrdCmd_RELAUNCH_MODULE_RESP:
+ case ePLThrdCmd_TERMINATE_MODULE_RESP:
+ case ePLThrdCmd_THREAD_STATUS_REQST:
+ case ePLThrdCmd_THREAD_STATUS_RESP:
+ case ePLThrdCmd_NONE:
+ break;
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::SendRequestToLauncher(
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup RemoveModuleEntryFromHB
+/// This function is called to send module information to heart beat thread
+/// which is to be removed from its list of services to be monitored.
+///
+/// \param HANDLE hApp,
+/// const CHAR *f_ModuleName => Module Name
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::RemoveModuleEntryFromHB(HANDLE hApp, const CHAR *f_ModuleName) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ HBListIter l_HBIter = std::find(m_HBList.begin(), m_HBList.end(), f_ModuleName);
+ if (l_HBIter != m_HBList.end()) {
+ m_HBList.erase(l_HBIter);
+ }
+
+ TSMRequestMessage l_ModuleDetails;
+ strncpy(l_ModuleDetails.pstModuleName, f_ModuleName,
+ sizeof(l_ModuleDetails.pstModuleName) - 1);
+ l_ModuleDetails.pstModuleName[sizeof(l_ModuleDetails.pstModuleName) - 1] = '\0';
+ l_eStatus = SendRequestToHeartBeat(hApp, SS_HEARTBEAT_DELETE_MODULE_ENTRY,
+ &l_ModuleDetails, sizeof(TSMRequestMessage));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnHeartBeatThreadHeartbeatResponse
+/// This function gets called when heart beat thread replies the
+/// heart beat query sent by the System Manager.
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnHeartBeatThreadHeartbeatResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "HeartBeat HeartBeat Received");
+ m_hHeartbeatThread.m_ThreadState = eSMThreadIsFine;
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnCheckAvailResponse
+/// This function gets service's availability status from HBThread
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnCheckAvailResponse(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ THbAvailCheck result;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < THbAvailCheck > (hApp, result))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_tempaltes.h // NOLINT(whitespace/line_length)
+ } else if (result.isOk == FALSE) {
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessLauncherThreadHeartbeatResponse
+/// This function gets called when launcher thread replies the
+/// heart beat query sent by the System Manager.
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessLauncherThreadHeartbeatResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, "ProcessLaunch HeartBeat Received");
+ m_hProcLauncherThread.m_ThreadState = eSMThreadIsFine;
+ return eFrameworkunifiedStatusOK;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup RegisterCallbacksForRequester
+/// Register callbacks for External Protocol commands
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::RegisterCallbacksForRequester(HANDLE hApp, PCSTR f_pRequester) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // Attach Session Protocol messages.
+ FrameworkunifiedProtocolCallbackHandler l_sm_protocol_handlers[] = {
+ // Command ID, Call back functions
+ { SS_SM_START_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStartCompleteResponse> },
+ { SS_SM_STOP_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStopCompleteResponse> },
+ { SS_SM_PRE_START_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStartCompleteResponse> },
+ { SS_SM_PRE_STOP_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStartCompleteResponse> },
+ { SS_SM_BACKGROUND_START_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStartCompleteResponse> },
+ { SS_SM_BACKGROUND_STOP_COMPL_RSPN,
+ SysMgrCallback<CSystemManager, &CSystemManager::OnModuleStartCompleteResponse> },
+ { SS_SM_GET_START_EXT_INFO, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnGetStartExtInfo> },
+ { SS_SM_GET_STOP_EXT_INFO, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnGetStopExtInfo> },
+ { SS_SM_CRNT_STATE_QUERY, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnCurrentSMStateQuery> },
+ { SS_SM_DATA_RESET_MODE_SET_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnSetDataResetModeRequest> },
+ { SS_SM_PROG_UPDATE_STATE_SET_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnSetProgUpdateStateRequest> },
+
+ { SS_SM__CWORD56__HEARTBEAT_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::On_CWORD56_HeartBeatRequest> },
+ { SS_SM_NEXT_WAKEUP_TYPE_SET_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnSetNextWakeupTypeRequest> },
+ // Error Event Logging
+ { SS_SM_ERROR_EVENT_LOGGING_START_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnLoggingStartRequest> },
+ { SS_SM_ERROR_EVENT_ARTIFACT_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnErrorEventArtifactRequest> },
+ { SS_SM_ERROR_EVENT_LOGGING_COMPLETE, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnErrorEventLoggingComplete> },
+ { SS_SM_DEBUG_DUMP_RSPN, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnDebugDumpResponseReceived> },
+ { SS_SM_PROPAGATE_SYSTEM_ERROR, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnPropagateSystemError> },
+ { SS_SM_BOOT_MICRO_RESET_NTF, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnBootMicroResetNotification> },
+ { SS_SM_BOOT_MICRO_LOG_RSP, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnBootMicroLogResponse> },
+ { SS_SM_USER_INVOKED_LOG_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnUserInvokedLoggingRequest> },
+ { SS_SM_ERROR_EVENT_EEL_EXPORT_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnEelExportRequest> },
+ { SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnSystemmanagerEmmcLogsRequest> },
+ { SS_SM_ERROR_EVENT_CLR_LOGS_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnSystemmanagerClearLogsRequest> },
+ { SS_SM_ERROR_EVENT_DIAG_LOG_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnDiagLoggingRequest> },
+ { SS_SM_ERROR_EVENT_CAN_LOG_REQ, SysMgrCallback<CSystemManager,
+ &CSystemManager::OnCANLoggingRequest> } }; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(hApp, f_pRequester,
+ l_sm_protocol_handlers, static_cast<UI_32>(_countof(l_sm_protocol_handlers))); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedAttachCallbacksToDispatcher(%s) errored: %d/'%s'", f_pRequester,
+ l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::RegisterCallbacksForRequester( HANDLE hApp, PCSTR f_pRequester)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup open_session_with_sm_test_client
+/// Process request to open session with sm test client
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::open_session_with_sm_test_client(HANDLE hApp, PCSTR pRequester) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ UI_32 const l_ui32DefaultSessionID = 0;
+ OpenSessionAck tOpenAck = { };
+
+/*
+ * Here pRequester is SMTesteClient with whom session is opened and its handle is stored in m_hPowerServiceSession handle.
+ * This case comes only while testing SystemManager through SMTestClient (PowerService should not be running).
+ */
+ // Validate session handle
+ if (NULL == m_hPowerServiceSession) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Session Handle NULL, calling FrameworkunifiedMcOpenSender for %s", pRequester);
+
+ m_hPowerServiceSession = FrameworkunifiedMcOpenSender(hApp, pRequester);
+ //
+ // Set the Session Handle for Framework so FrameworkunifiedSendResponse won't error due to a null
+ // session handle.
+ //
+ // LCOV_EXCL_BR_START 4:NSFW's error
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSetSessionHandle(hApp,
+ pRequester, // [in] PCSTR - Name of the associated service name
+ m_hPowerServiceSession))) { // [in] HANDLE - Session handle
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSetSessionHandle(%s) errored: %d/'%s'", pRequester,
+ l_eStatus, GetStr(l_eStatus).c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (m_hPowerServiceSession == NULL) { // LCOV_EXCL_BR_LINE 200:m_hPowerServiceSession must not be NULL
+ // LCOV_EXCL_START 200:m_hPowerServiceSession must not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Invalid Session Handle to service (%s) ", pRequester);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Session opened with %s", pRequester);
+
+ // Copy session name to data structure
+ strncpy(tOpenAck.cSessionName, FrameworkunifiedGetAppName(hApp),
+ sizeof(tOpenAck.cSessionName) - 1);
+ tOpenAck.eStatus = eFrameworkunifiedStatusOK;
+ tOpenAck.sessionId = l_ui32DefaultSessionID;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "About to send Open Session ACK");
+ // send OpenSession ACK
+ // LCOV_EXCL_BR_START 4:NSFW's error
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession,
+ PROTOCOL_OPEN_SESSION_ACK, sizeof(OpenSessionAck),
+ (PVOID) & tOpenAck))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendMsg(PROTOCOL_OPEN_SESSION_ACK)");
+
+ // Close the message queue handle
+ if (NULL != m_hPowerServiceSession) {
+ CALL_AND_LOG_STATUS_IF_ERRORED(FrameworkunifiedMcClose(m_hPowerServiceSession));
+ m_hPowerServiceSession = NULL;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ CALL_AND_LOG_STATUS_IF_ERRORED(RegisterCallbacksForRequester(hApp, pRequester));
+ }
+ } // end of else block of if(l_ModuleListIterator->hsession == NULL)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnOpenSession
+/// Process request to open session
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnOpenSession(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 const l_ui32DefaultSessionID = 0;
+ UI_32 const l_ui32DefaultSessionType = 0;
+ OpenSessionAck tOpenAck = { };
+ PCSTR pRequester = FrameworkunifiedGetMsgSrc(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "%s", pRequester);
+
+ ModuleLaunchListIter l_ModuleListIter;
+
+ REC_HIST_IF_SUCCESSFUL("PROTOCOL_OPEN_SESSION_REQ", m_SMCmdHist, m_SMHistIter, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ FrameworkunifiedGetMsgSrc(hApp), l_eStatus); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = GetModuleIterator(pRequester, l_ModuleListIter);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ // Special handling for open session request from SMTestClient.
+ if ((0 == strcmp(TC_SysManager, pRequester))) {
+ open_session_with_sm_test_client(hApp, pRequester);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s not found in Group Launch Map",
+ pRequester);
+ }
+ } else {
+ /**********************************************************************/
+ if (0 != l_ModuleListIter->pid) {
+ UI_32 l_ClientPriority;
+ l_eStatus = l_ModuleListIter->GetPriority(l_ClientPriority);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("l_ModuleListIter->GetPriority( l_ClientPriority )"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (l_ClientPriority != l_ModuleListIter->configuration_priority) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Changing %s's priority from %d to %d",
+ pRequester, l_ClientPriority,
+ l_ModuleListIter->configuration_priority);
+ CALL_AND_LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_ModuleListIter->SetPriority( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_ModuleListIter->configuration_priority)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ /**********************************************************************/
+
+ // ToDo Jay 2013 Jan 09 REPLACE WITH CORRECT SERVICE / SESSION HANDLE
+ // LOGIC
+ // validate session handle
+ if (NULL == l_ModuleListIter->hsession) {
+ // LCOV_EXCL_BR_START 4: nsfw error
+ if (NULL == (l_ModuleListIter->hsession = FrameworkunifiedMcOpenSender(hApp, pRequester))) {
+ // LCOV_EXCL_BR_STOP 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedMcOpenSender(App %s, %s) returned NULL",
+ FrameworkunifiedGetAppName(hApp), pRequester);
+ return eFrameworkunifiedStatusInvldHandle;
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ /*
+ * Currently System Manager does not support multiple sessions from same client.
+ * When a client gets restarted after Crash or after missing HeartBeat, System Manager
+ * would receive OpenSession request from that client even when System Manager already
+ * has a open session with that client.
+ */
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Repeated Session Opening Request from %s", pRequester);
+ }
+ if (eFrameworkunifiedStatusOK != (l_eStatus = RegisterCallbacksForRequester(hApp, pRequester))) {
+ // Close the message queue handle
+ if (NULL != l_ModuleListIter->hsession) { // LCOV_EXCL_BR_LINE 6: Due to NULL checking
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedMcClose(l_ModuleListIter->hsession))) {
+ LOG_ERROR("FrameworkunifiedMcClose()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ l_ModuleListIter->hsession = NULL;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+ }
+
+ // Copy session name to data structure
+ strncpy(tOpenAck.cSessionName, FrameworkunifiedGetAppName(hApp), sizeof(tOpenAck.cSessionName) - 1);
+ tOpenAck.eStatus = eFrameworkunifiedStatusOK;
+ tOpenAck.sessionId = l_ui32DefaultSessionID;
+ tOpenAck.sessionType = l_ui32DefaultSessionType;
+
+ // send OpenSession ACK
+ // LCOV_EXCL_BR_START 4: nsfw error
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedSendMsg(l_ModuleListIter->hsession,
+ SS_SM_PROTOCOL_OPEN_SESSION_ACK, sizeof(OpenSessionAck),
+ (PVOID) & tOpenAck))) { // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSendMsg( %s, SS_SM_PROTOCOL_OPEN_SESSION_ACK)"
+ " errored: %d/'%s'", l_ModuleListIter->name.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+
+ if (NULL != l_ModuleListIter->hsession) {
+ // Close the message queue handle
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedMcClose(l_ModuleListIter->hsession))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedMcClose(%s) errored: %d/'%s'",
+ l_ModuleListIter->name.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ }
+ l_ModuleListIter->hsession = NULL;
+ }
+ // LCOV_EXCL_STOP
+ } else {
+ // Store PowerService session handle in class so it can be accessed faster
+ // to use opened session while replying to PowerService.
+ if ((0 == strcmp(SERVICE_POWER, pRequester))) {
+ m_hPowerServiceSession = l_ModuleListIter->hsession;
+ }
+
+ l_ModuleListIter->SetModuleState(MODULE_STATE_CONNECTED);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " SM State: %s, %s.is_start_required: %s",
+ GetStr(m_SMCurrentState).c_str(), l_ModuleListIter->name.c_str(),
+ GetStr(l_ModuleListIter->is_start_required).c_str());
+
+ if (l_ModuleListIter->is_start_required
+ && ((SS_SM_APPS_START_IN_PROGRESS == m_SMCurrentState)
+ || (SS_SM_APPS_START_COMPLETE == m_SMCurrentState))) {
+ T_SS_SM_START_DataStructType f_startupData(m_StartUpReason,
+ m_PowerType_to_SSBoolEnumMap[m_Wake.powerupType], m_DataResetMode,
+ m_startUpConfirmationMsg.securityStatus,
+ m_startUpConfirmationMsg.wakeupType, m_DramBackupStatus,
+ m_ResetStatus, m_ResetCount);
+ const UI_32 l_iCmd = InProgressStateToSendMsg();
+ if (l_iCmd != SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX) {
+ CALL_AND_LOG_STATUS_IF_ERRORED(l_ModuleListIter->SendMsgAndUpdateState(l_iCmd, &f_startupData)); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+ }
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ std::string l_Subscriber;
+ l_Subscriber = FrameworkunifiedGetMsgSrc(hApp);
+
+ // check if the heart beat subscriber is already in list
+ HBListIter l_HBIter = std::find(m_HBList.begin(), m_HBList.end(), l_Subscriber);
+ if (l_HBIter == m_HBList.end()) {
+ m_HBList.push_back(l_Subscriber);
+ }
+ if (m_SMCurrentState == SS_SM_APPS_START_COMPLETE) {
+ TSMRequestMessage l_ModuleDetails;
+ snprintf(l_ModuleDetails.pstModuleName, sizeof(l_ModuleDetails.pstModuleName),
+ "%s", l_Subscriber.c_str());
+ l_eStatus = SendRequestToHeartBeat(hApp, SS_HEARTBEAT_APPEND_MODULE_ENTRY,
+ &l_ModuleDetails, sizeof(TSMRequestMessage));
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "SendRequestToHeartBeat()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// ConstructGetResultResponse
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::add_state_information_to_response(CHAR *f_MessageResponse) const {
+ const CHAR ReadyToLaunchAppDescription[] = "_READY_TO_LAUNCH:";
+ const CHAR StartInProgressDescription[] = "_START_IN_PROGRESS:";
+ const CHAR LaunchInProgressDescription[] = "_LAUNCH_IN_PROGRESS:";
+ const CHAR LaunchedReadyToStartDescription[] = "_READY_TO_START:";
+ const CHAR StopInProgressDescription[] = "_STOP_IN_PROGRESS:";
+ const CHAR StartCompleteDescription[] = "_START_COMPLETED:";
+ const CHAR WaitingForCriticalAppsToStopDescription[] = "_WAITING_FOR_CRITICAL_APPS_TO_STOP:";
+ const CHAR PreStartInProgressDescription[] = "_PRE_START_IN_PROGRESS:";
+ const CHAR PreStopInProgressDescription[] = "_PRE_STOP_IN_PROGRESS:";
+ const CHAR PreRunCompleteDescription[] = "_PRE_RUN_COMPLETE:";
+ const CHAR BackgroundStartInProgressDescription[] = "_BACKGROUND_START_IN_PROGRESS:";
+ const CHAR BackgroundStopInProgressDescription[] = "_BACKGROUND_STOP_IN_PROGRESS:";
+ const CHAR BackgroundRunCompleteDescription[] = "_BACKGROUND_RUN_COMPLETE:";
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ CHAR l_Buffer[5];
+ UI_32 l_Index = 0;
+
+ std::map<SS_SMModuleState, std::string> StateMap; // State Map
+ StateMap[SS_SM_READY_TO_LAUNCH_APP] = ReadyToLaunchAppDescription;
+ StateMap[SS_SM_APPS_LAUNCH_IN_PROGRESS] = LaunchInProgressDescription;
+ StateMap[SS_SM_APPS_LAUNCHED_READY_TO_START] = LaunchedReadyToStartDescription;
+ StateMap[SS_SM_APPS_START_IN_PROGRESS] = StartInProgressDescription;
+ StateMap[SS_SM_APPS_START_COMPLETE] = StartCompleteDescription;
+ StateMap[SS_SM_APPS_STOPPING_AT__CWORD56__REQ] = StopInProgressDescription;
+ StateMap[SS_SM_APPS_STOPPING_AT_INTERNAL_REQ] = StopInProgressDescription;
+ StateMap[SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ] =
+ WaitingForCriticalAppsToStopDescription;
+ StateMap[SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ] =
+ WaitingForCriticalAppsToStopDescription;
+ StateMap[SS_SM_APPS_PRE_START_IN_PROGRESS] = PreStartInProgressDescription;
+ StateMap[SS_SM_APPS_PRE_STOP_IN_PROGRESS] = PreStopInProgressDescription;
+ StateMap[SS_SM_APPS_PRE_RUN_COMPLETE] = PreRunCompleteDescription;
+ StateMap[SS_SM_APPS_BACKGROUND_START_IN_PROGRESS] = BackgroundStartInProgressDescription;
+ StateMap[SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS] = BackgroundStopInProgressDescription;
+ StateMap[SS_SM_APPS_BACKGROUND_RUN_COMPLETE] = BackgroundRunCompleteDescription;
+
+ itoa(m_SMCurrentState, l_Buffer, 16);
+ while (l_Buffer[l_Index]) {
+ l_Buffer[l_Index] = toupper(l_Buffer[l_Index]);
+ l_Index++;
+ }
+
+ if (SS_SM_MAX_RESP_MSG_SIZE > (strlen(f_MessageResponse) + sizeof(l_Buffer)
+ + StateMap[m_SMCurrentState].length() + 1)) {
+ strncat(f_MessageResponse, l_Buffer, sizeof(l_Buffer));
+ strncat(f_MessageResponse, StateMap[m_SMCurrentState].c_str(),
+ StateMap[m_SMCurrentState].length());
+ } else {
+ eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// ConstructGetResultResponse
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::construct_get_result_response(CHAR *f_MessageResponse) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ const EFrameworkunifiedStatus eStatus = add_state_information_to_response(f_MessageResponse);
+ if (eFrameworkunifiedStatusOK == eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Response Constructed");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////
+/// REC_HIST_IF_SUCCESSFUL / SetCmdHist
+///
+///
+//////////////////////////////////////////////////////////////////////
+void CSystemManager::SetCmdHist(std::string cmd, cmdHist &hist, cmdHistIter &it, std::string sender) {
+ UI_64 l_time = 0XDEAD;
+ CTimeSpan* timerClass = new (std::nothrow) CTimeSpan(); // LCOV_EXCL_BR_LINE 5: Because new cannot fail
+ if (NULL == timerClass) { // LCOV_EXCL_BR_LINE 5: Because new cannot fail
+ // LCOV_EXCL_START 5: Because new cannot fail
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " 'new (std::nothrow) CTimeSpan()' returned NULL, "
+ "'it->m_time' being set to 0xDEAD");
+ // LCOV_EXCL_STOP
+ } else {
+ l_time = timerClass->GetTimeMilliseconds();
+ }
+
+ pthread_mutex_lock(&sm_hist_mutex);
+
+ it->m_time = l_time;
+ it->m_cmd = cmd;
+ it->m_sender = sender;
+ it++;
+
+ if (it != hist.end()) { // LCOV_EXCL_BR_LINE 5: std: because it is a member of a vector and it is difficult to create a failing condition
+ it = hist.begin();
+ }
+
+ pthread_mutex_unlock(&sm_hist_mutex);
+
+ delete timerClass; // LCOV_EXCL_BR_LINE 5: Because the delete cannot fail
+}
+
+///////////////////////////////////////////////////////////////////////
+/// OnCurrentPowerStateQuery
+///
+///
+//////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnCurrentSMStateQuery(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Received from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SS_SMCurrentState l_CurrentState;
+
+ REC_HIST_IF_SUCCESSFUL("SS_SM_CRNT_STATE_QUERY", m_SMCmdHist, m_SMHistIter,
+ FrameworkunifiedGetMsgSrc(hApp), l_eStatus);
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < SS_SMCurrentState > (hApp, l_CurrentState))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else {
+ construct_get_result_response(l_CurrentState.respMsgString);
+
+ ModuleLaunchListIter l_ModuleListIter;
+ PCSTR l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ if (eFrameworkunifiedStatusOK != (l_eStatus = GetModuleIterator(l_moduleName, l_ModuleListIter))) { // LCOV_EXCL_BR_LINE 200: can not be other value // NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 200: can not be other value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map", l_moduleName);
+ // LCOV_EXCL_STOP
+ } else if (l_ModuleListIter->hsession != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL // NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(l_ModuleListIter->hsession, // LCOV_EXCL_BR_LINE 4: nsfw error
+ SS_SM_CRNT_STATE_QUERY_RSPN, sizeof(SS_SMCurrentState),
+ (PVOID) & l_CurrentState))) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendMsg(SS_SM_CRNT_STATE_QUERY_RSPN)"); // LCOV_EXCL_LINE 4: nsfw error
+ }
+ } else {
+ // LCOV_EXCL_START 200: can not be NUL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " NULL == hsession; %s not connected yet",
+ l_ModuleListIter->name.c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::GetVersionNumber(SS_VersionNumberType & f_VersionNumber) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ CSMVersion cVersion;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = cVersion.get_version(f_VersionNumber))) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ LOG_ERROR("cVersion.get_version()"); // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::GetVersionNumber( SS_VersionNumberType
+
+EFrameworkunifiedStatus CSystemManager::GetBuildInfo(std::string &f_BuildInfoStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ CSMVersion cVersion;
+ if (eFrameworkunifiedStatusOK != (l_eStatus = cVersion.get_build_info(f_BuildInfoStr))) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ LOG_ERROR("cVersion.get_build_info()"); // LCOV_EXCL_BR_LINE 6:For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::GetBuildInfo(std::string)
+
+bool CSystemManager::GetDramPowerStatusInfo(const HANDLE h_app) {
+ PsmDramStsT l_dram_sts = PSM_DRAM_STS_NORMAL;
+ bool ret = false;
+
+ // Checking dram power status.
+ if (PsmGetDramPowerSupplyAbnormalityCheckResultPower(h_app, &l_dram_sts))
+ return ret;
+
+ if (l_dram_sts == PSM_DRAM_STS_NORMAL)
+ ret = true;
+
+ return ret;
+}
+
+bool CSystemManager::GetDramStoreStatusInfo(const HANDLE h_app) {
+ PsmSysupDramT l_dram1 = PSM_SYSUP_DRAM_NORMAL;
+ PsmSysupDramT l_dram2 = PSM_SYSUP_DRAM_NORMAL;
+ PsmSysupDramT l_dram3 = PSM_SYSUP_DRAM_NORMAL;
+ PsmStartStatusT l_sts = PSM_START_STATUS_FACTRESET;
+
+ bool ret = false;
+
+ // Checking factory shipment status
+ if (PsmGetStartStatusPower(h_app, &l_sts))
+ return ret;
+
+ if (l_sts == PSM_START_STATUS_FACTRESET) {
+ ret = true;
+ goto finish;
+ }
+
+ // Checking dram power
+ if (!GetDramPowerStatusInfo(h_app))
+ goto finish;
+
+ // Checking dram status.
+ if (PsmGetDramBackupStatusPower(h_app, &l_dram1, &l_dram2, &l_dram3))
+ goto finish;
+
+ // l_dram2 and l_dram3 would be ignored.
+ if (l_dram1 == PSM_SYSUP_DRAM_NORMAL)
+ ret = true;
+
+ if (l_dram2 == PSM_SYSUP_DRAM_SFTERRSR)
+ ret = true;
+
+finish:
+ return ret;
+}
+
+bool CSystemManager::GetSyscomPowerStatusInfo(const HANDLE h_app) {
+ PsmComStsT l_syscom_sts = PSM_COM_STS_NORMAL;
+ bool ret = false;
+
+ if (PsmGetSyscomStatusPower(h_app, &l_syscom_sts))
+ return ret;
+
+ if (l_syscom_sts == PSM_COM_STS_NORMAL)
+ ret = true;
+
+ return ret;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnSetStartupConfirmationDataRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+ EFrameworkunifiedStatus l_eStatus;
+ Pwr_ServiceSetInterface tServiceSetIf;
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg < Pwr_ServiceSetInterface > (hApp, tServiceSetIf))) { // LCOV_EXCL_BR_LINE 4:NSFW's error
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ m_startUpConfirmationMsg = tServiceSetIf.data.startupConfirmationMsg;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s Startup Confirmation data:", FrameworkunifiedGetMsgSrc(hApp));
+ SYSTEMMANAGERLOG_StartupConfirmationMsg(m_startUpConfirmationMsg); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ DGCODE_RET_API l_ret = DGCODE_RET_ERROR;
+
+ l_ret = Diag_StartupAllStatusOfDTC();
+ if (l_ret == DGCODE_RET_ERROR) {
+ LOG_ERROR("Diag_StartupAllStatusOfDTC()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ if ((e_SS_SM_NEXT_WAKEUP_TYPE_COLD == m_NextWakeupType) && (epsstCOLDSTART != m_startUpConfirmationMsg.wakeupType)) { // LCOV_EXCL_BR_LINE 6: Because the above formula cannot be set to true // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "WakeupType Change to Cold by Svc Request");
+ m_startUpConfirmationMsg.wakeupType = epsstCOLDSTART;
+ // LCOV_EXCL_STOP
+ }
+
+ m_ResetStatus = ((m_isIlgReset == TRUE) ?
+ e_SS_SM_RESET_STATUS_NG :
+ ((m_isImmediateReset == TRUE) ?
+ e_SS_SM_RESET_STATUS_IMMEDIATE : e_SS_SM_RESET_STATUS_NONE));
+ if (e_SS_SM_RESET_STATUS_NG == m_ResetStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "ResetStatus NG illRst:%s lastErr:Not Support",
+ m_isIlgReset ? "TRUE" : "FALSE");
+ m_ResetCount++;
+ if (PowerHalSetResetInfo(AGL_RESET_COUNTER, m_ResetCount)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not back up m_ResetCount(%lu) to power_hal", m_ResetCount);
+ }
+ }
+
+ m_DramBackupStatus =
+ ((epsstWARMSTART != m_startUpConfirmationMsg.wakeupType)
+ || (e_SS_SM_DATA_RESET_MODE_FACTORY == m_DataResetMode)
+ || (GetDramStoreStatusInfo(hApp) == false)) ?
+ e_SS_SM_DRAM_BACKUP_NG : e_SS_SM_DRAM_BACKUP_OK;
+
+ if (e_SS_SM_DRAM_BACKUP_NG == m_DramBackupStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
+ "DramBackup NG wakeupType:%s dataResetMode:%s",
+ (epsstWARMSTART == m_startUpConfirmationMsg.wakeupType) ?
+ "WARM" : "COLD",
+ (e_SS_SM_DATA_RESET_MODE_FACTORY == m_DataResetMode) ?
+ "FACTORY" : "NotFactory");
+ }
+
+ if (m_needReNotifyStartPrm) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be satisfied from the external API
+ // LCOV_EXCL_BR_START 6: Because both sides are not FALSE
+ if (e_SS_SM_DRAM_BACKUP_NG == m_DramBackupStatus) {
+ // LCOV_EXCL_BR_STOP
+ m_DramBackupStatus = e_SS_SM_DRAM_BACKUP_NG;
+ }
+ }
+
+ if (m_needReNotifyStartPrm) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be satisfied from the external API
+ if (e_SS_SM_RESET_STATUS_NG == m_ResetStatus) {
+ // do nothing, keep m_ResetStatus.
+ } else if (e_SS_SM_RESET_STATUS_IMMEDIATE == m_ResetStatus) {
+ // do nothing, keep m_ResetStatus.
+ } else {
+ m_ResetStatus = e_SS_SM_RESET_STATUS_NONE;
+ }
+
+ if (epsstWARMSTART != m_startUpConfirmationMsg.wakeupType) { // LCOV_EXCL_BR_LINE 6: Because the above condition cannot be satisfied // NOLINT(whitespace/line_length)
+ m_startUpConfirmationMsg.wakeupType = epsstCOLDSTART;
+ }
+ }
+
+ CALL_AND_LOG_STATUS(ClearDramBackupInfo(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "\n"
+ "start prm\n"
+ "dramBackupStatus = %s\n"
+ "wakeupType = %s\n"
+ "dataResetMode = %s\n"
+ "resetStatus = %s\n"
+ "resetCount = %d\n"
+ "progUpdateState = %d",
+ (m_DramBackupStatus == e_SS_SM_DRAM_BACKUP_OK) ? "OK" : "NG",
+ (m_startUpConfirmationMsg.wakeupType == epsstWARMSTART) ? "WARM" : "COLD",
+ (m_DataResetMode == e_SS_SM_DATA_RESET_MODE_FACTORY) ? "FACT" :
+ (m_DataResetMode == e_SS_SM_DATA_RESET_MODE_USER) ? "USER" :
+ (m_DataResetMode == e_SS_SM_DATA_RESET_MODE_PROGUPDATE) ? "PROG" : "NONE",
+ (m_ResetStatus == e_SS_SM_RESET_STATUS_IMMEDIATE) ? "IMM" :
+ (m_ResetStatus == e_SS_SM_RESET_STATUS_NONE) ? "NONE" : "NG", m_ResetCount,
+ m_ProgUpdateState);
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedNPPublishNotification(hApp, NTFY_SSSystemMgrStartUpType, &m_startUpConfirmationMsg.wakeupType, sizeof(EPWR_SC_WAKEUP_TYPE)))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedNPPublishNotification(%s, %s) errored: %d/'%s'",
+ NTFY_SSSystemMgrStartUpType,
+ GetStr(m_startUpConfirmationMsg.wakeupType).c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " FrameworkunifiedNPPublishNotification(%s, %s) successful",
+ NTFY_SSSystemMgrStartUpType,
+ GetStr(m_startUpConfirmationMsg.wakeupType).c_str());
+
+ // LCOV_EXCL_BR_START 200: As there are no cases other than eFrameworkunifiedStatusOK
+ REC_HIST_IF_SUCCESSFUL("SM/StartUpType",
+ m_PubCmdHist, m_PubHistIter, "", l_eStatus);
+ // LCOV_EXCL_BR_STOP
+ }
+ }
+
+ EFrameworkunifiedStatus l_responseStatus = l_eStatus;
+
+ ModuleLaunchListIter l_ModuleListIter;
+ PCSTR l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ if (eFrameworkunifiedStatusOK != (l_eStatus = GetModuleIterator(l_moduleName, l_ModuleListIter))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map", l_moduleName);
+ } else if (l_ModuleListIter->hsession != NULL) {
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(l_ModuleListIter->hsession, // LCOV_EXCL_BR_LINE 4:NSFW's error
+ SS_SM_FWD_START_CONFIRMATION_MSG_RESP, sizeof(EFrameworkunifiedStatus),
+ (PVOID) & l_responseStatus))) {
+ // LCOV_EXCL_START 4:NSFW's error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendMsg(SS_SM_FWD_START_CONFIRMATION_MSG_RESP)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " NULL == hsession; %s not connected yet", l_ModuleListIter->name.c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnSetStartupConfirmationDataRequest( HANDLE hApp )
+
+EFrameworkunifiedStatus CSystemManager::GetTimeStamp(std::string& TimeStamp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ CHAR format[256] = { '\0' };
+ CHAR l_format[256] = { '\0' };
+ struct timeb timebuf;
+ uint32_t time;
+ uint8_t status;
+ struct tm theTime;
+ ftime(&timebuf);
+ Clock_getSystemTimeY2K38(&time, &status);
+ CLOCK_RETURN clock_ret = Clock_CnvSecToDateY2K38(&time, &theTime);
+
+ if (CLOCK_OK != clock_ret) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ sprintf(l_format, "GMT Time,%04d-%02d-%02d %02d:%02d:%02d.%hu\n", // NOLINT
+ theTime.tm_year + 1900, theTime.tm_mon + 1, theTime.tm_mday,
+ theTime.tm_hour, theTime.tm_min, theTime.tm_sec, timebuf.millitm);
+
+ struct timespec timeSpec;
+
+ if (0 != clock_gettime(CLOCK_MONOTONIC, &timeSpec)) {
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ time_t timeInSecs = timeSpec.tv_sec;
+ sprintf(format, "Elaps Time,%ld:%02ld:%02ld\n", (timeInSecs / 3600), // NOLINT
+ ((timeInSecs % 3600) / 60), (timeInSecs % 60));
+ }
+
+ TimeStamp.clear();
+ TimeStamp.assign(format);
+ TimeStamp.append(l_format);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+VOID CSystemManager::SYSTEMMANAGERLOG_StartupConfirmationMsg(EPWR_SC_MSG_STRUCT & f_scMsg) {
+ std::stringstream l_enumStr;
+ l_enumStr << endl;
+ l_enumStr << " HostProcSoftVer:" << hex << std::setw(16) << std::setfill('0')
+ << m_VersionNumberStruct.m_VersionNumber << endl;
+ l_enumStr << " _CWORD56_ Boot Mode:" << GetStr(f_scMsg._CWORD56_BootMode) << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_enumStr << " wakeupType :" << GetStr(f_scMsg.wakeupType); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s", l_enumStr.str().c_str());
+} // End of VOID CSystemManager::SYSTEMMANAGERLOG_StartupConfirmationMsg( EPWR_SC_MSG_STRUCT & f_scMsg )
+
+VOID CSystemManager::LogESystemmanagerStatusEnums() {
+ #define INITIAL_INDEX eFrameworkunifiedStatusEmptyMediaList
+ #define FINAL_INDEX eFrameworkunifiedStatusErrNoEINTR
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::stringstream l_enumStr;
+ for (int i = INITIAL_INDEX; i <= FINAL_INDEX; i++) {
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_enumStr << "\n" << "0x" << std::setfill('0') << std::setw(8) << hex << i
+ << "/" << std::setfill(' ') << std::setw(2) << dec << i << ": "
+ << GetStr(static_cast<EFrameworkunifiedStatus>(i));
+ // LCOV_EXCL_BR_STOP
+ }
+
+ std::string l_logMsg = l_enumStr.str();
+ SystemmanagerLogString(ZONE_INFO, __FUNCTION__, l_logMsg); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+#undef INITIAL_INDEX
+#undef FINAL_INDEX
+} // End of VOID CSystemManager::LogESystemmanagerStatusEnums()
+
+VOID CSystemManager::LogProtocolIDs() {
+#define INITIAL_INDEX SS_SYSTEM_MANAGER_PROTOCOL_BEGINNING_INDEX
+#define FINAL_INDEX SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::stringstream l_enumStr;
+ for (int i = INITIAL_INDEX; i <= FINAL_INDEX; i++) {
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_enumStr << "\n" << "0x" << std::setfill('0') << std::setw(8) << hex << i
+ << "/" << std::setfill(' ') << std::setw(2) << dec << i << ": "
+ << GetStr(static_cast<SS_SystemManagerProtocol>(i));
+ // LCOV_EXCL_BR_STOP
+ }
+
+ std::string l_logMsg = l_enumStr.str();
+ SystemmanagerLogString(ZONE_INFO, __FUNCTION__, l_logMsg); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+#undef INITIAL_INDEX
+#undef FINAL_INDEX
+} // End of VOID CSystemManager::LogProtocolIDs()
+
+VOID CSystemManager::SystemmanagerLogString(TFrameworkunifiedZone f_zone, PCSTR f_func, std::string &f_text) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_offset = 0;
+ UI_32 l_msgLenMax = MAX_QUEUE_MSG_SIZE - 512; // Leave space for the appending of
+ // the NSLog date/time/service/line string.
+
+ if (f_text.at(f_text.length() - 1) == '\n') { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ f_text.erase(f_text.length() - 1); // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup
+ }
+
+ while (l_offset < f_text.size()) {
+ UI_32 l_charsRem = static_cast<UI_32>(f_text.size() - l_offset);
+ UI_32 l_msgLen = (l_charsRem > l_msgLenMax) ? // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ l_msgLenMax : l_charsRem; // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup
+ std::string l_msgStr = f_text.substr(l_offset, l_msgLen);
+ size_t l_newLinePos = l_msgStr.find_last_of("\n", l_msgLen);
+ if ((l_newLinePos != std::string::npos) && (l_charsRem > l_msgLenMax)) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_msgStr = f_text.substr(l_offset, l_newLinePos);
+ l_offset += static_cast<UI_32>(l_newLinePos);
+ // LCOV_EXCL_STOP
+ } else {
+ l_offset += l_msgLen;
+ }
+
+ FRAMEWORKUNIFIEDLOG(f_zone, f_func, l_msgStr.c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // LCOV_EXCL_BR_LINE 10: Final line
+
+// End of /SS_SystemManager/src/ss_system_manager.cpp
diff --git a/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_callbacks.cpp b/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_callbacks.cpp
new file mode 100755
index 0000000..2e597ce
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_callbacks.cpp
@@ -0,0 +1,3411 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager business logic.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <sys/wait.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <system_service/ss_system_manager_notifications_local.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_power_service_if.h>
+#include <processlauncher/ProcessLauncher.h>
+#include <processlauncher/ss_sm_process_launcher_protocol.h>
+#include <processlauncher/ss_sm_process_launcher.h>
+#include <heartbeat/ss_hb_thread.h>
+
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service_protocol.h>
+
+#include <native_service/ns_np_service.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/ns_backup.h>
+
+#include <stub/ss_diag.h>
+
+#include <system_service/ss_error_message.h>
+#include <system_service/ss_test_clients.h>
+#include <system_service/ss_templates.h>
+#include <native_service/ns_plogger_if.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <iomanip>
+#include <vector>
+#include <algorithm>
+#include <string>
+
+#include "ss_system_manager_callbacks.h"
+#include "ss_system_manager.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_config.h"
+
+using namespace std; // NOLINT
+
+extern SS_String GetStr(SS_SMModuleState f_enum);
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus SysMgrCallback(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ C * pObj = static_cast<C *>(&CSystemManager::GetInstance());
+ if (pObj) { // LCOV_EXCL_BR_LINE 5 : new error
+ l_eStatus = (pObj->*M)(hApp);
+ }
+ return l_eStatus;
+}
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE, UI_32)>
+EFrameworkunifiedStatus SysMgrCbType2(HANDLE hApp, UI_32 f_UI_32) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ C * pObj = static_cast<C *>(&CSystemManager::GetInstance());
+ if (pObj) { // LCOV_EXCL_BR_LINE 5 : new error
+ l_eStatus = (pObj->*M)(hApp, f_UI_32);
+ }
+ return l_eStatus;
+}
+
+template<typename C, BOOL (C::*M)(UI_32)>
+BOOL SysMgrCbType3(UI_32 f_UI_32) {
+ BOOL l_bValue = FALSE;
+ C * pObj = static_cast<C *>(&CSystemManager::GetInstance());
+ if (pObj) { // LCOV_EXCL_BR_LINE 5 : new error
+ l_bValue = (pObj->*M)(f_UI_32);
+ }
+ return l_bValue;
+}
+
+enum {
+ POWERON = TRUE,
+ POWEROFF = FALSE
+};
+
+VOID CSystemManager::LogGroupModulesState(UI_32 f_groupId, std::string pStr) {
+ if (IS_ZONE_SET(ZONE_INFO)) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(f_groupId);
+ if (l_GroupIterator == m_MapProclaunchGrps.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Group %d not found; 'm_MapProclaunchGrps' is empty",
+ f_groupId);
+ } else {
+ std::string sIsOKFlag;
+ TEXT(__FUNCTION__, " Group %d/%s, %ld modules: %s, %s", f_groupId,
+ l_GroupIterator->second.name.c_str(),
+ l_GroupIterator->second.modules.size(), pStr.c_str(),
+ GetStr(m_SMCurrentState).c_str());
+
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+ for (int i = 1;
+ l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++, i++) {
+ sIsOKFlag = GetModuleCondition(l_ModuleListIterator) ? " " : // 'blank' means OK
+ "X"; // 'X' means state mismatch
+
+ TEXT(__FUNCTION__,
+ " %2d: %-24s Start Req'd: %-5s %s %-24s %3dms, %3dms, %d",
+ i, l_ModuleListIterator->name.c_str(),
+ l_ModuleListIterator->is_start_required ?
+ "TRUE" : "FALSE", sIsOKFlag.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str(),
+ static_cast<SI_16>(l_ModuleListIterator->m_startReason.GetDelta()),
+ static_cast<SI_16>(l_ModuleListIterator->m_stopReason.GetDelta()),
+ l_ModuleListIterator->pid);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ // LCOV_EXCL_STOP
+ }
+} // End of VOID CSystemManager::LogGroupModulesState( UI_32 f_groupId, std::string pStr)
+
+VOID CSystemManager::LogAllGroupModulesState(std::string pStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ std::string l_sIsOKFlag;
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+
+ std::stringstream l_comStream;
+
+ l_comStream << pStr << "," << GetStr(m_SMCurrentState);
+
+ std::string l_comStr = l_comStream.str();
+ SystemmanagerLogString(ZONE_STATE, __FUNCTION__, l_comStr);
+
+ while (l_GroupIterator != m_MapProclaunchGrps.end()) {
+ std::stringstream l_tblStream;
+ l_tblStream << "G" << l_GroupIterator->second.id << "/" << l_GroupIterator->second.name;
+
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+
+ for (int i = 1;
+ l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++, i++) {
+ // Since NPPService exceptionally transitions to STARTED when StartReq'd = N, it is not checked
+ l_sIsOKFlag =
+ GetModuleCondition(l_ModuleListIterator)
+ | (FRAMEWORKUNIFIED_NS_NPSERVICE == l_ModuleListIterator->name) ?
+ " " : // 'blank' means OK
+ "X"; // 'X' means state mismatch
+
+ std::string l_isStartReqd = l_ModuleListIterator->is_start_required ? "T" : "F";
+
+ l_tblStream << endl << " " << std::setw(2) << std::right << i << ":"
+ << l_ModuleListIterator->pid << " "
+ << l_ModuleListIterator->name << " " << "StartReq:"
+ << l_isStartReqd << " " << l_sIsOKFlag
+ << l_ModuleListIterator->ModuleStateStr();
+
+ if (l_ModuleListIterator->is_start_required && (FRAMEWORKUNIFIED_NS_NPSERVICE != l_ModuleListIterator->name)) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set // NOLINT(whitespace/line_length)
+ l_tblStream << " "
+ << static_cast<SI_32>(l_ModuleListIterator->m_startReason.GetDelta())
+ << "ms "
+ << static_cast<SI_32>(l_ModuleListIterator->m_stopReason.GetDelta())
+ << "ms";
+ }
+ }
+
+ l_GroupIterator++;
+
+ // Outputs each GROUP so that buffers do not overflow.
+ std::string l_logMsgStr = l_tblStream.str();
+ SystemmanagerLogString(ZONE_STATE, __FUNCTION__, l_logMsgStr);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+} // End of VOID CSystemManager::LogAllGroupModulesState(std::string pStr)
+
+BOOL CSystemManager::GetModuleCondition(ModuleLaunchListIter & f_ModuleIter) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bIsModuleStateGood = TRUE;
+
+ switch (m_SMCurrentState) { // LCOV_EXCL_BR_LINE 6: As no values are passed into the default case
+ case SS_SM_READY_TO_LAUNCH_APP:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_INVALID);
+ break;
+
+ case SS_SM_APPS_LAUNCH_IN_PROGRESS:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHING)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED);
+ break;
+
+ case SS_SM_APPS_LAUNCHED_READY_TO_START:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED);
+ break;
+
+ case SS_SM_APPS_START_IN_PROGRESS:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED)
+ || (f_ModuleIter->is_start_required
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_START_SENT)
+ || f_ModuleIter->IsModuleState(
+ MODULE_STATE_STARTED)))
+ || (!f_ModuleIter->is_start_required
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED)
+ || f_ModuleIter->IsModuleState(
+ MODULE_STATE_CONNECTED)));
+ break;
+
+ case SS_SM_APPS_START_COMPLETE:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_STARTED) == TRUE))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_START_PRE_SENT) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STARTED_PRE) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_STOP_PRE_SENT) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STOPPED_PRE) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_PRE_RUN_COMPLETE:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_STARTED_PRE) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STOPPED_PRE) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_START_BACKGROUND_SENT) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STARTED_BACKGROUND) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_STOP_BACKGROUND_SENT) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STOPPED_BACKGROUND) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+ case SS_SM_APPS_BACKGROUND_RUN_COMPLETE:
+ l_bIsModuleStateGood =
+ ((f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED) == TRUE)
+ || ((f_ModuleIter->is_start_required == TRUE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_STARTED_BACKGROUND) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_STOPPED_BACKGROUND) == TRUE)))
+ || ((f_ModuleIter->is_start_required == FALSE)
+ && ((f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)
+ || (f_ModuleIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)))) ? (BOOL) TRUE : (BOOL) FALSE;
+ break;
+
+ case SS_SM_APPS_STOPPING_AT__CWORD56__REQ:
+ case SS_SM_APPS_STOPPING_AT_INTERNAL_REQ:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED)
+ || (f_ModuleIter->is_start_required
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_STOP_SENT)
+ || f_ModuleIter->IsModuleState(
+ MODULE_STATE_STOPPED)))
+ || (!f_ModuleIter->is_start_required
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED)
+ || f_ModuleIter->IsModuleState(
+ MODULE_STATE_CONNECTED)));
+ break;
+
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ:
+ l_bIsModuleStateGood = f_ModuleIter->IsModuleState(MODULE_STATE_SKIPPED)
+ || f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCH_FAILED)
+ || (f_ModuleIter->is_start_required
+ && f_ModuleIter->IsModuleState(MODULE_STATE_STOPPED))
+ || (!f_ModuleIter->is_start_required
+ && (f_ModuleIter->IsModuleState(MODULE_STATE_LAUNCHED)
+ || f_ModuleIter->IsModuleState(
+ MODULE_STATE_CONNECTED)));
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bIsModuleStateGood;
+} // End of BOOL CSystemManager::GetModuleCondition( ModuleLaunchListIter & f_ModuleIter )
+
+/*****************************************************************************
+ @ingroup: CSystemManager
+ @brief: Post Termination handler
+ @note: .
+ @param void
+ @return void
+*****************************************************************************/
+EFrameworkunifiedStatus CSystemManager::SendRequestToHeartBeat(HANDLE hApp,
+ EHBProtocolMessages tRequest, VOID *tReqMessageData,
+ UI_32 u32SizeofMessage) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL bValid = FALSE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ switch (tRequest) {
+ case SS_HEARTBEAT_START:
+ bValid = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SS_HEARTBEAT_START");
+ break;
+
+ case SS_HEARTBEAT_STOP:
+ bValid = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SS_HEARTBEAT_STOP");
+ tReqMessageData = NULL;
+ break;
+
+ case SS_HEARTBEAT_DELETE_MODULE_ENTRY:
+ bValid = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SS_HEARTBEAT_DELETE_MODULE_ENTRY");
+ break;
+
+ case SS_HEARTBEAT_APPEND_MODULE_ENTRY:
+ bValid = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SS_HEARTBEAT_APPEND_MODULE_ENTRY");
+ break;
+
+ default:
+ bValid = FALSE;
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error : Ignored Invalid message id 0x%X", tRequest);
+ break;
+ }
+
+ if (TRUE == bValid) { // LCOV_EXCL_BR_LINE 200:tRequest cannot be default, so bValid cannot be false
+ if (INVALID_HANDLE != m_hHeartbeatThread.m_ThreadHdl) { // LCOV_EXCL_BR_LINE 200:m_ThreadHdl cannot be null
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, m_hHeartbeatThread.m_ThreadHdl, tRequest, u32SizeofMessage, tReqMessageData))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedSendChild()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ // LCOV_EXCL_START 200: m_ThreadHdl cannot be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error : Invalid Heartbeat Thread Handle, cannot send message");
+ // LCOV_EXCL_STOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnModuleConnectWaitTimeout
+/// SM maintains timer (40 sec) to check if all modules opened session with him whoever requires Start.
+/// This timer is common to all modules. After timeout it checks the status of every module in group map.
+/// If a module requires start and does not connect, SM will initiate error event logging followed by Soft Reset
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnModuleConnectWaitTimeout(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ static SI_32 l_NumTimesChecked = 0;
+ {
+ char l_cFormat[] = " Received from (Timer expiration %d)";
+ char l_cBuf[sizeof(l_cFormat) + 1];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, l_NumTimesChecked + 1);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, l_cBuf);
+ }
+
+ std::string l_ProcName;
+
+ SetCmdHist("SM_TIMER_MODULE_CONNECT_WAIT_TIMER", m_TimerCmdHist, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ BOOL l_bModuleConnMissed = false;
+
+ GroupLaunchMap::reverse_iterator l_grp_riter = m_MapProclaunchGrps.rbegin();
+
+ ModuleLaunchList::reverse_iterator l_mod_riter;
+
+ if (l_grp_riter == m_MapProclaunchGrps.rend()) { // LCOV_EXCL_BR_LINE 200: group cannot be empty
+ // LCOV_EXCL_START 200: group cannot be empty
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Group Map is Empty"); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ // LCOV_EXCL_STOP
+ } else {
+ // scan the group map in reverse order
+ for (; l_grp_riter != m_MapProclaunchGrps.rend(); l_grp_riter++) {
+ l_mod_riter = l_grp_riter->second.modules.rbegin();
+ for (; l_mod_riter != l_grp_riter->second.modules.rend();
+ l_mod_riter++) {
+ SMModuleState l_ModuleState = l_mod_riter->GetModuleState();
+ // if the module is still in MODULE_STATE_LAUNCHED state at
+ // this point though it requires start something is wrong with
+ // the module. SM initiates error event logging followed by
+ // soft rest
+ if (l_mod_riter->is_start_required
+ && ((l_ModuleState == MODULE_STATE_INVALID)
+ || (l_ModuleState == MODULE_STATE_SKIPPED)
+ || (l_ModuleState == MODULE_STATE_LAUNCHING)
+ || (l_ModuleState == MODULE_STATE_LAUNCHED)
+ || (l_ModuleState == MODULE_STATE_LAUNCH_FAILED))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Module %s/%s is not connected",
+ l_mod_riter->name.c_str(),
+ l_mod_riter->ModuleStateStr().c_str());
+ l_bModuleConnMissed = true;
+ l_ProcName.assign(l_mod_riter->name);
+
+ if (l_ModuleState == MODULE_STATE_LAUNCHED) {
+ CALL_AND_LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_mod_riter->SetPriority( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ m_SystemManagerPriority - 1)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+ }
+ }
+
+ PreLaunchModuleListIter l_itr;
+ for (l_itr = m_PreLaunchModuleList.begin();
+ m_PreLaunchModuleList.end() != l_itr; l_itr++) {
+ if ((-1 == l_itr->pid) && (l_itr->critical)) { // LCOV_EXCL_BR_LINE 200: all prelaunch mode is not critical // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 200: all prelaunch mode is not critical
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Module %s is not launched", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_itr->name.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_bModuleConnMissed = true;
+ l_ProcName.assign(l_itr->name);
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ l_NumTimesChecked++;
+ if (true == l_bModuleConnMissed) {
+ if (l_NumTimesChecked < m_SMConfig.MCConfig.ModuleConnectionNumTimesToCheck) {
+ char l_cFormat[] =
+ " l_NumTimesChecked %d < ModuleConnectionNumTimesToCheck %d, "
+ "will re-check in %d seconds. ";
+ char l_cBuf[sizeof(l_cFormat) + 1 + 1 + 1];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, l_NumTimesChecked,
+ m_SMConfig.MCConfig.ModuleConnectionNumTimesToCheck,
+ m_SMConfig.MCConfig.ModuleConnectionTimeOutSec);
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, l_cBuf);
+
+ } else {
+ l_eStatus = eFrameworkunifiedStatusBadConnection;
+ char l_cFormat[] =
+ " Module connection timeout for %s and "
+ "l_NumTimesChecked %d == ModuleConnectionNumTimesToCheck %d. "
+ " Stopping ModuleConnectTimeOut timer and resetting _CWORD102_.";
+ char l_cBuf[sizeof(l_cFormat) + MAX_NAME_SIZE_APP + 1 + 1];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, l_ProcName.c_str(),
+ l_NumTimesChecked,
+ m_SMConfig.MCConfig.ModuleConnectionNumTimesToCheck);
+ LOG_ERROR(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_MODULE_CONNECT_WAIT_TIMER]); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // initiate error event logging
+ l_eStatus = ErrorEventEnqueue(hApp, eErrorEventTypeModConnFailed,
+ l_ProcName, eErrorEventResetTypeHard, l_loggingInfo);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: ModConnFailed %s",
+ l_ProcName.c_str());
+ fprintf(stderr, "SS_SysManager/%s/Error: ModConnFailed %s\n", // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ __FUNCTION__, l_ProcName.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeModConnFailed)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ } else {
+ char l_cFormat[] =
+ " l_NumTimesChecked = %d, ModuleConnectionNumTimesToCheck = %d. "
+ "All modules connected. Stopping ModuleConnectTimeOut timer.";
+ char l_cBuf[sizeof(l_cFormat) + 1 + 1];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, l_NumTimesChecked,
+ m_SMConfig.MCConfig.ModuleConnectionNumTimesToCheck);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, l_cBuf);
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_MODULE_CONNECT_WAIT_TIMER]); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnModuleConnectWaitTimeout( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnClientStartMonitorTimerExpiry
+///
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnClientStartMonitorTimerExpiry(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from group %d"
+ //, m_ActiveGroupId);
+ , m_SystemStarter.get_id());
+
+ char cBuf[100];
+ SetCmdHist("SM_TIMER_CLIENT_START_MONITOR", m_TimerCmdHist, m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // sprintf( cBuf, "ProcessGroupAsStarted(%d)", m_ActiveGroupId);
+ sprintf(cBuf, "ProcessGroupAsStarted(%d)", m_SystemStarter.get_id()); // NOLINT
+ l_eStatus = ProcessGroupAsStarted(hApp, m_SystemStarter.get_id());
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+
+
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup send_power_request_complete_response
+/// send power request completion response to power
+///
+/// \param [in]
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::send_power_request_complete_response(HANDLE hApp, std::string pStr) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ // send Wake-up complete response to Power
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession,
+ SS_SM_WAKEUP_MODULES_CMPL_RSPN, sizeof(wakeInfo), (PVOID) & m_Wake);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "FrameworkunifiedSendMsg(SS_SM_WAKEUP_MODULES_CMPL_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ LogAllGroupModulesState(pStr);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::send_power_request_complete_response( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnNPPStatusCheckMonitorTimerExpiry
+///
+/// \brief Called when NPP fails to provide a ready status in the specified.
+/// amount of time. This function will periodically request a new status
+/// ACK from NPP service until one is received. See OnNPPReadyStatusCallback().
+///
+/// Note: NPP usually pushes a ready event to SM and the reversion to
+/// polling the NPP ready ACK is for additional robustness. Failure
+/// to receive an NPP ready ACK will prevent system startup.
+///
+/// \param [in] hApp - Handle to framework application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnNPPStatusCheckMonitorTimerExpiry(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ SetCmdHist("SM_TIMER_NPP_STATUS_CHECK_MONITOR", m_TimerCmdHist, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " m_bIsNPP_ServicesStarted is '%s'",
+ GetStr(m_bIsNPP_ServicesStarted).c_str());
+
+ if (FALSE == m_bIsNPP_ServicesStarted) {
+ l_eStatus = FrameworkunifiedNPGetReadyStatusOfNPP(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "FrameworkunifiedNPGetReadyStatusOfNPP()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnNPPReadyStatusCallback
+///
+/// \brief Called when NPP returns a status ACK indicating that the service is
+/// operational and ready to respond to subsequent requests.
+///
+/// \param [in] hApp - Handle to framework application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnNPPReadyStatusCallback(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("NPS_GET_READYSTATUS_ACK", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ l_eStatus = OnNPPReadyEventCallback(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnNPPReadyEventCallback()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CSystemManager::OnNPPReadyEventCallback(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ PCSTR l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", l_moduleName);
+
+ SetCmdHist("NPS_NPP_READY_EVENT", m_SMCmdHist, m_SMHistIter, l_moduleName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (TRUE == m_bIsNPP_ServicesStarted) {
+ l_eStatus = eFrameworkunifiedStatusMsgNotProcessed;
+ LOG_ERROR("TRUE == m_bIsNPP_ServicesStarted"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ ModuleLaunchListIter l_ModuleListIter;
+ m_bIsNPP_ServicesStarted = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " m_bIsNPP_ServicesStarted set 'TRUE'");
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_NPP_STATUS_CHECK_MONITOR]);
+
+ UI_32 l_cbCmdIdArrayNPPService[] = { NPS_NPP_READY_EVENT, NPS_GET_READYSTATUS_ACK };
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hApp, FRAMEWORKUNIFIED_NS_NPSERVICE, l_cbCmdIdArrayNPPService, static_cast<UI_32>(_countof(l_cbCmdIdArrayNPPService))))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedDetachCallbacksFromDispatcher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = register_all_notification_callbacks(hApp))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("register_all_notification_callbacks()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = GetModuleIterator(l_moduleName, l_ModuleListIter))) { // LCOV_EXCL_BR_LINE 200:NPP always in launch map //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 200 : NPP service always in launch map
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " Error: Module %s not found in Group Launch Map", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_moduleName); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ l_ModuleListIter->SetModuleState(MODULE_STATE_STARTED);
+
+ if (m_oSystemLauncher.get_id() == 1) {
+ m_oSystemLauncher.advance_id();
+ }
+
+ l_eStatus = OnLaunchGroup(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnLaunchGroup(hApp)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 200: OnLaunchGroup() return ok
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " successful");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnNPPReadyEventCallback( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnBackupMgrAvailCallback
+/// BackupManager Availability Notification Callback
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnBackupMgrAvailCallback(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (sizeof(ServiceAvailability) != FrameworkunifiedGetMsgLength(hApp)) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else if (strcmp(FrameworkunifiedGetLastNotification(hApp), NTFY_BackupMgr_Availability) != 0) { // LCOV_EXCL_BR_LINE 200:cannot be false //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 200: cannot be false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ m_bIsBackupAvail = FrameworkunifiedIsServiceAvailable(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "BackupAvail:%s", m_bIsBackupAvail ? "T" : "F");
+
+ l_eStatus = OnLaunchGroup(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnLaunchGroup(hApp)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnBackupMgrAvailCallback(HANDLE hApp)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnPowerRequestCallback
+/// PowerRequest callback handler
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnPowerRequestCallback(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ Pwr_ServiceSetInterface tServiceIf;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ SetCmdHist("SS_SM_POWER_REQUEST_MSG", m__CWORD56_CmdHist, m__CWORD56_HistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ // OnSystemManagerDebugDump(hApp);
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < Pwr_ServiceSetInterface > (hApp, tServiceIf))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ // NOTE: interface_unified always set userMode as 0. so don't use m_lastUserMode.
+ m_lastUserMode = tServiceIf.data.powerRequestMsg.userMode;
+ //
+ // 2012 December 04 Temporary hack ( I hope ) to set m_Wake to nominal
+ // values. At present, the 'Power Request Message Response' is sent
+ // back to Power Services via the 'send_power_request_complete_response()'
+ // function, which uses m_Wake.
+ m_Wake.powerupType =
+ m_SSBool_to_PowerTypeEnumMap[m_SSUserMode_to_SSBoolEnumMap[m_lastUserMode]];
+
+ m_Wake.up.factor = tServiceIf.data.powerRequestMsg.startupReason;
+
+ if (epswfINVALID != m_Wake.up.factor) {
+ m_StartUpReason = m_Wake.up.factor;
+ }
+
+ m_userModeChangeReason = tServiceIf.data.powerRequestMsg.userModeChangeReason;
+ m_Wake.up.userModeChangeReason = m_userModeChangeReason;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "UserMode:%s, SM State:%s",
+ GetStr(m_lastUserMode).c_str(),
+ GetStr(m_SMCurrentState).c_str());
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "UserMode:%s, SM State:%s",
+ GetStr(m_lastUserMode).c_str(),
+ GetStr(m_SMCurrentState).c_str());
+ CALL_AND_LOG_STATUS(PublishPowerOnOffNotification(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ switch (m_SMCurrentState) { // LCOV_EXCL_BR_LINE 6: As not all cases can be passed through
+ case SS_SM_READY_TO_LAUNCH_APP:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Received a PowerRequest command while still in "
+ "the '%s' state !!!",
+ GetStr(m_SMCurrentState).c_str());
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+
+ case SS_SM_APPS_LAUNCH_IN_PROGRESS:
+ // When Start is received while processes are launching, we
+ // need to send the Start request later, once the 'Open
+ // Session Request' is received from the application.
+ //*****
+ // Deliberate commenting-out of case-break to allow this case to
+ // use following case's logic.
+ // break;
+ //*****
+
+ case SS_SM_APPS_LAUNCHED_READY_TO_START:
+ case SS_SM_APPS_START_COMPLETE:
+ case SS_SM_APPS_PRE_RUN_COMPLETE:
+ case SS_SM_APPS_BACKGROUND_RUN_COMPLETE:
+ case SS_SM_APPS_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "Startup Reason is '%s'", GetStr(m_StartUpReason).c_str());
+ if ((m_userModeChangeReason == epsumcrPARKING_B)
+ || ((m_userModeChangeReason == epsumcrPRE_BA) && (m_SMCurrentState == SS_SM_APPS_PRE_RUN_COMPLETE))
+ || ((m_userModeChangeReason == epsumcrNORMAL) && (m_SMCurrentState == SS_SM_APPS_START_COMPLETE))
+ || ((m_userModeChangeReason == epsumcrBACKGROUND_BA)
+ && (m_SMCurrentState == SS_SM_APPS_BACKGROUND_RUN_COMPLETE))) {
+ // send the Power Request complete response to PowerService
+ // LCOV_EXCL_BR_START 15: Excluded due to inlined functions
+ CALL_AND_LOG_STATUS_IF_ERRORED(send_power_request_complete_response(hApp, "Power Request"));
+ // LCOV_EXCL_BR_STOP 15: Excluded due to inlined functions
+ } else {
+ //
+ // Publish the UserMode 'Off' notification now for those
+ // applications that need immediate notification ( HMI )
+ if (m_lastUserMode == epsumOFF) {
+ CALL_AND_LOG_STATUS(PublishUserModeNotification(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ CALL_AND_LOG_STATUS(BeginStartup(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ break;
+
+ case SS_SM_APPS_STOPPING_AT__CWORD56__REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ:
+ // Abort the Stop.
+ // Reset System Manager to handle (re)starting as if this is a
+ // nominal start.
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_CLIENT_STOP_MONITOR]);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Aborted %s, resetting to %s,"
+ " restarting Application groups at group %d",
+ GetStr(m_SMCurrentState).c_str(),
+ GetStr(SS_SM_APPS_START_IN_PROGRESS).c_str()
+ , m_SystemStarter.get_id());
+
+ CALL_AND_LOG_STATUS(BeginStartup(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ break;
+
+ case SS_SM_APPS_STOPPING_AT_INTERNAL_REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ: // LCOV_EXCL_START 8: As no value is set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: System Manager state is %d/'%s', ignoring "
+ "PowerRequest command", m_SMCurrentState,
+ GetStr(m_SMCurrentState).c_str());
+ break;
+ } // LCOV_EXCL_STOP
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnPowerRequestCallback( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup
+/// Begin the Startup process
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::BeginStartup(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if ((m_userModeChangeReason != epsumcrPARKING_B) &&
+ (m_userModeChangeReason != epsumcrPRE_BA) &&
+ (m_userModeChangeReason != epsumcrNORMAL) &&
+ (m_userModeChangeReason != epsumcrBACKGROUND_BA)) {
+ // Not a power state transition request.
+ return eFrameworkunifiedStatusOK;
+ }
+
+ switch (m_userModeChangeReason) { // LCOV_EXCL_BR_LINE 6: Excluded because it has been guarded to prevent out-of-range values from entering immediately before.
+ case epsumcrPRE_BA:
+ // LCOV_EXCL_BR_START 6: This function is an internal function, and it is guarded so that the value outside the range is not entered by the caller, so it is excluded.
+ if ((m_SMCurrentState == SS_SM_APPS_START_COMPLETE) || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_RUN_COMPLETE)) {
+ // LCOV_EXCL_BR_STOP 6: This function is an internal function, and it is guarded so that the value outside the range is not entered by the caller, so it is excluded.
+ m_SystemStarter.to_end();
+ SMSetState(hApp, SS_SM_APPS_PRE_STOP_IN_PROGRESS);
+ } else {
+ m_SystemStarter.to_begin();
+ SMSetState(hApp, SS_SM_APPS_PRE_START_IN_PROGRESS);
+ }
+ break;
+ case epsumcrNORMAL:
+ m_SystemStarter.to_begin();
+ SMSetState(hApp, SS_SM_APPS_START_IN_PROGRESS);
+ break;
+ case epsumcrBACKGROUND_BA:
+ if (m_SMCurrentState == SS_SM_APPS_START_COMPLETE) {
+ m_SystemStarter.to_end();
+ SMSetState(hApp, SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS);
+ } else {
+ m_SystemStarter.to_begin();
+ SMSetState(hApp, SS_SM_APPS_BACKGROUND_START_IN_PROGRESS);
+ }
+ break;
+ default:
+ break;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Starting 'Start Resp Monitor' Timer with '%d' sec",
+ m_SMConfig.MCConfig.ModuleStartRespTimeOutSec);
+
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_START_RESP_MONITOR_WAIT_TIMER],
+ m_SMConfig.MCConfig.ModuleStartRespTimeOutSec, 0, 0, 0);
+
+ l_eStatus = start_all_modules_of_group(hApp, m_SystemStarter.get_id());
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: start_all_modules_of_group(%d) errored: %d/'%s'",
+ m_SystemStarter.get_id(), l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::BeginStartup( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnWakeupCallback
+/// WakeUp callback handler
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnWakeupCallback(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "Received from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnWakeupCallback( HANDLE hApp )
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnModuleStartCompleteResponse
+/// Start Response\Ack Handlers
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnModuleStartCompleteResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "%s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("system_manager protocol completion response", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ ModuleLaunchListIter l_ModuleListIter;
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ l_eStatus = GetModuleIterator(l_moduleName.c_str(), l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:always be eFrameworkunifiedStatusOK
+ // LCOV_EXCL_START 200: always be eFrameworkunifiedStatusOK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map",
+ l_moduleName.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ switch (m_SMCurrentState) { // LCOV_EXCL_BR_LINE 200: cannot be SS_SM_READY_TO_LAUNCH_APP
+ case SS_SM_READY_TO_LAUNCH_APP:
+ // LCOV_EXCL_START 200: cannot be SS_SM_READY_TO_LAUNCH_APP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Received while in the '%s' state !!!",
+ GetStr(m_SMCurrentState).c_str());
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+ // LCOV_EXCL_STOP
+
+ case SS_SM_APPS_LAUNCH_IN_PROGRESS:
+ case SS_SM_APPS_LAUNCHED_READY_TO_START:
+ case SS_SM_APPS_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ {
+ const SMModuleState l_state = InProgressStateToState(); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ if (l_state != MODULE_STATE_INVALID) {
+ const PCSTR l_loglist[] = {"start", "pre start", "pre stop", "background start", "background stop", ""};
+ PCSTR l_logtxt;
+ switch (l_state) { // LCOV_EXCL_BR_LINE 6: As no other value is returned
+ case MODULE_STATE_STARTED:
+ l_logtxt = l_loglist[0];
+ break;
+ case MODULE_STATE_STARTED_PRE:
+ l_logtxt = l_loglist[1];
+ break;
+ case MODULE_STATE_STOPPED_PRE:
+ l_logtxt = l_loglist[2];
+ break;
+ case MODULE_STATE_STARTED_BACKGROUND:
+ l_logtxt = l_loglist[3];
+ break;
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ l_logtxt = l_loglist[4];
+ break;
+ // LCOV_EXCL_START 6: As no other value is returned
+ default:
+ AGL_ASSERT_NOT_TESTED();
+ l_logtxt = l_loglist[5];
+ break;
+ // LCOV_EXCL_STOP 6: As no other value is returned
+ }
+ l_eStatus = ModuleCompleteResponse(hApp, l_ModuleListIter, l_state, // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ SysMgrCbType3<CSystemManager, &CSystemManager::IsGroupStarted>,
+ SysMgrCbType2<CSystemManager, &CSystemManager::ProcessGroupAsStarted>,
+ l_logtxt);
+ }
+ }
+ break;
+
+ case SS_SM_APPS_STOPPING_AT__CWORD56__REQ:
+ case SS_SM_APPS_STOPPING_AT_INTERNAL_REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ:
+ // SystemManager changed state while this module was starting;
+ // tell this module to stop.
+ if (!l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_SENT)
+ && !l_ModuleListIter->IsModuleState(MODULE_STATE_STOPPED)) {
+ T_SS_SM_STOP_DataStructType l_SM_STOP_Struct;
+ l_SM_STOP_Struct.shutdownTrigger = m_shutdownTrigger;
+ l_SM_STOP_Struct.lastUserMode = m_lastUserMode;
+
+ CALL_AND_LOG_STATUS( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_ModuleListIter->SendMsgAndUpdateState(
+ &l_SM_STOP_Struct));
+ }
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Received while in the '%s' state !!!", GetStr(m_SMCurrentState).c_str());
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+ } // End switch ( m_SMCurrentState )
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnModuleStartCompleteResponse( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ModuleCompleteResponse
+/// Start Response\Ack Handlers
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ModuleCompleteResponse(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleListIter, SMModuleState f_moduleState,
+ FncCbType3 f_isGroupDoneFnc, FncCbType2 f_groupDoneFnc,
+ PCSTR f_sCompleteTypeText) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Received from %s, m_SystemStarter.get_id() is %d",
+ l_moduleName.c_str()
+ , m_SystemStarter.get_id());
+
+ f_ModuleListIter->SetModuleState(f_moduleState);
+ if (f_ModuleListIter->group_id != m_SystemStarter.get_id()) {
+ // In PastModel002, it is assumed that there is no service that returns a FrameworkunifiedOnStop reply after the NPP service.
+ // However, since _CWORD71_ does not assume this, completion of waiting for termination of the CRITICAL service must be
+ // judged even when services other than the Group1 service terminate last.
+ // Initially, SS_SM_WAITING_FOR_CRITICAL_APPS_AT_XXXX should be handled separately by ProcessModuleStopCompleteResponse(),
+ // but this is limited to ModuleCompleteResponse in order to avoid code deviation from PastModel002 and limit the scope of effect.
+ // LCOV_EXCL_BR_START 200 : m_SMCurrentState can't be SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ and SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ // NOLINT(whitespace/line_length)
+ if ((MODULE_STATE_STOPPED == f_moduleState)
+ && ((m_SMCurrentState
+ == SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ)
+ || (m_SMCurrentState
+ == SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ))) {
+ // LCOV_EXCL_BR_STOP 200 : m_SMCurrentState can't be SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ and SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 200 : m_SMCurrentState can't be SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ and SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ check_all_groups_have_stopped(hApp);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s ( group %d ) received out-of-synch; m_SystemStarter.get_id() is %d",
+ l_moduleName.c_str(), f_ModuleListIter->group_id
+ , m_SystemStarter.get_id());
+ }
+ } else {
+ if ((*f_isGroupDoneFnc)(f_ModuleListIter->group_id)) { // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ l_eStatus = (*f_groupDoneFnc)(hApp, f_ModuleListIter->group_id); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else if (IS_ZONE_SET(ZONE_INFO)) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " Group %d %s incomplete, m_SystemStarter.get_id() is %d", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ f_ModuleListIter->group_id, f_sCompleteTypeText // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ , m_SystemStarter.get_id()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ char cBuf[100];
+ sprintf(cBuf, "%s incomplete", f_sCompleteTypeText); // NOLINT
+ LogGroupModulesState(f_ModuleListIter->group_id, cBuf); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ const SMModuleState l_transition_state = InProgressStateToState(); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ if (l_transition_state == f_moduleState) { // LCOV_EXCL_BR_LINE 6: As no other value is returned
+ if (have_all_services_start_completed(l_transition_state) == TRUE) {
+ if ((m_SMCurrentState == SS_SM_APPS_PRE_START_IN_PROGRESS)
+ || (m_SMCurrentState == SS_SM_APPS_PRE_STOP_IN_PROGRESS)) {
+ SMSetState(hApp, SS_SM_APPS_PRE_RUN_COMPLETE); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ } else if ((m_SMCurrentState == SS_SM_APPS_BACKGROUND_START_IN_PROGRESS)
+ || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS)) {
+ SMSetState(hApp, SS_SM_APPS_BACKGROUND_RUN_COMPLETE); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ } else {
+ SMSetState(hApp, SS_SM_APPS_START_COMPLETE); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ModuleCompleteResponse(
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnStartRespMonitorTimeout
+/// SM maintains timer to check if all modules sent start response to him whoever requires Start.
+/// This timer is common to all modules. After timeout it checks the status of every module in group map.
+/// If a module sent start and does not respond, SM will initiate error event logging followed by Soft Reset
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnStartRespMonitorTimeout(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ std::string l_ProcName;
+ BOOL l_isStartRespNotReceived = false;
+
+ SetCmdHist("SM_TIMER_START_RESP_MONITOR_WAIT_TIMER", m_TimerCmdHist,
+ m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp));
+ GroupLaunchMap::reverse_iterator l_grp_riter = m_MapProclaunchGrps.rbegin();
+ ModuleLaunchList::reverse_iterator l_mod_riter;
+
+ if (l_grp_riter == m_MapProclaunchGrps.rend()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Group Map is Empty");
+ } else {
+ // scan the group map in reverse order
+ for (; l_grp_riter != m_MapProclaunchGrps.rend(); l_grp_riter++) {
+ l_mod_riter = l_grp_riter->second.modules.rbegin();
+ for (; l_mod_riter != l_grp_riter->second.modules.rend(); l_mod_riter++) {
+ // if a module sent start and not received response from module SM wait for "ModuleStartRespTimeout"
+ // and initiated error event
+ // logging followed by soft reset
+
+ if (l_mod_riter->is_start_required) {
+ if (l_mod_riter->IsModuleState(MODULE_STATE_START_SENT)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Module [%s] did not respond(%s) to SM in allocated time [%d] sec",
+ l_mod_riter->name.c_str(),
+ l_mod_riter->ModuleStateStr().c_str(),
+ m_SMConfig.MCConfig.ModuleStartRespTimeOutSec);
+ l_isStartRespNotReceived = true;
+ l_ProcName.assign(l_mod_riter->name);
+ }
+ }
+ }
+ }
+ }
+
+ if (true == l_isStartRespNotReceived) {
+ char l_cFormat[] = " Error. Module '%s' start response timeout.";
+ char l_cBuf[sizeof(l_cFormat) + MAX_NAME_SIZE_APP];
+ snprintf(l_cBuf, sizeof(l_cBuf), l_cFormat, l_ProcName.c_str());
+ TEXT(__FUNCTION__, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, l_cBuf);
+
+ SMLoggingInfo l_loggingInfo;
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+
+ // initate error event logging
+ l_eStatus = ErrorEventEnqueue(hApp, eErrorEventTypeStartRespFailed,
+ l_ProcName, eErrorEventResetTypeHard, l_loggingInfo);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: StartRespFailed %s", l_ProcName.c_str());
+ fprintf(stderr, "SS_SysManager/%s/Error: StartRespFailed %s\n",
+ __FUNCTION__, l_ProcName.c_str());
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeStartRespFailed)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__,
+ " All modules returned Start Response.");
+
+ l_eStatus = FrameworkunifiedSendChild(hApp, m_hHeartbeatThread.m_ThreadHdl,
+ SS_HEARTBEAT_AVAIL_CHECK_REQ, 0, NULL);
+ SS_ASERT(l_eStatus == eFrameworkunifiedStatusOK); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnStartRespMonitorTimeout(HANDLE hApp)
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnShutdownCompleteMonitorTimeout
+/// SM maintains timer to check if all modules sent start response to him whoever requires Start.
+/// This timer is common to all modules. After timeout it checks the status of every module in group map.
+/// If a module sent start and does not respond, SM will initiate error event logging followed by Soft Reset
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnShutdownCompleteMonitorTimeout(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Reset Timeout");
+
+ l_eStatus = SecureChipOff();
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: SecureChipOff Failed");
+ }
+
+ m_ResetFactor = PSM_FACTOR_AGL_WITH_HISTORY;
+
+ l_eStatus = perform_force_reset(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnShutdownCompleteMonitorTimeout(HANDLE hApp)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup start_all_modules_of_group
+/// Send START to all modules of the given group
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::start_all_modules_of_group(HANDLE hApp, UI_32 f_ui32GroupNumber) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(
+ f_ui32GroupNumber);
+ if (l_GroupIterator == m_MapProclaunchGrps.end()) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,
+ __FUNCTION__
+ , " Error: Group %d not found; 'm_MapProclaunchGrps' is empty",
+ f_ui32GroupNumber);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: Because the condition cannot be set
+ } else {
+ T_SS_SM_START_DataStructType f_startupData(m_StartUpReason,
+ m_PowerType_to_SSBoolEnumMap[m_Wake.powerupType],
+ m_DataResetMode, m_startUpConfirmationMsg.securityStatus,
+ m_startUpConfirmationMsg.wakeupType, m_DramBackupStatus,
+ m_ResetStatus, m_ResetCount);
+
+ UI_32 l_numModulesMessaged = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Attempting to send Start Requests to Group %d/'%s'",
+ f_ui32GroupNumber, l_GroupIterator->second.name.c_str());
+
+ for (ModuleLaunchListIter l_ModuleListIterator =
+ l_GroupIterator->second.modules.begin();
+ l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++) {
+ //
+ // Every branch below must ZONE_INFO log how it dispenses w/
+ // the module.
+ // Note: ModuleLaunchParams::SetModuleState() performs that
+ // ZONE_INFO logging internally.
+ if (!l_ModuleListIterator->is_start_required) {
+ if (FRAMEWORKUNIFIED_NS_NPSERVICE == l_ModuleListIterator->name) {
+ const SMModuleState l_transition_state = InProgressStateToState(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ l_ModuleListIterator->SetModuleState(l_transition_state); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ } else {
+ // Not an error
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s 'is_start_required' is False;"
+ " leaving state as '%s'",
+ l_ModuleListIterator->name.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str());
+ }
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else if (NULL == l_ModuleListIterator->hsession) { // LCOV_EXCL_BR_LINE 6: hsession can not be null.
+ l_eStatus = eFrameworkunifiedStatusOK; // Log a message. But its not a failure
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warning: NULL == hsession;"
+ " %s not connected yet",
+ l_ModuleListIterator->name.c_str());
+ } else {
+ switch (l_ModuleListIterator->GetModuleState()) { // LCOV_EXCL_BR_LINE 6: As not all cases can be passed through
+ case MODULE_STATE_INVALID:
+ case MODULE_STATE_SKIPPED:
+ case MODULE_STATE_LAUNCH_FAILED:
+ // LCOV_EXCL_START 6: Because the state of the corresponding variable cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusOK; // Log a message. But its not a failure
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s is %s, NOT sending system_manager protocol message",
+ l_ModuleListIterator->name.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str());
+ break;
+ // LCOV_EXCL_STOP
+
+ case MODULE_STATE_START_SENT:
+ case MODULE_STATE_START_PRE_SENT:
+ case MODULE_STATE_STOP_PRE_SENT:
+ case MODULE_STATE_START_BACKGROUND_SENT:
+ case MODULE_STATE_STOP_BACKGROUND_SENT:
+ l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s is %s, NOT sending system_manager protocol message",
+ l_ModuleListIterator->name.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str());
+ l_numModulesMessaged++;
+ break;
+
+ case MODULE_STATE_LAUNCHING:
+ case MODULE_STATE_LAUNCHED:
+ // LCOV_EXCL_START 6: Because the state of the corresponding variable cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusOK; // Log a message. But its not a failure
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " %s is %s, NOT sending system_manager protocol message",
+ l_ModuleListIterator->name.c_str(),
+ l_ModuleListIterator->ModuleStateStr().c_str());
+ break;
+ // LCOV_EXCL_STOP
+
+ case MODULE_STATE_CONNECTED:
+ case MODULE_STATE_STARTED:
+ case MODULE_STATE_START_FAILED:
+ case MODULE_STATE_STOP_FAILED:
+ case MODULE_STATE_STOP_SENT:
+ case MODULE_STATE_STOPPED:
+ case MODULE_STATE_STARTED_PRE:
+ case MODULE_STATE_START_PRE_FAILED:
+ case MODULE_STATE_STOPPED_PRE:
+ case MODULE_STATE_STOP_PRE_FAILED:
+ case MODULE_STATE_STARTED_BACKGROUND:
+ case MODULE_STATE_START_BACKGROUND_FAILED:
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ case MODULE_STATE_STOP_BACKGROUND_FAILED:
+ {
+ const UI_32 l_iCmd = InProgressStateToSendMsg(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ if (l_iCmd != SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX) { // LCOV_EXCL_BR_LINE 6: Excluded due to value never returned at present
+ // LCOV_EXCL_BR_START 15: Excluded due to inlined functions
+ CALL_AND_LOG_STATUS_IF_ERRORED(l_ModuleListIterator->SendMsgAndUpdateState(l_iCmd, &f_startupData));
+ // LCOV_EXCL_BR_STOP 15: Excluded due to inlined functions
+ l_numModulesMessaged++;
+ }
+ }
+ break;
+ // default: Don't code a 'default' here - let the compiler
+ // detect when the set of module_state enumerations changes -
+ // then the System Service's System Manager maintainer will
+ // automagically know to update this switch statement.
+ }
+ }
+ }
+
+ if (0 == l_numModulesMessaged) {
+ LogGroupModulesState(f_ui32GroupNumber, " Warning: NO modules were sent system_manager protocol message"); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+
+ char l_cBuf[100];
+ snprintf(l_cBuf, sizeof(l_cBuf), "ProcessGroupAsStarted(%d)", l_GroupIterator->second.id);
+ l_eStatus = ProcessGroupAsStarted(hApp, l_GroupIterator);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ } else {
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_CLIENT_START_MONITOR],
+ SS_CLIENT_START_MONITOR_TIMER_CONFIG, 0, 0, 0);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::start_all_modules_of_group(HANDLE hApp, UI_32 f_ui32GroupNumber)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup start_all_modules_of_group
+/// mark the specified group as started. If there is another group to start,
+/// do so, else send Start Complete Response to the Start Requester.
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ProcessGroupAsStarted(HANDLE hApp, UI_32 f_groupId) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(f_groupId);
+ if (l_GroupIterator == m_MapProclaunchGrps.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Group %d not found; 'm_MapProclaunchGrps' is empty", f_groupId);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ } else {
+ l_eStatus = ProcessGroupAsStarted(hApp, l_GroupIterator);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ProcessGroupAsStarted( HANDLE hApp, UI_32 f_groupId )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup start_all_modules_of_group
+/// mark the specified group as started. If there is another group to start,
+/// do so, else send Start Complete Response to the Start Requester.
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ProcessGroupAsStarted(HANDLE hApp,
+ GroupLaunchMapIter f_GroupIterator) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_groupID = m_SystemStarter.get_id();
+
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_CLIENT_START_MONITOR]);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Group %d/%s start completed, m_SystemStarter.get_id() is %d",
+ f_GroupIterator->second.id, f_GroupIterator->second.name.c_str(),
+ l_groupID);
+
+ if (f_GroupIterator->second.id != l_groupID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO,
+ __FUNCTION__
+ , " The just-started group ( %d/%s ) is not the current Active "
+ " Group ( %d ); not starting next group's modules",
+ f_GroupIterator->second.id,
+ f_GroupIterator->second.name.c_str(), l_groupID);
+ } else {
+ if ((m_SMCurrentState == SS_SM_APPS_START_IN_PROGRESS)
+ || (m_SMCurrentState == SS_SM_APPS_PRE_START_IN_PROGRESS)
+ || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_START_IN_PROGRESS)) {
+ // check if WakeUp Level has been achieved
+ if (m_SystemStarter.is_end() == FALSE) {
+ // Start modules from next group
+ l_groupID = m_SystemStarter.advance_id(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ char l_cBuf[100] = {0};
+ snprintf(l_cBuf, sizeof(l_cBuf), "start_all_modules_of_group(%u)", l_groupID);
+ l_eStatus = start_all_modules_of_group(hApp, l_groupID); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ }
+ } else if ((m_SMCurrentState == SS_SM_APPS_PRE_STOP_IN_PROGRESS)
+ || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS)) {
+ if (m_SystemStarter.is_begin() == FALSE) {
+ // Stop modules from next group
+ l_groupID = m_SystemStarter.decrement_id(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ char l_cBuf[100] = {0};
+ snprintf(l_cBuf, sizeof(l_cBuf), "stop_all_modules_of_group(%u)", l_groupID);
+ l_eStatus = start_all_modules_of_group(hApp, l_groupID); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ }
+ } else {
+ // MISRA C++-2008 Rule 6-4-2
+ // NOP
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ProcessGroupAsStarted( GroupLaunchMapIter f_GroupIterator )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup calculate_max_shutdown_time
+/// Calculate maximum shutdown time of apps critical to shutdown
+/// from the launch group map
+///
+/// \param [in]
+///
+/// \return UI_32
+/// Max Value of critical shutdown apps shutdown time
+///////////////////////////////////////////////////////////////////////////////
+UI_32 CSystemManager::calculate_max_shutdown_time() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_MaxShutdownTimeValue = 0;
+ std::string moduleName;
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ for (; l_GroupIterator != m_MapProclaunchGrps.end(); l_GroupIterator++) {
+ ModuleLaunchListIter l_ModuleListIterator =
+ l_GroupIterator->second.modules.begin();
+ for (; l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++) {
+ if (l_ModuleListIterator->shutdown_critical) {
+ if (l_MaxShutdownTimeValue < l_ModuleListIterator->shutdown_wait_time) {
+ moduleName = l_ModuleListIterator->name;
+ l_MaxShutdownTimeValue = l_ModuleListIterator->shutdown_wait_time;
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Max time: Module %s, time %d s",
+ moduleName.c_str(), l_MaxShutdownTimeValue);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_MaxShutdownTimeValue;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnShutdownModulesRequest
+/// Send Shutdown to all modules in reverse order of group
+///
+/// \param [in]
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnShutdownModulesRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
+ " Received from %s, m_SystemStarter.get_id() is %d",
+ FrameworkunifiedGetMsgSrc(hApp)
+ , m_SystemStarter.get_id());
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "m_SystemStarter.get_id() is %d", m_SystemStarter.get_id());
+
+ SetCmdHist("SS_SM_SHUTDOWN_MODULES", m__CWORD56_CmdHist, m__CWORD56_HistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ Pwr_ServiceSetInterface l_tServiceSetIf;
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < Pwr_ServiceSetInterface > (hApp, l_tServiceSetIf))) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ BOOL isImmShutdown = FALSE;
+
+ // If the Shutdown is not completed after the Shutdown is requested, it is forcibly reset.
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_SHUTDOWN_COMPLETE_MONITOR],
+ SM_SHUTDOWN_COMPLETE_MONITOR_TIMEOUT, 0, 0, 0);
+
+ if (m_isImmResetReq) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " ImmReset");
+ isImmShutdown = TRUE;
+ }
+
+ switch (l_tServiceSetIf.data.shutdownRequestMsg.lastUserMode) {
+ case epsumINVALID:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: shutdownRequestMsg.lastUserMode == epsumINVALID");
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+
+ case epsumOFF:
+ case epsumON: {
+ switch (m_SMCurrentState) {
+ case SS_SM_READY_TO_LAUNCH_APP:
+ case SS_SM_APPS_LAUNCH_IN_PROGRESS:
+ case SS_SM_APPS_LAUNCHED_READY_TO_START:
+ isImmShutdown = TRUE;
+ case SS_SM_APPS_START_COMPLETE:
+ case SS_SM_APPS_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ case SS_SM_APPS_PRE_RUN_COMPLETE:
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_RUN_COMPLETE:
+
+ if (l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger ==
+ epssdmsdtIGN_OFF) {
+ m_ResetCount = 0;
+ if (PowerHalSetResetInfo(AGL_RESET_COUNTER, m_ResetCount)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not back up m_ResetCount(%lu) to power_hal", m_ResetCount);
+ }
+
+ if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, 0)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not reset AGL_ERRLOG_COUNTER");
+ }
+ }
+ if (!m_isPrevErrEventCompleted
+ || ((!((m_SMCurrentState == SS_SM_APPS_START_COMPLETE)
+ || (m_SMCurrentState == SS_SM_APPS_PRE_RUN_COMPLETE)
+ || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_RUN_COMPLETE)))
+ && (l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger
+ == epssdmsdtIGN_OFF
+ || l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger
+ == epssdmsdtNORMAL_RESET))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "shutdown pending");
+ if (!m_dqDeferMsg.empty()) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ SM_POWER_EVENT_INFO deferMsg(SS_SM_SHUTDOWN_MODULES, l_tServiceSetIf);
+ m_dqDeferMsg.push(deferMsg);
+ }
+ } else {
+ // The shutdownTrigger has already been validated by
+ // Power::OnShutdownRequestMsg()
+ m_shutdownTrigger = l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger;
+ m_lastUserMode = l_tServiceSetIf.data.shutdownRequestMsg.lastUserMode;
+
+ // Notify services ShutDownTrigger the FrameworkunifiedOnStop, if dataResetMode is configured
+ // When using FastSleep, be aware that it may be overwritten here
+ switch (m_DataResetMode) {
+ case e_SS_SM_DATA_RESET_MODE_FACTORY:
+ m_shutdownTrigger = epssdmsdtFACTORY_DATA_RESET;
+ break;
+ case e_SS_SM_DATA_RESET_MODE_USER:
+ m_shutdownTrigger = epssdmsdtUSER_DATA_RESET;
+ break;
+ default:
+ break;
+ }
+
+ if (isImmShutdown) {
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_GROUP_LAUNCH_WAIT_TIMER]);
+
+ // Do not use m_shutdownTrigger because it is updated on DataReset
+ switch (l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger) {
+ case epssdmsdtGENERIC_ERROR_RESET:
+ case epssdmsdtFATAL_ERROR_RESET:
+ CALL_AND_LOG_STATUS((*m_pfStopCompleteHandler)(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Received a Shutdown command while in "
+ "the '%s' state - returning Shutdown "
+ "Response msg now",
+ GetStr(m_SMCurrentState).c_str());
+
+ CALL_AND_LOG_STATUS(SendShutdownResponseMessage(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ break;
+ }
+
+ } else {
+ InitiateAllGroupsShutdown(hApp);
+ }
+ }
+ break;
+
+ case SS_SM_APPS_STOPPING_AT__CWORD56__REQ:
+ case SS_SM_APPS_STOPPING_AT_INTERNAL_REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ:
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Received a Shutdown command while already in "
+ "the '%s' state !!!",
+ GetStr(m_SMCurrentState).c_str());
+ break;
+ } // End switch ( m_SMCurrentState )
+ break;
+ } // End case epsumOFF | epsumON
+ } // End switch (m_lastUserMode )
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnShutdownModulesRequest( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SendSystemModeInfoResponse
+/// send SystemModeInfo to
+/// _CWORD56_ ( via Power Service-> PSMShadow ) as an IPC 'Start Notification'
+/// message, informing _CWORD56_ of the startup state of the _CWORD102_.
+///
+/// \param [in] HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::SendSystemModeInfoResponse(HANDLE hApp, EPWR_STARTUP_STAGE_TYPE f_startupStage) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SystemModeInfo l_SystemModeInfo;
+
+ memcpy(&l_SystemModeInfo, &m_SystemModeInfo, sizeof(l_SystemModeInfo));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "stage:%d", f_startupStage);
+ l_SystemModeInfo.startupStage = f_startupStage;
+
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM_SYSTEM_MODE_INFO_RSPN,
+ sizeof(l_SystemModeInfo), (PVOID) & l_SystemModeInfo);
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendSystemModeInfoResponse(%s) errored: 0x%X",
+ GetStr(l_SystemModeInfo.startupStage).c_str(), l_eStatus);
+ } else {
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " SendSystemModeInfoResponse(%s) successful",
+ GetStr(l_SystemModeInfo.startupStage).c_str());
+ // LCOV_EXCL_STOP
+ }
+
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(SS_SM_SYSTEM_MODE_INFO_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::SendSystemModeInfoResponse( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnSystemModeInfoRequest
+/// Handle System Mode Info request. Send System Mode Info read from NVM
+///
+/// \param [in] HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnSystemModeInfoRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+ m_isRcvModeInfo = TRUE;
+
+ SetCmdHist("SS_SM_SYSTEM_MODE_INFO_REQ", m__CWORD56_CmdHist, m__CWORD56_HistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ if (m_SystemModeInfo.startupStage == epssusfINVALID) {
+ // Transitioning to SYSTEM_SERVICES_STARTED if startupStage == INVALID
+ m_SystemModeInfo.startupStage = epssusSYSTEM_SERVICES_STARTED;
+ }
+
+ l_eStatus = SendSystemModeInfoResponse(hApp, epssusSYSTEM_SERVICES_STARTED);
+ LOG_STATUS(l_eStatus, "SendSystemModeInfoResponse()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (TRUE == m_isRstPending) {
+ ESMCpuResetReason l_resetReason = m_rstPendingInfo.resetReason;
+ std::string l_messageStr = m_rstPendingInfo.messageStr;
+
+ m_isRstPending = FALSE;
+ m_rstPendingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_INVALID;
+ memset(m_rstPendingInfo.messageStr, 0, sizeof(m_rstPendingInfo.messageStr));
+
+ l_eStatus = PerformCpuReset(hApp, l_resetReason, l_messageStr);
+ LOG_STATUS(l_eStatus, "PerformCpuReset()"); // LCOV_EXCL_BR_LINE 6: Because it is executed only once and cannot see all branches
+ }
+
+ if (m_SystemModeInfo.startupStage == epssusALL_SERVICES_LAUNCHED) {
+ // If startupStage == ALL_SERVICES_LAUNCHED
+ // Notify here because Launch of all SVCs is completed first.
+ l_eStatus = SendSystemModeInfoResponse(hApp, epssusALL_SERVICES_LAUNCHED);
+ LOG_STATUS(l_eStatus, "SendSystemModeInfoResponse()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnSystemModeInfoRequest( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnInitCompReportCallback
+/// Handle InitComp report.
+///
+/// \param [in] HANDLE hApp
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnInitCompReportCallback(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("SS_SM_INITCOMP_REP", m__CWORD56_CmdHist, m__CWORD56_HistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnInitCompReportCallback( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup have_all_services_start_completed
+/// check if state of all services is MODULE_STATE_STARTED
+///
+/// \param [in]
+///
+///
+/// \return BOOL
+/// Success ==> TRUE
+/// Failure ==> FALSE
+///////////////////////////////////////////////////////////////////////////////
+BOOL CSystemManager::have_all_services_start_completed(const SMModuleState f_moduleState) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL bIsStartCompleted = TRUE;
+ SMModuleState l_failedState = MODULE_STATE_INVALID;
+
+ switch (f_moduleState) {
+ case MODULE_STATE_STARTED:
+ l_failedState = MODULE_STATE_START_FAILED;
+ break;
+ case MODULE_STATE_STARTED_PRE:
+ l_failedState = MODULE_STATE_START_PRE_FAILED;
+ break;
+ case MODULE_STATE_STOPPED_PRE:
+ l_failedState = MODULE_STATE_STOP_PRE_FAILED;
+ break;
+ case MODULE_STATE_STARTED_BACKGROUND:
+ l_failedState = MODULE_STATE_START_BACKGROUND_FAILED;
+ break;
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ l_failedState = MODULE_STATE_STOP_BACKGROUND_FAILED;
+ break;
+ default:
+ bIsStartCompleted = FALSE;
+ break;
+ }
+ if (l_failedState != MODULE_STATE_INVALID) {
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ for (; l_GroupIterator != m_MapProclaunchGrps.end(); l_GroupIterator++) {
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+ for (; l_ModuleListIterator != l_GroupIterator->second.modules.end(); l_ModuleListIterator++) {
+ if ((l_ModuleListIterator->is_start_required == TRUE)
+ && ((l_ModuleListIterator->IsModuleState(f_moduleState) == FALSE) // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ && (l_ModuleListIterator->IsModuleState(MODULE_STATE_SKIPPED) == FALSE) // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ && (l_ModuleListIterator->IsModuleState(l_failedState) == FALSE))) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ // Allow _SKIPPED/START_FAILED for StartRespMonitor conditions
+ bIsStartCompleted = FALSE;
+ break;
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return bIsStartCompleted;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup is_critical_service_stopped
+///
+///
+/// \param [in]
+///
+///
+/// \return BOOL
+/// Success ==> TRUE
+/// Failure ==> FALSE
+///////////////////////////////////////////////////////////////////////////////
+BOOL CSystemManager::is_service_shutdown_ready(ModuleLaunchListIter &modIte) {
+ if (((modIte->shutdown_critical && modIte->is_start_required)
+ || (modIte->name == FRAMEWORKUNIFIED_NS_NPSERVICE))
+ && modIte->IsModuleState(MODULE_STATE_STOPPED) == FALSE) {
+ // Not shutdown_ready if NPP or shutdown_critical services are not STOPPED.
+ return FALSE;
+ }
+ return TRUE;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup have_critical_services_stopped
+/// check if state of all critical services is MODULE_STATE_STOPPED
+///
+/// \param [in]
+///
+///
+/// \return BOOL
+/// Success ==> TRUE
+/// Failure ==> FALSE
+///////////////////////////////////////////////////////////////////////////////
+BOOL CSystemManager::have_critical_services_stopped() {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ uint numStoppingModules = 0;
+
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ for (; l_GroupIterator != m_MapProclaunchGrps.end(); l_GroupIterator++) {
+ ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+ for (; l_ModuleListIterator != l_GroupIterator->second.modules.end(); l_ModuleListIterator++) {
+ if (l_ModuleListIterator->IsModuleState(MODULE_STATE_STOP_SENT)
+ && l_ModuleListIterator->shutdown_critical) {
+ numStoppingModules++;
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (numStoppingModules == 0);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup perform_force_reset
+///
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::perform_force_reset(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "+");
+
+ // Since initialization must be performed by the PSMs during FactReset, do not NaviDet them as much as possible.
+ if (e_SS_SM_DATA_RESET_MODE_FACTORY == m_DataResetMode) {
+ fprintf(stderr,
+ "SS_SysManager/%s/NO NAVIDET!! but SendShutdownComp for FactReset\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "NO NAVIDET!! but SendShutdownComp for FactReset");
+ CALL_AND_LOG_STATUS(send_shutdown_complete_response(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ sleep(60);
+ } else if (access("/nv/BS/ss/system_manager/rwdata/ss_debug", F_OK) == 0) {
+ fprintf(stderr, "SS_SysManager/%s/NO NAVIDET!! but SendShutdownComp\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NO NAVIDET!! but SendShutdownComp");
+ CALL_AND_LOG_STATUS(send_shutdown_complete_response(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ sleep(60);
+ }
+
+ fflush(stderr);
+ usleep(100 * 1000);
+
+ if (0 == PsmNaviResetPower(hApp, m_ResetFactor)) { // LCOV_EXCL_BR_LINE 200: power_hal if, can not to be error.
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ usleep(300 * 1000);
+ fprintf(stderr, "SS_SysManager/%s/Error: Not Reset !!!\n", __FUNCTION__);
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+
+ send_shutdown_complete_response(hApp); // Try to NAVI_RESET even if ignored
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup send_shutdown_complete_response
+///
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::send_shutdown_complete_response(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CALL_AND_LOG_STATUS(ResetModulesStateToConnected(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ SMSetState(hApp, SS_SM_APPS_LAUNCHED_READY_TO_START);
+ // m_ActiveGroupId = SS_SM_INITIAL_GROUP;
+
+ // all the modules have stopped, send Shutdown Response to Power Service
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " All critical services have stopped, Active Group ID is now %d",
+ m_SystemStarter.get_id());
+#if 1
+ CALL_AND_LOG_STATUS(SendShutdownResponseMessage(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+#else
+ //
+ // Normal, production flow is to call SendShutdownResponseMessage(), which
+ // sends the Shutdown Response message to the _CWORD56_, causing the _CWORD56_ to
+ // remove power from the _CWORD102_ before queued-up FRAMEWORKUNIFIEDLOG messages can be // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ // processed by SS_LoggerService.
+ //
+ // Optional development flow is to NOT call SendShutdownResponseMessage(),
+ // thus giving the _CWORD102_ time to process its FRAMEWORKUNIFIEDLOG messages. Since this is an // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ // abnormal, 'bad' condition of NOT sending a Shutdown Response message to
+ // the _CWORD56_, be very obvious about this state by displaying both
+ // compile-time and run-time warning messages.
+ //
+#warning NOT calling SendShutdownResponseMessage(hApp) !
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " Warning: SendShutdownResponseMessage( hApp ) "
+ "#def'f out; ShutdownResponse NOT sent to _CWORD56_");
+#endif
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::SendShutdownResponseMessage(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ SS_SM_SHUTDOWN_MODULES_CMPL_RSPN, 0, (PVOID) NULL); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "FrameworkunifiedSendMsg(PowerService,SS_SM_SHUTDOWN_MODULES_CMPL_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::SendShutdownResponseMessage( HANDLE hApp )
+
+
+PsmFactorT CSystemManager::GetResetFactor(PCSTR f_module_name, BOOL f_user_reset) {
+ PsmFactorT l_reset_factor = PSM_FACTOR_NONE;
+ EFrameworkunifiedStatus l_eStatus;
+ ModuleLaunchListIter l_moduleIter;
+ l_eStatus = GetModuleIterator(f_module_name, l_moduleIter); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("GetModuleIterator()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_reset_factor = GetResetFactor(l_moduleIter, f_user_reset);
+ }
+ return l_reset_factor;
+} // End of PsmFactorT CSystemManager::GetResetFactor(PCSTR f_module_name)
+
+
+PsmFactorT CSystemManager::GetResetFactor(const ModuleLaunchListIter f_module_iter, BOOL f_user_reset) {
+ PsmFactorT l_reset_factor;
+ if (f_module_iter->IsAGLUnit() == TRUE) {
+ if (f_module_iter->IsAGLResetHistoryDisable() == TRUE) {
+ l_reset_factor = PSM_FACTOR_AGL;
+ } else {
+ l_reset_factor = PSM_FACTOR_AGL_WITH_HISTORY;
+ }
+ } else {
+ if (f_module_iter->IsNonAGLResetHistoryDisable() == TRUE) {
+ l_reset_factor = PSM_FACTOR_TIER1;
+ } else {
+ l_reset_factor = PSM_FACTOR_TIER1_WITH_HISTORY;
+ }
+ }
+
+ if (f_user_reset == TRUE) {
+ if ((l_reset_factor == PSM_FACTOR_AGL) || (l_reset_factor == PSM_FACTOR_TIER1)) {
+ l_reset_factor = PSM_FACTOR_USER;
+ } else {
+ l_reset_factor = PSM_FACTOR_USER_WITH_HISTORY;
+ }
+ }
+ return l_reset_factor;
+} // End of PsmFactorT GetResetFactor(ModuleLaunchListIter & f_module_iter)
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnClientStopMonitorTimerExpiry
+///
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnClientStopMonitorTimerExpiry(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from group %d", m_SystemStarter.get_id());
+
+ SetCmdHist("SM_TIMER_CLIENT_STOP_MONITOR", m_TimerCmdHist, m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if ((m_SMCurrentState == SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ)
+ || (m_SMCurrentState == SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ)
+ || m_SystemStarter.get_id() <= SS_SM_THIRD_GROUP) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: StopCompTimeout:gid:%d", m_SystemStarter.get_id());
+ fprintf(stderr, "SS_SysManager/%s/Error: StopCompTimeout:gid:%d\n", __FUNCTION__, m_SystemStarter.get_id());
+
+ for (GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ l_GroupIterator != m_MapProclaunchGrps.end();
+ l_GroupIterator++) {
+ for (ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+ l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++) {
+ if (l_ModuleListIterator->group_id >= m_SystemStarter.get_id()
+ && is_service_shutdown_ready(l_ModuleListIterator) == FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s", l_ModuleListIterator->name.c_str());
+ fprintf(stderr, "SS_SysManager/%s/Error: %s\n", __FUNCTION__, l_ModuleListIterator->name.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ if (!m_SystemStarter.is_begin()) {
+ // Continue termination processing to perform BackupManager termination processing.
+ m_SystemStarter.decrement_id();
+ check_all_groups_have_stopped(hApp);
+ } else {
+ // DEAD CODE
+ fprintf(stderr, "SS_SysManager/%s:SVC stop timeout\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " SVC stop timeout");
+ l_eStatus = CallStopCompleteHandler(hApp);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "CallStopCompleteHandler( hApp )"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ } else {
+ // The current m_ActiveGroupId group just timed out. If possible,
+ // decrement it, and then see if there are more groups to send
+ // stop requests to.
+ if (!m_SystemStarter.is_begin()) {
+ m_SystemStarter.decrement_id();
+ }
+ check_all_groups_have_stopped(hApp);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnClientStopMonitorTimerExpiry( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup check_all_groups_have_stopped
+/// check that all the groups has stopped
+///
+/// \param [in]
+///
+///
+/// \return VOID
+///////////////////////////////////////////////////////////////////////////////
+VOID CSystemManager::check_all_groups_have_stopped(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_ActiveGroupId = m_SystemStarter.get_id();
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " m_SystemStarter.get_id() is %d, 'm_NPPStopSent' is '%s'"
+ , m_SystemStarter.get_id(), GetStr(m_NPPStopSent).c_str());
+
+ // send stop to next group in reverse order
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " m_NPPStopSent is %s", GetStr(m_NPPStopSent).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ if (!m_NPPStopSent) {
+ l_eStatus = stop_all_modules_of_group(hApp);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: stop_all_modules_of_group(%d) errored: %d/'%s'",
+ l_ActiveGroupId, l_eStatus, GetStr(l_eStatus).c_str());
+ }
+ } else { // (m_ActiveGroupId < SS_SM_INITIAL_GROUP)
+ BOOL l_bIsDetectTimeout;
+
+ if ((l_bIsDetectTimeout = !have_critical_services_stopped())) {
+ // If the Critical service is not terminated even when the final GROUP is completed, DUMP the applicable service and issue NAVI_DET.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FinalCriticalCheck");
+ fprintf(stderr, "SS_SysManager/%s:FinalCriticalCheck\n", __FUNCTION__); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ for (GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.begin();
+ l_GroupIterator != m_MapProclaunchGrps.end();
+ l_GroupIterator++) {
+ for (ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin();
+ l_ModuleListIterator != l_GroupIterator->second.modules.end();
+ l_ModuleListIterator++) {
+ if (is_service_shutdown_ready(l_ModuleListIterator) == FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s",
+ l_ModuleListIterator->name.c_str());
+ fprintf(stderr, "SS_SysManager/%s/Error: %s\n", // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ __FUNCTION__,
+ l_ModuleListIterator->name.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+ fprintf(stderr, "SS_SysManager/%s:critical service no stop\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "critical service no stop");
+ }
+
+ CALL_AND_LOG_STATUS(CallStopCompleteHandler(hApp, l_bIsDetectTimeout)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // In PastModel002, there was a transition to WAITING_FOR_CRITICAL_APPS in the following processing, but in _CWORD71_,
+ // the transition to WAITING_FOR_CRITICAL_APPS was eliminated by revising the termination processing.
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return;
+} // End of VOID CSystemManager::check_all_groups_have_stopped( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup MarkModuleStateStopped
+/// Sets Module State to STOP COMPLETE
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnNppStopComplete
+/// Npp Stop Complete complete Response\Ack Handlers
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnNppStopComplete(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("NPS_NPP_STOP_ACK", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ char l_cBuf[100];
+ snprintf(l_cBuf, sizeof(l_cBuf), "ProcessModuleStopCompleteResponse(%s)", FRAMEWORKUNIFIED_NS_NPSERVICE);
+ l_eStatus = ProcessModuleStopCompleteResponse(hApp, FRAMEWORKUNIFIED_NS_NPSERVICE);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus CSystemManager::GetModuleIterator(PCSTR f_moduleName, ModuleLaunchListIter &f_moduleIter) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ ModuleLaunchListIter l_moduleIter;
+// static int l_numTimesEntered = 0 ;
+// l_numTimesEntered++ ;
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__ // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+// , " NTE %d: Looking for %s"
+// , l_numTimesEntered
+// , f_moduleName);
+
+ BOOL l_bIsFound = FALSE;
+ for (GroupLaunchMapIter l_GroupIter = m_MapProclaunchGrps.begin();
+ !l_bIsFound && l_GroupIter != m_MapProclaunchGrps.end();
+ l_GroupIter++) {
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__ // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+// , " NTE %d: Checking group %d/%s"
+// , l_numTimesEntered
+// , l_GroupIter->second.id
+// , l_GroupIter->second.name.c_str());
+
+ for (l_moduleIter = l_GroupIter->second.modules.begin();
+ !l_bIsFound && (l_moduleIter != l_GroupIter->second.modules.end());
+ l_moduleIter++) {
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__ // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+// , " NTE %d: Checking PCSTR '%s' against std::string '%s': %d, %s"
+// , l_numTimesEntered
+// , f_moduleName
+// , l_moduleIter->name.c_str()
+// , strcmp(l_moduleIter->name.c_str(), f_moduleName)
+// , (0 == strcmp(l_moduleIter->name.c_str(), f_moduleName) ? "True" : "False"));
+
+ l_bIsFound =
+ (0 == strcmp(l_moduleIter->name.c_str(), f_moduleName));
+ if (l_bIsFound) {
+ f_moduleIter = l_moduleIter;
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+//// " NTE %d:"
+// " '%s' is in group %d/%s"
+//// , l_numTimesEntered
+// , f_moduleIter->name.c_str()
+// , l_GroupIter->second.id
+// , l_GroupIter->second.name.c_str());
+ l_eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ }
+
+ if (!l_bIsFound) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+// " NTE %d:"
+ " Error: '%s' is not in group map 'm_MapProclaunchGrps'"
+// , l_numTimesEntered
+ , f_moduleName);
+ if (0 != strcmp(f_moduleName, SERVICE_SYSMANAGER)) {
+ SysMgrConfiguration m_launchConfig;
+ m_launchConfig.PrintAllInfo(m_MapProclaunchGrps);
+ }
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::GetModuleIterator( PCSTR f_moduleName
+
+BOOL CSystemManager::IsGroupStarted(UI_32 f_groupID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bIsStarted = TRUE;
+
+ GroupLaunchMapIter l_GroupIter = m_MapProclaunchGrps.find(f_groupID);
+ if (l_GroupIter == m_MapProclaunchGrps.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Group Map Empty; was looking for group %d", f_groupID);
+ } else {
+ ModuleLaunchListIter l_ModuleListIter = l_GroupIter->second.modules.begin();
+ const SMModuleState l_dest_state = InProgressStateToState(); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length)
+ if (l_dest_state != MODULE_STATE_INVALID) {
+ for (; l_ModuleListIter != l_GroupIter->second.modules.end(); l_ModuleListIter++) {
+ if (((l_ModuleListIter->IsModuleState(l_dest_state) == FALSE) // LCOV_EXCL_BR_START 11:Gcov constraints (because exception-handling routes are automatically generated)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_START_FAILED) == FALSE)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_START_PRE_FAILED) == FALSE)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_PRE_FAILED) == FALSE)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_START_BACKGROUND_FAILED) == FALSE)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_BACKGROUND_FAILED) == FALSE)
+ && (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_FAILED) == FALSE))
+ // LCOV_EXCL_BR_STOP 11:Gcov constraints (because exception-handling routes are automatically generated)
+ || ((l_ModuleListIter->is_start_required == TRUE)
+ // LCOV_EXCL_START 6: Because the value cannot be stored to make the condition true
+ && ((l_ModuleListIter->IsModuleState(MODULE_STATE_LAUNCHING) == TRUE)
+ || (l_ModuleListIter->IsModuleState(MODULE_STATE_CONNECTED) == TRUE)
+ || (l_ModuleListIter->IsModuleState(MODULE_STATE_LAUNCHED) == TRUE)))) {
+ // LCOV_EXCL_STOP 6: Because the value cannot be stored to make the condition true
+ l_bIsStarted = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " No: '%s' in group %d/%s is '%s'", l_ModuleListIter->name.c_str(),
+ l_GroupIter->second.id, l_GroupIter->second.name.c_str(),
+ l_ModuleListIter->ModuleStateStr().c_str());
+ break;
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bIsStarted;
+} // End of BOOL CSystemManager::IsGroupStarted(UI_32 f_groupId)
+
+BOOL CSystemManager::IsGroupStopped(UI_32 f_groupID) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ BOOL l_bIsStopped = TRUE;
+ ModuleLaunchListIter l_ModuleListIter;
+
+ GroupLaunchMapIter l_GroupIter = m_MapProclaunchGrps.find(f_groupID);
+ if (l_GroupIter == m_MapProclaunchGrps.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Group Map Empty; was looking for group %d",
+ f_groupID);
+ } else {
+ for (l_ModuleListIter = l_GroupIter->second.modules.begin();
+ l_bIsStopped
+ && l_ModuleListIter != l_GroupIter->second.modules.end();
+ l_ModuleListIter++) {
+ if (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_SENT)) {
+ l_bIsStopped = FALSE;
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_bIsStopped;
+} // End of BOOL CSystemManager::IsGroupStopped(UI_32 f_groupId)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnStopComplete
+/// Shutdown complete Response\Ack Handlers
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnModuleStopCompleteResponse(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusErrOther;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ PCSTR l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", l_moduleName);
+ SetCmdHist("SS_SM_STOP_COMPL_RSPN", m_SMCmdHist, m_SMHistIter, l_moduleName);
+
+ char l_cBuf[100];
+ snprintf(l_cBuf, sizeof(l_cBuf), "ProcessModuleStopCompleteResponse(%s)", l_moduleName);
+ l_eStatus = ProcessModuleStopCompleteResponse(hApp, l_moduleName);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnModuleStopCompleteResponse( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnGetStartExtInfo
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnGetStartExtInfo(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ T_SS_SM_START_ExtDataStructType l_extInfo = { 0 };
+
+ SS_STATIC_ASERT(sizeof(T_SS_SM_START_ExtDataStructType) == SS_SM_START_EXT_INFO_SIZE); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+ ");
+
+ SetCmdHist("SS_SM_GET_START_EXT_INFO", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ l_extInfo.isProgUpdated =
+ (m_ProgUpdateState & SS_SM_PROG_UPDATE_STATE_UPDATED) ? TRUE : FALSE;
+ l_extInfo.isMapUpdated =
+ (m_ProgUpdateState & SS_SM_PROG_UPDATE_STATE_MAP_UPDATED) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_extInfo.isMapDiffUpdated =
+ (m_ProgUpdateState & SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ ModuleLaunchListIter l_ModuleListIter;
+
+ l_eStatus = GetModuleIterator(FrameworkunifiedGetMsgSrc(hApp), l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s not found", FrameworkunifiedGetMsgSrc(hApp));
+ } else {
+ switch (l_ModuleListIter->relaunch_status) {
+ case NotRelaunched:
+ l_extInfo.relaunchStatus = e_SS_SM_RELAUNCH_STATUS_NONE;
+ break;
+ case RelaunchSafe:
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_extInfo.relaunchStatus = e_SS_SM_RELAUNCH_STATUS_SAFE;
+ break;
+ case RelaunchErr:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_extInfo.relaunchStatus = e_SS_SM_RELAUNCH_STATUS_ERR;
+ break;
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_extInfo.relaunchStatus = e_SS_SM_RELAUNCH_STATUS_NONE;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData()
+ // because this request is sent by FrameworkunifiedInvokeSync()
+ l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_extInfo, sizeof(l_extInfo));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnGetStartExtInfo( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnGetStopExtInfo
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnGetStopExtInfo(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ T_SS_SM_STOP_ExtDataStructType l_extInfo = { 0 };
+
+ SS_STATIC_ASERT(sizeof(T_SS_SM_STOP_ExtDataStructType) == SS_SM_STOP_EXT_INFO_SIZE); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+ ");
+
+ SetCmdHist("SS_SM_GET_STOP_EXT_INFO", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ l_extInfo.isProgUpdated =
+ (m_ProgUpdateState & SS_SM_PROG_UPDATE_STATE_UPDATED) ? TRUE : FALSE;
+
+ // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData()
+ // because this request is sent by FrameworkunifiedInvokeSync()
+ l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_extInfo, sizeof(l_extInfo));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnGetStopExtInfo( HANDLE hApp )
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnModuleStopCompleteNotification
+///
+/// \param [in]
+///
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnModuleStopCompleteNotification(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+ ");
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ ShutdownComplete l_shutdownNotif; /// \file frameworkunified_framework_types.h
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ // Report any errors found. *
+ // *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < ShutdownComplete > (hApp, l_shutdownNotif))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ PCSTR l_moduleName = l_shutdownNotif.cServiceName;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " '%s' 'Shutdown Complete Status' is 0x%X", l_moduleName,
+ l_shutdownNotif.eShutdownCompleteStatus);
+
+ char l_cBuf[100];
+ snprintf(l_cBuf, sizeof(l_cBuf),
+ "ProcessModuleStopCompleteResponse(%s)", l_moduleName);
+ l_eStatus = ProcessModuleStopCompleteResponse(hApp, l_moduleName);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::onmodulestopcompletenotification( HANDLE hApp )
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus CSystemManager::ProcessModuleStopCompleteResponse(HANDLE hApp, PCSTR f_moduleName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ ModuleLaunchListIter l_ModuleListIter;
+ l_eStatus = GetModuleIterator(f_moduleName, l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Module %s not found in Group Launch Map", f_moduleName);
+ } else {
+ switch (m_SMCurrentState) {
+ case SS_SM_READY_TO_LAUNCH_APP:
+ case SS_SM_APPS_LAUNCH_IN_PROGRESS:
+ case SS_SM_APPS_LAUNCHED_READY_TO_START:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Received from client while in "
+ "the '%s' state !!!",
+ GetStr(m_SMCurrentState).c_str());
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+
+ case SS_SM_APPS_STOPPING_AT__CWORD56__REQ:
+ case SS_SM_APPS_STOPPING_AT_INTERNAL_REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ:
+ case SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ:
+ if (m_SystemStarter.get_id() == SS_SM_THIRD_GROUP) {
+ // Execute shutdown_critical services termination synchronization prior to CoreModule(backupManager termination processing
+ l_ModuleListIter->SetModuleState(MODULE_STATE_STOPPED);
+ if (have_critical_services_stopped()) { // Transition after all critical services have ended
+ ProcessGroupOnModuleStopResponse(hApp, m_SystemStarter.get_id());
+ }
+ } else {
+ l_eStatus = ModuleCompleteResponse(hApp, l_ModuleListIter,
+ MODULE_STATE_STOPPED,
+ (SysMgrCbType3<CSystemManager,
+ &CSystemManager::IsGroupStopped>),
+ (SysMgrCbType2<CSystemManager,
+ &CSystemManager::ProcessGroupOnModuleStopResponse>),
+ "stop");
+ }
+ break;
+
+ case SS_SM_APPS_START_COMPLETE:
+ case SS_SM_APPS_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_RUN_COMPLETE:
+ case SS_SM_APPS_PRE_START_IN_PROGRESS:
+ case SS_SM_APPS_PRE_STOP_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_RUN_COMPLETE:
+ case SS_SM_APPS_BACKGROUND_START_IN_PROGRESS:
+ case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Received from client while in "
+ "the '%s' state !!!",
+ GetStr(m_SMCurrentState).c_str());
+ l_eStatus = eFrameworkunifiedStatusErrOther;
+ break;
+ } // End switch ( m_SMCurrentState )
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ProcessModuleStopCompleteResponse(
+
+EFrameworkunifiedStatus CSystemManager::ProcessGroupOnModuleStopResponse(HANDLE hApp, UI_32 f_groupID) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ UI_32 l_ActiveGroupId = m_SystemStarter.get_id();
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_CLIENT_STOP_MONITOR]);
+
+ if (f_groupID != l_ActiveGroupId) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Group %d stop complete, but m_SystemStarter.get_id() is %d",
+ f_groupID
+ // , m_ActiveGroupId); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ , l_ActiveGroupId);
+ } else {
+ if (!m_SystemStarter.is_begin()) {
+ m_SystemStarter.decrement_id();
+ }
+ check_all_groups_have_stopped(hApp);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ProcessGroupOnModuleStopResponse( HANDLE hApp
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup stop_all_modules_of_group
+/// Send SS_SM_STOP to all modules of the given group
+///
+/// \param [in]
+///
+///
+/// \return VOID
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::stop_all_modules_of_group(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ModuleLaunchList::reverse_iterator l_revIter;
+
+ UI_32 l_uiMaxGroupWaitTime_sec = 0;
+ UI_32 l_uiMaxGroupWaitTime_msec = 0;
+ UI_32 l_uiModuleWaitTime = 0;
+
+ // GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(m_ActiveGroupId);
+ GroupLaunchMapIter l_GroupIterator = m_MapProclaunchGrps.find(m_SystemStarter.get_id());
+ if (l_GroupIterator == m_MapProclaunchGrps.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Group %d not found; 'm_MapProclaunchGrps' is empty"
+ //, m_ActiveGroupId); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ , m_SystemStarter.get_id());
+ l_eStatus = eFrameworkunifiedStatusDbRecNotFound;
+ } else {
+ int l_numModulesMessaged = 0;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "StopReq grp:%d", m_SystemStarter.get_id());
+
+ T_SS_SM_STOP_DataStructType l_SM_STOP_Struct;
+ l_SM_STOP_Struct.shutdownTrigger = m_shutdownTrigger;
+ l_SM_STOP_Struct.lastUserMode = m_lastUserMode;
+
+ for (l_revIter = l_GroupIterator->second.modules.rbegin();
+ l_revIter != l_GroupIterator->second.modules.rend();
+ l_revIter++) {
+ // LCOV_EXCL_BR_START 11: Excluded due to gcov constraints (others)
+ if ((l_revIter->IsModuleState(MODULE_STATE_START_SENT) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STARTED) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_START_PRE_SENT) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STARTED_PRE) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STOP_PRE_SENT) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STOPPED_PRE) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_START_BACKGROUND_SENT) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STARTED_BACKGROUND) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STOP_BACKGROUND_SENT) == TRUE)
+ || (l_revIter->IsModuleState(MODULE_STATE_STOPPED_BACKGROUND) == TRUE)) {
+ // LCOV_EXCL_BR_STOP 11: Excluded due to gcov constraints (others)
+ if (FRAMEWORKUNIFIED_NS_NPSERVICE == l_revIter->name) {
+ if (epssdmsdtFACTORY_DATA_RESET == m_shutdownTrigger) {
+ CALL_AND_LOG_STATUS(FrameworkunifiedSendStopToNSNPP(hApp, eFrameworkunifiedDataResetShutdown, eFrameworkunifiedUserData | eFrameworkunifiedFactoryData)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (epssdmsdtUSER_DATA_RESET == m_shutdownTrigger) {
+ CALL_AND_LOG_STATUS(FrameworkunifiedSendStopToNSNPP(hApp, eFrameworkunifiedDataResetShutdown, eFrameworkunifiedUserData)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (epssdmsdtFAST_SLEEP_MODE == m_shutdownTrigger) {
+ CALL_AND_LOG_STATUS(FrameworkunifiedSendStopToNSNPP(hApp, eFrameworkunifiedQuickShutdown)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ CALL_AND_LOG_STATUS(FrameworkunifiedSendStopToNSNPP(hApp, eFrameworkunifiedNormalShutdown)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ l_revIter->SetModuleState(MODULE_STATE_STOP_FAILED);
+ } else {
+ l_revIter->SetModuleState(MODULE_STATE_STOP_SENT);
+ l_numModulesMessaged++;
+ }
+
+ m_NPPStopSent = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " m_NPPStopSent is %s", GetStr(m_NPPStopSent).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ // End else if ( FRAMEWORKUNIFIED_NS_NPSERVICE == l_ModuleListIter->name )
+ } else {
+ l_eStatus = l_revIter->SendMsgAndUpdateState(&l_SM_STOP_Struct);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "l_revIter->SendMsgAndUpdateState(&l_SM_STOP_Struct)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK == l_eStatus) {
+ if (epssdmsdtFAST_SLEEP_MODE == m_shutdownTrigger) {
+ l_uiModuleWaitTime = l_revIter->fast_shutdown_wait_time;
+
+ } else {
+ l_uiModuleWaitTime = l_revIter->shutdown_wait_time;
+ }
+ if (l_uiModuleWaitTime > l_uiMaxGroupWaitTime_sec) {
+ l_uiMaxGroupWaitTime_sec = l_uiModuleWaitTime;
+ }
+ l_numModulesMessaged++;
+ }
+ } // End if MODULE_STATE_STARTED || MODULE_STATE_START_SENT
+ } else if (l_revIter->IsModuleState(MODULE_STATE_INVALID)
+ && FRAMEWORKUNIFIED_NS_NPSERVICE == l_revIter->name) {
+ m_NPPStopSent = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "StopNotSent:%s is INVALID", FRAMEWORKUNIFIED_NS_NPSERVICE);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "StopNotSent:%s is %s",
+ l_revIter->name.c_str(),
+ l_revIter->ModuleStateStr().c_str());
+ }
+ }
+
+ if (0 == l_numModulesMessaged) {
+ LogGroupModulesState(m_SystemStarter.get_id() // m_ActiveGroupId // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ , " Warning: NO modules were sent SS_SM_STOP");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "StopComp grp:%d", l_GroupIterator->second.id);
+
+ if (m_SystemStarter.get_id() > SS_SM_INITIAL_GROUP) {
+ m_SystemStarter.decrement_id();
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " m_ActiveGroupId is now %d", m_SystemStarter.get_id());
+
+ check_all_groups_have_stopped(hApp);
+ }
+ } else {
+ if (epssdmsdtFAST_SLEEP_MODE == m_shutdownTrigger) {
+ // fast shutdown wait time always comes in milli seconds
+ UI_32 l_uiTotalWaitTime = l_uiMaxGroupWaitTime_sec;
+ l_uiMaxGroupWaitTime_sec = l_uiTotalWaitTime / 1000;
+ l_uiMaxGroupWaitTime_msec = l_uiTotalWaitTime % 1000;
+ } else {
+ // Other types of shutdown except fast shutdown always comes in seconds.
+ l_uiMaxGroupWaitTime_msec = 0;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "StopTimer grp:%d time:%d.%d",
+ m_SystemStarter.get_id(), l_uiMaxGroupWaitTime_sec,
+ l_uiMaxGroupWaitTime_msec);
+ m_GroupLaunchTimer->StartTimerMulti(
+ m_aTimerIDs[eSM_TIMER_CLIENT_STOP_MONITOR],
+ l_uiMaxGroupWaitTime_sec, l_uiMaxGroupWaitTime_msec, 0, 0,
+ m_SystemStarter.get_id());
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of VOID CSystemManager::stop_all_modules_of_group(HANDLE hApp)
+
+EFrameworkunifiedStatus CSystemManager::ValidateUserModeMessage(HANDLE hApp, EPWR_USER_MODE_TYPE &l_eUserModeState) { // LCOV_EXCL_START 6: Because the condition cannot be set // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ Pwr_ServiceSetInterface tServiceSetIf;
+ EPWR_USER_MODE_TYPE l_my_eUserModeState;
+
+ // ReadMsg(): *
+ // Check hApp ptr, msg size, msg reception, read msg if all ok. *
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < Pwr_ServiceSetInterface > (hApp, tServiceSetIf))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_my_eUserModeState = tServiceSetIf.data.user_mode.mode;
+ switch (l_my_eUserModeState) {
+ case epsumINVALID:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: l_eUserModeState == epsumINVALID");
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+
+ case epsumOFF:
+ case epsumON:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Validated '%s'",
+ l_my_eUserModeState == epsumON ? "epsumON" : "epsumOFF");
+ l_eUserModeState = l_my_eUserModeState;
+ l_eStatus = eFrameworkunifiedStatusOK;
+ break;
+
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ } // End switch
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ValidateUserModeMessage( HANDLE hApp, EPWR_USER_MODE_TYPE &l_eUserModeState )
+// LCOV_EXCL_STOP
+
+//*****************************************************************************
+// Next Wakeup Type Set Protocol functions *
+// *
+EFrameworkunifiedStatus CSystemManager::OnSetNextWakeupTypeRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ ESMNextWakeupType l_wakeupType;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+ SetCmdHist("SS_SM_NEXT_WAKEUP_TYPE_SET_REQ", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < ESMNextWakeupType > (hApp, l_wakeupType))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ switch (l_wakeupType) {
+ case e_SS_SM_NEXT_WAKEUP_TYPE_NONE:
+ case e_SS_SM_NEXT_WAKEUP_TYPE_COLD:
+ case e_SS_SM_NEXT_WAKEUP_TYPE_HOT:
+ break;
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "unknown type(%d)", l_wakeupType);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ }
+ }
+ l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_eStatus, sizeof(l_eStatus));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnSetNextWakeupTypeRequest( HANDLE hApp )
+
+// *
+// End of Boot Mode Protocol functions *
+//*****************************************************************************
+
+
+//*****************************************************************************
+// Data Reset Mode Protocol functions *
+// *
+EFrameworkunifiedStatus CSystemManager::OnSetDataResetModeRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ ESMDataResetModeInfo l_dataResetMode;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("SS_SM_DATA_RESET_MODE_SET_REQ", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < ESMDataResetModeInfo > (hApp, l_dataResetMode))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ uint32_t tmp;
+ m_DataResetMode = l_dataResetMode;
+ tmp = static_cast<uint32_t>(m_DataResetMode);
+ if (PowerHalSetResetInfo(AGL_DATARESET_STATE, tmp)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not set AGL_DATARESET_STATE.");
+ // Return error to client of system_manager.
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ //
+ // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData()
+ // because this request is sent by FrameworkunifiedInvokeSync()
+ //
+ l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_eStatus, sizeof(l_eStatus));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnSetDataResetModeRequest( HANDLE hApp )
+
+EFrameworkunifiedStatus CSystemManager::OnSetProgUpdateStateRequest(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus;
+ SMProgUpdateState l_progUpdateState;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp));
+
+ SetCmdHist("SS_SM_PROG_UPDATE_STATE_SET_REQ", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp));
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < SMProgUpdateState > (hApp, l_progUpdateState))) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ m_ProgUpdateState |= l_progUpdateState;
+ if (PowerHalSetResetInfo(AGL_PROGUPDATE_STATE, m_ProgUpdateState)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not set AGL_PROGUPDATE_STATE.");
+ // return Error to client of system_manager.
+ l_eStatus = eFrameworkunifiedStatusFail;
+ }
+ }
+ // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData()
+ // because this request is sent by FrameworkunifiedInvokeSync()
+ l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_eStatus, sizeof(l_eStatus));
+ LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnSetProgUpdateStateRequest( HANDLE hApp )
+
+EFrameworkunifiedStatus CSystemManager::CallStopCompleteHandler(HANDLE hApp, BOOL bIsDetectTimeout /* = FALSE */) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+
+ if (bIsDetectTimeout) {
+ fprintf(stderr, "SS_SysManager/%s/State StopComplete(timeout)\n", __FUNCTION__);
+ } else {
+ fprintf(stderr, "SS_SysManager/%s/State StopComplete\n", __FUNCTION__);
+ }
+
+ l_eStatus = SecureChipOff();
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: SecureChipOff Failed");
+ }
+
+ l_eStatus = (*m_pfStopCompleteHandler)(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::CallStopCompleteHandler( HANDLE hApp )
+
+
+//*****************************************************************************
+// Soft Reset Protocol functions *
+// *
+static char *get_line(const char *filepath) {
+ char line[LINE_MAX];
+ FILE *fp;
+
+ if ((fp = fopen(filepath, "rb")) == NULL)
+ return NULL;
+ if (fgets(line, LINE_MAX, fp) == NULL) { // LCOV_EXCL_BR_LINE 5:fgets error
+ // LCOV_EXCL_START 5: fgets error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fclose(fp);
+ return NULL;
+ // LCOV_EXCL_STOP
+ }
+ fclose(fp);
+
+ return strdup(line);
+}
+
+EFrameworkunifiedStatus CSystemManager::PerformCpuReset(HANDLE hApp,
+ ESMCpuResetReason f_eSmCpuResetReason, std::string f_messageStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ if (FALSE == m_isRcvModeInfo) {
+ // If the condition for implementing the CpuReset request is not satisfied, keep the request.
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Cpu Reset Pending");
+ m_isRstPending = TRUE;
+ m_rstPendingInfo.resetReason = f_eSmCpuResetReason;
+ snprintf(m_rstPendingInfo.messageStr,
+ sizeof(m_rstPendingInfo.messageStr), "%s", f_messageStr.c_str());
+ } else {
+ switch (f_eSmCpuResetReason) {
+ case e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR:
+ case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR:
+ case e_SS_SM_CPU_RESET_REASON_DSP_ERR:
+ m_isImmResetReq = TRUE;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " will reset immediately");
+ // The break is omitted because the same process as for a normal reboot is performed.
+ case e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET:
+ m_pfStopCompleteHandler = (SysMgrCallback<CSystemManager, &CSystemManager::perform_force_reset>);
+ case e_SS_SM_CPU_RESET_REASON_NORMAL: {
+ TSystemManagerCpuResetInfo l_resetInfo;
+
+ l_resetInfo.resetReason = f_eSmCpuResetReason;
+ snprintf(l_resetInfo.messageStr, SS_SM_RESET_MSG_STR_SIZE, "%s", f_messageStr.c_str());
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM_CPU_RESET_REQ,
+ sizeof(l_resetInfo), (PVOID) & l_resetInfo);
+ LOG_STATUS(l_eStatus, // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ "FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM_CPU_RESET_REQ)");
+ }
+ break;
+ case e_SS_SM_CPU_RESET_REASON_DATA_RESET: {
+ ESMDataResetType l_eSmDataResetType;
+
+ switch (m_DataResetMode) {
+ case e_SS_SM_DATA_RESET_MODE_FACTORY:
+ l_eSmDataResetType = e_SS_SM_DATA_RESET_TYPE_FACTORY;
+ break;
+ case e_SS_SM_DATA_RESET_MODE_USER:
+ l_eSmDataResetType = e_SS_SM_DATA_RESET_TYPE_USER;
+ l_eStatus = FrameworkunifiedBroadcastEvent(hApp, SS_SM_EVENT_USER_DATA_RESET, NULL, 0);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedBroadcastEvent(SS_SM_EVENT_USER_DATA_RESET)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ break;
+ default:
+ SS_ASERT_LOG(0, "unexpected data reset mode : %d", m_DataResetMode); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ }
+ if (l_eStatus == eFrameworkunifiedStatusOK) {
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession,
+ SS_SM_REMOTE_DATA_RESET_REQ, sizeof(l_eSmDataResetType),
+ (PVOID) & l_eSmDataResetType);
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM_REMOTE_DATA_RESET_REQ)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ break;
+ case e_SS_SM_CPU_RESET_REASON_INVALID:
+ default:
+ SS_ASERT_LOG(0, " Error: Unknown CPU reset request type: 0x%X/%d", // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ f_eSmCpuResetReason, f_eSmCpuResetReason);
+ l_eStatus = eFrameworkunifiedStatusInvldParam;
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::PerformCpuReset( ESMCpuResetReason f_eSmCpuResetReason )
+
+//*****************************************************************************
+// CPU Reset Protocol functions *
+// *
+EFrameworkunifiedStatus CSystemManager::OnCpuResetRequest(HANDLE hApp) { // SS_SM_CPU_RESET_REQ
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(hApp);
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", l_moduleName.c_str());
+
+ // If you implement FastSleep,
+ // ShutdownTrigger of FrameworkunifiedOnStop needs to be changed to FAST_SLEEP_MODE,
+ // and also MaxShutdownTime needs to be changed to CriticalAppsMaxShutdownTimeFastSleep
+
+ try {
+ TSystemManagerCpuResetInfo l_resetInfo;
+ SetCmdHist("SS_SM_CPU_RESET_REQ", m_SMCmdHist, m_SMHistIter, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < TSystemManagerCpuResetInfo > (hApp, l_resetInfo))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ char l_cBuf[100];
+ EErrorEventType l_errorEventType;
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_loggingInfo.messageStr = l_resetInfo.messageStr;
+ l_loggingInfo.suffixStr = l_resetInfo.suffixStr;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
+ " CPU Reset Reason: '%d'/'%s' from %s",
+ l_resetInfo.resetReason,
+ GetStr(l_resetInfo.resetReason).c_str(),
+ FrameworkunifiedGetMsgSrc(hApp));
+
+ if (e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL == l_resetInfo.resetReason) {
+ m_isImmResetReq = TRUE;
+ l_resetInfo.resetReason = e_SS_SM_CPU_RESET_REASON_NORMAL;
+ }
+ switch (l_resetInfo.resetReason) {
+ case e_SS_SM_CPU_RESET_REASON_DATA_RESET:
+ switch (m_DataResetMode) {
+ case e_SS_SM_DATA_RESET_MODE_FACTORY:
+ case e_SS_SM_DATA_RESET_MODE_USER:
+ break;
+ case e_SS_SM_DATA_RESET_MODE_NONE:
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "unexpected data reset mode : %d", m_DataResetMode);
+ throw eFrameworkunifiedStatusInvldParam;
+ }
+ case e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR:
+ case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR:
+ case e_SS_SM_CPU_RESET_REASON_DSP_ERR:
+ case e_SS_SM_CPU_RESET_REASON_NORMAL:
+ l_errorEventType = eErrorEventTypeModuleInvokedResetRequest;
+ l_loggingInfo.resetReason = l_resetInfo.resetReason;
+ break;
+ case e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET:
+ // Separate ErrorEventType only for USER_FORCE_RESET, because the logs to be saved differ.
+ l_errorEventType = eErrorEventTypeUserInvokedUserForceReset;
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET;
+ break;
+ case e_SS_SM_CPU_RESET_REASON_INVALID:
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Unknown CPU reset request type: 0x%X/%d",
+ l_resetInfo.resetReason, l_resetInfo.resetReason);
+ throw eFrameworkunifiedStatusInvldParam;
+ }
+
+ l_eStatus = ErrorEventEnqueue(hApp, l_errorEventType, l_moduleName,
+ eErrorEventResetTypeHard, l_loggingInfo);
+
+ snprintf(l_cBuf, sizeof(l_cBuf), "ErrorEventEnqueue(%s)",
+ GetStr(l_errorEventType).c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ } catch (EFrameworkunifiedStatus e) {
+ l_eStatus = e;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// *
+// End of CPU Reset Protocol functions *
+//*****************************************************************************
+
+VOID CSystemManager::InitiateAllGroupsShutdown(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ // Prioritize safe termination sequence and do not save logs during termination
+ m_errorEventQueueLocked = TRUE;
+
+ m_MaxShutdownTime = calculate_max_shutdown_time();
+
+ l_eStatus = FrameworkunifiedNPPublishNotification(hApp, NTFY_SSSystemMgrShutdownStarted, NULL, 0);
+
+ SetCmdHist(NTFY_SSSystemMgrShutdownStarted, m_PubCmdHist, m_PubHistIter, ""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "FrameworkunifiedNPPublishNotification(" NTFY_SSSystemMgrShutdownStarted ")");
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_START_RESP_MONITOR_WAIT_TIMER]);
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER_CLIENT_START_MONITOR]);
+
+ // Stop Heartbeat thread activity
+ l_eStatus = SendRequestToHeartBeat(hApp, SS_HEARTBEAT_STOP, NULL, 0);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "SendRequestToHeartBeat(SS_HEARTBEAT_STOP)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ SMSetState(hApp, SS_SM_APPS_STOPPING_AT__CWORD56__REQ);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "shutdownTrigger:%s, lastUserMode:%s",
+ GetStr(m_shutdownTrigger).c_str(), GetStr(m_lastUserMode).c_str());
+
+ fprintf(stderr, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ "SS_SysManager/%s/State shutdownTrigger:%s, lastUserMode:%s\n", // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ __FUNCTION__, GetStr(m_shutdownTrigger).c_str(), // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ GetStr(m_lastUserMode).c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ /// Send SS_SM_STOP to all modules, starting with the m_ActiveGroupId group
+ m_NPPStopSent = FALSE;
+ check_all_groups_have_stopped(hApp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return;
+} // End of EFrameworkunifiedStatus CSystemManager::InitiateAllGroupsShutdown(HANDLE hApp)
+
+VOID CSystemManager::SendDeferMsg(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ if (!m_dqDeferMsg.empty()) {
+ EFrameworkunifiedStatus l_eStatus;
+ SM_POWER_EVENT_INFO deferMsg;
+
+ deferMsg = m_dqDeferMsg.front();
+ m_dqDeferMsg.pop();
+
+ HANDLE hSender = McOpenSender(SERVICE_SYSMANAGER);
+ if (hSender == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: McOpenSender(SERVICE_SYSMANAGER)");
+ // LCOV_EXCL_STOP
+ } else {
+ CALL_AND_LOG_STATUS_IF_ERRORED( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ McSend(hSender, SERVICE_POWER, deferMsg.first,
+ sizeof(Pwr_ServiceSetInterface),
+ (PVOID) & deferMsg.second));
+ CALL_AND_LOG_STATUS_IF_ERRORED(McClose(hSender)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ return;
+} // End of VOID CSystemManager::SendDeferMsg(HANDLE hApp)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup PublishPowerOnOffNotification
+/// Power Off notification handler
+///
+/// \param [in]
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::PublishPowerOnOffNotification(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = PerformPowerOnOffUserModePublication(hApp, NTFY_SSSystemMgrPowerOnOff);
+
+ SetCmdHist(NTFY_SSSystemMgrPowerOnOff, m_PubCmdHist, m_PubHistIter, "");
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformPowerOnOffUserModePublication()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus CSystemManager::PublishUserModeNotification(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = PerformPowerOnOffUserModePublication(hApp, NTFY_SSSystemMgrUserMode);
+
+ SetCmdHist(NTFY_SSSystemMgrUserMode, m_PubCmdHist, m_PubHistIter, "");
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformPowerOnOffUserModePublication()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::PublishUserModeNotification(
+
+EFrameworkunifiedStatus CSystemManager::PerformPowerOnOffUserModePublication(HANDLE hApp, const char * p_NotificationStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ char l_cBuf[500] = { 0 };
+
+ if (m_SMConfig.UMConfig.IsUserModeNotificationABOOL) {
+ BOOL l_bUuserMode(m_PowerType_to_SSBoolEnumMap[m_Wake.powerupType]);
+
+ snprintf(l_cBuf, sizeof(l_cBuf), "FrameworkunifiedNPPublishNotification(%s, %s)",
+ p_NotificationStr, GetStr(l_bUuserMode).c_str());
+ l_eStatus = FrameworkunifiedNPPublishNotification(hApp, p_NotificationStr,
+ &l_bUuserMode, sizeof(l_bUuserMode));
+ } else {
+ T_SS_SM_UserModeOnOffNotification_Struct l_UserModeOnOffStruct(
+ m_PowerType_to_SSBoolEnumMap[m_Wake.powerupType],
+ m_StartUpReason, m_userModeChangeReason);
+
+ snprintf(l_cBuf, sizeof(l_cBuf),
+ "FrameworkunifiedNPPublishNotification(%s, %s, %s, %s)", p_NotificationStr,
+ GetStr(l_UserModeOnOffStruct.isUserModeOn).c_str(),
+ GetStr(m_StartUpReason).c_str(),
+ GetStr(m_userModeChangeReason).c_str());
+ l_eStatus = FrameworkunifiedNPPublishNotification(hApp, p_NotificationStr,
+ &l_UserModeOnOffStruct, sizeof(l_UserModeOnOffStruct));
+ }
+
+ SetCmdHist(p_NotificationStr, m_PubCmdHist, m_PubHistIter, "");
+ LOG_STATUS(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::PerformPowerOnOffUserModePublication(
+
+EFrameworkunifiedStatus CSystemManager::ResetModulesStateToConnected(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ModuleLaunchListIter l_moduleIter;
+ for (GroupLaunchMapIter l_GroupIter = m_MapProclaunchGrps.begin();
+ l_GroupIter != m_MapProclaunchGrps.end(); l_GroupIter++) {
+ for (l_moduleIter = l_GroupIter->second.modules.begin();
+ l_moduleIter != l_GroupIter->second.modules.end();
+ l_moduleIter++) {
+ if (l_moduleIter->name == FRAMEWORKUNIFIED_NS_NPSERVICE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s ( Group %d/%s ) is %s",
+ l_moduleIter->name.c_str(), l_GroupIter->second.id,
+ l_GroupIter->second.name.c_str(),
+ l_moduleIter->ModuleStateStr().c_str());
+ l_moduleIter->SetModuleState(MODULE_STATE_STARTED); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ // End else if ( FRAMEWORKUNIFIED_NS_NPSERVICE == l_ModuleListIter->name )
+ } else {
+ switch (l_moduleIter->GetModuleState()) {
+ case MODULE_STATE_INVALID:
+ case MODULE_STATE_SKIPPED:
+ case MODULE_STATE_LAUNCHING:
+ case MODULE_STATE_LAUNCHED:
+ case MODULE_STATE_LAUNCH_FAILED:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " %s ( Group %d/%s ) is %s, NOT setting to "
+ "MODULE_STATE_CONNECTED",
+ l_moduleIter->name.c_str(), l_GroupIter->second.id,
+ l_GroupIter->second.name.c_str(),
+ l_moduleIter->ModuleStateStr().c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ break;
+
+ case MODULE_STATE_STARTED:
+ case MODULE_STATE_START_SENT:
+ case MODULE_STATE_CONNECTED:
+ case MODULE_STATE_START_FAILED:
+ case MODULE_STATE_STOP_FAILED:
+ case MODULE_STATE_STOP_SENT:
+ case MODULE_STATE_STOPPED:
+ case MODULE_STATE_START_PRE_SENT:
+ case MODULE_STATE_START_PRE_FAILED:
+ case MODULE_STATE_STARTED_PRE:
+ case MODULE_STATE_STOP_PRE_SENT:
+ case MODULE_STATE_STOP_PRE_FAILED:
+ case MODULE_STATE_STOPPED_PRE:
+ case MODULE_STATE_START_BACKGROUND_SENT:
+ case MODULE_STATE_START_BACKGROUND_FAILED:
+ case MODULE_STATE_STARTED_BACKGROUND:
+ case MODULE_STATE_STOP_BACKGROUND_SENT:
+ case MODULE_STATE_STOP_BACKGROUND_FAILED:
+ case MODULE_STATE_STOPPED_BACKGROUND:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s ( Group %d/%s ) is %s",
+ l_moduleIter->name.c_str(), l_GroupIter->second.id,
+ l_GroupIter->second.name.c_str(),
+ l_moduleIter->ModuleStateStr().c_str());
+ l_moduleIter->SetModuleState(MODULE_STATE_CONNECTED);
+ break;
+ // default: Don't code a 'default' here - let the compiler
+ // issue a warning ( set via -Wall or -Wswitch ) when the set of
+ // enumerations changes - then the maintainer will
+ // automagically know to update this switch statement.
+ }
+ }
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::ResetModulesStateToConnected(HANDLE hApp)
+
+EFrameworkunifiedStatus CSystemManager::On_CWORD56_HeartBeatRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ PCSTR l_senderName = FrameworkunifiedGetMsgSrc(hApp);
+
+ SetCmdHist("SS_SM__CWORD56__HEARTBEAT_REQ", m_SMCmdHist, m_SMHistIter, l_senderName);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_INFO, __FUNCTION__, " Received from %s", l_senderName);
+ EPWR_HB_REQ_MSG_STRUCT l_hbReq;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < EPWR_HB_REQ_MSG_STRUCT > (hApp, l_hbReq))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+
+ m_GroupLaunchTimer->StopTimer(m_aTimerIDs[eSM_TIMER__CWORD56__HEARTBEAT_RESPONSE]);
+
+ if (l_hbReq.IntervalSec > 0) {
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER__CWORD56__HEARTBEAT_RESPONSE], 0, 0,
+ l_hbReq.IntervalSec, 0);
+ } else if (l_hbReq.IntervalSec == 0) { // LCOV_EXCL_BR_LINE 8: As the condition is never false
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM__CWORD56__HEARTBEAT_RSPN, 0, NULL);
+
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM__CWORD56__HEARTBEAT_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSystemManager::On_CWORD56_HeartBeatResponseIntervalTimerExpiry(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ SetCmdHist("SM_TIMER__CWORD56__HEARTBEAT_RESPONSE", m_TimerCmdHist, m_TimerHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_eStatus = FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM__CWORD56__HEARTBEAT_RSPN, 0, NULL);
+
+ LOG_STATUS(l_eStatus, "FrameworkunifiedSendMsg(m_hPowerServiceSession, SS_SM__CWORD56__HEARTBEAT_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+// EOF of /SS_SystemManager/src/ss_system_manager_callbacks.cpp
+
diff --git a/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event.cpp b/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event.cpp
new file mode 100755
index 0000000..131b86a
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event.cpp
@@ -0,0 +1,945 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for IAT error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <sys/mman.h>
+#include <sys/procfs.h>
+#include <libgen.h>
+#include <spawn.h>
+#include <errno.h>
+#include <sys/timeb.h>
+#include <system_service/ss_system_manager_notifications.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_client_names.h>
+#include <system_service/ss_power_service_if.h>
+#include <processlauncher/ProcessLauncher_if.h>
+#include <processlauncher/ss_sm_process_launcher_protocol.h>
+#include <processlauncher/ss_sm_process_launcher.h>
+#include <heartbeat/ss_hb_if.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <stub/ss_diag.h>
+#include <system_service/ss_test_clients.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/frameworkunified_application.h>
+
+#include <system_service/ss_sm_thread_names.h>
+#include <system_service/ss_templates.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <native_service/ns_np_service_nor_persistence.h>
+#include <boost/bind.hpp>
+#include <string>
+#include "ss_system_manager.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_default_paths.h"
+#include "ss_sm_version.h"
+
+template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)>
+ EFrameworkunifiedStatus SysMgrCallback(HANDLE hApp) { // LCOV_EXCL_START 6: Can not set condition
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ C * pObj = static_cast<C *>(&CSystemManager::GetInstance());
+ if (pObj) {
+ l_eStatus = (pObj->*M)(hApp);
+ }
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+//******************************************************************************
+void Init_EErrorEventReset_StrMap(std::map<EErrorEventResetType, SS_String> & m_strMap) { // NOLINT
+ MAP_ENTRY(m_strMap, eErrorEventResetTypeNone); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ MAP_ENTRY(m_strMap, eErrorEventResetTypeHard); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+}
+class EnumStringMap<EErrorEventResetType, Init_EErrorEventReset_StrMap> m_oEErrorEventResetTypeMap;
+SS_String GetStr(EErrorEventResetType f_enum) { // LCOV_EXCL_START 6: Can not set condition
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_oEErrorEventResetTypeMap.GetStr(f_enum);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ErrorEventInit
+/// This function initializes the error event handling subsystem.
+/// This function MUST be called by System Manager initialization.
+///
+/// \param HANDLE f_hApp AGL FW application handle.
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ErrorEventInit(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ Timer *l_pTimer;
+
+ m_isPrevErrEventCompleted = TRUE;
+ m_errorEventResult = eFrameworkunifiedStatusOK;
+ m_errorEventQueueLocked = FALSE;
+ m_errorEventCurrentIter = m_errorEventQueue.end();
+
+ l_pTimer = &m_errorEventTimers[eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ];
+ l_pTimer->Initialize(f_hApp, SS_SM_ERROR_EVENT_TIMER_ID_LOGGER_START_REQ,
+ boost::bind(&CSystemManager::OnErrorEventLoggerStartRequestTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_pTimer = &m_errorEventTimers[eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN];
+ l_pTimer->Initialize(f_hApp, SS_SM_ERROR_EVENT_TIMER_ID_DEBUG_DUMP_RSPN,
+ boost::bind(&CSystemManager::OnDebugDumpCompleteTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_pTimer = &m_errorEventTimers[eSM_ERROR_EVENT_TIMER_BOOT_MICRO_LOG_RSPN];
+ l_pTimer->Initialize(f_hApp, SS_SM_ERROR_EVENT_TIMER_ID_BOOT_MICRO_LOG_RSPN,
+ boost::bind(&CSystemManager::OnErrorEventBootMicroLogResponseTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_pTimer = &m_errorEventTimers[eSM_ERROR_EVENT_TIMER_CORE_FILE_POLL];
+ l_pTimer->Initialize(f_hApp, SS_SM_ERROR_EVENT_TIMER_ID_CORE_FILE_POLL,
+ boost::bind(&CSystemManager::OnErrorEventCoreFilePollTimeout, this, _1)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ErrorEventEnqueue
+/// Conditional queue error events for processing by the error event state
+/// machine.
+///
+/// \param f_hApp Handle to AGL application.
+///
+/// \param f_eventType Error event type.
+///
+/// \param f_moduleQueueName Error event trigger module queue name.
+///
+/// \param f_resetType Error event reset type (none, hard).
+///
+/// \param f_loggingInfo Logging information if applicable (optional).
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ErrorEventEnqueue(HANDLE f_hApp,
+ EErrorEventType f_eventType, std::string &f_moduleQueueName,
+ EErrorEventResetType f_resetType, const SMLoggingInfo &f_loggingInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ERROR_EVENT_INFO l_errorEventInfo;
+ ERROR_EVENT_QUEUE_ITER l_errorEventIter;
+ ERROR_EVENT_QUEUE_RET l_retVal;
+ BOOL isErrorReset = FALSE;
+
+ if (eErrorEventResetTypeHard == f_resetType) {
+ // Forced reset if shutdown process is not completed after Reboot requesting
+ m_GroupLaunchTimer->StartTimer(
+ m_aTimerIDs[eSM_TIMER_SHUTDOWN_COMPLETE_MONITOR],
+ SM_SHUTDOWN_COMPLETE_MONITOR_TIMEOUT, 0, 0, 0);
+
+ switch (f_loggingInfo.resetReason) {
+ case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR:
+ case e_SS_SM_CPU_RESET_REASON_DSP_ERR:
+ isErrorReset = TRUE;
+ break;
+ default:
+ break;
+ }
+ // LCOV_EXCL_START 6:This variable cannot be modified by external API
+ if ((m_ResetCount > SS_SM_ERR_NAVI_RESET_LIMIT) && isErrorReset) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6:This variable cannot be modified by external API (evaluated only initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ fprintf(stderr,
+ "SS_SysManager/%s:will NAVIDET as continuous error(%d) \n", __FUNCTION__, m_ResetCount);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "will NAVIDET as continuous error(%d)", m_ResetCount);
+ m_pfStopCompleteHandler = (SysMgrCallback<CSystemManager, &CSystemManager::perform_force_reset>);
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (TRUE == m_errorEventQueueLocked) {
+ l_eStatus = eFrameworkunifiedStatusAccessError;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. The Error Event Queue has been locked. No further items may be enqueued. System reset pending."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ } else {
+ GetTimeStamp(l_errorEventInfo.m_eventEnqueueTimeStamp);
+
+ l_errorEventInfo.m_moduleQueueName = f_moduleQueueName;
+ l_errorEventInfo.m_eventType = f_eventType;
+ l_errorEventInfo.m_errorEventResetType = f_resetType;
+ l_errorEventInfo.m_loggingInfo = f_loggingInfo;
+ l_errorEventInfo.m_prio = eErrorEventPrioDefault; // Make Prios of all ErrorEvent first-win as default
+ // It needs to add eErrorEventPrioxxx properly if design modification about priority required
+
+ if (eErrorEventResetTypeNone != f_resetType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " System will reset after logging");
+ }
+
+ l_retVal = m_errorEventQueue.insert(l_errorEventInfo);
+ if (FALSE == l_retVal.second) {
+ std::string l_errorEventName = GetStr(l_errorEventInfo.m_eventType);
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: %s is already queued or is in progress. Event dropped.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_errorEventName.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ }
+
+ l_eStatus = ErrorEventProcessNext(f_hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "ErrorEventProcessNext()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup PerformResetAfterLogging
+/// perform CPU reset after logging complete
+///
+/// \param f_hApp Handle to AGL application.
+/// f_eCpuResetReason CPU reset reason
+/// f_messageStr Error message string
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///
+///
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::PerformResetAfterLogging(HANDLE f_hApp,
+ ESMCpuResetReason f_eCpuResetReason, std::string f_messageStr) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = PerformCpuReset(f_hApp, f_eCpuResetReason, f_messageStr);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformCpuReset()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_BR_START 200: Can not satisfy the condition for calling from caller
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 200: Can not satisfy the condition for calling from caller
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT_LOG(0, "PerformCpuReset() : %d", l_eStatus);
+ // Erasing ErrorEvent only if resetting process is failed
+ m_errorEventQueue.erase(m_errorEventCurrentIter); // Erase last processed event.
+ // LCOV_EXCL_STOP
+ } else {
+ m_errorEventQueueLocked = TRUE; // Permanent lock until post reset.
+ m_errorEventQueue.clear(); // Drop queued events.
+ SendDeferMsg(f_hApp);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ErrorEventProcessNext
+/// Process the next error event from error event queue.
+///
+/// \param f_hApp Handle to AGL application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///
+/// \Notes (1) Removal from the queue occurs AFTER the entry has been processed
+/// AND just before the NEXT entry is to be obtained. Therefore,
+/// the first item enqueued MUST not be removed since it has not
+/// been processed. This is ensured by setting the iterator to END
+/// during module initialization. After processing the first event,
+/// the iterator will no longer be END until all events have been
+/// processed.
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::ErrorEventProcessNext(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ERROR_EVENT_QUEUE_ITER l_errorEventIter;
+ SMErrorEventNtfData l_errorEventNtfData;
+
+ if (TRUE == m_isPrevErrEventCompleted) { // Remove last completed item from front of queue.
+ // See Note #1.
+ if ((0 != m_errorEventQueue.size()) &&
+ (m_errorEventQueue.end() != m_errorEventCurrentIter)) {
+ // Completed logging by ErrorEvent
+ switch (m_errorEventCurrentIter->m_errorEventResetType) {
+ case eErrorEventResetTypeNone:
+ switch (m_errorEventCurrentIter->m_eventType) {
+ case eErrorEventTypeInterfaceunifiedEmmcLogs:
+ case eErrorEventTypeUserInvokedClearLogs:
+ if (eFrameworkunifiedStatusOK == m_errorEventResult) {
+ if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, 0)) {
+ // Logging only.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not reset AGL_ERRLOG_COUNTER");
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (eErrorEventTypeInterfaceunifiedEmmcLogs == m_errorEventCurrentIter->m_eventType) {
+ HANDLE hSession = FrameworkunifiedMcOpenSender(f_hApp,
+ m_errorEventCurrentIter->m_moduleQueueName.c_str());
+
+ if (hSession == NULL) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE 4: NSFW error case
+ != FrameworkunifiedSendMsg(hSession,
+ SS_SM_ERROR_EVENT_INTERFACEUNIFIED_EMMC_LOGS_RSPN,
+ sizeof(m_errorEventResult),
+ &m_errorEventResult)) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedMcClose(hSession)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ m_errorEventQueue.erase(m_errorEventCurrentIter); // Erase last processed event.
+ break;
+ case eErrorEventResetTypeHard:
+ TEXT(__FUNCTION__, "ERROR EVENT: Hard reset required for previously processed error event." // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ "Initiating reset and flushing logging queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != m_errorEventResult) {
+ // Logging at next launching by setting L to NaviDet if logging failed before rebooting
+ fprintf(stderr,
+ "SS_SysManager/%s:will NAVIDET as LOG save failed\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "will NAVIDET as LOG save failed");
+ m_pfStopCompleteHandler = (SysMgrCallback<CSystemManager,
+ &CSystemManager::perform_force_reset>);
+ }
+
+ if ((m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR) ||
+ (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_GENERIC_ERR) ||
+ (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_DSP_ERR) ||
+ (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET)) {
+ BOOL l_user_reset = FALSE;
+ if (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET) {
+ l_user_reset = TRUE;
+ }
+ m_ResetFactor = GetResetFactor(m_errorEventCurrentIter->m_moduleQueueName.c_str(), l_user_reset);
+ }
+
+ l_eStatus = PerformResetAfterLogging(f_hApp,
+ m_errorEventCurrentIter->m_loggingInfo.resetReason,
+ m_errorEventCurrentIter->m_loggingInfo.messageStr); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "PerformResetAfterLogging()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ break;
+ // LCOV_EXCL_START 6:Can not satisfy condition to branch
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Unknown reset type encountered: 0x%X/%d. No action taken.",
+ m_errorEventCurrentIter->m_errorEventResetType,
+ m_errorEventCurrentIter->m_errorEventResetType);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ // Check if a new work item exists.
+ if (0 != m_errorEventQueue.size()) {
+ // ErrorEvent startup process
+ m_errorEventCurrentIter = m_errorEventQueue.begin();
+
+ l_errorEventNtfData.EventType = m_errorEventCurrentIter->m_eventType;
+
+ if (eErrorEventResetTypeHard == m_errorEventCurrentIter->m_errorEventResetType) {
+ l_errorEventNtfData.isNeedReboot = TRUE;
+ } else {
+ l_errorEventNtfData.isNeedReboot = FALSE;
+ }
+
+ // Check BufferSize
+ size_t modl_len = sizeof(l_errorEventNtfData.ModuleName) - 1;
+
+ // SS Logger uses the l_errorEventNtfData.ModuleName as the LOGGERSERVICE_EMMC_LOGS and
+ // EEL_EXPORT destination path. eErrorEventTypeDiagEvent sends the destination path.
+ // For all other event types, the binary name is sent to logger.
+ // LCOV_EXCL_BR_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ if ((eErrorEventTypeInterfaceunifiedEmmcLogs
+ == m_errorEventCurrentIter->m_eventType) ||
+ (eErrorEventTypeEelExport
+ == m_errorEventCurrentIter->m_eventType) ||
+ (eErrorEventTypeDiagEvent
+ == m_errorEventCurrentIter->m_eventType)) {
+ // LCOV_EXCL_BR_STOP
+ strncpy(l_errorEventNtfData.ModuleName,
+ m_errorEventCurrentIter->m_loggingInfo.path.c_str(),
+ sizeof(l_errorEventNtfData.ModuleName) - 1);
+
+ size_t path_len = strlen(m_errorEventCurrentIter->m_loggingInfo.path.c_str());
+ if (path_len > modl_len) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Input buffer size over. input : %ld, enable : %ld",
+ path_len, modl_len);
+ }
+ l_errorEventNtfData.ModuleName[sizeof(l_errorEventNtfData.ModuleName) - 1] = 0;
+ } else {
+ strncpy(l_errorEventNtfData.ModuleName,
+ m_errorEventCurrentIter->m_loggingInfo.suffixStr.c_str(),
+ sizeof(l_errorEventNtfData.ModuleName) - 1);
+ }
+
+ // When the Reboot process is started during the execution of the LOG save sequence, an undefined value was set
+ // in m_errorEventCurrentIter. Therefore, the Reboot start timing due to an error in SS_Loger was changed from
+ // the time of ErrorEvent queuing to the time of dequeuing.
+
+ // LCOV_EXCL_BR_START 6: Because the following conditions cannot be satisfied when called from an external API
+ if ((SERVICE_LOGGER == m_errorEventCurrentIter->m_moduleQueueName)
+ && ((eErrorEventTypeProcessCrash
+ == m_errorEventCurrentIter->m_eventType)
+ || (eErrorEventTypeProcessExit
+ == m_errorEventCurrentIter->m_eventType)
+ || (eErrorEventTypeHeartBeatFailure
+ == m_errorEventCurrentIter->m_eventType)
+ || (eErrorEventTypeModConnFailed
+ == m_errorEventCurrentIter->m_eventType)
+ || (eErrorEventTypeStartRespFailed
+ == m_errorEventCurrentIter->m_eventType))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: Because the following conditions cannot be satisfied when called from an external API
+ // Note: If logger crashes, a core file will exist.
+ std::string l_hmiDispStr;
+ l_hmiDispStr = SERVICE_LOGGER;
+ if (eErrorEventResetTypeNone != m_errorEventCurrentIter->m_errorEventResetType) {
+ l_hmiDispStr += " - Shutting down, check for core file.";
+
+ // Since LOG save cannot be performed when an SSL error is detected, the LOG is saved at the next startup
+ // by rebooting with NaviDet = L after completion of the process.
+ fprintf(stderr, "SS_SysManager/%s:will NAVIDET as SSL dead\n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "will NAVIDET as SSL dead");
+ m_pfStopCompleteHandler = (SysMgrCallback<CSystemManager,
+ &CSystemManager::perform_force_reset>);
+
+ m_ResetFactor = GetResetFactor(SERVICE_LOGGER, FALSE);
+
+ l_eStatus = PerformResetAfterLogging(f_hApp,
+ e_SS_SM_CPU_RESET_REASON_GENERIC_ERR);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformResetAfterLogging()");
+ } else {
+ l_hmiDispStr += " - Check for core file.";
+ }
+
+ SMErrorEventNtfData l_errorEventNtfData;
+ l_errorEventNtfData.EventType = m_errorEventCurrentIter->m_eventType;
+ l_errorEventNtfData.isNeedReboot = FALSE;
+ snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName), "%s",
+ l_hmiDispStr.c_str());
+
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, // Show indication on HMI.
+ SS_SM_EVENT_ERROR,
+ NULL, &l_errorEventNtfData, sizeof(l_errorEventNtfData));
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedPublishEvent(SS_SM_EVENT_ERROR)");
+ } else if (m_errorEventCurrentIter->m_eventType == eErrorEventTypeModuleInvokedResetRequest
+ && (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_NORMAL
+ || m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_DATA_RESET)) {
+ l_eStatus = PerformResetAfterLogging(f_hApp,
+ m_errorEventCurrentIter->m_loggingInfo.resetReason,
+ m_errorEventCurrentIter->m_loggingInfo.messageStr); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformResetAfterLogging()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ } else {
+ BOOL bIsNeedLogging = TRUE;
+
+ {
+ UI_32 l_ErrLogCount = 0;
+ if (PowerHalGetResetInfo(AGL_ERRLOG_COUNTER, &l_ErrLogCount)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not get AGL_ERRLOG_COUNTER form power_hal, assume to 0.");
+ l_ErrLogCount = 0;
+ }
+
+ {
+ if ((l_ErrLogCount >= SS_SM_ERR_LOGGING_LIMIT)
+ && (eErrorEventResetTypeHard == m_errorEventCurrentIter->m_errorEventResetType)) {
+ fprintf(stderr, "SS_SysManager/%s:Skip Logging by continuous error \n", __FUNCTION__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Skip Logging by continuous error ");
+
+ m_ResetFactor = PSM_FACTOR_AGL_WITH_HISTORY;
+
+ l_eStatus =
+ PerformResetAfterLogging(f_hApp,
+ m_errorEventCurrentIter->m_loggingInfo.resetReason,
+ m_errorEventCurrentIter->m_loggingInfo.messageStr);
+ LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformResetAfterLogging()");
+ bIsNeedLogging = FALSE;
+ } else if (eErrorEventResetTypeHard
+ == m_errorEventCurrentIter->m_errorEventResetType) {
+ l_ErrLogCount++;
+ if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, l_ErrLogCount)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Could not set AGL_ERRLOG_COUNTER to power_hal.");
+ }
+ }
+ }
+ }
+
+ if (bIsNeedLogging) {
+ m_isPrevErrEventCompleted = FALSE;
+ m_errorEventResult = eFrameworkunifiedStatusOK;
+ BOOL result =
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ].Start(
+ SS_ERROR_EVENT_START_REQ_TO_SEC, 0, 0, 0);
+ if (FALSE == result) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Failed to start timer eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ.");
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp,
+ SS_SM_EVENT_ERROR_TO_SSL,
+ NULL, &l_errorEventNtfData,
+ sizeof(l_errorEventNtfData));
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " FrameworkunifiedPublishEvent(SS_SM_EVENT_ERROR_TO_SSL, "
+ "module name (optional): '%s', "
+ "event type: %d) returned '%d'/'%s'",
+ l_errorEventNtfData.ModuleName,
+ l_errorEventNtfData.EventType, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ }
+ }
+ }
+ }
+
+ // If Reboot has been started up to this point, m_errorEventQueue is cleared and checking is performed at the end because m_errorEventQueue is cleared.
+ if (0 == m_errorEventQueue.size()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Error Event queue empty. Error logging complete.");
+ m_errorEventCurrentIter = m_errorEventQueue.end(); // Invalidate iterator in case of spurious events.
+ SendDeferMsg(f_hApp);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnLoggingStartRequestFromSL
+/// This function gets called when System Logger initiates artifact
+/// collection for a trigger source that originates within System
+/// Logger or as a result of System Manager raising a logging
+/// event notification to System Logger.
+///
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnLoggingStartRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ModuleLaunchListIter l_ModuleListIter;
+ HANDLE l_hLoggerServiceSession;
+ EErrorEventType l_eventType;
+ SMErrorEventNtfData l_errorEventNtfData;
+
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ].Stop();
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp);
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg < EErrorEventType > (f_hApp, l_eventType))) {
+ LOG_ERROR("ReadMsg()");
+ } else {
+ if (0 == m_errorEventQueue.size()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Logging start request received for event type: %d/'%s', "
+ "but the logging queue is empty.!", l_eventType,
+ GetStr(l_eventType).c_str());
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else if (m_errorEventCurrentIter == m_errorEventQueue.end()) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Logging start request received for event type: %d/'%s', "
+ "but the current event iterator is invalid.",
+ l_eventType, GetStr(l_eventType).c_str());
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else if (m_errorEventCurrentIter->m_eventType != l_eventType) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Logging start request received for event type: %d/'%s', "
+ "but current work item is for event type: %d/'%s'.",
+ l_eventType, GetStr(l_eventType).c_str(),
+ m_errorEventCurrentIter->m_eventType,
+ GetStr(m_errorEventCurrentIter->m_eventType).c_str());
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ l_errorEventNtfData.EventType = l_eventType;
+ l_errorEventNtfData.isNeedReboot = FALSE;
+
+ // For boot micro reset, customize the string as per the reset reason.
+ if (l_eventType == eErrorEventTypeBootMicroReset) {
+ switch (m_BootMicroResetReason) {
+ case SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET:
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName),
+ "Boot Micro Reset. Reason: %d, Self Reset",
+ m_BootMicroResetReason);
+ break;
+
+ case SS_SM_BOOT_MICRO_RESET_REASON_USER_FORCE_RESET: // User Force Reset timeout.
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName),
+ "Boot Micro Reset. Reason: %d, UFR Timeout",
+ m_BootMicroResetReason);
+ break;
+
+ case SS_SM_BOOT_MICRO_RESET_REASON_DSP_RESET:
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName),
+ "Boot Micro Reset. Reason: %d, DSP Reset",
+ m_BootMicroResetReason);
+ break;
+
+ case SS_SM_BOOT_MICRO_RESET_REASON_HB_TIMEOUT:
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName),
+ "Boot Micro Reset. Reason: %d, HB Timeout",
+ m_BootMicroResetReason);
+ break;
+
+ default:
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName),
+ "Boot Micro Reset. Reason: %d, Unknown",
+ m_BootMicroResetReason);
+ break;
+ }
+ } else {
+ // All other error event types format =
+ // Binary Name <circumstantial> PID: TID: Additional info: </circumstantial>
+ std::string l_hmiDispStr = ErrorEventCreateHmiDisplayString();
+
+ (void) snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName), "%s",
+ l_hmiDispStr.c_str());
+ }
+
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, SS_SM_EVENT_ERROR, // To HMI
+ NULL, &l_errorEventNtfData, sizeof(l_errorEventNtfData));
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedPublishEvent(SS_SM_EVENT_ERROR)");
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = GetModuleIterator(SERVICE_LOGGER, l_ModuleListIter))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: GetModuleIterator(%s) errored: %d/'%s'",
+ SERVICE_LOGGER, l_eStatus, GetStr(l_eStatus).c_str());
+ } else {
+ l_hLoggerServiceSession = l_ModuleListIter->hsession;
+
+ l_eStatus = FrameworkunifiedSendMsg(l_hLoggerServiceSession,
+ SS_SM_ERROR_EVENT_LOGGING_START_RSPN, 0, NULL);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedSendMsg(SS_SM_ERROR_EVENT_LOGGING_START_RSPN)");
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnErrorEventLoggerStartRequestTimeout
+///
+/// \brief This function is called if System Logger fails to respond in a
+/// timely fashion to the published logger start request event
+/// SS_SM_EVENT_ERROR_TO_SSL. See OnLoggingStartRequest() which
+/// is the expected path should the timer period NOT expire.
+///
+/// \param [in] hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnErrorEventLoggerStartRequestTimeout(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ SMErrorEventNtfData l_errorEventNtfData;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Logger failed to respond to message SS_SM_EVENT_ERROR_TO_SSL in a timely fashion. Logging aborted.");
+
+ // Publish to HMI even if the error event will not be processed.
+ // In this way, developers can be made aware of the error condition
+ // and determine why logging did not proceed as expected.
+ if (m_errorEventCurrentIter != m_errorEventQueue.end()) {
+ l_errorEventNtfData.EventType = m_errorEventCurrentIter->m_eventType;
+ l_errorEventNtfData.isNeedReboot = FALSE;
+
+ std::string l_hmiDispStr = ErrorEventCreateHmiDisplayString();
+ snprintf(l_errorEventNtfData.ModuleName,
+ sizeof(l_errorEventNtfData.ModuleName), "%s.", l_hmiDispStr.c_str());
+
+ l_eStatus = FrameworkunifiedPublishEvent(f_hApp, SS_SM_EVENT_ERROR, // To HMI
+ NULL, &l_errorEventNtfData, sizeof(l_errorEventNtfData)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "FrameworkunifiedPublishEvent(SS_SM_EVENT_ERROR)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ m_isPrevErrEventCompleted = TRUE;
+ m_errorEventResult = eFrameworkunifiedStatusFail;
+ l_eStatus = ErrorEventProcessNext(f_hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "ErrorEventProcessNext()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSystemManager::OnErrorEventLoggingComplete(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ HANDLE l_hLoggerServiceSession;
+ ModuleLaunchListIter l_ModuleListIter;
+
+ // If logger does not send a logging start and instead immediately
+ // sends a logging complete response, then the start timer must be
+ // stopped to prevent a start response timeout from occuring.
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ].Stop();
+
+ m_errorEventResult = eFrameworkunifiedStatusFail;
+ if (sizeof(m_errorEventResult) != FrameworkunifiedGetMsgLength(f_hApp)) {
+ LOG_ERROR("DataSize mismatch");
+ } else if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &m_errorEventResult,
+ sizeof(m_errorEventResult), eSMRRelease))) {
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()");
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "m_errorEventResult = %d", m_errorEventResult);
+ }
+ m_isPrevErrEventCompleted = TRUE;
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = GetModuleIterator(SERVICE_LOGGER, l_ModuleListIter))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: GetModuleIterator(%s) errored: %d/'%s'",
+ SERVICE_LOGGER, l_eStatus, GetStr(l_eStatus).c_str());
+ } else {
+ l_hLoggerServiceSession = l_ModuleListIter->hsession;
+
+ l_eStatus = FrameworkunifiedSendMsg(l_hLoggerServiceSession,
+ SS_SM_ERROR_EVENT_LOGGING_COMPLETE_RSPN, 0, NULL);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus,
+ "FrameworkunifiedSendMsg(SS_SM_ERROR_EVENT_LOGGING_START_RSPN)");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " Info. Done processing error event %s.",
+ GetStr(m_errorEventCurrentIter->m_eventType).c_str());
+
+ l_eStatus = ErrorEventProcessNext(f_hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "ErrorEventProcessNext()");
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ActOnModuleFailure
+/// This function is called to take appropriate action of the failure
+/// reported by heart beat or crash detector. Attributes set in
+/// Launch configuration file are considered while taking action
+/// on the failed module.
+///
+/// \param f_hApp AGL FW application handle.
+/// f_moduleName Failed module name.
+/// f_refSoftResetRequired Return parameter indicating if a
+/// soft reset will be required.
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+const CHAR RestartModule[] = "me";
+
+EFrameworkunifiedStatus CSystemManager::ActOnModuleFailure(HANDLE f_hApp,
+ SS_String f_moduleName, BOOL &f_refResetRequired) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ ModuleLaunchListIter l_ModuleListIter;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ESMPLThreadCommandIds l_PLCmd = ePLThrdCmd_NONE;
+ SS_String l_PLCmdStr = "";
+
+ f_refResetRequired = FALSE;
+
+ l_eStatus = GetModuleIterator(f_moduleName.c_str(), l_ModuleListIter);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map", f_moduleName.c_str());
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (eFrameworkunifiedStatusDbRecNotFound);
+ }
+
+ // LCOV_EXCL_BR_START 6: Because the condition cannot be set
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = RemoveModuleEntryFromHB(f_hApp,
+ l_ModuleListIter->name.c_str()))) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: RemoveModuleEntryFromHB(%s) errored: %d/'%s'",
+ l_ModuleListIter->name.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+
+ if (TRUE == l_ModuleListIter->critical
+ && (l_ModuleListIter->relaunch_count >= l_ModuleListIter->retry_cnt)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Critical module '%s' re-launch counter exceeded limit (%d).",
+ l_ModuleListIter->name.c_str(), l_ModuleListIter->retry_cnt);
+
+ l_ModuleListIter->SetModuleState(MODULE_STATE_SKIPPED);
+
+ // Module has crossed re-launched limit and is not going to be re-launched.
+ // It must however still be terminated.
+ l_PLCmd = ePLThrdCmd_TERMINATE_MODULE_REQST;
+ l_PLCmdStr = "ePLThrdCmd_TERMINATE_MODULE_REQST";
+
+ // Module is critical. Restart system.
+ f_refResetRequired = TRUE;
+ // Restart required?
+ } else if (0 == std::strcmp(l_ModuleListIter->restart.c_str(), RestartModule)) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Module: %s, relaunch_count: %d",
+ l_ModuleListIter->name.c_str(),
+ l_ModuleListIter->relaunch_count);
+
+ if (l_ModuleListIter->relaunch_count < l_ModuleListIter->retry_cnt) {
+ SS_String l_ModulePath = (m_BinaryFilesPath + l_ModuleListIter->path);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
+ " Requesting ReLaunch of '%s' '%s'",
+ l_ModuleListIter->name.c_str(), l_ModulePath.c_str());
+
+ l_PLCmd = ePLThrdCmd_RELAUNCH_MODULE_REQST;
+ l_PLCmdStr = "ePLThrdCmd_RELAUNCH_MODULE_REQST";
+ l_ModuleListIter->relaunch_count++;
+ l_ModuleListIter->relaunch_status = RelaunchErr;
+ } else if ((FALSE == l_ModuleListIter->critical)
+ && (l_ModuleListIter->relaunch_count
+ >= l_ModuleListIter->retry_cnt)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: Skipping re-launch of non-critical %s module, "
+ "re-launch counter exceeded limit(%d). Terminating module.",
+ l_ModuleListIter->name.c_str(),
+ l_ModuleListIter->retry_cnt);
+
+ l_ModuleListIter->SetModuleState(MODULE_STATE_SKIPPED);
+
+ // non critical module has crossed re-launched limit and is not going to be re-launched.
+ // We must terminate the module in the event that it has become non responsive.
+ l_PLCmd = ePLThrdCmd_TERMINATE_MODULE_REQST;
+ l_PLCmdStr = "ePLThrdCmd_TERMINATE_MODULE_REQST";
+ }
+ // LCOV_EXCL_STOP
+ } else { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set
+ // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: %s is not required to be re-launched, "
+ "skipping re-launch and terminating module.",
+ l_ModuleListIter->name.c_str());
+
+ l_ModuleListIter->SetModuleState(MODULE_STATE_SKIPPED);
+
+ // Module restart not required.
+ // We must terminate the module in the event that it has become non responsive.
+ l_PLCmd = ePLThrdCmd_TERMINATE_MODULE_REQST;
+ l_PLCmdStr = "ePLThrdCmd_TERMINATE_MODULE_REQST";
+ // LCOV_EXCL_STOP
+ }
+
+
+ if (ePLThrdCmd_NONE != l_PLCmd) {
+ l_eStatus = SendRequestToLauncher(f_hApp, l_ModuleListIter, l_PLCmd, l_PLCmdStr); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "SendRequestToLauncher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup ErrorEventCreateHmiDisplayString
+///
+/// \brief Create error event HMI colored square display string.
+///
+/// \return Error Display String.
+///////////////////////////////////////////////////////////////////////////////
+std::string CSystemManager::ErrorEventCreateHmiDisplayString(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::stringstream l_displayNamess; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::stringstream l_pidss; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::stringstream l_hmiDispStr; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (0 != strncmp("",
+ m_errorEventCurrentIter->m_loggingInfo.binaryFileName,
+ sizeof(m_errorEventCurrentIter->m_loggingInfo.binaryFileName))) {
+ l_displayNamess << m_errorEventCurrentIter->m_loggingInfo.binaryFileName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else {
+ l_displayNamess << m_errorEventCurrentIter->m_moduleQueueName;
+ }
+
+ if (m_errorEventCurrentIter->m_loggingInfo.pid != 0) {
+ l_pidss << " PID: " << m_errorEventCurrentIter->m_loggingInfo.pid;
+ }
+
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_hmiDispStr.str());
+} // LCOV_EXCL_BR_LINE 10:The final line
+
diff --git a/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event_responses.cpp b/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event_responses.cpp
new file mode 100755
index 0000000..28e8dbf
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event_responses.cpp
@@ -0,0 +1,1007 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup SS_SM_Logging
+/// \brief This file supports SM logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_plogger_if.h>
+#include <stub/ss_diag.h>
+#include <system_service/ss_ver.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_client_names.h>
+#include <system_service/ss_sm_client_if.h>
+
+#include <stdint.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/statvfs.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <errno.h>
+#include <sys/wait.h>
+#include <boost/algorithm/string.hpp>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <list>
+
+#include "ss_system_manager.h"
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainLoggerserviceLogRequest
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+static int getExecedString(char* const argv[], std::stringstream &ss) {
+ int ret;
+ int pipeFd[2]; // 0:read, 1:write
+ pid_t pid;
+ ret = pipe(pipeFd);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5:pipe's error case
+ // LCOV_EXCL_START 5:pipe's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ goto error_exit;
+ // LCOV_EXCL_STOP
+ }
+
+ pid = fork();
+ if (pid == -1) { // LCOV_EXCL_BR_LINE 5:fork's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else if (pid == 0) {
+ close(pipeFd[0]); // unnecessary pile (closing read)
+ close(1); // closing stdout
+ dup2(pipeFd[1], 1); // take stdout to pipe
+ execve(argv[0], argv, environ);
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ exit(EXIT_FAILURE);
+ } else {
+ char readBuf[256];
+ ssize_t rs;
+ SS_ASERT_ERRNO(0 == close(pipeFd[1])); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ fd_set rfds;
+ FD_ZERO(&rfds); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ FD_SET(pipeFd[0], &rfds); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ struct timeval timeout;
+ timeout.tv_sec = 2;
+ timeout.tv_usec = 0;
+
+ int selRet = select(pipeFd[0] + 1, &rfds, NULL, NULL, &timeout);
+ switch (selRet) {
+ case 1:
+ if (FD_ISSET(pipeFd[0], &rfds)) {
+ do {
+ rs = read(pipeFd[0], readBuf, sizeof(readBuf) - 1);
+ if (rs > 0) {
+ readBuf[rs] = '\0';
+ ss << readBuf;
+ } else if (rs == -1) { // LCOV_EXCL_BR_LINE 5:read's error case
+ // LCOV_EXCL_START 5:read's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ if (errno != EINTR) {
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ ret = -1;
+ break;
+ }
+ // LCOV_EXCL_STOP
+ }
+ } while (rs != 0);
+ } else {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ break;
+ case -1:
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ break;
+ default:
+ // LCOV_EXCL_START 5:never be this case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ if (0 == selRet) {
+ ss << "timeout" << std::endl;
+ } else {
+ ss << "ERR:rslt=" << selRet << std::endl;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ // SM leaves processing to OnProcessExitDetected when using child process
+ // SS_ASERT_ERRNO(-1 != waitpid(pid,&status,0));
+ }
+ SS_ASERT_ERRNO(0 == close(pipeFd[0])); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+error_exit:
+ return ret;
+}
+
+static int saveProcsMemInfo(std::ofstream &fo) {
+ DIR *dir = NULL;
+ int ret = 0;
+
+ try {
+ struct dirent dent, *next;
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ {
+ fo << "******** mem info **********" << std::endl;
+ std::ifstream fin("/proc/meminfo");
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ fo << line << endl;
+ }
+ }
+
+ {
+ fo << "******** slab info **********" << std::endl;
+ std::ifstream fin("/proc/slabinfo");
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ fo << line << endl;
+ }
+ }
+
+ {
+ fo << "******** zone info **********" << std::endl;
+ std::ifstream fin("/proc/zoneinfo");
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ fo << line << endl;
+ }
+ }
+ // LCOV_EXCL_BR_STOP
+
+ // Linux dependency codes
+ dir = opendir("/proc"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (dir == NULL) { // LCOV_EXCL_BR_LINE 5:opendir's error case
+ // LCOV_EXCL_START 11:opendir's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ throw eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ fo << "******** proc status **********" << std::endl;
+ while (0 == readdir_r(dir, &dent, &next) && next) {
+ if (DT_DIR == dent.d_type) {
+ struct stat statbuf;
+ std::string statPath("/proc/"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ statPath += dent.d_name;
+ statPath += "/status";
+
+ if (stat(statPath.c_str(), &statbuf) == 0) {
+ std::ifstream fin(statPath.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ if (strstr(line.c_str(), "Name") != NULL
+ || strstr(line.c_str(), "Pid") != NULL
+ || strstr(line.c_str(), "Vm") != NULL) {
+ fo << line << endl;
+ }
+ }
+ fo << "************************************" << std::endl;
+ }
+ }
+ }
+ SS_ASERT_ERRNO(0 == closedir(dir)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } catch (...) {
+ if (dir) { // LCOV_EXCL_BR_LINE 5:opendir's error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT_ERRNO(0 == closedir(dir)); // LCOV_EXCL_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ ret = -1;
+ }
+ return ret;
+}
+
+///////////////////////////////////////////////////////////////////////////
+// Function : OnObtainLoggerserviceLogRequest
+// brief : Collect frameworkunifiedlog artifact and return a response to
+// SS_Logger.
+///////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::SendLogArtifactResponseToLogger(HANDLE f_hApp,
+ EArtifactId f_artifactId, std::string f_artifactFilePathAndName) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ HANDLE l_hLoggerServiceSession;
+ ModuleLaunchListIter l_ModuleListIter;
+ ARTIFACT_RESPONSE l_artifactResponse;
+
+ l_artifactResponse.ArtifactId = f_artifactId;
+
+ strncpy(l_artifactResponse.FilePathAndName,
+ f_artifactFilePathAndName.c_str(),
+ sizeof(l_artifactResponse.FilePathAndName) - 1);
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = GetModuleIterator(SERVICE_LOGGER, l_ModuleListIter))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: GetModuleIterator(%s) errored: %d/'%s'",
+ SERVICE_LOGGER, l_eStatus, GetStr(l_eStatus).c_str());
+ } else {
+ l_hLoggerServiceSession = l_ModuleListIter->hsession;
+
+ l_eStatus = FrameworkunifiedSendMsg(l_hLoggerServiceSession,
+ SS_SM_ERROR_EVENT_ARTIFACT_RSPN, sizeof(l_artifactResponse),
+ &l_artifactResponse);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "FrameworkunifiedSendMsg(SS_SM_ERROR_EVENT_ARTIFACT_RSPN)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnErrorEventArtifactRequest
+/// Dispatch logging requests to the various handlers.
+///
+/// \param f_hApp Framework application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnErrorEventArtifactRequest(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ReadMsg < EArtifactId
+ > (hApp, m_requestedArtifactId))) { // LCOV_EXCL_BR_LINE 200:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ switch (m_requestedArtifactId) {
+ case eArtifactIdBootMicroLog:
+ l_eStatus = OnObtainBootMicroLog(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnObtainBootMicroLog()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ break;
+
+ case eArtifactIdSystemDataCsv:
+ l_eStatus = OnObtainSystemmanagerSystemDataCsv(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnObtainSystemmanagerSystemDataCsv()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ break;
+
+ case eArtifactIdShowMemTxt:
+ l_eStatus = OnObtainShowMemTxt(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnObtainShowMemTxt()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ break;
+
+ case eArtifactIdProcessCore:
+ SS_ASERT(0); // Never called in Linux PF // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ break;
+
+ case eArtifactIdDebugDumpLog:
+ l_eStatus = OnObtainDebugDumpLog(hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "OnObtainDebugDumpLog()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ break;
+
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Unsupported logging artifact requested: %d.",
+ m_requestedArtifactId);
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnObtainBootMicroLog
+/// Obtain the boot micro log content, write file to disk, and send filename to SL.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnObtainBootMicroLog(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(f_hApp));
+
+ l_eStatus = RequestBootMicroLog(f_hApp);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "RequestBootMicroLog"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnBootMicroLogResponse
+/// Boot micro log response sent from the logging shadow.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnBootMicroLogResponse(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_len;
+ std::string l_artifactFilePathAndName;
+
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_BOOT_MICRO_LOG_RSPN].Stop(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(f_hApp));
+
+ if (0 == strcmp(TIMER_SERVICE_NAME, FrameworkunifiedGetMsgSrc(f_hApp))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Timer expired while waiting for the boot micro log.");
+ } else if (0 == (l_len = FrameworkunifiedGetMsgLength(f_hApp))) { // LCOV_EXCL_BR_LINE 200:restricted by ss_sm_client
+ // LCOV_EXCL_START 200:restricted by ss_sm_client
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Invalid log response received. Length cannot be 0.");
+ // LCOV_EXCL_STOP
+ } else {
+ char l_buf[l_len]; // NOLINT
+ l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, l_buf, static_cast<UI_32>(sizeof(l_buf)), eSMRRelease); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_artifactFilePathAndName = "/tmp/bootmicro.log";
+ l_len = static_cast<UI_32>(strlen((const char *) l_buf));
+ std::ofstream l_stream(l_artifactFilePathAndName.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.write(l_buf, l_len); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.close(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, m_requestedArtifactId,
+ l_artifactFilePathAndName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d', '%s') "
+ "errored: %d/'%s'", m_requestedArtifactId,
+ l_artifactFilePathAndName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnErrorEventBootMicroLogResponseTimeout
+/// Called when the boot micro log request timer expires (e.g. no response).
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnErrorEventBootMicroLogResponseTimeout(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_artifactFilePathAndName = "";
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Boot micro log response timed out. Sending empty artifact response to SSL.");
+
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, m_requestedArtifactId,
+ l_artifactFilePathAndName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d', '%s') "
+ "errored: %d/'%s'", m_requestedArtifactId,
+ l_artifactFilePathAndName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnObtainSystemmanagerSystemDataCsv
+/// Obtain system content, write file to disk, and send filename to SL.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnObtainSystemmanagerSystemDataCsv(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ // std::string l_artifactFilePathAndName = "/tmp/frameworkunified_systemdata.csv";
+ // std::ofstream l_stream(l_artifactFilePathAndName.c_str());
+ std::stringstream l_stream;
+ char *l_pSignalName;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // Output version info
+ {
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ CSSVer ver;
+ l_stream << "********** PACKAGE VERSIONS **********\n";
+ l_stream << left;
+ l_stream << setw(16) << "PACKAGE" << setw(24) << "VERSION" << setw(10)
+ << "DATE" << endl;
+ for (SSVerPkgListIter ite = ver.begin(); ite != ver.end(); ite++) {
+ l_stream << setw(16) << ite->first;
+ l_stream << setw(24) << ite->second.version;
+ l_stream << setw(10) << ite->second.date << std::endl;
+ }
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "********** Error Description Start ***********" << endl;
+ l_stream << "Error Event Type,"
+ << GetStr(m_errorEventCurrentIter->m_eventType) << endl;
+ l_stream << m_errorEventCurrentIter->m_eventEnqueueTimeStamp.c_str() << endl;
+ l_stream << "MessageStr,"
+ << m_errorEventCurrentIter->m_loggingInfo.messageStr.c_str() << endl;
+ // LCOV_EXCL_BR_STOP
+
+ {
+ UI_32 l_ErrLogCount = 0;
+ if (PowerHalGetResetInfo(AGL_ERRLOG_COUNTER, &l_ErrLogCount)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__,
+ "Could not get AGL_ERRLOG_COUNTER from power_hal.");
+ }
+
+ {
+ l_stream << "ErrLogCount," << l_ErrLogCount << "/"
+ << SS_SM_ERR_LOGGING_LIMIT << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+
+ switch (m_errorEventCurrentIter->m_eventType) {
+ case eErrorEventTypeProcessCrash:
+ l_stream << "Crash Failure Binary Name,"
+ << m_errorEventCurrentIter->m_loggingInfo.binaryFileName << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "Module PID," << m_errorEventCurrentIter->m_loggingInfo.pid << endl;
+ l_stream << "Exit Value,"
+ << m_errorEventCurrentIter->m_loggingInfo.exitValue << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_pSignalName = strsignal(
+ m_errorEventCurrentIter->m_loggingInfo.signalNumber);
+ if (NULL != l_pSignalName) {
+ l_stream << "Exit Signal,"
+ << m_errorEventCurrentIter->m_loggingInfo.signalNumber // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << "," << l_pSignalName << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ break;
+
+ case eErrorEventTypeProcessExit:
+ l_stream << "Exit Binary Name,"
+ << m_errorEventCurrentIter->m_loggingInfo.binaryFileName << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "Module PID," << m_errorEventCurrentIter->m_loggingInfo.pid << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "Exit Value,"
+ << m_errorEventCurrentIter->m_loggingInfo.exitValue << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ break;
+
+ case eErrorEventTypeHeartBeatFailure:
+ l_stream << "HB Failure Module Queue Name,"
+ << m_errorEventCurrentIter->m_moduleQueueName.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "***************** HB Information Start *******************" << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "Entire State," << m_HBReport.eEntireState << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << "Module Name,HB State,Retry Count" << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ for (UI_32 i = 0; i < m_HBReport.nNumOfModules; i++) {
+ if (0 != m_HBReport.tModuleList[i].HeartBeatRetryCount) {
+ l_stream << m_HBReport.tModuleList[i].ProcQueueName << "," // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << m_HBReport.tModuleList[i].ProcHBState << "," // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << m_HBReport.tModuleList[i].HeartBeatRetryCount // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+ l_stream << "***************** HB Information End *******************" << endl;
+ break;
+
+ case eErrorEventTypeSystemLowMemory:
+ l_stream << "Free Memory Available (Byte)," << m_FreeMemAvailable << endl;
+ break;
+
+ case eErrorEventTypeBootMicroReset:
+ l_stream << "Boot Micro Reset Reason," << m_BootMicroResetReason << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ break;
+
+ case eErrorEventTypeModConnFailed:
+ l_stream << "Failed Module Queue Name,"
+ << m_errorEventCurrentIter->m_moduleQueueName.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ break;
+
+ case eErrorEventTypeStartRespFailed:
+ l_stream << "Failed Module Queue Name,"
+ << m_errorEventCurrentIter->m_moduleQueueName.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ break;
+
+ // No additional event specific log information to add.
+ case eErrorEventTypeUserInvokedCollectAllLogs:
+ case eErrorEventTypeUserInvokedCollectScreenShot:
+ case eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs:
+ case eErrorEventTypeUserInvokedUserForceReset:
+ case eErrorEventTypeUserInvokedCollectDevLogs:
+ default:
+ break;
+ }
+
+ {
+ std::ifstream finNum("/proc/sys/vm/nr_oom_kill_process");
+ std::string strNum;
+ if (finNum && std::getline(finNum, strNum)) { // LCOV_EXCL_BR_LINE 200:will not be this case
+ // LCOV_EXCL_START 200:will not be this case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ char *endptr = NULL;
+ long lNum = strtol(strNum.c_str(), &endptr, 10); // NOLINT
+ if (('\0' != *endptr) || (lNum < 0)) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_stream << "nr_oom_kill_process," << strNum.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (0 != lNum) {
+ std::ifstream finLast("/proc/sys/vm/last_oom_kill_victim"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::string strLast;
+ if (finLast && std::getline(finLast, strLast)) {
+ l_stream << "last_oom_kill_victim," << strLast.c_str() << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ l_stream << "********** Error Description End ***********" << endl << endl;
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+
+ fprintf(stderr, "SS_SysManager/\n%s", l_stream.str().c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_stream << "********** Variant Code Start ***********" << endl;
+ if (NULL != m_pVarCodeStr) {
+ l_stream << m_pVarCodeStr << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ } else {
+ l_stream << "Variant coding not available." << endl;
+ }
+ l_stream << "********** Variant Code End ***********" << endl << endl;
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_stream << "********** File System Information Start ***********" << endl;
+ l_stream << "== mounts info start==" << endl;
+ {
+ std::ifstream fin("/proc/mounts"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ l_stream << line << endl;
+ }
+ }
+ l_stream << "== mounts info end ==" << endl;
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_stream << "== DF info start==" << endl;
+ {
+ char* const argv[] = { const_cast<char*>("/bin/df"), const_cast<char*>("-a"), static_cast<char*>(NULL), };
+ SS_ASERT(0 == getExecedString(argv, l_stream)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ l_stream << "== DF info end==" << endl;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+#if 0 // Need to install lsblk if requested so that it is not installed
+ l_stream << "== lsblk info start==" << endl;
+ {
+ char* const argv[] = {
+ const_cast<char*>("/usr/debug/bin/lsblk"),
+ const_cast<char*>("-o"),
+ const_cast<char*>("NAME,KNAME,MAJ:MIN,FSTYPE,PARTLABEL,MODEL,SERIAL,REV,VENDOR"),
+ const_cast<char*>(NULL),
+ };
+ SS_ASERT(0 == getExecedString(argv, l_stream));
+ }
+ l_stream << "== lsblk info end==" << endl;
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", l_stream.str().c_str());
+ l_stream.str("");
+ l_stream.clear();
+#endif
+
+ l_stream << "== proc info start==" << endl;
+ {
+ char* const argv[] = { const_cast<char*>("/bin/ps"), const_cast<char*>("auxc"),
+ const_cast<char*>("-L"), static_cast<char*>(NULL), };
+ SS_ASERT(0 == getExecedString(argv, l_stream)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ l_stream << "== proc info end==" << endl;
+ {
+ // Output is splitted so that the FRAMEWORKUNIFIEDLOG can not write data over 4K Bytes at a time
+ std::list<std::string> strList;
+ boost::split(strList, static_cast<const std::string>(l_stream.str()),
+ boost::is_any_of("\n")); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ int ii = 0;
+ std::stringstream ss; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ for (std::list<std::string>::iterator ite = strList.begin();
+ ite != strList.end(); ite++) {
+ ss << *ite << endl;
+ ii++;
+ if (ii > 20) {
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", ss.str().c_str());
+ ss.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ss.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ii = 0;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "\n%s", ss.str().c_str());
+ }
+ l_stream.str(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.clear(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, m_requestedArtifactId, ""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d') "
+ "errored: %d/'%s'", m_requestedArtifactId, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnObtainShowMemTxt
+/// Obtain showmem content, write file to disk, and send filename to SL.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnObtainShowMemTxt(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ std::string l_artifactFilePathAndName = "/tmp/showmem.txt";
+ {
+ std::ofstream fo(l_artifactFilePathAndName.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ saveProcsMemInfo(fo); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, m_requestedArtifactId,
+ l_artifactFilePathAndName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d', '%s') "
+ "errored: %d/'%s'", m_requestedArtifactId,
+ l_artifactFilePathAndName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnErrorEventCoreFilePollTimeout
+/// Called periodically to verify whether the process core file has completed
+/// being written to disk. When complete, this function sends an artifact
+/// response to SSL.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnErrorEventCoreFilePollTimeout(HANDLE f_hApp) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_sendResponse = FALSE;
+ std::string l_artifactFilePathAndName = "";
+ std::ostringstream l_coreFilePathAndName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+// struct stat l_fileInfo;
+ struct stat64 l_fileInfo;
+ int l_result;
+ off_t l_coreFileSize;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ l_coreFilePathAndName << "/debug/"
+ << m_errorEventCurrentIter->m_loggingInfo.binaryFileName << ".core.gz"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+
+// l_result = stat(l_coreFilePathAndName.str().c_str(), &l_fileInfo);
+ l_result = stat64(l_coreFilePathAndName.str().c_str(), &l_fileInfo);
+ if (l_result == 0) {
+ l_coreFileSize = l_fileInfo.st_size;
+ if ((l_coreFileSize > m_coreFileSizeBytes) || // Core file grew from last read.
+ (l_coreFileSize == 0)) { // Core file not yet updated externally.
+ m_coreFileSizeBytes = l_coreFileSize; // Wait until file stops growing.
+ bool result =
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_CORE_FILE_POLL].Start( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ 0, SS_ERROR_EVENT_CORE_FILE_POLL_TO_MS, 0, 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (FALSE == result) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Failed to start timer SS_ERROR_EVENT_CORE_FILE_POLL_TO_MS.");
+ l_sendResponse = TRUE;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Core file: %s, size: %ld still growing.",
+ l_coreFilePathAndName.str().c_str(),
+ m_coreFileSizeBytes);
+
+ l_sendResponse = FALSE;
+ }
+ } else { // File has stopped growing.
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. Core file: %s, size: %ld write complete. Sending artifact response.",
+ l_coreFilePathAndName.str().c_str(), m_coreFileSizeBytes);
+
+ l_artifactFilePathAndName = l_coreFilePathAndName.str();
+ l_sendResponse = TRUE;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Info. Core file: %s, unable to determine size. Sending empty artifact response to SSL.",
+ l_coreFilePathAndName.str().c_str());
+
+ l_sendResponse = TRUE;
+ }
+
+ if (TRUE == l_sendResponse) {
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, // Error getting file size. Send empty path to SSL.
+ m_requestedArtifactId, l_artifactFilePathAndName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d', '%s') "
+ "errored: %d/'%s'", m_requestedArtifactId,
+ l_artifactFilePathAndName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnObtainDebugDumpLog
+/// Obtain debug dump content, write file to disk, and send filename to SL.
+/// See OnModuleDebugDumpResponse().
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnObtainDebugDumpLog(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ ModuleLaunchListIter l_moduleIter;
+
+ m_NbrDebugDumpRspnRecv = 0;
+
+ for (GroupLaunchMapIter l_GroupIter = m_MapProclaunchGrps.begin();
+ l_GroupIter != m_MapProclaunchGrps.end(); l_GroupIter++) {
+ for (l_moduleIter = l_GroupIter->second.modules.begin();
+ l_moduleIter != l_GroupIter->second.modules.end();
+ l_moduleIter++) {
+ const BOOL isModuleConnected = l_moduleIter->IsModuleConnected(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated)
+ if ((SERVICE_NS_NPP != l_moduleIter->name) && // NPP is a special case and does NOT session connect with SM.
+ (TRUE == isModuleConnected)) {
+ l_eStatus = FrameworkunifiedSendMsg(l_moduleIter->hsession, SS_SM_DEBUG_DUMP,
+ 0, NULL);
+
+ if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 200:NSFW error case
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Info. FrameworkunifiedSendMsg(SS_SM_DEBUG_DUMP) to %s succeeded.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_moduleIter->name.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ } else {
+ // LCOV_EXCL_START 200:NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: FrameworkunifiedSendMsg(%p, SS_SM_DEBUG_DUMP) to %s errored: %d/'%s'",
+ (void *) l_moduleIter->hsession,
+ l_moduleIter->name.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+
+ // Call debug dump handler for SM.
+ l_eStatus = OnSystemManagerDebugDump(f_hApp);
+ LOG_STATUS(l_eStatus, "OnSystemManagerDebugDump()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // Refresh debug dump timeout timer after each debug dump response received.
+ // Non AGL framework modules will have the remaining time after the last
+ // received response to complete their debug dump.
+ bool result =
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN].Start(
+ SS_ERROR_EVENT_DEBUG_DUMP_RSPN_TO_SEC, 0, 0, 0);
+ if (FALSE == result) { // LCOV_EXCL_BR_LINE 200:will not be this case
+ // LCOV_EXCL_START 200:will not be this case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Failed to start timer eSM_TIMER_DEBUG_DUMP_RSPN_MONITOR.");
+ // LCOV_EXCL_STOP
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnDebugDumpResponseReceived
+/// Debug Dump complete Response handler.
+/// See OnDebugDumpCompleteTimeout().
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnDebugDumpResponseReceived(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ ModuleLaunchListIter l_ModuleListIter;
+ UI_32 l_len;
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", l_moduleName.c_str());
+
+ SetCmdHist("SS_SM_DEBUG_DUMP_RSPN", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(f_hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ // SM is not launched by SM and is therefore not in the process list.
+ // SM does however use the same debug dump mechanism as other processes.
+ if (l_moduleName != SERVICE_SYSMANAGER) {
+ l_eStatus = GetModuleIterator(l_moduleName.c_str(), l_ModuleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map", l_moduleName.c_str());
+ } else {
+ l_ModuleListIter->SetModuleDebugDumpState(MODULE_DEBUG_DUMP_STATE_RESPONSE_RECEIVED);
+ }
+ }
+
+ if (0 == (l_len = FrameworkunifiedGetMsgLength(f_hApp))) { // LCOV_EXCL_BR_LINE 200:restricted by ss_sm_client
+ // LCOV_EXCL_START 200:restricted by ss_sm_client
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ l_eStatus = eFrameworkunifiedStatusInvldBufSize;
+ LOG_ERROR("0 == FrameworkunifiedGetMsgLength(f_hApp)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " Received debug dump response from %s, size: %d bytes. "
+ "Total number of responses received: %d",
+ l_moduleName.c_str(), l_len, m_NbrDebugDumpRspnRecv);
+
+ UI_8 l_buf[l_len]; // NOLINT
+ l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, l_buf, static_cast<UI_32>(sizeof(l_buf)),
+ eSMRRelease);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ ios_base::openmode l_mode;
+ if (0 == m_NbrDebugDumpRspnRecv) {
+ // Create new file.
+ l_mode = std::ios_base::trunc;
+ } else {
+ // Append existing file.
+ l_mode = std::ios_base::app;
+ }
+
+ std::ofstream l_stream("/tmp/systemmanager_debugdump.log", l_mode); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream << l_buf << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_stream.close(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ m_NbrDebugDumpRspnRecv++;
+
+ // Refresh debug dump timeout timer after each debug dump response received.
+ // Non AGL framework modules will have the remaining time after the last
+ // received response to complete their debug dump.
+ bool result =
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN].Start( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SS_ERROR_EVENT_DEBUG_DUMP_RSPN_TO_SEC, 0, 0, 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (FALSE == result) { // LCOV_EXCL_BR_LINE 200:will not be this case
+ // LCOV_EXCL_START 200:will not be this case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Failed to start timer eSM_TIMER_DEBUG_DUMP_RSPN_MONITOR.");
+ l_eStatus = OnDebugDumpCompleteTimeout(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "OnDebugDumpCompleteTimeout()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnDebugDumpCompleteTimeout
+/// Called after the last debug dump message is received, or when the debug
+/// dump monitor timer expires.
+///
+/// \param [in] f_hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnDebugDumpCompleteTimeout(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ std::string l_artifactFilePathAndName = "/tmp/systemmanager_debugdump.log";
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN].Stop(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Received '%d' Debug Dump responses.",
+ m_NbrDebugDumpRspnRecv);
+
+ l_eStatus = SendLogArtifactResponseToLogger(f_hApp, m_requestedArtifactId,
+ l_artifactFilePathAndName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: SendLogArtifactResponseToLogger(Artifact '%d', '%s') "
+ "errored: %d/'%s'", m_requestedArtifactId,
+ l_artifactFilePathAndName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
diff --git a/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event_triggers.cpp b/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event_triggers.cpp
new file mode 100755
index 0000000..385a628
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/ss_system_manager_error_event_triggers.cpp
@@ -0,0 +1,1093 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for IAT error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <system_service/ss_system_manager_notifications.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_client_names.h>
+#include <system_service/ss_power_service_if.h>
+#include <processlauncher/ProcessLauncher_if.h>
+#include <processlauncher/ss_sm_process_launcher_protocol.h>
+#include <processlauncher/ss_sm_process_launcher.h>
+#include <heartbeat/ss_hb_if.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <string.h>
+#include <system_service/ss_power_service_notifications.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <stub/ss_diag.h>
+#include <system_service/ss_test_clients.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <native_service/frameworkunified_application.h>
+#include <system_service/ss_sm_thread_names.h>
+#include <system_service/ss_templates.h>
+#include <native_service/ns_plogger_if.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <native_service/ns_np_service_nor_persistence.h>
+#include <native_service/cl_process.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <sys/mman.h>
+#include <sys/procfs.h>
+#include <libgen.h>
+#include <spawn.h>
+#include <errno.h>
+#include <sys/timeb.h>
+#include <string>
+#include "ss_system_manager.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_sm_signals.h"
+#include "ss_sm_default_paths.h"
+#include "ss_sm_version.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnHeartBeatErrorDetected
+/// This function gets called when a heartbeat failure is detected.
+///
+/// \param [in] f_hApp
+/// HANDLE - Handle of the Client Application
+///
+/// \return Status
+/// EFrameworkunifiedStatus - success or error
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnHeartBeatErrorDetected(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ BOOL l_resetRequired;
+ EErrorEventResetType l_resetType;
+ SMLoggingInfo l_loggingInfo;
+ std::string l_moduleBinaryName;
+ UI_32 l_ix;
+ THbReportData l_HBReport;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < THbReportData > (f_hApp, l_HBReport))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Report contains : %d entries.", l_HBReport.nNumOfModules);
+
+ for (l_ix = 0; l_ix < l_HBReport.nNumOfModules; l_ix++) {
+ if (HB_STATUS_TIMEOUT == l_HBReport.tModuleList[l_ix].ProcHBState) {
+ std::string l_moduleQueueName = l_HBReport.tModuleList[l_ix].ProcQueueName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ m_HBReport.eEntireState = l_HBReport.eEntireState;
+ m_HBReport.nNumOfModules = l_HBReport.nNumOfModules;
+ memcpy(&m_HBReport.tModuleList[l_ix], &l_HBReport.tModuleList[l_ix], sizeof(TSmModuleInfo));
+
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: Heartbeat error detected from: %s.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_moduleQueueName.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. Unable to identify binary name for SM child process with queue name: %s."
+ " The process name will be missing from the .csv and the core file will not be archived.",
+ l_moduleQueueName.c_str());
+ } else {
+ strncpy(l_loggingInfo.binaryFileName,
+ l_moduleBinaryName.c_str(),
+ sizeof(l_loggingInfo.binaryFileName) - 1);
+ }
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ActOnModuleFailure(f_hApp, l_moduleQueueName, l_resetRequired))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. ActOnModuleFailure(%s,%d) errored: %d/'%s'",
+ l_moduleQueueName.c_str(), l_resetRequired,
+ l_eStatus, GetStr(l_eStatus).c_str());
+ }
+
+ l_resetType =
+ (FALSE == l_resetRequired) ?
+ eErrorEventResetTypeNone :
+ eErrorEventResetTypeHard;
+
+ if (eErrorEventResetTypeNone != l_resetType) {
+ l_loggingInfo.resetReason =
+ e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+ }
+
+ l_eStatus = ErrorEventEnqueue(f_hApp,
+ eErrorEventTypeHeartBeatFailure, l_moduleQueueName,
+ l_resetType, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeHeartBeatFailure)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessTermDetected
+///
+///
+///
+/// \param Handle to AGL application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessTermDetected(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ int l_clRet;
+ int l_count = 0;
+
+ // When multiple child processes terminate, CL_ProcessCleanup() returns 1. If 1 is returned, it repeats.
+ do {
+ CL_ProcessCleanupInfo_t l_procInfo;
+
+ l_count++;
+
+ l_clRet = CL_ProcessCleanup(m_ClProcessSigFd, &l_procInfo);
+ if (l_clRet != 0 && l_clRet != 1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning: CL_ProcessCleanup(%d):%s", l_clRet,
+ strerror(errno));
+ l_eStatus = eFrameworkunifiedStatusFail;
+ break;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "PID:%d code:%d status:%d",
+ l_procInfo.pid, l_procInfo.code, l_procInfo.status);
+
+ // Terminate a process group to reclaim descendants of an anomaly terminated process
+ SS_ASERT_ERRNO(0 == CL_ProcessAbortGroup(l_procInfo.pid)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ BOOL bIsExited = (CLD_EXITED == l_procInfo.code) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SMProcessExitInfo l_procExitInfo;
+ memset(&l_procExitInfo, 0, sizeof(l_procExitInfo));
+ l_procExitInfo.pid = l_procInfo.pid;
+ // Process exit value when si_code == CLD_EXITED, else delivered signal number.
+ l_procExitInfo.exitValue = l_procInfo.status;
+ l_procExitInfo.signalNumber = SS_SM_ABORT_SIGNAL;
+
+ // If GroupRelaunch is required, kill the remaining services
+ SS_String l_moduleQueueName("");
+ if (eFrameworkunifiedStatusOK == FindNameOfTerminatedProcess(l_procExitInfo.pid, l_moduleQueueName)) {
+ for (GroupRelaunchModuleListIter l_itr =
+ m_GroupRelaunchModuleList.begin();
+ m_GroupRelaunchModuleList.end() != l_itr; l_itr++) {
+ if (l_itr->name == l_moduleQueueName) {
+ if (l_itr->bIsKilled) { // LCOV_EXCL_BR_LINE 200: relaunch module bIsKilled is always false
+ // LCOV_EXCL_START 200: relaunch module bIsKilled is always false
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // Normal during forced Relaunch
+ l_procExitInfo.exitValue = SS_SM_EXIT_RELAUNCH;
+ bIsExited = TRUE;
+ l_itr->bIsKilled = FALSE;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "GroupRelaunch(%d/%d)",
+ m_GroupRelaunchCount, m_GroupRelaunchLimit);
+
+ if (m_GroupRelaunchCount < m_GroupRelaunchLimit) {
+ SS_ASERT( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ FrameworkunifiedNPPublishNotification(f_hApp, // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ NTFY_SSNeedAplRestart, NULL, 0)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ // Issue ErrorEvent
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SS_String l_moduleBinaryName(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_loggingInfo.pid = l_procExitInfo.pid;
+ l_loggingInfo.exitValue = l_procExitInfo.exitValue;
+ l_loggingInfo.signalNumber = SS_SM_ABORT_SIGNAL;
+ if (eFrameworkunifiedStatusOK != GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName)) { // LCOV_EXCL_BR_LINE 200: cannot be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 200: cannot be error
+ } else {
+ snprintf(l_loggingInfo.binaryFileName,
+ sizeof(l_loggingInfo.binaryFileName),
+ "%s", l_moduleBinaryName.c_str());
+ }
+
+ l_eStatus = ErrorEventEnqueue(f_hApp,
+ eErrorEventTypeGroupRelaunch, l_itr->name,
+ eErrorEventResetTypeNone, l_loggingInfo);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ // Relaunch normally and do not leave anomaly LOGs
+ l_procExitInfo.exitValue = SS_SM_EXIT_RELAUNCH;
+ bIsExited = TRUE;
+
+ for (GroupRelaunchModuleListIter l_itr =
+ m_GroupRelaunchModuleList.begin();
+ m_GroupRelaunchModuleList.end() != l_itr;
+ l_itr++) {
+ if (l_itr->name != l_moduleQueueName) { // LCOV_EXCL_BR_LINE 200: name always be equal because of outer if judge // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 200: name always be equal
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ModuleLaunchListIter l_ModuleListIter;
+ if (eFrameworkunifiedStatusOK
+ != GetModuleIterator(
+ l_itr->name.c_str(),
+ l_ModuleListIter)) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ killpg(l_ModuleListIter->pid,
+ SS_SM_TERMINATE_SIGNAL);
+ l_itr->bIsKilled = TRUE;
+ }
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ m_GroupRelaunchCount++;
+ } else {
+ // Reboot system
+ ModuleLaunchListIter l_ModuleListIter;
+ if (eFrameworkunifiedStatusOK == GetModuleIterator(l_moduleQueueName.c_str(), l_ModuleListIter)) { // LCOV_EXCL_BR_LINE 200:cannot be error // NOLINT(whitespace/line_length)
+ l_ModuleListIter->relaunch_count = l_ModuleListIter->retry_cnt;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 200: cannot be error
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ if (isPreLaunchedProcess(l_procExitInfo.pid)) { // LCOV_EXCL_BR_LINE 200:prelaunch mode is not valid at UT test //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 200 :prelaunch mode is not valid at UT test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = OnPreLaunchedProcessTermDetected(f_hApp, l_procExitInfo, bIsExited); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("OnPreLaunchedProcessTermDetected()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // If an error occurs here, the zombie process may be collected and continued.
+ }
+ // LCOV_EXCL_STOP
+ } else if (bIsExited) {
+ l_eStatus = OnProcessExitDetected(f_hApp, l_procExitInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("OnProcessExitDetected()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // If an error occurs here, the zombie process may be collected and continued.
+ }
+ } else {
+ l_eStatus = OnProcessCrashDetected(f_hApp, l_procExitInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ LOG_ERROR("OnProcessCrashDetected()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ // If an error occurs here, the zombie process may be collected and continued.
+ }
+ }
+ } while (l_clRet == 1 && l_count < 50);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+BOOL CSystemManager::isPreLaunchedProcess(int f_pid) {
+ BOOL l_bIsExist = FALSE;
+
+ PreLaunchModuleListIter l_itr;
+ for (l_itr = m_PreLaunchModuleList.begin();
+ m_PreLaunchModuleList.end() != l_itr; l_itr++) {
+ if (l_itr->pid == f_pid) { // LCOV_EXCL_BR_LINE 200:prelaunch mode is not valid at UT test //NOLINT (whitespace/line_length)
+ // LCOV_EXCL_START 200 :prelaunch mode is not valid at UT test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_bIsExist = TRUE;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+ return l_bIsExist;
+}
+
+EFrameworkunifiedStatus CSystemManager::OnPreLaunchedProcessTermDetected(HANDLE f_hApp, SMProcessExitInfo &f_procExitInfo, BOOL f_bIsExited) { // LCOV_EXCL_START 200 :prelaunch mode is not valid at UT test // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ PreLaunchModuleListIter l_itr;
+ for (l_itr = m_PreLaunchModuleList.begin();
+ m_PreLaunchModuleList.end() != l_itr; l_itr++) {
+ if (l_itr->pid == static_cast<int>(f_procExitInfo.pid)) {
+ break;
+ }
+ }
+
+ try {
+ if (m_PreLaunchModuleList.end() == l_itr) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ throw eFrameworkunifiedStatusFail;
+ }
+
+ BOOL l_bIsNeedRelaunched = FALSE;
+
+ if ((SS_SM_RELAUNCH_NO_LIMIT == l_itr->relaunchLimit)
+ || (l_itr->relaunchLimit > l_itr->relaunchCount)) {
+ l_itr->relaunchCount++;
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Relaunch %s(%d/%d)",
+ l_itr->name.c_str(), l_itr->relaunchCount,
+ l_itr->relaunchLimit);
+ if (-1 == (l_itr->pid = l_itr->LaunchFunc())) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Relaunch %s Failed",
+ l_itr->name.c_str());
+ } else {
+ l_bIsNeedRelaunched = TRUE;
+ }
+ }
+
+ if (!l_bIsNeedRelaunched) {
+ if (l_itr->critical) {
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ EErrorEventType l_ErrorType;
+
+ l_itr->pid = -1;
+
+ l_loggingInfo.pid = f_procExitInfo.pid;
+ l_loggingInfo.exitValue = f_procExitInfo.exitValue;
+ l_loggingInfo.signalNumber = f_procExitInfo.signalNumber;
+ l_loggingInfo.resetReason =
+ e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+ snprintf(l_loggingInfo.binaryFileName,
+ sizeof(l_loggingInfo.binaryFileName), "%s",
+ l_itr->binaryFileName.c_str());
+
+ if (f_bIsExited) {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s exited",
+ l_itr->name.c_str());
+ l_ErrorType = eErrorEventTypeProcessExit;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s crashed",
+ l_itr->name.c_str());
+ l_ErrorType = eErrorEventTypeProcessCrash;
+ }
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, l_ErrorType, l_itr->name,
+ eErrorEventResetTypeHard, l_loggingInfo);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "ErrorEventEnqueue()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s removed",
+ l_itr->name.c_str());
+ l_itr->pid = -1;
+ }
+ }
+ } catch (EFrameworkunifiedStatus e) {
+ l_eStatus = e;
+ }
+
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessCrashDetected
+/// Initiate logging and recovery for an abnormal process termination.
+/// The terminated process may or may not be a child of system manager.
+/// If the process is a child of SM, then a validation check must ensue
+/// to ensure that the process crash is not the result of a failed heartbeat
+/// and subsequent termination signal sent from System Manager. This function
+/// is NOT called for processes that exit normally.
+///
+/// See OnProcessCrashDetected.
+///
+/// \param Handle to AGL application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessCrashDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ BOOL l_resetRequired = TRUE;
+ SS_String l_moduleQueueName("");
+ SS_String l_moduleBinaryName(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ EErrorEventResetType l_resetType;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ TEXT(__FUNCTION__, " PROCESS CRASH: Process PID: %d", f_procExitInfo.pid); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FindNameOfTerminatedProcess(f_procExitInfo.pid, l_moduleQueueName))) {
+ // Normally, logging COULD continue, but stopping logging also solves a PosixBasedOS001 errata
+ // where a process crashes and is removed from the SM process launch map and is ALSO
+ // detected by the exit detector as a 'normal' exit. The FindNameOfTerminatedProcess()
+ // will continue properly IF a crash and removal from the map has not occurred
+ // for the same process.
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. FindNameOfTerminatedProcess() returned error: %d/'%s' for PID: %d."
+ " No recovery possible. Logging has been suspended for this event.",
+ l_eStatus, GetStr(l_eStatus).c_str(), f_procExitInfo.pid);
+ } else {
+ l_eStatus = GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200: cannot be error
+ // LCOV_EXCL_START 200: cannot be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. Unable to identify binary for SM child process PID: %d, Queue Name: %s."
+ " The process binary name will be missing from the .csv file.",
+ f_procExitInfo.pid, l_moduleQueueName.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ strncpy(f_procExitInfo.binaryFileName, l_moduleBinaryName.c_str(),
+ sizeof(f_procExitInfo.binaryFileName) - 1);
+
+ f_procExitInfo.binaryFileName[sizeof(f_procExitInfo.binaryFileName) - 1] = '\0';
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ActOnModuleFailure(f_hApp, l_moduleQueueName,
+ l_resetRequired))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. ActOnModuleFailure(%s,%d) errored: %d/'%s'",
+ l_moduleQueueName.c_str(), l_resetRequired, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
+ "Info. ActOnModuleFailure() returned reset status: %d/'%s'.",
+ l_resetRequired, GetStr(l_resetRequired).c_str());
+ }
+
+ l_resetType =
+ (FALSE == l_resetRequired) ?
+ eErrorEventResetTypeNone : eErrorEventResetTypeHard;
+
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_loggingInfo.pid = f_procExitInfo.pid;
+ l_loggingInfo.exitValue = f_procExitInfo.exitValue;
+ l_loggingInfo.signalNumber = f_procExitInfo.signalNumber;
+ snprintf(l_loggingInfo.binaryFileName,
+ sizeof(l_loggingInfo.binaryFileName), "%s",
+ f_procExitInfo.binaryFileName);
+ if (eErrorEventResetTypeNone != l_resetType) {
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+ }
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeProcessCrash,
+ l_moduleQueueName, l_resetType, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeProcessCrash)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnProcessExitDetected
+/// Initiate logging and recovery for System Manager child processes that
+/// exit normally via the last brace of main(), exit(), or have their last
+/// thread exit. This function is NOT called for processes that terminate
+/// unexpectedly.
+///
+/// See OnProcessExitDetected.
+///
+/// \param Handle to AGL application.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnProcessExitDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+ SS_String l_moduleQueueName("");
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ TEXT(__FUNCTION__, "PROCESS EXIT: PID:%d exitValue:%d", f_procExitInfo.pid, // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ f_procExitInfo.exitValue); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = FindNameOfTerminatedProcess(f_procExitInfo.pid,
+ l_moduleQueueName))) {
+ // This happens when SMs to EXEC debugging commands, etc.
+ // Since this is not an error, set LOGs to WARN levels and set the return codes to OK.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s: pid:%d is unknown service",
+ GetStr(l_eStatus).c_str(), f_procExitInfo.pid);
+ l_eStatus = eFrameworkunifiedStatusOK;
+ } else {
+ if (0 == f_procExitInfo.exitValue) {
+ ModuleLaunchListIter l_moduleListIter;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = RemoveModuleEntryFromHB(f_hApp, l_moduleQueueName.c_str()))) { // LCOV_EXCL_BR_LINE 4: NSFW // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 4: NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: RemoveModuleEntryFromHB(%s) errored: %d/'%s'",
+ l_moduleQueueName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = GetModuleIterator(l_moduleQueueName.c_str(),
+ l_moduleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:cannot be error
+ // LCOV_EXCL_START 200:cannot be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map",
+ l_moduleQueueName.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = SendRequestToLauncher(f_hApp, l_moduleListIter, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ePLThrdCmd_TERMINATE_MODULE_REQST, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ "ePLThrdCmd_TERMINATE_MODULE_REQST"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "SendRequestToLauncher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ // Do not add relaunch_count for normal termination.
+ l_moduleListIter->relaunch_status = RelaunchSafe;
+ }
+ } else if (SS_SM_EXIT_RELAUNCH == f_procExitInfo.exitValue) {
+ ModuleLaunchListIter l_moduleListIter;
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = RemoveModuleEntryFromHB(f_hApp, l_moduleQueueName.c_str()))) { // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: RemoveModuleEntryFromHB(%s) errored: %d/'%s'",
+ l_moduleQueueName.c_str(), l_eStatus,
+ GetStr(l_eStatus).c_str());
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = GetModuleIterator(l_moduleQueueName.c_str(),
+ l_moduleListIter);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:cannot be error
+ // LCOV_EXCL_START 200:cannot be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error: Module %s not found in Group Launch Map",
+ l_moduleQueueName.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ l_eStatus = SendRequestToLauncher(f_hApp, l_moduleListIter, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ePLThrdCmd_RELAUNCH_MODULE_REQST, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ "ePLThrdCmd_RELAUNCH_MODULE_REQST"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "SendRequestToLauncher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ // Do not add relaunch_count for normal Relaunch
+ l_moduleListIter->relaunch_status = RelaunchSafe;
+ }
+ } else {
+ SS_String l_moduleBinaryName(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ BOOL l_resetRequired = TRUE;
+ EErrorEventResetType l_resetType;
+
+ l_eStatus = GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200: cannot be error
+ // LCOV_EXCL_START 200: cannot be error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. Unable to identify binary for SM child process PID: %d, Queue Name: %s."
+ " The process binary name will be missing from the .csv file.",
+ f_procExitInfo.pid, l_moduleQueueName.c_str());
+ // LCOV_EXCL_STOP
+ } else {
+ strncpy(f_procExitInfo.binaryFileName,
+ l_moduleBinaryName.c_str(),
+ sizeof(f_procExitInfo.binaryFileName) - 1);
+
+ f_procExitInfo.binaryFileName[sizeof(f_procExitInfo.binaryFileName)
+ - 1] = '\0';
+ }
+
+ if (eFrameworkunifiedStatusOK
+ != (l_eStatus = ActOnModuleFailure(f_hApp,
+ l_moduleQueueName, l_resetRequired))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. ActOnModuleFailure(%s,%d) errored: %d/'%s'",
+ l_moduleQueueName.c_str(), l_resetRequired, l_eStatus,
+ GetStr(l_eStatus).c_str());
+ }
+
+ l_resetType =
+ (FALSE == l_resetRequired) ?
+ eErrorEventResetTypeNone : eErrorEventResetTypeHard;
+
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_loggingInfo.pid = f_procExitInfo.pid;
+ l_loggingInfo.exitValue = f_procExitInfo.exitValue;
+ l_loggingInfo.signalNumber = f_procExitInfo.signalNumber;
+ snprintf(l_loggingInfo.binaryFileName,
+ sizeof(l_loggingInfo.binaryFileName), "%s",
+ f_procExitInfo.binaryFileName);
+ if (eErrorEventResetTypeNone != l_resetType) {
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+ }
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeProcessExit,
+ l_moduleQueueName, l_resetType, l_loggingInfo);
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeProcessExit)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnBootMicroResetNotification
+/// Called from the logging shadow when the boot micro notifies the shadow of
+/// an unexpected boot micro reset during the last power cycle.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnBootMicroResetNotification(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ std::string l_moduleName;
+ EFrameworkunifiedStatus l_eStatus;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < eSMBootMicroResetReason > (hApp, m_BootMicroResetReason))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ l_moduleName = FrameworkunifiedGetMsgSrc(hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: A boot micro reset has occurred. Reset reason: %d/'%s'.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ m_BootMicroResetReason, GetStr(m_BootMicroResetReason).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = ErrorEventEnqueue(hApp, eErrorEventTypeBootMicroReset, l_moduleName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeBootMicroReset)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup RequestBootMicroLog
+/// Request boot micro log from the logging shadow.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::RequestBootMicroLog(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = FrameworkunifiedPublishEvent(hApp, // Event received by PS Logging Shadow
+ SS_SM_BOOT_MICRO_LOG_REQ,
+ NULL,
+ NULL, 0);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "FrameworkunifiedPublishEvent(SS_SM_BOOT_MICRO_LOG_REQ)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ bool result =
+ m_errorEventTimers[eSM_ERROR_EVENT_TIMER_BOOT_MICRO_LOG_RSPN].Start(
+ SS_ERROR_EVENT_BOOT_MICRO_LOG_RESPONSE_TO_SEC, 0, 0, 0);
+ if (FALSE == result) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Failed to start timer eSM_TIMER_BOOT_MICRO_LOG_RESPONSE.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnLowSystemMemory
+/// Called when a low memory error has been detected.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnLowSystemMemory(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ SysMem l_SysMem;
+ std::string l_moduleName;
+ EFrameworkunifiedStatus l_eStatus;
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < SysMem > (hApp, l_SysMem))) {
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ } else {
+ m_FreeMemAvailable = l_SysMem.FreeMemoryBytes;
+
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: System Low Memory detected. Remaining memory: %d.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ m_FreeMemAvailable); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ l_moduleName = FrameworkunifiedGetMsgSrc(hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
+ l_eStatus = ErrorEventEnqueue(hApp, eErrorEventTypeSystemLowMemory,
+ l_moduleName, eErrorEventResetTypeHard, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeSystemLowMemory)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+} // End of EFrameworkunifiedStatus CSystemManager::OnLowSystemMemory( HANDLE hApp )
+
+EFrameworkunifiedStatus CSystemManager::OnPropagateSystemError(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnUserInvokedLoggingRequest
+/// Called when the end user invokes a error event logging request by means
+/// of hard key or other direct input method.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnUserInvokedLoggingRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TSystemManagerLoggingRequestInfo l_logInfo;
+ EErrorEventType l_errorEventType;
+ std::string l_moduleName;
+ EFrameworkunifiedStatus l_eStatus;
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < TSystemManagerLoggingRequestInfo > (f_hApp, l_logInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case
+ } else {
+ l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_loggingInfo.messageStr = l_logInfo.messageStr;
+ l_loggingInfo.suffixStr = l_logInfo.suffixStr;
+
+ switch (l_logInfo.logType) {
+ case e_SS_SM_CAPTURE_ALL_LOGS:
+ l_errorEventType = eErrorEventTypeUserInvokedCollectAllLogs;
+ break;
+
+ case e_SS_SM_SCREEN_CAPTURE:
+ l_errorEventType = eErrorEventTypeUserInvokedCollectScreenShot;
+ break;
+
+ case e_SS_SM_CAPTURE_INTERFACEUNIFIED_LOGS:
+ l_errorEventType = eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs;
+ break;
+
+ case e_SS_SM_CAPTURE_DEV_LOGS:
+ l_errorEventType = eErrorEventTypeUserInvokedCollectDevLogs;
+ break;
+
+ case e_SS_SM_CAPTURE_MODULE_LOGS:
+ l_errorEventType = eErrorEventTypeModuleInvokedCollectDebugLogs;
+ break;
+
+ case e_SS_SM_CAPTURE_DTC_LOGS:
+ l_errorEventType = eErrorEventTypeDtcEvent;
+ break;
+
+ case e_SS_SM_CAPTURE_NAVI_LOGS:
+ l_errorEventType = eErrorEventTypeUserInvokedCollectNaviLog;
+ break;
+
+ case e_SS_SM_CAPTURE_GROUP_RELAUNCH:
+ l_errorEventType = eErrorEventTypeGroupRelaunch;
+ break;
+
+ default:
+ l_errorEventType = eErrorEventTypeMaxValue;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ " Error. Received unknown user invoked log type: %d. Dropping request.",
+ l_logInfo.logType);
+ break;
+ }
+
+ if (eErrorEventTypeMaxValue != l_errorEventType) { // LCOV_EXCL_BR_LINE 200: will not be the else case
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: User invoked logging request %d/'%s' received. " // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "Adding the request to the event queue.", // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ l_logInfo.logType, GetStr(l_logInfo.logType).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, l_errorEventType,
+ l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(UserInvoked)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnEelExportRequest
+/// Called when a removable device is inserted and contains the EEL_Export
+/// trigger.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnEelExportRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_strlen = FrameworkunifiedGetMsgLength(f_hApp);
+ CHAR l_path[l_strlen]; // NOLINT
+
+ if (l_strlen == 0) { // LCOV_EXCL_BR_LINE 200: restricted by iterface_unified
+ // LCOV_EXCL_START 200: restricted by iterface_unified
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (sizeof(l_path) != FrameworkunifiedGetMsgLength(f_hApp)) { // LCOV_EXCL_BR_LINE 6: must be equal
+ // LCOV_EXCL_START 6: must be equal
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("DataSize mismatch"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE 4: NSFW error case
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_path[0],
+ static_cast<UI_32>(sizeof(l_path)), eSMRRelease))) {
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ TEXT(__FUNCTION__,
+ " ERROR EVENT: EelExport request received. Adding the request to the event queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_path[l_strlen - 1] = '\0';
+ l_loggingInfo.path = l_path;
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeEelExport,
+ l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeEelExport)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnSystemmanagerEmmcLogsRequest
+/// Called when a removable device is inserted and contains the LOGGERSERVICE_EMMC_LOGS
+/// trigger.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnSystemmanagerEmmcLogsRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_strlen = FrameworkunifiedGetMsgLength(f_hApp);
+ CHAR l_path[l_strlen]; // NOLINT
+
+ if (l_strlen == 0) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0);
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (sizeof(l_path) != FrameworkunifiedGetMsgLength(f_hApp)) { // LCOV_EXCL_BR_LINE 8: CHAR l_path[l_strlen]
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("DataSize mismatch"); // LCOV_EXCL_LINE 8: CHAR l_path[l_strlen]
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_path[0], static_cast<UI_32>(sizeof(l_path)), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW error case // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_LINE 4:NSFW error case
+ } else {
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: LOGGERSERVICE_EMMC_LOGS request received. Adding the request to the event queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ SMLoggingInfo l_loggingInfo;
+
+ l_path[l_strlen - 1u] = '\0';
+ l_loggingInfo.path = l_path;
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeInterfaceunifiedEmmcLogs,
+ l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeInterfaceunifiedEmmcLogs)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnSystemmanagerClearLogsRequest
+/// Called when a clear LOGGERSERVICE_EMMC_LOGS requested
+/// trigger.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnSystemmanagerClearLogsRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeUserInvokedClearLogs, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ l_moduleName, eErrorEventResetTypeNone); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeUserInvokedClearLogs)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnDiagLoggingRequest
+/// Called by logger to initiate log artifact collection and storage on behalf
+/// of diagnostic services.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnDiagLoggingRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_strlen = FrameworkunifiedGetMsgLength(f_hApp);
+ CHAR l_path[l_strlen]; // NOLINT
+
+ if (l_strlen == 0) { // LCOV_EXCL_BR_LINE 200: restricted by iterface_unified
+ // LCOV_EXCL_START 200: restricted by iterface_unified
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ return eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ }
+
+ if (sizeof(l_path) != FrameworkunifiedGetMsgLength(f_hApp)) { // LCOV_EXCL_BR_LINE 6: must be equal
+ // LCOV_EXCL_START 6: must be equal
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("DataSize mismatch"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE 4: NSFW error case
+ != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_path[0],
+ static_cast<UI_32>(sizeof(l_path)), eSMRRelease))) { // NOLINT
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_STOP
+ } else {
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: SS_SM_ERROR_EVENT_DIAG_LOG_REQ request received. Adding the request to the event queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
+ SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_path[l_strlen - 1u] = '\0';
+ l_loggingInfo.path = l_path;
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeDiagEvent,
+ l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeDiagEvent)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup OnCanLoggingRequest
+/// This function is called by logger to initiate log artifact collection
+/// and storage when signaled via CAN.
+///
+/// \param [in] hApp - Application handle.
+///
+/// \return EFrameworkunifiedStatus
+/// Success ==> eFrameworkunifiedStatusOK
+/// Failure ==> Other values
+///////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus CSystemManager::OnCANLoggingRequest(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+ std::string l_moduleName;
+
+ l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ " ERROR EVENT: SS_SM_ERROR_EVENT_CAN_LOG_REQ received from %s.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ l_moduleName.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeCanEvent, l_moduleName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+ "ErrorEventEnqueue(eErrorEventTypeCanEvent)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
diff --git a/video_in_hal/systemservice/system_manager/server/src/ss_system_memory_monitor.cpp b/video_in_hal/systemservice/system_manager/server/src/ss_system_memory_monitor.cpp
new file mode 100755
index 0000000..7ea9b71
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/ss_system_memory_monitor.cpp
@@ -0,0 +1,362 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager System Low Memory
+/// detection.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <system_service/ss_sm_thread_names_local.h>
+#include <system_service/ss_templates.h>
+#include <stub/Clock_API.h>
+
+#include <sys/stat.h>
+#include <errno.h>
+#include <sys/resource.h>
+#include <boost/bind.hpp>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+#include "ss_system_memory_monitor.h"
+#include "ss_sm_systemmanagerlog.h"
+
+CSysMemoryMonitor::CSysMemoryMonitor() :
+ m_hThread(NULL),
+ m_hParentApp(NULL),
+ m_SLMCheckCounter(0),
+ m_siPriority(-1),
+ m_NbrSamplesBeforeSystemmanagerlog(0),
+ m_memMonitorThreadName(SS_SMLowMemMonitor),
+ m_resmSession(-1) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ m_SLMConfig.SLMTimerValue = 0;
+ m_SLMConfig.SLMMaxRetryCount = 0;
+ m_SLMConfig.SLMThresholdValue = 0;
+ m_SLMConfig.SLMSystemmanagerLogIntervalMs = 0;
+ bzero(&m_sysMemInfoLast, sizeof(m_sysMemInfoLast));
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+CSysMemoryMonitor::~CSysMemoryMonitor(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ StopAndFreeObjects(m_hParentApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::Initialize(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (NULL == f_hApp) { // LCOV_EXCL_BR_LINE 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 4:NSFW
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Argument f_hApp passed NULL pointer.");
+ } else if (NULL == (m_hThread = FrameworkunifiedCreateChildThreadWithPriority(f_hApp, SS_SMLowMemMonitor, boost::bind(&CSysMemoryMonitor::CPUMemThreadStart, this, _1), boost::bind(&CSysMemoryMonitor::CPUMemThreadStop, this, _1), PR_SMLOWMEMMON))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusInvldHandle; // LCOV_EXCL_LINE 4:NSFW
+ LOG_ERROR("FrameworkunifiedCreateChildThreadWithPriority()"); // LCOV_EXCL_LINE 4:NSFW
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedStartChildThread(f_hApp, m_hThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOG_ERROR("FrameworkunifiedStartChildThread()"); // LCOV_EXCL_LINE 4:NSFW
+ } else {
+ m_hParentApp = f_hApp;
+ m_sysMemInfoLast.TotalMemoryBytes = GetSystemRamSize();
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Info. SLM thread successfully initialized.");
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::StopAndFreeObjects(HANDLE f_hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ CALL_AND_LOG_STATUS(FrameworkunifiedStopChildThread(f_hApp, m_hThread, 0, NULL)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ CALL_AND_LOG_STATUS(FrameworkunifiedDestroyChildThread(f_hApp, m_hThread)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+const std::string CSysMemoryMonitor::GetThreadName(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (m_memMonitorThreadName);
+}
+
+void CSysMemoryMonitor::SetSLMConfigData(SLMConfigParameters & f_ConfigData) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ m_SLMConfig.SLMTimerValue = f_ConfigData.SLMTimerValue;
+ m_SLMConfig.SLMMaxRetryCount = f_ConfigData.SLMMaxRetryCount;
+ m_SLMConfig.SLMThresholdValue = f_ConfigData.SLMThresholdValue;
+ m_SLMConfig.SLMSystemmanagerLogIntervalMs = f_ConfigData.SLMSystemmanagerLogIntervalMs;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Timer value '%d', Retry Count '%d', threshold '%d', log interval '%dms'",
+ m_SLMConfig.SLMTimerValue, m_SLMConfig.SLMMaxRetryCount,
+ m_SLMConfig.SLMThresholdValue, m_SLMConfig.SLMSystemmanagerLogIntervalMs);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::CPUMemThreadStart(HANDLE f_hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(f_hThread,
+ NTFY_ResourceMgr_Availability,
+ boost::bind(&CSysMemoryMonitor::OnAvailability, this, _1));
+ if (l_eStatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SS_ASERT(0); // LCOV_EXCL_LINE 4:NSFW
+ }
+
+ if (FALSE == (m_memMonitorTimer.Initialize(f_hThread, SS_SLM_MEM_MONITOR_TIMER_ID, boost::bind(&CSysMemoryMonitor::OnMemoryTimerExpiry, this, _1)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusBadConnection; // LCOV_EXCL_LINE 4:NSFW
+ LOG_ERROR("m_memMonitorTimer.Initialize() returned 'FALSE'"); // LCOV_EXCL_LINE 4:NSFW
+ } else if (FALSE == (m_systemmanagerlogTimer.Initialize(f_hThread, SS_SLM_SYSTEMMANAGERLOG_TIMER_ID, boost::bind(&CSysMemoryMonitor::OnSystemmanagerlogTimerExpiry, this, _1)))) { // LCOV_EXCL_BR_LINE 4:NSFW // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusBadConnection; // LCOV_EXCL_LINE 4:NSFW
+ LOG_ERROR("m_systemmanagerlogTimer.Initialize() returned 'FALSE'"); // LCOV_EXCL_LINE 4:NSFW
+ } else {
+ if (m_SLMConfig.SLMTimerValue > 0) {
+ m_memMonitorTimer.SetTime(m_SLMConfig.SLMTimerValue / 1000,
+ m_SLMConfig.SLMTimerValue % 1000,
+ m_SLMConfig.SLMTimerValue / 1000,
+ m_SLMConfig.SLMTimerValue % 1000);
+ } else {
+ // default timer settings
+ m_memMonitorTimer.SetTime(SS_MEMORY_TIMER_CONFIG_MS / 1000,
+ SS_MEMORY_TIMER_CONFIG_MS % 1000,
+ SS_MEMORY_TIMER_CONFIG_MS / 1000,
+ SS_MEMORY_TIMER_CONFIG_MS % 1000);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. SLM monitor timer configuration invalid. Using default values.");
+ }
+
+ if (m_SLMConfig.SLMSystemmanagerLogIntervalMs > 0) {
+ m_systemmanagerlogTimer.SetTime(m_SLMConfig.SLMSystemmanagerLogIntervalMs / 1000,
+ m_SLMConfig.SLMSystemmanagerLogIntervalMs % 1000,
+ m_SLMConfig.SLMSystemmanagerLogIntervalMs / 1000,
+ m_SLMConfig.SLMSystemmanagerLogIntervalMs % 1000);
+ } else {
+ // default timer settings
+ m_systemmanagerlogTimer.SetTime(SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS / 1000,
+ SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS % 1000,
+ SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS / 1000,
+ SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS % 1000);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ " Warning. SLM FRAMEWORKUNIFIEDLOG timer configuration invalid. Using default values.");
+ }
+
+ if (FALSE == (m_memMonitorTimer.Start())) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFault;
+ LOG_ERROR("m_memMonitorTimer.Start() returned 'FALSE'");
+ // LCOV_EXCL_STOP 4:NSFW
+ } else if (FALSE == (m_systemmanagerlogTimer.Start())) { // LCOV_EXCL_BR_LINE 4:NSFW
+ // LCOV_EXCL_START 4:NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_eStatus = eFrameworkunifiedStatusFault;
+ LOG_ERROR("m_systemmanagerlogTimer.Start() returned 'FALSE'");
+ // LCOV_EXCL_STOP 4:NSFW
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Success.");
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::CPUMemThreadStop(HANDLE f_hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus;
+
+ l_eStatus = StopTimers();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "StopTimers"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ if ((uint32_t) -1 != m_resmSession) {
+ if (RESM_E_OK != RESM_Close(m_resmSession)) {
+ l_eStatus = eFrameworkunifiedStatusFault;
+ LOG_ERROR("RESM_Close()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::StopTimers(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (FALSE == (m_memMonitorTimer.Stop())) { // LCOV_EXCL_BR_LINE 4:NSFW's error
+ l_eStatus = eFrameworkunifiedStatusFault;
+ LOG_ERROR("m_memMonitorTimer.Stop() returned 'FALSE'"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ if (FALSE == (m_systemmanagerlogTimer.Stop())) { // LCOV_EXCL_BR_LINE 4:NSFW's error
+ l_eStatus = eFrameworkunifiedStatusFault;
+ LOG_ERROR("m_systemmanagerlogTimer.Stop() returned 'FALSE'"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::OnMemoryTimerExpiry(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ RESM_STATUS_t l_resmStatus;
+
+ if ((uint32_t) -1 == m_resmSession) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ if (RESM_E_OK != RESM_GetStatus(m_resmSession, &l_resmStatus)) {
+ LOG_ERROR("RESM_GetStatus()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ l_eStatus = eFrameworkunifiedStatusFail;
+ } else {
+ m_sysMemInfoLast.FreeMemoryBytes = l_resmStatus.restMemSize;
+ if ((m_sysMemInfoLast.FreeMemoryBytes * 1024)
+ < (UI_32) m_SLMConfig.SLMThresholdValue) {
+ m_SLMCheckCounter++;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Low Memory detected(%d/%d).",
+ m_SLMCheckCounter, m_SLMConfig.SLMMaxRetryCount);
+
+ if (m_SLMCheckCounter >= m_SLMConfig.SLMMaxRetryCount) {
+ l_eStatus = FrameworkunifiedSendParent(hThread,
+ eSysMemThrdCmd_SYS_LOW_MEMORY, sizeof(m_sysMemInfoLast),
+ &m_sysMemInfoLast);
+ LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
+ "FrameworkunifiedSendParent(eSysMemThrdCmd_SYS_LOW_MEMORY)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+
+ l_eStatus = StopTimers();
+ LOG_STATUS_IF_ERRORED(l_eStatus, "StopTimers"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ } else {
+ m_SLMCheckCounter = 0;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::OnSystemmanagerlogTimerExpiry(HANDLE hThread) {
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+");
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ UI_32 l_freeMemoryObfuscated;
+ UI_32 l_totalMemoryObfuscated;
+
+ l_freeMemoryObfuscated = BitReverse32(m_sysMemInfoLast.FreeMemoryBytes);
+ l_totalMemoryObfuscated = BitReverse32(m_sysMemInfoLast.TotalMemoryBytes);
+
+ // Print to ZONE_WARN as per IAT requirement see WI 219056.
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FM: [%d/%d].", l_freeMemoryObfuscated,
+ l_totalMemoryObfuscated);
+
+ static int count = 0;
+
+ if (!(count %= 2)) {
+ CHAR l_format[256];
+ uint32_t timebuf;
+ uint8_t status;
+ struct tm gmt;
+ struct tm local;
+ Clock_getSystemTimeY2K38(&timebuf, &status);
+ Clock_CnvSecToDateY2K38(&timebuf, &gmt);
+ Clock_getLocalTimeY2K38(&timebuf, &local);
+
+ sprintf(l_format, " G%02d %02d%02d%02d L%02d %02d%02d%02d", gmt.tm_mday, // NOLINT
+ gmt.tm_hour, gmt.tm_min, gmt.tm_sec, local.tm_mday,
+ local.tm_hour, local.tm_min, local.tm_sec);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s", l_format);
+ }
+
+ count++;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "-");
+ return (l_eStatus);
+}
+
+EFrameworkunifiedStatus CSysMemoryMonitor::OnAvailability(HANDLE hThread) {
+ if (FrameworkunifiedIsServiceAvailable(hThread)) {
+ if (m_resmSession == (uint32_t) -1) {
+ if (RESM_E_OK != RESM_Open(NULL, &m_resmSession)) {
+ m_resmSession = -1;
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+UI_32 CSysMemoryMonitor::GetSystemRamSize(void) {
+ UI_32 l_ramTotalBytes = 0;
+ std::ifstream l_sFile("/proc/meminfo");
+
+ if (l_sFile.fail()) { // LCOV_EXCL_BR_LINE 5: Standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Open /proc/meminfo");
+ } else {
+ ssize_t l_position;
+ std::string l_str;
+
+ while (getline(l_sFile, l_str)) {
+
+// if (std::string::npos
+// != (l_position = static_cast<unsigned int>(l_str.find("MemTotal:", 0)))) {
+ if (0 <= (l_position = l_str.find("MemTotal:", 0))) { // LCOV_EXCL_BR_LINE 200:linux system information
+
+ l_str.erase(l_position, l_position + strlen("MemTotal:")); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ if (std::string::npos != (l_position = static_cast<unsigned int>(l_str.find("kB", 0)))) { // LCOV_EXCL_BR_LINE 200:linux system information
+ l_str.erase(l_position, l_position + strlen("kB")); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ std::istringstream l_istr(l_str); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ l_istr >> l_ramTotalBytes;
+
+ break;
+ }
+ }
+ }
+
+ return (l_ramTotalBytes);
+}
+
+UI_32 CSysMemoryMonitor::BitReverse32(UI_32 f_val) {
+ // Don't print FRAMEWORKUNIFIEDLOG(ZONE_FUNC) to prevent obfuscation method from being revealed.
+ f_val = (((f_val & 0xaaaaaaaa) >> 1) | ((f_val & 0x55555555) << 1));
+ f_val = (((f_val & 0xcccccccc) >> 2) | ((f_val & 0x33333333) << 2));
+ f_val = (((f_val & 0xf0f0f0f0) >> 4) | ((f_val & 0x0f0f0f0f) << 4));
+ f_val = (((f_val & 0xff00ff00) >> 8) | ((f_val & 0x00ff00ff) << 8));
+ f_val = (f_val >> 16) | (f_val << 16);
+ return (f_val);
+}
diff --git a/video_in_hal/systemservice/system_manager/server/src/systemmanager_application.cpp b/video_in_hal/systemservice/system_manager/server/src/systemmanager_application.cpp
new file mode 100755
index 0000000..506bb2c
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/systemmanager_application.cpp
@@ -0,0 +1,237 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file contains the standard set functions called by the NS
+// dispatcher on application initialization, cleanup and wakeup.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <system_service/ss_templates.h>
+
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_system_manager.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <errno.h>
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnInitialization
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ eStatus = CSystemManager::GetInstance().Initialize(hApp);
+ struct rlimit setrl = {RLIM_INFINITY, RLIM_INFINITY};
+ struct rlimit getrl = {};
+ int ret = prlimit(getpid(), RLIMIT_MSGQUEUE, &setrl, &getrl);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "prlimit ret%d", ret);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Previous limits: soft=%lld; hard=%lld", (long long) getrl.rlim_cur,
+ (long long) getrl.rlim_max);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnWakeup
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnWakeup(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+//////////////////////////////////////////
+// Function : FrameworkunifiedOnShutdown
+//////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnDestroy
+/// \todo Add behavior to this function
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) { // LCOV_EXCL_START 14:Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+// LCOV_EXCL_STOP
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// FrameworkunifiedOnEShutdown
+/// \todo Add behavior to this function
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE hApp) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp) { // LCOV_EXCL_START 7:Debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ CSystemManager* l_instance = &CSystemManager::GetInstance();
+ if (l_instance !=NULL) {
+ l_instance->SystemManagerDebugDump(hApp);
+ } else {
+ l_eStatus = eFrameworkunifiedStatusInvldHandle;
+ LOG_STATUS(l_eStatus, "Unable to acquire SM instance. Debug Dump handler not called."); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+*/
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+*/
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE h_app)
+ *
+ * @param h_app Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+ */
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
+ * @brief Used to .
+ *
+ * @param hApp Handle to the SS_Power Framework Obj.
+ *
+ * @return method status of completion or failure.
+*/
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "This method has not been implemented, return: eFrameworkunifiedStatusOK!");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SystemmanagerCloseApplication(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+
+ l_eStatus = CSystemManager::GetInstance().CloseApplication(hApp);
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// EOF
+
diff --git a/video_in_hal/systemservice/system_manager/server/src/systemmanager_main.cpp b/video_in_hal/systemservice/system_manager/server/src/systemmanager_main.cpp
new file mode 100755
index 0000000..d12aecc
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/src/systemmanager_main.cpp
@@ -0,0 +1,120 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief Application entry point.
+///
+///////////////////////////////////////////////////////////////////////////////
+#include <system_service/ss_system_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_version.h>
+#include <system_service/ss_system_types.h>
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <cstdlib>
+#include <fstream>
+
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_system_manager.h"
+
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+
+/// \brief: Name of the Queue that will be used to read data from.
+const CHAR AppName[] = SERVICE_SYSMANAGER;
+
+static EFrameworkunifiedStatus ArgumentParser(SI_32 cc, PCHAR str) {
+ switch (cc) {
+ case 'b':
+ CSystemManager::m_bootOpt += str;
+ break;
+ default:
+ break;
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+//////////////////////////////////////////
+// Function : main
+//////////////////////////////////////////
+int main(int argc, char *argv[]) {
+ EFrameworkunifiedStatus l_eStatus;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cbFuncs); // LCOV_EXCL_BR_LINE 15: marco defined in ss-system_if.h // NOLINT(whitespace/line_length)
+ int fd;
+/*
+ if (geteuid() == 0) { // LCOV_EXCL_BR_LINE 200: process cannot be executed by root
+ // LCOV_EXCL_START 200: process cannot be executed by root
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ printf("System cannot be started by root user!!\n"
+ "You can start system: \n"
+ " # sm > /dev/null &\n"
+ " or \n"
+ " # sm &\n");
+ // LCOV_EXCL_STOP
+ return -1;
+ }
+*/
+ fd = open("/dev/null", O_RDONLY); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (fd > 0) { // LCOV_EXCL_BR_LINE 5: open file error case.
+ int ret;
+ ret = dup2(fd, 0);
+ if (ret == -1) perror("dup2"); // LCOV_EXCL_BR_LINE 5: dup2 error case.
+ ret = close(fd); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ if (ret == -1) perror("close"); // LCOV_EXCL_BR_LINE 5: close error case.
+ } else {
+ // LCOV_EXCL_START 5: open file error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ perror("open"); // LCOV_EXCL_LINE 5: open file error case.
+ // LCOV_EXCL_STOP
+ }
+
+ // This allows overriding the already-passed-in System Manager's command
+ // line arguments by having a file exist named
+ // "/agl/rwdata/<this_file's_base_name>.args".
+ // For example, when this file is named 'SS_SystemManager', then
+ // if '/agl/rwdata/SS_SystemManager.args' is present, then the
+ // '/agl/rwdata/SS_SystemManager.args' strings are read as command line
+ // values and are passed to the FrameworkunifiedDispatcher() function.
+ // -m
+ // 0xFFFFFFFF,0xFFFFFFFF, where each bit represents a logging Zone.
+ // -c
+ // [configuration file..]
+
+ struct sched_param l_schedParam;
+
+ l_schedParam.sched_priority = PR_SS_SYSMANAGER;
+
+ if (0 != sched_setscheduler(getpid(), SCHED_FIFO, &l_schedParam)) { // LCOV_EXCL_BR_LINE 5: sched_setscheduler error case. // NOLINT(whitespace/line_length)
+ printf("ASSERT %d:%s\n", errno, strerror(errno)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ CustomCommandLineOptions l_tCmdLineOptions = { "b:", NULL, ArgumentParser }; // cShortOptions,rsv,callback
+ {
+ l_eStatus = FrameworkunifiedDispatcherWithArguments(AppName, argc, argv, &cbFuncs, &l_tCmdLineOptions); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+ printf("SM: Line %d: FrameworkunifiedDispatcherWithArguments() returned l_eStatus: '%d'/'%s'\n", // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ __LINE__, l_eStatus, GetStr(l_eStatus).c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+
+ return l_eStatus;
+} // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
diff --git a/video_in_hal/systemservice/system_manager/server/version.txt b/video_in_hal/systemservice/system_manager/server/version.txt
new file mode 100755
index 0000000..7fe8299
--- /dev/null
+++ b/video_in_hal/systemservice/system_manager/server/version.txt
@@ -0,0 +1,2 @@
+AGL Sample
+20191026_release
diff --git a/video_in_hal/systemservice/system_service.mk b/video_in_hal/systemservice/system_service.mk
new file mode 100755
index 0000000..5444eb4
--- /dev/null
+++ b/video_in_hal/systemservice/system_service.mk
@@ -0,0 +1,44 @@
+#############################################################
+#
+# Common Makefile for system_service
+# Copyright (C) 2017-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := system_service
+
+#############################################################
+
+
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk
diff --git a/video_in_hal/systemservice/task_manager/LICENSE b/video_in_hal/systemservice/task_manager/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/systemservice/task_manager/Makefile.client b/video_in_hal/systemservice/task_manager/Makefile.client
new file mode 100755
index 0000000..2c1628d
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/Makefile.client
@@ -0,0 +1,21 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := client
+
+include ../system_service.mk
+
+
diff --git a/video_in_hal/systemservice/task_manager/Makefile.server b/video_in_hal/systemservice/task_manager/Makefile.server
new file mode 100755
index 0000000..245dcc5
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/Makefile.server
@@ -0,0 +1,21 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := server
+
+include ../system_service.mk
+
+
diff --git a/video_in_hal/systemservice/task_manager/client/Makefile b/video_in_hal/systemservice/task_manager/client/Makefile
new file mode 100755
index 0000000..7d90745
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/Makefile
@@ -0,0 +1,26 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS = libtskmcfg ss_data_init libtskm libprimary
+
+VPATH = ../server/include/$(COMPONENT_NAME)
+
+######### install headers(*.h) #############
+INST_HEADERS = INI_API.h INI_API.hpp Primary_common.h tskm.h tskm_type.h tskm_local_type.h
+INST_HEADERS += sysup_from.h sysup.h tskm_svc.h
+INST_HEADERS += task_manager.h
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/task_manager/client/libprimary/Makefile b/video_in_hal/systemservice/task_manager/client/libprimary/Makefile
new file mode 100755
index 0000000..f58737c
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libprimary/Makefile
@@ -0,0 +1,37 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+VPATH = ./src ./../../server/src
+#######################################
+INST_SHLIBS = libprimary
+
+libprimary_SRCS = pri_main.c pri_api.c tskm_port_pf.c tskm_comm.c tskm_debug.c
+LDFLAGS += -Wl,--no-as-needed
+######### linked library (dynamic) #############
+LDLIBS += -lpthread
+LDLIBS += -lstdc++
+LDLIBS += -lrt
+LDLIBS += -lSS_SystemIfUnified
+LDLIBS += -lNS_FrameworkUnified
+LDLIBS += -lcommon
+
+######### add library path #############
+
+
+CPPFLAGS = -I./include/ -I./../../include-share -I./../../server/include -I./../libtskmcfg/include
+
+CPPFLAGS += -fno-exceptions
+
+include ../../../system_service.mk
diff --git a/video_in_hal/systemservice/task_manager/client/libprimary/include/pri_main.h b/video_in_hal/systemservice/task_manager/client/libprimary/include/pri_main.h
new file mode 100755
index 0000000..c29a337
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libprimary/include/pri_main.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_CLIENT_LIBPRIMARY_INCLUDE_PRI_MAIN_H_
+#define TASK_MANAGER_CLIENT_LIBPRIMARY_INCLUDE_PRI_MAIN_H_
+
+#include <native_service/frameworkunified_types.h>
+
+#include "system_service/tskm_type.h"
+#include "system_service/Primary_common.h"
+#include "system_service/INI_API.hpp"
+
+int pri_main(T_PRIM_PRM* p_prm, int argc, char* argv[]);
+void pri_exitStart(void* rsv);
+void pri_exitDone(int status);
+void* pri_getPrivate();
+HANDLE pri_getHandle();
+int32_t pri_setMonitorTimeout(uint32_t timeout);
+
+int32_t pri_stepForkComp(uint64_t id);
+int32_t pri_accOffComp(uint64_t id);
+
+int32_t pri_getBootInfo(T_SS_SM_START_DataStructType *info);
+int32_t pri_getExtBootInfo(T_SS_SM_START_ExtDataStructType *info);
+void pri_sendDebugDumpRes(const char *buf);
+
+void pri_init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum,
+ int fdlist[INI_FD_MAX]);
+BOOL pri_handler(fd_set* p_fds);
+void pri_term(void);
+int pri_setMonitorState(BOOL bIsRun, uint32_t timeout);
+void pri_getAppHandle(void);
+
+#endif // TASK_MANAGER_CLIENT_LIBPRIMARY_INCLUDE_PRI_MAIN_H_
+
diff --git a/video_in_hal/systemservice/task_manager/client/libprimary/libprimary.ver b/video_in_hal/systemservice/task_manager/client/libprimary/libprimary.ver
new file mode 100755
index 0000000..bebdc98
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libprimary/libprimary.ver
@@ -0,0 +1,22 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ global:
+ INI_*;
+ _INI_DEBUGDUMP*;
+ local: *;
+};
diff --git a/video_in_hal/systemservice/task_manager/client/libprimary/src/pri_api.cpp b/video_in_hal/systemservice/task_manager/client/libprimary/src/pri_api.cpp
new file mode 100755
index 0000000..ca1b40e
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libprimary/src/pri_api.cpp
@@ -0,0 +1,224 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "system_service/tskm_local_type.h"
+#include "system_service/INI_API.hpp"
+#include "tskm_debug.h"
+#include "pri_main.h"
+
+BOOL __thread isMain = FALSE; // Check for accessibility from the main thread context
+
+TSKM_STATIC BOOL isInitPrmValid(const T_PRIM_PRM* p_prm) {
+ if (p_prm == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->shmTbl == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->wakeupExFuncTbl == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->downExFuncTbl == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->onInit == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->onDestory == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->onDebugDump == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ } else if (p_prm->onTouch == NULL) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/******************************************************************************
+ * APIs for implementing the main thread on the service side
+ *******************************************************************************/
+/*********************************************************
+ * Primary library initialization
+ *********************************************************/
+int32_t INI_Init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum,
+ int fdlist[INI_FD_MAX]) {
+ isMain = TRUE;
+ if (isInitPrmValid(p_prm) == FALSE) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+ pri_init(p_prm, argc, argv, fdNum, fdlist);
+ return INI_SUCCESS;
+}
+
+/***********************************************************
+ * Primary library / Event handler
+ * ret:TRUE Running
+ * ret:FALSE Finished (Terminated a process with INI_Term())
+ ************************************************************/
+BOOL INI_Handler(fd_set* p_fds) {
+ if (!isMain || NULL == p_fds) {
+ TSKM_ASSERT(0);
+ return FALSE;
+ }
+
+ return pri_handler(p_fds);
+}
+
+/***********************************************************
+ * Primary (Processing finished)
+ ************************************************************/
+void INI_Term(void) {
+ pri_term();
+}
+
+/***********************************************************
+ * Primary (State setting for watching Services)
+ ************************************************************/
+int32_t INI_SetMonitorState(T_PRIM_MONITOR_PRM *p_prm) {
+ if (!p_prm) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ return pri_setMonitorState(p_prm->bIsRun, p_prm->timeout);
+ ERROR: return INI_FALSE;
+}
+
+/******************************************************************************
+ * Hiding the Main Thread in the Primary Library
+ *******************************************************************************/
+/************************************
+ * Startup FW MainLoop
+ ************************************/
+int INI_Main(T_PRIM_PRM* p_prm, int argc, char* argv[]) {
+ if (isInitPrmValid(p_prm) == FALSE) { // LCOV_EXCL_BR_LINE 6: Checked by Init()
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+
+ isMain = TRUE;
+
+ return pri_main(p_prm, argc, argv);
+}
+
+/******************************************************************************
+ * Common API
+ *******************************************************************************/
+/************************************
+ * Process termination
+ ************************************/
+void INI_ExitStart(void * rsv) {
+ static int isCalled = 0;
+ if (isCalled) {
+ return;
+ }
+ isCalled = 1;
+ pri_exitStart(rsv);
+}
+
+void INI_ExitDone(int status) {
+ static int isCalled = 0;
+ if (isCalled) {
+ return;
+ }
+ isCalled = 1;
+ pri_exitDone(status);
+}
+
+/************************************
+ * Private Info Acquisition
+ ************************************/
+void* INI_GetPrivate() {
+ return pri_getPrivate();
+}
+
+/************************************
+ * Applicastion Handle Aquisition
+ ************************************/
+HANDLE INI_GetHandle() {
+ return pri_getHandle();
+}
+
+/************************************
+ * Timeout setting for service monitoring status setting
+ ************************************/
+int32_t INI_SetMonitorTimeout(uint32_t timeout) {
+ return pri_setMonitorTimeout(timeout);
+}
+
+/************************************
+ * Event completion notification at startup
+ ************************************/
+int32_t INI_StepForkComp(uint64_t compId) {
+ return pri_stepForkComp(compId);
+}
+
+/************************************
+ * Event completion notification at termination
+ ************************************/
+int32_t INI_AccOffComp(uint64_t compId) {
+ return pri_accOffComp(compId);
+}
+
+/************************************
+ * BOOT Info Acquisition
+ ************************************/
+int32_t INI_GetBootInfo(T_SS_SM_START_DataStructType *info) {
+ if (info == NULL) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+ return pri_getBootInfo(info);
+}
+
+/************************************
+ * Extended BOOT Info Acquisition
+ ************************************/
+int32_t INI_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *info) {
+ if (info == NULL) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+ return pri_getExtBootInfo(info);
+}
+
+/************************************
+ * DebugDump Responding
+ ************************************/
+void _INI_DEBUGDUMP(BOOL bIsNeedSvcName, PCSTR cFormat, ...) { // LCOV_EXCL_START 7: for debugging
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ va_list argList;
+ char buf[TSKM_EV_DEBUGDUMP_SIZE] = { 0 };
+
+ if (bIsNeedSvcName) {
+ snprintf(buf, TSKM_EV_DEBUGDUMP_SIZE, "%s/",
+ FrameworkunifiedGetAppName(pri_getHandle()));
+ }
+
+ va_start(argList, cFormat);
+ vsnprintf(&buf[strlen(buf)], TSKM_EV_DEBUGDUMP_SIZE - strlen(buf), cFormat,
+ argList);
+ va_end(argList);
+
+ return pri_sendDebugDumpRes(buf);
+}
+// LCOV_EXCL_STOP 7
+
diff --git a/video_in_hal/systemservice/task_manager/client/libprimary/src/pri_main.cpp b/video_in_hal/systemservice/task_manager/client/libprimary/src/pri_main.cpp
new file mode 100755
index 0000000..9c0dd95
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libprimary/src/pri_main.cpp
@@ -0,0 +1,873 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "pri_main.h"
+#include <sys/eventfd.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <system_service/ss_system_if.h>
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include "tskm_debug.h"
+#include "tskm_comm.h"
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+#include "tskm_util.h"
+
+
+#define PRI_PROC_NAME_MAX 32
+
+// Context
+typedef struct {
+ T_PRIM_PRM prm;
+
+ TSKM_SVCID_t svcId; // Set valid value by REQ_WAKEUP
+ char procName[PRI_PROC_NAME_MAX];
+ // State
+ TSKM_BOOL_t isExec;
+ T_SS_SM_START_DataStructType bootInfo;
+ T_SS_SM_START_ExtDataStructType extBootInfo; TSKM_BOOL_t isDynamic;
+ uint32_t wakeupStepDone; // Performed Local Step
+ TSKM_BOOL_t shmDone;
+ uint32_t downStepDone; // Performed Local Step
+ TSKM_BOOL_t isExitStart;
+
+#define PRI_MONITOR_DEFAULT_TIMEOUT 50
+ uint32_t timeout; // Service monitoring timeout period (valid only for the INI_Main type service)
+
+ // Resources
+ int connFd; // TSKM communication sockets
+ int nsFd; // NSFW sockets
+ int pipeFd[2]; // For exitDone
+ HANDLE hApp; // appHandle
+} PRI_CTX_t;
+
+static PRI_CTX_t g_pri;
+
+/*********************************************
+ * Create Shared Memory
+ *********************************************/
+TSKM_STATIC void shmMake(PRI_CTX_t* p_ctx) {
+ const PRIM_SHAREDATA_TBL* shmEntry;
+ for (shmEntry = p_ctx->prm.shmTbl; shmEntry->shmName[0] != '\0'; shmEntry++) {
+ int ret;
+ ret = tskm_pf_shmCreate(shmEntry->shmName, shmEntry->size, NULL);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+ p_ctx->shmDone = TSKM_TRUE;
+ return;
+
+ // LCOV_EXCL_START 6: Checked by Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************
+ * Call Backup Check CB
+ *********************************************/
+TSKM_STATIC uint32_t wakeupExFuncCallback(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ const PRIM_EXFUNC_TBL* funcEntry;
+ uint32_t maxStep = 0;
+
+ for (funcEntry = p_ctx->prm.wakeupExFuncTbl; funcEntry->localStep != 0;
+ funcEntry++) {
+ if (funcEntry->localStep == p_prm->localStep) {
+ funcEntry->func(funcEntry->prm);
+ }
+ maxStep = TSKM_MAX(maxStep, funcEntry->localStep);
+ }
+ return maxStep;
+}
+
+/*********************************************
+ * Gradual Start Request
+ *********************************************/
+TSKM_STATIC void wakeupRequest(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t prm = *p_prm;
+ uint32_t max = 0;
+
+ // Execute one step at a time
+ for (prm.localStep = p_ctx->wakeupStepDone + 1;
+ (prm.localStep <= p_prm->localStep && prm.localStep < PRIM_STEPFORK_MAX);
+ prm.localStep++) {
+ max = wakeupExFuncCallback(p_ctx, &prm);
+ }
+
+ if (max <= p_prm->localStep) {
+ // Gradual start completed
+ p_ctx->wakeupStepDone = PRIM_STEPFORK_MAX;
+ } else {
+ p_ctx->wakeupStepDone = p_prm->localStep;
+ }
+}
+
+/*********************************************
+ * All startup requests
+ *********************************************/
+TSKM_STATIC void allWakeup(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ if (!p_ctx->shmDone) {
+ shmMake(p_ctx);
+ }
+
+ if (p_ctx->wakeupStepDone < PRIM_STEPFORK_MAX) {
+ wakeupRequest(p_ctx, p_prm);
+ }
+}
+
+/*********************************************
+ * Startup request handle
+ *********************************************/
+TSKM_STATIC void wakeupRequestHandle(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+
+ bzero(&ev, sizeof(ev));
+
+ p_ctx->svcId = p_prm->svcId;
+ memcpy(&p_ctx->bootInfo, &p_prm->bootInfo, sizeof(p_ctx->bootInfo));
+ memcpy(&p_ctx->extBootInfo, &p_prm->extBootInfo, sizeof(p_ctx->extBootInfo));
+ p_ctx->isDynamic = p_prm->isDynamic;
+
+ if (p_prm->localStep == TSKM_LSTEP_ALL) {
+ allWakeup(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_LAST) {
+ wakeupRequest(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_SHM) {
+ shmMake(p_ctx);
+ } else {
+ wakeupRequest(p_ctx, p_prm);
+ }
+
+ ev.prm.resWakeup.isShmDone = p_ctx->shmDone;
+ ev.prm.resWakeup.isStepDone =
+ (p_ctx->wakeupStepDone >= PRIM_STEPFORK_MAX) ?
+ TSKM_TRUE : TSKM_FALSE;
+
+ // LCOV_EXCL_BR_START 6: Because it depends on the test order
+ if (ev.prm.resWakeup.isShmDone && ev.prm.resWakeup.isStepDone) {
+ // LCOV_EXCL_BR_STOP
+ ev.prm.resWakeup.isLast = TSKM_TRUE;
+ }
+
+ ev.event = TSKM_EV_PRI_RES_WAKEUP;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+ }
+}
+
+/*********************************************
+ * Gradual Termination CALLBACK
+ *********************************************/
+TSKM_STATIC uint32_t downExFuncCallback(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ const PRIM_EXFUNC_TBL* funcEntry;
+ uint32_t maxStep = 0;
+
+ for (funcEntry = p_ctx->prm.downExFuncTbl; funcEntry->localStep != 0;
+ funcEntry++) {
+ if (funcEntry->localStep == p_prm->localStep) {
+ funcEntry->func(funcEntry->prm);
+ }
+ maxStep = TSKM_MAX(maxStep, funcEntry->localStep);
+ }
+ return maxStep;
+}
+
+/*********************************************
+ * Gradual Termination Request
+ *********************************************/
+TSKM_STATIC void downRequest(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ TSKM_EV_PRI_REQ_DOWN_PRM_t prm = *p_prm;
+ uint32_t max = 0;
+
+ // Execute one step at a time
+ for (prm.localStep = p_ctx->downStepDone + 1;
+ (prm.localStep <= p_prm->localStep && prm.localStep < PRIM_ACCOFF_MAX);
+ prm.localStep++) {
+ max = downExFuncCallback(p_ctx, &prm);
+ }
+
+ if (max <= p_prm->localStep) {
+ p_ctx->downStepDone = PRIM_ACCOFF_MAX; // Completed all steps
+ } else {
+ p_ctx->downStepDone = p_prm->localStep;
+ }
+}
+
+TSKM_STATIC void downRequestHandle(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+
+ bzero(&ev, sizeof(ev));
+
+ if (p_prm->localStep == TSKM_LSTEP_ALL || p_prm->localStep == TSKM_LSTEP_LAST) {
+ downRequest(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_SHM) {
+ TSKM_ASSERT(0);
+ } else if (p_prm->localStep == TSKM_LSTEP_BUPCHK) {
+ TSKM_ASSERT(0);
+ } else {
+ downRequest(p_ctx, p_prm);
+ }
+
+ if (p_ctx->downStepDone >= PRIM_ACCOFF_MAX) {
+ /* It is not notified when the last function is executed, and it is left to the exitDone.
+ TSKM_PRINTF(TSKM_LOG_DEBUG,"ACCOFF DONE");
+ ev.prm.resDown.isLast = TSKM_TRUE;
+ p_ctx->isExec = TSKM_FALSE;
+ ret = tskm_sockSend(p_ctx->connFd,&ev);
+ if(ret <= 0){
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ }
+ */
+ } else {
+ ev.event = TSKM_EV_PRI_RES_DOWN;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+ }
+ }
+}
+
+/*********************************************
+ * Termination completion is notified to the TSKM
+ *********************************************/
+TSKM_STATIC void sendLastDoneRes(PRI_CTX_t* p_ctx) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_PRI_RES_DOWN;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.resDown.isLast = TSKM_TRUE;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Termination completion is notified to the TSKM.
+ // LCOV_EXCL_START 5: Termination completion is notified to the TSKM.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+ }
+}
+
+/*********************************************
+ * Invocation of Touch CB
+ *********************************************/
+TSKM_STATIC void touchService(PRI_CTX_t* p_ctx) {
+ char touchName[32];
+
+ if (p_ctx->isExitStart) {
+ // If termination processing has already begun, the system does not respond Touch but TIMEOUT the processing for retrying.
+ return;
+ }
+
+ p_ctx->prm.onTouch(p_ctx->hApp);
+
+ tskm_pf_mkTouchFileName(getpid(), touchName);
+
+ if ((access(touchName, F_OK) == 0)) {
+ // Synchronize by deleting files.
+ TSKM_PRINTF(TSKM_LOG_STATE, "del:%s", touchName);
+ unlink(touchName);
+ } else {
+ TSKM_ASSERT_PRINT(0, "%s", touchName);
+ }
+}
+
+/*********************************************
+ * Invocation of Debugdump CB
+ *********************************************/
+TSKM_STATIC void callDebugDump(PRI_CTX_t* p_ctx) {
+ if (!p_ctx->prm.onDebugDump) { // LCOV_EXCL_BR_LINE 6: As NULL checked by INI_Init
+ // LCOV_EXCL_START 6: As NULL checked by INI_Init
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ } else {
+ p_ctx->prm.onDebugDump(p_ctx->hApp);
+ }
+}
+
+/*********************************************
+ * Invocation of LowMemory detection CB
+ *********************************************/
+TSKM_STATIC void callLowMem(PRI_CTX_t* p_ctx) {
+ if (!p_ctx->prm.onLowMem) {
+ TSKM_ASSERT(0);
+ } else if (!p_ctx->isExitStart) {
+ // Notify LowMemory only when the process is finished
+ p_ctx->prm.onLowMem(p_ctx->hApp);
+ }
+}
+
+/*********************************************
+ * Event Handle
+ *********************************************/
+TSKM_STATIC void eventHandle(PRI_CTX_t* p_ctx, TSKM_EVENT_INFO_t* p_ev) {
+ // Processing according to the request
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REQ_WAKEUP:
+ wakeupRequestHandle(p_ctx, &p_ev->prm.reqWakeup);
+ break;
+ case TSKM_EV_PRI_REQ_DOWN:
+ downRequestHandle(p_ctx, &p_ev->prm.reqDown);
+ break;
+ case TSKM_EV_PRI_REQ_TOUCH:
+ touchService(p_ctx);
+ break;
+ case TSKM_EV_PRI_REQ_DEBUGDUMP:
+ callDebugDump(p_ctx);
+ break;
+ case TSKM_EV_PRI_REP_LOWMEM:
+ callLowMem(p_ctx);
+ break;
+ default:
+ TSKM_ASSERT(0);
+ break;
+ }
+}
+
+/*********************************************
+ * Initialize Context
+ *********************************************/
+TSKM_STATIC void initCtx(T_PRIM_PRM* p_prm, PRI_CTX_t* p_ctx, int argc,
+ char* argv[]) {
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+
+ p_ctx->prm = *p_prm;
+
+ cbFuncs.onInitilization = p_ctx->prm.onInit;
+ cbFuncs.onDestroy = p_ctx->prm.onDestory;
+ cbFuncs.onDebugDump = p_ctx->prm.onDebugDump;
+ cbFuncs.onStart = FrameworkunifiedOnStart;
+ cbFuncs.onStop = FrameworkunifiedOnStop;
+ cbFuncs.onPreStart = FrameworkunifiedOnPreStart;
+ cbFuncs.onPreStop = FrameworkunifiedOnPreStop;
+ cbFuncs.onBackgroundStart = FrameworkunifiedOnBackgroundStart;
+ cbFuncs.onBackgroundStop = FrameworkunifiedOnBackgroundStop;
+ cbFuncs.createStateMachine = FrameworkunifiedCreateStateMachine;
+ cbFuncs.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface;
+
+ EFrameworkunifiedStatus taskmanagerRet;
+ taskmanagerRet = FrameworkunifiedCreateDispatcherWithoutLoop(p_ctx->prm.name, p_ctx->hApp, argc,
+ argv, &cbFuncs, FALSE);
+ if (eFrameworkunifiedStatusOK != taskmanagerRet) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ taskmanagerRet = FrameworkunifiedGetDispatcherFD(p_ctx->hApp, &p_ctx->nsFd);
+ if (taskmanagerRet != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ exit(EXIT_FAILURE);
+ }
+
+ p_ctx->connFd = tskm_cliSockConnect(TSKM_SOCKET_NAME);
+ if (p_ctx->connFd < 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ if (pipe(p_ctx->pipeFd) != 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ return;
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************
+ * Destroy Context
+ *********************************************/
+TSKM_STATIC void termCtx(PRI_CTX_t* p_ctx) {
+ if (p_ctx->shmDone) { // LCOV_EXCL_BR_LINE 6: Since it has been set to True by INI_Handler and cannot be changed
+ const PRIM_SHAREDATA_TBL* shmEntry = p_ctx->prm.shmTbl;
+ for (shmEntry = p_ctx->prm.shmTbl; shmEntry->shmName[0] != '\0';
+ shmEntry++) {
+ TSKM_ASSERT(0 == tskm_pf_shmDelete(shmEntry->shmName)); // LCOV_EXCL_BR_LINE 8: For processing in which only return value 0 is set
+ }
+ }
+
+ if (p_ctx->connFd > 0) { // LCOV_EXCL_BR_LINE 6: As it is already set by INI_Init and cannot be changed
+ tskm_sockDestory(p_ctx->connFd);
+ }
+
+ EFrameworkunifiedStatus taskmanagerRet;
+ taskmanagerRet = FrameworkunifiedDestroyDispatcherWithoutLoop(p_ctx->hApp);
+ TSKM_ASSERT(taskmanagerRet == eFrameworkunifiedStatusOK);
+
+ if (p_ctx->isDynamic) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "EXIT %s", p_ctx->procName);
+ } else {
+ // Hung up running services to prevent adversely affecting to system termination processing during process termination processing
+ sleep(TSKM_CFG_WAIT_SHUTDOWN);
+ }
+}
+
+/*******************************************************************
+ * PRI Context Initialization
+ *******************************************************************/
+void pri_init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum,
+ int fdlist[INI_FD_MAX]) {
+ int ret = 0;
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ strncpy(p_ctx->procName, basename(argv[0]), sizeof(p_ctx->procName) - 1);
+
+ ret = tskm_pf_procInit();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: Return value of 0 only
+ // LCOV_EXCL_START 6: Return value of 0 only
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = tskm_comm_procInit();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ initCtx(p_prm, p_ctx, argc, argv);
+
+ *fdNum = 3;
+ fdlist[0] = p_ctx->connFd;
+ fdlist[1] = p_ctx->pipeFd[0];
+ fdlist[2] = p_ctx->nsFd;
+
+ p_ctx->svcId = TSKM_SVCID_NONE;
+ p_ctx->isExec = TSKM_TRUE;
+
+ p_ctx->bootInfo.startupReason = epswfINVALID;
+ p_ctx->bootInfo.isUserModeOn = FALSE;
+ p_ctx->bootInfo.dataResetMode = e_SS_SM_DATA_RESET_MODE_NONE;
+ p_ctx->bootInfo.securityStatus = epsssINVALID;
+ p_ctx->bootInfo.wakeupType = epsstINVALID;
+ p_ctx->bootInfo.dramBackupStatus = e_SS_SM_DRAM_BACKUP_UNSET;
+ p_ctx->bootInfo.resetStatus = e_SS_SM_RESET_STATUS_UNSET;
+
+ memset(&p_ctx->extBootInfo, 0, sizeof(p_ctx->extBootInfo));
+
+ p_ctx->timeout = PRI_MONITOR_DEFAULT_TIMEOUT;
+
+ return;
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort(); // ABORT
+ // LCOV_EXCL_STOP
+}
+
+/*******************************************************************
+ * Primary Library Handler
+ *******************************************************************/
+BOOL pri_handler(fd_set* p_fds) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (FD_ISSET(p_ctx->connFd, p_fds)) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+ ret = tskm_sockRcv(p_ctx->connFd, &ev);
+ // LCOV_EXCL_BR_START 5: Condition is true. False condition is checked in Death tests, but not reflected in coverage and excluded
+ if (ret > 0) {
+ // LCOV_EXCL_BR_STOP
+ eventHandle(p_ctx, &ev);
+ } else { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (FD_ISSET(p_ctx->pipeFd[0], p_fds)) {
+ // only use exitDone
+ uint32_t tmp;
+ TSKM_ASSERT(sizeof(tmp) == read(p_ctx->pipeFd[0], &tmp, sizeof(tmp)));
+ TSKM_ASSERT(p_ctx->downStepDone == PRIM_ACCOFF_MAX); // Check if all exit functions are complete
+ if (p_ctx->isDynamic) {
+ // A nonresident service completes its termination processing by terminating the process.
+ // (because the SIGNAL will overtake the sockets)
+ } else {
+ // The resident service is a termination notice and completes termination processing.
+ // (Do not terminate processes to reduce the impact on system termination)
+ sendLastDoneRes(p_ctx);
+ }
+ p_ctx->isExec = TSKM_FALSE;
+ }
+
+ if (FD_ISSET(p_ctx->nsFd, p_fds)) {
+ FrameworkunifiedDispatchProcessWithoutLoop(p_ctx->hApp);
+ }
+ return p_ctx->isExec;
+
+ // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort(); // ABORT
+ return 0;
+ // LCOV_EXCL_STOP
+}
+
+/*******************************************************************
+ * Process termination
+ *******************************************************************/
+void pri_term(void) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ termCtx(p_ctx);
+}
+
+/*******************************************************************
+ * Service Monitoring Status Setting
+ *******************************************************************/
+int pri_setMonitorState(BOOL bIsRun, uint32_t timeout) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ int ret = INI_SUCCESS;
+
+ if (TSKM_SVCID_NONE == p_ctx->svcId) {
+ // Ignore requests until svcId is acquired.
+ } else if ((TRUE == bIsRun) && (0 == timeout)) {
+ // When RUN is specified with timeout = 0, monitoring is disabled.
+ } else {
+ ret = tskm_comm_setSvcWatchState(p_ctx->svcId, bIsRun, timeout);
+ if (INI_SUCCESS != ret) {
+ TSKM_ASSERT(0);
+ }
+ }
+
+ return ret;
+}
+
+/*******************************************************************
+ * MAIN Function
+ *******************************************************************/
+int pri_main(T_PRIM_PRM* p_prm, int argc, char* argv[]) {
+ int mainRet = -1;
+ int fdlist[INI_FD_MAX];
+ int fdNum;
+ int ii;
+ BOOL isExec = TRUE;
+
+ pri_init(p_prm, argc, argv, &fdNum, fdlist);
+
+ while (isExec) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ int maxFd = 0;
+ fd_set fds;
+ int ret;
+
+ FD_ZERO(&fds);
+
+ for (ii = 0; ii < fdNum; ii++) {
+ FD_SET(fdlist[ii], &fds);
+ maxFd = TSKM_MAX(fdlist[ii], maxFd);
+ }
+
+ TSKM_ASSERT(INI_SUCCESS == pri_setMonitorState(FALSE, 0));
+ ret = select(maxFd + 1, &fds, NULL, NULL, NULL);
+ TSKM_ASSERT(INI_SUCCESS == pri_setMonitorState(TRUE, p_ctx->timeout));
+ if (ret < 1) {
+ // LCOV_EXCL_START 5: Select's Error-Handling Process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno != EINTR) {
+ TSKM_ASSERT(0);
+ }
+ continue;
+ // LCOV_EXCL_STOP
+ }
+
+ isExec = pri_handler(&fds);
+ }
+
+ mainRet = 0;
+
+ pri_term();
+ return mainRet;
+}
+
+/*******************************************************************
+ * Termination Request
+ *******************************************************************/
+void pri_exitStart(void *rsv) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+ p_ctx->isExitStart = TRUE;
+ ev.event = TSKM_EV_PRI_REQ_EXIT;
+ ev.errCode = TSKM_E_OK;
+
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: The caller's external API does not execute the second or subsequent processing and cannot be checked.
+ // LCOV_EXCL_START 5: The caller's external API does not execute the second or subsequent processing and cannot be checked.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ return;
+ // LCOV_EXCL_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked.
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+void pri_exitDone(int status) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ uint32_t l_status = (uint32_t) status;
+
+ if (p_ctx->pipeFd[1] > 0) { // LCOV_EXCL_BR_LINE 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ // LCOV_EXCL_BR_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ TSKM_ASSERT_ERRNO(
+ write(p_ctx->pipeFd[1], &l_status, sizeof(l_status))
+ == sizeof(l_status));
+ // LCOV_EXCL_BR_STOP
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: The caller's external API does not execute the second or subsequent processing and cannot be checked.
+ }
+}
+
+/*******************************************************************
+ * Event completion notification at startup
+ *******************************************************************/
+int32_t pri_stepForkComp(uint64_t id) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+ ev.event = TSKM_EV_PRI_REP_WAKEUP_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repWakeupComp.compId = id;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ return INI_SUCCESS;
+ ERROR: return INI_FALSE;
+}
+
+/*******************************************************************
+ * Event completion notification at termination
+ *******************************************************************/
+int32_t pri_accOffComp(uint64_t id) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_PRI_REP_DOWN_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repDownComp.compId = id;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ return INI_SUCCESS;
+ ERROR: return INI_FALSE;
+}
+
+/*******************************************************************
+ * Private Information Acquisition
+ *******************************************************************/
+void*
+pri_getPrivate() {
+ PRI_CTX_t* p_ctx = &g_pri;
+ return p_ctx->prm.priv;
+}
+
+/*******************************************************************
+ * App Handle Acquisition
+ *******************************************************************/
+HANDLE pri_getHandle() {
+ PRI_CTX_t* p_ctx = &g_pri;
+ return p_ctx->hApp;
+}
+
+/*******************************************************************
+ * Timeout setting for Service monitoring status setting
+ *******************************************************************/
+int32_t pri_setMonitorTimeout(uint32_t timeout) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ p_ctx->timeout = timeout;
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * BOOT Info Acquisition
+ *******************************************************************/
+int32_t pri_getBootInfo(T_SS_SM_START_DataStructType *info) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (p_ctx->bootInfo.startupReason == epswfINVALID) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+
+ *info = p_ctx->bootInfo;
+
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * Extended BOOT Info Acquisition
+ *******************************************************************/
+int32_t pri_getExtBootInfo(T_SS_SM_START_ExtDataStructType *info) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (p_ctx->bootInfo.startupReason == epswfINVALID) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+
+ *info = p_ctx->extBootInfo;
+
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * DebugDump Responding
+ *******************************************************************/
+void pri_sendDebugDumpRes(const char *buf) { // LCOV_EXCL_START 7: for debugging
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+ TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *p_prm;
+
+ ev.event = TSKM_EV_PRI_RES_DEBUGDUMP;
+ ev.errCode = TSKM_E_OK;
+ ev.hasExtend = TSKM_TRUE;
+
+ ev.extendPrm = malloc(sizeof(TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t));
+ if (!ev.extendPrm) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ ev.extendSize = sizeof(TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t);
+
+ p_prm = (TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *) ev.extendPrm; // NOLINT ( )
+ snprintf(p_prm->dumpMsg, TSKM_EV_DEBUGDUMP_SIZE, "%s", buf);
+
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ }
+
+ ERROR: return;
+}
+// LCOV_EXCL_STOP
+/*************************************************
+ * Empty functions implemented for building software
+ **************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/systemservice/task_manager/client/libtskm/Makefile b/video_in_hal/systemservice/task_manager/client/libtskm/Makefile
new file mode 100755
index 0000000..b0f7e2f
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskm/Makefile
@@ -0,0 +1,35 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+VPATH = ./ ./src
+
+INST_SHLIBS = libtskm
+
+RPC_API := TSKM
+
+libtskm_SRCS = tskm_api_stub.c
+libtskm_SRCS += tskm_api_lib.cpp
+
+CPPFLAGS += -I. -I../../include-share -I./ -I../../server/include -I./../libtskmcfg/include
+
+######## add compile option ########
+CPPFLAGS += -fno-exceptions
+LDFLAGS += -Wl,--no-as-needed
+######### linked library (dynamic) #############
+LDLIBS += -lrpc
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+include ../../../system_service.mk
diff --git a/video_in_hal/systemservice/task_manager/client/libtskm/TSKM.api b/video_in_hal/systemservice/task_manager/client/libtskm/TSKM.api
new file mode 100755
index 0000000..023f53b
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskm/TSKM.api
@@ -0,0 +1,9 @@
+INCLUDE <system_service/tskm.h>
+
+RPC_Result _TSKM_SvcCtl(TSKM_SVCID_t svcId,const TSKM_SVC_CTL_t* ctl);
+RPC_Result TSKM_SvcGetInfo(TSKM_SVCID_t svcId,TSKM_SVC_INFO_t* svcInfo);
+RPC_Result _TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info);
+RPC_Result TSKM_Reboot(const TSKM_RSV_t * p_rsv);
+RPC_Result TSKM_Logging(const TSKM_LOGGING_INFO_t* p_info);
+RPC_Result TSKM_SetWakeupOrder(const TSKM_WAKEUP_ORDER_t* p_order);
+
diff --git a/video_in_hal/systemservice/task_manager/client/libtskm/libtskm.ver b/video_in_hal/systemservice/task_manager/client/libtskm/libtskm.ver
new file mode 100755
index 0000000..4d68cee
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskm/libtskm.ver
@@ -0,0 +1,21 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ global:
+ TSKM_*;
+ local: *;
+};
diff --git a/video_in_hal/systemservice/task_manager/client/libtskm/src/tskm_api_lib.cpp b/video_in_hal/systemservice/task_manager/client/libtskm/src/tskm_api_lib.cpp
new file mode 100755
index 0000000..625b639
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskm/src/tskm_api_lib.cpp
@@ -0,0 +1,90 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <unistd.h>
+#include <signal.h>
+
+#include <native_service/frameworkunified_framework_if.h>
+
+#include "tskm_debug.h"
+#include "tskm_api.h"
+
+TSKM_ERR_t TSKM_SvcCtl(TSKM_SVCID_t svcId, const TSKM_SVC_CTL_t* ctl) {
+ TSKM_ERR_t tskmRet;
+ int ii;
+
+ for (ii = 0; ii < 3; ii++) {
+ // Retry three times
+ tskmRet = _TSKM_SvcCtl(svcId, ctl);
+ if (tskmRet == TSKM_E_RETRY) {
+ usleep(300 * 1000); // 300ms wait
+ } else {
+ break;
+ }
+ }
+
+ return tskmRet;
+}
+
+TSKM_ERR_t TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+ RPC_Result rpcRet;
+
+ rpcRet = _TSKM_ErrorReboot(p_info);
+ if (RPC_OK != rpcRet) {
+ tskmRet = TSKM_E_PAR;
+ }
+
+ return tskmRet;
+}
+
+TSKM_ERR_t TSKM_DataInit(HANDLE hApp, const TSKM_DATAINIT_t *p_info) {
+ TSKM_ERR_t tskmRet = TSKM_E_NG;
+ TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__)
+
+ if (!p_info || !hApp || (p_info->type != TSKM_DATAINIT_TYPE_USER)
+ || !(p_info->onCompInit)) {
+ TSKM_ASSERT(0);
+ return TSKM_E_PAR;
+ }
+
+ // LCOV_EXCL_BR_START 10: Due to compiler dependency
+ EFrameworkunifiedStatus l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp,
+ SS_TASK_MANAGER,
+ TSKM_DATAINIT_RESP,
+ p_info->onCompInit);
+ // LCOV_EXCL_BR_STOP
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ } else {
+ HANDLE hSvc = FrameworkunifiedOpenService(hApp, SS_TASK_MANAGER);
+ if (hSvc == NULL) {
+ TSKM_ASSERT(0);
+ tskmRet = TSKM_E_STATE;
+ } else {
+ if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSvc, TSKM_DATAINIT_REQ, 0, NULL)) {
+ TSKM_ASSERT(0);
+ } else {
+ tskmRet = TSKM_E_OK;
+ }
+ }
+
+ TSKM_ASSERT(eFrameworkunifiedStatusOK == FrameworkunifiedCloseService(hApp, hSvc));
+ }
+
+ return tskmRet;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/Makefile b/video_in_hal/systemservice/task_manager/client/libtskmcfg/Makefile
new file mode 100755
index 0000000..9fe2ed3
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/Makefile
@@ -0,0 +1,93 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+WAKESHUTCONF_DIR=./conf
+
+VPATH = ./src ./include/$(COMPONENT_NAME)
+
+INST_SHLIBS = libtskmcfg
+INST_HEADERS = tskm_xml_data.h tskm_svcid.h task_manager_libtskmcfg.h
+libtskmcfg_SRCS = tskm_xml_data.cpp
+
+
+CPPFLAGS = -I./ -I./include -I./../../include-share -I./../../server/include
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+
+#============ XML PARSE ============
+XMLOUTFILE= tskm_auto_build.h
+
+CLEAN_FILES+=$(XMLOUTFILE) $(PARSEXMLCMD) $(CONFIG_FILES) top.xml
+
+#TOOLS
+HOST_CPP=cpp
+XMLCHECKER=xmllint
+XMLCHECKEROPT=--noout --valid
+PARSEXMLCMD=parsexml
+HOSTCC=gcc
+XMLFILETOP=tskm_cfg.xml
+
+install:install-pre install-pre-header
+build-lib:install-pre install-pre-header
+install-lib:install-pre install-pre-header
+install-pre:
+ install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ss/task_manager/rodata;\
+ install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ss/task_manager/rodata $(WAKESHUTCONF_DIR)/tskm_launch.xml;\
+
+CONFIG_FILES:=tskm_wakeup.xml tskm_shutdown.xml tskm_wakeup_vup.xml tskm_shutdown_vup.xml tskm_launch.xml tskm_svcid.h agl_thread.h
+
+#install-header:$(XMLOUTFILE)
+install-pre-header:$(XMLOUTFILE)
+
+#TOPFILE
+top.xml:$(XMLFILETOP)
+ ln -fs $< $@
+
+#CONFIG RULES
+tskm_wakeup.xml:$(WAKESHUTCONF_DIR)/tskm_wakeup.xml
+ ln -fs $< $@
+
+tskm_shutdown.xml:$(WAKESHUTCONF_DIR)/tskm_shutdown.xml
+ ln -fs $< $@
+
+tskm_wakeup_vup.xml:$(WAKESHUTCONF_DIR)/tskm_wakeup_vup.xml
+ ln -fs $< $@
+
+tskm_shutdown_vup.xml:$(WAKESHUTCONF_DIR)/tskm_shutdown_vup.xml
+ ln -fs $< $@
+
+#tskm_svcid.h:$(SVCONF_DIR)/tskm_svcid.h
+# ln -fs $< $@
+
+agl_thread.h:$(WAKESHUTCONF_DIR)/agl_thread.h
+ ln -fs $< $@
+
+
+tskm_launch.xml:$(WAKESHUTCONF_DIR)/tskm_launch.xml agl_thread.h
+ $(HOST_CPP) -P -include agl_thread.h $< > $@
+#tskm_launch.xml:$(SVCONF_DIR)/tskm_launch.xml $(SDKTARGETSYSROOT)/usr/agl/include/agl_thread.h
+# $(HOST_CPP) -P -include agl_thread.h $< > $@
+
+$(XMLOUTFILE):top.xml $(PARSEXMLCMD) $(CONFIG_FILES)
+ $(XMLCHECKER) $(XMLCHECKEROPT) $<
+ ./$(PARSEXMLCMD) $<
+
+$(PARSEXMLCMD):$(PARSEXMLCMD).c
+ $(HOSTCC) -o $@ $< -lexpat
+
+include ../../../system_service.mk
+
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/agl_thread.h b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/agl_thread.h
new file mode 100755
index 0000000..83ac087
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/agl_thread.h
@@ -0,0 +1,1377 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ */
+
+#ifndef __AGL_THREAD_H__
+#define __AGL_THREAD_H__
+
+//MACRO
+#define PR_TSS_S "0"
+#define PR_TSS 0
+
+/*
+ Main thread name. It need to be same as service name in sm_launch.xml or tskm_launch.xml
+ Max name length is 15
+ #define MN_XXXXX "MainName"
+
+ Thread name
+ Max name length is 15
+ #define TN_XXXXX "ThreadName"
+
+ Thread priority 0:TSS 1-99:FIFO
+ #define PR_XXXXX_S "(0-99)" //for xml
+ #define PR_XXXXX 0-99 //for program
+*/
+
+#define MN_SS_SYSMANAGER "SS_SysManager"
+#define PR_SS_SYSMANAGER_S "20"
+#define PR_SS_SYSMANAGER (20)
+
+ #define TN_SMHEARTBEAT "SM.Heartbeat"
+ #define PR_SMHEARTBEAT_S "20"
+ #define PR_SMHEARTBEAT (20)
+
+ #define TN_SMPROCLAUNCH "SM.ProcLaunch"
+ #define PR_SMPROCLAUNCH_S "20"
+ #define PR_SMPROCLAUNCH (20)
+
+ #define TN_SMLOWMEMMON "SM.LowMemMon"
+ #define PR_SMLOWMEMMON_S "20"
+ #define PR_SMLOWMEMMON (20)
+
+ #define TN_LOGGERRTIME "LoggerRtime"
+ #define PR_LOGGERRTIME_S PR_TSS_S
+ #define PR_LOGGERRTIME PR_TSS
+
+
+//======= exec from system manager =============
+#define MN_NS_SHAREDMEM "NS_SharedMem"
+#define PR_NS_SHAREDMEM_S "25"
+#define PR_NS_SHAREDMEM (25)
+
+
+#define MN_NS_NPPSERVICE "NS_NPPService"
+#define PR_NS_NPPSERVICE_S "25"
+#define PR_NS_NPPSERVICE (25)
+
+ #define TN_NS_NPPREADWKR "NS_NPPReadWkr"
+ #define PR_NS_NPPREADWKR_S "25"
+ #define PR_NS_NPPREADWKR (25)
+
+ #define TN_NS_NPPWRITEWKR "NS_NPPWriteWkr"
+ #define PR_NS_NPPWRITEWKR_S "25"
+ #define PR_NS_NPPWRITEWKR (25)
+
+ #define TN_NS_NPPIPWKR "NS_NPPIPWkr"
+ #define PR_NS_NPPIPWKR_S "25"
+ #define PR_NS_NPPIPWKR (25)
+
+#define MN_NS_BACKUPMGR "NS_BackupMgr"
+#define PR_NS_BACKUPMGR_S "25"
+#define PR_NS_BACKUPMGR (25)
+
+ #define TN_NS_BKUPNAND "NS_BkupNAND"
+ #define PR_NS_BKUPNAND_S "25"
+ #define PR_NS_BKUPNAND (25)
+
+ #define TN_NS_BKUPDELAY "NS_BkupDelay"
+ #define PR_NS_BKUPDELAY_S "25"
+ #define PR_NS_BKUPDELAY (25)
+
+#define MN_SS_DEVDETECTSRV "SS_DevDetectSrv"
+#define PR_SS_DEVDETECTSRV_S "20"
+#define PR_SS_DEVDETECTSRV (20)
+
+ #define TN_SS_DETECT_USB "SS_Detect_USB"
+ #define PR_SS_DETECT_USB_S "20"
+ #define PR_SS_DETECT_USB (20)
+
+ #define TN_SS_DETECT_SD "SS_Detect_SD"
+ #define PR_SS_DETECT_SD_S "20"
+ #define PR_SS_DETECT_SD (20)
+
+ #define TN_SS_MONITOR_OVC "SS_Monitor_OVC"
+ #define PR_SS_MONITOR_OVC_S "20"
+ #define PR_SS_MONITOR_OVC (20)
+
+#define MN_SS_LOGGERSRV "SS_LoggerSrv"
+#define PR_SS_LOGGERSRV_S PR_TSS_S
+#define PR_SS_LOGGERSRV PR_TSS
+
+ #define TN_PDGLOGQUER "pdg.LogQueR"
+ #define PR_PDGLOGQUER_S PR_TSS_S
+ #define PR_PDGLOGQUER PR_TSS
+
+ #define TN_PDGTRANSQUER "pdg.TransQueR"
+ #define PR_PDGTRANSQUER_S PR_TSS_S
+ #define PR_PDGTRANSQUER PR_TSS
+
+ #define TN_PDGEVNTLOGQUE "pdg.EvntLogQue"
+ #define PR_PDGEVNTLOGQUE_S PR_TSS_S
+ #define PR_PDGEVNTLOGQUE PR_TSS
+
+ #define TN_SSLOGGERSTRAGE "SSLoggerStrage"
+ #define PR_SSLOGGERSTRAGE_S PR_TSS_S
+ #define PR_SSLOGGERSTRAGE PR_TSS
+
+ #define TN_PFDRECTHREAD "PFDRECThread"
+ #define PR_PFDRECTHREAD_S PR_TSS_S
+ #define PR_PFDRECTHREAD PR_TSS
+
+#define MN_PS_LOGGERSHADOW "PS_LoggerShadow"
+ #define PR_PSLOGGERSHADOW_S PR_TSS_S
+ #define PR_PSLOGGERSHADOW PR_TSS
+
+#define MN_UDEVD "udevd"
+#define PR_UDEVD_S "1"
+#define PR_UDEVD (1)
+
+#define MN_COMMUNICATION "Communication"
+#define PR_COMMUNICATION_S "30"
+#define PR_COMMUNICATION (30)
+
+ #define TN_DEV_SYSCOM_TMR "DEV_SYSCOM_TMR"
+ #define PR_DEV_SYSCOM_TMR_S "30"
+ #define PR_DEV_SYSCOM_TMR (30)
+
+ #define TN_DEV_SYSCOM_RCV "DEV_SYSCOM_RCV"
+ #define PR_DEV_SYSCOM_RCV_S "30"
+ #define PR_DEV_SYSCOM_RCV (30)
+
+ #define TN_DEV_SYSCOM_MAIN "DEV_SYSCOM_MAIN"
+ #define PR_DEV_SYSCOM_MAIN_S "30"
+ #define PR_DEV_SYSCOM_MAIN (30)
+
+ #define TN_TGWCOM "TGWCOM"
+ #define PR_TGWCOM_S "30"
+ #define PR_TGWCOM (30)
+
+ #define TN_ICM "ICM"
+ #define PR_ICM_S "30"
+ #define PR_ICM (30)
+
+ #define TN_CAN_COM_PROT "CAN_COM_PROT"
+ #define PR_CAN_COM_PROT_S "30"
+ #define PR_CAN_COM_PROT (30)
+
+#define MN_PS_PSMSHADOW "PS_PSMShadow"
+#define PR_PS_PSMSHADOW_S "30"
+#define PR_PS_PSMSHADOW (30)
+
+#define MN_COMMSH4A "CommSH4A"
+#define PR_COMMSH4A_S "30"
+#define PR_COMMSH4A (30)
+
+ #define TN_DEV_SH4A_SND "DEV_SH4ACOM_SND"
+ #define PR_DEV_SH4A_SND_S "30"
+ #define PR_DEV_SH4A_SND (30)
+
+ #define TN_DEV_SH4A_RCV "DEV_SH4ACOM_RCV"
+ #define PR_DEV_SH4A_RCV_S "30"
+ #define PR_DEV_SH4A_RCV (30)
+
+ #define TN_DEV_SH4A_MON "DEV_SH4ACOM_MON"
+ #define PR_DEV_SH4A_MON_S "30"
+ #define PR_DEV_SH4A_MON (30)
+
+#define MN_PS_COMMUSB "PS_CommUSB"
+#define PR_PS_COMMUSB_S "30"
+#define PR_PS_COMMUSB (30)
+
+ #define TN_COMMUSB_RCV "COMMUSB_RCV"
+ #define PR_COMMUSB_RCV_S "30"
+ #define PR_COMMUSB_RCV (30)
+
+ #define TN_COMMUSB_DIAG "COMMUSB_DIAG"
+ #define PR_COMMUSB_DIAG_S "30"
+ #define PR_COMMUSB_DIAG (30)
+
+#define MN_PS_CANGW_M "CANGW_M"
+#define PR_PS_CANGW_M_S PR_TSS_S
+#define PR_PS_CANGW_M PR_TSS
+
+ #define TN_CANGW_M_RCV "CANGW_M_RCV"
+ #define PR_CANGW_M_RCV_S PR_TSS_S
+ #define PR_CANGW_M_RCV PR_TSS
+
+ #define TN_CANGW_M_DIAG "CANGW_M_DIAG"
+ #define PR_CANGW_M_DIAG_S PR_TSS_S
+ #define PR_CANGW_M_DIAG PR_TSS
+
+#define MN_PS_CANGW_S "CANGW_S"
+#define PR_PS_CANGW_S_S PR_TSS_S
+#define PR_PS_CANGW_S PR_TSS
+
+ #define TN_CANGW_S_SND "CANGW_S_SND"
+ #define PR_CANGW_S_SND_S PR_TSS_S
+ #define PR_CANGW_S_SND PR_TSS
+
+ #define TN_CANGW_S_DIAG "CANGW_S_DIAG"
+ #define PR_CANGW_S_DIAG_S PR_TSS_S
+ #define PR_CANGW_S_DIAG PR_TSS
+
+#define MN_LANSERVER "LanServer"
+#define PR_LANSERVER_S "20"
+#define PR_LANSERVER (20)
+
+#define MN_PS_CDR "ps_cdr"
+#define PR_PS_CDR_S PR_TSS_S
+#define PR_PS_CDR PR_TSS
+
+ #define TN_PS_CDR_NBD "ps_cdr_nbd"
+ #define PR_PS_CDR_NBD_S PR_TSS_S
+ #define PR_PS_CDR_NBD PR_TSS
+
+ #define TN_PS_CDR_DOIT "ps_cdr_doit"
+ #define PR_PS_CDR_DOIT_S PR_TSS_S
+ #define PR_PS_CDR_DOIT PR_TSS
+
+ #define TN_PS_CDR_READ "ps_cdr_read"
+ #define PR_PS_CDR_READ_S PR_TSS_S
+ #define PR_PS_CDR_READ PR_TSS
+
+#define MN_POSITIONING "Positioning"
+#define PR_POSITIONING_S PR_TSS_S
+#define PR_POSITIONING PR_TSS
+
+ #define TN_POSITIONING_GPS_MAIN "POS_Main"
+ #define PR_POSITIONING_GPS_MAIN_S PR_TSS_S
+ #define PR_POSITIONING_GPS_MAIN PR_TSS
+
+ #define TN_POSITIONING_GPS_RECV "POS_Gps_Recv"
+ #define PR_POSITIONING_GPS_RECV_S PR_TSS_S
+ #define PR_POSITIONING_GPS_RECV PR_TSS
+
+ #define TN_POSITIONING_GPS "POS_Gps"
+ #define PR_POSITIONING_GPS_S PR_TSS_S
+ #define PR_POSITIONING_GPS PR_TSS
+
+ #define TN_POSITIONING_SENS "POS_Sens"
+ #define PR_POSITIONING_SENS_S PR_TSS_S
+ #define PR_POSITIONING_SENS PR_TSS
+
+ #define TN_POSITIONING_GPS_ROLOVR "POS_Gps_Rolovr"
+ #define PR_POSITIONING_GPS_ROLOVR_S PR_TSS_S
+ #define PR_POSITIONING_GPS_ROLOVR PR_TSS
+
+#define MN_CLOCK "clock"
+#define PR_CLOCK_S "20"
+#define PR_CLOCK (20)
+
+ #define TN_CLOCK_MNG "ClockMng"
+ #define PR_CLOCK_MNG_S "20"
+ #define PR_CLOCK_MNG (20)
+
+#define MN_VEHICLE "vehicle"
+#define PR_VEHICLE_S "20"
+#define PR_VEHICLE (20)
+
+ #define TN_VEHICLE_SENS "VehicleSens"
+ #define PR_VEHICLE_SENS_S "20"
+ #define PR_VEHICLE_SENS (20)
+
+ #define TN_LINE_SENS_DRV "LineSensDrv"
+ #define PR_LINE_SENS_DRV_S "20"
+ #define PR_LINE_SENS_DRV (20)
+
+#define MN_SS_POWERSERVICE "SS_PowerService"
+#define PR_SS_POWERSERVICE_S "30"
+#define PR_SS_POWERSERVICE (30)
+
+#define MN_SS_TASKMANAGER "SS_TaskManager"
+#define PR_SS_TASKMANAGER_S "20"
+#define PR_SS_TASKMANAGER (20)
+
+ #define TN_SS_TSKMTIMER "SS_TskmTimer"
+ #define PR_SS_TSKMTIMER_S "20"
+ #define PR_SS_TSKMTIMER (20)
+
+#define MN_SOUND "Sound"
+#define PR_SOUND_S "45"
+#define PR_SOUND (45)
+
+ #define TN_VG_SNDSRCMGR "VG_SNDSRCMGR"
+ #define PR_VG_SNDSRCMGR_S "40"
+ #define PR_VG_SNDSRCMGR (40)
+
+ #define TN_SND_INPUTCTRL "SND_INPUTCTRL"
+ #define PR_SND_INPUTCTRL_S "40"
+ #define PR_SND_INPUTCTRL (40)
+
+ #define TN_SND_DEVCTRL "SND_DEVCTRL"
+ #define PR_SND_DEVCTRL_S "40"
+ #define PR_SND_DEVCTRL (40)
+
+ #define TN_SND_VCETRFCTRL "SND_VCETRFCTRL"
+ #define PR_SND_VCETRFCTRL_S "45"
+ #define PR_SND_VCETRFCTRL (45)
+
+ #define TN_SND_VCETRFWRT1 "SND_VCETRFWRT1"
+ #define PR_SND_VCETRFWRT1_S "45"
+ #define PR_SND_VCETRFWRT1 (45)
+
+ #define TN_SND_VCETRFWRT2 "SND_VCETRFWRT2"
+ #define PR_SND_VCETRFWRT2_S "45"
+ #define PR_SND_VCETRFWRT2 (45)
+
+ #define TN_VG_SNDCTRL_BSCF "VG_SNDCTRL_BSCF"
+ #define PR_VG_SNDCTRL_BSCF_S "25"
+ #define PR_VG_SNDCTRL_BSCF (25)
+
+ #define TN_VG_SNDCTRL_BSCR "VG_SNDCTRL_BSCR"
+ #define PR_VG_SNDCTRL_BSCR_S "25"
+ #define PR_VG_SNDCTRL_BSCR (25)
+
+ #define TN_VG_SNDCTRL_ITRT "VG_SNDCTRL_ITRT"
+ #define PR_VG_SNDCTRL_ITRT_S "25"
+ #define PR_VG_SNDCTRL_ITRT (25)
+
+ #define TN_CVRS_OPRT_OUT_1 "CVRS_OPRT_OUT_1"
+ #define PR_CVRS_OPRT_OUT_1_S "45"
+ #define PR_CVRS_OPRT_OUT_1 (45)
+
+ #define TN_CVRS_OPRT_OUT_2 "CVRS_OPRT_OUT_2"
+ #define PR_CVRS_OPRT_OUT_2_S "45"
+ #define PR_CVRS_OPRT_OUT_2 (45)
+
+ #define TN_CVRS_OPRT_OUT_3 "CVRS_OPRT_OUT_3"
+ #define PR_CVRS_OPRT_OUT_3_S "45"
+ #define PR_CVRS_OPRT_OUT_3 (45)
+
+ #define TN_CVRS_OPRT_OUT_4 "CVRS_OPRT_OUT_4"
+ #define PR_CVRS_OPRT_OUT_4_S "45"
+ #define PR_CVRS_OPRT_OUT_4 (45)
+
+ #define TN_CVRS_OPRT_IN_1 "CVRS_OPRT_IN_1"
+ #define PR_CVRS_OPRT_IN_1_S "45"
+ #define PR_CVRS_OPRT_IN_1 (45)
+
+ #define TN_CVRS_OPRT_IN_2 "CVRS_OPRT_IN_2"
+ #define PR_CVRS_OPRT_IN_2_S "45"
+ #define PR_CVRS_OPRT_IN_2 (45)
+
+ #define TN_CVRS_OPRT_IN_3 "CVRS_OPRT_IN_3"
+ #define PR_CVRS_OPRT_IN_3_S "45"
+ #define PR_CVRS_OPRT_IN_3 (45)
+
+ #define TN_CVRS_OPRT_IN_4 "CVRS_OPRT_IN_4"
+ #define PR_CVRS_OPRT_IN_4_S "45"
+ #define PR_CVRS_OPRT_IN_4 (45)
+
+ #define TN_CVRS_OPRT_IN_5 "CVRS_OPRT_IN_5"
+ #define PR_CVRS_OPRT_IN_5_S "45"
+ #define PR_CVRS_OPRT_IN_5 (45)
+
+ #define TN_CVRS_OPRT_IN_6 "CVRS_OPRT_IN_6"
+ #define PR_CVRS_OPRT_IN_6_S "45"
+ #define PR_CVRS_OPRT_IN_6 (45)
+
+ #define TN_CVRS_OPRT_IN_7 "CVRS_OPRT_IN_7"
+ #define PR_CVRS_OPRT_IN_7_S "45"
+ #define PR_CVRS_OPRT_IN_7 (45)
+
+ #define TN_CVRS_OPRT_IN_8 "CVRS_OPRT_IN_8"
+ #define PR_CVRS_OPRT_IN_8_S "45"
+ #define PR_CVRS_OPRT_IN_8 (45)
+
+ #define TN_CVRS_OPRT_BS_I "CVRS_OPRT_BS_I"
+ #define PR_CVRS_OPRT_BS_I_S "45"
+ #define PR_CVRS_OPRT_BS_I (45)
+
+ #define TN_VR_NVR_RECO "VR_NVR_RECO"
+ #define PR_VR_NVR_RECO_S "20"
+ #define PR_VR_NVR_RECO (20)
+
+ #define TN_SND_ECNR "SND_ECNR"
+ #define PR_SND_ECNR_S "40"
+ #define PR_SND_ECNR (40)
+
+ #define TN_SNDAGENT_000 "SNDAGENT_000"
+ #define PR_SNDAGENT_000_S "45"
+ #define PR_SNDAGENT_000 (45)
+
+ #define TN_SNDAGENT_001 "SNDAGENT_001"
+ #define PR_SNDAGENT_001_S "45"
+ #define PR_SNDAGENT_001 (45)
+
+ #define TN_SNDAGENT_002 "SNDAGENT_002"
+ #define PR_SNDAGENT_002_S "45"
+ #define PR_SNDAGENT_002 (45)
+
+ #define TN_SNDAGENT_003 "SNDAGENT_003"
+ #define PR_SNDAGENT_003_S "45"
+ #define PR_SNDAGENT_003 (45)
+
+ #define TN_SNDAGENT_004 "SNDAGENT_004"
+ #define PR_SNDAGENT_004_S "45"
+ #define PR_SNDAGENT_004 (45)
+
+ #define TN_SNDAGENT_005 "SNDAGENT_005"
+ #define PR_SNDAGENT_005_S "45"
+ #define PR_SNDAGENT_005 (45)
+
+ #define TN_SNDAGENT_006 "SNDAGENT_006"
+ #define PR_SNDAGENT_006_S "45"
+ #define PR_SNDAGENT_006 (45)
+
+ #define TN_SNDAGENT_007 "SNDAGENT_007"
+ #define PR_SNDAGENT_007_S "45"
+ #define PR_SNDAGENT_007 (45)
+
+ #define TN_SNDAGENT_008 "SNDAGENT_008"
+ #define PR_SNDAGENT_008_S "45"
+ #define PR_SNDAGENT_008 (45)
+
+ #define TN_SNDAGENT_009 "SNDAGENT_009"
+ #define PR_SNDAGENT_009_S "45"
+ #define PR_SNDAGENT_009 (45)
+
+ #define TN_SNDAGENT_010 "SNDAGENT_010"
+ #define PR_SNDAGENT_010_S "45"
+ #define PR_SNDAGENT_010 (45)
+
+ #define TN_SNDAGENT_011 "SNDAGENT_011"
+ #define PR_SNDAGENT_011_S "45"
+ #define PR_SNDAGENT_011 (45)
+
+ #define TN_SNDAGENT_012 "SNDAGENT_012"
+ #define PR_SNDAGENT_012_S "45"
+ #define PR_SNDAGENT_012 (45)
+
+ #define TN_SNDAGENT_013 "SNDAGENT_013"
+ #define PR_SNDAGENT_013_S "45"
+ #define PR_SNDAGENT_013 (45)
+
+ #define TN_SNDAGENT_014 "SNDAGENT_014"
+ #define PR_SNDAGENT_014_S "45"
+ #define PR_SNDAGENT_014 (45)
+
+ #define TN_SNDAGENT_015 "SNDAGENT_015"
+ #define PR_SNDAGENT_015_S "45"
+ #define PR_SNDAGENT_015 (45)
+
+ #define TN_SNDAGENT_016 "SNDAGENT_016"
+ #define PR_SNDAGENT_016_S "45"
+ #define PR_SNDAGENT_016 (45)
+
+ #define TN_SNDAGENT_017 "SNDAGENT_017"
+ #define PR_SNDAGENT_017_S "45"
+ #define PR_SNDAGENT_017 (45)
+
+ #define TN_SNDAGENT_018 "SNDAGENT_018"
+ #define PR_SNDAGENT_018_S "45"
+ #define PR_SNDAGENT_018 (45)
+
+ #define TN_SNDAGENT_019 "SNDAGENT_019"
+ #define PR_SNDAGENT_019_S "45"
+ #define PR_SNDAGENT_019 (45)
+
+ #define TN_SNDAGENT_020 "SNDAGENT_020"
+ #define PR_SNDAGENT_020_S "45"
+ #define PR_SNDAGENT_020 (45)
+
+ #define TN_SNDAGENT_021 "SNDAGENT_021"
+ #define PR_SNDAGENT_021_S "45"
+ #define PR_SNDAGENT_021 (45)
+
+ #define TN_SNDAGENT_022 "SNDAGENT_022"
+ #define PR_SNDAGENT_022_S "45"
+ #define PR_SNDAGENT_022 (45)
+
+ #define TN_SNDAGENT_023 "SNDAGENT_023"
+ #define PR_SNDAGENT_023_S "45"
+ #define PR_SNDAGENT_023 (45)
+
+ #define TN_SNDAGENT_024 "SNDAGENT_024"
+ #define PR_SNDAGENT_024_S "45"
+ #define PR_SNDAGENT_024 (45)
+
+ #define TN_SNDAGENT_025 "SNDAGENT_025"
+ #define PR_SNDAGENT_025_S "45"
+ #define PR_SNDAGENT_025 (45)
+
+#define MN_SS_RESOURCEMGR "SS_ResourceMgr"
+#define PR_SS_RESOURCEMGR_S "49"
+#define PR_SS_RESOURCEMGR (49)
+
+ #define TN_RESOURCEHWDT "ResourceHWDT"
+ #define PR_RESOURCEHWDT_S "1"
+ #define PR_RESOURCEHWDT (1)
+
+#define MN_AS_AUDIOMANAGER "AS_AudioManager"
+#define PR_AS_AUDIOMANAGER_S PR_TSS_S
+#define PR_AS_AUDIOMANAGER PR_TSS
+
+ #define TN_AS_SOUNDBEEP "AS_SoundBeep"
+ #define PR_AS_SOUNDBEEP_S PR_TSS_S
+ #define PR_AS_SOUNDBEEP PR_TSS
+
+#define MN_GRAPHICS "Graphics"
+#define PR_GRAPHICS_S "4"
+#define PR_GRAPHICS (4)
+
+ #define TN_GR_MAIN_CTRL "Graphics_main"
+ #define PR_GR_MAIN_CTRL_S PR_TSS_S
+ #define PR_GR_MAIN_CTRL PR_TSS
+
+ #define TN_GR_SEQ_CTRL "Graphics_seq"
+ #define PR_GR_SEQ_CTRL_S PR_TSS_S
+ #define PR_GR_SEQ_CTRL PR_TSS
+
+ #define TN_GR_DEV_RCV_CTRL "Graphics_rcv"
+ #define PR_GR_DEV_RCV_CTRL_S PR_TSS_S
+ #define PR_GR_DEV_RCV_CTRL PR_TSS
+
+ #define TN_GR_VCAP1_CTRL "Graphics_cap1"
+ #define PR_GR_VCAP1_CTRL_S "4"
+ #define PR_GR_VCAP1_CTRL (4)
+
+ #define TN_GR_VCAP2_CTRL "Graphics_cap2"
+ #define PR_GR_VCAP2_CTRL_S "4"
+ #define PR_GR_VCAP2_CTRL (4)
+
+#define MN_VUPSERVICE "vupservice"
+#define PR_VUPSERVICE_S PR_TSS_S
+#define PR_VUPSERVICE PR_TSS
+
+#define MN_SS_UPDATESERVICE "UpdateService"
+#define PR_SS_UPDATESERVICE_S PR_TSS_S
+#define PR_SS_UPDATESERVICE PR_TSS
+
+ #define TN_UPSERVICE_VERI "t_update_veri"
+ #define PR_UPSERVICE_VERI_S PR_TSS_S
+ #define PR_UPSERVICE_VERI PR_TSS
+
+#define MN_NW_MICSERVICE "NW_MicService"
+#define PR_NW_MICSERVICE_S PR_TSS_S
+#define PR_NW_MICSERVICE PR_TSS
+
+#define MN_NS_LOCKMGR "LockMgr"
+#define PR_NS_LOCKMGR_S PR_TSS_S
+#define PR_NS_LOCKMGR PR_TSS
+
+#define MN_PS_SWITCHHANDLER "SwitchHandler"
+#define PR_PS_SWITCHHANDLER_S "30"
+#define PR_PS_SWITCHHANDLER (30)
+
+#define MN_SS_WINSYS "SS_WinSys"
+#define PR_SS_WINSYS_S "5"
+#define PR_SS_WINSYS 5
+
+#define MN_MODEMANAGER "modemanager"
+#define PR_MODEMANAGER_S PR_TSS_S
+#define PR_MODEMANAGER PR_TSS
+
+#define MN_BTSTACKMAIN "btstackmain"
+#define PR_BTSTACKMAIN_S PR_TSS_S
+#define PR_BTSTACKMAIN PR_TSS
+
+#define MN_MEDIASERVICE "MediaService"
+#define PR_MEDIASERVICE_S PR_TSS_S
+#define PR_MEDIASERVICE PR_TSS
+
+// REPRO START
+#define MN_REPROSERVICE "ReproService"
+#define PR_REPROSERVICE_S PR_TSS_S
+#define PR_REPROSERVICE PR_TSS
+
+ #define TN_REPROSEQUENCER "RPRS_Sequencer"
+ #define PR_REPROSEQUENCER_S PR_TSS_S
+ #define PR_REPROSEQUENCER PR_TSS
+
+ #define TN_REPROCTRL "RPRS_Control"
+ #define PR_REPROCTRL_S PR_TSS_S
+ #define PR_REPROCTRL PR_TSS
+
+ #define TN_REPROCENTERCOMM "RPRS_CenterComm"
+ #define PR_REPROCENTERCOMM_S PR_TSS_S
+ #define PR_REPROCENTERCOMM PR_TSS
+
+ #define TN_REPROUNITCOMM "RPRS_UnitComm"
+ #define PR_REPROUNITCOMM_S PR_TSS_S
+ #define PR_REPROUNITCOMM PR_TSS
+
+ #define TN_REPROWEBDAVMGR "RPRS_WebDAVMgr"
+ #define PR_REPROWEBDAVMGR_S PR_TSS_S
+ #define PR_REPROWEBDAVMGR PR_TSS
+
+#define MN_REPROAENDTEST "Repro_Testpro_Sender"
+#define PR_REPROAENDTEST_S PR_TSS_S
+#define PR_REPROAENDTEST PR_TSS
+
+ #define TN_REPROAENDTESTTN "Repro_TestproT"
+ #define PR_REPROAENDTESTTN_S PR_TSS_S
+ #define PR_REPROAENDTESTTN PR_TSS
+
+#define MN_REPROBACKVUP "BackVupCtrl"
+#define PR_REPROBACKVUP_S PR_TSS_S
+#define PR_REPROBACKVUP PR_TSS
+
+#define MN_REPRODEVELOP "DevReproService"
+#define PR_REPRODEVELOP_S PR_TSS_S
+#define PR_REPRODEVELOP PR_TSS
+// REPRO END
+
+ #define TN_MED_MMCOM_PLAY "mmcom_play"
+ #define PR_MED_MMCOM_PLAY_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAY PR_TSS
+
+ #define TN_MED_MMCOM_MEDIA "mmcom_media"
+ #define PR_MED_MMCOM_MEDIA_S PR_TSS_S
+ #define PR_MED_MMCOM_MEDIA PR_TSS
+
+ #define TN_MED_MMCOM_DB "mmcom_db"
+ #define PR_MED_MMCOM_DB_S PR_TSS_S
+ #define PR_MED_MMCOM_DB PR_TSS
+
+ #define TN_MED_MMCOM_LIST "mmcom_list"
+ #define PR_MED_MMCOM_LIST_S PR_TSS_S
+ #define PR_MED_MMCOM_LIST PR_TSS
+
+ #define TN_MED_MMCOM_DBUSB "mmcom_dbusb"
+ #define PR_MED_MMCOM_DBUSB_S PR_TSS_S
+ #define PR_MED_MMCOM_DBUSB PR_TSS
+
+ #define TN_MED_MMCOM_DBSD "mmcom_dbsd"
+ #define PR_MED_MMCOM_DBSD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBSD PR_TSS
+
+ #define TN_MED_MMCOM_DBCD "mmcom_dbcd"
+ #define PR_MED_MMCOM_DBCD_S PR_TSS_S
+ #define PR_MED_MMCOM_DBCD PR_TSS
+
+ #define TN_MED_MMCOM_PLAYRCV "mmcom_playrcv"
+ #define PR_MED_MMCOM_PLAYRCV_S PR_TSS_S
+ #define PR_MED_MMCOM_PLAYRCV PR_TSS
+
+ #define TN_MED_RIPCOM_MNG "MngRipComm"
+ #define PR_MED_RIPCOM_MNG_S PR_TSS_S
+ #define PR_MED_RIPCOM_MNG PR_TSS
+
+ #define TN_MED_RIPCOM_EXE01 "ExeRipComm01"
+ #define PR_MED_RIPCOM_EXE01_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE01 PR_TSS
+
+ #define TN_MED_RIPCOM_EXE02 "ExeRipComm02"
+ #define PR_MED_RIPCOM_EXE02_S PR_TSS_S
+ #define PR_MED_RIPCOM_EXE02 PR_TSS
+
+ #define TN_MED_DISCCOM_MAIN "disccom_main"
+ #define PR_MED_DISCCOM_MAIN_S PR_TSS_S
+ #define PR_MED_DISCCOM_MAIN PR_TSS
+
+ #define TN_MED_DISCCOM_DB "disccom_db"
+ #define PR_MED_DISCCOM_DB_S PR_TSS_S
+ #define PR_MED_DISCCOM_DB PR_TSS
+
+#define MN_PLAYBACKSERVICE "PlaybackService"
+#define PR_PLAYBACKSERVICE_S PR_TSS_S
+#define PR_PLAYBACKSERVICE PR_TSS
+
+ #define TN_PLAYSRV_AUDIO "playsrv_audio"
+ #define PR_PLAYSRV_AUDIO_S PR_TSS_S
+ #define PR_PLAYSRV_AUDIO PR_TSS
+
+ #define TN_PLAYSRV_RIP "playsrv_rip"
+ #define PR_PLAYSRV_RIP_S PR_TSS_S
+ #define PR_PLAYSRV_RIP PR_TSS
+
+ #define TN_PLAYSRV_PLAY "playsrv_play"
+ #define PR_PLAYSRV_PLAY_S PR_TSS_S
+ #define PR_PLAYSRV_PLAY PR_TSS
+
+ #define TN_PLAYSRV_DISC "playsrv_disc"
+ #define PR_PLAYSRV_DISC_S PR_TSS_S
+ #define PR_PLAYSRV_DISC PR_TSS
+
+ #define TN_PLAYSRV_ARTWORK "playsrv_artwork"
+ #define PR_PLAYSRV_ARTWORK_S PR_TSS_S
+ #define PR_PLAYSRV_ARTWORK PR_TSS
+
+#define MN_DISCSERVICE "DiscService"
+#define PR_DISCSERVICE_S PR_TSS_S
+#define PR_DISCSERVICE PR_TSS
+
+#define MN_RADIOSERVICE "RadioService"
+#define PR_RADIOSERVICE_S PR_TSS_S
+#define PR_RADIOSERVICE PR_TSS
+
+#define MN_RADIOHDARBITER "RadioHDArbiter"
+#define PR_RADIOHDARBITER_S "20"
+#define PR_RADIOHDARBITER (20)
+
+#define MN_HRDS_MANAGER "hrds_manager"
+#define PR_HRDS_MANAGER_S PR_TSS_S
+#define PR_HRDS_MANAGER PR_TSS
+
+ #define TN_HRDS_HDMNG "hrds_hdmng"
+ #define PR_HRDS_HDMNG_S PR_TSS_S
+ #define PR_HRDS_HDMNG PR_TSS
+
+ #define TN_HRDS_HDDEC "hrds_hddec"
+ #define PR_HRDS_HDDEC_S PR_TSS_S
+ #define PR_HRDS_HDDEC PR_TSS
+
+ #define TN_HRDS_WEBMNG "hrds_webmng"
+ #define PR_HRDS_WEBMNG_S PR_TSS_S
+ #define PR_HRDS_WEBMNG PR_TSS
+
+ #define TN_HRDS_WEBCOM "hrds_webcom"
+ #define PR_HRDS_WEBCOM_S PR_TSS_S
+ #define PR_HRDS_WEBCOM PR_TSS
+
+#define MN_BT_CONNECTIONSERVICE "BT_CnctSrv"
+#define PR_BT_CONNECTIONSERVICE_S PR_TSS_S
+#define PR_BT_CONNECTIONSERVICE PR_TSS
+
+#define MN_BT_PHONESERVICE "BT_PhoneSrv"
+#define PR_BT_PHONESERVICE_S PR_TSS_S
+#define PR_BT_PHONESERVICE PR_TSS
+
+#define MN_BT_PHONEBOOKSERVICE "BT_PbkSrv"
+#define PR_BT_PHONEBOOKSERVICE_S PR_TSS_S
+#define PR_BT_PHONEBOOKSERVICE PR_TSS
+
+#define MN_BT_MESSAGINGSERVICE "BT_MsgSrv"
+#define PR_BT_MESSAGINGSERVICE_S PR_TSS_S
+#define PR_BT_MESSAGINGSERVICE PR_TSS
+
+#define MN_BT_BLLSERVICE "TEL_BLLSrv"
+#define PR_BT_BLLSERVICE_S PR_TSS_S
+#define PR_BT_BLLSERVICE PR_TSS
+
+#define MN_BT_DCMPHONESERVICE "DCM_PhoneSrv"
+#define PR_BT_DCMPHONESERVICE_S PR_TSS_S
+#define PR_BT_DCMPHONESERVICE PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ1 "HFPMultiQ1"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ1 PR_TSS
+
+ #define TN_BT_CONSRV_HFPMULTIQ2 "HFPMultiQ2"
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2_S PR_TSS_S
+ #define PR_TN_BT_CONSRV_HFPMULTIQ2 PR_TSS
+
+ #define TN_BT_PBKSRV_DATABASE "BTPB_Database"
+ #define PR_TN_BT_PBKSRV_DATABASE_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_DATABASE PR_TSS
+
+ #define TN_BT_PBKSRV_LOCALPBINST "LocalPBINST"
+ #define PR_TN_BT_PBKSRV_LOCALPBINST_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_LOCALPBINST PR_TSS
+
+ #define TN_BT_PBKSRV_RESOLVENAME "ResolveName"
+ #define PR_TN_BT_PBKSRV_RESOLVENAME_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_RESOLVENAME PR_TSS
+
+ #define TN_BT_PBKSRV_PBAPMULTIQ1 "PBAPMultiQ1"
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_PBAPMULTIQ1 PR_TSS
+
+ #define TN_BT_PBKSRV_OPPMULTI "OPPMulti"
+ #define PR_TN_BT_PBKSRV_OPPMULTI_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_OPPMULTI PR_TSS
+
+ #define TN_BT_PBKSRV_VCARDPARSER "VCardParser"
+ #define PR_TN_BT_PBKSRV_VCARDPARSER_S PR_TSS_S
+ #define PR_TN_BT_PBKSRV_VCARDPARSER PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD0 "MsgCntrlThread0"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0 PR_TSS
+
+ #define TN_BT_MSGSRV_MSGCNTRLTHREAD1 "MsgCntrlThread1"
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1 PR_TSS
+
+ #define TN_BT_MSGSRV_MAPMULTI "MapMulti"
+ #define PR_TN_BT_MSGSRV_MAPMULTI_S PR_TSS_S
+ #define PR_TN_BT_MSGSRV_MAPMULTI PR_TSS
+
+#define MN_DTVSERVICE "DtvService"
+#define PR_DTVSERVICE_S PR_TSS_S
+#define PR_DTVSERVICE PR_TSS
+
+ #define TN_DTVTNC_TX "dtvtnc_tx"
+ #define PR_DTVTNC_TX_S PR_TSS_S
+ #define PR_DTVTNC_TX PR_TSS
+
+ #define TN_DTVTNC_RCV "dtvtnc_rcv"
+ #define PR_DTVTNC_RCV_S PR_TSS_S
+ #define PR_DTVTNC_RCV PR_TSS
+
+ #define TN_DTVTNC_TIMER "dtvtnc_timer"
+ #define PR_DTVTNC_TIMER_S PR_TSS_S
+ #define PR_DTVTNC_TIMER PR_TSS
+
+ #define TN_DTVTNC_CTL "dtvtnc_ctl"
+ #define PR_DTVTNC_CTL_S PR_TSS_S
+ #define PR_DTVTNC_CTL PR_TSS
+
+#define MN_DTVVUPSERVICE "DtvVupService"
+#define PR_DTVVUPSERVICE_S PR_TSS_S
+#define PR_DTVVUPSERVICE PR_TSS
+
+#define MN_SETTINGSERVICE "SettingService"
+#define PR_SETTINGSERVICE_S PR_TSS_S
+#define PR_SETTINGSERVICE PR_TSS
+
+#define MN_INFOSETTINGSRV "InfoSettingSrv"
+#define PR_INFOSETTINGSRV_S PR_TSS_S
+#define PR_INFOSETTINGSRV PR_TSS
+
+ #define TN_INFS_UIC "infs_uic"
+ #define PR_INFS_UIC_S PR_TSS_S
+ #define PR_INFS_UIC PR_TSS
+
+#define MN_DELPERSONALSRV "DelPersonalSrv"
+#define PR_DELPERSONALSRV_S PR_TSS_S
+#define PR_DELPERSONALSRV PR_TSS
+
+#define MN_MENUSERVICE "MenuService"
+#define PR_MENUSERVICE_S PR_TSS_S
+#define PR_MENUSERVICE PR_TSS
+
+#define MN_NAVIPROXY "NaviProxy"
+#define PR_NAVIPROXY_S PR_TSS_S
+#define PR_NAVIPROXY PR_TSS
+
+#define MN_AWBPROXY "AwbProxy"
+#define PR_AWBPROXY_S PR_TSS_S
+#define PR_AWBPROXY PR_TSS
+
+#define MN_TFFPROXY "TFFProxy"
+#define PR_TFFPROXY_S PR_TSS_S
+#define PR_TFFPROXY PR_TSS
+
+#define MN_TFFPROXYSLAVE "TFFProxySlave"
+#define PR_TFFPROXYSLAVE_S PR_TSS_S
+#define PR_TFFPROXYSLAVE PR_TSS
+
+#define MN_AWNPRIMARY "AwnPrimary"
+#define PR_AWNPRIMARY_S PR_TSS_S
+#define PR_AWNPRIMARY PR_TSS
+
+#define MN_AWBPRIMARY "AwbPrimary"
+#define PR_AWBPRIMARY_S PR_TSS_S
+#define PR_AWBPRIMARY PR_TSS
+
+#define MN_AWMPRIMARY "AwmPrimary"
+#define PR_AWMPRIMARY_S PR_TSS_S
+#define PR_AWMPRIMARY PR_TSS
+
+#define MN_AWTPRIMARY "AwtPrimary"
+#define PR_AWTPRIMARY_S PR_TSS_S
+#define PR_AWTPRIMARY PR_TSS
+
+#define MN_MISINKSERVICE "MisinkService"
+#define PR_MISINKSERVICE_S PR_TSS_S
+#define PR_MISINKSERVICE PR_TSS
+
+#define MN_TEXTCONVERTER "TextConverter"
+#define PR_TEXTCONVERTER_S PR_TSS_S
+#define PR_TEXTCONVERTER PR_TSS
+
+#define MN_HANDWRITING "HandWriting"
+#define PR_HANDWRITING_S PR_TSS_S
+#define PR_HANDWRITING PR_TSS
+
+#define MN_EXTUNITAUTH_D "EXTUNITAUTH_D"
+#define PR_EXTUNITAUTH_D_S "29"
+#define PR_EXTUNITAUTH_D 29
+
+ #define TN_VPSVC__CWORD84_ "VPSVC_D"
+ #define PR_VPSVC__CWORD84__S PR_TSS_S
+ #define PR_VPSVC__CWORD84_ PR_TSS
+
+#define MN_PROXYSERVICE "ProxyService"
+#define PR_PROXYSERVICE_S PR_TSS_S
+#define PR_PROXYSERVICE PR_TSS
+
+#define MN_FUELSERVICE "VS_FUCSrv"
+#define PR_FUELSERVICE_S PR_TSS_S
+#define PR_FUELSERVICE PR_TSS
+
+#define MN_ENERGYSERVICE "VS_ENMSrv"
+#define PR_ENERGYSERVICE_S PR_TSS_S
+#define PR_ENERGYSERVICE PR_TSS
+
+#define MN_CUSTOMIZESERVICE "VS_VSDSrv"
+#define PR_CUSTOMIZESERVICE_S PR_TSS_S
+#define PR_CUSTOMIZESERVICE PR_TSS
+
+#define MN_DMSSERVICE "VS_DMSSrv"
+#define PR_DMSSERVICE_S PR_TSS_S
+#define PR_DMSSERVICE PR_TSS
+
+#define MN_AIRCONSERVICE "VS_ACNSrv"
+#define PR_AIRCONSERVICE_S PR_TSS_S
+#define PR_AIRCONSERVICE PR_TSS
+
+#define MN_SEATSERVICE "VS_NMSSrv"
+#define PR_SEATSERVICE_S PR_TSS_S
+#define PR_SEATSERVICE PR_TSS
+
+#define MN_CAMERASERVICE "VS_CMRSrv"
+#define PR_CAMERASERVICE_S PR_TSS_S
+#define PR_CAMERASERVICE PR_TSS
+
+ #define TN_CAMERAQUICKRVC "QuickRVCThread"
+ #define PR_CAMERAQUICKRVC_S PR_TSS_S
+ #define PR_CAMERAQUICKRVC PR_TSS
+
+#define MN_METSERVICE "VS_METSrv"
+#define PR_METSERVICE_S PR_TSS_S
+#define PR_METSERVICE PR_TSS
+
+#define MN_TMCSERVICE "VS_TMCSrv"
+#define PR_TMCSERVICE_S PR_TSS_S
+#define PR_TMCSERVICE PR_TSS
+
+#define MN_DASSERVICE "VS_DASSrv"
+#define PR_DASSERVICE_S PR_TSS_S
+#define PR_DASSERVICE PR_TSS
+
+#define MN_EXTUNITAUTH_M "EXTUNITAUTH_M"
+#define PR_EXTUNITAUTH_M_S "29"
+#define PR_EXTUNITAUTH_M 29
+
+#define MN_DUMMYREAD "DummyRead"
+#define PR_DUMMYREAD_S PR_TSS_S
+#define PR_DUMMYREAD PR_TSS
+
+#define MN_SSTSERVICE "storage_access"
+#define PR_SSTSERVICE_S PR_TSS_S
+#define PR_SSTSERVICE PR_TSS
+
+#define MN_CCSAUDITD "ccs-auditd"
+#define PR_CCSAUDITD_S PR_TSS_S
+#define PR_CCSAUDITD PR_TSS
+
+//exec from task manager
+#define MN_ACTIVITYMANAGER "ActivityManager"
+#define PR_ACTIVITYMANAGER_S PR_TSS_S
+#define PR_ACTIVITYMANAGER PR_TSS
+
+#define MN_RESIDENT_SVC "RESIDENT_SVC"
+#define PR_RESIDENT_SVC_S PR_TSS_S
+#define PR_RESIDENT_SVC PR_TSS
+
+#define MN_TRANSIENT_SVC "TRANSIENT_SVC"
+#define PR_TRANSIENT_SVC_S PR_TSS_S
+#define PR_TRANSIENT_SVC PR_TSS
+
+#define MN_WLANSERVICE "wlan_ctrl_0700"
+#define PR_WLANSERVICE_S PR_TSS_S
+#define PR_WLANSERVICE PR_TSS
+
+#define MN_WLANEVTTHR "WlanEvtThr"
+#define PR_WLANEVTTHR_S PR_TSS_S
+#define PR_WLANEVTTHR PR_TSS
+
+#define MN_WLANMIDDLESERVICE "WlanMiddle"
+#define PR_WLANMIDDLESERVICE_S PR_TSS_S
+#define PR_WLANMIDDLESERVICE PR_TSS
+
+ #define TN_WLANMIDDLESERVICE0 "WM_MsgCtrlTh0"
+ #define PR_WLANMIDDLESERVICE0_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE0 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE1 "WM_MsgCtrlTh1"
+ #define PR_WLANMIDDLESERVICE1_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE1 PR_TSS
+
+ #define TN_WLANMIDDLESERVICE2 "WM_MsgCtrlTh2"
+ #define PR_WLANMIDDLESERVICE2_S PR_TSS_S
+ #define PR_WLANMIDDLESERVICE2 PR_TSS
+
+#define MN_WLANSERVICE2 "wlan_ctrl_0701"
+#define PR_WLANSERVICE2_S PR_TSS_S
+#define PR_WLANSERVICE2 PR_TSS
+
+#define MN_WLANEVTTHR2 "WlanEvtThr2"
+#define PR_WLANEVTTHR2_S PR_TSS_S
+#define PR_WLANEVTTHR2 PR_TSS
+
+//exec from task manager, Test for vup
+#define MN_PS__CWORD52_VUP "_CWORD52_vup"
+#define PR_PS__CWORD52_VUP_S PR_TSS_S
+#define PR_PS__CWORD52_VUP PR_TSS
+
+#define MN_PS_SYSVUP "sysvup"
+#define PR_PS_SYSVUP_S PR_TSS_S
+#define PR_PS_SYSVUP PR_TSS
+
+#define MN_SS_ROOTFSVUP "rootfsvup"
+#define PR_SS_ROOTFSVUP_S PR_TSS_S
+#define PR_SS_ROOTFSVUP PR_TSS
+
+#define MN_SS_VUPPROGUI "vupprogressui"
+#define PR_SS_VUPPROGUI_S PR_TSS_S
+#define PR_SS_VUPPROGUI PR_TSS
+
+#define MN_SS_NORVUP "norvup"
+#define PR_SS_NORVUP_S PR_TSS_S
+#define PR_SS_NORVUP PR_TSS
+
+// OUTER_UPDATE START
+#define MN_XMVUPSERVICE "radio_xm_update"
+#define PR_XMVUPSERVICE_S PR_TSS_S
+#define PR_XMVUPSERVICE PR_TSS
+// OUTER_UPDATE END
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+// NON-resident, exec from task manager, Repro update
+#define MN_PS_SYSUPDATE "sysupdate"
+#define PR_PS_SYSUPDATE_S PR_TSS_S
+#define PR_PS_SYSUPDATE PR_TSS
+
+#define MN_SS_NANDUPDATE "nandupdate"
+#define PR_SS_NANDUPDATE_S PR_TSS_S
+#define PR_SS_NANDUPDATE PR_TSS
+
+ #define TN_NANDUPDATE_CLD "t_nandcld"
+ #define PR_NANDUPDATE_CLD_S PR_TSS_S
+ #define PR_NANDUPDATE_CLD PR_TSS
+
+#define MN_BTPHONESRV "BT_PhoneSrv"
+#define PR_BTPHONESRV_S PR_TSS_S
+#define PR_BTPHONESRV PR_TSS
+
+#define MN_BTPBKSRV "BT_PbkSrv"
+#define PR_BTPBKSRV_S PR_TSS_S
+#define PR_BTPBKSRV PR_TSS
+
+#define MN_BTMSGSRV "BT_MsgSrv"
+#define PR_BTMSGSRV_S PR_TSS_S
+#define PR_BTMSGSRV PR_TSS
+
+//exec from diag
+#define MN_DIAGSERVICE "DiagService"
+#define PR_DIAGSERVICE_S PR_TSS_S
+#define PR_DIAGSERVICE PR_TSS
+
+#define MN_DIAGWORKERTSK "diagworker_tsk"
+#define PR_DIAGWORKERTSK_S PR_TSS_S
+#define PR_DIAGWORKERTSK PR_TSS
+
+#define MN_DIAGTSK "diag_tsk"
+#define PR_DIAGTSK_S PR_TSS_S
+#define PR_DIAGTSK PR_TSS
+
+#define MN_DIAGMCTSK "diagmc_tsk"
+#define PR_DIAGMCTSK_S PR_TSS_S
+#define PR_DIAGMCTSK PR_TSS
+
+#define MN_DIAGUTCOL "diagutCol_tsk"
+#define PR_DIAGUTCOL_S PR_TSS_S
+#define PR_DIAGUTCOL PR_TSS
+
+#define MN_DIAGUTUPD "diagutUpd_tsk"
+#define PR_DIAGUTUPD_S PR_TSS_S
+#define PR_DIAGUTUPD PR_TSS
+
+//exec from Connectivity for _CWORD57_
+#define MN__CWORD57_UTILSERVICE "_CWORD57_UtilService"
+#define PR__CWORD57_UTILSERVICE_S PR_TSS_S
+#define PR__CWORD57_UTILSERVICE PR_TSS
+
+ #define TN_CON_IPUT_DETECT "iputsrv_detect"
+ #define PR_CON_IPUT_DETECT_S PR_TSS_S
+ #define PR_CON_IPUT_DETECT PR_TSS
+
+ #define TN_CON_IPUT_AUTH "iputsrv_auth"
+ #define PR_CON_IPUT_AUTH_S PR_TSS_S
+ #define PR_CON_IPUT_AUTH PR_TSS
+
+ #define TN_CON_IPUT_SERIAL "iputsrv_serial"
+ #define PR_CON_IPUT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPUT_SERIAL PR_TSS
+
+ #define TN_CON_IPUT_USB_1 "iputsrv_usb1"
+ #define PR_CON_IPUT_USB_1_S PR_TSS_S
+ #define PR_CON_IPUT_USB_1 PR_TSS
+
+ #define TN_CON_IPUT_USB_2 "iputsrv_usb2"
+ #define PR_CON_IPUT_USB_2_S PR_TSS_S
+ #define PR_CON_IPUT_USB_2 PR_TSS
+
+ #define TN_CON_IPUT_SPP "iputsrv_spp"
+ #define PR_CON_IPUT_SPP_S PR_TSS_S
+ #define PR_CON_IPUT_SPP PR_TSS
+
+#define MN__CWORD57_DTSERVICE "_CWORD57_DTService"
+#define PR__CWORD57_DTSERVICE_S PR_TSS_S
+#define PR__CWORD57_DTSERVICE PR_TSS
+
+ #define TN_CON_IPDT_SERIAL "ipdtsrv_serial"
+ #define PR_CON_IPDT_SERIAL_S PR_TSS_S
+ #define PR_CON_IPDT_SERIAL PR_TSS
+
+ #define TN_CON_IPDT_USB_1 "ipdtsrv_usb1"
+ #define PR_CON_IPDT_USB_1_S PR_TSS_S
+ #define PR_CON_IPDT_USB_1 PR_TSS
+
+ #define TN_CON_IPDT_USB_2 "ipdtsrv_usb2"
+ #define PR_CON_IPDT_USB_2_S PR_TSS_S
+ #define PR_CON_IPDT_USB_2 PR_TSS
+
+ #define TN_CON_IPDT_SPP "ipdtsrv_spp"
+ #define PR_CON_IPDT_SPP_S PR_TSS_S
+ #define PR_CON_IPDT_SPP PR_TSS
+
+#define MN_WEBDAVMGR "webdavmgr"
+#define PR_WEBDAVMGR_S PR_TSS_S
+#define PR_WEBDAVMGR PR_TSS
+
+#define MN_DISPLAYSERVICE "DisplayService"
+#define PR_DISPLAYSERVICE_S PR_TSS_S
+#define PR_DISPLAYSERVICE PR_TSS
+
+#define MN_ENFORMSERVICE "EnformService"
+#define PR_ENFORMSERVICE_S PR_TSS_S
+#define PR_ENFORMSERVICE PR_TSS
+
+#define MN_CONNUTIL "ConnUtil"
+#define PR_CONNUTIL_S PR_TSS_S
+#define PR_CONNUTIL PR_TSS
+
+#define MN_CONNUTILSLAVE "ConnUtilSlave"
+#define PR_CONNUTILSLAVE_S PR_TSS_S
+#define PR_CONNUTILSLAVE PR_TSS
+
+#define MN_CONNMGR "ConnMgr"
+#define PR_CONNMGR_S PR_TSS_S
+#define PR_CONNMGR PR_TSS
+
+#define MN_SERVICEFLAGMGR "ServiceFlagMgr"
+#define PR_SERVICEFLAGMGR_S PR_TSS_S
+#define PR_SERVICEFLAGMGR PR_TSS
+
+//exec from VR
+#define MN_VRMANAGER "vrmanager"
+#define PR_VRMANAGER_S PR_TSS_S
+#define PR_VRMANAGER PR_TSS
+
+ #define TN_VR_WORKER "VrWorkerThread"
+ #define PR_VR_WORKER_S PR_TSS_S
+ #define PR_VR_WORKER PR_TSS
+
+ #define TN_VBT_PROPDISPATCH "PropDispatchThread"
+ #define PR_VBT_PROPDISPATCH_S PR_TSS_S
+ #define PR_VBT_PROPDISPATCH PR_TSS
+
+ #define TN_VBT_PROPRESPONSE "PropResponseThread"
+ #define PR_VBT_PROPRESPONSE_S PR_TSS_S
+ #define PR_VBT_PROPRESPONSE PR_TSS
+
+ #define TN_VBT_PROPAUDIOPLAY "PropAudioPlayThread"
+ #define PR_VBT_PROPAUDIOPLAY_S PR_TSS_S
+ #define PR_VBT_PROPAUDIOPLAY PR_TSS
+
+ #define TN_VBT_PROPAUDIORECORD "PropAudioRecordThread"
+ #define PR_VBT_PROPAUDIORECORD_S PR_TSS_S
+ #define PR_VBT_PROPAUDIORECORD PR_TSS
+
+ #define TN_VBT_MAINTHREADPRIO "MainThreadPriority"
+ #define PR_VBT_MAINTHREADPRIO_S PR_TSS_S
+ #define PR_VBT_MAINTHREADPRIO PR_TSS
+
+ #define TN_VBT_ASRMANAGERGRAMMAR "AsrManagerGrammarGenerationThread"
+ #define PR_VBT_ASRMANAGERGRAMMAR_S PR_TSS_S
+ #define PR_VBT_ASRMANAGERGRAMMAR PR_TSS
+
+ #define TN_VBT_ASRVOCONRECO "AsrVoconRecoProcessThread"
+ #define PR_VBT_ASRVOCONRECO_S PR_TSS_S
+ #define PR_VBT_ASRVOCONRECO PR_TSS
+
+ #define TN_VBT_BROADCASTREAD "BroadCastReadThread"
+ #define PR_VBT_BROADCASTREAD_S PR_TSS_S
+ #define PR_VBT_BROADCASTREAD PR_TSS
+
+ #define TN_VBT_FILEAGGREGATOR "FileAggregatorDecompressThread"
+ #define PR_VBT_FILEAGGREGATOR_S PR_TSS_S
+ #define PR_VBT_FILEAGGREGATOR PR_TSS
+
+ #define TN_VBT_HTTPCURLREQUEST "HttpCurlRequestThread"
+ #define PR_VBT_HTTPCURLREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPCURLREQUEST PR_TSS
+
+ #define TN_VBT_HTTPDRIVERREQUEST "HttpDriverRequestThread"
+ #define PR_VBT_HTTPDRIVERREQUEST_S PR_TSS_S
+ #define PR_VBT_HTTPDRIVERREQUEST PR_TSS
+
+ #define TN_VBT_HTTPREQUESTSESSION "HttpRequestSessionStateThread"
+ #define PR_VBT_HTTPREQUESTSESSION_S PR_TSS_S
+ #define PR_VBT_HTTPREQUESTSESSION PR_TSS
+
+ #define TN_VBT_PLAYMGRSTOPASYNC "PlayMgrStopAsyncStreamThread"
+ #define PR_VBT_PLAYMGRSTOPASYNC_S PR_TSS_S
+ #define PR_VBT_PLAYMGRSTOPASYNC PR_TSS
+
+ #define TN_VBT_RESOURCEMGRQUEUE "ResourceMgrQueueHandlerThread"
+ #define PR_VBT_RESOURCEMGRQUEUE_S PR_TSS_S
+ #define PR_VBT_RESOURCEMGRQUEUE PR_TSS
+
+ #define TN_VBT_SMURFDRIVERTIMEOUT "SmurfDriverTimeoutThread"
+ #define PR_VBT_SMURFDRIVERTIMEOUT_S PR_TSS_S
+ #define PR_VBT_SMURFDRIVERTIMEOUT PR_TSS
+
+ #define TN_NVR_NVRMAIN "NvrMainThread"
+ #define PR_NVR_NVRMAIN_S PR_TSS_S
+ #define PR_NVR_NVRMAIN PR_TSS
+
+ #define TN_NVR_NVRRECO "NvrRecoThread"
+ #define PR_NVR_NVRRECO_S PR_TSS_S
+ #define PR_NVR_NVRRECO PR_TSS
+
+ #define TN_NVR_NVRDICT "NvrDictThread"
+ #define PR_NVR_NVRDICT_S PR_TSS_S
+ #define PR_NVR_NVRDICT PR_TSS
+
+ #define TN_NVR_NVRENC "NvrEncThread"
+ #define PR_NVR_NVRENC_S PR_TSS_S
+ #define PR_NVR_NVRENC PR_TSS
+
+//exec from VehicleInfo
+#define MN_VEHICLEINFOSERVICE "VehicleInfoSrv"
+#define PR_VEHICLEINFOSERVICE_S PR_TSS_S
+#define PR_VEHICLEINFOSERVICE PR_TSS
+
+//exec from _CWORD76_
+#define MN__CWORD76_SERVICE "_CWORD76_Service"
+#define PR__CWORD76_SERVICE_S PR_TSS_S
+#define PR__CWORD76_SERVICE PR_TSS
+
+ #define TN_APPDOWNLOADER "AppDownloader"
+ #define PR_APPDOWNLOADER_S PR_TSS_S
+ #define PR_APPDOWNLOADER PR_TSS
+
+//exec from _CWORD76_(_CWORD58_)
+#define MN__CWORD58_SERVICE "_CWORD58_Service"
+#define PR__CWORD58_SERVICE_S PR_TSS_S
+#define PR__CWORD58_SERVICE PR_TSS
+
+#define MN__CWORD8_SRV "_CWORD8_Srv"
+#define PR__CWORD8_SRV_S PR_TSS_S
+#define PR__CWORD8_SRV PR_TSS
+
+#define MN_SPCSERVICE "SPCService"
+#define PR_SPCSERVICE_S PR_TSS_S
+#define PR_SPCSERVICE PR_TSS
+
+#define MN_LOCALSERVERPROXY "LSP"
+#define PR_LOCALSERVERPROXY_S PR_TSS_S
+#define PR_LOCALSERVERPROXY PR_TSS
+
+#define MN_EOMSERVICE "eOMService"
+#define PR_EOMSERVICE_S PR_TSS_S
+#define PR_EOMSERVICE PR_TSS
+
+//exec from NetworkManager
+#define MN_NETWORKMANAGER "NetworkManager"
+#define PR_NETWORKMANAGER_S PR_TSS_S
+#define PR_NETWORKMANAGER PR_TSS
+
+ #define TN_NWM_TH_CMDRCV "NWM_Th_CmdRcv"
+ #define PR_NWM_TH_CMDRCV_S PR_TSS_S
+ #define PR_NWM_TH_CMDRCV PR_TSS
+
+ #define TN_NWM_TH_PROCMGR "NWM_Th_ProcMgr"
+ #define PR_NWM_TH_PROCMGR_S PR_TSS_S
+ #define PR_NWM_TH_PROCMGR PR_TSS
+
+ #define TN_NWM_TH_CMDPROC "NWM_Th_CmdProc"
+ #define PR_NWM_TH_CMDPROC_S PR_TSS_S
+ #define PR_NWM_TH_CMDPROC PR_TSS
+
+ #define TN_NWM_TH_DNSMGR "NWM_Th_DnsMgr"
+ #define PR_NWM_TH_DNSMGR_S PR_TSS_S
+ #define PR_NWM_TH_DNSMGR PR_TSS
+
+ #define TN_NWM_TH_DHCPD "NWM_Th_Dhcpd"
+ #define PR_NWM_TH_DHCPD_S PR_TSS_S
+ #define PR_NWM_TH_DHCPD PR_TSS
+
+// DCM Service
+#define MN_DCMSERVICE "DCMService"
+#define PR_DCMSERVICE_S PR_TSS_S
+#define PR_DCMSERVICE PR_TSS
+
+ #define TN_DCM_TH_CMDRCV "DCM_Th_CmdRcv"
+ #define PR_DCM_TH_CMDRCV_S PR_TSS_S
+ #define PR_DCM_TH_CMDRCV PR_TSS
+
+ #define TN_DCM_TH_MSGRCV "DCM_Th_MsgRcv"
+ #define PR_DCM_TH_MSGRCV_S PR_TSS_S
+ #define PR_DCM_TH_MSGRCV PR_TSS
+
+ #define TN_DCM_TH_TIMER "DCM_Th_Timer"
+ #define PR_DCM_TH_TIMER_S PR_TSS_S
+ #define PR_DCM_TH_TIMER PR_TSS
+
+// HELP Service
+#define MN_HELPSERVICE "HELPService"
+#define PR_HELPSERVICE_S PR_TSS_S
+#define PR_HELPSERVICE PR_TSS
+
+//exec from RemoteService
+#define MN_REMOTESERVICE "RemoteService"
+#define PR_REMOTESERVICE_S PR_TSS_S
+#define PR_REMOTESERVICE PR_TSS
+
+ #define TN_RS_TH_CANCTRL "RS_Th_CANCtrl"
+ #define PR_RS_TH_CANCTRL_S PR_TSS_S
+ #define PR_RS_TH_CANCTRL PR_TSS
+
+ #define TN_RS_TH_DISPCTRL "RS_Th_DispCtrl"
+ #define PR_RS_TH_DISPCTRL_S PR_TSS_S
+ #define PR_RS_TH_DISPCTRL PR_TSS
+
+ #define TN_RS_TH_PARTSCTRL "RS_Th_PartsCtrl"
+ #define PR_RS_TH_PARTSCTRL_S PR_TSS_S
+ #define PR_RS_TH_PARTSCTRL PR_TSS
+
+ #define TN_RS_TH_HTTPPROC "RS_Th_HttpProc"
+ #define PR_RS_TH_HTTPPROC_S PR_TSS_S
+ #define PR_RS_TH_HTTPPROC PR_TSS
+
+//exec from VR
+#define MN_CONTENTSMGR "contentsmgr"
+#define PR_CONTENTSMGR_S PR_TSS_S
+#define PR_CONTENTSMGR PR_TSS
+
+ #define TN_CDB_CONTENDB "contendbThread"
+ #define PR_CDB_CONTENDB_S PR_TSS_S
+ #define PR_CDB_CONTENDB PR_TSS
+
+/* COMARB Service */
+#define MN_NW_COMARB "ComArbService"
+#define PR_NW_COMARB_S PR_TSS_S
+#define PR_NW_COMARB PR_TSS
+
+/* ASND_FRthread */
+#define MN_ASND_FRTH "ASND_FRthread"
+#define PR_ASND_FRTH_S PR_SND_VCETRFCTRL_S
+#define PR_ASND_FRTH PR_SND_VCETRFCTRL
+
+/* MLINK Service */
+#define MN_MLINKSERVICE "MlinkService"
+#define PR_MLINKSERVICE_S PR_TSS_S
+#define PR_MLINKSERVICE PR_TSS
+
+#define MN__CWORD74_SERVICE "_CWORD74_Service"
+#define PR__CWORD74_SERVICE_S PR_TSS_S
+#define PR__CWORD74_SERVICE PR_TSS
+#endif //__AGL_THREAD_H__
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_launch.xml b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_launch.xml
new file mode 100755
index 0000000..d4ab06c
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_launch.xml
@@ -0,0 +1,106 @@
+<service_list>
+ <service
+ svcid="TSKM_SVCID_ACTIVITYMGR"
+ name=MN_ACTIVITYMANAGER
+ path="/usr/agl/bin/acmsrv"
+ prio=PR_ACTIVITYMANAGER_S
+ policy="tss"
+ life_cycle="always"
+ user=""
+ shutdown_wait="yes" />
+
+ <service
+ svcid="TSKM_SVCID_TE_RESIDENT"
+ name=MN_RESIDENT_SVC
+ path="/usr/agl/bin/resident"
+ prio=PR_RESIDENT_SVC_S
+ policy="tss"
+ life_cycle="always"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_TE_TRANSIENT"
+ name =MN_TRANSIENT_SVC
+ path="/usr/agl/bin/transient"
+ prio=PR_TRANSIENT_SVC_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+
+ <service
+ svcid="TSKM_SVCID__CWORD58_"
+ name =MN__CWORD58_SERVICE
+ path="/usr/agl/bin/_CWORD58_Service"
+ prio=PR__CWORD58_SERVICE_S
+ policy="tss"
+ retry_cnt="-1"
+ user=""
+ shutdown_wait="yes" />
+
+ <service
+ svcid="TSKM_SVCID_SYSUPDATE"
+ name =MN_PS_SYSUPDATE
+ path="/usr/bin/sysupdate"
+ prio=PR_PS_SYSUPDATE_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_NANDUPDATE"
+ name =MN_SS_NANDUPDATE
+ path="/usr/bin/nandupdate"
+ prio=PR_SS_NANDUPDATE_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_XMVUPSRV"
+ name =MN_XMVUPSERVICE
+ path="/usr/agl/bin/radio_xm_update"
+ prio=PR_XMVUPSERVICE_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_BTPHONESRV"
+ name =MN_BTPHONESRV
+ path="/usr/agl/bin/BT_PhoneSrv"
+ prio=PR_BTPHONESRV_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_BTPBKSRV"
+ name =MN_BTPBKSRV
+ path="/usr/agl/bin/BT_PbkSrv"
+ prio=PR_BTPBKSRV_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_BTMSGSRV"
+ name =MN_BTMSGSRV
+ path="/usr/agl/bin/BT_MsgSrv"
+ prio=PR_BTMSGSRV_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+ <service
+ svcid="TSKM_SVCID_DTVVUPSRV"
+ name =MN_DTVVUPSERVICE
+ path="/usr/agl/bin/DtvVupService"
+ prio=PR_DTVVUPSERVICE_S
+ policy="tss"
+ user=""
+ shutdown_wait="no" />
+
+</service_list>
+
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml
new file mode 100755
index 0000000..4f724f7
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml
@@ -0,0 +1,11 @@
+<normal_shutdown>
+ <global_step>
+ <request_list>
+ <request svcid="TSKM_SVCID_TE_RESIDENT" local_step="last" />
+ <!-- <request svcid="TSKM_SVCID_ACTIVITYMGR" local_step="last" /> -->
+ </request_list>
+
+ <next_trans_condition cond="INI_TERMCOMP_TRANSIENT" />
+ </global_step>
+</normal_shutdown>
+
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml
new file mode 100755
index 0000000..71a30c8
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml
@@ -0,0 +1,6 @@
+<vup_shutdown>
+ <global_step>
+ <next_trans_condition cond="INI_TERMCOMP_TRANSIENT" />
+ </global_step>
+</vup_shutdown>
+
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml
new file mode 100755
index 0000000..aeb3548
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml
@@ -0,0 +1,8 @@
+<normal_wakeup>
+ <global_step>
+ <next_trans_condition cond="INI_INITCOMP_ON_START" />
+ </global_step>
+ <global_step>
+ <next_trans_condition cond="INI_INITCOMP_NVM_ACCESS" />
+ </global_step>
+</normal_wakeup>
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml
new file mode 100755
index 0000000..7162fdf
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml
@@ -0,0 +1,5 @@
+<vup_wakeup>
+ <global_step>
+ <next_trans_condition cond="INI_INITCOMP_NVM_ACCESS" />
+ </global_step>
+</vup_wakeup>
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h b/video_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h
new file mode 100755
index 0000000..c042fc8
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file task_manager_libtskmcfg.h
+ * @brief \~english This file include tskm_svcid.h file and tskm_xml_data.h file
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SYSTEMSERVICE_TASKMNAGERLIBTASKMCFG_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_TASKMNAGERLIBTASKMCFG_H_
+
+#include "system_service/tskm_svcid.h"
+#include "system_service/tskm_xml_data.h"
+
+#endif // SYSTEMSERVICE_TASKMNAGERLIBTASKMCFG_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.h b/video_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.h
new file mode 100755
index 0000000..d8f3e3d
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.h
@@ -0,0 +1,59 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_svcid.h
+ * @brief \~english This file contains declaration of TSKM_SVC ID
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+/*
+ * Service ID
+ */
+#ifndef TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_SVCID_H_
+#define TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_SVCID_H_
+
+
+#define TSKM_SVCID_NONE 0x00000000U
+#define TSKM_SVCID_TE_RESIDENT 0x00000001U // for test
+#define TSKM_SVCID_TE_TRANSIENT 0x00000002U // for test
+#define TSKM_SVCID_ACTIVITYMGR 0x00000003U
+#define TSKM_SVCID_SYSVUP 0x00000004U // for vup
+#define TSKM_SVCID__CWORD52_VUP 0x00000005U // for vup
+#define TSKM_SVCID_ROOTFSVUP 0x00000006U // for vup
+#define TSKM_SVCID_VUPPROGUI 0x00000007U // for vup
+#define TSKM_SVCID_NORVUP 0x00000008U // for vup
+#define TSKM_SVCID__CWORD58_ 0x00000009U // for _CWORD76_
+#define TSKM_SVCID_SYSUPDATE 0x0000000AU // for repro vup
+#define TSKM_SVCID_NANDUPDATE 0x0000000BU // for repro vup
+#define TSKM_SVCID_BTPHONESRV 0x0000000CU
+#define TSKM_SVCID_BTPBKSRV 0x0000000DU
+#define TSKM_SVCID_BTMSGSRV 0x0000000EU
+#define TSKM_SVCID_DTVVUPSRV 0x0000000FU // fot peaks vup
+#define TSKM_SVCID_XMVUPSRV 0x00000020U // fot XM_outer_update vup
+
+#endif // TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_SVCID_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h b/video_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h
new file mode 100755
index 0000000..0c8b75b
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h
@@ -0,0 +1,173 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_xml_data.h
+ * @brief \~english This file provide api to operating task manager with XML data
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_XML_DATA_H_
+#define TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_XML_DATA_H_
+
+#include "system_service/tskm_type.h"
+#include "system_service/tskm_svc.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_initServiceList
+ /// \~english @par Summary
+ /// init started services list
+ /// \~english @param [out] p_svcs
+ /// p_svcs - pointer of service list
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] iFd
+ /// iFd - the file descriptor return by inotify_init1().
+ /// \~english @par
+ /// p_svcs int
+ /// \~english @retval 0 Success
+ /// \~english @retval -1 Failed
+ /// \~english @par Preconditions
+ /// - called in the ctxCreate()
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - if srvId in serviceList greater than TSKM_SVC_ID_MAX_SIZE. [-1]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// Init started services list\n
+ /// Get the started services list from static variable serviceList and init by input parameter iFd\n
+ /// If envirment is NFS, change the path after /tmp to CAP path.\n
+ ///
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+int tskm_initServiceList(TSKM_SVCS_CTX_t* p_svcs, int iFd);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_initWakeupCtx
+ /// \~english @par Summary
+ /// Get state of started step.
+ /// \~english @param [out] p_wakeup
+ /// p_wakeup - pointer of TSKM_GSTEP_CTX_t
+ /// \~english @par
+ /// p_wakeup TSKM_GSTEP_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t gstepIdx; // step Index
+ /// uint32_t gstepNum; // number of step
+ /// TSKM_GSTEP_t* gstep; // step start/stop info
+ /// uint64_t compState;
+ /// } TSKM_GSTEP_CTX_t;
+ /// @endcode
+ /// \~english @param [in] isVupMode
+ /// isVupMode - version up flag
+ /// \~english @par
+ /// isVupMode BOOL
+ /// TRUE version up mode
+ /// FALSE not versoin up mode
+ /// \~english @retval void
+ ///
+ /// \~english @par Preconditions
+ /// - called in ctxCreate()
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// Get state of started step.\n
+ /// if version up mode is TRUE, retrun the wakeupGstepVup.\n
+ /// if version up mode is FALSE, return the wakeupGstep.\n
+ ///
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+void tskm_initWakeupCtx(TSKM_GSTEP_CTX_t* p_wakeup, BOOL isVupMode);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_initDownCtx
+ /// \~english @par Summary
+ /// Get state of down step.
+ /// \~english @param [out] p_down
+ /// p_down - pointer of TSKM_GSTEP_CTX_t
+ /// \~english @par
+ /// p_wakeup TSKM_GSTEP_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t gstepIdx; // step Index
+ /// uint32_t gstepNum; // number of step
+ /// TSKM_GSTEP_t* gstep; // step start/stop info
+ /// uint64_t compState;
+ /// } TSKM_GSTEP_CTX_t;
+ /// @endcode
+ /// \~english @param [in] isVupMode
+ /// isVupMode - version up mode flag
+ /// \~english @par
+ /// isVupMode BOOL
+ /// TRUE version up mode
+ /// FALSE not versoin up mode
+ /// \~english @retval
+ /// \~english @par Preconditions
+ /// - called in ctxCreate().
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - sync only
+ /// \~english @par Detail
+ /// Get state of down step.\n
+ /// if version up mode is TRUE, retrun the downGstepVup.\n
+ /// if version up mode is FALSE, return the downGstep.\n
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+void tskm_initDownCtx(TSKM_GSTEP_CTX_t* p_down, BOOL isVupMode);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_XML_DATA_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/libtskmcfg.ver b/video_in_hal/systemservice/task_manager/client/libtskmcfg/libtskmcfg.ver
new file mode 100755
index 0000000..c7bb97b
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/libtskmcfg.ver
@@ -0,0 +1,21 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ global:
+ tskm_init*;
+ local: *;
+};
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/src/parsexml.c b/video_in_hal/systemservice/task_manager/client/libtskmcfg/src/parsexml.c
new file mode 100755
index 0000000..7cb3929
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/src/parsexml.c
@@ -0,0 +1,879 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <libgen.h>
+
+#include <expat.h>
+
+#define BUFSIZE 4096
+#define OUTFILE "tskm_auto_build.h"
+#define TMPFILE "parsexml.tmp"
+
+typedef uint32_t ELE_STATE_t;
+#define ELE_NONE 0x00000000U
+#define ELE_TSKM_CFG 0x10000000U
+#define ELE_SERVICE_LIST 0x11000000U
+#define ELE_SERVICE 0x11100000U
+#define ELE_SUBGID_LIST 0x11110000U
+
+#define ELE_COMMON_GSTEP 0x00100000U
+#define ELE_COMMON_EXEC 0x00010000U
+#define ELE_COMMON_REQ 0x00020000U
+
+#define ELE_NORMAL_WAKEUP 0x12000000U
+#define ELE_NORMAL_W_GSTEP (ELE_NORMAL_WAKEUP|ELE_COMMON_GSTEP)
+#define ELE_NORMAL_W_EXEC (ELE_NORMAL_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_EXEC)
+#define ELE_NORMAL_W_REQ (ELE_NORMAL_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_REQ)
+
+#define ELE_NORMAL_SHUTDOWN 0x13000000U
+#define ELE_NORMAL_D_GSTEP (ELE_NORMAL_SHUTDOWN|ELE_COMMON_GSTEP)
+#define ELE_NORMAL_D_REQ (ELE_NORMAL_SHUTDOWN|ELE_COMMON_GSTEP|ELE_COMMON_REQ)
+
+#define ELE_VUP_WAKEUP 0x14000000U
+#define ELE_VUP_W_GSTEP (ELE_VUP_WAKEUP|ELE_COMMON_GSTEP)
+#define ELE_VUP_W_EXEC (ELE_VUP_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_EXEC)
+#define ELE_VUP_W_REQ (ELE_VUP_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_REQ)
+
+#define ELE_VUP_SHUTDOWN 0x15000000U
+#define ELE_VUP_D_GSTEP (ELE_VUP_SHUTDOWN|ELE_COMMON_GSTEP)
+#define ELE_VUP_D_REQ (ELE_VUP_SHUTDOWN|ELE_COMMON_GSTEP|ELE_COMMON_REQ)
+
+
+#define ELE_MASK0 0xF0000000U
+#define ELE_MASK1 0x0F000000U
+#define ELE_MASK2 0x00F00000U
+#define ELE_MASK3 0x000F0000U
+
+#define PARSE_ASSERT_EXIT(x) \
+ if(!(x)){ \
+ printf("ASSERT %s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__); \
+ exit(-1); \
+ }
+
+#define VALUE_NAME_MAX 255
+typedef struct {
+ int step;
+ char gstepIdStr[VALUE_NAME_MAX];
+ int execSvcNum;
+ int reqNum;
+ char nextStepCondStr[VALUE_NAME_MAX];
+ char execSvcName[VALUE_NAME_MAX];
+ char reqTableName[VALUE_NAME_MAX];
+} PARSE_GSTEP_t;
+
+
+typedef struct {
+ char svcid[VALUE_NAME_MAX];
+ char name[VALUE_NAME_MAX];
+ char path[VALUE_NAME_MAX];
+ char type[VALUE_NAME_MAX];
+ char life_cycle[VALUE_NAME_MAX];
+ char retry_cnt[VALUE_NAME_MAX];
+ char cpu_assign[VALUE_NAME_MAX];
+ char prio[VALUE_NAME_MAX];
+ char policy[VALUE_NAME_MAX];
+ char user[VALUE_NAME_MAX];
+ char runtime_limit[VALUE_NAME_MAX];
+ char cpu_limit[VALUE_NAME_MAX];
+ char mem_limit[VALUE_NAME_MAX];
+ int subgidNum;
+ char args[VALUE_NAME_MAX];
+ char shutdown_wait[VALUE_NAME_MAX];
+} PARSE_SVC_t;
+
+/***************************************
+ * Context
+ **************************************/
+typedef struct {
+ FILE* fp; // Output file pointer
+ FILE* tmpFp; // Temporary file
+ ELE_STATE_t state;
+
+ PARSE_SVC_t svc;
+
+ int svcNum; // Number of services
+ PARSE_GSTEP_t gstep;
+} PARSE_CTX_t;
+
+
+/***************************************
+ * entryTskmCfg
+ **************************************/
+void
+entryTskmCfg(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+/***************************************
+ * exitTskmCfg
+ **************************************/
+void
+exitTskmCfg(PARSE_CTX_t* p_ctx) {
+ p_ctx->state = ELE_NONE;
+}
+
+
+/***************************************
+ * entryServiceList
+ **************************************/
+void
+entryServiceList(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_SERVICE_LIST;
+
+ p_ctx->tmpFp = fopen(TMPFILE,"w");
+
+ fprintf(p_ctx->tmpFp,
+ "static TSKM_SVC_ATTR_t serviceAttr[]={"
+ "\n");
+}
+
+/***************************************
+ * exitServiceList
+ **************************************/
+void
+exitServiceList(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->tmpFp,
+ "};"
+ "\n\n");
+
+ fprintf(p_ctx->tmpFp, "#define TSKM_SVC_NUM (%d) \n\n",p_ctx->svcNum);
+
+ fprintf(p_ctx->tmpFp, "static TSKM_SVC_CTX_t serviceList[TSKM_SVC_NUM]; \n\n");
+
+ fclose(p_ctx->tmpFp);
+
+ fprintf(p_ctx->fp,"\n\n");
+
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+/***************************************
+ * handleServiceList
+ **************************************/
+void
+entryService(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) {
+ PARSE_ASSERT_EXIT(strcmp(name,"service") == 0);
+ int ii;
+ char* tp;
+ p_ctx->state = ELE_SERVICE;
+
+ memset(&p_ctx->svc,0,sizeof(p_ctx->svc));
+
+ for(ii=0; atts[ii]; ii+=2) {
+ const char* attr = atts[ii];
+ const char* value = atts[ii+1];
+ if(strcmp(attr,"svcid")==0) {
+ strcpy(p_ctx->svc.svcid,value);
+ } else if(strcmp(attr,"name")==0) {
+ strcpy(p_ctx->svc.name,value);
+ } else if(strcmp(attr,"path")==0) {
+ strcpy(p_ctx->svc.path,value);
+ } else if(strcmp(attr,"type")==0) {
+ const char* typeName = (strcmp(value,"native")==0) ? "TSKM_SVC_TYPE_NATIVE" : "TSKM_SVC_TYPE_UNKNONW";
+ strcpy(p_ctx->svc.type,typeName);
+ } else if(strcmp(attr,"prio")==0) {
+ strcpy(p_ctx->svc.prio,value);
+ } else if(strcmp(attr,"policy")==0) {
+ const char* polName = (strcmp(value,"fifo")==0) ? "TSKM_SVC_POLICY_FIFO" :
+ (strcmp(value,"tss")==0) ? "TSKM_SVC_POLICY_TSS" :
+ (strcmp(value,"rr")==0) ? "TSKM_SVC_POLICY_RR" : "ERROR";
+ strcpy(p_ctx->svc.policy,polName);
+ } else if(strcmp(attr,"life_cycle")==0) {
+ const char* lcName = (strcmp(value,"always")==0) ? "TSKM_SVC_LC_ALWAYS" :
+ (strcmp(value,"always_recoverable")==0) ? "TSKM_SVC_LC_ALWAYS_RECOVERABLE" :
+ (strcmp(value,"dynamic")==0) ? "TSKM_SVC_LC_DYNAMIC" : "ERROR";
+ strcpy(p_ctx->svc.life_cycle,lcName);
+ } else if(strcmp(attr,"retry_cnt")==0) {
+ strcpy(p_ctx->svc.retry_cnt,value);
+ } else if(strcmp(attr,"cpu_assign")==0) {
+ const char* caName = (strcmp(value,"cpu0")==0) ? "TSKM_SVC_ASSIGN_CPU_0" :
+ (strcmp(value,"cpu1")==0) ? "TSKM_SVC_ASSIGN_CPU_1" :
+ (strcmp(value,"auto")==0) ? "TSKM_SVC_ASSIGN_CPU_AUTO" : "ERROR";
+ strcpy(p_ctx->svc.cpu_assign,caName);
+ } else if(strcmp(attr,"user")==0) {
+ strcpy(p_ctx->svc.user,value);
+ } else if(strcmp(attr,"runtime_limit")==0) {
+ strcpy(p_ctx->svc.runtime_limit,value);
+ } else if(strcmp(attr,"cpu_limit")==0) {
+ strcpy(p_ctx->svc.cpu_limit,value);
+ } else if(strcmp(attr,"mem_limit")==0) {
+ strcpy(p_ctx->svc.mem_limit,value);
+ } else if(strcmp(attr,"args")==0) {
+ strcpy(p_ctx->svc.args,value);
+ } else if(strcmp(attr,"shutdown_wait")==0) {
+ const char* swStr = (strcmp(value,"yes")==0) ? "TSKM_TRUE" :
+ (strcmp(value,"no")==0) ? "TSKM_FALSE" : "ERROR";
+ strcpy(p_ctx->svc.shutdown_wait,swStr);
+ }
+ }
+
+ fprintf(p_ctx->fp,"char const *svcArgs%d[] = {",p_ctx->svcNum);
+ fprintf(p_ctx->fp,"\"%s\",",p_ctx->svc.path);
+
+ // Output arguments
+ tp = strtok(p_ctx->svc.args," ");
+ while(tp != NULL) {
+ fprintf(p_ctx->fp,"\"%s\",",tp);
+ tp = strtok(NULL," ");
+ }
+
+ fprintf(p_ctx->fp,"NULL");
+ fprintf(p_ctx->fp,"};\n");
+}
+
+/***************************************
+ * exitService
+ **************************************/
+void
+exitService(PARSE_CTX_t* p_ctx) {
+ uint32_t ii;
+ fprintf(p_ctx->tmpFp,"{" );
+
+ fprintf(p_ctx->tmpFp,"%s",p_ctx->svc.svcid);
+ fprintf(p_ctx->tmpFp,", (const char *)\"%s\"",p_ctx->svc.name);
+ fprintf(p_ctx->tmpFp,", (const char *)\"%s\"",p_ctx->svc.path);
+ fprintf(p_ctx->tmpFp,", (char**)svcArgs%d",p_ctx->svcNum);
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.type);
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.prio);
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.policy);
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.life_cycle);
+ fprintf(p_ctx->tmpFp,", (uint32_t)%s",p_ctx->svc.retry_cnt);
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.cpu_assign);
+ fprintf(p_ctx->tmpFp,", (const char *)\"%s\"",p_ctx->svc.user);
+ fprintf(p_ctx->tmpFp,", %s",(p_ctx->svc.runtime_limit[0] != '\0') ? p_ctx->svc.runtime_limit : "0");
+ fprintf(p_ctx->tmpFp,", %s",(p_ctx->svc.cpu_limit[0] != '\0') ? p_ctx->svc.cpu_limit : "0");
+ fprintf(p_ctx->tmpFp,", %s",(p_ctx->svc.mem_limit[0] != '\0') ? p_ctx->svc.mem_limit : "0");
+ fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.shutdown_wait);
+ fprintf(p_ctx->tmpFp,", %d",p_ctx->svc.subgidNum);
+ if(p_ctx->svc.subgidNum) {
+ fprintf(p_ctx->tmpFp,", subgidList%d",p_ctx->svcNum);
+ } else {
+ fprintf(p_ctx->tmpFp,", NULL");
+ }
+
+ fprintf(p_ctx->tmpFp,"},\n");
+
+ p_ctx->svcNum++;
+
+ p_ctx->state = ELE_SERVICE_LIST;
+}
+
+/***************************************
+ * entrySubgidList
+ **************************************/
+void
+entrySubgidList(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_SUBGID_LIST;
+
+ fprintf(p_ctx->fp,"static gid_t subgidList%d[] = {",p_ctx->svcNum);
+
+
+}
+
+/***************************************
+ * handleSubgidList
+ **************************************/
+void
+handleSubgidList(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) {
+ PARSE_ASSERT_EXIT(strcmp(name,"subgid") == 0);
+ int32_t ii;
+
+ if(p_ctx->svc.subgidNum > 0) {
+ fprintf(p_ctx->fp,",");
+ }
+ for(ii=0; atts[ii]; ii+=2) {
+ const char* attr = atts[ii];
+ const char* value = atts[ii+1];
+ if(strcmp(attr,"gid")==0) {
+ fprintf(p_ctx->fp,"%s",value);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+ }
+ p_ctx->svc.subgidNum++;
+}
+
+/***************************************
+ * exitSubgidList
+ **************************************/
+void
+exitSubgidList(PARSE_CTX_t* p_ctx) {
+
+ fprintf(p_ctx->fp,"};\n");
+
+ p_ctx->state = ELE_SERVICE;
+}
+
+
+/***************************************
+ * entryNormalWakeup
+ **************************************/
+void
+entryNormalWakeup(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_NORMAL_WAKEUP;
+ memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep));
+
+ sprintf(p_ctx->gstep.reqTableName,"wakeupReqList");
+ sprintf(p_ctx->gstep.execSvcName,"wakeupExecSvcId");
+ p_ctx->tmpFp = fopen(TMPFILE,"a");
+ PARSE_ASSERT_EXIT(p_ctx->tmpFp);
+
+ fprintf(p_ctx->tmpFp,"TSKM_GSTEP_t wakeupGstep[]={\n");
+}
+
+/***************************************
+ * exitNormalWakeup
+ **************************************/
+void
+exitNormalWakeup(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->tmpFp,"};\n\n");
+ fclose(p_ctx->tmpFp);
+
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+/***************************************
+ * entryVupWakeup
+ **************************************/
+void
+entryVupWakeup(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_VUP_WAKEUP;
+ memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep));
+
+ sprintf(p_ctx->gstep.reqTableName,"wakeupReqListVup");
+ sprintf(p_ctx->gstep.execSvcName,"wakeupExecSvcIdVup");
+ p_ctx->tmpFp = fopen(TMPFILE,"a");
+ PARSE_ASSERT_EXIT(p_ctx->tmpFp);
+
+ fprintf(p_ctx->tmpFp,"TSKM_GSTEP_t wakeupGstepVup[]={\n");
+}
+
+/***************************************
+ * exitVupWakeup
+ **************************************/
+void
+exitVupWakeup(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->tmpFp,"};\n\n");
+ fclose(p_ctx->tmpFp);
+
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+void
+entryGstep(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+
+ p_ctx->state &= ~ELE_MASK2;
+ p_ctx->state |= ELE_COMMON_GSTEP;
+
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+
+ if(atts[0] && strcmp(atts[0],"stepid") == 0) {
+ sprintf(p_gstep->gstepIdStr,"%s",atts[1]);
+ } else {
+ sprintf(p_gstep->gstepIdStr,"TSKM_GSTEP_NONE");
+ }
+ p_gstep->execSvcNum = 0;
+ p_gstep->reqNum = 0;
+ sprintf(p_gstep->nextStepCondStr,"INI_INITCOMP_NONE");
+}
+
+void
+handleGstep(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) {
+ PARSE_ASSERT_EXIT(strcmp(name,"next_trans_condition") == 0);
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+
+ if(atts[0] && strcmp(atts[0],"cond") == 0) {
+ sprintf(p_gstep->nextStepCondStr,"%s",atts[1]);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+}
+
+void
+exitGstep(PARSE_CTX_t* p_ctx) {
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+
+ fprintf(p_ctx->tmpFp,"{");
+ fprintf(p_ctx->tmpFp,"%s,",p_gstep->gstepIdStr);
+ fprintf(p_ctx->tmpFp,"%d,",p_gstep->execSvcNum);
+ if(p_gstep->execSvcNum) {
+ fprintf(p_ctx->tmpFp,"%s%d,",p_gstep->execSvcName,p_gstep->step);
+ } else {
+ fprintf(p_ctx->tmpFp,"NULL,");
+ }
+ fprintf(p_ctx->tmpFp,"%d,",p_gstep->reqNum);
+ if(p_gstep->reqNum) {
+ fprintf(p_ctx->tmpFp,"%s%d,",p_gstep->reqTableName,p_gstep->step);
+ } else {
+ fprintf(p_ctx->tmpFp,"NULL,");
+ }
+ fprintf(p_ctx->tmpFp,"%s",p_gstep->nextStepCondStr);
+ fprintf(p_ctx->tmpFp,"},\n");
+
+ p_gstep->step++;
+
+ p_ctx->state &= ~ELE_MASK2;
+}
+
+void
+entryExec(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state &= ~ELE_MASK3;
+ p_ctx->state |= ELE_COMMON_EXEC;
+
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+ fprintf(p_ctx->fp,
+ "static TSKM_SVCID_t %s%d[] = {",p_gstep->execSvcName,p_gstep->step);
+}
+void
+handleExec(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) {
+ PARSE_ASSERT_EXIT(strcmp(name,"exec_svc") == 0);
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+ int ii;
+
+ if(p_gstep->execSvcNum > 0) {
+ fprintf(p_ctx->fp,",");
+ }
+
+ for(ii=0; atts[ii]; ii+=2) {
+ const char* attr = atts[ii];
+ const char* value = atts[ii+1];
+ PARSE_ASSERT_EXIT(strcmp(attr,"svcid") == 0);
+ fprintf(p_ctx->fp,"%s",value);
+ }
+ p_gstep->execSvcNum++;
+}
+void
+exitExec(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->fp,"};\n\n");
+ p_ctx->state &= ~ELE_MASK3;
+}
+
+void
+entryReq(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state &= ~ELE_MASK3;
+ p_ctx->state |= ELE_COMMON_REQ;
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+
+ fprintf(p_ctx->fp,"static TSKM_GSTEP_REQ_INFO_t %s%d[] ={",p_gstep->reqTableName,p_gstep->step);
+}
+void
+handleReq(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) {
+ PARSE_GSTEP_t *p_gstep = &p_ctx->gstep;
+ PARSE_ASSERT_EXIT(strcmp(name,"request") == 0);
+ int ii;
+
+ fprintf(p_ctx->fp," {");
+
+ for(ii=0; atts[ii]; ii+=2) {
+ const char* attr = atts[ii];
+ const char* value = atts[ii+1];
+ if(strcmp(attr,"local_step") == 0) {
+ if(strcmp(value,"shm") == 0) {
+ fprintf(p_ctx->fp,"TSKM_LSTEP_SHM");
+ } else if(strcmp(value,"bupchk") == 0) {
+ fprintf(p_ctx->fp,"TSKM_LSTEP_BUPCHK");
+ } else if(strcmp(value,"last") == 0) {
+ fprintf(p_ctx->fp,"TSKM_LSTEP_LAST");
+ } else if(strcmp(value,"all") == 0) {
+ fprintf(p_ctx->fp,"TSKM_LSTEP_ALL");
+ } else {
+ fprintf(p_ctx->fp,"%s",value);
+ }
+ } else {
+ fprintf(p_ctx->fp,"%s",value); // Output of ","
+ }
+ fprintf(p_ctx->fp,"%s",(atts[ii+2])?",":""); // Outoput of ","
+ }
+ fprintf(p_ctx->fp,"},");
+ p_gstep->reqNum++;
+}
+void
+exitReq(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->fp,"};\n\n");
+ p_ctx->state &= ~ELE_MASK3;
+}
+
+/***************************************
+ * entryNormalShutdown
+ **************************************/
+void
+entryNormalShutdown(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_NORMAL_SHUTDOWN;
+
+ memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep));
+ sprintf(p_ctx->gstep.reqTableName,"downReqList");
+ p_ctx->tmpFp = fopen(TMPFILE,"a");
+ PARSE_ASSERT_EXIT(p_ctx->tmpFp);
+
+ fprintf(p_ctx->tmpFp,"static TSKM_GSTEP_t downGstep[]={\n");
+}
+
+/***************************************
+ * exitNormalShutdown
+ **************************************/
+void
+exitNormalShutdown(PARSE_CTX_t* p_ctx) {
+
+ fprintf(p_ctx->tmpFp,"};\n\n");
+ fclose(p_ctx->tmpFp);
+
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+/***************************************
+ * entryVupShutdown
+ **************************************/
+void
+entryVupShutdown(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) {
+ p_ctx->state = ELE_VUP_SHUTDOWN;
+ memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep));
+
+ sprintf(p_ctx->gstep.reqTableName,"downReqListVup");
+ p_ctx->tmpFp = fopen(TMPFILE,"a");
+ PARSE_ASSERT_EXIT(p_ctx->tmpFp);
+
+ fprintf(p_ctx->tmpFp,"static TSKM_GSTEP_t downGstepVup[]={\n");
+}
+
+/***************************************
+ * exitVupShutdown
+ **************************************/
+void
+exitVupShutdown(PARSE_CTX_t* p_ctx) {
+ fprintf(p_ctx->tmpFp,"};\n\n");
+ fclose(p_ctx->tmpFp);
+
+ p_ctx->state = ELE_TSKM_CFG;
+}
+
+/***************************************
+ * elementStart
+ **************************************/
+void
+elementStart(void *userData, const XML_Char *name, const XML_Char *atts[]) {
+ PARSE_CTX_t *p_ctx = (PARSE_CTX_t*)userData;
+#if 0
+ int ii;
+ printf("[ELEMENT] %s Start!\n", name);
+ for(ii=0; atts[ii]; ii+=2) {
+ printf(" %s:%s \n", atts[ii],atts[ii+1]);
+ }
+#endif
+ switch(p_ctx->state) {
+ case ELE_NONE:
+ if(strcmp(name,"tskm_cfg") == 0) {
+ entryTskmCfg(p_ctx,atts);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+ break;
+ case ELE_TSKM_CFG:
+ if(strcmp(name,"service_list") == 0) {
+ entryServiceList(p_ctx,atts);
+ } else if(strcmp(name,"normal_wakeup") == 0) {
+ entryNormalWakeup(p_ctx,atts);
+ } else if(strcmp(name,"normal_shutdown") == 0) {
+ entryNormalShutdown(p_ctx,atts);
+ } else if(strcmp(name,"vup_wakeup") == 0) {
+ entryVupWakeup(p_ctx,atts);
+ } else if(strcmp(name,"vup_shutdown") == 0) {
+ entryVupShutdown(p_ctx,atts);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+ break;
+ case ELE_SERVICE_LIST:
+ if(strcmp(name,"service") == 0) {
+ entryService(p_ctx,name,atts);
+ }
+ break;
+ case ELE_SERVICE:
+ if(strcmp(name,"subgid_list") == 0) {
+ entrySubgidList(p_ctx,atts);
+ }
+ break;
+ case ELE_SUBGID_LIST:
+ handleSubgidList(p_ctx,name,atts);
+ break;
+ case ELE_NORMAL_WAKEUP:
+ case ELE_NORMAL_SHUTDOWN:
+ case ELE_VUP_WAKEUP:
+ case ELE_VUP_SHUTDOWN:
+ if(strcmp(name,"global_step") == 0) {
+ entryGstep(p_ctx,atts);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+ break;
+ case ELE_NORMAL_W_GSTEP:
+ case ELE_NORMAL_D_GSTEP:
+ case ELE_VUP_W_GSTEP:
+ case ELE_VUP_D_GSTEP:
+ if(strcmp(name,"exec_list") == 0) {
+ entryExec(p_ctx,atts);
+ } else if(strcmp(name,"request_list") == 0) {
+ entryReq(p_ctx,atts);
+ } else {
+ handleGstep(p_ctx,name,atts);
+ }
+ break;
+ case ELE_NORMAL_W_EXEC:
+ case ELE_VUP_W_EXEC:
+ handleExec(p_ctx,name,atts);
+ break;
+ case ELE_NORMAL_W_REQ:
+ case ELE_NORMAL_D_REQ:
+ case ELE_VUP_W_REQ:
+ case ELE_VUP_D_REQ:
+ handleReq(p_ctx,name,atts);
+ break;
+ }
+}
+
+
+/***************************************
+ * elementEnd
+ **************************************/
+void
+elementEnd(void *userData, const XML_Char *name) {
+ PARSE_CTX_t *p_ctx = (PARSE_CTX_t*)userData;
+ switch(p_ctx->state) {
+ case ELE_NONE:
+ PARSE_ASSERT_EXIT(0);
+ break;
+ case ELE_TSKM_CFG:
+ if(strcmp(name,"tskm_cfg") == 0) {
+ exitTskmCfg(p_ctx);
+ } else {
+ PARSE_ASSERT_EXIT(0);
+ }
+ break;
+ case ELE_SERVICE_LIST:
+ if(strcmp(name,"service_list") == 0) {
+ exitServiceList(p_ctx);
+ }
+ break;
+ case ELE_SERVICE:
+ if(strcmp(name,"service") == 0) {
+ exitService(p_ctx);
+ }
+ break;
+ case ELE_SUBGID_LIST:
+ if(strcmp(name,"subgid_list") == 0) {
+ exitSubgidList(p_ctx);
+ }
+ break;
+ case ELE_NORMAL_WAKEUP:
+ if(strcmp(name,"normal_wakeup") == 0) {
+ exitNormalWakeup(p_ctx);
+ }
+ break;
+ case ELE_NORMAL_SHUTDOWN:
+ if(strcmp(name,"normal_shutdown") == 0) {
+ exitNormalShutdown(p_ctx);
+ }
+ break;
+ case ELE_VUP_WAKEUP:
+ if(strcmp(name,"vup_wakeup") == 0) {
+ exitVupWakeup(p_ctx);
+ }
+ break;
+ case ELE_VUP_SHUTDOWN:
+ if(strcmp(name,"vup_shutdown") == 0) {
+ exitVupShutdown(p_ctx);
+ }
+ break;
+ case ELE_NORMAL_D_GSTEP:
+ case ELE_NORMAL_W_GSTEP:
+ case ELE_VUP_D_GSTEP:
+ case ELE_VUP_W_GSTEP:
+ if(strcmp(name,"global_step") == 0) {
+ exitGstep(p_ctx);
+ }
+ break;
+ case ELE_NORMAL_W_EXEC:
+ case ELE_VUP_W_EXEC:
+ if(strcmp(name,"exec_list") == 0) {
+ exitExec(p_ctx);
+ }
+ break;
+ case ELE_NORMAL_D_REQ:
+ case ELE_NORMAL_W_REQ:
+ case ELE_VUP_D_REQ:
+ case ELE_VUP_W_REQ:
+ if(strcmp(name,"request_list") == 0) {
+ exitReq(p_ctx);
+ }
+ break;
+ }
+}
+/***************************************
+ * parseXmlFile
+ **************************************/
+int
+parseXmlFile(const char* file,XML_Parser parser) {
+ int ret = -1;
+ FILE* fp = fopen(file, "r");
+ if (fp == NULL) {
+ goto ERROR;
+ }
+
+ while(1) {
+ char *buf = (char*) XML_GetBuffer(parser, BUFSIZE);
+ if (!buf) {
+ goto ERROR;
+ }
+
+ size_t nread = fread(buf, sizeof(char), BUFSIZE, fp);
+ if (ferror(fp)) {
+ goto ERROR;
+ }
+
+ if (!XML_ParseBuffer(parser, nread, feof(fp))) {
+ goto ERROR;
+ }
+
+ if (feof(fp)) {
+ break;
+ }
+ }
+ ret = 0;
+ERROR:
+ if(fp) {
+ fclose(fp);
+ }
+ return ret;
+}
+
+/***************************************
+ * externalHandler
+ **************************************/
+int
+externalHandler(XML_Parser parser,
+ const XML_Char* content, const XML_Char* base,
+ const XML_Char* systemId, const XML_Char* publicId) {
+ printf("parse %s \n",systemId);
+
+ int ret = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
+ XML_Parser extparser = NULL;
+
+ extparser = XML_ExternalEntityParserCreate(parser, content, NULL);
+ if(extparser ==NULL) {
+ goto ERROR;
+ }
+
+ if(parseXmlFile(systemId,extparser) != 0) {
+ goto ERROR;
+ }
+ ret = XML_STATUS_OK;
+ERROR:
+ if(extparser) {
+ XML_ParserFree(extparser);
+ }
+ return ret;
+}
+
+/***************************************
+ * usage
+ **************************************/
+void
+usage(const char* cmd) {
+ printf("usage:%s xmlfile\n",cmd);
+}
+
+/***************************************
+ * main
+ **************************************/
+int
+main (int argc, char *argv[]) {
+ struct stat statinfo;
+ int ret=-1;
+ int xmlRet;
+ const char* inpath;
+ char tmpstr1[255];
+ char tmpstr2[255];
+ const char* workdir;
+ const char* infile;
+ XML_Parser parser;
+ PARSE_CTX_t ctx;
+
+ if(argc < 2) {
+ usage(argv[0]);
+ goto ERROR;
+ }
+
+ inpath = argv[1];
+ if(0 != stat(inpath,&statinfo)) {
+ fprintf(stderr, "%s:%s",strerror(errno),inpath);
+ goto ERROR;
+ }
+ memset(&ctx,0,sizeof(ctx));
+
+ strcpy(tmpstr1,inpath);
+ strcpy(tmpstr2,inpath);
+ workdir=dirname(tmpstr1);
+ infile=basename(tmpstr2);
+
+ if(0 != chdir(workdir)) {
+ fprintf(stderr, "%s:%s",strerror(errno),workdir);
+ goto ERROR;
+ }
+
+ ctx.fp = fopen(OUTFILE, "w");
+ if (ctx.fp == NULL) {
+ goto ERROR;
+ }
+ fprintf(ctx.fp,"//This file is created automatically from %s.\n",inpath);
+ fprintf(ctx.fp,"//So you shall not modify this file immediately.\n");
+
+ /* create XML parser */
+ if ((parser = XML_ParserCreate(NULL)) == NULL) {
+ fprintf(stderr, "parser creation error\n");
+ goto ERROR;
+ }
+ XML_SetUserData(parser,&ctx);
+ XML_SetParamEntityParsing(parser,XML_PARAM_ENTITY_PARSING_ALWAYS); // Allow External Entities
+ XML_SetExternalEntityRefHandler(parser,externalHandler);
+ XML_SetElementHandler(parser, elementStart, elementEnd);
+
+ if(parseXmlFile(infile,parser) != 0) {
+ goto ERROR;
+ }
+ ret = 0;
+
+ERROR:
+ if(parser) {
+ XML_ParserFree(parser);
+ }
+ if(ctx.fp) {
+ fclose(ctx.fp);
+ }
+ char buf[255];
+ sprintf(buf,"cat %s >> %s",TMPFILE,OUTFILE);
+ printf("%s\n",buf);
+ system(buf);
+ unlink(TMPFILE);
+ return ret;
+}
+
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp b/video_in_hal/systemservice/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp
new file mode 100755
index 0000000..531b701
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp
@@ -0,0 +1,138 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "system_service/tskm_xml_data.h"
+
+#include <boost/algorithm/string.hpp>
+#include <fstream>
+#include <iostream>
+#include <string>
+#include <list>
+
+#include "system_service/tskm_svc.h"
+
+#include "system_service/tskm_svcid.h"
+#include "tskm_debug.h"
+#include "tskm_comm.h"
+#include "tskm_auto_build.h" // Generated data from XML
+
+// This size depends on the size of the TM area of CL_Monitor
+#define TSKM_SVC_ID_MAX_SIZE 1024
+
+/***********************************************************************
+ * tskm_initServiceList
+ ***********************************************************************/
+int tskm_initServiceList(TSKM_SVCS_CTX_t* p_svcs, int iFd) {
+ uint32_t ii;
+
+ p_svcs->svcNum = sizeof(serviceList) / sizeof(TSKM_SVC_CTX_t);
+ p_svcs->svcList = serviceList;
+
+ // It is initialized with the Inotify floppy disk.
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ serviceList[ii].attr = &serviceAttr[ii];
+ serviceList[ii].iFd = iFd;
+ if (serviceList[ii].attr->svcId >= TSKM_SVC_ID_MAX_SIZE) {
+ TSKM_ASSERT(0);
+ return -1;
+ }
+ }
+
+ const char* nfsenv = getenv("AGL_NFS");
+ bool isNfs = (nfsenv && strcmp(nfsenv, "y") == 0) ? true : false;
+
+ // For NFS environments, replace the PATH with CAP with /tmp
+ if (isNfs) {
+ std::list<std::string> capFiles;
+ const std::string capPath("/usr/debug/share/target/cap.lst");
+ std::ifstream fin(capPath.c_str());
+ std::string line;
+ while (fin && std::getline(fin, line)) {
+ std::list<std::string> strList;
+ try { // throw exception by boost::split
+ boost::split(strList, line, boost::is_any_of("|"));
+ if (!strList.empty()) {
+ if (strList.front()[0] == '/') { // Only character strings beginning with '/' are considered PATH
+ capFiles.push_back(strList.front().c_str());
+ }
+ }
+ } catch (...) {
+ TSKM_ASSERT(0);
+ }
+ }
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ std::string binPath(serviceList[ii].attr->path);
+
+ for (std::list<std::string>::iterator ite = capFiles.begin();
+ ite != capFiles.end(); ite++) {
+ if (binPath == *ite) {
+ std::list<std::string> nodes;
+ try { // throw exception by boost::split
+ boost::split(nodes, binPath, boost::is_any_of("/"));
+ std::string *p_newPath = new std::string("/tmp/"); // Intent not to free up memory
+ *p_newPath += nodes.back();
+ TSKM_PRINTF(TSKM_LOG_STATE, "EXCHG %s", p_newPath->c_str());
+ serviceList[ii].attr->path = p_newPath->c_str();
+ break;
+ } catch (...) {
+ TSKM_ASSERT(0);
+ }
+ }
+ }
+ }
+ }
+
+ // If there is no socket resource equal to the number of services + 1 (internal control connection), a compilation error occurs
+ TSKM_STATIC_ASSERT(TSKM_COMM_CONNECT_MAX >= (TSKM_SVC_NUM+1));
+
+ return 0;
+}
+
+/***********************************************************************
+ * tskm_initWakeupCtx
+ ***********************************************************************/
+void tskm_initWakeupCtx(TSKM_GSTEP_CTX_t* p_wakeup, BOOL isVupMode) {
+ memset(p_wakeup, 0, sizeof(*p_wakeup));
+
+ if (isVupMode) {
+ p_wakeup->gstepNum = sizeof(wakeupGstepVup) / sizeof(TSKM_GSTEP_t);
+ p_wakeup->gstep = wakeupGstepVup;
+ } else {
+ p_wakeup->gstepNum = sizeof(wakeupGstep) / sizeof(TSKM_GSTEP_t);
+ p_wakeup->gstep = wakeupGstep;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "gstep(wakeup):%d", p_wakeup->gstepNum);
+}
+
+/***********************************************************************
+ * tskm_initDownCtx
+ ***********************************************************************/
+void tskm_initDownCtx(TSKM_GSTEP_CTX_t* p_down, BOOL isVupMode) {
+ memset(p_down, 0, sizeof(*p_down));
+
+ if (isVupMode) {
+ p_down->gstepNum = sizeof(downGstepVup) / sizeof(TSKM_GSTEP_t);
+ p_down->gstep = downGstepVup;
+ } else {
+ p_down->gstepNum = sizeof(downGstep) / sizeof(TSKM_GSTEP_t);
+ p_down->gstep = downGstep;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "gstep(down):%d", p_down->gstepNum);
+}
+
diff --git a/video_in_hal/systemservice/task_manager/client/libtskmcfg/tskm_cfg.xml b/video_in_hal/systemservice/task_manager/client/libtskmcfg/tskm_cfg.xml
new file mode 100755
index 0000000..2898f44
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/libtskmcfg/tskm_cfg.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" ?>
+
+<!DOCTYPE tskm_cfg [
+ <!ELEMENT tskm_cfg (service_list,normal_wakeup,normal_shutdown,vup_wakeup,vup_shutdown) >
+
+ <!-- service list -->
+ <!ELEMENT service_list (service+) >
+ <!ELEMENT service (subgid_list*) >
+ <!ATTLIST service
+ svcid ID #REQUIRED
+ name CDATA #REQUIRED
+ path CDATA #REQUIRED
+ type (native|unknown) "native"
+ prio CDATA #REQUIRED
+ policy (fifo|tss|rr) #REQUIRED
+ life_cycle (always|always_recoverable|dynamic) "dynamic"
+ retry_cnt CDATA "1"
+ cpu_assign (cpu0|cpu1|auto) "auto"
+ user CDATA #REQUIRED
+ runtime_limit CDATA #IMPLIED
+ cpu_limit CDATA #IMPLIED
+ mem_limit CDATA #IMPLIED
+ args CDATA #IMPLIED
+ shutdown_wait (yes|no) #REQUIRED
+ >
+
+ <!ELEMENT subgid_list (subgid+) >
+ <!ELEMENT subgid EMPTY >
+ <!ATTLIST subgid
+ gid CDATA #REQUIRED
+ >
+
+
+ <!-- Starting/terminating of services -->
+ <!ELEMENT normal_wakeup (global_step+) >
+ <!ELEMENT normal_shutdown (global_step+) >
+ <!ELEMENT vup_wakeup (global_step+) >
+ <!ELEMENT vup_shutdown (global_step+) >
+
+ <!ELEMENT global_step (exec_list?,request_list?,next_trans_condition?) >
+ <!ATTLIST global_step
+ stepid ID #IMPLIED
+ >
+
+ <!ELEMENT exec_list (exec_svc+) >
+ <!ELEMENT exec_svc EMPTY >
+
+ <!ATTLIST exec_svc
+ svcid IDREF #REQUIRED
+ >
+
+ <!ELEMENT request_list (request+) >
+ <!ELEMENT request EMPTY >
+ <!ATTLIST request
+ svcid IDREF #REQUIRED
+ local_step (shm|bupchk|1|2|3|4|5|6|7|8|9|last|all) #REQUIRED
+ >
+
+ <!ELEMENT next_trans_condition EMPTY>
+ <!ATTLIST next_trans_condition
+ cond CDATA #REQUIRED
+ >
+
+ <!ENTITY service_list_xml SYSTEM "tskm_launch.xml">
+ <!ENTITY normal_wakeup_xml SYSTEM "tskm_wakeup.xml">
+ <!ENTITY normal_shutdown_xml SYSTEM "tskm_shutdown.xml">
+ <!ENTITY vup_wakeup_xml SYSTEM "tskm_wakeup_vup.xml">
+ <!ENTITY vup_shutdown_xml SYSTEM "tskm_shutdown_vup.xml">
+]>
+
+
+<tskm_cfg>
+ &service_list_xml;
+
+ &normal_wakeup_xml;
+
+ &normal_shutdown_xml;
+
+ &vup_wakeup_xml;
+
+ &vup_shutdown_xml;
+
+</tskm_cfg>
diff --git a/video_in_hal/systemservice/task_manager/client/ss_data_init/Makefile b/video_in_hal/systemservice/task_manager/client/ss_data_init/Makefile
new file mode 100755
index 0000000..920fbea
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/ss_data_init/Makefile
@@ -0,0 +1,43 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#######################################
+#######################################
+INST_SHLIBS := libss_data_init
+
+MKDATAINIT=mkdatainit.sh
+
+INST_HEADERS = tskm_data_init.h task_manager_libss_data_init.h
+
+VPATH = ./include/$(COMPONENT_NAME)
+CPPFLAGS += -I./include/ -I./../../server/include -I./../libtskmcfg/include
+
+libss_data_init_SRCS := tskm_data_init.cpp
+libss_data_init_PCOS := $(shell ls ./obj/*.os)
+
+$(libss_data_init_SRCS): $(libss_data_init_PCOS)
+ set -e ; \
+ sh $(MKDATAINIT)
+
+######## add compile option ########
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -fno-exceptions
+
+CLEAN_FILES=$(libss_data_init_SRCS)
+
+LDLIBS = -Wl,-Bdynamic -lNS_FrameworkUnified
+
+include ../../../system_service.mk
diff --git a/video_in_hal/systemservice/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h b/video_in_hal/systemservice/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h
new file mode 100755
index 0000000..39422e9
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_LIBSS_DATA_INIT_TASKMANAGERLOG_H_
+#define TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_LIBSS_DATA_INIT_TASKMANAGERLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10) // library common def
+#define ZONE_FUNC ZONEMASK(11) // library common def
+#define ZONE_MEM ZONEMASK(12) // library common def
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29) // library common def
+#define ZONE_WARN ZONEMASK(30) // library common def
+#define ZONE_ERR ZONEMASK(31) // library common def
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INFO
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+extern FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams;
+
+#endif // TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_LIBSS_DATA_INIT_TASKMANAGERLOG_H_
diff --git a/video_in_hal/systemservice/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h b/video_in_hal/systemservice/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h
new file mode 100755
index 0000000..e3bdfc5
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief \~english This file include tskm_data_init.h
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef SYSTEMSERVICE_TASKMNAGERLIBSSDATAINIT_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_TASKMNAGERLIBSSDATAINIT_H_
+
+#include "system_service/tskm_data_init.h"
+
+#endif // SYSTEMSERVICE_TASKMNAGERLIBSSDATAINIT_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h b/video_in_hal/systemservice/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h
new file mode 100755
index 0000000..8cb49d6
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * @file tskm_data_init.h
+ * @brief \~english This file contains API of initial task manager data
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_SYSTEM_SERVICE_TSKM_DATA_INIT_H_
+#define TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_SYSTEM_SERVICE_TSKM_DATA_INIT_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_if.h>
+#include "system_service/tskm_type.h"
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_GetExtBootInfo
+/// \~english @par Summary
+/// Gets boot extended information.
+/// \~english @param [in] p_info
+/// T_SS_SM_START_ExtDataStructType * - Boot extended information
+/// \~english @code
+/// typedef struct {
+/// BOOL isProgUpdated;
+/// EMRelaunchStatus relaunchStatus;
+/// BOOL isMapUpdated;
+/// BOOL isMapDiffUpdated;
+/// uint8_t reserved[];
+/// }T_SS_SM_START_ExtDataStructType;
+/// @endcode
+/// \~english @retval TSKM_E_OK Normal end
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions
+/// - None
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_info is NULL. [TSKM_E_PAR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail
+/// Is available only at the functions defined by using TSKM_DATA_INIT_FUNC.
+/// \~english @see TSKM_DATA_INIT_FUNC
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_DATA_INIT_FUNC
+/// \~english @par Summary
+/// Defines callback functions to initialize data.
+/// \~english @param [in] serviceName
+/// const char* - Service name
+/// \~english @param [in] argName
+/// const T_SS_SM_START_DataStructType* - Argument name
+/// \~english @code
+/// typedef struct T_SS_SM_START_DataStruct{
+/// EPWR_WAKEUP_FACTOR_TYPE startupReason;
+/// BOOL isUserModeOn;
+/// ESMDataResetModeInfo dataResetMode;
+/// EPWR_SC_SECURITY_STATUS securityStatus;
+/// EPWR_SC_WAKEUP_TYPE wakeupType;
+/// ESMDramBackupStatus dramBackupStatus;
+/// ESMResetStatus resetStatus;
+/// UI_32 resetCount;
+/// } T_SS_SM_START_DataStructType;
+/// @endcode
+/// \~english @retval eFrameworkunifiedStatusOK Normal
+/// \~english @retval eFrameworkunifiedStatusFail Check error
+/// \~english @par Preconditions
+/// - None
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - Return values depend on the mount of callback functions. [eFrameworkunifiedStatusFail]
+/// \~english @par Classification
+/// Public
+/// \~english @par Detail
+/// Defines the callback functions to initialize data. \n
+/// The callback functions defined by this macro are executed at a timing
+/// when boot factor is fixed after booting the system. \n
+/// (Task_Manager executes Callback prior to the boot of ActivityManager.)\n
+/// If each service mounts and installs initialization functions, Task_Manager boots it
+/// at a timing when data initialization is necessary. \n
+/// Each service can install the object file of initialization functions by setting them
+/// to MAKE variables INST_DATAINITOBJ of Makefile.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+#define TSKM_DATA_INIT_FUNC(ServiceName, ArgName) \
+ EFrameworkunifiedStatus tskm_ ## ServiceName ## _data_init(T_SS_SM_START_DataStructType* ArgName)
+
+#endif // TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_SYSTEM_SERVICE_TSKM_DATA_INIT_H_
+/** @}*/ // end of Task_Manager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/task_manager/client/ss_data_init/include/tskm_data_init_local.h b/video_in_hal/systemservice/task_manager/client/ss_data_init/include/tskm_data_init_local.h
new file mode 100755
index 0000000..9d77d19
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/ss_data_init/include/tskm_data_init_local.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_TSKM_DATA_INIT_LOCAL_H_
+#define TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_TSKM_DATA_INIT_LOCAL_H_
+
+#include "system_service/tskm_data_init.h"
+
+extern void tskm_dataInitAll(T_SS_SM_START_DataStructType *arg,
+ T_SS_SM_START_ExtDataStructType *extArg);
+
+#endif // TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_TSKM_DATA_INIT_LOCAL_H_
diff --git a/video_in_hal/systemservice/task_manager/client/ss_data_init/mkdatainit.sh b/video_in_hal/systemservice/task_manager/client/ss_data_init/mkdatainit.sh
new file mode 100755
index 0000000..802fbd9
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/ss_data_init/mkdatainit.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+#
+# Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+cp tskm_data_init.cpp.in tskm_data_init.cpp.tmp
+
+LF=$(printf '\\\012_')
+LF=${LF%_}
+
+for files in `ls obj/*.os`
+do
+ serviceName=`nm -C $files | grep " T " | grep -o "tskm_[0-9a-zA-Z_]\+_data_init" | sed -e "s/^tskm_//" | sed -e "s/_data_init\$//"`
+
+ funcname="tskm_"$serviceName"_data_init"
+
+ echo $serviceName $funcname
+ sed -i "s/@DATA_INIT_PROT@/EFrameworkunifiedStatus $funcname(T_SS_SM_START_DataStructType* );$LF@DATA_INIT_PROT@/g" tskm_data_init.cpp.tmp
+ sed -i "s/@DATA_INIT_TABLE@/{\"$serviceName\", $funcname},$LF @DATA_INIT_TABLE@/g" tskm_data_init.cpp.tmp
+
+done
+
+sed -i "s/@DATA_INIT_PROT@//g" tskm_data_init.cpp.tmp
+sed "s/@DATA_INIT_TABLE@/{NULL , NULL},/g" tskm_data_init.cpp.tmp > tskm_data_init.cpp
+
+rm tskm_data_init.cpp.tmp
+
+
+
+
+
+
diff --git a/video_in_hal/systemservice/task_manager/client/ss_data_init/tskm_data_init.cpp.in b/video_in_hal/systemservice/task_manager/client/ss_data_init/tskm_data_init.cpp.in
new file mode 100755
index 0000000..072a486
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/client/ss_data_init/tskm_data_init.cpp.in
@@ -0,0 +1,66 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <system_service/tskm_data_init.h>
+#include "stdio.h"
+#include "libss_data_init_taskmanagerlog.h"
+
+
+#define ZONE_INFO ZONEMASK(29)
+
+typedef struct{
+ const char *serviceName;
+ EFrameworkunifiedStatus (*dataInitFunc)(T_SS_SM_START_DataStructType *arg);
+} FUNC_INFO_t;
+
+@DATA_INIT_PROT@
+
+const FUNC_INFO_t g_funcTbl[] = {
+ @DATA_INIT_TABLE@
+};
+
+static T_SS_SM_START_ExtDataStructType extBootInfo;
+
+TSKM_ERR_t TSKM_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info){
+ TSKM_ERR_t ret = TSKM_E_OK;
+
+ if(NULL == p_info){
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__,"p_info = NULL");
+ ret = TSKM_E_PAR;
+ }else{
+ memcpy(p_info, &extBootInfo, sizeof(*p_info));
+ }
+
+ return ret;
+}
+
+void tskm_dataInitAll(T_SS_SM_START_DataStructType *arg, T_SS_SM_START_ExtDataStructType *extArg){
+ int i;
+ int itemNum = sizeof(g_funcTbl)/sizeof(FUNC_INFO_t) - 1;
+
+ memcpy(&extBootInfo, extArg, sizeof(extBootInfo));
+
+ // LCOV_EXCL_START 10: Depends on reference information when building software
+ for(i=0;i<itemNum;i++){
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO,__FUNCTION__,"call datainit for %s",g_funcTbl[i].serviceName);
+ g_funcTbl[i].dataInitFunc(arg);
+ }
+ // LCOV_EXCL_STOP
+
+ return;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
+
diff --git a/video_in_hal/systemservice/task_manager/include-share/tskm_gstep.h b/video_in_hal/systemservice/task_manager/include-share/tskm_gstep.h
new file mode 100755
index 0000000..e2af96d
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/include-share/tskm_gstep.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_INCLUDE_SHARE_TSKM_GSTEP_H_
+#define TASK_MANAGER_INCLUDE_SHARE_TSKM_GSTEP_H_
+
+#include "system_service/tskm_local_type.h"
+#include "tskm_debug.h"
+
+/*********************************************************
+ * Get gradual startup current info
+ *********************************************************/
+inline TSKM_STATIC TSKM_BOOL_t gstepIsLast(TSKM_GSTEP_CTX_t* p_gstep) {
+ if (p_gstep->gstepNum == p_gstep->gstepIdx + 1) {
+ return TSKM_TRUE;
+ }
+ return TSKM_FALSE;
+}
+
+/*********************************************************
+ * Get gradual startup current info
+ *********************************************************/
+inline TSKM_STATIC TSKM_GSTEP_t*
+gstepGetCurrent(TSKM_GSTEP_CTX_t* p_gstep) {
+ if (p_gstep->gstepNum > p_gstep->gstepIdx) {
+ return &p_gstep->gstep[p_gstep->gstepIdx];
+ }
+ return NULL;
+}
+
+/*********************************************************
+ * Issue requests waiting for exec completion
+ *********************************************************/
+inline TSKM_STATIC TSKM_GSTEP_t*
+changeNextStep(TSKM_GSTEP_CTX_t* p_gstep) {
+ p_gstep->gstepIdx++;
+ return gstepGetCurrent(p_gstep);
+}
+
+#endif // TASK_MANAGER_INCLUDE_SHARE_TSKM_GSTEP_H_
+
diff --git a/video_in_hal/systemservice/task_manager/include-share/tskm_type_local.h b/video_in_hal/systemservice/task_manager/include-share/tskm_type_local.h
new file mode 100755
index 0000000..8ead34e
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/include-share/tskm_type_local.h
@@ -0,0 +1,52 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_INCLUDE_SHARE_TSKM_TYPE_LOCAL_H_
+#define TASK_MANAGER_INCLUDE_SHARE_TSKM_TYPE_LOCAL_H_
+
+#define NTFY_SS_TaskManager_Availability SS_TASK_MANAGER"/Availability"
+
+//*******************************************************
+// Legacy types:
+// Definition is retained because it is referenced by another module
+//******************************************************
+
+// Shared LOG with version upgrade
+#define STATEMGR__CWORD69_LOG_SIZE 176 /* STATEMGR__CWORD69_LOG */
+typedef struct {
+ uint8_t old_Ver[8];
+ uint8_t new_Ver[8];
+} STATEMGR__CWORD69_LOG_VERSION_T;
+
+typedef struct {
+ STATEMGR__CWORD69_LOG_VERSION_T ver;
+ uint8_t status;
+ uint8_t dummy[3];
+} STATEMGR__CWORD69_LOG_VUPINFO_T;
+
+typedef struct {
+ uint32_t seqnum; /* Set value (for chequence check) */
+ uint32_t normalnum; /* Set value (for route check) */
+ uint32_t errornum; /* Set value (for NG check) */
+} STATEMGR__CWORD69_LOG_PROC;
+
+typedef struct {
+ STATEMGR__CWORD69_LOG_VUPINFO_T VerInfo[7]; /* Store version info */
+ STATEMGR__CWORD69_LOG_PROC proc[3]; /* Store logs for analysis */
+} STATEMGR__CWORD69_LOG;
+
+#endif // TASK_MANAGER_INCLUDE_SHARE_TSKM_TYPE_LOCAL_H_
+
diff --git a/video_in_hal/systemservice/task_manager/include-share/tskm_util.h b/video_in_hal/systemservice/task_manager/include-share/tskm_util.h
new file mode 100755
index 0000000..83665aa
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/include-share/tskm_util.h
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_INCLUDE_SHARE_TSKM_UTIL_H_
+#define TASK_MANAGER_INCLUDE_SHARE_TSKM_UTIL_H_
+
+#include "system_service/tskm_local_type.h"
+#include "tskm_main.h"
+
+// inline MACRO
+#define TSKM_ERR_CHK(ret, expect, lavel) \
+ if (ret != expect) {TSKM_ASSERT(0); goto lavel;}
+
+#define TSKM_ERR_CHK_DFT TSKM_ERR_CHK(tskmRet, TSKM_E_OK, ERROR)
+
+#define TSKM_MAX(a, b) ((a) > (b) ? (a) : (b))
+
+#endif // TASK_MANAGER_INCLUDE_SHARE_TSKM_UTIL_H_
+
diff --git a/video_in_hal/systemservice/task_manager/server/Makefile b/video_in_hal/systemservice/task_manager/server/Makefile
new file mode 100755
index 0000000..7e7bfbd
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/Makefile
@@ -0,0 +1,67 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+#######################################
+INST_PROGS = tskmgr
+
+######### add source path #############
+######### add local value #############
+VPATH = ./src ./../client/libtskm ./../client/libtskmcfg/include/$(COMPONENT_NAME)
+
+tskmgr_SRCS += tskm_main.cpp
+
+######### compiled sources #############
+tskmgr_SRCS += tskm_api.cpp \
+ tskm_state.cpp \
+ tskm_wakeup.cpp \
+ tskm_shutdown.cpp \
+ tskm_svc.cpp \
+ tskm_watch.cpp \
+ tskm_debug.cpp \
+ tskm_comm.cpp \
+ tskm_port_pf.cpp \
+ tskm_port_subsys.cpp \
+ tskm_srvr_stub.cpp
+
+
+
+######### add include path #############
+CPPFLAGS = -I./include/ -I./../include-share/ -I./../client/ss_data_init/include/ -I./../client/libtskmcfg/include/ -I./../client/libtskm/
+######### add compile option ###########
+CPPFLAGS += -fno-exceptions
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+######### add library path #############
+LDFLAGS += -L./../client/ss_data_init -L./../client/libtskmcfg
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lrt # for mq_xxx
+LDLIBS += -Wl,-Bdynamic -lss_data_init
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lresm
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lvp
+LDLIBS += -Wl,-Bdynamic -lrpc -lev
+
+#LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI
+LDLIBS += -Wl,-Bdynamic -ltskmcfg
+
+
+LINK_CXX=Y
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/task_manager/server/include/system_service/INI_API.h b/video_in_hal/systemservice/task_manager/server/include/system_service/INI_API.h
new file mode 100755
index 0000000..871be5e
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/system_service/INI_API.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file INI_API.h
+ * @brief \~english This file include INI_API.hpp
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_INI_API_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_INI_API_H_
+
+#include "system_service/INI_API.hpp"
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_INI_API_H_
diff --git a/video_in_hal/systemservice/task_manager/server/include/system_service/INI_API.hpp b/video_in_hal/systemservice/task_manager/server/include/system_service/INI_API.hpp
new file mode 100755
index 0000000..00fe733
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/system_service/INI_API.hpp
@@ -0,0 +1,738 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file INI_API.hpp
+ * @brief \~english This file provide api to operating INI
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef _INI_API_HPP_
+#define _INI_API_HPP_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_if.h>
+#include "system_service/Primary_common.h"
+
+#define INI_SUCCESS 0 /* Normal */
+#define INI_FALSE -1 /* Failed */
+
+#define INI_FD_MAX 3
+
+// Only the information required for event completion notification is left
+// Gradual startup
+#define INI_INITCOMP_NONE 0x0000000000000000LLU
+#define INI_INITCOMP_ON_START 0x0000000000000001LLU /* ON_START */
+#define INI_INITCOMP_NVM_ACCESS 0x0000000000000002LLU /* NVM ACCESS */
+
+#define INI_INITCOMP_TEST0 0x1000000000000000LLU /* for test */
+#define INI_INITCOMP_TEST1 0x2000000000000000LLU /* for test */
+#define INI_INITCOMP_TEST2 0x4000000000000000LLU /* for test */
+#define INI_INITCOMP_TEST3 0x8000000000000000LLU /* for test */
+
+// Gradual termination
+#define INI_TERMCOMP_NONE 0x0000000000000000LLU
+#define INI_TERMCOMP_ACTIVITYMGR 0x0000000000000001LLU /* Terminate ActivityManager */
+#define INI_TERMCOMP_RESIDENT 0x0000000000000002LLU /* Terminate regident SVC */
+#define INI_TERMCOMP_TRANSIENT 0x0000000000000004LLU /* Terminate non-regident SVC */
+
+#define INI_TERMCOMP_TEST0 0x1000000000000000LLU /* for test */
+#define INI_TERMCOMP_TEST1 0x2000000000000000LLU /* for test */
+#define INI_TERMCOMP_TEST2 0x4000000000000000LLU /* for test */
+#define INI_TERMCOMP_TEST3 0x8000000000000000LLU /* for test */
+
+
+
+typedef struct _T_PRIM_PRM{
+ PCSTR name;
+ const PRIM_SHAREDATA_TBL* shmTbl;
+ const PRIM_EXFUNC_TBL* wakeupExFuncTbl;
+ const PRIM_EXFUNC_TBL* downExFuncTbl;
+ EFrameworkunifiedStatus (*onInit)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onDestory)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onDebugDump)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onTouch)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onLowMem)(HANDLE hApp);
+ void* priv;
+ _T_PRIM_PRM(){
+ name = NULL;
+ shmTbl = NULL;
+ wakeupExFuncTbl = NULL;
+ downExFuncTbl = NULL;
+ onInit = NULL;
+ onDestory = NULL;
+ onDebugDump = NULL;
+ onTouch = NULL;
+ onLowMem = NULL;
+ priv = NULL;
+ }
+}T_PRIM_PRM;
+
+
+typedef struct {
+ BOOL bIsRun;
+ uint32_t timeout;
+}T_PRIM_MONITOR_PRM;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Main
+/// \~english @par Summary:
+/// Runs the main thread of primary library.
+/// \~english @param [in] p_prm
+/// T_PRIM_PRM - The pointer to the parameter table of primary library
+/// \~english @param [in] argc
+/// int - The number of command parameters (The parameters passed to main functions must be set without processing.)
+/// \~english @param [in] argv
+/// char* - Command parameters (The parameters passed to main functions must be set without processing.)
+/// \~english @par
+/// - Shared memory creation table \n
+/// In process running, register the shared memory to create.\n
+/// This creates the shared memory to be registered in process running and releases it in process end.\n
+/// This must terminate by adding {"\0"} into member shmName of table termination.\n
+/// It is able to access to the shared memory to have been created by shm_open.\n
+/// \~english @code
+/// typedef struct {
+/// char shmName[32]; /* Shared memory name */
+/// uint32_t size; /* Shared memory size (BYTE) */
+/// }PRIM_SHAREDATA_TBL;
+/// @endcode
+/// \~english @par
+/// - Running extended function table / End extended function table \n
+/// Registers callback functions to be called in process start and exit.\n
+/// This must terminate by adding NULL into member func of table termination.\n
+/// Parameters prm of callback functions are User private information and the pointer designated by prm is passed as input parameters [in].\n
+/// Local phase numbers callback func by the designated phase numbers.\n
+/// \~english @code
+/// typedef struct {
+/// void (* func)( void* prm); /* Callback functions for function extension */
+/// void* prm; /* The pointer to the parameters of Callback function func */
+/// uint8_t localStep; /* Local phase numbers */
+/// uint8_t rsv[3]; /* Reserve for alignment */
+/// }PRIM_EXFUNC_TBL;
+/// @endcode
+/// \~english @par
+/// - %Parameter table of primary library\n
+/// For FrameworkunifiedOnInitialization/FrameworkunifiedOnDestroy/FrameworkunifiedOnDebugDump/TaskmanagerOnTouch/FrameworkunifiedOnLowMemory, check the corresponding API specification.\n
+/// It is able to get User private data by INI_GetPrivate().\n
+/// \~english @code
+/// typedef struct _T_PRIM_PRM{
+/// PCSTR name; /* Application name */
+/// const PRIM_SHAREDATA_TBL* shmTbl; /* The pointer to shared memory creation table */
+/// const PRIM_EXFUNC_TBL* wakeupExFuncTbl; /* The pointer to running extended function table */
+/// const PRIM_EXFUNC_TBL* downExFuncTbl; /* The pointer to end extended function table */
+/// EFrameworkunifiedStatus (*onInit)(HANDLE hApp); /* FrameworkunifiedOnInitialization callback function setting */
+/// EFrameworkunifiedStatus (*onDestory)(HANDLE hApp); /* FrameworkunifiedOnDestroy callback function setting */
+/// EFrameworkunifiedStatus (*onDebugDump)(HANDLE hApp); /* FrameworkunifiedOnDebugDump Callback function setting */
+/// EFrameworkunifiedStatus (*onTouch)(HANDLE hApp); /* TaskmanagerOnTouch callback function setting */
+/// EFrameworkunifiedStatus (*onLowMem)(HANDLE hApp); /* FrameworkunifiedOnLowMemory callback function setting */
+/// void* priv; /* User private data */
+/// }T_PRIM_PRM;
+/// @endcode
+/// \~english @retval INI_SUCCESS Normal end
+/// \~english @retval INI_FALSE Abnormal end
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the shared memory creation table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the running extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the end extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnInitialization callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDestroy callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDebugDump callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of TaskmanagerOnTouch callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail:
+/// This executes the main processing of primary library. Functions do not return until all of end processing of process is completed. \n
+/// Normal end returns INI_SUCCESS and abnormal end does INI_FALSE. \n
+/// User process must return this function's returned values as the returned values of main function and end main function. \n
+/// \~english @see INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int INI_Main(T_PRIM_PRM* p_prm,int argc,char* argv[]);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_ExitStart
+/// \~english @par Summary:
+/// Starts the end processing of process.
+/// \~english @param [in] rsv
+/// void* - The pointer to reservation parameters (NULL must be appointed)
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Collects the resource which primary library got, does the end processing equal to local_step=all and end process. \n
+/// (At the end processing in abnormality, process must be ended by not this function but exit(),_exit() function immediately) \n
+/// When this API is called after this API is already called, do nothing to process.
+/// \~english @par Supplemtent:
+/// local_step is the information defined in default_wakeup.xml/default_shutdown.xml as the definition of running order / end order. \n
+/// local_step defined in default_shutdown.xml has the following types.
+/// - 1-9 : Designates local phase numbers (the phase numbers of end processing)
+/// - last : This designates local phase numbers to be last. When there is the local phase processing not to be executed, this executes all.
+/// - all : The same as last.
+/// \~english @see INI_Main, INI_Init, INI_ExitDone
+////////////////////////////////////////////////////////////////////////////////////
+void INI_ExitStart(void* rsv); // Termination process start
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_ExitDone
+/// \~english @par Summary:
+/// Notifies the completion of process end processing.
+/// \~english @param [in] status
+/// int - Unused (This is for future extension. 0 must be designated.)
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Notifies the completion of service end processing to TaskManager. \n
+/// TaskManager ends the corresponding service by this notification. At the time, this callbacks FrameworkunifiedOnDestroy(). \n
+/// \~english @see INI_Main, INI_Init, INI_ExitStart
+////////////////////////////////////////////////////////////////////////////////////
+void INI_ExitDone(int status); // Termination process completed
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetPrivate
+/// \~english @par Summary:
+/// Gets private data.
+/// \~english @param None
+/// \~english @retval void* The pointer to user private data
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called and user private data must be set.
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets the private data designated at INI_Main/INI_Init from the inside of the context management information of the process inside primary library and returns it.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+void* INI_GetPrivate();
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetHandle
+/// \~english @par Summary:
+/// Gets the application handle of NSFW.
+/// \~english @param None
+/// \~english @retval void*(HANDLE) The application handle of NSFW
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called and the application handle of NSFW must be generated.
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets the application handle of NSFW from the inside of the context management information of the process inside primary library and returns it.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+void* INI_GetHandle();
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_SetMonitorTimeout
+/// \~english @par Summary:
+/// Requests the change for abnormality monitoring timeout time to Task Manager. \n
+/// (This is used when main thread is not implemented at service side)
+/// \~english @param [in] timeout
+/// uint32_t - Abnormality monitoring timeout time (sec)(When 0 is designated, the service must be out of abnormality monitoring object.)
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_Main()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sets the abnormality monitoring timeout time designated by parameters inside the context management information of the process inside primary library and returns returned values and INI_SUCCESS. \n
+/// Set timeout time becomes valid after the event waiting at the loop of main thread and this requests the change for service abnormality monitoring timeout time to TaskManager. In other words, this API can be used after running extended function Callback. \n
+/// When process does not return to main thread past the timeout time designated by this function, TaskManager ends the service forcibly. When this function is not called, TaskManager treats the timeout of monitoring time as 50 seconds.
+/// \~english @see INI_Main
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_SetMonitorTimeout(uint32_t timeout);
+
+// Event completion notification
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_StepForkComp
+/// \~english @par Summary:
+/// Notifies the completion of running event to TaskManager.
+/// \~english @param [in] compId
+/// uint64_t - The comparison ID for phase running (Designates INI_INITCOMP_[a-zA-Z_]+ to define at INI_API.hpp)
+/// \~english @par
+/// The ID descripted at INI_API.hpp
+/// \~english @code
+/// - INI_INITCOMP_NONE: None
+/// - INI_INITCOMP_ON_START: For ON Start
+/// - INI_INITCOMP_NVM_ACCESS: For NVM access
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called.
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The sending of the completion notification of running event to TaskManager failed [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sends the comparison ID for phase running as the completion notification of running event to TaskManager. If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE. \n
+/// TaskManager holds which completion notification of running event is notified and can add it to the transition conditions to next phase at phase running. \n
+/// The way to add at TaskManager side depends on the definition of next_trans_condition element described in default_wakeup.xml as the definition of running order.
+/// \~english @par Supplement:
+/// next_trans_condition is the element to designate transition conditions to next phase. The transition to next phase is done when the following two conditions are met. \n
+/// When the description of next_trans_condition element is omitted, transition is done only by condition 1. \n
+/// 1. All of the phase running request processing set by request element is completed. (The phase running request processing is executed by primary library asynchronously) \n
+/// 2. The completion notification of the event designated by next_trans_condition element is completed. \n
+/// Waiting conditions for event completion notification INI_INITCOMP_[A-Z]+ stipulated at INI_API.hpp is set in cond property designated at next_trans_condition element. \n
+/// AND condition can be set by being INI_INITCOMP_AAAA| INI_INITCOMP_BBBB when conditions are some. \n
+/// Event completion notification can be issued by using INI_StepForkComp.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_StepForkComp(uint64_t compId);
+
+// Event completion notification
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_AccOffComp
+/// \~english @par Summary:
+/// Notifies end event completion notification to TaskManager.
+/// \~english @param [in] compId
+/// uint64_t - The comparison ID for phase running (Designates INI_TERMCOMP_[a-zA-Z_]+ defined at INI_API.hpp)
+/// \~english @par
+/// The ID described at INI_API.hpp
+/// \~english @code
+/// - INI_TERMCOMP_NONE : None
+/// - INI_TERMCOMP_ACTIVITYMGR : For ActivityManager end
+/// - INI_TERMCOMP_RESIDENT : For resident service end
+/// - INI_TERMCOMP_TRANSIENT : For non-resident service end
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The sending of the completion notification of end event to TaskManager failed [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sends the comparison ID for phase running as the completion notification of end event to TaskManager. If it succeeded, returns INI_SUCCESS and if it failed, return INI_FALSE. \n
+/// TaskManager holds which completion notification of end event is notified and can add it to the transition conditions to next phase at phase end. \n
+/// The way to add at TaskManager side depends on the definition of next_trans_condition element described in default_shutdown.xml as the definition of end order.
+/// \~english @par Supplement:
+/// next_trans_condition is the element to designate transition conditions to next phase. The transition to next phase is done when the following two conditions are met. \n
+/// When the description of next_trans_condition element is omitted, transition is done only by condition 1. \n
+/// 1. All of the phase end request processing set by request element is completed. (The phase end request processing is executed by primary library asynchronously) \n
+/// 2. The completion notification of the event designated by next_trans_condition element is completed. Waiting conditions for event completion notification INI_INITCOMP_[A-Z]+ stipulated at INI_API.hpp is set in cond property designated at next_trans_condition element. \n
+/// AND condition can be set by being INI_INITCOMP_AAAA| INI_INITCOMP_BBBB when conditions are some. \n
+/// Event completion notification can be issued by using INI_ AccOffComp.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_AccOffComp(uint64_t compId);
+
+// Get boot info
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetBootInfo
+// \~english @par Summary:
+/// Gets boot information.
+/// \~english @param [in] info
+/// T_SS_SM_START_DataStructType * - The pointer to boot information structure
+/// \~english @par
+/// T_SS_SM_START_DataStructType structure
+/// \~english @code
+/// typedef struct T_SS_SM_START_DataStruct{
+/// EPWR_WAKEUP_FACTOR_TYPE startupReason; /* Startup reason */
+/// BOOL isUserModeOn; /* User mode ON/OFF */
+/// ESMDataResetModeInfo dataResetMode; /* Data reset mode */
+/// EPWR_SC_SECURITY_STATUS securityStatus; /* Security state */
+/// EPWR_SC_WAKEUP_TYPE wakeupType; /* Battery disconnection state */
+/// ESMDramBackupStatus dramBackupStatus; /* Backup memory area state */
+/// ESMResetStatus resetStatus; /* Reset state */
+/// UI_32 resetCount; /* Abnormal reboot number */
+/// } T_SS_SM_START_DataStructType;
+///
+/// Startup reason type:
+/// - epswfIGN_ACC : Ignition ACC (Currently, Fixed)
+/// User mode ON/OFF:
+/// - TRUE : User mode ON (Currently, Fixed)
+/// Data reset mode:
+/// - e_SS_SM_DATA_RESET_NONE: Not-initialized
+/// - e_SS_SM_DATA_RESET_USER: User data initialization
+/// - e_SS_SM_DATA_RESET_FACTORY: Factory initialization
+/// Security state:
+/// - epsssUNLOCK : Unlock state
+/// - epsssLOCK : Lock state
+/// Battery disconnection state:
+/// - epsstWARMSTART : Battery disconnection does not occur
+/// - epsstCOLDSTART : Battery disconnection occurs
+/// Backup memory area state:
+/// - e_SS_SM_DRAM_BACKUP_OK: Backup OK of Backup memory area
+/// - e_SS_SM_DRAM_BACKUP_NG: Backup NG of Backup memory area
+/// Reset state:
+/// - e_SS_SM_RESET_STATUS_UNSET: Information unsetting(Not decided yet)
+/// - e_SS_SM_RESET_STATUS_NONE : Normal
+/// - e_SS_SM_RESET_STATUS_NG : Abnormality occurred (Abnormal RESET or booting after service abnormal end)
+/// - e_SS_SM_RESET_STATUS_IMMEDIATE : Immediate RESET occurred
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called. (%Process running must be completed)
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to boot information structure designated at parameters is NULL [INI_FALSE]
+/// - Startup reason type inside the context management information of the process inside primary library is wrong (%Process running is not completed) [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets boot information which is managed inside the context management information of the process inside primary library.
+/// If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE. \n
+/// This sets valid values as info values in FrameworkunifiedOnStart of TaskManager. In other words, this sets valid values after running ActivityManager.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_GetBootInfo(T_SS_SM_START_DataStructType *info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetExtBootInfo
+/// \~english @par Summary:
+/// Gets boot extended information.
+/// \~english @param [in] info
+/// T_SS_SM_START_ExtDataStructType * - The pointer to boot extended information structure
+/// \~english @par
+/// T_SS_SM_START_ExtDataStructType structure
+/// \~english @code
+/// #define SS_SM_START_EXT_INFO_SIZE 64
+/// #define SS_SM_START_EXT_BODY_SIZE ( sizeof(BOOL)
+/// + sizeof(EMRelaunchStatus)
+/// + sizeof(BOOL)
+/// + sizeof(BOOL)
+/// )
+/// define SS_SM_START_EXT_RSV_SIZE SS_SM_START_EXT_INFO_SIZE
+/// - SS_SM_START_EXT_BODY_SIZE
+/// typedef struct {
+/// BOOL isProgUpdated; /* Program update information */
+/// EMRelaunchStatus relaunchStatus; /* Own-service Relaunch state */
+/// BOOL isMapUpdated; /* Map update information */
+/// BOOL isMapDiffUpdated; /* Map difference update information */
+/// uint8_t reserved[SS_SM_START_EXT_RSV_SIZE]; /* Reserve area */
+/// } T_SS_SM_START_ExtDataStructType;
+///
+/// Program update information
+/// - TRUE : Program update
+/// - FALSE : No Program update
+/// Own-service Relaunch state:
+/// - e_SS_SM_RELAUNCH_STATUS_NONE : Relaunch does not occur (Initial boot)
+/// - e_SS_SM_RELAUNCH_STATUS_SAFE : Normal Relaunch
+/// - e_SS_SM_RELAUNCH_STATUS_ERR : Abnormal Relaunch
+/// Map update information:
+/// - TRUE : Map update
+/// - FALSE : No Map update
+/// Map difference update information
+/// - TRUE : Map difference update
+/// - FALSE : No Map difference update
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called. (%Process running must be completed.)
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to boot information structure designated at parameters is NULL [INI_FALSE]
+/// - Startup reason type inside the context management information of the process inside primary library is wrong (%Process running is not completed) [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets boot extended information which is managed inside the context management information of the process inside primary library.
+/// If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE \n
+/// This sets valid values as info values in FrameworkunifiedOnStart of TaskManager. In other words, this sets valid values after running ActivityManager.
+/// Because TaskManager does not have Relaunch function, always sets e_SS_SM_RELAUNCH_STATUS_NONE in relaunchStatus.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *info);
+
+//withoutMainLoop
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Init
+/// \~english @par Summary:
+/// Initializes primary library. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param [in] p_prm
+/// T_PRIM_PRM - The pointer to parameter table of primary library
+/// \~english @param [in] argc
+/// int - The number of command parameters (The parameters passed to main functions must be set without processing)
+/// \~english @param [in] argv
+/// char* - Command parameters (The parameters passed to main functions must be set without processing)
+/// \~english @param [out] fdNum
+/// int * - The number of element stored in fdlist (INI_FD_MAX:3)
+/// \~english @param [out] fdlist[INI_FD_MAX]
+/// int - The array of FD (File Descriptor) for event reception which primary library waits
+/// \~english @par
+/// - Shared memory creation table \n
+/// In process running, register the shared memory to create. \n
+/// This creates the shared memory to be registered in process running and releases it in process end. \n
+/// This must terminate by adding {"\0"} into member shmName of table termination. \n
+/// It is able to access to the shared memory to have been created by shm_open. \n
+/// \~english @code
+/// typedef struct {
+/// char shmName[32]; /* Shared memory name */
+/// uint32_t size; /* Shared memory size (BYTE) */
+/// }PRIM_SHAREDATA_TBL;
+/// @endcode
+/// \~english @par
+/// - Running extended function table / End extended function table \n
+/// Registers callback functions to be called in process start and exit. \n
+/// This must terminate by adding NULL into member func of table termination. \n
+/// Parameters prm of callback functions are User private information and the pointer designated by prm is passed as input parameters [in]. \n
+/// Local phase numbers callback func by the designated phase numbers. \n
+/// \~english @code
+/// typedef struct {
+/// void (* func)( void* prm); /* Callback functions for function extension */
+/// void* prm; /* The pointer to the parameters of Callback function func */
+/// uint8_t localStep; /* Local phase numbers */
+/// uint8_t rsv[3]; /* Reserve for alignment */
+/// }PRIM_EXFUNC_TBL;
+/// @endcode
+/// \~english @par
+/// - %Parameter table of primary library \n
+/// For FrameworkunifiedOnInitialization/FrameworkunifiedOnDestroy/FrameworkunifiedOnDebugDump/TaskmanagerOnTouch/FrameworkunifiedOnLowMemory, check the corresponding API specification. \n
+/// It is able to get User private data by INI_GetPrivate(). \n
+/// \~english @code
+/// typedef struct _T_PRIM_PRM{
+/// PCSTR name; /* Application name */
+/// const PRIM_SHAREDATA_TBL* shmTbl; /* The pointer to shared memory creation table */
+/// const PRIM_EXFUNC_TBL* wakeupExFuncTbl; /* The pointer to running extended function table */
+/// const PRIM_EXFUNC_TBL* downExFuncTbl; /* The pointer to end extended function table */
+/// EFrameworkunifiedStatus (*onInit)(HANDLE hApp); /* FrameworkunifiedOnInitialization callback function setting */
+/// EFrameworkunifiedStatus (*onDestory)(HANDLE hApp); /* FrameworkunifiedOnDestroy callback function setting */
+/// EFrameworkunifiedStatus (*onDebugDump)(HANDLE hApp); /* FrameworkunifiedOnDebugDump Callback function setting */
+/// EFrameworkunifiedStatus (*onTouch)(HANDLE hApp); /* TaskmanagerOnTouch callback function setting */
+/// EFrameworkunifiedStatus (*onLowMem)(HANDLE hApp); /* FrameworkunifiedOnLowMemory callback function setting */
+/// void* priv; /* User private data */
+/// }T_PRIM_PRM;
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the shared memory creation table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the running extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the end extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnInitialization callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDestroy callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDebugDump callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of TaskmanagerOnTouch callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Initializes primary thread. If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE. \n
+/// When implementing main thread at service, this function must be called in running main thread. \n
+/// Waits fd of fdlist gotten by functions by select and when there is change in fd, service must execute event handler of primary by calling INI_Handler().
+/// \~english @see INI_Main
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_Init(T_PRIM_PRM* p_prm,int argc ,char* argv[],int *fdNum,int fdlist[INI_FD_MAX]);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Handler
+/// \~english @par Summary:
+/// Processes the reception event of primary library. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param [in] p_fds
+/// fd_set* - fd set varied and detected by select()
+/// \~english @retval TRUE Service running (Continuing)
+/// \~english @retval FALSE The process end processing of primary library is completed
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_Init()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Access is not from main thread context [FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// When FD which primary library should process in fd set designated by p_fds is included, processes event processing of primary library. \n
+/// When implementing main thread by service, it is necessary to execute the event reception processing of primary library by this function. \n
+/// Returns TRUE during service running and does FALSE when the process end processing of primary library was completed. When FALSE is returned, service must call
+/// INI_Term() and end itself.
+/// \~english @see INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+BOOL INI_Handler(fd_set* p_fds);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Term
+/// \~english @par Summary:
+/// Releases the resource of primary library. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param None
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_Init()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Releases the resource of primary library. \n
+/// When implementing main thread at service, this function must release the resource of primary library in service end.
+/// \~english @see INI_Init, INI_Handler
+////////////////////////////////////////////////////////////////////////////////////
+void INI_Term(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_SetMonitorState
+/// \~english @par Summary:
+/// Sets abnormality monitoring state. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param [in] p_prm
+/// T_PRIM_MONITOR_PRM - The pointer to the parameters structure for monitoring
+/// \~english @par
+/// T_PRIM_MONITOR_PRM structure
+/// \~english @code
+/// typedef struct {
+/// BOOL bIsRun; /* Monitoring state (TRUE:RUN FALSE:SLEEP) */
+/// uint32_t timeout; /* Monitoring timeout time (sec) */
+/// }PRIM_SHAREDATA_TBL;
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_ Init ()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer(p_prm) to the parameters structure for monitoring designated by parameters is NULL [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sets abnormality monitoring for TaskManager. If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE \n
+/// When bIsRun=FALSE is not set until time designated by timeout passes after setting bIsRun=TRUE, TaskManager decides that the service falls into abnormal state and ends forcibly. \n
+/// When 0 is designated at monitoring timeout time(timeout), the service must be out of abnormality monitoring object.
+/// When monitoring state (bIsRun) is FALSE, monitoring state becomes invalid. \n
+/// This API can be used after running extended function CALLBACK.
+/// \~english @see INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_SetMonitorState(T_PRIM_MONITOR_PRM *p_prm);
+
+
+void _INI_DEBUGDUMP(BOOL bIsNeedSvcName, PCSTR f_cFormat, ...);
+
+#define INI_DEBUGDUMP(args...) _INI_DEBUGDUMP(TRUE, ## args)
+#define INI_DEBUGDUMP_RAW(args...) _INI_DEBUGDUMP(FALSE, ## args)
+
+// Callback functions
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TaskmanagerOnTouch
+/// \~english @par Summary:
+/// Callback to notify process use
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @retval eFrameworkunifiedStatusOK Succeeded
+/// \~english @retval Other-than-eFrameworkunifiedStatusOK Failed (Error type depends on the implementation at user side)
+/// \~english @par Preconditions:
+/// - Must set inside running information structure in calling INI_Main or INI_Init
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Implementation specification of callback depends on the implementation (design) of an application. For this, error type on failure conditions must be considered at an application side.
+/// \~english @par Detail:
+/// Service is call backed just before using. \n
+/// INI_ExitStart must not be issued for 30 seconds after service called this function. \n
+/// Timeout must be implemented such as counting up by using interval timer so that INI_ExitStart is not issued by timeout after this API was called. \n
+/// This function cannot call the API (TSKM_Xxxx) of TaskManager. (If this calls, deadlock occurs)
+/// \~english @par Classification:
+/// Public
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus TaskmanagerOnTouch(HANDLE hApp);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //_INI_API_HPP_
+
+/** @}*/ // end of TaskManager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/video_in_hal/systemservice/task_manager/server/include/system_service/Primary_common.h b/video_in_hal/systemservice/task_manager/server/include/system_service/Primary_common.h
new file mode 100755
index 0000000..e0624bb
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/system_service/Primary_common.h
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file Primary_common.h
+ * @brief \~english This file contains declaration of common enum and structures
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
+
+#include <stdint.h>
+#include <pthread.h>
+
+typedef unsigned int PRI_DWORD; // To eliminate the DWORD
+
+/* SRAM process type */
+#define SRAM_INIT (int)0 /* Initialization processing specification */
+#define SRAM_CHK (int)1 /* Range check processing specification */
+#define SRAM_MAPVER (int)2 /* Map Version change support designation */
+#define SRAM_MAPVER_CHK (int)3 /* Map Version change support + range checking specification */
+#define SRAM_SYSTEM_INIT (int)4 /* System initialization processing specification */
+#define SRAM_CONFIG_INIT (int)5 /* Reset setting */
+
+/* Processing result */
+#define SRAM_CHK_OK (int)0 /* SRAM checking completed normally (no change) */
+#define SRAM_CHK_CHG (int)1 /* SRAM checking Successful completion value is changed (Including during initialization) */
+#define SRAM_CHK_NG (int)-1 /* SRAM checking error */
+
+/*
+ Constant definition
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define PRIM_SHM_NAME_MAX 32 /* Maximum name size */
+
+// Local stage number of the stage start request/end request from the TSKM
+// In XML, it is set with a direct value of 1-9, but it is left because the legacy service refers to this definition
+enum _PRIM_FORK_STEP {
+ PRIM_STEPFORK_FIRST = 1, /* First startup step */
+ PRIM_STEPFORK_SECOND, /* 2nd startup step */
+ PRIM_STEPFORK_THIRD, /* 3rd startup step */
+ PRIM_STEPFORK_FOURTH, /* 4th startup step */
+ PRIM_STEPFORK_FIFTH, /* 5th startup step */
+ PRIM_STEPFORK_SIXTH, /* 6th startup step */
+ PRIM_STEPFORK_SEVENTH, /* 7th startup step */
+ PRIM_STEPFORK_EIGHTH, /* 8th startup step */ /* #GPF_10_018 */
+ PRIM_STEPFORK_NINTH, /* 9th startup step */ /* #GPF_10_018 */
+ PRIM_STEPFORK_TENTH, /* 10th startup step */ /* #GPF_10_018 */
+ PRIM_STEPFORK_MAX /* Maximum number of Gradual startup steps */ /* Used for judgment when receiving gradual startup */
+};
+
+enum _PRIM_ACCOFF_STEP {
+ PRIM_ACCOFF_FIRST = 1, /* First step */
+ PRIM_ACCOFF_SECOND, /* 2nd step */
+ PRIM_ACCOFF_THIRD, /* 3rd step */
+ PRIM_ACCOFF_FOURTH, /* 4th step */
+ PRIM_ACCOFF_FIFTH, /* 5th step */
+ PRIM_ACCOFF_MAX /* Total number of ACC-OFF steps */ /* Used for judgment when receiving ACC-OFF instruction */
+};
+
+/******************************************************************************
+ * TAG : PRIM_SHAREDATA_TBL
+ * ABSTRACT : Shared data table
+ * NOTE :
+ ******************************************************************************/
+/* Structure of shared data table */
+typedef struct {
+ char shmName[PRIM_SHM_NAME_MAX]; /* Shared data name */
+ int32_t size; /* Shared data size */
+} PRIM_SHAREDATA_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_FORK_TBL
+ * ABSTRACT : Startup process table
+ * NOTE :
+ ******************************************************************************/
+typedef struct {
+ PRI_DWORD (*threadFunc)(void* prm); /* Thread function */
+ void* prm; /* Thread startup parameters */
+ uint32_t priority; /* Thread priority */
+ uint16_t pno; /* Thuread number */
+ uint8_t rsv; /* Reserved field */
+ uint8_t wakeLocalStep; /* Startup step */
+ // The following is valid only when useLegacy = FALSE
+ char threadName[16]; /* Thread name */
+ char downLocalStep; /* When the termination step is 0, termination notification is not issued */
+ void* primaryLocal; /* Local area for libPrimary (cannot be changed) */
+} PRIM_FORK_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_EXFUNC_TBL
+ * ABSTRACT : Feature extension table
+ ******************************************************************************/
+typedef struct {
+ void (*func)(void* prm); /* Feature extension function */
+ void* prm; /* parameters */
+ uint8_t localStep; /* Startup step */
+ uint8_t rsv[3]; /* Reserved */
+} PRIM_EXFUNC_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_BACKUPCHK_TBL
+ * ABSTRACT : Function table for check backup data
+ ******************************************************************************/
+typedef struct {
+ int32_t (*func)(int32_t kind); /* Feature Extension Functions */
+} PRIM_BACKUPCHK_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_ACCOFF_TBL
+ * ABSTRACT : ACC-OFF process table
+ ******************************************************************************/
+typedef struct {
+ uint32_t localStep; /* ACC-OFF process step */
+ uint16_t pno; /* PNO of Notification destination */
+ uint8_t rsv[2];
+} PRIM_ACCOFF_TBL;
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
+/*
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : Primary_common.h
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ */
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/task_manager/server/include/system_service/sysup.h b/video_in_hal/systemservice/task_manager/server/include/system_service/sysup.h
new file mode 100755
index 0000000..ef930a4
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/system_service/sysup.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file sysup.h
+ * @brief \~english This file contains declaration of system status(SYS_RESET, SYS_ONLY_RESET)
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_H_
+
+#define SYS_RESET (int32)1 /* Resetting */
+#define SYS_ONLY_RESET (int)2 /* Reset only */
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_H_
+/** @}*/
+/** @}*/
+/** @}*/
+
diff --git a/video_in_hal/systemservice/task_manager/server/include/system_service/sysup_from.h b/video_in_hal/systemservice/task_manager/server/include/system_service/sysup_from.h
new file mode 100755
index 0000000..be7e0fe
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/system_service/sysup_from.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_FROM_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_FROM_H_
+
+/**
+ * @file sysup_from.h
+ * @brief \~english empty file
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+// Deleted the definitions in the file because they are not used.
+// Left them for legacy sources that you include.
+/** @}*/
+/** @}*/
+/** @}*/
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_FROM_H_
diff --git a/video_in_hal/systemservice/task_manager/server/include/system_service/task_manager.h b/video_in_hal/systemservice/task_manager/server/include/system_service/task_manager.h
new file mode 100755
index 0000000..82d23fb
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/system_service/task_manager.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file task_manager.h
+ * @brief \~english include all task_manager_library head files
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TASK_MANAGER_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TASK_MANAGER_H_
+
+#include "system_service/INI_API.h"
+#include "system_service/INI_API.hpp"
+#include "system_service/Primary_common.h"
+#include "system_service/sysup_from.h"
+#include "system_service/sysup.h"
+#include "system_service/tskm_svc.h"
+#include "system_service/tskm_type.h"
+#include "system_service/tskm.h"
+#include "system_service/tskm_local_type.h"
+#include "system_service/tskm_xml_data.h"
+#include "system_service/tskm_svcid.h"
+#include "system_service/task_manager_libtskmcfg.h"
+#include "system_service/tskm_data_init.h"
+#include "system_service/task_manager_libss_data_init.h"
+
+
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TASK_MANAGER_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/task_manager/server/include/system_service/tskm.h b/video_in_hal/systemservice/task_manager/server/include/system_service/tskm.h
new file mode 100755
index 0000000..1a2f962
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/system_service/tskm.h
@@ -0,0 +1,413 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file tskm.h
+ * @brief \~english This file contains primary API of task manager
+ */
+
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_H_
+
+
+#include <other_service/rpc.h>
+#include "system_service/tskm_type.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TSKM_ID RPC_ID
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_Init
+/// \~english @par Summary:
+/// Creates the resource to communicate with Task_Manager.
+/// \~english @param [out] *pID
+/// UINT32 - Unique ID of the automatically allocated program
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Creates the resource to communicate with Task_Manager. \n
+/// It is necessary to call this before using the APIs of TSKM_xxxx defined after this. \n
+/// It is necessary to call this by the thread. \n
+/// \~english @see TSKM_End
+////////////////////////////////////////////////////////////////////////////////////
+#define TSKM_Init(p_tskmId) RPC_START_CLIENT(p_tskmId)
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_End
+/// \~english @par Summary:
+/// Releases the resource created at TSKM_Init.
+/// \~english @param [in] ID
+/// UINT32 - ID gotten at TSKM_Init()
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal stat:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Releases the resource created at TSKM_Init.
+/// \~english @see TSKM_Init
+////////////////////////////////////////////////////////////////////////////////////
+#define TSKM_End(tskmId) RPC_end(tskmId)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_SvcCtl
+// \~english @par Summary:
+/// Run the control for service.
+/// \~english @param [in] svcid
+/// TSKM_SVCID_t - Service ID
+/// \~english @param [in] ctl
+/// TSKM_SVC_CTL_t* - Command
+/// \~english @code
+/// typedef struct{
+/// TSKM_SVC_CMD_t cmd;
+/// } TSKM_SVC_CTL_t;
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @retval TSKM_E_STATE State error
+/// \~english @retval TSKM_E_NG Error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters ctl is NULL [TSKM_E_PAR]
+/// - Service context is not found [TSKM_E_PAR]
+/// - Before FrameworkunifiedOnStart of Task_Manager is called [TSKM_E_STATE]
+/// - It is prohibited to run designated service [TSKM_E_STATE]
+/// - Message sending failed [TSKM_E_RETRY]
+/// - When the specified service executes the start prohibition except during
+/// the stop or start prohibition status. [TSKM_E_STATE]
+/// - Maximum numbers to register running reservation service are exceeded [TSKM_E_STATE]
+/// - Anything except for the commands specified as parameters is designated [TSKM_E_PAR]
+/// - Writing in files of running reservation information failed [TSKM_E_NG]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// - TSKM_SVC_CMD_EXEC\n
+/// Designated service runs. \n
+/// When designated service already runs, this returns TSKM_E_OK without processing service running. \n
+/// Running equal to local_step=all of request element is done. \n
+/// When designated service designates the service that running is prohibited by
+/// TSKM_SVC_CMD_DISABLE, this returns TSKM_E_STATE. \n
+/// This guarantees that service running finished in API succeeding. \n
+/// - TSKM_SVC_CMD_DISABLE\n
+/// This prohibits to run the designated service. \n
+/// At the prohibited service to run already, this returns TSKM_E_OK without doing anything. \n
+/// When this API uses the service to be run already, this returns TSKM_E_STATE. \n
+/// By this, at resident service, it is necessary to call this before running corresponding service. \n
+/// About the prohibited service, this doesn't decide the wait condition of event completion notice
+/// which service running, phase startup, phase end request, corresponding service control. \n
+/// This command is prepared in consideration of changing the service to run in response to
+/// with or without extended BOX and device configuration. \n
+/// Initial values are running permission. \n
+/// - TSKM_SVC_CMD_ENABLE\n
+/// This permits to run the service to be set as running prohibition. \n
+/// At running permission service, this returns TSKM_E_OK without doing anything. \n
+/// - TSKM_SVC_RESERVE\n
+/// This does the running reservation of non-resident service. \n
+/// In next running, designated service runs automatically after finishing in running resident service. \n
+/// Once this runs automatically, this forgets reservation information. \n
+/// Maximum numbers of service able to do running reservation is the values of TSKM_SVC_RESERVE_MAX. \n
+/// When this reserves over maximum numbers, this returns TSKM_E_STATE. \n
+/// When backup RAM is invalid in running, this does not run automatically and
+/// discards reservation information. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_SvcCtl(TSKM_SVCID_t svcId, const TSKM_SVC_CTL_t* ctl);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_SvcGetInfo
+// \~english @par Summary:
+/// Gets the information of designated service.
+/// \~english @param [in] svcid
+/// TSKM_SVCID_t - Service ID
+/// \~english @param [out] svcInfo
+/// TSKM_SVC_INFO_t* - Service information
+/// \~english @code
+/// typedef struct {
+/// TSKM_SVCID_t svcId;
+/// TSKM_BOOL_t isExecDisable;
+/// } TSKM_SVC_INFO_t;
+/// svcId : Service ID
+/// isExecDisable : Service running prohibition state
+/// TSKM_TRUE : Running prohibition
+/// TSKM_FALSE : Running permission
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Service context is not found [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets the information of designated service.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_SvcGetInfo(TSKM_SVCID_t svcId, TSKM_SVC_INFO_t* svcInfo);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_ErrorReboot
+/// \~english @par Summary:
+/// Let system do abnormal reboot.
+/// \~english @param [in] p_info
+/// TSKM_ERROR_REBOOT_t* - REBOOT information
+/// \~english @code
+/// typedef struct {
+/// TSKM_ERROR_REBOOT_TYPE_t type;
+/// TSKM_LOGGING_ INFO_t log;
+/// } TSKM_ERROR_REBOOT_t;
+/// type
+/// TSKM_ERROR_REBOOT_NORMAL : Abnormal detection
+/// log : Log saving information
+/// typedef struct {
+/// char messageStr[TSKM_LOGGING_MSG_STR_SIZE];
+/// } TSKM_LOGGING_INFO_ t;
+/// messageStr : Abnormal message character string
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_info is NULL [TSKM_E_PAR]
+/// - Reboot factors are except for TSKM_ERROR_REBOOT_NORMAL [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Does REBOOT. \n
+/// It is assumed to issue when system is damaged if processing continues any more
+/// such as device trouble and non-volatile data trouble. \n
+/// Access limitation is done to this API by gid and uid. \n
+/// When an application with no authorization calls this, this force-quits the application to have called API. \n
+/// This stores the string designated to messageStr as factors in system information LOG. \n
+/// To link with PSMShadow about trouble factors, this designates abnormal message character string defined
+/// inside ss_error_message.h to messageStr.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_Reboot
+/// \~english @par Summary:
+/// Let system do reboot.
+/// \~english @param [in] rsv
+/// TSKM_RSV_t* - Reservation ( This must designate NULL)
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_rsv is except for NULL [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync x Method
+/// \~english @par Detail:
+/// Let system do normal reboot.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_Reboot(const TSKM_RSV_t * p_rsv);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_Logging
+/// \~english @par Summary:
+/// Stores LOG in internal non-volatile area.
+/// \~english @param [in] p_info
+/// TSKM_LOGGING_INFO_t * - Log storing information
+/// \~english @code
+/// typedef struct{
+/// TSKM_LOGGING_TYPE_NORMAL_t type;
+/// char messageStr[TSKM_LOGGING_MSG_STR_SIZE];
+/// }TSKM_LOGGING_INFO_t;
+/// type : Log storing type
+/// TSKM_LOGGING_TYPE_MODULE_LOGS: General LOG storing request from service
+/// TSKM_LOGGING_TYPE_GRP_RELAUNCH: Log collection by Group Relaunch
+/// messageStr : Trouble factors
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_info is NULL [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Collects LOG information and stores it in internal non-volatile area \n
+/// This stores the string designated to messageStr as factors in system information LOG.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_Logging(const TSKM_LOGGING_INFO_t* p_info);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_DataInit
+/// \~english @par Summary:
+/// Does the initialization process of service data.
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @param [in] p_info
+/// TSKM_DATAINIT_t * - Data initialization information
+/// \~english @code
+/// typedef struct {
+/// TSKM_DATAINIT_TYPE_t type;
+/// EFrameworkunifiedStatus (*onCompInit)(HANDLE hApp);
+/// } TSKM_DATAINIT_t;
+/// type : Data initialization type
+/// TSKM_DATAINIT_TYPE_USER : User data initialization
+/// onCompInit : Initialization complete Callback
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @retval TSKM_E_NG Error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters hAPP is NULL [TSKM_E_PAR]
+/// - Parameters p_info is NULL [TSKM_E_PAR]
+/// - Member type of parameters p_info is except for TSKM_DATAINIT_TYPE_USER [TSKM_E_PAR]
+/// - Member onCompInit of parameters p_info is NULL [TSKM_E_PAR]
+/// - The process of FrameworkunifiedAttachCallbackToDispatcher failed [TSKM_E_NG]
+/// - The process of FrameworkunifiedOpenService failed [TSKM_E_STATE]
+/// - The process of FrameworkunifiedSendMsg failed [TSKM_E_NG]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail:
+/// - How to report \n
+/// Reports by Callback of onCompInit. \n
+/// This can get message data by calling GetMsgData inside onCompInit. \n
+/// - Structure of message data \n
+/// TSKM_ERR_t:Processing result \n
+/// TSKM_E_OK :Normal end \n
+/// TSKM_E_STATE :State error \n
+/// TSKM_E_NG :Error
+/// - Summary of action \n
+/// Calls initialization functions which each service implemented. \n
+/// When this API was called before Availability of Task_Manager becomes TRUE, this
+/// does not call initialization functions and returns TSKM_E_STATE by onCompInit. \n
+/// It is permitted for same application to call this API several times, at this case,
+/// it is necessary to designate the pointer to same functions to onCompInit. \n
+/// When this API was called by designating TSKM_DATAINIT_TYPE_USER to type, this calls
+/// the initialization functions of each service by designating the following parameters. \n
+/// <table>
+/// <tr><th>Member</th><th>Values</th></tr>
+/// <tr><td>startupReason</td><td>epswfIGN_ACC</td></tr>
+/// <tr><td>isUserModeOn</td><td>TRUE</td></tr>
+/// <tr><td>dataResetMode</td><td>e_SS_SM_DATA_RESET_MODE_USER</td></tr>
+/// <tr><td>wakeupType</td><td>epsstWARMSTART</td></tr>
+/// <tr><td>dramBackupStatus</td><td>e_SS_SM_DRAM_BACKUP_OK</td></tr>
+/// <tr><td>resetStatus</td><td>e_SS_SM_RESET_STATUS_NONE</td></tr>
+/// <tr><td>resetCount</td><td>0</td></tr>
+/// </table>
+/// Because Task_Manager calls the initialization functions of each service and implements
+/// the recovery processing according to running factors at the timing of fixing running factor,
+/// this designates the above parameters not to do duplicate recover processing.
+/// \~english @see TSKM_DATA_INIT_FUNC
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_DataInit(HANDLE hApp, const TSKM_DATAINIT_t *p_info);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_SetWakeupOrder
+/// \~english @par Summary:
+/// Holds running order.
+/// \~english @param [in] p_order
+/// TSKM_WAKEUP_ORDER_t * - Running order information
+/// \~english @code
+/// typedef struct {
+/// char orderName[TSKM_ORDER_NAME_MAX];
+/// } TSKM_WAKEUP_ORDER_t;
+/// orderName: Order name (MAX:31 characters)
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @retval TSKM_E_NG Error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_order is NULL [TSKM_E_PAR]
+/// - The string length of the member orderName of Parameters p_order exceeds 32 [TSKM_E_PAR]
+/// - The process of SetWakeupOrderToSystemManager failed [TSKM_E_NG]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync x Sync
+/// \~english @par Detail:
+/// This function is Wrapper function to provide SetWakeupOrderToSystemManager
+/// by sessionless which SystemManger provides.
+/// This designates NULL to p_order and returns TSKM_E_PAR.
+/// For the detail of action, refer to SystemManager (SetWakeupOrderToSystemManager).
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_SetWakeupOrder(const TSKM_WAKEUP_ORDER_t* p_order);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_H_
+
+/** @}*/ // end of Task_Manager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
+
+
diff --git a/video_in_hal/systemservice/task_manager/server/include/system_service/tskm_local_type.h b/video_in_hal/systemservice/task_manager/server/include/system_service/tskm_local_type.h
new file mode 100755
index 0000000..79831aa
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/system_service/tskm_local_type.h
@@ -0,0 +1,287 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_local_type.h
+ * @brief \~english localtype of tskm
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_LOCAL_TYPE_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_LOCAL_TYPE_H_
+
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <native_service/frameworkunified_types.h>
+#include "system_service/INI_API.hpp"
+#include "system_service/tskm_type.h"
+
+//==================================================
+// Configuration
+//==================================================
+
+#if 1
+#define TSKM_CFG_WAIT_SHUTDOWN 10000
+#else
+#define TSKM_CFG_WAIT_SHUTDOWN 1 // Handy for test
+#warning TSKM_CFG_WAIT_SHUTDOWN is temorary
+#endif
+
+#define TSKM_CFG_TOUCH_TIMEOUT 2 // TOUCH time-out
+
+//==================================================
+// Task manager internal
+//==================================================
+// State
+#define TSKM_ST_ACCOFF 0x01000000U // ACC-OFF (Default) No transition here
+#define TSKM_ST_ACCON 0x02000000U // ACC-ON
+#define TSKM_ST_WAKEUP 0x02010000U // Gradual startup
+#define TSKM_ST_RUNNING 0x02020000U // Running (Startup completed)
+#define TSKM_ST_DOWN 0x02040000U // Gradual Terminating
+
+typedef uint32_t TSKM_STATE_t;
+#define TSKM_STATE_MASK0 0xFF000000U
+#define TSKM_STATE_MASK1 0xFFFF0000U
+#define TSKM_STATE_MASK2 0xFFFFFF00U
+#define TSKM_STATE_MASK3 0xFFFFFFFFU
+
+// Global step IDs for gradual starting
+typedef uint32_t TSKM_GLOBAL_STEP_t;
+#define TSKM_GSTEP_NONE 0x00000000U //
+#define TSKM_GSTEP_BUPCHK 0x00000001U
+
+// Local step
+typedef uint32_t TSKM_LOCAL_STEP_t;
+#define TSKM_LSTEP_LAST 0xFFFFFFF0U // Executing to end of local steps
+#define TSKM_LSTEP_SHM 0xFFFFFFF1U // Creating shared memory
+#define TSKM_LSTEP_BUPCHK 0xFFFFFFF2U // Checking backup memory
+#define TSKM_LSTEP_ALL 0xFFFFFFF3U // Executing all user definitions
+
+/************************************************************
+ * Structure of gradual startup/termination structure
+ (When this structure is modified, structure of parsexml is also changed)
+ *************************************************************/
+// Structure of request for services
+typedef struct {
+ TSKM_SVCID_t svcId; // Service ID
+ TSKM_LOCAL_STEP_t localStep; // Local step number
+} TSKM_GSTEP_REQ_INFO_t;
+
+// Structure of gradual startup/termination
+typedef struct {
+ uint32_t gstepId;
+
+ // List of executing services
+ uint32_t execSvcNum;
+ TSKM_SVCID_t* execSvcIdList;
+
+ // List of request
+ uint32_t reqNum;
+ TSKM_GSTEP_REQ_INFO_t* reqList;
+
+ // Event completion wait conditions
+ uint64_t nextTransCond;
+} TSKM_GSTEP_t;
+
+typedef struct {
+ uint32_t gstepIdx; // Step index
+ uint32_t gstepNum; // Step number
+ TSKM_GSTEP_t* gstep; // Gradual startup/termination info
+ uint64_t compState; // Status of receiving for Event completion notification
+} TSKM_GSTEP_CTX_t;
+
+//********* Non-volatile management information ****************
+
+#define TSKM_NV_STRUCT_VERSION "v000" // Compatible version of non-volatile management structure
+#define TSKM_SVC_RESERVE_MAX (8) // Maximum number of reserved services to startup
+
+#define TSKM_NV_SIZE_ALL (512)
+#define TSKM_NV_SIZE_HEADER (32)
+#define TSKM_NV_SIZE_FOOTER (32)
+#define TSKM_NV_SIZE_BODY (TSKM_NV_SIZE_ALL - TSKM_NV_SIZE_HEADER - TSKM_NV_SIZE_FOOTER)
+
+// Header
+typedef struct {
+ char version[5];
+} TSKM_NV_HEADER_t;
+
+// Footer
+typedef struct {
+ uint32_t checkSum;
+} TSKM_NV_FOOTER_t;
+
+// Body
+typedef struct {
+ uint8_t rsvSvcNum; // Number of reserved services
+ TSKM_SVCID_t rsvSvcs[TSKM_SVC_RESERVE_MAX]; // List of services
+} TSKM_NV_BODY_t;
+
+// Non-volatile storage info
+typedef struct {
+ TSKM_NV_HEADER_t header;
+ uint8_t rsvHeader[TSKM_NV_SIZE_HEADER - sizeof(TSKM_NV_HEADER_t)];
+ TSKM_NV_BODY_t body;
+ uint8_t rsvBody[TSKM_NV_SIZE_BODY - sizeof(TSKM_NV_BODY_t)];
+ uint8_t rsvFooter[TSKM_NV_SIZE_FOOTER - sizeof(TSKM_NV_FOOTER_t)];
+ TSKM_NV_FOOTER_t footer;
+} TSKM_NV_INFO_t;
+
+// Internal event
+typedef enum {
+ TSKM_EV_NOP, // Do nothing
+ // TSKM->PRI
+ TSKM_EV_PRI_REQ_WAKEUP, // Startup request
+ TSKM_EV_PRI_REQ_DOWN, // Termination request
+ TSKM_EV_PRI_REQ_TOUCH,
+ TSKM_EV_PRI_REQ_DEBUGDUMP, // DebugDump request
+ TSKM_EV_PRI_REP_LOWMEM, // LowMemory detection request
+
+ // PRI->TSKM(SVC)
+ TSKM_EV_PRI_REP_WAKEUP_COMP, // Notification of event completion at startup
+ TSKM_EV_PRI_REP_DOWN_COMP, // Notification of event completion at termination
+ TSKM_EV_PRI_REP_CONNECT, // Connecting
+ TSKM_EV_PRI_REP_DISCONNECT, // Disconnecting
+ TSKM_EV_PRI_RES_WAKEUP, // Response to startup request
+ TSKM_EV_PRI_RES_DOWN, // Response to termination request
+ TSKM_EV_PRI_RES_DEBUGDUMP, // Response to DebugDump request
+ TSKM_EV_PRI_REQ_EXIT, // Response to terminating request
+
+ // SVC->TSKM
+ TSKM_EV_SVC_REP_TERM, // Termination of service
+
+ // APL->TSKM
+ TSKM_EV_API_REQ_REBOOT, // Reboot system
+ TSKM_EV_API_REQ_SVC_CTL, // Startup service
+ TSKM_EV_API_REQ_SVC_DISABLE, // Prohibit starting service
+
+ // Internal message
+ TSKM_EV_LCL_REQ_STOP, // Termination request
+ TSKM_EV_LCL_CHG_SVC_STATE, // State Change of service
+ TSKM_EV_LCL_REQ_SDUMP, // Dump of service list
+ TSKM_EV_LCL_REP_TIMEOUT, // Occured Timeout
+ TSKM_EV_LCL_REP_POLLING, // Polling request
+ TSKM_EV_LCL_REP_LOWMEM, // Notification of LowMemory detection
+ TSKM_EV_LCL_REQ_TRANS_STEP, // Gradual transitioning request
+} TSKM_EVENT_t;
+
+#define TSKM_EV_BOOTINFO_SIZE sizeof(T_SS_SM_START_DataStructType)
+#define TSKM_EV_EXTBOOTINFO_SIZE sizeof(T_SS_SM_START_ExtDataStructType)
+
+typedef struct {
+ TSKM_SVCID_t svcId;
+ TSKM_LOCAL_STEP_t localStep;
+ char bootInfo[TSKM_EV_BOOTINFO_SIZE];
+ char extBootInfo[TSKM_EV_EXTBOOTINFO_SIZE];
+ TSKM_BOOL_t isDynamic; // Nonresident task?
+} TSKM_EV_PRI_REQ_WAKEUP_PRM_t;
+
+typedef struct {
+ TSKM_LOCAL_STEP_t localStep;
+} TSKM_EV_PRI_REQ_DOWN_PRM_t;
+
+// PRI->TSKM
+typedef struct {
+ uint64_t compId;
+} TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t;
+
+typedef struct {
+ uint64_t compId;
+} TSKM_EV_PRI_REP_DOWN_COMP_PRM_t;
+
+typedef struct {
+ int connFd;
+} TSKM_EV_PRI_REP_CONNECT_PRM_t;
+
+typedef struct {
+ TSKM_BOOL_t isLast;
+ TSKM_BOOL_t isShmDone;
+ TSKM_BOOL_t isStepDone;
+} TSKM_EV_PRI_RES_WAKEUP_PRM_t;
+
+typedef struct {
+ TSKM_BOOL_t isLast;
+} TSKM_EV_PRI_RES_DOWN_PRM_t;
+
+#define TSKM_EV_DEBUGDUMP_SIZE 4096
+
+typedef struct {
+ char dumpMsg[TSKM_EV_DEBUGDUMP_SIZE];
+} TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t;
+
+// APL->TSKM
+
+// Internal message
+typedef struct {
+ TSKM_SVCID_t svcId;
+} TSKM_EV_LCL_CHG_SVC_STATE_PRM_t;
+
+// The structure must be on a stack
+typedef struct _TSKM_EVENT_INFO_t {
+ TSKM_EVENT_t event;
+ TSKM_ERR_t errCode;
+ pid_t fromPid;
+ TSKM_BOOL_t hasExtend;
+ uint32_t extendSize;
+ void *extendPrm;
+ union {
+ // TSKM->PRI
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
+ TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
+
+ // PRI->TSKM
+ TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
+ TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
+ TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
+ TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
+ TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
+
+ // Internal message
+ TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
+ } prm;
+ _TSKM_EVENT_INFO_t() {
+ event = TSKM_EV_NOP;
+ errCode = TSKM_E_OK;
+ fromPid = 0;
+ hasExtend = TSKM_FALSE;
+ extendSize = 0;
+ extendPrm = NULL;
+ }
+ ~_TSKM_EVENT_INFO_t() {
+ if (hasExtend && !extendPrm) {
+ free(extendPrm);
+ }
+ }
+} TSKM_EVENT_INFO_t;
+
+typedef enum {
+ TSKM_DATAINIT_REQ = 800,
+ TSKM_DATAINIT_RESP,
+ TSKM_TRANS_STEP_REQ
+} TSKM_PROTCOL_t;
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_LOCAL_TYPE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/task_manager/server/include/system_service/tskm_svc.h b/video_in_hal/systemservice/task_manager/server/include/system_service/tskm_svc.h
new file mode 100755
index 0000000..8b25581
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/system_service/tskm_svc.h
@@ -0,0 +1,904 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_svc.h
+ * @brief \~english define of tskm
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
+
+
+#include <unistd.h>
+#include <sys/types.h>
+#include "system_service/tskm_local_type.h"
+
+
+#define TSKM_SVC_WAIT_REQ_MAX (8) // Number of queued requests
+
+// Service type
+typedef enum {
+ TSKM_SVC_TYPE_NATIVE, //
+ TSKM_SVC_TYPE_UNKNONW, //
+} TSKM_SVC_TYPE_t;
+
+// Scheduling policy
+typedef enum {
+ TSKM_SVC_POLICY_TSS, //
+ TSKM_SVC_POLICY_RR, //
+ TSKM_SVC_POLICY_FIFO, //
+} TSKM_SVC_POLICY_t;
+
+// Life cycle
+typedef enum {
+ TSKM_SVC_LC_ALWAYS, // Resident
+ TSKM_SVC_LC_ALWAYS_RECOVERABLE, // Resident(Recoverable)
+ TSKM_SVC_LC_DYNAMIC // Non-resident
+} TSKM_SVC_LC_t;
+
+// CPU allocation: This defined value should match the specification of the second argument of CL_ProcessCreateAttrSetCpuAssign
+
+typedef enum {
+ TSKM_SVC_ASSIGN_CPU_AUTO = 0, // Automatic allocation
+ TSKM_SVC_ASSIGN_CPU_0 = 1, // Fixed to CPU0
+ TSKM_SVC_ASSIGN_CPU_1 = 2, // Fixed to CPU1
+} TSKM_SVC_ASSIGN_CPU_t;
+
+// Service attributes (given by XML)
+typedef struct {
+ TSKM_SVCID_t svcId; //
+ const char* name; //
+ const char* path; //
+ char** args; //
+ TSKM_SVC_TYPE_t type; //
+ uint32_t prio; //
+ TSKM_SVC_POLICY_t policy; //
+ TSKM_SVC_LC_t lifeCycle; //
+ uint32_t retryCnt; //
+ TSKM_SVC_ASSIGN_CPU_t cpuAssign; //
+ const char* user; //
+ uint32_t runtimeLimit; //
+ uint32_t cpuLimit; //
+ uint32_t memLimit; //
+ TSKM_BOOL_t shotdownWait; //
+ uint32_t subgidNum; //
+ gid_t *subgidList; //
+} TSKM_SVC_ATTR_t;
+
+// Service status
+typedef enum {
+ TSKM_SVC_DORMANT, // During dormant (Not exec)
+ TSKM_SVC_WAITCONNECT, // Wait for connection
+ TSKM_SVC_WAKEUP, // Start in progress
+ TSKM_SVC_RUNNING, // Running (Startup completed)
+ TSKM_SVC_DOWN, // Termination in progress
+ TSKM_SVC_FINDOWN, // Termination completed
+ TSKM_SVC_DISABLE, // Prohibitting startup (exec prohibited)
+} TSKM_SVC_STATE_t;
+
+// Service
+typedef struct { // Life cycle
+ TSKM_SVC_ATTR_t *attr; // Service Attributes ALL
+ TSKM_SVC_STATE_t state; // Service State ALL
+ int iFd; // inotifyFd for touch ALL
+ pid_t pid; // PID of service REQ_WAKEUP - FIN_DOWN
+ int connFd; // service communication socket DO_WAKEUP - FIN_DOWN
+ T_SS_SM_START_DataStructType bootInfo; // Boot info REQ_WAKEUP - FIN_DOWN
+ T_SS_SM_START_ExtDataStructType extBootInfo; // Extended boot info REQ_WAKEUP - FIN_DOWN
+
+ TSKM_BOOL_t isShmDone; // Shared memory initialization completed
+ TSKM_BOOL_t isStepDone; // Gradual startup completed
+ TSKM_BOOL_t isAvailable; // Availability reception completed
+
+ uint32_t watchCnt; // Service monitoring counter
+ uint32_t waitResCnt; // Wait for response to request DO_WAKEUP - WAIT_WAKEUP
+ uint32_t waitReqCnt; // Wait for request issuance REQ_WAKEUP - DO_WAKEUP
+ TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX]; // REQ_WAKEUP - DO_WAKEUP
+
+ uint32_t errTermCnt; // Number of abnormal terminations ALL
+} TSKM_SVC_CTX_t;
+
+// Service list
+typedef struct {
+ uint32_t svcNum;
+ TSKM_SVC_CTX_t *svcList;
+} TSKM_SVCS_CTX_t;
+
+// State of waiting for service termination
+typedef enum {
+ TSKM_SVC_WAIT_NONE, // No wait
+ TSKM_SVC_WAIT_TRANSIENT, // Waiting for termination of nonresident service
+ TSKM_SVC_WAIT_BOTH, // Waiting for termination of resident/nonresident service
+} TSKM_SVC_WAIT_STATE_t;
+
+// Service list
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsEventHandle
+ /// \~english @par Summary
+ ///
+ /// \~english @param
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_inEv
+ /// p_inEv - pointer of input event info
+ /// \~english @par
+ /// p_inEv TSKM_EVENT_INFO_t*
+ /// \~english @code
+ /// typedef struct _TSKM_EVENT_INFO_t {
+ /// TSKM_EVENT_t event;
+ /// TSKM_ERR_t errCode;
+ /// pid_t fromPid;
+ /// TSKM_BOOL_t hasExtend;
+ /// uint32_t extendSize;
+ /// void *extendPrm;
+ /// union {
+ /// // TSKM->PRI
+ /// TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
+ /// TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
+ /// // PRI->TSKM
+ /// TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
+ /// TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
+ /// TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
+ /// TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
+ /// TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
+ /// TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
+ /// } prm;
+ /// } TSKM_EVENT_INFO_t;
+ /// @endcode
+ /// \~english @param [out] p_outEv
+ /// p_outEv - pointer of output event info
+ /// \~english @par
+ /// p_outEv TSKM_EVENT_INFO_t*
+ /// \~english @retval
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// -
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ ///
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsEventHandle(TSKM_SVCS_CTX_t* p_svcs,
+ const TSKM_EVENT_INFO_t* p_inEv,
+ TSKM_EVENT_INFO_t* p_outEv);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsGetSvcBySvcId
+ /// \~english @par Summary
+ /// find service in inputed service list by service id.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services object
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] svcId
+ /// svcId - service Id
+ /// \~english @par
+ /// svcId uint32_t
+ /// \~english @retval TSKM_SVC_CTX_t* service pointer
+ /// \~english @retval TSKM_SVC_CTX_t* NULL
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If not find svcId in services list. [NULL]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// find service in inputed service list by service id.. If do not find then return NULL pointer.
+ /// \~english @see getSvcCtxBySvcId
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_SVC_CTX_t* tskm_svcsGetSvcBySvcId(TSKM_SVCS_CTX_t* p_svcs,
+ TSKM_SVCID_t svcId);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsGetSvcByPid
+ /// \~english @par Summary
+ /// find service in inputed service list by process id.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] pid
+ /// pid - process id
+ /// \~english @par
+ /// pid pid_t
+ /// \~english @retval TSKM_SVC_CTX_t* service pointer
+ /// \~english @retval TSKM_SVC_CTX_t* NULL
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If not find process id in services list. [NULL]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// find service in inputed service list by process id. If do not find then return NULL pointer.
+ /// \~english @see getSvcCtxByPid
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_SVC_CTX_t* tskm_svcsGetSvcByPid(TSKM_SVCS_CTX_t* p_svcs, pid_t pid);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsIsWaiting
+ /// \~english @par Summary
+ /// Is the service state waiting.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_BOOL_t
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If service state is TSKM_SVC_WAITCONNECT and wait response num is 0. [TSKM_FALSE]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Is the service state waiting. \n
+ /// There are not service's state equal TSKM_SVC_WAITCONNECT or wait respose number > 0 return TSKM_TRUE.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_BOOL_t tskm_svcsIsWaiting(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsGetSvcTermWaitState
+ /// \~english @par Summary
+ /// Get the service which state equanl not equal terminal.
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_SVC_WAIT_STATE_t
+ /// \~english @par
+ /// TSKM_SVC_WAIT_STATE_t enum
+ /// \~english @code
+ /// typedef enum {
+ /// TSKM_SVC_WAIT_NONE, // not waiting state
+ /// TSKM_SVC_WAIT_TRANSIENT, // dynamic service terminal waiting state
+ /// TSKM_SVC_WAIT_BOTH, // no dynamic/ dyanmic service terminal waiting state
+ /// } TSKM_SVC_WAIT_STATE_t;
+ /// @endcode
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// If all services state equal TSKM_SVC_DORMANT. [TSKM_SVC_WAIT_NONE]
+ /// If dynamic service. [TSKM_SVC_WAIT_TRANSIENT]
+ /// If not dynamic service and state not TSKM_SVC_FINDOWN. [TSKM_SVC_WAIT_BOTH]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Get the service which state equanl not equal terminal. \n
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_SVC_WAIT_STATE_t tskm_svcsGetSvcTermWaitState(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsSetBootInfo
+ /// \~english @par Summary
+ /// initialize all services boot info.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_info
+ /// p_info - SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message pointer
+ /// \~english @par
+ /// p_info T_SS_SM_START_DataStructType*
+ /// \~english @code
+ /// Data passed as part of SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message
+ /// typedef struct T_SS_SM_START_DataStruct {
+ /// EPWR_WAKEUP_FACTOR_TYPE startupReason;
+ /// BOOL isUserModeOn;
+ /// ESMDataResetModeInfo dataResetMode;
+ /// EPWR_SC_SECURITY_STATUS securityStatus;
+ /// EPWR_SC_WAKEUP_TYPE wakeupType;
+ /// ESMDramBackupStatus dramBackupStatus;
+ /// ESMResetStatus resetStatus;
+ /// UI_32 errResetCount;
+ /// T_SS_SM_START_DataStruct
+ /// } T_SS_SM_START_DataStructType;
+ /// @endcode
+ /// \~english @param [in] p_exInfo
+ /// p_exInfo - FrameworkunifiedOnStart extend info pointer
+ /// \~english @par
+ /// p_exInfo T_SS_SM_START_ExtDataStructType*
+ /// \~english @code
+ /// /// Extended Parameter for FrameworkunifiedOnStart
+ /// typedef struct {
+ /// BOOL isProgUpdated;
+ /// EMRelaunchStatus relaunchStatus;
+ /// BOOL isMapUpdated;
+ /// BOOL isMapDiffUpdated;
+ /// uint8_t reserved[SS_SM_START_EXT_RSV_SIZE];
+ /// } T_SS_SM_START_ExtDataStructType;
+ /// @endcode
+ /// \~english @retval TSKM_E_OK
+ /// \~english @par
+ /// TSKM_SVC_WAIT_STATE_t enum
+ /// \~english @par Preconditions
+ /// - call tskm_dataInitAll() to get boot info
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - pulbic
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// - initialize all services boot info.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsSetBootInfo(TSKM_SVCS_CTX_t* p_svcs,
+ T_SS_SM_START_DataStructType* p_info,
+ T_SS_SM_START_ExtDataStructType *p_exInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsAvtiveSvcTerm
+ /// \~english @par Summary
+ /// Terminal the dynamic services.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - tskm_svcDownRequest return failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - pulbic
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Terminal all the dynamic services which state equal TSKM_SVC_RUNNING and response num equal 0. \n
+ /// \~english @see tskm_svcDownRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsAvtiveSvcTerm(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsCallDebugDump
+ /// \~english @par Summary
+ /// Send DebugDump message to services.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - tskm_sockSend send DebugDump message failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Send DebugDump message to services which state equal TSKM_SVC_RUNNING. \n
+ /// \~english @see tskm_sockSend
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsCallDebugDump(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsCallLowMem
+ /// \~english @par Summary
+ /// Send checking low memory message to services.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - tskm_sockSend send LowMemory message failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Send checking LowMemory message to services which state equal TSKM_SVC_RUNNING. \n
+ /// \~english @see tskm_sockSend
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsCallLowMem(TSKM_SVCS_CTX_t* p_svcs);
+
+// Service
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcEventHandle
+ /// \~english @par Summary
+ /// process event.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in][out] p_ev
+ /// p_ev - event info pointer
+ /// \~english @par
+ /// p_ev TSKM_EVENT_INFO_t*
+ /// \~english @code
+ /// typedef struct _TSKM_EVENT_INFO_t {
+ /// TSKM_EVENT_t event;
+ /// TSKM_ERR_t errCode;
+ /// pid_t fromPid;
+ /// TSKM_BOOL_t hasExtend;
+ /// uint32_t extendSize;
+ /// void *extendPrm;
+ /// union {
+ /// // TSKM->PRI
+ /// TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
+ /// TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
+ ///
+ /// // PRI->TSKM
+ /// TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
+ /// TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
+ /// TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
+ /// TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
+ /// TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
+ /// TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
+ /// } prm;
+ /// } TSKM_EVENT_INFO_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// process event.\n
+ /// process connect response.\n
+ /// process disconnect response. \n
+ /// process service wakeup request. \n
+ /// process service down request. \n
+ /// process service debugdump request. \n
+ /// process service exit request. \n
+ /// process service terminal response. \n
+ /// \~english @see isSvcEvent,connectHandle,disConnectHandle,resWakeupHandle, \n
+ /// resDownHandle,resDebugDumpHandle,reqExit,repTermHandle \n
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcEventHandle(TSKM_SVC_CTX_t* p_svc, TSKM_EVENT_INFO_t* p_ev); // p_ev: [IN/OUT]
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcExec
+ /// \~english @par Summary
+ /// start service.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer of services
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// TSKM_E_STATE
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - input parameter p_svc is NULL. [TSKM_E_NG]
+ /// - service state is TSKM_SVC_DISABLE [TSKM_E_STATE]
+ /// - reqTouch return failed [TSKM_E_NG]
+ /// - tskm_pf_createProc return failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// start service which state is TSKM_SVC_DORMANT.\n
+ /// \~english @see svcExec, reqTouch, tskm_pf_createProc
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcExec(TSKM_SVC_CTX_t* p_svc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcWakeupRequest
+ /// \~english @par Summary
+ /// Send started request to service.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer of service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_req
+ /// p_req - pointer of request
+ /// \~english @par
+ /// p_req TSKM_GSTEP_REQ_INFO_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVCID_t svcId; // service ID
+ /// TSKM_LOCAL_STEP_t localStep; // local step id
+ /// } TSKM_GSTEP_REQ_INFO_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// TSKM_E_STATE
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Input parameter p_svc is NULL. [TSKM_E_STATE]
+ /// - Service state is TSKM_SVC_DISABLE [TSKM_E_STATE]
+ /// - wakeupRequest return failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Send started request to service. If service do not connect, save the request.\n
+ /// Send request again when service connect. \n
+ /// \~english @see svcWakeupRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcWakeupRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcDownRequest
+ /// \~english @par Summary
+ /// Send service down request to service.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_req
+ /// p_req - request pointer
+ /// \~english @par
+ /// p_req TSKM_GSTEP_REQ_INFO_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVCID_t svcId; // service ID
+ /// TSKM_LOCAL_STEP_t localStep; // local step id
+ /// } TSKM_GSTEP_REQ_INFO_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Send service down request failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// If service state is commounicated(TSKM_SVC_WAKEUP, TSKM_SVC_RUNNING), \n
+ /// send service down request and set state as TSKM_SVC_DOWN.\n
+ /// \~english @see tskm_svcIsCommunicatable,tskm_sockSend
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcDownRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcDisableRequest
+ /// \~english @par Summary
+ ///
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer of service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_STATE
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If service state is not TSKM_SVC_DORMANT and TSKM_SVC_DISABLE. [TSKM_E_STATE]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Set service state as TSKM_SVC_DISABLE if state is TSKM_SVC_DORMANT.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcDisableRequest(TSKM_SVC_CTX_t* p_svc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcDisableRequest
+ /// \~english @par Summary
+ /// Set service state as start available.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - Pointer to service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Set service state as start available which state is disable(TSKM_SVC_DISABLE).
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcEnableRequest(TSKM_SVC_CTX_t* p_svc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcIsCommunicatable
+ /// \~english @par Summary
+ /// Whether service is Communicatable.
+ /// \~english @param [in] p_svc
+ /// p_svc - pointer of service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_BOOL_t
+ /// \~english @par
+ /// TSKM_FALSE
+ /// TSKM_TRUE
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If input parameter p_svc is NULL. [TSKM_FALSE]
+ /// - If input parameter p_svc->attr->type is TSKM_SVC_TYPE_UNKNONW. [TSKM_FALSE]
+ /// - If service state is TSKM_SVC_DORMANT or TSKM_SVC_WAITCONNECT or
+ /// TSKM_SVC_FINDOWN orTSKM_SVC_DISABLE. [TSKM_FALSE]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Whether service is Communicatable. \n
+ /// If service state is TSKM_SVC_WAKEUP or TSKM_SVC_RUNNING or TSKM_SVC_DOWN, return TSKM_TRUE. \n
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_BOOL_t tskm_svcIsCommunicatable(TSKM_SVC_CTX_t* p_svc);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/task_manager/server/include/system_service/tskm_type.h b/video_in_hal/systemservice/task_manager/server/include/system_service/tskm_type.h
new file mode 100755
index 0000000..7d1f818
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/system_service/tskm_type.h
@@ -0,0 +1,123 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_type.h
+ * @brief \~english type of tskm
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_TYPE_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_TYPE_H_
+
+
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_services.h>
+#include "system_service/tskm_svcid.h"
+
+
+#define TSKM_ERR_t int32_t
+#define TSKM_E_OK 0
+#define TSKM_E_PAR 1
+#define TSKM_E_STATE 2
+#define TSKM_E_PERMIT 3
+#define TSKM_E_ALREADY 4
+#define TSKM_E_RETRY 5
+#define TSKM_E_NG 6
+
+#define TSKM_BOOL_t int32_t
+#define TSKM_TRUE 1
+#define TSKM_FALSE 0
+
+#define TSKM_RSV_t int
+
+typedef uint32_t TSKM_SVCID_t;
+// Values are defined in tskm_svcid.h
+
+typedef enum {
+ TSKM_SVC_CMD_NOP, // Do nothing
+ TSKM_SVC_CMD_EXEC, // Startup service
+ TSKM_SVC_CMD_ENABLE, // Allow service startup
+ TSKM_SVC_CMD_DISABLE, // Prohibit service startup
+ TSKM_SVC_CMD_RESERVE, // Reserve service startup
+} TSKM_SVC_CMD_t;
+
+typedef struct {
+ TSKM_SVC_CMD_t cmd;
+} TSKM_SVC_CTL_t;
+
+typedef struct {
+ TSKM_SVCID_t svcId;
+ TSKM_BOOL_t isExecDisable;
+} TSKM_SVC_INFO_t;
+
+typedef enum {
+ TSKM_BOOT_NORMAL, // Normal start
+ TSKM_BOOT_FACTRESET, // start with factory default start
+ TSKM_BOOT_USERRESET, // start with resetting user info
+ TSKM_BOOT_VERSIONUP, // start with version up
+} TSKM_BOOT_t;
+
+typedef enum {
+ TSKM_LOGGING_TYPE_MODULE_LOGS, // logging request from the service
+ TSKM_LOGGING_TYPE_GRP_RELAUNCH, // logging by Group Relaunch
+} TSKM_LOGGING_TYPE_NORMAL_t;
+
+typedef enum {
+ TSKM_ERROR_REBOOT_NORMAL, // Anomaly detection
+} TSKM_ERROR_REBOOT_TYPE_t;
+
+#define TSKM_LOGGING_MSG_STR_SIZE 64
+
+typedef struct {
+ TSKM_LOGGING_TYPE_NORMAL_t type; // Log type
+ char messageStr[TSKM_LOGGING_MSG_STR_SIZE]; // Error message
+} TSKM_LOGGING_INFO_t;
+
+typedef struct {
+ TSKM_ERROR_REBOOT_TYPE_t type; // Reboot type
+ TSKM_LOGGING_INFO_t log; // Log info
+} TSKM_ERROR_REBOOT_t;
+
+typedef enum {
+ TSKM_DATAINIT_TYPE_USER, // Reset user info
+} TSKM_DATAINIT_TYPE_t;
+
+typedef struct {
+ TSKM_DATAINIT_TYPE_t type;
+ EFrameworkunifiedStatus (*onCompInit)(HANDLE hApp);
+} TSKM_DATAINIT_t;
+
+#define TSKM_ORDER_NAME_MAX 32
+
+typedef struct {
+ char orderName[TSKM_ORDER_NAME_MAX];
+} TSKM_WAKEUP_ORDER_t;
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_TYPE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/task_manager/server/include/tskm_comm.h b/video_in_hal/systemservice/task_manager/server/include/tskm_comm.h
new file mode 100755
index 0000000..c884be9
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/tskm_comm.h
@@ -0,0 +1,59 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Communication module header file
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_COMM_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_COMM_H_
+
+#include <sys/types.h>
+#include "system_service/tskm_local_type.h"
+
+#define TSKM_SOCKET_NAME "/tmp/tskm_sock" // Sockets for Primary Library
+
+#define TSKM_COMM_CONNECT_MAX (32)
+
+typedef struct {
+ pid_t pid;
+ int connFd;
+} TSKM_SRV_CONNENT_t;
+
+typedef struct {
+ uint32_t num;
+ TSKM_SRV_CONNENT_t conn[TSKM_COMM_CONNECT_MAX];
+} TSKM_SRV_CONNENT_LIST_t;
+
+typedef struct {
+ int sockFd;
+ const char *sockName;
+ TSKM_SRV_CONNENT_LIST_t connList;
+} TSKM_SRV_SOCK_CTX_t;
+
+TSKM_ERR_t tskm_srvSockCreate(const char* sockName,
+ TSKM_SRV_SOCK_CTX_t* p_sock);
+TSKM_SRV_CONNENT_t* tskm_srvSockConnect(TSKM_SRV_SOCK_CTX_t* p_sock);
+void tskm_srvSockDisconnect(TSKM_SRV_SOCK_CTX_t* p_sock,
+ TSKM_SRV_CONNENT_t *p_conn);
+void tskm_srvSockDestory(TSKM_SRV_SOCK_CTX_t* p_sock);
+int tskm_cliSockConnect(const char* sockName);
+int tskm_sockRcv(int fd, TSKM_EVENT_INFO_t* p_ev);
+int tskm_sockSend(int fd, TSKM_EVENT_INFO_t* p_ev);
+void tskm_sockDestory(int fd);
+
+int tskm_comm_procInit(void);
+int tskm_comm_setSvcWatchState(uint32_t id, BOOL bIsRun, uint32_t timeout);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_COMM_H_
+
diff --git a/video_in_hal/systemservice/task_manager/server/include/tskm_debug.h b/video_in_hal/systemservice/task_manager/server/include/tskm_debug.h
new file mode 100755
index 0000000..ae963a8
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/tskm_debug.h
@@ -0,0 +1,208 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_DEBUG_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_DEBUG_H_
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <native_service/ns_logger_if.h>
+#include "system_service/tskm_svc.h"
+
+#include "system_service/tskm_local_type.h"
+
+#define TSKM_STATIC static
+
+// for frameworkunifiedlog
+#define ZONE_INIT ZONEMASK(10) // Reserved for lib
+#define ZONE_FUNC ZONEMASK(11) // Reserved for lib
+#define ZONE_MEM ZONEMASK(12) // Reserved for lib
+#define ZONE_OUT ZONEMASK(13)
+#define ZONE_STATE ZONEMASK(14) // Basic state change
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29) // Reserved for lib
+#define ZONE_WARN ZONEMASK(30) // Reserved for lib
+#define ZONE_ERR ZONEMASK(31) // Reserved for lib
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT|LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_OUT, ZONE_WARN, ZONE_ERR, ZONE_STATE, ZONE_PERFORMANCE, ZONE_SYSTEMDATA
+/*
+ ZONE_NS_FUNC,\
+ ZONE_NS_DIS,\
+ ZONE_NS__CWORD77_,\
+ ZONE_NS_IMP_INFO,\
+ ZONE_NS_SM_DEV_INFO,\
+ ZONE_NS_SM_USR_INFO,\
+ ZONE_NS_INFO,\
+ ZONE_NS_DEBUG_DUMP,\
+ ZONE_NS_WAR ,\
+ ZONE_NS_ERR ,\
+ ZONE_DEBUG_DUMP
+ */
+#endif
+
+#define TSKM_LOG_ERROR 0x00000001U
+#define TSKM_LOG_STATE 0x00000002U
+#define TSKM_LOG_DEBUG 0x00000004U
+#define TSKM_LOG_API 0x00000008U
+#define TSKM_LOG_PORTPF 0x00000010U
+#define TSKM_LOG_FUNC 0x00000020U
+#define TSKM_LOG_MSG 0x00000040U
+#define TSKM_LOG_WARN 0x00000080U
+#define TSKM_LOG_SVCSTATE 0x00000100U
+#define TSKM_LOG_SYSTEMDATA 0x00000200U
+
+// For debugging
+#define TSKM_LOG_CUSTUM (0 \
+ )
+/*
+ |TSKM_LOG_MSG \
+ |TSKM_LOG_DEBUG \
+ |TSKM_LOG_FUNC \
+ |TSKM_LOG_PORTPF \
+ */
+
+typedef enum {
+ TSKM_LOG_TYPE_TEXT,
+ TSKM_LOG_TYPE_PLACE,
+} TSKM_LOG_TYPE_t;
+
+#define TSKM_DEFAULT_PRINTF(flag, fmt, ...) { \
+ switch (flag) { \
+ case TSKM_LOG_SYSTEMDATA: \
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSTEMDATA, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_API: \
+ case TSKM_LOG_STATE: \
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_ERROR: \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_WARN: \
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_DEBUG: \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_MSG: \
+ case TSKM_LOG_FUNC: \
+ case TSKM_LOG_PORTPF: \
+ default: \
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ } \
+ }
+
+#define TSKM_PRINTF(flag, fmt, ...) { \
+ if (TSKM_LOG_SVCSTATE == flag) { \
+ /* Logs at startup and termination */ \
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, fmt, ## __VA_ARGS__); \
+ } else if (TSKM_LOG_CUSTUM & flag) { \
+ /* Logging by STATE when CUSTUM is specified */ \
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, fmt, ## __VA_ARGS__); \
+ } else { \
+ TSKM_DEFAULT_PRINTF(flag, fmt, ## __VA_ARGS__); \
+ } \
+ }
+
+#define TSKM_ASSERT(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TSKM_ASSERT"); \
+ }
+
+#define TSKM_ASSERT_ERRNO(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TSKM_ASSERT %d:%s", errno, strerror(errno)); \
+ }
+
+#define TSKM_ASSERT_PRINT(x, fmt, ...) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TSKM_ASSERT:" fmt, ## __VA_ARGS__); \
+ }
+
+#define TSKM_STATIC_ASSERT(expr) \
+ { \
+ char STATIC_ASSERTION_FAILED[(expr) ? 1 : -1]; \
+ (void)STATIC_ASSERTION_FAILED; \
+ }
+
+#define TSKM_DUMP(addr, size) { \
+ char* buf = (char*)addr; /* NOLINT (readability/casting) */ \
+ int ii; \
+ printf("[DUMP] %s:%d addr:%p size:%d", __FUNCTION__, __LINE__, addr, size); \
+ for (ii=0 ; ii < size ; ii++) { \
+ if (ii%16 == 0) printf(" "); \
+ if (ii%32 == 0) printf("\n"); \
+ printf("%02x", buf[ii]); \
+ } \
+ printf("\n"); \
+ }
+
+#define TSKM_FUNC_IN() TSKM_PRINTF(TSKM_LOG_FUNC, "%s:IN", __FUNCTION__)
+
+#define TSKM_FUNC_OUT() TSKM_PRINTF(TSKM_LOG_FUNC, "%s:OUT", __FUNCTION__)
+
+const char* tskm_convState2Str(TSKM_STATE_t state);
+const char* tskm_convLocalStep2Str(TSKM_LOCAL_STEP_t localStep);
+const char* tskm_convEvent2Str(TSKM_EVENT_t event);
+const char* tskm_convInitCompId2Str(uint64_t compId);
+const char* tskm_convTermCompId2Str(uint64_t compId);
+const char* tskm_convSvcState2Str(TSKM_SVC_STATE_t state);
+void tskm_svcsDump(TSKM_SVCS_CTX_t* p_svcs);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_DEBUG_H_
diff --git a/video_in_hal/systemservice/task_manager/server/include/tskm_main.h b/video_in_hal/systemservice/task_manager/server/include/tskm_main.h
new file mode 100755
index 0000000..24ba5f1
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/tskm_main.h
@@ -0,0 +1,71 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_
+
+#include <system_service/ss_boot_map.h>
+
+#include "system_service/tskm_svc.h"
+#include "system_service/tskm_local_type.h"
+#include "tskm_comm.h"
+#include "tskm_type_local.h"
+
+typedef struct {
+ // State
+ TSKM_BOOL_t isExec; // Executing flag
+ TSKM_STATE_t state; // TSKM state
+
+ // API
+ TSKM_BOOL_t inApi; // API running
+ TSKM_ERR_t apiRet; // API return
+ TSKM_BOOL_t isReboot; // REBOOT request
+
+ TSKM_BOOL_t isOnStartDone; // System start process completion flag
+ TSKM_BOOL_t isOnStopDone; // System stop process completion flag
+
+ // Communication
+ TSKM_SRV_SOCK_CTX_t sock; // priLib socket
+ int sigFd; // signalFd(process-termination-detection)
+ HANDLE hApp; // DispatcherHandle
+ int nsFd; // For receiving from the NSFW
+ int iFd; // inotify FDs
+ int resmFd; // EV FDs of RESM
+
+ // Non-volatile info
+ TSKM_NV_INFO_t nvInfo; // Non-volatile information
+
+ // Startup info
+ T_SS_SM_START_DataStructType bootInfo; // for Pri notification
+ T_SS_SM_START_ExtDataStructType extBootInfo; // for Pri notification
+
+ // Analysis support
+ STATEMGR__CWORD69_LOG* p__CWORD69_Log; // BUGBUG: Required or not
+
+ // Services management
+ TSKM_SVCS_CTX_t svcs;
+
+ // Gradual starting state management
+ TSKM_GSTEP_CTX_t wakeup;
+
+ // Gradual terminating state management
+ TSKM_GSTEP_CTX_t down;
+} TSKM_MAIN_CTX_t;
+
+EFrameworkunifiedStatus OnStart(const HANDLE hApp); // System start process
+TSKM_MAIN_CTX_t* tskm_getMainCtx(void);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_
diff --git a/video_in_hal/systemservice/task_manager/server/include/tskm_port_pf.h b/video_in_hal/systemservice/task_manager/server/include/tskm_port_pf.h
new file mode 100755
index 0000000..31da5ab
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/tskm_port_pf.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_PF_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_PF_H_
+
+#include <native_service/cl_process.h>
+
+#include "system_service/tskm_svc.h"
+#include "system_service/tskm_local_type.h"
+#include "tskm_main.h"
+
+int tskm_pf_sysInit();
+int tskm_pf_procInit();
+pid_t tskm_pf_createProc(TSKM_SVC_ATTR_t* p_svcAttr);
+int tskm_pf_cleanupProc(int sigFd, pid_t* p_pid, TSKM_ERR_t* p_err);
+int tskm_pf_terminateProcGroup(uint16_t pid);
+int tskm_pf_shmCreate(const char* name, int32_t size, void** p_addr);
+int tskm_pf_shmDelete(const char* name);
+int tskm_pf_createThread(void* (*threadFunc)(void*), void* prm,
+ uint32_t priority, const char* threadName,
+ pthread_t* p_thId);
+int tskm_pf_sendStopCompResp();
+int tskm_pf_abort();
+int tskm_pf_exit(int status);
+int tskm_pf_touch(char* path);
+int tskm_pf_mkTouchFileName(pid_t pid, char name[32]);
+int tskm_pf_nvFileInit(HANDLE hApp);
+int tskm_pf_nvFileRead(HANDLE hApp, TSKM_NV_INFO_t* p_nvInfo);
+int tskm_pf_nvFileWrite(const TSKM_NV_INFO_t* p_nvInfo);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_PF_H_
+
diff --git a/video_in_hal/systemservice/task_manager/server/include/tskm_port_subsys.h b/video_in_hal/systemservice/task_manager/server/include/tskm_port_subsys.h
new file mode 100755
index 0000000..3dc3565
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/tskm_port_subsys.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_SUBSYS_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_SUBSYS_H_
+
+#include "system_service/tskm_local_type.h"
+#include "tskm_main.h"
+
+typedef struct {
+ pid_t pid;
+ uint8_t type; // CL_MonitorType_t
+} TSKM_HUNG_INFO_t;
+
+int tskm_sub_init(void);
+int tskm_sub_term(void);
+void tskm_sub_reboot(const TSKM_ERROR_REBOOT_t* p_info);
+void tskm_sub_reboot_normal(void);
+void tskm_sub_logging(const TSKM_LOGGING_INFO_t* p_info);
+void tskm_sub_debugDumpRes(BOOL bIsNeedSvcName, const char *p_dumpMsg);
+int tskm_sub_getExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info);
+
+TSKM_HUNG_INFO_t *tskm_sub_searchHungSvcs();
+int tskm_sub_resmInit();
+int tskm_sub_resmRcv(TSKM_EVENT_INFO_t* p_ev);
+int tskm_sub_setWakeupOrder(const char* p_order);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_SUBSYS_H_
+
diff --git a/video_in_hal/systemservice/task_manager/server/include/tskm_shutdown.h b/video_in_hal/systemservice/task_manager/server/include/tskm_shutdown.h
new file mode 100755
index 0000000..bb76d3c
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/tskm_shutdown.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_SHUTDOWN_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_SHUTDOWN_H_
+
+#include "tskm_main.h"
+
+TSKM_ERR_t tskm_entryDown(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitDown(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_handleDown(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_SHUTDOWN_H_
+
diff --git a/video_in_hal/systemservice/task_manager/server/include/tskm_state.h b/video_in_hal/systemservice/task_manager/server/include/tskm_state.h
new file mode 100755
index 0000000..748d25e
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/tskm_state.h
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_STATE_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_STATE_H_
+
+#include "system_service/tskm_local_type.h"
+#include "system_service/tskm_type.h"
+#include "tskm_main.h"
+
+#define TSKM_SUB_STATE_IS(p_main, subState) \
+ (((p_main)->state & subState) == subState) // NOLINT (runtime/references)
+
+// Public functions
+TSKM_ERR_t tskm_entryState(TSKM_MAIN_CTX_t* p_rec, TSKM_STATE_t state);
+TSKM_ERR_t tskm_exitState(TSKM_MAIN_CTX_t* p_rec, TSKM_STATE_t state);
+TSKM_ERR_t tskm_stateTransit(TSKM_MAIN_CTX_t* p_main, TSKM_STATE_t srcState,
+ TSKM_STATE_t dstState);
+void tskm_handleEvent(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+TSKM_ERR_t tskm_handleAccon(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_STATE_H_
diff --git a/video_in_hal/systemservice/task_manager/server/include/tskm_wakeup.h b/video_in_hal/systemservice/task_manager/server/include/tskm_wakeup.h
new file mode 100755
index 0000000..d4a1193
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/tskm_wakeup.h
@@ -0,0 +1,26 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_WAKEUP_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_WAKEUP_H_
+
+#include "tskm_main.h"
+
+TSKM_ERR_t tskm_entryWakeup(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitWakeup(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_handleWakeup(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_WAKEUP_H_
diff --git a/video_in_hal/systemservice/task_manager/server/include/tskm_watch.h b/video_in_hal/systemservice/task_manager/server/include/tskm_watch.h
new file mode 100755
index 0000000..d1aced5
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/include/tskm_watch.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_WATCH_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_WATCH_H_
+
+#include "tskm_main.h"
+
+int tskm_watch_startTimer();
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_WATCH_H_
+
diff --git a/video_in_hal/systemservice/task_manager/server/src/pri_main.cpp b/video_in_hal/systemservice/task_manager/server/src/pri_main.cpp
new file mode 100755
index 0000000..2c87623
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/pri_main.cpp
@@ -0,0 +1,840 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "pri_main.h"
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+#include <sys/eventfd.h>
+#include <stdlib.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <system_service/ss_system_if.h>
+
+#include "tskm_debug.h"
+#include "tskm_comm.h"
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+#include "tskm_util.h"
+
+
+
+#define PRI_PROC_NAME_MAX 32
+
+// Context
+typedef struct {
+ T_PRIM_PRM prm;
+
+ TSKM_SVCID_t svcId; // Set valid value by REQ_WAKEUP
+ char procName[PRI_PROC_NAME_MAX];
+ // State
+ TSKM_BOOL_t isExec;
+ T_SS_SM_START_DataStructType bootInfo;
+ T_SS_SM_START_ExtDataStructType extBootInfo; TSKM_BOOL_t isDynamic;
+ uint32_t wakeupStepDone; // Executed local step
+ TSKM_BOOL_t shmDone;
+ uint32_t downStepDone; // Executed local step
+ TSKM_BOOL_t isExitStart;
+
+#define PRI_MONITOR_DEFAULT_TIMEOUT 50
+ uint32_t timeout; // Service monitoring timeout period (valid only for the INI_Main type service)
+
+ // Resources
+ int connFd; // TSKM communication socket
+ int nsFd; // NSFW socket
+ int pipeFd[2]; // for exitDone
+ HANDLE hApp; // appHandle
+} PRI_CTX_t;
+
+static PRI_CTX_t g_pri;
+
+/*********************************************
+ * Create shared memory
+ *********************************************/
+TSKM_STATIC void shmMake(PRI_CTX_t* p_ctx) {
+ const PRIM_SHAREDATA_TBL* shmEntry;
+ for (shmEntry = p_ctx->prm.shmTbl; shmEntry->shmName[0] != '\0'; shmEntry++) {
+ int ret;
+ ret = tskm_pf_shmCreate(shmEntry->shmName, shmEntry->size, NULL);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+ }
+ p_ctx->shmDone = TSKM_TRUE;
+ return;
+
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************
+ * Call backup check CB
+ *********************************************/
+TSKM_STATIC uint32_t wakeupExFuncCallback(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ const PRIM_EXFUNC_TBL* funcEntry;
+ uint32_t maxStep = 0;
+
+ for (funcEntry = p_ctx->prm.wakeupExFuncTbl; funcEntry->localStep != 0;
+ funcEntry++) {
+ if (funcEntry->localStep == p_prm->localStep) {
+ funcEntry->func(funcEntry->prm);
+ }
+ maxStep = TSKM_MAX(maxStep, funcEntry->localStep);
+ }
+ return maxStep;
+}
+
+/*********************************************
+ * Gradual startup request
+ *********************************************/
+TSKM_STATIC void wakeupRequest(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t prm = *p_prm;
+ uint32_t max = 0;
+
+ // Execute step by step
+ for (prm.localStep = p_ctx->wakeupStepDone + 1;
+ (prm.localStep <= p_prm->localStep && prm.localStep < PRIM_STEPFORK_MAX);
+ prm.localStep++) {
+ max = wakeupExFuncCallback(p_ctx, &prm);
+ }
+
+ if (max <= p_prm->localStep) {
+ // Completed gradual startup
+ p_ctx->wakeupStepDone = PRIM_STEPFORK_MAX;
+ } else {
+ p_ctx->wakeupStepDone = p_prm->localStep;
+ }
+}
+
+/*********************************************
+ * All startup requests
+ *********************************************/
+TSKM_STATIC void allWakeup(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ if (!p_ctx->shmDone) {
+ shmMake(p_ctx);
+ }
+
+ if (p_ctx->wakeupStepDone < PRIM_STEPFORK_MAX) {
+ wakeupRequest(p_ctx, p_prm);
+ }
+}
+
+/*********************************************
+ * Startup request handles
+ *********************************************/
+TSKM_STATIC void wakeupRequestHandle(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+
+ bzero(&ev, sizeof(ev));
+
+ p_ctx->svcId = p_prm->svcId;
+ memcpy(&p_ctx->bootInfo, &p_prm->bootInfo, sizeof(p_ctx->bootInfo));
+ memcpy(&p_ctx->extBootInfo, &p_prm->extBootInfo, sizeof(p_ctx->extBootInfo));
+ p_ctx->isDynamic = p_prm->isDynamic;
+
+ if (p_prm->localStep == TSKM_LSTEP_ALL) {
+ allWakeup(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_LAST) {
+ wakeupRequest(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_SHM) {
+ shmMake(p_ctx);
+ } else {
+ wakeupRequest(p_ctx, p_prm);
+ }
+
+ ev.prm.resWakeup.isShmDone = p_ctx->shmDone;
+ ev.prm.resWakeup.isStepDone =
+ (p_ctx->wakeupStepDone >= PRIM_STEPFORK_MAX) ?
+ TSKM_TRUE :
+ TSKM_FALSE;
+
+ // LCOV_EXCL_BR_START 6: Because it depends on the test order
+ if (ev.prm.resWakeup.isShmDone && ev.prm.resWakeup.isStepDone) {
+ // LCOV_EXCL_BR_STOP
+ ev.prm.resWakeup.isLast = TSKM_TRUE;
+ }
+
+ ev.event = TSKM_EV_PRI_RES_WAKEUP;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+}
+
+/*********************************************
+ * Gradual termination callback
+ *********************************************/
+TSKM_STATIC uint32_t downExFuncCallback(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ const PRIM_EXFUNC_TBL* funcEntry;
+ uint32_t maxStep = 0;
+
+ for (funcEntry = p_ctx->prm.downExFuncTbl; funcEntry->localStep != 0;
+ funcEntry++) {
+ if (funcEntry->localStep == p_prm->localStep) {
+ funcEntry->func(funcEntry->prm);
+ }
+ maxStep = TSKM_MAX(maxStep, funcEntry->localStep);
+ }
+ return maxStep;
+}
+
+/*********************************************
+ * Gradual termination requests
+ *********************************************/
+TSKM_STATIC void downRequest(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ TSKM_EV_PRI_REQ_DOWN_PRM_t prm = *p_prm;
+ uint32_t max = 0;
+
+ // Execute step by step
+ for (prm.localStep = p_ctx->downStepDone + 1;
+ (prm.localStep <= p_prm->localStep && prm.localStep < PRIM_ACCOFF_MAX);
+ prm.localStep++) {
+ max = downExFuncCallback(p_ctx, &prm);
+ }
+
+ if (max <= p_prm->localStep) {
+ p_ctx->downStepDone = PRIM_ACCOFF_MAX; // Completed all steps
+ } else {
+ p_ctx->downStepDone = p_prm->localStep;
+ }
+}
+
+TSKM_STATIC void downRequestHandle(PRI_CTX_t* p_ctx,
+ TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+
+ bzero(&ev, sizeof(ev));
+
+ if (p_prm->localStep == TSKM_LSTEP_ALL || p_prm->localStep == TSKM_LSTEP_LAST) {
+ downRequest(p_ctx, p_prm);
+ } else if (p_prm->localStep == TSKM_LSTEP_SHM) {
+ TSKM_ASSERT(0);
+ } else if (p_prm->localStep == TSKM_LSTEP_BUPCHK) {
+ TSKM_ASSERT(0);
+ } else {
+ downRequest(p_ctx, p_prm);
+ }
+
+ if (p_ctx->downStepDone >= PRIM_ACCOFF_MAX) {
+ /* It is not notified when the last function is executed, and it is left to the exitDone.
+ TSKM_PRINTF(TSKM_LOG_DEBUG,"ACCOFF DONE");
+ ev.prm.resDown.isLast = TSKM_TRUE;
+ p_ctx->isExec = TSKM_FALSE;
+ ret = tskm_sockSend(p_ctx->connFd,&ev);
+ if(ret <= 0){
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ }
+ */
+ } else {
+ ev.event = TSKM_EV_PRI_RES_DOWN;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+ }
+}
+
+/*********************************************
+ * Termination completion notification to the TSKM
+ *********************************************/
+TSKM_STATIC void sendLastDoneRes(PRI_CTX_t* p_ctx) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_PRI_RES_DOWN;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.resDown.isLast = TSKM_TRUE;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+}
+
+/*********************************************
+ * Call Touch CB
+ *********************************************/
+TSKM_STATIC void touchService(PRI_CTX_t* p_ctx) {
+ char touchName[32];
+
+ if (p_ctx->isExitStart) {
+ // If termination has already begun, the system just processes as timeout for retrying not respond Touch
+ return;
+ }
+
+ p_ctx->prm.onTouch(p_ctx->hApp);
+
+ tskm_pf_mkTouchFileName(getpid(), touchName);
+
+ if ((access(touchName, F_OK) == 0)) {
+ // Synchronize by deleting files.
+ TSKM_PRINTF(TSKM_LOG_STATE, "del:%s", touchName);
+ unlink(touchName);
+ } else {
+ TSKM_ASSERT_PRINT(0, "%s", touchName);
+ }
+}
+
+/*********************************************
+ * Call Debugdump CB
+ *********************************************/
+TSKM_STATIC void callDebugDump(PRI_CTX_t* p_ctx) {
+ if (!p_ctx->prm.onDebugDump) { // LCOV_EXCL_BR_LINE 6: As NULL checked by INI_Init
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: As NULL checked by INI_Init
+ } else {
+ p_ctx->prm.onDebugDump(p_ctx->hApp);
+ }
+}
+
+/*********************************************
+ * Call LowMemory detection
+ *********************************************/
+TSKM_STATIC void callLowMem(PRI_CTX_t* p_ctx) {
+ if (!p_ctx->prm.onLowMem) {
+ TSKM_ASSERT(0);
+ } else if (!p_ctx->isExitStart) {
+ // Notify LowMemory only before starting terminating process
+ p_ctx->prm.onLowMem(p_ctx->hApp);
+ }
+}
+
+/*********************************************
+ * Event handles
+ *********************************************/
+TSKM_STATIC void eventHandle(PRI_CTX_t* p_ctx, TSKM_EVENT_INFO_t* p_ev) {
+ //Processing according to the request
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REQ_WAKEUP:
+ wakeupRequestHandle(p_ctx, &p_ev->prm.reqWakeup);
+ break;
+ case TSKM_EV_PRI_REQ_DOWN:
+ downRequestHandle(p_ctx, &p_ev->prm.reqDown);
+ break;
+ case TSKM_EV_PRI_REQ_TOUCH:
+ touchService(p_ctx);
+ break;
+ case TSKM_EV_PRI_REQ_DEBUGDUMP:
+ callDebugDump(p_ctx);
+ break;
+ case TSKM_EV_PRI_REP_LOWMEM:
+ callLowMem(p_ctx);
+ break;
+ default:
+ TSKM_ASSERT(0);
+ break;
+ }
+}
+
+/*********************************************
+ * Initialize Context
+ *********************************************/
+TSKM_STATIC void initCtx(T_PRIM_PRM* p_prm, PRI_CTX_t* p_ctx, int argc,
+ char* argv[]) {
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+
+ p_ctx->prm = *p_prm;
+
+ cbFuncs.onInitilization = p_ctx->prm.onInit;
+ cbFuncs.onDestroy = p_ctx->prm.onDestory;
+ cbFuncs.onDebugDump = p_ctx->prm.onDebugDump;
+ cbFuncs.onStart = FrameworkunifiedOnStart;
+ cbFuncs.onStop = FrameworkunifiedOnStop;
+ cbFuncs.createStateMachine = FrameworkunifiedCreateStateMachine;
+ cbFuncs.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface;
+
+ EFrameworkunifiedStatus taskmanagerRet;
+ taskmanagerRet = FrameworkunifiedCreateDispatcherWithoutLoop(p_ctx->prm.name, p_ctx->hApp, argc,
+ argv, &cbFuncs, FALSE);
+ if (eFrameworkunifiedStatusOK != taskmanagerRet) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+
+ taskmanagerRet = FrameworkunifiedGetDispatcherFD(p_ctx->hApp, &p_ctx->nsFd);
+ if (taskmanagerRet != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ exit(EXIT_FAILURE);
+ }
+ p_ctx->connFd = tskm_cliSockConnect(TSKM_SOCKET_NAME);
+ if (p_ctx->connFd < 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+ if (pipe(p_ctx->pipeFd) != 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+
+ return;
+
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************
+ * Destroy context
+ *********************************************/
+TSKM_STATIC void termCtx(PRI_CTX_t* p_ctx) {
+ if (p_ctx->shmDone) { // LCOV_EXCL_BR_LINE 6: Since it has been set to True by INI_Handler and cannot be changed
+ const PRIM_SHAREDATA_TBL* shmEntry = p_ctx->prm.shmTbl;
+ for (shmEntry = p_ctx->prm.shmTbl; shmEntry->shmName[0] != '\0';
+ shmEntry++) {
+ TSKM_ASSERT(0 == tskm_pf_shmDelete(shmEntry->shmName)); // LCOV_EXCL_BR_LINE 8: For processing in which only return value 0 is set
+ }
+ }
+
+ if (p_ctx->connFd > 0) { // LCOV_EXCL_BR_LINE 6: For processing in which only return value 0 is set
+ tskm_sockDestory(p_ctx->connFd);
+ }
+
+ EFrameworkunifiedStatus taskmanagerRet;
+ taskmanagerRet = FrameworkunifiedDestroyDispatcherWithoutLoop(p_ctx->hApp);
+ TSKM_ASSERT(taskmanagerRet == eFrameworkunifiedStatusOK);
+
+ if (p_ctx->isDynamic) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "EXIT %s", p_ctx->procName);
+ } else {
+ // Hung up running services to prevent adversely affecting to system termination processing during process termination processing
+ sleep(TSKM_CFG_WAIT_SHUTDOWN);
+ }
+}
+
+/*******************************************************************
+ * Initialize PRI context
+ *******************************************************************/
+void pri_init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum,
+ int fdlist[INI_FD_MAX]) {
+ int ret = 0;
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ strncpy(p_ctx->procName, basename(argv[0]), sizeof(p_ctx->procName) - 1);
+
+ ret = tskm_pf_procInit();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: Return value of 0 only
+ // LCOV_EXCL_START 6: Return value of 0 only
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 6: Return value of 0 only
+ }
+
+ ret = tskm_comm_procInit();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ }
+
+ initCtx(p_prm, p_ctx, argc, argv);
+
+ *fdNum = 3;
+ fdlist[0] = p_ctx->connFd;
+ fdlist[1] = p_ctx->pipeFd[0];
+ fdlist[2] = p_ctx->nsFd;
+
+ p_ctx->svcId = TSKM_SVCID_NONE;
+ p_ctx->isExec = TSKM_TRUE;
+
+ p_ctx->bootInfo.startupReason = epswfINVALID;
+ p_ctx->bootInfo.isUserModeOn = FALSE;
+ p_ctx->bootInfo.dataResetMode = e_SS_SM_DATA_RESET_MODE_NONE;
+ p_ctx->bootInfo.securityStatus = epsssINVALID;
+ p_ctx->bootInfo.wakeupType = epsstINVALID;
+ p_ctx->bootInfo.dramBackupStatus = e_SS_SM_DRAM_BACKUP_UNSET;
+ p_ctx->bootInfo.resetStatus = e_SS_SM_RESET_STATUS_UNSET;
+
+ memset(&p_ctx->extBootInfo, 0, sizeof(p_ctx->extBootInfo));
+
+ p_ctx->timeout = PRI_MONITOR_DEFAULT_TIMEOUT;
+
+ return;
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort(); // ABORT
+// LCOV_EXCL_STOP
+}
+
+/*******************************************************************
+ * Primary library handler
+ *******************************************************************/
+BOOL pri_handler(fd_set* p_fds) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (FD_ISSET(p_ctx->connFd, p_fds)) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+ ret = tskm_sockRcv(p_ctx->connFd, &ev);
+ // LCOV_EXCL_BR_START 5: True condition is checked in Death tests, but not reflected in coverage and excluded
+ if (ret > 0) {
+ // LCOV_EXCL_BR_STOP
+ eventHandle(p_ctx, &ev);
+ } else { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (FD_ISSET(p_ctx->pipeFd[0], p_fds)) {
+ // only use exitDone
+ uint32_t tmp;
+ TSKM_ASSERT(sizeof(tmp) == read(p_ctx->pipeFd[0], &tmp, sizeof(tmp)));
+ TSKM_ASSERT(p_ctx->downStepDone == PRIM_ACCOFF_MAX); // Check if all exit functions are complete
+ if (p_ctx->isDynamic) {
+ // A nonresident service completes its termination processing by terminating the process (because the SIGNAL will overtake the sockets)
+ } else {
+ // The resident service completes termination processing with a termination notice (Do not terminate processes to reduce the impact on system termination)
+ sendLastDoneRes(p_ctx);
+ }
+ p_ctx->isExec = TSKM_FALSE;
+ }
+
+ if (FD_ISSET(p_ctx->nsFd, p_fds)) {
+ FrameworkunifiedDispatchProcessWithoutLoop(p_ctx->hApp);
+ }
+ return p_ctx->isExec;
+
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort(); // ABORT
+ return 0;
+// LCOV_EXCL_STOP
+}
+
+/*******************************************************************
+ * Process termination
+ *******************************************************************/
+void pri_term(void) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ termCtx(p_ctx);
+}
+
+/*******************************************************************
+ * Service Monitoring Status Setting
+ *******************************************************************/
+int pri_setMonitorState(BOOL bIsRun, uint32_t timeout) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ int ret = INI_SUCCESS;
+
+ if (TSKM_SVCID_NONE == p_ctx->svcId) {
+ // Ignore requests until svcId is acquired
+ } else if ((TRUE == bIsRun) && (0 == timeout)) {
+ // When RUN is specified with timeout = 0, monitoring is disabled
+ } else {
+ ret = tskm_comm_setSvcWatchState(p_ctx->svcId, bIsRun, timeout);
+ if (INI_SUCCESS != ret) {
+ TSKM_ASSERT(0);
+ }
+ }
+
+ return ret;
+}
+
+/*******************************************************************
+ * MAIN function
+ *******************************************************************/
+int pri_main(T_PRIM_PRM* p_prm, int argc, char* argv[]) {
+ int mainRet = -1;
+ int fdlist[INI_FD_MAX];
+ int fdNum;
+ int ii;
+ BOOL isExec = TRUE;
+
+ pri_init(p_prm, argc, argv, &fdNum, fdlist);
+
+ while (isExec) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ int maxFd = 0;
+ fd_set fds;
+ int ret;
+
+ FD_ZERO(&fds);
+
+ for (ii = 0; ii < fdNum; ii++) {
+ FD_SET(fdlist[ii], &fds);
+ maxFd = TSKM_MAX(fdlist[ii], maxFd);
+ }
+
+ TSKM_ASSERT(INI_SUCCESS == pri_setMonitorState(FALSE, 0));
+ ret = select(maxFd + 1, &fds, NULL, NULL, NULL);
+ TSKM_ASSERT(INI_SUCCESS == pri_setMonitorState(TRUE, p_ctx->timeout));
+ if (ret < 1) {
+ if (errno != EINTR) {
+ TSKM_ASSERT(0);
+ }
+ continue;
+ }
+
+ isExec = pri_handler(&fds);
+ }
+
+ mainRet = 0;
+
+ pri_term();
+ return mainRet;
+}
+
+/*******************************************************************
+ * Termination request
+ *******************************************************************/
+void pri_exitStart(void *rsv) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+ p_ctx->isExitStart = TRUE;
+ ev.event = TSKM_EV_PRI_REQ_EXIT;
+ ev.errCode = TSKM_E_OK;
+
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ return;
+ // LCOV_EXCL_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_abort();
+ // LCOV_EXCL_STOP
+}
+
+void pri_exitDone(int status) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ uint32_t l_status = (uint32_t) status;
+
+ // LCOV_EXCL_BR_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ if (p_ctx->pipeFd[1] > 0) {
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(
+ write(p_ctx->pipeFd[1], &l_status, sizeof(l_status))
+ == sizeof(l_status));
+ // LCOV_EXCL_STOP
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: The caller's external API does not execute the second or subsequent processing and cannot be checked
+ }
+}
+
+/*******************************************************************
+ * Event completion notification at startup
+ *******************************************************************/
+int32_t pri_stepForkComp(uint64_t id) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+ ev.event = TSKM_EV_PRI_REP_WAKEUP_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repWakeupComp.compId = id;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ return INI_SUCCESS;
+ ERROR: return INI_FALSE;
+}
+
+/*******************************************************************
+ * Event completion notification at termination
+ *******************************************************************/
+int32_t pri_accOffComp(uint64_t id) {
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_PRI_REP_DOWN_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repDownComp.compId = id;
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ return INI_SUCCESS;
+ ERROR: return INI_FALSE;
+}
+
+/*******************************************************************
+ * Get private info
+ *******************************************************************/
+void*
+pri_getPrivate() {
+ PRI_CTX_t* p_ctx = &g_pri;
+ return p_ctx->prm.priv;
+}
+
+/*******************************************************************
+ * Get app-handle
+ *******************************************************************/
+HANDLE pri_getHandle() {
+ PRI_CTX_t* p_ctx = &g_pri;
+ return p_ctx->hApp;
+}
+
+/*******************************************************************
+ * Service monitoring status setting timeout setting
+ *******************************************************************/
+int32_t pri_setMonitorTimeout(uint32_t timeout) {
+ PRI_CTX_t* p_ctx = &g_pri;
+ p_ctx->timeout = timeout;
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * Get boot info
+ *******************************************************************/
+int32_t pri_getBootInfo(T_SS_SM_START_DataStructType *info) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (p_ctx->bootInfo.startupReason == epswfINVALID) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+
+ *info = p_ctx->bootInfo;
+
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * Get extended boot info
+ *******************************************************************/
+int32_t pri_getExtBootInfo(T_SS_SM_START_ExtDataStructType *info) {
+ PRI_CTX_t* p_ctx = &g_pri;
+
+ if (p_ctx->bootInfo.startupReason == epswfINVALID) {
+ TSKM_ASSERT(0);
+ return INI_FALSE;
+ }
+
+ *info = p_ctx->extBootInfo;
+
+ return INI_SUCCESS;
+}
+
+/*******************************************************************
+ * DebugDump response
+ *******************************************************************/
+void pri_sendDebugDumpRes(const char *buf) { // LCOV_EXCL_START 7: Debugging code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int ret;
+ PRI_CTX_t* p_ctx = &g_pri;
+ TSKM_EVENT_INFO_t ev;
+ TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *p_prm;
+
+ ev.event = TSKM_EV_PRI_RES_DEBUGDUMP;
+ ev.errCode = TSKM_E_OK;
+ ev.hasExtend = TSKM_TRUE;
+
+ ev.extendPrm = malloc(sizeof(TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t));
+ if (!ev.extendPrm) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ ev.extendSize = sizeof(TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t);
+
+ p_prm = (TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *) ev.extendPrm; // NOLINT (readability/casting)
+ snprintf(p_prm->dumpMsg, TSKM_EV_DEBUGDUMP_SIZE, "%s", buf);
+
+ ret = tskm_sockSend(p_ctx->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ }
+
+ ERROR: return;
+}
+// LCOV_EXCL_STOP
+/*************************************************
+ * Empty functions implemented for building software
+ **************************************************/
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_api.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_api.cpp
new file mode 100755
index 0000000..94c8226
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_api.cpp
@@ -0,0 +1,268 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_debug.h"
+#include "tskm_main.h"
+#include "tskm_state.h"
+#include "tskm_util.h"
+
+#include "tskm_srvr.h"
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+
+/**
+ * _TSKM_SvcCtl Sub-func Task-startup-process
+ * @param svcId service id
+ * @param p_main TSKM_MAIN_CTX_t*
+ * @param p_svc TSKM_SVC_CTX_t*
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+
+TSKM_ERR_t tskm_svcExecRequest(TSKM_SVCID_t svcId, TSKM_MAIN_CTX_t* p_main, TSKM_SVC_CTX_t* p_svc) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ // Startup tasks
+ TSKM_GSTEP_REQ_INFO_t req = { 0 };
+
+ if (p_main->isOnStartDone == TSKM_FALSE) {
+ TSKM_PRINTF(TSKM_LOG_WARN, "Transient SVC cannot exec before get BootInfo");
+ return TSKM_E_STATE;
+ } else if (p_main->isOnStopDone == TSKM_TRUE) {
+ TSKM_PRINTF(TSKM_LOG_WARN, "Transient SVC cannot exec after FrameworkunifiedOnStop");
+ return TSKM_E_STATE;
+ }
+
+ tskmRet = tskm_svcExec(p_svc);
+ TSKM_ERR_CHK_DFT;
+ if (p_svc->state == TSKM_SVC_WAITCONNECT) {
+ // In the state of waiting to execute
+ req.svcId = svcId;
+ req.localStep = TSKM_LSTEP_ALL;
+ tskmRet = tskm_svcWakeupRequest(p_svc, &req);
+ TSKM_ERR_CHK_DFT; // LCOV_EXCL_BR_LINE 6: Because TSKM_ERR_CHK_DFT does not specify a condition for goto to ERROR
+ }
+ ERROR: return tskmRet;
+}
+
+/**
+ * _TSKM_SvcCtl Sub-func Task-startup-process
+ * @param p_main TSKM_MAIN_CTX_t*
+ * @param svcId TSKM_SVCID_t
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+
+TSKM_ERR_t tskm_svcReserveRequest(TSKM_MAIN_CTX_t* p_main, TSKM_SVCID_t svcId) {
+ uint8_t rsvSvcNum = p_main->nvInfo.body.rsvSvcNum;
+ TSKM_SVCID_t* p_rsvSvcs = p_main->nvInfo.body.rsvSvcs;
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ if (rsvSvcNum >= TSKM_SVC_RESERVE_MAX) {
+ tskmRet = TSKM_E_STATE;
+ } else {
+ int ii;
+ int ret;
+
+ for (ii = 0; ii < rsvSvcNum; ii++) {
+ if (p_rsvSvcs[ii] == svcId) {
+ TSKM_ASSERT_PRINT(0, "Rsv Req already registered(%d)", svcId);
+ // Return OK as continuable
+ return tskmRet;
+ }
+ }
+
+ p_rsvSvcs[rsvSvcNum] = svcId;
+ p_main->nvInfo.body.rsvSvcNum++;
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "Rsv Svc registered(%#x)", svcId);
+
+ ret = tskm_pf_nvFileWrite(&p_main->nvInfo); // LCOV_EXCL_BR_LINE 6: Return value of 0 only
+ if (ret == -1) {
+ TSKM_ASSERT(0);
+ tskmRet = TSKM_E_NG;
+ return tskmRet;
+ }
+ }
+ return tskmRet;
+}
+
+/**
+ * Service control
+ * @param svcId service id
+ * @param ctl control command
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+TSKM_ERR_t _TSKM_SvcCtl(TSKM_SVCID_t svcId, const TSKM_SVC_CTL_t* ctl) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+
+ TSKM_SVC_CTX_t* p_svc;
+
+ if (ctl == NULL) {
+ TSKM_ASSERT(0);
+ return TSKM_E_PAR;
+ }
+
+ p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs, svcId);
+ if (p_svc == NULL) {
+ TSKM_ASSERT(0);
+ TSKM_PRINTF(TSKM_LOG_ERROR, "unknown svcId:%#x", svcId);
+ return TSKM_E_PAR;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_API, "%s(%#x,%d)", __FUNCTION__, svcId, ctl->cmd);
+
+ if (ctl->cmd == TSKM_SVC_CMD_EXEC) {
+ tskmRet = tskm_svcExecRequest(svcId, p_main, p_svc);
+ } else if (ctl->cmd == TSKM_SVC_CMD_ENABLE) {
+ tskmRet = tskm_svcEnableRequest(p_svc);
+ TSKM_ERR_CHK_DFT; // LCOV_EXCL_BR_LINE 8: Because TSKM_ERR_CHK_DFT does not specify a condition for goto to ERROR
+
+ } else if (ctl->cmd == TSKM_SVC_CMD_DISABLE) {
+ tskmRet = tskm_svcDisableRequest(p_svc);
+ TSKM_ERR_CHK_DFT;
+
+ } else if (ctl->cmd == TSKM_SVC_CMD_RESERVE) {
+ tskmRet = tskm_svcReserveRequest(p_main, svcId);
+
+ } else {
+ return TSKM_E_PAR;
+ }
+
+ ERROR: return tskmRet;
+}
+
+/**
+ * Get service info
+ * @param svcId service id
+ * @param svcInfo[O] service info
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+TSKM_ERR_t TSKM_SvcGetInfo(TSKM_SVCID_t svcId, TSKM_SVC_INFO_t* svcInfo) {
+// Do not LOG acquisition APIs TSKM_PRINTF(TSKM_LOG_API,"%s()",__FUNCTION__)
+
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+ TSKM_SVC_CTX_t* p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs, svcId);
+
+ if (p_svc == NULL || svcInfo == NULL) {
+ return TSKM_E_PAR;
+ }
+
+ svcInfo->svcId = p_svc->attr->svcId;
+ svcInfo->isExecDisable =
+ (p_svc->state == TSKM_SVC_DISABLE) ? TSKM_TRUE : TSKM_FALSE;
+
+ return TSKM_E_OK;
+}
+
+RPC_Result _TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info) {
+ RPC_Result rpcRet = RPC_OK;
+ TSKM_ERROR_REBOOT_t rebootInfo;
+
+ if (!p_info || (p_info->type != TSKM_ERROR_REBOOT_NORMAL)) {
+ TSKM_ASSERT(0);
+ return RPC_ERR_Fatal;
+ }
+
+ memset(&rebootInfo, 0, sizeof(TSKM_ERROR_REBOOT_t));
+ rebootInfo.type = p_info->type;
+ snprintf(rebootInfo.log.messageStr, TSKM_LOGGING_MSG_STR_SIZE, "%s",
+ p_info->log.messageStr);
+
+ TSKM_PRINTF(TSKM_LOG_API, "%s(%d)", __FUNCTION__, p_info->type);
+
+ tskm_sub_reboot(&rebootInfo);
+
+ return rpcRet;
+}
+
+/**
+ * Reboot service
+ * @param p_rsv Reserved
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+TSKM_ERR_t TSKM_Reboot(const TSKM_RSV_t * p_rsv) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__)
+ if (p_rsv != NULL) {
+ TSKM_ASSERT(0);
+ return TSKM_E_PAR;
+ }
+
+ tskm_sub_reboot_normal();
+
+ return tskmRet;
+}
+
+/**
+ * Save LOGs
+ * @param p_info LOG storage info
+ * @return TSKM_E_OK Succeeded
+ * @return other Failed
+ */
+TSKM_ERR_t TSKM_Logging(const TSKM_LOGGING_INFO_t* p_info) {
+ TSKM_LOGGING_INFO_t logInfo;
+ TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__)
+
+ if (!p_info) {
+ TSKM_ASSERT(0);
+ return TSKM_E_PAR;
+ } else {
+ switch (p_info->type) {
+ case TSKM_LOGGING_TYPE_MODULE_LOGS:
+ case TSKM_LOGGING_TYPE_GRP_RELAUNCH:
+ break;
+ default:
+ TSKM_ASSERT(0);
+ return TSKM_E_PAR;
+ }
+ }
+
+ logInfo.type = p_info->type;
+ snprintf(logInfo.messageStr, TSKM_LOGGING_MSG_STR_SIZE, "%s",
+ p_info->messageStr);
+
+ tskm_sub_logging(&logInfo);
+
+ return TSKM_E_OK;
+}
+
+TSKM_ERR_t TSKM_SetWakeupOrder(const TSKM_WAKEUP_ORDER_t* p_order) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__)
+
+ if (p_order == NULL) {
+ return TSKM_E_PAR;
+ }
+
+ if (strnlen(p_order->orderName, TSKM_ORDER_NAME_MAX) >= TSKM_ORDER_NAME_MAX) {
+ return TSKM_E_PAR;
+ }
+
+ if (tskm_sub_setWakeupOrder(p_order->orderName) != 0) {
+ TSKM_ASSERT(0);
+ tskmRet = TSKM_E_NG;
+ }
+
+ return tskmRet;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_comm.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_comm.cpp
new file mode 100755
index 0000000..b177b9b
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_comm.cpp
@@ -0,0 +1,402 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _GNU_SOURCE
+#warning "_GNU_SOURCE not defined, so define here"
+#define _GNU_SOURCE
+#endif
+#include "tskm_comm.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <native_service/cl_monitor.h>
+
+#include "tskm_debug.h"
+#include "tskm_util.h"
+
+
+/**********************************************************
+ * Internal functions
+ **********************************************************/
+TSKM_STATIC TSKM_SRV_CONNENT_t*
+addConnFd(TSKM_SRV_CONNENT_LIST_t* list, TSKM_SRV_CONNENT_t* conn) {
+ TSKM_SRV_CONNENT_t* retConn;
+ if (list->num >= TSKM_COMM_CONNECT_MAX) {
+ TSKM_ASSERT(0)
+ return NULL;
+ }
+
+ retConn = &list->conn[list->num];
+ list->conn[list->num] = *conn;
+ list->num++;
+ return retConn;
+}
+
+TSKM_STATIC void delConnFd(TSKM_SRV_CONNENT_LIST_t* list,
+ TSKM_SRV_CONNENT_t* conn) {
+ uint32_t ii;
+ TSKM_BOOL_t isFind = TSKM_FALSE;
+ for (ii = 0; ii < list->num; ii++) {
+ if (!isFind && list->conn[ii].connFd == conn->connFd) {
+ isFind = TSKM_TRUE;
+ list->num--;
+ }
+
+ if (isFind && (ii < list->num)) {
+ list->conn[ii] = list->conn[ii + 1];
+ }
+ }
+ TSKM_ASSERT(isFind);
+}
+
+/**********************************************************
+ * Public functions
+ **********************************************************/
+TSKM_ERR_t tskm_srvSockCreate(const char *sockName,
+ TSKM_SRV_SOCK_CTX_t* p_sock) {
+ int fd = -1;
+ int ret;
+ int sockRet;
+ int enable = 1;
+ int listenNum = TSKM_COMM_CONNECT_MAX;
+
+ struct sockaddr_un unix_addr = { };
+
+ fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 5: For processing initializing process
+ // LCOV_EXCL_START 5: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 == access(sockName, F_OK)) { // LCOV_EXCL_BR_LINE 5: For processing initializing process
+ TSKM_ASSERT(0);
+ unlink(sockName);
+ }
+
+ unix_addr.sun_family = AF_UNIX;
+ strncpy(unix_addr.sun_path, sockName, sizeof(unix_addr.sun_path) - 1);
+
+ sockRet = bind(fd, (struct sockaddr *) &unix_addr, sizeof(unix_addr));
+ if (sockRet != 0) { // LCOV_EXCL_BR_LINE 5: For processing initializing process
+ // LCOV_EXCL_START 5: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = chmod(sockName, S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: For processing initializing process
+ // LCOV_EXCL_START 5: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ sockRet = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable));
+ if (sockRet != 0) { // LCOV_EXCL_BR_LINE 5:For processing initializing process
+ // LCOV_EXCL_START 5: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ sockRet = listen(fd, listenNum);
+ if (sockRet != 0) { // LCOV_EXCL_BR_LINE 5: For process initialization processing
+ // LCOV_EXCL_START 5: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ memset(p_sock, 0, sizeof(*p_sock));
+ p_sock->sockFd = fd;
+ p_sock->sockName = sockName;
+
+ return TSKM_E_OK;
+ // LCOV_EXCL_START 5: For process initialization processing
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (fd != -1) {
+ close(fd);
+ }
+ return TSKM_E_NG;
+ // LCOV_EXCL_STOP
+}
+
+TSKM_SRV_CONNENT_t*
+tskm_srvSockConnect(TSKM_SRV_SOCK_CTX_t* p_sock) {
+ int fd = -1;
+ socklen_t len;
+ int sockRet;
+ TSKM_SRV_CONNENT_t conn;
+ TSKM_SRV_CONNENT_t *retConn;
+ struct ucred credent;
+ struct sockaddr_un unix_addr;
+
+ memset(&conn, 0, sizeof(conn));
+ conn.connFd = -1;
+
+ len = sizeof(unix_addr);
+ fd = accept(p_sock->sockFd, (struct sockaddr*) &unix_addr,
+ (socklen_t *) &len); // NOLINT (readability/casting)
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 5: Accept's Error-Handling Process
+ // LCOV_EXCL_START 5: Accept's Error-Handling Process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ conn.connFd = fd;
+
+ len = sizeof(credent);
+ sockRet = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &credent, &len);
+ if (sockRet != 0) { // LCOV_EXCL_BR_LINE 5: Getsockopt's Error-Handling Process
+ // LCOV_EXCL_START 5: Getsockopt's Error-Handling Process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ conn.pid = credent.pid;
+
+ retConn = addConnFd(&p_sock->connList, &conn);
+ if (retConn == NULL) { // LCOV_EXCL_BR_LINE 5: Connect's Error-Handling Process
+ // LCOV_EXCL_START 5: Connect's Error-Handling Process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ return retConn;
+ // LCOV_EXCL_START 5: Error-Handling Process
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (conn.connFd != -1) {
+ tskm_sockDestory(conn.connFd);
+ }
+ return NULL;
+ // LCOV_EXCL_STOP
+}
+
+void tskm_srvSockDisconnect(TSKM_SRV_SOCK_CTX_t* p_sock,
+ TSKM_SRV_CONNENT_t *p_conn) {
+ int fd = p_conn->connFd;
+ delConnFd(&p_sock->connList, p_conn);
+ tskm_sockDestory(fd);
+}
+
+void tskm_srvSockDestory(TSKM_SRV_SOCK_CTX_t* p_sock) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (p_sock->sockFd) {
+ tskm_sockDestory(p_sock->sockFd);
+ p_sock->sockFd = 0;
+
+ TSKM_ASSERT_ERRNO(0 == unlink(p_sock->sockName));
+ }
+}
+// LCOV_EXCL_STOP
+int tskm_cliSockConnect(const char* sockName) {
+ int fd = -1;
+ int sockRet;
+ struct sockaddr_un unix_addr = { };
+
+ /* Create socket */
+ fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
+ if (fd < 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ unix_addr.sun_family = AF_UNIX;
+ strncpy(unix_addr.sun_path, sockName, sizeof(unix_addr.sun_path) - 1);
+ sockRet = connect(fd, (struct sockaddr*) &unix_addr, sizeof(unix_addr));
+ if (sockRet < 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ return fd;
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (fd != -1) {
+ TSKM_ASSERT_ERRNO(0 == close(fd));
+ }
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
+int tskm_sockRcv(int fd, TSKM_EVENT_INFO_t* p_ev) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+ ret = static_cast<int>(recv(fd, &ev, sizeof(ev), 0));
+
+ // LCOV_EXCL_BR_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ if (ret > (int) sizeof(ev)) { // NOLINT (readability/casting)
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ if (ret > 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ TSKM_PRINTF(TSKM_LOG_MSG, "recv:%s from:%d ret:%d",
+ tskm_convEvent2Str(ev.event), ev.fromPid, ret);
+ }
+
+ *p_ev = ev;
+
+ if (p_ev->hasExtend && (0 != p_ev->extendSize)) {
+ TSKM_PRINTF(TSKM_LOG_MSG, "rcv:ex(%d) ", p_ev->extendSize);
+
+ p_ev->extendPrm = malloc(p_ev->extendSize);
+ if (!p_ev->extendPrm) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = static_cast<int>(recv(fd, p_ev->extendPrm, p_ev->extendSize, 0));
+
+ // LCOV_EXCL_BR_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ if (ret > (int) p_ev->extendSize) { // NOLINT (readability/casting)
+ // LCOV_EXCL_BR_STOP
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (ret < 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ return ret;
+
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
+int tskm_sockSend(int fd, TSKM_EVENT_INFO_t* p_ev) {
+ int ret;
+ p_ev->fromPid = getpid();
+ TSKM_PRINTF(TSKM_LOG_MSG, "send:%s ", tskm_convEvent2Str(p_ev->event));
+ ret = static_cast<int>(send(fd, p_ev, sizeof(*p_ev), MSG_NOSIGNAL));
+ if (ret != sizeof(*p_ev)) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ // Because it is entered only when called from a debugging function (pri_sendDebugDumpRes)
+ if (p_ev->hasExtend && p_ev->extendPrm && (0 != p_ev->extendSize)) {
+ TSKM_PRINTF(TSKM_LOG_MSG, "send:ex(%d) ", p_ev->extendSize);
+
+ ret = static_cast<int>(send(fd, p_ev->extendPrm, p_ev->extendSize, MSG_NOSIGNAL));
+ if (ret != (int)p_ev->extendSize) { // NOLINT (readability/casting)
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ }
+
+ return ret;
+
+ ERROR: return -1;
+}
+
+void tskm_sockDestory(int fd) {
+ TSKM_ASSERT_ERRNO(0 == shutdown(fd, SHUT_RDWR));
+ TSKM_ASSERT_ERRNO(0 == close(fd));
+}
+
+/******************************************************************
+ * Initializing (Process)
+ ******************************************************************/
+int tskm_comm_procInit(void) {
+ int ret;
+
+ ret = CL_MonitorInit(CL_MONITOR_INIT_USER);
+
+ if (ret != 0) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ return 0;
+
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************************
+ * Service Error Monitoring Status Setting
+ *********************************************************/
+int tskm_comm_setSvcWatchState(uint32_t id, BOOL bIsRun, uint32_t timeout) {
+ int ret = 0;
+
+ CL_MonitorState_t state = CL_MONITOR_STATE_SLEEP;
+
+ if (bIsRun) {
+ state = CL_MONITOR_STATE_RUN;
+ }
+
+ ret = CL_MonitorSetEntry(CL_MONITOR_TYPE_GENERIC, id, state, timeout, 0);
+ if (0 != ret) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ return 0;
+ ERROR: return -1;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_debug.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_debug.cpp
new file mode 100755
index 0000000..5881f9a
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_debug.cpp
@@ -0,0 +1,286 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_debug.h"
+
+const char*
+tskm_convState2Str(TSKM_STATE_t state) {
+ const char* ret = "UNKNONW";
+ switch (state) { // LCOV_EXCL_BR_LINE 7:debug code
+ case TSKM_ST_ACCOFF:
+ ret = "ACCOFF";
+ break;
+ case TSKM_ST_ACCON:
+ ret = "ACCON";
+ break;
+ case TSKM_ST_WAKEUP:
+ ret = "WAKEUP";
+ break;
+ case TSKM_ST_RUNNING:
+ ret = "RUNNING";
+ break;
+ case TSKM_ST_DOWN:
+ ret = "DOWN";
+ break;
+ }
+ return ret;
+}
+
+const char*
+tskm_convEvent2Str(TSKM_EVENT_t event) {
+ switch (event) { // LCOV_EXCL_BR_LINE 7:debug code
+ case TSKM_EV_NOP:
+ return "NOP";
+ case TSKM_EV_PRI_REQ_WAKEUP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REQ_WAKEUP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REQ_DOWN:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REQ_DOWN";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REQ_TOUCH:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REQ_TOUCH";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REQ_DEBUGDUMP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REQ_DEBUGDUMP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REP_LOWMEM:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REP_LOWMEM";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REP_WAKEUP_COMP:
+ return "PRI_REP_WAKEUP_COMP";
+ case TSKM_EV_PRI_REP_DOWN_COMP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REP_DOWN_COMP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REP_CONNECT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REP_CONNECT";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REP_DISCONNECT:
+ return "PRI_REP_DISCONNECT";
+ case TSKM_EV_PRI_RES_WAKEUP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_RES_WAKEUP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_RES_DOWN:
+ return "PRI_RES_DOWN";
+ case TSKM_EV_PRI_RES_DEBUGDUMP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_RES_DEBUGDUMP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_PRI_REQ_EXIT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "PRI_REQ_EXIT";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_SVC_REP_TERM:
+ return "SVC_REP_TERM";
+ case TSKM_EV_API_REQ_REBOOT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "API_REQ_REBOOT";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_API_REQ_SVC_CTL:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "API_REQ_SVC_CTL";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_API_REQ_SVC_DISABLE:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "API_REQ_SVC_DISABLE";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REQ_STOP:
+ return "API_REQ_STOP";
+ case TSKM_EV_LCL_CHG_SVC_STATE:
+ return "LCL_CHG_SVC_STATE";
+ case TSKM_EV_LCL_REQ_SDUMP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "LCL_REQ_SDUMP";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REP_TIMEOUT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "LCL_REP_TIMEOUT";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REP_POLLING:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "LCL_REP_POLLING";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REP_LOWMEM:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "LCL_REP_LOWMEM";
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REQ_TRANS_STEP:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "LCL_REQ_TRANS_STEP";
+ // LCOV_EXCL_STOP
+ default:
+ break;
+ }
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "UNKNOWN";
+ // LCOV_EXCL_STOP
+}
+
+const char*
+tskm_convInitCompId2Str(uint64_t compId) {
+ switch (compId) { // LCOV_EXCL_BR_LINE 7:debug code
+ case INI_INITCOMP_NONE:
+ return "NONE";
+ case INI_INITCOMP_ON_START:
+ return "ONSTART";
+ case INI_INITCOMP_NVM_ACCESS:
+ return "NVM_ACCESS";
+ case INI_INITCOMP_TEST0:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST0";
+ // LCOV_EXCL_STOP
+ case INI_INITCOMP_TEST1:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST1";
+ // LCOV_EXCL_STOP
+ case INI_INITCOMP_TEST2:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST2";
+ // LCOV_EXCL_STOP
+ case INI_INITCOMP_TEST3:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST3";
+ // LCOV_EXCL_STOP
+ }
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "UNKNONW";
+ // LCOV_EXCL_STOP
+}
+
+const char*
+tskm_convTermCompId2Str(uint64_t compId) {
+ switch (compId) { // LCOV_EXCL_BR_LINE 7:debug code
+ case INI_TERMCOMP_NONE:
+ return "NONE";
+ case INI_TERMCOMP_ACTIVITYMGR:
+ return "ACTIVITYMGR";
+ case INI_TERMCOMP_RESIDENT:
+ return "RESIDENT";
+ case INI_TERMCOMP_TRANSIENT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TRANSIENT";
+ // LCOV_EXCL_STOP
+ case INI_TERMCOMP_TEST0:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST0";
+ // LCOV_EXCL_STOP
+ case INI_TERMCOMP_TEST1:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST1";
+ // LCOV_EXCL_STOP
+ case INI_TERMCOMP_TEST2:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST2";
+ // LCOV_EXCL_STOP
+ case INI_TERMCOMP_TEST3:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "TEST3";
+ // LCOV_EXCL_STOP
+ }
+ return "UNKNONW";
+}
+
+const char*
+tskm_convSvcState2Str(TSKM_SVC_STATE_t state) {
+ switch (state) { // LCOV_EXCL_BR_LINE 7:debug code
+ case TSKM_SVC_DORMANT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "DORMANT";
+ // LCOV_EXCL_STOP
+ case TSKM_SVC_WAITCONNECT:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "WAITCONNECT";
+ // LCOV_EXCL_STOP
+ case TSKM_SVC_WAKEUP:
+ return "WAKEUP";
+ case TSKM_SVC_RUNNING:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "RUNNING";
+ // LCOV_EXCL_STOP
+ case TSKM_SVC_DOWN:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "DOWN";
+ // LCOV_EXCL_STOP
+ case TSKM_SVC_FINDOWN:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "FINDOWN";
+ // LCOV_EXCL_STOP
+ case TSKM_SVC_DISABLE:
+ // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return "DISABLE";
+ // LCOV_EXCL_STOP
+ default:
+ break;
+ }
+ return "UNKNONW";
+}
+
+TSKM_STATIC void svcDump(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "<%s>", p_svc->attr->name);
+ TSKM_PRINTF(TSKM_LOG_STATE, " pid:%d svcId:%#x state:%s waitResCnt:%d",
+ p_svc->pid, p_svc->attr->svcId,
+ tskm_convSvcState2Str(p_svc->state), p_svc->waitResCnt);
+}
+
+void tskm_svcsDump(TSKM_SVCS_CTX_t* p_svcs) {
+ uint32_t ii;
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ svcDump(&p_svcs->svcList[ii]);
+ }
+}
+
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_main.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_main.cpp
new file mode 100755
index 0000000..33c10fa
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_main.cpp
@@ -0,0 +1,727 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_main.h"
+#include <stdio.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/inotify.h>
+#include <getopt.h>
+#include <system_service/ss_services.h>
+#include <native_service/ns_version_if.h>
+#include <native_service/ns_np_service_protocol.h>
+#include <system_service/ss_system_if.h>
+#include <system_service/ss_version.h>
+#include <system_service/ss_templates.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <other_service/rpc.h>
+#include <system_service/resm.h>
+
+#include "tskm_data_init_local.h"
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+#include "tskm_debug.h"
+#include "tskm_util.h"
+#include "tskm_srvr.h"
+#include "tskm_comm.h"
+#include "tskm_watch.h"
+#include "system_service/tskm_local_type.h"
+#include "system_service/tskm_xml_data.h"
+#include "tskm_state.h"
+
+#define TSKM_DATA_KEY "TSKM_KEY"
+
+TSKM_STATIC TSKM_MAIN_CTX_t g_mainCtx; // Main context
+
+TSKM_STATIC BOOL s_isVupMode = FALSE;
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION);
+
+// For NsLog
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = {
+FRAMEWORKUNIFIEDLOGOPTIONS, {
+ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ZONE_TEXT_31 }, FRAMEWORKUNIFIEDLOGZONES };
+
+EFrameworkunifiedStatus OnFinishLoadFile(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ int ret;
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+ TSKM_EVENT_INFO_t ev;
+
+ ret = tskm_pf_nvFileRead(hApp, &p_main->nvInfo);
+ if (ret != 0) {
+ TSKM_ASSERT(0);
+ }
+
+ // issure INI_INITCOMP_NVM_ACCESS
+ bzero(&ev, sizeof(ev));
+ ev.event = TSKM_EV_PRI_REP_WAKEUP_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repWakeupComp.compId = INI_INITCOMP_NVM_ACCESS;
+ tskm_handleEvent(p_main, &ev);
+
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus onDataInitRequest(HANDLE hApp) {
+ TSKM_ERR_t l_tskmRet = TSKM_E_OK;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+
+ TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__)
+
+ if (p_main->bootInfo.startupReason == epswfINVALID) {
+ // Before issuing FrameworkunifiedOnStart = Requests before TaskManager became Availabile are not accepted
+ TSKM_ASSERT(0);
+ l_tskmRet = TSKM_E_STATE;
+ } else {
+ T_SS_SM_START_DataStructType bootInfo(epswfIGN_ACC, TRUE,
+ e_SS_SM_DATA_RESET_MODE_USER,
+ epsssUNLOCK, epsstWARMSTART,
+ e_SS_SM_DRAM_BACKUP_OK,
+ e_SS_SM_RESET_STATUS_NONE, 0);
+
+ T_SS_SM_START_ExtDataStructType extBootInfo;
+
+ memcpy(&extBootInfo, &p_main->extBootInfo, sizeof(extBootInfo));
+
+ // After updating the program,
+ // FALSE is notified here because it is notified when data initialization I/F is called at startup
+ extBootInfo.isProgUpdated = FALSE;
+
+ tskm_dataInitAll(&bootInfo, &extBootInfo);
+ }
+
+ PCSTR l_senderName = FrameworkunifiedGetMsgSrc(hApp);
+ if (NULL != l_senderName) {
+ HANDLE hSession = FrameworkunifiedMcOpenSender(hApp, l_senderName);
+ if (hSession == NULL) {
+ TSKM_ASSERT(0);
+ } else {
+ TSKM_ASSERT(
+ eFrameworkunifiedStatusOK
+ == FrameworkunifiedSendMsg(hSession, TSKM_DATAINIT_RESP, sizeof(l_tskmRet),
+ &l_tskmRet));
+ TSKM_ASSERT(eFrameworkunifiedStatusOK == FrameworkunifiedMcClose(hSession));
+ }
+ }
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus onTransStepRequest(HANDLE hApp) { // LCOV_EXCL_START 6:Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ TSKM_EVENT_INFO_t ev;
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_LCL_REQ_TRANS_STEP;
+ ev.errCode = TSKM_E_OK;
+ tskm_handleEvent(p_main, &ev);
+
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+EFrameworkunifiedStatus OnResmAvailability(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+
+ if (0 != strcmp(NTFY_ResourceMgr_Availability, FrameworkunifiedGetLastNotification(hApp))) {
+ TSKM_ASSERT(0);
+ } else if (FrameworkunifiedIsServiceAvailable(hApp)) {
+ // Availability = TRUE
+
+ p_main->resmFd = tskm_sub_resmInit();
+ if (-1 == p_main->resmFd) {
+ TSKM_ASSERT(0);
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+//************ NS Framework Callback : must implemet ******************
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSKM_PRINTF(TSKM_LOG_STATE, "+");
+
+ l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hApp, NTFY_SS_TaskManager_Availability);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_NS_NPSERVICE,
+ NPS_GET_PERS_FILE_ACK,
+ OnFinishLoadFile);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, FRAMEWORKUNIFIED_ANY_SOURCE,
+ TSKM_DATAINIT_REQ,
+ onDataInitRequest);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, FrameworkunifiedGetAppName(hApp),
+ TSKM_TRANS_STEP_REQ,
+ onTransStepRequest);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(hApp, NTFY_ResourceMgr_Availability, OnResmAvailability);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "-");
+
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSKM_PRINTF(TSKM_LOG_STATE, "+");
+ l_eStatus = OnStart(hApp);
+ TSKM_PRINTF(TSKM_LOG_STATE, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSKM_PRINTF(TSKM_LOG_STATE, "+");
+ l_eStatus = OnStart(hApp);
+ TSKM_PRINTF(TSKM_LOG_STATE, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ TSKM_PRINTF(TSKM_LOG_STATE, "+");
+ l_eStatus = OnStart(hApp);
+ TSKM_PRINTF(TSKM_LOG_STATE, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+ // Returns Fail to send asynchronous STOP reply to SM
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
+
+ TSKM_EVENT_INFO_t ev;
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_LCL_REQ_STOP;
+ ev.errCode = TSKM_E_OK;
+ tskm_handleEvent(p_main, &ev);
+
+ p_main->isOnStopDone = TSKM_TRUE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+ TSKM_ERR_t l_tskmRet;
+
+ // Call DebugDump of all running SVCs
+ l_tskmRet = tskm_svcsCallDebugDump(&p_main->svcs);
+ if (TSKM_E_OK != l_tskmRet) {
+ TSKM_ASSERT(0);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
+ return l_eStatus;
+}
+// LCOV_EXCL_STOP
+
+/*********************************************************
+ * System start process
+ *********************************************************/
+EFrameworkunifiedStatus OnStart(const HANDLE hApp) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "+");
+ TSKM_MAIN_CTX_t* const p_main = &g_mainCtx;
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ if (p_main->isOnStartDone == TSKM_FALSE) {
+ T_SS_SM_START_DataStructType startupInfo;
+ TSKM_EVENT_INFO_t ev;
+ l_eStatus = ReadMsg<T_SS_SM_START_DataStructType>(hApp, startupInfo);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT(0);
+ } else {
+ memcpy(&p_main->bootInfo, &startupInfo, sizeof(T_SS_SM_START_DataStructType));
+ }
+
+ if (0 != tskm_sub_getExtBootInfo(&p_main->extBootInfo)) {
+ TSKM_ASSERT(0);
+ }
+
+ tskm_dataInitAll(&p_main->bootInfo, &p_main->extBootInfo);
+
+ tskm_svcsSetBootInfo(&p_main->svcs, &p_main->bootInfo, &p_main->extBootInfo);
+ p_main->isOnStartDone = TSKM_TRUE;
+
+ l_eStatus = FrameworkunifiedPublishServiceAvailability(hApp, TRUE);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT(0);
+ } else {
+ TSKM_PRINTF(TSKM_LOG_STATE, "Availability TRUE");
+ }
+
+ // Issure INI_INITCOMP_ON_START
+ bzero(&ev, sizeof(ev));
+ ev.event = TSKM_EV_PRI_REP_WAKEUP_COMP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.repWakeupComp.compId = INI_INITCOMP_ON_START;
+ tskm_handleEvent(p_main, &ev);
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "-");
+ return l_eStatus;
+}
+
+/*********************************************************
+ * Argument analysis process
+ *********************************************************/
+TSKM_STATIC EFrameworkunifiedStatus argParser(SI_32 argument, PCHAR argumentValue) { // LCOV_EXCL_START 6: for process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if ('v' == argument) {
+ s_isVupMode = TRUE;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+/*********************************************************
+ * Creating process for TSKM internal context
+ *********************************************************/
+TSKM_STATIC void ctxCreate(TSKM_MAIN_CTX_t* p_main, int argc, char* argv[]) {
+ int ret;
+ EFrameworkunifiedStatus taskmanagerRet;
+ TSKM_ERR_t tskmRet;
+ FrameworkunifiedDefaultCallbackHandler cbFuncs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cbFuncs);
+ CustomCommandLineOptions cmdLineOpt = { "v", NULL, argParser };
+
+ p_main->state = TSKM_ST_ACCOFF;
+ p_main->isOnStartDone = TSKM_FALSE;
+
+ // Create dispatcher
+ taskmanagerRet = FrameworkunifiedCreateDispatcherWithoutLoop(SS_TASK_MANAGER, p_main->hApp, argc,
+ argv, &cbFuncs, TRUE, &cmdLineOpt);
+ if (eFrameworkunifiedStatusOK != taskmanagerRet) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "s_isVupMode :%s", s_isVupMode ? "TRUE" : "FALSE");
+
+ taskmanagerRet = FrameworkunifiedGetDispatcherFD(p_main->hApp, &p_main->nsFd);
+ if (taskmanagerRet != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet);
+ exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP
+ }
+
+ p_main->sigFd = tskm_pf_sysInit(); // Platform initialization
+ if (p_main->sigFd == -1) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_LINE 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ p_main->iFd = inotify_init1(IN_CLOEXEC);
+ if (p_main->sigFd == -1) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_LINE 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ // Obtain RESM FDs after waiting for Availability
+ p_main->resmFd = -1;
+
+ tskmRet = tskm_srvSockCreate(TSKM_SOCKET_NAME, &p_main->sock);
+ TSKM_ERR_CHK(tskmRet, TSKM_E_OK, ERROR); // LCOV_EXCL_BR_LINE 6: For process initialization processing
+
+ ret = tskm_pf_nvFileInit(p_main->hApp);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = tskm_initServiceList(&p_main->svcs, p_main->iFd); // Service to be started
+ if (0 != ret) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For For process initialization process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ tskm_initWakeupCtx(&p_main->wakeup, s_isVupMode); // Gradual startup info
+ tskm_initDownCtx(&p_main->down, s_isVupMode); // Gradual termination info
+ return;
+
+ // LCOV_EXCL_START 6: For process initialization processing
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_exit(EXIT_FAILURE);
+ return;
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************************
+ * Get main context
+ *********************************************************/
+TSKM_MAIN_CTX_t*
+tskm_getMainCtx(void) {
+ return &g_mainCtx;
+}
+
+/*********************************************************
+ * Process initialization process (MAIN function sub)
+ *********************************************************/
+int Init_Process(int* rpcFd, int* sockFd, int* maxFd, fd_set* fds, TSKM_MAIN_CTX_t* p_main) {
+ int ret;
+ uint32_t ii;
+
+ TSKM_SRV_CONNENT_LIST_t* p_connList = &p_main->sock.connList;
+
+ FD_ZERO(fds);
+
+ FD_SET(*rpcFd, fds);
+ *maxFd = TSKM_MAX(*rpcFd, *maxFd); // LCOV_EXCL_BR_LINE 6: For process initialization processing
+
+ FD_SET(*sockFd, fds);
+ *maxFd = TSKM_MAX(*sockFd, *maxFd); // LCOV_EXCL_BR_LINE 6: For process initialization processing
+
+ FD_SET(p_main->nsFd, fds);
+ *maxFd = TSKM_MAX(p_main->nsFd, *maxFd); // LCOV_EXCL_BR_LINE 6: For process initialization processing
+
+ FD_SET(p_main->sigFd, fds);
+ *maxFd = TSKM_MAX(p_main->sigFd, *maxFd); // LCOV_EXCL_BR_LINE 6: For process initialization processing
+
+ if (-1 != p_main->resmFd) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FD_SET(p_main->resmFd, fds);
+ *maxFd = TSKM_MAX(p_main->resmFd, *maxFd);
+ // LCOV_EXCL_STOP
+ }
+
+ for (ii = 0; ii < p_connList->num; ii++) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ // LCOV_EXCL_START 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_SRV_CONNENT_t* p_conn = &p_connList->conn[ii];
+ FD_SET(p_conn->connFd, fds);
+ *maxFd = TSKM_MAX(p_conn->connFd, *maxFd);
+ // LCOV_EXCL_STOP
+ }
+
+ TSKM_PRINTF(TSKM_LOG_FUNC, "SELECT IN");
+ ret = select(*maxFd + 1, fds, NULL, NULL, NULL);
+ if (ret < 1) {
+ if (errno != EINTR) {
+ TSKM_ASSERT(0);
+ }
+ return ret;
+ }
+ TSKM_PRINTF(TSKM_LOG_FUNC, "SELECT OUT");
+ return 0;
+}
+
+/*********************************************************
+ * Receiving Messages from CONNECT Clients (MAIN Functions Sub)
+ *********************************************************/
+void Recv_Msg_FromConnectClient(fd_set* fds, TSKM_MAIN_CTX_t* p_main) {
+ uint32_t ii;
+ TSKM_SRV_CONNENT_LIST_t* p_connList = &p_main->sock.connList;
+
+ // Messages from CONNECT clients
+ for (ii = 0; ii < p_connList->num; ii++) {
+ TSKM_SRV_CONNENT_t* p_conn = &p_connList->conn[ii];
+ if (FD_ISSET(p_conn->connFd, fds)) {
+ TSKM_PRINTF(TSKM_LOG_FUNC, "connFd IN");
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+ ret = tskm_sockRcv(p_conn->connFd, &ev);
+
+ if (ret < 0) {
+ TSKM_ASSERT(0);
+ } else {
+ TSKM_SVC_CTX_t* p_svc;
+
+ if (ret == 0) {
+ // Closed Connection
+ TSKM_PRINTF(TSKM_LOG_STATE, "DISSCON pid:%d", p_conn->pid);
+ ev.event = TSKM_EV_PRI_REP_DISCONNECT;
+ ev.errCode = TSKM_E_OK;
+ ev.fromPid = p_conn->pid;
+ tskm_srvSockDisconnect(&p_main->sock, p_conn);
+ p_conn = NULL; // If the connection is lost, it cannot be referenced.
+ }
+
+ p_svc = tskm_svcsGetSvcByPid(&p_main->svcs, ev.fromPid);
+ if (p_svc) { // Events from service
+ TSKM_ERR_t tskmRet;
+ tskmRet = tskm_svcEventHandle(p_svc, &ev); // Service handler
+ if (tskmRet != TSKM_E_OK) {
+ TSKM_ASSERT(0);
+ }
+ }
+ if (ev.event != TSKM_EV_NOP) {
+ tskm_handleEvent(p_main, &ev); // Main handler
+ }
+ }
+ TSKM_PRINTF(TSKM_LOG_FUNC, "connFd OUT");
+ }
+ }
+}
+
+/*********************************************************
+ * CONNECT Requests (MAIN Functions Sub)
+ *********************************************************/
+void Recv_Req_Connect(fd_set* fds, TSKM_MAIN_CTX_t* p_main, int sockFd) {
+ // CONNECT requests
+ if (FD_ISSET(sockFd, fds)) {
+ TSKM_PRINTF(TSKM_LOG_FUNC, "sockFd IN");
+
+ TSKM_SRV_CONNENT_t* conn;
+ conn = tskm_srvSockConnect(&p_main->sock);
+ if (conn == NULL) {
+ TSKM_ASSERT(0);
+ } else {
+ TSKM_SVC_CTX_t* p_svc;
+ TSKM_PRINTF(TSKM_LOG_STATE, "CONNECT pid:%d", conn->pid);
+
+ p_svc = tskm_svcsGetSvcByPid(&p_main->svcs, conn->pid);
+ if (p_svc) {
+ TSKM_ERR_t tskmRet;
+ TSKM_EVENT_INFO_t ev;
+
+ ev.event = TSKM_EV_PRI_REP_CONNECT;
+ ev.errCode = TSKM_E_OK;
+ ev.fromPid = conn->pid;
+ ev.prm.repConnect.connFd = conn->connFd;
+
+ tskmRet = tskm_svcEventHandle(p_svc, &ev); // Service handler
+ if (tskmRet != TSKM_E_OK) {
+ TSKM_ASSERT(0);
+ } else if (ev.event != TSKM_EV_NOP) {
+ tskm_handleEvent(p_main, &ev); // Main hander
+ }
+ }
+ }
+ TSKM_PRINTF(TSKM_LOG_FUNC, "sockFd OUT");
+ }
+}
+
+/*********************************************************
+ * MAIN Function
+ *********************************************************/
+int main(int argc, char* argv[]) {
+ RPC_ID rpcId = TSKM_RPC_ID;
+ int rpcFd = 0;
+ int maxFd = 0;
+ int ret;
+ fd_set fds;
+ TSKM_MAIN_CTX_t* p_main = &g_mainCtx;
+
+ // Logging setting
+ FRAMEWORKUNIFIED_SET_ZONES();
+
+ ctxCreate(p_main, argc, argv); // Initialize context
+
+ tskm_sub_init(); // Initialize sub systems
+
+ RPC_START_SECURE_SERVER(rpcId);
+ RPC_get_fd(rpcId, &rpcFd);
+
+ uid_t uid[2];
+ gid_t gid[2];
+
+ uid[0] = 0;
+ gid[0] = 0;
+ uid[1] = getuid();
+ gid[1] = getgid();
+
+ if (RPC_OK != RPC_regist_credential(2, uid, 2, gid)) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: For process initialization processing
+ }
+
+ // Start periodic timer thread
+ ret = tskm_watch_startTimer();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: For process initialization processing
+ }
+
+ tskm_stateTransit(p_main, TSKM_ST_ACCOFF, TSKM_ST_ACCON);
+
+ p_main->isExec = TSKM_TRUE;
+ while (p_main->isExec) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ int sockFd = p_main->sock.sockFd;
+
+ // Initialization processing
+ if (Init_Process(&rpcFd, &sockFd, &maxFd, &fds, p_main) != 0) { // LCOV_EXCL_BR_LINE 6: For process initialization processing
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ continue; // LCOV_EXCL_LINE 6: For process initialization processing
+ }
+
+ // RPC API
+ if (FD_ISSET(rpcFd, &fds)) {
+ RPC_process_API_request(rpcId);
+ }
+
+ // Process termination signal
+ if (FD_ISSET(p_main->sigFd, &fds)) {
+ int count = 0;
+
+ do {
+ TSKM_EVENT_INFO_t ev;
+ ev.event = TSKM_EV_SVC_REP_TERM;
+
+ count++;
+
+ ret = tskm_pf_cleanupProc(p_main->sigFd, &ev.fromPid, &ev.errCode);
+ if (ret == -1) {
+ TSKM_ASSERT(0);
+ break;
+ }
+
+ TSKM_SVC_CTX_t* p_svc;
+
+ p_svc = tskm_svcsGetSvcByPid(&p_main->svcs, ev.fromPid);
+ if (p_svc) {
+ TSKM_ERR_t tskmRet;
+
+ tskmRet = tskm_svcEventHandle(p_svc, &ev); // Service handler
+ if (tskmRet != TSKM_E_OK) {
+ TSKM_ASSERT(0);
+ }
+ if (ev.event != TSKM_EV_NOP) {
+ tskm_handleEvent(p_main, &ev); // Main handler
+ }
+ }
+ } while (ret == 1 && count < 50);
+ }
+
+ if (FD_ISSET(p_main->nsFd, &fds)) {
+ FrameworkunifiedDispatchProcessWithoutLoop(p_main->hApp);
+ }
+
+ // EV from RESM
+ if (-1 != p_main->resmFd) {
+ if (FD_ISSET(p_main->resmFd, &fds)) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+ ret = tskm_sub_resmRcv(&ev);
+
+ if (-1 == ret) {
+ TSKM_ASSERT(0);
+ } else {
+ tskm_handleEvent(p_main, &ev);
+ }
+ }
+ }
+
+ // Messages from connected clients
+ Recv_Msg_FromConnectClient(&fds, p_main);
+
+ // CONNECT request
+ Recv_Req_Connect(&fds, p_main, sockFd);
+ }
+
+ tskm_srvSockDestory(&p_main->sock);
+
+ RPC_end(rpcId);
+
+ FrameworkunifiedDestroyDispatcherWithoutLoop(p_main->hApp);
+ TSKM_PRINTF(TSKM_LOG_STATE, "tskm end");
+
+ sleep(TSKM_CFG_WAIT_SHUTDOWN);
+ return 0;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_port_pf.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_port_pf.cpp
new file mode 100755
index 0000000..f427255
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_port_pf.cpp
@@ -0,0 +1,884 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_port_pf.h"
+#include <pthread.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <pwd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <native_service/cl_process.h>
+#include <native_service/cl_monitor.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_sm_client_if.h>
+
+#include "system_service/tskm_svc.h"
+#include "tskm_debug.h"
+
+#define TSKM_PORTPF_IN() TSKM_PRINTF(TSKM_LOG_PORTPF, "%s:IN", __FUNCTION__)
+#define TSKM_PORTPF_IN_ARG(format, ...) TSKM_PRINTF(TSKM_LOG_PORTPF, "%s:IN:" format, __FUNCTION__, __VA_ARGS__)
+#define TSKM_PORTPF_OUT() TSKM_PRINTF(TSKM_LOG_PORTPF, "%s:OUT", __FUNCTION__)
+
+#define TSKM_PRIO_MIN 1
+#define TSKM_PRIO_MAX 99
+#define TSKM_PRIO_MIN_TSS -20
+#define TSKM_PRIO_MAX_TSS 19
+
+#define TSKM_TMP_DIRECTORY "/tmp"
+#define TSKM_TMP_TSKM_DIRECTORY TSKM_TMP_DIRECTORY "/tskm"
+#define TSKM_TMP_NV_INFO_FILEPATH TSKM_TMP_TSKM_DIRECTORY "/nvInfo"
+
+#define TSKM_NPP_NV_FILE_TAG SS_TASK_MANAGER "/nvInfo"
+
+/*********************************************************
+ * user->uid/gid conversion
+ *********************************************************/
+TSKM_STATIC int cnvUserName2UidGid(const char *user, uid_t *uid, gid_t *gid) {
+ int ret = -1;
+
+ if (0 == strcmp(user, "")) {
+ *uid = geteuid();
+ *gid = getegid();
+ } else {
+ static __thread size_t bufSize = 0;
+ static __thread char *buf = NULL;
+ struct passwd pwd;
+ struct passwd *result;
+
+ if (0 == bufSize) {
+ struct stat statInfo;
+
+ bufSize = -1;
+
+ if (0 != stat("/etc/passwd", &statInfo) || 0 >= statInfo.st_size) { // LCOV_EXCL_START 8: Because buf is a static variable and cannot be passed test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ // LCOV_EXCL_STOP
+
+ bufSize = statInfo.st_size * 2;
+
+ // Since TaskManager is a resident service, the area allocated here is expected to be released at process termination and is not explicitly released by free()
+ buf = (char *) malloc(sizeof(char) * bufSize); // NOLINT (runtime/printf)
+ if (NULL == buf) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function malloc
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 5: Error branching of the standard-function malloc
+ goto ERROR; // LCOV_EXCL_LINE 5: Error branching of the standard-function malloc
+ }
+ }
+
+ if (NULL == buf) { // LCOV_EXCL_BR_LINE 8: Because buf is a static variable and cannot be passed test
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 8: Because buf is a static variable and cannot be passed test
+ goto ERROR; // LCOV_EXCL_LINE 8: Because buf is a static variable and cannot be passed test
+ }
+
+ ret = getpwnam_r(user, &pwd, buf, bufSize, &result);
+ if (ret != 0 || result == NULL) {
+ TSKM_ASSERT_PRINT(0, "ret = %d[%s]", ret, user);
+ goto ERROR;
+ }
+
+ *uid = pwd.pw_uid;
+ *gid = pwd.pw_gid;
+ }
+
+ ret = 0;
+
+ ERROR:
+
+ return ret;
+}
+
+/*********************************************************
+ * Convert Scheduling Policy Definitions Values (TSKM -> CL)
+ *********************************************************/
+TSKM_STATIC CL_ProcessSchedPolicy_t cnvTskmPolicy2ClPolicy(
+ TSKM_SVC_POLICY_t policy) {
+ switch (policy) {
+ case TSKM_SVC_POLICY_FIFO:
+ return CL_PROCESS_SCHED_POLICY_FIFO;
+ case TSKM_SVC_POLICY_TSS:
+ return CL_PROCESS_SCHED_POLICY_OTHER;
+ case TSKM_SVC_POLICY_RR:
+ return CL_PROCESS_SCHED_POLICY_RR;
+ default:
+ TSKM_ASSERT(0);
+ break;
+ }
+ return CL_PROCESS_SCHED_POLICY_OTHER;
+}
+
+/*********************************************************
+ * Process priority valid value determination
+ *********************************************************/
+TSKM_STATIC int chkPrioValue(TSKM_SVC_POLICY_t policy, int prio) {
+ switch (policy) {
+ case TSKM_SVC_POLICY_FIFO:
+ case TSKM_SVC_POLICY_RR:
+ if ((TSKM_PRIO_MIN > prio) || (prio > TSKM_PRIO_MAX)) {
+ TSKM_ASSERT(0);
+ }
+ break;
+ case TSKM_SVC_POLICY_TSS:
+ default:
+ if ((TSKM_PRIO_MIN_TSS > prio) || (prio > TSKM_PRIO_MAX_TSS)) {
+ TSKM_ASSERT(0);
+ }
+ break;
+ }
+
+ return prio;
+}
+
+/*********************************************************
+ * COMMONLIB initialization (at system startup)
+ *********************************************************/
+int tskm_pf_sysInit() {
+ int fd = 0;
+ int ret = 0;
+
+ TSKM_PORTPF_IN();
+
+ fd = CL_ProcessInit();
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 6: Error branching during process initialization
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 6: Error branching during process initialization
+ goto ERROR; // LCOV_EXCL_LINE 6: Error branching during process initialization
+ }
+
+ ret = CL_MonitorInit(CL_MONITOR_INIT_USER);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ TSKM_ASSERT_ERRNO(0);
+ }
+
+ TSKM_PORTPF_OUT();
+ return fd;
+ // LCOV_EXCL_START 6: Error branching during process initialization
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************************
+ * COMMONLIB initialization (at process startup)
+ *********************************************************/
+int tskm_pf_procInit() {
+ TSKM_PORTPF_IN();
+ // Originally called the _sys_Setup_CWORD64_API (NULL), but changed to empty function along to derete "_sys"
+
+ TSKM_PORTPF_OUT();
+ return 0;
+}
+
+/*********************************************************
+ * Process startup
+ *********************************************************/
+pid_t tskm_pf_createProc(TSKM_SVC_ATTR_t* p_svcAttr) {
+ TSKM_PORTPF_IN();
+ pid_t retPid = -1;
+ pid_t pid = -1;
+
+ CL_ProcessAttr_t attr;
+ char procPath[255];
+ char* procName;
+ uid_t setUid = 0;
+ gid_t setGid = 0;
+
+ if (0 != CL_ProcessCreateAttrInit(&attr)) { // LCOV_EXCL_BR_LINE 6: Error branching during process initialization
+ // LCOV_EXCL_START 6: Error branching during process initialization
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ // Process name setting(from basename)
+ if (strlen(p_svcAttr->path) < sizeof(procPath)) {
+ strcpy(procPath, p_svcAttr->path); // NOLINT (runtime/printf)
+ } else {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ procName = basename(procPath);
+ if (strlen(procName) >= 16) {
+ TSKM_ASSERT(0);
+ procName[16] = '\0';
+ }
+
+ if (0 != CL_ProcessCreateAttrSetName(&attr, procName)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 != cnvUserName2UidGid(p_svcAttr->user, &setUid, &setGid)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ setUid = geteuid();
+ setGid = getegid();
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 != CL_ProcessCreateAttrSetUid(&attr, setUid)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (0 != CL_ProcessCreateAttrSetGid(&attr, setGid)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ // All are group leaders in order to recover to the child processes of the service
+ if (0 != CL_ProcessCreateAttrSetGroup(&attr, 1)) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ if (0 != CL_ProcessCreateAttrSetCpuAssign(&attr, p_svcAttr->cpuAssign)) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ if (0
+ != CL_ProcessCreateAttrSetSchedule(
+ &attr, cnvTskmPolicy2ClPolicy(p_svcAttr->policy),
+ chkPrioValue(p_svcAttr->policy, p_svcAttr->prio))) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ pid = CL_ProcessCreate(p_svcAttr->path, p_svcAttr->args, NULL, &attr);
+ if (pid == -1) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ retPid = pid;
+ ERROR:
+
+ TSKM_PORTPF_OUT();
+ return retPid;
+}
+
+/*********************************************************
+ * Recover termination processes
+ *********************************************************/
+int tskm_pf_cleanupProc(int sigFd, pid_t* p_pid, TSKM_ERR_t* p_err) {
+ int ret;
+ CL_ProcessCleanupInfo_t info;
+
+ ret = CL_ProcessCleanup(sigFd, &info);
+ if (ret != 0 && ret != 1) {
+ TSKM_ASSERT_PRINT(0, "ret = %d", ret);
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "SVC TERM:pid:%d code:%d status:%d", info.pid,
+ info.code, info.status);
+
+ switch (info.code) {
+ case CLD_STOPPED:
+ // Not comes here usually
+ TSKM_PRINTF(TSKM_LOG_STATE, "svc stoped\n");
+ goto ERROR;
+ case CLD_TRAPPED:
+ // Comes here only during debugging
+ TSKM_PRINTF(TSKM_LOG_STATE, "svc traped\n");
+ goto ERROR;
+ case CLD_CONTINUED:
+ // Not comes here usually
+ TSKM_PRINTF(TSKM_LOG_STATE, "svc continue\n");
+ goto ERROR;
+ default:
+ break;
+ }
+
+ *p_pid = info.pid;
+ *p_err =
+ (info.code != CLD_EXITED) ? TSKM_E_NG :
+ (info.code == CLD_EXITED && info.status != EXIT_SUCCESS) ?
+ TSKM_E_NG : TSKM_E_OK;
+
+ if (TSKM_E_OK != *p_err) {
+ TSKM_PRINTF(TSKM_LOG_SYSTEMDATA, "SVC ERR TERM:pid:%d code:%d status:%d",
+ info.pid, info.code, info.status);
+ }
+
+ return ret;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Force Terminating a Process Group
+ *********************************************************/
+int tskm_pf_terminateProcGroup(uint16_t pid) {
+ int ret;
+ pid_t pgid;
+
+ pgid = getpgid(pid);
+ if (pgid < 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "TERM SVC GROUP:pid:%dpgid:%d", pid, pgid);
+
+ ret = CL_ProcessEuthanizeGroup(pgid);
+ if (ret != 0) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ return 0;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Opening shared memory and trancating
+ *********************************************************/
+int tskm_pf_shmCreate_Open_Ftrn(const char* name, int32_t size, void** p_addr) {
+ int ret = 0;
+ int fd = 0;
+
+ fd = shm_open(name, O_CREAT | O_RDWR | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ ret = -1; // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ if (fd > 0) { // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ TSKM_ASSERT_ERRNO(close(fd) == 0); // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ } // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ return ret; // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ }
+
+ ret = ftruncate(fd, size);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ if (fd > 0) { // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ TSKM_ASSERT_ERRNO(close(fd) == 0); // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ } // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ return ret; // LCOV_EXCL_LINE 5: Checked in Death testing, but it is not reflected in the coverage and excluded.
+ }
+
+ if (p_addr) { // LCOV_EXCL_BR_LINE 8: Because p_addr is set to NULL only
+ // LCOV_EXCL_START 8: Because p_addr is set to NULL only
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ // Not supported
+ TSKM_ASSERT_ERRNO(0);
+ ret = -1;
+ if (fd > 0) {
+ TSKM_ASSERT_ERRNO(close(fd) == 0);
+ }
+ return ret;
+ // LCOV_EXCL_STOP
+ }
+
+ ret = 0;
+ if (fd > 0) {
+ TSKM_ASSERT_ERRNO(close(fd) == 0);
+ }
+ return ret;
+}
+
+/*********************************************************
+ * Creating shared memory
+ *********************************************************/
+int tskm_pf_shmCreate(const char* name, int32_t size, void** p_addr) {
+ TSKM_PORTPF_IN_ARG("%s,%d", name, size);
+ struct stat statInfo;
+ int ret = -1;
+
+ if (stat(name, &statInfo) == 0) {
+ TSKM_ASSERT_PRINT(0, "Already Exist %s", name);
+ ret = 0; // To be Succeeded
+ TSKM_PORTPF_OUT();
+ return ret;
+ }
+
+ ret = tskm_pf_shmCreate_Open_Ftrn(name, size, p_addr);
+
+ TSKM_PORTPF_OUT();
+ return ret;
+}
+
+/*********************************************************
+ * Deleting shared memory
+ *********************************************************/
+int tskm_pf_shmDelete(const char* name) {
+ TSKM_PORTPF_IN_ARG("%s", name);
+ int ret = 0;
+
+ if (0 != shm_unlink(name)) {
+ TSKM_ASSERT_ERRNO(0);
+ }
+
+ TSKM_PORTPF_OUT();
+ return ret;
+}
+
+/*********************************************************
+ * Starting thread
+ *********************************************************/
+int tskm_pf_createThread(void* (*threadFunc)(void*), void* prm,
+ uint32_t priority, const char* threadName,
+ pthread_t* p_thId) {
+ TSKM_PORTPF_IN();
+
+ int ret;
+ CL_ThreadAttr_t cl_attr;
+
+ ret = CL_ThreadCreateAttrInit(&cl_attr);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 6: For processing initializing process
+ goto ERROR; // LCOV_EXCL_LINE 6: For processing initializing process
+ }
+
+ if (threadName) {
+ ret = CL_ThreadCreateAttrSetName(&cl_attr, threadName);
+ TSKM_ASSERT_ERRNO(ret == 0);
+ }
+
+ ret = CL_ThreadCreate(p_thId, NULL, &cl_attr, threadFunc, prm);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 6: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 6: For processing initializing process
+ goto ERROR; // LCOV_EXCL_LINE 6: For processing initializing process
+ }
+ int sched_policy;
+ struct sched_param sparam;
+
+ pthread_getschedparam(*p_thId, &sched_policy, &sparam);
+
+ sparam.sched_priority = priority;
+ if ((priority != 0) && (sched_policy == SCHED_OTHER)) {
+ sched_policy = SCHED_FIFO;
+ } else if ((priority == 0) && (sched_policy != SCHED_OTHER)) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ sched_policy = SCHED_OTHER; // LCOV_EXCL_LINE 6: For processing initializing process
+ }
+
+ ret = pthread_setschedparam(*p_thId, sched_policy, &sparam);
+ TSKM_ASSERT(ret == 0);
+ TSKM_PORTPF_OUT();
+ return 0;
+ ERROR: return -1;
+}
+/*********************************************************
+ * Send Stop Complete Response
+ *********************************************************/
+int tskm_pf_sendStopCompResp() {
+ EFrameworkunifiedStatus l_eStatus;
+ TSKM_PORTPF_IN();
+
+ l_eStatus = SendInterfaceunifiedOnStopResponseToSystemManager(eFrameworkunifiedStatusOK);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT(0);
+ }
+
+ TSKM_PORTPF_OUT();
+ return 0;
+}
+
+/*********************************************************
+ * ABORT
+ *********************************************************/
+int tskm_pf_abort() {
+ TSKM_PORTPF_IN();
+
+ TSKM_ASSERT(0);
+ sleep(1); // Sleep a little so that the logging at the time of abnormality may be interrupted
+
+ // Issure SIGSEG
+ printf("%d\n", *(int *) 0); // NOLINT (readability/casting)
+
+ TSKM_PORTPF_OUT();
+ return 0;
+}
+
+/*********************************************************
+ * EXIT
+ *********************************************************/
+int tskm_pf_exit(int status) { //LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_PORTPF_IN();
+
+ exit(status);
+
+ TSKM_PORTPF_OUT();
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/*********************************************************
+ * TOUCH
+ *********************************************************/
+int tskm_pf_touch(char* path) {
+ TSKM_PORTPF_IN();
+ int fd;
+ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ if (fd < 0) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ TSKM_ASSERT_ERRNO(close(fd) == 0);
+ TSKM_PORTPF_OUT();
+ return 0;
+ ERROR:
+ return -1;
+}
+
+/*********************************************************
+ * Touch
+ *********************************************************/
+int tskm_pf_mkTouchFileName(pid_t pid, char name[32]) {
+ TSKM_PORTPF_IN();
+
+ sprintf(name, "/tmp/tskm_touch%d", pid); // NOLINT (runtime/printf)
+
+ TSKM_PORTPF_OUT();
+ return 0;
+}
+
+/*********************************************************
+ * Read file
+ *********************************************************/
+static ssize_t readFile(const char* filePath, void* l_buf, ssize_t bufSize) {
+ int fd = -1;
+ ssize_t readSize, totalReadSize = 0;
+ char *p_buf = (char*) l_buf; // NOLINT (readability/casting)
+ fd = open(filePath, O_RDONLY);
+ if (fd == -1) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ do {
+ readSize = read(fd, p_buf, bufSize);
+ if (readSize == -1) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ } else if (readSize == 0) {
+ break;
+ }
+
+ p_buf += readSize;
+ bufSize -= readSize;
+ totalReadSize += readSize;
+ } while (bufSize > 0);
+
+ ERROR: if (fd != -1) {
+ close(fd);
+ }
+
+ return totalReadSize;
+}
+
+/*********************************************************
+ * Write to file
+ *********************************************************/
+static ssize_t writeFile(const char *filePath, const void* l_buf,
+ ssize_t bufSize) {
+ int ret = -1;
+ int fd = -1;
+
+ const char *p_buf = (const char*) l_buf;
+
+ ssize_t writeSize, totalWriteSize = 0;
+
+ fd = open(filePath, O_RDWR | O_TRUNC | O_CREAT, S_IRWXU);
+ if (fd == -1) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function open()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0); // LCOV_EXCL_LINE 5: Error branching of the standard-function open()
+ goto ERROR; // LCOV_EXCL_LINE 5: Error branching of the standard-function open()
+ }
+
+ do {
+ writeSize = write(fd, p_buf, bufSize);
+ if (writeSize == -1) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function write()
+ // LCOV_EXCL_START 5: Error branching of the standard-function write()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (errno == EINTR) {
+ continue;
+ } else {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ // LCOV_EXCL_STOP
+ } else if (writeSize == 0) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function write()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 5: Error branching of the standard-function write()
+ }
+ p_buf += writeSize;
+ bufSize -= writeSize;
+ totalWriteSize += writeSize;
+ } while (bufSize > 0); // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function write()
+
+ ret = fsync(fd);
+ if (ret == -1) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function fsync()
+ // LCOV_EXCL_START 5: Error branching of the standard-function fsync()
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ ERROR: if (fd != -1) { // LCOV_EXCL_BR_LINE 5: Error branching of the standard-function open()
+ close(fd);
+ }
+
+ return totalWriteSize;
+}
+
+/*********************************************************
+ * Checksum calculation
+ *********************************************************/
+static uint32_t calcCheckSum(const void* p_buf, size_t bufSize) {
+ int ii;
+ int blockNum;
+ uint32_t sum = 0;
+ uint32_t *p_calcBuf = (uint32_t*) p_buf; // NOLINT (readability/casting)
+
+ blockNum = static_cast<int>(bufSize) / static_cast<int>(sizeof(uint32_t));
+
+ for (ii = 0; ii < blockNum; ii++) {
+ sum += p_calcBuf[ii];
+ }
+
+ return sum;
+}
+
+/*********************************************************
+ * Checking files
+ *********************************************************/
+static TSKM_BOOL_t checkFile(const char *filePath) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uint32_t checkSum;
+ struct stat st;
+ ssize_t readSize;
+ TSKM_NV_INFO_t nvInfo;
+ TSKM_BOOL_t isFileOk = TSKM_FALSE;
+
+ if (stat(filePath, &st) != 0) {
+ goto ERROR;
+ }
+
+ readSize = readFile(filePath, &nvInfo, sizeof(TSKM_NV_INFO_t));
+ if (readSize != sizeof(TSKM_NV_INFO_t)) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ checkSum = calcCheckSum(&nvInfo, offsetof(TSKM_NV_INFO_t, footer.checkSum));
+
+ if (checkSum != nvInfo.footer.checkSum) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ if (strncmp(nvInfo.header.version, TSKM_NV_STRUCT_VERSION,
+ sizeof(TSKM_NV_STRUCT_VERSION)) != 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ isFileOk = TSKM_TRUE;
+ ERROR: return isFileOk;
+}
+// LCOV_EXCL_STOP
+/*********************************************************
+ * Non-volatile file initialization (Including checksum write)
+ *********************************************************/
+static int initNvFile() {
+ int ii;
+ ssize_t writeSize;
+ TSKM_NV_INFO_t nvInfo;
+
+ TSKM_STATIC_ASSERT(sizeof(TSKM_NV_INFO_t) == TSKM_NV_SIZE_ALL);
+ TSKM_STATIC_ASSERT(
+ offsetof(TSKM_NV_INFO_t, footer.checkSum) % sizeof(uint32_t) == 0);
+
+ memset(&nvInfo, 0, sizeof(TSKM_NV_INFO_t));
+ sprintf(nvInfo.header.version, TSKM_NV_STRUCT_VERSION); // NOLINT (readability/casting)
+ nvInfo.body.rsvSvcNum = 0;
+ for (ii = 0; ii < TSKM_SVC_RESERVE_MAX; ii++) {
+ nvInfo.body.rsvSvcs[ii] = TSKM_SVCID_NONE;
+ }
+ nvInfo.footer.checkSum = calcCheckSum(
+ &nvInfo, offsetof(TSKM_NV_INFO_t, footer.checkSum));
+
+ writeSize = writeFile(TSKM_TMP_NV_INFO_FILEPATH, &nvInfo,
+ sizeof(TSKM_NV_INFO_t));
+ if (writeSize != sizeof(TSKM_NV_INFO_t)) { // LCOV_EXCL_BR_LINE 6: writeSize must be the size of TSKM_NV_INFO_t
+ // LCOV_EXCL_START 6: writeSize must be the size of TSKM_NV_INFO_t
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ return 0;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Non-volatile file initialization
+ *********************************************************/
+int tskm_pf_nvFileInit(HANDLE hApp) {
+ int ret = -1;
+ struct stat st;
+ EFrameworkunifiedStatus l_eStatus;
+
+ if (stat(TSKM_TMP_TSKM_DIRECTORY, &st) != 0) { // LCOV_EXCL_BR_LINE 5:Standard C function return value
+ // LCOV_EXCL_START 5:Standard C function return value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = mkdir(TSKM_TMP_TSKM_DIRECTORY, S_IRWXU);
+ if (ret == -1) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = FrameworkunifiedNPRegisterPersistentFile(hApp, TSKM_NPP_NV_FILE_TAG);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: For processing initializing process
+ goto ERROR; // LCOV_EXCL_LINE 6: For processing initializing process
+ }
+
+ l_eStatus = FrameworkunifiedNPLoadPersistentFile(hApp, TSKM_TMP_NV_INFO_FILEPATH, TSKM_NPP_NV_FILE_TAG);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: For processing initializing process
+ goto ERROR; // LCOV_EXCL_LINE 6: For processing initializing process
+ }
+
+ return 0;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Non-volatile file read
+ *********************************************************/
+int tskm_pf_nvFileRead(HANDLE hApp, TSKM_NV_INFO_t* p_nvInfo) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ NC_LoadPersistedAck l_tMsgAck;
+ ssize_t readSize;
+ TSKM_BOOL_t isTmpFileOk = TSKM_FALSE;
+
+ if (sizeof(l_tMsgAck) != FrameworkunifiedGetMsgLength(hApp)) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_tMsgAck, sizeof(l_tMsgAck)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
+ // LCOV_EXCL_START 4: NSFW error case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if ((strncmp(l_tMsgAck.cTag, TSKM_NPP_NV_FILE_TAG, sizeof(TSKM_NPP_NV_FILE_TAG)) == 0)
+ && (eFrameworkunifiedStatusOK == l_tMsgAck.eStatus)) {
+ if (checkFile(TSKM_TMP_NV_INFO_FILEPATH) == TSKM_TRUE) {
+ isTmpFileOk = TSKM_TRUE;
+ }
+ }
+
+ if (isTmpFileOk == TSKM_FALSE) {
+ int ret;
+
+ ret = initNvFile();
+ if (ret == -1) { // LCOV_EXCL_BR_LINE 6: must return ok
+ // LCOV_EXCL_START 6: must return ok
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ readSize = readFile(TSKM_TMP_NV_INFO_FILEPATH, p_nvInfo,
+ sizeof(TSKM_NV_INFO_t));
+ if (readSize != sizeof(TSKM_NV_INFO_t)) { // LCOV_EXCL_BR_LINE 6: readSize must be the size of TSKM_NV_INFO_t
+ // LCOV_EXCL_START 6: readSize must be the size of TSKM_NV_INFO_t
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ l_eStatus = FrameworkunifiedNPReleasePersistentFile(hApp, eFrameworkunifiedPersistOnShutdown, TSKM_NPP_NV_FILE_TAG, TSKM_TMP_NV_INFO_FILEPATH);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ return 0;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Write non-volatile file (Including checksum)
+ *********************************************************/
+int tskm_pf_nvFileWrite(const TSKM_NV_INFO_t* p_nvInfo) {
+ ssize_t writeSize;
+ TSKM_NV_INFO_t nvInfo;
+
+ memcpy(&nvInfo, p_nvInfo, sizeof(TSKM_NV_INFO_t));
+
+ nvInfo.footer.checkSum = calcCheckSum(
+ &nvInfo, offsetof(TSKM_NV_INFO_t, footer.checkSum));
+
+ writeSize = writeFile(TSKM_TMP_NV_INFO_FILEPATH, &nvInfo,
+ sizeof(TSKM_NV_INFO_t));
+ if (writeSize != sizeof(TSKM_NV_INFO_t)) { // LCOV_EXCL_BR_LINE 6: writeSize must be the size of TSKM_NV_INFO_t
+ // LCOV_EXCL_START 6: writeSize must be the size of TSKM_NV_INFO_t
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ return -1;
+ // LCOV_EXCL_STOP
+ }
+ return 0;
+} // LCOV_EXCL_BR_LINE 10: Final line
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_port_subsys.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_port_subsys.cpp
new file mode 100755
index 0000000..cfdec49
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_port_subsys.cpp
@@ -0,0 +1,297 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_port_subsys.h"
+#include <pthread.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <native_service/cl_monitor.h>
+#include <system_service/ss_sm_client_if.h>
+#include <system_service/resm.h>
+//#include <stub/ss_diag.h>
+#include <string>
+
+#include "agl_thread.h"
+
+#include "tskm_main.h"
+#include "tskm_debug.h"
+#include "tskm_util.h"
+#include "tskm_port_pf.h"
+
+
+#ifndef oops_name2pid
+ #define oops_name2pid(processname) syscall(OOPSTRACE_SYSCALL, 17, processname)
+#endif
+
+
+typedef struct {
+ CL_MonitorSearch_t clMonSearch;
+ uint32_t resmId; // Session ID of RESM
+} SUB_SYS_CTX_t;
+
+static SUB_SYS_CTX_t g_sub;
+
+/******************************************************************
+ * Subsystem initialization
+ ******************************************************************/
+int tskm_sub_init(void) {
+ int clRet;
+ SUB_SYS_CTX_t* p_ctx = &g_sub;
+
+ clRet = CL_MonitorSearchInit(&p_ctx->clMonSearch);
+ if (clRet != 0) { // LCOV_EXCL_BR_LINE 6: For processing intializing process
+ // LCOV_EXCL_START 6:For processing initializing process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 6: For processing initializing process
+ }
+
+ return 0;
+ // LCOV_EXCL_START 6:For processing initializing process
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 1;
+ // LCOV_EXCL_STOP
+}
+
+/******************************************************************
+ * Subsystem termination
+ ******************************************************************/
+int tskm_sub_term(void) {
+ int ret;
+ SUB_SYS_CTX_t* p_ctx = &g_sub;
+
+ ret = CL_MonitorSearchDestroy(&p_ctx->clMonSearch);
+ if (ret != 0) {
+ TSKM_ASSERT_ERRNO(0);
+ }
+
+ return 0;
+}
+/*********************************************************
+ * REBOOT
+ *********************************************************/
+void tskm_sub_reboot(const TSKM_ERROR_REBOOT_t* p_info) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ TSKM_ASSERT(0);
+
+ l_eStatus = SendCpuResetRequestToSystemManager(
+ e_SS_SM_CPU_RESET_REASON_GENERIC_ERR, p_info->log.messageStr);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+}
+
+/*********************************************************
+ * REBOOT NORMAL
+ *********************************************************/
+void tskm_sub_reboot_normal(void) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+
+ l_eStatus = SendCpuResetRequestToSystemManager(
+ e_SS_SM_CPU_RESET_REASON_NORMAL);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT(0);
+ }
+}
+
+/*********************************************************
+ * LOGGING
+ *********************************************************/
+void tskm_sub_logging(const TSKM_LOGGING_INFO_t* p_info) {
+ EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
+ eSMUserLogType l_eType;
+
+ switch (p_info->type) {
+ case TSKM_LOGGING_TYPE_GRP_RELAUNCH:
+ l_eType = e_SS_SM_CAPTURE_GROUP_RELAUNCH;
+ break;
+ case TSKM_LOGGING_TYPE_MODULE_LOGS:
+ default:
+ l_eType = e_SS_SM_CAPTURE_MODULE_LOGS;
+ break;
+ }
+
+ l_eStatus = SendUserInvokedLoggingRequestToSystemManager(l_eType,
+ p_info->messageStr);
+ if (eFrameworkunifiedStatusOK != l_eStatus) {
+ TSKM_ASSERT(0);
+ }
+}
+
+/*********************************************************
+ * DEBUG DUMP
+ *********************************************************/
+void tskm_sub_debugDumpRes(BOOL bIsNeedSvcName, const char *p_dumpMsg) {
+ if (bIsNeedSvcName) { // LCOV_EXCL_BR_LINE 8: As the bIsNeedSvcName is set to FALSE only
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SSDEBUGDUMP("%s", p_dumpMsg); // LCOV_EXCL_LINE 8: As the bIsNeedSvcName is set to FALSE only
+ } else {
+ SSDEBUGDUMP_RAW("%s", p_dumpMsg);
+ }
+}
+
+/*********************************************************
+ * EXT BOOT INFO
+ *********************************************************/
+int tskm_sub_getExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info) {
+ EFrameworkunifiedStatus l_eStatus;
+ T_SS_SM_START_ExtDataStructType extStartupInfo;
+
+ l_eStatus = GetInterfaceunifiedOnStartExtInfo(extStartupInfo);
+ if (l_eStatus != eFrameworkunifiedStatusOK) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ memcpy(p_info, &extStartupInfo, sizeof(extStartupInfo));
+
+ return 0;
+ ERROR: return -1;
+}
+
+/*********************************************************
+ * Service Error Monitoring Check
+ *********************************************************/
+TSKM_HUNG_INFO_t*
+tskm_sub_searchHungSvcs() {
+ int ret;
+ TSKM_HUNG_INFO_t *p_hungList = NULL;
+ SUB_SYS_CTX_t* p_ctx = &g_sub;
+
+ ret = CL_MonitorSearchTimeout(&p_ctx->clMonSearch);
+ if (ret == -1) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ if (0 < p_ctx->clMonSearch.entry_num) {
+ int ii;
+
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "TimeoutSvcNum = %d",
+ p_ctx->clMonSearch.entry_num);
+
+ if (NULL == p_ctx->clMonSearch.entry_list) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ p_hungList = (TSKM_HUNG_INFO_t *) malloc( // NOLINT (readability/casting)
+ sizeof(TSKM_HUNG_INFO_t) * (p_ctx->clMonSearch.entry_num + 1));
+ if (p_hungList == NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case.
+ // LCOV_EXCL_START 5: Checked in Death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ for (ii = 0; ii < p_ctx->clMonSearch.entry_num; ii++) {
+ p_hungList[ii].pid = p_ctx->clMonSearch.entry_list[ii].pid;
+ p_hungList[ii].type = p_ctx->clMonSearch.entry_list[ii].type;
+ }
+ // set "-1" to pid at the end of list.
+ p_hungList[p_ctx->clMonSearch.entry_num].pid = -1;
+ }
+
+ ERROR: return p_hungList;
+}
+
+/*********************************************************
+ * RESM Initialization
+ *********************************************************/
+int tskm_sub_resmInit(void) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int redmFd;
+ SUB_SYS_CTX_t* p_ctx = &g_sub;
+ RESM_ERR_t resmRet = RESM_E_OK;
+ RESM_REQ_EVENT_t ev;
+
+ int pid;
+
+ resmRet = RESM_Open(NULL, &(p_ctx->resmId));
+ if (RESM_E_OK != resmRet) {
+ TSKM_ASSERT(0);
+
+#warning RESM backtrace disabled, because 'print_backtrace_pid' not support.
+#if 0
+ // Backtrace outoutput of the RESM
+ pid = oops_name2pid(MN_SS_RESOURCEMGR);
+ if(pid > 0){
+ TSKM_ASSERT(-1 != print_backtrace_pid(pid));
+ }else{
+ TSKM_PRINTF(TSKM_LOG_ERROR, "ERR : oops_name2pid %d , err:%d, msg:%s",
+ pid, errno, strerror(errno));
+ }
+#endif
+
+ goto ERROR;
+ }
+
+ resmRet = RESM_GetEventFd(p_ctx->resmId, &redmFd);
+ if (RESM_E_OK != resmRet) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ ev.reqEvent = RESM_EV_MEM;
+ ev.prm.restMemThresh = 512; // Threshold(BYTE)
+
+ resmRet = RESM_ReqEvent(p_ctx->resmId, &ev);
+ if (RESM_E_OK != resmRet) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ return redmFd;
+ ERROR: return -1;
+}
+// LCOV_EXCL_STOP
+/*********************************************************
+ * Get EV of RESM
+ *********************************************************/
+int tskm_sub_resmRcv(TSKM_EVENT_INFO_t* p_ev) {
+ SUB_SYS_CTX_t* p_ctx = &g_sub;
+ RESM_ERR_t resmRet = RESM_E_OK;
+ RESM_EV_t evFlag;
+
+ resmRet = RESM_GetEvent(p_ctx->resmId, &evFlag);
+ if (RESM_E_OK != resmRet) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ if (RESM_EV_MEM != evFlag) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ TSKM_PRINTF(TSKM_LOG_ERROR, "Detect LowMem");
+
+ p_ev->event = TSKM_EV_LCL_REP_LOWMEM;
+
+ return 0;
+ ERROR: return -1;
+}
+
+int tskm_sub_setWakeupOrder(const char* p_order) {
+ // Under consideration
+ return 0;
+} // LCOV_EXCL_BR_LINE 10: Gcov constraints (last row)
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_shutdown.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_shutdown.cpp
new file mode 100755
index 0000000..1699f90
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_shutdown.cpp
@@ -0,0 +1,242 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_shutdown.h"
+#include "tskm_util.h"
+#include "tskm_debug.h"
+#include "tskm_state.h"
+
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+#include "tskm_gstep.h"
+
+
+/*********************************************************
+ * Get context of gradual startup
+ *********************************************************/
+TSKM_STATIC TSKM_GSTEP_CTX_t*
+gstepGetDownCtx(TSKM_MAIN_CTX_t* p_main) {
+ return &p_main->down;
+}
+
+/*********************************************************
+ * System shutdown completed
+ *********************************************************/
+TSKM_STATIC void downFinish(TSKM_MAIN_CTX_t* p_main) {
+ int ret;
+
+ // Send FrameworkunifiedOnStop response
+ ret = tskm_pf_sendStopCompResp();
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 8: As ret never becomes non-zero
+ // LCOV_EXCL_START 8: As ret never becomes non-zero
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ }
+
+ // Terminate subsystems
+ tskm_sub_term();
+}
+/*********************************************************
+ * Challenge for a transition to the next state
+ *********************************************************/
+TSKM_STATIC void tryTransNextState(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_GSTEP_CTX_t* p_down;
+ TSKM_GSTEP_t* p_current;
+
+ p_down = gstepGetDownCtx(p_main);
+ p_current = gstepGetCurrent(p_down);
+
+ if (gstepIsLast(p_down)) {
+ TSKM_SVC_WAIT_STATE_t waitState;
+
+ // Checking the ShutdownWaitSVC termination status
+ waitState = tskm_svcsGetSvcTermWaitState(&p_main->svcs);
+ switch (waitState) {
+ case TSKM_SVC_WAIT_BOTH:
+ break;
+ case TSKM_SVC_WAIT_TRANSIENT:
+ if ((p_down->compState & INI_TERMCOMP_RESIDENT) != INI_TERMCOMP_RESIDENT) {
+ // Nonresident service termination processing
+ if (TSKM_E_OK != tskm_svcsAvtiveSvcTerm(&p_main->svcs)) { // LCOV_EXCL_BR_LINE 5: tskm_svcsAvtiveSvcTerm is always return TSKM_E_OK
+ // LCOV_EXCL_START 5: tskm_svcsAvtiveSvcTerm is always return TSKM_E_OK
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ }
+ // Nonresident SVC terminated and started
+ p_down->compState |= INI_TERMCOMP_RESIDENT;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "TERM COMP :%s(%#llx)",
+ tskm_convTermCompId2Str(INI_TERMCOMP_RESIDENT),
+ INI_TERMCOMP_RESIDENT);
+ }
+ break;
+ case TSKM_SVC_WAIT_NONE:
+ // Complete ShutdownWaitSVC
+ // Nonresident SVC terminated and started
+ p_down->compState |= INI_TERMCOMP_TRANSIENT;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "TERM COMP :%s(%#llx)",
+ tskm_convTermCompId2Str(INI_TERMCOMP_TRANSIENT),
+ INI_TERMCOMP_TRANSIENT);
+ break;
+ default:
+ // LCOV_EXCL_START 8: As it does not meet the default requirements
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ if (tskm_svcsIsWaiting(&p_main->svcs) == TSKM_FALSE && // No waiting services
+ ((p_down->compState & p_current->nextTransCond)
+ == p_current->nextTransCond)) { // Event completion condition
+ if (gstepIsLast(p_down)) {
+ tskm_stateTransit(p_main, TSKM_ST_ACCON, TSKM_ST_ACCOFF);
+ } else {
+ tskm_stateTransit(p_main, TSKM_ST_DOWN, TSKM_ST_DOWN);
+ }
+ }
+}
+
+/*********************************************************
+ * Check and process gradual termination request
+ *********************************************************/
+TSKM_ERR_t tskm_entryDown_Check_Req(TSKM_MAIN_CTX_t* p_main,
+ TSKM_GSTEP_t* p_current) {
+ uint32_t ii;
+
+ if (0 == p_current->reqNum) {
+ EFrameworkunifiedStatus l_eStatus;
+
+ // If there is no gradual termination request, check the transition to the next step.
+ l_eStatus = FrameworkunifiedSendSelf(p_main->hApp, TSKM_TRANS_STEP_REQ, 0, NULL);
+ if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 5: Checked in death testing, but it is not reflected in the coverage and excluded
+ // LCOV_EXCL_START 5: Checked in death testing, but it is not reflected in the coverage and excluded
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ return TSKM_E_NG;
+ // LCOV_EXCL_STOP
+ }
+
+ } else {
+ // Gradual termination request
+ for (ii = 0; ii < p_current->reqNum; ii++) {
+ TSKM_ERR_t tskmRet;
+ TSKM_GSTEP_REQ_INFO_t* p_req = &p_current->reqList[ii];
+ TSKM_SVC_CTX_t* p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs,
+ p_req->svcId);
+
+ tskmRet = tskm_svcDownRequest(p_svc, p_req);
+ if (tskmRet != TSKM_E_OK) {
+ TSKM_ASSERT(0);
+ }
+ }
+ }
+ return TSKM_E_OK;
+}
+
+/*********************************************************
+ * Gradual termination entry process
+ *********************************************************/
+TSKM_ERR_t tskm_entryDown(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+
+ TSKM_GSTEP_CTX_t* p_down;
+ TSKM_GSTEP_t* p_current;
+
+ p_main->state = TSKM_ST_DOWN;
+ p_down = gstepGetDownCtx(p_main);
+ p_current = gstepGetCurrent(p_down);
+ if (p_current == NULL) { // LCOV_EXCL_BR_LINE 200:p_current can not be null
+ // LCOV_EXCL_START 200:p_current can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "DOWN GSTEP:%d", p_down->gstepIdx);
+
+ if (tskm_entryDown_Check_Req(p_main, p_current) == TSKM_E_NG) { // LCOV_EXCL_BR_LINE 200:the function of tskm_entryDown_Check_Req can not be TSKM_E_NG at this case // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 200:tskm_entryDown_Check_Req can not be TSKM_E_NG at this case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (p_current->nextTransCond) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "WAIT COMP:%s(%llx)",
+ tskm_convTermCompId2Str(p_current->nextTransCond),
+ p_current->nextTransCond);
+ }
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+
+ ERROR: tskm_pf_abort();
+ return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Gradual termination exit process
+ *********************************************************/
+TSKM_ERR_t tskm_exitDown(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+ TSKM_GSTEP_CTX_t* p_down;
+
+ p_down = gstepGetDownCtx(p_main);
+
+ if (gstepIsLast(p_down)) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "DOWN FINISH");
+ downFinish(p_main); // Final process of termination
+ }
+
+ changeNextStep(p_down); // Proceed to the next step
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+/*********************************************************
+ * Hander during gradual termination
+ *********************************************************/
+TSKM_ERR_t tskm_handleDown(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_FUNC_IN();
+
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REP_DOWN_COMP: // Notificaton for event completion in termination
+ {
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "TERM COMP :%s(%#llx) from:%d",
+ tskm_convTermCompId2Str(p_ev->prm.repDownComp.compId),
+ p_ev->prm.repDownComp.compId, p_ev->fromPid);
+ TSKM_GSTEP_CTX_t* p_down = gstepGetDownCtx(p_main);
+ p_down->compState |= p_ev->prm.repDownComp.compId;
+ tryTransNextState(p_main);
+ }
+ break;
+ case TSKM_EV_LCL_CHG_SVC_STATE: // Service state change
+ tryTransNextState(p_main);
+ break;
+ case TSKM_EV_LCL_REQ_TRANS_STEP: //Step transition request
+ tryTransNextState(p_main);
+ break;
+ default:
+ tskm_handleAccon(p_main, p_ev);
+ break;
+ }
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_state.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_state.cpp
new file mode 100755
index 0000000..b777090
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_state.cpp
@@ -0,0 +1,452 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_state.h"
+#include <stdlib.h>
+#include "tskm_util.h"
+#include "tskm_debug.h"
+#include "tskm_wakeup.h"
+#include "tskm_shutdown.h"
+#include "tskm_port_subsys.h"
+#include "tskm_port_pf.h"
+
+
+
+// Prototype declarations
+TSKM_ERR_t tskm_entryAccoff(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitAccoff(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_handleAccoff(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+TSKM_ERR_t tskm_entryAccon(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitAccon(TSKM_MAIN_CTX_t* p_main);
+
+TSKM_ERR_t tskm_entryRunning(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitRunning(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_handleRunning(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+// Structures of state transitioning callback functions
+typedef TSKM_ERR_t (*entry_state_t)(TSKM_MAIN_CTX_t* p_main);
+typedef TSKM_ERR_t (*exit_state_t)(TSKM_MAIN_CTX_t* p_main);
+typedef TSKM_ERR_t (*event_handler_t)(TSKM_MAIN_CTX_t* p_main,
+ TSKM_EVENT_INFO_t* p_ev);
+
+typedef struct {
+ TSKM_STATE_t state;
+ entry_state_t entry_func;
+ exit_state_t exit_func;
+ event_handler_t event_handler;
+} state_func_table_t;
+
+// State specific function table
+static const state_func_table_t state_func_table[] = { { TSKM_ST_ACCOFF,
+ tskm_entryAccoff, tskm_exitAccoff, tskm_handleAccoff }, { TSKM_ST_ACCON,
+ tskm_entryAccon, tskm_exitAccon, tskm_handleAccon }, { TSKM_ST_WAKEUP,
+ tskm_entryWakeup, tskm_exitWakeup, tskm_handleWakeup }, { TSKM_ST_RUNNING,
+ tskm_entryRunning, tskm_exitRunning, tskm_handleRunning }, { TSKM_ST_DOWN,
+ tskm_entryDown, tskm_exitDown, tskm_handleDown }, { 0, 0, 0, 0 } };
+
+/****************************************************
+ * ACC OFF ENTRY
+ ****************************************************/
+TSKM_ERR_t tskm_entryAccoff(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+ p_main->state = TSKM_ST_ACCOFF;
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * ACC OFF EXIT
+ *************************************************************************/
+TSKM_ERR_t tskm_exitAccoff(TSKM_MAIN_CTX_t* p_main) {
+ // Do nothing
+ // Called only once at startup
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * ACC OFF HANDLE
+ *************************************************************************/
+TSKM_ERR_t tskm_handleAccoff(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_ASSERT(0); // Do nothing
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * ACC ON ENTRY
+ *************************************************************************/
+TSKM_ERR_t tskm_entryAccon(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+ p_main->state = TSKM_ST_ACCON;
+
+ tskm_entryState(p_main, TSKM_ST_WAKEUP);
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * ACC ON HANDLE
+ *************************************************************************/
+TSKM_ERR_t tskm_exitAccon(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ if (TSKM_SUB_STATE_IS(p_main, TSKM_ST_WAKEUP)) { // LCOV_EXCL_BR_LINE 8:Because the condition is never true
+ // LCOV_EXCL_START 8: Because the condition is never true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskmRet = tskm_exitState(p_main, TSKM_ST_WAKEUP);
+ // LCOV_EXCL_STOP
+ } else if (TSKM_SUB_STATE_IS(p_main, TSKM_ST_RUNNING)) { // LCOV_EXCL_BR_LINE 8: Because the condition is never true
+ // LCOV_EXCL_START 8: Because the condition is never true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskmRet = tskm_exitState(p_main, TSKM_ST_RUNNING);
+ // LCOV_EXCL_STOP
+ } else if (TSKM_SUB_STATE_IS(p_main, TSKM_ST_DOWN)) { // LCOV_EXCL_BR_LINE 8:Because the condition is never false
+ tskmRet = tskm_exitState(p_main, TSKM_ST_DOWN);
+ }
+
+ TSKM_ERR_CHK(tskmRet, TSKM_E_OK, ERROR); // LCOV_EXCL_BR_LINE 8: Because the tskmRet does not change to NG
+ p_main->isExec = TSKM_FALSE;
+ ERROR:
+ TSKM_FUNC_OUT();
+ return tskmRet;
+}
+
+/*************************************************************************
+ * POLL EVENT HANDLE
+ *************************************************************************/
+TSKM_STATIC void checkHungSvcs(TSKM_MAIN_CTX_t* p_main) {
+ int ret;
+ TSKM_HUNG_INFO_t *p_hungSvcList = NULL;
+
+ p_hungSvcList = tskm_sub_searchHungSvcs();
+ if (p_hungSvcList != NULL) {
+ int hungSvcNum = 0;
+
+ while (p_hungSvcList[hungSvcNum].pid != -1) {
+ pid_t pid = p_hungSvcList[hungSvcNum].pid;
+
+ TSKM_SVC_CTX_t* p_svc = tskm_svcsGetSvcByPid(&p_main->svcs, pid);
+
+ if (p_svc) {
+ TSKM_PRINTF(TSKM_LOG_SYSTEMDATA, "HUNG SVC(%s:%d), TYPE(%d)",
+ p_svc->attr->name, pid, p_hungSvcList[hungSvcNum].type);
+
+ ret = tskm_pf_terminateProcGroup(static_cast<uint16_t>(pid));
+ if (ret != 0) {
+ TSKM_ASSERT(0);
+ }
+
+ } else {
+ TSKM_PRINTF(TSKM_LOG_WARN, "UNKNOWN HUNG SVC(%d), TYPE(%d)", pid,
+ p_hungSvcList[hungSvcNum].type);
+ }
+
+ hungSvcNum++;
+ }
+
+ free(p_hungSvcList);
+ }
+
+ return;
+}
+
+#define AVAILABILITY_CHECK_RETRY_COUNT 24
+
+/*************************************************************************
+ * CHECK SVC AVAILABILITY
+ *************************************************************************/
+TSKM_STATIC void checkSvcAvailability(TSKM_MAIN_CTX_t* p_main) {
+ for (uint32_t ii = 0; ii < p_main->svcs.svcNum; ii++) {
+ if (p_main->svcs.svcList[ii].state == TSKM_SVC_RUNNING
+ && !p_main->svcs.svcList[ii].isAvailable) {
+ p_main->svcs.svcList[ii].watchCnt++;
+ TSKM_ASSERT_PRINT(0, "WAIT AVAILABILITY FOR %s(%d) (%d/%d)",
+ p_main->svcs.svcList[ii].attr->name,
+ p_main->svcs.svcList[ii].pid,
+ p_main->svcs.svcList[ii].watchCnt,
+ AVAILABILITY_CHECK_RETRY_COUNT);
+
+ if (p_main->svcs.svcList[ii].watchCnt > AVAILABILITY_CHECK_RETRY_COUNT) {
+ int ret;
+
+ ret = tskm_pf_terminateProcGroup(static_cast<uint16_t>(p_main->svcs.svcList[ii].pid));
+ if (ret != 0) {
+ TSKM_ASSERT(0);
+ }
+ }
+ }
+ }
+
+ return;
+}
+
+/*************************************************************************
+ * POLL EVENT HANDLE
+ *************************************************************************/
+TSKM_STATIC void handlePolling(TSKM_MAIN_CTX_t* p_main) {
+ checkHungSvcs(p_main);
+
+ checkSvcAvailability(p_main);
+
+ return;
+}
+
+/*************************************************************************
+ * LOW MEMORY EVENT HANDLE
+ *************************************************************************/
+TSKM_STATIC void handleLowMem(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ tskmRet = tskm_svcsCallLowMem(&p_main->svcs);
+ if (TSKM_E_OK != tskmRet) {
+ TSKM_ASSERT(0);
+ }
+
+ return;
+}
+/*************************************************************************
+ * ACC ON HANDLE
+ *************************************************************************/
+TSKM_ERR_t tskm_handleAccon(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_FUNC_IN();
+
+ switch (p_ev->event) {
+ case TSKM_EV_LCL_REQ_SDUMP:
+ tskm_svcsDump(&p_main->svcs);
+ break;
+ // LCOV_EXCL_STOP
+ case TSKM_EV_LCL_REP_POLLING:
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "watch timer polling event.");
+ handlePolling(p_main);
+ break;
+ default:
+ TSKM_PRINTF(TSKM_LOG_STATE, "IGNORE:%s(%d)",
+ tskm_convEvent2Str(p_ev->event), p_ev->event);
+ break;
+ }
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * BOOT RESERVED SERVICES
+ *************************************************************************/
+static int bootRsvSvcs(TSKM_MAIN_CTX_t* p_main) {
+ uint32_t ii;
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+ uint8_t rsvSvcNum = p_main->nvInfo.body.rsvSvcNum;
+ TSKM_SVCID_t* p_rsvSvcs = p_main->nvInfo.body.rsvSvcs;
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "RSV SVC NUM = %d", rsvSvcNum);
+
+ for (ii = 0; ii < rsvSvcNum; ii++) {
+ TSKM_GSTEP_REQ_INFO_t req = { 0 };
+ TSKM_SVC_CTX_t* p_svc;
+
+ p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs, p_rsvSvcs[ii]);
+ if (p_svc == NULL) {
+ TSKM_ASSERT(0);
+ continue;
+ }
+
+ tskmRet = tskm_svcExec(p_svc);
+ if (TSKM_E_OK != tskmRet) {
+ TSKM_ASSERT(0);
+ continue;
+ }
+ if (p_svc->state == TSKM_SVC_WAITCONNECT) {
+ // In the state waiting for execution
+ req.svcId = p_rsvSvcs[ii];
+ req.localStep = TSKM_LSTEP_ALL;
+ tskmRet = tskm_svcWakeupRequest(p_svc, &req);
+ if (TSKM_E_OK != tskmRet) { // LCOV_EXCL_BR_LINE 8: Because the condition is never true
+ // LCOV_EXCL_START 8: Because the condition is never true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT_PRINT(0, "tskmRet = %d", tskmRet);
+ continue;
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+
+ if (rsvSvcNum != 0) {
+ int ret;
+
+ for (ii = 0; ii < TSKM_SVC_RESERVE_MAX; ii++) {
+ p_rsvSvcs[ii] = TSKM_SVCID_NONE;
+ }
+
+ p_main->nvInfo.body.rsvSvcNum = 0;
+
+ ret = tskm_pf_nvFileWrite(&p_main->nvInfo);
+ if (ret == -1) { // LCOV_EXCL_BR_LINE 8: Because the tskm_pf_nvFileWrite() only returns a return value of 0
+ // LCOV_EXCL_START 8:Because the condition is never true
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ return 0;
+ // LCOV_EXCL_START 8: Because the tskm_pf_nvFileWrite() only returns a return value of 0
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
+/*************************************************************************
+ * RUN ENTRY
+ *************************************************************************/
+TSKM_ERR_t tskm_entryRunning(TSKM_MAIN_CTX_t* p_main) {
+ int ret;
+
+ TSKM_FUNC_IN();
+ p_main->state = TSKM_ST_RUNNING;
+
+ ret = bootRsvSvcs(p_main);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 8: Because bootRsvSvcs returns only a return value of 0
+ // LCOV_EXCL_START 8: Because bootRsvSvcs returns only a return value of 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ }
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * RUN EXIT
+ *************************************************************************/
+TSKM_ERR_t tskm_exitRunning(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * RUN HANDLE
+ *************************************************************************/
+TSKM_ERR_t tskm_handleRunning(TSKM_MAIN_CTX_t* p_main,
+ TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_FUNC_IN();
+
+ switch (p_ev->event) {
+ case TSKM_EV_LCL_REQ_STOP:
+ tskm_stateTransit(p_main, TSKM_ST_RUNNING, TSKM_ST_DOWN);
+ break;
+ case TSKM_EV_LCL_REP_LOWMEM:
+ handleLowMem(p_main);
+ break;
+ default:
+ tskm_handleAccon(p_main, p_ev);
+ break;
+ }
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*************************************************************************
+ * Get transition table
+ *************************************************************************/
+static const state_func_table_t*
+tskm_getFuncTable(TSKM_STATE_t state) {
+ int i;
+ for (i = 0; state_func_table[i].state != 0; i++) {
+ if (state == state_func_table[i].state) {
+ return &state_func_table[i];
+ }
+ }
+ TSKM_ASSERT(0);
+ return &state_func_table[0];
+}
+
+/*************************************************************************
+ * State transition instructions
+ *************************************************************************/
+TSKM_ERR_t tskm_stateTransit(TSKM_MAIN_CTX_t* p_main, TSKM_STATE_t srcState,
+ TSKM_STATE_t dstState) {
+ TSKM_ERR_t tskmRet;
+ TSKM_PRINTF(TSKM_LOG_STATE, "STATE:%s(%s) -> %s",
+ tskm_convState2Str(srcState), tskm_convState2Str(p_main->state),
+ tskm_convState2Str(dstState));
+
+ tskmRet = tskm_exitState(p_main, srcState);
+ TSKM_ERR_CHK(tskmRet, TSKM_E_OK, ERROR); // LCOV_EXCL_BR_LINE 8: Because TSKM_ERR_CHK does not specify a goto ERROR condition
+ tskmRet = tskm_entryState(p_main, dstState);
+ TSKM_ERR_CHK(tskmRet, TSKM_E_OK, ERROR); // LCOV_EXCL_BR_LINE 8: Because TSKM_ERR_CHK does not specify a goto ERROR condition
+ return TSKM_E_OK;
+
+ // LCOV_EXCL_START 8: Because TSKM_ERR_CHK does not specify a goto ERROR condition
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return TSKM_E_NG;
+ // LCOV_EXCL_STOP
+}
+
+/*************************************************************************
+ * Event handler
+ *************************************************************************/
+void tskm_handleEvent(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev) {
+ event_handler_t handlerFunc;
+ handlerFunc = tskm_getFuncTable(p_main->state)->event_handler;
+ handlerFunc(p_main, p_ev);
+}
+
+/****************************************************
+ * State transitioning entry process
+ ****************************************************/
+TSKM_ERR_t tskm_entryState(TSKM_MAIN_CTX_t* p_rec, TSKM_STATE_t state) {
+ TSKM_ERR_t ret = TSKM_E_NG;
+ const state_func_table_t* p_table = tskm_getFuncTable(state);
+
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "entry :%s", tskm_convState2Str(state));
+ if (p_table->entry_func) { // LCOV_EXCL_BR_LINE 8: Because p_table->entry_func never becomes 0
+ ret = ((*p_table->entry_func)(p_rec));
+ } else {
+ // LCOV_EXCL_START 8: Because p_table->entry_func never becomes 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ }
+ return ret;
+}
+
+/****************************************************
+ * State transitioning exit process
+ ****************************************************/
+TSKM_ERR_t tskm_exitState(TSKM_MAIN_CTX_t* p_rec, TSKM_STATE_t state) {
+ TSKM_ERR_t ret = TSKM_E_NG;
+ const state_func_table_t* p_table = tskm_getFuncTable(state);
+
+ if (p_table->exit_func) { // LCOV_EXCL_BR_LINE 8: Because p_table->exit_func never becomes 0
+ ret = (*p_table->exit_func)(p_rec);
+ } else {
+ // LCOV_EXCL_START 8: Because p_table->exit_func never becomes 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ // LCOV_EXCL_STOP
+ }
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "exit :%s", tskm_convState2Str(state));
+ return ret;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_svc.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_svc.cpp
new file mode 100755
index 0000000..2f9abc1
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_svc.cpp
@@ -0,0 +1,970 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "system_service/tskm_svc.h"
+#include <string.h>
+#include <stdlib.h>
+#include <sys/inotify.h>
+#include <errno.h>
+
+#include <native_service/ns_np_service_if.h>
+#include <string>
+
+#include "tskm_debug.h"
+#include "tskm_util.h"
+#include "tskm_port_pf.h"
+#include "tskm_port_subsys.h"
+#include "tskm_comm.h"
+
+
+/*********************************************************
+ * Is the target event of the service handler?
+
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t isSvcEvent(const TSKM_EVENT_INFO_t* p_ev) {
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REP_CONNECT:
+ case TSKM_EV_PRI_REP_DISCONNECT:
+ case TSKM_EV_PRI_RES_WAKEUP:
+ case TSKM_EV_PRI_RES_DOWN:
+ case TSKM_EV_PRI_RES_DEBUGDUMP:
+ case TSKM_EV_PRI_REQ_EXIT:
+ case TSKM_EV_SVC_REP_TERM:
+ return TSKM_TRUE;
+ break;
+ default:
+ break;
+ }
+ return TSKM_FALSE;
+}
+
+/*********************************************************
+ * Get service context
+ *********************************************************/
+TSKM_STATIC TSKM_SVC_CTX_t*
+getSvcCtxBySvcId(TSKM_SVCS_CTX_t* p_svcs, TSKM_SVCID_t svcId) {
+ uint32_t ii;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ if (p_svcs->svcList[ii].attr->svcId == svcId) {
+ return &p_svcs->svcList[ii];
+ }
+ }
+ TSKM_ASSERT(0);
+ return NULL;
+}
+
+/*********************************************************
+ * Get service context
+ *********************************************************/
+TSKM_STATIC TSKM_SVC_CTX_t*
+getSvcCtxByPid(TSKM_SVCS_CTX_t* p_svcs, pid_t pid) {
+ uint32_t ii;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ if (p_svcs->svcList[ii].pid == pid) {
+ return &p_svcs->svcList[ii];
+ }
+ }
+ return NULL;
+}
+
+/*********************************************************
+ * Get service context
+ *********************************************************/
+TSKM_STATIC TSKM_SVC_CTX_t*
+getSvcCtxByName(TSKM_SVCS_CTX_t* p_svcs, const char *p_name) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uint32_t ii;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ if (0
+ == strncmp(p_svcs->svcList[ii].attr->name, p_name,
+ strlen(p_svcs->svcList[ii].attr->name))) {
+ return &p_svcs->svcList[ii];
+ }
+ }
+ return NULL;
+}
+// LCOV_EXCL_STOP
+/*********************************************************
+ * Issuing a start request to the service
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t wakeupRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req) {
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+ bzero(&ev, sizeof(ev));
+
+ ev.event = TSKM_EV_PRI_REQ_WAKEUP;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.reqWakeup.svcId = p_svc->attr->svcId;
+ ev.prm.reqWakeup.localStep = p_req->localStep;
+ ev.prm.reqWakeup.isDynamic =
+ (p_svc->attr->lifeCycle == TSKM_SVC_LC_DYNAMIC) ? TSKM_TRUE : TSKM_FALSE;
+ // Since there is no startup in the P_CWORD72_ but only communication in the ALL/LAST,
+ // the startup information is optimized including the startup information in the communication of the WakeupRequest.
+ memcpy(&ev.prm.reqWakeup.bootInfo, &p_svc->bootInfo,
+ sizeof(ev.prm.reqWakeup.bootInfo));
+ memcpy(&ev.prm.reqWakeup.extBootInfo, &p_svc->extBootInfo,
+ sizeof(ev.prm.reqWakeup.extBootInfo));
+
+ ret = tskm_sockSend(p_svc->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ p_svc->waitResCnt++;
+ p_svc->state = TSKM_SVC_WAKEUP;
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Touch services and extend EXIT timeouts
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t reqTouch(TSKM_SVC_CTX_t* p_svc) {
+#define TSKM_BUF_LEN ( 4 * ( sizeof(struct inotify_event) ) ) /* read size */
+ TSKM_ERR_t funcRet = TSKM_E_NG;
+ char touchFileName[32];
+ BOOL isNeedRetry = FALSE;
+
+ int iFd = p_svc->iFd;
+ int wd = 0;
+
+ TSKM_EVENT_INFO_t ev;
+ int ret;
+ bzero(&ev, sizeof(ev));
+
+ // Create monitoring files
+ tskm_pf_mkTouchFileName(p_svc->pid, touchFileName);
+ if (0 != tskm_pf_touch(touchFileName)) {
+ goto ERROR;
+ }
+
+ // Synchronize by iNortify
+ wd = inotify_add_watch(iFd, touchFileName, IN_DELETE_SELF);
+ if (wd == -1) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+
+ // Send Touch request
+ ev.event = TSKM_EV_PRI_REQ_TOUCH;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(p_svc->connFd, &ev);
+ if (ret <= 0) {
+ // Immediately after the nonresident service process terminates, since the TaskManager service status is other than DORMANT
+ // (mainly DOWN), the socket may be discarded and communication may fail, so retry
+ funcRet = TSKM_E_RETRY;
+ TSKM_PRINTF(TSKM_LOG_WARN, "ret = %d", ret);
+ goto ERROR;
+ }
+
+ // Wait for Touch completion
+ while (1) {
+ int maxFd = 0;
+ int ret;
+ fd_set fds;
+ FD_ZERO(&fds);
+ struct timeval timeout = { 0 };
+ timeout.tv_sec = TSKM_CFG_TOUCH_TIMEOUT;
+
+ FD_SET(iFd, &fds);
+ maxFd = iFd;
+
+ ret = select(maxFd + 1, &fds, NULL, NULL, &timeout);
+ if (ret == 0) {
+ TSKM_ASSERT_PRINT(0, "TIMEOUT:%s", touchFileName); // Timeout occurs
+ isNeedRetry = TRUE;
+ break;
+ } else if (ret < 1) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ }
+
+ if (FD_ISSET(iFd, &fds)) {
+ int length;
+ uint8_t buf[TSKM_BUF_LEN];
+
+ length = static_cast<int>(read(iFd, buf, TSKM_BUF_LEN));
+ if (length < 0) {
+ TSKM_ASSERT_ERRNO(0);
+ goto ERROR;
+ }
+ struct inotify_event *event = (struct inotify_event *) buf;
+ if (event->mask & IN_DELETE_SELF) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "TouchOK");
+ wd = 0;
+ // When a file is deleted, the association with the monitoring target is automatically released and inotify_rm_watch is no longer needed.
+ break;
+ } else {
+ TSKM_ASSERT_PRINT(0, "%x", event->mask);
+ }
+ }
+ }
+
+ if (isNeedRetry) {
+ funcRet = TSKM_E_RETRY;
+ } else {
+ funcRet = TSKM_E_OK;
+ }
+
+ ERROR: if (wd > 0) {
+ TSKM_ASSERT_ERRNO(0 == inotify_rm_watch(iFd, wd))
+ }
+
+ if (access(touchFileName, F_OK) == 0) {
+ // Timeout care
+ unlink(touchFileName);
+ }
+
+ return funcRet;
+}
+
+/*********************************************************
+ * Availability Monitoring Callbacks for Services
+ *********************************************************/
+EFrameworkunifiedStatus OnSvcAvailability(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PCSTR availabilityName;
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+ TSKM_SVC_CTX_t* p_svc;
+
+ availabilityName = FrameworkunifiedGetLastNotification(hApp);
+
+ std::string str = availabilityName;
+
+// unsigned int position;
+// if (std::string::npos != (position = static_cast<unsigned int>(str.find("/Availability", 0)))) {
+ ssize_t position;
+ if (0 <= (position = str.find("/Availability", 0))) {
+ str.erase(position, position + strlen("/Availability"));
+ }
+
+ p_svc = getSvcCtxByName(&p_main->svcs, str.c_str());
+ if (p_svc) {
+ p_svc->isAvailable = FrameworkunifiedIsServiceAvailable(hApp) ? TSKM_TRUE : TSKM_FALSE;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "%s Availability %s", p_svc->attr->name,
+ (p_svc->isAvailable == TSKM_TRUE) ? "TRUE" : "FALSE");
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+/*********************************************************
+ * Starting Availability Monitoring of Services
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t startWatchAvailability(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_ERR_t funcRet = TSKM_E_OK;
+
+ // LCOV_EXCL_BR_START 8: Since the condition is checked by the caller, it is not true.
+ if (p_svc->attr->type == TSKM_SVC_TYPE_UNKNONW) {
+ // LCOV_EXCL_BR_STOP
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ p_svc->isAvailable = TSKM_TRUE; // LCOV_EXCL_LINE 8: Since the condition is checked by the caller, it is not true.
+ } else {
+ EFrameworkunifiedStatus taskmanagerStatus;
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+ SS_String availabilityName = p_svc->attr->name;
+
+ availabilityName.append("/Availability");
+
+ taskmanagerStatus = FrameworkunifiedSubscribeNotificationWithCallback(p_main->hApp,
+ availabilityName.c_str(),
+ OnSvcAvailability);
+ if (eFrameworkunifiedStatusOK != taskmanagerStatus) {
+ TSKM_ASSERT(0);
+ funcRet = TSKM_E_NG;
+ }
+ }
+
+ return funcRet;
+}
+
+/*********************************************************
+ * Service startup sub
+ *********************************************************/
+void svcExec_Process(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_ERR_t funcRet;
+
+ if (p_svc->attr->type == TSKM_SVC_TYPE_NATIVE) {
+ p_svc->state = TSKM_SVC_WAITCONNECT;
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "[ST:%d] WAIT_EXEC", p_svc->pid);
+ funcRet = startWatchAvailability(p_svc);
+ if (TSKM_E_OK != funcRet) {
+ TSKM_ASSERT(0);
+ p_svc->isAvailable = TSKM_TRUE;
+ }
+ } else {
+ p_svc->state = TSKM_SVC_RUNNING;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "[ST:%d] RUN", p_svc->pid);
+ p_svc->isAvailable = TSKM_TRUE;
+ }
+ return;
+}
+
+/*********************************************************
+ * Service startup main
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t svcExec(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_ERR_t funcRet = TSKM_E_NG;
+ pid_t pid;
+
+ if (p_svc == NULL) { // LCOV_EXCL_BR_LINE 6:double check
+ // LCOV_EXCL_START 6: double check
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ if (p_svc->state == TSKM_SVC_DISABLE) {
+ // Prohibited startup
+ TSKM_ASSERT(0);
+ return TSKM_E_STATE;
+ } else if (p_svc->state == TSKM_SVC_WAITCONNECT) {
+ return TSKM_E_OK;
+ } else if (p_svc->state != TSKM_SVC_DORMANT) {
+ // Already started
+ funcRet = reqTouch(p_svc);
+ if (TSKM_E_OK != funcRet) {
+ TSKM_PRINTF(TSKM_LOG_WARN, "funcRet = %d", funcRet);
+ goto ERROR;
+ }
+ return TSKM_E_OK;
+ }
+
+ pid = tskm_pf_createProc(p_svc->attr);
+ if (pid <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ TSKM_PRINTF(TSKM_LOG_STATE, "EXEC %s:%d", p_svc->attr->name, pid);
+
+ p_svc->pid = pid;
+ p_svc->waitReqCnt = 0;
+
+ // Startup service
+ svcExec_Process(p_svc);
+
+ funcRet = TSKM_E_OK;
+ ERROR: return funcRet;
+}
+
+/*********************************************************
+ * Issuing a start request to the service
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t svcWakeupRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req) {
+ if (p_svc == NULL || p_svc->state == TSKM_SVC_DISABLE) { // LCOV_EXCL_BR_LINE 6: Since this function has always been called after checking // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return TSKM_E_STATE; // LCOV_EXCL_LINE 6: Since this function has always been called after checking
+ } else if (p_svc->state == TSKM_SVC_WAITCONNECT) {
+ // Remember it once and issue a request when the CONNECT completes.
+ p_svc->request[p_svc->waitReqCnt] = *p_req;
+ p_svc->waitReqCnt++;
+ } else {
+ TSKM_ERR_t tskmRet;
+ tskmRet = wakeupRequest(p_svc, p_req);
+ TSKM_ERR_CHK_DFT;
+ }
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Service reboot processing
+ *********************************************************/
+TSKM_STATIC TSKM_ERR_t svcErrTermPost(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+
+ TSKM_PRINTF(TSKM_LOG_SYSTEMDATA, "ERR TERM SVC(%s:%d)", p_svc->attr->name,
+ p_svc->pid);
+
+ if (p_svc->attr->lifeCycle == TSKM_SVC_LC_ALWAYS || (p_svc->errTermCnt > p_svc->attr->retryCnt && (uint32_t) -1 != p_svc->attr->retryCnt)) { // NOLINT(whitespace/line_length)
+ TSKM_ERROR_REBOOT_t rebootInfo;
+
+ TSKM_ASSERT(0);
+ memset(&rebootInfo, 0, sizeof(TSKM_ERROR_REBOOT_t));
+ rebootInfo.type = TSKM_ERROR_REBOOT_NORMAL;
+ snprintf(rebootInfo.log.messageStr, TSKM_LOGGING_MSG_STR_SIZE,
+ "TaskManager:SVC ErrTerm");
+ tskm_sub_reboot(&rebootInfo);
+ } else {
+ TSKM_LOGGING_INFO_t logInfo;
+ logInfo.type = TSKM_LOGGING_TYPE_MODULE_LOGS;
+
+ snprintf(logInfo.messageStr, TSKM_LOGGING_MSG_STR_SIZE,
+ "TaskManager:SVC ErrTerm");
+ tskm_sub_logging(&logInfo);
+
+ if (p_svc->attr->lifeCycle == TSKM_SVC_LC_ALWAYS_RECOVERABLE) {
+ TSKM_ERR_t ret;
+ TSKM_GSTEP_REQ_INFO_t req = { 0 };
+
+ ret = svcExec(p_svc);
+
+ if (TSKM_E_OK != ret) {
+ TSKM_ASSERT_PRINT(0, "ret = %d", ret);
+ goto ERROR;
+ } else if (p_svc->state == TSKM_SVC_WAITCONNECT) {
+ // In the state waiting for execution
+ req.svcId = p_svc->attr->svcId;
+ req.localStep = TSKM_LSTEP_ALL;
+ ret = svcWakeupRequest(p_svc, &req);
+ if (TSKM_E_OK != ret) {
+ TSKM_ASSERT_PRINT(0, "ret = %d", ret);
+ goto ERROR;
+ }
+ }
+ }
+ }
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Connection handler
+ * ret:TRUE SVC status changed
+ * ret:FALSE SVC status not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t connectHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ uint32_t ii;
+
+ TSKM_ASSERT(p_svc->state == TSKM_SVC_WAITCONNECT);
+
+ p_svc->connFd = p_inEv->prm.repConnect.connFd;
+ p_svc->state = TSKM_SVC_WAKEUP;
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "[ST:%d] WAKEUP", p_svc->pid);
+
+ p_svc->waitResCnt = 0;
+
+ if (p_svc->waitReqCnt) {
+ for (ii = 0; ii < p_svc->waitReqCnt; ii++) {
+ TSKM_ASSERT(TSKM_E_OK == wakeupRequest(p_svc, &p_svc->request[ii]));
+ }
+ p_svc->waitReqCnt = 0;
+ }
+
+ return TSKM_TRUE;
+}
+
+/*********************************************************
+ * Disconnection handler
+ * ret:TRUE SVC status changed
+ * ret:FALSE SVC status not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t disConnectHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ // No status change
+
+ return TSKM_TRUE;
+}
+
+/*********************************************************
+ * Response handler for the activation request
+ * ret:TRUE SVC status changed
+ * ret:FALSE SVC status not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t resWakeupHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ TSKM_ASSERT(p_svc->state == TSKM_SVC_WAKEUP);
+ TSKM_ASSERT(p_svc->waitResCnt > 0);
+ TSKM_BOOL_t isStateChg = TSKM_FALSE;
+
+ if (p_svc->isShmDone == TSKM_FALSE && p_inEv->prm.resWakeup.isShmDone) {
+ p_svc->isShmDone = TSKM_TRUE;
+ isStateChg = TSKM_TRUE;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "%s:SHM DONE", p_svc->attr->name);
+ }
+ if (p_svc->isStepDone == TSKM_FALSE && p_inEv->prm.resWakeup.isStepDone) {
+ p_svc->isStepDone = TSKM_TRUE;
+ isStateChg = TSKM_TRUE;
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "%s:STEP DONE", p_svc->attr->name);
+ }
+
+ if (p_svc->waitResCnt > 0) {
+ p_svc->waitResCnt--;
+ if (p_svc->waitResCnt == 0) { // Transition when the wait runs out
+ if (p_inEv->prm.resWakeup.isLast) {
+ p_svc->state = TSKM_SVC_RUNNING; // Startup completed
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "[ST:%d] RUN", p_svc->pid);
+ }
+ isStateChg = TSKM_TRUE;
+ }
+ }
+ return isStateChg;
+}
+
+/*********************************************************
+ * Response handler for the termination request
+ * ret:TRUE SVC state changed
+ * ret:FALSE SVC state not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t resDownHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ TSKM_ASSERT(p_svc->state == TSKM_SVC_DOWN);
+ TSKM_ASSERT(p_svc->waitResCnt > 0);
+ TSKM_BOOL_t isStateChg = TSKM_FALSE;
+
+ TSKM_PRINTF(TSKM_LOG_DEBUG, "pid:%d waitCnt:%d", p_svc->pid,
+ p_svc->waitResCnt);
+ if (p_svc->waitResCnt > 0) {
+ p_svc->waitResCnt--;
+ if (p_svc->waitResCnt == 0) { // Transition when the wait runs out
+ if (p_inEv->prm.resWakeup.isLast) {
+ p_svc->state = TSKM_SVC_FINDOWN; // Termination complete
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "[ST:%d] FIN_DOWN", p_svc->pid);
+ }
+ isStateChg = TSKM_TRUE;
+ }
+ }
+ return isStateChg;
+}
+
+/*********************************************************
+ * Response Handlers for DebugDump Requests
+ * ret:TRUE SVC state changed
+ * ret:FALSE SVC state not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t resDebugDumpHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ TSKM_BOOL_t isStateChg = TSKM_FALSE;
+ TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *p_prm;
+
+ if (!p_inEv->hasExtend || !p_inEv->extendPrm) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+
+ p_prm = (TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *) p_inEv->extendPrm; // NOLINT (readability/casting)
+
+ // FALSE is specified here because the required service names have been added in the PrimaryLib.
+ tskm_sub_debugDumpRes(FALSE, p_prm->dumpMsg);
+
+ ERROR: return isStateChg;
+}
+
+/*********************************************************
+ * Service termination request
+ * ret:TRUE SVC state changed
+ * ret:FALSE SVC state not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t reqExit(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ int ret;
+ TSKM_ERR_t tskmRet;
+ TSKM_ASSERT(p_svc->state == TSKM_SVC_RUNNING);
+ TSKM_ASSERT(p_svc->waitResCnt == 0);
+ TSKM_GSTEP_REQ_INFO_t req = { 0 };
+
+ req.svcId = p_svc->attr->svcId;
+ req.localStep = TSKM_LSTEP_ALL;
+ tskmRet = tskm_svcDownRequest(p_svc, &req);
+ TSKM_ERR_CHK_DFT;
+
+ return TSKM_TRUE;
+
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ERROR: ret = tskm_pf_terminateProcGroup(static_cast<uint16_t>(p_svc->pid));
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 8: dead code
+ TSKM_PRINTF(TSKM_LOG_WARN, "ret = %d", ret);
+ }
+
+ return TSKM_TRUE;
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************************
+ * Service termination handler
+ * ret:TRUE SVC state changed
+ * ret:FALSE SVC state not changed
+ *********************************************************/
+TSKM_STATIC TSKM_BOOL_t repTermHandle(TSKM_SVC_CTX_t* p_svc,
+ const TSKM_EVENT_INFO_t* p_inEv) {
+ int ret;
+
+ // Check error
+ if (p_svc->attr->lifeCycle == TSKM_SVC_LC_DYNAMIC) {
+ if (p_svc->state != TSKM_SVC_DOWN) {
+ // A STATE other than DOWN does not terminate.
+ TSKM_PRINTF(TSKM_LOG_ERROR, "ERR TERM %s(%d) waitCnt:%d",
+ p_svc->attr->name, p_svc->pid, p_svc->waitResCnt);
+ TSKM_ASSERT(0);
+ }
+ } else {
+ // The resident service terminated.
+ TSKM_PRINTF(TSKM_LOG_ERROR, "ERR TERM %s(%d) waitCnt:%d", p_svc->attr->name,
+ p_svc->pid, p_svc->waitResCnt);
+ TSKM_ASSERT(0);
+ }
+
+ TSKM_PRINTF(TSKM_LOG_STATE, "[ST:%d] DORMANT", p_svc->pid);
+
+ p_svc->state = TSKM_SVC_DORMANT;
+ p_svc->waitResCnt = 0;
+ p_svc->pid = 0;
+
+ if (p_svc->attr->type == TSKM_SVC_TYPE_NATIVE) {
+ EFrameworkunifiedStatus taskmanagerStatus;
+ TSKM_MAIN_CTX_t* p_main = tskm_getMainCtx();
+ SS_String availabilityName = p_svc->attr->name;
+ availabilityName.append("/Availability");
+
+ taskmanagerStatus = FrameworkunifiedUnsubscribeNotificationWithCallback(
+ p_main->hApp, availabilityName.c_str());
+ if (eFrameworkunifiedStatusOK != taskmanagerStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ p_svc->isAvailable = TSKM_FALSE;
+ p_svc->watchCnt = 0;
+
+ HANDLE hMq = McOpenSender(FRAMEWORKUNIFIED_NS_NPSERVICE);
+ if (NULL == hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ ServiceAvailability availInfo = { };
+
+ snprintf(availInfo.cServiceName, MAX_NAME_SIZE_APP, "%s",
+ p_svc->attr->name);
+ availInfo.eServiceAvailability = eFrameworkunifiedServiceNotAvailable;
+
+ taskmanagerStatus = NPPublishNotification(hMq, p_svc->attr->name,
+ availabilityName.c_str(), &availInfo,
+ sizeof(availInfo));
+ if (eFrameworkunifiedStatusOK != taskmanagerStatus) {
+ TSKM_ASSERT(0);
+ }
+
+ taskmanagerStatus = McClose(hMq);
+ if (eFrameworkunifiedStatusOK != taskmanagerStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0); // LCOV_EXCL_LINE 4: NSFW error case.
+ }
+ }
+ }
+
+ if (p_inEv->errCode != TSKM_E_OK) {
+ p_svc->errTermCnt++;
+ // Notify 'NG' at Relaunch after abnormal termination
+ p_svc->bootInfo.resetStatus = e_SS_SM_RESET_STATUS_NG;
+
+ ret = svcErrTermPost(p_svc);
+ if (ret != TSKM_E_OK) {
+ TSKM_ASSERT(0);
+ }
+ } else {
+ // NONE is notified at Relaunch after normal completion.
+ p_svc->bootInfo.resetStatus = e_SS_SM_RESET_STATUS_NONE;
+ }
+
+ return TSKM_TRUE;
+}
+
+/*********************************************************
+ * Get service context
+ *********************************************************/
+TSKM_SVC_CTX_t*
+tskm_svcsGetSvcBySvcId(TSKM_SVCS_CTX_t* p_svcs, TSKM_SVCID_t svcId) {
+ return getSvcCtxBySvcId(p_svcs, svcId);
+}
+
+/*********************************************************
+ * Get service context
+ *********************************************************/
+TSKM_SVC_CTX_t*
+tskm_svcsGetSvcByPid(TSKM_SVCS_CTX_t* p_svcs, pid_t pid) {
+ return getSvcCtxByPid(p_svcs, pid);
+}
+
+/*********************************************************
+ * Check for waiting services
+ *********************************************************/
+TSKM_BOOL_t tskm_svcsIsWaiting(TSKM_SVCS_CTX_t* p_svcs) {
+ uint32_t ii;
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ if (p_svcs->svcList[ii].waitResCnt > 0
+ || p_svcs->svcList[ii].state == TSKM_SVC_WAITCONNECT) {
+ return TSKM_TRUE;
+ }
+ }
+ return TSKM_FALSE;
+}
+
+/*********************************************************
+ * Check if ShutdownWait services are terminated
+ *********************************************************/
+TSKM_SVC_WAIT_STATE_t tskm_svcsGetSvcTermWaitState(TSKM_SVCS_CTX_t* p_svcs) {
+ uint32_t ii;
+ TSKM_SVC_WAIT_STATE_t waitState = TSKM_SVC_WAIT_NONE;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ if (p_svcs->svcList[ii].attr->shotdownWait) {
+ // Check shutdownWait SVC Only
+ if (p_svcs->svcList[ii].state != TSKM_SVC_DORMANT) {
+ // DORMANT is terminated or not started, so no checking is required
+ if (TSKM_SVC_LC_DYNAMIC != p_svcs->svcList[ii].attr->lifeCycle
+ && p_svcs->svcList[ii].state != TSKM_SVC_FINDOWN) { // Check of termination of resident SVCs
+ waitState = TSKM_SVC_WAIT_BOTH;
+ break;
+ } else if (TSKM_SVC_LC_DYNAMIC == p_svcs->svcList[ii].attr->lifeCycle) { // Check of termination of non-resident SVCs
+ waitState = TSKM_SVC_WAIT_TRANSIENT;
+ }
+ }
+ }
+ }
+ return waitState;
+}
+
+/*********************************************************
+ * Update boot info of all services
+ *********************************************************/
+TSKM_ERR_t tskm_svcsSetBootInfo(TSKM_SVCS_CTX_t* p_svcs,
+ T_SS_SM_START_DataStructType* p_info,
+ T_SS_SM_START_ExtDataStructType *p_exInfo) {
+ uint32_t ii = 0;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ p_svcs->svcList[ii].bootInfo = *p_info;
+ p_svcs->svcList[ii].extBootInfo = *p_exInfo;
+ }
+ return TSKM_E_OK;
+}
+
+/*********************************************************
+ * Terminates a running non-resident services
+ *********************************************************/
+TSKM_ERR_t tskm_svcsAvtiveSvcTerm(TSKM_SVCS_CTX_t* p_svcs) {
+ uint32_t ii;
+
+ for (ii = 0; ii < p_svcs->svcNum; ii++) {
+ TSKM_SVC_CTX_t* p_svc = &p_svcs->svcList[ii];
+
+ if (TSKM_SVC_LC_DYNAMIC == p_svc->attr->lifeCycle && // Non-resident SVC
+ TSKM_SVC_RUNNING == p_svc->state && p_svc->waitResCnt == 0) { // Running
+ TSKM_ERR_t tskmRet;
+ TSKM_GSTEP_REQ_INFO_t req = { 0 };
+
+ req.svcId = p_svc->attr->svcId;
+ req.localStep = TSKM_LSTEP_ALL;
+ tskmRet = tskm_svcDownRequest(p_svc, &req);
+ TSKM_ERR_CHK_DFT;
+ }
+ }
+
+ return TSKM_E_OK;
+
+ ERROR:
+ return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Calls back the DebugDump of the running services
+ *********************************************************/
+TSKM_ERR_t tskm_svcsCallDebugDump(TSKM_SVCS_CTX_t* p_svcs) {
+ for (uint32_t ii = 0; ii < p_svcs->svcNum; ii++) {
+ TSKM_SVC_CTX_t* p_svc = &p_svcs->svcList[ii];
+
+ if (TSKM_SVC_RUNNING == p_svc->state) { // Running
+ TSKM_EVENT_INFO_t ev;
+ bzero(&ev, sizeof(ev));
+
+ // Send DebugDump request
+ ev.event = TSKM_EV_PRI_REQ_DEBUGDUMP;
+ ev.errCode = TSKM_E_OK;
+ if (0 >= tskm_sockSend(p_svc->connFd, &ev)) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ }
+ }
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Calls back the LowMemory of the running services
+ *********************************************************/
+TSKM_ERR_t tskm_svcsCallLowMem(TSKM_SVCS_CTX_t* p_svcs) {
+ for (uint32_t ii = 0; ii < p_svcs->svcNum; ii++) {
+ TSKM_SVC_CTX_t* p_svc = &p_svcs->svcList[ii];
+ if (TSKM_SVC_RUNNING == p_svc->state) { // Running
+ TSKM_EVENT_INFO_t ev;
+ bzero(&ev, sizeof(ev));
+
+ // Send LowMemory detection notification
+ ev.event = TSKM_EV_PRI_REP_LOWMEM;
+ ev.errCode = TSKM_E_OK;
+ if (0 >= tskm_sockSend(p_svc->connFd, &ev)) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ }
+ }
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Event handler
+ *********************************************************/
+TSKM_ERR_t tskm_svcEventHandle(TSKM_SVC_CTX_t* p_svc, TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_FUNC_IN();
+ TSKM_BOOL_t isStateChg = TSKM_FALSE;
+
+ if (isSvcEvent(p_ev) == TSKM_FALSE) {
+ // If it is not an event for the service, it will be sent as follows.
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+ }
+
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REP_CONNECT: // Connection Registration from Service
+ isStateChg = connectHandle(p_svc, p_ev);
+ break;
+ case TSKM_EV_PRI_REP_DISCONNECT: // Disconnection Registration from Service
+ isStateChg = disConnectHandle(p_svc, p_ev);
+ break;
+ case TSKM_EV_PRI_RES_WAKEUP: // Response to a startup request from a service
+ isStateChg = resWakeupHandle(p_svc, p_ev);
+ break;
+ case TSKM_EV_PRI_RES_DOWN:
+ isStateChg = resDownHandle(p_svc, p_ev);
+ break;
+ case TSKM_EV_PRI_RES_DEBUGDUMP:
+ isStateChg = resDebugDumpHandle(p_svc, p_ev);
+ break;
+ case TSKM_EV_PRI_REQ_EXIT:
+ isStateChg = reqExit(p_svc, p_ev);
+ break;
+ case TSKM_EV_SVC_REP_TERM: // Service termination
+ isStateChg = repTermHandle(p_svc, p_ev);
+ break;
+ default:
+ break;
+ }
+
+ // Overwrite service state change
+ if (isStateChg) {
+ p_ev->event = TSKM_EV_LCL_CHG_SVC_STATE;
+ p_ev->prm.chgSvc.svcId = p_svc->attr->svcId;
+ } else {
+ p_ev->event = TSKM_EV_NOP;
+ }
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+/*********************************************************
+ * Startup service
+ *********************************************************/
+TSKM_ERR_t tskm_svcExec(TSKM_SVC_CTX_t* p_svc) {
+ return svcExec(p_svc);
+}
+
+/*********************************************************
+ * Issue a startup request to the service
+ *********************************************************/
+TSKM_ERR_t tskm_svcWakeupRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req) {
+ return svcWakeupRequest(p_svc, p_req);
+}
+
+/*********************************************************
+ * Issue a termination request to the service
+ *********************************************************/
+TSKM_ERR_t tskm_svcDownRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+
+ bzero(&ev, sizeof(ev));
+
+ if (tskm_svcIsCommunicatable(p_svc) == TSKM_FALSE) {
+ return TSKM_E_OK;
+ }
+
+ ev.event = TSKM_EV_PRI_REQ_DOWN;
+ ev.errCode = TSKM_E_OK;
+ ev.prm.reqDown.localStep = p_req->localStep;
+
+ ret = tskm_sockSend(p_svc->connFd, &ev);
+ if (ret <= 0) {
+ TSKM_ASSERT(0);
+ goto ERROR;
+ }
+ p_svc->waitResCnt++;
+ p_svc->state = TSKM_SVC_DOWN;
+
+ return TSKM_E_OK;
+ ERROR: return TSKM_E_NG;
+}
+
+/*********************************************************
+ * Prohibit starting service
+ *********************************************************/
+TSKM_ERR_t tskm_svcDisableRequest(TSKM_SVC_CTX_t* p_svc) {
+ if (p_svc->state == TSKM_SVC_DORMANT || p_svc->state == TSKM_SVC_DISABLE) {
+ p_svc->state = TSKM_SVC_DISABLE;
+ return TSKM_E_OK;
+ }
+ return TSKM_E_STATE;
+}
+
+/*********************************************************
+ * Allow starting service
+ *********************************************************/
+TSKM_ERR_t tskm_svcEnableRequest(TSKM_SVC_CTX_t* p_svc) {
+ if (p_svc->state == TSKM_SVC_DISABLE) {
+ p_svc->state = TSKM_SVC_DORMANT;
+ }
+ return TSKM_E_OK;
+}
+
+/*********************************************************
+ * Queriy whether the service is ready for communication
+ *********************************************************/
+TSKM_BOOL_t tskm_svcIsCommunicatable(TSKM_SVC_CTX_t* p_svc) {
+ TSKM_BOOL_t ret = TSKM_FALSE;
+ if (p_svc == NULL || p_svc->attr->type == TSKM_SVC_TYPE_UNKNONW) {
+ } else {
+ switch (p_svc->state) {
+ case TSKM_SVC_WAKEUP:
+ case TSKM_SVC_RUNNING:
+ case TSKM_SVC_DOWN:
+ ret = TSKM_TRUE;
+ break;
+ default:
+ break;
+ }
+ }
+ return ret;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_wakeup.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_wakeup.cpp
new file mode 100755
index 0000000..b5c6e89
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_wakeup.cpp
@@ -0,0 +1,201 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_wakeup.h"
+#include "tskm_debug.h"
+#include "tskm_util.h"
+#include "tskm_state.h"
+#include "tskm_port_subsys.h"
+#include "tskm_port_pf.h"
+
+#include "tskm_gstep.h"
+
+
+/*********************************************************
+ * Get gradual startup context
+ *********************************************************/
+TSKM_STATIC TSKM_GSTEP_CTX_t*
+gstepGetWakeupCtx(TSKM_MAIN_CTX_t* p_main) {
+ return &p_main->wakeup;
+}
+
+/***********************************************************************
+ * Startup completion process
+ ***********************************************************************/
+TSKM_STATIC void wakeupFinish(TSKM_MAIN_CTX_t* p_main) {
+ return;
+}
+
+/*********************************************************
+ * Challenge for a transition to the next state
+ *********************************************************/
+TSKM_STATIC void tryTransNextState(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_GSTEP_CTX_t* p_wakeup;
+ TSKM_GSTEP_t* p_current;
+
+ p_wakeup = gstepGetWakeupCtx(p_main);
+ p_current = gstepGetCurrent(p_wakeup);
+
+ if (!p_current) {
+ return;
+ }
+
+ // LCOV_EXCL_BR_START 8: Because the second condition in the if statement is never false
+ if (tskm_svcsIsWaiting(&p_main->svcs) == TSKM_FALSE && // No waiting services
+ ((p_wakeup->compState & p_current->nextTransCond)
+ == p_current->nextTransCond)) { // Event completion condition
+ // LCOV_EXCL_BR_STOP
+ if (gstepIsLast(p_wakeup)) {
+ tskm_stateTransit(p_main, TSKM_ST_WAKEUP, TSKM_ST_RUNNING);
+ } else {
+ tskm_stateTransit(p_main, TSKM_ST_WAKEUP, TSKM_ST_WAKEUP);
+ }
+ }
+}
+
+/*********************************************************
+ * Gradual startup request issuance process
+ *********************************************************/
+TSKM_ERR_t tskm_entryWakeup_Req(TSKM_MAIN_CTX_t* p_main,
+ TSKM_GSTEP_t* p_current) {
+ uint32_t ii;
+
+ // Refer to the stepId and perform preprocessing if needed.
+ if (p_current->gstepId == TSKM_GSTEP_BUPCHK) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "BUPCHK EXE");
+ // When TaskManager is used as a system Launcher, system data is initialized here.
+ }
+
+ // Start process
+ for (ii = 0; ii < p_current->execSvcNum; ii++) {
+ TSKM_ERR_t tskmRet;
+ TSKM_SVCID_t svcId = p_current->execSvcIdList[ii];
+ TSKM_SVC_CTX_t* p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs, svcId);
+
+ tskmRet = tskm_svcExec(p_svc);
+ TSKM_ERR_CHK_DFT;
+ }
+
+ // Issue gradual startup request
+ for (ii = 0; ii < p_current->reqNum; ii++) {
+ TSKM_ERR_t tskmRet;
+ TSKM_GSTEP_REQ_INFO_t* p_req = &p_current->reqList[ii];
+ TSKM_SVC_CTX_t* p_svc = tskm_svcsGetSvcBySvcId(&p_main->svcs, p_req->svcId);
+
+ // Queuing in the SVC layer even for services that are not started.
+ tskmRet = tskm_svcWakeupRequest(p_svc, p_req);
+ TSKM_ERR_CHK_DFT; // LCOV_EXCL_BR_LINE 6: Because TSKM_ERR_CHK_DFT does not specify a condition for goto to ERROR
+ }
+
+ if (p_current->nextTransCond) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "WAIT COMP:%s(%llx)",
+ tskm_convInitCompId2Str(p_current->nextTransCond),
+ p_current->nextTransCond);
+ }
+
+ return TSKM_E_OK;
+
+ // LCOV_EXCL_START 6: Checked in Death testing, but it is not reflected in the coverage and excluded
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return TSKM_E_NG;
+ // LCOV_EXCL_STOP
+}
+
+/*********************************************************
+ * Gradual startup entry process
+ *********************************************************/
+TSKM_ERR_t tskm_entryWakeup(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_FUNC_IN();
+
+ TSKM_GSTEP_CTX_t* p_wakeup;
+ TSKM_GSTEP_t* p_current;
+
+ p_main->state = TSKM_ST_WAKEUP;
+ p_wakeup = gstepGetWakeupCtx(p_main);
+ p_current = gstepGetCurrent(p_wakeup);
+
+ if (p_current == NULL) { // LCOV_EXCL_BR_LINE 8: Because condition false setting is not possible
+ // LCOV_EXCL_START 8: Because condition false setting is not possible
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ tskm_pf_exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP
+ }
+
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "WAKEUP GSTEP:%d", p_wakeup->gstepIdx);
+
+ if (tskm_entryWakeup_Req(p_main, p_current) == TSKM_E_NG) { // LCOV_EXCL_BR_LINE 200:the function of tskm_entryWakeup_Req can not be TSKM_E_NG at this case // NOLINT(whitespace/line_length)
+ // LCOV_EXCL_START 200:the function of tskm_entryWakeup_Req can not be TSKM_E_NG at this case // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ tskm_pf_exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP
+ }
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*********************************************************
+ * Gradual startup exit process
+ *********************************************************/
+TSKM_ERR_t tskm_exitWakeup(TSKM_MAIN_CTX_t* p_main) {
+ TSKM_GSTEP_CTX_t* p_wakeup;
+
+ TSKM_FUNC_IN();
+ p_wakeup = gstepGetWakeupCtx(p_main);
+
+ // Exit process at the end of the gradual startup
+ if (gstepIsLast(p_wakeup)) {
+ TSKM_PRINTF(TSKM_LOG_STATE, "WAKEUP FIN");
+ wakeupFinish(p_main);
+ }
+
+ changeNextStep(p_wakeup); // Transition to next step
+
+ TSKM_FUNC_OUT();
+ return TSKM_E_OK;
+}
+
+/*********************************************************
+ * Gradual startup handler
+ *********************************************************/
+TSKM_ERR_t tskm_handleWakeup(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev) {
+ TSKM_FUNC_IN();
+ TSKM_ERR_t tskmRet = TSKM_E_OK;
+
+ switch (p_ev->event) {
+ case TSKM_EV_PRI_REP_WAKEUP_COMP: // Event completion notification at startup
+ {
+ TSKM_PRINTF(TSKM_LOG_SVCSTATE, "INIT COMP :%s(%#llx) from:%d",
+ tskm_convInitCompId2Str(p_ev->prm.repWakeupComp.compId),
+ p_ev->prm.repWakeupComp.compId, p_ev->fromPid);
+ TSKM_GSTEP_CTX_t* p_wakeup = gstepGetWakeupCtx(p_main);
+ p_wakeup->compState |= p_ev->prm.repWakeupComp.compId;
+ tryTransNextState(p_main);
+ }
+ break;
+ case TSKM_EV_LCL_CHG_SVC_STATE: // Service state change
+ tryTransNextState(p_main);
+ break;
+ default:
+ tskmRet = tskm_handleAccon(p_main, p_ev);
+ break;
+ }
+ TSKM_FUNC_OUT();
+ return tskmRet;
+} // LCOV_EXCL_BR_LINE 10: Final line
+
diff --git a/video_in_hal/systemservice/task_manager/server/src/tskm_watch.cpp b/video_in_hal/systemservice/task_manager/server/src/tskm_watch.cpp
new file mode 100755
index 0000000..455de0b
--- /dev/null
+++ b/video_in_hal/systemservice/task_manager/server/src/tskm_watch.cpp
@@ -0,0 +1,101 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tskm_watch.h"
+#include <agl_thread.h>
+
+#include "tskm_debug.h"
+#include "tskm_port_pf.h"
+#include "tskm_comm.h"
+
+
+#define WATCH_CYCLE 5
+
+#define TIMER_THREAD_NAME "SS_TskmTimer"
+
+/*******************************************************************
+ * Periodic Timer-Thread MAIN Function
+ *******************************************************************/
+void *
+watchMain(void *arg) {
+ int connFd = -1;
+
+ connFd = tskm_cliSockConnect(TSKM_SOCKET_NAME);
+ if (connFd < 0) { // LCOV_EXCL_BR_LINE 5: system function(uinx) "socket" fail process
+ // LCOV_EXCL_START 5: system function(uinx) "socket" fail process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5
+ }
+
+ while (1) {
+ int ret;
+ TSKM_EVENT_INFO_t ev;
+
+ sleep(WATCH_CYCLE);
+
+ ev.event = TSKM_EV_LCL_REP_POLLING;
+ ev.errCode = TSKM_E_OK;
+ ret = tskm_sockSend(connFd, &ev);
+ if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: system function(uinx) "send" fail process
+ // LCOV_EXCL_START 5: system function(uinx) "send" fail process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5
+ }
+ }
+
+ // LCOV_EXCL_START 6: system function(uinx) call fail process
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (connFd != -1) {
+ tskm_sockDestory(connFd);
+ }
+
+ return 0;
+ // LCOV_EXCL_STOP
+}
+
+/*******************************************************************
+ * Periodic Timer thread start
+ *******************************************************************/
+int tskm_watch_startTimer() {
+ int ret;
+ pthread_t thId = { 0 };
+
+ ret = tskm_pf_createThread(watchMain, NULL, PR_SS_TSKMTIMER,
+ TIMER_THREAD_NAME, &thId);
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 5: system function(uinx) "pthread_*" fail process
+ // LCOV_EXCL_START 5: system function(uinx) "pthread_*" fail process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ TSKM_ASSERT(0);
+ goto ERROR;
+ // LCOV_EXCL_STOP 5
+ } else {
+ TSKM_PRINTF(TSKM_LOG_STATE, "watch thread created.");
+ }
+
+ return 0;
+
+ // LCOV_EXCL_LINE 6: system function(uinx) "pthread_*" fail process
+ ERROR:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return -1;
+ // LCOV_EXCL_STOP
+}
+
diff --git a/video_in_hal/systemservice/version_library/LICENSE b/video_in_hal/systemservice/version_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/systemservice/version_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/systemservice/version_library/Makefile.client b/video_in_hal/systemservice/version_library/Makefile.client
new file mode 100755
index 0000000..38d4f60
--- /dev/null
+++ b/video_in_hal/systemservice/version_library/Makefile.client
@@ -0,0 +1,19 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SUBDIRS := library
+
+include ../system_service.mk
diff --git a/video_in_hal/systemservice/version_library/library/Makefile b/video_in_hal/systemservice/version_library/library/Makefile
new file mode 100755
index 0000000..79654a2
--- /dev/null
+++ b/video_in_hal/systemservice/version_library/library/Makefile
@@ -0,0 +1,37 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# installed shared library(.so)
+INST_SHLIBS := libssver
+
+# compiled source
+libssver_SRCS := ss_ver.cc
+
+# installed header
+INST_HEADERS := version_library.h ss_ver.h
+
+# additional source path
+VPATH += ./src \
+ ./include/$(COMPONENT_NAME)
+
+# additional include path
+CPPFLAGS += -I./include
+
+# linked library
+LDFLAGS += -Wl,--no-as-needed
+LDLIBS += -Wl,-Bdynamic,--no-as-needed -lNS_FrameworkUnified
+
+include ../../system_service.mk
diff --git a/video_in_hal/systemservice/version_library/library/include/system_service/ss_ver.h b/video_in_hal/systemservice/version_library/library/include/system_service/ss_ver.h
new file mode 100755
index 0000000..a78c5ff
--- /dev/null
+++ b/video_in_hal/systemservice/version_library/library/include/system_service/ss_ver.h
@@ -0,0 +1,338 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VERSION_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_VER_H_
+#define VERSION_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_VER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <algorithm>
+#include <map>
+
+/**
+ * @file ss_ver.h
+ * @brief \~english This file supports CSSVer class, This class is a generic CSSVer abstraction
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup version_library
+ * @ingroup system_service
+ * @{
+ */
+
+using namespace std; // NOLINT (readability/nolint)
+
+#define SSVER_VERCHAR_MAX (64)
+#define SSVER_DATE_MAX (16)
+
+/**
+* @struct SSVER_PkgInfo
+* @brief \~english The structure of version package information
+*/
+typedef struct {
+ char version[SSVER_VERCHAR_MAX]; /*!< \~english Version information (String):*/
+ /*!< \~english The termination of string must be "\0"*/
+ char date[SSVER_DATE_MAX]; /*!< \~english Date (String):The termination of string must be "\0" */
+ /*!< \~english Date (String):Store "\0" when date information does not exist.*/
+} SSVER_PkgInfo;
+
+typedef std::map<std::string, SSVER_PkgInfo> SSVerPkgList;
+typedef SSVerPkgList::const_iterator SSVerPkgListIter;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// \ingroup SS_SystemManager
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// \brief This class is a generic CSSVer abstraction
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * @class CSSVer
+ * \~english @brief Version information set-up/acquisition
+ * \~english @par Brief Introduction
+ * Class to provide the function of the version information set-up/acquisition
+ *
+ */
+class CSSVer {
+ private:
+ SSVerPkgList m_verList;
+ void dump(void) const;
+
+ public:
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Constructor for CSSVer class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Creates the instance of CSSVer class. \n
+ /// This API reads the version information registered in VersionDB and creates the package
+ /// lists inside a instance. \n
+ /// This can create some instances at the same time. \n
+ /// Meanwhile, this does not guarantee the action when some threads
+ /// inside same process access to same instances. \n
+ /// It is possible that version information is overwritten from other process but the information overwritten
+ /// at other process is not reflected into the version information held inside self-instance.
+ /// By this, it is necessary to recreate an instance to get the latest information. \n
+ /// \~english @see ~CSSVer
+ ////////////////////////////////////////////////////////////////////////////////////
+ CSSVer();
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Destructor for CSSVer class
+ /// \~english @param None
+ /// \~english @retval None
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classfication
+ /// Public
+ /// \~english @par Type
+ /// None
+ /// \~english @par Detail
+ /// Releases the instance of CSSVer class.
+ /// \~english @see CSSVer
+ ////////////////////////////////////////////////////////////////////////////////////
+ ~CSSVer();
+
+ // Wrapper
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Returns the first iterator of package list.
+ /// \~english @param None
+ /// \~english @retval SSVerPkgListIter The first iterator of package list
+ /// \~english @par
+ /// The structure of version package information
+ /// \~english @code
+ /// #define SSVER_VERCHAR_MAX (64)
+ /// #define SSVER_DATE_MAX (16)
+ /// typedef struct{
+ /// char version[SSVER_VERCHAR_MAX]; /* Version information (String): The termination of
+ /// string must be "\0" */
+ /// char date[SSVER_DATE_MAX]; /* Date (String): The termination of string must be "\0"*/
+ /// /* Store "\0" when date information does not exist. */
+ /// }SSVER_PkgInfo;
+ ///
+ /// typedef std::map<std::string, SSVER_PkgInfo> SSVerPkgList; /* Package list definition */
+ /// typedef SSVerPkgList::const_iterator SSVerPkgListIter; /* Iterator definition of package list */
+ /// @endcode
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Gets and returns the first iterator of package list from the package list inside an instance.
+ /// \~english @see end
+ ////////////////////////////////////////////////////////////////////////////////////
+ SSVerPkgListIter begin() {
+ return m_verList.begin();
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Returns the end iterator of package list.
+ /// \~english @param None
+ /// \~english @retval SSVerPkgListIter The end iterator of package list
+ /// \~english @par
+ /// The structure of version package information
+ /// \~english @code
+ /// #define SSVER_VERCHAR_MAX (64)
+ /// #define SSVER_DATE_MAX (16)
+ /// typedef struct{
+ /// char version[SSVER_VERCHAR_MAX]; /* Version information (String): The termination of
+ /// string must be "\0" */
+ /// char date[SSVER_DATE_MAX]; /* Date (String): The termination of string must be "\0" */
+ /// /* Store "\0" when date information does not exist. */
+ /// }SSVER_PkgInfo;
+ ///
+ /// typedef std::map<std::string, SSVER_PkgInfo> SSVerPkgList; /* Package list definition */
+ /// typedef SSVerPkgList::const_iterator SSVerPkgListIter; /* Iterator definition of package list */
+ /// @endcode
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Gets and returns the last iterator of package list from the package list inside a instance.
+ /// \~english @see begin
+ ////////////////////////////////////////////////////////////////////////////////////
+ SSVerPkgListIter end() {
+ return m_verList.end();
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Checks whether data exists in package list or not.
+ /// \~english @param None
+ /// \~english @retval bool The possibility of data existence of package list
+ /// \~english @par
+ /// - true : Data does not exist
+ /// - false : Data exists
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// None
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Returns true when package list is null and return false when data exists.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+ bool empty() {
+ return m_verList.empty();
+ }
+
+ // Setter,getter
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Gets the package information of specified package.
+ /// \~english @param [in] name
+ /// std::string & - Package name
+ /// \~english @param [out] p_info
+ /// SSVER_PkgInfo* - Pointer to the storage area of package information
+ /// \~english @par
+ /// The structure of version package information
+ /// \~english @code
+ /// #define SSVER_VERCHAR_MAX (64)
+ /// #define SSVER_DATE_MAX (16)
+ /// typedef struct{
+ /// char version[SSVER_VERCHAR_MAX]; /* Version information (String): The termination of
+ /// string must be "\0" */
+ /// char date[SSVER_DATE_MAX]; /* Date (String): The termination of string must be "\0" */
+ /// /* Store "\0" when date information does not exist. */
+ /// }SSVER_PkgInfo;
+ ///
+ /// typedef std::map<std::string, SSVER_PkgInfo> SSVerPkgList; /* Package list definition */
+ /// typedef SSVerPkgList::const_iterator SSVerPkgListIter; /* Iterator definition of package list */
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Succeeded in getting package information
+ /// \~english @retval eFrameworkunifiedStatusFileLoadError Loading error for file
+ /// \~english @retval eFrameworkunifiedStatusFail Failed at some process
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Pointer(p_info) to the storage area for package information specified
+ /// by parameters is NULL. [eFrameworkunifiedStatusFail]
+ /// - Package information does not exist. [eFrameworkunifiedStatusFileLoadError]
+ /// - Unexpected error occurs. [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Returns this package information if the package name specified by parameters exists
+ /// in the package information list inside an instance.
+ /// This API reads and returns the package information from package
+ /// information storing files if it does not exist. \n
+ /// This adds the package information read from files to the package information list
+ /// inside an instance. \n
+ /// When other CSSVer instance (B) adds package from setPkgInfo during creating instance (A),
+ /// after that, this API can get the package information added by instance (A).
+ /// \~english @see setPkgInfo
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus getPkgInfo(const std::string &name, SSVER_PkgInfo* p_info);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup SS_SystemManager
+ /// \~english @par Summary
+ /// Sets the package information of specified package.
+ /// \~english @param [in] name
+ /// std::string & - Package name
+ /// \~english @param [in] info
+ /// SSVER_PkgInfo* - Package information
+ /// \~english @par
+ /// The structure of version package information
+ /// \~english @code
+ /// #define SSVER_VERCHAR_MAX (64)
+ /// #define SSVER_DATE_MAX (16)
+ /// typedef struct{
+ /// char version[SSVER_VERCHAR_MAX]; /* Version information (String): The termination of
+ /// string must be "\0" */
+ /// char date[SSVER_DATE_MAX]; /* Date (String): The termination of string must be \ */
+ /// /* Store "\0" when date information does not exist. */
+ /// }SSVER_PkgInfo;
+ ///
+ /// typedef std::map<std::string, SSVER_PkgInfo> SSVerPkgList; /* Package list definition */
+ /// typedef SSVerPkgList::const_iterator SSVerPkgListIter; /* Iterator definition of package list */
+ /// @endcode
+ /// \~english @retval eFrameworkunifiedStatusOK Succeeded in setting package information
+ /// \~english @retval eFrameworkunifiedStatusFail Faild at some process
+ /// \~english @par Preconditions
+ /// - None
+ /// \~english @par Changes of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Unexpected error occurs [eFrameworkunifiedStatusFail]
+ /// \~english @par Classification
+ /// Public
+ /// \~english @par Type
+ /// Sync only(None communication)
+ /// \~english @par Detail
+ /// Sets the package information specified by parameters and update VersionDB. \n
+ /// When some package information exists in the package information list inside an instance,
+ /// this API adds the package information specified by parameters to the package
+ /// information list inside an instance,
+ /// and writes the package information specified by parameters in package information storing files. \n
+ /// When package information does not exist in the package information list inside an instance,
+ /// this sets the package information specified by parameters to the package information list inside an instance
+ /// and writes the package information specified by parameters in package information storing files.
+ /// \~english @see getPkgInfo
+ ////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus setPkgInfo(const std::string &name, SSVER_PkgInfo &info); // NOLINT (readability/nolint)
+};
+
+#endif // VERSION_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_VER_H_
diff --git a/video_in_hal/systemservice/version_library/library/include/system_service/version_library.h b/video_in_hal/systemservice/version_library/library/include/system_service/version_library.h
new file mode 100755
index 0000000..f56a259
--- /dev/null
+++ b/video_in_hal/systemservice/version_library/library/include/system_service/version_library.h
@@ -0,0 +1,40 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file version_library.h
+ * @brief \~english This file include ss_ver.h
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup version_library
+ * @ingroup system_service
+ * @{
+ */
+// Include guard
+#ifndef SYSTEMSERVICE_VERSIONLIBRARY_H_ // NOLINT(build/header_guard)
+#define SYSTEMSERVICE_VERSIONLIBRARY_H_
+
+#include "system_service/ss_ver.h"
+
+#endif // SYSTEMSERVICE_VERSIONLIBRARY_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/video_in_hal/systemservice/version_library/library/src/ss_ver.cc b/video_in_hal/systemservice/version_library/library/src/ss_ver.cc
new file mode 100755
index 0000000..70f120c
--- /dev/null
+++ b/video_in_hal/systemservice/version_library/library/src/ss_ver.cc
@@ -0,0 +1,309 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <native_service/ns_logger_if.h>
+#include <system_service/ss_templates.h>
+
+#include <system_service/ss_ver.h>
+
+// For DEBUG
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_DEFAULT ZONE_FUNC
+
+#define SSVER_TMPDIR "/tmp/ssver"
+
+// FILE IO
+class CPkgInfoIo {
+ private:
+ int m_fd;
+ std::string m_path;
+ static std::map<std::string, int> m_dbgCnt; // Debug information for exclusive leakage check
+
+ void openFD(const int32_t mode) {
+ m_fd = open(m_path.c_str(), mode, 0664); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ if (m_fd == -1) {
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ throw eFrameworkunifiedStatusFail;
+ }
+
+ // File lock to protect file accesses
+ SS_ASERT_ERRNO(0 == flock(m_fd, LOCK_EX)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ // LCOV_EXCL_BR_START 11:Unexpected branch
+ m_dbgCnt[m_path]++;
+ SS_ASERT_LOG(m_dbgCnt[m_path] == 1, "%s:%d", m_path.c_str(), // LCOV_EXCL_BR_LINE 15: marco define @ss_templates.h
+ m_dbgCnt[m_path]);
+ // LCOV_EXCL_BR_STOP
+ }
+
+public:
+ CPkgInfoIo(const std::string& pkgName)
+ : m_fd(-1),
+ m_path(SSVER_TMPDIR) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT,__FUNCTION__,"+:%s",pkgName.c_str());
+ m_path += "/";
+ m_path += pkgName;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT,__FUNCTION__,"-");
+ }
+
+ ~CPkgInfoIo() {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+
+ // LCOV_EXCL_BR_START 11:Unexpected branch
+ m_dbgCnt[m_path]--;
+ SS_ASERT_LOG(m_dbgCnt[m_path] == 0, "%s:%d", m_path.c_str(), // LCOV_EXCL_BR_LINE 15: marco define @ss_templates.h
+ m_dbgCnt[m_path]);
+ SS_ASERT_ERRNO(0 == flock(m_fd, LOCK_UN)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+
+ if (m_fd != -1) {
+ SS_ASERT_ERRNO(0 == close(m_fd)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ }
+ // LCOV_EXCL_BR_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+ }
+
+ void putData(SSVER_PkgInfo &info) { // NOLINT (readability/nolint)
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ openFD(O_RDWR|O_CREAT|O_CLOEXEC);
+ ssize_t wsz;
+ wsz = write(m_fd, &info, sizeof(info));
+ if (wsz != sizeof(info)) { // LCOV_EXCL_BR_LINE 5:std c lib error process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed write(). wsz=%d size=%d errno=%d", // LCOV_EXCL_LINE 5: glibc fail safe
+ wsz, sizeof(info), errno); // LCOV_EXCL_LINE 5:std c lib error process
+ throw eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 5:std c lib error process
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+ }
+
+ void getData(SSVER_PkgInfo* p_info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ openFD(O_RDONLY|O_CLOEXEC);
+
+ ssize_t rsz;
+ rsz = my_read(m_fd, p_info, sizeof(*p_info));
+ if (rsz != sizeof(*p_info)) { // LCOV_EXCL_BR_LINE 5:std c lib error process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed read(). rsz=%d size=%d", rsz, // LCOV_EXCL_LINE 5:std c lib error process
+ sizeof(*p_info)); // LCOV_EXCL_LINE 5:std c lib error process
+ p_info->version[0] = '\0'; // LCOV_EXCL_LINE 5:std c lib error process
+ p_info->date[0] = '\0'; // LCOV_EXCL_LINE 5:std c lib error process
+ throw eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 5:std c lib error process
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+ }
+
+ int my_read(int fd, void* buf, int size) {
+ int done = 0;
+ char *buffer = reinterpret_cast<char*>(buf);
+ int sz = done;
+
+ while (size > 0) {
+ done = read(fd, buffer + done, size);
+ if (done < 0) { // LCOV_EXCL_BR_LINE 5:std c lib error process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 5:std c lib error process
+ if (errno == EINTR) { // LCOV_EXCL_LINE 5:std c lib error process
+ continue;
+ } else {
+ return done;
+ }
+ } else if (done == 0) { // LCOV_EXCL_BR_LINE 5:std c lib error process
+ return sz;
+ }
+ size -= done;
+ sz += done;
+ }
+ return sz;
+ }
+};
+
+std::map<std::string, int> CPkgInfoIo::m_dbgCnt; // Actual status
+
+//==================================================================
+// private
+//==================================================================
+void CSSVer::dump(void) const { // LCOV_EXCL_START 7:debugging process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ std::string dumpStr;
+ dumpStr = "VERINFO DUMP\n";
+
+ for (SSVerPkgList::const_iterator ite = m_verList.begin();
+ ite != m_verList.end(); ite++) {
+ dumpStr += ite->first;
+ dumpStr += "\n";
+ dumpStr += ite->second.version;
+ dumpStr += "\n";
+ dumpStr += ite->second.date;
+ dumpStr += "\n";
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "%s", dumpStr.c_str());
+}
+// LCOV_EXCL_STOP
+
+//==================================================================
+// PUBLIC
+//==================================================================
+CSSVer::CSSVer() {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ DIR *dir = NULL;
+ struct dirent dent, *next;
+ struct stat statbuf;
+
+ try {
+ if (stat(SSVER_TMPDIR, &statbuf) != 0) {
+ mkdir(SSVER_TMPDIR, 0775);
+ // Because this process is not locked, if multiple processes process at the same time,
+ // although it may have been created and fail, do not ASSERT it because it is harmless.
+ }
+
+ // Linux dependency codes
+ if ((dir = opendir(SSVER_TMPDIR)) == NULL) { // LCOV_EXCL_BR_LINE 5:std c lib error process
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 5:std c lib error process
+ throw eFrameworkunifiedStatusFail;
+ }
+
+ // LCOV_EXCL_BR_START 11:Unexpected branch
+ while (0 == readdir_r(dir, &dent, &next) && next) {
+ if (DT_REG == dent.d_type) {
+ SSVER_PkgInfo info;
+ std::string name(dent.d_name);
+ std::string verInfo;
+
+ CPkgInfoIo pkgIo(name);
+ pkgIo.getData(&info);
+
+ verInfo += "\nPACKAGE :";
+ verInfo += name;
+ verInfo += "\n";
+ verInfo += " VERSION:";
+ verInfo += info.version;
+ verInfo += "\n";
+ verInfo += " DATE :";
+ verInfo += info.date;
+ verInfo += "\n";
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "%s", verInfo.c_str());
+
+ m_verList.insert(std::make_pair(name, info));
+ }
+ }
+ SS_ASERT_ERRNO(0 == closedir(dir)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ // LCOV_EXCL_BR_STOP
+ } catch (...) { // LCOV_EXCL_START 6:unable to reach
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ if (dir) {
+ SS_ASERT_ERRNO(0 == closedir(dir));
+ }
+ } // LCOV_EXCL_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+}
+
+CSSVer::~CSSVer() {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+}
+
+EFrameworkunifiedStatus CSSVer::getPkgInfo(const std::string &name, SSVER_PkgInfo* p_info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ EFrameworkunifiedStatus versionlibraryRet = eFrameworkunifiedStatusOK;
+ try {
+ if (p_info == NULL) {
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ throw eFrameworkunifiedStatusFail;
+ }
+
+ SSVerPkgList::iterator ite = m_verList.find(name);
+
+ if (ite != m_verList.end()) {
+ // cache hit
+ *p_info = ite->second;
+ } else {
+ // cache miss
+ std::string path(SSVER_TMPDIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ path += "/";
+ path += name;
+
+ if (access(path.c_str(), F_OK) == 0) {
+ // cache refresh
+ CPkgInfoIo pkgIo(name); // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ pkgIo.getData(p_info); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ m_verList.insert(std::make_pair(name, *p_info)); // LCOV_EXCL_BR_LINE 11:except,C++ STL
+ } else {
+ throw eFrameworkunifiedStatusFileLoadError;
+ }
+ }
+ } catch (EFrameworkunifiedStatus ee) {
+ versionlibraryRet = ee;
+ } catch (...) { // LCOV_EXCL_START 6:unable to reach
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ versionlibraryRet = eFrameworkunifiedStatusFail;
+ } // LCOV_EXCL_STOP
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+ return versionlibraryRet;
+}
+
+EFrameworkunifiedStatus CSSVer::setPkgInfo(const std::string &name, SSVER_PkgInfo &info) {
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "+");
+ EFrameworkunifiedStatus versionlibraryRet = eFrameworkunifiedStatusOK;
+ try {
+ // LCOV_EXCL_BR_START 11:Unexpected branch
+ SSVerPkgList::iterator ite = m_verList.find(name);
+
+ if (ite == m_verList.end()) {
+ m_verList.insert(std::make_pair(name, info));
+ CPkgInfoIo pkgIo(name);
+ pkgIo.putData(info);
+ } else {
+ ite->second = info;
+ CPkgInfoIo pkgIo(name);
+ pkgIo.putData(info);
+ }
+ // LCOV_EXCL_BR_STOP
+ } catch (EFrameworkunifiedStatus ee) {
+ versionlibraryRet = ee;
+ } catch (...) { // LCOV_EXCL_START 6:unable to reach
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h
+ versionlibraryRet = eFrameworkunifiedStatusFail;
+ } // LCOV_EXCL_STOP
+
+ FRAMEWORKUNIFIEDLOG(ZONE_DEFAULT, __FUNCTION__, "-");
+ return versionlibraryRet;
+} // LCOV_EXCL_BR_LINE 10:for the last line
+
diff --git a/video_in_hal/update_hal/LICENSE b/video_in_hal/update_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/update_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/update_hal/Makefile b/video_in_hal/update_hal/Makefile
new file mode 100755
index 0000000..8accb94
--- /dev/null
+++ b/video_in_hal/update_hal/Makefile
@@ -0,0 +1,34 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+HEADER = hal_api/update_hal.h
+
+.PHONY:all
+
+######### make targets ##########################
+all:
+ @echo $@ done.
+
+######### make cleans ###########################
+clean:
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/include
+ install -m 0644 $(HEADER) $(DESTDIR)/usr/include
+ @echo $@ done.
diff --git a/video_in_hal/update_hal/hal_api/update_hal.h b/video_in_hal/update_hal/hal_api/update_hal.h
new file mode 100755
index 0000000..92da9d7
--- /dev/null
+++ b/video_in_hal/update_hal/hal_api/update_hal.h
@@ -0,0 +1,165 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief This file provides support for Software Download.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file update_hal.h
+ */
+
+/** @addtogroup update_service
+ * @{
+ */
+/** @addtogroup update_hal
+ * @ingroup update_service
+ * @{
+ */
+
+#ifndef INCLUDE_UPDATE_HAL_H_
+#define INCLUDE_UPDATE_HAL_H_
+#include <stdint.h>
+
+/* status of VUP_COMPLETE */
+#define VUP_SUCCESS 0 //!< \~english Success
+#define VUP_FAIL 1 //!< \~english Failed
+
+/* Inter process command codes */
+
+/**
+* \~english Start all updates\n
+* Command ID that the user specifies when requesting update_hal to start all updates \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_VUPSTART 205
+
+/**
+* \~english Start differential update\n
+* Command ID that the user specifies when requesting incremental update start from update_hal \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_DIFFVUPSTART 209
+
+/**
+* \~english Copy of the updated side\n
+* Command ID that the user specifies when requesting update_hal to copy the update plane \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_COPY 216
+
+/**
+* \~english Cancel update\n
+* Command ID that the user specifies when requesting update_hal to cancel the update \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* At this time, specify updater as the destination.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_CANCEL 207
+
+/**
+* \~english Update cancellation completion notice\n
+* Command ID that notifies the user that update cancellation processing has been completed from update_hal \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_RES_CANCEL 208
+
+/**
+* \~english Progress status notification\n
+* Command ID that notifies the update progress status from update_hal to the user \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_PROGRESS 203
+
+/**
+* \~english Update completion notice\n
+* Command ID that notifies the end of update from update_hal to the user \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_COMPLETE 204
+
+#define UPDATE_START_TYPE_UPDATE 1 //!< \~english Type of Update
+#define UPDATE_START_TYPE_VERIFY 2 //!< \~english Type of Verification
+
+/* Data format of request to updater to exec update(UpdateService -> updater) */
+// Formate is:
+// num_of_fileset x 1 : UI_32
+// fileset x N : UpdateDataInfo(struct) x N
+#define KWI_MAX_MOD_FPATH 128 //!< \~english Max file path of module in Detailed info
+#define VUP_MAX_KWI_FNAME (KWI_MAX_MOD_FPATH+1) //!< \~english 129 Max size of the string which to save the file path
+#define KWI_SIZE_HASH 32 //!< \~english HashSize length
+#define VUP_MAX_KWI_DETAIL 15 //!< \~english Max file path of Data infos
+
+/**
+* \~english Structure for starts update external update
+*/
+typedef struct _UpdateDataInfo {
+ UI_32 ID; /*!< \~english ID originated by 0(ROOTFS:0, BOOT:1)*/
+ char filename[VUP_MAX_KWI_FNAME]; /*!< \~english source file(device) name(fullpath)*/
+ char srcname[VUP_MAX_KWI_FNAME]; /*!< \~english source file(device) name in diff update(fullpath)*/
+ char destname[VUP_MAX_KWI_FNAME]; /*!< \~english destinamtion file(device) name(fullpath)*/
+ UI_64 offset; /*!< \~english offset of source file*/
+ UI_64 seek; /*!< \~english seek of destination file*/
+ UI_32 size; /*!< \~english size of data*/
+ char src_hash[KWI_SIZE_HASH]; /*!< \~english Original Data Hash(for diff update only)*/
+ char dst_hash[KWI_SIZE_HASH]; /*!< \~english Restored Data Hash*/
+ UI_32 num_of_div; /*!< \~english Num of Detail files*/
+ UI_64 mod_offset; /*!< \~english offset of module in KWI file*/
+ UI_64 div_offset; /*!< \~english offset of divide header in KWI file*/
+} UpdateDataInfo;
+
+/**
+* \~english List of structure for starts update external update
+*/
+typedef struct _UpdateDataInfos {
+ UI_32 units; /*!< \~english Num of Data Info*/
+ UpdateDataInfo info[VUP_MAX_KWI_DETAIL]; /*!< \~english Data Infos*/
+} UpdateDataInfos;
+
+/**
+* \~english Structure for notify update complete
+*/
+typedef union _ResUpdCompletion {
+ // for Normal/SYS Updater
+ struct {
+ UI_32 type; /*!< \~english type*/
+ UI_32 status; /*!< \~english result*/
+ } inner;
+ // for Outer Updater
+ struct {
+ UI_32 status; /*!< \~english result*/
+ UI_32 need_reboot; /*!< \~english Whether it is necessary to reboot system.*/
+ } outer;
+} ResUpdCompletion;
+
+
+/** @}*/ // end of update_hal
+/** @}*/ // end of update_service
+
+#endif // INCLUDE_UPDATE_HAL_H_
diff --git a/video_in_hal/update_hal/include/update_hal.h b/video_in_hal/update_hal/include/update_hal.h
new file mode 100755
index 0000000..92da9d7
--- /dev/null
+++ b/video_in_hal/update_hal/include/update_hal.h
@@ -0,0 +1,165 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief This file provides support for Software Download.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @file update_hal.h
+ */
+
+/** @addtogroup update_service
+ * @{
+ */
+/** @addtogroup update_hal
+ * @ingroup update_service
+ * @{
+ */
+
+#ifndef INCLUDE_UPDATE_HAL_H_
+#define INCLUDE_UPDATE_HAL_H_
+#include <stdint.h>
+
+/* status of VUP_COMPLETE */
+#define VUP_SUCCESS 0 //!< \~english Success
+#define VUP_FAIL 1 //!< \~english Failed
+
+/* Inter process command codes */
+
+/**
+* \~english Start all updates\n
+* Command ID that the user specifies when requesting update_hal to start all updates \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_VUPSTART 205
+
+/**
+* \~english Start differential update\n
+* Command ID that the user specifies when requesting incremental update start from update_hal \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_DIFFVUPSTART 209
+
+/**
+* \~english Copy of the updated side\n
+* Command ID that the user specifies when requesting update_hal to copy the update plane \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* In this case, specify updater as the destination and UpdateDataInfo as the datatype.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_COPY 216
+
+/**
+* \~english Cancel update\n
+* Command ID that the user specifies when requesting update_hal to cancel the update \n
+* This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
+* At this time, specify updater as the destination.
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_REQ_CANCEL 207
+
+/**
+* \~english Update cancellation completion notice\n
+* Command ID that notifies the user that update cancellation processing has been completed from update_hal \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_RES_CANCEL 208
+
+/**
+* \~english Progress status notification\n
+* Command ID that notifies the update progress status from update_hal to the user \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_PROGRESS 203
+
+/**
+* \~english Update completion notice\n
+* Command ID that notifies the end of update from update_hal to the user \n
+* When receiving the event of this command,
+* Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
+* \~english @attention Do not send this command from multiple processes or threads at the same time.
+*/
+#define VUP_COMPLETE 204
+
+#define UPDATE_START_TYPE_UPDATE 1 //!< \~english Type of Update
+#define UPDATE_START_TYPE_VERIFY 2 //!< \~english Type of Verification
+
+/* Data format of request to updater to exec update(UpdateService -> updater) */
+// Formate is:
+// num_of_fileset x 1 : UI_32
+// fileset x N : UpdateDataInfo(struct) x N
+#define KWI_MAX_MOD_FPATH 128 //!< \~english Max file path of module in Detailed info
+#define VUP_MAX_KWI_FNAME (KWI_MAX_MOD_FPATH+1) //!< \~english 129 Max size of the string which to save the file path
+#define KWI_SIZE_HASH 32 //!< \~english HashSize length
+#define VUP_MAX_KWI_DETAIL 15 //!< \~english Max file path of Data infos
+
+/**
+* \~english Structure for starts update external update
+*/
+typedef struct _UpdateDataInfo {
+ UI_32 ID; /*!< \~english ID originated by 0(ROOTFS:0, BOOT:1)*/
+ char filename[VUP_MAX_KWI_FNAME]; /*!< \~english source file(device) name(fullpath)*/
+ char srcname[VUP_MAX_KWI_FNAME]; /*!< \~english source file(device) name in diff update(fullpath)*/
+ char destname[VUP_MAX_KWI_FNAME]; /*!< \~english destinamtion file(device) name(fullpath)*/
+ UI_64 offset; /*!< \~english offset of source file*/
+ UI_64 seek; /*!< \~english seek of destination file*/
+ UI_32 size; /*!< \~english size of data*/
+ char src_hash[KWI_SIZE_HASH]; /*!< \~english Original Data Hash(for diff update only)*/
+ char dst_hash[KWI_SIZE_HASH]; /*!< \~english Restored Data Hash*/
+ UI_32 num_of_div; /*!< \~english Num of Detail files*/
+ UI_64 mod_offset; /*!< \~english offset of module in KWI file*/
+ UI_64 div_offset; /*!< \~english offset of divide header in KWI file*/
+} UpdateDataInfo;
+
+/**
+* \~english List of structure for starts update external update
+*/
+typedef struct _UpdateDataInfos {
+ UI_32 units; /*!< \~english Num of Data Info*/
+ UpdateDataInfo info[VUP_MAX_KWI_DETAIL]; /*!< \~english Data Infos*/
+} UpdateDataInfos;
+
+/**
+* \~english Structure for notify update complete
+*/
+typedef union _ResUpdCompletion {
+ // for Normal/SYS Updater
+ struct {
+ UI_32 type; /*!< \~english type*/
+ UI_32 status; /*!< \~english result*/
+ } inner;
+ // for Outer Updater
+ struct {
+ UI_32 status; /*!< \~english result*/
+ UI_32 need_reboot; /*!< \~english Whether it is necessary to reboot system.*/
+ } outer;
+} ResUpdCompletion;
+
+
+/** @}*/ // end of update_hal
+/** @}*/ // end of update_service
+
+#endif // INCLUDE_UPDATE_HAL_H_
diff --git a/video_in_hal/usb_hal/LICENSE b/video_in_hal/usb_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/usb_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/usb_hal/Makefile b/video_in_hal/usb_hal/Makefile
new file mode 100755
index 0000000..1a107ce
--- /dev/null
+++ b/video_in_hal/usb_hal/Makefile
@@ -0,0 +1,66 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libusb_hal.so
+
+HEADER := ./hal_api/usb_hal.h
+
+######### include paths/files ###################
+CXXFLAGS += -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH :=
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+
+######### source files ##########################
+VPATH := src
+OBJS := usb_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
diff --git a/video_in_hal/usb_hal/hal_api/usb_hal.h b/video_in_hal/usb_hal/hal_api/usb_hal.h
new file mode 100755
index 0000000..9f93d9b
--- /dev/null
+++ b/video_in_hal/usb_hal/hal_api/usb_hal.h
@@ -0,0 +1,379 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file usb_hal.h
+ * @brief usb_hal API
+ */
+
+#ifndef HAL_API_USB_HAL_H_
+#define HAL_API_USB_HAL_H_
+
+#include "native_service/frameworkunified_types.h"
+
+/** @addtogroup device_detection_service
+ * @{
+ */
+/** @addtogroup usb_hal
+ * @ingroup device_detection_service
+ * @{
+ */
+
+/**
+ * \~english Definition of Host/Function mode of USB OTG port.
+ */
+enum UsbRoleType {
+ /**
+ * \~english Host mode
+ */
+ USB_ROLE_HOST = 0,
+ /**
+ * \~english Function mode
+ */
+ USB_ROLE_FUNCTION,
+};
+
+/**
+ * \ingroup GetUsbRoleSwitch
+ * \~english @par Brief
+ * Get USB role
+ * \~english @param [out] usb_role
+ * UsbRoleType* - USB role
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - When State value is "status faile", Can not get host/funtcion mode of USB OTG port.
+ * \~english @par Change of internal state
+ * - None.
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusNullPointer
+ * - Internal process error(open/read)
+ * - eFrameworkunifiedStatusFail
+ * - Internal process error(State value is "status faile")
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Get Host/Funtcion mode of USB OTG port.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see SetUsbRoleSwitch
+ */
+EFrameworkunifiedStatus GetUsbRoleSwitch(UsbRoleType* usb_role);
+
+/**
+ * \ingroup SetUsbRoleSwitch
+ * \~english @par Brief
+ * Set USB role.
+ * \~english @param [in] usb_role
+ * UsbRoleType - USB role
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - When State value is "status faile", Can not set host/funtcion mode of USB OTG port.
+ * \~english @par Change of internal state
+ * - Change "USB role is host mode"or"USB role is host mode"
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - Internal process error(open/read/write)
+ * - eFrameworkunifiedStatusFail
+ * - Internal process error(State value is "status faile")
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Set Host/Funtcion mode of USB OTG port.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see GetUsbRoleSwitch
+ */
+EFrameworkunifiedStatus SetUsbRoleSwitch(UsbRoleType usb_role);
+
+/**
+ * \~english USB authentication error information
+ */
+enum UsbAuthenticationError {
+ /**
+ * \~english USB authentication no error
+ */
+ USB_AUTHENTICATION_ERROR_NONE = 0,
+ /**
+ * \~english The connected device has no response
+ */
+ USB_AUTHENTICATION_ERROR_ENUMERATE,
+ /**
+ * \~english The device connected to bus-powered HUB is overcurrent
+ */
+ USB_AUTHENTICATION_ERROR_HUB_OVERCURRENT,
+ /**
+ * \~english HUB tier levels
+ */
+ USB_AUTHENTICATION_ERROR_HUB_TIER_LEVELS,
+ /**
+ * \~english The number of connected devices is more than supported
+ */
+ USB_AUTHENTICATION_ERROR_CONNECTION_EXCESS
+};
+
+/**
+ * \ingroup CheckUsbAuthenticationError
+ * \~english @par Brief
+ * Check USB authentication error
+ * \~english @param [out] usb_auth_error
+ * UsbAuthenticationError* - USB authentication error
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - When State value is "status faile", Can not check USB authentication error .
+ * \~english @par Change of internal state
+ * - None.
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusNullPointer
+ * - Internal process error(open/read)
+ * - eFrameworkunifiedStatusFail
+ * - Internal process error(State value is "status faile")
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Check USB authentication error information.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see None.
+ */
+EFrameworkunifiedStatus CheckUsbAuthenticationError(UsbAuthenticationError* usb_auth_error);
+
+/**
+ * \~english Definition of USB port number.
+ * - The USB port number is defined according to the RefHW,
+ * modification will be necessary if there's any change about USB port.
+ */
+enum UsbPortNumber {
+ /**
+ * \~english USB0(IF-BOX)
+ */
+ USB_PORT_NUMBER_0 = 0,
+ /**
+ * \~english USB1(DCM)
+ */
+ USB_PORT_NUMBER_1,
+ /**
+ * \~english USB2(DSRC/ETC)
+ */
+ USB_PORT_NUMBER_2,
+ /**
+ * \~english USB3(External deck)
+ */
+ USB_PORT_NUMBER_3,
+ /**
+ * \~english USB4(Drive recorder)
+ */
+ USB_PORT_NUMBER_4,
+ /**
+ * \~english Maximum of USB port number.
+ */
+ USB_PORT_NUMBER_MAX
+};
+
+/**
+ * \ingroup ResetUsbVbus
+ * \~english @par Brief
+ * USB VBus Reset.
+ * \~english @param [in] usb_port_no
+ * UsbPortNumber - USB port number
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - When State value is "status faile", Can not USB VBus reset .
+ * \~english @par Change of internal state
+ * - "USB power ON" from the "USB power OFF".
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - Internal process error(open/read/write)
+ * - eFrameworkunifiedStatusFail
+ * - Internal process error(State value is "status faile")
+ * - eFrameworkunifiedStatusFail
+ * - Not change internal state.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - USB VBus Reset.
+ * - The API is a block I/F which costs a while due to the sleep time between power off and power on.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see IsUsbPortPowered, PowerOnUsbPort, PowerOffUsbPort
+ */
+EFrameworkunifiedStatus ResetUsbVbus(UsbPortNumber usb_port_no);
+
+/**
+ * \ingroup IsUsbPortPowered
+ * \~english @par Brief
+ * Check the power state of USB port.
+ * \~english @param [in] usb_port_no
+ * UsbPortNumber - USB port number
+ * \~english @param [out] is_powered
+ * bool*\n
+ * - true : Power is on
+ * - false : Power is off
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - None.
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - eFrameworkunifiedStatusNullPointer
+ * - Internal process error(open/read)
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Check the power state of USB port.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see ResetUsbVbus, PowerOnUsbPort, PowerOffUsbPort
+ */
+EFrameworkunifiedStatus IsUsbPortPowered(UsbPortNumber usb_port_no, bool* is_powered);
+
+/**
+ * \ingroup PowerOnUsbPort
+ * \~english @par Brief
+ * Power on USB port.
+ * \~english @param [in] usb_port_no
+ * UsbPortNumber - USB port number
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - When State value is "status faile", Can not power on USB port.
+ * \~english @par Change of internal state
+ * - Change state "USB power on"
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - Internal process error(open/read/write)
+ * - eFrameworkunifiedStatusFail
+ * - Internal process error(State value is "status faile")
+ * - eFrameworkunifiedStatusFail
+ * - Not change internal state.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Power on USB port.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see ResetUsbVbus, IsUsbPortPowered, PowerOffUsbPort
+ */
+EFrameworkunifiedStatus PowerOnUsbPort(UsbPortNumber usb_port_no);
+
+/**
+ * \ingroup PowerOffUsbPort
+ * \~english @par Brief
+ * Power off USB port.
+ * \~english @param [in] usb_port_no
+ * UsbPortNumber - USB port number
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - Change state "USB power off"
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - Internal process error(open/read/write)
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Power off USB port.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see ResetUsbVbus, IsUsbPortPowered, PowerOnUsbPort
+ */
+EFrameworkunifiedStatus PowerOffUsbPort(UsbPortNumber usb_port_no);
+
+/**
+ * \~english USB abnormal status
+ */
+enum UsbAbnormalStatus {
+ /**
+ * \~english USB is not abnormal
+ */
+ USB_ABNORMAL_STATUS_NONE = 0,
+ /**
+ * \~english USB is overcurrent
+ */
+ USB_ABNORMAL_STATUS_OVERCURRENT
+};
+
+/**
+ * \ingroup CheckUsbAbnormalStatus
+ * \~english @par Brief
+ * Check the abnormal status of USB port
+ * \~english @param [in] usb_port_no
+ * UsbPortNumber - USB port number
+ * \~english @param [out] usb_abnormal_status
+ * UsbAbnormalStatus* - USB abnormal status
+ * \~english @retval eFrameworkunifiedStatusOK OK
+ * \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
+ * \~english @retval eFrameworkunifiedStatusNullPointer NULL Pointer
+ * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
+ * \~english @par Prerequisite
+ * - None.
+ * \~english @par Change of internal state
+ * - change state "usb port status faile" or "usb port status ok".
+ * \~english @par Conditions of processing failure
+ * - Input parameter error
+ * - eFrameworkunifiedStatusInvldParam
+ * - eFrameworkunifiedStatusNullPointer
+ * - Internal process error(open/read)
+ * - eFrameworkunifiedStatusFail
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Check the abnormal status of USB port, including overcurrent and so on.
+ * - The API can not be used by multiple processes, threads at the same time.
+ * \~english @see None.
+ */
+EFrameworkunifiedStatus CheckUsbAbnormalStatus(UsbPortNumber usb_port_no, UsbAbnormalStatus* usb_abnormal_status);
+
+/** @}*/ // end of usb_hal
+/** @}*/ // end of device_detection_service
+
+#endif // HAL_API_USB_HAL_H_
diff --git a/video_in_hal/usb_hal/inc/usb_hal_debug.h b/video_in_hal/usb_hal/inc/usb_hal_debug.h
new file mode 100755
index 0000000..15b307a
--- /dev/null
+++ b/video_in_hal/usb_hal/inc/usb_hal_debug.h
@@ -0,0 +1,31 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_USB_HAL_DEBUG_H_
+#define INC_USB_HAL_DEBUG_H_
+
+#include "usb_hal_usbhallog.h"
+
+/* Log output control flag */
+#define USB_LOG_ENABLE_ERROR /* Error log */
+
+#ifdef USB_LOG_ENABLE_ERROR
+#define USB_ERROR_LOG(fmt, ...) FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, fmt, ##__VA_ARGS__)
+#else
+#define USB_ERROR_LOG(fmt, ...)
+#endif
+
+#endif // INC_USB_HAL_DEBUG_H_
diff --git a/video_in_hal/usb_hal/inc/usb_hal_internal.h b/video_in_hal/usb_hal/inc/usb_hal_internal.h
new file mode 100755
index 0000000..86c3905
--- /dev/null
+++ b/video_in_hal/usb_hal/inc/usb_hal_internal.h
@@ -0,0 +1,165 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_USB_HAL_INTERNAL_H_
+#define INC_USB_HAL_INTERNAL_H_
+
+#define FILE_CONTENT_LENGTH (32)
+#define FILE_PATH_LENGTH (128)
+
+/**
+ * USB role file
+ */
+#define USB_ROLE_FILE "/sys/devices/platform/soc/ee080200.usb-phy/role"
+
+/**
+ * USB host value
+ */
+#define USB_HOST_STRING "host\n"
+
+/**
+ * USB function value
+ */
+#define USB_FUNCTION_STRING "peripheral\n"
+
+/**
+ * gpio high value
+ */
+const char kUsbGpioHighValue = '1';
+
+/**
+ * gpio low value
+ */
+const char kUsbGpioLowValue = '0';
+
+/**
+ * gpio export file
+ */
+const char kUsbGpioExportFile[] = "/sys/class/gpio/export";
+
+/**
+ * gpio file prefix
+ */
+const char kUsbGpioFilePrefix[] = "/sys/class/gpio/gpio";
+
+/**
+ * gpio direction file
+ */
+const char kUsbGpioDirectionFile[] = "/direction";
+
+/**
+ * gpio direction in
+ */
+const char kUsbGpioDirectionIn[] = "in";
+
+/**
+ * gpio direction out high
+ */
+const char kUsbGpioDirectionHigh[] = "high";
+
+/**
+ * gpio direction out low
+ */
+const char kUsbGpioDirectionLow[] = "low";
+
+/**
+ * gpio value file
+ */
+const char kUsbGpioValueFile[] = "/value";
+
+/**
+ * structure of USB role switch information
+ */
+struct UsbRoleSwitchInfo {
+ const char* file_path; //!< USB role switch file path
+ const char* usb_host_value; //!< USB host value
+ const char* usb_function_value; //!< USB function value
+};
+
+/**
+ * USB gpio port definition
+ */
+enum UsbGpioPort {
+ USB_GPIO_PORT_USB0_PWEN = 0, //!< USB0 power enable
+ USB_GPIO_PORT_USB1_PWEN, //!< USB1 power enable
+ USB_GPIO_PORT_USB2_PWEN, //!< USB2 power enable
+ USB_GPIO_PORT_USB0_OVC, //!< USB0 overcurrent
+ USB_GPIO_PORT_USB1_OVC, //!< USB1 overcurrent
+ USB_GPIO_PORT_USB2_OVC, //!< USB2 overcurrent
+ USB_GPIO_PORT_MAX
+};
+
+/**
+ * USB gpio port value definition
+ */
+enum GpioPortValue {
+ GPIO_PORT_OFF = 0, //!< gpio port on
+ GPIO_PORT_ON //!< gpio port off
+};
+
+/**
+ * Length for USB gpio port name
+ */
+#define USB_PORT_NAME_LENGTH (8)
+
+/**
+ * USB gpio port information
+ */
+struct UsbGpioPortInfo {
+ bool active_low; //!< active low or high
+ bool is_output; //!< direction output or input
+ const char* port_name; //!< gpio port name
+ char default_value; //!< output port default value (high or low)
+};
+
+/**
+ * USB gpio port config table
+ */
+const char kUsbGpioPortNameUsb0Pwen[] = "375";
+const char kUsbGpioPortNameUsb1Pwen[] = "387";
+const char kUsbGpioPortNameUsb2Pwen[] = "389";
+const char kUsbGpioPortNameUsb0Ovc[] = "376";
+const char kUsbGpioPortNameUsb1Ovc[] = "388";
+const char kUsbGpioPortNameUsb2Ovc[] = "390";
+
+const UsbGpioPortInfo kUsbGpioInfo[] = {
+ { false, true, kUsbGpioPortNameUsb0Pwen, kUsbGpioHighValue },
+ { false, true, kUsbGpioPortNameUsb1Pwen, kUsbGpioHighValue },
+ { false, true, kUsbGpioPortNameUsb2Pwen, kUsbGpioHighValue },
+ { false, false, kUsbGpioPortNameUsb0Ovc, kUsbGpioLowValue },
+ { false, false, kUsbGpioPortNameUsb1Ovc, kUsbGpioLowValue },
+ { false, false, kUsbGpioPortNameUsb2Ovc, kUsbGpioLowValue }
+};
+
+/**
+ * gpio port list of USB power enable
+ */
+const UsbGpioPort kUsbPowerEnableGpio[] = {
+ USB_GPIO_PORT_USB0_PWEN,
+ USB_GPIO_PORT_USB1_PWEN,
+ USB_GPIO_PORT_USB2_PWEN
+};
+
+/**
+ * gpio port list of USB overcurrent
+ */
+const UsbGpioPort kUsbOvercurrentGpio[] = {
+ USB_GPIO_PORT_USB0_OVC,
+ USB_GPIO_PORT_USB1_OVC,
+ USB_GPIO_PORT_USB2_OVC
+};
+
+#endif // INC_USB_HAL_INTERNAL_H_
diff --git a/video_in_hal/usb_hal/inc/usb_hal_usbhallog.h b/video_in_hal/usb_hal/inc/usb_hal_usbhallog.h
new file mode 100755
index 0000000..53c0a6b
--- /dev/null
+++ b/video_in_hal/usb_hal/inc/usb_hal_usbhallog.h
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_USB_HAL_USBHALLOG_H_
+#define INC_USB_HAL_USBHALLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_USB_HAL_USBHALLOG_H_
diff --git a/video_in_hal/usb_hal/src/usb_hal.cpp b/video_in_hal/usb_hal/src/usb_hal.cpp
new file mode 100755
index 0000000..7e09ad4
--- /dev/null
+++ b/video_in_hal/usb_hal/src/usb_hal.cpp
@@ -0,0 +1,500 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Information.
+ * This source code is a sample source code .
+ * Implementation of the function must be performed by the vendor.
+ */
+
+#include "usb_hal.h"
+#include "usb_hal_internal.h"
+#include "usb_hal_debug.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
+
+/**
+ * USB role switch information table
+ */
+const UsbRoleSwitchInfo kUsbRoleSwitchTable = {USB_ROLE_FILE, USB_HOST_STRING, USB_FUNCTION_STRING};
+
+/**
+ * Read content of USB role switch file, then determine HOST/FUNCTION role
+ * according to the specified HOST/FUNCTION value.
+ */
+static EFrameworkunifiedStatus GetUsbRoleType(const char* file_path, const char* usb_host_value, const char* usb_function_value,
+ UsbRoleType* usb_role) {
+ if (!file_path || !usb_host_value || !usb_function_value || !usb_role) {
+ USB_ERROR_LOG("parameter is NULL.");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // 1. open role switch file
+ int fd = open(file_path, O_RDONLY);
+ if (-1 == fd) {
+ USB_ERROR_LOG("open [%s] failed.(%d, %s)", file_path, errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // 2. read file content
+ char file_content[FILE_CONTENT_LENGTH];
+ memset(file_content, 0, sizeof(file_content));
+ ssize_t ret = read(fd, file_content, sizeof(file_content) - 1);
+ int read_error = errno;
+
+ // 3. close file
+ close(fd);
+
+ if (-1 == ret) {
+ USB_ERROR_LOG("read failed.(%d, %s)", read_error, strerror(read_error));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // 4. compare file content to HOST/FUNCTION value
+ if (!strcmp(usb_host_value, file_content)) {
+ *usb_role = USB_ROLE_HOST;
+ } else if (!strcmp(usb_function_value, file_content)) {
+ *usb_role = USB_ROLE_FUNCTION;
+ } else {
+ USB_ERROR_LOG("content error.[%s]", file_content);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Write the specified role value to USB role switch file.
+ */
+static EFrameworkunifiedStatus SetUsbRoleValue(const char* file_path, const char* role_value) {
+ if (!file_path || !role_value) {
+ USB_ERROR_LOG("parameter is NULL.");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // 1. open role switch file
+ int fd = open(file_path, O_WRONLY | O_TRUNC);
+ if (-1 == fd) {
+ USB_ERROR_LOG("open [%s] failed.(%d, %s)", file_path, errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // 2. write role file
+ ssize_t ret = write(fd, role_value, strlen(role_value));
+ int write_error = errno;
+
+ // 3. close file
+ close(fd);
+
+ // 4. check write result
+ if (static_cast<ssize_t>(strlen(role_value)) != ret) {
+ USB_ERROR_LOG("write [%s] failed, ret=%zd.(%d, %s)", role_value, ret, write_error, strerror(write_error));
+ return eFrameworkunifiedStatusFail;
+ } else {
+ return eFrameworkunifiedStatusOK;
+ }
+}
+
+/**
+ * Check whether the specified USB port supports power control.
+ */
+static bool CheckSupportPowerControl(UsbPortNumber usb_port_no) {
+ if (USB_PORT_NUMBER_MAX <= usb_port_no) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Check whether the specified gpio port is available.
+ */
+static bool CheckGpioPortAvailable(UsbGpioPort gpio_port) {
+ if (USB_GPIO_PORT_MAX <= gpio_port) {
+ USB_ERROR_LOG("port %d is invalid.", gpio_port);
+ return false;
+ }
+
+ if (!kUsbGpioInfo[gpio_port].port_name || (0 == strlen(kUsbGpioInfo[gpio_port].port_name))) {
+ USB_ERROR_LOG("port %d is not available.", gpio_port);
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Open gpio export file.
+ */
+static int OpenExportFile() {
+ return open(kUsbGpioExportFile, O_WRONLY);
+}
+
+/**
+ * Open the direction file of the specified gpio port.
+ */
+static int OpenDirectionFile(const char* port_name) {
+ if (!port_name || (0 == strlen(port_name))) {
+ USB_ERROR_LOG("port name is invalid.");
+ return -1;
+ }
+
+ char dir_file[FILE_PATH_LENGTH];
+ // /sys/class/gpio/gpio123/direction
+ snprintf(dir_file, sizeof(dir_file), "%s%s%s", kUsbGpioFilePrefix, port_name, kUsbGpioDirectionFile);
+ return open(dir_file, O_RDWR);
+}
+
+/**
+ * Open the value file of the specified gpio port.
+ */
+static int OpenValueFile(const char* port_name, bool ro) {
+ if (!port_name || (0 == strlen(port_name))) {
+ USB_ERROR_LOG("port name is invalid.");
+ return -1;
+ }
+
+ char value_file[FILE_PATH_LENGTH];
+ // /sys/class/gpio/gpio123/value
+ snprintf(value_file, sizeof(value_file), "%s%s%s", kUsbGpioFilePrefix, port_name, kUsbGpioValueFile);
+ return open(value_file, ro ? O_RDONLY : O_RDWR);
+}
+
+/**
+ * Initialize gpio port value.
+ */
+static EFrameworkunifiedStatus InitializeGpioPort(UsbGpioPort gpio_port) {
+ if (!CheckGpioPortAvailable(gpio_port)) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ char port_file[FILE_PATH_LENGTH];
+ snprintf(port_file, sizeof(port_file), "%s%s", kUsbGpioFilePrefix, kUsbGpioInfo[gpio_port].port_name);
+
+ // check if port is exported already
+ if (0 == access(port_file, F_OK)) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ // open the export file
+ int export_fd = OpenExportFile();
+ if (-1 == export_fd) {
+ USB_ERROR_LOG("open [%s] failed.(%d, %s)", "export", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // do export by writing the export file
+ ssize_t ret = write(export_fd, kUsbGpioInfo[gpio_port].port_name, strlen(kUsbGpioInfo[gpio_port].port_name));
+ int write_error = errno;
+
+ // close the export file
+ close(export_fd);
+
+ // check write result
+ if (static_cast<ssize_t>(strlen(kUsbGpioInfo[gpio_port].port_name)) != ret) {
+ USB_ERROR_LOG("write [%s] failed, ret=%zd.(%d, %s)", kUsbGpioInfo[gpio_port].port_name, ret, write_error,
+ strerror(write_error));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // open the direction file
+ int direction_fd = OpenDirectionFile(kUsbGpioInfo[gpio_port].port_name);
+ if (-1 == direction_fd) {
+ USB_ERROR_LOG("open direction file failed.(%d, %s)", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // set direction
+ const char* direction_value;
+ if (!kUsbGpioInfo[gpio_port].is_output) {
+ // for input port, set direction as "in"
+ direction_value = kUsbGpioDirectionIn;
+ } else {
+ if (kUsbGpioHighValue == kUsbGpioInfo[gpio_port].default_value) {
+ // for output port, if default value is high, set direction as "high"
+ direction_value = kUsbGpioDirectionHigh;
+ } else if (kUsbGpioLowValue == kUsbGpioInfo[gpio_port].default_value) {
+ // for output port, if default value is low, set direction as "low"
+ direction_value = kUsbGpioDirectionLow;
+ } else {
+ USB_ERROR_LOG("unknown default value[%c]", kUsbGpioInfo[gpio_port].default_value);
+ return eFrameworkunifiedStatusFail;
+ }
+ }
+
+ ret = write(direction_fd, direction_value, strlen(direction_value));
+ write_error = errno;
+ close(direction_fd);
+ if (static_cast<ssize_t>(strlen(direction_value)) != ret) {
+ USB_ERROR_LOG("write direction %s failed, ret=%zd.(%d, %s)", direction_value, ret, write_error,
+ strerror(write_error));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Get gpio port value.
+ */
+static EFrameworkunifiedStatus GetGpioPortValue(UsbGpioPort port_name, bool* port_value) {
+ if ((USB_GPIO_PORT_MAX <= port_name) || !port_value) {
+ USB_ERROR_LOG("parameter is invalid.");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // initialize gpio port
+ EFrameworkunifiedStatus result = InitializeGpioPort(port_name);
+ if (eFrameworkunifiedStatusOK != result) {
+ return result;
+ }
+
+ // open port value file
+ int fd = OpenValueFile(kUsbGpioInfo[port_name].port_name, true);
+ if (-1 == fd) {
+ USB_ERROR_LOG("open value file failed.(%d, %s)", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // read file content
+ char file_content = '\0';
+ ssize_t ret = read(fd, &file_content, sizeof(file_content));
+ int read_error = errno;
+
+ // close file
+ close(fd);
+
+ if (sizeof(file_content) != ret) {
+ USB_ERROR_LOG("read failed.(%d, %s)", read_error, strerror(read_error));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // compare file content to high/low value
+ if (kUsbGpioHighValue == file_content) {
+ *port_value = (kUsbGpioInfo[port_name].active_low ? false : true);
+ } else if (kUsbGpioLowValue == file_content) {
+ *port_value = (kUsbGpioInfo[port_name].active_low ? true : false);
+ } else {
+ USB_ERROR_LOG("content error.[%c]", file_content);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * Set gpio port value.
+ */
+static EFrameworkunifiedStatus SetGpioPortValue(UsbGpioPort port_name, GpioPortValue port_value) {
+ if (USB_GPIO_PORT_MAX <= port_name) {
+ USB_ERROR_LOG("parameter is invalid.");
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // initialize gpio port
+ EFrameworkunifiedStatus result = InitializeGpioPort(port_name);
+ if (eFrameworkunifiedStatusOK != result) {
+ return result;
+ }
+
+ // check direction is output
+ if (!kUsbGpioInfo[port_name].is_output) {
+ USB_ERROR_LOG("%d not an output port.", port_name);
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // open port value file
+ int fd = OpenValueFile(kUsbGpioInfo[port_name].port_name, false);
+ if (-1 == fd) {
+ USB_ERROR_LOG("open value file failed.(%d, %s)", errno, strerror(errno));
+ return eFrameworkunifiedStatusFail;
+ }
+
+ // write value
+ bool port_active = (GPIO_PORT_ON == port_value ? true : false);
+ bool write_low = (kUsbGpioInfo[port_name].active_low ? port_active : !port_active);
+ char write_value = (write_low ? kUsbGpioLowValue : kUsbGpioHighValue);
+ ssize_t ret = write(fd, &write_value, sizeof(write_value));
+ int write_error = errno;
+
+ // close file
+ close(fd);
+
+ // check write result
+ if (sizeof(write_value) != ret) {
+ USB_ERROR_LOG("write [%c] failed, ret=%zd.(%d, %s)", write_value, ret, write_error, strerror(write_error));
+ return eFrameworkunifiedStatusFail;
+ } else {
+ return eFrameworkunifiedStatusOK;
+ }
+}
+
+/**
+ * Check overcurrent.
+ */
+static EFrameworkunifiedStatus CheckUsbOvercurrent(UsbPortNumber usb_port_no, bool* is_ovc) {
+ if ((USB_PORT_NUMBER_MAX <= usb_port_no) || !is_ovc) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ return GetGpioPortValue(kUsbOvercurrentGpio[usb_port_no], is_ovc);
+}
+
+EFrameworkunifiedStatus GetUsbRoleSwitch(UsbRoleType* usb_role) {
+ // check NULL pointer
+ if (!usb_role) {
+ USB_ERROR_LOG("parameter is NULL.");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ return GetUsbRoleType(kUsbRoleSwitchTable.file_path, kUsbRoleSwitchTable.usb_host_value,
+ kUsbRoleSwitchTable.usb_function_value, usb_role);
+}
+
+EFrameworkunifiedStatus SetUsbRoleSwitch(UsbRoleType usb_role) {
+ if ((USB_ROLE_HOST != usb_role) && (USB_ROLE_FUNCTION != usb_role)) {
+ USB_ERROR_LOG("parameter error.[%d]", usb_role);
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ // check current usb role:
+ // allow to switch only when usb_role is different from current usb role.
+ UsbRoleType current_role;
+ if (eFrameworkunifiedStatusOK != GetUsbRoleSwitch(&current_role)) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (current_role == usb_role) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ // check usb role type
+ // - HOST: write HOST value to role file
+ // - FUNCTION: write FUNCTION value to role file
+ return SetUsbRoleValue(kUsbRoleSwitchTable.file_path, (USB_ROLE_HOST == usb_role)
+ ? kUsbRoleSwitchTable.usb_host_value
+ : kUsbRoleSwitchTable.usb_function_value);
+}
+
+EFrameworkunifiedStatus CheckUsbAuthenticationError(UsbAuthenticationError* usb_auth_error) {
+ // check NULL pointer
+ if (!usb_auth_error) {
+ USB_ERROR_LOG("parameter is NULL.");
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ // Empty Stub implementations
+ *usb_auth_error = USB_AUTHENTICATION_ERROR_NONE;
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus ResetUsbVbus(UsbPortNumber usb_port_no) {
+ // check support power control
+ if (!CheckSupportPowerControl(usb_port_no)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ // step 1: power off USB port
+ EFrameworkunifiedStatus result = SetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], GPIO_PORT_OFF);
+ if (eFrameworkunifiedStatusOK != result) {
+ USB_ERROR_LOG("power off USB%d failed.", usb_port_no);
+ return result;
+ }
+
+ // step 2: sleep 1.1 sec
+ usleep(1100 * 1000);
+
+ // step 3: power on USB port
+ result = SetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], GPIO_PORT_ON);
+ if (eFrameworkunifiedStatusOK != result) {
+ USB_ERROR_LOG("power on USB%d failed.", usb_port_no);
+ }
+ return result;
+}
+
+EFrameworkunifiedStatus IsUsbPortPowered(UsbPortNumber usb_port_no, bool* is_powered) {
+ if (!is_powered) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ // check support power control
+ if (!CheckSupportPowerControl(usb_port_no)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ return GetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], is_powered);
+}
+
+EFrameworkunifiedStatus PowerOnUsbPort(UsbPortNumber usb_port_no) {
+ // check support power control
+ if (!CheckSupportPowerControl(usb_port_no)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ bool current_power = false;
+ if (eFrameworkunifiedStatusOK != GetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], &current_power)) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (current_power) {
+ return eFrameworkunifiedStatusOK;
+ }
+ return SetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], GPIO_PORT_ON);
+}
+
+EFrameworkunifiedStatus PowerOffUsbPort(UsbPortNumber usb_port_no) {
+ // check support power control
+ if (!CheckSupportPowerControl(usb_port_no)) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+ bool current_power = false;
+ if (eFrameworkunifiedStatusOK != GetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], &current_power)) {
+ return eFrameworkunifiedStatusFail;
+ }
+
+ if (!current_power) {
+ return eFrameworkunifiedStatusOK;
+ }
+
+ return SetGpioPortValue(kUsbPowerEnableGpio[usb_port_no], GPIO_PORT_OFF);
+}
+
+EFrameworkunifiedStatus CheckUsbAbnormalStatus(UsbPortNumber usb_port_no, UsbAbnormalStatus* usb_abnormal_status) {
+ if (USB_PORT_NUMBER_MAX <= usb_port_no) {
+ return eFrameworkunifiedStatusInvldParam;
+ }
+
+ // check NULL pointer
+ if (!usb_abnormal_status) {
+ return eFrameworkunifiedStatusNullPointer;
+ }
+
+ // check overcurrent
+ bool is_ovc = false;
+ EFrameworkunifiedStatus result = CheckUsbOvercurrent(usb_port_no, &is_ovc);
+ if (eFrameworkunifiedStatusOK == result) {
+ if (is_ovc) {
+ *usb_abnormal_status = USB_ABNORMAL_STATUS_OVERCURRENT;
+ } else {
+ *usb_abnormal_status = USB_ABNORMAL_STATUS_NONE;
+ }
+ }
+ return result;
+}
diff --git a/video_in_hal/vehicle_hal/LICENSE b/video_in_hal/vehicle_hal/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/vehicle_hal/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/vehicle_hal/Makefile b/video_in_hal/vehicle_hal/Makefile
new file mode 100755
index 0000000..d009b13
--- /dev/null
+++ b/video_in_hal/vehicle_hal/Makefile
@@ -0,0 +1,69 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program/file ################
+TARGET := libvehicle_hal.so
+
+HEADER := hal_api/vehicle_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+
+######### link options ##########################
+LDFLAGS += -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+RPATH := /usr/lib
+
+######### linked library ########################
+LIBS += -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lpthread
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+#LIBS += -Wl,-Bdynamic -lcarsignal_mng
+
+######### source files ##########################
+VPATH := src
+OBJS := vehicle_hal.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-rpath=:$(RPATH) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
+
diff --git a/video_in_hal/vehicle_hal/README.md b/video_in_hal/vehicle_hal/README.md
new file mode 100755
index 0000000..6636a4f
--- /dev/null
+++ b/video_in_hal/vehicle_hal/README.md
@@ -0,0 +1,3 @@
+vehicle_hal library
+==================
+Vehicle HAL implementation library for AGL Reference Board.
diff --git a/video_in_hal/vehicle_hal/hal_api/vehicle_hal.h b/video_in_hal/vehicle_hal/hal_api/vehicle_hal.h
new file mode 100755
index 0000000..4e6cc89
--- /dev/null
+++ b/video_in_hal/vehicle_hal/hal_api/vehicle_hal.h
@@ -0,0 +1,210 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HAL_API_VEHICLE_HAL_H_
+#define HAL_API_VEHICLE_HAL_H_
+/**
+ * @file vehicle_hal.h
+ */
+
+/** @addtogroup vehicle
+ * @{
+ */
+/** @addtogroup vehicle_hal
+ * @ingroup vehicle
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+
+/**
+ * \~english Name of the send thread
+ */
+#define TN_LINE_SENS_READ "Vehicle Hal"
+
+/**
+ * @enum LineSensReadInternalServiceProtocol
+ * \~english Command ID used by Vehicle_hal to send the vehicle signal input from the jicage line to the user \n
+ To receive events with this command ID, use the interface defined in framework_unified as follows
+ * @code
+ * ret_status = FrameworkunifiedAttachCallbackToDispatcher(h_app, TN_LINE_SENS_READ, CID_VEHICLEHAL_LINESENS, CbCallbackFunc);
+ * @endcode
+ */
+enum LineSensReadInternalServiceProtocol {
+ CID_VEHICLEHAL_LINESENS = 0x00000101, //!< \~english LineSens Message Command ID
+ CID_VEHICLEHAL_SPDPULSE = 0x00000102, //!< \~english SpeedPulse Message Command ID
+ CID_VEHICLEHAL_SPD = 0x00000103, //!< \~english Speed Message Command ID
+ CID_VEHICLEHAL_LINESENS_POL = 0x00000104,
+ //!< \~english voltage and RHEOSTAT Message Command ID
+};
+
+/**
+ * @enum VehiclehalLinesenskindMicBit
+ * \~english MIC BIT
+ */
+enum VehiclehalLinesenskindMicBit {
+ VEHICLEHAL_LINESENSKIND_MIC_BIT_MIC = 0x01, //!< \~english MIC
+ VEHICLEHAL_LINESENSKIND_MIC_BIT_ANALOGMIC1 = 0x02, //!< \~english ANALOGMIC1
+ VEHICLEHAL_LINESENSKIND_MIC_BIT_ANALOGMIC2 = 0x04, //!< \~english ANALOGMIC2
+};
+
+/**
+ * @enum VehiclehalLinesenskindMic2Bit
+ * \~english MIC2 BIT
+ */
+enum VehiclehalLinesenskindMic2Bit {
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_A2BHUB = 0x01, //!< \~english A2BHUB
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC1 = 0x02, //!< \~english MULTIMIC1
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC2 = 0x04, //!< \~english MULTIMIC2
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC3 = 0x08, //!< \~english MULTIMIC3
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC4 = 0x10, //!< \~english MULTIMIC4
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC5 = 0x20, //!< \~english MULTIMIC5
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_MULTIMIC6 = 0x40, //!< \~english MULTIMIC6
+ VEHICLEHAL_LINESENSKIND_MIC2_BIT_ANC = 0x80, //!< \~english ANC
+};
+
+/**
+ * @enum VehicleHalLineSensKind
+ * \~english Line Sensor kind
+ */
+enum VehicleHalLineSensKind {
+ VEHICLEHAL_LINESENSKIND_IG = 0, //!< \~english IG
+ VEHICLEHAL_LINESENSKIND_PKB, //!< \~english PKB
+ VEHICLEHAL_LINESENSKIND_REV, //!< \~english REV
+ VEHICLEHAL_LINESENSKIND_ILL, //!< \~english ILL
+ VEHICLEHAL_LINESENSKIND_LOWVOLTAGE, //!< \~english LOWVOLTAGE
+ VEHICLEHAL_LINESENSKIND_ADIM, //!< \~english ADIM
+ VEHICLEHAL_LINESENSKIND_MIC, //!< \~english MIC,ANALOGMIC1,ANALOGMIC2
+ VEHICLEHAL_LINESENSKIND_USBPOWERSUPPLY, //!< \~english USB Power Supply[10mA]
+ VEHICLEHAL_LINESENSKIND_MIC2, //!< \~english A2BHUB,MULTIMIC1 to 6,ANC
+ VEHICLEHAL_LINESENSKIND_NUM, //!< \~english MAX Number
+};
+
+/**
+ * @enum VEHICLEHAL_RET_TYPE
+ * \~english The return value of vehicle_hal API
+ */
+typedef enum {
+ /**
+ * \~english Success
+ */
+ VEHICLEHAL_RET_SUCCESS = 0,
+ /**
+ * \~english Car Signal Ctrl Api Initialize failed
+ */
+ VEHICLEHAL_RET_ERR_HARDINIT,
+ /**
+ * \~english McSend Open failed
+ */
+ VEHICLEHAL_RET_ERR_MCOPEN,
+ /**
+ * \~english Create Thread failed
+ */
+ VEHICLEHAL_RET_ERR_THREADSTART,
+ /**
+ * \~english Invalid paramter
+ */
+ VEHICLEHAL_RET_ERR_PARAM,
+}VEHICLEHAL_RET_TYPE;
+
+/**
+ * @struct VehicleHalSpeedPulse
+ * \~english Struct of SpeedPulse
+ */
+struct VehicleHalSpeedPulse {
+ float pulse; //!< \~english speed pulse[Hz]
+ float period; //!< \~english pulse period[ms]
+};
+
+/**
+ * @struct VehicleHalLineSensMsg
+ * \~english Struct of Meassage
+ */
+struct VehicleHalLineSensMsg {
+ uint8_t stdata[VEHICLEHAL_LINESENSKIND_NUM]; //!< \~english line data
+};
+
+/**
+ * @struct VehicleHalPol
+ * \~english Struct of VehicleHalPolling
+ */
+struct VehicleHalPol {
+ uint8_t vb; //!< \~english voltage [10 * v]
+ uint8_t rheostat; //!< \~english RHEOSTAT [10 * v]
+};
+
+/**
+ * \ingroup VehicleHalStart
+ * \~english @par Brief
+ * API to start the vehicle_hal
+ * \~english @param [in] happ
+ * HANDLE - Handle for Application
+ * \~english @retval VEHICLEHAL_RET_SUCCESS : Success
+ * \~english @retval VEHICLEHAL_RET_ERR_HARDINIT : Car Signal Ctrl Api Initialize failed
+ * \~english @retval VEHICLEHAL_RET_ERR_MCOPEN : McSend Open failed
+ * \~english @retval VEHICLEHAL_RET_ERR_THREADSTART : Create Thread failed
+ * \~english @retval VEHICLEHAL_RET_ERR_PARAM : Invalid paramter
+ * \~english @par Prerequisite
+ * None
+ * \~english @par Change of internal state
+ * - If start successfully, vehicle_hal changes from stop to start.
+ * - If start failed, the state of the vehicle_hal remains no change.
+ * \~english @par Conditions of processing failure
+ * - Car Signal Ctrl Api Initialize failed.
+ * - McSend Open failed.
+ * - Create Thread failed.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Start the vehicle_hal service.
+ * - The API can only be used by 1 process.
+ * \~english @see
+ * None
+ */
+VEHICLEHAL_RET_TYPE VehicleHalStart(HANDLE happ);
+
+/**
+ * \ingroup VehicleHalStop
+ * \~english @par Brief
+ * API to stop the vehicle_hal
+ * \~english @param [in] happ
+ * HANDLE - Handle for Application
+ * \~english @retval VEHICLEHAL_RET_SUCCESS : Success
+ * \~english @retval VEHICLEHAL_RET_ERR_PARAM : Invalid paramter
+ * \~english @par Prerequisite
+ * vehicle_hal start successfully.
+ * \~english @par Change of internal state
+ * - If start successfully, vehicle_hal changes from start to stop.
+ * - If start failed, the state of the vehicle_hal remains no change.
+ * \~english @par Conditions of processing failure
+ * None.
+ * \~english @par Classification
+ * Public
+ * \~english @par Type
+ * Sync
+ * \~english @par Detail
+ * - Stop the vehicle_hal service.
+ * - The API can only be used by 1 process.
+ * \~english @see
+ * None
+ */
+VEHICLEHAL_RET_TYPE VehicleHalStop(HANDLE happ);
+
+/** @}*/ //!< end of vehicle_hal
+/** @}*/ //!< end of vehicle
+#endif // HAL_API_VEHICLE_HAL_H_
diff --git a/video_in_hal/vehicle_hal/inc/vehicle_hal_frameworkunifiedlog.h b/video_in_hal/vehicle_hal/inc/vehicle_hal_frameworkunifiedlog.h
new file mode 100755
index 0000000..2cee8eb
--- /dev/null
+++ b/video_in_hal/vehicle_hal/inc/vehicle_hal_frameworkunifiedlog.h
@@ -0,0 +1,78 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INC_VEHICLE_HAL_FRAMEWORKUNIFIEDLOG_H_
+#define INC_VEHICLE_HAL_FRAMEWORKUNIFIEDLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_VEHICLE_HAL_FRAMEWORKUNIFIEDLOG_H_
+
diff --git a/video_in_hal/vehicle_hal/src/vehicle_hal.cpp b/video_in_hal/vehicle_hal/src/vehicle_hal.cpp
new file mode 100755
index 0000000..258c51a
--- /dev/null
+++ b/video_in_hal/vehicle_hal/src/vehicle_hal.cpp
@@ -0,0 +1,398 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <agl_thread.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include "vehicle_hal_frameworkunifiedlog.h"
+
+extern "C" {
+// #include "carsignal_mng_api.h"
+}
+
+#include "vehicle_hal.h"
+
+/**
+* \~english environment variable define
+*/
+#define VEHICLEHAL_LINESENSKIND_ADIM_DATA "VEHICLEHAL_LINESENSKIND_ADIM"
+/**
+* \~english environment variable define
+*/
+#define VEHICLEHAL_LINESENSKIND_MIC_DATA "VEHICLEHAL_LINESENSKIND_MIC"
+/**
+* \~english environment variable define
+*/
+#define VEHICLEHAL_LINESENSKIND_VB_DATA "VEHICLEHAL_LINESENSKIND_VB"
+/**
+* \~english environment variable define
+*/
+#define VEHICLEHAL_LINESENSKIND_RHEOSTAT_DATA "VEHICLEHAL_LINESENSKIND_RHEOSTAT"
+
+#define VEHICLEHAL_LOWVB_VALUE 75
+
+// send message flag
+static HANDLE g_sendmsg_handle = NULL;
+
+// work thread exit flag
+static BOOL g_loopendflag = FALSE;
+
+// polling thread exit flag
+static BOOL g_polloopendflag = FALSE;
+
+// isOpen flag
+static BOOL g_isopenflag = FALSE;
+
+// thread id
+static pthread_t g_threadid = 0;
+
+// hard object struct
+//static VclCtlApiObj g_sclientobj;
+
+// app name
+static CHAR g_appname[MAX_NAME_SIZE_APP];
+
+// line sense list
+const UINT8 kLineSensList[VEHICLEHAL_LINESENSKIND_NUM] = {
+// CARSIGNAL_IG,
+// CARSIGNAL_PKB,
+// CARSIGNAL_REV,
+// CARSIGNAL_ILL,
+};
+
+static void *VehicleHalProcess(void *arg);
+
+HANDLE g_vehiclehalext_thread;
+HANDLE g_vehiclehalpol_thread;
+EFrameworkunifiedStatus VehicleHalProcessExtStart(HANDLE happ);
+EFrameworkunifiedStatus VehicleHalProcessExtStop(HANDLE happ);
+EFrameworkunifiedStatus VehicleHalProcessRecvSpeed(HANDLE happ);
+
+EFrameworkunifiedStatus VehicleHalProcessPolStart(HANDLE happ);
+EFrameworkunifiedStatus VehicleHalProcessPolStop(HANDLE happ);
+
+static const FrameworkunifiedProtocolCallbackHandler kVehicleHalSpd[] = { {
+ CID_VEHICLEHAL_SPD, VehicleHalProcessRecvSpeed } };
+
+#define VEHICLEHAL_SPEED "VehicleHalSpd"
+#define VEHICLEHAL_EXT "VehicleHalExt"
+#define VEHICLEHAL_POL "VehicleHalPol"
+
+VEHICLEHAL_RET_TYPE VehicleHalStart(HANDLE happ) {
+ if (NULL == happ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Handle is NULL");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+
+ // check open flag
+ if (TRUE == g_isopenflag) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Already Opened");
+ return VEHICLEHAL_RET_SUCCESS;
+ }
+
+// memset(&g_sclientobj, 0, sizeof(g_sclientobj));
+
+ // enter loop
+ g_loopendflag = FALSE;
+
+ g_polloopendflag = FALSE;
+
+ // get app name
+ PCSTR app_name = FrameworkunifiedGetAppName(happ);
+ if (NULL == app_name) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Get App Name Failed");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+
+ memset(g_appname, 0, sizeof(g_appname));
+ memcpy(g_appname, app_name, sizeof(g_appname));
+ g_appname[MAX_NAME_SIZE_APP] = '\0';
+
+// // Start VLC data input control API
+// UINT32 ret = VclCtlApiOpen(&g_sclientobj);
+// if ( CARSIGNAL_CTL_RET_SUCCESS != ret ) {
+// FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Ten Api Open Failed");
+// return VEHICLEHAL_RET_ERR_HARDINIT;
+// }
+
+ // Open message queue for sending
+ g_sendmsg_handle = McOpenSender(g_appname);
+ if (NULL == g_sendmsg_handle) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Open Mc Sender Failed");
+// VclCtlApiClose(&g_sclientobj);
+ return VEHICLEHAL_RET_ERR_MCOPEN;
+ }
+
+ // create thread
+ int iret = pthread_create(&g_threadid,
+ NULL,
+ VehicleHalProcess,
+ NULL);
+ if ( 0 != iret ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Create Thread Failed");
+ McClose(g_sendmsg_handle);
+// VclCtlApiClose(&g_sclientobj);
+ return VEHICLEHAL_RET_ERR_THREADSTART;
+ }
+
+ g_vehiclehalext_thread = FrameworkunifiedCreateChildThread(happ, VEHICLEHAL_EXT,
+ VehicleHalProcessExtStart,
+ VehicleHalProcessExtStop);
+
+ EFrameworkunifiedStatus estatus = FrameworkunifiedStartChildThread(happ, g_vehiclehalext_thread, 0, NULL);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedStartChildThread Failed");
+ McClose(g_sendmsg_handle);
+ return VEHICLEHAL_RET_ERR_THREADSTART;
+ }
+
+ g_vehiclehalpol_thread = FrameworkunifiedCreateChildThread(happ, VEHICLEHAL_POL,
+ VehicleHalProcessPolStart,
+ VehicleHalProcessPolStop);
+
+ EFrameworkunifiedStatus estatus_pol = FrameworkunifiedStartChildThread(happ, g_vehiclehalpol_thread, 0, NULL);
+ if (eFrameworkunifiedStatusOK != estatus_pol) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedStartChildThread polling Failed");
+ McClose(g_sendmsg_handle);
+ return VEHICLEHAL_RET_ERR_THREADSTART;
+ }
+
+
+ // set open flag true
+ g_isopenflag = TRUE;
+
+ return VEHICLEHAL_RET_SUCCESS;
+}
+
+VEHICLEHAL_RET_TYPE VehicleHalStop(HANDLE happ) {
+ if (NULL == happ) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Handle is NULL");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+
+ if (NULL != g_vehiclehalext_thread) {
+ EFrameworkunifiedStatus estatus = FrameworkunifiedDestroyChildThread(happ, g_vehiclehalext_thread);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedDestroyChildThread Failed");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+ g_vehiclehalext_thread = NULL;
+ }
+
+ // set open flag of polling to fasle
+ g_polloopendflag = TRUE;
+
+ if (NULL != g_vehiclehalpol_thread) {
+ EFrameworkunifiedStatus estatus = FrameworkunifiedStopChildThread(happ, g_vehiclehalpol_thread, 0, NULL);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedDestroyChildThread polling Failed");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+ estatus = FrameworkunifiedDestroyChildThread(happ, g_vehiclehalpol_thread);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedDestroyChildThread polling Failed");
+ return VEHICLEHAL_RET_ERR_PARAM;
+ }
+ g_vehiclehalpol_thread = NULL;
+ }
+
+ // set open flag fasle
+ g_isopenflag = FALSE;
+
+ // exit loop
+ g_loopendflag = TRUE;
+
+ // destroy thead
+ pthread_join(g_threadid, NULL);
+
+ // Close message queue
+ McClose(g_sendmsg_handle);
+
+// // End VLC data input control API
+// VclCtlApiClose(&g_sclientobj);
+
+ return VEHICLEHAL_RET_SUCCESS;
+}
+
+void *VehicleHalProcess(void *arg) {
+ // Line Sense Message
+ VehicleHalLineSensMsg s_linesensmsg;
+ memset( &s_linesensmsg, 0xFF, sizeof(s_linesensmsg) );
+
+ // main loop
+ while (TRUE != g_loopendflag) {
+ char* p_env_vb = NULL;
+ p_env_vb = getenv(VEHICLEHAL_LINESENSKIND_VB_DATA);
+ if (NULL != p_env_vb) {
+ // low voltage
+ if (VEHICLEHAL_LOWVB_VALUE >= atoi(p_env_vb)) {
+ s_linesensmsg.stdata[VEHICLEHAL_LINESENSKIND_LOWVOLTAGE] = 1;
+ } else {
+ s_linesensmsg.stdata[VEHICLEHAL_LINESENSKIND_LOWVOLTAGE] = 0;
+ }
+ }
+
+ // loop to get line sense status
+ for (UI_32 iloopnum = 0; iloopnum <= VEHICLEHAL_LINESENSKIND_ILL; ++iloopnum) {
+ // line sense status
+ UINT8 signalret = 0;
+
+// // get line sense status
+// UINT32 ret = VclCtlApiRcvVclData(&g_sclientobj, kLineSensList[iloopnum], &signalret);
+// if ( CARSIGNAL_CTL_RET_SUCCESS != ret ) {
+// FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Get LineSens [%d] status faild [%d]", kLineSensList[iloopnum], ret);
+// continue;
+// }
+
+ // convert 0 to 1 or 1 to 0 for IG,REV according car signal api reference
+ switch (kLineSensList[iloopnum]) {
+// case CARSIGNAL_IG:
+// case CARSIGNAL_REV:
+// signalret = 1 - signalret;
+// break;
+
+ default:
+ break;
+ }
+
+ // check status
+ if (signalret != s_linesensmsg.stdata[iloopnum]) {
+ s_linesensmsg.stdata[iloopnum] = signalret;
+ }
+ }
+
+ char* p_env_adim = NULL;
+ p_env_adim = getenv(VEHICLEHAL_LINESENSKIND_ADIM_DATA);
+ if (NULL != p_env_adim) {
+ s_linesensmsg.stdata[VEHICLEHAL_LINESENSKIND_ADIM] = atoi(p_env_adim);
+ }
+
+ char* p_env_mic = NULL;
+ p_env_mic = getenv(VEHICLEHAL_LINESENSKIND_MIC_DATA);
+ if (NULL != p_env_mic) {
+ s_linesensmsg.stdata[VEHICLEHAL_LINESENSKIND_MIC] = atoi(p_env_mic);
+ }
+
+ // send line sens
+ EFrameworkunifiedStatus eretval = McSend(g_sendmsg_handle, TN_LINE_SENS_READ, CID_VEHICLEHAL_LINESENS,
+ sizeof(s_linesensmsg), (PVOID)&s_linesensmsg);
+ if (eFrameworkunifiedStatusOK != eretval) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McSend LineSens failed");
+ }
+
+ // wait 10ms
+ usleep(10000);
+ }
+ return NULL;
+}
+
+EFrameworkunifiedStatus VehicleHalProcessExtStart(HANDLE happ) {
+ EFrameworkunifiedStatus estatus = FrameworkunifiedAttachCallbacksToDispatcher(happ, VEHICLEHAL_SPEED,
+ kVehicleHalSpd,
+ static_cast<UI_32>(_countof(kVehicleHalSpd)));
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__,
+ "Error FrameworkunifiedAttachCallbacksToDispatcher Vehicle_Hal_Speed:%d", estatus);
+ return estatus;
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus VehicleHalProcessExtStop(HANDLE happ) {
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus VehicleHalProcessRecvSpeed(HANDLE happ) {
+ // Speed Pusle Message
+ VehicleHalSpeedPulse speedpulsemsg;
+ memset( &speedpulsemsg, 0xFF, sizeof(speedpulsemsg) );
+
+ // get vehicle speed
+ UINT16 speed = 0;
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusOK;
+
+ estatus = FrameworkunifiedGetMsgDataOfSize(happ, &speed, sizeof(speed), eSMRRelease);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "failed FrameworkunifiedGetMsgDataOfSize() Status=[%d]", estatus);
+ return estatus;
+ }
+
+ // calculate speed to speed pulse
+ float speedpulse = static_cast<float>(speed * (4.0*637.0) / (60.0 * 60.0));
+ if ( speedpulse != speedpulsemsg.pulse ) {
+ speedpulsemsg.pulse = speedpulse;
+ if (0.0 != speedpulse) {
+ speedpulsemsg.period = static_cast<float>((1 / speedpulse) * 1000);
+ } else {
+ speedpulsemsg.period = 0;
+ }
+ }
+
+ // send line sens
+ EFrameworkunifiedStatus eretval = McSend(g_sendmsg_handle, TN_LINE_SENS_READ, CID_VEHICLEHAL_SPDPULSE,
+ sizeof(speedpulsemsg), (PVOID)&speedpulsemsg);
+ if (eFrameworkunifiedStatusOK != eretval) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McSend Speed Pulse failed");
+ }
+
+ eretval = McSend(g_sendmsg_handle, TN_LINE_SENS_READ, CID_VEHICLEHAL_SPD,
+ sizeof(UINT16), (PVOID)&speed);
+ if (eFrameworkunifiedStatusOK != eretval) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McSend Speed failed");
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus VehicleHalProcessPolStart(HANDLE happ) {
+ VehicleHalPol s_pol;
+ memset( &s_pol, 0xFF, sizeof(s_pol) );
+
+ while (!g_polloopendflag) {
+ char* p_env_vb = NULL;
+ char* p_env_rheostat = NULL;
+ p_env_vb = getenv(VEHICLEHAL_LINESENSKIND_VB_DATA);
+ p_env_rheostat = getenv(VEHICLEHAL_LINESENSKIND_RHEOSTAT_DATA);
+ if (NULL != p_env_vb) {
+ // covert voltage value
+ s_pol.vb = atoi(p_env_vb);
+ }
+
+ if (NULL != p_env_rheostat) {
+ // covert RHEOSTAT value
+ s_pol.rheostat = atoi(p_env_rheostat);
+ }
+ // send vb and rheostat
+ EFrameworkunifiedStatus eretval = McSend(g_sendmsg_handle, TN_LINE_SENS_READ, CID_VEHICLEHAL_LINESENS_POL,
+ sizeof(s_pol), (PVOID)&s_pol);
+ if (eFrameworkunifiedStatusOK != eretval) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McSend Vb and RHEOSTAT failed");
+ }
+ // sleep 700ms
+ usleep(700000);
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+EFrameworkunifiedStatus VehicleHalProcessPolStop(HANDLE happ) {
+ return eFrameworkunifiedStatusOK;
+}
diff --git a/video_in_hal/vehicleservice/.gitattributes b/video_in_hal/vehicleservice/.gitattributes
new file mode 100755
index 0000000..445b3c2
--- /dev/null
+++ b/video_in_hal/vehicleservice/.gitattributes
@@ -0,0 +1,128 @@
+*.doc filter=lfs diff=lfs merge=lfs -text
+*.docx filter=lfs diff=lfs merge=lfs -text
+*.pdf filter=lfs diff=lfs merge=lfs -text
+*.ppt filter=lfs diff=lfs merge=lfs -text
+*.pptx filter=lfs diff=lfs merge=lfs -text
+*.vsd filter=lfs diff=lfs merge=lfs -text
+*.xls filter=lfs diff=lfs merge=lfs -text
+*.xlsm filter=lfs diff=lfs merge=lfs -text
+*.xlsx filter=lfs diff=lfs merge=lfs -text
+*.doC filter=lfs diff=lfs merge=lfs -text
+*.dOc filter=lfs diff=lfs merge=lfs -text
+*.dOC filter=lfs diff=lfs merge=lfs -text
+*.Doc filter=lfs diff=lfs merge=lfs -text
+*.DoC filter=lfs diff=lfs merge=lfs -text
+*.DOc filter=lfs diff=lfs merge=lfs -text
+*.DOC filter=lfs diff=lfs merge=lfs -text
+*.docX filter=lfs diff=lfs merge=lfs -text
+*.doCx filter=lfs diff=lfs merge=lfs -text
+*.doCX filter=lfs diff=lfs merge=lfs -text
+*.dOcx filter=lfs diff=lfs merge=lfs -text
+*.dOcX filter=lfs diff=lfs merge=lfs -text
+*.dOCx filter=lfs diff=lfs merge=lfs -text
+*.dOCX filter=lfs diff=lfs merge=lfs -text
+*.Docx filter=lfs diff=lfs merge=lfs -text
+*.DocX filter=lfs diff=lfs merge=lfs -text
+*.DoCx filter=lfs diff=lfs merge=lfs -text
+*.DoCX filter=lfs diff=lfs merge=lfs -text
+*.DOcx filter=lfs diff=lfs merge=lfs -text
+*.DOcX filter=lfs diff=lfs merge=lfs -text
+*.DOCx filter=lfs diff=lfs merge=lfs -text
+*.DOCX filter=lfs diff=lfs merge=lfs -text
+*.pdF filter=lfs diff=lfs merge=lfs -text
+*.pDf filter=lfs diff=lfs merge=lfs -text
+*.pDF filter=lfs diff=lfs merge=lfs -text
+*.Pdf filter=lfs diff=lfs merge=lfs -text
+*.PdF filter=lfs diff=lfs merge=lfs -text
+*.PDf filter=lfs diff=lfs merge=lfs -text
+*.PDF filter=lfs diff=lfs merge=lfs -text
+*.ppT filter=lfs diff=lfs merge=lfs -text
+*.pPt filter=lfs diff=lfs merge=lfs -text
+*.pPT filter=lfs diff=lfs merge=lfs -text
+*.Ppt filter=lfs diff=lfs merge=lfs -text
+*.PpT filter=lfs diff=lfs merge=lfs -text
+*.PPt filter=lfs diff=lfs merge=lfs -text
+*.PPT filter=lfs diff=lfs merge=lfs -text
+*.pptX filter=lfs diff=lfs merge=lfs -text
+*.ppTx filter=lfs diff=lfs merge=lfs -text
+*.ppTX filter=lfs diff=lfs merge=lfs -text
+*.pPtx filter=lfs diff=lfs merge=lfs -text
+*.pPtX filter=lfs diff=lfs merge=lfs -text
+*.pPTx filter=lfs diff=lfs merge=lfs -text
+*.pPTX filter=lfs diff=lfs merge=lfs -text
+*.Pptx filter=lfs diff=lfs merge=lfs -text
+*.PptX filter=lfs diff=lfs merge=lfs -text
+*.PpTx filter=lfs diff=lfs merge=lfs -text
+*.PpTX filter=lfs diff=lfs merge=lfs -text
+*.PPtx filter=lfs diff=lfs merge=lfs -text
+*.PPtX filter=lfs diff=lfs merge=lfs -text
+*.PPTx filter=lfs diff=lfs merge=lfs -text
+*.PPTX filter=lfs diff=lfs merge=lfs -text
+*.vsD filter=lfs diff=lfs merge=lfs -text
+*.vSd filter=lfs diff=lfs merge=lfs -text
+*.vSD filter=lfs diff=lfs merge=lfs -text
+*.Vsd filter=lfs diff=lfs merge=lfs -text
+*.VsD filter=lfs diff=lfs merge=lfs -text
+*.VSd filter=lfs diff=lfs merge=lfs -text
+*.VSD filter=lfs diff=lfs merge=lfs -text
+*.xlS filter=lfs diff=lfs merge=lfs -text
+*.xLs filter=lfs diff=lfs merge=lfs -text
+*.xLS filter=lfs diff=lfs merge=lfs -text
+*.Xls filter=lfs diff=lfs merge=lfs -text
+*.XlS filter=lfs diff=lfs merge=lfs -text
+*.XLs filter=lfs diff=lfs merge=lfs -text
+*.XLS filter=lfs diff=lfs merge=lfs -text
+*.xlsM filter=lfs diff=lfs merge=lfs -text
+*.xlSm filter=lfs diff=lfs merge=lfs -text
+*.xlSM filter=lfs diff=lfs merge=lfs -text
+*.xLsm filter=lfs diff=lfs merge=lfs -text
+*.xLsM filter=lfs diff=lfs merge=lfs -text
+*.xLSm filter=lfs diff=lfs merge=lfs -text
+*.xLSM filter=lfs diff=lfs merge=lfs -text
+*.Xlsm filter=lfs diff=lfs merge=lfs -text
+*.XlsM filter=lfs diff=lfs merge=lfs -text
+*.XlSm filter=lfs diff=lfs merge=lfs -text
+*.XlSM filter=lfs diff=lfs merge=lfs -text
+*.XLsm filter=lfs diff=lfs merge=lfs -text
+*.XLsM filter=lfs diff=lfs merge=lfs -text
+*.XLSm filter=lfs diff=lfs merge=lfs -text
+*.XLSM filter=lfs diff=lfs merge=lfs -text
+*.xlsX filter=lfs diff=lfs merge=lfs -text
+*.xlSx filter=lfs diff=lfs merge=lfs -text
+*.xlSX filter=lfs diff=lfs merge=lfs -text
+*.xLsx filter=lfs diff=lfs merge=lfs -text
+*.xLsX filter=lfs diff=lfs merge=lfs -text
+*.xLSx filter=lfs diff=lfs merge=lfs -text
+*.xLSX filter=lfs diff=lfs merge=lfs -text
+*.Xlsx filter=lfs diff=lfs merge=lfs -text
+*.XlsX filter=lfs diff=lfs merge=lfs -text
+*.XlSx filter=lfs diff=lfs merge=lfs -text
+*.XlSX filter=lfs diff=lfs merge=lfs -text
+*.XLsx filter=lfs diff=lfs merge=lfs -text
+*.XLsX filter=lfs diff=lfs merge=lfs -text
+*.XLSx filter=lfs diff=lfs merge=lfs -text
+*.XLSX filter=lfs diff=lfs merge=lfs -text
+*.json filter=lfs diff=lfs merge=lfs -text
+*.jsoN filter=lfs diff=lfs merge=lfs -text
+*.jsOn filter=lfs diff=lfs merge=lfs -text
+*.jsON filter=lfs diff=lfs merge=lfs -text
+*.jSon filter=lfs diff=lfs merge=lfs -text
+*.jSoN filter=lfs diff=lfs merge=lfs -text
+*.jSOn filter=lfs diff=lfs merge=lfs -text
+*.jSON filter=lfs diff=lfs merge=lfs -text
+*.Json filter=lfs diff=lfs merge=lfs -text
+*.JsoN filter=lfs diff=lfs merge=lfs -text
+*.JsOn filter=lfs diff=lfs merge=lfs -text
+*.JsON filter=lfs diff=lfs merge=lfs -text
+*.JSon filter=lfs diff=lfs merge=lfs -text
+*.JSoN filter=lfs diff=lfs merge=lfs -text
+*.JSOn filter=lfs diff=lfs merge=lfs -text
+*.JSON filter=lfs diff=lfs merge=lfs -text
+*.ods filter=lfs diff=lfs merge=lfs -text
+*.odS filter=lfs diff=lfs merge=lfs -text
+*.oDs filter=lfs diff=lfs merge=lfs -text
+*.oDS filter=lfs diff=lfs merge=lfs -text
+*.Ods filter=lfs diff=lfs merge=lfs -text
+*.OdS filter=lfs diff=lfs merge=lfs -text
+*.ODs filter=lfs diff=lfs merge=lfs -text
+*.ODS filter=lfs diff=lfs merge=lfs -text
diff --git a/video_in_hal/vehicleservice/positioning/LICENSE b/video_in_hal/vehicleservice/positioning/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/vehicleservice/positioning/Makefile.client b/video_in_hal/vehicleservice/positioning/Makefile.client
new file mode 100755
index 0000000..7236c74
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/Makefile.client
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### subdirectories #########
+SUBDIRS += client
+
+include ../vehicle_service.mk
diff --git a/video_in_hal/vehicleservice/positioning/Makefile.server b/video_in_hal/vehicleservice/positioning/Makefile.server
new file mode 100755
index 0000000..d0fda9c
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/Makefile.server
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### subdirectories #########
+SUBDIRS += server
+
+include ../vehicle_service.mk
diff --git a/video_in_hal/vehicleservice/positioning/client/Makefile b/video_in_hal/vehicleservice/positioning/client/Makefile
new file mode 100755
index 0000000..d7fce28
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/Makefile
@@ -0,0 +1,31 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed header #########
+VPATH = ./include/$(COMPONENT_NAME)
+
+INST_HEADERS += POS_define.h
+INST_HEADERS += POS_sensor_API.h
+INST_HEADERS += POS_gps_API.h
+INST_HEADERS += POS_common_API.h
+INST_HEADERS += positioning.h
+
+######### subdirectories #########
+SUBDIRS += src/POS_common_API
+SUBDIRS += src/POS_gps_API
+SUBDIRS += src/POS_sensor_API
+
+include ../../vehicle_service.mk
diff --git a/video_in_hal/vehicleservice/positioning/client/include/CanInput_API.h b/video_in_hal/vehicleservice/positioning/client/include/CanInput_API.h
new file mode 100755
index 0000000..1449b25
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/CanInput_API.h
@@ -0,0 +1,98 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+ * File name : CanInput_API.h
+ * System name : PastModel002
+ * Sub System name : CanInput_API library
+ ******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_CANINPUT_API_H_
+#define POSITIONING_CLIENT_INCLUDE_CANINPUT_API_H_
+
+/************************************************************************
+ * Include *
+ ***********************************************************************/
+#include <vehicle_service/positioning_base_library.h> /* for type definitions */
+
+/************************************************************************
+* Definition *
+************************************************************************/
+/*----------------------------------------------------------------------*
+ * CAN_INPUT_RET_API Definition *
+ *----------------------------------------------------------------------*/
+/* Normal */
+#define CAN_INPUT_RET_NORMAL 0 /* Successful completion */
+
+/* Abnormal */
+#define CAN_INPUT_RET_ERROR (-1) /* An error has occurred */
+#define CAN_INPUT_RET_ERROR_PARAM (-2) /* Parameter error */
+
+/*----------------------------------------------------------------------*
+ * Message Definition *
+ *----------------------------------------------------------------------*/
+/* Command ID */
+#define CANINPUT_CID_LOCALTIME_NOTIFICATION 0x0220
+
+/*----------------------------------------------------------------------*
+ * Localtime status Definition *
+ *----------------------------------------------------------------------*/
+#define CANINPUT_LOCALTIME_STATUS_INVALID 0U
+#define CANINPUT_LOCALTIME_STATUS_INIT 1U
+#define CANINPUT_LOCALTIME_STATUS_PLAUSIBLE 2U
+#define CANINPUT_LOCALTIME_STATUS_NEW 3U
+#define CANINPUT_LOCALTIME_STATUS_DIAG 4U
+#define CANINPUT_LOCALTIME_STATUS_INCOMPLETE 5U
+
+/************************************************************************
+* type Definition *
+************************************************************************/
+typedef RET_API CAN_INPUT_RET_API; /* API return value */
+
+/************************************************************************
+* struct Definition *
+************************************************************************/
+/************************************************************************
+ * TAG : CANINPUT_MSG_LOCALTIMEINFO_DAT
+ * ABSTRACT : Localtime data structure
+ * NOTE :
+ ************************************************************************/
+typedef struct {
+ u_int8 status; /* status : Refer to Localtime status Definition */
+ u_int8 year; /* year : 0..99 (FFh:invalid) */
+ u_int8 month; /* month : 1..12 (FFh:invalid) */
+ u_int8 date; /* date : 1..31 (FFh:invalid) */
+ u_int8 hour; /* hour : 0..23 (FFh:invalid) */
+ u_int8 minute; /* minute : 0..59 (FFh:invalid) */
+ u_int8 second; /* second : 0..59 (FFh:invalid) */
+ u_int8 reserve; /* reserve */
+} CANINPUT_MSG_LOCALTIMEINFO_DAT;
+
+/************************************************************************
+ * Function prototypes *
+ ************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*[CanInput_API Public API]*/
+CAN_INPUT_RET_API CanInputInitialize(void);
+CAN_INPUT_RET_API CanInputSndMsg(PNO pno, CID cid, u_int16 msg_len, const void *msg_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_CANINPUT_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/CanInput_API_private.h b/video_in_hal/vehicleservice/positioning/client/include/CanInput_API_private.h
new file mode 100755
index 0000000..d7c8e8e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/CanInput_API_private.h
@@ -0,0 +1,68 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+ * File name : CanInput_API_private.h
+ * System name : PastModel002
+ * Sub System name : CanInput_API library
+ ******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_CANINPUT_API_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_CANINPUT_API_PRIVATE_H_
+
+/************************************************************************
+ * Include *
+ ***********************************************************************/
+
+/************************************************************************
+* Definition *
+************************************************************************/
+/*----------------------------------------------------------------------*
+ * Message Definition *
+ *----------------------------------------------------------------------*/
+/* Message body size (byte) */
+#define CANINPUT_MSGBUF_DSIZE 8 /* Maximum message body size */
+
+/************************************************************************
+* type Definition *
+************************************************************************/
+
+/************************************************************************
+* struct Definition *
+************************************************************************/
+/*****************************************************************************
+ * TAG : CANINPUT_MSG_INFO
+ * ABSTRACT : CanInput_API message structure
+ * NOTE : Message structure
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ uint8_t data[CANINPUT_MSGBUF_DSIZE]; /* Message data (Localtime) */
+} CANINPUT_MSG_INFO;
+
+/************************************************************************
+ * Function prototypes *
+ ************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*[CanInput_API Private API]*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_CANINPUT_API_PRIVATE_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Clock_API.h b/video_in_hal/vehicleservice/positioning/client/include/Clock_API.h
new file mode 100755
index 0000000..1987999
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Clock_API.h
@@ -0,0 +1,258 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+* $Header:: $
+* $Revision:: $
+*******************************************************************************/
+
+/******************************************************************************
+* File name :Clock_API.h
+* System name :_CWORD107__PND-A
+* Subsystem name :System common functions header file
+* Program name :
+* Publishing department
+****************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_CLOCK_API_H_
+#define POSITIONING_CLIENT_INCLUDE_CLOCK_API_H_
+
+#include <vehicle_service/positioning_base_library.h>
+#include "CommonDefine.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ Macro definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* For time calculation */
+#define CLOCK_TIMESTAMP_GETTIME(x) ((x) & (0x00FFFFFFU)) /* Macros that Get Time Counter Values */
+#define CLOCK_TIMESTAMP_GETFLAG(x) (((x) & (0xE0000000U)) >> (29U)) /* Macros that Get Your Own Count Values */
+#define CLOCK_TIMESTAMP_NORMAL (0U) /* Normal count */
+#define CLOCK_TIMESTAMP_INDIPENDENT (1U) /* Own count */
+
+#define CLOCK_TIMESTAMP_UNION(x, y) (((x) << (29U)) | (y)) /* Macro that combines the unique count value (x) and the time counter value (y) */
+
+ /* Timestamp Shared Memory Related */
+#define TIMESTAMP_RETRY_COUNTE (10U) /* Number of time stamp retries */
+#define TIMESTAMP_RETRY_INTERVAL (10U) /* Time stamp retry interval(100[msec]) */
+
+ /* Time Management Shared Memory Related */
+#define CLKMNG_RETRY_COUNTE (10U) /* Time management retries */
+#define CLKMNG_RETRY_INTERVAL (10U) /* Time Management Retry Interval(100[msec]) */
+
+ /* Day of the week definition */
+#define CLKMNG_SUN (0U) /* Sunday */
+#define CLKMNG_MON (1U) /* Mondays */
+#define CLKMNG_TUE (2U) /* Tuesdays */
+#define CLKMNG_WED (3U) /* Wednesdays */
+#define CLKMNG_THU (4U) /* Thursdays */
+#define CLKMNG_FRI (5U) /* Fridays */
+#define CLKMNG_SAT (6U)
+
+ /* Related to the accuracy of time */
+#define CLOCK_CORRECTED_TIME (0U) /* GPS corrected time completed */
+#define CLOCK_NOT_CORRECTED_TIME (1U) /* GPS uncorrected time */
+#define CLOCK_RTC_TIME (2U) /* GPS RTC time */
+#define CLOCK_INVALID_TIME (3U) /* GPS error time */
+
+ /* Time Stamp Status Storage Data Module Related Definition */
+#define TIMESTAMPDM_NAME "TIMESTAMP_DATA" /* Name of time stamp status storage data module */
+#define TIMESTAMPDM_SEM_NAME "TIMESTAMP_SEM" /* Timestamp status storage data module semaphore name */
+
+ /* Time Management Status Storage Data Module Related Definition */
+#define CLKMNG_DM_NAME "CLOCK_GPS_DATA" /* Name of time management status storage data module */
+#define CLKMNG_DM_SEM_NAME "CLOCK_GPS_SEM" /* Time management status storage data module semaphore name */
+
+ /* Messaging communication */
+#define CLKMNG_MSG_BUF_SIZE (128U) /* Message communication buffer size */
+#define CLKMNG_SETTIME_MSGBODYSIZE (4U) /* Date/Time Setting Response Notification Data Size */
+#define CLKMNG_NOTIOBSERVERS_MSGSZ (4U) /* Time change notification data body size */
+#define CLKMNG_NOTIACCURACY_MSGSZ (4U) /* Change notification data body size from time accuracy */
+#define CLKMNG_NOTIOBSERVERS_ENTRY_MSGSZ (4U) /* Time change notification registration data body size */
+#define CLKMNG_NOTIACCURACY_ENTRY_MSGSZ (0U) /* Change Notification Stored Data Size from Time Accuracy */
+
+ /* Semaphore Related Extensions */
+#define CLOCK_SEM_RETRY_INTERVAL (10) /* Retry interval for semaphore acquisition/release processing 10ms */
+
+/*
+ Data typing
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Time-stamped data */
+typedef struct TagTimestampData {
+ u_int16 trip; /* Trip counters */
+ u_int16 reserve; /* Reservation(Always 0) */
+ u_int32 time; /* Time counter */
+ u_int8 day; /* Number of days */
+ u_int8 hour; /* Time */
+ u_int8 min; /* Minutes */
+ u_int8 sec; /* Second */
+} TimestampData;
+
+/* TIMESTAMP INTERNAL COUNTER MODULE STRUCTURE DEFINITION */
+typedef struct {
+ u_int16 trip; /* Trip counters */
+ u_int32 time; /* Time counter */
+} TIMESTAMP_CNT;
+
+/* Time management status storage area */
+typedef struct TagClockStatus {
+ u_int8 status; /* GPS status */
+ u_int8 hour; /* Time of final correction */
+ u_int8 min; /* Minutes */
+ u_int8 sec; /* Second */
+} ClockStatus;
+
+/* Status storage area for writing time management shared memory */
+typedef struct TagClkMngTimerSetTime {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int8 reserve1[1]; /* (Not used) */
+ u_int8 gps_timer_state; /* GPS time status */
+ u_int16 year; /* Year */
+ u_int8 month; /* Month */
+ u_int8 day; /* Day */
+ u_int8 hour; /* Hour */
+ u_int8 min; /* Minutes */
+ u_int8 sec; /* Second */
+ u_int8 reserve2[3]; /* (Not used) */
+} CLKMNG_TIMER_SET_TIME;
+
+/* Existing sys_timerapi.h data */
+
+/* User time status */
+#define TIMEDATA_INVALID 0 /* Time invalid */
+#define TIMEDATA_VALID 1 /* Time valid */
+
+/* Time Definition AM/PM */
+#define CLOCK_AM 0
+#define CLOCK_PM 1
+/* Change to Enumeration */
+/* Time notification unit */
+typedef enum TagNotifyUnit {
+ CLOCK_NOTIFY_SECOND = (1U), /* Second notifications */
+ CLOCK_NOTIFY_MINUTE, /* Minute Notification */
+ CLOCK_NOTIFY_HOUR /* Hourly notification */
+} NOTIFYUNIT;
+
+/* Return value definition */
+typedef enum TagClockReturn {
+ CLOCK_OK, /* Normal completion */
+ CLOCK_ERROR, /* ABENDs */
+ CLOCK_ERROR_ARGUMENTS /* Invalid argument */
+} CLOCK_RETURN;
+
+/* Time Type Definition */
+typedef struct TagTimeData {
+ u_int16 year; /* Year */
+ u_int8 month; /* Month */
+ u_int8 day; /* Day */
+ u_int8 hour; /* Hour */
+ u_int8 minute; /* Minutes */
+ u_int8 second; /* Second */
+} TimeData;
+
+/* Offset time type definition */
+typedef struct TagOffsetData {
+ BOOL sign; /* Operator */
+ TimeData time; /* Date and time */
+} OffsetData;
+
+/* Data Definition for System Time Delivery Registration */
+typedef struct TagSystemTimeRegistData {
+ NOTIFYUNIT unit; /* Notification unit(Hour,Minutes,One of the seconds) */
+} SYSTEMTIME_REGISTDATA;
+
+/* Data Definition for Setting User Time */
+typedef struct TagUserTimSetData {
+ TimeData time; /* Time */
+ u_int8 day_of_week; /* Day-of-week */
+} USERTIME_SETDATA;
+
+/* Data Definition for User Time Delivery Registration */
+typedef struct TagUserTimeRegistData {
+ NOTIFYUNIT unit; /* Notification unit(Hour,Minutes,One of the seconds) */
+} USERTIME_REGISTDATA;
+
+
+/*
+ Time Management Thread -> External Message Definition
+- - - - - - - - - - - - - - - - - - - - - - */
+/* Message data type */
+typedef struct TagClkMngRecMsg {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int8 data[CLKMNG_MSG_BUF_SIZE];
+} CLKMNG_RCV_MSG;
+
+/* For time management Time Set Response Message */
+typedef struct TagClkMngRetTimeMsg { /* Time Set Response Message */
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ int8 result; /* Processing result */
+ int8 dummy[3];
+} CLKMNG_RETTIME_MSG;
+
+/* Change Notification Message from Time for Time Management */
+typedef struct TagClkMngNotiAccuracyMsg {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ u_int8 gps_status; /* GPS time status(Likelihood) */
+ int8 dummy[3];
+} CLKMNG_NOTIACCURACY_MSG;
+
+/* Time change notification message for time management */
+typedef struct TagClkMngNotiObserversMsg {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ u_int8 hour; /* Hour */
+ u_int8 min; /* Minutes */
+ u_int8 sec; /* Second */
+ int8 dummy[1];
+} CLKMNG_NOTIOBSERVERS_MSG;
+
+/*
+ Time Management API -> Time Management Thread Message Definition
+- - - - - - - - - - - - - - - - - - - - - - */
+/* Change Notification Registration Message from the Accuracy of Time for Time Management */
+typedef struct TagClkMngNotAccuracyEntryMsg {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+} CLKMNG_NOTIACCURACY_ENTRY_MSG;
+
+/* Time change notification registration message for time management */
+typedef struct TagClkMngNotiObserversEntryMsg {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ u_int8 notify_time; /* Notification unit (Hour,Minutes,One of the seconds) */
+ int8 dummy[3];
+} CLKMNG_NOTIOBSERVERS_ENTRY_MSG;
+
+/*
+ API Function Prototype Declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API ClockInitApi(void); /* API initialization processing */
+RET_API ClockGetLocalTime(RealTimeData *real_time, TimestampData *timestamp); /* Current time reference processing */
+RET_API ClockGetLocalTimeBcd(RealTimeDataBcd *real_time_bcd, TimestampData *timestamp); /* Current time reference processing(BCD) */
+RET_API ClockGetUtcTime(RealTimeData* real_time, TimestampData *timestamp); /* Current UTC time reference processing */
+RET_API ClockCnvDateToSec(const LPSYSTEMTIME sys_time, u_int32* sec); /* Date and time,Total seconds conversion */
+RET_API ClockCnvSecToDate(const u_int32* sec, LPSYSTEMTIME sys_time); /* Total seconds,Date and time conversion */
+RET_API ClockGetAddOpeTime(u_int32 *ope_time); /* Accumulated operating time reference processing */
+RET_API ClockSetSystemTime(PNO snd_pno, const SysTimeData* sys_time, u_int8 gps_status); /* System time setting process */
+
+RET_API ClockNotifyObserversClock(PNO snd_pno, u_int8 rsc_id, u_int8 notify_time); /* Fixed period time change notification registration */
+RET_API ClockNotifyObserversAccuracy(PNO snd_pno, u_int8 rsc_id); /* Register change notification based on the time probability */
+RET_API ClockNotifyObserversAdjustClock(PNO snd_pno, u_int8 rsc_id); /* System time setting change notification registration */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_CLOCK_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/CommonDefine.h b/video_in_hal/vehicleservice/positioning/client/include/CommonDefine.h
new file mode 100755
index 0000000..2e9e3e6
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/CommonDefine.h
@@ -0,0 +1,72 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_COMMONDEFINE_H_
+#define POSITIONING_CLIENT_INCLUDE_COMMONDEFINE_H_
+
+/**
+ * @file CommonDefine.h
+ */
+
+/** @addtogroup vehicle_service
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/pos_message_header.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* Date and Time Status Definition */
+#define NAVIINFO_NAVI_GPS_TD_STS_NOTFIX (0)
+//!< \~english time has not been adjusted after GPS receiver reset
+#define NAVIINFO_NAVI_GPS_TD_STS_RTCBACKUP (1) // !<\~english time output from RTC Backup(have time adjustment)
+#define NAVIINFO_NAVI_GPS_TD_STS_FIX (2) //!< \~english time adjustment completed
+
+/* Vehicle sensor data information */
+#define POS_SNS_CONNECTION (0x01U) //!< \~english connected
+#define POS_SNS_UNCONNECTION (0x00U) //!< \~english not connected
+#define POS_SNS_SHORT (0x02U) //!< \~english short
+#define POS_SNS_UNSPECIFIED (0x03U) //!< \~english not specified
+
+/* NMEA Receive Flag(_CWORD82_) */
+#define POS_SNS__CWORD82__DRMC (0x01U) //!< \~english DRMC sentence
+#define POS_SNS__CWORD82__GSA (0x02U) //!< \~english GSA sentence
+#define POS_SNS__CWORD82__GSV_1 (0x04U) //!< \~english GSV_1 sentence
+#define POS_SNS__CWORD82__GSV_2 (0x08U) //!< \~english GSV_2 sentence
+#define POS_SNS__CWORD82__GSV_3 (0x10U) //!< \~english GSV_3 sentence
+#define POS_SNS__CWORD82__PJRDC_GP_3 (0x20U) //!< \~english PJRDC_GP_3 sentence
+
+/* NMEA Receive Flag */
+#define POS_SNS_GPS_NMEA_PASCD (0x01000000U) //!< \~english pascd sentence
+
+typedef u_int16 PNO; //!< \~english PNo.
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+#endif // POSITIONING_CLIENT_INCLUDE_COMMONDEFINE_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/DR_API.h b/video_in_hal/vehicleservice/positioning/client/include/DR_API.h
new file mode 100755
index 0000000..6362f8c
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/DR_API.h
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+@file DR_API.h
+@detail DR_API external header file<BR>
+ DR_API External public header
+******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_DR_API_H_
+#define POSITIONING_CLIENT_INCLUDE_DR_API_H_
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Define *
+ *****************************************************************************/
+/* Command ID */
+#define CID_DR_MAP_MATCHING_DATA (0x0209)
+#define CID_DR_CLEAR_BACKUP_DATA (0x020F)
+
+/* DR_EXT_RET_API definition */
+#define DR_EXT_RET_NORMAL (0) /* Successful completion */
+#define DR_EXT_RET_ERROR (-1) /* Setup failure */
+
+/*****************************************************************************
+ * Typedef *
+ *****************************************************************************/
+typedef int32 DR_EXT_RET_API;
+
+/*****************************************************************************
+ * Enumeration *
+ *****************************************************************************/
+typedef enum {
+ NAVI_DATA_STATUS_2D_FIX = 0x00,
+ NAVI_DATA_STATUS_3D_FIX,
+ NAVI_DATA_STATUS_DR_COMBINED,
+ NAVI_DATA_STATUS_DR_ONLY,
+ NAVI_DATA_STATUS_MAP_2D_GPS_FIX,
+ NAVI_DATA_STATUS_MAP_3D_GPS_FIX,
+ NAVI_DATA_STATUS_MAP_DR_COMBINED,
+ NAVI_DATA_STATUS_MAP_DR_ONLY,
+ NAVI_DATA_STATUS_MAP_NO_FIX,
+ NAVI_DATA_STATUS_AWAITING_FIRST_FIX,
+ NAVI_DATA_STATUS_DATA_INVALID,
+ NAVI_DATA_STATUS_NO_FIX,
+ NAVI_DATA_STATUS_TIME_ONLY_FIX
+} NAVI_DATA_STATUS;
+
+typedef enum {
+ NAVI_DATA_INVALID = 0x00,
+ NAVI_DATA_VALID
+} NAVI_DATA_AVAILABLE;
+
+/*****************************************************************************
+ * Struct *
+ *****************************************************************************/
+/*****************************************************************************
+ * TAG : POSITION_INFO
+ * ABSTRACT : Position information structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ int32 latitude; /* 10^-7deg North : plus, South : minus */
+ int32 longitude; /* 10^-7deg East : plus, West : minus */
+ NAVI_DATA_AVAILABLE status; /* Status of data */
+} POSITION_INFO;
+
+/*****************************************************************************
+ * TAG : RATE_INFO
+ * ABSTRACT : Rate information structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 rate; /* 10^-2m/sec */
+ u_int8 reserve[2]; /* reserve */
+ NAVI_DATA_AVAILABLE status; /* Status of data */
+} RATE_INFO;
+
+/*****************************************************************************
+ * TAG : ORIENT_INFO
+ * ABSTRACT : Orient information structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 orient; /* 10^-2deg N : 0, E : 90, S : 180, W : 270 */
+ u_int8 reserve[2]; /* reserve */
+ NAVI_DATA_AVAILABLE status; /* Status of data */
+} ORIENT_INFO;
+
+/*****************************************************************************
+ * TAG : MAP_MATCHING_DATA
+ * ABSTRACT : Map-Matching information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ POSITION_INFO position_info; /* Position information */
+ RATE_INFO rate_info; /* Rate information */
+ ORIENT_INFO orient_info; /* Orient information */
+ NAVI_DATA_STATUS status; /* Status */
+} MAP_MATCHING_DATA;
+
+/*****************************************************************************
+ * TAG : DR_MSG_MAP_MATCHING_DATA
+ * ABSTRACT : Map-Matching information data message buffer structure
+ * NOTE : Message structure(User -> VehicleSens)
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ MAP_MATCHING_DATA data; /* Message data (Map-Matching information) */
+} DR_MSG_MAP_MATCHING_DATA;
+
+/*****************************************************************************
+ * TAG : DR_MSG_CLEAR_BACKUP_DATA
+ * ABSTRACT : Clear backup data message buffer structure
+ * NOTE : Message structure(User -> VehicleSens)
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+} DR_MSG_CLEAR_BACKUP_DATA;
+
+/*****************************************************************************
+* Function prototypes *
+*****************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern DR_EXT_RET_API DrSetMapMatchingData(PNO pno, MAP_MATCHING_DATA* map_matching_data);
+extern DR_EXT_RET_API DrClearBackupData(PNO pno);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_DR_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/DeadReckoning_DbgLogSim.h b/video_in_hal/vehicleservice/positioning/client/include/DeadReckoning_DbgLogSim.h
new file mode 100755
index 0000000..bd57de7
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/DeadReckoning_DbgLogSim.h
@@ -0,0 +1,50 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_DEADRECKONING_DBGLOGSIM_H_
+#define POSITIONING_CLIENT_INCLUDE_DEADRECKONING_DBGLOGSIM_H_
+
+/*******************************************************************************
+ FILE : DeadReckoning_DbgLogSim.h
+ SYSTEM : _CWORD64_ platform development
+ SUBSYSTEM : Log Simulator for Debugging
+ PROGRAM : PastModel002*1 log read
+ FUNC LIST :
+--------------------------------------------------------------------------------
+
+*******************************************************************************/
+
+#include "Dead_Reckoning_API.h"
+
+#define DR_DBG_LOG_PACKET_HEAD_SIZE (4) /* DR_LOG_PACKET_HEAD_SIZE */
+#define DR_DBG_LOG_SIM_BUFF_SIZE (0x200)
+
+#define DR_DBG_LOG_SIM_DATA_NONE (-1)
+#define DR_DBG_LOG_SIM_DATA_GPS (1)
+#define DR_DBG_LOG_SIM_DATA_SENSOR (2)
+
+/*
+ * prototype
+ * public functions
+ */
+
+void DeadReckoningDbgLogSimInit(void);
+void DeadReckoningDbgLogSimDispose(void);
+
+BOOL DeadReckoningDbgLogSimIsDbgLogSimMode(void);
+int DeadReckoningDbgLogSimReadPacket(u_int8 *, size_t, int16 *);
+
+#endif // POSITIONING_CLIENT_INCLUDE_DEADRECKONING_DBGLOGSIM_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Dead_Reckoning_API.h b/video_in_hal/vehicleservice/positioning/client/include/Dead_Reckoning_API.h
new file mode 100755
index 0000000..bd2e031
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Dead_Reckoning_API.h
@@ -0,0 +1,229 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_API_H_
+#define POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_API_H_
+/****************************************************************************
+ * File name :Dead_Reckoning_API.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "Sensor_Common_API.h"
+#include <native_service/frameworkunified_types.h>
+
+/*****************************************************************************
+ * Define *
+ *****************************************************************************/
+#define NUM_OF_100msData (10) /* Number of gyro data items delivered every 100 ms */
+
+/*****************************************************************************
+ * Typedef *
+ *****************************************************************************/
+typedef RET_API DR_RET_API;
+
+/*****************************************************************************
+ * Enumeration *
+ *****************************************************************************/
+/*******************************************************************************
+ TAG : NAVI_MATCHING_STATUS
+ ABSTRACT : Map matching data(Status)
+ NOTE :
+*******************************************************************************/
+typedef enum NaviMatchingStatus {
+ NAVI_MATCHING_STS_2D_FIX = 0x00,
+ NAVI_MATCHING_STS_3D_FIX,
+ NAVI_MATCHING_STS_DR_COMBINED,
+ NAVI_MATCHING_STS_DR_ONLY,
+ NAVI_MATCHING_STS_MAP_2D_GPS_FIX,
+ NAVI_MATCHING_STS_MAP_3D_GPS_FIX,
+ NAVI_MATCHING_STS_MAP_DR_COMBINED,
+ NAVI_MATCHING_STS_MAP_DR_ONLY,
+ NAVI_MATCHING_STS_MAP_NO_FIX,
+ NAVI_MATCHING_STS_AWAITING_FIRST_FIX,
+ NAVI_MATCHING_STS_DATA_INVALID,
+ NAVI_MATCHING_STS_NO_FIX,
+ NAVI_MATCHING_STS_TIME_ONLY_FIX
+} NAVI_MATCHING_STATUS;
+
+/*******************************************************************************
+ TAG : NAVI_MATCHING_DATA_AVAILABLE
+ ABSTRACT : Map matching data(Availability)
+ NOTE :
+*******************************************************************************/
+typedef enum {
+ NAVI_MATCHING_DATA_INVALID = 0x00,
+ NAVI_MATCHING_DATA_VALID
+} NAVI_MATCHING_DATA_AVAILABLE;
+
+/*****************************************************************************
+ * Struct *
+ *****************************************************************************/
+/* Sensor data */
+/*******************************************************************************
+ TAG : Struct_PulseRevTbl
+ ABSTRACT : Vehicle speed/REV data table structure
+ NOTE : 4byte
+*******************************************************************************/
+typedef struct {
+ u_int8 reverse_flag; /* 0:Forward march 1:Backward 3:Disabled Reverse signal status */
+ u_int8 pulse_flag; /* Vehicle speed pulse flag */
+ /* 0:Enabled 1:Receive invalid value from CAN 2:Unable to receive at download timing */
+ u_int16 pulse_sum_cyclic; /* Vehicle speed pulse counter value */
+} Struct_PulseRevTbl;
+/*******************************************************************************
+ TAG : Struct_GyroTbl
+ ABSTRACT : Gyro Data Table Structure
+ NOTE : 20byte
+*******************************************************************************/
+typedef struct {
+ u_int16 gyro_data[NUM_OF_100msData]; /* A/D-converted gyro data */
+} Struct_GyroTbl;
+/*******************************************************************************
+ TAG : Struct_SensData
+ ABSTRACT : Sensor data structure
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ u_int8 sens_cnt_flag; /* Sensor data transmission counter flag */
+ /* 0:Disabled(->Initial Sensor) 1:Enabled(->100 ms periodic transmission) */
+ /* Set "0" for initial sensor transmission and "1" for periodic transmission. */
+ u_int8 sens_cnt; /* Sensor data transmission counter value Set "0" at initial transmission of sensor */
+ Struct_PulseRevTbl pulse_rev_tbl; /* Vehicle speed/REV Data table */
+ Struct_GyroTbl gyro_x_tbl; /* Gyro(X axis) data table */
+ Struct_GyroTbl gyro_y_tbl; /* Gyro(Y axis) data table */
+ Struct_GyroTbl gyro_z_tbl; /* Gyro(Z axis) data table */
+} Struct_SensData;
+
+/* GPS data */
+/*******************************************************************************
+ TAG : Struct_GpsData
+ ABSTRACT : GPS data structure
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ u_int8 sens_cnt; /* Sensor data transmission counter value */
+ u_int8 sens_cnt_flag; /* Sensor data transmission counter flag */
+ /* 0:Disabled(Incorrect GPS sensor counter) */
+ /* 1:Enabled */
+ u_int16 gps_data_size; /* GPS data storage area size */
+ DID did; /* Data ID */
+ const void* gps_data; /* GPS data storage area */
+} Struct_GpsData;
+
+/* Estimated Navigation Calculation Result */
+/*******************************************************************************
+ TAG : Struct_DR_DATA
+ ABSTRACT : Estimated Navigation Calculation Result
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ int64_t latitude; /* Latitude(WGS-84) 10^-7deg */
+ int64_t longitude; /* Longitude(WGS-84) 10^-7deg */
+ int64_t altitude; /* Altitude 10^-2m */
+ u_int16 rate; /* Speeds 10^-2m/sec */
+ u_int16 heading; /* Orientation North-reference clockwise 10^-2deg */
+ u_int16 reserve; /* RESERVE */
+ u_int8 dr_status; /* DR calculation status */
+ u_int8 positioning_time; /* Sensor Counter */
+} Struct_DR_DATA;
+
+/*******************************************************************************
+ TAG : DR_CALC_INFO
+ ABSTRACT : Estimated navigation information
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ u_int16 gyro_offset; /* Correction coefficient:Gyro offset */
+ u_int8 gyro_scale_factor; /* Correction coefficient:Gyro Sensitivity */
+ u_int8 gyro_scale_factor_level; /* Learning Level(Gyro Sensitivity) */
+ u_int16 speed_pulse_scale_factor; /* Correction coefficient:Vehicle speed factor */
+ u_int8 speed_pulse_scale_factor_level; /* Learning Level(Vehicle speed factor) */
+ u_int8 reserve; /* Reserve(1Byte) */
+} DR_CALC_INFO;
+
+/*******************************************************************************
+ TAG : DR_POSITION_INFO
+ ABSTRACT : Location information
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ int64_t latitude;
+ int64_t longitude;
+ NAVI_MATCHING_DATA_AVAILABLE status;
+} DR_POSITION_INFO;
+
+/*******************************************************************************
+ TAG : DR_RATE_INFO
+ ABSTRACT : Location information
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ u_int16 rate;
+ u_int8 reserve[2];
+ NAVI_MATCHING_DATA_AVAILABLE status;
+} DR_RATE_INFO;
+
+/*******************************************************************************
+ TAG : DR_ORIENT_INFO
+ ABSTRACT : Location information
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ u_int16 orient;
+ u_int8 reserve[2];
+ NAVI_MATCHING_DATA_AVAILABLE status;
+} DR_ORIENT_INFO;
+
+/*******************************************************************************
+ TAG : NAVI_MATCHING_DATA
+ ABSTRACT : Map matching data
+ NOTE :
+*******************************************************************************/
+typedef struct {
+ DR_POSITION_INFO position_info;
+ DR_RATE_INFO rate_info;
+ DR_ORIENT_INFO orient_info;
+ NAVI_MATCHING_STATUS status;
+} NAVI_MATCHING_DATA;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+DR_RET_API DeadReckoningLibraryInit(void);
+DR_RET_API SetGpsData(Struct_GpsData *st_gps_data);
+DR_RET_API CalculateDeadReckoningData(Struct_SensData *st_sensor_data,
+ Struct_DR_DATA *st_dr_data, DR_CALC_INFO *dr_calc_data);
+DR_RET_API SetMatchingData(NAVI_MATCHING_DATA *st_matching_data);
+
+DR_RET_API ClearBackupData(void); /* Clear DR backup data */
+/* BOOL Problem Avoidance */
+DR_RET_API GetLocationLogSetting(int *log_sw, unsigned char *severity); /* Location log output ON/OFF acquisition */
+DR_RET_API SetLocationLogStatus(int log_sw, unsigned char severity); /* Location log output ON/OFF setting */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Dead_Reckoning_Local_Api.h b/video_in_hal/vehicleservice/positioning/client/include/Dead_Reckoning_Local_Api.h
new file mode 100755
index 0000000..c513e9b
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Dead_Reckoning_Local_Api.h
@@ -0,0 +1,147 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_LOCAL_API_H_
+#define POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_LOCAL_API_H_
+/****************************************************************************
+ * File name :Dead_Reckoning_Local_Api.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "Sensor_Common_API.h"
+#include "SensorLocation_API.h"
+#include "SensorMotion_API.h"
+#include "DR_API.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+
+/*----------------------------------------------------------------------*
+ * DEADRECKONING_RET_API define *
+ *----------------------------------------------------------------------*/
+/* Normal system */
+#define DEAD_RECKONING_RET_NORMAL 0 /* Normal completion */
+/* Abnormal system */
+#define DEADRECKONING_RET_ERROR_PID (-1) /* Thread ID error */
+#define DEADRECKONING_RET_ERROR_DID (-2) /* Unregistered DID */
+#define DEADRECKONING_RET_ERROR_PARAM (-4) /* Parameter error */
+#define DEADRECKONING_RET_ERROR_BUFFULL (-5) /* FULL of registered numbers */
+#define DEADRECKONING_RET_ERROR_CREATE_EVENT (-6) /* Event generation failure */
+#define DEADRECKONING_RET_ERROR_OUTOF_MEMORY (-8) /* Shared memory allocation failed */
+#define DEADRECKONING_RET_ERROR_SIZE (-9) /* Storage destination size error */
+#define DEADRECKONING_RET_ERROR_MIN (-10)
+
+/*----------------------------------------------------------------------*
+ * DEADRECKONING delivery registry APIs *
+ *----------------------------------------------------------------------*/
+/* Delivery control */
+#define DEADRECKONING_DELIVERY_REGIST 0x01 /* Delivery registration */
+
+/* Delivery timing */
+#define DEADRECKONING_DELIVERY_TIMING_UPDATE 0x01 /* Updating */
+
+/*----------------------------------------------------------------------*
+ * Command ID *
+ *----------------------------------------------------------------------*/
+/* Vehicle Sensor -> Vehicle Sensor(DR) */
+#define CID_DEAD_RECKONING_DELIVERY_ENTRY 0x0310 /* DR Transmission Registration Signal Notification */
+
+/* Vehicle Sensor -> Vehicle Sensor(DR) */
+#define CID_DEAD_RECKONING_SENS_DATA 0x0311 /* DR data signal notification */
+#define CID_DEAD_RECKONING_GPS_DATA 0x0312 /* DR data signal notification */
+#define CID_DEAD_RECKONING_SENS_FST_DATA 0x0313 /* DR data signal notification */
+
+/* Message Data Size(byte) */
+#define DEADRECKONING_MSGBUF_DSIZE 512 /* Message body MAX */
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+/* Semaphore name(MAX 32Byte) Synchronize with VehicleDebug_API_private.h */
+#define SENSOR_LOG_SETTING_SEMAPHO_NAME ("SEBSIR_GET_LOG_SETTING_SEMAPHO")
+
+/* Shared memory name(MAX 32Byte) Synchronize with VehicleDebug_API_private */
+#define LOG_SETTING_SHARE_MEMORY_NAME ("LOG_SETTING_SHARE_MEMORY")
+
+/************************************************************************
+* typedef Definition *
+************************************************************************/
+typedef RET_API DEAD_RECKONING_RET_API; /* API return value */
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/************************************************************************
+* TAG : DEADRECKONING_MSG_BUF
+* ABSTRACT : message buffer
+************************************************************************/
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int8 data[DEADRECKONING_MSGBUF_DSIZE]; /* Message data */
+} DEADRECKONING_MSG_BUF;
+
+/************************************************************************
+* TAG : DEADRECKONING_MSG_DELIVERY_ENTRY
+* ABSTRACT : Registration message delivery vehicle sensor information(->Vehicle sensor)
+************************************************************************/
+typedef struct {
+ DID did; /* ID data corresponding to the vehicle sensor information */
+ PNO pno; /* Shipping addressPNO */
+ u_int8 delivery_timing; /* Delivery opportunity */
+ u_int8 ctrl_flg; /* Delivery control */
+ EventID event_id; /* Event ID */
+} DEADRECKONING_MSG_DELIVERY_ENTRY_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ DEADRECKONING_MSG_DELIVERY_ENTRY_DAT data; /* Message data */
+} DEADRECKONING_MSG_DELIVERY_ENTRY;
+
+/************************************************************************
+* TAG : DEADRECKONING_MSG_GET_DR_DATA
+* ABSTRACT : Vehicle sensor information acquisition message(->Vehicle sensor)
+************************************************************************/
+typedef struct {
+ DID did; /* Data ID corresponding to vehicle sensor information */
+ PNO pno; /* Destination PNO */
+ u_int16 offset; /* Offset to shared memory storage area */
+ u_int16 size; /* Size of shared memory storage area */
+ u_int8 reserve[2];
+ EventID event_id; /* Event ID */
+} DEADRECKONING_MSG_GET_DR_DATA_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ DEADRECKONING_MSG_GET_DR_DATA_DAT data; /* Message data */
+} DEADRECKONING_MSG_GET_DR_DATA;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_LOCAL_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Gps_API_private.h b/video_in_hal/vehicleservice/positioning/client/include/Gps_API_private.h
new file mode 100755
index 0000000..7026ce9
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Gps_API_private.h
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * Gps_API_private.h
+ * @brief
+ * Definition for GPS Internal I/F Liblary
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_GPS_API_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_GPS_API_PRIVATE_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/*--- for message ---*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief message delivery GPS reset information
+ */
+typedef struct {
+ uint8_t mode; /**< Reset mode */
+ uint8_t reserve[3]; /**< reserve */
+ PNO snd_pno; /**< Caller PNO */
+ PNO res_pno; /**< Destination PNO */
+} POS_RESETINFO;
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_GPS_API_PRIVATE_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/INI_API.h b/video_in_hal/vehicleservice/positioning/client/include/INI_API.h
new file mode 100755
index 0000000..f16a4c6
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/INI_API.h
@@ -0,0 +1,259 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+* File name : INI_API.h
+* System name : _CWORD107_
+* Subsystem name : Staged Start and Termination Framework
+* Title : Staged Start and End Framework API Header Files
+************************************************************************/
+
+#ifndef POSITIONING_CLIENT_INCLUDE_INI_API_H_
+#define POSITIONING_CLIENT_INCLUDE_INI_API_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*
+***** DEFINE *****
+*/
+
+#define INI_EXTMEM_DUM 0 /* Message buffer header extension member */
+
+/* Return value */
+#define INI_SUCCESS 0 /* Normal */
+#define INI_FALSE (-1) /* Fail */
+#define INI_ERRNOTRDY (-2) /* No destination process(Not wakeup) */
+
+/* Stage start completion notification ID related Note: ACC-OFF process completion notification is also used. */
+#define GINI_COMPID_INI 0x00000000 /* Initial value of completion notification ID */
+#define GINI_COMPID_MASK 0x80000000 /* Completion notification ID mask value(Startup completion or for event completion determination) */
+
+/* ID for Phase Start Event Completion Notification */
+
+#define INI_INITCOMP_BTCOM_PRT 0x80000001 /* BT Communication Protocol Thread Startup Complete */
+#define INI_INITCOMP_BTCOM_MNG 0x80000002 /* BT Communication Protocol Thread Startup Complete */
+#define INI_INITCOMP_BTCOM_RCV 0x80000004 /* BT Communication Protocol Thread Startup Complete */
+#define INI_INITCOMP_MC_UPCHK 0x80000008 /* To receive the confirmation notice of connection between microcomputers */
+
+/************************************************************************
+ ID for Phase Start Event Completion Notification (For VUP)
+ ************************************************************************/
+#define INI_FWRDCOMP__CWORD24_ 0x80000008 /* _CWORD24_ transmission completed */
+#define INI_FWRDCOMP_VUP 0x80000010 /* VUPLoader transmission completed */
+#define INI_INITCOMP_MFT 0x80000020 /* Module transfer thread start completion */
+#define INI_INITCOMP_UPCHK 0x80000040 /* Receive Start Type Confirmation Notification */
+
+/* ID for Phase ACC-OFF Event Completion Notification ID */
+
+/* Boot phase */
+/*************************************************************************
+ Note: Maintenance Precautions*
+ Initial only affects the addition and deletion of startup parameters.
+ For addition or deletion of shared memory creation,The primary of each process is also affected
+*************************************************************************/
+/* --->CHG */
+enum IniStep {
+ GINI_STEPFORK_INI = 0, /* Initial state */
+ GINI_STEPFORK_COMMEM, /* Shared Memory Generation */
+ GINI_STEPFORK_FIRST, /* First start */
+ GINI_STEPFORK_SECOND, /* 2nd start */
+ GINI_STEPFORK_THIRD, /* 3rd start */
+ GINI_STEPFORK_FOURTH, /* 4th start */
+ GINI_STEPFORK_BUPCHK, /* Backup Data Check/Initialization */
+ GINI_STEPFORK_FIFTH, /* 5th start */
+ GINI_STEPFORK_SIXTH, /* 6th start */
+ GINI_STEPFORK_SEVENTH, /* 7th start */
+ GINI_STEPFORK_EIGHTH, /* 8th start */
+ GINI_STEPFORK_NINTH, /* 9th start */
+ GINI_STEPFORK_TENTH, /* 10th start */
+ GINI_STEPFORK_ELEVENTH, /* 11th start */
+ GINI_STEPFORK_TWELFTH, /* 12th start */
+ GINI_STEPFORK_THIRTEENTH, /* 13th start */
+ GINI_STEPFORK_FOURTEENTH, /* 14th start */
+ GINI_STEPFORK_FIFTEENTH, /* 15th Start */
+ GINI_STEPFORK_SIXTEENTH, /* 16th start */
+ GINI_STEPFORK_SEVENTEENTH, /* 17th Start */
+ GINI_STEPFORK_EIGHTEENTH, /* 18th Start */
+ GINI_STEPFORK_MAX /* Total number of startup phases */
+};
+/* <--- CHG */
+
+/* ACC-OFF phase */
+enum AccOffStep {
+ GINI_ACCOFF_INI = 0, /* Early stage(Normal state) */
+ GINI_ACCOFF_FIRST, /* Stage 1 */
+ GINI_ACCOFF_SECOND, /* Step 2 */
+ GINI_ACCOFF_THIRD, /* Step 3 */
+ GINI_ACCOFF_FOURTH, /* Step 4 */
+ GINI_ACCOFF_FIFTH, /* Step 5 */
+ GINI_ACCOFF_MAX /* Total number of ACC-OFF steps */
+};
+
+/* Backup data check process type */
+enum IniDramBkup {
+ INI_BUPCHK_SRAM_INIT = 0, /* Initialization of SRAM */
+ INI_BUPCHK_SRAM_CHK, /* SRAM range-checking process */
+ INI_BUPCHK_USER_INIT, /* Initialization of personal information */
+ INI_BUPCHK_DRAM_INIT /* Initializing DRAM backups */
+};
+
+/* ---> */
+/*************************************************
+ Startup identification
+*************************************************/
+enum {
+ INI_CND_UNSET = 0, /* Startup identification value not set */
+ INI_CND_UNKNOWN, /* Startup identification unknown */
+ INI_CND_CLSTART, /* COLD START */
+ INI_CND_HTSTART, /* HOT START */
+ INI_CND_ERRRESET, /* Error Reset */
+ INI_CND_USERCL /* User-specified COLD */
+};
+
+/*************************************************
+ Startup Security State
+*************************************************/
+enum {
+ INI_ANTITHEFT_UNSET = 0, /* Not set condition */
+ INI_ANTITHEFT_UNLOCK, /* Unlocked status */
+ INI_ANTITHEFT_LOCK, /* Lock state */
+ INI_ANTITHEFT_INITIAL /* Initial state(Not used) */
+};
+
+/*************************************************
+ Version upgrade completion information
+*************************************************/
+enum {
+ INI_VUP_INFO_UNSET = 0, /* VUP information not set */
+ INI_VUP_INFO_NORMAL, /* VUP Information Normal(VUP not executed) */
+ INI_VUP_INFO_ERROR, /* VUP information error(VUP incomplete) */
+ INI_VUP_INFO_VUPFIN /* Completion of VUP information */
+};
+
+/*************************************************
+ +B Disconnect Information
+*************************************************/
+enum {
+ INI_BATTERY_INFO_UNSET = 0, /* +B Information not set */
+ INI_BATTERY_INFO_NORMAL, /* +B Information Normal(no disconnected) */
+ INI_BATTERY_INFO_DISCON /* +B Information with disconnected */
+};
+
+/*************************************************
+ User information initialization information
+*************************************************/
+enum {
+ INI_INITUSERDAT_UNSET = 0, /* User information not set */
+ INI_INITUSERDAT_ON, /* Personal Information Initialization Status Setting ON */
+ INI_INITUSERDAT_OFF /* Personal information initialization status setting OFF */
+};
+
+/*************************************************
+ DRAM back-up status at startup
+*************************************************/
+enum {
+ INI_DRAMBKUP_UNSET = 0, /* DRAM back-up status not set */
+ INI_DRAMBKUP_OK, /* DRAM back-up status OK */
+ INI_DRAMBKUP_NG /* DRAM backup status NG */
+};
+
+/****** STRUCT ******/
+/*************************************************
+ Startup system information
+*************************************************/
+typedef struct {
+ u_int8 boot_type; /* Startup identification */
+ u_int8 security_sts; /* Startup Security State */
+ u_int8 vup_info; /* Version upgrade completion information */
+ u_int8 battery_off_info; /* +B Disconnect Information */
+ u_int8 usrdat_init_info; /* User data initialization information */
+ u_int8 dram_bup_sts; /* DRAM back-up status */
+ u_int8 reserve[2]; /* Reserved */
+ u_int32 boot_time; /* Passed Time */
+} T_INI_BOOTINFO;
+
+/* <--- */
+
+/*
+***** STRUCTURE *****
+*/
+/******************************************************************************
+* TAG : T_PRIM_FORKCOMP
+* ABSTRACT : Stage-up completion notification structure
+* NOTE : Body portion of messages generated from API (Staged Start Completion Notification)
+******************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER head; /* Message buffer header */
+ u_int32 id; /* ID for start phase completion notification */
+} T_PRIM_FORKCOMP;
+
+/******************************************************************************
+* TAG : T_PRIM_ACCOFFSTART
+* ABSTRACT : Structures for ACC-OFF Process Instructions
+* NOTE : Body of messages generated from API(ACC-OFF process instructions)
+******************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER head; /* Message buffer header */
+ u_int32 id; /* ID for start phase completion notification */
+} T_PRIM_ACCOFFSTART;
+
+/******************************************************************************
+* TAG : T_PRIM_ACCOFFCOMP
+* ABSTRACT : Structures for notifying completion of ACC-OFF process
+* NOTE : Main body of messages generated from API(ACC-OFF process completion notification)
+******************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER head; /* Message buffer header */
+ u_int32 id; /* Identifier for notifying completion of ACC-OFF process */
+} T_PRIM_ACCOFFCOMP;
+
+/******************************************************************************
+* TAG : T_PRIM_INTERNAL_ACCOFFSTART
+* ABSTRACT : Structures for in-function ACC-OFF indication
+* NOTE : Body portion of messages generated from API (notification of completion of ACC-OFF process in function)
+******************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER head; /* Message buffer header */
+ u_int32 id; /* Identifier for notifying completion of ACC-OFF process */
+} T_PRIM_INTERNAL_ACCOFFSTART;
+
+/******************************************************************************
+* TAG : T_PRIM_INTERNAL_ACCOFFCOMP
+* ABSTRACT : Structures for notifying completion of ACC-OFF in functions
+* NOTE : Body portion of messages generated from NOTEAPI (notification of completion of ACC-OFF process in function)
+******************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER head; /* Message buffer header */
+ u_int32 id; /* Identifier for notifying completion of ACC-OFF process */
+} T_PRIM_INTERNAL_ACCOFFCOMP;
+
+/*
+***** PROTOTYPE *****
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int32 IniInternalAccOffComp(PNO pno , u_int32 id);
+void IniNotifyInit_CWORD69_Comp(void);
+void IniWaitInit_CWORD69_Comp(void);
+BOOL IniIsInit_CWORD69_Comp(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_INI_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Naviinfo_API.h b/video_in_hal/vehicleservice/positioning/client/include/Naviinfo_API.h
new file mode 100755
index 0000000..12caa84
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Naviinfo_API.h
@@ -0,0 +1,110 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+@file Naviinfo_API.h
+@detail Naviinfo_API external header file<BR>
+ Naviinfo_API External Public Header
+******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_NAVIINFO_API_H_
+#define POSITIONING_CLIENT_INCLUDE_NAVIINFO_API_H_
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "Sensor_Common_API.h"
+#include "Vehicle_API.h"
+#include "Sensor_API.h"
+#include <vehicle_service/POS_gps_API.h>
+
+/*****************************************************************************
+ * Define *
+ *****************************************************************************/
+/* Command ID Definition */
+#define CID_NAVIINFO_DELIVER (0x0205) /* Navigation information setting CID */
+#define CID_NAVIINFO_SPEED_DELIVER (0x0206) /* Vehicle speed setting CID */
+#define CID_NAVIINFO_SETGPSTIME (0x0207) /* GPS time delivery CID */
+
+/* Positioning Level/GPS Information Positioning Status Information Definition */
+#define NAVIINFO_DIAG_GPS_FIX_STS_NON (0) /* Not fix */
+#define NAVIINFO_DIAG_GPS_FIX_STS_2D (1) /* 2D positioning */
+#define NAVIINFO_DIAG_GPS_FIX_STS_3D (2) /* 3D positioning */
+
+/* Reception status definition */
+#define NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE (0) /* Not used */
+#define NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING (1) /* Searching */
+#define NAVIINFO_DIAG_GPS_RCV_STS_TRACHING (2) /* Tracking in progress */
+#define NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX (3) /* Positioning not used */
+#define NAVIINFO_DIAG_GPS_RCV_STS_USEFIX (4) /* Positioning use */
+
+/* Date and Time Status Definition */
+#define NAVIINFO_NAVI_GPS_TD_STS_NOTFIX (0)
+/* Time not calibrated after receiver reset */
+#define NAVIINFO_NAVI_GPS_TD_STS_RTCBACKUP (1)
+/* Time output by RTC backup(Time Calibration Result)*/
+#define NAVIINFO_NAVI_GPS_TD_STS_FIX (2) /* Time calibration completed */
+
+/* ++ Porting from PastModel002 enabled APIs */
+#define CID_VEHICLEIF_GET_VEHICLE_DATA 0x0102 /* Vehicle sensor information acquisition CID */
+#define CID_VEHICLEIF_COMM_WATCH 0x0103 /* Vehicle Sensor Information Disruption Monitoring CID */
+#define CID_SENSORIF__CWORD82__REQUEST 0x0800 /* Vehicle sensor information setting CID */
+
+#define VEHICLE_RET_ERROR_OUTOF_MEMORY (-8) /* Shared memory allocation failure */
+#define VEHICLE_RET_ERROR_INVALID (-10) /* CANID undetermined */
+
+/* -- Porting from PastModel002 enabled APIs */
+
+/*****************************************************************************
+ * Typedef *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Struct *
+ *****************************************************************************/
+/*****************************************************************************
+ * TAG : NAVIINFO_DELIVER_MSG
+ * ABSTRACT : Navigation information delivery message structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ NAVIINFO_ALL dat; /* Message data section */
+} NAVIINFO_DELIVER_MSG;
+
+/*****************************************************************************
+ * TAG : NAVIINFO_SPEED_DELIVER_MSG
+ * ABSTRACT : Navigation Information (Vehicle Speed) Delivery Message Structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int16 navi_speed; /* Vehicle speed information */
+ u_int8 reserve[2]; /* reserve */
+} NAVIINFO_SPEED_DELIVER_MSG;
+
+/*****************************************************************************
+* Function prototype *
+*****************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int32 VehicleSetVehicleData(PNO pid, VEHICLE_MSG_SEND_DAT *p_data);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_NAVIINFO_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/POS_common_private.h b/video_in_hal/vehicleservice/positioning/client/include/POS_common_private.h
new file mode 100755
index 0000000..4dd98a2
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/POS_common_private.h
@@ -0,0 +1,62 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * POS_common_private.h
+ * @brief
+ * Definition for Common Internal I/F Liblary
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_POS_COMMON_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_POS_COMMON_PRIVATE_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/*--- for message ---*/
+/*
+ * Maximum receive message size
+ * - Set the value based on the message receiving buffer size of the local thread
+ */
+#define MAX_MSG_BUF_SIZE (4096)
+
+/* command ID */
+#define CID_POSIF_SET_DATA 0x0790 /* set data command ID */
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_POS_COMMON_PRIVATE_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/POS_private.h b/video_in_hal/vehicleservice/positioning/client/include/POS_private.h
new file mode 100755
index 0000000..9f02202
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/POS_private.h
@@ -0,0 +1,981 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * POS_private.h
+ * @brief
+ * Inner functions of Positoning API
+ *
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_POS_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_POS_PRIVATE_H_
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_define.h>
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+#include "Naviinfo_API.h"
+#include "POS_common_private.h"
+#include <asm/unistd.h>
+#include <other_service/VP_GetEnv.h>
+#include <other_service/env_vehicleparameterlibrary.h>
+#include "CommonDefine.h"
+/*---------------------------------------------------------------------------------*
+ * Function Prototype *
+ *---------------------------------------------------------------------------------*/
+/* Shared Library Value Area Check Function */
+inline UNIT_TYPE GetEnvSupportInfo(void);
+inline BOOL ChkUnitType(UNIT_TYPE type);
+inline RET_API MunMapDeviceIo(HANDLE dev, uint32_t map_size);
+inline RET_API MilliSecSleep(uint32_t mill_time);
+inline POS_RET_API PosChkParam8(int8_t data, int8_t min, int8_t max, const char* fn, int32_t line);
+inline POS_RET_API PosChkParam16(int16_t data, int16_t min, int16_t max, const char* fn, int32_t line);
+inline POS_RET_API PosChkParam32(int32_t data, int32_t min, int32_t max, const char* fn, int32_t line);
+inline POS_RET_API PosChkParamU8(uint8_t data, uint8_t min, uint8_t max, const char* fn, int32_t line);
+inline POS_RET_API PosChkParamU16(uint16_t data, uint16_t min, uint16_t max, const char* fn, int32_t line);
+inline POS_RET_API PosChkParamU32(uint32_t data, uint32_t min, uint32_t max, const char* fn, int32_t line);
+
+/* Shared Intra-Library Core Functions */
+inline POS_RET_API PosSetProc(DID did, void *p_data, uint16_t size, uint8_t is_event);
+inline POS_RET_API PosGetProc(DID did, void *p_data, uint16_t dest_size);
+inline SENSOR_RET_API PosRegisterListenerProc(PCSTR notify_name,
+ DID did, u_int8 ctrl_flg, u_int8 delivery_timing);
+
+/* General Functions in Shared Libraries */
+inline EventID VehicleCreateEvent(PNO pno);
+inline RET_API VehicleDeleteEvent(EventID event_id);
+inline RET_API VehicleLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset);
+inline RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, uint16_t offset);
+inline RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data);
+inline BOOL VehicleGetResource(void);
+inline void VehicleReleaseResource(void);
+inline uint32_t GetTid(void);
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+#define POS_CHKPARAM8(data, min, max) PosChkParam8(data, min, max, __func__, __LINE__)
+#define POS_CHKPARAM16(data, min, max) PosChkParam16(data, min, max, __func__, __LINE__)
+#define POS_CHKPARAM32(data, min, max) PosChkParam32(data, min, max, __func__, __LINE__)
+#define POS_CHKPARAMU8(data, min, max) PosChkParamU8(data, min, max, __func__, __LINE__)
+#define POS_CHKPARAMU16(data, min, max) PosChkParamU16(data, min, max, __func__, __LINE__)
+#define POS_CHKPARAMU32(data, min, max) PosChkParamU32(data, min, max, __func__, __LINE__)
+#define POS_API_TIME_OUT_MS 5000 /* Timeout period(ms) */
+
+/*---------------------------------------------------------------------------------*
+ * Inline Functions *
+ *---------------------------------------------------------------------------------*/
+UNIT_TYPE GetEnvSupportInfo(void) {
+ UNIT_TYPE ret_type = UNIT_TYPE_GRADE1;
+
+ char env_area[VP_MAX_LENGTH];
+ char env_grade[VP_MAX_LENGTH];
+ char* p_env_grade = env_grade;
+ char* p_env_area = env_area;
+
+ /*
+ * Note.
+ * This feature branches processing depending on the area and grade type.
+ */
+
+ VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_AREA, p_env_area);
+
+ if (0 == strcmp(p_env_area, "AREA1")) {
+ ret_type = UNIT_TYPE_GRADE2;
+ } else if (0 == strcmp(p_env_area, "AREA2")) {
+ memset(&env_grade, 0x00, sizeof(env_grade));
+ VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_GRADE, p_env_grade);
+ if (0 == strcmp(p_env_grade, "_CWORD95_") ||
+ 0 == strcmp(p_env_grade, "_CWORD101_") ||
+ 0 == strcmp(p_env_grade, "_CWORD61_")) {
+ ret_type = UNIT_TYPE_GRADE2;
+ }
+ } else {
+ // NOP
+ }
+
+ return ret_type;
+}
+
+BOOL ChkUnitType(UNIT_TYPE type) {
+ UNIT_TYPE type_temp;
+ BOOL ret;
+
+ type_temp = GetEnvSupportInfo();
+ if ((type_temp & type) != 0) {
+ ret = TRUE;
+ } else {
+ ret = FALSE;
+ }
+
+ return ret;
+}
+
+RET_API MunMapDeviceIo(HANDLE dev, uint32_t map_size) {
+ return RET_NORMAL;
+}
+
+RET_API MilliSecSleep(uint32_t mill_time) {
+ switch (mill_time) {
+ case 0:
+ {
+ /* Discard the time slice */
+ sched_yield();
+ break;
+ }
+ case INFINITE:
+ {
+ /* Abort processing indefinitely */
+ while (1) {
+ sleep(INFINITE);
+ }
+ }
+ default:
+ /* Sleep for Specified Time */
+ usleep(mill_time * 1000);
+ break;
+ }
+
+ return RET_NORMAL;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(int8)
+ *
+ * @param[in] date int8_t Object data
+ * @param[in] min int8_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max int8_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParam8(int8_t data, int8_t min, int8_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%d[%d, %d]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(int16)
+ *
+ * @param[in] date int16_t Object data
+ * @param[in] min int16_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max int16_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParam16(int16_t data, int16_t min, int16_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%d[%d, %d]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(int32)
+ *
+ * @param[in] date int32_t Object data
+ * @param[in] min int32_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max int32_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParam32(int32_t data, int32_t min, int32_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%d[%d, %d]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(unsigned int8)
+ *
+ * @param[in] date uint8_t Object data
+ * @param[in] min uint8_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max uint8_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParamU8(uint8_t data, uint8_t min, uint8_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%u[%u, %u]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(unsigned int16)
+ *
+ * @param[in] date uint16_t Object data
+ * @param[in] min uint16_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max uint16_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParamU16(uint16_t data, uint16_t min, uint16_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%u[%u, %u]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data Valid Value Determination(unsigned int32)
+ *
+ * @param[in] date uint32_t Object data
+ * @param[in] min uint32_t Target Data Valid Value Range(Minimum value)
+ * @param[in] max uint32_t Target Data Valid Value Range(Maximum value)
+ * @param[in] fn const char* Pointer to the function name
+ * @param[in] line int32_t Number of lines
+ *
+ * @return POS_RET_NORMAL Within the valid range<br>
+ * POS_RET_ERROR Out of scope<br>
+ * POS_RET_ERROR_PARAM Argument error
+ */
+inline POS_RET_API PosChkParamU32(uint32_t data, uint32_t min, uint32_t max, const char* fn, int32_t line) {
+ POS_RET_API ret = POS_RET_NORMAL;
+
+ if (fn == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Argument ERROR!! fn=%p", fn);
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ if ((data < min) || (max < data)) {
+ ret = POS_RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "%s/%d/Out of range!! data=%u[%u, %u]",
+ fn, line, data, min, max);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Data setting process(Internal processing)
+ *
+ * Set the specified information
+ *
+ * @param[in] did DID - Data ID
+ * @param[in] p_data void* - Configuration data
+ * @param[in] size uint16_t - Setting data size
+ * @param[in] is_event uint8_t - Event wait status(TRUE/FALSE)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_INNER Internal error
+ */
+inline POS_RET_API PosSetProc(DID did, void *p_data, uint16_t size, uint8_t is_event) {
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ RET_API ret_api = RET_NORMAL; /* API return value */
+ POS_MSGINFO snd_msg; /* Message */
+ EventID event_id; /* Event ID */
+ int32_t event_val; /* Event value */
+ PNO pno; /* Calling thread PNO */
+ uint32_t pid; /* Process ID */
+ uint32_t tid; /* Thread ID */
+ char name[128];
+
+ /* Data size check */
+ if (POS_MSG_INFO_DSIZE < size) {
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+ /* Message data */
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Initialization of areas that do not contain values */
+ snd_msg.pno = 0;
+ snd_msg.rcv_flag = 0;
+ snd_msg.reserve = 0;
+
+ snd_msg.did = did;
+ snd_msg.size = size;
+ memcpy(snd_msg.data, p_data, size);
+
+ if (TRUE == is_event) {
+ /* After requesting data setting,Wait for the setting completion(Event Wait) */
+
+ /* Event Generation */
+ pid = static_cast<uint32_t>(getpid());
+ tid = GetTid();
+
+ snprintf(name, sizeof(name), "PS_p%u_t%u", pid, tid);
+ pno = _pb_CnvName2Pno(name);
+ event_id = VehicleCreateEvent(pno);
+
+ /* Set the source Pno of message data */
+ snd_msg.pno = pno;
+
+ if (0 != event_id) {
+ /* Successful event generation */
+
+ /* Send NAVI Sensor Data Setting to Vehicle Sensor */
+ ret_api = VehicleSndMsg(pno,
+ PNO_VEHICLE_SENSOR,
+ CID_POSIF_SET_DATA,
+
+ (uint16_t)sizeof(POS_MSGINFO) - POS_MSG_INFO_DSIZE + snd_msg.size, /* variable length */
+ (const void *)&snd_msg);
+
+ if (RET_NORMAL == ret_api) {
+ /* If the data setup process is successful,Wait for a completion event */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN,
+ VEHICLE_RET_NORMAL, &event_val, POS_API_TIME_OUT_MS);
+ if (RET_NORMAL != ret_api) {
+ /* Return an internal error */
+ ret = POS_RET_ERROR_INNER;
+ } else {
+ /* Return from Event Wait */
+ /* Set event value (processing result) as return value */
+ ret = (POS_RET_API)event_val;
+ }
+ } else {
+ /* Message transmission processing failed */
+ ret = POS_RET_ERROR_INNER;
+ }
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ ret = POS_RET_ERROR_INNER;
+ }
+ } else {
+ /* After setting data,Immediate termination */
+
+ /* Send NAVI Sensor Data Setting to Vehicle Sensor */
+ ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_POSIF_SET_DATA,
+ sizeof(POS_MSGINFO), reinterpret_cast<void*>(&snd_msg), 0);
+ if (ret_api != RET_NORMAL) {
+ /* Message transmission failure */
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+ } else {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Sensor information acquisition(Internal processing)
+ *
+ * @param[in] did DID - Data ID for vehicle information
+ * @param[in] p_data void* - Pointer representing the storage destination of vehicle sensor information
+ * @param[in] dest_size uint16_t - Storage destination size of vehicle sensor information(byte)
+ *
+ * @return 0 or more Stored data size(Include illegal)<br>
+ * POS_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * POS_RET_ERROR_OUTOF_MEMORY Shared memory allocation failed<br>
+ * POS_RET_ERROR_SIZE Storage destination size error<br>
+ * POS_RET_ERROR_DID Unregistered ID<br>
+ */
+inline POS_RET_API PosGetProc(DID did, void *p_data, uint16_t dest_size) {
+ POS_RET_API ret; /* Return value */
+ RET_API ret_api; /* System API return value */
+ EventID event_id; /* Event ID */
+ int32_t event_val; /* Event value */
+ void *share_top; /* Start address of shared memory */
+ uint32_t share_size; /* Size of shared memory area */
+ uint16_t offset; /* Offset to free shared memory area */
+ VEHICLE_SHARE_BLOCK_DAT *share_dat; /* Address of free shared memory area */
+ VEHICLE_MSG_GET_VEHICLE_DATA_DAT data; /* Message data */
+ PNO pno; /* Calling thread PNO */
+ uint32_t pid; /* Process ID */
+ uint32_t tid; /* Thread ID */
+ char name[128];
+
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+ /* Initialization */
+ event_id = 0;
+ event_val = 0;
+ memset(reinterpret_cast<void *>(&data), 0, sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT));
+
+ /* Event Generation */
+ pid = static_cast<uint32_t>(getpid());
+ tid = GetTid();
+
+ snprintf(name, sizeof(name), "PG_p%u_t%u", pid, tid);
+ pno = _pb_CnvName2Pno(name);
+ event_id = VehicleCreateEvent(pno);
+
+ if (0 != event_id) {
+ /* Successful event generation */
+
+ /* Allocate shared memory */
+ ret_api = VehicleLinkShareData(reinterpret_cast<void **>(&share_top), &share_size, &offset);
+ if (RET_NORMAL != ret_api) {
+ /* Failed to allocate shared memory */
+ ret = POS_RET_ERROR_OUTOF_MEMORY;
+ } else { /* When the shared memory is allocated successfully */
+ /* Calculate start address of free shared memory area */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top)
+ + offset);
+
+ /* Send vehicle sensor information acquisition message */
+ data.did = did;
+ data.pno = pno;
+ data.offset = offset;
+ data.size = VEHICLE_SHARE_BLOCK_DSIZE;
+
+ /* Messaging */
+ ret_api = VehicleSndMsg(pno,
+ PNO_VEHICLE_SENSOR,
+ CID_VEHICLEIF_GET_VEHICLE_DATA,
+ sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT), (const void *)&data);
+
+ /* Message transmission processing is successful */
+ if (RET_NORMAL == ret_api) {
+ /* Wait for completion event from vehicle sensor thread */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN,
+ VEHICLE_RET_NORMAL, &event_val, POS_API_TIME_OUT_MS);
+
+ if (RET_NORMAL != ret_api) {
+ /* Return an internal error */
+ ret = POS_RET_ERROR_INNER;
+ } else { /* Return from Event Wait */
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME),
+ &share_top, &share_size);
+
+ /* Calculate the address of the shared memory storage area. */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top)
+ + offset);
+
+ if (event_val < 0) {
+ /* Vehicle sensor information acquisition failure */
+ ret = (VEHICLE_RET_API)event_val;
+ } else if (RET_NORMAL != ret_api) {
+ /* Shared memory error */
+ ret = POS_RET_ERROR_OUTOF_MEMORY;
+ } else if (dest_size < share_dat->size) {
+ /* Storage destination size error */
+ ret = POS_RET_ERROR_SIZE;
+ } else { /* Vehicle sensor information acquisition success */
+ /* Copy from shared memory to user memory */
+ memcpy(p_data, share_dat->data, (size_t)share_dat->size);
+
+ /* Set Write Size to Return Value */
+ ret = static_cast<int32>(share_dat->size);
+ }
+ }
+ } else { /* Message transmission processing failed */
+ /* Return an event generation failure */
+ ret = POS_RET_ERROR_CREATE_EVENT;
+ }
+ /* Free shared memory */
+ (void)VehicleUnLinkShareData(reinterpret_cast<VEHICLE_SHARE*>(share_top), offset);
+ }
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ ret = POS_RET_ERROR_CREATE_EVENT;
+ }
+ } else {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Delivery registration process(Internal processing)
+ *
+ * @param[in] notify_name Destination thread name
+ * @param[in] did Pointer to an array of data IDs for vehicle information
+ * @param[in] ctrl_flg Delivery control<br>
+ * Delivery registration: SENSOR_DELIVERY_REGIST<br>
+ * Delivery stop: SENSOR_DELIVERY_STOP (Note: Not mounted)<br>
+ * Resume delivery: SENSOR_DELIVERY_RESTART (Note: Not mounted)
+ * @param[in] delivery_timing Delivery timing<br>
+ * Updating : SENSOR_DELIVERY_TIMING_UPDATE<br>
+ * Changing : SENSOR_DELIVERY_TIMING_CHANGE
+ *
+ * @return SENSOR_RET_NORMAL Successful registration<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_DID Unregistered ID<br>
+ * SENSOR_RET_ERROR_BUFFULL FULL of delivery registers<br>
+ * SENSOR_RET_ERROR_INNER Internal abnormality<br>
+ */
+inline SENSOR_RET_API PosRegisterListenerProc(PCSTR notify_name, DID did, u_int8 ctrl_flg, u_int8 delivery_timing) {
+ SENSOR_RET_API ret; /* Return value */
+ RET_API ret_api; /* System API return value */
+ EventID event_id; /* Event ID */
+ int32 event_val; /* Event value */
+ VEHICLE_MSG_DELIVERY_ENTRY_DAT data; /* Message data */
+ PNO pno; /* Converted internal PNO */
+
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+ /* Initialization */
+ event_id = 0;
+ event_val = 0;
+
+ /* Get PNO from Thread Name */
+ pno = _pb_CnvName2Pno(notify_name);
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(pno);
+
+ if (0 != event_id) {
+ /* Successful event generation */
+
+ /*--------------------------------------------------------------*
+ * Send Vehicle Sensor Information Delivery Registration Message *
+ *--------------------------------------------------------------*/
+ /* Create Message Data */
+ data.did = did;
+ data.pno = pno;
+ data.delivery_timing = delivery_timing;
+ data.ctrl_flg = ctrl_flg;
+ data.event_id = event_id;
+
+ /* Messaging */
+ ret_api = VehicleSndMsg(pno,
+ PNO_VEHICLE_SENSOR,
+ CID_VEHICLEIF_DELIVERY_ENTRY,
+ (uint16_t)sizeof(VEHICLE_MSG_DELIVERY_ENTRY_DAT), (const void *)&data);
+
+ if (RET_NORMAL == ret_api) {
+ /* Message transmission processing is successful */
+ /* Wait for completion event from vehicle sensor thread */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN,
+ VEHICLE_RET_NORMAL, &event_val, POS_API_TIME_OUT_MS);
+ if (RET_NORMAL != ret_api) {
+ /* Return an internal error */
+ ret = SENSOR_RET_ERROR_INNER;
+ } else {
+ /* Return from Event Wait */
+ /* Set event value (processing result) as return value */
+ ret = (SENSOR_RET_API)event_val;
+ }
+ } else {
+ /* Message transmission processing failed */
+ /* Return an internal error */
+ ret = SENSOR_RET_ERROR_INNER;
+ }
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ ret = SENSOR_RET_ERROR_CREATE_EVENT;
+ }
+ } else {
+ /* Insufficient resource */
+ ret = SENSOR_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : VehicleCreateEvent
+ * ABSTRACT : Event creation process
+ * FUNCTION : Generate an event
+ * ARGUMENT : pno : Thread ID
+ * NOTE :
+ * RETURN : Non-zero : Event ID
+ * : Zero : Event generation failure
+ ******************************************************************************/
+inline EventID VehicleCreateEvent(PNO pno) {
+ EventID event_id; /* Event ID */
+ char event_name[32]; /* Event name character string buffer */
+ RET_API ret_api; /* System API return value */
+
+
+ /* Initialization of event name character string buffer */
+ memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name));
+ /* Event name creation */
+ snprintf(event_name, sizeof(event_name), "VEHICLE_%X", pno);
+
+ /* Event Generation */
+ event_id = _pb_CreateEvent(FALSE, 0, event_name);
+
+ if (0 != event_id) {
+ /* For successful event generation */
+
+ /* Initialize the event */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, VEHICLE_EVENT_VAL_INIT);
+ if (RET_NORMAL != ret_api) {
+ /* Event initialization failed */
+ /* Delete Event and Return Event Generation Failed */
+ ret_api = VehicleDeleteEvent(event_id);
+ event_id = 0;
+ }
+ }
+
+ return(event_id);
+}
+
+/*******************************************************************************
+ * MODULE : VehicleDeleteEvent
+ * ABSTRACT : Event deletion processing
+ * FUNCTION : Delete events
+ * ARGUMENT : event_id : Event ID of the event to delete
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_EV_NONE : Specified event does not exist
+ ******************************************************************************/
+inline RET_API VehicleDeleteEvent(EventID event_id) {
+ return(_pb_DeleteEvent(event_id));
+}
+
+/*******************************************************************************
+ * MODULE : VehicleLinkShareData
+ * ABSTRACT : Link to shared memory
+ * FUNCTION : Link to shared memory
+ * ARGUMENT : **share_top : Storage destination of shared memory top address
+ * : *share_size : Storage destination of shared memory area size
+ * : *offset : Offset storage destination to free shared memory area
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERROR : There is no shared memory area.
+ ******************************************************************************/
+inline RET_API VehicleLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset) {
+ RET_API ret_api; /* System API return value */
+ SemID sem_id; /* Semaphore ID */
+ VEHICLE_SHARE *share_top_tmp;
+ int32 i;
+
+ /* Initialization */
+ ret_api = RET_ERROR;
+
+ /* Create Semaphore */
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(VEHICLE_SEMAPHO_NAME));
+ if (0 != sem_id) {
+ /* Semaphore Lock */
+ ret_api = _pb_SemLock(sem_id);
+ if (RET_NORMAL == ret_api) {
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME), share_top, share_size);
+ if (RET_NORMAL == ret_api) {
+ /* By searching the free shared memory area,Offset is calculated if there is free space. */
+ share_top_tmp = reinterpret_cast<VEHICLE_SHARE *>(*share_top);
+
+ /* Because the first block of the shared memory area is the control area,Loop from i = 1 */
+ for (i = 1; i < VEHICLE_SHARE_BLOCK_NUM; i++) {
+ if (VEHICLE_SHARE_UNLOCK == share_top_tmp->mng.lock_info[i]) {
+ break;
+ }
+ }
+ if (i < VEHICLE_SHARE_BLOCK_NUM) {
+ /* Empty space */
+ /* Lock the block */
+ share_top_tmp->mng.lock_info[i] = VEHICLE_SHARE_LOCK;
+
+ /* Calculate the offset to the block */
+ *offset = static_cast<u_int16>(i * VEHICLE_SHARE_BLOCK_SIZE);
+
+ /* Normal completion */
+ ret_api = RET_NORMAL;
+ } else {
+ /* No free space */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Failed link to shared memory */
+ ret_api = RET_ERROR;
+ }
+ /* Semaphore unlock */
+ _pb_SemUnlock(sem_id);
+ } else {
+ /* Semaphore lock failed */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Semaphore creation failed */
+ ret_api = RET_ERROR;
+ }
+
+ return(ret_api);
+}
+
+/*******************************************************************************
+ * MODULE : VehicleUnLinkShareData
+ * ABSTRACT : Unlinking shared memory
+ * FUNCTION : Unlink shared memory
+ * ARGUMENT : *share_top : Start address of shared memory
+ * : offset : Offset to shared memory free area
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERROR : There is no shared memory area./semaphore error
+ ******************************************************************************/
+inline RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, uint16_t offset) {
+ RET_API ret_api; /* System API return value */
+ SemID sem_id; /* Semaphore ID */
+ int32 i;
+
+ /* Initialization */
+ ret_api = RET_ERROR;
+
+ /* Create Semaphore */
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(VEHICLE_SEMAPHO_NAME));
+ if (0 != sem_id) {
+ /* Semaphore Lock */
+ ret_api = _pb_SemLock(sem_id);
+ if (RET_NORMAL == ret_api) {
+ /* Unlock the block */
+ i = static_cast<int32>(offset) / VEHICLE_SHARE_BLOCK_SIZE;
+ share_top->mng.lock_info[i] = VEHICLE_SHARE_UNLOCK;
+
+ /* Semaphore unlock */
+ _pb_SemUnlock(sem_id);
+
+ /* Normal completion */
+ ret_api = RET_NORMAL;
+ } else {
+ /* Semaphore lock failed */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Semaphore creation failed */
+ ret_api = RET_ERROR;
+ }
+
+ return(ret_api);
+}
+
+/*******************************************************************************
+ * MODULE : VehicleSndMsg
+ * ABSTRACT : Message transmission processing
+ * FUNCTION : Send a message to the specified PNO
+ * ARGUMENT : pno_src : Source PNO
+ * : pno_dest : Destination PNO
+ * : cid : Command ID
+ * : msg_len : Message data body length
+ * : *msg_data : Pointer to message data
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERRNOTRDY : Destination process is not wakeup
+ * : RET_ERRMSGFULL : Message queue overflows
+ * : RET_ERRPARAM : Buffer size error
+ ******************************************************************************/
+inline RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data) {
+ VEHICLE_MSG_BUF msg_buf; /* message buffer */
+ T_APIMSG_MSGBUF_HEADER *msg_hdr; /* Pointer to the message header */
+ RET_API ret_api; /* Return value */
+ PCSTR thread_name; /* Destination thread name */
+
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "+ [pno_src = 0x%x, pno_dest = 0x%x]", pno_src, pno_dest);
+
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Initializing the header of the message buffer */
+ memset(reinterpret_cast<void *>(&msg_buf.hdr), 0, sizeof(T_APIMSG_MSGBUF_HEADER));
+
+ /* Get pointer to send buffer */
+ msg_hdr = reinterpret_cast<T_APIMSG_MSGBUF_HEADER *>(reinterpret_cast<void *>(&msg_buf));
+
+ /*--------------------------------------------------------------*
+ * Create message headers *
+ *--------------------------------------------------------------*/
+ msg_hdr->hdr.sndpno = pno_src; /* Source PNO */
+ msg_hdr->hdr.cid = cid; /* Command ID */
+ msg_hdr->hdr.msgbodysize = msg_len; /* Message data body length */
+
+ /*--------------------------------------------------------------*
+ * Create message data *
+ *--------------------------------------------------------------*/
+ if ((0 != msg_data) && (0 != msg_len)) {
+ /* Set the message data */
+ memcpy(reinterpret_cast<void *>(msg_buf.data), msg_data, (size_t)msg_len);
+ }
+ /*--------------------------------------------------------------*
+ * Send messages *
+ *--------------------------------------------------------------*/
+ /* Get Thread Name from PNO */
+ if (pno_dest <= SYS_PNO_MAX) {
+ thread_name = POS_THREAD_NAME;
+ } else {
+ thread_name = _pb_CnvPno2Name(pno_dest);
+ }
+
+ if ((pno_dest <= SYS_PNO_MAX) && (pno_src <= SYS_PNO_MAX)) {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "[LOG pno_dest = 0x%x]", pno_dest);
+
+ /* Internal Process Transmission and Reception Messages */
+ ret_api = _pb_SndMsg(pno_dest,
+ (uint16_t)(sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len),
+ reinterpret_cast<void *>(&msg_buf), 0);
+ } else {
+ /* External Process Transmission and Reception Messages */
+ ret_api = _pb_SndMsg_Ext(thread_name,
+ cid,
+ (uint16_t)(msg_len), /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ reinterpret_cast<void *>(&(msg_buf.data)), 0);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+
+ return(ret_api);
+}
+
+/**
+ * @brief
+ * Resource Acquisition Decision
+ *
+ * @param[in] none
+ *
+ * @return TRUE Normal<br>
+ * FALSE Abnormality(Insufficient resource)
+ */
+inline BOOL VehicleGetResource(void) {
+ BOOL ret[4] = {TRUE, TRUE, TRUE, TRUE};
+ uint8_t idx;
+
+ ret[1] = _pb_GetMsgResource();
+ ret[2] = _pb_GetMutexResource();
+ ret[3] = _pb_GetOtherResource();
+
+ for (idx = 1; idx < 4; idx++) {
+ if (ret[idx] == FALSE) {
+ ret[0] = FALSE;
+ }
+ }
+
+ return ret[0];
+}
+
+/**
+ * @brief
+ * Resource release
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+inline void VehicleReleaseResource(void) {
+ _pb_ReleaseMsgResource();
+ _pb_ReleaseMutexResource();
+ _pb_ReleaseOtherResource();
+
+ return;
+}
+
+inline uint32_t GetTid(void) {
+ return (uint32_t)syscall(__NR_gettid);
+}
+
+
+#endif // POSITIONING_CLIENT_INCLUDE_POS_PRIVATE_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/POS_sensor_private.h b/video_in_hal/vehicleservice/positioning/client/include/POS_sensor_private.h
new file mode 100755
index 0000000..1e1497f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/POS_sensor_private.h
@@ -0,0 +1,163 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_POS_SENSOR_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_POS_SENSOR_PRIVATE_H_
+/******************************************************************************
+ * file name :POS_sensor_private.h
+ * system name :Positioning
+ * sub system name :Positioning internal interface library
+ ******************************************************************************/
+
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/pos_message_header.h>
+#include <native_service/frameworkunified_types.h>
+/************************************************************************
+* definition *
+************************************************************************/
+/*----------------------------------------------------------------------*
+ * for message *
+ *----------------------------------------------------------------------*/
+/* command ID */
+#define CID_SENSOR_PKG_INFO 0x0700 /* vehicle sensor package notification ID */
+
+/*----------------------------------------------------------------------*
+ * definition for GPS response *
+ *----------------------------------------------------------------------*/
+#define GPS_BUFFERFUL 2 /* transmit buffer full(rejection) */
+#define GPS_INITIAL 3 /* initialization state(rejection) */
+#define GPS_CONNECTNG 4 /* connection error(rejection) */
+
+/*----------------------------------------------------------------------*
+ * definition clock status *
+ *----------------------------------------------------------------------*/
+#define CLOCK_VALID (1U)
+#define CLOCK_INVALID (0U)
+
+/*----------------------------------------------------------------------*
+ * Message Related Extensions *
+ *----------------------------------------------------------------------*/
+#define CID_SENSORIF_SET_GPSTIME 0x0701 /* GPS time information setting CID */
+
+/*----------------------------------------------------------------------*
+ * GPS version-related definitions *
+ *----------------------------------------------------------------------*/
+#define GPS__CWORD82__VERSION_LEN (7U) /* _CWORD82_ version data length */
+
+/************************************************************************
+* struct declaration *
+************************************************************************/
+/************************************************************************
+* TAG : SENSOR_MSG_DELIVERY_ENTRY
+* ABSTRACT : vehicle sensor delivery message (to vehicle sensor)
+************************************************************************/
+typedef struct {
+ PNO pno; /* destination process number */
+ u_int8 pkg_num; /* number of package data (1 - 16) */
+ u_int8 delivery_timing; /* delivery timing */
+ u_int8 ctrl_flg; /* delivery control flag */
+ u_int8 reserve[3];
+ EventID event_id; /* event ID */
+ DID did[SENSOR_PKG_DELIVERY_MAX]; /* data ID array */
+} SENSOR_MSG_DELIVERY_ENTRY_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* message header */
+ SENSOR_MSG_DELIVERY_ENTRY_DAT data; /* message body */
+} SENSOR_MSG_DELIVERY_ENTRY;
+
+/************************************************************************
+* TAG : SENSOR_MSG_GET_SENSOR_DATA
+* ABSTRACT : vehicle sensor getter message (to vehicle sensor)
+************************************************************************/
+typedef struct {
+ PNO pno; /* destination process number */
+ u_int8 pkg_num; /* number of package data (1 - 16) */
+ u_int8 reserve;
+ u_int16 offset; /* share memory offset */
+ u_int16 size; /* share memory allocation size */
+ EventID event_id; /* event ID */
+ DID did[SENSOR_PKG_DELIVERY_MAX]; /* data ID about vehicle sensor */
+} SENSOR_MSG_GET_SENSOR_DATA_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* message header */
+ SENSOR_MSG_GET_SENSOR_DATA_DAT data; /* message body */
+} SENSOR_MSG_GET_SENSOR_DATA;
+
+/************************************************************************
+* TAG : SENSOR_INTERNAL_MSG_BUF
+* ABSTRACT : message buffer
+************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* message header */
+ u_int8 data[SENSOR_MSGBUF_DSIZE]; /* message body */
+} SENSOR_INTERNAL_MSG_BUF;
+
+/********************************************************************************
+ * TAG :TG_GPSTIME
+ * ABSTRACT :GPS Absolute Time Structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct {
+ u_int16 year; /* Year information(4-digit year) */
+ u_int8 month; /* Month information */
+ u_int8 day; /* Day information */
+ u_int8 hour; /* Hour information */
+ u_int8 minute; /* Minute information */
+ u_int8 second; /* Second information */
+ u_int8 reserve; /* reserve */
+} TG_GPSTIME;
+
+/********************************************************************************
+ * TAG :TG_GPS_RTCBKUP_DATA
+ * ABSTRACT :RTC backup-related data structures
+ * NOTE :RTC-backup-related data stored in the SRAM alternate DRAM
+ ********************************************************************************/
+typedef struct {
+ u_int8 time_status; /* Time Status */
+ u_int8 reserve1[3]; /* Reserve 1 */
+ TG_GPSTIME gps_time; /* GPS Absolute Time */
+} TG_GPS_RTCBKUP_DATA; /* */
+
+/************************************************************************
+ * TAG : GPS_INTERRUPT
+ * ABSTRACT : GPS interrupt status
+ * NOTE :
+************************************************************************/
+typedef struct {
+ u_int8 _CWORD102__interrupt; /* from GPS to _CWORD102_ interrupt status */
+ u_int8 _CWORD56__interrupt; /* from GPS to _CWORD56_ interrupt status */
+} GPS_INTERRUPT;
+
+/********************************************************************************
+ * TAG :LOCALTIME
+ * ABSTRACT :LocalTime data structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct {
+ u_int8 status; /* status : valid or invalid */
+ u_int8 reserve[3]; /* reserve */
+ u_int16 year; /* year : 2000..2099 (FFFFh:invalid) */
+ u_int8 month; /* month : 1..12 (FFh:invalid) */
+ u_int8 day; /* date : 1..31 (FFh:invalid) */
+ u_int8 hour; /* hour : 0..23 (FFh:invalid) */
+ u_int8 min; /* minute : 0..59 (FFh:invalid) */
+ u_int8 sec; /* second : 0..59 (FFh:invalid) */
+ u_int8 reserve2; /* reserve */
+} LOCALTIME;
+
+#endif // POSITIONING_CLIENT_INCLUDE_POS_SENSOR_PRIVATE_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/SensorLocation_API.h b/video_in_hal/vehicleservice/positioning/client/include/SensorLocation_API.h
new file mode 100755
index 0000000..ae7f20a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/SensorLocation_API.h
@@ -0,0 +1,124 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+@file SensorLocation_API.h
+@detail SensorLocation_API external header file<BR>
+ SensorLocation_API External public header
+******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_H_
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Define *
+ *****************************************************************************/
+/* Command ID */
+#define CID_VEHICLE_SENSORLOCATION_LONLAT (0x0201)
+/* Vehicle sensor information notification CID (Latitude and longitude information)*/
+#define CID_VEHICLE_SENSORLOCATION_ALTITUDE (0x0202)
+/* Vehicle sensor information notification CID (Altitude Information) */
+
+/* SENSORLOCATION_RET_API definition */
+#define SENSORLOCATION_RET_NORMAL (0) /* Successful completion */
+#define SENSORLOCATION_RET_ERROR_PARAM (-1) /* Parameter error */
+#define SENSORLOCATION_RET_ERROR_BUFFULL (-2) /* Number of registered FULL */
+#define SENSORLOCATION_RET_ERROR_INNER (-3) /* Internal error */
+
+/* Delivery opportunity definition */
+#define SENSORLOCATION_DELIVERY_TIMING_CHANGE (0) /* Change */
+#define SENSORLOCATION_DELIVERY_TIMING_UPDATE (1) /* UpDate */
+
+/* Presence information definitions DR */
+#define SENSORLOCATION_EXISTDR_NODR (0) /* Without DR */
+#define SENSORLOCATION_EXISTDR_DR (1) /* There DR */
+
+/* DR state definition */
+#define SENSORLOCATION_DRSTATUS_INVALID (0) /* Invalid */
+#define SENSORLOCATION_DRSTATUS_GPS_NODR (1) /* Information use GPS, not yet implemented DR */
+#define SENSORLOCATION_DRSTATUS_NOGPS_DR (2) /* No information available GPS, DR implementation */
+#define SENSORLOCATION_DRSTATUS_GPS_DR (3) /* Information use GPS, DR implementation */
+
+/* LONLAT initial value definition */
+#define SENSORLOCATION_LATITUDE_INIT_VALUE 0x7FFFFFFFL /* initial value */
+#define SENSORLOCATION_LONGITUDE_INIT_VALUE 0x7FFFFFFFL /* initial value */
+
+/*****************************************************************************
+ * Typedef *
+ *****************************************************************************/
+typedef int32 SENSORLOCATION_RET_API;
+
+/*****************************************************************************
+ * Struct *
+ *****************************************************************************/
+/*****************************************************************************
+ * TAG : SENSORLOCATION_LONLATINFO_DAT
+ * ABSTRACT : Latitude and longitude information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int8 sensor_cnt; /* Sensor counter value */
+ u_int8 is_exist_dr; /* Presence or absence information DR */
+ u_int8 dr_status; /* DR state */
+ u_int8 reserve[3]; /* Reserve */
+ int32 longitude; /* Longitude */
+ int32 latitude; /* Latitude */
+} SENSORLOCATION_MSG_LONLATINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORLOCATION_ALTITUDEINFO_DAT
+ * ABSTRACT : Altitude information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int8 sensor_cnt; /* Sensor counter value */
+ u_int8 is_exist_dr; /* Presence or absence information DR */
+ u_int8 dr_status; /* DR state */
+ u_int8 reserve[3]; /* Reserve */
+ int32 altitude; /* Altitude(0.01m) */
+} SENSORLOCATION_MSG_ALTITUDEINFO_DAT;
+
+/*****************************************************************************
+ * TAG : LONLAT
+ * ABSTRACT : Latitude and Longitude data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ int32 latitude; /* Latitude */
+ int32 longitude; /* Longitude */
+} LONLAT;
+
+/*****************************************************************************
+* Function prototypes *
+*****************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern SENSORLOCATION_RET_API SensorLocationRegisterListenerLonLat(PNO pno, u_int8 delivery_timing);
+extern SENSORLOCATION_RET_API SensorLocationRegisterListenerAltitude(PNO pno, u_int8 delivery_timing);
+extern SENSORLOCATION_RET_API SensorLocationGetLonLat(SENSORLOCATION_MSG_LONLATINFO_DAT *dat);
+extern SENSORLOCATION_RET_API SensorLocationGetAltitude(SENSORLOCATION_MSG_ALTITUDEINFO_DAT *dat);
+extern SENSORLOCATION_RET_API SensorLocationGetLonLatOnShutdown(LONLAT *lonlat);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/SensorLocation_API_private.h b/video_in_hal/vehicleservice/positioning/client/include/SensorLocation_API_private.h
new file mode 100755
index 0000000..d37d9eb
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/SensorLocation_API_private.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_PRIVATE_H_
+/******************************************************************************
+ * File name :SensorLocation_API_private.h
+ * System name :PastModel002
+ * Subsystem name :Vehicle I/F library
+ ******************************************************************************/
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define LONLAT_SEMAPHO_NAME ("LONLAT_SHARE_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define LONLAT_SHARE_NAME ("LONLAT_SHARE_MEMORY") /* Shared memory name(MAX 32Byte) */
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSORLOCATION_API_PRIVATE_H_ */
diff --git a/video_in_hal/vehicleservice/positioning/client/include/SensorMotion_API.h b/video_in_hal/vehicleservice/positioning/client/include/SensorMotion_API.h
new file mode 100755
index 0000000..2db5511
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/SensorMotion_API.h
@@ -0,0 +1,178 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+@file SensorMotion_API.h
+@detail SensorMotion_API external header file<BR>
+ SensorMotion_API External public header
+******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSORMOTION_API_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSORMOTION_API_H_
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Define *
+ *****************************************************************************/
+/* Command ID */
+/* Vehicle sensor information notification CID (Rate information) */
+#define CID_VEHICLE_SENSORMOTION_SPEED (0x0203)
+/* Vehicle sensor information notification CID (Orientation information) */
+#define CID_VEHICLE_SENSORMOTION_HEADING (0x0204)
+
+/* Vehicle sensor information notification CID (GyroTrouble information) */
+#define CID_VEHICLE_SENSORMOTION_GYROTROUBLE (0x020A)
+/* Vehicle sensor information notification CID (GyroParameter information) */
+#define CID_VEHICLE_SENSORMOTION_GYROPARAMETER (0x020B)
+/* Vehicle sensor information notification CID (SpeedParameter information) */
+#define CID_VEHICLE_SENSORMOTION_SPEEDPULSEPARAMETER (0x020C)
+
+/* SENSORMOTION_RET_API definition */
+#define SENSORMOTION_RET_NORMAL (0) /* Successful completion */
+#define SENSORMOTION_RET_ERROR_PARAM (-1) /* Parameter error */
+#define SENSORMOTION_RET_ERROR_BUFFULL (-2) /* Number of registered FULL */
+#define SENSORMOTION_RET_ERROR_INNER (-3) /* Internal error */
+
+/* Delivery opportunity definition */
+#define SENSORMOTION_DELIVERY_TIMING_CHANGE (0) /* Change */
+#define SENSORMOTION_DELIVERY_TIMING_UPDATE (1) /* UpDate */
+
+/* Presence information definitions DR */
+#define SENSORMOTION_EXISTDR_NODR (0) /* Without DR */
+#define SENSORMOTION_EXISTDR_DR (1) /* There DR */
+
+/* DR state definition */
+#define SENSORMOTION_DRSTATUS_INVALID (0) /* Invalid */
+#define SENSORMOTION_DRSTATUS_GPS_NODR (1) /* Information use GPS, not yet implemented DR */
+#define SENSORMOTION_DRSTATUS_NOGPS_DR (2) /* No information available GPS, DR implementation */
+#define SENSORMOTION_DRSTATUS_GPS_DR (3) /* Information use GPS, DR implementation */
+
+/*----------------------------------------------------------------------*
+ * General Purpose Definition
+ *----------------------------------------------------------------------*/
+#define SENSORMOTION_NORMAL (0U)
+#define SENSORMOTION_ERROR (1U)
+#define SENSORMOTION_UNFIXED (2U)
+
+/*****************************************************************************
+ * Typedef *
+ *****************************************************************************/
+typedef int32 SENSORMOTION_RET_API;
+
+/*****************************************************************************
+ * Struct *
+ *****************************************************************************/
+/*****************************************************************************
+ * TAG : SENSORMOTION_SPEEDINFO_DAT
+ * ABSTRACT : Vehicle speed information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int8 sensor_cnt; /* Sensor counter value */
+ u_int8 is_exist_dr; /* Presence or absence information DR */
+ u_int8 dr_status; /* DR state */
+ u_int8 reserve; /* Reserve */
+ u_int16 speed; /* Speed(0.01m/sec) */
+} SENSORMOTION_MSG_SPEEDINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_HEADINGINFO_DAT
+ * ABSTRACT : Orientation information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int8 sensor_cnt; /* Sensor counter value */
+ u_int8 is_exist_dr; /* Presence or absence information DR */
+ u_int8 dr_status; /* DR state */
+ u_int8 reserve; /* Reserve */
+ u_int16 heading; /* Heading */
+} SENSORMOTION_MSG_HEADINGINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_GYROTROUBLEINFO_DAT
+ * ABSTRACT : GyroTrouble information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int8 gyro_trouble; /* Gyro Trouble Status */
+ u_int8 reserve; /* Reserve */
+} SENSORMOTION_MSG_GYROTROUBLEINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_GYROTROUBLEINFO
+ * ABSTRACT : Delivery of the message GyroTrouble information
+ * NOTE : Message structure(VehicleSens -> User)
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ SENSORMOTION_MSG_GYROTROUBLEINFO_DAT data; /* Delivery data (GyroTrouble) */
+} SENSORMOTION_MSG_GYROTROUBLEINFO;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_GYROPARAMETERINFO_DAT
+ * ABSTRACT : GyroParameter information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int16 gyro_offset; /* Gyro Offset */
+ u_int8 gyro_scale_factor; /* Gyro Scale Factor */
+ u_int8 gyro_scale_factor_level; /* Gyro Scale Factor Level */
+ u_int8 reserve[2]; /* Reserve */
+} SENSORMOTION_MSG_GYROPARAMETERINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_GYROPARAMETERINFO
+ * ABSTRACT : Delivery of the message GyroParameter information
+ * NOTE : Message structure(VehicleSens -> User)
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ SENSORMOTION_MSG_GYROPARAMETERINFO_DAT data; /* Delivery data (GyroParameter) */
+} SENSORMOTION_MSG_GYROPARAMETERINFO;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT
+ * ABSTRACT : SpeedPulseParameter information data structure
+ * NOTE :
+ *****************************************************************************/
+typedef struct {
+ u_int16 size; /* Size */
+ u_int16 speed_pulse_scale_factor; /* Speed Pulse Scale Factor */
+ u_int8 speed_pulse_scale_factor_level; /* Speed Pulse Scale Factor Level */
+ u_int8 reserve[3]; /* Reserve */
+} SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT;
+
+/*****************************************************************************
+ * TAG : SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO
+ * ABSTRACT : Delivery of the message SpeedPulseParameter information
+ * NOTE : Message structure(VehicleSens -> User)
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT data; /* Delivery data (SpeedPulseParameter) */
+} SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO;
+
+/*****************************************************************************
+ * Function prototypes *
+ *****************************************************************************/
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSORMOTION_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Sensor_API.h b/video_in_hal/vehicleservice/positioning/client/include/Sensor_API.h
new file mode 100755
index 0000000..b49b4ac
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Sensor_API.h
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSOR_API_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSOR_API_H_
+/******************************************************************************
+ * file name :Sensor_API.h
+ * system name :GPF
+ * sub system name :sensor interface library
+ ******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "Sensor_Common_API.h"
+#include <vehicle_service/POS_sensor_API.h>
+#include "POS_sensor_private.h"
+
+/*!
+ @brief GPS Rollover Based Week Number Structure
+*/
+typedef struct {
+ uint16_t wkn; /**< GPS rollover base week number */
+} SENSOR_WKNROLLOVER;
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSOR_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Sensor_API_private.h b/video_in_hal/vehicleservice/positioning/client/include/Sensor_API_private.h
new file mode 100755
index 0000000..c3b5f54
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Sensor_API_private.h
@@ -0,0 +1,174 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSOR_API_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSOR_API_PRIVATE_H_
+/******************************************************************************
+ * File name :Sensor_API_private.h
+ * System name :GPF
+ * Subsystem name Vehicle I/F library
+ ******************************************************************************/
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define SENSOR_PUBLIC_DID_NUM 31
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define SENSOR_SHARE_LOCK 0xFF /* Locking */
+#define SENSOR_SHARE_UNLOCK 0x00 /* Unlocking */
+
+#define SENSOR_SHARE_BLOCK_MNUM 1 /* Number of shared memory control blocks */
+#define SENSOR_SHARE_BLOCK_DNUM 10 /* Number of shared memory data blocks */
+/* Number of shared memory blocks */
+#define SENSOR_SHARE_BLOCK_NUM (SENSOR_SHARE_BLOCK_MNUM+SENSOR_SHARE_BLOCK_DNUM)
+
+#define SENSOR_SHARE_BLOCK_SIZE 512 /* Shared Memory Block Size(byte) */
+#define SENSOR_SHARE_HEAD_SIZE 40 /* Vehicle Sensor Information Header( (4)+1+3+16*2) */
+/* Shared Memory Data Size */
+#define SENSOR_SHARE_BLOCK_DSIZE (SENSOR_SHARE_BLOCK_SIZE - SENSOR_SHARE_HEAD_SIZE)
+/* Size of shared memory allocation area */
+#define SENSOR_SHARE_SIZE (SENSOR_SHARE_BLOCK_SIZE * SENSOR_SHARE_BLOCK_NUM)
+
+#define SENSOR_SEMAPHO_NAME ("SENSOR_SHARE_SEMAPHO") /* Semaphore name */
+#define GPS_INTERRUPT_SIGNAL_SEMAPHO_NAME ("GPS_INT_SIGNAL_SHARE_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+#define GYRO_CONNECT_STATUS_SEMAPHO_NAME ("GYRO_CONNECT_STTS_SHARE_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+#define EPHEMERIS_NUM_SEMAPHO_NAME ("EPHEMERIS_NUM_SHARE_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+#define LOCALTIME_SEMAPHO_NAME ("LOCALTIME_SHARE_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+
+/*----------------------------------------------------------------------*
+ * Event Related Extensions *
+ *----------------------------------------------------------------------*/
+#define SENSOR_EVENT_VAL_INIT (SENSOR_RET_ERROR_MIN - 1) /* Event initial value */
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define SENSOR_SHARE_NAME ("SENSOR_SHARE_MEMORY") /* Shared memory name */
+#define GPS_INTERRUPT_SIGNAL_SHARE_NAME ("GPS_INT_SIGNAL_SHARE_MEMORY") /* Shared memory name(MAX 32Byte) */
+#define GYRO_CONNECT_STATUS_SHARE_NAME ("GYRO_CONNECT_STTS_SHARE_MEMORY") /* Shared memory name(MAX 32Byte) */
+#define EPHEMERIS_NUM_SHARE_NAME ("EPHEMERIS_NUM_SHARE_MEMORY") /* Shared memory name(MAX 32Byte) */
+#define LOCALTIME_SHARE_NAME ("LOCALTIME_SHARE_MEMORY") /* Shared memory name(MAX 32Byte) */
+
+/*-----------------------------------------------------------------------------
+ * GPS local CID define
+ *----------------------------------------------------------------------------*/
+#define CID_DEV_REQGPS MAKECID(CID_DEVHIGH, 0x00) /* GPS request */
+#define CID_DEV_REQRST MAKECID(CID_DEVHIGH, 0x01) /* GPS reset request */
+
+#define CID_GPS_SERIAL0 (CID)0x0100 /* GPS reset request function definition */
+/* GPS reset request CID */
+
+/*---------------------------------------------------------------------------
+ * GPS error log output
+ ---------------------------------------------------------------------------*/
+#define GPS_DBGMSG 0 /* Product Shipping Log Output(WPF_DEBUGMSG) */
+#define GPS_RTLMSG 1 /* Development test log output(WPF_RETAILMSG) */
+
+/*----------------------------------------------------------------------*
+ * for message *
+ *----------------------------------------------------------------------*/
+#define CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT 0x0602 /* sensor extra package register command ID */
+
+/*----------------------------------------------------------------------*
+ * for JudgeDid *
+ *----------------------------------------------------------------------*/
+#define MODE_REGISTER_LISTENER_PKG_SENS_DATA 0 /* POS_RegisterListenerPkgSensData */
+#define MODE_REGISTER_LISTENER_SENSDATA 1 /* POS_RegisterListenerSensData */
+#define MODE_GET_SENSDATA 2 /* POS_GetSensData */
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/************************************************************************
+* TAG : SENSOR_SHARE_MNG
+* ABSTRACT : Shared memory management area
+************************************************************************/
+typedef struct {
+ uint8_t lock_info[SENSOR_SHARE_BLOCK_NUM]; /* Usages */
+ uint8_t reserve[501]; /* 512-11 */
+} SENSOR_SHARE_MNG;
+
+/************************************************************************
+* TAG : SENSOR_SHARE_BLOCK_DAT_DAT
+* ABSTRACT : Shared memory data area(Data section details)
+************************************************************************/
+typedef struct {
+ uint8_t pkg_num; /* Number of packages */
+ uint8_t reserve[3];
+ uint16_t offset[SENSOR_PKG_DELIVERY_MAX]; /* Offset value */
+ uint8_t data[SENSOR_SHARE_BLOCK_DSIZE]; /* Data portion */
+} SENSOR_SHARE_BLOCK_DAT_DAT;
+
+/************************************************************************
+* TAG : SENSOR_SHARE_BLOCK_DAT
+* ABSTRACT : Shared memory data area(One block)
+************************************************************************/
+typedef struct {
+ uint16_t size; /* Size of the data */
+ uint8_t reserve[2];
+ SENSOR_SHARE_BLOCK_DAT_DAT data; /* Data portion */
+} SENSOR_SHARE_BLOCK_DAT;
+
+/************************************************************************
+* TAG : SENSOR_SHARE_BLOCK_MNG
+* ABSTRACT : Areas of memory that are shared
+************************************************************************/
+typedef struct {
+ SENSOR_SHARE_MNG mng; /* Shared memory management information */
+ SENSOR_SHARE_BLOCK_DAT data[SENSOR_SHARE_BLOCK_DNUM]; /* Shared memory data portion */
+} SENSOR_SHARE;
+
+/**
+ * @brief Return code list structure
+ */
+typedef struct {
+/*
+ * Note.
+ * This feature needs to be defined according to the unit type.
+ */
+ BOOL GRADE2_ret; /**< Return code in GRADE2 */
+ BOOL GRADE1_ret; /**< Return code in GARDE1 */
+ DID did; /**< DID */
+} SENSOR_RET_PKG;
+
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+RET_API PosDeleteEvent(EventID event_id);
+RET_API SensorLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset);
+RET_API SensorUnLinkShareData(SENSOR_SHARE *share_top, uint16_t offset);
+
+EventID PosCreateEvent(PNO pno);
+void SensorSetShareData(void *share_top, uint16_t offset, const void *data_src, uint16_t size_src);
+RET_API PosSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data);
+
+BOOL SensorJudgeDid(DID did, uint8_t mode);
+
+/* Function macro */
+#define SENSOR_DID_JUDGE_REGLIS_PKG(did) SensorJudgeDid(did, MODE_REGISTER_LISTENER_PKG_SENS_DATA)
+#define SENSOR_DID_JUDGE_REGLIS(did) SensorJudgeDid(did, MODE_REGISTER_LISTENER_SENSDATA)
+#define SENSOR_DID_JUDGE_GET(did) SensorJudgeDid(did, MODE_GET_SENSDATA)
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSOR_API_PRIVATE_H_ */
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Sensor_Common_API.h b/video_in_hal/vehicleservice/positioning/client/include/Sensor_Common_API.h
new file mode 100755
index 0000000..5631e83
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Sensor_Common_API.h
@@ -0,0 +1,193 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_SENSOR_COMMON_API_H_
+#define POSITIONING_CLIENT_INCLUDE_SENSOR_COMMON_API_H_
+/******************************************************************************
+ * File name :Sensor_Common_API.h
+ * System name :PastModel002
+ * Sub System name :Vehicle I/F Liblary,Sensor I/F Liblary
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include "CommonDefine.h"
+
+/************************************************************************
+ * Definition *
+ ************************************************************************/
+/*----------------------------------------------------------------------*
+ * ID data corresponding to the vehicle sensor information *
+ *----------------------------------------------------------------------*/
+
+/*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+
+/* VEHICLE__DID */
+
+/* ++ PastModel002 Support_UBX_Protocol_DID */
+#define VEHICLE_DID_GPS_UBLOX_NAV_POSLLH 0x80000060
+#define VEHICLE_DID_GPS_UBLOX_NAV_STATUS 0x80000061
+#define VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC 0x80000062
+#define VEHICLE_DID_GPS_UBLOX_NAV_VELNED 0x80000063
+#define VEHICLE_DID_GPS_UBLOX_NAV_DOP 0x80000064
+#define VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS 0x80000065
+#define VEHICLE_DID_GPS_UBLOX_NAV_SVINFO 0x80000066
+#define VEHICLE_DID_GPS_UBLOX_NAV_CLOCK 0x80000067
+#define VEHICLE_DID_GPS_UBLOX_MON_HW 0x80000068
+#define VEHICLE_DID_GPS_UBLOX_ACK_ACK 0x80000069
+#define VEHICLE_DID_GPS_UBLOX_ACK_NAK 0x8000006A
+#define VEHICLE_DID_GPS_UBLOX_CFG_RST 0x8000006B
+#define VEHICLE_DID_GPS_UBLOX_AID_INI 0x8000006C
+#define VEHICLE_DID_GPS_UBLOX_AID_EPH 0x8000006D
+#define VEHICLE_DID_GPS_UBLOX_CFG_MSG 0x8000006E
+#define VEHICLE_DID_GPS_UBLOX_CFG_NAVX5 0x8000006F
+/* -- PastModel002 Support_UBX_Protocol_DID */
+
+/* ++ used internally by the DR */
+#define VEHICLE_DID_GPS_COUNTER 0x8000001B
+#define VEHICLE_DID_GYRO_EXT 0x80000027
+
+#define VEHICLE_DID_DR_LONGITUDE 0x80000070
+#define VEHICLE_DID_DR_LATITUDE 0x80000071
+#define VEHICLE_DID_DR_ALTITUDE 0x80000072
+#define VEHICLE_DID_DR_SPEED 0x80000073
+#define VEHICLE_DID_DR_HEADING 0x80000074
+#define VEHICLE_DID_DR_SNS_COUNTER 0x80000075
+#define VEHICLE_DID_DR_GYRO_OFFSET 0x80000078
+#define VEHICLE_DID_DR_GYRO_SCALE_FACTOR 0x80000079
+#define VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL 0x8000007A
+#define VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR 0x8000007B
+#define VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL 0x8000007C
+
+/* -- used internally by the DR */
+
+/* ++ PastModel002 Support_DID */
+#define VEHICLE_DID_GYRO_TROUBLE 0x80000080
+#define VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL 0x80000081
+#define VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL 0x80000082
+#define VEHICLE_DID_GYRO_CONNECT_STATUS 0x80000083
+#define VEHICLE_DID_VALID_EPH_NUM 0x80000084
+/* -- PastModel002 Support_DID */
+
+/* ++ Not supported by UBX_Protocol */
+#define VEHICLE_DID_LOCATION 0x80000020
+#define VEHICLE_DID_GPS__CWORD82__NMEA POS_DID_GPS__CWORD82__NMEA
+#define VEHICLE_DID_GPS__CWORD82__SETINITIAL POS_DID_GPS__CWORD82__SETINITIAL
+#define VEHICLE_DID_GPS__CWORD82__SETRMODE 0x80000034
+#define VEHICLE_DID_GPS__CWORD82__SETRMODEEX POS_DID_GPS__CWORD82__SETRMODEEX
+#define VEHICLE_DID_GPS__CWORD82__SELSENT POS_DID_GPS__CWORD82__SELSENT
+#define VEHICLE_DID_GPS__CWORD82__SETSBAS 0x80000037
+#define VEHICLE_DID_GPS__CWORD82__SETCONF1 0x80000038
+#define VEHICLE_DID_GPS__CWORD82__SETCONF2 0x80000039
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GGA_INTERNAL 0xA050
+#define VEHICLE_DID_GPS__CWORD82__NMEA_DGGA_INTERNAL 0xA051
+#define VEHICLE_DID_GPS__CWORD82__NMEA_VTG_INTERNAL 0xA052
+#define VEHICLE_DID_GPS__CWORD82__NMEA_RMC_INTERNAL 0xA053
+#define VEHICLE_DID_GPS__CWORD82__NMEA_DRMC_INTERNAL 0xA054
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GLL_INTERNAL 0xA055
+#define VEHICLE_DID_GPS__CWORD82__NMEA_DGLL_INTERNAL 0xA056
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GSA_INTERNAL 0xA057
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV1_INTERNAL 0xA058
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV2_INTERNAL 0xA059
+#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV3_INTERNAL 0xA060
+#define VEHICLE_DID_GPS__CWORD82__NMEA_PJRDC_GP_3_INTERNAL 0xA061
+#define VEHICLE_DID_LOCATION_LONLAT 0x80000095
+#define VEHICLE_DID_LOCATION_ALTITUDE 0x80000096
+#define VEHICLE_DID_MOTION_SPEED 0x80000062
+#define VEHICLE_DID_MOTION_HEADING 0x80000097
+#define VEHICLE_DID_GPS_TIME 0x80000098
+#define VEHICLE_DID_NAVIINFO_DIAG_GPS 0x80000099
+#define VEHICLE_DID_GPSWEEKCOR_CNT 0x8000009A
+
+#define VEHICLE_DID_GPS_CUSTOMDATA_NAVI 0x800000A0
+#define VEHICLE_DID_LOCATION_LONLAT_NAVI 0x800000A1
+#define VEHICLE_DID_LOCATION_ALTITUDE_NAVI 0x800000A2
+#define VEHICLE_DID_MOTION_SPEED_NAVI 0x800000A3
+#define VEHICLE_DID_MOTION_HEADING_NAVI 0x800000A4
+#define VEHICLE_DID_SETTINGTIME 0x800000A5
+
+#define VEHICLE_DID_LOCATIONINFO_NMEA_NAVI 0x800000A6
+
+#define VEHICLE_DID_MOTION_SPEED_INTERNAL 0x800000B0
+
+#define VEHICLE_DID_GPS_TIME_RAW 0x800000B1U /* QAC 1281 */
+#define VEHICLE_DID_GPS_WKNROLLOVER 0x800000B2U /* QAC 1281 */
+
+#define VEHICLE_DID_SPEED_PULSE_VEHICLE (0x80000044UL)
+
+/* -- Not supported by UBX_Protocol */
+
+/*----------------------------------------------------------------------*
+ * Vehicle sensor data information *
+ *----------------------------------------------------------------------*/
+#define VEHICLE_SNS_BATTERY_SHORT 0x02 /* BATTERY SHORT */
+#define VEHICLE_SNS_THERMAL_SHUT_DOWN 0x04 /* THERMAL SHUT DOWN */
+#define VEHICLE_SNS_UNKNOWN 0x05 /* UNKNOWN */
+
+/* Missing information data */
+#define VEHICLE_SNS_BREAK 0x01 /* Data without continuity */
+#define VEHICLE_SNS_NORMAL 0x00 /* Continuity of data */
+
+/*-------------------------------------------------------------------------------
+ * Time Status Return Values
+ -------------------------------------------------------------------------------*/
+#define GPS_TIMESTS_OK (0x00U) /* Exact values from the satellites */
+/* Ignore->MISRA-C++ Rule 16-2-2 */
+#define GPS_TIMESTS_NOTUTC (0x01U) /* Time from satellite but UTC uncorrected */
+/* Ignore->MISRA-C++ Rule 16-2-2 */
+#define GPS_TIMESTS_RTC (0x02U) /* RTC time */
+/* Ignore->MISRA-C++ Rule 16-2-2 */
+#define GPS_TIMESTS_NG (0x03U) /* Anomaly Time */
+/* Ignore->MISRA-C++ Rule 16-2-2 */
+
+/*-------------------------------------------------------------------------------
+ * NMEA Receive Flag
+ -------------------------------------------------------------------------------*/
+#define VEHICLE_SNS__CWORD82__DRMC POS_SNS__CWORD82__DRMC
+#define VEHICLE_SNS__CWORD82__GSA POS_SNS__CWORD82__GSA
+#define VEHICLE_SNS__CWORD82__GSV_1 POS_SNS__CWORD82__GSV_1
+#define VEHICLE_SNS__CWORD82__GSV_2 POS_SNS__CWORD82__GSV_2
+#define VEHICLE_SNS__CWORD82__GSV_3 POS_SNS__CWORD82__GSV_3
+#define VEHICLE_SNS__CWORD82__PJRDC_GP_3 POS_SNS__CWORD82__PJRDC_GP_3
+#define VEHICLE_SNS__CWORD82__PJRDC_GP_4 (0x40U) /* Ignore->MISRA-C++ Rule 16-2-2 */
+
+/************************************************************************
+* enum Definition *
+*************************************************************************/
+
+/*-------------------------------------------------------------------------------
+ * _CWORD71_ UNIT type
+ -------------------------------------------------------------------------------*/
+typedef enum {
+ POS_TYPE_NONE = (0U), /* Undefined */
+ POS_TYPE_GRADE1, /* GRADE1 (Integrated) */
+ POS_TYPE_GRADE2 /* GRADE2 (Binary type) */
+} POS_TYPE;
+
+/************************************************************************
+* typedef Definition *
+*************************************************************************/
+
+typedef u_int32 DID; /* DataID */
+
+/************************************************************************
+* struct Definition *
+*************************************************************************/
+
+#endif // POSITIONING_CLIENT_INCLUDE_SENSOR_COMMON_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/VehicleDebug_API.h b/video_in_hal/vehicleservice/positioning/client/include/VehicleDebug_API.h
new file mode 100755
index 0000000..e0c9ef2
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/VehicleDebug_API.h
@@ -0,0 +1,110 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+ * File name : VehicleDebug_API.h
+ * System name : PastModel002
+ * Sub System name : VehicleDebug_API library
+ ******************************************************************************/
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLEDEBUG_API_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLEDEBUG_API_H_
+
+/************************************************************************
+ * Include *
+ ***********************************************************************/
+
+/************************************************************************
+* Definition *
+************************************************************************/
+/*----------------------------------------------------------------------*
+ * VEHICLEDEBUG_RET_API Definition *
+ *----------------------------------------------------------------------*/
+/* Normal */
+#define VEHICLEDEBUG_RET_NORMAL 0 /* Successful completion */
+
+/* Abnormal */
+#define VEHICLEDEBUG_RET_ERROR (-1) /* An error has occurred */
+#define VEHICLEDEBUG_RET_ERROR_PARAM (-2) /* Parameter error */
+
+/*----------------------------------------------------------------------*
+ * Message Definition *
+ *----------------------------------------------------------------------*/
+/* Command ID */
+#define CID_VEHICLEDEBUG_LOG_SET 0x020D
+#define CID_VEHICLEDEBUG_LOG_GET 0x020E
+
+/* Message Length */
+#define VEHICLEDEBUG_MSGBUF_DSIZE 36U
+
+/*----------------------------------------------------------------------*
+ * Log Kind Definition *
+ *----------------------------------------------------------------------*/
+#define LOG_KIND_NUM 32U
+
+/*----------------------------------------------------------------------*
+ * Log Mask Definition *
+ *----------------------------------------------------------------------*/
+#define LOG_MASK_LOCATION_LOG 0x00000001UL
+
+/*----------------------------------------------------------------------*
+ * Log Severity Definition *
+ *----------------------------------------------------------------------*/
+/* Unused */
+
+/************************************************************************
+* type Definition *
+************************************************************************/
+typedef RET_API VEHICLEDEBUG_RET_API; /* API return value */
+
+/************************************************************************
+* struct Definition *
+************************************************************************/
+/************************************************************************
+ * TAG : VEHICLEDEBUG_MSG_LOGINFO_DAT
+ * ABSTRACT : Log data structure
+ * NOTE :
+ ************************************************************************/
+typedef struct {
+ u_int32 log_sw; /* Kind of log */
+ u_int8 severity[LOG_KIND_NUM]; /* Output level(unused) */
+} VEHICLEDEBUG_MSG_LOGINFO_DAT;
+
+/*****************************************************************************
+ * TAG : VEHICLEDEBUG_MSG_BUF
+ * ABSTRACT : VehicleDebug_API message buffer structure
+ * NOTE : Message structure
+ *****************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int8 data[VEHICLEDEBUG_MSGBUF_DSIZE]; /* Message data */
+} VEHICLEDEBUG_MSG_BUF;
+
+/************************************************************************
+ * Function prototypes *
+ ************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*[VehicleDebug_API Public API]*/
+VEHICLEDEBUG_RET_API SensorGetLogSetting(PNO pno, u_int32 *log_sw, u_int8 *severity);
+VEHICLEDEBUG_RET_API SensorSetLogStatus(PNO pno, u_int32 log_sw, u_int8 *severity);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLEDEBUG_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Vehicle_API.h b/video_in_hal/vehicleservice/positioning/client/include/Vehicle_API.h
new file mode 100755
index 0000000..78450c5
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Vehicle_API.h
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_API_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_API_H_
+/******************************************************************************
+ * File name :Vehicle_API.h
+ * System name :GPF
+ * Sub System name :Vehicle I/F Liblary
+ ******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_define.h>
+#include "Sensor_Common_API.h"
+
+/****************************************************************************
+* Definition *
+*****************************************************************************/
+/*--------------------------------------------------------------------------*
+ * VECHILE_RET_API Definition *
+ *--------------------------------------------------------------------------*/
+/* Normal system */
+#define VEHICLE_RET_NORMAL 0 /* Successful completion */
+
+/* Abnormal system */
+#define VEHICLE_RET_ERROR_DID (-2) /* NoneDID */
+#define VEHICLE_RET_ERROR_PARAM (-4) /* Parameter error */
+#define VEHICLE_RET_ERROR_BUFFULL (-5) /* registration number FULL */
+#define VEHICLE_RET_ERROR_CREATE_EVENT (-6) /* Failure event generation */
+#define VEHICLE_RET_ERROR_MIN POS_RET_ERROR_MIN
+
+/*----------------------------------------------------------------------*
+ * API-related registration information delivery vehicle sensor *
+ *----------------------------------------------------------------------*/
+/* Delivery control */
+#define VEHICLE_DELIVERY_REGIST 0x01 /* Shipping register */
+
+/* Delivery opportunity */
+#define VEHICLE_DELIVERY_TIMING_UPDATE 0x01 /* Update */
+#define VEHICLE_DELIVERY_TIMING_CHANGE 0x02 /* Change */
+
+/*----------------------------------------------------------------------*
+ * Message Definition *
+ *----------------------------------------------------------------------*/
+/* Command ID */
+
+/* Registration information delivery vehicle sensor CID */
+#define CID_VEHICLEIF_DELIVERY_ENTRY 0x0101
+
+/* Vehicle sensor information notification CID */
+#define CID_VEHICLESENS_VEHICLE_INFO 0x0200
+
+/* GPS time notification CID */
+#define CID_VEHICLESENS_VEHICLE_INFO_GPS_TIME 0x0201
+
+/************************************************************************
+* typedef Definition *
+************************************************************************/
+typedef RET_API VEHICLE_RET_API; /* API return value */
+
+/************************************************************************
+* struct Definition *
+************************************************************************/
+
+/************************************************************************
+* TAG : VEHICLE_MSG_VSINFO_DAT
+* ABSTRACT : message delivery vehicle sensor information
+************************************************************************/
+typedef struct {
+ DID did;
+ u_int16 size;
+ u_int8 rcv_flag;
+ u_int8 sensor_cnt;
+ u_int8 data[256];
+} VEHICLE_MSG_VSINFO_DAT;
+
+/* ++ GPS _CWORD82_ support */
+
+/************************************************************************
+* TAG : VEHICLE_MSG_SEND_DAT
+* ABSTRACT : Vehicle sensor information setting message(-> Vehicle sensor)
+************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ VEHICLE_MSG_SEND_DAT data; /* Message data */
+} VEHICLE_MSG_SEND;
+
+/* -- GPS _CWORD82_ support */
+
+/************************************************************************
+* Function prototypes *
+************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*[VEHICLE_API Public API]*/
+VEHICLE_RET_API VehicleInitialize(u_int32(*sighand)(void)); /* QAC 3001 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Vehicle_API_Dummy.h b/video_in_hal/vehicleservice/positioning/client/include/Vehicle_API_Dummy.h
new file mode 100755
index 0000000..b242ac6
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Vehicle_API_Dummy.h
@@ -0,0 +1,142 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_API_DUMMY_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_API_DUMMY_H_
+/******************************************************************************
+ * File name : Vehicle_API_Dummy.h
+ * System name : GPF
+ * Sub System name : Vehicle I/F Liblary
+ ******************************************************************************/
+
+#include "Sensor_Common_API.h"
+
+/****************************************************************************
+* Definition *
+*****************************************************************************/
+/*--------------------------------------------------------------------------*
+ * VECHILE_RET_API Definition *
+ *--------------------------------------------------------------------------*/
+/* Normal system */
+#define VEHICLE_RET_NORMAL 0 /* Successful completion */
+
+/* Abnormal system */
+#define VEHICLE_RET_ERROR_PID (-1) /* Abnormal thread ID */
+#define VEHICLE_RET_ERROR_DID (-2) /* NoneDID */
+#define VEHICLE_RET_ERROR_DID_DIS (-3) /* Non-ID data CANID */
+#define VEHICLE_RET_ERROR_PARAM (-4) /* Parameter error */
+#define VEHICLE_RET_ERROR_BUFFULL (-5) /* registration number FULL */
+#define VEHICLE_RET_ERROR_CREATE_EVENT (-6) /* Failure event generation */
+#define VEHICLE_RET_ERROR_TIMER (-7) /* Generation failure timer */
+#define VEHICLE_RET_ERROR_OUTOF_MEMORY (-8) /* Shared memory allocation failure */
+#define VEHICLE_RET_ERROR_SIZE (-9) /* Size error destination */
+#define VEHICLE_RET_ERROR_INVALID (-10) /* CANID undetermined */
+#define VEHICLE_RET_ERROR_MIN POS_RET_ERROR_MIN
+
+/*----------------------------------------------------------------------*
+ * API-related registration information delivery vehicle sensor *
+ *----------------------------------------------------------------------*/
+/* Delivery control */
+#define VEHICLE_DELIVERY_REGIST 0x01 /* Shipping register */
+
+/* Delivery opportunity */
+#define VEHICLE_DELIVERY_TIMING_UPDATE 0x01 /* Update */
+#define VEHICLE_DELIVERY_TIMING_CHANGE 0x02 /* Change */
+
+/*----------------------------------------------------------------------*
+ * Message Definition *
+ *----------------------------------------------------------------------*/
+/* Command ID */
+
+/* Registration information delivery vehicle sensor CID */
+#define CID_VEHICLEIF_DELIVERY_ENTRY 0x0101
+
+/* Vehicle sensor information notification CID */
+#define CID_VEHICLESENS_VEHICLE_INFO 0x0200
+
+#define CID_VEHICLEIF_GET_DR_DATA 0x0205
+
+/* The message body size data(byte) */
+#define VEHICLE_MSGBUF_DSIZE (SENSOR_MSG_VSINFO_DSIZE + 12)
+/* Header size of SENSOR_MSG_VSINFO_DSIZE + SENSOR_MSG_GPSDATA_DAT (12) */
+
+/************************************************************************
+* typedef Definition *
+************************************************************************/
+
+/************************************************************************
+* struct Definition *
+************************************************************************/
+
+/************************************************************************
+* TAG : VEHICLE_MSG_BUF
+* ABSTRACT : Message buffer
+************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ u_int8 data[VEHICLE_MSGBUF_DSIZE]; /* Message data */
+} VEHICLE_MSG_BUF;
+
+/************************************************************************
+* TAG : VEHICLE_MSG_GET_VEHICLE_DATA
+* ABSTRACT : Vehicle sensor information acquisition message(-> Vehicle sensor)
+************************************************************************/
+typedef struct {
+ DID did; /* Data ID corresponding to vehicle sensor information */
+ PNO pno; /* Destination PNO */
+ u_int16 offset; /* Offset to shared memory storage area */
+ u_int16 size; /* Size of shared memory storage area */
+ u_int8 reserve[2];
+ EventID event_id; /* Event ID */
+} VEHICLE_MSG_GET_VEHICLE_DATA_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ VEHICLE_MSG_GET_VEHICLE_DATA_DAT data; /* Message data */
+} VEHICLE_MSG_GET_VEHICLE_DATA;
+
+/************************************************************************
+* TAG : VEHICLE_MSG_DELIVERY_ENTRY
+* ABSTRACT : Registration message delivery vehicle sensor information(->Vehicle sensor)
+************************************************************************/
+typedef struct {
+ DID did; /* ID data corresponding to the vehicle sensor information */
+ PNO pno; /* Shipping addressPNO */
+ u_int8 delivery_timing; /* Delivery opportunity */
+ u_int8 ctrl_flg; /* Delivery control */
+ EventID event_id; /* Event ID */
+} VEHICLE_MSG_DELIVERY_ENTRY_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ VEHICLE_MSG_DELIVERY_ENTRY_DAT data; /* Message data */
+} VEHICLE_MSG_DELIVERY_ENTRY;
+
+/************************************************************************
+* Function prototypes *
+************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*[VEHICLE_API Public API]*/
+
+int32 VehicleGetDrData(PNO pno, DID did, void *dest_data, u_int16 dest_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_API_DUMMY_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/Vehicle_API_private.h b/video_in_hal/vehicleservice/positioning/client/include/Vehicle_API_private.h
new file mode 100755
index 0000000..ad92ddb
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/Vehicle_API_private.h
@@ -0,0 +1,129 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_
+/******************************************************************************
+ * File name :Vehicle_API_private.h
+ * System name :GPF
+ * Subsystem name :Vehicle I/F library
+ ******************************************************************************/
+#include <vehicle_service/POS_sensor_API.h>
+#include "Vehicle_API.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define VEHICLE_SHARE_LOCK 0xFF /* Locking */
+#define VEHICLE_SHARE_UNLOCK 0x00 /* Unlocking */
+
+#define VEHICLE_SHARE_BLOCK_MNUM 1 /* Number of shared memory control blocks */
+#define VEHICLE_SHARE_BLOCK_DNUM 10 /* Number of shared memory data blocks */
+/* Number of shared memory blocks */
+#define VEHICLE_SHARE_BLOCK_NUM (VEHICLE_SHARE_BLOCK_MNUM+VEHICLE_SHARE_BLOCK_DNUM)
+
+#define VEHICLE_SHARE_BLOCK_SIZE 512 /* Shared Memory Block Size(byte) */
+#define VEHICLE_SHARE_BLOCK_DSIZE SENSOR_MSG_VSINFO_DSIZE /* Shared Memory Data Size */
+/* Size of shared memory allocation area */
+#define VEHICLE_SHARE_SIZE (VEHICLE_SHARE_BLOCK_SIZE * VEHICLE_SHARE_BLOCK_NUM)
+
+#define VEHICLE_SEMAPHO_NAME ("VEHICLE_SHARE_SEMAPHO") /* Semaphore name */
+
+#define VEHICLE_INVALID 0 /* Disabled */
+#define VEHICLE_EFFECTIVE 1 /* Enabled */
+#define VEHICLE_BIT31 0x80000000
+
+/* ++ PastModel002 compliant_error compliant */
+/* Message Data Size(byte) */
+#define VEHICLE_VSINFO_DSIZE 504 /* Vehicle sensor information */
+/* -- PastModel002 compliant_error compliant */
+
+/*----------------------------------------------------------------------*
+ * Event Related Extensions *
+ *----------------------------------------------------------------------*/
+#define VEHICLE_EVENT_VAL_INIT (VEHICLE_RET_ERROR_MIN-1) /* Event initial value */
+
+/*----------------------------------------------------------------------*
+ * Shared Memory Related Extensions *
+ *----------------------------------------------------------------------*/
+#define VEHICLE_SHARE_NAME ("POS_VEHICLE_SHARE_MEMORY") /* Shared memory name */
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/* ++ PastModel002 compliant_error compliant */
+
+/************************************************************************
+* TAG : VEHICLE_MSG_VSINFO_DAT
+* ABSTRACT : Vehicle sensor information notification message(-> User)
+************************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr; /* Message header */
+ VEHICLE_MSG_VSINFO_DAT data; /* Message data */
+} VEHICLE_MSG_VSINFO;
+
+/* -- PastModel002 compliant_error compliant */
+
+/************************************************************************
+* TAG : VEHICLE_SHARE_MNG
+* ABSTRACT : Shared memory management area
+************************************************************************/
+typedef struct {
+ u_int8 lock_info[VEHICLE_SHARE_BLOCK_NUM]; /* Usages */
+ u_int8 reserve[501];
+} VEHICLE_SHARE_MNG;
+
+/************************************************************************
+* TAG : VEHICLE_SHARE_BLOCK_DAT
+* ABSTRACT : Shared memory data area(One block)
+************************************************************************/
+typedef struct {
+ u_int16 size; /* Size of the data */
+ u_int8 reserve[2];
+ u_int8 data[VEHICLE_SHARE_BLOCK_DSIZE]; /* Data */
+} VEHICLE_SHARE_BLOCK_DAT;
+
+/************************************************************************
+* TAG : VEHICLE_SHARE_BLOCK_MNG
+* ABSTRACT : Areas of memory that are shared
+************************************************************************/
+typedef struct {
+ VEHICLE_SHARE_MNG mng; /* Shared memory management information */
+ VEHICLE_SHARE_BLOCK_DAT data[VEHICLE_SHARE_BLOCK_DNUM]; /* Shared memory data portion */
+} VEHICLE_SHARE;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+RET_API VehicleDeleteEvent(EventID event_id);
+RET_API VehicleLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset);
+RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, u_int16 offset);
+EventID VehicleCreateEvent(PNO pno);
+void PosSetShareData(void *share_top, u_int16 offset, const void *data_src, u_int16 size_src);
+RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data);
+
+SENSOR_RET_API PosRegisterListenerProc(PCSTR notify_name, DID did, u_int8 ctrl_flg, u_int8 delivery_timing);
+
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_ */
diff --git a/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_common_API.h b/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_common_API.h
new file mode 100755
index 0000000..5ee3005
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_common_API.h
@@ -0,0 +1,1663 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_COMMON_API_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_COMMON_API_H_
+
+/**
+ * @file POS_common_API.h
+ * @brief API definition file for common function
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/POS_define.h>
+#include <gps_hal.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* State definitions can be used */
+#define SENSORLOCATION_STATUS_DISABLE (0) //!< \~english Not available
+#define SENSORLOCATION_STATUS_ENABLE (1) //!< \~english Available
+
+/* State definitions can be used */
+#define SENSORMOTION_STATUS_DISABLE (0) //!< \~english Not available
+#define SENSORMOTION_STATUS_ENABLE (1) //!< \~english Available
+/* Acquisition method */
+#define SENSOR_GET_METHOD_AUTO (0) //!< \~english Not specified
+#define SENSOR_GET_METHOD_GPS (1) //!< \~english GPS
+#define SENSOR_GET_METHOD_NAVI (2) //!< \~english Navigation
+#define SENSOR_GET_METHOD_DR (3) //!< \~english Dead Reckoning
+#define SENSOR_GET_METHOD_POS (4) //!< \~english positioning (Internal)
+
+
+#define LOCATIONINFO_NMEA_MAX (1020)
+//!< \~english Max length of 'Location Information'
+
+/* Command ID */
+/* Vehicle sensor information notification CID (Rate information) */
+
+/**
+ * \~english @brief Delivery speed command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_SPEED, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_SPEED (0x0203)
+
+/**
+ * \~english @brief Delivery longitude and latitude command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_LONLAT, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_LONLAT 0x0781
+
+/**
+ * \~english @brief Delivery altitude command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_ALTITUDE, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_ALTITUDE 0x0782
+
+/**
+ * \~english @brief Delivery heading command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_HEADING, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_HEADING 0x0783
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @struct POS_POSDATA
+ * \~english position information
+ */
+typedef struct {
+ int8_t status; //!< \~english data status
+ uint8_t posSts; //!< \~english position status
+ uint16_t posAcc; //!< \~english position accuracy
+ int32_t longitude; //!< \~english current longitude
+ int32_t latitude; //!< \~english current latitude
+ int32_t altitude; //!< \~english current altitude
+ int16_t heading; //!< \~english current heading
+ uint8_t reserved[2]; //!< \~english reserve
+} POS_POSDATA;
+
+/**
+ * @struct SENSORLOCATION_MSG_LONLATINFO
+ * \~english longitude and latitude information data delivery message
+ */
+typedef struct {
+ SENSORLOCATION_LONLATINFO_DAT data;
+ //!< \~english longitude and latitude information data
+} SENSORLOCATION_MSG_LONLATINFO;
+
+/**
+ * @struct SENSORLOCATION_MSG_ALTITUDEINFO
+ * \~english altitude information data delivery message
+ */
+typedef struct {
+ SENSORLOCATION_ALTITUDEINFO_DAT data; //!< \~english altitude information data
+} SENSORLOCATION_MSG_ALTITUDEINFO;
+
+/**
+ * @struct SENSORMOTION_MSG_HEADINGINFO
+ * \~english heading information data delivery message
+ */
+typedef struct {
+ SENSORMOTION_HEADINGINFO_DAT data; //!< \~english heading information data
+} SENSORMOTION_MSG_HEADINGINFO;
+
+/**
+ * @struct SENSORMOTION_MSG_SPEEDINFO
+ * \~english speed information data delivery message
+ */
+typedef struct {
+ SENSORMOTION_SPEEDINFO_DAT data; //!< \~english speed information data
+} SENSORMOTION_MSG_SPEEDINFO;
+
+
+/**
+ * @struct POS_LOCATIONINFO_NMEA
+ * \~english Structure of Location Information (NMEA)
+ */
+typedef struct {
+ uint32_t length; //!< \~english length
+ uint8_t data[LOCATIONINFO_NMEA_MAX]; //!< \~english data
+} POS_LOCATIONINFO_NMEA;
+
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+/* SENSOR_API public API */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register for longitude and lattitude delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Navigation/Not specified)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register for specified logtitude and latitude delivery
+/// - Please note if call this function for multiple times, the data will be deliveried for multiple times.
+/// - The specified longitude and latitude will be deliveried during the registration(first delivery)
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change. Specified longitude and latitude will be deliveried \n
+/// only when it has been changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update. Specified longitude and latitude will be deliveried \n
+/// every time that has been updated by the vehicle sensors.
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS. The longitude and latitude from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - Navi. The longitude and latitude from Navigation will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified. The specified longitude and latitude will be deliveried \n
+/// according to the current environment.
+/// - Avaliable method is descriped as following:\n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.\n
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUFFULL the register count is full
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) nor change \n
+/// (SENSOR_DELIVERY_TIMING_CHANGE) [POS_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to the max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to the max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to the max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference to the event \n
+/// is reach to the max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference to the event \n
+/// is reach to the max [POS_RET_ERROR_INNER]
+/// - Memory allocate failed during the event table creation for the event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been registered. \n
+/// [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between process. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer failed between process. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during waiting event. \n
+/// [POS_RET_ERROR_INNER]
+/// - The count of thread beyond max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during getting event. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - Getting event timeout. [POS_RET_ERROR_INNER]
+/// - Error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The result of positioning service returned is SENSOR_RET_ERROR_PARAM. [POS_RET_ERROR_PARAM]
+/// - The result of positioning service returned is SENSOR_RET_ERROR_BUFFULL. [POS_RET_ERROR_BUFFULL]
+/// - The result of positioning service returned is SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of positioning service returned is not SENSOR_RET_ERROR_PARAM and SENSOR_RET_ERROR_BUFFULL \n
+/// and SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register longitude and latitude information delivery.\n
+/// This API return the result of registered.
+/// \n
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same time.
+/// - After call this API, if the delivery destination thread name has been changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor information will been sent as system API \n
+/// message with following format.\n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_LONLAT \n
+/// message structure
+/// \~english @code
+/// typedef struct {
+/// SENSORLOCATION_LONLATINFO_DAT data; /* message data */
+/// } SENSORLOCATION_MSG_LONLATINFO;
+/// @endcode
+/// message data structure \n
+///
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* Synchrony count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t posSts; /* position status */
+/// uint16_t posAcc; /* Position accuracy */
+/// int32_t Longitude; /* Longitude */
+/// int32_t Latitude; /* Latitude */
+/// } SENSORLOCATION_LONLATINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - longitude and latitude from GPS
+/// - SENSOR_GET_METHOD_NAVI - longitude and latitude from Navigation
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous \n
+/// When delivery altitude and heading data, position data can be synchronized by SyncCnt.\n
+/// But the data of different method can not be synchronized by SyncCnt.\n
+/// Example 1: [LonLat from GPS] and [Heading from GPS] can be synchronized by SyncCnt.\n
+/// Example 2: [LonLat from GPS] and [LonLat from Navi] can not be synchronized by SyncCnt.\n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable) \n
+/// To describe this delivery message is whether can be used or not
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - when GPS data is specified,longitude and latitude is invalid at following condition:\n
+/// so [not avaliable] provieded
+/// - After system start, GPS unit has not received current location data and GPS unit \n
+/// status is not positioning fixed.
+/// - If it is not initialized status, certainly provide [avaliable] when Navigation data specified
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Position status(posSts)
+/// - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+/// - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+/// - Bit2 : DR data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DR)
+/// - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
+/// maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+/// - Position accuracy(posAcc)
+/// - Detected accruray of current position:1LSB=1m \n
+/// - Longitude : (WGS-84)(10^-7degree as 1) \n
+/// East longitude is positive value and west longitude is negative value.
+/// - Latitude : (WGS-84)(10^-7degree as 1) \n
+/// North latitude positive value and south latitude is negative value.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - POS_GetLonLat
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming,
+ uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register altitude delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Not specified)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified altitude delivery
+/// - Please note that if the same data delivery has been registered for multiple times, the data will \n
+/// also be deliveried for registered multiple times.
+/// - The specified altitude will be deliveried at registered time (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change. Specified altitude will be deliveried only when it is changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update. Specified altitude will be deliveried when it is updated by \n
+/// vehicle sensor.
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS. The altitude from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified. The altitude will be deliveried according to \n
+/// the current environment
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUFFULL the register count is full
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the dispatcher \n
+/// for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) nor change \n
+/// (SENSOR_DELIVERY_TIMING_CHANGE) [POS_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not registered(SENSOR_DELIVERY_REGIST) [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reached to the max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reached to the max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reached to the max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference to the event \n
+/// is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference to the event \n
+/// is reach to the max [POS_RET_ERROR_INNER]
+/// - Memory allocate failed during the event table creation for that event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been registered. \n
+/// [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event waiting. \n
+/// [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting.[POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - Getting event timeout. [POS_RET_ERROR_INNER]
+/// - Error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The result of positioning service is SENSOR_RET_ERROR_PARAM. [POS_RET_ERROR_PARAM]
+/// - The result of positioning service is SENSOR_RET_ERROR_BUFFULL. [POS_RET_ERROR_BUFFULL]
+/// - The result of positioning service is SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of positioning service is not SENSOR_RET_ERROR_PARAM and SENSOR_RET_ERROR_BUFFULL and \n
+/// SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register altitude delivery. \n
+/// This API will finish when get the return value.
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name is changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor will send system API message with following format. \n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_ALTITUDE \n
+/// message structure
+/// \~english @code
+/// typedef struct {
+/// SENSORLOCATION_ALTITUDEINFO_DAT data; /* message data */
+/// } SENSORLOCATION_MSG_ALTITUDEINFO;
+/// @endcode
+/// message data structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* synchrony count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t Reserve[3]; /* Reserve */
+/// int32_t Altitude; /* Altitude(unit:0.01m) */
+/// } SENSORLOCATION_ALTITUDEINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - altitude from GPS
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous \n
+/// When delivery altitude and heading data, position data can be synchronized by SyncCnt. \n
+/// But the data of different method can not be synchronized by SyncCnt.\n
+/// example: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by SyncCnt.\n
+/// synchronized by SyncCnt. \n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable) \n
+/// To describe this delivery message is whether can be used or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - when GPS data specified, Altitude is invalid at following condition(so [not avaliable] provieded):
+/// - Immediately after system start, GPS unit has not received current location data and GPS unit status \n
+/// is not positioning fix
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Altitude
+/// - altitude data(unit 0.01m)
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see delivery
+/// - POS_GetAltitude
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_RegisterListenerAltitude(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming,
+ uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register speed delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(POS/Navi/Not specified)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified speed delivery
+/// - Please note that if the same data delivery has been registered for multiple times, the data will \n
+/// also be deliveried for registered mutiple times.
+/// - The specified speed will be deliveried at registered time (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change. Specified speed will be deliveried only when it is changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update. Specified speed will be deliveried when it is updated by \n
+/// vehicle sensor.
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - Navi The speed from Navi will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified The speed will be deliveried according to the current environment
+/// deliveried.
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+///
+/// \~english @retval POS_RET_NORMAL normal end
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUFFULL the register count is full
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher for App \n
+/// are completed.
+/// - Availability of service positioning is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) \n
+/// nor change(SENSOR_DELIVERY_TIMING_CHANGE) [POS_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate failed during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been registered. \n
+/// [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer between processes.\n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event waiting. \n
+/// [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - Getting event timeout. [POS_RET_ERROR_INNER]
+/// - Error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The result of positioning service is SENSOR_RET_ERROR_PARAM. [POS_RET_ERROR_PARAM]
+/// - The result of positioning service is SENSOR_RET_ERROR_BUFFULL. [POS_RET_ERROR_BUFFULL]
+/// - The result of positioning service is SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of positioning service is not SENSOR_RET_ERROR_PARAM and SENSOR_RET_ERROR_BUFFULL \n
+/// and SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register speed delivery. \n
+/// This API will finish when get the return value.
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name is changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor will send system API message with following format. \n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_SPEED \n
+/// message structure
+/// \~english @code
+/// typedef struct {
+/// SENSORMOTION_SPEEDINFO_DAT data; /* message data */
+/// } SENSORMOTION_MSG_SPEEDINFO;
+/// @endcode
+/// message data structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* synchrony count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t Reserve1[3]; /* Reserve */
+/// uint16_t Speed; /* speed(unit:0.01m/sec) */
+/// uint8_t Reserve2[2]; /* Reserve */
+/// } SENSORMOTION_SPEEDINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - speed from Navi
+/// - Synchrony count(SyncCnt)
+/// - 0 (not change).
+/// - Enable or not(isEnable) \n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - Speed is invalid at following condition when speed pulse specified, so [not avaliable] provieded
+/// - Immediately after system start, the sensor data have not been received from SYS micon
+/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Speed
+/// - speed data(unit 0.01m/sec)
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - POS_GetSpeed
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_RegisterListenerSpeed(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming,
+ uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register heading delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Navi/Not specified)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified heading delivery
+/// - Please note that if the same data delivery has been registered for mutiple times, the data will \n
+/// also be deliveried for registered mutiple times.
+/// - The specified heading will be deliveried at registered time (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change. Specified heading will be deliveried only when it is changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update. Specified heading will be deliveried when it is updated by \n
+/// vehicle sensor.
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS. The heading from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified. The heading will be deliveried \n
+/// according to the current environment
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUFFULL the register count is full
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher \n
+/// for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) nor change \n
+/// (SENSOR_DELIVERY_TIMING_CHANGE) [POS_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate failed during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already \n
+/// been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer between \n
+/// processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event waiting. \n
+/// [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - Getting event timeout. [POS_RET_ERROR_INNER]
+/// - Error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The result of positioning service is SENSOR_RET_ERROR_PARAM. [POS_RET_ERROR_PARAM]
+/// - The result of positioning service is SENSOR_RET_ERROR_BUFFULL. [POS_RET_ERROR_BUFFULL]
+/// - The result of positioning service is SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of positioning service is not SENSOR_RET_ERROR_PARAM and SENSOR_RET_ERROR_BUFFULL \n
+/// and SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register heading delivery.
+/// This API will finish when get the return value.
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name is changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor will send system API message with following format. \n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_HEADING \n
+/// message structure
+/// \~english @code
+/// typedef struct {
+/// SENSORMOTION_HEADINGINFO_DAT data; /* message data */
+/// } SENSORMOTION_MSG_HEADINGINFO;
+/// @endcode
+/// message data structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* sync count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t posSts; /* position status */
+/// uint8_t Reserve1[2]; /* Reserve */
+/// uint16_t Heading; /* heading(unit:0.01degree) */
+/// uint8_t Reserve2[2]; /* Reserve */
+/// } SENSORMOTION_HEADINGINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - Heading from GPS
+/// - SENSOR_GET_METHOD_NAVI - Heading from Navi
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous \n
+/// When delivery altitude and heading data, position data can be synchronized by this count. \n
+/// But the data of different method can not be synchronized by this count.\n
+/// example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n
+/// example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be \n
+/// synchronized by the count. \n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable) \n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - Heading is invalid at following condition when GPS data specified, so [not avaliable] provieded \n
+/// - Immediately after system start, GPS unit has not received current location data and GPS unit status \n
+/// is not positioning fix
+/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Position status(posSts)
+/// - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+/// - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+/// - Bit2 : DR data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DR)
+/// - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
+/// maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+/// - Heading
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - POS_GetHeading
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming,
+ uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get longitude and latitude information
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] dat
+/// - SENSORLOCATION_LONLATINFO_DAT* - output pointer to longitude and latitude informaiton
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Navi/Not specified)
+///
+/// \~english @par
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS The longitude and latitude from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - Navi The longitude and latitude from Navi will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified The longitude and latitude will be deliveried \n
+/// according to the current environment.
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+/// \~english @par
+/// - SENSORLOCATION_LONLATINFO_DAT structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* sync count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t posSts; /* position status */
+/// uint16_t posAcc; /* Position accuracy */
+/// int32_t Longitude; /* Longitude */
+/// int32_t Latitude; /* Latitude */
+/// } SENSORLOCATION_LONLATINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - longitude and latitude from GPS
+/// - SENSOR_GET_METHOD_NAVI - longitude and latitude from Navi
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous\n
+/// When delivery altitude and heading data, position data can be synchronized by this count. \n
+/// But the data of different method can not be synchronized by this count. \n
+/// example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by this count. \n
+/// example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be \n
+/// synchronized by this count. \n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable) \n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - longitude and latitude is invalid at following condition when GPS data specified, \n
+/// so [not avaliable] provieded
+/// - Immediately after system start, GPS unit has not received current location data and \n
+/// GPS unit status is not positioning fix
+/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified\n
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Position status(posSts)
+/// - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+/// - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+/// - Bit2 : DR data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DR)
+/// - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
+/// maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+/// - Position accuracy(posAcc)
+/// - Detected accruray of current position:1LSB=1m
+/// - Longitude : (WGS-84)(10^-7degree as 1) \n
+/// East longitude is positive value and west longitude is minus value.
+/// - Latitude : (WGS-84)(10^-7degree as 1)\n
+/// North latitudeis positive value and south latitude is minus value.
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher \n
+/// for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter dat is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate failed during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been registered. \n
+/// [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when lock semaphore. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when lock mutex. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when lock mutex. [POS_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when lock mutex. [POS_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_INNER]
+/// - Can not open share memory. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [POS_RET_ERROR_INNER]
+/// - No empty field in share memory. [POS_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between processes. \n
+/// [POS_RET_ERROR_INNER]
+/// - Message transfer failed between process. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event waiting. \n
+/// [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing received data. \n
+/// [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_INNER]
+/// - The result of getting sensor data get is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of getting sensor data get is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get longitude and latitude from vehicle sensor
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_RegisterListenerLonLat
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_GetLonLat(HANDLE hApp, SENSORLOCATION_LONLATINFO_DAT *dat, uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get altitude data
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] dat
+/// - SENSORLOCATION_ALTITUDEINFO_DAT* - output pointer to altitude data
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Not specified)
+///
+/// \~english @par
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS The altitude from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified The altitude will be deliveried \n
+/// according to the current environment
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+/// \~english @par
+/// - SENSORLOCATION_ALTITUDEINFO_DAT structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* sync count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t Reserve[3]; /* Reserve */
+/// int32_t Altitude; /* Altitude(unit:0.01m) */
+/// } SENSORLOCATION_ALTITUDEINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - altitude from GPS
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous \n
+/// When delivery altitude and heading data, position data can be synchronized by this count. \n
+/// But the data of different method can not be synchronized by this count. \n
+/// example: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n
+/// synchronized by the count. \n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable)\n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - Altitude is invalid at following condition when GPS data specified, so [not avaliable] provieded
+/// - Immediately after system start, GPS unit has not received current location data and GPS unit \n
+/// status is not positioning fix
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Altitude
+/// - altitude data(unit 0.01m)
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of \n
+/// the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter dat is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when lock semaphore. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when lock mutex. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when lock mutex. [POS_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when lock mutex. [POS_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_INNER]
+/// - Can not open share memory. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [POS_RET_ERROR_INNER]
+/// - No empty field in share memory. [POS_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing
+/// received data. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_INNER]
+/// - The result of getting sensor data is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of getting sensor data is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get altitude from vehicle sensor
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_RegisterListenerAltitude
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_GetAltitude(HANDLE hApp, SENSORLOCATION_ALTITUDEINFO_DAT *dat, uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get speed data
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] dat
+/// - SENSORMOTION_SPEEDINFO_DAT* - output buffer pointer to store speed data
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(POS/Navi/Not specified)
+///
+/// \~english @par
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - Navi The speed from Navi will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified The speed will be deliveried according to current \n
+/// environment.
+/// - Avaliable method is descriped as following in each environment. \n
+/// In the following environment, if the SENSOR_GET_METHOD_AUTO is set,treated as default \n
+/// In the following environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+///
+/// \~english @par
+/// - SENSORMOTION_SPEEDINFO_DAT structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* sync count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t Reserve1[3]; /* Reserve */
+/// uint16_t Speed; /* speed(unit:0.01m/sec) */
+/// uint8_t Reserve2[2]; /* Reserve */
+/// } SENSORMOTION_SPEEDINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
+/// - Sync count(SyncCnt)
+/// - 0.
+/// - Enable or not(isEnable) \n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - Speed is invalid at following condition when speed pulse specified, so [not avaliable] provieded
+/// - Immediately after system start, the sensor data have not been received from SYS micon
+/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Speed
+/// - speed data(unit 0.01m/sec)
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter dat is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied when the event table creation that for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table when the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full when event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed when event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when semaphore lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when mutex lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when mutex lock. [POS_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when mutex lock. [POS_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_INNER]
+/// - Can not open share memory. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [POS_RET_ERROR_INNER]
+/// - No empty field in share memory. [POS_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer \n
+/// between processes [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between \n
+/// processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event \n
+/// waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing \n
+/// received data. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_INNER]
+/// - The result of getting sensor data is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of getting sensor data is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get speed from vehicle sensor.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_RegisterListenerSpeed
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_GetSpeed(HANDLE hApp, SENSORMOTION_SPEEDINFO_DAT *dat, uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get heading data
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] dat
+/// - SENSORMOTION_HEADINGINFO_DAT* - output buffer pointer to store heading data
+/// \~english @param [in] ucGetMethod
+/// - uint8_t - Get method(GPS/Navi/Not specified)
+///
+/// \~english @par
+/// - Get method(ucGetMethod)
+/// - SENSOR_GET_METHOD_GPS - GPS The heading from GPS will be deliveried.
+/// - SENSOR_GET_METHOD_NAVI - Navi The heading from Navi will be deliveried.
+/// - SENSOR_GET_METHOD_AUTO - Not specified The heading which most suitable in current environment \n
+/// - Avaliable method is descriped as following in each environment. \n
+/// In corresponding environment, the SENSOR_GET_METHOD_AUTO is set as default. \n
+/// In corresponding environment, if the unsupported method has been specified, \n
+/// POS_RET_ERROR_PARAM will be returned.
+/// \~english @par
+/// - SENSORMOTION_HEADINGINFO_DAT structure
+/// \~english @code
+/// typedef struct {
+/// uint8_t getMethod; /* get method */
+/// uint8_t SyncCnt; /* sync count */
+/// uint8_t isEnable; /* enable or not */
+/// uint8_t posSts; /* position status */
+/// uint8_t Reserve1[2]; /* Reserve */
+/// uint16_t Heading; /* heading(unit:0.01degree) */
+/// uint8_t Reserve2[2]; /* Reserve */
+/// } SENSORMOTION_HEADINGINFO_DAT;
+/// @endcode
+/// - Get method(getMethod)
+/// - SENSOR_GET_METHOD_GPS - Heading from GPS
+/// - SENSOR_GET_METHOD_NAVI - Heading from Navi
+/// - Synchrony count(SyncCnt)
+/// - Count for position data synchronous \n
+/// When delivery altitude and heading data, position data can be synchronized by this count. \n
+/// But the data of different method can not be synchronized by this count. \n
+/// example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n
+/// example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be \n
+/// synchronized by the count. \n
+/// Caution: The sensor count in sensor data delivery is another data.
+/// - Enable or not(isEnable) \n
+/// To describe this data is whether enable or not.
+/// - 0 - not avaliable
+/// - not 0 - avaliable
+/// - Heading is invalid at following condition when GPS data specified, so [not avaliable] provieded
+/// - Immediately after system start, GPS unit has not received current location data and GPS unit \n
+/// status is not positioning fix
+/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified
+/// - If the status is [not avaliable], data following can not be guaranteed.
+/// - Position status(posSts)
+/// - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+/// - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+/// - Bit2 : DR data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DR)
+/// - Bit3 : MapMatching data use result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+/// - Heading
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher
+/// - for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter dat is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when semaphore lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when mutex lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when mutex lock. [POS_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when mutex lock. [POS_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_INNER]
+/// - Can not open share memory. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [POS_RET_ERROR_INNER]
+/// - No empty field in share memory. [POS_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered between \n
+/// processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table \n
+/// during event waiting[POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing received \n
+/// data. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_INNER]
+/// - The result of getting sensor data is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of getting sensor data is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get heading from vehicle sensor.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_RegisterListenerHeading
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_GetHeading(HANDLE hApp, SENSORMOTION_HEADINGINFO_DAT *dat, uint8_t ucGetMethod);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Set speed information
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] navispeed
+/// - uint16_t - speed data[unit: 1.0km/h]
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of \n
+/// the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The data size is larger than specified value(POS_MSG_INFO_DSIZE) [POS_RET_ERROR_RESOURCE]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The message queue name has not been registered in control table. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table. [POS_RET_ERROR_INNER]
+/// - Speed data setting message transfer failed. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to set speed to vehicle sensor. \n
+/// This API will finish when get the return value. \n
+/// The speed set by this API is saved in positioning as the speed calculated by Navi.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - This API is only called by Navi proxy.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+/// \~english @see
+/// - None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_SetSpeedInfo(HANDLE hApp, uint16_t navispeed);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Set location information
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] pstPosData
+/// - POS_POSDATA * - pointer to location information
+///
+/// \~english @par
+/// - POS_POSDATA structure
+/// \~english @code
+/// typedef struct
+/// {
+/// int8_t status; /* data status */
+/// uint8_t posSts; /* position status */
+/// uint16_t posAcc; /* Position accuracy 1LSB=1m */
+/// int32_t Longitude; /* Longitude(unit:1/128sec) */
+/// int32_t Latitude; /* Latitude(unit:1/128sec) */
+/// int32_t altitude; /* altitude (unit:0.01m) */
+/// int16_t heading; /* heading (unit:1degree) */
+/// uint8_t reserved[2]; /* reserve */
+/// } POS_POSDATA;
+/// @endcode
+///
+/// \~english @par
+/// - data status(status) \n
+/// Do not set the invalid data(do not update data).
+/// - data valid/invalid status
+/// - Bit0 : latitude(1:valid, 0:invalid, definition of maskbit:POS_LOC_INFO_LAT)
+/// - Bit1 : longitude(1:valid, 0:invalid, definition of maskbit:POS_LOC_INFO_LON)
+/// - Bit2 : altitude (1:valid, 0:invalid, definition of maskbit:POS_LOC_INFO_ALT)
+/// - Bit3 : heading (1:valid, 0:invalid, definition of maskbit:POS_LOC_INFO_HEAD)
+/// - Bit4~7 : reserve
+/// - Position status(posSts)
+/// - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
+/// - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
+/// - Bit2 : DR data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DR)
+/// - Bit3 : MapMatching data use result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_MAPMATCHING)
+/// - Bit4~7 : reserve
+/// - Position accuracy(posAcc)
+/// - Detected accruray of current position:1LSB=1m
+/// - longitude
+/// - data range: -180deg ~ +180deg
+/// - +: east longitude -: west longitude
+/// - latitude
+/// - data range:-90deg ~ +90deg
+/// - +: north latitude -: south latitude
+/// - heading
+/// - data range:-179deg ~ +180deg
+/// - Based on north, west(counter-clockwise) is +, east(clockwise) is -
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher \n
+/// for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter pstPosData is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The data status in parameter pstPosData is invalid value(0). [POS_RET_ERROR_PARAM]
+/// - The data status in parameter pstPosData is abnormal value(<15). [POS_RET_ERROR_PARAM]
+/// - The data size is larger than specified value(POS_MSG_INFO_DSIZE) [POS_RET_ERROR_RESOURCE]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The message queue name has not been registered in control table. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table. [POS_RET_ERROR_INNER]
+/// - Location data setting message transfer failed. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to set location to vehicle sensor. \n
+/// This API will finish when get the return value. \n
+/// The location set by this API is saved in positioning as the location calculated by Navi. \n
+/// If one of longitude and latitude is valid, the another data will be used as valid data no \n
+/// matter what status it is. \n
+/// If one of longitude and latitude is valid, the position accuracy data will be used as valid data.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - This API is only called by Navi proxy.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+/// \~english @see
+/// - None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_SetLocationInfo(HANDLE hApp, POS_POSDATA* pstPosData);
+
+#ifdef __cplusplus
+}
+#endif
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_COMMON_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_define.h b/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_define.h
new file mode 100755
index 0000000..2ea918d
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_define.h
@@ -0,0 +1,134 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_DEFINE_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_DEFINE_H_
+
+/**
+ * @file POS_define.h
+ * @brief Header file to define the constants and structure
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+#include <gps_hal.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+#define POS_AVAILABILITY "Positioning/Availability" //!< \~english Availability
+
+/* message sender thread */
+#define POS_NTFY_SEND_THREAD "POS_Main" //!< \~english POS_Main thread
+#define POS_NTFY_SEND_THREAD_GPS "POS_Gps" //!< \~english POS_Gps thread
+
+/* SENSOR_RET_API */
+#define SENSOR_RET_NORMAL 0 //!< \~english normal finish
+#define SENSOR_RET_ERROR_PID (-1) //!< \~english thread ID error
+#define SENSOR_RET_ERROR_DID (-2) //!< \~english unregistered data ID error
+#define SENSOR_RET_ERROR_DID_DIS (-3) //!< \~english data ID not CAN ID
+#define SENSOR_RET_ERROR_PARAM (-4) //!< \~english parameter error
+#define SENSOR_RET_ERROR_BUFFULL (-5) //!< \~english buffer full error
+#define SENSOR_RET_ERROR_CREATE_EVENT (-6) //!< \~english create event error
+#define SENSOR_RET_ERROR_TIMER (-7) //!< \~english create timer error
+#define SENSOR_RET_ERROR_OUTOF_MEMORY (-8)
+//!< \~english share memory allocation size error
+
+#define SENSOR_RET_ERROR_SIZE (-9) //!< \~english memory size error
+#define SENSOR_RET_ERROR (-10) //!< \~english error occured
+#define SENSOR_RET_ERROR_NOSUPPORT (-11) //!< \~english no support
+#define SENSOR_RET_ERROR_INNER (-12) //!< \~english Internal error
+#define SENSOR_RET_ERROR_RESOURCE (-13) //!< \~english lack of resources
+#define SENSOR_RET_ERROR_MIN POS_RET_ERROR_MIN //!< \~english min value of error
+
+/* Data Status Definition */
+#define POS_LOC_INFO_LAT 0x01
+//!< \~english current position latitude(bit0) 1:valid 0:invalid
+
+#define POS_LOC_INFO_LON 0x02
+//!< \~english current position longitude(bit1) 1:valid 0:invalid
+
+#define POS_LOC_INFO_ALT 0x04
+//!< \~english current position altitude(bit2) 1:valid 0:invalid
+
+#define POS_LOC_INFO_HEAD 0x08
+//!< \~english current position heading(bit3) 1:valid 0:invalid
+
+/* Definition of positioning system */
+#define POS_LOC_INFO_USE_GSP 0x01
+//!< \~english GPS data used result(bit0) 1:valid 0:invalid
+
+#define POS_LOC_INFO_USE_DGPS 0x02
+//!< \~english DGPS data used result(bit1) 1:valid 0:invalid
+
+#define POS_LOC_INFO_USE_DR 0x04
+//!< \~english Dead Reckoning used result(bit2) 1:valid 0:invalid
+
+#define POS_LOC_INFO_USE_MAPMATCHING 0x08
+//!< \~english MapMatching result(bit3) 1:valid 0:invalid
+
+/*--- for message ---*/
+/* message body size (byte) */
+/* move to gps_hal.h */
+
+/*--- for register listener API ---*/
+/* control delivery */
+#define SENSOR_DELIVERY_REGIST 0x01 //!< \~english register delivery
+
+/* delivery timing control */
+#define SENSOR_DELIVERY_TIMING_UPDATE 0x01 //!< \~english delivery update timing
+#define SENSOR_DELIVERY_TIMING_CHANGE 0x02 //!< \~english delivery change timing
+
+/* POS_RET_API */
+#define POS_RET_NORMAL 0 //!< \~english normal finish
+#define POS_RET_ERROR (-1) //!< \~english error occured
+#define POS_RET_ERROR_DID (-2) //!< \~english data ID error
+#define POS_RET_ERROR_INNER (-3) //!< \~english internal error
+#define POS_RET_ERROR_PARAM (-4) //!< \~english parameter error
+#define POS_RET_ERROR_BUFFULL (-5) //!< \~english buffer full error
+#define POS_RET_ERROR_CREATE_EVENT (-6) //!< \~english create event error
+#define POS_RET_ERROR_OUTOF_MEMORY (-8)
+//!< \~english share memory allocation size error
+
+#define POS_RET_ERROR_SIZE (-9) //!< \~english memory size error
+#define POS_RET_ERROR_TIMEOUT (-10) //!< \~english timeout error
+#define POS_RET_ERROR_NOSUPPORT (-11) //!< \~english no support
+#define POS_RET_ERROR_BUSY (-12) //!< \~english busy
+#define POS_RET_ERROR_RESOURCE (-13) //!< \~english lack of resources
+#define POS_RET_ERROR_MIN (-13) //!< \~english min value of error
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+typedef int32_t SENSOR_RET_API; //!< \~english API return value
+typedef int32_t POS_RET_API; //!< \~english API return value
+typedef uint32_t DID; //!< \~english data ID
+typedef int32_t RET_API; //!< \~english _CWORD64_ API return value
+
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_DEFINE_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_gps_API.h b/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_gps_API.h
new file mode 100755
index 0000000..41e8e01
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_gps_API.h
@@ -0,0 +1,1135 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_GPS_API_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_GPS_API_H_
+/**
+ * @file POS_gps_API.h
+ * @brief API definition file for GPS function
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/POS_define.h>
+#include <gps_hal.h>
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+typedef int32_t NAVIINFO_RET_API;
+//!< \~english define return value of Get/Set GPS information API
+
+/*---------------------------------------------------------------------------------*
+ * Event declaration *
+ *---------------------------------------------------------------------------------*/
+
+
+/**
+ * \~english @brief GPS time setting result delivery command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(h_app,POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ 0x0780
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @struct SENSOR_MSG_SEND_DAT
+ * \~english message for setting vehicle sensor data(to vehicle sensor)
+ */
+typedef struct {
+ DID did; //!< \~english data ID
+ uint16_t usSize; //!< \~english data size
+ uint8_t data[502]; //!< \~english data body
+} SENSOR_MSG_SEND_DAT;
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+/* GPS_API public API */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - GPS setting request
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] p_data
+/// - SENSOR_MSG_SEND_DAT * - pointer of GPS setting data
+///
+/// \~english @par
+/// - SENSOR_MSG_SEND_DAT structure
+/// \~english @code
+/// typedef struct
+/// {
+/// DID did; /* Data ID */
+/// uint16_t usSize; /* Data size */
+/// uint8_t data[502]; /* Data body */
+/// } SENSOR_MSG_SEND_DAT;
+/// @endcode
+///
+/// \~english @par
+/// - Data ID(did)
+/// - POS_DID_GPS__CWORD82__SETINITIAL - setting initial location and time data to GPS \n
+/// (reference to initial location, time setting(_CWORD82_))
+/// - POS_DID_GPS__CWORD82__SETRMODEEX - setting GPS receiver mode(pull extension sentence) \n
+/// (reference to GPS receiver mode setting(_CWORD82_))
+/// - POS_DID_GPS__CWORD82__SELSENT - setting command to GPS that output any sentence \n
+/// (reference to output any sentence setting(_CWORD82_))
+///
+///
+/// \~english @retval SENSOR_RET_NORMAL normal finish
+/// \~english @retval SENSOR_RET_ERROR_CREATE_EVENT event create error
+/// \~english @retval SENSOR_RET_ERROR_PARAM parameter error
+/// \~english @retval SENSOR_RET_ERROR_DID data ID not registered
+/// \~english @retval SENSOR_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval SENSOR_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter p_data is NULL [SENSOR_RET_ERROR_PARAM]
+/// - Data ID(p_data->did) is not supported [SENSOR_RET_ERROR_DID]
+/// - GPS setting data size(p_data->usSize) is not same with the data \n
+/// that related to data ID [SENSOR_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The message queue name has not been registered in control table when GPS \n
+/// setting message transfer between processes. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Message transfer HANDLE create failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Message transfer HANDLE get failed from internal table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - GPS setting message transfer failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+///
+/// \~english @par Detail
+/// - Call this API to set GPS data. \n
+/// The GPS data specified by the parameter p_data will be set in positioning.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - This API is only called by Navigation proxy.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+/// \~english @see
+/// - None
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+int32_t POS_ReqGPSSetting(HANDLE hApp, SENSOR_MSG_SEND_DAT *p_data);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Set GPS information
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] navilocinfo
+/// - NAVIINFO_ALL * - pointer of GPS information
+///
+/// \~english @par
+/// - NAVIINFO_ALL structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint8_t ucSensorCnt; /* sensor count */
+/// uint8_t reserve[3]; /* reserve */
+/// NAVIINFO_DIAG_GPS stDiagGps; /* position fix related information */
+/// NAVIINFO_NAVI_GPS stNaviGps; /* other GPS related information */
+/// } NAVIINFO_ALL;
+/// @endcode
+/// - sensor count \n
+/// sensor count value when GPS data received
+///
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS structure
+/// \~english @code
+/// typedef struct
+/// {
+/// NAVIINFO_DIAG_GPS_FIX stFix; /* position fix information */
+/// NAVIINFO_DIAG_GPS_SAT stSat; /* all satellite information */
+/// } NAVIINFO_DIAG_GPS;
+/// @endcode
+/// \n
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint8_t ucFixSts; /* position fix status */
+/// uint8_t ucReserve[3]; /* reserve */
+/// NAVIINFO_DIAG_GPS_FIX_CNT stCnt; /* position fix count data */
+/// NAVIINFO_DIAG_GPS_FIX_XYZ stWgs84; /* lonlat data(WGS84 geodetic) */
+/// } NAVIINFO_DIAG_GPS_FIX;
+/// @endcode
+/// - position fix status(ucFixSts)
+/// - NAVIINFO_DIAG_GPS_FIX_STS_NON:not fixed
+/// - NAVIINFO_DIAG_GPS_FIX_STS_2D :2D fix
+/// - NAVIINFO_DIAG_GPS_FIX_STS_3D :3D fix
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX_CNT structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint32_t ulCnt3d; /* position fix ratio:3D(unit:sec) */
+/// uint32_t ulCnt2d; /* position fix ratio:2D(unit:sec) */
+/// uint32_t ulCntElse; /* position fix ratio:not fix(unit:sec) */
+/// } NAVIINFO_DIAG_GPS_FIX_CNT;
+/// @endcode
+///
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX_XYZ structure
+/// \~english @code
+/// typedef struct
+/// {
+/// int32_t lLat; /* GPS latitude(unit:1/256sec) (+: north latitude,-: south latitude) */
+/// int32_t lLon; /* GPS longitude(unit:1/256sec) (+: east longitude, -: west longitude) */
+/// } NAVIINFO_DIAG_GPS_FIX_XYZ;
+/// @endcode
+///
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_SAT structure
+/// \~english @code
+/// typedef struct
+/// {
+/// NAVIINFO_DIAG_GPS_PRN stPrn[12]; /* all satellite information */
+/// } NAVIINFO_DIAG_GPS_SAT;
+/// @endcode
+///
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_PRN structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint8_t ucRcvSts; /* reception status */
+/// uint8_t ucPrn; /* satellite No. */
+/// uint8_t ucelv; /* satellite angle(unit:1.0deg) */
+/// uint8_t ucLv; /* satellite level */
+/// uint16_t usAzm; /* satellite azimuth(unit:1.0deg) (clockwise from north) */
+/// uint8_t ucReserve[2]; /* reserve */
+/// } NAVIINFO_DIAG_GPS_PRN;
+/// @endcode
+/// - reception status(ucRcvSts)
+/// - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE :not used
+/// - NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING :searching
+/// - NAVIINFO_DIAG_GPS_RCV_STS_TRACHING :tracking
+/// - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX :not used for position fix
+/// - NAVIINFO_DIAG_GPS_RCV_STS_USEFIX :used for position fix
+/// \~english @par
+/// - NAVIINFO_NAVI_GPS structure
+/// \~english @code
+/// typedef struct
+/// {
+/// int32_t altitude; /* altitude(unit:1m) */
+/// uint16_t speed; /* speed(unit:1.00km/h) */
+/// uint16_t heading; /* heading(unit:0.1deg) (clockwise from north) */
+/// NAVIINFO_UTCTIME utc; /* UTC time */
+/// uint8_t tdsts; /* date and time status */
+/// uint8_t reserve[3]; /* reserve */
+/// } NAVIINFO_NAVI_GPS;
+/// @endcode
+/// - altitude(altitude) \n
+/// As the altitude is used as unit [0.01m] in internal, \n
+/// the altitude data range is (-21,474,839~21,474,839).
+/// - UTC(utc)
+/// - The time set after rollover.
+/// - date and time status(tdsts)
+/// - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+/// - 1= time output from RTC Backup(have time adjustment result)
+/// - 2= time adjustment completed
+/// \~english @par
+/// - NAVIINFO_UTCTIME structure
+/// \~english @code
+/// typedef struct {
+/// uint16_t year; /* A.D. (1~) */
+/// uint8_t month; /* month(1~12) */
+/// uint8_t date; /* date(1~31) */
+/// uint8_t hour; /* hour(0~23) */
+/// uint8_t minute; /* minute(0~59) */
+/// uint8_t second; /* second(0~59) */
+/// uint8_t reserved; /* not used */
+/// } NAVIINFO_UTCTIME;
+/// @endcode
+///
+/// \~english @retval NAVIINFO_RET_NORMAL normal finish
+/// \~english @retval NAVIINFO_RET_ERROR_PARAM parameter error
+/// \~english @retval NAVIINFO_RET_ERROR_INNER internal error
+/// \~english @retval NAVIINFO_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval NAVIINFO_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter navilocinfo is NULL [NAVIINFO_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [NAVIINFO_RET_ERROR_PARAM]
+/// - GPS setting data size(p_data->usSize) is not same as the data that \n
+/// related to data ID [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The count of message in message queue is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The message queue name has not been registered in control table. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table. [NAVIINFO_RET_ERROR_INNER]
+/// - GPS setting message transfer failed between processes. [NAVIINFO_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to set GPS information to vehicle sensor.\n
+/// - This API will finish when get the return value.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - This API is only called by Navigation proxy.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget and Method and Fire and Forget and Fire and Forget
+///
+/// \~english @see
+/// - POS_GetGPSInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+NAVIINFO_RET_API POS_SetGPSInfo(HANDLE hApp, NAVIINFO_ALL *navilocinfo);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get GPS data
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] navidiaginfo
+/// - NAVIINFO_DIAG_GPS* - pointer to get GPS data
+///
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS structure
+/// \~english @code
+/// typedef struct
+/// {
+/// NAVIINFO_DIAG_GPS_FIX stFix; /* position fix information */
+/// NAVIINFO_DIAG_GPS_SAT stSat; /* all satellite information */
+/// } NAVIINFO_DIAG_GPS;
+/// @endcode
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint8_t ucFixSts; /* position fix status */
+/// uint8_t ucReserve[3]; /* reserve */
+/// NAVIINFO_DIAG_GPS_FIX_CNT stCnt; /* position fix count data */
+/// NAVIINFO_DIAG_GPS_FIX_XYZ stWgs84; /* lonlat data(WGS84 geodetic) */
+/// } NAVIINFO_DIAG_GPS_FIX;
+/// @endcode
+/// - position fix status(ucFixSts)
+/// - NAVIINFO_DIAG_GPS_FIX_STS_NON:not fixed
+/// - NAVIINFO_DIAG_GPS_FIX_STS_2D :2D fix
+/// - NAVIINFO_DIAG_GPS_FIX_STS_3D :3D fix
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX_CNT structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint32_t ulCnt3d; /* position fix count:3D(unit:sec) */
+/// uint32_t ulCnt2d; /* position fix count:2D(unit:sec) */
+/// uint32_t ulCntElse; /* position fix count:not fix(unit:sec) */
+/// } NAVIINFO_DIAG_GPS_FIX_CNT;
+/// @endcode
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_FIX_XYZ structure
+/// \~english @code
+/// typedef struct
+/// {
+/// int32_t lLat; /* GPS latitude(unit:1/256sec) (+: north latitude, -: south latitude) */
+/// int32_t lLon; /* GPS longitude(unit:1/256sec) (+: east longitude, -: west longitude) */
+/// } NAVIINFO_DIAG_GPS_FIX_XYZ;
+/// @endcode
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_SAT structure
+/// \~english @code
+/// typedef struct
+/// {
+/// NAVIINFO_DIAG_GPS_PRN stPrn[12]; /* all satellite information */
+/// } NAVIINFO_DIAG_GPS_SAT;
+/// @endcode
+/// \~english @par
+/// - NAVIINFO_DIAG_GPS_PRN structure
+/// \~english @code
+/// typedef struct
+/// {
+/// uint8_t ucRcvSts; /* reception status */
+/// uint8_t ucPrn; /* satellite No. */
+/// uint8_t ucelv; /* satellite angle(unit:1.0deg) */
+/// uint8_t ucLv; /* satellite level */
+/// uint16_t usAzm; /* satellite azimuth(unit:1.0deg) (clockwise from north) */
+/// uint8_t ucReserve[2]; /* reserve */
+/// } NAVIINFO_DIAG_GPS_PRN;
+/// @endcode
+/// - reception status(ucRcvSts)
+/// - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE : not used
+/// - NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING : searching
+/// - NAVIINFO_DIAG_GPS_RCV_STS_TRACHING : tracking
+/// - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX : not used for position fix
+/// - NAVIINFO_DIAG_GPS_RCV_STS_USEFIX : used for position fix
+///
+/// \~english @retval NAVIINFO_RET_NORMAL normal finish
+/// \~english @retval NAVIINFO_RET_ERROR_PARAM parameter error
+/// \~english @retval NAVIINFO_RET_ERROR_INNER internal error
+/// \~english @retval NAVIINFO_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval NAVIINFO_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter navidiaginfo is NULL [NAVIINFO_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [NAVIINFO_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [NAVIINFO_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [NAVIINFO_RET_ERROR_INNER]
+/// - Memory allocate falied during the event table creation for event \n
+/// registering. [NAVIINFO_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [NAVIINFO_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [NAVIINFO_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already \n
+/// been registered. [NAVIINFO_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [NAVIINFO_RET_ERROR_INNER]
+/// - The event table is full during event creation. [NAVIINFO_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [NAVIINFO_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [NAVIINFO_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but \n
+/// failed. [NAVIINFO_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been \n
+/// registered. [NAVIINFO_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [NAVIINFO_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [NAVIINFO_RET_ERROR_INNER]
+/// - Initialize event object failed. [NAVIINFO_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [NAVIINFO_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when semaphore lock. [NAVIINFO_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when mutex lock. [NAVIINFO_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when mutex lock. [NAVIINFO_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when mutex lock. [NAVIINFO_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [NAVIINFO_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [NAVIINFO_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [NAVIINFO_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [NAVIINFO_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [NAVIINFO_RET_ERROR_INNER]
+/// - Can not open share memory. [NAVIINFO_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [NAVIINFO_RET_ERROR_INNER]
+/// - No empty field in share memory. [NAVIINFO_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [NAVIINFO_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message \n
+/// transfer between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [NAVIINFO_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [NAVIINFO_RET_ERROR_INNER]
+/// - The count of thread arrived max in event management table during event waiting. [NAVIINFO_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [NAVIINFO_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [NAVIINFO_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [NAVIINFO_RET_ERROR_INNER]
+/// - The interruption happened during event getting [NAVIINFO_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [NAVIINFO_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing \n
+/// received data. [NAVIINFO_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [NAVIINFO_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [NAVIINFO_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [NAVIINFO_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [NAVIINFO_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [NAVIINFO_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of \n
+/// received data. [NAVIINFO_RET_ERROR_INNER]
+/// - The result of sensor data get processing is POS_RET_ERROR_RESOURCE. [NAVIINFO_RET_ERROR_RESOURCE]
+/// - The result of sensor data get processing is not POS_RET_ERROR_RESOURCE. [NAVIINFO_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get GPS data for diag. \n
+/// This API will finish when get the return value.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_SetGPSInfo
+////////////////////////////////////////////////////////////////////////////////////////////
+NAVIINFO_RET_API POS_GetGPSInfo(HANDLE hApp, NAVIINFO_DIAG_GPS *navidiaginfo);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - GPS reset request
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] ResName
+/// - PCSTR - response thread name
+/// \~english @param [in] mode
+/// - uint8_t - reset mode
+///
+/// \~english @par
+/// - reset mode(mode) \n
+/// If the mode is not one of the following, return POS_RET_ERROR_PARAM
+/// - GPS_RST_COLDSTART - GPS reset request(cold start) \n
+/// Automatic search, track satellite and position fix after RAM initialized(all config \n
+/// items be initialized to default value).\n
+/// Initialize data objects:almanac/ ephemeris data, current position, GPS receiver mode and etc.\n
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUSY GPS device is still in setting
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter ResName is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter mode is not GPS_RST_COLDSTART [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied when the event table creation that for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table when the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full when event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed when event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when GPS reset \n
+/// message transfer between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when GPS reset message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when GPS reset message \n
+/// transfered between processes. [POS_RET_ERROR_INNER]
+/// - GPS reset message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event waiting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event waiting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event waiting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event waiting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event waiting. [POS_RET_ERROR_INNER]
+/// - The result of sensor data get processing is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of sensor data get processing is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to reset GPS device.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - This API is only called by Navigation proxy.
+///
+/// \~english @par
+/// Notification of message
+/// - The result of communication with GPS device will be sent by system API message with following format. \n
+/// Command ID : CID_POSIF_REQ_GPS_RESET \n
+/// message structure
+/// \~english @code
+/// typedef struct
+/// {
+/// TG_GPS_RET_RESET data; /* GPS reset status data */
+/// } TG_GPS_RET_RESET_MSG;
+/// @endcode
+/// - message data body structure
+/// \~english @code
+/// typedef struct {
+/// unsigned long ret_rst_status; /* response GPS reset status */
+/// } TG_GPS_RET_RESET;
+/// @endcode
+/// - response GPS reset status(ret_rst_status)
+/// - GPS_SENDOK:acknowledge
+/// - GPS_SENDNG:connection error
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+/// \~english @see
+/// - None
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_ReqGPSReset(HANDLE hApp, PCSTR ResName, uint8_t mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register GPS time setting request delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_BUFFULL the register count is full
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of \n
+/// the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed in process. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread arrived max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The result from positioning service is SENSOR_RET_ERROR_PARAM. [POS_RET_ERROR_PARAM]
+/// - The result from positioning service is SENSOR_RET_ERROR_BUFFULL. [POS_RET_ERROR_BUFFULL]
+/// - The result from positioning service is SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result from positioning service is not SENSOR_RET_ERROR_PARAM or \n
+/// SENSOR_RET_ERROR_BUFFULL or SENSOR_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register GPS time setting request delivery. \n
+/// This API will finish when get the return value.
+///
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name has been changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor information will be sent by system \n
+/// API message with following format. \n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ \n
+/// time info structure \n
+/// The year, month, date, hour, minute and second should be the format set to GPS
+/// \~english @code
+/// typedef struct {
+/// uint16_t year; /* A.D.(1~) */
+/// uint8_t month; /* month(1~12) */
+/// uint8_t date; /* date(1~31) */
+/// uint8_t hour; /* hour(0~23) */
+/// uint8_t minute; /* minute(0~59) */
+/// uint8_t second; /* second(0~59) */
+/// uint8_t reserved; /* not used */
+/// } POS_DATETIME;
+/// @endcode
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - None
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_RegisterListenerGPSTimeSetReq(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Temporarily set GPS time from Diag function
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] pstDateTime
+/// - POS_DATETIME * - pointer of GPS time
+///
+/// \~english @par
+/// - POS_DATETIME structure
+/// \~english @code
+/// typedef struct {
+/// uint16_t year; /* A.D.(1~) */
+/// uint8_t month; /* month(1~12) */
+/// uint8_t date; /* date(1~31) */
+/// uint8_t hour; /* hour(0~23) */
+/// uint8_t minute; /* minute(0~59) */
+/// uint8_t second; /* second(0~59) */
+/// uint8_t reserved; /* not used */
+/// } POS_DATETIME;
+/// @endcode
+///
+/// \~english @retval NAVIINFO_RET_NORMAL normal finish
+/// \~english @retval NAVIINFO_RET_ERROR_PARAM parameter error
+/// \~english @retval NAVIINFO_RET_ERROR_INNER internal error
+/// \~english @retval NAVIINFO_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval NAVIINFO_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter pstDateTime is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - GPS time Data size is larger than 144 [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The message queue name has not been registered in control table. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table. [POS_RET_ERROR_INNER]
+/// - GPS time setting message transfer failed. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to set GPS time data to vehicle sensor. \n
+/// This API will finish when get the return value.
+///
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - This API will not notify the result of setting time to GPS device. \n
+/// Return normal only there is no error such as parameter error.
+/// - If want to get the result of setting time to GPS device, use \n
+/// POS_RegisterListnerGpsTime to get GPS time and judge it.
+/// - This API is only called by Diag service.
+/// - While GPS data is receiving from GPS device, the GPS time set by this API is ignored \n
+/// and it is set actual GPS time notified by positioning_hal.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+/// \~english @see
+/// - POS_GetGPStime
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_SetGPStime(HANDLE hApp, POS_DATETIME* pstDateTime);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register GPS time delivery
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+///
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified data delivery
+/// - Please note that if the same data delivery has been registered for multiple \n
+/// times, the data will also be deliveried for registered multiple times.
+/// - The specified GPS time information will be deliveried at registered time (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change Specified data will be deliveried only when it changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update Specified data will be deliveried as \n
+/// long as it updated by vehicle sensor.
+///
+/// \~english @retval SENSOR_RET_NORMAL normal finish
+/// \~english @retval SENSOR_RET_ERROR_CREATE_EVENT event creation error
+/// \~english @retval SENSOR_RET_ERROR_PARAM parameter error
+/// \~english @retval SENSOR_RET_ERROR_INNER internal error
+/// \~english @retval SENSOR_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval SENSOR_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of \n
+/// the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) \n
+/// nor change(SENSOR_DELIVERY_TIMING_CHANGE) [SENSOR_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to \n
+/// max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event is created in system, but the count of reference is reach to max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Memory allocate falied during the event table creation for event \n
+/// registering. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The thread can not register in the event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Memory allocate failed in event table during the thread table creation. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - After register the thread table in event table, the event flag has already been \n
+/// registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - After register the thread table in event table, the event flag register \n
+/// failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event table is full during event creation. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The memory for event HANDLE allocate failed during event table creation. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The thread can not be registered in event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - In event table, try to allocate the memory of the thread table creation, but \n
+/// failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - After register the thread in event table, the event flag has already been \n
+/// registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - After register the thread in event table, the event flag register failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Specified event ID has not been registered in table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Initialize event object failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [SENSOR_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message \n
+/// transfer between processes. [SENSOR_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [SENSOR_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [SENSOR_RET_ERROR_INNER]
+/// - The count of thread arrived max in event management table during event waiting. [SENSOR_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event get. [SENSOR_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event get. [SENSOR_RET_ERROR_INNER]
+/// - The flagID has not been registered during event get. [SENSOR_RET_ERROR_INNER]
+/// - The interruption happened during event get [SENSOR_RET_ERROR_INNER]
+/// - Whatever error happened during event get. [SENSOR_RET_ERROR_INNER]
+/// - Get event timeout. [SENSOR_RET_ERROR_INNER]
+/// - Error happened during event get. [SENSOR_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to register GPS time delivery. \n
+/// This API will finish when get the return value.
+///
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name has changed, please call this API again.
+///
+/// \~english @par
+/// Notification of message
+/// - After registered successfully, vehicle sensor will send GPS time data \n
+/// as system API message with following format.
+/// - If the register successed, certainly delivery first data. And then \n
+/// delivery data according to the delivery timing.
+/// - Command ID : CID_VEHICLESENS_VEHICLE_INFO_GPS_TIME\n
+/// - SENSOR_MSG_GPSTIME structure
+/// \~english @code
+/// typedef struct {
+/// NAVIINFO_UTCTIME utc; /* UTC time */
+/// uint8_t tdsts; /* time status */
+/// uint8_t reserve[3]; /* reserve */
+/// } SENSOR_MSG_GPSTIME;
+/// @endcode
+/// - time status(tdsts)
+/// - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+/// - 1= time output from RTC Backup(have time adjustment result)
+/// - 2= time adjustment completed
+///
+/// \~english @par
+/// - NAVIINFO_UTCTIME structure
+/// \~english @code
+/// typedef struct {
+/// uint16_t year; /* A.D.(1~) */
+/// uint8_t month; /* month(1~12) */
+/// uint8_t date; /* date(1~31) */
+/// uint8_t hour; /* hour(0~23) */
+/// uint8_t minute; /* minute(0~59) */
+/// uint8_t second; /* second(0~59) */
+/// uint8_t reserved; /* not used */
+/// } POS_DATETIME;
+/// @endcode
+///
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - None
+////////////////////////////////////////////////////////////////////////////////////////////
+SENSOR_RET_API POS_RegisterListenerGPStime(HANDLE hApp, PCSTR notifyName, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get GPS time
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [out] dat
+/// - SENSOR_GPSTIME* - output buffer pointer to store GPS time
+///
+/// \~english @par
+/// - SENSOR_GPSTIME structure
+/// \~english @code
+/// typedef struct {
+/// NAVIINFO_UTCTIME utc; /* UTC time */
+/// uint8_t tdsts; /* date amd time status */
+/// uint8_t reserve[3]; /* reserve */
+/// } SENSOR_GPSTIME;
+/// @endcode
+/// - date amd time status(tdsts)
+/// - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
+/// - 1= time output from RTC Backup(have time adjustment result)
+/// - 2= time adjustment completed
+///
+/// \~english @par
+/// - NAVIINFO_UTCTIME structure
+/// \~english @code
+/// typedef struct {
+/// uint16_t year; /* A.D.(1~) */
+/// uint8_t month; /* month(1~12) */
+/// uint8_t date; /* date(1~31) */
+/// uint8_t hour; /* hour(0~23) */
+/// uint8_t minute; /* minute(0~59) */
+/// uint8_t second; /* second(0~59) */
+/// uint8_t reserved; /* not used */
+/// } NAVIINFO_UTCTIME;
+/// @endcode
+///
+/// \~english @retval POS_RET_NORMAL normal finish
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of positioning service is TRUE.
+///
+/// \~english @par changes of internal status
+/// - There is no changes of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter dat is NULL [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_INNER]
+/// - Memory allocate falied during the event table creation for event registering. [POS_RET_ERROR_INNER]
+/// - The thread can not register in the event table. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag has already \n
+/// been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread table in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - The event table is full during event creation. [POS_RET_ERROR_INNER]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_INNER]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_INNER]
+/// - In event table, try to allocate the memory of the thread table creation, but failed. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag has already been registered. [POS_RET_ERROR_INNER]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_INNER]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_INNER]
+/// - Initialize event object failed. [POS_RET_ERROR_INNER]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_INNER]
+/// - Specified semaphore ID has not been registered when semaphore lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE is NULL when mutex lock. [POS_RET_ERROR_INNER]
+/// - Internal mutex HANDLE has not been registered in mutex table when mutex lock. [POS_RET_ERROR_INNER]
+/// - The owner of specified mutex is not itself when mutex lock. [POS_RET_ERROR_INNER]
+/// - Mutex has been multiple locked [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_INNER]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_INNER]
+/// - Can not open share memory. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory. [POS_RET_ERROR_INNER]
+/// - No empty field in share memory. [POS_RET_ERROR_INNER]
+/// - Failed to guarantee share memory. [POS_RET_ERROR_INNER]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message \n
+/// transfer between processes. [POS_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [POS_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [POS_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread arrived max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event getting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event getting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event getting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event getting. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing \n
+/// received data. [POS_RET_ERROR_INNER]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Memory for share memory management allocate failed for accessing received data. [POS_RET_ERROR_INNER]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_INNER]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_INNER]
+/// - The result of sensor data getting process is POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_RESOURCE]
+/// - The result of sensor data getting process is not POS_RET_ERROR_RESOURCE. [POS_RET_ERROR_INNER]
+///
+/// \~english @par Detail
+/// - Call this API to get GPS time from vehicle sensor.
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+///
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_SetGPStime
+////////////////////////////////////////////////////////////////////////////////////////////
+POS_RET_API POS_GetGPStime(HANDLE hApp, SENSOR_GPSTIME* dat);
+
+#ifdef __cplusplus
+}
+#endif
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_GPS_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_sensor_API.h b/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_sensor_API.h
new file mode 100755
index 0000000..a7a35c4
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/POS_sensor_API.h
@@ -0,0 +1,716 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_SENSOR_API_H_
+#define POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_SENSOR_API_H_
+/**
+ * @file POS_sensor_API.h
+ * @brief API definition file for Sensor function
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/POS_define.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* POSITIONING_DID */
+#define POS_DID_SPEED_PULSE 0x80000012 //!< \~english Data ID of speed pulse
+#define POS_DID_SPEED_KMPH 0x80000013 //!< \~english Data ID of KMPH speed
+#define POS_DID_SNS_COUNTER 0x8000001A
+//!< \~english Data ID of sensor counter
+#define POS_DID_GYRO_X 0x80000014 //!< \~english Data ID of X axis gyro
+#define POS_DID_GYRO_Y 0x80000085 //!< \~english Data ID of Y axis gyro
+#define POS_DID_GYRO_Z 0x80000086 //!< \~english Data ID of Z axis gyro
+#define POS_DID_GYRO POS_DID_GYRO_X
+//!< \~english Data ID of POS_DID_GYRO is same as POS_DID_GYRO_X
+#define POS_DID_GSNS_X 0x80000015 //!< \~english Data ID of x axis gsensor
+#define POS_DID_GSNS_Y 0x80000016 //!< \~english Data ID of Y axis gsensor
+#define POS_DID_GSNS_Z 0x80000026 //!< \~english Data ID of Z axis gsensor
+#define POS_DID_REV 0x80000017 //!< \~english Data ID of reverse signal
+#define POS_DID_GPS_ANTENNA 0x80000019
+//!< \~english Data ID of GPS antenna status
+#define POS_DID_SPEED_PULSE_FST 0x80000028
+//!< \~english Data ID of first time speed pulse
+#define POS_DID_GYRO_X_FST 0x80000029 //!< \~english Data ID of first time X axis gyro
+#define POS_DID_GYRO_Y_FST 0x80000043 //!< \~english Data ID of first time Y axis gyro
+#define POS_DID_GYRO_Z_FST 0x80000023 //!< \~english Data ID of first time Z axis gyro
+#define POS_DID_GYRO_FST POS_DID_GYRO_X_FST
+//!< \~~english Data ID of POS_DID_GYRO_FST is same as POS_DID_GYRO_X_FST
+#define POS_DID_REV_FST 0x8000007E
+//!< \~english Data ID of first time reverse signal
+#define POS_DID_GYRO_TEMP 0x80000090 //!< \~english Data ID of gyro temperature
+#define POS_DID_GYRO_TEMP_FST 0x80000091
+//!< \~english Data ID of first time gyro temperature
+#define POS_DID_GSNS_X_FST 0x80000087
+//!< \~english Data ID of first time x axis gsensor
+#define POS_DID_GSNS_Y_FST 0x80000088
+//!< \~english Data ID of first time Y axis gsensor
+#define POS_DID_GSNS_Z_FST 0x80000089
+//!< \~english Data ID of first time Z axis gsensor
+#define POS_DID_PULSE_TIME 0x8000003A //!< \~english Data ID of pulse time
+
+#define POS_DID_GPS__CWORD82__NMEA 0x80000030U
+//!< \~english Data ID of _CWORD82_ GPS NMEA sentence
+#define POS_DID_GPS__CWORD82___CWORD44_GP4 0x80000031U
+//!< \~english Data ID of _CWORD82_ GPS _CWORD44_GP4 data
+#define POS_DID_GPS__CWORD82__FULLBINARY 0x80000032U
+//!< \~english Data ID of _CWORD82_ GPS full binary data
+#define POS_DID_GPS_NMEA 0x8000009AU
+//!< \~english Data ID of GPS NMEA sentence
+#define POS_DID_GPS_CLOCK_DRIFT 0x800000B3U
+//!< \~english Data ID of GPS time drift data
+#define POS_DID_GPS_CLOCK_FREQ 0x800000B4U
+//!< \~english Data ID of GPS time frequency data
+
+/**
+ * \~english @brief Delivery sensor extra package command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_PKG_SENSOR_DATA, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_PKG_SENSOR_DATA 0x0700
+
+/**
+ * \~english @brief Delivery sensor information command ID
+ * \~english @brief If you want to catch above envents, use NSFW like below.
+ * \~english @code
+ * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_SENSOR_DATA, CBCallbackA);
+ * @endcode
+ */
+#define CID_POSIF_REGISTER_LISTENER_SENSOR_DATA 0x0200
+
+#define SENSOR_MSGBUF_DSIZE 4096
+//!< \~english message body maximum size
+
+#define SENSOR_VSHEAD_DSIZE 36
+//!< \~english vehicle sensor header size(1+3+16*2)
+
+#define SENSOR_VSINFO_DSIZE (SENSOR_MSGBUF_DSIZE - SENSOR_VSHEAD_DSIZE)
+//!< \~english vehicle sensor data size
+
+// Same name/value is defined, but client doesn't include HAL header.
+// It defines SENSOR_MSG_VSINFO_DSIZE if not included HAL.
+#ifndef HAL_API_POSITIONING_HAL_H_
+#define SENSOR_MSG_VSINFO_DSIZE 1904u
+//!< \~english vehicle sensor message body maximum size
+#endif
+
+#define SENSOR_PKG_DELIVERY_MAX 16
+//!< \~english number of data ID per a package
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @struct SENSOR_PKG_MSG_VSINFO
+ * \~english positioning sensor notification message (to User)
+ */
+typedef struct {
+ uint8_t ucDNum; //!< \~english number of data
+ uint8_t ucDataBreak; //!< \~english data lack infomation
+ uint8_t ucDivideCnt; //!< \~english total partition
+ uint8_t ucDivideSendCnt; //!< \~english partition transmit count
+ uint16_t usOffset[SENSOR_PKG_DELIVERY_MAX]; //!< \~english offset
+ uint8_t ucData[SENSOR_VSINFO_DSIZE]; //!< \~english data body
+} SENSOR_PKG_MSG_VSINFO;
+
+/**
+ * @struct SENSOR_MSG_VSINFO
+ * \~english message delivery positioning sensor information
+ */
+typedef struct {
+ DID did; //!< \~english data ID
+ uint16_t size; //!< \~english data size
+ uint8_t rcvFlag; //!< \~english reception flag
+ uint8_t reserve; //!< \~english reserve
+ uint8_t data[SENSOR_MSG_VSINFO_DSIZE]; //!< \~english data body
+} SENSOR_MSG_VSINFO;
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+/* SENSOR_API public API */
+#ifdef __cplusplus
+extern "C" {
+#endif
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Send the extra package when first delivery.
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ucPkgNum
+/// - uint8_t - data number in package(1 to 16)
+/// \~english @param [in] pulDid
+/// - DID * - buffer pointer of the data ID array in package
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+///
+/// \~english @par
+/// - data number in package(ucPkgNum) \n
+/// The following 8 data ID can be registered. And the register data number range is 1~16.
+/// - buffer pointer of the data ID array in package(pulDid) \n
+/// The data ID set to the first in pulDid is the delivery key. \n
+/// If the data ID not one of the following be set, return SENSOR_RET_ERROR_PARAM.
+/// - POS_DID_SNS_COUNTER - sensor counter
+/// - POS_DID_GYRO_X - gyro output (X axis)
+/// - POS_DID_GYRO_Y - gyro output (Y axis)
+/// - POS_DID_GYRO_Z - gyro output (Z axis)
+/// - POS_DID_SPEED_PULSE - speed pulse
+/// - POS_DID_REV - REV signal(0:forward 1:backward)
+/// - POS_DID_GSNS_X - Gsensor output X axis
+/// - POS_DID_GSNS_Y - Gsensor output Y axis
+/// - POS_DID_GSNS_Z - Gsensor output Z axis
+/// - POS_DID_GYRO_TEMP - gyro temperature
+/// - POS_DID_PULSE_TIME - pulse time\n
+/// \~english @par
+/// - Because positioning is G/W between Navi and HAL, value depends on the design of HAL.
+/// \~english @par
+/// - Note:The Gsensor output is 0 in the environment without Gsensor hardware.\n
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified LonLat delivery
+/// - Please note that if the same data delivery has been registered for multiple times, \n
+/// the data will also be deliveried for registered multiple times.
+/// - The specified LonLat will be deliveried at register time no matter what delivery \n
+/// timing has been registered (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change Specified LonLat be deliveried only when it is changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update Specified Lonlat be deliveried as long as \n
+/// it is updated by vehicle sensor.
+///
+///
+/// \~english @retval SENSOR_RET_NORMAL normal end
+/// \~english @retval SENSOR_RET_ERROR_CREATE_EVENT event create failed
+/// \~english @retval SENSOR_RET_ERROR_PARAM parameter error
+/// \~english @retval SENSOR_RET_ERROR_INNER internal error
+/// \~english @retval SENSOR_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval SENSOR_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization \n
+/// (FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the Dispatcher for App are completed.
+/// - Availability of service positioning is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucDeliveryTiming is neither update(SENSOR_DELIVERY_TIMING_UPDATE) \n
+/// nor change(SENSOR_DELIVERY_TIMING_CHANGE) [SENSOR_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucPkgNum is 0 or it is larger than 16 [SENSOR_RET_ERROR_PARAM]
+/// - The parameter pulDid is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The data ID in paramter buffer pulDid is not avaliable value [SENSOR_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The event has been registered in event table and created in same process, \n
+/// but the count of reference is reach to max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table and created in system, but the \n
+/// count of reference is reach to max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but memory for the thread event table \n
+/// creation allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but the thread can not be registered in \n
+/// event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but memory for thread table creation \n
+/// allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, and the event flag has already been \n
+/// registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, and the event flag register failed. \n
+/// [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - No empty field for registering the event HANDLE into event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Memory for event HANDLE get failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table and not finished registering \n
+/// [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and memory for thread table \n
+/// creation allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and the event flag has already been \n
+/// registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and the event flag register failed. \n
+/// [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - ProcessNo has not been registered in message control table when message transfered \n
+/// between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered in process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed in process. [SENSOR_RET_ERROR_INNER]
+/// - The destination process name is NULL. [SENSOR_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message transfer \n
+/// between processes. [SENSOR_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed between processes. [SENSOR_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during event \n
+/// waiting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The count of thread is reach to max in event management table during event \n
+/// waiting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The EV_FLAG_BIT is not set in flagID during event getting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The ID of message event queue has not been created during event getting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The flagID has not been registered during event getting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The interruption happened during event getting [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Whatever error happened during event getting. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Got event is SENSOR_RET_ERROR_INNER. [SENSOR_RET_ERROR_INNER]
+///
+/// \~english @par Detial
+/// - Call this API to register vehicle sensor data delivery. \n
+/// This API return the result of registering. \n
+/// The data from sensor data received to registering will be deliveried. \n
+/// The first delivery data is the sensor data(max 64 number of sensor counter, \n
+/// reverse signal,gyro temperature, max 640 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis), \n
+/// speed pulse,Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis), max 2048 number of pulse time) in 6.4 second. \n
+/// If the data number is more than max number, delivery the data in newest 6.4 second. \n
+/// If the sensor data accumulated more than max number, set VEHICLE_SNS_BREAK to data missing information. \n
+/// If sensor data number is more than the data number send in one time(10 number of \n
+/// sensor counter,reverse signal,gyro temperature, 100 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis), \n
+/// speed pulse, Gsensor output(X axis),Gsensor output(Y axis), Gsensor output(Z axis), 320 number of pulse time), \n
+/// the old data is divided into partitions(every partition with 10 number of sensor counter, \n
+/// reverse signal,gyro temperature, 100 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis), \n
+/// speed pulse,Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis), 320 number of pulse time) to delivery. \n
+/// The last message for first delivery is the message that the partition count equal to partition No. \n
+/// After first delivery, the message data(1 number of sensor counter,reverse signal, \n
+/// gyro temperature, 10 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis),speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis), 32 number of pulse time) deliveried. \n
+/// And because the data missing information, divided partition count, \n
+/// diveided partition No is not used, they will be set to 0 in message.\n
+/// (sample)The sensor data in 6.4 second divided to delivery
+/// - 1st message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7, divided partition No=1)
+/// - 2nd message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7, divided partition No=2)
+/// - 3rd message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7,divided partition No=3)
+/// - 4th message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7,divided partition No=4)
+/// - 5th message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7,divided partition No=5)
+/// - 6th message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n
+/// partition count=7,divided partition No=6)
+/// - 7th message(sensor counter, reverse signal, gyro temperature=4 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n
+/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=40 number, pulse time=128 number), divided \n
+/// partition count=7,divided partition No=7)
+///
+/// \~english @par
+/// - Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After delivery the sensor data accumulated in 6.4 second(first delivery), the sensor data \n
+/// will not be accumulated any more. So the same data will be deliveried as first \n
+/// delivery when registered again.
+/// - This API is only called by Navi proxy.
+/// - After call this API, if the delivery destination thread name is changed, please call this API again.
+///
+/// \~english @par
+/// message structure
+/// - After success to register, vehicle sensor will send message as system API message with following format.
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_PKG_SENSOR_DATA \n
+/// Definition of structure
+/// \~english @code
+/// #define SENSOR_MSGBUF_DSIZE 4096 /* max size of message body */
+/// #define SENSOR_VSHEAD_DSIZE 36 /* vehicle sensor header size(1+3+16*2) */
+/// #define SENSOR_PKG_DELIVERY_MAX 16 /* max number of Data ID in package */
+/// #define SENSOR_VSINFO_DSIZE (SENSOR_MSGBUF_DSIZE - SENSOR_VSHEAD_DSIZE)
+/// typedef struct {
+/// uint8_t ucDNum; /* number of data */
+/// uint8_t ucDataBreak; /* data missing information */
+/// uint8_t ucDivideCnt; /* divided partition count */
+/// uint8_t ucDivideSendCnt; /* divided partition No. */
+/// uint16_t usOffset[SENSOR_PKG_DELIVERY_MAX]; /* offset */
+/// uint8_t ucData[SENSOR_VSINFO_DSIZE]; /* vehicle sensor data */
+/// } SENSOR_PKG_MSG_VSINFO;
+/// @endcode
+/// - number of data \n
+/// Data number in package
+/// - data missing information \n
+/// VEHICLE_SNS_BREAK:not continuous data \n
+/// VEHICLE_SNS_NORMAL:continuous data
+/// - divided partition count \n
+/// All divided partition count \n
+/// If it is more than 1, data divided to delivery
+/// - divided partition No. \n
+/// The No. of the divided partition. If it equal to the divided partition count, \n
+/// that meanings this message is the last divided partition of the package.
+/// - offset \n
+/// The array of the offset from the head of vehicle sensor data
+/// - vehicle sensor data
+/// - Data ID(4Byte)
+/// - Data size(2Byte)
+/// - reception flag(1Byte)
+/// - If the data get from CAN, direct line, GPS, set to 0x01
+/// - If data has not been received, set to 0x00
+/// - reserve(1Byte)\n
+/// - Data body is cycle fit with the packaged data.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - POS_RegisterListenerSensData, POS_GetSensData
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+SENSOR_RET_API POS_RegisterListenerPkgSensData(HANDLE hApp, PCSTR notifyName, uint8_t ucPkgNum, DID *pulDid,
+ uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Register sensor data delivery.
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] notifyName
+/// - PCSTR - Destination thread name
+/// \~english @param [in] ulDid
+/// - DID - Data ID of vehicle info
+/// \~english @param [in] ucCtrlFlg
+/// - uint8_t - Delivery control flag(register)
+/// \~english @param [in] ucDeliveryTiming
+/// - uint8_t - Delivery timing(change/update)
+///
+/// \~english @par
+/// - Data ID of vehicle info(ulDid) \n
+///
+/// \~english @par
+/// - Note:The Gsensor output is 0 in the environment without Gsensor hardware.
+/// \~english @par
+/// - Delivery control flag(ucCtrlFlg)
+/// - SENSOR_DELIVERY_REGIST - register
+/// - Register specified LonLat delivery
+/// - Please note that if the same data delivery has been registered for multiple times, \n
+/// the data will also be deliveried for registered multiple times.
+/// - The specified LonLat will be deliveried at register time no matter what delivery \n
+/// timing has been registered (first delivery).
+/// - Delivery timing(ucDeliveryTiming)
+/// - SENSOR_DELIVERY_TIMING_CHANGE - change Specified LonLat be deliveried only when it is changed.
+/// - SENSOR_DELIVERY_TIMING_UPDATE - update Specified Lonlat be deliveried \n
+/// as long as it is updated by vehicle sensor.
+///
+/// \~english @retval SENSOR_RET_NORMAL normal end
+/// \~english @retval SENSOR_RET_ERROR_CREATE_EVENT event create failed
+/// \~english @retval SENSOR_RET_ERROR_PARAM parameter error
+/// \~english @retval SENSOR_RET_ERROR_INNER internal error
+/// \~english @retval SENSOR_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval SENSOR_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of service positioning is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter ucDeliveryTiming is neither update \n
+/// (SENSOR_DELIVERY_TIMING_UPDATE) nor change(SENSOR_DELIVERY_TIMING_CHANGE) [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ucCtrlFlg is not register(SENSOR_DELIVERY_REGIST) [SENSOR_RET_ERROR_PARAM]
+/// - The parameter hApp is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter notifyName is NULL [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ulDID is not avaliable value [SENSOR_RET_ERROR_PARAM]
+/// - The parameter ulDID is a value can not specified [SENSOR_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [SENSOR_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to \n
+/// max [SENSOR_RET_ERROR_RESOURCE]
+/// - The event has been registered in event table and created in same process, \n
+/// but the count of reference is reach to max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table and created in system, but the count \n
+/// of reference is reach to max [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but memory for the thread event table \n
+/// creation allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but the thread can not be registered \n
+/// in event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, but memory for thread table creation \n
+/// allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, and the event flag has already been \n
+/// registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has been registered in event table, and the event flag register failed. \n
+/// [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - No empty field for registering the event HANDLE into event table. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Memory for event HANDLE get failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table and not finished registering \n
+/// [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and memory for thread table \n
+/// creation allocate falied. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and the event flag has already \n
+/// been registered. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The event has not been registered in event table, and the event flag register \n
+/// failed. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - ProcessNo has not been registered in message control table when message transfered \n
+/// in process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed when message transfered in process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed in process. [SENSOR_RET_ERROR_INNER]
+/// - The destination process name is NULL. [SENSOR_RET_ERROR_INNER]
+/// - The destination process name size is larger than 20 characters when message \n
+/// transfer between process. [SENSOR_RET_ERROR_INNER]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE create failed when message transfered between process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between process. [SENSOR_RET_ERROR_INNER]
+/// - Message transfer failed between process. [SENSOR_RET_ERROR_INNER]
+/// - Specified event HANDLE has not been registered in event HANDLE table during waiting \n
+/// event. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The count of thread is reach to max in event management table during waiting \n
+/// event. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The EV_FLAG_BIT is not set in flagID during getting event. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The ID of message event queue has not been created during getting event. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The flagID has not been registered during getting event. [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - The interruption happened during getting event [SENSOR_RET_ERROR_CREATE_EVENT]
+/// - Whatever error happened during getting event. [SENSOR_RET_ERROR_CREATE_EVENT]
+///
+/// \~english @par Detial
+/// - Call this API to register vehicle sensor data delivery. \n
+/// This API return the result of registering.
+///
+/// \~english @par
+/// Please note the following points when use this API.
+/// - Duplication registering
+/// - The same destination thread name has already been registered
+/// - The registered delivery data updated and normal return.(first delivery)
+/// - To one delivery destination, the same data will not be duplication deliveried at same timing.
+/// - After call this API, if the delivery destination thread name is changed, please call this API again.
+///
+/// \~english @par
+/// message structure
+/// - After success to register, vehicle sensor will send message as system API message with following format.
+/// - If the register successed, certainly delivery first data. And then delivery data according to
+/// the delivery timing. \n
+/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_SENSOR_DATA \n
+///
+/// \~english @code
+/// #define SENSOR_MSG_VSINFO_DSIZE 1904 /* max size of message body */
+/// typedef struct
+/// {
+/// DID did; /* data ID */
+/// uint16_t size; /* data size of vehicle sensor data */
+/// uint8_t rcvFlag; /* reception flag */
+/// uint8_t reserve; /* reserve */
+/// uint8_t data[SENSOR_MSG_VSINFO_DSIZE]; /* vehicle sensor data */
+/// } SENSOR_MSG_VSINFO;
+/// @endcode
+/// - reception flag(1Byte)
+/// - If the data get from CAN or direct line, set to 0x01
+/// - If data has not been received, set to 0x00
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Method
+///
+/// \~english @see
+/// - POS_RegisterListenerPkgSensData, POS_GetSensData
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+SENSOR_RET_API POS_RegisterListenerSensData(HANDLE hApp, PCSTR notifyName, DID ulDid, uint8_t ucCtrlFlg,
+ uint8_t ucDeliveryTiming);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_Positioning
+/// \~english @par Brief
+/// - Get vehicle sensor data.
+///
+/// \~english @param [in] hApp
+/// - HANDLE - App Handle
+/// \~english @param [in] ulDid
+/// - DID - Data ID of vehicle info
+/// \~english @param [out] pDestData
+/// - void* - pointer of buffer for storing vehicle sensor data
+/// \~english @param [in] usDestSize
+/// - uint16_t - vehicle sensor data buffer size
+///
+/// \~english @par
+/// - Data ID of vehicle info(ulDid)
+/// - POS_DID_SPEED_PULSE - speed pulse(count of pulse)
+/// - POS_DID_GYRO_X - gyro output (X axis)
+/// - POS_DID_GYRO_Y - gyro output (Y axis)
+/// - POS_DID_GYRO_Z - gyro output (Z axis)
+/// - POS_DID_GSNS_X - Gsensor output (X axis)
+/// - POS_DID_GSNS_Y - Gsensor output (Y axis)
+/// - POS_DID_GSNS_Z - Gsensor output (Z axis)
+/// - POS_DID_GPS_ANTENNA - GPS antenna connection status
+/// - POS_DID_GPS__CWORD82__NMEA - GPS NMEA(_CWORD82_)
+/// - POS_DID_GPS__CWORD82__FULLBINARY - GPS _CWORD82_ full binary(_CWORD82_)
+/// - POS_DID_GPS_NMEA - GPS NMEA
+/// - POS_DID_GYRO_TEMP - gyro temperature
+/// - POS_DID_GPS_CLOCK_DRIFT - GPS clock drift
+/// - POS_DID_GPS_CLOCK_FREQ - GPS clock frequency
+/// - The avaliable data ID of each hardware type is as following.
+/// \~english @par
+/// - Because positioning is G/W between Navi and HAL, value depends on the design of HAL.
+/// \~english @par
+/// - Note:The Gsensor output is 0 in the environment without Gsensor hardware.
+/// - vehicle sensor data buffer size(usDestSize) \n
+/// Please note it is the size of output buffer, not the size of data.
+///
+/// \~english @retval more than 0 data size
+/// \~english @retval POS_RET_ERROR_CREATE_EVENT event create failed
+/// \~english @retval POS_RET_ERROR_OUTOF_MEMORY share memory guarantee failed
+/// \~english @retval POS_RET_ERROR_PARAM parameter error
+/// \~english @retval POS_RET_ERROR_SIZE buffer size error
+/// \~english @retval POS_RET_ERROR_INNER internal error
+/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported
+/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n
+/// of the Dispatcher for App are completed.
+/// - Availability of service positioning is TRUE.
+///
+/// \~english @par change of internal status
+/// - There is no change of internal status
+///
+/// \~english @par Failure condition
+/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter pDestData is NULL [POS_RET_ERROR_PARAM]
+/// - The parameter ulDid is not avaliable value in current hardware environment [POS_RET_ERROR_PARAM]
+/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE]
+/// - The event is created in same process, but the count of reference is reach to max \n
+/// [POS_RET_ERROR_CREATE_EVENT]
+/// - The event is created in system, but the count of reference is reach to max [POS_RET_ERROR_CREATE_EVENT]
+/// - Memory allocate falied during the event table creation for \n
+/// event registering. [POS_RET_ERROR_CREATE_EVENT]
+/// - The thread can not register in the event table. [POS_RET_ERROR_CREATE_EVENT]
+/// - Memory allocate failed in event table during the thread table creation. [POS_RET_ERROR_CREATE_EVENT]
+/// - After register the thread table in event table, the event flag has already \n
+/// been registered. [POS_RET_ERROR_CREATE_EVENT]
+/// - After register the thread table in event table, the event flag register \n
+/// failed. [POS_RET_ERROR_CREATE_EVENT]
+/// - The event table is full during event creation. [POS_RET_ERROR_CREATE_EVENT]
+/// - The memory for event HANDLE allocate failed during event table creation. [POS_RET_ERROR_CREATE_EVENT]
+/// - The thread can not be registered in event table. [POS_RET_ERROR_CREATE_EVENT]
+/// - In event table, to allocate the memory of the thread table creation, \n
+/// but failed. [POS_RET_ERROR_CREATE_EVENT]
+/// - After register the thread in event table, the event flag has already been \n
+/// registered. [POS_RET_ERROR_CREATE_EVENT]
+/// - After register the thread in event table, the event flag register failed. [POS_RET_ERROR_CREATE_EVENT]
+/// - Specified event ID has not been registered in table. [POS_RET_ERROR_CREATE_EVENT]
+/// - Initialize event object failed. [POS_RET_ERROR_CREATE_EVENT]
+/// - There is no empty field in semaphore table for semaphore creation [POS_RET_ERROR_OUTOF_MEMORY]
+/// - The memory for storing semaphore control data allocate failed. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Specified semaphore ID has not been registered when semaphore lock. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Internal mutex HANDLE is NULL when mutex lock. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Internal mutex HANDLE has not been registered in mutex table when mutex lock. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - The owner of specified mutex is not itself when mutex lock. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Mutex has been multiple locked [POS_RET_ERROR_OUTOF_MEMORY]
+/// - The HANDLE is NULL when getting usable share memory address. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Can not get usable share memory address. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Memory allocate failed for share memory map. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Memory allocate failed for share memory management. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Can not open share memory. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Failed to mapping share memory. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - No empty field in share memory. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - ProcessNo has not been registered in message control table when message \n
+/// transfered between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - Message transfer HANDLE get failed when message transfered between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - Message transfer failed between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - The destination process name size is larger than 20 characters when message \n
+/// transfer between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - The message queue name has not been registered in control table when message \n
+/// transfer between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - Message transfer HANDLE create failed when message transfered between processes. \n
+/// [POS_RET_ERROR_CREATE_EVENT]
+/// - Message transfer HANDLE get failed from internal table when message transfered \n
+/// between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - Message transfer failed between processes. [POS_RET_ERROR_CREATE_EVENT]
+/// - Specified event HANDLE has not been registered in event HANDLE table during \n
+/// event waiting. [POS_RET_ERROR_INNER]
+/// - The count of thread is reach to max in event management table during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during event waiting. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during event waiting. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during event waiting. [POS_RET_ERROR_INNER]
+/// - The interruption happened during event waiting [POS_RET_ERROR_INNER]
+/// - Whatever error happened during event waiting. [POS_RET_ERROR_INNER]
+/// - The EV_FLAG_BIT is not set in flagID during getting event. [POS_RET_ERROR_INNER]
+/// - The ID of message event queue has not been created during getting event. [POS_RET_ERROR_INNER]
+/// - The flagID has not been registered during getting event. [POS_RET_ERROR_INNER]
+/// - The interruption happened during getting event [POS_RET_ERROR_INNER]
+/// - Whatever error happened during getting event. [POS_RET_ERROR_INNER]
+/// - The HANDLE is NULL when getting usable share memory address for accessing \n
+/// received data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Can not get usable share memory address for accessing received data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Memory for share memory map allocate failed for accessing received data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Memory for share memory management allocate failed for accessing received \n
+/// data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Can not open share memory for accessing received data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Failed to mapping share memory for accessing received data. [POS_RET_ERROR_OUTOF_MEMORY]
+/// - Can not get share memory normally [POS_RET_ERROR_OUTOF_MEMORY]
+/// - The size of data stored in share memory is larger than the size of received data. [POS_RET_ERROR_SIZE]
+///
+/// \~english @par Detial
+/// - Call this API to get vehicle sensor data. \n
+/// This vehicle sensor data stored in the output buffer of the parameter, this API return.
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+/// \~english @see
+/// - POS_RegisterListenerPkgSensData, POS_RegisterListenerSensData
+///
+
+POS_RET_API POS_GetSensData(HANDLE hApp, DID ulDid, void *pDestData, uint16_t usDestSize);
+
+#ifdef __cplusplus
+}
+#endif
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_CLIENT_INCLUDE_VEHICLE_SERVICE_POS_SENSOR_API_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/positioning.h b/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/positioning.h
new file mode 100755
index 0000000..a5a1e56
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/include/vehicle_service/positioning.h
@@ -0,0 +1,46 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+
+#ifndef VEHICLESERVICE_POSITIONING_H_ // NOLINT(build/header_guard)
+#define VEHICLESERVICE_POSITIONING_H_ // NOLINT(build/header_guard)
+
+/**
+ * @file positioning.h
+ * @brief Common header of positioning
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/POS_gps_API.h>
+#include <vehicle_service/POS_common_API.h>
+
+/** @}*/ // end of positioning
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // VEHICLESERVICE_POSITIONING_H_
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_common_API/Common_API.cpp b/video_in_hal/vehicleservice/positioning/client/src/POS_common_API/Common_API.cpp
new file mode 100755
index 0000000..f266dec
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_common_API/Common_API.cpp
@@ -0,0 +1,889 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * Common_API.cpp
+ * @brief
+ * Module : POSITIONING
+ * Common I/F service functionality
+ */
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/POS_common_API.h>
+#include "POS_common_private.h"
+#include "Vehicle_API_private.h"
+#include "POS_private.h"
+
+/**
+ * @brief
+ * Latitude and longitude informationDelivery registration
+ *
+ * Registering Latitude and Longitude Information Delivery
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] notifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating)
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_BUFFULL Buffer-full<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg, // NOLINT(readability/nolint)
+ uint8_t ucDeliveryTiming, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ SENSOR_RET_API ret_sens = SENSOR_RET_NORMAL; /* API return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_LOCATION_LONLAT; /* Data ID */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ucCtrlFlg != SENSOR_DELIVERY_REGIST) {
+ /* Parameters other than delivery registration are terminated abnormally when delivery control is terminated. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* If the thread name is NULL, it terminates with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ if (ucGetMethod == SENSOR_GET_METHOD_GPS) {
+ did = VEHICLE_DID_LOCATION_LONLAT;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_LOCATION_LONLAT_NAVI;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Delivery registration */
+ if (ret == POS_RET_NORMAL) {
+ /* Delivery registry SensorAPI calls */
+ ret_sens = PosRegisterListenerProc(notifyName, /* Destination thread name */
+ did, /* Data ID */
+ ucCtrlFlg, /* Delivery control */
+ ucDeliveryTiming); /* Delivery timing */
+
+ /* Decision of delivery registration result */
+ if (ret_sens == SENSOR_RET_NORMAL) {
+ ret = POS_RET_NORMAL;
+ } else if (ret_sens == SENSOR_RET_ERROR_PARAM) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ret_sens == SENSOR_RET_ERROR_BUFFULL) {
+ ret = POS_RET_ERROR_BUFFULL;
+ } else if (ret_sens == SENSOR_RET_ERROR_RESOURCE) {
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Altitude information delivery registration
+ *
+ * Register for the delivery of altitude information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] notifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating)
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_RegisterListenerAltitude(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg, // NOLINT(readability/nolint)
+ uint8_t ucDeliveryTiming, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ SENSOR_RET_API ret_sens = SENSOR_RET_NORMAL; /* API return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_LOCATION_ALTITUDE; /* Data ID */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ucCtrlFlg != SENSOR_DELIVERY_REGIST) {
+ /* Parameters other than delivery registration are terminated abnormally when delivery control is terminated. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* If the thread name is NULL, it terminates with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ if ((ucGetMethod == SENSOR_GET_METHOD_GPS) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_LOCATION_ALTITUDE;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Delivery registration */
+ if (ret == POS_RET_NORMAL) {
+ /* Delivery registry SensorAPI calls */
+ ret_sens = PosRegisterListenerProc(notifyName, /* Destination thread name */
+ did, /* Data ID */
+ ucCtrlFlg, /* Delivery control */
+ ucDeliveryTiming); /* Delivery timing */
+
+ /* Decision of delivery registration result */
+ if (ret_sens == SENSOR_RET_NORMAL) {
+ ret = POS_RET_NORMAL;
+ } else if (ret_sens == SENSOR_RET_ERROR_PARAM) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ret_sens == SENSOR_RET_ERROR_BUFFULL) {
+ ret = POS_RET_ERROR_BUFFULL;
+ } else if (ret_sens == SENSOR_RET_ERROR_RESOURCE) {
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Vehicle Speed Information Transmission Registration
+ *
+ * Register delivery of vehicle speed information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] notifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating)
+ * @param[in] ucGetMethod uint8_t - Acquisition method(POS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_BUFFULL Buffer-full<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_RegisterListenerSpeed(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg, // NOLINT(readability/nolint)
+ uint8_t ucDeliveryTiming, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ SENSOR_RET_API ret_sens = SENSOR_RET_NORMAL; /* API return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did; /* Data ID */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ucCtrlFlg != SENSOR_DELIVERY_REGIST) {
+ /* Parameters other than delivery registration are terminated abnormally when delivery control is terminated. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* If the thread name is NULL, it terminates with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ if (ucGetMethod == SENSOR_GET_METHOD_POS) {
+ did = VEHICLE_DID_MOTION_SPEED_INTERNAL;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_MOTION_SPEED_NAVI;
+ } else {
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Delivery registration */
+ if (ret == POS_RET_NORMAL) {
+ /* Delivery registry SensorAPI calls */
+ ret_sens = PosRegisterListenerProc(notifyName, /* Destination thread name */
+ did, /* Data ID */
+ ucCtrlFlg, /* Delivery control */
+ ucDeliveryTiming); /* Delivery timing */
+
+ /* Decision of delivery registration result */
+ if (ret_sens == SENSOR_RET_NORMAL) {
+ ret = POS_RET_NORMAL;
+ } else if (ret_sens == SENSOR_RET_ERROR_PARAM) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ret_sens == SENSOR_RET_ERROR_BUFFULL) {
+ ret = POS_RET_ERROR_BUFFULL;
+ } else if (ret_sens == SENSOR_RET_ERROR_RESOURCE) {
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Compass Information Transmission Register
+ *
+ * Register the delivery of the vehicle orientation information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] notifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating)
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg, // NOLINT(readability/nolint)
+ uint8_t ucDeliveryTiming, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ SENSOR_RET_API ret_sens = SENSOR_RET_NORMAL; /* API return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_MOTION_HEADING; /* TODO VEHICLE_DID_LOCATION_HEADING Missing */
+ /* Data ID */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ucCtrlFlg != SENSOR_DELIVERY_REGIST) {
+ /* Parameters other than delivery registration are terminated abnormally when delivery control is terminated. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* If the thread name is NULL, it terminates with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ if (ucGetMethod == SENSOR_GET_METHOD_GPS) {
+ did = VEHICLE_DID_MOTION_HEADING;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_MOTION_HEADING_NAVI;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Delivery registration */
+ if (ret == POS_RET_NORMAL) {
+ /* Delivery registry SensorAPI calls */
+ ret_sens = PosRegisterListenerProc(notifyName, /* Destination thread name */
+ did, /* Data ID */
+ ucCtrlFlg, /* Delivery control */
+ ucDeliveryTiming); /* Delivery timing */
+
+ /* Decision of delivery registration result */
+ if (ret_sens == SENSOR_RET_NORMAL) {
+ ret = POS_RET_NORMAL;
+ } else if (ret_sens == SENSOR_RET_ERROR_PARAM) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ret_sens == SENSOR_RET_ERROR_BUFFULL) {
+ ret = POS_RET_ERROR_BUFFULL;
+ } else if (ret_sens == SENSOR_RET_ERROR_RESOURCE) {
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Get Lltitude and longitude information
+ *
+ * Get Lltitude and longitude information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] dat SENSORLOCATION_LONLATINFO_DAT* - Pointer to the acquired latitude/longitude information storage destination
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment<br>
+ * POS_RET_ERROR_INNER Internal error
+ *
+ */
+POS_RET_API POS_GetLonLat(HANDLE hApp, // NOLINT(readability/nolint)
+ SENSORLOCATION_LONLATINFO_DAT *dat, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_LOCATION_LONLAT; /* DID */
+ int32_t ret_get_proc; /* POS_GetProc Return Values */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (dat == NULL) {
+ /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ if (ucGetMethod == SENSOR_GET_METHOD_GPS) {
+ did = VEHICLE_DID_LOCATION_LONLAT;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_LOCATION_LONLAT_NAVI;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Sensor information acquisition */
+ if (ret == POS_RET_NORMAL) {
+ /* Data acquisition process */
+ ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORLOCATION_LONLATINFO_DAT));
+ if (static_cast<int32_t>(sizeof(SENSORLOCATION_LONLATINFO_DAT)) > ret_get_proc) {
+ /* Failed to acquire */
+ if (ret_get_proc == POS_RET_ERROR_RESOURCE) {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Altitude information acquisition
+ *
+ * Obtain altitude information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] dat SENSORLOCATION_ALTITUDEINFO_DAT* - Pointer to the acquired altitude information storage destination
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment<br>
+ * POS_RET_ERROR_INNER Internal error
+ *
+ */
+POS_RET_API POS_GetAltitude(HANDLE hApp, // NOLINT(readability/nolint)
+ SENSORLOCATION_ALTITUDEINFO_DAT *dat, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_LOCATION_ALTITUDE; /* DID */
+ int32_t ret_get_proc; /* POS_GetProc Return Values */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (dat == NULL) {
+ /* If the altitude data is NULL, it terminates with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ if ((ucGetMethod == SENSOR_GET_METHOD_GPS) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_LOCATION_ALTITUDE;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+ /* Sensor information acquisition */
+ if (ret == POS_RET_NORMAL) {
+ /* Data acquisition process */
+ ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+ if (static_cast<int32_t>(sizeof(SENSORLOCATION_ALTITUDEINFO_DAT)) > ret_get_proc) {
+ /* Failed to acquire */
+ if (ret_get_proc == POS_RET_ERROR_RESOURCE) {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Vehicle Speed Information Acquisition
+ *
+ * Obtain vehicle speed information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] dat SENSORMOTION_SPEEDINFO_DAT* - Pointer to the acquired car speed information storage destination
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment<br>
+ * POS_RET_ERROR_INNER Internal error
+ *
+ */
+POS_RET_API POS_GetSpeed(HANDLE hApp, // NOLINT(readability/nolint)
+ SENSORMOTION_SPEEDINFO_DAT *dat, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did; /* Data ID */
+ int32_t ret_get_proc; /* POS_GetProc Return Values */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+ if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [hApp = %p]", hApp);
+ } else if (dat == NULL) {
+ /* When the pointer to the vehicle speed data storage destination is NULL, the pointer terminates with an error in the parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [dat = %p]", dat);
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ if (ucGetMethod == SENSOR_GET_METHOD_POS) {
+ did = VEHICLE_DID_MOTION_SPEED_INTERNAL;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_MOTION_SPEED_NAVI;
+ } else {
+ /* End as a parameter error abnormality except for POS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Argument ERROR [type = %d, ucGetMethod = %d]",
+ type, ucGetMethod);
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "GetEnvSupportInfo ERROR [type = %d]", type);
+ }
+ }
+
+ if (ret == POS_RET_NORMAL) {
+ /* Data acquisition process */
+ ret_get_proc = PosGetProc(did, dat, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+ if (static_cast<int32_t>(sizeof(SENSORMOTION_SPEEDINFO_DAT)) > ret_get_proc) {
+ /* Failed to acquire */
+ if (ret_get_proc == POS_RET_ERROR_RESOURCE) {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Compass information acquisition
+ *
+ * Get Bill Direction Information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] dat SENSORMOTION_HEADINGINFO_DAT* - Pointer to the acquired altitude information storage destination
+ * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment<br>
+ * POS_RET_ERROR_INNER Internal error
+ *
+ */
+POS_RET_API POS_GetHeading(HANDLE hApp, // NOLINT(readability/nolint)
+ SENSORMOTION_HEADINGINFO_DAT *dat, // NOLINT(readability/nolint)
+ uint8_t ucGetMethod) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_MOTION_HEADING; /* Data ID */
+ int32_t ret_get_proc; /* POS_GetProc Return Values */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (dat == NULL) {
+ /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ if (ucGetMethod == SENSOR_GET_METHOD_GPS) {
+ did = VEHICLE_DID_MOTION_HEADING;
+ } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) ||
+ (ucGetMethod == SENSOR_GET_METHOD_AUTO)) {
+ did = VEHICLE_DID_MOTION_HEADING_NAVI;
+ } else {
+ /* End as a parameter error abnormality except for GPS/unspecified acquisition method */
+ ret = POS_RET_ERROR_PARAM;
+ }
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+ /* Sensor information acquisition */
+ if (ret == POS_RET_NORMAL) {
+ /* Data acquisition process */
+ ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORMOTION_HEADINGINFO_DAT));
+ if (static_cast<int32_t>(sizeof(SENSORMOTION_HEADINGINFO_DAT)) > ret_get_proc) {
+ /** Failed to acquire */
+ if (ret_get_proc == POS_RET_ERROR_RESOURCE) {
+ /** Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Vehicle speed information setting
+ *
+ * Setting Vehicle Speed Information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] navispped uint16_t - Vehicle speed information[Unit:1.0km/h]
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_SetSpeedInfo(HANDLE hApp, uint16_t navispeed) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ uint16_t speed; /* Vehicle speed */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if (hApp == NULL) {
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == POS_RET_NORMAL) {
+ /* Adjustment by unit [1.0km/h]->[0.01m/sec] */
+ speed = static_cast<uint16_t>(navispeed * 10000 / 360);
+ /* Data setting(After setting,Immediate termination) */
+ ret = PosSetProc(VEHICLE_DID_MOTION_SPEED_NAVI,
+ reinterpret_cast<void *>(&speed), sizeof(uint16_t), FALSE);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Location information setting
+ *
+ * Set location information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] posData POS_POSDATA - Pointer to location information
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_SetLocationInfo(HANDLE hApp, POS_POSDATA* pstPosData) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((pstPosData == NULL) || (hApp == NULL)) {
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == POS_RET_NORMAL) {
+ /* Data status check */
+ if ((0x01 > pstPosData->status) || (0x0F < pstPosData->status)) {
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Parameter range check */
+ /* Latitude */
+ if ((pstPosData->status & POS_LOC_INFO_LAT) == POS_LOC_INFO_LAT) {
+ (void)POS_CHKPARAM32(pstPosData->latitude, -41472000, 41472000);
+ }
+ /* Longitude */
+ if ((pstPosData->status & POS_LOC_INFO_LON) == POS_LOC_INFO_LON) {
+ (void)POS_CHKPARAM32(pstPosData->longitude, -82944000, 82944000);
+ }
+ /* Orientation */
+ if ((pstPosData->status & POS_LOC_INFO_HEAD) == POS_LOC_INFO_HEAD) {
+ (void)POS_CHKPARAM16(pstPosData->heading, -179, 180);
+ }
+
+ /* Data setting(After setting,Immediate termination) */
+ ret = PosSetProc(VEHICLE_DID_GPS_CUSTOMDATA_NAVI, // == POSHAL_DID_GPS_CUSTOMDATA_NAVI
+ reinterpret_cast<void *>(pstPosData), sizeof(POS_POSDATA), FALSE);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_common_API/Makefile b/video_in_hal/vehicleservice/positioning/client/src/POS_common_API/Makefile
new file mode 100755
index 0000000..4d7a90f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_common_API/Makefile
@@ -0,0 +1,47 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+######### installed shared library(*.so) #############
+INST_SHLIBS = libPOS_common_API
+
+######### compiled sources #############
+libPOS_common_API_SRCS += Common_API.cpp
+
+######### add include path #############
+CPPFLAGS += -I../../../server/include/common
+CPPFLAGS += -I../../include
+CPPFLAGS += -I../../../server/include/nsfw
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lPOS_base_API
+LDLIBS += -Wl,-Bdynamic -lvp
+
+######### add library path #############
+LDFLAGS += -shared
+
+include ../../../../vehicle_service.mk
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_common_API/libPOS_common_API.ver b/video_in_hal/vehicleservice/positioning/client/src/POS_common_API/libPOS_common_API.ver
new file mode 100755
index 0000000..afc7f3a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_common_API/libPOS_common_API.ver
@@ -0,0 +1,37 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libPOS_common_API version script
+#
+{
+ global:
+ POS_GetAltitude;
+ POS_GetHeading;
+ POS_GetLonLat;
+ POS_GetSpeed;
+ POS_RegisterListenerAltitude;
+ POS_RegisterListenerHeading;
+ POS_RegisterListenerLonLat;
+ POS_RegisterListenerSpeed;
+ POS_SetLocationInfo;
+ POS_SetSpeedInfo;
+
+ POS_SetLocationInfoNmea;
+ local:
+ *;
+};
+
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Gps_API.cpp b/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Gps_API.cpp
new file mode 100755
index 0000000..7395f9d
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Gps_API.cpp
@@ -0,0 +1,456 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * Gps_API.cpp
+ * @brief
+ * Module : POSITIONING
+ * GPS I/F service functionality
+ */
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/POS_gps_API.h>
+#include <vehicle_service/POS_common_API.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include "POS_common_private.h"
+#include "POS_private.h"
+#include "Vehicle_API_private.h"
+#include "Gps_API_private.h"
+
+
+/**
+ * @brief
+ * GPS reset request
+ *
+ * Request a GPS reset
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] ResName PCSTR - Destination thread name
+ * @param[in] mode uint8_t - Reset mode
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_INNER Internal processing error<br>
+ * POS_RET_ERROR_BUSY Busy occurrence<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_ReqGPSReset(HANDLE hApp, PCSTR ResName, uint8_t mode) { // NOLINT(readability/nolint)
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ RET_API ret_api = RET_NORMAL; /* API return value */
+ POS_RESETINFO snd_msg; /* Reset information */
+ EventID event_id; /* Event ID */
+ int32_t event_val; /* Event value */
+ PNO my_pno; /* Caller PNO */
+ PNO rs_pno; /* Destination PNO */
+ uint32_t pid; /* Process ID */
+ uint32_t tid; /* Thread ID */
+ char name[128]; /* Name buffer */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((hApp == NULL) || (ResName == NULL)) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (GPS_RST_COLDSTART != mode) {
+ /* Parameter error except */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+
+ if (ret == POS_RET_NORMAL) {
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+ /* Event Generation */
+ rs_pno = _pb_CnvName2Pno(ResName);
+ pid = (uint32_t)getpid();
+ tid = GetTid();
+
+ snprintf(name, sizeof(name), "PR_p%u_t%u", pid, tid);
+ my_pno = _pb_CnvName2Pno(name);
+ event_id = VehicleCreateEvent(my_pno);
+ if (0 != event_id) {
+ /* Successful event generation */
+ memset(&snd_msg, 0x00, sizeof(POS_RESETINFO));
+
+ /* Message creation */
+ snd_msg.mode = mode; /* Reset mode */
+ snd_msg.snd_pno = my_pno; /* Caller PNo. */
+ snd_msg.res_pno = rs_pno; /* Destination PNo. */
+
+ /* Message transmission request */
+ ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_GPS_REQRESET,
+ sizeof(POS_RESETINFO),
+ reinterpret_cast<void*>(&snd_msg), 0);
+
+ if (RET_NORMAL == ret_api) {
+ /* If the data setup process is successful,Wait for a completion event */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN, VEHICLE_RET_NORMAL, &event_val, INFINITE);
+ if (RET_NORMAL != ret_api) {
+ /* When not put in event wait state */
+ /* Event generation failure */
+ ret = POS_RET_ERROR_INNER;
+ } else {
+ /* Return from Event Wait */
+ /* Set event value (processing result) as return value */
+ ret = (POS_RET_API)event_val;
+ }
+ } else {
+ /* Message transmission processing failed */
+ ret = POS_RET_ERROR_INNER;
+ }
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ ret = POS_RET_ERROR_INNER;
+ }
+ } else {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS time setting request delivery registration
+ *
+ * Register delivery of GPS time setting request
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] notifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_BUFFULL Buffer-full<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_RegisterListenerGPSTimeSetReq(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ SENSOR_RET_API ret_sens = SENSOR_RET_NORMAL; /* API return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((hApp == NULL) || (notifyName == NULL)) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (SENSOR_DELIVERY_REGIST != ucCtrlFlg) {
+ /* Parameter error other than delivery registration */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Delivery registration */
+ if (POS_RET_NORMAL == ret) {
+ /* Delivery registry SensorAPI calls */
+ ret_sens = PosRegisterListenerProc(notifyName, /* Destination thread name */
+ VEHICLE_DID_SETTINGTIME, /* Data ID */
+ ucCtrlFlg, /* Delivery control */
+ VEHICLE_DELIVERY_TIMING_UPDATE); /* Delivery timing */
+
+ /* Decision of delivery registration result */
+ if (ret_sens == SENSOR_RET_NORMAL) {
+ ret = POS_RET_NORMAL;
+ } else if (ret_sens == SENSOR_RET_ERROR_PARAM) {
+ ret = POS_RET_ERROR_PARAM;
+ } else if (ret_sens == SENSOR_RET_ERROR_BUFFULL) {
+ ret = POS_RET_ERROR_BUFFULL;
+ } else if (ret_sens == SENSOR_RET_ERROR_RESOURCE) {
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS time setting
+ *
+ * Set the GPS time
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] pstDateTime POS_DATETIME - Pointer to GPS time information
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_TIMEOUT Timeout error<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_SetGPStime(HANDLE hApp, POS_DATETIME* pstDateTime) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if ((pstDateTime == NULL) || (hApp == NULL)) {
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == POS_RET_NORMAL) {
+ /* Parameter range check */
+ /* Month */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->month, 1, 12)) {
+ return POS_RET_ERROR_PARAM;
+ }
+ /* Day */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->date, 1, 31)) {
+ return POS_RET_ERROR_PARAM;
+ }
+ /* Hour */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->hour, 0, 23)) {
+ return POS_RET_ERROR_PARAM;
+ }
+ /* Minutes */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->minute, 0, 59)) {
+ return POS_RET_ERROR_PARAM;
+ }
+ /* Second */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->second, 0, 59)) {
+ return POS_RET_ERROR_PARAM;
+ }
+
+ /* Data setting(Immediate recovery)*/
+ ret = PosSetProc(VEHICLE_DID_SETTINGTIME,
+ reinterpret_cast<void*>(pstDateTime), sizeof(POS_DATETIME), FALSE);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS Time Delivery Registration
+ *
+ * Registering GPS time delivery
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] nofifyName PCSTR - Destination thread name
+ * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery)
+ * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating)
+ *
+ * @return SENSOR_RET_NORMAL Successful registration<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_BUFFULL FULL of delivery registers<br>
+ * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+SENSOR_RET_API POS_RegisterListenerGPStime(HANDLE hApp, // NOLINT(readability/nolint)
+ PCSTR notifyName, // NOLINT(readability/nolint)
+ uint8_t ucCtrlFlg, // NOLINT(readability/nolint)
+ uint8_t ucDeliveryTiming) { // NOLINT(readability/nolint)
+ SENSOR_RET_API ret = SENSOR_RET_NORMAL;
+ UNIT_TYPE type = UNIT_TYPE_NONE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ if (hApp == NULL) {
+ /* Parameter error */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = SENSOR_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* fail */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (SENSOR_RET_NORMAL == ret) {
+ if (notifyName == NULL) {
+ /* Parameter error */
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+ if (ucCtrlFlg != SENSOR_DELIVERY_REGIST) {
+ /* Parameter error */
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Parameter error */
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+ }
+
+ if (SENSOR_RET_NORMAL == ret) {
+ /* Delivery registration process */
+ ret = PosRegisterListenerProc(notifyName, VEHICLE_DID_GPS_TIME, ucCtrlFlg, ucDeliveryTiming);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+ return ret;
+}
+
+/**
+ * @brief
+ * Get GPS time
+ *
+ * Get the GPS time
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] *dat SENSOR_GPSTIME - Pointer to GPS time information
+ *
+ * @return POS_RET_NORMAL Normal completion(Include illegal)<br>
+ * POS_RET_ERROR_INNER Internal error<br>
+ * POS_RET_ERROR_PARAM Parameter error<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_GetGPStime(HANDLE hApp, SENSOR_GPSTIME* dat) { // NOLINT(readability/nolint)
+ POS_RET_API ret = POS_RET_NORMAL; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ DID did = VEHICLE_DID_GPS_TIME; /* DID */
+ int32_t ret_get_proc; /* POS_GetProc Return Values */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Arguments & Support Configuration Check */
+ if (hApp == NULL) {
+ /* If the handler is NULL, the process terminates with an error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else if (dat == NULL) {
+ /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ ret = POS_RET_NORMAL;
+ } else {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ /* Sensor information acquisition */
+ if (ret == POS_RET_NORMAL) {
+ /* Data acquisition process */
+ ret_get_proc = PosGetProc(did, reinterpret_cast<void*>(dat), sizeof(SENSOR_GPSTIME));
+ if (static_cast<int32_t>(sizeof(SENSOR_GPSTIME)) > ret_get_proc) {
+ /* Failed to acquire */
+ if (ret_get_proc == POS_RET_ERROR_RESOURCE) {
+ /* Insufficient resource */
+ ret = POS_RET_ERROR_RESOURCE;
+ } else {
+ ret = POS_RET_ERROR_INNER;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret);
+
+ return ret;
+}
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Makefile b/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Makefile
new file mode 100755
index 0000000..c6391a9
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Makefile
@@ -0,0 +1,51 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+######### installed shared library(*.so) #############
+INST_SHLIBS = libPOS_gps_API
+
+######### compiled sources #############
+libPOS_gps_API_SRCS += Gps_API.cpp
+libPOS_gps_API_SRCS += Naviinfo_API.cpp
+
+######### add include path #############
+CPPFLAGS += -I../../../server/include/common
+CPPFLAGS += -I../../include
+CPPFLAGS += -I../../../server/include/nsfw
+
+CPPFLAGS += -I../Vehicle_API
+CPPFLAGS += -I../Vehicle_API/common
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lPOS_base_API
+LDLIBS += -Wl,-Bdynamic -lvp
+
+######### add library path #############
+LDFLAGS += -shared
+
+include ../../../../vehicle_service.mk
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Naviinfo_API.cpp b/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Naviinfo_API.cpp
new file mode 100755
index 0000000..cfe04ff
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/Naviinfo_API.cpp
@@ -0,0 +1,404 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+@file Naviinfo_API.cpp
+@detail Naviinfo_API Functions
+@lib libNaviinfo_API.so
+******************************************************************************/
+
+/*****************************************************************************
+ * Include *
+ *****************************************************************************/
+#include "Naviinfo_API.h"
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/POS_gps_API.h>
+#include "Vehicle_API_Dummy.h"
+#include "POS_private.h"
+#include <native_service/frameworkunified_types.h> // NOLINT(build/include_order)
+
+void PosCnvGpsInfo(NAVIINFO_ALL *navi_loc_info);
+
+
+/**
+ * @brief
+ * GPS information setting
+ *
+ * Set GPS information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] navilocinfo NAVIINFO_ALL* - Pointer to GPS information storage area
+ *
+ * @return NAVIINFO_RET_NORMAL Normal completion<br>
+ * NAVIINFO_RET_ERROR_PARAM Parameter error<br>
+ * NAVIINFO_RET_ERROR_INNER Internal error<br>
+ * NAVIINFO_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+NAVIINFO_RET_API POS_SetGPSInfo(HANDLE hApp, NAVIINFO_ALL *navilocinfo)
+{
+ NAVIINFO_RET_API ret = NAVIINFO_RET_NORMAL; /* Return value of this function */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ NAVIINFO_ALL navi_loc_info_tmp; /* Conversion quantity area */
+ RET_API ret_api;
+
+ /** NULL checking */
+ if (navilocinfo == NULL) {
+ /** Parameter error */
+ ret = NAVIINFO_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /** Parameter error */
+ ret = NAVIINFO_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = NAVIINFO_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = NAVIINFO_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = NAVIINFO_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == NAVIINFO_RET_NORMAL) {
+ /* Parameter range check */
+ if (navilocinfo->stNaviGps.tdsts != 0) { /* Other than ""Time not calibrated after receiver reset"" */
+ /* Positioning status information */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stDiagGps.stFix.ucFixSts, 0, 2)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* Latitude */
+ if (POS_RET_ERROR == POS_CHKPARAM32(navilocinfo->stDiagGps.stFix.stWgs84.lLat, -82944000, 82944000)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* Longitude */
+ if (POS_RET_ERROR == POS_CHKPARAM32(navilocinfo->stDiagGps.stFix.stWgs84.lLon, -165888000, 165888000)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* Measurement Azimuth */
+ if (POS_RET_ERROR == POS_CHKPARAMU16(navilocinfo->stNaviGps.heading, 0, 3599)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* UTC(Month) */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.month, 1, 12)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* UTC(Day) */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.date, 1, 31)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* UTC(Hour) */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.hour, 0, 23)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* UTC(Minutes) */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.minute, 0, 59)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ /* UTC(Second) */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.second, 0, 59)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+ }
+ /* Date and Time Status */
+ if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.tdsts, 0, 2)) {
+ return NAVIINFO_RET_ERROR_PARAM;
+ }
+
+ /* Copy to conversion area */
+ memcpy(&navi_loc_info_tmp, navilocinfo, sizeof(NAVIINFO_ALL));
+ /** Data unit conversion */
+ PosCnvGpsInfo(&navi_loc_info_tmp);
+
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+
+ /** Send navigation information to vehicle sensor */
+ ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_NAVIINFO_DELIVER,
+ sizeof(NAVIINFO_ALL),
+ reinterpret_cast<void*>(&navi_loc_info_tmp), 0);
+ if (ret_api != RET_NORMAL) {
+ /** Message transmission failure */
+ ret = NAVIINFO_RET_ERROR_INNER;
+ }
+ } else {
+ /* When resource shortage occurs, the system terminates with an insufficient resource error. */
+ ret = NAVIINFO_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * GPS information acquisition
+ *
+ * Access GPS information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] navidiaginfo NAVIINFO_DIAG_GPS* - Pointer to GPS information storage area
+ *
+ * @return NAVIINFO_RET_NORMAL Normal completion<br>
+ * NAVIINFO_RET_ERROR_PARAM Parameter error<br>
+ * NAVIINFO_RET_ERROR_INNER Internal error<br>
+ * NAVIINFO_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+NAVIINFO_RET_API POS_GetGPSInfo(HANDLE hApp, NAVIINFO_DIAG_GPS *navidiaginfo)
+{
+ NAVIINFO_RET_API ret = NAVIINFO_RET_NORMAL; /* Return value of this function */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ int32_t ret_veh; /* VehicleAPI Return Values */
+ NAVIINFO_DIAG_GPS dest_data; /* Data acquisition area */
+
+ /** NULL checking */
+ if (navidiaginfo == NULL) {
+ /** Parameter error */
+ ret = NAVIINFO_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /** Parameter error */
+ ret = NAVIINFO_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = NAVIINFO_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = NAVIINFO_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = NAVIINFO_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == NAVIINFO_RET_NORMAL) {
+ /** Acquisition of navigation data for Diag provide */
+ ret_veh = PosGetProc(
+ (DID)VEHICLE_DID_NAVIINFO_DIAG_GPS,
+ reinterpret_cast<void*>(&dest_data),
+ (u_int16)sizeof(dest_data));
+
+ if (static_cast<int32_t>(sizeof(NAVIINFO_DIAG_GPS)) > ret_veh) {
+ /** Failed to acquire */
+ if (ret_veh == POS_RET_ERROR_RESOURCE) {
+ ret = NAVIINFO_RET_ERROR_RESOURCE;
+ } else {
+ ret = NAVIINFO_RET_ERROR_INNER;
+ }
+ } else {
+ /** Successful acquisition */
+ memcpy( navidiaginfo, &dest_data, sizeof(NAVIINFO_DIAG_GPS));
+ }
+ }
+
+ return ret;
+}
+
+/* ++ GPS _CWORD82_ support */
+/**
+ * @brief
+ * GPS setting transmission request
+ *
+ * Requesting GPS Settings with Complete Return
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] p_data SENSOR_MSG_SEND_DAT* - GPS setting information to be sent
+ *
+ * @return SENSOR_RET_NORMAL Normal completion<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_DID Unregistered DID<br>
+ * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+int32 POS_ReqGPSSetting(HANDLE hApp, SENSOR_MSG_SEND_DAT *p_data) { /* Ignore->MISRA-C++:2008 Rule 7-1-2 */
+ SENSOR_RET_API ret = SENSOR_RET_NORMAL; /* Return value */
+ RET_API ret_api; /* System API return value */
+ uint16_t expected_size; /* Message size for the specified DID */
+
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+
+ if (hApp == NULL) {
+ /* Parameter error */
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+
+ if (ret == SENSOR_RET_NORMAL) {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Argument check (DID) + Size calculation */
+ if (p_data != reinterpret_cast<SENSOR_MSG_SEND_DAT*>(NULL)) {
+ switch (p_data->did) {
+ case VEHICLE_DID_GPS__CWORD82__SETINITIAL:
+ {
+ expected_size = 71;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SETRMODE:
+ {
+ expected_size = 50;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SETRMODEEX:
+ {
+ expected_size = 63;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SELSENT:
+ {
+ expected_size = 21;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SETSBAS:
+ {
+ expected_size = 34;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SETCONF1:
+ {
+ expected_size = 37;
+ break;
+ }
+ case VEHICLE_DID_GPS__CWORD82__SETCONF2:
+ {
+ expected_size = 45;
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ ret = SENSOR_RET_ERROR_DID;
+ break;
+ }
+ } else {
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+ }
+
+ /* Supported HW Configuration Check */
+ if (ret == SENSOR_RET_NORMAL) {
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = SENSOR_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == SENSOR_RET_NORMAL) {
+ /* Argument check (Size)*/
+ if (expected_size != p_data->usSize) {
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Message buffer initialization */
+
+ /* Create message data */
+
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+ /* External Process Transmission and Reception Messages */
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "POSITIONING: POS_ReqGPSSetting() --> cid = %d",
+ CID_SENSORIF__CWORD82__REQUEST);
+ ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME,
+ CID_SENSORIF__CWORD82__REQUEST,
+ sizeof(SENSOR_MSG_SEND_DAT),
+ reinterpret_cast<void *>(p_data), 0);
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__, "POSITIONING: POS_ReqGPSSetting() <--");
+
+ if (ret_api != RET_NORMAL) {
+ ret = SENSOR_RET_ERROR_CREATE_EVENT;
+ }
+ } else {
+ /* When resource shortage occurs, the system terminates with an insufficient resource error. */
+ ret = SENSOR_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+ }
+ }
+
+ return ret;
+}
+/* -- GPS _CWORD82_ support */
+
+/**
+ * @brief
+ * GPS information conversion process
+ *
+ * Convert GPS information to a format to be provided to the vehicle sensor
+ *
+ * @param[in] none
+ * @param[in] navi_loc_info NAVIINFO_ALL* - GPS information pointer
+ *
+ * @return none
+ */
+void PosCnvGpsInfo(NAVIINFO_ALL *navi_loc_info) {
+ int32_t altitude;
+ int64_t tmp;
+ uint16_t heading;
+
+ /* Unit conversion of fix altitude[1m]->[0.01m] */
+ tmp = (int64_t)((int64_t)(navi_loc_info->stNaviGps.altitude) * 100);
+ if (tmp > static_cast<int32_t>(0x7FFFFFFF)) {
+ /* +Overflow of digits */
+ altitude = static_cast<int32_t>(0x7FFFFFFF);
+ } else if (tmp < static_cast<int32_t>(0x80000000)) { /* Ignore->MISRA-C:2004 Rule 3.1 */
+ /* -Overflow of digits */
+ altitude = static_cast<int32_t>(0x80000000); /* Ignore->MISRA-C:2004 Rule 3.1 */
+ } else {
+ altitude = static_cast<int32_t>(tmp);
+ }
+ navi_loc_info->stNaviGps.altitude = altitude;
+
+ /* Measurement Azimuth Conversion[0.Once]->[0.01 degree] */
+ heading = navi_loc_info->stNaviGps.heading;
+ heading = static_cast<uint16_t>(heading - ((heading / 3600) * 3600));
+ heading = static_cast<uint16_t>(heading * 10);
+ navi_loc_info->stNaviGps.heading = heading;
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/libPOS_gps_API.ver b/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/libPOS_gps_API.ver
new file mode 100755
index 0000000..038c99e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_gps_API/libPOS_gps_API.ver
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libPOS_gps_API version script
+#
+{
+ global:
+ POS_GetGPSInfo;
+ POS_GetGPSVersion;
+ POS_RegisterListenerGPSTimeSetReq;
+ POS_RegisterListenerGPStime;
+ POS_ReqGPSReset;
+ POS_ReqGPSSetting;
+ POS_SetGPSInfo;
+ POS_SetGPStime;
+ POS_GetGPStime;
+ local:
+ *;
+};
+
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Makefile b/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Makefile
new file mode 100755
index 0000000..a4f627f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Makefile
@@ -0,0 +1,48 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+######### installed shared library(*.so) #############
+INST_SHLIBS = libPOS_sensor_API
+
+######### compiled sources #############
+libPOS_sensor_API_SRCS += Sensor_API.cpp
+libPOS_sensor_API_SRCS += Vehicle_API.cpp
+
+######### add include path #############
+CPPFLAGS += -I../../../server/include/common
+CPPFLAGS += -I../../include
+CPPFLAGS += -I../../../server/include/nsfw
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lPOS_base_API
+LDLIBS += -Wl,-Bdynamic -lvp
+######### add library path #############
+LDFLAGS += -shared
+
+
+include ../../../../vehicle_service.mk
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Sensor_API.cpp b/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Sensor_API.cpp
new file mode 100755
index 0000000..179eb92
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Sensor_API.cpp
@@ -0,0 +1,784 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :Sensor_API.cpp
+ * System name :GPF
+ * Subsystem name :Sensor I/F library
+ * Program name :SensorI/F API
+ ******************************************************************************/
+
+#include <stdio.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/POS_define.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "POS_sensor_private.h"
+#include "Sensor_Common_API.h"
+#include "Sensor_API_private.h"
+#include "Sensor_Common_API.h"
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+#include "Naviinfo_API.h"
+#include "POS_private.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+/********************************************************************************
+ * TAG :TG_GPS_REQ_RESET
+ * ABSTRACT :GPS reset request
+ * NOTE :I/F information between host applications(Reset mode)
+ ********************************************************************************/
+/**
+ * @brief POS_RegisterListenerPkgSensData Return code list
+ */
+static const SENSOR_RET_PKG g_ret_list_reg_lis_pkg_sens_data[SENSOR_PUBLIC_DID_NUM] = {
+ /* GRADE2 GRADE1 DID (Key) */
+ {TRUE, TRUE, POS_DID_SPEED_PULSE },
+ {FALSE, TRUE, POS_DID_SPEED_KMPH },
+ {TRUE, TRUE, POS_DID_GYRO_X },
+ {TRUE, TRUE, POS_DID_GYRO_Y },
+ {TRUE, TRUE, POS_DID_GYRO_Z },
+ {TRUE, TRUE, POS_DID_GSNS_X },
+ {TRUE, TRUE, POS_DID_GSNS_Y },
+ {TRUE, TRUE, POS_DID_GSNS_Z },
+ {FALSE, TRUE, POS_DID_GPS_ANTENNA },
+ {TRUE, TRUE, POS_DID_SNS_COUNTER },
+ {FALSE, TRUE, POS_DID_SPEED_PULSE_FST },
+ {FALSE, TRUE, POS_DID_GYRO_X_FST },
+ {FALSE, TRUE, POS_DID_GYRO_Y_FST },
+ {FALSE, TRUE, POS_DID_GYRO_Z_FST },
+ {FALSE, TRUE, POS_DID_GPS__CWORD82__NMEA },
+ {FALSE, TRUE, POS_DID_GPS__CWORD82___CWORD44_GP4 },
+ {FALSE, TRUE, POS_DID_GPS__CWORD82__FULLBINARY },
+ {FALSE, TRUE, POS_DID_GPS_NMEA },
+ {TRUE, TRUE, POS_DID_REV },
+ {FALSE, TRUE, POS_DID_REV_FST },
+ {TRUE, TRUE, POS_DID_GYRO_TEMP },
+ {FALSE, TRUE, POS_DID_GYRO_TEMP_FST },
+ {FALSE, TRUE, POS_DID_GSNS_X_FST },
+ {FALSE, TRUE, POS_DID_GSNS_Y_FST },
+ {FALSE, TRUE, POS_DID_GSNS_Z_FST },
+ {TRUE, TRUE, POS_DID_PULSE_TIME },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_DRIFT },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_FREQ },
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME_RAW }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_WKNROLLOVER} /* For local use */
+};
+
+/**
+ * @brief POS_RegisterListenerSensData Return code list
+ */
+static const SENSOR_RET_PKG g_ret_list_reg_lis_sens_data[SENSOR_PUBLIC_DID_NUM] = {
+ /* GRADE2 GRADE1 DID (Key) */
+ {TRUE, TRUE, POS_DID_SPEED_PULSE },
+ {FALSE, TRUE, POS_DID_SPEED_KMPH },
+ {TRUE, TRUE, POS_DID_GYRO_X },
+ {TRUE, TRUE, POS_DID_GYRO_Y },
+ {TRUE, TRUE, POS_DID_GYRO_Z },
+ {TRUE, TRUE, POS_DID_GSNS_X },
+ {TRUE, TRUE, POS_DID_GSNS_Y },
+ {TRUE, TRUE, POS_DID_GSNS_Z },
+ {TRUE, TRUE, POS_DID_GPS_ANTENNA },
+ {FALSE, TRUE, POS_DID_SNS_COUNTER },
+ {TRUE, TRUE, POS_DID_SPEED_PULSE_FST },
+ {TRUE, TRUE, POS_DID_GYRO_X_FST },
+ {TRUE, TRUE, POS_DID_GYRO_Y_FST },
+ {TRUE, TRUE, POS_DID_GYRO_Z_FST },
+ {TRUE, TRUE, POS_DID_GPS__CWORD82__NMEA },
+ {FALSE, TRUE, POS_DID_GPS__CWORD82___CWORD44_GP4 },
+ {TRUE, TRUE, POS_DID_GPS__CWORD82__FULLBINARY },
+ {FALSE, TRUE, POS_DID_GPS_NMEA },
+ {FALSE, TRUE, POS_DID_REV },
+ {TRUE, TRUE, POS_DID_REV_FST },
+ {TRUE, TRUE, POS_DID_GYRO_TEMP },
+ {TRUE, TRUE, POS_DID_GYRO_TEMP_FST },
+ {TRUE, TRUE, POS_DID_GSNS_X_FST },
+ {TRUE, TRUE, POS_DID_GSNS_Y_FST },
+ {TRUE, TRUE, POS_DID_GSNS_Z_FST },
+ {FALSE, TRUE, POS_DID_PULSE_TIME },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_DRIFT },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_FREQ },
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME_RAW }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_WKNROLLOVER } /* For local use */
+};
+
+/**
+ * @brief POS_GetSensData Return code list
+ */
+static const SENSOR_RET_PKG g_ret_list_get_sens_data[SENSOR_PUBLIC_DID_NUM] = {
+ /* GRADE2 GRADE1 DID (Key) */
+ {TRUE, TRUE, POS_DID_SPEED_PULSE },
+ {FALSE, TRUE, POS_DID_SPEED_KMPH },
+ {TRUE, TRUE, POS_DID_GYRO_X },
+ {TRUE, TRUE, POS_DID_GYRO_Y },
+ {TRUE, TRUE, POS_DID_GYRO_Z },
+ {TRUE, TRUE, POS_DID_GSNS_X },
+ {TRUE, TRUE, POS_DID_GSNS_Y },
+ {TRUE, TRUE, POS_DID_GSNS_Z },
+ {TRUE, TRUE, POS_DID_GPS_ANTENNA },
+ {FALSE, TRUE, POS_DID_SNS_COUNTER },
+ {FALSE, TRUE, POS_DID_SPEED_PULSE_FST },
+ {FALSE, TRUE, POS_DID_GYRO_X_FST },
+ {FALSE, TRUE, POS_DID_GYRO_Y_FST },
+ {FALSE, TRUE, POS_DID_GYRO_Z_FST },
+ {TRUE, TRUE, POS_DID_GPS__CWORD82__NMEA },
+ {FALSE, TRUE, POS_DID_GPS__CWORD82___CWORD44_GP4 },
+ {TRUE, TRUE, POS_DID_GPS__CWORD82__FULLBINARY },
+ {FALSE, TRUE, POS_DID_GPS_NMEA },
+ {FALSE, TRUE, POS_DID_REV },
+ {FALSE, TRUE, POS_DID_REV_FST },
+ {TRUE, TRUE, POS_DID_GYRO_TEMP },
+ {FALSE, TRUE, POS_DID_GYRO_TEMP_FST },
+ {FALSE, TRUE, POS_DID_GSNS_X_FST },
+ {FALSE, TRUE, POS_DID_GSNS_Y_FST },
+ {FALSE, TRUE, POS_DID_GSNS_Z_FST },
+ {FALSE, TRUE, POS_DID_PULSE_TIME },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_DRIFT },
+ {FALSE, TRUE, POS_DID_GPS_CLOCK_FREQ },
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_TIME_RAW }, /* For local use */
+ {FALSE, TRUE, VEHICLE_DID_GPS_WKNROLLOVER } /* For local use */
+};
+
+/**
+ * @brief
+ * DID-decision functions for Sensor API
+ *
+ * Determines whether or not the DID specified by the public API corresponds to the DID.
+ *
+ * @param[in] did Data ID
+ * @param[in] mode Operation mode 1:For Package Delivery Registration API<br>
+ * 2:For Sensor Data Delivery Registration API<br>
+ * 3:For Sensor Data Acquisition API
+ *
+ * @return TRUE Be supported
+ * FALSE Not supported
+ */
+BOOL SensorJudgeDid(DID did, uint8_t mode) {
+ BOOL ret = FALSE;
+ UNIT_TYPE type;
+ const SENSOR_RET_PKG *pkg_list = NULL;
+ int32_t i;
+
+ /* Set Return pakage list */
+ switch (mode) {
+ case MODE_REGISTER_LISTENER_PKG_SENS_DATA: /* POS_RegisterListenerPkgSensData */
+ {
+ pkg_list = g_ret_list_reg_lis_pkg_sens_data;
+ break;
+ }
+ case MODE_REGISTER_LISTENER_SENSDATA: /* POS_RegisterListenerSensData */
+ {
+ pkg_list = g_ret_list_reg_lis_sens_data;
+ break;
+ }
+ case MODE_GET_SENSDATA: /* POS_GetSensData */
+ {
+ pkg_list = g_ret_list_get_sens_data;
+ break;
+ }
+ default:
+ /* Error log */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [mode = %d]", mode);
+ break;
+ }
+
+ if (pkg_list != NULL) {
+ /* Search Return code list for DID */
+ for (i = 0; i < SENSOR_PUBLIC_DID_NUM; i++) {
+ if (did == pkg_list[i].did) {
+ break;
+ }
+ }
+
+ if (i != SENSOR_PUBLIC_DID_NUM) {
+ /* Get Unit type */
+ type = GetEnvSupportInfo();
+ switch (type) {
+ case UNIT_TYPE_GRADE1:
+ {
+ ret = pkg_list[i].GRADE1_ret;
+ break;
+ }
+ case UNIT_TYPE_GRADE2:
+ {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = pkg_list[i].GRADE2_ret;
+ break;
+ }
+ default:
+ /* Error log */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "GetEnvSupportInfo ERROR [type = %d]", type);
+ break;
+ }
+ } else {
+ /* Error log */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [did = %d]", did);
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Information Extended Package Delivery Registration
+ * Sensor information is delivered for the first time.,Extension Packaging and Registering for Delivery.
+ *
+ * @param[in] hApp Application handle
+ * @param[in] notifyName Destination thread name
+ * @param[in] ucPkgNum Number of package data(1 to 16)
+ * @param[in] *pulDid Pointer to an array of data IDs for vehicle information
+ * @param[in] ucCtrlFlg Delivery control<br>
+ * Delivery registration: SENSOR_DELIVERY_REGIST<br>
+ * Delivery stop: SENSOR_DELIVERY_STOP (Note: Not mounted)<br>
+ * Resume delivery: SENSOR_DELIVERY_RESTART (Note: Not mounted)
+ * @param[in] ucDeliveryTiming Delivery timing<br>
+ * Updating : SENSOR_DELIVERY_TIMING_UPDATE<br>
+ * Changing : SENSOR_DELIVERY_TIMING_CHANGE
+ *
+ * @return SENSOR_RET_NORMAL Successful registration<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_DID Unregistered ID<br>
+ * SENSOR_RET_ERROR_BUFFULL FULL of delivery registers<br>
+ * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment<br>
+ * SENSOR_RET_ERROR_INNER Internal abnormality
+ *
+ */
+SENSOR_RET_API POS_RegisterListenerPkgSensData(HANDLE hApp,
+ PCSTR notifyName,
+ uint8_t ucPkgNum,
+ DID *pulDid, uint8_t ucCtrlFlg, uint8_t ucDeliveryTiming) {
+ SENSOR_RET_API ret; /* Return value */
+ BOOL ret_b;
+ RET_API ret_api; /* System API return value */
+ EventID event_id; /* Event ID */
+ int32_t event_val; /* Event value */
+ SENSOR_MSG_DELIVERY_ENTRY_DAT data; /* Message data */
+ int32_t i; /* Generic counters */
+ PNO ch_pno; /* Converted internal PNO */
+ UNIT_TYPE type; /* Supported HW Configuration Type */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ ret = SENSOR_RET_NORMAL;
+ /* Check Handle */
+ if (hApp == NULL) {
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ }
+
+ if (ret == SENSOR_RET_NORMAL) {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = SENSOR_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == SENSOR_RET_NORMAL) {
+ /* Check Delivery Control Designation */
+ if (SENSOR_DELIVERY_REGIST != ucCtrlFlg) {
+ /* Parameters other than delivery registration terminated abnormally. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Check delivery timing */
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* Check Thread Name */
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if ((0 == ucPkgNum) || (SENSOR_PKG_DELIVERY_MAX < ucPkgNum)) {
+ /* Check Package Data Count */
+ /* Out-of-range is terminated as a parameter error. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (pulDid == NULL) {
+ /* Check Data ID */
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Check if data ID is acceptable */
+ for (i = 0; i < ucPkgNum; i++) {
+ /* Judge DID */
+ ret_b = SENSOR_DID_JUDGE_REGLIS_PKG(pulDid[i]);
+ if (ret_b == FALSE) {
+ /* An unacceptable ID terminates with an abnormal parameter. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ break;
+ } else {
+ ret = SENSOR_RET_NORMAL;
+ }
+ }
+ }
+ }
+
+ if (ret == SENSOR_RET_NORMAL) {
+ /* Resource acquisition */
+ if (VehicleGetResource() == TRUE) {
+
+ /* Initialization */
+ event_id = 0;
+ event_val = 0;
+ memset(reinterpret_cast<void *>(&data), 0, sizeof(SENSOR_MSG_DELIVERY_ENTRY_DAT));
+
+ /* Get PNO from Thread Name */
+ ch_pno = _pb_CnvName2Pno(notifyName);
+
+ /* Event Generation */
+ event_id = PosCreateEvent(ch_pno);
+
+ if (0 != event_id) {
+ /* Successful event generation */
+
+ /*--------------------------------------------------------------*
+ * Send Vehicle Sensor Information Delivery Registration Message *
+ *--------------------------------------------------------------*/
+ /* Create Message Data */
+ data.pno = ch_pno;
+ data.pkg_num = ucPkgNum;
+ data.delivery_timing = ucDeliveryTiming;
+ data.ctrl_flg = ucCtrlFlg;
+ data.event_id = event_id;
+ for (i = 0; i < ucPkgNum; i++) {
+ data.did[i] = pulDid[i];
+ }
+
+ /* Messaging */
+ ret_api = PosSndMsg(ch_pno,
+ PNO_VEHICLE_SENSOR,
+ CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT,
+ (uint16_t)sizeof(SENSOR_MSG_DELIVERY_ENTRY_DAT),
+ (const void *)&data);
+
+ if (RET_NORMAL == ret_api) {
+ /* Message transmission processing is successful */
+ /* Wait for completion event from vehicle sensor thread */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ SENSOR_RET_ERROR_MIN,
+ SENSOR_RET_NORMAL,
+ &event_val,
+ POS_API_TIME_OUT_MS);
+ if (RET_NORMAL != ret_api) {
+ /* Return an internal error */
+ ret = SENSOR_RET_ERROR_INNER;
+ } else {
+ /* Return from Event Wait */
+ /* Set event value (processing result) as return value */
+ ret = (SENSOR_RET_API)event_val;
+ }
+ } else {
+ /* Message transmission processing failed */
+ /* Return an internal error */
+ ret = SENSOR_RET_ERROR_INNER;
+ }
+
+ /* Event deletion */
+ ret_api = PosDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ ret = SENSOR_RET_ERROR_CREATE_EVENT;
+ }
+ } else {
+ /* When resource shortage occurs, the system terminates with an insufficient resource error. */
+ ret = SENSOR_RET_ERROR_RESOURCE;
+ }
+ /* Resource release */
+ VehicleReleaseResource();
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : PosCreateEvent
+ * ABSTRACT : Event creation process
+ * FUNCTION : Generate an event
+ * ARGUMENT : pno : Thread ID
+ * NOTE :
+ * RETURN : Non-zero : Event ID
+ * : Zero : Event generation failure
+ ******************************************************************************/
+EventID PosCreateEvent(PNO pno) {
+ EventID event_id; /* Event ID */
+ char event_name[32]; /* Event name character string buffer */
+ RET_API ret_api; /* System API return value */
+
+ /* Initialization of event name character string buffer */
+ (void)memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name));
+
+ /* Event name creation */
+ snprintf(event_name, sizeof(event_name), "SENSOR_%X", pno); /* Ignore->MISRA-C++:2008 Rule 5-2-12 */
+
+ /* Event Generation */
+ event_id = _pb_CreateEvent(FALSE , 0, event_name); /* Ignore->MISRA-C++:2008 Rule 5-2-12 */
+
+ if (0 != event_id) {
+ /* For successful event generation */
+
+ /* Initialize the event */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, SENSOR_EVENT_VAL_INIT);
+ if (RET_NORMAL != ret_api) {
+ /* Event initialization failed */
+
+ /* Delete Event and Return Event Generation Failed */
+ ret_api = PosDeleteEvent(event_id);
+ event_id = 0;
+ }
+ }
+
+ return event_id;
+}
+
+/*******************************************************************************
+ * MODULE : PosDeleteEvent
+ * ABSTRACT : Event deletion processing
+ * FUNCTION : Delete events
+ * ARGUMENT : event_id : Event ID of the event to delete
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_EV_NONE : Specified event does not exist
+ ******************************************************************************/
+RET_API PosDeleteEvent(EventID event_id) {
+ return(_pb_DeleteEvent(event_id));
+}
+
+/*******************************************************************************
+ * MODULE : SensorLinkShareData
+ * ABSTRACT : Link to shared memory
+ * FUNCTION : Link to shared memory
+ * ARGUMENT : **share_top : Storage destination of shared memory top address
+ * : *share_size : Storage destination of shared memory area size
+ * : *offset : Offset storage destination to free shared memory area
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERROR : There is no shared memory area.
+ ******************************************************************************/
+RET_API SensorLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api; /* System API return value */
+ SemID sem_id; /* Semaphore ID */
+ SENSOR_SHARE *share_top_tmp;
+ int32_t i;
+
+ /* Initialization */
+ ret_api = RET_ERROR;
+
+ /* Create Semaphore */
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(SENSOR_SEMAPHO_NAME));
+ if (0 != sem_id) {
+ /* Semaphore Lock */
+ ret_api = _pb_SemLock(sem_id);
+ if (RET_NORMAL == ret_api) {
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(SENSOR_SHARE_NAME), share_top, share_size);
+ if (RET_NORMAL == ret_api) {
+ /* By searching the free shared memory area,Offset is calculated if there is free space. */
+ share_top_tmp = reinterpret_cast<SENSOR_SHARE *>(*share_top);
+
+ /* Because the first block of the shared memory area is the control area,Loop from i = 1 */
+ for (i = 1; i < SENSOR_SHARE_BLOCK_NUM; i++) {
+ if (SENSOR_SHARE_UNLOCK == share_top_tmp->mng.lock_info[i]) {
+ break;
+ }
+ }
+ if (i < SENSOR_SHARE_BLOCK_NUM) {
+ /* Empty space */
+ /* Lock the block */
+ share_top_tmp->mng.lock_info[i] = SENSOR_SHARE_LOCK;
+
+ /* Calculate the offset to the block */
+ *offset = static_cast<uint16_t>(i * SENSOR_SHARE_BLOCK_SIZE);
+
+ /* Normal completion */
+ ret_api = RET_NORMAL;
+ } else {
+ /* No free space */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Failed link to shared memory */
+ ret_api = RET_ERROR;
+ }
+ /* Semaphore unlock */
+ _pb_SemUnlock(sem_id);
+ } else {
+ /* Semaphore lock failed */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Semaphore creation failed */
+ ret_api = RET_ERROR;
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : SensorUnLinkShareData
+ * ABSTRACT : Unlinking shared memory
+ * FUNCTION : Unlink shared memory
+ * ARGUMENT : *share_top : Start address of shared memory
+ * : offset : Offset to shared memory free area
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERROR : There is no shared memory area./semaphore error
+ ******************************************************************************/
+RET_API SensorUnLinkShareData(SENSOR_SHARE *share_top, uint16_t offset) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api; /* System API return value */
+ SemID sem_id; /* Semaphore ID */
+ int32_t i;
+
+ /* Initialization */
+ ret_api = RET_ERROR;
+
+ /* Create Semaphore */
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(SENSOR_SEMAPHO_NAME));
+ if (0 != sem_id) {
+ /* Semaphore Lock */
+ ret_api = _pb_SemLock(sem_id);
+ if (RET_NORMAL == ret_api) {
+ /* Unlock the block */
+ i = static_cast<int32>(offset) / SENSOR_SHARE_BLOCK_SIZE;
+ share_top->mng.lock_info[i] = SENSOR_SHARE_UNLOCK;
+
+ /* Semaphore unlock */
+ _pb_SemUnlock(sem_id);
+
+ /* Normal completion */
+ ret_api = RET_NORMAL;
+ } else {
+ /* Semaphore lock failed */
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* Semaphore creation failed */
+ ret_api = RET_ERROR;
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : SensorSetShareData
+ * ABSTRACT : Write processing to shared memory
+ * FUNCTION : Write shared memory
+ * ARGUMENT : *share_top : Start address of shared memory
+ * : offset : Offsets to shared memory write destination
+ * : *data_src :
+ : size_src :
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void SensorSetShareData(void *share_top, uint16_t offset, const void *data_src, uint16_t size_src) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SENSOR_SHARE_BLOCK_DAT *share_dat;
+
+ /* Calculate Shared Memory Write Address */
+ share_dat = reinterpret_cast<SENSOR_SHARE_BLOCK_DAT *>(reinterpret_cast<uint8_t *>(share_top) + offset);
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+
+ /* Clear Shared Memory */
+ memset(reinterpret_cast<void *>(share_dat), 0, sizeof(SENSOR_SHARE_BLOCK_DAT));
+
+ /* Set write size to shared memory */
+ share_dat->size = size_src;
+
+ /* Set specified data in shared memory */
+ memcpy(reinterpret_cast<void *>(&share_dat->data), data_src, (size_t)size_src);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : PosSndMsg
+ * ABSTRACT : Message transmission processing
+ * FUNCTION : Send a message to the specified PNO
+ * ARGUMENT : pno_src : Source PNO
+ * : pno_dest : Destination PNO
+ * : cid : Command ID
+ * : msg_len : Message data body length
+ * : *msg_len : Pointer to message data
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERRNOTRDY : Destination process is not wakeup
+ * : RET_ERRMSGFULL : Message queue overflows
+ * : RET_ERRPARAM : Buffer size error
+ ******************************************************************************/
+RET_API PosSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data) {
+ SENSOR_INTERNAL_MSG_BUF msg_buf; /* message buffer */
+ T_APIMSG_MSGBUF_HEADER *msg_hdr; /* Pointer to the message header */
+ RET_API ret_api; /* Return value */
+ PCSTR thread_name; /* Destination thread name */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Initializing the header of the message buffer */
+ memset(reinterpret_cast<void *>(&msg_buf.hdr), 0, sizeof(T_APIMSG_MSGBUF_HEADER));
+
+ /* Get pointer to send buffer */
+ msg_hdr = reinterpret_cast<T_APIMSG_MSGBUF_HEADER *>(reinterpret_cast<void *>(&msg_buf));
+
+ /*--------------------------------------------------------------*
+ * Create message headers *
+ *--------------------------------------------------------------*/
+ msg_hdr->hdr.sndpno = pno_src; /* Source PNO */
+ msg_hdr->hdr.cid = cid; /* Command ID */
+ msg_hdr->hdr.msgbodysize = msg_len; /* Message data body length */
+
+ /*--------------------------------------------------------------*
+ * Create message data *
+ *--------------------------------------------------------------*/
+ if ((0 != msg_data) && (0 != msg_len)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Set the message data */
+ memcpy(reinterpret_cast<void *>(msg_buf.data), msg_data, (size_t)msg_len);
+ }
+ /*--------------------------------------------------------------*
+ * Send messages *
+ *--------------------------------------------------------------*/
+ /* Get Thread Name from PNO */
+ if (pno_dest <= SYS_PNO_MAX) {
+ thread_name = POS_THREAD_NAME;
+ } else {
+ thread_name = _pb_CnvPno2Name(pno_dest);
+ }
+
+ if ((pno_dest <= SYS_PNO_MAX) && (pno_src <= SYS_PNO_MAX)) {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "[LOG pno_dest = 0x%x]", pno_dest);
+
+ /* Internal Process Transmission and Reception Messages */
+ ret_api = _pb_SndMsg(pno_dest,
+ (uint16_t)(sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len),/* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ reinterpret_cast<void *>(&msg_buf), 0);
+ } else {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[LOG thread_name = %s, cid = 0x%x]", thread_name, cid);
+
+ /* External Process Transmission and Reception Messages */
+ ret_api = _pb_SndMsg_Ext(thread_name,
+ cid,
+ (uint16_t)(msg_len), /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ reinterpret_cast<void *>(&(msg_buf.data)), 0);
+ }
+ /* If RET_ERROR,Register a dialog if called from a Vehicle related thread */ /* Task_30332 */
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "[ERROR]");
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret_api);
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Sensor information acquisition
+ *
+ * Obtain sensor information
+ *
+ * @param[in] hApp HANDLE - Application handle
+ * @param[in] did DID - Data ID for vehicle information
+ * @param[in] dest_data void* - Pointer representing the storage destination of vehicle sensor information
+ * @param[in] dest_size uint16_t - Storage destination size of vehicle sensor information(byte)
+ *
+ * @return 0 or more Stored data size(Include illegal)<br>
+ * POS_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * POS_RET_ERROR_OUTOF_MEMORY Shared memory allocation failed<br>
+ * POS_RET_ERROR_SIZE Storage destination size error<br>
+ * POS_RET_ERROR_DID Unregistered ID<br>
+ * POS_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+POS_RET_API POS_GetSensData(HANDLE hApp, DID did, void *dest_data, uint16_t dest_size)
+{
+ POS_RET_API ret; /* Return value */
+ UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ BOOL ret_b;
+
+ /** NULL checking */
+ if ((hApp == NULL) || (dest_data == NULL)) {
+ /** Parameter error */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = POS_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = POS_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (ret == NAVIINFO_RET_NORMAL) {
+ /* Judge DID*/
+ ret_b = SENSOR_DID_JUDGE_GET(did);
+ if (ret_b == FALSE) {
+ /* An unacceptable ID is regarded as a parameter error. */
+ ret = POS_RET_ERROR_PARAM;
+ } else {
+ /* Data acquisition process */
+ ret = PosGetProc(did, dest_data, dest_size);
+ }
+ }
+
+ return ret;
+}
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Vehicle_API.cpp b/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Vehicle_API.cpp
new file mode 100755
index 0000000..3cd97f8
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/Vehicle_API.cpp
@@ -0,0 +1,292 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :Vehicle_API.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle I/F library
+ * Program name :Vehicle I/F API
+ * Module configuration :POS_RegisterListenerSensData() Vehicle sensor information delivery registration
+ ******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include <stdio.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include "Sensor_API_private.h"
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+#include "POS_private.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+ * initialize
+******************************************************************************/
+VEHICLE_RET_API VehicleInitialize(u_int32 (*sighand)()) { // LCOV_EXCL_START 8:dead code // NOLINT(readability/nolint)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API _CWORD64_api_ret;
+ VEHICLE_RET_API ret;
+
+ _CWORD64_api_ret = _pb_Setup_CWORD64_API(NULL);
+
+ if (_CWORD64_api_ret == RET_NORMAL) {
+ ret = RET_NORMAL;
+ } else {
+ ret = RET_ERROR;
+ }
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Vehicle sensor information delivery registration
+ * Register delivery of vehicle sensor information
+ *
+ * @param[in] hApp Application handle
+ * @param[in] notifyName Destination thread name
+ * @param[in] ulDid Pointer to an array of data IDs for vehicle information
+ * @param[in] ucCtrlFlg Delivery control<br>
+ * Delivery registration: SENSOR_DELIVERY_REGIST<br>
+ * Delivery stop: SENSOR_DELIVERY_STOP (Note: Not mounted)<br>
+ * Resume delivery: SENSOR_DELIVERY_RESTART (Note: Not mounted)
+ * @param[in] ucDeliveryTiming Delivery timing<br>
+ * Updating : SENSOR_DELIVERY_TIMING_UPDATE<br>
+ * Changing : SENSOR_DELIVERY_TIMING_CHANGE
+ *
+ * @return SENSOR_RET_NORMAL Successful registration<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_DID Unregistered ID<br>
+ * SENSOR_RET_ERROR_BUFFULL FULL of delivery registers<br>
+ * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+SENSOR_RET_API POS_RegisterListenerSensData(HANDLE hApp,
+ PCSTR notifyName, DID ulDid, u_int8 ucCtrlFlg, u_int8 ucDeliveryTiming) {
+ SENSOR_RET_API ret; /* Return value */
+ UNIT_TYPE type; /* Supported HW Configuration Type */
+ BOOL ret_b;
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Check Delivery Control Designation */
+ ret = SENSOR_RET_NORMAL;
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (SENSOR_DELIVERY_REGIST != ucCtrlFlg) {
+ /* Parameters other than delivery registration terminated abnormally. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* Check Handle */
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* Check Thread Name */
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Positioning Base API initialization */
+ _pb_Setup_CWORD64_API(hApp);
+
+ /* Supported HW Configuration Check */
+ type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == type) {
+ /* GRADE1 */
+ ret = SENSOR_RET_NORMAL;
+ } else if (UNIT_TYPE_GRADE2 == type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ } else {
+ /* Environment error */
+ ret = SENSOR_RET_ERROR_NOSUPPORT;
+ }
+ }
+
+ if (SENSOR_RET_NORMAL == ret) {
+ /* Judge DID */
+ ret_b = SENSOR_DID_JUDGE_REGLIS(ulDid);
+ if (ret_b == FALSE) {
+ /* An unacceptable ID is regarded as a parameter error. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Delivery registration process */
+ ret = PosRegisterListenerProc(notifyName, ulDid, ucCtrlFlg, ucDeliveryTiming);
+ }
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : PosSetShareData
+ * ABSTRACT : Write processing to shared memory
+ * FUNCTION : Write shared memory
+ * ARGUMENT : *share_top : Start address of shared memory
+ * : offset : Offsets to shared memory write destination
+ * : *data_src : Data
+ * : size_src : Size
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void PosSetShareData(void *share_top, u_int16 offset, const void *data_src, u_int16 size_src) {
+ VEHICLE_SHARE_BLOCK_DAT *share_dat;
+ /* Calculate Shared Memory Write Address */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top) + offset);
+
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Clear Shared Memory(Unused area) */
+ share_dat->reserve[0] = 0;
+ share_dat->reserve[1] = 0;
+
+ /* Set write size to shared memory */
+ share_dat->size = size_src;
+
+ /* Set specified data in shared memory */
+ memcpy(reinterpret_cast<void *>(share_dat->data), data_src, (size_t)size_src);
+}
+
+/*******************************************************************************
+* MODULE : VehicleGetDrData
+* ABSTRACT : DR information acquisition
+* FUNCTION : Retrieves DR information (optional data) by returning to completion.
+* ARGUMENT : pno : Thread ID
+* : did : Data ID for DR information
+* : *dest_data : Pointer to the storage destination of DR information
+* : dest_size : Storage destination size of DR information(byte)
+* NOTE :
+* RETURN : Zero or more : Stored data size
+* : VEHICLE_RET_ERROR_CREATE_EVENT : Event generation failure
+* : VEHICLE_RET_ERROR_OUTOF_MEMORY : Shared memory allocation failed
+* : VEHICLE_RET_ERROR_SIZE : Storage destination size error
+* : VEHICLE_RET_ERROR_DID : Unregistered ID
+******************************************************************************/
+int32 VehicleGetDrData(PNO pno, DID did, void *dest_data, u_int16 dest_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLE_RET_API ret; /* Return value */
+ RET_API ret_api; /* System API return value */
+ EventID event_id; /* Event ID */
+ int32 event_val; /* Event value */
+ void *share_top; /* Start address of shared memory */
+ u_int32 share_size; /* Size of shared memory area */
+ u_int16 offset; /* Offset to free shared memory area */
+ VEHICLE_SHARE_BLOCK_DAT *share_dat; /* Address of free shared memory area */
+ VEHICLE_MSG_GET_VEHICLE_DATA_DAT data; /* Message data */
+
+ /* Initialization */
+ event_id = 0;
+ event_val = 0;
+ memset(reinterpret_cast<void *>(&data), 0, sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT));
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(pno);
+
+ if (0 != event_id) {
+ /* Successful event generation */
+ /* Allocate shared memory */
+ ret_api = VehicleLinkShareData(reinterpret_cast<void **>(&share_top), &share_size, &offset);
+ if (RET_NORMAL != ret_api) {
+ /* Failed to allocate shared memory */
+ ret = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ } else {
+ /* When the shared memory is allocated successfully */
+
+ /* Calculate start address of free shared memory area */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top) + offset);
+
+ /* Send vehicle sensor information acquisition message */
+ data.did = did;
+ data.pno = pno;
+ data.offset = offset;
+ data.size = VEHICLE_SHARE_BLOCK_DSIZE;
+ data.event_id = event_id;
+ /* Messaging */
+
+ ret_api = VehicleSndMsg(pno,
+ PNO_VEHICLE_SENSOR,
+ CID_VEHICLEIF_GET_DR_DATA,
+ sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT),
+ (const void *)&data);
+
+ if (RET_NORMAL == ret_api) {
+ /* Message transmission processing is successful */
+ /* Wait for completion event from vehicle sensor thread */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN, VEHICLE_RET_NORMAL, &event_val, INFINITE);
+ if (RET_NORMAL != ret_api) {
+ /* When not put in event wait state */
+ /* Return an event generation failure */
+ ret = VEHICLE_RET_ERROR_CREATE_EVENT;
+ } else {
+ /* Return from Event Wait */
+
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME), &share_top, &share_size);
+
+ /* Calculate the address of the shared memory storage area. */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top)
+ + offset);
+
+ if (event_val < 0) {
+ /* Vehicle sensor information acquisition failure */
+ ret = (VEHICLE_RET_API)event_val;
+ } else if (RET_NORMAL != ret_api) {
+ /* Shared memory error */
+ ret = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ } else if (dest_size < share_dat->size) {
+ /* Storage destination size error */
+ ret = VEHICLE_RET_ERROR_SIZE;
+ } else {
+ /* Vehicle sensor information acquisition success */
+
+ /* Copy from shared memory to user memory */
+ memcpy(dest_data, share_dat->data, (size_t)share_dat->size);
+
+ /* Set Write Size to Return Value */
+ ret = static_cast<int32>(share_dat->size);
+ }
+ }
+ } else {
+ /* Message transmission processing failed */
+ /* Return an event generation failure */
+ ret = VEHICLE_RET_ERROR_CREATE_EVENT;
+ }
+ /* Free shared memory */
+ (void)VehicleUnLinkShareData(reinterpret_cast<VEHICLE_SHARE*>(share_top), offset);
+ }
+
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+
+ } else {
+ /* Event generation failure */
+ ret = VEHICLE_RET_ERROR_CREATE_EVENT;
+ }
+ return ret;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver b/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver
new file mode 100755
index 0000000..10fd95b
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libPOS_sensor_API version script
+#
+{
+ global:
+ POS_GetSensData;
+ POS_RegisterListenerPkgSensData;
+ POS_RegisterListenerSensData;
+ *PosSndMsg*;
+ *PosCreateEvent*;
+ *PosDeleteEvent*;
+ *PosSetShareData*;
+ local:
+ *;
+};
+
diff --git a/video_in_hal/vehicleservice/positioning/server/Makefile b/video_in_hal/vehicleservice/positioning/server/Makefile
new file mode 100755
index 0000000..6ef1082
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/Makefile
@@ -0,0 +1,22 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### subdirectories #########
+SUBDIRS += src/Sensor
+SUBDIRS += src/ServiceInterface
+SUBDIRS += src/nsfw
+
+include ../../vehicle_service.mk
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockDataMng.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockDataMng.h
new file mode 100755
index 0000000..69a96c2
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockDataMng.h
@@ -0,0 +1,100 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/******************************************************************************
+ * File name : ClockDataMng.h
+ * System name : PastModel002
+ * Subsystem name : Time-related processing
+ ******************************************************************************/
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKDATAMNG_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKDATAMNG_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+
+#include "positioning_hal.h"
+#include "CanInput_API.h"
+#include "Sensor_API.h"
+
+/********************************************************************************
+* Macro definitions *
+*********************************************************************************/
+#define CLOCKDATAMNG_SECONDS_PAR_WEEK (7 * 24 * 60 * 60)
+#define CLOCKDATAMNG_CNV_WEEK2SEC(WEEK) ((WEEK)* CLOCKDATAMNG_SECONDS_PAR_WEEK)
+
+/* [PastModel002 Specifications]Time difference tolerance(plus or minus 512 week or less,GPS TIME range from 0 to 1023 week) */
+#define CLOCKDATAMNG_TIME_DIFF_LIMIT_UPPER (512 * CLOCKDATAMNG_SECONDS_PAR_WEEK)
+#define CLOCKDATAMNG_TIME_DIFF_LIMIT_LOWER (-512 * CLOCKDATAMNG_SECONDS_PAR_WEEK)
+
+/* [PastModel002 Specifications]Time difference addition value(+1024week,GPS TIME range from 0 to 1023 week) */
+#define CLOCKDATAMNG_TIME_DIFF_ADD_VALUE (CLOCKDATAMNG_TIME_DIFF_LIMIT_UPPER * 2)
+
+/* [PastModel002 Specifications]GPS TIME weekNo scope */
+#define CLOCKDATAMNG_GPS_TIME_WEEKNO_LIMIT 1024
+
+/* [PastModel002 Specifications]Initial value of time difference information at the previous shutdown */
+#define CLOCKDATAMNG_TIME_DIFF_INIT_VALUE 0x7FFFFFFFL
+
+/* [PastModel002 Specifications]AID-INI lifetime(+4Time) */
+#define CLOCKDATAMNG_AID_INI_EFFECTIVE_TIME (4 * 60 * 60)
+
+/* [PastModel002 Specifications]AID-EPH lifetime(plus or minus 2 hours) */
+#define CLOCKDATAMNG_AID_EPH_EFFECTIVE_TIME (2 * 60 * 60)
+
+#define MUTEX_CLOCKDATAMNG __TEXT("MUTEX_VEHICLE_CLOCKDATAMNG")
+
+/********************************************************************************
+* Struct definitions *
+*********************************************************************************/
+/********************************************************************************
+ * TAG :CLOCKDATAMNG_GPS_TIME
+ * ABSTRACT :GPS time structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct {
+ u_int32 tow; /* Time of week (msec) */
+ int16 week_no; /* GPS Week No. */
+ u_int8 reserve[2]; /* reserve */
+ BOOL validity_flag; /* Enabled/DisabledFlagging */
+} CLOCKDATAMNG_GPS_TIME;
+
+/********************************************************************************
+* Function prototype *
+*********************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ BOOL ClockDataMngInitialize(void);
+ void ClockDataMngSetLastTimeDiff(int32 time_diff);
+
+ void ClockDataMngSetGpsTime(const SENSOR_MSG_GPSDATA_DAT *gps_time_data);
+ void ClockDataMngGetGpsTime(CLOCKDATAMNG_GPS_TIME *gps_time_data);
+
+ BOOL ClockDataMngGetLocalTime(const CANINPUT_MSG_LOCALTIMEINFO_DAT *can_local_time, LOCALTIME *vehicle_local_time);
+ BOOL ClockDataMngGetTimeDiff(LOCALTIME *local_time, int32 *time_diff);
+
+ void ClockDataMngGetStartupTime(CLOCKDATAMNG_GPS_TIME *start_up_time);
+ int32 ClockDataMngCalculateTimeDiff(int32 munuend, int32 subtrahend);
+
+ BOOL ClockDataMngCheckLocalTime(LOCALTIME *local_time);
+ int32 ClockDataMngConversionLocalTime2GpsTime(LOCALTIME *local_time, BOOL calc_second_available);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKDATAMNG_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockGPS_Process_Proto.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockGPS_Process_Proto.h
new file mode 100755
index 0000000..5f20c33
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockGPS_Process_Proto.h
@@ -0,0 +1,37 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * FILE : ClockGPS_Process_Proto.h
+ * SYSTEM : _CWORD107_
+ * SUBSYSTEM: ClockGPS thread
+ * TITLE : Header for publication in a process (EXL)
+ ******************************************************************************/
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKGPS_PROCESS_PROTO_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKGPS_PROCESS_PROTO_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+EFrameworkunifiedStatus ClockGPSThread(HANDLE h_app);
+int TimerSramInit(int); /* Baackup data check/initialization function */ /* Ignore->MISRA-C++:2008 Rule 3-9-2 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKGPS_PROCESS_PROTO_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockUtility.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockUtility.h
new file mode 100755
index 0000000..8924975
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockUtility.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file ClockUtility.h
+@detail Common processing function header file concerning clock
+*****************************************************************************/
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_H_
+
+#include <vehicle_service/positioning_base_library.h>
+#include "Clock_API.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ Function prototype declaration
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+ RET_API ClockUtilityConvertDateToSecond(const LPSYSTEMTIME lp_st, u_int32* uli_sec);
+ RET_API ClockUtilityConvertSecondToDate(const u_int32* uli_sec, LPSYSTEMTIME lp_st);
+
+ /* Converting TimeData Types to SYSTEMTIME Types Functions */
+ CLOCK_RETURN ClockApiConvertTimeDataToSYSTEMTIME(const TimeData* base_time,
+ SYSTEMTIME* result_time);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockUtility_private.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockUtility_private.h
new file mode 100755
index 0000000..8c322ae
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/ClockUtility_private.h
@@ -0,0 +1,49 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file ClockUtility_private.h
+@detail Common processing function private header file concerning clock
+*****************************************************************************/
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_PRIVATE_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_PRIVATE_H_
+
+#include "CommonDefine.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ Macro definitions
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define MONTH_MAX (12U) /* Maximum value of month */
+
+ /*
+ Data typing
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ /* Time parameter */
+ typedef struct ClockDayCnvTblTag {
+ YearCntTbl st_tbl[CNV_YEAR_MAX + 1 ]; /* Have +1 data for end determination */
+ } ClockDayCntTbl;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_CLOCKUTILITY_PRIVATE_H_
+
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_Common.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_Common.h
new file mode 100755
index 0000000..1c6e060
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_Common.h
@@ -0,0 +1,84 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_COMMON_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_COMMON_H_
+/****************************************************************************
+ * File name :DeadReckoning_Common.h
+ * System name :PastModel002
+ * Subsystem name :
+ ****************************************************************************/
+
+#include "Dead_Reckoning_Local_Api.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define DEADRECKONING_ZERO 0
+#define DEADRECKONING_BIT0 0x00000001
+#define DEADRECKONING_BIT1 0x00000002
+#define DEADRECKONING_BIT2 0x00000004
+#define DEADRECKONING_BIT3 0x00000008
+#define DEADRECKONING_BIT4 0x00000010
+#define DEADRECKONING_BIT5 0x00000020
+#define DEADRECKONING_BIT6 0x00000040
+#define DEADRECKONING_BIT7 0x00000080
+#define DEADRECKONING_BIT29 0x20000000
+#define DEADRECKONING_BIT30 0x40000000
+#define DEADRECKONING_BIT31 0x80000000
+#define DEADRECKONING_NEQ 1
+#define DEADRECKONING_EQ 0
+#define DEADRECKONING_INVALID 0
+#define DEADRECKONING_EFFECTIVE 1
+#define DEADRECKONING_CHGTYPE_NCHG DEADRECKONING_EQ
+#define DEADRECKONING_CHGTYPE_CHG DEADRECKONING_NEQ
+#define DEADRECKONING_GETMETHOD_DR 4 /* Data collection way: DR */
+
+/* Offset value of normal data of vehicle sensor */
+#define DEADRECKONING_OFFSET_NORMAL 4
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+
+/* Data Master Set Notification Function */
+typedef void (*PFUNC_DR_DMASTER_SET_N) (DID, u_int8, u_int8);
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+/*********************************************************************
+* TAG : DEADRECKONING_DID_OFFSET_TBL
+* ABSTRACT : Vehicle sensor data ID,Structure of each data in the offset table
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_offset; /* Offset value */
+ u_int8 uc_reserve[2]; /* Reserved */
+} DEADRECKONING_DID_OFFSET_TBL;
+
+/*********************************************************************
+* TAG :
+* ABSTRACT :
+***********************************************************************/
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+u_int8 DeadReckoningMemcmp(const void *, const void *, size_t);
+int32 DeadReckoningCheckDid(DID);
+u_int16 DeadReckoningGetDataMasterOffset(DID);
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_COMMON_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DataMaster.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DataMaster.h
new file mode 100755
index 0000000..00c056a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DataMaster.h
@@ -0,0 +1,127 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DATAMASTER_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DATAMASTER_H_
+/****************************************************************************
+ * File name :DeadReckoning_DataMaster.h
+ * System name :PastModel002
+ * Subsystem name :DeadReckoning processes
+ ****************************************************************************/
+
+#include "DeadReckoning_Common.h"
+#include "Dead_Reckoning_Local_Api.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/* Initial value */
+#define VEHICLE_DINIT_LONGITUDE 0x00
+#define VEHICLE_DINIT_LATITUDE 0x00
+#define VEHICLE_DINIT_ALTITUDE 0x00
+#define VEHICLE_DINIT_SPEED 0x00
+#define VEHICLE_DINIT_HEADING 0x00
+#define VEHICLE_DINIT_DR_SNS_COUNTER 0x00
+#define VEHICLE_DINIT_GYRO_OFFSET 0x0000
+#define VEHICLE_DINIT_GYRO_SCALE_FACTOR 0x00
+#define VEHICLE_DINIT_GYRO_SCALE_FACTOR_LEVEL 0x00
+#define VEHICLE_DINIT_SPEED_PULSE_SCALE_FACTOR 0x0000
+#define VEHICLE_DINIT_SPEED_PULSE_SCALE_FACTOR_LEVEL 0x00
+
+#define VEHICLE_DSIZE_LONGITUDE 0x04
+#define VEHICLE_DSIZE_LATITUDE 0x04
+#define VEHICLE_DSIZE_ALTITUDE 0x04
+#define VEHICLE_DSIZE_SPEED 0x02
+#define VEHICLE_DSIZE_HEADING 0x02
+#define VEHICLE_DSIZE_DR_SNS_COUNTER 0x01
+#define VEHICLE_DSIZE_GYRO_OFFSET 0x02
+#define VEHICLE_DSIZE_GYRO_SCALE_FACTOR 0x01
+#define VEHICLE_DSIZE_GYRO_SCALE_FACTOR_LEVEL 0x01
+#define VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR 0x02
+#define VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR_LEVEL 0x01
+
+/* Data received*/
+#define DEADRECKONING_RCVFLAG_ON 0x01
+#define DEADRECKONING_RCVFLAG_OFF 0x00
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/*********************************************************************
+* TAG : DEADRECKONING_DATA_MASTER
+* ABSTRACT : Vehicle SW Data Master Structure
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcv_flag; /* Receive flag */
+ u_int8 dr_status; /* DR status */
+ u_int8 uc_data[4]; /* Vehicle DR data */
+} DEADRECKONING_DATA_MASTER;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void DeadReckoningInitDataMaster(void);
+void DeadReckoningSetDataMaster(const DEADRECKONING_DATA_MASTER *, PFUNC_DR_DMASTER_SET_N);
+void DeadReckoningGetDataMaster(DID ul_did, DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitLongitudeDr(void);
+u_int8 DeadReckoningSetLongitudeDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetLongitudeDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitLatitudeDr(void);
+u_int8 DeadReckoningSetLatitudeDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetLatitudeDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitAltitudeDr(void);
+u_int8 DeadReckoningSetAltitudeDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetAltitudeDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitSpeedDr(void);
+u_int8 DeadReckoningSetSpeedDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetSpeedDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitHeadingDr(void);
+u_int8 DeadReckoningSetHeadingDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetHeadingDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitSnsCounterDr(void);
+u_int8 DeadReckoningSetSnsCounterDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetSnsCounterDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitGyroOffsetDr(void);
+u_int8 DeadReckoningSetGyroOffsetDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetGyroOffsetDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitGyroScaleFactorDr(void);
+u_int8 DeadReckoningSetGyroScaleFactorDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetGyroScaleFactorDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitGyroScaleFactorLevelDr(void);
+u_int8 DeadReckoningSetGyroScaleFactorLevelDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetGyroScaleFactorLevelDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitSpeedPulseScaleFactorDr(void);
+u_int8 DeadReckoningSetSpeedPulseScaleFactorDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetSpeedPulseScaleFactorDr(DEADRECKONING_DATA_MASTER *);
+
+void DeadReckoningInitSpeedPulseScaleFactorLevelDr(void);
+u_int8 DeadReckoningSetSpeedPulseScaleFactorLevelDr(const DEADRECKONING_DATA_MASTER *);
+void DeadReckoningGetSpeedPulseScaleFactorLevelDr(DEADRECKONING_DATA_MASTER *);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DATAMASTER_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DeliveryCtrl.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DeliveryCtrl.h
new file mode 100755
index 0000000..a555a47
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_DeliveryCtrl.h
@@ -0,0 +1,137 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DELIVERYCTRL_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DELIVERYCTRL_H_
+/******************************************************************************
+ * File name :DeadReckoning_DeliveryCtrl.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+#include "DeadReckoning_DataMaster.h"
+#include "Dead_Reckoning_Local_Api.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define DEADRECKONING_SIGNAL 6 /* Number of vehicle signals */
+#define DEADRECKONING_DELIVERY 10 /* Number of delivery destinations */
+/* Vehicle sensor information */
+#define DEADRECKONING_DELIVERY_INFO (DEADRECKONING_SIGNAL)
+/* Maximum number of vehicle sensor information */
+#define DEADRECKONING_DELIVERY_INFO_MAX (DEADRECKONING_DELIVERY_INFO * DEADRECKONING_DELIVERY)
+/* Vehicle Sensor Information Valid Number */
+#define DEADRECKONING_DID_EFFECTIVE (DEADRECKONING_SIGNAL)
+#define DEADRECKONING_ACTION_TYPE_ADD 0 /* Vehicle sensor addition processing */
+#define DEADRECKONING_ACTION_TYPE_UPDATE 1 /* Vehicle sensor update processing */
+
+#define DEADRECKONING_LINK_INDEX_END 0xFFFF /* End of the link index */
+
+#define DEADRECKONING_DELIVERY_METHOD_NORMAL 0 /* Delivery system normal delivery */
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/*********************************************************************
+* TAG :DEADRECKONING_DELIVERY_CTRL_TBL_DATA
+* ABSTRACT : Structure of each data of the vehicle sensor delivery destination management table
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ PNO us_pno; /* Shipping PID */
+ u_int8 uc_chg_type; /* Delivery timing */
+ u_int8 uc_ctrl_flg; /* Delivery operation */
+ u_int16 us_link_idx; /* Link index */
+ u_int8 uc_method; /* Delivery system */
+ u_int8 uc_reserve; /* reserve */
+} DEADRECKONING_DELIVERY_CTRL_TBL_DATA;
+
+/*********************************************************************
+* TAG : DEADRECKONING_DELIVERY_CTRL_TBL
+* ABSTRACT : Vehicle Sensor Delivery Destination Management Table Structure
+***********************************************************************/
+typedef struct {
+ u_int16 us_num; /* Number of delivery destination management data items */
+ u_int8 uc_reserve[2]; /* Reserved */
+ /* Array of each data */
+ DEADRECKONING_DELIVERY_CTRL_TBL_DATA st_ctrl_data[DEADRECKONING_DELIVERY_INFO_MAX];
+} DEADRECKONING_DELIVERY_CTRL_TBL;
+
+/*********************************************************************
+* TAG : DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA
+* ABSTRACT : Structure of each data of Vehicle Sensor Destination Management Table Management
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_start_idx; /* Start index */
+ u_int16 us_end_idx; /* End index */
+ u_int16 us_dlvry_entry_num; /* Number of registered shipping addresses */
+ u_int8 uc_reserve[2]; /* Reserved */
+} DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA;
+
+/*********************************************************************
+* TAG : DEADRECKONING_DELIVERY_CTRL_TBL_MNG
+* ABSTRACT : Structure of Vehicle Sensor Delivery Destination Management Table Management
+***********************************************************************/
+typedef struct {
+ u_int16 us_num; /* Number of data items */
+ u_int8 uc_reserve[2]; /* Reserved */
+ /* Array of each data */
+ DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA st_ctrl_tbl_mng_data[DEADRECKONING_DELIVERY_INFO];
+} DEADRECKONING_DELIVERY_CTRL_TBL_MNG;
+
+/*********************************************************************
+* TAG : DEADRECKONING_DELIVERY_PNO_TBL
+* ABSTRACT : Vehicle Sensor Destination PNO Table
+***********************************************************************/
+typedef struct {
+ PNO us_pno; /* Thread ID */
+ u_int16 us_index; /* Appropriate INDEX in the delivery control table */
+ u_int8 uc_method; /* Delivery system */
+ u_int8 uc_reserve[3]; /* reserve */
+} DEADRECKONING_DELIVERY_PNO_TBL_DAT;
+
+typedef struct {
+ u_int16 us_num; /* Number of data items */
+ u_int8 uc_reserve[2]; /* reserve */
+ DEADRECKONING_DELIVERY_PNO_TBL_DAT st_pno_data[DEADRECKONING_DELIVERY_INFO_MAX];
+} DEADRECKONING_DELIVERY_PNO_TBL;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+
+DEADRECKONING_DELIVERY_PNO_TBL* DeadReckoningMakeDeliveryPnoTbl(DID ul_did, u_int8 change_type);
+
+DEAD_RECKONING_RET_API DeadReckoningEntryDeliveryCtrl(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+
+void DeadReckoningInitDeliveryCtrlTbl(void);
+void DeadReckoningInitDeliveryCtrlTblMng(void);
+
+void DeadReckoningAddDeliveryCtrlTbl(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+void DeadReckoningUpdateDeliveryCtrlTbl(DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *);
+void DeadReckoningAddDeliveryCtrlTblMng(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+void DeadReckoningUpdateDeliveryCtrlTblMng(DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *);
+
+void DeadReckoningAddPnoTbl(u_int16);
+void DeadReckoningDeliveryProc(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method);
+void DeadReckoningFirstDelivery(PNO us_pno, DID ul_did);
+
+RET_API DRManagerSndMsg(PNO us_pno_src, PNO us_pno_dest, CID us_cid, u_int16 us_msg_len, const void *p_msg_data);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_DELIVERYCTRL_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_main.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_main.h
new file mode 100755
index 0000000..3e2e9d4
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/DeadReckoning_main.h
@@ -0,0 +1,146 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_MAIN_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_MAIN_H_
+/****************************************************************************
+ * File name :DeadReckoning_main.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+
+#include "Sensor_Common_API.h"
+
+#include "Dead_Reckoning_API.h"
+#include "Dead_Reckoning_Local_Api.h"
+#include "DeadReckoning_Common.h"
+#include "DeadReckoning_DataMaster.h"
+#include "DeadReckoning_DeliveryCtrl.h"
+
+#include "Sensor_API.h"
+#include "VehicleSens_DeliveryCtrl.h"
+#include "VehicleDebug_API.h"
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/* Return value */
+#define RET_SWMNG_SUCCESS RET_NORMAL /* Success of API processing */
+#define RET_SWMNG_ERROR RET_ERROR /* API processing failed */
+
+/*** Rcv Message Relationships ***************************************************/
+/* Size of data section */
+#define DEAD_RECKONING_RCVMSG_MSGBUF 512 /* RcvMSG Byte count in data section */
+#define DEAD_RECKONING_RCVDATA_SENSOR_MSGBUF 40 /* RcvMSG Byte count of Sensor data section */
+#define DEAD_RECKONING_RCVDATA_SENSOR_FIRST_MSGBUF 1000 /* RcvMSG Initial Byte count of sensor data section */
+#define DEAD_RECKONING_SENSOR_FIRST_NUM 175 /* Initial number of saved sensor data */
+
+/* Event initial value */
+/* DR_API_private. Synchronize with DR_EVENT_VAL_INIT in h */
+#define DR_EVENT_VAL_INIT (-101)
+
+/* Event initial value */
+/* DeadReckoning_main. Synchronize with h's VEHICELEDEBUG_EVENT_VAL_INIT */
+#define VEHICLEDEBUG_EVENT_VAL_INIT (-101)
+
+/* PastModel002 sleep time[ms] for CPU load balancing in the first sensor data processing */
+#define DR_FST_SENS_CALC_SLEEP_TIME 15
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/*********************************************************************
+* TAG : DEAD_RECKONING_RCVDATA
+* ABSTRACT : Message receive buffer structure
+***********************************************************************/
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER hdr;
+ u_int8 data[DEAD_RECKONING_RCVMSG_MSGBUF]; /* Data portion */
+} DEAD_RECKONING_RCVDATA;
+
+/*********************************************************************
+* TAG : DEAD_RECKONING_RCVDATA_SENSOR
+* ABSTRACT : LineSensor Vehicle Signal Notification Message Structure
+***********************************************************************/
+typedef struct {
+ u_int32 did; /* Data ID */
+ u_int8 size; /* Size of the data */
+ u_int8 reserve[3]; /* Reserved */
+ u_int8 data[DEAD_RECKONING_RCVDATA_SENSOR_MSGBUF]; /* Data content */
+} DEAD_RECKONING_RCVDATA_SENSOR;
+
+/*********************************************************************
+* TAG : DEAD_RECKONING_RCVDATA_SENSOR_FIRST
+* ABSTRACT : LineSensor Vehicle Signal Notification Message Structure
+***********************************************************************/
+typedef struct {
+ u_int32 did; /* Data ID */
+ u_int16 size; /* Size of the data */
+ u_int8 reserve[1]; /* Reserved */
+ u_int8 num; /* Number of data */
+ u_int8 data[DEAD_RECKONING_RCVDATA_SENSOR_FIRST_MSGBUF]; /* Data content */
+} DEAD_RECKONING_RCVDATA_SENSOR_FIRST;
+
+/*********************************************************************
+* TAG : DEAD_RECKONING_SAVEDATA_SENSOR_FIRST
+* ABSTRACT : LineSensor Vehicle Signal-Storage Message Structures
+***********************************************************************/
+typedef struct {
+ u_int16 gyro_x_data[DEAD_RECKONING_SENSOR_FIRST_NUM * NUM_OF_100msData]; /* Data content */
+ u_int16 gyro_y_data[DEAD_RECKONING_SENSOR_FIRST_NUM * NUM_OF_100msData]; /* Data content */
+ u_int16 gyro_z_data[DEAD_RECKONING_SENSOR_FIRST_NUM * NUM_OF_100msData]; /* Data content */
+ u_int16 spd_pulse_data[DEAD_RECKONING_SENSOR_FIRST_NUM]; /* Data content */
+ u_int8 spd_pulse_check_data[DEAD_RECKONING_SENSOR_FIRST_NUM]; /* Data content */
+ u_int8 rev_data[DEAD_RECKONING_SENSOR_FIRST_NUM]; /* Data content */
+ u_int8 data_num; /* Number of data */
+ u_int8 reserve[3]; /* reserve */
+ u_int16 gyro_x_rcv_size; /* Receiving Size */
+ u_int16 gyro_y_rcv_size; /* Receiving Size */
+ u_int16 gyro_z_rcv_size; /* Receiving Size */
+ u_int16 spd_pulse_rcv_size; /* Receiving Size */
+ u_int16 spd_pulse_check_rcv_size; /* Receiving Size */
+ u_int16 rev_rcv_size; /* Receiving Size */
+} DEAD_RECKONING_SAVEDATA_SENSOR_FIRST;
+
+/*********************************************************************
+* TAG : DEAD_RECKONING_LONLAT_INFO
+* ABSTRACT : Get Position Information Structure
+***********************************************************************/
+typedef struct {
+ u_int8 calc_called; /* Whether Calculate_DeadReckoningData was called */
+ u_int8 available;
+ u_int8 reserve[2];
+ LONLAT lonlat;
+} DEAD_RECKONING_LONLAT_INFO;
+
+/************************************************************************
+* DeadReckoning_main function prototype *
+************************************************************************/
+
+void DeadReckoningRcvMsg(const DEAD_RECKONING_RCVDATA *msg, DEAD_RECKONING_LONLAT_INFO *location_info);
+void DeadReckoningRcvMsgFstSens(const DEAD_RECKONING_RCVDATA *msg, DEAD_RECKONING_LONLAT_INFO *location_info,
+ const SENSOR_MSG_GPSDATA_DAT *rcv_gps_msg, Struct_GpsData* send_gps_msg,
+ Struct_SensData* send_sensor_msg);
+int32 DeadReckoningInit(void);
+void DeadReckoningGetDRData(const DEADRECKONING_MSG_GET_DR_DATA *msg);
+void DeadReckoningSetMapMatchingData(const DR_MSG_MAP_MATCHING_DATA *msg);
+void DeadReckoningClearBackupData(const DR_MSG_CLEAR_BACKUP_DATA *msg);
+void DeadReckoningGetLocationLogStatus(PNO pno);
+void DeadReckoningSetLocationLogStatus(BOOL log_sw, u_int8 severity);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_MAIN_H_ */
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/GpsInt.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/GpsInt.h
new file mode 100755
index 0000000..fbb69de
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/GpsInt.h
@@ -0,0 +1,68 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*****************************************************************************************
+* File name :GpsInt.h
+* System name :PastModel002
+* Process name :Vehicle
+* Overview :GPS interrupt thread header
+******************************************************************************************/
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_GPSINT_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_GPSINT_H_
+
+/*******************************************************************************
+* Include File
+*******************************************************************************/
+
+/*******************************************************************************
+* Define
+*******************************************************************************/
+#define GPS_IRQ_ADR 0x00000306UL /* GPS IRQ addresses */
+#define GPS_MASK_6BIT 0x00000040UL /* GPS IRQ bit-mask position */
+
+#define GPS_GPIO0_IRQSTATUS_0_OFFSET 0x0000002CUL /* IRQSTATUS_0 offset */
+#define GPS_GPIO0_IRQSTATUS_SET_0_OFFSET 0x00000034UL /* IRQSTATUS_SET_0 offset */
+#define GPS_GPIO0_RISINGDETECT_OFFSET 0x00000148UL /* RISINGDETECT offsets */
+
+/* IRQSTATUS_0 address */
+#define GPS_GPIO0_IRQSTATUS_0_ADDR (DM816X_GPIO0_BASE + GPS_GPIO0_IRQSTATUS_0_OFFSET)
+
+/* IRQSTATUS_SET_0 address */
+#define GPS_GPIO0_IRQSTATUS_SET_0_ADDR (DM816X_GPIO0_BASE + GPS_GPIO0_IRQSTATUS_SET_0_OFFSET)
+
+/* RISINGDETECT addresses */
+#define GPS_GPIO0_RISINGDETECT_ADDR (DM816X_GPIO0_BASE + GPS_GPIO0_RISINGDETECT_OFFSET)
+
+/*******************************************************************************
+* Struct
+*******************************************************************************/
+typedef struct {
+ DWORD irq_status_reg; /* Interrupt Source Clear Register */
+ DWORD irq_status_set_reg; /* Interrupt enable register */
+ DWORD rising_detect_reg; /* Rising edge detection setting register */
+} GPS_INT_DATA;
+
+/***************************
+* Function prototype declaration
+***************************/
+RET_API DEVGpsIntInitial(void);
+BOOL DEVGpsIntMapDevice(void);
+void DEVGpsIntUnMapDevice(void);
+void DEVGpsIntSetInterupt(void);
+void DEVGpsIntIntRegClear(void);
+RET_API DEVGpsIntSndMsg(void);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_GPSINT_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/SensorLog.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/SensorLog.h
new file mode 100755
index 0000000..9b6a49a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/SensorLog.h
@@ -0,0 +1,114 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * SensorLog.h
+ * @brief
+ * Definition for Sensor Logging I/F Liblary
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_SENSORLOG_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_SENSORLOG_H_
+
+#include <stdint.h>
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_define.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* NAV-SVINFO sizes(chnum=20) */
+#define SENSLOG_GPS_SIZE_NAVSVINFO 248
+
+/* Sensor log data type */
+typedef enum {
+ SENSLOG_DATA_I_UNSPECIFIED = 0, /* Input:Not specified */
+
+ SENSLOG_DATA_I_SYS, /* Input:Sensor */
+ SENSLOG_DATA_I_SYS_STS, /* Input:External terminal status */
+ SENSLOG_DATA_I_GPS, /* Input:GPS(_CWORD82_/u-blox) */
+ SENSLOG_DATA_I_LOC, /* Input:Location information */
+ SENSLOG_DATA_I_SPEED, /* Input:Vehicle speed */
+ SENSLOG_DATA_I_TIME, /* Input:Request to set GPS time */
+ SENSLOG_DATA_I_GPSINF, /* Input:GPS information setting request */
+ SENSLOG_DATA_I_GPSRST, /* Input:GPS reset request */
+ SENSLOG_DATA_I_GPSSET, /* Input:GPS setting request */
+ SENSLOG_DATA_I_NAVSVINFO, /* Input:NAV-SVINFO(u-blox)*/
+ SENSLOG_DATA_I_SYS_ABNORMAL, /* Input:Sensor(When an error occurs) */
+ SENSLOG_DATA_I_COUNT /* Classified number */
+} SENSLOG_DATA_I;
+
+typedef enum {
+ SENSLOG_DATA_O_UNSPECIFIED = 0, /* Output:Not specified */
+
+ SENSLOG_DATA_O_SYS, /* Output:Sensor */
+ SENSLOG_DATA_O_SYS_PKG, /* Output:Sensor(PKG) */
+ SENSLOG_DATA_O_GPS, /* Output:GPS(_CWORD82_/u-blox) */
+ SENSLOG_DATA_O_LONLAT_N, /* Output:Latitude and longitude(NAVI) */
+ SENSLOG_DATA_O_LONLAT_G, /* Output:Latitude and longitude(GPS) */
+ SENSLOG_DATA_O_ALT, /* Output:Altitude */
+ SENSLOG_DATA_O_SPEED_N, /* Output:Vehicle speed(NAVI) */
+ SENSLOG_DATA_O_SPEED_P, /* Output:Vehicle speed(POS) */
+ SENSLOG_DATA_O_HEAD_N, /* Output:Orientation(NAVI) */
+ SENSLOG_DATA_O_HEAD_G, /* Output:Orientation(GPS) */
+ SENSLOG_DATA_O_TIME_SETREQ, /* Output:GPS time delivery request */
+ SENSLOG_DATA_O_TIME, /* Output:GPS time */
+ SENSLOG_DATA_O_GPSINF, /* Output:GPS information */
+ SENSLOG_DATA_O_TIME_CS, /* Output:GPS time(For the ClockService) */
+ SENSLOG_DATA_O_GPSRST, /* Output:GPS reset response */
+
+ SENSLOG_DATA_O_COUNT /* Classified number */
+} SENSLOG_DATA_O;
+
+/* Send/Receive result */
+#define SENSLOG_RES_SUCCESS 0 /* Send/Receive Success */
+#define SENSLOG_RES_FAIL 1 /* Send/Receive Abnormality */
+
+/* Destination name(Internal use) */
+#define SENSLOG_PNAME_CLOCK "*Clock" /* Clock Service */
+#define SENSLOG_PNAME_COMMUSB "*CommUSB" /* CommUSB */
+
+#define SENSLOG_ON 1
+#define SENSLOG_OFF 0
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+/* SensorLog public API */
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void SensLogInitialize(uint8_t *p_mount_path);
+ uint8_t SensLogGetNavSvinfoFlag(void);
+ void SensLogWriteInputData(uint16_t us_data_type, DID ul_did, PNO us_pno, uint8_t *p_data, \
+ uint16_t us_size, uint8_t uc_result, uint8_t u_write_flag, uint8_t u_write_abnormal_flag);
+ void SensLogWriteOutputData(uint16_t us_data_type, DID ul_did, PNO us_pno, uint8_t *p_data, \
+ uint16_t us_size, uint8_t uc_result);
+ void SensLogTerminate(void);
+ void SensLogStore(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_SENSORLOG_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_Common.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_Common.h
new file mode 100755
index 0000000..7b47268
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_Common.h
@@ -0,0 +1,131 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_COMMON_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_COMMON_H_
+/****************************************************************************
+ * File name :VehicleSens_Common.h
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ ****************************************************************************/
+
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+
+#include "positioning_hal.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define VEHICLESENS_ZERO 0
+#define VEHICLESENS_BIT0 0x00000001
+#define VEHICLESENS_BIT1 0x00000002
+#define VEHICLESENS_BIT2 0x00000004
+#define VEHICLESENS_BIT3 0x00000008
+#define VEHICLESENS_BIT4 0x00000010
+#define VEHICLESENS_BIT5 0x00000020
+#define VEHICLESENS_BIT6 0x00000040
+#define VEHICLESENS_BIT7 0x00000080
+#define VEHICLESENS_BIT29 0x20000000
+#define VEHICLESENS_BIT30 0x40000000
+#define VEHICLESENS_BIT31 0x80000000
+#define VEHICLESENS_NEQ 1
+#define VEHICLESENS_EQ 0
+#define VEHICLESENS_INVALID 0
+#define VEHICLESENS_EFFECTIVE 1
+#define VEHICLESENS_CHGTYPE_NCHG VEHICLESENS_EQ
+#define VEHICLESENS_CHGTYPE_CHG VEHICLESENS_NEQ
+#define VEHICLESENS_GETMETHOD_CAN 0 /* Data collection way: CAN communication */
+#define VEHICLESENS_GETMETHOD_LINE 1 /* Data collection way: LineSensor drivers */
+#define VEHICLESENS_GETMETHOD_NO_DETECTION 2 /* Data collection way: Not downloaded */
+#define VEHICLESENS_GETMETHOD_GPS 3 /* Data collection way: GPS */
+#define VEHICLESENS_GETMETHOD_NAVI 4 /* Data collection way: NAVI */
+#define VEHICLESENS_GETMETHOD_CLOCK 5 /* Data collection way: Clock Information */
+#define VEHICLESENS_GETMETHOD_INTERNAL 6 /* Data collection way: Internal calculation */
+#define VEHICLESENS_GETMETHOD_OTHER 7 /* Data collection way: Others */
+
+/* Offset value of normal data of vehicle sensor */
+#define VEHICLESENS_OFFSET_NORMAL 32
+/* Offset value of normal data of vehicle sensor */
+#define VEHICLESENS_OFFSET_GPS_FORMAT 268 /* 8 + 260 */
+/* Offset value of normal data of vehicle sensor */
+#define VEHICLESENS_OFFSET_GPS_BINARY 368 /* 8 + 360 */
+/* ++ GPS _CWORD82_ support */
+#define VEHICLESENS_OFFSET_GPS_NMEA 460 /* 8 + 452 Packaged delivery offset */
+/* -- GPS _CWORD82_ support */
+
+/* ++ PastModel002 support */
+/* U-Blox GPS offsets */
+#define VEHICLESENS_OFFSET_GPS_UBLOX 220 /* 220 */
+/* -- PastModel002 support */
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+#define VEHICLESENS_OFFSET_10WORD_PKG_EXT 208 /* Offset value of 10 initial deliveries(WORD) 8 + (20 * 10) */
+#define VEHICLESENS_OFFSET_WORD_PKG_EXT 28 /* Offset value of 10 initial deliveries(WORD) 8 + 20 */
+#define VEHICLESENS_OFFSET_BYTE_PKG_EXT 18 /* Offset value of 10 initial deliveries(BYTE) 8 + 10 */
+#define VEHICLESENS_OFFSET_32LONG_PKG_EXT 1328 /* Offset value of 10 initial deliveries(LONG) 8 + (132 * 10) */
+#define VEHICLESENS_OFFSET_20WORD 48 /* Offset value of 20 sensor data(WORD) 8 + 40 */
+#define VEHICLESENS_OFFSET_20WORD_FST 408 /* Offset value of 20 initial sensor data(WORD) 8 + 400 */
+#define VEHICLESENS_DNUM_4 4 /* Number of sensor data */
+#define VEHICLESENS_DNUM_5 5 /* Number of sensor data */
+#define VEHICLESENS_DNUM_7 7 /* Number of sensor data */
+#endif
+#define VEHICLESENS_EXT_OFF 0 /* Normal delivery */
+#define VEHICLESENS_EXT_ON 1 /* Extended delivery */
+
+#if CONFIG_HW_PORTSET_TYPE_C
+#define VEHICLESENS_OFFSET_GPS_NMEA 248 /* 8 + 240 */
+#endif
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+/* typedef u_int32 DID; */ /* Data ID */
+
+/* Data Master Set Notification Function */
+typedef void (*PFUNC_DMASTER_SET_N) (DID, u_int8, u_int8);
+typedef void (*PFUNC_DMASTER_SET_SHARED_MEMORY) (DID, u_int8);
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+/*********************************************************************
+* TAG : VEHICLESENS_DID_OFFSET_TBL
+* ABSTRACT : Vehicle sensor data ID,Structure of each data in the offset table
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_offset; /* Offset value */
+ u_int8 uc_reserve[2]; /* Reserved */
+} VEHICLESENS_DID_OFFSET_TBL;
+
+/*********************************************************************
+* TAG :
+* ABSTRACT :
+***********************************************************************/
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+u_int8 VehicleSensmemcmp(const void *, const void *, size_t);
+int32 VehicleSensCheckDid(DID);
+u_int16 VehicleSensGetDataMasterOffset(DID);
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+u_int16 VehicleSensGetDataMasterExtOffset(DID);
+#endif
+void VehicleSensSetGpsVersion(const SENSOR_MSG_GPSDATA_DAT *pstData);
+void VehicleSensGetDebugPosDate(void* pBuf, u_int8 uc_get_method);
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_COMMON_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_DataMaster.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_DataMaster.h
new file mode 100755
index 0000000..a180764
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_DataMaster.h
@@ -0,0 +1,1091 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DATAMASTER_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DATAMASTER_H_
+/****************************************************************************
+ * File name :VehicleSens_DataMaster.h
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ ****************************************************************************/
+
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+
+#include "positioning_hal.h"
+#include "VehicleSens_Common.h"
+#include "VehicleSens_SelectionItemList.h"
+#include "CommonDefine.h"
+#include <vehicle_service/POS_common_API.h>
+#include <vehicle_service/POS_gps_API.h>
+#include "Naviinfo_API.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/* Initial value */
+#define VEHICLE_DINIT_SP1P 0x0000
+#define VEHICLE_DINIT_SP1S 0x00
+#define VEHICLE_DINIT_SP1 0x0000
+#define VEHICLE_DINIT_ECOMODE 0x00
+#define VEHICLE_DINIT_NE1 0x0000
+#define VEHICLE_DINIT_R_ACCALL 0x00
+#define VEHICLE_DINIT_R_AC_WNG 0x00
+#define VEHICLE_DINIT_R_SW_CON 0x00
+#define VEHICLE_DINIT_R_BEEP 0x00
+#define VEHICLE_DINIT_I_RA_AUT 0x00
+#define VEHICLE_DINIT_I_RA_AC 0x00
+#define VEHICLE_DINIT_I_RA_LO 0x00
+#define VEHICLE_DINIT_I_RA_HI 0x00
+#define VEHICLE_DINIT_I_AUTO_D 0x00
+#define VEHICLE_DINIT_I_AUTO_P 0x00
+#define VEHICLE_DINIT_I_DEF 0x00
+#define VEHICLE_DINIT_I_RRDEF 0x00
+#define VEHICLE_DINIT_I_RFAUT 0x00
+#define VEHICLE_DINIT_I_REC 0x00
+#define VEHICLE_DINIT_I_FRS 0x00
+#define VEHICLE_DINIT_I_AC 0x00
+#define VEHICLE_DINIT_I_MHTR 0x00
+#define VEHICLE_DINIT_I_WIPD 0x00
+#define VEHICLE_DINIT_I_DUSY 0x00
+#define VEHICLE_DINIT_I_SWNG 0x00
+#define VEHICLE_DINIT_I_BLW_F 0x00
+#define VEHICLE_DINIT_I_OAUT_D 0x00
+#define VEHICLE_DINIT_I_OLET_D 0x00
+#define VEHICLE_DINIT_I_OAUT_P 0x00
+#define VEHICLE_DINIT_I_OLET_P 0x00
+#define VEHICLE_DINIT_ST_BMN_F 0x00
+#define VEHICLE_DINIT_I_AIRPR 0x00
+#define VEHICLE_DINIT_I_O2 0x00
+#define VEHICLE_DINIT_I_PLSM 0x00
+#define VEHICLE_DINIT_I_KAFUN 0x00
+#define VEHICLE_DINIT_I_SAFS 0x00
+#define VEHICLE_DINIT_R_ONSCRN 0x00
+#define VEHICLE_DINIT_I_HUM 0x00
+#define VEHICLE_DINIT_I_TMP_D 0x00
+#define VEHICLE_DINIT_I_TMP_P 0x00
+#define VEHICLE_DINIT_SL_ACDSP 0x00
+#define VEHICLE_DINIT_SL_DUSY 0x00
+#define VEHICLE_DINIT_SL_CIF 0x00
+#define VEHICLE_DINIT_SL_BLW_F 0x00
+#define VEHICLE_DINIT_SL_SRLVL 0x00
+#define VEHICLE_DINIT_SL_RR_IH 0x00
+#define VEHICLE_DINIT_SL_RAUTO 0x00
+#define VEHICLE_DINIT_SL_BLW_R 0x00
+#define VEHICLE_DINIT_SL_DST 0x00
+#define VEHICLE_DINIT_SL_WIPD 0x00
+#define VEHICLE_DINIT_SL_MRHT 0x00
+#define VEHICLE_DINIT_SL_AIRP 0x00
+#define VEHICLE_DINIT_SL_O2 0x00
+#define VEHICLE_DINIT_SL_PLSM 0x00
+#define VEHICLE_DINIT_SL_KAFUN 0x00
+#define VEHICLE_DINIT_SL_SWNG 0x00
+#define VEHICLE_DINIT_ST_CN_OK 0x00
+#define VEHICLE_DINIT_SL_RBLW 0x00
+#define VEHICLE_DINIT_SL_HUM 0x00
+#define VEHICLE_DINIT_R_INLVL 0x00
+#define VEHICLE_DINIT_I_INLVL 0x00
+#define VEHICLE_DINIT_I_AUT_RR 0x00
+#define VEHICLE_DINIT_I_AUT_RL 0x00
+#define VEHICLE_DINIT_I_CNT_IH 0x00
+#define VEHICLE_DINIT_I_RAUTO 0x00
+#define VEHICLE_DINIT_ST_BMN_R 0x00
+#define VEHICLE_DINIT_I_BLW_R 0x00
+#define VEHICLE_DINIT_R_RONSCR 0x00
+#define VEHICLE_DINIT_I_OLT_RR 0x00
+#define VEHICLE_DINIT_I_OLT_RL 0x00
+#define VEHICLE_DINIT_I_TMP_RR 0x00
+#define VEHICLE_DINIT_I_TMP_RL 0x00
+#define VEHICLE_DINIT_ACN_AMB 0x00
+#define VEHICLE_DINIT_AC_AMB05 0x00
+#define VEHICLE_DINIT_SOC_MON 0x00
+#define VEHICLE_DINIT_RDYIND 0x00
+#define VEHICLE_DINIT_HV_M2B 0x00
+#define VEHICLE_DINIT_HV_EP 0x00
+#define VEHICLE_DINIT_HV_EM 0x00
+#define VEHICLE_DINIT_RNRG 0x00
+#define VEHICLE_DINIT_HV_MP 0x00
+#define VEHICLE_DINIT_HV_MB 0x00
+#define VEHICLE_DINIT_HV_RG 0x00
+#define VEHICLE_DINIT_B_P 0x00
+#define VEHICLE_DINIT_B_R 0x00
+#define VEHICLE_DINIT_B_N 0x00
+#define VEHICLE_DINIT_B_D 0x00
+#define VEHICLE_DINIT_B_FC 0x0000
+#define VEHICLE_DINIT_R_DISP 0x00
+#define VEHICLE_DINIT_HVFLAG 0x00
+#define VEHICLE_DINIT_DVINF 0x00
+#define VEHICLE_DINIT_IN_FC 0x0000
+#define VEHICLE_DINIT_UNIT_0 0x00
+#define VEHICLE_DINIT_AS_SP 0x0000
+#define VEHICLE_DINIT_UNIT_1 0x00
+#define VEHICLE_DINIT_FC_SCL 0x00
+#define VEHICLE_DINIT_RANGE 0x0000
+#define VEHICLE_DINIT_UNIT_4 0x00
+#define VEHICLE_DINIT_TO_FC 0x0000
+#define VEHICLE_DINIT_UNIT_6 0x00
+#define VEHICLE_DINIT_AS_TM 0x0000
+#define VEHICLE_DINIT_ADIM_C 0x00
+#define VEHICLE_DINIT_LGCY 0x00
+#define VEHICLE_DINIT_BCTY 0x00
+#define VEHICLE_DINIT_RTRRQ 0x00
+#define VEHICLE_DINIT_DEST_BDB 0x00
+#define VEHICLE_DINIT_DS_PACK1 0x00
+#define VEHICLE_DINIT_DS_PACK2 0x00
+#define VEHICLE_DINIT_STRG_WHL 0x00
+#define VEHICLE_DINIT_TRIP_CNT 0x0000
+#define VEHICLE_DINIT_TIME_CNT 0x00000000
+#define VEHICLE_DINIT_TPM_VAR 0x00
+#define VEHICLE_DINIT_TPM_WA1 0x00
+#define VEHICLE_DINIT_TPM_TNUM 0x00
+#define VEHICLE_DINIT_TPM_REQ0 0x00
+#define VEHICLE_DINIT_TPM_TAN0 0x00
+#define VEHICLE_DINIT_TPM_FLPR 0x00
+#define VEHICLE_DINIT_TPM_FL0 0x00
+#define VEHICLE_DINIT_TPM_FRPR 0x00
+#define VEHICLE_DINIT_TPM_FR0 0x00
+#define VEHICLE_DINIT_TPM_RLPR 0x00
+#define VEHICLE_DINIT_TPM_RL0 0x00
+#define VEHICLE_DINIT_TPM_RRPR 0x00
+#define VEHICLE_DINIT_TPM_RR0 0x00
+#define VEHICLE_DINIT_TPM_SPPR 0x00
+#define VEHICLE_DINIT_TPM_SP0 0x00
+#define VEHICLE_DINIT_B_R2 0x00
+#define VEHICLE_DINIT_VSP0B 0x00
+#define VEHICLE_DINIT_EPBLOCK 0x00
+
+#define VEHICLE_DINIT_DESTINATION_DEST_BDB 0x00
+#define VEHICLE_DINIT_DESTINATION_DS_PACK1 0x00
+#define VEHICLE_DINIT_DESTINATION_DS_PACK2 0x00
+#define VEHICLE_DINIT_HV 0x00
+#define VEHICLE_DINIT_2WD4WD 0x00
+#define VEHICLE_DINIT_STEERING_WHEEL 0x00
+#define VEHICLE_DINIT_VB 0x00
+#define VEHICLE_DINIT_IG 0x00
+#define VEHICLE_DINIT_MIC 0x00
+#define VEHICLE_DINIT_TEST 0x00
+#define VEHICLE_DINIT_VTRADAPTER 0x00
+#define VEHICLE_DINIT_AUXADAPTER 0x00
+#define VEHICLE_DINIT_BACKDOOR 0x00
+#define VEHICLE_DINIT_PKB 0x00
+#define VEHICLE_DINIT_PKB_CAN 0x00
+#define VEHICLE_DINIT_ADIM 0x00
+#define VEHICLE_DINIT_ILL 0x00
+#define VEHICLE_DINIT_RHEOSTAT 0x00
+#define VEHICLE_DINIT_PANELTEMP 0x00
+#define VEHICLE_DINIT_SYSTEMP 0x0000
+#define VEHICLE_DINIT_SPEED_PULSE 0x0000
+#define VEHICLE_DINIT_SPEED_KMPH 0x0000
+#define VEHICLE_DINIT_GYRO_X 0x0000
+#define VEHICLE_DINIT_GYRO_Y 0x0000
+#define VEHICLE_DINIT_GYRO_Z 0x0000
+#define VEHICLE_DINIT_GYRO VEHICLE_DINIT_GYRO_X
+#define VEHICLE_DINIT_GSNS_X 0x0000
+#define VEHICLE_DINIT_GSNS_Y 0x0000
+#define VEHICLE_DINIT_GSNS_Z 0x0000
+#define VEHICLE_DINIT_REV 0x00
+#define VEHICLE_DINIT_VSC1S03_4 0x00
+#define VEHICLE_DINIT_VSC1S03_5 0x00
+#define VEHICLE_DINIT_VSC1S03_6 0x00
+#define VEHICLE_DINIT_VSC1S03_7 0x00
+#define VEHICLE_DINIT_ECO1S01_2 0x00
+#define VEHICLE_DINIT_ENG1F07_0 0x00
+#define VEHICLE_DINIT_ENG1F07_1 0x00
+#define VEHICLE_DINIT_ENG1S03_0 0x00
+#define VEHICLE_DINIT_ENG1S03_1 0x00
+#define VEHICLE_DINIT_ACN1S04_0 0x00
+#define VEHICLE_DINIT_ACN1S04_1 0x00
+#define VEHICLE_DINIT_ACN1S04_2 0x00
+#define VEHICLE_DINIT_ACN1S04_3 0x00
+#define VEHICLE_DINIT_ACN1S04_4 0x00
+#define VEHICLE_DINIT_ACN1S04_5 0x00
+#define VEHICLE_DINIT_ACN1S04_7 0x00
+#define VEHICLE_DINIT_ACN1S05_0 0x00
+#define VEHICLE_DINIT_ACN1S05_1 0x00
+#define VEHICLE_DINIT_ACN1S06_0 0x00
+#define VEHICLE_DINIT_ACN1S06_1 0x00
+#define VEHICLE_DINIT_ACN1S06_2 0x00
+#define VEHICLE_DINIT_ACN1S06_4 0x00
+#define VEHICLE_DINIT_ACN1S06_7 0x00
+#define VEHICLE_DINIT_ACN1S08_0 0x00
+#define VEHICLE_DINIT_ACN1S08_1 0x00
+#define VEHICLE_DINIT_ACN1S08_2 0x00
+#define VEHICLE_DINIT_ACN1S08_6 0x00
+#define VEHICLE_DINIT_ACN1S08_7 0x00
+#define VEHICLE_DINIT_ACN1S07_3 0x00
+#define VEHICLE_DINIT_ACN1S07_5 0x00
+#define VEHICLE_DINIT_EHV1S90_2 0x00
+#define VEHICLE_DINIT_EHV1S90_3 0x00
+#define VEHICLE_DINIT_EHV1S90_4 0x00
+#define VEHICLE_DINIT_EHV1S90_5 0x00
+#define VEHICLE_DINIT_EHV1S90_6 0x00
+#define VEHICLE_DINIT_EHV1S90_7 0x00
+#define VEHICLE_DINIT_ECT1S92_1 0x00
+#define VEHICLE_DINIT_ECT1S92_5 0x00
+#define VEHICLE_DINIT_ENG1S28_0 0x00
+#define VEHICLE_DINIT_ENG1S28_1 0x00
+#define VEHICLE_DINIT_BGM1S01_0 0x00
+#define VEHICLE_DINIT_ENG1F03_1 0x00
+#define VEHICLE_DINIT_ENG1F03_3 0x00
+#define VEHICLE_DINIT_MET1S01_5 0x00
+#define VEHICLE_DINIT_MET1S01_6 0x00
+#define VEHICLE_DINIT_MET1S01_7 0x00
+#define VEHICLE_DINIT_MET1S03_2 0x00
+#define VEHICLE_DINIT_MET1S03_3 0x00
+#define VEHICLE_DINIT_MET1S03_4 0x00
+#define VEHICLE_DINIT_MET1S04_4 0x00
+#define VEHICLE_DINIT_MET1S04_5 0x00
+#define VEHICLE_DINIT_MET1S04_6 0x00
+#define VEHICLE_DINIT_MET1S04_7 0x00
+#define VEHICLE_DINIT_MET1S05_5 0x00
+#define VEHICLE_DINIT_MET1S05_6 0x00
+#define VEHICLE_DINIT_MET1S05_7 0x00
+#define VEHICLE_DINIT_MET1S07_6 0x00
+#define VEHICLE_DINIT_MET1S07_7 0x00
+#define VEHICLE_DINIT_BDB1S01_4 0x00
+#define VEHICLE_DINIT_BDB1S01_5 0x00
+#define VEHICLE_DINIT_BDB1S03_4 0x00
+#define VEHICLE_DINIT_BDB1S08_2 0x00
+#define VEHICLE_DINIT_BDB1S08_3 0x00
+#define VEHICLE_DINIT_BDB1S08_4 0x00
+#define VEHICLE_DINIT_BDB1S08_5 0x00
+#define VEHICLE_DINIT_BDB1F03_2 0x00
+#define VEHICLE_DINIT_BDB1F03_3 0x00
+#define VEHICLE_DINIT_BDB1F03_4 0x00
+#define VEHICLE_DINIT_BDB1F03_5 0x00
+#define VEHICLE_DINIT_BDB1F03_6 0x00
+#define VEHICLE_DINIT_BDB1F03_7 0x00
+#define VEHICLE_DINIT_TPM1S02_2 0x00
+#define VEHICLE_DINIT_TPM1S02_5 0x00
+#define VEHICLE_DINIT_TPM1S03_2 0x00
+#define VEHICLE_DINIT_TPM1S03_3 0x00
+#define VEHICLE_DINIT_TPM1S03_4 0x00
+#define VEHICLE_DINIT_TPM1S03_5 0x00
+#define VEHICLE_DINIT_TPM1S03_6 0x00
+#define VEHICLE_DINIT_TPM1S03_7 0x00
+#define VEHICLE_DINIT_ENG1S92_3 0x00
+#define VEHICLE_DINIT_MMT1S52_0 0x00
+#define VEHICLE_DINIT_EPB1S01_0 0x00
+#define VEHICLE_DINIT_MINIJACK 0x00
+#define VEHICLE_DINIT_GPS_ANTENNA 0x00
+#define VEHICLE_DINIT_SNS_COUNTER 0x00
+#define VEHICLE_DINIT_GPS_COUNTER 0x00
+
+/* ++ PastModel002 support */
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_POSLLH 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_STATUS 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_TIMEUTC 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_VELNED 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_DOP 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_TIMEGPS 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_SVINFO 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_NAV_CLOCK 0x00
+#define VEHICLE_DINIT_GPS_UBLOX_MON_HW 0x00
+
+#define VEHICLE_DINIT_SPEED_PULSE_FLAG 0x00
+#define VEHICLE_DINIT_GPS_INTERRUPT_FLAG 0x00
+
+#define VEHICLE_DINIT_GYRO_TROUBLE 0x00 /* Gyro failure status undefined(GYRO_UNFIXED) */
+#define VEHICLE_DINIT_MAIN_GPS_INTERRUPT_SIGNAL 0x00
+#define VEHICLE_DINIT_SYS_GPS_INTERRUPT_SIGNAL 0x00
+#define VEHICLE_DINIT_GYRO_CONNECT_STATUS 0x00
+/* -- PastModel002 support */
+
+/* Size of the data(byte) */
+#define VEHICLE_DSIZE_DESTINATION 0x03
+#define VEHICLE_DSIZE_HV 0x01
+#define VEHICLE_DSIZE_2WD4WD 0x01
+#define VEHICLE_DSIZE_STEERING_WHEEL 0x01
+#define VEHICLE_DSIZE_VB 0x01
+#define VEHICLE_DSIZE_IG 0x01
+#define VEHICLE_DSIZE_MIC 0x01
+#define VEHICLE_DSIZE_TEST 0x01
+#define VEHICLE_DSIZE_VTRADAPTER 0x01
+#define VEHICLE_DSIZE_AUXADAPTER 0x01
+#define VEHICLE_DSIZE_BACKDOOR 0x01
+#define VEHICLE_DSIZE_PKB 0x01
+#define VEHICLE_DSIZE_ADIM 0x01
+#define VEHICLE_DSIZE_ILL 0x01
+#define VEHICLE_DSIZE_RHEOSTAT 0x01
+#define VEHICLE_DSIZE_PANELTEMP 0x01
+#define VEHICLE_DSIZE_SYSTEMP 0x02
+#define VEHICLE_DSIZE_SPEED_PULSE 0x14
+#define VEHICLE_DSIZE_SPEED_KMPH 0x02
+#define VEHICLE_DSIZE_GYRO_X 0x14
+#define VEHICLE_DSIZE_GYRO_Y 0x14
+#define VEHICLE_DSIZE_GYRO_Z 0x14
+#define VEHICLE_DSIZE_GYRO VEHICLE_DSIZE_GYRO_X
+#define VEHICLE_DSIZE_GYRO_TEMP 0x02
+#define VEHICLE_DSIZE_PULSE_TIME 0x84
+#define VEHICLE_DSIZE_GSNS_X 0x06
+#define VEHICLE_DSIZE_GSNS_Y 0x06
+#define VEHICLE_DSIZE_GSNS_Z 0x06
+#define VEHICLE_DSIZE_REV 0x01
+#define VEHICLE_DSIZE_VSC1S03 0x09 /* Internal extensions */
+#define VEHICLE_DSIZE_ECO1S01 0x05
+#define VEHICLE_DSIZE_ENG1F07 0x08
+#define VEHICLE_DSIZE_ENG1S03 0x08
+#define VEHICLE_DSIZE_ACN1S04 0x08
+#define VEHICLE_DSIZE_ACN1S05 0x02
+#define VEHICLE_DSIZE_ACN1S06 0x08
+#define VEHICLE_DSIZE_ACN1S08 0x08
+#define VEHICLE_DSIZE_ACN1S07 0x06
+#define VEHICLE_DSIZE_EHV1S90 0x08
+#define VEHICLE_DSIZE_ECT1S92 0x08
+#define VEHICLE_DSIZE_ENG1S28 0x02
+#define VEHICLE_DSIZE_BGM1S01 0x01
+#define VEHICLE_DSIZE_ENG1F03 0x08
+#define VEHICLE_DSIZE_CAA1N01 0x08
+#define VEHICLE_DSIZE_MET1S01 0x08
+#define VEHICLE_DSIZE_MET1S03 0x08
+#define VEHICLE_DSIZE_MET1S04 0x08
+#define VEHICLE_DSIZE_MET1S05 0x08
+#define VEHICLE_DSIZE_MET1S07 0x08
+#define VEHICLE_DSIZE_BDB1S01 0x08
+#define VEHICLE_DSIZE_BDB1S03 0x08
+#define VEHICLE_DSIZE_BDB1S08 0x08
+#define VEHICLE_DSIZE_BDB1F03 0x08
+#define VEHICLE_DSIZE_TPM1S02 0x08
+#define VEHICLE_DSIZE_TPM1S03 0x08
+#define VEHICLE_DSIZE_ENG1S92 0x08
+#define VEHICLE_DSIZE_MMT1S52 0x08
+#define VEHICLE_DSIZE_EPB1S01 0x03
+#define VEHICLE_DSIZE_MINIJACK 0x01
+#define VEHICLE_DSIZE_GPS_ANTENNA 0x01
+#define VEHICLE_DSIZE_SNS_COUNTER 0x01
+#define VEHICLE_DSIZE_GPS_COUNTER 0x01
+#define VEHICLE_DSIZE_SIRF_BINARY 360
+#define VEHICLE_DSIZE_RTC VEHICLE_DSIZE_GPS_FORMAT
+#define VEHICLE_DSIZE_GPS_VERSION VEHICLE_DSIZE_GPS_FORMAT
+#define VEHICLE_DSIZE_SATELLITE_STATUS VEHICLE_DSIZE_GPS_FORMAT
+#define VEHICLE_DSIZE_LOCATION VEHICLE_DSIZE_GPS_FORMAT
+/* ++ GPS _CWORD82_ support */
+#define VEHICLE_DSIZE_GPS__CWORD82___CWORD44_GP4 VEHICLE_DSIZE_GPS_FORMAT
+#define VEHICLE_DSIZE_GPS__CWORD82__NMEA 424
+#define VEHICLE_DSIZE_GPS__CWORD82__FULLBINARY VEHICLE_DSIZE_GPS_FORMAT
+/* -- GPS _CWORD82_ support */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+#define VEHICLE_DSIZE_DATA_MASTER_FST 0x1200
+
+#define VEHICLE_DSIZE_GYRO_X_FST LSDRV_FSTSNS_DSIZE_GYRO_X
+#define VEHICLE_DSIZE_GYRO_Y_FST LSDRV_FSTSNS_DSIZE_GYRO_Y
+#define VEHICLE_DSIZE_GYRO_Z_FST LSDRV_FSTSNS_DSIZE_GYRO_Z
+#define VEHICLE_DSIZE_SPEED_PULSE_FST LSDRV_FSTSNS_DSIZE_SPEED
+#define VEHICLE_DSIZE_GSNSX_FST LSDRV_FSTSNS_DSIZE_GSENSOR_X
+#define VEHICLE_DSIZE_GSNSY_FST LSDRV_FSTSNS_DSIZE_GSENSOR_Y
+#define VEHICLE_DSIZE_GSNSZ_FST LSDRV_FSTSNS_DSIZE_GSENSOR_Z
+#define VEHICLE_DSIZE_GYROTEMP_FST LSDRV_FSTSNS_DSIZE_GYRO_TEMP
+#define VEHICLE_DSIZE_SPEED_PULSE_FLAG_FST LSDRV_FSTSNS_DSIZE_SPEED_FLG
+#define VEHICLE_DSIZE_REV_FST LSDRV_FSTSNS_DSIZE_REV
+
+#define VEHICLE_DSIZE_GYRO_EXT 0x500
+#define VEHICLE_DSIZE_SPEED_PULSE_EXT 0x500
+#define VEHICLE_DSIZE_GSNS_X_EXT 0x500
+#define VEHICLE_DSIZE_GSNS_Y_EXT 0x500
+#define VEHICLE_DSIZE_GSNS_Z_EXT 0x500
+#define VEHICLE_DSIZE_SNS_COUNTER_EXT 0x40
+#define VEHICLE_DSIZE_GYRO_TEMP_EXT 0x80
+#define VEHICLE_DSIZE_REV_EXT 0x40
+#define VEHICLE_DSIZE_PULSE_TIME_EXT 0x2100
+
+#define VEHICLE_DSIZE_GYRO_EXT_INIT 0x00 /* Gyro output extended data master registration number initial value */
+#define VEHICLE_DSIZE_SPEED_PULSE_EXT_INIT 0x00 /* Vehicle speed expansion data master registration number initial value */
+#define VEHICLE_DSIZE_GSNS_X_EXT_INIT 0x00 /* Initial value of G sensor (X-axis) extended data master registration number */
+#define VEHICLE_DSIZE_GSNS_Y_EXT_INIT 0x00 /* Initial value of G sensor (Y-axis) expansion data master registration number */
+#define VEHICLE_DSIZE_GSNS_Z_EXT_INIT 0x00 /* Initial value of G sensor (Z-axis) expansion data master registration number */
+#define VEHICLE_DSIZE_SNS_COUNTER_EXT_INIT 0x00 /* Initial value of register number of sensor counter extended data master */
+#define VEHICLE_DSIZE_REV_EXT_INIT 0x00 /* REV extended data master registration number initial value */
+#define VEHICLE_DSIZE_GYRO_TEMP_EXT_INIT 0x00 /* Gyro Temperature Extended Data Master Registration Number Initial Value */
+#define VEHICLE_DSIZE_PULSE_TIME_EXT_INIT 0x00 /* Extended data master registration number initial value between pulse time */
+
+#define VEHICLE_DSIZE_GYRO_TROUBLE 0x01
+#define VEHICLE_DSIZE_MAIN_GPS_INTERRUPT_SIGNAL 0x01
+#define VEHICLE_DSIZE_SYS_GPS_INTERRUPT_SIGNAL 0x01
+#define VEHICLE_DSIZE_GYRO_CONNECT_STATUS 0x01
+
+#define VEHICLE_DKEEP_MAX 64 /* Internal data retention count */
+
+/* Data storage location */
+#define VEHICLE_DATA_POS_00 0x00 /* Data storage position 0 */
+#define VEHICLE_DATA_POS_01 0x01 /* Data storage position 1 */
+#endif
+
+#define VEHICLE_DSIZE_GPS_FORMAT 1904
+
+/* ++ PastModel002 support */
+/* GPS_u-blox data size(Up to 208 bytes + 1 byte of sensor counter) */
+#define VEHICLE_DSIZE_GPS_UBLOX_FORMAT 212
+/* ++ PastModel002 support */
+
+/* NMEA data size */
+#define VEHICLE_DSIZE_GPS_NMEA_GGA 71 /* Positioning information(Fixed-length sentence 71 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_DGGA 75 /* Double precision GGA - Positioning information(Fixed-length sentence 75 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_VTG 37 /* Progress Direction,Velocity information(Fixed-length sentence 37 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_RMC 61 /* RMC - Minimal information(Fixed-length sentence 61 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_DRMC 67 /* Double RMC - Minimal information(Fixed-length sentence 67 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_GLL 44 /* GLL - Geographical locality information(Fixed-length sentence 44 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_DGLL 50 /* Double-precision GLL - Geographical locality information(Fixed-length sentence 50 Byte) */
+/* GSA - DOP information and positioning satellite information(Fixed-length sentence 66 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_GSA 66
+#define VEHICLE_DSIZE_GPS_NMEA_GSV_1 70 /* GSV - Visual satellite information(Fixed-length sentence 70 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_GSV_2 70 /* GSV - Visual satellite information(Fixed-length sentence 70 Byte) */
+#define VEHICLE_DSIZE_GPS_NMEA_GSV_3 70 /* GSV - Visual satellite information(Fixed-length sentence 70 Byte) */
+/* _CWORD44_,GP,3 - Visual satellite reception information */
+#define VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_3 78
+/* _CWORD44_,GP,4 - Receiver-specific information */
+#define VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4 25
+
+/* FULLBINARY data size */
+/* Fully customized output */
+#define VEHICLE_DSIZE_GPS_FULLBINARY GPS_CMD_FULLBIN_SZ
+
+#if CONFIG_HW_PORTSET_TYPE_C
+#define VEHICLE_DSIZE_NMEA 0
+#define VEHICLE_DSIZE_GGA 0x00
+#define VEHICLE_DSIZE_GLL 0x00
+#define VEHICLE_DSIZE_GSA 0x00
+#define VEHICLE_DSIZE_GSV 0x00
+#define VEHICLE_DSIZE_RMC 0x00
+#define VEHICLE_DSIZE_VTG 0x00
+#endif
+
+/* ++ PastModel002 support */
+#define VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE 0 /* UBX common header size */
+
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_CLOCK 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_DOP 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_POSLLH 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_STATUS 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO 0 /* 8 + 12*numCh(For variable,Define only the fixed part) */
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_TIMEGPS 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_TIMEUTC 0
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_VELNED 0
+#define VEHICLE_DSIZE_GPS_UBLOX_MON_HW 0
+
+#define VEHICLE_DSIZE_SPEED_PULSE_FLAG 0x00
+#define VEHICLE_DSIZE_GPS_INTERRUPT_FLAG 0x00
+
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO_CH_MAX 0 /* Maximum number of NAV_SVINFO channels */
+#define VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO_ALONE_MAX 0 /* NAV_SVINFO channel:Maximum Single Data Size */
+/* -- PastModel002 support */
+
+/* Data received*/
+#define VEHICLE_RCVFLAG_ON 0x00
+#define VEHICLE_RCVFLAG_OFF 0x00
+
+/* Upper limit of number of data items stored between pulses */
+#define VEHICLE_SNS_INFO_PULSE_NUM 0
+
+/*------------------------------------------------------------------------------*
+ * NMEA reception flag *
+ -------------------------------------------------------------------------------*/
+/* Not supported by UBX_Protocol */
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/*********************************************************************
+* TAG : VEHICLESENS_DATA_MASTER
+* ABSTRACT : Vehicle sensor data master structure
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_snscnt; /* Sensor Counter */
+ u_int8 uc_data[132]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER;
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data[8448]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_EXT;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 partition_flg; /* Fragmented Transmission Flag */
+ u_int8 uc_data[VEHICLE_DSIZE_DATA_MASTER_FST]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_FST;
+
+#endif
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data[VEHICLE_DSIZE_GPS_FORMAT]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_FORMAT;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data[VEHICLE_DSIZE_SIRF_BINARY]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_BINARY;
+
+/* ++ GPS _CWORD82_ support */
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data[VEHICLE_DSIZE_GPS__CWORD82__NMEA]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_NMEA_FORMAT;
+
+/* -- GPS _CWORD82_ support */
+#if CONFIG_HW_PORTSET_TYPE_C
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data[VEHICLE_DSIZE_NMEA]; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_NMEA;
+#endif
+
+/* ++ PastModel002 support */
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_sensor_cnt; /* Sensor Counter */
+ u_int8 uc_gpscnt_flag; /* GPS counter flag */
+ u_int8 reserve[3]; /* reserve */
+ u_int8 uc_data[VEHICLE_DSIZE_GPS_UBLOX_FORMAT]; /* UBLOX_GPS data */
+} VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GYRO_TROUBLE;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_reserve; /* Reserved */
+ u_int8 uc_data; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS;
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_size; /* Size of the data */
+ u_int8 uc_rcvflag; /* Receive flag */
+ u_int8 uc_sensor_cnt; /* Sensor Counter */
+ u_int8 uc_data; /* Vehicle sensor data */
+} VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS;
+
+/* ++ PastModel002 support */
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*********************************************************************
+* TAG : VEHICLESENS_PKG_DELIVERY_TEMP_EXT
+* ABSTRACT : Structure of Vehicle Sensor Initial Delivery Management Table
+***********************************************************************/
+typedef struct {
+ u_int16 us_gyro[10]; /* Gyro output */
+ u_int16 us_sp_pls[10]; /* Vehicle speed pulse */
+ u_int8 uc_sens_cnt; /* Sensor Counter */
+ u_int8 uc_reserve[3]; /* reserve */
+} VEHICLESENS_PKG_DELIVERY_TEMP_TBL;
+
+// for VEHICLESENS_PKG_DELIVERY_TEMP_EXT.start_point index
+enum VEHICLESENS_PKG_INDEX {
+ SNSCounter = 0,
+ SpeedPulse,
+ GyroExt,
+ GsnsX,
+ GsnsY,
+ Rev,
+ GyroTemp,
+ PulseTime,
+ GyroY,
+ GyroZ,
+ GsnsZ,
+ MAX
+};
+
+typedef struct {
+ uint16_t start_point[8]; /* Sequence reference start position */
+ uint16_t end_point; /* Array registration completion position */
+ uint16_t data_break; /* All data undelivered flag */
+} VEHICLESENS_PKG_DELIVERY_TEMP_EXT;
+
+/************************************************************************
+* External variable *
+************************************************************************/
+extern VEHICLESENS_PKG_DELIVERY_TEMP_EXT gstPkgTempExt; // NOLINT(readability/nolint)
+#endif
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void VehicleSensInitDataMaster(void);
+void VehicleSensSetDataMasterLineSens(const LSDRV_LSDATA *, PFUNC_DMASTER_SET_N func, BOOL);
+void VehicleSensSetDataMasterLineSensG(const LSDRV_LSDATA_G *, PFUNC_DMASTER_SET_N func, BOOL);
+void VehicleSensSetDataMasterGps(SENSOR_MSG_GPSDATA_DAT *, PFUNC_DMASTER_SET_N func);
+void VehicleSensGetDataMaster(DID ul_did, u_int8, VEHICLESENS_DATA_MASTER *);
+void VehicleSensGetGpsDataMaster(DID ul_did, u_int8, SENSOR_MSG_GPSDATA_DAT *);
+void VehicleSensSetDataMasterData(const POS_MSGINFO *, PFUNC_DMASTER_SET_N func);
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+void VehicleSensSetDataMasterLineSensFst(const LSDRV_LSDATA_FST *pst_data, PFUNC_DMASTER_SET_N p_data_master_set_n);
+void VehicleSensSetDataMasterLineSensFstG(const LSDRV_MSG_LSDATA_DAT_FST *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n);
+void VehicleSensGetDataMasterFst(DID ul_did, u_int8, VEHICLESENS_DATA_MASTER_FST *);
+void VehicleSensGetDataMasterExt(DID ul_did, u_int8, VEHICLESENS_DATA_MASTER_EXT *);
+#endif
+
+void VehicleSensSetDataMasterGyroTrouble(const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n);
+void VehicleSensSetDataMasterSysGpsInterruptSignal(const LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL *pst_data,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory);
+void VehicleSensSetDataMasterMainGpsInterruptSignal(const SENSOR_MSG_GPSDATA_DAT *pst_data,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory);
+void VehicleSensSetDataMasterGyroConnectStatus(const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *pst_data,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory);
+void VehicleSensSetDataMasterGpsAntennaStatus(const LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n);
+
+void VehicleSensGetDataMasterGyroTrouble(DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_data);
+void VehicleSensGetDataMasterSysGpsInterruptSignal(DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data);
+void VehicleSensGetDataMasterMainGpsInterruptSignal(DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data);
+void VehicleSensGetDataMasterGyroConnectStatus(DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_data);
+void VehicleSensGetDataMasterGpsAntennaStatus(DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_data);
+
+void VehicleSensGetGsnsX(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGsnsXl(void);
+u_int8 VehicleSensSetGsnsXl(const LSDRV_LSDATA *);
+void VehicleSensGetGsnsXl(VEHICLESENS_DATA_MASTER *);
+u_int8 VehicleSensSetGsnsXlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsXFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGsnsXFstl(void);
+u_int8 VehicleSensSetGsnsXFstG(const LSDRV_LSDATA_FST_GSENSOR_X *pst_data);
+void VehicleSensGetGsnsXFstl(VEHICLESENS_DATA_MASTER_FST *pst_data);
+
+void VehicleSensGetGsnsY(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGsnsYl(void);
+u_int8 VehicleSensSetGsnsYl(const LSDRV_LSDATA *);
+void VehicleSensGetGsnsYl(VEHICLESENS_DATA_MASTER *);
+u_int8 VehicleSensSetGsnsYlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsYFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGsnsYFstl(void);
+u_int8 VehicleSensSetGsnsYFstG(const LSDRV_LSDATA_FST_GSENSOR_Y *pst_data);
+void VehicleSensGetGsnsYFstl(VEHICLESENS_DATA_MASTER_FST *pst_data);
+
+void VehicleSensGetGsnsZ(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGsnsZl(void);
+u_int8 VehicleSensSetGsnsZl(const LSDRV_LSDATA *);
+void VehicleSensGetGsnsZl(VEHICLESENS_DATA_MASTER *);
+u_int8 VehicleSensSetGsnsZlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsZFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGsnsZFstl(void);
+u_int8 VehicleSensSetGsnsZFstG(const LSDRV_LSDATA_FST_GSENSOR_Z *pst_data);
+void VehicleSensGetGsnsZFstl(VEHICLESENS_DATA_MASTER_FST *pst_data);
+
+void VehicleSensGetGyroX(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGyroXl(void);
+u_int8 VehicleSensSetGyroXl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetGyroXlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroXl(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetGyroY(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGyroYl(void);
+u_int8 VehicleSensSetGyroYl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetGyroYlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroYl(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetGyroZ(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGyroZl(void);
+u_int8 VehicleSensSetGyroZl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetGyroZlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroZl(VEHICLESENS_DATA_MASTER *);
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+void VehicleSensGetSpeedPulseFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitSpeedPulseFstl(void);
+u_int8 VehicleSensSetSpeedPulseFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetSpeedPulseFstG(const LSDRV_LSDATA_FST_SPEED *);
+void VehicleSensGetSpeedPulseFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetGyroXFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGyroXFstl(void);
+u_int8 VehicleSensSetGyroXFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetGyroXFstG(const LSDRV_LSDATA_FST_GYRO_X *);
+void VehicleSensGetGyroXFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetGyroYFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGyroYFstl(void);
+u_int8 VehicleSensSetGyroYFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetGyroYFstG(const LSDRV_LSDATA_FST_GYRO_Y *);
+void VehicleSensGetGyroYFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetGyroYExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGyroYExtl(void);
+void VehicleSensSetGyroYExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroYExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetGyroZFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitGyroZFstl(void);
+u_int8 VehicleSensSetGyroZFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetGyroZFstG(const LSDRV_LSDATA_FST_GYRO_Z *);
+void VehicleSensGetGyroZFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetGyroZExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGyroZExtl(void);
+void VehicleSensSetGyroZExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroZExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetSpeedPulseFlagFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitSpeedPulseFlagFstl(void);
+u_int8 VehicleSensSetSpeedPulseFlagFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetSpeedPulseFlagFstG(const LSDRV_LSDATA_FST_SPEED_PULSE_FLAG *);
+void VehicleSensGetSpeedPulseFlagFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetRevFst(VEHICLESENS_DATA_MASTER_FST *, u_int8);
+void VehicleSensInitRevFstl(void);
+u_int8 VehicleSensSetRevFstl(const LSDRV_LSDATA_FST *);
+u_int8 VehicleSensSetRevFstG(const LSDRV_LSDATA_FST_REV *);
+void VehicleSensGetRevFstl(VEHICLESENS_DATA_MASTER_FST *);
+
+void VehicleSensGetGsnsXExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGsnsXExtl(void);
+void VehicleSensSetGsnsXExtl(const LSDRV_LSDATA *);
+void VehicleSensSetGsnsXExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsXExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetGsnsYExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGsnsYExtl(void);
+void VehicleSensSetGsnsYExtl(const LSDRV_LSDATA *);
+void VehicleSensSetGsnsYExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsYExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetGsnsZExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGsnsZExtl(void);
+void VehicleSensSetGsnsZExtl(const LSDRV_LSDATA *);
+void VehicleSensSetGsnsZExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGsnsZExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetGyroExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitGyroExtl(void);
+void VehicleSensSetGyroExtl(const LSDRV_LSDATA *);
+void VehicleSensSetGyroExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetGyroRev(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGyroRevl(void);
+u_int8 VehicleSensSetGyroRevl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetGyroRevlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetGyroRevl(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetSpeedPulseExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitSpeedPulseExtl(void);
+void VehicleSensSetSpeedPulseExtl(const LSDRV_LSDATA *);
+void VehicleSensSetSpeedPulseExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetSpeedPulseExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetSnsCounterExt(VEHICLESENS_DATA_MASTER_EXT *, u_int8);
+void VehicleSensInitSnsCounterExtl(void);
+void VehicleSensSetSnsCounterExtl(const LSDRV_LSDATA *);
+void VehicleSensSetSnsCounterExtlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetSnsCounterExtl(VEHICLESENS_DATA_MASTER_EXT *);
+
+void VehicleSensGetRevExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method);
+void VehicleSensGetRevExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data);
+void VehicleSensInitRevExtl(void);
+void VehicleSensSetRevExtlG(const LSDRV_LSDATA_G *pst_data);
+
+#endif
+
+void VehicleSensGetSpeedKmph(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitSpeedKmphl(void);
+u_int8 VehicleSensSetSpeedKmphl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetSpeedKmphlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetSpeedKmphl(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetGyroTemp(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method);
+void VehicleSensInitGyroTempl(void);
+u_int8 VehicleSensSetGyroTemplG(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetGyroTempl(VEHICLESENS_DATA_MASTER *pst_data);
+
+void VehicleSensGetGyroTempFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method);
+void VehicleSensInitGyroTempFstl(void);
+u_int8 VehicleSensSetGyroTempFstG(const LSDRV_LSDATA_FST_GYRO_TEMP *pst_data);
+void VehicleSensGetGyroTempFstl(VEHICLESENS_DATA_MASTER_FST *pst_data);
+
+void VehicleSensGetGyroTempExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method);
+void VehicleSensInitGyroTempExtl(void);
+void VehicleSensSetGyroTempExtlG(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetGyroTempExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data);
+
+void VehicleSensGetPulseTime(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method);
+void VehicleSensInitPulseTimel(void);
+u_int8 VehicleSensSetPulseTimelG(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetPulseTimel(VEHICLESENS_DATA_MASTER *pst_data);
+
+void VehicleSensGetPulseTimeExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method);
+void VehicleSensInitPulseTimeExtl(void);
+void VehicleSensSetPulseTimeExtlG(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetPulseTimeExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data);
+
+void VehicleSensGetRev(VEHICLESENS_DATA_MASTER *, u_int8);
+
+void VehicleSensInitRevl(void);
+u_int8 VehicleSensSetRevl(const LSDRV_LSDATA *);
+void VehicleSensGetRevl(VEHICLESENS_DATA_MASTER *);
+u_int8 VehicleSensSetRevlG(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetRevline(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetSpeedPulse(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitSpeedPulsel(void);
+u_int8 VehicleSensSetSpeedPulsel(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetSpeedPulselG(const LSDRV_LSDATA_G *);
+void VehicleSensGetSpeedPulsel(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetGpsAntenna(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitGpsAntennal(void);
+u_int8 VehicleSensSetGpsAntennal(const LSDRV_LSDATA *);
+void VehicleSensGetGpsAntennal(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensGetSnsCounter(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitSnsCounterl(void);
+u_int8 VehicleSensSetSnsCounterl(const LSDRV_LSDATA *);
+u_int8 VehicleSensSetSnsCounterlG(const LSDRV_LSDATA_G *);
+void VehicleSensGetSnsCounterl(VEHICLESENS_DATA_MASTER *);
+
+void VehicleSensInitGpsCounterg(void);
+u_int8 VehicleSensSetGpsCounterg(const SENSOR_MSG_GPSDATA_DAT *);
+void VehicleSensGetGpsCounterg(SENSOR_MSG_GPSDATA_DAT *);
+
+/* ++ PastModel002 support */
+/* U-BLOX_GPS MON-HW */
+void VehicleSensInitMonHwG(void);
+u_int8 VehicleSensSetMonHwG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetMonHwG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-CLOCK */
+void VehicleSensInitNavClockG(void);
+u_int8 VehicleSensSetNavClockG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavClockG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-DOP */
+void VehicleSensInitNavDopG(void);
+u_int8 VehicleSensSetNavDopG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavDopG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-POSLLH */
+void VehicleSensInitNavPosllhG(void);
+u_int8 VehicleSensSetNavPosllhG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavPosllhG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-STATUS */
+void VehicleSensInitNavStatusG(void);
+u_int8 VehicleSensSetNavStatusG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavStatusG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-SVINFO */
+void VehicleSensInitNavSvInfoG(void);
+u_int8 VehicleSensSetNavSvInfoG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavSvInfoG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-TIMEGPS */
+void VehicleSensInitNavTimeGpsG(void);
+u_int8 VehicleSensSetNavTimeGpsG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavTimeGpsG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-TIMEUTC */
+void VehicleSensInitNavTimeUtcG(void);
+u_int8 VehicleSensSetNavTimeUtcG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavTimeUtcG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* U-BLOX_GPS NAV-VELNED */
+void VehicleSensInitNavVelnedG(void);
+u_int8 VehicleSensSetNavVelnedG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetNavVelnedG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* DR SPEED_PULSE_FLAG */
+void VehicleSensInitSpeedPulseFlag(void);
+u_int8 VehicleSensSetSpeedPulseFlag(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetSpeedPulseFlag(VEHICLESENS_DATA_MASTER *);
+
+/* DR GPS_INTERRUPT_FLAG */
+void VehicleSensInitGpsInterruptFlag(void);
+u_int8 VehicleSensSetGpsInterruptFlag(const LSDRV_LSDATA_G *pst_data);
+void VehicleSensGetGpsInterruptFlag(VEHICLESENS_DATA_MASTER *);
+
+/* GYRO_TROUBLE */
+void VehicleSensInitGyroTrouble(void);
+u_int8 VehicleSensSetGyroTrouble(const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *pst_data);
+void VehicleSensGetGyroTrouble(VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_data);
+
+/* MAIN_GPS_INTERRUPT_SIGNAL */
+void VehicleSensInitMainGpsInterruptSignal(void);
+u_int8 VehicleSensSetMainGpsInterruptSignal(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetMainGpsInterruptSignal(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data);
+
+/* SYS_GPS_INTERRUPT_SIGNAL */
+void VehicleSensInitSysGpsInterruptSignal(void);
+u_int8 VehicleSensSetSysGpsInterruptSignal(const LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL *pst_data);
+void VehicleSensGetSysGpsInterruptSignal(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data);
+
+/* GYRO_CONNECT_STATUS */
+void VehicleSensInitGyroConnectStatus(void);
+u_int8 VehicleSensSetGyroConnectStatus(const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *pst_data);
+void VehicleSensGetGyroConnectStatus(VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_data);
+
+/* GPS_ANTENNA_STATUS */
+void VehicleSensInitGpsAntennaStatus(void);
+u_int8 VehicleSensSetGpsAntennaStatus(const LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS *pst_data);
+void VehicleSensGetGpsAntennaStatus(VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_data);
+
+/* -- PastModel002 support */
+
+/* GPS__CWORD82__FULLBINARY */
+void VehicleSensInitGps_CWORD82_FullBinaryG(void);
+u_int8 VehicleSensSetGps_CWORD82_FullBinaryG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetGps_CWORD82_FullBinaryG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* GPS__CWORD82__FULLBINARY */
+void VehicleSensInitGps_CWORD82__CWORD44_Gp4G(void);
+u_int8 VehicleSensSetGps_CWORD82__CWORD44_Gp4G(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetGps_CWORD82__CWORD44_Gp4G(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* GPS__CWORD82__NMEA */
+void VehicleSensInitGps_CWORD82_NmeaG(void);
+u_int8 VehicleSensSetGps_CWORD82_NmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetGps_CWORD82_NmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* GPS_NMEA */
+void VehicleSensInitGpsNmeaG(void);
+u_int8 VehicleSensSetGpsNmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data);
+void VehicleSensGetGpsNmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data);
+
+/* LOCATION_LONLAT */
+void VehicleSensGetLocationLonLat(VEHICLESENS_DATA_MASTER *pst_data, u_int8);
+void VehicleSensInitLocationLonLatG(void);
+u_int8 VehicleSensSetLocationLonLatG(const SENSORLOCATION_LONLATINFO_DAT*);
+void VehicleSensGetLocationLonLatG(VEHICLESENS_DATA_MASTER*);
+void VehicleSensInitLocationLonLatN(void);
+u_int8 VehicleSensSetLocationLonLatN(const SENSORLOCATION_LONLATINFO_DAT*);
+void VehicleSensGetLocationLonLatN(VEHICLESENS_DATA_MASTER*);
+void VehicleSensGetLocationLonLatnUnitCnv(VEHICLESENS_DATA_MASTER*);
+
+/* LOCATION_ALTITUDE */
+void VehicleSensGetLocationAltitude(VEHICLESENS_DATA_MASTER *pst_data, u_int8);
+void VehicleSensInitLocationAltitudeG(void);
+u_int8 VehicleSensSetLocationAltitudeG(const SENSORLOCATION_ALTITUDEINFO_DAT*);
+void VehicleSensGetLocationAltitudeG(VEHICLESENS_DATA_MASTER*);
+void VehicleSensInitLocationAltitudeN(void);
+u_int8 VehicleSensSetLocationAltitudeN(const SENSORLOCATION_ALTITUDEINFO_DAT*);
+void VehicleSensGetLocationAltitudeN(VEHICLESENS_DATA_MASTER*);
+
+/* MOTION_SPEED */
+void VehicleSensGetMotionSpeed(VEHICLESENS_DATA_MASTER *pst_data, u_int8);
+void VehicleSensInitMotionSpeedG(void);
+u_int8 VehicleSensSetMotionSpeedG(const SENSORMOTION_SPEEDINFO_DAT*);
+void VehicleSensGetMotionSpeedG(VEHICLESENS_DATA_MASTER*);
+void VehicleSensInitMotionSpeedN(void);
+u_int8 VehicleSensSetMotionSpeedN(const SENSORMOTION_SPEEDINFO_DAT*);
+void VehicleSensGetMotionSpeedN(VEHICLESENS_DATA_MASTER*);
+void VehicleSensInitMotionSpeedI(void);
+u_int8 VehicleSensSetMotionSpeedI(const SENSORMOTION_SPEEDINFO_DAT*);
+void VehicleSensGetMotionSpeedI(VEHICLESENS_DATA_MASTER*);
+
+/* MOTION_HEADING */
+void VehicleSensGetMotionHeading(VEHICLESENS_DATA_MASTER *pst_data, u_int8);
+void VehicleSensInitMotionHeadingG(void);
+u_int8 VehicleSensSetMotionHeadingG(const SENSORMOTION_HEADINGINFO_DAT*);
+void VehicleSensGetMotionHeadingG(VEHICLESENS_DATA_MASTER*);
+void VehicleSensInitMotionHeadingN(void);
+u_int8 VehicleSensSetMotionHeadingN(const SENSORMOTION_HEADINGINFO_DAT*);
+void VehicleSensGetMotionHeadingN(VEHICLESENS_DATA_MASTER*);
+void VehicleSensGetMotionHeadingnCnvData(VEHICLESENS_DATA_MASTER*);
+
+/* GPS_TIME */
+void VehicleSensGetGpsTime(SENSOR_MSG_GPSDATA_DAT*, u_int8);
+void VehicleSensInitGpsTimeG(void);
+u_int8 VehicleSensSetGpsTimeG(const SENSOR_MSG_GPSTIME*);
+void VehicleSensGetGpsTimeG(SENSOR_MSG_GPSDATA_DAT*);
+
+/* GPS_TIME_RAW */
+void VehicleSensGetGpsTimeRaw(SENSOR_MSG_GPSDATA_DAT*, u_int8);
+void VehicleSensInitGpsTimeRawG(void);
+u_int8 VehicleSensSetGpsTimeRawG(const SENSOR_GPSTIME_RAW*);
+void VehicleSensGetGpsTimeRawG(SENSOR_MSG_GPSDATA_DAT*);
+
+/* GPS_WKNROLLOVER */
+void VehicleSensGetWknRollover(VEHICLESENS_DATA_MASTER*, u_int8);
+void VehicleSensInitWknRolloverG(void);
+u_int8 VehicleSensSetWknRolloverG(const SENSOR_WKNROLLOVER*);
+void VehicleSensGetWknRolloverG(SENSOR_MSG_GPSDATA_DAT*);
+
+/* DIAG_GPS */
+void VehicleSensInitNaviinfoDiagGPSg(void);
+u_int8 VehicleSensSetNaviinfoDiagGPSg(const NAVIINFO_DIAG_GPS*);
+void VehicleSensGetNaviinfoDiagGPSg(SENSOR_MSG_GPSDATA_DAT*);
+
+/* SETTINGTIME */
+void VehicleSensGetSettingTime(VEHICLESENS_DATA_MASTER *, u_int8);
+void VehicleSensInitSettingTimeclock(void);
+u_int8 VehicleSensSetSettingTimeclock(const POS_DATETIME*);
+void VehicleSensGetSettingTimeclock(VEHICLESENS_DATA_MASTER*);
+
+/* GPS_CLOCK_DRIFT */
+void VehicleSensGetGpsClockDrift(SENSOR_MSG_GPSDATA_DAT *, u_int8);
+void VehicleSensInitGpsClockDriftG(void);
+u_int8 VehicleSensSetGpsClockDriftG(const int32_t*);
+void VehicleSensGetGpsClockDriftG(SENSOR_MSG_GPSDATA_DAT*);
+
+/* GPS_CLOCK_FREQ */
+void VehicleSensGetGpsClockFreq(SENSOR_MSG_GPSDATA_DAT *, u_int8);
+void VehicleSensInitGpsClockFreqG(void);
+u_int8 VehicleSensSetGpsClockFreqG(const uint32_t*);
+void VehicleSensGetGpsClockFreqG(SENSOR_MSG_GPSDATA_DAT*);
+
+/* LOCATION INFORMATION (NMEA) */
+void VehicleSens_GetLocationInfoNmea(VEHICLESENS_DATA_MASTER_GPS_FORMAT *, u_int8 );
+void VehicleSens_InitLocationInfoNmea_n(void);
+u_int8 VehicleSens_SetLocationInfoNmea_n( const POS_LOCATIONINFO_NMEA * );
+void VehicleSens_GetLocationInfoNmea_n(VEHICLESENS_DATA_MASTER_GPS_FORMAT * );
+
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DATAMASTER_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_DeliveryCtrl.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_DeliveryCtrl.h
new file mode 100755
index 0000000..3fb7056
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_DeliveryCtrl.h
@@ -0,0 +1,253 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DELIVERYCTRL_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DELIVERYCTRL_H_
+/******************************************************************************
+ * File name :VehicleSens_DeliveryCtrl.h
+ * System name :_CWORD107_
+ * Subsystem name :
+ ******************************************************************************/
+
+#include "Vehicle_API_Dummy.h"
+#include "Sensor_API.h"
+#include "Vehicle_API_private.h"
+#include "Sensor_API_private.h"
+#include "VehicleSens_SelectionItemList.h"
+#include "VehicleSens_DataMaster.h"
+#include "Dead_Reckoning_Local_Api.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define VEHICLESENS_CANID_EFFECTIVE 29 /* CAN ID Effective number */
+#define VEHICLESENS_CANID_RESERVE 11 /* CAN ID Reserved number */
+#define VEHICLESENS_SIGNAL VEHICLESENS_SELECTION_ITEM_LIST_LEN /* Number of vehicle signals */
+#define VEHICLESENS_DELIVERY 10 /* Number of delivery destinations */
+/* CAN ID Maximum number */
+#define VEHICLESENS_CANID_MAX (VEHICLESENS_CANID_EFFECTIVE + VEHICLESENS_CANID_RESERVE)
+/* Vehicle sensor information */
+#define VEHICLESENS_DELIVERY_INFO (VEHICLESENS_CANID_MAX + VEHICLESENS_SIGNAL)
+/* Maximum number of vehicle sensor information */
+#define VEHICLESENS_DELIVERY_INFO_MAX (VEHICLESENS_DELIVERY_INFO * VEHICLESENS_DELIVERY)
+/* Vehicle Sensor Information Valid Number */
+#define VEHICLESENS_DID_EFFECTIVE (VEHICLESENS_CANID_EFFECTIVE + VEHICLESENS_SIGNAL)
+#define VEHICLESENS_ACTION_TYPE_ADD 0 /* Vehicle sensor addition processing */
+#define VEHICLESENS_ACTION_TYPE_UPDATE 1 /* Vehicle sensor update processing */
+#define VEHICLESENS_LINK_INDEX_END 0xFFFF /* End of the link index */
+
+
+#define VEHICLESENS_PKG_DELIVERY_INFO_MAX 2560 /* Maximum number of vehicle sensor information */
+#define VEHICLESENS_DELIVERY_METHOD_NORMAL 0 /* Delivery system normal delivery */
+#define VEHICLESENS_DELIVERY_METHOD_PACKAGE 1 /* Delivery system package delivery */
+#define VEHICLESENS_PKG_EXT_SEND_MAX 10 /* Number of data master transmissions/onece */
+#define VEHICLESENS_PKG_EXT_SEND_MAX_10DATA 100 /* Number of data masters transmitted (GYRO),SPEED)/once */
+
+#define VEHICLESENS_DELIVERY_MAX_SIZE SENSOR_MSG_VSINFO_DSIZE /* Maximum Size of Delivery */
+#define VEHICLESENS_DELIVERY_FSTSNS_HDR_SIZE 8 /* Initial Sensor Data Delivery Data Header Size */
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_LIST_CANID
+* ABSTRACT : CAN data delivery registration request information
+***********************************************************************/
+typedef struct {
+ u_int8 uc_can_num; /* CANID delivery registrations */
+ u_int8 uc_reserve[3];
+ u_int32 ul_can_id[VEHICLESENS_CANID_MAX]; /* Delivery registrationCANID */ /* CANIF_API deletion */
+} VEHICLESENS_DELIVERY_LIST_CANID;
+
+/*********************************************************************
+* TAG :VEHICLESENS_DELIVERY_CTRL_TBL_DATA
+* ABSTRACT : Structure of each data of the vehicle sensor delivery destination management table
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ PNO us_pno; /* Shipping PID */
+ u_int8 uc_chg_type; /* Delivery timing */
+ u_int8 uc_ctrl_flg; /* Delivery operation */
+ u_int16 us_link_idx; /* Link index */
+ u_int16 us_pkg_start_idx; /* Package Delivery Start Index */
+ u_int16 us_pkg_end_idx; /* Package delivery end index */
+ u_int8 uc_method; /* Delivery system */
+ u_int8 uc_reserve; /* reserve */
+ /* Modify to store the destination service name TODO */
+ /* Add handles as needed TODO */
+} VEHICLESENS_DELIVERY_CTRL_TBL_DATA;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_CTRL_TBL
+* ABSTRACT : Vehicle Sensor Delivery Destination Management Table Structure
+***********************************************************************/
+typedef struct {
+ u_int16 us_dnum; /* Number of delivery destination management data items */
+ u_int8 uc_reserve[2]; /* Reserved */
+ /* Array of each data */
+ VEHICLESENS_DELIVERY_CTRL_TBL_DATA st_ctrl_data[VEHICLESENS_DELIVERY_INFO_MAX];
+} VEHICLESENS_DELIVERY_CTRL_TBL;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA
+* ABSTRACT : Structure of each data of Vehicle Sensor Destination Management Table Management
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 us_start_idx; /* Start index */
+ u_int16 us_end_idx; /* End index */
+ u_int16 usdlvry_entry_num; /* Number of registered shipping addresses */
+ u_int8 uc_reserve[2]; /* Reserved */
+} VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_CTRL_TBL_MNG
+* ABSTRACT : Structure of Vehicle Sensor Delivery Destination Management Table Management
+***********************************************************************/
+typedef struct {
+ u_int16 us_dnum; /* Number of data items */
+ u_int8 uc_reserve[2]; /* Reserved */
+ /* Array of each data */
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA st_ctrl_tbl_mng_data[VEHICLESENS_DELIVERY_INFO];
+} VEHICLESENS_DELIVERY_CTRL_TBL_MNG;
+
+/*********************************************************************
+* TAG : VEHICLESENS_PKG_DELIVERY_TBL_MNG_DATA
+* ABSTRACT : Structure of each data of the vehicle sensor package delivery management table
+***********************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int16 usdlvry_idx; /* Delivery data index */
+ u_int8 uc_reserve[2]; /* Reserved */
+} VEHICLESENS_PKG_DELIVERY_TBL_MNG_DATA;
+
+
+/*********************************************************************
+* TAG : VEHICLESENS_PKG_DELIVERY_TBL_MNG
+* ABSTRACT : Structure of Vehicle Sensor Package Delivery Management Table
+***********************************************************************/
+typedef struct {
+ u_int16 us_dnum; /* Number of data items */
+ u_int8 uc_reserve[2]; /* Reserved */
+ /* Array of each data */
+ VEHICLESENS_PKG_DELIVERY_TBL_MNG_DATA st_pkg_data[VEHICLESENS_PKG_DELIVERY_INFO_MAX];
+} VEHICLESENS_PKG_DELIVERY_TBL_MNG;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_PNO_TBL
+* ABSTRACT : Vehicle Sensor Destination PNO Table
+***********************************************************************/
+typedef struct {
+ PNO us_pno; /* Thread ID */
+ u_int16 us_pkg_start_idx; /* Package Delivery Start Index */
+ u_int16 us_pkg_end_idx; /* Package delivery end index */
+ u_int8 uc_method; /* Delivery system */
+ u_int8 uc_reserve; /* reserve */
+} VEHICLESENS_DELIVERY_PNO_TBL_DAT;
+
+typedef struct {
+ u_int16 us_dnum; /* Number of data items */
+ u_int8 uc_reserve[2]; /* reserve */
+ VEHICLESENS_DELIVERY_PNO_TBL_DAT st_pno_data[VEHICLESENS_DELIVERY_INFO_MAX];
+} VEHICLESENS_DELIVERY_PNO_TBL;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_HEADER
+* ABSTRACT : Delivery data header
+***********************************************************************/
+typedef struct {
+ DID did; /* Data ID */
+ u_int16 size; /* Size of the data */
+ u_int8 rcv_flag; /* Receive flag */
+ u_int8 sensor_cnt; /* Sensor Counter */
+} VEHICLESENS_DELIVERY_HEADER;
+
+/*********************************************************************
+* TAG : VEHICLESENS_DELIVERY_FORMAT
+* ABSTRACT : Delivery data format
+***********************************************************************/
+typedef struct {
+ VEHICLESENS_DELIVERY_HEADER header; /* Header */
+ u_int8 data[VEHICLESENS_DELIVERY_MAX_SIZE]; /* Data */
+} VEHICLESENS_DELIVERY_FORMAT;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void VehicleSensInitDeliveryCtrlTbl(void);
+void VehicleSensInitDeliveryCtrlTblMng(void);
+void VehicleSensInitPkgDeliveryTblMng(void);
+VEHICLE_RET_API VehicleSensEntryDeliveryCtrl(const VEHICLE_MSG_DELIVERY_ENTRY *);
+void VehicleSensAddDeliveryCtrlTbl(const VEHICLE_MSG_DELIVERY_ENTRY *);
+void VehicleSensUpdateDeliveryCtrlTbl(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *);
+void VehicleSensUpdatePkgDeliveryCtrlTbl(u_int16, u_int16);
+void VehicleSensAddDeliveryCtrlTblMng(const VEHICLE_MSG_DELIVERY_ENTRY *);
+void VehicleSensUpdateDeliveryCtrlTblMng(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *);
+void VehicleSensAddPkgDeliveryTblMng(const SENSOR_MSG_DELIVERY_ENTRY *);
+VEHICLE_RET_API VehicleSensEntryPkgDeliveryCtrl(const SENSOR_MSG_DELIVERY_ENTRY *, u_int8 uc_ext_chk);
+VEHICLESENS_DELIVERY_PNO_TBL* VehicleSensMakeDeliveryPnoTbl(DID ul_did, u_int8 change_type);
+void VehicleSensAddPnoTbl(u_int16);
+u_int8 VehicleSensDeliveryGPS(DID ul_did, u_int8 uc_get_method, u_int8 uc_current_get_method, int32 pno_index,
+ u_int32* cid, VEHICLESENS_DATA_MASTER* stmaster,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl);
+u_int8 VehicleSensDeliveryFst(DID ul_did, u_int8 uc_get_method, int32 pno_index,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl);
+u_int8 VehicleSensDeliveryGyro(DID ul_did, u_int8 uc_current_get_method, int32 pno_index,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl);
+void VehicleSensDeliveryAntenna(DID ul_did, u_int8 uc_current_get_method, int32 pno_index,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl);
+u_int8 VehicleSensDeliveryOther(DID ul_did, u_int8 uc_current_get_method, int32 pno_index,
+ u_int32* cid,
+ VEHICLESENS_DATA_MASTER* stmaster,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl);
+void VehicleSensDeliveryProc(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method);
+u_int8 VehicleSensFirstDeliverySens(PNO us_pno, DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_FST* stmaster_fst,
+ VEHICLESENS_DATA_MASTER_FST* stmaster_fst_temp);
+u_int8 VehicleSensFirstDeliveryOther(PNO us_pno, DID ul_did, u_int8 uc_get_method,
+ u_int32* cid,
+ VEHICLESENS_DATA_MASTER* stmaster);
+void VehicleSensFirstDelivery(PNO us_pno, DID ul_did);
+void VehicleSensFirstPkgDelivery(const SENSOR_MSG_DELIVERY_ENTRY_DAT *);
+RET_API VehicleSensCanDeliveryEntry(void);
+void VehicleSensFirstPkgDelivery(const SENSOR_MSG_DELIVERY_ENTRY_DAT *);
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+void VehicleSensFirstPkgDeliveryExt(const SENSOR_MSG_DELIVERY_ENTRY_DAT *pst_data);
+#endif
+
+#if CONFIG_HW_PORTSET_TYPE_C
+void VehicleSensInitSeqNum(void);
+void VehicleSensDivideDeliveryProc(PNO, const void *);
+#endif
+
+/* ++ PastModel002 support DR */
+void VehicleSensInitDeliveryCtrlTblDR(void);
+void VehicleSensInitDeliveryCtrlTblMngDR(void);
+VEHICLE_RET_API VehicleSensEntryDeliveryCtrlDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+void VehicleSensAddDeliveryCtrlTblDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+void VehicleSensAddDeliveryCtrlTblMngDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *);
+void VehicleSensUpdateDeliveryCtrlTblDR(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *);
+void VehicleSensUpdateDeliveryCtrlTblMngDR(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *);
+void VehicleSensDeliveryProcDR(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method);
+VEHICLESENS_DELIVERY_PNO_TBL* VehicleSensMakeDeliveryPnoTblDR(DID ul_did, u_int8 change_type);
+void VehicleSensAddPnoTblDR(u_int16 us_index);
+void VehicleSensGetDebugDeliveryCtrlTbl(void* pbuf);
+void VehicleSensGetDebugDeliveryCtrlTblMng(void* pbuf);
+void VehicleSensGetDebugPkgDeliveryTblMng(void* pbuf);
+void VehicleSensGetDebugDeliveryPnoTbl(void* pbuf);
+/* -- PastModel002 supprt DR */
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_DELIVERYCTRL_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_FromAccess.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_FromAccess.h
new file mode 100755
index 0000000..e58b059
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_FromAccess.h
@@ -0,0 +1,69 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_FROMACCESS_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_FROMACCESS_H_
+/******************************************************************************
+ * File name :VehicleSens_FromAccess.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+#include <stdio.h>
+#include <stdint.h>
+#include "Sensor_API.h"
+#include "SensorLocation_API.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#define NV_FILE_VEHICLESENS "/fs/tmpfs/VehicleSens_nv_data.bin"
+#define NV_FILE_VEHICLESENS_TEMP "/fs/tmpfs/VehicleSens_nv_data_temp.bin"
+#define NV_FILE_VEHICLESENS2 "/fs/tmpfs/VehicleSens_nv_data_2nd.bin"
+#define NV_FILE_VEHICLESENS2_TEMP "/fs/tmpfs/VehicleSens_nv_data_2nd_temp.bin"
+#define NV_LOAD_WAIT_TIME_VEHICLESENS 100U
+#define NV_UPDATE_CYCLE_LONLAT 100U
+#define NV_UPDATE_CYCLE_LOCALTIME 10U
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+typedef struct {
+ LOCALTIME localtime;
+ LONLAT lonlat;
+ int32 timediff;
+ u_int32 update_counter;
+ u_int8 reserve[2];
+ u_int8 cka;
+ u_int8 ckb;
+} NV_DATA_VEHICLESENS;
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void VehicleSensFromAccessInitialize(void);
+RET_API VehicleSensRegistNvTag(void);
+RET_API VehicleSensReadNVLocalTime(LOCALTIME * local_time);
+RET_API VehicleSensReadNVLonLat(LONLAT * lonlat);
+RET_API VehicleSensReadNVTimeDiff(int32 * time_diff);
+void VehicleSensStoreLonlat(LONLAT * plonlat);
+RET_API VehicleSensWriteNVLocaltime(LOCALTIME * local_time, int32 * time_diff);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_FROMACCESS_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_SelectionItemList.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_SelectionItemList.h
new file mode 100755
index 0000000..15004e8
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_SelectionItemList.h
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SELECTIONITEMLIST_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SELECTIONITEMLIST_H_
+/****************************************************************************
+ * File name :VehicleSens_SelectionItemList.h
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ ****************************************************************************/
+
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+#include "VehicleSens_Common.h"
+#include "VehicleIf.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/* ++ Addition of DID9 related to PastModel002 supported_UBX commands */
+/* ++ GPS _CWORD82_ support (To add the target DID 3) */
+#define VEHICLESENS_SELECTION_ITEM_LIST_LEN (87) /* Number of data in Vehicle Sensor Selection Item List */
+/* -- GPS _CWORD82_ support */
+#else
+#define VEHICLESENS_SELECTION_ITEM_LIST_LEN (63) /* Number of data in Vehicle Sensor Selection Item List */
+/* -- PastModel002 support */
+#endif
+/* Sum of bits 29 through 31*/
+#define VEHICLESENS_BIT31_29 (VEHICLESENS_BIT31 | VEHICLESENS_BIT30 | VEHICLESENS_BIT29)
+
+#define VEHICLESENS_ITEMLIST_APPLICATION 0x00 /* Application of electronic PF */
+#define VEHICLESENS_ITEMLIST_NON_APPLICATION 0x01 /* Electronic PF not applicable */
+#define VEHICLESENS_ITEMLIST_INVALID 0x02 /* Disabled */
+
+#define VEHICLE_COMM_WATCHTBL_DAT_NUM 64 /* Number of data held for communication discontinuation registration */
+#define VEHICLE_COMM_WATCHTBL_DID_NUM 2 /* Number of Disruption Monitoring Data Management */
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/*********************************************************************
+* TAG : VEHICLESENS_SELECTION_ITEM_LIST
+* ABSTRACT : Managing a list of vehicle information choices
+***********************************************************************/
+
+typedef struct {
+ DID ul_did; /* Data ID */
+ u_int32 ul_canid; /* CAN ID */ /* CANIF_API deletion */
+ u_int8 uc_get_method; /* Data acquisition source category */
+ u_int8 reserve[3]; /* reserve */
+} VEHICLESENS_SELECTION_ITEM_LIST;
+
+/************************************************************************
+* TAG : VEHICLE_COMM_WATCH_TBL
+* ABSTRACT : Managing Vehicle Sensor Disruption Monitoring Data
+************************************************************************/
+typedef struct {
+ PNO us_pno; /* Destination PNO */
+ u_int16 us_watch_time; /* Interruption monitoring time(Units of 100 ms) */
+} VEHICLE_COMM_WATCH_DAT;
+
+typedef struct {
+ DID ul_did; /* Data ID corresponding to vehicle sensor information */
+ u_int8 uc_effective_flg; /* CANID Valid Flag */
+ u_int8 uc_vehicle_comm_watch_cnt; /* Vehicle Sensor Information Disruption Monitoring Request Count */
+ VEHICLE_COMM_WATCH_DAT st_comm_watch_dat[VEHICLE_COMM_WATCHTBL_DAT_NUM]; /* Communication disruption registration data */
+} VEHICLE_COMM_WATCH_TBL;
+
+/* ++ PastModel002 support */
+/************************************************************************
+* TAG : VEHICLE_MSG_WATCH_STOPPAGE
+* ABSTRACT : Vehicle Sensor Disruption Monitoring Message(-> Vehicle sensor)
+************************************************************************/
+typedef struct {
+ DID ul_did; /* Data ID corresponding to vehicle sensor information */
+ PNO us_pno; /* Destination PNO */
+ u_int16 us_watch_time; /* Interruption monitoring time(Units of 100 ms) */
+ u_int16 us_offset; /* Offset to shared memory storage area */
+ u_int16 us_size; /* Size of shared memory storage area */
+ EventID ul_eventid; /* Event ID */
+} VEHICLE_MSG_WATCH_STOPPAGE_DAT;
+
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER st_hdr; /* Message header */
+ VEHICLE_MSG_WATCH_STOPPAGE_DAT st_data; /* Message data */
+} VEHICLE_MSG_WATCH_STOPPAGE;
+
+/* -- PastModel002 support */
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+void VehicleSensInitSelectionItemList(void);
+u_int8 VehicleSensGetSelectionItemList(DID);
+u_int32 VehicleSensGetSelectionItemListCanId(DID);
+BOOL VehicleSensSetSelectionItemListCanId(DID did, u_int32); /* CANIF_API deletion */
+void VehicleSensCommWatchTblInit(void);
+BOOL VehicleSensCommWatchTblSave(const VEHICLE_MSG_WATCH_STOPPAGE*);
+BOOL VehicleSensCommWatchTblRun(DID);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SELECTIONITEMLIST_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_SharedMemory.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_SharedMemory.h
new file mode 100755
index 0000000..54878ec
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_SharedMemory.h
@@ -0,0 +1,48 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SHAREDMEMORY_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SHAREDMEMORY_H_
+/******************************************************************************
+ * File name :VehicleSens_SharedMemory.h
+ * System name :PastModel002
+ * Subsystem name :
+ ******************************************************************************/
+
+#include "Vehicle_API.h"
+#include "Sensor_Common_API.h"
+#include "VehicleSens_FromAccess.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+
+/************************************************************************
+* Typedef definitions *
+************************************************************************/
+
+/************************************************************************
+* Struct definitions *
+************************************************************************/
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+RET_API VehicleSensInitSharedMemory(void);
+void VehicleSensWriteSharedMemory(DID ul_did);
+RET_API VehicleSensWriteDataValidEphemerisNum(u_int8 valid_ephemer_isnum);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_SHAREDMEMORY_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_Thread.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_Thread.h
new file mode 100755
index 0000000..17a342d
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSens_Thread.h
@@ -0,0 +1,185 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_THREAD_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_THREAD_H_
+/******************************************************************************
+ * File name :VehicleSens_Thread.h
+ * System name :_CWORD107_
+ * Subsystem name :
+ ******************************************************************************/
+
+#include "Vehicle_API_Dummy.h"
+#include "Sensor_API.h"
+#include "Vehicle_API_private.h"
+#include "Sensor_API_private.h"
+#include "VehicleSens_Common.h"
+#include "VehicleSens_SelectionItemList.h"
+#include "VehicleSens_DataMaster.h"
+#include "VehicleSens_DeliveryCtrl.h"
+#include "VehicleSens_SharedMemory.h"
+#include "CanInput_API.h"
+#include "CanInput_API_private.h"
+#include "VehicleDebug_API.h"
+#include "VehicleSens_FromAccess.h"
+#include "ClockDataMng.h"
+#include "gps_hal.h"
+#include "positioning_hal.h"
+#include "CommonDefine.h"
+
+/* ++ DR support */
+#include "DeadReckoning_main.h"
+#include "Dead_Reckoning_Local_Api.h"
+/* -- DR support */
+
+#include "POS_common_private.h"
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+
+/* ++ Porting from PastModel002 enabled APIs */
+#define CID_VEHICLEIF_GET_VEHICLE_DATA 0x0102 /* Vehicle sensor information acquisition CID */
+#define CID_VEHICLEIF_COMM_WATCH 0x0103 /* Vehicle Sensor Information Disruption Monitoring CID */
+#define CID_SENSORIF__CWORD82__REQUEST 0x0800 /* Vehicle sensor information setting CID */
+
+#define VEHICLE_RET_ERROR_OUTOF_MEMORY (-8) /* Shared memory allocation failure */
+#define VEHICLE_RET_ERROR_INVALID (-10) /* CANID undetermined */
+
+/* -- Porting from PastModel002 enabled APIs */
+
+
+/* NMEA */
+#define VEHICLESENS_NMEA_LF "\n"
+#define VEHICLESENS_NMEA_CR "\r"
+#define VEHICLESENS_NMEA_FIELDDELIMITER ","
+#define VEHICLESENS_NMEA_DECIMALPOINT "."
+#define VEHICLESENS_NMEA_ASTARISK "*"
+
+#define VEHICLESENS_NMEA_PASCD_LEN_MAX 256
+
+#define VEHICLESENS_NMEA_PASCD_ID "$PASCD"
+
+#define VEHICLESENS_NMEA_PASCD_TS_MAX 86400
+#define VEHICLESENS_NMEA_PASCD_TS_INT_LEN_MAX 6 /* max length of integer part of timestamp */
+#define VEHICLESENS_NMEA_PASCD_TS_FRA_LEN_MAX 3 /* max length of fractional part of timestamp */
+
+#define VEHICLESENS_NMEA_PASCD_SENSORTYPE_C "C" /* Combined left and right wheel speed sensors */
+
+#define VEHICLESENS_NMEA_PASCD_TMS_U "U" /* Unkonwn */
+#define VEHICLESENS_NMEA_PASCD_TMS_P "P" /* Park */
+#define VEHICLESENS_NMEA_PASCD_TMS_R "R" /* Reverse */
+#define VEHICLESENS_NMEA_PASCD_TMS_D "D" /* Driving forword */
+#define VEHICLESENS_NMEA_PASCD_TMS_N "N" /* Neutral */
+
+#define VEHICLESNES_NMEA_PASCD_SLIP "1" /* 1 = a wheel speed slippage was detected */
+#define VEHICLESNES_NMEA_PASCD_NOSLIP "0" /* 0 = no slip was detected */
+
+#define VEHICLESENS_NMEA_PASCD_TO_FRA_LEN_MAX 2 /* max length of fractional part of timeoffset */
+
+#define VEHICLESENS_NMEA_PASCD_SPD_FRA_LEN_MAX 3 /* max length of fractional part of speed */
+
+#define VEHICLESENS_NMEA_PASCD_SAMPLECOUNT_MAX 50
+
+/************************************************************************
+ * Struct definitions *
+ ************************************************************************/
+
+/*!
+ @brief Structure of Vehicle Speed and TimeSpec
+ */
+typedef struct {
+ timespec ts;
+ uint16_t speed; /* [0.01m/s] */
+} VEHICLESENS_VEHICLE_SPEED_DAT;
+
+/*!
+ @brief Structure of Vehilce Speeds and TimeSpecs
+ */
+typedef struct {
+ VEHICLESENS_VEHICLE_SPEED_DAT listSpd[VEHICLESENS_NMEA_PASCD_SAMPLECOUNT_MAX];
+ uint8_t sampleCount;
+} VEHICLESENS_VEHICLE_SPEED_INFO;
+
+/*!
+ @brief Structure for LUT to Derive Transmission State
+ */
+typedef struct {
+ uint8_t type; /* Transmission Type */
+ uint8_t shift; /* Shift Position from Vehicle */
+
+ uint8_t pkb; /* Parking Brake from Vehicle */
+ char state[8]; /* Transmission State for _CWORD27_ */
+} VEHICLESENS_TRANSMISSION_PKG;
+
+/************************************************************************
+ * TAG : VEHICLE_MSG_SEND_DAT
+ * ABSTRACT : Vehicle sensor information setting message(-> Vehicle sensor)
+ ************************************************************************/
+
+
+
+/************************************************************************
+* Function prototype *
+************************************************************************/
+EFrameworkunifiedStatus VehicleSensThread(HANDLE h_app);
+RET_API VehicleSensThreadInit(void);
+void VehicleSensDeliveryEntry(const VEHICLE_MSG_DELIVERY_ENTRY *);
+void VehicleSensGetVehicleData(const VEHICLE_MSG_GET_VEHICLE_DATA *);
+void VehicleSensWatchStopPage(const VEHICLE_MSG_WATCH_STOPPAGE *);
+void VehicleSensPkgDeliveryEntry(const SENSOR_MSG_DELIVERY_ENTRY *);
+void VehicleSensGetVehiclePkgData(const SENSOR_MSG_GET_SENSOR_DATA *);
+void VehicleSensLineSensDataDelivery(const LSDRV_MSG_LSDATA *, PFUNC_DMASTER_SET_N);
+void VehicleSensLineSensDataDeliveryG(const LSDRV_MSG_LSDATA_G *, PFUNC_DMASTER_SET_N);
+void VehicleSensLineSensDataDeliveryGyroTrouble(const LSDRV_MSG_LSDATA_GYRO_TROUBLE *msg,
+ PFUNC_DMASTER_SET_N p_datamaster_set_n);
+void VehicleSensLineSensDataDeliverySysGpsInterruptSignal(const LSDRV_MSG_LSDATA_GPS_INTERRUPT_SIGNAL *msg,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory);
+void VehicleSensLineSensDataDeliveryGyroConnectStatus(const LSDRV_MSG_LSDATA_GYRO_CONNECT_STATUS *msg,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory);
+void VehicleSensLineSensDataDeliveryGpsAntennaStatus(const LSDRV_MSG_LSDATA_GPS_ANTENNA_STATUS *msg,
+ PFUNC_DMASTER_SET_N p_datamaster_set_n);
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+void VehicleSensPkgDeliveryEntryExt(const SENSOR_MSG_DELIVERY_ENTRY *msg);
+void VehicleSensLineSensDataDeliveryFst(const LSDRV_MSG_LSDATA_FST *, PFUNC_DMASTER_SET_N);
+void VehicleSensLineSensDataDeliveryFstG(const LSDRV_MSG_LSDATA_FST *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n);
+#else
+void VehicleSensPkgDeliveryEntryError(const SENSOR_MSG_DELIVERY_ENTRY *msg);
+#endif
+void VehicleSensGpsDataDelivery(SENSOR_MSG_GPSDATA *msg,
+ PFUNC_DMASTER_SET_N p_datamaster_set_n,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory);
+
+void VehicleSensDataMasterSetN(DID did, u_int8 chg_type, u_int8 get_method);
+void VehicleSensDataMasterSetSharedMemory(DID did, u_int8 chg_type);
+/* ++ GPS _CWORD82_ support */
+void VehicleSensSetVehicleData(const VEHICLE_MSG_SEND *);
+/* -- GPS _CWORD82_ support */
+
+void VehicleSensDrDeliveryEntry(const VEHICLE_MSG_DELIVERY_ENTRY *);
+void VehicleSensGetLog(const VEHICLEDEBUG_MSG_BUF* msg);
+void VehicleSensSetLog(const VEHICLEDEBUG_MSG_BUF* msg);
+void VehicleSensWriteLocalTime(const CANINPUT_MSG_INFO *msg);
+void VehicleSensSetEphNumSharedMemory(const SENSOR_MSG_GPSDATA *msg);
+void VehicleSensDrRcvMsg(const DEAD_RECKONING_RCVDATA *msg);
+
+void VehicleSensCommonDataDelivery(const VEHICLE_MSG_BUF *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n);
+void VehicleSensGpsTimeSndMsg(const POS_MSGINFO *pos_msg);
+void VehicleSensGpsTimeDelivery(const VEHICLE_MSG_BUF *msg);
+RET_API VehicleSensSendEvent(uint16_t snd_pno, int32_t event_val);
+void VehicleSensThreadStopProcess(void);
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_THREAD_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSensor_Thread.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSensor_Thread.h
new file mode 100755
index 0000000..f40f2a7
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleSensor_Thread.h
@@ -0,0 +1,33 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+ * File name :vehiclesensor_thread.h
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Title :Prototype Declaration of Thread Entry Function of Vehicle Sensor Process
+ ****************************************************************************/
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENSOR_THREAD_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENSOR_THREAD_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+/***********************************************************************
+* Thread entry function prototype *
+************************************************************************/
+EFrameworkunifiedStatus VehicleSensThread(HANDLE h_app);
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENSOR_THREAD_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleUtility.h b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleUtility.h
new file mode 100755
index 0000000..e7ebef0
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/Sensor/VehicleUtility.h
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleUtility.h
+@detail Common processing function header file of Vehicle<BR>
+ Vehicle Common Functions Header Files
+*****************************************************************************/
+#ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLEUTILITY_H_
+#define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLEUTILITY_H_
+
+#include <stdint.h>
+#include <vehicle_service/positioning_base_library.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*------------------------------------------------------------------------------*
+ * Definition *
+ *------------------------------------------------------------------------------*/
+/* GPS-related timer value */
+#define TIMVAL_GPS_STARTUP 500 /* 5Sec Start confirmation monitoring timer */
+#define TIMVAL_GPS_RCVCYCLDAT 500 /* 5Sec Periodic reception data monitoring timer */
+#define TIMVAL_GPS_RCVACK 500 /* 5Sec ACK reception monitoring timer */
+#define TIMVAL_GPS_RCVDAT 500 /* 5Sec Data reception monitoring timer(Not used) */
+#define TIMVAL_GPS_NAVIFST 3000 /* 30sec Initial Navigation Monitoring Timer */
+#define TIMVAL_GPS_NAVICYCLE 300 /* 3sec Navi monitoring timer */
+#define TIMVAL_GPS_NAVIDISRPT 1000 /* 10Sec Navigation Monitoring Disruption Log Output Timer */
+#define TIMVAL_GPS_DIAGCLKGUARD 1000 /* 10sec Diag provision time guard monitoring timer */
+#define TIMVAL_GPS_NMEADATAGUARD 1000 /* 10sec NMEA data-providing guard monitoring timer */
+#define TIMVAL_GPS_RECOVERY 60000 /* 600sec GPS recovery timer */
+#define TIMVAL_GPS_RECEIVERERR 60000 /* 600sec GPS receiver anomaly detection timer */
+
+/* Sensor-related timer value */
+#define TIMVAL_SNS_RCVFSTDAT 3000 /* 30Sec Initial sensor data reception monitoring timer */
+#define TIMVAL_SNS_RCVCYCLDAT 300 /* 3Sec Cyclic sensor data reception monitoring timer */
+#define TIMVAL_SNS_RCVDISRPT 1000 /* 10Sec Cyclic sensor data interruption log output timer */
+
+/* Timer management table */
+#define TIM_NON 0x00 /* Timer counter initial value */
+#define TIM_CNTMIN 0x01 /* Timer counter minimum value */
+#define TIM_CNTMAX 0xff /* Maximum value of timer counter */
+#define TIMER_OFF 0 /* Timer enable flag OFF */
+#define TIMER_ON 1 /* Timer enable flag ON */
+
+/*------------------------------------------------------------------------------*
+ * Structure *
+ *------------------------------------------------------------------------------*/
+/*!
+ @brief Timer type
+ */
+typedef enum _VEHICLEUTILITY_TIM_KIND {
+ GPS_STARTUP_TIMER = 0, /* 0 Start confirmation monitoring timer */
+ GPS_CYCL_TIMER, /* 1 Cyclic GPS data reception monitoring timer */
+ GPS_RECV_ACK_TIMER, /* 2 ACK reception monitoring timer */
+ GPS_NAVIFST_TIMER, /* 3 Initial Navigation Monitoring Timer */
+ GPS_NAVICYCLE_TIMER, /* 4 Navi monitoring timer */
+ GPS_NAVIDISRPT_TIMER, /* 5 Navigation Monitoring Disruption Log Output Timer */
+ GPS_DIAGCLK_GUARDTIMER, /* 6 Diag provision time guard monitoring timer */
+ GPS_NMEADATA_GUARDTIMER, /* 7 NMEA data-providing guard monitoring timer */
+ GPS_RECOVERY_TIMER, /* 8 GPS recovery timer */
+ GPS_RECEIVERERR_TIMER, /* 9 GPS receiver anomaly detection timer */
+ SNS_FST_TIMER, /* 10 Initial sensor data reception monitoring timer */
+ SNS_CYCLE_TIMER, /* 11 Cyclic sensor data reception monitoring timer */
+ SNS_DISRPT_TIMER, /* 12 Cyclic sensor data interruption log output timer */
+ TIM_NUM /* 13 Number of timer types */
+} VEHICLEUTILITY_TIM_KIND;
+
+/*!
+ @brief Master status
+*/
+typedef struct {
+ u_int8 flag; /**< Timer flag OFF:Stop,ON:Start */
+ u_int8 cnt; /**< Start counter */
+ int8 rsv[2]; /**< Reserved */
+} VEHICLEUTILITY_TIM_STS;
+
+/*!
+ @brief Master status management table
+ */
+typedef struct {
+ VEHICLEUTILITY_TIM_STS sts[TIM_NUM]; /**< Master status */
+} VEHICLEUTILITY_TIM_MNG;
+
+/*!
+ @brief Timer setting information table
+*/
+typedef struct {
+ uint32_t timer_val; /**< Timer value */
+ PNO pno; /**< Event notification destination process number */
+} VEHICLEUTILITY_TIM_INFO;
+
+/*
+ Function prototype declaration
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API VehicleUtilitySndMsg(PNO pno, u_int16 size, void *msgbuf, u_int16 mode);
+RET_API VehicleUtilityRcvMsg(PNO pno, u_int16 size, void **msgbuf, u_int16 mode);
+void VehicleUtilityDiagCodePut(u_int32 err_id, u_int16 positioning_code);
+void VehicleUtilityInitTimer(void);
+BOOL VehicleUtilitySetTimer(VEHICLEUTILITY_TIM_KIND tim_kind);
+BOOL VehicleUtilityStopTimer(VEHICLEUTILITY_TIM_KIND tim_kind);
+BOOL VehicleUtilityTimeJdgKnd(uint16_t seqno);
+
+void LineSensDrvExtTermStsReq(void);
+RET_API DEVGpsSndBackupDataLoadReq(void);
+void DEVGpsGetDebugGpsFormatFailCnt(void* p_buf);
+u_int8 LineSensDrvGetSysRecvFlag(void);
+uint16_t DEVGpsGetWknRollover(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLEUTILITY_H_ */
diff --git a/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/BackupMgrIf.h b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/BackupMgrIf.h
new file mode 100755
index 0000000..3e2e5e5
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/BackupMgrIf.h
@@ -0,0 +1,65 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * BackupMgrIf.h
+ * @brief
+ * BackupMgr service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_BACKUPMGRIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_BACKUPMGRIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_backup.h>
+#include <native_service/ns_backup_id.h>
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+EFrameworkunifiedStatus BackupMgrIfNotifyOnBackupMgrAvailability(CbFuncPtr fp_on_cmd);
+void BackupMgrIfSetAvailability(BOOL b_is_available);
+BOOL BackupMgrIf_GetAvailability(void);
+EFrameworkunifiedStatus BackupMgrIfBackupDataRd(PCSTR tag_id, uint32_t ui_offset, \
+ void *pv_buf, uint32_t ui_size, BOOL* pb_is_available);
+EFrameworkunifiedStatus BackupMgrIfBackupDataWt(PCSTR tag_id, void *pv_buf, \
+ uint32_t ui_offset, uint32_t ui_size, BOOL* pb_is_available);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_BACKUPMGRIF_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ClockIf.h b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ClockIf.h
new file mode 100755
index 0000000..5a2e976
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ClockIf.h
@@ -0,0 +1,61 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * ClockIf.h
+ * @brief
+ * Clock service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_CLOCKIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_CLOCKIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <stub/DTime_Api.h>
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_gps_API.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+EFrameworkunifiedStatus ClockIfNotifyOnClockAvailability(CbFuncPtr fp_on_cmd);
+void ClockIfSetAvailability(BOOL b_is_available);
+EFrameworkunifiedStatus ClockIfDtimeSetGpsTime(const SENSOR_MSG_GPSTIME *pst_gps_time, BOOL* pb_is_available);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_CLOCKIF_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/CommUsbIf.h b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/CommUsbIf.h
new file mode 100755
index 0000000..cbc947c
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/CommUsbIf.h
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * CommUsbIf.h
+ * @brief
+ * CommUSB service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_COMMUSBIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_COMMUSBIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <stub/commusb_api.h>
+#include <stub/commusb_notifications.h>
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+EFrameworkunifiedStatus CommUsbIfAttachCallbacksToDispatcher( // NOLINT(readability/nolint)
+ _FrameworkunifiedProtocolCallbackHandler const* p_msg_handler,
+ unsigned int ui_handler_count);
+EFrameworkunifiedStatus CommUsbIfDetachCallbacksFromDispatcher(const PUI_32 pui_cmd_array, UI_32 ui_command_count);
+EFrameworkunifiedStatus CommUsbIfNotifyOnCommUSBAvailability(CbFuncPtr fp_on_cmd);
+void CommUsbIfSetAvailability(BOOL b_is_available);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_COMMUSBIF_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/DevDetectSrvIf.h b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/DevDetectSrvIf.h
new file mode 100755
index 0000000..8829123
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/DevDetectSrvIf.h
@@ -0,0 +1,69 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * DevDetectSrvIf.h
+ * @brief
+ * DevDetectSrv service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DEVDETECTSRVIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DEVDETECTSRVIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <system_service/ss_devicedetection_service_protocol.h>
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+void DevDetectSrvIfSetAvailability(BOOL b_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfInitialize(void);
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnDeviceDetectionAvailability(CbFuncPtr fp_call_back_fn);
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnOpenSessionAck(CbFuncPtr fp_call_back_fn, BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnCloseSessionAck(CbFuncPtr fp_call_back_fn, BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfOpenSessionRequest(BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfDecodeOpenSessionResponse(BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfRegisterForDeviceDetectionEvent(SS_DeviceDetectionServerEvents fe_dev_detect_event, \
+ CbFuncPtr fp_call_back_fn, PCSTR p_file_path, BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfUnRegisterForDeviceDetectionEvent(SS_DeviceDetectionServerEvents fe_dev_detect_event, \
+ BOOL* pb_is_available);
+EFrameworkunifiedStatus DevDetectSrvIfCloseSessionRequest(BOOL* pb_is_available);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DEVDETECTSRVIF_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/DiagSrvIf.h b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/DiagSrvIf.h
new file mode 100755
index 0000000..a6bcd77
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/DiagSrvIf.h
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * DiagSrvIf.h
+ * @brief
+ * DiagSrv service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DIAGSRVIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DIAGSRVIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <vehicle_service/positioning_base_library.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+void DiagSrvIfSetRegistrationPermission(BOOL b_is_true);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_DIAGSRVIF_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/PSMShadowIf.h b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/PSMShadowIf.h
new file mode 100755
index 0000000..8cdb1f8
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/PSMShadowIf.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * PSMShadow.h
+ * @brief
+ * PSMShadow service-to-service interface
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_PSMSHADOWIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_PSMSHADOWIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "ps_psmshadow_notifications.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+EFrameworkunifiedStatus PSMShadowIfNotifyOnPSMShadowAvailability(CbFuncPtr fp_on_cmd);
+EFrameworkunifiedStatus PSMShadowIfNotifyOnPSMShadowInitComp(CbFuncPtr fp_on_cmd);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_PSMSHADOWIF_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/VehicleIf.h b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/VehicleIf.h
new file mode 100755
index 0000000..28c05fb
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/VehicleIf.h
@@ -0,0 +1,82 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_VEHICLEIF_H_
+#define POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_VEHICLEIF_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <vehicle_service/positioning_base_library.h>
+#include <stub/vehicle_notifications.h>
+#include <stub/Vehicle_Sensor_Common_API.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* Transmission Type */
+#define VEHICLEIF_TRANSMISSION_TYPE_MT 0
+#define VEHICLEIF_TRANSMISSION_TYPE_AT 1
+#define VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN 2
+#define VEHICLEIF_TRANSMISSION_TYPE_NUM 3 /* Number of Transmission Types */
+
+/* Shift Position (CAUTION: These values depend on Vehicle I/F) */
+#define VEHICLEIF_SHIFT_POSITION_U 0
+#define VEHICLEIF_SHIFT_POSITION_R 1
+#define VEHICLEIF_SHIFT_POSITION_P 2
+#define VEHICLEIF_SHIFT_POSITION_N 4
+#define VEHICLEIF_SHIFT_POSITION_D 8
+#define VEHICLEIF_SHIFT_POSITION_NUM 5 /* Number of Shift Position Types */
+
+/* Parking Brake (CAUTION: These values depend on Vehicle I/F) */
+#define VEHICLEIF_PKB_OFF 0
+#define VEHICLEIF_PKB_ON 1
+#define VEHICLEIF_PKB_UNKNOWN 2
+#define VEHICLEIF_PKB_NUM 3
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+void VehicleIf_SetAvailability(BOOL bIsAvailable);
+
+//EFrameworkunifiedStatus VehicleIf_GetTypeOfTransmission(uint8_t* pType, BOOL* pbIsAvailable);
+EFrameworkunifiedStatus VehicleIf_GetTypeOfTransmission(uint8_t* pType, uint8_t* pPkb, BOOL* pbIsAvailable);
+EFrameworkunifiedStatus VehicleIf_GetShiftPosition(uint8_t* pShift, BOOL* pbIsAvailable);
+EFrameworkunifiedStatus VehicleIfAttachCallbacksToDispatcher( // NOLINT(readability/nolint)
+ _FrameworkunifiedProtocolCallbackHandler const* p_msg_handler,
+ unsigned int ui_handlercount);
+EFrameworkunifiedStatus VehicleIfDetachCallbacksFromDispatcher(const PUI_32 pui_cmd_array, UI_32 ui_command_count);
+EFrameworkunifiedStatus VehicleIfNotifyOnVehicleAvailability(CbFuncPtr fp_on_cmd);
+EFrameworkunifiedStatus VehicleIfDeliveryEntry(uint32_t ul_did);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_SERVER_INCLUDE_SERVICEINTERFACE_VEHICLEIF_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ps_psmshadow_notifications.h b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ps_psmshadow_notifications.h
new file mode 100755
index 0000000..24a513a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ps_psmshadow_notifications.h
@@ -0,0 +1,62 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ps_psmshadow_notifications.h
+ */
+
+#ifndef PS_PSM_SHADOW_NOTIFICATIONS_H_ // NOLINT(build/header_guard)
+
+#include "agl_thread.h"
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheralservice
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup PS_PSMShadow
+ * @ingroup peripheralservice
+ * @{
+ */
+
+/**
+ * \~english PS_PSMShadow service availability notify.
+ */
+#define NTFY_PSMShadowService_Availability MN_PS_PSMSHADOW"/Availability"
+
+/**
+ * \~english init complete notify.
+ */
+#define NTFY_PSM_INITCOMP MN_PS_PSMSHADOW"/InitComp"
+
+/**
+ * \~english init complete2 notify.
+ */
+#define NTFY_PSM_INITCOMP2 MN_PS_PSMSHADOW"/InitComp2"
+
+// to be delete code.
+// Voltage, temperature and fan data to DIAG / HMI.
+#define NTFY_PSM_VTG_TEMP_FAN_DATA MN_PS_PSMSHADOW"/VolTempFanInfo"
+// Audio High Temp notification to Audio service.
+#define NTFY_PSM_AUDIO_HIGH_TEMP MN_PS_PSMSHADOW"/AudioHighTemp"
+
+/** @}*/ // end of PS_PSMShadow
+/** @}*/ // end of peripheralservice
+/** @}*/ // end of BaseSystem
+
+#endif // PS_PSM_SHADOW_NOTIFICATIONS_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ps_version.h b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ps_version.h
new file mode 100755
index 0000000..f28982f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/ServiceInterface/ps_version.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// \session
+/// \internal
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \file ps_services.h
+/// \ingroup tag_PeripheralServices
+/// \brief Peripheral Services Version Information Support.
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+// File name : ps_version.h
+// Module : PeripheralServices
+// Description : Peripheral Services Version Information Support.
+// Scope : PeripheralServices
+// Platform : Global Platform Framework (GPF)
+//
+// Customer : General
+// System : PosixBasedOS001
+// Reference : PeripheralServices
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef PS_VERSION_H_ // NOLINT(build/header_guard)
+
+#define PS_VERSION_MAJOR (1u)
+#define PS_VERSION_MINOR (0u)
+#define PS_VERSION_REV (0u)
+
+#endif /* PS_VERSION_H_ */
+
diff --git a/video_in_hal/vehicleservice/positioning/server/include/nsfw/positioning_common.h b/video_in_hal/vehicleservice/positioning/server/include/nsfw/positioning_common.h
new file mode 100755
index 0000000..538630d
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/nsfw/positioning_common.h
@@ -0,0 +1,90 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * positioning_common.h
+ * @brief
+ * Positioing NSFW Dependency Section Common Headers
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_NSFW_POSITIONING_COMMON_H_
+#define POSITIONING_SERVER_INCLUDE_NSFW_POSITIONING_COMMON_H_
+
+#include <positioning_hal.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* Thread control command ID */
+#define CID_EXTTERM_REQ (0x0011) /* External pin status request */
+
+/* Internal thread activation status determination */
+#define THREAD_STS_MSK_POS_MAIN (0x01)
+#define THREAD_STS_MSK_POS_SENS (0x02)
+#define THREAD_STS_MSK_POS_GPS (0x04)
+#define THREAD_STS_MSK_POS_GPS_RECV (0x08)
+#define THREAD_STS_MSK_POS_GPS_ROLLOVER (0x10)
+
+
+/*---------------------------------------------------------------------------------*
+ * ENUMERATION *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Positioning operating status definitions
+*/
+typedef enum {
+ EPOS_EXE_STS_STOP = 0, /* Stopped */
+ EPOS_EXE_STS_RUNNING, /* Running (From FrameworkunifiedOnStart to FrameworkunifiedOnStop) */
+ EPOS_EXE_STS_RUNNING_COLDSTART /* Running after cold start */
+} EnumExeSts_POS;
+
+/*!
+ @brief Positioning Thread Startup Modes
+*/
+typedef enum {
+ EPOS_SETUP_MODE_NORMAL = 0, /* Normal start */
+ EPOS_SETUP_MODE_DATA_RESET /* Data reset start */ /* QAC 930 */
+} EnumSetupMode_POS;
+
+/*---------------------------------------------------------------------------------*
+ * STRUCTURE *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Thread activation information
+*/
+typedef struct {
+ EnumSetupMode_POS e_mode; /* Thread activation mode */
+} ST_THREAD_SETUP_INFO;
+
+/*---------------------------------------------------------------------------------*
+ * Prototype *
+ *---------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+ EnumSetupMode_POS PosSetupThread(HANDLE h_app, EnumTID_POS e_tid);
+ void PosTeardownThread(EnumTID_POS e_tid);
+#ifdef __cplusplus
+}
+#endif
+
+/*---------------------------------------------------------------------------------*
+ * Extern *
+ *---------------------------------------------------------------------------------*/
+extern BOOL g_thread_stop_req; /* Pos_Gps_Recv Thread Stop Flag */
+
+
+#endif // POSITIONING_SERVER_INCLUDE_NSFW_POSITIONING_COMMON_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/include/nsfw/vehicle_version.h b/video_in_hal/vehicleservice/positioning/server/include/nsfw/vehicle_version.h
new file mode 100755
index 0000000..b397b68
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/include/nsfw/vehicle_version.h
@@ -0,0 +1,29 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_SERVER_INCLUDE_NSFW_VEHICLE_VERSION_H_
+#define POSITIONING_SERVER_INCLUDE_NSFW_VEHICLE_VERSION_H_
+
+#define MAJORNO 0x01
+#define MINORNO 0x00
+#define REVISION 0x00
+
+/*
+ * ChangeLog : This section describes all the changes done to the project.
+ *
+ * - Initial
+ */
+
+#endif // POSITIONING_SERVER_INCLUDE_NSFW_VEHICLE_VERSION_H_
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/ClockUtility.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/ClockUtility.cpp
new file mode 100755
index 0000000..2e9639a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/ClockUtility.cpp
@@ -0,0 +1,414 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file ClockUtility.cpp
+@detail Common processing function concerning clock
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "ClockUtility.h"
+#include "ClockUtility_private.h"
+
+/*
+ Global Constant Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static const u_int16 kUsMonth[3][12] = { /* Mnumonic For Remembering The Months With Fewer Than 31 Days Table(Leap year version) Task_31499 */
+ {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, /* Number of days per month(If it is not a leap year) */
+ {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, /* Number of days per month(For leap years) */
+ {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334} /* Cumulative number of days per month(If it is not a leap year) */
+};
+
+static const ClockDayCntTbl kUlDayCntTbl = {
+ /* 1970 Year */ {{0x000007B2U, 0x00000000U, {0x00000000U, 0x0028DE80U, 0x004DC880U, 0x0076A700U, 0x009E3400U, 0x00C71280U, 0x00EE9F80U, 0x01177E00U, 0x01405C80U, 0x0167E980U, 0x0190C800U, 0x01B85500U}}, // NOLINT(whitespace/line_length)
+ /* 1971 Year */ {0x000007B3U, 0x01E13380U, {0x01E13380U, 0x020A1200U, 0x022EFC00U, 0x0257DA80U, 0x027F6780U, 0x02A84600U, 0x02CFD300U, 0x02F8B180U, 0x03219000U, 0x03491D00U, 0x0371FB80U, 0x03998880U}}, // NOLINT(whitespace/line_length)
+ /* 1972 Year */ {0x000007B4U, 0x03C26700U, {0x03C26700U, 0x03EB4580U, 0x04118100U, 0x043A5F80U, 0x0461EC80U, 0x048ACB00U, 0x04B25800U, 0x04DB3680U, 0x05041500U, 0x052BA200U, 0x05548080U, 0x057C0D80U}}, // NOLINT(whitespace/line_length)
+ /* 1973 Year */ {0x000007B5U, 0x05A4EC00U, {0x05A4EC00U, 0x05CDCA80U, 0x05F2B480U, 0x061B9300U, 0x06432000U, 0x066BFE80U, 0x06938B80U, 0x06BC6A00U, 0x06E54880U, 0x070CD580U, 0x0735B400U, 0x075D4100U}}, // NOLINT(whitespace/line_length)
+ /* 1974 Year */ {0x000007B6U, 0x07861F80U, {0x07861F80U, 0x07AEFE00U, 0x07D3E800U, 0x07FCC680U, 0x08245380U, 0x084D3200U, 0x0874BF00U, 0x089D9D80U, 0x08C67C00U, 0x08EE0900U, 0x0916E780U, 0x093E7480U}}, // NOLINT(whitespace/line_length)
+ /* 1975 Year */ {0x000007B7U, 0x09675300U, {0x09675300U, 0x09903180U, 0x09B51B80U, 0x09DDFA00U, 0x0A058700U, 0x0A2E6580U, 0x0A55F280U, 0x0A7ED100U, 0x0AA7AF80U, 0x0ACF3C80U, 0x0AF81B00U, 0x0B1FA800U}}, // NOLINT(whitespace/line_length)
+ /* 1976 Year */ {0x000007B8U, 0x0B488680U, {0x0B488680U, 0x0B716500U, 0x0B97A080U, 0x0BC07F00U, 0x0BE80C00U, 0x0C10EA80U, 0x0C387780U, 0x0C615600U, 0x0C8A3480U, 0x0CB1C180U, 0x0CDAA000U, 0x0D022D00U}}, // NOLINT(whitespace/line_length)
+ /* 1977 Year */ {0x000007B9U, 0x0D2B0B80U, {0x0D2B0B80U, 0x0D53EA00U, 0x0D78D400U, 0x0DA1B280U, 0x0DC93F80U, 0x0DF21E00U, 0x0E19AB00U, 0x0E428980U, 0x0E6B6800U, 0x0E92F500U, 0x0EBBD380U, 0x0EE36080U}}, // NOLINT(whitespace/line_length)
+ /* 1978 Year */ {0x000007BAU, 0x0F0C3F00U, {0x0F0C3F00U, 0x0F351D80U, 0x0F5A0780U, 0x0F82E600U, 0x0FAA7300U, 0x0FD35180U, 0x0FFADE80U, 0x1023BD00U, 0x104C9B80U, 0x10742880U, 0x109D0700U, 0x10C49400U}}, // NOLINT(whitespace/line_length)
+ /* 1979 Year */ {0x000007BBU, 0x10ED7280U, {0x10ED7280U, 0x11165100U, 0x113B3B00U, 0x11641980U, 0x118BA680U, 0x11B48500U, 0x11DC1200U, 0x1204F080U, 0x122DCF00U, 0x12555C00U, 0x127E3A80U, 0x12A5C780U}}, // NOLINT(whitespace/line_length)
+ /* 1980 Year */ {0x000007BCU, 0x12CEA600U, {0x12CEA600U, 0x12F78480U, 0x131DC000U, 0x13469E80U, 0x136E2B80U, 0x13970A00U, 0x13BE9700U, 0x13E77580U, 0x14105400U, 0x1437E100U, 0x1460BF80U, 0x14884C80U}}, // NOLINT(whitespace/line_length)
+ /* 1981 Year */ {0x000007BDU, 0x14B12B00U, {0x14B12B00U, 0x14DA0980U, 0x14FEF380U, 0x1527D200U, 0x154F5F00U, 0x15783D80U, 0x159FCA80U, 0x15C8A900U, 0x15F18780U, 0x16191480U, 0x1641F300U, 0x16698000U}}, // NOLINT(whitespace/line_length)
+ /* 1982 Year */ {0x000007BEU, 0x16925E80U, {0x16925E80U, 0x16BB3D00U, 0x16E02700U, 0x17090580U, 0x17309280U, 0x17597100U, 0x1780FE00U, 0x17A9DC80U, 0x17D2BB00U, 0x17FA4800U, 0x18232680U, 0x184AB380U}}, // NOLINT(whitespace/line_length)
+ /* 1983 Year */ {0x000007BFU, 0x18739200U, {0x18739200U, 0x189C7080U, 0x18C15A80U, 0x18EA3900U, 0x1911C600U, 0x193AA480U, 0x19623180U, 0x198B1000U, 0x19B3EE80U, 0x19DB7B80U, 0x1A045A00U, 0x1A2BE700U}}, // NOLINT(whitespace/line_length)
+ /* 1984 Year */ {0x000007C0U, 0x1A54C580U, {0x1A54C580U, 0x1A7DA400U, 0x1AA3DF80U, 0x1ACCBE00U, 0x1AF44B00U, 0x1B1D2980U, 0x1B44B680U, 0x1B6D9500U, 0x1B967380U, 0x1BBE0080U, 0x1BE6DF00U, 0x1C0E6C00U}}, // NOLINT(whitespace/line_length)
+ /* 1985 Year */ {0x000007C1U, 0x1C374A80U, {0x1C374A80U, 0x1C602900U, 0x1C851300U, 0x1CADF180U, 0x1CD57E80U, 0x1CFE5D00U, 0x1D25EA00U, 0x1D4EC880U, 0x1D77A700U, 0x1D9F3400U, 0x1DC81280U, 0x1DEF9F80U}}, // NOLINT(whitespace/line_length)
+ /* 1986 Year */ {0x000007C2U, 0x1E187E00U, {0x1E187E00U, 0x1E415C80U, 0x1E664680U, 0x1E8F2500U, 0x1EB6B200U, 0x1EDF9080U, 0x1F071D80U, 0x1F2FFC00U, 0x1F58DA80U, 0x1F806780U, 0x1FA94600U, 0x1FD0D300U}}, // NOLINT(whitespace/line_length)
+ /* 1987 Year */ {0x000007C3U, 0x1FF9B180U, {0x1FF9B180U, 0x20229000U, 0x20477A00U, 0x20705880U, 0x2097E580U, 0x20C0C400U, 0x20E85100U, 0x21112F80U, 0x213A0E00U, 0x21619B00U, 0x218A7980U, 0x21B20680U}}, // NOLINT(whitespace/line_length)
+ /* 1988 Year */ {0x000007C4U, 0x21DAE500U, {0x21DAE500U, 0x2203C380U, 0x2229FF00U, 0x2252DD80U, 0x227A6A80U, 0x22A34900U, 0x22CAD600U, 0x22F3B480U, 0x231C9300U, 0x23442000U, 0x236CFE80U, 0x23948B80U}}, // NOLINT(whitespace/line_length)
+ /* 1989 Year */ {0x000007C5U, 0x23BD6A00U, {0x23BD6A00U, 0x23E64880U, 0x240B3280U, 0x24341100U, 0x245B9E00U, 0x24847C80U, 0x24AC0980U, 0x24D4E800U, 0x24FDC680U, 0x25255380U, 0x254E3200U, 0x2575BF00U}}, // NOLINT(whitespace/line_length)
+ /* 1990 Year */ {0x000007C6U, 0x259E9D80U, {0x259E9D80U, 0x25C77C00U, 0x25EC6600U, 0x26154480U, 0x263CD180U, 0x2665B000U, 0x268D3D00U, 0x26B61B80U, 0x26DEFA00U, 0x27068700U, 0x272F6580U, 0x2756F280U}}, // NOLINT(whitespace/line_length)
+ /* 1991 Year */ {0x000007C7U, 0x277FD100U, {0x277FD100U, 0x27A8AF80U, 0x27CD9980U, 0x27F67800U, 0x281E0500U, 0x2846E380U, 0x286E7080U, 0x28974F00U, 0x28C02D80U, 0x28E7BA80U, 0x29109900U, 0x29382600U}}, // NOLINT(whitespace/line_length)
+ /* 1992 Year */ {0x000007C8U, 0x29610480U, {0x29610480U, 0x2989E300U, 0x29B01E80U, 0x29D8FD00U, 0x2A008A00U, 0x2A296880U, 0x2A50F580U, 0x2A79D400U, 0x2AA2B280U, 0x2ACA3F80U, 0x2AF31E00U, 0x2B1AAB00U}}, // NOLINT(whitespace/line_length)
+ /* 1993 Year */ {0x000007C9U, 0x2B438980U, {0x2B438980U, 0x2B6C6800U, 0x2B915200U, 0x2BBA3080U, 0x2BE1BD80U, 0x2C0A9C00U, 0x2C322900U, 0x2C5B0780U, 0x2C83E600U, 0x2CAB7300U, 0x2CD45180U, 0x2CFBDE80U}}, // NOLINT(whitespace/line_length)
+ /* 1994 Year */ {0x000007CAU, 0x2D24BD00U, {0x2D24BD00U, 0x2D4D9B80U, 0x2D728580U, 0x2D9B6400U, 0x2DC2F100U, 0x2DEBCF80U, 0x2E135C80U, 0x2E3C3B00U, 0x2E651980U, 0x2E8CA680U, 0x2EB58500U, 0x2EDD1200U}}, // NOLINT(whitespace/line_length)
+ /* 1995 Year */ {0x000007CBU, 0x2F05F080U, {0x2F05F080U, 0x2F2ECF00U, 0x2F53B900U, 0x2F7C9780U, 0x2FA42480U, 0x2FCD0300U, 0x2FF49000U, 0x301D6E80U, 0x30464D00U, 0x306DDA00U, 0x3096B880U, 0x30BE4580U}}, // NOLINT(whitespace/line_length)
+ /* 1996 Year */ {0x000007CCU, 0x30E72400U, {0x30E72400U, 0x31100280U, 0x31363E00U, 0x315F1C80U, 0x3186A980U, 0x31AF8800U, 0x31D71500U, 0x31FFF380U, 0x3228D200U, 0x32505F00U, 0x32793D80U, 0x32A0CA80U}}, // NOLINT(whitespace/line_length)
+ /* 1997 Year */ {0x000007CDU, 0x32C9A900U, {0x32C9A900U, 0x32F28780U, 0x33177180U, 0x33405000U, 0x3367DD00U, 0x3390BB80U, 0x33B84880U, 0x33E12700U, 0x340A0580U, 0x34319280U, 0x345A7100U, 0x3481FE00U}}, // NOLINT(whitespace/line_length)
+ /* 1998 Year */ {0x000007CEU, 0x34AADC80U, {0x34AADC80U, 0x34D3BB00U, 0x34F8A500U, 0x35218380U, 0x35491080U, 0x3571EF00U, 0x35997C00U, 0x35C25A80U, 0x35EB3900U, 0x3612C600U, 0x363BA480U, 0x36633180U}}, // NOLINT(whitespace/line_length)
+ /* 1999 Year */ {0x000007CFU, 0x368C1000U, {0x368C1000U, 0x36B4EE80U, 0x36D9D880U, 0x3702B700U, 0x372A4400U, 0x37532280U, 0x377AAF80U, 0x37A38E00U, 0x37CC6C80U, 0x37F3F980U, 0x381CD800U, 0x38446500U}}, // NOLINT(whitespace/line_length)
+ /* 2000 Year */ {0x000007D0U, 0x386D4380U, {0x386D4380U, 0x38962200U, 0x38BC5D80U, 0x38E53C00U, 0x390CC900U, 0x3935A780U, 0x395D3480U, 0x39861300U, 0x39AEF180U, 0x39D67E80U, 0x39FF5D00U, 0x3A26EA00U}}, // NOLINT(whitespace/line_length)
+ /* 2001 Year */ {0x000007D1U, 0x3A4FC880U, {0x3A4FC880U, 0x3A78A700U, 0x3A9D9100U, 0x3AC66F80U, 0x3AEDFC80U, 0x3B16DB00U, 0x3B3E6800U, 0x3B674680U, 0x3B902500U, 0x3BB7B200U, 0x3BE09080U, 0x3C081D80U}}, // NOLINT(whitespace/line_length)
+ /* 2002 Year */ {0x000007D2U, 0x3C30FC00U, {0x3C30FC00U, 0x3C59DA80U, 0x3C7EC480U, 0x3CA7A300U, 0x3CCF3000U, 0x3CF80E80U, 0x3D1F9B80U, 0x3D487A00U, 0x3D715880U, 0x3D98E580U, 0x3DC1C400U, 0x3DE95100U}}, // NOLINT(whitespace/line_length)
+ /* 2003 Year */ {0x000007D3U, 0x3E122F80U, {0x3E122F80U, 0x3E3B0E00U, 0x3E5FF800U, 0x3E88D680U, 0x3EB06380U, 0x3ED94200U, 0x3F00CF00U, 0x3F29AD80U, 0x3F528C00U, 0x3F7A1900U, 0x3FA2F780U, 0x3FCA8480U}}, // NOLINT(whitespace/line_length)
+ /* 2004 Year */ {0x000007D4U, 0x3FF36300U, {0x3FF36300U, 0x401C4180U, 0x40427D00U, 0x406B5B80U, 0x4092E880U, 0x40BBC700U, 0x40E35400U, 0x410C3280U, 0x41351100U, 0x415C9E00U, 0x41857C80U, 0x41AD0980U}}, // NOLINT(whitespace/line_length)
+ /* 2005 Year */ {0x000007D5U, 0x41D5E800U, {0x41D5E800U, 0x41FEC680U, 0x4223B080U, 0x424C8F00U, 0x42741C00U, 0x429CFA80U, 0x42C48780U, 0x42ED6600U, 0x43164480U, 0x433DD180U, 0x4366B000U, 0x438E3D00U}}, // NOLINT(whitespace/line_length)
+ /* 2006 Year */ {0x000007D6U, 0x43B71B80U, {0x43B71B80U, 0x43DFFA00U, 0x4404E400U, 0x442DC280U, 0x44554F80U, 0x447E2E00U, 0x44A5BB00U, 0x44CE9980U, 0x44F77800U, 0x451F0500U, 0x4547E380U, 0x456F7080U}}, // NOLINT(whitespace/line_length)
+ /* 2007 Year */ {0x000007D7U, 0x45984F00U, {0x45984F00U, 0x45C12D80U, 0x45E61780U, 0x460EF600U, 0x46368300U, 0x465F6180U, 0x4686EE80U, 0x46AFCD00U, 0x46D8AB80U, 0x47003880U, 0x47291700U, 0x4750A400U}}, // NOLINT(whitespace/line_length)
+ /* 2008 Year */ {0x000007D8U, 0x47798280U, {0x47798280U, 0x47A26100U, 0x47C89C80U, 0x47F17B00U, 0x48190800U, 0x4841E680U, 0x48697380U, 0x48925200U, 0x48BB3080U, 0x48E2BD80U, 0x490B9C00U, 0x49332900U}}, // NOLINT(whitespace/line_length)
+ /* 2009 Year */ {0x000007D9U, 0x495C0780U, {0x495C0780U, 0x4984E600U, 0x49A9D000U, 0x49D2AE80U, 0x49FA3B80U, 0x4A231A00U, 0x4A4AA700U, 0x4A738580U, 0x4A9C6400U, 0x4AC3F100U, 0x4AECCF80U, 0x4B145C80U}}, // NOLINT(whitespace/line_length)
+ /* 2010 Year */ {0x000007DAU, 0x4B3D3B00U, {0x4B3D3B00U, 0x4B661980U, 0x4B8B0380U, 0x4BB3E200U, 0x4BDB6F00U, 0x4C044D80U, 0x4C2BDA80U, 0x4C54B900U, 0x4C7D9780U, 0x4CA52480U, 0x4CCE0300U, 0x4CF59000U}}, // NOLINT(whitespace/line_length)
+ /* 2011 Year */ {0x000007DBU, 0x4D1E6E80U, {0x4D1E6E80U, 0x4D474D00U, 0x4D6C3700U, 0x4D951580U, 0x4DBCA280U, 0x4DE58100U, 0x4E0D0E00U, 0x4E35EC80U, 0x4E5ECB00U, 0x4E865800U, 0x4EAF3680U, 0x4ED6C380U}}, // NOLINT(whitespace/line_length)
+ /* 2012 Year */ {0x000007DCU, 0x4EFFA200U, {0x4EFFA200U, 0x4F288080U, 0x4F4EBC00U, 0x4F779A80U, 0x4F9F2780U, 0x4FC80600U, 0x4FEF9300U, 0x50187180U, 0x50415000U, 0x5068DD00U, 0x5091BB80U, 0x50B94880U}}, // NOLINT(whitespace/line_length)
+ /* 2013 Year */ {0x000007DDU, 0x50E22700U, {0x50E22700U, 0x510B0580U, 0x512FEF80U, 0x5158CE00U, 0x51805B00U, 0x51A93980U, 0x51D0C680U, 0x51F9A500U, 0x52228380U, 0x524A1080U, 0x5272EF00U, 0x529A7C00U}}, // NOLINT(whitespace/line_length)
+ /* 2014 Year */ {0x000007DEU, 0x52C35A80U, {0x52C35A80U, 0x52EC3900U, 0x53112300U, 0x533A0180U, 0x53618E80U, 0x538A6D00U, 0x53B1FA00U, 0x53DAD880U, 0x5403B700U, 0x542B4400U, 0x54542280U, 0x547BAF80U}}, // NOLINT(whitespace/line_length)
+ /* 2015 Year */ {0x000007DFU, 0x54A48E00U, {0x54A48E00U, 0x54CD6C80U, 0x54F25680U, 0x551B3500U, 0x5542C200U, 0x556BA080U, 0x55932D80U, 0x55BC0C00U, 0x55E4EA80U, 0x560C7780U, 0x56355600U, 0x565CE300U}}, // NOLINT(whitespace/line_length)
+ /* 2016 Year */ {0x000007E0U, 0x5685C180U, {0x5685C180U, 0x56AEA000U, 0x56D4DB80U, 0x56FDBA00U, 0x57254700U, 0x574E2580U, 0x5775B280U, 0x579E9100U, 0x57C76F80U, 0x57EEFC80U, 0x5817DB00U, 0x583F6800U}}, // NOLINT(whitespace/line_length)
+ /* 2017 Year */ {0x000007E1U, 0x58684680U, {0x58684680U, 0x58912500U, 0x58B60F00U, 0x58DEED80U, 0x59067A80U, 0x592F5900U, 0x5956E600U, 0x597FC480U, 0x59A8A300U, 0x59D03000U, 0x59F90E80U, 0x5A209B80U}}, // NOLINT(whitespace/line_length)
+ /* 2018 Year */ {0x000007E2U, 0x5A497A00U, {0x5A497A00U, 0x5A725880U, 0x5A974280U, 0x5AC02100U, 0x5AE7AE00U, 0x5B108C80U, 0x5B381980U, 0x5B60F800U, 0x5B89D680U, 0x5BB16380U, 0x5BDA4200U, 0x5C01CF00U}}, // NOLINT(whitespace/line_length)
+ /* 2019 Year */ {0x000007E3U, 0x5C2AAD80U, {0x5C2AAD80U, 0x5C538C00U, 0x5C787600U, 0x5CA15480U, 0x5CC8E180U, 0x5CF1C000U, 0x5D194D00U, 0x5D422B80U, 0x5D6B0A00U, 0x5D929700U, 0x5DBB7580U, 0x5DE30280U}}, // NOLINT(whitespace/line_length)
+ /* 2020 Year */ {0x000007E4U, 0x5E0BE100U, {0x5E0BE100U, 0x5E34BF80U, 0x5E5AFB00U, 0x5E83D980U, 0x5EAB6680U, 0x5ED44500U, 0x5EFBD200U, 0x5F24B080U, 0x5F4D8F00U, 0x5F751C00U, 0x5F9DFA80U, 0x5FC58780U}}, // NOLINT(whitespace/line_length)
+ /* 2021 Year */ {0x000007E5U, 0x5FEE6600U, {0x5FEE6600U, 0x60174480U, 0x603C2E80U, 0x60650D00U, 0x608C9A00U, 0x60B57880U, 0x60DD0580U, 0x6105E400U, 0x612EC280U, 0x61564F80U, 0x617F2E00U, 0x61A6BB00U}}, // NOLINT(whitespace/line_length)
+ /* 2022 Year */ {0x000007E6U, 0x61CF9980U, {0x61CF9980U, 0x61F87800U, 0x621D6200U, 0x62464080U, 0x626DCD80U, 0x6296AC00U, 0x62BE3900U, 0x62E71780U, 0x630FF600U, 0x63378300U, 0x63606180U, 0x6387EE80U}}, // NOLINT(whitespace/line_length)
+ /* 2023 Year */ {0x000007E7U, 0x63B0CD00U, {0x63B0CD00U, 0x63D9AB80U, 0x63FE9580U, 0x64277400U, 0x644F0100U, 0x6477DF80U, 0x649F6C80U, 0x64C84B00U, 0x64F12980U, 0x6518B680U, 0x65419500U, 0x65692200U}}, // NOLINT(whitespace/line_length)
+ /* 2024 Year */ {0x000007E8U, 0x65920080U, {0x65920080U, 0x65BADF00U, 0x65E11A80U, 0x6609F900U, 0x66318600U, 0x665A6480U, 0x6681F180U, 0x66AAD000U, 0x66D3AE80U, 0x66FB3B80U, 0x67241A00U, 0x674BA700U}}, // NOLINT(whitespace/line_length)
+ /* 2025 Year */ {0x000007E9U, 0x67748580U, {0x67748580U, 0x679D6400U, 0x67C24E00U, 0x67EB2C80U, 0x6812B980U, 0x683B9800U, 0x68632500U, 0x688C0380U, 0x68B4E200U, 0x68DC6F00U, 0x69054D80U, 0x692CDA80U}}, // NOLINT(whitespace/line_length)
+ /* 2026 Year */ {0x000007EAU, 0x6955B900U, {0x6955B900U, 0x697E9780U, 0x69A38180U, 0x69CC6000U, 0x69F3ED00U, 0x6A1CCB80U, 0x6A445880U, 0x6A6D3700U, 0x6A961580U, 0x6ABDA280U, 0x6AE68100U, 0x6B0E0E00U}}, // NOLINT(whitespace/line_length)
+ /* 2027 Year */ {0x000007EBU, 0x6B36EC80U, {0x6B36EC80U, 0x6B5FCB00U, 0x6B84B500U, 0x6BAD9380U, 0x6BD52080U, 0x6BFDFF00U, 0x6C258C00U, 0x6C4E6A80U, 0x6C774900U, 0x6C9ED600U, 0x6CC7B480U, 0x6CEF4180U}}, // NOLINT(whitespace/line_length)
+ /* 2028 Year */ {0x000007ECU, 0x6D182000U, {0x6D182000U, 0x6D40FE80U, 0x6D673A00U, 0x6D901880U, 0x6DB7A580U, 0x6DE08400U, 0x6E081100U, 0x6E30EF80U, 0x6E59CE00U, 0x6E815B00U, 0x6EAA3980U, 0x6ED1C680U}}, // NOLINT(whitespace/line_length)
+ /* 2029 Year */ {0x000007EDU, 0x6EFAA500U, {0x6EFAA500U, 0x6F238380U, 0x6F486D80U, 0x6F714C00U, 0x6F98D900U, 0x6FC1B780U, 0x6FE94480U, 0x70122300U, 0x703B0180U, 0x70628E80U, 0x708B6D00U, 0x70B2FA00U}}, // NOLINT(whitespace/line_length)
+ /* 2030 Year */ {0x000007EEU, 0x70DBD880U, {0x70DBD880U, 0x7104B700U, 0x7129A100U, 0x71527F80U, 0x717A0C80U, 0x71A2EB00U, 0x71CA7800U, 0x71F35680U, 0x721C3500U, 0x7243C200U, 0x726CA080U, 0x72942D80U}}, // NOLINT(whitespace/line_length)
+ /* 2031 Year */ {0x000007EFU, 0x72BD0C00U, {0x72BD0C00U, 0x72E5EA80U, 0x730AD480U, 0x7333B300U, 0x735B4000U, 0x73841E80U, 0x73ABAB80U, 0x73D48A00U, 0x73FD6880U, 0x7424F580U, 0x744DD400U, 0x74756100U}}, // NOLINT(whitespace/line_length)
+ /* 2032 Year */ {0x000007F0U, 0x749E3F80U, {0x749E3F80U, 0x74C71E00U, 0x74ED5980U, 0x75163800U, 0x753DC500U, 0x7566A380U, 0x758E3080U, 0x75B70F00U, 0x75DFED80U, 0x76077A80U, 0x76305900U, 0x7657E600U}}, // NOLINT(whitespace/line_length)
+ /* 2033 Year */ {0x000007F1U, 0x7680C480U, {0x7680C480U, 0x76A9A300U, 0x76CE8D00U, 0x76F76B80U, 0x771EF880U, 0x7747D700U, 0x776F6400U, 0x77984280U, 0x77C12100U, 0x77E8AE00U, 0x78118C80U, 0x78391980U}}, // NOLINT(whitespace/line_length)
+ /* 2034 Year */ {0x000007F2U, 0x7861F800U, {0x7861F800U, 0x788AD680U, 0x78AFC080U, 0x78D89F00U, 0x79002C00U, 0x79290A80U, 0x79509780U, 0x79797600U, 0x79A25480U, 0x79C9E180U, 0x79F2C000U, 0x7A1A4D00U}}, // NOLINT(whitespace/line_length)
+ /* 2035 Year */ {0x000007F3U, 0x7A432B80U, {0x7A432B80U, 0x7A6C0A00U, 0x7A90F400U, 0x7AB9D280U, 0x7AE15F80U, 0x7B0A3E00U, 0x7B31CB00U, 0x7B5AA980U, 0x7B838800U, 0x7BAB1500U, 0x7BD3F380U, 0x7BFB8080U}}, // NOLINT(whitespace/line_length)
+ /* 2036 Year */ {0x000007F4U, 0x7C245F00U, {0x7C245F00U, 0x7C4D3D80U, 0x7C737900U, 0x7C9C5780U, 0x7CC3E480U, 0x7CECC300U, 0x7D145000U, 0x7D3D2E80U, 0x7D660D00U, 0x7D8D9A00U, 0x7DB67880U, 0x7DDE0580U}}, // NOLINT(whitespace/line_length)
+ /* 2037 Year */ {0x000007F5U, 0x7E06E400U, {0x7E06E400U, 0x7E2FC280U, 0x7E54AC80U, 0x7E7D8B00U, 0x7EA51800U, 0x7ECDF680U, 0x7EF58380U, 0x7F1E6200U, 0x7F474080U, 0x7F6ECD80U, 0x7F97AC00U, 0x7FBF3900U}}, // NOLINT(whitespace/line_length)
+ /* 2038 Year */ {0x000007F6U, 0x7FE81780U, {0x7FE81780U, 0x8010F600U, 0x8035E000U, 0x805EBE80U, 0x80864B80U, 0x80AF2A00U, 0x80D6B700U, 0x80FF9580U, 0x81287400U, 0x81500100U, 0x8178DF80U, 0x81A06C80U}}, // NOLINT(whitespace/line_length)
+ /* 2039 Year */ {0x000007F7U, 0x81C94B00U, {0x81C94B00U, 0x81F22980U, 0x82171380U, 0x823FF200U, 0x82677F00U, 0x82905D80U, 0x82B7EA80U, 0x82E0C900U, 0x8309A780U, 0x83313480U, 0x835A1300U, 0x8381A000U}}, // NOLINT(whitespace/line_length)
+ /* 2040 Year */ {0x000007F8U, 0x83AA7E80U, {0x83AA7E80U, 0x83D35D00U, 0x83F99880U, 0x84227700U, 0x844A0400U, 0x8472E280U, 0x849A6F80U, 0x84C34E00U, 0x84EC2C80U, 0x8513B980U, 0x853C9800U, 0x85642500U}}, // NOLINT(whitespace/line_length)
+ /* 2041 Year */ {0x000007F9U, 0x858D0380U, {0x858D0380U, 0x85B5E200U, 0x85DACC00U, 0x8603AA80U, 0x862B3780U, 0x86541600U, 0x867BA300U, 0x86A48180U, 0x86CD6000U, 0x86F4ED00U, 0x871DCB80U, 0x87455880U}}, // NOLINT(whitespace/line_length)
+ /* 2042 Year */ {0x000007FAU, 0x876E3700U, {0x876E3700U, 0x87971580U, 0x87BBFF80U, 0x87E4DE00U, 0x880C6B00U, 0x88354980U, 0x885CD680U, 0x8885B500U, 0x88AE9380U, 0x88D62080U, 0x88FEFF00U, 0x89268C00U}}, // NOLINT(whitespace/line_length)
+ /* 2043 Year */ {0x000007FBU, 0x894F6A80U, {0x894F6A80U, 0x89784900U, 0x899D3300U, 0x89C61180U, 0x89ED9E80U, 0x8A167D00U, 0x8A3E0A00U, 0x8A66E880U, 0x8A8FC700U, 0x8AB75400U, 0x8AE03280U, 0x8B07BF80U}}, // NOLINT(whitespace/line_length)
+ /* 2044 Year */ {0x000007FCU, 0x8B309E00U, {0x8B309E00U, 0x8B597C80U, 0x8B7FB800U, 0x8BA89680U, 0x8BD02380U, 0x8BF90200U, 0x8C208F00U, 0x8C496D80U, 0x8C724C00U, 0x8C99D900U, 0x8CC2B780U, 0x8CEA4480U}}, // NOLINT(whitespace/line_length)
+ /* 2045 Year */ {0x000007FDU, 0x8D132300U, {0x8D132300U, 0x8D3C0180U, 0x8D60EB80U, 0x8D89CA00U, 0x8DB15700U, 0x8DDA3580U, 0x8E01C280U, 0x8E2AA100U, 0x8E537F80U, 0x8E7B0C80U, 0x8EA3EB00U, 0x8ECB7800U}}, // NOLINT(whitespace/line_length)
+ /* 2046 Year */ {0x000007FEU, 0x8EF45680U, {0x8EF45680U, 0x8F1D3500U, 0x8F421F00U, 0x8F6AFD80U, 0x8F928A80U, 0x8FBB6900U, 0x8FE2F600U, 0x900BD480U, 0x9034B300U, 0x905C4000U, 0x90851E80U, 0x90ACAB80U}}, // NOLINT(whitespace/line_length)
+ /* 2047 Year */ {0x000007FFU, 0x90D58A00U, {0x90D58A00U, 0x90FE6880U, 0x91235280U, 0x914C3100U, 0x9173BE00U, 0x919C9C80U, 0x91C42980U, 0x91ED0800U, 0x9215E680U, 0x923D7380U, 0x92665200U, 0x928DDF00U}}, // NOLINT(whitespace/line_length)
+ /* 2048 Year */ {0x00000800U, 0x92B6BD80U, {0x92B6BD80U, 0x92DF9C00U, 0x9305D780U, 0x932EB600U, 0x93564300U, 0x937F2180U, 0x93A6AE80U, 0x93CF8D00U, 0x93F86B80U, 0x941FF880U, 0x9448D700U, 0x94706400U}}, // NOLINT(whitespace/line_length)
+ /* 2049 Year */ {0x00000801U, 0x94994280U, {0x94994280U, 0x94C22100U, 0x94E70B00U, 0x950FE980U, 0x95377680U, 0x95605500U, 0x9587E200U, 0x95B0C080U, 0x95D99F00U, 0x96012C00U, 0x962A0A80U, 0x96519780U}}, // NOLINT(whitespace/line_length)
+ /* 2050 Year */ {0x00000802U, 0x967A7600U, {0x967A7600U, 0x96A35480U, 0x96C83E80U, 0x96F11D00U, 0x9718AA00U, 0x97418880U, 0x97691580U, 0x9791F400U, 0x97BAD280U, 0x97E25F80U, 0x980B3E00U, 0x9832CB00U}}, // NOLINT(whitespace/line_length)
+ /* 2051 Year */ {0x00000803U, 0x985BA980U, {0x985BA980U, 0x98848800U, 0x98A97200U, 0x98D25080U, 0x98F9DD80U, 0x9922BC00U, 0x994A4900U, 0x99732780U, 0x999C0600U, 0x99C39300U, 0x99EC7180U, 0x9A13FE80U}}, // NOLINT(whitespace/line_length)
+ /* 2052 Year */ {0x00000804U, 0x9A3CDD00U, {0x9A3CDD00U, 0x9A65BB80U, 0x9A8BF700U, 0x9AB4D580U, 0x9ADC6280U, 0x9B054100U, 0x9B2CCE00U, 0x9B55AC80U, 0x9B7E8B00U, 0x9BA61800U, 0x9BCEF680U, 0x9BF68380U}}, // NOLINT(whitespace/line_length)
+ /* 2053 Year */ {0x00000805U, 0x9C1F6200U, {0x9C1F6200U, 0x9C484080U, 0x9C6D2A80U, 0x9C960900U, 0x9CBD9600U, 0x9CE67480U, 0x9D0E0180U, 0x9D36E000U, 0x9D5FBE80U, 0x9D874B80U, 0x9DB02A00U, 0x9DD7B700U}}, // NOLINT(whitespace/line_length)
+ /* 2054 Year */ {0x00000806U, 0x9E009580U, {0x9E009580U, 0x9E297400U, 0x9E4E5E00U, 0x9E773C80U, 0x9E9EC980U, 0x9EC7A800U, 0x9EEF3500U, 0x9F181380U, 0x9F40F200U, 0x9F687F00U, 0x9F915D80U, 0x9FB8EA80U}}, // NOLINT(whitespace/line_length)
+ /* 2055 Year */ {0x00000807U, 0x9FE1C900U, {0x9FE1C900U, 0xA00AA780U, 0xA02F9180U, 0xA0587000U, 0xA07FFD00U, 0xA0A8DB80U, 0xA0D06880U, 0xA0F94700U, 0xA1222580U, 0xA149B280U, 0xA1729100U, 0xA19A1E00U}}, // NOLINT(whitespace/line_length)
+ /* 2056 Year */ {0x00000808U, 0xA1C2FC80U, {0xA1C2FC80U, 0xA1EBDB00U, 0xA2121680U, 0xA23AF500U, 0xA2628200U, 0xA28B6080U, 0xA2B2ED80U, 0xA2DBCC00U, 0xA304AA80U, 0xA32C3780U, 0xA3551600U, 0xA37CA300U}}, // NOLINT(whitespace/line_length)
+ /* 2057 Year */ {0x00000809U, 0xA3A58180U, {0xA3A58180U, 0xA3CE6000U, 0xA3F34A00U, 0xA41C2880U, 0xA443B580U, 0xA46C9400U, 0xA4942100U, 0xA4BCFF80U, 0xA4E5DE00U, 0xA50D6B00U, 0xA5364980U, 0xA55DD680U}}, // NOLINT(whitespace/line_length)
+ /* 2058 Year */ {0x0000080AU, 0xA586B500U, {0xA586B500U, 0xA5AF9380U, 0xA5D47D80U, 0xA5FD5C00U, 0xA624E900U, 0xA64DC780U, 0xA6755480U, 0xA69E3300U, 0xA6C71180U, 0xA6EE9E80U, 0xA7177D00U, 0xA73F0A00U}}, // NOLINT(whitespace/line_length)
+ /* 2059 Year */ {0x0000080BU, 0xA767E880U, {0xA767E880U, 0xA790C700U, 0xA7B5B100U, 0xA7DE8F80U, 0xA8061C80U, 0xA82EFB00U, 0xA8568800U, 0xA87F6680U, 0xA8A84500U, 0xA8CFD200U, 0xA8F8B080U, 0xA9203D80U}}, // NOLINT(whitespace/line_length)
+ /* 2060 Year */ {0x0000080CU, 0xA9491C00U, {0xA9491C00U, 0xA971FA80U, 0xA9983600U, 0xA9C11480U, 0xA9E8A180U, 0xAA118000U, 0xAA390D00U, 0xAA61EB80U, 0xAA8ACA00U, 0xAAB25700U, 0xAADB3580U, 0xAB02C280U}}, // NOLINT(whitespace/line_length)
+ /* 2061 Year */ {0x0000080DU, 0xAB2BA100U, {0xAB2BA100U, 0xAB547F80U, 0xAB796980U, 0xABA24800U, 0xABC9D500U, 0xABF2B380U, 0xAC1A4080U, 0xAC431F00U, 0xAC6BFD80U, 0xAC938A80U, 0xACBC6900U, 0xACE3F600U}}, // NOLINT(whitespace/line_length)
+ /* 2062 Year */ {0x0000080EU, 0xAD0CD480U, {0xAD0CD480U, 0xAD35B300U, 0xAD5A9D00U, 0xAD837B80U, 0xADAB0880U, 0xADD3E700U, 0xADFB7400U, 0xAE245280U, 0xAE4D3100U, 0xAE74BE00U, 0xAE9D9C80U, 0xAEC52980U}}, // NOLINT(whitespace/line_length)
+ /* 2063 Year */ {0x0000080FU, 0xAEEE0800U, {0xAEEE0800U, 0xAF16E680U, 0xAF3BD080U, 0xAF64AF00U, 0xAF8C3C00U, 0xAFB51A80U, 0xAFDCA780U, 0xB0058600U, 0xB02E6480U, 0xB055F180U, 0xB07ED000U, 0xB0A65D00U}}, // NOLINT(whitespace/line_length)
+ /* 2064 Year */ {0x00000810U, 0xB0CF3B80U, {0xB0CF3B80U, 0xB0F81A00U, 0xB11E5580U, 0xB1473400U, 0xB16EC100U, 0xB1979F80U, 0xB1BF2C80U, 0xB1E80B00U, 0xB210E980U, 0xB2387680U, 0xB2615500U, 0xB288E200U}}, // NOLINT(whitespace/line_length)
+ /* 2065 Year */ {0x00000811U, 0xB2B1C080U, {0xB2B1C080U, 0xB2DA9F00U, 0xB2FF8900U, 0xB3286780U, 0xB34FF480U, 0xB378D300U, 0xB3A06000U, 0xB3C93E80U, 0xB3F21D00U, 0xB419AA00U, 0xB4428880U, 0xB46A1580U}}, // NOLINT(whitespace/line_length)
+ /* 2066 Year */ {0x00000812U, 0xB492F400U, {0xB492F400U, 0xB4BBD280U, 0xB4E0BC80U, 0xB5099B00U, 0xB5312800U, 0xB55A0680U, 0xB5819380U, 0xB5AA7200U, 0xB5D35080U, 0xB5FADD80U, 0xB623BC00U, 0xB64B4900U}}, // NOLINT(whitespace/line_length)
+ /* 2067 Year */ {0x00000813U, 0xB6742780U, {0xB6742780U, 0xB69D0600U, 0xB6C1F000U, 0xB6EACE80U, 0xB7125B80U, 0xB73B3A00U, 0xB762C700U, 0xB78BA580U, 0xB7B48400U, 0xB7DC1100U, 0xB804EF80U, 0xB82C7C80U}}, // NOLINT(whitespace/line_length)
+ /* 2068 Year */ {0x00000814U, 0xB8555B00U, {0xB8555B00U, 0xB87E3980U, 0xB8A47500U, 0xB8CD5380U, 0xB8F4E080U, 0xB91DBF00U, 0xB9454C00U, 0xB96E2A80U, 0xB9970900U, 0xB9BE9600U, 0xB9E77480U, 0xBA0F0180U}}, // NOLINT(whitespace/line_length)
+ /* 2069 Year */ {0x00000815U, 0xBA37E000U, {0xBA37E000U, 0xBA60BE80U, 0xBA85A880U, 0xBAAE8700U, 0xBAD61400U, 0xBAFEF280U, 0xBB267F80U, 0xBB4F5E00U, 0xBB783C80U, 0xBB9FC980U, 0xBBC8A800U, 0xBBF03500U}}, // NOLINT(whitespace/line_length)
+ /* 2070 Year */ {0x00000816U, 0xBC191380U, {0xBC191380U, 0xBC41F200U, 0xBC66DC00U, 0xBC8FBA80U, 0xBCB74780U, 0xBCE02600U, 0xBD07B300U, 0xBD309180U, 0xBD597000U, 0xBD80FD00U, 0xBDA9DB80U, 0xBDD16880U}}, // NOLINT(whitespace/line_length)
+ /* 2071 Year */ {0x00000817U, 0xBDFA4700U, {0xBDFA4700U, 0xBE232580U, 0xBE480F80U, 0xBE70EE00U, 0xBE987B00U, 0xBEC15980U, 0xBEE8E680U, 0xBF11C500U, 0xBF3AA380U, 0xBF623080U, 0xBF8B0F00U, 0xBFB29C00U}}, // NOLINT(whitespace/line_length)
+ /* 2072 Year */ {0x00000818U, 0xBFDB7A80U, {0xBFDB7A80U, 0xC0045900U, 0xC02A9480U, 0xC0537300U, 0xC07B0000U, 0xC0A3DE80U, 0xC0CB6B80U, 0xC0F44A00U, 0xC11D2880U, 0xC144B580U, 0xC16D9400U, 0xC1952100U}}, // NOLINT(whitespace/line_length)
+ /* 2073 Year */ {0x00000819U, 0xC1BDFF80U, {0xC1BDFF80U, 0xC1E6DE00U, 0xC20BC800U, 0xC234A680U, 0xC25C3380U, 0xC2851200U, 0xC2AC9F00U, 0xC2D57D80U, 0xC2FE5C00U, 0xC325E900U, 0xC34EC780U, 0xC3765480U}}, // NOLINT(whitespace/line_length)
+ /* 2074 Year */ {0x0000081AU, 0xC39F3300U, {0xC39F3300U, 0xC3C81180U, 0xC3ECFB80U, 0xC415DA00U, 0xC43D6700U, 0xC4664580U, 0xC48DD280U, 0xC4B6B100U, 0xC4DF8F80U, 0xC5071C80U, 0xC52FFB00U, 0xC5578800U}}, // NOLINT(whitespace/line_length)
+ /* 2075 Year */ {0x0000081BU, 0xC5806680U, {0xC5806680U, 0xC5A94500U, 0xC5CE2F00U, 0xC5F70D80U, 0xC61E9A80U, 0xC6477900U, 0xC66F0600U, 0xC697E480U, 0xC6C0C300U, 0xC6E85000U, 0xC7112E80U, 0xC738BB80U}}, // NOLINT(whitespace/line_length)
+ /* 2076 Year */ {0x0000081CU, 0xC7619A00U, {0xC7619A00U, 0xC78A7880U, 0xC7B0B400U, 0xC7D99280U, 0xC8011F80U, 0xC829FE00U, 0xC8518B00U, 0xC87A6980U, 0xC8A34800U, 0xC8CAD500U, 0xC8F3B380U, 0xC91B4080U}}, // NOLINT(whitespace/line_length)
+ /* 2077 Year */ {0x0000081DU, 0xC9441F00U, {0xC9441F00U, 0xC96CFD80U, 0xC991E780U, 0xC9BAC600U, 0xC9E25300U, 0xCA0B3180U, 0xCA32BE80U, 0xCA5B9D00U, 0xCA847B80U, 0xCAAC0880U, 0xCAD4E700U, 0xCAFC7400U}}, // NOLINT(whitespace/line_length)
+ /* 2078 Year */ {0x0000081EU, 0xCB255280U, {0xCB255280U, 0xCB4E3100U, 0xCB731B00U, 0xCB9BF980U, 0xCBC38680U, 0xCBEC6500U, 0xCC13F200U, 0xCC3CD080U, 0xCC65AF00U, 0xCC8D3C00U, 0xCCB61A80U, 0xCCDDA780U}}, // NOLINT(whitespace/line_length)
+ /* 2079 Year */ {0x0000081FU, 0xCD068600U, {0xCD068600U, 0xCD2F6480U, 0xCD544E80U, 0xCD7D2D00U, 0xCDA4BA00U, 0xCDCD9880U, 0xCDF52580U, 0xCE1E0400U, 0xCE46E280U, 0xCE6E6F80U, 0xCE974E00U, 0xCEBEDB00U}}, // NOLINT(whitespace/line_length)
+ /* 2080 Year */ {0x00000820U, 0xCEE7B980U, {0xCEE7B980U, 0xCF109800U, 0xCF36D380U, 0xCF5FB200U, 0xCF873F00U, 0xCFB01D80U, 0xCFD7AA80U, 0xD0008900U, 0xD0296780U, 0xD050F480U, 0xD079D300U, 0xD0A16000U}}, // NOLINT(whitespace/line_length)
+ /* 2081 Year */ {0x00000821U, 0xD0CA3E80U, {0xD0CA3E80U, 0xD0F31D00U, 0xD1180700U, 0xD140E580U, 0xD1687280U, 0xD1915100U, 0xD1B8DE00U, 0xD1E1BC80U, 0xD20A9B00U, 0xD2322800U, 0xD25B0680U, 0xD2829380U}}, // NOLINT(whitespace/line_length)
+ /* 2082 Year */ {0x00000822U, 0xD2AB7200U, {0xD2AB7200U, 0xD2D45080U, 0xD2F93A80U, 0xD3221900U, 0xD349A600U, 0xD3728480U, 0xD39A1180U, 0xD3C2F000U, 0xD3EBCE80U, 0xD4135B80U, 0xD43C3A00U, 0xD463C700U}}, // NOLINT(whitespace/line_length)
+ /* 2083 Year */ {0x00000823U, 0xD48CA580U, {0xD48CA580U, 0xD4B58400U, 0xD4DA6E00U, 0xD5034C80U, 0xD52AD980U, 0xD553B800U, 0xD57B4500U, 0xD5A42380U, 0xD5CD0200U, 0xD5F48F00U, 0xD61D6D80U, 0xD644FA80U}}, // NOLINT(whitespace/line_length)
+ /* 2084 Year */ {0x00000824U, 0xD66DD900U, {0xD66DD900U, 0xD696B780U, 0xD6BCF300U, 0xD6E5D180U, 0xD70D5E80U, 0xD7363D00U, 0xD75DCA00U, 0xD786A880U, 0xD7AF8700U, 0xD7D71400U, 0xD7FFF280U, 0xD8277F80U}}, // NOLINT(whitespace/line_length)
+ /* 2085 Year */ {0x00000825U, 0xD8505E00U, {0xD8505E00U, 0xD8793C80U, 0xD89E2680U, 0xD8C70500U, 0xD8EE9200U, 0xD9177080U, 0xD93EFD80U, 0xD967DC00U, 0xD990BA80U, 0xD9B84780U, 0xD9E12600U, 0xDA08B300U}}, // NOLINT(whitespace/line_length)
+ /* 2086 Year */ {0x00000826U, 0xDA319180U, {0xDA319180U, 0xDA5A7000U, 0xDA7F5A00U, 0xDAA83880U, 0xDACFC580U, 0xDAF8A400U, 0xDB203100U, 0xDB490F80U, 0xDB71EE00U, 0xDB997B00U, 0xDBC25980U, 0xDBE9E680U}}, // NOLINT(whitespace/line_length)
+ /* 2087 Year */ {0x00000827U, 0xDC12C500U, {0xDC12C500U, 0xDC3BA380U, 0xDC608D80U, 0xDC896C00U, 0xDCB0F900U, 0xDCD9D780U, 0xDD016480U, 0xDD2A4300U, 0xDD532180U, 0xDD7AAE80U, 0xDDA38D00U, 0xDDCB1A00U}}, // NOLINT(whitespace/line_length)
+ /* 2088 Year */ {0x00000828U, 0xDDF3F880U, {0xDDF3F880U, 0xDE1CD700U, 0xDE431280U, 0xDE6BF100U, 0xDE937E00U, 0xDEBC5C80U, 0xDEE3E980U, 0xDF0CC800U, 0xDF35A680U, 0xDF5D3380U, 0xDF861200U, 0xDFAD9F00U}}, // NOLINT(whitespace/line_length)
+ /* 2089 Year */ {0x00000829U, 0xDFD67D80U, {0xDFD67D80U, 0xDFFF5C00U, 0xE0244600U, 0xE04D2480U, 0xE074B180U, 0xE09D9000U, 0xE0C51D00U, 0xE0EDFB80U, 0xE116DA00U, 0xE13E6700U, 0xE1674580U, 0xE18ED280U}}, // NOLINT(whitespace/line_length)
+ /* 2090 Year */ {0x0000082AU, 0xE1B7B100U, {0xE1B7B100U, 0xE1E08F80U, 0xE2057980U, 0xE22E5800U, 0xE255E500U, 0xE27EC380U, 0xE2A65080U, 0xE2CF2F00U, 0xE2F80D80U, 0xE31F9A80U, 0xE3487900U, 0xE3700600U}}, // NOLINT(whitespace/line_length)
+ /* 2091 Year */ {0x0000082BU, 0xE398E480U, {0xE398E480U, 0xE3C1C300U, 0xE3E6AD00U, 0xE40F8B80U, 0xE4371880U, 0xE45FF700U, 0xE4878400U, 0xE4B06280U, 0xE4D94100U, 0xE500CE00U, 0xE529AC80U, 0xE5513980U}}, // NOLINT(whitespace/line_length)
+ /* 2092 Year */ {0x0000082CU, 0xE57A1800U, {0xE57A1800U, 0xE5A2F680U, 0xE5C93200U, 0xE5F21080U, 0xE6199D80U, 0xE6427C00U, 0xE66A0900U, 0xE692E780U, 0xE6BBC600U, 0xE6E35300U, 0xE70C3180U, 0xE733BE80U}}, // NOLINT(whitespace/line_length)
+ /* 2093 Year */ {0x0000082DU, 0xE75C9D00U, {0xE75C9D00U, 0xE7857B80U, 0xE7AA6580U, 0xE7D34400U, 0xE7FAD100U, 0xE823AF80U, 0xE84B3C80U, 0xE8741B00U, 0xE89CF980U, 0xE8C48680U, 0xE8ED6500U, 0xE914F200U}}, // NOLINT(whitespace/line_length)
+ /* 2094 Year */ {0x0000082EU, 0xE93DD080U, {0xE93DD080U, 0xE966AF00U, 0xE98B9900U, 0xE9B47780U, 0xE9DC0480U, 0xEA04E300U, 0xEA2C7000U, 0xEA554E80U, 0xEA7E2D00U, 0xEAA5BA00U, 0xEACE9880U, 0xEAF62580U}}, // NOLINT(whitespace/line_length)
+ /* 2095 Year */ {0x0000082FU, 0xEB1F0400U, {0xEB1F0400U, 0xEB47E280U, 0xEB6CCC80U, 0xEB95AB00U, 0xEBBD3800U, 0xEBE61680U, 0xEC0DA380U, 0xEC368200U, 0xEC5F6080U, 0xEC86ED80U, 0xECAFCC00U, 0xECD75900U}}, // NOLINT(whitespace/line_length)
+ /* 2096 Year */ {0x00000830U, 0xED003780U, {0xED003780U, 0xED291600U, 0xED4F5180U, 0xED783000U, 0xED9FBD00U, 0xEDC89B80U, 0xEDF02880U, 0xEE190700U, 0xEE41E580U, 0xEE697280U, 0xEE925100U, 0xEEB9DE00U}}, // NOLINT(whitespace/line_length)
+ /* 2097 Year */ {0x00000831U, 0xEEE2BC80U, {0xEEE2BC80U, 0xEF0B9B00U, 0xEF308500U, 0xEF596380U, 0xEF80F080U, 0xEFA9CF00U, 0xEFD15C00U, 0xEFFA3A80U, 0xF0231900U, 0xF04AA600U, 0xF0738480U, 0xF09B1180U}}, // NOLINT(whitespace/line_length)
+ /* 2098 Year */ {0x00000832U, 0xF0C3F000U, {0xF0C3F000U, 0xF0ECCE80U, 0xF111B880U, 0xF13A9700U, 0xF1622400U, 0xF18B0280U, 0xF1B28F80U, 0xF1DB6E00U, 0xF2044C80U, 0xF22BD980U, 0xF254B800U, 0xF27C4500U}}, // NOLINT(whitespace/line_length)
+ /* 2099 Year */ {0x00000833U, 0xF2A52380U, {0xF2A52380U, 0xF2CE0200U, 0xF2F2EC00U, 0xF31BCA80U, 0xF3435780U, 0xF36C3600U, 0xF393C300U, 0xF3BCA180U, 0xF3E58000U, 0xF40D0D00U, 0xF435EB80U, 0xF45D7880U}}, // NOLINT(whitespace/line_length)
+ /* 2100 Year */ {0x00000834U, 0xF4865700U, {0xF4865700U, 0xF4AF3580U, 0xF4D41F80U, 0xF4FCFE00U, 0xF5248B00U, 0xF54D6980U, 0xF574F680U, 0xF59DD500U, 0xF5C6B380U, 0xF5EE4080U, 0xF6171F00U, 0xF63EAC00U}}, // NOLINT(whitespace/line_length)
+ /* 2101 Year */ {0x00000835U, 0xF6678A80U, {0xF6678A80U, 0xF6906900U, 0xF6B55300U, 0xF6DE3180U, 0xF705BE80U, 0xF72E9D00U, 0xF7562A00U, 0xF77F0880U, 0xF7A7E700U, 0xF7CF7400U, 0xF7F85280U, 0xF81FDF80U}}, // NOLINT(whitespace/line_length)
+ /* 2102 Year */ {0x00000836U, 0xF848BE00U, {0xF848BE00U, 0xF8719C80U, 0xF8968680U, 0xF8BF6500U, 0xF8E6F200U, 0xF90FD080U, 0xF9375D80U, 0xF9603C00U, 0xF9891A80U, 0xF9B0A780U, 0xF9D98600U, 0xFA011300U}}, // NOLINT(whitespace/line_length)
+ /* 2103 Year */ {0x00000837U, 0xFA29F180U, {0xFA29F180U, 0xFA52D000U, 0xFA77BA00U, 0xFAA09880U, 0xFAC82580U, 0xFAF10400U, 0xFB189100U, 0xFB416F80U, 0xFB6A4E00U, 0xFB91DB00U, 0xFBBAB980U, 0xFBE24680U}}, // NOLINT(whitespace/line_length)
+ /* 2104 Year */ {0x00000838U, 0xFC0B2500U, {0xFC0B2500U, 0xFC340380U, 0xFC5A3F00U, 0xFC831D80U, 0xFCAAAA80U, 0xFCD38900U, 0xFCFB1600U, 0xFD23F480U, 0xFD4CD300U, 0xFD746000U, 0xFD9D3E80U, 0xFDC4CB80U}}, // NOLINT(whitespace/line_length)
+ /* 2105 Year */ {0x00000839U, 0xFDEDAA00U, {0xFDEDAA00U, 0xFE168880U, 0xFE3B7280U, 0xFE645100U, 0xFE8BDE00U, 0xFEB4BC80U, 0xFEDC4980U, 0xFF052800U, 0xFF2E0680U, 0xFF559380U, 0xFF7E7200U, 0xFFA5FF00U}}, // NOLINT(whitespace/line_length)
+ /* 2106 Year */ {0x0000083AU, 0xFFCEDD80U, {0xFFCEDD80U, 0xFFF7BC00U, 0x001CA600U, 0x00458480U, 0x006D1180U, 0x0095F000U, 0x00BD7D00U, 0x00E65B80U, 0x010F3A00U, 0x0136C700U, 0x015FA580U, 0x01873280U}} // NOLINT(whitespace/line_length)
+ }
+};
+
+/*************************************************************************
+@brief The date is converted at the multiplication second.
+@outline The specified time and date is converted at the multiplication second
+ from epoch time(0:0:0 January 1, 1970. )
+@type Completion return type<BR>
+@param[in] const LPSYSTEMTIME lp_st : Converted time and date
+@param[out] u_int32* uli_sec : Multiplication second from epoch time
+@threshold lp_st != NULL, uli_sec != NULL <BR>
+ 1970 <= lp_st.wYear <= 2105 <BR>
+ 1 <= lp_st.wMonth <= 12 <BR>
+ 1 <= lp_st.wDay <= 31 <BR>
+ 0 <= lp_st.wHour <= 23 <BR>
+ 0 <= lp_st.wMinute <= 59 <BR>
+ 0 <= lp_st.wSecond <= 59 <BR>
+@return RET_API
+@retval RET_NORMAL : Normal end
+@retval RET_ERROR : Abnormal end
+*****************************************************************************/
+RET_API ClockUtilityConvertDateToSecond(const LPSYSTEMTIME lp_st, u_int32* uli_sec) {
+ u_int8 imflg; /* Leap year determination flag 0:Not a leap year 1:Leap year */
+ u_int32 ui_day;
+ int32 century;
+ RET_API ret = RET_NORMAL;
+
+ /* Checking the NULL of Pointer Arguments */
+ if ((lp_st == NULL) || (uli_sec == NULL)) {
+ ret = RET_ERROR;
+ } else {
+ *uli_sec = 0; /* Reset accumulated seconds to 0 */
+
+ /* Parameter check */
+ if (((lp_st->wYear < 1970) || (2105 < lp_st->wYear)) || /* Check Year to Convert */
+ ((lp_st->wMonth < 1) || (12 < lp_st->wMonth))) { /* Check month to convert */
+ ret = RET_ERROR;
+ } else {
+ /* Determine the leap year and select the "Mnumonic For Remembering The Months With Fewer Than 31 Days" table. */
+ imflg = 0; /* Set the default to a non-leap year */
+ if ((lp_st->wYear % 4) == 0) { /* If the year is divisible by 4, */
+ imflg = 1; /* Be a leap year */
+ }
+ if ((lp_st->wYear % 100) == 0) { /* However,If the year is divisible by 100 */
+ imflg = 0; /* Not leap years */
+ }
+ if ((lp_st->wYear % 400) == 0) { /* However,If the year is divisible by 400 */
+ imflg = 1; /* Be a leap year */
+ }
+
+ /* Parameter check again */
+ if (((lp_st->wDay < 1) || (kUsMonth[imflg][lp_st->wMonth - 1] < lp_st->wDay)) || /* Check date to convert */
+ (23 < lp_st->wHour) || /* Check when converting */
+ (59 < lp_st->wMinute) || /* Check the minutes to convert */
+ (59 < lp_st->wSecond) ) { /* Check the seconds to convert */
+ ret = RET_ERROR;
+ } else {
+ /* Converting Hours, Minutes, and Seconds to Seconds */
+ *uli_sec = lp_st->wSecond; /* The specified seconds are stored as is. */
+ *uli_sec += lp_st->wMinute * SEC_PER_MIN; /* Convert specified minutes to seconds and add */
+ *uli_sec += lp_st->wHour * SEC_PER_HOUR; /* Convert specified hour to second and add */
+
+ /* Convert a date to the number of days since January 1, 1970 */ /* Task_31499 */
+ ui_day = 0;
+ ui_day += (lp_st->wYear - 1970) * 365;
+
+ /* Because years divisible by 100 are not counted as leap years,Calculate the number of times */
+ century = lp_st->wYear / 100;
+ /* Add the number of days added for the leap year up to the previous year */
+ /* Shift year to right by 2 bits until last year(Divide by 4) -
+ Exclude years divisible by 100(century) + Shift century right by 2 bits(Divide by 4
+ -> If it is divisible by 4, it is counted as a leap year */
+ ui_day += ((lp_st->wYear - 1) >> 2) - century + (century >> 2) - 477; /* 477 -> Number of leap years up to 1970 */
+ /* Add the number of days up to the previous month of the current year */
+ ui_day += kUsMonth[2][lp_st->wMonth - 1] + ((lp_st->wMonth > 2) ? imflg : 0);
+
+ ui_day += (lp_st->wDay - 1); /* Add the number of elapsed days */
+
+ *uli_sec += (ui_day * SEC_PER_DAY); /* Convert the number of days to seconds and add */
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*************************************************************************
+@brief The multiplication second is converted at the date.
+@outline The specified multiplication second is converted as a multiplication second from epoch time(0:0:0 January 1, 1970.) at time and date.
+@type Completion return type
+@param[in] const u_int32*uli_sec : Converted multiplication second from epoch time
+@param[out] LPSYSTEMTIME lp_st : Time after it converts it of date
+@threshold lp_st != NULL, uli_sec != NULL <BR>
+ uli_sec < 0xFFCEDD80
+@return RET_API
+@retval RET_NORMAL : Normal end
+@retval RET_ERROR : Abnormal end
+*****************************************************************************/
+
+RET_API ClockUtilityConvertSecondToDate(const u_int32* uli_sec, LPSYSTEMTIME lp_st) {
+ u_int32 i; /* Loop control */
+ u_int32 j; /* Loop control */
+ u_int32 uli_sec_wk; /* Total value save */
+ RET_API ret = RET_NORMAL; /* return value */
+ u_int8 complete_cnv = FALSE; /* Conversion completion flag */
+ u_int8 valid_date; /* Date Valid Value Flag */
+
+ /* Checking the NULL of Pointer Arguments */
+ if ((uli_sec == NULL) || (lp_st == NULL)) {
+ ret = RET_ERROR;
+ } else {
+ /* Back up the accumulated seconds to the work. */
+ uli_sec_wk = static_cast<u_int32>(*uli_sec);
+
+ /* Parameter check processing */
+ if (uli_sec_wk >= kUlDayCntTbl.st_tbl[CNV_YEAR_MAX].ulCount) {
+ ret = RET_ERROR;
+ } else {
+ /* Initialize */
+ lp_st->wYear = (WORD)(kUlDayCntTbl.st_tbl[0].ulYear);
+ lp_st->wMonth = (WORD)(1); /* Month Settings */
+ lp_st->wDay = (WORD)(1); /* Day Settings */
+ lp_st->wDayOfWeek = (WORD)(4); /* Setting the day of the week(Note : Corrected in cases other than 1970) */
+ lp_st->wHour = (WORD)(0); /* Time setting */
+ lp_st->wMinute = (WORD)(0); /* Minute setting */
+ lp_st->wSecond = (WORD)(0); /* Set Seconds */
+ lp_st->wMilliseconds = (WORD)(0); /* Set msec. */
+
+ /* Search time accumulated seconds conversion table */
+ for (i = 0; i < CNV_YEAR_MAX; i++) {
+ /* Set the year(Maximum value) */
+ if ((kUlDayCntTbl.st_tbl[i + 1].ulCount > uli_sec_wk) || (i == (CNV_YEAR_MAX - 1))) {
+ lp_st->wYear = (WORD)kUlDayCntTbl.st_tbl[i].ulYear;
+
+ /* Set the month(Maximum value) */
+ j = 0;
+ while ((j < 12) && (complete_cnv == FALSE)) {
+ /* Prevent 12Month(j=11)ulMonth[12] access */
+ valid_date = FALSE;
+ if (j == (MONTH_MAX - 1)) {
+ valid_date = TRUE;
+ } else {
+ if (kUlDayCntTbl.st_tbl[i].ulMonth[j + 1] > uli_sec_wk) {
+ valid_date = TRUE;
+ }
+ }
+
+ if (valid_date == TRUE) {
+ lp_st->wMonth = (WORD)(j + 1);
+
+ /* Day-of-week,Set Date Hour Minute Second */
+ lp_st->wDayOfWeek = (WORD)((lp_st->wDayOfWeek +
+ (WORD)((uli_sec_wk / SEC_PER_DAY) % 7)) % 7); /* Setting the day of the week */
+ uli_sec_wk = uli_sec_wk - (u_int32)(kUlDayCntTbl.st_tbl[i].ulMonth[j]);
+ lp_st->wDay = (WORD)((uli_sec_wk / SEC_PER_DAY) + 1); /* Day Settings */
+ lp_st->wSecond = (WORD)(uli_sec_wk % SEC_PER_MIN); /* Set Seconds */
+ lp_st->wMinute = (WORD)((uli_sec_wk % SEC_PER_HOUR) / SEC_PER_MIN); /* Minute setting */
+ lp_st->wHour = (WORD)((uli_sec_wk % SEC_PER_DAY) / SEC_PER_HOUR); /* Time setting */
+
+ complete_cnv = TRUE; /* Completion */
+ }
+ j++;
+ }
+ }
+
+ if (complete_cnv != FALSE) {
+ break;
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*************************************************************************
+@brief Type conversion is done.
+@outline It converts it from the TimeData type to the SYSTEMTIME type.
+@type Completion return type
+@param[in] const TimeData* base_time : Time of conversion origin
+@param[out] const SYSTEMTIME* result_time : Time after it converts it
+@threshold base_time != NULL<BR>
+@threshold result_time != NULL
+@return CLOCK_RETURN
+@retval CLOCK_OK : Normal end
+@retval CLOCK_ERROR : Abnormal end
+@retval CLOCK_ERROR_ARGUMENTS : The argument is wrong
+@trace
+*****************************************************************************/
+CLOCK_RETURN ClockApiConvertTimeDataToSYSTEMTIME(const TimeData* base_time, SYSTEMTIME* result_time) {
+ CLOCK_RETURN ret = CLOCK_ERROR;
+ RET_API ret_cnv = RET_ERROR;
+ u_int32 total_sec = 0;
+
+ if ((base_time != NULL) && (result_time != NULL)) {
+ /* Converting TimeData Types to SYSTEMTIME Types */
+ result_time->wYear = static_cast<WORD>(base_time->year);
+ result_time->wMonth = static_cast<WORD>(base_time->month);
+ result_time->wDay = static_cast<WORD>(base_time->day);
+ result_time->wHour = static_cast<WORD>(base_time->hour);
+ result_time->wMinute = static_cast<WORD>(base_time->minute);
+ result_time->wSecond = static_cast<WORD>(base_time->second);
+ result_time->wMilliseconds = 0; /* 0 because there is no corresponding parameter */
+ result_time->wDayOfWeek = CLKMNG_SUN; /* 0 because there is no corresponding parameter */
+
+ ret_cnv = ClockUtilityConvertDateToSecond(result_time, &total_sec);
+ if (ret_cnv == RET_NORMAL) {
+ /* Calculate the day of the week from the cumulative second. */
+ ret_cnv = ClockUtilityConvertSecondToDate(&total_sec, result_time);
+ if (ret_cnv == RET_NORMAL) {
+ ret = CLOCK_OK;
+ } else {
+ ret = CLOCK_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ClockUtility.lib:%s:LINE:%d\r\nClockApiConvertTimeDataToSYSTEMTIME"\
+ "ClockUtilityConvertSecondToDate ERROR!![%d]\r\n",
+ LTEXT(__FILE__),
+ __LINE__,
+ ret);
+ }
+ } else {
+ ret = CLOCK_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ClockUtility.lib:%s:LINE:%d\r\nClockApiConvertTimeDataToSYSTEMTIME"\
+ "ClockUtilityConvertDateToSecond ERROR!![%d]\r\n",
+ LTEXT(__FILE__),
+ __LINE__,
+ ret);
+ }
+
+ } else {
+ /* Invalid argument */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ClockUtility.lib:%s:LINE:%d\r\nClockApiConvertTimeDataToSYSTEMTIME"\
+ "Arguments ERROR!![%d]\r\n",
+ LTEXT(__FILE__),
+ __LINE__,
+ ret);
+ ret = CLOCK_ERROR_ARGUMENTS;
+ }
+ return ret;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Common.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Common.cpp
new file mode 100755
index 0000000..9503b34
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Common.cpp
@@ -0,0 +1,127 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :DeadReckoning_Common.cpp
+ * System name :PastModel002
+ * Subsystem name :DeadReckoning processes
+ * Program name :DeadReckoning shared process(DEADRECKONING_COMMON)
+ * Module configuration DeadReckoningMemcmp() Functions for Common Processing Memory Block Comparisons
+ * DeadReckoningCheckDid() Common Processing Data ID Check Function
+ * DeadReckoningGetDataMasterOffset() Get function for common processing data master offset value
+ ******************************************************************************/
+#include "DeadReckoning_Common.h"
+#include <vehicle_service/positioning_base_library.h>
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static const DEADRECKONING_DID_OFFSET_TBL kGstDidListS[] = {
+ /* Data ID Offset size Reserved */
+ { VEHICLE_DID_DR_LONGITUDE, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_LATITUDE, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_ALTITUDE, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_SPEED, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_HEADING, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_GYRO_OFFSET, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_GYRO_SCALE_FACTOR, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL, DEADRECKONING_OFFSET_NORMAL, {0, 0} },
+ { 0, 0, {0, 0} } /* Termination code */
+};
+
+/*******************************************************************************
+* MODULE : DeadReckoningMemcmp
+* ABSTRACT : Functions for Common Processing Memory Block Comparisons
+* FUNCTION : Memory block comparison processing
+* ARGUMENT : *vp_data1 : Comparison target address 1
+* : *vp_data2 : Comparison target address 2
+* : uc_size : Comparison Size
+* NOTE :
+* RETURN : DEADRECKONING_EQ : No data change
+* : DEADRECKONING_NEQ : Data change
+******************************************************************************/
+u_int8 DeadReckoningMemcmp(const void *vp_data1, const void *vp_data2, size_t uc_size) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 l_ret = DEADRECKONING_EQ;
+ const u_int8 *p_data1 = (const u_int8 *)vp_data1;
+ const u_int8 *p_data2 = (const u_int8 *)vp_data1;
+
+ /* Loop by data size */
+ while (uc_size > 0) {
+ if (*p_data1 != *p_data2) {
+ /* Data mismatch */
+ l_ret = DEADRECKONING_NEQ;
+ break;
+ }
+ p_data1++;
+ p_data2++;
+ uc_size--;
+ }
+ return(l_ret);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningCheckDid
+* ABSTRACT : Common Processing Data ID Check Function
+* FUNCTION : Check if the specified DID corresponds to the vehicle sensor information
+* ARGUMENT : ul_did : Data ID
+* NOTE :
+* RETURN : DEADRECKONING_INVALID :Disabled
+* : DEADRECKONING_EFFECTIVE :Enabled
+******************************************************************************/
+int32 DeadReckoningCheckDid(DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i = 0;
+ int32 l_ret = DEADRECKONING_INVALID;
+
+ while (0 != kGstDidListS[i].ul_did) {
+ if (kGstDidListS[i].ul_did == ul_did) {
+ /* DID enabled */
+ l_ret = DEADRECKONING_EFFECTIVE;
+ break;
+ }
+ i++;
+ }
+ return(l_ret);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningGetDataMasterOffset
+* ABSTRACT : Get function for common processing data master offset value
+* FUNCTION : Get the fixed offset value for a given DID
+* ARGUMENT : ul_did : Data ID
+* NOTE :
+* RETURN : Offset value(Returns 0 if DID is invalid)
+* :
+******************************************************************************/
+u_int16 DeadReckoningGetDataMasterOffset(DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i = 0; /* Generic counters */
+ u_int16 us_ret = 0; /* Return value of this function */
+
+ while (0 != kGstDidListS[i].ul_did) {
+ if (kGstDidListS[i].ul_did == ul_did) {
+ /* DID enabled */
+ us_ret = kGstDidListS[i].us_offset;
+ break;
+ }
+ i++;
+ }
+ return(us_ret);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DataMasterMain.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DataMasterMain.cpp
new file mode 100755
index 0000000..93adda0
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DataMasterMain.cpp
@@ -0,0 +1,298 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :DeadReckoning_DataMasterMain.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle SW Data Master
+ * Module configuration :DeadReckoningInitDataMaster() Guess Navigation Data Master Initialization Function
+ * :DeadReckoningSetDataMaster() Estimated Navigational Data Master SW Data Set Processing
+ * :DeadReckoningGetDataMaster() Estimated Navigational Data Master Get Processing
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+#define DR_DEBUG 0
+
+/*******************************************************************************
+* MODULE : DeadReckoningInitDataMaster
+* ABSTRACT : Initialization of Guess Navigation Data Master
+* FUNCTION : Initialize the estimated navigation data master
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningInitDataMaster(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Vehicle sensor data master initialization */
+ DeadReckoningInitLongitudeDr();
+ DeadReckoningInitLatitudeDr();
+ DeadReckoningInitAltitudeDr();
+ DeadReckoningInitSpeedDr();
+ DeadReckoningInitHeadingDr();
+ DeadReckoningInitSnsCounterDr();
+ DeadReckoningInitGyroOffsetDr();
+ DeadReckoningInitGyroScaleFactorDr();
+ DeadReckoningInitGyroScaleFactorLevelDr();
+ DeadReckoningInitSpeedPulseScaleFactorDr();
+ DeadReckoningInitSpeedPulseScaleFactorLevelDr();
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoning_SetDataMaster_Sub
+* ABSTRACT : Estimated Navigational Data Master SW Data Set Processing
+* FUNCTION : Set estimated navigation data
+* ARGUMENT : *p_data : SW vehicle signal notification data
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningSetDataMaster(const DEADRECKONING_DATA_MASTER *p_data,
+ PFUNC_DR_DMASTER_SET_N p_datamaster_set_n) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 chg_type;
+
+ static u_int8 gyro_parameter_chg_type = 0;
+ static u_int8 speedpulse_parameter_chg_type = 0;
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (p_data->ul_did) {
+ case VEHICLE_DID_DR_LONGITUDE:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetLongitudeDr(p_data);
+ /* Implementation of delivery process at LATITUDE updating timings */
+ /* Since the order of transmission (updating) at the main receiver is fixed, there is no problem. */
+ break;
+ }
+ case VEHICLE_DID_DR_LATITUDE:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetLatitudeDr(p_data);
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_ALTITUDE:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetAltitudeDr(p_data);
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetSpeedDr(p_data);
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_HEADING:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetHeadingDr(p_data);
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_SNS_COUNTER:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetSnsCounterDr(p_data);
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_OFFSET:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetGyroOffsetDr(p_data);
+ /* Distribution processing not performed in this DID */
+ /* Delivery processing is executed when VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL is updated. */
+ /* The GyroParameter order is defined by DeadReckoning_RcvMsg(). */
+ if (chg_type == DEADRECKONING_NEQ) {
+ gyro_parameter_chg_type = DEADRECKONING_NEQ;
+ }
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetGyroScaleFactorDr(p_data);
+ /* Distribution processing not performed in this DID */
+ /* Delivery processing is executed when VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL is updated. */
+ /* The GyroParameter order is defined by DeadReckoning_RcvMsg(). */
+ if (chg_type == DEADRECKONING_NEQ) {
+ gyro_parameter_chg_type = DEADRECKONING_NEQ;
+ }
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetGyroScaleFactorLevelDr(p_data);
+ if (gyro_parameter_chg_type == DEADRECKONING_NEQ) {
+ chg_type = DEADRECKONING_NEQ;
+ gyro_parameter_chg_type = DEADRECKONING_EQ;
+ }
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetSpeedPulseScaleFactorDr(p_data);
+ /* Distribution processing not performed in this DID */
+ /* Delivery processing is executed when VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL is updated. */
+ /* The SpeedPulseParameter order is defined by DeadReckoning_RcvMsg(). */
+ if (chg_type == DEADRECKONING_NEQ) {
+ speedpulse_parameter_chg_type = DEADRECKONING_NEQ;
+ }
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningSetDataMaster DID=[0x%08X] DSIZE=[%d] \r\n",
+ p_data->ul_did, p_data->us_size);
+#endif
+ chg_type = DeadReckoningSetSpeedPulseScaleFactorLevelDr(p_data);
+ if (speedpulse_parameter_chg_type == DEADRECKONING_NEQ) {
+ chg_type = DEADRECKONING_NEQ;
+ speedpulse_parameter_chg_type = DEADRECKONING_EQ;
+ }
+ (*p_datamaster_set_n)(p_data->ul_did, chg_type, DEADRECKONING_GETMETHOD_DR);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningGetDataMaster
+* ABSTRACT : Estimated Navigational Data Master Get Processing
+* FUNCTION : Provide an estimated navigation data master
+* ARGUMENT : ul_did : Data ID corresponding to the vehicle information
+* : *p_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningGetDataMaster(DID ul_did, DEADRECKONING_DATA_MASTER *p_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /*------------------------------------------------------*/
+ /* Call the data Get processing associated with the DID */
+ /*------------------------------------------------------*/
+ switch (ul_did) {
+ /*------------------------------------------------------*/
+ /* Vehicle sensor data group */
+ /*------------------------------------------------------*/
+ case VEHICLE_DID_DR_LONGITUDE:
+ {
+ DeadReckoningGetLongitudeDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_LATITUDE:
+ {
+ DeadReckoningGetLatitudeDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_ALTITUDE:
+ {
+ DeadReckoningGetAltitudeDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED:
+ {
+ DeadReckoningGetSpeedDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_HEADING:
+ {
+ DeadReckoningGetHeadingDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_SNS_COUNTER:
+ {
+ DeadReckoningGetSnsCounterDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_OFFSET:
+ {
+ DeadReckoningGetGyroOffsetDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR:
+ {
+ DeadReckoningGetGyroScaleFactorDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL:
+ {
+ DeadReckoningGetGyroScaleFactorLevelDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR:
+ {
+ DeadReckoningGetSpeedPulseScaleFactorDr(p_data);
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL:
+ {
+ DeadReckoningGetSpeedPulseScaleFactorLevelDr(p_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DeliveryCtrl.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DeliveryCtrl.cpp
new file mode 100755
index 0000000..0a08f5f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_DeliveryCtrl.cpp
@@ -0,0 +1,835 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :DeadReckoning_DeliveryCtrl.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle Sensor Destination Management(
+ * Module configuration DeadReckoningInitDeliveryCtrlTbl() Vehicle sensor delivery destination management table initialization function
+ * DeadReckoningInitDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management area initialization function
+ * DeadReckoningEntryDeliveryCtrl() Vehicle sensor delivery destination management registration function
+ * :DeadReckoningAddDeliveryCtrlTbl() Vehicle sensor delivery destination management table addition function
+ * :DeadReckoningUpdateDeliveryCtrlTbl() Vehicle sensor delivery destination management table update function
+ * :DeadReckoning_DeliveryEntry_Delete() Vehicle sensor delivery destination management table deletion function
+ * :DeadReckoningAddDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management addition function
+ * :DeadReckoningUpdateDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management update function
+ * :DeadReckoning_DeleteDeliveryCtrlTblMng_Touch() Vehicle sensor delivery destination management table management deletion (touch panel) function
+ * DeadReckoningMakeDeliveryPnoTbl() Vehicle Sensor Destination PNO Table Creation Function
+ * :DeadReckoningAddPnoTbl() Vehicle Sensor Destination PNO Table Addition Function
+ * :DeadReckoningDeliveryProc() Vehicle Sensor Data Delivery Process
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DeliveryCtrl.h"
+#include "Vehicle_API.h"
+#include "Vehicle_API_Dummy.h"
+#include "Dead_Reckoning_Local_Api.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DELIVERY_CTRL_TBL g_delivery_dr_ctrltbl;
+static DEADRECKONING_DELIVERY_CTRL_TBL_MNG g_delivery_dr_ctrltbl_mng;
+static DEADRECKONING_DELIVERY_PNO_TBL g_delivery_dr_pnotbl;
+
+/* Stored data count */
+int32 g_delivery_dr_ctrl_num = 0;
+
+/* PastModel002 support DR */
+/*******************************************************************************
+* MODULE : DeadReckoningInitDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table initialization function
+* FUNCTION : Delivery destination management table initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningInitDeliveryCtrlTbl(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&g_delivery_dr_ctrltbl, 0x00, sizeof(DEADRECKONING_DELIVERY_CTRL_TBL));
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningInitDeliveryCtrlTblMng
+* ABSTRACT : Vehicle sensor delivery destination management table management area initialization function
+* FUNCTION : Delivery destination management table management area initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningInitDeliveryCtrlTblMng(void) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&g_delivery_dr_ctrltbl_mng, 0x00, sizeof(DEADRECKONING_DELIVERY_CTRL_TBL_MNG));
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningEntryDeliveryCtrl
+* ABSTRACT : Vehicle sensor delivery destination management registration function
+* FUNCTION : Shipping management table,Update the shipping management table management.
+* ARGUMENT : p_st_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : VEHICLE_RET_NORMAL :Successful registration
+******************************************************************************/
+DEAD_RECKONING_RET_API DeadReckoningEntryDeliveryCtrl(const DEADRECKONING_MSG_DELIVERY_ENTRY *p_st_delivery_entry) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i;
+ u_int8 uc_action_type = DEADRECKONING_ACTION_TYPE_ADD;
+ int32 uc_did_flag;
+ DID ul_entry_did = p_st_delivery_entry->data.did;
+ DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *p_st_existing_mng_data = NULL;
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ DEAD_RECKONING_RET_API ret = DEAD_RECKONING_RET_NORMAL;
+
+ /* Check if the data ID exists. */
+ uc_did_flag = DeadReckoningCheckDid(ul_entry_did);
+ if (uc_did_flag == 0) {
+ ret = DEADRECKONING_RET_ERROR_DID; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Check the number of registered shipments. */
+ if ((ret == DEAD_RECKONING_RET_NORMAL) &&/* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (g_delivery_dr_ctrltbl.us_num >= DEADRECKONING_DELIVERY_INFO_MAX)) {
+ /* Return the FULL of delivery registrations*/
+ ret = DEADRECKONING_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ if (ret == DEAD_RECKONING_RET_NORMAL) {
+ /* By searching for the delivery registration of the relevant DID,Hold the address. */
+ for (i = 0; i < g_delivery_dr_ctrltbl_mng.us_num; i++) {
+ if (g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[i].ul_did == ul_entry_did) {
+ uc_action_type = DEADRECKONING_ACTION_TYPE_UPDATE;
+ p_st_existing_mng_data = &g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[i];
+ }
+ }
+
+ /* Add to the shipping management table.*/
+ DeadReckoningAddDeliveryCtrlTbl(p_st_delivery_entry);
+
+ /* Processing when updating existing data*/
+ if (uc_action_type == DEADRECKONING_ACTION_TYPE_UPDATE) {
+ /* Update the shipping management table.*/
+ DeadReckoningUpdateDeliveryCtrlTbl(p_st_existing_mng_data);
+
+ /* Update the shipping destination management table management information.*/
+ DeadReckoningUpdateDeliveryCtrlTblMng(p_st_existing_mng_data);
+ } else { /* Newly added processing*/
+ /* Add to the shipping management table management information.*/
+ DeadReckoningAddDeliveryCtrlTblMng(p_st_delivery_entry);
+ }
+ }
+ return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningAddDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table addition function
+* FUNCTION : Add to the shipping management table.
+* ARGUMENT : *p_st_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningAddDeliveryCtrlTbl(const DEADRECKONING_MSG_DELIVERY_ENTRY *p_st_delivery_entry) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEADRECKONING_DELIVERY_CTRL_TBL_DATA *p_st_ctrl_data;
+
+ p_st_ctrl_data = &g_delivery_dr_ctrltbl.st_ctrl_data[g_delivery_dr_ctrltbl.us_num];
+ p_st_ctrl_data->ul_did = p_st_delivery_entry->data.did;
+ p_st_ctrl_data->us_pno = p_st_delivery_entry->data.pno;
+ p_st_ctrl_data->uc_chg_type = p_st_delivery_entry->data.delivery_timing;
+ p_st_ctrl_data->uc_ctrl_flg = p_st_delivery_entry->data.ctrl_flg;
+ p_st_ctrl_data->us_link_idx = DEADRECKONING_LINK_INDEX_END;
+ p_st_ctrl_data->uc_method = DEADRECKONING_DELIVERY_METHOD_NORMAL;
+
+ g_delivery_dr_ctrltbl.us_num = static_cast<u_int16>(g_delivery_dr_ctrltbl.us_num + 1);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningUpdateDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table update function
+* FUNCTION : Update the shipping management table.
+* ARGUMENT : *p_st_existing_mng_data : Pointer to the previous data information with the same data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningUpdateDeliveryCtrlTbl(DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *p_st_existing_mng_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Update Link Index Only.
+ For the index of the value of us_end_idx that matches the data ID of the distribution target management table management information
+ Make us_link_idx a registered index */
+ g_delivery_dr_ctrltbl.st_ctrl_data[p_st_existing_mng_data->us_end_idx].us_link_idx =
+ static_cast<u_int16>(g_delivery_dr_ctrltbl.us_num - 1);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningAddDeliveryCtrlTblMng
+* ABSTRACT : Vehicle sensor delivery destination management table management addition function
+* FUNCTION : Add to the shipping management table management.
+* ARGUMENT : *p_st_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningAddDeliveryCtrlTblMng(const DEADRECKONING_MSG_DELIVERY_ENTRY *p_st_delivery_entry) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *p_st_ctr_mng_data;
+
+ p_st_ctr_mng_data = &g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[g_delivery_dr_ctrltbl_mng.us_num];
+ p_st_ctr_mng_data->ul_did = p_st_delivery_entry->data.did;
+ p_st_ctr_mng_data->us_start_idx = static_cast<u_int16>(g_delivery_dr_ctrltbl.us_num - 1);
+ p_st_ctr_mng_data->us_end_idx = static_cast<u_int16>(g_delivery_dr_ctrltbl.us_num - 1);
+ p_st_ctr_mng_data->us_dlvry_entry_num++;
+ g_delivery_dr_ctrltbl_mng.us_num++;
+ g_delivery_dr_ctrl_num++;
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningUpdateDeliveryCtrlTblMng
+* ABSTRACT : Vehicle sensor delivery destination management table management update function
+* FUNCTION : Update the shipping management table management.
+* ARGUMENT : *p_st_existing_mng_data : Pointer to the previous data information with the same data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningUpdateDeliveryCtrlTblMng(DEADRECKONING_DELIVERY_CTRL_TBL_MNG_DATA *p_st_existing_mng_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Update only the end index and the number of registered shipping destinations. */
+ p_st_existing_mng_data->us_end_idx = static_cast<u_int16>(g_delivery_dr_ctrltbl.us_num - 1);
+ p_st_existing_mng_data->us_dlvry_entry_num++;
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningMakeDeliveryPnoTbl
+* ABSTRACT : Vehicle sensor delivery destination PNO table creation function
+* FUNCTION : Create the shipping destination PNO table
+* ARGUMENT : ul_did Data ID
+* Change_type Delivery Trigger
+* NOTE :
+* RETURN : DEADRECKONING_DELIVERY_PNO_TBL* Pointer to the shipping PNO table
+******************************************************************************/
+DEADRECKONING_DELIVERY_PNO_TBL* DeadReckoningMakeDeliveryPnoTbl(DID ul_did, u_int8 change_type) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i;
+ u_int16 us_index = 0;
+ u_int16 us_num = 0;
+
+ /* Get the start index and count of the corresponding data ID. */
+ for (i = 0; i < g_delivery_dr_ctrl_num; i++) {
+ /* Stores the information of the corresponding DID.. */
+ if (g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[i].ul_did == ul_did) {
+ us_index = g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[i].us_start_idx;
+ us_num = g_delivery_dr_ctrltbl_mng.st_ctrl_tbl_mng_data[i].us_dlvry_entry_num;
+ break;
+ }
+ }
+
+ /* Create a PNO list */
+ g_delivery_dr_pnotbl.us_num = 0;
+ if (change_type == DEADRECKONING_CHGTYPE_CHG) {
+ /* Processing when delivery timing is changed*/
+ for (i = 0; i < us_num; i++) {
+ /* Functionalization by Increasing Structure Members */
+ DeadReckoningAddPnoTbl(us_index);
+
+ us_index = g_delivery_dr_ctrltbl.st_ctrl_data[us_index].us_link_idx;
+ }
+ } else {
+ /* Processing when delivery timing is update */
+ for (i = 0; i < us_num; i++) {
+ if (DEADRECKONING_DELIVERY_TIMING_UPDATE == g_delivery_dr_ctrltbl.st_ctrl_data[us_index].uc_chg_type) {
+ /* Functionalization by Increasing Structure Members */
+ DeadReckoningAddPnoTbl(us_index);
+ }
+ us_index = g_delivery_dr_ctrltbl.st_ctrl_data[us_index].us_link_idx;
+ }
+ }
+ return (&g_delivery_dr_pnotbl);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningAddPnoTbl
+* ABSTRACT : Vehicle Sensor Destination PNO Table Addition Function
+* FUNCTION : Add to the shipping PNO table.
+* ARGUMENT : us_index : Index of the referenced destination management table
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningAddPnoTbl(u_int16 us_index) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int16 us_pno_tbl_idx;
+
+ us_pno_tbl_idx = g_delivery_dr_pnotbl.us_num;
+ g_delivery_dr_pnotbl.st_pno_data[us_pno_tbl_idx].us_pno = g_delivery_dr_ctrltbl.st_ctrl_data[us_index].us_pno;
+ /* Save the relevant INDEX in the delivery control table */
+ g_delivery_dr_pnotbl.st_pno_data[us_pno_tbl_idx].us_index = us_index;
+ g_delivery_dr_pnotbl.st_pno_data[us_pno_tbl_idx].uc_method =
+ g_delivery_dr_ctrltbl.st_ctrl_data[us_index].uc_method;
+ g_delivery_dr_pnotbl.us_num++;
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningDeliveryProc
+* ABSTRACT : Vehicle Sensor Data Delivery Process
+* FUNCTION : Deliver data to a destination.
+* ARGUMENT : ul_did :Data ID
+* uc_chg_type :Delivery timing
+* uc_get_method :Acquisition method
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningDeliveryProc(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i; /* Generic counters */
+ DEADRECKONING_DATA_MASTER st_master; /* Data master of normal data */
+
+
+ /* Defines the data master for each API. */
+ SENSORLOCATION_MSG_LONLATINFO_DAT st_msg_lonlat_info;
+ SENSORLOCATION_MSG_ALTITUDEINFO_DAT st_msg_altitude_info;
+ SENSORMOTION_MSG_SPEEDINFO_DAT st_msg_speed_info;
+ SENSORMOTION_MSG_HEADINGINFO_DAT st_msg_heading_info;
+
+
+ const DEADRECKONING_DELIVERY_PNO_TBL *p_st_pno_tbl; /* Vehicle Sensor Destination PNO Table Pointer */
+
+ /* Initialization */
+ st_msg_lonlat_info.reserve[0] = 0;
+ st_msg_lonlat_info.reserve[1] = 0;
+ st_msg_lonlat_info.reserve[2] = 0;
+ st_msg_altitude_info.reserve[0] = 0;
+ st_msg_altitude_info.reserve[1] = 0;
+ st_msg_altitude_info.reserve[2] = 0;
+ st_msg_speed_info.reserve = 0;
+ st_msg_heading_info.reserve = 0;
+
+ /* Obtain the shipping destination PNO */
+ p_st_pno_tbl =
+ reinterpret_cast<DEADRECKONING_DELIVERY_PNO_TBL*>(DeadReckoningMakeDeliveryPnoTbl(ul_did, uc_chg_type));
+
+ if ((p_st_pno_tbl->us_num) > 0) {
+ /* When there is a shipping destination PNO registration */
+ /* Vehicle sensor information notification transmission process */
+ for (i = 0; i < (p_st_pno_tbl->us_num); i++) {
+ /* Acquire the applicable data information from the data master..*/
+ DeadReckoningGetDataMaster(ul_did, &st_master);
+
+ /* Align data from the data master for API I/F */
+ switch (ul_did) {
+ /* Describes the process for each DID. */
+ case VEHICLE_DID_DR_LATITUDE:
+ {
+ /* Size storage(LONLAT) */
+ st_msg_lonlat_info.size = (u_int16)sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT);
+
+ /* DR status setting */
+ st_msg_lonlat_info.dr_status = st_master.dr_status;
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_lonlat_info.is_exist_dr = SENSORLOCATION_EXISTDR_DR;
+
+ /* Set the Latitude */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_lonlat_info.latitude)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Obtain the data master Longitude */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_LONGITUDE, &st_master);
+
+ /* Set the Longitude */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_lonlat_info.longitude)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+
+ /* Set the SensorCnt */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_lonlat_info.sensor_cnt)),
+ (const void *)(&( st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORLOCATION_LONLAT,
+ sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT),
+ (const void *)&st_msg_lonlat_info);
+ break;
+ }
+ case VEHICLE_DID_DR_ALTITUDE:
+ {
+ /* Size storage(ALTITUDE) */
+ st_msg_altitude_info.size = (u_int16)sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_altitude_info.is_exist_dr = SENSORLOCATION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_altitude_info.dr_status = st_master.dr_status;
+
+
+ /* Set the Altitude */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_altitude_info.altitude)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+
+ /* Set the SensorCnt */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_altitude_info.sensor_cnt)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORLOCATION_ALTITUDE,
+ sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT),
+ (const void *)&st_msg_altitude_info);
+
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED:
+ {
+ /* Size storage(SPEED) */
+ st_msg_speed_info.size = (u_int16)sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_speed_info.is_exist_dr = SENSORMOTION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_speed_info.dr_status = st_master.dr_status;
+
+
+ /* Set the Speed */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_speed_info.speed)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+ /* Set the SensorCnt */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_speed_info.sensor_cnt)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORMOTION_SPEED,
+ sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT),
+ (const void *)&st_msg_speed_info);
+ break;
+ }
+ case VEHICLE_DID_DR_HEADING:
+ {
+ /* Size storage(HEADING) */
+ st_msg_heading_info.size = (u_int16)sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_heading_info.is_exist_dr = SENSORMOTION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_heading_info.dr_status = st_master.dr_status;
+
+ /* Set the Heading */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_heading_info.heading)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+ /* Set the SensorCnt */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_heading_info.sensor_cnt)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORMOTION_HEADING,
+ sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT),
+ (const void *)&st_msg_heading_info);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL:
+ {
+ SENSORMOTION_MSG_GYROPARAMETERINFO_DAT stMsgGyroParameterInfo;
+ /* Initialization */
+ stMsgGyroParameterInfo.reserve[0] = 0;
+ stMsgGyroParameterInfo.reserve[1] = 0;
+
+ /* GyroOffset/GyroScaleFactor/GyroScaleFactorLevel data master */
+ /* setup must be completed before data delivery of this DID */
+ /* The order of processing is defined by DeadReckoning_RcvMsg().,Be careful when changing */
+
+ /* Size storage(GYROPARAMETER) */
+ stMsgGyroParameterInfo.size = (u_int16)sizeof(stMsgGyroParameterInfo);
+
+ /* GyroOffset acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_OFFSET, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_offset)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgGyroParameterInfo.gyro_offset));
+
+ /* GyroScaleFactor acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_SCALE_FACTOR, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_scale_factor)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgGyroParameterInfo.gyro_scale_factor));
+
+ /* GyroScaleFactorLevel acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_scale_factor_level)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgGyroParameterInfo.gyro_scale_factor_level));
+
+ /* Data transmission */
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORMOTION_GYROPARAMETER,
+ sizeof(stMsgGyroParameterInfo),
+ (const void *)&stMsgGyroParameterInfo);
+ }
+ break;
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL:
+ {
+ SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT stMsgSpeedPulseParameterInfo;
+
+ /* Initialization */
+ stMsgSpeedPulseParameterInfo.reserve[0] = 0;
+ stMsgSpeedPulseParameterInfo.reserve[1] = 0;
+ stMsgSpeedPulseParameterInfo.reserve[2] = 0;
+
+ /* GyroOffset/GyroScaleFactor/GyroScaleFactorLevel data master */
+ /* setup must be completed before data delivery of this DID */
+ /* The order of processing is defined by DeadReckoning_RcvMsg().,Be careful when changing */
+
+ /* Size storage(SPEEDPULSEPARAMETER) */
+ stMsgSpeedPulseParameterInfo.size = (u_int16)sizeof(stMsgSpeedPulseParameterInfo);
+
+ /* SpeedPulseScaleFactor acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor));
+
+ /* SpeedPulseScaleFactorLevel acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor_level)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor_level));
+
+ /* Data transmission */
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ p_st_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLE_SENSORMOTION_SPEEDPULSEPARAMETER,
+ sizeof(stMsgSpeedPulseParameterInfo),
+ (const void *)&stMsgSpeedPulseParameterInfo);
+ }
+ break;
+ /* Other than the above */
+ default:
+ /* Do not edit. */
+ break;
+ }
+ }
+ }
+}
+
+/*******************************************************************************
+ * MODULE : DRManagerSndMsg
+ * ABSTRACT : Message transmission processing
+ * FUNCTION : Send a message to the specified PNO
+ * ARGUMENT : us_pno_src : Source PNO
+ * : us_pno_dest : Destination PNO
+ * : us_cid : Command ID
+ * : us_msg_len : Message data body length
+ * : *p_msg_data : Pointer to message data
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : RET_ERRNOTRDY : Destination process is not wakeup
+ * : RET_ERRMSGFULL : Message queue overflows
+ * : RET_ERRPARAM : Buffer size error
+ ******************************************************************************/
+RET_API DRManagerSndMsg(PNO us_pno_src, PNO us_pno_dest, CID us_cid, u_int16 us_msg_len, const void *p_msg_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEADRECKONING_MSG_BUF st_msg_buf; /* message buffer */
+ T_APIMSG_MSGBUF_HEADER *p_st_msg_hdr; /* Pointer to the message header */
+ RET_API l_ret_api; /* Return value */
+
+ /* Message buffer initialization */
+ memset(reinterpret_cast<void *>(&st_msg_buf), 0, sizeof(DEADRECKONING_MSG_BUF));
+
+ /* Get pointer to send buffer */
+ p_st_msg_hdr = reinterpret_cast<T_APIMSG_MSGBUF_HEADER *>(reinterpret_cast<void *>(&st_msg_buf));
+
+ /*--------------------------------------------------------------*
+ * Create message headers *
+ *--------------------------------------------------------------*/
+ p_st_msg_hdr->hdr.sndpno = us_pno_src; /* Source PNO */
+ p_st_msg_hdr->hdr.cid = us_cid; /* Command ID */
+ p_st_msg_hdr->hdr.msgbodysize = us_msg_len; /* Message data body length */
+
+ /*--------------------------------------------------------------*
+ * Create message data *
+ *--------------------------------------------------------------*/
+ if ((0 != p_msg_data) && (0 != us_msg_len)) {
+ /* Set the message data */
+ memcpy(reinterpret_cast<void *>(st_msg_buf.data), p_msg_data, (size_t)us_msg_len);
+ }
+ /*--------------------------------------------------------------*
+ * Send messages *
+ *--------------------------------------------------------------*/
+ l_ret_api = _pb_SndMsg(us_pno_dest,
+ (u_int16)(sizeof(T_APIMSG_MSGBUF_HEADER) + us_msg_len),
+ reinterpret_cast<void *>(&st_msg_buf),
+ 0);
+ return (l_ret_api);
+}
+
+
+/*******************************************************************************
+* MODULE : DeadReckoningFirstDelivery
+* ABSTRACT : Vehicle Sensor Initial Data Delivery Process
+* FUNCTION : Deliver the initial data to the destination.
+* ARGUMENT : us_pno :Addresses for delivery NO
+* ul_did :Data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningFirstDelivery(PNO us_pno, DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEADRECKONING_DATA_MASTER st_master; /* Data master of normal data */
+
+ /* Defines the data master for each API. */
+ SENSORLOCATION_MSG_LONLATINFO_DAT st_msg_lonlat_info;
+ SENSORLOCATION_MSG_ALTITUDEINFO_DAT st_msg_altitude_info;
+ SENSORMOTION_MSG_SPEEDINFO_DAT st_msg_speed_info;
+ SENSORMOTION_MSG_HEADINGINFO_DAT st_msg_heading_info;
+
+ /* Initialization */
+ st_msg_lonlat_info.reserve[0] = 0;
+ st_msg_lonlat_info.reserve[1] = 0;
+ st_msg_lonlat_info.reserve[2] = 0;
+ st_msg_altitude_info.reserve[0] = 0;
+ st_msg_altitude_info.reserve[1] = 0;
+ st_msg_altitude_info.reserve[2] = 0;
+ st_msg_speed_info.reserve = 0;
+ st_msg_heading_info.reserve = 0;
+
+ /* Align data from the data master for API I/F */
+ switch (ul_did) {
+ /* Describes the process for each DID. */
+ case VEHICLE_DID_DR_LATITUDE:
+ {
+ DeadReckoningGetDataMaster(ul_did, &st_master);
+
+ /* Size storage(LONLAT) */
+ st_msg_lonlat_info.size = (u_int16)sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT);
+
+ /* DR status setting */
+ st_msg_lonlat_info.dr_status = st_master.dr_status;
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_lonlat_info.is_exist_dr = SENSORLOCATION_EXISTDR_DR;
+
+ /* Set the Latitude */
+ memcpy(&(st_msg_lonlat_info.latitude), &(st_master.uc_data[0]), st_master.us_size);
+
+ /* Obtain the data master Longitude */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_LONGITUDE, &st_master);
+
+ /* Set the Longitude */
+ memcpy(&(st_msg_lonlat_info.longitude), &(st_master.uc_data[0]), st_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+
+ /* Set the SensorCnt */
+ memcpy(&(st_msg_lonlat_info.sensor_cnt), &(st_master.uc_data[0]), st_master.us_size);
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORLOCATION_LONLAT,
+ sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT),
+ (const void *)&st_msg_lonlat_info);
+ break;
+ }
+ case VEHICLE_DID_DR_ALTITUDE:
+ {
+ DeadReckoningGetDataMaster(ul_did, &st_master);
+
+ /* Size storage(ALTITUDE) */
+ st_msg_altitude_info.size = (u_int16)sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_altitude_info.is_exist_dr = SENSORLOCATION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_altitude_info.dr_status = st_master.dr_status;
+
+
+ /* Set the Altitude */
+ memcpy(&(st_msg_altitude_info.altitude), &(st_master.uc_data[0]), st_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+
+ /* Set the SensorCnt */
+ memcpy(&(st_msg_altitude_info.sensor_cnt), &(st_master.uc_data[0]), st_master.us_size);
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORLOCATION_ALTITUDE,
+ sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT),
+ (const void *)&st_msg_altitude_info);
+
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED:
+ {
+ DeadReckoningGetDataMaster(ul_did, &st_master);
+
+ /* Size storage(SPEED) */
+ st_msg_speed_info.size = (u_int16)sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_speed_info.is_exist_dr = SENSORMOTION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_speed_info.dr_status = st_master.dr_status;
+
+
+ /* Set the Speed */
+ memcpy(&(st_msg_speed_info.speed), &(st_master.uc_data[0]), st_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+ /* Set the SensorCnt */
+ memcpy(&(st_msg_speed_info.sensor_cnt), &(st_master.uc_data[0]), st_master.us_size);
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORMOTION_SPEED,
+ sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT),
+ (const void *)&st_msg_speed_info);
+ break;
+ }
+ case VEHICLE_DID_DR_HEADING:
+ {
+ DeadReckoningGetDataMaster(ul_did, &st_master);
+
+ /* Size storage(HEADING) */
+ st_msg_heading_info.size = (u_int16)sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT);
+
+ /* The DR enable flag is set to enabled. */
+ st_msg_heading_info.is_exist_dr = SENSORMOTION_EXISTDR_DR;
+
+ /* DR status setting */
+ st_msg_heading_info.dr_status = st_master.dr_status;
+
+
+ /* Set the Heading */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_heading_info.heading)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ /* Acquire data master SensorCnt */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &st_master);
+ /* Set the SensorCnt */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_heading_info.sensor_cnt)),
+ (const void *)(&(st_master.uc_data[0])), (size_t)(st_master.us_size));
+
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORMOTION_HEADING,
+ sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT),
+ (const void *)&st_msg_heading_info);
+ break;
+ }
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL:
+ {
+ SENSORMOTION_MSG_GYROPARAMETERINFO_DAT stMsgGyroParameterInfo;
+
+ /* Initialization */
+ stMsgGyroParameterInfo.reserve[0] = 0;
+ stMsgGyroParameterInfo.reserve[1] = 0;
+
+ /* Size storage(GYROPARAMETER) */
+ stMsgGyroParameterInfo.size = (u_int16)sizeof(stMsgGyroParameterInfo);
+
+ /* GyroOffset acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_OFFSET, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_offset)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof( stMsgGyroParameterInfo.gyro_offset));
+
+ /* GyroScaleFactor acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_SCALE_FACTOR, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_scale_factor)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgGyroParameterInfo.gyro_scale_factor));
+
+ /* GyroScaleFactorLevel acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgGyroParameterInfo.gyro_scale_factor_level)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgGyroParameterInfo.gyro_scale_factor_level));
+
+ /* Data transmission */
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORMOTION_GYROPARAMETER,
+ sizeof(stMsgGyroParameterInfo),
+ (const void *)&stMsgGyroParameterInfo);
+ }
+ break;
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL:
+ {
+ SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT stMsgSpeedPulseParameterInfo;
+
+ /* Initialization */
+ stMsgSpeedPulseParameterInfo.reserve[0] = 0;
+ stMsgSpeedPulseParameterInfo.reserve[1] = 0;
+ stMsgSpeedPulseParameterInfo.reserve[2] = 0;
+
+ /* Size storage(SPEEDPULSEPARAMETER) */
+ stMsgSpeedPulseParameterInfo.size = (u_int16)sizeof(stMsgSpeedPulseParameterInfo);
+
+ /* SpeedPulseScaleFactor acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor));
+
+ /* SpeedPulseScaleFactorLevel acuisition/setting */
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL, &st_master);
+
+ (void)memcpy(reinterpret_cast<void *>(&(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor_level)),
+ reinterpret_cast<void *>(&(st_master.uc_data[0])),
+ sizeof(stMsgSpeedPulseParameterInfo.speed_pulse_scale_factor_level));
+
+ /* Data transmission */
+ (void)DRManagerSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORMOTION_SPEEDPULSEPARAMETER,
+ sizeof(stMsgSpeedPulseParameterInfo),
+ (const void *)&stMsgSpeedPulseParameterInfo);
+ }
+ break;
+ /* Other than the above */
+ default:
+ /* Do not edit. */
+ break;
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Altitude_dr.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Altitude_dr.cpp
new file mode 100755
index 0000000..acd5f6d
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Altitude_dr.cpp
@@ -0,0 +1,106 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file DeadReckoning_Did_Altitude.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_ALTITUDE)<BR>
+ DeadReckoning data master(VEHICLE_DID_DR_ALTITUDE)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_altitude; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief Altitude Dead Reckoning initialization function
+@outline Altitude initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitAltitudeDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_altitude), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_altitude.ul_did = VEHICLE_DID_DR_ALTITUDE;
+ gst_altitude.us_size = VEHICLE_DSIZE_ALTITUDE;
+ gst_altitude.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_altitude.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
+ gst_altitude.uc_data[0] = VEHICLE_DINIT_ALTITUDE;
+}
+
+/***********************************************************************
+@brief Altitude Dead Reckoning SET function
+@outline To update the master data Altitude.
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetAltitudeDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_altitude;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief Altitude Dead Reckoning GET function
+@outline Master Data provides the Altitude
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetAltitudeDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_altitude;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroOffset_dr.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroOffset_dr.cpp
new file mode 100755
index 0000000..f295f8d
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroOffset_dr.cpp
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file DeadReckoning_Did_GyroScaleFactor_dr.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_GYRO_OFFSET)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_gyrooffset; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief GyroOffset initialization function
+@outline GyroOffset initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitGyroOffsetDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void)memset(reinterpret_cast<void *>(&gst_gyrooffset), 0x00, sizeof(gst_gyrooffset));
+ gst_gyrooffset.ul_did = VEHICLE_DID_DR_GYRO_OFFSET;
+ gst_gyrooffset.us_size = VEHICLE_DSIZE_GYRO_OFFSET;
+ gst_gyrooffset.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_gyrooffset.dr_status = 0U; /* Not used */
+}
+
+/************************************************************************
+@brief GyroOffset SET function
+@outline To update the master data GyroOffset
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetGyroOffsetDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = DEADRECKONING_EQ;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyrooffset;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), (size_t)(p_st_data->us_size));
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = 0U; /* Not used */
+
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data) ), sizeof(p_st_master->uc_data));
+ }
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief GyroOffset GET function
+@outline Master Data provides the GyroOffset
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetGyroOffsetDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyrooffset;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
+ (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp
new file mode 100755
index 0000000..dff0913
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_gyroscalefactor_level; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief GyroScaleFactorLevel initialization function
+@outline GyroScaleFactorLevel initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitGyroScaleFactorLevelDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void)memset(reinterpret_cast<void *>(&gst_gyroscalefactor_level), 0x00, sizeof(gst_gyroscalefactor_level));
+ gst_gyroscalefactor_level.ul_did = VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL;
+ gst_gyroscalefactor_level.us_size = VEHICLE_DSIZE_GYRO_SCALE_FACTOR_LEVEL;
+ gst_gyroscalefactor_level.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_gyroscalefactor_level.dr_status = 0U; /* Not used */
+}
+
+/*************************************************************************
+@brief GyroScaleFactorLevel SET function
+@outline To update the master data GyroScaleFactorLevel
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes<BR>
+@retval DEADRECKONING_NEQ : With data changes<BR>
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetGyroScaleFactorLevelDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = DEADRECKONING_EQ;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyroscalefactor_level;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)( &(p_st_data->uc_data)), (size_t)(p_st_data->us_size));
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = 0U; /* Not used */
+
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), sizeof(p_st_master->uc_data));
+ }
+
+ return (uc_ret);
+}
+
+/*************************************************************************
+@brief GyroScaleFactorLevel GET function
+@outline Master Data provides the GyroScaleFactorLevel
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetGyroScaleFactorLevelDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyroscalefactor_level;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
+ (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactor_dr.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactor_dr.cpp
new file mode 100755
index 0000000..d05ef5c
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_GyroScaleFactor_dr.cpp
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+@file DeadReckoning_Did_GyroScaleFactor_dr.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_GYRO_SCALE_FACTOR)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_gyroscalefactor; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief GyroScaleFactor initialization function
+@outline GyroScaleFactor initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitGyroScaleFactorDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void)memset(reinterpret_cast<void *>(&gst_gyroscalefactor), 0x00, sizeof(gst_gyroscalefactor));
+ gst_gyroscalefactor.ul_did = VEHICLE_DID_DR_GYRO_SCALE_FACTOR;
+ gst_gyroscalefactor.us_size = VEHICLE_DSIZE_GYRO_SCALE_FACTOR;
+ gst_gyroscalefactor.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_gyroscalefactor.dr_status = 0U; /* Not used */
+}
+
+/************************************************************************
+@brief GyroScaleFactor SET function
+@outline To update the master data GyroScaleFactor
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetGyroScaleFactorDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = DEADRECKONING_EQ;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyroscalefactor;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), (size_t)(p_st_data->us_size));
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = 0U; /* Not used */
+
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data) ), sizeof(p_st_master->uc_data));
+ }
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief GyroScaleFactor GET function
+@outline Master Data provides the GyroScaleFactor
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetGyroScaleFactorDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_gyroscalefactor;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
+ (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Heading_dr.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Heading_dr.cpp
new file mode 100755
index 0000000..451b133
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Heading_dr.cpp
@@ -0,0 +1,106 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+@file DeadReckoning_Did_Heading.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_HEADING)<BR>
+ DeadReckoning data master(VEHICLE_DID_DR_HEADING)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_heading; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief Heading Dead Reckoning initialization function
+@outline Heading initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitHeadingDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_heading), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_heading.ul_did = VEHICLE_DID_DR_HEADING;
+ gst_heading.us_size = VEHICLE_DSIZE_HEADING;
+ gst_heading.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_heading.dr_status = SENSORMOTION_DRSTATUS_INVALID;
+ gst_heading.uc_data[0] = VEHICLE_DINIT_HEADING;
+}
+
+/*************************************************************************
+@brief Heading Dead Reckoning SET function
+@outline To update the master data Heading.
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetHeadingDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_heading;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief Heading Dead Reckoning GET function
+@outline Master Data provides the Heading
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetHeadingDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_heading;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Latitude_dr.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Latitude_dr.cpp
new file mode 100755
index 0000000..9d06e7a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Latitude_dr.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+@file DeadReckoning_Did_Latitude.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_LATITUDE)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_latitude; // NOLINT(readability/nolint)
+
+/***********************************************************************
+@brief Latitude Dead Reckoning initialization function
+@outline Latitude initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitLatitudeDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_latitude), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_latitude.ul_did = VEHICLE_DID_DR_LATITUDE;
+ gst_latitude.us_size = VEHICLE_DSIZE_LATITUDE;
+ gst_latitude.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_latitude.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
+ gst_latitude.uc_data[0] = VEHICLE_DINIT_LATITUDE;
+}
+
+/************************************************************************
+@brief Latitude Dead Reckoning SET function
+@outline To update the master data Latitude.
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetLatitudeDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_latitude;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief Latitude Dead Reckoning GET function
+@outline Master Data provides the Latitude
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetLatitudeDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_latitude;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Longitude_dr.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Longitude_dr.cpp
new file mode 100755
index 0000000..38a6351
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Longitude_dr.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+@file DeadReckoning_Did_Longitude.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_LONGITUDE)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_longitude; // NOLINT(readability/nolint)
+
+/***********************************************************************
+@brief Longitude Dead Reckoning initialization function
+@outline Longitude initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitLongitudeDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_longitude), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_longitude.ul_did = VEHICLE_DID_DR_LONGITUDE;
+ gst_longitude.us_size = VEHICLE_DSIZE_LONGITUDE;
+ gst_longitude.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_longitude.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
+ gst_longitude.uc_data[0] = VEHICLE_DINIT_LONGITUDE;
+}
+
+/************************************************************************
+@brief Longitude Dead Reckoning SET function
+@outline To update the master data Longitude.
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetLongitudeDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_longitude;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief Longitude Dead Reckoning GET function
+@outline Master Data provides the Longitude
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetLongitudeDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_longitude;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SnsCounter.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SnsCounter.cpp
new file mode 100755
index 0000000..6bf3ed7
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SnsCounter.cpp
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :DeadReckoning_Did_SnsCounter.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_SNS_COUNTER)
+ * Module configuration :DeadReckoningInitSnsCounterDr() Vehicle sensor SNS_COUNTER initialization function
+ * :DeadReckoningSetSnsCounterDr() Vehicle sensor SNS_COUNTER SET function
+ * :DeadReckoningGetSnsCounterDr() Vehicle sensor SNS_COUNTER GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_snscounter_dr; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : DeadReckoningInitSnsCounterDr
+* ABSTRACT : Vehicle sensor SNS_COUNTER initialization function
+* FUNCTION : SNS_COUNTER data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningInitSnsCounterDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_snscounter_dr), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_snscounter_dr.ul_did = VEHICLE_DID_DR_SNS_COUNTER;
+ gst_snscounter_dr.us_size = VEHICLE_DSIZE_DR_SNS_COUNTER;
+ gst_snscounter_dr.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_snscounter_dr.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
+ gst_snscounter_dr.uc_data[0] = VEHICLE_DINIT_DR_SNS_COUNTER;
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningSetSnsCounterDr
+* ABSTRACT : Vehicle sensor SNS_COUNTER SET function
+* FUNCTION : Update the SNS_COUNTER data master
+* ARGUMENT : *p_st_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 DeadReckoningSetSnsCounterDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_snscounter_dr;
+
+ /* Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /* Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningGetSnsCounterDr
+* ABSTRACT : Vehicle sensor SNS_COUNTER GET function
+* FUNCTION : Provide the SNS_COUNTER data master
+* ARGUMENT : *p_st_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningGetSnsCounterDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_snscounter_dr;
+
+ /* Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp
new file mode 100755
index 0000000..dc7022f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+@file DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_speedpulsescalefactor_level; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief SpeedPulseScaleFactorLevel initialization function
+@outline SpeedPulseScaleFactorLevel initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitSpeedPulseScaleFactorLevelDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void)memset(reinterpret_cast<void *>(&gst_speedpulsescalefactor_level), 0x00,
+ sizeof(gst_speedpulsescalefactor_level));
+ gst_speedpulsescalefactor_level.ul_did = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL;
+ gst_speedpulsescalefactor_level.us_size = VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR_LEVEL;
+ gst_speedpulsescalefactor_level.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_speedpulsescalefactor_level.dr_status = 0U; /* Not used */
+}
+
+/************************************************************************
+@brief SpeedPulseScaleFactorLevel SET function
+@outline To update the master data SpeedPulseScaleFactorLevel
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetSpeedPulseScaleFactorLevelDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = DEADRECKONING_EQ;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_speedpulsescalefactor_level;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), (size_t)(p_st_data->us_size));
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = 0U; /* Not used */
+
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), sizeof(p_st_master->uc_data));
+ }
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief SpeedPulseScaleFactorLevel GET function
+@outline Master Data provides the SpeedPulseScaleFactorLevel
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetSpeedPulseScaleFactorLevelDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_speedpulsescalefactor_level;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
+ (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp
new file mode 100755
index 0000000..cd27141
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_speedpulsescalefactor; // NOLINT(readability/nolint)
+
+/***********************************************************************
+@brief SpeedPulseScaleFactor initialization function
+@outline SpeedPulseScaleFactor initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitSpeedPulseScaleFactorDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ (void)memset(reinterpret_cast<void *>(&gst_speedpulsescalefactor), 0x00, sizeof(gst_speedpulsescalefactor));
+ gst_speedpulsescalefactor.ul_did = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR;
+ gst_speedpulsescalefactor.us_size = VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR;
+ gst_speedpulsescalefactor.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_speedpulsescalefactor.dr_status = 0U; /* Not used */
+}
+
+/*************************************************************************
+@brief SpeedPulseScaleFactor SET function
+@outline To update the master data SpeedPulseScaleFactor
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetSpeedPulseScaleFactorDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = DEADRECKONING_EQ;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_speedpulsescalefactor;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data) ), (size_t)(p_st_data->us_size));
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = 0U; /* Not used */
+
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
+ (const void *)(&(p_st_data->uc_data)), sizeof(p_st_master->uc_data));
+ }
+
+ return (uc_ret);
+}
+
+/************************************************************************
+@brief SpeedPulseScaleFactor GET function
+@outline Master Data provides the SpeedPulseScaleFactor
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetSpeedPulseScaleFactorDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ if (p_st_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
+ } else {
+ p_st_master = &gst_speedpulsescalefactor;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
+ (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
+ (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Speed_dr.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Speed_dr.cpp
new file mode 100755
index 0000000..b2b1f88
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_Did_Speed_dr.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*************************************************************************
+@file DeadReckoning_Did_Speed.cpp
+@detail DeadReckoning data Master(VEHICLE_DID_DR_SPEED)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DeadReckoning_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static DEADRECKONING_DATA_MASTER gst_speed; // NOLINT(readability/nolint)
+
+/************************************************************************
+@brief Speed Dead Reckoning initialization function
+@outline Speed initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+**************************************************************************** */
+void DeadReckoningInitSpeedDr(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&(gst_speed), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
+ gst_speed.ul_did = VEHICLE_DID_DR_SPEED;
+ gst_speed.us_size = VEHICLE_DSIZE_SPEED;
+ gst_speed.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
+ gst_speed.dr_status = SENSORMOTION_DRSTATUS_INVALID;
+ gst_speed.uc_data[0] = VEHICLE_DINIT_SPEED;
+}
+
+/************************************************************************
+@brief Speed Dead Reckoning SET function
+@outline To update the master data Speed.
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval DEADRECKONING_EQ : No data changes
+@retval DEADRECKONING_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 DeadReckoningSetSpeedDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_speed;
+
+ /** Compare data master and received data */
+ uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ /** Received data is set in the data master. */
+ p_st_master->ul_did = p_st_data->ul_did;
+ p_st_master->us_size = p_st_data->us_size;
+ p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ p_st_master->dr_status = p_st_data->dr_status;
+
+ memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
+
+ return (uc_ret);
+}
+
+/*************************************************************************
+@brief Speed Dead Reckoning GET function
+@outline Master Data provides the Speed
+@type Completion return type
+@param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void DeadReckoningGetSpeedDr(DEADRECKONING_DATA_MASTER *p_st_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const DEADRECKONING_DATA_MASTER *p_st_master;
+
+ p_st_master = &gst_speed;
+
+ /** Store the data master in the specified destination. */
+ p_st_data->ul_did = p_st_master->ul_did;
+ p_st_data->us_size = p_st_master->us_size;
+ p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
+ p_st_data->dr_status = p_st_master->dr_status;
+ memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_main.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_main.cpp
new file mode 100755
index 0000000..1d956b7
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/DeadReckoning_main.cpp
@@ -0,0 +1,1086 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :DeadReckoning_Main.cpp
+ * System name :_CWORD107_
+ * Subsystem name :DeadReckoning Mains
+ * Program name :DeadReckoning Mains
+ * Module configuration :DeadReckoningInit() Guessed navigation initialization processing
+ * :DeadReckoningRcvMsg() DR Component MSG Receive Processing
+ ******************************************************************************/
+
+#include <positioning_hal.h>
+
+#include "DeadReckoning_main.h"
+
+#include "Sensor_Common_API.h"
+#include "DeadReckoning_DataMaster.h"
+#include "Dead_Reckoning_Local_Api.h"
+
+#include "DeadReckoning_DbgLogSim.h"
+
+#include "POS_private.h"
+
+static RET_API DeadReckoningWriteSharedMemory(VEHICLEDEBUG_MSG_LOGINFO_DAT* loginfo);
+static void DeadReckoningSetEvent(PNO pno, RET_API ret);
+static void DeadReckoningLinkSharedMemory(char *shared_memory_name, void **share_addr);
+
+#define DEAD_RECKONING_MAIN_DEBUG 0
+#define DR_DEBUG 0
+#define DR_DEBUG_ENG_MODE 0
+
+/*************************************************/
+/* Constant */
+/*************************************************/
+
+#define DEAD_RECKONING_BUF_SIZE 7
+#define DR_MASK_WORD_L 0x00FF
+#define DR_MASK_WORD_U 0xFF00
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/* Data receive confirmation flag */
+BOOL g_gps_data_get_flg = FALSE;
+BOOL g_sens_data_get_flg = FALSE;
+BOOL g_fst_sens_data_get_flg = FALSE;
+
+/* Reception flag for each data */
+BOOL g_sens_data_get_sns_cnt_flg = FALSE;
+BOOL g_sens_data_get_gyro_x_flg = FALSE;
+BOOL g_sens_data_get_gyro_y_flg = FALSE;
+BOOL g_sens_data_get_gyro_z_flg = FALSE;
+BOOL g_sens_data_get_rev_flg = FALSE;
+BOOL g_sens_data_get_spdpulse_flg = FALSE;
+BOOL g_sens_data_get_spdpulse_chk_flg = FALSE;
+
+BOOL g_sens_data_get_gyro_x_fst_flg = FALSE;
+BOOL g_sens_data_get_gyro_y_fst_flg = FALSE;
+BOOL g_sens_data_get_gyro_z_fst_flg = FALSE;
+BOOL g_sens_data_get_rev_fst_flg = FALSE;
+BOOL g_sens_data_get_spdpulse_fst_flg = FALSE;
+BOOL g_sens_data_get_spdpulse_chk_fst_flg = FALSE;
+
+/* Receive data storage buffer */
+/* [0]:SNS_COUNTER [1]:REV [2]:SPEED_PULSE_FLAG [3]:SPEED_PULSE [4]:GYRO_X [5]:GYRO_Y [6]:GYRO_Z */
+DEAD_RECKONING_RCVDATA_SENSOR g_sns_buf[DEAD_RECKONING_BUF_SIZE];
+DEAD_RECKONING_SAVEDATA_SENSOR_FIRST g_fst_sns_buf;
+
+/*******************************************************************************
+ * MODULE : DeadReckoningInit
+ * ABSTRACT : Guessed navigation initialization processing
+ * FUNCTION : Initialize inferred navigation processing
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : RET_NORMAL :Success in initialization
+ * RET_ERROR :Master Clear failed
+ ******************************************************************************/
+int32 DeadReckoningInit(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL;
+}
+
+/*******************************************************************************
+ * MODULE : DeadReckoningRcvMsg
+ * ABSTRACT : DR Component MSG Receive Processing
+ * FUNCTION : Receive the DR component MSG
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void DeadReckoningRcvMsg(const DEAD_RECKONING_RCVDATA *msg, DEAD_RECKONING_LONLAT_INFO *location_info) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if ((msg == NULL) || (location_info == NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "msg == NULL\r\n");
+ } else {
+ const SENSOR_MSG_GPSDATA_DAT *rcv_gps_msg = NULL;
+ const VEHICLESENS_DATA_MASTER *rcv_sensor_msg = NULL;
+ const VEHICLESENS_DATA_MASTER_FST *rcv_sensor_msg_fst = NULL;
+
+ Struct_GpsData send_gps_msg;
+ Struct_SensData send_sensor_msg;
+
+ /* Initialization */
+ (void)memset(reinterpret_cast<void *>(&send_gps_msg), 0, sizeof(Struct_GpsData));
+ (void)memset(reinterpret_cast<void *>(&send_sensor_msg), 0, sizeof(Struct_SensData));
+
+ /* Flag is set to FALSE */
+ location_info->calc_called = static_cast<u_int8>(FALSE);
+ location_info->available = static_cast<u_int8>(FALSE);
+
+ if (CID_DEAD_RECKONING_GPS_DATA == msg->hdr.hdr.cid) {
+ rcv_gps_msg = (const SENSOR_MSG_GPSDATA_DAT *)(&(msg->data[0]));
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+
+ /* Receiving GPS Data for DR */
+ switch (rcv_gps_msg->ul_did) {
+ case VEHICLE_DID_GPS_UBLOX_NAV_POSLLH :
+ case VEHICLE_DID_GPS_UBLOX_NAV_STATUS :
+ case VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC :
+ case VEHICLE_DID_GPS_UBLOX_NAV_VELNED :
+ case VEHICLE_DID_GPS_UBLOX_NAV_DOP :
+ case VEHICLE_DID_GPS_UBLOX_NAV_SVINFO :
+ case VEHICLE_DID_GPS_UBLOX_NAV_CLOCK :
+ {
+ g_gps_data_get_flg = TRUE;
+ break;
+ }
+ default:
+ break;
+ }
+ } else if (CID_DEAD_RECKONING_SENS_DATA == msg->hdr.hdr.cid) {
+ rcv_sensor_msg = (const VEHICLESENS_DATA_MASTER *)(&(msg->data[0]));
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+
+ /* Sensor data reception for DR */
+ switch (rcv_sensor_msg->ul_did) {
+ case POSHAL_DID_SNS_COUNTER :
+ {
+ g_sns_buf[0].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[0].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ g_sns_buf[0].data[0] = rcv_sensor_msg->uc_data[0];
+ g_sens_data_get_sns_cnt_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_REV :
+ {
+ g_sns_buf[1].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[1].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[1].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_rev_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FLAG :
+ {
+ g_sns_buf[2].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[2].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[2].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_spdpulse_chk_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE :
+ {
+ g_sns_buf[3].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[3].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[3].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_spdpulse_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_GYRO_X :
+ {
+ g_sns_buf[4].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[4].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[4].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_gyro_x_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_GYRO_Y :
+ {
+ g_sns_buf[5].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[5].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[5].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_gyro_y_flg = TRUE;
+ break;
+ }
+ case POSHAL_DID_GYRO_Z :
+ {
+ g_sns_buf[6].did = rcv_sensor_msg->ul_did;
+ g_sns_buf[6].size = static_cast<u_int8>(rcv_sensor_msg->us_size);
+ (void)memcpy(reinterpret_cast<void *>(&(g_sns_buf[6].data[0])),
+ (const void *)(&(rcv_sensor_msg->uc_data[0])), (size_t)rcv_sensor_msg->us_size);
+ g_sens_data_get_gyro_z_flg = TRUE;
+ break;
+ }
+ default:
+ break;
+ }
+ } else if (CID_DEAD_RECKONING_SENS_FST_DATA == msg->hdr.hdr.cid) {
+ u_int16 rev_data_size;
+
+ rcv_sensor_msg_fst = (const VEHICLESENS_DATA_MASTER_FST *)(&(msg->data[0]));
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ rev_data_size = static_cast<u_int16>(msg->hdr.hdr.msgbodysize - VEHICLESENS_DELIVERY_FSTSNS_HDR_SIZE);
+
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " DID = %08X, rev_data_size = %d ",
+ rcv_sensor_msg_fst->ul_did, rev_data_size);
+#endif
+
+ /* Sensor data reception for DR */
+ switch (rcv_sensor_msg_fst->ul_did) {
+ case POSHAL_DID_REV_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.rev_data[g_fst_sns_buf.rev_rcv_size
+ / sizeof(g_fst_sns_buf.rev_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.rev_rcv_size = static_cast<u_int16>(
+ g_fst_sns_buf.rev_rcv_size + rev_data_size);
+
+ if (g_fst_sns_buf.rev_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_rev_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " REV receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FLAG_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.spd_pulse_check_data[g_fst_sns_buf.spd_pulse_check_rcv_size
+ / sizeof(g_fst_sns_buf.spd_pulse_check_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.spd_pulse_check_rcv_size = static_cast<u_int16>(
+ g_fst_sns_buf.spd_pulse_check_rcv_size + rev_data_size);
+
+ if (g_fst_sns_buf.spd_pulse_check_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_spdpulse_chk_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " SPF receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.spd_pulse_data[g_fst_sns_buf.spd_pulse_rcv_size
+ / sizeof(g_fst_sns_buf.spd_pulse_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.spd_pulse_rcv_size = static_cast<u_int16>(g_fst_sns_buf.spd_pulse_rcv_size + \
+ rev_data_size);
+
+ if (g_fst_sns_buf.spd_pulse_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_spdpulse_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " SP receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ case POSHAL_DID_GYRO_X_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.gyro_x_data[g_fst_sns_buf.gyro_x_rcv_size
+ / sizeof(g_fst_sns_buf.gyro_x_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.gyro_x_rcv_size = static_cast<u_int16>(g_fst_sns_buf.gyro_x_rcv_size + rev_data_size);
+
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " g_fst_sns_buf.gyro_x_rcv_size = %d, rcv_sensor_msg_fst->us_size = %d ",
+ g_fst_sns_buf.gyro_x_rcv_size, rcv_sensor_msg_fst->us_size);
+#endif
+ if (g_fst_sns_buf.gyro_x_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_gyro_x_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " GYRO_X receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ case POSHAL_DID_GYRO_Y_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.gyro_y_data[g_fst_sns_buf.gyro_y_rcv_size
+ / sizeof(g_fst_sns_buf.gyro_y_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.gyro_y_rcv_size = static_cast<u_int16>(g_fst_sns_buf.gyro_y_rcv_size + rev_data_size);
+
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " g_fst_sns_buf.gyro_y_rcv_size = %d, rcv_sensor_msg_fst->us_size = %d ",
+ g_fst_sns_buf.gyro_y_rcv_size, rcv_sensor_msg_fst->us_size);
+#endif
+ if (g_fst_sns_buf.gyro_y_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_gyro_y_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " GYRO_Y receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ case POSHAL_DID_GYRO_Z_FST :
+ {
+ (void)memcpy(
+ reinterpret_cast<void *>(&(g_fst_sns_buf.gyro_z_data[g_fst_sns_buf.gyro_z_rcv_size
+ / sizeof(g_fst_sns_buf.gyro_z_data[0])])),
+ (const void *)(&(rcv_sensor_msg_fst->uc_data[0])),
+ (size_t)(rev_data_size));
+
+ g_fst_sns_buf.gyro_z_rcv_size = static_cast<u_int16>(g_fst_sns_buf.gyro_z_rcv_size + rev_data_size);
+
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ " g_fst_sns_buf.gyro_z_rcv_size = %d, rcv_sensor_msg_fst->us_size = %d ",
+ g_fst_sns_buf.gyro_z_rcv_size, rcv_sensor_msg_fst->us_size);
+#endif
+ if (g_fst_sns_buf.gyro_z_rcv_size == rcv_sensor_msg_fst->us_size) {
+ g_sens_data_get_gyro_z_fst_flg = TRUE;
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " GYRO_Z receive flag = TRUE ");
+#endif
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ } else {
+ /* nop */
+ }
+
+ /* 4 data received? */
+ if ((g_sens_data_get_sns_cnt_flg == TRUE) &&
+ (g_sens_data_get_rev_flg == TRUE) &&
+ (g_sens_data_get_gyro_x_flg == TRUE) &&
+ (g_sens_data_get_gyro_y_flg == TRUE) &&
+ (g_sens_data_get_gyro_z_flg == TRUE) &&
+ (g_sens_data_get_spdpulse_flg == TRUE) &&
+ (g_sens_data_get_spdpulse_chk_flg == TRUE)) {
+ /* Sensor data acquisition flag ON */
+ g_sens_data_get_flg = TRUE;
+
+ /* Set all flags to FALSE */
+ g_sens_data_get_sns_cnt_flg = FALSE;
+ g_sens_data_get_gyro_x_flg = FALSE;
+ g_sens_data_get_gyro_y_flg = FALSE;
+ g_sens_data_get_gyro_z_flg = FALSE;
+ g_sens_data_get_rev_flg = FALSE;
+ g_sens_data_get_spdpulse_flg = FALSE;
+ g_sens_data_get_spdpulse_chk_flg = FALSE;
+ }
+
+ /* 4 data received? */
+ if ((g_sens_data_get_rev_fst_flg == TRUE) &&
+ (g_sens_data_get_gyro_x_fst_flg == TRUE) &&
+ (g_sens_data_get_gyro_y_fst_flg == TRUE) &&
+ (g_sens_data_get_gyro_z_fst_flg == TRUE) &&
+ (g_sens_data_get_spdpulse_fst_flg == TRUE) &&
+ (g_sens_data_get_spdpulse_chk_fst_flg == TRUE)) {
+ /* Initial sensor data acquisition flag ON */
+ g_fst_sens_data_get_flg = TRUE;
+
+ /* Set all flags to FALSE */
+ g_sens_data_get_gyro_x_fst_flg = FALSE;
+ g_sens_data_get_gyro_y_fst_flg = FALSE;
+ g_sens_data_get_gyro_z_fst_flg = FALSE;
+ g_sens_data_get_rev_fst_flg = FALSE;
+ g_sens_data_get_spdpulse_fst_flg = FALSE;
+ g_sens_data_get_spdpulse_chk_fst_flg = FALSE;
+ }
+
+ DeadReckoningRcvMsgFstSens(msg, location_info, rcv_gps_msg, &send_gps_msg, &send_sensor_msg);
+ }
+}
+
+void DeadReckoningRcvMsgFstSens(const DEAD_RECKONING_RCVDATA *msg, DEAD_RECKONING_LONLAT_INFO *location_info,
+ const SENSOR_MSG_GPSDATA_DAT *rcv_gps_msg, Struct_GpsData* send_gps_msg,
+ Struct_SensData* send_sensor_msg) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Verifying Debug Log Simulator Mode
+ Perform packet reading here to match some timing.
+ However,,Differ between GPS and SENSOR.
+ */
+ u_int8 fst_sens_send_num = 0U;
+ /* For GPS data */
+ if (g_gps_data_get_flg == TRUE) {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "DeadReckoningRcvMsg SEND GPS_DATA: DID[0x%08X] DSIZE[%d] MSG_SIZE[%d] SNS_CNT[%d] \r\n",
+ rcv_gps_msg.ulDid, rcv_gps_msg.ucData[4], msg->hdr.hdr.msgbodysize, rcv_gps_msg.ucSnsCnt);
+#endif
+
+ if (1) {
+ rcv_gps_msg = (const SENSOR_MSG_GPSDATA_DAT *)(&(msg->data[0]));
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+
+ /* Set and pass the data part except header/footer */
+ send_gps_msg->sens_cnt = rcv_gps_msg->uc_sns_cnt;
+ send_gps_msg->sens_cnt_flag = rcv_gps_msg->uc_gps_cnt_flag;
+ send_gps_msg->gps_data_size = rcv_gps_msg->us_size;
+ send_gps_msg->did = rcv_gps_msg->ul_did;
+ send_gps_msg->gps_data = (const void *)(&rcv_gps_msg->uc_data[0]);
+ }
+
+ /* Providing GPS data to DR_Lib */
+
+ g_gps_data_get_flg = FALSE;
+
+ } else if (g_sens_data_get_flg == TRUE) {
+ Struct_DR_DATA rcv_dr_data;
+ DR_CALC_INFO rcv_dr_calc_info;
+ DEADRECKONING_DATA_MASTER send_data_master;
+
+ if (1) {
+ /* Each data is stored in the data format for transmission. */
+ send_sensor_msg->sens_cnt_flag = 1U;
+ send_sensor_msg->sens_cnt = g_sns_buf[0].data[0];
+ send_sensor_msg->pulse_rev_tbl.reverse_flag = g_sns_buf[1].data[0];
+ send_sensor_msg->pulse_rev_tbl.pulse_flag = g_sns_buf[2].data[0];
+ send_sensor_msg->pulse_rev_tbl.pulse_sum_cyclic = static_cast<u_int16>(
+ ((((u_int16)g_sns_buf[3].data[0] << 0) & DR_MASK_WORD_L) |
+ (((u_int16)g_sns_buf[3].data[1] << 8) & DR_MASK_WORD_U)));
+ /* ToDo */
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_x_tbl.gyro_data[0])),
+ (const void *)(&(g_sns_buf[4].data[0])), sizeof(u_int16) * NUM_OF_100msData);
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_y_tbl.gyro_data[0])),
+ (const void *)(&(g_sns_buf[5].data[0])), sizeof(u_int16) * NUM_OF_100msData);
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_z_tbl.gyro_data[0])),
+ (const void *)(&(g_sns_buf[6].data[0])), sizeof(u_int16) * NUM_OF_100msData);
+ }
+
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningRcvMsg SEND SENSOR_COUNTER %d \r\n",
+ send_sensor_msg->sens_cnt);
+#endif
+
+ /* When the sensor data are ready, Call the DR-calculation process. */
+ memset(&rcv_dr_data, 0x00, sizeof(rcv_dr_data)); /* Coverity CID:18805 compliant */
+ memset(&rcv_dr_calc_info, 0x00, sizeof(rcv_dr_calc_info)); /* Coverity CID:18806 compliant */
+
+ location_info->calc_called = static_cast<u_int8>(TRUE);
+ location_info->lonlat.latitude = static_cast<int32>(rcv_dr_data.latitude);
+ location_info->lonlat.longitude = static_cast<int32>(rcv_dr_data.longitude);
+
+ if (rcv_dr_data.dr_status != static_cast<u_int8>(SENSORLOCATION_DRSTATUS_INVALID)) {
+ location_info->available = static_cast<u_int8>(TRUE);
+ } else {
+ location_info->available = static_cast<u_int8>(FALSE);
+ }
+
+ /* Changing the order of registration and delivery of the out structure to the data master for DR */
+
+ send_data_master.ul_did = VEHICLE_DID_DR_SNS_COUNTER;
+ send_data_master.us_size = VEHICLE_DSIZE_DR_SNS_COUNTER;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.positioning_time)), (size_t)VEHICLE_DSIZE_DR_SNS_COUNTER);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_LONGITUDE;
+ send_data_master.us_size = VEHICLE_DSIZE_LONGITUDE;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.longitude)), (size_t)VEHICLE_DSIZE_LONGITUDE);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_LATITUDE;
+ send_data_master.us_size = VEHICLE_DSIZE_LATITUDE;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.latitude)), (size_t)VEHICLE_DSIZE_LATITUDE);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_ALTITUDE;
+ send_data_master.us_size = VEHICLE_DSIZE_ALTITUDE;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.altitude)), (size_t)VEHICLE_DSIZE_ALTITUDE);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_SPEED;
+ send_data_master.us_size = VEHICLE_DSIZE_SPEED;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.rate)), (size_t)VEHICLE_DSIZE_SPEED);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_HEADING;
+ send_data_master.us_size = VEHICLE_DSIZE_HEADING;
+ send_data_master.uc_rcv_flag = 1;
+ send_data_master.dr_status = rcv_dr_data.dr_status;
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ (const void *)(&(rcv_dr_data.heading)), (size_t)VEHICLE_DSIZE_HEADING);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ /* Data master setting,Data delivery(GyroParameter) */
+ /* As it is registered for delivery with DID = VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL */
+ /* Process in GyroOffset-> GyroScaleFactor-> GyroScelFactorLevel order(Processing order cannot be changed.) */
+ send_data_master.ul_did = VEHICLE_DID_DR_GYRO_OFFSET;
+ send_data_master.us_size = VEHICLE_DSIZE_GYRO_OFFSET;
+ send_data_master.uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ send_data_master.dr_status = 0U; /* Not used */
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ reinterpret_cast<void *>(&(rcv_dr_calc_info.gyro_offset)), (size_t)send_data_master.us_size);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_GYRO_SCALE_FACTOR;
+ send_data_master.us_size = VEHICLE_DSIZE_GYRO_SCALE_FACTOR;
+ send_data_master.uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ send_data_master.dr_status = 0U; /* Not used */
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ reinterpret_cast<void *>(&(rcv_dr_calc_info.gyro_scale_factor)),
+ (size_t)send_data_master.us_size);
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL;
+ send_data_master.us_size = VEHICLE_DSIZE_GYRO_SCALE_FACTOR_LEVEL;
+ send_data_master.uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ send_data_master.dr_status = 0U; /* Not used */
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ reinterpret_cast<void *>(&(rcv_dr_calc_info.gyro_scale_factor_level)),
+ (size_t)(send_data_master.us_size));
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ /* Data master setting,Data delivery(SpeedPulseParameter) */
+ /* As it is registered for delivery with DID = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL */
+ /* Process in SpeedPulseScaleFactor-> SpeedPulseScaleFactorLevel order(Processing order cannot be changed.) */
+ send_data_master.ul_did = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR;
+ send_data_master.us_size = VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR;
+ send_data_master.uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ send_data_master.dr_status = 0U; /* Not used */
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ reinterpret_cast<void *>(&(rcv_dr_calc_info.speed_pulse_scale_factor)),
+ (size_t)(send_data_master.us_size));
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ send_data_master.ul_did = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL;
+ send_data_master.us_size = VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR_LEVEL;
+ send_data_master.uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
+ send_data_master.dr_status = 0U; /* Not used */
+ (void)memcpy(reinterpret_cast<void *>(&(send_data_master.uc_data[0])),
+ reinterpret_cast<void *>(&(rcv_dr_calc_info.speed_pulse_scale_factor_level)),
+ (size_t)(send_data_master.us_size));
+ DeadReckoningSetDataMaster(&send_data_master, (PFUNC_DR_DMASTER_SET_N)DeadReckoningDeliveryProc);
+
+ g_sens_data_get_flg = FALSE;
+ } else if (g_fst_sens_data_get_flg == TRUE) {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningRcvMsg FstSnsData -> DeadReckoningLibrary. \r\n");
+#endif
+ for (fst_sens_send_num = 0; fst_sens_send_num < g_fst_sns_buf.data_num; fst_sens_send_num++) {
+ /* Each data is stored in the data format for transmission. */
+ send_sensor_msg->sens_cnt_flag = 0U;
+ send_sensor_msg->sens_cnt = 0U;
+ send_sensor_msg->pulse_rev_tbl.reverse_flag = g_fst_sns_buf.rev_data[fst_sens_send_num];
+ send_sensor_msg->pulse_rev_tbl.pulse_flag = g_fst_sns_buf.spd_pulse_check_data[fst_sens_send_num];
+ send_sensor_msg->pulse_rev_tbl.pulse_sum_cyclic = g_fst_sns_buf.spd_pulse_data[fst_sens_send_num];
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_x_tbl.gyro_data[0])),
+ (const void *)(&(g_fst_sns_buf.gyro_x_data[fst_sens_send_num * NUM_OF_100msData])),
+ (size_t)((sizeof(g_fst_sns_buf.gyro_x_data[fst_sens_send_num])) * NUM_OF_100msData));
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_y_tbl.gyro_data[0])),
+ (const void *)(&(g_fst_sns_buf.gyro_y_data[fst_sens_send_num * NUM_OF_100msData])),
+ (size_t)((sizeof(g_fst_sns_buf.gyro_y_data[fst_sens_send_num])) * NUM_OF_100msData));
+ (void)memcpy(reinterpret_cast<void *>(&(send_sensor_msg->gyro_z_tbl.gyro_data[0])),
+ (const void *)(&(g_fst_sns_buf.gyro_z_data[fst_sens_send_num * NUM_OF_100msData])),
+ (size_t)((sizeof(g_fst_sns_buf.gyro_z_data[fst_sens_send_num])) * NUM_OF_100msData));
+
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningRcvMsg send_sensor_msg.sens_cnt_flag %d \r\n",
+ send_sensor_msg->sens_cnt_flag);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DeadReckoningRcvMsg SEND SENSOR_COUNTER %d \r\n",
+ send_sensor_msg->sens_cnt);
+#endif
+
+ /* Sleep to reduce CPU load */
+ MilliSecSleep(DR_FST_SENS_CALC_SLEEP_TIME);
+
+ /* When the sensor data are ready, Call the DR-calculation process. */
+ }
+
+ g_sens_data_get_flg = FALSE;
+
+ g_fst_sens_data_get_flg = FALSE;
+
+ } else {
+ /* nop */
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningGetDRData
+* ABSTRACT : Vehicle sensor information acquisition
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningGetDRData(const DEADRECKONING_MSG_GET_DR_DATA *msg) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ void *share_top; /* Start address of shared memory */
+ u_int32 share_size; /* Size of shared memory area */
+ RET_API ret_api;
+ int32 ret;
+ int32 event_val = VEHICLE_RET_NORMAL;
+ EventID event_id;
+ DEADRECKONING_DATA_MASTER dr_master; /* GPS Data Master */
+
+ DEADRECKONING_MSG_GET_DR_DATA msg_buf;
+
+ /* Defines the data master for each API. */
+ SENSORLOCATION_MSG_LONLATINFO_DAT msg_lonlat_info;
+ SENSORLOCATION_MSG_ALTITUDEINFO_DAT msg_altitude_info;
+ SENSORMOTION_MSG_SPEEDINFO_DAT msg_speed_info;
+ SENSORMOTION_MSG_HEADINGINFO_DAT msg_heading_info;
+
+ (void)memset(reinterpret_cast<void *>(&msg_buf), 0, sizeof(DEADRECKONING_MSG_GET_DR_DATA));
+ memcpy(&(msg_buf), msg, sizeof(DEADRECKONING_MSG_GET_DR_DATA));
+
+ /* Check the DID */
+ ret = DeadReckoningCheckDid(msg_buf.data.did);
+
+ if (VEHICLESENS_INVALID != ret) {
+ /* DID normal */
+
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME), &share_top, &share_size);
+ if (RET_NORMAL == ret_api) {
+ /* Acquire the specified data from the data master. */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(msg_buf.data.did, &dr_master);
+
+ /* Align data from the data master for API I/F */
+ switch ((u_int32)(msg_buf.data.did)) {
+ /* Describes the process for each DID. */
+ case VEHICLE_DID_DR_LATITUDE:
+ {
+ (void)memset(reinterpret_cast<void *>(&msg_lonlat_info),
+ 0, sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT));
+
+ /* Size storage(LATITUDE) */
+ msg_lonlat_info.size = static_cast<u_int16>(sizeof(SENSORLOCATION_MSG_LONLATINFO_DAT));
+
+ /* DR status setting */
+ msg_lonlat_info.dr_status = dr_master.dr_status;
+
+ /* The DR enable flag is set to DR status. */
+ msg_lonlat_info.is_exist_dr = dr_master.dr_status;
+
+ /* Set the Latitude */
+ memcpy(&(msg_lonlat_info.latitude), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Obtain the data master Longitude */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_LONGITUDE, &dr_master);
+
+ /* Set the Longitude */
+ memcpy(&(msg_lonlat_info.longitude), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &dr_master);
+
+ /* Set the SensorCnt */
+ memcpy(&(msg_lonlat_info.sensor_cnt), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg_buf.data.offset,
+ (const void *)&msg_lonlat_info,
+ sizeof(msg_lonlat_info));
+
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+
+ break;
+ }
+ case VEHICLE_DID_DR_ALTITUDE:
+ {
+ (void)memset(reinterpret_cast<void *>(&msg_altitude_info),
+ 0, sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT));
+
+ msg_altitude_info.size = static_cast<u_int16>(sizeof(SENSORLOCATION_MSG_ALTITUDEINFO_DAT));
+ /* The DR enable flag is set to DR status. */
+ msg_altitude_info.is_exist_dr = dr_master.dr_status;
+ msg_altitude_info.dr_status = dr_master.dr_status;
+
+ /* Set the Speed */
+ memcpy(&(msg_altitude_info.altitude), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &dr_master);
+
+ /* Set the SensorCnt */
+ memcpy(&(msg_altitude_info.sensor_cnt), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg_buf.data.offset,
+ (const void *)&msg_altitude_info,
+ sizeof(msg_altitude_info));
+
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+
+ break;
+ }
+ case VEHICLE_DID_DR_SPEED:
+ {
+ (void)memset(reinterpret_cast<void *>(&msg_speed_info),
+ 0, sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT));
+
+ msg_speed_info.size = static_cast<u_int16>(sizeof(SENSORMOTION_MSG_SPEEDINFO_DAT));
+ /* The DR enable flag is set to DR status. */
+ msg_speed_info.is_exist_dr = dr_master.dr_status;
+ msg_speed_info.dr_status = dr_master.dr_status;
+
+ /* Set the Speed */
+ memcpy(&(msg_speed_info.speed), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &dr_master);
+ /* Set the SensorCnt */
+ memcpy(&(msg_speed_info.sensor_cnt), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg_buf.data.offset,
+ (const void *)&msg_speed_info,
+ sizeof(msg_speed_info));
+
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+
+ break;
+ }
+ case VEHICLE_DID_DR_HEADING:
+ {
+ (void)memset(reinterpret_cast<void *>(&msg_heading_info),
+ 0, sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT));
+
+ msg_heading_info.size = static_cast<u_int16>(sizeof(SENSORMOTION_MSG_HEADINGINFO_DAT));
+ /* The DR enable flag is set to DR status. */
+ msg_heading_info.is_exist_dr = dr_master.dr_status;
+ msg_heading_info.dr_status = dr_master.dr_status;
+
+ /* Set the Heading */
+ memcpy(&(msg_heading_info.heading), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Acquire data master SensorCnt */
+ (void)memset(reinterpret_cast<void *>(&dr_master), 0, sizeof(DEADRECKONING_DATA_MASTER));
+ DeadReckoningGetDataMaster(VEHICLE_DID_DR_SNS_COUNTER, &dr_master);
+ /* Set the SensorCnt */
+ memcpy(&(msg_heading_info.sensor_cnt), &(dr_master.uc_data[0]), dr_master.us_size);
+
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg_buf.data.offset,
+ (const void *)&msg_heading_info,
+ sizeof(msg_heading_info));
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+
+ break;
+ }
+ /* Other than the above */
+ default:
+ /* Do not edit. */
+ break;
+ }
+
+ /* Check the data size */
+ if (msg_buf.data.size < dr_master.us_size) {
+ /* Shared memory error(Insufficient storage size) */
+ event_val = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ }
+ } else {
+ /* Shared memory error */
+ event_val = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ }
+ } else {
+ /* DID error */
+ event_val = VEHICLE_RET_ERROR_DID;
+ }
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(msg_buf.data.pno);
+
+ /* Publish Events */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningSetMapMatchingData
+* ABSTRACT : Map-Matching information setting
+* FUNCTION : Setting Map-Matching Information
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningSetMapMatchingData(const DR_MSG_MAP_MATCHING_DATA *msg) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningClearBackupData
+* ABSTRACT : Backup data clear function CALL
+* FUNCTION : Call the backup data clear function.
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void DeadReckoningClearBackupData(const DR_MSG_CLEAR_BACKUP_DATA *msg) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ char event_name[32]; /* Event name character string buffer */
+ EventID event_id; /* Event ID */
+ int32 event_val; /* Event value to set*/
+ RET_API ret_api; /* System API return value */
+
+ if (msg != NULL) {
+ /* DR backup data initialization function call */
+ event_val = RET_NORMAL;
+
+ /* Initialization of event name character string buffer */
+ (void)memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name));
+
+ /* Event name creation */
+ snprintf(event_name, sizeof(event_name), "DR_API_%X", msg->hdr.hdr.sndpno);
+ /* Match DR_API.cpp side with name */
+
+ /* Event Generation */
+ event_id = _pb_CreateEvent(_CWORD64_EVENT_MANUALRESET_OFF, DR_EVENT_VAL_INIT, event_name);
+
+ if (event_id != 0) {
+ /* For successful event generation */
+ /* Set the event */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+
+ if (ret_api == RET_NORMAL) {
+ /* Successful event set */
+ } else {
+ /* Event set failed */
+ /* Delete Event and Return Event Generation Failed */
+ ret_api = _pb_DeleteEvent(event_id);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SetEvent Failed\r\n");
+ }
+ }
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningSetEvent
+* ABSTRACT : Set of events
+* FUNCTION : Set event to return successful or unsuccessful log configuration retrieval
+* ARGUMENT : PNO pno : Caller Pno
+* : RET_API ret : Log setting acquisition Success/Fail
+* : RET_NORMAL: Log setting acquisition success
+* : RET_ERROR: Log setting acquisition failure
+* NOTE :
+* RETURN : None
+******************************************************************************/
+static void DeadReckoningSetEvent(PNO pno, RET_API ret) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ char event_name[32]; /* Event name character string buffer */
+ EventID event_id; /* Event ID */
+ RET_API ret_api; /* System API return value */
+
+ /* Initialization of event name character string buffer */
+ (void)memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name));
+
+ /* Event name creation */
+ snprintf(event_name, sizeof(event_name), "VehicleDebug_%X", pno);
+ /* Event name should match VehicleDebug_API.cpp */
+
+ /* Event Generation */
+ event_id = _pb_CreateEvent(_CWORD64_EVENT_MANUALRESET_OFF, VEHICLEDEBUG_EVENT_VAL_INIT, event_name);
+
+ if (event_id != 0) {
+ /* For successful event generation */
+ /* Set the event */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, ret);
+
+ if (ret_api == RET_NORMAL) {
+ /* Successful event set */
+ } else {
+ /* Event set failed */
+ /* Delete Event */
+ ret_api = _pb_DeleteEvent(event_id);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SetEvent Failed\r\n");
+ }
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningLinkSharedMemory
+* ABSTRACT : Shared memory link
+* FUNCTION : Link to shared memory
+* ARGUMENT : char *shared_memory_name : Name of shared memory to link
+* : void **share_addr : Pointer to a variable that stores the address of the linked shared memory.
+* NOTE :
+* RETURN : None
+******************************************************************************/
+static void DeadReckoningLinkSharedMemory(char *shared_memory_name, void **share_addr) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api;
+ void *pv_share_mem; /* Store Shared Memory Address */
+ u_int32 share_mem_size; /* Size of the linked shared memory */
+
+ if ((shared_memory_name != NULL) && (share_addr != NULL)) {
+ /* Link to the handle storage area */
+ ret_api = _pb_LinkShareData(shared_memory_name, &pv_share_mem, &share_mem_size);
+
+ if (ret_api == RET_NORMAL) {
+ /* If the link is successful */
+ if (share_mem_size == VEHICLEDEBUG_MSGBUF_DSIZE) {
+ /* When the size of the linked shared memory is correct */
+ *share_addr = pv_share_mem; /* Set the address */
+ } else {
+ /* The size of the linked shared memory is incorrect. */
+ *share_addr = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Bad shared memory size\r\n");
+ }
+ } else {
+ /* If the link fails */
+ *share_addr = NULL;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't link shared memory\r\n");
+ }
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningWriteSharedMemory
+* ABSTRACT : Write Shared Memory
+* FUNCTION : Write Shared Memory
+* ARGUMENT : VEHICLEDEBUG_MSG_LOGINFO_DAT* loginfo : Logging information
+* RETURN : RET_API : Whether writing to shared memory was successful
+* : : RET_NORMAL Success
+* : : RET_ERROR Failed
+* NOTE :
+******************************************************************************/
+static RET_API DeadReckoningWriteSharedMemory(VEHICLEDEBUG_MSG_LOGINFO_DAT* loginfo) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static VEHICLEDEBUG_MSG_LOGINFO_DAT *share_addr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ RET_API ret = RET_NORMAL; /* Return of the functions */
+ RET_API ret_api; /* Return of the functions */
+
+#if DEAD_RECKONING_MAIN_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Call %s\r\n", __func__);
+#endif
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(SENSOR_LOG_SETTING_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (share_addr == NULL) {
+ /* Link to shared memory */
+ DeadReckoningLinkSharedMemory(const_cast<char *>(LOG_SETTING_SHARE_MEMORY_NAME),
+ reinterpret_cast<void **>(&share_addr));
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ }
+
+ if (share_addr != NULL) {
+ /* The link to shared memory is successful. */
+ /* Writing Data to Shared Memory */
+ share_addr->log_sw = loginfo->log_sw;
+ (void)memcpy(reinterpret_cast<void *>(share_addr->severity),
+ (const void *)(loginfo->severity), sizeof(share_addr->severity));
+ } else {
+ /* Failed to link to shared memory */
+ ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "DeadReckoningLinkSharedMemory Failed");
+ }
+ /* Semaphore unlock */
+ (void)_pb_SemUnlock(sem_id);
+ } else {
+ /* Semaphore lock failed */
+ ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock Failed");
+ }
+ } else {
+ ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return ret;
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningGetLocationLogStatus
+* ABSTRACT : CALL of functions for acquiring logging settings
+* FUNCTION : Call the log setting acquisition function.
+* ARGUMENT : None
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningGetLocationLogStatus(PNO pno) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api; /* System API return value */
+ RET_API ret;
+ VEHICLEDEBUG_MSG_LOGINFO_DAT loginfo; /* Logging information */
+ BOOL log_sw = FALSE;
+
+ /* CALL of functions for acquiring logging settings */
+ ret_api = RET_NORMAL;
+
+ if (ret_api == RET_NORMAL) {
+ /* Log setting acquisition function succeeded */
+ loginfo.log_sw = (u_int32)(log_sw);
+
+ /* Write to shared memory */
+ ret = DeadReckoningWriteSharedMemory(&loginfo);
+
+ /* Event publishing */
+ DeadReckoningSetEvent(pno, ret);
+ } else {
+ /* Log setting acquisition function failed */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "GetLocationLogSetting Failed");
+
+ /* Event publishing */
+ DeadReckoningSetEvent(pno, RET_ERROR);
+ }
+}
+
+/*******************************************************************************
+* MODULE : DeadReckoningSetLocationLogStatus
+* ABSTRACT : CALL of log-setting-request-function
+* FUNCTION : Call the log setting request function.
+* ARGUMENT : u_int32 log_sw : Log type
+* : u_int8 severity : Output level
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void DeadReckoningSetLocationLogStatus(BOOL log_sw, u_int8 severity) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/GpsInt.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/GpsInt.cpp
new file mode 100755
index 0000000..75fb890
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/GpsInt.cpp
@@ -0,0 +1,171 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :GpsInt.cpp
+ * System name :PastModel002
+ * Subsystem name :GPS interrupt thread
+ ******************************************************************************/
+
+/*******************************************************************************
+* Include File
+*******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "POS_private.h"
+#include "GpsInt.h"
+
+#define RD_REG32(reg) \
+ (*(volatile ULONG * const)(reg))
+
+#define COMREGMSK_OR 1
+#define ALLINTMASK 0x0f
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void com_regmsk_dword(ULONG *, ULONG, UCHAR, UCHAR); // NOLINT(readability/nolint)
+#ifdef __cplusplus
+}
+#endif
+
+/*******************************************************************************
+* Define
+*******************************************************************************/
+#define GPS_INT_THREAD_DEBUG_SWITCH 0 /* 0:OFF 1:ON */
+
+/*******************************************************************************
+* Global Parameter
+*******************************************************************************/
+GPS_INT_DATA g_gps_int_data;
+
+/*******************************************************************************
+* Module
+*******************************************************************************/
+/*******************************************************************************
+ * MODULE : DEVGpsIntUnMapDevice
+ * ABSTRACT : Register mapping release processing
+ * FUNCTION : Release the register mapping
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void DEVGpsIntUnMapDevice(void) {
+ /* Release GPIO Register Mapping */
+ if ((g_gps_int_data.irq_status_reg != 0)
+ || (g_gps_int_data.irq_status_set_reg != 0)
+ || (g_gps_int_data.rising_detect_reg != 0)) {
+ /* When GPIO registers are mapped */
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ MunMapDeviceIo((HANDLE)g_gps_int_data.irq_status_reg, sizeof(g_gps_int_data.irq_status_reg));
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ MunMapDeviceIo((HANDLE)g_gps_int_data.irq_status_set_reg, sizeof(g_gps_int_data.irq_status_set_reg));
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ MunMapDeviceIo((HANDLE)g_gps_int_data.rising_detect_reg, sizeof(g_gps_int_data.rising_detect_reg));
+
+ g_gps_int_data.irq_status_reg = 0;
+ g_gps_int_data.irq_status_set_reg = 0;
+ g_gps_int_data.rising_detect_reg = 0;
+ }
+}
+
+/*******************************************************************************
+ * MODULE : DEVGpsIntSetInterupt
+ * ABSTRACT : GPS interrupt setting
+ * FUNCTION : Setting GPS Interrupt
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : TRUE : Interrupt setting success
+ * : FALSE : Interrupt setting failure
+ ******************************************************************************/
+void DEVGpsIntSetInterupt(void) {
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ /* Dummy read */
+ itr_ret = RD_REG32(g_gps_int_data.irq_status_set_reg);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, IRQSTATUS_SET reg value(before) = 0x%08X ", itr_ret);
+#endif
+
+ /* GPS interrupt Enable setting */
+ /* Dummy read */
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ (void)RD_REG32(g_gps_int_data.irq_status_set_reg);
+
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, IRQSTATUS_SET reg value(after) = 0x%08X ", itr_ret);
+#endif
+
+
+
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ /* Dummy read */
+ itr_ret = RD_REG32(g_gps_int_data.rising_detect_reg);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, RISINGDETECT reg value(before) = 0x%08X ", itr_ret);
+#endif
+
+ /* GPS Interrupt Detection Method Setting */
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ com_regmsk_dword(reinterpret_cast<ULONG *>(g_gps_int_data.rising_detect_reg), \
+ GPS_MASK_6BIT, COMREGMSK_OR, ALLINTMASK);
+
+ /* Dummy read */
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ (void)RD_REG32(g_gps_int_data.rising_detect_reg);
+
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, RISINGDETECT reg value(after) = 0x%08X ", itr_ret);
+#endif
+}
+
+/*******************************************************************************
+ * MODULE : DEVGpsIntIntRegClear
+ * ABSTRACT : Interrupt cause register clear processing
+ * FUNCTION : Clear the interrupt cause register
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : None
+ ******************************************************************************/
+void DEVGpsIntIntRegClear(void) {
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ /* Dummy read */
+ itr_ret = RD_REG32(g_gps_int_data.irq_status_reg);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, IRQSTATUS reg value(before) = 0x%08X ", itr_ret);
+#endif
+
+ /* Clear Interrupt Source Register */
+ /* Dummy read */
+ /* #QAC confirmation Rule11.3 Data Size Equivalent (4Byte),No problem due to unsigned relation */
+ (void)RD_REG32(g_gps_int_data.irq_status_reg);
+
+#if GPS_INT_THREAD_DEBUG_SWITCH
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "GpsInt.cpp, IRQSTATUS reg value(after) = 0x%08X ", itr_ret);
+#endif
+}
+
+/*******************************************************************************
+ * MODULE : DEVGpsIntSndMsg
+ * ABSTRACT : Send GPS interrupt occurrence notification
+ * FUNCTION : Notify GPS communication management that an interrupt has occurred.
+ * ARGUMENT : None
+ * NOTE :
+ * RETURN : RET_NORMAL : Normal completion
+ * : Other than the above : Processing error
+ ******************************************************************************/
+RET_API DEVGpsIntSndMsg(void) {
+ return RET_NORMAL;
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/Makefile b/video_in_hal/vehicleservice/positioning/server/src/Sensor/Makefile
new file mode 100755
index 0000000..bb70229
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/Makefile
@@ -0,0 +1,181 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed library(*.a) #############
+INST_LIBS = libPOS_Sensor
+
+######### compiled sources #############
+libPOS_Sensor_SRCS += DeadReckoning_main.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Common.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_GyroScaleFactorLevel_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_Heading_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_GyroOffset_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_Speed_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_Longitude_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_SnsCounter.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_Altitude_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_GyroScaleFactor_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_DataMasterMain.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_Latitude_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_SpeedPulseScaleFactor_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp
+libPOS_Sensor_SRCS += DeadReckoning_DeliveryCtrl.cpp
+libPOS_Sensor_SRCS += ClockUtility.cpp
+libPOS_Sensor_SRCS += VehicleUtility.cpp
+libPOS_Sensor_SRCS += GpsInt.cpp
+libPOS_Sensor_SRCS += VehicleSens_Thread.cpp
+libPOS_Sensor_SRCS += VehicleSens_FromAccess.cpp
+libPOS_Sensor_SRCS += VehicleSens_Common.cpp
+libPOS_Sensor_SRCS += VehicleSens_SelectionItemList.cpp
+libPOS_Sensor_SRCS += VehicleSens_SharedMemory.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MainGpsInterruptSignal.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsAntennaStatus.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Rev.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsCounter_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulse_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Rev_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulseExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Mon_Hw_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_Clock_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SysGpsInterruptSignal.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SnsCounter_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroYExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroZExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroX.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroY.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroZ.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_Dop_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroTrouble.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SnsCounterExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Gps_CWORD82__CWORD44_Gp4_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroX_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroY_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroZ_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroConnectStatus.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_RevFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_RevExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_SvInfo_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GPSInterruptFlag.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulseFlag.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_TimeGps_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_TimeUtc_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulseFlagFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SnsCounter.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulseFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroXFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroYFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroZFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_Status_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedPulse.cpp
+libPOS_Sensor_SRCS += VehicleSens_DataMasterMain.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_Velned_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_Nav_Posllh_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsAntenna.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsAntenna_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedKmph.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SpeedKmph_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationLonLat.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationLonLat_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationAltitude.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationAltitude_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionSpeed.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionSpeed_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionSpeed_n.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionSpeed_i.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionHeading.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionHeading_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsTime.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsTime_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsTimeRaw.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsTimeRaw_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_NaviinfoDiagGPS_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsX.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsX_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsXExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsXFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsY.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsY_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsYExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsYFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsZ.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsZ_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsZExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GsnsZFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroTemp.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroTemp_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroTempExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GyroTempFst_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsNmea_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationLonLat_n.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationAltitude_n.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionSpeed_n.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_MotionHeading_n.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SettingTime.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_SettingTime_clock.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_PulseTime.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_PulseTime_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_PulseTimeExt_l.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_WknRollover.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_WknRollover_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsClockDrift.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsClockDrift_g.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsClockFreq.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_GpsClockFreq_g.cpp
+
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationInfoNmea.cpp
+libPOS_Sensor_SRCS += VehicleSens_Did_LocationInfoNmea_n.cpp
+
+libPOS_Sensor_SRCS += VehicleSens_CanDeliveryEntry.cpp
+libPOS_Sensor_SRCS += VehicleSens_DeliveryCtrl.cpp
+libPOS_Sensor_SRCS += SensorLog.cpp
+
+######### add include path #############
+CPPFLAGS += -I../../include/Sensor
+CPPFLAGS += -I../../include/nsfw
+CPPFLAGS += -I../../include/ServiceInterface
+CPPFLAGS += -I../../../client/include
+
+CPPFLAGS += -I../ServiceInterface/VehicleIf
+CPPFLAGS += -I../nsfw/include
+#CPPFLAGS += -I../../../../diag_code/library/include
+
+CPPFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include/vehicle_service
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### add library path #############
+LDFLAGS +=
+
+INSTALL = install
+CREATE_DIR = $(DESTDIR)/nv/BS/vs/positioning/rwdata
+install-data:
+ $(INSTALL) -d -m 775 $(CREATE_DIR)
+
+include ../../../../vehicle_service.mk
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/SensorLog.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/SensorLog.cpp
new file mode 100755
index 0000000..eed514f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/SensorLog.cpp
@@ -0,0 +1,1307 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * SensorLog.cpp
+ * @brief
+ * Sensor Logging service functionality
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <positioning_hal.h>
+#include <unistd.h>
+#include "SensorLog.h"
+#include "Sensor_Common_API.h"
+#include <zlib.h>
+#include "POS_private.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+/* Sensor Log Type */
+typedef enum {
+ SENSLOG_TYPE_SYS_INPUT = 0, /* Sensor Log Type-SYS (INPUT) */
+ SENSLOG_TYPE_SYS_OUTPUT, /* Sensor Log Type-SYS (OUTPUT) */
+ SENSLOG_TYPE_GPS_INPUT, /* Sensor Log Type-GPS (INPUT) */
+ SENSLOG_TYPE_GPS_OUTPUT, /* Sensor Log Type-GPS (OUTPUT) */
+ SENSLOG_TYPE_NAVI_INPUT, /* Sensor Log Type-NAVI(INPUT) */
+ SENSLOG_TYPE_NAVI_OUTPUT, /* Sensor Log Type-NAVI(OUTPUT) */
+ SENSLOG_TYPE_POS_OUTPUT, /* Sensor Log Type-POS (OUTPUT) */
+ SENSLOG_TYPE_CMD_INPUT, /* Sensor Log Type-CMD (INPUT) */
+ SENSLOG_TYPE_CMD_OUTPUT, /* Sensor Log Type-CMD (OUTPUT) */
+
+ SENSLOG_TYPE_COUNT /* Sensor Log Type-Counting */
+} SENSLOG_TYPE;
+
+#define SENSLOG_VALIDFLAG_ON (1) /* Effective specific flag ON */
+#define SENSLOG_VALIDFLAG_OFF (0) /* Enable flag OFF */
+#define SENSLOG_FILEPATH_SIZE (128) /* Output path size */
+#define SENSLOG_FILENAME_SIZE (64) /* Output file name size */
+#define SENSLOG_CONFIG_TEXT_SIZE (128) /* config file size/line */
+#define SENSLOG_LEN_MIN (1) /* Record Length-Minimum */
+#define SENSLOG_LEN_MAX (900) /* Record Length-Maximum */
+#define SENSLOG_LEN_DEFAULT (300) /* Record length-default value */
+#define SENSLOG_GEN_MIN (1) /* Number of generations-minimum value */
+#define SENSLOG_GEN_MAX (999) /* Number of generations-maximum value */
+#define SENSLOG_GEN_DEFAULT (100) /* Number of generations-default value */
+#define SENSLOG_BUF_MIN (2272) /* Buffer Size-Minimum */
+#define SENSLOG_BUF_MAX (11360) /* Buffer size-maximum value */
+#define SENSLOG_BUF_DEFAULT (4544) /* Buffer size-default value */
+#define SENSLOG_OUTPUTFLAG_NEW (0) /* Output Flag-New */
+#define SENSLOG_OUTPUTFLAG_ADD (1) /* Output Flag-Add */
+#define SENSLOG_PNAME_MAX (16) /* Maximum number of characters of process name */
+
+#define SENSLOG_SEMAPHO_NAME ("SENSLOG_SEMAPHO") /* Semaphore name(MAX 32Byte) */
+
+#define SENSLOG_CONFIG_FILE_PATH_1 "/nv/BS/vs/positioning/rwdata/" /* Sensor log-Config filepath-1 */
+#define SENSLOG_CONFIG_FILE_PATH_2 "/mnt/sda1/" /* Sensor log-Config filepath-2 */
+#define SENSLOG_CONFIG_FILE_NAME_SYS "POS_sys_log.cfg" /* Sensor log-Config filename-SYS */
+#define SENSLOG_CONFIG_FILE_NAME_GPS "POS_gps_log.cfg" /* Sensor log-Config filename-GPS */
+#define SENSLOG_CONFIG_FILE_NAME_NAVI "POS_nav_log.cfg" /* Sensor log-Config filename-NAVI */
+#define SENSLOG_CONFIG_FILE_NAME_POS "POS_pos_log.cfg" /* Sensor log-Config filename-POS */
+#define SENSLOG_CONFIG_FILE_NAME_CMD "POS_cmd_log.cfg" /* Sensor log-Config filename-CMD */
+#define SENSLOG_CONFIG_KEY_LEN "POS_log_len" /* Sensor log-config file-Record length */
+#define SENSLOG_CONFIG_KEY_GEN "POS_log_gen" /* Sensor log-config file-Number of generations */
+#define SENSLOG_CONFIG_KEY_BUF "POS_log_buf" /* Sensor log-config file-Buffer size */
+#define SENSLOG_NAV_SVINFO_FILE_NAME "POS_NAV_SVINFO" /* Sensor log-NAV-SVINFOFile name(Log output when file exists)*/
+#define SENSLOG_SEQ_START ">>>>" /* Sensor log sequence(Start) */
+#define SENSLOG_SEQ_END "<<<<" /* Sensor log sequence(End) */
+#define SENSLOG_SEQ_SIZE (4) /* Sensor Log Sequence Size */
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Structure to create SensorLog data
+*/
+typedef struct {
+ uint16_t us_len; /* Number of records */
+ uint16_t uc_gen; /* Number of generations */
+} SENSLOG_GEN;
+
+/*!
+ @brief Structure to create SensorLog data
+*/
+typedef struct {
+ uint8_t uc_valid_flag; /* Output enable flag */
+ SENSLOG_GEN st_gen; /* Generation information */
+ uint16_t us_file_rec_count; /* Number of file output records */
+ uint16_t us_rec_count; /* Number of output records */
+ uint16_t us_gen_count; /* Number of generations */
+ uint8_t uc_file_path[SENSLOG_FILEPATH_SIZE]; /* Output path */
+ uint8_t uc_file_name[SENSLOG_FILENAME_SIZE]; /* Output file name */
+ uint8_t uc_gen_fname[SENSLOG_FILENAME_SIZE]; /* Generation information output file name */
+ uint8_t uc_text_buf[SENSLOG_BUF_MAX]; /* Buffering area(Static) */
+ uint32_t ul_text_buf_size; /* Buffering area size */
+ uint32_t ul_text_buf_len; /* Data size in the buffer */
+ uint8_t uc_output_flag; /* Output flag */
+ uint8_t uc_temp_buf[SENSLOG_BUF_MAX]; /* Output data temporary area */
+ uint8_t uc_positioninglog_buf[SENSLOG_BUF_MAX]; /* FRAMEWORKUNIFIEDLOG outputs */
+} SENSLOG_INFO;
+
+/*!
+ @brief Structure to get System time
+*/
+typedef struct {
+ uint16_t us_year;
+ uint16_t us_month;
+ uint16_t us_day_of_week;
+ uint16_t us_day;
+ uint16_t us_hour;
+ uint16_t us_minute;
+ uint16_t us_second;
+ uint16_t us_milli_seconds;
+} SENSLOG_SYSTEMTIME;
+
+/*!
+ @brief Structure to create SensorLog data
+*/
+typedef struct {
+ uint16_t us_data_type; /* Data type */
+ SENSLOG_SYSTEMTIME st_sys_time; /* Current time */
+ DID ul_did; /* Data ID */
+ int8_t c_pname[SENSLOG_PNAME_MAX]; /* Destination information */
+ uint8_t uc_unit_type; /* Hardware configuration type(GRADE1 / GRADE2) */
+ uint8_t uc_result; /* Send/Receive result(Success:0 / Fail:1) */
+ uint16_t us_data_size; /* Size of the data */
+} SENSLOG_DATA_HEADER;
+
+
+/*!
+ @brief Structure to create SensorLog ID table
+*/
+typedef struct {
+ uint16_t us_data_type; /* Data type */
+ DID ul_did; /* Data ID */
+ uint16_t us_file_type; /* Sensor Log Type */
+ uint16_t us_write_type; /* FRAMEWORKUNIFIEDLOG Output Type */
+} SENSLOG_ID_TBL;
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+static void SensLogGetConfig(const uint8_t*, SENSLOG_INFO*);
+static void SensLogGetConfigVal(uint8_t*, uint8_t*);
+static void SensLogCheckNAVSVINFOFile(void);
+static void SensLogWrite(uint16_t, uint16_t, uint16_t, DID did, PNO pno, uint8_t*, uint16_t, uint8_t, uint8_t, uint8_t);
+static uint16_t SensLogGetFileType(const SENSLOG_ID_TBL*, uint16_t*, uint16_t*, DID did);
+static void SensLogOutputFile(uint8_t);
+static void SensLogOutputGenFile(uint8_t);
+static void SensLogGetSystemTime(SENSLOG_SYSTEMTIME*);
+static void Num2String2Digit(uint8_t* buf, uint32_t num);
+static void Num2String3Digit(uint8_t* buf, uint32_t num);
+static void Num2String4Digit(uint8_t* buf, uint32_t num);
+static void Num2HexString(uint8_t* buf, uint8_t digits, uint32_t num);
+static void SensLogmakeHeader(uint8_t* buf, SENSLOG_DATA_HEADER data_header);
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/* Sensor log information */
+static SENSLOG_INFO g_sens_log_info[SENSLOG_TYPE_COUNT]; // NOLINT(readability/nolint)
+static uint8_t g_navsv_info_flag = FALSE;
+uint8_t g_mount_path[SENSLOG_FILEPATH_SIZE]; /* Mount path */
+UNIT_TYPE g_unit_type = UNIT_TYPE_NONE; /* HW configuration type */
+SemID g_sem_id = 0; /* Lock semaphore ID */
+
+/* Sensor log type definition table */
+const SENSLOG_ID_TBL kSensLogInputTbl[] = {
+ /* Data type DID Sensor Log Type FRAMEWORKUNIFIEDLOG Output Type */
+ {SENSLOG_DATA_I_SYS, 0, SENSLOG_TYPE_SYS_INPUT, POS_SENSLOG_TYPE_SYS },
+ {SENSLOG_DATA_I_SYS_STS, 0, SENSLOG_TYPE_SYS_INPUT, POS_SENSLOG_TYPE_SYS },
+ {SENSLOG_DATA_I_GPS, 0, SENSLOG_TYPE_GPS_INPUT, POS_SENSLOG_TYPE_GPS },
+ {SENSLOG_DATA_I_LOC, POSHAL_DID_GPS_CUSTOMDATA_NAVI, SENSLOG_TYPE_NAVI_INPUT, POS_SENSLOG_TYPE_NAV },
+ {SENSLOG_DATA_I_SPEED, VEHICLE_DID_MOTION_SPEED_NAVI, SENSLOG_TYPE_NAVI_INPUT, POS_SENSLOG_TYPE_NAV },
+ {SENSLOG_DATA_I_TIME, VEHICLE_DID_SETTINGTIME, SENSLOG_TYPE_NAVI_INPUT, POS_SENSLOG_TYPE_NAV },
+ {SENSLOG_DATA_I_TIME, POSHAL_DID_GPS_TIME, SENSLOG_TYPE_GPS_INPUT, POS_SENSLOG_TYPE_GPS },
+ {SENSLOG_DATA_I_GPSINF, 0, SENSLOG_TYPE_NAVI_INPUT, POS_SENSLOG_TYPE_NAV },
+ {SENSLOG_DATA_I_GPSRST, 0, SENSLOG_TYPE_CMD_INPUT, POS_SENSLOG_TYPE_CMD },
+ {SENSLOG_DATA_I_GPSSET, 0, SENSLOG_TYPE_CMD_INPUT, POS_SENSLOG_TYPE_CMD },
+ {SENSLOG_DATA_I_NAVSVINFO, 0, SENSLOG_TYPE_GPS_INPUT, POS_SENSLOG_TYPE_GPS },
+ {SENSLOG_DATA_I_SYS_ABNORMAL, 0, SENSLOG_TYPE_SYS_INPUT, POS_SENSLOG_TYPE_SYS },
+ {SENSLOG_DATA_I_UNSPECIFIED, 0, SENSLOG_TYPE_COUNT, POS_SENSLOG_TYPE_NONE }
+};
+
+const SENSLOG_ID_TBL kSensLogOutputTbl[] = {
+ /* Data type DID Sensor Log Type FRAMEWORKUNIFIEDLOG Output Type */
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_SPEED_PULSE, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_SPEED_KMPH, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_X, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_Y, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_Z, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_X, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_Y, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_Z, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS_ANTENNA, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_SNS_COUNTER, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_SPEED_PULSE_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_X_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_Y_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_Z_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, VEHICLE_DID_GPS__CWORD82__NMEA, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS__CWORD82___CWORD44_GP4, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS__CWORD82__FULLBINARY, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS_NMEA, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_REV, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_REV_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_TEMP, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GYRO_TEMP_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_X_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_Y_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GSNS_Z_FST, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_PULSE_TIME, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS_CLOCK_DRIFT, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS, POSHAL_DID_GPS_CLOCK_FREQ, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SYS_PKG, 0, SENSLOG_TYPE_SYS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_GPS, 0, SENSLOG_TYPE_CMD_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_LONLAT_N, VEHICLE_DID_LOCATION_LONLAT_NAVI, SENSLOG_TYPE_NAVI_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_LONLAT_G, VEHICLE_DID_LOCATION_LONLAT, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_ALT, VEHICLE_DID_LOCATION_ALTITUDE, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SPEED_N, VEHICLE_DID_MOTION_SPEED_NAVI, SENSLOG_TYPE_NAVI_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_SPEED_P, VEHICLE_DID_MOTION_SPEED_INTERNAL, SENSLOG_TYPE_POS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_HEAD_N, VEHICLE_DID_MOTION_HEADING_NAVI, SENSLOG_TYPE_NAVI_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_HEAD_G, VEHICLE_DID_MOTION_HEADING, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_TIME_SETREQ, VEHICLE_DID_SETTINGTIME, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_TIME, POSHAL_DID_GPS_TIME, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_GPSINF, VEHICLE_DID_NAVIINFO_DIAG_GPS, SENSLOG_TYPE_NAVI_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_TIME_CS, 0, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+ {SENSLOG_DATA_O_GPSRST, 0, SENSLOG_TYPE_GPS_OUTPUT, POS_SENSLOG_TYPE_NONE },
+
+ {SENSLOG_DATA_O_UNSPECIFIED, 0, SENSLOG_TYPE_COUNT, POS_SENSLOG_TYPE_NONE }
+};
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Sensor Log Initial Processing
+ *
+ * @param[in] p_mount_path Mount path
+ */
+void SensLogInitialize(uint8_t *p_mount_path) {
+ static SENSLOG_INFO st_sens_log_info; /* Coverity CID:23609 compliant */
+ uint8_t uc_hw[16]; /* HW name */
+ uint8_t ret = 0;
+ uint8_t i;
+ static uint8_t tzset_flag = 0; /* Not initialized */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ /* Not initialized */
+ if (tzset_flag == 0) {
+ tzset();
+ tzset_flag = 1; /* Initialization complete */
+ }
+
+ /* Initialization of sensor log information structure */
+ memset(&g_sens_log_info, 0, sizeof(g_sens_log_info));
+
+ /* Get mount path */
+ memset(&g_mount_path[0], 0, sizeof(g_mount_path));
+ if (NULL == p_mount_path) {
+ snprintf(reinterpret_cast<char*>(&g_mount_path[0]), sizeof(g_mount_path), SENSLOG_CONFIG_FILE_PATH_2);
+ } else {
+ snprintf(reinterpret_cast<char*>(&g_mount_path[0]), sizeof(g_mount_path), "%s/", p_mount_path);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "mount path[%s]", g_mount_path);
+
+ /* HW judgment */
+ memset(&uc_hw[0], 0, sizeof(uc_hw));
+ g_unit_type = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == g_unit_type) {
+ /* GRADE1 */
+ snprintf(reinterpret_cast<char*>(&uc_hw[0]), sizeof(uc_hw), "GRADE1");
+ } else if (UNIT_TYPE_GRADE2 == g_unit_type) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ } else {
+ /* Environment error */
+ /* Do not output sensor log */
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Environment Error.");
+ ret = 1;
+ }
+
+ /* Get Semaphore ID */
+ g_sem_id = _pb_CreateSemaphore(const_cast<char *>(SENSLOG_SEMAPHO_NAME));
+ if (g_sem_id == 0) { // LCOV_EXCL_BR_LINE 200: can not return zero
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Semaphore create Error.(ID = 0)");
+ ret = 1;
+ // LCOV_EXCL_STOP
+ }
+
+ if (ret == 0) {
+ /* Read config files */
+ /* SYS */
+ memset(&st_sens_log_info, 0, sizeof(SENSLOG_INFO));
+ SensLogGetConfig((const uint8_t*)SENSLOG_CONFIG_FILE_NAME_SYS, &st_sens_log_info);
+ if (st_sens_log_info.uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ st_sens_log_info.us_gen_count = 1;
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_SYS_INPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_SYS_OUTPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_SYS_INPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_SYS_INPUT].uc_file_name), "POS_%s_sys_i_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_SYS_OUTPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_SYS_OUTPUT].uc_file_name), "POS_%s_sys_o_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_SYS_INPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_SYS_INPUT].uc_gen_fname), "POS_%s_sys_i_gen.dat", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_SYS_OUTPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_SYS_OUTPUT].uc_gen_fname), "POS_%s_sys_o_gen.dat", uc_hw);
+ SensLogOutputGenFile(SENSLOG_TYPE_SYS_INPUT);
+ SensLogOutputGenFile(SENSLOG_TYPE_SYS_OUTPUT);
+ }
+
+ /* GPS */
+ memset(&st_sens_log_info, 0, sizeof(SENSLOG_INFO));
+ SensLogGetConfig((const uint8_t*)SENSLOG_CONFIG_FILE_NAME_GPS, &st_sens_log_info);
+ if (st_sens_log_info.uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ st_sens_log_info.us_gen_count = 1;
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_GPS_INPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_GPS_OUTPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_GPS_INPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_GPS_INPUT].uc_file_name), "POS_%s_gps_i_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_GPS_OUTPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_GPS_OUTPUT].uc_file_name), "POS_%s_gps_o_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_GPS_INPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_GPS_INPUT].uc_gen_fname), "POS_%s_gps_i_gen.dat", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_GPS_OUTPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_GPS_OUTPUT].uc_gen_fname), "POS_%s_gps_o_gen.dat", uc_hw);
+ SensLogOutputGenFile(SENSLOG_TYPE_GPS_INPUT);
+ SensLogOutputGenFile(SENSLOG_TYPE_GPS_OUTPUT);
+ }
+
+ /* NAVI */
+ memset(&st_sens_log_info, 0, sizeof(SENSLOG_INFO));
+ SensLogGetConfig((const uint8_t*)SENSLOG_CONFIG_FILE_NAME_NAVI, &st_sens_log_info);
+ if (st_sens_log_info.uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ st_sens_log_info.us_gen_count = 1;
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_NAVI_INPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_NAVI_OUTPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_NAVI_INPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_NAVI_INPUT].uc_file_name), "POS_%s_nav_i_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_NAVI_OUTPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_NAVI_OUTPUT].uc_file_name), "POS_%s_nav_o_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_NAVI_INPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_NAVI_INPUT].uc_gen_fname), "POS_%s_nav_i_gen.dat", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_NAVI_OUTPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_NAVI_OUTPUT].uc_gen_fname), "POS_%s_nav_o_gen.dat", uc_hw);
+ SensLogOutputGenFile(SENSLOG_TYPE_NAVI_INPUT);
+ SensLogOutputGenFile(SENSLOG_TYPE_NAVI_OUTPUT);
+ }
+
+ /* POS */
+ memset(&st_sens_log_info, 0, sizeof(SENSLOG_INFO));
+ SensLogGetConfig((const uint8_t*)SENSLOG_CONFIG_FILE_NAME_POS, &st_sens_log_info);
+ if (st_sens_log_info.uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ st_sens_log_info.us_gen_count = 1;
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_POS_OUTPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_POS_OUTPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_POS_OUTPUT].uc_file_name), "POS_%s_pos_o_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_POS_OUTPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_POS_OUTPUT].uc_gen_fname), "POS_%s_pos_o_gen.dat", uc_hw);
+ SensLogOutputGenFile(SENSLOG_TYPE_POS_OUTPUT);
+ }
+
+ /* CMD */
+ memset(&st_sens_log_info, 0, sizeof(SENSLOG_INFO));
+ SensLogGetConfig((const uint8_t*)SENSLOG_CONFIG_FILE_NAME_CMD, &st_sens_log_info);
+ if (st_sens_log_info.uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ st_sens_log_info.us_gen_count = 1;
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_CMD_INPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ memcpy(&g_sens_log_info[SENSLOG_TYPE_CMD_OUTPUT], &st_sens_log_info, sizeof(SENSLOG_INFO));
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_CMD_INPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_CMD_INPUT].uc_file_name), "POS_%s_cmd_i_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_CMD_OUTPUT].uc_file_name[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_CMD_OUTPUT].uc_file_name), "POS_%s_cmd_o_%%03d.log", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_CMD_INPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_CMD_INPUT].uc_gen_fname), "POS_%s_cmd_i_gen.dat", uc_hw);
+ snprintf(reinterpret_cast<char*>(&(g_sens_log_info[SENSLOG_TYPE_CMD_OUTPUT].uc_gen_fname[0])),
+ sizeof(g_sens_log_info[SENSLOG_TYPE_CMD_OUTPUT].uc_gen_fname), "POS_%s_cmd_o_gen.dat", uc_hw);
+ SensLogOutputGenFile(SENSLOG_TYPE_CMD_INPUT);
+ SensLogOutputGenFile(SENSLOG_TYPE_CMD_OUTPUT);
+ }
+
+ /* NAV-SVINFO */
+ SensLogCheckNAVSVINFOFile();
+ }
+
+ for (i = 0; i < SENSLOG_TYPE_COUNT; i++) {
+ if (g_sens_log_info[i].uc_valid_flag == SENSLOG_VALIDFLAG_ON) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].uc_valid_flag:%d", i, g_sens_log_info[i].uc_valid_flag);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].st_gen.us_len:%d", i, g_sens_log_info[i].st_gen.us_len);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].st_gen.uc_gen:%d", i, g_sens_log_info[i].st_gen.uc_gen);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].us_file_rec_count:%d", i, g_sens_log_info[i].us_file_rec_count);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].us_rec_count:%d", i, g_sens_log_info[i].us_rec_count);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].us_gen_count:%d", i, g_sens_log_info[i].us_gen_count);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].uc_file_path:%s", i, g_sens_log_info[i].uc_file_path);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].uc_file_name:%s", i, g_sens_log_info[i].uc_file_name);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].uc_gen_fname:%s", i, g_sens_log_info[i].uc_gen_fname);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "g_sens_log_info[%d].ul_text_buf_size:%d", i, g_sens_log_info[i].ul_text_buf_size);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log stop processing
+ */
+void SensLogTerminate(void) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Initialization of sensor log information structure */
+ memset(&g_sens_log_info, 0, sizeof(g_sens_log_info));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log saving process
+ */
+void SensLogStore(void) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uint8_t i;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ for (i = 0; i < SENSLOG_TYPE_COUNT; i++) {
+ /* Output buffering log */
+ if ((g_sens_log_info[i].uc_valid_flag == SENSLOG_VALIDFLAG_ON) &&
+ (g_sens_log_info[i].ul_text_buf_len > 0)) {
+ SensLogOutputFile(i);
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Sensor log config file information acquisition
+ *
+ * @param[in] uc_config_file Config filename
+ * @param[out] st_sens_log_info Sensor log information
+ */
+static void SensLogGetConfig(const uint8_t* uc_config_file, SENSLOG_INFO* st_sens_log_info) {
+ FILE* fp;
+ uint8_t uc_file_path[SENSLOG_FILEPATH_SIZE];
+ uint8_t uc_file_name[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+ uint8_t ucBuf[SENSLOG_CONFIG_TEXT_SIZE];
+ uint8_t uc_val[SENSLOG_CONFIG_TEXT_SIZE];
+ uint8_t flag = 0;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ if ((uc_config_file == NULL) || (st_sens_log_info == NULL)) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Unprocessed if the argument is invalid. */
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Parameter Error.");
+ // LCOV_EXCL_STOP
+ } else {
+ memset(&uc_file_path, 0, sizeof(uc_file_path));
+ memset(&uc_file_name, 0, sizeof(uc_file_name));
+
+ /* Refer to the config files in the built-in memory. */
+ snprintf(reinterpret_cast<char*>(&uc_file_path[0]), sizeof(uc_file_path), \
+ SENSLOG_CONFIG_FILE_PATH_1);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name), \
+ "%s%s", uc_file_path, uc_config_file);
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "r");
+ if (NULL == fp) {
+ /* If there are no config files in the built-in memory, refer to the USB memory. */
+ snprintf(reinterpret_cast<char*>(&uc_file_path[0]), sizeof(uc_file_path), \
+ "%s", (const char*)&g_mount_path[0]);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name), \
+ "%s%s", uc_file_path, uc_config_file);
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "r");
+ }
+
+ if (NULL == fp) {
+ /* Do not print when there are no config files.(Console log output)*/
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "Not SensorLog config file. [%s]", uc_file_name);
+ } else {
+ /* Read config files */
+ for (;;) {
+ if (fgets(reinterpret_cast<char*>(&ucBuf), SENSLOG_CONFIG_TEXT_SIZE, fp) == NULL) {
+ /* EOF detection(Fail-safe:Normally it does not pass because it is break at the flag judgment place.)*/
+ break;
+ }
+ memset(&uc_val, 0, sizeof(uc_val));
+ if ((strncmp(reinterpret_cast<char*>(&ucBuf), SENSLOG_CONFIG_KEY_LEN, \
+ strlen(SENSLOG_CONFIG_KEY_LEN)) == 0) && ((flag & 0x01) != 0x01)) {
+ /* Get record length */
+ SensLogGetConfigVal(ucBuf, uc_val);
+ st_sens_log_info->st_gen.us_len = static_cast<uint16_t>(atoi((const char *)uc_val));
+ flag ^= 0x01;
+ } else if ((strncmp(reinterpret_cast<char*>(&ucBuf), SENSLOG_CONFIG_KEY_GEN, \
+ strlen(SENSLOG_CONFIG_KEY_GEN)) == 0) && ((flag & 0x02) != 0x02)) {
+ /* Get number of generations */
+ SensLogGetConfigVal(ucBuf, uc_val);
+ st_sens_log_info->st_gen.uc_gen = static_cast<uint16_t>(atoi((const char *)uc_val));
+ flag ^= 0x02;
+ } else {
+ /* nop */
+ }
+
+ if (flag == 0x03) {
+ break;
+ }
+ }
+ fclose(fp);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, \
+ "SensorLog read : file[%s] : config[0x%02x]", uc_file_name, flag);
+
+ if ((st_sens_log_info->st_gen.us_len < SENSLOG_LEN_MIN) \
+ || (st_sens_log_info->st_gen.us_len > SENSLOG_LEN_MAX)) {
+ /* The default value is applied if it is outside the valid range. */
+ st_sens_log_info->st_gen.us_len = SENSLOG_LEN_DEFAULT;
+ }
+ if ((st_sens_log_info->st_gen.uc_gen < SENSLOG_GEN_MIN) \
+ || (st_sens_log_info->st_gen.uc_gen > SENSLOG_GEN_MAX)) {
+ /* The default value is applied if it is outside the valid range. */
+ st_sens_log_info->st_gen.uc_gen = SENSLOG_GEN_DEFAULT;
+ }
+ st_sens_log_info->ul_text_buf_size = SENSLOG_BUF_MAX; /* Static area(Maximum security) */
+
+ st_sens_log_info->uc_valid_flag = SENSLOG_VALIDFLAG_ON;
+ st_sens_log_info->uc_output_flag = SENSLOG_OUTPUTFLAG_NEW;
+ /* The log output path should be the same path as the config file. */
+ memcpy(st_sens_log_info->uc_file_path, uc_file_path, SENSLOG_FILEPATH_SIZE);
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log config file setting value acquisition
+ *
+ * @param[in] uc_text Config setting information
+ * @param[out] uc_val Config setting
+ */
+static void SensLogGetConfigVal(uint8_t* uc_text, uint8_t* uc_val) {
+ uint8_t ucBuf[SENSLOG_CONFIG_TEXT_SIZE];
+ uint16_t i = 0;
+ uint16_t j = 0;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ if ((uc_text == NULL) || (uc_val == NULL)) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Unprocessed if the argument is invalid. */
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Parameter Error.");
+ // LCOV_EXCL_STOP
+ } else {
+ memset(ucBuf, 0, sizeof(ucBuf));
+ while ((*uc_text != ':') && (*uc_text != '\0')) {
+ uc_text++;
+ i++;
+ if (i >= (SENSLOG_CONFIG_TEXT_SIZE - 1)) {
+ break;
+ }
+ }
+ while ((*uc_text != '\r') && (*uc_text != '\n') && (*uc_text != '\0')) {
+ uc_text++;
+ i++;
+ ucBuf[j++] = *uc_text;
+ if (i >= SENSLOG_CONFIG_TEXT_SIZE) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&ucBuf, 0, sizeof(ucBuf));
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+ memcpy(uc_val, ucBuf, sizeof(ucBuf));
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Acquisition of sensor log NAV-SVINFO file information
+ *
+ * @param[in] none
+ */
+static void SensLogCheckNAVSVINFOFile(void) {
+ FILE* fp;
+ const uint8_t* uc_config_file;
+ uint8_t uc_file_path[SENSLOG_FILEPATH_SIZE];
+ uint8_t uc_file_name[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ uc_config_file = (const uint8_t*)SENSLOG_NAV_SVINFO_FILE_NAME;
+
+ memset(&uc_file_path, 0, sizeof(uc_file_path));
+ memset(&uc_file_name, 0, sizeof(uc_file_name));
+
+ /* Refer to the config files in the built-in memory. */
+ snprintf(reinterpret_cast<char*>(&uc_file_path[0]), sizeof(uc_file_path), SENSLOG_CONFIG_FILE_PATH_1);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name), "%s%s", uc_file_path, uc_config_file);
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "r");
+ if (NULL == fp) {
+ /* If there are no config files in the built-in memory, refer to the USB memory. */
+ snprintf(reinterpret_cast<char*>(&uc_file_path[0]), sizeof(uc_file_path), \
+ "%s", (const char*)&g_mount_path[0]);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name), \
+ "%s%s", uc_file_path, uc_config_file);
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "r");
+ }
+
+ if (NULL == fp) {
+ /* Do not print when there are no config files.(Console log output)*/
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "Not SensorLog config file. [%s]", uc_file_name);
+ g_navsv_info_flag = FALSE;
+ } else {
+ fclose(fp);
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "SensorLog read : file[%s]", uc_file_name);
+ g_navsv_info_flag = TRUE;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Acquisition of sensor log NAV-SVINFO file information
+ *
+ * @param[in] none
+ *
+ * @return Destination sensor log file type
+ */
+uint8_t SensLogGetNavSvinfoFlag(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return g_navsv_info_flag;
+}
+// LCOV_EXCL_STOP
+/**
+ * @brief
+ * Sensor log output(Input information)
+ *
+ * Writes the specified log (input information) to the buffer area
+ *
+ * @param[in] us_data_type Data type
+ * @param[in] ul_did Data ID
+ * @param[in] us_pno Destination PNO
+ * @param[in] p_data Write data pointer
+ * @param[in] us_size Write data size
+ * @param[in] uc_result Reception result
+ * @param[in] u_write_flag ability to write sensor log
+ * @param[in] u_write_abnormal_flag When an error occurs ability to write sensor log
+ */
+void SensLogWriteInputData(uint16_t us_data_type, DID ul_did, PNO us_pno, uint8_t *p_data, \
+ uint16_t us_size, uint8_t uc_result, uint8_t u_write_flag, uint8_t u_write_abnormal_flag) {
+ uint16_t file_type = 0;
+ uint16_t data_type = us_data_type;
+ uint16_t write_type = POS_SENSLOG_TYPE_NONE;
+ RET_API lret_sem = RET_ERROR;
+
+ /* Sensor log file type determination */
+ file_type = SensLogGetFileType(kSensLogInputTbl, &data_type, &write_type, ul_did);
+
+ /* For the target type,Perform exclusive control */
+ /* Currently, only GPS input can be written from multiple threads. */
+ if (file_type == SENSLOG_TYPE_GPS_INPUT) {
+ /* Semaphore ID determination */
+ if (g_sem_id != 0) { // LCOV_EXCL_BR_LINE 200: can not zero
+ lret_sem = _pb_SemLock(g_sem_id); /* Semaphore Lock */
+ if (lret_sem != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not return error
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "SemLock Error.");
+ // LCOV_EXCL_STOP
+ } else {
+ /* Sensor log output */
+ SensLogWrite(file_type, data_type, write_type, ul_did, us_pno, p_data, \
+ us_size, uc_result, u_write_flag, u_write_abnormal_flag);
+ (void)_pb_SemUnlock(g_sem_id); /* Semaphore unlock */
+ }
+ }
+ } else {
+ /* Sensor log output */
+ SensLogWrite(file_type, data_type, write_type, ul_did, us_pno, p_data, us_size, \
+ uc_result, u_write_flag, u_write_abnormal_flag);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log output(Outputs the information)
+ *
+ * Writes the specified log (output information) to the buffer area
+ *
+ * @param[in] us_data_type Data type
+ * @param[in] ul_did Data ID
+ * @param[in] us_pno Destination PNO
+ * @param[in] p_data Write data pointer
+ * @param[in] us_size Write data size
+ * @param[in] uc_result Reception result
+ */
+void SensLogWriteOutputData(uint16_t us_data_type, DID ul_did, PNO us_pno, uint8_t *p_data, \
+ uint16_t us_size, uint8_t uc_result) {
+ uint16_t file_type = 0;
+ uint16_t data_type = us_data_type;
+ uint16_t write_type = POS_SENSLOG_TYPE_NONE;
+ RET_API lret_sem = RET_ERROR;
+
+ /* Sensor log file type determination */
+ file_type = SensLogGetFileType(kSensLogOutputTbl, &data_type, &write_type, ul_did);
+
+ /* For the target type,Perform exclusive control */
+ /* Currently, only GPS output can be written from multiple threads. */
+ if (file_type == SENSLOG_TYPE_GPS_OUTPUT) {
+ /* Semaphore ID determination */
+ if (g_sem_id != 0) { // LCOV_EXCL_BR_LINE 200: can not zero
+ lret_sem = _pb_SemLock(g_sem_id); /* Semaphore Lock */
+ if (lret_sem != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not return error
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "SemLock Error.");
+ // LCOV_EXCL_STOP
+ } else {
+ /* Sensor log output */
+ SensLogWrite(file_type, data_type, write_type, ul_did, us_pno, p_data, \
+ us_size, uc_result, SENSLOG_ON, SENSLOG_OFF);
+ (void)_pb_SemUnlock(g_sem_id); /* Semaphore unlock */
+ }
+ }
+ } else {
+ /* Sensor log output */
+ SensLogWrite(file_type, data_type, write_type, ul_did, us_pno, p_data, us_size, \
+ uc_result, SENSLOG_ON, SENSLOG_OFF);
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Convert number to ASCII code(For two digits,Fill up to zero)
+ *
+ * @param[out] buf Data saving
+ * @param[in] num Numbers to be converted
+ */
+static void Num2String2Digit(uint8_t* buf, uint32_t num) {
+ int8_t c;
+ if (num >= 100) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *buf++ = '0';
+ *buf = '0';
+ // LCOV_EXCL_STOP
+ } else {
+ c = static_cast<int8_t>(num / 10);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ *buf = static_cast<uint8_t>(num - (c * 10) + '0');
+ }
+}
+
+/**
+ * @brief
+ * Convert number to ASCII code(For 3 digits,Fill up to zero)
+ *
+ * @param[out] buf Data saving
+ * @param[in] num Numbers to be converted
+ */
+static void Num2String3Digit(uint8_t* buf, uint32_t num) {
+ int8_t c;
+ if (num >= 1000) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *buf++ = '0';
+ *buf++ = '0';
+ *buf = '0';
+ // LCOV_EXCL_STOP
+ } else {
+ c = static_cast<int8_t>(num / 100);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ num = num - (c * 100);
+ c = static_cast<int8_t>(num / 10);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ *buf = static_cast<uint8_t>(num - (c * 10) + '0');
+ }
+}
+
+/**
+ * @brief
+ * Convert number to ASCII code(For 4 digits,Fill up to zero)
+ *
+ * @param[out] buf Data saving
+ * @param[in] num Numbers to be converted
+ */
+static void Num2String4Digit(uint8_t* buf, uint32_t num) {
+ int8_t c;
+ if (num >= 10000) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *buf++ = '0';
+ *buf++ = '0';
+ *buf++ = '0';
+ *buf = '0';
+ // LCOV_EXCL_STOP
+ } else {
+ c = static_cast<int8_t>(num / 1000);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ num = num - (c * 1000);
+ c = static_cast<int8_t>(num / 100);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ num = num - (c * 100);
+ c = static_cast<int8_t>(num / 10);
+ *buf++ = static_cast<uint8_t>(c + '0');
+ *buf = static_cast<uint8_t>(num - (c * 10) + '0');
+ }
+}
+
+/**
+ * @brief
+ * Convert digits to hexadecimal ASCII code(Fill up to zero)
+ *
+ * @param[out] buf Data saving
+ * @param[in] Number of digits to be converted to digits
+ * @param[in] num Numbers to be converted
+ */
+static void Num2HexString(uint8_t* buf, uint8_t digits, uint32_t num) {
+ uint8_t* p = buf + digits;
+ uint8_t calc;
+ int32_t i;
+
+ /* Only within the displayable range,Convert */
+ if ((digits == 8) || (num < (uint32_t)(1 << (4 *digits)))) {
+ while (num) {
+ calc = num % 16;
+ if (10 > calc) {
+ calc = static_cast<uint8_t>(calc + 0x30); // 0x30 is 0 character
+ } else {
+ calc = static_cast<uint8_t>(calc + (0x61 - 0x0A)); // 0x41 is the letter of a
+ }
+ *(--p) = calc;
+ num /= 16;
+ digits--;
+ }
+ }
+
+ /* Insert 0 in the remaining significant digits. */
+ for (i = 0; i < digits; i++) {
+ *(--p) = '0';
+ }
+}
+
+/**
+ * @brief
+ * Sensor Log Header Creation
+ *
+ * @param[out] buf Data saving
+ * @param[in] DataHeader data headers
+ * @note For buf, Up to 62 bytes are used. As 64 bytes are allocated in the upper digit, Without current problems, dataHeader.c_pname size increase,
+ * Need to be reviewed when changing the format.
+ */
+static void SensLogmakeHeader(uint8_t* buf, SENSLOG_DATA_HEADER dataHeader) {
+ /* "%02d %04d/%02d/%02d %02d:%02d:%02d.%03d %08x %s %01x %01x %04d " */
+ int8_t *p;
+ uint16_t i = 0;
+ Num2String2Digit(buf, dataHeader.us_data_type);
+ buf += 2;
+ *(buf++) = ' ';
+ Num2String4Digit(buf, dataHeader.st_sys_time.us_year);
+ buf += 4;
+ *(buf++) = '/';
+ Num2String2Digit(buf, dataHeader.st_sys_time.us_month);
+ buf += 2;
+ *(buf++) = '/';
+ Num2String2Digit(buf, dataHeader.st_sys_time.us_day);
+ buf += 2;
+ *(buf++) = ' ';
+ Num2String2Digit(buf, dataHeader.st_sys_time.us_hour);
+ buf += 2;
+ *(buf++) = ':';
+ Num2String2Digit(buf, dataHeader.st_sys_time.us_minute);
+ buf += 2;
+ *(buf++) = ':';
+ Num2String2Digit(buf, dataHeader.st_sys_time.us_second);
+ buf += 2;
+ *(buf++) = '.';
+ Num2String3Digit(buf, dataHeader.st_sys_time.us_milli_seconds);
+ buf += 3;
+ *(buf++) = ' ';
+ Num2HexString(buf, 8, dataHeader.ul_did);
+ buf += 8;
+ *(buf++) = ' ';
+ p = dataHeader.c_pname;
+ for (i = 0; i < sizeof(dataHeader.c_pname); i++) {
+ if (*p == 0) {
+ break;
+ }
+ *(buf++) = *(p++);
+ }
+ *(buf++) = ' ';
+ Num2HexString((buf++), 1, dataHeader.uc_unit_type);
+ *(buf++) = ' ';
+ Num2HexString((buf++), 1, dataHeader.uc_result);
+ *(buf++) = ' ';
+ Num2String4Digit(buf, dataHeader.us_data_size);
+ buf += 4;
+ *(buf++) = ' ';
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log output
+ *
+ * Write specified log to buffer area(Common process)
+ *
+ * @param[in] us_file_type File type
+ * @param[in] us_data_type Data type
+ * @param[in] us_write_type FRAMEWORKUNIFIEDLOG Output Type
+ * @param[in] ul_did Data ID
+ * @param[in] us_pno Destination PNO
+ * @param[in] p_data Write data pointer
+ * @param[in] us_size Write data size
+ * @param[in] uc_result Reception result
+ * @param[in] uWriteFlag ability to write sensor log
+ * @param[in] u_write_abnormal_flag When an error occursability to write sensor log
+ */
+static void SensLogWrite(uint16_t us_file_type, uint16_t us_data_type, uint16_t us_write_type, \
+ DID ul_did, PNO us_pno, uint8_t *p_data, uint16_t us_size, uint8_t uc_result, uint8_t uWriteFlag, \
+ uint8_t u_write_abnormal_flag) {
+ uint32_t len = 0;
+ SENSLOG_DATA_HEADER dataHeader;
+ uint16_t headSize = sizeof(SENSLOG_DATA_HEADER);
+ uint16_t i = 0;
+ uint8_t workBuf[64];
+ uint16_t workBufLen = 0;
+ PCSTR pPname = NULL;
+ uint32_t ulTempBufLen;
+ uint32_t ulPositioninglogBufLen = SENSLOG_BUF_MAX;
+ uint32_t retComp;
+
+ if ((p_data == NULL) || (us_size == 0) || (us_size > SENSLOG_BUF_MIN)) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ /* Unprocessed if write specified log data is invalid */
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
+ "Parameter Error. File[%d] Data[%d] DID[%d] Size[%d]",
+ us_file_type, us_data_type, ul_did, us_size);
+ } else {
+ /* Sensor log file type determination */
+ if (us_file_type < SENSLOG_TYPE_COUNT) {
+ if ((g_sens_log_info[us_file_type].uc_valid_flag == SENSLOG_VALIDFLAG_ON) ||
+ (us_write_type != POS_SENSLOG_TYPE_NONE)) {
+ /* Setting of header information */
+ memset(&dataHeader, 0x00, sizeof(dataHeader));
+ dataHeader.us_data_type = us_data_type;
+ SensLogGetSystemTime(&dataHeader.st_sys_time);
+ dataHeader.ul_did = ul_did;
+ pPname = _pb_CnvPno2Name(us_pno);
+ if (pPname == NULL) {
+ dataHeader.c_pname[0] = '-';
+ } else {
+ snprintf(reinterpret_cast<char *>(&(dataHeader.c_pname[0])), \
+ sizeof(dataHeader.c_pname), "%s", pPname);
+ }
+ dataHeader.uc_unit_type = (uint8_t)g_unit_type;
+ dataHeader.uc_result = uc_result;
+ dataHeader.us_data_size = us_size;
+
+ /* Buffer storage(Header)*/
+ memset(&workBuf[0], 0x00, sizeof(workBuf));
+ SensLogmakeHeader(workBuf, dataHeader);
+ workBufLen = static_cast<uint16_t>(strlen(reinterpret_cast<char *>(&(workBuf[0]))));
+ memcpy(reinterpret_cast<char *>(&(g_sens_log_info[us_file_type].uc_temp_buf[0])), \
+ &workBuf[0], workBufLen);
+
+ /* Buffer storage(Data portion)*/
+ for (i = 0; i < us_size; i++) {
+ Num2HexString(&(g_sens_log_info[us_file_type].uc_temp_buf[workBufLen + i * 3]), 2, *p_data);
+ g_sens_log_info[us_file_type].uc_temp_buf[workBufLen + i * 3 + 2] = ' ';
+ g_sens_log_info[us_file_type].uc_temp_buf[workBufLen + i * 3 + 3] = 0; /* NULL */
+ p_data++;
+ }
+ g_sens_log_info[us_file_type].uc_temp_buf[workBufLen + (us_size * 3)] = '\r';
+ g_sens_log_info[us_file_type].uc_temp_buf[workBufLen + (us_size * 3) + 1] = '\n';
+ ulTempBufLen = workBufLen + (us_size * 3) + 2;
+
+ /* FRAMEWORKUNIFIEDLOG out */
+ if ((us_file_type == SENSLOG_TYPE_NAVI_INPUT) || (us_file_type == SENSLOG_TYPE_NAVI_OUTPUT)) {
+ if (g_unit_type != UNIT_TYPE_GRADE1) {
+ /* Sensor log is not output when an error occurs except for _CWORD80_ in NAV. */
+ u_write_abnormal_flag = 0;
+ }
+ }
+ if ((us_write_type != POS_SENSLOG_TYPE_NONE) && (u_write_abnormal_flag == SENSLOG_ON)) {
+ /* Data compression */
+ retComp = compress2(reinterpret_cast<Bytef*>(&(g_sens_log_info[us_file_type]. \
+ uc_positioninglog_buf[SENSLOG_SEQ_SIZE + sizeof(ulPositioninglogBufLen)])), \
+ reinterpret_cast<uLongf*>(&ulPositioninglogBufLen), \
+ reinterpret_cast<Bytef*>(&(g_sens_log_info[us_file_type].uc_temp_buf[0])), \
+ ulTempBufLen, Z_DEFAULT_COMPRESSION);
+
+ if (retComp == Z_OK) {
+ memcpy(&(g_sens_log_info[us_file_type].uc_positioninglog_buf[0]), \
+ SENSLOG_SEQ_START, SENSLOG_SEQ_SIZE);
+ memcpy(&(g_sens_log_info[us_file_type].uc_positioninglog_buf[SENSLOG_SEQ_SIZE]), \
+ &ulPositioninglogBufLen, sizeof(ulPositioninglogBufLen));
+ memcpy(&(g_sens_log_info[us_file_type].uc_positioninglog_buf[SENSLOG_SEQ_SIZE \
+ + sizeof(ulPositioninglogBufLen) + ulPositioninglogBufLen]), SENSLOG_SEQ_END, SENSLOG_SEQ_SIZE);
+ g_sens_log_info[us_file_type].uc_positioninglog_buf[SENSLOG_SEQ_SIZE + sizeof(ulPositioninglogBufLen) \
+ + ulPositioninglogBufLen + SENSLOG_SEQ_SIZE] = '\n';
+ ulPositioninglogBufLen = static_cast<uint32_t>(SENSLOG_SEQ_SIZE + sizeof(ulPositioninglogBufLen) \
+ + ulPositioninglogBufLen + SENSLOG_SEQ_SIZE + 1);
+ POS_SENSLOG(us_write_type, (PCSTR)&(g_sens_log_info[us_file_type].uc_positioninglog_buf[0]), \
+ ulPositioninglogBufLen);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, \
+ "compress error[retComp = %d]", retComp);
+ }
+ }
+
+ if ((g_sens_log_info[us_file_type].uc_valid_flag == SENSLOG_VALIDFLAG_ON) \
+ && (uWriteFlag == SENSLOG_ON)) {
+ /* For executing file output */
+ /* Buffer size determination */
+ len = g_sens_log_info[us_file_type].ul_text_buf_len;
+ if (g_sens_log_info[us_file_type].ul_text_buf_size <= (len + ((headSize + us_size) * 3))) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[%d]:DataSize[%d]/BufLen[%d]",
+ us_data_type, us_size, len);
+
+ /* In case of buffer upper limit,Write File */
+ SensLogOutputFile(static_cast<uint8_t>(us_file_type));
+
+ /* Buffer clear */
+ memset(&(g_sens_log_info[us_file_type].uc_text_buf[0]), 0x00,
+ g_sens_log_info[us_file_type].ul_text_buf_size);
+ len = 0;
+ }
+
+ /* Buffer storage */
+ memcpy(reinterpret_cast<char*>(&(g_sens_log_info[us_file_type].uc_text_buf[len])), \
+ &g_sens_log_info[us_file_type].uc_temp_buf[0], ulTempBufLen);
+ g_sens_log_info[us_file_type].ul_text_buf_len = len + ulTempBufLen;
+ g_sens_log_info[us_file_type].us_rec_count++;
+
+ /* Determining whether the number of file write records is the upper limit (the number of records per file) */
+ if (g_sens_log_info[us_file_type].st_gen.us_len <= g_sens_log_info[us_file_type].us_rec_count) {
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "[%d]:RecCnt[%d/%d]",
+ us_data_type, g_sens_log_info[us_file_type].us_rec_count, \
+ g_sens_log_info[us_file_type].st_gen.us_len);
+
+ /* In case of buffer upper limit,Write File */
+ SensLogOutputFile(static_cast<uint8_t>(us_file_type));
+
+ /* Buffer clear */
+ memset(&(g_sens_log_info[us_file_type].uc_text_buf[0]), 0x00, \
+ g_sens_log_info[us_file_type].ul_text_buf_size);
+ g_sens_log_info[us_file_type].ul_text_buf_len = 0;
+ g_sens_log_info[us_file_type].us_rec_count = 0;
+ /* Update the number of generations */
+ g_sens_log_info[us_file_type].us_gen_count++;
+ if (g_sens_log_info[us_file_type].st_gen.uc_gen < g_sens_log_info[us_file_type].us_gen_count) {
+ g_sens_log_info[us_file_type].us_gen_count = 1;
+ }
+ g_sens_log_info[us_file_type].uc_output_flag = SENSLOG_OUTPUTFLAG_NEW;
+ }
+ }
+ }
+ }
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Sensor log file type determination
+ *
+ * Determine the type of the output destination sensor log file
+ *
+ * @param[in] pstTbl Sensor log type definition table
+ * @param[in] Pus_data_type Data type
+ * @param[out] pus_write_type FRAMEWORKUNIFIEDLOG Output Type
+ * @param[in] ul_did Data ID
+ *
+ * @return Destination sensor log file type
+ */
+static uint16_t SensLogGetFileType(const SENSLOG_ID_TBL *pstTbl, uint16_t *pus_data_type, \
+ uint16_t *pus_write_type, DID ul_did) {
+ uint16_t file_type = SENSLOG_TYPE_COUNT;
+ uint16_t cnt = 0;
+
+ /* Determination of output log file type */
+ /* DID,Prioritize the beginning of the table for both data types. */
+ /* If DID is specified, it is judged by DID.*/
+ if (ul_did != 0) {
+ for (cnt = 0; pstTbl[cnt].us_file_type != SENSLOG_TYPE_COUNT; cnt++) {
+ if (pstTbl[cnt].ul_did == ul_did) {
+ *pus_data_type = pstTbl[cnt].us_data_type;
+ file_type = pstTbl[cnt].us_file_type;
+ *pus_write_type = pstTbl[cnt].us_write_type;
+ break;
+ }
+ }
+ }
+ /* If no DID is specified or cannot be found, judge according to the data type. */
+ if (file_type == SENSLOG_TYPE_COUNT) {
+ for (cnt = 0; pstTbl[cnt].us_file_type != SENSLOG_TYPE_COUNT; cnt++) {
+ if (pstTbl[cnt].us_data_type == *pus_data_type) {
+ file_type = pstTbl[cnt].us_file_type;
+ *pus_write_type = pstTbl[cnt].us_write_type;
+ break;
+ }
+ }
+ }
+ return file_type;
+}
+
+/**
+ * @brief
+ * Sensor log file output
+ *
+ * Write the log data in the buffer area to a file
+ *
+ * @param[in] ucFileType File type
+ */
+static void SensLogOutputFile(uint8_t ucFileType) {
+ FILE *fp;
+ int fd;
+ uint8_t uc_file_name_base[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+ uint8_t uc_file_name[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+
+ if (ucFileType < SENSLOG_TYPE_COUNT) { // LCOV_EXCL_BR_LINE 200: can not exceed type
+ /* File path generation */
+ snprintf(reinterpret_cast<char*>(&uc_file_name_base[0]), sizeof(uc_file_name_base),
+ "%s%s",
+ g_sens_log_info[ucFileType].uc_file_path, g_sens_log_info[ucFileType].uc_file_name);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name),
+ reinterpret_cast<char*>(&uc_file_name_base[0]),
+ g_sens_log_info[ucFileType].us_gen_count);
+
+ /* Writing to a File */
+ if (g_sens_log_info[ucFileType].uc_output_flag == SENSLOG_OUTPUTFLAG_NEW) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, \
+ "SensLog create file. : file[%s] : uc_output_flag[%d]", \
+ uc_file_name, g_sens_log_info[ucFileType].uc_output_flag);
+
+ /* Export New File(Write From Beginning)*/
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "w+");
+ g_sens_log_info[ucFileType].uc_output_flag = SENSLOG_OUTPUTFLAG_ADD;
+
+ /* Update generation information file */
+ SensLogOutputGenFile(ucFileType);
+ } else {
+ /* Append export */
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "a+");
+ }
+
+ if (NULL != fp) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ /* Log file output(ASCII)*/
+ fd = fileno(fp);
+ fwrite(&(g_sens_log_info[ucFileType].uc_text_buf[0]), g_sens_log_info[ucFileType].ul_text_buf_len, 1, fp);
+ fflush(fp); /* Flush the userspace buffers provided by the C library */
+ fdatasync(fd); /* Flush cache of files referenced by fd to disk */
+ fclose(fp); /* Coverity CID:23371 compliant */
+ } else {
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "SensLog fopen fail. : file[%s] : uc_output_flag[%d]", \
+ uc_file_name, g_sens_log_info[ucFileType].uc_output_flag);
+ // LCOV_EXCL_STOP
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Generation information file output
+ *
+ * Holds the number of generations being output in the generation information file.
+ *
+ * @param[in] ucFileType File type
+ */
+static void SensLogOutputGenFile(uint8_t ucFileType) {
+ FILE *fp;
+ int fd;
+ uint8_t uc_file_name_base[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+ uint8_t uc_file_name[SENSLOG_FILEPATH_SIZE + SENSLOG_FILENAME_SIZE];
+
+ if (ucFileType < SENSLOG_TYPE_COUNT) { // LCOV_EXCL_BR_LINE 200: can not exceed type
+ /* File path generation */
+ snprintf(reinterpret_cast<char*>(&uc_file_name_base[0]), sizeof(uc_file_name_base),
+ "%s%s",
+ g_sens_log_info[ucFileType].uc_file_path, g_sens_log_info[ucFileType].uc_gen_fname);
+ snprintf(reinterpret_cast<char*>(&uc_file_name[0]), sizeof(uc_file_name),
+ reinterpret_cast<char*>(&uc_file_name_base[0]),
+ g_sens_log_info[ucFileType].us_gen_count);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SensLog create file. : file[%s] : us_gen_count[%d]",
+ uc_file_name, g_sens_log_info[ucFileType].us_gen_count);
+
+ /* Export New File(Write From Beginning)*/
+ fp = fopen(reinterpret_cast<char*>(&uc_file_name[0]), "w+");
+ if (NULL != fp) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ /* Generation control number output */
+ fd = fileno(fp);
+ fprintf(fp, "%03d", g_sens_log_info[ucFileType].us_gen_count);
+ fflush(fp); /* Flush the userspace buffers provided by the C library */
+ fdatasync(fd); /* Flush cache of files referenced by fd to disk */
+ fclose(fp); /* Coverity CID:23372 compliant */
+ } else {
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "SensLog fopen fail. : file[%s] : us_gen_count[%d]", \
+ uc_file_name, g_sens_log_info[ucFileType].us_gen_count);
+ // LCOV_EXCL_STOP
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Get system time
+ *
+ * Get the system time(Millisecond)
+ *
+ * @param[out] st_sys_time System time
+ */
+void SensLogGetSystemTime(SENSLOG_SYSTEMTIME *st_sys_time) {
+ time_t time_sec = 0;
+ struct timespec tp = {0};
+ struct tm time_cal= {0};
+
+ if (NULL != st_sys_time) { // LCOV_EXCL_BR_LINE 200: not NULL
+ if (0 == clock_gettime(CLOCK_REALTIME, &tp)) {
+ time_sec = tp.tv_sec;
+ localtime_r(&time_sec, &time_cal);
+ st_sys_time->us_year = static_cast<uint16_t>((WORD)time_cal.tm_year + 1900);
+ st_sys_time->us_month = static_cast<uint16_t>((WORD)time_cal.tm_mon + 1);
+ st_sys_time->us_day_of_week = (WORD)time_cal.tm_wday;
+ st_sys_time->us_day = (WORD)time_cal.tm_mday;
+ st_sys_time->us_hour = (WORD)time_cal.tm_hour;
+ st_sys_time->us_minute = (WORD)time_cal.tm_min;
+ st_sys_time->us_second = (WORD)time_cal.tm_sec;
+ st_sys_time->us_milli_seconds = (WORD)(static_cast<double>(tp.tv_nsec) * 1e-6); /* Calculating milliseconds */
+ }
+ }
+ return;
+}
+
+/* end of file */
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_CanDeliveryEntry.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_CanDeliveryEntry.cpp
new file mode 100755
index 0000000..f1cd695
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_CanDeliveryEntry.cpp
@@ -0,0 +1,47 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSensCanDeliveryEntry.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :CAN data delivery registration
+ * Module configuration :VehicleSensCanDeliveryEntry() CAN data delivery registration
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DeliveryCtrl.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensCanDeliveryEntry
+* ABSTRACT : CAN data delivery registration
+* FUNCTION : Register delivery of CAN data required as vehicle sensor middleware
+* ARGUMENT : void
+* NOTE :
+* RETURN : CANIF_RET_NORMAL :Normal completion
+* CANIF_RET_ERROR_CREATE_EVENT :Event generation failure
+* CANIF_RET_ERROR_PARAM :Parameter error
+* CANIF_RET_ERROR_BUFFULL :FULL of delivery registers
+* CANIF_RET_ERROR_CANIDFULL :FULL of delivery CAN ID numbers
+******************************************************************************/
+RET_API VehicleSensCanDeliveryEntry(void) {
+ return RET_NORMAL;
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Common.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Common.cpp
new file mode 100755
index 0000000..aeb180e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Common.cpp
@@ -0,0 +1,429 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Common.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor common processing(VEHICLE_COMMON)
+ * Module configuration :VehicleSensmemcmp() Functions for Common Processing Memory Block Comparisons
+ * VehicleSensCheckDid() Common Processing Data ID Check Function
+ * VehicleSensGetDataMasterOffset() Get function for common processing data master offset value
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_Common.h"
+#include "POS_private.h"
+#include <system_service/ss_ver.h>
+#include <system_service/ss_package.h>
+#include "gps_hal.h"
+#include "VehicleSens_DataMaster.h"
+
+
+#define _pb_strcat(pdest, psrc, size) (strncat(pdest, psrc, size) , (0))
+
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static const VEHICLESENS_DID_OFFSET_TBL kGstDidList[] = {
+ /* Data ID Offset size Reserved */
+ { VEHICLE_DID_DESTINATION, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_HV, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_STEERING_WHEEL, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_VB, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_IG, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MIC, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_BACKDOOR, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_PKB, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_ADIM, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_ILL, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_RHEOSTAT, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_SYSTEMP, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_SPEED_PULSE, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_SPEED_PULSE_FLAG, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_SPEED_KMPH, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_X, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_GYRO_Y, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_GYRO_Z, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_GSNS_X, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GSNS_Y, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GSNS_Z, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_REV, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_ANTENNA, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_SNS_COUNTER, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_GPS_COUNTER, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_VERSION, VEHICLESENS_OFFSET_GPS_FORMAT, {0, 0} },
+ { VEHICLE_DID_LOCATION, VEHICLESENS_OFFSET_GPS_FORMAT, {0, 0} },
+ /* ++GPS _CWORD82_ support */
+ { POSHAL_DID_GPS__CWORD82___CWORD44_GP4, VEHICLESENS_OFFSET_GPS_FORMAT, {0, 0} },
+ { VEHICLE_DID_GPS__CWORD82__NMEA, VEHICLESENS_OFFSET_GPS_NMEA, {0, 0} },
+ { POSHAL_DID_GPS_NMEA, VEHICLESENS_OFFSET_GPS_NMEA, {0, 0} },
+ { POSHAL_DID_GPS__CWORD82__FULLBINARY, VEHICLESENS_OFFSET_GPS_FORMAT, {0, 0} },
+ /* --GPS _CWORD82_ support */
+ { VEHICLE_DID_REV_LINE, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_REV_CAN, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ { POSHAL_DID_GYRO_EXT, VEHICLESENS_OFFSET_20WORD, {0, 0} },
+ { POSHAL_DID_SPEED_PULSE_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_X_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_Y_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_Z_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_SPEED_PULSE_FLAG_FST, VEHICLESENS_OFFSET_20WORD_FST, {0, 0} },
+ { POSHAL_DID_REV_FST, VEHICLESENS_OFFSET_20WORD_FST, {0, 0} },
+#endif
+ /* ++ PastModel002 support */
+ { VEHICLE_DID_GPS_UBLOX_NAV_POSLLH, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_STATUS, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_VELNED, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_DOP, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_SVINFO, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_NAV_CLOCK, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GPS_UBLOX_MON_HW, VEHICLESENS_OFFSET_GPS_UBLOX, {0, 0} },
+ { VEHICLE_DID_GYRO_TROUBLE, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_GYRO_CONNECT_STATUS, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ /* -- PastModel002 support */
+ { POSHAL_DID_GPS_TIME, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_TIME_RAW, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_WKNROLLOVER, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_NAVIINFO_DIAG_GPS, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_TEMP, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GYRO_TEMP_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GSNS_X_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GSNS_Y_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GSNS_Z_FST, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_PULSE_TIME, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_LOCATION_LONLAT, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_LOCATION_ALTITUDE, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MOTION_SPEED, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MOTION_HEADING, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_LOCATION_LONLAT_NAVI, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_LOCATION_ALTITUDE_NAVI, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MOTION_SPEED_NAVI, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MOTION_HEADING_NAVI, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_SETTINGTIME, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { VEHICLE_DID_MOTION_SPEED_INTERNAL, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_CLOCK_DRIFT, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { POSHAL_DID_GPS_CLOCK_FREQ, VEHICLESENS_OFFSET_NORMAL, {0, 0} },
+ { 0, 0, {0, 0} } /* Termination code */
+};
+
+/*******************************************************************************
+* MODULE : VehicleSensmemcmp
+* ABSTRACT : Functions for Common Processing Memory Block Comparisons
+* FUNCTION : Memory block comparison processing
+* ARGUMENT : *vp_data1 : Comparison target address 1
+* : *vp_data2 : Comparison target address 2
+* : uc_size : Comparison Size
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* : VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensmemcmp(const void *vp_data1, const void *vp_data2, size_t uc_size) {
+ u_int8 ret = VEHICLESENS_EQ;
+ const u_int8 *ucp_data1 = (const u_int8 *)vp_data1;
+ const u_int8 *ucp_data2 = (const u_int8 *)vp_data2;
+
+ /* Loop by data size */
+ while (uc_size > 0) {
+ if (*ucp_data1 != *ucp_data2) {
+ /* Data mismatch */
+ ret = VEHICLESENS_NEQ;
+ break;
+ }
+ ucp_data1++;
+ ucp_data2++;
+ uc_size--;
+ }
+ return( ret );
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensCheckDid
+* ABSTRACT : Common Processing Data ID Check Function
+* FUNCTION : Check if the specified DID corresponds to the vehicle sensor information
+* ARGUMENT : ul_did : Data ID
+* NOTE :
+* RETURN : VEHICLESENS_INVALID :Disabled
+* : VEHICLESENS_EFFECTIVE :Enabled
+******************************************************************************/
+int32 VehicleSensCheckDid(DID ul_did) {
+ int32 i = 0;
+ int32 ret = VEHICLESENS_INVALID;
+
+ while (0 != kGstDidList[i].ul_did) { // LCOV_EXCL_BR_LINE 200: did always valid
+ if (kGstDidList[i].ul_did == ul_did) {
+ /* DID enabled */
+ ret = VEHICLESENS_EFFECTIVE;
+ break;
+ }
+ i++;
+ }
+ return( ret );
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterOffset
+* ABSTRACT : Get function for common processing data master offset value
+* FUNCTION : Get the fixed offset value for a given DID
+* ARGUMENT : ul_did : Data ID
+* NOTE :
+* RETURN : Offset value(Returns 0 if DID is invalid)
+******************************************************************************/
+u_int16 VehicleSensGetDataMasterOffset(DID ul_did) {
+ int32 i = 0; /* Generic counters */
+ u_int16 ret = 0; /* Return value of this function */
+
+ while (0 != kGstDidList[i].ul_did) { // LCOV_EXCL_BR_LINE 200: did always valid
+ if (kGstDidList[i].ul_did == ul_did) {
+ /* DID enabled */
+ ret = kGstDidList[i].us_offset;
+ break;
+ }
+ i++;
+ }
+ return( ret );
+}
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterExtOffset
+* ABSTRACT : Get function for common processing data master offset value
+* FUNCTION : Get the fixed offset value for the first package delivery of the specified DID
+* ARGUMENT : ul_did : Data ID
+* NOTE :
+* RETURN : Offset value(Returns 0 for unspecified DID)
+******************************************************************************/
+u_int16 VehicleSensGetDataMasterExtOffset(DID ul_did) {
+ u_int16 usRet = 0; /* Return value of this function */
+
+ switch (ul_did) {
+ case POSHAL_DID_GYRO_EXT:
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_Y:
+ case POSHAL_DID_GYRO_Z:
+ case POSHAL_DID_GSNS_X: /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+ case POSHAL_DID_GSNS_Y: /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+ case POSHAL_DID_GSNS_Z:
+ case POSHAL_DID_SPEED_PULSE:
+ {
+ /* Returns the extended package size (one data 2byte) at the time of initial delivery */
+ usRet = VEHICLESENS_OFFSET_10WORD_PKG_EXT;
+ break;
+ }
+ case POSHAL_DID_SNS_COUNTER:
+ case POSHAL_DID_REV:
+ {
+ /* Returns the extended package size (one data 1byte) at the time of initial delivery */
+ usRet = VEHICLESENS_OFFSET_BYTE_PKG_EXT;
+ break;
+ }
+ case POSHAL_DID_GYRO_TEMP:
+ {
+ /* Returns the extended package size (one data 2byte) at the time of initial delivery */
+ usRet = VEHICLESENS_OFFSET_WORD_PKG_EXT;
+ break;
+ }
+ case POSHAL_DID_PULSE_TIME:
+ {
+ /* Returns the expansion package size (132 bytes per data) at the time of initial delivery */
+ usRet = VEHICLESENS_OFFSET_32LONG_PKG_EXT;
+ break;
+ }
+ default: /* Other than the above */ /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+ return( usRet );
+}
+#endif
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+
+/**
+ * @brief
+ * GPS version information setting request
+ *
+ * Request to set GPS version information to SS
+ *
+ * @param[in] pstData Pointer to received message data
+ */
+void VehicleSensSetGpsVersion(const SENSOR_MSG_GPSDATA_DAT *pstData) {
+ static BOOL isExistGpsVersion = FALSE;
+ SSVER_PkgInfo info;
+ CSSVer cssVer;
+ UNIT_TYPE eType = UNIT_TYPE_NONE; /* Supported HW Configuration Type */
+ EFrameworkunifiedStatus ret;
+
+ if (isExistGpsVersion == FALSE) {
+ memset(&info, 0x00, sizeof(info));
+ /* Supported HW Configuration Check */
+ eType = GetEnvSupportInfo();
+ if (UNIT_TYPE_GRADE1 == eType) { // LCOV_EXCL_BR_LINE 6:cannot be this env
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* GRADE1 */
+ memcpy(info.version, pstData->uc_data, sizeof(info.version));
+
+ /* Calling setPkgInfo() */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "--- VehicleUtility_SetGpsVersion setPkgInfo -->");
+ ret = cssVer.setPkgInfo(SS_PKG_NAVI_GPS, info);
+ if (ret == eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "--- VehicleUtility_SetGpsVersion setPkgInfo <-- GPSVersion = %s", info.version);
+ isExistGpsVersion = TRUE; /* Update Flag */
+ } else {
+ /* Error log */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Failed to set PkgInfo EpositioningStatus = %d", ret);
+ }
+ // LCOV_EXCL_STOP
+ } else if ( UNIT_TYPE_GRADE2 == eType ) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ } else {
+ /* nop */
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+* Acquisition of location and time information (dump)
+ *
+ * @param[out] pBuf Dump information
+ * @param[in] Uc_get_method Retrieval method
+ */
+void VehicleSensGetDebugPosDate(void* pBuf, u_int8 uc_get_method) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[256];
+ VEHICLESENS_DATA_MASTER stSnsData;
+ SENSORLOCATION_LONLATINFO_DAT *pstLonLat;
+ SENSORLOCATION_ALTITUDEINFO_DAT *pstAltitude;
+ SENSORMOTION_HEADINGINFO_DAT *pstHeading;
+ SENSOR_MSG_GPSDATA_DAT stGpsData;
+ SENSOR_MSG_GPSTIME *pstDateTimeGps;
+ NAVIINFO_DIAG_GPS *pstDiagGps;
+ uint8_t i;
+
+ memset(&buf, 0x00, sizeof(buf));
+ /* Title */
+ switch ( uc_get_method ) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ snprintf(reinterpret_cast<char *>(&buf), sizeof(buf), "GPS Info");
+ break;
+ case VEHICLESENS_GETMETHOD_NAVI:
+ snprintf(reinterpret_cast<char *>(&buf), sizeof(buf), "Navi Info");
+ break;
+ default:
+ /* nop */
+ break;
+ }
+
+ /* Latitude,Longitude */
+ VehicleSensGetLocationLonLat(&stSnsData, uc_get_method);
+ pstLonLat = reinterpret_cast<SENSORLOCATION_LONLATINFO_DAT*>(stSnsData.uc_data);
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf( reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [LonLat] sync:%3d, Enable:%01d, Lon:%10d, Lat:%10d, PosSts:0x%02x, PosAcc:0x%04x",
+ pstLonLat->SyncCnt,
+ pstLonLat->isEnable,
+ pstLonLat->Longitude,
+ pstLonLat->Latitude,
+ pstLonLat->posSts,
+ pstLonLat->posAcc);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+
+ /* Altitude */
+ VehicleSensGetLocationAltitude(&stSnsData, uc_get_method);
+ pstAltitude = reinterpret_cast<SENSORLOCATION_ALTITUDEINFO_DAT*>(stSnsData.uc_data);
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [Alt] sync:%3d, Enable:%01d, Alt:%10d",
+ pstAltitude->SyncCnt,
+ pstAltitude->isEnable,
+ pstAltitude->Altitude);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+
+ /* Orientation */
+ VehicleSensGetMotionHeading(&stSnsData, uc_get_method);
+ pstHeading = reinterpret_cast<SENSORMOTION_HEADINGINFO_DAT*>(stSnsData.uc_data);
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [Head] sync:%3d, Enable:%01d, Head:%5d, PosSts:0x%02x",
+ pstHeading->SyncCnt,
+ pstHeading->isEnable,
+ pstHeading->Heading,
+ pstHeading->posSts);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+
+ switch ( uc_get_method ) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ /* Satellite information */
+ VehicleSensGetNaviinfoDiagGPSg(&stGpsData);
+ pstDiagGps = reinterpret_cast<NAVIINFO_DIAG_GPS*>(stGpsData.uc_data);
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [Diag]\n FixSts:0x%02x",
+ pstDiagGps->stFix.ucFixSts);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ for (i = 0; i < 12; i++) {
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] RcvSts:0x%02x, prn:0x%02x, elv:0x%02x, Lv:0x%02x, azm:0x%04x",
+ i,
+ pstDiagGps->stSat.stPrn[i].ucRcvSts,
+ pstDiagGps->stSat.stPrn[i].ucPrn,
+ pstDiagGps->stSat.stPrn[i].ucelv,
+ pstDiagGps->stSat.stPrn[i].ucLv,
+ pstDiagGps->stSat.stPrn[i].usAzm);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ }
+
+ /* Time */
+ VehicleSensGetGpsTime(&stGpsData, VEHICLESENS_GETMETHOD_GPS);
+ pstDateTimeGps = reinterpret_cast<SENSOR_MSG_GPSTIME*>(stGpsData.uc_data);
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [Time] %04d/%02d/%02d %02d:%02d:%02d, sts:%d",
+ pstDateTimeGps->utc.year,
+ pstDateTimeGps->utc.month,
+ pstDateTimeGps->utc.date,
+ pstDateTimeGps->utc.hour,
+ pstDateTimeGps->utc.minute,
+ pstDateTimeGps->utc.second,
+ pstDateTimeGps->tdsts);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ break;
+ case VEHICLESENS_GETMETHOD_NAVI:
+ /* nop */
+ break;
+ default:
+ /* nop */
+ break;
+ }
+ memcpy(pBuf, &buf[0], sizeof(buf));
+ return;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_DataMasterMain.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_DataMasterMain.cpp
new file mode 100755
index 0000000..7bf40d1
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_DataMasterMain.cpp
@@ -0,0 +1,1880 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_DataMasterMain.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master
+ * Module configuration :VehicleSensInitDataMaster() Vehicle data master initialization function
+ * :VehicleSensSetDataMasterCan() Vehicle sensor data master CAN data set processing
+ * :VehicleSensSetDataMasterLineSens() Vehicle sensor data master LineSensor data set process
+ * :VehicleSensSetDataMasterGps() Vehicle Sensor Data Master GPS Data Set Processing
+ * :VehicleSensGetDataMaster() Vehicle Sensor Data Master Get Processing
+ * :VehicleSensGetGpsDataMaster() Vehicle Sensor Data Master GPS Data Get Processing
+ * :VehicleSensGetGps_CWORD82_NmeaSensorCnt() Vehicle sensor GPS_sensor counter GET function
+ * :VehicleSensSetDataMaster_CWORD82_() Vehicle sensor data master GPS data (_CWORD82_) set processing
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "gps_hal.h"
+#include "POS_private.h"
+#include "DeadReckoning_main.h"
+#include "VehicleSens_DeliveryCtrl.h"
+#include "Vehicle_API.h"
+#include "CommonDefine.h"
+#include <vehicle_service/POS_common_API.h>
+#include "SensorMotion_API.h"
+#include "SensorLog.h"
+#include "ClockIf.h"
+#include "DiagSrvIf.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+VEHICLESENS_PKG_DELIVERY_TEMP_EXT gstPkgTempExt; // NOLINT(readability/nolint)
+#endif
+
+#define DR_DEBUG 0
+#define GPS_DEBUG 0
+
+/*************************************************/
+/* Function prototype */
+/*************************************************/
+static uint8_t VehicleSensGetSensorCnt(void);
+
+
+/*******************************************************************************
+* MODULE : VehicleSensInitDataMaster
+* ABSTRACT : Vehicle sensor data master initialization
+* FUNCTION : Initializing Vehicle Sensor Data Master
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitDataMaster(void) {
+ /* Vehicle sensor data master initialization */
+
+ VehicleSensInitSpeedPulsel();
+ VehicleSensInitSpeedKmphl();
+ VehicleSensInitGyroXl();
+ VehicleSensInitGyroYl();
+ VehicleSensInitGyroZl();
+ VehicleSensInitGsnsXl();
+ VehicleSensInitGsnsYl();
+ VehicleSensInitGsnsZl();
+ VehicleSensInitRevl();
+ VehicleSensInitGpsAntennal();
+ VehicleSensInitSnsCounterl();
+ VehicleSensInitGpsCounterg();
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ VehicleSensInitGyroRevl();
+ VehicleSensInitSnsCounterExtl();
+ VehicleSensInitGyroExtl();
+ VehicleSensInitGyroYExtl();
+ VehicleSensInitGyroZExtl();
+ VehicleSensInitSpeedPulseExtl();
+ VehicleSensInitRevExtl();
+ VehicleSensInitGsnsXExtl();
+ VehicleSensInitGsnsYExtl();
+ VehicleSensInitGsnsZExtl();
+ VehicleSensInitGsnsXFstl();
+ VehicleSensInitGsnsYFstl();
+ VehicleSensInitGsnsZFstl();
+ VehicleSensInitGyroXFstl();
+ VehicleSensInitGyroYFstl();
+ VehicleSensInitGyroZFstl();
+ VehicleSensInitSpeedPulseFstl();
+ VehicleSensInitSpeedPulseFlagFstl();
+ VehicleSensInitRevFstl();
+#endif
+ /* ++ GPS _CWORD82_ support */
+ VehicleSensInitGps_CWORD82_FullBinaryG();
+ VehicleSensInitGps_CWORD82_NmeaG();
+ VehicleSensInitGps_CWORD82__CWORD44_Gp4G();
+ VehicleSensInitGpsNmeaG();
+ /* -- GPS _CWORD82_ support */
+
+ /* ++ PastModel002 support */
+ VehicleSensInitNavVelnedG();
+ VehicleSensInitNavTimeUtcG();
+ VehicleSensInitNavTimeGpsG();
+ VehicleSensInitNavSvInfoG();
+ VehicleSensInitNavStatusG();
+ VehicleSensInitNavPosllhG();
+ VehicleSensInitNavClockG();
+ VehicleSensInitNavDopG();
+ VehicleSensInitMonHwG();
+
+ VehicleSensInitSpeedPulseFlag();
+ VehicleSensInitGpsInterruptFlag();
+
+ VehicleSensInitGyroTrouble();
+ VehicleSensInitMainGpsInterruptSignal();
+ VehicleSensInitSysGpsInterruptSignal();
+ VehicleSensInitGyroConnectStatus();
+ VehicleSensInitGpsAntennaStatus();
+ /* -- PastModel002 support */
+
+ VehicleSensInitGyroTempFstl();
+ VehicleSensInitGyroTempExtl();
+ VehicleSensInitGyroTempl();
+ VehicleSensInitPulseTimeExtl();
+ VehicleSensInitPulseTimel();
+
+ VehicleSensInitLocationLonLatG();
+ VehicleSensInitLocationAltitudeG();
+ VehicleSensInitMotionSpeedG();
+ VehicleSensInitMotionHeadingG();
+ VehicleSensInitNaviinfoDiagGPSg();
+ VehicleSensInitGpsTimeG();
+ VehicleSensInitGpsTimeRawG();
+ VehicleSensInitWknRolloverG();
+ VehicleSensInitLocationLonLatN();
+ VehicleSensInitLocationAltitudeN();
+ VehicleSensInitMotionSpeedN();
+ VehicleSensInitMotionHeadingN();
+ VehicleSensInitSettingTimeclock();
+ VehicleSensInitMotionSpeedI();
+ VehicleSensInitGpsClockDriftG();
+ VehicleSensInitGpsClockFreqG();
+
+ VehicleSens_InitLocationInfoNmea_n();
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterLineSens
+* ABSTRACT : Vehicle sensor data master LineSensor data set process
+* FUNCTION : Set LineSensor data
+* ARGUMENT : *pst_data : LineSensor Vehicle Signal Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterLineSens(const LSDRV_LSDATA *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n,
+ BOOL b_sens_ext) {
+ u_int8 uc_chg_type;
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pst_data->ul_did) {
+ case POSHAL_DID_SPEED_PULSE:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulsel(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+
+ break;
+ }
+// case POSHAL_DID_GYRO_X:
+// {
+// uc_chg_type = VehicleSensSetGyroXl(pst_data);
+// (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+// break;
+// }
+ case POSHAL_DID_GYRO_Y:
+ {
+ uc_chg_type = VehicleSensSetGyroYl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z:
+ {
+ uc_chg_type = VehicleSensSetGyroZl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_REV:
+ {
+ uc_chg_type = VehicleSensSetRevl(pst_data);
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_REV \r\n");
+#endif
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* -- PastModel002 support DR */
+ break;
+ }
+ case POSHAL_DID_GPS_ANTENNA:
+ {
+ uc_chg_type = VehicleSensSetGpsAntennal(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_EXT: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ uc_chg_type = VehicleSensSetGyroRevl(pst_data);
+// if (b_sens_ext == TRUE) {
+// VehicleSensSetGyroExtl(pst_data);
+// }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterLineSensG
+* ABSTRACT : Vehicle sensor data master LineSensor data set process
+* FUNCTION : Set LineSensor data
+* ARGUMENT : *pst_data : LineSensor Vehicle Signal Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterLineSensG(const LSDRV_LSDATA_G *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n,
+ BOOL b_sens_ext) {
+ u_int8 uc_chg_type;
+ SENSORMOTION_SPEEDINFO_DAT stSpeed;
+ const VEHICLESENS_DATA_MASTER* pst_master;
+ u_int16 usSP_KMPH = 0; /* Vehicle speed(km/h) */
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pst_data->ul_did) {
+ case POSHAL_DID_SPEED_PULSE:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulselG(pst_data);
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_SPEED_PULSE \r\n");
+#endif
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetSpeedPulseExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* -- PastModel002 support DR */
+ break;
+ }
+ case POSHAL_DID_SPEED_KMPH:
+ {
+ uc_chg_type = VehicleSensSetSpeedKmphlG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+
+ /* Set the data master of Motion Seepd (Internal) */
+ pst_master = (const VEHICLESENS_DATA_MASTER*)pst_data;
+ memset(&stSpeed, 0x00, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+ /* When the notified size is ""0"",The vehicle speed cannot be calculated with the line sensor. */
+ if (pst_master->us_size == 0) {
+ stSpeed.isEnable = FALSE;
+ } else {
+ stSpeed.isEnable = TRUE;
+ memcpy(&usSP_KMPH, pst_master->uc_data, sizeof(u_int16));
+ }
+ stSpeed.getMethod = SENSOR_GET_METHOD_POS;
+ /* Unit conversion [0.01km/h] -> [0.01m/s] */
+ stSpeed.Speed = static_cast<uint16_t>((1000 * usSP_KMPH) / 3600);
+
+ uc_chg_type = VehicleSensSetMotionSpeedI(&stSpeed);
+ (*p_data_master_set_n)(VEHICLE_DID_MOTION_SPEED_INTERNAL, uc_chg_type, VEHICLESENS_GETMETHOD_INTERNAL);
+ break;
+ }
+// case POSHAL_DID_GYRO_X:
+// {
+// uc_chg_type = VehicleSensSetGyroXlG(pst_data);
+//#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+// FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_GYRO_X \r\n");
+//#endif
+// (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+// /* ++ PastModel002 support DR */
+// VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+// /* -- PastModel002 support DR */
+// break;
+// }
+ case POSHAL_DID_GYRO_Y:
+ {
+ uc_chg_type = VehicleSensSetGyroYlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGyroYExtlG(pst_data);
+ }
+#if (DR_DEBUG == 1)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_GYRO_Y \r\n");
+#endif
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z:
+ {
+ uc_chg_type = VehicleSensSetGyroZlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGyroZExtlG(pst_data);
+ }
+#if (DR_DEBUG == 1)
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_GYRO_Z \r\n");
+#endif
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_SNS_COUNTER:
+ {
+#if (DR_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster POSHAL_DID_SNS_COUNTER \r\n");
+#endif
+ uc_chg_type = VehicleSensSetSnsCounterlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetSnsCounterExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* -- PastModel002 support DR */
+ break;
+ }
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_EXT: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ uc_chg_type = VehicleSensSetGyroRevlG(pst_data);
+
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGyroExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+
+ break;
+ }
+
+ case POSHAL_DID_SPEED_PULSE_FLAG:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulseFlag((const LSDRV_LSDATA_G *)pst_data);
+
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ /* -- PastModel002 support DR */
+
+ break;
+ }
+ case POSHAL_DID_GPS_INTERRUPT_FLAG:
+ {
+ uc_chg_type = VehicleSensSetGpsInterruptFlag((const LSDRV_LSDATA_G *)pst_data);
+
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+
+ break;
+ }
+ case POSHAL_DID_REV:
+ {
+ uc_chg_type = VehicleSensSetRevlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetRevExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_TEMP:
+ {
+ uc_chg_type = VehicleSensSetGyroTemplG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGyroTempExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GSNS_X:
+ {
+ uc_chg_type = VehicleSensSetGsnsXlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGsnsXExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GSNS_Y:
+ {
+ uc_chg_type = VehicleSensSetGsnsYlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGsnsYExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GSNS_Z:
+ {
+ uc_chg_type = VehicleSensSetGsnsZlG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetGsnsZExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_PULSE_TIME:
+ {
+ uc_chg_type = VehicleSensSetPulseTimelG(pst_data);
+ if (b_sens_ext == TRUE) {
+ VehicleSensSetPulseTimeExtlG(pst_data);
+ }
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterLineSensFst
+* ABSTRACT : Vehicle sensor data master LineSensor data set process
+* FUNCTION : Set LineSensor data
+* ARGUMENT : *pst_data : LineSensor Vehicle Signal Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterLineSensFst(const LSDRV_LSDATA_FST *pst_data, PFUNC_DMASTER_SET_N p_data_master_set_n) { // LCOV_EXCL_START 8: dead code // // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pst_data->ul_did) {
+ case POSHAL_DID_GYRO_X_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ uc_chg_type = VehicleSensSetGyroXFstl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_Y_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ uc_chg_type = VehicleSensSetGyroYFstl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ uc_chg_type = VehicleSensSetGyroZFstl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FST:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulseFstl(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ break;
+ }
+ default:
+ break;
+ }
+}
+// LCOV_EXCL_STOP
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterLineSensFstG
+* ABSTRACT : Vehicle sensor data master LineSensor data set process
+* FUNCTION : Set LineSensor data
+* ARGUMENT : *pst_data : LineSensor Vehicle Signal Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterLineSensFstG(const LSDRV_MSG_LSDATA_DAT_FST *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n) {
+ u_int8 uc_chg_type;
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pst_data->st_gyro_x.ul_did) {
+ case POSHAL_DID_GYRO_X_FST:
+ {
+ uc_chg_type = VehicleSensSetGyroXFstG(&(pst_data->st_gyro_x));
+ if (pst_data->st_gyro_x.uc_partition_max == pst_data->st_gyro_x.uc_partition_num)
+ {
+ (*p_data_master_set_n)(pst_data->st_gyro_x.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gyro_y.ul_did) {
+ case POSHAL_DID_GYRO_Y_FST:
+ {
+ uc_chg_type = VehicleSensSetGyroYFstG(&(pst_data->st_gyro_y));
+ if (pst_data->st_gyro_y.uc_partition_max == pst_data->st_gyro_y.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gyro_y.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gyro_z.ul_did) {
+ case POSHAL_DID_GYRO_Z_FST:
+ {
+ uc_chg_type = VehicleSensSetGyroZFstG(&(pst_data->st_gyro_z));
+ if (pst_data->st_gyro_z.uc_partition_max == pst_data->st_gyro_z.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gyro_z.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_speed.ul_did) {
+ case POSHAL_DID_SPEED_PULSE_FST:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulseFstG(&(pst_data->st_speed));
+ if (pst_data->st_speed.uc_partition_max == pst_data->st_speed.uc_partition_num)
+ {
+ (*p_data_master_set_n)(pst_data->st_speed.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_spd_pulse_flg.ul_did) {
+ case POSHAL_DID_SPEED_PULSE_FLAG_FST:
+ {
+ uc_chg_type = VehicleSensSetSpeedPulseFlagFstG(&(pst_data->st_spd_pulse_flg));
+ if (pst_data->st_spd_pulse_flg.uc_partition_max == pst_data->st_spd_pulse_flg.uc_partition_num)
+ {
+ (*p_data_master_set_n)(pst_data->st_spd_pulse_flg.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_rev.ul_did) {
+ case POSHAL_DID_REV_FST:
+ {
+ uc_chg_type = VehicleSensSetRevFstG(&(pst_data->st_rev));
+ if (pst_data->st_rev.uc_partition_max == pst_data->st_rev.uc_partition_num)
+ {
+ (*p_data_master_set_n)(pst_data->st_rev.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gyro_temp.ul_did) {
+ case POSHAL_DID_GYRO_TEMP_FST:
+ {
+ uc_chg_type = VehicleSensSetGyroTempFstG(&(pst_data->st_gyro_temp));
+
+ if (pst_data->st_gyro_temp.uc_partition_max == pst_data->st_gyro_temp.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gyro_temp.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gsns_x.ul_did) {
+ case POSHAL_DID_GSNS_X_FST:
+ {
+ uc_chg_type = VehicleSensSetGsnsXFstG(&(pst_data->st_gsns_x));
+
+ if (pst_data->st_gsns_x.uc_partition_max == pst_data->st_gsns_x.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gsns_x.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gsns_y.ul_did) {
+ case POSHAL_DID_GSNS_Y_FST:
+ {
+ uc_chg_type = VehicleSensSetGsnsYFstG(&(pst_data->st_gsns_y));
+
+ if (pst_data->st_gsns_y.uc_partition_max == pst_data->st_gsns_y.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gsns_y.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (pst_data->st_gsns_z.ul_did) {
+ case POSHAL_DID_GSNS_Z_FST:
+ {
+ uc_chg_type = VehicleSensSetGsnsZFstG(&(pst_data->st_gsns_z));
+
+ if (pst_data->st_gsns_z.uc_partition_max == pst_data->st_gsns_z.uc_partition_num) {
+ (*p_data_master_set_n)(pst_data->st_gsns_z.ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterGps
+* ABSTRACT : Vehicle Sensor Data Master GPS Data Set Processing
+* FUNCTION : Set GPS data
+* ARGUMENT : *pst_data : GPS received message data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterGps(SENSOR_MSG_GPSDATA_DAT *pst_data,
+ PFUNC_DMASTER_SET_N p_data_master_set_n) {
+ u_int8 uc_chg_type;
+ SENSORLOCATION_LONLATINFO_DAT lstLonLat;
+ SENSORLOCATION_ALTITUDEINFO_DAT lstAltitude;
+ SENSORMOTION_HEADINGINFO_DAT lstHeading;
+ MDEV_GPS_CUSTOMDATA *pstCustomData;
+
+ VEHICLESENS_DATA_MASTER st_data;
+ u_int8 antennaState = 0;
+ u_int8 sensCount = 0;
+ u_int8 ucResult = SENSLOG_RES_SUCCESS;
+
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ BOOL bIsAvailable;
+ PNO us_pno;
+
+ /* Antenna Connection Information */
+ (void)memset(reinterpret_cast<void *>(&st_data), 0, sizeof(st_data));
+ VehicleSensGetGpsAntennal(&st_data);
+ antennaState = st_data.uc_data[0];
+
+ /* Sensor Counter */
+ (void)memset(reinterpret_cast<void *>(&st_data), 0, sizeof(st_data));
+ VehicleSensGetSnsCounterl(&st_data);
+ /** Sensor Counter Value Calculation */
+ /** Subtract sensor counter according to data amount from sensor counter.(Rounded off) */
+ /** Communication speed9600bps = 1200byte/s,Sensor counter is 1 count at 100ms. */
+ sensCount = st_data.uc_data[0];
+
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "antennaState = %d, sensCount = %d", antennaState, sensCount);
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pst_data->ul_did) { // LCOV_EXCL_BR_LINE 6:some DID is not used
+ case VEHICLE_DID_GPS_UBLOX_NAV_VELNED:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_VELNED \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavVelnedG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavTimeUtcG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavTimeGpsG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_SVINFO:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_SVINFO \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavSvInfoG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_STATUS:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_STATUS \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavStatusG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_POSLLH:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_POSLLH \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavPosllhG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_CLOCK:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_CLOCK \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavClockG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_DOP:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_NAV_DOP \r\n");
+#endif
+ uc_chg_type = VehicleSensSetNavDopG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* ++ PastModel002 support DR */
+ VehicleSensDeliveryProcDR(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ /* -- PastModel002 support DR */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_MON_HW:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if (GPS_DEBUG == 1) /* PastModel002_DR_VEHICLE */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VehicleSens_SetDataMaster VEHICLE_DID_GPS_UBLOX_MON_HW \r\n");
+#endif
+ uc_chg_type = VehicleSensSetMonHwG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_COUNTER:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uc_chg_type = VehicleSensSetGpsCounterg(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ /* GPS raw data(_CWORD82_ NMEA) */
+ case VEHICLE_DID_GPS__CWORD82__NMEA:
+ {
+ /* NMEA data */
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSens_GpsDataDelivery VEHICLE_DID_GPS__CWORD82__NMEA -->");
+
+ /* Insert Antenna Connection Status and Sensor Counter */
+ pst_data->uc_data[1] = antennaState; /* Insert Antennas into 2byte Eyes */
+ /* Place counters at 3byte */
+ pst_data->uc_data[2] = static_cast<u_int8>(sensCount - (u_int8)(((GPS_NMEA_SZ * 10) / 1200) + 1));
+
+ uc_chg_type = VehicleSensSetGps_CWORD82_NmeaG(pst_data); /* Ignore->MISRA-C++:2008 Rule 5-2-5 */
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSens_GpsDataDelivery VEHICLE_DID_GPS__CWORD82__NMEA <--");
+ break;
+ }
+ /* GPS raw data(FullBinary) */
+ case POSHAL_DID_GPS__CWORD82__FULLBINARY:
+ {
+ /* FullBin data */
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSens_GpsDataDelivery POSHAL_DID_GPS__CWORD82__FULLBINARY -->");
+
+ /* Insert Antenna Connection Status and Sensor Counter */
+ pst_data->uc_data[0] = antennaState; /* Insert Antennas into 1byte Eyes */
+ /* Place counters at 2byte */
+ pst_data->uc_data[1] = static_cast<u_int8>(sensCount - (u_int8)(((GPS_CMD_FULLBIN_SZ * 10) / 1200) + 1));
+
+ uc_chg_type = VehicleSensSetGps_CWORD82_FullBinaryG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSens_GpsDataDelivery POSHAL_DID_GPS__CWORD82__FULLBINARY <--");
+ break;
+ }
+ /* GPS raw data(Specific information) */
+ case POSHAL_DID_GPS__CWORD82___CWORD44_GP4:
+ {
+ /* GPS-specific information */
+ uc_chg_type = VehicleSensSetGps_CWORD82__CWORD44_Gp4G(pst_data); /* Ignore->MISRA-C++:2008 Rule 5-2-5 */
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+ case POSHAL_DID_GPS_CUSTOMDATA:
+ {
+ pstCustomData = reinterpret_cast<MDEV_GPS_CUSTOMDATA*>(pst_data->uc_data);
+ /* Latitude/LongitudeInformation */
+ (void)memcpy(&lstLonLat, &(pstCustomData->st_lonlat), sizeof(SENSORLOCATION_LONLATINFO_DAT));
+ lstLonLat.SyncCnt = VehicleSensGetSensorCnt(); /* Synchronization counter setting */
+ uc_chg_type = VehicleSensSetLocationLonLatG(&lstLonLat);
+ (*p_data_master_set_n)(VEHICLE_DID_LOCATION_LONLAT, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+
+ /* Altitude information */
+ (void)memcpy(&lstAltitude, &(pstCustomData->st_altitude), sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+ lstAltitude.SyncCnt = VehicleSensGetSensorCnt(); /* Synchronization counter setting */
+ uc_chg_type = VehicleSensSetLocationAltitudeG(&lstAltitude);
+ (*p_data_master_set_n)(VEHICLE_DID_LOCATION_ALTITUDE, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+
+ /* Bearing information */
+ (void)memcpy(&lstHeading, &(pstCustomData->st_heading), sizeof(SENSORMOTION_HEADINGINFO_DAT));
+ lstHeading.SyncCnt = VehicleSensGetSensorCnt(); /* Synchronization counter setting */
+ uc_chg_type = VehicleSensSetMotionHeadingG(&lstHeading);
+ (*p_data_master_set_n)(VEHICLE_DID_MOTION_HEADING, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+
+ /* GPS time information */
+ uc_chg_type = VehicleSensSetGpsTimeG(&(pstCustomData->st_gps_time));
+ (*p_data_master_set_n)(POSHAL_DID_GPS_TIME, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+
+ /* Set GPS time to CLOCK */
+ eStatus = ClockIfDtimeSetGpsTime(&(pstCustomData->st_gps_time), &bIsAvailable);
+ if ((bIsAvailable == TRUE) && (eStatus != eFrameworkunifiedStatusOK)) {
+ ucResult = SENSLOG_RES_FAIL;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ClockIfDtimeSetGpsTime ERROR!! [ret=%d, y=%d, m=%d, d=%d, h=%d, n=%d, s=%d, sts=%d]",
+ eStatus, pstCustomData->st_gps_time.utc.year, pstCustomData->st_gps_time.utc.month,
+ pstCustomData->st_gps_time.utc.date,
+ pstCustomData->st_gps_time.utc.hour, pstCustomData->st_gps_time.utc.minute,
+ pstCustomData->st_gps_time.utc.second, pstCustomData->st_gps_time.tdsts);
+ }
+ us_pno = _pb_CnvName2Pno(SENSLOG_PNAME_CLOCK);
+ SensLogWriteOutputData(SENSLOG_DATA_O_TIME_CS, 0, us_pno,
+ reinterpret_cast<uint8_t *>(&(pstCustomData->st_gps_time)),
+ sizeof(pstCustomData->st_gps_time), ucResult);
+
+ /* Diag Info */
+ uc_chg_type = VehicleSensSetNaviinfoDiagGPSg(&(pstCustomData->st_diag_gps));
+ (*p_data_master_set_n)(VEHICLE_DID_NAVIINFO_DIAG_GPS, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+ /* GPS raw data(NMEA except _CWORD82_) */
+ case POSHAL_DID_GPS_NMEA:
+ {
+ /* NMEA data */
+ uc_chg_type = VehicleSensSetGpsNmeaG(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+ /* GPS version(except _CWORD82_) */
+ case POSHAL_DID_GPS_VERSION:
+ {
+ VehicleSensSetGpsVersion(pst_data);
+ break;
+ }
+ /* Raw GPS time data */
+ case POSHAL_DID_GPS_TIME_RAW:
+ {
+ (void)VehicleSensSetGpsTimeRawG(reinterpret_cast<SENSOR_GPSTIME_RAW*>(pst_data->uc_data));
+ break;
+ }
+ case POSHAL_DID_GPS_TIME:
+ {
+ uc_chg_type = VehicleSensSetGpsTimeG(reinterpret_cast<SENSOR_MSG_GPSTIME*>(pst_data->uc_data));
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+ case POSHAL_DID_GPS_WKNROLLOVER:
+ {
+ (void)VehicleSensSetWknRolloverG(reinterpret_cast<SENSOR_WKNROLLOVER*>(pst_data->uc_data));
+ break;
+ }
+ /* GPS clock drift */
+ case POSHAL_DID_GPS_CLOCK_DRIFT:
+ {
+ uc_chg_type = VehicleSensSetGpsClockDriftG(reinterpret_cast<int32_t*>(pst_data->uc_data));
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+ /* GPS clock frequency */
+ case POSHAL_DID_GPS_CLOCK_FREQ:
+ {
+ uc_chg_type = VehicleSensSetGpsClockFreqG(reinterpret_cast<uint32_t*>(pst_data->uc_data));
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+ * MODULE : VehicleSensSetDataMasterData
+ * ABSTRACT : Vehicle sensor data master common data set processing
+ * FUNCTION : Set vehicle data
+ * ARGUMENT : *pstMsg : Received message data
+ * : p_data_master_set_n : Data Master Set Notification(Callback function)
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensSetDataMasterData(const POS_MSGINFO *pstMsg,
+ PFUNC_DMASTER_SET_N p_data_master_set_n) {
+ u_int8 uc_chg_type = 0;
+ const POS_POSDATA *pstPosData = NULL;
+ const u_int16 *pucSpeed = 0;
+ SENSORLOCATION_LONLATINFO_DAT stLonLat;
+ SENSORLOCATION_ALTITUDEINFO_DAT stAltitude;
+ SENSORMOTION_SPEEDINFO_DAT stSpeed;
+ SENSORMOTION_HEADINGINFO_DAT stHeading;
+ const SENSOR_MSG_GPSTIME *pstGpsTime;
+
+// RET_API ret;
+
+// char* pEnvPositioning_CWORD86_ = NULL;
+// BOOL sndFlg;
+
+
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ BOOL bIsAvailable;
+ u_int8 ucResult = SENSLOG_RES_SUCCESS;
+ PNO us_pno;
+
+ /*------------------------------------------------------*/
+ /* Call the data set processing associated with the DID */
+ /* Call the data master set notification process */
+ /*------------------------------------------------------*/
+ switch (pstMsg->did) {
+ case POSHAL_DID_GPS_CUSTOMDATA_NAVI:
+ {
+ pstPosData = (const POS_POSDATA *) & (pstMsg->data);
+
+ /* Latitude/LongitudeInformation */
+ if (((pstPosData->status & POS_LOC_INFO_LAT) == POS_LOC_INFO_LAT) ||
+ ((pstPosData->status & POS_LOC_INFO_LON) == POS_LOC_INFO_LON)) {
+ memset(&stLonLat, 0x00, sizeof(stLonLat));
+ stLonLat.getMethod = SENSOR_GET_METHOD_NAVI;
+ stLonLat.SyncCnt = VehicleSensGetSensorCnt();
+ stLonLat.isEnable = SENSORLOCATION_STATUS_ENABLE;
+ stLonLat.posSts = pstPosData->posSts;
+ stLonLat.posAcc = pstPosData->posAcc;
+ stLonLat.Longitude = pstPosData->longitude;
+ stLonLat.Latitude = pstPosData->latitude;
+ uc_chg_type = VehicleSensSetLocationLonLatN((const SENSORLOCATION_LONLATINFO_DAT *)&stLonLat);
+ (*p_data_master_set_n)(VEHICLE_DID_LOCATION_LONLAT_NAVI, uc_chg_type, VEHICLESENS_GETMETHOD_NAVI);
+ }
+
+ /* Altitude information */
+ if ((pstPosData->status & POS_LOC_INFO_ALT) == POS_LOC_INFO_ALT) {
+ memset(&stAltitude, 0x00, sizeof(stAltitude));
+ stAltitude.getMethod = SENSOR_GET_METHOD_NAVI;
+ stAltitude.SyncCnt = VehicleSensGetSensorCnt();
+ stAltitude.isEnable = SENSORLOCATION_STATUS_ENABLE;
+ stAltitude.Altitude = pstPosData->altitude;
+ uc_chg_type = VehicleSensSetLocationAltitudeN((const SENSORLOCATION_ALTITUDEINFO_DAT *)&stAltitude);
+ (*p_data_master_set_n)(VEHICLE_DID_LOCATION_ALTITUDE_NAVI, uc_chg_type, VEHICLESENS_GETMETHOD_NAVI);
+ }
+
+ /* Bearing information */
+ if ((pstPosData->status & POS_LOC_INFO_HEAD) == POS_LOC_INFO_HEAD) {
+ memset(&stHeading, 0x00, sizeof(stHeading));
+ stHeading.getMethod = SENSOR_GET_METHOD_NAVI;
+ stHeading.SyncCnt = VehicleSensGetSensorCnt();
+ stHeading.isEnable = SENSORMOTION_STATUS_ENABLE;
+ stHeading.posSts = pstPosData->posSts;
+ stHeading.Heading = pstPosData->heading;
+ uc_chg_type = VehicleSensSetMotionHeadingN((const SENSORMOTION_HEADINGINFO_DAT *)&stHeading);
+ (*p_data_master_set_n)(VEHICLE_DID_MOTION_HEADING_NAVI, uc_chg_type, VEHICLESENS_GETMETHOD_NAVI);
+ }
+
+ ( *p_data_master_set_n )( POSHAL_DID_GPS_CUSTOMDATA_NAVI, VEHICLESENS_NEQ, VEHICLESENS_GETMETHOD_NAVI );
+
+ break;
+ }
+ case VEHICLE_DID_MOTION_SPEED_NAVI:
+ {
+ pucSpeed = (const u_int16 *) & (pstMsg->data);
+
+ /* Vehicle speed information */
+ memset(&stSpeed, 0x00, sizeof(stSpeed));
+ stSpeed.getMethod = SENSOR_GET_METHOD_NAVI;
+ stSpeed.SyncCnt = VehicleSensGetSensorCnt();
+ stSpeed.isEnable = SENSORMOTION_STATUS_ENABLE;
+ stSpeed.Speed = *pucSpeed;
+ uc_chg_type = VehicleSensSetMotionSpeedN((const SENSORMOTION_SPEEDINFO_DAT *)&stSpeed);
+ (*p_data_master_set_n)(VEHICLE_DID_MOTION_SPEED_NAVI, uc_chg_type, VEHICLESENS_GETMETHOD_NAVI);
+ break;
+ }
+ case POSHAL_DID_GPS_TIME:
+ {
+ pstGpsTime = (const SENSOR_MSG_GPSTIME*)(pstMsg->data);
+ uc_chg_type = VehicleSensSetGpsTimeG((const SENSOR_MSG_GPSTIME *)pstGpsTime);
+ (*p_data_master_set_n)(POSHAL_DID_GPS_TIME, uc_chg_type, VEHICLESENS_GETMETHOD_GPS);
+
+ /* Set GPS time to CLOCK */
+ eStatus = ClockIfDtimeSetGpsTime(pstGpsTime, &bIsAvailable);
+ if ((bIsAvailable == TRUE) && (eStatus != eFrameworkunifiedStatusOK)) {
+ ucResult = SENSLOG_RES_FAIL;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ClockIfDtimeSetGpsTime ERROR!! [ret=%d, y=%d, m=%d, d=%d, h=%d, n=%d, s=%d, sts=%d]",
+ eStatus, pstGpsTime->utc.year, pstGpsTime->utc.month, pstGpsTime->utc.date,
+ pstGpsTime->utc.hour, pstGpsTime->utc.minute, pstGpsTime->utc.second, pstGpsTime->tdsts);
+ }
+ us_pno = _pb_CnvName2Pno(SENSLOG_PNAME_CLOCK);
+ SensLogWriteOutputData(SENSLOG_DATA_O_TIME_CS, 0, us_pno,
+ (uint8_t *)(pstGpsTime), // NOLINT(readability/casting)
+ sizeof(SENSOR_MSG_GPSTIME), ucResult);
+ break;
+ }
+ case VEHICLE_DID_SETTINGTIME:
+ {
+ /* GPS time information */
+ uc_chg_type = VehicleSensSetSettingTimeclock((const POS_DATETIME *) & (pstMsg->data));
+ (*p_data_master_set_n)(VEHICLE_DID_SETTINGTIME, uc_chg_type, VEHICLESENS_GETMETHOD_OTHER);
+ break;
+ }
+
+ case VEHICLE_DID_LOCATIONINFO_NMEA_NAVI:
+ {
+ uc_chg_type = VehicleSens_SetLocationInfoNmea_n((const POS_LOCATIONINFO_NMEA*)&(pstMsg->data));
+ (*p_data_master_set_n)(VEHICLE_DID_LOCATIONINFO_NMEA_NAVI, uc_chg_type, VEHICLESENS_GETMETHOD_NAVI );
+ break;
+ }
+
+ default:
+ break;
+ }
+ return;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterGyroTrouble
+* ABSTRACT : Vehicle Sensor Data Master Gyro Failure Status Setting Process
+* FUNCTION : Set a gyro fault condition
+* ARGUMENT : *pst_data : Gyro Failure Status Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterGyroTrouble(const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *pst_data, PFUNC_DMASTER_SET_N p_data_master_set_n) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+
+ if ((pst_data != NULL) && (p_data_master_set_n != NULL)) {
+ if (pst_data->ul_did == VEHICLE_DID_GYRO_TROUBLE) {
+ uc_chg_type = VehicleSensSetGyroTrouble(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", pst_data->ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT is NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterSysGpsInterruptSignal
+* ABSTRACT : Vehicle Sensor Data Master SYS GPS Interrupt Signal Setting
+* FUNCTION : Setting SYS GPS Interrupt Signals
+* ARGUMENT : *pst_data : SYS GPS interrupt notification
+* : p_data_master_set_shared_memory : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterSysGpsInterruptSignal(const LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL *pst_data, PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+ if ((pst_data != NULL) && (p_data_master_set_shared_memory != NULL)) {
+ if (pst_data->ul_did == VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL) {
+ uc_chg_type = VehicleSensSetSysGpsInterruptSignal(pst_data);
+ /* As SYS GPS interrupt signals are not registered for delivery, */
+ /* Disposal quantity,To avoid risks,DeliveryProc shall not be called. */
+ (*p_data_master_set_shared_memory)(pst_data->ul_did, uc_chg_type);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", pst_data->ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT is NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterMainGpsInterruptSignal
+* ABSTRACT : Vehicle Sensor Data Master MAIN GPS Interrupt Signal Setting
+* FUNCTION : Setting MAIN GPS Interrupt Signals
+* ARGUMENT : *pst_data : MAIN GPS interrupt notification
+* : p_data_master_set_shared_memory : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterMainGpsInterruptSignal(const SENSOR_MSG_GPSDATA_DAT *pst_data, PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+
+ if ((pst_data != NULL) &&
+ (p_data_master_set_shared_memory != NULL)) {
+ if (pst_data->ul_did == VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL) {
+ uc_chg_type = VehicleSensSetMainGpsInterruptSignal(pst_data);
+ /* As MAIN GPS interrupt signals are not registered for delivery, */
+ /* Disposal quantity,To avoid risks,DeliveryProc shall not be called. */
+ (*p_data_master_set_shared_memory)(pst_data->ul_did, uc_chg_type);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", pst_data->ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT is NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterGyroConnectStatus
+* ABSTRACT : Vehicle Sensor Data Master Gyro Connection Status Setting Processing
+* FUNCTION : Set the state of the gyro connection
+* ARGUMENT : *pst_data : Gyro Connect Status Notification Data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterGyroConnectStatus(const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *pst_data, PFUNC_DMASTER_SET_SHARED_MEMORY p_data_master_set_shared_memory) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+
+ if ((pst_data != NULL) &&
+ (p_data_master_set_shared_memory != NULL)) {
+ if (pst_data->ul_did == VEHICLE_DID_GYRO_CONNECT_STATUS) {
+ uc_chg_type = VehicleSensSetGyroConnectStatus(pst_data);
+ /* As MAIN GPS interrupt signals are not registered for delivery, */
+ /* Disposal quantity,To avoid risks,DeliveryProc shall not be called. */
+ (*p_data_master_set_shared_memory)(pst_data->ul_did, uc_chg_type);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", pst_data->ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT is NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetDataMasterGpsAntennaStatus
+* ABSTRACT : Vehicle Sensor Data Master GPS Antenna Connection Status Setting Processing
+* FUNCTION : Setting the GPS Antenna Connection Status
+* ARGUMENT : *pst_data : GPS antenna connection status notification data
+* : p_data_master_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetDataMasterGpsAntennaStatus(const LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS *pst_data, PFUNC_DMASTER_SET_N p_data_master_set_n) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_chg_type;
+
+ if ((pst_data != NULL) && (p_data_master_set_n != NULL)) {
+ if (pst_data->ul_did == POSHAL_DID_GPS_ANTENNA) {
+ uc_chg_type = VehicleSensSetGpsAntennaStatus(pst_data);
+ (*p_data_master_set_n)(pst_data->ul_did, uc_chg_type, VEHICLESENS_GETMETHOD_LINE);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", pst_data->ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT is NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMaster
+* ABSTRACT : Vehicle Sensor Data Master Get Processing
+* FUNCTION : Provide vehicle sensor data master
+* ARGUMENT : ul_did : Data ID corresponding to the vehicle information
+* : uc_get_method : Data collection way
+* : VEHICLESENS_GETMETHOD_CAN: CAN communication
+* : VEHICLESENS_GETMETHOD_LINE: LineSensor drivers
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMaster(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER *pst_data) {
+ /*------------------------------------------------------*/
+ /* Call the data Get processing associated with the DID */
+ /*------------------------------------------------------*/
+ switch (ul_did) { // LCOV_EXCL_BR_LINE 6:some DID is not used
+ /*------------------------------------------------------*/
+ /* Vehicle sensor data group */
+ /*------------------------------------------------------*/
+ case POSHAL_DID_SPEED_PULSE:
+ {
+ VehicleSensGetSpeedPulse(pst_data, uc_get_method);
+ break;
+ }
+// case POSHAL_DID_GYRO_X:
+// {
+// VehicleSensGetGyroX(pst_data, uc_get_method);
+// break;
+// }
+ case POSHAL_DID_GYRO_Y:
+ {
+ VehicleSensGetGyroY(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z:
+ {
+ VehicleSensGetGyroZ(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_EXT: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ VehicleSensGetGyroRev(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_X:
+ {
+ VehicleSensGetGsnsX(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Y:
+ {
+ VehicleSensGetGsnsY(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Z:
+ {
+ VehicleSensGetGsnsZ(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_REV:
+ {
+ VehicleSensGetRev(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FLAG:
+ {
+ /* Data acquisition not selected */
+ VehicleSensGetSpeedPulseFlag(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_ANTENNA:
+ {
+ VehicleSensGetGpsAntenna(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_SNS_COUNTER:
+ {
+ VehicleSensGetSnsCounter(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GPS_INTERRUPT_FLAG:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Data acquisition not selected */
+ VehicleSensGetGpsInterruptFlag(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case POSHAL_DID_SPEED_KMPH:
+ {
+ VehicleSensGetSpeedKmph(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_TEMP:
+ {
+ VehicleSensGetGyroTemp(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_PULSE_TIME:
+ {
+ VehicleSensGetPulseTime(pst_data, uc_get_method);
+ break;
+ }
+ case VEHICLE_DID_LOCATION_LONLAT:
+ case VEHICLE_DID_LOCATION_LONLAT_NAVI:
+ {
+ VehicleSensGetLocationLonLat(pst_data, uc_get_method);
+ break;
+ }
+ case VEHICLE_DID_LOCATION_ALTITUDE:
+ case VEHICLE_DID_LOCATION_ALTITUDE_NAVI:
+ {
+ VehicleSensGetLocationAltitude(pst_data, uc_get_method);
+ break;
+ }
+ case VEHICLE_DID_MOTION_SPEED_NAVI:
+ case VEHICLE_DID_MOTION_SPEED_INTERNAL:
+ {
+ VehicleSensGetMotionSpeed(pst_data, uc_get_method);
+ break;
+ }
+ case VEHICLE_DID_MOTION_HEADING:
+ case VEHICLE_DID_MOTION_HEADING_NAVI:
+ {
+ VehicleSensGetMotionHeading(pst_data, uc_get_method);
+ break;
+ }
+ case VEHICLE_DID_SETTINGTIME:
+ {
+ VehicleSensGetSettingTime(pst_data, uc_get_method);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterExt
+* ABSTRACT : Vehicle Sensor Data Master Get Processing(Initial delivery)
+* FUNCTION : Provide vehicle sensor data master
+* ARGUMENT : ul_did : Data ID corresponding to the vehicle information
+* : uc_get_method : Data collection way
+* : VEHICLESENS_GETMETHOD_CAN: CAN communication
+* : VEHICLESENS_GETMETHOD_LINE: LineSensor drivers
+* : VEHICLESENS_GETMETHOD_NAVI: Navi
+* : VEHICLESENS_GETMETHOD_CLOCK:Clock
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterExt(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ /*------------------------------------------------------*/
+ /* Call the data Get processing associated with the DID */
+ /*------------------------------------------------------*/
+ switch (ul_did) {
+ /*------------------------------------------------------*/
+ /* Vehicle sensor data group */
+ /*------------------------------------------------------*/
+ case POSHAL_DID_SPEED_PULSE:
+ {
+ VehicleSensGetSpeedPulseExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_X:
+ {
+ VehicleSensGetGsnsXExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Y:
+ {
+ VehicleSensGetGsnsYExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Z:
+ {
+ VehicleSensGetGsnsZExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_SNS_COUNTER:
+ {
+ VehicleSensGetSnsCounterExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_EXT: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ VehicleSensGetGyroExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_Y:
+ {
+ VehicleSensGetGyroYExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z:
+ {
+ VehicleSensGetGyroZExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_REV:
+ {
+ VehicleSensGetRevExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_TEMP:
+ {
+ VehicleSensGetGyroTempExt(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_PULSE_TIME:
+ {
+ VehicleSensGetPulseTimeExt(pst_data, uc_get_method);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterFst
+* ABSTRACT : Vehicle Sensor Data Master Get Processing(Initial transmission data)
+* FUNCTION : Provide vehicle sensor data master
+* ARGUMENT : ul_did : Data ID corresponding to the vehicle information
+* : uc_get_method : Data collection way
+* : VEHICLESENS_GETMETHOD_CAN: CAN communication
+* : VEHICLESENS_GETMETHOD_LINE: LineSensor drivers
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterFst(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ /*------------------------------------------------------*/
+ /* Call the data Get processing associated with the DID */
+ /*------------------------------------------------------*/
+ switch (ul_did) {
+ /*------------------------------------------------------*/
+ /* Vehicle sensor data group */
+ /*------------------------------------------------------*/
+ case POSHAL_DID_GYRO_X_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ VehicleSensGetGyroXFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_Y_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ VehicleSensGetGyroYFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_Z_FST: /* 3 to 14bit A/D value,0bit:REV */
+ {
+ VehicleSensGetGyroZFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FST:
+ {
+ VehicleSensGetSpeedPulseFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_SPEED_PULSE_FLAG_FST:
+ {
+ VehicleSensGetSpeedPulseFlagFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_REV_FST:
+ {
+ VehicleSensGetRevFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GYRO_TEMP_FST:
+ {
+ VehicleSensGetGyroTempFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_X_FST:
+ {
+ VehicleSensGetGsnsXFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Y_FST:
+ {
+ VehicleSensGetGsnsYFst(pst_data, uc_get_method);
+ break;
+ }
+ case POSHAL_DID_GSNS_Z_FST:
+ {
+ VehicleSensGetGsnsZFst(pst_data, uc_get_method);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGpsDataMaster
+* ABSTRACT : Vehicle Sensor Data Master GPS Data Get Processing
+* FUNCTION : Provide vehicle sensor data master GPS data
+* ARGUMENT : ul_did : Data ID corresponding to the vehicle information
+* : uc_get_method : Data collection way
+* : VEHICLESENS_GETMETHOD_GPS: GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGpsDataMaster(DID ul_did,
+ u_int8 uc_get_method,
+ SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ /*------------------------------------------------------*/
+ /* Call the data Get processing associated with the DID */
+ /*------------------------------------------------------*/
+ switch (ul_did) { // LCOV_EXCL_BR_LINE 6:some DID is not used
+ /*------------------------------------------------------*/
+ /* GPS data group */
+ /*------------------------------------------------------*/
+
+ case VEHICLE_DID_GPS_UBLOX_NAV_VELNED:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavVelnedG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavTimeUtcG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavTimeGpsG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_SVINFO:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavSvInfoG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_STATUS:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavStatusG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_POSLLH:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavPosllhG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_CLOCK:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetNavClockG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_NAV_DOP:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED();
+ VehicleSensGetNavDopG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_UBLOX_MON_HW:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED();
+ VehicleSensGetMonHwG(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS_COUNTER:
+ {
+ // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetGpsCounterg(pst_data);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case VEHICLE_DID_GPS__CWORD82__NMEA:
+ {
+ VehicleSensGetGps_CWORD82_NmeaG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS__CWORD82__FULLBINARY:
+ {
+ VehicleSensGetGps_CWORD82_FullBinaryG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS__CWORD82___CWORD44_GP4:
+ {
+ VehicleSensGetGps_CWORD82__CWORD44_Gp4G(pst_data);
+ break;
+ }
+ case VEHICLE_DID_NAVIINFO_DIAG_GPS:
+ {
+ VehicleSensGetNaviinfoDiagGPSg(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_TIME:
+ {
+ VehicleSensGetGpsTimeG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_TIME_RAW:
+ {
+ VehicleSensGetGpsTimeRawG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_NMEA:
+ {
+ VehicleSensGetGpsNmeaG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_WKNROLLOVER:
+ {
+ VehicleSensGetWknRolloverG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_CLOCK_DRIFT:
+ {
+ VehicleSensGetGpsClockDriftG(pst_data);
+ break;
+ }
+ case POSHAL_DID_GPS_CLOCK_FREQ:
+ {
+ VehicleSensGetGpsClockFreqG(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterGyroTrouble
+* ABSTRACT : Vehicle Sensor Data Master Gyro Failure Status Get Processing
+* FUNCTION : Provide a gyro fault condition
+* ARGUMENT : ul_did : Data ID
+* : uc_get_method : Data collection way(Not used)
+* : VEHICLESENS_GETMETHOD_CAN : CAN communication
+* : VEHICLESENS_GETMETHOD_LINE : LineSensor drivers
+* : VEHICLESENS_GETMETHOD_GPS : GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterGyroTrouble(DID ul_did, u_int8 uc_get_method, VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_data) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (pst_data != NULL) {
+ if (ul_did == VEHICLE_DID_GYRO_TROUBLE) {
+ VehicleSensGetGyroTrouble(pst_data);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pst_data == NULL\r\n");
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterSysGpsInterruptSignal
+* ABSTRACT : Vehicle Sensor Data Master SYS GPS Interrupt Signal Get Processing
+* FUNCTION : Provide SYS GPS interrupt signals
+* ARGUMENT : ul_did : Data ID
+* : uc_get_method : Data collection way(Not used)
+* : VEHICLESENS_GETMETHOD_CAN : CAN communication
+* : VEHICLESENS_GETMETHOD_LINE : LineSensor drivers
+* : VEHICLESENS_GETMETHOD_GPS : GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterSysGpsInterruptSignal(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (pst_data != NULL) {
+ if (ul_did == VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL) {
+ VehicleSensGetSysGpsInterruptSignal(pst_data);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pst_data == NULL\r\n");
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterMainGpsInterruptSignal
+* ABSTRACT : Vehicle Sensor Data Master MAIN GPS Interrupt Signal Get Processing
+* FUNCTION : Provide MAIN GPS interrupt signals
+* ARGUMENT : ul_did : Data ID
+* : uc_get_method : Data collection way(Not used)
+* : VEHICLESENS_GETMETHOD_CAN : CAN communication
+* : VEHICLESENS_GETMETHOD_LINE : LineSensor drivers
+* : VEHICLESENS_GETMETHOD_GPS : GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterMainGpsInterruptSignal(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (pst_data != NULL) {
+ if (ul_did == VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL) {
+ VehicleSensGetMainGpsInterruptSignal(pst_data);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pst_data == NULL\r\n");
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterGyroConnectStatus
+* ABSTRACT : Vehicle Sensor Data Master Gyro Connection Status Get Processing
+* FUNCTION : Provide the status of the gyro connection
+* ARGUMENT : ul_did : Data ID
+* : uc_get_method : Data collection way(Not used)
+* : VEHICLESENS_GETMETHOD_CAN : CAN communication
+* : VEHICLESENS_GETMETHOD_LINE : LineSensor drivers
+* : VEHICLESENS_GETMETHOD_GPS : GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterGyroConnectStatus(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (pst_data != NULL) {
+ if (ul_did == VEHICLE_DID_GYRO_CONNECT_STATUS) {
+ VehicleSensGetGyroConnectStatus(pst_data);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x)\r\n", ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pst_data == NULL\r\n");
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetDataMasterGpsAntennaStatus
+* ABSTRACT : Vehicle Sensor Data Master GPS Antenna Connection Status Get Processing
+* FUNCTION : Provide GPS antenna connection status
+* ARGUMENT : ul_did : Data ID
+* : uc_get_method : Data collection way(Not used)
+* : VEHICLESENS_GETMETHOD_CAN : CAN communication
+* : VEHICLESENS_GETMETHOD_LINE : LineSensor drivers
+* : VEHICLESENS_GETMETHOD_GPS : GPS
+* : *pst_data : Pointer to the data master provider
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetDataMasterGpsAntennaStatus(DID ul_did,
+ u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (pst_data != NULL) {
+ if (ul_did == POSHAL_DID_GPS_ANTENNA) {
+ VehicleSensGetGpsAntennaStatus(pst_data);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "UNKNOWN DID(%x) \r\n", ul_did);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pst_data == NULL\r\n");
+ }
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Sensor counter acquisition
+ *
+ * @return Sensor Counter
+ *
+ */
+static uint8_t VehicleSensGetSensorCnt(void) {
+ VEHICLESENS_DATA_MASTER st_data;
+ uint8_t sensCnt;
+
+ /* Synchronous counter acquisition */
+ VehicleSensGetSnsCounterl(&st_data);
+
+ sensCnt = st_data.uc_data[0];
+
+ return sensCnt;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_DeliveryCtrl.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_DeliveryCtrl.cpp
new file mode 100755
index 0000000..15aabff
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_DeliveryCtrl.cpp
@@ -0,0 +1,2243 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_DeliveryCtrl.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle Sensor Destination Management
+ * Module configuration VehicleSensInitDeliveryCtrlTbl() Vehicle sensor delivery destination management table initialization function
+ * VehicleSensInitDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management area initialization function
+ * VehicleSensInitPkgDeliveryTblMng() Vehicle Sensor Package Delivery Management Table Initialization Function
+ * VehicleSensEntryDeliveryCtrl() Vehicle sensor delivery destination management registration function
+ * VehicleSensAddDeliveryCtrlTbl() Vehicle sensor delivery destination management table addition function
+ * VehicleSensUpdateDeliveryCtrlTbl() Vehicle sensor delivery destination management table update function
+ * VehicleSensUpdatePkgDeliveryCtrlTbl() Vehicle Sensor Delivery Destination Management Table Package Delivery Data Update Function
+ * VehicleSensAddDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management addition function
+ * VehicleSensUpdateDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management update function
+ * VehicleSensAddPkgDeliveryTblMng() Vehicle Sensor Package Delivery Management Table Additional Function
+ * VehicleSensEntryPkgDeliveryCtrl() Vehicle sensor package delivery management registration function
+ * VehicleSensMakeDeliveryPnoTbl() Vehicle Sensor Destination PNO Table Creation Function
+ * VehicleSensAddPnoTbl() Vehicle Sensor Destination PNO Table Addition Function
+ * VehicleSensDeliveryProc() Vehicle Sensor Data Delivery Process
+ * VehicleSensFirstDelivery() Vehicle Sensor Initial Data Delivery Process
+ * VehicleSensFirstPkgDelivery() Vehicle Sensor Initial Package Data Delivery Process
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include <vehicle_service/POS_common_API.h>
+#include <vehicle_service/POS_gps_API.h>
+#include "VehicleSens_DeliveryCtrl.h"
+#include "Dead_Reckoning_Local_Api.h"
+#include "SensorLog.h"
+#include "POS_private.h"
+
+#define VEHICLE_SENS_DELIVERY_CTRL_DEBUG 0
+#define VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG 0
+
+#define GYRO_NORMAL (0U)
+#define GYRO_ERROR (1U)
+#define GYRO_UNFIXED (2U)
+
+#define _pb_strcat(pdest, psrc, size) (strncat(pdest, psrc, size) , (0))
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DELIVERY_CTRL_TBL g_stdelivery_ctrl_tbl;
+static VEHICLESENS_DELIVERY_CTRL_TBL_MNG g_stdelivery_ctrl_tbl_mng;
+static VEHICLESENS_PKG_DELIVERY_TBL_MNG g_stpkgdelivery_tbl_mng;
+static VEHICLESENS_DELIVERY_PNO_TBL g_stdelivery_pno_tbl;
+
+/* ++ PastModel002 response DR */
+static VEHICLESENS_DELIVERY_CTRL_TBL g_stdelivery_ctrl_tbl_dr;
+static VEHICLESENS_DELIVERY_CTRL_TBL_MNG g_stdelivery_ctrl_tbl_mng_dr;
+static VEHICLESENS_DELIVERY_PNO_TBL g_stdelivery_pno_tbl_dr;
+
+/* -- PastModel002 response DR */
+
+#if CONFIG_HW_PORTSET_TYPE_C
+u_int16 gusSeqNum; /* Sequence number for split transmission */
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensInitDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table initialization function
+* FUNCTION : Delivery destination management table initialization processing
+* ARGUMENT : void
+* NOTE :
+******************************************************************************/
+void VehicleSensInitDeliveryCtrlTbl(void) {
+ memset(&g_stdelivery_ctrl_tbl, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL));
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensInitDeliveryCtrlTblMng
+* ABSTRACT : Vehicle Sensor DR Internal Delivery Destination Management Table Management Area Initialization Function
+* FUNCTION : Delivery destination management table management area initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitDeliveryCtrlTblMng(void) {
+ memset(&g_stdelivery_ctrl_tbl_mng, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL_MNG));
+}
+
+/* ++ PastModel002 response DR */
+/*******************************************************************************
+* MODULE : VehicleSensInitDeliveryCtrlTblDR
+* ABSTRACT : Vehicle sensor delivery destination management table initialization function
+* FUNCTION : DR distribution target management table initialization processing
+* ARGUMENT : void
+* NOTE :
+******************************************************************************/
+void VehicleSensInitDeliveryCtrlTblDR(void) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&g_stdelivery_ctrl_tbl_dr, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL));
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensInitDeliveryCtrlTblMngDR
+* ABSTRACT : Vehicle sensor delivery destination management table management area initialization function
+* FUNCTION : Initialization processing for the management table area of the delivery destination management table for DR
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitDeliveryCtrlTblMngDR(void) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ memset(&g_stdelivery_ctrl_tbl_mng_dr, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL_MNG));
+}
+// LCOV_EXCL_STOP
+
+/* -- PastModel002 response DR */
+
+/*******************************************************************************
+* MODULE : VehicleSensInitPkgDeliveryTblMng
+* ABSTRACT : Vehicle Sensor Package Delivery Management Table Initialization Function
+* FUNCTION : Delivery Package Management Table Initialization Processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitPkgDeliveryTblMng(void) {
+ memset(&g_stpkgdelivery_tbl_mng, 0x00, sizeof(VEHICLESENS_PKG_DELIVERY_TBL_MNG));
+}
+
+#if CONFIG_HW_PORTSET_TYPE_C
+/*******************************************************************************
+* MODULE : VehicleSensInitSeqNum
+* ABSTRACT : Sequence number initialization function for split transmission
+* FUNCTION : Sequence number initialization processing for split transmission
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSeqNum(void) {
+ gusSeqNum = 0;
+}
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensEntryDeliveryCtrl
+* ABSTRACT : Vehicle sensor delivery destination management registration function
+* FUNCTION : Shipping management table,Update the shipping management table management.
+* ARGUMENT : pst_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : VEHICLE_RET_NORMAL :Successful registration
+******************************************************************************/
+VEHICLE_RET_API VehicleSensEntryDeliveryCtrl(const VEHICLE_MSG_DELIVERY_ENTRY *pst_delivery_entry) {
+ int32 i;
+ u_int8 uc_action_type = VEHICLESENS_ACTION_TYPE_ADD;
+ int32 uc_did_flag;
+ DID ulentry_did = pst_delivery_entry->data.did;
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data = NULL;
+ VEHICLE_RET_API ret = VEHICLE_RET_NORMAL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ BOOL bexist_flag = FALSE;
+
+ /* Check if the data ID exists. */
+ uc_did_flag = VehicleSensCheckDid(ulentry_did);
+ if (uc_did_flag == 0) { // LCOV_EXCL_BR_LINE 6:alway be 1
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ ret = VEHICLE_RET_ERROR_DID; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ // LCOV_EXCL_LINE 8: dead code // NOLINT(whitespace/line_length)
+ }
+
+ /* Check the number of registered shipments. */
+ if ((ret == VEHICLE_RET_NORMAL) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (g_stdelivery_ctrl_tbl.us_dnum >= VEHICLESENS_DELIVERY_INFO_MAX)) {
+ /* Return the FULL of delivery registrations*/
+ ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* Duplicate delivery registration check*/
+ for (i = 0; i < g_stdelivery_ctrl_tbl.us_dnum; i++) {
+ if ((g_stdelivery_ctrl_tbl.st_ctrl_data[i].ul_did == ulentry_did) &&
+ (g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pno == pst_delivery_entry->data.pno) &&
+ (g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_method == VEHICLESENS_DELIVERY_METHOD_NORMAL)) {
+ /* When the same shipping address (PNO) and shipping DID are already registered,Update registration information and exit */
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_chg_type = pst_delivery_entry->data.delivery_timing;
+ bexist_flag = TRUE;
+ break;
+ }
+ }
+
+ if (bexist_flag == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "Duplicate DID=0x%x PNO=0x%x ChgType=%d",
+ ulentry_did,
+ pst_delivery_entry->data.pno,
+ pst_delivery_entry->data.delivery_timing);
+ } else {
+ /* By searching for the delivery registration of the relevant DID,Hold the address. */
+ for (i = 0; i < g_stdelivery_ctrl_tbl_mng.us_dnum; i++) {
+ if (g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did == ulentry_did) {
+ uc_action_type = VEHICLESENS_ACTION_TYPE_UPDATE;
+ pst_existing_mng_data = &g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i];
+ }
+ }
+ /* Add to the shipping management table.*/
+ VehicleSensAddDeliveryCtrlTbl(pst_delivery_entry);
+
+ /* Processing when updating existing data*/
+ if (uc_action_type == VEHICLESENS_ACTION_TYPE_UPDATE) {
+ /* Update the shipping management table.*/
+ VehicleSensUpdateDeliveryCtrlTbl(pst_existing_mng_data);
+
+ /* Update the shipping destination management table management information.*/
+ VehicleSensUpdateDeliveryCtrlTblMng(pst_existing_mng_data);
+ } else { /* Newly added processing*/
+ /* Add to the shipping management table management information.*/
+ VehicleSensAddDeliveryCtrlTblMng(pst_delivery_entry);
+ }
+ }
+ }
+ return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensAddDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table addition function
+* FUNCTION : Add to the shipping management table.
+* ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddDeliveryCtrlTbl(const VEHICLE_MSG_DELIVERY_ENTRY *pst_delivery_entry) {
+ VEHICLESENS_DELIVERY_CTRL_TBL_DATA *pst_ctrl_data;
+
+ pst_ctrl_data = &g_stdelivery_ctrl_tbl.st_ctrl_data[g_stdelivery_ctrl_tbl.us_dnum];
+ pst_ctrl_data->ul_did = pst_delivery_entry->data.did;
+ pst_ctrl_data->us_pno = pst_delivery_entry->data.pno;
+ pst_ctrl_data->uc_chg_type = pst_delivery_entry->data.delivery_timing;
+ pst_ctrl_data->uc_ctrl_flg = pst_delivery_entry->data.ctrl_flg;
+ pst_ctrl_data->us_link_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->us_pkg_start_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->us_pkg_end_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->uc_method = VEHICLESENS_DELIVERY_METHOD_NORMAL;
+ g_stdelivery_ctrl_tbl.us_dnum = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum + 1);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensUpdateDeliveryCtrlTbl
+* ABSTRACT : Vehicle sensor delivery destination management table update function
+* FUNCTION : Update the shipping management table.
+* ARGUMENT : *pstExistingMngData : Pointer to the previous data information with the same data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensUpdateDeliveryCtrlTbl(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) {
+ /* Ignore->MISRA-C++:2008 Rule 7-1-2 */
+ /* Update Link Index Only.
+ For indexes of usEndIdx values matching the data IDs in the target management table
+ Making usLinkIdx an Index-Registered Index */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ g_stdelivery_ctrl_tbl.st_ctrl_data[pst_existing_mng_data->us_end_idx].us_link_idx =
+ static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensUpdatePkgDeliveryCtrlTbl
+* ABSTRACT : Vehicle Sensor Delivery Destination Management Table Package Delivery Data Update Function
+* FUNCTION : Updating Package Delivery Data in the Destination Management Table.
+* ARGUMENT : us_dnum : Number of data items in the package delivery management table
+* : us_pkg_num : Number of packages to create
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensUpdatePkgDeliveryCtrlTbl(u_int16 us_dnum, u_int16 us_pkg_num) {
+ VEHICLESENS_DELIVERY_CTRL_TBL_DATA *pst_ctrl_data;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_ctrl_data = &g_stdelivery_ctrl_tbl.st_ctrl_data[g_stdelivery_ctrl_tbl.us_dnum - 1];
+ pst_ctrl_data->us_pkg_start_idx = us_dnum;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_ctrl_data->us_pkg_end_idx = static_cast<u_int16>(us_dnum + us_pkg_num - 1);
+ pst_ctrl_data->uc_method = VEHICLESENS_DELIVERY_METHOD_PACKAGE;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensAddDeliveryCtrlTblMng
+* ABSTRACT : Vehicle sensor delivery destination management table management addition function
+* FUNCTION : Add to the shipping management table management.
+* ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddDeliveryCtrlTblMng(const VEHICLE_MSG_DELIVERY_ENTRY *pst_delivery_entry) {
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_ctrl_mng_data;
+
+ pst_ctrl_mng_data = &g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[g_stdelivery_ctrl_tbl_mng.us_dnum];
+ pst_ctrl_mng_data->ul_did = pst_delivery_entry->data.did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_ctrl_mng_data->us_start_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_ctrl_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1);
+ pst_ctrl_mng_data->usdlvry_entry_num++;
+ g_stdelivery_ctrl_tbl_mng.us_dnum++;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensUpdateDeliveryCtrlTblMng
+* ABSTRACT : Vehicle sensor delivery destination management table management update function
+* FUNCTION : Update the shipping management table management.
+* ARGUMENT : *pst_existing_mng_data : Pointer to the previous data information with the same data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensUpdateDeliveryCtrlTblMng(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) {
+ /* Update only the end index and the number of registered shipping destinations. */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_existing_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1);
+ pst_existing_mng_data->usdlvry_entry_num++;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensAddPkgDeliveryTblMng
+* ABSTRACT : Vehicle Sensor Package Delivery Management Table Additional Function
+* FUNCTION : Add to the shipping management table management.
+* ARGUMENT : *pst_pkg : Pointer to package delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddPkgDeliveryTblMng(const SENSOR_MSG_DELIVERY_ENTRY *pst_pkg) {
+ int32 i; /* Generic counters */
+
+ /* Data ID registration */
+ /* Registration of delivery data index */
+ for (i = 0; i < (pst_pkg->data.pkg_num); i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ g_stpkgdelivery_tbl_mng.st_pkg_data[g_stpkgdelivery_tbl_mng.us_dnum].ul_did = pst_pkg->data.did[i];
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ g_stpkgdelivery_tbl_mng.st_pkg_data[g_stpkgdelivery_tbl_mng.us_dnum].usdlvry_idx = \
+ static_cast<u_int16>(g_stpkgdelivery_tbl_mng.us_dnum + 1);
+ g_stpkgdelivery_tbl_mng.us_dnum++;
+ }
+ /* The final delivery data index overwrites the terminating code */
+ g_stpkgdelivery_tbl_mng.st_pkg_data[g_stpkgdelivery_tbl_mng.us_dnum - 1].usdlvry_idx = VEHICLESENS_LINK_INDEX_END;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensEntryPkgDeliveryCtrl
+* ABSTRACT : Vehicle sensor package delivery management registration function
+* FUNCTION : Shipping management table,Destination management table management,Update the package delivery management table.
+* ARGUMENT : *pst_pkg : Pointer to package delivery registration information
+* NOTE :
+* RETURN : VEHICLE_RET_NORMAL : Successful registration
+******************************************************************************/
+VEHICLE_RET_API VehicleSensEntryPkgDeliveryCtrl(const SENSOR_MSG_DELIVERY_ENTRY *pst_pkg ,
+ u_int8 uc_ext_chk) { /* Ignore->MISRA-C++:2008 Rule 6-6-5 */
+ int32 i;
+ u_int16 us_size = 0;
+ u_int8 uc_action_type = VEHICLESENS_ACTION_TYPE_ADD;
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data = NULL;
+ VEHICLE_MSG_DELIVERY_ENTRY st_delivery_entry;
+ u_int16 us_boundary_adj; /* For boundary adjustment */
+ u_int16 us_next_offset; /* For size calculation */
+ VEHICLE_RET_API ret = VEHICLE_RET_NORMAL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ BOOL bexist_flag = FALSE;
+
+ /* Check if the data ID exists. */
+ for (i = 0; i < (pst_pkg->data.pkg_num); i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (VEHICLESENS_INVALID == VehicleSensCheckDid(pst_pkg->data.did[i])) { // LCOV_EXCL_BR_LINE 200: always Valid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret = VEHICLE_RET_ERROR_DID; // // LCOV_EXCL_LINE 8 :dead code
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+ }
+
+ /* Check the number of registered shipments. */
+ if ((ret == VEHICLE_RET_NORMAL) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (VEHICLESENS_DELIVERY_INFO_MAX <= g_stdelivery_ctrl_tbl.us_dnum)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Return the FULL of delivery registrations*/
+ ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Check the number of registered package shipments. */
+ if ((ret == VEHICLE_RET_NORMAL) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (VEHICLESENS_PKG_DELIVERY_INFO_MAX < (g_stpkgdelivery_tbl_mng.us_dnum + pst_pkg->data.pkg_num))) {
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Return the FULL of delivery registrations*/
+ ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* Check that the size of the buffer to be delivered does not exceed the maximum size. */
+ /* For boundary adjustment */
+ us_boundary_adj = (u_int16)VEHICLESENS_BIT1 | (u_int16)VEHICLESENS_BIT0;
+ for (i = 0; i < pst_pkg->data.pkg_num; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ if (uc_ext_chk == VEHICLESENS_EXT_OFF) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */ // LCOV_EXCL_BR_LINE 200: VEHICLESENS_EXT_OFF passed in function is dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ us_next_offset = VehicleSensGetDataMasterOffset(pst_pkg->data.did[i]); // LCOV_EXCL_LINE 8: dead code
+ } else {
+ us_next_offset = VehicleSensGetDataMasterExtOffset(pst_pkg->data.did[i]);
+ }
+#else
+ us_next_offset = VehicleSensGetDataMasterOffset(pst_pkg->data.did[i]);
+#endif
+ /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
+ if ((us_next_offset & us_boundary_adj) != 0) {
+ /* If you need to adjust */
+ /* Mask Lower Bit Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
+ us_next_offset = static_cast<u_int16>(us_next_offset & ~us_boundary_adj);
+ us_next_offset = static_cast<u_int16>(us_next_offset + (u_int16)VEHICLESENS_BIT2); /* Add numbers */
+ }
+ us_size = static_cast<u_int16>(us_size + us_next_offset); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+ if (SENSOR_VSINFO_DSIZE < us_size) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Return the FULL of delivery registrations(Exceed the size of the buffer to be delivered due to the combination of packages)*/
+ ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+ }
+
+ if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ for (i = 0; i < g_stdelivery_ctrl_tbl.us_dnum; i++) {
+ if ((g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pno == pst_pkg->data.pno) &&
+ (g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_method == VEHICLESENS_DELIVERY_METHOD_PACKAGE)) {
+ /* When the same shipping address (PNO) is already registered,Update registration information and exit */
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_chg_type = pst_pkg->data.delivery_timing;
+ bexist_flag = TRUE;
+ break;
+ }
+ }
+
+ if (bexist_flag == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Duplicate PNO=0x%x ChgType=%d",
+ pst_pkg->data.pno, pst_pkg->data.delivery_timing);
+ } else {
+ /* By searching for the delivery registration of the relevant DID,Hold the address. */
+ for (i = 0; i < g_stdelivery_ctrl_tbl_mng.us_dnum; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did == pst_pkg->data.did[0]) {
+ uc_action_type = VEHICLESENS_ACTION_TYPE_UPDATE;
+ pst_existing_mng_data = &g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i];
+ }
+ }
+ /* Type conversion,And copies of the data section(Because the header is unused,Not involved) */
+ memset(reinterpret_cast<void *>(&st_delivery_entry),
+ static_cast<int32>(0),
+ (size_t)sizeof(VEHICLE_MSG_DELIVERY_ENTRY));
+ st_delivery_entry.data.did = pst_pkg->data.did[0];
+ st_delivery_entry.data.pno = pst_pkg->data.pno;
+ st_delivery_entry.data.delivery_timing = pst_pkg->data.delivery_timing;
+ st_delivery_entry.data.ctrl_flg = pst_pkg->data.ctrl_flg;
+ st_delivery_entry.data.event_id = pst_pkg->data.event_id;
+ /* Add to the shipping management table.*/
+ VehicleSensAddDeliveryCtrlTbl(&st_delivery_entry);
+
+ /* Processing when updating existing data*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
+ if (uc_action_type == VEHICLESENS_ACTION_TYPE_UPDATE) {
+ /* Update the shipping management table.*/
+ VehicleSensUpdateDeliveryCtrlTbl(pst_existing_mng_data);
+
+ /* Update the shipping destination management table management information.*/
+ VehicleSensUpdateDeliveryCtrlTblMng(pst_existing_mng_data);
+ } else { /* Newly added processing*/
+ /* Add to the shipping management table management information.*/
+ VehicleSensAddDeliveryCtrlTblMng(&st_delivery_entry);
+ }
+
+ /* Updating Package Relationship Data in the Destination Management Table.*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ VehicleSensUpdatePkgDeliveryCtrlTbl(g_stpkgdelivery_tbl_mng.us_dnum, pst_pkg->data.pkg_num);
+ /* Add to the package delivery management table.*/
+ VehicleSensAddPkgDeliveryTblMng(pst_pkg);
+ }
+ }
+
+ return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensMakeDeliveryPnoTbl
+* ABSTRACT : Vehicle sensor delivery destination PNO table creation function
+* FUNCTION : Create the shipping destination PNO table
+* ARGUMENT : ul_did Data ID
+* Change_type Delivery Trigger
+* NOTE :
+* RETURN : VEHICLESENS_DELIVERY_PNO_TBL* Pointer to the shipping PNO table
+******************************************************************************/
+VEHICLESENS_DELIVERY_PNO_TBL* VehicleSensMakeDeliveryPnoTbl(DID ul_did, u_int8 change_type) {
+ int32 i;
+ u_int8 uc_ctrl_tbl_mng_data_list;
+ u_int16 us_index = 0;
+ u_int16 us_dnum = 0;
+
+ /* Get the start index and count of the corresponding data ID. */
+ uc_ctrl_tbl_mng_data_list = static_cast<u_int8>(
+ (sizeof(g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data)) /
+ (sizeof(g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[0])));
+ for (i = 0; i < uc_ctrl_tbl_mng_data_list; i++) {
+ /* Stores the information of the corresponding DID.. */
+ if (g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did == ul_did) {
+ us_index = g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].us_start_idx;
+ us_dnum = g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].usdlvry_entry_num;
+ break;
+ }
+ }
+
+ /* Create a PNO list */
+ g_stdelivery_pno_tbl.us_dnum = 0;
+ if (change_type == VEHICLESENS_CHGTYPE_CHG) {
+ /* Processing when delivery timing is changed*/
+ for (i = 0; i < us_dnum; i++) {
+ /* Functionalization by Increasing Structure Members */
+ VehicleSensAddPnoTbl(us_index);
+ us_index = g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_link_idx;
+ }
+ } else {
+ /* Processing when delivery timing is update */
+ for (i = 0; i < us_dnum; i++) {
+ if (VEHICLE_DELIVERY_TIMING_UPDATE == g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].uc_chg_type) {
+ /* Functionalization by Increasing Structure Members */
+ VehicleSensAddPnoTbl(us_index);
+ }
+ us_index = g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_link_idx;
+ }
+ }
+ return(&g_stdelivery_pno_tbl);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensAddPnoTbl
+* ABSTRACT : Vehicle Sensor Destination PNO Table Addition Function
+* FUNCTION : Add to the shipping PNO table.
+* ARGUMENT : us_index : Index of the referenced destination management table
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddPnoTbl(u_int16 us_index) {
+ u_int16 us_pno_tbl_idx;
+
+ us_pno_tbl_idx = g_stdelivery_pno_tbl.us_dnum;
+ g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].us_pno = \
+ g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_pno;
+ g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].us_pkg_start_idx = \
+ g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_pkg_start_idx;
+ g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].us_pkg_end_idx = \
+ g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_pkg_end_idx;
+ g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].uc_method = \
+ g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].uc_method;
+ g_stdelivery_pno_tbl.us_dnum++;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensDeliveryGPS
+* ABSTRACT : Vehicle Sensor Data Delivery Process
+* FUNCTION : Deliver data to a destination.
+* ARGUMENT : ul_did :Data ID
+* uc_chg_type :Delivery timing
+* uc_get_method :Acquisition method
+* NOTE :
+* RETURN : void
+******************************************************************************/
+u_int8 VehicleSensDeliveryGPS(DID ul_did, u_int8 uc_get_method, u_int8 uc_current_get_method, int32 pno_index,
+ u_int32* cid,
+ VEHICLESENS_DATA_MASTER* stmaster,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) {
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ SENSORLOCATION_MSG_LONLATINFO *plonlat_msg;
+ SENSORLOCATION_MSG_ALTITUDEINFO *paltitude_msg;
+ SENSORMOTION_MSG_HEADINGINFO *pheading_msg;
+#endif
+
+ SENSOR_MSG_GPSDATA_DAT gps_master;
+ VEHICLESENS_DELIVERY_FORMAT delivery_data;
+ u_int16 length;
+ u_int16 senslog_len;
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+
+ VehicleSensGetGpsDataMaster(ul_did, uc_current_get_method, &gps_master);
+
+ if (ul_did == POSHAL_DID_GPS_TIME) {
+ /* GPS time,Because there is no header in the message to be delivered,
+ Padding deliveryData headers */
+ (void)memcpy(reinterpret_cast<void*>(&delivery_data),
+ reinterpret_cast<void*>(&gps_master.uc_data[0]), gps_master.us_size);
+ length = gps_master.us_size;
+ senslog_len = length;
+ *cid = CID_VEHICLESENS_VEHICLE_INFO_GPS_TIME;
+ } else if (ul_did == VEHICLE_DID_LOCATION_LONLAT) {
+ plonlat_msg = reinterpret_cast<SENSORLOCATION_MSG_LONLATINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_current_get_method, stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(plonlat_msg->data)),
+ reinterpret_cast<void*>(&(stmaster->uc_data[0])), stmaster->us_size);
+ length = (u_int16)(stmaster->us_size);
+ senslog_len = length;
+ *cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
+ } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE) {
+ paltitude_msg = reinterpret_cast<SENSORLOCATION_MSG_ALTITUDEINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(paltitude_msg->data)),
+ reinterpret_cast<void*>(&stmaster->uc_data[0]), stmaster->us_size);
+ length = (u_int16)(stmaster->us_size);
+ senslog_len = length;
+ *cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE;
+ } else if (ul_did == VEHICLE_DID_MOTION_HEADING) {
+ pheading_msg = reinterpret_cast<SENSORMOTION_MSG_HEADINGINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(pheading_msg->data)),
+ reinterpret_cast<void*>(&stmaster->uc_data[0]), stmaster->us_size);
+ length = (u_int16)(stmaster->us_size);
+ senslog_len = length;
+ *cid = CID_POSIF_REGISTER_LISTENER_HEADING;
+ } else {
+ delivery_data.header.did = gps_master.ul_did;
+ delivery_data.header.size = gps_master.us_size;
+ delivery_data.header.rcv_flag = gps_master.uc_rcv_flag;
+ delivery_data.header.sensor_cnt = gps_master.uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(&delivery_data.data[0]),
+ reinterpret_cast<void *>(&gps_master.uc_data[0]),
+ (size_t)delivery_data.header.size);
+
+ length = static_cast<u_int16>((u_int16)sizeof(delivery_data.header) + \
+ delivery_data.header.size);
+ senslog_len = delivery_data.header.size;
+ *cid = CID_VEHICLESENS_VEHICLE_INFO;
+ }
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ static_cast<CID>(*cid),
+ length,
+ (const void *)&delivery_data);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ if (*cid != CID_VEHICLESENS_VEHICLE_INFO) {
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&delivery_data),
+ senslog_len, uc_result);
+ } else {
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(delivery_data.data[0])),
+ senslog_len, uc_result);
+ }
+ return uc_result;
+}
+
+u_int8 VehicleSensDeliveryFst(DID ul_did, u_int8 uc_get_method, int32 pno_index,
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) {
+ VEHICLESENS_DATA_MASTER_FST st_master_fst; /* Master of initial sensor data */
+ VEHICLESENS_DATA_MASTER_FST st_master_fst_temp; /* For temporary storage */
+
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+ (void)memset(reinterpret_cast<void *>(&st_master_fst),
+ 0,
+ sizeof(VEHICLESENS_DATA_MASTER_FST));
+ (void)memset(reinterpret_cast<void *>(&st_master_fst_temp),
+ 0,
+ sizeof(VEHICLESENS_DATA_MASTER_FST));
+ VehicleSensGetDataMasterFst(ul_did, uc_get_method, &st_master_fst);
+ if (st_master_fst.partition_flg == 1) {
+ /* When the partitioning flag is enabled,Or exceeds the size that can be sent,Perform split transmission */
+ memcpy(&st_master_fst_temp, &st_master_fst, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ if ((ul_did == POSHAL_DID_GYRO_X_FST) || /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ (ul_did == POSHAL_DID_GYRO_Y_FST) ||
+ (ul_did == POSHAL_DID_GYRO_Z_FST) ||
+ (ul_did == POSHAL_DID_GSNS_X_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Y_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Z_FST)) {
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ /* Size of data that can be transmitted in one division(Same size definition used)*/
+ st_master_fst_temp.us_size = LSDRV_FSTSNS_DSIZE_GYRO_X;
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&st_master_fst_temp.uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size(Same size definition used)Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ st_master_fst_temp.us_size = static_cast<u_int16>(st_master_fst.us_size - \
+ LSDRV_FSTSNS_DSIZE_GYRO_X);
+ memcpy(&st_master_fst_temp.uc_data[0],
+ &st_master_fst.uc_data[LSDRV_FSTSNS_DSIZE_GYRO_X],
+ st_master_fst_temp.us_size);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 #Coverity_19347 */
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+ } else if (ul_did == POSHAL_DID_REV_FST) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ /* Size of data that can be transmitted in one division */
+ st_master_fst_temp.us_size = LSDRV_FSTSNS_DSIZE_REV;
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&st_master_fst_temp.uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ st_master_fst_temp.us_size = static_cast<u_int16>(st_master_fst.us_size - \
+ LSDRV_FSTSNS_DSIZE_REV);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 #Coverity_19347 */
+ memcpy(&st_master_fst_temp.uc_data[0],
+ &st_master_fst.uc_data[LSDRV_FSTSNS_DSIZE_REV],
+ st_master_fst_temp.us_size);
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+ } else {
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ /* Size of data that can be transmitted in one division(Same size definition used)*/
+ st_master_fst_temp.us_size = LSDRV_FSTSNS_DSIZE_GYRO_TEMP;
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&st_master_fst_temp.uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size(Same size definition used)Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ st_master_fst_temp.us_size = static_cast<u_int16>(st_master_fst.us_size - \
+ LSDRV_FSTSNS_DSIZE_GYRO_TEMP);
+ memcpy(&st_master_fst_temp.uc_data[0],
+ &st_master_fst.uc_data[LSDRV_FSTSNS_DSIZE_GYRO_TEMP],
+ st_master_fst_temp.us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 #Coverity_19347*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst_temp.us_size + 8),
+ (const void *)&st_master_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
+ st_master_fst_temp.us_size,
+ uc_result);
+ }
+ } else {
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(st_master_fst.us_size + 8),
+ (const void *)&st_master_fst);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(st_master_fst.uc_data[0])),
+ st_master_fst.us_size,
+ uc_result);
+ }
+
+ return uc_result;
+}
+
+u_int8 VehicleSensDeliveryGyro(DID ul_did, u_int8 uc_current_get_method, int32 pno_index, const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+
+ VEHICLESENS_DATA_MASTER_GYRO_TROUBLE st_master_gyro_trouble;
+ SENSORMOTION_MSG_GYROTROUBLEINFO_DAT st_msg_gyro_trouble_info;
+
+ /* Initialization */
+ st_msg_gyro_trouble_info.reserve = 0;
+
+ VehicleSensGetDataMasterGyroTrouble(ul_did, uc_current_get_method, &st_master_gyro_trouble);
+
+ /* Size storage(GYROTROUBLE) */
+ st_msg_gyro_trouble_info.size = st_master_gyro_trouble.us_size;
+
+ /* Set the GyroTrouble */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_gyro_trouble_info.gyro_trouble)),
+ reinterpret_cast<void *>(&(st_master_gyro_trouble.uc_data)),
+ sizeof(st_msg_gyro_trouble_info.gyro_trouble));
+
+#if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[DIAG] ul_did = VEHICLE_DID_GYRO_TROUBLE");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[DIAG] st_msg_gyro_trouble_info.size = %d", st_msg_gyro_trouble_info.size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[DIAG] st_msg_gyro_trouble_info.gyro_trouble = 0x%08X \r\n",
+ st_msg_gyro_trouble_info.gyro_trouble);
+#endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
+ /* Since the undefined state is not a device specification,Do not deliver to the app side */
+ if (st_msg_gyro_trouble_info.gyro_trouble != GYRO_UNFIXED) {
+
+ /* Send GyroTrouble to API-caller */
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLE_SENSORMOTION_GYROTROUBLE,
+ sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
+ (const void *)&st_msg_gyro_trouble_info);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&st_msg_gyro_trouble_info),
+ sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
+ uc_result);
+#if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] GyroTrouble Delivery");
+#endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
+ }
+ return uc_result;
+}
+// LCOV_EXCL_STOP
+
+void VehicleSensDeliveryAntenna(DID ul_did, u_int8 uc_current_get_method, int32 pno_index, const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS gps_antenna_status;
+ VEHICLESENS_DELIVERY_FORMAT delivery_data;
+ u_int16 length;
+
+ VehicleSensGetDataMasterGpsAntennaStatus(ul_did, uc_current_get_method, &gps_antenna_status);
+
+ delivery_data.header.did = gps_antenna_status.ul_did;
+ delivery_data.header.size = gps_antenna_status.us_size;
+ delivery_data.header.rcv_flag = gps_antenna_status.uc_rcvflag;
+ delivery_data.header.sensor_cnt = gps_antenna_status.uc_sensor_cnt;
+ (void)memcpy(reinterpret_cast<void *>(&delivery_data.data[0]),
+ reinterpret_cast<void *>(&gps_antenna_status.uc_data),
+ (size_t)delivery_data.header.size);
+
+ length = static_cast<u_int16>(static_cast<u_int32>(sizeof(delivery_data.header)) + delivery_data.header.size);
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ length,
+ (const void *)&delivery_data);
+}
+// LCOV_EXCL_STOP
+
+u_int8 VehicleSensDeliveryOther(DID ul_did, u_int8 uc_current_get_method, int32 pno_index,
+ u_int32* cid, // NOLINT(readability/nolint)
+ VEHICLESENS_DATA_MASTER* stmaster, // NOLINT(readability/nolint)
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) {
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+/* Determine CID */
+ if (ul_did == VEHICLE_DID_LOCATION_LONLAT_NAVI) {
+ *cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
+ } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE_NAVI) { // LCOV_EXCL_BR_LINE 6:VEHICLE_DID_LOCATION_ALTITUDE_NAVI no API to pass in // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE; // LCOV_EXCL_LINE 8: dead code
+ } else if ((ul_did == VEHICLE_DID_MOTION_SPEED_NAVI) ||
+ (ul_did == VEHICLE_DID_MOTION_SPEED_INTERNAL)) {
+ *cid = CID_VEHICLE_SENSORMOTION_SPEED;
+ } else if (ul_did == VEHICLE_DID_MOTION_HEADING_NAVI) {
+ *cid = CID_POSIF_REGISTER_LISTENER_HEADING;
+ } else if (ul_did == VEHICLE_DID_SETTINGTIME) {
+ *cid = CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ;
+ } else { // LCOV_EXCL_BR_LINE 6: cannot be this one
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *cid = 0xFFFF; /* DID error */ // LCOV_EXCL_LINE 8: dead code
+ }
+
+ /* Send vehicle sensor information notification */
+ if (*cid == 0xFFFF) { // LCOV_EXCL_BR_LINE 6: cannot be this one
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Error log */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unknown DID [%d]", ul_did);
+ } else {
+ /* Acquire the applicable data information from the data master..*/
+ (void)memset(reinterpret_cast<void *>(stmaster), 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ VehicleSensGetDataMaster(ul_did, uc_current_get_method, stmaster);
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ static_cast<CID>(*cid),
+ (u_int16)(stmaster->us_size),
+ (const void *)&(stmaster->uc_data[0]));
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED,
+ ul_did,
+ pst_pno_tbl->st_pno_data[pno_index].us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster->uc_data[0])),
+ stmaster->us_size,
+ uc_result);
+ }
+
+ return uc_result;
+}
+
+void VehicleSensDeliveryProc(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method) {
+ VEHICLESENS_DATA_MASTER stmaster; /* Data master of normal data */
+ const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl; /* Vehicle Sensor Destination PNO Table Pointer */
+ SENSOR_PKG_MSG_VSINFO st_pkg_master; /* Data master for package delivery */
+ uint32_t cid;
+ uint8_t uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+
+ /* Obtain the data acquisition method from the Vehicle Selection Item List */
+ uint8_t uc_current_get_method = VehicleSensGetSelectionItemList(ul_did);
+
+ if (uc_current_get_method == uc_get_method) {
+ /* When the data acquisition methods match (= delivery target) */
+
+ /* Obtain the shipping destination PNO */
+ pst_pno_tbl = (const VEHICLESENS_DELIVERY_PNO_TBL *) VehicleSensMakeDeliveryPnoTbl(ul_did, uc_chg_type);
+
+ if ((pst_pno_tbl->us_dnum) > 0) {
+ /* When there is a shipping destination PNO registration */
+ /* For boundary adjustment */
+ uint16_t us_boundary_adj = (u_int16) VEHICLESENS_BIT1 | (u_int16) VEHICLESENS_BIT0; /* #012 */
+ /* Vehicle sensor information notification transmission process */
+ for (uint32_t i = 0; i < (pst_pno_tbl->us_dnum); i++) {
+ if (VEHICLESENS_DELIVERY_METHOD_PACKAGE == pst_pno_tbl->st_pno_data[i].uc_method) {
+ /* When the delivery method is the package method */
+ (void) memset(reinterpret_cast<void *>(&st_pkg_master), 0, sizeof(SENSOR_PKG_MSG_VSINFO));
+
+ uint16_t us_index = pst_pno_tbl->st_pno_data[i].us_pkg_start_idx;
+ uint8_t uc_data_cnt = 0U;
+ uint16_t us_offset = 0U;
+ for (uint32_t j = 0; j < SENSOR_PKG_DELIVERY_MAX; j++) {
+ DID ul_pkg_did = g_stpkgdelivery_tbl_mng.st_pkg_data[us_index].ul_did; /* Get DID */
+ st_pkg_master.usOffset[uc_data_cnt] = us_offset; /* Offset setting */
+ uc_current_get_method = VehicleSensGetSelectionItemList(ul_pkg_did); /* Data collection way */
+ if (VEHICLESENS_GETMETHOD_GPS == uc_current_get_method) {
+ VehicleSensGetGpsDataMaster(ul_pkg_did, uc_current_get_method,
+ reinterpret_cast<SENSOR_MSG_GPSDATA_DAT *>(&st_pkg_master.ucData[us_offset]));
+ }
+ else {
+ VehicleSensGetDataMaster(ul_pkg_did, uc_current_get_method,
+ reinterpret_cast<VEHICLESENS_DATA_MASTER *>(&st_pkg_master.ucData[us_offset]));
+ }
+ uc_data_cnt++; /* Data count increment */
+ if ((us_index == pst_pno_tbl->st_pno_data[i].us_pkg_end_idx)
+ || (VEHICLESENS_LINK_INDEX_END == g_stpkgdelivery_tbl_mng.st_pkg_data[us_index].usdlvry_idx)) {
+ st_pkg_master.ucDNum = uc_data_cnt; /* To save the number of data */
+ break;
+ }
+ else {
+ /* By creating the following processing contents,Need to obtain an offset value */
+ uint16_t us_next_offset = VehicleSensGetDataMasterOffset(ul_pkg_did); /* Next offset calculation */
+ /* Boundary adjustment of data size */
+ if ((us_next_offset & us_boundary_adj) != 0) {
+ /* If you need to adjust */
+ /* Mask Lower Bit */
+ us_next_offset = static_cast<u_int16>(us_next_offset & ~us_boundary_adj);
+ /* Add numbers */
+ us_next_offset = static_cast<u_int16>(us_next_offset + (u_int16) VEHICLESENS_BIT2);
+ }
+ us_offset = static_cast<u_int16>(us_offset + us_next_offset);
+ /* Get next index */
+ us_index = g_stpkgdelivery_tbl_mng.st_pkg_data[us_index].usdlvry_idx;
+ }
+ }
+ RET_API ret = PosSndMsg(PNO_VEHICLE_SENSOR, pst_pno_tbl->st_pno_data[i].us_pno,
+ CID_SENSOR_PKG_INFO, (u_int16) sizeof(SENSOR_PKG_MSG_VSINFO), (const void *) &st_pkg_master);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS_PKG, 0, pst_pno_tbl->st_pno_data[i].us_pno,
+ reinterpret_cast<uint8_t *>(&st_pkg_master), sizeof(SENSOR_PKG_MSG_VSINFO), uc_result);
+ }
+ else {
+ /* When the delivery system is normal */
+ /* Acquire the applicable data information from the data master..*/
+ if (VEHICLESENS_GETMETHOD_GPS == uc_current_get_method) {
+ uc_result = VehicleSensDeliveryGPS(ul_did, uc_get_method, uc_current_get_method, i, &cid, &stmaster,
+ pst_pno_tbl);
+ }
+ else if ((VEHICLESENS_GETMETHOD_NAVI == uc_get_method) || // NOLINT(readability/braces)
+ (VEHICLESENS_GETMETHOD_OTHER == uc_get_method) || (VEHICLESENS_GETMETHOD_INTERNAL == uc_get_method)) {
+ uc_result = VehicleSensDeliveryOther(ul_did, uc_current_get_method, i, &cid, &stmaster, pst_pno_tbl);
+ }
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ else if ((ul_did == POSHAL_DID_GYRO_X_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_GYRO_Y_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_GYRO_Z_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_REV_FST) ||
+ (ul_did == POSHAL_DID_GYRO_TEMP_FST) ||
+ (ul_did == POSHAL_DID_GSNS_X_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Y_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Z_FST) ||
+ (ul_did == POSHAL_DID_SPEED_PULSE_FST)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Acquire the applicable data information from the data master for the initial sensor..*/
+ uc_result = VehicleSensDeliveryFst(ul_did, uc_get_method, i, pst_pno_tbl);
+ }
+#endif
+ else if (ul_did == VEHICLE_DID_GYRO_TROUBLE) { // LCOV_EXCL_BR_LINE 6:DID is not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uc_result = VehicleSensDeliveryGyro(ul_did, uc_current_get_method, i, pst_pno_tbl); // LCOV_EXCL_LINE 8: dead code // NOLINT(whitespace/line_length)
+ }
+ else { // NOLINT(readability/braces)
+ (void) memset(reinterpret_cast<void *>(&stmaster), 0x00, sizeof(stmaster));
+ VehicleSensGetDataMaster(ul_did, uc_current_get_method, &stmaster);
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ RET_API ret = VehicleSndMsg(PNO_VEHICLE_SENSOR, pst_pno_tbl->st_pno_data[i].us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO, (u_int16) sizeof(VEHICLESENS_DATA_MASTER), (const void *) &stmaster);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, pst_pno_tbl->st_pno_data[i].us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster.uc_data[0])), stmaster.us_size, uc_result);
+ }
+ }
+ }
+ }
+ }
+}
+
+u_int8 VehicleSensFirstDeliverySens(PNO us_pno, DID ul_did, u_int8 uc_get_method,
+ VEHICLESENS_DATA_MASTER_FST* stmaster_fst,
+ VEHICLESENS_DATA_MASTER_FST* stmaster_fst_temp) {
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+ /* Acquire the applicable data information from the data master for the initial sensor..*/
+ (void)memset(reinterpret_cast<void *>(stmaster_fst), 0, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ (void)memset(reinterpret_cast<void *>(stmaster_fst_temp), 0, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ VehicleSensGetDataMasterFst(ul_did, uc_get_method, stmaster_fst);
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[LOG:POSHAL_DID_GYRO_FST,POSHAL_DID_SPEED_PULSE_FST]");
+
+ if (stmaster_fst->partition_flg == 1) {
+ /* When the partitioning flag is enabled,Or exceeds the size that can be sent,Perform split transmission */
+ memcpy(stmaster_fst_temp, stmaster_fst, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ if ((ul_did == POSHAL_DID_GYRO_X_FST) || /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ (ul_did == POSHAL_DID_GYRO_Y_FST) ||
+ (ul_did == POSHAL_DID_GYRO_Z_FST) ||
+ (ul_did == POSHAL_DID_GSNS_X_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Y_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Z_FST)) {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[CALL:VehicleSndMsg:INPOSHAL_DID_GYRO_FST Partition]");
+
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ /* Size of data that can be transmitted in one division(Same size definition used) */
+ stmaster_fst_temp->us_size = LSDRV_FSTSNS_DSIZE_GYRO_X;
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
+ ul_did,
+ us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size,
+ uc_result);
+
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&stmaster_fst_temp->uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size(Same size definition used) Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stmaster_fst_temp->us_size = static_cast<u_int16>(stmaster_fst->us_size - LSDRV_FSTSNS_DSIZE_GYRO_X);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ memcpy(&stmaster_fst_temp->uc_data[0],
+ &stmaster_fst->uc_data[LSDRV_FSTSNS_DSIZE_GYRO_X],
+ stmaster_fst_temp->us_size);
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size, uc_result);
+ } else if (ul_did == POSHAL_DID_REV_FST) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[CALL:VehicleSndMsg:INPOSHAL_DID_REV_FST Partition]");
+
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ stmaster_fst_temp->us_size = LSDRV_FSTSNS_DSIZE_REV; /* Size of data that can be transmitted in one division */
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size, uc_result);
+
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&stmaster_fst_temp->uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stmaster_fst_temp->us_size = static_cast<u_int16>(stmaster_fst->us_size - LSDRV_FSTSNS_DSIZE_REV);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ memcpy(&stmaster_fst_temp->uc_data[0],
+ &stmaster_fst->uc_data[LSDRV_FSTSNS_DSIZE_REV],
+ stmaster_fst_temp->us_size);
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size, uc_result);
+ } else {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[CALL:Vehicle_SndMsg:POSHAL_DID_SPEED_PULSE_FST Partition]");
+
+ /* 1st session */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ /* Size of data that can be transmitted in one division(Same size definition used) */
+ stmaster_fst_temp->us_size = LSDRV_FSTSNS_DSIZE_GYRO_TEMP;
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size, uc_result);
+
+ /* Second time */
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ (void)memset(reinterpret_cast<void *>(&stmaster_fst_temp->uc_data[0]),
+ 0,
+ sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
+ /* Size of the data - Transmission size(Same size definition used) Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stmaster_fst_temp->us_size = static_cast<u_int16>(stmaster_fst->us_size - LSDRV_FSTSNS_DSIZE_GYRO_TEMP);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ memcpy(&stmaster_fst_temp->uc_data[0],
+ &stmaster_fst->uc_data[LSDRV_FSTSNS_DSIZE_GYRO_TEMP],
+ stmaster_fst_temp->us_size);
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
+ (const void *)stmaster_fst_temp);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
+ stmaster_fst_temp->us_size, uc_result);
+ }
+ } else {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "[CALL:VehicleSndMsg]");
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ static_cast<u_int16>(stmaster_fst->us_size + 8),
+ (const void *)stmaster_fst);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster_fst->uc_data[0])),
+ stmaster_fst->us_size, uc_result);
+ }
+
+ return uc_result;
+}
+
+u_int8 VehicleSensFirstDeliveryOther(PNO us_pno, DID ul_did, u_int8 uc_get_method,
+ u_int32* cid,
+ VEHICLESENS_DATA_MASTER* stmaster) {
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+ /* Determine CID */
+ if (ul_did == VEHICLE_DID_LOCATION_LONLAT_NAVI) {
+ *cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
+ } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE_NAVI) { // LCOV_EXCL_BR_LINE 6:VEHICLE_DID_LOCATION_ALTITUDE_NAVI no API to pass in // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE; // LCOV_EXCL_LINE 8: dead code
+ } else if ((ul_did == VEHICLE_DID_MOTION_SPEED_NAVI) ||
+ (ul_did == VEHICLE_DID_MOTION_SPEED_INTERNAL)) {
+ *cid = CID_VEHICLE_SENSORMOTION_SPEED;
+ } else if (ul_did == VEHICLE_DID_MOTION_HEADING_NAVI) {
+ *cid = CID_POSIF_REGISTER_LISTENER_HEADING;
+ } else if (ul_did == VEHICLE_DID_SETTINGTIME) {
+ *cid = CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ;
+ } else { // LCOV_EXCL_BR_LINE 6: cannot be this one
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *cid = 0xFFFF; /* DID error */ // LCOV_EXCL_LINE 8: dead code
+ }
+
+ /* Vehicle sensor information notification transmission */
+ if (*cid == 0xFFFF) { // LCOV_EXCL_BR_LINE 6: cannot be this one
+ /* Error log */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unknown DID [%d]", ul_did); // LCOV_EXCL_LINE 8: dead code // NOLINT(whitespace/line_length)
+ } else {
+ /* Acquire the applicable data information from the data master..*/
+ (void)memset(reinterpret_cast<void *>(stmaster), 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ VehicleSensGetDataMaster(ul_did, uc_get_method, stmaster);
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ static_cast<CID>(*cid),
+ (u_int16)stmaster->us_size,
+ (const void *)&(stmaster->uc_data[0]));
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED,
+ ul_did,
+ us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster->uc_data[0])),
+ stmaster->us_size,
+ uc_result);
+ }
+
+ return uc_result;
+}
+/*******************************************************************************
+* MODULE : VehicleSensFirstDelivery
+* ABSTRACT : Vehicle Sensor Initial Data Delivery Process
+* FUNCTION : Deliver the initial data to the destination.
+* ARGUMENT : us_pno :Addresses for delivery NO
+* ul_did :Data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensFirstDelivery(PNO us_pno, DID ul_did) {
+ u_int8 uc_get_method;
+ VEHICLESENS_DATA_MASTER stmaster;
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ VEHICLESENS_DATA_MASTER_FST stMasterFst; /* Master of initial sensor data */
+ VEHICLESENS_DATA_MASTER_FST stMasterFst_temp; /* For temporary storage */
+ u_int32 cid;
+ SENSORLOCATION_MSG_LONLATINFO *pLonLatMsg;
+ SENSORLOCATION_MSG_ALTITUDEINFO *pAltitudeMsg;
+ SENSORMOTION_MSG_HEADINGINFO *pHeadingMsg;
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
+#endif
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+ [ul_did = 0x%x us_pno:0x%x]", ul_did, us_pno);
+
+ /* Obtain the data acquisition method.*/
+ uc_get_method = VehicleSensGetSelectionItemList(ul_did);
+
+ if (VEHICLESENS_GETMETHOD_GPS == uc_get_method) {
+ SENSOR_MSG_GPSDATA_DAT gps_master;
+ VEHICLESENS_DELIVERY_FORMAT delivery_data;
+ u_int16 length;
+ u_int16 senslog_len;
+
+ VehicleSensGetGpsDataMaster(ul_did, uc_get_method, &gps_master);
+
+ if (ul_did == POSHAL_DID_GPS_TIME) {
+ /* GPS time,Because there is no header in the message to be delivered,Padding deliveryData headers */
+ (void)memcpy(reinterpret_cast<void*>(&delivery_data),
+ reinterpret_cast<void*>(&gps_master.uc_data[0]), gps_master.us_size);
+ length = gps_master.us_size;
+ senslog_len = length;
+ cid = CID_VEHICLESENS_VEHICLE_INFO_GPS_TIME;
+ } else if (ul_did == VEHICLE_DID_LOCATION_LONLAT) {
+ pLonLatMsg = reinterpret_cast<SENSORLOCATION_MSG_LONLATINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(pLonLatMsg->data)),
+ reinterpret_cast<void*>(&(stmaster.uc_data[0])), stmaster.us_size);
+ length = (u_int16)stmaster.us_size;
+ senslog_len = length;
+ cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
+ } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE) {
+ pAltitudeMsg = reinterpret_cast<SENSORLOCATION_MSG_ALTITUDEINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(pAltitudeMsg->data)),
+ reinterpret_cast<void*>(&stmaster.uc_data[0]), stmaster.us_size);
+ length = (u_int16)stmaster.us_size;
+ senslog_len = length;
+ cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE;
+ } else if (ul_did == VEHICLE_DID_MOTION_HEADING) {
+ pHeadingMsg = reinterpret_cast<SENSORMOTION_MSG_HEADINGINFO*>(&delivery_data);
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
+ (void)memcpy(reinterpret_cast<void*>(&(pHeadingMsg->data)),
+ reinterpret_cast<void*>(&stmaster.uc_data[0]), stmaster.us_size);
+ length = (u_int16)stmaster.us_size;
+ senslog_len = length;
+ cid = CID_POSIF_REGISTER_LISTENER_HEADING;
+ } else {
+
+ delivery_data.header.did = gps_master.ul_did;
+ delivery_data.header.size = gps_master.us_size;
+ delivery_data.header.rcv_flag = gps_master.uc_rcv_flag;
+ delivery_data.header.sensor_cnt = gps_master.uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(&delivery_data.data[0]),
+ reinterpret_cast<void *>(&gps_master.uc_data[0]),
+ (size_t)delivery_data.header.size);
+
+ length = static_cast<u_int16>((u_int16)sizeof(delivery_data.header) + delivery_data.header.size);
+ senslog_len = delivery_data.header.size;
+ cid = CID_VEHICLESENS_VEHICLE_INFO;
+ }
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ static_cast<CID>(cid),
+ length,
+ (const void *)&delivery_data);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ if (cid != CID_VEHICLESENS_VEHICLE_INFO) {
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&delivery_data), senslog_len, uc_result);
+ } else {
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(delivery_data.data[0])), senslog_len, uc_result);
+ }
+ }
+ else if ((VEHICLESENS_GETMETHOD_NAVI == uc_get_method) || // NOLINT(readability/braces)
+ (VEHICLESENS_GETMETHOD_OTHER == uc_get_method) ||
+ (VEHICLESENS_GETMETHOD_INTERNAL == uc_get_method)) {
+ uc_result = VehicleSensFirstDeliveryOther(us_pno, ul_did, uc_get_method, &cid, &stmaster);
+ }
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ else if ((ul_did == POSHAL_DID_GYRO_X_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_GYRO_Y_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_GYRO_Z_FST) || // NOLINT(readability/braces)
+ (ul_did == POSHAL_DID_REV_FST) ||
+ (ul_did == POSHAL_DID_GYRO_TEMP_FST) ||
+ (ul_did == POSHAL_DID_GSNS_X_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Y_FST) ||
+ (ul_did == POSHAL_DID_GSNS_Z_FST) ||
+ (ul_did == POSHAL_DID_SPEED_PULSE_FST)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Acquire the applicable data information from the data master for the initial sensor..*/
+ uc_result = VehicleSensFirstDeliverySens(us_pno, ul_did, uc_get_method, &stMasterFst, &stMasterFst_temp);
+ }
+#endif
+ else if (ul_did == VEHICLE_DID_GYRO_TROUBLE) { // LCOV_EXCL_BR_LINE 8 : DID in not used
+ // LCOV_EXCL_START 8: DID is not used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLESENS_DATA_MASTER_GYRO_TROUBLE st_master_gyro_trouble;
+ SENSORMOTION_MSG_GYROTROUBLEINFO_DAT st_msg_gyro_trouble_info;
+
+ /* Initialization */
+ st_master_gyro_trouble.uc_reserve = 0;
+ st_msg_gyro_trouble_info.reserve = 0;
+
+ VehicleSensGetDataMasterGyroTrouble(ul_did, uc_get_method, &st_master_gyro_trouble);
+
+ /* Size storage(GYROTROUBLE) */
+ st_msg_gyro_trouble_info.size = st_master_gyro_trouble.us_size;
+
+ /* Set the GyroTrouble */
+ (void)memcpy(reinterpret_cast<void *>(&(st_msg_gyro_trouble_info.gyro_trouble)),
+ reinterpret_cast<void *>(&(st_master_gyro_trouble.uc_data)),
+ sizeof(st_msg_gyro_trouble_info.gyro_trouble));
+
+#if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] ul_did = VEHICLE_DID_GYRO_TROUBLE");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[DIAG] st_msg_gyro_trouble_info.size = %d",
+ st_msg_gyro_trouble_info.size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[DIAG] st_msg_gyro_trouble_info.gyro_trouble = 0x%08X \r\n",
+ st_msg_gyro_trouble_info.gyro_trouble);
+#endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
+ /* Since the undefined state is not a device specification,Do not deliver to the app for the first time */
+ if (st_msg_gyro_trouble_info.gyro_trouble != GYRO_UNFIXED) {
+
+ /* Send GyroTrouble to API-caller */
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLE_SENSORMOTION_GYROTROUBLE,
+ sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
+ (const void *)&st_msg_gyro_trouble_info);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&st_msg_gyro_trouble_info),
+ sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
+ uc_result);
+#if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] GyroTrouble FirstDelivery");
+#endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
+ }
+ // LCOV_EXCL_STOP
+ }
+ else { // NOLINT(readability/braces)
+ (void)memset(reinterpret_cast<void *>(&stmaster), 0x00, sizeof(stmaster));
+ /* Acquire the applicable data information from the data master..*/
+ VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
+
+ /* Call Vehicle Sensor Information Notification Transmission Process.*/
+ ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
+ us_pno,
+ CID_VEHICLESENS_VEHICLE_INFO,
+ (u_int16)sizeof(VEHICLESENS_DATA_MASTER),
+ (const void *)&stmaster);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
+ reinterpret_cast<uint8_t *>(&(stmaster.uc_data[0])),
+ stmaster.us_size, uc_result);
+ }
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensFirstPkgDelivery
+* ABSTRACT : Vehicle Sensor Initial Package Data Delivery Process
+* FUNCTION : Deliver the initial package data to the destination.
+* ARGUMENT : *pst_data :Data portion pointer of the message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensFirstPkgDelivery(const SENSOR_MSG_DELIVERY_ENTRY_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_get_method; /* Data collection way */
+ int32 i; /* Generic counters */
+ SENSOR_PKG_MSG_VSINFO st_pkg_master; /* Data master for package delivery */
+ DID ul_pkg_did; /* DID for package data acquisition */
+ u_int16 us_offset = 0; /* For offset calculation */
+ u_int16 us_next_offset; /* Next offset value */
+ u_int16 us_boundary_adj; /* For boundary adjustment */
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = 0; /* Send/Receive result */
+
+ (void)memset(reinterpret_cast<void *>(&st_pkg_master), 0, sizeof(SENSOR_PKG_MSG_VSINFO));
+ /* For boundary adjustment */
+ us_boundary_adj = (u_int16)VEHICLESENS_BIT1 | (u_int16)VEHICLESENS_BIT0;
+ for (i = 0; i < pst_data->pkg_num; i++) {
+ ul_pkg_did = pst_data->did[i]; /* Get DID */
+ st_pkg_master.usOffset[i] = us_offset; /* Offset setting */
+ /* Data collection way */
+ uc_get_method = VehicleSensGetSelectionItemList(ul_pkg_did);
+ if (VEHICLESENS_GETMETHOD_GPS == uc_get_method) {
+ VehicleSensGetGpsDataMaster(ul_pkg_did,
+ uc_get_method,
+ reinterpret_cast<SENSOR_MSG_GPSDATA_DAT *>(&st_pkg_master.ucData[us_offset]));
+ } else {
+ VehicleSensGetDataMaster(ul_pkg_did,
+ uc_get_method,
+ reinterpret_cast<VEHICLESENS_DATA_MASTER *>(&st_pkg_master.ucData[us_offset]));
+ }
+ /* Next offset calculation */
+ /* Boundary adjustment of data size */
+ us_next_offset = VehicleSensGetDataMasterOffset(ul_pkg_did);
+ if ((us_next_offset & us_boundary_adj) != 0) {
+ /* If you need to adjust */
+ us_next_offset = static_cast<u_int16>(us_next_offset & ~us_boundary_adj); /* Mask Lower Bit */
+ us_next_offset = static_cast<u_int16>(us_next_offset + (u_int16)VEHICLESENS_BIT2); /* Add numbers */
+ }
+ us_offset = static_cast<u_int16>(us_offset + us_next_offset);
+ }
+
+ st_pkg_master.ucDNum = pst_data->pkg_num; /* To save the number of data */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR,
+ pst_data->pno,
+ CID_SENSOR_PKG_INFO,
+ (u_int16)sizeof(SENSOR_PKG_MSG_VSINFO),
+ (const void *)&st_pkg_master);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS_PKG, 0, pst_data->pno,
+ reinterpret_cast<uint8_t *>(&st_pkg_master),
+ sizeof(SENSOR_PKG_MSG_VSINFO),
+ uc_result);
+}
+// LCOV_EXCL_STOP
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensFirstPkgDeliveryExt
+* ABSTRACT : Vehicle Sensor Initial Expansion Package Data Delivery Process
+* FUNCTION : Deliver the initial expansion package data to the destination.
+* ARGUMENT : *pst_data :Data portion pointer of the message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensFirstPkgDeliveryExt(const SENSOR_MSG_DELIVERY_ENTRY_DAT *pst_data) {
+ u_int8 ucGetMethod; /* Data collection way */
+ int32 i; /* Generic counters */
+ static SENSOR_PKG_MSG_VSINFO stPkgMaster; /* Data master for package delivery */
+ DID ulPkgDid; /* DID for package data acquisition */
+ u_int16 usOffset = 0; /* For offset calculation */
+ u_int16 usNextOffset; /* Next offset value */
+ u_int16 usBoundaryAdj; /* For boundary adjustment */
+ static VEHICLESENS_DATA_MASTER_EXT stExtDataTemp[11];/* Extended data master temporary storage area */
+ u_int16 usDataCnt[11] = {0}; /* For storing the number of data items */
+ u_int8 ucDivideCnt; /* Total number of partitions */
+ u_int8 ucDivide100Cnt = 0; /* Total number of 100 partitions */
+ u_int8 ucDivideSendCnt; /* Number of divided transmissions */
+ u_int16 usDivideSendSize[11] = {0}; /* Split Send Size */
+ u_int16 ucDivideSendPoint; /* Split transmission data acquisition position */
+ u_int8 ucDataBreak; /* Storage area of all data undelivered flag */
+ RET_API ret = RET_NORMAL; /* API return value */
+ u_int8 uc_result = 0; /* Send/Receive result */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* For boundary adjustment */
+ usBoundaryAdj = (u_int16)VEHICLESENS_BIT1 | (u_int16)VEHICLESENS_BIT0;
+ /* #Polaris_004 START */ /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+ (void)memset(reinterpret_cast<void *>(&stExtDataTemp), 0, sizeof(stExtDataTemp));
+ for (i = 0; i < pst_data->pkg_num; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ulPkgDid = pst_data->did[i]; /* Get DID */
+ ucGetMethod = VehicleSensGetSelectionItemList(ulPkgDid); /* Data collection way */
+ if (VEHICLESENS_GETMETHOD_GPS < ucGetMethod) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "VEHICLESENS_DELIVERYCTRL: VehicleSensGetSelectionItemList error :%d\r\n", ucGetMethod);
+ }
+
+ if ((ulPkgDid == POSHAL_DID_GYRO_EXT) ||
+ (ulPkgDid == POSHAL_DID_GYRO_X) ||
+ (ulPkgDid == POSHAL_DID_GYRO_Y) ||
+ (ulPkgDid == POSHAL_DID_GYRO_Z) ||
+ (ulPkgDid == POSHAL_DID_GSNS_X) ||
+ (ulPkgDid == POSHAL_DID_GSNS_Y) ||
+ (ulPkgDid == POSHAL_DID_GSNS_Z) ||
+ (ulPkgDid == POSHAL_DID_SPEED_PULSE) ||
+ (ulPkgDid == POSHAL_DID_REV) ||
+ (ulPkgDid == POSHAL_DID_GYRO_TEMP) ||
+ (ulPkgDid == POSHAL_DID_PULSE_TIME) ||
+ (ulPkgDid == POSHAL_DID_SNS_COUNTER)) {
+ /* Store in the extended data master information buffer */
+ VehicleSensGetDataMasterExt(ulPkgDid, ucGetMethod, &stExtDataTemp[i]);
+ /* Obtain the number of data items */
+ if ((ulPkgDid == POSHAL_DID_SNS_COUNTER) ||
+ (ulPkgDid == POSHAL_DID_REV)) {
+ usDataCnt[i] = stExtDataTemp[i].us_size; /* 1data 1byte */
+ /* Store the transmission size for 10 items */
+ usDivideSendSize[i] = 10;
+ } else if (ulPkgDid == POSHAL_DID_GYRO_TEMP) {
+ usDataCnt[i] = stExtDataTemp[i].us_size / 2; /* 1data 2byte */
+ /* Store the transmission size for 10 items */
+ usDivideSendSize[i] = 20;
+ }
+ else if (ulPkgDid == POSHAL_DID_PULSE_TIME) { // NOLINT(readability/braces)
+ usDataCnt[i] = stExtDataTemp[i].us_size / 132; /* 1data 132byte */
+ /* Store the transmission size for 10 items */
+ usDivideSendSize[i] = 1320;
+ }
+ else { // NOLINT(readability/braces)
+ usDataCnt[i] = stExtDataTemp[i].us_size / 2; /* 1data 2byte Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Store the transmission size for 100 items */
+ usDivideSendSize[i] = 200;
+
+ // divide cnt is 100
+ if (((usDataCnt[i] % VEHICLESENS_PKG_EXT_SEND_MAX_10DATA) > 0) || (usDataCnt[i] == 0)) {
+ ucDivide100Cnt = static_cast<u_int8>((usDataCnt[i] / VEHICLESENS_PKG_EXT_SEND_MAX_10DATA) + 1);
+ } else {
+ ucDivide100Cnt = static_cast<u_int8>(usDataCnt[i] / VEHICLESENS_PKG_EXT_SEND_MAX_10DATA);
+ }
+ }
+ }
+ }
+ /* All-data undelivered flag holding Ignore->MISRA-C ++: 2008 Rule 5-0-5 */
+ ucDataBreak = static_cast<u_int8>(gstPkgTempExt.data_break);
+
+ /* From the number of data items in the acquired buffer,Calculate the number of transmissions */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (((usDataCnt[0] % VEHICLESENS_PKG_EXT_SEND_MAX) > 0) || (usDataCnt[0] == 0)) {
+ /* If there is a remainder,,Division result + 1 */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideCnt = static_cast<u_int8>((usDataCnt[0] / VEHICLESENS_PKG_EXT_SEND_MAX) + 1);
+ } else {
+ /* If there is no remainder,,The result of division is the total number of transmissions. */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideCnt = static_cast<u_int8>(usDataCnt[0] / VEHICLESENS_PKG_EXT_SEND_MAX);
+ }
+
+ // if ucDivide100cnt is valid (greater than 0)
+ ucDivideCnt = (ucDivide100Cnt > 0) ? ucDivide100Cnt : ucDivideCnt;
+
+ ucDivideSendCnt = 0; /* Number of divided transmissions */
+ while (ucDivideSendCnt < ucDivideCnt) {
+ /* Clear send message buffer */
+ (void)memset(reinterpret_cast<void *>(&stPkgMaster), 0, sizeof(SENSOR_PKG_MSG_VSINFO));
+ usOffset = 0;
+ for (i = 0; i < pst_data->pkg_num; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ulPkgDid = pst_data->did[i]; /* Get DID */
+ stPkgMaster.usOffset[i] = usOffset; /* Offset setting */
+ /* copy Data ID of extended data master structure,Size of the data,Receive flag,Reserved */
+ memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset]),
+ reinterpret_cast<void *>(&stExtDataTemp[i]), 11);
+ if ((ulPkgDid == POSHAL_DID_SNS_COUNTER) ||
+ (ulPkgDid == POSHAL_DID_REV) ||
+ (ulPkgDid == POSHAL_DID_PULSE_TIME) ||
+ (ulPkgDid == POSHAL_DID_GYRO_TEMP)) {
+ if (usDataCnt[i] > VEHICLESENS_PKG_EXT_SEND_MAX) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Calculate the data acquisition position */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
+ /* Update the data size*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 4] = (u_int8)usDivideSendSize[i];
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 5] = (u_int8)(usDivideSendSize[i] >> 8);
+ /* Create 10 divided transmission data of sensor counters of extended data master structure */
+ memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
+ reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
+ usDivideSendSize[i]); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Subtract the number of created transmission data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ usDataCnt[i] = static_cast<u_int16>(usDataCnt[i] - VEHICLESENS_PKG_EXT_SEND_MAX);
+ } else {
+ /* Calculate the data acquisition position */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
+ /* Update the data size*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 4] = (u_int8)(stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
+ stPkgMaster.ucData[usOffset + 5] = \
+ (u_int8)((stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint) >> 8);
+ /* Create the remaining divided send data of sensor counter of extended data master structure */
+ memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
+ reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
+ stExtDataTemp[i].us_size - ucDivideSendPoint); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Since all buffers have been created, the number of data is set to 0. */
+ usDataCnt[i] = 0;
+ }
+ } else {
+ if (usDataCnt[i] > VEHICLESENS_PKG_EXT_SEND_MAX_10DATA) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Calculate the data acquisition position */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
+ /* Update the data size*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 4] = (u_int8)usDivideSendSize[i];
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 5] = (u_int8)(usDivideSendSize[i] >> 8);
+ /* Create 100 divided transmission data of vehicle sensor data of extended data master structure */
+ memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
+ reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
+ usDivideSendSize[i]); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Subtract the number of created transmission data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ usDataCnt[i] = static_cast<u_int16>(usDataCnt[i] - VEHICLESENS_PKG_EXT_SEND_MAX_10DATA);
+ } else {
+ /* Calculate the data acquisition position */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
+ /* Update the data size*/
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucData[usOffset + 4] = \
+ (u_int8)(stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
+ stPkgMaster.ucData[usOffset + 5] = \
+ (u_int8)((stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint) >> 8);
+ /* Create the remaining divided transmission data of the vehicle sensor data of the extended data master structure. */
+ memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
+ reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
+ stExtDataTemp[i].us_size - ucDivideSendPoint); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Since all buffers have been created, the number of data is set to 0. */
+ usDataCnt[i] = 0;
+ }
+ }
+ /* Next offset calculation */
+ /* Boundary adjustment of data size */
+ usNextOffset = VehicleSensGetDataMasterExtOffset(ulPkgDid);
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
+ if ((usNextOffset & usBoundaryAdj) != 0) {
+ /* If you need to adjust */
+ /* Mask Lower Bit Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
+ usNextOffset = static_cast<u_int16>(usNextOffset & ~usBoundaryAdj);
+ usNextOffset = static_cast<u_int16>(usNextOffset + (u_int16)VEHICLESENS_BIT2); /* Add numbers */
+ }
+ usOffset = static_cast<u_int16>(usOffset + usNextOffset); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+ stPkgMaster.ucDNum = pst_data->pkg_num; /* To save the number of data */
+ stPkgMaster.ucDataBreak = ucDataBreak; /* Set all data undelivered flag */
+ stPkgMaster.ucDivideCnt = ucDivideCnt; /* Set total number of partitions */
+ /* Division number setting Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ stPkgMaster.ucDivideSendCnt = static_cast<uint8_t>(ucDivideSendCnt + 1);
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR,
+ pst_data->pno,
+ CID_SENSOR_PKG_INFO,
+ (u_int16)sizeof(SENSOR_PKG_MSG_VSINFO),
+ (const void *)&stPkgMaster);
+ uc_result = SENSLOG_RES_SUCCESS;
+ if (ret != RET_NORMAL) {
+ uc_result = SENSLOG_RES_FAIL;
+ }
+ SensLogWriteOutputData(SENSLOG_DATA_O_SYS_PKG, 0, pst_data->pno,
+ reinterpret_cast<uint8_t *>(&stPkgMaster),
+ sizeof(SENSOR_PKG_MSG_VSINFO), uc_result);
+
+ ucDivideSendCnt++;
+
+ /* Package delivery (split) confirmation debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
+ "### SENS RECV # FST PKG DELIVERY : cnt[%d/7]", ucDivideSendCnt);
+ if (7 <= ucDivideSendCnt) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
+ "### SENS RECV # FST PKG DELIVERY : last sns_cnt[%d][%d][%d][%d]",
+ stPkgMaster.ucData[8], stPkgMaster.ucData[9], stPkgMaster.ucData[10], stPkgMaster.ucData[11]);
+ }
+ }
+ /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+#endif
+
+/* ++ PastModel002 response DR */
+
+/*******************************************************************************
+ * MODULE : VehicleSensEntryDeliveryCtrlDR
+ * ABSTRACT : Internal delivery destination management registration function for vehicle sensor DR
+ * FUNCTION : Internal distribution destination management table for DR,Update the shipping management table management.
+ * ARGUMENT : pst_delivery_entry : Pointer to the delivery registration information
+ * NOTE :
+ * RETURN : VEHICLE_RET_NORMAL :Successful registration
+ ******************************************************************************/
+VEHICLE_RET_API VehicleSensEntryDeliveryCtrlDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *pst_delivery_entry) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i;
+ u_int8 uc_action_type = VEHICLESENS_ACTION_TYPE_ADD;
+ int32 uc_did_flag;
+ DID ulentry_did = pst_delivery_entry->data.did;
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data = NULL;
+ VEHICLE_RET_API ret = VEHICLE_RET_NORMAL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+
+ /* Check if the data ID exists. */
+ uc_did_flag = VehicleSensCheckDid(ulentry_did);
+ if (uc_did_flag == 0) {
+ ret = VEHICLE_RET_ERROR_DID; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Check the number of registered shipments. */
+ if ((ret == VEHICLE_RET_NORMAL) &&/* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (g_stdelivery_ctrl_tbl_dr.us_dnum >= VEHICLESENS_DELIVERY_INFO_MAX)) {
+ /* Return the FULL of delivery registrations*/
+ ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* By searching for the delivery registration of the relevant DID,Hold the address. */
+ for (i = 0; i < g_stdelivery_ctrl_tbl_mng_dr.us_dnum; i++) {
+ if (g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].ul_did == ulentry_did) {
+ uc_action_type = VEHICLESENS_ACTION_TYPE_UPDATE;
+ pst_existing_mng_data = &g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i];
+ }
+ }
+
+ /* Add to the shipping management table.*/
+ VehicleSensAddDeliveryCtrlTblDR(pst_delivery_entry);
+ /* Processing when updating existing data*/
+ if (uc_action_type == VEHICLESENS_ACTION_TYPE_UPDATE) {
+ /* Update the shipping management table.*/
+ VehicleSensUpdateDeliveryCtrlTblDR(pst_existing_mng_data);
+
+ /* Update the shipping destination management table management information.*/
+ VehicleSensUpdateDeliveryCtrlTblMngDR(pst_existing_mng_data);
+ } else { /* Newly added processing*/
+ /* Add to the shipping management table management information.*/
+ VehicleSensAddDeliveryCtrlTblMngDR(pst_delivery_entry);
+ }
+ }
+ return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensMakeDeliveryPnoTblDR
+* ABSTRACT : Vehicle sensor internal delivery destination PNO table creation function for DR
+* FUNCTION : Create an internal delivery destination PNO table for DR
+* ARGUMENT : ul_did Data ID
+* Change_type Delivery Trigger
+* NOTE :
+* RETURN : VEHICLESENS_DELIVERY_PNO_TBL* Pointer to the shipping PNO table
+******************************************************************************/
+VEHICLESENS_DELIVERY_PNO_TBL* VehicleSensMakeDeliveryPnoTblDR(DID ul_did, u_int8 change_type) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i;
+ u_int8 uc_ctrl_tbl_mng_data_list;
+ u_int16 us_index = 0;
+ u_int16 us_dnum = 0;
+
+ /* Get the start index and count of the corresponding data ID. */
+ uc_ctrl_tbl_mng_data_list = static_cast<u_int8>(
+ (sizeof(g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data)) /
+ (sizeof(g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[0])));
+
+ for (i = 0; i < uc_ctrl_tbl_mng_data_list; i++) {
+ /* Stores the information of the corresponding DID.. */
+ if (g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].ul_did == ul_did) {
+ us_index = g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].us_start_idx;
+ us_dnum = g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].usdlvry_entry_num;
+ break;
+ }
+ }
+
+ /* Create a PNO list */
+ (void)memset(reinterpret_cast<void *>(&g_stdelivery_pno_tbl_dr),
+ static_cast<int32>(0),
+ (size_t)sizeof(g_stdelivery_pno_tbl_dr));
+ if (change_type == VEHICLESENS_CHGTYPE_CHG) {
+ /* Processing when delivery timing is changed*/
+ for (i = 0; i < us_dnum; i++) {
+ /* Functionalization by Increasing Structure Members */
+ VehicleSensAddPnoTblDR(us_index);
+ us_index = g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_link_idx;
+ }
+ } else {
+ /* Processing when delivery timing is update */
+ for (i = 0; i < us_dnum; i++) {
+ if (VEHICLE_DELIVERY_TIMING_UPDATE == g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].uc_chg_type) {
+ /* Functionalization by Increasing Structure Members */
+ VehicleSensAddPnoTblDR(us_index);
+ }
+ us_index = g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_link_idx;
+ }
+ }
+
+ return(&g_stdelivery_pno_tbl_dr);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensAddPnoTblDR
+* ABSTRACT : Vehicle sensor DR internal delivery destination PNO table addition function
+* FUNCTION : Add to the internal DR shipping destination PNO table.
+* ARGUMENT : us_index : Index of the referenced destination management table
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddPnoTblDR(u_int16 us_index) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int16 us_pno_tbl_idx;
+
+ us_pno_tbl_idx = g_stdelivery_pno_tbl_dr.us_dnum;
+ g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].us_pno = \
+ g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_pno;
+ g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].us_pkg_start_idx = \
+ g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_pkg_start_idx;
+ g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].us_pkg_end_idx = \
+ g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_pkg_end_idx;
+ g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].uc_method = \
+ g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].uc_method;
+ g_stdelivery_pno_tbl_dr.us_dnum++;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensAddDeliveryCtrlTblDR
+* ABSTRACT : Vehicle sensor DR internal delivery destination management table addition function
+* FUNCTION : Add to the DR internal shipping management table.
+* ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddDeliveryCtrlTblDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *pst_delivery_entry) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLESENS_DELIVERY_CTRL_TBL_DATA *pst_ctrl_data;
+
+ pst_ctrl_data = &g_stdelivery_ctrl_tbl_dr.st_ctrl_data[g_stdelivery_ctrl_tbl_dr.us_dnum];
+ pst_ctrl_data->ul_did = pst_delivery_entry->data.did;
+ pst_ctrl_data->us_pno = pst_delivery_entry->data.pno;
+ pst_ctrl_data->uc_chg_type = pst_delivery_entry->data.delivery_timing;
+ pst_ctrl_data->uc_ctrl_flg = pst_delivery_entry->data.ctrl_flg;
+ pst_ctrl_data->us_link_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->us_pkg_start_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->us_pkg_end_idx = VEHICLESENS_LINK_INDEX_END;
+ pst_ctrl_data->uc_method = VEHICLESENS_DELIVERY_METHOD_NORMAL;
+ g_stdelivery_ctrl_tbl_dr.us_dnum = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum + 1);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensAddDeliveryCtrlTblMngDR
+* ABSTRACT : Internal delivery destination management table management addition function for vehicle sensor DR
+* FUNCTION : Add to the DR internal shipping management table management.
+* ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensAddDeliveryCtrlTblMngDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *pst_delivery_entry) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_ctrl_mng_data;
+
+ pst_ctrl_mng_data = &g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[g_stdelivery_ctrl_tbl_mng_dr.us_dnum];
+ pst_ctrl_mng_data->ul_did = pst_delivery_entry->data.did;
+ pst_ctrl_mng_data->us_start_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
+ pst_ctrl_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
+ pst_ctrl_mng_data->usdlvry_entry_num++;
+ g_stdelivery_ctrl_tbl_mng_dr.us_dnum++;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : VehicleSensUpdateDeliveryCtrlTblMngDR
+ * ABSTRACT : Internal delivery destination management table management update function for vehicle sensor DR
+ * FUNCTION : Update the internal delivery destination management table management for DR.
+ * ARGUMENT : *pst_existing_mng_data : Pointer to the previous data information with the same data ID
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensUpdateDeliveryCtrlTblMngDR(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Update only the end index and the number of registered shipping destinations. */
+ pst_existing_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
+ pst_existing_mng_data->usdlvry_entry_num++;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensUpdateDeliveryCtrlTblDR
+* ABSTRACT : Vehicle sensor DR internal delivery destination management table update function
+* FUNCTION : Update the internal distribution destination management table for DR.
+* ARGUMENT : *pst_existing_mng_data : Pointer to the previous data information with the same data ID
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensUpdateDeliveryCtrlTblDR(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Update Link Index Only.
+ For indexes of usEndIdx values matching the data IDs in the target management table
+ Making usLinkIdx an Index-Registered Index */
+ g_stdelivery_ctrl_tbl_dr.st_ctrl_data[pst_existing_mng_data->us_end_idx].us_link_idx =
+ static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : VehicleSensDeliveryProcDR
+ * ABSTRACT : Internal Data Delivery Process for Vehicle Sensor DR
+ * FUNCTION : Deliver data to internal DR destinations.
+ * ARGUMENT : ul_did :Data ID
+ * uc_chg_type :Delivery timing
+ * uc_get_method :Acquisition method
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensDeliveryProcDR(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method) {
+ return;
+}
+
+/**
+ * @brief
+ * Obtain dump info(g_stdelivery_ctrl_tbl)
+ *
+ * @param[out] pbuf Dump information
+ */
+void VehicleSensGetDebugDeliveryCtrlTbl(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[256];
+ u_int16 i;
+
+ memset(&buf, 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&(buf)),
+ 32,
+ "Delivery-Tbl\n DNum:%d", g_stdelivery_ctrl_tbl.us_dnum);
+ for (i = 0; i < g_stdelivery_ctrl_tbl.us_dnum; i++) {
+ if (i >= 30) {
+ break;
+ }
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] did:0x%08x, pno:0x%04x, chgT:0x%02x, ctrlFg:0x%02x, "\
+ "lnkidx:0x%04x, pkgSidx:0x%04x, pkgEidx:0x%04x, Mth:0x%02x",
+ i,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].ul_did,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pno,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_chg_type,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_ctrl_flg,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_link_idx,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pkg_start_idx,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pkg_end_idx,
+ g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_method);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ }
+ memcpy(pbuf, &buf[0], sizeof(buf));
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Obtain dump info(g_stdelivery_ctrl_tbl_mng)
+ *
+ * @param[out] pbuf Dump information
+ */
+void VehicleSensGetDebugDeliveryCtrlTblMng(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[256];
+ u_int16 i;
+
+ memset(&buf, 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&(buf)),
+ 32,
+ "Delivery-TblMng\n DNum:%d",
+ g_stdelivery_ctrl_tbl_mng.us_dnum);
+ for (i = 0; i < g_stdelivery_ctrl_tbl_mng.us_dnum; i++) {
+ if (i >= 60) {
+ break;
+ }
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] did:0x%08x, Sidx:0x%04x, Eidx:0x%04x, EntNum:0x%04x",
+ i,
+ g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did,
+ g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].us_start_idx,
+ g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].us_end_idx,
+ g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].usdlvry_entry_num);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ }
+ memcpy(pbuf, &buf[0], sizeof(buf));
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Obtain dump info(g_stpkgdelivery_tbl_mng)
+ *
+ * @param[out] pbuf Dump information
+ */
+void VehicleSensGetDebugPkgDeliveryTblMng(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[256];
+ u_int16 i;
+
+ memset(&buf, 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&(buf)),
+ 32,
+ "Delivery-PkgTblMng\n DNum:%d",
+ g_stpkgdelivery_tbl_mng.us_dnum);
+ for (i = 0; i < g_stpkgdelivery_tbl_mng.us_dnum; i++) {
+ if (i >= 100) {
+ break;
+ }
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] did:0x%08x, Didx:0x%04x",
+ i,
+ g_stpkgdelivery_tbl_mng.st_pkg_data[i].ul_did,
+ g_stpkgdelivery_tbl_mng.st_pkg_data[i].usdlvry_idx);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ }
+ memcpy(pbuf, &buf[0], sizeof(buf));
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Obtain dump info(g_stdelivery_pno_tbl)
+ *
+ * @param[out] pbuf Dump information
+ */
+void VehicleSensGetDebugDeliveryPnoTbl(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[256];
+ u_int16 i;
+
+ memset(&buf, 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&(buf)),
+ 32,
+ "Delivery-PnoTbl\n DNum:%d",
+ g_stdelivery_pno_tbl.us_dnum);
+ for (i = 0; i < g_stdelivery_pno_tbl.us_dnum; i++) {
+ if (i >= 60) {
+ break;
+ }
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] pno:0x%04x, pkgSidx:0x%04x, pkgEidx:0x%04x, Mth:0x%02x",
+ i,
+ g_stdelivery_pno_tbl.st_pno_data[i].us_pno,
+ g_stdelivery_pno_tbl.st_pno_data[i].us_pkg_start_idx,
+ g_stdelivery_pno_tbl.st_pno_data[i].us_pkg_end_idx,
+ g_stdelivery_pno_tbl.st_pno_data[i].uc_method);
+ _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
+ }
+ memcpy(pbuf, &buf[0], sizeof(buf));
+ return;
+}
+// LCOV_EXCL_STOP
+/* -- PastModel002 support DR */
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GPSInterruptFlag.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GPSInterruptFlag.cpp
new file mode 100755
index 0000000..eefbc51
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GPSInterruptFlag.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_GPSInterruptFlag.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_INTERRUPT_FLAG)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGpsInterruptFlag; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief VehicleSensInitGpsInterruptFlag<BR>
+ Vehicle sensor SPEED_PULSE initialization function
+@outline SPEED_PULSE_FLAG initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitGpsInterruptFlag(void) {
+ memset(&gstGpsInterruptFlag, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGpsInterruptFlag.ul_did = POSHAL_DID_GPS_INTERRUPT_FLAG;
+ gstGpsInterruptFlag.us_size = VEHICLE_DSIZE_GPS_INTERRUPT_FLAG;
+
+ gstGpsInterruptFlag.uc_data[0] = VEHICLE_DINIT_GPS_INTERRUPT_FLAG;
+}
+
+/***************************************************************************
+@brief NAV-CLOCK SET vehicle sensor function
+@outline To update the master data NAV-CLOCK.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetGpsInterruptFlag(const LSDRV_LSDATA_G *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsInterruptFlag;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-CLOCK GET
+@outline Master Data provides the NAV-CLOCK
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetGpsInterruptFlag(VEHICLESENS_DATA_MASTER *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_masterdata;
+
+ pst_masterdata = &gstGpsInterruptFlag;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_masterdata->ul_did;
+ pst_data->us_size = pst_masterdata->us_size;
+ pst_data->uc_rcvflag = pst_masterdata->uc_rcvflag;
+ pst_data->uc_snscnt = pst_masterdata->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_masterdata->uc_data), (size_t)(pst_masterdata->us_size));
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna.cpp
new file mode 100755
index 0000000..bbf4965
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna.cpp
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GpsAntenna.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS_ANTENNA)
+ * Module configuration :VehicleSensGetGpsAntenna() Vehicle Sensor GPS_ANTENNA GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGpsAntenna
+* ABSTRACT : Vehicle sensor GPS_ANTENNA GET function
+* FUNCTION : Provide the GPS_ANTENNA data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGpsAntenna(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGpsAntennal(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntennaStatus.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntennaStatus.cpp
new file mode 100755
index 0000000..dc950cc
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntennaStatus.cpp
@@ -0,0 +1,112 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GpsAntennaStatus.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS_ANTENNA)
+ * Module configuration :VehicleSensInitGpsAntennaStatus() Vehicle sensor GPS_ANTENNA_STATUS initialization function
+ * :VehicleSensSetGpsAntennaStatus() Vehicle sensor GPS_ANTENNA_STATUS SET function
+ * :VehicleSensGetGpsAntennaStatus() Vehicle sensor GPS_ANTENNA_STATUS GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS gstGpsAntennaStatus; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGpsAntennaStatus
+* ABSTRACT : Vehicle sensor GPS_ANTENNA_STATUS initialization function
+* FUNCTION : GPS_ANTENNA_STATUS data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGpsAntennaStatus(void) {
+ (void)memset(reinterpret_cast<void *>(&gstGpsAntennaStatus), 0, sizeof(gstGpsAntennaStatus));
+ gstGpsAntennaStatus.ul_did = POSHAL_DID_GPS_ANTENNA;
+ gstGpsAntennaStatus.us_size = VEHICLE_DSIZE_GPS_ANTENNA;
+ gstGpsAntennaStatus.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ gstGpsAntennaStatus.uc_sensor_cnt = 0U;
+ gstGpsAntennaStatus.uc_data = VEHICLE_DINIT_GPS_ANTENNA;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGpsAntennaStatus
+* ABSTRACT : Vehicle sensor GPS_ANTENNA_STATUS SET function
+* FUNCTION : Update the GPS_ANTENNA_STATUS data master
+* ARGUMENT : *pst_data : Pointer to received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* : VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGpsAntennaStatus(const LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS *pst_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGpsAntennaStatus;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), (size_t)(pst_data->uc_size));
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int16)pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
+ }
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGpsAntennaStatus
+* ABSTRACT : Vehicle sensor GPS_ANTENNA_STATUS GET function
+* FUNCTION : Provide the GPS_ANTENNA_STATUS data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGpsAntennaStatus(VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS *pst_master;
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGpsAntennaStatus;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_sensor_cnt = pst_master->uc_sensor_cnt;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
+ (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna_l.cpp
new file mode 100755
index 0000000..00db159
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsAntenna_l.cpp
@@ -0,0 +1,97 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GpsAntenna_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS_ANTENNA)
+ * Module configuration :VehicleSensInitGpsAntennal() Vehicle sensor GPS_ANTENNA initialization function
+ * :VehicleSensSetGpsAntennal() Vehicle Sensor GPS_ANTENNA SET Function
+ * :VehicleSensGetGpsAntennal() Vehicle Sensor GPS_ANTENNA GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGpsAntenna_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGpsAntennal
+* ABSTRACT : Vehicle sensor GPS_ANTENNA initialization function
+* FUNCTION : GPS_ANTENNA data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGpsAntennal(void) {
+ memset(&gstGpsAntenna_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGpsAntenna_l.ul_did = POSHAL_DID_GPS_ANTENNA;
+ gstGpsAntenna_l.us_size = VEHICLE_DSIZE_GPS_ANTENNA;
+ gstGpsAntenna_l.uc_data[0] = VEHICLE_DINIT_GPS_ANTENNA;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGpsAntennal
+* ABSTRACT : Vehicle Sensor GPS_ANTENNA SET Function
+* FUNCTION : Update the GPS_ANTENNA data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGpsAntennal(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsAntenna_l;
+
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGpsAntennal
+* ABSTRACT : Vehicle Sensor GPS_ANTENNA GET Function
+* FUNCTION : Provide the GPS_ANTENNA data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGpsAntennal(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsAntenna_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift.cpp
new file mode 100755
index 0000000..955e161
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift.cpp
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsClockDrift.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS clock drift data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ * @param[in] u_int8
+ */
+void VehicleSensGetGpsClockDrift(SENSOR_MSG_GPSDATA_DAT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetGpsClockDriftG(pst_data);
+ break;
+ }
+
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift_g.cpp
new file mode 100755
index 0000000..ecfbb4f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockDrift_g.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsClockDrift_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gGpsClockDrift_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS clock drift data master initialization process
+ */
+void VehicleSensInitGpsClockDriftG(void) {
+ int32_t l_gps_clock_drift;
+
+ memset(&gGpsClockDrift_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gGpsClockDrift_g.ul_did = POSHAL_DID_GPS_CLOCK_DRIFT;
+ /** Data size setting */
+ gGpsClockDrift_g.us_size = sizeof(int32_t);
+ /** Data content setting */
+ l_gps_clock_drift = 0xFFFFFFFF;
+ memcpy(&gGpsClockDrift_g.uc_data[0], &l_gps_clock_drift, sizeof(l_gps_clock_drift));
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS clock drift data master SET process
+ *
+ * @param[in] int32_t*
+ *
+ * @return u_int8
+ */
+u_int8 VehicleSensSetGpsClockDriftG(const int32_t *p_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gGpsClockDrift_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, p_data, sizeof(int32_t));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GPS_CLOCK_DRIFT;
+ pst_master->us_size = sizeof(int32_t);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, p_data, sizeof(int32_t));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * GPS clock drift data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ */
+void VehicleSensGetGpsClockDriftG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gGpsClockDrift_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq.cpp
new file mode 100755
index 0000000..39fac42
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq.cpp
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsClockFreq.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS clock frequency data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ * @param[in] u_int8
+ */
+void VehicleSensGetGpsClockFreq(SENSOR_MSG_GPSDATA_DAT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetGpsClockFreqG(pst_data);
+ break;
+ }
+
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq_g.cpp
new file mode 100755
index 0000000..85cbdd6
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsClockFreq_g.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsClockFreq_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gGpsClockFreq_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Initialization of GPS clock frequency data master
+ */
+void VehicleSensInitGpsClockFreqG(void) {
+ uint32_t ul_gps_clock_freq;
+
+ memset(&gGpsClockFreq_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gGpsClockFreq_g.ul_did = POSHAL_DID_GPS_CLOCK_FREQ;
+ /** Data size setting */
+ gGpsClockFreq_g.us_size = sizeof(uint32_t);
+ /** Data content setting */
+ ul_gps_clock_freq = 0xFFFFFFFF;
+ memcpy(&gGpsClockFreq_g.uc_data[0], &ul_gps_clock_freq, sizeof(ul_gps_clock_freq));
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS clock frequency data master SET process
+ *
+ * @param[in] uint32_t*
+ *
+ * @return u_int8
+ */
+u_int8 VehicleSensSetGpsClockFreqG(const uint32_t *p_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gGpsClockFreq_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, p_data, sizeof(uint32_t));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GPS_CLOCK_FREQ;
+ pst_master->us_size = sizeof(uint32_t);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, p_data, sizeof(uint32_t));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * GPS clock frequency data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ */
+void VehicleSensGetGpsClockFreqG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gGpsClockFreq_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsCounter_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsCounter_g.cpp
new file mode 100755
index 0000000..d4aba14
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsCounter_g.cpp
@@ -0,0 +1,98 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GpsCounter_g.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS_COUNTER)
+ * Module configuration :VehicleSensInitGpsCounterg() Vehicle sensor GPS_COUNTER initialization function
+ * :VehicleSensSetGpsCounterg() Vehicle Sensor GPS_COUNTER SET Function
+ * :VehicleSensGetGpsCounterg() Vehicle Sensor GPS_COUNTER GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGpsCounter_g; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGpsCounterg
+* ABSTRACT : Vehicle sensor GPS_COUNTER initialization function
+* FUNCTION : GPS_COUNTER data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGpsCounterg(void) {
+ memset(&gstGpsCounter_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGpsCounter_g.ul_did = VEHICLE_DID_GPS_COUNTER;
+ gstGpsCounter_g.us_size = VEHICLE_DSIZE_GPS_COUNTER;
+ gstGpsCounter_g.uc_data[0] = VEHICLE_DINIT_GPS_COUNTER;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGpsCounterg
+* ABSTRACT : Vehicle Sensor GPS_COUNTER SET Function
+* FUNCTION : Update the GPS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to CAN received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGpsCounterg(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsCounter_g;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int8)pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGpsCounterg
+* ABSTRACT : Vehicle Sensor GPS_COUNTER GET Function
+* FUNCTION : Provide the GPS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGpsCounterg(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsCounter_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsNmea_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsNmea_g.cpp
new file mode 100755
index 0000000..a7b733e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsNmea_g.cpp
@@ -0,0 +1,89 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsNmea_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files
+ *---------------------------------------------------------------------------------*/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "gps_hal.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGpsNmea_g; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor GPS_NMEA initialization processing
+ */
+void VehicleSensInitGpsNmeaG(void) {
+ memset(&gstGpsNmea_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+ gstGpsNmea_g.ul_did = POSHAL_DID_GPS_NMEA;
+ gstGpsNmea_g.us_size = VEHICLE_DSIZE_GPS_FORMAT;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GPS_NMEA SET processing
+ *
+ * @param[in] Pointer to received message data
+ *
+ * @return VEHICLESENS_EQ No data change<BR>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGpsNmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGpsNmea_g;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle sensor GPS_NMEA GET processing
+ *
+ * @param[out] pst_data Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGpsNmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGpsNmea_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime.cpp
new file mode 100755
index 0000000..8c23e3e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime.cpp
@@ -0,0 +1,53 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsTime.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS time information data master GET processing
+ *
+ * @param[out] VEHICLESENS_DATA_MASTER*
+ * @param[in] u_int8
+ */
+void VehicleSensGetGpsTime(SENSOR_MSG_GPSDATA_DAT *pst_data, u_int8 uc_get_method) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPSorNAVI */
+ VehicleSensGetGpsTimeG(pst_data);
+ break;
+ }
+
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw.cpp
new file mode 100755
index 0000000..9637b72
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw.cpp
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsTimeRaw.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Raw GPS time information data master GET processing
+ *
+ * @param[out] VEHICLESENS_DATA_MASTER*
+ * @param[in] u_int8
+ */
+void VehicleSensGetGpsTimeRaw(SENSOR_MSG_GPSDATA_DAT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetGpsTimeRawG(pst_data);
+ break;
+ }
+
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw_g.cpp
new file mode 100755
index 0000000..52cda83
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTimeRaw_g.cpp
@@ -0,0 +1,107 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsTimeRaw_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstGpsTimeRaw_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS time information data master initialization processing
+ */
+void VehicleSensInitGpsTimeRawG(void) {
+ SENSOR_GPSTIME_RAW st_gps_time_raw;
+
+ memset(&gstGpsTimeRaw_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstGpsTimeRaw_g.ul_did = POSHAL_DID_GPS_TIME_RAW;
+ /** Data size setting */
+ gstGpsTimeRaw_g.us_size = sizeof(SENSOR_GPSTIME_RAW);
+ /** Data content setting */
+ memset(&st_gps_time_raw, 0x00, sizeof(st_gps_time_raw));
+ memcpy(&gstGpsTimeRaw_g.uc_data[0], &st_gps_time_raw, sizeof(st_gps_time_raw));
+
+ return;
+}
+
+/**
+ * @brief
+ * Raw GPS Time Data Master SET Processing
+ *
+ * @param[in] SENSOR_GPSTIME_RAW*
+ *
+ * @return u_int8
+ */
+u_int8 VehicleSensSetGpsTimeRawG(const SENSOR_GPSTIME_RAW *pst_gps_time_raw) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsTimeRaw_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_gps_time_raw, sizeof(SENSOR_GPSTIME_RAW));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GPS_TIME_RAW;
+ pst_master->us_size = sizeof(SENSOR_GPSTIME_RAW);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_gps_time_raw, sizeof(SENSOR_GPSTIME_RAW));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "year=%04d, month=%02d, date=%02d, hour=%02d, minute=%02d, second=%02d, tdsts=%d",
+ pst_gps_time_raw->utc.year, pst_gps_time_raw->utc.month, pst_gps_time_raw->utc.date,
+ pst_gps_time_raw->utc.hour, pst_gps_time_raw->utc.minute,
+ pst_gps_time_raw->utc.second, pst_gps_time_raw->tdsts);
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Raw GPS time information data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ */
+void VehicleSensGetGpsTimeRawG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsTimeRaw_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime_g.cpp
new file mode 100755
index 0000000..404e60e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GpsTime_g.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GpsTime_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstGpsTime_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS time information data master initialization processing
+ */
+void VehicleSensInitGpsTimeG(void) {
+ SENSOR_MSG_GPSTIME st_gps_time;
+
+ memset(&gstGpsTime_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstGpsTime_g.ul_did = POSHAL_DID_GPS_TIME;
+ /** Data size setting */
+ gstGpsTime_g.us_size = sizeof(SENSOR_MSG_GPSTIME);
+ /** Data content setting */
+ memset(&st_gps_time, 0x00, sizeof(st_gps_time));
+ memcpy(&gstGpsTime_g.uc_data[0], &st_gps_time, sizeof(st_gps_time));
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS time information data master SET process
+ *
+ * @param[in] SENSOR_MSG_GPS*
+ *
+ * @return u_int8
+ */
+u_int8 VehicleSensSetGpsTimeG(const SENSOR_MSG_GPSTIME *pst_gps_time) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsTime_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_gps_time, sizeof(SENSOR_MSG_GPSTIME));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GPS_TIME;
+ pst_master->us_size = sizeof(SENSOR_MSG_GPSTIME);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_gps_time, sizeof(SENSOR_MSG_GPSTIME));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * GPS time information data master GET processing
+ *
+ * @param[out] SENSOR_MSG_GPS*
+ */
+void VehicleSensGetGpsTimeG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGpsTime_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp
new file mode 100755
index 0000000..8f84200
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp
@@ -0,0 +1,99 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_Gps_CWORD82_FullBinary_g.cpp
+ * System name :_CWORD72_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS__CWORD82__FULLBINARY)
+ * Module configuration :VehicleSensInitGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY initialization function
+ * :VehicleSensSetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY SET function
+ * :VehicleSensGetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "VehicleSens_Common.h"
+#include "gps_hal.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGps_CWORD82_FullBinary_g; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGps_CWORD82_FullBinaryG
+* ABSTRACT : Vehicle sensor GPS_VERSION initialization function
+* FUNCTION : GPS__CWORD82__FULLBINARY data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGps_CWORD82_FullBinaryG(void) {
+ memset(&gstGps_CWORD82_FullBinary_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+ gstGps_CWORD82_FullBinary_g.ul_did = POSHAL_DID_GPS__CWORD82__FULLBINARY;
+ /* _CWORD82_-only format with a fixed magic number */
+ /* GPS antenna connection information(1byte) + Sensor Counter(1byte) + 191 */
+ gstGps_CWORD82_FullBinary_g.us_size = (VEHICLE_DSIZE_GPS_ANTENNA + VEHICLE_DSIZE_SNS_COUNTER + GPS_CMD_FULLBIN_SZ);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGps_CWORD82_FullBinaryG
+* ABSTRACT : Vehicle sensor GPS_VERSION SET function
+* FUNCTION : Update the GPS__CWORD82__FULLBINARY data master
+* ARGUMENT : *pst_data : Pointer to CAN received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGps_CWORD82_FullBinaryG(const SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+ VehicleSensSetGpsVersion(pst_data); /* Pass the _CWORD82_ binary */
+
+ pst_master = &gstGps_CWORD82_FullBinary_g;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGps_CWORD82_FullBinaryG
+* ABSTRACT : Vehicle sensor GPS_VERSION GET function
+* FUNCTION : Provide the GPS__CWORD82__FULLBINARY data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGps_CWORD82_FullBinaryG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGps_CWORD82_FullBinary_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
new file mode 100755
index 0000000..9f69054
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
+ * System name :_CWORD72_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS__CWORD82__FULLBINARY)
+ * Module configuration :VehicleSensInitGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY initialization function
+ * :VehicleSensSetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY SET function
+ * :VehicleSensGetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "gps_hal.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGps_CWORD82_Nmea_g; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGps_CWORD82_NmeaG
+* ABSTRACT : Vehicle sensor GPS__CWORD82__NMEA initialization function
+* FUNCTION : GPS__CWORD82__NMEA data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGps_CWORD82_NmeaG(void) {
+ memset(&gstGps_CWORD82_Nmea_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+ gstGps_CWORD82_Nmea_g.ul_did = VEHICLE_DID_GPS__CWORD82__NMEA;
+ /* _CWORD82_-only format with a fixed magic number */
+ gstGps_CWORD82_Nmea_g.us_size = 3 /* NMEA reception flag + GPS antenna connection information + sensor counter */
+ + VEHICLE_DSIZE_GPS_NMEA_DRMC
+ + VEHICLE_DSIZE_GPS_NMEA_GSA
+ + VEHICLE_DSIZE_GPS_NMEA_GSV_1
+ + VEHICLE_DSIZE_GPS_NMEA_GSV_2
+ + VEHICLE_DSIZE_GPS_NMEA_GSV_3
+ + VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_3;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGps_CWORD82_NmeaG
+* ABSTRACT : Vehicle sensor GPS_NMEA SET function
+* FUNCTION : Update the GPS__CWORD82___CWORD44__GP4 data master
+* ARGUMENT : *pst_data : Pointer to CAN received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetGps_CWORD82_NmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGps_CWORD82_Nmea_g;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGps_CWORD82_NmeaG
+* ABSTRACT : Vehicle sensor GPS__CWORD82__NMEA GET function
+* FUNCTION : GPS__CWORD82__NMEA Provides a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGps_CWORD82_NmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGps_CWORD82_Nmea_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82__CWORD44_Gp4_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82__CWORD44_Gp4_g.cpp
new file mode 100755
index 0000000..4ce8678
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Gps_CWORD82__CWORD44_Gp4_g.cpp
@@ -0,0 +1,101 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
+ * System name :_CWORD72_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GPS__CWORD82__FULLBINARY)
+ * Module configuration :VehicleSensInitGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY initialization function
+ * :VehicleSensSetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY SET function
+ * :VehicleSensGetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "gps_hal.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGps_CWORD82__CWORD44_Gp4_g; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGps_CWORD82__CWORD44_Gp4G
+* ABSTRACT : Vehicle sensor GPS__CWORD44__GP4 initialization function
+* FUNCTION : GPS__CWORD82___CWORD44__GP4 data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGps_CWORD82__CWORD44_Gp4G(void) {
+ memset(&gstGps_CWORD82__CWORD44_Gp4_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+ gstGps_CWORD82__CWORD44_Gp4_g.ul_did = POSHAL_DID_GPS__CWORD82___CWORD44_GP4;
+ /* Initialize with _CWORD82_ only and size fixed VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4 */
+ /* GPS antenna connection information(1byte) + Sensor Counter(1byte) + VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4 */
+ gstGps_CWORD82__CWORD44_Gp4_g.us_size = (VEHICLE_DSIZE_GPS_ANTENNA + VEHICLE_DSIZE_SNS_COUNTER) \
+ + (VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGps_CWORD82__CWORD44_Gp4G
+* ABSTRACT : Vehicle sensor GPS_NMEA SET function
+* FUNCTION : Update the GPS__CWORD82___CWORD44__GP4 data master
+* ARGUMENT : *pst_data : Pointer to CAN received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetGps_CWORD82__CWORD44_Gp4G(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGps_CWORD82__CWORD44_Gp4_g;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int8)pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGps_CWORD82__CWORD44_Gp4G
+* ABSTRACT : Vehicle sensor GPS__CWORD44__GP4 GET function
+* FUNCTION : Provide the GPS__CWORD82___CWORD44__GP4 data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGps_CWORD82__CWORD44_Gp4G(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstGps_CWORD82__CWORD44_Gp4_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX.cpp
new file mode 100755
index 0000000..e68edc6
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX.cpp
@@ -0,0 +1,119 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsX.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GSNS_X)
+ * Module configuration :VehicleSensGetGsnsX() Vehicle sensor GSNS_X GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsX
+* ABSTRACT : Vehicle sensor GSNS_X GET function
+* FUNCTION : Provide the GSNS_X data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsX(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsXl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsXExt
+* ABSTRACT : Vehicle sensor GSNS_X GET function
+* FUNCTION : Provide the GSNS_X data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsXExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsXExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+#endif
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X GET function
+ *
+ * Provide the GSNS_X data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGsnsXFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsXFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXExt_l.cpp
new file mode 100755
index 0000000..4a481bb
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXExt_l.cpp
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsXExt_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_X)
+ * Module configuration :VehicleSensInitGsnsXExtl() Vehicle sensor GSNS_X initialization function
+ * :VehicleSensSetGsnsXExtlG() Vehicle sensor GSNS_X SET function
+ * :VehicleSensGetGsnsXExtl() Vehicle sensor GSNS_X GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGsnsXExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsXExtl
+* ABSTRACT : Vehicle sensor GSNS_X initialization function
+* FUNCTION : GSNS_X data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsXExtl(void) {
+ memset(&gstGsnsXExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstGsnsXExt_l.ul_did = POSHAL_DID_GSNS_X;
+ gstGsnsXExt_l.us_size = VEHICLE_DSIZE_GSNS_X_EXT_INIT;
+ gstGsnsXExt_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X SET function
+ *
+ * Update the GSNS_X data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ */
+void VehicleSensSetGsnsXExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGsnsXExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Store the latest one in the internal data structure */
+ us_start = gstPkgTempExt.start_point[GsnsX]; /* Location to store one received message */
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GsnsX] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GSNS_X_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsXExtl
+* ABSTRACT : Vehicle sensor GSNS_X GET function
+* FUNCTION : Provide the GSNS_X data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsXExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGsnsXExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GsnsX];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GsnsX] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GsnsX] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXFst_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXFst_l.cpp
new file mode 100755
index 0000000..61ee990
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsXFst_l.cpp
@@ -0,0 +1,127 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GsnsXFst_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GSNS_X_FST)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST g_st_gsnsx_fst_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X initialization function
+ *
+ * GSNS_X data master initialization processing
+ */
+void VehicleSensInitGsnsXFstl(void) {
+ memset(&g_st_gsnsx_fst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ g_st_gsnsx_fst_l.ul_did = POSHAL_DID_GSNS_X_FST;
+ g_st_gsnsx_fst_l.us_size = VEHICLE_DSIZE_GSNS_X_EXT_INIT;
+ g_st_gsnsx_fst_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ g_st_gsnsx_fst_l.partition_flg = 0;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X SET function
+ *
+ * Update the GSNS_X data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGsnsXFstG(const LSDRV_LSDATA_FST_GSENSOR_X *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ pst_master = &g_st_gsnsx_fst_l;
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GSNSX_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GSNSX_FST], pst_data->uc_data, pst_data->uc_size);
+ } else { }
+ } else { }
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X GET function
+ *
+ * Provide the GSNS_X data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGsnsXFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &g_st_gsnsx_fst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX_l.cpp
new file mode 100755
index 0000000..90d16ce
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsX_l.cpp
@@ -0,0 +1,98 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsX_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_X)
+ * Module configuration :VehicleSensInitGsnsXl() Vehicle sensor GSNS_X initialization function
+ * :VehicleSensSetGsnsXlG() Vehicle sensor GSNS_X SET function
+ * :VehicleSensGetGsnsXl() Vehicle sensor GSNS_X GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGsnsX_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsXl
+* ABSTRACT : Vehicle sensor GSNS_X initialization function
+* FUNCTION : GSNS_X data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsXl(void) {
+ memset(&gstGsnsX_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGsnsX_l.ul_did = POSHAL_DID_GSNS_X;
+ gstGsnsX_l.us_size = VEHICLE_DSIZE_GSNS_X;
+ gstGsnsX_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_X SET function
+ *
+ * Update the GSNS_X data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGsnsXlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsX_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsXl
+* ABSTRACT : Vehicle sensor GSNS_X GET function
+* FUNCTION : Provide the GSNS_X data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsXl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsX_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY.cpp
new file mode 100755
index 0000000..0ab4b67
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY.cpp
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsY.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GSNS_Y)
+ * Module configuration :VehicleSensGetGsnsY() Vehicle sensor GSNS_Y GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsY
+* ABSTRACT : Vehicle sensor GSNS_Y GET function
+* FUNCTION : Provide the GSNS_Y data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsY(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsYl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsYExt
+* ABSTRACT : Vehicle sensor GSNS_Y GET function
+* FUNCTION : Provide the GSNS_Y data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsYExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsYExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+#endif
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y GET function
+ *
+ * Provide the GSNS_Y data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGsnsYFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsYFstl(pst_data);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYExt_l.cpp
new file mode 100755
index 0000000..947da7f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYExt_l.cpp
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsYExt_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_Y)
+ * Module configuration :VehicleSensInitGsnsYExtl() Vehicle sensor GSNS_Y initialization function
+ * :VehicleSensSetGsnsYExtlG() Vehicle sensor GSNS_Y SET function
+ * :VehicleSensGetGsnsYExtl() Vehicle sensor GSNS_Y GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGsnsYExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsYExtl
+* ABSTRACT : Vehicle sensor GSNS_Y initialization function
+* FUNCTION : GSNS_Y data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsYExtl(void) {
+ memset(&gstGsnsYExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstGsnsYExt_l.ul_did = POSHAL_DID_GSNS_Y;
+ gstGsnsYExt_l.us_size = VEHICLE_DSIZE_GSNS_Y_EXT_INIT;
+ gstGsnsYExt_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y SET function
+ *
+ * Update the GSNS_Y data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ */
+void VehicleSensSetGsnsYExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGsnsYExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Store the latest one in the internal data structure */
+ us_start = gstPkgTempExt.start_point[GsnsY]; /* Location to store one received message */
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GsnsY] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GSNS_Y_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsYExtl
+* ABSTRACT : Vehicle sensor GSNS_Y GET function
+* FUNCTION : Provide the GSNS_Y data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsYExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGsnsYExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GsnsY];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GsnsY] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GsnsY] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYFst_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYFst_l.cpp
new file mode 100755
index 0000000..1fc1b92
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsYFst_l.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GsnsYFst_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GSNS_Y_FST)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST g_st_gsnsy_fst_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y initialization function
+ *
+ * GSNS_Y data master initialization processing
+ */
+void VehicleSensInitGsnsYFstl(void) {
+ memset(&g_st_gsnsy_fst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ g_st_gsnsy_fst_l.ul_did = POSHAL_DID_GSNS_Y_FST;
+ g_st_gsnsy_fst_l.us_size = VEHICLE_DSIZE_GSNS_Y_EXT_INIT;
+ g_st_gsnsy_fst_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ g_st_gsnsy_fst_l.partition_flg = 0;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y SET function
+ *
+ * Update the GSNS_Y data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGsnsYFstG(const LSDRV_LSDATA_FST_GSENSOR_Y *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ pst_master = &g_st_gsnsy_fst_l;
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GSNSY_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GSNSY_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y GET function
+ *
+ * Provide the GSNS_Y data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGsnsYFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &g_st_gsnsy_fst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY_l.cpp
new file mode 100755
index 0000000..1bf2e30
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsY_l.cpp
@@ -0,0 +1,99 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsY_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_Y)
+ * Module configuration :VehicleSensInitGsnsYl() Vehicle sensor GSNS_Y initialization function
+ * :VehicleSensSetGsnsYlG() Vehicle sensor GSNS_Y SET function
+ * :VehicleSensGetGsnsYl() Vehicle sensor GSNS_Y GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGsnsY_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsYl
+* ABSTRACT : Vehicle sensor GSNS_Y initialization function
+* FUNCTION : GSNS_Y data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsYl(void) {
+ memset(&gstGsnsY_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGsnsY_l.ul_did = POSHAL_DID_GSNS_Y;
+ gstGsnsY_l.us_size = VEHICLE_DSIZE_GSNS_Y;
+ gstGsnsY_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Y SET function
+ *
+ * Update the GSNS_Y data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ *
+ */
+u_int8 VehicleSensSetGsnsYlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsY_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsYl
+* ABSTRACT : Vehicle sensor GSNS_Y GET function
+* FUNCTION : Provide the GSNS_Y data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsYl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsY_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ.cpp
new file mode 100755
index 0000000..ec865c3
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ.cpp
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsY.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GSNS_Z)
+ * Module configuration :VehicleSensGetGsnsZ() Vehicle sensor GSNS_Z GET function
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsZ
+* ABSTRACT : Vehicle sensor GSNS_Z GET function
+* FUNCTION : Provide the GSNS_Z data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsZ(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsZl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsZExt
+* ABSTRACT : Vehicle sensor GSNS_Z GET function
+* FUNCTION : Provide the GSNS_Z data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsZExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsZExtl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z GET function
+ *
+ * Provide the GSNS_Z data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGsnsZFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGsnsZFstl(pst_data);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZExt_l.cpp
new file mode 100755
index 0000000..9dc1e39
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZExt_l.cpp
@@ -0,0 +1,142 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsZExt_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_Z)
+ * Module configuration :VehicleSensInitGsnsZExtl() Vehicle sensor GSNS_Z initialization function
+ * :VehicleSensSetGsnsZExtlG() Vehicle sensor GSNS_Z SET function
+ * :VehicleSensGetGsnsZExtl() Vehicle sensor GSNS_Z GET function
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGsnsZExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsZExtl
+* ABSTRACT : Vehicle sensor GSNS_Z initialization function
+* FUNCTION : GSNS_Z data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsZExtl(void) {
+ memset(&gstGsnsZExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstGsnsZExt_l.ul_did = POSHAL_DID_GSNS_Z;
+ gstGsnsZExt_l.us_size = VEHICLE_DSIZE_GSNS_Z_EXT_INIT;
+ gstGsnsZExt_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z SET function
+ *
+ * Update the GSNS_Z data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ */
+void VehicleSensSetGsnsZExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGsnsZExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Store the latest one in the internal data structure */
+ us_start = gstPkgTempExt.start_point[GsnsZ]; /* Location to store one received message */
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GsnsZ] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GSNS_Z_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsZExtl
+* ABSTRACT : Vehicle sensor GSNS_Z GET function
+* FUNCTION : Provide the GSNS_Z data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsZExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGsnsZExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GsnsZ];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GsnsZ] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GsnsZ] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZFst_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZFst_l.cpp
new file mode 100755
index 0000000..a69bb87
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZFst_l.cpp
@@ -0,0 +1,127 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GsnsZFst_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GSNS_Z_FST)
+ */
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST g_st_gsnsz_fst_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z initialization function
+ *
+ * GSNS_Z data master initialization processing
+ */
+void VehicleSensInitGsnsZFstl(void) {
+ memset(&g_st_gsnsz_fst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ g_st_gsnsz_fst_l.ul_did = POSHAL_DID_GSNS_Z_FST;
+ g_st_gsnsz_fst_l.us_size = VEHICLE_DSIZE_GSNS_Z_EXT_INIT;
+ g_st_gsnsz_fst_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ g_st_gsnsz_fst_l.partition_flg = 0;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z SET function
+ *
+ * Update the GSNS_Z data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGsnsZFstG(const LSDRV_LSDATA_FST_GSENSOR_Z *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ pst_master = &g_st_gsnsz_fst_l;
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GSNSZ_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GSNSZ_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z GET function
+ *
+ * Provide the GSNS_Z data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGsnsZFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &g_st_gsnsz_fst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ_l.cpp
new file mode 100755
index 0000000..8614535
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GsnsZ_l.cpp
@@ -0,0 +1,97 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GsnsZ_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_Z)
+ * Module configuration :VehicleSensInitGsnsZl() Vehicle sensor GSNS_Z initialization function
+ * :VehicleSensSetGsnsZlG() Vehicle sensor GSNS_Z SET function
+ * :VehicleSensGetGsnsZl() Vehicle sensor GSNS_Z GET function
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGsnsZ_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGsnsZl
+* ABSTRACT : Vehicle sensor GSNS_Z initialization function
+* FUNCTION : GSNS_Z data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGsnsZl(void) {
+ memset(&gstGsnsZ_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGsnsZ_l.ul_did = POSHAL_DID_GSNS_Z;
+ gstGsnsZ_l.us_size = VEHICLE_DSIZE_GSNS_Z;
+ gstGsnsZ_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor GSNS_Z SET function
+ *
+ * Update the GSNS_Z data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ *
+ */
+u_int8 VehicleSensSetGsnsZlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsZ_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGsnsZl
+* ABSTRACT : Vehicle sensor GSNS_Z GET function
+* FUNCTION : Provide the GSNS_Z data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGsnsZl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGsnsZ_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroConnectStatus.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroConnectStatus.cpp
new file mode 100755
index 0000000..d6fee30
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroConnectStatus.cpp
@@ -0,0 +1,110 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroConnectStatus.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_CONNECT_STATUS)
+ * Module configuration :VehicleSensInitGyroConnectStatus() Vehicle Sensor GYRO CONNECT STATUS Initialization Functions
+ * :VehicleSensSetGyroConnectStatus() Vehicle Sensor GYRO CONNECT STATUS SET Functions
+ * :VehicleSensGetGyroConnectStatus() Vehicle Sensor GYRO CONNECT STATUS GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS gstGyroConnectStatus; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroConnectStatus
+* ABSTRACT : Vehicle sensor GYRO_CONNECT_STATUS initialization function
+* FUNCTION : GYRO_CONNECT_STATUS data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroConnectStatus(void) {
+ (void)memset(reinterpret_cast<void *>(&(gstGyroConnectStatus)), static_cast<int>(0x00),
+ sizeof(VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS));
+ gstGyroConnectStatus.ul_did = VEHICLE_DID_GYRO_CONNECT_STATUS;
+ gstGyroConnectStatus.us_size = VEHICLE_DSIZE_GYRO_CONNECT_STATUS;
+ gstGyroConnectStatus.uc_data = VEHICLE_DINIT_GYRO_CONNECT_STATUS;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroConnectStatus
+* ABSTRACT : Vehicle sensor GYRO_CONNECT_STATUS SET function
+* FUNCTION : Update the GYRO_CONNECT_STATUS data master
+* ARGUMENT : *pst_data : Pointer to received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroConnectStatus(const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *pst_data) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGyroConnectStatus;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), (size_t)(pst_data->uc_size));
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int16)pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
+ }
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroConnectStatus
+* ABSTRACT : Vehicle Sensor GYRO TROUBLE GET Functions
+* FUNCTION : Provide a GYRO TROUBLE data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroConnectStatus(VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGyroConnectStatus;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
+ (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroExt_l.cpp
new file mode 100755
index 0000000..0470c9f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroExt_l.cpp
@@ -0,0 +1,257 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroExt_l.cpp
+ * System name :Polaris
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_EXT)
+ * Module configuration :VehicleSensInitGyroExtl() Vehicle Sensor GYRO (Initial Delivery) Initialization Functions
+ * :VehicleSensSetGyroExtlG() Vehicle Sensor GYRO (Initial Delivery) Set Functions
+ * :VehicleSensGetGyroExtl() Vehicle Sensor GYRO (Initial Delivery) Get Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGyroExt_l; // NOLINT(readability/nolint)
+static VEHICLESENS_DATA_MASTER gstGyroRev_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroRevl
+* ABSTRACT : Vehicle Sensor GYRO Initialization Functions(Extensions data)
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroRevl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroRev_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ /* POSHAL_DID_GYRO initialized by POSHAL_DID_GYRO_X because POSHAL_DID_GYRO is internally replaced by POSHAL_DID_GYRO_EXT */
+ gstGyroRev_l.ul_did = POSHAL_DID_GYRO_X;
+ gstGyroRev_l.us_size = VEHICLE_DSIZE_GYRO;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroRev_l.uc_data);
+ pus[0] = VEHICLE_DINIT_GYRO; /* Ignore->MISRA-C++:2008 Rule 5-0-15 */
+ pus[1] = VEHICLE_DINIT_GYRO; /* Ignore->MISRA-C++:2008 Rule 5-0-15 */
+ pus[2] = VEHICLE_DINIT_GYRO; /* Ignore->MISRA-C++:2008 Rule 5-0-15 */
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroExtl
+* ABSTRACT : Vehicle Sensor GYRO Initialization Functions(Initial delivery)
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroExtl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ /* POSHAL_DID_GYRO initialized by POSHAL_DID_GYRO_X because POSHAL_DID_GYRO is internally replaced by POSHAL_DID_GYRO_EXT */
+ gstGyroExt_l.ul_did = POSHAL_DID_GYRO_X;
+ gstGyroExt_l.us_size = VEHICLE_DSIZE_GYRO_EXT_INIT;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroExt_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO, VEHICLE_DSIZE_GYRO_EXT);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroRevl
+* ABSTRACT : Vehicle Sensor GYRO SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroRevl(const LSDRV_LSDATA *pst_data) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroRev_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GYRO_X;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroRevlG
+* ABSTRACT : Vehicle Sensor GYRO SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroRevlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroRev_l;
+
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GYRO_X;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroExtlG
+* ABSTRACT : Vehicle Sensor GYRO SET Functions(Initial delivery)
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+void VehicleSensSetGyroExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGyroExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[GyroExt];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = POSHAL_DID_GYRO_X;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GyroExt] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GYRO_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroExtl
+* ABSTRACT : Vehicle Sensor GYRO GET Functions(Initial delivery)
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGyroExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GyroExt];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GyroExt] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GyroExt] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroRevl
+* ABSTRACT : Vehicle Sensor GYRO GET Functions(Initial delivery)
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroRevl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroRev_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp.cpp
new file mode 100755
index 0000000..d6debe6
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp.cpp
@@ -0,0 +1,114 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GyroTemp.cpp
+ * @brief
+ * Vehicle sensor data master(VEHICLE_DID_GYRO_TEMP_)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature GET Function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGyroTemp(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroTempl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature (Initial Delivery) GET Function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGyroTempExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroTempExtl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/**
+ * @brief
+ * Vehicle sensor gyro temperature (initial sensor) GET function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetGyroTempFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroTempFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempExt_l.cpp
new file mode 100755
index 0000000..aee750d
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempExt_l.cpp
@@ -0,0 +1,140 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GyroTempExt_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GYRO_TEMP)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT g_stgyro_temp_ext_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor gyro temperature initialization function
+ *
+ * Gyro Temperature Data Master Initialization Processing
+ */
+void VehicleSensInitGyroTempExtl(void) {
+ (void)memset(reinterpret_cast<void *>(&g_stgyro_temp_ext_l), 0, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ g_stgyro_temp_ext_l.ul_did = POSHAL_DID_GYRO_TEMP;
+ g_stgyro_temp_ext_l.us_size = VEHICLE_DSIZE_GYRO_TEMP_EXT_INIT;
+ g_stgyro_temp_ext_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature SET Function
+ *
+ * Update the gyro temperature data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+void VehicleSensSetGyroTempExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &g_stgyro_temp_ext_l;
+ us_size = sizeof(u_int16); /* Size of one data item: 2byte */
+
+ /* Store the latest one in the internal data structure */
+ us_start = gstPkgTempExt.start_point[GyroTemp]; /* Location to store one received message */
+ /* Stored in data master(Order of reception)*/
+ if (us_start == VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position. */
+ us_start++;
+ gstPkgTempExt.start_point[GyroTemp] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GYRO_TEMP_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature GET Function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGyroTempExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &g_stgyro_temp_ext_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = sizeof(u_int16); /* Size of one data item: 2byte */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GyroTemp];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GyroTemp] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GyroTemp] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempFst_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempFst_l.cpp
new file mode 100755
index 0000000..3c2906d
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTempFst_l.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GyroTempFst_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GYRO_TEMP_FST)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST g_st_gyro_tempfst_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor gyro temperature initialization function
+ *
+ * Gyro Temperature Data Master Initialization Processing
+ */
+void VehicleSensInitGyroTempFstl(void) {
+ memset(&g_st_gyro_tempfst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ g_st_gyro_tempfst_l.ul_did = POSHAL_DID_GYRO_TEMP_FST;
+ g_st_gyro_tempfst_l.us_size = VEHICLE_DSIZE_GYRO_TEMP_EXT_INIT;
+ g_st_gyro_tempfst_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ g_st_gyro_tempfst_l.partition_flg = 0;
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature SET Function
+ *
+ * Update the gyro temperature data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGyroTempFstG(const LSDRV_LSDATA_FST_GYRO_TEMP *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ pst_master = &g_st_gyro_tempfst_l;
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GYROTEMP_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GYROTEMP_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature GET Function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGyroTempFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &g_st_gyro_tempfst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp_l.cpp
new file mode 100755
index 0000000..002cf02
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTemp_l.cpp
@@ -0,0 +1,95 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_GyroTemp_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_GYRO_TEMP)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGyroTemp_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor gyro temperature initialization function
+ *
+ * Gyro Temperature Data Master Initialization Processing
+ */
+void VehicleSensInitGyroTempl(void) {
+ (void)memset(reinterpret_cast<void *>(&gstGyroTemp_l), 0, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGyroTemp_l.ul_did = POSHAL_DID_GYRO_TEMP;
+ gstGyroTemp_l.us_size = VEHICLE_DSIZE_GYRO_TEMP;
+ gstGyroTemp_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature SET Function
+ *
+ * Update the gyro temperature data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetGyroTemplG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroTemp_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle Sensor Gyro Temperature GET Function
+ *
+ * Provide a gyro temperature data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetGyroTempl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroTemp_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTrouble.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTrouble.cpp
new file mode 100755
index 0000000..e588c39
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroTrouble.cpp
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroTrouble.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_TROUBLE)
+ * Module configuration :VehicleSensInitGyroTrouble() Vehicle Sensor GYRO TROUBLE Initialization Functions
+ * :VehicleSensSetGyroTrouble() Vehicle Sensor GYRO TROUBLE SET Functions
+ * :VehicleSensGetGyroTrouble() Vehicle Sensor GYRO TROUBLE GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#define VEHICLE_SENS_DID_GYRO_TROUBLE_DEBUG_FACTORY 0
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GYRO_TROUBLE gstGyroTrouble; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroTrouble
+* ABSTRACT : Vehicle sensor GYRO_TROUBLE initialization function
+* FUNCTION : GYRO_TROUBLE data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroTrouble(void) {
+ (void)memset(reinterpret_cast<void *>(&(gstGyroTrouble)),
+ static_cast<int>(0x00), sizeof(VEHICLESENS_DATA_MASTER_GYRO_TROUBLE));
+ gstGyroTrouble.ul_did = VEHICLE_DID_GYRO_TROUBLE;
+ gstGyroTrouble.us_size = VEHICLE_DSIZE_GYRO_TROUBLE;
+ gstGyroTrouble.uc_data = VEHICLE_DINIT_GYRO_TROUBLE;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroTrouble
+* ABSTRACT : Vehicle Sensor GYRO_TROUBLE SET Function
+* FUNCTION : Update the GYRO_TROUBLE data master
+* ARGUMENT : *pst_data : Pointer to received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroTrouble(const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGyroTrouble;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(&(pst_master->uc_data), &(pst_data->uc_data), pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int16)pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_data = pst_data->uc_data;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
+ }
+
+#if VEHICLE_SENS_DID_GYRO_TROUBLE_DEBUG_FACTORY
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] pst_data->ul_did == 0x%x", pst_data->ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] gstGyroTrouble.ul_did == 0x%x\r\n", gstGyroTrouble.ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] (u_int8)pst_data->ucSize == 0x%x", (u_int8)pst_data->uc_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] gstGyroTrouble.us_size == 0x%x\r\n", gstGyroTrouble.us_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] pst_data->uc_data == 0x%x", pst_data->uc_data);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] gstGyroTrouble.uc_data == 0x%x\r\n", gstGyroTrouble.uc_data);
+#endif
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroTrouble
+* ABSTRACT : Vehicle Sensor GYRO TROUBLE GET Functions
+* FUNCTION : Provide a GYRO TROUBLE data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroTrouble(VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstGyroTrouble;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
+ (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX.cpp
new file mode 100755
index 0000000..3cda53a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX.cpp
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroX.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_X)
+ * Module configuration :VehicleSensGetGyroX() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroX
+* ABSTRACT : Vehicle Sensor GYRO_X GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroX(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroXl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroRev
+* ABSTRACT : Vehicle Sensor GYRO GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroRev(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroRevl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroExt
+* ABSTRACT : Vehicle Sensor GYRO GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroXFst
+* ABSTRACT : Vehicle Sensor GYRO_X GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroXFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroXFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroXFst_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroXFst_l.cpp
new file mode 100755
index 0000000..e9997ac
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroXFst_l.cpp
@@ -0,0 +1,176 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroXFst_l.cpp
+ * System name :Polaris
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_X_FST)
+ * Module configuration :VehicleSensInitGyroXFstl() Vehicle sensor GYRO (initial sensor) initialization functions
+ * :VehicleSensSetGyroXFstl() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensSetGyroXFstG() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensGetGyroXFstl() Vehicle sensor GYRO (initial sensor) GET-function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST gstGyroXFst_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroXFstl
+* ABSTRACT : Vehicle Sensor GYRO_X Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroXFstl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroXFst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ gstGyroXFst_l.ul_did = POSHAL_DID_GYRO_X_FST;
+ gstGyroXFst_l.us_size = 0;
+ gstGyroXFst_l.partition_flg = 0;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroXFst_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO_X, VEHICLE_DSIZE_GYRO_X_FST);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroXFstl
+* ABSTRACT : Vehicle Sensor GYRO_X SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroXFstl(const LSDRV_LSDATA_FST *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroXFst_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->partition_flg = 0;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroXFstG
+* ABSTRACT : Vehicle Sensor GYRO SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroXFstG(const LSDRV_LSDATA_FST_GYRO_X *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ pst_master = &gstGyroXFst_l;
+
+ if (partition_max == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_max == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (partition_num == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_num == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_X_FST],
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_X_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroXFstl
+* ABSTRACT : Vehicle Sensor GYRO GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroXFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroXFst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
+
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX_l.cpp
new file mode 100755
index 0000000..af90e25
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroX_l.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroX_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_X)
+ * Module configuration :VehicleSensInitGyroXl() Vehicle Sensor GYRO Initialization Functions
+ * :VehicleSensSetGyroXl() Vehicle Sensor GYRO SET Functions
+ * :VehicleSensGetGyroXl() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGyroX_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroXl
+* ABSTRACT : Vehicle Sensor GYRO_X Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroXl(void) {
+ memset(&gstGyroX_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGyroX_l.ul_did = POSHAL_DID_GYRO_X;
+ gstGyroX_l.us_size = VEHICLE_DSIZE_GYRO_X;
+ gstGyroX_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroXl
+* ABSTRACT : Vehicle Sensor GYRO_X SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroXl(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroX_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)pst_data->uc_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroXlG
+* ABSTRACT : Vehicle Sensor GYRO_X SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroXlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroX_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroXl
+* ABSTRACT : Vehicle Sensor GYRO_X GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroXl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroX_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY.cpp
new file mode 100755
index 0000000..b7d0e5a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY.cpp
@@ -0,0 +1,113 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroY.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_Y)
+ * Module configuration :VehicleSensGetGyroY() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroY
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroY(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroYl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroYExt
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroYExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroYExtl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroYFst
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroYFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroYFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYExt_l.cpp
new file mode 100755
index 0000000..898dafb
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYExt_l.cpp
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroYExt_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_EXT)
+ * Module configuration :VehicleSensInitGyroYExtl() Vehicle Sensor GYRO (Initial Delivery) Initialization Functions
+ * :VehicleSensSetGyroYExtlG() Vehicle Sensor GYRO (Initial Delivery) Set Functions
+ * :VehicleSensGetGyroYExtl() Vehicle Sensor GYRO (Initial Delivery) Get Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGyroYExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroYExtl
+* ABSTRACT : Vehicle Sensor GYRO_Y Initialization Functions(Initial delivery)
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroYExtl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroYExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstGyroYExt_l.ul_did = POSHAL_DID_GYRO_Y;
+ gstGyroYExt_l.us_size = VEHICLE_DSIZE_GYRO_EXT_INIT;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroYExt_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO, VEHICLE_DSIZE_GYRO_EXT);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroYExtlG
+* ABSTRACT : Vehicle Sensor GYRO_Y SET Functions(Initial delivery)
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+void VehicleSensSetGyroYExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGyroYExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[GyroY];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GyroY] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GYRO_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroYExtl
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions(Initial delivery)
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroYExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGyroYExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GyroY];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GyroY] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GyroY] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif // CONFIG_SENSOR_EXT_VALID
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYFst_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYFst_l.cpp
new file mode 100755
index 0000000..164cf4d
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroYFst_l.cpp
@@ -0,0 +1,169 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroYFst_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_Y_FST)
+ * Module configuration :VehicleSensInitGyroYFstl() Vehicle sensor GYRO (initial sensor) initialization functions
+ * :VehicleSensSetGyroYFstl() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensSetGyroYFstG() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensGetGyroYFstl() Vehicle sensor GYRO (initial sensor) GET-function
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST gstGyroYFst_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroYFstl
+* ABSTRACT : Vehicle Sensor GYRO_Y Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroYFstl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroYFst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ gstGyroYFst_l.ul_did = POSHAL_DID_GYRO_Y_FST;
+ gstGyroYFst_l.us_size = 0;
+ gstGyroYFst_l.partition_flg = 0;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroYFst_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO_Y, VEHICLE_DSIZE_GYRO_Y_FST);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroYFstl
+* ABSTRACT : Vehicle Sensor GYRO_Y SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroYFstl(const LSDRV_LSDATA_FST *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroYFst_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->partition_flg = 0;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroYFstG
+* ABSTRACT : Vehicle Sensor GYRO_Y SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroYFstG(const LSDRV_LSDATA_FST_GYRO_Y *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ pst_master = &gstGyroYFst_l;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_Y_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_Y_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroYFstl
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroYFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroYFst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY_l.cpp
new file mode 100755
index 0000000..9799b29
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroY_l.cpp
@@ -0,0 +1,126 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroY_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_Y)
+ * Module configuration :VehicleSensInitGyroYl() Vehicle Sensor GYRO Initialization Functions
+ * :VehicleSensSetGyroYl() Vehicle Sensor GYRO SET Functions
+ * :VehicleSensGetGyroYl() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGyroY_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroYl
+* ABSTRACT : Vehicle Sensor GYRO_Y Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroYl(void) {
+ memset(&gstGyroY_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGyroY_l.ul_did = POSHAL_DID_GYRO_Y;
+ gstGyroY_l.us_size = VEHICLE_DSIZE_GYRO_Y;
+ gstGyroY_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroYl
+* ABSTRACT : Vehicle Sensor GYRO_Y SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroYl(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroY_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)pst_data->uc_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroYlG
+* ABSTRACT : Vehicle Sensor GYRO_Y SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroYlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroY_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroYl
+* ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroYl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroY_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ.cpp
new file mode 100755
index 0000000..1b84af7
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ.cpp
@@ -0,0 +1,113 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroZ.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_Z)
+ * Module configuration :VehicleSensGetGyroZ() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZ
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZ(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroZl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZExt
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroZExtl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZFst
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetGyroZFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZExt_l.cpp
new file mode 100755
index 0000000..9ef9996
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZExt_l.cpp
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroZExt_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_EXT)
+ * Module configuration :VehicleSensInitGyroxiZYExtl() Vehicle Sensor GYRO (Initial Delivery) Initialization Functions
+ * :VehicleSensSetGyroZExtlG() Vehicle Sensor GYRO (Initial Delivery) Set Functions
+ * :VehicleSensGetGyroZExtl() Vehicle Sensor GYRO (Initial Delivery) Get Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstGyroZExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroZExtl
+* ABSTRACT : Vehicle Sensor GYRO_Z Initialization Functions(Initial delivery)
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroZExtl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroZExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstGyroZExt_l.ul_did = POSHAL_DID_GYRO_Z;
+ gstGyroZExt_l.us_size = VEHICLE_DSIZE_GYRO_EXT_INIT;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroZExt_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO, VEHICLE_DSIZE_GYRO_EXT);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroZExtlG
+* ABSTRACT : Vehicle Sensor GYRO_Z SET Functions(Initial delivery)
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+void VehicleSensSetGyroZExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstGyroZExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[GyroZ];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[GyroZ] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_GYRO_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZExtl
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions(Initial delivery)
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstGyroZExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[GyroZ];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[GyroZ] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[GyroZ] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif // CONFIG_SENSOR_EXT_VALID
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZFst_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZFst_l.cpp
new file mode 100755
index 0000000..587f565
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZFst_l.cpp
@@ -0,0 +1,169 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroZFst_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_Z_FST)
+ * Module configuration :VehicleSensInitGyroZFstl() Vehicle sensor GYRO (initial sensor) initialization functions
+ * :VehicleSensSetGyroZFstl() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensSetGyroZFstG() Vehicle sensor GYRO (initial sensor) SET-function
+ * :VehicleSensGetGyroZFstl() Vehicle sensor GYRO (initial sensor) GET-function
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST gstGyroZFst_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroZFstl
+* ABSTRACT : Vehicle Sensor GYRO_Z Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroZFstl(void) {
+ u_int16 *pus;
+
+ memset(&gstGyroZFst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ gstGyroZFst_l.ul_did = POSHAL_DID_GYRO_Z_FST;
+ gstGyroZFst_l.us_size = 0;
+ gstGyroZFst_l.partition_flg = 0;
+
+ pus = reinterpret_cast<u_int16 *>(gstGyroZFst_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_GYRO_Z, VEHICLE_DSIZE_GYRO_Z_FST);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroZFstl
+* ABSTRACT : Vehicle Sensor GYRO_Z SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroZFstl(const LSDRV_LSDATA_FST *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroZFst_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->partition_flg = 0;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroZFstG
+* ABSTRACT : Vehicle Sensor GYRO_Z SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroZFstG(const LSDRV_LSDATA_FST_GYRO_Z *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ pst_master = &gstGyroZFst_l;
+
+ if (partition_max == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_max == 2) {
+ if (partition_num == 1) {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+ } else if (partition_num == 2) {
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_Z_FST],
+ pst_data->uc_data, pst_data->uc_size);
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_GYRO_Z_FST], pst_data->uc_data, pst_data->uc_size);
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZFstl
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstGyroZFst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ_l.cpp
new file mode 100755
index 0000000..8296dab
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_GyroZ_l.cpp
@@ -0,0 +1,126 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_GyroZ_l.cpp
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_Z)
+ * Module configuration :VehicleSensInitGyroZl() Vehicle Sensor GYRO Initialization Functions
+ * :VehicleSensSetGyroZl() Vehicle Sensor GYRO SET Functions
+ * :VehicleSensGetGyroZl() Vehicle Sensor GYRO GET Functions
+ ******************************************************************************/
+
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstGyroZ_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitGyroZl
+* ABSTRACT : Vehicle Sensor GYRO_Z Initialization Functions
+* FUNCTION : GYRO data master initialization process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitGyroZl(void) {
+ memset(&gstGyroZ_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstGyroZ_l.ul_did = POSHAL_DID_GYRO_Z;
+ gstGyroZ_l.us_size = VEHICLE_DSIZE_GYRO_Z;
+ gstGyroZ_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroZl
+* ABSTRACT : Vehicle Sensor GYRO_Z SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroZl(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroZ_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)pst_data->uc_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetGyroZlG
+* ABSTRACT : Vehicle Sensor GYRO_Z SET Functions
+* FUNCTION : Update the GYRO data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetGyroZlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroZ_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetGyroZl
+* ABSTRACT : Vehicle Sensor GYRO_Z GET Functions
+* FUNCTION : Provide a GYRO data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetGyroZl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstGyroZ_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude.cpp
new file mode 100755
index 0000000..167fa0a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude.cpp
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_LocationAltitude.cpp
+@detail Altitude information data master management
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+
+/****************************************************************************
+@brief VehicleSensGetLocationAltitude<BR>
+ Altitude Information Data Master GET Processing
+@outline Provide an altitude information data master
+@param[in] u_int8 uc_get_method : Acquisition method(GPS or Navi)
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetLocationAltitude(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:no other parameter pass in
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetLocationAltitudeG(pst_data);
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_NAVI:
+ {
+ /** To acquire from NAVI */
+ VehicleSensGetLocationAltitudeN(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_g.cpp
new file mode 100755
index 0000000..cae429c
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_g.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_LocationAltitude_g.cpp
+@detail Altitude information data master management(NMEA information)
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+static VEHICLESENS_DATA_MASTER gstLocationAltitude_g; // NOLINT(readability/nolint)
+
+/****************************************************************************
+@brief VehicleSensInitLocationAltitudeG<BR>
+ Altitude information data master initialization processing(NMEA information)
+@outline Initialize the altitude information data master
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensInitLocationAltitudeG(void) {
+ SENSORLOCATION_ALTITUDEINFO_DAT st_altitude;
+
+ memset(&gstLocationAltitude_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstLocationAltitude_g.ul_did = VEHICLE_DID_LOCATION_ALTITUDE;
+ /** Data size setting */
+ gstLocationAltitude_g.us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
+ /** Data content setting */
+ memset(&st_altitude, 0x00, sizeof(st_altitude));
+ st_altitude.getMethod = SENSOR_GET_METHOD_GPS;
+ st_altitude.SyncCnt = 0x00;
+ st_altitude.isEnable = SENSORLOCATION_STATUS_DISABLE;
+ memcpy(&gstLocationAltitude_g.uc_data[0], &st_altitude, sizeof(st_altitude));
+}
+
+/****************************************************************************
+@brief VehicleSensSetLocationAltitudeG<BR>
+ Altitude information data master SET processing(NMEA information)
+@outline Update the altitude information data master
+@param[in] u_int8 ucSensCnt : Sensor counter value
+@param[in] u_int8* pucDGGA : Double precision GGAInformation(_CWORD82_ NMEA)
+@param[out] none
+@return u_int8
+@retval VEHICLESENS_EQ : No data change
+@retval VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetLocationAltitudeG(const SENSORLOCATION_ALTITUDEINFO_DAT *pst_altitude) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationAltitude_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_LOCATION_ALTITUDE;
+ pst_master->us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+
+ return(uc_ret);
+}
+
+/****************************************************************************
+@brief VehicleSensGetLocationAltitudeG<BR>
+ Altitude Information Data Master GET Processing(NMEA information)
+@outline Provide an altitude information data master
+@param[in] none
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetLocationAltitudeG(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationAltitude_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_n.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_n.cpp
new file mode 100755
index 0000000..1d6064f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationAltitude_n.cpp
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_LocationAltitude_n.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "SensorLocation_API.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstLocationAltitude_n; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Altitude information data master initialization processing(NAVI information)
+ *
+ * Initialize the altitude information data master
+ *
+ * @param[in] none
+ * @param[out] none
+ * @return none
+ * @retval none
+ */
+void VehicleSensInitLocationAltitudeN(void) {
+ SENSORLOCATION_ALTITUDEINFO_DAT st_altitude;
+
+ memset(&gstLocationAltitude_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstLocationAltitude_n.ul_did = VEHICLE_DID_LOCATION_ALTITUDE_NAVI;
+
+ /** Data size setting */
+ gstLocationAltitude_n.us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
+
+ /** Data content setting */
+ memset(&st_altitude, 0x00, sizeof(st_altitude));
+ st_altitude.getMethod = SENSOR_GET_METHOD_NAVI;
+ st_altitude.SyncCnt = 0x00;
+ st_altitude.isEnable = SENSORLOCATION_STATUS_DISABLE;
+ st_altitude.Altitude = 0x00;
+ memcpy(&gstLocationAltitude_n.uc_data[0], &st_altitude, sizeof(st_altitude));
+
+ return;
+}
+
+/**
+ * @brief
+ * Altitude information data master SET processing(NAVI information)
+ *
+ * Update the altitude information data master
+ *
+ * @param[in] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @param[out] none
+ * @return u_int8
+ * @retval VEHICLESENS_EQ : No data change
+ * @retval VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetLocationAltitudeN(const SENSORLOCATION_ALTITUDEINFO_DAT *pst_altitude) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationAltitude_n;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_LOCATION_ALTITUDE_NAVI;
+ pst_master->us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Altitude Information Data Master GET Processing(NAVI information)
+ *
+ * Provide an altitude information data master
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetLocationAltitudeN(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationAltitude_n;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea.cpp
new file mode 100755
index 0000000..496e5ac
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea.cpp
@@ -0,0 +1,50 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**************************************************************************//**
+@file VehicleSens_Did_LocationInfoNmea.cpp
+@detail Location Information (NMEA) Management of information data master
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+
+/**************************************************************************//**
+@brief VehicleSens_GetLocationInfoNmea<BR>
+ Location Information (NMEA) Information Data Master GET Processing
+@outline Location Information (NMEA) Provide an information data master
+@param[in] u_int8 ucGetMethod : Acquisition method(GPS or Navi)
+@param[out] VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstData : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSens_GetLocationInfoNmea(VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstData, u_int8 ucGetMethod)
+{
+ switch(ucGetMethod)
+ {
+ case VEHICLESENS_GETMETHOD_NAVI:
+ {
+ VehicleSens_GetLocationInfoNmea_n(pstData);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea_n.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea_n.cpp
new file mode 100755
index 0000000..048e522
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationInfoNmea_n.cpp
@@ -0,0 +1,118 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_LocationInfoNmea_n.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "SensorLocation_API.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstLocationInfoNmea_n;
+
+/**
+ * @brief
+ * Location Information (NMEA) Initialization of information data master(NAVI information)
+ *
+ * Location Information (NMEA) Initialize the information data master
+ *
+ * @param[in] none
+ * @param[out] none
+ * @return none
+ */
+void VehicleSens_InitLocationInfoNmea_n(void)
+{
+ POS_LOCATIONINFO_NMEA stLocInfoNmea;
+
+ _pb_memset(&gstLocationInfoNmea_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+
+ /* Set Data ID */
+ gstLocationInfoNmea_n.ul_did = VEHICLE_DID_LOCATIONINFO_NMEA_NAVI;
+
+ /* Set Data Size */
+ gstLocationInfoNmea_n.us_size = sizeof(POS_LOCATIONINFO_NMEA);
+
+ /** Set Data itself */
+ _pb_memset(&stLocInfoNmea, 0x00, sizeof(stLocInfoNmea));
+ _pb_memcpy(&gstLocationInfoNmea_n.uc_data[0], &stLocInfoNmea, sizeof(stLocInfoNmea));
+
+ return;
+}
+
+/**
+ * @brief
+ * Location Information (NMEA) Information data master SET process(NAVI information)
+ *
+ * Location Information (NMEA) Update the information data master
+ *
+ * @param[in] VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstData : Pointer to the data master acquisition destination
+ * @param[out] none
+ * @return u_int8
+ * @retval VEHICLESENS_EQ : No data change
+ * @retval VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSens_SetLocationInfoNmea_n( const POS_LOCATIONINFO_NMEA *pstLocInfoNmea )
+{
+ u_int8 ucRet;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstMaster;
+
+ pstMaster = &gstLocationInfoNmea_n;
+
+ /* Compare Received Data with Master Data */
+ ucRet = VehicleSensmemcmp( pstMaster->uc_data, pstLocInfoNmea, sizeof(POS_LOCATIONINFO_NMEA) );
+
+ /* Set Received Data as Master Data */
+ pstMaster->ul_did = VEHICLE_DID_LOCATIONINFO_NMEA_NAVI;
+ pstMaster->us_size = sizeof(POS_LOCATIONINFO_NMEA);
+ pstMaster->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ _pb_memcpy(pstMaster->uc_data, pstLocInfoNmea, sizeof(POS_LOCATIONINFO_NMEA));
+
+ return ucRet;
+}
+
+/**
+ * @brief
+ * Location Information (NMEA) Information Data Master GET Processing(NAVI information)
+ *
+ * Location Information (NMEA) Provide an information data master
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstData : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSens_GetLocationInfoNmea_n(VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstData)
+{
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pstMaster;
+
+ pstMaster = &gstLocationInfoNmea_n;
+
+ /* Set Master Data to Indicated Region */
+ pstData->ul_did = pstMaster->ul_did;
+ pstData->us_size = pstMaster->us_size;
+ pstData->uc_rcvflag = pstMaster->uc_rcvflag;
+ _pb_memcpy(pstData->uc_data, pstMaster->uc_data, pstMaster->us_size);
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat.cpp
new file mode 100755
index 0000000..1ae1b59
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat.cpp
@@ -0,0 +1,56 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_LocationLonLat.cpp
+@detail Latitude and longitudeManagement of information data master
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+
+/****************************************************************************
+@brief VehicleSensGetLocationLonLat<BR>
+ Latitude and longitudeInformation Data Master GET Processing
+@outline Latitude and longitudeProvide an information data master
+@param[in] u_int8 uc_get_method : Acquisition method(GPS or Navi)
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetLocationLonLat(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:other parameters cannot pass in
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetLocationLonLatG(pst_data);
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_NAVI:
+ {
+ /** To acquire from NAVI */
+ VehicleSensGetLocationLonLatnUnitCnv(pst_data);
+ break;
+ }
+
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_g.cpp
new file mode 100755
index 0000000..07075c0
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_LocationLonLat_g.cpp
+@detail Latitude and longitudeManagement of information data master(NMEA information)
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+static VEHICLESENS_DATA_MASTER gstLocationLonLat_g; // NOLINT(readability/nolint)
+
+/****************************************************************************
+@brief VehicleSensInitLocationLonLatG<BR>
+ Latitude and longitudeInitialization of information data master(NMEA information)
+@outline Latitude and longitudeInitialize the information data master
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensInitLocationLonLatG(void) {
+ SENSORLOCATION_LONLATINFO_DAT st_lonlat;
+
+ memset(&gstLocationLonLat_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstLocationLonLat_g.ul_did = VEHICLE_DID_LOCATION_LONLAT;
+ /** Data size setting */
+ gstLocationLonLat_g.us_size = sizeof(SENSORLOCATION_LONLATINFO_DAT);
+ /** Data content setting */
+ memset(&st_lonlat, 0x00, sizeof(st_lonlat));
+ st_lonlat.getMethod = SENSOR_GET_METHOD_GPS;
+ st_lonlat.SyncCnt = 0x00;
+ st_lonlat.isEnable = SENSORLOCATION_STATUS_DISABLE;
+ memcpy(&gstLocationLonLat_g.uc_data[0], &st_lonlat, sizeof(st_lonlat));
+}
+
+/****************************************************************************
+@brief VehicleSensSetLocationLonLatG<BR>
+ Latitude and longitudeInformation data master SET process(NMEA information)
+@outline Latitude and longitudeUpdate the information data master
+@param[in] SENSORLOCATION_LONLATINFO_DAT * pst_lonlat : Latitude and longitude information
+@param[out] none
+@return u_int8
+@retval VEHICLESENS_EQ : No data change
+@retval VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetLocationLonLatG(const SENSORLOCATION_LONLATINFO_DAT *pst_lonlat) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationLonLat_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_lonlat, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_LOCATION_LONLAT;
+ pst_master->us_size = sizeof(SENSORLOCATION_LONLATINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_lonlat, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+
+ return(uc_ret);
+}
+
+/****************************************************************************
+@brief VehicleSensGetLocationLonLatG<BR>
+ Latitude and longitudeInformation Data Master GET Processing(NMEA information)
+@outline Latitude and longitudeProvide an information data master
+@param[in] none
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetLocationLonLatG(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationLonLat_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_n.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_n.cpp
new file mode 100755
index 0000000..dcaecff
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_LocationLonLat_n.cpp
@@ -0,0 +1,163 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_LocationLonLat_n.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "SensorLocation_API.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstLocationLonLat_n; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Latitude and longitudeInitialization of information data master(NAVI information)
+ *
+ * Latitude and longitudeInitialize the information data master
+ *
+ * @param[in] none
+ * @param[out] none
+ * @return none
+ * @retval none
+ */
+void VehicleSensInitLocationLonLatN(void) {
+ SENSORLOCATION_LONLATINFO_DAT st_lonlat;
+
+ memset(&gstLocationLonLat_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstLocationLonLat_n.ul_did = VEHICLE_DID_LOCATION_LONLAT_NAVI;
+
+ /** Data size setting */
+ gstLocationLonLat_n.us_size = sizeof(SENSORLOCATION_LONLATINFO_DAT);
+
+ /** Data content setting */
+ memset(&st_lonlat, 0x00, sizeof(st_lonlat));
+ st_lonlat.getMethod = SENSOR_GET_METHOD_NAVI;
+ st_lonlat.SyncCnt = 0x00;
+ st_lonlat.isEnable = SENSORLOCATION_STATUS_DISABLE;
+ st_lonlat.posSts = 0x00;
+ st_lonlat.posAcc = 0x00;
+ st_lonlat.Longitude = 0x00;
+ st_lonlat.Latitude = 0x00;
+ memcpy(&gstLocationLonLat_n.uc_data[0], &st_lonlat, sizeof(st_lonlat));
+
+ return;
+}
+
+/**
+ * @brief
+ * Latitude and longitudeInformation data master SET process(NAVI information)
+ *
+ * Latitude and longitudeUpdate the information data master
+ *
+ * @param[in] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @param[out] none
+ * @return u_int8
+ * @retval VEHICLESENS_EQ : No data change
+ * @retval VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetLocationLonLatN(const SENSORLOCATION_LONLATINFO_DAT *pst_lonlat) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationLonLat_n;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_lonlat, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_LOCATION_LONLAT_NAVI;
+ pst_master->us_size = sizeof(SENSORLOCATION_LONLATINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_lonlat, sizeof(SENSORLOCATION_LONLATINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Latitude and longitudeInformation Data Master GET Processing(NAVI information)
+ *
+ * Latitude and longitudeProvide an information data master
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetLocationLonLatN(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstLocationLonLat_n;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
+
+/**
+ * @brief
+ * Latitude and longitudeInformation Data Master GET Processing(NAVI information)
+ *
+ * Latitude and longitudeProvide an information data master(Unit:10^-7th degree)
+ *
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ */
+void VehicleSensGetLocationLonLatnUnitCnv(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+ SENSORLOCATION_LONLATINFO_DAT st_lonlat;
+ int32_t l_lon;
+ int32_t l_lat;
+ int64_t ll_tmp;
+
+ pst_master = &gstLocationLonLat_n;
+
+ /* Perform unit conversion[1/128Second] -> [10^-7 degree] */
+ memcpy(&st_lonlat, pst_master->uc_data, sizeof(st_lonlat));
+
+ /* Longitude */
+ l_lon = st_lonlat.Longitude;
+ ll_tmp = (int64_t)l_lon * 10000000;
+ st_lonlat.Longitude = (int32_t)(ll_tmp / (128 * 60 * 60));
+
+ /* Latitude */
+ l_lat = st_lonlat.Latitude;
+ ll_tmp = (int64_t)l_lat * 10000000;
+ st_lonlat.Latitude = (int32_t)(ll_tmp / (128 * 60 * 60));
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, &st_lonlat, sizeof(st_lonlat));
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MainGpsInterruptSignal.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MainGpsInterruptSignal.cpp
new file mode 100755
index 0000000..7066324
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MainGpsInterruptSignal.cpp
@@ -0,0 +1,132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_MainGpsInterruptSignal.cpp
+ * System name :PastModel002
+ * Subsystem name :GPS process
+ * Program name :MAIN GPS interrupt data master(VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL)
+ * Module configuration :VehicleSensInitMainGpsInterruptSignal() Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL initialization function
+ * :VehicleSensSetMainGpsInterruptSignal() Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL SET function
+ * :VehicleSensGetMainGpsInterruptSignal() Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#define VEHICLE_SENS_DID_MAIN_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY 0
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL gstMainGpsInterruptSignal; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitMainGpsInterruptSignal
+* ABSTRACT : Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL initialization function
+* FUNCTION : MAIN_GPS_INTERRUPT_SIGNAL data master initialization processing
+* ARGUMENT : None
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensInitMainGpsInterruptSignal(void) {
+ (void)memset(reinterpret_cast<void *>(&(gstMainGpsInterruptSignal)),
+ static_cast<int>(0x00), sizeof(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL));
+ gstMainGpsInterruptSignal.ul_did = VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL;
+ gstMainGpsInterruptSignal.us_size = VEHICLE_DSIZE_MAIN_GPS_INTERRUPT_SIGNAL;
+ gstMainGpsInterruptSignal.uc_data = VEHICLE_DINIT_MAIN_GPS_INTERRUPT_SIGNAL;
+
+#if VEHICLE_SENS_DID_MAIN_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstMainGpsInterruptSignal.uc_data.uc_data == 0x%x\r\n", gstMainGpsInterruptSignal.uc_data);
+#endif
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetMainGpsInterruptSignal
+* ABSTRACT : Vehicle sensor MAIN_GPS_INTERRUPT_SIGNALE SET function
+* FUNCTION : Update the Main_GPS_INTERRUPT_SIGNAL data master
+* ARGUMENT : *pst_data : Pointer to received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetMainGpsInterruptSignal(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstMainGpsInterruptSignal;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), (size_t)(pst_data->us_size));
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
+
+#if VEHICLE_SENS_DID_MAIN_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] pst_data->ul_did == 0x%x", pst_data->ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstMainGpsInterruptSignal.ul_did == 0x%x\r\n", gstMainGpsInterruptSignal.ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] (u_int8)pst_data->us_size == 0x%x", (u_int8)pst_data->us_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstMainGpsInterruptSignal.us_size == 0x%x\r\n", gstMainGpsInterruptSignal.us_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] pst_data->uc_data == 0x%x", pst_data->uc_data[0]);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstMainGpsInterruptSignal.uc_data == 0x%x\r\n", gstMainGpsInterruptSignal.uc_data);
+#endif
+ }
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetMainGpsInterruptSignal
+* ABSTRACT : Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL GET function
+* FUNCTION : Provide the MAIN_GPS_INTERRUPT_SIGNAL data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensGetMainGpsInterruptSignal(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstMainGpsInterruptSignal;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
+ (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Mon_Hw_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Mon_Hw_g.cpp
new file mode 100755
index 0000000..1859f76
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Mon_Hw_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Mon_Hw_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_MON_HW)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstMonHw_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief MON-HW vehicle sensor initialization function
+@outline MON-HW initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitMonHwG(void) {
+ memset(&gstMonHw_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstMonHw_g.ul_did = VEHICLE_DID_GPS_UBLOX_MON_HW;
+ gstMonHw_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_MON_HW + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstMonHw_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_MON_HW;
+}
+
+/***************************************************************************
+@brief MON-HW SET vehicle sensor function
+@outline To update the master data MON-HW.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetMonHwG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstMonHw_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function MON-HW GET
+@outline Master Data provides the MON-HW
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetMonHwG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstMonHw_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading.cpp
new file mode 100755
index 0000000..67a218e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading.cpp
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_MotionHeading.cpp
+@detail Orientation Information Data Master Management
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+
+/****************************************************************************
+@brief VehicleSensGetMotionHeading<BR>
+ Compass Data Master GET Processing
+@outline Provide an orientation information data master
+@param[in] u_int8 uc_get_method : Acquisition method(GPS or Navi)
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetMotionHeading(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:other parameters cannot pass in
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetMotionHeadingG(pst_data);
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_NAVI:
+ {
+ /** To acquire from NAVI */
+ VehicleSensGetMotionHeadingnCnvData(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_g.cpp
new file mode 100755
index 0000000..751b199
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_g.cpp
@@ -0,0 +1,105 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_MotionHeading_g.cpp
+@detail Orientation Information Data Master Management(NMEA information)
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+static VEHICLESENS_DATA_MASTER gstMotionHeading_g; // NOLINT(readability/nolint)
+
+/****************************************************************************
+@brief VehicleSensInitMotionHeadingG<BR>
+ Orientation information data master initialization process(NMEA information)
+@outline Initialize the orientation information data master
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensInitMotionHeadingG(void) {
+ SENSORMOTION_HEADINGINFO_DAT st_heading;
+
+ memset(&gstMotionHeading_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstMotionHeading_g.ul_did = VEHICLE_DID_MOTION_HEADING;
+ /** Data size setting */
+ gstMotionHeading_g.us_size = sizeof(SENSORMOTION_HEADINGINFO_DAT);
+ /** Data content setting */
+ memset(&st_heading, 0x00, sizeof(st_heading));
+ st_heading.getMethod = SENSOR_GET_METHOD_GPS;
+ st_heading.SyncCnt = 0x00;
+ st_heading.isEnable = SENSORMOTION_STATUS_DISABLE;
+ memcpy(&gstMotionHeading_g.uc_data[0], &st_heading, sizeof(st_heading));
+}
+
+/****************************************************************************
+@brief VehicleSensSetMotionHeadingG<BR>
+ Compass Data Master SET Processing(NMEA information)
+@outline Update the orientation information data master
+@param[in] SENSORMOTION_HEADINGINFO_DAT* pst_heading : Bearing information
+@param[out] none
+@return u_int8
+@retval VEHICLESENS_EQ : No data change
+@retval VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetMotionHeadingG(const SENSORMOTION_HEADINGINFO_DAT *pst_heading) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionHeading_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_heading,
+ sizeof(SENSORMOTION_HEADINGINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_MOTION_HEADING;
+ pst_master->us_size = sizeof(SENSORMOTION_HEADINGINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_heading, sizeof(SENSORMOTION_HEADINGINFO_DAT));
+
+ return(uc_ret);
+}
+
+/****************************************************************************
+@brief VehicleSensGetMotionHeadingG<BR>
+ Compass Data Master GET Processing(NMEA information)
+@outline Provide an orientation information data master
+@param[in] none
+@param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetMotionHeadingG(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionHeading_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_n.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_n.cpp
new file mode 100755
index 0000000..4475b24
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionHeading_n.cpp
@@ -0,0 +1,162 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_MotionHeading_n.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "SensorMotion_API.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstMotionHeading_n; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Orientation information data master initialization process(NAVI information)
+ *
+ * Initialize the orientation information data master
+ *
+ * @param[in] none
+ * @param[out] none
+ * @return none
+ * @retval none
+ */
+void VehicleSensInitMotionHeadingN(void) {
+ SENSORMOTION_HEADINGINFO_DAT st_heading;
+
+ memset(&gstMotionHeading_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstMotionHeading_n.ul_did = VEHICLE_DID_MOTION_HEADING_NAVI;
+
+ /** Data size setting */
+ gstMotionHeading_n.us_size = sizeof(SENSORMOTION_HEADINGINFO_DAT);
+
+ /** Data content setting */
+ memset(&st_heading, 0x00, sizeof(st_heading));
+ st_heading.getMethod = SENSOR_GET_METHOD_NAVI;
+ st_heading.SyncCnt = 0x00;
+ st_heading.isEnable = SENSORMOTION_STATUS_DISABLE;
+ st_heading.posSts = 0x00;
+ st_heading.Heading = 0x00;
+ memcpy(&gstMotionHeading_n.uc_data[0], &st_heading, sizeof(st_heading));
+
+ return;
+}
+
+/**
+ * @brief
+ * Compass Data Master SET Processing(NAVI information)
+ *
+ * Update the orientation information data master
+ *
+ * @param[in] VEHICLESENS_DATA_MASTER *pst_heading : Pointer to the data master acquisition destination
+ * @param[out] none
+ * @return u_int8
+ * @retval VEHICLESENS_EQ : No data change
+ * @retval VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetMotionHeadingN(const SENSORMOTION_HEADINGINFO_DAT *pst_heading) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionHeading_n;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_heading, sizeof(SENSORMOTION_HEADINGINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_MOTION_HEADING_NAVI;
+ pst_master->us_size = sizeof(SENSORMOTION_HEADINGINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_heading, sizeof(SENSORMOTION_HEADINGINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Compass Data Master GET Processing(NAVI information)
+ *
+ * Provide an orientation information data master
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetMotionHeadingN(VEHICLESENS_DATA_MASTER *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionHeading_n;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Compass Data Master GET Processing(NAVI information)
+ *
+ * Providing orientation information data master with orientation and unit conversion
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetMotionHeadingnCnvData(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+ SENSORMOTION_HEADINGINFO_DAT st_heading;
+ int16 i_heading;
+
+ pst_master = &gstMotionHeading_n;
+
+ /* Perform the orientation conversion[-179 to +180] -> [0 to 359] */
+ memcpy(&st_heading, pst_master->uc_data, sizeof(st_heading));
+ i_heading = static_cast<int16>(st_heading.Heading);
+ if (i_heading > 0) {
+ i_heading = static_cast<int16>(360 - i_heading);
+ } else {
+ i_heading = static_cast<int16>(i_heading * -1);
+ }
+ /* Perform unit conversion[Once] -> [0.01 degree] */
+ st_heading.Heading = (u_int16)(i_heading * 100);
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, &st_heading, sizeof(st_heading));
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed.cpp
new file mode 100755
index 0000000..0f7abe3
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed.cpp
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_MotionSpeed.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Speed information data master GET processing
+ *
+ * @param[out] *pst_data - VEHICLESENS_DATA_MASTER Pointer to the data master acquisition destination
+ * @param[in] uc_get_method - u_int8 acquisition method
+ */
+void VehicleSensGetMotionSpeed(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:other parameters cannot pass in
+ case VEHICLESENS_GETMETHOD_INTERNAL:
+ {
+ /** When acquiring internal calculation data */
+ VehicleSensGetMotionSpeedI(pst_data);
+ }
+ break;
+ case VEHICLESENS_GETMETHOD_NAVI:
+ {
+ /** To acquire NAVI data */
+ VehicleSensGetMotionSpeedN(pst_data);
+ break;
+ }
+ default:
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_g.cpp
new file mode 100755
index 0000000..9b8ae6c
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_g.cpp
@@ -0,0 +1,107 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_MotionSpeed_g.cpp
+ * @brief
+ * Vehicle Speed Information Data Master Management(NMEA information)
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstMotionSpeed_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Speed information data master initialization process(NMEA information)
+ */
+void VehicleSensInitMotionSpeedG(void) {
+ SENSORMOTION_SPEEDINFO_DAT st_speed;
+
+ memset(&gstMotionSpeed_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstMotionSpeed_g.ul_did = VEHICLE_DID_MOTION_SPEED;
+ /** Data size setting */
+ gstMotionSpeed_g.us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ /** Data content setting */
+ memset(&st_speed, 0x00, sizeof(st_speed));
+ st_speed.getMethod = SENSOR_GET_METHOD_GPS;
+ st_speed.SyncCnt = 0x00;
+ st_speed.isEnable = SENSORMOTION_STATUS_DISABLE;
+ memcpy(&gstMotionSpeed_g.uc_data[0], &st_speed, sizeof(st_speed));
+}
+
+/**
+ * @brief
+ * Rate information data master SET process(NMEA information)
+ *
+ * @param[in] *pst_speed - SENSORMOTION_SPEEDINFO_DAT Pointer to vehicle speed information
+ *
+ * @return VEHICLESENS_EQ : No data change<br>
+ * VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetMotionSpeedG(const SENSORMOTION_SPEEDINFO_DAT *pst_speed) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_MOTION_SPEED;
+ pst_master->us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Speed information data master GET processing(NMEA information)
+ *
+ * @param[out] *pst_speed - VEHICLESENS_DATA_MASTER Pointer to the data master acquisition destination
+ */
+void VehicleSensGetMotionSpeedG(VEHICLESENS_DATA_MASTER *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_i.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_i.cpp
new file mode 100755
index 0000000..7f01e2f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_i.cpp
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_MotionSpeed_i.cpp
+ * @brief
+ * Vehicle Speed Information Data Master Management(Internal calculation information)
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstMotionSpeed_i; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Speed information data master initialization process(Internal calculation information)
+ */
+void VehicleSensInitMotionSpeedI(void) {
+ SENSORMOTION_SPEEDINFO_DAT st_speed;
+
+ memset(&gstMotionSpeed_i, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstMotionSpeed_i.ul_did = VEHICLE_DID_MOTION_SPEED_INTERNAL;
+ /** Data size setting */
+ gstMotionSpeed_i.us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ /** Data content setting */
+ memset(&st_speed, 0x00, sizeof(st_speed));
+ st_speed.getMethod = SENSOR_GET_METHOD_POS;
+ st_speed.SyncCnt = 0x00;
+ st_speed.isEnable = SENSORMOTION_STATUS_DISABLE;
+ memcpy(&gstMotionSpeed_i.uc_data[0], &st_speed, sizeof(st_speed));
+}
+
+/**
+ * @brief
+ * Rate information data master SET process(Internal calculation information)
+ *
+ * @param[in] *pst_speed - SENSORMOTION_SPEEDINFO_DAT Pointer to vehicle speed information
+ *
+ * @return VEHICLESENS_EQ : No data change<br>
+ * VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetMotionSpeedI(const SENSORMOTION_SPEEDINFO_DAT *pst_speed) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_i;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_MOTION_SPEED_INTERNAL;
+ pst_master->us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Speed information data master GET processing(Internal calculation information)
+ *
+ * @param[out] *pst_speed - VEHICLESENS_DATA_MASTER Pointer to the data master acquisition destination
+ */
+void VehicleSensGetMotionSpeedI(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_i;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_n.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_n.cpp
new file mode 100755
index 0000000..9c8f5bc
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_MotionSpeed_n.cpp
@@ -0,0 +1,103 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_MotionSpeed_n.cpp
+ * @brief
+ * Vehicle Speed Information Data Master Management(Navi information)
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+#include "CommonDefine.h"
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstMotionSpeed_n; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Speed information data master initialization process(Navi information)
+ */
+void VehicleSensInitMotionSpeedN(void) {
+ SENSORMOTION_SPEEDINFO_DAT st_speed;
+
+ memset(&gstMotionSpeed_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstMotionSpeed_n.ul_did = VEHICLE_DID_MOTION_SPEED_NAVI;
+ /** Data size setting */
+ gstMotionSpeed_n.us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ /** Data content setting */
+ memset(&st_speed, 0x00, sizeof(st_speed));
+ st_speed.getMethod = SENSOR_GET_METHOD_NAVI;
+ st_speed.SyncCnt = 0x00;
+ st_speed.isEnable = SENSORMOTION_STATUS_DISABLE;
+ memcpy(&gstMotionSpeed_n.uc_data[0], &st_speed, sizeof(st_speed));
+}
+
+/**
+ * @brief
+ * Rate information data master SET process(Navi information)
+ *
+ * @param[in] *pst_speed - SENSORMOTION_SPEEDINFO_DAT Pointer to vehicle speed information
+ *
+ * @return VEHICLESENS_EQ : No data change<br>
+ * VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetMotionSpeedN(const SENSORMOTION_SPEEDINFO_DAT *pst_speed) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_n;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_MOTION_SPEED_NAVI;
+ pst_master->us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Speed information data master GET processing(Navi information)
+ *
+ * @param[out] *pst_speed - VEHICLESENS_DATA_MASTER Pointer to the data master acquisition destination
+ */
+void VehicleSensGetMotionSpeedN(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstMotionSpeed_n;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Clock_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Clock_g.cpp
new file mode 100755
index 0000000..a9bc0c9
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Clock_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Clock_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_CLOCK)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavClock_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-CLOCK vehicle sensor initialization function
+@outline NAV-CLOCK initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavClockG(void) {
+ memset(&gstNavClock_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavClock_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_CLOCK;
+ gstNavClock_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_CLOCK + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavClock_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_CLOCK;
+}
+
+/***************************************************************************
+@brief NAV-CLOCK SET vehicle sensor function
+@outline To update the master data NAV-CLOCK.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavClockG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavClock_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-CLOCK GET
+@outline Master Data provides the NAV-CLOCK
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavClockG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavClock_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Dop_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Dop_g.cpp
new file mode 100755
index 0000000..211e940
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Dop_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Dop_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_DOP)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavDop_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-DOP vehicle sensor initialization function
+@outline NAV-DOP initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavDopG(void) {
+ memset(&gstNavDop_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavDop_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_DOP;
+ gstNavDop_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_DOP + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavDop_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_DOP;
+}
+
+/***************************************************************************
+@brief NAV-DOP SET vehicle sensor function
+@outline To update the master data NAV-DOP.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavDopG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavDop_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-DOP GET
+@outline Master Data provides the NAV-DOP
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavDopG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavDop_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Posllh_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Posllh_g.cpp
new file mode 100755
index 0000000..17ebc04
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Posllh_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Posllh_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_POSLLH)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavPosllh_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-POSLLH vehicle sensor initialization function
+@outline NAV-POSLLH initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavPosllhG(void) {
+ memset(&gstNavPosllh_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavPosllh_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_POSLLH;
+ gstNavPosllh_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_POSLLH + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavPosllh_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_POSLLH;
+}
+
+/***************************************************************************
+@brief NAV-POSLLH SET vehicle sensor function
+@outline To update the master data NAV-POSLLH.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavPosllhG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavPosllh_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-POSLLH GET
+@outline Master Data provides the NAV-POSLLH
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavPosllhG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavPosllh_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Status_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Status_g.cpp
new file mode 100755
index 0000000..f03d48f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Status_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Status_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_STATUS)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavStatus_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-STATUS vehicle sensor initialization function
+@outline NAV-STATUS initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavStatusG(void) {
+ memset(&gstNavStatus_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavStatus_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_STATUS;
+ gstNavStatus_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_STATUS + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavStatus_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_STATUS;
+}
+
+/***************************************************************************
+@brief NAV-STATUS SET vehicle sensor function
+@outline To update the master data NAV-STATUS.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavStatusG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavStatus_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-STATUS GET
+@outline Master Data provides the NAV-STATUS
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavStatusG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavStatus_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_SvInfo_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_SvInfo_g.cpp
new file mode 100755
index 0000000..7211ce8
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_SvInfo_g.cpp
@@ -0,0 +1,108 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_SvInfo_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_SVINFO)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavSvInfo_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-SVINFO vehicle sensor initialization function
+@outline NAV-SVINFO initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavSvInfoG(void) {
+ memset(&gstNavSvInfo_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavSvInfo_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_SVINFO;
+ /* Initially, the maximum storage size is set.(Common header size(8) + NAV-SVINFO fixed-data-size(8) +
+ *(Maximum number of channels(16) + Size of single channel data(12))) */
+ gstNavSvInfo_g.us_size = (VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE + VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO) +
+ (VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO_CH_MAX * \
+ VEHICLE_DSIZE_GPS_UBLOX_NAV_SVINFO_ALONE_MAX);
+ gstNavSvInfo_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_SVINFO;
+}
+
+/***************************************************************************
+@brief NAV-SVINFO SET vehicle sensor function
+@outline To update the master data NAV-SVINFO.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavSvInfoG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavSvInfo_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-SVINFO GET
+@outline Master Data provides the NAV-SVINFO
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavSvInfoG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavSvInfo_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeGps_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeGps_g.cpp
new file mode 100755
index 0000000..1d959cd
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeGps_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_TimeGps_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavTimeGps_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-TIMEGPS vehicle sensor initialization function
+@outline NAV-TIMEGPS initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavTimeGpsG(void) {
+ memset(&gstNavTimeGps_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavTimeGps_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS;
+ gstNavTimeGps_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_TIMEGPS + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavTimeGps_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_TIMEGPS;
+}
+
+/***************************************************************************
+@brief NAV-TIMEGPS SET vehicle sensor function
+@outline To update the master data NAV-TIMEGPS.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavTimeGpsG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavTimeGps_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-TIMEGPS GET
+@outline Master Data provides the NAV-TIMEGPS
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavTimeGpsG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavTimeGps_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeUtc_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeUtc_g.cpp
new file mode 100755
index 0000000..8368257
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_TimeUtc_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_TimeUtc_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavTimeUtc_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-TIMEUTC vehicle sensor initialization function
+@outline NAV-TIMEUTC initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavTimeUtcG(void) {
+ memset(&gstNavTimeUtc_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavTimeUtc_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC;
+ gstNavTimeUtc_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_TIMEUTC + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavTimeUtc_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_TIMEUTC;
+}
+
+/***************************************************************************
+@brief NAV-TIMEUTC SET vehicle sensor function
+@outline To update the master data NAV-TIMEUTC.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavTimeUtcG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavTimeUtc_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-TIMEUTC GET
+@outline Master Data provides the NAV-TIMEUTC
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavTimeUtcG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavTimeUtc_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Velned_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Velned_g.cpp
new file mode 100755
index 0000000..ad757aa
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Nav_Velned_g.cpp
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Velned_g.cpp
+@detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_VELNED)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavVelned_g; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief NAV-VELNED vehicle sensor initialization function
+@outline NAV-VELNED initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitNavVelnedG(void) {
+ memset(&gstNavVelned_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
+ gstNavVelned_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_VELNED;
+ gstNavVelned_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_VELNED + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
+ gstNavVelned_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_VELNED;
+}
+
+/***************************************************************************
+@brief NAV-VELNED SET vehicle sensor function
+@outline To update the master data NAV-VELNED.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : A pointer to the received data message or the direct line
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetNavVelnedG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavVelned_g;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->us_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
+ pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
+
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-VELNED GET
+@outline Master Data provides the NAV-VELNED
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetNavVelnedG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
+
+ pst_master = &gstNavVelned_g;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
+ pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_NaviinfoDiagGPS_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_NaviinfoDiagGPS_g.cpp
new file mode 100755
index 0000000..7335ce1
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_NaviinfoDiagGPS_g.cpp
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file VehicleSens_Did_NaviinfoDiagGPS_g.cpp
+@detail Management of GPS Information Master for Diag
+******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************
+ * Global variable *
+ *************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstNaviinfoDiagGPS_g; // NOLINT(readability/nolint)
+
+/****************************************************************************
+@brief VehicleSensInitNaviinfoDiagGPSg<BR>
+ Initialization of GPS Data Master for Diag
+@outline Initializing GPS Data Master for Diag
+@param[in] none
+@param[out] none
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensInitNaviinfoDiagGPSg(void) {
+ memset(&gstNaviinfoDiagGPS_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
+
+ /** Data ID setting */
+ gstNaviinfoDiagGPS_g.ul_did = VEHICLE_DID_NAVIINFO_DIAG_GPS;
+ /** Data size setting */
+ gstNaviinfoDiagGPS_g.us_size = sizeof(NAVIINFO_DIAG_GPS);
+}
+
+/****************************************************************************
+@brief VehicleSensSetNaviinfoDiagGPSg<BR>
+ GPS Information Master SET Processing for Diag
+@outline Update the GPS Data Master for Diag
+@param[in] NAVIINFO_DIAG_GPS* pst_diag_data : GPS information for Diag
+@param[out] none
+@return u_int8
+@retval VEHICLESENS_EQ : No data change
+@retval VEHICLESENS_NEQ : Data change
+*******************************************************************************/
+u_int8 VehicleSensSetNaviinfoDiagGPSg(const NAVIINFO_DIAG_GPS *pst_diag_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = &gstNaviinfoDiagGPS_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_diag_data, sizeof(NAVIINFO_DIAG_GPS));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_NAVIINFO_DIAG_GPS;
+ pst_master->us_size = sizeof(NAVIINFO_DIAG_GPS);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_diag_data, sizeof(NAVIINFO_DIAG_GPS));
+
+ return(uc_ret);
+}
+
+/****************************************************************************
+@brief VehicleSensGetNaviinfoDiagGPSg<BR>
+ GPS Information Master GET Processing for Diag
+@outline Provide a master GPS information for Diag
+@param[in] none
+@param[out] SENSOR_MSG_GPSDATA_DAT *pst_data : Pointer to the data master acquisition destination
+@return none
+@retval none
+*******************************************************************************/
+void VehicleSensGetNaviinfoDiagGPSg(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
+
+ pst_master = reinterpret_cast<VEHICLESENS_DATA_MASTER_GPS_FORMAT*>(&gstNaviinfoDiagGPS_g);
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime.cpp
new file mode 100755
index 0000000..cb80e6f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime.cpp
@@ -0,0 +1,115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_PulseTime.cpp
+ * @brief
+ * Vehicle sensor data master(VEHICLE_DID_PULSE_TIME)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/**
+ * @brief
+ * Vehicle sensor pulse time GET function
+ *
+ * Provide interpulse time data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetPulseTime(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetPulseTimel(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/**
+ * @brief
+ * Vehicle sensor inter-pulse time (initial delivery) GET function
+ *
+ * Provide interpulse time data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+void VehicleSensGetPulseTimeExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetPulseTimeExtl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/**
+ * @brief
+ * Vehicle sensor pulse time (initial sensor) GET function
+ *
+ * Provide interpulse time data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ */
+
+void VehicleSensGetPulseTimeFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ break;
+ }
+ default:
+ break;
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTimeExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTimeExt_l.cpp
new file mode 100755
index 0000000..04e66b5
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTimeExt_l.cpp
@@ -0,0 +1,143 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_PulseTimeExt_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_PULSE_TIME)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER_EXT g_st_pulsetime_ext_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor inter-pulse time initialization function
+ *
+ * Inter-pulse time data master initialization processing
+ */
+void VehicleSensInitPulseTimeExtl(void) {
+ (void)memset(reinterpret_cast<void *>(&g_st_pulsetime_ext_l), 0, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ g_st_pulsetime_ext_l.ul_did = POSHAL_DID_PULSE_TIME;
+ g_st_pulsetime_ext_l.us_size = VEHICLE_DSIZE_PULSE_TIME_EXT_INIT;
+ g_st_pulsetime_ext_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor pulse time SET function
+ *
+ * Update the interpulse time data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+void VehicleSensSetPulseTimeExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_size = 0;
+ u_int16 us_start = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &g_st_pulsetime_ext_l;
+ /* 4byte * (Number of data items + 32 data items) */
+ us_size = static_cast<u_int16>(sizeof(u_int32) * (1 + VEHICLE_SNS_INFO_PULSE_NUM));
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[PulseTime];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[PulseTime] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_PULSE_TIME_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/**
+ * @brief
+ * Vehicle sensor pulse time GET function
+ *
+ * Provide interpulse time data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetPulseTimeExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &g_st_pulsetime_ext_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ /* Size of one data item: 4byte * (Number of data items + 32 data items) */
+ us_size = static_cast<u_int16>(sizeof(u_int32) * (1 + VEHICLE_SNS_INFO_PULSE_NUM));
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[PulseTime];
+ }
+
+ /* Acquire data from the oldest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[PulseTime] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[PulseTime] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime_l.cpp
new file mode 100755
index 0000000..527bb72
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_PulseTime_l.cpp
@@ -0,0 +1,93 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_PulseTime_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_PULSE_TIME)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstPulseTime_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle sensor inter-pulse time initialization function
+ *
+ * Inter-pulse time data master initialization processing
+ */
+void VehicleSensInitPulseTimel(void) {
+ memset(&gstPulseTime_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstPulseTime_l.ul_did = POSHAL_DID_PULSE_TIME;
+ gstPulseTime_l.us_size = VEHICLE_DSIZE_PULSE_TIME;
+ gstPulseTime_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/**
+ * @brief
+ * Vehicle sensor inter-pulse time initialization function
+ *
+ * Update the interpulse time data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ No data change<br>
+ * VEHICLESENS_NEQ Data change
+ */
+u_int8 VehicleSensSetPulseTimelG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstPulseTime_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle sensor pulse time GET function
+ *
+ * Provide interpulse time data master
+ *
+ * @param[in] Pointer to the data master acquisition destination
+ */
+void VehicleSensGetPulseTimel(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstPulseTime_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev.cpp
new file mode 100755
index 0000000..08c5ec7
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev.cpp
@@ -0,0 +1,118 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_Rev.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_REV)
+ * Module configuration :VehicleSensGetRev() Vehicle Sensor REV GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetRev
+* ABSTRACT : Vehicle Sensor REV GET Functions
+* FUNCTION : Provide a REV data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetRev(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetRevl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetRevFst
+* ABSTRACT : Vehicle sensor GET function
+* FUNCTION : Provide a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetRevFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetRevFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+
+/**
+ * @brief
+ * Vehicle Sensor REV GET Functions
+ *
+ * Provide a REV data master
+ *
+ * @param[in] *pst_data: Pointer to the data master acquisition destination
+ * @param[in] uc_get_method: Acquisition method(Direct Line or CAN)
+ *
+ * @return none
+ */
+void VehicleSensGetRevExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetRevExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevExt_l.cpp
new file mode 100755
index 0000000..0f4e5e6
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevExt_l.cpp
@@ -0,0 +1,134 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_RevExt_l.cpp
+ * @brief
+ * Vehicle sensor data master(POSHAL_DID_REV)
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT g_st_revext_l; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * Vehicle Sensor REV Initialization Functions
+ *
+ * REV data master initialization processing
+ *
+ * @param[in] none
+ */
+void VehicleSensInitRevExtl(void) {
+ u_int16 *pus;
+
+ memset(&g_st_revext_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ g_st_revext_l.ul_did = POSHAL_DID_REV;
+ g_st_revext_l.us_size = VEHICLE_DSIZE_REV_EXT_INIT;
+ g_st_revext_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+ pus = reinterpret_cast<u_int16 *>(g_st_revext_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_SNS_COUNTER, VEHICLE_DSIZE_REV_EXT);
+}
+
+/**
+ * @brief
+ * Vehicle Sensor REV SET Functions
+ *
+ * Update the REV data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ */
+void VehicleSensSetRevExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+
+ pst_master = &g_st_revext_l;
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[Rev];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_data[us_start] = pst_data->uc_data[0];
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[Rev] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_REV_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + sizeof(u_int8));
+ }
+}
+
+/**
+ * @brief
+ * Vehicle Sensor REV GET Functions
+ *
+ * Provide a REV data master
+ *
+ * @param[in] *pst_data : Pointer to the data master acquisition destination
+ */
+void VehicleSensGetRevExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &g_st_revext_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[Rev];
+ }
+
+ /* Acquire data from the newest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[Rev] + us_cnt < VEHICLE_DKEEP_MAX) {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[(gstPkgTempExt.start_point[Rev] + us_cnt)];
+ } else {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[us_loop_cnt];
+ us_loop_cnt++;
+ }
+ } else {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[us_cnt];
+ }
+ }
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevFst_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevFst_l.cpp
new file mode 100755
index 0000000..49d4654
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_RevFst_l.cpp
@@ -0,0 +1,171 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_RevFst_l.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_REV_FST)
+ * Module configuration :VehicleSensInitRevFstl() Vehicle Sensor REV Initialization Functions
+ * :VehicleSensSetRevFstl() Vehicle Sensor REV SET Functions
+ * :VehicleSensSetRevFstG() Vehicle Sensor REV SET Functions
+ * :VehicleSensGetRevFstl() Vehicle Sensor REV GET Functions
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST gstRevFst_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitRevFstl
+* ABSTRACT : Vehicle Sensor REV Initialization Functions
+* FUNCTION : REV data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitRevFstl(void) {
+ (void)memset(reinterpret_cast<void *>(&gstRevFst_l), 0, sizeof (VEHICLESENS_DATA_MASTER_FST));
+ gstRevFst_l.ul_did = POSHAL_DID_REV_FST;
+ gstRevFst_l.us_size = 0U;
+ gstRevFst_l.uc_rcvflag = 0U;
+ gstRevFst_l.partition_flg = 0;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetRevFstl
+* ABSTRACT : Vehicle Sensor REV SET Functions
+* FUNCTION : Update the REV data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetRevFstl(const LSDRV_LSDATA_FST *pst_data) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstRevFst_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetRevFstG
+* ABSTRACT : Vehicle Sensor REV SET Functions
+* FUNCTION : Update the REV data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetRevFstG(const LSDRV_LSDATA_FST_REV *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstRevFst_l;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_max == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (partition_num == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_num == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_REV_FST],
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_REV_FST],
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetRevFstl
+* ABSTRACT : Vehicle Sensor REV GET Functions
+* FUNCTION : Provide a REV data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetRevFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstRevFst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
+
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev_l.cpp
new file mode 100755
index 0000000..8a8178a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_Rev_l.cpp
@@ -0,0 +1,157 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_Rev_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_REV)
+ * Module configuration :VehicleSensInitRevl() Vehicle Sensor REV Initialization Functions
+ * :VehicleSensSetRevl() Vehicle Sensor REV SET Functions
+ * :VehicleSensGetRevl() Vehicle Sensor REV GET Functions
+ * :VehicleSensGetRevline() Vehicle Sensor REV GET Functions(_LINE)
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstRev_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitRevl
+* ABSTRACT : Vehicle Sensor REV Initialization Functions
+* FUNCTION : REV data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitRevl(void) {
+ memset(&gstRev_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstRev_l.ul_did = VEHICLE_DID_REV;
+ gstRev_l.us_size = VEHICLE_DSIZE_REV;
+ gstRev_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetRevl
+* ABSTRACT : Vehicle Sensor REV SET Functions
+* FUNCTION : Update the REV data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetRevl(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstRev_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * Vehicle Sensor REV SET Functions
+ *
+ * Update the REV data master
+ *
+ * @param[in] *pst_data : Pointer to the message data received by the direct line
+ *
+ * @return VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetRevlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstRev_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetRevl
+* ABSTRACT : Vehicle Sensor REV GET Functions
+* FUNCTION : Provide a REV data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetRevl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstRev_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetRevline
+* ABSTRACT : Vehicle Sensor REV GET Functions(For direct lines)
+* FUNCTION : Provide a REV data master(For direct lines)
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetRevline(VEHICLESENS_DATA_MASTER *pst_data) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstRev_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = VEHICLE_DID_REV_LINE;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
+// LCOV_EXCL_STOP
+
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime.cpp
new file mode 100755
index 0000000..b8db26c
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime.cpp
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_SettingTime.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+
+/**
+ * @brief
+ * GPS setting time information data master GET process
+ *
+ * Provide the GPS setting time information data master
+ *
+ * @param[in] u_int8 uc_get_method : Acquisition method(NAVI)
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ *
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetSettingTime(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:other parameters cannot pass in
+ case VEHICLESENS_GETMETHOD_OTHER:
+ {
+ /** Acquiring from Clock */
+ VehicleSensGetSettingTimeclock(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime_clock.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime_clock.cpp
new file mode 100755
index 0000000..a415a84
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SettingTime_clock.cpp
@@ -0,0 +1,116 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_SettingTime_clock.cpp
+ * @brief
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstSettingTime_clock; // NOLINT(readability/nolint)
+
+/**
+ * @brief
+ * GPS setting time information data master initialization process(NAVI information)
+ *
+ * Initialize the GPS setting time information data master
+ *
+ * @param[in] none
+ * @param[out] none
+ * @return none
+ * @retval none
+ */
+void VehicleSensInitSettingTimeclock(void) {
+ POS_DATETIME st_time;
+
+ memset(&gstSettingTime_clock, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstSettingTime_clock.ul_did = VEHICLE_DID_SETTINGTIME;
+
+ /** Data size setting */
+ gstSettingTime_clock.us_size = sizeof(POS_DATETIME);
+
+ /** Data content setting */
+ memset(&st_time, 0x00, sizeof(st_time));
+ memcpy(&gstSettingTime_clock.uc_data[0], &st_time, sizeof(st_time));
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS setting time information data master SET process(NAVI information)
+ *
+ * Update the GPS setting time information data master
+ *
+ * @param[in] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @param[out] none
+ * @return u_int8
+ * @retval VEHICLESENS_EQ : No data change
+ * @retval VEHICLESENS_NEQ : Data change
+ */
+u_int8 VehicleSensSetSettingTimeclock(const POS_DATETIME *pst_rcv_time) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSettingTime_clock;
+
+ /** Compare the data master and generated data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_rcv_time, sizeof(POS_DATETIME));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = VEHICLE_DID_SETTINGTIME;
+ pst_master->us_size = sizeof(POS_DATETIME);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_rcv_time, sizeof(POS_DATETIME));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * GPS setting time information data master GET process(NAVI information)
+ *
+ * Provide the GPS setting time information data master
+ *
+ * @param[in] none
+ * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
+ * @return none
+ * @retval none
+ */
+void VehicleSensGetSettingTimeclock(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSettingTime_clock;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return;
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter.cpp
new file mode 100755
index 0000000..6456125
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter.cpp
@@ -0,0 +1,90 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SnsCounter.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_SNS_COUNTER)
+ * Module configuration :VehicleSensGetSnsCounter() Vehicle sensor SNS_COUNTER GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSnsCounter
+* ABSTRACT : Vehicle sensor SNS_COUNTER GET function
+* FUNCTION : Provide the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSnsCounter(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSnsCounterl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetSnsCounterExt
+* ABSTRACT : Vehicle sensor SNS_COUNTER GET function
+* FUNCTION : Provide the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSnsCounterExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSnsCounterExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+#endif
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounterExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounterExt_l.cpp
new file mode 100755
index 0000000..61b7a42
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounterExt_l.cpp
@@ -0,0 +1,155 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SnsCounterExt_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SNS_COUNTER)
+ * Module configuration :VehicleSensInitSnsCounterl() Vehicle sensor SNS_COUNTER initialization function
+ * :VehicleSensSetSnsCounterl() Vehicle sensor SNS_COUNTER SET function
+ * :VehicleSensGetSnsCounterl() Vehicle sensor SNS_COUNTER GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Response */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstSnsCounterExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSnsCounterExtl
+* ABSTRACT : Vehicle sensor SNS_COUNTER initialization function
+* FUNCTION : SNS_COUNTER data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSnsCounterExtl(void) {
+ u_int16 *pus;
+
+ memset(&gstSnsCounterExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstSnsCounterExt_l.ul_did = POSHAL_DID_SNS_COUNTER;
+ gstSnsCounterExt_l.us_size = VEHICLE_DSIZE_SNS_COUNTER_EXT_INIT;
+ pus = reinterpret_cast<u_int16 *>(gstSnsCounterExt_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_SNS_COUNTER, VEHICLE_DSIZE_SNS_COUNTER_EXT);
+
+ /* Initializing Initial Delivery Internal Information */
+ memset(&gstPkgTempExt, 0x00, sizeof(VEHICLESENS_PKG_DELIVERY_TEMP_EXT));
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSnsCounterExtl
+* ABSTRACT : Vehicle sensor SNS_COUNTER SET function
+* FUNCTION : Update the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetSnsCounterExtl(const LSDRV_LSDATA *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSnsCounterExtlG
+* ABSTRACT : Vehicle sensor SNS_COUNTER SET function
+* FUNCTION : Update the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetSnsCounterExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+
+ pst_master = &gstSnsCounterExt_l;
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[SNSCounter];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_data[us_start] = pst_data->uc_data[0];
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[SNSCounter] = us_start;
+
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_SNS_COUNTER_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + sizeof(u_int8));
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSnsCounterExtl
+* ABSTRACT : Vehicle sensor SNS_COUNTER GET function
+* FUNCTION : Provide the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSnsCounterExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstSnsCounterExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[SNSCounter];
+ }
+
+ /* Acquire data from the newest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[SNSCounter] + us_cnt < VEHICLE_DKEEP_MAX) {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[(gstPkgTempExt.start_point[SNSCounter] + us_cnt)];
+ } else {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[us_loop_cnt];
+ us_loop_cnt++;
+ }
+ } else {
+ pst_data->uc_data[us_cnt] = pst_master->uc_data[us_cnt];
+ }
+ }
+}
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter_l.cpp
new file mode 100755
index 0000000..b81b4b3
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SnsCounter_l.cpp
@@ -0,0 +1,124 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SnsCounter_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SNS_COUNTER)
+ * Module configuration :VehicleSensInitSnsCounterl() Vehicle sensor SNS_COUNTER initialization function
+ * :VehicleSensSetSnsCounterl() Vehicle sensor SNS_COUNTER SET function
+ * :VehicleSensGetSnsCounterl() Vehicle sensor SNS_COUNTER GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstSnsCounter_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSnsCounterl
+* ABSTRACT : Vehicle sensor SNS_COUNTER initialization function
+* FUNCTION : SNS_COUNTER data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSnsCounterl(void) {
+ memset(&gstSnsCounter_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstSnsCounter_l.ul_did = POSHAL_DID_SNS_COUNTER;
+ gstSnsCounter_l.us_size = VEHICLE_DSIZE_SNS_COUNTER;
+ gstSnsCounter_l.uc_data[0] = VEHICLE_DINIT_SNS_COUNTER;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSnsCounterl
+* ABSTRACT : Vehicle sensor SNS_COUNTER SET function
+* FUNCTION : Update the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSnsCounterl(const LSDRV_LSDATA *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSnsCounter_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSnsCounterlG
+* ABSTRACT : Vehicle sensor SNS_COUNTER SET function
+* FUNCTION : Update the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSnsCounterlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSnsCounter_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSnsCounterl
+* ABSTRACT : Vehicle sensor SNS_COUNTER GET function
+* FUNCTION : Provide the SNS_COUNTER data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSnsCounterl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSnsCounter_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph.cpp
new file mode 100755
index 0000000..4705774
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph.cpp
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedKmph.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_KMPH)
+ * Module configuration :VehicleSensGetSpeedKmph() Vehicle Sensor SPEED_KMPH GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedKmph
+* ABSTRACT : Vehicle Sensor SPEED_KMPH GET Function
+* FUNCTION : Provide the SPEED_KMPH data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(DIRECT or CAN or NAVI)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedKmph(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSpeedKmphl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph_l.cpp
new file mode 100755
index 0000000..abbb27a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedKmph_l.cpp
@@ -0,0 +1,156 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedKmph_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_KMPH)
+ * Module configuration :VehicleSensInitSpeedKmphl() Vehicle sensor SPEED_KMPH initialization function
+ * :VehicleSensSetSpeedKmphl() Vehicle sensor SPEED_KMPH SET function
+ * :VehicleSensGetSpeedKmphl() Vehicle Sensor SPEED_KMPH GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstSpeedKmph_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSpeedKmphl
+* ABSTRACT : Vehicle sensor SPEED_KMPH initialization function
+* FUNCTION : SPEED_KMPH data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSpeedKmphl(void) {
+ u_int16 *pus;
+
+ memset(&gstSpeedKmph_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+ gstSpeedKmph_l.ul_did = POSHAL_DID_SPEED_KMPH;
+ gstSpeedKmph_l.us_size = VEHICLE_DSIZE_SPEED_KMPH;
+
+ pus = reinterpret_cast<u_int16 *>(gstSpeedKmph_l.uc_data);
+ *pus = VEHICLE_DINIT_SPEED_KMPH;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedKmphl
+* ABSTRACT : Vehicle sensor SPEED_KMPH SET function
+* FUNCTION : Update the SPEED_KMPH data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedKmphl(const LSDRV_LSDATA *pst_data) { // LCOV_EXCL_START 8: dead code.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedKmph_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedKmphlG
+* ABSTRACT : Vehicle sensor SPEED_KMPH SET function
+* FUNCTION : Update the SPEED_KMPH data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedKmphlG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ static u_int16 pre_speed[2] = {0, 0};
+ u_int16 cur_speed = 0;
+ memcpy(&cur_speed, &pst_data->uc_data[0], sizeof(u_int16));
+
+ BOOL under2 = TRUE;
+ BOOL eq_speed = TRUE;
+
+ pst_master = &gstSpeedKmph_l;
+
+ /* Transition of 0->1km/h and 1->0km/h requires 3 consecutive matches. Compliance with driving regulations */
+ under2 = ((pre_speed[1] < 2) && (pre_speed[0] < 2) && (cur_speed < 2));
+ eq_speed = ((pre_speed[1] == pre_speed[0]) && (pre_speed[0] == cur_speed));
+
+ if ((under2 == TRUE) && (eq_speed != TRUE) && (pst_master->uc_rcvflag == VEHICLE_RCVFLAG_ON)) {
+ uc_ret = VEHICLESENS_EQ; /* Return without data change */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+
+ } else {
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data,
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* For the next comparison,Update Speed */
+ pre_speed[1] = pre_speed[0];
+ pre_speed[0] = cur_speed;
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedKmphl
+* ABSTRACT : Vehicle Sensor SPEED_KMPH GET Function
+* FUNCTION : Provide the SPEED_KMPH data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedKmphl(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedKmph_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse.cpp
new file mode 100755
index 0000000..3f4ec8a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse.cpp
@@ -0,0 +1,117 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedPulse.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_)
+ * Module configuration :VehicleSensGetSpeedPulse() Vehicle sensor GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulse
+* ABSTRACT : Vehicle sensor GET function
+* FUNCTION : Provide a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulse(VEHICLESENS_DATA_MASTER *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSpeedPulsel(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseExt
+* ABSTRACT : Vehicle sensor GET function
+* FUNCTION : Provide a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseExt(VEHICLESENS_DATA_MASTER_EXT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSpeedPulseExtl(pst_data);
+ break;
+ }
+ default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */
+ break;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseFst
+* ABSTRACT : Vehicle sensor GET function
+* FUNCTION : Provide a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) { // LCOV_EXCL_BR_LINE 6:VEHICLESENS_GETMETHOD_CAN cannot to pass in
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ break; // LCOV_EXCL_LINE 8: dead code
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSpeedPulseFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseExt_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseExt_l.cpp
new file mode 100755
index 0000000..86c8f49
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseExt_l.cpp
@@ -0,0 +1,150 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedPulseExt_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_PULSE)
+ * Module configuration :VehicleSensInitSpeedPulseExtl() Vehicle sensor SPEED_PULSE initialization function
+ * :VehicleSensSetSpeedPulseExtlG() Vehicle Sensor SPEED_PULSE SET Function
+ * :VehicleSensGetSpeedPulseExtl() Vehicle Sensor SPEED_PULSE GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* Ignore->MISRA-C++:2008 Rule 2-7-2 */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_EXT gstSpeedPulseExt_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSpeedPulseExtl
+* ABSTRACT : Vehicle sensor SPEED_PULSE initialization function
+* FUNCTION : SPEED_PULSE data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSpeedPulseExtl(void) {
+ u_int16 *pus;
+
+ memset(&gstSpeedPulseExt_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_EXT));
+ gstSpeedPulseExt_l.ul_did = POSHAL_DID_SPEED_PULSE;
+ gstSpeedPulseExt_l.us_size = VEHICLE_DSIZE_SPEED_PULSE_EXT_INIT;
+
+ pus = reinterpret_cast<u_int16 *>(gstSpeedPulseExt_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_SPEED_PULSE, VEHICLE_DSIZE_SPEED_PULSE_EXT);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulseExtlG
+* ABSTRACT : Vehicle Sensor SPEED_PULSE SET Function
+* FUNCTION : Update the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+void VehicleSensSetSpeedPulseExtlG(const LSDRV_LSDATA_G *pst_data) {
+ VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ u_int16 us_start = 0;
+ u_int16 us_size = 0;
+ u_int16 us_cnt = 0;
+
+ pst_master = &gstSpeedPulseExt_l;
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Retrieve the location where the received one is stored */
+ us_start = gstPkgTempExt.start_point[SpeedPulse];
+
+ /* Stored in data master(Order of reception)*/
+ if (us_start >= VEHICLE_DKEEP_MAX) {
+ /* Store the latest one at position 0 */
+ us_start = VEHICLE_DATA_POS_00;
+ /* If you are discarding old data,,Set a flag */
+ gstPkgTempExt.data_break = VEHICLE_SNS_BREAK;
+ }
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ for (us_cnt = 0; us_cnt < us_size; us_cnt++) {
+ pst_master->uc_data[us_start * us_size + us_cnt] = (u_int8)(pst_data->uc_data[us_cnt]);
+ }
+
+ /* Update next storage start position and latest data storage position */
+ us_start++;
+ gstPkgTempExt.start_point[SpeedPulse] = us_start;
+ /* Update data master size */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Make the size of all extended data masters */
+ pst_master->us_size = VEHICLE_DSIZE_SPEED_PULSE_EXT;
+ } else {
+ /* Add the size of one received data item */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + us_size);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseExtl
+* ABSTRACT : Vehicle Sensor SPEED_PULSE GET Function
+* FUNCTION : Provide the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseExtl(VEHICLESENS_DATA_MASTER_EXT *pst_data) {
+ const VEHICLESENS_DATA_MASTER_EXT *pst_master;
+ uint16_t us_size = 0;
+ uint16_t us_data_cnt = 0; // Number of data contained
+ uint16_t us_loop_cnt = 0; // 64 over index
+
+ /* Store the data master in the specified destination. */
+ pst_master = &gstSpeedPulseExt_l;
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+
+ us_size = static_cast<u_int16>(sizeof(u_int16) * 10); /* Size of one data item: 2byte * 10 data items */
+
+ /* Checking whether the number of stored entries is looped */
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ us_data_cnt = VEHICLE_DKEEP_MAX;
+ } else {
+ us_data_cnt = gstPkgTempExt.start_point[SpeedPulse];
+ }
+
+ /* Acquire data from the newest data master */
+ for (uint16_t us_cnt = 0; us_cnt < us_data_cnt; us_cnt++) {
+ if (gstPkgTempExt.data_break == VEHICLE_SNS_BREAK) {
+ /* Get information before loop */
+ if (gstPkgTempExt.start_point[SpeedPulse] + us_cnt < VEHICLE_DKEEP_MAX) {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[(gstPkgTempExt.start_point[SpeedPulse] + us_cnt) * us_size], us_size);
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_loop_cnt * us_size], us_size);
+ us_loop_cnt++;
+ }
+ } else {
+ memcpy(&pst_data->uc_data[us_cnt * us_size],
+ &pst_master->uc_data[us_cnt * us_size], us_size);
+ }
+ }
+}
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlag.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlag.cpp
new file mode 100755
index 0000000..f6ab8df
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlag.cpp
@@ -0,0 +1,133 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleSens_Did_Nav_Clock_g.cpp
+@detail Master vehicle sensor data(POSHAL_DID_SPEED_PULSE_FLAG)
+*****************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstSpeedPulseFlag; // NOLINT(readability/nolint)
+
+/***************************************************************************
+@brief VehicleSensInitSpeedPulseFlag
+@outline SPEED_PULSE_FLAG initialization process data master
+@type Completion return type
+@param[in] none
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensInitSpeedPulseFlag(void) {
+ (void)memset(reinterpret_cast<void *>(&gstSpeedPulseFlag), 0, sizeof(VEHICLESENS_DATA_MASTER));
+ gstSpeedPulseFlag.ul_did = POSHAL_DID_SPEED_PULSE_FLAG;
+ gstSpeedPulseFlag.us_size = VEHICLE_DSIZE_SPEED_PULSE_FLAG;
+ gstSpeedPulseFlag.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/***************************************************************************
+@brief NAV-CLOCK SET vehicle sensor function
+@outline To update the master data NAV-CLOCK.
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
+@threshold none
+@return u_int8
+@retval VEHICLESENS_EQ : No data changes
+@retval VEHICLESENS_NEQ : With data changes
+@trace
+*****************************************************************************/
+u_int8 VehicleSensSetSpeedPulseFlag(const LSDRV_LSDATA_G *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedPulseFlag;
+
+ /** Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/***************************************************************************
+@brief Vehicle sensor function NAV-CLOCK GET
+@outline Master Data provides the NAV-CLOCK
+@type Completion return type
+@param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
+@threshold none
+@return void
+@retval none
+@trace
+*****************************************************************************/
+void VehicleSensGetSpeedPulseFlag(VEHICLESENS_DATA_MASTER *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedPulseFlag;
+
+ /** Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseFlagFst
+* ABSTRACT : Vehicle sensor GET function
+* FUNCTION : Provide a data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* uc_get_method : Acquisition method(Direct Line or CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseFlagFst(VEHICLESENS_DATA_MASTER_FST *pst_data, u_int8 uc_get_method) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_CAN:
+ {
+ /* When acquiring from CAN data */
+ break;
+ }
+ case VEHICLESENS_GETMETHOD_LINE:
+ {
+ /* To acquire from LineSensor */
+ VehicleSensGetSpeedPulseFlagFstl(pst_data);
+ break;
+ }
+ default:
+ break;
+ }
+}
+#endif
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlagFst_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlagFst_l.cpp
new file mode 100755
index 0000000..051c6bb
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFlagFst_l.cpp
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedPulseFlagFst_l.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_PULSE_FLAG_FST)
+ * Module configuration :VehicleSensInitSpeedPulseFlagFstl() Vehicle sensor SPEED_PULSE_FLAG initialization function
+ * :VehicleSensSetSpeedPulseFlagFstl() Vehicle Sensor SPEED_PULSE_FLAG SET Function
+ * :VehicleSensSetSpeedPulseFlagFstG() Vehicle Sensor SPEED_PULSE_FLAG SET Function
+ * :VehicleSensGetSpeedPulseFlagFstl() Vehicle Sensor SPEED_PULSE_FLAG GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/* #Polaris_003 START */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Response */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSpeedPulseFlagFstl
+* ABSTRACT : Vehicle sensor SPEED_PULSE_FLAG initialization function
+* FUNCTION : SPEED_PULSE_FLAG data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSpeedPulseFlagFstl(void) {
+ return;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulseFlagFstl
+* ABSTRACT : Vehicle Sensor SPEED_PULSE_FLAG SET Function
+* FUNCTION : Update the SPEED_PULSE_FLAG data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulseFlagFstl(const LSDRV_LSDATA_FST *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(VEHICLESENS_EQ);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulseFlagFstG
+* ABSTRACT : Vehicle Sensor SPEED_PULSE_FLAG SET Function
+* FUNCTION : Update the SPEED_PULSE_FLAG data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulseFlagFstG(const LSDRV_LSDATA_FST_SPEED_PULSE_FLAG *pst_data) {
+ return VEHICLESENS_EQ;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseFlagFstl
+* ABSTRACT : Vehicle Sensor SPEED_PULSE_FLAG GET Function
+* FUNCTION : Provide the SPEED_PULSE_FLAG data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseFlagFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return;
+}
+
+#endif
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFst_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFst_l.cpp
new file mode 100755
index 0000000..26952b3
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulseFst_l.cpp
@@ -0,0 +1,172 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedPulseFst_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_PULSE_FST)
+ * Module configuration :VehicleSensInitSpeedPulseFstl() Vehicle sensor SPEED_PULSE initialization function
+ * :VehicleSensSetSpeedPulseFstl() Vehicle Sensor SPEED_PULSE SET Function
+ * :VehicleSensSetSpeedPulseFstG() Vehicle Sensor SPEED_PULSE SET Function
+ * :VehicleSensGetSpeedPulseFstl() Vehicle Sensor SPEED_PULSE GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_FST gstSpeedPulseFst_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSpeedPulseFstl
+* ABSTRACT : Vehicle sensor SPEED_PULSE initialization function
+* FUNCTION : SPEED_PULSE data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSpeedPulseFstl(void) {
+ u_int16 *pus;
+
+ memset(&gstSpeedPulseFst_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER_FST));
+ gstSpeedPulseFst_l.ul_did = POSHAL_DID_SPEED_PULSE_FST;
+ gstSpeedPulseFst_l.us_size = 0;
+ gstSpeedPulseFst_l.partition_flg = 0;
+ pus = reinterpret_cast<u_int16 *>(gstSpeedPulseFst_l.uc_data);
+ memset(reinterpret_cast<void*>(pus), VEHICLE_DINIT_SPEED_PULSE, VEHICLE_DSIZE_SPEED_PULSE_FST);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulseFstl
+* ABSTRACT : Vehicle Sensor SPEED_PULSE SET Function
+* FUNCTION : Update the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulseFstl(const LSDRV_LSDATA_FST *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstSpeedPulseFst_l;
+
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulseFstG
+* ABSTRACT : Vehicle Sensor SPEED_PULSE SET Function
+* FUNCTION : Update the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulseFstG(const LSDRV_LSDATA_FST_SPEED *pst_data) {
+ static u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ u_int8 partition_max; /* Total number of partitions */
+ u_int8 partition_num; /* Data number */
+
+ pst_master = &gstSpeedPulseFst_l;
+
+ partition_max = pst_data->uc_partition_max;
+ partition_num = pst_data->uc_partition_num;
+
+ if (partition_max == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 0;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_max == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ if (partition_num == 1) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->partition_flg = 1;
+ memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else if (partition_num == 2) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ /* Compare data master and received data */
+ if (uc_ret == VEHICLESENS_EQ) {
+ uc_ret = VehicleSensmemcmp(&pst_master->uc_data[VEHICLE_DSIZE_SPEED_PULSE_FST],
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ }
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ pst_master->us_size = static_cast<u_int16>(pst_master->us_size + pst_data->uc_size);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->partition_flg = 1;
+ memcpy(&pst_master->uc_data[VEHICLE_DSIZE_SPEED_PULSE_FST],
+ pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+ } else {}
+ } else {}
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulseFstl
+* ABSTRACT : Vehicle Sensor SPEED_PULSE GET Function
+* FUNCTION : Provide the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulseFstl(VEHICLESENS_DATA_MASTER_FST *pst_data) {
+ const VEHICLESENS_DATA_MASTER_FST *pst_master;
+
+ pst_master = &gstSpeedPulseFst_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->partition_flg = pst_master->partition_flg;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
+}
+
+#endif
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse_l.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse_l.cpp
new file mode 100755
index 0000000..a3ebc01
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SpeedPulse_l.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SpeedPulse_l.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(POSHAL_DID_SPEED_PULSE)
+ * Module configuration :VehicleSensInitSpeedPulsel() Vehicle sensor SPEED_PULSE initialization function
+ * :VehicleSensSetSpeedPulsel() Vehicle Sensor SPEED_PULSE SET Function
+ * :VehicleSensGetSpeedPulsel() Vehicle Sensor SPEED_PULSE GET Function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER gstSpeedPulse_l; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSpeedPulsel
+* ABSTRACT : Vehicle sensor SPEED_PULSE initialization function
+* FUNCTION : SPEED_PULSE data master initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSpeedPulsel(void) {
+ (void)memset(reinterpret_cast<void *>(&gstSpeedPulse_l), 0, sizeof(VEHICLESENS_DATA_MASTER));
+ gstSpeedPulse_l.ul_did = POSHAL_DID_SPEED_PULSE;
+ gstSpeedPulse_l.us_size = VEHICLE_DSIZE_SPEED_PULSE;
+ gstSpeedPulse_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulsel
+* ABSTRACT : Vehicle Sensor SPEED_PULSE SET Function
+* FUNCTION : Update the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulsel(const LSDRV_LSDATA *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedPulse_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSpeedPulselG
+* ABSTRACT : Vehicle Sensor SPEED_PULSE SET Function
+* FUNCTION : Update the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the message data received by the direct line
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSpeedPulselG(const LSDRV_LSDATA_G *pst_data) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedPulse_l;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ pst_master->uc_snscnt = pst_data->uc_sns_cnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
+ (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSpeedPulsel
+* ABSTRACT : Vehicle Sensor SPEED_PULSE GET Function
+* FUNCTION : Provide the SPEED_PULSE data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetSpeedPulsel(VEHICLESENS_DATA_MASTER *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstSpeedPulse_l;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ pst_data->uc_snscnt = pst_master->uc_snscnt;
+ (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
+ (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SysGpsInterruptSignal.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SysGpsInterruptSignal.cpp
new file mode 100755
index 0000000..e1400f2
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_SysGpsInterruptSignal.cpp
@@ -0,0 +1,132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Did_SysGpsInterruptSignal.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor data master(VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL)
+ * Module configuration :VehicleSensInitSysGpsInterruptSignal() Vehicle sensor Sys_GPS_INTERRUPT_SIGNAL initialization function
+ * :VehicleSensSetSysGpsInterruptSignal() Vehicle Sensor Sys_GPS_INTERRUPT_SIGNAL SET Function
+ * :VehicleSensGetSysGpsInterruptSignal() Vehicle sensor Sys_GPS_INTERRUPT_SIGNAL GET function
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+#define VEHICLE_SENS_DID_SYS_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY 0
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL gstSysGpsInterruptSignal; // NOLINT(readability/nolint)
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSysGpsInterruptSignal
+* ABSTRACT : Vehicle sensor Sys_GPS_INTERRUPT_SIGNAL initialization function
+* FUNCTION : Sys_GPS_INTERRUPT_SIGNAL data master initialization processing
+* ARGUMENT : None
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensInitSysGpsInterruptSignal(void) {
+ (void)memset(reinterpret_cast<void *>(&(gstSysGpsInterruptSignal)), static_cast<int>(0x00),
+ sizeof(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL));
+ gstSysGpsInterruptSignal.ul_did = VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL;
+ gstSysGpsInterruptSignal.us_size = VEHICLE_DSIZE_SYS_GPS_INTERRUPT_SIGNAL;
+ gstSysGpsInterruptSignal.uc_data = VEHICLE_DINIT_SYS_GPS_INTERRUPT_SIGNAL;
+
+#if VEHICLE_SENS_DID_SYS_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstSysGpsInterruptSignal.uc_data == 0x%x\r\n", gstSysGpsInterruptSignal.uc_data);
+#endif
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSysGpsInterruptSignal
+* ABSTRACT : Vehicle sensor SYS_GPS_INTERRUPT_SIGNAL SET function
+* FUNCTION : Update the Sys_GPS_INTERRUPT_SIGNAL data master
+* ARGUMENT : *pst_data : Pointer to received message data
+* NOTE :
+* RETURN : VEHICLESENS_EQ : No data change
+* VEHICLESENS_NEQ : Data change
+******************************************************************************/
+u_int8 VehicleSensSetSysGpsInterruptSignal(const LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL *pst_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int8 uc_ret = VEHICLESENS_EQ;
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstSysGpsInterruptSignal;
+
+ /* Compare data master and received data */
+ uc_ret = VehicleSensmemcmp(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), (size_t)(pst_data->uc_size));
+
+ /* Received data is set in the data master. */
+ pst_master->ul_did = pst_data->ul_did;
+ pst_master->us_size = (u_int16)pst_data->uc_size;
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
+ (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
+
+#if VEHICLE_SENS_DID_SYS_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] pst_data->ul_did == 0x%x", pst_data->ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstSysGpsInterruptSignal.ul_did == 0x%x\r\n", gstSysGpsInterruptSignal.ul_did);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] (u_int8)pst_data->ucSize == 0x%x", (u_int8)pst_data->uc_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstSysGpsInterruptSignal.us_size == 0x%x\r\n", gstSysGpsInterruptSignal.us_size);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] pst_data->uc_data == 0x%x", pst_data->uc_data);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "#[FACTORY] gstSysGpsInterruptSignal.uc_data == 0x%x\r\n", gstSysGpsInterruptSignal.uc_data);
+#endif
+ }
+
+ return(uc_ret);
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSysGpsInterruptSignal
+* ABSTRACT : Vehicle sensor SYS_GPS_INTERRUPT_SIGNAL GET function
+* FUNCTION : Provide the SYS_GPS_INTERRUPT_SIGNAL data master
+* ARGUMENT : *pst_data : Pointer to the data master acquisition destination
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensGetSysGpsInterruptSignal(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ const VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_master;
+
+ if (pst_data == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
+ } else {
+ pst_master = &gstSysGpsInterruptSignal;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcvflag = pst_master->uc_rcvflag;
+ (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
+ (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover.cpp
new file mode 100755
index 0000000..e98d364
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover.cpp
@@ -0,0 +1,51 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_WknRollover.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS Rollover Standard Week Number Data Master GET Processing
+ *
+ * @param[out] VEHICLESENS_DATA_MASTER*
+ * @param[in] u_int8
+ */
+void VehicleSensGetWknRollover(SENSOR_MSG_GPSDATA_DAT *pst_data, u_int8 uc_get_method) {
+ switch (uc_get_method) {
+ case VEHICLESENS_GETMETHOD_GPS:
+ {
+ /** To acquire from GPS */
+ VehicleSensGetWknRolloverG(pst_data);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover_g.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover_g.cpp
new file mode 100755
index 0000000..4a5defe
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Did_WknRollover_g.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehicleSens_Did_WknRollover_g.cpp
+ * @brief
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_DataMaster.h"
+
+/*---------------------------------------------------------------------------------*
+ * Global Value *
+ *---------------------------------------------------------------------------------*/
+static VEHICLESENS_DATA_MASTER gstWknRollover_g; // NOLINT(readability/nolint)
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * GPS rollover standard week number data master initialization processing
+ */
+void VehicleSensInitWknRolloverG(void) {
+ SENSOR_WKNROLLOVER st_wkn_rollover;
+
+ memset(&gstWknRollover_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
+
+ /** Data ID setting */
+ gstWknRollover_g.ul_did = POSHAL_DID_GPS_WKNROLLOVER;
+ /** Data size setting */
+ gstWknRollover_g.us_size = sizeof(SENSOR_WKNROLLOVER);
+ /** Data content setting */
+ memset(&st_wkn_rollover, 0x00, sizeof(st_wkn_rollover));
+ memcpy(&gstWknRollover_g.uc_data[0], &st_wkn_rollover, sizeof(st_wkn_rollover));
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS Rollover Standard Week Number Data Master SET Process
+ *
+ * @param[in] SENSOR_WKNROLLOVER*
+ *
+ * @return u_int8
+ */
+u_int8 VehicleSensSetWknRolloverG(const SENSOR_WKNROLLOVER *pst_wkn_rollover) {
+ u_int8 uc_ret;
+ VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstWknRollover_g;
+
+ /** With the contents of the current data master,Compare received data */
+ uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_wkn_rollover, sizeof(SENSOR_WKNROLLOVER));
+
+ /** Received data is set in the data master. */
+ pst_master->ul_did = POSHAL_DID_GPS_WKNROLLOVER;
+ pst_master->us_size = sizeof(SENSOR_WKNROLLOVER);
+ pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
+ memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
+ memcpy(pst_master->uc_data, pst_wkn_rollover, sizeof(SENSOR_WKNROLLOVER));
+
+ return(uc_ret);
+}
+
+/**
+ * @brief
+ * GPS Rollover Standard Week Number Data Master GET Processing
+ *
+ * @param[out] SENSOR_MSG_GPSDATA_DAT*
+ */
+void VehicleSensGetWknRolloverG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
+ const VEHICLESENS_DATA_MASTER *pst_master;
+
+ pst_master = &gstWknRollover_g;
+
+ /* Store the data master in the specified destination. */
+ pst_data->ul_did = pst_master->ul_did;
+ pst_data->us_size = pst_master->us_size;
+ pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
+ memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_FromAccess.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_FromAccess.cpp
new file mode 100755
index 0000000..99f2dc3
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_FromAccess.cpp
@@ -0,0 +1,319 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_FromAccess.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Functions for accessing vehicle sensor FROM
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_FromAccess.h"
+#include "ClockDataMng.h"
+
+/********************************************************************************
+ * Global variable *
+ ********************************************************************************/
+
+/********************************************************************************
+ * prototype declalation *
+ ********************************************************************************/
+static RET_API VehicleSensReadNV(NV_DATA_VEHICLESENS *p_nv_data);
+
+/********************************************************************************
+ * Definition *
+ ********************************************************************************/
+#define VEHICLESENS_FROM_ACCESS_DEBUG 0
+
+/*******************************************************************************
+* MODULE : VehicleSensFromAccessInitialize
+* ABSTRACT : Initializing process
+* FUNCTION :
+* ARGUMENT : None
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensFromAccessInitialize(void) {
+ /* The result of tag registration for non-volatile memory access is stored in g_nv_access_available, so no confirmation is required. */
+ (void)VehicleSensRegistNvTag();
+
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensRegistNvTag
+* ABSTRACT : Tag registration process
+* FUNCTION : Registering Tag Name to Identify Data Storage Destination
+* ARGUMENT : None
+* NOTE :
+* RETURN : RET_NORMAL :Successful registration
+* : RET_ERROR :Registration failure
+******************************************************************************/
+RET_API VehicleSensRegistNvTag(void) {
+ RET_API lret = RET_NORMAL;
+ return lret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensReadNV
+* ABSTRACT : Get local time Lonlat
+* FUNCTION : Reading local time Lonlat from non-volatile memory
+* ARGUMENT : NV_DATA_VEHICLESENS * p_nv_data : Pointer to data acquired from non-volatile memory
+* NOTE : None
+* RETURN : RET_NORMAL :Read success
+* : RET_ERROR :Failed to read
+******************************************************************************/
+static RET_API VehicleSensReadNV(NV_DATA_VEHICLESENS * p_nv_data) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API lret = RET_NORMAL;
+ FILE *fp;
+ NV_DATA_VEHICLESENS nv_data_tmp;
+ BOOL ret_read = FALSE;
+ BOOL ret_read2 = FALSE;
+
+ u_int32 loop;
+ u_int8 CK_A = 0;
+ u_int8 CK_B = 0;
+ u_int8 *ptr;
+
+ fp = fopen(NV_FILE_VEHICLESENS_TEMP, "rb");
+
+ /* Read File1 */
+ if (fp != NULL) {
+ if ((fread(reinterpret_cast<void *>(p_nv_data), sizeof(u_int8), sizeof(NV_DATA_VEHICLESENS), fp)) == \
+ sizeof(NV_DATA_VEHICLESENS)) {
+ /* Checksum processing */
+ ptr = reinterpret_cast<u_int8 *>(p_nv_data); /* #QAC confirmation Rule11.4 1Byte accesses for checksums */
+ CK_A = 0;
+ CK_B = 0;
+
+ /* The 2Byte portion from the end of the checksum data is excluded because the checksum storage area. */
+ for (loop = 0; loop < (sizeof(NV_DATA_VEHICLESENS) - 2); loop++) {
+ CK_A = static_cast<u_int8>(CK_A + ptr[loop]);
+ CK_B = static_cast<u_int8>(CK_B + CK_A);
+ }
+
+
+ if ((p_nv_data->cka == CK_A) && (p_nv_data->ckb == CK_B)) {
+ ret_read = TRUE;
+
+#if VEHICLESENS_FROM_ACCESS_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NV read, status, year, month, day, hour, min, sec, lat, lon, "\
+ "timediff, update_counter, cka, ckb ");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NV read, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d ",
+ p_nv_data->localtime.status,
+ p_nv_data->localtime.year,
+ p_nv_data->localtime.month,
+ p_nv_data->localtime.day,
+ p_nv_data->localtime.hour,
+ p_nv_data->localtime.min,
+ p_nv_data->localtime.sec,
+ p_nv_data->lonlat.latitude,
+ p_nv_data->lonlat.longitude,
+ p_nv_data->timediff,
+ p_nv_data->update_counter,
+ p_nv_data->cka,
+ p_nv_data->ckb);
+#endif /* VEHICLESENS_FROM_ACCESS_DEBUG */
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Checksum1 failed.");
+ ret_read = FALSE;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fread1 failed.");
+ }
+ fclose(fp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fopen1 failed.");
+ }
+
+ /* Read File2 */
+ fp = fopen(NV_FILE_VEHICLESENS2_TEMP, "rb");
+
+ if (fp != NULL) {
+ if ((fread(reinterpret_cast<void *>(&nv_data_tmp), sizeof(u_int8), sizeof(NV_DATA_VEHICLESENS), fp)) == \
+ sizeof(NV_DATA_VEHICLESENS)) {
+ /* Checksum processing */
+ ptr = reinterpret_cast<u_int8 *>(&nv_data_tmp); /* #QAC confirmation Rule11.4 1Byte accesses for checksums */
+ CK_A = 0;
+ CK_B = 0;
+
+ /* The 2Byte portion from the end of the checksum data is excluded because the checksum storage area. */
+ for (loop = 0; loop < (sizeof(NV_DATA_VEHICLESENS) - 2); loop++) {
+ CK_A = static_cast<u_int8>(CK_A + ptr[loop]);
+ CK_B = static_cast<u_int8>(CK_B + CK_A);
+ }
+
+
+ if ((nv_data_tmp.cka == CK_A) && (nv_data_tmp.ckb == CK_B)) {
+ ret_read2 = TRUE;
+
+#if VEHICLESENS_FROM_ACCESS_DEBUG
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NV read2, status, year, month, day, hour, min, sec, lat, lon, "\
+ "timediff, update_counter, cka, ckb ");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NV read2, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d ",
+ nv_data_tmp.localtime.status,
+ nv_data_tmp.localtime.year,
+ nv_data_tmp.localtime.month,
+ nv_data_tmp.localtime.day,
+ nv_data_tmp.localtime.hour,
+ nv_data_tmp.localtime.min,
+ nv_data_tmp.localtime.sec,
+ nv_data_tmp.lonlat.latitude,
+ nv_data_tmp.lonlat.longitude,
+ nv_data_tmp.timediff,
+ nv_data_tmp.update_counter,
+ nv_data_tmp.cka,
+ nv_data_tmp.ckb);
+#endif /* VEHICLESENS_FROM_ACCESS_DEBUG */
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Checksum2 failed.");
+ ret_read2 = FALSE;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fread2 failed.");
+ }
+ fclose(fp);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fopen2 failed.");
+ }
+
+
+ /* Check the read results of File 1 and File 2. */
+ if ((ret_read == TRUE) && (ret_read2 == TRUE)) {
+ /* Whether File 1 or File 2 is the most recent file,Check with the update count counter */
+ if (p_nv_data->update_counter < nv_data_tmp.update_counter) {
+ (void)memcpy(reinterpret_cast<void *>(p_nv_data), reinterpret_cast<void *>(&nv_data_tmp), \
+ sizeof(NV_DATA_VEHICLESENS));
+ }
+ lret = RET_NORMAL;
+ } else if (ret_read == TRUE) {
+ /* Use file 1 */
+ lret = RET_NORMAL;
+ } else if (ret_read2 == TRUE) {
+ /* Use file 2 */
+ (void)memcpy(reinterpret_cast<void *>(p_nv_data), reinterpret_cast<void *>(&nv_data_tmp), \
+ sizeof(NV_DATA_VEHICLESENS));
+ lret = RET_NORMAL;
+ } else {
+ /* Read failed for both file 1 and file 2 */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fread failed.");
+ lret = RET_ERROR;
+ }
+
+ return lret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensReadNVLocalTime
+* ABSTRACT : Local time acquisition at shutdown
+* FUNCTION : Read local time at shutdown from non-volatile memory
+* ARGUMENT : LOCALTIME * local_time : Local time at shutdown
+* NOTE : None
+* RETURN : RET_NORMAL :Successful acquisition
+* : RET_ERROR :Failed to acquire
+******************************************************************************/
+RET_API VehicleSensReadNVLocalTime(LOCALTIME * local_time) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API lret;
+ NV_DATA_VEHICLESENS nv_data;
+
+ lret = VehicleSensReadNV(&nv_data);
+
+ if (lret == RET_NORMAL) {
+ (void)memcpy(reinterpret_cast<void *>(local_time), (const void *)(&nv_data.localtime), sizeof(LOCALTIME));
+ }
+
+ return lret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensReadNVLonLat
+* ABSTRACT : Obtain position at shutdown
+* FUNCTION : Read the shutdown position from the non-volatile memory
+* ARGUMENT : LONLAT * lonlat : Shutdown position
+* NOTE : None
+* RETURN : RET_NORMAL :Successful acquisition
+* : RET_ERROR :Failed to acquire
+******************************************************************************/
+RET_API VehicleSensReadNVLonLat(LONLAT * lonlat) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API lret;
+ NV_DATA_VEHICLESENS nv_data;
+
+ lret = VehicleSensReadNV(&nv_data);
+
+ if (lret == RET_NORMAL) {
+ (void)memcpy(reinterpret_cast<void *>(lonlat), (const void *)(&nv_data.lonlat), sizeof(LONLAT));
+ }
+
+ return lret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensReadNVTimeDiff
+* ABSTRACT : Shutdown time difference acquisition
+* FUNCTION : Reading the shutdown time difference from the non-volatile memory
+* ARGUMENT : int32 * time_diff : Shutdown position
+* NOTE : None
+* RETURN : RET_NORMAL :Successful acquisition
+* : RET_ERROR :Failed to acquire
+******************************************************************************/
+RET_API VehicleSensReadNVTimeDiff(int32 * time_diff) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API lret;
+ NV_DATA_VEHICLESENS nv_data;
+
+ lret = VehicleSensReadNV(&nv_data);
+
+ if (lret == RET_NORMAL) {
+ *time_diff = nv_data.timediff;
+ }
+
+ return lret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensStoreLonlat
+* ABSTRACT : Store location data in non-volatile memory
+* FUNCTION :
+* ARGUMENT : LONLAT * plonlat : Position data
+* NOTE :
+* RETURN : None
+******************************************************************************/
+void VehicleSensStoreLonlat(LONLAT * plonlat) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ return;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteNVLocaltime
+* ABSTRACT : Local Time Write
+* FUNCTION : Write local time
+* ARGUMENT : LOCALTIME * local_time : Local time
+* NOTE :
+* RETURN : RET_NORMAL :Successful write
+* : RET_ERROR :Writing failure
+******************************************************************************/
+RET_API VehicleSensWriteNVLocaltime(LOCALTIME * local_time, int32 * time_diff) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API lret = RET_NORMAL;
+
+ return lret;
+}
+
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_SelectionItemList.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_SelectionItemList.cpp
new file mode 100755
index 0000000..4172b1e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_SelectionItemList.cpp
@@ -0,0 +1,466 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_SelectionItemList.cpp
+ * System name :_CWORD107_
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle Sensor Selection Item List
+ * Module configuration :VehicleSensInitSelectionItemList() Vehicle sensor selection item list initialization function
+ * :VehicleSensGetSelectionItemList() Vehicle sensor selection item list acquisition method GET function
+ * :VehicleSensGetSelectionItemListCanId() Vehicle Sensor Selection Items List CANID GET Functions
+ * :VehicleSensSetSelectionItemListCanId() Vehicle Sensor Selection Items List CANID SET Functions
+ * :VehicleSensCommWatchTblInit() Disruption monitoring data management table initialization function
+ * :VehicleSensCommWatchTblSave() Disruption monitoring data management table storage function
+ * :VehicleSensCommWatchTblRun() Disruption monitoring data management table execution function
+ ******************************************************************************/
+
+#include <positioning_hal.h>
+#include <vehicle_service/positioning_base_library.h>
+
+#include "VehicleSens_SelectionItemList.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLESENS_SELECTION_ITEM_LIST g_st_selection_itemlist[VEHICLESENS_SELECTION_ITEM_LIST_LEN];
+static VEHICLE_COMM_WATCH_TBL g_st_comm_watchtbl[VEHICLE_COMM_WATCHTBL_DID_NUM];
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSelectionItemList
+* ABSTRACT : Vehicle sensor selection item list initialization function
+* FUNCTION : Vehicle Sensor Selection Item List Initialization Process
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensInitSelectionItemList(void) {
+ u_int8 uc_get_method;
+
+ VehicleSensCommWatchTblInit();
+
+ /* Setting Acquisition Method (CAN/ Direct Line) for DataID in Vehicle Sensor Selection Item List.
+ BackDoor, Adim, Rev sets the CAN/ direct line obtained from the FROM
+ */
+ memset(&g_st_selection_itemlist, 0x00, sizeof(g_st_selection_itemlist));
+
+ g_st_selection_itemlist[0].ul_did = VEHICLE_DID_HV;
+ g_st_selection_itemlist[0].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[0].uc_get_method = VEHICLESENS_GETMETHOD_CAN;
+ g_st_selection_itemlist[1].ul_did = VEHICLE_DID_VB;
+ g_st_selection_itemlist[1].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[2].ul_did = VEHICLE_DID_IG;
+ g_st_selection_itemlist[2].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[3].ul_did = VEHICLE_DID_MIC;
+ g_st_selection_itemlist[3].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[4].ul_did = VEHICLE_DID_ILL;
+ g_st_selection_itemlist[4].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[5].ul_did = VEHICLE_DID_RHEOSTAT;
+ g_st_selection_itemlist[5].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[6].ul_did = VEHICLE_DID_SYSTEMP;
+ g_st_selection_itemlist[6].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[7].ul_did = POSHAL_DID_SPEED_PULSE;
+ g_st_selection_itemlist[7].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[8].ul_did = POSHAL_DID_SPEED_KMPH;
+ g_st_selection_itemlist[8].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[9].ul_did = POSHAL_DID_GYRO_X;
+ g_st_selection_itemlist[9].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[10].ul_did = POSHAL_DID_GYRO_Y;
+ g_st_selection_itemlist[10].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[11].ul_did = POSHAL_DID_GYRO_Z;
+ g_st_selection_itemlist[11].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[12].ul_did = POSHAL_DID_GSNS_X;
+ g_st_selection_itemlist[12].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[13].ul_did = POSHAL_DID_GSNS_Y;
+ g_st_selection_itemlist[13].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[14].ul_did = POSHAL_DID_GSNS_Z;
+ g_st_selection_itemlist[14].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[15].ul_did = VEHICLE_DID_REV;
+ g_st_selection_itemlist[15].ul_canid = VEHICLESENS_INVALID;
+ uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[15].uc_get_method = uc_get_method;
+ g_st_selection_itemlist[16].ul_did = POSHAL_DID_GPS_ANTENNA;
+ g_st_selection_itemlist[16].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[17].ul_did = POSHAL_DID_SNS_COUNTER;
+ g_st_selection_itemlist[17].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[18].ul_did = VEHICLE_DID_GPS_COUNTER;
+ g_st_selection_itemlist[18].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[19].ul_did = POSHAL_DID_GPS_VERSION;
+ g_st_selection_itemlist[19].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[20].ul_did = VEHICLE_DID_LOCATION;
+ g_st_selection_itemlist[20].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[21].ul_did = VEHICLE_DID_REV_LINE;
+ g_st_selection_itemlist[21].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[22].ul_did = VEHICLE_DID_REV_CAN;
+ g_st_selection_itemlist[22].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[22].uc_get_method = VEHICLESENS_GETMETHOD_CAN;
+ /* ++ GPS _CWORD82_ support */
+ g_st_selection_itemlist[23].ul_did = POSHAL_DID_GPS__CWORD82___CWORD44_GP4;
+ g_st_selection_itemlist[23].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[24].ul_did = VEHICLE_DID_GPS__CWORD82__NMEA;
+ g_st_selection_itemlist[24].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[25].ul_did = POSHAL_DID_GPS__CWORD82__FULLBINARY;
+ g_st_selection_itemlist[25].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ /* -- GPS _CWORD82_ support */
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Response */
+ g_st_selection_itemlist[26].ul_did = POSHAL_DID_GYRO_EXT;
+ g_st_selection_itemlist[26].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[27].ul_did = POSHAL_DID_SPEED_PULSE_FST;
+ g_st_selection_itemlist[27].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[28].ul_did = POSHAL_DID_GYRO_X_FST;
+ g_st_selection_itemlist[28].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[29].ul_did = POSHAL_DID_GYRO_Y_FST;
+ g_st_selection_itemlist[29].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[30].ul_did = POSHAL_DID_GYRO_Z_FST;
+ g_st_selection_itemlist[30].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[31].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_POSLLH;
+ g_st_selection_itemlist[31].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[32].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_STATUS;
+ g_st_selection_itemlist[32].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[33].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC;
+ g_st_selection_itemlist[33].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[34].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_VELNED;
+ g_st_selection_itemlist[34].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[35].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_DOP;
+ g_st_selection_itemlist[35].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[36].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS;
+ g_st_selection_itemlist[36].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[37].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_SVINFO;
+ g_st_selection_itemlist[37].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[38].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_CLOCK;
+ g_st_selection_itemlist[38].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[39].ul_did = VEHICLE_DID_GPS_UBLOX_MON_HW;
+ g_st_selection_itemlist[39].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[40].ul_did = POSHAL_DID_SPEED_PULSE_FLAG;
+ g_st_selection_itemlist[40].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[41].ul_did = VEHICLE_DID_GYRO_TROUBLE;
+ g_st_selection_itemlist[41].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[41].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[42].ul_did = VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL;
+ g_st_selection_itemlist[42].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[42].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[43].ul_did = VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL;
+ g_st_selection_itemlist[43].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[43].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[44].ul_did = VEHICLE_DID_GYRO_CONNECT_STATUS;
+ g_st_selection_itemlist[44].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[44].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[45].ul_did = POSHAL_DID_SPEED_PULSE_FLAG_FST;
+ g_st_selection_itemlist[45].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[46].ul_did = POSHAL_DID_REV_FST;
+ g_st_selection_itemlist[46].ul_canid = VEHICLESENS_INVALID;
+ uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[46].uc_get_method = uc_get_method;
+ g_st_selection_itemlist[47].ul_did = POSHAL_DID_GPS_NMEA;
+ g_st_selection_itemlist[47].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[48].ul_did = POSHAL_DID_GPS_TIME;
+ g_st_selection_itemlist[48].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[48].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[49].ul_did = VEHICLE_DID_NAVIINFO_DIAG_GPS;
+ g_st_selection_itemlist[49].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[49].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[50].ul_did = POSHAL_DID_GYRO_TEMP;
+ g_st_selection_itemlist[50].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[50].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[51].ul_did = POSHAL_DID_GYRO_TEMP_FST;
+ g_st_selection_itemlist[51].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[51].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[52].ul_did = POSHAL_DID_GSNS_X_FST;
+ g_st_selection_itemlist[52].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[52].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[53].ul_did = POSHAL_DID_GSNS_Y_FST;
+ g_st_selection_itemlist[53].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[53].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[54].ul_did = POSHAL_DID_GSNS_Z_FST;
+ g_st_selection_itemlist[54].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[54].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[55].ul_did = VEHICLE_DID_LOCATION_LONLAT;
+ g_st_selection_itemlist[55].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[55].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[56].ul_did = VEHICLE_DID_LOCATION_ALTITUDE;
+ g_st_selection_itemlist[56].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[56].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[57].ul_did = VEHICLE_DID_MOTION_HEADING;
+ g_st_selection_itemlist[57].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[57].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[58].ul_did = VEHICLE_DID_LOCATION_LONLAT_NAVI;
+ g_st_selection_itemlist[58].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[58].uc_get_method = VEHICLESENS_GETMETHOD_NAVI;
+ g_st_selection_itemlist[59].ul_did = VEHICLE_DID_LOCATION_ALTITUDE_NAVI;
+ g_st_selection_itemlist[59].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[59].uc_get_method = VEHICLESENS_GETMETHOD_NAVI;
+ g_st_selection_itemlist[60].ul_did = VEHICLE_DID_MOTION_HEADING_NAVI;
+ g_st_selection_itemlist[60].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[60].uc_get_method = VEHICLESENS_GETMETHOD_NAVI;
+ g_st_selection_itemlist[61].ul_did = VEHICLE_DID_SETTINGTIME;
+ g_st_selection_itemlist[61].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[61].uc_get_method = VEHICLESENS_GETMETHOD_OTHER;
+ g_st_selection_itemlist[62].ul_did = VEHICLE_DID_MOTION_SPEED;
+ g_st_selection_itemlist[62].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[62].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[63].ul_did = VEHICLE_DID_MOTION_SPEED_NAVI;
+ g_st_selection_itemlist[63].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[63].uc_get_method = VEHICLESENS_GETMETHOD_NAVI;
+ g_st_selection_itemlist[64].ul_did = VEHICLE_DID_MOTION_SPEED_INTERNAL;
+ g_st_selection_itemlist[64].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[64].uc_get_method = VEHICLESENS_GETMETHOD_INTERNAL;
+ g_st_selection_itemlist[65].ul_did = POSHAL_DID_PULSE_TIME;
+ g_st_selection_itemlist[65].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[65].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[66].ul_did = POSHAL_DID_GPS_TIME_RAW;
+ g_st_selection_itemlist[66].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[66].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[67].ul_did = POSHAL_DID_GPS_WKNROLLOVER;
+ g_st_selection_itemlist[67].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[67].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[68].ul_did = POSHAL_DID_GPS_CLOCK_DRIFT;
+ g_st_selection_itemlist[68].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[68].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[69].ul_did = POSHAL_DID_GPS_CLOCK_FREQ;
+ g_st_selection_itemlist[69].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[69].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+#else
+ g_st_selection_itemlist[26].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_POSLLH;
+ g_st_selection_itemlist[26].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[27].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_STATUS;
+ g_st_selection_itemlist[27].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[28].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC;
+ g_st_selection_itemlist[28].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[29].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_VELNED;
+ g_st_selection_itemlist[29].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[30].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_DOP;
+ g_st_selection_itemlist[30].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[31].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS;
+ g_st_selection_itemlist[31].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[32].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_SVINFO;
+ g_st_selection_itemlist[32].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[33].ul_did = VEHICLE_DID_GPS_UBLOX_NAV_CLOCK;
+ g_st_selection_itemlist[33].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[34].ul_did = VEHICLE_DID_GPS_UBLOX_MON_HW;
+ g_st_selection_itemlist[34].uc_get_method = VEHICLESENS_GETMETHOD_GPS;
+ g_st_selection_itemlist[35].ul_did = POSHAL_DID_SPEED_PULSE_FLAG;
+ g_st_selection_itemlist[35].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[36].ul_did = VEHICLE_DID_GYRO_TROUBLE;
+ g_st_selection_itemlist[36].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[36].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[37].ul_did = VEHICLE_DID__CWORD56__GPS_INTERRUPT_SIGNAL;
+ g_st_selection_itemlist[37].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[37].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[38].ul_did = VEHICLE_DID__CWORD102__GPS_INTERRUPT_SIGNAL;
+ g_st_selection_itemlist[38].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[38].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+ g_st_selection_itemlist[39].ul_did = VEHICLE_DID_GYRO_CONNECT_STATUS;
+ g_st_selection_itemlist[39].ul_canid = VEHICLESENS_INVALID;
+ g_st_selection_itemlist[39].uc_get_method = VEHICLESENS_GETMETHOD_LINE;
+#endif
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSelectionItemList
+* ABSTRACT : Vehicle sensor_data acquisition method GET function
+* FUNCTION : Provide data acquisition methods
+* ARGUMENT : ul_did Data ID
+* NOTE :
+* RETURN : VEHICLESENS_GETMETHOD_CAN :CAN line
+* VEHICLESENS_GETMETHOD_LINE :Direct Line
+* VEHICLESENS_GETMETHOD_NO_DETECTION :Not downloaded
+* VEHICLESENS_GETMETHOD_GPS :GPS
+* VEHICLESENS_GETMETHOD_NAVI :Navi
+* VEHICLESENS_GETMETHOD_CLOCK :Clock
+* VEHICLESENS_GETMETHOD_OTHER :Others
+******************************************************************************/
+u_int8 VehicleSensGetSelectionItemList(DID ul_did) {
+ int32 i;
+ u_int8 uc_get_method = VEHICLESENS_GETMETHOD_NO_DETECTION;
+ /* Ignore->MISRA-C++:2008 Rule 2-13-3 */ /* Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
+ if ( (ul_did & VEHICLESENS_BIT31_29) != 0 ) {
+ /* For other than CAN frame data */
+ for (i = 0; i < VEHICLESENS_SELECTION_ITEM_LIST_LEN; i++) {
+ if (g_st_selection_itemlist[i].ul_did == ul_did) {
+ uc_get_method = g_st_selection_itemlist[i].uc_get_method;
+ break;
+ }
+ }
+ } else {
+ /* CAN frame data */
+ uc_get_method = VEHICLESENS_GETMETHOD_CAN;
+ }
+ return uc_get_method;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetSelectionItemListCanId
+* ABSTRACT : Vehicle Sensor Selection Item List_CANID GET Function
+* FUNCTION : Provide CANID
+* ARGUMENT :
+* NOTE :
+* RETURN : ul_canid CANID
+******************************************************************************/
+u_int32 VehicleSensGetSelectionItemListCanId(DID ul_did) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 i;
+ u_int32 ul_canid = VEHICLESENS_INVALID;
+
+ for (i = 0; i < VEHICLESENS_SELECTION_ITEM_LIST_LEN; i++) {
+ if (g_st_selection_itemlist[i].ul_did == ul_did) {
+ if (VEHICLESENS_GETMETHOD_CAN == g_st_selection_itemlist[i].uc_get_method) {
+ /* When the data source type is CAN communication */
+ ul_canid = g_st_selection_itemlist[i].ul_canid;
+ }
+ break;
+ }
+ }
+ return ul_canid;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetSelectionItemListCanId
+* ABSTRACT : Vehicle Sensor Selection Item List_CANID SET Function
+* FUNCTION : Sets when the CANID associated with the specified DID is unconfirmed.
+* ARGUMENT : ul_canid u-int32(CANID)
+* NOTE :
+* RETURN : TRUE :Successful registration(Including when the CANID is fixed)
+* : FALSE :Registration failure
+******************************************************************************/
+BOOL VehicleSensSetSelectionItemListCanId(DID ul_did, u_int32 ul_canid) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL b_ret = TRUE;
+ u_int8 uc_cnt = 0;
+ int32 uc_last_cnt = 0;
+
+ u_int8 uc_effective_flg = VEHICLESENS_EFFECTIVE;
+
+ for (uc_cnt = 0; uc_cnt < VEHICLE_COMM_WATCHTBL_DID_NUM; uc_cnt++) {
+ if (g_st_comm_watchtbl[uc_cnt].ul_did == ul_did) {
+ /* Obtain CANID determination flg */
+ uc_effective_flg = g_st_comm_watchtbl[uc_cnt].uc_effective_flg;
+ break;
+ }
+ }
+
+ if (uc_cnt >= VEHICLE_COMM_WATCHTBL_DID_NUM) {
+ return FALSE;
+ }
+
+ if (VEHICLESENS_EFFECTIVE != uc_effective_flg) {
+ /* When the CANID is undetermined */
+ b_ret = FALSE;
+ for (uc_last_cnt = 0; uc_last_cnt < VEHICLESENS_SELECTION_ITEM_LIST_LEN; uc_last_cnt++) {
+ if (g_st_selection_itemlist[uc_last_cnt].ul_did == ul_did) {
+ /* Updating the CANID of the Vehicle Sensor Selection Items List */
+ g_st_selection_itemlist[uc_last_cnt].ul_canid = ul_canid;
+ /* To fix the CANID */
+ g_st_comm_watchtbl[uc_cnt].uc_effective_flg = VEHICLESENS_EFFECTIVE;
+
+ /* During CANID indoubt,When Vehicle API ""Vehicle Sensor Information Disruption Monitoring"" is called */
+ /* Register for disruption monitoring of pending CAN threads */
+ if (0x00 < g_st_comm_watchtbl[uc_cnt].uc_vehicle_comm_watch_cnt) {
+ VehicleSensCommWatchTblRun(ul_did);
+ }
+ b_ret = TRUE;
+ break;
+ }
+ }
+ }
+ return b_ret;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensCommWatchTblInit
+* ABSTRACT : Disruption monitoring data management table initialization function
+* FUNCTION : Disruption monitoring data management table initialization processing
+* ARGUMENT : void
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensCommWatchTblInit(void) {
+ memset(&g_st_comm_watchtbl, 0x00, sizeof(g_st_comm_watchtbl));
+
+ /* DID initialization */
+ g_st_comm_watchtbl[0].ul_did = VEHICLE_DID_REV;
+ g_st_comm_watchtbl[1].ul_did = VEHICLE_DID_REV_CAN;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensCommWatchTblSave
+* ABSTRACT : Disruption monitoring data management table storage function
+* FUNCTION : When the target CANID is undetermined, save the discontinuation monitoring data...
+* ARGUMENT :
+* NOTE :
+* RETURN : TRUE : To fix the CANID
+* : FALSE : CANID undetermined
+******************************************************************************/
+BOOL VehicleSensCommWatchTblSave(const VEHICLE_MSG_WATCH_STOPPAGE *pst_msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL b_ret = TRUE; /* Function return value */
+ u_int8 uc_cnt = 0; /* Generic counters */
+ u_int8 uc_last_cnt = 0; /* Vehicle Sensor Information Disruption Monitoring Request Count */
+ u_int8 uc_get_method = VEHICLESENS_GETMETHOD_CAN; /* Acquisition method */
+ u_int8 uc_effective_flg = VEHICLESENS_EFFECTIVE; /* CANID determination flg */
+
+
+ uc_get_method = VehicleSensGetSelectionItemList(pst_msg->st_data.ul_did);
+
+ /* If the retrieval method is CAN: Check if the CANID is fixed */
+ if (VEHICLESENS_GETMETHOD_CAN == uc_get_method) {
+ for ( uc_cnt = 0; uc_cnt < VEHICLE_COMM_WATCHTBL_DID_NUM; uc_cnt++ ) {
+ if ( g_st_comm_watchtbl[uc_cnt].ul_did == pst_msg->st_data.ul_did ) {
+ /* Obtain CANID determination flg */
+ uc_effective_flg = g_st_comm_watchtbl[uc_cnt].uc_effective_flg;
+ break;
+ }
+ }
+ }
+
+ if ( VEHICLESENS_EFFECTIVE != uc_effective_flg ) {
+ /* Due to being asked for disruption monitoring of CANID indoubt data,Keep parameters required for disruption monitoring */
+ /* Returns success to the API user,No Disruption Monitoring Registration at this time */
+ /* Ask the CAN thread to monitor for disruption when the CANID is fixed. */
+
+ uc_last_cnt = g_st_comm_watchtbl[uc_cnt].uc_vehicle_comm_watch_cnt;
+ if ( VEHICLE_COMM_WATCHTBL_DAT_NUM > uc_last_cnt ) {
+ /* Destination PNO,Keep Disrupted Monitoring Time */
+ g_st_comm_watchtbl[uc_cnt].st_comm_watch_dat[uc_last_cnt].us_pno = pst_msg->st_data.us_pno;
+ g_st_comm_watchtbl[uc_cnt].st_comm_watch_dat[uc_last_cnt].us_watch_time = pst_msg->st_data.us_watch_time;
+
+ /* Vehicle sensor information disruption monitoring request count is incremented. */
+ uc_last_cnt++;
+ g_st_comm_watchtbl[uc_cnt].uc_vehicle_comm_watch_cnt = uc_last_cnt;
+ }
+ b_ret = FALSE;
+ }
+ return b_ret;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensCommWatchTblRun
+* ABSTRACT : Disruption monitoring data management table execution function
+* FUNCTION : Execute requested disruption monitoring when CANID is unconfirmed
+* ARGUMENT : ul_did DID
+* NOTE :
+* RETURN : TRUE : Normal completion
+* : FALSE : ABENDs
+******************************************************************************/
+BOOL VehicleSensCommWatchTblRun(DID ul_did) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL b_ret = TRUE;
+
+ return b_ret;
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_SharedMemory.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_SharedMemory.cpp
new file mode 100755
index 0000000..1fc9954
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_SharedMemory.cpp
@@ -0,0 +1,521 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_SharedMemory.cpp
+ * System name :PastModel002
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor shared memory management
+ ******************************************************************************/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "VehicleSens_SharedMemory.h"
+#include "Sensor_API.h"
+#include "VehicleSens_DataMaster.h"
+#include "Sensor_API_private.h"
+#include "SensorLocation_API.h"
+#include "SensorLocation_API_private.h"
+
+/********************************************************************************
+ * prototype declalation *
+ ********************************************************************************/
+static void VehicleSensLinkSharedMemory(char *shared_memory_name, void **p_share_addr);
+static RET_API VehicleSensWriteDataGpsInterruptSignal(DID ul_did);
+static RET_API VehicleSensWriteDataGyroConnectStatus(DID ul_did);
+static RET_API VehicleSensWriteDataLocalTime(void);
+static RET_API VehicleSensWriteDataLonLat(void);
+
+/********************************************************************************
+ * Definition *
+ ********************************************************************************/
+
+/*******************************************************************************
+* MODULE : VehicleSensInitSharedMemory
+* ABSTRACT : Shared Memory Initialization
+* FUNCTION : Initialize shared memory
+* ARGUMENT : None
+* NOTE :
+* RETURN : RET_NORMAL :Normal
+* : RET_ERROR :Abnormality
+******************************************************************************/
+RET_API VehicleSensInitSharedMemory(void) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API l_ret; /* Return of the functions */
+
+ /* All shared memory initialization */
+ l_ret = VehicleSensWriteDataGpsInterruptSignal(VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL);
+ if (l_ret == RET_NORMAL) {
+ l_ret = VehicleSensWriteDataGpsInterruptSignal(VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL);
+ }
+ if (l_ret == RET_NORMAL) {
+ l_ret = VehicleSensWriteDataGyroConnectStatus(VEHICLE_DID_GYRO_CONNECT_STATUS);
+ }
+
+ /* Initializes the effective ephemeris count when the shared memory is shut down. */
+ if (l_ret == RET_NORMAL) {
+ l_ret = VehicleSensWriteDataValidEphemerisNum(0); /* Initialized with effective ephemeris number 0 */
+ }
+
+ /* Writes the value read from the non-volatile memory to the shared memory. */
+ /* This process is executed only at startup.,After that, the shared memory will not be overwritten. */
+ if (l_ret == RET_NORMAL) {
+ l_ret = VehicleSensWriteDataLocalTime();
+ }
+
+ if (l_ret == RET_NORMAL) {
+ l_ret = VehicleSensWriteDataLonLat();
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensLinkSharedMemory
+* ABSTRACT : Shared memory link
+* FUNCTION : Link to shared memory
+* ARGUMENT :
+* NOTE :
+* RETURN : None
+******************************************************************************/
+static void VehicleSensLinkSharedMemory(char *shared_memory_name, void **p_share_addr) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api;
+ void *pv_share_mem; /* Store Shared Memory Address */
+ u_int32 ul_share_mem_size; /* Size of the linked shared memory */
+
+ /* Link to the handle storage area */
+ ret_api = _pb_LinkShareData(shared_memory_name, &pv_share_mem, &ul_share_mem_size);
+
+ if (ret_api == RET_NORMAL) {
+ /* If the link is successful */
+ *p_share_addr = pv_share_mem; /* Set the address */
+ } else {
+ /* If the link fails */
+ *p_share_addr = NULL;
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteDataGpsInterruptSignal
+* ABSTRACT : Writing of data
+* FUNCTION : Writing Data to Shared Memory
+* ARGUMENT : DID : Data ID
+* NOTE :
+* RETURN : RET_NORMAL :Normal
+* : RET_ERROR :Abnormality
+******************************************************************************/
+static RET_API VehicleSensWriteDataGpsInterruptSignal(DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static GPS_INTERRUPT *gpsInterruptSharedAddr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL pst_data;
+
+ RET_API l_ret = RET_NORMAL; /* Return of the functions */
+ RET_API l_ret_api; /* Return of the functions */
+
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(GPS_INTERRUPT_SIGNAL_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ l_ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (l_ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (gpsInterruptSharedAddr == NULL) {
+ /* Link to shared memory */
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ VehicleSensLinkSharedMemory(const_cast<char *>(GPS_INTERRUPT_SIGNAL_SHARE_NAME),
+ reinterpret_cast<void **>(&gpsInterruptSharedAddr));
+ }
+
+ if (gpsInterruptSharedAddr != NULL) {
+ /* The link to shared memory is successful. */
+ switch (ul_did) {
+ case VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL:
+ {
+ /* Get data from data master */
+ VehicleSensGetDataMasterMainGpsInterruptSignal(ul_did, 0, &pst_data);
+
+ /* Writing Data to Shared Memory */
+ gpsInterruptSharedAddr->_CWORD102__interrupt = pst_data.uc_data;
+ break;
+ }
+ case VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL:
+ {
+ /* Get data from data master */
+ VehicleSensGetDataMasterSysGpsInterruptSignal(ul_did, 0, &pst_data);
+
+ /* Writing Data to Shared Memory */
+ gpsInterruptSharedAddr->_CWORD56__interrupt = pst_data.uc_data;
+ break;
+ }
+ default:
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "DID is unknown. \r\n");
+ break;
+ }
+
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "gpsInterruptSharedAddr == NULL \r\n");
+ }
+
+ /* Semaphore unlock */
+ (void)_pb_SemUnlock(sem_id);
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteDataGyroConnectStatus
+* ABSTRACT : Writing of data
+* FUNCTION : Writing Data to Shared Memory
+* ARGUMENT : DID : Data ID
+* NOTE :
+* RETURN : RET_NORMAL :Normal
+* : RET_ERROR :Abnormality
+******************************************************************************/
+static RET_API VehicleSensWriteDataGyroConnectStatus(DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static u_int8 *gyroConnectSharedAddr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS pst_data;
+
+ RET_API l_ret = RET_NORMAL; /* Return of the functions */
+ RET_API l_ret_api; /* Return of the functions */
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(GYRO_CONNECT_STATUS_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ l_ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (l_ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (gyroConnectSharedAddr == NULL) {
+ /* Link to shared memory */
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ VehicleSensLinkSharedMemory(const_cast<char *>(GYRO_CONNECT_STATUS_SHARE_NAME),
+ reinterpret_cast<void **>(&gyroConnectSharedAddr));
+ }
+
+ if (gyroConnectSharedAddr != NULL) {
+ /* The link to shared memory is successful. */
+
+ /* Get data from data master */
+ VehicleSensGetDataMasterGyroConnectStatus(ul_did, 0, &pst_data);
+
+ /* Writing Data to Shared Memory */
+ *gyroConnectSharedAddr = pst_data.uc_data;
+
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "gyroConnectSharedAddr == NULL \r\n");
+ }
+
+ /* Semaphore unlock */
+ (void)_pb_SemUnlock(sem_id);
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteDataValidEphemerisNum
+* ABSTRACT : Write effective ephemeris number at shutdown
+* FUNCTION : Write effective ephemeris number at shutdown to shared memory
+* ARGUMENT : u_int8 valid_ephemer_isnum : Number of effective ephemeris written to shared memory during shutdown
+* NOTE :
+* RETURN : RET_NORMAL :Normal
+* : RET_ERROR :Abnormality
+******************************************************************************/
+RET_API VehicleSensWriteDataValidEphemerisNum(u_int8 valid_ephemer_isnum) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static u_int8 *shared_addr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ RET_API l_ret; /* Return of the functions */
+ RET_API l_ret_api; /* Return of the functions */
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(EPHEMERIS_NUM_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ l_ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (l_ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (shared_addr == NULL) {
+ /* Link to shared memory */
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ VehicleSensLinkSharedMemory(const_cast<char *>(EPHEMERIS_NUM_SHARE_NAME),
+ reinterpret_cast<void **>(&shared_addr));
+ }
+
+ if (shared_addr != NULL) {
+ *shared_addr = valid_ephemer_isnum;
+ l_ret = RET_NORMAL;
+
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "shared_addr == NULL \r\n");
+ }
+
+ /* Semaphore unlock */
+ l_ret_api = _pb_SemUnlock(sem_id);
+ if (l_ret_api != RET_NORMAL) {
+ /* Semaphore unlock failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemUnlock failed");
+ }
+ } else {
+ /* Semaphore ID acquisition failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteDataLocalTime
+* ABSTRACT : Writing Local Time at Shutdown
+* FUNCTION : Write local time on shutdown to shared memory
+* ARGUMENT : None
+* NOTE :
+* RETURN : RET_NORMAL :Acquisition normal
+* : RET_ERROR :Acquisition anomaly
+******************************************************************************/
+static RET_API VehicleSensWriteDataLocalTime(void) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static LOCALTIME *shared_addr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ RET_API l_ret; /* Return of the functions */
+ RET_API l_ret_api; /* Return of the functions */
+
+ LOCALTIME LocalTime;
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(LOCALTIME_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ l_ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (l_ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (shared_addr == NULL) {
+ /* Link to shared memory */
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ VehicleSensLinkSharedMemory(const_cast<char *>(LOCALTIME_SHARE_NAME),
+ reinterpret_cast<void **>(&shared_addr));
+ }
+
+ if (shared_addr != NULL) {
+ /* The link to shared memory is successful. */
+
+ /* Acquires data from the non-volatile memory and writes it to the shared memory. */
+ l_ret_api = VehicleSensReadNVLocalTime(&LocalTime);
+ if (l_ret_api == RET_NORMAL) {
+ *shared_addr = LocalTime;
+ l_ret = RET_NORMAL;
+ } else {
+ /* When data acquisition from non-volatile memory fails,Set an invalid value */
+ (*shared_addr).status = CLOCK_INVALID;
+ (*shared_addr).year = 0xFFFFU; /* invalid */
+ (*shared_addr).month = 255U; /* invalid */
+ (*shared_addr).day = 255U; /* invalid */
+ (*shared_addr).hour = 255U; /* invalid */
+ (*shared_addr).min = 255U; /* invalid */
+ (*shared_addr).sec = 255U; /* invalid */
+ l_ret = RET_NORMAL;
+ }
+
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "shared_addr == NULL \r\n");
+ }
+
+ /* Semaphore unlock */
+ l_ret_api = _pb_SemUnlock(sem_id);
+ if (l_ret_api != RET_NORMAL) {
+ /* Semaphore unlock failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemUnlock failed");
+ }
+ } else {
+ /* Semaphore ID acquisition failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteDataLonLat
+* ABSTRACT : Write position at shutdown
+* FUNCTION : Write shutdown position to shared memory
+* ARGUMENT : None
+* NOTE :
+* RETURN : RET_NORMAL :Successful acquisition
+* : RET_ERROR :Failed to acquire
+******************************************************************************/
+static RET_API VehicleSensWriteDataLonLat(void) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static LONLAT *shared_addr = NULL; /* Store Shared Memory Address */
+ static SemID sem_id = 0; /* ID of shared memory exclusive semaphore */
+
+ RET_API l_ret; /* Return of the functions */
+ RET_API l_ret_api; /* Return of the functions */
+
+ LONLAT lonlat; /* Position */
+
+ /* Get Semaphore ID */
+ if (sem_id == 0) {
+ sem_id = _pb_CreateSemaphore(const_cast<char *>(LONLAT_SEMAPHO_NAME));
+ }
+
+ if (sem_id != 0) {
+ /* Semaphore ID successfully acquired */
+ l_ret_api = _pb_SemLock(sem_id); /* Semaphore Lock */
+
+ if (l_ret_api == RET_NORMAL) {
+ /* Semaphore lock successful */
+
+ /* When the shared memory is not linked */
+ if (shared_addr == NULL) {
+ /* Link to shared memory */
+ /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */
+ VehicleSensLinkSharedMemory(const_cast<char *>(LONLAT_SHARE_NAME),
+ reinterpret_cast<void **>(&shared_addr));
+ }
+
+ if (shared_addr != NULL) {
+ /* The link to shared memory is successful. */
+
+ /* Acquires data from the non-volatile memory and writes it to the shared memory. */
+ l_ret_api = VehicleSensReadNVLonLat(&lonlat);
+ if (l_ret_api == RET_NORMAL) {
+ *shared_addr = lonlat;
+ l_ret = RET_NORMAL;
+ } else {
+ /* When data acquisition from non-volatile memory fails */
+ (*shared_addr).latitude = SENSORLOCATION_LATITUDE_INIT_VALUE;
+ (*shared_addr).longitude = SENSORLOCATION_LONGITUDE_INIT_VALUE;
+ l_ret = RET_NORMAL;
+ }
+
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "shared_addr == NULL \r\n");
+ }
+
+ /* Semaphore unlock */
+ l_ret_api = _pb_SemUnlock(sem_id);
+ if (l_ret_api != RET_NORMAL) {
+ /* Semaphore unlock failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemUnlock failed");
+ }
+ } else {
+ /* Semaphore ID acquisition failure */
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+ } else {
+ l_ret = RET_ERROR;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0");
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWriteSharedMemory
+* ABSTRACT : Write Shared Memory
+* FUNCTION : Write Shared Memory
+* ARGUMENT : DID : Data ID
+* RETURN : None
+* NOTE :
+******************************************************************************/
+void VehicleSensWriteSharedMemory(DID ul_did) {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (ul_did) {
+ case VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL:
+ case VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL:
+ {
+ (void)VehicleSensWriteDataGpsInterruptSignal(ul_did);
+ break;
+ }
+ case VEHICLE_DID_GYRO_CONNECT_STATUS:
+ {
+ (void)VehicleSensWriteDataGyroConnectStatus(ul_did);
+ break;
+ }
+ default:
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DID is unknown. \r\n");
+ break;
+ }
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Thread.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Thread.cpp
new file mode 100755
index 0000000..8dc3922
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleSens_Thread.cpp
@@ -0,0 +1,2144 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * File name :VehicleSens_Thread.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle sensor process
+ * Program name :Vehicle sensor thread
+ * Module configuration :VehicleSensThread() Vehicle Sensor Thread Domain Functions
+ * :VehicleSensThreadInit() Vehicle sensor thread initials
+ * :VehicleSensDeliveryEntry() Vehicle sensor information delivery registration
+ * :VehicleSensGetVehicleData() Vehicle sensor information acquisition
+ * :VehicleSensWatchStopPage() Vehicle sensor interruption monitoring
+ * :VehicleSensPkgDeliveryEntry() Vehicle sensor information package delivery registration
+ * :VehicleSensGetVehiclePkgData() Vehicle sensor information package data acquisition
+ * :VehicleSensLineSensDataDelivery() LineSensor Vehicle Signal Notification
+ * :VehicleSensGpsDataDelivery() GPS data notification
+ * :VehicleSens_CanDataDelivery() CAN data delivery notice
+ * :VehicleSensDataMasterSetN() Data master set notification process(Callback function)
+ * :VehicleSensSetVehicleData() GPS command request processing
+ ******************************************************************************/
+#include "VehicleSens_Thread.h"
+#include <vehicle_service/positioning_base_library.h>
+#include <other_service/VP_GetEnv.h>
+#include "POS_private.h"
+#include "positioning_common.h"
+#include "SensorLog.h"
+#include "VehicleUtility.h"
+#include "VehicleSensor_Thread.h"
+
+#include "VehicleIf.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+static VEHICLE_MSG_BUF g_wait_for_resp_msg; /* Message waiting to receive a response */
+static PFUNC_DMASTER_SET_N g_wait_for_resp_set_n; /* Response waiting data master set */
+static BOOL g_sent_fst_pkg_delivery_ext; /* Initial expansion package data delivery status */
+
+static VEHICLESENS_VEHICLE_SPEED_INFO g_vehicle_speed_info;
+
+uint32_t gPseudoSecClockCounter = 0u;
+
+/*************************************************/
+/* Function prototype */
+/*************************************************/
+static void VehicleSensInitDataDisrptMonitor(void);
+static void VehicleSensDataDisrptMonitorProc(DID did);
+static void VehicleSensRcvMsgTout(TimerToutMsg* rcv_msg);
+
+static void VehilceSens_InitVehicleSpeed(void);
+static void VehicleSens_StoreVehicleSpeed(VEHICLESENS_VEHICLE_SPEED_DAT* pVehicleSpeed);
+static void VehicleSens_LoadVehicleSpeed(VEHICLESENS_VEHICLE_SPEED_INFO* pVehicleSpeedInfo);
+static RET_API VehicleSens_CatNmeaSentenceFieldWithDelimiter(char* str1, const size_t size, const char* str2, const size_t n);
+static RET_API VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(char* str1, const size_t size, const char* str2, const size_t n);
+static inline RET_API VehicleSens_GeneratePASCDFieldId(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldTimestamp(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldSensorType(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldTransmissionState(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldSlipDetect(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldSampleCount(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldTimeOffsetNSpeed(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldChecksum(char* pascd, size_t size);
+static inline RET_API VehicleSens_GeneratePASCDFieldCRLF(char* pascd, size_t size);
+static RET_API VehicleSens_DeriveTransmissionStateFor_CWORD27_(VEHICLESENS_TRANSMISSION_PKG* pPkg);
+
+
+/*******************************************************************************
+* MODULE : VehicleSensThread
+* ABSTRACT : Vehicle Sensor Thread Domain Functions
+* FUNCTION : Main processing
+* ARGUMENT : lpv_para :
+* NOTE :
+* RETURN :
+******************************************************************************/
+EFrameworkunifiedStatus VehicleSensThread(HANDLE h_app) {
+ RET_API ret_api = RET_NORMAL; /* Return Values of System API Functions */
+ T_APIMSG_MSGBUF_HEADER *p; /* Message header */
+ RET_API ret_val; /* Return value of initialization processing */
+ VEHICLE_MSG_DELIVERY_ENTRY delivery_entry;
+
+ static u_int8 msg_buf[MAX_MSG_BUF_SIZE]; /* message buffer */
+
+ void* p_msg_buf = &msg_buf;
+ LSDRV_MSG_LSDATA_G** p_lsdrv_msg;
+ VEHICLE_MSG_BUF** p_vehicle_msg;
+ POS_MSGINFO *p_pos_msg;
+
+
+
+ p_lsdrv_msg = reinterpret_cast<LSDRV_MSG_LSDATA_G**>(&p_msg_buf);
+ p_vehicle_msg = reinterpret_cast<VEHICLE_MSG_BUF**>(&p_msg_buf);
+
+ VehicleUtilityInitTimer();
+ (void)PosSetupThread(h_app, ETID_POS_MAIN);
+
+ memset(&(delivery_entry), 0, sizeof(VEHICLE_MSG_DELIVERY_ENTRY));
+
+ /* Thread initialization process */
+ ret_val = VehicleSensThreadInit();
+
+ gPseudoSecClockCounter = 0u;
+
+ if (RET_NORMAL == ret_val) { // LCOV_EXCL_BR_LINE 6: always be RET_NORMAL
+ while (1) {
+ /* Message reception processing */
+ p_msg_buf = &msg_buf;
+ ret_api = _pb_RcvMsg(PNO_VEHICLE_SENSOR, sizeof(msg_buf), &p_msg_buf, RM_WAIT);
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "[ret_api = 0x%x]",
+ ret_api);
+
+ /* When the message is received successfully */
+ if (ret_api == RET_RCVMSG) {
+ p = reinterpret_cast<T_APIMSG_MSGBUF_HEADER *>(p_msg_buf);
+
+ switch (p->hdr.cid) { // LCOV_EXCL_BR_LINE 200: some DID is not used
+ case CID_VEHICLEIF_DELIVERY_ENTRY:
+ {
+ memcpy(&(delivery_entry), &(p_msg_buf), sizeof(VEHICLE_MSG_DELIVERY_ENTRY));
+
+ /* Sort by received DID */
+ switch (delivery_entry.data.did) { // LCOV_EXCL_BR_LINE 200: DR DID is not used
+ case VEHICLE_DID_DR_ALTITUDE :
+ case VEHICLE_DID_DR_LATITUDE :
+ case VEHICLE_DID_DR_SPEED :
+ case VEHICLE_DID_DR_HEADING :
+ case VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL :
+ case VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL :
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensDrDeliveryEntry((const VEHICLE_MSG_DELIVERY_ENTRY *)p_msg_buf);
+ // LCOV_EXCL_STOP
+ }
+ break;
+ default:
+ /* Vehicle sensor information delivery registration */
+ VehicleSensDeliveryEntry((const VEHICLE_MSG_DELIVERY_ENTRY *)p_msg_buf);
+ break;
+ }
+ break;
+ }
+ case CID_VEHICLEIF_GET_VEHICLE_DATA:
+ {
+ /* Vehicle sensor information acquisition */
+ VehicleSensGetVehicleData((const VEHICLE_MSG_GET_VEHICLE_DATA *)p_msg_buf);
+ break;
+ }
+ case CID_LINESENS_VEHICLE_DATA:
+ {
+ /* LineSensor Vehicle Signal Notification */
+ VehicleSensLineSensDataDelivery((const LSDRV_MSG_LSDATA *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ }
+ case CID_LINESENS_VEHICLE_DATA_G:
+ {
+ /* Data disruption monitoring process */
+ VehicleSensDataDisrptMonitorProc(
+ (reinterpret_cast<LSDRV_MSG_LSDATA_G*>(*p_lsdrv_msg))->st_para.st_data[0].ul_did);
+ VehicleSensLineSensDataDeliveryG((const LSDRV_MSG_LSDATA_G *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ }
+ case CID_LINESENS_VEHICLE_DATA_GYRO_TROUBLE:
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Gyro Failure Status Notification */
+ VehicleSensLineSensDataDeliveryGyroTrouble((const LSDRV_MSG_LSDATA_GYRO_TROUBLE *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_LINESENS_VEHICLE_DATA_SYS_GPS_INTERRUPT_SIGNAL:
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* SYS GPS interrupt notification */
+ VehicleSensLineSensDataDeliverySysGpsInterruptSignal(
+ (const LSDRV_MSG_LSDATA_GPS_INTERRUPT_SIGNAL *)p_msg_buf,
+ (PFUNC_DMASTER_SET_SHARED_MEMORY)VehicleSensDataMasterSetSharedMemory);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_LINESENS_VEHICLE_DATA_GYRO_CONNECT_STATUS:
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Gyro Failure Status Notification */
+ VehicleSensLineSensDataDeliveryGyroConnectStatus(
+ (const LSDRV_MSG_LSDATA_GYRO_CONNECT_STATUS *)p_msg_buf,
+ (PFUNC_DMASTER_SET_SHARED_MEMORY)VehicleSensDataMasterSetSharedMemory);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_LINESENS_VEHICLE_DATA_GPS_ANTENNA_STATUS:
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* GPS antenna failure status notification */
+ VehicleSensLineSensDataDeliveryGpsAntennaStatus(
+ (const LSDRV_MSG_LSDATA_GPS_ANTENNA_STATUS *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT:
+ {
+ /* Vehicle Sensor Information Extended Package Delivery Registration */
+ VehicleSensPkgDeliveryEntryExt((const SENSOR_MSG_DELIVERY_ENTRY *)p_msg_buf);
+ break;
+ }
+ case CID_LINESENS_VEHICLE_DATA_FST:
+ {
+ /* LineSensor Vehicle Initial Sensor Signal Notification */
+ VehicleSensLineSensDataDeliveryFstG((const LSDRV_MSG_LSDATA_FST *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ }
+ case CID_GPS_DATA:
+ {
+ /* GPS information notification */
+ VehicleSensGpsDataDelivery(reinterpret_cast<SENSOR_MSG_GPSDATA *>(p_msg_buf),
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN,
+ (PFUNC_DMASTER_SET_SHARED_MEMORY)VehicleSensDataMasterSetSharedMemory);
+ break;
+ }
+ case CID_POSIF_SET_DATA:
+ {
+ p_pos_msg =
+ reinterpret_cast<POS_MSGINFO*>((reinterpret_cast<VEHICLE_MSG_BUF*>(*p_vehicle_msg))->data);
+ /* Data disruption monitoring process */
+ VehicleSensDataDisrptMonitorProc(p_pos_msg->did);
+
+ /* Data Setting Notification */
+ VehicleSensCommonDataDelivery((const VEHICLE_MSG_BUF *)p_msg_buf,
+ (PFUNC_DMASTER_SET_N)VehicleSensDataMasterSetN);
+ break;
+ }
+ case CID_GPS_RETTIMESETTING:
+ {
+ /* GPS time setting result notification */
+ VehicleSensGpsTimeDelivery((const VEHICLE_MSG_BUF *)p_msg_buf);
+ break;
+ }
+ case CID_DEAD_RECKONING_GPS_DATA : /* GPS data distribution for DR */
+ case CID_DEAD_RECKONING_SENS_DATA : /* Sensor Data Delivery for DR */
+ case CID_DEAD_RECKONING_SENS_FST_DATA : /* Initial Sensor Data Delivery for DR */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensDrRcvMsg((const DEAD_RECKONING_RCVDATA *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_VEHICLEIF_GET_DR_DATA :
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Vehicle sensor information acquisition */
+ DeadReckoningGetDRData((const DEADRECKONING_MSG_GET_DR_DATA *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_DR_MAP_MATCHING_DATA : /* Map matching information */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DeadReckoningSetMapMatchingData((const DR_MSG_MAP_MATCHING_DATA *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_DR_CLEAR_BACKUP_DATA : /* Clear backup data */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DeadReckoningClearBackupData((const DR_MSG_CLEAR_BACKUP_DATA*)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_VEHICLEDEBUG_LOG_GET : /* Log acquisition request */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensGetLog((const VEHICLEDEBUG_MSG_BUF *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_VEHICLEDEBUG_LOG_SET : /* Log Setting Request */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensSetLog((const VEHICLEDEBUG_MSG_BUF *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CANINPUT_CID_LOCALTIME_NOTIFICATION : /* CAN information acquisition */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensWriteLocalTime((const CANINPUT_MSG_INFO*)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_EPH_NUM_NOTIFICATION : /* Set effective ephemeris count at shutdown */
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VehicleSensSetEphNumSharedMemory((const SENSOR_MSG_GPSDATA *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_SENSORIF__CWORD82__REQUEST:
+ {
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Requests to send GPS _CWORD82_ commands */
+ VehicleSensSetVehicleData((const VEHICLE_MSG_SEND *)p_msg_buf);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case CID_THREAD_STOP_REQ:
+ {
+ /* Thread stop processing */
+ VehicleSensThreadStopProcess();
+ break;
+ }
+ case CID_TIMER_TOUT:
+ {
+ /* Timeout notification reception processing */
+ VehicleSensRcvMsgTout(reinterpret_cast<TimerToutMsg*>(p_msg_buf));
+ break;
+ }
+ default:
+ break;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ret_api != RET_RCVMSG\r\n");
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleSens: VehicleSens_MainThread Initial Error!! :%d", ret_val);
+ _pb_Exit();
+ }
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensThreadInit
+* ABSTRACT : Vehicle sensor thread initials
+* FUNCTION : Initial process
+* ARGUMENT : void
+* NOTE :
+* RETURN : CAN data delivery registration result
+******************************************************************************/
+RET_API VehicleSensThreadInit(void) {
+ RET_API ret_val = RET_NORMAL;
+
+ /* Initialization of Vehicle Selection Item List Table */
+ VehicleSensInitSelectionItemList();
+
+ /* Vehicle sensor data master initialization */
+ VehicleSensInitDataMaster();
+
+ /* Initialization of shipping destination management table */
+ VehicleSensInitDeliveryCtrlTbl();
+
+ /* Initialization of shipping destination management table management information */
+ VehicleSensInitDeliveryCtrlTblMng();
+
+ /* Initialization of package delivery management table */
+ VehicleSensInitPkgDeliveryTblMng();
+
+ /* Initialization of non-volatile access function block */
+ VehicleSensFromAccessInitialize();
+
+ /* Clear message information waiting to receive a response */
+ (void)memset(&g_wait_for_resp_msg, 0x00, sizeof(VEHICLE_MSG_BUF));
+ g_wait_for_resp_set_n = NULL;
+ g_sent_fst_pkg_delivery_ext = FALSE; /* Initial expansion package data undelivered */
+
+ VehilceSens_InitVehicleSpeed(); /* for PASCD */
+
+ /* Start of data interruption monitoring */
+ VehicleSensInitDataDisrptMonitor();
+ return ret_val;
+}
+
+/*******************************************************************************
+ * MODULE : VehicleSensDeliveryEntry
+ * ABSTRACT : Vehicle sensor information delivery registration
+ * FUNCTION :
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensDeliveryEntry(const VEHICLE_MSG_DELIVERY_ENTRY *msg) {
+ int32 event_val;
+ EventID event_id;
+
+ /* Call the process of creating the delivery destination management table */
+ event_val = static_cast<int32>(VehicleSensEntryDeliveryCtrl(msg));
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(msg->data.pno);
+
+ /* Publish Events */
+ (void)_pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+
+ if (VEHICLE_RET_NORMAL == event_val) {
+ /* Successful delivery registration */
+ /* Deliver data for the first time */
+ VehicleSensFirstDelivery((PNO)(msg->data.pno), (DID)(msg->data.did));
+ }
+
+ /* Event deletion */
+ (void)VehicleDeleteEvent(event_id);
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensGetVehicleData
+* ABSTRACT : Vehicle sensor information acquisition
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetVehicleData(const VEHICLE_MSG_GET_VEHICLE_DATA *msg) {
+ void *share_top; /* Start address of shared memory */
+ u_int32 share_size; /* Size of shared memory area */
+ u_int8 get_method; /* Data collection way */
+ VEHICLESENS_DATA_MASTER master; /* Data master */
+ RET_API ret_api;
+ int32 ret_val;
+ int32 event_val;
+ EventID event_id;
+ SENSOR_MSG_GPSDATA_DAT gps_master; /* GPS Data Master */
+
+ /* Check the DID */
+ ret_val = VehicleSensCheckDid(msg->data.did);
+ if (VEHICLESENS_INVALID != ret_val) { // LCOV_EXCL_BR_LINE 6:did always valid
+ /* DID normal */
+
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME), &share_top, &share_size);
+ if (RET_NORMAL == ret_api) {
+ /* Acquire the specified data from the data master. */
+ get_method = VehicleSensGetSelectionItemList(msg->data.did);
+ if ((VEHICLESENS_GETMETHOD_GPS == get_method) &&
+ ((msg->data.did != VEHICLE_DID_LOCATION_LONLAT) &&
+ (msg->data.did != VEHICLE_DID_LOCATION_ALTITUDE) &&
+ (msg->data.did != VEHICLE_DID_MOTION_HEADING))) {
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Retrieval of the data master fails.,Initialize size to 0 to prevent unauthorized writes */
+ gps_master.us_size = 0;
+ VehicleSensGetGpsDataMaster(msg->data.did, get_method, &gps_master);
+ /* Check the data size */
+ if (msg->data.size < gps_master.us_size) {
+ /* Shared memory error(Insufficient storage size) */
+ event_val = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ } else {
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg->data.offset, (const void *)&gps_master.uc_data, gps_master.us_size);
+
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED,
+ msg->data.did, msg->data.pno,
+ reinterpret_cast<uint8_t *>(&(gps_master.uc_data[0])),
+ gps_master.us_size, SENSLOG_RES_SUCCESS);
+ }
+ } else {
+ (void)memset(reinterpret_cast<void *>(&master), 0, sizeof(VEHICLESENS_DATA_MASTER));
+ VehicleSensGetDataMaster(msg->data.did, get_method, &master);
+
+ /* Check the data size */
+ if (msg->data.size < master.us_size) {
+ /* Shared memory error(Insufficient storage size) */
+ event_val = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ } else {
+ /* Write data master to shared memory */
+ PosSetShareData(share_top,
+ msg->data.offset, (const void *)master.uc_data, master.us_size);
+
+ /* Set Successful Completion */
+ event_val = VEHICLE_RET_NORMAL;
+ SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED,
+ msg->data.did, msg->data.pno,
+ reinterpret_cast<uint8_t *>(&(master.uc_data[0])),
+ master.us_size, SENSLOG_RES_SUCCESS);
+ }
+ }
+ } else {
+ /* Shared memory error */
+ event_val = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ }
+ } else {
+ /* DID error */
+ event_val = VEHICLE_RET_ERROR_DID;
+ }
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(msg->data.pno);
+
+ /* Publish Events */
+ ret_api = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+ if (RET_NORMAL != ret_api) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SetEvent ERROR!! [ret_api = %d]", ret_api);
+ }
+
+ /* Event deletion */
+ (void)VehicleDeleteEvent(event_id);
+
+ return;
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensWatchStopPage
+* ABSTRACT : Vehicle sensor interruption monitoring
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensWatchStopPage(const VEHICLE_MSG_WATCH_STOPPAGE *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Not used(Delete Used Functions After Investigation) */
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensPkgDeliveryEntry
+* ABSTRACT : Vehicle sensor information package delivery registration
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensPkgDeliveryEntry(const SENSOR_MSG_DELIVERY_ENTRY *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 event_val;
+ EventID event_id;
+
+ /* Call the process of creating the delivery destination management table */
+ event_val = static_cast<int32>(VehicleSensEntryPkgDeliveryCtrl(msg , VEHICLESENS_EXT_OFF));
+ /* #Polaris_003 */
+
+ /* Event Generation */
+ event_id = PosCreateEvent(msg->data.pno);
+
+ /* Publish Events */
+ (void)_pb_SetEvent(msg->data.event_id, SAPI_EVSET_ABSOLUTE, event_val);
+
+ if (VEHICLE_RET_NORMAL == event_val) {
+ /* Successful delivery registration */
+ /* Deliver package data for the first time */
+ VehicleSensFirstPkgDelivery(&msg->data);
+ }
+
+ /* Event deletion */
+ (void)PosDeleteEvent(event_id);
+}
+// LCOV_EXCL_STOP
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensPkgDeliveryEntryExt
+* ABSTRACT : Vehicle Sensor Information Extended Package Delivery Registration
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensPkgDeliveryEntryExt(const SENSOR_MSG_DELIVERY_ENTRY *msg) {
+ int32 event_val;
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ /* Call the process of creating the delivery destination management table */
+ event_val = static_cast<int32>(VehicleSensEntryPkgDeliveryCtrl(msg , VEHICLESENS_EXT_ON));
+
+ /* Event Generation */
+ (void)PosCreateEvent(msg->data.pno);
+
+ /* Publish Events */
+ (void)_pb_SetEvent(msg->data.event_id, SAPI_EVSET_ABSOLUTE, event_val);
+
+ if (VEHICLE_RET_NORMAL == event_val) {
+ /* Successful delivery registration */
+ /* Provide initial expansion package data delivery */
+ VehicleSensFirstPkgDeliveryExt(&msg->data);
+
+ /* Initial expansion package data delivered */
+ g_sent_fst_pkg_delivery_ext = TRUE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
+ "FirstPkgDeliveryExt call.[%d]",
+ g_sent_fst_pkg_delivery_ext); /* TODO */
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+
+#else
+/*******************************************************************************
+* MODULE : VehicleSensPkgDeliveryEntryError
+* ABSTRACT : Vehicle Sensor Information Extended Package Delivery Registration
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensPkgDeliveryEntryError(const SENSOR_MSG_DELIVERY_ENTRY *msg) {
+ RET_API ret_api;
+ EventID event_id;
+
+ /* Event Generation */
+ event_id = PosCreateEvent(msg->data.pno);
+
+ /* Publish Event Set DID Error */
+ ret_api = _pb_SetEvent(msg->data.event_id, SAPI_EVSET_ABSOLUTE, VEHICLE_RET_ERROR_DID);
+}
+
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensGetVehiclePkgData
+* ABSTRACT : Vehicle sensor information package data acquisition
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGetVehiclePkgData(const SENSOR_MSG_GET_SENSOR_DATA *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDelivery
+* ABSTRACT : LineSensor Vehicle Signal Notification
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDelivery(const LSDRV_MSG_LSDATA *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) {
+ int32 i;
+ BOOL sens_ext;
+
+ sens_ext = TRUE;
+
+ for (i = 0; i < msg->st_para.uc_data_num; i++) {
+ /* Setting Vehicle Signal Data from LineSensor as Data Master */
+ VehicleSensSetDataMasterLineSens((const LSDRV_LSDATA *) & (msg->st_para.st_data[i]),
+ p_datamaster_set_n, sens_ext);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryG
+* ABSTRACT : LineSensor Vehicle Signal Notification
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryG(const LSDRV_MSG_LSDATA_G *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) {
+ int32 i;
+ BOOL sens_ext;
+
+ sens_ext = TRUE;
+ if (g_sent_fst_pkg_delivery_ext == TRUE) {
+ /* Initial Expansion Package Data Delivery,Without storing extended data */
+ sens_ext = FALSE;
+ }
+
+ for (i = 0; i < msg->st_para.uc_data_num; i++) {
+ /* Setting Vehicle Signal Data from LineSensor as Data Master */
+ VehicleSensSetDataMasterLineSensG((const LSDRV_LSDATA_G *) & (msg->st_para.st_data[i]),
+ p_datamaster_set_n, sens_ext);
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryGyroTrouble
+* ABSTRACT : Gyro Failure Status Notification
+* FUNCTION : Notify of a gyro failure condition
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryGyroTrouble(const LSDRV_MSG_LSDATA_GYRO_TROUBLE *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Setting Gyro Failure Status Data from LineSensor to Data Master */
+ VehicleSensSetDataMasterGyroTrouble((const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *)&(msg->st_para),
+ p_datamaster_set_n);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliverySysGpsInterruptSignal
+* ABSTRACT : SYS GPS interrupt notification
+* FUNCTION : Notify SYS GPS interrupt signals
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_sharedmemory : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliverySysGpsInterruptSignal(const LSDRV_MSG_LSDATA_GPS_INTERRUPT_SIGNAL *msg, PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory) { // LCOV_EXCL_START 8 :dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Sets the SYS GPS interrupt data from the LineSensor to the data master. */
+ VehicleSensSetDataMasterSysGpsInterruptSignal((const LSDRV_MSG_LSDATA_DAT_GPS_INTERRUPT_SIGNAL *)&(msg->st_para),
+ p_datamaster_set_sharedmemory);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryGyroConnectStatus
+* ABSTRACT : Gyro Connection Status Notification
+* FUNCTION : Notify the state of the gyro connection
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_sharedmemory : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryGyroConnectStatus(const LSDRV_MSG_LSDATA_GYRO_CONNECT_STATUS *msg, PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Setting Gyro Connection Status Data from LineSensor to Data Master */
+ VehicleSensSetDataMasterGyroConnectStatus((const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *)&(msg->st_para),
+ p_datamaster_set_sharedmemory);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryGpsAntennaStatus
+* ABSTRACT : GPS Antenna Connection Status Notification
+* FUNCTION : Notify the GPS antenna connection status
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryGpsAntennaStatus(const LSDRV_MSG_LSDATA_GPS_ANTENNA_STATUS *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Setting GPS Antenna Connection Status Data from LineSensor as Data Master */
+ VehicleSensSetDataMasterGpsAntennaStatus((const LSDRV_MSG_LSDATA_DAT_GPS_ANTENNA_STATUS *)&(msg->st_para),
+ p_datamaster_set_n);
+}
+// LCOV_EXCL_STOP
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryFst
+* ABSTRACT : LineSensor Vehicle Signal Notification(Initial Sensor)
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryFst(const LSDRV_MSG_LSDATA_FST *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+#endif
+
+#if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
+/*******************************************************************************
+* MODULE : VehicleSensLineSensDataDeliveryFstG
+* ABSTRACT : LineSensor Vehicle Signal Notification(Initial Sensor)
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : Data Master Set Notification(Callback function)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensLineSensDataDeliveryFstG(const LSDRV_MSG_LSDATA_FST *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) {
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
+
+ if (msg == NULL) { // LCOV_EXCL_BR_LINE 6:msg cannot be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "msg == NULL\r\n"); // LCOV_EXCL_LINE 8: dead code
+ } else {
+ /* Set Vehicle Signal Data from LineSensor (Initial Sensor) as Data Master */
+ VehicleSensSetDataMasterLineSensFstG((const LSDRV_MSG_LSDATA_DAT_FST *) & (msg->st_para),
+ p_datamaster_set_n);
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
+}
+#endif
+
+/*******************************************************************************
+* MODULE : VehicleSensGpsDataDelivery
+* ABSTRACT : GPS data notification
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* : p_datamaster_set_n : For Data Master Set Notification(Callback function) delivery
+* : p_datamaster_set_sharedmemory : Data Master Set Notification (Callback Function) Shared Memory Write
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensGpsDataDelivery(SENSOR_MSG_GPSDATA *msg,
+ PFUNC_DMASTER_SET_N p_datamaster_set_n,
+ PFUNC_DMASTER_SET_SHARED_MEMORY p_datamaster_set_sharedmemory) {
+ /* Setting GPS Data as Data Master */
+ if (msg->st_para.ul_did == VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL) { // LCOV_EXCL_BR_LINE 6:DID is not used
+ // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* [PastModel002 Specifications] GPS->_CWORD102_ interrupt or not is obtained from GPS */
+ VehicleSensSetDataMasterMainGpsInterruptSignal((const SENSOR_MSG_GPSDATA_DAT *)&(msg->st_para),
+ p_datamaster_set_sharedmemory);
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSensGpsDataDelivery VehicleSensSetDataMasterGps() -->");
+ VehicleSensSetDataMasterGps(reinterpret_cast<SENSOR_MSG_GPSDATA_DAT *>(&(msg->st_para)),
+ p_datamaster_set_n);
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__,
+ "VehicleSensGpsDataDelivery VehicleSensSetDataMasterGps() <--");
+ }
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensDataMasterSetN
+* ABSTRACT : Data master set notification process(Callback function)
+* FUNCTION : Call the data delivery process
+* ARGUMENT : did : Data ID
+* : chg_type : Change type(no change/with change)
+* : get_method : Acquisition method(Direct Line/CAN)
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensDataMasterSetN(DID did, u_int8 chg_type, u_int8 get_method) {
+
+ u_int8 chgType;
+
+ chgType = chg_type;
+
+ switch (did) {
+ case POSHAL_DID_SPEED_KMPH:
+ {
+ if (ChkUnitType(UNIT_TYPE_GRADE1) == TRUE) {
+ /* For creating PASCD Sentence of NMEA */
+
+ int ret;
+ VEHICLESENS_VEHICLE_SPEED_DAT stVehicleSpeed;
+
+ ret = clock_gettime(CLOCK_MONOTONIC, &(stVehicleSpeed.ts));
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "clock_gettime error:%m");
+ } else {
+ VEHICLESENS_DATA_MASTER stData;
+ SENSORMOTION_SPEEDINFO_DAT* pSpdInfo;
+
+ VehicleSensGetMotionSpeed(&stData, VEHICLESENS_GETMETHOD_INTERNAL); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ pSpdInfo = (SENSORMOTION_SPEEDINFO_DAT*)(stData.uc_data);
+
+ stVehicleSpeed.speed = pSpdInfo->Speed;
+
+ VehicleSens_StoreVehicleSpeed(&stVehicleSpeed); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ }
+ }
+
+ break;
+ }
+ case POSHAL_DID_GPS_NMEA:
+ {
+ VehilceSens_InitVehicleSpeed();
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ /* Call the data delivery process */
+ VehicleSensDeliveryProc( did, chgType, get_method );
+}
+
+/*******************************************************************************
+* MODULE : VehicleSensDataMasterSetSharedMemory
+* ABSTRACT : Data master set notification process(Callback function)
+* FUNCTION : Call Write Shared Memory
+* ARGUMENT : did : Data ID
+* : chg_type : Whether or not data is updated
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensDataMasterSetSharedMemory(DID did, u_int8 chg_type) { // LCOV_EXCL_START 8: dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When there is no change, the shared memory write process is not called. */
+ if (chg_type == VEHICLESENS_NEQ) {
+ VehicleSensWriteSharedMemory(did);
+ }
+}
+// LCOV_EXCL_STOP
+
+/* ++ GPS _CWORD82_ support */
+/*******************************************************************************
+* MODULE : VehicleSensSetVehicleData
+* ABSTRACT : GPS command request processing
+* FUNCTION : Transfer a GPS command request
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetVehicleData(const VEHICLE_MSG_SEND *msg) {
+ u_int16 size; /* Data length setting */
+ u_int16 all_len; /* Sent message length */
+ u_int16 mode; /* Mode information */
+ RID req_id = 0; /* Resources ID */
+
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ TG_GPS_SND_DATA data; /* Message body */
+ u_int8 snd_buf[(sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(TG_GPS_SND_DATA))];
+
+ /* Message header generation */
+ size = sizeof(data);
+ header.signo = 0; /* Signal information */
+ header.hdr.sndpno = PNO_VEHICLE_SENSOR; /* Source thread number */
+ header.hdr.respno = 0; /* Destination process No. */
+ header.hdr.cid = CID_GPS__CWORD82__REQUEST; /* Command ID */
+ header.hdr.msgbodysize = size; /* Message data length setting */
+ header.hdr.rid = req_id; /* Resource ID Setting */
+ header.hdr.reserve = 0; /* Reserved Area Clear */
+
+ /* Message body generating */
+ data.us_size = msg->data.size;
+ memcpy(&(data.ub_data[0]), &(msg->data.data[0]), msg->data.size);
+
+ /* Reserved Area Clear */
+ data.reserve[0] = 0;
+ data.reserve[1] = 0;
+ data.reserve[2] = 0;
+ data.reserve[3] = 0;
+
+ /* Message generation */
+ (void)memcpy(&snd_buf[0], &header, sizeof(header));
+ (void)memcpy(&snd_buf[sizeof(header)], &data, sizeof(data));
+ all_len = static_cast<u_int16>(size + sizeof(header));
+ mode = 0;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__, "VehicleSensSetVehicleData NMEA = %s", data.ub_data);
+ (void)_pb_SndMsg(PNO_NAVI_GPS_MAIN, all_len, reinterpret_cast<void *>(&snd_buf[0]), mode);
+}
+
+/*******************************************************************************
+ * MODULE : VehicleSensDrDeliveryEntry
+ * ABSTRACT : Sensor Internal Information Delivery Registration for DR
+ * FUNCTION :
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensDrDeliveryEntry(const VEHICLE_MSG_DELIVERY_ENTRY *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 event_val;
+ EventID event_id;
+
+ /* Call the process of creating the delivery destination management table */
+ event_val = static_cast<int32>(DeadReckoningEntryDeliveryCtrl((const DEADRECKONING_MSG_DELIVERY_ENTRY*)msg));
+ /* #QAC confirmation Rule11.4 Member reference to suppress address reference error in data R/W */
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(msg->data.pno);
+
+ /* Publish Events */
+ (void)_pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+
+ if (VEHICLE_RET_NORMAL == event_val) {
+ /* Successful delivery registration */
+ /* Deliver data for the first time */
+ DeadReckoningFirstDelivery((PNO)(msg->data.pno), (DID)(msg->data.did));
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : VehicleSensGetLog
+ * ABSTRACT : Log acquisition request
+ * FUNCTION :
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensGetLog(const VEHICLEDEBUG_MSG_BUF *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DeadReckoningGetLocationLogStatus(msg->hdr.hdr.sndpno);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : VehicleSensSetLog
+ * ABSTRACT : Log Setting Request
+ * FUNCTION :
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensSetLog(const VEHICLEDEBUG_MSG_BUF* msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : VehicleSensWriteLocalTime
+ * ABSTRACT : Set LOCALTIME to non-volatile
+ * FUNCTION :
+ * ARGUMENT : *msg : message buffer
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void VehicleSensWriteLocalTime(const CANINPUT_MSG_INFO *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ LOCALTIME localtime = {0};
+ int32 time_diff;
+ RET_API ret_write_api;
+ static u_int8 cnt = 0U; /* For update cycle count */
+ if (msg != NULL) {
+ memset(&time_diff, 0x00, sizeof(time_diff)); /* Coverity CID:18813 compliant */
+
+ /* Determine that the 1s cycle (cnt == 1) has elapsed for 1 second. */
+ cnt++;
+
+ /* When 5 seconds or more have elapsed since the last update */
+ /* Saving Time Information in Non-volatile Memory */
+ if (cnt >= NV_UPDATE_CYCLE_LOCALTIME) {
+ /* Non-volatile write */
+ ret_write_api = VehicleSensWriteNVLocaltime(&localtime, &time_diff);
+ if (ret_write_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NV write error.");
+ }
+ cnt = 0U;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT NULL");
+ }
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensSetEphNumSharedMemory
+* ABSTRACT : Write effective ephemeris number to shared memory
+* FUNCTION :
+* ARGUMENT : *msg : message buffer
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensSetEphNumSharedMemory(const SENSOR_MSG_GPSDATA *msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api;
+ u_int8 ephemeris_num;
+
+ if (msg != NULL) {
+ ephemeris_num = msg->st_para.uc_data[0];
+
+ ret_api = VehicleSensWriteDataValidEphemerisNum(ephemeris_num);
+
+ if (ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Share Memory write error.");
+ }
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+* MODULE : VehicleSensDrRcvMsg
+* ABSTRACT : Data delivery for DR,Write location information to shared memory
+* FUNCTION :
+* ARGUMENT : const EPHEMERIS_NUM_DATA_DAT * : Incoming message
+* NOTE :
+* RETURN : void
+******************************************************************************/
+void VehicleSensDrRcvMsg(const DEAD_RECKONING_RCVDATA * msg) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DEAD_RECKONING_LONLAT_INFO lonlat_info;
+
+ if (msg != NULL) {
+ DeadReckoningRcvMsg(msg, &lonlat_info);
+
+ /* Process for storing location information in non-volatile memory during shutdown */
+ /* With a refresh interval of 1 second,Save only when location information is valid data */
+ if (lonlat_info.calc_called == TRUE) {
+ static u_int8 cnt = 0U; /* For update cycle count */
+
+ /* Sensor data is 100ms cycle,Determine that (cnt == 10) has elapsed for 1 second */
+ /* Cnt increments to 10 */
+ if (cnt < NV_UPDATE_CYCLE_LONLAT) {
+ cnt++;
+ }
+
+ /* When 1 second or more has elapsed since the last update and the location information is valid, */
+ /* Saving Location Information in Non-Volatile Memory */
+ if ((cnt >= NV_UPDATE_CYCLE_LONLAT) && (lonlat_info.available == static_cast<u_int8>(TRUE))) {
+ VehicleSensStoreLonlat(&(lonlat_info.lonlat));
+ cnt = 0U;
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ARGUMENT NULL");
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Data setting process
+ *
+ * Setting Specified Data to Data Master
+ *
+ * @param[in] const VEHICLE_MSG_BUF *msg : message buffer
+ * @param[out] PFUNC_DMASTER_SET_N p_datamaster_set_n : Data Master Set Notification(Callback function)
+ * @return none
+ * @retval none
+ */
+void VehicleSensCommonDataDelivery(const VEHICLE_MSG_BUF *msg, PFUNC_DMASTER_SET_N p_datamaster_set_n) {
+ const POS_MSGINFO *pstPosMsg = (const POS_MSGINFO *) & (msg->data[0]);
+
+ /* Individual processing for each data ID */
+ switch (pstPosMsg->did) {
+ case VEHICLE_DID_SETTINGTIME:
+ {
+ /* By checking the evacuation message information,Determine whether the GPS time has already been set and requested */
+ if (NULL == g_wait_for_resp_set_n) {
+ /* GPS time settable */
+ /* GPS time setting data transmission */
+ VehicleSensGpsTimeSndMsg(pstPosMsg);
+
+ /* Save message information(Used when a response is received.)*/
+ (void)memcpy(&g_wait_for_resp_msg, msg, sizeof(VEHICLE_MSG_BUF));
+ g_wait_for_resp_set_n = p_datamaster_set_n;
+ } else {
+ /* GPS time setting process is already in progress:Reply BUSY to requesting processes */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SetGpsTime already.");
+ }
+ break;
+ }
+ default:
+ /* Set the specified data in the data master */
+ VehicleSensSetDataMasterData((const POS_MSGINFO *)msg->data, p_datamaster_set_n);
+ break;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS time setting data transmission process
+ *
+ * Send the specified data to the GPS thread
+ *
+ * @param[in] const POS_MSGINFO *pos_msg : message buffer
+ * @return none
+ * @retval none
+ */
+void VehicleSensGpsTimeSndMsg(const POS_MSGINFO *pos_msg) {
+ RET_API ret_api = RET_NORMAL; /* System API return value */
+ u_int16 size = 0; /* Data length setting */
+ u_int16 all_len = 0; /* Sent message length */
+ u_int16 mode = 0; /* Mode information */
+ RID req_id = 0; /* Resources ID */
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ TG_GPS_SND_DATA data; /* Message body */
+ u_int8 snd_buf[(sizeof(T_APIMSG_MSGBUF_HEADER) + sizeof(TG_GPS_SND_DATA))];
+
+ memset(&header, 0x00, sizeof(T_APIMSG_MSGBUF_HEADER));
+ memset(&data, 0x00, sizeof(TG_GPS_SND_DATA));
+
+ /* Message header generation */
+ size = sizeof(data);
+ header.signo = 0; /* Signal information */
+ header.hdr.sndpno = PNO_VEHICLE_SENSOR; /* Source thread number */
+ header.hdr.respno = 0; /* Destination process No. */
+ header.hdr.cid = CID_GPS_TIMESETTING; /* Command ID */
+ header.hdr.msgbodysize = size; /* Message data length setting */
+ header.hdr.rid = req_id; /* Resource ID Setting */
+
+ /* Message body generating */
+ data.us_size = pos_msg->size;
+ memcpy(&(data.ub_data[0]), &(pos_msg->data[0]), pos_msg->size);
+
+ /* Messaging */
+ (void)memcpy(&snd_buf[0], &header, sizeof(header));
+ (void)memcpy(&snd_buf[sizeof(header)], &data, sizeof(data));
+ all_len = static_cast<u_int16>(size + sizeof(header));
+ mode = 0;
+ ret_api = _pb_SndMsg(PNO_NAVI_GPS_MAIN, all_len, reinterpret_cast<void *>(&snd_buf[0]), mode);
+ if (RET_NORMAL != ret_api) {
+ /* Message transmission processing failed */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "send Message failed.");
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * GPS time setting result notification process
+ *
+ * Setting Specified Data to Data Master
+ *
+ * @param[in] const VEHICLE_MSG_BUF *msg : message buffer
+ * @return none
+ * @retval none
+ */
+void VehicleSensGpsTimeDelivery(const VEHICLE_MSG_BUF *msg) {
+ int32 event_val = POS_RET_ERROR_INNER; /* Event value */
+ const TG_GPS_RET_TIMESET_MSG *gps_ret_time; /* GPS time setting response message */
+
+ /* Determine the GPS time setting result */
+ gps_ret_time = (const TG_GPS_RET_TIMESET_MSG *)msg;
+
+ if (GPS_SENDOK == gps_ret_time->status) {
+ event_val = POS_RET_NORMAL;
+ } else {
+ event_val = POS_RET_ERROR_TIMEOUT;
+ }
+
+ /* Set the specified data in the data master */
+ if (POS_RET_NORMAL == event_val) {
+ VehicleSensSetDataMasterData((const POS_MSGINFO *)&g_wait_for_resp_msg.data, g_wait_for_resp_set_n);
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
+ "SetGpsTime Result[%d] EventVal[%d]",
+ static_cast<uint32_t>(gps_ret_time->status), static_cast<uint32_t>(event_val));
+
+ /* Clear saved message information */
+ (void)memset(&g_wait_for_resp_msg, 0x00, sizeof(VEHICLE_MSG_BUF));
+ g_wait_for_resp_set_n = NULL;
+
+ return;
+}
+
+/**
+ * @brief
+ * Specified process No. event transmission processing
+ *
+ * Send an event to the specified process No.
+ *
+ * @param[in] uint16_t snd_pno : Destination process number
+ * @param[in] int32_t event_val : Sent event value
+ * @return RET_API
+ * @retval RET_NORMAL Normal completion<br>
+ * RET_ERROR Event generation failure<br>
+ * RET_ERRPARAM Configuration mode error<br>
+ * RET_EV_NONE Specified event does not exist<br>
+ * RET_EV_MAX The set event value exceeds the maximum value<br>
+ * RET_EV_MIN The set event value is below the minimum value.
+ */
+RET_API VehicleSensSendEvent(uint16_t snd_pno, int32_t event_val) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_val = RET_ERROR; /* Return value */
+ EventID event_id = 0; /* Event ID */
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(snd_pno);
+ if (0 != event_id) {
+ /* Event publishing(Release Event Wait) */
+ ret_val = _pb_SetEvent(event_id, SAPI_EVSET_ABSOLUTE, event_val);
+ if (RET_NORMAL != ret_val) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "set Event failed.");
+ }
+
+ /* Event deletion */
+ (void)VehicleDeleteEvent(event_id);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "create Event failed.");
+ }
+
+ return ret_val;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Pos_Main thread stop processing
+ */
+void VehicleSensThreadStopProcess(void) {
+ /* Exit Process Implementation Point >>> */
+
+
+ /* <<< Exit Process Implementation Point */
+
+ /* Thread stop processing */
+ PosTeardownThread(ETID_POS_MAIN);
+
+ /* don't arrive here */
+ return;
+}
+
+/**
+ * @brief
+ * Initialization of data interruption monitoring process<br>
+ * 1.Initial data reception monitoring timer issuance
+ */
+static void VehicleSensInitDataDisrptMonitor(void) {
+
+ /* Initial sensor data reception monitoring timer */
+ VehicleUtilitySetTimer(SNS_FST_TIMER);
+
+ return;
+}
+
+/**
+ * @brief
+ * Data disruption monitoring process<br>
+ * 1.Stop timer for monitoring initial data reception<br>
+ * 2.Stop timer for periodic data reception monitoring<br>
+ * 3.Periodic data reception monitoring timer issuance
+ *
+ * @param[in] did Data type
+ */
+static void VehicleSensDataDisrptMonitorProc(DID did) {
+ static BOOL is_rcv_sns_data = FALSE;
+
+ switch (did) {
+ case POSHAL_DID_GYRO_X:
+ case POSHAL_DID_GYRO_Y:
+ case POSHAL_DID_GYRO_Z:
+ case POSHAL_DID_GSNS_X:
+ case POSHAL_DID_GSNS_Y:
+ case POSHAL_DID_GSNS_Z:
+ case POSHAL_DID_SPEED_PULSE:
+ case POSHAL_DID_REV:
+ case POSHAL_DID_GPS_ANTENNA:
+ case POSHAL_DID_GYRO_EXT:
+ case POSHAL_DID_GYRO_TEMP:
+ case POSHAL_DID_PULSE_TIME:
+ case POSHAL_DID_SNS_COUNTER:
+ {
+ if (is_rcv_sns_data == FALSE) {
+ /* Initial sensor data reception monitoring timer */
+ VehicleUtilityStopTimer(SNS_FST_TIMER);
+ is_rcv_sns_data = TRUE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "is_rcv_sns_data=TRUE");
+ }
+
+ /* Cyclic sensor data reception monitoring timer stopped */
+ VehicleUtilityStopTimer(SNS_CYCLE_TIMER);
+ /* Cyclic sensor data reception monitoring timer setting */
+ VehicleUtilitySetTimer(SNS_CYCLE_TIMER);
+ /* Sensor data interruption log output timer */
+ VehicleUtilityStopTimer(SNS_DISRPT_TIMER);
+
+ break;
+ }
+ default:
+ {
+ /* nop */
+ }
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timeout message reception processing
+ *
+ * @param[in] rcv_msg Incoming message
+ */
+static void VehicleSensRcvMsgTout(TimerToutMsg* rcv_msg) {
+ uint8_t tim_kind = static_cast<uint8_t>(rcv_msg->TimerSeq >> 8);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+ ### TIMEOUT ### Seq=0x%04x", rcv_msg->TimerSeq);
+ switch (tim_kind) {
+ case SNS_FST_TIMER:
+ case SNS_CYCLE_TIMER:
+ case SNS_DISRPT_TIMER:
+ {
+ /* Sensor data interruption log output timer setting */
+ VehicleUtilityStopTimer(SNS_DISRPT_TIMER);
+ VehicleUtilitySetTimer(SNS_DISRPT_TIMER);
+ break;
+ }
+ default:
+ {
+ /* nop */
+ }
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return;
+}
+
+
+/**
+ * @brief
+ * Initialize Vehilce Speed Information
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can initialize the buffer of Vehicle Speed Information.
+ */
+static void VehilceSens_InitVehicleSpeed(void) {
+ (void)memset(&g_vehicle_speed_info, 0x00, sizeof(g_vehicle_speed_info));
+ return;
+}
+
+/**
+ * @brief
+ * Store Vehilce Speed Data
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can store Vehicle Speed Information for a cycle.
+ *
+ * @param[in] VEHICLESENS_VEHICLE_SPEED_DAT* pVehicleSpeed : Speed [m/s] and TimeSpec
+ */
+static void VehicleSens_StoreVehicleSpeed(VEHICLESENS_VEHICLE_SPEED_DAT* pVehicleSpeed) {
+ VEHICLESENS_VEHICLE_SPEED_INFO* pInfo = &g_vehicle_speed_info;
+
+
+// if (pInfo->sampleCount < VEHICLESENS_NMEA_PASCD_SAMPLECOUNT_MAX) {
+ if (pInfo->sampleCount == 0) {
+ (void)memcpy((pInfo->listSpd) + (pInfo->sampleCount), pVehicleSpeed, sizeof(VEHICLESENS_VEHICLE_SPEED_DAT));
+ pInfo->sampleCount++;
+
+ } else if (pInfo->sampleCount < VEHICLESENS_NMEA_PASCD_SAMPLECOUNT_MAX) {
+ (void)_pb_memcpy((pInfo->listSpd) + (pInfo->sampleCount), pVehicleSpeed, sizeof(VEHICLESENS_VEHICLE_SPEED_DAT));
+
+ VEHICLESENS_VEHICLE_SPEED_DAT* pS0 = &(pInfo->listSpd[0]);
+ VEHICLESENS_VEHICLE_SPEED_DAT* pS = &(pInfo->listSpd[pInfo->sampleCount]);
+ uint32_t ts_i; /* Interger Part of timestamp [s] */
+ if (pS->ts.tv_nsec - pS0->ts.tv_nsec >= 0) { // LCOV_EXCL_BR_LINE 200: can not less than zero
+ ts_i = (pS->ts.tv_sec - pS0->ts.tv_sec) % VEHICLESENS_NMEA_PASCD_TS_MAX;
+ } else {
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ts_i = (pS->ts.tv_sec - pS0->ts.tv_sec - 1) % VEHICLESENS_NMEA_PASCD_TS_MAX; // LCOV_EXCL_LINE 8: invalid
+ }
+ if (ts_i == 0) { /* Offset is 0 to 1 second */
+ pInfo->sampleCount++;
+ }
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "WARNING: Num of stored datas is over 50. (%ld.%ld spd = %d)",
+ pVehicleSpeed->ts.tv_sec, pVehicleSpeed->ts.tv_nsec, pVehicleSpeed->speed );
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Load Vehicle Speed Information (Vehicle Speed Data x 50(max))
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can load Vehicle Speed Informations from the last initialization.
+ *
+ * @param[in] VEHICLESENS_VEHICLE_SPEED_INFO* pVehicleSpeedInfo : Speeds [m/s] and TimeSpecs
+ */
+static void VehicleSens_LoadVehicleSpeed(VEHICLESENS_VEHICLE_SPEED_INFO* pVehicleSpeedInfo) {
+ (void)memcpy(pVehicleSpeedInfo, &g_vehicle_speed_info, sizeof(g_vehicle_speed_info));
+ return;
+}
+
+/**
+ * @brief
+ * Concatenate NMEA Sentence Fields with Delimiter
+ *
+ * @details This is for creating NMEA Sentence. <br>
+ * You can concatenate the two strings given as arguments 'str1' and 'str2'. <br>
+ * And at the time, it puts the delimiter between 'str1' and 'str2' automaticaly.
+ *
+ * @param[in] char* str1 : destination
+ * @param[in] const size_t size : buffer size of destination
+ * @param[in] const char* str2 : source
+ * @param[in] const size_t n : copy size of source
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static RET_API VehicleSens_CatNmeaSentenceFieldWithDelimiter(char* str1, const size_t size,
+ const char* str2, const size_t n) {
+ RET_API ret_api = RET_NORMAL;
+
+ size_t len1 = strlen(str1);
+ size_t len2 = strlen(str2);
+ size_t len3 = strlen(VEHICLESENS_NMEA_FIELDDELIMITER);
+ size_t sn = n;
+
+ if (sn > len2) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ sn = len2;
+ }
+
+ if (len1 + len3 + sn <= size - 1) {
+ (void)strncat(str1, VEHICLESENS_NMEA_FIELDDELIMITER, len3); /* Add Delimiter (,) */
+ (void)strncat(str1, str2, sn);
+ } else {
+ ret_api = RET_ERROR;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: Buffer size is too small to connatenate. len1:%d len2:%d len3:%d n:%d", len1, len2, len3, n);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Concatenate NMEA Sentence Fields without Delimiter
+ *
+ * @details This is for creating NMEA Sentence. <br>
+ * You can concatenate the two strings given as arguments 'str1' and 'str2'.
+ *
+ * @param[in] char* str1 : destination
+ * @param[in] const size_t size : buffer size of destination
+ * @param[in] const char* str2 : source
+ * @param[in] const size_t n : copy size of source
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static RET_API VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(char* str1, const size_t size,
+ const char* str2, const size_t n) {
+ RET_API ret_api = RET_NORMAL;
+
+ size_t len1 = strlen(str1);
+ size_t len2 = strlen(str2);
+ size_t sn = n;
+
+ if (sn > len2) { // LCOV_EXCL_BR_LINE 200: can not exceed size
+ sn = len2;
+ }
+
+ if (len1 + sn <= size - 1) {
+ (void)strncat(str1, str2, sn);
+ } else {
+ ret_api = RET_ERROR;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: Buffer size is too small to connatenate. len1:%d len2:%d n:%d", len1, len2, n);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate ID Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate ID Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldId(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_PASCD_ID, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate Timestamp Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate Timestamp Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldTimestamp(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ VEHICLESENS_VEHICLE_SPEED_INFO stVehicleSpeedInfo;
+
+ uint32_t ts_i; /* Interger Part of timestamp [s] */
+ uint32_t ts_f; /* Fractional Part of timestamp [ms] */
+ char ts_ci[32]; /* ts_i in charactor */
+ char ts_cf[32]; /* ts_f in charactor */
+
+ VehicleSens_LoadVehicleSpeed(&stVehicleSpeedInfo);
+
+
+#if 1 /* PASCD *//* Suppose that GPS NMEA data are updated 1 sec interval */
+ ts_i = gPseudoSecClockCounter; /* Synchronize: GPS NMEA */
+ ts_f = 0u;
+ gPseudoSecClockCounter += 1u; /* PASCD *//* Suppose that GPS NMEA data are updated 1 sec interval */
+ if (gPseudoSecClockCounter >= VEHICLESENS_NMEA_PASCD_TS_MAX) {
+ gPseudoSecClockCounter = 0u;
+ }
+#else /* PASCD *//* Suppose that GPS NMEA data are updated 1 sec interval */
+
+ ts_i = stVehicleSpeedInfo.listSpd[0].ts.tv_sec % VEHICLESENS_NMEA_PASCD_TS_MAX;
+ ts_f = stVehicleSpeedInfo.listSpd[0].ts.tv_nsec;
+
+#endif /* PASCD *//* Suppose that GPS NMEA data are updated 1 sec interval */
+
+ (void)snprintf(ts_ci, sizeof(ts_ci), "%d", ts_i);
+ (void)snprintf(ts_cf, sizeof(ts_cf), "%06d", ts_f);
+
+ /* Integer Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, ts_ci, VEHICLESENS_NMEA_PASCD_TS_INT_LEN_MAX);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ }
+
+ /* Decimal Point */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_DECIMALPOINT, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ }
+
+ /* Fractional Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size,
+ ts_cf, VEHICLESENS_NMEA_PASCD_TS_FRA_LEN_MAX);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate SensorType Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate SensorType Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldSensorType(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, VEHICLESENS_NMEA_PASCD_SENSORTYPE_C, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate TransmissionState Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate TransmissionState Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldTransmissionState(char* pascd, size_t size) {
+ RET_API ret_api = RET_NORMAL;
+ EFrameworkunifiedStatus eStatus;
+
+ uint8_t ucType; /* type of transmission */
+ uint8_t ucShift;
+
+#if 1 /* For Plus _CWORD27_ Gear Data Support 180115 */
+ uint8_t ucPkb; /* state of parking brake */
+#endif /* For Plus _CWORD27_ Gear Data Support 180115 */
+
+ BOOL bIsAvailable;
+
+ /* Get Type of Transmission */
+
+// eStatus = VehicleIf_GetTypeOfTransmission(&ucType, &bIsAvailable);
+ eStatus = VehicleIf_GetTypeOfTransmission(&ucType, &ucPkb, &bIsAvailable);
+ if ((bIsAvailable != true) || (eStatus != eFrameworkunifiedStatusOK)) {
+ if (bIsAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleIf_GetTypeOfTransmission:%d", eStatus);
+ }
+ ret_api = RET_ERROR;
+ }
+
+ if (ret_api != RET_ERROR) {
+ /* Get Shift Position */
+ eStatus = VehicleIf_GetShiftPosition(&ucShift, &bIsAvailable);
+ if ((bIsAvailable != true) || (eStatus != eFrameworkunifiedStatusOK)) {
+ if (bIsAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleIf_GetShiftPosition:%d", eStatus);
+ }
+ ret_api = RET_ERROR;
+ }
+ }
+
+ if (ret_api != RET_ERROR) {
+ VEHICLESENS_TRANSMISSION_PKG tsmPkg;
+
+ tsmPkg.type = ucType;
+ tsmPkg.shift = ucShift;
+
+#if 1 /* For Plus _CWORD27_ Gear Data Support 180115 */
+ tsmPkg.pkb = ucPkb;
+#endif /* For Plus _CWORD27_ Gear Data Support 180115 */
+
+
+ ret_api = VehicleSens_DeriveTransmissionStateFor_CWORD27_(&tsmPkg);
+ if (ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSensDeriveTransmissionStateFor_CWORD27_:%d", ret_api);
+ } else {
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, tsmPkg.state, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate SlipDetect Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate SlipDetect Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldSlipDetect(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, VEHICLESNES_NMEA_PASCD_NOSLIP, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate SampleCount Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate SampleCount Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldSampleCount(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ VEHICLESENS_VEHICLE_SPEED_INFO stVehicleSpeedInfo;
+ char cSampleCount[32];
+
+ VehicleSens_LoadVehicleSpeed(&stVehicleSpeedInfo);
+ (void)snprintf(cSampleCount, sizeof(cSampleCount), "%d", stVehicleSpeedInfo.sampleCount);
+
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, cSampleCount, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate TimeOffset and Speed Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate TimeOffset and Speed Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldTimeOffsetNSpeed(char* pascd, size_t size) {
+ RET_API ret_api = RET_ERROR;
+
+ VEHICLESENS_VEHICLE_SPEED_INFO stVehicleSpeedInfo;
+ VEHICLESENS_VEHICLE_SPEED_DAT *pS0 = &(stVehicleSpeedInfo.listSpd[0]);
+
+ int32_t i;
+
+ VehicleSens_LoadVehicleSpeed(&stVehicleSpeedInfo);
+
+ for (i = 0; i < stVehicleSpeedInfo.sampleCount; i++) {
+ VEHICLESENS_VEHICLE_SPEED_DAT *pS = &(stVehicleSpeedInfo.listSpd[i]);
+
+ /* timeoffset */
+ uint32_t ts_i; /* Interger Part of timestamp [s] */
+ uint32_t ts_f; /* Fractional Part of timestamp [us] */
+ char ts_ci[32]; /* ts_i in charactor */
+ char ts_cf[32]; /* ts_f in charactor */
+
+ if (pS->ts.tv_nsec - pS0->ts.tv_nsec >= 0) { // LCOV_EXCL_BR_LINE 200: can not less than zero
+ ts_i = (pS->ts.tv_sec - pS0->ts.tv_sec) % VEHICLESENS_NMEA_PASCD_TS_MAX;
+ ts_f = (pS->ts.tv_nsec - pS0->ts.tv_nsec) / 1000; /* [ns] -> [us] */
+ } else {
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ts_i = (pS->ts.tv_sec - pS0->ts.tv_sec - 1) % VEHICLESENS_NMEA_PASCD_TS_MAX;
+ ts_f = (1000000000 + pS->ts.tv_nsec - pS0->ts.tv_nsec) / 1000; /* [ns] -> [us] */
+ // LCOV_EXCL_STOP
+ }
+
+ (void)snprintf(ts_ci, sizeof(ts_ci), "%d", ts_i);
+ (void)snprintf(ts_cf, sizeof(ts_cf), "%06d", ts_f);
+
+ /* Integer Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, ts_ci, size);
+ if (ret_api == RET_ERROR) { // LCOV_EXCL_BR_LINE 200: can not exceed buffer size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Decimal Point */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_DECIMALPOINT, size);
+ if (ret_api == RET_ERROR) { // LCOV_EXCL_BR_LINE 200: can not exceed buffer size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Fractional Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size,
+ ts_cf, VEHICLESENS_NMEA_PASCD_TO_FRA_LEN_MAX);
+ if (ret_api == RET_ERROR) { // LCOV_EXCL_BR_LINE 200: can not exceed buffer size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ /* speed */
+ uint16_t spd_i; /* Interger Part of speed [m/s] */
+ uint16_t spd_f; /* Fractional Part of speed [mm/s] */
+ char spd_ci[32]; /* spd_i in charactor */
+ char spd_cf[32]; /* spd_f in charactor */
+
+ spd_i = pS->speed / 100; /* [0.01m/s] -> [m/s] */
+ spd_f = (pS->speed % 100) * 10; /* [0.01m/s] -> [mm/s] */
+
+ (void)snprintf(spd_ci, sizeof(spd_ci), "%d", spd_i);
+ (void)snprintf(spd_cf, sizeof(spd_cf), "%03d", spd_f);
+
+ /* Integer Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithDelimiter(pascd, size, spd_ci, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ break;
+ }
+
+ /* Decimal Point */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_DECIMALPOINT, size);
+ if (ret_api == RET_ERROR) { // LCOV_EXCL_BR_LINE 200: can not exceed buffer size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ break;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Fractional Part */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size,
+ spd_cf, VEHICLESENS_NMEA_PASCD_SPD_FRA_LEN_MAX);
+ if (ret_api == RET_ERROR) { // LCOV_EXCL_BR_LINE 200: can not exceed buffer size
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ break;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate Checksum Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate Checksum Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldChecksum(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ size_t length;
+ uint8_t chk = 0;
+ char cChk[3];
+ uint16_t i = 0;
+
+ length = strnlen(pascd, size);
+
+ /* Calculate Checksum (start with the 2th Bype except '$') */
+ for (i = 1; i < length; i++) {
+ chk ^= pascd[i];
+ }
+ (void)snprintf(cChk, sizeof(cChk), "%02X", chk);
+
+ /* Set Astarisk before Checksum */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_ASTARISK, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithoutDelimiter:%d", ret_api);
+ }
+
+ /* Set Checksum */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, cChk, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Generate CR & LF Field of PASCD Sentence
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can generate CRLF Field of PASCD Sentence and <br>
+ * concatenate it with the string given as argument 'pascd'. <br>
+ * It should be called in the specific order.
+ *
+ * @param[in/out] char* pascd : buffer pointer for PASCD Sentence
+ * @param[in] size_t size : buffer size
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static inline RET_API VehicleSens_GeneratePASCDFieldCRLF(char* pascd, size_t size) {
+ RET_API ret_api;
+
+ /* Set Carriage Return */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_CR, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ /* Set Line Feed */
+ ret_api = VehicleSens_CatNmeaSentenceFieldWithoutDelimiter(pascd, size, VEHICLESENS_NMEA_LF, size);
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: VehicleSens_CatNmeaSentenceFieldWithDelimiter:%d", ret_api);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Derive Transmission State For _CWORD27_
+ *
+ * @details This is for creating PASCD Sentence of NMEA. <br>
+ * You can derive transmissionState from the transmission type and <br>
+ * the shift positiong from Vehicle Service.
+ *
+ * @param[in/out] VEHICLESENS_TRANSMISSION_PKG* pPkg : source data set for Transmission State
+ *
+ * @return RET_NORMAL : success
+ * @return RET_ERROR : failed
+ */
+static RET_API VehicleSens_DeriveTransmissionStateFor_CWORD27_(VEHICLESENS_TRANSMISSION_PKG* pPkg) {
+ RET_API ret_api = RET_NORMAL;
+ uint32_t i;
+
+ static const VEHICLESENS_TRANSMISSION_PKG TmsLut[VEHICLEIF_TRANSMISSION_TYPE_NUM * VEHICLEIF_SHIFT_POSITION_NUM] = {
+
+// /* Transmission Type : MT */
+// { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_U, VEHICLESENS_NMEA_PASCD_TMS_D },
+// { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_R, VEHICLESENS_NMEA_PASCD_TMS_R },
+// { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_P, VEHICLESENS_NMEA_PASCD_TMS_D },
+// { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_N, VEHICLESENS_NMEA_PASCD_TMS_D },
+// { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_D, VEHICLESENS_NMEA_PASCD_TMS_D },
+// /* Tranmission Type : AT */
+// { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_U, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_R, VEHICLESENS_NMEA_PASCD_TMS_R },
+// { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_P, VEHICLESENS_NMEA_PASCD_TMS_P },
+// { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_N, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_D, VEHICLESENS_NMEA_PASCD_TMS_D },
+// /* Transmission Type : UNKNOWN */
+// { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_U, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_R, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_P, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_N, VEHICLESENS_NMEA_PASCD_TMS_U },
+// { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_D, VEHICLESENS_NMEA_PASCD_TMS_U },
+ /* Transmission Type : MT */
+ { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_U, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_R, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_R },
+ { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_P, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_N, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_MT, VEHICLEIF_SHIFT_POSITION_D, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ /* Tranmission Type : AT */
+#if 1 /* For Plus _CWORD27_ Gear Data Support 180115 */
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_U, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+#else /* For Plus _CWORD27_ Gear Data Support 180115 */
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_U, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+#endif /* For Plus _CWORD27_ Gear Data Support 180115 */
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_R, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_R },
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_P, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_P },
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_N, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_N }, /* However, the Vehicle does not notify you by Phase3. */
+ { VEHICLEIF_TRANSMISSION_TYPE_AT, VEHICLEIF_SHIFT_POSITION_D, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ /* Transmission Type : UNKNOWN */
+#if 1 /* For Plus _CWORD27_ Gear Data Support 180115 */
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_U, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_R, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_P, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_N, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_D, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_U },
+#else /* For Plus _CWORD27_ Gear Data Support 180115 */
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_U, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_R, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_P, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_N, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+ { VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN, VEHICLEIF_SHIFT_POSITION_D, VEHICLEIF_PKB_UNKNOWN, VEHICLESENS_NMEA_PASCD_TMS_D },
+#endif /* For Plus _CWORD27_ Gear Data Support 180115 */
+
+ };
+
+ for (i = 0; i < VEHICLEIF_TRANSMISSION_TYPE_NUM * VEHICLEIF_SHIFT_POSITION_NUM; i++) {
+ if ((pPkg->type == TmsLut[i].type) && (pPkg->shift == TmsLut[i].shift)) {
+ strncpy(pPkg->state, TmsLut[i].state, sizeof(pPkg->state));
+ break;
+ }
+ }
+
+
+#if 1 /* For Plus _CWORD27_ Gear Data Support 180115 */
+ if ((pPkg->type == VEHICLEIF_TRANSMISSION_TYPE_MT) && (pPkg->pkb == VEHICLEIF_PKB_ON)) {
+ strncpy(pPkg->state, VEHICLESENS_NMEA_PASCD_TMS_P, sizeof(VEHICLESENS_NMEA_PASCD_TMS_P));
+ }
+#endif /* For Plus _CWORD27_ Gear Data Support 180115 */
+
+
+ if (i == VEHICLEIF_TRANSMISSION_TYPE_NUM * VEHICLEIF_SHIFT_POSITION_NUM) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FORBIDDEN ERROR: Can't find Transmission State. type:%d shift:%d", pPkg->type, pPkg->shift);
+ ret_api = RET_ERROR;
+ }
+
+ return ret_api;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleUtility.cpp b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleUtility.cpp
new file mode 100755
index 0000000..0201326
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/Sensor/VehicleUtility.cpp
@@ -0,0 +1,455 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/***************************************************************************
+@file VehicleUtility.cpp
+@detail Common processing function of Vehicle
+*****************************************************************************/
+
+#include "VehicleUtility.h"
+#include <vehicle_service/positioning_base_library.h>
+
+#include "gps_hal.h"
+#include "positioning_common.h"
+
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/** Timer management table */
+static VEHICLEUTILITY_TIM_MNG g_st_tim_mng;
+
+/** Timer setting information table */
+static const VEHICLEUTILITY_TIM_INFO g_tim_info[TIM_NUM] = {
+ /* GSP-related */
+ {TIMVAL_GPS_STARTUP, PNO_NAVI_GPS_MAIN}, /* Start confirmation monitoring timer */
+ {TIMVAL_GPS_RCVCYCLDAT, PNO_NAVI_GPS_MAIN}, /* Periodic reception data monitoring timer */
+ {TIMVAL_GPS_RCVACK, PNO_NAVI_GPS_MAIN}, /* ACK reception monitoring timer */
+ {TIMVAL_GPS_NAVIFST, PNO_NAVI_GPS_MAIN}, /* Initial Navigation Monitoring Timer */
+ {TIMVAL_GPS_NAVICYCLE, PNO_NAVI_GPS_MAIN}, /* Navi monitoring timer */
+ {TIMVAL_GPS_NAVIDISRPT, PNO_NAVI_GPS_MAIN}, /* Navigation Monitoring Disruption Log Output Timer */
+ {TIMVAL_GPS_DIAGCLKGUARD, PNO_NAVI_GPS_MAIN}, /* Diag provision time guard monitoring timer */
+ {TIMVAL_GPS_NMEADATAGUARD, PNO_NAVI_GPS_MAIN}, /* NMEA data-providing guard monitoring timer */
+ {TIMVAL_GPS_RECOVERY, PNO_NAVI_GPS_MAIN}, /* GPS recovery timer */
+ {TIMVAL_GPS_RECEIVERERR, PNO_NAVI_GPS_MAIN}, /* GPS receiver anomaly detection timer */
+ /* Sensor Related Extensions */
+ {TIMVAL_SNS_RCVFSTDAT, PNO_VEHICLE_SENSOR}, /* Initial cyclic sensor data reception monitoring timer */
+ {TIMVAL_SNS_RCVCYCLDAT, PNO_VEHICLE_SENSOR}, /* Cyclic sensor data reception monitoring timer */
+ {TIMVAL_SNS_RCVDISRPT, PNO_VEHICLE_SENSOR}, /* Cyclic sensor data interruption log output timer */
+};
+
+/*---------------------------------------------------------------------------------*
+ * Prototype *
+ *---------------------------------------------------------------------------------*/
+static uint16_t VehicleUtilityTimeMakSeqNo(VEHICLEUTILITY_TIM_KIND tim_kind);
+
+/***************************************************************************
+@brief send message function for Vehicle domain.
+@outline send message function with put error diag function if error occurred.
+@type Completion return type
+@param[in] PNO pno : PNO
+@param[in] u_int16 size : size of message data
+@param[in] void* msgbuf : message data
+@param[in] u_int16 mode : mode
+@threshold
+@return RET_API
+@retval RET_NORMAL : Normal end
+@retval RET_ERROR : Abnormal end
+*****************************************************************************/
+RET_API VehicleUtilitySndMsg(PNO pno, u_int16 size, void *msgbuf, u_int16 mode) {
+ RET_API ret_api;
+ if (msgbuf != NULL) { // LCOV_EXCL_BR_LINE 6: msgbuf cannot be null
+ ret_api = _pb_SndMsg(pno, size, msgbuf, mode);
+ /* RET_ERROR: Execute _pb_Exit() after dialog registration */
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg ERROR [ret_api:%d]", ret_api);
+ }
+ } else {
+ ret_api = RET_ERRPARAM;
+ }
+
+ return ret_api;
+}
+
+/***************************************************************************
+@brief send message function for Vehicle domain.
+@outline receive message function with put error diag function if error occurred.
+@type Completion return type
+@param[in] PNO pno : PNO
+@param[in] u_int16 size : size of message data
+@param[in] void* msgbuf : message data
+@param[in] u_int16 mode : mode
+@threshold
+@return RET_API
+@retval RET_NORMAL : Normal end
+@retval RET_ERROR : Abnormal end
+*****************************************************************************/
+RET_API VehicleUtilityRcvMsg(PNO pno, u_int16 size, void **msgbuf, u_int16 mode)
+{
+ RET_API ret_api;
+
+ if (msgbuf != NULL) { // LCOV_EXCL_BR_LINE 6: msgbuf cannot be null
+ ret_api = _pb_RcvMsg(pno, size, msgbuf, mode);
+ /* For RET_ERROR Sys_Exit() after dialog registration */
+ if (ret_api == RET_ERROR) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_RcvMsg ERROR [ret_api:%d]", ret_api);
+ }
+ } else {
+ ret_api = RET_ERRPARAM;
+ }
+
+ return ret_api;
+}
+
+/***************************************************************************
+@brief Diagcode submit for Vehicle domain.
+@outline submit the DiagCode for Vehicle domain.
+@type Completion return type
+@param[in] u_int32 err_id : Diag Code
+@param[in] u_int16 positioning_code : Positioning Code
+@param[in] void* msgbuf : message data
+@return void
+*****************************************************************************/
+void VehicleUtilityDiagCodePut(u_int32 err_id, u_int16 positioning_code) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Timer function initialization processing
+ *
+ */
+void VehicleUtilityInitTimer(void) {
+ VEHICLEUTILITY_TIM_MNG *pst_tim_mng;
+ u_int32 i;
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ /* Initialize timer management table */
+ memset(pst_tim_mng, 0x00, sizeof(VEHICLEUTILITY_TIM_MNG));
+
+ for (i = 0; i < TIM_NUM; i++) {
+ pst_tim_mng->sts[i].flag = TIMER_OFF;
+ pst_tim_mng->sts[i].cnt = 0;
+ }
+}
+
+/**
+ * @brief
+ * Timer start processing<br>
+ *
+ * Starts a timer of the specified type<br>
+ * 1.Increment total number of timer start<br>
+ * 2.Timer Sequence Number Creation<br>
+ * 3.Get timeout value<br>
+ * 4.Timer start<br>
+ *
+ * @param[in] Tim_kind Timer type
+ *
+ * @return TRUE Normal completion<br>
+ * FALSE abend<br>
+ */
+BOOL VehicleUtilitySetTimer(VEHICLEUTILITY_TIM_KIND tim_kind) {
+ VEHICLEUTILITY_TIM_MNG *pst_tim_mng;
+ const uint32_t *p_time_val;
+ const PNO *p_pno;
+ RET_API api_ret; /* Timer API return value */
+ u_int16 seq_no;
+ BOOL ret = TRUE;
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ p_time_val = &(g_tim_info[tim_kind].timer_val); /* Timer set value */
+ p_pno = &(g_tim_info[tim_kind].pno); /* Notify party PNO */
+
+ if (pst_tim_mng->sts[tim_kind].flag == TIMER_ON) {
+ /*-----------------------------------------------------------------------*/
+ /* When the same timer has already started */
+ /* Terminate without starting the timer because the timer is set multiple times. */
+ /*-----------------------------------------------------------------------*/
+ ret = FALSE;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* Count up the timer counter of the corresponding timer by 1. */
+ /*-----------------------------------------------------------------------*/
+ if (pst_tim_mng->sts[tim_kind].cnt >= TIM_CNTMAX) {
+ /*-----------------------------------------------------------------------*/
+ /* When the count reaches the maximum number,Count again from 1 */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].cnt = TIM_CNTMIN;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* If the count has not reached the maximum,Count up */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].cnt++;
+ }
+
+ /*-----------------------------------------------------------------------*/
+ /* Creating Timer Sequence Numbers */
+ /*-----------------------------------------------------------------------*/
+ seq_no = VehicleUtilityTimeMakSeqNo(tim_kind);
+
+ /*-----------------------------------------------------------------------*/
+ /* Start the timer */
+ /*-----------------------------------------------------------------------*/
+ api_ret = _pb_ReqTimerStart(*p_pno, seq_no, TIMER_TYPE_USN, (u_int32)*p_time_val);
+ if (api_ret != RET_NORMAL) {
+ ret = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "_pb_ReqTimerStart ERROR!! [api_ret=%d]", api_ret);
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* Successful timer start */
+ /* Set the start/stop flag of the corresponding timer to start (MCSUB_ON) */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].flag = TIMER_ON;
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Timer stop processing<br>
+ *
+ * Stops a timer of the specified type<br>
+ * 1.Get the sequence number of the specified type<br>
+ * 2.Timer stop<br>
+ *
+ * @param[in] Tim_kind Timer type
+ * @param[in] pno Process number
+ *
+ * @return TRUE Normal completion<br>
+ * FALSE abend<br>
+ */
+BOOL VehicleUtilityStopTimer(VEHICLEUTILITY_TIM_KIND tim_kind) {
+ VEHICLEUTILITY_TIM_MNG *pst_tim_mng;
+ const PNO *p_pno;
+ BOOL ret = TRUE;
+ RET_API api_ret;
+ u_int16 seq_no;
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ p_pno = &(g_tim_info[tim_kind].pno); /* Notify party PNO */
+
+ /* Check timer start/stop flag */
+ if (pst_tim_mng->sts[tim_kind].flag == TIMER_OFF) {
+ /* If it is already stopped, do nothing. */
+ ret = FALSE;
+ } else {
+ /*-----------------------------------------------------------------------*/
+ /* Creating Timer Sequence Numbers */
+ /*-----------------------------------------------------------------------*/
+ seq_no = VehicleUtilityTimeMakSeqNo(tim_kind);
+
+ /*-----------------------------------------------------------------------*/
+ /* Set the corresponding timer to stop */
+ /*-----------------------------------------------------------------------*/
+ api_ret = _pb_TimerStop(*p_pno, seq_no, TIMER_TYPE_USN);
+ if (api_ret != RET_NORMAL) {
+ ret = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_TimerStop ERROR!! [api_ret=%d]", api_ret);
+ }
+
+ /*-----------------------------------------------------------------------*/
+ /* Set the start/stop flag of the corresponding timer to stop (MCSUB_OFF) */
+ /* Set the ID of the corresponding timer to invalid (DEV_TED_INVALID) */
+ /*-----------------------------------------------------------------------*/
+ pst_tim_mng->sts[tim_kind].flag = TIMER_OFF;
+ }
+ return ret;
+}
+
+/**
+ * @brief
+ * Timer Sequence Number Determination<br>
+ *
+ * Determine whether the timer sequence number corresponds to the one being managed
+ *
+ * @param[in] seqno Timer Sequence Number
+ *
+ * @return TRUE Normal completion(No problem)<br>
+ * FALSE abend(Unusual number)<br>
+ */
+BOOL VehicleUtilityTimeJdgKnd(uint16_t seqno) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLEUTILITY_TIM_MNG *pst_tim_mng;
+ BOOL ret;
+ u_int8 timekind;
+ u_int8 count;
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ timekind = (u_int8)((seqno & 0xff00) >> 8);
+ count = (u_int8)(seqno & 0x00ff);
+
+ /* Timer type is unexpected */
+ if (timekind >= TIM_NUM) {
+ ret = FALSE;
+ } else {
+ if ((pst_tim_mng->sts[timekind].cnt == count) &&
+ (pst_tim_mng->sts[timekind].flag == TIMER_ON)) {
+ /* The counter matches and the counter start/stop flag is "Start". */
+ ret = TRUE;
+ } else {
+ /* Not applicable due to differences */
+ ret = FALSE;
+ }
+ }
+
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Timer Sequence Number Creation<br>
+ *
+ * Creating a Sequence Number for a Timer<br>
+ * 1. The upper 1 byte is the timer type.,So that the lower 1 times is the total number of timer starts
+ * Create a sequence number.
+ *
+ * @param[in] Tim_kind Timer type
+ *
+ * @return Timer Sequence Number
+ */
+static uint16_t VehicleUtilityTimeMakSeqNo(VEHICLEUTILITY_TIM_KIND tim_kind) {
+ VEHICLEUTILITY_TIM_MNG *pst_tim_mng;
+ u_int16 seq_no; /* Timer Sequence Number */
+
+ pst_tim_mng = &g_st_tim_mng;
+
+ /*------------------------------------------------------------------------*/
+ /* Definition of Sequence Number */
+ /* |------------------- Sequence number(2Byte) -----------------------| */
+ /* 15 8 7 0 */
+ /* +-------------------------------+-----------------------------------+ */
+ /* | Timer type(1Byte) | Counter(1Byte)(0x01 ? 0xFF) | */
+ /* +-------------------------------+-----------------------------------+ */
+ /* For the timer type,0x00 ? (Number of timers-1) */
+ /* For counters,0x01 ? 0xFF(Do not use 0x00.) */
+ /* (Counters are counted up each time a timer is started. */
+ /* Count up when counter is 0xFF, */
+ /* Be counted up from the 0x01) */
+ /*------------------------------------------------------------------------*/
+ seq_no = static_cast<u_int16>(((u_int16)tim_kind << 8) | (pst_tim_mng->sts[tim_kind].cnt));
+
+ return seq_no;
+}
+
+/**
+ * @brief
+ * External pin status request
+ */
+void LineSensDrvExtTermStsReq(void) {
+ T_APIMSG_MSGBUF_HEADER st_snd_msg;
+ RET_API lret;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ memset(&st_snd_msg, 0x00, sizeof(st_snd_msg));
+
+ st_snd_msg.hdr.sndpno = PNO_LINE_SENS_DRV;
+ st_snd_msg.hdr.respno = 0x0000;
+ st_snd_msg.hdr.cid = CID_EXTTERM_REQ;
+ st_snd_msg.hdr.msgbodysize = 0x00; /* No data */
+ st_snd_msg.hdr.rid = 0x00;
+
+ /* Messaging */
+ lret = _pb_SndMsg(PNO_LINE_SENS_DRV, sizeof(T_APIMSG_MSGBUF_HEADER), &st_snd_msg, 0);
+ if (lret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg ERROR!! lret=%d", lret);
+ lret = RET_ERROR;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return;
+}
+
+
+/**
+ * @brief
+ * Backup data read request send processing<BR>
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABENDs
+ */
+RET_API DEVGpsSndBackupDataLoadReq(void) {
+ RET_API lret;
+ T_APIMSG_MSGBUF_HEADER st_snd_msg;
+
+ /** Create GPS Data Notification Message */
+ (void)memset(&st_snd_msg, 0x00, sizeof(st_snd_msg)); /* QAC 3200 */
+ /** Message header */
+ st_snd_msg.hdr.sndpno = 0x0000;
+ st_snd_msg.hdr.respno = 0x0000;
+ st_snd_msg.hdr.cid = CID_GPS_BACKUPDATA_LOAD;
+ st_snd_msg.hdr.msgbodysize = 0x00;
+ st_snd_msg.hdr.rid = 0x00;
+
+ /* Messaging */
+ lret = _pb_SndMsg(PNO_NAVI_GPS_MAIN, sizeof(st_snd_msg), &st_snd_msg, 0);
+ if (lret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg ERROR!! [lret=%d]", lret);
+ lret = RET_ERROR;
+ }
+
+ return(lret);
+}
+
+/**
+ * @brief
+ * Acquisition of GPS-format error count information (dump)
+ *
+ * @param[out] p_buf Dump information
+ */
+void DEVGpsGetDebugGpsFormatFailCnt(void* p_buf) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (p_buf != NULL) {
+ snprintf(reinterpret_cast<char *>(p_buf), \
+ 512, "GPS Format Fail Count is not supported.\n"); // NOLINT(readability/nolint)
+ }
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Initial sensor data reception flag acquisition
+ */
+u_int8 LineSensDrvGetSysRecvFlag(void) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get GPS Rollover Standard Week Number
+ *
+ * @return GPS rollover base week number
+ */
+uint16_t DEVGpsGetWknRollover(void) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/* end of file */
diff --git a/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/BackupMgrIf.cpp b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/BackupMgrIf.cpp
new file mode 100755
index 0000000..da5dba2
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/BackupMgrIf.cpp
@@ -0,0 +1,211 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * BackupMgrIf.cpp
+ * @brief
+ * BackupMgr service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "BackupMgrIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+
+// static BOOL g_backup_mgr_availability = FALSE;
+BOOL g_backup_mgr_availability = FALSE;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+
+/**
+ * @brief
+ * BackupMgr Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus BackupMgrIfNotifyOnBackupMgrAvailability(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ /* NS_BackupMgr/Availability Changing notification registration */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_BackupMgr_Availability, (CbFuncPtr)fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * BackupMgr Services IF-Availability Settings
+ *
+ * @param[in] b_is_available Available state
+ * @return none
+ */
+void BackupMgrIfSetAvailability(BOOL b_is_available) {
+ g_backup_mgr_availability = b_is_available;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, \
+ "g_backup_mgr_availability=%d", g_backup_mgr_availability);
+
+ return;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @brief
+ * BackupMgr Services IF-Availability Acquisition
+ *
+ * @param[in] none
+ * @return gb_BackupMgrAvailability
+ */
+
+BOOL BackupMgrIf_GetAvailability(void)
+{
+ return g_backup_mgr_availability;
+}
+#ifdef __cplusplus
+}
+#endif
+
+/**
+ * @brief
+ * Import BackupMgr Services IFs
+ *
+ * @param[in] tag_id
+ * @param[in] ui_offset
+ * @param[in] *pv_buf
+ * @param[in] ui_size
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus BackupMgrIfBackupDataRd(PCSTR tag_id, uint32_t ui_offset, void *pv_buf, \
+ uint32_t ui_size, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ int32_t lret;
+
+ if (BackupMgrIf_GetAvailability() == TRUE) {
+ lret = Backup_DataRd(tag_id, ui_offset, pv_buf, ui_size);
+ if (lret == BKUP_RET_NORMAL) {
+ /* 8Byte fixed outputs */
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, \
+ "Backup_DataRd Done [tag_id=%s, pv_buf(Hex):%02x %02x %02x %02x %02x %02x %02x %02x, offset=%d, size=%d]",
+ tag_id,
+ *(reinterpret_cast<int8_t*>(pv_buf)),
+ *((reinterpret_cast<int8_t*>(pv_buf))+1),
+ *((reinterpret_cast<int8_t*>(pv_buf))+2),
+ *((reinterpret_cast<int8_t*>(pv_buf))+3),
+ *((reinterpret_cast<int8_t*>(pv_buf))+4),
+ *((reinterpret_cast<int8_t*>(pv_buf))+5),
+ *((reinterpret_cast<int8_t*>(pv_buf))+6),
+ *((reinterpret_cast<int8_t*>(pv_buf))+7),
+ ui_offset, ui_size);
+
+ estatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "Backup_DataRd ERROR!! [lret=%d, tag_id=%s, ui_offset=%d, pv_buf=%p, ui_size=%d]", \
+ lret, tag_id, ui_offset, pv_buf, ui_size);
+ }
+ } else {
+ /* nop */
+ }
+
+ *pb_is_available = BackupMgrIf_GetAvailability();
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * BackupMgr Services IF Write
+ *
+ * @param[in] tag_id
+ * @param[in] *pv_buf
+ * @param[in] ui_offset
+ * @param[in] ui_size
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus BackupMgrIfBackupDataWt(PCSTR tag_id, void *pv_buf, uint32_t ui_offset, \
+ uint32_t ui_size, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ int32_t lret;
+
+ if (BackupMgrIf_GetAvailability() == TRUE) {
+ lret = Backup_DataWt(tag_id, pv_buf, ui_offset, ui_size);
+ if (lret == BKUP_RET_NORMAL) {
+ /* 8Byte fixed outputs */
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__,
+ "Backup_DataWt Done [tag_id=%s, pv_buf(Hex):%02x %02x %02x %02x %02x %02x %02x %02x, offset=%d, size=%d]",
+ tag_id,
+ *(reinterpret_cast<int8_t*>(pv_buf)),
+ *((reinterpret_cast<int8_t*>(pv_buf))+1),
+ *((reinterpret_cast<int8_t*>(pv_buf))+2),
+ *((reinterpret_cast<int8_t*>(pv_buf))+3),
+ *((reinterpret_cast<int8_t*>(pv_buf))+4),
+ *((reinterpret_cast<int8_t*>(pv_buf))+5),
+ *((reinterpret_cast<int8_t*>(pv_buf))+6),
+ *((reinterpret_cast<int8_t*>(pv_buf))+7),
+ ui_offset, ui_size);
+
+ estatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "Backup_DataWt ERROR!! [lret=%d, tag_id=%s, pv_buf=%p, ui_offset=%d, ui_size=%d]", \
+ lret, tag_id, pv_buf, ui_offset, ui_size);
+ }
+ } else {
+ /* nop */
+ }
+
+ *pb_is_available = BackupMgrIf_GetAvailability();
+
+ return estatus;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/ClockIf.cpp b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/ClockIf.cpp
new file mode 100755
index 0000000..52fd4cf
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/ClockIf.cpp
@@ -0,0 +1,138 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * ClockIf.cpp
+ * @brief
+ * Clock service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "ClockIf.h"
+#include <stub/clock_notifications.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static BOOL g_clock_availability = FALSE;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Clock Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus ClockIfNotifyOnClockAvailability(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ /* Clock/Availability Changing notification registration */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_Clock_Availability, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Clock Services IF-Availability Settings
+ *
+ * @param[in] b_is_available Available state
+ * @return none
+ */
+void ClockIfSetAvailability(BOOL b_is_available) {
+ g_clock_availability = b_is_available;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "g_clock_availability=%d", g_clock_availability);
+
+ return;
+}
+
+/**
+ * @brief
+ * Clock Services IF GPS Time
+ *
+ * @param[in] *gps_time GPS time
+ * @param[out] *b_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus ClockIfDtimeSetGpsTime(const SENSOR_MSG_GPSTIME *pst_gps_time, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+ T_DTIME_MSG_GPSTIME st_dtime_gpstime;
+
+ if (g_clock_availability == TRUE) {
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ st_dtime_gpstime.utc.year = pst_gps_time->utc.year;
+ st_dtime_gpstime.utc.month = pst_gps_time->utc.month;
+ st_dtime_gpstime.utc.date = pst_gps_time->utc.date;
+ st_dtime_gpstime.utc.hour = pst_gps_time->utc.hour;
+ st_dtime_gpstime.utc.minute = pst_gps_time->utc.minute;
+ st_dtime_gpstime.utc.second = pst_gps_time->utc.second;
+ st_dtime_gpstime.tdsts = pst_gps_time->tdsts;
+
+ /* Set GPS time for Clock services */
+ estatus = DTime_setGpsTime(happ, &st_dtime_gpstime);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "DTime_setGpsTime ERROR!! [ret=%d, y=%d, m=%d, d=%d, h=%d, n=%d, s=%d, sts=%d]", \
+ estatus, st_dtime_gpstime.utc.year, st_dtime_gpstime.utc.month, st_dtime_gpstime.utc.date, \
+ st_dtime_gpstime.utc.hour, st_dtime_gpstime.utc.minute, st_dtime_gpstime.utc.second, \
+ st_dtime_gpstime.tdsts);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+ } else {
+ /* nop */
+ }
+
+ *pb_is_available = g_clock_availability;
+
+ return estatus;
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/CommUsbIf.cpp b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/CommUsbIf.cpp
new file mode 100755
index 0000000..b776ff0
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/CommUsbIf.cpp
@@ -0,0 +1,147 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * CommUsbIf.cpp
+ * @brief
+ * CommUSB service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "CommUsbIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static BOOL g_comm_usb_availability = FALSE;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Registering CommUSB Services IF Callback Functions
+ *
+ * @param[in] *p_msg_handler Callback function table
+ * @param[in] Ui_handler_count Number of callback functions
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus CommUsbIfAttachCallbacksToDispatcher( // NOLINT(readability/nolint)
+ _FrameworkunifiedProtocolCallbackHandler const* p_msg_handler,
+ unsigned int ui_handler_count) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ estatus = FrameworkunifiedAttachCallbacksToDispatcher(happ, "NS_ANY_SRC", p_msg_handler, ui_handler_count);
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Remove CommUSB Services IF Callback Functions
+ *
+ * @param[in] *p_msg_handler CID table
+ * @param[in] ui_handler_count Number of CIDs
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus CommUsbIfDetachCallbacksFromDispatcher(const PUI_32 pui_cmd_array, UI_32 ui_command_count) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ estatus = FrameworkunifiedDetachCallbacksFromDispatcher(happ, "NS_ANY_SRC", pui_cmd_array, ui_command_count, NULL);
+ /* In the event of failure */
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "PositioningDetachCallbacksToDispatcher Failed in FrameworkunifiedOnStop [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * CommUSB Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus CommUsbIfNotifyOnCommUSBAvailability(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* PS_CommUSB/Availability Changing notification registration */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_CommUSB_Availability, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * CommUSB Services IF-Availability Settings
+ *
+ * @param[in] pb_is_available
+ * @return none
+ */
+void CommUsbIfSetAvailability(BOOL b_is_available) {
+ g_comm_usb_availability = b_is_available;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "g_comm_usb_availability=%d", g_comm_usb_availability);
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/DevDetectSrvIf.cpp b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/DevDetectSrvIf.cpp
new file mode 100755
index 0000000..800429f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/DevDetectSrvIf.cpp
@@ -0,0 +1,279 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * DevDetectSrvIf.cpp
+ * @brief
+ * DevDetectSrv service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "DevDetectSrvIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static BOOL g_dev_detect_srv_availability = FALSE;
+
+/** Device insertion detection */
+DeviceDetectionServiceIf g_if_ss_dev;
+
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * DevDetectSrv Services IF-Availability Settings
+ *
+ * @param[in] b_is_available Available state
+ * @return none
+ */
+void DevDetectSrvIfSetAvailability(BOOL b_is_available) {
+ g_dev_detect_srv_availability = b_is_available;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, \
+ "g_dev_detect_srv_availability=%d", g_dev_detect_srv_availability);
+
+ return;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF-Initialization
+ *
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfInitialize(void) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ BOOL bret;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ bret = g_if_ss_dev.Initialize(happ);
+ if (bret == TRUE) {
+ estatus = eFrameworkunifiedStatusOK;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "g_if_ss_dev::Initialize ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_call_back_fn Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnDeviceDetectionAvailability(CbFuncPtr fp_call_back_fn) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ estatus = g_if_ss_dev.NotifyOnDeviceDetectionAvailability(fp_call_back_fn);
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf Availability ERROR!! [estatus = %d]", estatus);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF OpenSessionRequest Complete Answer Receive Callback Registration
+ *
+ * @param[in] fp_call_back_fn Callback function
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnOpenSessionAck(CbFuncPtr fp_call_back_fn, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.NotifyOnOpenSessionAck(fp_call_back_fn);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF CloseSessionRequest Complete Answer Receive Callback Registration
+ *
+ * @param[in] fp_call_back_fn Callback function
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfNotifyOnCloseSessionAck(CbFuncPtr fp_call_back_fn, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.NotifyOnCloseSessionAck(fp_call_back_fn);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Service IF Service and Session Generation
+ *
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfOpenSessionRequest(BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.OpenSessionRequest();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF-Session Id Retention
+ *
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfDecodeOpenSessionResponse(BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.DecodeOpenSessionResponse();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF-Device Event Receive Callback Registration
+ *
+ * @param[in] fe_dev_detect_event
+ * @param[in] fp_call_back_fn
+ * @param[in] p_file_path
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfRegisterForDeviceDetectionEvent(SS_DeviceDetectionServerEvents fe_dev_detect_event, \
+ CbFuncPtr fp_call_back_fn, PCSTR p_file_path, BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.RegisterForDeviceDetectionEvent(fe_dev_detect_event, fp_call_back_fn, p_file_path);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Services IF DeviceDetectionServiceIf Callback Release
+ *
+ * @param[in] fe_dev_detect_event
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfUnRegisterForDeviceDetectionEvent(SS_DeviceDetectionServerEvents fe_dev_detect_event, \
+ BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.UnRegisterForDeviceDetectionEvent(fe_dev_detect_event);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * DevDetectSrv Service IF Service and Destroy Sessions
+ *
+ * @param[out] pb_is_available Available state
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus DevDetectSrvIfCloseSessionRequest(BOOL* pb_is_available) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+
+ if (g_dev_detect_srv_availability == TRUE) {
+ estatus = g_if_ss_dev.CloseSessionRequest();
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_dev_detect_srv_availability=FALSE");
+ }
+
+ *pb_is_available = g_dev_detect_srv_availability;
+
+ return estatus;
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/DiagSrvIf.cpp b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/DiagSrvIf.cpp
new file mode 100755
index 0000000..195555e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/DiagSrvIf.cpp
@@ -0,0 +1,64 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * DiagSrvIf.cpp
+ * @brief
+ * DiagSrv service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "DiagSrvIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static BOOL g_registration_permission = FALSE; /* Whether or not the dialog code can be registered */
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * DiagSrv Services IF Registration Enable Status Setting
+ *
+ * @param[in] b_is_true
+ * @return none
+ */
+void DiagSrvIfSetRegistrationPermission(BOOL b_is_true) {
+ g_registration_permission = b_is_true;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, \
+ "g_registration_permission=%d", g_registration_permission);
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/Makefile b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/Makefile
new file mode 100755
index 0000000..fba98e8
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/Makefile
@@ -0,0 +1,54 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed library(*.a) #############
+INST_LIBS = libPOS_ServiceInterface
+
+######### compiled sources #############
+libPOS_ServiceInterface_SRCS += BackupMgrIf.cpp
+libPOS_ServiceInterface_SRCS += ClockIf.cpp
+libPOS_ServiceInterface_SRCS += CommUsbIf.cpp
+libPOS_ServiceInterface_SRCS += DevDetectSrvIf.cpp
+libPOS_ServiceInterface_SRCS += DiagSrvIf.cpp
+libPOS_ServiceInterface_SRCS += PSMShadowIf.cpp
+libPOS_ServiceInterface_SRCS += VehicleIf.cpp
+
+######### add include path #############
+CPPFLAGS += -I../../include/common/
+CPPFLAGS += -I../../include/nsfw/
+CPPFLAGS += -I../../include/ServiceInterface
+
+CPPFLAGS += -I../../../client/include
+
+#CPPFLAGS += -I../../../../diag_code/library/include
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### add library path #############
+LDFLAGS +=
+
+include ../../../../vehicle_service.mk
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/PSMShadowIf.cpp b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/PSMShadowIf.cpp
new file mode 100755
index 0000000..99d9a52
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/PSMShadowIf.cpp
@@ -0,0 +1,102 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * PSMShadowIf.cpp
+ * @brief
+ * PSMShadow service-to-service interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "PSMShadowIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * PSMShadow Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus PSMShadowIfNotifyOnPSMShadowAvailability(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ /* PS_PSMShadow/Availability Changing notification registration */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_PSMShadowService_Availability, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Register PSMShadow services IF start completion notification
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus PSMShadowIfNotifyOnPSMShadowInitComp(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (happ != NULL) {
+ /* PS_PSMShadow startup completion notice */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_PSM_INITCOMP, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/VehicleIf.cpp b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/VehicleIf.cpp
new file mode 100755
index 0000000..0ef5e15
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/ServiceInterface/VehicleIf.cpp
@@ -0,0 +1,364 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * VehilceIf.cpp
+ * @brief
+ * Vehicle Service Interface
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include <stub/Vehicle_Sensor_Common_API.h>
+#include <stub/Vehicle_API.h>
+#include <stub/vehicle_notifications.h>
+
+#include "VehicleIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static BOOL gb_vehicleAvailability = FALSE;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Registering Vehicle Services IF Callback Functions
+ *
+ * @param[in] *p_msg_handler Callback function table
+ * @param[in] Ui_handler_count Number of callback functions
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus VehicleIfAttachCallbacksToDispatcher( // NOLINT(readability/nolint)
+ _FrameworkunifiedProtocolCallbackHandler const* p_msg_handler,
+ unsigned int ui_handler_count) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (NULL != happ) {
+ estatus = FrameworkunifiedAttachCallbacksToDispatcher(happ, "NS_ANY_SRC", p_msg_handler, ui_handler_count);
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Vehicle IF: Set Availability Status
+ *
+ * @details This function sets status of Vehicle/Availablity stored in local. <br>
+ * Only when the status is true, Vehicle I/F is called by wrappers.
+ *
+ * @param[in] BOOL bIsAvailable : Availability Status
+ */
+void VehicleIf_SetAvailability(BOOL bIsAvailable)
+{
+ gb_vehicleAvailability = bIsAvailable;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "gb_vehicleAvailability=%d", gb_vehicleAvailability);
+
+ return;
+}
+
+/**
+ * @brief
+ * Remove Vehicle Services IF Callback Functions
+ *
+ * @param[in] *p_msg_handler CID table
+ * @param[in] ui_handler_count Number of CIDs
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus VehicleIfDetachCallbacksFromDispatcher(const PUI_32 pui_cmd_array, UI_32 ui_command_count) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (NULL != happ) {
+ estatus = FrameworkunifiedDetachCallbacksFromDispatcher(happ, "NS_ANY_SRC", pui_cmd_array, ui_command_count, NULL);
+ /* In the event of failure */
+ if (eFrameworkunifiedStatusOK != estatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningDetachCallbacksToDispatcher Failed in FrameworkunifiedOnStop [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Vehicle IF: Get Type of Transmission
+ *
+ * @details This function is wrapper function of Vehicle I/F. <br>
+ * You can get the type of transmission of the vehicle.
+ *
+ * @param[out] uint8_t* pType : Type of Transmission
+ * @param[out] BOOL* bIsAvailable : Availability Status
+ *
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+
+//EFrameworkunifiedStatus VehicleIf_GetTypeOfTransmission(uint8_t* pType, BOOL* pbIsAvailable)
+EFrameworkunifiedStatus VehicleIf_GetTypeOfTransmission(uint8_t* pType, uint8_t* pPkb, BOOL* pbIsAvailable)
+{
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ VEHICLE_RET_API ret;
+ HANDLE hApp;
+ uint8_t ucVartrm;
+
+#if 1 /* Plus _CWORD27_ Gear Data Support 180115 */
+ uint8_t ucPkb;
+#endif /* Plus _CWORD27_ Gear Data Support 180115 */
+
+
+ if (gb_vehicleAvailability == TRUE)
+ {
+ hApp = _pb_GetAppHandle();
+ if (hApp != NULL)
+ {
+ ret = Vehicle_GetVehicleData(hApp, VEHICLE_DID_VARTRM1, &ucVartrm, sizeof(ucVartrm));
+ if (ret < VEHICLE_RET_NORMAL)
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR: Vehicle_GetVehicleData:%d", ret);
+ }
+ else
+ {
+ eStatus = eFrameworkunifiedStatusOK;
+
+ switch (ucVartrm)
+ {
+ case VEHICLE_SNS_VARTRM1_AT:
+ case VEHICLE_SNS_VARTRM1_CVT:
+ case VEHICLE_SNS_VARTRM1_HV_AT:
+ {
+ *pType = VEHICLEIF_TRANSMISSION_TYPE_AT;
+ break;
+ }
+ case VEHICLE_SNS_VARTRM1_MT:
+ case VEHICLE_SNS_VARTRM1_MMT:
+ case VEHICLE_SNS_VARTRM1_SMT:
+ {
+ *pType = VEHICLEIF_TRANSMISSION_TYPE_MT;
+ break;
+ }
+ case VEHICLE_SNS_VARTRM1_UNCERTAINTY:
+ {
+ *pType = VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN;
+ break;
+ }
+ default:
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: Type of transmission is unknown. (%d)", ucVartrm);
+
+ *pType = VEHICLEIF_TRANSMISSION_TYPE_UNKNOWN;
+ break;
+ }
+ }
+ }
+
+#if 1 /* Plus _CWORD27_ Gear Data Support 180115 */
+ ret = Vehicle_GetVehicleData(hApp, VEHICLE_DID_PKB, &ucPkb, sizeof(ucPkb));
+ if (ret < VEHICLE_RET_NORMAL)
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR: Vehicle_GetVehicleData:%d", ret);
+ }
+ else
+ {
+ eStatus = eFrameworkunifiedStatusOK;
+
+ switch (ucPkb)
+ {
+ case VEHICLE_SNS_OFF: // R-state
+ //case VEHICLE_SNS_ANTI: // Antilock(Vehicle undefined)
+ {
+ *pPkb = VEHICLEIF_PKB_OFF;
+ break;
+ }
+ case VEHICLE_SNS_ON: // Lock state
+ {
+ *pPkb = VEHICLEIF_PKB_ON;
+ break;
+ }
+ default:
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "ERROR: State of parking brake is unknown. (%d)", ucPkb);
+
+ *pPkb = VEHICLEIF_PKB_OFF;
+ break;
+ }
+ }
+ }
+#endif /* Plus _CWORD27_ Gear Data Support 180115 */
+
+ }
+ else
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR: _pb_GetAppHandle hApp:%p", hApp);
+ }
+ }
+ else
+ {
+ /* nop */
+ }
+
+ *pbIsAvailable = gb_vehicleAvailability;
+
+ return eStatus;
+}
+
+/**
+ * @brief
+ * Vehicle Services IF Availability Change Notification Registration
+ *
+ * @param[in] fp_on_cmd Callback function
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus VehicleIfNotifyOnVehicleAvailability(CbFuncPtr fp_on_cmd) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+
+ happ = _pb_GetAppHandle();
+ if (NULL != happ) {
+ /* Vehicle/Availability Changing notification registration */
+ estatus = FrameworkunifiedSubscribeNotificationWithCallback(happ, NTFY_Vehicle_Availability, fp_on_cmd); // LCOV_EXCL_BR_LINE 6:unexpected branch //NOLINT (whitespace/line_length)
+ if (eFrameworkunifiedStatusOK != estatus) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningSubscriveNotificationswithCallback ERROR!! [estatus=%d]", estatus);
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+
+ return estatus;
+}
+
+/**
+ * @brief
+ * Vehicle IF: Get Shift Position
+ *
+ * @details This function is wrapper function of Vehicle I/F. <br>
+ * You can get the shift position of the vehicle.
+ *
+ * @param[out] uint8_t* pShift : Shift Position
+ * @param[out] BOOL* bIsAvailable : Availability Status
+ *
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+EFrameworkunifiedStatus VehicleIf_GetShiftPosition(uint8_t* pShift, BOOL* pbIsAvailable)
+{
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
+ VEHICLE_RET_API ret;
+ HANDLE hApp;
+
+ if (gb_vehicleAvailability == TRUE)
+ {
+ hApp = _pb_GetAppHandle();
+ if (hApp != NULL)
+ {
+ ret = Vehicle_GetVehicleData(hApp, VEHICLE_DID_SHIFT, pShift, sizeof(*pShift));
+ if (ret < VEHICLE_RET_NORMAL)
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR: Vehicle_GetVehicleData:%d", ret);
+ }
+ else
+ {
+ eStatus = eFrameworkunifiedStatusOK;
+ }
+ }
+ else
+ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR: _pb_GetAppHandle hApp:%p", hApp);
+ }
+ }
+ else
+ {
+ /* nop */
+ }
+
+ *pbIsAvailable = gb_vehicleAvailability;
+
+ return eStatus;
+}
+
+
+/**
+ * @brief
+ * Vehicle services IF Info data-delivery registry
+ *
+ * @param[in] ul_did
+ * @return eFrameworkunifiedStatusOK
+ * @return eFrameworkunifiedStatusFail
+ */
+
+EFrameworkunifiedStatus VehicleIfDeliveryEntry(uint32_t ul_did) {
+ EFrameworkunifiedStatus estatus = eFrameworkunifiedStatusFail;
+ HANDLE happ;
+ VEHICLE_RET_API iret;
+
+ if (TRUE == gb_vehicleAvailability) {
+ happ = _pb_GetAppHandle();
+ if (NULL != happ) {
+ /* Sensor data delivery registration */
+ iret = Vehicle_DeliveryEntry(happ, (PCSTR)POS_THREAD_NAME, ul_did,
+ VEHICLE_DELIVERY_REGIST, VEHICLE_DELIVERY_TIMING_UPDATE);
+ if (VEHICLE_RET_NORMAL != iret) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Vehicle_DeliveryEntry ERROR!! [iret=%d]", iret);
+ } else {
+ estatus = eFrameworkunifiedStatusOK;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_GetAppHandle ERROR!! [happ=%p]", happ);
+ }
+ } else {
+ /* nop */
+ }
+ return estatus;
+}
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/nsfw/Makefile b/video_in_hal/vehicleservice/positioning/server/src/nsfw/Makefile
new file mode 100755
index 0000000..403e29f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/nsfw/Makefile
@@ -0,0 +1,89 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed program #############
+INST_PROGS = Positioning
+
+######### compiled sources #############
+Positioning_SRCS += ps_main.cpp
+Positioning_SRCS += positioning_application.cpp
+
+ifeq ($(ARCH),arm64)
+LDLIBS += -Wl,-Bdynamic -lpositioning_hal
+else
+LDLIBS += -Wl,-Bdynamic -lpositioning_hal
+endif #($(ARCH),arm64)
+
+######### add include path #############
+CPPFLAGS += -I../../../client/include
+CPPFLAGS += -I../../include/common/
+CPPFLAGS += -I../../include/Sensor/
+CPPFLAGS += -I../../include/ServiceInterface/
+CPPFLAGS += -I../../include/nsfw/
+#CPPFLAGS += -I../../../../diag_code/library/include
+
+######### add compile option #############
+CPPFLAGS += -DLINUX
+CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library(static) #############
+LDLIBS += -Wl,-Bstatic -lPOS_Sensor
+LDLIBS += -Wl,-Bstatic -lPOS_ServiceInterface
+
+# LDLIBS += -Wl,-Bstatic -lVehicle_API
+
+######### linked library (dynamic) #############
+ifeq (arm64, $(ARCH))
+LDLIBS += -Wl,-Bdynamic -lpositioning_hal
+LDLIBS += -Wl,-Bdynamic -lVehicle_API
+endif
+LDLIBS += -Wl,-Bdynamic -lClock_API
+#LDLIBS += -Wl,-Bdynamic -lMM_DREC_API
+#LDLIBS += -Wl,-Bdynamic -lextension
+LDLIBS += -Wl,-Bdynamic -lPOS_base_API
+LDLIBS += -Wl,-Bdynamic -lPOS_common_API
+LDLIBS += -Wl,-Bdynamic -lPOS_gps_API
+LDLIBS += -Wl,-Bdynamic -lPOS_sensor_API
+LDLIBS += -Wl,-Bdynamic -lz
+LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lns_backup
+LDLIBS += -Wl,-Bdynamic -lssver
+LDLIBS += -Wl,-Bdynamic -lstdc++
+#LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI
+LDLIBS += -Wl,-Bdynamic -lDTime_Api
+LDLIBS += -Wl,-Bdynamic -lVehicle_API
+LDLIBS += -Wl,-Bdynamic -lvp
+LDLIBS += -Wl,-Bdynamic -lev
+LDLIBS += -Wl,-Bdynamic -lCommUSB
+
+######### add library path #############
+LDFLAGS += -L../../positioning_hal
+LDFLAGS += -L../Sensor
+LDFLAGS += -L../ServiceInterface
+LDFLAGS += -L../../../client/src/POS_common_API
+LDFLAGS += -L../../../client/src/POS_gps_API
+LDFLAGS += -L../../../client/src/POS_sensor_API
+
+include ../../../../vehicle_service.mk
diff --git a/video_in_hal/vehicleservice/positioning/server/src/nsfw/positioning_application.cpp b/video_in_hal/vehicleservice/positioning/server/src/nsfw/positioning_application.cpp
new file mode 100755
index 0000000..d23daad
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/nsfw/positioning_application.cpp
@@ -0,0 +1,2593 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * positioning_application.cpp
+ * @brief
+ * Module : POSITIONING
+ * Implements Vehicle service functionality
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_application.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/frameworkunified_service_protocol.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_message_center_if.h>
+#include <peripheral_service/ps_services.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include <vehicle_service/POS_gps_API.h>
+#include <system_service/ss_sm_client_if.h>
+#include <vehicle_service/positioning_base_library.h>
+#include <stub/vehicle_notifications.h>
+#include <peripheral_service/communication_notifications.h>
+#include <other_service/VP_GetEnv.h>
+#include <cstdlib>
+#include <iostream>
+
+#include "SensorLog.h"
+#include "positioning_common.h"
+#include "POS_private.h"
+#include "Gps_API_private.h"
+#include "POS_common_private.h"
+#include "Vehicle_API.h"
+#include "Vehicle_API_private.h"
+#include "Sensor_API_private.h"
+#include "Naviinfo_API.h"
+#include "VehicleSensor_Thread.h"
+#include "ClockGPS_Process_Proto.h"
+#include "VehicleSens_Common.h"
+#include "VehicleSens_DataMaster.h"
+#include "VehicleSens_DeliveryCtrl.h"
+#include "VehicleUtility.h"
+#include "BackupMgrIf.h"
+#include "ClockIf.h"
+#include "CommUsbIf.h"
+#include "DevDetectSrvIf.h"
+#include "DiagSrvIf.h"
+#include "PSMShadowIf.h"
+#include "VehicleIf.h"
+#include "positioning_hal.h"
+#include "gps_hal.h"
+#include "CommonDefine.h"
+
+#include "VehicleIf.h"
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+#define DATMOD_RETRY (3) /* Number of shared memory generation retries */
+#define DATMOD_PREINIT (0) /* Shared Memory State Before Initialization */
+#define PRIM_NAME_MAX (32) /* Maximum Name Size */
+
+/* Mask for managing various notification reception conditions */
+#define NTFY_MSK_NONE (0x00)
+/* Service availability notification */
+#define NTFY_MSK_COMMUNICATION_AVAILABILITY (0x01)
+#define NTFY_MSK_PS_COMMUSB_AVAILABILITY (0x02)
+#define NTFY_MSK_PS_PSMSHADOW_AVAILABILITY (0x04)
+#define NTFY_MSK_CLOCK_AVAILABILITY (0x08)
+#define NTFY_MSK_NS_BACKUPMGR_AVAILABILITY (0x10)
+#define NTFY_MSK_SS_DEVDETSRV_AVAILABILITY (0x20)
+#define NTFY_MSK_VS_VEHICLE_AVAILABILITY (0x40)
+/* Other Notices */
+#define NTFY_MSK_PS_PSMSHADOW_INIT_COMP (0x01) /* PSMShadow startup completion notice */
+
+/* Thread state */
+#define THREAD_STS_NOEXIST (0x00)
+#define THREAD_STS_CREATING (0x01)
+#define THREAD_STS_CREATED (0x02)
+
+#define POS_SNDMSG_DTSIZE_1 1 /* SndMSG data size 1Byte */
+#define POS_SNDMSG_DTSIZE_2 2 /* SndMSG data size 2Byte */
+#define POS_SNDMSG_DTSIZE_20 20 /* SndMSG data size of 20 bytes */
+#define POS_SNDMSG_DTSIZE_132 132 /* SndMSG data size: 132 bytes */
+
+/* PositioningLogFlag */
+#define POSITIONINGLOG_FLAG_NAVI 9
+
+/* Definition for thinning out sensor log at anomaly */
+#define POSITIONINGLOG_SYS_1_ABNORMAL_DATA_NUM 3
+#define POSITIONINGLOG_SYS_2_ABNORMAL_DATA_NUM 4
+#define POSITIONINGLOG_SYS_3_ABNORMAL_DATA_NUM 4
+#define POSITIONINGLOG_SYS_4_ABNORMAL_DATA_NUM 129
+#define POSITIONINGLOG_SYS_ABNORMAL_DATA_NUM (POSITIONINGLOG_SYS_1_ABNORMAL_DATA_NUM + \
+ POSITIONINGLOG_SYS_2_ABNORMAL_DATA_NUM + \
+ POSITIONINGLOG_SYS_3_ABNORMAL_DATA_NUM + \
+ POSITIONINGLOG_SYS_4_ABNORMAL_DATA_NUM)
+#define POSITIONINGLOG_SYS_1_ABNORMAL_DATA_OFFSET 11
+#define POSITIONINGLOG_SYS_2_ABNORMAL_DATA_OFFSET 32
+#define POSITIONINGLOG_SYS_3_ABNORMAL_DATA_OFFSET 54
+#define POSITIONINGLOG_SYS_4_ABNORMAL_DATA_OFFSET 114
+#define POSITIONINGLOG_SYS_1_ABNORMAL_SET_DATA_OFFSET 0
+#define POSITIONINGLOG_SYS_2_ABNORMAL_SET_DATA_OFFSET POSITIONINGLOG_SYS_1_ABNORMAL_DATA_NUM
+#define POSITIONINGLOG_SYS_3_ABNORMAL_SET_DATA_OFFSET (POSITIONINGLOG_SYS_1_ABNORMAL_DATA_NUM + POSITIONINGLOG_SYS_2_ABNORMAL_DATA_NUM)
+#define POSITIONINGLOG_SYS_4_ABNORMAL_SET_DATA_OFFSET (POSITIONINGLOG_SYS_1_ABNORMAL_DATA_NUM + \
+ POSITIONINGLOG_SYS_2_ABNORMAL_DATA_NUM + \
+ POSITIONINGLOG_SYS_3_ABNORMAL_DATA_NUM)
+#define POSITIONINGLOG_SYS_OPC_OFFSET 9
+#define POSITIONINGLOG_SYS_PULSE_TIME_NUM_OFFSET 114
+#define POSITIONINGLOG_SYS_NORMAL_DATA 0xC1
+#define POSITIONINGLOG_SYS_FST_DATA 0xF4
+#define _pb_strcat(pdest, psrc, size) (strncat(pdest, psrc, size) , (0))
+
+// Vehicle sensor information notification message
+typedef struct {
+ uint32_t did; // Data ID corresponding to vehicle sensor information
+ uint16_t size; // Data size of vehicle sensor information
+ uint8_t rcv_flag; // Vehicle sensor information reception flag
+ uint8_t reserve; // Reserved
+ uint8_t data[VEHICLE_VSINFO_DSIZE]; // Vehicle sensor information
+} VEHICLE_UNIT_MSG_VSINFO_DAT;
+
+// Vehicle sensor information notification message
+typedef struct {
+ VEHICLE_UNIT_MSG_VSINFO_DAT data; // Message data
+} VEHICLE_UNIT_MSG_VSINFO;
+/*---------------------------------------------------------------------------------*
+ * Structre *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Structure to create shared data
+*/
+typedef struct {
+ char share_data_name[PRIM_NAME_MAX]; /**< Shared data name */
+ u_int32 data_size; /**< Shared data size */
+} ST_SHAREDATA;
+
+/*!
+ @brief Thread management information
+*/
+typedef struct {
+ EnumTID_POS id; /**< Thread ID */
+ const int8_t* p_name; /**< Thread name */
+ PNO pno; /**< Process number */
+ CbFuncPtr routine; /**< Start Routine */
+ uint8_t msk_available; /**< Dependent services Availability */
+ uint8_t msk_ntfy; /**< Dependency notification */
+ uint8_t msk_thread; /**< Dependent threads */
+ BOOL is_depended; /**< Positioning/Availability->TRUE change dependency */
+ uint8_t status; /**< Thread activation state */
+ uint8_t order; /**< Boot Sequence(Performance) */
+ uint8_t reserve[2];
+} ST_THREAD_CREATE_INFO;
+
+
+/* GPS fix count information */
+typedef struct {
+ uint32_t ul3d; /* 3D */
+ uint32_t ul2d; /* 2D */
+ uint32_t ul_else; /* Not fix */
+ uint8_t dummy[4]; /* Dummy */
+} ST_GPS_FIX_CNT;
+
+/*!
+ @brief Structure that stores the time set by the time setting or the time updated(For GRADE1)
+*/
+typedef struct {
+ u_int16 year; /* Year */
+ u_int8 month; /* Month */
+ u_int8 date; /* Day */
+ u_int8 hour; /* Hour */
+ u_int8 minute;/* Minutes */
+ u_int8 second;/* Minutes */
+ u_int8 flag; /* Whether or not the time is set */
+} ST_GPS_SET_TIME;
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+static EFrameworkunifiedStatus PositioningOnStartImpl(const HANDLE hApp, const EPWR_SC_WAKEUP_TYPE wakeupType,
+ const ESMDataResetModeInfo dataResetMode);
+static EFrameworkunifiedStatus PosNotifyCommunicationAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyCommUSBAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyPSMShadowAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyPSMShadowInitComp(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyClockAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyNSBackupMgrAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyDevDetectSrvAvailability(HANDLE h_app);
+static EFrameworkunifiedStatus PosNotifyVehicleAvailability(HANDLE h_app);
+
+static EFrameworkunifiedStatus PosStopThreadDummy(HANDLE h_app);
+static void PosCreateSharedMemory(void);
+static void PosCreateThread(HANDLE h_app);
+static void PosStopThread(void);
+static void PosBackupDataInit(void);
+
+/* Message Dispatching Functions */
+static EFrameworkunifiedStatus PosThreadCreateComp(HANDLE h_app);
+static EFrameworkunifiedStatus PosThreadStopComp(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifRegisterListenerPkgSensorData(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifRegisterListenerSensorData(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifReqGpsSetting(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifSetGpsInfo(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifGetGpsInfo(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifSetData(HANDLE h_app);
+static EFrameworkunifiedStatus PosPosifReqGpsReset(HANDLE h_app);
+static EFrameworkunifiedStatus PosVehicleInfoRcv(HANDLE h_app);
+static uint32_t PosGetMsg(HANDLE h_app, void** p_buf, uint32_t size);
+static RET_API PosSndMsg(PNO pno, CID cid, void* p_msg_body, uint32_t size);
+static void PosOutputDebugDumpLog(uint8_t* p_buf);
+
+/* Function scan for device insertion detection */
+static EFrameworkunifiedStatus PosOnDevDetectOpenSessionAck(HANDLE h_app);
+static EFrameworkunifiedStatus PosOnDevDetectCloseSessionAck(HANDLE h_app);
+static EFrameworkunifiedStatus PosOnDevDetectEvent(HANDLE h_app);
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/* Thread name */
+static const int8_t kThreadNamePosMain[15] = "POS_Main";
+static const int8_t kThreadNamePosSens[15] = "POS_Sens";
+static const int8_t kThreadNamePosGps[15] = "POS_Gps";
+static const int8_t kThreadNamePosGpsRecv[15] = "POS_Gps_Recv";
+static const int8_t kThreadNamePosGpsRollover[15] = "POS_Gps_Rolovr";
+
+/** Shared memory generation table */
+static ST_SHAREDATA g_sharedata_tbl[] = {
+ /* Shared data name to be generated, Shared data size */
+ { {VEHICLE_SHARE_NAME}, 512 * 11 }, /* Vehicle sensor information acquisition */
+#if 0 /* Less than 0.1 SBU,Not used in _CWORD71_ */
+ { {"SENSOR_SHARE_MEMORY"}, 512 * 11 }, /* Vehicle sensor information Pkg acquisition */
+ { {"GPS_INT_SIGNAL_SHARE_MEMORY"}, 4 }, /* GPS Interrupt Signal Acquisition */
+ { {"LOG_SETTING_SHARE_MEMORY"}, 36 }, /* DR feature log acquisition */
+ { {"GYRO_CONNECT_STTS_SHARE_MEMORY"}, 4 }, /* Get Gyro Connection Status */
+ { {"EPHEMERIS_NUM_SHARE_MEMORY"}, 4 }, /* For acquiring effective ephemeris count at shutdown */
+ { {"LOCALTIME_SHARE_MEMORY"}, 12 }, /* Local time acquisition at shutdown */
+ { {"LONLAT_SHARE_MEMORY"}, 8 }, /* Location acquisition at shutdown */
+#endif
+ { {'\0'}, 0 } /* Termination */
+};
+
+/** Sub-thread creation table
+ (1) Thread ID (Locally defined Enumeration)
+ (2) Thread name
+ (3) Process number
+ (4) Start Routine
+ (5) Dependent Availability
+ (6) Dependency notification
+ (7) Dependent threads * If there are dependent threads, do not create them until those threads are created.
+ (8) Positioning/Availability->TRUE depending on change
+ (9) Thread activation state (THREAD_STS_NOEXIST:Not started,THREAD_STS_CREATING:Starting,THREAD_STS_CREATED:Completion of the activation)
+ (10) Boot Sequence(Performance) (0,1,2, ... Note : 0 = Initial value(Not started)) Time of termination,Be destroyed in the reverse order of startup
+ */
+static ST_THREAD_CREATE_INFO g_pos_thread_create_info_Grade1[] = { // LCOV_EXCL_BR_LINE 11: unexpected branch
+ { /* Pos_main */
+ ETID_POS_MAIN, /* (1) */
+ kThreadNamePosMain, /* (2) */
+ PNO_VEHICLE_SENSOR, /* (3) */
+ &VehicleSensThread, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ 0, /* (7) */
+ TRUE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Pos_sens */
+ ETID_POS_SENS, /* (1) */
+ kThreadNamePosSens, /* (2) */
+ PNO_LINE_SENS_DRV, /* (3) */
+ &StartLineSensorThreadPositioning, /* (4) */
+ (NTFY_MSK_PS_PSMSHADOW_AVAILABILITY), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ THREAD_STS_MSK_POS_MAIN, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Pos_gps */
+ ETID_POS_GPS, /* (1) */
+ kThreadNamePosGps, /* (2) */
+ PNO_NAVI_GPS_MAIN, /* (3) */
+ &StartGpsMainThreadPositioning, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ THREAD_STS_MSK_POS_MAIN, /* (7) */
+ TRUE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Pos_gps_recv */
+ ETID_POS_GPS_RECV, /* (1) */
+ kThreadNamePosGpsRecv, /* (2) */
+ PNO_NAVI_GPS_RCV, /* (3) */
+ &StartGpsRecvThreadPositioning, /* (4) */
+ (NTFY_MSK_NONE), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ THREAD_STS_MSK_POS_GPS, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Pos_gps_rollover */
+ ETID_POS_GPS_ROLLOVER, /* (1) */
+ kThreadNamePosGpsRollover, /* (2) */
+ PNO_CLK_GPS, /* (3) */
+ &StartGpsRolloverThreadPositioning, /* (4) */
+ (NTFY_MSK_NS_BACKUPMGR_AVAILABILITY), /* (5) */
+ (NTFY_MSK_NONE), /* (6) */
+ THREAD_STS_MSK_POS_GPS, /* (7) */
+ FALSE, /* (8) */
+ THREAD_STS_NOEXIST, /* (9) */
+ 0 /* (10) */
+ },
+ { /* Termination */
+ ETID_POS_MAX, NULL, 0, NULL, NTFY_MSK_NONE, NTFY_MSK_NONE, 0, FALSE, THREAD_STS_NOEXIST, 0
+ },
+};
+
+/* State Management Variables */
+static bool g_start_flg = false; /** Start Processed Flag */
+static EnumExeSts_POS g_exe_sts; /** Positioning running status */
+static EnumSetupMode_POS g_setup_mode; /** Thread activation mode */
+static uint8_t g_last_thread_sts; /** Latest internal thread activation state */
+static uint8_t g_last_srv_sts; /** Latest service availability */
+static uint8_t g_last_ntfy_sts; /** Receive state of latest notification */
+static uint8_t g_last_num_of_thread; /** Number of Current Startup Threads */
+
+/** Sub-thread creation table */
+static ST_THREAD_CREATE_INFO* g_pos_thread_create_info;
+
+/** Interprocess message receive buffer */
+static uint8_t g_rcv_msg_buf[MAX_MSG_BUF_SIZE];
+
+/** Dispatcher Registration Callback Table */
+static const FrameworkunifiedProtocolCallbackHandler kPositioningPcbhs[] = { // LCOV_EXCL_BR_LINE 11: unexpected branch
+ {CID_THREAD_CREATE_COMP, &PosThreadCreateComp }, /* Thread start completion notification */
+ {CID_THREAD_STOP_COMP, &PosThreadStopComp }, /* Thread stop completion notice */
+ {CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT, &PosPosifRegisterListenerPkgSensorData},
+ {CID_VEHICLEIF_DELIVERY_ENTRY, &PosPosifRegisterListenerSensorData },
+ {CID_SENSORIF__CWORD82__REQUEST, &PosPosifReqGpsSetting },
+ {CID_NAVIINFO_DELIVER, &PosPosifSetGpsInfo },
+ {CID_VEHICLEIF_GET_VEHICLE_DATA, &PosPosifGetGpsInfo },
+ {CID_POSIF_SET_DATA, &PosPosifSetData },
+ {CID_GPS_REQRESET, &PosPosifReqGpsReset },
+};
+
+static const FrameworkunifiedProtocolCallbackHandler kPositioningPcbhsVehicle[] = { // LCOV_EXCL_BR_LINE 11: unexpected branch
+ {CID_VEHICLESENS_VEHICLE_INFO, &PosVehicleInfoRcv},
+};
+
+/** Dispatcher unregister command ID table */
+static uint32_t g_positioning_cids[] = {
+ CID_THREAD_CREATE_COMP,
+ CID_THREAD_STOP_COMP,
+ CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT,
+ CID_VEHICLEIF_DELIVERY_ENTRY,
+ CID_SENSORIF__CWORD82__REQUEST,
+ CID_NAVIINFO_DELIVER,
+ CID_VEHICLEIF_GET_VEHICLE_DATA,
+ CID_POSIF_SET_DATA,
+ CID_GPS_REQRESET,
+};
+
+static uint32_t g_positioning_cids_vehicle[] = {
+ CID_VEHICLESENS_VEHICLE_INFO,
+};
+
+
+
+/** Stop request flag for GPS reception thread */
+BOOL g_thread_stop_req;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * FrameworkunifiedOnInitialization<br>
+ * Sends message to Notification Service
+ *
+ * Mm 21 API perform initialization.<br>
+ * Generatings shared memories used by Vehicle function block..<br>
+ * Creates a sub-thread of the Vehicle feature block..
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ * eFrameworkunifiedStatusFail ABENDs
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) {
+ RET_API ret_api;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ uint8_t* p_last_srv_sts = &g_last_srv_sts;
+ uint8_t* p_last_thread_sts = &g_last_thread_sts;
+ uint8_t* p_last_ntfy_sts = &g_last_ntfy_sts;
+ ST_THREAD_CREATE_INFO** pp_thr_cre_info = &g_pos_thread_create_info;
+ uint8_t* p_last_num_thr = &g_last_num_of_thread;
+ BOOL* p_thr_stop_req = &g_thread_stop_req;
+ EnumExeSts_POS* p_exe_sts = &g_exe_sts;
+ EnumSetupMode_POS* pe_mode = &g_setup_mode;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ /* Global variable initialization */
+ *p_last_srv_sts = 0;
+ *p_last_thread_sts = 0;
+ *p_last_ntfy_sts = 0;
+ *pp_thr_cre_info = g_pos_thread_create_info_Grade1;
+ *p_last_num_thr = 0;
+ *p_thr_stop_req = FALSE;
+ *p_exe_sts = EPOS_EXE_STS_STOP;
+ *pe_mode = EPOS_SETUP_MODE_NORMAL;
+
+ /* null check */
+ if (h_app == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "h_app is NULL");
+ e_status = eFrameworkunifiedStatusFail;
+ } else {
+ /* Positioning Base API initialization */
+ ret_api = _pb_Setup_CWORD64_API(h_app);
+ if (ret_api != RET_NORMAL) { // LCOV_EXCL_BR_LINE 4: can not return error
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_Setup_CWORD64_API ERROR!! [ret_api = %d]",
+ ret_api);
+
+ e_status = eFrameworkunifiedStatusFail;
+ // LCOV_EXCL_STOP
+ } else {
+ /* Availability at Positioning startup,Set internal thread activation state */
+ if (ChkUnitType(UNIT_TYPE_GRADE1) == true) { /* GRADE1 environment */
+ *pp_thr_cre_info = g_pos_thread_create_info_Grade1;
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
+ "*pp_thr_cre_info = g_pos_thread_create_info_Grade1");
+ } else if (ChkUnitType(UNIT_TYPE_GRADE2) == true) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "_pb_ChkUnitType UNKNOWN!!");
+ }
+
+ /* Shared Memory Creation */
+ PosCreateSharedMemory();
+
+ if (e_status == eFrameworkunifiedStatusOK) {
+ /* Register callback functions for Positioning internals */
+ e_status = FrameworkunifiedAttachCallbacksToDispatcher(h_app,
+ "NS_ANY_SRC",
+ kPositioningPcbhs,
+ _countof(kPositioningPcbhs)); // LCOV_EXCL_BR_LINE 4:nsfw error
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedAttachCallbacksToDispatcher ERROR!! [e_status = %d]", e_status);
+ }
+
+ (void)VehicleIfAttachCallbacksToDispatcher(kPositioningPcbhsVehicle,
+ _countof(kPositioningPcbhsVehicle));
+ }
+
+ if (e_status == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Positioning/Availability registration */
+ e_status = FrameworkunifiedRegisterServiceAvailabilityNotification(h_app, POS_AVAILABILITY);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedRegisterServiceAvailabilityNotification ERROR!! [e_status = %d]", e_status);
+ }
+ }
+
+ if (e_status == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Positioning/Availability -> FALSE */
+ e_status = FrameworkunifiedPublishServiceAvailability(h_app, FALSE);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedPublishServiceAvailability ERROR!! [e_status = %d]", e_status);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "Positioning/Availability -> FALSE");
+ }
+ }
+
+ /* Communication/Availability Changing notification registration */
+ FrameworkunifiedSubscribeNotificationWithCallback(h_app, NTFY_Communication_Availability, &PosNotifyCommunicationAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* PS_CommUSB/Availability Changing notification registration */
+ (void)CommUsbIfNotifyOnCommUSBAvailability(&PosNotifyCommUSBAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* PS_PSMShadow/Availability Changing notification registration */
+ (void)PSMShadowIfNotifyOnPSMShadowAvailability(&PosNotifyPSMShadowAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+ /* PS_PSMShadow Startup completion notification registration */
+ (void)PSMShadowIfNotifyOnPSMShadowInitComp(&PosNotifyPSMShadowInitComp); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* Clock/Availability Changing notification registration */
+ (void)ClockIfNotifyOnClockAvailability(&PosNotifyClockAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* NS_BackupMgr/Availability Changing notification registration */
+ (void)BackupMgrIfNotifyOnBackupMgrAvailability(&PosNotifyNSBackupMgrAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* Regist Vehilce Availability Notification */
+ (void)VehicleIfNotifyOnVehicleAvailability(&PosNotifyVehicleAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+
+ /* DeviceDetectionServiceIf initialization */
+ if (DevDetectSrvIfInitialize() == eFrameworkunifiedStatusOK) {
+ /* SS_DevDetectSrv/Availability Changing notification registration */
+ (void)DevDetectSrvIfNotifyOnDeviceDetectionAvailability(&PosNotifyDevDetectSrvAvailability); // LCOV_EXCL_BR_LINE 6: not a branch // NOLINT(whitespace/line_length)
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return e_status;
+}
+
+/**
+ * @brief
+ * PositioningOnStartImpl
+ */
+static EFrameworkunifiedStatus PositioningOnStartImpl(const HANDLE hApp, const EPWR_SC_WAKEUP_TYPE wakeupType,
+ const ESMDataResetModeInfo dataResetMode) {
+ EnumExeSts_POS* p_exe_sts = &g_exe_sts;
+ EnumSetupMode_POS* pe_mode = &g_setup_mode;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ if (g_start_flg == false) {
+ g_start_flg = true;
+
+ /* Running */
+ *p_exe_sts = EPOS_EXE_STS_RUNNING;
+
+ /* Cold start */
+ if (wakeupType == epsstCOLDSTART) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "wakeupType:COLDSTART");
+
+ *p_exe_sts = EPOS_EXE_STS_RUNNING_COLDSTART;
+
+ /* Initialize GPS time setting information */
+ PosBackupDataInit();
+ } else { /* Time of warm start */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "wakeupType:WARMSTART");
+ }
+
+ /* Time of factory initialization */
+ if (dataResetMode == e_SS_SM_DATA_RESET_MODE_FACTORY) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "dataResetMode:FACTORYRESET");
+
+ /* Set thread start mode to ""data reset start"" */
+ *pe_mode = EPOS_SETUP_MODE_DATA_RESET;
+
+ /* Initialize GPS time setting information */
+ PosBackupDataInit();
+ }
+
+ PosCreateThread(hApp);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnStart
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
+ EFrameworkunifiedStatus ret = eFrameworkunifiedStatusFail;
+ uint32_t size;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ size = PosGetMsg(hApp, reinterpret_cast<void**>(&g_rcv_msg_buf), MAX_MSG_BUF_SIZE);
+ if (size != 0) {
+ T_SS_SM_START_DataStructType* p_start_data;
+ p_start_data = reinterpret_cast<T_SS_SM_START_DataStructType*>(g_rcv_msg_buf);
+
+ ret = PositioningOnStartImpl(hApp, p_start_data->wakeupType, p_start_data->dataResetMode);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return ret;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnStop
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ * eFrameworkunifiedStatusFail ABENDs
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) {
+ EFrameworkunifiedStatus e_status;
+ EnumExeSts_POS* p_exe_sts = &g_exe_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ /* null check */
+ if (h_app == NULL) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "h_app is NULL");
+ // LCOV_EXCL_STOP
+ } else {
+ *p_exe_sts = EPOS_EXE_STS_STOP;
+
+ e_status = FrameworkunifiedPublishServiceAvailability(h_app, FALSE);
+ if (eFrameworkunifiedStatusOK != e_status) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedPublishServiceAvailability ERROR!! [e_status = %d]",
+ e_status);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "Positioning/Availability -> FALSE");
+ }
+
+ PosStopThread();
+
+ g_start_flg = false;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ /* Return end response to SM at timing after completion of internal thread stop */
+ return eFrameworkunifiedStatusFail;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnPreStart
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
+ EFrameworkunifiedStatus ret = eFrameworkunifiedStatusFail;
+ uint32_t size;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ size = PosGetMsg(hApp, reinterpret_cast<void**>(&g_rcv_msg_buf), MAX_MSG_BUF_SIZE);
+ if (size != 0) {
+ T_SS_SM_START_DataStructType* p_start_data;
+ p_start_data = reinterpret_cast<T_SS_SM_START_DataStructType*>(g_rcv_msg_buf);
+
+ ret = PositioningOnStartImpl(hApp, p_start_data->wakeupType, p_start_data->dataResetMode);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return ret;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnPreStop
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnBackgroundStart
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
+ EFrameworkunifiedStatus ret = eFrameworkunifiedStatusFail;
+ uint32_t size;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ size = PosGetMsg(hApp, reinterpret_cast<void**>(&g_rcv_msg_buf), MAX_MSG_BUF_SIZE);
+ if (size != 0) {
+ T_SS_SM_START_DataStructType* p_start_data;
+ p_start_data = reinterpret_cast<T_SS_SM_START_DataStructType*>(g_rcv_msg_buf);
+
+ ret = PositioningOnStartImpl(hApp, p_start_data->wakeupType, p_start_data->dataResetMode);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return ret;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnBackgroundStop
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * FrameworkunifiedOnDestroy (Not mounted)
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ * eFrameworkunifiedStatusFail ABENDs
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app) { // LCOV_EXCL_START 14 Resident process, not called by NSFW
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * FrameworkunifiedOnDebugDump
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ * eFrameworkunifiedStatusFail ABENDs
+ */
+EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app) { // LCOV_EXCL_START 7: debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ static uint8_t buf_tmp[256];
+ static uint8_t buf_proc[128];
+ static uint8_t buf_thread[512];
+ static uint8_t buf_message[4][DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_mutex[3][DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_timer[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_event[9][DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_memory[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_other[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_nand[256];
+ static uint8_t buf_ram[256];
+ static uint8_t buf_gps_format_fail[512];
+ static uint8_t buf_antenna[256];
+ static uint8_t buf_gps_info[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_navi_info[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_deli_ctrl_tbl[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_deli_ctrl_tbl_mng[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_pkg_deli_tbl_mng[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_deli_pno_tbl[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_sys[128];
+ int32_t i;
+ ST_THREAD_CREATE_INFO* p_thr_cre_info = g_pos_thread_create_info;
+ ST_GPS_FIX_CNT st_gps_fix_cnt;
+ ST_GPS_SET_TIME st_gps_set_time;
+ uint8_t len_msg = 4;
+ uint8_t len_mtx = 3;
+ uint8_t len_evt = 9;
+ EFrameworkunifiedStatus e_status;
+ BOOL b_is_available;
+ UNIT_TYPE e_type = UNIT_TYPE_NONE;
+ u_int8 sys_recv_flg;
+ uint16_t wkn_rollover;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ memset(&buf_proc[0], 0x00, sizeof(buf_proc));
+ memset(&buf_thread[0], 0x00, sizeof(buf_thread));
+ memset(&buf_nand[0], 0x00, sizeof(buf_nand));
+ memset(&buf_ram[0], 0x00, sizeof(buf_ram));
+ memset(&buf_gps_format_fail[0], 0x00, sizeof(buf_gps_format_fail));
+ memset(&buf_antenna[0], 0x00, sizeof(buf_antenna));
+ memset(&buf_gps_info[0], 0x00, sizeof(buf_gps_info));
+ memset(&buf_navi_info[0], 0x00, sizeof(buf_navi_info));
+ memset(&buf_deli_ctrl_tbl[0], 0x00, sizeof(buf_deli_ctrl_tbl));
+ memset(&buf_deli_ctrl_tbl_mng[0], 0x00, sizeof(buf_deli_ctrl_tbl_mng));
+ memset(&buf_pkg_deli_tbl_mng[0], 0x00, sizeof(buf_pkg_deli_tbl_mng));
+ memset(&buf_deli_pno_tbl[0], 0x00, sizeof(buf_deli_pno_tbl));
+ memset(&buf_sys[0], 0x00, sizeof(buf_sys));
+
+ for (i = 0; i < len_msg; i++) {
+ memset(&buf_message[i][0], 0x00, sizeof(buf_message[i]));
+ }
+ for (i = 0; i < len_mtx; i++) {
+ memset(&buf_mutex[i][0], 0x00, sizeof(buf_mutex[i]));
+ }
+ memset(&buf_timer[0], 0x00, sizeof(buf_timer));
+ for (i = 0; i < len_evt; i++) {
+ memset(&buf_event[i][0], 0x00, sizeof(buf_event[i]));
+ }
+ memset(&buf_memory[0], 0x00, sizeof(buf_memory));
+ memset(&buf_other[0], 0x00, sizeof(buf_other));
+ e_type = GetEnvSupportInfo();
+
+ /* Availability status of related processes */
+ snprintf(reinterpret_cast<char *>(&buf_proc[0]), sizeof(buf_proc),
+ "Availability\n thread:0x%02x, srv:0x%02x, ntfy:0x%02x",
+ g_last_thread_sts, /* Latest internal thread activation state */
+ g_last_srv_sts, /* Latest service availability */
+ g_last_ntfy_sts); /* Receive state of latest notification */
+
+ /* Internal thread activation state */
+ snprintf(reinterpret_cast<char *>(&buf_thread[0]), sizeof(buf_thread), "Thread");
+ for (i = 0; i < ETID_POS_MAX; i++) {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%d]id:%d, pno:0x%04x, name:%16s, sts:0x%02x, order:%d",
+ i,
+ p_thr_cre_info->id, /* Thread ID */
+ p_thr_cre_info->pno, /* Process number */
+ p_thr_cre_info->p_name, /* Thread name */
+ p_thr_cre_info->status, /* Thread activation state */
+ p_thr_cre_info->order); /* Boot Sequence */
+ _pb_strcat(reinterpret_cast<char *>(&buf_thread[0]), reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp));
+ p_thr_cre_info++;
+ }
+
+ /* BASE API control data */
+ /* Message */
+ (void)_pb_GetDebugMsgMngTbl(&buf_message[0][0], &len_msg);
+ /* Mutex */
+ (void)_pb_GetDebugMutexMngTbl(&buf_mutex[0][0], &len_mtx);
+ /* Timer */
+ (void)_pb_GetDebugTimerMngTbl(&buf_timer[0]);
+ /* Event */
+ (void)_pb_GetDebugEventMngTbl(&buf_event[0][0], &len_evt);
+ /* Shared Memory */
+ (void)_pb_GetDebugMemoryMngTbl(&buf_memory[0]);
+ /* Other */
+ (void)_pb_GetDebugOtherMngTbl(&buf_other[0]);
+
+ /* NAND data */
+ snprintf(reinterpret_cast<char *>(&buf_nand[0]), sizeof(buf_nand), "NAND");
+ /* GPS fix count */
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ memset(&st_gps_fix_cnt, 0x00, sizeof(st_gps_fix_cnt));
+
+ e_status = BackupMgrIfBackupDataRd(D_BK_ID_POS_GPS_FIX_CNT,
+ 0,
+ &st_gps_fix_cnt,
+ sizeof(st_gps_fix_cnt), &b_is_available);
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n %20s rd:0x%08x av:%d, 3d:%d, 2d:%d, else:%d, dmy:0x%02x%02x%02x%02x",
+ "GPS_FIX_CNT",
+ e_status,
+ b_is_available,
+ st_gps_fix_cnt.ul3d,
+ st_gps_fix_cnt.ul2d,
+ st_gps_fix_cnt.ul_else,
+ st_gps_fix_cnt.dummy[0], st_gps_fix_cnt.dummy[1], st_gps_fix_cnt.dummy[2], st_gps_fix_cnt.dummy[3]);
+ _pb_strcat(reinterpret_cast<char *>(&buf_nand[0]), reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp));
+
+ /* Data of the backup RAM */
+ snprintf(reinterpret_cast<char *>(&buf_ram[0]), sizeof(buf_ram), "BackupRAM");
+ /* Set GPS date and time(Information) */
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ (void)memset( reinterpret_cast<void *>(&st_gps_set_time), 0, (size_t)sizeof(st_gps_set_time) );
+
+ e_status = BackupMgrIfBackupDataRd(D_BK_ID_POS_GPS_TIME_SET_INFO,
+ 0,
+ &st_gps_set_time,
+ sizeof(st_gps_set_time),
+ &b_is_available);
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n %20s rd:0x%08x av:%d, %d/%d/%d %d:%d:%d flag:0x%02x",
+ "GPS_TIME_SET_INFO",
+ e_status,
+ b_is_available,
+ st_gps_set_time.year,
+ st_gps_set_time.month,
+ st_gps_set_time.date,
+ st_gps_set_time.hour,
+ st_gps_set_time.minute,
+ st_gps_set_time.second,
+ st_gps_set_time.flag);
+ _pb_strcat(reinterpret_cast<char *>(&buf_ram[0]), reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp));
+
+ if (e_type == UNIT_TYPE_GRADE1) {
+ /* GPS format anomaly counter */ /* There is no lock control. */
+ (void)DEVGpsGetDebugGpsFormatFailCnt(&buf_gps_format_fail[0]);
+
+ /* GPS antenna connection status */ /* There is no lock control. */
+ VEHICLESENS_DATA_MASTER st_sns_data = {0};
+ (void)VehicleSensGetGpsAntenna(&st_sns_data, VEHICLESENS_GETMETHOD_LINE);
+ snprintf(reinterpret_cast<char *>(&buf_antenna[0]), sizeof(buf_antenna),
+ "Antenna\n sts:0x%02x",
+ st_sns_data.uc_data[0]);
+
+ /* GPS position time */ /* There is no lock control. */
+ (void)VehicleSensGetDebugPosDate(&buf_gps_info[0], VEHICLESENS_GETMETHOD_GPS);
+ }
+
+ if (e_type == UNIT_TYPE_GRADE1) {
+ /* Navigation position time */ /* There is no lock control. */
+ (void)VehicleSensGetDebugPosDate(&buf_navi_info[0], VEHICLESENS_GETMETHOD_NAVI);
+ }
+
+ /* Delivery table */ /* There is no lock control. */
+ (void)VehicleSensGetDebugDeliveryCtrlTbl(&buf_deli_ctrl_tbl[0]);
+ (void)VehicleSensGetDebugDeliveryCtrlTblMng(&buf_deli_ctrl_tbl_mng[0]);
+ (void)VehicleSensGetDebugPkgDeliveryTblMng(&buf_pkg_deli_tbl_mng[0]);
+ (void)VehicleSensGetDebugDeliveryPnoTbl(&buf_deli_pno_tbl[0]);
+
+ /* Initial Sensor Data Status from Sys */
+ sys_recv_flg = LineSensDrvGetSysRecvFlag();
+ snprintf(reinterpret_cast<char *>(&buf_sys[0]), sizeof(buf_sys),
+ "Rx 1st Sensor Data %d\n", sys_recv_flg);
+
+ /* Dump Information Out */
+ PosOutputDebugDumpLog(&buf_proc[0]);
+ PosOutputDebugDumpLog(&buf_thread[0]);
+ for (i = 0; i < len_msg; i++) {
+ PosOutputDebugDumpLog(&buf_message[i][0]);
+ }
+ for (i = 0; i < len_mtx; i++) {
+ PosOutputDebugDumpLog(&buf_mutex[i][0]);
+ }
+ PosOutputDebugDumpLog(&buf_timer[0]);
+ for (i = 0; i < len_evt; i++) {
+ PosOutputDebugDumpLog(&buf_event[i][0]);
+ }
+ PosOutputDebugDumpLog(&buf_memory[0]);
+ PosOutputDebugDumpLog(&buf_other[0]);
+ PosOutputDebugDumpLog(&buf_nand[0]);
+ PosOutputDebugDumpLog(&buf_ram[0]);
+ if (e_type == UNIT_TYPE_GRADE1) {
+ PosOutputDebugDumpLog(&buf_gps_format_fail[0]);
+ PosOutputDebugDumpLog(&buf_antenna[0]);
+ PosOutputDebugDumpLog(&buf_gps_info[0]);
+ }
+ if (e_type == UNIT_TYPE_GRADE1) {
+ PosOutputDebugDumpLog(&buf_navi_info[0]);
+ }
+ PosOutputDebugDumpLog(&buf_deli_ctrl_tbl[0]);
+ PosOutputDebugDumpLog(&buf_deli_ctrl_tbl_mng[0]);
+ PosOutputDebugDumpLog(&buf_pkg_deli_tbl_mng[0]);
+ PosOutputDebugDumpLog(&buf_deli_pno_tbl[0]);
+ PosOutputDebugDumpLog(&buf_sys[0]);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * FrameworkunifiedCreateStateMachine (Not mounted)
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ * eFrameworkunifiedStatusFail ABENDs
+ */
+EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @brief
+ * Common processing after thread startup
+ *
+ * Thread naming,Create Message Queue,Thread activation response
+ *
+ * @param[in] h_app Application handle
+ * @param[in] e_tid Thread ID
+ *
+ * @return Thread activation mode
+ */
+EnumSetupMode_POS PosSetupThread(HANDLE h_app, EnumTID_POS e_tid) {
+ RET_API ret;
+ ST_THREAD_CREATE_INFO* p_thr_cre_info = g_pos_thread_create_info;
+ ST_THREAD_CREATE_INFO* p_info;
+ ST_THREAD_SETUP_INFO st_setup_info;
+ ST_THREAD_SETUP_INFO* pst_setup_info = &st_setup_info;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ p_info = p_thr_cre_info + e_tid;
+
+ /* Application handle setting */
+ _pb_SetAppHandle(h_app);
+
+ /* Create Message Queue */
+ _pb_CreateMsg(p_info->pno);
+
+ /* Get Thread Startup Information */
+ pst_setup_info->e_mode = EPOS_SETUP_MODE_NORMAL;
+ (void)PosGetMsg(h_app, reinterpret_cast<void**>(&pst_setup_info), sizeof(ST_THREAD_SETUP_INFO));
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "[e_mode = %d]", pst_setup_info->e_mode);
+
+ /* Issue thread creation completion notice */
+ ret = _pb_SndMsg_Ext(POS_THREAD_NAME, CID_THREAD_CREATE_COMP, sizeof(EnumTID_POS), (const void*)&e_tid, 0);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg_Ext ERROR!! [ret = %d]", ret);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return pst_setup_info->e_mode;
+}
+
+/**
+ * @brief
+ * Common Processing at Thread Stop
+ *
+ * Thread stop response,Thread destruction
+ *
+ * @param[in] e_tid Thread ID
+ */
+void PosTeardownThread(EnumTID_POS e_tid) {
+ RET_API ret;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ /* Issue thread stop completion notice */
+ ret = _pb_SndMsg_Ext(POS_THREAD_NAME, CID_THREAD_STOP_COMP, sizeof(EnumTID_POS), (const void*)&e_tid, 0);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg_Ext ERROR!! [ret = %d]", ret);
+ }
+
+ /* Thread destruction */
+ _pb_ExitThread((DWORD)0);
+
+ /* don't arrive here */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return; // LCOV_EXCL_LINE 8 : cannot reach here
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/**
+ * @brief
+ * FrameworkunifiedCreateChildThread dummy functions
+ *
+ * @param[in] Application handle
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosStopThreadDummy(HANDLE h_app) { // LCOV_EXCL_START 8 : dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+// LCOV_EXCL_STOP
+
+/*---------------------------------------------------------------------------------*
+ * Local Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Communication services Availability notification callback functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosNotifyCommunicationAvailability(HANDLE h_app) {
+ BOOL isAvailable;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+ if (isAvailable == TRUE) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Communication/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_COMMUNICATION_AVAILABILITY;
+
+ PosCreateThread(h_app);
+
+ /* Sensor Log Initial Processing(First)*/
+ SensLogInitialize(NULL);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Communication/Availability -> FALSE");
+
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_COMMUNICATION_AVAILABILITY);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * CommUSB services Availability notification callback functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosNotifyCommUSBAvailability(HANDLE h_app) {
+ BOOL isAvailable;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+ if (isAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PS_CommUSB/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_PS_COMMUSB_AVAILABILITY;
+
+ PosCreateThread(h_app);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PS_CommUSB/Availability -> FALSE");
+
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_PS_COMMUSB_AVAILABILITY);
+ }
+
+ /* Update CommUSB I/F availability */
+ CommUsbIfSetAvailability(isAvailable);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * PSMShadow services Availability notification callback functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosNotifyPSMShadowAvailability(HANDLE h_app) {
+ BOOL isAvailable;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+ if (isAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PS_PSMShadow/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_PS_PSMSHADOW_AVAILABILITY;
+
+ PosCreateThread(h_app);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PS_PSMShadow/Availability -> FALSE");
+
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_PS_PSMSHADOW_AVAILABILITY);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * PSMShadow services Callback function for notifying completion of startup
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosNotifyPSMShadowInitComp(HANDLE h_app) {
+ uint8_t* pLastNtfySts = &g_last_ntfy_sts;
+ ST_THREAD_CREATE_INFO* pThrCreInfo = g_pos_thread_create_info;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ *pLastNtfySts |= NTFY_MSK_PS_PSMSHADOW_INIT_COMP;
+
+ /* When the Pos_Sens thread is started */
+ if (((pThrCreInfo + ETID_POS_SENS)->status) == THREAD_STS_CREATED) {
+ /* External pin status request */
+ LineSensDrvExtTermStsReq();
+ }
+
+ PosCreateThread(h_app);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Clock Services Availability Notification Callback Functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosNotifyClockAvailability(HANDLE h_app) {
+ BOOL isAvailable;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+ if (isAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Clock/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_CLOCK_AVAILABILITY;
+
+ PosCreateThread(h_app);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Clock/Availability -> FALSE");
+
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_CLOCK_AVAILABILITY);
+ }
+
+ /* Update Clock I/F availability */
+ ClockIfSetAvailability(isAvailable);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * NS_BackupMgr service Availability notification callback function
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosNotifyNSBackupMgrAvailability(HANDLE h_app) {
+ EnumExeSts_POS* pExeSts = &g_exe_sts;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+ ST_THREAD_CREATE_INFO* pThrCreInfo = g_pos_thread_create_info;
+ EnumSetupMode_POS* peMode = &g_setup_mode;
+ BOOL bIsAvailable;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ bIsAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+
+ /* Update BackupMgr I/F availability */
+ BackupMgrIfSetAvailability(bIsAvailable);
+
+ if (bIsAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NS_BackupMgr/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_NS_BACKUPMGR_AVAILABILITY;
+
+ /* Executing after cold start or during factory initialization*/
+ if ((*pExeSts == EPOS_EXE_STS_RUNNING_COLDSTART) ||
+ (*peMode == EPOS_SETUP_MODE_DATA_RESET)) {
+ /* Backup RAM initialization */
+ PosBackupDataInit();
+ }
+
+ /* When the GPS management thread is started */
+ if (((pThrCreInfo + ETID_POS_GPS)->status) == THREAD_STS_CREATED) {
+ if ((*pExeSts == EPOS_EXE_STS_RUNNING_COLDSTART) ||
+ (*peMode == EPOS_SETUP_MODE_DATA_RESET)) {
+ // GPS reset request.
+ SENSOR_INTERNAL_MSG_BUF msg_buf = {};
+ T_APIMSG_MSGBUF_HEADER *msg_hdr = &msg_buf.hdr;
+ msg_hdr->hdr.cid = CID_GPS_REQRESET;
+ msg_hdr->hdr.msgbodysize = sizeof(POS_RESETINFO);
+ POS_RESETINFO *msg_data = reinterpret_cast<POS_RESETINFO *>(&msg_buf.data);
+ msg_data->mode = GPS_RST_COLDSTART;
+
+ RET_API ret = _pb_SndMsg(PNO_NAVI_GPS_MAIN, sizeof(msg_buf), &msg_buf, 0);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_pb_SndMsg ERROR!! [ret=%d]", ret);
+ }
+ }
+
+ /* Backup data read request to GSP management thread */
+ (void)DEVGpsSndBackupDataLoadReq();
+ }
+ /* Enable Diag Code Writing */
+ DiagSrvIfSetRegistrationPermission(TRUE);
+
+ PosCreateThread(h_app);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NS_BackupMgr/Availability -> FALSE");
+
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_NS_BACKUPMGR_AVAILABILITY);
+ /* Write prohibited dialog code */
+ DiagSrvIfSetRegistrationPermission(FALSE);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * SS_DevDetectSrv service Availability Callback Functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosNotifyDevDetectSrvAvailability(HANDLE h_app) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ BOOL isAvailable;
+ BOOL bDummy;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+
+ /* Update DevDetectSrv I/F availability */
+ DevDetectSrvIfSetAvailability(isAvailable);
+
+ if (isAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "SS_DevDetectSrv/Availability -> TRUE");
+ *pLastSrvSts |= NTFY_MSK_SS_DEVDETSRV_AVAILABILITY;
+
+ eStatus = DevDetectSrvIfOpenSessionRequest(&bDummy);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf OpenSession ERROR!! [eStatus = %d]", eStatus);
+ } else {
+ eStatus = DevDetectSrvIfNotifyOnOpenSessionAck(&PosOnDevDetectOpenSessionAck, &bDummy);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf NotifyOnOpenSessionAck ERROR!! [eStatus = %d]", eStatus);
+ }
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "SS_DevDetectSrv/Availability -> FALSE");
+ *pLastSrvSts = static_cast<uint8_t>(*pLastSrvSts & ~NTFY_MSK_SS_DEVDETSRV_AVAILABILITY);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+
+/**
+ * @brief
+ * Vehicle Availability notification callback functions
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ *
+ */
+static EFrameworkunifiedStatus PosNotifyVehicleAvailability(HANDLE h_app) {
+ BOOL isAvailable;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ isAvailable = FrameworkunifiedIsServiceAvailable(h_app);
+
+ /* Update Vechile I/F Abailability */
+ VehicleIf_SetAvailability(isAvailable);
+
+ if (isAvailable == TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Vehicle/Availability -> TRUE");
+
+ *pLastSrvSts |= NTFY_MSK_VS_VEHICLE_AVAILABILITY;
+
+ if (eFrameworkunifiedStatusFail == VehicleIfDeliveryEntry(VEHICLE_DID_SPEED)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleIfDeliveryEntry SPEED ERROR");
+ }
+
+ if (eFrameworkunifiedStatusFail == VehicleIfDeliveryEntry(VEHICLE_DID_REV)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleIfDeliveryEntry REV ERROR");
+ }
+
+ if (eFrameworkunifiedStatusFail == VehicleIfDeliveryEntry(VEHICLE_DID_SPEED_PULSE_VEHICLE)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleIfDeliveryEntry SPEED PULSE ERROR");
+ }
+
+ PosCreateThread(h_app);
+
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Vehicle/Availability -> FALSE");
+
+ *pLastSrvSts &= ~NTFY_MSK_VS_VEHICLE_AVAILABILITY;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Shared Memory Creation for Positioning Function
+ *
+ * @return RET_NORMAL Normal completion
+ * RET_ERROR ABENDs
+ */
+static void PosCreateSharedMemory(void) {
+ RET_API ret_api = RET_NORMAL;
+ void *mod_exec_dmy; /* Module data pointer(dummy) */
+ int retry; /* Retry counter */
+ ST_SHAREDATA *p_shm_tbl;
+
+ /* Configure Shared Data Generating Tables */
+ p_shm_tbl = g_sharedata_tbl;
+
+ while ( *(p_shm_tbl->share_data_name) != '\0' ) {
+ for ( retry = 0; retry < DATMOD_RETRY; retry++ ) {
+ /* Shared Memory Generation */
+ ret_api = _pb_CreateShareData(p_shm_tbl->share_data_name, p_shm_tbl->data_size, &mod_exec_dmy);
+ if (ret_api == RET_NORMAL) { /* If successful */
+ /* Set the shared memory status flag to ""Before initialization (0)"" */
+ *reinterpret_cast<u_int32 *>(mod_exec_dmy) = DATMOD_PREINIT;
+
+ break;
+ } else { /* In the event of failure */
+ /* Error Handling */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_CreateShareData ERROR [ret_api:%d]",
+ ret_api);
+ }
+ }
+
+ if (retry >= DATMOD_RETRY) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateShareData failed more %d times.",
+ DATMOD_RETRY);
+
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ /* Next shared memory generation */
+ p_shm_tbl++;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Positioning in-process thread creation
+ *
+ * @param[in] hApp application handles
+ */
+static void PosCreateThread(HANDLE h_app) {
+ HANDLE threadHandle;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ EnumSetupMode_POS* peMode = &g_setup_mode;
+ int32_t i;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+ uint8_t* pLastThreadSts = &g_last_thread_sts;
+ uint8_t* pLastNtfySts = &g_last_ntfy_sts;
+ EnumExeSts_POS* pExeSts = &g_exe_sts;
+ ST_THREAD_CREATE_INFO* pThrCreInfo = g_pos_thread_create_info;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ for (i = 0; i < ETID_POS_MAX; i++) {
+ if ((pThrCreInfo->status == THREAD_STS_NOEXIST) && (pThrCreInfo->routine != NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__,
+ "i=%d, mskThread=0x%02x, *pLastThreadSts=0x%02x,"\
+ "mskAvailable=0x%02x, *pLastSrvSts=0x%02x, mskNtfy=0x%02x, *pLastNtfySts=0x%02x",
+ i,
+ pThrCreInfo->msk_thread,
+ *pLastThreadSts,
+ pThrCreInfo->msk_available,
+ *pLastSrvSts,
+ pThrCreInfo->msk_ntfy,
+ *pLastNtfySts);
+
+ if ((*pExeSts != EPOS_EXE_STS_STOP)
+ && ((((pThrCreInfo->msk_thread) & (*pLastThreadSts)) == pThrCreInfo->msk_thread)
+ || (pThrCreInfo->msk_thread == 0))
+ && ((((pThrCreInfo->msk_available) & (*pLastSrvSts)) == pThrCreInfo->msk_available)
+ || (pThrCreInfo->msk_available == NTFY_MSK_NONE))
+ && ((((pThrCreInfo->msk_ntfy) & (*pLastNtfySts)) == pThrCreInfo->msk_ntfy)
+ || (pThrCreInfo->msk_ntfy == NTFY_MSK_NONE))) {
+ if (pThrCreInfo->pno == PNO_LINE_SENS_DRV || \
+ pThrCreInfo->pno == PNO_NAVI_GPS_MAIN || \
+ pThrCreInfo->pno == PNO_NAVI_GPS_RCV ||
+ pThrCreInfo->pno == PNO_CLK_GPS) {
+ (pThrCreInfo->routine)(h_app);
+ } else {
+ /* Thread creation */
+ threadHandle = FrameworkunifiedCreateChildThread(h_app,
+ (PCSTR)(pThrCreInfo->p_name),
+ pThrCreInfo->routine,
+ &PosStopThreadDummy);
+ if (threadHandle == NULL) { /* If the thread creation fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedCreateChildThread ERROR!! [tHandle=%p]",
+ threadHandle);
+ _pb_Exit();
+ /* don't arrive here. */
+ } else {
+ /* Thread activation (Notify the startup mode) */
+ eStatus = FrameworkunifiedStartChildThread(h_app,
+ threadHandle,
+ sizeof(EnumSetupMode_POS),
+ reinterpret_cast<void*>(peMode));
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedStartChildThread ERROR!! [eStatus=%d, name=%s]",
+ eStatus,
+ pThrCreInfo->p_name);
+ } else {
+ pThrCreInfo->status = THREAD_STS_CREATING;
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "name=%s", pThrCreInfo->p_name);
+ }
+ }
+ }
+ }
+ }
+
+ pThrCreInfo++;
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return;
+}
+
+
+/**
+ * @brief
+ * Termination of Positioning in-process threads
+ */
+static void PosStopThread(void) {
+ RET_API ret;
+ ST_THREAD_CREATE_INFO* p_thr_cre_info = g_pos_thread_create_info;
+ BOOL *p_thr_stop_req = &g_thread_stop_req;
+ uint8_t uc_msg = 0;
+ uint8_t uc_order = 0;
+ PNO us_pno = 0;
+ int32_t i;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ for (i = 0; i < ETID_POS_MAX; i++) {
+ if (uc_order < p_thr_cre_info->order) {
+ uc_order = p_thr_cre_info->order;
+ us_pno = p_thr_cre_info->pno;
+ }
+ p_thr_cre_info++;
+ }
+
+ if (uc_order != 0) {
+ /* Send Thread Termination Request */
+ if (us_pno == PNO_NAVI_GPS_RCV) {
+ /* Pos_gps_recv Only thread flag control */
+ *p_thr_stop_req = TRUE;
+ } else {
+ ret = PosSndMsg(us_pno, CID_THREAD_STOP_REQ, &uc_msg, sizeof(uc_msg));
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PosSndMsg ERROR!! [ret = %d]",
+ ret);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Backup RAM initialization
+ */
+static void PosBackupDataInit(void) {
+ UNIT_TYPE e_type = UNIT_TYPE_NONE;
+ EFrameworkunifiedStatus e_status;
+ BOOL b_is_available;
+ ST_GPS_SET_TIME st_gps_set_time;
+
+ (void)memset( reinterpret_cast<void *>(&st_gps_set_time), 0, (size_t)sizeof(st_gps_set_time) );
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ e_type = GetEnvSupportInfo();
+ if (e_type == UNIT_TYPE_GRADE1) {
+ /* Set GPS date and time */
+ e_status = BackupMgrIfBackupDataWt(D_BK_ID_POS_GPS_TIME_SET_INFO,
+ &st_gps_set_time,
+ 0,
+ sizeof(st_gps_set_time),
+ &b_is_available);
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "D_BK_ID_POS_GPS_TIME_SET_INFO:W:Clear");
+ if (e_status != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "BackupMgrIfBackupDataWt ERROR!! [e_status=%d, b_is_available=%d]",
+ e_status,
+ b_is_available);
+ }
+ } else if (e_type == UNIT_TYPE_GRADE2) {
+ /*
+ * Note.
+ * This feature branches processing depending on the unit type.
+ */
+ } else {
+ /* No processing */
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher()
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosThreadCreateComp(HANDLE h_app) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ uint8_t* pLastThreadSts = &g_last_thread_sts;
+ ST_THREAD_CREATE_INFO* pThrCreInfo = g_pos_thread_create_info;
+ uint8_t* pLastNumThr = &g_last_num_of_thread;
+ uint8_t* pLastSrvSts = &g_last_srv_sts;
+ uint8_t* pLastNtfySts = &g_last_ntfy_sts;
+ EnumTID_POS eTid;
+ int32_t i;
+ static BOOL isSetAvailable = FALSE;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ (*pLastNumThr)++;
+
+ eTid = *(reinterpret_cast<EnumTID_POS*>(pRcvMsg));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X]",
+ (pThrCreInfo + eTid)->p_name,
+ CID_THREAD_CREATE_COMP);
+
+ /* Thread Management Variable Updates */
+ *pLastThreadSts = static_cast<uint8_t>(*pLastThreadSts | (0x1u << eTid));
+ (pThrCreInfo + eTid)->status = THREAD_STS_CREATED;
+ (pThrCreInfo + eTid)->order = *pLastNumThr;
+
+ /* Individual processing of started threads */
+ switch (eTid) {
+ case ETID_POS_SENS: /* When sensor driver thread startup is completed */
+ {
+ /* When PSMShadow startup completion notice has been received */
+ if (((NTFY_MSK_PS_PSMSHADOW_INIT_COMP) & (*pLastNtfySts)) == NTFY_MSK_PS_PSMSHADOW_INIT_COMP) {
+ /* External pin status request */
+ LineSensDrvExtTermStsReq();
+ }
+ break;
+ }
+ case ETID_POS_GPS: /* When the GPS management thread has started */
+ {
+ /* NSBackupMgr/Availability=When TRUE notification has been received */
+ if (((NTFY_MSK_NS_BACKUPMGR_AVAILABILITY) & (*pLastSrvSts)) == NTFY_MSK_NS_BACKUPMGR_AVAILABILITY) {
+ /* Backup data read request to GSP management thread */
+ (void)DEVGpsSndBackupDataLoadReq();
+ }
+ break;
+ }
+ default: /* Other thread startup completion time */
+ break;
+ }
+
+ PosCreateThread(h_app);
+
+ for (i = 0; i < ETID_POS_MAX; i++) {
+ if ((pThrCreInfo->is_depended == TRUE) && (pThrCreInfo->status != THREAD_STS_CREATED)) {
+ break; /* Positioning/Availability->TRUE condition does not meet */
+ }
+ pThrCreInfo++;
+ }
+
+ if ((i == ETID_POS_MAX) && (isSetAvailable == FALSE)) {
+ /* Positionig/Availability -> TRUE */
+ eStatus = FrameworkunifiedPublishServiceAvailability(h_app, TRUE);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedPublishServiceAvailability ERROR!! [eStatus = %d]",
+ eStatus);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "Positioning/Availability -> TRUE");
+ isSetAvailable = TRUE;
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher()
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosThreadStopComp(HANDLE h_app) {
+ EFrameworkunifiedStatus eStatus;
+ BOOL bIsAvailable;
+
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ uint8_t* pLastThreadSts = &g_last_thread_sts;
+ ST_THREAD_CREATE_INFO* pThrCreInfo = g_pos_thread_create_info;
+ uint8_t* pLastNumThr = &g_last_num_of_thread;
+ BOOL *pThrStopReq = &g_thread_stop_req;
+ EnumTID_POS eTid;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ (*pLastNumThr)--;
+
+ eTid = *(reinterpret_cast<EnumTID_POS*>(pRcvMsg));
+
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X]",
+ (pThrCreInfo + eTid)->p_name,
+ CID_THREAD_STOP_COMP);
+
+ *pLastThreadSts = static_cast<uint8_t>(*pLastThreadSts & ~(0x1u << eTid));
+
+ (pThrCreInfo + eTid)->status = THREAD_STS_NOEXIST;
+ (pThrCreInfo + eTid)->order = 0;
+
+ if ((pThrCreInfo + eTid)->pno == PNO_NAVI_GPS_RCV) {
+ *pThrStopReq = FALSE;
+ }
+ }
+
+ PosStopThread();
+
+ /* When all threads have stopped */
+ if (*pLastThreadSts == 0) {
+ /* Unregister callback function */
+ eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(h_app,
+ "NS_ANY_SRC",
+ (const PUI_32)g_positioning_cids,
+ _countof(g_positioning_cids), NULL);
+ if (eStatus != eFrameworkunifiedStatusOK) { /* In the event of failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "PositioningDetachCallbacksToDispatcher Failed in FrameworkunifiedOnStop [eStatus:%d]",
+ eStatus);
+ }
+
+ /* Sensor log stop processing */
+ SensLogTerminate();
+
+ /* DeviceDetectionServiceIf termination process */
+ eStatus = DevDetectSrvIfUnRegisterForDeviceDetectionEvent(SS_DEV_DETECT_ANY_USB_EV, &bIsAvailable);
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf UnRegisterEvent ERROR!! [sts:%d, ava:%d]",
+ eStatus,
+ bIsAvailable);
+ } else {
+ eStatus = DevDetectSrvIfCloseSessionRequest(&bIsAvailable);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf CloseSession ERROR!! [sts=%d, ava:%d]",
+ eStatus,
+ bIsAvailable);
+ }
+ }
+
+ (void)VehicleIfDetachCallbacksFromDispatcher((const PUI_32)g_positioning_cids_vehicle,
+ _countof(g_positioning_cids_vehicle));
+
+ /* Releasing Base API Resources */
+ _pb_Teardown_CWORD64_API();
+
+ /* Stop processing completion response */
+ SendInterfaceunifiedOnStopResponseToSystemManager(eFrameworkunifiedStatusOK);
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(POS_RegisterListenerPkgSensData)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifRegisterListenerPkgSensorData(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ EventID ulEventId;
+ PCSTR pName;
+ static const PCSTR pNone = "-";
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ pName = _pb_CnvPno2Name((reinterpret_cast<SENSOR_MSG_DELIVERY_ENTRY_DAT*>(pRcvMsg))->pno);
+ if (pName == NULL) {
+ pName = pNone;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X",
+ pName,
+ CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT);
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ /* Event Generation */
+ ulEventId = PosCreateEvent((reinterpret_cast<SENSOR_MSG_DELIVERY_ENTRY_DAT*>(pRcvMsg))->pno);
+ if (ulEventId != 0) {
+ /* Event publishing */
+ ret = _pb_SetEvent(ulEventId, SAPI_EVSET_ABSOLUTE, SENSOR_RET_ERROR_INNER);
+ if (ret != RET_NORMAL) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SetEvent ERROR!! [ret = %d]", ret);
+ }
+ /* Event deletion */
+ (void)PosDeleteEvent(ulEventId);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosCreateEvent ERROR!!");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(POS_RegisterListenerSensData)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifRegisterListenerSensorData(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ EventID ulEventId;
+ PCSTR pName;
+ static const PCSTR pNone = "-";
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ pName = _pb_CnvPno2Name((reinterpret_cast<VEHICLE_MSG_DELIVERY_ENTRY_DAT*>(pRcvMsg))->pno);
+ if (pName == NULL) {
+ pName = pNone;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X]",
+ pName,
+ CID_VEHICLEIF_DELIVERY_ENTRY);
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_VEHICLEIF_DELIVERY_ENTRY, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ /* Event Generation */
+ ulEventId = VehicleCreateEvent((reinterpret_cast<VEHICLE_MSG_DELIVERY_ENTRY_DAT*>(pRcvMsg))->pno);
+ if (ulEventId != 0) {
+ /* Event publishing */
+ ret = _pb_SetEvent(ulEventId, SAPI_EVSET_ABSOLUTE, SENSOR_RET_ERROR_INNER);
+ if (ret != RET_NORMAL) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SetEvent ERROR!! [ret = %d]", ret);
+ }
+ /* Event deletion */
+ (void)VehicleDeleteEvent(ulEventId);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleCreateEvent ERROR!!");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(POS_ReqGPSSetting)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifReqGpsSetting(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ uint8_t ucResult = SENSLOG_RES_FAIL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:-][CID:0x%X]",
+ CID_SENSORIF__CWORD82__REQUEST);
+ ucResult = SENSLOG_RES_SUCCESS;
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_SENSORIF__CWORD82__REQUEST, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ }
+ }
+
+ SensLogWriteInputData(SENSLOG_DATA_I_GPSSET, 0, 0, pRcvMsg, static_cast<uint16_t>(size),
+ ucResult, SENSLOG_ON, SENSLOG_ON);
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(POS_SetGPSInfo)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifSetGpsInfo(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ uint8_t ucResult = SENSLOG_RES_FAIL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:-][CID:0x%X]",
+ CID_NAVIINFO_DELIVER);
+ ucResult = SENSLOG_RES_SUCCESS;
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_NAVI_GPS_MAIN, CID_NAVIINFO_DELIVER, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ }
+ }
+ SensLogWriteInputData(SENSLOG_DATA_I_GPSINF, 0, 0, pRcvMsg, static_cast<uint16_t>(size),
+ ucResult, SENSLOG_ON, SENSLOG_ON);
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(POS_GetGPSInfo)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifGetGpsInfo(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ EventID ulEventId;
+ PCSTR pName;
+ static const PCSTR pNone = "-";
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ pName = _pb_CnvPno2Name((reinterpret_cast<VEHICLE_MSG_GET_VEHICLE_DATA_DAT*>(pRcvMsg))->pno);
+ if (pName == NULL) {
+ pName = pNone;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X]",
+ pName,
+ CID_VEHICLEIF_GET_VEHICLE_DATA);
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_VEHICLEIF_GET_VEHICLE_DATA, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ /* Event Generation */
+ ulEventId = VehicleCreateEvent((reinterpret_cast<VEHICLE_MSG_GET_VEHICLE_DATA_DAT*>(pRcvMsg))->pno);
+ if (ulEventId != 0) {
+ /* Event publishing */
+ ret = _pb_SetEvent(ulEventId, SAPI_EVSET_ABSOLUTE, POS_RET_ERROR_INNER);
+ if (ret != RET_NORMAL) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_SetEvent ERROR!! [ret = %d]",
+ ret);
+ }
+ /* Event deletion */
+ (void)VehicleDeleteEvent(ulEventId);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleCreateEvent ERROR!!");
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(CID_POSIF_SET_DATA)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifSetData(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ EventID ulEventId;
+ PCSTR pName;
+ static const PCSTR pNone = "-";
+ uint8_t ucResult = SENSLOG_RES_FAIL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ ucResult = SENSLOG_RES_SUCCESS;
+
+ pName = _pb_CnvPno2Name((reinterpret_cast<POS_MSGINFO*>(pRcvMsg))->pno);
+ if (pName == NULL) {
+ pName = pNone;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X][DID:0x%X]",
+ pName,
+ CID_POSIF_SET_DATA,
+ (reinterpret_cast<POS_MSGINFO*>(pRcvMsg))->did);
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_POSIF_SET_DATA, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ if ((reinterpret_cast<POS_MSGINFO*>(pRcvMsg))->did == VEHICLE_DID_SETTINGTIME) {
+ /* GPS time setting(When waiting for completion of an event, an event is issued. */
+ /* Event Generation */
+ ulEventId = VehicleCreateEvent((reinterpret_cast<POS_MSGINFO*>(pRcvMsg))->pno);
+ if (ulEventId != 0) {
+ /* Event publishing */
+ ret = _pb_SetEvent(ulEventId, SAPI_EVSET_ABSOLUTE, POS_RET_ERROR_INNER);
+ if (ret != RET_NORMAL) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_SetEvent ERROR!! [ret = %d]",
+ ret);
+ }
+ /* Event deletion */
+ (void)VehicleDeleteEvent(ulEventId);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleCreateEvent ERROR!!");
+ }
+ }
+ }
+ }
+ SensLogWriteInputData(SENSLOG_DATA_I_UNSPECIFIED,
+ (reinterpret_cast<POS_MSGINFO*>(pRcvMsg))->did,
+ 0,
+ pRcvMsg,
+ static_cast<uint16_t>(size),
+ ucResult,
+ SENSLOG_ON,
+ SENSLOG_ON);
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(CID_GPS_REQRESET)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosPosifReqGpsReset(HANDLE h_app) {
+ RET_API ret;
+ uint8_t* pRcvMsg;
+ uint32_t size;
+ EventID ulEventId;
+ PCSTR pName;
+ static const PCSTR pNone = "-";
+ uint8_t ucResult = SENSLOG_RES_FAIL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "+");
+
+ pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ ucResult = SENSLOG_RES_SUCCESS;
+
+ pName = _pb_CnvPno2Name((reinterpret_cast<POS_RESETINFO*>(pRcvMsg))->snd_pno);
+ if (pName == NULL) {
+ pName = pNone;
+ }
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__,
+ "Get message = [Sender:%s][CID:0x%X]",
+ pName,
+ CID_GPS_REQRESET);
+
+ /* Send Messages to Internal Thread */
+ ret = PosSndMsg(PNO_NAVI_GPS_MAIN, CID_GPS_REQRESET, pRcvMsg, size);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+
+ /* Event Generation */
+ ulEventId = VehicleCreateEvent((reinterpret_cast<POS_RESETINFO*>(pRcvMsg))->snd_pno);
+ if (0 != ulEventId) {
+ /* Event publishing */
+ ret = _pb_SetEvent(ulEventId, SAPI_EVSET_ABSOLUTE, POS_RET_ERROR_INNER);
+ if (ret != RET_NORMAL) {
+ /* Event issuance failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_SetEvent ERROR!! [ret = %d]",
+ ret);
+ }
+ /* Event deletion */
+ (void)VehicleDeleteEvent(ulEventId);
+ } else {
+ /* Event generation failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleCreateEvent ERROR!!");
+ }
+ }
+ }
+
+ SensLogWriteInputData(SENSLOG_DATA_I_GPSRST, 0, 0, pRcvMsg, static_cast<uint16_t>(size),
+ ucResult, SENSLOG_ON, SENSLOG_ON);
+ FRAMEWORKUNIFIEDLOG(ZONE_28, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Callback function for registering the dispatcher(CID_VEHICLESENS_VEHICLE_INFO)
+ *
+ * Send a message to an internal thread.
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus PosVehicleInfoRcv(HANDLE h_app) {
+ LSDRV_MSG_LSDATA_DAT_G line_sns_data;
+ RET_API ret = RET_NORMAL;
+
+ memset(&line_sns_data, 0, sizeof(line_sns_data));
+ LSDRV_MSG_LSDATA_DAT_G *p_line_sns_data = &line_sns_data;
+ VEHICLE_UNIT_MSG_VSINFO *p_vehicle_msg = NULL;
+ uint32_t size = 0;
+ uint16_t us_speed = 0;
+
+ uint8_t* pRcvMsg = g_rcv_msg_buf;
+
+ size = PosGetMsg(h_app, reinterpret_cast<void**>(&pRcvMsg), MAX_MSG_BUF_SIZE);
+ if (size != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ memset(p_line_sns_data, 0x00, sizeof(line_sns_data));
+ p_vehicle_msg = (reinterpret_cast<VEHICLE_UNIT_MSG_VSINFO*>(pRcvMsg));
+ switch (p_vehicle_msg->data.did) {
+ // SPEED info
+ case VEHICLE_DID_SPEED:
+ {
+ p_line_sns_data->uc_data_num = LSDRV_KINDS_MAX;
+ p_line_sns_data->st_data[LSDRV_SPEED_KMPH].ul_did = POSHAL_DID_SPEED_KMPH;
+ p_line_sns_data->st_data[LSDRV_SPEED_KMPH].uc_size = POS_SNDMSG_DTSIZE_2;
+ p_line_sns_data->st_data[LSDRV_SPEED_KMPH].uc_sns_cnt = 0;
+
+ char p_env_variable[VP_MAX_LENGTH];
+
+ VP_GetEnv("VP__CWORD31__SPEED", p_env_variable);
+ if (0 == strcmp(p_env_variable, "direct")) {
+ int16_t speed = 0;
+ // To obtain the vehicle speed from Direct lanes,1 to 2 bytes of received data
+ memcpy(&speed, &p_vehicle_msg->data.data[0], sizeof(speed));
+ us_speed = static_cast<uint16_t>(abs(speed));
+ // Unit conversion [km/h] -> [0.01km/h]
+ us_speed = static_cast<uint16_t>(us_speed * 100);
+ } else if (0 == strcmp(p_env_variable, "CAN")) {
+ UINT16 speed = 0;
+ // To obtain the vehicle speed from CAN,2 to 3 bytes of received data
+ memcpy(&speed, &p_vehicle_msg->data.data[1], sizeof(speed));
+ us_speed = static_cast<uint16_t>(abs(speed));
+ // Unit conversion [km/h] -> [0.01km/h]
+ us_speed = static_cast<uint16_t>(us_speed * 100);
+ } else {
+ // In case of invalid value, the vehicle speed is acquired by CAN.
+ UINT16 speed = 0;
+ memcpy(&speed, &p_vehicle_msg->data.data[1], sizeof(speed));
+ us_speed = static_cast<uint16_t>(abs(speed));
+ // Unit conversion [km/h] -> [0.01km/h]
+ us_speed = static_cast<uint16_t>(us_speed * 100);
+ }
+
+ memcpy(&p_line_sns_data->st_data[LSDRV_SPEED_KMPH].uc_data[0], &us_speed, sizeof(us_speed));
+
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_LINESENS_VEHICLE_DATA_G,
+ reinterpret_cast<void*>(p_line_sns_data), sizeof(line_sns_data));
+
+ break;
+ }
+ // REV information
+ case VEHICLE_DID_REV:
+ {
+ p_line_sns_data->uc_data_num = LSDRV_KINDS_MAX;
+ p_line_sns_data->st_data[LSDRV_REV].ul_did = VEHICLE_DID_REV;
+ p_line_sns_data->st_data[LSDRV_REV].uc_size = POS_SNDMSG_DTSIZE_1;
+ p_line_sns_data->st_data[LSDRV_REV].uc_sns_cnt = 0;
+ p_line_sns_data->st_data[LSDRV_REV].uc_data[0] = p_vehicle_msg->data.data[0];
+
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_LINESENS_VEHICLE_DATA_G,
+ reinterpret_cast<void*>(p_line_sns_data), sizeof(line_sns_data));
+ break;
+ }
+
+ // Speed Pulse information
+ case VEHICLE_DID_SPEED_PULSE_VEHICLE:
+ {
+ p_line_sns_data->uc_data_num = LSDRV_KINDS_MAX;
+ p_line_sns_data->st_data[LSDRV_SPEED_PULSE].ul_did = POSHAL_DID_SPEED_PULSE;
+ p_line_sns_data->st_data[LSDRV_SPEED_PULSE].uc_size = sizeof(float);
+ p_line_sns_data->st_data[LSDRV_SPEED_PULSE].uc_sns_cnt = 0;
+
+ memcpy(&p_line_sns_data->st_data[LSDRV_SPEED_PULSE].uc_data[0],
+ &p_vehicle_msg->data.data[0], sizeof(float));
+
+ p_line_sns_data->st_data[LSDRV_PULSE_TIME].ul_did = POSHAL_DID_PULSE_TIME;
+ p_line_sns_data->st_data[LSDRV_PULSE_TIME].uc_size = sizeof(float);
+ p_line_sns_data->st_data[LSDRV_PULSE_TIME].uc_sns_cnt = 0;
+
+ memcpy(&p_line_sns_data->st_data[LSDRV_PULSE_TIME].uc_data[0],
+ &p_vehicle_msg->data.data[sizeof(float)], sizeof(float));
+
+ ret = PosSndMsg(PNO_VEHICLE_SENSOR, CID_LINESENS_VEHICLE_DATA_G,
+ reinterpret_cast<void*>(p_line_sns_data), sizeof(line_sns_data));
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosSndMsg ERROR!! [ret = %d]", ret);
+ }
+ }
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * Get Message
+ *
+ * Get messages received by the dispatcher
+ *
+ * @param[in] h_app Application handle
+ * @param[out] p_buf Pointer to receive data storage buffer
+ * @param[in] Sizes of size receive data storage buffers
+ *
+ * @return Received data size(0:Receiving error)
+ */
+static uint32_t PosGetMsg(HANDLE h_app, void** p_buf, uint32_t size) {
+ EFrameworkunifiedStatus eStatus;
+ uint32_t ulSize = 0;
+ void* pRcvBuf;
+
+ /* null check */
+ if ((h_app == NULL) || (p_buf == NULL)) { // LCOV_EXCL_BR_LINE 200: can not NULL
+ // LCOV_EXCL_START 8: invalid
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Argument ERROR!! [h_app = %p, p_buf = %p]",
+ h_app,
+ p_buf);
+ // LCOV_EXCL_STOP
+ } else {
+ /* Check the size of received data */
+ ulSize = FrameworkunifiedGetMsgLength(h_app);
+ if (ulSize > size) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Message size ERROR!! [ulSize = %d, maxsize = %d]",
+ ulSize,
+ size);
+ ulSize = 0;
+ } else {
+ /* Obtain data */
+ eStatus = FrameworkunifiedGetDataPointer(h_app, &pRcvBuf);
+ if (eStatus == eFrameworkunifiedStatusOK) {
+ *p_buf = pRcvBuf;
+ } else if (eStatus == eFrameworkunifiedStatusInvldBufSize) {
+ eStatus = FrameworkunifiedGetMsgDataOfSize(h_app, *p_buf, ulSize);
+ /* When acquisition fails */
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetMsgDataOfSize ERROR [eStatus:%d]",
+ eStatus);
+ ulSize = 0;
+ }
+ } else {
+ /* When acquisition fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetDataPointer ERROR [eStatus:%d]",
+ eStatus);
+ ulSize = 0;
+ }
+ }
+ }
+
+ return ulSize;
+}
+
+/**
+ * @brief
+ * Sending Messages for Internal Threads
+ *
+ * Adds a header to the message received by the dispatcher and sends it to the internal thread..
+ *
+ * @param[in] pno PNO
+ * @param[in] cid Command ID
+ * @param[in] p_msg_body Sent message body
+ * @param[in] size Send message size
+ *
+ * @return RET_NORAML Normal completion
+ * RET_ERROR ABENDs
+ */
+static RET_API PosSndMsg(PNO pno, CID cid, void* p_msg_body, uint32_t size) {
+ RET_API ret = RET_NORMAL;
+ T_APIMSG_MSGBUF_HEADER* p;
+ static u_int8 sndMsgBuf[MAX_MSG_BUF_SIZE + sizeof(T_APIMSG_MSGBUF_HEADER)];
+
+ if ((p_msg_body == NULL) || (size > MAX_MSG_BUF_SIZE)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! [p_msg_body = %p, size = %d]", p_msg_body, size);
+ ret = RET_ERROR;
+ } else {
+ p = reinterpret_cast<T_APIMSG_MSGBUF_HEADER*>(sndMsgBuf);
+
+ /* Message header addition */
+ p->hdr.cid = cid;
+ p->hdr.msgbodysize = static_cast<uint16_t>(size);
+
+ /* Copy of the data section */
+ memcpy((p + 1), p_msg_body, size);
+
+ /* Send a message to an internal thread */
+ ret = _pb_SndMsg(pno, static_cast<uint16_t>(size + sizeof(T_APIMSG_MSGBUF_HEADER)), p, 0);
+ /* When transmission fails */
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SndMsg ERROR [ret = %d]", ret);
+ ret = RET_ERROR;
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * SS_DevDetectSrv service OpenSessionAck Callback Functions
+ *
+ * @param none
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosOnDevDetectOpenSessionAck(HANDLE h_app) {
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ BOOL bIsAvailable;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ eStatus = DevDetectSrvIfDecodeOpenSessionResponse(&bIsAvailable);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf OpenSession ERROR!! [sts=%d, ava=%d]", eStatus, bIsAvailable);
+ } else {
+ eStatus = DevDetectSrvIfRegisterForDeviceDetectionEvent(SS_DEV_DETECT_ANY_USB_EV,
+ &PosOnDevDetectEvent,
+ NULL,
+ &bIsAvailable);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf RegisterEvent ERROR!! [sts=%d, ava=%d]", eStatus, bIsAvailable);
+ } else {
+ eStatus = DevDetectSrvIfNotifyOnCloseSessionAck(&PosOnDevDetectCloseSessionAck, &bIsAvailable);
+ if (eFrameworkunifiedStatusOK != eStatus) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "DeviceDetectionServiceIf CloseSessionAck ERROR!! [sts=%d, ava=%d]",
+ eStatus,
+ bIsAvailable);
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * SS_DevDetectSrv service CloseSessionAck Callback Functions
+ *
+ * @param none
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosOnDevDetectCloseSessionAck(HANDLE h_app) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Sensor log stop processing */
+ SensLogTerminate();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "-");
+ return eFrameworkunifiedStatusOK;
+}
+
+/**
+ * @brief
+ * SS_DevDetectSrv service Event Callback Functions
+ *
+ * @param none
+ *
+ * @return eFrameworkunifiedStatusOK successful completion
+ */
+static EFrameworkunifiedStatus PosOnDevDetectEvent(HANDLE h_app) {
+ SS_MediaDetectInfo stMedia;
+ EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
+ uint32_t ulSize = 0;
+ uint8_t mode;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "+");
+
+ /* Check the size of received data */
+ ulSize = FrameworkunifiedGetMsgLength(h_app);
+ if (ulSize > sizeof(SS_MediaDetectInfo)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Message size ERROR!! [ulSize = %d, maxsize = %ld]",
+ ulSize, sizeof(SS_MediaDetectInfo));
+ ulSize = 0;
+ } else {
+ /* Obtain data */
+ eStatus = FrameworkunifiedGetMsgDataOfSize(h_app, &stMedia, ulSize);
+ /* When acquisition fails */
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "FrameworkunifiedGetMsgDataOfSize ERROR [eStatus:%d]", eStatus);
+ ulSize = 0;
+ } else {
+ if (eUSB == stMedia.dev_type) {
+ if (TRUE == stMedia.bIsDeviceAvailable) {
+ /* Mount detection */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
+ "USB mounted sts=[%d] path=[%s] fusedav=[%d]",
+ stMedia.bIsDeviceAvailable, stMedia.deviceMountpath, stMedia.bIsFuseDav);
+
+ /* NOTE: bIsFuseDav -> From the _CWORD80_'s point of view, */
+ /* TRUE(With a USB flash drive inserted into the _CWORD84_,Be synchronized on the FuseDav)*/
+ /* FALSE(USB memory is inserted into the _CWORD80_.) */
+
+ if (stMedia.bIsFuseDav == FALSE) {
+ /* Inserted into your USB port */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "SensLog Initialize start.");
+ /* Get Debug/Release setting */
+ eStatus = NsLogGetFrameworkunifiedLogFlag(POSITIONINGLOG_FLAG_NAVI, &mode);
+ /* When acquisition fails */
+ if (eStatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "NsLogGetFrameworkunifiedLogFlag ERROR [eStatus:%d]", eStatus);
+ } else {
+ if (mode == FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG) {
+ /* Sensor Log Initial Processing(Normal)*/
+ SensLogInitialize(reinterpret_cast<uint8_t *>(stMedia.deviceMountpath));
+ }
+ }
+ } else {
+ /* TODO: Mounts (FuseDav synchronized) that are not inserted into your device's USB port are not supported. */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "Don't output SensLog.");
+ }
+ } else {
+ /* Unmount detection */
+ if (stMedia.bIsFuseDav == FALSE) {
+ /* When it is unmounted to its own USB */
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
+ "USB umounted sts=[%d] fusedav=[%d]",
+ stMedia.bIsDeviceAvailable, stMedia.bIsFuseDav);
+
+ /* Sensor log stop processing */
+ SensLogTerminate();
+ }
+ }
+ }
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__, "-");
+ return eStatus;
+}
+
+/**
+ * @brief Debug dump log output function
+ *
+ * @param[in] *p_buf Pointer to the output string
+ */
+static void PosOutputDebugDumpLog(uint8_t* p_buf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SSDEBUGDUMP("%s\n", p_buf);
+ MilliSecSleep(1);
+ return;
+}
+// LCOV_EXCL_STOP
+
diff --git a/video_in_hal/vehicleservice/positioning/server/src/nsfw/ps_main.cpp b/video_in_hal/vehicleservice/positioning/server/src/nsfw/ps_main.cpp
new file mode 100755
index 0000000..de2732a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning/server/src/nsfw/ps_main.cpp
@@ -0,0 +1,59 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <native_service/frameworkunified_dispatcher.h>
+#include <native_service/frameworkunified_application.h>
+#include <peripheral_service/ps_services.h>
+#include <native_service/ns_version_if.h>
+#include <system_service/ss_system_if.h>
+#include <vehicle_service/positioning_base_library.h>
+#include <cstdlib>
+#include <iostream>
+#include "vehicle_version.h"
+
+const CHAR kAppName[PS_APPNAME_MAX] = "Positioning";
+
+CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, // NOLINT(readability/nolint)
+ MINORNO, // NOLINT(readability/nolint)
+ REVISION);
+
+/* FRAMEWORKUNIFIEDLOGPARAM : g_FrameworkunifiedLogParams : definition for LOG */
+FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { // NOLINT(readability/nolint)
+ FRAMEWORKUNIFIEDLOGOPTIONS,
+ {
+ ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
+ ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
+ ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
+ ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
+ ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
+ ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
+ ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
+ ZONE_TEXT_31,
+ ZONE_POS_SYS_IN, ZONE_POS_GPS_IN, ZONE_POS_CMD_IN, ZONE_POS_NAV_IN
+ },
+ FRAMEWORKUNIFIEDLOGZONES
+};
+
+/* Function : main */
+int main(int argc, char *argv[]) {
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ FrameworkunifiedDefaultCallbackHandler cb_funcs;
+ FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cb_funcs);
+
+ FRAMEWORKUNIFIED_SET_ZONES();
+ e_status = FrameworkunifiedDispatcher(kAppName, &cb_funcs);
+
+ return e_status;
+} // LCOV_EXCL_BR_LINE 10:The final line
diff --git a/video_in_hal/vehicleservice/positioning_base_library/LICENSE b/video_in_hal/vehicleservice/positioning_base_library/LICENSE
new file mode 100755
index 0000000..f433b1a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/vehicleservice/positioning_base_library/Makefile.client b/video_in_hal/vehicleservice/positioning_base_library/Makefile.client
new file mode 100755
index 0000000..c3aaab5
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/Makefile.client
@@ -0,0 +1,20 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### subdirectories #########
+SUBDIRS += library
+
+include ../vehicle_service.mk
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/Makefile b/video_in_hal/vehicleservice/positioning_base_library/library/Makefile
new file mode 100755
index 0000000..c0aec5b
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/Makefile
@@ -0,0 +1,87 @@
+#
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libPOS_base_API
+
+######### install headers(*.h) #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += std_types.h
+INST_HEADERS += sys_timerapi.h
+INST_HEADERS += WPF_STD.h
+INST_HEADERS += pos_message_header.h
+INST_HEADERS += positioning_base_library.h
+INST_HEADERS += positioning_positioningbaselibrarylog.h
+
+######### compiled sources #############
+VPATH += src
+libPOS_base_API_SRCS += _pbTimer.cpp
+libPOS_base_API_SRCS += _pbCSection.cpp
+libPOS_base_API_SRCS += _pbMutex.cpp
+libPOS_base_API_SRCS += _pbSem.cpp
+libPOS_base_API_SRCS += _pbDram.cpp
+libPOS_base_API_SRCS += _pbFsys.cpp
+libPOS_base_API_SRCS += _pbMem.cpp
+libPOS_base_API_SRCS += _pbSram.cpp
+libPOS_base_API_SRCS += _pbOSCtrl.cpp
+libPOS_base_API_SRCS += _pbSerial.cpp
+libPOS_base_API_SRCS += _pbWaitforsingleobject.cpp
+libPOS_base_API_SRCS += _pbOther.cpp
+libPOS_base_API_SRCS += _pbProcMng.cpp
+libPOS_base_API_SRCS += _pbCommon.cpp
+libPOS_base_API_SRCS += _CWORD64_api.cpp
+libPOS_base_API_SRCS += _pbMisc.cpp
+libPOS_base_API_SRCS += _pbEvent.cpp
+libPOS_base_API_SRCS += _pbMsg.cpp
+libPOS_base_API_SRCS += _pbSum.cpp
+libPOS_base_API_SRCS += MsgBapi.cpp
+libPOS_base_API_SRCS += memcpy_64p_sync.cpp
+libPOS_base_API_SRCS += memset_64p_sync.cpp
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC
+CPPFLAGS += -D_CWORD64_API_DOES_NOT_USE_UNICODE
+
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -Wl,--no-as-needed
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lvp
+LDLIBS += -Wl,-Bdynamic -lrt
+LDLIBS += -Wl,-Bdynamic -lcommon
+LDLIBS += -Wl,-Bdynamic -lstdc++
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lev
+
+######### add library path #############
+LDFLAGS += -shared
+
+INSTALL = install
+CREATE_DIR = $(DESTDIR)/nv/BS/vs/positioning_base_library/rwdata
+install-data:
+ $(INSTALL) -d -m 775 $(CREATE_DIR)
+
+include ../../vehicle_service.mk
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h
new file mode 100755
index 0000000..141c8d8
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/DEV_TimerEntryDrv_if.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+ * File name : DEV_TimerEntryDrv_if.h
+ * System name : Integrated PF
+ * Subsystem name : Timer registry drivers
+ * Title : APIs for Timer registry drivers
+ ****************************************************************************/
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_DEV_TIMERENTRYDRV_IF_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_DEV_TIMERENTRYDRV_IF_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*-----------------------------------------------------------------------------
+ * Constant definition
+ *----------------------------------------------------------------------------*/
+/* Return value */
+#define DEV_TED_INVALID (u_int32)0 /* Timer start failure */
+#define DEV_TED_STOP_NG (u_int32)0 /* Timer stop failure */
+#define DEV_TED_STOP_OK (u_int32)1 /* Timer stop success */
+
+/* Definitions for event Handle names */
+#define DEV_TED_EVTNAME_MAX (u_int32)32 /* _CWORD64_ Events HANDLE Name */
+
+/*-----------------------------------------------------------------------------
+ * Structure Definition
+ *----------------------------------------------------------------------------*/
+/* Structures for timer setting instructions (_CWORD64_ messages) */
+typedef struct {
+ int32 set_time; /* Count time */
+ PNO pno; /* _CWORD64_ Messages Destination PNOs */
+ u_int32 ext_data; /* Extended Info for _CWORD64_ Messages */
+} stTED_SetTime__CWORD64_msg;
+
+/* Structures for timer setting directives (Windows events) */
+typedef struct {
+ int32 set_time; /* Count time */
+ char evob_name[DEV_TED_EVTNAME_MAX]; /* _CWORD64_ Events HANDLE Name */
+ int32 ext_data; /* _CWORD64_ Events Extended Info */
+} stTED_SetTime__CWORD64_evt;
+
+/* Structures for sending _CWORD64_ messages */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER header; /* _CWORD64_ Message header */
+ u_int32 timer_id; /* Timer IDs for _CWORD64_ messages */
+ u_int32 us_data; /* Extended Info for _CWORD64_ Messages */
+} stTimer_CWORD64_msg;
+
+/* Structures for timer setting directives (Windows events) */
+typedef struct {
+ int32 set_time; /* Count time */
+ wchar_t evob_name[DEV_TED_EVTNAME_MAX]; /* _CWORD64_ Events HANDLE Name */
+} stTED_SetTime_winevt;
+/*
+ API Function Prototype
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+u_int32 DEVSetTimer_CWORD64_msg(stTED_SetTime__CWORD64_msg *p_set_data);
+u_int32 DEVSetTimer_CWORD64_event(stTED_SetTime__CWORD64_evt *p_set_data);
+u_int32 DEVStopTimer(u_int32 time_id);
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_DEV_TIMERENTRYDRV_IF_H_
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h
new file mode 100755
index 0000000..d20d6f0
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/TimerEntryDrv_If.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * File name : TimerDrv_If.h
+ * System name : Integrated PF
+ * Process name : Timer registry driversI/F
+ * Overview : Timer registry drivers I/F Header file
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TIMERENTRYDRV_IF_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TIMERENTRYDRV_IF_H_
+
+#include <vehicle_service/positioning_base_library.h>
+#include "DEV_TimerEntryDrv_if.h"
+
+/*
+ Constant definition
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#define TED_DRV_NAME "TED" /* Channel names of drivers registered in the Timer */
+/* The channel name cannot be a leading slash. Location is under /dev/name/local */
+
+/*-----------------------------------------------------------------------------
+ * CTRL CODE definitions
+ *----------------------------------------------------------------------------*/
+/* IOCTRL internal-processing sort codes */
+#define TED_IOCTRL_TIMREQ __DIOTF(_DCMD_MISC, 1, stTedApidt) /* Timer start */
+#define TED_IOCTRL_STPREQ __DIOT(_DCMD_MISC, 2, stTedApidt) /* Timer stop */
+
+#define TED_IF_SETTIME_MIN (int32)1 /* Minimum count time(1ms) */
+
+#define TED_IF_SETPNO_NG (PNO)0 /* PNO invalid value for _CWORD64_ messages */
+#define TED_IF_MMEVENT_INVALID_ID 0 /* Invalid _CWORD64_ EventID */
+
+#define TED_IF_RET__CWORD64_MSG (u_int16)1 /* How Users Are Notified on Timeouts: _CWORD64_ Messages */
+#define TED_IF_RET_WINEVT (u_int16)2 /* How Users Are Notified on Timeouts: Windows Events */
+
+/* Timer type */
+#define TED_IF_TIMERTYPE_CYCLE 1 /* Fixed period Timer Specified in [10ms] */
+#define TED_IF_TIMERTYPE_SINGLE 2 /* Single occurrence Timer Specified in [10ms] */
+
+/* API type(Distinguishing between API Functions Used at Timer Startup) */
+#define TED_IF_APITYPE_SYS 1 /* Timer start by _pb_ReqTimerStart() */
+#define TED_IF_APITYPE_DEV 2 /* Timer start by DEV_SetTimer_XXX() */
+
+/*
+ Data type definition
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Timer registration data by user(Timer register driver IF -> timer register driver) */
+typedef struct {
+ int32 time_rem; /* User's remaining timer count time(count value in 10 [msec] units) */
+ u_int32 timer_id; /* User's timer ID */
+ u_int32 ret_data; /* User's extended information */
+ PNO ret_pno; /* User's _CWORD64_ message-destination process number */
+ u_int16 fin_mode; /* User Timeout Notification Method */
+ char wev_ob_name[DEV_TED_EVTNAME_MAX]; /* Event name(32 characters) */
+ u_int32 timer_seq; /* Timer Sequence Number */
+ u_int8 time_type; /* Timer type(Fixed period/single occurrence) */
+ u_int8 api_type; /* API type(_pb_ReqTimerStart/DEV_SetTimer) */
+ u_int8 reserve[2];
+} stTedApidt;
+typedef stTedApidt *PTED_IFDT;
+
+/* Timer Start/Stop Messages Structures, */
+typedef struct {
+ int32 time_rem; /* User's remaining timer count time(count value in 10 [msec] units) */
+ u_int32 timer_id; /* User's timer ID */
+ u_int32 ret_data; /* User's extended information */
+ PNO ret_pno; /* User's _CWORD64_ message-destination process number */
+ u_int16 fin_mode; /* User Timeout Notification Method */
+ char wev_ob_name[DEV_TED_EVTNAME_MAX]; /* Event name(32 characters) */
+ u_int32 timer_seq; /* Timer Sequence Number */
+ u_int8 time_type; /* Timer type(Fixed period/single occurrence) */
+ u_int8 api_type; /* API type(_pb_ReqTimerStart/DEV_SetTimer) */
+ u_int8 reserve[2];
+} TIMERUSERDATA;
+
+/* Structures for sending _CWORD64_ message timer START */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER header; /* _CWORD64_ Message header */
+ /* Extended Info for _CWORD64_ Messages */
+ TIMERUSERDATA st_us_data;
+} stTimerStart_CWORD64_msg;
+
+/* Structures for sending _CWORD64_ message timer STOP */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER header; /* _CWORD64_ Message header */
+ /* Extended Info for _CWORD64_ Messages */
+ TIMERUSERDATA st_us_data;
+} stTimerStop_CWORD64_msg;
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TIMERENTRYDRV_IF_H_
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : TimerEntryDrv_If.h
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/WPF_STD_private.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/WPF_STD_private.h
new file mode 100755
index 0000000..87f57cd
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/WPF_STD_private.h
@@ -0,0 +1,295 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file WPF_STD_private.h
+ * @brief Header file for system standard definitions
+ */
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+
+/* _CWORD64_ non-OS managed areas */
+#define SDRAM__CWORD64__NOTOS_AREA 0x00000000
+#define SDRAM__CWORD64__NOTOS_AREA_SIZE 0x0
+
+#define BLVER_SIZE 0x00000008 /* BootLoader version information area size */
+#define FROM_FIX_VER_SIZE BLVER_SIZE /* Mask(BootLoder)Version size */
+
+/* Start address of the _CWORD64_ non-OS management area */
+#define TOP_ADDR_NOTOS SDRAM__CWORD64__NOTOS_AREA
+/* Size of the non-OS management area */
+#define NOTOS_SISE SDRAM__CWORD64__NOTOS_AREA_SIZE
+
+/* Reserved(32KB)Unavailable */
+#define SRAMDRAM_RESERVE2_SIZE 0x00008000
+
+#define WINAPI
+
+#define STATUS_WAIT_0 ((DWORD)0x00000000L)
+#define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080L)
+#define STATUS_TIMEOUT ((DWORD)0x00000102L)
+#define WAIT_TIMEOUT STATUS_TIMEOUT
+#define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0)
+#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0) + 0)
+#define WAIT_FAILED ((DWORD)0xFFFFFFFF)
+
+#define SHARED_MEMORY_DIRECTORY ("/tmp/shm/navigation/")
+
+#define _pb_strcmp(pleft, pright)((strcmp(pleft, pright) == 0) ?(0) :(-1))
+
+/* For heap allocation method control */
+#define HEAP_ZERO_MEMORY (0x00000008)
+
+#define EV_RXCHAR 0x0001
+#define EV_ERROR 0x0080
+
+#define EV_DSR 0x0010
+
+/* Systems API External Public Functions Prototype Definitions */
+#define VUP_DISC_PATHNAME _T("/Z01") /* VUP DISC paths */
+#define VUP_USB_PATHNAME _T("/U") /* VUP USB paths */
+#define VUP_PATHNAME_SYSTEM _T("/agl/system") /* Storage path name */
+#define VUP_FNAME_TOP _T("/NA_D0_") /* VUPFile name(front) */
+#define VUP_FNAME_BTM _T(".bin") /* VUPFile name(rear) */
+#define VUP_FNAME_FORCEVUP _T("/forcevup.dat") /* Forced VUP file name */
+
+#define FROM_VARI_VER_SIZE 8
+#define WRITE_FLAG_ON 0x01 /* Write permission status for the file */
+#define FSNOACCESS 0x00 /* File system access disabled state */
+#define VUP_GETNAME_MEDIA_DISC 0x01 /* VUP media:disc */
+
+/* Function Code(Normal completion) */
+#define RET_RCVMSG 1 /* Receive only message */
+#define RET_RCVSIG 2 /* Receive only signal */
+#define RET_RCVBOTH 3 /* Receive both messages and signals */
+#define RET_NOMSG 4 /* No received message */
+/* User-side signal handling return values */
+#define RET_QUE 5 /* Queue a signal */
+#define RET_NOTQUE 6 /* Do not queue signals */
+#define RET_PROCDOWN 7 /* Detect DOWN of children */
+#define RET_SLEEP 100
+
+/* Error code system */
+#define RET_OSERROR (-127) /* OS System call error */
+/* Actual error in _sys_GetOSErrorCode() */
+/* Code can be retrieved */
+#define RET_ERRNOTRDY (-3) /* Specified port ID and semaphore ID are not created.*/
+#define RET_ERRPROC (-4) /* Error in API processing */
+#define RET_ERRTIMEOUT (-5) /* Timeout with Processing Not Complete */
+/* (D type API only) */
+#define RET_ERRMSGFULL (-6) /* Message table full */
+#define RET_ERROVERFLW (-7) /* Receive message is larger than the receive buffer size */
+#define RET_ERRINIT (-8)
+#define RET_ERRREGQUE (-9)
+
+#define RET_EV_NONE (-20) /* No specified event */
+#define RET_EV_MAX (-21) /* Event value exceeds the specified maximum value */
+#define RET_EV_MIN (-22) /* The event value is less than the specified minimum value. */
+
+#define SAPI_EVSET_RELATE 2
+
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+typedef struct FileTime {
+ DWORD dw_low_date_time;
+ DWORD dw_high_date_time;
+} FILETIME;
+typedef FILETIME *PFILETIME;
+typedef FILETIME *LPFILETIME;
+
+typedef struct Overlapped {
+ ULONG_PTR internal;
+ ULONG_PTR internal_high;
+ union {
+ struct {
+ DWORD offset;
+ DWORD offset_high;
+ };
+
+ PVOID pointer;
+ };
+
+ HANDLE h_event;
+} OVERLAPPED;
+typedef OVERLAPPED *LPOVERLAPPED;
+
+typedef struct ComStat {
+ DWORD f_cts_hold : 1;
+ DWORD f_dsr_hold : 1;
+ DWORD f_rlsd_hold : 1;
+ DWORD f_x_off_hold : 1;
+ DWORD f_x_off_sent : 1;
+ DWORD f_eof : 1;
+ DWORD f_txim : 1;
+ DWORD f_reserved : 25;
+ DWORD cb_in_que;
+ DWORD cb_out_que;
+} COMSTAT;
+typedef COMSTAT *LPCOMSTAT;
+
+typedef struct Dcb {
+ DWORD dcb_length; /* sizeof(DCB) */
+ DWORD baud_rate; /* Baudrate at which running */
+ DWORD f_binary: 1; /* Binary Mode (skip EOF check) */
+ DWORD f_parity: 1; /* Enable parity checking */
+ DWORD f_out_x_cts_flow: 1; /* CTS handshaking on output */
+ DWORD f_out_x_dsr_flow: 1; /* DSR handshaking on output */
+ DWORD f_dtr_control: 2; /* DTR Flow control */
+ DWORD f_dsr_sensitivity: 1; /* DSR Sensitivity */
+ DWORD f_tx_continue_on_x_off: 1; /* Continue TX when Xoff sent */
+ DWORD f_out_x: 1; /* Enable output X-ON/X-OFF */
+ DWORD f_in_x: 1; /* Enable input X-ON/X-OFF */
+ DWORD f_error_char: 1; /* Enable Err Replacement */
+ DWORD f_null: 1; /* Enable Null stripping */
+ DWORD f_rts_control: 2; /* Rts Flow control */
+ DWORD f_abort_on_error: 1; /* Abort all reads and writes on Error */
+ DWORD f_dummy2: 17; /* Reserved */
+ WORD w_reserved; /* Not currently used */
+ WORD x_on_lim; /* Transmit X-ON threshold */
+ WORD x_off_lim; /* Transmit X-OFF threshold */
+ BYTE byte_size; /* Number of bits/byte, 4-8 */
+ BYTE parity; /* 0-4=None,Odd,Even,Mark,Space */
+ BYTE stop_bits; /* 0,1,2 = 1, 1.5, 2 */
+ char x_on_char; /* Tx and Rx X-ON character */
+ char x_off_char; /* Tx and Rx X-OFF character */
+ char error_char; /* Error replacement char */
+ char eof_char; /* End of Input character */
+ char evt_char; /* Received Event character */
+ WORD w_reserved1; /* Fill for now. */
+} DCB;
+typedef DCB *LPDCB;
+
+typedef struct CommTimeouts {
+ DWORD read_interval_timeout; /* Maximum time between read chars. */
+ DWORD read_total_timeout_multiplier; /* Multiplier of characters. */
+ DWORD read_total_timeout_constant; /* Constant in milliseconds. */
+ DWORD write_total_timeout_multiplier; /* Multiplier of characters. */
+ DWORD write_total_timeout_constant; /* Constant in milliseconds. */
+} COMMTIMEOUTS;
+typedef COMMTIMEOUTS *LPCOMMTIMEOUTS;
+
+typedef struct {
+ DWORD size; /* Allocated shared memory size */
+ DWORD phy_addr; /* Physical address */
+ HANDLE h_map; /* +8: Handle of file mapping object. */
+ void* p_memory; /* Shared Memory Mapped Address */
+ DWORD owner; /* +16: Owner flag. */
+ HANDLE h_heap; /* +20: Handle of heap for oneself. */
+} SHARED_MEMORY;
+
+typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)(
+ LPVOID lpThreadParameter
+);
+typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
+
+/* Program version storage */
+typedef struct {
+ u_int8 mask_ver[ FROM_FIX_VER_SIZE ]; /* BootLoader programming versions */
+ u_int8 flash_ver1[ FROM_VARI_VER_SIZE ]; /* NK1 programming versions */
+ u_int8 flash_ver2[ FROM_VARI_VER_SIZE ]; /* NK2 programming versions */
+ u_int8 flash_ver3[ FROM_VARI_VER_SIZE ]; /* NK3 programming versions */
+} T_SYS_PRGVER;
+
+/* Device information storage */
+typedef struct {
+ u_int8 _CWORD31__no[ _CWORD31__NO_SIZE ]; /* _CWORD31_ product number */
+ u_int8 reserve1[ RESERVE1_SIZE ]; /* RESERVE1 */
+ u_int8 helpnet_id[ HELPNET_ID_SIZE ]; /* HELPNET ID */
+ u_int8 reserve2[ RESERVE2_SIZE ]; /* RESERVE2 */
+ u_int8 date[ DATE_SIZE ]; /* Manufacturing date and time */
+} T_SYS_DEVINFO;
+
+/* Structure for storing display information */
+typedef struct {
+ int i_width_size; /* Width */
+ int i_height_size; /* Height */
+} DISPLAY_INFO;
+
+/* System error notification message structure */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER bhead; /* Message buffer header */
+ PNO pno; /* Process No. */
+ u_int8 dummy[2]; /* Dummy */
+ int32 errcode; /* Error code */
+} T_SYS_SYSTEMERROR;
+
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+/* Configuration Functions (_pbCommon.cpp) */
+void PbReset(void); /* Soft reset process */
+
+/* Message Sending/Receiving Functions (_pbMsg.cpp) */
+RET_API PbDeleteMsg(PNO pno);
+
+/* SRAM Control Functions (_pbSram.cpp) */
+RET_API PbSramFil32(u_int8 id, u_int32 off, u_int8 pat, u_int32 size);
+RET_API PbSramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size);
+RET_API PbSramSz32(u_int8 id, u_int32 *psize);
+
+/* DRAM Control Functions (_pbDram.cpp) */
+RET_API PbDramWt32(u_int8 id, void *pbuf, u_int32 off, u_int32 size);
+
+/* Semaphore(_pbSem.cpp) */
+RET_API PbDeleteSemaphore(SemID sem_id);
+DWORD PbDeleteMutex(HANDLE h_mutex);
+DWORD PbMutexLock(HANDLE h_mutex, DWORD timeout);
+BOOL PbMutexUnlock(HANDLE h_mutex);
+
+/* Shared Memory Access Functions(_pbMem.cpp) */
+RET_API PbDeleteShareData(char* area_name);
+/* Accessing Physical Memory Area Allocation Data */
+RET_API PbAccessPhysicalMem(u_int32 addr, void **mem_ptr, u_int32 size, u_int32 mode);
+/* Releases access to the physical memory area allocation data. */
+RET_API PbFreePhysicalMem(u_int32 addr, void *mem_ptr, u_int32 size);
+
+LPVOID PbProcessHeapAlloc(DWORD dw_flags, SIZE_T dw_bytes); /* Allocating Memory from the Process Heap */
+BOOL PbProcessHeapFree(DWORD dw_flags, LPVOID lp_mem); /* Free Memory Allocated from Process Heap */
+
+/* Functions Related to Analysis Support Functions(_pbOther.cpp) */
+uint32_t PbGetTid(void);
+uint32_t PbGetLocalTid(void);
+
+/* Other Functions(_pbMisc.cpp) */
+RET_API PbMilliSecSleep(u_int32 ul_mill_time); /* Sleeping of the calling process */
+
+/* TODO As defined in _pbCSection--> */
+VOID PbDeleteCriticalSection(LPCRITICAL_SECTION lp_critical_section);
+VOID PbEnterCriticalSection(LPCRITICAL_SECTION lp_critical_section);
+VOID PbInitializeCriticalSection(LPCRITICAL_SECTION lp_critical_section);
+VOID PbLeaveCriticalSection(LPCRITICAL_SECTION lp_critical_section);
+
+BOOL PbSystemTimeToFileTime(CONST SYSTEMTIME *lp_system_time, LPFILETIME lp_file_time);
+
+
+/* Memory copy Bus release support */
+void* Memset64pSync(void* dest, int c, size_t count);
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_WPF_STD_PRIVATE_H_
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbCommon.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbCommon.h
new file mode 100755
index 0000000..8cd1591
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbCommon.h
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+ * File name : _sysCommon.h
+ * System name : System API
+ * Subsystem name : Common system
+ * Title : Internal header for system API infrastructure management
+ ****************************************************************************/
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBCOMMON_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBCOMMON_H_
+
+#define PBCOM_CONFIGFILE "config" /* Configuration file */
+#define PBCOM_CONFIGSIZE_MAX (1024) /* Configuration file maximum size */
+#define PBCOM_API_NORMAL (0) /* API processing result normal */
+#define PBCOM_API_ERROR (-1) /* API processing result error */
+#define PBCOM_UNICODE_NUL (0x00) /* NULL character codes */
+#define PBCOM_UNICODE_LF (0x0A) /* Line feed character code */
+#define PBCOM_UTOIMAX_NUM (8) /* Maximum font size */
+#define PBCOM_CONFIG_INDEX_SCRWIDTH "[ScreenWidth]" /* Data information "Screen width" */
+#define PBCOM_CONFIG_INDEX_SCRHEIGHT "[ScreenHeight]" /* Data information "Screen Height" */
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBCOMMON_H_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h
new file mode 100755
index 0000000..d0b6d44
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbEvent_Internal.h
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+* $Header:: $
+* $Revision:: $
+*******************************************************************************/
+
+/****************************************************************************
+ * File name : _pbEvent_Internal.h
+ * System name : GPF
+ * Subsystem name : _CWORD64_API Events Feature
+ * Title : Internal definition file for event function
+ ****************************************************************************/
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_
+
+#include <other_service/ev_lib.h>
+
+/*
+ Constant definition
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define MAX_PB_EVENTS 16
+#define MAX_EVENT_NAME_LEN 32
+#define MIN_EVENT_VAL 0x80000000 /* Minimum event value(-2147483648) */
+#define MAX_EVENT_VAL 0x7FFFFFFF /* Maximum event value( 2147483647) */
+#define EVENT_BIT_ZERO 0x00000000 /* Event value All Bit Zero Definition */
+#define MAX_PB_EVENT_WAIT_THREADS 1 /* Values other than 1 are not designed while the EV library is being used. */
+#define EVSET_ABSOLUTE 1 /* Absolute setting */
+#define EVSET_RELATE 2 /* Relative value setting */
+#define EVSET_AND 3 /* AND value setting */
+#define EVSET_OR 4 /* OR setting */
+#define EVWAIT_VAL 1 /* Waiting mode for an event by specifying a range */
+#define EVWAIT_ALLCLR 2 /* Mode to wait for an event when the specified bit is cleared */
+#define EVWAIT_ANYSET 3 /* Mode to wait for an event with a specified set of bits */
+
+#define _CWORD64_EVENT_MAXOPEN_IN_PROCESS 0x7FFFFFFF /* Maximum number of open events in the same process */
+#define _CWORD64_EVENT_MAXOPEN_IN_SYSTEM 0x7FFFFFFF /* Maximum number of the same event open in the system */
+
+#define MAX_EVENT_PROC_NUM (32) /* EVENT Max Processes Used */
+
+/*
+ Structure Definition
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*****************************************************************************
+ * TAG : WAITING_CONDITION
+ * ABSTRACT : Event Status Settings
+******************************************************************************/
+typedef struct {
+ u_int8 uc_use_flag; /* Table Usage Flags(TRUE:Use FALSE:Not used) */
+ u_int8 uc_waiting; /* Event Waiting Flag */
+ /* TRUE Waiting for event */
+ /* FALSE Release Event Wait */
+ u_int16 us_mode; /* Waiting mode */
+ /* EVWAIT_VAL Wait for Value Range */
+ /* EVWAIT_ALLCLR Wait for specified bit to be cleared */
+ /* EVWAIT_ANYSET Waiting for setting the specified bit */
+ u_int32 ul_mask; /* Mask value when waiting for specified bit */
+ int32 l_min_val; /* Minimum value of condition when waiting for value range */
+ int32 l_max_val; /* Maximum value of condition when waiting for value range */
+ int32 l_last_val; /* Events at WaitEvent Return */
+ EV_ID flag_id[MAX_EVENT_PROC_NUM]; /* Event flags(CLS event library) */
+} WAITING_CONDITION; /* Total 28 Bytes. */
+
+/*****************************************************************************
+ * TAG : WAITING_CONDITION
+ * ABSTRACT : Event information storage area
+******************************************************************************/
+typedef struct {
+ TCHAR event_name[MAX_EVENT_NAME_LEN]; /* Maximum number of characters + NULL area */
+ int32 l_event_val;
+ WAITING_CONDITION st_condition[MAX_PB_EVENT_WAIT_THREADS];
+ int32 l_process_ref;
+ int32 l_reset_data;
+ u_int8 uc_manual_reset;
+ u_int8 uc_reserve[3];
+ char name_of_mutex[NAME_MAX];
+ /* TODO: Members for the following EV library use:Structurely strange, but borrowed shared space.Correction is required. */
+ u_int8 proc_cnt;
+} PB_EVENT;
+
+/*****************************************************************************
+ * TAG : PB_EVENT_OPEN_HANDLE
+ * ABSTRACT : Generated event management information
+******************************************************************************/
+typedef struct {
+ HANDLE h_heap;
+ PB_EVENT* p_sys_event;
+ DWORD index;
+ int32 l_thread_ref;
+} PB_EVENT_OPEN_HANDLE;
+
+/*****************************************************************************
+ * TAG : PB_EVENT_INSTANCE
+ * ABSTRACT : Event management table
+******************************************************************************/
+typedef struct {
+ PB_EVENT_OPEN_HANDLE* p_handle_table[MAX_PB_EVENTS];
+ HANDLE h_shared_memory;
+ SemID id_event_table_sem;
+ PB_EVENT* p_event_table;
+} PB_EVENT_INSTANCE;
+
+/*
+ Prototype declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbInternalProc.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbInternalProc.h
new file mode 100755
index 0000000..03bcd03
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbInternalProc.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBINTERNALPROC_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBINTERNALPROC_H_
+
+#define POSITIONINGBASELIBRARY_NON_FD (-1) //!< \~english invalid fd
+#define POSITIONINGBASELIBRARY_MAP_NON_INIT (0) //!< \~english init flag for mmap
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ int32 InitMutexObject(pthread_mutex_t *p_st_mutex);
+
+ HANDLE CreateSharedMemory(TCHAR* name, DWORD size);
+ HANDLE OpenSharedMemory(TCHAR* name, DWORD size);
+ void DeleteAllSharedMemory(void);
+ void* GetSharedMemoryPtr(HANDLE h_shm);
+ void CloseSharedMemory(HANDLE h_shm);
+ void DeleteSharedMemory(TCHAR* name);
+ HANDLE OpenSharedMemoryAtPhysical(DWORD physical_address, DWORD size, DWORD protect);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBINTERNALPROC_H_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbSerial.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbSerial.h
new file mode 100755
index 0000000..1bedfe8
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbSerial.h
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBSERIAL_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBSERIAL_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+/* Prototype */
+BOOL SerialTableInit(void); /* Initialization process for each process */
+BOOL SerialTableTerm(void); /* Termination process for each process */
+BOOL SerialObjectTimeoutAdd(HANDLE h_obj, DWORD dw_read_timeout, DWORD dw_write_timeout); /* Timeout registration process */
+BOOL SerialObjectTimeoutGet(HANDLE h_obj, DWORD*, DWORD*); /* Timeout acquisition processing */
+BOOL SerialObjectWaitmaskAdd(HANDLE h_obj, DWORD dw_mask); /* Mask registration process */
+BOOL SerialObjectWaitmaskGet(HANDLE h_obj, DWORD*); /* Mask acquisition processing */
+BOOL SerialObjectDel(HANDLE h_obj); /* Deletion process */
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBSERIAL_H_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h
new file mode 100755
index 0000000..e4f8eb1
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/_pbWaitforsingleobject.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBWAITFORSINGLEOBJECT_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBWAITFORSINGLEOBJECT_H_
+
+#include <vehicle_service/positioning_base_library.h>
+
+typedef enum {
+ PB_HANDLE_INVAL = 0,
+ PB_HANDLE_MUTEX,
+ PB_HANDLE_PROC_SEMAPHORE,
+ PB_HANDLE_EVENT,
+ PB_HANDLE_THREAD,
+ PB_HANDLE_PROCESS,
+
+ PB_HANDLE_KIND_MAX /* Maximum value range check */
+} HANDLE_KIND;
+
+/* Prototype */
+BOOL WaitObjectInit(void); /* Initialization process for each process */
+BOOL WaitObjectTerm(void); /* Termination process for each process */
+BOOL WaitObjectAdd(HANDLE h_obj, HANDLE_KIND l_kind); /* Registration process */
+BOOL WaitObjectDel(HANDLE h_obj); /* Deletion process */
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBWAITFORSINGLEOBJECT_H_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/sysup.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/sysup.h
new file mode 100755
index 0000000..eafca8e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/sysup.h
@@ -0,0 +1,24 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_H_
+
+#define SYS_RESET (int32)1 /* Make reset */
+#define SYS_ONLY_RESET (int)2 /* Reset only */
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_H_
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/sysup_addr.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/sysup_addr.h
new file mode 100755
index 0000000..9e73bf0
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/sysup_addr.h
@@ -0,0 +1,227 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/************************************************************************
+* File name : sysup_addr.h
+* System name : Integrated PF
+* Subsystem name : Common system
+* Title : Boot-Related Address Definition Header Files
+************************************************************************/
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_ADDR_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_ADDR_H_
+
+/*****************************************************
+ *
+ * Initial management area address space definition
+ * A: Address, S: Size
+ ****************************************************/
+/* Note : Don't forget to change sysup_addr.inc at the same time! */
+
+/* SDRAM startup identification table (1) A Offset from the beginning 0x0 */
+#define ADDR_SYSUP_DRAM1 ((SDRAM_INITIAL_AREA & ADDR_MASK) | ADDR_P2) // NOLINT(runtime/references)
+/* SDRAM startup identification table (1) S */
+#define SIZE_SYSUP_DRAM1 0x00000004
+
+/* SDRAM Start Identification Table A Offset from the beginning 0x4 */
+#define ADDR_SYSUP_DRAM_FIX (ADDR_SYSUP_DRAM1 + SIZE_SYSUP_DRAM1)
+/* SDRAM Start Identification Table S */
+#define SIZE_SYSUP_DRAM_FIX 0x00000004
+
+/* Startup Status Table A Offset from the beginning 0x8 */
+#define ADDR_SYSUP_STS (ADDR_SYSUP_DRAM_FIX + SIZE_SYSUP_DRAM_FIX)
+/* Startup Status Table S */
+#define SIZE_SYSUP_STS 0x00000002
+
+#define ADDR_SYS_DUMMY1 (ADDR_SYSUP_STS + SIZE_SYSUP_STS) /* Dummy1 A Offset from the beginning 0xa */
+#define SIZE_SYS_DUMMY1 0x00000002 /* Dummy1 S */
+
+#define ADDR_UPMODE (ADDR_SYS_DUMMY1 + SIZE_SYS_DUMMY1) /* Boot Mode Save Table A Offset from the beginning 0xc */
+#define SIZE_UPMODE 0x00000004 /* Boot Mode Save Table S */
+
+#define ADDR_SYSUP_STS_GINI (ADDR_UPMODE + SIZE_UPMODE) /* System startup status table A Offset from the beginning 0x10 */
+#define SIZE_SYSUP_STS_GINI 0x00000002 /* System startup status table S */
+
+/* Fork Failures Recording Table A Offset from the beginning 0x12 */
+#define ADDR_SYSUP_RST_CNT (ADDR_SYSUP_STS_GINI + SIZE_SYSUP_STS_GINI)
+/* Fork Failures Recording Table S */
+#define SIZE_SYSUP_RST_CNT 0x00000002
+
+/* System anomaly process No. table A Offset from the beginning 0x14 */
+#define ADDR_SYS_ERR_PNO (ADDR_SYSUP_RST_CNT + SIZE_SYSUP_RST_CNT)
+/* System anomaly process No. table S */
+#define SIZE_SYS_ERR_PNO 0x00000004
+
+/* System error reset cause table A Offset from the beginning 0x18 */
+#define ADDR_SYS_ERR_RST (ADDR_SYS_ERR_PNO + SIZE_SYS_ERR_PNO)
+/* System error reset cause table S */
+#define SIZE_SYS_ERR_RST 0x00000004
+
+/* System startup failure table A Offset from the beginning 0x1c */
+#define ADDR_SYSUP_ERR_STS (ADDR_SYS_ERR_RST + SIZE_SYS_ERR_RST)
+/* System startup failure table S */
+#define SIZE_SYSUP_ERR_STS 0x00000004
+
+/* Navigation activation state table A Offset from the beginning 0x20 */
+#define ADDR_NAVIUP_STS (ADDR_SYSUP_ERR_STS + SIZE_SYSUP_ERR_STS)
+/* Navigation activation state table S */
+#define SIZE_NAVIUP_STS 0x00000002
+
+/* Navigation fork Failed Count Recording Table A Offset from the beginning 0x22*/
+#define ADDR_NAVIUP_RST_CNT (ADDR_NAVIUP_STS + SIZE_NAVIUP_STS)
+/* Navigation fork Failed Count Recording Table S */
+#define SIZE_NAVIUP_RST_CNT 0x00000002
+
+/* Navigation error process No. table A Offset from the beginning 0x24 */
+#define ADDR_NAVI_ERR_PNO (ADDR_NAVIUP_RST_CNT + SIZE_NAVIUP_RST_CNT)
+/* Navigation error process No. table S */
+#define SIZE_NAVI_ERR_PNO 0x00000004
+
+/* Navigation Error Cause Table A Offset from the beginning 0x28 */
+#define ADDR_NAVI_ERR (ADDR_NAVI_ERR_PNO + SIZE_NAVI_ERR_PNO)
+/* Navigation Error Cause Table S */
+#define SIZE_NAVI_ERR 0x00000004
+
+#define ADDR_NAVIUP_ERR_STS (ADDR_NAVI_ERR + SIZE_NAVI_ERR) /* Navigation start failure table A Offset from the beginning 0x2c */
+#define SIZE_NAVIUP_ERR_STS 0x00000004 /* Navigation start failure table S */
+
+/* SDRAM startup identification table (2) A Offset from the beginning 0x30 */
+#define ADDR_SYSUP_DRAM2 (ADDR_NAVIUP_ERR_STS + SIZE_NAVIUP_ERR_STS)
+/* SDRAM startup identification table (2) S */
+#define SIZE_SYSUP_DRAM2 0x00000004
+
+/* SDRAM Backup Status Table A Offset from the beginning 0x34 */
+#define ADDR_SYS_BUP_STS (ADDR_SYSUP_DRAM2 + SIZE_SYSUP_DRAM2)
+/* SDRAM Backup Status Table S */
+#define SIZE_SYS_BUP_STS 0x00000004
+
+/* NAVI-SYS communication error recording table A Offset from the beginning 0x38 */
+#define ADDR_SYSCOM_STS (ADDR_SYS_BUP_STS + SIZE_SYS_BUP_STS)
+/* NAVI-SYS communication error recording table S */
+#define SIZE_SYSCOM_STS 0x00000004
+
+/* SDRAM Power Supply Fault Detection Table A Offset from the beginning 0x3c */
+#define ADDR_SYS_PW_STS (ADDR_SYSCOM_STS + SIZE_SYSCOM_STS)
+/* SDRAM Power Supply Fault Detection Table S */
+#define SIZE_SYS_PW_STS 0x00000004
+
+/* Hard WDT generation table A Offset from the beginning 0x40 */
+#define ADDR_HWDT_STS (ADDR_SYS_PW_STS + SIZE_SYS_PW_STS)
+/* Hard WDT generation table S */
+#define SIZE_HWDT_STS 0x00000004
+
+/* SDRAM Labels Destruct Status Detection Table A Offset from the beginning 0x44 */
+#define ADDR_DRAMLABEL_STS (ADDR_HWDT_STS + SIZE_HWDT_STS)
+/* SDRAM Labels Destruct Status Detection Table S */
+#define SIZE_DRAMLABEL_STS 0x00000004
+
+#define ADDR_SSB_MNG (ADDR_DRAMLABEL_STS + SIZE_DRAMLABEL_STS) /* SSB management table A Offset from the beginning 0x48 */
+#define SIZE_SSB_MNG 0x00000004 /* SSB management table S */
+
+#define ADDR_NMI_END (ADDR_SSB_MNG + SIZE_SSB_MNG) /* NMI completion flag A Offset from the beginning 0x4c */
+#define SIZE_NMI_END 0x00000004 /* NMI completion flag S */
+
+/* Opening indication determination table A Offset from the beginning 0x50 */
+#define ADDR_OPDSP_CHK (ADDR_NMI_END + SIZE_NMI_END)
+/* Opening indication determination table S */
+#define SIZE_OPDSP_CHK 0x00000004
+
+#define ADDR_SYS_FROM_STS (ADDR_OPDSP_CHK + SIZE_OPDSP_CHK) /* FROM destruction status table A Offset from the beginning 0x54 */
+#define SIZE_SYS_FROM_STS 0x00000004 /* FROM destruction status table S */
+
+/* BootLoader status A Offset from the beginning 0x58 */
+#define ADDR_BOOT_STS (ADDR_SYS_FROM_STS + SIZE_SYS_FROM_STS)
+/* BootLoader status S */
+#define SIZE_BOOT_STS 0x00000004
+
+/* BootLoader Exceptions Recording Table A Offset from the beginning 0x5c */
+#define ADDR_BOOTEXP_LOG (ADDR_BOOT_STS + SIZE_BOOT_STS)
+/* BootLoader Exceptions Recording Table S */
+#define SIZE_BOOTEXP_LOG 0x00000004
+
+/* SDRAM startup identification table (3) A Offset from the beginning0x60 */
+#define ADDR_SYSUP_DRAM3 (ADDR_BOOTEXP_LOG + SIZE_BOOTEXP_LOG)
+/* SDRAM startup identification table (3) S */
+#define SIZE_SYSUP_DRAM3 0x00000004
+
+/* Error Logging Table in BootLoader Drivers A Offset from the beginning 0x64 */
+#define ADDR_BOOTERR_LOG (ADDR_SYSUP_DRAM3 + SIZE_SYSUP_DRAM3)
+/* Error Logging Table in BootLoader Drivers S */
+#define SIZE_BOOTERR_LOG 0x00000004
+
+/* EPC register values at the time of exceptions in the BootLoader A Offset from the beginning 0x68 */
+#define ADDR_BOOT_EPC (ADDR_BOOTERR_LOG + SIZE_BOOTERR_LOG)
+/* EPC register values at the time of exceptions in the BootLoader S */
+#define SIZE_BOOT_EPC 0x00000004
+
+/* Status register when exceptions occur in the BootLoader A Offset from the beginning 0x6c */
+#define ADDR_BOOT_SR (ADDR_BOOT_EPC + SIZE_BOOT_EPC)
+/* Status register when exceptions occur in the BootLoader S */
+#define SIZE_BOOT_SR 0x00000004
+
+/* Cause Register Values When Internal BootLoader Exceptions Occur A Offset from the beginning 0x70 */
+#define ADDR_BOOT_CAUSE (ADDR_BOOT_SR + SIZE_BOOT_SR)
+/* Cause Register Values When Internal BootLoader Exceptions Occur S */
+#define SIZE_BOOT_CAUSE 0x00000004
+
+/* NMI completion flag(Copying) A Offset from the beginning 0x74 */
+#define ADDR_NMI_END_CPY (ADDR_BOOT_CAUSE + SIZE_BOOT_CAUSE)
+/* NMI completion flag(Copying) S */
+#define SIZE_NMI_END_CPY 0x00000004
+
+/* Target Type A Offset from the beginning 0x78 */
+#define ADDR_TARGET (ADDR_NMI_END_CPY + SIZE_NMI_END_CPY)
+/* Target Type S */
+#define SIZE_TARGET 0x00000004
+
+#define ADDR_SYS_NR_RST (ADDR_TARGET + SIZE_TARGET) /* Normal reset factor table A 0x7c */
+#define SIZE_SYS_NR_RST 0x00000004 /* Normal reset factor table S */
+
+#define ADDR_NK_LOAD_STS (ADDR_SYS_NR_RST + SIZE_SYS_NR_RST) /* NK Load Status Table A 0x80 */
+#define SIZE_NK_LOAD_STS 0x00000004 /* NK Load Status Table S */
+
+#define ADDR_CRC_RETRY (ADDR_NK_LOAD_STS + SIZE_NK_LOAD_STS) /* CRC retry count table A 0x84 */
+#define SIZE_CRC_RETRY 0x00000004 /* CRC retry count table S */
+
+#define ADDR_BOOT_VBR (ADDR_CRC_RETRY + SIZE_CRC_RETRY) /* VBR-saved table in BootLoaderr A 0x88 */
+#define SIZE_BOOT_VBR 0x00000004 /* VBR-saved table in BootLoaderr S */
+
+#define ADDR_MONI_TYPE (ADDR_BOOT_VBR + SIZE_BOOT_VBR) /* Monitor Type Table A 0x8C */
+#define SIZE_MONI_TYPE 0x00000004 /* Monitor Type Table S */
+
+#define ADDR_B_FLAG (ADDR_MONI_TYPE + SIZE_MONI_TYPE) /* B genuine flag A 0x90 */
+#define SIZE_B_FLAG 0x00000010 /* B genuine flag S */
+
+#define ADDR_RGBCABLE_TYPE (ADDR_B_FLAG + SIZE_B_FLAG) /* Connection RGB Cable Type Table A 0xA0 */
+#define SIZE_RGBCABLE_TYPE 0x0000004 /* Connection RGB Cable Type Table S */
+
+#define ADDR_RESET_LABEL (ADDR_RGBCABLE_TYPE + SIZE_RGBCABLE_TYPE) /* Normal reset label area A 0xA4 */
+#define SIZE_RESET_LABEL 0x00000010 /* Normal reset label area S */
+
+#define ADDR_NK_VUP_FLAG (ADDR_RESET_LABEL + SIZE_RESET_LABEL) /* NK version upgrade flag A 0xB4 */
+#define SIZE_NK_VUP_FLAG 0x00000004 /* NK version upgrade flag S */
+
+#define ADDR_TRANS_VUP (ADDR_NK_VUP_FLAG + SIZE_NK_VUP_FLAG) /* VUP migration flag A */
+#define SIZE_TRANS_VUP 0x00000004 /* VUP migration flag S */
+
+#define ADDR_PRG_SPAR_BOOT (ADDR_TRANS_VUP + SIZE_TRANS_VUP) /* Preliminary program start occurrence flag A */
+#define SIZE_ADDR_PRG_SPAR_BOOT 0x00000004 /* Preliminary program start occurrence flag S */
+
+#define ADDR_BOOT_ERR (ADDR_PRG_SPAR_BOOT + SIZE_ADDR_PRG_SPAR_BOOT) /* OS Pre-boot Error Information Storage Table A */
+#define SIZE_BOOT_ERR 0x00000004 /* OS Pre-boot Error Information Storage Table S */
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_SYSUP_ADDR_H_
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/tchar.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/tchar.h
new file mode 100755
index 0000000..ee45e4d
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/tchar.h
@@ -0,0 +1,256 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TCHAR_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TCHAR_H_
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _T(x) __TEXT(x)
+
+#ifdef UNICODE
+ /* ++++++++++++++++++++ UNICODE ++++++++++++++++++++ */
+
+#define _TEOF WEOF
+
+#define _tmain wmain
+
+#ifdef UNDER_CE
+# define _tWinMain WinMain
+#else
+# define _tWinMain wWinMain
+#endif
+
+ /* Formatted i/o */
+#define _tprintf wprintf
+#define _ftprintf fwprintf
+#define _stprintf swprintf
+#define _sntprintf _snwprintf
+#define _vtprintf vwprintf
+#define _vftprintf vfwprintf
+#define _vstprintf vswprintf
+#define _vsntprintf _vsnwprintf
+#define _tscanf wscanf
+#define _ftscanf fwscanf
+#define _stscanf swscanf
+
+ /* Unformatted i/o */
+#define _fgettc fgetwc
+#define _fgetts fgetws
+#define _fputtc fputwc
+#define _fputts fputws
+#define _gettc getwc
+#define _gettchar getwchar
+#define _getts _getws
+#define _puttc putwc
+#define _puttchar putwchar
+#define _putts _putws
+#define _ungettc ungetwc
+
+#define _tfopen _wfopen
+#define _tfreopen _wfreopen
+
+ /* String conversion functions */
+#define _tcstod wcstod
+#define _tcstol wcstol
+#define _tcstoul wcstoul
+
+#define _itot _itow
+#define _ltot _ltow
+#define _ultot _ultow
+#define _ttoi _wtoi
+#define _ttol _wtol
+#define _ttoi64 _wtoi64
+
+ /* String functions */
+#define _tcscat wcscat
+#define _tcschr wcschr
+#define _tcscmp wcscmp
+#define _tcscpy wcscpy
+#define _tcscspn wcscspn
+#define _tcslen wcslen
+#define _tcsclen wcslen
+
+#define _tcsncat wcsncat
+#define _tcsnccat wcsncat
+#define _tcsnccmp wcsncmp
+#define _tcsncmp wcsncmp
+#define _tcsncpy wcsncpy
+#define _tcsnccpy wcsncpy
+#define _tcspbrk wcspbrk
+#define _tcsrchr wcsrchr
+#define _tcsspn wcsspn
+#define _tcsstr wcsstr
+#define _tcstok wcstok
+#define _tcsdup _wcsdup
+#define _tcsicmp _wcsicmp
+#define _tcsncicmp _wcsnicmp
+#define _tcsnicmp _wcsnicmp
+#define _tcsnset _wcsnset
+#define _tcsncset _wcsnset
+#define _tcsrev _wcsrev
+#define _tcsset _wcsset
+
+#define _tcslwr _wcslwr
+#define _tcsupr _wcsupr
+
+#define _istalpha iswalpha
+#define _istupper iswupper
+#define _istlower iswlower
+#define _istdigit iswdigit
+#define _istxdigit iswxdigit
+#define _istspace iswspace
+#define _istpunct iswpunct
+#define _istalnum iswalnum
+#define _istprint iswprint
+#define _istgraph iswgraph
+#define _istcntrl iswcntrl
+#define _istascii iswascii
+
+#define _totupper towupper
+#define _totlower towlower
+
+#define _istlegal(_c) (1)
+#define _istlead(_c) (0)
+#define _istleadbyte(_c) (0)
+
+#else /* ndef UNICODE */
+
+ /* ++++++++++++++++++++ SBCS (MBCS in Not supported) ++++++++++++++++++++ */
+
+#define _TEOF EOF
+
+ /* Program */
+#define _tmain main
+#define _tWinMain WinMain
+
+ /* Formatted i/o */
+#define _tprintf printf
+#define _ftprintf fprintf
+#define _stprintf sprintf
+#define _sntprintf _snprintf
+#define _vtprintf vprintf
+#define _vftprintf vfprintf
+#define _vstprintf vsprintf
+#define _vsntprintf _vsnprintf
+#define _tscanf scanf
+#define _ftscanf fscanf
+#define _stscanf sscanf
+
+ /* Unformatted i/o */
+#define _fgettc fgetc
+#define _fgetts fgets
+#define _fputtc fputc
+#define _fputts fputs
+#define _gettc getc
+#define _gettchar getchar
+#define _getts gets
+#define _puttc putc
+#define _puttchar putchar
+#define _putts puts
+#define _ungettc ungetc
+
+#define _tfopen _wfopen
+#define _tfreopen _wfreopen
+
+#ifndef UNDER_CE
+
+#define _tcstod strtod
+#define _tcstol strtol
+#define _tcstoul strtoul
+#endif
+
+#define _itot _itoa
+#define _ltot _ltoa
+#define _ultot _ultoa
+#define _ttoi atoi
+#define _ttol atol
+
+#ifndef UNDER_CE
+#define _ttoi64 atoi64
+#endif
+
+ /* String functions */
+#define _tcscat strcat
+#define _tcschr strchr
+#define _tcscmp strcmp
+#define _tcscpy strcpy
+#define _tcscspn strcspn
+#define _tcslen strlen
+#define _tcsclen strlen
+
+#define _tcsncat strncat
+#define _tcsnccat strncat
+#define _tcsnccmp strncmp
+#define _tcsncmp strncmp
+#define _tcsncpy strncpy
+#define _tcsnccpy strncpy
+
+#ifndef UNDER_CE
+
+#define _tcspbrk strpbrk
+#define _tcsrchr strrchr
+#define _tcsspn strspn
+#endif
+
+#define _tcsstr strstr
+#define _tcstok strtok
+
+#ifndef UNDER_CE
+
+#define _tcsdup _strdup
+#define _tcsicmp _stricmp
+#define _tcsncicmp _strnicmp
+#define _tcsnicmp _strnicmp
+#define _tcsnset _strnset
+#define _tcsncset _strnset
+#define _tcsrev _strrev
+#define _tcsset _strset
+#define _tcslwr _strlwr
+#define _tcsupr _strupr
+#endif
+
+#ifndef UNDER_CE
+
+#define _istalpha isalpha
+#define _istupper isupper
+#define _istlower islower
+#define _istdigit isdigit
+#define _istxdigit isxdigit
+#define _istspace isspace
+#define _istpunct ispunct
+#define _istalnum isalnum
+#define _istprint isprint
+#define _istgraph isgraph
+#define _istcntrl iscntrl
+#define _istascii isascii
+#define _totupper toupper
+#define _totlower tolower
+#endif
+
+#endif /* UNICODE */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_TCHAR_H_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h
new file mode 100755
index 0000000..085640a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/WPF_STD.h
@@ -0,0 +1,1653 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_
+
+/**
+ * @file WPF_STD.h
+ * @brief Header file for system standard definitions
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning_base_library
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Incluce *
+ *---------------------------------------------------------------------------------*/
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <wchar.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <native_service/wpf_legacy.h>
+#include <vehicle_service/std_types.h>
+#include <vehicle_service/pos_message_header.h>
+#include <vehicle_service/sys_timerapi.h>
+#include <vehicle_service/positioning_positioningbaselibrarylog.h>
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+#define POS_THREAD_NAME "Positioning" //!< \~english Positioning thread name
+
+#ifdef UNICODE
+#define __TEXT(quote) L##quote
+#else /* UNICODE */
+#define __TEXT(quote) (quote) /* r_winnt */
+#endif /* UNICODE */
+
+#define D_LTEXT(x) __TEXT(x)
+#define LTEXT(x) D_LTEXT(x)
+
+#define DEBUG_DUMP_MAX_SIZE 4096
+//!< \~english FrameworkunifiedOnDebugDump max size
+
+/* Sensor Log Type */
+#define POS_SENSLOG_TYPE_NONE 0 //!< \~english sensor log type NONE
+#define POS_SENSLOG_TYPE_SYS 1 //!< \~english sensor log type SYS
+#define POS_SENSLOG_TYPE_GPS 2 //!< \~english sensor log type GPS
+#define POS_SENSLOG_TYPE_NAV 3 //!< \~english sensor log type NAV
+#define POS_SENSLOG_TYPE_CMD 4 //!< \~english sensor log type CMD
+
+#define POS_SENSLOG_GET_ZONE(typ) \
+ (((typ) == (POS_SENSLOG_TYPE_SYS))?(ZONE_POS_SYS_IN):\
+ ((typ) == (POS_SENSLOG_TYPE_GPS))?(ZONE_POS_GPS_IN):\
+ ((typ) == (POS_SENSLOG_TYPE_NAV))?(ZONE_POS_NAV_IN):\
+ ((typ) == (POS_SENSLOG_TYPE_CMD))?(ZONE_POS_CMD_IN):\
+ (0))
+//!< \~english get sensor log zone code
+
+#define POS_WRITE_SENSLOG(zone, data, len) (((zone) != (0))?((void)((FRAMEWORKUNIFIEDLOG_DATA(zone, data, len)))):((void)(0)))
+//!< \~english write sensor log output
+#define POS_SENSLOG(typ, data, len) (POS_WRITE_SENSLOG(POS_SENSLOG_GET_ZONE(typ), data, len))
+
+/* HW configuration type */
+/*
+ * Note.
+ * This feature needs to be defined by the vendor.
+ */
+#define UNIT_TYPE_NONE 0x00000000UL //!< \~english type none
+#define UNIT_TYPE_UNKNOWN 0x00000001UL //!< \~english type unknown
+#define UNIT_TYPE_GRADE1 0x00000002UL //!< \~english type Grade1
+#define UNIT_TYPE_GRADE2 0x00000004UL //!< \~english type Grade2
+
+#define MAX_NAME_LEN 32 //!< \~english name max length
+#define _CWORD31__NO_SIZE 16 //!< \~english _CWORD31_ No size
+#define RESERVE1_SIZE 16 //!< \~english reserve 1
+#define HELPNET_ID_SIZE 21 //!< \~english helpnet ID size
+#define RESERVE2_SIZE 11 //!< \~english reserve 2
+#define DATE_SIZE 32 //!< \~english make time size
+#define SERIAL_NO_SIZE 3 //!< \~english serial No size
+#define PRODUCT_NAME_SIZE 1 //!< \~english product name size
+
+#define _pb_memcpy memcpy
+#define _pb_memset memset
+
+/* RET_API define */
+#define RET_NORMAL 0 //!< \~english normal return
+#define RET_ERROR (-1) //!< \~english error return
+#define RET_ERRPARAM (-2) //!< \~english parameter error
+
+#define SAPI_EVSET_ABSOLUTE 1 //!< \~english absolute vale set
+#define SAPI_EVWAIT_VAL 1 //!< \~english event wait value set
+
+/* sys common commandID definition */
+#define CID_GPS_BASE (CID)0xF030
+//!< \~english GPS
+
+#define CID_TIMER_BASE (CID)0xF040
+//!< \~english timer management
+
+#define CID_INITIAL_BASE (CID)0xF100
+//!< \~english initial
+
+/* ResourceManager/CID definition */
+#define CID_GPS_SERIAL0 (CID)0x0100
+//!< \~english GPS reset request func definition
+
+#define CID_GPS_REQRESET (CID)(CID_GPS_BASE | CID_GPS_SERIAL0)
+//!< \~english GPS reset request CID
+
+
+/* sys common commandID detail definition */
+#define CID_COM_SERIAL4 (CID)0x0004
+//!< \~english serial command ID 4
+
+#define CID_COM_SERIAL6 (CID)0x0006
+//!< \~english serial command ID 6
+
+#define CID_COM_SERIAL7 (CID)0x0007
+//!< \~english serial command ID 7
+
+/* initial CID definition */
+#define CID_INI_SYSTEMERR (CID)(CID_INITIAL_BASE | CID_COM_SERIAL6)
+//!< \~english system abnormality notify
+
+#define CID_INI_INTERNAL_ACCOFF_START (CID)(CID_INITIAL_BASE | CID_COM_SERIAL7)
+//!< \~english internal ACC-OFF start Indication
+
+/* timer control CID definition */
+#define CID_TIMER_TOUT (CID)(CID_TIMER_BASE | CID_COM_SERIAL4)
+//!< \~english timeout notify
+
+
+/* PNO definition */
+#define PNO_NONE 0x0000 //!< \~english initial value
+
+#define PNO__CWORD88___CWORD23_ 0x0100
+//!< \~english _CWORD23_ primary thread
+#define PNO_GINI_MAIN 0x0300
+//!< \~english G initial
+#define PNO_CLK_GPS 0x0316
+//!< \~english clock GPS thread
+#define PNO_VEHICLE_SENSOR 0x0363
+//!< \~english vehicle sensor thread
+#define PNO_LINE_SENS_DRV 0x0364
+//!< \~english line sensor driver thread
+#define PNO_NAVI_GPS_MAIN 0x0440
+//!< \~english GPS communication manager thread
+#define PNO_NAVI_GPS_RCV 0x0441
+//!< \~english GPS receive thread
+#define PNO__CWORD83_ 0x0900
+//!< \~english _CWORD83_(Intersystem Communication Message)thread
+
+#define SYS_PNO_MIN PNO__CWORD88___CWORD23_
+//!< \~english minimum PNO.(normal process)
+#define SYS_PNO_MAX PNO__CWORD83_
+//!< \~english maximum PNO.(normal process)
+
+/*---------------------------------------------------------------------------------*
+ * Typedef declaration *
+ *---------------------------------------------------------------------------------*/
+typedef u_int32 EventID;
+typedef int32 RET_API; //!< \~english _CWORD64_API return code
+typedef u_int32 event_id;
+typedef event_id SemID; //!< \~english semaphore ID
+typedef u_int16 CID; //!< \~english command ID
+
+typedef uint32_t UNIT_TYPE; //!< \~english unit type data type define
+typedef int32 ANA_RET_API;
+
+typedef char TCHAR;
+
+/**
+ * @enum _RcvMsgMode
+ * \~english mode of receive message
+ */
+typedef enum {
+ RM_WAIT, //!< \~english wait until received message
+ RM_CHECKRCV //!< \~english do not wait message, return
+} _RcvMsgMode;
+
+/**
+ * @enum
+ * \~english definition of event reset mode
+ */
+enum {
+ _CWORD64_EVENT_MANUALRESET_OFF = 0, //!< \~english manual reset off
+ _CWORD64_EVENT_MANUALRESET_ON, //!< \~english manual reset on
+ _CWORD64_EVENT_MANUALRESET_MAX //!< \~english manual reset max value
+};
+
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @struct _SECURITY_ATTRIBUTES
+ * \~english security attribute
+ */
+typedef struct _SECURITY_ATTRIBUTES {
+ DWORD nLength; //!< \~english length
+ LPVOID lpSecurityDescriptor; //!< \~english data pointer
+ BOOL bInheritHandle; //!< \~english inherited handle
+} SECURITY_ATTRIBUTES;
+typedef SECURITY_ATTRIBUTES *PSECURITY_ATTRIBUTES; //!< \~english security attribute
+typedef SECURITY_ATTRIBUTES *LPSECURITY_ATTRIBUTES; //!< \~english security attribute
+
+/*---------------------------------------------------------------------------------*
+ * Prototype Declaration *
+ *---------------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Create event by specified name
+///
+/// \~english @param [in] ucManualReset
+/// - u_int8 manual reset mode
+/// \~english @param [in] lInitData
+/// - int32 event value
+/// \~english @param [in] cpEventName
+/// - char* event name
+///
+/// \~english @par
+/// - manual reset mode(ucManualReset)
+/// - _CWORD64_EVENT_MANUALRESET_OFF manual reset OFF
+/// - _CWORD64_EVENT_MANUALRESET_ON manual reset ON
+///
+/// \~english @retval 0 event create failed
+/// \~english @retval not 0 created event ID
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter cpEventName is NULL
+/// - The parameter ucManualReset is more than or equal _CWORD64_EVENT_MANUALRESET_MAX
+/// - The string of parameter cpEventName has no text
+/// - The string length of parameter cpEventName is longer than MAX_EVENT_NAME_LEN
+/// - The event is created in same process, but the count of thread reference to the event is reach to the max
+/// - The event is created in system, but the count of process reference to the event is reach to the max
+/// - Memory allocate failed for creating event table
+/// - During create the event table, the event flag register failed
+/// - The event table is full
+///
+/// \~english @par Detail
+/// - Call this API to create event and return the created event ID.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+EventID _pb_CreateEvent(u_int8 ucManualReset, int32 lInitData, char *cpEventName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Wait for the event specified by ID
+///
+/// \~english @param [in] eventID
+/// - EventID event ID
+/// \~english @param [in] lWaitMode
+/// - int32 event wait mode
+/// \~english @param [in] lMinVal
+/// - int32 event wait min value
+/// \~english @param [in] lMaxVal
+/// - int32 event wait max value
+/// \~english @param [out] plEventVal
+/// - int32* event wait value output pointer
+/// \~english @param [in] ulMillSecTime
+/// - u_int32 timeout time(ms)
+///
+/// \~english @par
+/// - event wait mode(lWaitMode)
+/// - SAPI_EVWAIT_VAL
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_EV_NONE parameter error or specified event not exist
+/// \~english @retval RET_ERRTIMEOUT timeout
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter plEventVal is NULL
+/// - The parameter eventID is more than MAX_PB_EVENTS
+/// - The specified event has not been registered in event table
+/// - The count of threads which is waiting this event is reach max
+/// - The parameter ulMillSecTime is 0
+/// - The parameter ulMillSecTime is INFINITE, and wait event flag failed
+/// - The parameter ulMillSecTime is not INFINITE, and timeout
+/// - The parameter ulMillSecTime is not INFINITE, and get event flag failed
+///
+/// \~english @par Detail
+/// - Call this API to wait event.
+/// - This API will return after timeout or this event been set.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_WaitEvent(EventID eventID, int32 lWaitMode, int32 lMinVal,
+ int32 lMaxVal, int32* plEventVal, u_int32 ulMillSecTime);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Set the value of event specified by ID
+///
+/// \~english @param [in] eventID
+/// - EventID event ID
+/// \~english @param [in] lSetMode
+/// - int32 event value set mode
+/// \~english @param [in] iVal
+/// - int32 event value
+///
+/// \~english @par
+/// - event value set mode(lSetMode)
+/// - SAPI_EVSET_ABSOLUTE absolute value set(set parameter value)
+/// - SAPI_EVSET_RELATE offset set(offset of current value set)
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_EV_NONE specified event not exist
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter eventID is more than MAX_PB_EVENTS
+/// - The specified event has not been registered in event table
+/// - The parameter lSetMode is neither SAPI_EVSET_ABSOLUTE nor SAPI_EVSET_RELATE
+///
+/// \~english @par Detail
+/// - Call this API to set event value.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_SetEvent(EventID eventID, int32 lSetMode, int32 lval);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Destroy the event specified by ID
+///
+/// \~english @param [in] eventID
+/// - EventID event ID
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERROR event flag destroy failed
+/// \~english @retval RET_EV_NONE specified event not exist
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter eventID is more than MAX_PB_EVENTS
+/// - The specified event has not been registered in event table
+/// - Event flag destroy failed
+///
+/// \~english @par Detail
+/// - Call this API to destroy specified event.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_DeleteEvent(EventID eventID);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Initialization before call Base API(every process used Base API should call this API firstly).
+///
+/// \~english @param [in] hApp
+/// - HANDLE app Handle
+///
+/// \~english @retval RET_NORMAL normal return
+///
+/// \~english @par Precondition
+/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the dispatcher for App are completed.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to initialize Base API.
+/// - Every process used Base API should call this API firstly.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_Setup_CWORD64_API(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Terminate current thread.
+///
+/// \~english @param [in] dwExitCode
+/// - DWORD exit code(not used)
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - None
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to terminate current thread.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+VOID _pb_ExitThread(DWORD dwExitCode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Create the message queue
+///
+/// \~english @param [in] eventID
+/// - EventID process No
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter pno is 0
+/// - The name length of thread called this API is longer than MAX_QUEUE_NAME_SIZE
+///
+/// \~english @par Detail
+/// - Call this API to create the message queue.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_CreateMsg(PNO pno);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Send message in process
+///
+/// \~english @param [in] pno
+/// - PNO process No
+/// \~english @param [in] size
+/// - u_int16 message size
+/// \~english @param [in] msgbuf
+/// - void* message buffer
+/// \~english @param [in] mode
+/// - u_int16 not used
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter msgbuf is NULL
+/// - The parameter pno is 0
+/// - The message queue specified by parameter pno has not been created
+/// - Get sender Handle failed
+/// - Send message failed
+///
+/// \~english @par Detail
+/// - Call this API to send message in process.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_SndMsg(PNO pno, u_int16 size, void* msgbuf, u_int16 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Send message between process
+///
+/// \~english @param [in] name
+/// - PCSTR destination process name
+/// \~english @param [in] cid
+/// - CID command ID
+/// \~english @param [in] size
+/// - u_int16 message size
+/// \~english @param [in] msgbuf
+/// - const void* message buffer
+/// \~english @param [in] mode
+/// - u_int16 not used
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter name is NULL
+/// - The parameter msgbuf is NULL
+/// - The length of parameter name is longer than MAX_QUEUE_NAME_SIZE
+/// - Get sender Handle failed
+/// - Send message failed
+///
+/// \~english @par Detail
+/// - Call this API to send message between process.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_SndMsg_Ext(PCSTR name, CID cid, u_int16 size, const void* msgbuf, u_int16 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Create semaphore by specified name
+///
+/// \~english @param [in] semName
+/// - char* semaphore name
+///
+/// \~english @retval 0 semaphore create failed
+/// \~english @retval not 0 created semaphore ID
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter semName is NULL
+/// - The string of parameter semName has no text
+/// - The string length of parameter semName is longer than MAX_SEMAPHORE_NAME_LEN
+/// - Memory allocate failed for creating semaphore table
+/// - The semaphore table is full
+///
+/// \~english @par Detail
+/// - Call this API to create semaphore and return the created semaphore ID.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+SemID _pb_CreateSemaphore(char* semName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Semaphore lock
+///
+/// \~english @param [in] semID
+/// - SemID semaphore ID
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_OSERROR error return
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter semName is 0
+/// - The parameter semName is more than MAX_PB_SEMAPHORES
+/// - The specified semaphore has not been registered in semaphore table
+/// - The specified semaphore's mutex has not been created
+/// - The specified semaphore's mutex lock failed
+///
+/// \~english @par Detail
+/// - Call this API to get semaphore.
+/// - This API will return after got semaphore.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_SemLock(SemID semID);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Semaphore unlock
+///
+/// \~english @param [in] semID
+/// - SemID semaphore ID
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_OSERROR error return
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter semName is 0
+/// - The parameter semName is more than MAX_PB_SEMAPHORES
+/// - The specified semaphore has not been registered in semaphore table
+/// - The specified semaphore's mutex has not been created
+/// - The specified semaphore's mutex release failed
+///
+/// \~english @par Detail
+/// - Call this API to relesae semaphore.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_SemUnlock(SemID semID);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Create Share Data
+///
+/// \~english @param [in] area_name
+/// - char* share data name
+/// \~english @param [in] size
+/// - u_int32 data size
+/// \~english @param [out] mem_ptr
+/// - void** share memory pointer
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERROR error return
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter area_name is NULL
+/// - The parameter mem_ptr is NULL
+/// - The string of parameter area_name has no text
+/// - The string length of parameter area_name is longer than MAX_AREA_NAME_LEN
+/// - The parameter size is 0
+/// - The specified share data has already been created
+/// - Memory allocate failed for creating share data
+/// - The specified share data file create failed
+///
+/// \~english @par Detail
+/// - Call this API to create share data.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_CreateShareData(char* area_name, u_int32 size, void** mem_ptr);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Link Share Data
+///
+/// \~english @param [in] area_name
+/// - char* share data name
+/// \~english @param [out] mem_ptr
+/// - void** share memory pointer
+/// \~english @param [in] size
+/// - u_int32* data size
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERROR error return
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter area_name is NULL
+/// - The parameter mem_ptr is NULL
+/// - The string of parameter area_name has no text
+/// - The string length of parameter area_name is longer than MAX_AREA_NAME_LEN
+/// - The parameter size is NULL
+/// - Memory allocate failed for linking share data
+/// - The specified share data file open failed
+///
+/// \~english @par Detail
+/// - Call this API to link share data.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_LinkShareData(char* area_name, void** mem_ptr, u_int32* size);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Start timer
+///
+/// \~english @param [in] SndPno
+/// - PNO source process No
+/// \~english @param [in] TimerSeq
+/// - u_int16 timer sequence No
+/// \~english @param [in] TimerType
+/// - u_int8 timer type
+/// \~english @param [in] TimeOut
+/// - u_int32 timeout time
+///
+/// \~english @par
+/// - timer type(TimerType)
+/// - TIMER_TYPE_SYN fixed term timer
+/// - TIMER_TYPE_USN asynchronous timer
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - Initialization of positioning_base_library has not been done in current process
+/// - The parameter TimerType is neither TIMER_TYPE_SYN nor TIMER_TYPE_USN
+/// - The parameter TimeOut is 0
+/// - The same timer has already been started
+/// - Timer start failed
+///
+/// \~english @par Detail
+/// - Call this API to start timer.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_ReqTimerStart(PNO SndPno, u_int16 TimerSeq, u_int8 TimeType, u_int32 TimeOut);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Stop timer
+///
+/// \~english @param [in] SndPno
+/// - PNO source process No
+/// \~english @param [in] TimerSeq
+/// - u_int16 timer sequence No
+/// \~english @param [in] TimerType
+/// - u_int8 timer type
+///
+/// \~english @par
+/// - timer type(TimerType)
+/// - TIMER_TYPE_SYN fixed term timer
+/// - TIMER_TYPE_USN asynchronous timer
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERROR error return
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - Initialization of positioning_base_library has not been done in current process
+/// - Timer stop failed
+///
+/// \~english @par Detail
+/// - Call this API to stop timer.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_TimerStop(PNO SndPno, u_int16 TimerSeq, u_int8 TimeType);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Create mutex
+///
+/// \~english @param [in] lpMutexAttributes
+/// - LPSECURITY_ATTRIBUTES not used
+/// \~english @param [in] bInitialOwner
+/// - BOOL not used
+/// \~english @param [in] lpName
+/// - LPCTSTR mutex name
+///
+/// \~english @retval NULL error return
+/// \~english @retval Except NULL created mutex Handle
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter lpName is NULL
+/// - The string length of pamareter lpName is longer than NAME_MAX
+/// - Mutex lock map failed
+///
+/// \~english @par Detail
+/// - Call this API to create mutex.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE _pb_CreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCTSTR lpName);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get message management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+/// \~english @param [in/out] pLen
+/// - uint8_t* output buffer size
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get message management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugMsgMngTbl(void* pBuf, uint8_t* pLen);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get mutex management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+/// \~english @param [in/out] pLen
+/// - uint8_t* output buffer size
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get mutex management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugMutexMngTbl(void* pBuf, uint8_t* pLen);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get timer management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get timer management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugTimerMngTbl(void* pBuf);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get event management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+/// \~english @param [in/out] pLen
+/// - uint8_t* output buffer size
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get event management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugEventMngTbl(void* pBuf, uint8_t* pLen);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get memory management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get memory management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugMemoryMngTbl(void* pBuf);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get common info management table dump info.
+///
+/// \~english @param [out] pBuf
+/// - void* output buffer
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get common info management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_GetDebugOtherMngTbl(void* pBuf);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get current app Handle.
+///
+/// \~english @param None
+///
+/// \~english @retval 0 get Handle failed
+/// \~english @retval not 0 Handle
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - Current app Handle has not been registered
+///
+/// \~english @par Detail
+/// - Call this API to get current app Handle.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+HANDLE _pb_GetAppHandle(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Set current app Handle.
+///
+/// \~english @param [in] hApp
+/// - HANDLE app Handle
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get common info management table dump info.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_SetAppHandle(HANDLE hApp);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Base API stop process(every process used Base API should call this API before stop).
+///
+/// \~english @param None
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to stop Base API.
+/// - Every process used Base API should call this API before stop.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_Teardown_CWORD64_API(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Terminate current process.
+///
+/// \~english @param [in] pFunc
+/// - char* source function
+/// \~english @param [in] line
+/// - int source line
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - None
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to terminate current process.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_Exit_d(const char* pFunc, int line);
+#define _pb_Exit() _pb_Exit_d(__func__, __LINE__)
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Receive message.
+///
+/// \~english @param [in] pno
+/// - PNO process No
+/// \~english @param [in] size
+/// - u_int16 message size
+/// \~english @param [out] msgbuf
+/// - void* message buffer
+/// \~english @param [in] mode
+/// - u_int16 not used
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter msgbuf is NULL
+/// - The parameter pno is 0
+/// - The message queue specified by parameter pno has not been created
+/// - Receive message failed
+/// - Receive message successrully, but the received message size is longer than parameter size
+/// - Get received message data failed
+///
+/// \~english @par Detail
+/// - Call this API to receive message of specified pno.
+/// - This API will return after received message.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_RcvMsg(PNO pno, u_int16 size, void** msgbuf, u_int16 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get send buffer for message transferring in process
+///
+/// \~english @param [in] pno
+/// - PNO process No
+/// \~english @param [out] pSndBuf
+/// - void** send buffer
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter pno is 0
+/// - The message queue specified by parameter pno has not been created
+/// - Get sender Handle failed
+/// - Get send buffer failed
+///
+/// \~english @par Detail
+/// - Call this API to get send buffer for message transferring in process.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_GetZcSndBuf(PNO pno, void** pSndBuf);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Send message in process
+///
+/// \~english @param [in] pno
+/// - PNO process No
+/// \~english @param [in] size
+/// - u_int16 message size
+/// \~english @param [in] mode
+/// - u_int16 not used
+///
+/// \~english @retval RET_NORMAL normal return
+/// \~english @retval RET_ERRPARAM parameter error
+/// \~english @retval RET_ERROR other error
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter pno is 0
+/// - The message queue specified by parameter pno has not been created
+/// - Get sender Handle failed
+/// - Get send buffer failed
+/// - Set send buffer failed
+/// - Send message failed
+///
+/// \~english @par Detail
+/// - Call this API to send message in process.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+RET_API _pb_ZcSndMsg(PNO pno, u_int16 size, u_int16 mode);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Convert process name to pno
+///
+/// \~english @param [in] name
+/// - PCSTR process name
+///
+/// \~english @retval 0 convert failed
+/// \~english @retval not 0 converted PNO
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter name is NULL
+/// - The size of parameter name is longer than THREAD_NAME_LEN_MAX
+///
+/// \~english @par Detail
+/// - Call this API to convert process name to pno.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+PNO _pb_CnvName2Pno(PCSTR name);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Convert pno to process name
+///
+/// \~english @param [in] pno
+/// - PNO process No
+///
+/// \~english @retval NULL convert failed
+/// \~english @retval not NULL converted process name
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Failure condition
+/// - The parameter pno has not been registered(not the return pno of _pb_CnvName2Pno).
+///
+/// \~english @par Detail
+/// - Call this API to convert pno to process name.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Sync
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+PCSTR _pb_CnvPno2Name(PNO pno);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get message resource
+///
+/// \~english @param None
+///
+/// \~english @retval TRUE normal return
+/// \~english @retval FALSE error(lack of resource)
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get message resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL _pb_GetMsgResource(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get mutex resource
+///
+/// \~english @param None
+///
+/// \~english @retval TRUE normal return
+/// \~english @retval FALSE error(lack of resource)
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get mutex resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL _pb_GetMutexResource(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Get common resource
+///
+/// \~english @param None
+///
+/// \~english @retval TRUE normal return
+/// \~english @retval FALSE error(lack of resource)
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to get common resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+BOOL _pb_GetOtherResource(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Release message resource
+///
+/// \~english @param None
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to release message resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_ReleaseMsgResource(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Release mutex resource
+///
+/// \~english @param None
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to release mutex resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_ReleaseMutexResource(void);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup positioning_base_library
+/// \~english @par Brief
+/// - Release common resource
+///
+/// \~english @param None
+///
+/// \~english @retval None
+///
+/// \~english @par Precondition
+/// - positioning_base_library initialization are completed \n
+/// (_pb_Setup_CWORD64_API has already been called) in current process.
+///
+/// \~english @par changes of the internal status
+/// - There is no changes of the internal status by this API
+///
+/// \~english @par Detail
+/// - Call this API to release common resource.
+/// \n
+///
+/// \~english @par Classification
+/// - Public
+///
+/// \~english @par Type
+/// - Fire and Forget
+///
+////////////////////////////////////////////////////////////////////////////////////////////
+void _pb_ReleaseOtherResource(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/ // end of positioning_base_library
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h
new file mode 100755
index 0000000..b6af335
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/pos_message_header.h
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _POS_MESSAGE_HEADER_ // NOLINT(build/header_guard)
+#define _POS_MESSAGE_HEADER_
+
+/**
+ * @file pos_message_header.h
+ * @brief Header file for message data definitions
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning_base_library
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <sys/types.h>
+
+/**
+ * @struct T_APIMSG_HEADER
+ * \~english _CWORD64_API message header structure
+ */
+typedef struct {
+ uint16_t replyid; //!< \~english message send result notify dest ID
+ uint16_t sndpno; //!< \~english message send source process No
+ uint16_t respno; //!< \~english message response process No
+ uint16_t cid; //!< \~english message command ID
+ uint16_t msgbodysize; //!< \~english message body size
+ uint8_t rid; //!< \~english message resource ID */
+ uint8_t reserve; //!< \~english reserve
+ uint8_t filler[2]; //!< \~english filter
+} T_APIMSG_HEADER;
+
+/**
+ * @struct T_APIMSG_MSGBUF_HEADER
+ * \~english _CWORD64_API message buffer header structure
+ */
+typedef struct {
+ uint32_t signo; //!< \~english signal No, _pb_SndMsg to set 0
+ T_APIMSG_HEADER hdr; //!< \~english message header
+} T_APIMSG_MSGBUF_HEADER;
+
+/**
+ * @struct _CWORD64_MSG_LOG_HDR
+ * \~english _CWORD64_API message log header structure
+ */
+typedef struct {
+ uint32_t kickTime; //!< \~english kick time
+ uint32_t srCid; //!< \~english message command ID
+ uint32_t pno; //!< \~english process No
+ uint32_t dataBytes; //!< \~english data size
+} _CWORD64_MSG_LOG_HDR;
+
+/** @}*/ // end of positioning_base_library
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // _POS_MESSAGE_HEADER_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h
new file mode 100755
index 0000000..c6ce3ce
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_base_library.h
@@ -0,0 +1,46 @@
+//
+// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+
+#ifndef VEHICLESERVICE_POSITIONINGBASELIBRARY_H_ // NOLINT(build/header_guard)
+#define VEHICLESERVICE_POSITIONINGBASELIBRARY_H_ // NOLINT(build/header_guard)
+
+/**
+ * @file positioning_base_library.h
+ * @brief Common header of positioning_base_library
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning_base_library
+ * @ingroup vehicle_service
+ * @{
+ */
+
+#include <vehicle_service/WPF_STD.h>
+#include <vehicle_service/sys_timerapi.h>
+#include <vehicle_service/std_types.h>
+#include <vehicle_service/pos_message_header.h>
+
+/** @}*/ // end of positioning_base_library
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // VEHICLESERVICE_POSITIONINGBASELIBRARY_H_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h
new file mode 100755
index 0000000..b0fd4e1
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/positioning_positioningbaselibrarylog.h
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file has been generated automatically.
+ * User hand written code entry is not allowed. Do not modify the file content.
+ *
+ */
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_POSITIONING_POSITIONINGBASELIBRARYLOG_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_POSITIONING_POSITIONINGBASELIBRARYLOG_H_
+
+/* Include Files */
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_APP ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_POS_SYS_IN ZONE_SP_ZONE_99
+#define ZONE_POS_GPS_IN ZONE_SP_ZONE_100
+#define ZONE_POS_CMD_IN ZONE_SP_ZONE_101
+#define ZONE_POS_NAV_IN ZONE_SP_ZONE_102
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "StateMachine Example"
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) /* LPRINT, LMSGQ, LSLOGGER */
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INIT, ZONE_ERR, ZONE_14, ZONE_INFO, ZONE_POS_SYS_IN, ZONE_POS_GPS_IN, ZONE_POS_CMD_IN, \
+ ZONE_POS_NAV_IN
+#endif
+
+#define PS_APPNAME_MAX 12
+extern const CHAR kAppName[PS_APPNAME_MAX];
+
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_POSITIONING_POSITIONINGBASELIBRARYLOG_H_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h
new file mode 100755
index 0000000..41ebbc8
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/std_types.h
@@ -0,0 +1,55 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_STD_TYPES_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_STD_TYPES_H_
+
+/**
+ * @file std_types.h
+ * @brief Header file for base type definitions
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning_base_library
+ * @ingroup vehicle_service
+ * @{
+ */
+
+typedef signed char int8;
+typedef unsigned char u_int8;
+typedef signed short int int16;
+typedef unsigned short int u_int16;
+typedef signed int int32;
+typedef unsigned int u_int32;
+typedef float float_t;
+typedef double double_t;
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+/** @}*/ // end of positioning_base_library
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_STD_TYPES_H_
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h
new file mode 100755
index 0000000..03a24ff
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/include/vehicle_service/sys_timerapi.h
@@ -0,0 +1,359 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_SYS_TIMERAPI_H_
+#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_SYS_TIMERAPI_H_
+
+/**
+ * @file sys_timerapi.h
+ * @brief Header file for timer management
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup vehicle_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup positioning_base_library
+ * @ingroup vehicle_service
+ * @{
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Definition *
+ *---------------------------------------------------------------------------------*/
+
+#define WTM_DUPTIME_MAX 5 //!< \~english duplication timer max count
+
+#define TIMER_TYPE_SYN 1
+//!< \~english fixing cycle timer(unit: 100ms)
+#define TIMER_TYPE_USN 2
+//!< \~english asynchronous timer(unit: 100ms)
+#define TIMER_TYPE_ALM 5 //!< \~english specific time timer
+
+#define SUN 0 //!< \~english sunday
+#define MON 1 //!< \~english monday
+#define TUE 2 //!< \~english tuesday
+#define WED 3 //!< \~english wednesday
+#define THU 4 //!< \~english thursday
+#define FRI 5 //!< \~english friday
+#define SAT 6 //!< \~english saturday
+#define DEFAULT_DIFFTIME 0x00 //!< \~english time difference value of japan
+
+#define GPS_SAT 0x00 //!< \~english corrected GPS time
+#define GPS_IST 0x01 //!< \~english not corrected GPS time
+#define GPS_RTC 0x02 //!< \~english RTC time
+#define GPS_IRG 0x03 //!< \~english initial time
+#define GPS_NON 0x7E //!< \~english GPS unused
+#define GPS_IGN 0x7F //!< \~english time not received
+
+#define END_TIMER_RPT_OFF 0 //!< \~english No continuation
+#define END_TIMER_RPT_ON 1 //!< \~english With continuation
+
+#define CID_TIMER_SETGPS 0x4040
+//!< \~english command ID of GPS setting timer
+#define CID_TIMER_DIFSET 0x4045
+//!< \~english command ID of time difference setting timer
+#define CID_TIMER_CYCLE (CID)(CID_TIMER_BASE | CID_COM_SERIAL5)
+//!< \~english command ID of cycle data receive timer
+
+#define CNV_YEAR_MAX 136
+//!< \~english max value of conversion year(number of years + 1)
+#define SEC_PER_MIN 60 //!< \~english 60[sec]
+#define SEC_PER_HOUR 3600 //!< \~english 60[min] * 60[sec]
+#define SEC_PER_DAY 86400 //!< \~english 24[h] * 60[min] * 60[sec]
+
+#define TIM_ROLOVR_DISABLE 0 //!< \~english GPS week rollover correct prohibition
+#define TIM_ROLOVR_ENABLE 1 //!< \~english GPS week rollover correct permission
+
+/*
+ * Definition
+ * \~english timer manager error definition
+ */
+#define RET_ERR_NONEINIT (-30) //!< \~english initialization untreated error
+#define RET_ERR_SEMLOCK (-31) //!< \~english get semaphore error
+#define RET_ERR_SEMUNLOCK (-32) //!< \~english open semaphore error
+#define RET_ERR_SRAMREAD (-33) //!< \~english read SRAM error
+
+/*
+ * Definition
+ * \~english command notify information definition(almanac abnormality notify, and time enable notify)
+ */
+#define TIM_NUM_SNDCMD 4 //!< \~english command send number
+
+#define NON_TIMEUNIT_INVALID_TIME 0
+//!< \~english No time manager unit - system time not set
+#define NON_TIMEUNIT_VALID_TIME 1
+//!< \~english No time manager unit - system time set complete
+#define GPS_INVALID_TIME 2
+//!< \~english With GPS unit - system time not set
+#define GPS_VALID_TIME 3
+//!< \~english With GPS unit - system time set complete
+
+#define TMT_RETRY 3 //!< \~english retry count
+#define TMT_RETRY_INTERVAL 500 //!< \~english retry interval(500[msec])
+
+
+/*---------------------------------------------------------------------------------*
+ * Struct declaration *
+ *---------------------------------------------------------------------------------*/
+
+/**
+ * \~english define data type
+ */
+typedef struct {
+ u_int32 TimeOut[WTM_DUPTIME_MAX]; //!< \~english timeout value
+ u_int8 ContFlg; //!< \~english continue flag
+ u_int8 Dummy1; //!< \~english dummy data
+ u_int16 Dummy2; //!< \~english dummy data
+} TimerDupData;
+
+/**
+ * @struct RealTimeData
+ * \~english current time data
+ */
+typedef struct {
+ u_int16 Yyear; //!< \~english current time(year:A.D.)
+ u_int8 Mmonth; //!< \~english (month)
+ u_int8 Dday; //!< \~english (day)
+ u_int8 Hhour; //!< \~english (hour)
+ u_int8 Mmin; //!< \~english (min)
+ u_int8 Ssec; //!< \~english (sec)
+ u_int8 Wweek; //!< \~english (week)
+ u_int8 CrtFlg; //!< \~english GPS time not corrected/corrected flag
+ u_int8 CrtHou; //!< \~english the last correction(hour)
+ u_int8 CrtMin; //!< \~english min
+ u_int8 CrtSec; //!< \~english sec
+} RealTimeData;
+
+/**
+ * @struct RealTimeDataBcd
+ * \~english current time data(BCD format)
+ */
+typedef struct {
+ u_int16 Yyear; //!< \~english current time(year:A.D.BCD ex.0x1998)
+ u_int8 Mmonth; //!< \~english (month BCD 0x01 to 0x12)
+ u_int8 Dday; //!< \~english (day BCD 0x01 to 0x31)
+ u_int8 Hhour; //!< \~english (hour BCD 0x00 to 0x23)
+ u_int8 Mmin; //!< \~english (min BCD 0x00 to 0x59)
+ u_int8 Ssec; //!< \~english (sec BCD 0x00 to 0x59)
+ u_int8 Wweek; //!< \~english (week BIN 0x00 to 0x06)
+ u_int8 CrtFlg;
+ //!< \~english GPS time not corrected or corrected flag(BIN 0x00 to 0x03)
+ u_int8 CrtHou; //!< \~english the last correction(hour BCD 0x00 to 0x23)
+ u_int8 CrtMin; //!< \~english (min BCD 0x00 to 0x59)
+ u_int8 CrtSec; //!< \~english (sec BCD 0x00 to 0x59)
+} RealTimeDataBcd;
+
+/**
+ * @struct GpsSetData
+ * \~english GPS time setting data
+ */
+typedef struct {
+ u_int16 Yyear; //!< \~english current time(year:A.D.)
+ u_int8 Mmonth; //!< \~english (month)
+ u_int8 Dday; //!< \~english (day)
+ u_int8 Hhour; //!< \~english (hour)
+ u_int8 Mmin; //!< \~english (min)
+ u_int8 Ssec; //!< \~english (sec)
+ u_int8 Dummy; //!< \~english dummy data
+} GpsSetData;
+
+/**
+ * @struct TimerToutMsg
+ * \~english timeout message
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific)
+ u_int16 Dummy; //!< \~english dummy
+} TimerToutMsg;
+
+/**
+ * @struct TimerTimeReq
+ * \~english timer start request
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ PNO SndPno; //!< \~english process No.(claimant specific)
+ u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific)
+ u_int8 TimeType; //!< \~english timer type
+ u_int8 Dummy[3]; //!< \~english dummy data
+ TimerDupData DupData; //!< \~english timeout value
+} TimerTimeReq;
+
+/**
+ * @struct TimerAlrmReq
+ * \~english time specified timer start request
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ PNO SndPno; //!< \~english process No.(claimant specific)
+ u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific)
+ u_int8 TimeHou; //!< \~english specific timeout hour
+ u_int8 TimeMin; //!< \~english min
+ u_int8 TimeSec; //!< \~english sec
+ u_int8 Dummy; //!< \~english dummy
+} TimerAlrmReq;
+
+/**
+ * @struct TimerStopReq
+ * \~english timer stop request
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ PNO SndPno; //!< \~english process No.(claimant specific)
+ u_int16 TimerSeq; //!< \~english timer sequence No.(claimant specific)
+ u_int8 TimeType; //!< \~english timer type
+ u_int8 Dummy[3]; //!< \~english dummy data
+} TimerStopReq;
+
+/**
+ * @struct GpsSetTimeReq
+ * \~english GPS RTC time set request
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ PNO SndPno; //!< \~english process No.(claimant specific)
+ u_int8 Dummy1; //!< \~english dummy data
+ u_int8 Dummy2; //!< \~english dummy data
+ GpsSetData SetData; //!< \~english GPS setting data
+} GpsSetTimeReq;
+
+/**
+ * @struct GpsSetTimeReq
+ * \~english time difference set request
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ int8 DiffTime; //!< \~english time difference value
+ int8 Dummy1; //!< \~english dummy data
+ int16 Dummy2; //!< \~english dummy data
+} SetDiffTimeReq;
+
+
+/**
+ * @struct T_TIM_RCV_DATA
+ * \~english command notify information structure
+ */
+typedef struct {
+ PNO SndPno; //!< \~english command delivery PNO
+ u_int8 ucAlmanc_Flg;
+ //!< \~english almanac abnormal judgement notify complete flag
+ u_int8 ucInvalid_Flg;
+ //!< \~english time acquisition notify complete flag
+} T_TIM_RCV_DATA;
+
+/**
+ * @struct TimerSramData
+ * \~english timer SRAM data structure
+ */
+typedef struct {
+ u_int32 navitime; //!< \~english Navi operation addition time
+ int8 _difftime; //!< \~english time difference value of current time
+ int8 timeUnit; //!< \~english specific time manager unit
+ int8 dummy[2]; //!< \~english dummy data
+ T_TIM_RCV_DATA timCmdData[TIM_NUM_SNDCMD];
+ //!< \~english command receive information
+} TimerSramData;
+
+/**
+ * @struct SysTimeData
+ * \~english system time data
+ */
+typedef struct {
+ u_int16 Yyear; //!< \~english current time(year:A.D.BCD ex. 0x1998)
+ u_int8 Mmonth; //!< \~english (month BCD 0x01 to 0x12)
+ u_int8 Dday; //!< \~english (day BCD 0x01 to 0x31)
+ u_int8 Hhour; //!< \~english (hour BCD 0x00 to 0x23)
+ u_int8 Mmin; //!< \~english (min BCD 0x00 to 0x59)
+ u_int8 Ssec; //!< \~english (sec BCD 0x00 to 0x59)
+ u_int8 Wweek; //!< \~english (week BIN 0x00 to 0x06)
+} SysTimeData;
+
+/**
+ * @struct YearCntTbl
+ * \~english year convert table
+ */
+typedef struct TimeCnvTbl_tag {
+ uint32_t ulYear; //!< \~english year
+ uint32_t ulCount; //!< \~english count
+ uint32_t ulMonth[12]; //!< \~english month
+} YearCntTbl;
+
+/**
+ * @struct DayCntTbl
+ * \~english day convert table
+ */
+typedef struct DayCnvTbl_tag {
+ YearCntTbl stTbl[CNV_YEAR_MAX]; //!< \~english year convert table
+} DayCntTbl;
+
+/**
+ * @struct TG_TIM_ROLOVR_GPSWEEKCORDATA
+ * \~english GPS week correction data
+ */
+typedef struct {
+ u_int8 gpsweekcorcnt; //!< \~english GPS week rollover correct count
+ u_int8 permission; //!< \~english GPS week rollover correct permission
+ u_int8 dummy[2]; //!< \~english dummy data
+} TG_TIM_ROLOVR_GPSWEEKCORDATA;
+
+/**
+ * @struct TIMECHGIND_MSG
+ * \~english time change information message structure
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ RealTimeData RealTime; //!< \~english data body(current time data)
+} TIMECHGIND_MSG;
+
+/**
+ * @struct T_TIM_CMDMSG
+ * \~english time available notification/almanac abnormality notification structure
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+} T_TIM_CMDMSG;
+
+/**
+ * @struct T_TIM_RETTIMEMSG
+ * \~english time setting response message
+ */
+typedef struct {
+ T_APIMSG_MSGBUF_HEADER Header; //!< \~english message header
+ int8 cResult; //!< \~english process result
+ int8 dummy[2]; //!< \~english dummy data
+} T_TIM_RETTIMEMSG;
+
+/**
+ * @struct TimerModDat
+ * \~english current time data module structure
+ */
+typedef struct {
+ u_int32 InitFlg; //!< \~english initialization complete flag
+ u_int8 CrtFlg; //!< \~english corrected/not corrected flag
+ u_int8 CrtHou; //!< \~english the last correction: hour
+ u_int8 CrtMin; //!< \~english min
+ u_int8 CrtSec; //!< \~english sec
+} TimerModDat;
+
+/** @}*/ // end of positioning_base_library
+/** @}*/ // end of vehicle_service
+/** @}*/ // end of BaseSystem
+#endif // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_SYS_TIMERAPI_H_
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/libPOS_base_API.ver b/video_in_hal/vehicleservice/positioning_base_library/library/libPOS_base_API.ver
new file mode 100755
index 0000000..019a271
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/libPOS_base_API.ver
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#
+# libPOS_base_API version script
+#
+{
+ global:
+ _pb_*;
+ *MemoryTerm*;
+ *ErrTrapTerm*;
+ *MsgTerm*;
+ *EventTerm*;
+ *MutexTerm*;
+ *SemaphoreTerm*;
+ *ErrTrapInit*;
+ *MsgInit*;
+ *EventInit*;
+ *MemoryInit*;
+ *SemaphoreInit*;
+ *MutexInit*;
+ local:
+ *;
+};
+
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/MsgBapi.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/MsgBapi.cpp
new file mode 100755
index 0000000..66e78ae
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/MsgBapi.cpp
@@ -0,0 +1,347 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * MsgBapi.cpp
+ * @brief system common functions
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <dirent.h>
+#include "_pbInternalProc.h"
+#include "WPF_STD_private.h"
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Create Shared Memory
+ *
+ * Create a file mapping object with the specified shared memory name and size, then <br>
+ * maps it to the invoking process space. If the shared memory that has already been <br>
+ * created is specified, an error is returned.<br>
+ * The shared memory management information allocates a heap area each time it is <br>
+ * created, and return this address as a shared memory handle.
+ *
+ * @param[in] TCHAR* name
+ * @param[in] DWORD size
+ *
+ * @return HANDLE<br>
+ * Except NULL Handle of the created shared memory(Management information pointer)<br>
+ * NULL ABEND
+ */
+HANDLE CreateSharedMemory(TCHAR* name, DWORD size) {
+ int32 lret = EOK;
+ RET_API ret_api = RET_ERROR;
+ int32 fd = POSITIONINGBASELIBRARY_NON_FD;
+ SHARED_MEMORY* p_shm = NULL;
+ char c_file_path[PATH_MAX + 1] = SHARED_MEMORY_DIRECTORY;
+
+ if ((name != NULL) && (size != 0)) { // LCOV_EXCL_BR_LINE 6:name can not be NULL, size can not be 0
+ /* Allocate the shared memory management information area in the heap. */
+ p_shm = reinterpret_cast<SHARED_MEMORY *>(malloc(sizeof(SHARED_MEMORY)));
+ if (p_shm == NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+ } else {
+ p_shm->h_heap = NULL;
+ p_shm->phy_addr = 0;
+ p_shm->h_map = NULL;
+ p_shm->size = size;
+
+ /* Create directory */
+ (void)mkdir(SHARED_MEMORY_DIRECTORY, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+
+ /* Create shared memory with the specified size and name.(Error if it already exists) */
+ (void)strncat(c_file_path, (const char*)name, 128);
+ fd = open(c_file_path, O_RDWR | O_CREAT | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); // LCOV_EXCL_BR_LINE 5: standard lib error // NOLINT(whitespace/line_length)
+ if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18775 compliant */ { // LCOV_EXCL_BR_LINE 5: standard lib error // NOLINT(whitespace/line_length)
+ /* Set size */
+ lret = ftruncate(fd, size);
+ if (lret == EOK) { // LCOV_EXCL_BR_LINE 5: ftruncate's error case
+ /* Map the created shared memory to the invoking process space. */
+ p_shm->p_memory = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (p_shm->p_memory != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ ret_api = RET_NORMAL;
+ }
+ }
+ }
+ }
+ }
+
+ if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18775 compliant */ {
+ close(fd);
+ }
+
+ if (ret_api == RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ /* Indicate that it is the creator of the shared memory */
+ p_shm->owner = TRUE;
+ } else {
+ // LCOV_EXCL_START 200: can not be not normal
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* In case of an error */
+ if (fd != POSITIONINGBASELIBRARY_NON_FD) {
+ /* Delete shared memory object if created */
+ shm_unlink(name);
+ }
+
+ if (p_shm != NULL) {
+ free(p_shm);
+ }
+
+ p_shm = NULL;
+ // LCOV_EXCL_STOP
+ }
+
+ return (HANDLE)p_shm;
+}
+
+/**
+ * @brief
+ * Open Shared Memory
+ *
+ * Create a file mapping object with the specified shared memory name and size, <br>
+ * then map it to the invoking process space. Since this is not shared memory <br>
+ * creation processing, an error is returned if it is not a file mapping object.<br>
+ * The shared memory management information allocates a heap area each time <br>
+ * it is created, and return this address as a shared memory handle.
+ *
+ * @param[in] TCHAR* name
+ * @param[in] DWORD size
+ *
+ * @return HANDLE<br>
+ * Except NULL Handle of the acquired shared memory(Management information pointer)<br>
+ * NULL ABEND
+ */
+HANDLE OpenSharedMemory(TCHAR* name, DWORD size) {
+ RET_API ret_api = RET_ERROR;
+ int32 fd = POSITIONINGBASELIBRARY_NON_FD;
+ SHARED_MEMORY* p_shm = NULL;
+ char c_file_path[PATH_MAX + 1] = SHARED_MEMORY_DIRECTORY;
+
+ if ((name != NULL) && (size != 0)) { // LCOV_EXCL_BR_LINE 6:name can not be NULL, size can not be 0
+ /* Allocate the shared memory management information area in the heap. */
+ p_shm = reinterpret_cast<SHARED_MEMORY *>(malloc(sizeof(SHARED_MEMORY)));
+ if (p_shm == NULL) { // LCOV_EXCL_BR_LINE 5: malloc's error case
+ } else {
+ p_shm->h_heap = NULL;
+ p_shm->phy_addr = 0;
+ p_shm->h_map = NULL;
+ p_shm->size = size;
+
+ /* Open shared memory with the specified size and name(Error if not exists) */
+ (void)strncat(c_file_path, (const char*)name, 128);
+ fd = open(c_file_path, O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); // LCOV_EXCL_BR_LINE 5: standard lib error
+ if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18774 compliant */ {
+ /* Map open shared memory to invoking process space. */
+ p_shm->p_memory = reinterpret_cast<SHARED_MEMORY *>(mmap(0, size, PROT_READ | PROT_WRITE, \
+ MAP_SHARED | POSITIONINGBASELIBRARY_MAP_NON_INIT, fd, 0));
+ if (p_shm->p_memory != MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ ret_api = RET_NORMAL;
+ }
+ }
+ }
+ }
+
+ if (fd > POSITIONINGBASELIBRARY_NON_FD) /* Coverity CID: 18774 compliant */ {
+ close(fd);
+ }
+
+ if (ret_api == RET_NORMAL) {
+ /* Indicate that the opener of the shared memory not the creator of it. */
+ p_shm->owner = FALSE;
+ } else {
+ /* In case of an error */
+ if (p_shm != NULL) {
+ free(p_shm);
+ }
+
+ p_shm = NULL;
+ }
+
+ return (HANDLE)p_shm;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DeleteAllSharedMemory()
+ * ABSTRACT : Delete all shared memory objects
+ * NOTE : Delete all shared memory objects
+ * : However, the heap area allocated at the time of shared memory creation or open is not released.
+ * ARGUMENT : None
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+DeleteAllSharedMemory(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+ char* cwd = NULL;
+ char sz_cwd[PATH_MAX + 1] = {0};
+ DIR* p_dir = NULL;
+ struct dirent* p_dir_ent = NULL;
+
+ /* Get path of current directory */
+ cwd = getcwd(sz_cwd, PATH_MAX + 1);
+
+ if (cwd != NULL) {
+ /* Move to shared memory directory */
+ lret = chdir(SHARED_MEMORY_DIRECTORY);
+
+ if (lret == EOK) {
+ /* Open shared memory directory */
+ p_dir = opendir(SHARED_MEMORY_DIRECTORY);
+ if (p_dir != NULL) {
+ for (;;) {
+ /* Get directory entry */
+ p_dir_ent = readdir(p_dir);
+ if (p_dir_ent == NULL) {
+ break;
+ }
+
+ if ((_pb_strcmp(p_dir_ent->d_name, ".") != 0) &&
+ (_pb_strcmp(p_dir_ent->d_name, "..") != 0)) {
+ /* Delete shared memory objects */
+ shm_unlink(p_dir_ent->d_name);
+ }
+ }
+
+ /* Close shared memory directory */
+ closedir(p_dir);
+ }
+
+ /* Go to original directory */
+ lret = chdir(cwd);
+ if (lret != EOK) /* Coverity CID: 18816 compliant */ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "chdir ERROR [lret:%d]", lret);
+ }
+ }
+ }
+
+ /* Delete shared memory directory */
+ lret = rmdir(SHARED_MEMORY_DIRECTORY);
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetSharedMemoryPtr()
+ * ABSTRACT : Shared memory start address acquisition processing
+ * NOTE : Return the start address of the shared memory that is allocated/mapped at the
+ * : time of shared memory creation or open
+ * ARGUMENT : HANDLE h_shm Shared memory handle(Management information pointer)
+ * RETURN : void* Except NULL Pointer to the acquired shared memory
+ * : NULL ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void*
+GetSharedMemoryPtr(HANDLE h_shm) {
+ void *p_vret = NULL;
+ SHARED_MEMORY *p_shm = reinterpret_cast<SHARED_MEMORY *>(h_shm);
+
+ if (p_shm == NULL) /* If the shared memory handle that is not created or not opened is specified, */ { // LCOV_EXCL_BR_LINE 200: p_shm can not be NULL // NOLINT(whitespace/line_length)
+ } else {
+ p_vret = p_shm->p_memory;
+ }
+
+ return p_vret;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : CloseSharedMemory()
+ * ABSTRACT : Shared memory close processing
+ * NOTE : Close the shared memory that is allocated/mapped at the time of its creation or open
+ * ARGUMENT : HANDLE h_shm Shared memory handle(Management information pointer)
+ * RETURN : NONE
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+CloseSharedMemory(HANDLE h_shm) {
+ SHARED_MEMORY* p_shm = reinterpret_cast<SHARED_MEMORY *>(h_shm);
+ int32 lret = EOK;
+
+ if (p_shm == NULL) /* If the shared memory handle that is not created or not opened is specified, */ {
+ } else if (p_shm->phy_addr != 0) /* If the physical memory area address is specified,(Currently never comes here) */ {
+ if (p_shm->p_memory != NULL) {
+ /* Release physical memory area */
+ if (lret != EOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "_CWORD64_api.dll:%s:LINE %d\r\n munmap_device_memory ERROR In PbFreePhysicalMem\r\n", \
+ LTEXT(__FILE__), __LINE__);
+ _pb_Exit(); /* System recovery processing(Exception execution) */
+ }
+ }
+ } else {
+ /* Release the shared memory object mapped to invoking process space */
+ if (p_shm->p_memory != NULL) {
+ lret = munmap(p_shm->p_memory, p_shm->size);
+ p_shm->p_memory = NULL;
+ }
+
+ /* Release the shared memory management information allocated in the heap */
+ free(p_shm);
+ }
+
+ return;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DeleteSharedMemory()
+ * ABSTRACT : Shared memory object delete processing
+ * NOTE : Delete the shared memory object that is specified name
+ * ARGUMENT : TCHAR* name Pointer to the name of the shared memory to be deleted
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+DeleteSharedMemory(TCHAR* name) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+ char* cwd = NULL;
+ char sz_cwd[PATH_MAX + 1] = {0};
+
+ if (name != NULL) {
+ /* Get path of current directory */
+ cwd = getcwd(sz_cwd, PATH_MAX + 1);
+
+ if (cwd != NULL) {
+ /* Move to shared memory directory */
+ lret = chdir(SHARED_MEMORY_DIRECTORY);
+
+ if (lret == EOK) {
+ /* Delete shared memory object */
+ lret = shm_unlink(name);
+
+ /* Go to original directory */
+ lret = chdir(cwd);
+ }
+ }
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+
+HANDLE
+OpenSharedMemoryAtPhysical(DWORD physical_address, DWORD size, DWORD protect) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return NULL;
+}
+// LCOV_EXCL_STOP
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp
new file mode 100755
index 0000000..ed833fd
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_CWORD64_api.cpp
@@ -0,0 +1,254 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _CWORD64_api.cpp
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+#include "tchar.h"
+#include "WPF_STD_private.h"
+
+
+
+/*---------------------------------------------------------------------------------*
+ * Function Prototype *
+ *---------------------------------------------------------------------------------*/
+extern RET_API MutexInit(void);
+extern RET_API SemaphoreInit(void);
+extern RET_API MemoryInit(void);
+extern RET_API EventInit(void);
+extern RET_API MsgInit(void);
+extern RET_API ErrTrapInit(void);
+extern RET_API TimerInit(HANDLE h_app);
+extern void MsgTerm(void);
+
+static void BaseCreateMutex(void);
+static void BaseLockMutex(void);
+static void BaseUnlockMutex(void);
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/** Handle for locking Base API setups */
+static HANDLE g_h_mtx = NULL;
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Setup Base API
+ *
+ * Perform the processing required to use the Base API.(Call per process)
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return RET_NORMAL Normal completion
+ */
+RET_API _pb_Setup_CWORD64_API(HANDLE h_app) { // NOLINT(readability/nolint) API
+ RET_API result;
+ static int8 i = 0;
+ int32 ret;
+
+ if (i != 0) {
+ /* If the process has already initialized */
+ /* nop */
+ } else {
+ /* Interprocess lock initialization(CLS) */
+ ret = CL_LockProcessInit(); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockProcessInit ERROR!! [ret=%d]", ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ BaseCreateMutex(); /* Create Mutex */
+ BaseLockMutex(); /* Get Mutex */
+
+ /* Recheck during getting Mutex */
+ if (i == 0) { // LCOV_EXCL_BR_LINE 6: i can not be other value
+ /* Not initialized */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_pb_Setup_CWORD64_API Entered.");
+
+ /* Mutex function initialization */
+ result = MutexInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MutexInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: function can not be not normal
+ }
+
+ /* Semaphore function initialization */
+ result = SemaphoreInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SemaphoreInit ERROR!! [result=%d]", \
+ result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: function can not be not normal
+ }
+
+ /* Memory function initialization */
+ result = MemoryInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MemoryInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal
+ }
+
+ /* Event function initialization */
+ result = EventInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "EventInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: function can not be not normal
+ }
+
+ /* Message function initialization */
+ result = MsgInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal
+ }
+
+ result = ErrTrapInit();
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ErrTrapInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal
+ }
+
+ /* For Positioning processes */
+ if (_tcscmp("Positioning", FrameworkunifiedGetAppName(h_app)) == 0) { // LCOV_EXCL_BR_LINE 200: can not be other value
+ /* Timer function initialization */
+ result = TimerInit(h_app);
+ if (result != RET_NORMAL) { // LCOV_EXCL_BR_LINE 200: can not be not normal
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "TimerInit ERROR!! [result=%d]", result);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: can not be not normal
+ }
+ }
+
+ i = 1;
+ }
+
+ BaseUnlockMutex(); /* Release Mutex */
+ }
+
+ /* Set application handle */
+ _pb_SetAppHandle(h_app);
+
+ return RET_NORMAL;
+}
+
+/**
+ * @brief
+ * Teardown Base API
+ *
+ * Base API termination processing (Call per process)
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+void _pb_Teardown_CWORD64_API(void) { // NOLINT(readability/nolint) API // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Interprocess Lock Control(CLS) */
+
+
+ /*
+ Resources cannot be released unless it is guaranteed that other processes do not call the Positioning API.
+ Even if the resource is not released at the time of termination, it will not lead to illegal operation such as memory leak.
+ Comment out release processing.
+ */
+
+ /* Mutex */
+ /* Semaphore */
+ /* Memory */
+ /* Event */
+ /* Message */
+
+ /* Timer */
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+
+/**
+ * @brief
+ * Create Mutex for Base API setups
+ */
+static void BaseCreateMutex(void) {
+ g_h_mtx = (HANDLE)CL_LockMap(LOCK_POS_MTX_1); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockMap ERROR [g_h_mtx:%p]", g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get Mutex for Base API setups
+ */
+static void BaseLockMutex(void) {
+ int32 ret;
+
+ ret = CL_LockGet(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockGet ERROR [g_h_mtx:%p, ret:%d]", \
+ g_h_mtx, ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Release Mutex for Base API Setup
+ */
+static void BaseUnlockMutex(void) {
+ int32 ret;
+
+ ret = CL_LockRelease(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockRelease ERROR [g_h_mtx:%p, ret:%d]", \
+ g_h_mtx, ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp
new file mode 100755
index 0000000..e144d6f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbCSection.cpp
@@ -0,0 +1,131 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+* $Header:: $
+* $Revision:: $
+*******************************************************************************/
+
+/****************************************************************************
+ * File name :_pbCSection.cpp
+ * System name :GPF
+ * Subsystem name :_CWORD64_API Critical Section Function
+ * Title :Critical Section Function Definition File
+ ****************************************************************************/
+
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : PbDeleteCriticalSection()
+* ABSTRACT : Specify a critical section object that is not owned and free all resources used by that object.
+* NOTE :
+* ARGUMENT : LPCRITICAL_SECTION lp_critical_section
+* RETURN : VOID defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID PbDeleteCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+
+ if (lp_critical_section == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbDeleteCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__);
+ } else {
+ lret = pthread_mutex_destroy(lp_critical_section);
+ if (lret != EOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbDeleteCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__, lret);
+ }
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : PbEnterCriticalSection()
+* ABSTRACT : Wait to take ownership of the specified critical section object
+* NOTE :
+* ARGUMENT : LPCRITICAL_SECTION lp_critical_section
+* RETURN : VOID defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID PbEnterCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+
+ if (lp_critical_section == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbEnterCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__);
+ } else {
+ lret = pthread_mutex_lock(lp_critical_section);
+ if (lret != EOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbEnterCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__, lret);
+ }
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : PbInitializeCriticalSection
+* ABSTRACT : Initialize the specified critical section object.
+* NOTE :
+* ARGUMENT : LPCRITICAL_SECTION lp_critical_section
+* RETURN : VOID defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID PbInitializeCriticalSection(LPCRITICAL_SECTION lp_critical_section) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : PbLeaveCriticalSection
+* ABSTRACT : Discard ownership of the specified critical section object.
+* NOTE :
+* ARGUMENT : LPCRITICAL_SECTION lp_critical_section
+* RETURN : VOID defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID PbLeaveCriticalSection(LPCRITICAL_SECTION lp_critical_section ) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+
+ if (lp_critical_section == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n Parameter ERROR In PbLeaveCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__);
+ } else {
+ lret = pthread_mutex_unlock(lp_critical_section);
+ if (lret != EOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:%s:LINE %d\r\n ERROR ... ErrNo[%d] In PbLeaveCriticalSection\r\n",
+ LTEXT(__FILE__), __LINE__, lret);
+ }
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbCommon.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbCommon.cpp
new file mode 100755
index 0000000..6bb4fb9
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbCommon.cpp
@@ -0,0 +1,928 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbCommon.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System wide functions
+ Title : System API _CWORD64_ configuration processes
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <vehicle_service/positioning_base_library.h>
+
+#include "_pbCommon.h"
+#include "WPF_STD_private.h"
+#include "sysup_addr.h"
+#include "tchar.h"
+#include "sysup.h"
+
+/*
+ Constants and data type definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define BLOCK_SIZE (1*1024*1024)
+#define WDTC_REG_ADDR (0x13500000 | ADDR_P2) /* WDT clear register address */
+#define SUM_ZERO 0
+#define ALLOC_SIZE 0x00200000
+#define EXIST_CLEAR 0x434c4f4b /* Flag to indicate cleared Non-OS management area */
+
+#define PRCM_BASE 0x48180000
+#define PRM_RSTCTRL 0xA0
+
+#define RST_GLOBAL_COLD_SW (0x01 << 1)
+#define RST_GLOBAL_WARM_SW (0x01 << 0)
+
+/*
+ Internal function prototype declarations
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+u_int32 RomCheck(u_int32 *start_addr, u_int32 check_size);
+u_int32 RomCheckEx(u_int32 *start_addr, u_int32 check_size);
+uint64_t AtoxLong(char* str, unsigned int ascii_size);
+void XtoaLong(uint64_t x, char* str);
+#ifdef PBCOM_CONFIGREAD
+static RET_API SysGetConfigSize(FILE*, u_int32*);
+static RET_API SysReadConfigInfo(FILE*, TCHAR*, TCHAR*, u_int32);
+static int SysUniToInt(TCHAR*, u_int32);
+#endif /* PBCOM_CONFIGREAD */
+
+/*
+ External function prototype declarations
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ Global Variable Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef PSL_USED
+extern int g_n_api_set_id; /* ID variable for PSL registration */
+#endif // PSL_USED
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _CWORD64_NotOSAreaInit
+ * ABSTRACT : Initialization non-OS managed areas of _CWORD64_
+ * NOTE : This function initializes the non-OS control areas of _CWORD64_.
+ * ARGUMENT : None
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_CWORD64_NotOSAreaInit(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#ifndef CEPC_EM /* If not emulated in CEPC */
+ RET_API ret;
+ char *cp_addr = NULL;
+ u_int32 size;
+ u_int32 *p_clear_flag; /* Pointer for storing non-OS management area clear flag */
+ LPVOID notos_topaddr;
+
+ /* Link of shared memory area to store the non-OS management area clear flag */
+ ret = _pb_LinkShareData(const_cast<char*>("NOTOS_DATA"), reinterpret_cast<void**>(&cp_addr), &size);
+ if (ret != RET_NORMAL) {
+ /* Create a shared memory area to store the non-OS management area clear flag */
+ Memset64pSync(cp_addr, 0, sizeof(p_clear_flag)); /* NULL initialization process of acquisition area */
+ }
+
+ p_clear_flag = reinterpret_cast<u_int32*>(cp_addr);
+
+ /* Non-OS management area clear processing */
+ /* Because an exception occurs when garbage data remains in the message pool at startup,
+ Clear the entire non-OS management area as 0 Only for the first time after startup. */
+ if (*p_clear_flag != EXIST_CLEAR) {
+ /* Execute mapping to non-OS management area */
+ ret = PbAccessPhysicalMem(TOP_ADDR_NOTOS, /* Start address non-OS management area for of the _CWORD64_ */
+ &notos_topaddr, /* Start address of the mapping */
+ NOTOS_SISE, /* Area-size */
+ 0);
+
+ /* failed mapping */
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_msg.lib:%s:LINE %d\r\n PbAccessPhysicalMem ERROR In " \
+ "_CWORD64_NotOSAreaInit ... ret[%d] \r\n",
+ LTEXT(__FILE__), __LINE__, ret);
+ _pb_Exit();
+ }
+
+ /* Non-OS management area clear processing */
+ Memset64pSync(notos_topaddr, 0, NOTOS_SISE);
+
+ /* Shared area release processing */
+ ret = PbFreePhysicalMem(TOP_ADDR_NOTOS, /* Start address of the _CWORD64_ non-OS management area */
+ notos_topaddr, /* Start address of the mapped area */
+ NOTOS_SISE); /* Size */
+
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_msg.lib:%s:LINE %d\r\n PbFreePhysicalMem ERROR " \
+ "In_CWORD64_NotOSAreaInit ... ret[%d] \r\n",
+ LTEXT(__FILE__), __LINE__, ret);
+ _pb_Exit();
+ }
+
+ *p_clear_flag = EXIST_CLEAR; /* Set non-OS management area clear flag */
+ }
+#endif
+
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _CWORD64_APIInit
+ * ABSTRACT : System initialization of _CWORD64_API
+ * NOTE : This function is called once from the initialization process
+ * : at system startup to perform the _CWORD64_API initialization process.
+ * ARGUMENT : u_int32 (*sighand)() Completion of signal handling within APIs if NULL
+ * : Otherwise calls this first when a signal is raised
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_CWORD64_APIInit(u_int32 (*sighand)()) { // NOLINT(readability/nolint) API // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API RetSts = RET_ERROR;
+
+ if (sighand == NULL) {
+ /* Parameter is set to an error other than NULL */
+ RetSts = _pb_Setup_CWORD64_API(NULL); /* Execute initialization processing for normal processing */
+ }
+
+ return(RetSts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_GetPrgVer
+ * ABSTRACT : Get the program version
+ * NOTE : Get the program version of the mask ROM (BootLoader) and flash
+ * : ROM (NK-image) into specified buffers.
+ * : In hardware-independent CEPC emulation environment, return the following version,
+ * : otherwise always return RET_NORMAL as the return value.
+ * : mask_ver=0x0102 0304 0506 0708
+ * : flash_ver1=0x0102 0304 0506 0708
+ * : flash_ver2=0x0102 0304 0506 0708
+ * : flash_ver3=0x0102 0304 0506 0708
+ * ARGUMENT : T_SYS_PRGVER *pbuf Destination buffer address
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_GetPrgVer(T_SYS_PRGVER *pbuf) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_UpManage
+ * ABSTRACT : Boot management process
+ * NOTE : Set the startup identifier in the SDRAM startup identification table (SDRAM)
+ * : or TinyFugue area (FLASH) at the next startup.
+ * : Which one to set depends on the table type of the argument.
+ * : Soft reset is performed when reset is instructed by the parameter.
+ * : In hardware-independent CEPC emulation environment, return the RET_NORMAL as the return value without recording the startup identifier.
+ * ARGUMENT : u_int16 up_sts :Startup Identifier Value
+ * : int reset :Reset instruction
+ * : u_int8 table :Table Type
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_UpManage(u_int32 up_sts, int reset, u_int8 table) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Is reset instructed? */
+ if ((reset == SYS_RESET) || (reset == SYS_ONLY_RESET)) {
+ PbReset(); /* Soft reset */
+ }
+
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_RomcheckMask
+ * ABSTRACT : Check the sum value of masked part
+ * NOTE : Check the sum value of the mask ROM (BOOTROM)
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL :Sum value normal
+ * REL_ERROR :Sum value error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_RomcheckMask(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_RomcheckApl
+ * ABSTRACT : Check sum value of APL part (NK image)
+ * NOTE : In hardware-independent CEPC emulations do nothing and return RET_NORMAL.
+ * ARGUMENT :
+ * RETURN : RET_API RET_NORMAL :Sum Value Normal
+ * REL_ERROR :Sum value error
+ * RET_OSERROR :AccessPhysicalMem error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_RomcheckApl(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbReset
+ * ABSTRACT : Hard reset processing
+ * NOTE : Manipulate the WDT control register to generate a hard reset
+ * : Hardware-independent CEPC emulations do nothing and return RET_NORMAL.
+ * ARGUMENT : void
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+PbReset(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+
+ /* Message log output processing */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " PbReset:%s:LINE %d\r\n #### HARD RESET !! ####\r\n",
+ LTEXT(__FILE__), __LINE__);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_GetDeviceInfo
+ * ABSTRACT : Getting device information
+ * NOTE : Gets device information into the specified buffer.
+ * : In hardware-independent CEPC emulations, the following device
+ * : information is returned permanently. The return value is always RET_NORMAL.
+ * : _CWORD31__no="8611052060010001" mci_no="CNCS0200A" date="200301011200"
+ * ARGUMENT : T_SYS_PRGVER *pbuf Destination buffer address
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_GetDeviceInfo(T_SYS_DEVINFO *pbuf) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_WriteDeviceInfo
+ * ABSTRACT : Write device key information
+ * NOTE : Write device key information to flash memory
+ * ARGUMENT : u_char *ucpData Start address of write data (256 bytes)
+ * RETURN : int32 VUP_SUCCESS Flash write complete
+ * : VUP_FAILED Flash write abend
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+int32
+_pb_WriteDeviceInfo(u_char *ucpData) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_GetSramVer
+ * ABSTRACT : SRAM versioning process
+ * NOTE : Getting SRAM version
+ * : In hardware-independent CEPC emulations, return the following SRAM Version statically.
+ * : The return value is always RET_NORMAL.
+ * : SRAM Version=0x1112 1314
+ * ARGUMENT : char *pbuf Destination buffer address
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+_pb_GetSramVer(char *pbuf) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_GetDisplayInfo
+ * ABSTRACT : Getting display information
+ * NOTE : Get the screen size (width and height) into the buffer of the DISPLAY_INFO structure
+ * ARGUMENT : DISPLAY_INFO *pSystemInfo Screen size acquisition destination buffer address
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define DISPLAYINFO_SUBKEY_SIZE 56
+#define DISPLAYINFO_VALNAME_SIZE 16
+#define DISPLAYINFO_VAL_SIZE 8
+
+RET_API
+_pb_GetDisplayInfo(DISPLAY_INFO *pSystemInfo) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#ifdef PBCOM_CONFIGREAD
+ FILE* fpConfigFile = NULL; /* Configuration file handle */
+ TCHAR tcData[DISPLAYINFO_VAL_SIZE] = {0}; /* Data section read buffer */
+ TCHAR tcDataName[DISPLAYINFO_VALNAME_SIZE] = {0}; /* Data information storage buffer */
+ int iRet = PBCOM_API_NORMAL; /* API return value */
+#endif
+ int iHeight = 0; /* Screen height information */
+ int iWidth = 0; /* Screen width information */
+ RET_API Retapi = RET_NORMAL; /* Results of this Module process */
+
+ /************************************************************
+ * Parameter check
+ ************************************************************/
+ if (NULL == pSystemInfo) {
+ /* Parameter is set to error */
+ Retapi = RET_ERRPARAM;
+ }
+
+ /************************************************************
+ * Set the information in the configuration file
+ ************************************************************/
+#ifdef PBCOM_CONFIGREAD
+ /************************************************************
+ * Open configuration file
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ fpConfigFile = fopen(PBCOM_CONFIGFILE, "r");
+ if (NULL == fpConfigFile) {
+ /* Set error in as a result */
+ Retapi = RET_ERROR;
+ }
+ }
+
+ /************************************************************
+ * Get screen width information from configuration file
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Buffer clear */
+ memset(tcData, 0x00, sizeof(tcData));
+ memset(tcDataName, 0x00, sizeof(tcDataName));
+
+ /* Data information setting */
+ memcpy(tcDataName, PBCOM_CONFIG_INDEX_SCRWIDTH, strlen(PBCOM_CONFIG_INDEX_SCRWIDTH));
+
+ /************************************************************
+ * Setting file information reading process
+ ************************************************************/
+ Retapi = SysReadConfigInfo(fpConfigFile, tcDataName, tcData, (u_int32)sizeof(tcData));
+
+ /************************************************************
+ * Conversion process from character string (UNICODE) to numeric
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Conversion from string to numeric */
+ iHeight = SysUniToInt(tcData, strlen(tcData));
+ }
+ }
+
+ /************************************************************
+ * Get screen height information from setting file
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Buffer clear */
+ memset(tcData, 0x00, sizeof(tcData));
+ memset(tcDataName, 0x00, sizeof(tcDataName));
+
+ /* Data information setting */
+ memcpy(tcDataName, PBCOM_CONFIG_INDEX_SCRHEIGHT, strlen(PBCOM_CONFIG_INDEX_SCRHEIGHT));
+
+ /************************************************************
+ * Setting file information reading process
+ ************************************************************/
+ Retapi = SysReadConfigInfo(fpConfigFile, tcDataName, tcData, (u_int32)sizeof(tcData));
+
+ /************************************************************
+ * Conversion process from character string (UNICODE) to numeric
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Conversion from string to numeric */
+ iWidth = SysUniToInt(tcData, strlen(tcData));
+ }
+ }
+
+ /************************************************************
+ * Configuration file close
+ ************************************************************/
+ /* Executed only when the open is successful. */
+ if (NULL != fpConfigFile) {
+ iRet = fclose(fpConfigFile);
+ if (PBCOM_API_NORMAL != iRet) {
+ Retapi = RET_ERROR;
+ }
+ }
+
+ /************************************************************
+ * Direct value setting
+ ************************************************************/
+#else
+ iHeight = 480;
+ iWidth = 800;
+#endif
+ /************************************************************
+ * Display information setting
+ ************************************************************/
+
+ if (RET_NORMAL == Retapi) {
+ /* Coverity CID: 18756 compliant */
+ pSystemInfo->i_height_size = iHeight;
+ pSystemInfo->i_width_size = iWidth;
+ } /* Coverity CID: 18756 compliant */
+
+ return Retapi;
+}
+// LCOV_EXCL_STOP
+
+/******************************************************************************
+* MODULE : RomCheck
+* ABSTRACT : Calculate sum value within range of address specified by argument
+* FUNCTION : u_int32 RomCheck()
+* ARGUMENT : u_int32 *addr Start address for which sum value is to be calculated
+* u_int32 check_size Size for which the sum is to be calculated
+* NOTE :
+* RETURN : u_int32 sum Sum value
+******************************************************************************/
+u_int32
+RomCheck(u_int32 *start_addr, u_int32 check_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int32 *addr_tmp;
+ u_int32 *end_addr;
+ u_int32 sum;
+
+ end_addr = start_addr + check_size / sizeof(u_int32);
+ addr_tmp = start_addr;
+
+ for (sum = 0; addr_tmp < end_addr;) {
+ sum += *(addr_tmp++);
+ }
+ return(sum);
+}
+// LCOV_EXCL_STOP
+
+/******************************************************************************
+* MODULE : RomCheckEx
+* ABSTRACT : Calculate sum value in range of address on ROM specified by argument
+* FUNCTION : u_int32 RomCheckEx()
+* ARGUMENT : u_int32 *addr Start address for which sum value is to be calculated
+* u_int32 check_size Size for which the sum is to be calculated
+* NOTE : For single operation(For a one-bank configuration). APIs provided by FROM management
+* are used because FROM management must be exclusively controled.
+* The sum calculation unit is assumed to be the sector size of FlashROM.
+* RETURN : u_int32 sum Sum value
+* When this function terminates with an error, "RET_ERROR" is returned.
+******************************************************************************/
+u_int32
+RomCheckEx(u_int32 *start_addr, u_int32 check_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(0);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : AtoxLong
+ * ABSTRACT : Convert ASCII to hex
+ * FUNCTION : Convert a ASCII string (up to 8 characters) to a uint64_t hexadecimal string
+ * NOTE :
+ * RETURN : uint64_t :Converted hexadecimal number (up to 8 digits)
+ * INPUT : char *str -------------------- Pointer to a source ASCII string
+ * unsigned int ascii_size ------ Number of characters in source ASCII string
+ * OUTPUT :
+ ******************************************************************************/
+uint64_t AtoxLong(char* str, unsigned int ascii_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ uint64_t x = 0; /* Return value */
+ unsigned int i; /* For work */
+ unsigned int tmp; /* For work */
+
+ /* Check that the specified ASCII number of characters does not exceed the number of digits represented by int64_t (8 hexadecimal digits). */
+ if (ascii_size > (sizeof(x)) * 2) {
+ ascii_size = static_cast<unsigned int>(sizeof(x) * 2);
+ }
+ /* Convert one character at a time to hexadecimal */
+ for (i = 0; i < ascii_size; i++) {
+ /* Is a number? */
+ tmp = *str - '0';
+ if (tmp > 9) {
+ /* Coverity CID: 18790 compliant */
+ /* a-f? */
+ tmp = *str - 'a' + 10;
+ if ((tmp < 0x0a) || (tmp > 0x0f)) {
+ /* A to F ? */
+ tmp = *str - 'A' + 10;
+ if ((tmp < 0x0a) || (tmp > 0x0f)) {
+ /* Stop when a non-hexadecimal value is found */
+ break;
+ }
+ }
+ }
+
+ /* Increase the digit */
+ x <<= 4;
+ /* Add to the bottom digit */
+ x |= tmp;
+ str++;
+ }
+
+ return x;
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : XtoaLong
+ * ABSTRACT : Convert HEX to ASCII
+ * FUNCTION : This function converts the 8-digit hexadecimal number from str[0] to the ASCII code and stores the code.
+ * NOTE : The string to be passed as *str must be at least 8 characters in length. * RETURN :
+ * INPUT : uint64_t x ------------ Source hexadecimal number
+ * OUTPUT : char* str ------------------ Converted ASCII Strings (8 Characters)
+ ******************************************************************************/
+void XtoaLong(uint64_t x, char* str) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int i; /* For looping */
+ int size; /* For looping */
+ char tmp; /* Conversion temporary buffer */
+
+ /* Maximum number of loops (for character string) */
+ size = static_cast<int>(sizeof(int64_t) * 2);
+ /* Convert eight digits */
+ for (i = 0; i < size; i++) {
+ tmp = static_cast<char>((x >> ((size - i - 1) * 4)) & 0x0F);
+
+ /* For 0xA to 0xF */
+ if (tmp > 0x09) {
+ str[i] = static_cast<char>('A' + tmp - 0x0A);
+ } else {
+ str[i] = static_cast<char>('0' + tmp);
+ }
+ }
+}
+// LCOV_EXCL_STOP
+
+/******************************************************************************
+* MODULE : _pb_SendSystemError
+* ABSTRACT : System error notification
+* FUNCTION : Notify the system error and reset the software.
+* ARGUMENT : PNO pno Error process No.
+* int32 errcode Error code
+* NOTE : _pb_SndMsg : Send message (System API)
+* _sys_GetPno : PNO to be gotten
+* RETURN : RET_API defined
+******************************************************************************/
+RET_API _pb_SendSystemError(PNO pno, int32 errcode) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ T_SYS_SYSTEMERROR msg; /* Message */
+ register T_APIMSG_HEADER *hdr; /* Message header */
+ RET_API api_ret;
+
+ /* Message Header Settings */
+ hdr = &(msg.bhead.hdr);
+
+ msg.bhead.signo = 0; /* Extension member */
+ hdr->sndpno = 0; /* Source Process No. */
+ hdr->respno = 0; /* Response destination process No.(None) */
+ hdr->cid = CID_INI_SYSTEMERR; /* Command ID */
+ hdr->msgbodysize = static_cast<uint16_t>(sizeof(T_SYS_SYSTEMERROR) - sizeof(T_APIMSG_MSGBUF_HEADER));
+ /* Main unit size */
+ hdr->rid = 0; /* Resources ID (Dummy) */
+ hdr->reserve = 0;
+ msg.pno = pno; /* Error process No. */
+ msg.errcode = errcode; /* Error code */
+
+ /* Send Message */
+ api_ret = _pb_SndMsg(PNO_GINI_MAIN, sizeof(msg), &msg, 0);
+
+ return(api_ret);
+}
+// LCOV_EXCL_STOP
+
+/******************************************************************************
+* MODULE : _pb_GetVupFileName
+* ABSTRACT : Getting the version upgrade file name
+* FUNCTION : Get the path name and file name of the version upgrade.
+* ARGUMENT : LPTSTR filename File name storage
+* u_char media Container media
+* NOTE :
+* RETURN : RET_API defined
+******************************************************************************/
+RET_API _pb_GetVupFileName(LPTSTR filename , u_char media) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API api_ret = RET_NORMAL; /* API return value */
+ T_SYS_PRGVER ver; /* Version Information */
+ RET_API ret; /* Internal function return value */
+ u_char kisyu; /* Storage of model code */
+
+ /* Get version */
+ ret = _pb_GetPrgVer(&ver);
+
+ if (ret == RET_NORMAL) {
+ /* Extract model code from version */
+ kisyu = ver.mask_ver[3];
+
+ /* If the media is a disk */
+ if (media == VUP_GETNAME_MEDIA_DISC) {
+ _stprintf(filename, _T("%s%s%s%02x%s"),
+ VUP_DISC_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_TOP, kisyu, VUP_FNAME_BTM);
+ } else {
+ /* Media is USB */
+ _stprintf(filename, _T("%s%s%s%02x%s"),
+ VUP_USB_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_TOP, kisyu, VUP_FNAME_BTM);
+ }
+ } else {
+ api_ret = RET_ERROR;
+ }
+
+ return(api_ret);
+}
+// LCOV_EXCL_STOP
+
+/******************************************************************************
+* MODULE : _pb_GetForceVupFileName
+* ABSTRACT : Getting the version upgrade file name
+* FUNCTION : Get the path name and file name of the version upgrade.
+* ARGUMENT : LPTSTR filename File name storage
+* u_char media Container media
+* NOTE :
+* RETURN : RET_API defined
+******************************************************************************/
+RET_API _pb_GetForceVupFileName(LPTSTR filename , u_char media) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API api_ret = RET_NORMAL; /* API return value */
+
+ /* If the media is a disk */
+ if (media == VUP_GETNAME_MEDIA_DISC) {
+ _stprintf(filename, _T("%s%s%s"),
+ VUP_DISC_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_FORCEVUP);
+ } else {
+ /* Media is USB */
+ _stprintf(filename, _T("%s%s%s"),
+ VUP_USB_PATHNAME, VUP_PATHNAME_SYSTEM, VUP_FNAME_FORCEVUP);
+ }
+
+ return(api_ret);
+}
+// LCOV_EXCL_STOP
+
+#ifdef PBCOM_CONFIGREAD
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SysGetConfigSize
+ * ABSTRACT : Setting file size acquisition processing
+ * NOTE : Get file size.
+ * : When this Module is called, an area must be allocated at a higher level.
+ * : Parameter checking is not performed in this Module.
+ * ARGUMENT : FILE* fpFile(File handle)
+ * : int* piSize(File size storage area)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static RET_API
+SysGetConfigSize(FILE* fpFile, u_int32* puiSize) {
+ int64_t lCurrentPos = 0; /* File current position */
+ int64_t lEndPos = 0; /* End position of the file */
+ int iRet = PBCOM_API_NORMAL; /* API processing result */
+ RET_API Retapi = RET_NORMAL; /* Result of this Module process */
+
+ /************************************************************
+ * Get current offset
+ ************************************************************/
+ lCurrentPos = ftell(fpFile);
+
+ /* If the return value is abnormal, the processing result is set to abnormal. */
+ if (PBCOM_API_ERROR == lCurrentPos) {
+ Retapi = RET_ERROR;
+ }
+
+ /************************************************************
+ * Get end offset (size)
+ * -Set offset to end-of-file
+ * -Get end-of-file offset
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Set offset to end-of-file */
+ iRet = fseek(fpFile, 0L, SEEK_END);
+
+ /* If the return value is abnormal, the processing result is set to abnormal. */
+ if (PBCOM_API_NORMAL != iRet) {
+ Retapi = RET_ERROR;
+ }
+ }
+
+ if (RET_NORMAL == Retapi) {
+ /* Get end-of-file offset */
+ lEndPos = ftell(fpFile);
+
+ /* Set file size if the return value is normal */
+ if (PBCOM_API_ERROR != lEndPos) {
+ *puiSize = (u_int32)lEndPos;
+ } else {
+ /* If the return value is abnormal, the processing result is set to abnormal. */
+ Retapi = RET_ERROR;
+ }
+ }
+
+ /************************************************************
+ * Revert current offset
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Revert offset and complete processing */
+ iRet = fseek(fpFile, lCurrentPos, SEEK_SET);
+
+ /* If the return value is abnormal, the processing result is set to abnormal. */
+ if (PBCOM_API_NORMAL != iRet) {
+ Retapi = RET_ERROR;
+ }
+ }
+
+ return Retapi;
+}
+#endif /* PBCOM_CONFIGREAD */
+
+#ifdef PBCOM_CONFIGREAD
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SysReadConfigInfo
+ * ABSTRACT : Setting file information reading process
+ * NOTE : Read the data associated with the specified data information from the configuration file.
+ * : When this module is called, an area must be allocated at a higher level.
+ * : Parameter checking is not performed in this module.
+ * ARGUMENT : FILE* fpConfig(File handle)
+ * : TCHAR* tcDataIndex(Data information)
+ * : TCHAR* tcDataBuf(Data read buffer)
+ * : int tcDataSize(Data read size)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static RET_API
+SysReadConfigInfo(FILE* fpConfig, TCHAR* tcDataIndex, TCHAR* tcDataValue, u_int32 tcDataSize) {
+ TCHAR tcReadBuf[PBCOM_CONFIGSIZE_MAX] = {0}; /* Read buffer */
+ u_int32 uiDataPos = 0; /* Data position */
+ u_int32 uiCpyPos = 0; /* Copy position */
+ u_int32 uiFileSize = 0; /* File size */
+ u_int32 uiReadSize = 0; /* Data read size */
+ u_int32 uiDataNum = 0; /* Number of read data */
+ int iRet = 0; /* API processing result */
+ RET_API Retapi = RET_NORMAL; /* Result of this Module process */
+
+ /************************************************************
+ * Get setting file size
+ ************************************************************/
+ /* Get setting file size */
+ Retapi = SysGetConfigSize(fpConfig, &uiFileSize);
+
+ /* When the setting file size is gotten successfully */
+ if (RET_NORMAL == Retapi) {
+ /* The maximum size of the configuration file is greater than or equal to the maximum size of the configuration file. */
+ if (uiFileSize > PBCOM_CONFIGSIZE_MAX) {
+ /* Set the maximum value of the configuration file as the size */
+ uiFileSize = PBCOM_CONFIGSIZE_MAX;
+ }
+ }
+
+ /************************************************************
+ * Read setting file
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Read data count */
+ uiDataNum = uiFileSize / sizeof(TCHAR);
+
+ /* Set file pointer to the beginning of file */
+ rewind(fpConfig);
+
+ /* Read the data */
+ uiReadSize = fread(tcReadBuf, sizeof(TCHAR), uiDataNum, fpConfig);
+
+ /* When the data corresponding to the file size cannot be read */
+ if (uiReadSize != uiFileSize) {
+ /* Set error in processing result */
+ Retapi = RET_ERROR;
+ }
+ }
+
+ /************************************************************
+ * Data information search & retrieval
+ * -Find data information from the configuration file you read
+ * -Read associated data if data information can be found
+ ************************************************************/
+ if (RET_NORMAL == Retapi) {
+ /* Set error to processing result (Set normal when search is normal) */
+ Retapi = RET_ERROR;
+
+ for (uiDataPos = 0; uiDataPos < uiDataNum; uiDataPos++) {
+ /* Determine file information */
+ iRet = memcmp(&tcReadBuf[uiDataPos], tcDataIndex, strlen(tcDataIndex));
+
+ /************************************************************
+ * If the applicable data information(Data information matched)
+ ************************************************************/
+ if (0 == iRet) {
+ /* Move to data position (Move file information)*/
+ uiDataPos += strlen(tcDataIndex) / sizeof(TCHAR);
+
+ /* Set normal to processing result for data discovery */
+ Retapi = RET_NORMAL;
+
+ /************************************************************
+ * Data read processing
+ * -Read data from the read data size
+ * -Assume that he end of the data has been reached when the following conditions are met
+ * NULL character code
+ * Line feed character code
+ * The data end of the configuration file is exceeded.
+ ************************************************************/
+ for (uiCpyPos = 0; uiCpyPos < tcDataSize; uiCpyPos++) {
+ if (uiDataNum > uiDataPos) {
+ /* Coverity CID: 18781 compliant */
+ /* If it is valid data */
+ if ((PBCOM_UNICODE_NUL != tcReadBuf[uiDataPos]) &&
+ (PBCOM_UNICODE_LF != tcReadBuf[uiDataPos])) {
+ /* Data setting*/
+ tcDataValue[uiCpyPos] = tcReadBuf[uiDataPos];
+ } else {
+ /* Exit from this loop */
+ break;
+ }
+ } else {
+ /* When the end of data is reached */
+ /* Exit from this loop */
+ break;
+ }
+ /* Move the data position by the set amount */
+ uiDataPos++;
+ }
+ /************************************************************
+ * Completion of data information search
+ ************************************************************/
+ break;
+ } else {
+ /************************************************************
+ * Not applicable data information(Data information mismatch)
+ ************************************************************/
+ /************************************************************
+ * Move to next data information
+ * -Determine supine data if following condition is met
+ * Line feed character code
+ * -End processing when the end of file is reached
+ ************************************************************/
+ while (uiDataPos < uiDataNum) {
+ /* Data determination */
+ if (PBCOM_UNICODE_LF == tcReadBuf[uiDataPos]) {
+ /*Next Data Detection */
+ break;
+ }
+ /* Move the data by the determined amount */
+ uiDataPos++;
+ }
+ }
+ }
+ }
+ return Retapi;
+}
+#endif /* PBCOM_CONFIGREAD */
+
+#ifdef PBCOM_CONFIGREAD
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SysUniToInt
+ * ABSTRACT : Converting from Unicode(string) to Int(number)
+ * NOTE : Convert from Unicode(string) to Int(number).
+ * : The number of characters that can be converted is defined in PBCOM_UTOIMAX_NUM.
+ * : When this module is called, an area must be allocated at a higher level.
+ * : Parameter checking is not performed in this module.
+ * ARGUMENT : TCHAR* tcData(Character string storage area)
+ * : int iDataSize(Character array size)
+ * RETURN : Number converted from character string
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static int SysUniToInt(TCHAR* tcData, u_int32 iDataSize) {
+ int iValue = 0; /* Converted value */
+ u_int8 ucCount = 0; /* Character string data position */
+
+ /************************************************************
+ * Parameter check
+ ************************************************************/
+ if (PBCOM_UTOIMAX_NUM < iDataSize) {
+ iDataSize = PBCOM_UTOIMAX_NUM;
+ }
+
+ /************************************************************
+ * Conversion from string to number
+ ************************************************************/
+ for (ucCount = 0; ucCount < iDataSize; ucCount++) {
+ /*If it is a number */
+ if ((tcData[ucCount] >= '0') &&
+ (tcData[ucCount] <= '9')) {
+ iValue = (iValue * 10) + (tcData[ucCount] - '0');
+ } else {
+ /* If it is not a digit */
+ /* End of data */
+ break;
+ }
+ }
+ return iValue;
+}
+#endif /* PBCOM_CONFIGREAD */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : _sysCommon.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbDram.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbDram.cpp
new file mode 100755
index 0000000..eb70131
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbDram.cpp
@@ -0,0 +1,284 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbDram.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System common functions
+ Title : System API
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+
+/*
+ Constants and structure definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define END 0xFFFFFFFF /* DRAM R/W check address table end flag */
+/* Definitions for CRC calculations */
+#define DIV_BYTE_DATA 0x000000FF
+#define CRC_INIT 0x00000000
+#define DATA_L_SHIFTNUM 8
+#define DATA_R_SHIFTNUM 24
+
+/*
+ Global Variable Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+extern int g_n_api_set_id; /* ID variable for PSL registration */
+
+/*
+External function prototype declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef __cplusplus
+extern "C" {
+#endif
+ BOOL VirtualCopy(LPVOID lpv_dest, LPVOID lpv_src, DWORD cb_size, DWORD fdw_protect);
+#ifdef __cplusplus
+};
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramWt
+ * ABSTRACT : DRAM self-refresh area write process
+ * NOTE : Write the content of the buffer to the offset-position of the area of the specified DRAM ID.
+ * Perform CRC calculation and add it to the end of the area
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * void *pbuf Source buffer pointer
+ * u_int32 off Destination DRAM offsets(bytes)
+ * u_int16 size Transfer data size(bytes)
+ * RETURN : RET_API defineed
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret = PbDramWt32(id, pbuf, off, (u_int32)size);
+ return(ret);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbDramWt32
+ * ABSTRACT : DRAM self-refresh area write process
+ * NOTE : Write the content of the buffer to the offset-position of the area of the specified DRAM ID.
+ * Perform CRC calculation and add it to the end of the area
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * void *pbuf Source buffer pointer
+ * u_int32 off Destination DRAM offsets(bytes)
+ * u_int32 size Transfer data size(bytes)
+ * RETURN : RET_API defined
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbDramWt32(u_int8 id, void *pbuf, u_int32 off, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramRd
+ * ABSTRACT : DRAM self-refresh area read process
+ * NOTE : Write the offsets of the area of the specified DRAM ID to buffer.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int32 off Source DRAM Offsets(bytes)
+ * void *pbuf Destination buffer pointer
+ * u_int16 size Transfer data size(bytes)
+ * RETURN : RET_API definef
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramRd32
+ * ABSTRACT : DRAM self-refresh area read process
+ * NOTE : Write the offsets of the area of the specified DRAM ID to buffer.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int32 off Source DRAM Offset(bytes)
+ * void *pbuf Destination buffer pointer
+ * u_int32 size Transfer data size(bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramSz
+ * ABSTRACT : DRAM ID size acquisition processing
+ * NOTE : Get the effective area size of the specified DRAM ID.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int16 *psize Size(bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramSz(u_int8 id, u_int16 *psize) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramSz32
+ * ABSTRACT : DRAM ID size acquisition processing
+ * NOTE : Get the effective area size of the specified DRAM ID.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int32 *psize Size(bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramSz32(u_int8 id, u_int32 *psize) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramFilCrc
+ * ABSTRACT : DRAM memory-fill process (add CRC-value)
+ * NOTE : Fill with the specified patterns from the offset position of the area of the specified DRAM ID.
+ * After filling, add result of the CRC calculation to the end of the region.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int32 off Fill destination DRAM offset(bytes)
+ * u_int8 pat Fill pattern
+ * u_int16 size Fill size(bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramFilCrc(u_int8 id, u_int32 off, u_int8 pat, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramFil32Crc
+ * ABSTRACT : DRAM memory-fill process (CRC-value addition)
+ * NOTE : Fill with the specified patterns from the offset position of the area of the specified DRAM ID.
+ * After filling, perform CRC calculation and add it to the end of the region
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * u_int32 off Fill destination DRAM offset(bytes)
+ * u_int8 pat Fill pattern
+ * u_int32 size Fill size(bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramFil32Crc(u_int8 id, u_int32 off, u_int8 pat, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramCrcChk
+ * ABSTRACT : DRAM self-refresh area CRC-check
+ * NOTE : Perform CRC calculation for the specified area and check whether the CRC value is normal.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramCrcChk(u_int8 id) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramRWChk
+ * ABSTRACT : DRAM read/write checking
+ * NOTE : Check whether DRAM can be read/written correctly
+ * ARGUMENT : None
+ * RETURN : RET_API define RET_NORMAL : Normal status
+ * RET_ERROR : In case of read/write error
+ * RET_OSERRER : Virtual area mapping error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramRWChk(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/*******************************************************************************
+ * MODULE : Crc
+ * ABSTRACT : Calculate sum of a given range
+ * FUNCTION : RET_API Crc(u_int32 start_addr,u_int32 size, u_int32 *sum);
+ * ARGUMENT : u_int32 start_addr Top address
+ * u_int32 size Size
+ * u_int32* sum Sum value storage
+ * NOTE : Calculate the 4 bytes sum of the size portion from start_addr and stores the result in sum.
+ * If start_addr and size are not 4-bytes boundaries, errors are returned.
+ * On error, -1 is stored in sum and returned.
+ * RETURN : RET_NORMAL Sum value calculation success
+ * RET_ERROR Sum value calculation failed
+ ******************************************************************************/
+RET_API
+Crc(u_int32 start_addr, u_int32 size, u_int32 *sum) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DramDestroy
+ * ABSTRACT : SRAM alternative DRAM self-refresh area destruction process
+ * NOTE : The SRAM replacement DRAM self-refresh area is destroyed by adding 1
+ * to the CRC value held by the area ID and destroying the CRC value.
+ * ARGUMENT : u_int8 id DRAM Area IDs
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DramDestroy(u_int8 id) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : CrcEx
+ * ABSTRACT : Calculate the sum of the CRC values in the given range and the CRC values passed in the arguments
+ * FUNCTION : RET_API CrcEx(u_int32 start_addr, u_int32 size, u_int32 *sum, u_int32 addcrc);
+ * ARGUMENT : u_int32 start_addr Top address
+ * u_int32 size Size
+ * u_int32* sum CRC value storage
+ * u_int32 addcrc CRC value to add
+ * NOTE : When the 4-bytes-CRC value for the size is calculated from start_addr,
+ * Add the CRC value passed in the fourth argument to sum, and store it in sum.
+ * Note:Because the address align is undefined, 1-byte calculation shall be performed.
+ * RETURN : RET_NORMAL Sum value calculation success
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+CrcEx(u_int32 start_addr, u_int32 size, u_int32 *sum, u_int32 addcrc) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : _pbDram.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbEvent.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbEvent.cpp
new file mode 100755
index 0000000..0912a13
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbEvent.cpp
@@ -0,0 +1,1695 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbEvent.cpp
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <vehicle_service/positioning_base_library.h>
+#include "_pbEvent_Internal.h"
+#include "_pbInternalProc.h"
+#include "WPF_STD_private.h"
+#include "tchar.h"
+
+/*---------------------------------------------------------------------------------*
+ * Internal Function Prototype *
+ *---------------------------------------------------------------------------------*/
+static BOOL FindEventTable(PB_EVENT*, TCHAR*, u_int32*);
+static BOOL AllocNewEventTable(PB_EVENT*, u_int32*);
+
+static void FreeEventTable(PB_EVENT* p_event_table, int index);
+static RET_API SetProc(PB_EVENT_OPEN_HANDLE* p_event_open, int32 i_mode, int32 l_val, int32* lp_val);
+static RET_API WaitProc(PB_EVENT_OPEN_HANDLE*, WAITING_CONDITION*, u_int32);
+static BOOL CheckCondition(PB_EVENT* p_sys_event, DWORD wcn, int32 l_event_data);
+
+static EventID EventCreateNewEventInSystem(u_int8, int32, TCHAR*);
+static EventID EventCreateNewEventInProcess(u_int32);
+
+static RET_API EventSendSignal(PB_EVENT_OPEN_HANDLE*, u_int32);
+static RET_API EventWaitForSignal(PB_EVENT_OPEN_HANDLE*, u_int32, u_int32);
+
+static BOOL EventCreateMutex(PB_EVENT_OPEN_HANDLE*);
+static void EventLockMutex(PB_EVENT_OPEN_HANDLE*);
+static void EventUnlockMutex(PB_EVENT_OPEN_HANDLE*);
+static void EventDeleteMutex(PB_EVENT_OPEN_HANDLE*);
+
+void GetDebugEventMngTblSysEvent(void* p_buf, PB_EVENT* p_evt, uint8_t* p_indent);
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static PB_EVENT_INSTANCE g_instance; // NOLINT(readability/nolint)
+
+static uint8_t g_my_proc_cnt; /* Invoking process counter value */
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Initializing Event-Related Processing
+ *
+ * Instantiate and initialize system API event related processing.
+ * Creates a flags in the CLS event library.
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRINIT Initialization error
+ */
+RET_API EventInit(void) {
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ PB_EVENT* p_event_table = NULL;
+ u_int32 ul_share_mem_size = 0;
+ RET_API ret_api = RET_ERROR;
+ char c_share_mem_name[32] = {0};
+ char c_sem_name[32] = {0};
+ void *pv_share_mem_addr = NULL;
+ int32 n;
+ RET_API l_ret_api;
+
+ /* Create Mutex */
+ _tcscpy(c_sem_name, "POS_BASE_EVENT_MUTEX");
+ p_inst->id_event_table_sem = _pb_CreateSemaphore(c_sem_name); // LCOV_EXCL_BR_LINE 200: can not be 0
+ if (p_inst->id_event_table_sem == 0) /* When mutex creation fails */ { // LCOV_EXCL_BR_LINE 200: can not be 0
+ // LCOV_EXCL_START 200: can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "_pb_CreateSemaphore ERROR [name:%s]", c_sem_name);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+ }
+
+ l_ret_api = _pb_SemLock(p_inst->id_event_table_sem); /* Get event-control-table-locking Mutex */
+ if (l_ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+
+ /* Initialize table of handles. */
+ for (n = 0; n < MAX_PB_EVENTS; n++) {
+ p_inst->p_handle_table[n] = NULL;
+ }
+
+ /* Generate shared memory name */
+ _tcscpy(c_share_mem_name, "POS_BASE_EVENT_TABLE");
+
+ /* Link to event information storage area */
+ ret_api = _pb_LinkShareData(c_share_mem_name, &pv_share_mem_addr, &ul_share_mem_size);
+ if (ret_api != RET_NORMAL) /* When the link fails */ {
+ /* Generate shared memory */
+ ret_api = _pb_CreateShareData(c_share_mem_name,
+ static_cast<u_int32>((sizeof(PB_EVENT) * MAX_PB_EVENTS)), &pv_share_mem_addr);
+
+ /* Terminate processing when generating fails */
+ if (ret_api != RET_NORMAL) {
+ ret_api = RET_ERRINIT; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* Event information storage area initialization processing */
+ p_event_table = reinterpret_cast<PB_EVENT*>(pv_share_mem_addr);
+ for (n = 0; n < MAX_PB_EVENTS; n++) {
+ memset(reinterpret_cast<void *>(p_event_table[n].event_name), 0, \
+ sizeof(p_event_table[n].event_name));
+ p_event_table[n].l_event_val = 0;
+ for (int wcn = 0; wcn < MAX_PB_EVENT_WAIT_THREADS; wcn++) {
+ p_event_table[n].st_condition[wcn].uc_use_flag = FALSE; /* Initialize to unused */
+ p_event_table[n].st_condition[wcn].uc_waiting = FALSE;
+ p_event_table[n].st_condition[wcn].us_mode = 0;
+ p_event_table[n].st_condition[wcn].ul_mask = 0; /* Initialize Mask Value */
+ p_event_table[n].st_condition[wcn].l_min_val = 0;
+ p_event_table[n].st_condition[wcn].l_max_val = 0;
+ /* Initialize event values at WaitEvent Returns */
+ p_event_table[n].st_condition[wcn].l_last_val = 0;
+ p_event_table[n].st_condition[wcn].flag_id[p_event_table->proc_cnt] = 0;
+ }
+
+ p_event_table[n].l_process_ref = 0;
+ p_event_table[n].l_reset_data = 0;
+ p_event_table[n].uc_manual_reset = _CWORD64_EVENT_MANUALRESET_OFF;
+ }
+ }
+ } else {
+ /* When the link is successful */
+ p_event_table = reinterpret_cast<PB_EVENT*>(pv_share_mem_addr);
+ p_event_table->proc_cnt++;
+ }
+
+ if (ret_api == RET_NORMAL) /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ {
+ g_my_proc_cnt = p_event_table->proc_cnt;
+ /* Get the address of the acquired event information storage area. */
+ p_inst->h_shared_memory = (HANDLE)pv_share_mem_addr;
+ p_inst->p_event_table = reinterpret_cast<PB_EVENT*>(pv_share_mem_addr);
+ }
+
+ _pb_SemUnlock(p_inst->id_event_table_sem); // LCOV_EXCL_BR_LINE 200: no branch
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Event-related instance destruction processing
+ *
+ * Delete a Flag from the CLS Event Library (Not implemented)
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR ABEND
+ */
+RET_API EventTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ char c_share_mem_name[32] = {0};
+
+ RET_API ret_api = RET_NORMAL;
+
+ /* TODO:Implement processing to delete event flags */
+
+ /* Generate shared memory name */
+ _tcscpy(c_share_mem_name, "POS_BASE_EVENT_TABLE");
+
+ /* Discard the semaphore if it has already been created */
+ if (p_inst->id_event_table_sem != 0) {
+ PbDeleteSemaphore(p_inst->id_event_table_sem);
+ p_inst->id_event_table_sem = 0;
+ }
+
+ /* Discard the shared memory if it has already been created */
+ if (p_inst->h_shared_memory != NULL) {
+ /* Release shared memory */
+ PbDeleteShareData(c_share_mem_name);
+ p_inst->h_shared_memory = NULL;
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create the event
+ *
+ * Create an event with the specified name and returns the event ID.<br>
+ * If it has already been generated, the event ID is searched and returned.
+ *
+ * @param[in] uc_manual_reset
+ * @param[in] l_init_data
+ * @param[in] *cp_event_name Pointer to the names of the event to be generated (NULL termination string)
+ *
+ * @return Non-zero Generated event ID<br>
+ * 0 Event generation error
+ */
+EventID _pb_CreateEvent(u_int8 uc_manual_reset, int32 l_init_data, // NOLINT(readability/nolint)
+ char *cp_event_name) { // NOLINT(readability/nolint)
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ EventID ret_event_id = 0;
+ TCHAR *p_event_name = NULL;
+ u_int32 index = 0;
+ BOOL bret = FALSE;
+ BOOL check_status = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ RET_API l_ret_api;
+
+ /* Parameter check */
+ if ((cp_event_name == NULL) ||
+ (uc_manual_reset >= _CWORD64_EVENT_MANUALRESET_MAX)) {
+ check_status = FALSE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+#ifdef UNICODE
+ /* Event name character limit processing */
+ if (strlen(cp_event_name) > MAX_EVENT_NAME_LEN) {
+ _pb_Exit(); /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ TCHAR unicodeEventName[MAX_EVENT_NAME_LEN + 1]; /* Maxmum nunber of characters + NULL area */
+ mbstowcs(unicodeEventName, cp_event_name, MAX_EVENT_NAME_LEN);
+ p_event_name = unicodeEventName;
+#else
+ p_event_name = cp_event_name;
+#endif // UNICODE
+
+ if ((check_status == TRUE) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (p_event_name[0] == __TEXT('\0'))) {
+ check_status = FALSE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Event name character limit processing */
+ if ((check_status == TRUE) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ (_tcslen(p_event_name) < MAX_EVENT_NAME_LEN)) {
+ l_ret_api = _pb_SemLock(p_inst->id_event_table_sem); /* Mutex from here */
+ if (l_ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+
+ /* Search the event table by the specified event name */
+ bret = FindEventTable(p_inst->p_event_table, p_event_name, &index);
+ /* If the same event already exists on the system */
+ if (bret != FALSE) {
+ ret_event_id = EventCreateNewEventInProcess(index); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ /* When creating a new file */
+ ret_event_id = EventCreateNewEventInSystem(uc_manual_reset, l_init_data, p_event_name); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+ }
+
+ _pb_SemUnlock(p_inst->id_event_table_sem); // LCOV_EXCL_BR_LINE 200: no branch
+ }
+
+ return ret_event_id;
+}
+
+/**
+ * @brief
+ * Set the event
+ *
+ * Set the event value by specifying the event ID acquired when the event was created.<br>
+ * The event value setting modes are as follows.<br>
+ * SAPI_EVSET_ABSOLUTE : Absolute value setting(Specify the value to be set.)<br>
+ * SAPI_EVSET_RELATE : Relative value setting(Specifies the value relative to the current value.)
+ *
+ * @param[in] event_id Specify the event ID for which the event value is to be set.
+ * @param[in] l_set_mode Specify the event value setting mode
+ * @param[in] l_Val Specify the event value to be set
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Configuration mode error<br>
+ * RET_EV_NONE Specified event does not exist<br>
+ * RET_EV_MAX The set event value exceeds the maximum value<br>
+ * RET_EV_MIN The set event value is below the minimum value.
+ */
+RET_API _pb_SetEvent(EventID event_id, int32 l_set_mode, int32 l_val) { // NOLINT(readability/nolint)
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ RET_API ret_sts = RET_EV_NONE;
+ int32 l_work_val = 0;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if (ul_index < MAX_PB_EVENTS) {
+ /* If the specified event ID value is within range */
+ p_event_open = p_inst->p_handle_table[ul_index];
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ /* Determine the event setting mode and call the event value setting function. */
+ if (l_set_mode == SAPI_EVSET_ABSOLUTE) {
+ ret_sts = SetProc(p_event_open, EVSET_ABSOLUTE, l_val, &l_work_val); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+ } else if (l_set_mode == SAPI_EVSET_RELATE) {
+ ret_sts = SetProc(p_event_open, EVSET_RELATE, l_val, &l_work_val); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ ret_sts = RET_ERRPARAM;
+ }
+ }
+ }
+
+ return ret_sts;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SetandEvent()
+ * ABSTRACT : Event value AND setting process
+ * NOTE : Set the logical AND result of the specified mask value to the event value of the specified event ID.
+ * ARGUMENT : EventID event_id Specify the event ID to wait for an event
+ * : u_int32 ul_mask Mask value to be logically ANDed with the event value
+ * : int32* pl_val Pointer to the area to store the pre-event value
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE Specified event does not exist
+ * : RET_ERROR
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SetandEvent(EventID event_id, u_int32 ul_mask, int32* pl_val) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if ((ul_index < MAX_PB_EVENTS) &&
+ (pl_val != NULL)) {
+ /* If the specified event ID value is within range */
+ p_event_open = p_inst->p_handle_table[ul_index];
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ ret_sts = SetProc(p_event_open, EVSET_AND, static_cast<int32>(ul_mask), pl_val);
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SetorEvent()
+ * ABSTRACT : Event value OR setting process
+ * NOTE : Set the logical OR result of the specified mask value and the event value of the specified event ID.
+ * ARGUMENT : EventID event_id Specify the event ID to wait for an event.
+ * : u_int32 ul_mask Mask value to be logically ANDed with the event value
+ * : int32* pl_val Pointer to the area to store the pre-event value
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE Specified event does not exist
+ * : RET_ERROR
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SetorEvent(EventID event_id, u_int32 ul_mask, int32* pl_val) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if ((ul_index < MAX_PB_EVENTS) &&
+ (pl_val != NULL)) {
+ /* If the specified event ID value is within range */
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ ret_sts = SetProc(p_event_open, EVSET_OR, static_cast<int32>(ul_mask), pl_val);
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Wait for the event
+ *
+ * Wait until the event value of the specified event ID reaches the specified range.
+ *
+ * @param[in] event_id Specify the event ID for which the event value is to be set.
+ * @param[in] l_wait_mode Monitoring mode of event * Current only SAPI_EVWAIT_VAL is allowed
+ * @param[in] l_min_val Minimum Event Wait
+ * @param[in] l_max_val Maximum value waiting for an event
+ * @param[in] *pl_event_val Pointer to the event value storage area after waiting for an event
+ * @param[in] ul_mill_sec_time Timeout period(ms)
+ *
+_ * @return RET_NORMAL Normal completion<br>
+ * RET_EV_NONE Specified event does not exist<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_WaitEvent(EventID event_id, int32 l_wait_mode, int32 l_min_val, // NOLINT(readability/nolint)
+ int32 l_max_val, int32* pl_event_val, u_int32 ul_mill_sec_time) { // NOLINT(readability/nolint)
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ WAITING_CONDITION st_condition = {0};
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if ((pl_event_val != NULL) &&
+ (ul_index < MAX_PB_EVENTS)) {
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ /* Set Wait Mode and Mask Value to Parameter Blk */
+ st_condition.us_mode = EVWAIT_VAL;
+ st_condition.l_min_val = l_min_val;
+ st_condition.l_max_val = l_max_val;
+
+ /* Call the event wait processing */
+ ret_sts = WaitProc(p_event_open, &st_condition, ul_mill_sec_time); // LCOV_EXCL_BR_LINE 200: no branch
+ if (ret_sts == RET_NORMAL) {
+ *pl_event_val = st_condition.l_last_val;
+ }
+ }
+ }
+
+ return ret_sts;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : WaitallclrEvent()
+ * ABSTRACT : Event Bit Clear Wait
+ * NOTE : Wait until all the bits specified by the mask value are cleared
+ * : for the event value of the specified event ID.
+ * ARGUMENT : EventID event_id Specifies the event ID to wait for an event.
+ * : u_int32 ul_mask Mask value waiting for an event (Bit pattern)
+ * : int32* pl_val Pointer to the event value storage area after waiting for an event
+ * : u_itn32 ul_mill_sec_time Timeout period(ms)
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE Specified event does not exist
+ * : RET_ERROR Maximum number of waiting threads exceeded
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+WaitallclrEvent(EventID event_id, u_int32 ul_mask, int32* pl_val, u_int32 ul_mill_sec_time) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ WAITING_CONDITION st_condition = {0};
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = static_cast<u_int32>(event_id) - 1;
+
+ /* Parameter check */
+ if ((pl_val != NULL) &&
+ (ul_index < MAX_PB_EVENTS)) {
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ /* Set Wait Mode and Mask Value to Parameter Blk */
+ st_condition.us_mode = EVWAIT_ALLCLR;
+ st_condition.ul_mask = ul_mask;
+
+ /* Call the event wait processing */
+ ret_sts = WaitProc(p_event_open, &st_condition, ul_mill_sec_time);
+ if (ret_sts == RET_NORMAL) {
+ *pl_val = st_condition.l_last_val;
+ }
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : WaitanysetEvent()
+ * ABSTRACT : Event Bit Set Waiting Process
+ * NOTE : Wait until one of the bits specified by the mask value is set
+ * : for the event value of the specified event ID.
+ * ARGUMENT : EventID event_id Specify the event ID to wait for an event.
+ * : u_int32 ul_mask Mask value waiting for an event
+ * : int32* ipVal Pointer to the event value storage area after waiting for an event
+ * : u_itn32 ul_mill_sec_time Timeout period(ms)
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE Specified event does not exist
+ * : RET_ERROR When the maximum number of waiting events is exceeded
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+WaitanysetEvent(EventID event_id, u_int32 ul_mask, int32* pl_val, u_int32 ul_mill_sec_time) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ WAITING_CONDITION st_condition = {0};
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if ((pl_val != NULL) &&
+ (ul_index < MAX_PB_EVENTS)) {
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* If the specified event ID is registered in the table, */
+ if (p_event_open != NULL) {
+ /* Set Wait Mode and Mask Value to Parameter Blk */
+ st_condition.us_mode = EVWAIT_ANYSET;
+ st_condition.ul_mask = ul_mask;
+
+ /* Call the event wait processing */
+ ret_sts = WaitProc(p_event_open, &st_condition, ul_mill_sec_time);
+ if (ret_sts == RET_NORMAL) {
+ *pl_val = st_condition.l_last_val;
+ }
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : LookupEvent()
+ * ABSTRACT : Event value reading process
+ * NOTE : Read the event value of the specified event ID.
+ * ARGUMENT : EventID event_id Specify the event ID to read the event value from.
+ * : int32 *iEventVal Pointer to the read event value storage area
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE Specified event does not exist
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+LookupEvent(EventID event_id, int32* pl_event_val) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ u_int32 ul_index = (u_int32)event_id - 1;
+ RET_API ret_sts = RET_EV_NONE;
+
+ /* Parameter check */
+ if ((pl_event_val != NULL) &&
+ (ul_index < MAX_PB_EVENTS)) {
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* When the specified event ID is already registered in the table */
+ if (p_event_open != NULL) {
+ EventLockMutex(p_event_open);
+ /* Store the current event value. */
+ *pl_event_val = static_cast<int32>(p_event_open->p_sys_event->l_event_val);
+ EventUnlockMutex(p_event_open);
+ ret_sts = RET_NORMAL;
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Delete the event
+ *
+ * Delete the event with the specified event ID.
+ *
+ * @param[in] event_id Specify the event ID for which the event value is to be set.
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_EV_NONE Specified event does not exist
+ */
+RET_API _pb_DeleteEvent(EventID event_id) { // NOLINT(readability/nolint)
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ RET_API ret_api = RET_EV_NONE;
+ u_int32 index = static_cast<u_int32>(event_id) - 1;
+ EV_ERR ev_err;
+ RET_API l_ret_api;
+
+ /* Parameter check */
+ if (index < MAX_PB_EVENTS) {
+ p_event_open = p_inst->p_handle_table[index];
+ /* When the specified event ID is registered in the table */
+ if (p_event_open != NULL) {
+ ret_api = RET_NORMAL;
+ }
+ }
+
+ /* Parameter normal */
+ if (ret_api == RET_NORMAL) {
+ l_ret_api = _pb_SemLock(p_inst->id_event_table_sem);
+ if (l_ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed");
+ }
+
+ /* When no one references in the same process */
+ if ((p_event_open->l_thread_ref - 1) <= 0) {
+ /* Delete event flag */
+ ev_err = EV_destroy_flag(p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]);
+ /* When initialization fails */
+ if (ev_err == EV_OK) {
+ p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt] = 0;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "EV_destroy_flag ERROR!! [ev_err=%d, flag_id=0x%x]", \
+ ev_err, p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]);
+
+ ret_api = RET_ERROR;
+ }
+ }
+
+ /* When the event flag is deleted successfully */
+ if (ret_api == RET_NORMAL) {
+ /* Reduce the number of event references in the same process */
+ p_event_open->l_thread_ref--;
+
+ /* When no one references in the same process */
+ if (p_event_open->l_thread_ref <= 0) {
+ /* Reduce the number of event references in the system */
+ p_event_open->p_sys_event->l_process_ref--;
+ }
+
+ /* When no one references in the system */
+ if (p_event_open->p_sys_event->l_process_ref <= 0) {
+ /* Initialization of the target area */
+ FreeEventTable(p_inst->p_event_table, index);
+ }
+
+ /* If no one references in the same process, release the resource here */
+ if (p_event_open->l_thread_ref <= 0) {
+ /* Exclusive deletion for the target event */
+ EventDeleteMutex(p_event_open);
+
+ /* Open the heap area storing the target event. */
+ /* */
+ PbProcessHeapFree(0, p_inst->p_handle_table[index]);
+ p_inst->p_handle_table[index] = NULL;
+ }
+ }
+
+ _pb_SemUnlock(p_inst->id_event_table_sem);
+ }
+
+ return ret_api;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : ResetEvent()
+ * ABSTRACT : Event Clear
+ * NOTE : Specified event clear processing
+ * ARGUMENT : EventID event_id Event ID to reset
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_EV_NONE ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+ResetEvent(EventID event_id) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ RET_API ret_sts = RET_EV_NONE;
+ u_int32 ul_index = (u_int32)event_id - 1;
+
+ /* Parameter check */
+ if (ul_index < MAX_PB_EVENTS) {
+ p_event_open = p_inst->p_handle_table[ul_index];
+
+ /* When the specified event ID is already registered in the table */
+ if (p_event_open != NULL) {
+ EventLockMutex(p_event_open);
+
+ /* Clear the event value */
+ p_event_open->p_sys_event->l_event_val = p_event_open->p_sys_event->l_reset_data;
+
+ EventUnlockMutex(p_event_open);
+ ret_sts = RET_NORMAL;
+ }
+ }
+
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* Private functions. */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SetProc()
+ * ABSTRACT : General Event Configuration Processing
+ * NOTE : Sets the event according to the specified event setting method.
+ * ARGUMENT : PB_EVENT_OPEN_HANDLE* p_event_open Pointer to manage event waiting for the event TBL
+ * : int32 i_mode Event setting method
+ * : int32 iVal Event setting value
+ * : int32* ipVal Pointer to the area to store the pre-event value
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_ERROR
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static RET_API
+SetProc(PB_EVENT_OPEN_HANDLE* p_event_open, int32 i_mode, int32 l_val, int32* lpVal) {
+ RET_API ret_sts = RET_NORMAL;
+ int32 lTempEventData = 0;
+ int32 lTestValue = 0;
+ BOOL bCastCondFlag = FALSE;
+
+ EventLockMutex(p_event_open);
+
+ /* Get current event value */
+ lTempEventData = p_event_open->p_sys_event->l_event_val;
+ *lpVal = p_event_open->p_sys_event->l_event_val; /* Set the value before the event operation */
+
+ /* Switch Processing by event configuration mode */
+ switch (i_mode) { // LCOV_EXCL_BR_LINE 200:only the first two cases will be called
+ case EVSET_ABSOLUTE: /* In absolute mode */ {
+ /* Updating event values with specified values */
+ lTempEventData = l_val;
+ break;
+ }
+ case EVSET_RELATE: /* In relative setting mode */ {
+ lTestValue = lTempEventData + l_val;
+ /* Exceeding representable event value */
+ if ((l_val > 0) && (lTempEventData > lTestValue)) {
+ ret_sts = RET_EV_MAX;
+ }
+ /* Below representable event value */
+ if ((l_val < 0) && (lTempEventData < lTestValue)) {
+ ret_sts = RET_EV_MIN;
+ }
+ /* Normal range */
+ if (ret_sts == RET_NORMAL) {
+ /* Add specified value to event value */
+ lTempEventData += l_val;
+ }
+ break;
+ }
+ case EVSET_AND: { // LCOV_EXCL_BR_LINE 200: i_mode cannot be this value
+ // LCOV_EXCL_START 200: i_mode cannot be this value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lTempEventData &= ((u_int32)l_val); /* Logical AND of the event value and the specified value */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case EVSET_OR: { // LCOV_EXCL_BR_LINE 200: i_mode cannot be this value
+ // LCOV_EXCL_START 200: i_mode cannot be this value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lTempEventData |= ((u_int32)l_val); /* Logical AND of the event value and the specified value */
+ break;
+ // LCOV_EXCL_STOP
+ }
+ default: /* Event setting mode error */ // LCOV_EXCL_BR_LINE 200: i_mode cannot be this value
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_sts = RET_ERRPARAM; // LCOV_EXCL_LINE 200: i_mode cannot be this value
+ }
+
+ /* When the manual reset function is enabled */
+
+ if (ret_sts == RET_NORMAL) {
+ /* When the manual reset function is enabled */
+ if (p_event_open->p_sys_event->uc_manual_reset == _CWORD64_EVENT_MANUALRESET_ON) {
+ /* Set event value */
+ p_event_open->p_sys_event->l_event_val = lTempEventData;
+ }
+
+ /* Loop for the maximum number of waiting threads per event and check the condition of event wait processing of the state TBL. */
+ for (DWORD wcn = 0; wcn < MAX_PB_EVENT_WAIT_THREADS; wcn++) {
+ /* If the event wait flag is waiting, */
+ if (p_event_open->p_sys_event->st_condition[wcn].uc_waiting == TRUE) {
+ /* Check if event wait conditions are met */
+ BOOL bret = CheckCondition(p_event_open->p_sys_event, wcn, lTempEventData);
+ /* If the event wait conditions are met, */
+ if (bret == TRUE) {
+ bCastCondFlag = TRUE;
+ /* Save the event value at the time of SetEvent issuance (at the time of WaitEvent return). */
+ p_event_open->p_sys_event->st_condition[wcn].l_last_val = lTempEventData;
+
+ /* Processing to prevent concurrent SetEvent from more than one threads for a single event which is in WAIT state */
+ /* Set WAIT status to wait-canceled */
+ p_event_open->p_sys_event->st_condition[wcn].uc_waiting = FALSE;
+ /* Setting the default min value for event */
+ p_event_open->p_sys_event->st_condition[wcn].l_min_val = MIN_EVENT_VAL;
+ /* Setting the default max event */
+ p_event_open->p_sys_event->st_condition[wcn].l_max_val = MAX_EVENT_VAL;
+
+ /* Signal issuance */
+ (void)EventSendSignal(p_event_open, static_cast<int>(wcn));
+ }
+ }
+ }
+
+ /* When the manual reset function is disabled */
+ if (p_event_open->p_sys_event->uc_manual_reset != _CWORD64_EVENT_MANUALRESET_ON) {
+ /* If no one has issued the event */
+ if (bCastCondFlag == FALSE) {
+ /* Set event value */
+ p_event_open->p_sys_event->l_event_val = lTempEventData;
+ } else {
+ /* If issued event */
+ /* Reset event value */
+ p_event_open->p_sys_event->l_event_val = p_event_open->p_sys_event->l_reset_data;
+ }
+ }
+ }
+
+ EventUnlockMutex(p_event_open);
+
+ return ret_sts;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : WaitProc()
+ * ABSTRACT : Generic Event Wait Processing
+ * NOTE : Wait for an event according to the wait queue of the specified event.
+ * ARGUMENT : PB_EVENT_OPEN_HANDLE* p_event_open Pointer to TBL which is managed waiting for events
+ * : WAITING_CONDITION* st_condition Pointer to the event wait condition setting parameter
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_ERROR The maximum number of waits has been exceeded, or a parameter error has occurred.
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static RET_API
+WaitProc(PB_EVENT_OPEN_HANDLE* p_event_open, WAITING_CONDITION* st_condition, u_int32 ul_mill_sec_time) {
+ RET_API ret_sts = RET_ERROR;
+ u_int32 ul_wcn = 0;
+
+ /* Get semaphore for event table */
+ EventLockMutex(p_event_open);
+
+ /* Loop for the maximum number of waiting threads per event and retrieve free area of state TBL */
+ for (ul_wcn = 0; ul_wcn < MAX_PB_EVENT_WAIT_THREADS; ul_wcn++) {
+ if ((p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag == FALSE) && \
+ (p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting == FALSE)) {
+ /* For the unused state TBL */
+ /* If the event wait flag is released, */
+ /* finish searching when free area is found */
+ ret_sts = RET_NORMAL;
+ break;
+ }
+ }
+
+ /* If there is free space in the state TBL */
+ if (ret_sts == RET_NORMAL) {
+ /* Set wait rule for free space of state TBL */
+ /* Determine the wait rule */
+ switch (st_condition->us_mode) { // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ALLCLR and EVWAIT_ANYSET
+ case EVWAIT_VAL: /* For range waiting */
+ {
+ /* Set event monitoring mode */
+ p_event_open->p_sys_event->st_condition[ul_wcn].us_mode = st_condition->us_mode;
+ /* Set the minimum value for establishing an event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_min_val = st_condition->l_min_val;
+ /* Set the maximum value for establishing an event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_max_val = st_condition->l_max_val;
+ break;
+ }
+ case EVWAIT_ALLCLR: /* If waiting for the specified bit to be cleared */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ALLCLR
+ case EVWAIT_ANYSET: /* If waiting for the specified bit to be set */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ANYSET
+ {
+ // LCOV_EXCL_START 200: can not be EVWAIT_ANYSET and EVWAIT_ALLCLR
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Set event monitoring mode */
+ p_event_open->p_sys_event->st_condition[ul_wcn].us_mode = st_condition->us_mode;
+ /* Set event wait mask value */
+ p_event_open->p_sys_event->st_condition[ul_wcn].ul_mask = st_condition->ul_mask;
+ break;
+ // LCOV_EXCL_STOP
+ }
+ default:
+ ret_sts = RET_ERROR;
+ }
+ }
+
+ /* When the specified mode is normal */
+ if (ret_sts == RET_NORMAL) {
+ /* Check if event wait conditions are met */
+ BOOL bret = CheckCondition(p_event_open->p_sys_event, ul_wcn, p_event_open->p_sys_event->l_event_val);
+
+ /* Target event received */
+ if (bret == TRUE) {
+ /* Set the received event value */
+ st_condition->l_last_val = p_event_open->p_sys_event->l_event_val;
+ /* Since it does not wait for an event, set the initial value to the state TBL. */
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting = FALSE;
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag = FALSE;
+ /* Set the default minimum value for the event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_min_val = MIN_EVENT_VAL;
+ /* Set the default maximum value for the event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_max_val = MAX_EVENT_VAL;
+
+ /* When the manual reset function is disabled */
+ if (p_event_open->p_sys_event->uc_manual_reset != _CWORD64_EVENT_MANUALRESET_ON) {
+ /* Initialize event values */
+ p_event_open->p_sys_event->l_event_val = p_event_open->p_sys_event->l_reset_data;
+ }
+ } else {
+ /* When no event is received */
+ /* Set event wait state in free area of state TBL */
+ /* Set event wait flag to waiting */
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting = TRUE;
+ /* Set table usage flag in use */
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag = TRUE;
+
+ /* Perform event wait */
+ ret_sts = EventWaitForSignal(p_event_open, ul_wcn, ul_mill_sec_time);
+ /* Set event wait flag to unused */
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_waiting = FALSE;
+ /* Set table usage flag to unused */
+ p_event_open->p_sys_event->st_condition[ul_wcn].uc_use_flag = FALSE;
+ /* Set the default minimum value for the event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_min_val = MIN_EVENT_VAL;
+ /* Setting the default maximum value for the event */
+ p_event_open->p_sys_event->st_condition[ul_wcn].l_max_val = MAX_EVENT_VAL;
+ /* Set event return value */
+ st_condition->l_last_val = p_event_open->p_sys_event->st_condition[ul_wcn].l_last_val;
+ }
+ }
+
+ /* Release semaphore for event table */
+ EventUnlockMutex(p_event_open);
+
+ return ret_sts;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FindEventTable()
+ * ABSTRACT : Event Table Search Processing
+ * NOTE : Search the event table for the specified event name and return the index number
+ * : of the event if it has been already registerd.
+ * ARGUMENT : PB_EVENT *p_event_table Pointer to the start of event table array in the shared memory
+ * : TCHAR *ptcEventName Event name to search
+ * : u_int32* puc_index storage area for the index number of the specified event table
+ * RETURN : BOOL FALSE No specified event
+ * : TRUE Specified Event Yes
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static BOOL
+FindEventTable(PB_EVENT* p_event_table, TCHAR* ptcEventName, u_int32* puc_index) {
+ u_int32 ul_index = 0;
+ BOOL bret = FALSE;
+
+ for (ul_index = 0; ul_index < MAX_PB_EVENTS; ul_index++) {
+ if (_tcscmp(p_event_table[ul_index].event_name, ptcEventName) == 0) {
+ /* Save target index */
+ *puc_index = ul_index;
+ bret = TRUE;
+ break;
+ }
+ }
+
+ return bret;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : AllocNewEventTable()
+ * ABSTRACT : Event table allocation processing
+ * NOTE : Search the event table pointed to from the beginning for an area in
+ * : which the event name is not registered, and returns its index number.
+ * : The event table structure is allocated as an array in shared memory.
+ * : One element of the array is the event table structure, and its index
+ * : plus one is used as the event ID.
+ * : Whether the event table structure is in use or unused is determined
+ * : by whether the event name is set or not.
+ * : Note: Since the Mutex part inside this function was deleted to
+ * : fix a bug caused by Mutex leak, use Mutex around this function from the
+ * : outside before using this function.
+ * ARGUMENT : PB_EVENT *p_event_table Start pointer of the event table array in shared memory
+ * : TCHAR *name Event name to reserve table Note: Currently unused.
+ * : HANDLE hMutex Mutex handle for event table Note: Currently unused.
+ * RETURN : DWORD other than -1 Index number of the allocted event table
+ * : -1 There is no free space in the event table.
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static BOOL
+AllocNewEventTable(PB_EVENT* p_event_table, u_int32* puc_index) {
+ u_int32 ul_index = 0;
+ BOOL bret = FALSE;
+
+ for (ul_index = 0; ul_index < MAX_PB_EVENTS; ul_index++) {
+ if (p_event_table[ul_index].event_name[0] == __TEXT('\0')) {
+ *puc_index = ul_index;
+ bret = TRUE;
+ break;
+ }
+ }
+
+ return bret;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FreeEventTable()
+ * ABSTRACT : Event table release processing
+ * NOTE : Initialize the event name and event value of the index number
+ * : of the specified event table to make them free.
+ * ARGUMENT : PB_EVENT *p_event_table Start pointer of the event table array in shared memory
+ * : int index Index number of the event table to release
+ * : HANDLE hMutex Mutex handle for event table
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void
+FreeEventTable(PB_EVENT* p_event_table, int index) {
+ p_event_table[index].event_name[0] = __TEXT('\0');
+ p_event_table[index].l_event_val = 0;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : CheckCondition()
+ * ABSTRACT : Event condition determination processing
+ * NOTE : Check whether the event value of the specified event table is
+ * : satisfied as an event wait condition.
+ * ARGUMENT : PB_EVENT *p_event_table Start pointer of the event table array in shared memory
+ * : DWORD wcn Index number of the event table to be checked
+ * RETURN : BOOL TRUE Condition satisfied
+ * : FALSE Condition not met
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static BOOL CheckCondition(PB_EVENT* p_sys_event, DWORD wcn, int32 l_event_data) {
+ BOOL bret = FALSE;
+
+ if (p_sys_event != NULL) { // LCOV_EXCL_BR_LINE 6: p_sys_event can not be NULL
+ /* Determine the wait mode of the event state TBL. */
+ switch (p_sys_event->st_condition[wcn].us_mode) { // LCOV_EXCL_BR_LINE 200: EVWAIT_ALLCLR and EVWAIT_ANYSET will not be called // NOLINT(whitespace/line_length)
+ case EVWAIT_VAL: /* For value range wait */
+ {
+ /* Check whether the event value is within the condition satisfied range */
+ if ((l_event_data >= p_sys_event->st_condition[wcn].l_min_val) &&
+ (l_event_data <= p_sys_event->st_condition[wcn].l_max_val)) {
+ bret = TRUE;
+ }
+ break;
+ }
+ case EVWAIT_ALLCLR: /* When waiting for all specified bits to be cleared */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ALLCLR // NOLINT(whitespace/line_length)
+ {
+ // LCOV_EXCL_START 200: can not be EVWAIT_ALLCLR
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if ((((u_int32)l_event_data) & p_sys_event->st_condition[wcn].ul_mask) == EVENT_BIT_ZERO) {
+ bret = TRUE;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ case EVWAIT_ANYSET: /* If the specified bit is waiting to set any bits */ // LCOV_EXCL_BR_LINE 200: can not be EVWAIT_ANYSET // NOLINT(whitespace/line_length)
+ {
+ // LCOV_EXCL_START 200: can not be EVWAIT_ALLCLR
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if ((((u_int32)l_event_data) & p_sys_event->st_condition[wcn].ul_mask) != EVENT_BIT_ZERO) {
+ bret = TRUE;
+ }
+ break;
+ // LCOV_EXCL_STOP
+ }
+ default: /* If the wait mode is out of range, */
+ break; /* return with error */
+ }
+ }
+
+ return bret;
+}
+
+/**
+ * @brief
+ * Event generation processing
+ *
+ * @param[in] u_int8 uc_manual_reset
+ * @param[in] int32 l_init_data
+ * @param[in] char *cp_event_name Pointer to the names of event to be generated (NULL termination string)
+ * @return EventID Non-zero Event ID created<br>
+ * 0 Event generation error
+ */
+static EventID EventCreateNewEventInSystem(u_int8 uc_manual_reset, int32 l_init_data, TCHAR* p_event_name) {
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ PB_EVENT *p_sys_event = NULL;
+ EventID ret_event_id = 0;
+ u_int32 ul_index = 0;
+ BOOL bret = FALSE;
+ EV_ERR ev_err;
+
+ /* Parameter check */
+ if (p_event_name != NULL) { // LCOV_EXCL_BR_LINE 6: p_event_name can not be NULL
+ /* Parameter normal */
+ /* Get the index number of the newly created event table */
+ bret = AllocNewEventTable(p_inst->p_event_table, &ul_index);
+
+ /* When there is no free space */
+ if (bret == FALSE) {
+ /* Error log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:_pb_CreateEvent : AllocNewEventTable Full... \r\n");
+ }
+ }
+
+ /* When there is free space */
+ if (bret != FALSE) {
+ /* allocate event table to generate from heap */
+ /* */
+ p_event_open = reinterpret_cast<PB_EVENT_OPEN_HANDLE*>(PbProcessHeapAlloc(0, sizeof(PB_EVENT_OPEN_HANDLE))); // LCOV_EXCL_BR_LINE 200: can not be NULL // NOLINT(whitespace/line_length)
+
+ /* Failure in allocating heap area */
+ if (p_event_open == NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ // LCOV_EXCL_START 200: can not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ bret = FALSE;
+ /* Error log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_CWORD64_api.dll:_pb_CreateEvent : CreateHeap ... GetAddr[0x%08x], size[%ld] \r\n",
+ p_event_open, sizeof(PB_EVENT_OPEN_HANDLE));
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ /* When the heap area can be allocated */
+ if (bret != FALSE) {
+ /* Initialization of generated event management information */
+ p_event_open->index = ul_index;
+ p_event_open->p_sys_event = &p_inst->p_event_table[ul_index];
+ p_event_open->l_thread_ref = 1;
+
+ /* Initialization processing of event information storage area */
+ p_sys_event = p_event_open->p_sys_event;
+ _tcscpy(p_sys_event->event_name, p_event_name); /* Event name registration */
+ p_sys_event->l_event_val = l_init_data; /* Default setting */
+ for (u_int32 ul_wcn = 0; ul_wcn < MAX_PB_EVENT_WAIT_THREADS; ul_wcn++) {
+ p_sys_event->st_condition[ul_wcn].uc_use_flag = FALSE;
+ p_sys_event->st_condition[ul_wcn].uc_waiting = FALSE;
+ p_sys_event->st_condition[ul_wcn].us_mode = 0;
+ p_sys_event->st_condition[ul_wcn].l_min_val = MIN_EVENT_VAL;
+ p_sys_event->st_condition[ul_wcn].l_max_val = MAX_EVENT_VAL;
+
+ /* Create Event Flag */
+ ev_err = EV_create_flag_auto_id(&(p_sys_event->st_condition[0].flag_id[g_my_proc_cnt])); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+ if (ev_err != EV_OK) /* When initialization fails */ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "EV_create_flag_auto_id ERROR!! [ev_err=%d, flag_id=0x%x", \
+ ev_err, p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]);
+
+ /* Release heap space */
+ PbProcessHeapFree(0, p_event_open); // LCOV_EXCL_BR_LINE 200: no branch
+
+ ret_event_id = 0;
+ bret = FALSE;
+ }
+ }
+
+ if (bret != FALSE) {
+ p_sys_event->l_process_ref = 1; /* Set the number of references to this event. */
+ p_sys_event->l_reset_data = l_init_data; /* Default setting */
+ p_sys_event->uc_manual_reset = uc_manual_reset; /* Setting for a manual reset */
+
+ /* Create an event table Mutex and set it in the event table. */
+ bret = EventCreateMutex(p_event_open);
+ /* If generating fails, reset is executed. */
+ if (bret == FALSE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n", LTEXT(__FILE__), __LINE__); \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CreateMutex Err ... Event Name[%s]\r\n", p_event_name);
+ _pb_Exit();
+ }
+
+ /* Register event table with event instance */
+ p_inst->p_handle_table[ul_index] = p_event_open;
+ ret_event_id = ul_index + 1;
+ }
+ }
+
+ return ret_event_id;
+}
+
+/**
+ * @brief
+ * Event generation processing
+ *
+ * @param[in] char *cpEventName Pointer to name of the event to be generated (NULL termination string)
+ * @return EventID Non-zero Event ID created<br>
+ * 0 Event generation error
+ */
+static EventID EventCreateNewEventInProcess(u_int32 index) {
+ PB_EVENT_OPEN_HANDLE *p_event_open = NULL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ EventID ret_event_id = 0;
+ EV_ERR ev_err;
+
+ /* Already created in the same process */
+ if (p_inst->p_handle_table[index] != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ /* When the number of event references in the same process is less than the upper limit */
+ if (p_inst->p_handle_table[index]->l_thread_ref < _CWORD64_EVENT_MAXOPEN_IN_PROCESS) {
+ /* Increase the number of thread references */
+ (p_inst->p_handle_table[index]->l_thread_ref)++;
+ ret_event_id = index + 1;
+ } else {
+ /* When the number of event references in the same process is the upper limit */
+ /* Error log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_CreateEvent Err ... Event Max In Process : EventName[%s]\r\n",
+ p_inst->p_handle_table[index]->p_sys_event->event_name);
+ }
+ } else {
+ /* Creating for the first time in the process */
+ /* Checking the upper limit of the reference count of the same event in the system */
+ if (p_inst->p_event_table[index].l_process_ref < _CWORD64_EVENT_MAXOPEN_IN_SYSTEM) {
+ /* Allocate event table to generate from heap */
+ /* */
+ p_event_open = reinterpret_cast<PB_EVENT_OPEN_HANDLE*>(PbProcessHeapAlloc(0, \
+ sizeof(PB_EVENT_OPEN_HANDLE)));
+
+ /* Failure in allocating heap area */
+ if (p_event_open == NULL) {
+ /* Error log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "_CWORD64_api.dll:_pb_CreateEvent : CreateHeap ... GetAddr[0x%08x], size[%ld] \r\n", \
+ p_event_open, sizeof(PB_EVENT_OPEN_HANDLE));
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "_pb_CreateEvent Err ... Event Max In sYSTEM : EventName[%s]\r\n",
+ p_inst->p_handle_table[index]->p_sys_event->event_name);
+ }
+
+ /* When heap allocation is successful */
+ if (p_event_open != NULL) {
+ /* When it is not created in the same process, set each data. */
+ /* Set the index to which the event name is registered */
+ p_event_open->index = index;
+ /* Initialize the reference count of the threads referencing this event in the same process. */
+ p_event_open->l_thread_ref = 1;
+ /* Set event instance start address */
+ p_event_open->p_sys_event = &p_inst->p_event_table[index];
+ /* Add the reference count of the process referencing this event in the system. */
+ p_event_open->p_sys_event->l_process_ref++;
+
+ /* Create an event flag */
+ ev_err = EV_create_flag_auto_id(&(p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]));
+ if (ev_err != EV_OK) /* When initialization fails */ {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "EV_create_flag_auto_id ERROR!! [ev_err=%d, flag_id=0x%x]",
+ ev_err, p_event_open->p_sys_event->st_condition[0].flag_id[g_my_proc_cnt]);
+
+ /* Release heap space */
+ PbProcessHeapFree(0, p_event_open);
+
+ ret_event_id = 0;
+ } else {
+ /* Even if event information already exists in the system, the Mutex is created for each process. */
+ (void)_pb_CreateMutex(NULL, FALSE, p_event_open->p_sys_event->name_of_mutex);
+
+ p_inst->p_handle_table[index] = p_event_open; /* Register event tables with event instance */
+ ret_event_id = index + 1;
+ }
+ }
+ }
+
+ return ret_event_id;
+}
+
+/**
+ * @brief
+ * Send the signal
+ *
+ * Sends the specified event signal.
+ *
+ * - Sending signals in the CLS event library
+ *
+ * @param[in] PB_EVENT_OPEN_HANDLE *p_evet_open_handle
+ * @param[in] u_int32 ul_index
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR Other errors
+ */
+static RET_API EventSendSignal(PB_EVENT_OPEN_HANDLE *p_evet_open_handle, u_int32 ul_index) {
+ RET_API ret_api = RET_NORMAL;
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ EV_ERR ev_err;
+ int32 i;
+ BOOL errFlag = TRUE;
+
+ if ((p_evet_open_handle != NULL) &&
+ (ul_index < MAX_PB_EVENT_WAIT_THREADS)) {
+ for (i = 0; i <= p_inst->p_event_table->proc_cnt; i++) {
+ /* Signal issuance */
+ if (p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[i] != 0) {
+ ev_err = EV_set_flag(p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[i], 1);
+ if (ev_err == EV_OK) {
+ errFlag = FALSE;
+ }
+ }
+ }
+ }
+
+ if (errFlag == TRUE) /* Event issuance NG */ {
+ ret_api = RET_ERROR;
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Wait for the signal
+ *
+ * Wait until the specified signal is received. Timeout can be specified (ms).
+ * When this API is called, the semaphore for the event element must be acquired.
+ *
+ * Receive a signal in the CLS event library.
+ *
+ * @param[in] *p_evet_open_handle
+ * @param[in] ul_index
+ * @param[in] ul_mill_sec_time
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRTIMEOUT Timeout End<br>
+ * RET_ERROR Other errors
+ */
+static RET_API EventWaitForSignal(PB_EVENT_OPEN_HANDLE *p_evet_open_handle, u_int32 ul_index, \
+ u_int32 ul_mill_sec_time) {
+ RET_API ret_api = RET_ERRTIMEOUT;
+ EV_ERR ev_err;
+ EV_Flag ev_flag;
+ u_int32 timeOutCnt = 0;
+
+ /* Parameter check */
+ if ((p_evet_open_handle != NULL) && (ul_index < MAX_PB_EVENT_WAIT_THREADS)) { // LCOV_EXCL_BR_LINE 6: param can not be invalid // NOLINT(whitespace/line_length)
+ /* Release semaphore for event table */
+ EventUnlockMutex(p_evet_open_handle); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Distribute processing by timeout period */
+ /* To check the event occurrence status */
+ if (ul_mill_sec_time == 0) {
+ /* Untreated */
+ } else if (ul_mill_sec_time == INFINITE) {
+ /* Without timeout */
+ ret_api = RET_NORMAL;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "EV_wait_flag CALL [flag_id=0x%x]",
+ p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt]);
+
+ /* Wait for event flag */
+ ev_err = EV_wait_flag(p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt], \
+ &ev_flag); // LCOV_EXCL_BR_LINE 200: no branch
+ if (ev_err != EV_OK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "EV_wait_flag ERROR!! [ev_err=%d]", ev_err);
+ ret_api = RET_ERROR;
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \
+ "EV_wait_flag RETURN [ev_err=%d]", ev_err);
+ }
+ } else {
+ /* When the timeout period is specified */
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "EV_get_flag CALL [flag_id=0x%x]",
+ p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt]);
+
+ while (1) {
+ /* Get elag event */
+ ev_err = EV_get_flag(p_evet_open_handle->p_sys_event->st_condition[ul_index].flag_id[g_my_proc_cnt], \
+ &ev_flag); // LCOV_EXCL_BR_LINE 200: no branch
+ if (ev_err == EV_OK) {
+ if (ev_flag.flagID == EV_NO_ID) {
+ timeOutCnt++;
+ if (timeOutCnt <= ul_mill_sec_time) {
+ usleep(1000); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ break; /* Timeout error */
+ }
+ } else {
+ ret_api = RET_NORMAL;
+ break;
+ }
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "EV_get_flag ERROR!! [ev_err=%d]", ev_err);
+ ret_api = RET_ERROR;
+ break;
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "EV_get_flag BREAK [ret_api=%d]", ret_api);
+ }
+
+ /* Get event table semaphore */
+ EventLockMutex(p_evet_open_handle); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ /* Parameter error */
+ ret_api = RET_ERROR;
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Create the mutex for event
+ *
+ * @param[in] *p_evet_open_handle
+ *
+ * @return TRUE Normal completion<br>
+ * FALSE ABENDs
+ */
+static BOOL EventCreateMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) {
+ static u_int8 idx = 0;
+ uint32_t ulPid; /* Process ID */
+ BOOL bret = FALSE;
+ TCHAR name[NAME_MAX];
+ HANDLE handle;
+
+ /* Parameter check */
+ if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL
+ ulPid = (uint32_t)getpid();
+
+ wsprintf(name, __TEXT("POS_BASE_EVENT_MUTEX%05d_p%d"), idx, ulPid);
+
+ /****************************************/
+ /* Create Mutex */
+ /****************************************/
+ handle = _pb_CreateMutex(NULL, FALSE, name);
+ if (handle != NULL) {
+ _tcscpy(p_evet_open_handle->p_sys_event->name_of_mutex, name);
+ idx++;
+ bret = TRUE;
+ }
+ }
+
+ /* When mutex processing fails */
+ if (bret != TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "bret ERROR [bret:%d]", bret);
+ }
+
+ return bret;
+}
+
+/**
+ * @brief
+ * Lock the mutex for event
+ *
+ * @param[in] *p_evet_open_handle
+ */
+static void EventLockMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) {
+ DWORD lret = WAIT_FAILED;
+ HANDLE handle;
+
+ if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL
+ /* Get handle from Mutex name */
+ handle = _pb_CreateMutex(NULL, FALSE, p_evet_open_handle->p_sys_event->name_of_mutex);
+
+ /****************************************/
+ /* Get Mutex */
+ /****************************************/
+ lret = PbMutexLock(handle, INFINITE);
+
+ /* Cancel by deleting the generated portion when a handle was acquired */
+ (void)PbDeleteMutex(handle);
+ }
+
+ /* When mutex processing fails */
+ if (lret != WAIT_OBJECT_0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lret ERROR [lret:%lu]", lret);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Unlock the mutex for event
+ *
+ * @param[in] *p_evet_open_handle
+ */
+static void EventUnlockMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) {
+ BOOL bret = FALSE;
+ HANDLE handle;
+
+ if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL
+ /* Get handle from Mutex name */
+ handle = _pb_CreateMutex(NULL, FALSE, p_evet_open_handle->p_sys_event->name_of_mutex);
+
+ /****************************************/
+ /* Release Mutex */
+ /****************************************/
+ bret = PbMutexUnlock(handle);
+
+ /* Cancel by deleting the generated portion when a handle was acquired */
+ (void)PbDeleteMutex(handle);
+ }
+
+ /* When mutex processing fails */
+ if (bret != TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "bret ERROR [bret:%d]", bret);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * delete the mutex for event
+ *
+ * @param[in] *p_evet_open_handle
+ */
+static void EventDeleteMutex(PB_EVENT_OPEN_HANDLE *p_evet_open_handle) {
+ RET_API ret_api = RET_ERROR;
+ HANDLE handle;
+
+ if (p_evet_open_handle != NULL) { // LCOV_EXCL_BR_LINE 6: p_evet_open_handle can not be NULL
+ /* Get handle from Mutex name */
+ handle = _pb_CreateMutex(NULL, FALSE, p_evet_open_handle->p_sys_event->name_of_mutex);
+
+ /****************************************/
+ /* Delete Mutex */
+ /****************************************/
+ ret_api = static_cast<RET_API>(PbDeleteMutex(handle)); /* Coverity CID:18817 Comment Managed */
+
+ /* Cancel by deleting the generated portion when a handle was acquired */
+ (void)PbDeleteMutex(handle);
+ }
+
+ /* When mutex processing fails */
+ if (ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ret_api ERROR [ret_api:%d]", ret_api);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get dump information
+ *
+ * @param[out] p_buf Dump info
+ * @param[in/out] p_len Buffer size
+ */
+void _pb_GetDebugEventMngTbl(void* p_buf, uint8_t* p_len) {
+ PB_EVENT_INSTANCE *p_inst = &g_instance;
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufHdlTbl[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufSysEvt[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_tmp[DEBUG_DUMP_MAX_SIZE];
+ uint8_t buf_indent[16];
+ uint32_t i;
+ PB_EVENT_OPEN_HANDLE* p_hdl_tbl;
+ uint8_t cnt = 0;
+
+ if ((p_buf != NULL) && (p_len != NULL)) {
+ memset(&buf[0], 0x00, sizeof(buf));
+ memset(&bufSysEvt, 0x00, sizeof(bufSysEvt));
+ snprintf(reinterpret_cast<char *>(&buf_indent[0]), sizeof(buf_indent), " ");
+ GetDebugEventMngTblSysEvent(&bufSysEvt[0], p_inst->p_event_table, &buf_indent[0]); // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Event-1\n ShrMem:%p\n idEvt:%d\n Evt:\n%s",
+ p_inst->h_shared_memory,
+ p_inst->id_event_table_sem,
+ &bufSysEvt[0]);
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ p_buf = reinterpret_cast<void *>((reinterpret_cast<uint8_t *>(p_buf)) + sizeof(buf));
+ cnt++;
+ if (cnt < *p_len) {
+ memset(&bufHdlTbl[0], 0x00, sizeof(bufHdlTbl));
+ for (i = 0; i < MAX_PB_EVENTS; i++) {
+ // p_handle_table
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ p_hdl_tbl = p_inst->p_handle_table[i];
+ if (p_hdl_tbl == NULL) {
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%d] NULL",
+ i);
+ } else {
+ memset(&bufSysEvt[0], 0x00, sizeof(bufSysEvt));
+ snprintf(reinterpret_cast<char *>(&buf_indent[0]), sizeof(buf_indent), " ");
+ GetDebugEventMngTblSysEvent(&bufSysEvt[0], p_hdl_tbl->p_sys_event, &buf_indent[0]);
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%d]\n h_heap:%p, index:%lu, l_thread_ref:%d\n p_sys_event:\n%s",
+ i,
+ p_hdl_tbl->h_heap,
+ p_hdl_tbl->index,
+ p_hdl_tbl->l_thread_ref,
+ &bufSysEvt[0]);
+ }
+ strncat(reinterpret_cast<char *>(&bufHdlTbl[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ if (((i + 1) % 4) == 0) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Event-%d\n Handle:%s",
+ cnt,
+ &bufHdlTbl[0]);
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ p_buf = reinterpret_cast<void *>((reinterpret_cast<uint8_t *>(p_buf)) + sizeof(buf));
+ memset(&bufHdlTbl[0], 0x00, sizeof(bufHdlTbl));
+ if (cnt >= *p_len) {
+ break;
+ }
+ }
+ }
+ }
+ if (cnt < *p_len) {
+ if (bufHdlTbl[0] != 0x00) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Event-%d\n Handle:%s",
+ cnt,
+ &bufHdlTbl[0]);
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ }
+ *p_len = cnt;
+ }
+ }
+}
+
+/**
+ * @brief
+ * Get dump information(PB_EVENT)
+ *
+ * @param[out] p_buf Dump info
+ * @param[in] pEvt PB_EVENT
+ * @param[in] pIndent Indenting
+ */
+void GetDebugEventMngTblSysEvent(void* p_buf, PB_EVENT* pEvt, uint8_t* pIndent) {
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_condition[1024];
+ static uint8_t buf_flag_id[512];
+ static uint8_t buf_tmp[DEBUG_DUMP_MAX_SIZE];
+ uint32_t i;
+ uint32_t e;
+
+ if ((p_buf != NULL) && (pEvt != NULL)) { // LCOV_EXCL_BR_LINE 6: p_buf and pEvt can not be NULL
+ memset(&buf, 0x00, sizeof(buf));
+ memset(&buf_condition, 0x00, sizeof(buf_condition));
+ snprintf(reinterpret_cast<char *>(&(buf_condition)), sizeof(buf_condition), "stCnd:");
+ for (i = 0; i < MAX_PB_EVENT_WAIT_THREADS; i++) {
+ memset(&buf_flag_id, 0x00, sizeof(buf_flag_id));
+ for (e = 0; e < MAX_EVENT_PROC_NUM; e++) {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "[%d]0x%08x ", e, pEvt->st_condition[i].flag_id[e]);
+ strncat(reinterpret_cast<char *>(&buf_flag_id[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ }
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s [%d] UseFlg:%d, Wait:%d, Mode:%d, Mask:%d, Min:%d, Max:%d, Last:%d, flag:%s",
+ pIndent,
+ i,
+ pEvt->st_condition[i].uc_use_flag,
+ pEvt->st_condition[i].uc_waiting,
+ pEvt->st_condition[i].us_mode,
+ pEvt->st_condition[i].ul_mask,
+ pEvt->st_condition[i].l_min_val,
+ pEvt->st_condition[i].l_max_val,
+ pEvt->st_condition[i].l_last_val,
+ &buf_flag_id[0]);
+ strncat(reinterpret_cast<char *>(&buf_condition[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ }
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "%s EvtName:%s",
+ pIndent,
+ pEvt->event_name);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s EvtVal:%d",
+ pIndent,
+ pEvt->l_event_val);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s %s",
+ pIndent,
+ &buf_condition[0]);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s ProcRef:%d",
+ pIndent,
+ pEvt->l_process_ref);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s ResetData:%d",
+ pIndent,
+ pEvt->l_reset_data);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s ManualReset:%d",
+ pIndent,
+ pEvt->uc_manual_reset);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n%s name_of_mutex:%s",
+ pIndent,
+ pEvt->name_of_mutex);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbFsys.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbFsys.cpp
new file mode 100755
index 0000000..ee132b0
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbFsys.cpp
@@ -0,0 +1,171 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbFsys.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System common functions
+ Title : System API file access control related processes
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+
+/*
+ Constants and structure definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define ALLOC_SIZE 0x00200000
+#define MAX_MUTEX_NAME_LEN 32
+
+/* Flag structure for file system protection */
+typedef struct {
+ u_int8 file_write_flag;
+ u_int8 dummy1;
+ u_int8 recover_flag;
+ u_int8 dummy2;
+} FSYS_FLAG_STRUCT;
+
+/* File system protection flag area control table */
+typedef struct {
+ TCHAR mtx_name[MAX_MUTEX_NAME_LEN]; /* Mutex name */
+ HANDLE h_mutex; /* Mutex handles */
+} FSYS_GLOBAL;
+
+/*
+ Global Variable Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+FSYS_FLAG_STRUCT *g_fsys_flag_top_addr;
+
+/*
+ External function prototype declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef __cplusplus
+extern "C" {
+#endif
+ BOOL VirtualCopy(LPVOID lpv_dest, LPVOID lpv_src, DWORD cb_size, DWORD fdw_protect);
+#ifdef __cplusplus
+}
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FileSystemCheckInit
+ * ABSTRACT : File system protection flag area and setting value initialization processing
+ * NOTE : Allocate a flag area for protecting the file system, create a Mutex
+ * : for locking the area, and initialize the flags as follows.
+ * : File access flag :File Access Permission State
+ * : FlashFS recovery status flag :FlashFS access-prohibited status
+ * ARGUMENT : None
+ * RETURN : RET_API define
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+FileSystemCheckInit(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FileSystemCheckTerm
+ * ABSTRACT : File system protection flag area release processing
+ * NOTE :
+ * ARGUMENT : None
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+FileSystemCheckTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SetFileAccessFlag
+ * ABSTRACT : File access flag setting process
+ * NOTE : Sets the write access state in the file access flag.Parameter
+ * : Set "Write prohibited state" at the time of parameter error.
+ * ARGUMENT : u_int8 status : File access flag setting value
+ * WRITE_FLAG_OFF : Write prohibited state to file
+ * WRITE_FLAG_ON : Write permission status for the file
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+SetFileAccessFlag(u_int8 status) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetFileAccessFlag
+ * ABSTRACT : File access flag acquisition processing
+ * NOTE : Gets the write access status to a file from the file access flag
+ * ARGUMENT : u_int8 *status Pointer for storing access status
+ * RETURN : RET_NORMAL Normal completion Note : Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+GetFileAccessFlag(u_int8 *status) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *status = WRITE_FLAG_ON;
+ return (RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SetFFSRecoverFlag
+ * ABSTRACT : FLASH file system recovery processing status setting processing
+ * NOTE : Sets the status of FLASH file system recovery
+ * ARGUMENT : u_int8 status : FLASH file system recovery process status setting
+ * RECOVER_OFF : Access authorization state
+ * RECOVER_ON : Access prohibited status during recovery processing
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void
+SetFFSRecoverFlag(u_int8 status) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetFFSRecoverFlag
+ * ABSTRACT : FLASH file system recovery processing status acquisition processing
+ * NOTE : Gets the status of FLASH file system recovery
+ * ARGUMENT : u_int8 *status Pointer for storing recovery processing status
+ * RETURN : RET_API define
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+GetFFSRecoverFlag(u_int8 *status) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetFSAccessSts
+ * ABSTRACT : File system access status acquisition processing
+ * NOTE : Gets the access status to the file system
+ * ARGUMENT : u_int8 *status Pointer for storing the file system access status
+ * RETURN : RET_API define
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+GetFSAccessSts(u_int8 *status) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *status = FSNOACCESS;
+
+ return (RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* End _pbFsys.cpp */
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMem.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMem.cpp
new file mode 100755
index 0000000..4028ae3
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMem.cpp
@@ -0,0 +1,989 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbMem.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System common functions
+ Title : System API
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "tchar.h"
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+
+/*
+ Constants and data type definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define MAX_AREA_NAME_LEN 32
+#define MAX_FILENAME_LEN 32
+#define _CWORD64__MEM_MUTEX_NAME __TEXT("POS_BASE_MEM_MUTEX")
+#define MAX_ROMFILENAME_LEN (32-4) /* To the name appended with "_rom" at the time of registration */
+#define PHYADDR_MAX 0x9FFFFFFF /* Physical address of the boundary divided by 256 */
+#define ROM_DATA_SIZE 0x00400000 /* Size of the virtual ROM data area(4MB) */
+#define ALLOC_SIZE 0x00200000 /* 2MB (Minimum VirtualAlloc allocation of shared memory, */
+/* which is less than 2MB, is not mapped to shared memory) */
+#define OFFSET_SIZE 0x00001000 /* 4KB (VirtualCopy Addressing Units) */
+
+ /* Memory map information */
+typedef struct TagMemMapItem {
+ HANDLE h_heap; /* Handle of heap. */
+ struct TagMemMapItem* p_next; /* Pointers to the next Chain memory map table */
+ struct TagMemMapItem* p_prev; /* Pointers to the previous Chain memory map table */
+ DWORD address;
+ TCHAR name[MAX_AREA_NAME_LEN]; /* Name of shared data area(Not used when permit is processed) */
+ HANDLE h_shared_mem; /* Shared memory handle */
+} MEMMAP_ITEM;
+
+/* Memory map information management table */
+typedef struct {
+ HANDLE h_heap; /* Heap handle of the invoking table */
+ MEMMAP_ITEM* p_head; /* Pointer to the first memory map information */
+ MEMMAP_ITEM* p_tail; /* Pointer to the terminating memory map information */
+ DWORD num_of_items; /* Chain memory map data */
+ HANDLE h_mutex; /* _CWORD64__MEM_MUTEX Exclusive Mutex handles */
+} MEMMAP_LIST;
+
+typedef struct {
+ DWORD mem_size;
+ DWORD reserv[3];
+} _CWORD64_SHMHDR;
+
+/* LINK ROM data top address/size storage ROM data */
+typedef struct {
+ u_int32 *link_rom_addr; /* ROM data start address */
+ u_int32 link_size; /* ROM data size */
+} LINK_ROM;
+
+/*
+ Internal function prototype declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void UnlinkFromMemMapList(MEMMAP_ITEM* p_item);
+static void LinkToMemMapList(MEMMAP_ITEM* p_item);
+static MEMMAP_ITEM* FindMemMapItemByName(TCHAR* name);
+
+/*
+ Global variable
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+MEMMAP_LIST* g_p_mem_map_list;
+
+/**
+ * @brief
+ * Memory API initialization
+ *
+ * @param[in] none
+ *
+ * @return RET_API RET_NORMAL Normal completion<br>
+ * RET_ERROR ABENDs
+ */
+
+RET_API MemoryInit(void) {
+ RET_API ret_api = RET_NORMAL;
+ TCHAR name[] = _CWORD64__MEM_MUTEX_NAME;
+
+ // LCOV_EXCL_BR_START 5: standard lib error
+ g_p_mem_map_list = reinterpret_cast<MEMMAP_LIST *>(PbProcessHeapAlloc(0, sizeof(MEMMAP_ITEM)));
+ // LCOV_EXCL_BR_STOP
+ if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 5: standard lib error
+ } else {
+ /* Initialization of memory map information management table */
+ g_p_mem_map_list->h_heap = NULL;
+ g_p_mem_map_list->p_head = NULL;
+ g_p_mem_map_list->p_tail = NULL;
+ g_p_mem_map_list->num_of_items = 0;
+
+ /* Create Mutex */
+ g_p_mem_map_list->h_mutex = _pb_CreateMutex(NULL, TRUE, name); // LCOV_EXCL_BR_LINE 200: no branch
+ if (g_p_mem_map_list->h_mutex == NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ // LCOV_EXCL_START 200:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR [name:%s]", name);
+ _pb_Exit(); /* System recovery processing(Exception execution) */
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ return ret_api;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : MemoryTerm
+ * ABSTRACT : Memory API termination processing
+ * NOTE : This function frees each allocated object.
+ * : This function must be called only once by DllMain() at process termination.
+ * ARGUMENT : None
+ * RETURN : Return RET_NORMAL
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+MemoryTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+
+ if (g_p_mem_map_list == NULL) {
+ ret_api = RET_ERROR;
+ } else {
+ /* Lock Mutex */
+ PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE);
+
+ while (g_p_mem_map_list->num_of_items > 0) {
+ MEMMAP_ITEM* p_item = g_p_mem_map_list->p_head;
+ if (g_p_mem_map_list->num_of_items == 1) {
+ /* Delete last one of memory map list */
+ g_p_mem_map_list->p_head = NULL;
+ g_p_mem_map_list->p_tail = NULL;
+ g_p_mem_map_list->num_of_items = 0;
+ } else {
+ /* Deletes the beginning of the memory map list, with the next at the beginning. */
+ g_p_mem_map_list->p_head = g_p_mem_map_list->p_head->p_next;
+ g_p_mem_map_list->p_head->p_prev = NULL;
+ g_p_mem_map_list->num_of_items--;
+ }
+
+ /* Releases the real memory specified in the memory map list. */
+ if (p_item != NULL) {
+ PbProcessHeapFree(0, p_item);
+ p_item = NULL;
+ }
+ }
+
+ /* Release Mutex */
+ PbMutexUnlock(g_p_mem_map_list->h_mutex);
+
+ /* Delete Mutex */
+ PbDeleteMutex(g_p_mem_map_list->h_mutex);
+
+ /* Free MEMMAP_LIST structure */
+ PbProcessHeapFree(0, g_p_mem_map_list);
+ g_p_mem_map_list = NULL;
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Allocate Process Heap
+ *
+ * Allocates a memory block from the process heap
+ *
+ * @param[in] DWORD dw_flags Heap allocation scheme
+ * @param[in] SIZE_T dw_bytes Number of bytes to allocate
+ *
+ * @return LPVOID Except NULL Pointer to the allocated memory block
+ * NULL Assignment Failed
+ */
+LPVOID PbProcessHeapAlloc(DWORD dw_flags, SIZE_T dw_bytes) {
+ LPVOID pv_ret = NULL;
+
+ if ((dw_flags & HEAP_ZERO_MEMORY) == 0) { // LCOV_EXCL_BR_LINE 200: dw_flags cannot have bit HEAP_ZERO_MEMORY
+ /* Zero initialization not specified */
+ pv_ret = malloc(dw_bytes);
+ } else {
+ /* Zero initialization specified */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ pv_ret = calloc(dw_bytes, sizeof(char)); // LCOV_EXCL_LINE 200: dw_flags cannot have bit HEAP_ZERO_MEMORY
+ }
+
+ return pv_ret;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PrivateHeapAlloc
+ * ABSTRACT : Allocate a block of memory from the private heap
+ * NOTE : Because there is no private-heap notion in PosixBasedOS001,
+ * Allocate from the process-heap using ProcessHeapAlloc
+ * ARGUMENT : DWORD dw_flags Controlling Heap Allocation Methods
+ * : SIZE_T dw_bytes Number of bytes to allocate
+ * RETURN : LPVOID Except NULL Pointer to the allocated memory block
+ * : NULL Assignment Failed
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+LPVOID
+PrivateHeapAlloc(DWORD dw_flags, SIZE_T dw_bytes) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return PbProcessHeapAlloc(dw_flags, dw_bytes);
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Free Process Heap
+ *
+ * Frees memory blocks allocated from the process heap
+ *
+ * @param[in] DWORD dw_flags Heap free method(Unused)
+ * @param[in] LPVOID lp_mem Pointer to the memory to be freed
+ *
+ * @return BOOL Non-zero Normal completion
+ * 0 ABENDs
+ */
+BOOL PbProcessHeapFree(DWORD dw_flags, LPVOID lp_mem) {
+ free(lp_mem);
+
+ return TRUE;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PrivateHeapFree
+ * ABSTRACT : Free memory blocks allocated from private heap
+ * NOTE : Because there is no private-heap notion in PosixBasedOS001,
+ * Open using ProcessHeapFree
+ * ARGUMENT : DWORD dw_flags Heap release option(Not used by PosixBasedOS001)
+ * : LPVOID lp_mem Pointer to the memory to be freed
+ * RETURN : BOOL Non-zero Normal
+ * : 0 Abnormality
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BOOL
+PrivateHeapFree(DWORD dw_flags, LPVOID lp_mem) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return PbProcessHeapFree(dw_flags, lp_mem);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : MemPermit
+ * ABSTRACT : Acquire access privilege to non-managed memory block of invoking process
+ * NOTE : To the data of the unmanaged memory block of invoking process
+ * : Allocate to accessible area of invoking process
+ * ARGUMENT : u_int32 mem_adr Start address of the data area to which access privileges are granted
+ * : u_int32 size Size of the data area to be granted access privileges
+ * : int32 perm PERM_NONCACHE(Cache invalidation), PERM_CACHE(Cache enabled)
+ * : void** ptr Returns the start address of the actual data area that can be accessed
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_ERROR ABENDs
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API MemPermit(u_int32 mem_adr, u_int32 size, int32 perm, void** ptr) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : MemProtect
+ * ABSTRACT : Revoking access privileges to invoking process unmanaged memory blocks
+ * NOTE : Free unmanaged memory block allocated to invoking process area
+ * ARGUMENT : u_int32 mem_adr Start address of the data area from which the access privilege is to be revoked
+ * : u_int32 size Size of the data area for which access privileges are to be revoked
+ * RETURN : RET_API RET_NORMAL Access privilege revocation successful
+ * : RET_ERROR Failed to revoke access privilege
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API MemProtect(u_int32 mem_adr, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create Share Data
+ *
+ * @param[in] char* area_name Pointer to shared data area name string
+ * @param[in] u_int32 size Size of the data portion
+ * @param[out] void** mem_ptr Pointer to the start address of the shared data area
+ *
+ * @return RET_API
+ * RET_NORMAL Normal
+ * RET_ERROR Abnormality
+ */
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+RET_API _pb_CreateShareData(char* area_name, u_int32 size, void** mem_ptr) // NOLINT(readability/nolint) WPF_SYSAPI.h
+#else
+RET_API _pb_CreateShareData(TCHAR* area_name, u_int32 size, void** mem_ptr) // NOLINT(readability/nolint) WPF_SYSAPI.h
+#endif // _CWORD64_API_DOES_NOT_USE_UNICODE
+{
+ RET_API ret_api = RET_NORMAL;
+ TCHAR *p_area_name = NULL;
+ TCHAR name[MAX_AREA_NAME_LEN] = {0};
+ HANDLE h_shm = NULL;
+ _CWORD64_SHMHDR *p_hdr = reinterpret_cast<_CWORD64_SHMHDR *>(MAP_FAILED);
+ MEMMAP_ITEM *p_item = NULL;
+#ifdef UNDER_CE
+ TCHAR unicode_area_name[MAX_AREA_NAME_LEN] = {0};
+#endif // UNDER_CE
+
+ if (mem_ptr == NULL) {
+ ret_api = RET_ERROR; /* Parameter error */
+ } else if (area_name == NULL) {
+ ret_api = RET_ERROR; /* Parameter error */
+ } else {
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+#ifdef UNDER_CE
+ if (area_name[0] == '\0') {
+ ret_api = RET_ERROR;
+ } else {
+ /* Shared memory name character limit processing */
+ if (strlen(area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ } else {
+ mbstowcs(unicode_area_name, area_name, MAX_AREA_NAME_LEN);
+ p_area_name = unicode_area_name;
+ }
+ }
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+ }
+
+ if (ret_api == RET_NORMAL) {
+ if ((p_area_name[0] == __TEXT('\0')) || (size == 0)) {
+ ret_api = RET_ERROR; /* Parameter error */
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ _tcscpy(name, p_area_name);
+
+ /* Lock Mutex */
+ PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE); // LCOV_EXCL_BR_LINE 200: no branch
+
+ p_item = FindMemMapItemByName(name); /* Search memory map object by area name */
+ if (p_item != NULL) /* When there is already a generated name */ {
+ *mem_ptr = NULL;
+ ret_api = RET_ERROR; /* Return in error because it has been generated */
+ } else {
+ /* Allocate MEMMAP_ITEM structure from heap */
+ // LCOV_EXCL_BR_START 5: standard lib error
+ p_item = reinterpret_cast<MEMMAP_ITEM *>(PbProcessHeapAlloc(0, sizeof(MEMMAP_ITEM)));
+ // LCOV_EXCL_BR_STOP
+ if (p_item == NULL) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *mem_ptr = NULL; // LCOV_EXCL_LINE 5: standard lib error
+ ret_api = RET_ERROR; /* Failed to allocate */ // LCOV_EXCL_LINE 5: standard lib error
+ } else {
+ p_item->h_heap = NULL;
+ p_item->p_next = NULL;
+ p_item->p_prev = NULL;
+ p_item->address = 0;
+ p_item->h_shared_mem = NULL;
+ LinkToMemMapList(p_item); /* Add to end of memory map list */ // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Allocate shared memory */
+ h_shm = CreateSharedMemory(name, size + sizeof(_CWORD64_SHMHDR)); // LCOV_EXCL_BR_LINE 200: can not be null
+ if (h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Remove the target memory-mapped object from the memory-mapped list */
+ UnlinkFromMemMapList(p_item);
+ PbProcessHeapFree(0, p_item);
+ p_item = NULL;
+ *mem_ptr = NULL;
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ p_item->h_shared_mem = h_shm;
+ /* Get Accessible Address */
+ // LCOV_EXCL_BR_START 200: can not be null
+ p_hdr = reinterpret_cast<_CWORD64_SHMHDR *>(GetSharedMemoryPtr(p_item->h_shared_mem));
+ // LCOV_EXCL_BR_STOP
+ if (p_hdr == NULL) { // LCOV_EXCL_BR_LINE 200: can not be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Delete allocated shared memory */
+ CloseSharedMemory(h_shm);
+ DeleteSharedMemory(name);
+ /* Remove the target memory-mapped object from the memory-mapped list */
+ UnlinkFromMemMapList(p_item);
+ PbProcessHeapFree(0, p_item);
+ p_item = NULL;
+ *mem_ptr = NULL;
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ p_hdr->mem_size = size;
+ *mem_ptr = reinterpret_cast<void*>(p_hdr + 1); /* Start at the address following the header */
+ _tcscpy(p_item->name, name); /* Name registration in the table */
+ }
+ }
+ }
+ }
+
+ /* Release Mutex */
+ PbMutexUnlock(g_p_mem_map_list->h_mutex); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ /* When an error occurs during parameter check */
+ if (mem_ptr != NULL) {
+ *mem_ptr = NULL;
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Link Share Data
+ *
+ * @param[in] char* area_name Pointer to shared data area name string
+ * @param[out] void** mem_ptr Pointer to the start address of the shared data area
+ * @param[out] u_int32* size Size of the data portion
+ *
+ * @return RET_API
+ * RET_NORMAL Normal
+ * RET_ERROR Abnormality
+ */
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+RET_API _pb_LinkShareData(char* area_name, void** mem_ptr, u_int32* size) // NOLINT(readability/nolint) WPF_SYSAPI.h
+#else
+RET_API _pb_LinkShareData(TCHAR* area_name, void** mem_ptr, u_int32* size) // NOLINT(readability/nolint) WPF_SYSAPI.h
+#endif // _CWORD64_API_DOES_NOT_USE_UNICODE
+{
+ RET_API ret_api = RET_NORMAL;
+ TCHAR *p_area_name = NULL;
+ TCHAR name[MAX_AREA_NAME_LEN] = {0};
+ _CWORD64_SHMHDR *p_hdr = reinterpret_cast<_CWORD64_SHMHDR *>(MAP_FAILED);
+ MEMMAP_ITEM *p_item = NULL;
+ HANDLE h_shm = NULL;
+ HANDLE h_shm_temp = NULL;
+ DWORD mem_size = 0;
+#ifdef UNDER_CE
+ TCHAR unicode_area_name[MAX_AREA_NAME_LEN] = {0};
+#endif
+
+ if (mem_ptr == NULL) {
+ ret_api = RET_ERROR; /* Parameter error */
+ } else if ((area_name == NULL) || (size == NULL)) {
+ ret_api = RET_ERROR; /* Parameter error */
+ } else {
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+#ifdef UNDER_CE
+ if (area_name[0] == '\0') {
+ ret_api = RET_ERROR;
+ } else {
+ /* Shared memory name character limit processing */
+ if (strlen(area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ } else {
+ mbstowcs(unicode_area_name, area_name, MAX_AREA_NAME_LEN);
+ p_area_name = unicode_area_name;
+ }
+ }
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+ }
+
+ if (ret_api == RET_NORMAL) {
+ if (p_area_name[0] == __TEXT('\0')) {
+ ret_api = RET_ERROR; /* Parameter error */
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ *size = 0;
+ _tcscpy(name, p_area_name);
+ mem_size = (u_int32) * size;
+
+ /* Lock Mutex */
+ PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE); // LCOV_EXCL_BR_LINE 200: no branch
+
+ p_item = FindMemMapItemByName(name); /* Search memory map object by area name */
+ if (p_item != NULL) {
+ /* When there is already a generated name */
+ h_shm = p_item->h_shared_mem;
+ // LCOV_EXCL_BR_START 200: can not be null
+ p_hdr = reinterpret_cast<_CWORD64_SHMHDR*>(GetSharedMemoryPtr(h_shm)); /* Get Accessible Address */
+ // LCOV_EXCL_BR_STOP
+ if (p_hdr == NULL) { // LCOV_EXCL_BR_LINE 200: can not be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *mem_ptr = NULL;
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ /* Start at the address following the header */
+ *mem_ptr = reinterpret_cast<void *>(p_hdr + 1);
+ *size = static_cast<u_int32>(p_hdr->mem_size);
+ }
+ } else {
+ /* When no memory map object has been created */
+ /* Allocate MEMMAP_ITEM structure from heap */
+ // LCOV_EXCL_BR_START 5: standard lib error
+ p_item = reinterpret_cast<MEMMAP_ITEM*>(PbProcessHeapAlloc(0, sizeof(MEMMAP_ITEM)));
+ // LCOV_EXCL_BR_STOP
+ if (p_item == NULL) { // LCOV_EXCL_BR_LINE 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ *mem_ptr = NULL; // LCOV_EXCL_LINE 5: standard lib error
+ ret_api = RET_ERROR; /* Failed to allocate */ // LCOV_EXCL_LINE 5: standard lib error
+ } else {
+ p_item->h_heap = NULL;
+ p_item->p_next = NULL;
+ p_item->p_prev = NULL;
+ p_item->address = 0;
+ _tcscpy(p_item->name, name);
+ p_item->h_shared_mem = NULL;
+ LinkToMemMapList(p_item); /* Add to end of memory map list */ // LCOV_EXCL_BR_LINE 200: no branch
+
+ ret_api = RET_ERROR; /* Process result initialization */
+ /* Maps the shared data area to physical memory and returns its information pointer
+ * (Check if not found by table lookup, but other processes are already reserved) */
+ h_shm_temp = OpenSharedMemory(p_item->name, sizeof(_CWORD64_SHMHDR)); // LCOV_EXCL_BR_LINE 200: no branch
+ if (h_shm_temp != NULL) {
+ /* Get Accessible Address */
+ p_hdr = reinterpret_cast<_CWORD64_SHMHDR*>(GetSharedMemoryPtr(h_shm_temp)); // LCOV_EXCL_BR_LINE 200: can not be NULL // NOLINT(whitespace/line_length)
+ if (p_hdr != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ mem_size = p_hdr->mem_size;
+ ret_api = RET_NORMAL;
+ }
+ CloseSharedMemory(h_shm_temp); // LCOV_EXCL_BR_LINE 200: no branch
+ }
+
+ if (ret_api == RET_NORMAL) {
+ ret_api = RET_ERROR; /* Process result initialization */
+ /* Maps the shared data area to physical memory and returns its information pointer */
+ h_shm = OpenSharedMemory(p_item->name, mem_size); // LCOV_EXCL_BR_LINE 200: no branch
+ if (h_shm != NULL) {
+ p_item->h_shared_mem = h_shm;
+ /* Get Accessible Address */
+ p_hdr = reinterpret_cast<_CWORD64_SHMHDR*>(GetSharedMemoryPtr(p_item->h_shared_mem));
+ if (p_hdr != NULL) {
+ *mem_ptr = reinterpret_cast<void*>(p_hdr + 1); /* Start at the address following the header */
+ *size = static_cast<u_int32>(mem_size);
+ ret_api = RET_NORMAL;
+ }
+ }
+ }
+
+ if (ret_api != RET_NORMAL) {
+ UnlinkFromMemMapList(p_item); /* Remove the target memory-mapped object from the memory-mapped list */
+
+ PbProcessHeapFree(0, p_item); // LCOV_EXCL_BR_LINE 200: no branch
+ p_item = NULL;
+ *mem_ptr = NULL;
+ *size = 0;
+ }
+ }
+ }
+
+ /* Release Mutex */
+ PbMutexUnlock(g_p_mem_map_list->h_mutex); // LCOV_EXCL_BR_LINE 200: no branch
+ } else {
+ /* When an error occurs during parameter check */
+ if (mem_ptr != NULL) {
+ *mem_ptr = NULL;
+ }
+ }
+
+ return ret_api;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbDeleteShareData
+ * ABSTRACT : Shared data area deletion processing
+ * NOTE : Deletes (releases) the shared memory area allocated under the name of the shared data area.
+ * ARGUMENT : char* area_name Pointer to shared data area name string
+ * RETURN : RET_API RET_NORMAL Normal
+ * : RET_ERROR The specified shared data does not exist
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+PbDeleteShareData(char* area_name) // LCOV_EXCL_START 8:dead code
+#else
+PbDeleteShareData(TCHAR* area_name)
+#endif // _CWORD64_API_DOES_NOT_USE_UNICODE
+{
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+ TCHAR *p_area_name = NULL;
+ TCHAR name[MAX_AREA_NAME_LEN] = {0};
+ MEMMAP_ITEM *p_item = NULL;
+#ifdef UNDER_CE
+ TCHAR unicode_area_name[MAX_AREA_NAME_LEN] = {0};
+#endif
+
+ /* Parameter check */
+ if (area_name == NULL) /* If the name of the shared area is NULL */ {
+ ret_api = RET_ERROR;
+ } else {
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+#ifdef UNDER_CE
+ if (strlen(area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ } else {
+ mbstowcs(unicode_area_name, area_name, MAX_AREA_NAME_LEN);
+ p_area_name = unicode_area_name;
+ }
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+#else
+ p_area_name = area_name;
+ if (_tcslen(p_area_name) >= MAX_AREA_NAME_LEN) {
+ ret_api = RET_ERROR;
+ }
+#endif
+ if (ret_api == RET_NORMAL) {
+ if (p_area_name[0] == __TEXT('\0')) {
+ ret_api = RET_ERROR;
+ }
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ /* Shared memory is allocated with the name of the shared area, or the memory map information management table is searched. */
+ _tcscpy(name, p_area_name);
+
+ /* Lock Mutex */
+ PbMutexLock(g_p_mem_map_list->h_mutex, INFINITE);
+
+ p_item = FindMemMapItemByName(name); /* Search memory map object by area name */
+ if (p_item == NULL) /* If the area name is not in the memory-map information management TBL */ {
+ /* If the area name is not in the memory map information management TBL, it has not been created or deleted. */
+ /* Release Mutex */
+ PbMutexUnlock(g_p_mem_map_list->h_mutex);
+ ret_api = RET_ERROR;
+ } else {
+ /* If the area name is in the memory map information management TBL */
+ /* Removes the memory map information from the Chain of the memory map information management table. */
+ UnlinkFromMemMapList(p_item);
+
+ /* Releases the Mutex of the memory map information management table and releases the shared memory. */
+ /* Release Mutex */
+ PbMutexUnlock(g_p_mem_map_list->h_mutex);
+
+ if (p_item->h_shared_mem != NULL) {
+ CloseSharedMemory(p_item->h_shared_mem);
+ p_item->h_shared_mem = NULL;
+ }
+
+ /* Frees memory-map information from the heap */
+ PbProcessHeapFree(0, p_item);
+
+ /* Deleting Shared Memory Objects */
+ /*************************************************************/
+ /* Note: Be sure to delete it, so Do not use DeleteShareData */
+ /* if you want to link elsewhere. */
+ /*************************************************************/
+ DeleteSharedMemory(name);
+ }
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : LinkRomData
+ * ABSTRACT : ROM data link
+ * NOTE : Links data located in ROM.
+ * : Specifies the name of the file in which the data is to be stored, and points to the start address of the data.
+ * : Get pointer and data size.
+ * ARGUMENT : char *filename Pointer to the string of the name of the ROM data storage file
+ * : void **mem_ptr Pointer to the start address of the ROM data storage file
+ * : u_int32 *size Pointer to the size of the data portion
+ * RETURN : RET_API RET_NORMAL Normal status
+ * : RET_ERROR Specified ROM data storage file does not exist
+ * : File name character string width error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+RET_API LinkRomData(char* filename, void** mem_ptr, u_int32* size) // LCOV_EXCL_START 8:dead code
+#else
+RET_API LinkRomData(TCHAR* filename, void** mem_ptr, u_int32* size)
+#endif // _CWORD64_API_DOES_NOT_USE_UNICODE
+{
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL; /* Coverity CID: 18772 compliant */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbAccessPhysicalMem
+ * ABSTRACT : Access to Physical Memory Area Allocation Data
+ * NOTE : Access data allocated in the physical memory area.
+ * : The physical memory area is mapped to the shared memory area and mapped.
+ * : The start address is returned.
+ * ARGUMENT : u_int32 addr Start address of the physical memory area
+ * : void **mem_ptr Pointer to the start address of the mapped shared area
+ * : u_int32 size Size of the data
+ * : u_int32 mode Access mode
+ * : ACCESS_MODE_READONLY :Read Only
+ * : ACCESS_MODE_READWRITE:Reading and Writing
+ * RETURN : RET_API RET_NORMAL Normal status
+ * : RET_ERRPARAM Parameter error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbAccessPhysicalMem(u_int32 addr, void **mem_ptr, u_int32 size, u_int32 mode) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL; /* Coverity CID: 18767 compliant */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbFreePhysicalMem
+ * ABSTRACT : Access release processing to the physical memory area allocation data
+ * NOTE : Releases access to data allocated in a physical memory area
+ * : Releases the shared memory area Allocate by AccessPhysicalMem.
+ * ARGUMENT : u_int32 addr Start address of the physical memory area to be released
+ * : void *mem_ptr Pointer to the start address of the mapped shared area
+ * : u_int32 size Data size to be released
+ * RETURN : RET_API RET_NORMAL Normal status
+ * : RET_ERRPARAM Parameter error
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbFreePhysicalMem(u_int32 addr, void *mem_ptr, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL; /* Coverity CID: 18766 compliant */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FindMemMapItemByName
+ * ABSTRACT : Memory map information retrieval processing
+ * NOTE : Retrieves the memory map information by the specified shared data area name.
+ * ARGUMENT : TCHAR* name Pointer to shared data area name character string
+ * RETURN : MEMMAP_ITEM* !NULL Pointer to memory map information
+ * : NULL Memory map information does not exist
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static MEMMAP_ITEM*
+FindMemMapItemByName(TCHAR* name) {
+ MEMMAP_ITEM* ret = NULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL
+ /* If the memory map information management table is not allocated, */
+ /* nop */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else if (g_p_mem_map_list->num_of_items == 0) {
+ /* If no memory map information is allocated, */
+ /* nop */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ MEMMAP_ITEM* p_item = g_p_mem_map_list->p_head;
+ /* Gets the pointer of the memory map Chain at the beginning of the file. */
+ /* Loops until there is no memory map Chain */
+ while (p_item != NULL) {
+ if (_tcscmp(p_item->name, name) == 0) {
+ /* If the name of the memory map information matches the name of the argument */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* Returns a pointer to the memory map information */
+ ret = p_item;
+ break; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+ p_item = p_item->p_next; /* Retrieves the pointers of the memory map data Chain next time. */
+ }
+ }
+
+ return(ret); /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : LinkToMemMapList
+ * NOTE : Adding a Memory Map Object to the Memory Map List
+ * ARGUMENT : MEMMAP_ITEM* p_item Specify a memory-mapped object
+ * RETURN : Without
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void
+LinkToMemMapList(MEMMAP_ITEM* p_item) {
+ BOOL processing_complete = FALSE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL
+ // LCOV_EXCL_START 200: g_p_mem_map_list can not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ // LCOV_EXCL_STOP
+ }
+
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ if ((processing_complete == FALSE) && (g_p_mem_map_list->num_of_items == 0)) {
+ g_p_mem_map_list->p_head = p_item;
+ g_p_mem_map_list->p_tail = p_item;
+ g_p_mem_map_list->num_of_items = 1;
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ if (processing_complete == FALSE) {
+ g_p_mem_map_list->p_tail->p_next = p_item;
+ p_item->p_prev = g_p_mem_map_list->p_tail;
+ p_item->p_next = NULL;
+ g_p_mem_map_list->p_tail = p_item;
+ g_p_mem_map_list->num_of_items++;
+ }
+ return;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : UnlinkFromMemMapList
+ * ABSTRACT : Memory map information deletion processing
+ * NOTE : Memory map information specified by the pointer is stored in the memory map information management table.
+ * : From the Chain structures.The memory map information is not released.
+ * ARGUMENT : MEMMAP_ITEM* p_item Pointer to the memory map information to be deleted
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void
+UnlinkFromMemMapList(MEMMAP_ITEM* p_item) {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ BOOL processing_complete = FALSE;
+ /* Parameter check */
+ if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL
+ /* If the memory map information management table is not allocated, */
+ /* nop */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else if (p_item == NULL) { // LCOV_EXCL_BR_LINE 200: p_item can not be NULL
+ /* If a pointer to memory-mapped information is not specified, */
+ /* nop */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else if (g_p_mem_map_list->num_of_items == 0) { // LCOV_EXCL_BR_LINE 200: num_of_items can not be 0
+ /* If no memory map information is allocated, */
+ /* nop */
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ } else {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* Chain detachment process when there is only one memory map data item */
+ if (g_p_mem_map_list->num_of_items == 1) {
+ if (g_p_mem_map_list->p_head == p_item) {
+ /* If only one memory map is reserved */
+ /* For the top memory map information of the memo map information management table */
+ g_p_mem_map_list->p_head = NULL; /* Initializes the top memory map to NULL. */
+ g_p_mem_map_list->p_tail = NULL; /* NULL initialization of the termination memory map data */
+ g_p_mem_map_list->num_of_items = 0; /* Initializes the control memory map information count to zero. */
+ }
+ /* Specified memory map information pointer does not exist */
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Memory-map-information-removal process at the top of the Chain */
+ if ((processing_complete == FALSE) && (p_item == g_p_mem_map_list->p_head)) {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* If the specified memory map information is the first memory map information, */
+ /* The leading memory map information pointer is changed to the next Chain pointer. */
+ g_p_mem_map_list->p_head = g_p_mem_map_list->p_head->p_next;
+ /* Change the previous Chain source of the first memory map to NULL */
+ g_p_mem_map_list->p_head->p_prev = NULL;
+ g_p_mem_map_list->num_of_items--; /* Decrement the number of management memory map information */
+ p_item->p_next = NULL; /* Initialize the Chain destination of the removed memory map NULL. */
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Memory-map data detachment process at the end of the Chain */
+ if ((processing_complete == FALSE) && (p_item == g_p_mem_map_list->p_tail)) {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* If the pointed-to memory-map information is terminated, */
+ /* Change the terminating memory-map info pointer to the previous Chain source */
+ g_p_mem_map_list->p_tail = g_p_mem_map_list->p_tail->p_prev;
+ /* Change the Chain destination of the terminated memory map to NULL. */
+ g_p_mem_map_list->p_tail->p_next = NULL;
+ /* Decrement the number of management memory map information */
+ g_p_mem_map_list->num_of_items--;
+ /* The previous Chain source of the removed memory map data is NULL initialized. */
+ p_item->p_prev = NULL;
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Checking the memory map info Chain for errors */
+ if ((processing_complete == FALSE) &&
+ (g_p_mem_map_list->num_of_items <= 2)) {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ /* No more than two memory maps are possible except at the beginning and end. */
+ processing_complete = TRUE; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ }
+
+ /* Departure process other than the start and end of the memory map data Chain */
+ if (processing_complete == FALSE) {
+ /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
+ p_item->p_prev->p_next = p_item->p_next; /* Set the next Chain destination of the previous memory map to the next one */
+ p_item->p_next->p_prev = p_item->p_prev; /* Previous Chain of one memory map before previous */
+ g_p_mem_map_list->num_of_items--; /* Decrement the number of management memory map information */
+ p_item->p_prev = NULL; /* The previous Chain source of the removed memory map data is NULL initialized. */
+ p_item->p_next = NULL; /* Initialize the Chain destination of the removed memory map NULL. */
+ }
+ }
+ return;
+}
+
+/**
+ * @brief
+ * Obtain dump information
+ *
+ * @param[out] p_buf Dump info
+ */
+void _pb_GetDebugMemoryMngTbl(void* p_buf) { // NOLINT(readability/nolint) WPF_SYSAPI.h
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_tmp[256];
+ uint32_t i = 0;
+
+ if (p_buf != NULL) {
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf), "Memory");
+
+ if (g_p_mem_map_list == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_mem_map_list can not be NULL
+ // LCOV_EXCL_START 200: g_p_mem_map_list can not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ strncat(reinterpret_cast<char *>(&buf[0]), "\n NULL", strlen("\n NULL"));
+ // LCOV_EXCL_STOP
+ } else if (g_p_mem_map_list->num_of_items == 0) { // LCOV_EXCL_BR_LINE 200: num_of_items can not be 0
+ // LCOV_EXCL_START 200: num_of_items can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ strncat(reinterpret_cast<char *>(&buf[0]), "\n num_of_items:0", strlen("\n num_of_items:0"));
+ // LCOV_EXCL_STOP
+ } else {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp), // LCOV_EXCL_BR_LINE 5: c lib error case
+ "\n h_heap:%p, p_head:%s, p_tail:%s, num_of_items:%lu, h_mutex:%p",
+ g_p_mem_map_list->h_heap,
+ ((g_p_mem_map_list->p_head == NULL)?"NULL":"NOT NULL"),
+ ((g_p_mem_map_list->p_tail == NULL)?"NULL":"NOT NULL"),
+ g_p_mem_map_list->num_of_items,
+ g_p_mem_map_list->h_mutex);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ MEMMAP_ITEM* p_item = g_p_mem_map_list->p_head;
+ while (p_item != NULL) {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%02d]h_heap:%10p, p_next:%s, p_prev:%s, name:%40s, hShrMem:%10p, adr:%lu",
+ i,
+ p_item->h_heap,
+ ((p_item->p_next == NULL)?"NULL ":"NOT NULL"),
+ ((p_item->p_prev == NULL)?"NULL ":"NOT NULL"),
+ p_item->name,
+ p_item->h_shared_mem,
+ p_item->address);
+ i++;
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ p_item = p_item->p_next;
+ }
+ }
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ }
+}
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMisc.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMisc.cpp
new file mode 100755
index 0000000..c52b7c6
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMisc.cpp
@@ -0,0 +1,226 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbMisc.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System common functions
+ Title : System API Time-of-day operations related processing group
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+
+/*
+ Declaration of constant data type
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+typedef struct {
+ DWORD time_on_january1_1970; /* Time on January 1, 1970 when it expressed */
+ /* with the total second number from January 1, 1601 */
+} BTIME_INSTANCE;
+
+/*
+ Internal function prototype declaration
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static DWORD FileTimeToSeonds(FILETIME* p_ft);
+
+/*
+ Global Variable Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BTIME_INSTANCE g_instance; // NOLINT(readability/nolint) global class instance
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : MiscInit()
+ * ABSTRACT : Time-related processing instance initialization processing
+ * NOTE : Assign and hold 1/1/1970 to FILETIME variables
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Normal completion Note: Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+MiscInit(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BTIME_INSTANCE *p_inst = &g_instance;
+ SYSTEMTIME st;
+ FILETIME ft;
+ BOOL bret;
+
+ /* Set the system time to the default value (January 1, 1970, 00:00:00). */
+ st.wYear = 1970;
+ st.wMonth = 1;
+ st.wDayOfWeek = 0;
+ st.wDay = 1;
+ st.wHour = 0;
+ st.wMinute = 0;
+ st.wSecond = 0;
+ st.wMilliseconds = 0;
+
+ /* Converting System Time to File Time */
+ bret = PbSystemTimeToFileTime(&st, &ft);
+ if (bret != TRUE) {
+ /* If the conversion fails, */
+ p_inst->time_on_january1_1970 = 0; /* Save to instance with zero elapsed seconds */
+ } else {
+ /* If the conversion is successful, */
+ p_inst->time_on_january1_1970 = FileTimeToSeonds(&ft); /* Save File Time Elapsed Seconds to Instance */
+ }
+
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FileTimeToSeonds()
+ * ABSTRACT : File Time -> Time Conversion Processing
+ * NOTE : Convert the file time to seconds
+ * ARGUMENT : FILETIME *p_ft Pointer to the file time structure
+ * RETURN : DWORD Elapsing time(In seconds)
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static DWORD
+FileTimeToSeonds(FILETIME* p_ft) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : MiscTerm()
+ * ABSTRACT : Time-related processing instance release processing
+ * NOTE :
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Normal completion Note: Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+MiscTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : Sleep()
+ * ABSTRACT : Sleep Processing
+ * NOTE : Cause the caller to sleep at the number of ticks specified by the argument
+ * ARGUMENT : u_int32 ticks Sleep time(Specify in ticks)
+ * : 0 Sleep permanently
+ * : 1 Discard the time slice
+ * RETURN : RET_API Normal completion Note: Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+Sleep(u_int32 ticks) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DWORD milliseconds;
+
+ switch (ticks) {
+ case 0: /* infinite delay. */
+ {
+ milliseconds = INFINITE;
+ break;
+ }
+ case 1: /* the thread to relinquish the remainder of its time slice */
+ /* to any other thread of equal priority that is ready to run. */
+ /* If there are no other threads of equal priority ready to run, */
+ /* the function returns immediately, and the thread continues execution. */
+ {
+ milliseconds = 0;
+ break;
+ }
+ default: /* Time tranrate from per 10ms tick count to per milli second. */
+ milliseconds = (DWORD)ticks * 10;
+ break;
+ }
+ PbMilliSecSleep(static_cast<u_int32>(milliseconds));
+
+ return(RET_NORMAL);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbMilliSecSleep()
+ * ABSTRACT : Sleep Processing(Units of ms)
+ * NOTE : Cause the caller to sleep at the number of ticks specified by the argument
+ * ARGUMENT : u_int32 ul_mill_time Sleep time(Specified in millimeters)
+ * : 0 Discard the time slice
+ * : INFINITE Sleep permanently
+ * RETURN : RET_API Normal completion Note: Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API PbMilliSecSleep(u_int32 ul_mill_time) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (ul_mill_time) {
+ case 0:
+ {
+ /* Discard the time slice */
+ sched_yield();
+ break;
+ }
+ case INFINITE:
+ {
+ /* Abort processing indefinitely */
+ while (1) {
+ sleep(INFINITE);
+ }
+ }
+ default:
+ /* Sleep for Specified Time */
+ usleep(ul_mill_time * 1000);
+ break;
+ }
+
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SecSleep()
+ * ABSTRACT : Sleep Processing(s unit)
+ * NOTE : Cause the caller to sleep at the number of ticks specified by the argument
+ * ARGUMENT : u_int32 ul_time Sleep time(Specify in seconds)
+ * : 0 Discard the time slice
+ * : INFINITE Sleep permanently
+ * RETURN : RET_API Normal completion Note: Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API SecSleep(u_int32 ul_time) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ switch (ul_time) {
+ case 0:
+ {
+ /* Discard the time slice */
+ sched_yield();
+ break;
+ }
+ case INFINITE:
+ {
+ /* Abort processing indefinitely */
+ while (1) {
+ sleep(INFINITE);
+ }
+ }
+ default:
+ /* Sleep for Specified Time */
+ sleep(ul_time);
+ break;
+ }
+
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : _sysMisc.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMsg.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMsg.cpp
new file mode 100755
index 0000000..3919239
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMsg.cpp
@@ -0,0 +1,1572 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbMsg.cpp
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_types.h>
+#include <vehicle_service/positioning_base_library.h>
+#include <native_service/ns_message_center_if.h>
+#include "_pbEvent_Internal.h"
+#include "_pbInternalProc.h"
+
+#include <native_service/frameworkunified_framework_if.h>
+#include "WPF_STD_private.h"
+#include "tchar.h"
+
+/*---------------------------------------------------------------------------------*
+ * Define *
+ *---------------------------------------------------------------------------------*/
+#define MSG_MAX_NUM_CTRL_MSGQUE (32) /* Maximum number of message queues */
+#define MSG_MAX_NUM_CTRL_THREAD (16) /* Maximum number of threads/process */
+
+#define FULL_MSG_NUM_CTRL_MSGQUE (MSG_MAX_NUM_CTRL_MSGQUE - 4) /* Message control table threshold (no free) */
+#define WARN_MSG_NUM_CTRL_MSGQUE (MSG_MAX_NUM_CTRL_MSGQUE - 10) /* Message control table threshold (warning) */
+
+/*---------------------------------------------------------------------------------*
+ * Structure *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Control table for message queues
+*/
+typedef struct {
+ PNO pno; /**< Process No. */
+ char name[MAX_QUEUE_NAME_SIZE]; /**< Message Que Name */
+ HANDLE h_positioningbaselibrary_sender[MSG_MAX_NUM_CTRL_THREAD]; /**< handle to the Sender */
+ HANDLE h_sender; /**< handle to the Sender */
+ HANDLE h_receiver; /**< handle to the Receiver */
+ HANDLE h_zc_sender; /**< handle to the ZcSender */
+ uint8_t msg_rcv_buf[MAX_QUEUE_MSG_SIZE]; /**< Message buffer */
+} MSG_CTRL_DETAIL_INFO;
+
+/*!
+ @brief Control table for message queues
+*/
+typedef struct {
+ MSG_CTRL_DETAIL_INFO info[MSG_MAX_NUM_CTRL_MSGQUE]; /**< message infomation */
+ uint32_t use_cnt; /**< Use Counter */
+ uint32_t rsv_cnt; /**< Reserve Counter */
+} MSG_CTRL_INFO;
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/**
+ Message control table
+ Note: Access to this instance shall be made through the operation module.
+*/
+static MSG_CTRL_INFO g_msg_ctrl_tbl; // NOLINT(readability/nolint) global Class instance
+
+/** Message-control-table-locking Mutex handles */
+static HANDLE g_h_mtx;
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+/* Message Control Table Operation Functions */
+static void MsgSetPnoOfCtrlTbl(u_int32 idx, PNO pno); /* PNO setting */
+static PNO MsgGetPnoOfCtrlTbl(u_int32 idx); /* PNO acquisition */
+static void MsgSetNameOfCtrlTbl(u_int32 idx, LPCTSTR name); /* Message queue name setting */
+static char* MsgGetNameOfCtrlTbl(u_int32 idx); /* Get Message Queue Name */
+static void MsgSetReceiverHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Message queue handle setting */
+static HANDLE MsgGetReceiverHandleOfCtrlTbl(u_int32 idx); /* Get message queue handle */
+static void MsgSetSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Message send handle setting */
+static HANDLE MsgGetSenderHandleOfCtrlTbl(u_int32 idx); /* Get message send handle */
+/* Message send handle setting*/
+static void MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle, uint32_t offset);
+static HANDLE MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, uint32_t offset); /* Get message send handle */
+static void MsgSetZcSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Message send handle setting */
+static HANDLE MsgGetZcSenderHandleOfCtrlTbl(u_int32 idx); /* Get message send handle */
+static uint8_t* MsgGetMsgRcvBufOfCtrlTbl(uint32_t idx); /* Get message receive buffer */
+static u_int32 MsgSearchEmptyOfCtrlTbl(void); /* Retrieval of free space in control table */
+static u_int32 MsgSearchPnoOfCtrlTbl(PNO pno); /* Retrieval of control table PNO */
+static u_int32 MsgSearchNameOfCtrlTbl(LPCTSTR name); /* Retrieve control table queue name */
+static void MsgIncUseCntOfCtrlTbl(void); /* Control table usage counter increment */
+static void MsgDecUseCntOfCtrlTbl(void); /* Control table usage counter increment */
+static void MsgIncRsvCntOfCtrlTbl(void); /* Control table reservation counter increment */
+static void MsgDecRsvCntOfCtrlTbl(void); /* Control table reservation counter increment */
+
+/* Mutex handling Functions for Accessing Message Control Tables */
+static void MsgCreateMutex(void); /* Mutex generating */
+/* Message send handle setting */
+/* static void MsgDeleteMutex(void); */ // Todo:Uncomment out after completion of implementation of termination processing
+static void MsgLockMutex(void); /* Mutex retrieval */
+static void MsgUnlockMutex(void); /* Mutex release */
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Initialize the message function
+ *
+ * Message control table initialization
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error
+ */
+RET_API MsgInit(void) {
+ RET_API ret_api = RET_NORMAL;
+ u_int32 i;
+
+ MsgCreateMutex();
+
+ /* Control table initialization */
+ memset(g_msg_ctrl_tbl.info, 0x00, sizeof(g_msg_ctrl_tbl.info));
+
+ for (i = 0; i < MSG_MAX_NUM_CTRL_MSGQUE; i++) {
+ /* Empty character is set for the message queue name. */
+ _tcscpy(g_msg_ctrl_tbl.info[i].name, "");
+ }
+ g_msg_ctrl_tbl.use_cnt = 0;
+ g_msg_ctrl_tbl.rsv_cnt = 0;
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Term
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR ABENDs
+ */
+RET_API MsgTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_ERROR;
+ RET_API ret;
+ EFrameworkunifiedStatus estatus;
+ HANDLE handle;
+ u_int32 idx;
+ PNO pno;
+
+ MsgLockMutex();
+
+ /* Release Message Transmission/Reception Handle */
+ for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) {
+ /* Receive handle acquisition */
+ pno = MsgGetPnoOfCtrlTbl(idx);
+ if (pno != 0) {
+ /* For queue information for internal threads */
+ /* Delete Message Queue */
+ ret = PbDeleteMsg(pno);
+ if (ret != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McClose ERROR " \
+ "[ret:%d, pno:%d]", ret, pno);
+ /* The module returns OK even if it fails. */
+ }
+ } else {
+ /* Other than the above(Send handle to external process) */
+ /* Get send handle */
+ handle = MsgGetSenderHandleOfCtrlTbl(idx);
+ if (handle != NULL) {
+ estatus = FrameworkunifiedMcClose(handle);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "FrameworkunifiedMcClose ERROR " \
+ "[estatus:%d, handle:%p]", estatus, handle);
+ /* The module returns OK even if it fails. */
+ } else {
+ /* Message control table update */
+ MsgSetSenderHandleOfCtrlTbl(idx, NULL); /* Send handle */
+
+ MsgSetNameOfCtrlTbl(idx, ""); /* Name */
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(--) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s",
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \
+ PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+ }
+ }
+
+ MsgUnlockMutex();
+
+ /* MsgDeleteMutex(); */ // Todo:Uncomment out after completion of implementation of termination processing
+
+ /* TODO:Delete the shared memory for the message management table */
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create the message queue
+ *
+ * Creates a message queue.
+ * This function is implemented on the assumption that a thread name is assigned by prctl() and then called from that thread.
+ * The generated message queue name is the same as the thread name.
+ *
+ * @param[in] pno Process number
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_CreateMsg(PNO pno) { // NOLINT(readability/nolint) interface
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ u_int32 idx;
+ HANDLE handle = NULL;
+ char name[MAX_QUEUE_NAME_SIZE];
+ size_t len;
+
+ /* If PNO is invalid (0), the parameter is abnormal and processing is not performed. */
+ if (pno == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* Get Thread Name */
+ (void)prctl(PR_GET_NAME, name);
+
+ len = _tcslen(name);
+ if (len >= MAX_QUEUE_NAME_SIZE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Length of thread name is too long(>=%d). " \
+ "[len:%zu]", MAX_QUEUE_NAME_SIZE, len);
+ ret_api = RET_ERRPARAM;
+ } else {
+ MsgLockMutex(); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Check if the specified PNO is already registered */
+ idx = MsgSearchPnoOfCtrlTbl(pno); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* When the entry is already stored */
+ if (idx != MSG_MAX_NUM_CTRL_MSGQUE) {
+ /* No processing */
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \
+ PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ } else {
+ /* Not registered */
+ /* Search for free space */
+ idx = MsgSearchEmptyOfCtrlTbl();
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE
+ /* Be impossible by design */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchEmptyOfCtrlTbl ERROR " \
+ "[idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE
+
+ /* don't arrive here. */
+ } else {
+ /* Create Message Queue */
+ handle = McOpenReceiver(name); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (handle == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* In the event of failure */
+ // LCOV_EXCL_START 5: standard lib error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenReceiver ERROR " \
+ "[handle:%p, name:%s]", handle, name);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+ /* don't arrive here. */
+ } else {
+ /* If successful */
+ /* Message control table update */
+ MsgSetPnoOfCtrlTbl(idx, pno); /* PNO */ // LCOV_EXCL_BR_LINE 200: no branch
+
+ MsgSetReceiverHandleOfCtrlTbl(idx, handle); /* Receive handle */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+
+ MsgSetNameOfCtrlTbl(idx, name); /* Name */ // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Increment Message Control Table Usage Counter */
+ MsgIncUseCntOfCtrlTbl();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \
+ "### MESSAGE TABLE INFORMATION # (++) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, " \
+ "h_sender=%p, h_receiver=%p, name=%s", idx, MsgGetPnoOfCtrlTbl(idx), \
+ PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, PbGetLocalTid()), \
+ MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+ }
+ }
+
+ MsgUnlockMutex(); // LCOV_EXCL_BR_LINE 200: no branch
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Delete the message queue
+ *
+ * Delete a message queue.
+ * Deleted from the message control table even if closing of the send/receive handle fails
+ *
+ * @param[in] pno
+ *
+ * @return RET_NORMAL Normal completion
+ */
+RET_API PbDeleteMsg(PNO pno) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ uint32_t idx;
+ uint32_t i;
+ HANDLE handle;
+ EFrameworkunifiedStatus estatus;
+
+ idx = MsgSearchPnoOfCtrlTbl(pno);
+ if (idx != MSG_MAX_NUM_CTRL_MSGQUE) {
+ /* Receive handle acquisition */
+ handle = MsgGetReceiverHandleOfCtrlTbl(idx);
+ if (handle != NULL) {
+ estatus = McClose(handle);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McClose ERROR " \
+ "[estatus:%d, handle:%p]", estatus, handle);
+ /* The module returns OK even if the Close fails. */
+ }
+ }
+
+ /* Get send handle */
+ handle = MsgGetSenderHandleOfCtrlTbl(idx);
+ if (handle != NULL) {
+ estatus = McClose(handle);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McClose ERROR " \
+ "[estatus:%d, handle:%p]", estatus, handle);
+ /* The module returns OK even if the Close fails. */
+ }
+ }
+
+ /* Get send handle */
+ handle = MsgGetZcSenderHandleOfCtrlTbl(idx);
+ if (handle != NULL) {
+ estatus = McZcClose(handle);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "McZcClose ERROR " \
+ "[estatus:%d, handle:%p]", estatus, handle);
+ /* The module returns OK even if the Close fails. */
+ }
+ }
+
+ /* Message control table update */
+ MsgSetPnoOfCtrlTbl(idx, 0); /* PNO */
+
+ for (i = 0; i < MSG_MAX_NUM_CTRL_THREAD; i++) {
+ MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, NULL, i); /* Send handle */
+ }
+
+ MsgSetSenderHandleOfCtrlTbl(idx, NULL); /* Send handle */
+
+ MsgSetReceiverHandleOfCtrlTbl(idx, NULL); /* Receive handle */
+
+ MsgSetNameOfCtrlTbl(idx, ""); /* Name */
+
+ /* Decrement Message Control Table Usage Counter */
+ MsgDecUseCntOfCtrlTbl();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(--) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \
+ PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Receive the message
+ *
+ * Receive a message for the specified PNO.If the specified PNO is invalid, an error is returned.
+ * If the size of the received data exceeds the size specified in the parameter, an error is returned.
+ *
+ * @param[in] pno Process number
+ * @param[in] size Message size
+ * @param[out] msgbuf Pointer to message area
+ * @param[in] mode Not used
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_RcvMsg(PNO pno, u_int16 size, void** msgbuf, u_int16 mode) { // NOLINT(readability/nolint) interface
+ RET_API ret_api = RET_RCVMSG; /* Results of this Module process */
+ u_int32 idx;
+ HANDLE h_msg_que = NULL;
+ char source[MAX_QUEUE_NAME_SIZE];
+ u_int32 cmd_id;
+ EFrameworkunifiedStatus rcv_sts;
+ u_int8* p_msg_rcv_buf;
+ u_int32 msg_len = 0;
+ void* p_rcv_data;
+
+ /* Null Check */
+ if (msgbuf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [msgbuf:%p]", msgbuf);
+ ret_api = RET_ERRPARAM;
+ } else if (pno == 0) {
+ /* PNO-invalid Check */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* Search if the specified PNO is registered in the control table */
+ idx = MsgSearchPnoOfCtrlTbl(pno); // LCOV_EXCL_BR_LINE 200: no branch
+ /* Not stored */
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR " \
+ "[idx:%d, pno:0x%x]", idx, pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* If it is registered */
+ /* Handle acquisition */
+ h_msg_que = MsgGetReceiverHandleOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: recv handle created in _pb_CreateMsg //NOLINT(whitespace/line_length)
+ if (h_msg_que == NULL) { // LCOV_EXCL_BR_LINE 200: recv handle created in _pb_CreateMsg
+ /* Be impossible by design */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Msg_getMsgQueHandleOfCtrlTbl ERROR " \
+ "[h_msg_que:%p, idx:%d]", h_msg_que, idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: recv handle created in _pb_CreateMsg
+
+ /* don't arrive here. */
+ }
+
+ /* Get Message Buffer */
+ p_msg_rcv_buf = MsgGetMsgRcvBufOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Receive message */
+ // LCOV_EXCL_BR_START 4: nsfw error
+ rcv_sts = McReceive(h_msg_que,
+ source, /* app that sent this message */
+ &cmd_id, /* Command ID */
+ MAX_QUEUE_MSG_SIZE,
+ (PVOID)p_msg_rcv_buf);
+ // LCOV_EXCL_BR_STOP
+
+ if (rcv_sts != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* In the event of failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McReceive ERROR " \
+ "[rcv_sts:%d, h_msg_que:%p, source:%s, cmd_id:0x%x]", rcv_sts, h_msg_que, source, cmd_id);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ /* If successful */
+ /* Size check */
+ msg_len = McGetLength(p_msg_rcv_buf); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if ((msg_len <= size) && (msg_len > 0)) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* OK */
+ /* Get Message */
+ p_rcv_data = McGetDataPointer(p_msg_rcv_buf); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (p_rcv_data == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ rcv_sts = McGetDataOfSize(p_msg_rcv_buf, *msgbuf, msg_len);
+ if (rcv_sts != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Message acquisition failure */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "McGetDataOfSize ERROR [rcv_sts:%d]", rcv_sts);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \
+ "McReceive/McGetDataOfSize SUCCESS [rcv_sts:%d, h_msg_que:%p, source:%s, " \
+ "cmd_id:0x%x, msg_len:%d]", rcv_sts, h_msg_que, source, cmd_id, msg_len);
+ }
+ } else {
+ *msgbuf = p_rcv_data;
+ }
+ } else {
+ /* NG */
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McGetLength ERROR " \
+ "[size:%d < msg_len:%d]", size, msg_len);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Send the message
+ *
+ * For in-process communication
+ * Sends a message to the specified PNO.If the specified PNO is invalid, an error is returned.
+ *
+ * @param[in] pno Process number
+ * @param[in] size Message size
+ * @param[in] msgbuf Pointer to message storage area
+ * @param[in] mode Not used
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_SndMsg(PNO pno, u_int16 size, void* msgbuf, u_int16 mode) { // NOLINT(readability/nolint) interface
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ u_int32 idx;
+ PCSTR msg_que_name;
+ HANDLE handle; /* handle to the send message queue */
+ EFrameworkunifiedStatus estatus;
+ T_APIMSG_MSGBUF_HEADER *p_msg_header;
+ CID cid;
+
+ /* Null Check */
+ if (msgbuf == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [msgbuf:%p]", msgbuf);
+ ret_api = RET_ERRPARAM;
+ } else if (pno == 0) {
+ /* PNO-invalid Check */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ MsgLockMutex();
+
+ /* Check if the specified PNO is registered in the message control table */
+ idx = MsgSearchPnoOfCtrlTbl(pno);
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) {
+ /* Not stored */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR!! " \
+ "[pno=%d]", pno);
+
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* If it is registered */
+ /* Acquire transmission handle from management table */
+ handle = MsgGetSenderHandleOfCtrlTbl(idx);
+ if (handle == NULL) {
+ /* Get message queue name */
+ msg_que_name = MsgGetNameOfCtrlTbl(idx);
+
+ /* Get send handle */
+ handle = McOpenSender(msg_que_name); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When handle acquisition fails */
+ if (handle == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender ERROR " \
+ "[handle:%p, msg_que_name:%s]", handle, msg_que_name);
+
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Message control table update */
+ MsgSetSenderHandleOfCtrlTbl(idx, handle); /* Send handle */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \
+ PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+ /* When handle acquisition is successful */
+ if (handle != NULL) {
+ p_msg_header = reinterpret_cast<T_APIMSG_MSGBUF_HEADER*>(msgbuf);
+ cid = p_msg_header->hdr.cid;
+
+ /* Messaging */
+ estatus = McSend(handle,
+ "", /* Sender name */
+ cid, /* Command ID */
+ size,
+ msgbuf); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When transmission fails */
+ if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend ERROR " \
+ "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, idx, handle, cid, size);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "McSend SUCCESS " \
+ "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, idx, handle, cid, size);
+ }
+
+ /* Close all handles at the time of termination */
+ }
+ }
+
+ MsgUnlockMutex();
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Acquire transmission buffer for in-process communication (for non-copy API)
+ * Gets the buffer for sending messages to the specified PNO.If the specified PNO is invalid, an error is returned.
+ * Set the send data in the acquired buffer and send it with _pb_ZcSndMsg().
+ *
+ * @param[in] pno Process number
+ * @param[out] p_snd_buf Transmitting buffer
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_GetZcSndBuf(PNO pno, void** p_snd_buf) { // NOLINT(readability/nolint) interface
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ u_int32 idx;
+ PCSTR msg_que_name;
+ HANDLE handle; /* handle to the send message queue */
+
+ /* PNO-invalid Check */
+ if (pno == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ MsgLockMutex();
+
+ /* Check if the specified PNO is registered in the message control table */
+ idx = MsgSearchPnoOfCtrlTbl(pno);
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) {
+ /* Not stored */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR!! [pno=%d]", pno);
+
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* If it is registered */
+ /* Acquire transmission handle from management table */
+ handle = MsgGetZcSenderHandleOfCtrlTbl(idx);
+ if (handle == NULL) {
+ /* Get message queue name */
+ msg_que_name = MsgGetNameOfCtrlTbl(idx);
+
+ /* Get send handle */
+ handle = McZcOpenSender(msg_que_name); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (handle == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When handle acquisition fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender ERROR " \
+ "[handle:%p, msg_que_name:%s]", handle, msg_que_name);
+
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Message control table update */
+ MsgSetZcSenderHandleOfCtrlTbl(idx, handle); /* Send handle */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s",
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, \
+ PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+
+ if (handle != NULL) {
+ /* When handle acquisition is successful */
+ /* Get message send buffer */
+ *p_snd_buf = McZcGetBuf(handle); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (*p_snd_buf == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When buffer acquisition fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcSetParam ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ }
+
+ /* Close all handles at the time of termination */
+ }
+ }
+
+ MsgUnlockMutex();
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Send the message
+ *
+ * For in-process communication(for non-copy API)
+ * Sends a message to the specified PNO.If the specified PNO is invalid, an error is returned.
+ * Before calling this function, send data must be set in the area acquired by _pb_GetZcSndBuf().
+ *
+ * @param[in] pno Process number
+ * @param[in] size Message size
+ * @param[in] mode Not used
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_ZcSndMsg(PNO pno, u_int16 size, u_int16 mode) { // NOLINT(readability/nolint) interface
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ u_int32 idx;
+ HANDLE handle; /* handle to the send message queue */
+ EFrameworkunifiedStatus estatus;
+ T_APIMSG_MSGBUF_HEADER *p_msg_header;
+ CID cid;
+ void* p_send_data;
+
+ /* PNO-invalid Check */
+ if (pno == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [pno:%d]", pno);
+ ret_api = RET_ERRPARAM;
+ } else {
+ MsgLockMutex();
+
+ /* Check if the specified PNO is registered in the message control table */
+ idx = MsgSearchPnoOfCtrlTbl(pno);
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) {
+ /* Not stored */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchPnoOfCtrlTbl ERROR!! [pno=%d]", pno);
+
+ ret_api = RET_ERRPARAM;
+ } else {
+ /* If it is registered */
+ /* Acquire transmission handle from management table */
+ handle = MsgGetZcSenderHandleOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: sender handle set in _pb_GetZcSndBuf
+ if (handle == NULL) { // LCOV_EXCL_BR_LINE 200: sender handle set in _pb_GetZcSndBuf
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "handle ERROR " \
+ "[pno=%d, idx=%d]", pno, idx);
+
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 200: sender handle set in _pb_GetZcSndBuf
+ }
+ /* When handle acquisition is successful */
+ if (handle != NULL) {
+ /* Messaging */
+ /* Set the transmission data in advance. */
+ p_send_data = McZcGetBuf(handle);
+ if (p_send_data != NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ p_msg_header = reinterpret_cast<T_APIMSG_MSGBUF_HEADER*>(p_send_data);
+ cid = p_msg_header->hdr.cid;
+ estatus = McZcSetParam(handle, cid, size);
+ if (estatus == eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ estatus = McZcSend(handle); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When transmission fails */
+ if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcSend ERROR " \
+ "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, \
+ idx, handle, cid, size);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "McZcSend SUCCESS " \
+ "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, \
+ idx, handle, cid, size);
+ }
+ } else {
+ /* When parameter setting fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcSetParam ERROR " \
+ "[estatus:%d, idx:%d, handle:%p, cid:0x%x, size:%d]", estatus, idx, handle, cid, size);
+ ret_api = RET_ERROR;
+ }
+ } else {
+ /* When parameter buffer acquisition fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McZcGetBuf ERROR " \
+ "[idx:%d, handle:%p, size:%d]", idx, handle, size);
+ ret_api = RET_ERROR;
+ }
+
+ /* Close all handles at the time of termination */
+ }
+ }
+
+ MsgUnlockMutex();
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Send the message
+ *
+ * For interprocess communication
+ * Sends a message to the specified process.If the specified process is invalid, an error is returned.
+ *
+ * Note: Since the data sent by this function is to be received by the dispatcher, the message header
+ * must not be included in the send data specified by the argument.
+ *
+ * @param[in] name Destination Process Name
+ * @param[in] cid Command ID
+ * @param[in] size Message size
+ * @param[in] msgbuf Pointer to message storage area
+ * @param[in] mode Not used
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERRPARAM Parameter error<br>
+ * RET_ERROR Other errors
+ */
+RET_API _pb_SndMsg_Ext(PCSTR name, CID cid, u_int16 size, const void* msgbuf, // NOLINT(readability/nolint) interface
+ u_int16 mode) {
+ RET_API ret_api = RET_NORMAL; /* Results of this Module process */
+ uint32_t thread_offset;
+ u_int32 idx;
+ HANDLE h_positioningbaselibrary_service = NULL;
+ EFrameworkunifiedStatus estatus;
+ size_t len;
+ HANDLE h_app;
+
+ /* Null Check */
+ if ((name == NULL) || (msgbuf == NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \
+ "[name:%p, msgbuf:%p]", name, msgbuf);
+ ret_api = RET_ERRPARAM;
+ } else {
+ h_app = _pb_GetAppHandle();
+
+ len = _tcslen(name);
+ if (len >= MAX_QUEUE_NAME_SIZE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! " \
+ "Length of thread name is too long(>=%d). [len:%zu]", MAX_QUEUE_NAME_SIZE, len);
+ ret_api = RET_ERRPARAM;
+ } else {
+ thread_offset = PbGetLocalTid();
+
+ MsgLockMutex();
+
+ idx = MsgSearchNameOfCtrlTbl(name);
+
+ if (idx != MSG_MAX_NUM_CTRL_MSGQUE) {
+ h_positioningbaselibrary_service = MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, thread_offset);
+ if (h_positioningbaselibrary_service == NULL) {
+ h_positioningbaselibrary_service = FrameworkunifiedMcOpenSender(h_app, name); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When handle acquisition fails */
+ if (h_positioningbaselibrary_service == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedMcOpenSender ERROR!! " \
+ "[h_positioningbaselibrary_service=%p, h_app=%p, name=%s]", h_positioningbaselibrary_service, h_app, name);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ /* Message control table update */
+ MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, h_positioningbaselibrary_service, thread_offset); /* Send handle */
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### MESSAGE TABLE INFORMATION # " \
+ "(+) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, h_sender=%p, h_receiver=%p, name=%s", \
+ idx, MsgGetPnoOfCtrlTbl(idx), PbGetLocalTid(), \
+ MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, PbGetLocalTid()), MsgGetSenderHandleOfCtrlTbl(idx), \
+ MsgGetReceiverHandleOfCtrlTbl(idx), MsgGetNameOfCtrlTbl(idx));
+ }
+ }
+ } else {
+ /* Search for free space */
+ idx = MsgSearchEmptyOfCtrlTbl();
+ if (idx == MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE
+ /* Be impossible by design */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgSearchEmptyOfCtrlTbl ERROR!! " \
+ "[idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: idx can not be MSG_MAX_NUM_CTRL_MSGQUE
+
+ /* don't arrive here. */
+ } else {
+ /* Get send handle */
+ h_positioningbaselibrary_service = FrameworkunifiedMcOpenSender(h_app, name); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When handle acquisition fails */
+ if (h_positioningbaselibrary_service == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedMcOpenSender ERROR!! " \
+ "[h_positioningbaselibrary_service=%p, h_app=%p, name=%s]", h_positioningbaselibrary_service, h_app, name);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ /* Message control table update */
+ MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, h_positioningbaselibrary_service, thread_offset); /* Send handle */
+
+ MsgSetNameOfCtrlTbl(idx, name); /* Name */
+
+ /* Increment Message Control Table Usage Counter */
+ MsgIncUseCntOfCtrlTbl();
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, \
+ "### MESSAGE TABLE INFORMATION # (++) idx=%d, pno=%d, h_positioningbaselibrary_sender[%d]=%p, " \
+ "h_sender=%p, h_receiver=%p, name=%s", idx, MsgGetPnoOfCtrlTbl(idx), \
+ PbGetLocalTid(), MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(idx, PbGetLocalTid()), \
+ MsgGetSenderHandleOfCtrlTbl(idx), MsgGetReceiverHandleOfCtrlTbl(idx), \
+ MsgGetNameOfCtrlTbl(idx));
+ }
+ }
+ }
+
+ MsgUnlockMutex();
+ /* When handle acquisition is successful */
+ if (h_positioningbaselibrary_service != NULL) {
+ /* Messaging */
+ estatus = FrameworkunifiedSendMsg(h_positioningbaselibrary_service, cid, size, msgbuf); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When transmission fails */
+ if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg ERROR!! " \
+ "[name=%s, estatus=%d, h_positioningbaselibrary_service=%p, cid=%d, size=%d]", \
+ name, estatus, h_positioningbaselibrary_service, cid, size);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_17, __FUNCTION__, "Send message = " \
+ "[Destination:%s][CID:0x%X]", name, cid);
+ }
+ /* Close all handles at the time of termination */
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+/*---------------------------------------------------------------------------------*
+ * Local Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * PNO setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] pno Process number
+ */
+static void MsgSetPnoOfCtrlTbl(u_int32 idx, PNO pno) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d, pno:%d]", idx, pno);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ } else {
+ g_msg_ctrl_tbl.info[idx].pno = pno;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * PNO acquisition(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] pno Process number
+ */
+static PNO MsgGetPnoOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].pno;
+}
+
+/**
+ * @brief
+ * Message queue name setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] name Message queue name
+ */
+static void MsgSetNameOfCtrlTbl(u_int32 idx, LPCTSTR name) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d, name:%s]", idx, name);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ _tcscpy(g_msg_ctrl_tbl.info[idx].name, name);
+
+ return;
+}
+
+/**
+ * @brief
+ * Get Message Queue Name(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ *
+ * @return Message queue name
+ */
+static char* MsgGetNameOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].name;
+}
+
+/**
+ * @brief
+ * Message reception handle setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] handle Message queue handle
+ */
+static void MsgSetReceiverHandleOfCtrlTbl(u_int32 idx, HANDLE handle) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ } else {
+ g_msg_ctrl_tbl.info[idx].h_receiver = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get message reception handle(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ *
+ * @return Message queue handle
+ */
+static HANDLE MsgGetReceiverHandleOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].h_receiver;
+}
+
+/**
+ * @brief
+ * Message send handle setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] handle Message queue handle
+ */
+static void MsgSetSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ } else {
+ g_msg_ctrl_tbl.info[idx].h_sender = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get message send handle(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ *
+ * @return Message queue handle
+ */
+static HANDLE MsgGetSenderHandleOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].h_sender;
+}
+
+
+/**
+ * @brief
+ * Positioningbaselibrary message send handle setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] handle Message queue handle
+ * @param[in] offset Local thread ID
+ */
+static void MsgSetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle, uint32_t offset) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ } else {
+ g_msg_ctrl_tbl.info[idx].h_positioningbaselibrary_sender[offset] = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Positioningbaselibrary message send handle acquisition(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] offset Local thread ID
+ *
+ * @return Message queue handle
+ */
+static HANDLE MsgGetPositioningbaselibrarySenderHandleOfCtrlTbl(u_int32 idx, uint32_t offset) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].h_positioningbaselibrary_sender[offset];
+}
+
+/**
+ * @brief
+ * Message send handle setting(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ * @param[in] handle Message queue handle
+ */
+static void MsgSetZcSenderHandleOfCtrlTbl(u_int32 idx, HANDLE handle) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ } else {
+ g_msg_ctrl_tbl.info[idx].h_zc_sender = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get message send handle(Message control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control Table Element Number
+ *
+ * @return Message queue handle
+ */
+static HANDLE MsgGetZcSenderHandleOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].h_zc_sender;
+}
+
+/**
+ * @brief
+ * Get message receive buffer(Message control table)
+ *
+ * @param[in] idx Control Table Element Number
+ *
+ * @return Pointer to message receive buffer
+ */
+static uint8_t* MsgGetMsgRcvBufOfCtrlTbl(uint32_t idx) {
+ /* check index */
+ if (idx >= MSG_MAX_NUM_CTRL_MSGQUE) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+
+ /* don't arrive here. */
+ }
+
+ return g_msg_ctrl_tbl.info[idx].msg_rcv_buf;
+}
+
+/**
+ * @brief
+ * Search unused area(Message control table)
+ *
+ * Returns the index (minimum value) for accessing the unused area in the message control table.<br>
+ * Returns the maximum message queue management value (MSG_MAX_NUM_CTRL_MSGQUE) <br>
+ * when no unused area exists
+ *
+ * @return Index for access(Unused area exists.)<br>
+ * Maximum mutex management value(No unused area)
+ */
+static u_int32 MsgSearchEmptyOfCtrlTbl(void) {
+ int32 ret;
+ u_int32 idx;
+
+ for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) {
+ ret = _tcscmp(g_msg_ctrl_tbl.info[idx].name, "");
+
+ /* For unused space */
+ if (ret == 0) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * PNO search(Message control table)
+ *
+ * Retrieves whether the specified PNO is already registered in the message control table.<br>
+ * If it is registered, the access index is returned.If it is not stored,<br>
+ * Returns the maximum message queue management value (MSG_MAX_NUM_CTRL_MSGQUE).
+ *
+ * @param[in] pno Process number
+ *
+ * @return Index for access(If it is registered)<br>
+ * Maximum value of message queue management(Not stored)
+ */
+static u_int32 MsgSearchPnoOfCtrlTbl(PNO pno) {
+ u_int32 idx;
+ PNO lPno;
+
+ for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) {
+ lPno = MsgGetPnoOfCtrlTbl(idx);
+
+ /* If there is a match */
+ if (lPno == pno) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+
+/**
+ * @brief
+ * Queue name search(Message control table)
+ *
+ * Retrieves whether the specified queue name is already registered in the message control table.<br>
+ * If it is registered, the access index is returned.If it is not stored,<br>
+ * Returns the maximum message queue management value (MSG_MAX_NUM_CTRL_MSGQUE).
+ *
+ * @param[in] Name queue-name
+ *
+ * @return Index for access(If it is registered)<br>
+ * Maximum value of message queue management(Not stored)
+ */
+static u_int32 MsgSearchNameOfCtrlTbl(LPCTSTR name) {
+ int32 ret;
+ u_int32 idx;
+
+ for (idx = 0; idx < MSG_MAX_NUM_CTRL_MSGQUE; idx++) {
+ ret = _tcscmp(g_msg_ctrl_tbl.info[idx].name, name);
+
+ /* If there is a match */
+ if (ret == 0) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+
+/**
+ * @brief
+ * Creation of Mutex for accessing the message control table
+ */
+static void MsgCreateMutex(void) {
+ g_h_mtx = _pb_CreateMutex(NULL, 0, "Msg_Mutex");
+ if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 200: can not be not NULL
+ // LCOV_EXCL_START 200: can not be not NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR [g_h_mtx:%p]", g_h_mtx);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Acquire Mutex for accessing the message control table
+ */
+static void MsgLockMutex(void) {
+ DWORD ret;
+ ret = PbMutexLock(g_h_mtx, INFINITE); // LCOV_EXCL_BR_LINE 200: mutex lock can not failed
+ if (ret != WAIT_OBJECT_0) { // LCOV_EXCL_BR_LINE 200: mutex lock can not failed
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexLock ERROR " \
+ "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: mutex lock can not failed
+
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Releasing the Mutex for accessing the message control table
+ */
+static void MsgUnlockMutex(void) {
+ BOOL ret;
+ ret = PbMutexUnlock(g_h_mtx); // LCOV_EXCL_BR_LINE 200: mutex lock can not failed
+ if (ret != TRUE) { // LCOV_EXCL_BR_LINE 200: mutex lock can not failed
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexUnlock ERROR " \
+ "[ret:%d, g_h_mtx:%p]", ret, g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: mutex lock can not failed
+
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Obtain dump information
+ *
+ * @param[out] pBuf Dump info
+ * @param[in/out] pLen Buffer size
+ */
+void _pb_GetDebugMsgMngTbl(void* pBuf, uint8_t* pLen) {
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufPositioningbaselibrarySender[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufMsg[DEBUG_DUMP_MAX_SIZE];
+ uint32_t i;
+ uint32_t e;
+ uint8_t cnt = 0;
+
+ if ((pBuf != NULL) && (pLen != NULL)) {
+ memset(&buf[0], 0x00, sizeof(buf));
+ memset(&bufMsg[0], 0x00, sizeof(bufMsg));
+ for (i = 0; i < MSG_MAX_NUM_CTRL_MSGQUE; i++) {
+ memset(&bufPositioningbaselibrarySender[0], 0x00, sizeof(bufPositioningbaselibrarySender));
+ for (e = 0; e < MSG_MAX_NUM_CTRL_THREAD; e++) {
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "[%02d]%10p ", e, g_msg_ctrl_tbl.info[i].h_positioningbaselibrary_sender[e]);
+ strncat(reinterpret_cast<char *>(&bufPositioningbaselibrarySender[0]), reinterpret_cast<char *>(&bufTmp[0]), \
+ strlen(reinterpret_cast<char *>(&bufTmp[0])));
+ }
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] pno:0x%04x, name:%16s, hSnd:%10p, hRcv:%10p, hPSnd:%s",
+ i,
+ g_msg_ctrl_tbl.info[i].pno,
+ g_msg_ctrl_tbl.info[i].name,
+ g_msg_ctrl_tbl.info[i].h_sender,
+ g_msg_ctrl_tbl.info[i].h_receiver,
+ &bufPositioningbaselibrarySender[0]);
+ strncat(reinterpret_cast<char *>(&bufMsg[0]), reinterpret_cast<char *>(&bufTmp[0]), \
+ strlen(reinterpret_cast<char *>(&bufTmp[0])));
+ if (((i+1) % 8) == 0) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Message-%d%s",
+ cnt,
+ &bufMsg[0]);
+ memcpy(pBuf, &buf[0], sizeof(buf));
+ pBuf = reinterpret_cast<void *>((reinterpret_cast<uint8_t *>(pBuf)) + sizeof(buf));
+ memset(&bufMsg[0], 0x00, sizeof(bufMsg));
+ if (cnt >= *pLen) {
+ break;
+ }
+ }
+ }
+ if (cnt < *pLen) {
+ if (bufMsg[0] != 0x00) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Message-%d%s",
+ cnt,
+ &bufMsg[0]);
+ memcpy(pBuf, &buf[0], sizeof(buf));
+ }
+ *pLen = cnt;
+ }
+ }
+}
+
+/**
+ * @brief
+ * Message Control Table Usage Counter Increment
+ *
+ * @param[in] none
+ */
+static void MsgIncUseCntOfCtrlTbl(void) {
+ g_msg_ctrl_tbl.use_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Message control table usage counter decrement
+ *
+ * @param[in] none
+ */
+static void MsgDecUseCntOfCtrlTbl(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ g_msg_ctrl_tbl.use_cnt--;
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Message Control Table Reserved Counter Increment
+ *
+ * @param[in] none
+ */
+static void MsgIncRsvCntOfCtrlTbl(void) {
+ g_msg_ctrl_tbl.rsv_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Message Control Table Reserved Counter Decrement
+ *
+ * @param[in] none
+ */
+static void MsgDecRsvCntOfCtrlTbl(void) {
+ g_msg_ctrl_tbl.rsv_cnt--;
+ return;
+}
+
+/**
+ * @brief
+ * Resource Acquisition Decision(Message control table)
+ *
+ * @param[in] none
+ *
+ * @return BOOL
+ * @retval TRUE : Normal
+ * @retval FALSE : Anomaly (Resource shortage)
+ */
+BOOL _pb_GetMsgResource(void) {
+ BOOL ret = TRUE;
+ uint32_t cnt;
+
+ MsgLockMutex();
+
+ /* Increment Message Control Table Reservation Counter */
+ MsgIncRsvCntOfCtrlTbl();
+
+ cnt = g_msg_ctrl_tbl.use_cnt + g_msg_ctrl_tbl.rsv_cnt;
+ if (cnt >= FULL_MSG_NUM_CTRL_MSGQUE) {
+ ret = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \
+ "[FATAL][use_cnt:%d rsv_cnt:%d]", g_msg_ctrl_tbl.use_cnt, g_msg_ctrl_tbl.rsv_cnt);
+ } else if (cnt >= WARN_MSG_NUM_CTRL_MSGQUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \
+ "[WARN][use_cnt:%d rsv_cnt:%d]", g_msg_ctrl_tbl.use_cnt, g_msg_ctrl_tbl.rsv_cnt);
+ }
+
+ MsgUnlockMutex();
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Resource release(Message control table)
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+void _pb_ReleaseMsgResource(void) {
+ MsgLockMutex();
+
+ /* Decrement Message Control Table Reservation Counter */
+ MsgDecRsvCntOfCtrlTbl();
+
+ MsgUnlockMutex();
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMutex.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMutex.cpp
new file mode 100755
index 0000000..06254ab
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbMutex.cpp
@@ -0,0 +1,1423 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbMutex.cpp
+ */
+
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+
+#ifndef PT_PB_MUTEX_STUB__CWORD71_
+
+#include <vehicle_service/positioning_base_library.h>
+#include "_pbInternalProc.h"
+#include <native_service/cl_lock.h>
+#include <native_service/cl_lockid.h>
+#include "WPF_STD_private.h"
+#include "tchar.h"
+
+/*---------------------------------------------------------------------------------*
+ * Define *
+ *---------------------------------------------------------------------------------*/
+/* Mutex control table name (Shared Memory) */
+#define MUTEX_CTRL_TBL_NAME __TEXT("POS_BASE_MUTEX_TABLE")
+
+/*
+ Max. available Lock ID
+ Note : Lock ID application is 1 (for BaseAPI initialization) + 1 (for Mutex function control) + 30 (for provision) = 32
+*/
+#define MAX_CTRL_MUTEX_NUM (30)
+
+#define FULL_CTRL_MUTEX_NUM (MAX_CTRL_MUTEX_NUM - 4) /** Mutex control data threshold (no free) */
+#define WARN_CTRL_MUTEX_NUM (MAX_CTRL_MUTEX_NUM - 10) /** Mutex control data threshold (warning) */
+
+/*
+ ID needs to be aplicated
+
+ If you increase or decrease the IDs, define maximum number of managed LOCK IDs and
+ the default setting of "Lock ID Resource List" must also be changed.
+*/
+#define MUTEX_LOCK_ID_0 LOCK_POS_MTX_2 /* Mutex management-information-exclusive control */
+#define MUTEX_LOCK_ID_1 LOCK_POS_MTX_3
+#define MUTEX_LOCK_ID_2 LOCK_POS_MTX_4
+#define MUTEX_LOCK_ID_3 LOCK_POS_MTX_5
+#define MUTEX_LOCK_ID_4 LOCK_POS_MTX_6
+#define MUTEX_LOCK_ID_5 LOCK_POS_MTX_7
+#define MUTEX_LOCK_ID_6 LOCK_POS_MTX_8
+#define MUTEX_LOCK_ID_7 LOCK_POS_MTX_9
+#define MUTEX_LOCK_ID_8 LOCK_POS_MTX_10
+#define MUTEX_LOCK_ID_9 LOCK_POS_MTX_11
+#define MUTEX_LOCK_ID_10 LOCK_POS_MTX_12
+#define MUTEX_LOCK_ID_11 LOCK_POS_MTX_13
+#define MUTEX_LOCK_ID_12 LOCK_POS_MTX_14
+#define MUTEX_LOCK_ID_13 LOCK_POS_MTX_15
+#define MUTEX_LOCK_ID_14 LOCK_POS_MTX_16
+#define MUTEX_LOCK_ID_15 LOCK_POS_MTX_17
+#define MUTEX_LOCK_ID_16 LOCK_POS_MTX_18
+#define MUTEX_LOCK_ID_17 LOCK_POS_MTX_19
+#define MUTEX_LOCK_ID_18 LOCK_POS_MTX_20
+#define MUTEX_LOCK_ID_19 LOCK_POS_MTX_21
+#define MUTEX_LOCK_ID_20 LOCK_POS_MTX_22
+#define MUTEX_LOCK_ID_21 LOCK_POS_MTX_23
+#define MUTEX_LOCK_ID_22 LOCK_POS_MTX_24
+#define MUTEX_LOCK_ID_23 LOCK_POS_MTX_25
+#define MUTEX_LOCK_ID_24 LOCK_POS_MTX_26
+#define MUTEX_LOCK_ID_25 LOCK_POS_MTX_27
+#define MUTEX_LOCK_ID_26 LOCK_POS_MTX_28
+#define MUTEX_LOCK_ID_27 LOCK_POS_MTX_29
+#define MUTEX_LOCK_ID_28 LOCK_POS_MTX_30
+#define MUTEX_LOCK_ID_29 LOCK_POS_MTX_31
+#define MUTEX_LOCK_ID_30 LOCK_POS_MTX_32
+
+typedef int32 LOCK_ID;
+
+/*---------------------------------------------------------------------------------*
+ * Structure *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Mutex control information(Interprocess common-details)
+ */
+typedef struct {
+ LOCK_ID lock_id; /**< Lock ID */
+ TCHAR name[NAME_MAX]; /**< Mutex Name */
+ int32 ref_cnt; /**< Reference Counter */
+ uint32_t thread_id; /**< Thread IDs while Lock is being acquired (Initial value:0) Note: For debugging */
+ BOOL is_rel_fail; /**< Release failure information (Failed:TRUE) Note: For debugging */
+ BOOL is_forbid_access; /**< Deletion occurred during Lock acquisition (Deletion occurred:TRUE) Note: For debugging */
+} MUTEX_CTRL_SHARED_DETAIL;
+
+/*!
+ @brief Mutex control information (Interprocess common)
+ */
+typedef struct {
+ MUTEX_CTRL_SHARED_DETAIL detail[MAX_CTRL_MUTEX_NUM]; /**< Common Infomation */
+ uint32_t use_cnt; /**< Use Counter */
+ uint32_t rsv_cnt; /**< Reserve Counter */
+} MUTEX_CTRL_SHARED_INFO;
+
+/*!
+ @brief Mutex control information
+*/
+typedef struct {
+ HANDLE handle[MAX_CTRL_MUTEX_NUM]; /**< Mutex Handle */
+ int32 ref_cnt[MAX_CTRL_MUTEX_NUM]; /**< Reference Counter */
+ MUTEX_CTRL_SHARED_INFO* info; /**< Common Infomation */
+} MUTEX_CTRL_INFO;
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+/**
+ Mutex control table pointer (Partial shared memory)
+ Note: Access to this instance shall be made through the operation module.
+ */
+static MUTEX_CTRL_INFO g_mutex_ctrl_tbl; // NOLINT(readability/nolint) global class instance
+
+static HANDLE g_h_mtx; /** Mutex control-information-locking Mutex handle */
+static HANDLE g_h_shm; /** Shared memory handle */ // Coverity CID: 18788 compliant
+
+
+/** Lock ID Resource List */
+static const LOCK_ID kLockIdList[MAX_CTRL_MUTEX_NUM] = {
+ MUTEX_LOCK_ID_1,
+ MUTEX_LOCK_ID_2,
+ MUTEX_LOCK_ID_3,
+ MUTEX_LOCK_ID_4,
+ MUTEX_LOCK_ID_5,
+ MUTEX_LOCK_ID_6,
+ MUTEX_LOCK_ID_7,
+ MUTEX_LOCK_ID_8,
+ MUTEX_LOCK_ID_9,
+ MUTEX_LOCK_ID_10,
+ MUTEX_LOCK_ID_11,
+ MUTEX_LOCK_ID_12,
+ MUTEX_LOCK_ID_13,
+ MUTEX_LOCK_ID_14,
+ MUTEX_LOCK_ID_15,
+ MUTEX_LOCK_ID_16,
+ MUTEX_LOCK_ID_17,
+ MUTEX_LOCK_ID_18,
+ MUTEX_LOCK_ID_19,
+ MUTEX_LOCK_ID_20,
+ MUTEX_LOCK_ID_21,
+ MUTEX_LOCK_ID_22,
+ MUTEX_LOCK_ID_23,
+ MUTEX_LOCK_ID_24,
+ MUTEX_LOCK_ID_25,
+ MUTEX_LOCK_ID_26,
+ MUTEX_LOCK_ID_27,
+ MUTEX_LOCK_ID_28,
+ MUTEX_LOCK_ID_29,
+ MUTEX_LOCK_ID_30,
+};
+
+/*
+ Mutex property information (Information for each process)
+ _pb_CreateMutex calls -> 1
+ DeleteMutex calls -> 0
+ Only "1" can be used in the process.
+ */
+BOOL g_is_mutex_owner_tbl[MAX_CTRL_MUTEX_NUM];
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+/* Mutex Control Table Manipulation Functions */
+static void MutexSetLockIdOfCtrlTbl(u_int32 idx, LOCK_ID l_id); /* Set Lock ID */
+static LOCK_ID MutexGetLockIdOfCtrlTbl(u_int32 idx); /* Get Lock ID */
+static void MutexSetMutexNameOfCtrlTbl(u_int32 idx, LPCTSTR name); /* Set Mutex name */
+static void MutexSetMutexHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Set Mutex handle */
+static HANDLE MutexGetMutexHandleOfCtrlTbl(u_int32 idx); /* Get Mutex Handle */
+static void MutexSetTidOfCtrlTbl(uint32_t idx, uint32_t tid); /* Set thread ID while Lock is being acquired */
+static uint32_t MutexGetTidOfCtrlTbl(uint32_t idx); /* Get thread ID while Lock is being acquired */
+static void MutexSetIsRelFailOfCtrlTbl(uint32_t idx, BOOL flag); /* Set release failure information */
+static void MutexSetIsForbidAccessOfCtrlTbl(uint32_t idx, BOOL flag); /* Set deletion occurrence while Lock is being acquired */
+static u_int32 MutexGetIdxOfCtrlTbl(HANDLE h_mutex); /* Get index for access */
+static void MutexIncRefCntOfCtrlTbl(u_int32 idx); /* Increment Mutex reference counter */
+static void MutexDecRefCntOfCtrlTbl(u_int32 idx); /* Decrement Mutex reference counter */
+static int32 MutexGetRefCntOfCtrlTbl(u_int32 idx); /* Get Mutex reference counter */
+static int32 MutexGetRefCntLocalOfCtrlTbl(u_int32 idx); /* Get mutex reference counter (in-process) */
+static u_int32 MutexSearchNameOfCtrlTbl(LPCTSTR name); /* Search mutex name */
+static u_int32 MutexSearchEmptyOfCtrlTbl(void); /* Search unused area */
+static void MutexIncUseCntOfCtrlInfo(void); /* Increment Mutex using counter */
+static void MutexDecUseCntOfCtrlInfo(void); /* Decrement Mutex using counter */
+static void MutexIncRsvCntOfCtrlInfo(void); /* Increment Mutex reserved counter */
+static void MutexDecRsvCntOfCtrlInfo(void); /* Decrement Mutex reserved counter */
+
+/* Mutex ownership-information manipulation functions */
+static void MutexSetFlagOfOwnerTbl(u_int32 idx, BOOL flag); /* Set ownership-information */
+static BOOL MutexGetFlagOfOwnerTbl(u_int32 idx); /* Get ownership-information */
+
+/* Mutex manipulation functions for accessing Mutex control tables */
+static void MutexCreateMutex(void); /* Create Mutex */
+static void MutexLockMutex(void); /* Get Mutex */
+static void MutexUnlockMutex(void); /* Release Mutex */
+static void MutexDeleteMutex(void); /* Delete Mutex */
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Initialize the mutex function
+ *
+ * Call the in-process initialization API for locking between processes that provide CLS.<br>
+ * Create shared memory for a Mutex control table.<br>
+ * Create a mutex for accessing Mutex control info.<br>
+ * If an error occurs during internal processing of this API, subsequent normal operations cannot be performed, so call _pb_Exit().
+ *
+ * @return RET_NORMAL
+ */
+RET_API MutexInit(void) {
+ RET_API ret_api = RET_NORMAL;
+ MUTEX_CTRL_SHARED_INFO **pp_tbl;
+ u_int32 idx;
+
+ memset(g_mutex_ctrl_tbl.handle, 0, sizeof(g_mutex_ctrl_tbl.handle));
+ memset(g_mutex_ctrl_tbl.ref_cnt, 0, sizeof(g_mutex_ctrl_tbl.ref_cnt));
+
+ /* Set pointer to Mutex control table */
+ pp_tbl = &(g_mutex_ctrl_tbl.info);
+
+ MutexCreateMutex(); /* Create Mutex for accessing Mutex control info */
+
+ MutexLockMutex(); /* Get Mutex for accessing Mutex control info */
+
+ /* Open the Mutex control table shared memory */
+ g_h_shm = OpenSharedMemory((TCHAR*)(MUTEX_CTRL_TBL_NAME), // NOLINT(readability/casting)
+ sizeof(MUTEX_CTRL_SHARED_INFO));
+
+ /* If called for the first time within all processes, an error occurs and the following processing is performed. */
+ if (g_h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be other val
+ /* Create shared memory for Mutex control table */
+ // LCOV_EXCL_BR_LINE 200: can not return NULL
+ g_h_shm = CreateSharedMemory((TCHAR*)MUTEX_CTRL_TBL_NAME, // NOLINT(readability/casting)
+ sizeof(MUTEX_CTRL_SHARED_INFO));
+ if (g_h_shm == NULL) /* In case of an error */ { // LCOV_EXCL_BR_LINE 200: can not return NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateShareData ERROR [hShm:%p]", g_h_shm);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: cannot return NULL
+ /* don't arrive here. */
+ }
+ }
+
+ MutexUnlockMutex(); /* Release of Mutex for accessing Mutex control info */
+
+ /* Set addresses of the acquired shared memory as a pointer of the Mutex control table. */
+ *pp_tbl = reinterpret_cast<MUTEX_CTRL_SHARED_INFO*>(GetSharedMemoryPtr(g_h_shm));
+
+ /* Initialize various information of control table */
+ for (idx = 0; idx < MAX_CTRL_MUTEX_NUM; idx++) {
+ /* Set Lock ID in Mutex control table(Overwrite from the second process onwards) */
+ MutexSetLockIdOfCtrlTbl(idx, kLockIdList[idx]);
+
+ MutexSetFlagOfOwnerTbl(idx, FALSE);
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Terminate
+ */
+RET_API MutexTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+
+ CloseSharedMemory(g_h_shm);
+
+ MutexDeleteMutex();
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create Mutex
+ *
+ * Create a named mutex that can be locked between processes.
+ *
+ * @param[in] lp_mutex_attributes Security descriptor(Unused)
+ * @param[in] b_initial_owner Initial owner flag(Unused)
+ * @param[in] lp_name Mutex name
+ *
+ * @return Except NULL Handle of the created mutex (Management information pointer)<br>
+ * NULL ABEND
+ */
+HANDLE _pb_CreateMutex(LPSECURITY_ATTRIBUTES lp_mutex_attributes, // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ BOOL b_initial_owner, LPCTSTR lp_name) {
+ int32 idx; /* For accessing Mutex control table */
+ HANDLE h_mutex = NULL; /* Mutex handle */
+ void *p_addr;
+ int32 errno;
+ LOCK_ID lock_id;
+ size_t len;
+
+ /* Null check */
+ if (lp_name == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!!");
+ } else {
+ len = _tcslen(lp_name);
+ if (len >= NAME_MAX) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! " \
+ "Length of mutex name is too long(>=%d). [len:%zu]", NAME_MAX, len);
+ } else {
+ MutexLockMutex(); /* Get Mutex for accessing Mutex control info */
+
+ /* Retrieve whether the specified mutex name exists in the Mutex control table */
+ idx = MutexSearchNameOfCtrlTbl(lp_name);
+
+ /* Already assigned */
+ if (idx != MAX_CTRL_MUTEX_NUM) {
+ /* Get mutex handle from Mutex control table */
+ h_mutex = MutexGetMutexHandleOfCtrlTbl(idx);
+
+ /* First-time creation within a process */
+ if (h_mutex == NULL) {
+ /* Get Lock ID */
+ lock_id = MutexGetLockIdOfCtrlTbl(idx);
+
+ /* Lock information mapping (CLS) */
+ p_addr = CL_LockMap(lock_id); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* In case of an error */
+ if (p_addr == MAP_FAILED) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Output an error log and return an error value */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockMap ERROR!! [p_addr:%p, errno:%d]", p_addr, errno);
+ } else {
+ /* Successful allocation */
+ /* Set Mutex handle in the mutex management table */
+ MutexSetMutexHandleOfCtrlTbl(idx, (HANDLE)p_addr);
+
+ h_mutex = (HANDLE)p_addr;
+ }
+ }
+
+ if (h_mutex != NULL) { // LCOV_EXCL_BR_LINE 200: h_mutex can not be NULL
+ /* Increment Mutex reference counter */
+ MutexIncRefCntOfCtrlTbl(idx);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__,
+ "### MUTEX TABLE INFORMATION # (+) idx:%d HANDLE:%p, " \
+ "ref_cnt:%d, LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d",
+ idx,
+ g_mutex_ctrl_tbl.handle[idx],
+ g_mutex_ctrl_tbl.ref_cnt[idx],
+ g_mutex_ctrl_tbl.info->detail[idx].lock_id,
+ g_mutex_ctrl_tbl.info->detail[idx].name,
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt,
+ g_mutex_ctrl_tbl.info->detail[idx].thread_id,
+ g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail,
+ g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access);
+ }
+ } else {
+ /* For a new assignment */
+ /* Get the free space in the mutex management table. */
+ idx = MutexSearchEmptyOfCtrlTbl();
+
+ /* Get Lock ID */
+ lock_id = MutexGetLockIdOfCtrlTbl(idx);
+
+ /* Lock information mapping (CLS) */
+ p_addr = CL_LockMap(lock_id);
+
+ /* In case of an error */
+ if (p_addr == MAP_FAILED) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Output an error log and return an error value. */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockMap ERROR!! " \
+ "[p_addr:%p, errno:%d] In _pb_CreateMutex", p_addr, errno);
+ } else {
+ /* Successful allocation */
+ /* Set Mutex Hanlde in the mutex management table */
+ MutexSetMutexHandleOfCtrlTbl(idx, (HANDLE)p_addr);
+
+ /* Set the mutex name in the mutex management table */
+ MutexSetMutexNameOfCtrlTbl(idx, lp_name);
+
+ /* Increment Mutex reference counter */
+ MutexIncRefCntOfCtrlTbl(idx);
+
+ /* Increment mutex using counter */
+ MutexIncUseCntOfCtrlInfo();
+
+ h_mutex = (HANDLE)p_addr;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__,
+ "### MUTEX TABLE INFORMATION # (++) idx:%d HANDLE:%p, ref_cnt:%d, " \
+ "LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d",
+ idx,
+ g_mutex_ctrl_tbl.handle[idx],
+ g_mutex_ctrl_tbl.ref_cnt[idx],
+ g_mutex_ctrl_tbl.info->detail[idx].lock_id,
+ g_mutex_ctrl_tbl.info->detail[idx].name,
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt,
+ g_mutex_ctrl_tbl.info->detail[idx].thread_id,
+ g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail,
+ g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access);
+ }
+ }
+
+ if (h_mutex != NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ /* Update Mutex ownership */
+ MutexSetFlagOfOwnerTbl(idx, TRUE);
+ }
+
+ /* Release the Mutex for accessing Mutex control info */
+ MutexUnlockMutex();
+ }
+ }
+
+ return h_mutex;
+}
+
+/**
+ * @brief
+ * Delete the mutex
+ *
+ * Decrement the Mutex reference counter and delete it when it reaches zero.
+ *
+ * @param[in] h_mutex Mutex handle (CreateMutex return value)
+ *
+ * @return WAIT_OBJECT_0 Normal completion<br>
+ * WAIT_FAILED ABEND
+ */
+DWORD PbDeleteMutex(HANDLE h_mutex) {
+ DWORD lret = WAIT_OBJECT_0;
+ u_int32 idx;
+ int32 ref_cnt;
+ int32 ret;
+ BOOL is_owner;
+ uint32_t tid;
+
+ /* Null check */
+ if (h_mutex == NULL) { // LCOV_EXCL_BR_LINE 6: h_mutex cannot be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 6: h_mutex cannot be NULL
+ } else {
+ MutexLockMutex(); /* Get Mutex for accessing Mutex control info */
+
+ /* Retrieve the index of the management table containing the Mutex handles */
+ idx = MutexGetIdxOfCtrlTbl(h_mutex);
+ /* When the specified Mutex handle is not registered */
+ if (idx == MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 200: idx can no be MAX_CTRL_MUTEX_NUM
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "Argment ERROR [h_mutex:%p]", h_mutex);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 200: idx can no be MAX_CTRL_MUTEX_NUM
+ } else {
+ /* If it is registered */
+ /* Determinate its ownership */
+ is_owner = MutexGetFlagOfOwnerTbl(idx);
+ if (is_owner == TRUE) {
+ /* Get Mutex reference counter */
+ ref_cnt = MutexGetRefCntOfCtrlTbl(idx);
+
+ /* No clients are using the specified Mutex. */
+ if ((ref_cnt - 1) <= 0) {
+ /* Lock information unmapping (CLS) */
+ ret = CL_LockUnmap(reinterpret_cast<void*>(h_mutex)); // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When an error occurs */
+ if (ret == -1) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockUnmap ERROR");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ /* If successful */
+ /* Remove Mutex hanlde from Mutex control table */
+ MutexSetMutexHandleOfCtrlTbl(idx, NULL);
+
+ /* Delete the mutex name from the Mutex control table */
+ MutexSetMutexNameOfCtrlTbl(idx, "");
+
+ /* Update Mutex ownership */
+ MutexSetFlagOfOwnerTbl(idx, FALSE);
+
+ /* Decrement Mutex reference counter */
+ MutexDecRefCntOfCtrlTbl(idx);
+
+ /* Decrement mutex using counter */
+ MutexDecUseCntOfCtrlInfo();
+
+ tid = MutexGetTidOfCtrlTbl(idx);
+ if (tid != 0) { // LCOV_EXCL_BR_LINE 200: tid can not be 0
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ MutexSetIsForbidAccessOfCtrlTbl(idx, TRUE); // LCOV_EXCL_LINE 200: tid can not be 0
+ }
+
+ /* Initialize debug information */
+ MutexSetTidOfCtrlTbl(idx, 0);
+ MutexSetIsRelFailOfCtrlTbl(idx, FALSE);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__,
+ "### MUTEX TABLE INFORMATION # (--) idx:%d HANDLE:%p, ref_cnt(local):%d, " \
+ "LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d",
+ idx,
+ g_mutex_ctrl_tbl.handle[idx],
+ g_mutex_ctrl_tbl.ref_cnt[idx],
+ g_mutex_ctrl_tbl.info->detail[idx].lock_id,
+ g_mutex_ctrl_tbl.info->detail[idx].name,
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt,
+ g_mutex_ctrl_tbl.info->detail[idx].thread_id,
+ g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail,
+ g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access);
+ }
+ } else {
+ /* If exists */
+ /* Determine if any clients are referencing in the process */
+ ref_cnt = MutexGetRefCntLocalOfCtrlTbl(idx);
+ if ((ref_cnt - 1) <= 0) { // LCOV_EXCL_BR_LINE 200: ref_cnt can not bigger than 1
+ // LCOV_EXCL_START 200: ref_cnt can not bigger than 1
+ //AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Lock information unmapping (CLS) */
+ ret = CL_LockUnmap(reinterpret_cast<void*>(h_mutex));
+ /* When an error occurs */
+ if (ret == -1) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockUnmap ERROR");
+ lret = WAIT_FAILED; /* ABEND */
+ } else {
+ /* If successful */
+ /* Remove Mutex Hanlde from the Mutex control table */
+ MutexSetMutexHandleOfCtrlTbl(idx, NULL);
+
+ /* Update Mutex ownership */
+ MutexSetFlagOfOwnerTbl(idx, FALSE);
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ if (lret == WAIT_OBJECT_0) {
+ /* Decrement Mutex refernce counter */
+ MutexDecRefCntOfCtrlTbl(idx);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__,
+ "### MUTEX TABLE INFORMATION # (-) idx:%d HANDLE:%p, ref_cnt(local):%d, " \
+ "LOCK_ID:%d, NAME:%s, ref_cnt:%d, tid:%d, fail:%d, forbid:%d",
+ idx,
+ g_mutex_ctrl_tbl.handle[idx],
+ g_mutex_ctrl_tbl.ref_cnt[idx],
+ g_mutex_ctrl_tbl.info->detail[idx].lock_id,
+ g_mutex_ctrl_tbl.info->detail[idx].name,
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt,
+ g_mutex_ctrl_tbl.info->detail[idx].thread_id,
+ g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail,
+ g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access);
+ }
+ }
+
+ } else { // LCOV_EXCL_BR_LINE 200: is_owner can not be FALSE
+ /* If it is not the owner */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; // LCOV_EXCL_LINE 200: is_owner can not be FALSE
+ }
+ }
+
+ MutexUnlockMutex(); /* Release of Mutex for accessing Mutex control info */
+ }
+
+ return lret;
+}
+
+/**
+ * @brief
+ * Mutex Lock
+ *
+ * Take ownership of the mutex and start locking.
+ *
+ * @param[in] h_mutex Mutex handle(CreateMutex return value)
+ * @param[in] timeout Timeout (Millisecond)
+ *
+ * @return WAIT_OBJECT_0 Succeeded to get ownership<br>
+ * WAIT_TIMEOUT Failed to get ownership (Timeout)<br>
+ * WAIT_FAILED Failed to get ownership (Error)
+ */
+DWORD PbMutexLock(HANDLE h_mutex, DWORD timeout) {
+ DWORD lret = WAIT_OBJECT_0;
+ int32 ret;
+ DWORD time_out_cnt = 0;
+ u_int32 idx;
+ BOOL is_owner;
+ uint32_t tid;
+
+ /* Null check */
+ if (h_mutex == NULL) { // LCOV_EXCL_BR_LINE 6: h_mutex cannot be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 6: h_mutex cannot be NULL
+ } else {
+ /* Retrieve the index of the management table containing the Mutex handles */
+ idx = MutexGetIdxOfCtrlTbl(h_mutex);
+ /* When the specified Mutex handle is not registered */
+ if (idx == MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot be MAX_CTRL_MUTEX_NUM
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [h_mutex:%p, idx:%d]", \
+ h_mutex, idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 6: idx cannot be MAX_CTRL_MUTEX_NUM
+ } else {
+ /* If it is registered */
+ /* Determinate ownership */
+ is_owner = MutexGetFlagOfOwnerTbl(idx);
+ if (is_owner == TRUE) {
+ tid = PbGetTid();
+
+ /* No timeout specified */
+ if (timeout == INFINITE) { // LCOV_EXCL_BR_LINE 6: timeout will not be other case
+ /* Get Lock (CLS) */
+ ret = CL_LockGet(reinterpret_cast<void*>(h_mutex)); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) /* In case of ABEND */ { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockGet ERROR [h_mutex:%p, ret:%d]", h_mutex, ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; /* ABEND */ // LCOV_EXCL_LINE 4: nsfw error
+ } else {
+ /* Set thread ID during lock */
+ MutexSetTidOfCtrlTbl(idx, tid);
+ }
+ } else {
+ // LCOV_EXCL_START 6: timeout will not be other case
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Timeout specified */
+ while (1) {
+ /* Get Lock (CLS) */
+ ret = CL_LockNowait(reinterpret_cast<void*>(h_mutex));
+ if (ret != 0) /* In case of ABEND */ {
+ /* Invalid parameter */
+ if (ret != EBUSY) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockGet ERROR [h_mutex:%p, ret:%d]", h_mutex, ret);
+ lret = WAIT_FAILED; /* ABEND */
+ break;
+ }
+
+ time_out_cnt++;
+ if (time_out_cnt <= timeout) {
+ usleep(1000);
+ } else {
+ /* Timeout error */
+ lret = WAIT_TIMEOUT;
+ break;
+ }
+ } else {
+ /* Successful acquisition */
+ /* Set thread ID during lock */
+ MutexSetTidOfCtrlTbl(idx, tid);
+
+ break;
+ }
+ }
+ // LCOV_EXCL_STOP
+ }
+ } else { // LCOV_EXCL_BR_LINE 200: is_owner can not be FALSE
+ /* If it is not the owner */
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ lret = WAIT_FAILED; // LCOV_EXCL_LINE 200: is_owner can not be FALSE
+ }
+ }
+ }
+
+ return lret;
+}
+
+/**
+ * @brief
+ * Mutex Unlock
+ *
+ * Release the mutex ownership and terminate the lock.
+ *
+ * @param[in] h_mutex Mutex handle(CreateMutex return value)
+ *
+ * @return TURE Normal<br>
+ * FALSE Error
+ */
+BOOL PbMutexUnlock(HANDLE h_mutex) {
+ BOOL bret = FALSE;
+ int32 ret;
+ u_int32 idx;
+ BOOL is_owner;
+ uint32_t tid;
+
+ /* Null check */
+ if (h_mutex == NULL) { // LCOV_EXCL_BR_LINE 6: h_mutex can not be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR");
+ } else {
+ /* Retrieve the index of the management table containing the Mutex handle */
+ idx = MutexGetIdxOfCtrlTbl(h_mutex);
+ /* When the specified Mutex handle is not registered */
+ if (idx == MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 200: idx can not be MAX_CTRL_MUTEX_NUM
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "MutexGetIdxOfCtrlTbl ERROR [h_mutex:%p, idx:%d]", h_mutex, idx);
+ } else {
+ /* If it is registered */
+ /* Determinate ownership */
+ is_owner = MutexGetFlagOfOwnerTbl(idx);
+ if (is_owner == TRUE) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* Release thread ID setting during lock */
+ MutexSetTidOfCtrlTbl(idx, 0);
+
+ /* Release the Lock */
+ ret = CL_LockRelease(reinterpret_cast<void*>(h_mutex));
+ if (ret == 0) /* If successful */ { // LCOV_EXCL_BR_LINE 4: nsfw error
+ bret = TRUE;
+
+ } else { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Failed */
+ tid = PbGetTid();
+
+ /* Retry to set the thread ID during lock */
+ MutexSetTidOfCtrlTbl(idx, tid);
+
+ /* Add the release failure information */
+ MutexSetIsRelFailOfCtrlTbl(idx, TRUE);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockRelease ERROR [h_mutex:%p, ret:%d]", h_mutex, ret);
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+ }
+
+ return bret;
+}
+
+/*---------------------------------------------------------------------------------*
+ * Local Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Set the Lock ID (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] l_id Lock ID
+ */
+static void MutexSetLockIdOfCtrlTbl(u_int32 idx, LOCK_ID l_id) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, l_id:%d]", idx, l_id);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_mutex_ctrl_tbl.info->detail[idx].lock_id = l_id;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get the Lock ID (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ */
+static LOCK_ID MutexGetLockIdOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_mutex_ctrl_tbl.info->detail[idx].lock_id;
+}
+
+/**
+ * @brief
+ * Set the Mutex name (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] name Mutex name
+ */
+static void MutexSetMutexNameOfCtrlTbl(u_int32 idx, LPCTSTR name) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, name:%s]", idx, name);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ _tcscpy(g_mutex_ctrl_tbl.info->detail[idx].name, name);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Set the Mutex handle (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] handle Mutex handle
+ */
+static void MutexSetMutexHandleOfCtrlTbl(u_int32 idx, HANDLE handle) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_mutex_ctrl_tbl.handle[idx] = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get the Mutex handle (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ *
+ * @return Mutex handle
+ */
+static HANDLE MutexGetMutexHandleOfCtrlTbl(u_int32 idx) {
+ HANDLE handle = NULL;
+
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ handle = g_mutex_ctrl_tbl.handle[idx];
+ }
+
+ return handle;
+}
+
+/**
+ * @brief
+ * Set the thread ID during lock acquisition (Mutex control table)
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] tid Thread ID
+ * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ */
+static void MutexSetTidOfCtrlTbl(uint32_t idx, uint32_t tid) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_mutex_ctrl_tbl.info->detail[idx].thread_id = tid;
+ }
+
+ return;
+}
+
+
+/**
+ * @brief
+ * Get the thread ID during lock acquisition (Mutex control table)
+ *
+ * @param[in] idx Control table accessor
+ *
+ * @return Thread ID
+ *
+ * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ */
+static uint32_t MutexGetTidOfCtrlTbl(uint32_t idx) {
+ uint32_t tid = 0;
+
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ tid = g_mutex_ctrl_tbl.info->detail[idx].thread_id;
+ }
+
+ return tid;
+}
+
+
+/**
+ * @brief
+ * Set the release failure information (Mutex control table)
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] flag Failed to release:TURE
+ * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ */
+static void MutexSetIsRelFailOfCtrlTbl(uint32_t idx, BOOL flag) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_mutex_ctrl_tbl.info->detail[idx].is_rel_fail = flag;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Set deletion-occurrence information during Lock acquisition (Mutex control table)
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] flag When deletion occurs while Lock is being acquired:TRUE
+ * @note If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ */
+static void MutexSetIsForbidAccessOfCtrlTbl(uint32_t idx, BOOL flag) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_mutex_ctrl_tbl.info->detail[idx].is_forbid_access = flag;
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get index for access (Mutex control table)
+ *
+ * Return the index for accessing the area of the Mutex control table in which <br>
+ * the specified mutex handle is registered. If the specified handle is not <br>
+ * registered, the maximum number of mutex management (MAX_MUTEX_CTRL_NUM) is returned.
+ *
+ * @param[in] h_mutex Mutex handle
+ *
+ * @return Index for access (Specified handle is already registered)<br>
+ * Maximum mutex management value (Specified handle is not registered)
+ */
+static u_int32 MutexGetIdxOfCtrlTbl(HANDLE h_mutex) {
+ u_int32 idx;
+ HANDLE handle;
+
+ for (idx = 0; idx < MAX_CTRL_MUTEX_NUM; idx++) {
+ /* Get handle from Mutex control table */
+ handle = MutexGetMutexHandleOfCtrlTbl(idx);
+
+ if (handle == h_mutex) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Increment the Mutex reference counter (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ */
+static void MutexIncRefCntOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt++;
+ g_mutex_ctrl_tbl.ref_cnt[idx]++;
+
+ return;
+}
+
+/**
+ * @brief
+ * Decrement the Mutex reference counter (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ */
+static void MutexDecRefCntOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ g_mutex_ctrl_tbl.info->detail[idx].ref_cnt--;
+ g_mutex_ctrl_tbl.ref_cnt[idx]--;
+
+ return;
+}
+
+/**
+ * @brief
+ * Get the Mutex Reference Counter (Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ *
+ * @return Reference counter value
+ */
+static int32 MutexGetRefCntOfCtrlTbl(u_int32 idx) {
+ int32 ret = 0;
+
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ ret = g_mutex_ctrl_tbl.info->detail[idx].ref_cnt;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Get mutex reference counter (in-process)(Mutex control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ *
+ * @return Reference counter value
+ */
+static int32 MutexGetRefCntLocalOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_mutex_ctrl_tbl.ref_cnt[idx];
+}
+
+/**
+ * @brief
+ * Search mutex name (Mutex control table)
+ *
+ * Retrieve whether the specified mutex is already registered in the Mutex control table.<br>
+ * If it is registered, the access index is returned.If it is not registered,<br>
+ * return the maximum mutex management value(MAX_CTRL_MUTEX_NUM).
+ *
+ * @param[in] name Mutex name
+ *
+ * @return Index for access(If it is registered)<br>
+ * Maximum mutex management value (Not registered)
+ */
+static u_int32 MutexSearchNameOfCtrlTbl(LPCTSTR name) {
+ int32 ret;
+ u_int32 idx;
+
+ for (idx = 0; idx < MAX_CTRL_MUTEX_NUM; idx++) {
+ ret = _tcscmp(g_mutex_ctrl_tbl.info->detail[idx].name, name);
+
+ /* If there is a match */
+ if (ret == 0) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Search unused area (Mutex control table)
+ *
+ * Return the lowest-numbered index for accessing unused space in the Mutex control table.<br>
+ * Return the maximum value((MAX_CTRL_MUTEX_NUM)) of message queue management <br>
+ * when no unused area exists.
+ *
+ * @return Index for access (Unused area exists)<br>
+ * Maximum mutex management value (No unused area)
+ */
+static u_int32 MutexSearchEmptyOfCtrlTbl(void) {
+ u_int32 idx;
+
+ idx = MutexSearchNameOfCtrlTbl("");
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Set the Mutex ownership flag (Ownership-information table)
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] flag ownership-information
+ */
+static void MutexSetFlagOfOwnerTbl(u_int32 idx, BOOL flag) {
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, flag:%d]", idx, flag);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_is_mutex_owner_tbl[idx] = flag;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get the Mutex ownership flag (Ownership-information table)
+ *
+ * @param[in] idx Control table accessor
+ *
+ * @return TRUE Owned
+ * FALSE Not owned
+ */
+static BOOL MutexGetFlagOfOwnerTbl(u_int32 idx) {
+ BOOL bret = FALSE;
+
+ /* check index */
+ if (idx >= MAX_CTRL_MUTEX_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ bret = g_is_mutex_owner_tbl[idx];
+ }
+
+ return bret;
+}
+
+/**
+ * @brief
+ * Create Mutex for accessing the Mutex control table
+ */
+static void MutexCreateMutex(void) {
+ g_h_mtx = (HANDLE)CL_LockMap(MUTEX_LOCK_ID_0); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CL_LockMap ERROR [g_h_mtx:%p]", g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Delete Mutex for accessing Mutex control table
+ */
+static void MutexDeleteMutex(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 ret;
+
+ ret = CL_LockUnmap(g_h_mtx);
+ if (ret != 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockUnmap ERROR [g_h_mtx:%p, ret:%d]", g_h_mtx, ret);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get Mutex for accessing Mutex control table
+ */
+static void MutexLockMutex(void) {
+ int32 ret;
+
+ ret = CL_LockGet(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockGet ERROR [g_h_mtx:%p, ret:%d]", g_h_mtx, ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Release Mutex for accessing Mutex control table
+ */
+static void MutexUnlockMutex(void) {
+ int32 ret;
+
+ ret = CL_LockRelease(g_h_mtx); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (ret != 0) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "CL_LockRelease ERROR [g_h_mtx:%p, ret:%d]", g_h_mtx, ret);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 4: nsfw error
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get dump information
+ *
+ * @param[out] p_buf Dump info
+ * @param[in/out] p_len Buffer size
+ */
+void _pb_GetDebugMutexMngTbl(void* p_buf, uint8_t* p_len) {
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_tmp[512];
+ static uint8_t buf_info[DEBUG_DUMP_MAX_SIZE];
+ uint32_t i;
+ uint8_t cnt = 0;
+
+ if ((p_buf != NULL) && (p_len != NULL)) {
+ memset(&buf[0], 0x00, sizeof(buf));
+ memset(&buf_info[0], 0x00, sizeof(buf_info));
+ for (i = 0; i < MAX_CTRL_MUTEX_NUM; i++) {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%02d]id:%10d, nm:%40s, ref_cnt:%10d, tid:%03d, fail:%01d, " \
+ "forbid:%01d, handle:%10p, ref_cnt(local):%10d",
+ i,
+ g_mutex_ctrl_tbl.info->detail[i].lock_id,
+ g_mutex_ctrl_tbl.info->detail[i].name,
+ g_mutex_ctrl_tbl.info->detail[i].ref_cnt,
+ g_mutex_ctrl_tbl.info->detail[i].thread_id,
+ g_mutex_ctrl_tbl.info->detail[i].is_rel_fail,
+ g_mutex_ctrl_tbl.info->detail[i].is_forbid_access,
+ g_mutex_ctrl_tbl.handle[i],
+ g_mutex_ctrl_tbl.ref_cnt[i]);
+ strncat(reinterpret_cast<char *>(&buf_info[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ if (((i + 1) % 10) == 0) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Mutex-%d%s",
+ cnt,
+ &buf_info[0]);
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ p_buf = reinterpret_cast<void *>((reinterpret_cast<uint8_t *>(p_buf)) + sizeof(buf));
+ memset(&buf_info[0], 0x00, sizeof(buf_info));
+ if (cnt >= *p_len) {
+ break;
+ }
+ }
+ }
+ if (cnt < *p_len) {
+ if (buf_info[0] != 0x00) {
+ cnt++;
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf),
+ "Mutex-%d%s",
+ cnt,
+ &buf_info[0]);
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ }
+ *p_len = cnt;
+ }
+ }
+}
+
+/**
+ * @brief
+ * Increment the Mutex using counter
+ *
+ * @param[in] none
+ */
+static void MutexIncUseCntOfCtrlInfo(void) {
+ g_mutex_ctrl_tbl.info->use_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Decrement Mutex using counter
+ *
+ * @param[in] none
+ */
+static void MutexDecUseCntOfCtrlInfo(void) {
+ g_mutex_ctrl_tbl.info->use_cnt--;
+ return;
+}
+
+/**
+ * @brief
+ * Increment Mutex reserved counter
+ *
+ * @param[in] none
+ */
+static void MutexIncRsvCntOfCtrlInfo(void) {
+ g_mutex_ctrl_tbl.info->rsv_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Decrement Mutex reserved counter
+ *
+ * @param[in] none
+ */
+static void MutexDecRsvCntOfCtrlInfo(void) {
+ g_mutex_ctrl_tbl.info->rsv_cnt--;
+ return;
+}
+
+/**
+ * @brief
+ * Determine resources ready (Mutex control data)
+ *
+ * @param[in] none
+ *
+ * @return BOOL
+ * @retval TRUE : Normal
+ * @retval FALSE : Error (Resource shortage)
+ */
+BOOL _pb_GetMutexResource(void) {
+ BOOL ret = TRUE;
+ uint32_t cnt;
+
+ MutexLockMutex();
+
+ /* Increment Mutex reserved counter */
+ MutexIncRsvCntOfCtrlInfo();
+
+ cnt = g_mutex_ctrl_tbl.info->use_cnt + g_mutex_ctrl_tbl.info->rsv_cnt;
+ if (cnt >= FULL_CTRL_MUTEX_NUM) {
+ ret = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "Lack of resources [FATAL][use_cnt:%d rsv_cnt:%d]", g_mutex_ctrl_tbl.info->use_cnt, \
+ g_mutex_ctrl_tbl.info->rsv_cnt);
+ } else if (cnt >= WARN_CTRL_MUTEX_NUM) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "Lack of resources [WARN][use_cnt:%d rsv_cnt:%d]", g_mutex_ctrl_tbl.info->use_cnt, \
+ g_mutex_ctrl_tbl.info->rsv_cnt);
+ }
+
+ MutexUnlockMutex();
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Release resources (Mutex control data)
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+void _pb_ReleaseMutexResource(void) {
+ MutexLockMutex();
+
+ /* Decrement Mutex reserved counter */
+ MutexDecRsvCntOfCtrlInfo();
+
+ MutexUnlockMutex();
+
+ return;
+}
+#endif /* PT_PB_MUTEX_STUB__CWORD71_ */
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp
new file mode 100755
index 0000000..c38016a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbOSCtrl.cpp
@@ -0,0 +1,541 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbOSCtrl.cpp
+ System name :
+ Subsystem name :
+ Title :
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <unistd.h>
+#include <stdint.h>
+#include <sys/mman.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+#include "_pbSerial.h"
+/* For CreateFile--> */
+#include <sys/select.h>
+#include <fcntl.h>
+#include <strings.h>
+#include <termios.h>
+/* For CreateFile <-- */
+
+#define GPS_FUNC_DEBUG_MSG__CWORD71__FILE 0
+
+#if GPS_FUNC_DEBUG_MSG__CWORD71__FILE
+#define FILE_OUT_LINE 50
+static u_int8 file_buf[FILE_OUT_LINE][1024];
+static u_int16 line_size_buf[FILE_OUT_LINE];
+
+/* Log destination selection (Activate the one you want to output.) */
+#define POS_GPS_R_LOGFILE_PATH "/nv/BS/vs/positioning_base_library/rwdata/Test_Pos_gps_read_data.txt"
+#define POS_GPS_W_LOGFILE_PATH "/nv/BS/vs/positioning_base_library/rwdata/Test_Pos_gps_write_data.txt"
+
+#endif /* GPS_FUNC_DEBUG_MSG__CWORD71__FILE */
+
+/* For CreateFile--> */
+#define BAUDRATE B9600
+#define MODEMDEVICE "/dev/tty.gps"
+/* For CreateFile <-- */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : ClearCommError
+* ABSTRACT : Get the communication error information and report the current status of the communication device.
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Wait for replacement */
+BOOL ClearCommError(HANDLE h_file, LPDWORD lp_errors, LPCOMSTAT lp_stat) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+// LCOV_EXCL_STOP
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : GetCommState
+* ABSTRACT : Store the current control settings of the specified communication device in the device control block (DCB struct).
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Wait for replacement */ /* TODO IHFLOW OHFLOW declarations are missing */
+BOOL GetCommState(HANDLE h_file, LPDCB lp_dcb) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 1;
+// LCOV_EXCL_STOP
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : GetCommTimeouts
+* ABSTRACT : Get the timeout parameters for all read and write operations performed on the specified communication device.
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+BOOL GetCommTimeouts(HANDLE h_file, LPCOMMTIMEOUTS lp_comm_timeouts) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if 1 /* GPF */
+ BOOL bret = FALSE;
+ DWORD dw_read = 0;
+ DWORD dw_write = 0;
+
+ if ((INVALID_HANDLE_VALUE != h_file) && (NULL != lp_comm_timeouts)) {
+ /* Initialization */
+ memset(lp_comm_timeouts, 0, sizeof(COMMTIMEOUTS));
+ bret = SerialObjectTimeoutGet(h_file, &dw_read, &dw_write);
+ if (TRUE == bret) {
+ lp_comm_timeouts->write_total_timeout_constant = dw_write;
+ if (0 == dw_read) {
+ /* Return as 0? or return this setting? */
+ lp_comm_timeouts->read_interval_timeout = INFINITE;
+ lp_comm_timeouts->read_total_timeout_constant = 0;
+ lp_comm_timeouts->read_total_timeout_multiplier = 0;
+ } else {
+ lp_comm_timeouts->read_total_timeout_constant = dw_read;
+ }
+ } else {
+ /* not exist in the list */
+ lp_comm_timeouts->write_total_timeout_constant = INFINITE;
+ lp_comm_timeouts->read_total_timeout_constant = INFINITE;
+ bret = TRUE;
+ }
+ }
+
+ return bret;
+
+#endif /* GPF */
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Clear Communication Buffer
+ *
+ * Discard all characters in the output buffer or input buffer of the specified resource
+ *
+ *
+ * @param[in] h_file Handle of the communication resource
+ * @param[in] dw_flags Operation to perform
+ *
+ * @return Processing result
+ * @retval TRUE processing succeeded
+ * @retval FALSE Processing failed
+ */
+BOOL PurgeComm(HANDLE h_file, DWORD dw_flags) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL ret = 0;
+ int res = -1;
+ /* h_file is FD, and less than INT_MAX(0x7fffffff) */
+ /* Flush received but unreceived data */
+ res = tcflush(static_cast<int>((long)h_file), TCIFLUSH); // NOLINT(runtime/int)
+ if (res != -1) {
+ ret = 1;
+ }
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : SetCommMask
+* ABSTRACT : Specify a set of events to monitor for a specific communication device.
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+BOOL SetCommMask(HANDLE h_file, DWORD dw_evt_mask) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if 1 /* GPF */
+ BOOL bret = FALSE;
+
+ bret = SerialObjectWaitmaskAdd(h_file, dw_evt_mask);
+ return bret;
+#endif /* GPF */
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ *
+ * Communication setting
+ *
+ * Set the serial communication according to the setting information.
+ *
+ * @param[in] h_file Communication handle
+ * @param[in] lp_dcb Serial port setting information
+ *
+ * @return Processing result
+ * @retval TRUE processing succeeded
+ * @retval FALSE Processing failed
+ */
+BOOL SetCommState(HANDLE h_file, LPDCB lp_dcb) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ struct termios newtio;
+#if 1
+ bzero(&newtio, sizeof(newtio));
+ cfmakeraw(&newtio); /* RAW mode */
+ newtio.c_cflag |= (BAUDRATE | CS8 | CLOCAL | CREAD);/*Baud:9600*/
+ newtio.c_lflag &= ~ECHO;
+#endif
+ /* h_file is FD, and less than INT_MAX(0x7fffffff) */
+ tcflush(static_cast<int>((long)h_file), TCIFLUSH); // NOLINT(runtime/int)
+ tcsetattr(static_cast<int>((long)h_file), TCSANOW, &newtio); // NOLINT(runtime/int)
+
+ return 1;
+}
+// LCOV_EXCL_STOP
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : SetCommTimeouts
+* ABSTRACT : Set the timeout parameter for all read and write operations performed on the specified communication device.
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+BOOL SetCommTimeouts(HANDLE h_file, LPCOMMTIMEOUTS lp_comm_timeouts) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if 1 /* GPF */
+ BOOL bret = FALSE;
+ DWORD dw_read_timeout = INFINITE;
+ DWORD dw_write_timeout = INFINITE;
+
+ /* Calculate timeout time */
+ if ((INFINITE == lp_comm_timeouts->read_interval_timeout)
+ && (0 == lp_comm_timeouts->read_total_timeout_constant)
+ && (0 == lp_comm_timeouts->read_total_timeout_multiplier)) {
+ /* Set without waiting */
+ dw_read_timeout = 0;
+ } else {
+ dw_read_timeout = lp_comm_timeouts->read_total_timeout_constant;
+ }
+
+
+ dw_write_timeout = lp_comm_timeouts->write_total_timeout_constant;
+
+ bret = SerialObjectTimeoutAdd(h_file, dw_read_timeout, dw_write_timeout);
+
+ return bret;
+#endif /* GPF */
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ *
+ * Waiting for communication event
+ *
+ * Wait for an event to be generated for a specified handle
+ * Note : Continue to wait indefinitely until data reception/error occurs
+ *
+ * @param[in] h_file Communication handle
+ * @param[out] lp_evt_mask Pointer to the variable to receive the event
+ * @param[in] lp_overlapped OVERLAPPED Pointer to a struct[Note:Not used]
+ *
+ * @return Processing result
+ * @retval TRUE Processing succeeded
+ * @retval FALSE Processing failed
+ */
+BOOL WaitCommEvent(HANDLE h_file, LPDWORD lp_evt_mask, LPOVERLAPPED lp_overlapped) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL ret = 0;
+ int res = -1;
+ int fd;
+ fd_set fds_set_err;
+ fd_set fds_set; // Set of file descriptor
+
+ struct timeval tv;
+
+ /* Monitor for 0.5 seconds */
+ tv.tv_sec = 1;
+ tv.tv_usec = 0;
+ /* h_file is FD, and less than INT_MAX(0x7fffffff) */
+ fd = static_cast<int>((long)h_file); // NOLINT(runtime/int)
+
+ /* Initialization */
+ FD_ZERO(&fds_set);
+ FD_ZERO(&fds_set_err);
+
+ FD_SET(fd, &fds_set);
+ FD_SET(fd, &fds_set_err);
+
+ res = select(fd + 1, &fds_set, NULL, &fds_set_err, &tv);
+
+ if (res > 0) {
+ if (FD_ISSET(fd, &fds_set)) {
+ *lp_evt_mask = EV_RXCHAR;
+ ret = 1;
+
+ } else {
+ *lp_evt_mask = EV_ERROR;
+ ret = 0;
+ }
+ } else {
+ ret = 0;
+ }
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ *
+ * Create file
+ *
+ * Create or open an object and return a handle which can be used to access the object
+ *
+ * @param lp_file_name Not used
+ * @param dw_desired_access Not used
+ * @param dw_share_mode Not used
+ * @param lp_security_attributes Not used
+ * @param dw_creation_disposition Not used
+ * @param dw_flags_and_attributes Not used
+ * @param h_template_file Not used
+ *
+ * @return Handle
+ */
+HANDLE CreateFile(LPCTSTR lp_file_name, DWORD dw_desired_access, DWORD dw_share_mode, LPSECURITY_ATTRIBUTES lp_security_attributes, DWORD dw_creation_disposition, DWORD dw_flags_and_attributes, HANDLE h_template_file) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int fd;
+ int loop = 1;
+
+ while (loop == 1) {
+ fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY);
+ if (fd != -1) {
+ break;
+ }
+ sleep(1);
+ }
+ /* fd is FD, and less than INT_MAX(0x7fffffff) and the return data type is HANDLE. */
+ return (HANDLE)((long)(fd)); // NOLINT(runtime/int)
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ *
+ * Close file
+ *
+ * Close an open file
+ *
+ * @param[in] h_object Handle
+ *
+ * @return Processing result
+ * @retval TRUE Processing succeeded
+ * @retval FALSE Processing failed
+ */
+BOOL CloseFile(HANDLE h_object) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (h_object != reinterpret_cast<void*>(-1)) {
+ /* h_object is FD, and less than INT_MAX(0x7fffffff) */
+ close(static_cast<int>((long)h_object)); // NOLINT(runtime/int)
+ } else {
+ /* nop */
+ }
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ *
+ * Write File
+ *
+ * Writing Data to a File
+ *
+ * @param[in] h_file Handle
+ * @param[in] lp_buffer buffer to write
+ * @param[out] n_number_of_bytes_to_write Maximum writing size
+ * @param[out] lpNumberOfBytesWrite Writing size
+ * @param lp_overlapped Not used
+ *
+ * @return Processing result
+ * @retval TRUE Processing succeeded
+ * @retval FALSE Processing failed
+ */
+BOOL WriteFile(HANDLE h_file, LPCVOID lp_buffer, DWORD n_number_of_bytes_to_write, LPDWORD lp_number_of_bytes_written, LPOVERLAPPED lp_overlapped) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int res = -1;
+ BOOL ret = 0;
+ int fd;
+ fd_set fds_set; /* Set of file descriptors */
+ fd_set fds_set_err;
+
+ struct timeval tv;
+
+#if GPS_FUNC_DEBUG_MSG__CWORD71__FILE
+ static FILE* fp = NULL; /* For debugging */
+ int i;
+#endif /* GPS_FUNC_DEBUG_MSG__CWORD71__FILE */
+
+ /* monitor for 2 seconds.*/
+ tv.tv_sec = 2;
+ tv.tv_usec = 0;
+ /* h_file is FD, and less than INT_MAX(0x7fffffff) */
+ fd = static_cast<int>((long)h_file); // NOLINT(runtime/int)
+
+ /* Initialization */
+ FD_ZERO(&fds_set);
+ FD_ZERO(&fds_set_err);
+
+ FD_SET(fd, &fds_set);
+ FD_SET(fd, &fds_set_err);
+
+ res = select(fd + 1, &fds_set, NULL, &fds_set_err, &tv);
+ if (res > 0) {
+ if (FD_ISSET(fd, &fds_set)) {
+ /* h_file is FD, and less than INT_MAX(0x7fffffff) */
+ res = static_cast<int>(write(static_cast<int>((long)h_file), lp_buffer, // NOLINT(runtime/int)
+ n_number_of_bytes_to_write));
+ *lp_number_of_bytes_written = res;
+
+#if GPS_FUNC_DEBUG_MSG__CWORD71__FILE
+ if (fp == NULL) {
+ /* File initialization */
+ fp = fopen(POS_GPS_W_LOGFILE_PATH, "w+");
+ } else {
+ fp = fopen(POS_GPS_W_LOGFILE_PATH, "a+");
+ }
+ for (i = 0; i < n_number_of_bytes_to_write; i++) {
+ fprintf(fp, "%02x ", *(reinterpret_cast<char *>(lp_buffer) + i));
+ }
+ fprintf(fp, "\n");
+ fclose(fp);
+#endif /* GPS_FUNC_DEBUG_MSG__CWORD71__FILE */
+ }
+ } else {
+ }
+
+ if (res != -1) {
+ ret = 1;
+ }
+
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : Wsprintf
+* ABSTRACT : Format a string and store the value in a buffer. If any of the arguments are passed,
+* Format according to the corresponding format specifier in the format control string and copies it to the output buffer.
+* NOTE :
+* ARGUMENT :
+* RETURN : int defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+int Wsprintf(LPTSTR lp_out, LPCTSTR lp_fmt, ...) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+#if 1 /* GPF */
+ int rtn;
+ va_list args;
+
+ va_start(args, lp_fmt);
+ /* Seems to be occured problems because the buffer size is not known. */
+ rtn = vswprintf(reinterpret_cast<wchar_t*>(lp_out), 256, reinterpret_cast<const wchar_t*>(lp_fmt), args);
+ va_end(args);
+
+ return rtn;
+#endif /* GPF */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* MODULE : PbSystemTimeToFileTime
+* ABSTRACT : Convert the system date and time to 64-bit format file time.
+* NOTE :
+* ARGUMENT :
+* RETURN : BOOL defined
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BOOL PbSystemTimeToFileTime(const SYSTEMTIME* lp_system_time, LPFILETIME lp_file_time) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return FALSE;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * Function name : MunmapDeviceIo<br>
+ * Register unmapping<br>
+ *
+ * Overview : Remove the mapping of a register to memory.<br>
+ *
+ * -# Release the mapping of the specified register to memory.
+ *
+ * @param h_dev [I]Handle to the device object
+ * @param map_size [I]Size of mapped device I/O memory
+ *
+ * @return RET_API Processing result
+ * @retval RET_NORMAL Processing succeeded
+ * @retval RET_ERROR Processing failed
+ */
+/* Wait for replacement */
+RET_API MunmapDeviceIo(HANDLE h_dev, u_int32 map_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL;
+// LCOV_EXCL_STOP
+}
+
+/**
+ * Function name : MmapDeviceIo<br>
+ * Register mapping<br>
+ *
+ * Overview : Map registers to memory.<br>
+ *
+ * -# Map the specified register to memory.
+ *
+ * @param map_size [I]Size of mapped device I/O memory
+ * @param map_addr [I]Mapped physical address
+ *
+ * @return HANDLE Processing result
+ * @retval Except NULL Handle
+ * @retval NULL Processing failed
+ */
+/* Wait for replacement */
+HANDLE MmapDeviceIo(u_int32 map_size, u_int32 map_addr) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL;
+// LCOV_EXCL_STOP
+}
+
+/**
+ * @brief
+ *
+ * Kill
+ *
+ * Exit program
+ *
+ * @param[in] p_func Calling function
+ * @param[in] line Number of caller rows
+ */
+void _pb_Exit_d(const char* p_func, int line) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int ret = -1;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FORBIDDEN ERROR [Called by:%s, Line:%d]", p_func, line);
+ exit(ret);
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+
+/* GPF001_sample_ttaka add end */
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbOther.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbOther.cpp
new file mode 100755
index 0000000..73ff300
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbOther.cpp
@@ -0,0 +1,799 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbOther.cpp
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <asm/unistd.h>
+#include <native_service/frameworkunified_types.h>
+
+#include <vehicle_service/positioning_base_library.h>
+#include "_pbInternalProc.h"
+#include <other_service/VP_GetEnv.h>
+#include "WPF_STD_private.h"
+#include "tchar.h"
+
+
+
+/*---------------------------------------------------------------------------------*
+ * Define *
+ *---------------------------------------------------------------------------------*/
+/* Shared memory */
+#define POS_BASE_OTHER_PROC_ID "POS_BASE_OTHER_PROC_ID"
+
+#define MAX_OTHER_PROC_NUM (32) /** Maximum number of the management information to translate the process name to PNO */
+#define MAX_NUM_CTRL_TID (16) /** Maximum number of tje TID management for thread in Process */
+
+#define OTHER_PNO_BASE (0x9000) /** Base number of local process */
+
+#define THREAD_NAME_LEN_MAX (32)
+
+#define FULL_OTHER_PROC_NUM (MAX_OTHER_PROC_NUM - 4) /** Threshold of the management information to translate the process name to PNO (no free) */
+#define WARN_OTHER_PROC_NUM (MAX_OTHER_PROC_NUM - 10) /** Threshold of the management information to translate the process name to PNO (warning) */
+
+typedef void* (*_CWORD64_PROCMNG_START_ROUTINE)(void*);
+
+/*---------------------------------------------------------------------------------*
+ * Structure *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Process identification information
+ */
+typedef struct {
+ PNO pno; /**< Process number */
+ char name[THREAD_NAME_LEN_MAX]; /**< Process name */
+} PROC_ID;
+
+/*!
+ @brief Process information
+ */
+typedef struct {
+ PROC_ID id[MAX_OTHER_PROC_NUM]; /**< Process identification information */
+ uint32_t use_cnt; /**< Used number */
+ uint32_t rsv_cnt; /**< Reserved number */
+} PROC_INFO;
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Value *
+ *---------------------------------------------------------------------------------*/
+static HANDLE g_h_app[MAX_NUM_CTRL_TID]; /** Application handle */
+static HANDLE g_h_mtx; /** Shared-information-locking Mutex handle */
+static HANDLE g_h_shm; /** Shared memory handle */ // Coverity CID: 18787 compliant
+
+static PROC_INFO* g_p_proc_id_tbl; /** Process Name-PNO Translation Table */
+
+/*---------------------------------------------------------------------------------*
+ * Internal Function Prototype *
+ *---------------------------------------------------------------------------------*/
+/* Process number to PNO translation table manipulation functions */
+static void OtherSetPnoOfCnvTbl(u_int32 idx, PNO pno);
+static void OtherSetNameOfCnvTbl(u_int32 idx, PCSTR name);
+static PNO OtherGetPnoOfCnvTbl(u_int32 idx);
+static PCSTR OtherGetNameOfCnvTbl(u_int32 idx);
+static u_int32 OtherSearchPnoOfCnvTbl(PNO pno);
+static u_int32 OtherSearchNameOfCnvTbl(PCSTR name);
+static void OtherIncUseCntOfCnvTbl(void);
+static void OtherIncRsvCntOfCnvTbl(void);
+static void OtherDecRsvCntOfCnvTbl(void);
+
+static void OtherCreateMutex(void);
+static void OtherDeleteMutex(void);
+static void OtherLockMutex(void);
+static void OtherUnlockMutex(void);
+
+/**
+ * @brief
+ * Initialize other funtion
+ *
+ * @return RET_NORMAL Normal completion
+ */
+RET_API ErrTrapInit(void) {
+ RET_API ret_api = RET_NORMAL;
+ PROC_INFO **pp_tbl;
+ u_int16 idx;
+
+ pp_tbl = &g_p_proc_id_tbl; /* Set a pointer to a table to translate the process name to PNO */
+
+ OtherCreateMutex(); /* Create Mutex for accessing shared info */
+ OtherLockMutex(); /* Acquire Mutex for accessing shared info */
+
+ /* Open shared memory for a table to translate the process name to PNO */
+ g_h_shm = OpenSharedMemory(const_cast<char*>(POS_BASE_OTHER_PROC_ID), sizeof(PROC_INFO));
+
+ /* If called for the first time within all processes, an error occurs and the following processing is performed. */
+ if (g_h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be not NULL
+ /* Create shared memory for a table to translate the name to PNO */
+ g_h_shm = CreateSharedMemory(const_cast<char*>(POS_BASE_OTHER_PROC_ID), sizeof(PROC_INFO));
+ /* In case of an error */
+ if (g_h_shm == NULL) { // LCOV_EXCL_BR_LINE 200: can not be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateShareData ERROR " \
+ "[g_h_shm:%p]", g_h_shm);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // // LCOV_EXCL_LINE 200: can not be NULL
+ /* don't arrive here. */
+ }
+ }
+
+ OtherUnlockMutex(); /* Release Mutex for accessing shared info */
+
+ /* Set the acquired shared memory address as a pointer for a table to translate the process name to PNO */
+ *pp_tbl = reinterpret_cast<PROC_INFO*>(GetSharedMemoryPtr(g_h_shm));
+
+ /* Table initialization */
+ for (idx = 0; idx < MAX_OTHER_PROC_NUM; idx++) {
+ /* Set PNO into the table to translate the process name to PNO (Overwrite from the second process onwards) */
+ OtherSetPnoOfCnvTbl(idx, static_cast<PNO>(OTHER_PNO_BASE + idx));
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Terminate other function
+ */
+void ErrTrapTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CloseSharedMemory(g_h_shm);
+
+ OtherDeleteMutex();
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create Thread
+ *
+ * @param[in] lp_thread_attributes Not used
+ * @param[in] dw_stack_size Initial stack size
+ * @param[in] lp_start_address Address of the effective function of the thread
+ * @param[in] lp_parameter Thread arguments
+ * @param[in] dw_creation_flags Not used
+ * @param[in] lp_thread_id Thread identifier
+ * @param[in] pno PNO
+ * @param[in] priority Thread priority
+ *
+ * @return Non-zero:Normal status, 0:When an error occurs
+ */
+HANDLE _pb_CreateThread(LPSECURITY_ATTRIBUTES lp_thread_attributes, DWORD dw_stack_size, LPTHREAD_START_ROUTINE lp_start_address, LPVOID lp_parameter, DWORD dw_creation_flags, LPDWORD lp_thread_id, PNO pno, int32 priority) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ pthread_attr_t st_thread_attr;
+ pthread_t ul_thread_id = 0;
+ sched_param st_thread_param = {0};
+ HANDLE handle = NULL;
+ int32 lret = EOK;
+ BOOL bret = FALSE;
+
+ /* null check */
+ if (lp_thread_id == NULL) {
+ // no op
+ } else {
+ /* Initializing Attributes */
+ lret = pthread_attr_init(&st_thread_attr);
+
+ /* When the attribute initialization is successful */
+ if (lret == EOK) {
+ /* Do not inherit parent scheduling policies */
+ lret = pthread_attr_setinheritsched(&st_thread_attr, PTHREAD_EXPLICIT_SCHED);
+ }
+
+ /* If you successfully configure policy inheritance */
+ if (lret == EOK) {
+ /* Scheduling settings */
+ lret = pthread_attr_setschedpolicy(&st_thread_attr, SCHED_RR);
+ }
+
+ /* Successful Scheduling settings */
+ if (lret == EOK) {
+ /* Create a thread with the lowest priority so that the spawned thread */
+ /* do not run until they are ready for processing */
+ st_thread_param.sched_priority = 1;
+ lret = pthread_attr_setschedparam(&st_thread_attr, &st_thread_param);
+ }
+
+ /* If the priority setting is successful */
+ if (lret == EOK) {
+ lret = pthread_create(&ul_thread_id,
+ NULL,
+ (_CWORD64_PROCMNG_START_ROUTINE)lp_start_address,
+ lp_parameter);
+ }
+
+ /* Successful pthread_create */
+ if (lret == EOK) {
+ bret = TRUE;
+ }
+ }
+
+ /* When priority setting is successful */
+ if (bret != FALSE) {
+ /* Return value setting */
+ handle = (HANDLE)ul_thread_id;
+ *lp_thread_id = ul_thread_id;
+ } else {
+ /* Error log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lret ERROR [lret:%d]", lret);
+ }
+
+ return handle;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get the thread ID
+ *
+ * @return Thread ID
+ */
+uint32_t PbGetTid(void) {
+ uint32_t ul_tid;
+
+ ul_tid = (uint32_t)syscall(__NR_gettid);
+
+ return ul_tid;
+}
+
+/**
+ * @brief
+ * Get the local thread ID
+ *
+ * Local thread ID = [0, 1, 2, ...]<br>
+ * The local thread ID is unique in the process, and dynamically assigned in the order in which <br>
+ * this API was called during the process execution. <br>
+ *
+ * @return Local thread ID
+ */
+uint32_t PbGetLocalTid(void) {
+ static uint32_t g_tid[MAX_NUM_CTRL_TID] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
+ }; /** In-process thread ID management table */
+
+ uint32_t ul_tid;
+ uint32_t ul_idx;
+ uint32_t ul_local_tid = 0xFFFFFFFF;
+
+ ul_tid = PbGetTid();
+
+ OtherLockMutex(); /* Get Mutex for accessing shared info */
+
+ for (ul_idx = 0; ul_idx < MAX_NUM_CTRL_TID; ul_idx++) {
+ if (g_tid[ul_idx] == ul_tid) {
+ ul_local_tid = ul_idx;
+ }
+ }
+
+ if (ul_local_tid == 0xFFFFFFFF) {
+ for (ul_idx = 0; ul_idx < MAX_NUM_CTRL_TID; ul_idx++) {
+ if (g_tid[ul_idx] == 0xFFFFFFFF) {
+ g_tid[ul_idx] = ul_tid;
+ ul_local_tid = ul_idx;
+
+ break;
+ }
+ }
+
+ if (ul_local_tid == 0xFFFFFFFF) {
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Local Tid buffer is overfull!!");
+ _pb_Exit();
+
+ /* don't arrive here. */
+ }
+ }
+
+ OtherUnlockMutex(); /* Release Mutex for accessing shared info */
+
+ return ul_local_tid;
+}
+
+
+/**
+ * @brief
+ * Get Application Handle
+ *
+ * Get the application handle of the invoking thread.
+ *
+ * @return Non-zero:Normal status, 0:When an error occurs
+ */
+HANDLE _pb_GetAppHandle(void) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ const uint32_t offset = PbGetLocalTid();
+
+ return g_h_app[offset];
+}
+
+
+/**
+ * @brief
+ * Set Application Handle
+ *
+ * Set the application handle of the invoking thread.
+ *
+ * @param[in] name Process name
+ */
+void _pb_SetAppHandle(HANDLE h_app) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ const uint32_t offset = PbGetLocalTid();
+
+ OtherLockMutex(); /* Get Mutex for accessing shared info */
+
+ g_h_app[offset] = h_app;
+
+ OtherUnlockMutex(); /* Release Mutex for accessing shared info */
+
+ return;
+}
+
+
+/**
+ * @brief
+ * Convert process name to pno
+ *
+ * Translate process name to PNO.<br>
+ * If the process name specified in the argument is the first name to <br>
+ * be translated by this API, a new PNO is assigned and returned. <br>
+ * If NULL is specified, 0 is returned.
+ *
+ * @param[in] name Process name
+ *
+ * @return Process number
+ */
+PNO _pb_CnvName2Pno(PCSTR name) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ u_int32 idx;
+ PNO pno = 0;
+ size_t len;
+
+ /* null check */
+ if (name == NULL) {
+ pno = 0;
+ } else {
+ len = _tcslen(name);
+ if (len >= THREAD_NAME_LEN_MAX) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! " \
+ "Length of thread name is too long(>=%d). [len:%zu]", THREAD_NAME_LEN_MAX, len);
+ } else {
+ OtherLockMutex();
+
+ idx = OtherSearchNameOfCnvTbl(name);
+
+ if (idx != MAX_OTHER_PROC_NUM) {
+ pno = OtherGetPnoOfCnvTbl(idx);
+ } else {
+ idx = OtherSearchNameOfCnvTbl("");
+ OtherSetNameOfCnvTbl(idx, name);
+ /* Increment using-counter */
+ OtherIncUseCntOfCnvTbl();
+ pno = OtherGetPnoOfCnvTbl(idx);
+ }
+
+ OtherUnlockMutex();
+ }
+ }
+
+ return pno;
+}
+
+/**
+ * @brief
+ * Convert pno to process name
+ *
+ * Translate PNO to the process name.
+ * Return the process name set by _pb_CnvName2Pno to the PNO argument.
+ * If a non-PNO value is given by _pb_CnvName2Pno is specified,
+ * NULL is returned.
+ *
+ * @param[in] pno Process number
+ *
+ * @return Process name
+ */
+PCSTR _pb_CnvPno2Name(PNO pno) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ u_int32 idx;
+ PCSTR name = NULL;
+
+ OtherLockMutex();
+
+ idx = OtherSearchPnoOfCnvTbl(pno);
+
+ if (idx != MAX_OTHER_PROC_NUM) {
+ name = OtherGetNameOfCnvTbl(idx);
+ }
+
+ OtherUnlockMutex();
+
+ return name;
+}
+
+
+/**
+ * @brief
+ * Get environment variables
+ *
+ * @param[in] Environment variable name
+ * @param[in] Pointer to environment variable value
+ */
+void GetEnv(const char* p_env_str, char* p_env_buff) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VP_GetEnv(p_env_str, p_env_buff);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "VP_GetEnv:%s=%s", p_env_str, p_env_buff);
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/*---------------------------------------------------------------------------------*
+ * Local Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * PNO setting(The table to translate the process name to PNO)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] u_int32 idx Table accessor
+ * @param[in] PNO pno Process number
+ *
+ * @return none
+ */
+static void OtherSetPnoOfCnvTbl(u_int32 idx, PNO pno) {
+ /* check index */
+ if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, pno:%d]", idx, pno);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ g_p_proc_id_tbl->id[idx].pno = pno;
+
+ return;
+}
+
+/**
+ * @brief
+ * Set process name (The table to translate the process name to PNO)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] u_int32 idx Table accessor
+ * @param[in] PCSTR name Process name
+ *
+ * @return none
+ */
+static void OtherSetNameOfCnvTbl(u_int32 idx, PCSTR name) {
+ /* check index */
+ if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, name:%s]", idx, name);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ _tcscpy(g_p_proc_id_tbl->id[idx].name, name);
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get PNO (The table to translate the process name to PNO)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] u_int32 idx Table accessor
+ *
+ * @return PNO
+ */
+static PNO OtherGetPnoOfCnvTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_p_proc_id_tbl->id[idx].pno;
+}
+
+/**
+ * @brief
+ * Get process name (The table to translate the process name to PNO)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] u_int32 idx Table accessor
+ *
+ * @return PCSTR
+ */
+static PCSTR OtherGetNameOfCnvTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_OTHER_PROC_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_p_proc_id_tbl->id[idx].name;
+}
+
+/**
+ * @brief
+ * Retrieve PNO (The table to translate the process name to PNO)
+ *
+ * If the PNO specified in the argument exists in the table, return the index for access.
+ * If not exists, return the maximum number of local PNO controls (MAX_OTHER_PROC_NUM).
+ *
+ * @param[in] PNO pno Process number
+ *
+ * @return u_int32 Table accessor
+ */
+static u_int32 OtherSearchPnoOfCnvTbl(PNO pno) {
+ u_int32 idx;
+ PNO lPno;
+
+ for (idx = 0; idx < MAX_OTHER_PROC_NUM; idx++) {
+ lPno = OtherGetPnoOfCnvTbl(idx);
+
+ if (lPno == pno) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Retrieve process name (The table to translate the process name to PNO)
+ *
+ * If the process specified by the argument exists in the table, return the index for access.
+ * If not exists, return the maximum number of local PNO controls (MAX_OTHER_PROC_NUM).
+ *
+ * @param[in] PCSTR name Process name
+ *
+ * @return u_int32 Table accessor
+ */
+static u_int32 OtherSearchNameOfCnvTbl(PCSTR name) {
+ int32 ret;
+ u_int32 idx;
+
+ for (idx = 0; idx < MAX_OTHER_PROC_NUM; idx++) {
+ ret = _tcscmp(g_p_proc_id_tbl->id[idx].name, name);
+
+ /* If there is a match */
+ if (ret == 0) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+
+/**
+ * @brief
+ * Create Mutex for accessing shared info
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+static void OtherCreateMutex(void) {
+ g_h_mtx = _pb_CreateMutex(NULL, 0, "Other_Mutex");
+ if (g_h_mtx == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR [g_h_mtx:%p]", g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Delete Mutex for accessing shared info
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+static void OtherDeleteMutex(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DWORD ret;
+ ret = PbDeleteMutex(g_h_mtx);
+ if (ret != WAIT_OBJECT_0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbDeleteMutex ERROR " \
+ "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get Mutex for accessing shared info
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+static void OtherLockMutex(void) {
+ DWORD ret;
+ ret = PbMutexLock(g_h_mtx, INFINITE);
+ if (ret != WAIT_OBJECT_0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexLock ERROR " \
+ "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Open Mutex for Accessing Shared Info
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+static void OtherUnlockMutex(void) {
+ BOOL ret;
+ ret = PbMutexUnlock(g_h_mtx);
+ if (ret != TRUE) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexUnlock ERROR " \
+ "[ret:%d, g_h_mtx:%p]", ret, g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Get dump information
+ *
+ * @param[out] pBuf Dump info
+ */
+void _pb_GetDebugOtherMngTbl(void* pBuf) {
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t bufTmp[64];
+ uint32_t i;
+
+ if (pBuf != NULL) {
+ memset(&buf[0], 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&buf[0]), sizeof(buf), "Other");
+ if (g_p_proc_id_tbl == NULL) { // LCOV_EXCL_BR_LINE 200: g_p_proc_id_tbl can not be NULL
+ // LCOV_EXCL_START 200: g_p_proc_id_tbl can not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ strncat(reinterpret_cast<char *>(&buf[0]), "\n NULL", strlen("\n NULL"));
+ // LCOV_EXCL_STOP
+ } else {
+ for (i = 0; i < MAX_OTHER_PROC_NUM; i++) {
+ memset(&bufTmp[0], 0x00, sizeof(bufTmp));
+ snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
+ "\n [%02d] pno:0x%04x, name:%s",
+ i,
+ g_p_proc_id_tbl->id[i].pno,
+ g_p_proc_id_tbl->id[i].name);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), \
+ strlen(reinterpret_cast<char *>(&bufTmp[0])));
+ }
+ }
+ memcpy(pBuf, &buf[0], sizeof(buf));
+ }
+}
+
+/**
+ * @brief
+ * Increment the usage counter of the table to translate process name to PNO
+ *
+ * @param[in] none
+ */
+static void OtherIncUseCntOfCnvTbl(void) {
+ g_p_proc_id_tbl->use_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Increment the counter to reserve the table to translate the process name to PNO
+ *
+ * @param[in] none
+ */
+static void OtherIncRsvCntOfCnvTbl(void) {
+ g_p_proc_id_tbl->rsv_cnt++;
+ return;
+}
+
+/**
+ * @brief
+ * Decrement the counter to reserve the table to translate the process name to PNO
+ *
+ * @param[in] none
+ */
+static void OtherDecRsvCntOfCnvTbl(void) {
+ g_p_proc_id_tbl->rsv_cnt--;
+ return;
+}
+
+/**
+ * @brief
+ * Determine resources ready (The table to translate the process name to PNO)
+ *
+ * @param[in] none
+ *
+ * @return BOOL
+ * @retval TRUE : Normal
+ * @retval FALSE : Error (Resource shortage)
+ */
+BOOL _pb_GetOtherResource(void) {
+ BOOL ret = TRUE;
+ uint32_t cnt;
+
+ OtherLockMutex();
+
+ /* Increment reserved counter */
+ OtherIncRsvCntOfCnvTbl();
+
+ cnt = g_p_proc_id_tbl->use_cnt + g_p_proc_id_tbl->rsv_cnt;
+ if (cnt >= FULL_OTHER_PROC_NUM) {
+ ret = FALSE;
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \
+ "[FATAL][use_cnt:%d rsv_cnt:%d]", g_p_proc_id_tbl->use_cnt, g_p_proc_id_tbl->rsv_cnt);
+ } else if (cnt >= WARN_OTHER_PROC_NUM) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Lack of resources " \
+ "[WARN][use_cnt:%d rsv_cnt:%d]", g_p_proc_id_tbl->use_cnt, g_p_proc_id_tbl->rsv_cnt);
+ }
+
+ OtherUnlockMutex();
+
+ return ret;
+}
+
+/**
+ * @brief
+ * Release resources (The table to translate process name to PNO)
+ *
+ * @param[in] none
+ *
+ * @return none
+ */
+void _pb_ReleaseOtherResource(void) {
+ OtherLockMutex();
+
+ /* Decrement reserved counter */
+ OtherDecRsvCntOfCnvTbl();
+
+ OtherUnlockMutex();
+
+ return;
+}
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp
new file mode 100755
index 0000000..e8d9601
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbProcMng.cpp
@@ -0,0 +1,207 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbProcMng.cpp
+ System name :
+ Subsystem name :
+ Title :
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <fcntl.h>
+#include <sys/procfs.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+#include "_pbWaitforsingleobject.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : ExitProcess
+ * ABSTRACT : Terminate one process and all threads belonging to that process.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : VOID defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID ExitProcess(UINT u_exit_code) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ exit(u_exit_code);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetCurrentProcess
+ * ABSTRACT : Get a pseudo handle for the current process.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : HANDLE defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* QAC 3460 */
+HANDLE GetCurrentProcess(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return reinterpret_cast<HANDLE>(getpid());
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetCurrentProcessId
+ * ABSTRACT : Get the process identifier of the calling process.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : DWORD defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* QAC 3460 */
+DWORD GetCurrentProcessId(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (DWORD)getpid();
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : _pb_ExitThread
+ * ABSTRACT : Terminate a thread
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : VOID defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+VOID _pb_ExitThread(DWORD dw_exit_code) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* Delete handle type */
+ WaitObjectDel(reinterpret_cast<HANDLE*>(pthread_self()));
+
+ return pthread_exit (reinterpret_cast<void*>(dw_exit_code));
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : TerminateThread
+ * ABSTRACT : Terminate a thread
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : BOOL defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BOOL TerminateThread(HANDLE h_thread, DWORD dw_exit_code) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ int32 lret = EOK;
+ BOOL bret = TRUE;
+
+ /* Delete handle type */
+ WaitObjectDel(h_thread);
+
+ /* When an error occurs */
+ if (lret == EOK) {
+ bret = FALSE;
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetExitCodeThread
+ * ABSTRACT : Get the exit status of the specified thread.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : BOOL defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BOOL GetExitCodeThread(HANDLE h_thread, LPDWORD lp_exit_code) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return TRUE;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : WaitExitThread
+ * ABSTRACT : Wait for the thread to terminate.
+ * NOTE : It can only be used for a thread in the same process according to PosixBasedOS001.
+ * ARGUMENT :
+ * RETURN : BOOL defined
+ * RET_NORMAL : Normal completion
+ * RET_ERROR : ABEND
+ * RET_ERRTIMEOUT : Timeout occurred
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API WaitExitThread(HANDLE h_handle, u_int32 ul_mill_seconds, u_int32* pul_exit_code) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return RET_NORMAL; /* Coverity CID: 18759 compliant */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetCurrentThread
+ * ABSTRACT : Get a pseudo handle for the current thread.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : HANDLE defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* QAC 3460 */
+HANDLE GetCurrentThread(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (HANDLE)pthread_self();
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetCurrentThreadId
+ * ABSTRACT : Get the thread identifier of the calling thread.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : DWORD defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* QAC 3460 */
+DWORD GetCurrentThreadId(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return (DWORD)pthread_self();
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : GetThreadTimes
+ * ABSTRACT : Get time information about the specified thread.
+ * NOTE :
+ * ARGUMENT :
+ * RETURN : BOOL defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+BOOL GetThreadTimes(HANDLE h_process, HANDLE h_thread, LPFILETIME lp_creation_time, LPFILETIME lp_exit_time, LPFILETIME lp_kernel_time, LPFILETIME lp_user_time) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return TRUE; /* Coverity CID: 18765 compliant */
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : ResumeThread
+ * ABSTRACT : Decrease the thread suspend count by 1.
+ * NOTE : Always return 0 because no suspend operation is supported according to PosixBasedOS001.
+ * ARGUMENT :
+ * RETURN : DWORD defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+DWORD ResumeThread(HANDLE h_thread) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SuspendThread
+ * ABSTRACT : Suspend execution of the specified thread.
+ * NOTE : Always return 0 because no suspend operation is supported according to PosixBasedOS001.
+ * ARGUMENT :
+ * RETURN : DWORD defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+DWORD SuspendThread(HANDLE h_thread) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return 0;
+}
+// LCOV_EXCL_STOP
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSem.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSem.cpp
new file mode 100755
index 0000000..1264d79
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSem.cpp
@@ -0,0 +1,780 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbSem.cpp
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+#include "_pbInternalProc.h"
+#include "WPF_STD_private.h"
+#include "tchar.h"
+
+/*
+ Constants and structure definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define MAX_PB_SEMAPHORES 256
+#define MAX_SEMAPHORE_NAME_LEN 32
+#define MAX_PB_SEMAPHORES_INPROC 16
+
+/* Name storage table */
+typedef struct {
+ TCHAR semaphore_name[MAX_SEMAPHORE_NAME_LEN + 1]; /* Semaphore name(Specified name of the user APP) */
+ DWORD ref_counter; /* Reference Counter (Currently unused, always 1) */
+} PB_SEMAPHORE;
+
+/* Control information storage table */
+typedef struct {
+ HANDLE h_heap; /* Handle of the heap area allocated for expanding the self TBL (control-information-storage TBL) */
+ PB_SEMAPHORE* p_sys_semaphore; /* Address where the self name in the name storage table is stored (Top address of self name) */
+ DWORD index; /* Semaphore ID that is equal to the index of self TBL (control information strage TBL:p_handle_table) + 1 */
+ HANDLE h_semaphore; /* Semaphore handle (Semaphore or Mutex according to the above DEBUG defines) */
+ HANDLE h_mutex; /* Mutex handle for locking when updating the self TBL (control information storage TBL) */
+} PB_SEMAPHORE_OPEN_HANDLE;
+
+/* Semaphore information management table */
+typedef struct {
+ PB_SEMAPHORE_OPEN_HANDLE* p_handle_table[MAX_PB_SEMAPHORES]; /* Pointer to control information storage table */
+ HANDLE h_shared_memory; /* Handle of shared memory allocated for name storage table to expand */
+ HANDLE h_mutex; /* Mutex handle to lock when updating the name storage table */
+ PB_SEMAPHORE* p_semaphore_table; /* Pointer to the name storage table (Allocate as many areas as the maximum number of registrations in shared memory)*/
+} PB_SEMAPHORE_INSTANCE;
+
+typedef struct /* In-process semaphore management table */ {
+ char semaphore_name[MAX_SEMAPHORE_NAME_LEN]; /* Semaphore name (Specified name of the user APP) */
+ HANDLE h_heap; /* Heap handle of critical section structure area */
+ CRITICAL_SECTION *p_cs; /* Critical section pointer(Semaphore ID) */
+} PB_SEM_INPROC;
+
+/*
+ Internal function prototype declarations
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static DWORD FindSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex);
+static DWORD AllocNewSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex);
+static void FreeSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, int index, HANDLE h_mutex);
+
+/*
+ Global variable definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static PB_SEMAPHORE_INSTANCE g_instance; // NOLINT(readability/nolint) global class instance
+/* CS for exclusive control of in-process semaphore management table */
+CRITICAL_SECTION g_sem_in_proc_tbl_mng_cs;
+/* Pointer to the in-process semaphore management table */
+PB_SEM_INPROC *g_p_sem_in_proc_mng = NULL;
+
+/*
+ * Inline functions.
+ */
+inline void
+MakeSemaphoreName(TCHAR* name, DWORD index) {
+ wsprintf(name, __TEXT("POS_BASE_SEMAPHORE_SEM%05d"), static_cast<int32>(index));
+}
+inline void
+MakeMutexName(TCHAR* name, DWORD index) {
+ wsprintf(name, __TEXT("POS_BASE_SEMAPHORE_MUTEX%05d"), static_cast<int32>(index));
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SemaphoreInit
+ * ABSTRACT : Semaphore initialization processing
+ * NOTE : This function is called when _CWORD64_api.dll is ATTACH from processes
+ * : and initializes the process.
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * RET_ERRINIT ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SemaphoreInit(void) {
+ RET_API ret_api = RET_NORMAL;
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+ TCHAR name[32] = {0};
+ DWORD semaphore_table_size = 0;
+ int32 n = 0;
+ PB_SEMAPHORE *p_semaphore_table = NULL;
+ BOOL b_create = FALSE;
+
+ /* Initialize the semaphore information management table */
+ for (n = 0; n < MAX_PB_SEMAPHORES; n++) {
+ p_inst->p_handle_table[n] = NULL; /* NULL initialize the control data storage table */
+ }
+
+ /* Initialize the semaphore name storage table */
+ _tcscpy(name, __TEXT("POS_BASE_SEMAPHORE_TABLE"));
+ semaphore_table_size = sizeof(PB_SEMAPHORE) * MAX_PB_SEMAPHORES;
+ /* Open shared memory with the name _CWORD64__SEMAPHORE_TABLE */
+ p_inst->h_shared_memory = OpenSharedMemory(name, semaphore_table_size);
+ if (p_inst->h_shared_memory == NULL) /* If shared memory does not exist */ {
+ /* Create a shared memory with the name _CWORD64__SEMAPHORE_TABLE */
+ p_inst->h_shared_memory = CreateSharedMemory(name, semaphore_table_size);
+ if (p_inst->h_shared_memory == NULL) /* If shared memory creation fails */ {
+ ret_api = RET_ERRINIT; /* Ends in error */
+ } else {
+ b_create = TRUE; /* Create shared memory */
+
+ /* Allocate the created shared memory to the semaphore name storage table and initialize it. */
+ // LCOV_EXCL_BR_START 200: cannot be null
+ p_semaphore_table = reinterpret_cast<PB_SEMAPHORE*>(GetSharedMemoryPtr(p_inst->h_shared_memory));
+ // LCOV_EXCL_BR_STOP
+ if (p_semaphore_table == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null
+ // LCOV_EXCL_START 200: cannot be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CloseSharedMemory(p_inst->h_shared_memory);
+ DeleteSharedMemory(name);
+ ret_api = RET_ERRINIT; /* Ends in error */
+ // LCOV_EXCL_STOP
+ } else {
+ for (n = 0; n < MAX_PB_SEMAPHORES; n++) {
+ p_semaphore_table[n].semaphore_name[0] = __TEXT('\0'); /* Initialize name */
+ p_semaphore_table[n].ref_counter = 0; /* Initialize reference counter */
+ }
+ }
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ /* Save the address of the shared memory to the name storage table pointer of the semaphore information management table. */
+ // LCOV_EXCL_BR_START 200: cannot be null
+ p_inst->p_semaphore_table = reinterpret_cast<PB_SEMAPHORE*>(GetSharedMemoryPtr(p_inst->h_shared_memory));
+ // LCOV_EXCL_BR_STOP
+ if (p_inst->p_semaphore_table == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null
+ // LCOV_EXCL_START 200: cannot be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ CloseSharedMemory(p_inst->h_shared_memory);
+ if (b_create != FALSE) {
+ DeleteSharedMemory(name);
+ }
+ ret_api = RET_ERRINIT; /* Ends in error */
+ // LCOV_EXCL_STOP
+ } else {
+ /* Mutex creation process for semaphore-information-management table */
+ _tcscpy(name, __TEXT("POS_BASE_SEMAPHORE_MUTEX"));
+ /* Save the handle of the created Mutex in the Mutex handles for semaphore-information-management-table */
+ p_inst->h_mutex = _pb_CreateMutex(NULL, FALSE, name); // LCOV_EXCL_BR_LINE 200: can not be null
+ if (p_inst->h_mutex == NULL) { /* Failed to create a Mutex. */ // LCOV_EXCL_BR_LINE 200: can not be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \
+ "In SemaphoreInit\r\n", LTEXT(__FILE__), __LINE__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SemaphoreTerm
+ * ABSTRACT : Semaphore function termination processing
+ * NOTE : Called when the process ATTACH to _CWORD64_api.dll terminates, and then terminated.
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Always this value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SemaphoreTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+
+ if (p_inst->h_mutex != NULL) {
+ PbDeleteMutex(p_inst->h_mutex);
+ p_inst->h_mutex = NULL;
+ }
+
+ if (p_inst->h_shared_memory != NULL) {
+ CloseSharedMemory(p_inst->h_shared_memory);
+ p_inst->h_shared_memory = NULL;
+ }
+
+ return RET_NORMAL;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Create Semaphore
+ *
+ * Create a semaphore and return a semaphore ID.<br>
+ * For a semaphore that has already been created, return the same value of the semaphore ID when it has been created.
+ *
+ * @param[in] *sem_name Pointer to the semaphore name string to be created (NULL termination)
+ *
+ * @return Semaphore ID created other than 0<br>
+ * 0 ABEND to create semaphore
+ */
+#ifdef _CWORD64_API_DOES_NOT_USE_UNICODE
+SemID _pb_CreateSemaphore(char* sem_name) // NOLINT(readability/nolint) WPF_SYSAPI.h API
+#else
+SemID _pb_CreateSemaphore(TCHAR* sem_name) // NOLINT(readability/nolint) WPF_SYSAPI.h API
+#endif // _CWORD64_API_DOES_NOT_USE_UNICODE
+{
+ SemID ret_sem_id = 0;
+ TCHAR *p_semaphore_name = NULL;
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+ TCHAR name[MAX_SEMAPHORE_NAME_LEN + 1] = {0};
+ PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL;
+ DWORD index = 0;
+
+ /* Check if the semaphore name is NULL */
+ if (sem_name == NULL) {
+ } else {
+ p_semaphore_name = sem_name;
+
+ /* Check if the semaphore name is specified */
+ if (p_semaphore_name[0] == __TEXT('\0')) {
+ } else if (_tcslen(p_semaphore_name) > MAX_SEMAPHORE_NAME_LEN) {
+ /* Check whether the semaphore name is less than or equal to the maximum number of characters */
+ } else {
+ /* Allocate Heap control information storage table area to create a semaphore */
+ p_semaphore_open = reinterpret_cast<PB_SEMAPHORE_OPEN_HANDLE *>(PbProcessHeapAlloc(0, \
+ sizeof(PB_SEMAPHORE_OPEN_HANDLE))); // LCOV_EXCL_BR_LINE 200: no branch
+ }
+
+ if (p_semaphore_open != NULL) {
+ PbMutexLock(p_inst->h_mutex, INFINITE); /* Mutex Lock from here */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+
+ /* Retrieve the name storage table expanded in the shared memory with the user-specified name. */
+ index = FindSemaphoreTable(p_inst->p_semaphore_table, p_semaphore_name, p_inst->h_mutex);
+ if (index != ((DWORD) - 1)) {
+ /* The semaphore name specified for the user already exists. */
+ /* Check if the control information storage table exists */
+ if (p_inst->p_handle_table[index] != NULL) {
+ /* If the control information storage TBL exists,(If it has already been created by this process) */
+ /* release the previously allocated Heap because it is not needed. */
+ PbProcessHeapFree(0, p_semaphore_open); // LCOV_EXCL_BR_LINE 200: no branch
+ /* Retrieve the pointer to the TBL storing the existing control information. */
+ p_semaphore_open = p_inst->p_handle_table[index];
+ PbMutexUnlock(p_inst->h_mutex); /* Mutex release */ // LCOV_EXCL_BR_LINE 200: no branch
+ /* Convert from an index of array to a semaphore ID and return (If it has already been created in this process) */
+ ret_sem_id = static_cast<SemID>(index + 1);
+ } else {
+ // LCOV_EXCL_START 200: p_handle_table can not be NULL
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* If a semaphore with the established name exists but the control information table does not exist, link to it or create it in the following processing. */
+ /* (A semaphore was created by another process or the created process was terminated.) */
+ /* Store the assigned semaphore ID in the control information storage table. */
+ p_semaphore_open->index = index;
+ /* Store the start address of the name storage table */
+ p_semaphore_open->p_sys_semaphore = &p_inst->p_semaphore_table[index];
+ /* Store the address of the control information TBL (Heap) into the semaphore information management TBL. */
+ p_inst->p_handle_table[index] = p_semaphore_open;
+
+ /* Create the object name of the semaphore from the position (index of array) of the control information storage TBL. */
+ /* "_CWORD64__SEMAPHORE_SEMAPHORExxxxx" : xxxxx is expanded with five-digit array index */
+ MakeSemaphoreName(name, index);
+
+ /* Create a semaphore object using Mutex and store its handle into the control information storage TBL. */
+ p_semaphore_open->h_semaphore = _pb_CreateMutex(NULL, FALSE, name);
+ if (p_semaphore_open->h_semaphore == NULL) {
+ /* If the semaphore object creation failed, */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \
+ "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name);
+ _pb_Exit(); /* Make reset */
+ }
+
+ /* Create a Mutex name for locking the control information storage TBL from the position (index of array) of the control information storage TBL */
+ /* "_CWORD64__SEMAPHORE_MUTEXxxxxx" : xxxxx is expanded with five-digit array index */
+ MakeMutexName(name, index);
+ /* Create a Mutex for locking the control information storage TBL and store its handle into the control information storage TBL */
+ p_semaphore_open->h_mutex = _pb_CreateMutex(NULL, FALSE, name);
+ if (p_semaphore_open->h_mutex == NULL) {
+ /* If the creation of a Mutex for locking the control data storage TBL fails, */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \
+ "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name);
+ _pb_Exit();
+ }
+ /* Semaphore Lock for updating semaphore information control TBL */
+ PbMutexLock(p_semaphore_open->h_mutex, INFINITE);
+ p_semaphore_open->p_sys_semaphore->ref_counter = 1;
+ /* Semaphore UnLock upon completion of updating semaphore-information-management-TBL */
+ PbMutexUnlock(p_semaphore_open->h_mutex);
+ /* Semaphore UnLock upon completion of updating semaphore-information-management-TBL */
+ PbMutexUnlock(p_inst->h_mutex);
+
+ ret_sem_id = static_cast<SemID>(index + 1); /* Convert from an index of array to a semaphore ID and return */
+ /* (A semaphore was created by another process or the created process was terminated.) */
+ // LCOV_EXCL_STOP
+ }
+ } else {
+ /* If the semaphore name specified by the user does not exist, it is newly created in the following processing. */
+ /* Free-space retrieval processing for the name storage table */
+ index = AllocNewSemaphoreTable(p_inst->p_semaphore_table, p_semaphore_name, p_inst->h_mutex);
+ if (index == ((DWORD) - 1)) { // LCOV_EXCL_BR_LINE 200: table buffer is enough, can not failed
+ /* If there is no free space in the name storage table */
+ /* Initialize the name storage TBL pointer of the control information storage TBL. (it may be No meaning due to release heap area in the following processing?) */
+ // LCOV_EXCL_START 200: table buffer is enough, can not failed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ p_semaphore_open->p_sys_semaphore = NULL;
+ /* Free the Heap area allocated for control information storage TBL */
+ PbProcessHeapFree(0, p_semaphore_open);
+ /* Semaphore UnLock to recover from errors */
+ PbMutexUnlock(p_inst->h_mutex);
+ // LCOV_EXCL_STOP
+ } else {
+ /* Store the assigned semaphore ID in the control information storage table. */
+ p_semaphore_open->index = index;
+ /* Store this start address of the name storage table */
+ p_semaphore_open->p_sys_semaphore = &p_inst->p_semaphore_table[index];
+ p_semaphore_open->p_sys_semaphore->ref_counter = 1; /* Reset reference counter. */
+ /* Store the control information TBL (Heap) address in the semaphore information management TBL. */
+ p_inst->p_handle_table[index] = p_semaphore_open;
+
+ /* Create the object name of the semaphore from the position (array index) of the control information storage TBL. */
+ /* "_CWORD64__SEMAPHORE_SEMAPHORExxxxx" : xxxxx is expanded with five-digit array index */
+ MakeSemaphoreName(name, index);
+ p_semaphore_open->h_semaphore = _pb_CreateMutex(NULL, FALSE, name); // LCOV_EXCL_BR_LINE 200: cannot be null // NOLINT(whitespace/line_length)
+ if (p_semaphore_open->h_semaphore == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \
+ "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+ }
+
+ MakeMutexName(name, index);
+ p_semaphore_open->h_mutex = _pb_CreateMutex(NULL, FALSE, name); // LCOV_EXCL_BR_LINE 200: cannot be null // NOLINT(whitespace/line_length)
+ if (p_semaphore_open->h_mutex == NULL) { // LCOV_EXCL_BR_LINE 200: cannot be null
+ // LCOV_EXCL_START 200: can not be null
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_CWORD64_api.dll:%s:LINE %d\r\n CreateMutex ERROR " \
+ "In _pb_CreateSemaphore\r\n", LTEXT(__FILE__), __LINE__);
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Mutex_Name : %s\r\n", name);
+ _pb_Exit();
+ // LCOV_EXCL_STOP
+ }
+ /* Semaphore name registration */
+ _tcscpy(p_semaphore_open->p_sys_semaphore->semaphore_name, p_semaphore_name);
+
+ PbMutexUnlock(p_inst->h_mutex); /* Mutex lock to new create semaphore ends here */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+
+ ret_sem_id = static_cast<SemID>(index + 1); /* Convert from an array index to a semaphore ID and return */
+ }
+ }
+ }
+ }
+
+ return ret_sem_id; /* Return the allocated semaphore ID. */
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbDeleteSemaphore
+ * ABSTRACT : Semaphore deletion processing
+ * NOTE : Delete the semaphore specified by semaphore ID
+ * ARGUMENT : SemID sem_id Semaphore ID to be deleted
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_OSERROR ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbDeleteSemaphore(SemID sem_id) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+ int index = 0;
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+ PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL;
+ DWORD dw_ret_sts = 0;
+ DWORD ref_counter = 0;
+
+ /* Parameter check */
+ if (sem_id == 0) {
+ /* Error if specified semaphore ID is zero */
+ ret_api = RET_OSERROR;
+ }
+
+ if (ret_api == RET_NORMAL) {
+ index = static_cast<int>(sem_id) - 1; /* Calculate the index number of the semaphore table from the specified semaphore ID. */
+ if (index >= MAX_PB_SEMAPHORES) {
+ /* If the specified semaphore ID is out of range */
+ ret_api = RET_OSERROR;
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ PbMutexLock(p_inst->h_mutex, INFINITE); /* Need this exclusion? Seems to not be used exclusion at Locking/Unlocking... */
+ p_semaphore_open = p_inst->p_handle_table[index];
+ PbMutexUnlock(p_inst->h_mutex); /* Need this exclusion? Seems to not be used exclusion at Locking/Unlocking... */
+ if (p_semaphore_open == NULL) /* If the specified semaphore ID is not registered in the table */ {
+ ret_api = RET_OSERROR;
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ /* Return an error if the semaphore is locked */
+ dw_ret_sts = PbMutexLock(p_semaphore_open->h_semaphore, 0);
+ if (dw_ret_sts == WAIT_TIMEOUT) {
+ ret_api = RET_OSERROR;
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ PbMutexUnlock(p_semaphore_open->h_semaphore);
+
+ PbMutexLock(p_semaphore_open->h_mutex, INFINITE);
+ if (p_semaphore_open->p_sys_semaphore->ref_counter > 0) {
+ p_semaphore_open->p_sys_semaphore->ref_counter--;
+ }
+
+ ref_counter = p_semaphore_open->p_sys_semaphore->ref_counter;
+ PbMutexUnlock(p_semaphore_open->h_mutex);
+
+ if (ref_counter == 0) {
+ PbMutexLock(p_inst->h_mutex, INFINITE); /* Get Mutex */
+
+ FreeSemaphoreTable(p_inst->p_semaphore_table, index, p_inst->h_mutex);
+ p_semaphore_open->p_sys_semaphore = NULL;
+ if (p_semaphore_open->h_semaphore != NULL) {
+ PbDeleteMutex(p_semaphore_open->h_semaphore);
+ p_semaphore_open->h_semaphore = NULL;
+ }
+
+ if (p_semaphore_open->h_mutex != NULL) {
+ PbDeleteMutex(p_semaphore_open->h_mutex);
+ p_semaphore_open->h_mutex = NULL;
+ }
+
+ PbProcessHeapFree(0, p_semaphore_open);
+
+ p_inst->p_handle_table[index] = NULL;
+ PbMutexUnlock(p_inst->h_mutex); /* Release Mutex */
+ }
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Semaphore Lock
+ *
+ * Get the semaphore with the specified semaphore ID. Do not return from this function until it is acquired.
+ *
+ * @param[in] sem_id Semaphore ID of the semaphore to be acquired
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_OSERROR ABEND
+ */
+RET_API _pb_SemLock(SemID sem_id) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ RET_API ret_api = RET_OSERROR;
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+ PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL;
+ int index = 0;
+ DWORD result = 0;
+
+ /* Parameter check */
+ if (sem_id != 0) {
+ /* The specified semaphore ID is non-zero */
+ index = static_cast<int>(sem_id) - 1; /* Calculate the index number of the semaphore table from the specified semaphore ID. */
+ if (index >= MAX_PB_SEMAPHORES) {
+ /* If the specified semaphore ID is out of range */
+ } else {
+ p_semaphore_open = p_inst->p_handle_table[index];
+ if (p_semaphore_open != NULL) {
+ /* If the specified semaphore ID is already registered in the table, */
+ ret_api = RET_NORMAL;
+ }
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ /* Wait forever until a semaphore is acquired */
+ result = PbMutexLock(p_semaphore_open->h_semaphore, INFINITE);
+
+ switch (result) {
+ case WAIT_OBJECT_0: {
+ ret_api = RET_NORMAL;
+ break;
+ }
+ case WAIT_ABANDONED: { // LCOV_EXCL_BR_LINE 200: function do not return this
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_OSERROR; // LCOV_EXCL_LINE 200: function do not return this
+ break; // LCOV_EXCL_LINE 200: function do not return this
+ }
+ case WAIT_TIMEOUT: { // LCOV_EXCL_BR_LINE 200: parameter INFINITE not return this
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_OSERROR; // LCOV_EXCL_LINE 200: parameter INFINITE not return this
+ break; // LCOV_EXCL_LINE 200: parameter INFINITE not return this
+ }
+ default:
+ ret_api = RET_OSERROR;
+ break;
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Semaphore Unlock
+ *
+ * Release the semaphore specified by semaphore ID.
+ *
+ * @param[in] sem_id Semaphore ID of the semaphore to be released
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_OSERROR ABEND
+ */
+RET_API _pb_SemUnlock(SemID sem_id) { // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ RET_API ret_api = RET_OSERROR;
+ int index = 0;
+ PB_SEMAPHORE_INSTANCE *p_inst = &g_instance;
+ PB_SEMAPHORE_OPEN_HANDLE *p_semaphore_open = NULL;
+ BOOL ok = FALSE;
+
+ /* Parameter check */
+ if (sem_id != 0) {
+ /* The specified semaphore ID is non-zero */
+ index = static_cast<int>(sem_id) - 1; /* Calculate the index number of the semaphore table from the specified semaphore ID. */
+ if (index >= MAX_PB_SEMAPHORES) {
+ /* If the specified semaphore ID is out of range */
+ } else {
+ p_semaphore_open = p_inst->p_handle_table[index];
+ if (p_semaphore_open != NULL) {
+ /* If the specified semaphore ID is already registered in the table, */
+ ret_api = RET_NORMAL;
+ }
+ }
+ }
+
+ if (ret_api == RET_NORMAL) {
+ ok = PbMutexUnlock(p_semaphore_open->h_semaphore); // LCOV_EXCL_BR_LINE 200: unlock can not failed
+ if (ok == FALSE) { // LCOV_EXCL_BR_LINE 200: unlock can not failed
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_OSERROR; // LCOV_EXCL_LINE 200: unlock can not failed
+ }
+ }
+
+ return ret_api;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : InitSemaphoreInProcess
+ * ABSTRACT : Semaphore initialization processing
+ * NOTE : Initialize to use semaphore that is valid only within a process
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_OSERROR ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+InitSemaphoreInProcess(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+ DWORD pid; /* Process ID */
+ TCHAR wcs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */
+ char mbs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */
+ char *cp_addr = NULL; /* For returning the start address of the shared data area */
+ u_int32 dummy_size; /* For returning the size of shared data area */
+
+ pid = getpid(); /* Get process ID */
+
+ memset(&wcs_share_data_name[0], 0, sizeof(wcs_share_data_name));
+ memset(&mbs_share_data_name[0], 0, sizeof(mbs_share_data_name));
+#ifdef UNDER_CE
+ /* Create the name of shared data area for in-process semaphore management table */
+ wsprintf(&wcs_share_data_name[0], __TEXT("SemInProc_%08x"), pid);
+ wcstombs(&mbs_share_data_name[0], &wcs_share_data_name[0], sizeof(mbs_share_data_name));
+#else
+ /* Create the name of shared data area for in-process semaphore management table */
+ wsprintf(&mbs_share_data_name[0], __TEXT("SemInProc_%08x"), static_cast<int32>(pid));
+#endif
+
+ /* Link to shared data area for semaphore management table in process */
+ ret_api = _pb_LinkShareData(&mbs_share_data_name[0], reinterpret_cast<void**>(&cp_addr), &dummy_size);
+ if (ret_api == RET_NORMAL) {
+ /* Successful completion because _pb_InitSemaphoreInProcess has already been executed. */
+ } else {
+ /* Create shared data area for in-process semaphore management table */
+ ret_api = _pb_CreateShareData(&mbs_share_data_name[0],
+ static_cast<u_int32>(sizeof(PB_SEM_INPROC) * MAX_PB_SEMAPHORES_INPROC), \
+ reinterpret_cast<void**>(&cp_addr));
+ if (ret_api == RET_NORMAL) {
+ /* Save top address of in-process semaphore management table */
+ g_p_sem_in_proc_mng = reinterpret_cast<PB_SEM_INPROC *>(cp_addr);
+
+ /* Initialization processing of the critical section object for in-process semaphore management table lock */
+ PbInitializeCriticalSection(&g_sem_in_proc_tbl_mng_cs);
+ } else {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " _CWORD64_api.dll:%s:LINE %d\r\n ## " \
+ "ERROR:InitSemaphoreInProcess --> _pb_CreateShareData ##\r\n", LTEXT(__FILE__), __LINE__);
+ ret_api = RET_OSERROR;
+ }
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DeinitSemaphoreInProcess
+ * ABSTRACT : Semaphore function termination processing
+ * NOTE : Terminate semaphore function that is valid only within a process
+ * ARGUMENT : None
+ * RETURN : RET_API RET_NORMAL Normal completion
+ * : RET_OSERROR ABEND
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DeinitSemaphoreInProcess(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+ PB_SEM_INPROC *p_sem_in_proc; /* Pointer to the in-process semaphore management table */
+ DWORD pid; /* Process ID */
+ TCHAR wcs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */
+ char mbs_share_data_name[32]; /* Name of shared data area for in-process semaphore management table */
+ char *cp_addr = NULL; /* For returning the start address of the shared data area */
+ u_int32 dummy_size; /* For returning the size of the shared data area */
+ int i;
+
+ pid = getpid(); /* Get process ID */
+
+ memset(&wcs_share_data_name[0], 0, sizeof(wcs_share_data_name));
+ memset(&mbs_share_data_name[0], 0, sizeof(mbs_share_data_name));
+#ifdef UNDER_CE
+ /* Create the name of shared data area for in-process semaphore management table */
+ wsprintf(&wcs_share_data_name[0], __TEXT("SemInProc_%08x"), pid);
+ wcstombs(&mbs_share_data_name[0], &wcs_share_data_name[0], sizeof(mbs_share_data_name));
+#else/* Create the name of shared data area for in-process semaphore management table */
+ wsprintf(&mbs_share_data_name[0], __TEXT("SemInProc_%08x"), static_cast<int32>(pid));
+#endif
+
+ /* Link to shared data area for in-process semaphore management table */
+ ret_api = _pb_LinkShareData(&mbs_share_data_name[0], reinterpret_cast<void**>(&cp_addr), &dummy_size);
+ if (ret_api != RET_NORMAL) {
+ ret_api = RET_NORMAL; /* If the link fails, it is assumed to have been deleted and it completes normally. */
+ } else {
+ /* Get CS for exclusive control of in-process semaphore management table */
+ PbEnterCriticalSection(&g_sem_in_proc_tbl_mng_cs);
+
+ p_sem_in_proc = g_p_sem_in_proc_mng; /* Get start address of in-process semaphore management table */
+ if (p_sem_in_proc == NULL) {
+ ret_api = RET_OSERROR;
+ } else {
+ /* Search in-process semaphore management table (delete all semaphores) */
+ for (i = 0; i < MAX_PB_SEMAPHORES_INPROC; i++, p_sem_in_proc++) {
+ if (p_sem_in_proc->p_cs != 0) {
+ PbDeleteCriticalSection(p_sem_in_proc->p_cs); /* Delete critical section */
+ /* Release the Heap area allocated as the critical section structured area */
+ PbProcessHeapFree(0, p_sem_in_proc->p_cs);
+ }
+ }
+
+ ret_api = PbDeleteShareData(&mbs_share_data_name[0]); /* Delete shared data area */
+ if (ret_api != RET_NORMAL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " _CWORD64_api.dll:%s:LINE %d\r\n ## " \
+ "ERROR:DeinitSemaphoreInProcess --> PbDeleteShareData ##\r\n", LTEXT(__FILE__), __LINE__);
+ ret_api = RET_OSERROR;
+ } else {
+ g_p_sem_in_proc_mng = NULL;
+ }
+ }
+
+ PbLeaveCriticalSection(&g_sem_in_proc_tbl_mng_cs); /* Release CS for exclusive control of in-process semaphore management table */
+
+ if (ret_api == RET_NORMAL) {
+ /* When the process is completed normally up to this point */
+ PbDeleteCriticalSection(&g_sem_in_proc_tbl_mng_cs); /* Delete critical section */
+ }
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/***** Internal functions *****/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FindSemaphoreTable
+ * ABSTRACT : Name storage table retrieval processing
+ * NOTE : Retrieve the specified name storage table with the specified name,
+ * : and return its array index if the specified name exists in the table.
+ * : The specified Mutex is locked during this table retrieval processing.
+ * ARGUMENT : PB_SEMAPHORE* p_semaphore_table Pointer to the name storage TBL
+ * TCHAR* name Pointer to the name to be retrieved
+ * HANDLE h_mutex Handle of the name storage TBL-locking Mutex
+ * RETURN : DWORD othe than -1 Array index of containing the name string to be retrieved
+ * : -1 Specified name does not exist
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static DWORD
+FindSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex) {
+ DWORD ret = (DWORD) - 1;
+ /* Loop up to the maximum number of entries and search the name storage table. */
+ for (int n = 0; n < MAX_PB_SEMAPHORES; n++) {
+ /* If there is a matching name, */
+ if (_tcscmp(p_semaphore_table[n].semaphore_name, name) == 0) {
+ ret = n; /* Return the index of the array in which the given name existed */
+ break;
+ }
+ }
+ /* UnLock the lock Mutex because the search for the name storage table has been completed. */
+ /* PbMutexUnlock(h_mutex); */
+
+ return ret; /* Since no search name exists, an error value of-1 is returned. */
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : AllocNewSemaphoreTable
+ * ABSTRACT : Name storage table free space retrieval processing
+ * NOTE : Retrieve the specified name storage table from the beginning,
+ * : return the array index of any free space.
+ * : [Note] Because the Mutex part inside this function has been deleted
+ * : to fix a bug caused by Mutex leaks, the whole function must be
+ * : locked by Mutex from the outside when this function is used.
+ * ARGUMENT : PB_SEMAPHORE *p_semaphore_table
+ * TCHAR *name
+ * HANDLE h_mutex
+ * RETURN : DWORD
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static DWORD
+AllocNewSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, TCHAR* name, HANDLE h_mutex) {
+ DWORD ret = (DWORD) - 1;
+ /* Loop up to the maximum number of entries and search the name storage table. */
+ for (int n = 0; n < MAX_PB_SEMAPHORES; n++) {
+ /* If there is free space */
+ if (p_semaphore_table[n].semaphore_name[0] == __TEXT('\0')) {
+ ret = n;
+ break;
+ }
+ }
+
+ return ret;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : FreeSemaphoreTable
+ * ABSTRACT :
+ * NOTE :
+ * ARGUMENT : PB_SEMAPHORE* p_semaphore_table
+ * int index
+ * HANDLE h_mutex
+ * RETURN : None
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static void
+FreeSemaphoreTable(PB_SEMAPHORE* p_semaphore_table, int index, HANDLE h_mutex) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ p_semaphore_table[index].semaphore_name[0] = __TEXT('\0');
+}
+// LCOV_EXCL_STOP
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : _sysSem.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSerial.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSerial.cpp
new file mode 100755
index 0000000..c6044af
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSerial.cpp
@@ -0,0 +1,525 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "_pbSerial.h"
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+
+typedef struct SerialTable {
+ HANDLE h_handle; /* Registration handle */
+ DWORD dw_wait_mask; /* SetMask */
+ DWORD dw_read_timeout; /* milisec */
+ DWORD dw_write_timeout; /* milisec */
+ struct SerialTable *next;
+} SERIAL_TABLE;
+
+static SERIAL_TABLE *g_pst_serial_table = NULL;
+static pthread_mutex_t g_func_lock_mutex = PTHREAD_MUTEX_INITIALIZER; /* Consider replacing it later */
+
+/* Prototype declarations */
+static BOOL FindList(SERIAL_TABLE **p_list, HANDLE h_obj);
+static BOOL AddList(SERIAL_TABLE *p_add_list);
+static BOOL DelList(SERIAL_TABLE *h_del_obj);
+static BOOL FunctionLock(void);
+static BOOL FunctionUnlock(void);
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* _sys internal public APIs
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+@brief SerialTableInit<BR>
+ Initialize each process
+@outline SerialTableInit<BR>
+ Initialize each process
+@type Completion return type
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialTableInit(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* do nothing at this time */
+ return TRUE;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialTableTerm<BR>
+ termination processing for each process
+@outline SerialTableTerm<BR>
+ termination processing for each process
+@type Completion return type
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialTableTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (NULL != g_pst_serial_table) {
+ /* delete the list? */
+ }
+ return TRUE;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialObjectTimeoutAdd<BR>
+ Set read/write timeout
+@outline SerialObjectTimeoutAdd<BR>
+ Set read/write timeout
+@type Completion return type
+
+@param[in] HANDLE h_obj : Handle to set the timeout
+@param[in] DWORD dw_read_timeout : Timeout to read (Millisecond)
+@param[in] DWORD dw_write_timeout : Timeout to write (Millisecond)
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialObjectTimeoutAdd(HANDLE h_obj, DWORD dw_read_timeout, DWORD dw_write_timeout) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *p_list = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != h_obj) {
+ FunctionLock();
+ bret = FindList(&p_list, h_obj);
+ if (TRUE == bret) {
+ /* Already exists in the list */
+ if (NULL != p_list) {
+ p_list->dw_read_timeout = dw_read_timeout;
+ p_list->dw_write_timeout = dw_write_timeout;
+ bret = TRUE;
+ } else {
+ /* The list pointer is expected to be in the list but cannot be retrieved. */
+ bret = FALSE;
+ }
+ } else {
+ /* Not exist in the list */
+ p_list = reinterpret_cast<SERIAL_TABLE*>(malloc(sizeof(SERIAL_TABLE)));
+ if (NULL != p_list) {
+ p_list->next = NULL;
+ p_list->dw_wait_mask = 0;
+ p_list->h_handle = h_obj;
+ p_list->dw_read_timeout = dw_read_timeout;
+ p_list->dw_write_timeout = dw_write_timeout;
+ bret = AddList(p_list);
+ if (FALSE == bret) {
+ /* Registration failure */
+ free(p_list);
+ bret = FALSE;
+ } else {
+ /* Registration success */
+ bret = TRUE;
+ }
+ } else {
+ /* Falied to get memory */
+ bret = FALSE;
+ }
+ }
+ FunctionUnlock();
+ } else {
+ /* Parameter error */
+ bret = FALSE;
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialObjectTimeoutGet<BR>
+ Get read/write timeout
+@outline SerialObjectTimeoutGet<BR>
+ Get read/write timeout
+@type Completion return type
+
+@param[in] HANDLE h_obj : Handle for getting the timeout
+@param[out] DWORD* dw_read_timeout : Timeout to read (Millisecond)
+@param[out] DWORD* dw_write_timeout : Timeout to write (Millisecond)
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialObjectTimeoutGet(HANDLE h_obj, DWORD *dw_read_timeout, DWORD *dw_write_timeout) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *p_list = NULL;
+ BOOL bret = FALSE;
+
+ if ((NULL != h_obj) && (NULL != dw_read_timeout) && (NULL != dw_write_timeout)) {
+ FunctionLock();
+ bret = FindList(&p_list, h_obj);
+ if (TRUE == bret) {
+ /* Exists in the list */
+ if (NULL != p_list) {
+ *dw_read_timeout = p_list->dw_read_timeout;
+ *dw_write_timeout = p_list->dw_write_timeout;
+ bret = TRUE;
+ } else {
+ /* The list pointer is expected to be in the list but cannot be retrieved. */
+ bret = FALSE;
+ }
+ } else {
+ /* Not exist in the list */
+ bret = FALSE;
+ }
+ FunctionUnlock();
+ } else {
+ /* Parameter error */
+ bret = FALSE;
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialObjectWaitmaskAdd<BR>
+ Set the mask of event wait factor
+@outline SerialObjectWaitmaskAdd<BR>
+ Set the mask of event wait factor
+@type Completion return type
+
+@param[in] HANDLE h_obj : Handle to set the mask
+@param[in] DWORD dw_mask : Value of mask
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialObjectWaitmaskAdd(HANDLE h_obj, DWORD dw_mask) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *p_list = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != h_obj) {
+ FunctionLock();
+ bret = FindList(&p_list, h_obj);
+ if (TRUE == bret) {
+ /* already exists in the list */
+ if (NULL != p_list) {
+ /* Clear unused flags */
+ p_list->dw_wait_mask = (DWORD)((dw_mask) & (EV_RXCHAR | EV_ERROR | EV_DSR));
+ bret = TRUE;
+ } else {
+ /* The list pointer is expected to be in the list but cannot be retrieved. */
+ bret = FALSE;
+ }
+ } else {
+ /* Not exist in the list */
+ p_list = reinterpret_cast<SERIAL_TABLE*>(malloc(sizeof(SERIAL_TABLE)));
+ if (NULL != p_list) {
+ p_list->next = NULL;
+ p_list->h_handle = h_obj;
+ p_list->dw_read_timeout = INFINITE; /* Infinity wait as initial value */
+ p_list->dw_write_timeout = INFINITE; /* Infinity wait as initial value */
+ /* Clear unused flags */
+ p_list->dw_wait_mask = (DWORD)((dw_mask) & (EV_RXCHAR | EV_ERROR | EV_DSR));
+ bret = AddList(p_list);
+ if (FALSE == bret) {
+ /* Registration failure */
+ free(p_list);
+ bret = FALSE;
+ } else {
+ /* registration success */
+ bret = TRUE;
+ }
+ } else {
+ /* Failed to get memory */
+ bret = FALSE;
+ }
+ }
+ FunctionUnlock();
+ } else {
+ /* Parameter error */
+ bret = FALSE;
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialObjectWaitmaskGet<BR>
+ Get the set mask value from a handle
+@outline SerialObjectWaitmaskGet<BR>
+ Get the set mask value from a handle
+@type Completion return type
+
+@param[in] HANDLE h_obj : Handle from which the mask is to be acquired
+@param[out] DWORD* dw_mask : mask value
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialObjectWaitmaskGet(HANDLE h_obj, DWORD *dw_mask) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *p_list = NULL;
+ BOOL bret = FALSE;
+
+ if ((NULL != h_obj) && (NULL != dw_mask)) {
+ *dw_mask = 0;
+ FunctionLock();
+ bret = FindList(&p_list, h_obj);
+ if (TRUE == bret) {
+ /* Exists in the list */
+ if (NULL != p_list) {
+ *dw_mask = p_list->dw_wait_mask;
+ bret = TRUE;
+ } else {
+ /* The list pointer is expected to be in the list but cannot be retrieved. */
+ bret = FALSE;
+ }
+ } else {
+ /* Not exist in the list */
+ bret = FALSE;
+ }
+ FunctionUnlock();
+ } else {
+ /* Parameter error */
+ bret = FALSE;
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief SerialObjectDel<BR>
+ Delete Timeout and Mask Setting
+@outline SerialObjectDel<BR>
+ Delete Timeout and Mask Setting
+@type Completion return type
+
+@param[in] HANDLE h_obj : Handle from which the setting is to be deleted
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL SerialObjectDel(HANDLE h_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *p_list = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != h_obj) {
+ FunctionLock();
+ bret = FindList(&p_list, h_obj);
+ if (TRUE == bret) {
+ /* Already exists in the list */
+ if (NULL != p_list) {
+ bret = DelList(p_list);
+ if (TRUE == bret) {
+ free(p_list);
+ } else {
+ /* Failed to delete */
+ }
+ } else {
+ /* The list pointer is expected to be in the list but cannot be retrieved. */
+ bret = FALSE;
+ }
+ } else {
+ /* Not exist in the list */
+ }
+ FunctionUnlock();
+ } else {
+ /* Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* Private APIs
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+@brief FindList<BR>
+ Searching for a Handle in the List
+@outline FindList<BR>
+ Searching for a Handle in the List
+@type Completion return type
+
+@param[out] SERIAL_TABLE** p_list : Found list pointer
+@param[in] HANDLE h_obj : Handle to look for
+
+@return BOOL
+@retval TRUE : Normal (p_list != NULL)
+@retval FALSE : Error (p_list == NULL)
+*****************************************************************************/
+static BOOL FindList(SERIAL_TABLE **p_list, HANDLE h_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *pNow = NULL;
+ BOOL bret = FALSE;
+
+ if ((NULL != h_obj) && (NULL != p_list)) {
+ /* Search list */
+ pNow = g_pst_serial_table;
+ while (NULL != pNow) {
+ /* h_obj and pNow->h_handle are pointer type.*/
+ if ((int64_t)h_obj == (int64_t)pNow->h_handle) {
+ *p_list = pNow;
+ bret = TRUE;
+ break;
+ }
+ pNow = pNow->next;
+ }
+ } else {
+ bret = FALSE; /* Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief AddList<BR>
+ Append data to the end of the list
+@outline AddList<BR>
+ Append data to the end of the list
+@type Completion return type
+
+@param[in] SERIAL_TABLE* p_list : Data to add
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL AddList(SERIAL_TABLE *p_add_list) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *pNow = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != p_add_list) {
+ /* Add unregistered data */
+ if (NULL == g_pst_serial_table) {
+ g_pst_serial_table = p_add_list;
+ bret = TRUE;
+ } else {
+ /* Add to end of list */
+ pNow = g_pst_serial_table;
+ while (NULL != pNow) {
+ if (NULL == pNow->next) {
+ pNow->next = p_add_list;
+ bret = TRUE;
+ break;
+ }
+ pNow = pNow->next;
+ }
+ }
+ } else {
+ bret = FALSE; /* Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief DelList<BR>
+ Remove Specified Data from a List
+@outline DelList<BR>
+ Remove Specified Data from a List
+@type Completion return type
+
+@param[in,out] SERIAL_TABLE* h_del_obj :
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL DelList(SERIAL_TABLE *h_del_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ SERIAL_TABLE *pNow = NULL;
+ SERIAL_TABLE *pBef = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != h_del_obj) {
+ /* Add to end of list */
+ pNow = g_pst_serial_table;
+ while (NULL != pNow) {
+ if (h_del_obj == pNow) {
+ if (NULL == pBef) {
+ /* Delete first data */
+ g_pst_serial_table = pNow->next;
+ } else {
+ /* Others */
+ pBef->next = h_del_obj->next;
+ }
+ bret = TRUE;
+ break;
+ }
+ pBef = pNow;
+ pNow = pNow->next;
+ }
+ } else {
+ bret = FALSE; /* Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief FunctionLock<BR>
+ Start locking g_pst_serial_table
+@outline FunctionLock<BR>
+ Start locking g_pst_serial_table
+@type Completion return type
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL FunctionLock(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ if (EOK == pthread_mutex_lock(&g_func_lock_mutex)) {
+ bret = TRUE;
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/***************************************************************************
+@brief FunctionUnlock<BR>
+ Terminate locking of g_pst_serial_table
+@outline FunctionUnlock<BR>
+ Terminate locking of g_pst_serial_table
+@type Completion return type
+
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL FunctionUnlock(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ if (EOK == pthread_mutex_unlock(&g_func_lock_mutex)) {
+ bret = TRUE;
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSram.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSram.cpp
new file mode 100755
index 0000000..f31e16f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSram.cpp
@@ -0,0 +1,316 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbSram.cpp
+ System name : 05 Integration Platform
+ Subsystem name : System common functions
+ Title : System APIs
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /*
+ Function prototype declarations
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ RET_API SramDMWt(u_int32 mode);
+ RET_API SramDMWrkWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size);
+ RET_API SramDMWrkRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size);
+
+#ifdef __cplusplus
+}
+#endif
+
+/*
+ External function prototype declarations
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+extern RET_API CreateAsyncWtThread(void);
+
+/*
+ Global Variable Definitions
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+extern int g_n_api_set_id; /* ID variable for PSL registration */
+extern void *g_adr_diagmem_wrktop; /* Diag memory temporary work area top address */
+
+#ifdef CEPC_EM /* Physical area (pseudo area) setting for CEPC and EM */
+
+/* Allocation size of temporary work for diagnosis memory */
+#define SIZE_DIAGMEM_WRK 0x00001000
+
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramSetup
+ * ABSTRACT : SRAM Access-Initialization Process
+ * NOTE : When called by _sys_SramInit when _CWORD64_api.dll is attached, the SRAM physical area
+ * is mapped to the shared area so that the SRAM physical area can be accessed.
+ * The first call after system startup checks the result of the previous SRAM write processing.
+ * If the power is off during system startup, the system performs continuous write processing.
+ * (Before the _CWORD100_ modularization of SRAM access functions,
+ * they were used to open ports, but now they do not need to be opened.)
+ * ARGUMENT : u_int32 mount_flg HDD mount status flag
+ * u_int32 *mount_sts HDD mount status return pointer
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramSetup(u_int32 mount_flg, u_int32 *mount_sts) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramWt
+ * ABSTRACT : SRAM write process
+ * NOTE : Write the content of the buffer to the offset-position of the area of the specified SRAM ID.
+ * Temporary buffer is used for SRAM writing, and recovery from writing is considered.
+ * Therefore, the transfer data size must be less than or equal to the temporary buffer size.
+ * ARGUMENT : u_int8 id SRAM area id
+ * void *pbuf Source buffer pointer
+ * u_int32 off Destination SRAM offsets (bytes)
+ * u_int16 size Transfer data size (bytes)
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramFil
+ * ABSTRACT : SRAM memory-fill process
+ * NOTE : Fill with the specified patterns from the offset position of
+ * the area of the specified SRAM ID.
+ * Temporary buffer is used for SRAM writing, and recovery from writing is considered.
+ * Therefore, it is effective that the fill size is less than or equal to the temporary buffer size.
+ * ARGUMENT : u_int8 id SRAM area id
+ * u_int32 off Fill destination SRAM offset (bytes)
+ * u_int8 pat Fill pattern
+ * u_int16 size Fill size (bytes)
+ *
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramFil(u_int8 id, u_int32 off, u_int8 pat, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+
+ ret_sts = PbSramFil32(id, off, pat, (u_int32)size);
+
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbSramFil32
+ * ABSTRACT : SRAM memory-fill process
+ * NOTE : Fill with the specified patterns from the offset position of
+ * the area of the specified SRAM ID.
+ * Temporary buffer is used for SRAM writing, and recovery from writing is considered.
+ * Therefore, it is effective that the fill size is less than or equal to the temporary buffer size.
+ * ARGUMENT : u_int8 id SRAM area id
+ * u_int32 off Fill destination SRAM offset (bytes)
+ * u_int8 pat Fill pattern
+ * u_int32 size Fill size (bytes)
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbSramFil32(u_int8 id, u_int32 off, u_int8 pat, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramRd
+ * ABSTRACT : SRAM read process
+ * NOTE : Write content in the area specified SRAM ID and offset position to buffer.
+ * ARGUMENT : u_int8 id SRAM area ID
+ * u_int32 off Source SRAM Offset (bytes)
+ * void *pbuf Destination buffer pointer
+ * u_int16 size Transfer data size (bytes)
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+
+ ret_sts = PbSramRd32(id, off, pbuf, (u_int32)size);
+
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbSramRd32
+ * ABSTRACT : SRAM read process
+ * NOTE : Write content in the area specified SRAM ID and offset position to buffer.
+ * ARGUMENT : u_int8 id SRAM area ID
+ * u_int32 off Source SRAM Offset (bytes)
+ * void *pbuf Destination buffer pointer
+ * u_int32 size Transfer data size(bytes)
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbSramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramSz
+ * ABSTRACT : Acquisition of SRAM ID size
+ * NOTE : Get the effective area size of the specified SRAM ID.
+ * ARGUMENT : u_int8 id SRAM area ID
+ * u_int16 *psize Size (bytes)
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramSz(u_int8 id, u_int16 *psize) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ u_int32 size32 = 0;
+
+ ret_sts = PbSramSz32(id, &size32);
+ if (ret_sts == RET_NORMAL) {
+ if (size32 <= 0x0000FFFF) {
+ *psize = (u_int16)size32;
+ } else {
+ /* When the size of the specified ID is u_int16 or greater */
+ ret_sts = RET_ERRPARAM;
+ }
+ }
+
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : PbSramSz32
+ * ABSTRACT : Acquisition of SRAM ID size
+ * NOTE : Get the effective area size of the specified SRAM ID.
+ * ARGUMENT : u_int8 id SRAM area ID
+ * u_int32 *psize Size (bytes)
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+PbSramSz32(u_int8 id, u_int32 *psize) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramRWChk
+ * ABSTRACT : SRAM read/write check processing
+ * NOTE : Checking whether SRAM can be read/written correctly
+ * ARGUMENT : None
+ * RETURN : RET_API
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramRWChk(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_NORMAL; /* Result */
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : AsyncFWt
+ * ABSTRACT : Asynchronous Data HDD Backup Processing
+ * NOTE :
+ * ARGUMENT : void
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API AsyncFWt(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ /* _CWORD121_ compliant ret_sts = Backup_AsyncForcibleWrite(); */
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramWtAccOff
+ * ABSTRACT : Asynchronous Data HDD Backup Process at ACC-OFF
+ * NOTE : Saving Asynchronous Data to Hard Drives at ACC-OFF
+ * ARGUMENT : void
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API SramWtAccOff(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ /* _CWORD121_ compliant ret_sts = Backup_AccOffNotify(); */
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : DataWtWaitHDDSpinup
+ * ABSTRACT : HDD spin-up completion wait data save processing
+ * NOTE : Save to the HDD
+ * ARGUMENT : u_int16 para Startup Identification Value
+ * RETURN : RET_API defined
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+DataWtWaitHDDSpinup(u_int16 para) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_NORMAL; /* Result */
+ return ret_sts;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : SramLoadFromExtDev
+ * ABSTRACT : SRAM recovery processing
+ * NOTE : Restore Static data stored as a file on an externally attached device
+ * and the registry data to the HDD.
+ * ARGUMENT : u_int32 device Device where the file to be restored resides
+ * SD card:EXTDEV_STRAGECARD
+ * PC card:EXTDEV_PCCARD
+ * RET_API *err Error code
+ * RETURN : Return only RET_ERROR (Just perform reset without returning of this function when normal end)
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+RET_API
+SramLoadFromExtDev(ANA_RET_API *err) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_sts = RET_OSERROR;
+ return(ret_sts);
+}
+// LCOV_EXCL_STOP
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : _pbSram.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSum.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSum.cpp
new file mode 100755
index 0000000..2964db7
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbSum.cpp
@@ -0,0 +1,95 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ File name : _pbSum.cpp
+ System name :
+ Subsystem name : System common functions
+ Title : System APIs Asynchronous Data HDD Backup Processing
+ --------------------------------------------------------------------------------------
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <vehicle_service/positioning_base_library.h>
+
+/*
+ Function prototype declarations
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * MODULE : Sum()
+ * ABSTRACT : SUM calculation process
+ * NOTE : Calculate the SUM value for the specified size from the SUM calculation start address.
+ * ARGUMENT : void *p SUM calculation start address
+ * int32 size Size (bytes)
+ * u_int8 type Calculation width Byte :sizeof(u_char)
+ * Word :sizeof(u_int16)
+ * Long-word:sizeof(u_int32)
+ * NOTE : Calculate the SUM value from the SUM calculation start address by the size specified by the calculation width.
+ * RETURN : u_int32 SUM value
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+u_int32 Sum(void *p, int32 size, u_int8 type) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ u_int32 sum = 0; /* SUM value */
+ u_int32 loop_cnt; /* Loop counter */
+ u_int32 loop_num; /* Number of loops */
+
+ /* Pointer size check */
+ if ((p == NULL) || (size == 0)) {
+ /* nop */
+ } else {
+ /* When the calculation width is "Long word" */
+ if (type == sizeof(int32)) {
+ u_int32 * ptr32 = reinterpret_cast<u_int32 *>(p); /* Long word pointer */
+
+ /* Calculate the number of processes and loop for the number of Times to compute the Sum value. */
+ loop_num = static_cast<u_int32>(size / sizeof(u_int32));
+ for (loop_cnt = 0; loop_cnt < loop_num; loop_cnt++) {
+ sum += *ptr32;
+ ptr32++;
+ }
+ } else if (type == sizeof(int16)) {
+ /* For "Word" */
+ u_int16 * ptr16 = reinterpret_cast<u_int16 *>(p); /* Word pointer */
+
+ loop_num = static_cast<u_int32>(size / sizeof(u_int16));
+ for (loop_cnt = 0; loop_cnt < loop_num; loop_cnt++) {
+ sum += *ptr16;
+ ptr16++;
+ }
+ } else if (type == sizeof(char)) {
+ /* For "Byte" */
+ u_char * ptr8 = reinterpret_cast<u_char *>(p); /* Byte pointer */
+
+ loop_num = static_cast<u_int32>(size / sizeof(u_char));
+ for (loop_cnt = 0; loop_cnt < loop_num; loop_cnt++) {
+ sum += *ptr8;
+ ptr8++;
+ }
+ } else {
+ /* For other than above */
+ /* No processing */
+ }
+ }
+ return sum;
+}
+// LCOV_EXCL_STOP
+
+/*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : Sum.cpp
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*/
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbTimer.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbTimer.cpp
new file mode 100755
index 0000000..f36711f
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbTimer.cpp
@@ -0,0 +1,1115 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * _pbTimer.cpp
+ */
+/*---------------------------------------------------------------------------------*
+ * Include Files *
+ *---------------------------------------------------------------------------------*/
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <native_service/ns_message_center_if.h>
+
+#include <vehicle_service/positioning_base_library.h>
+#include "TimerEntryDrv_If.h"
+#include "DEV_TimerEntryDrv_if.h"
+
+#include <native_service/ns_timer_if.h>
+#include "WPF_STD_private.h"
+
+
+/*---------------------------------------------------------------------------------*
+ * Define *
+ *---------------------------------------------------------------------------------*/
+#define MAX_CTRL_TIMER_NUM (8)
+
+#define CID_TIMER_1 (0x1000)
+#define CID_TIMER_2 (0x1001)
+#define CID_TIMER_3 (0x1002)
+#define CID_TIMER_4 (0x1003)
+#define CID_TIMER_5 (0x1004)
+#define CID_TIMER_6 (0x1005)
+#define CID_TIMER_7 (0x1006)
+#define CID_TIMER_8 (0x1007)
+
+#define TIMER_MAKE_DEFAULT_MESSAGE(x) \
+ (x)->Header.signo = 0; \
+ (x)->Header.hdr.sndpno = 0; \
+ (x)->Header.hdr.respno = 0; \
+ (x)->Header.hdr.cid = CID_TIMER_TOUT; \
+ (x)->Header.hdr.msgbodysize = \
+ static_cast<uint16_t>(sizeof(TimerToutMsg) - sizeof(T_APIMSG_MSGBUF_HEADER)); \
+ (x)->Header.hdr.rid = 0; \
+ (x)->Header.hdr.reserve = 0; \
+ (x)->TimerSeq = 0;
+
+/*---------------------------------------------------------------------------------*
+ * Structure *
+ *---------------------------------------------------------------------------------*/
+/*!
+ @brief Timer control information
+*/
+typedef struct {
+ CID cid; /**< Command ID */
+ HANDLE h_timer; /**< Timer handle */
+ TimerToutMsg msg_buf; /**< Message buffer */
+ uint16_t size; /**< Message size */
+ PNO pno; /**< Process number */
+ uint16_t seq_no; /**< Timer Sequence Number */
+ uint8_t type; /**< Timer type */
+ uint32_t time_out; /**< Timeout */
+} TIMER_CTRL_INFO;
+
+/*---------------------------------------------------------------------------------*
+ * Local Function Prototype *
+ *---------------------------------------------------------------------------------*/
+/* Timer control table manipulation functions */
+static void TimerSetCidOfCtrlTbl(u_int32 idx, CID cid); /* Set timer CID */
+static CID TimerGetCidOfCtrlTbl(u_int32 idx); /* Get timer CID */
+static void TimerSetPnoOfCtrlTbl(u_int32 idx, PNO pno); /* Set PNO */
+static PNO TimerGetPnoOfCtrlTbl(u_int32 idx); /* Get PNO */
+static void TimerSetSizeOfCtrlTbl(u_int32 idx, u_int16 size); /* Set message size */
+static TimerToutMsg* TimerGetMsgBufOfCtrlTbl(u_int32 idx); /* Get message buffer */
+static void TimerSetTimerHandleOfCtrlTbl(u_int32 idx, HANDLE handle); /* Set timer handle */
+static HANDLE TimerGetTimerHandleOfCtrlTbl(u_int32 idx); /* Get timer handle */
+static void TimerSetTypeOfCtrlTbl(u_int32 idx, u_int8 type); /* Set timer type */
+static u_int8 TimerGetTypeOfCtrlTbl(u_int32 idx); /* Get timer type */
+static void TimerSetSeqNoOfCtrlTbl(u_int32 idx, u_int16 seq_no); /* Set timer Sequence Number */
+static u_int16 TimerGetSeqNoOfCtrlTbl(u_int32 idx); /* Get timer sequence number */
+static void TimerSetTimeOutOfCtrlTbl(u_int32 idx, u_int32 time_out); /* Set timeout */
+static u_int32 TimerGetTimeOutOfCtrlTbl(u_int32 idx); /* Get timeout */
+static u_int32 TimerSearchEmptyOfCtrlTbl(void); /* Search unused area */
+static u_int32 TimerSearchTimerOfCtrlTbl(PNO snd_pno, u_int16 timer_seq, u_int8 time_type); /* Search specified timer */
+static void TimerClearSettingOfCtrlTbl(u_int32 idx); /* Clear timer information */
+
+/* Mutex handling Functions for accessing Timer Control Table */
+static void TimerCreateMutex(void); /* Create Mutex */
+static void TimerDeleteMutex(void); /* Delete Mutex */
+static void TimerLockMutex(void); /* Get Mutex */
+static void TimerUnlockMutex(void); /* Release Mutex */
+
+/* Callback function resources */
+static EFrameworkunifiedStatus TimerCallback1(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback2(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback3(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback4(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback5(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback6(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback7(HANDLE h_app);
+static EFrameworkunifiedStatus TimerCallback8(HANDLE h_app);
+
+static void TimerCallbackComProc(const uint8_t id);
+
+/*---------------------------------------------------------------------------------*
+ * Grobal Values *
+ *---------------------------------------------------------------------------------*/
+/**
+ Timer control table
+ Note : Access to this instance shall be made through the operation module.
+*/
+static TIMER_CTRL_INFO g_timer_ctrl_tbl[MAX_CTRL_TIMER_NUM]; // NOLINT(readability/nolint) global class instance
+
+/** Timer control table lock Mutex handle */
+static HANDLE g_h_mtx = NULL;
+
+/** Timer event destination handle */
+static HANDLE g_h_service;
+
+
+/** Dispatcher Registration Callback Table */
+static const FrameworkunifiedProtocolCallbackHandler kTimerPcbhs[] = {
+ {CID_TIMER_1, &TimerCallback1 },
+ {CID_TIMER_2, &TimerCallback2 },
+ {CID_TIMER_3, &TimerCallback3 },
+ {CID_TIMER_4, &TimerCallback4 },
+ {CID_TIMER_5, &TimerCallback5 },
+ {CID_TIMER_6, &TimerCallback6 },
+ {CID_TIMER_7, &TimerCallback7 },
+ {CID_TIMER_8, &TimerCallback8 },
+}; // LCOV_EXCL_BR_LINE 11:unexpected branch
+
+/*---------------------------------------------------------------------------------*
+ * Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Timer function initialization
+ *
+ * @return RET_NORMAL Normal completion
+ * @return RET_ERROR ABEND
+ */
+RET_API TimerInit(HANDLE h_app) {
+ RET_API ret_api = RET_NORMAL;
+ u_int32 idx;
+ HANDLE h_timer;
+ EFrameworkunifiedStatus estatus;
+ NSTimerInfo timer_info;
+ HANDLE* p_h_service = &g_h_service;
+
+ if (h_app == NULL) { // LCOV_EXCL_BR_LINE 6: h_app cannot be Null
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR!! [h_app=%p]", h_app);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 6: h_app cannot be Null
+ } else {
+ memset(&timer_info, 0x00, sizeof(timer_info));
+
+ /* Create Mutex */
+ TimerCreateMutex(); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Register callback function for timer control */
+ // LCOV_EXCL_BR_LINE 4: nsfw error
+ estatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, "NS_ANY_SRC", kTimerPcbhs, _countof(kTimerPcbhs)); // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+ if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ /* When registration fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "FrameworkunifiedAttachCallbacksToDispatcher ERROR [status:%d]", estatus);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 4: nsfw error
+ }
+
+ /* Initialization of timer control table */
+ for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) {
+ TimerSetCidOfCtrlTbl(idx, static_cast<CID>(kTimerPcbhs[idx].iCmd)); /* Set timer control CID */ // LCOV_EXCL_BR_LINE 200: no branch // NOLINT(whitespace/line_length)
+
+ /* Initialize timeout */
+ TimerSetTimeOutOfCtrlTbl(idx, 0); // LCOV_EXCL_BR_LINE 200: no branch
+
+ *p_h_service = McOpenSender("Positioning"); /* Be intended for use only in Positioning */ // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+
+ /* Create Timer Resource */
+ timer_info.iCmd = TimerGetCidOfCtrlTbl(idx); /* Only CID needs to be set. */ // LCOV_EXCL_BR_LINE 200: no branch
+ h_timer = NS_TimerCreate(timer_info, CALLBACK_MESSAGE, (HANDLE)*p_h_service); // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
+ if (h_timer == NULL) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When an error occurs */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "NS_TimerCreate ERROR [h_timer:%p, hService:%p]", h_timer, *p_h_service);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ /* If successful */
+ /* Set Handle information */
+ TimerSetTimerHandleOfCtrlTbl(idx, h_timer); // LCOV_EXCL_BR_LINE 200: no branch
+ }
+ }
+ }
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Terminate timer function
+ *
+ * @return Normal completion
+ */
+RET_API TimerTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API ret_api = RET_NORMAL;
+ u_int32 idx;
+ HANDLE h_timer;
+ EFrameworkunifiedStatus estatus;
+ HANDLE* p_h_service = &g_h_service;
+
+ /* If a control Mutex has not been created, it is determined that the Timer function has not been initialized (non Positioning processes) and the process terminates with an error. */
+ if (g_h_mtx == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_h_mtx is NULL!!");
+ ret_api = RET_ERROR;
+ } else {
+ /* Delete timer control information */
+ for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) {
+ h_timer = TimerGetTimerHandleOfCtrlTbl(idx);
+ if (h_timer != NULL) {
+ /* Delete timer */
+ estatus = NS_TimerDelete(h_timer);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ /* When an error occurs */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, \
+ "NS_TimerDelete ERROR [estatus:%d, h_timer:%p]", estatus, h_timer);
+ }
+ TimerSetTimerHandleOfCtrlTbl(idx, NULL);
+ }
+
+ TimerClearSettingOfCtrlTbl(idx);
+ }
+
+ /* Mutex deletion */
+ TimerDeleteMutex();
+ }
+
+ /* Delete transmission handle */
+ estatus = McClose(*p_h_service);
+ if (estatus != eFrameworkunifiedStatusOK) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McClose ERROR [estatus:%d, hService:%p]", \
+ estatus, *p_h_service);
+ }
+
+ return ret_api;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Fixed period/asynchronous timer start instruction
+ *
+ * @param[in] snd_pno Requesting process number
+ * @param[in] timer_seq Timer sequence number
+ * @param[in] TimerType Timer type
+ * @param[in] time_out Timeout value [10ms]
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR Message transmission error<br>
+ * RET_ERRPARAM Parameter error
+ */
+RET_API _pb_ReqTimerStart(PNO snd_pno, u_int16 timer_seq, // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ u_int8 time_type, u_int32 time_out) {
+ RET_API ret_api = RET_NORMAL; /* Return value of this module */
+ u_int32 idx;
+ TimerToutMsg *p_msg;
+ EFrameworkunifiedStatus estatus;
+ HANDLE h_timer;
+ NSTimerInfo timer_info;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ /* If a control Mutex has not been created, it is determined that the Timer function has not been initialized (non Positioning processes) and the process terminates with an error. */
+ if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 6: g_h_mtx cannot be null
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_h_mtx is NULL!!");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 6: g_h_mtx cannot be null
+ } else {
+ /* Parameter study */
+ if ((time_type != TIMER_TYPE_SYN) && (time_type != TIMER_TYPE_USN)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [time_type:%d]", time_type);
+ ret_api = RET_ERRPARAM; /* Timer type error */
+ }
+
+ if (time_out == 0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [time_out:%d]", time_out);
+ ret_api = RET_ERRPARAM; /* Timer setting value error */
+ }
+
+ /* When a timer of the same process number, sequence number, or type is already registered, creation of the timer is not allowed. */
+ idx = TimerSearchTimerOfCtrlTbl(snd_pno, timer_seq, time_type);
+ if (idx != MAX_CTRL_TIMER_NUM) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TimerSearchTimerOfCtrlTbl ERROR!! " \
+ "[snd_pno:%d, timer_seq:%d, TimeType:%d]", snd_pno, timer_seq, time_type);
+ ret_api = RET_ERRPARAM; /* Invalid timer value */
+ }
+
+ /* Parameter normal */
+ if (ret_api == RET_NORMAL) {
+ TimerLockMutex(); /* Get Mutex */
+
+ /* Get free space in timer control table */
+ idx = TimerSearchEmptyOfCtrlTbl(); // LCOV_EXCL_BR_LINE 200: no branch
+ if (idx == MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 200: idx can not be MAX_CTRL_TIMER_NUM
+ // LCOV_EXCL_START 200: idx can not be MAX_CTRL_TIMER_NUM
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When there is no free space */
+ /* Be impossible by design */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TimerSearchEmptyCtrlTbl ERROR!! " \
+ "[idx = %d]", idx);
+ _pb_Exit();
+ /* don't arrive here. */
+ // LCOV_EXCL_STOP
+ }
+
+ /* Get message buffer address */
+ p_msg = TimerGetMsgBufOfCtrlTbl(idx);
+
+ TIMER_MAKE_DEFAULT_MESSAGE(p_msg); /* Set message data to be send */
+ p_msg->TimerSeq = timer_seq; /* Timer sequence number */
+
+ /* Set callback function information in timer control table */
+ TimerSetPnoOfCtrlTbl(idx, snd_pno); // LCOV_EXCL_BR_LINE 200: no branch
+ TimerSetSizeOfCtrlTbl(idx, sizeof(TimerToutMsg)); // LCOV_EXCL_BR_LINE 200: no branch
+ TimerSetTypeOfCtrlTbl(idx, time_type); // LCOV_EXCL_BR_LINE 200: no branch
+ TimerSetSeqNoOfCtrlTbl(idx, timer_seq); // LCOV_EXCL_BR_LINE 200: no branch
+ TimerSetTimeOutOfCtrlTbl(idx, time_out); // LCOV_EXCL_BR_LINE 200: no branch
+
+ /* Set timer value */
+ timer_info.t_sec = (uint32_t)((10 * time_out) / 1000);
+ /* Coverity CID: 21979 compliant */
+ timer_info.t_nsec = ((10 * (uint64_t)time_out) - ((uint64_t)(timer_info.t_sec) * 1000)) * 1000 * 1000;
+ timer_info.iCmd = TimerGetCidOfCtrlTbl(idx);
+ timer_info.rpt_sec = 0;
+ timer_info.rpt_nsec = 0;
+ if (time_type == TIMER_TYPE_SYN) {
+ timer_info.rpt_sec = timer_info.t_sec;
+ timer_info.rpt_nsec = timer_info.t_nsec;
+ }
+
+ h_timer = TimerGetTimerHandleOfCtrlTbl(idx);
+
+ /* Start timer */
+ estatus = NS_TimerSetTime(h_timer, timer_info); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if ((h_timer == NULL) || (estatus != eFrameworkunifiedStatusOK)) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When an error occurs */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NS_TimerSetTime ERROR " \
+ "[estatus:%d, h_timer:%p]", estatus, h_timer);
+
+ TimerClearSettingOfCtrlTbl(idx); /* Clear timer information */
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ /* If successful */
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### TIMER TABLE INFORMATION # " \
+ "(++) idx:%d cid:%d h_timer:%p pno:%d seq_no:%d type:%d time_out:%d", \
+ idx, g_timer_ctrl_tbl[idx].cid, g_timer_ctrl_tbl[idx].h_timer, g_timer_ctrl_tbl[idx].pno, \
+ g_timer_ctrl_tbl[idx].seq_no, g_timer_ctrl_tbl[idx].type, g_timer_ctrl_tbl[idx].time_out);
+ }
+
+ TimerUnlockMutex(); /* Release Mutex */ // LCOV_EXCL_BR_LINE 200: no branch
+ }
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return ret_api;
+}
+
+/**
+ * @brief
+ * Timer stop instruction
+ *
+ * @param[in] snd_pno Requesting process number
+ * @param[in] timer_seq Timer sequence number
+ * @param[in] time_r_type Timer type<br>
+ * TIMER_TYPE_SYN Fixed-period timer<br>
+ * TIMER_TYPE_USN Asynchronous timer<br>
+ * TIMER_TYPE_ALM Alerm with specified time <br>
+ *
+ * @return RET_NORMAL Normal completion<br>
+ * RET_ERROR Message transmission error<br>
+ * RET_ERRPARAM Parameter error
+ */
+RET_API _pb_TimerStop(PNO snd_pno, u_int16 timer_seq, // NOLINT(readability/nolint) WPF_SYSAPI.h API
+ u_int8 time_type) {
+ RET_API ret_api = RET_NORMAL; /* Return value of this module */
+ u_int32 idx;
+ EFrameworkunifiedStatus estatus;
+ HANDLE h_timer;
+ const NSTimerInfo timer_info = {0};
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ /* If a control Mutex has not been created, it is determined that the Timer function has not been initialized (non Positioning processes) and the process terminates with an error. */
+ if (g_h_mtx == NULL) { // LCOV_EXCL_BR_LINE 6: g_h_mtx cannot be NULL
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "g_h_mtx is NULL!!");
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ ret_api = RET_ERROR; // LCOV_EXCL_LINE 6: g_h_mtx cannot be NULL
+ } else {
+ TimerLockMutex(); /* Get Mutex */ // LCOV_EXCL_BR_LINE 200: no branch
+
+ idx = TimerSearchTimerOfCtrlTbl(snd_pno, timer_seq, time_type);
+ if (idx == MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 200: idx can not be MAX_CTRL_TIMER_NUM
+ /* When the specified timer is not set */
+ /* nop */
+ } else {
+ h_timer = TimerGetTimerHandleOfCtrlTbl(idx);
+
+ /* Stop timer */
+ estatus = NS_TimerSetTime(h_timer, timer_info); // LCOV_EXCL_BR_LINE 4: nsfw error
+ if (estatus != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: nsfw error
+ // LCOV_EXCL_START 4: nsfw error
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /* When deletion fails */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NS_TimerSetTime ERROR " \
+ "[estatus:%d, h_timer:%p]", estatus, h_timer);
+ ret_api = RET_ERROR;
+ // LCOV_EXCL_STOP
+ } else {
+ /* If successful */
+ /* Clear timer information */
+ TimerClearSettingOfCtrlTbl(idx); // LCOV_EXCL_BR_LINE 200: no branch
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### TIMER TABLE INFORMATION # " \
+ "(--) idx:%d cid:%d h_timer:%p pno:%d seq_no:%d type:%d time_out:%d", \
+ idx, g_timer_ctrl_tbl[idx].cid, g_timer_ctrl_tbl[idx].h_timer, g_timer_ctrl_tbl[idx].pno, \
+ g_timer_ctrl_tbl[idx].seq_no, g_timer_ctrl_tbl[idx].type, g_timer_ctrl_tbl[idx].time_out);
+ }
+ }
+
+ TimerUnlockMutex(); /* Release Mutex */ // LCOV_EXCL_BR_LINE 200: no branch
+ }
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return ret_api;
+}
+
+/*---------------------------------------------------------------------------------*
+ * Local Function *
+ *---------------------------------------------------------------------------------*/
+/**
+ * @brief
+ * Timer CID setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Control table accessor
+ * @param[in] cid Command ID
+ */
+static void TimerSetCidOfCtrlTbl(u_int32 idx, CID cid) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].cid = cid;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timer CID acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ *
+ * @return Command ID
+ */
+static CID TimerGetCidOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].cid;
+}
+
+/**
+ * @brief
+ * PNO setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ * @param[in] pno Process number
+ */
+static void TimerSetPnoOfCtrlTbl(u_int32 idx, PNO pno) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \
+ "[idx:%d, pno:%d]", idx, pno);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].pno = pno;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * PNO acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ *
+ * @return Process number
+ */
+static PNO TimerGetPnoOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].pno;
+}
+
+/**
+ * @brief
+ * Message size setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ * @param[in] size Message size
+ */
+static void TimerSetSizeOfCtrlTbl(u_int32 idx, u_int16 size) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \
+ "[idx:%d, size:%d]", idx, size);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].size = size;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Message buffer acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ *
+ * @return Pointer to message storage area
+ */
+static TimerToutMsg* TimerGetMsgBufOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return &(g_timer_ctrl_tbl[idx].msg_buf);
+}
+
+/**
+ * @brief
+ * Timer handle setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ * @param[in] handle Timer handle
+ */
+static void TimerSetTimerHandleOfCtrlTbl(u_int32 idx, HANDLE handle) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \
+ "[idx:%d, handle:%p]", idx, handle);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].h_timer = handle;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timer handle acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ *
+ * @return Timer handle
+ */
+static HANDLE TimerGetTimerHandleOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].h_timer;
+}
+
+/**
+ * @brief
+ * Timer type setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ * @param[in] type Timer type
+ */
+static void TimerSetTypeOfCtrlTbl(u_int32 idx, u_int8 type) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \
+ "[idx:%d, type:%d]", idx, type);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].type = type;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timer type acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ *
+ * @return Timer handle
+ */
+static u_int8 TimerGetTypeOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].type;
+}
+
+/**
+ * @brief
+ * Timer sequence number setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ * @param[in] seq_no Timer Sequence Number
+ */
+static void TimerSetSeqNoOfCtrlTbl(u_int32 idx, u_int16 seq_no) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR " \
+ "[idx:%d, seq_no:%d]", idx, seq_no);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].seq_no = seq_no;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timer sequence number acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table accessor
+ */
+static u_int16 TimerGetSeqNoOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].seq_no;
+}
+
+/**
+ * @brief
+ * Timeout setting (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table access Index
+ * @param[in] time_out Timeout
+ */
+static void TimerSetTimeOutOfCtrlTbl(u_int32 idx, u_int32 time_out) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d, " \
+ "time_out:%d]", idx, time_out);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6: idx cannot greater
+ /* don't arrive here. */
+ } else {
+ g_timer_ctrl_tbl[idx].time_out = time_out;
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timeout acquisition (Timer control table)
+ *
+ * If an invalid value is specified for an argument, the system assumes that it is a design problem and calls _pb_Exit().
+ *
+ * @param[in] idx Timer control table access Index
+ *
+ * @return Timeout value
+ */
+static u_int32 TimerGetTimeOutOfCtrlTbl(u_int32 idx) {
+ /* check index */
+ if (idx >= MAX_CTRL_TIMER_NUM) { // LCOV_EXCL_BR_LINE 6: idx cannot greater
+ /* forbidden */
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argment ERROR [idx:%d]", idx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 6:idx cannot greater
+ /* don't arrive here. */
+ }
+
+ return g_timer_ctrl_tbl[idx].time_out;
+}
+
+/**
+ * @brief
+ * Retreaval of unused area in the timer control table (Timer control table)
+ *
+ * Return the lowest-numbered index for accessing unused space in the Timer control table.
+ * If the mutex is not registered, the maximum timer management value (MAX_CTRL_MUTEX_NUM)
+ * is returned.
+ *
+ * @return Table accessor
+ */
+static u_int32 TimerSearchEmptyOfCtrlTbl(void) {
+ u_int32 idx;
+ u_int32 time_out;
+
+ for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) {
+ time_out = TimerGetTimeOutOfCtrlTbl(idx);
+
+ /* For unused space */
+ if (time_out == 0) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Retrieval of specified timer for in the timer control table (Timer control table)
+ *
+ * Retrieve whether the specified timer is already registered in the timer control table.
+ * If it is registered, the access index is returned. If it is not registered,
+ * Return the maximum value of timer management (MAX_CTRL_TIMER_NUM).
+ *
+ * @param[in] snd_pno Process number
+ * @param[in] TimerSeq Timer sequence number
+ * @param[in] TimeType Timer type
+ *
+ * @return Index for access(If it is registered)<br>
+ * Maximum mutex management value (Not registered)
+ */
+static u_int32 TimerSearchTimerOfCtrlTbl(PNO snd_pno, u_int16 TimerSeq, u_int8 TimeType) {
+ u_int32 idx;
+ PNO pno;
+ u_int16 seq_no;
+ u_int8 type;
+
+ for (idx = 0; idx < MAX_CTRL_TIMER_NUM; idx++) {
+ pno = TimerGetPnoOfCtrlTbl(idx);
+ seq_no = TimerGetSeqNoOfCtrlTbl(idx);
+ type = TimerGetTypeOfCtrlTbl(idx);
+
+ /* If there is a match */
+ if ((pno == snd_pno) && (seq_no == TimerSeq) && (type == TimeType)) {
+ break;
+ }
+ }
+
+ return idx;
+}
+
+/**
+ * @brief
+ * Clear timer setting information
+ *
+ * @param[in] idx Timer control table accessor
+ */
+static void TimerClearSettingOfCtrlTbl(u_int32 idx) {
+ void *p_msg;
+
+ /* Delete timer information */
+ TimerSetPnoOfCtrlTbl(idx, 0);
+ TimerSetSizeOfCtrlTbl(idx, 0);
+ TimerSetTypeOfCtrlTbl(idx, 0);
+ TimerSetSeqNoOfCtrlTbl(idx, 0);
+ TimerSetTimeOutOfCtrlTbl(idx, 0);
+ p_msg = TimerGetMsgBufOfCtrlTbl(idx);
+ memset(p_msg, 0x00, sizeof(TimerToutMsg));
+
+ return;
+}
+
+/**
+ * @brief
+ * Create Mutex for accessing the timer control table
+ */
+static void TimerCreateMutex(void) {
+ g_h_mtx = _pb_CreateMutex(NULL, 0, "Timer_Mutex");
+ if (g_h_mtx == NULL) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateMutex ERROR " \
+ "[g_h_mtx:%p]", g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Delete Mutex for accessing timer control table
+ */
+static void TimerDeleteMutex(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ DWORD ret;
+
+ ret = PbDeleteMutex(g_h_mtx);
+ if (ret != WAIT_OBJECT_0) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbDeleteMutex ERROR " \
+ "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx);
+ _pb_Exit();
+ /* don't arrive here. */
+ }
+
+ return;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Get Mutex for accessing timer control table
+ */
+static void TimerLockMutex(void) {
+ DWORD ret;
+
+ ret = PbMutexLock(g_h_mtx, INFINITE); // LCOV_EXCL_BR_LINE 200: lock will not failed
+ if (ret != WAIT_OBJECT_0) { // LCOV_EXCL_BR_LINE 200: lock will not failed
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexLock ERROR " \
+ "[ret:%lu, g_h_mtx:%p]", ret, g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: lock will not failed
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Release Mutex for accessing timer control table
+ */
+static void TimerUnlockMutex(void) {
+ BOOL ret;
+
+ ret = PbMutexUnlock(g_h_mtx); // LCOV_EXCL_BR_LINE 200: unlock will not failed
+ if (ret != TRUE) { // LCOV_EXCL_BR_LINE 200: unlock will not failed
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PbMutexUnlock ERROR " \
+ "[ret:%d, g_h_mtx:%p]", ret, g_h_mtx);
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ _pb_Exit(); // LCOV_EXCL_LINE 200: unlock will not failed
+ /* don't arrive here. */
+ }
+
+ return;
+}
+
+/**
+ * @brief
+ * Timer Expiration Callback Functions
+ *
+ * For setting the timer creation function (NS_TimerCreate)<br>
+ * TimerCallback1 ... TimerCallback8
+ *
+ * @param[in] h_app Application handle
+ *
+ * @return eFrameworkunifiedStatusOK Normal completion
+ */
+static EFrameworkunifiedStatus TimerCallback1(HANDLE h_app) {
+ static const u_int8 ID = 0;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback2(HANDLE h_app) {
+ static const u_int8 ID = 1;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback3(HANDLE h_app) {
+ static const u_int8 ID = 2;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback4(HANDLE h_app) {
+ static const u_int8 ID = 3;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback5(HANDLE h_app) {
+ static const u_int8 ID = 4;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback6(HANDLE h_app) {
+ static const u_int8 ID = 5;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback7(HANDLE h_app) {
+ static const u_int8 ID = 6;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static EFrameworkunifiedStatus TimerCallback8(HANDLE h_app) {
+ static const u_int8 ID = 7;
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "+");
+
+ TimerCallbackComProc(ID);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "-");
+
+ return eFrameworkunifiedStatusOK;
+}
+
+static void TimerCallbackComProc(const uint8_t id) {
+ uint8_t type;
+
+ TimerLockMutex(); /* Get Mutex */
+
+ /* Message is sent to the thread specified when the timer is created. */
+ (void)_pb_SndMsg(g_timer_ctrl_tbl[id].pno, g_timer_ctrl_tbl[id].size, &(g_timer_ctrl_tbl[id].msg_buf), 0);
+
+ type = TimerGetTypeOfCtrlTbl(id);
+ if (type == TIMER_TYPE_USN) {
+ /* One-shot timer */
+ /* Clear timer information */
+ TimerClearSettingOfCtrlTbl(id);
+
+ FRAMEWORKUNIFIEDLOG(ZONE_20, __FUNCTION__, "### TIMER TABLE INFORMATION # " \
+ "(--) idx:%d cid:%d h_timer:%p pno:%d seq_no:%d type:%d time_out:%d", \
+ id, g_timer_ctrl_tbl[id].cid, g_timer_ctrl_tbl[id].h_timer, g_timer_ctrl_tbl[id].pno, \
+ g_timer_ctrl_tbl[id].seq_no, g_timer_ctrl_tbl[id].type, g_timer_ctrl_tbl[id].time_out);
+ }
+
+ TimerUnlockMutex(); /* Release Mutex */
+
+ return;
+}
+
+/**
+ * @brief
+ * Get dump information
+ *
+ * @param[out] p_buf Dump info
+ */
+void _pb_GetDebugTimerMngTbl(void* p_buf) {
+ static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
+ static uint8_t buf_tmp[256];
+ uint32_t i;
+
+ if (p_buf != NULL) {
+ memset(&buf, 0x00, sizeof(buf));
+ snprintf(reinterpret_cast<char *>(&(buf)), sizeof(buf), "Timer");
+ for (i = 0; i < MAX_CTRL_TIMER_NUM; i++) {
+ memset(&buf_tmp[0], 0x00, sizeof(buf_tmp));
+ snprintf(reinterpret_cast<char *>(&buf_tmp[0]), sizeof(buf_tmp),
+ "\n [%d] cid:%05d, hTim:%10p, sz:%05d, pno:0x%04x, seq:0x%04x, typ:%03d, tOut:%10d",
+ i,
+ g_timer_ctrl_tbl[i].cid,
+ g_timer_ctrl_tbl[i].h_timer,
+ g_timer_ctrl_tbl[i].size,
+ g_timer_ctrl_tbl[i].pno,
+ g_timer_ctrl_tbl[i].seq_no,
+ g_timer_ctrl_tbl[i].type,
+ g_timer_ctrl_tbl[i].time_out);
+ strncat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&buf_tmp[0]), \
+ strlen(reinterpret_cast<char *>(&buf_tmp[0])));
+ }
+ memcpy(p_buf, &buf[0], sizeof(buf));
+ }
+} // LCOV_EXCL_BR_LINE 10:The final line
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp
new file mode 100755
index 0000000..2111b3a
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/_pbWaitforsingleobject.cpp
@@ -0,0 +1,358 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************
+@file waitforsingleobject.cpp
+@detail Functions that implement waitforsingleobject in PosixBasedOS001<BR>
+ Functions to register/delete a table to determine the handle and its type
+*****************************************************************************/
+
+#include "_pbWaitforsingleobject.h"
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+#include "_pbInternalProc.h"
+
+typedef struct HandleTypeTable {
+ HANDLE h_handle; /* Registration handle */
+ HANDLE_KIND l_kind; /* Type of Mutex/Semaphre/Event... */
+ struct HandleTypeTable *next;
+} HANDLE_TYPE;
+
+static HANDLE_TYPE *g_pst_handle_kind_table = NULL;
+static pthread_mutex_t g_func_lock_mutex = PTHREAD_MUTEX_INITIALIZER; /* Consider replacing it later */
+
+/* Prototype declarations */
+static BOOL FindList(HANDLE_TYPE **p_list, HANDLE h_obj);
+static BOOL AddList(HANDLE_TYPE *p_add_list);
+static BOOL DelList(HANDLE_TYPE *h_del_obj);
+static BOOL FunctionLock(void);
+static BOOL FunctionUnlock(void);
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* Public APIs
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* _sys Internally Used APIs
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+@brief WaitObjectInit<BR>
+ Initialization processing for each process
+@outline WaitObjectInit<BR>
+ Initialization processing for each process
+@type Completion return type
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL WaitObjectInit(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ g_pst_handle_kind_table = NULL;
+ return TRUE;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief WaitObjectTerm<BR>
+ Termination processing for each process
+@outline WaitObjectTerm<BR>
+ Termination processing for each process
+@type Completion return type
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+BOOL WaitObjectTerm(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (NULL != g_pst_handle_kind_table) {
+ /* Should be Deleted a List? */
+ }
+ return TRUE;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief WaitObjectAdd<BR>
+ Register a handle and a handle-type in a list
+@outline WaitObjectAdd<BR>
+ Register a handle and a handle-type in a list
+@type Completion return type
+@param[in] HANDLE h_obj : Handle to register
+@param[in] HANDLE_KIND l_kind : Handle type
+
+@return BOOL
+@retval TRUE : Normal
+ FALSE : Error
+*****************************************************************************/
+BOOL WaitObjectAdd(HANDLE h_obj, HANDLE_KIND l_kind) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ HANDLE_TYPE *p_add_list = NULL;
+
+ if ((NULL != h_obj)
+ && (PB_HANDLE_INVAL < l_kind)
+ && (PB_HANDLE_KIND_MAX > l_kind)) {
+ FunctionLock();
+ bret = FindList(&p_add_list, h_obj);
+ if (TRUE == bret) {
+ /* Handle already registered */
+ if (l_kind == p_add_list->l_kind) {
+ /* re-register the same item */
+ bret = TRUE;
+ } else {
+ /* An attempt was made to re-register the same handle with different type */
+ bret = FALSE; /** Consider whether to win or not later */
+ }
+ } else {
+ p_add_list = reinterpret_cast<HANDLE_TYPE*>(malloc(sizeof(HANDLE_TYPE)));
+ if (NULL == p_add_list) {
+ /* Memory acquisition failed */
+ bret = FALSE;
+ } else {
+ memset(p_add_list, 0, sizeof(HANDLE_TYPE));
+ p_add_list->h_handle = h_obj;
+ p_add_list->l_kind = l_kind;
+ p_add_list->next = NULL;
+ bret = AddList(p_add_list);
+ if (FALSE == bret) {
+ /* Registration failure */
+ free(p_add_list);
+ bret = FALSE;
+ } else {
+ bret = TRUE;
+ }
+ }
+ }
+
+ FunctionUnlock();
+
+ } else {
+ bret = FALSE; /** Parameter error */
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief WaitObjectDel<BR>
+ Remove handle and handle-type from the list
+@outline WaitObjectDel<BR>
+ Remove handle and handle-type from the list
+@type Completion return type
+@param[in] HANDLE h_obj : Handle to delete
+
+@return BOOL
+@retval TRUE : Normal
+ FALSE : Error
+*****************************************************************************/
+BOOL WaitObjectDel(HANDLE h_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ HANDLE_TYPE *p_del_list = NULL;
+
+ if (NULL != h_obj) {
+ FunctionLock();
+ bret = FindList(&p_del_list, h_obj);
+ if (TRUE == bret) {
+ /* handle already registered */
+ if (TRUE == DelList(p_del_list)) {
+ free(p_del_list);
+ bret = TRUE;
+ } else {
+ bret = FALSE;
+ }
+ } else {
+ bret = FALSE; /* no handles */
+ }
+
+ FunctionUnlock();
+
+ } else {
+ bret = FALSE; /* Parameter error */
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* Private API
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+@brief FindList<BR>
+ Searching for a Handle in the List
+@outline FindList<BR>
+ Searching for a Handle in the List
+@type Completion return type
+@param[out] HANDLE_TYPE** p_list : Found list pointer
+@param[in] HANDLE h_obj : Handle to look for
+
+@return BOOL
+@retval TRUE : Normal (p_list != NULL)
+ FALSE : Error (p_list == NULL)
+*****************************************************************************/
+static BOOL FindList(HANDLE_TYPE **p_list, HANDLE h_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ HANDLE_TYPE *p_now = NULL;
+ BOOL bret = FALSE;
+
+ if ((NULL != h_obj) && (NULL != p_list)) {
+ /* Search list */
+ p_now = g_pst_handle_kind_table;
+ while (NULL != p_now) {
+ /* h_obj and p_now->h_handle are pointer type.*/
+ if ((int64_t)h_obj == (int64_t)p_now->h_handle) {
+ *p_list = p_now;
+ bret = TRUE;
+ break;
+ }
+ p_now = p_now->next;
+ }
+ } else {
+ bret = FALSE; /** Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief AddList<BR>
+ Append data to the end of the list
+@outline AddList<BR>
+ Append data to the end of the list
+@type Completion return type
+@param[in] HANDLE_TYPE* p_list : Data to add
+
+@return BOOL
+@retval TRUE : Normal
+ FALSE : Error
+*****************************************************************************/
+static BOOL AddList(HANDLE_TYPE *p_add_list) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ HANDLE_TYPE *p_now = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != p_add_list) {
+ /* Add unregistered data */
+ if (NULL == g_pst_handle_kind_table) {
+ g_pst_handle_kind_table = p_add_list;
+ bret = TRUE;
+ } else {
+ /* Add to end of list */
+ p_now = g_pst_handle_kind_table;
+ while (NULL != p_now) {
+ if (NULL == p_now->next) {
+ p_now->next = p_add_list;
+ bret = TRUE;
+ break;
+ }
+ p_now = p_now->next;
+ }
+ }
+ } else {
+ bret = FALSE; /** Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief DelList<BR>
+ Remove specified data from a List
+@outline DelList<BR>
+ Remove specified data from a List
+@type Completion return type
+@param[in,out] HANDLE_TYPE* h_del_obj :
+
+@return BOOL
+@retval TRUE : Normal
+ FALSE : End
+*****************************************************************************/
+static BOOL DelList(HANDLE_TYPE *h_del_obj) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ HANDLE_TYPE *p_now = NULL;
+ HANDLE_TYPE *pBef = NULL;
+ BOOL bret = FALSE;
+
+ if (NULL != h_del_obj) {
+ /* Add to end of list */
+ p_now = g_pst_handle_kind_table;
+ while (NULL != p_now) {
+ if (h_del_obj == p_now) {
+ if (NULL == pBef) {
+ /* Delete first */
+ g_pst_handle_kind_table = p_now->next;
+ } else {
+ /* Others */
+ pBef->next = h_del_obj->next;
+ }
+ bret = TRUE;
+ break;
+ }
+ pBef = p_now;
+ p_now = p_now->next;
+ }
+ } else {
+ bret = FALSE; /** Parameter error */
+ }
+
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief FunctionLock<BR>
+ Start locking of g_pst_handle_kind_table
+@outline FunctionLock<BR>
+ Start locking of g_pst_handle_kind_table
+@type Completion return type
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL FunctionLock(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ if (EOK == pthread_mutex_lock(&g_func_lock_mutex)) {
+ bret = TRUE;
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
+/****************************************************************************
+@brief FunctionUnlock<BR>
+ Terminate locking of g_pst_handle_kind_table
+@outline FunctionUnlock<BR>
+ Terminate locking of g_pst_handle_kind_table
+@type Completion return type
+@return BOOL
+@retval TRUE : Normal
+@retval FALSE : Error
+*****************************************************************************/
+static BOOL FunctionUnlock(void) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ BOOL bret = FALSE;
+ if (EOK == pthread_mutex_unlock(&g_func_lock_mutex)) {
+ bret = TRUE;
+ }
+ return bret;
+}
+// LCOV_EXCL_STOP
+
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp
new file mode 100755
index 0000000..204c516
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/memcpy_64p_sync.cpp
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vehicle_service/positioning_base_library.h>
+
+
+#include "WPF_STD_private.h"
+void* Memcpy64pSync(void* dest, const void* src, size_t count) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return _pb_memcpy(dest, src, count);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp b/video_in_hal/vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp
new file mode 100755
index 0000000..ad6c11e
--- /dev/null
+++ b/video_in_hal/vehicleservice/positioning_base_library/library/src/memset_64p_sync.cpp
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <vehicle_service/positioning_base_library.h>
+#include "WPF_STD_private.h"
+
+void* Memset64pSync(void* dest, int c, size_t count) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return _pb_memset(dest, c, count);
+}
+// LCOV_EXCL_STOP
diff --git a/video_in_hal/vehicleservice/vehicle_service.mk b/video_in_hal/vehicleservice/vehicle_service.mk
new file mode 100755
index 0000000..40d337f
--- /dev/null
+++ b/video_in_hal/vehicleservice/vehicle_service.mk
@@ -0,0 +1,42 @@
+#############################################################
+#
+# Common Makefile for vehicle_service
+# Copyright (C) 2017-2019 TOYOTA MOTOR CORPORATION
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################
+
+CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+#############################################################
+# COMPONENT_NAME must not be blank and be named snake_case
+
+COMPONENT_NAME := vehicle_service
+
+#############################################################
+
+#############################################################
+# You can add several flags and libraries.
+# When you add -I or -L path, DO NOT USE relative path.
+# Instead, use $(CURRENT_DIR) variable
+# that indicates the path this .mk file is stored.
+
+COMPONENT_CFLAGS :=
+COMPONENT_CXXFLAGS :=
+COMPONENT_LDLIBS :=
+COMPONENT_LDFLAGS :=
+
+##############################################################
+
+include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk